From patchwork Wed Mar 15 07:51:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yoshinori Sato X-Patchwork-Id: 70062 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2191300wrd; Wed, 15 Mar 2023 00:51:46 -0700 (PDT) X-Google-Smtp-Source: AK7set8w5GmuePdK/LlmsmEqYwLCtAZ6iQlMay4xuUvcodjeWtJZ1V1vvKu/mcP+b36SwC89qiZt X-Received: by 2002:aa7:c750:0:b0:4aa:a280:55b5 with SMTP id c16-20020aa7c750000000b004aaa28055b5mr1663772eds.20.1678866705931; Wed, 15 Mar 2023 00:51:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1678866705; cv=none; d=google.com; s=arc-20160816; b=QbUtSjmBocsY/7Xs5350ZYynvyVT8x2BlZLuKJhF0sL5zfmL32XAIIp+n0MtbOlchX obdEVB5SwHVld9guZ3BSHY+1B5sW5mEKI1rH/SukrHgadKwu7yG3ZEoXBX+TkYhSZyz9 +7VDztQ3UL7x31Eq8s9qiY0JSWs3s2fMxeEPChF6xky+g7q/OHzVcKlLu2aUG2EzSzPD LjdgX5LWaMmDuId8Pf5enUskpAWkMw7jt0ffE3UyjdFKB6zH6feBNuKCGfIxuvRwMjfA 1NVRT6EyZIrD1Zhr+Tt4ty9fKBBW67H8yrBsug5sLuMHIp6qcFrJR6gmC0yxxjX/NhA4 /P3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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 :from:dmarc-filter:delivered-to; bh=/kKKn4lktR+rHUwtPPFwoRTKwgB8EeX/kXdp0oBUOtk=; b=R2mjjsdIjgK4ju94UuTlUSoFaNBvhPgGhDydDEk0/5gtGxVU9cfke+wczV0k0ByP+K jO3Bk2BvDdqXRJcIBL86k1mMjidC++AOGFD56Cj3hB0TSYF+iRVE6sR22Rlu9M/fXll2 BBIE5DiEeGKFMDzreZqxr+oXFnFmsp9rP+4gH5044MwFndVO0eRg/H5tm9Cxv92sk6Ue c8Fo1/VbOggAfDPWUeMJ98nrRNl6FKiopgzhApfwuiCWeF9XW7CU0RoRdvliwlV60WZR IbG/BH5OpmRxA+LnNpK8nYAfhZGqO93oz3guBPyxJ9BubXY0JiFPSxkX/annpfCMzDTL 55jA== ARC-Authentication-Results: i=1; mx.google.com; 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" Received: from sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id m15-20020aa7d34f000000b004fd26753f3esi5219871edr.129.2023.03.15.00.51.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Mar 2023 00:51:45 -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; 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" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 92B313858433 for ; Wed, 15 Mar 2023 07:51:41 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from hsmtpd-def.xspmail.jp (hsmtpd-def.xspmail.jp [202.238.198.237]) by sourceware.org (Postfix) with ESMTPS id 400893858D20 for ; Wed, 15 Mar 2023 07:51:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 400893858D20 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=users.sourceforge.jp Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=users.sourceforge.jp X-Country-Code: JP Received: from sakura.ysato.name (ik1-413-38519.vs.sakura.ne.jp [153.127.30.23]) by hsmtpd-out-1.asahinet.cluster.xspmail.jp (Halon) with ESMTPA id d2997850-4fe9-41c5-8d08-2e2529cc7981; Wed, 15 Mar 2023 16:51:13 +0900 (JST) Received: from SIOS1075.flets-east.jp (al130018.dynamic.ppp.asahi-net.or.jp [111.234.130.18]) by sakura.ysato.name (Postfix) with ESMTPSA id 820A31C0422; Wed, 15 Mar 2023 16:51:12 +0900 (JST) From: Yoshinori Sato To: gcc-patches@gcc.gnu.org Cc: Yoshinori Sato Subject: [PATCH v2] PR target/89828 Inernal compiler error on -fno-omit-frame-pointer Date: Wed, 15 Mar 2023 16:51:03 +0900 Message-Id: <20230315075103.1039307-1-ysato@users.sourceforge.jp> X-Mailer: git-send-email 2.30.2 In-Reply-To: <7e49f36f-73d6-bf9b-fe83-b36474e09ae2@gmail.com> References: <7e49f36f-73d6-bf9b-fe83-b36474e09ae2@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-14.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_SOFTFAIL, 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.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754187960784003081?= X-GMAIL-MSGID: =?utf-8?q?1760419334589671121?= What about this? It no longer occurs for me. gcc/config/rx/ * rx.cc (add_pop_cfi_notes): Release the frame pointer if it is used. (rx_expand_prologue): Redesigned stack pointer and frame pointer update process. Signed-off-by: Yoshinori Sato --- gcc/config/rx/rx.cc | 50 +++++++++++++++------------------------------ 1 file changed, 17 insertions(+), 33 deletions(-) diff --git a/gcc/config/rx/rx.cc b/gcc/config/rx/rx.cc index 412a3a354b0..51ef4a6be34 100644 --- a/gcc/config/rx/rx.cc +++ b/gcc/config/rx/rx.cc @@ -1647,16 +1647,20 @@ mark_frame_related (rtx insn) static void add_pop_cfi_notes (rtx_insn *insn, unsigned int high, unsigned int low) { - rtx t = plus_constant (Pmode, stack_pointer_rtx, - (high - low + 1) * UNITS_PER_WORD); + rtx src = stack_pointer_rtx; + rtx t; + for (unsigned int i = low; i <= high; i++) + { + add_reg_note (insn, REG_CFA_RESTORE, gen_rtx_REG (word_mode, i)); + if (i == FRAME_POINTER_REGNUM && frame_pointer_needed) + src = frame_pointer_rtx; + } + t = plus_constant (Pmode, src, (high - low + 1) * UNITS_PER_WORD); t = gen_rtx_SET (stack_pointer_rtx, t); add_reg_note (insn, REG_CFA_ADJUST_CFA, t); RTX_FRAME_RELATED_P (insn) = 1; - for (unsigned int i = low; i <= high; i++) - add_reg_note (insn, REG_CFA_RESTORE, gen_rtx_REG (word_mode, i)); } - static bool ok_for_max_constant (HOST_WIDE_INT val) { @@ -1815,37 +1819,17 @@ rx_expand_prologue (void) } } - /* If needed, set up the frame pointer. */ - if (frame_pointer_needed) - gen_safe_add (frame_pointer_rtx, stack_pointer_rtx, - GEN_INT (- (HOST_WIDE_INT) frame_size), true); - - /* Allocate space for the outgoing args. - If the stack frame has not already been set up then handle this as well. */ - if (stack_size) + if (stack_size || frame_size) { - if (frame_size) - { - if (frame_pointer_needed) - gen_safe_add (stack_pointer_rtx, frame_pointer_rtx, - GEN_INT (- (HOST_WIDE_INT) stack_size), true); - else - gen_safe_add (stack_pointer_rtx, stack_pointer_rtx, - GEN_INT (- (HOST_WIDE_INT) (frame_size + stack_size)), - true); - } - else - gen_safe_add (stack_pointer_rtx, stack_pointer_rtx, - GEN_INT (- (HOST_WIDE_INT) stack_size), true); + gen_safe_add (stack_pointer_rtx, stack_pointer_rtx, + GEN_INT (- (HOST_WIDE_INT) (stack_size + frame_size)), + true); } - else if (frame_size) + if (frame_pointer_needed) { - if (! frame_pointer_needed) - gen_safe_add (stack_pointer_rtx, stack_pointer_rtx, - GEN_INT (- (HOST_WIDE_INT) frame_size), true); - else - gen_safe_add (stack_pointer_rtx, frame_pointer_rtx, NULL_RTX, - false /* False because the epilogue will use the FP not the SP. */); + gen_safe_add (frame_pointer_rtx, stack_pointer_rtx, + GEN_INT ((HOST_WIDE_INT) stack_size), + true); } }