[llvm-commits] [llvm] r74628 - in /llvm/trunk/include/llvm/CodeGen: MachineInstrBuilder.h MachineOperand.h
Devang Patel
dpatel at apple.com
Wed Jul 1 12:08:13 PDT 2009
Author: dpatel
Date: Wed Jul 1 14:08:07 2009
New Revision: 74628
URL: http://llvm.org/viewvc/llvm-project?rev=74628&view=rev
Log:
Add machine operand for MDNodes. This will be used to communicate debug info.
Modified:
llvm/trunk/include/llvm/CodeGen/MachineInstrBuilder.h
llvm/trunk/include/llvm/CodeGen/MachineOperand.h
Modified: llvm/trunk/include/llvm/CodeGen/MachineInstrBuilder.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineInstrBuilder.h?rev=74628&r1=74627&r2=74628&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/MachineInstrBuilder.h (original)
+++ llvm/trunk/include/llvm/CodeGen/MachineInstrBuilder.h Wed Jul 1 14:08:07 2009
@@ -107,6 +107,13 @@
return *this;
}
+ const MachineInstrBuilder &addMetadata(MDNode *N,
+ int64_t Offset = 0,
+ unsigned char TargetFlags = 0) const {
+ MI->addOperand(MachineOperand::CreateMDNode(N, Offset, TargetFlags));
+ return *this;
+ }
+
const MachineInstrBuilder &addExternalSymbol(const char *FnName,
int64_t Offset = 0,
unsigned char TargetFlags = 0) const {
Modified: llvm/trunk/include/llvm/CodeGen/MachineOperand.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineOperand.h?rev=74628&r1=74627&r2=74628&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/MachineOperand.h (original)
+++ llvm/trunk/include/llvm/CodeGen/MachineOperand.h Wed Jul 1 14:08:07 2009
@@ -23,6 +23,7 @@
class ConstantFP;
class MachineBasicBlock;
class GlobalValue;
+class MDNode;
class MachineInstr;
class TargetMachine;
class MachineRegisterInfo;
@@ -41,7 +42,8 @@
MO_ConstantPoolIndex, ///< Address of indexed Constant in Constant Pool
MO_JumpTableIndex, ///< Address of indexed Jump Table for switch
MO_ExternalSymbol, ///< Name of external global symbol
- MO_GlobalAddress ///< Address of a global value
+ MO_GlobalAddress, ///< Address of a global value
+ MO_Metadata ///< Metadata info
};
private:
@@ -107,6 +109,7 @@
int Index; // For MO_*Index - The index itself.
const char *SymbolName; // For MO_ExternalSymbol.
GlobalValue *GV; // For MO_GlobalAddress.
+ MDNode *Node; // For MO_Metadata.
} Val;
int64_t Offset; // An offset from the object.
} OffsetedInfo;
@@ -423,6 +426,14 @@
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, int64_t Offset = 0,
unsigned char TargetFlags = 0) {
MachineOperand Op(MachineOperand::MO_ExternalSymbol);
More information about the llvm-commits
mailing list