]> git.ipfire.org Git - thirdparty/gcc.git/commit
riscv: Refactor riscv target parsing to take string_slice.
authorAlfie Richards <alfie.richards@arm.com>
Mon, 24 Mar 2025 11:45:32 +0000 (11:45 +0000)
committerAlfie Richards <alfie.richards@arm.com>
Tue, 23 Sep 2025 09:47:43 +0000 (09:47 +0000)
commit2564e45b3bd3391ebca0be24866f01001480c0ff
treee0a23b51c92fb8f6c7372e16ce0fb2a18148b884
parentb500cd2634f3b8942eb06ba4af1847afd572e020
riscv: Refactor riscv target parsing to take string_slice.

This is a quick refactor of the riscv target processing code
to take a string_slice rather than a decl.

The reason for this is to enable it to work with target_clones
where merging logic requires reasoning about each version string
individually in the front end.

This refactor primarily serves just to get this working. Ideally the
logic here would be further refactored as currently there is no way to
check if a parse fails or not without emitting an error.
This makes things difficult for later patches which intends to emit a
warning and ignoring unrecognised/not parsed target_clone values rather
than erroring which can't currently be achieved with the current riscv
code.

gcc/ChangeLog:

* config/riscv/riscv-protos.h (riscv_process_target_version_str): New function..
* config/riscv/riscv-target-attr.cc (riscv_process_target_attr): Refactor to take
string_slice.
(riscv_process_target_version_str): New function.
* config/riscv/riscv.cc (parse_features_for_version): Refactor to take
string_slice.
(riscv_compare_version_priority): Ditto.
(dispatch_function_versions): Change to pass location.
gcc/config/riscv/riscv-protos.h
gcc/config/riscv/riscv-target-attr.cc
gcc/config/riscv/riscv.cc