From patchwork Mon Jan 8 13:47:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kito Cheng X-Patchwork-Id: 1883692 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=sifive.com header.i=@sifive.com header.a=rsa-sha256 header.s=google header.b=aVcCtW5M; dkim-atps=neutral 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 4T7wQp289Bz1yP3 for ; Tue, 9 Jan 2024 00:49:22 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 43CEA385AC33 for ; Mon, 8 Jan 2024 13:49:20 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pf1-x436.google.com (mail-pf1-x436.google.com [IPv6:2607:f8b0:4864:20::436]) by sourceware.org (Postfix) with ESMTPS id 5394D38582AD for ; Mon, 8 Jan 2024 13:48:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5394D38582AD Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=sifive.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=sifive.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 5394D38582AD Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::436 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704721683; cv=none; b=ROEfJCzdjv4YJk2H5Dx4SPRSSm+Q0/ByNYBj0mWLXgca/bCr5FcIMe1rCWZKTZsjkN8e41VPughPv2b/b++Y/63CwZ1Clz/luVTfBTg+hcg412quc4adJvg5zgkIL/cu+ozROlN+gCT3/ItV9pL3etd61eP9UxKFk4734eslJRI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704721683; c=relaxed/simple; bh=Tz2aaM4jUsY/4p2m3Xr2inMf1CleJ0Wv2hFlLQjFcq0=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=S/5vM284N2OkWpCRGUwm7J9LiT3hHzbpw3STOUvxe85WgY0PT8GW7wuPtmVBG/9jsZzwnvWdozLPsnY6d8C1vruAMQqcK/kpcXK/paeoVxlWmvGeUaCX4patQ7hupzt34ObWDAzRQ4zCgEWnpjww96quZuMhh+kCzXGVkhoicqc= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pf1-x436.google.com with SMTP id d2e1a72fcca58-6d9b1589a75so493084b3a.3 for ; Mon, 08 Jan 2024 05:48:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1704721679; x=1705326479; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Rt7HzghrshgjW161HpW6l1W9rlKbGCI2omGm/vfGnvA=; b=aVcCtW5MdeZViyTFgOF18LUkqZHAi8JfcFUHwauVaGguwsKoEwI+gbd8CB5xGaFGR+ 9F1FVPQ2xhjz6TTqoiX8TnkqKkP4BaMt7OrTT5Sn19FB7oJz2QobniVXx0OYqFjjkHxC SsyQ3SqdN68yy6nDWlRBZHLcWw6BkhFnHHJ3M4PgKCOiIeVSuf0UCyfT9Zr8ntFKa/64 pGYj0HreMbsSZRpCre+q+JIObEhJ/R6v/0e9Lt8mEICp42uW/Saa3axGWknNoGUdTbRo 36vYxFLGFYoka2uN7dLXGjxW3TxAYR8EhOu0fNYBNnZ8SaD2k2mHd3zYBrqiUEge7bqQ HxYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704721679; x=1705326479; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Rt7HzghrshgjW161HpW6l1W9rlKbGCI2omGm/vfGnvA=; b=K98fmF4Kbv44CTYM3vfTFjbi3FNAJZxYkMCPjNdl5lCFjNQcYzUSmkpluLsW8HnBB7 TDuYq+rFbRITp9zI2Q+rMMgtvlZRKwe4p05n9hrsibCqPZCp78ZEzzd9jE0Cz7C+wEUy m/x9FgWONyrkOeNF76X0nAZ8EohaSBLhiRuFl4aqiVJ2/rrVwpCiPmgZbyy2TESERB8h 0bcA4EA2Ev+Rdnu/wiqzuFvSqWYRBccX1tPRaMC3R1sbKThK4yIpC4tJYVGsAWJh4Oaf z+P2lo9Pdt4T4+qepUG5nuZ6QJhfSNMUb2ioU59VCFIontSsf/h8/CxZtm0zK6rLoXJB vRIA== X-Gm-Message-State: AOJu0YydjFKe6ICvEUmNVvt0Dnp2blRdytfE2Yg+oTQNpXr3xYBey2jD A2o16NvLSxbdu71GMCAvX8j5SNQ2g/aX+OtPlmyk7mE+OuuGzSQwrU31YpLohNYiAcSQUb0iUrg ucEvJmlEO76sKdLwsyw+qOzk8C0iE0sz0zwd07BT3iKKZcDJCDfP0TImAPI7gfMb4DNbWlJpCBl PdOAy8CmgCF+0= X-Google-Smtp-Source: AGHT+IFit2rXCfngkpU4aDA/XZzcIIkoj42qEKQiZPHeU2Bm/SHoPGxxtbVQn8sZFVocyjp2Lw6DXA== X-Received: by 2002:a17:902:e845:b0:1d4:e203:3781 with SMTP id t5-20020a170902e84500b001d4e2033781mr1692783plg.101.1704721678725; Mon, 08 Jan 2024 05:47:58 -0800 (PST) Received: from hsinchu18.internal.sifive.com (59-124-168-89.hinet-ip.hinet.net. [59.124.168.89]) by smtp.gmail.com with ESMTPSA id jc20-20020a17090325d400b001d403969b65sm4588056plb.187.2024.01.08.05.47.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jan 2024 05:47:58 -0800 (PST) From: Kito Cheng To: gcc-patches@gcc.gnu.org, kito.cheng@gmail.com, jim.wilson.gcc@gmail.com, palmer@dabbelt.com, andrew@sifive.com, jeffreyalaw@gmail.com, christoph.muellner@vrull.eu Cc: Kito Cheng Subject: [PATCH 3/5] RISC-V: Remove unused function in riscv_subset_list [NFC] Date: Mon, 8 Jan 2024 21:47:36 +0800 Message-Id: <20240108134738.998804-4-kito.cheng@sifive.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240108134738.998804-1-kito.cheng@sifive.com> References: <20240108134738.998804-1-kito.cheng@sifive.com> MIME-Version: 1.0 X-Spam-Status: No, score=-12.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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 gcc/ChangeLog: * common/config/riscv/riscv-common.cc (riscv_subset_list::parse_std_ext): Remove. (riscv_subset_list::parse_multiletter_ext): Remove. * config/riscv/riscv-subset.h (riscv_subset_list::parse_std_ext): Remove. (riscv_subset_list::parse_multiletter_ext): Remove. --- gcc/common/config/riscv/riscv-common.cc | 179 ------------------------ gcc/config/riscv/riscv-subset.h | 4 - 2 files changed, 183 deletions(-) diff --git a/gcc/common/config/riscv/riscv-common.cc b/gcc/common/config/riscv/riscv-common.cc index 891ecfce464..cf1c82c9f5e 100644 --- a/gcc/common/config/riscv/riscv-common.cc +++ b/gcc/common/config/riscv/riscv-common.cc @@ -1059,73 +1059,6 @@ riscv_subset_list::parse_base_ext (const char *p) return p; } - -/* Parsing function for standard extensions. - - Return Value: - Points to the end of extensions. - - Arguments: - `p`: Current parsing position. */ - -const char * -riscv_subset_list::parse_std_ext (const char *p) -{ - const char *all_std_exts = riscv_supported_std_ext (); - const char *std_exts = all_std_exts; - - unsigned major_version = 0; - unsigned minor_version = 0; - char std_ext = '\0'; - bool explicit_version_p = false; - - while (p != NULL && *p) - { - char subset[2] = {0, 0}; - - if (*p == 'x' || *p == 's' || *p == 'z') - break; - - if (*p == '_') - { - p++; - continue; - } - - std_ext = *p; - - /* Checking canonical order. */ - const char *prior_std_exts = std_exts; - - while (*std_exts && std_ext != *std_exts) - std_exts++; - - subset[0] = std_ext; - if (std_ext != *std_exts && standard_extensions_p (subset)) - { - error_at (m_loc, - "%<-march=%s%>: ISA string is not in canonical order. " - "%<%c%>", - m_arch, *p); - /* Extension ordering is invalid. Ignore this extension and keep - searching for other issues with remaining extensions. */ - std_exts = prior_std_exts; - p++; - continue; - } - - std_exts++; - - p++; - - p = parsing_subset_version (subset, p, &major_version, &minor_version, - /* std_ext_p= */ true, &explicit_version_p); - - add (subset, major_version, minor_version, explicit_version_p, false); - } - return p; -} - /* Parsing function for one standard extensions. Return Value: @@ -1409,118 +1342,6 @@ riscv_subset_list::parse_single_multiletter_ext (const char *p, } -/* Parsing function for multi-letter extensions. - - Return Value: - Points to the end of extensions. - - Arguments: - `p`: Current parsing position. - `ext_type`: What kind of extensions, 's', 'z' or 'x'. - `ext_type_str`: Full name for kind of extension. */ - -const char * -riscv_subset_list::parse_multiletter_ext (const char *p, - const char *ext_type, - const char *ext_type_str) -{ - unsigned major_version = 0; - unsigned minor_version = 0; - size_t ext_type_len = strlen (ext_type); - - while (*p) - { - if (*p == '_') - { - p++; - continue; - } - - if (strncmp (p, ext_type, ext_type_len) != 0) - break; - - char *subset = xstrdup (p); - char *q = subset; - const char *end_of_version; - bool explicit_version_p = false; - char *ext; - char backup; - size_t len; - size_t end_of_version_pos, i; - bool found_any_number = false; - bool found_minor_version = false; - - /* Parse until end of this extension including version number. */ - while (*++q != '\0' && *q != '_') - ; - - backup = *q; - *q = '\0'; - len = q - subset; - *q = backup; - - end_of_version_pos = len; - /* Find the begin of version string. */ - for (i = len -1; i > 0; --i) - { - if (ISDIGIT (subset[i])) - { - found_any_number = true; - continue; - } - /* Might be version seperator, but need to check one more char, - we only allow p, so we could stop parsing if found - any more `p`. */ - if (subset[i] == 'p' && - !found_minor_version && - found_any_number && ISDIGIT (subset[i-1])) - { - found_minor_version = true; - continue; - } - - end_of_version_pos = i + 1; - break; - } - - backup = subset[end_of_version_pos]; - subset[end_of_version_pos] = '\0'; - ext = xstrdup (subset); - subset[end_of_version_pos] = backup; - - end_of_version - = parsing_subset_version (ext, subset + end_of_version_pos, &major_version, &minor_version, - /* std_ext_p= */ false, &explicit_version_p); - free (ext); - - if (end_of_version == NULL) - return NULL; - - subset[end_of_version_pos] = '\0'; - - if (strlen (subset) == 1) - { - error_at (m_loc, "%<-march=%s%>: name of %s must be more than 1 letter", - m_arch, ext_type_str); - free (subset); - return NULL; - } - - add (subset, major_version, minor_version, explicit_version_p, false); - p += end_of_version - subset; - free (subset); - - if (*p != '\0' && *p != '_') - { - error_at (m_loc, "%<-march=%s%>: %s must separate with %<_%>", - m_arch, ext_type_str); - return NULL; - } - } - - return p; -} - /* Parsing function for a single-letter or multi-letter extensions. Return Value: diff --git a/gcc/config/riscv/riscv-subset.h b/gcc/config/riscv/riscv-subset.h index a80f9138e5c..ae849e2a302 100644 --- a/gcc/config/riscv/riscv-subset.h +++ b/gcc/config/riscv/riscv-subset.h @@ -69,12 +69,8 @@ private: const char *parse_base_ext (const char *); - const char *parse_std_ext (const char *); - const char *parse_single_std_ext (const char *, bool); - const char *parse_multiletter_ext (const char *, const char *, - const char *); const char *parse_single_multiletter_ext (const char *, const char *, const char *, bool);