[PATCH] D18619: [AArch64] Combine callee-save and local stack SP adjustment instructions.

Geoff Berry via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 30 13:01:49 PDT 2016


gberry created this revision.
gberry added a reviewer: t.p.northover.
gberry added a subscriber: llvm-commits.
Herald added subscribers: mcrosier, rengolin, aemerson.

If a function needs to allocate both callee-save stack memory and local
stack memory, we currently decrement/increment the SP in two steps:
first for the callee-save area, and then for the local stack area.  This
changes the code to allocate them both at once at the very beginning/end
of the function.  This has a few benefits:

1) there is one fewer sub/add micro-op in the prologue/epilogue

2) stack usage is reduced in cases where both the callee-save area and
local stack area size are equal to 8 mod 16

3) the stack adjustment instructions act as a scheduling barrier, so
moving them to the very beginning/end of the function increases post-RA
scheduler's ability to move instructions (that only depend on argument
registers) before any of the callee-save stores

This change can cause an increase in instructions if the original local
stack SP decrement could be folded into the first store to the stack.
This occurs when the first local stack store is to stack offset 0.  In
this case we are trading off one more sub instruction for one fewer sub
micro-op (along with benefits (2) and (3) above).

http://reviews.llvm.org/D18619

Files:
  lib/Target/AArch64/AArch64FrameLowering.cpp
  lib/Target/AArch64/AArch64FrameLowering.h
  lib/Target/AArch64/AArch64MachineFunctionInfo.h
  lib/Target/AArch64/AArch64RegisterInfo.cpp
  test/CodeGen/AArch64/aarch64-dynamic-stack-layout.ll
  test/CodeGen/AArch64/arm64-aapcs-be.ll
  test/CodeGen/AArch64/arm64-abi.ll
  test/CodeGen/AArch64/arm64-abi_align.ll
  test/CodeGen/AArch64/arm64-fast-isel-alloca.ll
  test/CodeGen/AArch64/arm64-hello.ll
  test/CodeGen/AArch64/arm64-join-reserved.ll
  test/CodeGen/AArch64/arm64-patchpoint-webkit_jscc.ll
  test/CodeGen/AArch64/arm64-patchpoint.ll
  test/CodeGen/AArch64/arm64-shrink-wrapping.ll
  test/CodeGen/AArch64/arm64-virtual_base.ll
  test/CodeGen/AArch64/fastcc.ll
  test/CodeGen/AArch64/func-calls.ll
  test/CodeGen/AArch64/remat.ll
  test/CodeGen/AArch64/tailcall-implicit-sret.ll
  test/DebugInfo/AArch64/prologue_end.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D18619.52109.patch
Type: text/x-patch
Size: 36198 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160330/793cd1b9/attachment.bin>


More information about the llvm-commits mailing list