diff graal/GraalCompiler/src/com/sun/c1x/debug/IdealGraphPrinter.java @ 2787:9253df721472

Allow to return a map of "debug properties" in Node and subclasses and show these properties in the IdealGraphVisualizer. Also, fix inputCount() and successorCount() for Local.
author Peter Hofer <peter.hofer@jku.at>
date Wed, 25 May 2011 17:48:56 +0200
parents 39a9d62e4c60
children d3fc4fe063bf
line wrap: on
line diff
--- a/graal/GraalCompiler/src/com/sun/c1x/debug/IdealGraphPrinter.java	Wed May 25 17:10:53 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/debug/IdealGraphPrinter.java	Wed May 25 17:48:56 2011 +0200
@@ -24,6 +24,7 @@
 
 import java.io.*;
 import java.util.*;
+import java.util.Map.Entry;
 
 import com.oracle.graal.graph.*;
 
@@ -129,17 +130,26 @@
                 continue;
             }
 
-            String name;
-            if (shortNames) {
-                name = node.shortName();
-            } else {
-                name = node.toString();
+            stream.printf("   <node id='%d'><properties>%n", node.id());
+            stream.printf("    <p name='idx'>%d</p>%n", node.id());
+
+            Map<Object, Object> props = node.getDebugProperties();
+            if (!props.containsKey("name")) {
+                String name;
+                if (shortNames) {
+                    name = node.shortName();
+                } else {
+                    name = node.toString();
+                }
+                stream.printf("    <p name='name'>%s</p>%n", escape(name));
+            }
+            for (Entry<Object, Object> entry : props.entrySet()) {
+                String key = entry.getKey().toString();
+                String value = entry.getValue().toString();
+                stream.printf("    <p name='%s'>%s</p>%n", escape(key), escape(value));
             }
 
-            stream.printf("   <node id='%d'><properties>", node.id());
-            stream.printf("<p name='idx'>%d</p>", node.id());
-            stream.printf("<p name='name'>%s</p>", escape(name));
-            stream.println("</properties></node>");
+            stream.println("   </properties></node>");
 
             // successors
             int fromIndex = 0;