comparison graal/GraalCompiler/src/com/sun/c1x/ir/BlockEnd.java @ 2616:3558ca7088c0

FrameState and Graphviz changes: * removed popx, pushx methods from GraphBuilder * FrameState subclass of Value * added String shortName() to Node * added GraphvizPrinter option to use short names * small hack in GraphvizPrinter: omit FrameState->Local connections * added GraalGraphviz to implicit classpatch (read from GRAAL env var)
author Lukas Stadler <lukas.stadler@jku.at>
date Mon, 09 May 2011 17:00:25 +0200
parents 0c6564c254af
children dd115f80acf8
comparison
equal deleted inserted replaced
2615:5768534fd4e5 2616:3558ca7088c0
32 * The {@code BlockEnd} instruction is a base class for all instructions that end a basic 32 * The {@code BlockEnd} instruction is a base class for all instructions that end a basic
33 * block, including branches, switches, throws, and goto's. 33 * block, including branches, switches, throws, and goto's.
34 */ 34 */
35 public abstract class BlockEnd extends Instruction { 35 public abstract class BlockEnd extends Instruction {
36 36
37 private static final int INPUT_COUNT = 0; 37 private static final int INPUT_COUNT = 1;
38 private static final int INPUT_STATE_AFTER = 0;
38 39
39 private final int blockSuccessorCount; 40 private final int blockSuccessorCount;
40 41
41 @Override 42 @Override
42 protected int inputCount() { 43 protected int inputCount() {
46 @Override 47 @Override
47 protected int successorCount() { 48 protected int successorCount() {
48 return super.successorCount() + blockSuccessorCount; 49 return super.successorCount() + blockSuccessorCount;
49 } 50 }
50 51
52 /**
53 * The state for this instruction.
54 */
55 @Override
56 public FrameState stateAfter() {
57 return (FrameState) inputs().get(super.inputCount() + INPUT_STATE_AFTER);
58 }
59
60 public FrameState setStateAfter(FrameState n) {
61 return (FrameState) inputs().set(super.inputCount() + INPUT_STATE_AFTER, n);
62 }
51 /** 63 /**
52 * The list of instructions that produce input for this instruction. 64 * The list of instructions that produce input for this instruction.
53 */ 65 */
54 public BlockBegin blockSuccessor(int index) { 66 public BlockBegin blockSuccessor(int index) {
55 assert index >= 0 && index < blockSuccessorCount; 67 assert index >= 0 && index < blockSuccessorCount;
64 public int blockSuccessorCount() { 76 public int blockSuccessorCount() {
65 return blockSuccessorCount; 77 return blockSuccessorCount;
66 } 78 }
67 79
68 BlockBegin begin; 80 BlockBegin begin;
69 FrameState stateAfter;
70 boolean isSafepoint; 81 boolean isSafepoint;
71 82
72 /** 83 /**
73 * Constructs a new block end with the specified value type. 84 * Constructs a new block end with the specified value type.
74 * @param kind the type of the value produced by this instruction 85 * @param kind the type of the value produced by this instruction
90 this.isSafepoint = isSafepoint; 101 this.isSafepoint = isSafepoint;
91 } 102 }
92 103
93 public BlockEnd(CiKind kind, FrameState stateAfter, boolean isSafepoint, Graph graph) { 104 public BlockEnd(CiKind kind, FrameState stateAfter, boolean isSafepoint, Graph graph) {
94 this(kind, stateAfter, isSafepoint, 2, 0, 0, graph); 105 this(kind, stateAfter, isSafepoint, 2, 0, 0, graph);
95 }
96
97 /**
98 * Gets the state after the end of this block.
99 */
100 @Override
101 public FrameState stateAfter() {
102 return stateAfter;
103 }
104
105 public void setStateAfter(FrameState state) {
106 stateAfter = state;
107 } 106 }
108 107
109 /** 108 /**
110 * Checks whether this instruction is a safepoint. 109 * Checks whether this instruction is a safepoint.
111 * @return {@code true} if this instruction is a safepoint 110 * @return {@code true} if this instruction is a safepoint