Mercurial > hg > graal-compiler
comparison graal/GraalCompiler/src/com/sun/c1x/ir/BlockEnd.java @ 2793:d3fc4fe063bf
Rename BlockBegin to Merge, remove some Block related member from it. Made CFGPrinter work with the Block class from schedule
author | Gilles Duboscq <gilles.duboscq@oracle.com> |
---|---|
date | Fri, 27 May 2011 11:08:55 +0200 |
parents | 50677668afe3 |
children | e1dad0edd57a |
comparison
equal
deleted
inserted
replaced
2792:2f3258e3800e | 2793:d3fc4fe063bf |
---|---|
57 } | 57 } |
58 | 58 |
59 public Instruction setBlockSuccessor(int index, Instruction n) { | 59 public Instruction setBlockSuccessor(int index, Instruction n) { |
60 assert index >= 0 && index < blockSuccessorCount; | 60 assert index >= 0 && index < blockSuccessorCount; |
61 // assert n == null || n instanceof BlockBegin : "only BlockBegins, for now... " + n.getClass(); | 61 // assert n == null || n instanceof BlockBegin : "only BlockBegins, for now... " + n.getClass(); |
62 return (BlockBegin) successors().set(super.successorCount() + SUCCESSOR_COUNT + index, n); | 62 return (Merge) successors().set(super.successorCount() + SUCCESSOR_COUNT + index, n); |
63 } | 63 } |
64 | 64 |
65 public int blockSuccessorCount() { | 65 public int blockSuccessorCount() { |
66 return blockSuccessorCount; | 66 return blockSuccessorCount; |
67 } | 67 } |
89 | 89 |
90 /** | 90 /** |
91 * Gets the block begin associated with this block end. | 91 * Gets the block begin associated with this block end. |
92 * @return the beginning of this basic block | 92 * @return the beginning of this basic block |
93 */ | 93 */ |
94 public BlockBegin begin() { | 94 public Merge begin() { |
95 for (Node n : predecessors()) { | 95 for (Node n : predecessors()) { |
96 if (n instanceof BlockBegin) { | 96 if (n instanceof Merge) { |
97 return (BlockBegin) n; | 97 return (Merge) n; |
98 } | 98 } |
99 } | 99 } |
100 return null; | 100 return null; |
101 } | 101 } |
102 | 102 |
104 * Substitutes a successor block in this block end's successor list. Note that | 104 * Substitutes a successor block in this block end's successor list. Note that |
105 * this method updates all occurrences in the list. | 105 * this method updates all occurrences in the list. |
106 * @param oldSucc the old successor to replace | 106 * @param oldSucc the old successor to replace |
107 * @param newSucc the new successor | 107 * @param newSucc the new successor |
108 */ | 108 */ |
109 public int substituteSuccessor(BlockBegin oldSucc, BlockBegin newSucc) { | 109 public int substituteSuccessor(Merge oldSucc, Merge newSucc) { |
110 assert newSucc != null; | 110 assert newSucc != null; |
111 int count = 0; | 111 int count = 0; |
112 for (int i = 0; i < blockSuccessorCount; i++) { | 112 for (int i = 0; i < blockSuccessorCount; i++) { |
113 if (blockSuccessor(i) == oldSucc) { | 113 if (blockSuccessor(i) == oldSucc) { |
114 setBlockSuccessor(i, newSucc); | 114 setBlockSuccessor(i, newSucc); |
130 * Searches for the specified successor and returns its index into the | 130 * Searches for the specified successor and returns its index into the |
131 * successor list if found. | 131 * successor list if found. |
132 * @param b the block to search for in the successor list | 132 * @param b the block to search for in the successor list |
133 * @return the index of the block in the list if found; <code>-1</code> otherwise | 133 * @return the index of the block in the list if found; <code>-1</code> otherwise |
134 */ | 134 */ |
135 public int successorIndex(BlockBegin b) { | 135 public int successorIndex(Merge b) { |
136 for (int i = 0; i < blockSuccessorCount; i++) { | 136 for (int i = 0; i < blockSuccessorCount; i++) { |
137 if (blockSuccessor(i) == b) { | 137 if (blockSuccessor(i) == b) { |
138 return i; | 138 return i; |
139 } | 139 } |
140 } | 140 } |
144 /** | 144 /** |
145 * Gets this block end's list of successors. | 145 * Gets this block end's list of successors. |
146 * @return the successor list | 146 * @return the successor list |
147 */ | 147 */ |
148 @SuppressWarnings({ "unchecked", "rawtypes"}) | 148 @SuppressWarnings({ "unchecked", "rawtypes"}) |
149 public List<BlockBegin> blockSuccessors() { | 149 public List<Instruction> blockSuccessors() { |
150 List<BlockBegin> list = (List) successors().subList(super.successorCount() + SUCCESSOR_COUNT, super.successorCount() + blockSuccessorCount + SUCCESSOR_COUNT); | 150 List<Instruction> list = (List) successors().subList(super.successorCount() + SUCCESSOR_COUNT, super.successorCount() + blockSuccessorCount + SUCCESSOR_COUNT); |
151 return Collections.unmodifiableList(list); | 151 return Collections.unmodifiableList(list); |
152 } | 152 } |
153 | 153 |
154 public void clearSuccessors() { | 154 public void clearSuccessors() { |
155 for (int i = 0; i < blockSuccessorCount(); i++) { | 155 for (int i = 0; i < blockSuccessorCount(); i++) { |