Add MO_Metadata as an operand kind. Not used yet.

llvm-svn: 93220
This commit is contained in:
Dale Johannesen 2010-01-12 02:01:53 +00:00
parent 5951609ac2
commit 585f82b6f6
1 changed files with 18 additions and 1 deletions

View File

@ -26,6 +26,7 @@ class GlobalValue;
class MachineInstr; class MachineInstr;
class TargetMachine; class TargetMachine;
class MachineRegisterInfo; class MachineRegisterInfo;
class MDNode;
class raw_ostream; class raw_ostream;
/// MachineOperand class - Representation of each machine instruction operand. /// MachineOperand class - Representation of each machine instruction operand.
@ -42,7 +43,8 @@ public:
MO_JumpTableIndex, ///< Address of indexed Jump Table for switch MO_JumpTableIndex, ///< Address of indexed Jump Table for switch
MO_ExternalSymbol, ///< Name of external global symbol MO_ExternalSymbol, ///< Name of external global symbol
MO_GlobalAddress, ///< Address of a global value MO_GlobalAddress, ///< Address of a global value
MO_BlockAddress ///< Address of a basic block MO_BlockAddress, ///< Address of a basic block
MO_Metadata ///< Metadata reference (for debug info)
}; };
private: private:
@ -94,6 +96,7 @@ private:
MachineBasicBlock *MBB; // For MO_MachineBasicBlock. MachineBasicBlock *MBB; // For MO_MachineBasicBlock.
const ConstantFP *CFP; // For MO_FPImmediate. const ConstantFP *CFP; // For MO_FPImmediate.
int64_t ImmVal; // For MO_Immediate. int64_t ImmVal; // For MO_Immediate.
MDNode *MD; // For MO_Metadata.
struct { // For MO_Register. struct { // For MO_Register.
unsigned RegNo; unsigned RegNo;
@ -158,6 +161,8 @@ public:
bool isSymbol() const { return OpKind == MO_ExternalSymbol; } bool isSymbol() const { return OpKind == MO_ExternalSymbol; }
/// isBlockAddress - Tests if this is a MO_BlockAddress operand. /// isBlockAddress - Tests if this is a MO_BlockAddress operand.
bool isBlockAddress() const { return OpKind == MO_BlockAddress; } bool isBlockAddress() const { return OpKind == MO_BlockAddress; }
/// isMetadata - Tests if this is a MO_Metadata operand.
bool isMetadata() const { return OpKind == MO_Metadata; }
//===--------------------------------------------------------------------===// //===--------------------------------------------------------------------===//
// Accessors for Register Operands // Accessors for Register Operands
@ -311,6 +316,11 @@ public:
assert(isSymbol() && "Wrong MachineOperand accessor"); assert(isSymbol() && "Wrong MachineOperand accessor");
return Contents.OffsetedInfo.Val.SymbolName; return Contents.OffsetedInfo.Val.SymbolName;
} }
MDNode *getMetadata() const {
assert(isMetadata() && "Wrong MachineOperand accessor");
return Contents.MD;
}
//===--------------------------------------------------------------------===// //===--------------------------------------------------------------------===//
// Mutators for various operand types. // Mutators for various operand types.
@ -443,6 +453,13 @@ public:
Op.setTargetFlags(TargetFlags); Op.setTargetFlags(TargetFlags);
return Op; return Op;
} }
static MachineOperand CreateMetadata(MDNode *Meta,
unsigned char TargetFlags = 0) {
MachineOperand Op(MachineOperand::MO_Metadata);
Op.Contents.MD = Meta;
Op.setTargetFlags(TargetFlags);
return Op;
}
friend class MachineInstr; friend class MachineInstr;
friend class MachineRegisterInfo; friend class MachineRegisterInfo;