aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2006-09-05 20:20:04 +0000
committerEvan Cheng <evan.cheng@apple.com>2006-09-05 20:20:04 +0000
commitf89e2a941616681c93d4c52da05870f18660cada (patch)
tree3bcd3dc939c8f3e18f117d98f85b7f6b2c744e89 /include
parentd8f44e07b89e651b2f0e3b0d680a775f44e667da (diff)
downloadexternal_llvm-f89e2a941616681c93d4c52da05870f18660cada.zip
external_llvm-f89e2a941616681c93d4c52da05870f18660cada.tar.gz
external_llvm-f89e2a941616681c93d4c52da05870f18660cada.tar.bz2
IsDef can only be accessed / set if operand is a register.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30119 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/CodeGen/MachineInstr.h27
1 files changed, 16 insertions, 11 deletions
diff --git a/include/llvm/CodeGen/MachineInstr.h b/include/llvm/CodeGen/MachineInstr.h
index 09e9ad6..d3136df 100644
--- a/include/llvm/CodeGen/MachineInstr.h
+++ b/include/llvm/CodeGen/MachineInstr.h
@@ -143,10 +143,22 @@ public:
return contents.SymbolName;
}
- bool isUse() const { return !IsDef; }
- bool isDef() const { return IsDef; }
- void setIsUse() { IsDef = false; }
- void setIsDef() { IsDef = true; }
+ bool isUse() const {
+ assert(isRegister() && "Wrong MachineOperand accessor");
+ return !IsDef;
+ }
+ bool isDef() const {
+ assert(isRegister() && "Wrong MachineOperand accessor");
+ return IsDef;
+ }
+ void setIsUse() {
+ assert(isRegister() && "Wrong MachineOperand accessor");
+ IsDef = false;
+ }
+ void setIsDef() {
+ assert(isRegister() && "Wrong MachineOperand accessor");
+ IsDef = true;
+ }
/// getReg - Returns the register number.
///
@@ -295,7 +307,6 @@ public:
void addImmOperand(int64_t Val) {
MachineOperand &Op = AddNewOperand();
Op.opType = MachineOperand::MO_Immediate;
- Op.IsDef = false;
Op.contents.immedVal = Val;
Op.offset = 0;
}
@@ -303,7 +314,6 @@ public:
void addMachineBasicBlockOperand(MachineBasicBlock *MBB) {
MachineOperand &Op = AddNewOperand();
Op.opType = MachineOperand::MO_MachineBasicBlock;
- Op.IsDef = false;
Op.contents.MBB = MBB;
Op.offset = 0;
}
@@ -313,7 +323,6 @@ public:
void addFrameIndexOperand(unsigned Idx) {
MachineOperand &Op = AddNewOperand();
Op.opType = MachineOperand::MO_FrameIndex;
- Op.IsDef = false;
Op.contents.immedVal = Idx;
Op.offset = 0;
}
@@ -324,7 +333,6 @@ public:
void addConstantPoolIndexOperand(unsigned Idx, int Offset) {
MachineOperand &Op = AddNewOperand();
Op.opType = MachineOperand::MO_ConstantPoolIndex;
- Op.IsDef = false;
Op.contents.immedVal = Idx;
Op.offset = Offset;
}
@@ -335,7 +343,6 @@ public:
void addJumpTableIndexOperand(unsigned Idx) {
MachineOperand &Op = AddNewOperand();
Op.opType = MachineOperand::MO_JumpTableIndex;
- Op.IsDef = false;
Op.contents.immedVal = Idx;
Op.offset = 0;
}
@@ -343,7 +350,6 @@ public:
void addGlobalAddressOperand(GlobalValue *GV, int Offset) {
MachineOperand &Op = AddNewOperand();
Op.opType = MachineOperand::MO_GlobalAddress;
- Op.IsDef = false;
Op.contents.GV = GV;
Op.offset = Offset;
}
@@ -353,7 +359,6 @@ public:
void addExternalSymbolOperand(const char *SymName) {
MachineOperand &Op = AddNewOperand();
Op.opType = MachineOperand::MO_ExternalSymbol;
- Op.IsDef = false;
Op.contents.SymbolName = SymName;
Op.offset = 0;
}