# HG changeset patch # User Josef Eisl # Date 1429537444 -7200 # Node ID c927a05097ae409cc04b26235ce6328dda13ec9f # Parent a74a22532c171f4aa2fe4242aba2352a7526216d PhiResolver: use LIRInsertionBuffer instead of LIRGeneratorTool.append(). diff -r a74a22532c17 -r c927a05097ae graal/com.oracle.graal.lir/src/com/oracle/graal/lir/gen/PhiResolver.java --- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/gen/PhiResolver.java Mon Apr 20 15:34:41 2015 +0200 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/gen/PhiResolver.java Mon Apr 20 15:44:04 2015 +0200 @@ -30,6 +30,7 @@ import com.oracle.graal.api.meta.*; import com.oracle.graal.compiler.common.*; +import com.oracle.graal.compiler.common.cfg.*; import com.oracle.graal.lir.*; import com.oracle.graal.lir.gen.LIRGeneratorTool.*; @@ -107,6 +108,8 @@ private final LIRGeneratorTool gen; private final SpillMoveFactory moveFactory; + private final LIRInsertionBuffer buffer; + private final int insertBefore; /** * The operand loop header phi for the operand currently being process in {@link #dispose()}. @@ -127,6 +130,15 @@ this.gen = gen; moveFactory = gen.getSpillMoveFactory(); temp = ILLEGAL; + + AbstractBlockBase block = gen.getCurrentBlock(); + assert block != null; + List instructions = gen.getResult().getLIR().getLIRforBlock(block); + + buffer = new LIRInsertionBuffer(); + buffer.init(instructions); + insertBefore = instructions.size(); + } public void dispose() { @@ -148,6 +160,7 @@ emitMove(node.destinations.get(j).operand, node.operand); } } + buffer.finish(); } public void move(Value dest, Value src) { @@ -192,7 +205,7 @@ assert isLegal(src); assert isLegal(dest); LIRInstruction move = moveFactory.createMove((AllocatableValue) dest, src); - gen.append(move); + buffer.append(insertBefore, move); } // Traverse assignment graph in depth first order and generate moves in post order