[PATCH] D56883: [X86] Deduplicate static calling convention helpers for code size, NFC

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 17 16:13:02 PST 2019


rnk created this revision.
rnk added reviewers: craig.topper, hfinkel, efriedma.
Herald added subscribers: hiraditya, kristof.beyls, javed.absar.

Right now we include ${TGT}GenCallingConv.inc once per each instruction
selection method implemented by ${TGT}:

- ${TGT}ISelLowering.cpp
- ${TGT}CallLowering.cpp
- ${TGT}FastISel.cpp

Instead, add a mechanism to tablegen for marking a particular convention
as "External", which causes tablegen to emit into the ::llvm namespace,
instead of as a static helper. This allows us to provide a header to
forward declare it, so we can simply call the function from all the
places it is referenced. Typically the calling convention analyzer is
called indirectly, so it doesn't benefit from inlining.

This saves a bit of final binary size, but mostly just saves object file
size:

before  after   diff   artifact
12852K  12492K  -360K  X86ISelLowering.cpp.obj
4640K   4280K   -360K  X86FastISel.cpp.obj
1704K   2092K   +388K  X86CallingConv.cpp.obj
52448K  52336K  -112K  llc.exe

I didn't collect before numbers for X86CallLowering.cpp.obj, which is
for GlobalISel, but we should save 360K there as well.

This patch applies the strategy to the X86 backend, but there is no
reason it couldn't be applied to the other backends that implement
multiple ISel strategies, like AArch64.


https://reviews.llvm.org/D56883

Files:
  llvm/include/llvm/Target/TargetCallingConv.td
  llvm/lib/Target/X86/X86CallLowering.cpp
  llvm/lib/Target/X86/X86CallingConv.cpp
  llvm/lib/Target/X86/X86CallingConv.h
  llvm/lib/Target/X86/X86CallingConv.td
  llvm/lib/Target/X86/X86FastISel.cpp
  llvm/lib/Target/X86/X86ISelLowering.cpp
  llvm/utils/TableGen/CallingConvEmitter.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56883.182409.patch
Type: text/x-patch
Size: 11187 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190118/b16f88c5/attachment.bin>


More information about the llvm-commits mailing list