The SVE port needs to maintain a different type identity for GNU vectors and "SVE vectors", since the types use different ABIs. Until now we've done that using pointer equality between the TYPE_MAIN_VARIANT and the built-in SVE type.
However, as Richard B noted, that doesn't work well for LTO, where we stream both GNU and SVE types from a file instead of creating them directly. We need a mechanism for distinguishing the types using streamed type information.
This patch does that using a new type attribute. This attribute is only meant to be used for the built-in SVE types and shouldn't be user-visible. The patch tries to ensure this by including a space in the attribute name, like we already do for things like "fn spec" and "omp declare simd".
2020-01-07 Richard Sandiford
- config/aarch64/aarch64-protos.h (aarch64_sve::svbool_type_p) (aarch64_sve::nvectors_if_data_type): Replace with... (aarch64_sve::builtin_type_p): ...this.
- config/aarch64/aarch64-sve-builtins.cc: Include attribs.h. (find_vector_type): Delete. (add_sve_type_attribute): New function. (lookup_sve_type_attribute): Likewise. (register_builtin_types): Add an "SVE type" attribute to each type. (register_tuple_type): Likewise. (svbool_type_p, nvectors_if_data_type): Delete. (mangle_builtin_type): Use lookup_sve_type_attribute. (builtin_type_p): Likewise. Add an overload that returns the number of constituent vector and predicate registers.
- config/aarch64/aarch64.c (aarch64_sve_argument_p): Delete. (aarch64_returns_value_in_sve_regs_p): Use aarch64_sve::builtin_type_p instead of aarch64_sve_argument_p. (aarch64_takes_arguments_in_sve_regs_p): Likewise. (aarch64_pass_by_reference): Likewise. (aarch64_function_value_1): Likewise. (aarch64_return_in_memory): Likewise. (aarch64_layout_arg): Likewise.
- g++.target/aarch64/sve/acle/general-c++/mangle_5.C: New test.
- gcc.target/aarch64/sve/pcs/asm_1.c: Likewise.
- gcc.target/aarch64/sve/pcs/asm_2.c: Likewise.
- gcc.target/aarch64/sve/pcs/asm_3.c: Likewise.
5117d902d61 [AArch64] Use type attributes to mark types that use the SVE PCS
gcc/ChangeLog | 24 +++++
gcc/config/aarch64/aarch64-protos.h | 3 +-
gcc/config/aarch64/aarch64-sve-builtins.cc | 113 +++++++++++----------
gcc/config/aarch64/aarch64.c | 36 ++-----
gcc/testsuite/ChangeLog | 7 ++
.../aarch64/sve/acle/general-c++/mangle_5.C | 8 ++
gcc/testsuite/gcc.target/aarch64/sve/pcs/asm_1.c | 70 +++++++++++++
gcc/testsuite/gcc.target/aarch64/sve/pcs/asm_2.c | 4 +
gcc/testsuite/gcc.target/aarch64/sve/pcs/asm_3.c | 68 +++++++++++++
9 files changed, 246 insertions(+), 87 deletions(-)