]> git.ipfire.org Git - thirdparty/gcc.git/commit
RISC-V: Implement TARGET_GENERATE_VERSION_DISPATCHER_BODY and TARGET_GET_FUNCTION_VER...
authorYangyu Chen <cyy@cyyself.name>
Tue, 5 Nov 2024 03:23:07 +0000 (11:23 +0800)
committerKito Cheng <kito.cheng@sifive.com>
Wed, 13 Nov 2024 09:01:42 +0000 (17:01 +0800)
commit917d03e4f366f7738684bed2eae02482b535b7fc
tree37a62817c89b2a623d2364808a885d74313b8825
parent0c77c4b082bf110fd2fc9c800268ac58fa579d06
RISC-V: Implement TARGET_GENERATE_VERSION_DISPATCHER_BODY and TARGET_GET_FUNCTION_VERSIONS_DISPATCHER

This patch implements the TARGET_GENERATE_VERSION_DISPATCHER_BODY and
TARGET_GET_FUNCTION_VERSIONS_DISPATCHER for RISC-V. This is used to
generate the dispatcher function and get the dispatcher function for
function multiversioning.

This patch copies many codes from commit 0cfde688e213 ("[aarch64]
Add function multiversioning support") and modifies them to fit the
RISC-V port. A key difference is the data structure of feature bits in
RISC-V C-API is a array of unsigned long long, while in AArch64 is not
a array. So we need to generate the array reference for each feature
bits element in the dispatcher function.

Signed-off-by: Yangyu Chen <cyy@cyyself.name>
gcc/ChangeLog:

* config/riscv/riscv.cc (add_condition_to_bb): New function.
(dispatch_function_versions): New function.
(get_suffixed_assembler_name): New function.
(make_resolver_func): New function.
(riscv_generate_version_dispatcher_body): New function.
(riscv_get_function_versions_dispatcher): New function.
(TARGET_GENERATE_VERSION_DISPATCHER_BODY): Implement it.
(TARGET_GET_FUNCTION_VERSIONS_DISPATCHER): Implement it.
gcc/config/riscv/riscv.cc