summaryrefslogtreecommitdiff
path: root/include/llvm/CodeGen
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2006-11-10 08:32:14 +0000
committerEvan Cheng <evan.cheng@apple.com>2006-11-10 08:32:14 +0000
commite7680cef84c42bc2ee68904bc2bd0b30a312da08 (patch)
tree5b1d8f516badf40c6e9d912bd929e4fe17577331 /include/llvm/CodeGen
parenta7ff64d6080ed2b4bd08b6ee75920e8ad5302143 (diff)
downloadllvm-e7680cef84c42bc2ee68904bc2bd0b30a312da08.tar.gz
llvm-e7680cef84c42bc2ee68904bc2bd0b30a312da08.tar.bz2
llvm-e7680cef84c42bc2ee68904bc2bd0b30a312da08.tar.xz
Add implicit def / use operands to MachineInstr.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31632 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/CodeGen')
-rw-r--r--include/llvm/CodeGen/MachineInstr.h21
-rw-r--r--include/llvm/CodeGen/MachineInstrBuilder.h5
2 files changed, 20 insertions, 6 deletions
diff --git a/include/llvm/CodeGen/MachineInstr.h b/include/llvm/CodeGen/MachineInstr.h
index c20b95cad5..94a51c09f5 100644
--- a/include/llvm/CodeGen/MachineInstr.h
+++ b/include/llvm/CodeGen/MachineInstr.h
@@ -60,6 +60,7 @@ private:
MachineOperandType opType:8; // Discriminate the union.
bool IsDef : 1; // True if this is a def, false if this is a use.
+ bool IsImp : 1; // True if this is an implicit def or use.
/// offset - Offset to address of global or external, only valid for
/// MO_GlobalAddress, MO_ExternalSym and MO_ConstantPoolIndex
@@ -78,6 +79,7 @@ public:
Op.opType = MachineOperand::MO_Immediate;
Op.contents.immedVal = Val;
Op.IsDef = false;
+ Op.IsImp = false;
Op.offset = 0;
return Op;
}
@@ -85,6 +87,7 @@ public:
const MachineOperand &operator=(const MachineOperand &MO) {
contents = MO.contents;
IsDef = MO.IsDef;
+ IsImp = MO.IsImp;
opType = MO.opType;
offset = MO.offset;
return *this;
@@ -173,6 +176,15 @@ public:
IsDef = true;
}
+ bool isImplicit() const {
+ assert(isRegister() && "Wrong MachineOperand accessor");
+ return IsImp;
+ }
+ bool setImplicit() {
+ assert(isRegister() && "Wrong MachineOperand accessor");
+ IsImp = true;
+ }
+
/// getReg - Returns the register number.
///
unsigned getReg() const {
@@ -330,10 +342,11 @@ public:
/// addRegOperand - Add a register operand.
///
- void addRegOperand(unsigned Reg, bool IsDef) {
- MachineOperand &Op = AddNewOperand();
+ void addRegOperand(unsigned Reg, bool IsDef, bool IsImp = false) {
+ MachineOperand &Op = AddNewOperand(IsImp);
Op.opType = MachineOperand::MO_Register;
Op.IsDef = IsDef;
+ Op.IsImp = IsImp;
Op.contents.RegNo = Reg;
Op.offset = 0;
}
@@ -415,8 +428,8 @@ public:
Operands.erase(Operands.begin()+i);
}
private:
- MachineOperand &AddNewOperand() {
- assert(!OperandsComplete() &&
+ MachineOperand &AddNewOperand(bool IsImp = false) {
+ assert((IsImp || !OperandsComplete()) &&
"Trying to add an operand to a machine instr that is already done!");
Operands.push_back(MachineOperand());
return Operands.back();
diff --git a/include/llvm/CodeGen/MachineInstrBuilder.h b/include/llvm/CodeGen/MachineInstrBuilder.h
index 3a1335a159..4da557cbb3 100644
--- a/include/llvm/CodeGen/MachineInstrBuilder.h
+++ b/include/llvm/CodeGen/MachineInstrBuilder.h
@@ -33,8 +33,9 @@ public:
/// addReg - Add a new virtual register operand...
///
- const MachineInstrBuilder &addReg(int RegNo, bool isDef = false) const {
- MI->addRegOperand(RegNo, isDef);
+ const MachineInstrBuilder &addReg(int RegNo, bool isDef = false,
+ bool isImp = false) const {
+ MI->addRegOperand(RegNo, isDef, isImp);
return *this;
}