static unsigned long num_canonical_type_hash_entries;
static unsigned long num_canonical_type_hash_queries;
-static void iterative_hash_canonical_type (tree type, inchash &hstate);
+static void iterative_hash_canonical_type (tree type, inchash::hash &hstate);
static hashval_t gimple_canonical_type_hash (const void *p);
static void gimple_register_canonical_type_1 (tree t, hashval_t hash);
static hashval_t
hash_canonical_type (tree type)
{
- inchash hstate;
+ inchash::hash hstate;
/* Combine a few common features of types so that types are grouped into
smaller sets; when searching for existing matching types to merge,
/* OMP lowering can introduce error_mark_node in place of
random local decls in types. */
if (TYPE_MIN_VALUE (TYPE_DOMAIN (type)) != error_mark_node)
- iterative_hstate_expr (TYPE_MIN_VALUE (TYPE_DOMAIN (type)), hstate);
+ inchash::add_expr (TYPE_MIN_VALUE (TYPE_DOMAIN (type)), hstate);
if (TYPE_MAX_VALUE (TYPE_DOMAIN (type)) != error_mark_node)
- iterative_hstate_expr (TYPE_MAX_VALUE (TYPE_DOMAIN (type)), hstate);
+ inchash::add_expr (TYPE_MAX_VALUE (TYPE_DOMAIN (type)), hstate);
}
/* Recurse for aggregates with a single element type. */
/* Returning a hash value for gimple type TYPE combined with VAL. */
static void
-iterative_hash_canonical_type (tree type, inchash &hstate)
+iterative_hash_canonical_type (tree type, inchash::hash &hstate)
{
hashval_t v;
/* An already processed type. */
static void print_debug_expr_statistics (void);
static void print_value_expr_statistics (void);
static int type_hash_marked_p (const void *);
-static void type_hash_list (const_tree, inchash &);
-static void attribute_hash_list (const_tree, inchash &);
+static void type_hash_list (const_tree, inchash::hash &);
+static void attribute_hash_list (const_tree, inchash::hash &);
tree global_trees[TI_MAX];
tree integer_types[itk_none];
{
if (! attribute_list_equal (TYPE_ATTRIBUTES (ttype), attribute))
{
- inchash hstate;
+ inchash::hash hstate;
tree ntype;
int i;
tree t;
of the individual types. */
static void
-type_hash_list (const_tree list, inchash &hstate)
+type_hash_list (const_tree list, inchash::hash &hstate)
{
const_tree tail;
by adding the hash codes of the individual attributes. */
static void
-attribute_hash_list (const_tree list, inchash &hstate)
+attribute_hash_list (const_tree list, inchash::hash &hstate)
{
const_tree tail;
return false;
}
+namespace inchash
+{
+
/* Generate a hash value for an expression. This can be used iteratively
by passing a previous result as the HSTATE argument.
This function is intended to produce the same hash for expressions which
would compare equal using operand_equal_p. */
void
-iterative_hstate_expr (const_tree t, inchash &hstate)
+add_expr (const_tree t, inchash::hash &hstate)
{
int i;
enum tree_code code;
hstate.add ((const void *) TREE_STRING_POINTER (t), TREE_STRING_LENGTH (t));
return;
case COMPLEX_CST:
- iterative_hstate_expr (TREE_REALPART (t), hstate);
- iterative_hstate_expr (TREE_IMAGPART (t), hstate);
+ inchash::add_expr (TREE_REALPART (t), hstate);
+ inchash::add_expr (TREE_IMAGPART (t), hstate);
return;
case VECTOR_CST:
{
unsigned i;
for (i = 0; i < VECTOR_CST_NELTS (t); ++i)
- iterative_hstate_expr (VECTOR_CST_ELT (t, i), hstate);
+ inchash::add_expr (VECTOR_CST_ELT (t, i), hstate);
return;
}
case SSA_NAME:
/* A list of expressions, for a CALL_EXPR or as the elements of a
VECTOR_CST. */
for (; t; t = TREE_CHAIN (t))
- iterative_hstate_expr (TREE_VALUE (t), hstate);
+ inchash::add_expr (TREE_VALUE (t), hstate);
return;
case CONSTRUCTOR:
{
tree field, value;
FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (t), idx, field, value)
{
- iterative_hstate_expr (field, hstate);
- iterative_hstate_expr (value, hstate);
+ inchash::add_expr (field, hstate);
+ inchash::add_expr (value, hstate);
}
return;
}
{
/* Make sure to include signness in the hash computation. */
hstate.add_int (TYPE_UNSIGNED (TREE_TYPE (t)));
- iterative_hstate_expr (TREE_OPERAND (t, 0), hstate);
+ inchash::add_expr (TREE_OPERAND (t, 0), hstate);
}
else if (commutative_tree_code (code))
however it appears. We do this by first hashing both operands
and then rehashing based on the order of their independent
hashes. */
- inchash one, two;
- iterative_hstate_expr (TREE_OPERAND (t, 0), one);
- iterative_hstate_expr (TREE_OPERAND (t, 1), two);
+ inchash::hash one, two;
+ inchash::add_expr (TREE_OPERAND (t, 0), one);
+ inchash::add_expr (TREE_OPERAND (t, 1), two);
hstate.add_commutative (one, two);
}
else
for (i = TREE_OPERAND_LENGTH (t) - 1; i >= 0; --i)
- iterative_hstate_expr (TREE_OPERAND (t, i), hstate);
+ inchash::add_expr (TREE_OPERAND (t, i), hstate);
}
return;
}
}
+}
+
/* Constructors for pointer, array and function types.
(RECORD_TYPE, UNION_TYPE and ENUMERAL_TYPE nodes are
constructed by language-dependent code, not here.) */
build_range_type_1 (tree type, tree lowval, tree highval, bool shared)
{
tree itype = make_node (INTEGER_TYPE);
- inchash hstate;
+ inchash::hash hstate;
TREE_TYPE (itype) = type;
return itype;
}
- iterative_hstate_expr (TYPE_MIN_VALUE (itype), hstate);
- iterative_hstate_expr (TYPE_MAX_VALUE (itype), hstate);
+ inchash::add_expr (TYPE_MIN_VALUE (itype), hstate);
+ inchash::add_expr (TYPE_MAX_VALUE (itype), hstate);
hstate.merge_hash (TYPE_HASH (type));
itype = type_hash_canon (hstate.end (), itype);
if (shared)
{
- inchash hstate;
+ inchash::hash hstate;
hstate.add_object (TYPE_HASH (elt_type));
if (index_type)
hstate.add_object (TYPE_HASH (index_type));
build_function_type (tree value_type, tree arg_types)
{
tree t;
- inchash hstate;
+ inchash::hash hstate;
bool any_structural_p, any_noncanonical_p;
tree canon_argtypes;
{
tree t;
tree ptype;
- inchash hstate;
+ inchash::hash hstate;
bool any_structural_p, any_noncanonical_p;
tree canon_argtypes;
build_offset_type (tree basetype, tree type)
{
tree t;
- inchash hstate;
+ inchash::hash hstate;
/* Make a node of the sort we want. */
t = make_node (OFFSET_TYPE);
build_complex_type (tree component_type)
{
tree t;
- inchash hstate;
+ inchash::hash hstate;
gcc_assert (INTEGRAL_TYPE_P (component_type)
|| SCALAR_FLOAT_TYPE_P (component_type)
make_vector_type (tree innertype, int nunits, enum machine_mode mode)
{
tree t;
- inchash hstate;
+ inchash::hash hstate;
t = make_node (VECTOR_TYPE);
TREE_TYPE (t) = TYPE_MAIN_VARIANT (innertype);