tree-hash-traits.h (tree_ssa_name_hasher): New class.
authorRichard Sandiford <richard.sandiford@arm.com>
Thu, 25 Jun 2015 17:16:02 +0000 (17:16 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Thu, 25 Jun 2015 17:16:02 +0000 (17:16 +0000)
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

gcc/ChangeLog
gcc/sese.c
gcc/tree-hash-traits.h

index 30b7cdc121a4c2491acbf8a18dfd21b0c16e33db..f95f2dcc9470a1ba20e5025d433d66adb0644251 100644 (file)
@@ -1,3 +1,9 @@
+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.
index 45deda1a4fa2566b626f634373b8bf24f364d159..95ef7e80372f7f985f13787ed597b1b6a81a8c0c 100644 (file)
@@ -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;
 }
 \f
-
-/* 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;
 \f
 
index 9a2fda7bac69b13530e528269f07b89380c9b31c..1f4364f591e5aad055ab91751e16767d96c07145 100644 (file)
@@ -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