diff options
| author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-05-24 16:48:54 +0000 |
|---|---|---|
| committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-05-24 16:48:54 +0000 |
| commit | 1e0d94e7bb989ac009467dd526e0d680bd02d4ee (patch) | |
| tree | e8bb6ab14e61d7d085e09c50e45a9aca8c41a66a /llvm/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp | |
| parent | f4599942fb3063a879985e51360c2c0d46685df4 (diff) | |
| download | bcm5719-llvm-1e0d94e7bb989ac009467dd526e0d680bd02d4ee.tar.gz bcm5719-llvm-1e0d94e7bb989ac009467dd526e0d680bd02d4ee.zip | |
AsmPrinter: Avoid EmitLabelDifference() in DwarfAccelTable
Mint a new function, `AsmPrinter::emitDwarfStringOffset()`, which takes
a `DwarfStringPoolEntryRef`. When DWARF is relocatable across sections,
this defers to `emitSectionOffset()` and emits the `MCSymbol`;
otherwise, just emit the offset directly, without using any intermediate
symbols.
`EmitLabelDifference()` is already optimized to emit absolute label
differences cheaply when possible, so there aren't any major memory
savings here (853 MB down to 851 MB, or 0.2%). However, it prepares for
making the `MCSymbol`s in the `DwarfStringPool` optional.
(I'm looking at `llc` memory usage on `verify-uselistorder.lto.opt.bc`;
see r236629 for details.)
llvm-svn: 238119
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp')
| -rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp index 6f48767c1df..3258961bfb1 100644 --- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp @@ -181,6 +181,16 @@ void AsmPrinter::emitSectionOffset(const MCSymbol *Label) const { EmitLabelDifference(Label, Label->getSection().getBeginSymbol(), 4); } +void AsmPrinter::emitDwarfStringOffset(DwarfStringPoolEntryRef S) const { + if (MAI->doesDwarfUseRelocationsAcrossSections()) { + emitSectionOffset(S.getSymbol()); + return; + } + + // Just emit the offset directly; no need for symbol math. + EmitInt32(S.getOffset()); +} + /// EmitDwarfRegOp - Emit dwarf register operation. void AsmPrinter::EmitDwarfRegOp(ByteStreamer &Streamer, const MachineLocation &MLoc) const { |

