Mercurial > hg > graal-compiler
comparison graal/GraalCompiler/src/com/sun/c1x/ir/BlockBegin.java @ 2724:e2d20fc3760f
Removed last BlockBegin flag.
author | Thomas Wuerthinger <thomas@wuerthinger.net> |
---|---|
date | Thu, 19 May 2011 16:46:37 +0200 |
parents | 173067211acb |
children | 819a40e46826 |
comparison
equal
deleted
inserted
replaced
2723:173067211acb | 2724:e2d20fc3760f |
---|---|
75 } | 75 } |
76 | 76 |
77 private static final List<BlockBegin> NO_HANDLERS = Collections.emptyList(); | 77 private static final List<BlockBegin> NO_HANDLERS = Collections.emptyList(); |
78 | 78 |
79 /** | 79 /** |
80 * An enumeration of flags for block entries indicating various things. | |
81 */ | |
82 public enum BlockFlag { | |
83 ParserLoopHeader; | |
84 | |
85 public final int mask = 1 << ordinal(); | |
86 } | |
87 | |
88 /** | |
89 * A unique id used in tracing. | 80 * A unique id used in tracing. |
90 */ | 81 */ |
91 public final int blockID; | 82 public final int blockID; |
92 | 83 |
93 /** | 84 /** |
95 */ | 86 */ |
96 private int blockFlags; | 87 private int blockFlags; |
97 | 88 |
98 private int depthFirstNumber; | 89 private int depthFirstNumber; |
99 private int linearScanNumber; | 90 private int linearScanNumber; |
100 | |
101 private BlockBegin dominator; | |
102 | 91 |
103 // LIR block | 92 // LIR block |
104 private LIRBlock lirBlock; | 93 private LIRBlock lirBlock; |
105 | 94 |
106 public void setLIRBlock(LIRBlock block) { | 95 public void setLIRBlock(LIRBlock block) { |
139 return (List) Collections.unmodifiableList(predecessors()); | 128 return (List) Collections.unmodifiableList(predecessors()); |
140 } | 129 } |
141 } | 130 } |
142 | 131 |
143 /** | 132 /** |
144 * Sets the dominator block for this block. | |
145 * @param dominator the dominator for this block | |
146 */ | |
147 public void setDominator(BlockBegin dominator) { | |
148 this.dominator = dominator; | |
149 } | |
150 | |
151 /** | |
152 * Gets the depth first traversal number of this block. | 133 * Gets the depth first traversal number of this block. |
153 * @return the depth first number | 134 * @return the depth first number |
154 */ | 135 */ |
155 public int depthFirstNumber() { | 136 public int depthFirstNumber() { |
156 return depthFirstNumber; | 137 return depthFirstNumber; |
169 this.depthFirstNumber = depthFirstNumber; | 150 this.depthFirstNumber = depthFirstNumber; |
170 } | 151 } |
171 | 152 |
172 public void setLinearScanNumber(int linearScanNumber) { | 153 public void setLinearScanNumber(int linearScanNumber) { |
173 this.linearScanNumber = linearScanNumber; | 154 this.linearScanNumber = linearScanNumber; |
174 } | |
175 | |
176 /** | |
177 * Set a flag on this block. | |
178 * @param flag the flag to set | |
179 */ | |
180 public void setBlockFlag(BlockFlag flag) { | |
181 blockFlags |= flag.mask; | |
182 } | |
183 | |
184 /** | |
185 * Clear a flag on this block. | |
186 * @param flag the flag to clear | |
187 */ | |
188 public void clearBlockFlag(BlockFlag flag) { | |
189 blockFlags &= ~flag.mask; | |
190 } | |
191 | |
192 public void copyBlockFlag(BlockBegin other, BlockFlag flag) { | |
193 setBlockFlag(flag, other.checkBlockFlag(flag)); | |
194 } | |
195 | |
196 /** | |
197 * Check whether this block has the specified flag set. | |
198 * @param flag the flag to test | |
199 * @return {@code true} if this block has the flag | |
200 */ | |
201 public boolean checkBlockFlag(BlockFlag flag) { | |
202 return (blockFlags & flag.mask) != 0; | |
203 } | 155 } |
204 | 156 |
205 /** | 157 /** |
206 * Iterate over this block, its exception handlers, and its successors, in that order. | 158 * Iterate over this block, its exception handlers, and its successors, in that order. |
207 * @param closure the closure to apply to each block | 159 * @param closure the closure to apply to each block |
390 newState.setupPhiForLocal(this, i); | 342 newState.setupPhiForLocal(this, i); |
391 } | 343 } |
392 } | 344 } |
393 } | 345 } |
394 | 346 |
347 boolean parserLoopHeader; | |
348 | |
395 public boolean isParserLoopHeader() { | 349 public boolean isParserLoopHeader() { |
396 return checkBlockFlag(BlockFlag.ParserLoopHeader); | 350 return parserLoopHeader; |
397 } | 351 } |
398 | 352 |
399 public void setParserLoopHeader(boolean value) { | 353 public void setParserLoopHeader(boolean value) { |
400 setBlockFlag(BlockFlag.ParserLoopHeader, value); | 354 parserLoopHeader = value; |
401 } | |
402 | |
403 private void setBlockFlag(BlockFlag flag, boolean value) { | |
404 if (value) { | |
405 setBlockFlag(flag); | |
406 } else { | |
407 clearBlockFlag(flag); | |
408 } | |
409 } | 355 } |
410 | 356 |
411 @Override | 357 @Override |
412 public String toString() { | 358 public String toString() { |
413 StringBuilder builder = new StringBuilder(); | 359 StringBuilder builder = new StringBuilder(); |
414 builder.append("block #"); | 360 builder.append("block #"); |
415 builder.append(blockID); | 361 builder.append(blockID); |
416 builder.append(","); | 362 builder.append(","); |
417 builder.append(depthFirstNumber); | 363 builder.append(depthFirstNumber); |
418 builder.append(" ["); | 364 builder.append(" ["); |
419 boolean hasFlag = false; | |
420 for (BlockFlag f : BlockFlag.values()) { | |
421 if (checkBlockFlag(f)) { | |
422 if (hasFlag) { | |
423 builder.append(' '); | |
424 } | |
425 builder.append(f.name()); | |
426 hasFlag = true; | |
427 } | |
428 } | |
429 | 365 |
430 builder.append("]"); | 366 builder.append("]"); |
431 if (end() != null) { | 367 if (end() != null) { |
432 builder.append(" -> "); | 368 builder.append(" -> "); |
433 boolean hasSucc = false; | 369 boolean hasSucc = false; |