[v3,14/15] gas: Test predicate whether SFrame RA tracking is used

Message ID 20240412144718.4191286-15-jremus@linux.ibm.com
State New
Headers
Series sframe: Enhancements to SFrame info generation |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_binutils_build--master-arm success Testing passed
linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 success Testing passed
linaro-tcwg-bot/tcwg_binutils_check--master-aarch64 success Testing passed
linaro-tcwg-bot/tcwg_binutils_check--master-arm success Testing passed

Commit Message

Jens Remus April 12, 2024, 2:47 p.m. UTC
  The existence of the macro SFRAME_FRE_RA_TRACKING only ensures the
existence of the macro SFRAME_CFA_RA_REG and the predicate function
sframe_ra_tracking_p. It does not indicate whether SFrame RA tracking
is actually used.

Test the return value of the SFrame RA tracking predicate function
sframe_ra_tracking_p to determine whether RA tracking is used.

This aligns the logic in functions get_fre_num_offsets and
output_sframe_row_entry to the one used in all other places.

gas/
	* gen-sframe.c (get_fre_num_offsets, output_sframe_row_entry):
	Test predicate to determine whether SFrame RA tracking is used.

Signed-off-by: Jens Remus <jremus@linux.ibm.com>
---

Notes (jremus):
    Changes v2 -> v3:
    - New patch.

 gas/gen-sframe.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
  

Comments

Indu Bhagat April 18, 2024, 8:37 p.m. UTC | #1
On 4/12/24 07:47, Jens Remus wrote:
> The existence of the macro SFRAME_FRE_RA_TRACKING only ensures the
> existence of the macro SFRAME_CFA_RA_REG and the predicate function
> sframe_ra_tracking_p. It does not indicate whether SFrame RA tracking
> is actually used.
> 
> Test the return value of the SFrame RA tracking predicate function
> sframe_ra_tracking_p to determine whether RA tracking is used.
> 
> This aligns the logic in functions get_fre_num_offsets and
> output_sframe_row_entry to the one used in all other places.
> 

LGTM.

Thanks

> gas/
> 	* gen-sframe.c (get_fre_num_offsets, output_sframe_row_entry):
> 	Test predicate to determine whether SFrame RA tracking is used.
> 
> Signed-off-by: Jens Remus <jremus@linux.ibm.com>
> ---
> 
> Notes (jremus):
>      Changes v2 -> v3:
>      - New patch.
> 
>   gas/gen-sframe.c | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/gas/gen-sframe.c b/gas/gen-sframe.c
> index 12b523a8d59a..ca6565b0e45e 100644
> --- a/gas/gen-sframe.c
> +++ b/gas/gen-sframe.c
> @@ -346,7 +346,8 @@ get_fre_num_offsets (struct sframe_row_entry *sframe_fre)
>     if (sframe_fre->bp_loc == SFRAME_FRE_ELEM_LOC_STACK)
>       fre_num_offsets++;
>   #ifdef SFRAME_FRE_RA_TRACKING
> -  if (sframe_fre->ra_loc == SFRAME_FRE_ELEM_LOC_STACK)
> +  if (sframe_ra_tracking_p ()
> +      && sframe_fre->ra_loc == SFRAME_FRE_ELEM_LOC_STACK)
>       fre_num_offsets++;
>   #endif
>     return fre_num_offsets;
> @@ -536,7 +537,8 @@ output_sframe_row_entry (symbolS *fde_start_addr,
>     fre_write_offsets++;
>   
>   #ifdef SFRAME_FRE_RA_TRACKING
> -  if (sframe_fre->ra_loc == SFRAME_FRE_ELEM_LOC_STACK)
> +  if (sframe_ra_tracking_p ()
> +      && sframe_fre->ra_loc == SFRAME_FRE_ELEM_LOC_STACK)
>       {
>         fre_offset_func_map[idx].out_func (sframe_fre->ra_offset);
>         fre_write_offsets++;
  

Patch

diff --git a/gas/gen-sframe.c b/gas/gen-sframe.c
index 12b523a8d59a..ca6565b0e45e 100644
--- a/gas/gen-sframe.c
+++ b/gas/gen-sframe.c
@@ -346,7 +346,8 @@  get_fre_num_offsets (struct sframe_row_entry *sframe_fre)
   if (sframe_fre->bp_loc == SFRAME_FRE_ELEM_LOC_STACK)
     fre_num_offsets++;
 #ifdef SFRAME_FRE_RA_TRACKING
-  if (sframe_fre->ra_loc == SFRAME_FRE_ELEM_LOC_STACK)
+  if (sframe_ra_tracking_p ()
+      && sframe_fre->ra_loc == SFRAME_FRE_ELEM_LOC_STACK)
     fre_num_offsets++;
 #endif
   return fre_num_offsets;
@@ -536,7 +537,8 @@  output_sframe_row_entry (symbolS *fde_start_addr,
   fre_write_offsets++;
 
 #ifdef SFRAME_FRE_RA_TRACKING
-  if (sframe_fre->ra_loc == SFRAME_FRE_ELEM_LOC_STACK)
+  if (sframe_ra_tracking_p ()
+      && sframe_fre->ra_loc == SFRAME_FRE_ELEM_LOC_STACK)
     {
       fre_offset_func_map[idx].out_func (sframe_fre->ra_offset);
       fre_write_offsets++;