comparison graal/GraalCompiler/src/com/sun/c1x/ir/Merge.java @ 2799:e1dad0edd57a

first part of loop reworking
author Lukas Stadler <lukas.stadler@jku.at>
date Fri, 27 May 2011 17:48:28 +0200
parents 0fd105ff30f1
children 6a1e5d7e1f4e
comparison
equal deleted inserted replaced
2798:58e65eb6bb5d 2799:e1dad0edd57a
31 /** 31 /**
32 * Denotes the beginning of a basic block, and holds information 32 * Denotes the beginning of a basic block, and holds information
33 * about the basic block, including the successor and 33 * about the basic block, including the successor and
34 * predecessor blocks, exception handlers, liveness information, etc. 34 * predecessor blocks, exception handlers, liveness information, etc.
35 */ 35 */
36 public final class Merge extends StateSplit { 36 public class Merge extends StateSplit {
37 37
38 private static final int INPUT_COUNT = 0; 38 private static final int INPUT_COUNT = 0;
39 39
40 private static final int SUCCESSOR_COUNT = 0; 40 private static final int SUCCESSOR_COUNT = 0;
41 41
51 51
52 @Override 52 @Override
53 public boolean needsStateAfter() { 53 public boolean needsStateAfter() {
54 return false; 54 return false;
55 } 55 }
56
57 public final boolean isLoopHeader;
58
59 /**
60 * Index of bytecode that generated this node when appended in a basic block.
61 * Negative values indicate special cases.
62 */
63 private int bci;
64 56
65 /** 57 /**
66 * Constructs a new Merge at the specified bytecode index. 58 * Constructs a new Merge at the specified bytecode index.
67 * @param bci the bytecode index of the start 59 * @param bci the bytecode index of the start
68 * @param blockID the ID of the block 60 * @param blockID the ID of the block
69 * @param graph 61 * @param graph
70 */ 62 */
71 public Merge(int bci, boolean isLoopHeader, Graph graph) { 63 public Merge(Graph graph) {
72 super(CiKind.Illegal, INPUT_COUNT, SUCCESSOR_COUNT, graph); 64 super(CiKind.Illegal, INPUT_COUNT, SUCCESSOR_COUNT, graph);
73 this.bci = bci; 65 }
74 this.isLoopHeader = isLoopHeader; 66
75 } 67 protected Merge(int inputCount, int successorCount, Graph graph) {
76 68 super(CiKind.Illegal, inputCount + INPUT_COUNT, successorCount + SUCCESSOR_COUNT, graph);
77 /**
78 * Gets the bytecode index of this instruction.
79 * @return the bytecode index of this instruction
80 */
81 public int bci() {
82 return bci;
83 } 69 }
84 70
85 @Override 71 @Override
86 public void accept(ValueVisitor v) { 72 public void accept(ValueVisitor v) {
87 v.visitMerge(this); 73 v.visitMerge(this);
97 builder.append("]"); 83 builder.append("]");
98 //if (end() != null) { 84 //if (end() != null) {
99 builder.append(" -> "); 85 builder.append(" -> ");
100 boolean hasSucc = false; 86 boolean hasSucc = false;
101 for (Node s : this.successors()) { 87 for (Node s : this.successors()) {
102 if (hasSucc) { 88 if (s != null) {
103 builder.append(", "); 89 if (hasSucc) {
104 } 90 builder.append(", ");
105 builder.append("#"); 91 }
106 builder.append(s.id()); 92 builder.append("#");
107 hasSucc = true; 93 builder.append(s.id());
94 hasSucc = true;
95 }
108 } 96 }
109 //} 97 //}
110 return builder.toString(); 98 return builder.toString();
111 } 99 }
112 100
262 sb.append("alias ").append(Util.valueString(value.subst())); 250 sb.append("alias ").append(Util.valueString(value.subst()));
263 } 251 }
264 return sb.toString(); 252 return sb.toString();
265 } 253 }
266 254
267 @Override
268 public String shortName() {
269 return "Merge #" + id();
270 }
271 } 255 }