[arm] PR target/90405 fix regression for thumb1 with -mtpcs-leaf-frame
authorRichard Earnshaw <rearnsha@arm.com>
Thu, 9 May 2019 16:00:23 +0000 (16:00 +0000)
committerRichard Earnshaw <rearnsha@gcc.gnu.org>
Thu, 9 May 2019 16:00:23 +0000 (16:00 +0000)
commit4456525c4ebf97649f4976b4981318fba4564c31
tree8c0fb9f89d43d84ba3d5a6052ee6623895abb4d5
parentfd4485aa04b5db3f0fc367ce7aefc8431112e1a1
[arm] PR target/90405 fix regression for thumb1 with -mtpcs-leaf-frame

-mtpcs-leaf-frame causes an APCS-style backtrace frame to be created
on the stack.  This should probably be deprecated, but it did reveal
an issue with the patch I committed previously to improve the code
generation when pushing high registers, in that
thumb_find_work_register had a different idea as to which registers
were available as scratch registers.

The new code actually does a better job of finding a viable work
register and doesn't rely so much on assumptions about the ABI, so it
seems better to adapt thumb_find_work_register to the new approach.
This way we can eliminate some rather crufty code.

gcc:
PR target/90405
* config/arm/arm.c (callee_saved_reg_p): Move before
thumb_find_work_register.
(thumb1_prologue_unused_call_clobbered_lo_regs): Move before
thumb_find_work_register.  Only call df_get_live_out once.
(thumb1_epilogue_unused_call_clobbered_lo_regs): Likewise.
(thumb_find_work_register): Use
thumb1_prologue_unused_call_clobbered_lo_regs instead of ad hoc
algorithms to locate a spare call clobbered reg.

gcc/testsuite:
PR target/90405
* gcc.target/arm/pr90405.c: New test.

From-SVN: r271036
gcc/ChangeLog
gcc/config/arm/arm.c