Mercurial > hg > graal-compiler
diff graal/GraalCompiler/src/com/sun/c1x/ir/BlockBegin.java @ 2751:0fe79e7435c3
More scheduling. Removed need for cfg iteration in the phi simplifier.
author | Thomas Wuerthinger <thomas@wuerthinger.net> |
---|---|
date | Fri, 20 May 2011 14:22:22 +0200 |
parents | a3cd5eb68837 |
children | 0d268cf66e24 |
line wrap: on
line diff
--- a/graal/GraalCompiler/src/com/sun/c1x/ir/BlockBegin.java Fri May 20 12:08:58 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/ir/BlockBegin.java Fri May 20 14:22:22 2011 +0200 @@ -116,7 +116,7 @@ */ @SuppressWarnings({ "unchecked", "rawtypes" }) public List<Instruction> blockPredecessors() { - if (predecessors().size() == 1 && predecessors().get(0) == graph().root()) { + if (predecessors().size() == 1 && predecessors().get(0) == graph().start()) { return Collections.EMPTY_LIST; } else { return (List) Collections.unmodifiableList(predecessors()); @@ -145,65 +145,6 @@ } /** - * Iterate over all blocks transitively reachable from this block. - * @param closure the closure to apply to each block - * @param predecessors {@code true} if also to include this blocks predecessors - */ - public void iterateAnyOrder(BlockClosure closure, boolean predecessors) { - IdentityHashMap<BlockBegin, BlockBegin> mark = new IdentityHashMap<BlockBegin, BlockBegin>(); - LinkedList<BlockBegin> queue = new LinkedList<BlockBegin>(); - queue.offer(this); - mark.put(this, this); - BlockBegin block; - while ((block = queue.poll()) != null) { - closure.apply(block); - - Instruction inst = block; - ArrayList<BlockBegin> excBlocks = new ArrayList<BlockBegin>(); - while (inst != null) { - if (inst instanceof ExceptionEdgeInstruction) { - excBlocks.add(((ExceptionEdgeInstruction) inst).exceptionEdge()); - } - inst = inst.next(); - } - while (excBlocks.remove(null)) { - // nothing - } - if (excBlocks.size() > 0) { - queueBlocks(queue, excBlocks, mark); - } - - queueBlocks(queue, block.end().blockSuccessors(), mark); - if (predecessors) { - queueBlockEnds(queue, block.blockPredecessors(), mark); - } - } - } - - private void queueBlocks(LinkedList<BlockBegin> queue, List<BlockBegin> list, IdentityHashMap<BlockBegin, BlockBegin> mark) { - if (list != null) { - for (BlockBegin b : list) { - if (!mark.containsKey(b)) { - queue.offer(b); - mark.put(b, b); - } - } - } - } - - private void queueBlockEnds(LinkedList<BlockBegin> queue, List<Instruction> list, IdentityHashMap<BlockBegin, BlockBegin> mark) { - if (list != null) { - for (Instruction end : list) { - BlockBegin b = end.block(); - if (!mark.containsKey(b)) { - queue.offer(b); - mark.put(b, b); - } - } - } - } - - /** * Gets the bytecode index of this instruction. * @return the bytecode index of this instruction */ @@ -298,7 +239,7 @@ */ public int numberOfPreds() { // ignore the graph root - if (predecessors().size() == 1 && predecessors().get(0) == graph().root()) { + if (predecessors().size() == 1 && predecessors().get(0) == graph().start()) { return 0; } else { return predecessors().size();