[gcc r13-6150] xtensa: Enforce return address saving when -Og is specified
Max Filippov
jcmvbkbc@gcc.gnu.org
Tue Feb 21 01:33:16 GMT 2023
https://gcc.gnu.org/g:a804419c89db9e1c0b99e772dda6c95095bab0bf
commit r13-6150-ga804419c89db9e1c0b99e772dda6c95095bab0bf
Author: Takayuki 'January June' Suwa <jjsuwa_sys3175@yahoo.co.jp>
Date: Sat Feb 18 13:54:10 2023 +0900
xtensa: Enforce return address saving when -Og is specified
Leaf function often omits saving its return address to the stack slot,
and this feature often makes debugging very confusing, especially for
stack dump analysis.
gcc/ChangeLog:
* config/xtensa/xtensa.cc (xtensa_call_save_reg): Change to return
true if register A0 (return address register) when -Og is specified.
Diff:
---
gcc/config/xtensa/xtensa.cc | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/gcc/config/xtensa/xtensa.cc b/gcc/config/xtensa/xtensa.cc
index 3e2e22d4cbe..d0320efe21d 100644
--- a/gcc/config/xtensa/xtensa.cc
+++ b/gcc/config/xtensa/xtensa.cc
@@ -3223,8 +3223,11 @@ xtensa_call_save_reg (int regno)
return false;
if (regno == A0_REG)
- return crtl->profile || !crtl->is_leaf || crtl->calls_eh_return ||
- df_regs_ever_live_p (regno);
+ /* Ensure the return address to be saved to the stack slot in order
+ to assist stack dump analysis when -Og is specified. */
+ return optimize_debug
+ || crtl->profile || !crtl->is_leaf || crtl->calls_eh_return
+ || df_regs_ever_live_p (regno);
if (crtl->calls_eh_return && IN_RANGE (regno, 2, 3))
return true;
More information about the Gcc-cvs
mailing list