Now, named mdnode llvm.dbg.cu keeps track of all compile units in a module. Update DebugInfoFinder to collect compile units from llvm.dbg.cu.

llvm-svn: 139147
This commit is contained in:
Devang Patel 2011-09-06 17:40:08 +00:00
parent cd0d826001
commit 5ea5d7965b
1 changed files with 12 additions and 6 deletions

View File

@ -905,6 +905,10 @@ DIVariable llvm::cleanseInlinedVariable(MDNode *DV, LLVMContext &VMContext) {
/// processModule - Process entire module and collect debug info.
void DebugInfoFinder::processModule(Module &M) {
if (NamedMDNode *CU_Nodes = M.getNamedMetadata("llvm.dbg.cu"))
for (unsigned i = 0, e = CU_Nodes->getNumOperands(); i != e; ++i)
addCompileUnit(DICompileUnit(CU_Nodes->getOperand(i)));
for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
for (Function::iterator FI = (*I).begin(), FE = (*I).end(); FI != FE; ++FI)
for (BasicBlock::iterator BI = (*FI).begin(), BE = (*FI).end(); BI != BE;
@ -934,7 +938,8 @@ void DebugInfoFinder::processModule(Module &M) {
for (unsigned i = 0, e = NMD->getNumOperands(); i != e; ++i) {
DIGlobalVariable DIG(cast<MDNode>(NMD->getOperand(i)));
if (addGlobalVariable(DIG)) {
addCompileUnit(DIG.getCompileUnit());
if (DIG.getVersion() <= LLVMDebugVersion10)
addCompileUnit(DIG.getCompileUnit());
processType(DIG.getType());
}
}
@ -962,8 +967,8 @@ void DebugInfoFinder::processLocation(DILocation Loc) {
void DebugInfoFinder::processType(DIType DT) {
if (!addType(DT))
return;
addCompileUnit(DT.getCompileUnit());
if (DT.getVersion() <= LLVMDebugVersion10)
addCompileUnit(DT.getCompileUnit());
if (DT.isCompositeType()) {
DICompositeType DCT(DT);
processType(DCT.getTypeDerivedFrom());
@ -994,7 +999,8 @@ void DebugInfoFinder::processLexicalBlock(DILexicalBlock LB) {
void DebugInfoFinder::processSubprogram(DISubprogram SP) {
if (!addSubprogram(SP))
return;
addCompileUnit(SP.getCompileUnit());
if (SP.getVersion() <= LLVMDebugVersion10)
addCompileUnit(SP.getCompileUnit());
processType(SP.getType());
}
@ -1009,8 +1015,8 @@ void DebugInfoFinder::processDeclare(DbgDeclareInst *DDI) {
if (!NodesSeen.insert(DV))
return;
addCompileUnit(DIVariable(N).getCompileUnit());
if (DIVariable(N).getVersion() <= LLVMDebugVersion10)
addCompileUnit(DIVariable(N).getCompileUnit());
processType(DIVariable(N).getType());
}