public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Andrea Corallo <akrl@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc(refs/vendors/ARM/heads/arm-12-m-pacbti)] [PATCH 9/15] arm: Set again stack pointer as CFA reg when popping if necessary
Date: Fri, 12 Aug 2022 16:30:53 +0000 (GMT)	[thread overview]
Message-ID: <20220812163053.DD068385842E@sourceware.org> (raw)

https://gcc.gnu.org/g:721d4af523814538f266e2d1efa9cfacf1176209

commit 721d4af523814538f266e2d1efa9cfacf1176209
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


                 reply	other threads:[~2022-08-12 16:30 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220812163053.DD068385842E@sourceware.org \
    --to=akrl@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).