public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeff Law <jeffreyalaw@gmail.com>
To: Kito Cheng <kito.cheng@sifive.com>,
	gcc-patches@gcc.gnu.org, kito.cheng@gmail.com,
	palmer@dabbelt.com, rdapp@ventanamicro.com, juzhe.zhong@rivai.ai
Subject: Re: [PATCH v2 3/4] RISC-V: Extend riscv_subset_list, preparatory for target attribute support
Date: Tue, 10 Oct 2023 08:00:31 -0600	[thread overview]
Message-ID: <af6d19f8-0d8a-4ac4-9a96-04230f11c98c@gmail.com> (raw)
In-Reply-To: <20231010041305.9111-4-kito.cheng@sifive.com>



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

  reply	other threads:[~2023-10-10 14:00 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-10  4:13 [PATCH v2 0/4] RISC-V target attribute Kito Cheng
2023-10-10  4:13 ` [PATCH v2 1/4] options: Define TARGET_<NAME>_P and TARGET_<NAME>_OPTS_P macro for Mask and InverseMask Kito Cheng
2023-10-10 13:50   ` Jeff Law
2023-10-11 21:20     ` Kito Cheng
2023-10-11 22:49       ` 钟居哲
2023-10-11 22:50         ` Kito Cheng
2023-10-11 23:23           ` Kito Cheng
2023-10-10  4:13 ` [PATCH v2 2/4] RISC-V: Refactor riscv_option_override and riscv_convert_vector_bits. [NFC] Kito Cheng
2023-10-10 13:51   ` Jeff Law
2023-10-11 21:21     ` Kito Cheng
2023-10-10  4:13 ` [PATCH v2 3/4] RISC-V: Extend riscv_subset_list, preparatory for target attribute support Kito Cheng
2023-10-10 14:00   ` Jeff Law [this message]
2023-10-11 21:19     ` Kito Cheng
2023-10-10  4:13 ` [PATCH v2 4/4] RISC-V: Implement target attribute Kito Cheng
2023-10-10 15:24   ` Jeff Law
2023-10-11 21:29     ` Kito Cheng
2023-10-10  9:56 ` [PATCH v2 0/4] RISC-V " juzhe.zhong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=af6d19f8-0d8a-4ac4-9a96-04230f11c98c@gmail.com \
    --to=jeffreyalaw@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=juzhe.zhong@rivai.ai \
    --cc=kito.cheng@gmail.com \
    --cc=kito.cheng@sifive.com \
    --cc=palmer@dabbelt.com \
    --cc=rdapp@ventanamicro.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).