aboutsummaryrefslogtreecommitdiffstats
path: root/lib/CodeGen
diff options
context:
space:
mode:
authorManman Ren <mren@apple.com>2013-05-29 17:16:59 +0000
committerManman Ren <mren@apple.com>2013-05-29 17:16:59 +0000
commit742671bf8e422aadcf3b7697a8844b9eb6f566f2 (patch)
treec21bc31b49d15c7490cbe78d126ac175c5adf87e /lib/CodeGen
parenta9a8a128f807d46ce46971abf65578996c50cf2e (diff)
downloadexternal_llvm-742671bf8e422aadcf3b7697a8844b9eb6f566f2.tar.gz
external_llvm-742671bf8e422aadcf3b7697a8844b9eb6f566f2.tar.bz2
external_llvm-742671bf8e422aadcf3b7697a8844b9eb6f566f2.zip
LTO+Debug Info: revert r182791.
Since the testing case uses ref_addr, which requires version 3+ to work, we will solve the dwarf version issue first. This patch also causes failures in one of the bots. I will update the patch accordingly in my next attempt. rdar://13926659 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182867 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r--lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp9
-rw-r--r--lib/CodeGen/AsmPrinter/DwarfDebug.cpp49
-rw-r--r--lib/CodeGen/AsmPrinter/DwarfDebug.h9
3 files changed, 13 insertions, 54 deletions
diff --git a/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp b/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
index adee01bc83..90ca034c97 100644
--- a/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
+++ b/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
@@ -1504,14 +1504,9 @@ DIE *CompileUnit::constructVariableDIE(DbgVariable *DV, bool isScopeAbstract) {
DIE *VariableDie = new DIE(Tag);
DbgVariable *AbsVar = DV->getAbstractVariable();
DIE *AbsDIE = AbsVar ? AbsVar->getDIE() : NULL;
- if (AbsDIE) {
- bool InSameCU = AbsDIE->getCompileUnit() == getCUDie();
+ if (AbsDIE)
addDIEEntry(VariableDie, dwarf::DW_AT_abstract_origin,
- InSameCU ? dwarf::DW_FORM_ref4 : dwarf::DW_FORM_ref_addr,
- AbsDIE);
- if (!InSameCU)
- DD->setUseRefAddr(true);
- }
+ dwarf::DW_FORM_ref4, AbsDIE);
else {
addString(VariableDie, dwarf::DW_AT_name, Name);
addSourceLine(VariableDie, DV->getVariable());
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());
diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.h b/lib/CodeGen/AsmPrinter/DwarfDebug.h
index 65e4fa99a0..6cc792b373 100644
--- a/lib/CodeGen/AsmPrinter/DwarfDebug.h
+++ b/lib/CodeGen/AsmPrinter/DwarfDebug.h
@@ -402,9 +402,6 @@ class DwarfDebug {
// Whether or not we're emitting info for older versions of gdb on darwin.
bool IsDarwinGDBCompat;
- // Whether or not we use ref_addr in the generated DWARF.
- unsigned UseRefAddr;
-
// DWARF5 Experimental Options
bool HasDwarfAccelTables;
bool HasSplitDwarf;
@@ -604,9 +601,6 @@ private:
/// \brief Return Label immediately following the instruction.
MCSymbol *getLabelAfterInsn(const MachineInstr *MI);
- /// \brief Search all compile units to find the SP DIE for the given MDNode.
- DIE *findSPDieInAllCUs(const MDNode *N);
-
public:
//===--------------------------------------------------------------------===//
// Main entry points.
@@ -646,9 +640,6 @@ public:
/// output to the limitations of darwin gdb.
bool useDarwinGDBCompat() { return IsDarwinGDBCompat; }
- bool getUseRefAddr() { return UseRefAddr; }
- void setUseRefAddr(bool RefAddr) { UseRefAddr = RefAddr; }
-
// Experimental DWARF5 features.
/// \brief Returns whether or not to emit tables that dwarf consumers can