Make MachineOperand's value named 'contents'. Make really, really sure

it is always completely initialized and copied.
Also, fix up many comments and asserts.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12100 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Brian Gaeke
2004-03-03 19:07:27 +00:00
parent ba2e09891a
commit c54839573c
2 changed files with 105 additions and 70 deletions

View File

@ -100,7 +100,7 @@ void MachineInstr::SetMachineOperandVal(unsigned i,
Value* V) {
assert(i < operands.size()); // may be explicit or implicit op
operands[i].opType = opTy;
operands[i].value = V;
operands[i].contents.value = V;
operands[i].regNum = -1;
}
@ -113,8 +113,8 @@ MachineInstr::SetMachineOperandConst(unsigned i,
"immed. constant cannot be defined");
operands[i].opType = opTy;
operands[i].value = NULL;
operands[i].immedVal = intValue;
operands[i].contents.value = NULL;
operands[i].contents.immedVal = intValue;
operands[i].regNum = -1;
operands[i].flags = 0;
}
@ -123,7 +123,7 @@ void MachineInstr::SetMachineOperandReg(unsigned i, int regNum) {
assert(i < getNumOperands()); // must be explicit op
operands[i].opType = MachineOperand::MO_MachineRegister;
operands[i].value = NULL;
operands[i].contents.value = NULL;
operands[i].regNum = regNum;
}
@ -162,7 +162,7 @@ MachineInstr::substituteValue(const Value* oldVal, Value* newVal,
notDefsAndUses && (O.isDef() && !O.isUse()) ||
!notDefsAndUses && O.isDef())
{
O.getMachineOperand().value = newVal;
O.getMachineOperand().contents.value = newVal;
++numSubst;
}
else
@ -175,7 +175,7 @@ MachineInstr::substituteValue(const Value* oldVal, Value* newVal,
notDefsAndUses && (getImplicitOp(i).isDef() && !getImplicitOp(i).isUse()) ||
!notDefsAndUses && getImplicitOp(i).isDef())
{
getImplicitOp(i).value = newVal;
getImplicitOp(i).contents.value = newVal;
++numSubst;
}
else