From 736c658c274404084b15b450b2ab72d0e7569586 Mon Sep 17 00:00:00 2001 From: Dibyendu Majumdar Date: Fri, 3 Nov 2023 21:21:54 +0000 Subject: Backport changes in Chapter 5 to previous chapters and update Chapter5 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> --- chapter05/docs/05-graph2.gv | 9 +- chapter05/docs/05-graph2.svg | 196 ++++++++++---------- chapter05/docs/05-graph3.gv | 15 +- chapter05/docs/05-graph3.svg | 176 +++++++++--------- chapter05/docs/05-graph4.gv | 63 +++++++ chapter05/docs/05-graph4.svg | 216 ++++++++++++++++++++++ chapter05/docs/05-graph5.gv | 60 ++++++ chapter05/docs/05-graph5.svg | 196 ++++++++++++++++++++ chapter05/docs/05-graph6.gv | 58 ++++++ chapter05/docs/05-graph6.svg | 176 ++++++++++++++++++ chapter05/docs/05-graph7.gv | 72 ++++++++ chapter05/docs/05-graph7.svg | 269 +++++++++++++++++++++++++++ chapter05/docs/05-graph8.gv | 129 +++++++++++++ chapter05/docs/05-graph8.svg | 430 +++++++++++++++++++++++++++++++++++++++++++ 14 files changed, 1872 insertions(+), 193 deletions(-) create mode 100644 chapter05/docs/05-graph4.gv create mode 100644 chapter05/docs/05-graph4.svg create mode 100644 chapter05/docs/05-graph5.gv create mode 100644 chapter05/docs/05-graph5.svg create mode 100644 chapter05/docs/05-graph6.gv create mode 100644 chapter05/docs/05-graph6.svg create mode 100644 chapter05/docs/05-graph7.gv create mode 100644 chapter05/docs/05-graph7.svg create mode 100644 chapter05/docs/05-graph8.gv create mode 100644 chapter05/docs/05-graph8.svg (limited to 'chapter05/docs') diff --git a/chapter05/docs/05-graph2.gv b/chapter05/docs/05-graph2.gv index 0be7c1d6..2adb3da5 100644 --- a/chapter05/docs/05-graph2.gv +++ b/chapter05/docs/05-graph2.gv @@ -9,7 +9,6 @@ else { } #showGraph; return a; - */ rankdir=BT; ordering="in"; @@ -61,15 +60,15 @@ return a; edge [ fontname=Helvetica, fontsize=8 ]; EQNode8 -> Start2:p1[taillabel=1]; EQNode8 -> Con_7[taillabel=2]; - If9 -> Start2:p0[taillabel=0; color=red]; + If9 -> Start2:p0[taillabel=0 color=red]; If9 -> EQNode8[taillabel=1]; Add14 -> Start2:p1[taillabel=1]; Add14 -> Con_13[taillabel=2]; Sub16 -> Start2:p1[taillabel=1]; Sub16 -> Con_15[taillabel=2]; - Region17 -> If9:p0[taillabel=1; color=red]; - Region17 -> If9:p1[taillabel=2; color=red]; - Region17 -> Phi_a18 [style=invis] + Region17 -> If9:p0[taillabel=1 color=red]; + Region17 -> If9:p1[taillabel=2 color=red]; + Phi_a18 -> Region17 [style=dotted taillabel=0]; Phi_a18 -> Add14[taillabel=1]; Phi_a18 -> Sub16[taillabel=2]; edge [style=dashed color=cornflowerblue]; diff --git a/chapter05/docs/05-graph2.svg b/chapter05/docs/05-graph2.svg index ebc4ffac..d5e48a9e 100644 --- a/chapter05/docs/05-graph2.svg +++ b/chapter05/docs/05-graph2.svg @@ -4,220 +4,226 @@ - + chapter05 - + cluster_Nodes cluster_Scope1_0 - + cluster_Scope1_1 - + Start2 - - -Start - - - -$ctrl - -arg + + +Start + + + +$ctrl + +arg Con_7 - -#1 + +#1 EQNode8 - -== + +== EQNode8->Start2:p1 - - -1 + + +1 EQNode8->Con_7 - - -2 + + +2 If9 - - -If - - - -True - - -False + + +If + + + +True + + +False If9->Start2:p0 - - -0 + + +0 If9->EQNode8 - - -1 + + +1 Con_13 - -#2 + +#2 Add14 - -+ + ++ Add14->Start2:p1 - - - -1 + + +1 Add14->Con_13 - - -2 + + +2 Con_15 - -#3 + +#3 Sub16 - -- + +- Sub16->Start2:p1 - - -1 + + +1 Sub16->Con_15 - - -2 + + +2 Region17 - -Region + +Region Region17->If9:p0 - - -1 + + +1 Region17->If9:p1 - - -2 + + +2 Phi_a18 - -φ_a + +φ_a - Phi_a18->Add14 - - -1 + + +1 Phi_a18->Sub16 - - -2 + + +2 + + + +Phi_a18->Region17 + + +0 Scope1_0 - - -0 - -$ctrl - -arg + + +0 + +$ctrl + +arg Scope1_0:Scope1_0_arg->Start2:p1 - + + Scope1_0:Scope1_0_$ctrl->Region17 - - + + Scope1_1 - - -1 - -a + + +1 + +a Scope1_1:Scope1_1_a->Phi_a18 - - + + diff --git a/chapter05/docs/05-graph3.gv b/chapter05/docs/05-graph3.gv index 59a8a3e2..7e049c9c 100644 --- a/chapter05/docs/05-graph3.gv +++ b/chapter05/docs/05-graph3.gv @@ -9,7 +9,6 @@ else { } #showGraph; return a; - */ rankdir=BT; ordering="in"; @@ -48,20 +47,20 @@ return a; { rank=same; Region17;Phi_a18;} } edge [ fontname=Helvetica, fontsize=8 ]; - Stop3 -> Return19[taillabel=0; color=red]; + Stop3 -> Return19[taillabel=0 color=red]; EQNode8 -> Start2:p1[taillabel=1]; EQNode8 -> Con_7[taillabel=2]; - If9 -> Start2:p0[taillabel=0; color=red]; + If9 -> Start2:p0[taillabel=0 color=red]; If9 -> EQNode8[taillabel=1]; Add14 -> Start2:p1[taillabel=1]; Add14 -> Con_13[taillabel=2]; Sub16 -> Start2:p1[taillabel=1]; Sub16 -> Con_15[taillabel=2]; - Region17 -> If9:p0[taillabel=1; color=red]; - Region17 -> If9:p1[taillabel=2; color=red]; - Region17 -> Phi_a18 [style=invis] + Region17 -> If9:p0[taillabel=1 color=red]; + Region17 -> If9:p1[taillabel=2 color=red]; + Phi_a18 -> Region17 [style=dotted taillabel=0]; Phi_a18 -> Add14[taillabel=1]; Phi_a18 -> Sub16[taillabel=2]; - Return19 -> Region17[taillabel=0; color=red]; + Return19 -> Region17[taillabel=0 color=red]; Return19 -> Phi_a18[taillabel=1]; -} +} \ No newline at end of file diff --git a/chapter05/docs/05-graph3.svg b/chapter05/docs/05-graph3.svg index 5b6f0c86..855fdc2c 100644 --- a/chapter05/docs/05-graph3.svg +++ b/chapter05/docs/05-graph3.svg @@ -16,195 +16,201 @@ Start2 - - -Start - - - -$ctrl - -arg + + +Start + + + +$ctrl + +arg Stop3 - -Stop + +Stop Return19 - -Return + +Return Stop3->Return19 - - -0 + + +0 Con_7 - -#1 + +#1 EQNode8 - -== + +== EQNode8->Start2:p1 - - -1 + + +1 EQNode8->Con_7 - - -2 + + +2 If9 - - -If - - - -True - - -False + + +If + + + +True + + +False If9->Start2:p0 - - -0 + + +0 If9->EQNode8 - - -1 + + +1 Con_13 - -#2 + +#2 Add14 - -+ + ++ Add14->Start2:p1 - - -1 + + +1 Add14->Con_13 - - -2 + + +2 Con_15 - -#3 + +#3 Sub16 - -- + +- Sub16->Start2:p1 - - -1 + + +1 Sub16->Con_15 - - -2 + + +2 Region17 - -Region + +Region Region17->If9:p0 - - -1 + + +1 Region17->If9:p1 - - -2 + + +2 Phi_a18 - -φ_a + +φ_a - Phi_a18->Add14 - - -1 + + +1 Phi_a18->Sub16 - - -2 + + +2 + + + +Phi_a18->Region17 + + +0 Return19->Region17 - - -0 + + +0 Return19->Phi_a18 - - -1 + + +1 diff --git a/chapter05/docs/05-graph4.gv b/chapter05/docs/05-graph4.gv new file mode 100644 index 00000000..ac3dcdd7 --- /dev/null +++ b/chapter05/docs/05-graph4.gv @@ -0,0 +1,63 @@ +digraph chapter05 { +/* +int a=arg==2; +if( arg==1 ) +{ + a=arg==3; +} +return a; +*/ + rankdir=BT; + ordering="in"; + concentrate="true"; + subgraph cluster_Nodes { + Start2 [ shape=plaintext label=< + + + +
Start
+ + +
$ctrlarg
+
> + ]; + Stop3 [ shape=box style=filled fillcolor=yellow label="Stop" ]; + Con_6 [ label="#2" ]; + EQNode7 [ label="==" ]; + Con_8 [ label="#1" ]; + EQNode9 [ label="==" ]; + If10 [ shape=plaintext label=< + + + +
If
+ + +
TrueFalse
+
> + ]; + Con_14 [ label="#3" ]; + EQNode15 [ label="==" ]; + Region16 [ shape=box style=filled fillcolor=yellow label="Region" ]; + Phi_a17 [ style=filled fillcolor=lightyellow label="φ_a" ]; + Return18 [ shape=box style=filled fillcolor=yellow label="Return" ]; + { rank=same; Region16;Phi_a17;} + } + edge [ fontname=Helvetica, fontsize=8 ]; + Stop3 -> Return18[taillabel=0 color=red]; + EQNode7 -> Start2:p1[taillabel=1]; + EQNode7 -> Con_6[taillabel=2]; + EQNode9 -> Start2:p1[taillabel=1]; + EQNode9 -> Con_8[taillabel=2]; + If10 -> Start2:p0[taillabel=0 color=red]; + If10 -> EQNode9[taillabel=1]; + EQNode15 -> Start2:p1[taillabel=1]; + EQNode15 -> Con_14[taillabel=2]; + Region16 -> If10:p0[taillabel=1 color=red]; + Region16 -> If10:p1[taillabel=2 color=red]; + Phi_a17 -> Region16 [style=dotted taillabel=0]; + Phi_a17 -> EQNode15[taillabel=1]; + Phi_a17 -> EQNode7[taillabel=2]; + Return18 -> Region16[taillabel=0 color=red]; + Return18 -> Phi_a17[taillabel=1]; +} \ No newline at end of file diff --git a/chapter05/docs/05-graph4.svg b/chapter05/docs/05-graph4.svg new file mode 100644 index 00000000..3fcee500 --- /dev/null +++ b/chapter05/docs/05-graph4.svg @@ -0,0 +1,216 @@ + + + + + + +chapter05 + + +cluster_Nodes + + + + +Start2 + + +Start + + + +$ctrl + +arg + + + +Stop3 + +Stop + + + +Return18 + +Return + + + +Stop3->Return18 + + +0 + + + +Con_6 + +#2 + + + +EQNode7 + +== + + + +EQNode7->Start2:p1 + + +1 + + + +EQNode7->Con_6 + + +2 + + + +Con_8 + +#1 + + + +EQNode9 + +== + + + +EQNode9->Start2:p1 + + +1 + + + +EQNode9->Con_8 + + +2 + + + +If10 + + +If + + + +True + + +False + + + +If10->Start2:p0 + + +0 + + + +If10->EQNode9 + + +1 + + + +Con_14 + +#3 + + + +EQNode15 + +== + + + +EQNode15->Start2:p1 + + +1 + + + +EQNode15->Con_14 + + +2 + + + +Region16 + +Region + + + +Region16->If10:p0 + + +1 + + + +Region16->If10:p1 + + +2 + + + +Phi_a17 + +φ_a + + + +Phi_a17->EQNode7 + + +2 + + + +Phi_a17->EQNode15 + + +1 + + + +Phi_a17->Region16 + + +0 + + + +Return18->Region16 + + +0 + + + +Return18->Phi_a17 + + +1 + + + diff --git a/chapter05/docs/05-graph5.gv b/chapter05/docs/05-graph5.gv new file mode 100644 index 00000000..b6bfd5f2 --- /dev/null +++ b/chapter05/docs/05-graph5.gv @@ -0,0 +1,60 @@ +digraph chapter05 { +/* +int a=arg==2; +if( arg==1 ) +{ + a=arg==3; +} +return a; +*/ + rankdir=BT; + ordering="in"; + concentrate="true"; + subgraph cluster_Nodes { + Start2 [ shape=plaintext label=< + + + +
Start
+ + +
$ctrlarg
+
> + ]; + Stop3 [ shape=box style=filled fillcolor=yellow label="Stop" ]; + Con_6 [ label="#2" ]; + Con_8 [ label="#1" ]; + EQNode9 [ label="==" ]; + If10 [ shape=plaintext label=< + + + +
If
+ + +
TrueFalse
+
> + ]; + Con_14 [ label="#3" ]; + Region16 [ shape=box style=filled fillcolor=yellow label="Region" ]; + Phi_a19 [ style=filled fillcolor=lightyellow label="φ_a" ]; + EQNode20 [ label="==" ]; + Return21 [ shape=box style=filled fillcolor=yellow label="Return" ]; + { rank=same; Region16;Phi_a19;} + } + edge [ fontname=Helvetica, fontsize=8 ]; + Stop3 -> Return21[taillabel=0 color=red]; + EQNode9 -> Start2:p1[taillabel=1]; + EQNode9 -> Con_8[taillabel=2]; + If10 -> Start2:p0[taillabel=0 color=red]; + If10 -> EQNode9[taillabel=1]; + Region16 -> If10:p0[taillabel=1 color=red]; + Region16 -> If10:p1[taillabel=2 color=red]; + Phi_a19 -> Region16 [style=dotted taillabel=0]; + Phi_a19 -> Con_14[taillabel=1]; + Phi_a19 -> Con_6[taillabel=2]; + EQNode20 -> Start2:p1[taillabel=1]; + EQNode20 -> Phi_a19[taillabel=2]; + Return21 -> Region16[taillabel=0 color=red]; + Return21 -> EQNode20[taillabel=1]; +} \ No newline at end of file diff --git a/chapter05/docs/05-graph5.svg b/chapter05/docs/05-graph5.svg new file mode 100644 index 00000000..4f6fa4bd --- /dev/null +++ b/chapter05/docs/05-graph5.svg @@ -0,0 +1,196 @@ + + + + + + +chapter05 + + +cluster_Nodes + + + + +Start2 + + +Start + + + +$ctrl + +arg + + + +Stop3 + +Stop + + + +Return21 + +Return + + + +Stop3->Return21 + + +0 + + + +Con_6 + +#2 + + + +Con_8 + +#1 + + + +EQNode9 + +== + + + +EQNode9->Start2:p1 + + +1 + + + +EQNode9->Con_8 + + +2 + + + +If10 + + +If + + + +True + + +False + + + +If10->Start2:p0 + + +0 + + + +If10->EQNode9 + + +1 + + + +Con_14 + +#3 + + + +Region16 + +Region + + + +Region16->If10:p0 + + +1 + + + +Region16->If10:p1 + + +2 + + + +Phi_a19 + +φ_a + + + +Phi_a19->Con_6 + + +2 + + + +Phi_a19->Con_14 + + +1 + + + +Phi_a19->Region16 + + +0 + + + +EQNode20 + +== + + + +EQNode20->Start2:p1 + + +1 + + + +EQNode20->Phi_a19 + + +2 + + + +Return21->Region16 + + +0 + + + +Return21->EQNode20 + + +1 + + + diff --git a/chapter05/docs/05-graph6.gv b/chapter05/docs/05-graph6.gv new file mode 100644 index 00000000..f888e8e9 --- /dev/null +++ b/chapter05/docs/05-graph6.gv @@ -0,0 +1,58 @@ +digraph chapter05 { +/* +int c = 3; +int b = 2; +if (arg == 1) { + b = 3; + c = 4; +} +return c; +*/ + rankdir=BT; + ordering="in"; + concentrate="true"; + subgraph cluster_Nodes { + Start2 [ shape=plaintext label=< + + + +
Start
+ + +
$ctrlarg
+
> + ]; + Stop3 [ shape=box style=filled fillcolor=yellow label="Stop" ]; + Con_6 [ label="#3" ]; + Con_8 [ label="#1" ]; + EQNode9 [ label="==" ]; + If10 [ shape=plaintext label=< + + + +
If
+ + +
TrueFalse
+
> + ]; + Con_15 [ label="#4" ]; + Region16 [ shape=box style=filled fillcolor=yellow label="Region" ]; + Phi_c17 [ style=filled fillcolor=lightyellow label="φ_c" ]; + Return19 [ shape=box style=filled fillcolor=yellow label="Return" ]; + { rank=same; Region16;Phi_c17;} + } + edge [ fontname=Helvetica, fontsize=8 ]; + Stop3 -> Return19[taillabel=0 color=red]; + EQNode9 -> Start2:p1[taillabel=1]; + EQNode9 -> Con_8[taillabel=2]; + If10 -> Start2:p0[taillabel=0 color=red]; + If10 -> EQNode9[taillabel=1]; + Region16 -> If10:p0[taillabel=1 color=red]; + Region16 -> If10:p1[taillabel=2 color=red]; + Phi_c17 -> Region16 [style=dotted taillabel=0]; + Phi_c17 -> Con_15[taillabel=1]; + Phi_c17 -> Con_6[taillabel=2]; + Return19 -> Region16[taillabel=0 color=red]; + Return19 -> Phi_c17[taillabel=1]; +} \ No newline at end of file diff --git a/chapter05/docs/05-graph6.svg b/chapter05/docs/05-graph6.svg new file mode 100644 index 00000000..71527d7f --- /dev/null +++ b/chapter05/docs/05-graph6.svg @@ -0,0 +1,176 @@ + + + + + + +chapter05 + + +cluster_Nodes + + + + +Start2 + + +Start + + + +$ctrl + +arg + + + +Stop3 + +Stop + + + +Return19 + +Return + + + +Stop3->Return19 + + +0 + + + +Con_6 + +#3 + + + +Con_8 + +#1 + + + +EQNode9 + +== + + + +EQNode9->Start2:p1 + + +1 + + + +EQNode9->Con_8 + + +2 + + + +If10 + + +If + + + +True + + +False + + + +If10->Start2:p0 + + +0 + + + +If10->EQNode9 + + +1 + + + +Con_15 + +#4 + + + +Region16 + +Region + + + +Region16->If10:p0 + + +1 + + + +Region16->If10:p1 + + +2 + + + +Phi_c17 + +φ_c + + + +Phi_c17->Con_6 + + +2 + + + +Phi_c17->Con_15 + + +1 + + + +Phi_c17->Region16 + + +0 + + + +Return19->Region16 + + +0 + + + +Return19->Phi_c17 + + +1 + + + diff --git a/chapter05/docs/05-graph7.gv b/chapter05/docs/05-graph7.gv new file mode 100644 index 00000000..3abd6455 --- /dev/null +++ b/chapter05/docs/05-graph7.gv @@ -0,0 +1,72 @@ +digraph chapter05 { +/* +int a=arg+1; +int b=arg+2; +if( arg==1 ) + b=b+a; +else + a=b+1; +return a+b; +*/ + rankdir=BT; + ordering="in"; + concentrate="true"; + subgraph cluster_Nodes { + Start2 [ shape=plaintext label=< + + + +
Start
+ + +
$ctrlarg
+
> + ]; + Stop3 [ shape=box style=filled fillcolor=yellow label="Stop" ]; + Phi_b37 [ style=filled fillcolor=lightyellow label="φ_b" ]; + Con_10 [ label="#1" ]; + Add42 [ label="+" ]; + EQNode11 [ label="==" ]; + If12 [ shape=plaintext label=< + + + +
If
+ + +
TrueFalse
+
> + ]; + Con_46 [ label="#4" ]; + Con_48 [ label="#5" ]; + Phi_ab49 [ style=filled fillcolor=lightyellow label="φ_ab" ]; + Add50 [ label="+" ]; + Con_19 [ label="#2" ]; + Return51 [ shape=box style=filled fillcolor=yellow label="Return" ]; + Mul20 [ label="*" ]; + Region31 [ shape=box style=filled fillcolor=yellow label="Region" ]; + { rank=same; Region31;Phi_b37;Phi_ab49;} + } + edge [ fontname=Helvetica, fontsize=8 ]; + Stop3 -> Return51[taillabel=0 color=red]; + Phi_b37 -> Region31 [style=dotted taillabel=0]; + Phi_b37 -> Mul20[taillabel=1]; + Phi_b37 -> Start2:p1[taillabel=2]; + Add42 -> Phi_b37[taillabel=1]; + Add42 -> Start2:p1[taillabel=2]; + EQNode11 -> Start2:p1[taillabel=1]; + EQNode11 -> Con_10[taillabel=2]; + If12 -> Start2:p0[taillabel=0 color=red]; + If12 -> EQNode11[taillabel=1]; + Phi_ab49 -> Region31 [style=dotted taillabel=0]; + Phi_ab49 -> Con_46[taillabel=1]; + Phi_ab49 -> Con_48[taillabel=2]; + Add50 -> Add42[taillabel=1]; + Add50 -> Phi_ab49[taillabel=2]; + Return51 -> Region31[taillabel=0 color=red]; + Return51 -> Add50[taillabel=1]; + Mul20 -> Start2:p1[taillabel=1]; + Mul20 -> Con_19[taillabel=2]; + Region31 -> If12:p0[taillabel=1 color=red]; + Region31 -> If12:p1[taillabel=2 color=red]; +} diff --git a/chapter05/docs/05-graph7.svg b/chapter05/docs/05-graph7.svg new file mode 100644 index 00000000..8ba5ebd6 --- /dev/null +++ b/chapter05/docs/05-graph7.svg @@ -0,0 +1,269 @@ + + + + + + +chapter05 + + +cluster_Nodes + + + + +Start2 + + +Start + + + +$ctrl + +arg + + + +Stop3 + +Stop + + + +Return51 + +Return + + + +Stop3->Return51 + + +0 + + + +Phi_b37 + +φ_b + + + +Phi_b37->Start2:p1 + +2 + + + +Mul20 + +* + + + +Phi_b37->Mul20 + + +1 + + + +Region31 + +Region + + + +Phi_b37->Region31 + + +0 + + + +Con_10 + +#1 + + + +Add42 + ++ + + + +Add42->Start2:p1 + + + + +2 + + + +Add42->Phi_b37 + + +1 + + + +EQNode11 + +== + + + +EQNode11->Start2:p1 + + +1 + + + +EQNode11->Con_10 + + +2 + + + +If12 + + +If + + + +True + + +False + + + +If12->Start2:p0 + + +0 + + + +If12->EQNode11 + + +1 + + + +Con_46 + +#4 + + + +Con_48 + +#5 + + + +Phi_ab49 + +φ_ab + + + +Phi_ab49->Con_46 + + +1 + + + +Phi_ab49->Con_48 + + +2 + + + +Phi_ab49->Region31 + + +0 + + + +Add50 + ++ + + + +Add50->Add42 + + +1 + + + +Add50->Phi_ab49 + + +2 + + + +Con_19 + +#2 + + + +Return51->Add50 + + +1 + + + +Return51->Region31 + + +0 + + + +Mul20->Start2:p1 + +1 + + + +Mul20->Con_19 + + +2 + + + +Region31->If12:p0 + + +1 + + + +Region31->If12:p1 + + +2 + + + diff --git a/chapter05/docs/05-graph8.gv b/chapter05/docs/05-graph8.gv new file mode 100644 index 00000000..bef29b93 --- /dev/null +++ b/chapter05/docs/05-graph8.gv @@ -0,0 +1,129 @@ +digraph chapter05 { +/* +int a=1; +if( arg==1 ) + if( arg==2 ) + a=2; + else + a=3; +else if( arg==3 ) + a=4; +else + a=5; +return a; +#showGraph; +*/ + rankdir=BT; + ordering="in"; + concentrate="true"; + subgraph cluster_Nodes { + Start2 [ shape=plaintext label=< + + + +
Start
+ + +
$ctrlarg
+
> + ]; + Stop3 [ shape=box style=filled fillcolor=yellow label="Stop" ]; + Con_7 [ label="#1" ]; + EQNode8 [ label="==" ]; + If9 [ shape=plaintext label=< + + + +
If
+ + +
TrueFalse
+
> + ]; + Con_13 [ label="#2" ]; + EQNode14 [ label="==" ]; + If15 [ shape=plaintext label=< + + + +
If
+ + +
TrueFalse
+
> + ]; + Con_19 [ label="#2" ]; + Con_20 [ label="#3" ]; + Region21 [ shape=box style=filled fillcolor=yellow label="Region" ]; + Phi_a22 [ style=filled fillcolor=lightyellow label="φ_a" ]; + Con_23 [ label="#3" ]; + EQNode24 [ label="==" ]; + If25 [ shape=plaintext label=< + + + +
If
+ + +
TrueFalse
+
> + ]; + Con_29 [ label="#4" ]; + Con_30 [ label="#5" ]; + Region31 [ shape=box style=filled fillcolor=yellow label="Region" ]; + Phi_a32 [ style=filled fillcolor=lightyellow label="φ_a" ]; + Region33 [ shape=box style=filled fillcolor=yellow label="Region" ]; + Phi_a34 [ style=filled fillcolor=lightyellow label="φ_a" ]; + Return35 [ shape=box style=filled fillcolor=yellow label="Return" ]; + { rank=same; Region21;Phi_a22;} + { rank=same; Region31;Phi_a32;} + { rank=same; Region33;Phi_a34;} + } + node [shape=plaintext]; + subgraph cluster_Scope1_0 { + Scope1_0 [label=< + + +
0$ctrlarg
>]; + subgraph cluster_Scope1_1 { + Scope1_1 [label=< + + +
1a
>]; + } + } + edge [ fontname=Helvetica, fontsize=8 ]; + Stop3 -> Return35[taillabel=0 color=red]; + EQNode8 -> Start2:p1[taillabel=1]; + EQNode8 -> Con_7[taillabel=2]; + If9 -> Start2:p0[taillabel=0 color=red]; + If9 -> EQNode8[taillabel=1]; + EQNode14 -> Start2:p1[taillabel=1]; + EQNode14 -> Con_13[taillabel=2]; + If15 -> If9:p0[taillabel=0 color=red]; + If15 -> EQNode14[taillabel=1]; + Region21 -> If15:p0[taillabel=1 color=red]; + Region21 -> If15:p1[taillabel=2 color=red]; + Phi_a22 -> Region21 [style=dotted taillabel=0]; + Phi_a22 -> Con_19[taillabel=1]; + Phi_a22 -> Con_20[taillabel=2]; + EQNode24 -> Start2:p1[taillabel=1]; + EQNode24 -> Con_23[taillabel=2]; + If25 -> If9:p1[taillabel=0 color=red]; + If25 -> EQNode24[taillabel=1]; + Region31 -> If25:p0[taillabel=1 color=red]; + Region31 -> If25:p1[taillabel=2 color=red]; + Phi_a32 -> Region31 [style=dotted taillabel=0]; + Phi_a32 -> Con_29[taillabel=1]; + Phi_a32 -> Con_30[taillabel=2]; + Region33 -> Region21[taillabel=1 color=red]; + Region33 -> Region31[taillabel=2 color=red]; + Phi_a34 -> Region33 [style=dotted taillabel=0]; + Phi_a34 -> Phi_a22[taillabel=1]; + Phi_a34 -> Phi_a32[taillabel=2]; + Return35 -> Region33[taillabel=0 color=red]; + Return35 -> Phi_a34[taillabel=1]; + edge [style=dashed color=cornflowerblue]; + Scope1_0:"Scope1_0_arg" -> Start2:p1; + Scope1_1:"Scope1_1_a" -> Phi_a34; +} \ No newline at end of file diff --git a/chapter05/docs/05-graph8.svg b/chapter05/docs/05-graph8.svg new file mode 100644 index 00000000..e5310db4 --- /dev/null +++ b/chapter05/docs/05-graph8.svg @@ -0,0 +1,430 @@ + + + + + + +chapter05 + + +cluster_Nodes + + + +cluster_Scope1_0 + + + +cluster_Scope1_1 + + + + +Start2 + + +Start + + + +$ctrl + +arg + + + +Stop3 + +Stop + + + +Return35 + +Return + + + +Stop3->Return35 + + +0 + + + +Con_7 + +#1 + + + +EQNode8 + +== + + + +EQNode8->Start2:p1 + + +1 + + + +EQNode8->Con_7 + + +2 + + + +If9 + + +If + + + +True + + +False + + + +If9->Start2:p0 + + +0 + + + +If9->EQNode8 + + +1 + + + +Con_13 + +#2 + + + +EQNode14 + +== + + + +EQNode14->Start2:p1 + + +1 + + + +EQNode14->Con_13 + + +2 + + + +If15 + + +If + + + +True + + +False + + + +If15->If9:p0 + + +0 + + + +If15->EQNode14 + + +1 + + + +Con_19 + +#2 + + + +Con_20 + +#3 + + + +Region21 + +Region + + + +Region21->If15:p0 + + +1 + + + +Region21->If15:p1 + + +2 + + + +Phi_a22 + +φ_a + + + +Phi_a22->Con_19 + + +1 + + + +Phi_a22->Con_20 + + +2 + + + +Phi_a22->Region21 + + +0 + + + +Con_23 + +#3 + + + +EQNode24 + +== + + + +EQNode24->Start2:p1 + + +1 + + + +EQNode24->Con_23 + + +2 + + + +If25 + + +If + + + +True + + +False + + + +If25->If9:p1 + + +0 + + + +If25->EQNode24 + + +1 + + + +Con_29 + +#4 + + + +Con_30 + +#5 + + + +Region31 + +Region + + + +Region31->If25:p0 + + +1 + + + +Region31->If25:p1 + + +2 + + + +Phi_a32 + +φ_a + + + +Phi_a32->Con_29 + + +1 + + + +Phi_a32->Con_30 + + +2 + + + +Phi_a32->Region31 + + +0 + + + +Region33 + +Region + + + +Region33->Region21 + + +1 + + + +Region33->Region31 + + +2 + + + +Phi_a34 + +φ_a + + + +Phi_a34->Phi_a22 + + +1 + + + +Phi_a34->Phi_a32 + + +2 + + + +Phi_a34->Region33 + + +0 + + + +Return35->Region33 + + +0 + + + +Return35->Phi_a34 + + +1 + + + +Scope1_0 + + +0 + +$ctrl + +arg + + + +Scope1_0:Scope1_0_arg->Start2:p1 + + + + + +Scope1_1 + + +1 + +a + + + +Scope1_1:Scope1_1_a->Phi_a34 + + + + + -- cgit v1.2.3