[PR83370][AARCH64]Use tighter register constraint for sibcall patterns.
authorRenlin Li <renlin@gcc.gnu.org>
Thu, 1 Feb 2018 13:02:24 +0000 (13:02 +0000)
committerRenlin Li <renlin@gcc.gnu.org>
Thu, 1 Feb 2018 13:02:24 +0000 (13:02 +0000)
commitd677263e6c6ce0b40ca791e97f7b2f4ab0718f03
treeffcc73195210cedb54a0013ffe86a74100c4a82e
parentdc3b4a20b5d83aea66758e8da31ce04a8cf3964b
[PR83370][AARCH64]Use tighter register constraint for sibcall patterns.

In aarch64 backend, ip0/ip1 register will be used in the prologue/epilogue as
temporary register.

When the compiler is performing sibcall optimization. It has the chance to use
ip0/ip1 register for indirect function call to hold the address. However,
those two register might be clobbered by the epilogue code which makes the
last sibcall instruction invalid.

The patch here renames the register class CALLER_SAVE_REGS to TAILCALL_ADDR_REGS
to reflect its usage, and remove IP registers from this class.

gcc/

2018-02-01  Renlin Li  <renlin.li@arm.com>

PR target/83370
* config/aarch64/aarch64.c (aarch64_class_max_nregs): Handle
TAILCALL_ADDR_REGS.
(aarch64_register_move_cost): Likewise.
* config/aarch64/aarch64.h (reg_class): Rename CALLER_SAVE_REGS to
TAILCALL_ADDR_REGS.
(REG_CLASS_NAMES): Likewise.
(REG_CLASS_CONTENTS): Rename CALLER_SAVE_REGS to
TAILCALL_ADDR_REGS. Remove IP registers.
* config/aarch64/aarch64.md (Ucs): Update register constraint.

gcc/testsuite/

2018-02-01  Richard Sandiford  <richard.sandiford@linaro.org>

PR target/83370
* gcc.target/aarch64/pr83370.c: New.

From-SVN: r257294
gcc/ChangeLog
gcc/config/aarch64/aarch64.c
gcc/config/aarch64/aarch64.h
gcc/config/aarch64/constraints.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/aarch64/pr83370.c [new file with mode: 0644]