diff options
author | Chris Lattner <sabre@nondot.org> | 2010-03-13 08:14:18 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-03-13 08:14:18 +0000 |
commit | 72aaa3c79869870bd16402ed1f37b80a5e71c800 (patch) | |
tree | 47fa9be885530c3e13bcb0adc81c051651a0666b /include/llvm/CodeGen/MachineOperand.h | |
parent | 5e6cbe0eff1249daaa02807f8cb4b33d43fdf985 (diff) | |
download | external_llvm-72aaa3c79869870bd16402ed1f37b80a5e71c800.tar.gz external_llvm-72aaa3c79869870bd16402ed1f37b80a5e71c800.tar.bz2 external_llvm-72aaa3c79869870bd16402ed1f37b80a5e71c800.zip |
add support for MCSymbols as operands to MachineInstrs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98433 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/CodeGen/MachineOperand.h')
-rw-r--r-- | include/llvm/CodeGen/MachineOperand.h | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/include/llvm/CodeGen/MachineOperand.h b/include/llvm/CodeGen/MachineOperand.h index 0978057c20..e5229479f1 100644 --- a/include/llvm/CodeGen/MachineOperand.h +++ b/include/llvm/CodeGen/MachineOperand.h @@ -28,6 +28,7 @@ class MachineRegisterInfo; class MDNode; class TargetMachine; class raw_ostream; +class MCSymbol; /// MachineOperand class - Representation of each machine instruction operand. /// @@ -44,7 +45,8 @@ public: MO_ExternalSymbol, ///< Name of external global symbol MO_GlobalAddress, ///< Address of a global value MO_BlockAddress, ///< Address of a basic block - MO_Metadata ///< Metadata reference (for debug info) + MO_Metadata, ///< Metadata reference (for debug info) + MO_MCSymbol ///< MCSymbol reference (for debug/eh info) }; private: @@ -101,6 +103,7 @@ private: const ConstantFP *CFP; // For MO_FPImmediate. int64_t ImmVal; // For MO_Immediate. const MDNode *MD; // For MO_Metadata. + MCSymbol *Sym; // For MO_MCSymbol struct { // For MO_Register. unsigned RegNo; @@ -167,6 +170,7 @@ public: bool isBlockAddress() const { return OpKind == MO_BlockAddress; } /// isMetadata - Tests if this is a MO_Metadata operand. bool isMetadata() const { return OpKind == MO_Metadata; } + bool isMCSymbol() const { return OpKind == MO_MCSymbol; } //===--------------------------------------------------------------------===// // Accessors for Register Operands @@ -315,6 +319,11 @@ public: assert(isBlockAddress() && "Wrong MachineOperand accessor"); return Contents.OffsetedInfo.Val.BA; } + + MCSymbol *getMCSymbol() const { + assert(isMCSymbol() && "Wrong MachineOperand accessor"); + return Contents.Sym; + } /// getOffset - Return the offset from the symbol in this operand. This always /// returns 0 for ExternalSymbol operands. @@ -473,6 +482,12 @@ public: return Op; } + static MachineOperand CreateMCSymbol(MCSymbol *Sym) { + MachineOperand Op(MachineOperand::MO_MCSymbol); + Op.Contents.Sym = Sym; + return Op; + } + friend class MachineInstr; friend class MachineRegisterInfo; private: |