Mercurial > hg > truffle
diff graal/GraalCompiler/src/com/sun/c1x/graph/IR.java @ 2779:93ec3f067420
Changed CriticalEdgeFinder to use LIRBlock.
author | Thomas Wuerthinger <thomas@wuerthinger.net> |
---|---|
date | Wed, 25 May 2011 11:04:59 +0200 |
parents | 2ac7b30b7290 |
children | 79dda81dd337 |
line wrap: on
line diff
--- a/graal/GraalCompiler/src/com/sun/c1x/graph/IR.java Tue May 24 21:39:45 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/graph/IR.java Wed May 25 11:04:59 2011 +0200 @@ -80,10 +80,6 @@ C1XTimers.HIR_OPTIMIZE.start(); } - CriticalEdgeFinder finder = new CriticalEdgeFinder(this); - getHIRStartBlock().iteratePreOrder(finder); - finder.splitCriticalEdges(); - Schedule schedule = new Schedule(this.compilation.graph); List<Block> blocks = schedule.getBlocks(); List<LIRBlock> lirBlocks = new ArrayList<LIRBlock>(); @@ -116,9 +112,14 @@ //computeLinearScanOrder(); // assert orderedBlocks.size() == lirBlocks.size(); + + + CriticalEdgeFinder finder = new CriticalEdgeFinder(lirBlocks, compilation.graph); + finder.splitCriticalEdges(); + + orderedBlocks = lirBlocks; - valueToBlock = new HashMap<Value, LIRBlock>(); for (LIRBlock b : orderedBlocks) { for (Instruction i : b.getInstructions()) { @@ -256,55 +257,6 @@ } } - /** - * Creates and inserts a new block between this block and the specified successor, - * altering the successor and predecessor lists of involved blocks appropriately. - * @param source the source of the edge - * @param target the successor before which to insert a block - * @return the new block inserted - */ - public BlockBegin splitEdge(BlockBegin source, BlockBegin target) { - int bci = -2; - - int backEdgeIndex = target.predecessors().indexOf(source.end()); - - // create new successor and mark it for special block order treatment - BlockBegin newSucc = new BlockBegin(bci, nextBlockNumber(), false, compilation.graph); - - List<Integer> removePhiInputs = null; - for (int i = backEdgeIndex + 1; i < target.predecessors().size(); ++i) { - if (target.predecessors().get(i) == source.end()) { - if (removePhiInputs == null) { - removePhiInputs = new ArrayList<Integer>(); - } - removePhiInputs.add(i); - } - } - - // This goto is not a safepoint. - Goto e = new Goto(target, compilation.graph); - newSucc.appendNext(e); - e.reorderSuccessor(0, backEdgeIndex); - - // link predecessor to new block - source.end().substituteSuccessor(target, newSucc); - if (removePhiInputs != null && removePhiInputs.size() > 0) { - - for (Node n : target.usages()) { - if (n instanceof Phi) { - Phi phi = (Phi) n; - int correction = 0; - for (int index : removePhiInputs) { - phi.removeInput(index - correction); - correction++; - } - } - } - - } - - return newSucc; - } public int nextBlockNumber() { return compilation.stats.blockCount++;