[ARM] Refactor the prologue/epilogue emission to be more robust.
authorQuentin Colombet <qcolombet@apple.com>
Mon, 20 Jul 2015 21:42:14 +0000 (21:42 +0000)
committerQuentin Colombet <qcolombet@apple.com>
Mon, 20 Jul 2015 21:42:14 +0000 (21:42 +0000)
commitb2dab382ce01d602a757906160fccd9129c768f7
tree4a6ab1837fec12ebca41e844e280be11ccf3821c
parentc9f86c12604a377cf27a5627c11ced288c31cf1e
[ARM] Refactor the prologue/epilogue emission to be more robust.

This is the first step toward supporting shrink-wrapping for this target.

The changes could be summarized by these items:
- Expand the tail-call return as part of the expand pseudo pass.
- Get rid of the assumptions that the epilogue is the exit block:
  * Do not assume which registers are free in the epilogue. (This indirectly
    improve the lowering of the code for the segmented stacks, see the test
    cases.)
  * Take into account that the basic block can be empty.

Related to <rdar://problem/20821730>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242714 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/ARM/ARMExpandPseudoInsts.cpp
lib/Target/ARM/ARMFrameLowering.cpp
lib/Target/ARM/ARMFrameLowering.h
lib/Target/ARM/Thumb1FrameLowering.cpp
test/CodeGen/ARM/fold-stack-adjust.ll
test/CodeGen/ARM/thumb1_return_sequence.ll
test/CodeGen/Thumb/pop.ll
test/CodeGen/Thumb/vargs.ll