comparison graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/LIRGenerator.java @ 6411:c5afcc2ebd3d

change of project structure: separate compiler and LIR, put EA into separate project
author Lukas Stadler <lukas.stadler@jku.at>
date Mon, 17 Sep 2012 16:08:46 +0200
parents 823a2978e7ba
children 5395ecdfce8a
comparison
equal deleted inserted replaced
6410:debe42b2b92f 6411:c5afcc2ebd3d
279 protected LabelRef getLIRBlock(FixedNode b) { 279 protected LabelRef getLIRBlock(FixedNode b) {
280 Block result = lir.cfg.blockFor(b); 280 Block result = lir.cfg.blockFor(b);
281 int suxIndex = currentBlock.getSuccessors().indexOf(result); 281 int suxIndex = currentBlock.getSuccessors().indexOf(result);
282 assert suxIndex != -1 : "Block not in successor list of current block"; 282 assert suxIndex != -1 : "Block not in successor list of current block";
283 283
284 return LabelRef.forSuccessor(currentBlock, suxIndex); 284 return LabelRef.forSuccessor(lir, currentBlock, suxIndex);
285 } 285 }
286 286
287 public LIRFrameState state() { 287 public LIRFrameState state() {
288 assert lastState != null : "must have state before instruction"; 288 assert lastState != null : "must have state before instruction";
289 return stateFor(lastState, -1); 289 return stateFor(lastState, -1);
325 ip.printInstructionListing(currentInstruction); 325 ip.printInstructionListing(currentInstruction);
326 } 326 }
327 TTY.println(op.toStringWithIdPrefix()); 327 TTY.println(op.toStringWithIdPrefix());
328 TTY.println(); 328 TTY.println();
329 } 329 }
330 currentBlock.lir.add(op); 330 lir.lir(currentBlock).add(op);
331 } 331 }
332 332
333 public void doBlock(Block block) { 333 public void doBlock(Block block) {
334 if (GraalOptions.PrintIRWithLIR) { 334 if (GraalOptions.PrintIRWithLIR) {
335 TTY.print(block.toString()); 335 TTY.print(block.toString());
336 } 336 }
337 337
338 currentBlock = block; 338 currentBlock = block;
339 // set up the list of LIR instructions 339 // set up the list of LIR instructions
340 assert block.lir == null : "LIR list already computed for this block"; 340 assert lir.lir(block) == null : "LIR list already computed for this block";
341 block.lir = new ArrayList<>(); 341 lir.setLir(block, new ArrayList<LIRInstruction>());
342 342
343 append(new LabelOp(new Label(), block.align)); 343 append(new LabelOp(new Label(), block.align));
344 344
345 if (GraalOptions.TraceLIRGeneratorLevel >= 1) { 345 if (GraalOptions.TraceLIRGeneratorLevel >= 1) {
346 TTY.println("BEGIN Generating LIR for block B" + block.getId()); 346 TTY.println("BEGIN Generating LIR for block B" + block.getId());
484 fs = fs.outerFrameState(); 484 fs = fs.outerFrameState();
485 } 485 }
486 return true; 486 return true;
487 } 487 }
488 488
489 private static boolean endsWithJump(Block block) { 489 private boolean endsWithJump(Block block) {
490 if (block.lir.size() == 0) { 490 List<LIRInstruction> instructions = lir.lir(block);
491 if (instructions.size() == 0) {
491 return false; 492 return false;
492 } 493 }
493 LIRInstruction lirInstruction = block.lir.get(block.lir.size() - 1); 494 LIRInstruction lirInstruction = instructions.get(instructions.size() - 1);
494 if (lirInstruction instanceof LIRXirInstruction) { 495 if (lirInstruction instanceof LIRXirInstruction) {
495 LIRXirInstruction lirXirInstruction = (LIRXirInstruction) lirInstruction; 496 LIRXirInstruction lirXirInstruction = (LIRXirInstruction) lirInstruction;
496 return (lirXirInstruction.falseSuccessor != null) && (lirXirInstruction.trueSuccessor != null); 497 return (lirXirInstruction.falseSuccessor != null) && (lirXirInstruction.trueSuccessor != null);
497 } 498 }
498 return lirInstruction instanceof StandardOp.JumpOp; 499 return lirInstruction instanceof StandardOp.JumpOp;