aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-06-30 23:37:44 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-06-30 23:37:44 +0000
commite303503da3dd928b70ab371161e33b515e8dfc95 (patch)
treef7d1e5abc5509c5845d20f72e71501eaef1fa244
parentd870b2804b825d02d0097f145aef4808617025ee (diff)
downloadexternal_llvm-e303503da3dd928b70ab371161e33b515e8dfc95.zip
external_llvm-e303503da3dd928b70ab371161e33b515e8dfc95.tar.gz
external_llvm-e303503da3dd928b70ab371161e33b515e8dfc95.tar.bz2
Fill in some methods for the MCValue field of an MCOperand.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74572 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/MC/MCInst.h18
1 files changed, 16 insertions, 2 deletions
diff --git a/include/llvm/MC/MCInst.h b/include/llvm/MC/MCInst.h
index 3108985..8b638d4 100644
--- a/include/llvm/MC/MCInst.h
+++ b/include/llvm/MC/MCInst.h
@@ -31,7 +31,7 @@ class MCOperand {
kRegister, ///< Register operand.
kImmediate, ///< Immediate operand.
kMBBLabel, ///< Basic block label.
- kMCValue
+ kMCValue ///< Relocatable immediate operand.
};
unsigned char Kind;
@@ -49,9 +49,11 @@ public:
MCOperand() : Kind(kInvalid) {}
MCOperand(const MCOperand &RHS) { *this = RHS; }
+ bool isValid() const { return Kind != kInvalid; }
bool isReg() const { return Kind == kRegister; }
bool isImm() const { return Kind == kImmediate; }
bool isMBBLabel() const { return Kind == kMBBLabel; }
+ bool isMCValue() const { return Kind == kMCValue; }
/// getReg - Returns the register number.
unsigned getReg() const {
@@ -82,6 +84,15 @@ public:
assert(isMBBLabel() && "Wrong accessor");
return MBBLabel.BlockNo;
}
+
+ const MCValue &getMCValue() const {
+ assert(isMCValue() && "This is not an MCValue");
+ return MCValueVal;
+ }
+ void setMCValue(const MCValue &Val) {
+ assert(isMCValue() && "This is not an MCValue");
+ MCValueVal = Val;
+ }
void MakeReg(unsigned Reg) {
Kind = kRegister;
@@ -96,6 +107,10 @@ public:
MBBLabel.FunctionNo = Fn;
MBBLabel.BlockNo = MBB;
}
+ void MakeMCValue(const MCValue &Val) {
+ Kind = kMCValue;
+ MCValueVal = Val;
+ }
};
@@ -119,7 +134,6 @@ public:
void addOperand(const MCOperand &Op) {
Operands.push_back(Op);
}
-
};