]> git.ipfire.org Git - thirdparty/gcc.git/commit - gcc/config/xtensa/xtensa.cc
xtensa: Add support for sibling call optimization
authorTakayuki 'January June' Suwa <jjsuwa_sys3175@yahoo.co.jp>
Wed, 15 Jun 2022 12:21:21 +0000 (21:21 +0900)
committerMax Filippov <jcmvbkbc@gmail.com>
Wed, 15 Jun 2022 23:55:36 +0000 (16:55 -0700)
commit43b0c56fda4bc990e8ee8d6a0b376de7b663bb06
treee2b0511e65e49eac0883b44d8d9d262d9fa7dde8
parent96518f714e3fab53a966a05b8d48011e27c1a718
xtensa: Add support for sibling call optimization

This patch introduces support for sibling call optimization, when call0
ABI is in effect.

gcc/ChangeLog:

* config/xtensa/xtensa-protos.h (xtensa_prepare_expand_call,
xtensa_emit_sibcall): New prototypes.
(xtensa_expand_epilogue): Add new argument that specifies whether
or not sibling call.
* config/xtensa/xtensa.cc (TARGET_FUNCTION_OK_FOR_SIBCALL):
New macro definition.
(xtensa_prepare_expand_call): New function in order to share
the common code.
(xtensa_emit_sibcall, xtensa_function_ok_for_sibcall):
New functions.
(xtensa_expand_epilogue): Add new argument sibcall_p and use it
for sibling call handling.
* config/xtensa/xtensa.md (call, call_value):
Use xtensa_prepare_expand_call.
(call_internal, call_value_internal):
Add the condition in order to be disabled if sibling call.
(sibcall, sibcall_value, sibcall_epilogue): New expansions.
(sibcall_internal, sibcall_value_internal): New insn patterns,
and split ones in order to take care of the indirect sibcalls.

gcc/testsuite/ChangeLog:

* gcc.target/xtensa/sibcalls.c: New.
gcc/config/xtensa/xtensa-protos.h
gcc/config/xtensa/xtensa.cc
gcc/config/xtensa/xtensa.md
gcc/testsuite/gcc.target/xtensa/sibcalls.c [new file with mode: 0644]