diff options
author | Richard Sandiford <richard.sandiford@arm.com> | 2015-06-25 17:16:02 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2015-06-25 17:16:02 +0000 |
commit | 5d6678ae80850da572b28776ef9dd19b04d5fefd (patch) | |
tree | af7ce16a0d3a01d46fbfdf11fee855773e841859 /gcc | |
parent | 910ee068dfe96a049298066301b2f48e00299789 (diff) | |
download | gcc-5d6678ae80850da572b28776ef9dd19b04d5fefd.zip gcc-5d6678ae80850da572b28776ef9dd19b04d5fefd.tar.gz gcc-5d6678ae80850da572b28776ef9dd19b04d5fefd.tar.bz2 |
tree-hash-traits.h (tree_ssa_name_hasher): New class.
gcc/
* tree-hash-traits.h (tree_ssa_name_hasher): New class.
* sese.c: Include tree-hash-traits.h.
(rename_map_hasher): Use tree_ssa_name_hasher.
From-SVN: r224969
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/sese.c | 18 | ||||
-rw-r--r-- | gcc/tree-hash-traits.h | 14 |
3 files changed, 22 insertions, 16 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 30b7cdc..f95f2dc 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,11 @@ 2015-06-25 Richard Sandiford <richard.sandiford@arm.com> + * tree-hash-traits.h (tree_ssa_name_hasher): New class. + * sese.c: Include tree-hash-traits.h. + (rename_map_hasher): Use tree_ssa_name_hasher. + +2015-06-25 Richard Sandiford <richard.sandiford@arm.com> + * 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. @@ -60,6 +60,7 @@ along with GCC; see the file COPYING3. If not see #include "value-prof.h" #include "sese.h" #include "tree-ssa-propagate.h" +#include "tree-hash-traits.h" /* Helper function for debug_rename_map. */ @@ -75,22 +76,7 @@ debug_rename_map_1 (tree_node *const &old_name, tree_node *const &expr, return true; } - -/* Hashtable helpers. */ - -struct rename_map_hasher : default_hashmap_traits -{ - static inline hashval_t hash (tree); -}; - -/* Computes a hash function for database element ELT. */ - -inline hashval_t -rename_map_hasher::hash (tree old_name) -{ - return SSA_NAME_VERSION (old_name); -} - +typedef simple_hashmap_traits<tree_ssa_name_hash> rename_map_hasher; typedef hash_map<tree, tree, rename_map_hasher> rename_map_type; diff --git a/gcc/tree-hash-traits.h b/gcc/tree-hash-traits.h index 9a2fda7..1f4364f 100644 --- a/gcc/tree-hash-traits.h +++ b/gcc/tree-hash-traits.h @@ -53,4 +53,18 @@ tree_decl_hash::hash (tree t) return DECL_UID (t); } +/* Hash for SSA_NAMEs in the same function. Pointer equality is enough + here, but the SSA_NAME_VERSION is a better hash than the pointer + value and gives a predictable traversal order. */ +struct tree_ssa_name_hash : ggc_ptr_hash <tree_node> +{ + static inline hashval_t hash (tree); +}; + +inline hashval_t +tree_ssa_name_hash::hash (tree t) +{ + return SSA_NAME_VERSION (t); +} + #endif |