ARM: fold prologue/epilogue sp updates into push/pop for code size
authorTim Northover <tnorthover@apple.com>
Fri, 8 Nov 2013 17:18:07 +0000 (17:18 +0000)
committerTim Northover <tnorthover@apple.com>
Fri, 8 Nov 2013 17:18:07 +0000 (17:18 +0000)
commit323ac85d6ad7ba5d9593d8e151d879bd91d82e08
tree1c3b17bc84524be55da9f3ffaf112d3263a564f9
parent2b01682aa7b9509e9fa1865ebed3d0a7928f5b7a
ARM: fold prologue/epilogue sp updates into push/pop for code size

ARM prologues usually look like:
    push {r7, lr}
    sub sp, sp, #4

If code size is extremely important, this can be optimised to the single
instruction:
    push {r6, r7, lr}

where we don't actually care about the contents of r6, but pushing it subtracts
4 from sp as a side effect.

This should implement such a conversion, predicated on the "minsize" function
attribute (-Oz) since I've yet to find any code it actually makes faster.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194264 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/ARM/ARMBaseInstrInfo.cpp
lib/Target/ARM/ARMBaseInstrInfo.h
lib/Target/ARM/ARMFrameLowering.cpp
lib/Target/ARM/Thumb1FrameLowering.cpp
test/CodeGen/ARM/fold-stack-adjust.ll [new file with mode: 0644]