changeset 15199:38f9b0506cc4

LIRGenerator: only use AbstractBlocks.
author Josef Eisl <josef.eisl@jku.at>
date Thu, 17 Apr 2014 18:01:21 +0200
parents 2c0cfbf454b5
children 97eed257999b
files graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/LIRGenerator.java graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/NodeLIRBuilder.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/cfg/ControlFlowGraph.java
diffstat 3 files changed, 9 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/LIRGenerator.java	Thu Apr 17 17:28:20 2014 +0200
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/LIRGenerator.java	Thu Apr 17 18:01:21 2014 +0200
@@ -44,7 +44,6 @@
 import com.oracle.graal.lir.StandardOp.NoOp;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.calc.*;
-import com.oracle.graal.nodes.cfg.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.options.*;
 import com.oracle.graal.phases.util.*;
@@ -94,14 +93,14 @@
          * The block that does or will contain {@link #op}. This is initially the block where the
          * first usage of the constant is seen during LIR generation.
          */
-        Block block;
+        AbstractBlock<?> block;
 
         /**
          * The variable into which the constant is loaded.
          */
         final Variable variable;
 
-        public LoadConstant(Variable variable, Block block, int index, LIRInstruction op) {
+        public LoadConstant(Variable variable, AbstractBlock<?> block, int index, LIRInstruction op) {
             this.variable = variable;
             this.block = block;
             this.index = index;
@@ -245,16 +244,6 @@
         return value;
     }
 
-    public LabelRef getLIRBlock(FixedNode b) {
-        assert res.getLIR().getControlFlowGraph() instanceof ControlFlowGraph;
-        Block result = ((ControlFlowGraph) res.getLIR().getControlFlowGraph()).blockFor(b);
-        int suxIndex = currentBlock.getSuccessors().indexOf(result);
-        assert suxIndex != -1 : "Block not in successor list of current block";
-
-        assert currentBlock instanceof Block;
-        return LabelRef.forSuccessor(res.getLIR(), currentBlock, suxIndex);
-    }
-
     /**
      * Determines if only oop maps are required for the code generated from the LIR.
      */
@@ -488,7 +477,7 @@
 
                 // Move loads of constant outside of loops
                 if (OptScheduleOutOfLoops.getValue()) {
-                    Block outOfLoopDominator = lc.block;
+                    AbstractBlock<?> outOfLoopDominator = lc.block;
                     while (outOfLoopDominator.getLoop() != null) {
                         outOfLoopDominator = outOfLoopDominator.getDominator();
                     }
@@ -514,7 +503,7 @@
             int groupBegin = 0;
             while (true) {
                 int groupEnd = groupBegin + 1;
-                Block block = groupedByBlock[groupBegin].block;
+                AbstractBlock<?> block = groupedByBlock[groupBegin].block;
                 while (groupEnd < groupedByBlock.length && groupedByBlock[groupEnd].block == block) {
                     groupEnd++;
                 }
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/NodeLIRBuilder.java	Thu Apr 17 17:28:20 2014 +0200
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/NodeLIRBuilder.java	Thu Apr 17 18:01:21 2014 +0200
@@ -121,9 +121,9 @@
                         int index = gen.getResult().getLIR().getLIRforBlock(gen.getCurrentBlock()).size();
                         loadedValue = gen.emitMove(value);
                         LIRInstruction op = gen.getResult().getLIR().getLIRforBlock(gen.getCurrentBlock()).get(index);
-                        gen.constantLoads.put(value, new LoadConstant(loadedValue, (Block) gen.getCurrentBlock(), index, op));
+                        gen.constantLoads.put(value, new LoadConstant(loadedValue, gen.getCurrentBlock(), index, op));
                     } else {
-                        Block dominator = ControlFlowGraph.commonDominator(load.block, (Block) gen.getCurrentBlock());
+                        AbstractBlock<?> dominator = ControlFlowGraph.commonDominator((Block) load.block, (Block) gen.getCurrentBlock());
                         loadedValue = load.variable;
                         if (dominator != load.block) {
                             load.unpin(gen.getResult().getLIR());
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/cfg/ControlFlowGraph.java	Thu Apr 17 17:28:20 2014 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/cfg/ControlFlowGraph.java	Thu Apr 17 18:01:21 2014 +0200
@@ -321,15 +321,15 @@
         dominator.dominated.add(block);
     }
 
-    public static Block commonDominator(Block a, Block b) {
+    public static <T extends AbstractBlock<T>> T commonDominator(T a, T b) {
         if (a == null) {
             return b;
         }
         if (b == null) {
             return a;
         }
-        Block iterA = a;
-        Block iterB = b;
+        T iterA = a;
+        T iterB = b;
         while (iterA != iterB) {
             if (iterA.getId() > iterB.getId()) {
                 iterA = iterA.getDominator();