From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1130) id A89CE385843A; Tue, 12 Sep 2023 15:08:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A89CE385843A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1694531294; bh=xJz66/GHiwTmfgJzKj0EyXxHaC/FK7dSvK2t+WjyVhU=; h=From:To:Subject:Date:From; b=EbibgaYOKtbhjRTuxmIqEP6OMqaYOspl2IIsqt69hICEy/RS1kqEIsUuU9wEUFZd0 vXvnqjlycK4egR+nRRpr5bjQPJxh3zjZV76axgfggoxleGPIwl+o/dT8KFKhbt7CMW 2FADOdvJxzBVQQtf9Qazqrsu391dQIlXAG3L356k= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Richard Sandiford To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-7797] aarch64: Explicitly handle frames with no saved registers X-Act-Checkin: gcc X-Git-Author: Richard Sandiford X-Git-Refname: refs/heads/releases/gcc-13 X-Git-Oldrev: 89a9fa287706c5011f61926eaf65e7b996b963a3 X-Git-Newrev: b36a2a78040722dab6124366c5d6baf8eaf80aef Message-Id: <20230912150814.A89CE385843A@sourceware.org> Date: Tue, 12 Sep 2023 15:08:14 +0000 (GMT) List-Id: https://gcc.gnu.org/g:b36a2a78040722dab6124366c5d6baf8eaf80aef commit r13-7797-gb36a2a78040722dab6124366c5d6baf8eaf80aef Author: Richard Sandiford Date: Tue Sep 12 16:07:13 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. And if we allocate the frame in one go, it should be allocated as the initial_adjust rather than the final_adjust. This allows the frame size to grow to guard_size - guard_used_by_caller before a stack probe is needed. (A frame with no register saves is necessarily a leaf frame.) 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.cc (aarch64_layout_frame): Explicitly allocate the frame in one go if there are no saved registers. Diff: --- gcc/config/aarch64/aarch64.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc index 4f233c95140e..37643041ffb1 100644 --- a/gcc/config/aarch64/aarch64.cc +++ b/gcc/config/aarch64/aarch64.cc @@ -8639,9 +8639,11 @@ aarch64_layout_frame (void) HOST_WIDE_INT const_size, const_outgoing_args_size, const_fp_offset; HOST_WIDE_INT const_saved_regs_size; - if (frame.frame_size.is_constant (&const_size) - && const_size < max_push_offset - && known_eq (frame.hard_fp_offset, const_size)) + if (known_eq (frame.saved_regs_size, 0)) + frame.initial_adjust = frame.frame_size; + else if (frame.frame_size.is_constant (&const_size) + && const_size < max_push_offset + && known_eq (frame.hard_fp_offset, const_size)) { /* Simple, small frame with no outgoing arguments: