Mercurial > hg > truffle
changeset 2819:774d2bc06148
Merge.
author | Thomas Wuerthinger <thomas@wuerthinger.net> |
---|---|
date | Mon, 30 May 2011 15:36:22 +0200 |
parents | bf12196e2a60 (current diff) 878bbf7dbf31 (diff) |
children | 2b8ef0a06391 ac4b086cbd72 |
files | |
diffstat | 1 files changed, 34 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/GraalCompiler/src/com/sun/c1x/debug/IdealGraphPrinter.java Mon May 30 15:36:06 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/debug/IdealGraphPrinter.java Mon May 30 15:36:22 2011 +0200 @@ -126,7 +126,7 @@ stream.println(" <controlFlow>"); for (Block block : schedule.getBlocks()) { - printBlock(block); + printBlock(graph, block); } printNoBlock(); stream.println(" </controlFlow>"); @@ -138,7 +138,7 @@ ArrayList<Edge> edges = new ArrayList<Edge>(); for (Node node : nodes) { - if (node == Node.Null || omittedClasses.contains(node)) { + if (node == Node.Null || omittedClasses.contains(node.getClass())) { continue; } @@ -196,7 +196,7 @@ stream.printf(" <edge from='%d' fromIndex='%d' to='%d' toIndex='%d'/>%n", edge.from, edge.fromIndex, edge.to, edge.toIndex); } - private void printBlock(Block block) { + private void printBlock(Graph graph, Block block) { stream.printf(" <block name='%d'>%n", block.blockID()); stream.printf(" <successors>%n"); for (Block sux : block.getSuccessors()) { @@ -208,8 +208,38 @@ } stream.printf(" </successors>%n"); stream.printf(" <nodes>%n"); + + ArrayList<Node> nodes = new ArrayList<Node>(block.getInstructions()); + // if this is the first block: add all locals to this block + if (nodes.get(0) == graph.start()) { + for (Node node : graph.getNodes()) { + if (node instanceof Local) { + nodes.add(node); + } + } + } + // add all framestates and phis to their blocks for (Node node : block.getInstructions()) { - stream.printf(" <node id='%d'/>%n", node.id()); + if (node instanceof Instruction && ((Instruction) node).stateAfter() != null) { + nodes.add(((Instruction) node).stateAfter()); + } + if (node instanceof Merge) { + Merge merge = (Merge) node; + if (merge.stateBefore() != null) { + nodes.add(merge.stateBefore()); + } + for (Node usage : merge.usages()) { + if (usage instanceof Phi) { + nodes.add(usage); + } + } + } + } + + for (Node node : nodes) { + if (!omittedClasses.contains(node.getClass())) { + stream.printf(" <node id='%d'/>%n", node.id()); + } } stream.printf(" </nodes>%n"); stream.printf(" </block>%n", block.blockID());