Commit 56fdfd3e by Andi Kleen Committed by Andi Kleen

Convert the tree.c type hashing over to inchash

v2: Use commutative interface. Be much nearer to the old
code.

gcc/:

2014-07-25  Andi Kleen  <ak@linux.intel.com>

	* tree.c (build_type_attribute_qual_variant): Use inchash.
	(type_hash_list): Dito.
	(attribute_hash_list): Dito
	(iterative_hstate_expr): Dito.
	(iterative_hash_expr): Dito.
	(build_range_type_1): Dito.
	(build_array_type_1): Dito.
	(build_function_type): Dito.
	(build_method_type_directly): Dito.
	(build_offset_type): Dito.
	(build_complex_type): Dito.
	(make_vector_type): Dito.
	* tree.h (iterative_hash_expr): Add compat wrapper.
	(iterative_hstate_expr): Add.

gcc/lto/:

2014-07-25  Andi Kleen  <ak@linux.intel.com>

	* lto.c (hash_canonical_type): Call iterative_hstate_expr.

From-SVN: r213056
parent 0bd8bb04
2014-07-25 Andi Kleen <ak@linux.intel.com> 2014-07-25 Andi Kleen <ak@linux.intel.com>
* tree.c (build_type_attribute_qual_variant): Use inchash.
(type_hash_list): Dito.
(attribute_hash_list): Dito
(iterative_hstate_expr): Dito.
(iterative_hash_expr): Dito.
(build_range_type_1): Dito.
(build_array_type_1): Dito.
(build_function_type): Dito.
(build_method_type_directly): Dito.
(build_offset_type): Dito.
(build_complex_type): Dito.
(make_vector_type): Dito.
* tree.h (iterative_hash_expr): Add compat wrapper.
(iterative_hstate_expr): Add.
2014-07-25 Andi Kleen <ak@linux.intel.com>
* Makefile.in (OBJS): Add inchash.o. * Makefile.in (OBJS): Add inchash.o.
(PLUGIN_HEADERS): Add inchash.h. (PLUGIN_HEADERS): Add inchash.h.
* ipa-devirt.c: Include inchash.h. * ipa-devirt.c: Include inchash.h.
......
2014-07-25 Andi Kleen <ak@linux.intel.com> 2014-07-25 Andi Kleen <ak@linux.intel.com>
* lto.c (hash_canonical_type): Call iterative_hstate_expr.
2014-07-25 Andi Kleen <ak@linux.intel.com>
* lto.c (hash_canonical_type): Convert to inchash. * lto.c (hash_canonical_type): Convert to inchash.
(iterative_hash_canonical_type): Dito. (iterative_hash_canonical_type): Dito.
......
...@@ -327,11 +327,9 @@ hash_canonical_type (tree type) ...@@ -327,11 +327,9 @@ hash_canonical_type (tree type)
/* OMP lowering can introduce error_mark_node in place of /* OMP lowering can introduce error_mark_node in place of
random local decls in types. */ random local decls in types. */
if (TYPE_MIN_VALUE (TYPE_DOMAIN (type)) != error_mark_node) if (TYPE_MIN_VALUE (TYPE_DOMAIN (type)) != error_mark_node)
hstate.add_int (iterative_hash_expr (TYPE_MIN_VALUE ( iterative_hstate_expr (TYPE_MIN_VALUE (TYPE_DOMAIN (type)), hstate);
TYPE_DOMAIN (type)), 0));
if (TYPE_MAX_VALUE (TYPE_DOMAIN (type)) != error_mark_node) if (TYPE_MAX_VALUE (TYPE_DOMAIN (type)) != error_mark_node)
hstate.add_int (iterative_hash_expr (TYPE_MAX_VALUE ( iterative_hstate_expr (TYPE_MAX_VALUE (TYPE_DOMAIN (type)), hstate);
TYPE_DOMAIN (type)), 0));
} }
/* Recurse for aggregates with a single element type. */ /* Recurse for aggregates with a single element type. */
......
...@@ -22,6 +22,7 @@ along with GCC; see the file COPYING3. If not see ...@@ -22,6 +22,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree-core.h" #include "tree-core.h"
#include "wide-int.h" #include "wide-int.h"
#include "inchash.h"
/* These includes are required here because they provide declarations /* These includes are required here because they provide declarations
used by inline functions in this file. used by inline functions in this file.
...@@ -4283,7 +4284,17 @@ extern int tree_log2 (const_tree); ...@@ -4283,7 +4284,17 @@ extern int tree_log2 (const_tree);
extern int tree_floor_log2 (const_tree); extern int tree_floor_log2 (const_tree);
extern unsigned int tree_ctz (const_tree); extern unsigned int tree_ctz (const_tree);
extern int simple_cst_equal (const_tree, const_tree); extern int simple_cst_equal (const_tree, const_tree);
extern hashval_t iterative_hash_expr (const_tree, hashval_t); extern void iterative_hstate_expr (const_tree, inchash &);
/* Compat version until all callers are converted. Return hash for
TREE with SEED. */
static inline hashval_t iterative_hash_expr(const_tree tree, hashval_t seed)
{
inchash hstate (seed);
iterative_hstate_expr (tree, hstate);
return hstate.end ();
}
extern int compare_tree_int (const_tree, unsigned HOST_WIDE_INT); extern int compare_tree_int (const_tree, unsigned HOST_WIDE_INT);
extern int type_list_equal (const_tree, const_tree); extern int type_list_equal (const_tree, const_tree);
extern int chain_member (const_tree, const_tree); extern int chain_member (const_tree, const_tree);
......
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