From b933257d6b26343f3ad517f5876bb5a0093ab403 Mon Sep 17 00:00:00 2001 From: Cliff Click Date: Tue, 23 Apr 2024 17:23:16 +0100 Subject: Chapter 10: Structs and Memory Co-authored-by: Thalia Archibald Co-authored-by: Dibyendu Majumdar Co-authored-by: XmiliaH <45106915+XmiliaH@users.noreply.github.com> Co-authored-by: XmiliaH Co-authored-by: Robert Obkircher --- src/main/java/com/seaofnodes/simple/GraphVisualizer.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/main/java/com/seaofnodes/simple/GraphVisualizer.java') 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 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"); -- cgit v1.2.3