mirror of
https://gcc.gnu.org/git/gcc.git
synced 2024-11-23 19:03:59 +08:00
0cfde688e2
This adds initial support for function multiversioning on aarch64 using the target_version and target_clones attributes. This loosely follows the Beta specification in the ACLE [1], although with some differences that still need to be resolved (possibly as follow-up patches). Existing function multiversioning implementations are broken in various ways when used across translation units. This includes placing resolvers in the wrong translation units, and using symbol mangling that callers to unintentionally bypass the resolver in some circumstances. Fixing these issues for aarch64 will require modifications to our ACLE specification. It will also require further adjustments to existing middle end code, to facilitate different mangling and resolver placement while preserving existing target behaviours. The list of function multiversioning features specified in the ACLE is also inconsistent with the list of features supported in target option extensions. I intend to resolve some or all of these inconsistencies at a later stage. The target_version attribute is currently only supported in C++, since this is the only frontend with existing support for multiversioning using the target attribute. On the other hand, this patch happens to enable multiversioning with the target_clones attribute in Ada and D, as well as the entire C family, using their existing frontend support. This patch also does not support the following aspects of the Beta specification: - The target_clones attribute should allow an implicit unlisted "default" version. - There should be an option to disable function multiversioning at compile time. - Unrecognised target names in a target_clones attribute should be ignored (with an optional warning). This current patch raises an error instead. [1] https://github.com/ARM-software/acle/blob/main/main/acle.md#function-multi-versioning gcc/ChangeLog: * config/aarch64/aarch64-feature-deps.h (fmv_deps_<FEAT_NAME>): Define aarch64_feature_flags mask foreach FMV feature. * config/aarch64/aarch64-option-extensions.def: Use new macros to define FMV feature extensions. * config/aarch64/aarch64.cc (aarch64_option_valid_attribute_p): Check for target_version attribute after processing target attribute. (aarch64_fmv_feature_data): New. (aarch64_parse_fmv_features): New. (aarch64_process_target_version_attr): New. (aarch64_option_valid_version_attribute_p): New. (get_feature_mask_for_version): New. (compare_feature_masks): New. (aarch64_compare_version_priority): New. (build_ifunc_arg_type): New. (make_resolver_func): New. (add_condition_to_bb): New. (dispatch_function_versions): New. (aarch64_generate_version_dispatcher_body): New. (aarch64_get_function_versions_dispatcher): New. (aarch64_common_function_versions): New. (aarch64_mangle_decl_assembler_name): New. (TARGET_OPTION_VALID_VERSION_ATTRIBUTE_P): New implementation. (TARGET_OPTION_EXPANDED_CLONES_ATTRIBUTE): New implementation. (TARGET_OPTION_FUNCTION_VERSIONS): New implementation. (TARGET_COMPARE_VERSION_PRIORITY): New implementation. (TARGET_GENERATE_VERSION_DISPATCHER_BODY): New implementation. (TARGET_GET_FUNCTION_VERSIONS_DISPATCHER): New implementation. (TARGET_MANGLE_DECL_ASSEMBLER_NAME): New implementation. * config/aarch64/aarch64.h (TARGET_HAS_FMV_TARGET_ATTRIBUTE): Set target macro. * config/arm/aarch-common.h (enum aarch_parse_opt_result): Add new value to report duplicate FMV feature. * common/config/aarch64/cpuinfo.h: New file. libgcc/ChangeLog: * config/aarch64/cpuinfo.c (enum CPUFeatures): Move to shared copy in gcc/common gcc/testsuite/ChangeLog: * gcc.target/aarch64/options_set_17.c: Reorder expected flags. * gcc.target/aarch64/cpunative/native_cpu_0.c: Ditto. * gcc.target/aarch64/cpunative/native_cpu_13.c: Ditto. * gcc.target/aarch64/cpunative/native_cpu_16.c: Ditto. * gcc.target/aarch64/cpunative/native_cpu_17.c: Ditto. * gcc.target/aarch64/cpunative/native_cpu_18.c: Ditto. * gcc.target/aarch64/cpunative/native_cpu_19.c: Ditto. * gcc.target/aarch64/cpunative/native_cpu_20.c: Ditto. * gcc.target/aarch64/cpunative/native_cpu_21.c: Ditto. * gcc.target/aarch64/cpunative/native_cpu_22.c: Ditto. * gcc.target/aarch64/cpunative/native_cpu_6.c: Ditto. * gcc.target/aarch64/cpunative/native_cpu_7.c: Ditto. |
||
---|---|---|
.. | ||
config | ||
soft-fp | ||
ChangeLog | ||
config.host | ||
config.in | ||
configure | ||
configure.ac | ||
crtstuff.c | ||
dfp-bit.c | ||
dfp-bit.h | ||
divmod.c | ||
emutls.c | ||
enable-execute-stack-empty.c | ||
enable-execute-stack-mprotect.c | ||
find-symver.awk | ||
fixed-bit.c | ||
fixed-bit.h | ||
fixed-obj.mk | ||
floatunsidf.c | ||
floatunsisf.c | ||
floatunsitf.c | ||
floatunsixf.c | ||
fp-bit.c | ||
fp-bit.h | ||
gbl-ctors.h | ||
gcov.h | ||
gen-fixed.sh | ||
generic-morestack-thread.c | ||
generic-morestack.c | ||
generic-morestack.h | ||
gstdint.h | ||
gthr-posix.h | ||
gthr-single.h | ||
gthr.h | ||
hardcfr.c | ||
libgcc2.c | ||
libgcc2.h | ||
libgcc-std.ver.in | ||
libgcov-driver-system.c | ||
libgcov-driver.c | ||
libgcov-interface.c | ||
libgcov-merge.c | ||
libgcov-profiler.c | ||
libgcov-util.c | ||
libgcov.h | ||
Makefile.in | ||
memcmp.c | ||
memcpy.c | ||
memmove.c | ||
memset.c | ||
mkheader.sh | ||
mkmap-flat.awk | ||
mkmap-symver.awk | ||
offloadstuff.c | ||
shared-object.mk | ||
siditi-object.mk | ||
static-object.mk | ||
strub.c | ||
sync.c | ||
udivhi3.c | ||
udivmod.c | ||
udivmodhi4.c | ||
udivmodsi4.c | ||
unwind-arm-common.inc | ||
unwind-c.c | ||
unwind-compat.c | ||
unwind-compat.h | ||
unwind-dw2-btree.h | ||
unwind-dw2-execute_cfa.h | ||
unwind-dw2-fde-compat.c | ||
unwind-dw2-fde-dip.c | ||
unwind-dw2-fde.c | ||
unwind-dw2-fde.h | ||
unwind-dw2.c | ||
unwind-dw2.h | ||
unwind-generic.h | ||
unwind-pe.h | ||
unwind-seh.c | ||
unwind-sjlj.c | ||
unwind.inc | ||
vtv_end_preinit.c | ||
vtv_end.c | ||
vtv_start_preinit.c | ||
vtv_start.c |