Fix a bug I introduced (assertion failed: Unknown operand type), and convert to predicate style for type checks

llvm-svn: 531
This commit is contained in:
Chris Lattner 2001-09-10 19:43:38 +00:00
parent 9d1629d688
commit 52084c119f

View File

@ -127,17 +127,12 @@ ostream &operator<<(ostream &os, const MachineOperand &mop) {
case MachineOperand::MO_CCRegister: case MachineOperand::MO_CCRegister:
os << "%ccreg"; os << "%ccreg";
return OutputOperand(os, mop); return OutputOperand(os, mop);
case MachineOperand::MO_SignExtendedImmed: case MachineOperand::MO_SignExtendedImmed:
return os << mop.immedVal; return os << mop.immedVal;
case MachineOperand::MO_UnextendedImmed: case MachineOperand::MO_UnextendedImmed:
return os << mop.immedVal; return os << mop.immedVal;
case MachineOperand::MO_PCRelativeDisp: case MachineOperand::MO_PCRelativeDisp:
os << "%disp(label "; return os << "%disp(label " << mop.getVRegValue() << ")";
return OutputOperand(os, mop) << ")";
default: default:
assert(0 && "Unrecognized operand type"); assert(0 && "Unrecognized operand type");
break; break;
@ -212,12 +207,12 @@ Set3OperandsFromInstrJUNK(MachineInstr* minstr,
minstr->SetMachineOperand(op1Position, /*regNum*/ target.zeroRegNum); minstr->SetMachineOperand(op1Position, /*regNum*/ target.zeroRegNum);
else else
{ {
if (op1Value->getValueType() == Value::ConstantVal) if (op1Value->isConstant()) {
{// value is constant and must be loaded from constant pool // value is constant and must be loaded from constant pool
returnFlags = returnFlags | (1 << op1Position); returnFlags = returnFlags | (1 << op1Position);
} }
minstr->SetMachineOperand(op1Position,MachineOperand::MO_VirtualRegister, minstr->SetMachineOperand(op1Position, MachineOperand::MO_VirtualRegister,
op1Value); op1Value);
} }
// Check if operand 2 (if any) fits in the immed. field of the instruction, // Check if operand 2 (if any) fits in the immed. field of the instruction,
@ -237,10 +232,10 @@ Set3OperandsFromInstrJUNK(MachineInstr* minstr,
minstr->SetMachineOperand(op2Position, machineRegNum); minstr->SetMachineOperand(op2Position, machineRegNum);
else if (op2type == MachineOperand::MO_VirtualRegister) else if (op2type == MachineOperand::MO_VirtualRegister)
{ {
if (op2Value->getValueType() == Value::ConstantVal) if (op2Value->isConstant()) {
{// value is constant and must be loaded from constant pool // value is constant and must be loaded from constant pool
returnFlags = returnFlags | (1 << op2Position); returnFlags = returnFlags | (1 << op2Position);
} }
minstr->SetMachineOperand(op2Position, op2type, op2Value); minstr->SetMachineOperand(op2Position, op2type, op2Value);
} }
else else