aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@arm.com>2020-03-13 11:32:53 +0000
committerRichard Sandiford <richard.sandiford@arm.com>2020-04-09 17:11:11 +0100
commit5002dae3df4efa7a2db1869ae6f8edd329df8486 (patch)
tree88cdbccf8df8ff193646d93e3aaca775d2ada75b /gcc
parenta4d2774c9c1e213cb129c8b81a591297669838c8 (diff)
downloadgcc-5002dae3df4efa7a2db1869ae6f8edd329df8486.zip
gcc-5002dae3df4efa7a2db1869ae6f8edd329df8486.tar.gz
gcc-5002dae3df4efa7a2db1869ae6f8edd329df8486.tar.bz2
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.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog10
-rw-r--r--gcc/config/aarch64/aarch64-sve-builtins.cc21
-rw-r--r--gcc/config/aarch64/aarch64.c1
3 files changed, 31 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index d081003..0ee6c7d 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 2c5543b..bcd60e9 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 25eccc7..0a46717 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 }
};