static void print_debug_expr_statistics (void);
static void print_value_expr_statistics (void);
-static tree build_array_type_1 (tree, tree, bool, bool);
+static tree build_array_type_1 (tree, tree, bool, bool, bool);
tree global_trees[TI_MAX];
tree integer_types[itk_none];
= map->get_or_insert (t, &existed);
if (!existed)
{
- array = build_array_type_1 (t2, TYPE_DOMAIN (t),
- TYPE_TYPELESS_STORAGE (t), false);
+ array
+ = build_array_type_1 (t2, TYPE_DOMAIN (t), TYPE_TYPELESS_STORAGE (t),
+ false, false);
TYPE_CANONICAL (array) = TYPE_CANONICAL (t);
if (!fld->pset.add (array))
add_tree_to_fld_list (array, fld);
/* Construct, lay out and return the type of arrays of elements with ELT_TYPE
and number of elements specified by the range of values of INDEX_TYPE.
If TYPELESS_STORAGE is true, TYPE_TYPELESS_STORAGE flag is set on the type.
- If SHARED is true, reuse such a type that has already been constructed. */
+ If SHARED is true, reuse such a type that has already been constructed.
+ If SET_CANONICAL is true, compute TYPE_CANONICAL from the element type. */
static tree
build_array_type_1 (tree elt_type, tree index_type, bool typeless_storage,
- bool shared)
+ bool shared, bool set_canonical)
{
tree t;
TYPE_TYPELESS_STORAGE (t) = typeless_storage;
layout_type (t);
- /* If the element type is incomplete at this point we get marked for
- structural equality. Do not record these types in the canonical
- type hashtable. */
- if (TYPE_STRUCTURAL_EQUALITY_P (t))
- return t;
-
if (shared)
{
hashval_t hash = type_hash_canon_hash (t);
t = type_hash_canon (hash, t);
}
- if (TYPE_CANONICAL (t) == t)
+ if (TYPE_CANONICAL (t) == t && set_canonical)
{
if (TYPE_STRUCTURAL_EQUALITY_P (elt_type)
|| (index_type && TYPE_STRUCTURAL_EQUALITY_P (index_type))
= build_array_type_1 (TYPE_CANONICAL (elt_type),
index_type
? TYPE_CANONICAL (index_type) : NULL_TREE,
- typeless_storage, shared);
+ typeless_storage, shared, set_canonical);
}
return t;
tree
build_array_type (tree elt_type, tree index_type, bool typeless_storage)
{
- return build_array_type_1 (elt_type, index_type, typeless_storage, true);
+ return
+ build_array_type_1 (elt_type, index_type, typeless_storage, true, true);
}
/* Wrapper around build_array_type_1 with SHARED set to false. */
tree
build_nonshared_array_type (tree elt_type, tree index_type)
{
- return build_array_type_1 (elt_type, index_type, false, false);
+ return build_array_type_1 (elt_type, index_type, false, false, true);
}
/* Return a representation of ELT_TYPE[NELTS], using indices of type