public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/vendors/ARM/heads/CVE-2023-4039/gcc-7)] aarch64: Explicitly handle frames with no saved registers
@ 2023-09-12 15:22 Richard Sandiford
  0 siblings, 0 replies; only message in thread
From: Richard Sandiford @ 2023-09-12 15:22 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:04553281f42e5c4340d554a93d1a73006365d8fb

commit 04553281f42e5c4340d554a93d1a73006365d8fb
Author: Richard Sandiford <richard.sandiford@arm.com>
Date:   Fri Jun 16 17:00:51 2023 +0100

    aarch64: Explicitly handle frames with no saved registers
    
    If a frame has no saved registers, it can be allocated in one go.
    There is no need to treat the areas below and above the saved
    registers as separate.
    
    This is a no-op as thing stand, since a leaf function will have
    no outgoing arguments, and so all the frame will be above where
    the saved registers normally go.
    
    gcc/
            * config/aarch64/aarch64.c (aarch64_layout_frame): Explicitly
            allocate the frame in one go if there are no saved registers.

Diff:
---
 gcc/config/aarch64/aarch64.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index 4e94be3b0b4d..bb4f6020e5df 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -2901,8 +2901,10 @@ aarch64_layout_frame (void)
   else if (cfun->machine->frame.wb_candidate1 != INVALID_REGNUM)
     max_push_offset = 256;
 
-  if (cfun->machine->frame.frame_size < max_push_offset
-      && crtl->outgoing_args_size == 0)
+  if (cfun->machine->frame.saved_regs_size == 0)
+    cfun->machine->frame.initial_adjust = cfun->machine->frame.frame_size;
+  else if (cfun->machine->frame.frame_size < max_push_offset
+	   && crtl->outgoing_args_size == 0)
     {
       /* Simple, small frame with no outgoing arguments:
 	 stp reg1, reg2, [sp, -frame_size]!

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-09-12 15:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-12 15:22 [gcc(refs/vendors/ARM/heads/CVE-2023-4039/gcc-7)] aarch64: Explicitly handle frames with no saved registers Richard Sandiford

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).