Mercurial > hg > truffle
changeset 4317:ef004bae30ae
Improvement to LIR Verification
author | Christian Wimmer <Christian.Wimmer@Oracle.com> |
---|---|
date | Thu, 19 Jan 2012 18:49:51 -0800 |
parents | 9ce8594bedaf |
children | e3374bccaa5f dc6f6e2f1a00 |
files | graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/alloc/util/LIRVerifier.java |
diffstat | 1 files changed, 13 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- 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<OperandFlag> 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<OperandFlag> 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);