From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1130) id 645483858C33; Tue, 12 Sep 2023 15:20:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 645483858C33 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1694532024; bh=tjg8Pk17A1e/7wVWQK+z4J3d6v4egXM1DPeaIFIEA0g=; h=From:To:Subject:Date:From; b=fj4Cwcv+P6beSUgepWxIgzS8Dry5P2sSKYb0O3kVJB+69b55F+Fy2Ym4hMqN47Gc+ G3GQ+Mvi1RPhI1kFeWkiAhNHA/QWC2YRXi1vniUhThe4Bh4spGultePRFjfVkmt8K0 NVKhW3ng1AyKwRKGoUjy2HqIuiDkiGoDFidwscx4= 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 r11-10987] aarch64: Avoid a use of callee_offset X-Act-Checkin: gcc X-Git-Author: Richard Sandiford X-Git-Refname: refs/heads/releases/gcc-11 X-Git-Oldrev: 52816ab48f97968f3fbfb5656250f3de7c00166d X-Git-Newrev: a2a57f7ec7912e77eb26919545807d90065584ff Message-Id: <20230912152024.645483858C33@sourceware.org> Date: Tue, 12 Sep 2023 15:20:24 +0000 (GMT) List-Id: https://gcc.gnu.org/g:a2a57f7ec7912e77eb26919545807d90065584ff commit r11-10987-ga2a57f7ec7912e77eb26919545807d90065584ff Author: Richard Sandiford Date: Tue Sep 12 16:19:44 2023 +0100 aarch64: Avoid a use of callee_offset When we emit the frame chain, i.e. when we reach Here in this statement of aarch64_expand_prologue: if (emit_frame_chain) { // Here ... } the stack is in one of two states: - We've allocated up to the frame chain, but no more. - We've allocated the whole frame, and the frame chain is within easy reach of the new SP. The offset of the frame chain from the current SP is available in aarch64_frame as callee_offset. It is also available as the chain_offset local variable, where the latter is calculated from other data. (However, chain_offset is not always equal to callee_offset when !emit_frame_chain, so chain_offset isn't redundant.) In c600df9a4060da3c6121ff4d0b93f179eafd69d1 I switched to using chain_offset for the initialisation of the hard frame pointer: aarch64_add_offset (Pmode, hard_frame_pointer_rtx, - stack_pointer_rtx, callee_offset, + stack_pointer_rtx, chain_offset, tmp1_rtx, tmp0_rtx, frame_pointer_needed); But the later REG_CFA_ADJUST_CFA handling still used callee_offset. I think the difference is harmless, but it's more logical for the CFA note to be in sync, and it's more convenient for later patches if it uses chain_offset. gcc/ * config/aarch64/aarch64.c (aarch64_expand_prologue): Use chain_offset rather than callee_offset. Diff: --- gcc/config/aarch64/aarch64.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index 77c1d1300a5c..6bc026bd08f9 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -8901,7 +8901,6 @@ aarch64_expand_prologue (void) poly_int64 initial_adjust = frame.initial_adjust; HOST_WIDE_INT callee_adjust = frame.callee_adjust; poly_int64 final_adjust = frame.final_adjust; - poly_int64 callee_offset = frame.callee_offset; poly_int64 sve_callee_adjust = frame.sve_callee_adjust; poly_int64 below_hard_fp_saved_regs_size = frame.below_hard_fp_saved_regs_size; @@ -9010,8 +9009,7 @@ aarch64_expand_prologue (void) implicit. */ if (!find_reg_note (insn, REG_CFA_ADJUST_CFA, NULL_RTX)) { - rtx src = plus_constant (Pmode, stack_pointer_rtx, - callee_offset); + rtx src = plus_constant (Pmode, stack_pointer_rtx, chain_offset); add_reg_note (insn, REG_CFA_ADJUST_CFA, gen_rtx_SET (hard_frame_pointer_rtx, src)); }