AsmPrinter: Compute absolute label difference directly
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>
Thu, 21 May 2015 02:41:23 +0000 (02:41 +0000)
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>
Thu, 21 May 2015 02:41:23 +0000 (02:41 +0000)
commit583dac827ca7daea75c6e92c4ebf6b2296118886
treec41572cb81436dfbb98977724b0c92d9f444331b
parent1d4f2ba509eebf9aaaec2412a4772b6969e49974
AsmPrinter: Compute absolute label difference directly

Create a low-overhead path for `EmitLabelDifference()` that emits a
emits an absolute number when (1) the output is an object stream and (2)
the two symbols are in the same data fragment.

This drops memory usage on Mach-O from 975 MB down to 919 MB (5.8%).
The only call is when `!doesDwarfUseRelocationsAcrossSections()` --
i.e., on Mach-O -- since otherwise an absolute offset from the start of
the section needs a relocation.  (`EmitLabelDifference()` is cheaper on
ELF anyway, since it creates 1 fewer temp symbol, and it gets called far
less often.  It's not clear to me if this is even a bottleneck there.)

(I'm looking at `llc` memory usage on `verify-uselistorder.lto.opt.bc`;
see r236629 for details.)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237876 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/MC/MCObjectStreamer.h
include/llvm/MC/MCStreamer.h
lib/CodeGen/AsmPrinter/AsmPrinter.cpp
lib/MC/MCObjectStreamer.cpp