diff options
| author | Cliff Click <cliffc@acm.org> | 2024-04-23 17:23:16 +0100 |
|---|---|---|
| committer | Cliff Click <cliffc@acm.org> | 2024-10-23 17:51:09 -0700 |
| commit | b933257d6b26343f3ad517f5876bb5a0093ab403 (patch) | |
| tree | 82b21a1c11c55c1cf5b6662e6066a0b063626e3c /src/main/java/com/seaofnodes/simple/GraphVisualizer.java | |
| parent | 9ed409df4516e0089afbc7d5ccf9b029d431be04 (diff) | |
| download | Simple-linear-chapter10.tar.gz Simple-linear-chapter10.zip | |
Chapter 10: Structs and Memorylinear-chapter10
Co-authored-by: Thalia Archibald <thalia@archibald.dev>
Co-authored-by: Dibyendu Majumdar <mobile@majumdar.org.uk>
Co-authored-by: XmiliaH <45106915+XmiliaH@users.noreply.github.com>
Co-authored-by: XmiliaH <xmilia.hermit@gmail.com>
Co-authored-by: Robert Obkircher <robert.obkircher@gmail.com>
Diffstat (limited to 'src/main/java/com/seaofnodes/simple/GraphVisualizer.java')
| -rw-r--r-- | src/main/java/com/seaofnodes/simple/GraphVisualizer.java | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/main/java/com/seaofnodes/simple/GraphVisualizer.java b/src/main/java/com/seaofnodes/simple/GraphVisualizer.java index b4d64d4c..cfe6d5cc 100644 --- a/src/main/java/com/seaofnodes/simple/GraphVisualizer.java +++ b/src/main/java/com/seaofnodes/simple/GraphVisualizer.java @@ -27,7 +27,7 @@ public class GraphVisualizer { // nodes in the graph. Collection<Node> all = findAll(stop, scope); StringBuilder sb = new StringBuilder(); - sb.append("digraph chapter09 {\n"); + sb.append("digraph chapter10 {\n"); sb.append("/*\n"); sb.append(stop._src); sb.append("\n*/\n"); @@ -39,8 +39,10 @@ public class GraphVisualizer { // still making the subgraphs DOT gets confused. sb.append("\trankdir=BT;\n"); // Force Nodes before Scopes + // CNC - turned off Apr/8/2024, gives more flex in the layout and + // removes some of the more ludicrous layout choices. // Preserve node input order - sb.append("\tordering=\"in\";\n"); + //sb.append("\tordering=\"in\";\n"); // Merge multiple edges hitting the same node. Makes common shared // nodes much prettier to look at. @@ -195,9 +197,14 @@ public class GraphVisualizer { } else sb.append(def.uniqueName()); // Number edges, so we can see how they track sb.append("[taillabel=").append(i); + // The edge from New to ctrl is just for anchoring the New + if ( n instanceof NewNode ) + sb.append(" color=green"); // control edges are colored red - if( def.isCFG() ) + else if( def.isCFG() ) sb.append(" color=red"); + else if( def.isMem() ) + sb.append(" color=blue"); // Backedges do not add a ranking constraint if( i==2 && (n instanceof PhiNode || n instanceof LoopNode) ) sb.append(" constraint=false"); |
