# HG changeset patch # User Lukas Stadler # Date 1306761566 -7200 # Node ID 31e0786a986cf19d614e7a94b974b2d38d0f33ca # Parent b003ea36fa12bad3151764439e7c395aa1e46815 IdealGraph: fix omittedClasses, put FrameStates, Locals and Phis into the correct blocks diff -r b003ea36fa12 -r 31e0786a986c graal/GraalCompiler/src/com/sun/c1x/debug/IdealGraphPrinter.java --- a/graal/GraalCompiler/src/com/sun/c1x/debug/IdealGraphPrinter.java Mon May 30 14:55:09 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/debug/IdealGraphPrinter.java Mon May 30 15:19:26 2011 +0200 @@ -28,6 +28,7 @@ import com.oracle.graal.graph.*; import com.oracle.max.graal.schedule.*; +import com.sun.c1x.ir.*; /** * Generates a representation of {@link Graph Graphs} that can be visualized and inspected with the "); for (Block block : schedule.getBlocks()) { - printBlock(block); + printBlock(graph, block); } printNoBlock(); stream.println(" "); @@ -137,7 +138,7 @@ ArrayList edges = new ArrayList(); for (Node node : nodes) { - if (node == Node.Null || omittedClasses.contains(node)) { + if (node == Node.Null || omittedClasses.contains(node.getClass())) { continue; } @@ -195,7 +196,7 @@ stream.printf(" %n", edge.from, edge.fromIndex, edge.to, edge.toIndex); } - private void printBlock(Block block) { + private void printBlock(Graph graph, Block block) { stream.printf(" %n", block.blockID()); stream.printf(" %n"); for (Block sux : block.getSuccessors()) { @@ -203,8 +204,38 @@ } stream.printf(" %n"); stream.printf(" %n"); + + ArrayList nodes = new ArrayList(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(" %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(" %n", node.id()); + } } stream.printf(" %n"); stream.printf(" %n", block.blockID());