comparison graal/GraalCompiler/src/com/sun/c1x/gen/LIRGenerator.java @ 2623:b129b7da1397

Some fixes around LIRGenerator / frame state. New option C1X:TraceLIRGeneratorLevel
author Thomas Wuerthinger <thomas@wuerthinger.net>
date Tue, 10 May 2011 14:34:03 +0200
parents 91d3952f7eb7
children 569228710be8 c93adece95d2
comparison
equal deleted inserted replaced
2622:91d3952f7eb7 2623:b129b7da1397
223 223
224 public void doBlock(BlockBegin block) { 224 public void doBlock(BlockBegin block) {
225 blockDoProlog(block); 225 blockDoProlog(block);
226 this.currentBlock = block; 226 this.currentBlock = block;
227 227
228 if (C1XOptions.TraceLIRGeneratorLevel >= 1) {
229 TTY.println("BEGIN Generating LIR for block B" + block.blockID);
230 }
231
228 for (Instruction instr = block; instr != null; instr = instr.next()) { 232 for (Instruction instr = block; instr != null; instr = instr.next()) {
229 FrameState stateAfter = instr.stateAfter(); 233 FrameState stateAfter = instr.stateAfter();
230 if (stateAfter != null) {
231 lastState = stateAfter;
232 }
233 if (!(instr instanceof BlockBegin)) { 234 if (!(instr instanceof BlockBegin)) {
234 walkState(instr, stateAfter); 235 walkState(instr, stateAfter);
235 doRoot(instr); 236 doRoot(instr);
236 } 237 }
238 if (stateAfter != null) {
239 lastState = stateAfter;
240 if (C1XOptions.TraceLIRGeneratorLevel >= 2) {
241 TTY.println("STATE CHANGE");
242 if (C1XOptions.TraceLIRGeneratorLevel >= 3) {
243 TTY.println(stateAfter.toString());
244 }
245 }
246 }
247 }
248
249 if (C1XOptions.TraceLIRGeneratorLevel >= 1) {
250 TTY.println("END Generating LIR for block B" + block.blockID);
237 } 251 }
238 252
239 this.currentBlock = null; 253 this.currentBlock = null;
240 blockDoEpilog(block); 254 blockDoEpilog(block);
241 } 255 }
254 268
255 @Override 269 @Override
256 public void visitBase(Base x) { 270 public void visitBase(Base x) {
257 // emit phi-instruction move after safepoint since this simplifies 271 // emit phi-instruction move after safepoint since this simplifies
258 // describing the state at the safepoint. 272 // describing the state at the safepoint.
259 moveToPhi(); 273 //moveToPhi();
260 274
261 // all blocks with a successor must end with an unconditional jump 275 // all blocks with a successor must end with an unconditional jump
262 // to the successor even if they are consecutive 276 // to the successor even if they are consecutive
263 lir.jump(x.defaultSuccessor()); 277 lir.jump(x.defaultSuccessor());
264 } 278 }
1232 } 1246 }
1233 return res.toArray(new SwitchRange[res.size()]); 1247 return res.toArray(new SwitchRange[res.size()]);
1234 } 1248 }
1235 1249
1236 void doRoot(Instruction instr) { 1250 void doRoot(Instruction instr) {
1251 if (C1XOptions.TraceLIRGeneratorLevel >= 2) {
1252 TTY.println("Emitting LIR for instruction " + instr.toString());
1253 }
1237 currentInstruction = instr; 1254 currentInstruction = instr;
1238 assert !instr.hasSubst() : "shouldn't have missed substitution"; 1255 assert !instr.hasSubst() : "shouldn't have missed substitution";
1239 1256
1240 if (C1XOptions.TraceLIRVisit) { 1257 if (C1XOptions.TraceLIRVisit) {
1241 TTY.println("Visiting " + instr); 1258 TTY.println("Visiting " + instr);