From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-x631.google.com (mail-pl1-x631.google.com [IPv6:2607:f8b0:4864:20::631]) by sourceware.org (Postfix) with ESMTPS id E67213858D32 for ; Tue, 10 Oct 2023 14:00:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E67213858D32 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pl1-x631.google.com with SMTP id d9443c01a7336-1c0ecb9a075so35766875ad.2 for ; Tue, 10 Oct 2023 07:00:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696946438; x=1697551238; darn=gcc.gnu.org; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=ysSFr4b+3CwjzVgxhQtG0Ua/nUj/ftqiZJoV/m2AeiA=; b=Cj/Eu56gNGfgC6SSbxhFqI7FGY1bGL11nEv5U1IlQzkw4ZbKppGxybhIumykBAPSS5 W1rKF8vte4mTdbsCaXFJ8dV3TFAOnVucOrWNBCbhLa50YGBEfL4G66qrXNaDjTiovWaZ 14ZGb0J9bIUDaTPOy1C2he2mxnYMD+YtcUDpWyYvavn1F5uDotLnAfAjbWrelyCpJwV/ gHbaYD5yEsXRHHyYUiMjXg+3LhtGAWgQ1QpYJKpW/sPIpp3jcxkjb7qwvoyCmd2w0XW0 FCswUxUVn+5DtwIoISmEpRuCc2mv5EWu5Q++h6yPyqjYHhKKjV8DQ0+VVDgzVFcpsgPg K7Xg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696946438; x=1697551238; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ysSFr4b+3CwjzVgxhQtG0Ua/nUj/ftqiZJoV/m2AeiA=; b=A3hsX45ldm56/LaO8FBR7oMavFwiRq/kDBmMooCWJ6dIFHHW+BalsTfkE5irjcjpSy GjIpRlpBwarp1S+HyiROM47kqFo1H5YSitq1i2Uzrmc+U6Bk91Y2CGFGJ3a6dXjVrGvj +F8JepYCF83UJ0D2G6d1L72oMydXdiXQCJkW/i0luETlLFEYgcJQbpDUj+efnaOparY2 dz7949scBQpu/p6ND4RixJln2R3cSG65oHMbhcw0Hp9KPMVbRAwMIO6jGwkWsMpoY22/ zz+OK20OMhlN9dPJSGkbPtqULxUN1fFjhAqSn2dvPOwDr/gIO2ZGm5L3C1bIgzdO6Na4 PkPQ== X-Gm-Message-State: AOJu0YxzW+1dzHXeciJ41UaNWOeqJOWdW0RVKic7o8nyfNkta1Y+oUpe 9CTSwEw2P2CeSQ0km0JpsWo= X-Google-Smtp-Source: AGHT+IFj073k+RX0BgI7+/ycn4AgYyhBp3Kzb0I2OVrOrip5kk82kXga5U0G0OyxbrDFJx90YSSq2g== X-Received: by 2002:a17:902:ecc2:b0:1c7:8678:e4a4 with SMTP id a2-20020a170902ecc200b001c78678e4a4mr17641921plh.66.1696946438279; Tue, 10 Oct 2023 07:00:38 -0700 (PDT) Received: from [172.31.0.109] ([136.36.130.248]) by smtp.gmail.com with ESMTPSA id c8-20020a170903234800b001c32fd9e412sm11754907plh.58.2023.10.10.07.00.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 10 Oct 2023 07:00:37 -0700 (PDT) Message-ID: Date: Tue, 10 Oct 2023 08:00:31 -0600 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 3/4] RISC-V: Extend riscv_subset_list, preparatory for target attribute support Content-Language: en-US To: Kito Cheng , gcc-patches@gcc.gnu.org, kito.cheng@gmail.com, palmer@dabbelt.com, rdapp@ventanamicro.com, juzhe.zhong@rivai.ai References: <20231010041305.9111-1-kito.cheng@sifive.com> <20231010041305.9111-4-kito.cheng@sifive.com> From: Jeff Law In-Reply-To: <20231010041305.9111-4-kito.cheng@sifive.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-8.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,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 List-Id: On 10/9/23 22:13, Kito Cheng wrote: > riscv_subset_list only accept a full arch string before, but we need to > parse single extension when supporting target attribute, also we may set > a riscv_subset_list directly rather than re-parsing the ISA string > again. > > gcc/ChangeLog: > > * config/riscv/riscv-subset.h (riscv_subset_list::parse_single_std_ext): > New. > (riscv_subset_list::parse_single_multiletter_ext): Ditto. > (riscv_subset_list::clone): Ditto. > (riscv_subset_list::parse_single_ext): Ditto. > (riscv_subset_list::set_loc): Ditto. > (riscv_set_arch_by_subset_list): Ditto. > * common/config/riscv/riscv-common.cc > (riscv_subset_list::parse_single_std_ext): New. > (riscv_subset_list::parse_single_multiletter_ext): Ditto. > (riscv_subset_list::clone): Ditto. > (riscv_subset_list::parse_single_ext): Ditto. > (riscv_subset_list::set_loc): Ditto. > (riscv_set_arch_by_subset_list): Ditto. > --- > gcc/common/config/riscv/riscv-common.cc | 203 ++++++++++++++++++++++++ > gcc/config/riscv/riscv-subset.h | 11 ++ > 2 files changed, 214 insertions(+) > > diff --git a/gcc/common/config/riscv/riscv-common.cc b/gcc/common/config/riscv/riscv-common.cc > index 9a0a68fe5db..25630d5923e 100644 > --- a/gcc/common/config/riscv/riscv-common.cc > +++ b/gcc/common/config/riscv/riscv-common.cc > @@ -1138,6 +1173,102 @@ riscv_subset_list::handle_combine_ext () > } > } > > +/* 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_single_multiletter_ext (const char *p, > + const char *ext_type, > + const char *ext_type_str) [ ... ] > + > + if (end_of_version == NULL) > + return NULL; I think when we hit this path we leak SUBSET. > > std::string > @@ -1498,6 +1673,34 @@ static const riscv_ext_flag_table_t riscv_ext_flag_table[] = > {NULL, NULL, 0} > }; > > +void > +riscv_set_arch_by_subset_list (riscv_subset_list *subset_list, > + struct gcc_options *opts) Needs a function comment. OK with those two minor issues fixed. jeff