]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[PATCH 9/15] arm: Set again stack pointer as CFA reg when popping if necessary
authorAndrea Corallo <andrea.corallo@arm.com>
Wed, 10 Aug 2022 15:05:10 +0000 (17:05 +0200)
committerAndrea Corallo <andrea.corallo@arm.com>
Fri, 19 Aug 2022 13:22:58 +0000 (15:22 +0200)
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.

gcc/config/arm/arm.cc

index c49c86e75b8f77e355fcc5e0567cad392d1daa14..5380abeffe8ca2530e1135bb7131b28f49dfec86 100644 (file)
@@ -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