| Commit message (Collapse) | Author | Age | Files | Lines |
| ... | |
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
| |
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.
|
| |
|
|
|
| |
No type compute yet
Initial parsing logic for If statements
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
|
|
| |
(#18)
|
| | |
|
| |
|
|
| |
ScopeNode added to chapter 3
Revised the description for Chapter 3 and 4 to include ScopeNode.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fixes #12
* Replace Parser scopes with ScopeNode
Basically move the Stack of HashMaps to a ScopeNode, with wrappers.
The HashMap maps String names to Integer indices; inputs to the ScopeNode.
This way, the ScopeNode keeps alive Nodes that are only alive because they are alive in the HashMap.
Fix bug isDead -> isUnused in deadCodeElim.
Support routines for adding/removing edges in ScopeNode.
Set $ctrl to null after a Return; there is no control.
Regression tests.
* One more test case
|
| |
|
|
|
| |
* Add a description of proj nodes
* Add a description of proj nodes
|
| |
|
|
|
|
|
|
|
| |
* Port updates back to chapter 2
* Update older visuals to match new format
* Update older visuals to match new format
* update docs
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Initial work on chapter 4.
Updated language grammar for chapter 4
Enhanced Parser to implement comparison operators
Parser now allows setting 'arg' as input parameter to program
The StartNode now has a tuple as result with two values.
We set up two projection nodes as output of Start - the first is bound to scope as '$ctrl' and second as 'arg'.
Return node now obtains the ctrl input by looking up '$ctrl' in scope; thus it gets the projection node.
Added TypeTuple - represents a tuple of values. This is the type of Start.
Added BoolNode - for comparison operators.
Added MultiNode - interface for nodes that generate tuple results. Start implements this interface.
Added ProjNode - projections to extract values from Start node. Each projection takes a MultiNode and an index value.
Initial writeup of chapter 4 in README.
GraphVisualizer now searches node outputs as well to locate all nodes
* Add TypeControl.
The first member of Start's tuple is of TypeControl.
Correct the projType() method
* Quote port names in edges as unquoted $ctrl is not valid.
Revise how we decide an edge is a control edge so that it works correctly for projections.
* We used to compute initial type in Node but this is problematic for new node types such as
ProjNode and BoolNode as the construction is not yet complete when Node calls compute().
So we have to move compute() call down to the sub type's constructor.
Add some tests for comparison ops.
* Describe the $ctrl name binding and how it represents the Ptri net model.
Add a diagram to show why we need algebraic manipulation of expressions.
* Implement a simplification for expressions such as
(con1 + arg) + con2 -> arg + con3
con1 + (arg + con2) -> arg + con3
* Add diagram to show what the graph looks like post peephole
* Explain projection nodes
* Cleanup Chapter 4, add peepholes.
Add like 6 peepholes. Replace the 2 prior ones with 1-liners.
BoolNode: replace the switch with 6 1-line classes.
Giant comment discussion on idealize() calling convention.
TypeInteger shorten isTop and isBot, and use them instead of calling "equals()".
* 2 more peeps, no tests yet
* Cleanup Chapter 4
`peephole()` kills nodes killed by `idealize()` calls... and works recursively. This requires keeping "mid-peephole" nodes alive. The edge-swap code in Add and Mul now keeps their inputs alive mid-swap.
MultiNode is a class, not an interface.
Move the initial 'compute()' to peephole, instead of requiring each constructor to do it. Start and Constant remember their original types, even if the `_type` field changes.
`kill()` flags nodes as DEAD. Print DEAD nodes with "DEAD". Change recursive `_print()` to a tik-tok style, so each individual print does not need to handle DEAD printing. This printing will soon need a "visit" bit to avoid infinite recursion.
Projs pick up a debugging name.
GraphViz: combine Multis and their Projs. Drop Constant inputs from Start. Fix coloring Control edges red.
* minor WS cleanup
* Cleaned up Node.peephole
Use a smart DCE call after peephole. More comments. Tidy interfaces.
* minor comment cleanup
* But the proj nodes inside a table
* No need to set column span on multi node as we put the proj nodes in a table
* Update the dot diagrams
* Rename method to make it more obvious to the reader
* Start to add a description of peephole
* Rename del() to delUse() and make it an instance method as it reads better that way.
Add new method addUse() again to improve readability.
Adjust removeDeadCode() to make the intention clear.
* Update docs explaining how peephole works
Update the diagrams
* Fix errors
* Add diagram to show what the graph looks like post peephole
* 2 more peeps, no tests yet
* Cleanup Chapter 4
`peephole()` kills nodes killed by `idealize()` calls... and works recursively. This requires keeping "mid-peephole" nodes alive. The edge-swap code in Add and Mul now keeps their inputs alive mid-swap.
MultiNode is a class, not an interface.
Move the initial 'compute()' to peephole, instead of requiring each constructor to do it. Start and Constant remember their original types, even if the `_type` field changes.
`kill()` flags nodes as DEAD. Print DEAD nodes with "DEAD". Change recursive `_print()` to a tik-tok style, so each individual print does not need to handle DEAD printing. This printing will soon need a "visit" bit to avoid infinite recursion.
Projs pick up a debugging name.
GraphViz: combine Multis and their Projs. Drop Constant inputs from Start. Fix coloring Control edges red.
* minor WS cleanup
* Cleaned up Node.peephole
Use a smart DCE call after peephole. More comments. Tidy interfaces.
* minor comment cleanup
* But the proj nodes inside a table
* No need to set column span on multi node as we put the proj nodes in a table
* Update the dot diagrams
* Rename method to make it more obvious to the reader
* Start to add a description of peephole
* Rename del() to delUse() and make it an instance method as it reads better that way.
Add new method addUse() again to improve readability.
Adjust removeDeadCode() to make the intention clear.
* Update docs explaining how peephole works
Update the diagrams
* Minor cleanups
Split isUnused from isDead, with comments.
Rename removeDeadCode back to deadCodeElim after discussion; matches the historical compiler wording.
Fixup large javadoc example with a table.
* match doc and code
* Fix name of method
* Fix name of method
---------
Co-authored-by: dibyendumajumdar <mobile@majumdar.org.uk>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Chapter 3 - add vars and lexical scope.
* Fix typo
* Overhaul graph viz
Makes the scopes pointing into the graph being build more visually appealing.
Constants are a printed with just the constant value.
* Fix control edge color
* Fix missing grouping operator parse
Add a parens test.
Shorten names 'Identifier' to 'Id'
_lexer.match -> match
require() passes a Node thru, so can be flow-coded.
Uniform syntax error messages.
Handy Lexer.toString for debugging.
Drop Optional for null returns; less total code; less objects; less confusion.
camelCase some fcns.
* All parser helpers return Node, not void.
Drop _ret. parseBlock and parseStatement now the same.
* CLosely align chap2 and chap3 parsers
Mostly whitespace aligned; dragged a few functions around to make more sense.
I think the diff from Ch2 and Ch3 is down a few differences about what is a statement, plus all the symbol stuff for scopes and variables.
* Add examples illustrating the symbol table creation.
* Update docs and comments
---------
Co-authored-by: Cliff Click <cliffc@acm.org>
|
| |
|
| |
Fix tests that check for exceptions
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Start on Chapter 2.
* Start on Chapter 2.
* Refactor
* Refactor
* Initial attempt at peephole opt for add operation
* cleanup unused import
* Start on graph visualizer
* Start on graph visualizer
* Rework chapter 2
Add a short discourse on the Types, and provide a Bottom type.
Make a final toString; require each Node to specify its special printing via label().
Add a recursing printer called print(); toString is used by default in the debugger and so cannot be recursive.
Make the peephole rules based on a proper Type and idealize calls.
Big comments about the Type computations.
Every node picks up a _print, compute and idealize() call.
Rename long arith ops Divide, UnaryMinus, Multiply, Subtract into shorter uniform-length names. Cleans up the parser where he does the precedence op parsing.
Rework Parser:
- Drop Token class, its all Strings except in the one place we know a number is coming
- Embed the Lexer as a field in the Parser, instead of trying to pass it around everywhere in the Parser
- StartNode becomes a read-only global, so we don't have to pass it around everywhere in the Parser AND optimizer.
- Lexer matches on strings and returns strings. Match and consume *at the moment* instead of carrying around a current token/string and forcing the next-token after consuming the current one.
- All parse subexpressions shrink by 1/2 after these changes.
* Initial writeup of Chapter 2
* Initial writeup of Chapter 2
* Initial writeup of Chapter 2
* Initial writeup of Chapter 2
* Remove range
* progress Chapter 2
Drop integer ranges.
Broader lattice pic.
Lots of prose changes in the readme.
Fixed title in gviz dot generation.
Fixed bug with peephole making redundant constants.
* Implement compute for all the arithmetic node types
Add a flag to switch off peephole so we can see the full graph
Add post peephole graph to writeup
* Implement compute for all the arithmetic node types
Add a flag to switch off peephole so we can see the full graph
Add post peephole graph to writeup
* Fix bad path to the svg
* Update pre-peephole diagram
* Add dead code elimination
...and a set_def to proper update graph edges.
* Update README.md
* Cleanup the GraphVisualizer a bit.
Update the graphs.
Update the chapter list as chapter 3 deleted, and chapter 4 is now chapter 3.
---------
Co-authored-by: Cliff Click <cliffc@acm.org>
|
| |\
| |
| | |
Chapter 1 implementation
|