[LLVMdev] RFC: Merge MCSymbol with MCSymbolData, optimizing for object file emission

Duncan P. N. Exon Smith dexonsmith at apple.com
Wed May 13 14:48:56 PDT 2015


Right now MC is optimized for emitting assembly, but as Rafael pointed
out to me over IRC the optimized path should be emitting object files.

This WIP patch moves MCSymbolData into MCSymbol.h and makes it a
field inside MCSymbol.  This eliminates a pointer from MCSymbolData back
to MCSymbol, the DenseMap<const MCSymbol *, MCSymbolData *> in
MCAssembler, and converts the iplist in MCAssembler into a std::vector
(along with some churn to pass around MCSymbols instead of
MCSymbolData).  As a result, during object emission we save ~6 pointers
per MCSymbol, eliminate lookup indirection between MCSymbol and
MCSymbolData, and avoid allocation overhead for MCSymbolData.

I've measured ~4% memory savings on `llc` with this patch (using the
same -flto -g input as r236642 and r236629 before it), dropping memory
usage from 1058 MB down to 1017 MB.

Before I clean this up and commit it (obviously in more incremental
patches (and I'll do the same cleanup for MCSection)), I wanted to
confirm the direction.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: symbol-data-wip.patch
Type: application/octet-stream
Size: 89529 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150513/3cae1543/attachment.obj>


More information about the llvm-dev mailing list