Mercurial > hg > graal-jvmci-8
comparison graal/GraalCompiler/src/com/sun/c1x/ir/Merge.java @ 2823:ac4b086cbd72
Merge
author | Gilles Duboscq <gilles.duboscq@oracle.com> |
---|---|
date | Mon, 30 May 2011 16:35:08 +0200 |
parents | 530366123e46 c3f64b66fc78 |
children | d54ea877a302 |
comparison
equal
deleted
inserted
replaced
2822:530366123e46 | 2823:ac4b086cbd72 |
---|---|
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); |
93 builder.append("merge #"); | 79 builder.append("merge #"); |
94 builder.append(id()); | 80 builder.append(id()); |
95 builder.append(" ["); | 81 builder.append(" ["); |
96 | 82 |
97 builder.append("]"); | 83 builder.append("]"); |
98 //if (end() != null) { | 84 |
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 (s == null) { | 88 if (hasSucc) { |
103 continue; | 89 builder.append(", "); |
104 } | 90 } |
105 if (hasSucc) { | 91 builder.append("#"); |
106 builder.append(", "); | 92 if (s != null) { |
107 } | |
108 builder.append("#"); | |
109 builder.append(s.id()); | 93 builder.append(s.id()); |
110 hasSucc = true; | 94 } else { |
111 } | 95 builder.append("null"); |
112 //} | 96 } |
97 hasSucc = true; | |
98 } | |
99 | |
113 return builder.toString(); | 100 return builder.toString(); |
114 } | 101 } |
115 | 102 |
116 public void printWithoutPhis(LogStream out) { | 103 public void printWithoutPhis(LogStream out) { |
117 // print block id | 104 // print block id |
137 } | 124 } |
138 } | 125 } |
139 //} | 126 //} |
140 | 127 |
141 // print predecessors | 128 // print predecessors |
142 if (!blockPredecessors().isEmpty()) { | 129 // if (!blockPredecessors().isEmpty()) { |
143 out.print(" pred:"); | 130 // out.print(" pred:"); |
144 for (Instruction pred : blockPredecessors()) { | 131 // for (Instruction pred : blockPredecessors()) { |
145 out.print(pred.block()); | 132 // out.print(pred.block()); |
146 } | 133 // } |
147 } | 134 // } |
148 } | 135 } |
149 | 136 |
150 @Override | 137 @Override |
151 public void print(LogStream out) { | 138 public void print(LogStream out) { |
152 | 139 |
259 } | 246 } |
260 } | 247 } |
261 sb.append("] "); | 248 sb.append("] "); |
262 } | 249 } |
263 } | 250 } |
264 if (value != null && value.hasSubst()) { | |
265 sb.append("alias ").append(Util.valueString(value.subst())); | |
266 } | |
267 return sb.toString(); | 251 return sb.toString(); |
268 } | 252 } |
269 | 253 |
270 @Override | 254 @Override |
271 public String shortName() { | 255 public String shortName() { |