diff graal/GraalCompiler/src/com/sun/c1x/alloc/EdgeMoveOptimizer.java @ 2718:c1ce2a53d6c3

Attempt to remove dependency between backend and BlockBegin.
author Thomas Wuerthinger <thomas@wuerthinger.net>
date Thu, 19 May 2011 16:05:42 +0200
parents 7ed72769d51a
children 2ac7b30b7290
line wrap: on
line diff
--- a/graal/GraalCompiler/src/com/sun/c1x/alloc/EdgeMoveOptimizer.java	Thu May 19 14:31:03 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/alloc/EdgeMoveOptimizer.java	Thu May 19 16:05:42 2011 +0200
@@ -59,12 +59,12 @@
      *
      * @param blockList a list of blocks whose moves should be optimized
      */
-    public static void optimize(List<BlockBegin> blockList) {
+    public static void optimize(List<LIRBlock> blockList) {
         EdgeMoveOptimizer optimizer = new EdgeMoveOptimizer();
 
         // ignore the first block in the list (index 0 is not processed)
         for (int i = blockList.size() - 1; i >= 1; i--) {
-            BlockBegin block = blockList.get(i);
+            LIRBlock block = blockList.get(i);
 
             if (block.numberOfPreds() > 1) {
                 optimizer.optimizeMovesAtBlockEnd(block);
@@ -111,8 +111,8 @@
      * Moves the longest {@linkplain #same common} subsequence at the end all
      * predecessors of {@code block} to the start of {@code block}.
      */
-    private void optimizeMovesAtBlockEnd(BlockBegin block) {
-        if (block.isPredecessor(block.end())) {
+    private void optimizeMovesAtBlockEnd(LIRBlock block) {
+        if (block.isPredecessor(block)) {
             // currently we can't handle this correctly.
             return;
         }
@@ -125,7 +125,7 @@
 
         // setup a list with the LIR instructions of all predecessors
         for (int i = 0; i < numPreds; i++) {
-            BlockBegin pred = block.predAt(i).block();
+            LIRBlock pred = block.predAt(i);
             List<LIRInstruction> predInstructions = pred.lir().instructionsList();
 
             if (pred.numberOfSux() != 1) {
@@ -180,7 +180,7 @@
      * successors of {@code block} to the end of {@code block} just prior to the
      * branch instruction ending {@code block}.
      */
-    private void optimizeMovesAtBlockBegin(BlockBegin block) {
+    private void optimizeMovesAtBlockBegin(LIRBlock block) {
 
         edgeInstructionSeqences.clear();
         int numSux = block.numberOfSux();
@@ -220,7 +220,7 @@
 
         // setup a list with the lir-instructions of all successors
         for (int i = 0; i < numSux; i++) {
-            BlockBegin sux = block.suxAt(i);
+            LIRBlock sux = block.suxAt(i);
             List<LIRInstruction> suxInstructions = sux.lir().instructionsList();
 
             assert suxInstructions.get(0).code == LIROpcode.Label : "block must start with label";
@@ -230,7 +230,7 @@
                 // the same blocks.
                 return;
             }
-            assert sux.predAt(0).block() == block : "invalid control flow";
+            assert sux.predAt(0) == block : "invalid control flow";
 
             // ignore the label at the beginning of the block
             List<LIRInstruction> seq = suxInstructions.subList(1, suxInstructions.size());