Commit 5002dae3 by Richard Sandiford

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.
parent a4d2774c
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> 2020-04-09 Matthew Malcomson <matthew.malcomson@arm.com>
* config/arm/arm_cde.h: Remove `extern "C"` when compiling for * config/arm/arm_cde.h: Remove `extern "C"` when compiling for
......
...@@ -585,6 +585,23 @@ lookup_sve_type_attribute (const_tree type) ...@@ -585,6 +585,23 @@ lookup_sve_type_attribute (const_tree type)
return lookup_attribute ("SVE type", TYPE_ATTRIBUTES (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 /* If TYPE is a valid SVE element type, return the corresponding type
suffix, otherwise return NUM_TYPE_SUFFIXES. */ suffix, otherwise return NUM_TYPE_SUFFIXES. */
static type_suffix_index static type_suffix_index
...@@ -3293,6 +3310,7 @@ register_builtin_types () ...@@ -3293,6 +3310,7 @@ register_builtin_types ()
TYPE_INDIVISIBLE_P (vectype) = 1; TYPE_INDIVISIBLE_P (vectype) = 1;
add_sve_type_attribute (vectype, num_zr, num_pr, add_sve_type_attribute (vectype, num_zr, num_pr,
vector_types[i].mangled_name); vector_types[i].mangled_name);
make_type_sizeless (vectype);
abi_vector_types[i] = vectype; abi_vector_types[i] = vectype;
lang_hooks.types.register_builtin_type (vectype, lang_hooks.types.register_builtin_type (vectype,
vector_types[i].abi_name); vector_types[i].abi_name);
...@@ -3361,6 +3379,7 @@ register_tuple_type (unsigned int num_vectors, vector_type_index type) ...@@ -3361,6 +3379,7 @@ register_tuple_type (unsigned int num_vectors, vector_type_index type)
DECL_FIELD_CONTEXT (field) = tuple_type; DECL_FIELD_CONTEXT (field) = tuple_type;
TYPE_FIELDS (tuple_type) = field; TYPE_FIELDS (tuple_type) = field;
add_sve_type_attribute (tuple_type, num_vectors, 0, NULL); add_sve_type_attribute (tuple_type, num_vectors, 0, NULL);
make_type_sizeless (tuple_type);
layout_type (tuple_type); layout_type (tuple_type);
gcc_assert (VECTOR_MODE_P (TYPE_MODE (tuple_type)) gcc_assert (VECTOR_MODE_P (TYPE_MODE (tuple_type))
&& TYPE_MODE_RAW (tuple_type) == TYPE_MODE (tuple_type) && TYPE_MODE_RAW (tuple_type) == TYPE_MODE (tuple_type)
...@@ -3578,7 +3597,7 @@ bool ...@@ -3578,7 +3597,7 @@ bool
verify_type_context (location_t loc, type_context_kind context, verify_type_context (location_t loc, type_context_kind context,
const_tree type, bool silent_p) const_tree type, bool silent_p)
{ {
if (!builtin_type_p (type)) if (!sizeless_type_p (type))
return true; return true;
switch (context) switch (context)
......
...@@ -1247,6 +1247,7 @@ static const struct attribute_spec aarch64_attribute_table[] = ...@@ -1247,6 +1247,7 @@ static const struct attribute_spec aarch64_attribute_table[] =
{ "aarch64_vector_pcs", 0, 0, false, true, true, true, { "aarch64_vector_pcs", 0, 0, false, true, true, true,
handle_aarch64_vector_pcs_attribute, NULL }, handle_aarch64_vector_pcs_attribute, NULL },
{ "SVE type", 3, 3, false, true, false, true, NULL, 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 } { NULL, 0, 0, false, false, false, false, NULL, NULL }
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment