Mercurial > hg > truffle
comparison graal/GraalCompiler/src/com/sun/c1x/ir/ComputeLinearScanOrder.java @ 2674:6ab73784566a
* BlockBegin.predecessors changed to List<BlockEnd>
* Node: add input/successor with given back edge index, allows for explicit ordering of predecessors/usages
* Graphviz: PDF output, option to omit FrameStates
* runscimark.sh: forward additional options to JVM
author | Lukas Stadler <lukas.stadler@jku.at> |
---|---|
date | Fri, 13 May 2011 15:18:41 +0200 |
parents | 4a6518c4d17d |
children | 773189811d10 7ed72769d51a |
comparison
equal
deleted
inserted
replaced
2673:98447ab8bd83 | 2674:6ab73784566a |
---|---|
248 assert isBlockInLoop(loopIdx, cur) : "bit in loop map must be set when block is in work list"; | 248 assert isBlockInLoop(loopIdx, cur) : "bit in loop map must be set when block is in work list"; |
249 | 249 |
250 // recursive processing of all predecessors ends when start block of loop is reached | 250 // recursive processing of all predecessors ends when start block of loop is reached |
251 if (cur != loopStart) { | 251 if (cur != loopStart) { |
252 for (int j = cur.numberOfPreds() - 1; j >= 0; j--) { | 252 for (int j = cur.numberOfPreds() - 1; j >= 0; j--) { |
253 BlockBegin pred = cur.predAt(j); | 253 BlockBegin pred = cur.predAt(j).begin(); |
254 | 254 |
255 if (!isBlockInLoop(loopIdx, pred)) { | 255 if (!isBlockInLoop(loopIdx, pred)) { |
256 // this predecessor has not been processed yet, so add it to work list | 256 // this predecessor has not been processed yet, so add it to work list |
257 if (C1XOptions.TraceLinearScanLevel >= 3) { | 257 if (C1XOptions.TraceLinearScanLevel >= 3) { |
258 TTY.println(" pushing B%d", pred.blockID); | 258 TTY.println(" pushing B%d", pred.blockID); |
537 assert linearScanOrder.get(0).numberOfPreds() == 0 : "must not have predecessors"; | 537 assert linearScanOrder.get(0).numberOfPreds() == 0 : "must not have predecessors"; |
538 for (int i = 1; i < numBlocks; i++) { | 538 for (int i = 1; i < numBlocks; i++) { |
539 BlockBegin block = linearScanOrder.get(i); | 539 BlockBegin block = linearScanOrder.get(i); |
540 | 540 |
541 assert block.numberOfPreds() > 0; | 541 assert block.numberOfPreds() > 0; |
542 BlockBegin dominator = block.predAt(0); | 542 BlockBegin dominator = block.predAt(0).begin(); |
543 if (block.isExceptionEntry()) { | 543 if (block.isExceptionEntry()) { |
544 dominator = dominator.dominator(); | 544 dominator = dominator.dominator(); |
545 } | 545 } |
546 | 546 |
547 int numPreds = block.numberOfPreds(); | 547 int numPreds = block.numberOfPreds(); |
548 for (int j = 1; j < numPreds; j++) { | 548 for (int j = 1; j < numPreds; j++) { |
549 BlockBegin curPred = block.predAt(j); | 549 BlockBegin curPred = block.predAt(j).begin(); |
550 if (block.isExceptionEntry()) { | 550 if (block.isExceptionEntry()) { |
551 curPred = curPred.dominator(); | 551 curPred = curPred.dominator(); |
552 } | 552 } |
553 dominator = commonDominator(dominator, curPred); | 553 dominator = commonDominator(dominator, curPred); |
554 } | 554 } |
613 } | 613 } |
614 | 614 |
615 if (cur.numberOfPreds() > 0) { | 615 if (cur.numberOfPreds() > 0) { |
616 TTY.print(" preds: "); | 616 TTY.print(" preds: "); |
617 for (int j = 0; j < cur.numberOfPreds(); j++) { | 617 for (int j = 0; j < cur.numberOfPreds(); j++) { |
618 BlockBegin pred = cur.predAt(j); | 618 BlockBegin pred = cur.predAt(j).begin(); |
619 TTY.print("B%d ", pred.blockID); | 619 TTY.print("B%d ", pred.blockID); |
620 } | 620 } |
621 } | 621 } |
622 if (cur.numberOfSux() > 0) { | 622 if (cur.numberOfSux() > 0) { |
623 TTY.print(" sux: "); | 623 TTY.print(" sux: "); |
664 if (cur.loopDepth() == sux.loopDepth()) { | 664 if (cur.loopDepth() == sux.loopDepth()) { |
665 assert cur.loopIndex() == sux.loopIndex() || sux.checkBlockFlag(BlockBegin.BlockFlag.LinearScanLoopHeader) : "successing blocks with same loop depth must have same loop index"; | 665 assert cur.loopIndex() == sux.loopIndex() || sux.checkBlockFlag(BlockBegin.BlockFlag.LinearScanLoopHeader) : "successing blocks with same loop depth must have same loop index"; |
666 } | 666 } |
667 } | 667 } |
668 | 668 |
669 for (BlockBegin pred : cur.blockPredecessors()) { | 669 for (BlockEnd pred : cur.blockPredecessors()) { |
670 assert pred.linearScanNumber() >= 0 && pred.linearScanNumber() == linearScanOrder.indexOf(pred) : "incorrect linearScanNumber"; | 670 BlockBegin begin = pred.begin(); |
671 assert begin.linearScanNumber() >= 0 && begin.linearScanNumber() == linearScanOrder.indexOf(begin) : "incorrect linearScanNumber"; | |
671 if (!cur.checkBlockFlag(BlockBegin.BlockFlag.LinearScanLoopHeader)) { | 672 if (!cur.checkBlockFlag(BlockBegin.BlockFlag.LinearScanLoopHeader)) { |
672 assert cur.linearScanNumber() > pred.linearScanNumber() : "invalid order"; | 673 assert cur.linearScanNumber() > begin.linearScanNumber() : "invalid order"; |
673 } | 674 } |
674 if (cur.loopDepth() == pred.loopDepth()) { | 675 if (cur.loopDepth() == begin.loopDepth()) { |
675 assert cur.loopIndex() == pred.loopIndex() || cur.checkBlockFlag(BlockBegin.BlockFlag.LinearScanLoopHeader) : "successing blocks with same loop depth must have same loop index"; | 676 assert cur.loopIndex() == begin.loopIndex() || cur.checkBlockFlag(BlockBegin.BlockFlag.LinearScanLoopHeader) : "successing blocks with same loop depth must have same loop index"; |
676 } | 677 } |
677 | 678 |
678 assert cur.dominator().linearScanNumber() <= pred.linearScanNumber() : "dominator must be before predecessors"; | 679 assert cur.dominator().linearScanNumber() <= begin.linearScanNumber() : "dominator must be before predecessors"; |
679 } | 680 } |
680 | 681 |
681 // check dominator | 682 // check dominator |
682 if (i == 0) { | 683 if (i == 0) { |
683 assert cur.dominator() == null : "first block has no dominator"; | 684 assert cur.dominator() == null : "first block has no dominator"; |
684 } else { | 685 } else { |
685 assert cur.dominator() != null : "all but first block must have dominator"; | 686 assert cur.dominator() != null : "all but first block must have dominator"; |
686 } | 687 } |
687 assert cur.numberOfPreds() != 1 || cur.dominator() == cur.predAt(0) || cur.isExceptionEntry() : "Single predecessor must also be dominator"; | 688 assert cur.numberOfPreds() != 1 || cur.dominator() == cur.predAt(0).begin() || cur.isExceptionEntry() : "Single predecessor must also be dominator"; |
688 } | 689 } |
689 | 690 |
690 // check that all loops are continuous | 691 // check that all loops are continuous |
691 for (int loopIdx = 0; loopIdx < numLoops; loopIdx++) { | 692 for (int loopIdx = 0; loopIdx < numLoops; loopIdx++) { |
692 int blockIdx = 0; | 693 int blockIdx = 0; |