diff graal/com.oracle.graal.lir/src/com/oracle/graal/lir/EdgeMoveOptimizer.java @ 7497:0f8c6dbf68be

Code clean up and documentation for ComputeBlockOrder class.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Thu, 17 Jan 2013 17:21:16 +0100
parents 2e96dc4eb8e2
children ca3e5df0e6cf
line wrap: on
line diff
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/EdgeMoveOptimizer.java	Thu Jan 17 00:41:44 2013 +0100
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/EdgeMoveOptimizer.java	Thu Jan 17 17:21:16 2013 +0100
@@ -60,10 +60,10 @@
         for (int i = blockList.size() - 1; i >= 1; i--) {
             Block block = blockList.get(i);
 
-            if (block.numberOfPreds() > 1) {
+            if (block.getPredecessorCount() > 1) {
                 optimizer.optimizeMovesAtBlockEnd(block);
             }
-            if (block.numberOfSux() == 2) {
+            if (block.getSuccessorCount() == 2) {
                 optimizer.optimizeMovesAtBlockBegin(block);
             }
         }
@@ -115,7 +115,7 @@
         // clear all internal data structures
         edgeInstructionSeqences.clear();
 
-        int numPreds = block.numberOfPreds();
+        int numPreds = block.getPredecessorCount();
         assert numPreds > 1 : "do not call otherwise";
 
         // setup a list with the LIR instructions of all predecessors
@@ -124,13 +124,13 @@
             assert ir.lir(pred) != null;
             List<LIRInstruction> predInstructions = ir.lir(pred);
 
-            if (pred.numberOfSux() != 1) {
+            if (pred.getSuccessorCount() != 1) {
                 // this can happen with switch-statements where multiple edges are between
                 // the same blocks.
                 return;
             }
 
-            assert pred.suxAt(0) == block : "invalid control flow";
+            assert pred.getFirstSuccessor() == block : "invalid control flow";
             assert predInstructions.get(predInstructions.size() - 1) instanceof StandardOp.JumpOp : "block must end with unconditional jump";
 
             if (predInstructions.get(predInstructions.size() - 1).hasState()) {
@@ -177,7 +177,7 @@
     private void optimizeMovesAtBlockBegin(Block block) {
 
         edgeInstructionSeqences.clear();
-        int numSux = block.numberOfSux();
+        int numSux = block.getSuccessorCount();
 
         List<LIRInstruction> instructions = ir.lir(block);
 
@@ -203,18 +203,17 @@
         int insertIdx = instructions.size() - 2;
 
         // setup a list with the lir-instructions of all successors
-        for (int i = 0; i < numSux; i++) {
-            Block sux = block.suxAt(i);
+        for (Block sux : block.getSuccessors()) {
             List<LIRInstruction> suxInstructions = ir.lir(sux);
 
             assert suxInstructions.get(0) instanceof StandardOp.LabelOp : "block must start with label";
 
-            if (sux.numberOfPreds() != 1) {
+            if (sux.getPredecessorCount() != 1) {
                 // this can happen with switch-statements where multiple edges are between
                 // the same blocks.
                 return;
             }
-            assert sux.predAt(0) == block : "invalid control flow";
+            assert sux.getPredecessors().get(0) == block : "invalid control flow";
 
             // ignore the label at the beginning of the block
             List<LIRInstruction> seq = suxInstructions.subList(1, suxInstructions.size());