[gcc(refs/vendors/ARM/heads/arm-12-m-pacbti)] [PATCH 9/15] arm: Set again stack pointer as CFA reg when popping if necessary

Andrea Corallo akrl@gcc.gnu.org
Fri Aug 19 13:24:24 GMT 2022


https://gcc.gnu.org/g:bd0ed35026e46e358dcaa88b7576ad9f850d93bc

commit bd0ed35026e46e358dcaa88b7576ad9f850d93bc
Author: Andrea Corallo <andrea.corallo@arm.com>
Date:   Wed Aug 10 17:05:10 2022 +0200

    [PATCH 9/15] arm: Set again stack pointer as CFA reg when popping if necessary
    
    Hi all,
    
    this patch enables 'arm_emit_multi_reg_pop' to set again the stack
    pointer as CFA reg when popping if this is necessary.
    
    /gcc/
    
            * config/arm/arm.cc (arm_emit_multi_reg_pop): If the frame pointer
            was set define again the stack pointer as CFA reg when popping.

Diff:
---
 gcc/config/arm/arm.cc | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/gcc/config/arm/arm.cc b/gcc/config/arm/arm.cc
index c49c86e75b8..5380abeffe8 100644
--- a/gcc/config/arm/arm.cc
+++ b/gcc/config/arm/arm.cc
@@ -22311,8 +22311,18 @@ arm_emit_multi_reg_pop (unsigned long saved_regs_mask)
 
   REG_NOTES (par) = dwarf;
   if (!return_in_pc)
-    arm_add_cfa_adjust_cfa_note (par, UNITS_PER_WORD * num_regs,
-				 stack_pointer_rtx, stack_pointer_rtx);
+    {
+      /* If the frame pointer was set define again the stack pointer
+         as CFA reg.  */
+      if (frame_pointer_needed)
+        {
+          RTX_FRAME_RELATED_P (par) = 1;
+          add_reg_note (par, REG_CFA_DEF_CFA, stack_pointer_rtx);
+        }
+      else
+        arm_add_cfa_adjust_cfa_note (par, UNITS_PER_WORD * num_regs,
+                                     stack_pointer_rtx, stack_pointer_rtx);
+    }
 }
 
 /* Generate and emit an insn pattern that we will recognize as a pop_multi


More information about the Gcc-cvs mailing list