summaryrefslogtreecommitdiff
path: root/chapter07/docs/07-graph2.svg
diff options
context:
space:
mode:
authorDibyendu Majumdar <dibyendumajumdar@users.noreply.github.com>2023-12-03 23:23:04 +0000
committerGitHub <noreply@github.com>2023-12-03 15:23:04 -0800
commit6415e3ae9013e3a9ae0437553ea0c3702381469b (patch)
treeaec64a03c86332ce53857d9297b7bbfb7f807acf /chapter07/docs/07-graph2.svg
parent21a1fc4a4414f8511ae5e94965b4b72fd45751e0 (diff)
downloadSimple-6415e3ae9013e3a9ae0437553ea0c3702381469b.tar.gz
Simple-6415e3ae9013e3a9ae0437553ea0c3702381469b.zip
Chapter 7 (also 8 but not officially) (#48)
* #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>
Diffstat (limited to 'chapter07/docs/07-graph2.svg')
-rw-r--r--chapter07/docs/07-graph2.svg184
1 files changed, 184 insertions, 0 deletions
diff --git a/chapter07/docs/07-graph2.svg b/chapter07/docs/07-graph2.svg
new file mode 100644
index 00000000..1fec9556
--- /dev/null
+++ b/chapter07/docs/07-graph2.svg
@@ -0,0 +1,184 @@
+<?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: chapter07 Pages: 1 -->
+<svg width="330pt" height="492pt"
+ viewBox="0.00 0.00 330.00 492.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 488)">
+<title>chapter07</title>
+<polygon fill="white" stroke="transparent" points="-4,4 -4,-488 326,-488 326,4 -4,4"/>
+<g id="clust1" class="cluster">
+<title>cluster_Nodes</title>
+<polygon fill="none" stroke="black" points="8,-8 8,-476 314,-476 314,-8 8,-8"/>
+</g>
+<!-- Start2 -->
+<g id="node1" class="node">
+<title>Start2</title>
+<polygon fill="yellow" stroke="transparent" points="141,-439 141,-464 222,-464 222,-439 141,-439"/>
+<polygon fill="none" stroke="black" points="141,-439 141,-464 222,-464 222,-439 141,-439"/>
+<text text-anchor="start" x="163" y="-447.8" font-family="Times,serif" font-size="14.00">Start</text>
+<polygon fill="none" stroke="black" points="141,-408 141,-439 222,-439 222,-408 141,-408"/>
+<polygon fill="yellow" stroke="transparent" points="146,-413 146,-434 186,-434 186,-413 146,-413"/>
+<polygon fill="none" stroke="black" points="146,-413 146,-434 186,-434 186,-413 146,-413"/>
+<text text-anchor="start" x="149" y="-419.8" font-family="Times,serif" font-size="14.00">$ctrl</text>
+<polygon fill="none" stroke="black" points="186,-413 186,-434 217,-434 217,-413 186,-413"/>
+<text text-anchor="start" x="189" y="-419.8" font-family="Times,serif" font-size="14.00">arg</text>
+</g>
+<!-- Stop3 -->
+<g id="node2" class="node">
+<title>Stop3</title>
+<polygon fill="yellow" stroke="black" points="153,-52 99,-52 99,-16 153,-16 153,-52"/>
+<text text-anchor="middle" x="126" y="-30.3" font-family="Times,serif" font-size="14.00">Stop</text>
+</g>
+<!-- Return17 -->
+<g id="node10" class="node">
+<title>Return17</title>
+<polygon fill="yellow" stroke="black" points="159,-124 93,-124 93,-88 159,-88 159,-124"/>
+<text text-anchor="middle" x="126" y="-102.3" font-family="Times,serif" font-size="14.00">Return</text>
+</g>
+<!-- Stop3&#45;&gt;Return17 -->
+<g id="edge1" class="edge">
+<title>Stop3&#45;&gt;Return17</title>
+<path fill="none" stroke="red" d="M126,-52.3C126,-60.02 126,-69.29 126,-77.89"/>
+<polygon fill="red" stroke="red" points="122.5,-77.9 126,-87.9 129.5,-77.9 122.5,-77.9"/>
+<text text-anchor="middle" x="123" y="-54.9" font-family="Helvetica,sans-Serif" font-size="8.00">0</text>
+</g>
+<!-- Loop6 -->
+<g id="node3" class="node">
+<title>Loop6</title>
+<polygon fill="yellow" stroke="black" points="306,-368 252,-368 252,-332 306,-332 306,-368"/>
+<text text-anchor="middle" x="279" y="-346.3" font-family="Times,serif" font-size="14.00">Loop</text>
+</g>
+<!-- Loop6&#45;&gt;Start2 -->
+<g id="edge2" class="edge">
+<title>Loop6&#45;&gt;Start2:p0</title>
+<path fill="none" stroke="red" d="M251.93,-364.13C226.34,-376.71 189.56,-395.24 173.73,-405.41"/>
+<polygon fill="red" stroke="red" points="171.34,-402.85 166,-412 175.88,-408.18 171.34,-402.85"/>
+<text text-anchor="middle" x="248.93" y="-357.73" font-family="Helvetica,sans-Serif" font-size="8.00">1</text>
+</g>
+<!-- If11 -->
+<g id="node7" class="node">
+<title>If11</title>
+<polygon fill="yellow" stroke="transparent" points="32,-195 32,-220 126,-220 126,-195 32,-195"/>
+<polygon fill="none" stroke="black" points="32,-195 32,-220 126,-220 126,-195 32,-195"/>
+<text text-anchor="start" x="73.5" y="-203.8" font-family="Times,serif" font-size="14.00">If</text>
+<polygon fill="none" stroke="black" points="32,-164 32,-195 126,-195 126,-164 32,-164"/>
+<polygon fill="yellow" stroke="transparent" points="37,-169 37,-190 77,-190 77,-169 37,-169"/>
+<polygon fill="none" stroke="black" points="37,-169 37,-190 77,-190 77,-169 37,-169"/>
+<text text-anchor="start" x="40" y="-175.8" font-family="Times,serif" font-size="14.00">True</text>
+<polygon fill="yellow" stroke="transparent" points="77,-169 77,-190 121,-190 121,-169 77,-169"/>
+<polygon fill="none" stroke="black" points="77,-169 77,-190 121,-190 121,-169 77,-169"/>
+<text text-anchor="start" x="80" y="-175.8" font-family="Times,serif" font-size="14.00">False</text>
+</g>
+<!-- Loop6&#45;&gt;If11 -->
+<g id="edge3" class="edge">
+<title>Loop6&#45;&gt;If11:p0</title>
+<path fill="none" stroke="red" d="M251.78,-335.24C248.86,-334.04 245.9,-332.93 243,-332 156.98,-304.48 103.76,-362.82 43,-296 18.41,-268.96 14.64,-203.69 27.49,-184.44"/>
+<polygon fill="red" stroke="red" points="29.46,-187.33 36,-179 25.69,-181.43 29.46,-187.33"/>
+<text text-anchor="middle" x="248.78" y="-328.84" font-family="Helvetica,sans-Serif" font-size="8.00">2</text>
+</g>
+<!-- Phi_arg8 -->
+<g id="node4" class="node">
+<title>Phi_arg8</title>
+<ellipse fill="lightyellow" stroke="black" cx="125" cy="-350" rx="37.09" ry="18"/>
+<text text-anchor="middle" x="125" y="-346.3" font-family="Times,serif" font-size="14.00">φ_arg</text>
+</g>
+<!-- Phi_arg8&#45;&gt;Start2 -->
+<g id="edge5" class="edge">
+<title>Phi_arg8&#45;&gt;Start2:p1</title>
+<path fill="none" stroke="black" d="M154.55,-360.93C173.21,-369 194.84,-382.27 200.56,-401.87"/>
+<polygon fill="black" stroke="black" points="197.12,-402.59 202,-412 204.05,-401.61 197.12,-402.59"/>
+<text text-anchor="middle" x="151.55" y="-363.53" font-family="Helvetica,sans-Serif" font-size="8.00">1</text>
+</g>
+<!-- Phi_arg8&#45;&gt;Loop6 -->
+<g id="edge4" class="edge">
+<title>Phi_arg8&#45;&gt;Loop6</title>
+<path fill="none" stroke="black" stroke-dasharray="1,5" d="M143.47,-334.01C153.54,-326.34 166.66,-317.98 180,-314 203,-307.14 211.35,-306.06 234,-314 241.14,-316.5 247.99,-320.67 254.09,-325.3"/>
+<polygon fill="black" stroke="black" points="251.99,-328.1 261.92,-331.78 256.45,-322.71 251.99,-328.1"/>
+<text text-anchor="middle" x="140.47" y="-327.61" font-family="Helvetica,sans-Serif" font-size="8.00">0</text>
+</g>
+<!-- Add16 -->
+<g id="node9" class="node">
+<title>Add16</title>
+<ellipse fill="none" stroke="black" cx="203" cy="-278" rx="27" ry="18"/>
+<text text-anchor="middle" x="203" y="-274.3" font-family="Times,serif" font-size="14.00">+</text>
+</g>
+<!-- Con_9 -->
+<g id="node5" class="node">
+<title>Con_9</title>
+<ellipse fill="none" stroke="black" cx="43" cy="-350" rx="27" ry="18"/>
+<text text-anchor="middle" x="43" y="-346.3" font-family="Times,serif" font-size="14.00">10</text>
+</g>
+<!-- LT10 -->
+<g id="node6" class="node">
+<title>LT10</title>
+<ellipse fill="none" stroke="black" cx="79" cy="-278" rx="27" ry="18"/>
+<text text-anchor="middle" x="79" y="-274.3" font-family="Times,serif" font-size="14.00">&lt;</text>
+</g>
+<!-- LT10&#45;&gt;Phi_arg8 -->
+<g id="edge7" class="edge">
+<title>LT10&#45;&gt;Phi_arg8</title>
+<path fill="none" stroke="black" d="M89.44,-294.88C95.12,-303.53 102.28,-314.42 108.68,-324.17"/>
+<polygon fill="black" stroke="black" points="105.87,-326.26 114.28,-332.69 111.72,-322.41 105.87,-326.26"/>
+<text text-anchor="middle" x="86.44" y="-297.48" font-family="Helvetica,sans-Serif" font-size="8.00">1</text>
+</g>
+<!-- LT10&#45;&gt;Con_9 -->
+<g id="edge8" class="edge">
+<title>LT10&#45;&gt;Con_9</title>
+<path fill="none" stroke="black" d="M70.65,-295.24C66.29,-303.72 60.85,-314.29 55.96,-323.8"/>
+<polygon fill="black" stroke="black" points="52.77,-322.36 51.3,-332.85 58.99,-325.56 52.77,-322.36"/>
+<text text-anchor="middle" x="67.65" y="-297.84" font-family="Helvetica,sans-Serif" font-size="8.00">2</text>
+</g>
+<!-- If11&#45;&gt;Loop6 -->
+<g id="edge9" class="edge">
+<title>If11&#45;&gt;Loop6</title>
+<path fill="none" stroke="red" d="M134.07,-205.07C167.93,-214.93 210.21,-231.94 239,-260 256.28,-276.84 266.71,-302.48 272.57,-321.93"/>
+<polygon fill="red" stroke="red" points="269.24,-323.03 275.3,-331.72 275.98,-321.15 269.24,-323.03"/>
+<text text-anchor="middle" x="137.07" y="-198.67" font-family="Helvetica,sans-Serif" font-size="8.00">0</text>
+</g>
+<!-- If11&#45;&gt;LT10 -->
+<g id="edge10" class="edge">
+<title>If11&#45;&gt;LT10</title>
+<path fill="none" stroke="black" d="M79,-224.28C79,-232.58 79,-241.48 79,-249.56"/>
+<polygon fill="black" stroke="black" points="75.5,-249.6 79,-259.6 82.5,-249.6 75.5,-249.6"/>
+<text text-anchor="middle" x="76" y="-226.88" font-family="Helvetica,sans-Serif" font-size="8.00">1</text>
+</g>
+<!-- Con_15 -->
+<g id="node8" class="node">
+<title>Con_15</title>
+<ellipse fill="none" stroke="black" cx="207" cy="-350" rx="27" ry="18"/>
+<text text-anchor="middle" x="207" y="-346.3" font-family="Times,serif" font-size="14.00">1</text>
+</g>
+<!-- Add16&#45;&gt;Phi_arg8 -->
+<g id="edge11" class="edge">
+<title>Add16&#45;&gt;Phi_arg8</title>
+<path fill="none" stroke="black" d="M180.01,-299.63C170.41,-308.25 159.23,-318.28 149.47,-327.04"/>
+<polygon fill="black" stroke="black" points="182.48,-302.11 187.59,-292.83 177.81,-296.9 182.48,-302.11"/>
+<polygon fill="black" stroke="black" points="147.11,-324.46 142,-333.74 151.78,-329.67 147.11,-324.46"/>
+<text text-anchor="middle" x="184.59" y="-295.43" font-family="Helvetica,sans-Serif" font-size="8.00">1</text>
+</g>
+<!-- Add16&#45;&gt;Con_15 -->
+<g id="edge12" class="edge">
+<title>Add16&#45;&gt;Con_15</title>
+<path fill="none" stroke="black" d="M203.99,-296.3C204.43,-304.02 204.96,-313.29 205.45,-321.89"/>
+<polygon fill="black" stroke="black" points="201.96,-322.11 206.02,-331.9 208.95,-321.71 201.96,-322.11"/>
+<text text-anchor="middle" x="200.99" y="-298.9" font-family="Helvetica,sans-Serif" font-size="8.00">2</text>
+</g>
+<!-- Return17&#45;&gt;Phi_arg8 -->
+<g id="edge14" class="edge">
+<title>Return17&#45;&gt;Phi_arg8</title>
+<path fill="none" stroke="black" d="M133.07,-124.33C136.84,-134.53 141.09,-147.78 143,-160 151.97,-217.35 140.08,-285.24 131.79,-322.03"/>
+<polygon fill="black" stroke="black" points="128.33,-321.44 129.46,-331.97 135.14,-323.03 128.33,-321.44"/>
+<text text-anchor="middle" x="130.07" y="-126.93" font-family="Helvetica,sans-Serif" font-size="8.00">1</text>
+</g>
+<!-- Return17&#45;&gt;If11 -->
+<g id="edge13" class="edge">
+<title>Return17&#45;&gt;If11:p1</title>
+<path fill="none" stroke="red" d="M113.92,-124C108.25,-133.3 102.24,-145.44 99.95,-157.94"/>
+<polygon fill="red" stroke="red" points="96.46,-157.71 99,-168 103.43,-158.38 96.46,-157.71"/>
+<text text-anchor="middle" x="110.92" y="-126.6" font-family="Helvetica,sans-Serif" font-size="8.00">0</text>
+</g>
+</g>
+</svg>