Rename MO_VirtualRegister -> MO_Register. Clean up immediate handling.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28104 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2006-05-04 18:05:43 +00:00
parent 68ab4c6367
commit 2d90ac7ca6
11 changed files with 37 additions and 52 deletions

View File

@@ -61,7 +61,7 @@ public:
};
enum MachineOperandType {
MO_VirtualRegister, // virtual register for *value
MO_Register, // Register operand.
MO_Immediate, // Immediate Operand
MO_MachineBasicBlock, // MachineBasicBlock reference
MO_FrameIndex, // Abstract Stack Frame Index
@@ -93,12 +93,17 @@ private:
extra.offset = 0;
}
MachineOperand(int64_t ImmVal, MachineOperandType OpTy, int Offset = 0)
: flags(0), opType(OpTy) {
MachineOperand(int64_t ImmVal) : flags(0), opType(MO_Immediate) {
contents.immedVal = ImmVal;
extra.offset = Offset;
extra.offset = 0;
}
MachineOperand(unsigned Idx, MachineOperandType OpTy)
: flags(0), opType(OpTy) {
contents.immedVal = Idx;
extra.offset = 0;
}
MachineOperand(int Reg, MachineOperandType OpTy, UseType UseTy)
: flags(UseTy), opType(OpTy) {
zeroContents();
@@ -152,7 +157,7 @@ public:
/// Accessors that tell you what kind of MachineOperand you're looking at.
///
bool isRegister() const { return opType == MO_VirtualRegister; }
bool isRegister() const { return opType == MO_Register; }
bool isImmediate() const { return opType == MO_Immediate; }
bool isMachineBasicBlock() const { return opType == MO_MachineBasicBlock; }
bool isFrameIndex() const { return opType == MO_FrameIndex; }
@@ -245,7 +250,7 @@ public:
/// the specified value. If an operand is known to be an register already,
/// the setReg method should be used.
void ChangeToRegister(unsigned Reg) {
opType = MO_VirtualRegister;
opType = MO_Register;
extra.regNum = Reg;
}
@@ -353,16 +358,6 @@ public:
// Accessors to add operands when building up machine instructions
//
/// addRegOperand - Add a symbolic virtual register reference...
///
void addRegOperand(int reg, bool isDef) {
assert(!OperandsComplete() &&
"Trying to add an operand to a machine instr that is already done!");
operands.push_back(
MachineOperand(reg, MachineOperand::MO_VirtualRegister,
isDef ? MachineOperand::Def : MachineOperand::Use));
}
/// addRegOperand - Add a symbolic virtual register reference...
///
void addRegOperand(int reg,
@@ -370,26 +365,16 @@ public:
assert(!OperandsComplete() &&
"Trying to add an operand to a machine instr that is already done!");
operands.push_back(
MachineOperand(reg, MachineOperand::MO_VirtualRegister, UTy));
MachineOperand(reg, MachineOperand::MO_Register, UTy));
}
/// addZeroExtImmOperand - Add a zero extended constant argument to the
/// addImmOperand - Add a zero extended constant argument to the
/// machine instruction.
///
void addZeroExtImmOperand(int intValue) {
void addImmOperand(int64_t Val) {
assert(!OperandsComplete() &&
"Trying to add an operand to a machine instr that is already done!");
operands.push_back(
MachineOperand(intValue, MachineOperand::MO_Immediate));
}
/// addZeroExtImm64Operand - Add a zero extended 64-bit constant argument
/// to the machine instruction.
///
void addZeroExtImm64Operand(uint64_t intValue) {
assert(!OperandsComplete() &&
"Trying to add an operand to a machine instr that is already done!");
operands.push_back(MachineOperand(intValue, MachineOperand::MO_Immediate));
operands.push_back(MachineOperand(Val));
}
void addMachineBasicBlockOperand(MachineBasicBlock *MBB) {

View File

@@ -42,22 +42,22 @@ public:
/// addImm - Add a new immediate operand.
///
const MachineInstrBuilder &addImm(int Val) const {
MI->addZeroExtImmOperand(Val);
const MachineInstrBuilder &addImm(int64_t Val) const {
MI->addImmOperand(Val);
return *this;
}
/// addZImm - Add a new zero extended immediate operand...
///
const MachineInstrBuilder &addZImm(unsigned Val) const {
MI->addZeroExtImmOperand(Val);
MI->addImmOperand(Val);
return *this;
}
/// addImm64 - Add a new 64-bit immediate operand...
///
const MachineInstrBuilder &addImm64(uint64_t Val) const {
MI->addZeroExtImm64Operand(Val);
MI->addImmOperand(Val);
return *this;
}