diff options
author | Frederic Riss <friss@apple.com> | 2015-03-04 02:30:17 +0000 |
---|---|---|
committer | Frederic Riss <friss@apple.com> | 2015-03-04 02:30:17 +0000 |
commit | 9412d63f683346e010261662acf97e8c10cb8d03 (patch) | |
tree | 94b7d3890f4548e0a27abe485d50c4ec2aac61d2 /llvm/lib/CodeGen/AsmPrinter/DwarfFile.cpp | |
parent | cd04434cd50ea127f6247383cf50abc65d1f1ce0 (diff) | |
download | bcm5719-llvm-9412d63f683346e010261662acf97e8c10cb8d03.tar.gz bcm5719-llvm-9412d63f683346e010261662acf97e8c10cb8d03.zip |
Move emitDIE and emitAbbrevs to AsmPrinter. NFC.
(They are called emitDwarfDIE and emitDwarfAbbrevs in their new home)
llvm-dsymutil wants to reuse that code, but it doesn't have a DwarfUnit or
a DwarfDebug object to call those. It has access to an AsmPrinter though.
Having emitDIE in the AsmPrinter also removes the DwarfFile dependency
on DwarfDebug, and thus the patch drops that field.
Differential Revision: http://reviews.llvm.org/D8024
llvm-svn: 231210
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/DwarfFile.cpp')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfFile.cpp | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfFile.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfFile.cpp index 3988f0def31..7eceec3cf2b 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfFile.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfFile.cpp @@ -17,9 +17,8 @@ #include "llvm/Target/TargetLoweringObjectFile.h" namespace llvm { -DwarfFile::DwarfFile(AsmPrinter *AP, DwarfDebug &DD, StringRef Pref, - BumpPtrAllocator &DA) - : Asm(AP), DD(DD), StrPool(DA, *Asm, Pref) {} +DwarfFile::DwarfFile(AsmPrinter *AP, StringRef Pref, BumpPtrAllocator &DA) + : Asm(AP), StrPool(DA, *Asm, Pref) {} DwarfFile::~DwarfFile() {} @@ -56,7 +55,7 @@ void DwarfFile::emitUnits(const MCSymbol *ASectionSym) { TheU->emitHeader(ASectionSym); - DD.emitDIE(Die); + Asm->emitDwarfDIE(Die); } } @@ -120,23 +119,13 @@ unsigned DwarfFile::computeSizeAndOffset(DIE &Die, unsigned Offset) { Die.setSize(Offset - Die.getOffset()); return Offset; } + void DwarfFile::emitAbbrevs(const MCSection *Section) { // Check to see if it is worth the effort. if (!Abbreviations.empty()) { // Start the debug abbrev section. Asm->OutStreamer.SwitchSection(Section); - - // For each abbrevation. - for (const DIEAbbrev *Abbrev : Abbreviations) { - // Emit the abbrevations code (base 1 index.) - Asm->EmitULEB128(Abbrev->getNumber(), "Abbreviation Code"); - - // Emit the abbreviations data. - Abbrev->Emit(Asm); - } - - // Mark end of abbreviations. - Asm->EmitULEB128(0, "EOM(3)"); + Asm->emitDwarfAbbrevs(Abbreviations); } } |