summaryrefslogtreecommitdiff
path: root/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
diff options
context:
space:
mode:
authorEric Christopher <echristo@gmail.com>2012-12-15 00:04:07 +0000
committerEric Christopher <echristo@gmail.com>2012-12-15 00:04:07 +0000
commitb1e66d0c4fed6f162424fd5257cedf0d2e705152 (patch)
tree681ceaedb01982d943070f156eae61ba4d65143c /lib/CodeGen/AsmPrinter/DwarfDebug.cpp
parentcf6b8ad784c7e5e64beb9e26c43176eb38b1b68b (diff)
downloadllvm-b1e66d0c4fed6f162424fd5257cedf0d2e705152.tar.gz
llvm-b1e66d0c4fed6f162424fd5257cedf0d2e705152.tar.bz2
llvm-b1e66d0c4fed6f162424fd5257cedf0d2e705152.tar.xz
To simplify some code move the unit emission into the holders.
Make emitDIE public accordingly. No functional change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170258 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/AsmPrinter/DwarfDebug.cpp')
-rw-r--r--lib/CodeGen/AsmPrinter/DwarfDebug.cpp43
1 files changed, 26 insertions, 17 deletions
diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index 6c99d9591e..73502f2153 100644
--- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -1814,16 +1814,22 @@ void DwarfDebug::emitDIE(DIE *Die) {
}
}
-void DwarfDebug::emitCompileUnits(const MCSection *Section) {
- Asm->OutStreamer.SwitchSection(Section);
- for (DenseMap<const MDNode *, CompileUnit *>::iterator I = CUMap.begin(),
- E = CUMap.end(); I != E; ++I) {
- CompileUnit *TheCU = I->second;
+// Emit the various dwarf units to the unit section USection with
+// the abbreviations going into ASection.
+void DwarfUnits::emitUnits(DwarfDebug *DD,
+ const MCSection *USection,
+ const MCSection *ASection,
+ const MCSymbol *ASectionSym) {
+ Asm->OutStreamer.SwitchSection(USection);
+ for (SmallVector<CompileUnit *, 1>::iterator I = CUs.begin(),
+ E = CUs.end(); I != E; ++I) {
+ CompileUnit *TheCU = *I;
DIE *Die = TheCU->getCUDie();
// Emit the compile units header.
- Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol(Section->getLabelBeginName(),
- TheCU->getUniqueID()));
+ Asm->OutStreamer
+ .EmitLabel(Asm->GetTempSymbol(USection->getLabelBeginName(),
+ TheCU->getUniqueID()));
// Emit size of content not including length itself
unsigned ContentSize = Die->getSize() +
@@ -1836,24 +1842,24 @@ void DwarfDebug::emitCompileUnits(const MCSection *Section) {
Asm->OutStreamer.AddComment("DWARF version number");
Asm->EmitInt16(dwarf::DWARF_VERSION);
Asm->OutStreamer.AddComment("Offset Into Abbrev. Section");
- const MCSection *ASec = Asm->getObjFileLowering().getDwarfAbbrevSection();
- Asm->EmitSectionOffset(Asm->GetTempSymbol(ASec->getLabelBeginName()),
- DwarfAbbrevSectionSym);
+ Asm->EmitSectionOffset(Asm->GetTempSymbol(ASection->getLabelBeginName()),
+ ASectionSym);
Asm->OutStreamer.AddComment("Address Size (in bytes)");
Asm->EmitInt8(Asm->getDataLayout().getPointerSize());
- emitDIE(Die);
- Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol(Section->getLabelEndName(),
+ DD->emitDIE(Die);
+ Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol(USection->getLabelEndName(),
TheCU->getUniqueID()));
}
}
// Emit the debug info section.
void DwarfDebug::emitDebugInfo() {
- if (!useSplitDwarf())
- emitCompileUnits(Asm->getObjFileLowering().getDwarfInfoSection());
- else
- emitSkeletonCU(Asm->getObjFileLowering().getDwarfInfoSection());
+ DwarfUnits &Holder = useSplitDwarf() ? SkeletonHolder : InfoHolder;
+
+ Holder.emitUnits(this, Asm->getObjFileLowering().getDwarfInfoSection(),
+ Asm->getObjFileLowering().getDwarfAbbrevSection(),
+ DwarfAbbrevSectionSym);
}
// Emit the abbreviation section.
@@ -2392,5 +2398,8 @@ void DwarfDebug::emitSkeletonCU(const MCSection *Section) {
// compile units that would normally be in debug_info.
void DwarfDebug::emitDebugInfoDWO() {
assert(useSplitDwarf() && "No split dwarf debug info?");
- emitCompileUnits(Asm->getObjFileLowering().getDwarfInfoDWOSection());
+ // FIXME for Abbrev DWO.
+ InfoHolder.emitUnits(this, Asm->getObjFileLowering().getDwarfInfoDWOSection(),
+ Asm->getObjFileLowering().getDwarfAbbrevSection(),
+ DwarfAbbrevSectionSym);
}