aboutsummaryrefslogtreecommitdiff
path: root/gcc/hash-traits.h
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@arm.com>2015-06-25 17:06:36 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2015-06-25 17:06:36 +0000
commitca752f3929677221a5806daf4940367308fc16d7 (patch)
treed35764dd52f6e222b536f1063b2e147b652cc9b6 /gcc/hash-traits.h
parent95fbe13e99744b36691495fd81934ccee963c0a3 (diff)
downloadgcc-ca752f3929677221a5806daf4940367308fc16d7.zip
gcc-ca752f3929677221a5806daf4940367308fc16d7.tar.gz
gcc-ca752f3929677221a5806daf4940367308fc16d7.tar.bz2
hash-traits.h (ggc_hasher): Rename to...
gcc/ * hash-traits.h (ggc_hasher): Rename to... (ggc_remover): ...this and remove typedefs. (ggc_cache_hasher): Update accordingly. Add typedefs. (ggc_ptr_hash): New class. * hash-table.h: Update comment. * cfgloop.h (loop_exit_hasher): Inherit from ggc_ptr_hash rather than ggc_hasher. * cgraph.h (section_name_hasher, cgraph_edge_hasher): Likewise. (tree_descriptor_hasher): Likewise. * cgraph.c (function_version_hasher): Likewise. * dwarf2out.c (indirect_string_hasher, dwarf_file_hasher): Likewise. (decl_die_hasher, block_die_hasher, decl_loc_hasher): Likewise. (dw_loc_list_hasher, addr_hasher): Likewise. * function.h (used_type_hasher): Likewise. * function.c (temp_address_hasher): Likewise. * gimple-ssa.h (tm_restart_hasher, ssa_name_hasher): Likewise. * libfuncs.h (libfunc_hasher): Likewise. * lto-streamer.h (decl_state_hasher): Likewise. * optabs.c (libfunc_decl_hasher): Likewise. * tree-scalar-evolution.c (scev_info_hasher): Likewise. * varasm.c (section_hasher, object_block_hasher): Likewise. (const_rtx_desc_hasher): Likewise. * config/darwin.c (indirection_hasher, cfstring_hasher): Likewise. * config/rs6000/rs6000.c (toc_hasher, builtin_hasher): Likewise. gcc/c-family/ * c-common.c (c_type_hasher): Inherit from ggc_ptr_hash rather than ggc_hasher. gcc/cp/ * constexpr.c (constexpr_fundef_hasher): Inherit from ggc_ptr_hash rather than ggc_hasher. (constexpr_call_hasher): Likewise. * cp-tree.h (cxx_int_tree_map_hasher, named_label_hasher): Likewise. * decl.c (typename_hasher): Likewise. * mangle.c (conv_type_hasher): Likewise. * pt.c (spec_hasher): Likewise. * tree.c (cplus_array_hasher, list_hasher): Likewise. * typeck2.c (abstract_type_hasher): Likewise. gcc/fortran/ * trans-decl.c (module_hasher): Likewise. * trans.h (module_decl_hasher): Likewise. gcc/java/ * java-tree.h (treetreehasher): Inherit from ggc_ptr_hash rather than ggc_hasher. (ict_hasher, type_assertion_hasher): Likewise. gcc/objc/ * objc-act.c (objc_string_hasher): Inherit from ggc_ptr_hash rather than ggc_hasher. From-SVN: r224959
Diffstat (limited to 'gcc/hash-traits.h')
-rw-r--r--gcc/hash-traits.h18
1 files changed, 12 insertions, 6 deletions
diff --git a/gcc/hash-traits.h b/gcc/hash-traits.h
index e4c182ea..77f88f3 100644
--- a/gcc/hash-traits.h
+++ b/gcc/hash-traits.h
@@ -121,14 +121,11 @@ pointer_hash <Type>::is_empty (Type *e)
return e == NULL;
}
-/* Hasher for entry in gc memory. */
+/* Remover and marker for entries in gc memory. */
template<typename T>
-struct ggc_hasher
+struct ggc_remove
{
- typedef T value_type;
- typedef T compare_type;
-
static void remove (T &) {}
static void
@@ -155,8 +152,11 @@ struct ggc_hasher
/* Hasher for cache entry in gc memory. */
template<typename T>
-struct ggc_cache_hasher : ggc_hasher<T>
+struct ggc_cache_hasher : ggc_remove<T>
{
+ typedef T value_type;
+ typedef T compare_type;
+
/* Entries are weakly held because this is for caches. */
static void ggc_mx (T &) {}
@@ -179,4 +179,10 @@ struct nofree_ptr_hash : pointer_hash <T>, typed_noop_remove <T> {};
template <typename T>
struct free_ptr_hash : pointer_hash <T>, typed_free_remove <T> {};
+/* Traits for elements that point to gc memory. The pointed-to data
+ must be kept across collections. */
+
+template <typename T>
+struct ggc_ptr_hash : pointer_hash <T>, ggc_remove <T *> {};
+
#endif