From patchwork Tue Sep 12 15:25:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 138259 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9ecd:0:b0:3f2:4152:657d with SMTP id t13csp489661vqx; Tue, 12 Sep 2023 08:32:26 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGsDufnDOOI1AnsP8D9tOyfIYb8p5pnBFWxKY90YOfChcnmKiRbAuS+Rk9QpQbYTS9Vjjkd X-Received: by 2002:a5d:494f:0:b0:319:7b57:8dc5 with SMTP id r15-20020a5d494f000000b003197b578dc5mr10045241wrs.54.1694532746159; Tue, 12 Sep 2023 08:32:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694532746; cv=none; d=google.com; s=arc-20160816; b=p7HxbkbIsDo1MCfs8YlvLU8pkv5IbzQ/NswcwoYxWKTT2oDz0AiWZ26LC7xnyVN9XV hL5FEtczFfsXIWVfxb1PFlUSG4KVjXjUklpuDE19Z8wloQWAooVFvgKt2n/AhZ2Wrd6u CiW6hJwQUw01pSJt0eGWakgV3rh0Om6MJoe81Ub2tl3NyB8jValuRvbSku1w5MGR7Sdl hvB/pftGvSf1B2aIZjIapcdn+vmJSUAAKLXZWjTQZC2GhbfAKueWurTXMG04g2ZjR0WJ oLdKbCJhkHmrbp4/bJvbAloxUXVv984SIw7h4Yge+rHYomIhpiMLUR2KsPPW3fCt8TzS OZYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:dmarc-filter:delivered-to :dkim-signature:dkim-filter; bh=X0x7bc3sfjfINmYwwaqyeE6fyGV4KyCMRhl+A5cAOFU=; fh=C4nEn4uRKApr1WsFtLyJD8L5BeRuRc+JFyqoopFjd9M=; b=mGzSRT1H6tQ46eYukxbEwo/rPs7elZjGz4BlVP0RIGWvxNlKsINBAk06QefPblBL0i abifc/vBBoHqWHo2c+mXbwbproIqwVrr2wW5MLKJ6whuoOwSeCzzwQFNYZQOWEyS5H9J d14bbZuKaG9fKmU6B++JHrSw7iPGYQFtQ6DkJb1xJyWpM3JjhngvFG7X9i89jHOloOMb dpfjk293GqUzdxMWcUoKQvq5pxsEvo0VwHMgI2g0qWIcO1nEZsttT3wML5zuR7mxc3qb ZRL+Ou5638PID3Y71qAe3BqI0xtvTnVLLH45l7++rfQZehOIl1KXbpzkVaR7gNyu3MbL 1ZFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b="TMD7t6f/"; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id n14-20020a056402060e00b0052569fa02b4si9329433edv.400.2023.09.12.08.32.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Sep 2023 08:32:26 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b="TMD7t6f/"; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 25FC8389EC59 for ; Tue, 12 Sep 2023 15:28:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 25FC8389EC59 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1694532492; bh=X0x7bc3sfjfINmYwwaqyeE6fyGV4KyCMRhl+A5cAOFU=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=TMD7t6f/3JlK/Iy+qsUG0hljRFBzuDCMjlcEOUCyJ/YQetHE1glxztlMmrSIx1dUQ cJs1+ECUouYCj4HDYGzNAsmF0TZfF1n+M0wjeK71wA+UKLx7YtPt//BOtKJr5lnQW+ 5fvdqtqGn2IgDxC72ih0mi/yrWc9GJ8beusHkvW0= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by sourceware.org (Postfix) with ESMTP id EF3F8385C6DB for ; Tue, 12 Sep 2023 15:25:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EF3F8385C6DB Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C949FC15; Tue, 12 Sep 2023 08:26:21 -0700 (PDT) Received: from e121540-lin.manchester.arm.com (e121540-lin.manchester.arm.com [10.32.110.72]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 2B3B13F738; Tue, 12 Sep 2023 08:25:44 -0700 (PDT) To: gcc-patches@gcc.gnu.org Cc: Richard Sandiford Subject: [PATCH 09/19] aarch64: Rename hard_fp_offset to bytes_above_hard_fp Date: Tue, 12 Sep 2023 16:25:19 +0100 Message-Id: <20230912152529.3322336-10-richard.sandiford@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230912152529.3322336-1-richard.sandiford@arm.com> References: <20230912152529.3322336-1-richard.sandiford@arm.com> MIME-Version: 1.0 X-Spam-Status: No, score=-25.2 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_NONE, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Richard Sandiford via Gcc-patches From: Richard Sandiford Reply-To: Richard Sandiford Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1776846368609262505 X-GMAIL-MSGID: 1776846368609262505 Similarly to the previous locals_offset patch, hard_fp_offset was described as: /* Offset from the base of the frame (incomming SP) to the hard_frame_pointer. This value is always a multiple of STACK_BOUNDARY. */ poly_int64 hard_fp_offset; which again took an “upside-down” view: higher offsets meant lower addresses. This patch renames the field to bytes_above_hard_fp instead. gcc/ * config/aarch64/aarch64.h (aarch64_frame::hard_fp_offset): Rename to... (aarch64_frame::bytes_above_hard_fp): ...this. * config/aarch64/aarch64.cc (aarch64_layout_frame) (aarch64_expand_prologue): Update accordingly. (aarch64_initial_elimination_offset): Likewise. --- gcc/config/aarch64/aarch64.cc | 26 +++++++++++++------------- gcc/config/aarch64/aarch64.h | 6 +++--- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc index bcd1dec6f51..7d642d06871 100644 --- a/gcc/config/aarch64/aarch64.cc +++ b/gcc/config/aarch64/aarch64.cc @@ -8629,7 +8629,7 @@ aarch64_layout_frame (void) + get_frame_size (), STACK_BOUNDARY / BITS_PER_UNIT); - frame.hard_fp_offset + frame.bytes_above_hard_fp = saved_regs_and_above - frame.below_hard_fp_saved_regs_size; /* Both these values are already aligned. */ @@ -8678,13 +8678,13 @@ aarch64_layout_frame (void) else if (frame.wb_pop_candidate1 != INVALID_REGNUM) max_push_offset = 256; - HOST_WIDE_INT const_size, const_below_saved_regs, const_fp_offset; + HOST_WIDE_INT const_size, const_below_saved_regs, const_above_fp; HOST_WIDE_INT const_saved_regs_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)) + && known_eq (frame.bytes_above_hard_fp, const_size)) { /* Simple, small frame with no data below the saved registers. @@ -8701,8 +8701,8 @@ aarch64_layout_frame (void) case that it hardly seems worth the effort though. */ && (!saves_below_hard_fp_p || const_below_saved_regs == 0) && !(cfun->calls_alloca - && frame.hard_fp_offset.is_constant (&const_fp_offset) - && const_fp_offset < max_push_offset)) + && frame.bytes_above_hard_fp.is_constant (&const_above_fp) + && const_above_fp < max_push_offset)) { /* Frame with small area below the saved registers: @@ -8720,12 +8720,12 @@ aarch64_layout_frame (void) sub sp, sp, hard_fp_offset + below_hard_fp_saved_regs_size save SVE registers relative to SP sub sp, sp, bytes_below_saved_regs */ - frame.initial_adjust = (frame.hard_fp_offset + frame.initial_adjust = (frame.bytes_above_hard_fp + frame.below_hard_fp_saved_regs_size); frame.final_adjust = frame.bytes_below_saved_regs; } - else if (frame.hard_fp_offset.is_constant (&const_fp_offset) - && const_fp_offset < max_push_offset) + else if (frame.bytes_above_hard_fp.is_constant (&const_above_fp) + && const_above_fp < max_push_offset) { /* Frame with large area below the saved registers, or with SVE saves, but with a small area above: @@ -8735,7 +8735,7 @@ aarch64_layout_frame (void) [sub sp, sp, below_hard_fp_saved_regs_size] [save SVE registers relative to SP] sub sp, sp, bytes_below_saved_regs */ - frame.callee_adjust = const_fp_offset; + frame.callee_adjust = const_above_fp; frame.sve_callee_adjust = frame.below_hard_fp_saved_regs_size; frame.final_adjust = frame.bytes_below_saved_regs; } @@ -8750,7 +8750,7 @@ aarch64_layout_frame (void) [sub sp, sp, below_hard_fp_saved_regs_size] [save SVE registers relative to SP] sub sp, sp, bytes_below_saved_regs */ - frame.initial_adjust = frame.hard_fp_offset; + frame.initial_adjust = frame.bytes_above_hard_fp; frame.sve_callee_adjust = frame.below_hard_fp_saved_regs_size; frame.final_adjust = frame.bytes_below_saved_regs; } @@ -10118,7 +10118,7 @@ aarch64_expand_prologue (void) { /* The offset of the frame chain record (if any) from the current SP. */ poly_int64 chain_offset = (initial_adjust + callee_adjust - - frame.hard_fp_offset); + - frame.bytes_above_hard_fp); gcc_assert (known_ge (chain_offset, 0)); if (callee_adjust == 0) @@ -12851,10 +12851,10 @@ aarch64_initial_elimination_offset (unsigned from, unsigned to) if (to == HARD_FRAME_POINTER_REGNUM) { if (from == ARG_POINTER_REGNUM) - return frame.hard_fp_offset; + return frame.bytes_above_hard_fp; if (from == FRAME_POINTER_REGNUM) - return frame.hard_fp_offset - frame.bytes_above_locals; + return frame.bytes_above_hard_fp - frame.bytes_above_locals; } if (to == STACK_POINTER_REGNUM) diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h index 3382f819e72..4a4de9c044e 100644 --- a/gcc/config/aarch64/aarch64.h +++ b/gcc/config/aarch64/aarch64.h @@ -795,10 +795,10 @@ struct GTY (()) aarch64_frame STACK_BOUNDARY. */ 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 + /* The number of bytes between the hard_frame_pointer and the top of + the frame (the incomming SP). This value is always a multiple of STACK_BOUNDARY. */ - poly_int64 hard_fp_offset; + poly_int64 bytes_above_hard_fp; /* The size of the frame. This value is the offset from base of the frame (incomming SP) to the stack_pointer. This value is always