Mercurial > hg > truffle
diff graal/GraalCompiler/src/com/sun/c1x/gen/LIRGenerator.java @ 2823:ac4b086cbd72
Merge
author | Gilles Duboscq <gilles.duboscq@oracle.com> |
---|---|
date | Mon, 30 May 2011 16:35:08 +0200 |
parents | 530366123e46 d27bdbec3d67 |
children | 9ba6a8abe894 |
line wrap: on
line diff
--- a/graal/GraalCompiler/src/com/sun/c1x/gen/LIRGenerator.java Fri May 27 15:41:10 2011 +0200 +++ b/graal/GraalCompiler/src/com/sun/c1x/gen/LIRGenerator.java Mon May 30 16:35:08 2011 +0200 @@ -198,8 +198,6 @@ variablesForConstants = new ArrayList<CiVariable>(); this.operands = new OperandPool(compilation.target); - - new PhiSimplifier(ir); } public ArrayList<DeoptimizationStub> deoptimizationStubs() { @@ -230,8 +228,15 @@ TTY.println("BEGIN Generating LIR for block B" + block.blockID()); } - for (Instruction instr : block.getInstructions()) { - FrameState stateAfter = instr.stateAfter(); + if (block.blockPredecessors().size() > 1) { + lastState = null; + } + + for (Node instr : block.getInstructions()) { + FrameState stateAfter = null; + if (instr instanceof Instruction) { + stateAfter = ((Instruction) instr).stateAfter(); + } FrameState stateBefore = null; if (instr instanceof StateSplit && ((StateSplit) instr).stateBefore() != null) { stateBefore = ((StateSplit) instr).stateBefore(); @@ -245,9 +250,9 @@ } } } - if (!(instr instanceof Merge)) { + if (!(instr instanceof Merge) && instr != instr.graph().start()) { walkState(instr, stateAfter); - doRoot(instr); + doRoot((Value) instr); } if (stateAfter != null) { lastState = stateAfter; @@ -273,8 +278,8 @@ blockDoEpilog(); } - private static boolean jumpsToNextBlock(Instruction instr) { - return instr instanceof BlockEnd; + private static boolean jumpsToNextBlock(Node node) { + return node instanceof BlockEnd; } @Override @@ -695,11 +700,11 @@ } } - protected CiValue emitXir(XirSnippet snippet, Instruction x, LIRDebugInfo info, RiMethod method, boolean setInstructionResult) { + protected CiValue emitXir(XirSnippet snippet, Value x, LIRDebugInfo info, RiMethod method, boolean setInstructionResult) { return emitXir(snippet, x, info, null, method, setInstructionResult, null); } - protected CiValue emitXir(XirSnippet snippet, Instruction instruction, LIRDebugInfo info, LIRDebugInfo infoAfter, RiMethod method, boolean setInstructionResult, List<CiValue> pointerSlots) { + protected CiValue emitXir(XirSnippet snippet, Value instruction, LIRDebugInfo info, LIRDebugInfo infoAfter, RiMethod method, boolean setInstructionResult, List<CiValue> pointerSlots) { if (C1XOptions.PrintXirTemplates) { TTY.println("Emit XIR template " + snippet.template.name); } @@ -1225,12 +1230,11 @@ return res.toArray(new SwitchRange[res.size()]); } - void doRoot(Instruction instr) { + void doRoot(Value instr) { if (C1XOptions.TraceLIRGeneratorLevel >= 2) { - TTY.println("Emitting LIR for instruction " + instr.toString()); + TTY.println("Emitting LIR for instruction " + instr); } currentInstruction = instr; - assert !instr.hasSubst() : "shouldn't have missed substitution"; if (C1XOptions.TraceLIRVisit) { TTY.println("Visiting " + instr); @@ -1299,7 +1303,7 @@ private List<Phi> getPhis(LIRBlock block) { if (block.getInstructions().size() > 0) { - Instruction i = block.getInstructions().get(0); + Node i = block.firstInstruction(); if (i instanceof Merge) { List<Phi> result = new ArrayList<Phi>(); for (Node n : i.usages()) { @@ -1441,7 +1445,7 @@ } } - protected void walkState(Instruction x, FrameState state) { + protected void walkState(Node x, FrameState state) { if (state == null) { return; } @@ -1463,7 +1467,6 @@ private void walkStateValue(Value value) { if (value != null) { - assert !value.hasSubst() : "missed substitution on " + value.toString(); if (value instanceof Phi && !value.isIllegal()) { // phi's are special operandForPhi((Phi) value); @@ -1475,12 +1478,12 @@ } } - protected LIRDebugInfo stateFor(Instruction x) { + protected LIRDebugInfo stateFor(Value x) { assert lastState != null : "must have state before instruction for " + x; return stateFor(x, lastState); } - protected LIRDebugInfo stateFor(Instruction x, FrameState state) { + protected LIRDebugInfo stateFor(Value x, FrameState state) { if (compilation.placeholderState != null) { state = compilation.placeholderState; } @@ -1549,7 +1552,7 @@ } } // the value must be a constant or have a valid operand - assert operand.isLegal() : "this root has not been visited yet"; + assert operand.isLegal() : "this root has not been visited yet; instruction=" + instruction; return operand; }