aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/MachineInstr.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2001-09-10 19:43:38 +0000
committerChris Lattner <sabre@nondot.org>2001-09-10 19:43:38 +0000
commitb221a763862ccaed46dee3fbf56c384981d84fbd (patch)
tree9b900ccd43a9f9930d9eebdc01ddec05b955fe38 /lib/CodeGen/MachineInstr.cpp
parent70cc3397f84c2e1fd69c059a0ef89e398e847b00 (diff)
Fix a bug I introduced (assertion failed: Unknown operand type), and convert to predicate style for type checks
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@531 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/MachineInstr.cpp')
-rw-r--r--lib/CodeGen/MachineInstr.cpp27
1 files changed, 11 insertions, 16 deletions
diff --git a/lib/CodeGen/MachineInstr.cpp b/lib/CodeGen/MachineInstr.cpp
index 7a5214d260..63acea14b4 100644
--- a/lib/CodeGen/MachineInstr.cpp
+++ b/lib/CodeGen/MachineInstr.cpp
@@ -127,17 +127,12 @@ ostream &operator<<(ostream &os, const MachineOperand &mop) {
case MachineOperand::MO_CCRegister:
os << "%ccreg";
return OutputOperand(os, mop);
-
case MachineOperand::MO_SignExtendedImmed:
return os << mop.immedVal;
-
case MachineOperand::MO_UnextendedImmed:
return os << mop.immedVal;
-
case MachineOperand::MO_PCRelativeDisp:
- os << "%disp(label ";
- return OutputOperand(os, mop) << ")";
-
+ return os << "%disp(label " << mop.getVRegValue() << ")";
default:
assert(0 && "Unrecognized operand type");
break;
@@ -212,12 +207,12 @@ Set3OperandsFromInstrJUNK(MachineInstr* minstr,
minstr->SetMachineOperand(op1Position, /*regNum*/ target.zeroRegNum);
else
{
- if (op1Value->getValueType() == Value::ConstantVal)
- {// value is constant and must be loaded from constant pool
- returnFlags = returnFlags | (1 << op1Position);
- }
- minstr->SetMachineOperand(op1Position,MachineOperand::MO_VirtualRegister,
- op1Value);
+ if (op1Value->isConstant()) {
+ // value is constant and must be loaded from constant pool
+ returnFlags = returnFlags | (1 << op1Position);
+ }
+ minstr->SetMachineOperand(op1Position, MachineOperand::MO_VirtualRegister,
+ op1Value);
}
// 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);
else if (op2type == MachineOperand::MO_VirtualRegister)
{
- if (op2Value->getValueType() == Value::ConstantVal)
- {// value is constant and must be loaded from constant pool
- returnFlags = returnFlags | (1 << op2Position);
- }
+ if (op2Value->isConstant()) {
+ // value is constant and must be loaded from constant pool
+ returnFlags = returnFlags | (1 << op2Position);
+ }
minstr->SetMachineOperand(op2Position, op2type, op2Value);
}
else