[gcc/devel/ranger] aarch64: Add a separate "SVE sizeless type" attribute
Aldy Hernandez
aldyh@gcc.gnu.org
Wed Jun 17 20:20:28 GMT 2020
https://gcc.gnu.org/g:5002dae3df4efa7a2db1869ae6f8edd329df8486
commit 5002dae3df4efa7a2db1869ae6f8edd329df8486
Author: Richard Sandiford <richard.sandiford@arm.com>
Date: Fri Mar 13 11:32:53 2020 +0000
aarch64: Add a separate "SVE sizeless type" attribute
It's more convenient for a later patch if sizelessness is represented
separately from "SVEness". "SVEness" is an ABI property that carries
forward into gimple and beyond, and continues to matter during LTO.
Sizelessness is just a frontend restriction and can be ignored after
that.
2020-04-09 Richard Sandiford <richard.sandiford@arm.com>
gcc/
* config/aarch64/aarch64.c (aarch64_attribute_table): Add
"SVE sizeless type".
* config/aarch64/aarch64-sve-builtins.cc (make_type_sizeless)
(sizeless_type_p): New functions.
(register_builtin_types): Apply make_type_sizeless to the type.
(register_tuple_type): Likewise.
(verify_type_context): Use sizeless_type_p instead of builin_type_p.
Diff:
---
gcc/ChangeLog | 10 ++++++++++
gcc/config/aarch64/aarch64-sve-builtins.cc | 21 ++++++++++++++++++++-
gcc/config/aarch64/aarch64.c | 1 +
3 files changed, 31 insertions(+), 1 deletion(-)
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index d081003609f..0ee6c7dc574 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,13 @@
+2020-04-09 Richard Sandiford <richard.sandiford@arm.com>
+
+ * config/aarch64/aarch64.c (aarch64_attribute_table): Add
+ "SVE sizeless type".
+ * config/aarch64/aarch64-sve-builtins.cc (make_type_sizeless)
+ (sizeless_type_p): New functions.
+ (register_builtin_types): Apply make_type_sizeless to the type.
+ (register_tuple_type): Likewise.
+ (verify_type_context): Use sizeless_type_p instead of builin_type_p.
+
2020-04-09 Matthew Malcomson <matthew.malcomson@arm.com>
* config/arm/arm_cde.h: Remove `extern "C"` when compiling for
diff --git a/gcc/config/aarch64/aarch64-sve-builtins.cc b/gcc/config/aarch64/aarch64-sve-builtins.cc
index 2c5543b6e6a..bcd60e9f838 100644
--- a/gcc/config/aarch64/aarch64-sve-builtins.cc
+++ b/gcc/config/aarch64/aarch64-sve-builtins.cc
@@ -585,6 +585,23 @@ lookup_sve_type_attribute (const_tree type)
return lookup_attribute ("SVE type", TYPE_ATTRIBUTES (type));
}
+/* Force TYPE to be a sizeless type. */
+static void
+make_type_sizeless (tree type)
+{
+ TYPE_ATTRIBUTES (type) = tree_cons (get_identifier ("SVE sizeless type"),
+ NULL_TREE, TYPE_ATTRIBUTES (type));
+}
+
+/* Return true if TYPE is a sizeless type. */
+static bool
+sizeless_type_p (const_tree type)
+{
+ if (type == error_mark_node)
+ return NULL_TREE;
+ return lookup_attribute ("SVE sizeless type", TYPE_ATTRIBUTES (type));
+}
+
/* If TYPE is a valid SVE element type, return the corresponding type
suffix, otherwise return NUM_TYPE_SUFFIXES. */
static type_suffix_index
@@ -3293,6 +3310,7 @@ register_builtin_types ()
TYPE_INDIVISIBLE_P (vectype) = 1;
add_sve_type_attribute (vectype, num_zr, num_pr,
vector_types[i].mangled_name);
+ make_type_sizeless (vectype);
abi_vector_types[i] = vectype;
lang_hooks.types.register_builtin_type (vectype,
vector_types[i].abi_name);
@@ -3361,6 +3379,7 @@ register_tuple_type (unsigned int num_vectors, vector_type_index type)
DECL_FIELD_CONTEXT (field) = tuple_type;
TYPE_FIELDS (tuple_type) = field;
add_sve_type_attribute (tuple_type, num_vectors, 0, NULL);
+ make_type_sizeless (tuple_type);
layout_type (tuple_type);
gcc_assert (VECTOR_MODE_P (TYPE_MODE (tuple_type))
&& TYPE_MODE_RAW (tuple_type) == TYPE_MODE (tuple_type)
@@ -3578,7 +3597,7 @@ bool
verify_type_context (location_t loc, type_context_kind context,
const_tree type, bool silent_p)
{
- if (!builtin_type_p (type))
+ if (!sizeless_type_p (type))
return true;
switch (context)
diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index 25eccc755b3..0a467176fd9 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -1247,6 +1247,7 @@ static const struct attribute_spec aarch64_attribute_table[] =
{ "aarch64_vector_pcs", 0, 0, false, true, true, true,
handle_aarch64_vector_pcs_attribute, NULL },
{ "SVE type", 3, 3, false, true, false, true, NULL, NULL },
+ { "SVE sizeless type", 0, 0, false, true, false, true, NULL, NULL },
{ NULL, 0, 0, false, false, false, false, NULL, NULL }
};
More information about the Gcc-cvs
mailing list