diff options
| author | Dibyendu Majumdar <dibyendumajumdar@users.noreply.github.com> | 2023-09-26 17:43:36 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-09-26 09:43:36 -0700 |
| commit | 29def92f2ddbfca64ba827f116172fe98b2df491 (patch) | |
| tree | a49affb27d57e908429beafe300756d5e4c0c273 /chapter02/docs/02-post-peephole-ex1.svg | |
| parent | 62bfd0d619b28892152a7d89639f3437bc9df573 (diff) | |
| download | Simple-29def92f2ddbfca64ba827f116172fe98b2df491.tar.gz Simple-29def92f2ddbfca64ba827f116172fe98b2df491.zip | |
Chapter 2 (#4)
* 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>
Diffstat (limited to 'chapter02/docs/02-post-peephole-ex1.svg')
| -rw-r--r-- | chapter02/docs/02-post-peephole-ex1.svg | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/chapter02/docs/02-post-peephole-ex1.svg b/chapter02/docs/02-post-peephole-ex1.svg new file mode 100644 index 00000000..33aa5a95 --- /dev/null +++ b/chapter02/docs/02-post-peephole-ex1.svg @@ -0,0 +1,51 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" + "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> +<!-- Generated by graphviz version 2.43.0 (0) + --> +<!-- Title: chapter02 Pages: 1 --> +<svg width="106pt" height="188pt" + viewBox="0.00 0.00 106.45 188.00" xmlns="http://www.w3.org/2000/svg"> + <g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 184)"> + <title>chapter02</title> + <polygon fill="white" stroke="transparent" points="-4,4 -4,-184 102.45,-184 102.45,4 -4,4"/> + <!-- Start1 --> + <g id="node1" class="node"> + <title>Start1</title> + <polygon fill="none" stroke="black" points="92.45,-180 38.45,-180 38.45,-144 92.45,-144 92.45,-180"/> + <text text-anchor="middle" x="65.45" y="-158.3" font-family="Times,serif" font-size="14.00">Start</text> + </g> + <!-- Con213 --> + <g id="node2" class="node"> + <title>Con213</title> + <ellipse fill="none" stroke="black" cx="34.45" cy="-90" rx="34.39" ry="18"/> + <text text-anchor="middle" x="34.45" y="-86.3" font-family="Times,serif" font-size="14.00">Con2</text> + </g> + <!-- Start1->Con213 --> + <g id="edge1" class="edge"> + <title>Start1->Con213</title> + <path fill="none" stroke="black" stroke-dasharray="1,5" + d="M57.78,-143.7C54.2,-135.61 49.86,-125.81 45.9,-116.87"/> + <polygon fill="black" stroke="black" points="49.06,-115.35 41.81,-107.62 42.66,-118.18 49.06,-115.35"/> + </g> + <!-- Return14 --> + <g id="node3" class="node"> + <title>Return14</title> + <polygon fill="none" stroke="black" points="98.45,-36 32.45,-36 32.45,0 98.45,0 98.45,-36"/> + <text text-anchor="middle" x="65.45" y="-14.3" font-family="Times,serif" font-size="14.00">Return</text> + </g> + <!-- Start1->Return14 --> + <g id="edge3" class="edge"> + <title>Start1->Return14</title> + <path fill="none" stroke="red" + d="M70.32,-143.98C73.01,-133.67 76.08,-120.19 77.45,-108 79.22,-92.1 79.22,-87.9 77.45,-72 76.49,-63.43 74.69,-54.22 72.76,-45.93"/> + <polygon fill="red" stroke="red" points="76.11,-44.89 70.32,-36.02 69.32,-46.57 76.11,-44.89"/> + </g> + <!-- Con213->Return14 --> + <g id="edge2" class="edge"> + <title>Con213->Return14</title> + <path fill="none" stroke="black" d="M41.79,-72.41C45.32,-64.45 49.63,-54.72 53.6,-45.76"/> + <polygon fill="black" stroke="black" points="56.87,-47.01 57.72,-36.45 50.47,-44.17 56.87,-47.01"/> + </g> + </g> +</svg> |
