mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-23 12:24:34 +00:00
add new apis for getting/setting !dbg metadata on
instructions. In addition to being a convenience, they are faster than the old apis, particularly when not going from an MDKindID like people should be doing. llvm-svn: 99982
This commit is contained in:
parent
58296f9543
commit
27c9cacb63
@ -156,6 +156,16 @@ public:
|
||||
void setMetadata(unsigned KindID, MDNode *Node);
|
||||
void setMetadata(const char *Kind, MDNode *Node);
|
||||
|
||||
/// setDbgMetadata - This is just an optimized helper function that is
|
||||
/// equivalent to setMetadata("dbg", Node);
|
||||
void setDbgMetadata(MDNode *Node);
|
||||
|
||||
/// getDbgMetadata - This is just an optimized helper function that is
|
||||
/// equivalent to calling getMetadata("dbg").
|
||||
MDNode *getDbgMetadata() const {
|
||||
return DbgInfo;
|
||||
}
|
||||
|
||||
private:
|
||||
/// hasMetadataHashEntry - Return true if we have an entry in the on-the-side
|
||||
/// metadata hash.
|
||||
|
@ -284,8 +284,7 @@ class TrackingVH : public ValueHandleBase {
|
||||
Value *VP = ValueHandleBase::getValPtr();
|
||||
|
||||
// Null is always ok.
|
||||
if (!VP)
|
||||
return;
|
||||
if (!VP) return;
|
||||
|
||||
// Check that this value is valid (i.e., it hasn't been deleted). We
|
||||
// explicitly delay this check until access to avoid requiring clients to be
|
||||
|
@ -2014,7 +2014,8 @@ void DwarfDebug::collectVariableInfo() {
|
||||
// FIXME : Lift this restriction.
|
||||
if (MInsn->getNumOperands() != 3)
|
||||
continue;
|
||||
DIVariable DV((MDNode*)(MInsn->getOperand(MInsn->getNumOperands() - 1).getMetadata()));
|
||||
DIVariable DV((MDNode*)(MInsn->getOperand(MInsn->getNumOperands()
|
||||
- 1).getMetadata()));
|
||||
if (DV.getTag() == dwarf::DW_TAG_arg_variable) {
|
||||
// FIXME Handle inlined subroutine arguments.
|
||||
DbgVariable *ArgVar = new DbgVariable(DV, MInsn, NULL);
|
||||
|
@ -340,10 +340,9 @@ bool FastISel::SelectCall(User *I) {
|
||||
StaticAllocaMap.find(AI);
|
||||
if (SI == StaticAllocaMap.end()) break; // VLAs.
|
||||
int FI = SI->second;
|
||||
if (MMI) {
|
||||
if (MDNode *Dbg = DI->getMetadata("dbg"))
|
||||
MMI->setVariableDbgInfo(DI->getVariable(), FI, Dbg);
|
||||
}
|
||||
if (MDNode *Dbg = DI->getDbgMetadata())
|
||||
MMI->setVariableDbgInfo(DI->getVariable(), FI, Dbg);
|
||||
|
||||
// Building the map above is target independent. Generating DBG_VALUE
|
||||
// inline is target dependent; do this now.
|
||||
(void)TargetSelectInstruction(cast<Instruction>(I));
|
||||
|
@ -3800,7 +3800,7 @@ SelectionDAGBuilder::visitIntrinsicCall(CallInst &I, unsigned Intrinsic) {
|
||||
int FI = SI->second;
|
||||
|
||||
if (MachineModuleInfo *MMI = DAG.getMachineModuleInfo())
|
||||
if (MDNode *Dbg = DI.getMetadata("dbg"))
|
||||
if (MDNode *Dbg = DI.getDbgMetadata())
|
||||
MMI->setVariableDbgInfo(Variable, FI, Dbg);
|
||||
return 0;
|
||||
}
|
||||
@ -3852,7 +3852,7 @@ SelectionDAGBuilder::visitIntrinsicCall(CallInst &I, unsigned Intrinsic) {
|
||||
return 0; // VLAs.
|
||||
int FI = SI->second;
|
||||
if (MachineModuleInfo *MMI = DAG.getMachineModuleInfo())
|
||||
if (MDNode *Dbg = DI.getMetadata("dbg"))
|
||||
if (MDNode *Dbg = DI.getDbgMetadata())
|
||||
MMI->setVariableDbgInfo(Variable, FI, Dbg);
|
||||
return 0;
|
||||
}
|
||||
|
@ -424,6 +424,10 @@ MDNode *Instruction::getMetadataImpl(const char *Kind) const {
|
||||
return getMetadataImpl(getContext().getMDKindID(Kind));
|
||||
}
|
||||
|
||||
void Instruction::setDbgMetadata(MDNode *Node) {
|
||||
DbgInfo = Node;
|
||||
}
|
||||
|
||||
/// setMetadata - Set the metadata of of the specified kind to the specified
|
||||
/// node. This updates/replaces metadata if already present, or removes it if
|
||||
/// Node is null.
|
||||
|
Loading…
x
Reference in New Issue
Block a user