[PATCH] D24237: [ARM] Promote small global constants to constant pools
James Molloy via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 5 08:39:16 PDT 2016
jmolloy created this revision.
jmolloy added reviewers: olista01, t.p.northover, mcrosier.
jmolloy added a subscriber: llvm-commits.
jmolloy set the repository for this revision to rL LLVM.
Herald added subscribers: samparker, rengolin, aemerson.
If a constant is unamed_addr and is only used within one function, we can save
on the code size and runtime cost of an indirection by changing the global's storage
to inside the constant pool. For example, instead of:
ldr r0, .CPI0
bl printf
bx lr
.CPI0: &format_string
format_string: .asciz "hello, world!\n"
We can emit:
adr r0, .CPI0
bl printf
bx lr
.CPI0: .asciz "hello, world!\n"
This can cause significant code size savings when many small strings are used in one
function (4 bytes per string).
Repository:
rL LLVM
https://reviews.llvm.org/D24237
Files:
lib/Target/ARM/ARMAsmPrinter.cpp
lib/Target/ARM/ARMAsmPrinter.h
lib/Target/ARM/ARMISelLowering.cpp
lib/Target/ARM/ARMMachineFunctionInfo.h
test/CodeGen/ARM/constantpool-promote.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D24237.70335.patch
Type: text/x-patch
Size: 10536 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160905/bd62a77d/attachment.bin>
More information about the llvm-commits
mailing list