mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-01 15:17:25 +00:00
Use named MDNode, llvm.dbg.sp, to collect subprogram info. This will be used to emit local variable's debug info of deleted functions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106989 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -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,17 +1240,19 @@ 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)
|
for (unsigned i = 0, e = NMD->getNumOperands(); i != e; ++i) {
|
||||||
return;
|
DIGlobalVariable DIG(cast<MDNode>(NMD->getOperand(i)));
|
||||||
|
if (addGlobalVariable(DIG)) {
|
||||||
for (unsigned i = 0, e = NMD->getNumOperands(); i != e; ++i) {
|
addCompileUnit(DIG.getCompileUnit());
|
||||||
DIGlobalVariable DIG(cast<MDNode>(NMD->getOperand(i)));
|
processType(DIG.getType());
|
||||||
if (addGlobalVariable(DIG)) {
|
}
|
||||||
addCompileUnit(DIG.getCompileUnit());
|
|
||||||
processType(DIG.getType());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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.
|
||||||
|
|||||||
Reference in New Issue
Block a user