diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2015-03-11 00:51:37 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2015-03-11 00:51:37 +0000 |
commit | f1a13f5ad5b54634989ae7d067f5364b56a5a8d4 (patch) | |
tree | a248456cf9ef7fe222dba54bc6f418b8e61fcf86 /llvm/lib/CodeGen | |
parent | 900086de8817c49724fa7b71edcbd7155ca955fa (diff) | |
download | bcm5719-llvm-f1a13f5ad5b54634989ae7d067f5364b56a5a8d4.tar.gz bcm5719-llvm-f1a13f5ad5b54634989ae7d067f5364b56a5a8d4.zip |
Print section start labels when first switching to the section.
This is less brittle and avoids polluting the start of the file with every
debug section.
llvm-svn: 231898
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 47 | ||||
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h | 3 |
2 files changed, 5 insertions, 45 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index 85f807808b3..8d14781871b 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -241,14 +241,6 @@ DwarfDebug::DwarfDebug(AsmPrinter *A, Module *M) // Define out of line so we don't have to include DwarfUnit.h in DwarfDebug.h. DwarfDebug::~DwarfDebug() { } -// Switch to the specified MCSection and emit an assembler -// temporary label to it if SymbolStem is specified. -static void emitSectionSym(AsmPrinter *Asm, const MCSection *Section) { - Asm->OutStreamer.SwitchSection(Section); - MCSymbol *TmpSym = Section->getBeginSymbol(); - Asm->OutStreamer.EmitLabel(TmpSym); -} - static bool isObjCClass(StringRef Name) { return Name.startswith("+") || Name.startswith("-"); } @@ -449,9 +441,6 @@ void DwarfDebug::beginModule() { return; TypeIdentifierMap = generateDITypeIdentifierMap(CU_Nodes); - // Emit initial sections so we can reference labels later. - emitSectionLabels(); - SingleCU = CU_Nodes->getNumOperands() == 1; for (MDNode *N : CU_Nodes->operands()) { @@ -619,14 +608,13 @@ void DwarfDebug::finalizeModuleInfo() { // Emit all Dwarf sections that should come after the content. void DwarfDebug::endModule() { - const TargetLoweringObjectFile &TLOF = Asm->getObjFileLowering(); assert(CurFn == nullptr); assert(CurMI == nullptr); // If we aren't actually generating debug info (check beginModule - // conditionalized on !DisableDebugInfoPrinting and the presence of the // llvm.dbg.cu metadata node) - if (!TLOF.getDwarfInfoSection()->getBeginSymbol()->isInSection()) + if (!MMI->hasDebugInfo()) return; // Finalize the debug info for the module. @@ -640,12 +628,12 @@ void DwarfDebug::endModule() { // Emit info into a debug loc section. emitDebugLoc(); - // Emit all the DIEs into a debug info section. - emitDebugInfo(); - // Corresponding abbreviations into a abbrev section. emitAbbreviations(); + // Emit all the DIEs into a debug info section. + emitDebugInfo(); + // Emit info into a debug aranges section. if (GenerateARangeSection) emitDebugARanges(); @@ -1299,31 +1287,6 @@ void DwarfDebug::recordSourceLine(unsigned Line, unsigned Col, const MDNode *S, // Emit Methods //===----------------------------------------------------------------------===// -// Emit initial Dwarf sections with a label at the start of each one. -void DwarfDebug::emitSectionLabels() { - const TargetLoweringObjectFile &TLOF = Asm->getObjFileLowering(); - - // Dwarf sections base addresses. - emitSectionSym(Asm, TLOF.getDwarfInfoSection()); - if (useSplitDwarf()) { - emitSectionSym(Asm, TLOF.getDwarfInfoDWOSection()); - emitSectionSym(Asm, TLOF.getDwarfTypesDWOSection()); - } - emitSectionSym(Asm, TLOF.getDwarfAbbrevSection()); - if (useSplitDwarf()) - emitSectionSym(Asm, TLOF.getDwarfAbbrevDWOSection()); - - emitSectionSym(Asm, TLOF.getDwarfLineSection()); - emitSectionSym(Asm, TLOF.getDwarfStrSection()); - if (useSplitDwarf()) { - emitSectionSym(Asm, TLOF.getDwarfStrDWOSection()); - emitSectionSym(Asm, TLOF.getDwarfAddrSection()); - emitSectionSym(Asm, TLOF.getDwarfLocDWOSection()); - } else - emitSectionSym(Asm, TLOF.getDwarfLocSection()); - emitSectionSym(Asm, TLOF.getDwarfRangesSection()); -} - // Emit the debug info section. void DwarfDebug::emitDebugInfo() { DwarfFile &Holder = useSplitDwarf() ? SkeletonHolder : InfoHolder; @@ -1364,7 +1327,7 @@ void DwarfDebug::emitEndOfLineMatrix(unsigned SectionEnd) { void DwarfDebug::emitAccel(DwarfAccelTable &Accel, const MCSection *Section, StringRef TableName) { Accel.FinalizeTable(Asm, TableName); - emitSectionSym(Asm, Section); + Asm->OutStreamer.SwitchSection(Section); // Emit the full data. Accel.emit(Asm, Section->getBeginSymbol(), this); diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h index df967d58151..6e462bf06d0 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h @@ -339,9 +339,6 @@ class DwarfDebug : public AsmPrinterHandler { /// \brief Construct a DIE for this abstract scope. void constructAbstractSubprogramScopeDIE(LexicalScope *Scope); - /// \brief Emit initial Dwarf sections with a label at the start of each one. - void emitSectionLabels(); - /// \brief Compute the size and offset of a DIE given an incoming Offset. unsigned computeSizeAndOffset(DIE *Die, unsigned Offset); |