diff graal/GraalCompiler/src/com/sun/c1x/graph/IR.java @ 2841:633e66de40fe

merge
author Lukas Stadler <lukas.stadler@jku.at>
date Tue, 31 May 2011 16:54:15 +0200
parents 75e0d39833a0 adc4b3ec0a8c
children 7596ae867a7b
line wrap: on
line diff
--- a/graal/GraalCompiler/src/com/sun/c1x/graph/IR.java	Tue May 31 16:53:19 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/graph/IR.java	Tue May 31 16:54:15 2011 +0200
@@ -89,7 +89,25 @@
 //        newGraph.addDuplicate(compilation.graph.getNodes(), replacement);
 //        compilation.graph = newGraph;
 
-        Schedule schedule = new Schedule(this.compilation.graph);
+        Graph graph = compilation.graph;
+
+        // Split critical edges.
+        List<Node> nodes = graph.getNodes();
+        for (int i = 0; i < nodes.size(); ++i) {
+            Node n = nodes.get(i);
+            if (Schedule.trueSuccessorCount(n) > 1) {
+                for (int j = 0; j < n.successors().size(); ++j) {
+                    Node succ = n.successors().get(j);
+                    if (Schedule.truePredecessorCount(succ) > 1) {
+                        Anchor a = new Anchor(null, graph);
+                        a.successors().setAndClear(1, n, j);
+                        n.successors().set(j, a);
+                    }
+                }
+            }
+        }
+
+        Schedule schedule = new Schedule(graph);
         List<Block> blocks = schedule.getBlocks();
         List<LIRBlock> lirBlocks = new ArrayList<LIRBlock>();
         Map<Block, LIRBlock> map = new HashMap<Block, LIRBlock>();
@@ -114,9 +132,6 @@
             }
         }
 
-        CriticalEdgeFinder finder = new CriticalEdgeFinder(lirBlocks, compilation.graph);
-        finder.splitCriticalEdges();
-
         orderedBlocks = lirBlocks;
         valueToBlock = new HashMap<Node, LIRBlock>();
         for (LIRBlock b : orderedBlocks) {
@@ -128,14 +143,6 @@
         assert startBlock != null;
         assert startBlock.blockPredecessors().size() == 0;
 
-/*        if (startBlock.blockPredecessors().size() > 0) {
-            LIRBlock oldStartBlock = startBlock;
-            startBlock = new LIRBlock(orderedBlocks.size());
-            startBlock.blockSuccessors().add(oldStartBlock);
-
-            orderedBlocks.add(startBlock);
-        }*/
-
         ComputeLinearScanOrder clso = new ComputeLinearScanOrder(lirBlocks.size(), startBlock);
         orderedBlocks = clso.linearScanOrder();
         this.compilation.stats.loopCount = clso.numLoops();