aboutsummaryrefslogtreecommitdiffstats
path: root/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/CodeGen/AsmPrinter/DwarfDebug.cpp')
-rw-r--r--lib/CodeGen/AsmPrinter/DwarfDebug.cpp49
1 files changed, 11 insertions, 38 deletions
diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index e764e36f05..2d42af8f83 100644
--- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -190,7 +190,6 @@ DwarfDebug::DwarfDebug(AsmPrinter *A, Module *M)
IsDarwinGDBCompat = false;
} else
IsDarwinGDBCompat = DarwinGDBCompat == Enable ? true : false;
- UseRefAddr = false;
if (DwarfAccelTables == Default) {
if (IsDarwin)
@@ -370,8 +369,6 @@ DIE *DwarfDebug::updateSubprogramScopeDIE(CompileUnit *SPCU,
SPCU->addDIEEntry(SPDie, dwarf::DW_AT_abstract_origin,
InSameCU ? dwarf::DW_FORM_ref4 : dwarf::DW_FORM_ref_addr,
AbsSPDIE);
- if (!InSameCU)
- UseRefAddr = true;
SPCU->addDie(SPDie);
} else {
DISubprogram SPDecl = SP.getFunctionDeclaration();
@@ -472,17 +469,6 @@ DIE *DwarfDebug::constructLexicalScopeDIE(CompileUnit *TheCU,
return ScopeDIE;
}
-DIE *DwarfDebug::findSPDieInAllCUs(const MDNode *N) {
- for (DenseMap<const MDNode *, CompileUnit *>::iterator CUI = CUMap.begin(),
- CUE = CUMap.end(); CUI != CUE; ++CUI) {
- CompileUnit *TheCU = CUI->second;
- DIE *SPDie = TheCU->getDIE(N);
- if (SPDie)
- return SPDie;
- }
- return 0;
-}
-
// This scope represents inlined body of a function. Construct DIE to
// represent this concrete inlined copy of the function.
DIE *DwarfDebug::constructInlinedScopeDIE(CompileUnit *TheCU,
@@ -495,7 +481,7 @@ DIE *DwarfDebug::constructInlinedScopeDIE(CompileUnit *TheCU,
return NULL;
DIScope DS(Scope->getScopeNode());
DISubprogram InlinedSP = getDISubprogram(DS);
- DIE *OriginDIE = findSPDieInAllCUs(InlinedSP);
+ DIE *OriginDIE = TheCU->getDIE(InlinedSP);
if (!OriginDIE) {
DEBUG(dbgs() << "Unable to find original DIE for an inlined subprogram.");
return NULL;
@@ -514,12 +500,8 @@ DIE *DwarfDebug::constructInlinedScopeDIE(CompileUnit *TheCU,
"Invalid end label for an inlined scope!");
DIE *ScopeDIE = new DIE(dwarf::DW_TAG_inlined_subroutine);
- bool InSameCU = OriginDIE->getCompileUnit() == TheCU->getCUDie();
TheCU->addDIEEntry(ScopeDIE, dwarf::DW_AT_abstract_origin,
- InSameCU ? dwarf::DW_FORM_ref4 : dwarf::DW_FORM_ref_addr,
- OriginDIE);
- if (!InSameCU)
- UseRefAddr = true;
+ dwarf::DW_FORM_ref4, OriginDIE);
if (Ranges.size() > 1) {
// .debug_range section has not been laid out yet. Emit offset in
@@ -576,12 +558,9 @@ DIE *DwarfDebug::constructScopeDIE(CompileUnit *TheCU, LexicalScope *Scope) {
DIScope DS(Scope->getScopeNode());
// Early return to avoid creating dangling variable|scope DIEs.
- DIE *AbstractSPDie = 0;
- if (!Scope->getInlinedAt() && DS.isSubprogram() && Scope->isAbstractScope()) {
- AbstractSPDie = findSPDieInAllCUs(DS);
- if (!AbstractSPDie)
- return NULL;
- }
+ if (!Scope->getInlinedAt() && DS.isSubprogram() && Scope->isAbstractScope() &&
+ !TheCU->getDIE(DS))
+ return NULL;
SmallVector<DIE *, 8> Children;
DIE *ObjectPointer = NULL;
@@ -614,7 +593,7 @@ DIE *DwarfDebug::constructScopeDIE(CompileUnit *TheCU, LexicalScope *Scope) {
else if (DS.isSubprogram()) {
ProcessedSPNodes.insert(DS);
if (Scope->isAbstractScope()) {
- ScopeDIE = AbstractSPDie;
+ ScopeDIE = TheCU->getDIE(DS);
// Note down abstract DIE.
if (ScopeDIE)
AbstractSPDies.insert(std::make_pair(DS, ScopeDIE));
@@ -1704,9 +1683,7 @@ void DwarfDebug::endFunction(const MachineFunction *MF) {
}
}
if (ProcessedSPNodes.count(AScope->getScopeNode()) == 0)
- // Use the compile unit for the abstract scope to create scope DIEs and
- // variable DIEs.
- constructScopeDIE(SPMap.lookup(AScope->getScopeNode()), AScope);
+ constructScopeDIE(TheCU, AScope);
}
DIE *CurFnDIE = constructScopeDIE(TheCU, FnScope);
@@ -1996,8 +1973,7 @@ void DwarfUnits::emitUnits(DwarfDebug *DD,
Asm->OutStreamer.AddComment("Length of Compilation Unit Info");
Asm->EmitInt32(ContentSize);
Asm->OutStreamer.AddComment("DWARF version number");
- Asm->EmitInt16((DD->getUseRefAddr() && dwarf::DWARF_VERSION < 3) ?
- 3 : dwarf::DWARF_VERSION);
+ Asm->EmitInt16(dwarf::DWARF_VERSION);
Asm->OutStreamer.AddComment("Offset Into Abbrev. Section");
Asm->EmitSectionOffset(Asm->GetTempSymbol(ASection->getLabelBeginName()),
ASectionSym);
@@ -2238,8 +2214,7 @@ void DwarfDebug::emitDebugPubnames() {
Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("pubnames_begin", ID));
Asm->OutStreamer.AddComment("DWARF Version");
- Asm->EmitInt16((UseRefAddr && dwarf::DWARF_VERSION < 3) ?
- 3 : dwarf::DWARF_VERSION);
+ Asm->EmitInt16(dwarf::DWARF_VERSION);
Asm->OutStreamer.AddComment("Offset of Compilation Unit Info");
Asm->EmitSectionOffset(Asm->GetTempSymbol(ISec->getLabelBeginName(), ID),
@@ -2286,8 +2261,7 @@ void DwarfDebug::emitDebugPubTypes() {
TheCU->getUniqueID()));
if (Asm->isVerbose()) Asm->OutStreamer.AddComment("DWARF Version");
- Asm->EmitInt16((UseRefAddr && dwarf::DWARF_VERSION < 3) ?
- 3 : dwarf::DWARF_VERSION);
+ Asm->EmitInt16(dwarf::DWARF_VERSION);
Asm->OutStreamer.AddComment("Offset of Compilation Unit Info");
const MCSection *ISec = Asm->getObjFileLowering().getDwarfInfoSection();
@@ -2570,8 +2544,7 @@ void DwarfDebug::emitDebugInlineInfo() {
Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("debug_inlined_begin", 1));
Asm->OutStreamer.AddComment("Dwarf Version");
- Asm->EmitInt16((UseRefAddr && dwarf::DWARF_VERSION < 3) ?
- 3 : dwarf::DWARF_VERSION);
+ Asm->EmitInt16(dwarf::DWARF_VERSION);
Asm->OutStreamer.AddComment("Address Size (in bytes)");
Asm->EmitInt8(Asm->getDataLayout().getPointerSize());