From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1130) id 5051E38582B7; Tue, 12 Sep 2023 15:08:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5051E38582B7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1694531320; bh=aW0xCqJj1wQWhAeWdHmSzn87rmQZnJanuFtLLryS5+4=; h=From:To:Subject:Date:From; b=TmbBpph7sq7FvfjF7heHghBCMHGqS8X3CbAP4I6yQhS9yHVhM4klY/nFimFT2jngA 2lSvLSLUzK2t0rlIwcP7aMQsKYCLWtrsz0aB0jM4ZLLSSrZMymn54vVSZf3e2xeBIc bzgq0+y2zqkIz7uEtnpWpdjWwVaZCZOt3u17Z1pg= MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="utf-8" From: Richard Sandiford To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-7802] aarch64: Rename locals_offset to bytes_above_locals X-Act-Checkin: gcc X-Git-Author: Richard Sandiford X-Git-Refname: refs/heads/releases/gcc-13 X-Git-Oldrev: 8ae9181426f2700c2e5a2909487fa630e6fa406b X-Git-Newrev: 375794feb614cee1f41b710b9cc1b6f25da6c1cb Message-Id: <20230912150840.5051E38582B7@sourceware.org> Date: Tue, 12 Sep 2023 15:08:40 +0000 (GMT) List-Id: https://gcc.gnu.org/g:375794feb614cee1f41b710b9cc1b6f25da6c1cb commit r13-7802-g375794feb614cee1f41b710b9cc1b6f25da6c1cb Author: Richard Sandiford Date: Tue Sep 12 16:07:15 2023 +0100 aarch64: Rename locals_offset to bytes_above_locals locals_offset was described as: /* Offset from the base of the frame (incomming SP) to the top of the locals area. This value is always a multiple of STACK_BOUNDARY. */ This is implicitly an “upside down” view of the frame: the incoming SP is at offset 0, and anything N bytes below the incoming SP is at offset N (rather than -N). However, reg_offset instead uses a “right way up” view; that is, it views offsets in address terms. Something above X is at a positive offset from X and something below X is at a negative offset from X. Also, even on FRAME_GROWS_DOWNWARD targets like AArch64, target-independent code views offsets in address terms too: locals are allocated at negative offsets to virtual_stack_vars. It seems confusing to have *_offset fields of the same structure using different polarities like this. This patch tries to avoid that by renaming locals_offset to bytes_above_locals. gcc/ * config/aarch64/aarch64.h (aarch64_frame::locals_offset): Rename to... (aarch64_frame::bytes_above_locals): ...this. * config/aarch64/aarch64.cc (aarch64_layout_frame) (aarch64_initial_elimination_offset): Update accordingly. Diff: --- gcc/config/aarch64/aarch64.cc | 6 +++--- gcc/config/aarch64/aarch64.h | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc index 0e9b9717c085..0a22f91520e5 100644 --- a/gcc/config/aarch64/aarch64.cc +++ b/gcc/config/aarch64/aarch64.cc @@ -8598,7 +8598,7 @@ aarch64_layout_frame (void) STACK_BOUNDARY / BITS_PER_UNIT)); frame.frame_size = saved_regs_and_above + frame.bytes_below_saved_regs; - frame.locals_offset = frame.saved_varargs_size; + frame.bytes_above_locals = frame.saved_varargs_size; frame.initial_adjust = 0; frame.final_adjust = 0; @@ -12754,13 +12754,13 @@ aarch64_initial_elimination_offset (unsigned from, unsigned to) return frame.hard_fp_offset; if (from == FRAME_POINTER_REGNUM) - return frame.hard_fp_offset - frame.locals_offset; + return frame.hard_fp_offset - frame.bytes_above_locals; } if (to == STACK_POINTER_REGNUM) { if (from == FRAME_POINTER_REGNUM) - return frame.frame_size - frame.locals_offset; + return frame.frame_size - frame.bytes_above_locals; } return frame.frame_size; diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h index fd820b1be4eb..7ae12d13e2b4 100644 --- a/gcc/config/aarch64/aarch64.h +++ b/gcc/config/aarch64/aarch64.h @@ -791,10 +791,10 @@ struct GTY (()) aarch64_frame always a multiple of STACK_BOUNDARY. */ poly_int64 bytes_below_hard_fp; - /* Offset from the base of the frame (incomming SP) to the - top of the locals area. This value is always a multiple of + /* The number of bytes between the top of the locals area and the top + of the frame (the incomming SP). This value is always a multiple of STACK_BOUNDARY. */ - poly_int64 locals_offset; + poly_int64 bytes_above_locals; /* Offset from the base of the frame (incomming SP) to the hard_frame_pointer. This value is always a multiple of