diff options
author | Richard Sandiford <richard.sandiford@arm.com> | 2015-06-25 17:15:54 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2015-06-25 17:15:54 +0000 |
commit | 910ee068dfe96a049298066301b2f48e00299789 (patch) | |
tree | c0a0e6676bc3c8d75377a2d4e197dead803b8531 /gcc/tree-hash-traits.h | |
parent | d6a818c59e002f76f237ad305bf4b73a415dcb3c (diff) | |
download | gcc-910ee068dfe96a049298066301b2f48e00299789.zip gcc-910ee068dfe96a049298066301b2f48e00299789.tar.gz gcc-910ee068dfe96a049298066301b2f48e00299789.tar.bz2 |
tree-hash-traits.h (tree_decl_hash): New class.
gcc/
* tree-hash-traits.h (tree_decl_hash): New class.
* tree-ssa-strlen.c: Include tree-hash-traits.h.
(stridxlist_hash_traits): Use tree_decl_hash.
From-SVN: r224968
Diffstat (limited to 'gcc/tree-hash-traits.h')
-rw-r--r-- | gcc/tree-hash-traits.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/gcc/tree-hash-traits.h b/gcc/tree-hash-traits.h index eab8c30..9a2fda7 100644 --- a/gcc/tree-hash-traits.h +++ b/gcc/tree-hash-traits.h @@ -39,4 +39,18 @@ tree_operand_hash::equal_keys (const_tree t1, const_tree t2) return operand_equal_p (t1, t2, 0); } +/* Hasher for tree decls. Pointer equality is enough here, but the DECL_UID + is a better hash than the pointer value and gives a predictable traversal + order. */ +struct tree_decl_hash : ggc_ptr_hash <tree_node> +{ + static inline hashval_t hash (tree); +}; + +inline hashval_t +tree_decl_hash::hash (tree t) +{ + return DECL_UID (t); +} + #endif |