OSDN Git Service

Subzero: Improve handling of alloca instructions of constant size.
authorJim Stichnoth <stichnot@chromium.org>
Wed, 23 Sep 2015 23:33:08 +0000 (16:33 -0700)
committerJim Stichnoth <stichnot@chromium.org>
Wed, 23 Sep 2015 23:33:08 +0000 (16:33 -0700)
commit55f931f65f307116c2def40c3b11ec93998a907e
tree400dc0872072e06f5e2f53a6ee4797f819a3a5bd
parent467a222f6728d7faccd82b40d79303ed97732c15
Subzero: Improve handling of alloca instructions of constant size.

PNaCl simplifies varargs calls by creating a known-size argument array with an alloca instruction, and passing the address of that argument array.  These alloca instructions don't necessarily require use of a frame pointer, freeing up the frame pointer register for normal register allocation.

These varargs calls sometimes show up in cold paths of hot functions, so increasing the number of registers available to the register allocator can produce tangible gains.

This patch does a simple recognition of these alloca patterns, and on x86 doesn't force a frame pointer if all alloca instructions are suitable.

Future work is to avoid saving the alloca result as a local variable, and instead rematerialize the address as needed with respect to the stack or frame pointer.

BUG= none
R=jpp@chromium.org

Review URL: https://codereview.chromium.org/1361803002 .
src/IceCfg.cpp
src/IceInst.h
src/IceTargetLowering.h
src/IceTargetLoweringX8632.cpp
src/IceTargetLoweringX8664.cpp
src/IceTargetLoweringX86Base.h
src/IceTargetLoweringX86BaseImpl.h
tests_lit/llvm2ice_tests/align-spill-locations.ll
tests_lit/llvm2ice_tests/alloc.ll
tests_lit/llvm2ice_tests/ebp_args.ll
tests_lit/llvm2ice_tests/nacl-atomic-intrinsics.ll