xtensa: Make register A0 allocable for the CALL0 ABI
Commit Message
This patch offers an additional allocable register by RA for the CALL0
ABI.
> Register a0 holds the return address upon entry to a function, but
> unlike the windowed register ABI, it is not reserved for this purpose
> and may hold other values after the return address has been saved.
- Xtensa ISA Reference Manual,
8.1.2 "CALL0 Register Usage and Stack Layout" [p.589]
gcc/ChangeLog:
* config/xtensa/xtensa.cc (xtensa_conditional_register_usage):
Remove register A0 from FIXED_REGS if the CALL0 ABI.
---
gcc/config/xtensa/xtensa.cc | 7 +++++++
1 file changed, 7 insertions(+)
Comments
Hi Suwa-san,
On Thu, Oct 20, 2022 at 7:58 PM Takayuki 'January June' Suwa
<jjsuwa_sys3175@yahoo.co.jp> wrote:
>
> This patch offers an additional allocable register by RA for the CALL0
> ABI.
>
> > Register a0 holds the return address upon entry to a function, but
> > unlike the windowed register ABI, it is not reserved for this purpose
> > and may hold other values after the return address has been saved.
> - Xtensa ISA Reference Manual,
> 8.1.2 "CALL0 Register Usage and Stack Layout" [p.589]
>
> gcc/ChangeLog:
>
> * config/xtensa/xtensa.cc (xtensa_conditional_register_usage):
> Remove register A0 from FIXED_REGS if the CALL0 ABI.
> ---
> gcc/config/xtensa/xtensa.cc | 7 +++++++
> 1 file changed, 7 insertions(+)
This change results in the following new regressions:
FAIL: gcc.c-torture/execute/20040709-1.c -O3 -fomit-frame-pointer
-funroll-loops -fpeel-loops -ftracer -finline-functions execution
test
FAIL: gcc.c-torture/execute/20040709-2.c -O3 -fomit-frame-pointer
-funroll-loops -fpeel-loops -ftracer -finline-functions execution
test
FAIL: gcc.c-torture/execute/20190820-1.c -O3 -fomit-frame-pointer
-funroll-loops -fpeel-loops -ftracer -finline-functions execution
test
FAIL: gcc.c-torture/execute/loop-15.c -O3 -fomit-frame-pointer
-funroll-loops -fpeel-loops -ftracer -finline-functions execution
test
FAIL: gcc.dg/torture/pr101031.c -O3 -fomit-frame-pointer
-funroll-loops -fpeel-loops -ftracer -finline-functions execution
test
FAIL: gcc.dg/torture/pr101972.c -O3 -fomit-frame-pointer
-funroll-loops -fpeel-loops -ftracer -finline-functions execution
test
FAIL: gcc.dg/torture/pr99954.c -O3 -fomit-frame-pointer
-funroll-loops -fpeel-loops -ftracer -finline-functions execution
test
FAIL: g++.dg/coroutines/torture/co-yield-04-complex-local-state.C
-O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer
-finline-functions execution test
FAIL: g++.dg/coroutines/torture/local-var-05-awaitable.C -O3
-fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer
-finline-functions execution test
@@ -4970,6 +4970,13 @@ xtensa_conditional_register_usage (void)
/* Remove hard FP register from the preferred reload registers set. */
CLEAR_HARD_REG_BIT (reg_class_contents[(int)RL_REGS],
HARD_FRAME_POINTER_REGNUM);
+
+ /* Register A0 holds the return address upon entry to a function
+ for the CALL0 ABI, but unlike the windowed register ABI, it is
+ not reserved for this purpose and may hold other values after
+ the return address has been saved. */
+ if (!TARGET_WINDOWED_ABI)
+ fixed_regs[A0_REG] = 0;
}
/* Map hard register number to register class */