diff options
author | Dan Gohman <gohman@apple.com> | 2009-10-30 00:20:08 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2009-10-30 00:20:08 +0000 |
commit | 64348df5c9a4757e82b2a6b081b3537dfe37313b (patch) | |
tree | 8de7925c31cb3dd14f7d3ba24cff424054f3e6b6 /include/llvm/CodeGen/MachineOperand.h | |
parent | 922d8d78940ad25966f761737140770973c4e1ed (diff) | |
download | external_llvm-64348df5c9a4757e82b2a6b081b3537dfe37313b.zip external_llvm-64348df5c9a4757e82b2a6b081b3537dfe37313b.tar.gz external_llvm-64348df5c9a4757e82b2a6b081b3537dfe37313b.tar.bz2 |
Add a BlockAddress MachineOperand kind.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85549 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/CodeGen/MachineOperand.h')
-rw-r--r-- | include/llvm/CodeGen/MachineOperand.h | 37 |
1 files changed, 27 insertions, 10 deletions
diff --git a/include/llvm/CodeGen/MachineOperand.h b/include/llvm/CodeGen/MachineOperand.h index 22435e9..eaa87db 100644 --- a/include/llvm/CodeGen/MachineOperand.h +++ b/include/llvm/CodeGen/MachineOperand.h @@ -20,6 +20,7 @@ namespace llvm { class ConstantFP; +class BlockAddress; class MachineBasicBlock; class GlobalValue; class MDNode; @@ -42,6 +43,7 @@ public: MO_JumpTableIndex, ///< Address of indexed Jump Table for switch MO_ExternalSymbol, ///< Name of external global symbol MO_GlobalAddress, ///< Address of a global value + MO_BlockAddress, ///< Address of a basic block MO_Metadata ///< Metadata info }; @@ -108,6 +110,7 @@ private: int Index; // For MO_*Index - The index itself. const char *SymbolName; // For MO_ExternalSymbol. GlobalValue *GV; // For MO_GlobalAddress. + BlockAddress *BA; // For MO_BlockAddress. MDNode *Node; // For MO_Metadata. } Val; int64_t Offset; // An offset from the object. @@ -156,6 +159,8 @@ public: bool isGlobal() const { return OpKind == MO_GlobalAddress; } /// isSymbol - Tests if this is a MO_ExternalSymbol operand. bool isSymbol() const { return OpKind == MO_ExternalSymbol; } + /// isBlockAddress - Tests if this is a MO_BlockAddress operand. + bool isBlockAddress() const { return OpKind == MO_BlockAddress; } /// isMetadata - Tests if this is a MO_Metadata operand. bool isMetadata() const { return OpKind == MO_Metadata; } @@ -293,6 +298,11 @@ public: assert(isGlobal() && "Wrong MachineOperand accessor"); return Contents.OffsetedInfo.Val.GV; } + + BlockAddress *getBlockAddress() const { + assert(isBlockAddress() && "Wrong MachineOperand accessor"); + return Contents.OffsetedInfo.Val.BA; + } MDNode *getMDNode() const { return Contents.OffsetedInfo.Val.Node; @@ -301,7 +311,7 @@ public: /// getOffset - Return the offset from the symbol in this operand. This always /// returns 0 for ExternalSymbol operands. int64_t getOffset() const { - assert((isGlobal() || isSymbol() || isCPI()) && + assert((isGlobal() || isSymbol() || isCPI() || isBlockAddress()) && "Wrong MachineOperand accessor"); return Contents.OffsetedInfo.Offset; } @@ -321,7 +331,8 @@ public: } void setOffset(int64_t Offset) { - assert((isGlobal() || isSymbol() || isCPI() || isMetadata()) && + assert((isGlobal() || isSymbol() || isCPI() || isBlockAddress() || + isMetadata()) && "Wrong MachineOperand accessor"); Contents.OffsetedInfo.Offset = Offset; } @@ -426,14 +437,6 @@ public: Op.setTargetFlags(TargetFlags); return Op; } - static MachineOperand CreateMDNode(MDNode *N, int64_t Offset, - unsigned char TargetFlags = 0) { - MachineOperand Op(MachineOperand::MO_Metadata); - Op.Contents.OffsetedInfo.Val.Node = N; - Op.setOffset(Offset); - Op.setTargetFlags(TargetFlags); - return Op; - } static MachineOperand CreateES(const char *SymName, unsigned char TargetFlags = 0) { MachineOperand Op(MachineOperand::MO_ExternalSymbol); @@ -442,6 +445,20 @@ public: Op.setTargetFlags(TargetFlags); return Op; } + static MachineOperand CreateBA(BlockAddress *BA) { + MachineOperand Op(MachineOperand::MO_BlockAddress); + Op.Contents.OffsetedInfo.Val.BA = BA; + Op.setOffset(0); // Offset is always 0. + return Op; + } + static MachineOperand CreateMDNode(MDNode *N, int64_t Offset, + unsigned char TargetFlags = 0) { + MachineOperand Op(MachineOperand::MO_Metadata); + Op.Contents.OffsetedInfo.Val.Node = N; + Op.setOffset(Offset); + Op.setTargetFlags(TargetFlags); + return Op; + } friend class MachineInstr; friend class MachineRegisterInfo; |