| Commit message (Collapse) | Author | Age | Files | Lines |
| ... | |
| |
|
|
|
|
|
| |
* #52 Update chapter8 to align with chapter7
* #52 Update chapter8 to align with chapter7
* #52 Fix spacing
|
| |
|
|
|
|
|
|
|
|
|
| |
* #44 Revise docs and comments
* #44 Add starting scope to xScopes
* #44 back some of the code refactoring port to previous chapters
* #44 add_def should not be public
* #44 add_def should not be public. Rename method names so that they are camelcase
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* #44 Start on chapter 7
* #44
Temp hack on printing to not break on cycles.
Parse while statement.
* #44 Remove unnecessary method
* #44 Remove unnecessary phi map
* #44 Phi should have existing nodes from both scopes as input
* #44 We need to only insert phis once for each name that is looked up. To do so,
we need to know when a named is looked up first time inside the loop body.
The phi must have its second input added later on after the loop is fully parsed.
* #44 Add phi also when update() is called.
Only add phi if name was known at loop start
* #44 Only create phi in loop body if var binding in head != body.
During finish() lookup in body directly.
* #44 Update the print output to make it similar to that in Xmilia's fork
* #44 Disable peephole for phis & region involved in while loop
* Fix broken tests
Remove "disablePeephole" set in some tests, and remaining set for other tests, so a bulk test-all fails because disablePeephole is true for all.
Reset disablePeephole in Node.reset
Switch HashSet for BitSet (touches all).
* Restructure Node class
Group printing, group node & edge manipulations, group optimizations.
Also, fix LoopRegion idom, it does not use Region idom but uses the original
* #44 Node printing
* #44 Node printing
* #44 Fix control edges in loop region
Change label of loop region
Fix the output count in dump
* #44 Revise dump output
* #44 When a LoopRegionNode is duplicated, ensure the dupe is also a LoopRegionNode
* #44 When a LoopScopeNode is merged, we merge the names set too
* #44 When a LoopScopeNode is merged, we merge the names set too
* #44 Fix print1() on RegionNode to use label()
* #44 Fix bug caused by incorrect comparison of nodes between body and head of loop; the check must be performed before any phis are created
* Revert "#44 Fix bug caused by incorrect comparison of nodes between body and head of loop; the check must be performed before any phis are created"
This reverts commit 5f729709855046c5c10904f08385fd1aec9a298a.
* #44 Fix bug caused by incorrect comparison of nodes between body and head of loop; the check must be performed before any phis are created
* #44 when we create a phi incrementally for a loop region, all scopes that are cloned from the original must get the same phi update
* #44 test case
* #44 test case
* Squashed commit of the following:
commit 15666e287e6bbc39b3fcc49939165a1e908d43b2
Author: Cliff Click <cliffc@acm.org>
Date: Mon Nov 27 09:45:40 2023 -0800
lazy/eager phis
Eager phis by default, but can flip Parser.LAZY to switch to lazy phis. Several tests golden answers change when flipping this flag due to minor node renumbering.
Phi combines same_inputs and singleUniqueInput.
Fancier basic-block-like printing. Uses isMultiHead & isMultiTail which show up in many Nodes.
Remove blanks in triple-quote strings.
commit 6ea70182a92b7db4fe5a1fdc2c4491842ef77ee5
Author: Cliff Click <cliffc@acm.org>
Date: Sun Nov 26 11:13:22 2023 -0800
Remove dead scopes
Add a debug find
commit a52c06a47bf1e56866d8b4d043290838f053ad76
Author: Cliff Click <cliffc@acm.org>
Date: Sun Nov 26 10:21:48 2023 -0800
No constraints on backedges
nicer loopy graphs
commit b5ab550098355f0b66bf24b40adf2e5ba4d86e4e
Author: Cliff Click <cliffc@acm.org>
Date: Sun Nov 26 10:13:22 2023 -0800
Fix regression
commit 30a7f5c734c686c02d3ca479914c9427b65cc469
Author: Cliff Click <cliffc@acm.org>
Date: Sat Nov 25 21:51:47 2023 -0800
minor cleanup
commit ad742b795ce0c93cfc82b2b11740261cfd923d02
Author: Cliff Click <cliffc@acm.org>
Date: Sat Nov 25 21:47:05 2023 -0800
Fixes lazy phi
Scope now takes a 'loop' option on dupping; the dup'ed Scope is filled with "Lazy Phi" sentinels - markers to indicate a Phi is need if this variable is ever referenced. If its never referenced, at the loop exit the "Lazy Phi" unwinds back to the original value. Lookup and update calls lazily insert concrete Phis over "Lazy Phis" at first touch.
Rename _allScopes to _xScopes its "active" not "all" scopes now.
Remove try/finally block at end, because a compiler bug throws, then attempts a GraphViz on a broken graph, then throws again, hiding the original bug.
Removed 1 extra layer of Scopes.
Scope printing now prints in edge order; added a reversemap for printing.
More touches to ascii printing.
* Remove flag to parseBlock
* Bugfix for lazy on empty loop body
Remove extra phi name-matching code
* Keep head alive until entire end_loop merging is done
* Create chapter 8 as a copy of chapter 7
* #44 Chapter 7 is now eager phis only (#46)
* #44 Chapter 7 is now eager phis only
* MOVE IR Printing to dedicated class to declutter Node. Remove Ary (#49)
* #44 Move IR printing to dedicated class to declutter Node, and remove Ary
* #44 refactor Node.delUse() to use common del()
* #44 Some cleanups
* #44 Some cleanups
* #44 Some cleanups
* #44 Some cleanups
* Revert "#44 Some cleanups"
This reverts commit 2702c338c8bdaa5ef2128000e26f1a8496baf34a.
* #44 Some cleanups
* #44 Some cleanups
* #44 Some cleanups
* #44 Fix typo
* #44 Fix markdown formatting
* #44 Remove line numbers from code snippets
---------
Co-authored-by: Cliff Click <cliffc@acm.org>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* #37 Add a Utils class to hold some useful functions. (#39)
Move the name '$ctrl' to the ScopeNode
* Fix maven pom
Missing an explicit compiler target, so IntelliJ/Maven defaulted to version 5 ???
Remove explict ver 17 from Makefile.
* Add immediate dominator peephole
* A little more robust & simpler idom search
* #40 Revise chapter 6 writeup to include a description of dominators
* #40 Revise chapter 6 writeup to include a description of dominators
---------
Co-authored-by: Cliff Click <cliffc@acm.org>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* #37 Create chapter 6 skeleton
* #37 Revise type system - TOP, BOTTOM, CONTROL are now directly implemented in Type, XCONTROL is a new type and that's implemented directly too.
We have a _type field that is like an enum.
* #37 Revise Type.meet() - this is now final.
Subclasses can override xmeet() which is protected but
now handles simple types in Type itself.
* #37 Basic test for peephole of CFG
* #37 Revise compute of if
* #37 Revise compute of if
* #37 WIP peephole of If
* #37 WIP peephole of If
* #37 WIP peephole of If
* #37 WIP peephole of If
* #37 WIP peephole of If
* #37 WIP fix the chars inserted by IntelliJ
* #37 WIP Fix compute type in IfNode
* #37 WIP Null check region inputs
* #37 WIP Fix where we choose great grand parent instead of grand parent
Add new test
* #37 WIP More fixes and tests
* #37 WIP Some minor adjustments
* Cleanup folding dead IF tests
Remove isDeadCtrl & just test for the constant.
Remove DEAD_CTRL, doesn't properly reset between tests.
Move keep/unkeep to Node.
PhiNode has a proper compute() call.
ProjNode ideal is a lot simpler.
Region doesn't ever get a null.
Move the mergeScopes Region peep till after all Phis are added.
Type TOP and XCONTROL count as constants.
TypeTuple gets a toString
* #37 WIP Upate README
* #37 WIP Region node should check if one of its inputs is a region that needs to be peepholed
* #37 WIP If node should check if its ctrl input is a Region that has only 1 live input so can be peepholed
* #37 WIP Further update to README to make the peephole logic clearer. Also discuss the relationship between Region and Phi nodes
* Region removes dead input paths
Remove region-folding in Return, If.
Add a Makefile.
Reformat triple-quote lines to be emacs-friendly.
* StopNode idealize
Return type sharpens to include control input.
* Remove !=, >=, >; use Not and <, <=, ==
Fix bug mixing rotating different ops.
Generalize Add fold constants; apply to Mul, EQ.
Fix Div.copy
* Fix bug rotating e.g. < or <=
Peep is only valid for associative ops
* #37 WIP Doc updates
* Work over the Ch6 Readme
Major issue: Region inputs align 1-to-1 with Phi inputs, but a Region can have zero to many Phis. When we lose a Region input (dead path), we need to lose the same inputs to each Phi - but we don't lose the Phis themselves, unless we're folding away down to the last live input.
* Update chapter06/README.md
Co-authored-by: Yichen Yan <oraluben@outlook.com>
* Update chapter06/README.md
Co-authored-by: Yichen Yan <oraluben@outlook.com>
* #37 Backport type system changes to chapter 2
* #37 Backport type system changes to chapter 3
* #37 Backport type system changes to chapter 4
* #37 Backport type system changes to chapter 5
* #37 Merge chapter 5 updates from main.
Remove language grammar module as we describe the grammar incrementally in each chapter.
* #37 Chapter 6 doc updates - added visuals to show effects of CFG peephole
* #37 Sync some updates to chapter 2
* #37 Sync some updates to chapter 3
* #37 Sync some updates to chapter 4
---------
Co-authored-by: Cliff Click <cliffc@acm.org>
Co-authored-by: Yichen Yan <oraluben@outlook.com>
|
| |
|
|
|
|
|
| |
* Link to parseIf.
Reorder the table of nodes.
Fix example.
* Replace code with links
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
documentation (#34)
* Backport changes from chapter 5 to older chapters (#30)
* Fix wrong indent
* Backport to chapter 4
* Backport to chapter 3
* Backport to chapter 2
* Backport to chapter 1
* Add if statement to comment (#32)
* Update visuals for chapters 1,2 & 3.
Reenable drawing of edges from constants to Start for these chapters.
* Update visuals for chapters 4.
Revise text to explain the labeling of edges in graphs and that we omit edge from Constant to Start nodes from chapter 4.
* Add code snippets for if statement parsing and the duplication and merging of ScopeNodes.
Explain how scopeNodes are duplicated and merged.
* Add constant check to minus node (#31)
* Fix closing root block with } (#33)
* Backport fix closing root block with } to chapter 4 and 3 (#35)
* Show use-def edge from Phi to Region as dotted edge.
Add example of Phi peephole.
Update visuals.
Add more examples.
* Fix visuals in chapter 1 and README in chapter 4.
* Remove subheading
* Adjust spaces
---------
Co-authored-by: XmiliaH <45106915+XmiliaH@users.noreply.github.com>
|
| |
|
|
| |
Remove parseBlock flag, and just require the missing `}`
|
| |
|
|
|
|
|
|
|
| |
* Report unclosed block in parsing
* Fix tests
* Resolve comments and rebase onto chapter5
* Test `isEOF` after consume whitespaces
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
* Backport fix for set_def killing new_def (#21)
* Use JDK 21
* Remove duplicate field in pom
* Enable GA test for pull requests
---------
Co-authored-by: XmiliaH <45106915+XmiliaH@users.noreply.github.com>
|
| | |
|
| | |
|
| |
|
|
| |
This reverts commit e3c412bbbdd6f6eefe2ac889f6d59aeaef71beb1.
|
| | |
|
| |
|
|
|
|
|
| |
* Wrong input index used
* Then is currently not a keyword
* Some phis are now not created and ids shifted
|
| | |
|
| |
|
|
| |
Region edges need to align with Phi edges; missing leading null
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
| |
Update visuals
Update chapter list
|
| |
|
|
| |
Make an official TODO which can't be hit in the current Chapter, but future binary ops might hit it.
|
| |
|
|
|
|
|
|
|
|
|
| |
* Return null when the node cannot be copied
* Make add_def package private again
* Phi node can have more then two data inputs in theory
* Use swap12
* Use addUse
|
| | |
|
| |
|
|
|
|
|
|
| |
Merging common edges.
Phis of same Region align.
Phis use greek phi, and have a debug name. Scope carries the debug name. Phis are lightly colored.
Common math names for math prims.
Parse can optionally show the graph after closing the last scope.
|
| | |
|
| |
|
|
| |
More rigorously head for a left-spline sum-of-products format.
|
| |
|
|
|
| |
higher level parsers can return null, but their return is ignored anycase.
div-by-0 is defined to be 0, backported to ch2,3,4,5
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
| |
Add an exact 'matchx' for keywords. Add a list of keywords.
int true=0; return true; // Expected id, found 'true'
int else=arg; if(else) else=2; else else=1; return else; // Expected id, found 'else'
inta=1; return a; // undefined inta
|
| |
|
|
| |
Add true/false
|
| |
|
|
|
|
| |
Return returns a tuple of control & result
GraphViz works with multi-Scopes and Scopes do not double-print uid.
Proj also does not print uid in golden test results, because every time we add a new early node, the final results change node id so fail golden test.
|
| |
|
|
| |
Fix GraphVix node edge ordering
|
| | |
|
| |
|
|
|
|
|
|
|
| |
Rename CTRL_TOKEN... its not a token.
_allScopes becomes a Stack, because... it behaves like a stack.
Add a junk Phi peep.
More general AddNode peeps
Add a bunch of If tests.
Rewrite how expected-exception tests work; the workflow on the old technique sucked. New one stops in the right place in the debugger.
|
| | |
|
| | |
|
| | |
|
| |
|
|
| |
Add references to Cliff's thesis.
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
| |
Fix test cases broken due to renaming of ProjNode label.
Cleanup the way we update $ctrl token
Assign an ID to each ScopeNode so that when we visualize we can assign different names
|
| |
|
|
|
|
| |
Drop Control interface, not flexible enough. Use isCFG() call, overloaded in child classes. Projections have a more complex test.
Missing some printouts in Bool children, If, Region, Phi.
IfNode type is a tuple. Region is TypeControl.
|