Mercurial > hg > graal-jvmci-8
comparison graal/GraalCompiler/src/com/sun/c1x/lir/LIRBlock.java @ 2718:c1ce2a53d6c3
Attempt to remove dependency between backend and BlockBegin.
author | Thomas Wuerthinger <thomas@wuerthinger.net> |
---|---|
date | Thu, 19 May 2011 16:05:42 +0200 |
parents | 4272b7af2d17 |
children | 127db58b044e |
comparison
equal
deleted
inserted
replaced
2717:bd85cf08720a | 2718:c1ce2a53d6c3 |
---|---|
20 * or visit www.oracle.com if you need additional information or have any | 20 * or visit www.oracle.com if you need additional information or have any |
21 * questions. | 21 * questions. |
22 */ | 22 */ |
23 package com.sun.c1x.lir; | 23 package com.sun.c1x.lir; |
24 | 24 |
25 import java.util.*; | |
26 | |
25 import com.oracle.max.asm.*; | 27 import com.oracle.max.asm.*; |
26 import com.sun.c1x.alloc.*; | 28 import com.sun.c1x.alloc.*; |
29 import com.sun.c1x.debug.*; | |
30 import com.sun.c1x.ir.*; | |
31 import com.sun.c1x.value.*; | |
27 import com.sun.cri.ci.*; | 32 import com.sun.cri.ci.*; |
28 | 33 |
29 /** | 34 /** |
30 * The {@code LIRBlock} class definition. | 35 * The {@code LIRBlock} class definition. |
31 */ | 36 */ |
32 public final class LIRBlock { | 37 public final class LIRBlock { |
33 | 38 |
34 public LIRBlock() { | |
35 loopIndex = -1; | |
36 } | |
37 | |
38 public final Label label = new Label(); | 39 public final Label label = new Label(); |
39 private LIRList lir; | 40 private LIRList lir; |
41 private final int blockID; | |
42 private List<Instruction> instructions = new ArrayList<Instruction>(4); | |
43 private List<LIRBlock> predecessors = new ArrayList<LIRBlock>(); | |
44 private List<LIRBlock> successors = new ArrayList<LIRBlock>(); | |
40 | 45 |
41 /** | 46 /** |
42 * Bit map specifying which {@linkplain OperandPool operands} are live upon entry to this block. | 47 * Bit map specifying which {@linkplain OperandPool operands} are live upon entry to this block. |
43 * These are values used in this block or any of its successors where such value are not defined | 48 * These are values used in this block or any of its successors where such value are not defined |
44 * in this block. | 49 * in this block. |
69 | 74 |
70 private int firstLirInstructionID; | 75 private int firstLirInstructionID; |
71 private int lastLirInstructionID; | 76 private int lastLirInstructionID; |
72 public int blockEntryPco; | 77 public int blockEntryPco; |
73 | 78 |
79 public LIRBlock(int blockID) { | |
80 this.blockID = blockID; | |
81 loopIndex = -1; | |
82 } | |
83 | |
84 public List<Instruction> getInstructions() { | |
85 return instructions; | |
86 } | |
87 | |
74 public int firstLirInstructionId() { | 88 public int firstLirInstructionId() { |
75 return firstLirInstructionID; | 89 return firstLirInstructionID; |
76 } | 90 } |
77 | 91 |
78 public void setFirstLirInstructionId(int firstLirInstructionId) { | 92 public void setFirstLirInstructionId(int firstLirInstructionId) { |
95 } | 109 } |
96 | 110 |
97 public void setLir(LIRList lir) { | 111 public void setLir(LIRList lir) { |
98 this.lir = lir; | 112 this.lir = lir; |
99 } | 113 } |
114 | |
115 public void setBlockEntryPco(int codePos) { | |
116 this.blockEntryPco = codePos; | |
117 } | |
118 | |
119 public void printWithoutPhis(LogStream out) { | |
120 out.println("LIR Block " + blockID()); | |
121 } | |
122 | |
123 public int blockID() { | |
124 return blockID; | |
125 } | |
126 | |
127 public int numberOfPreds() { | |
128 return predecessors.size(); | |
129 } | |
130 | |
131 public int numberOfSux() { | |
132 return successors.size(); | |
133 } | |
134 | |
135 public boolean isPredecessor(LIRBlock block) { | |
136 return predecessors.contains(block); | |
137 } | |
138 | |
139 public LIRBlock predAt(int i) { | |
140 return predecessors.get(i); | |
141 } | |
142 | |
143 public LIRBlock suxAt(int i) { | |
144 return successors.get(i); | |
145 } | |
146 | |
147 public List<LIRBlock> blockSuccessors() { | |
148 return successors; | |
149 } | |
150 | |
151 public List<LIRBlock> blockPredecessors() { | |
152 return predecessors; | |
153 } | |
154 | |
155 public int loopDepth() { | |
156 // TODO(tw): Set correct loop depth. | |
157 return 0; | |
158 } | |
159 | |
160 public int loopIndex() { | |
161 // TODO(tw): Set correct loop index. | |
162 return -1; | |
163 } | |
164 | |
165 public Label label() { | |
166 return label; | |
167 } | |
168 | |
169 private int linearScanNumber = -1; | |
170 private boolean linearScanLoopEnd; | |
171 private boolean linearScanLoopHeader; | |
172 private FrameState stateBefore; | |
173 | |
174 public void setLinearScanNumber(int v) { | |
175 linearScanNumber = v; | |
176 } | |
177 | |
178 public int linearScanNumber() { | |
179 return linearScanNumber; | |
180 } | |
181 | |
182 public void setLinearScanLoopEnd() { | |
183 linearScanLoopEnd = true; | |
184 } | |
185 | |
186 public boolean isLinearScanLoopEnd() { | |
187 return linearScanLoopEnd; | |
188 } | |
189 | |
190 public void setLinearScanLoopHeader() { | |
191 this.linearScanLoopHeader = true; | |
192 } | |
193 | |
194 public boolean isLinearScanLoopHeader() { | |
195 return linearScanLoopHeader; | |
196 } | |
197 | |
198 public void setStateBefore(FrameState stateBefore) { | |
199 this.stateBefore = stateBefore; | |
200 } | |
201 | |
202 public FrameState stateBefore() { | |
203 return stateBefore; | |
204 } | |
100 } | 205 } |