]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
aarch64: Add a separate "SVE sizeless type" attribute
authorRichard Sandiford <richard.sandiford@arm.com>
Fri, 13 Mar 2020 11:32:53 +0000 (11:32 +0000)
committerRichard Sandiford <richard.sandiford@arm.com>
Thu, 9 Apr 2020 16:11:11 +0000 (17:11 +0100)
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.

gcc/ChangeLog
gcc/config/aarch64/aarch64-sve-builtins.cc
gcc/config/aarch64/aarch64.c

index d081003609f55a5be61fba4af2f34fbf22a81876..0ee6c7dc574c66b65f35a7b19a4b2a948d3cef7a 100644 (file)
@@ -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
index 2c5543b6e6ad9abf61541ae07be1b1024473f226..bcd60e9f838fdc9ad3b8cd11f4fdf65c22bacda3 100644 (file)
@@ -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)
index 25eccc755b3660dd451f3280300826cb79e95239..0a467176fd967d7b9a91fef7739f82e994308dd0 100644 (file)
@@ -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 }
 };