changeset 2760:127db58b044e

One more step towards schedule.
author Thomas Wuerthinger <thomas@wuerthinger.net>
date Fri, 20 May 2011 16:56:58 +0200
parents b72e6638b9e6
children d3398b21faf9
files graal/GraalCompiler/src/com/oracle/max/graal/schedule/Schedule.java graal/GraalCompiler/src/com/sun/c1x/graph/IR.java graal/GraalCompiler/src/com/sun/c1x/lir/LIRBlock.java
diffstat 3 files changed, 29 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/graal/GraalCompiler/src/com/oracle/max/graal/schedule/Schedule.java	Fri May 20 16:40:32 2011 +0200
+++ b/graal/GraalCompiler/src/com/oracle/max/graal/schedule/Schedule.java	Fri May 20 16:56:58 2011 +0200
@@ -39,6 +39,14 @@
         identifyBlocks();
     }
 
+    public List<Block> getBlocks() {
+        return Collections.unmodifiableList(blocks);
+    }
+
+    public NodeMap<Block> getNodeToBlock() {
+        return nodeToBlock;
+    }
+
     private Block createBlock() {
         Block b = new Block(blocks.size());
         blocks.add(b);
--- a/graal/GraalCompiler/src/com/sun/c1x/graph/IR.java	Fri May 20 16:40:32 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/graph/IR.java	Fri May 20 16:56:58 2011 +0200
@@ -24,6 +24,7 @@
 
 import java.util.*;
 
+import com.oracle.graal.graph.*;
 import com.oracle.max.graal.schedule.*;
 import com.sun.c1x.*;
 import com.sun.c1x.debug.*;
@@ -84,6 +85,25 @@
         }
 
         Schedule schedule = new Schedule(this.compilation.graph);
+        List<Block> blocks = schedule.getBlocks();
+        NodeMap<Block> nodeToBlock = schedule.getNodeToBlock();
+        Map<Block, LIRBlock> map = new HashMap<Block, LIRBlock>();
+        for (Block b : blocks) {
+            map.put(b, new LIRBlock(b.blockID()));
+        }
+
+        for (Block b : blocks) {
+            for (Block succ : b.getSuccessors()) {
+                map.get(b).blockSuccessors().add(map.get(succ));
+            }
+
+            for (Block pred : b.getPredecessors()) {
+                map.get(b).blockPredecessors().add(map.get(pred));
+            }
+        }
+
+        // TODO(tw): Schedule nodes within a block.
+
 
         valueToBlock = computeLinearScanOrder();
         verifyAndPrint("After linear scan order");
--- a/graal/GraalCompiler/src/com/sun/c1x/lir/LIRBlock.java	Fri May 20 16:40:32 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/lir/LIRBlock.java	Fri May 20 16:56:58 2011 +0200
@@ -79,6 +79,7 @@
     public LIRBlock(int blockID) {
         this.blockID = blockID;
         loopIndex = -1;
+        linearScanNumber = blockID;
     }
 
     public List<Instruction> getInstructions() {