# HG changeset patch # User Christian Wimmer # Date 1327027791 28800 # Node ID ef004bae30ae3d6c79b2ccaa585c2886a9cf23c4 # Parent 9ce8594bedafcd5f593d1c4296bd0a01f164fdc9 Improvement to LIR Verification diff -r 9ce8594bedaf -r ef004bae30ae graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/alloc/util/LIRVerifier.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/alloc/util/LIRVerifier.java Thu Jan 19 14:14:36 2012 -0800 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/alloc/util/LIRVerifier.java Thu Jan 19 18:49:51 2012 -0800 @@ -147,7 +147,9 @@ private CiValue use(CiValue value, OperandMode mode, EnumSet flags) { allowed(curInstruction, value, mode, flags); - if (beforeRegisterAllocation && isVariable(value)) { + if (isVariable(value)) { + assert beforeRegisterAllocation; + int variableIdx = asVariable(value).index; if (!curVariablesLive.get(variableIdx)) { TTY.println("block %s instruction %s", curBlock, curInstruction); @@ -159,9 +161,13 @@ throw Util.shouldNotReachHere(); } - } else if (beforeRegisterAllocation && isAllocatableRegister(value)) { + } else if (isAllocatableRegister(value)) { int regNum = asRegister(value).number; - if (curRegistersLive[regNum] != value) { + if (mode == OperandMode.Alive) { + curRegistersDefined.set(regNum); + } + + if (beforeRegisterAllocation && curRegistersLive[regNum] != value) { TTY.println("block %s instruction %s", curBlock, curInstruction); TTY.println("live registers: %s", Arrays.toString(curRegistersLive)); TTY.println("ERROR: Use of fixed register %s that is not defined in this block", value); @@ -174,7 +180,9 @@ private CiValue def(CiValue value, OperandMode mode, EnumSet flags) { allowed(curInstruction, value, mode, flags); - if (beforeRegisterAllocation && isVariable(value)) { + if (isVariable(value)) { + assert beforeRegisterAllocation; + int variableIdx = asVariable(value).index; if (variableDefinitions[variableIdx] != null) { TTY.println("block %s instruction %s", curBlock, curInstruction); @@ -190,7 +198,7 @@ curVariablesLive.set(variableIdx); } - } else if (beforeRegisterAllocation && isAllocatableRegister(value)) { + } else if (isAllocatableRegister(value)) { int regNum = asRegister(value).number; if (curRegistersDefined.get(regNum)) { TTY.println("block %s instruction %s", curBlock, curInstruction);