changeset 20027:87419b0d9bfb

BinaryGraphPrinter: if a schedule is available, also print he node-to-blocks mapping in addition to the block-to-nodes
author Gilles Duboscq <gilles.m.duboscq@oracle.com>
date Wed, 25 Mar 2015 16:16:36 +0100
parents 3bda2c03d089
children 104304a54b0c
files graal/com.oracle.graal.printer/src/com/oracle/graal/printer/BinaryGraphPrinter.java
diffstat 1 files changed, 13 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/BinaryGraphPrinter.java	Wed Mar 25 16:15:20 2015 +0100
+++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/BinaryGraphPrinter.java	Wed Mar 25 16:16:36 2015 +0100
@@ -141,8 +141,9 @@
         }
         ControlFlowGraph cfg = schedule == null ? null : schedule.getCFG();
         BlockMap<List<Node>> blockToNodes = schedule == null ? null : schedule.getBlockToNodesMap();
+        NodeMap<Block> nodeToBlocks = schedule == null ? null : schedule.getNodeToBlockMap();
         List<Block> blocks = cfg == null ? null : cfg.getBlocks();
-        writeNodes(graph);
+        writeNodes(graph, nodeToBlocks);
         writeBlocks(blocks, blockToNodes);
     }
 
@@ -399,7 +400,7 @@
         return node.getId();
     }
 
-    private void writeNodes(Graph graph) throws IOException {
+    private void writeNodes(Graph graph, NodeMap<Block> nodeToBlocks) throws IOException {
         ToDoubleFunction<FixedNode> probabilities = null;
         if (PrintGraphProbabilities.getValue()) {
             try {
@@ -421,6 +422,16 @@
                     props.put("probability", t);
                 }
             }
+            if (nodeToBlocks != null) {
+                if (nodeToBlocks.isNew(node)) {
+                    props.put("node-to-block", "NEW (not in schedule)");
+                } else {
+                    Block block = nodeToBlocks.get(node);
+                    if (block != null) {
+                        props.put("node-to-block", block.getId());
+                    }
+                }
+            }
             writeInt(getNodeId(node));
             writePoolObject(nodeClass);
             writeByte(node.predecessor() == null ? 0 : 1);