Mercurial > hg > graal-jvmci-8
comparison graal/GraalCompiler/src/com/sun/c1x/lir/LIRBlock.java @ 2778:2ac7b30b7290
Enabled new block finding algorithm.
author | Thomas Wuerthinger <thomas@wuerthinger.net> |
---|---|
date | Tue, 24 May 2011 21:39:45 +0200 |
parents | 3e4d992fd312 |
children | 93ec3f067420 |
comparison
equal
deleted
inserted
replaced
2777:3e4d992fd312 | 2778:2ac7b30b7290 |
---|---|
27 import com.oracle.max.asm.*; | 27 import com.oracle.max.asm.*; |
28 import com.sun.c1x.alloc.*; | 28 import com.sun.c1x.alloc.*; |
29 import com.sun.c1x.debug.*; | 29 import com.sun.c1x.debug.*; |
30 import com.sun.c1x.ir.*; | 30 import com.sun.c1x.ir.*; |
31 import com.sun.c1x.util.*; | 31 import com.sun.c1x.util.*; |
32 import com.sun.c1x.value.*; | |
33 import com.sun.cri.ci.*; | 32 import com.sun.cri.ci.*; |
34 | 33 |
35 /** | 34 /** |
36 * The {@code LIRBlock} class definition. | 35 * The {@code LIRBlock} class definition. |
37 */ | 36 */ |
41 private LIRList lir; | 40 private LIRList lir; |
42 private final int blockID; | 41 private final int blockID; |
43 private List<Instruction> instructions = new ArrayList<Instruction>(4); | 42 private List<Instruction> instructions = new ArrayList<Instruction>(4); |
44 private List<LIRBlock> predecessors = new ArrayList<LIRBlock>(4); | 43 private List<LIRBlock> predecessors = new ArrayList<LIRBlock>(4); |
45 private List<LIRBlock> successors = new ArrayList<LIRBlock>(4); | 44 private List<LIRBlock> successors = new ArrayList<LIRBlock>(4); |
46 private List<Phi> phis = new ArrayList<Phi>(4); | 45 private List<LIRBlock> exceptionHandlerSuccessors = new ArrayList<LIRBlock>(4); |
47 | 46 |
48 /** | 47 /** |
49 * Bit map specifying which {@linkplain OperandPool operands} are live upon entry to this block. | 48 * Bit map specifying which {@linkplain OperandPool operands} are live upon entry to this block. |
50 * These are values used in this block or any of its successors where such value are not defined | 49 * These are values used in this block or any of its successors where such value are not defined |
51 * in this block. | 50 * in this block. |
75 public CiBitMap liveKill; | 74 public CiBitMap liveKill; |
76 | 75 |
77 private int firstLirInstructionID; | 76 private int firstLirInstructionID; |
78 private int lastLirInstructionID; | 77 private int lastLirInstructionID; |
79 public int blockEntryPco; | 78 public int blockEntryPco; |
79 | |
80 public List<LIRBlock> getExceptionHandlerSuccessors() { | |
81 return exceptionHandlerSuccessors; | |
82 } | |
80 | 83 |
81 public LIRBlock(int blockID) { | 84 public LIRBlock(int blockID) { |
82 this.blockID = blockID; | 85 this.blockID = blockID; |
83 loopIndex = -1; | 86 loopIndex = -1; |
84 linearScanNumber = blockID; | 87 linearScanNumber = blockID; |
103 public void setLastLirInstructionId(int lastLirInstructionId) { | 106 public void setLastLirInstructionId(int lastLirInstructionId) { |
104 this.lastLirInstructionID = lastLirInstructionId; | 107 this.lastLirInstructionID = lastLirInstructionId; |
105 } | 108 } |
106 | 109 |
107 public int loopDepth; | 110 public int loopDepth; |
108 public int loopIndex; | |
109 | 111 |
110 public LIRList lir() { | 112 public LIRList lir() { |
111 return lir; | 113 return lir; |
112 } | 114 } |
113 | 115 |
147 return successors.get(i); | 149 return successors.get(i); |
148 } | 150 } |
149 | 151 |
150 public List<LIRBlock> blockSuccessors() { | 152 public List<LIRBlock> blockSuccessors() { |
151 return successors; | 153 return successors; |
154 } | |
155 | |
156 @Override | |
157 public String toString() { | |
158 return "B" + blockID(); | |
152 } | 159 } |
153 | 160 |
154 public List<LIRBlock> blockPredecessors() { | 161 public List<LIRBlock> blockPredecessors() { |
155 return predecessors; | 162 return predecessors; |
156 } | 163 } |
159 // TODO(tw): Set correct loop depth. | 166 // TODO(tw): Set correct loop depth. |
160 return 0; | 167 return 0; |
161 } | 168 } |
162 | 169 |
163 public int loopIndex() { | 170 public int loopIndex() { |
164 // TODO(tw): Set correct loop index. | 171 return loopIndex; |
165 return -1; | 172 } |
166 } | 173 |
174 public void setLoopIndex(int v) { | |
175 loopIndex = v; | |
176 } | |
177 | |
178 public void setLoopDepth(int v) { | |
179 this.loopDepth = v; | |
180 } | |
181 | |
182 private int loopIndex; | |
167 | 183 |
168 public Label label() { | 184 public Label label() { |
169 return label; | 185 return label; |
170 } | 186 } |
171 | 187 |
172 private int linearScanNumber = -1; | 188 private int linearScanNumber = -1; |
173 private boolean linearScanLoopEnd; | 189 private boolean linearScanLoopEnd; |
174 private boolean linearScanLoopHeader; | 190 private boolean linearScanLoopHeader; |
175 private FrameState stateBefore; | 191 private boolean exceptionEntry; |
192 private boolean backwardBranchTarget; | |
193 | |
194 | |
195 public void setExceptionEntry(boolean b) { | |
196 this.exceptionEntry = b; | |
197 } | |
198 | |
199 public boolean isExceptionEntry() { | |
200 return exceptionEntry; | |
201 } | |
202 | |
203 public void setBackwardBranchTarget(boolean b) { | |
204 this.backwardBranchTarget = b; | |
205 } | |
206 | |
207 public boolean backwardBranchTarget() { | |
208 return backwardBranchTarget; | |
209 } | |
176 | 210 |
177 public void setLinearScanNumber(int v) { | 211 public void setLinearScanNumber(int v) { |
178 linearScanNumber = v; | 212 linearScanNumber = v; |
179 } | 213 } |
180 | 214 |
194 this.linearScanLoopHeader = true; | 228 this.linearScanLoopHeader = true; |
195 } | 229 } |
196 | 230 |
197 public boolean isLinearScanLoopHeader() { | 231 public boolean isLinearScanLoopHeader() { |
198 return linearScanLoopHeader; | 232 return linearScanLoopHeader; |
199 } | |
200 | |
201 public void setStateBefore(FrameState stateBefore) { | |
202 this.stateBefore = stateBefore; | |
203 } | |
204 | |
205 public FrameState stateBefore() { | |
206 return stateBefore; | |
207 } | 233 } |
208 | 234 |
209 public void replaceWith(LIRBlock other) { | 235 public void replaceWith(LIRBlock other) { |
210 for (LIRBlock pred : predecessors) { | 236 for (LIRBlock pred : predecessors) { |
211 Util.replaceAllInList(this, other, pred.successors); | 237 Util.replaceAllInList(this, other, pred.successors); |