forked from OSchip/llvm-project
Use named MDNode, llvm.dbg.sp, to collect subprogram info. This will be used to emit local variable's debug info of deleted functions.
llvm-svn: 106989
This commit is contained in:
parent
7ea5fc0794
commit
f7869a4b81
|
@ -971,7 +971,12 @@ DISubprogram DIFactory::CreateSubprogram(DIDescriptor Context,
|
||||||
ConstantInt::get(Type::getInt1Ty(VMContext), isOptimized),
|
ConstantInt::get(Type::getInt1Ty(VMContext), isOptimized),
|
||||||
Fn
|
Fn
|
||||||
};
|
};
|
||||||
return DISubprogram(MDNode::get(VMContext, &Elts[0], 17));
|
MDNode *Node = MDNode::get(VMContext, &Elts[0], 17);
|
||||||
|
|
||||||
|
// Create a named metadata so that we do not lose this mdnode.
|
||||||
|
NamedMDNode *NMD = M.getOrInsertNamedMetadata("llvm.dbg.sp");
|
||||||
|
NMD->addOperand(Node);
|
||||||
|
return DISubprogram(Node);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// CreateSubprogramDefinition - Create new subprogram descriptor for the
|
/// CreateSubprogramDefinition - Create new subprogram descriptor for the
|
||||||
|
@ -1000,7 +1005,12 @@ DISubprogram DIFactory::CreateSubprogramDefinition(DISubprogram &SPDeclaration)
|
||||||
DeclNode->getOperand(15), // isOptimized
|
DeclNode->getOperand(15), // isOptimized
|
||||||
SPDeclaration.getFunction()
|
SPDeclaration.getFunction()
|
||||||
};
|
};
|
||||||
return DISubprogram(MDNode::get(VMContext, &Elts[0], 16));
|
MDNode *Node =MDNode::get(VMContext, &Elts[0], 16);
|
||||||
|
|
||||||
|
// Create a named metadata so that we do not lose this mdnode.
|
||||||
|
NamedMDNode *NMD = M.getOrInsertNamedMetadata("llvm.dbg.sp");
|
||||||
|
NMD->addOperand(Node);
|
||||||
|
return DISubprogram(Node);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// CreateGlobalVariable - Create a new descriptor for the specified global.
|
/// CreateGlobalVariable - Create a new descriptor for the specified global.
|
||||||
|
@ -1230,10 +1240,7 @@ void DebugInfoFinder::processModule(Module &M) {
|
||||||
processLocation(DILocation(IA));
|
processLocation(DILocation(IA));
|
||||||
}
|
}
|
||||||
|
|
||||||
NamedMDNode *NMD = M.getNamedMetadata("llvm.dbg.gv");
|
if (NamedMDNode *NMD = M.getNamedMetadata("llvm.dbg.gv")) {
|
||||||
if (!NMD)
|
|
||||||
return;
|
|
||||||
|
|
||||||
for (unsigned i = 0, e = NMD->getNumOperands(); i != e; ++i) {
|
for (unsigned i = 0, e = NMD->getNumOperands(); i != e; ++i) {
|
||||||
DIGlobalVariable DIG(cast<MDNode>(NMD->getOperand(i)));
|
DIGlobalVariable DIG(cast<MDNode>(NMD->getOperand(i)));
|
||||||
if (addGlobalVariable(DIG)) {
|
if (addGlobalVariable(DIG)) {
|
||||||
|
@ -1243,6 +1250,11 @@ void DebugInfoFinder::processModule(Module &M) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (NamedMDNode *NMD = M.getNamedMetadata("llvm.dbg.sp"))
|
||||||
|
for (unsigned i = 0, e = NMD->getNumOperands(); i != e; ++i)
|
||||||
|
processSubprogram(DISubprogram(NMD->getOperand(i)));
|
||||||
|
}
|
||||||
|
|
||||||
/// processLocation - Process DILocation.
|
/// processLocation - Process DILocation.
|
||||||
void DebugInfoFinder::processLocation(DILocation Loc) {
|
void DebugInfoFinder::processLocation(DILocation Loc) {
|
||||||
if (!Loc.Verify()) return;
|
if (!Loc.Verify()) return;
|
||||||
|
|
Loading…
Reference in New Issue