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
This commit is contained in:
parent
d6a818c59e
commit
910ee068df
|
@ -1,3 +1,9 @@
|
||||||
|
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.
|
||||||
|
|
||||||
2015-06-25 Richard Sandiford <richard.sandiford@arm.com>
|
2015-06-25 Richard Sandiford <richard.sandiford@arm.com>
|
||||||
|
|
||||||
* tree-hash-traits.h: New file.
|
* tree-hash-traits.h: New file.
|
||||||
|
|
|
@ -39,4 +39,18 @@ tree_operand_hash::equal_keys (const_tree t1, const_tree t2)
|
||||||
return operand_equal_p (t1, t2, 0);
|
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
|
#endif
|
||||||
|
|
|
@ -71,6 +71,7 @@ along with GCC; see the file COPYING3. If not see
|
||||||
#include "ipa-ref.h"
|
#include "ipa-ref.h"
|
||||||
#include "cgraph.h"
|
#include "cgraph.h"
|
||||||
#include "ipa-chkp.h"
|
#include "ipa-chkp.h"
|
||||||
|
#include "tree-hash-traits.h"
|
||||||
|
|
||||||
/* A vector indexed by SSA_NAME_VERSION. 0 means unknown, positive value
|
/* A vector indexed by SSA_NAME_VERSION. 0 means unknown, positive value
|
||||||
is an index into strinfo vector, negative value stands for
|
is an index into strinfo vector, negative value stands for
|
||||||
|
@ -153,20 +154,7 @@ struct decl_stridxlist_map
|
||||||
struct stridxlist list;
|
struct stridxlist list;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* stridxlist hashtable helpers. */
|
typedef simple_hashmap_traits <tree_decl_hash> stridxlist_hash_traits;
|
||||||
|
|
||||||
struct stridxlist_hash_traits : default_hashmap_traits
|
|
||||||
{
|
|
||||||
static inline hashval_t hash (tree);
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Hash a from tree in a decl_stridxlist_map. */
|
|
||||||
|
|
||||||
inline hashval_t
|
|
||||||
stridxlist_hash_traits::hash (tree item)
|
|
||||||
{
|
|
||||||
return DECL_UID (item);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Hash table for mapping decls to a chained list of offset -> idx
|
/* Hash table for mapping decls to a chained list of offset -> idx
|
||||||
mappings. */
|
mappings. */
|
||||||
|
|
Loading…
Reference in New Issue