+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.
#include "value-prof.h"
#include "sese.h"
#include "tree-ssa-propagate.h"
+#include "tree-hash-traits.h"
/* Helper function for debug_rename_map. */
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
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