From patchwork Fri Jul 5 09:56:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fei Gao X-Patchwork-Id: 1957264 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WFppb3b24z1xr0 for ; Fri, 5 Jul 2024 19:57:27 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id BC67B38845AA for ; Fri, 5 Jul 2024 09:57:25 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from zg8tmja2lje4os43os4xodqa.icoremail.net (zg8tmja2lje4os43os4xodqa.icoremail.net [206.189.79.184]) by sourceware.org (Postfix) with ESMTP id 91339382E6B3 for ; Fri, 5 Jul 2024 09:57:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 91339382E6B3 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=eswincomputing.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=eswincomputing.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 91339382E6B3 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=206.189.79.184 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1720173426; cv=none; b=Oz/IVfOAyDFpWnaX/gP/o05zbUo8tSC9msyst7jDXaJLlLPBc0FFT6iBExxLf/97k1fOTwUkMjxLUpwsw+mPlzaXcjBuhaOdrvpPTj9kk1L4Wt92qv80OG4glUAiYHB/uEriNO24CKsOUvtAfjfVXRU03HFok1rqaWsFpzs5Y5w= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1720173426; c=relaxed/simple; bh=uFAVDxOlJPwmRuDg3Vr+/F7sCr0w8AyNYhRjMyWOpuI=; h=From:To:Subject:Date:Message-Id; b=Ne/d1Ciw88Vt+j3I27NUIC+XzAjgSw3vmMjHfEM7hT1TLpnvcLziUmfHol3L49ozhriCtirCuHQ6j1ho4NVOXPy//hiZ8u5ezwhfvJElz4vk/LPBEmNK30JRU9CsDF2aI/4SEDfcqizCHEUK6CvByQ5tni1ttSzLqavs1MWZkys= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from localhost.localdomain (unknown [10.12.130.31]) by app1 (Coremail) with SMTP id TAJkCgDniOVhw4dmKjAUAA--.12811S5; Fri, 05 Jul 2024 17:56:59 +0800 (CST) From: Fei Gao To: gcc-patches@gcc.gnu.org Cc: kito.cheng@gmail.com, palmer@dabbelt.com, jeffreyalaw@gmail.com, gaofei@eswincomputing.com Subject: [PATCH 1/2] [RISC-V] add implied extension repeatly until stable Date: Fri, 5 Jul 2024 09:56:30 +0000 Message-Id: <20240705095631.949-2-gaofei@eswincomputing.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240705095631.949-1-gaofei@eswincomputing.com> References: <20240705095631.949-1-gaofei@eswincomputing.com> X-CM-TRANSID: TAJkCgDniOVhw4dmKjAUAA--.12811S5 X-Coremail-Antispam: 1UD129KBjvJXoW7AFWkCr4kAr1Dur15trWxXrb_yoW8Kw18pF 45Jw4YyryrtFsFgrnxt3WUW345tanagr43tw4jk34qyrs8XayFyF1Dt34S9rn8XF4kurnr CF1fCrWYvw4UC37anT9S1TB71UUUUUUqnTZG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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: , Errors-To: gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org Call handle_implied_ext repeatly until there's no new subset added into the subset list. gcc/ChangeLog: * common/config/riscv/riscv-common.cc (riscv_subset_list::riscv_subset_list): init m_subset_num to 0. (riscv_subset_list::add): increase m_subset_num once a subset added. (riscv_subset_list::finalize): call handle_implied_ext repeatly until no change in m_subset_num. * config/riscv/riscv-subset.h: add m_subset_num member. Signed-off-by: Fei Gao --- gcc/common/config/riscv/riscv-common.cc | 14 +++++++++++--- gcc/config/riscv/riscv-subset.h | 3 +++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/gcc/common/config/riscv/riscv-common.cc b/gcc/common/config/riscv/riscv-common.cc index 410e673f5e0..cad3551feb6 100644 --- a/gcc/common/config/riscv/riscv-common.cc +++ b/gcc/common/config/riscv/riscv-common.cc @@ -566,7 +566,8 @@ riscv_subset_t::riscv_subset_t () } riscv_subset_list::riscv_subset_list (const char *arch, location_t loc) - : m_arch (arch), m_loc (loc), m_head (NULL), m_tail (NULL), m_xlen (0) + : m_arch (arch), m_loc (loc), m_head (NULL), m_tail (NULL), m_xlen (0), + m_subset_num (0) { } @@ -812,6 +813,7 @@ riscv_subset_list::add (const char *subset, int major_version, return; } + m_subset_num++; riscv_subset_t *s = new riscv_subset_t (); riscv_subset_t *itr; @@ -1586,9 +1588,15 @@ void riscv_subset_list::finalize () { riscv_subset_t *subset; + unsigned pre_subset_num; - for (subset = m_head; subset != NULL; subset = subset->next) - handle_implied_ext (subset->name.c_str ()); + do + { + pre_subset_num = m_subset_num; + for (subset = m_head; subset != NULL; subset = subset->next) + handle_implied_ext (subset->name.c_str ()); + } + while (pre_subset_num != m_subset_num); gcc_assert (check_implied_ext ()); diff --git a/gcc/config/riscv/riscv-subset.h b/gcc/config/riscv/riscv-subset.h index fe7f54d8bc5..7dc196a2007 100644 --- a/gcc/config/riscv/riscv-subset.h +++ b/gcc/config/riscv/riscv-subset.h @@ -62,6 +62,9 @@ private: /* X-len of m_arch. */ unsigned m_xlen; + /* Number of subsets. */ + unsigned m_subset_num; + riscv_subset_list (const char *, location_t); const char *parsing_subset_version (const char *, const char *, unsigned *,