Mercurial > hg > truffle
comparison graal/GraalCompiler/src/com/sun/c1x/ir/BlockEnd.java @ 2750:6048da340364
less references to BlockBegin in BlockEnd instructions
author | Lukas Stadler <lukas.stadler@jku.at> |
---|---|
date | Fri, 20 May 2011 14:22:19 +0200 |
parents | 027adfafd47e |
children | dbb4c8b6d5cd |
comparison
equal
deleted
inserted
replaced
2749:36440e516e44 | 2750:6048da340364 |
---|---|
75 public BlockBegin blockSuccessor(int index) { | 75 public BlockBegin blockSuccessor(int index) { |
76 assert index >= 0 && index < blockSuccessorCount; | 76 assert index >= 0 && index < blockSuccessorCount; |
77 return (BlockBegin) successors().get(super.successorCount() + SUCCESSOR_COUNT + index); | 77 return (BlockBegin) successors().get(super.successorCount() + SUCCESSOR_COUNT + index); |
78 } | 78 } |
79 | 79 |
80 public BlockBegin setBlockSuccessor(int index, BlockBegin n) { | 80 public Instruction setBlockSuccessor(int index, Instruction n) { |
81 assert index >= 0 && index < blockSuccessorCount; | 81 assert index >= 0 && index < blockSuccessorCount; |
82 assert n instanceof BlockBegin : "only BlockBegins, for now..."; | |
82 return (BlockBegin) successors().set(super.successorCount() + SUCCESSOR_COUNT + index, n); | 83 return (BlockBegin) successors().set(super.successorCount() + SUCCESSOR_COUNT + index, n); |
83 } | 84 } |
84 | 85 |
85 public int blockSuccessorCount() { | 86 public int blockSuccessorCount() { |
86 return blockSuccessorCount; | 87 return blockSuccessorCount; |
91 * @param kind the type of the value produced by this instruction | 92 * @param kind the type of the value produced by this instruction |
92 * @param stateAfter the frame state at the end of this block | 93 * @param stateAfter the frame state at the end of this block |
93 * @param isSafepoint {@code true} if this instruction is a safepoint instruction | 94 * @param isSafepoint {@code true} if this instruction is a safepoint instruction |
94 * @param successors the list of successor blocks. If {@code null}, a new one will be created. | 95 * @param successors the list of successor blocks. If {@code null}, a new one will be created. |
95 */ | 96 */ |
96 public BlockEnd(CiKind kind, FrameState stateAfter, List<BlockBegin> blockSuccessors, int inputCount, int successorCount, Graph graph) { | 97 public BlockEnd(CiKind kind, FrameState stateAfter, List<? extends Instruction> blockSuccessors, int inputCount, int successorCount, Graph graph) { |
97 this(kind, stateAfter, blockSuccessors.size(), inputCount, successorCount, graph); | 98 this(kind, stateAfter, blockSuccessors.size(), inputCount, successorCount, graph); |
98 for (int i = 0; i < blockSuccessors.size(); i++) { | 99 for (int i = 0; i < blockSuccessors.size(); i++) { |
99 setBlockSuccessor(i, blockSuccessors.get(i)); | 100 setBlockSuccessor(i, blockSuccessors.get(i)); |
100 } | 101 } |
101 } | 102 } |
164 /** | 165 /** |
165 * This method reorders the predecessors of the i-th successor in such a way that this BlockEnd is at position backEdgeIndex. | 166 * This method reorders the predecessors of the i-th successor in such a way that this BlockEnd is at position backEdgeIndex. |
166 */ | 167 */ |
167 public void reorderSuccessor(int i, int backEdgeIndex) { | 168 public void reorderSuccessor(int i, int backEdgeIndex) { |
168 assert i >= 0 && i < blockSuccessorCount; | 169 assert i >= 0 && i < blockSuccessorCount; |
169 BlockBegin successor = blockSuccessor(i); | 170 Instruction successor = blockSuccessor(i); |
170 if (successor != null) { | 171 if (successor != null) { |
171 successors().set(super.successorCount() + SUCCESSOR_COUNT + i, Node.Null); | 172 successors().set(super.successorCount() + SUCCESSOR_COUNT + i, Node.Null); |
172 successors().set(super.successorCount() + SUCCESSOR_COUNT + i, successor, backEdgeIndex); | 173 successors().set(super.successorCount() + SUCCESSOR_COUNT + i, successor, backEdgeIndex); |
173 } | 174 } |
174 } | 175 } |