[binutils-gdb] gas: sframe: add new sframe_xlate_ctx_get_cur_cfa_reg
Indu Bhagat
ibhagat@sourceware.org
Wed Dec 24 08:43:23 GMT 2025
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=8ca0d74895151b62bc322c5053720d41d154a4d3
commit 8ca0d74895151b62bc322c5053720d41d154a4d3
Author: Indu Bhagat <indu.bhagat@oracle.com>
Date: Wed Dec 24 00:43:04 2025 -0800
gas: sframe: add new sframe_xlate_ctx_get_cur_cfa_reg
Purely cosmetic change.
Reviewed-by: Jens Remus <jremus@linux.ibm.com>
gas/
* gen-sframe.c (sframe_xlate_ctx_get_cur_cfa_reg): New
definition.
(sframe_xlate_do_def_cfa_offset): Use it.
(sframe_xlate_do_escape_expr): Likewise.
(sframe_xlate_do_escape_gnu_args_size): Likewise.
Diff:
---
gas/gen-sframe.c | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/gas/gen-sframe.c b/gas/gen-sframe.c
index dad6e8b3735..ecd56e8f164 100644
--- a/gas/gen-sframe.c
+++ b/gas/gen-sframe.c
@@ -947,6 +947,17 @@ sframe_xlate_ctx_finalize (struct sframe_xlate_ctx *xlate_ctx,
xlate_ctx->remember_fre = NULL;
}
+/* Get the current CFA base register from the scratchpad FRE (cur_fre).
+ NB: this may return a value of SFRAME_FRE_REG_INVALID. */
+
+static unsigned int
+sframe_xlate_ctx_get_cur_cfa_reg (const struct sframe_xlate_ctx *xlate_ctx)
+{
+ gas_assert (xlate_ctx && xlate_ctx->cur_fre);
+
+ return xlate_ctx->cur_fre->cfa_base_reg;
+}
+
/* Add the given FRE in the list of frame row entries in the given FDE
translation context. */
@@ -1145,13 +1156,13 @@ sframe_xlate_do_def_cfa_offset (struct sframe_xlate_ctx *xlate_ctx,
being interpreted. This FRE eventually gets linked in into the
list of FREs for the specific function. */
struct sframe_row_entry *cur_fre = xlate_ctx->cur_fre;
+ unsigned int cur_cfa_reg = sframe_xlate_ctx_get_cur_cfa_reg (xlate_ctx);
gas_assert (cur_fre);
/* Define the current CFA rule to use the provided offset (but to keep
the old register). However, if the old register is not FP/SP,
skip creating SFrame stack trace info for the function. */
- if ((cur_fre->cfa_base_reg == SFRAME_CFA_FP_REG)
- || (cur_fre->cfa_base_reg == SFRAME_CFA_SP_REG))
+ if (cur_cfa_reg == SFRAME_CFA_FP_REG || cur_cfa_reg == SFRAME_CFA_SP_REG)
{
if (sframe_fre_stack_offset_bound_p (cfi_insn->u.i, true))
{
@@ -1512,7 +1523,7 @@ sframe_xlate_do_escape_expr (const struct sframe_xlate_ctx *xlate_ctx,
if (reg == SFRAME_CFA_SP_REG || reg == SFRAME_CFA_FP_REG
|| (sframe_ra_tracking_p () && reg == SFRAME_CFA_RA_REG)
- || reg == xlate_ctx->cur_fre->cfa_base_reg)
+ || reg == sframe_xlate_ctx_get_cur_cfa_reg (xlate_ctx))
{
as_warn (_("no SFrame FDE emitted; "
".cfi_escape DW_CFA_expression with %s reg %u"),
@@ -1649,7 +1660,8 @@ sframe_xlate_do_escape_gnu_args_size (const struct sframe_xlate_ctx *xlate_ctx,
struct sframe_row_entry *cur_fre = xlate_ctx->cur_fre;
gas_assert (cur_fre);
/* If CFA is FP based, safe to skip. */
- if (offset == 0 || cur_fre->cfa_base_reg == SFRAME_CFA_FP_REG)
+ if (offset == 0
+ || sframe_xlate_ctx_get_cur_cfa_reg (xlate_ctx) == SFRAME_CFA_FP_REG)
return SFRAME_XLATE_OK;
warn_and_exit:
More information about the Binutils-cvs
mailing list