xtensa: Improve indirect sibling call handling
authorTakayuki 'January June' Suwa <jjsuwa_sys3175@yahoo.co.jp>
Thu, 18 Aug 2022 10:03:51 +0000 (19:03 +0900)
committerMax Filippov <jcmvbkbc@gmail.com>
Thu, 18 Aug 2022 19:59:46 +0000 (12:59 -0700)
commit8731aa98674eda56425ffd652918ce4979631f67
tree74d4511009454b412ebef7537aaf7bff327b4bbb
parentca170ed9f8a086ca7e1eec841882b6bed9ec1a3a
xtensa: Improve indirect sibling call handling

No longer needs the dedicated hard register (A11) for the address of the
call and the split patterns for fixups, due to the introduction of appropriate
register class and constraint.

(Note: "ISC_REGS" contains a hard register A8 used as a "static chain"
 pointer for nested functions, but no problem;  Pointer to nested function
 actually points to "trampoline", and trampoline itself doesn't receive
 "static chain" pointer to its parent's stack frame from the caller.)

gcc/ChangeLog:

* config/xtensa/xtensa.h
(enum reg_class, REG_CLASS_NAMES, REG_CLASS_CONTENTS):
Add new register class "ISC_REGS".
* config/xtensa/constraints.md (c): Add new register constraint.
* config/xtensa/xtensa.md (define_constants): Remove "A11_REG".
(sibcall_internal, sibcall_value_internal):
Change to use the new register constraint, and remove two split
patterns for fixups that are no longer needed.

gcc/testsuite/ChangeLog:

* gcc.target/xtensa/sibcalls.c: Add a new test function to ensure
that registers for arguments (occupy from A2 to A7) and for indirect
sibcall (should be assigned to A8) neither conflict nor spill out.
gcc/config/xtensa/constraints.md
gcc/config/xtensa/xtensa.h
gcc/config/xtensa/xtensa.md
gcc/testsuite/gcc.target/xtensa/sibcalls.c