[AArch64] Use type attributes to mark types that use the SVE PCS
authorRichard Sandiford <richard.sandiford@arm.com>
Tue, 7 Jan 2020 10:18:14 +0000 (10:18 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Tue, 7 Jan 2020 10:18:14 +0000 (10:18 +0000)
commit683e93d1975f676d00096b7c93b942dbd0491800
tree31e6eb4dea1b3327bdd3fb9874e36778056b3100
parentc4b30920c7427fc57181d91f17e9998502fe1866
[AArch64] Use type attributes to mark types that use the SVE PCS

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  <richard.sandiford@arm.com>

gcc/
* 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.

gcc/testsuite/
* 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.

From-SVN: r279953
gcc/ChangeLog
gcc/config/aarch64/aarch64-protos.h
gcc/config/aarch64/aarch64-sve-builtins.cc
gcc/config/aarch64/aarch64.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.target/aarch64/sve/acle/general-c++/mangle_5.C [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve/pcs/asm_1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve/pcs/asm_2.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve/pcs/asm_3.c [new file with mode: 0644]