Message ID | 87twty8ob7.fsf@e105548-lin.cambridge.arm.com |
---|---|
State | New |
Headers | show |
On 06/23/2015 08:57 AM, Richard Sandiford wrote: > At this point all hash_map traits know what kind of key they're > dealing with, so we can make that a traits typedef, like it is for > hash_table traits. Then, if we make the default hash traits for > T be T, we can use hash_table-style traits as the first template > parameter to hash_map, without the need for a third. That is, if > foo_hash hashes elements of type foo_type: > > typedef simple_hashmap_traits <foo_hash> foo_traits; > hash_map <foo_type, value_type, foo_traits> x; > > becomes just: > > hash_map <foo_hash, value_type> x; > > just like a hash_table of foo_types would be: > > hash_table <foo_hash> y; > > This patch makes that simplification. > > > gcc/ > * hash-map-traits.h (simple_hashmap_traits::key_type): New typedef. > (unbounded_int_hashmap_traits::key_type): Likewise. > * hash-map.h (hash_map): Get the key type from the traits. > * hash-traits.h (default_hash_traits): By default, inherit from the > template parameter. > * alias.c (alias_set_traits): Delete. > (alias_set_entry_d::children): Use alias_set_hash as the first > template parameter. > (record_alias_subset): Update accordingly. > * except.c (tree_hash_traits): Delete. > (type_to_runtime_map): Use tree_hash as the first template parameter. > (init_eh): Update accordingly. > * genmatch.c (capture_id_map_hasher): Delete. > (cid_map_t): Use nofree_string_hash as first template parameter. > * ipa-icf.h (symbol_compare_hashmap_traits): Delete. > * ipa-icf.c (sem_item_optimizer::subdivide_classes_by_sensitive_refs): > Use symbol_compare_hash as the first template parameter in > subdivide_hash_map. > * mem-stats.h (mem_usage_pair::mem_alloc_hashmap_traits): Delete. > (mem_usage_pair::mem_map_t): Use mem_location_hash as the first > template parameter. > * passes.c (pass_registry_hasher): Delete. > (name_to_pass_map): Use nofree_string_hash as the first template > parameter. > (register_pass_name): Update accordingly. > * sanopt.c (sanopt_tree_map_traits): Delete. > (sanopt_tree_triplet_map_traits): Delete. > (sanopt_ctx::asan_check_map): Use tree_operand_hash as the first > template parameter. > (sanopt_ctx::vptr_check_map): Use sanopt_tree_triplet_hash as > the first template parameter. > * sese.c (rename_map_hasher): Delete. > (rename_map_type): Use tree_ssa_name_hash as the first template > parameter. > * symbol-summary.h (function_summary::summary_hashmap_traits): Delete. > (function_summary::m_map): Use map_hash as the first template > parameter. > (function_summary::release): Update accordingly. > * tree-if-conv.c (phi_args_hash_traits): Delete. > (predicate_scalar_phi): Use tree_operand_hash as the first template > parameter to phi_arg_map. > * tree-inline.h (dependence_hasher): Delete. > (copy_body_data::dependence_map): Use dependence_hash as the first > template parameter. > * tree-inline.c (remap_dependence_clique): Update accordingly. > * tree-ssa-strlen.c (stridxlist_hash_traits): Delete. > (decl_to_stridxlist_htab): Use tree_decl_hash as the first template > parameter. > (addr_stridxptr): Update accordingly. > * value-prof.c (profile_id_traits): Delete. > (cgraph_node_map): Use profile_id_hash as the first template > parameter. > (init_node_map): Update accordingly. > * config/alpha/alpha.c (string_traits): Delete. > (machine_function::links): Use nofree_string_hash as the first > template parameter. > (alpha_use_linkage, alpha_write_linkage): Update accordingly. > * config/m32c/m32c.c (pragma_traits): Delete. > (pragma_htab): Use nofree_string_hash as the first template parameter. > (m32c_note_pragma_address): Update accordingly. > * config/mep/mep.c (pragma_traits): Delete. > (pragma_htab): Use nofree_string_hash as the first template parameter. > (mep_note_pragma_flag): Update accordingly. > * config/mips/mips.c (mips16_flip_traits): Delete. > (mflip_mips16_htab): Use nofree_string_hash as the first template > parameter. > (mflip_mips16_use_mips16_p): Update accordingly. > (local_alias_traits): Delete. > (mips16_local_aliases): Use nofree_string_hash as the first template > parameter. > (mips16_local_alias): Update accordingly. Phew. OK. jeff
Jeff Law <law@redhat.com> writes: > On 06/23/2015 08:57 AM, Richard Sandiford wrote: >> At this point all hash_map traits know what kind of key they're >> dealing with, so we can make that a traits typedef, like it is for >> hash_table traits. Then, if we make the default hash traits for >> T be T, we can use hash_table-style traits as the first template >> parameter to hash_map, without the need for a third. That is, if >> foo_hash hashes elements of type foo_type: >> >> typedef simple_hashmap_traits <foo_hash> foo_traits; >> hash_map <foo_type, value_type, foo_traits> x; >> >> becomes just: >> >> hash_map <foo_hash, value_type> x; >> >> just like a hash_table of foo_types would be: >> >> hash_table <foo_hash> y; >> >> This patch makes that simplification. >> >> >> gcc/ >> * hash-map-traits.h (simple_hashmap_traits::key_type): New typedef. >> (unbounded_int_hashmap_traits::key_type): Likewise. >> * hash-map.h (hash_map): Get the key type from the traits. >> * hash-traits.h (default_hash_traits): By default, inherit from the >> template parameter. >> * alias.c (alias_set_traits): Delete. >> (alias_set_entry_d::children): Use alias_set_hash as the first >> template parameter. >> (record_alias_subset): Update accordingly. >> * except.c (tree_hash_traits): Delete. >> (type_to_runtime_map): Use tree_hash as the first template parameter. >> (init_eh): Update accordingly. >> * genmatch.c (capture_id_map_hasher): Delete. >> (cid_map_t): Use nofree_string_hash as first template parameter. >> * ipa-icf.h (symbol_compare_hashmap_traits): Delete. >> * ipa-icf.c (sem_item_optimizer::subdivide_classes_by_sensitive_refs): >> Use symbol_compare_hash as the first template parameter in >> subdivide_hash_map. >> * mem-stats.h (mem_usage_pair::mem_alloc_hashmap_traits): Delete. >> (mem_usage_pair::mem_map_t): Use mem_location_hash as the first >> template parameter. >> * passes.c (pass_registry_hasher): Delete. >> (name_to_pass_map): Use nofree_string_hash as the first template >> parameter. >> (register_pass_name): Update accordingly. >> * sanopt.c (sanopt_tree_map_traits): Delete. >> (sanopt_tree_triplet_map_traits): Delete. >> (sanopt_ctx::asan_check_map): Use tree_operand_hash as the first >> template parameter. >> (sanopt_ctx::vptr_check_map): Use sanopt_tree_triplet_hash as >> the first template parameter. >> * sese.c (rename_map_hasher): Delete. >> (rename_map_type): Use tree_ssa_name_hash as the first template >> parameter. >> * symbol-summary.h (function_summary::summary_hashmap_traits): Delete. >> (function_summary::m_map): Use map_hash as the first template >> parameter. >> (function_summary::release): Update accordingly. >> * tree-if-conv.c (phi_args_hash_traits): Delete. >> (predicate_scalar_phi): Use tree_operand_hash as the first template >> parameter to phi_arg_map. >> * tree-inline.h (dependence_hasher): Delete. >> (copy_body_data::dependence_map): Use dependence_hash as the first >> template parameter. >> * tree-inline.c (remap_dependence_clique): Update accordingly. >> * tree-ssa-strlen.c (stridxlist_hash_traits): Delete. >> (decl_to_stridxlist_htab): Use tree_decl_hash as the first template >> parameter. >> (addr_stridxptr): Update accordingly. >> * value-prof.c (profile_id_traits): Delete. >> (cgraph_node_map): Use profile_id_hash as the first template >> parameter. >> (init_node_map): Update accordingly. >> * config/alpha/alpha.c (string_traits): Delete. >> (machine_function::links): Use nofree_string_hash as the first >> template parameter. >> (alpha_use_linkage, alpha_write_linkage): Update accordingly. >> * config/m32c/m32c.c (pragma_traits): Delete. >> (pragma_htab): Use nofree_string_hash as the first template parameter. >> (m32c_note_pragma_address): Update accordingly. >> * config/mep/mep.c (pragma_traits): Delete. >> (pragma_htab): Use nofree_string_hash as the first template parameter. >> (mep_note_pragma_flag): Update accordingly. >> * config/mips/mips.c (mips16_flip_traits): Delete. >> (mflip_mips16_htab): Use nofree_string_hash as the first template >> parameter. >> (mflip_mips16_use_mips16_p): Update accordingly. >> (local_alias_traits): Delete. >> (mips16_local_aliases): Use nofree_string_hash as the first template >> parameter. >> (mips16_local_alias): Update accordingly. > Phew. OK. According to a reghunt, this patch broke bootstrap (at least with g++ 4.7 as bootstrap compiler): /vol/gcc/src/hg/trunk/local/gcc/c-family/cilk.c: In function 'void build_wrapper_type(wrapper_data*)': /vol/gcc/src/hg/trunk/local/gcc/c-family/cilk.c:436:77: error: no matching function for call to 'hash_map<tree_node*, tree_node*>::traverse(auto_vec<cilk_decls>*)' /vol/gcc/src/hg/trunk/local/gcc/c-family/cilk.c:436:77: note: candidates are: In file included from /vol/gcc/src/hg/trunk/local/gcc/hash-table.h:553:0, from /vol/gcc/src/hg/trunk/local/gcc/coretypes.h:317, from /vol/gcc/src/hg/trunk/local/gcc/c-family/cilk.c:25: /vol/gcc/src/hg/trunk/local/gcc/hash-map.h:173:8: note: template<class Arg, bool (* f)(tree_node*&, tree_node* const&, Arg)> void hash_map::traverse(Arg) const [with Arg = Arg; bool (* f)(typename Traits::key_type&, const Value&, Arg) = f; KeyId = tree_node*; Value = tree_node*; Traits = simple_hashmap_traits<default_hash_traits<tree_node*> >] /vol/gcc/src/hg/trunk/local/gcc/hash-map.h:173:8: note: template argument deduction/substitution failed: /vol/gcc/src/hg/trunk/local/gcc/c-family/cilk.c:436:77: error: could not convert template argument 'fill_decls_vec' to 'bool (*)(tree_node*&, tree_node* const&, auto_vec<cilk_decls>*)' In file included from /vol/gcc/src/hg/trunk/local/gcc/hash-table.h:553:0, from /vol/gcc/src/hg/trunk/local/gcc/coretypes.h:317, from /vol/gcc/src/hg/trunk/local/gcc/c-family/cilk.c:25: /vol/gcc/src/hg/trunk/local/gcc/hash-map.h:181:8: note: template<class Arg, bool (* f)(tree_node*&, tree_node**, Arg)> void hash_map::traverse(Arg) const [with Arg = Arg; bool (* f)(typename Traits::key_type&, Value*, Arg) = f; KeyId = tree_node*; Value = tree_node*; Traits = simple_hashmap_traits<default_hash_traits<tree_node*> >] /vol/gcc/src/hg/trunk/local/gcc/hash-map.h:181:8: note: template argument deduction/substitution failed: /vol/gcc/src/hg/trunk/local/gcc/c-family/cilk.c:436:77: error: could not convert template argument 'fill_decls_vec' to 'bool (*)(tree_node*&, tree_node**, auto_vec<cilk_decls>*)' /vol/gcc/src/hg/trunk/local/gcc/c-family/cilk.c: In function 'void cilk_outline(tree, tree_node**, void*)': /vol/gcc/src/hg/trunk/local/gcc/c-family/cilk.c:540:77: error: no matching function for call to 'hash_map<tree_node*, tree_node*>::traverse(auto_vec<cilk_decls>*)' /vol/gcc/src/hg/trunk/local/gcc/c-family/cilk.c:540:77: note: candidates are: In file included from /vol/gcc/src/hg/trunk/local/gcc/hash-table.h:553:0, from /vol/gcc/src/hg/trunk/local/gcc/coretypes.h:317, from /vol/gcc/src/hg/trunk/local/gcc/c-family/cilk.c:25: /vol/gcc/src/hg/trunk/local/gcc/hash-map.h:173:8: note: template<class Arg, bool (* f)(tree_node*&, tree_node* const&, Arg)> void hash_map::traverse(Arg) const [with Arg = Arg; bool (* f)(typename Traits::key_type&, const Value&, Arg) = f; KeyId = tree_node*; Value = tree_node*; Traits = simple_hashmap_traits<default_hash_traits<tree_node*> >] /vol/gcc/src/hg/trunk/local/gcc/hash-map.h:173:8: note: template argument deduction/substitution failed: /vol/gcc/src/hg/trunk/local/gcc/c-family/cilk.c:540:77: error: could not convert template argument 'fill_decls_vec' to 'bool (*)(tree_node*&, tree_node* const&, auto_vec<cilk_decls>*)' In file included from /vol/gcc/src/hg/trunk/local/gcc/hash-table.h:553:0, from /vol/gcc/src/hg/trunk/local/gcc/coretypes.h:317, from /vol/gcc/src/hg/trunk/local/gcc/c-family/cilk.c:25: /vol/gcc/src/hg/trunk/local/gcc/hash-map.h:181:8: note: template<class Arg, bool (* f)(tree_node*&, tree_node**, Arg)> void hash_map::traverse(Arg) const [with Arg = Arg; bool (* f)(typename Traits::key_type&, Value*, Arg) = f; KeyId = tree_node*; Value = tree_node*; Traits = simple_hashmap_traits<default_hash_traits<tree_node*> >] /vol/gcc/src/hg/trunk/local/gcc/hash-map.h:181:8: note: template argument deduction/substitution failed: /vol/gcc/src/hg/trunk/local/gcc/c-family/cilk.c:540:77: error: could not convert template argument 'fill_decls_vec' to 'bool (*)(tree_node*&, tree_node**, auto_vec<cilk_decls>*)' /vol/gcc/src/hg/trunk/local/gcc/c-family/cilk.c: In function 'tree_node* create_cilk_wrapper(tree, tree_node**)': /vol/gcc/src/hg/trunk/local/gcc/c-family/cilk.c:747:76: error: no matching function for call to 'hash_map<tree_node*, tree_node*>::traverse(auto_vec<cilk_decls>*)' /vol/gcc/src/hg/trunk/local/gcc/c-family/cilk.c:747:76: note: candidates are: In file included from /vol/gcc/src/hg/trunk/local/gcc/hash-table.h:553:0, from /vol/gcc/src/hg/trunk/local/gcc/coretypes.h:317, from /vol/gcc/src/hg/trunk/local/gcc/c-family/cilk.c:25: /vol/gcc/src/hg/trunk/local/gcc/hash-map.h:173:8: note: template<class Arg, bool (* f)(tree_node*&, tree_node* const&, Arg)> void hash_map::traverse(Arg) const [with Arg = Arg; bool (* f)(typename Traits::key_type&, const Value&, Arg) = f; KeyId = tree_node*; Value = tree_node*; Traits = simple_hashmap_traits<default_hash_traits<tree_node*> >] /vol/gcc/src/hg/trunk/local/gcc/hash-map.h:173:8: note: template argument deduction/substitution failed: /vol/gcc/src/hg/trunk/local/gcc/c-family/cilk.c:747:76: error: could not convert template argument 'fill_decls_vec' to 'bool (*)(tree_node*&, tree_node* const&, auto_vec<cilk_decls>*)' In file included from /vol/gcc/src/hg/trunk/local/gcc/hash-table.h:553:0, from /vol/gcc/src/hg/trunk/local/gcc/coretypes.h:317, from /vol/gcc/src/hg/trunk/local/gcc/c-family/cilk.c:25: /vol/gcc/src/hg/trunk/local/gcc/hash-map.h:181:8: note: template<class Arg, bool (* f)(tree_node*&, tree_node**, Arg)> void hash_map::traverse(Arg) const [with Arg = Arg; bool (* f)(typename Traits::key_type&, Value*, Arg) = f; KeyId = tree_node*; Value = tree_node*; Traits = simple_hashmap_traits<default_hash_traits<tree_node*> >] /vol/gcc/src/hg/trunk/local/gcc/hash-map.h:181:8: note: template argument deduction/substitution failed: /vol/gcc/src/hg/trunk/local/gcc/c-family/cilk.c:747:76: error: could not convert template argument 'fill_decls_vec' to 'bool (*)(tree_node*&, tree_node**, auto_vec<cilk_decls>*)' make: *** [c-family/cilk.o] Error 1 Rainer
On Tue, 2015-06-23 15:57:48 +0100, Richard Sandiford <richard.sandiford@arm.com> wrote: > At this point all hash_map traits know what kind of key they're > dealing with, so we can make that a traits typedef, like it is for > hash_table traits. Then, if we make the default hash traits for > T be T, we can use hash_table-style traits as the first template > parameter to hash_map, without the need for a third. That is, if > foo_hash hashes elements of type foo_type: > > typedef simple_hashmap_traits <foo_hash> foo_traits; > hash_map <foo_type, value_type, foo_traits> x; > > becomes just: > > hash_map <foo_hash, value_type> x; > > just like a hash_table of foo_types would be: > > hash_table <foo_hash> y; > > This patch makes that simplification. One of the patches around yours, and I guess it's specifically this one, makes g++ (GCC) 4.7.2 20121109 (Red Hat 4.7.2-8) (on gcc110.fsffrance.org) unhappy: g++ -fno-PIE -c -DIN_GCC_FRONTEND -DIN_GCC_FRONTEND -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -fno-common -DHAVE_CONFIG_H -I. -Ic-family -I/home/jbglaw/repos/gcc/gcc -I/home/jbglaw/repos/gcc/gcc/c-family -I/home/jbglaw/repos/gcc/gcc/../include -I/home/jbglaw/repos/gcc/gcc/../libcpp/include -I/home/jbglaw/repos/gcc/gcc/../libdecnumber -I/home/jbglaw/repos/gcc/gcc/../libdecnumber/dpd -I../libdecnumber -I/home/jbglaw/repos/gcc/gcc/../libbacktrace -o c-family/cilk.o -MT c-family/cilk.o -MMD -MP -MF c-family/.deps/cilk.TPo /home/jbglaw/repos/gcc/gcc/c-family/cilk.c In file included from /home/jbglaw/repos/gcc/gcc/coretypes.h:319:0, from /home/jbglaw/repos/gcc/gcc/c-family/cilk.c:25: /home/jbglaw/repos/gcc/gcc/input.h:37:12: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] /home/jbglaw/repos/gcc/gcc/c-family/cilk.c: In function ‘void build_wrapper_type(wrapper_data*)’: /home/jbglaw/repos/gcc/gcc/c-family/cilk.c:438:77: error: no matching function for call to ‘hash_map<tree_node*, tree_node*>::traverse(auto_vec<cilk_decls>*)’ /home/jbglaw/repos/gcc/gcc/c-family/cilk.c:438:77: note: candidates are: In file included from /home/jbglaw/repos/gcc/gcc/hash-table.h:553:0, from /home/jbglaw/repos/gcc/gcc/coretypes.h:317, from /home/jbglaw/repos/gcc/gcc/c-family/cilk.c:25: /home/jbglaw/repos/gcc/gcc/hash-map.h:173:8: note: template<class Arg, bool (* f)(tree_node*&, tree_node* const&, Arg)> void hash_map::traverse(Arg) const [with Arg = Arg; bool (* f)(typename Traits::key_type&, const Value&, Arg) = f; KeyId = tree_node*; Value = tree_node*; Traits = simple_hashmap_traits<default_hash_traits<tree_node*> >] /home/jbglaw/repos/gcc/gcc/hash-map.h:173:8: note: template argument deduction/substitution failed: /home/jbglaw/repos/gcc/gcc/c-family/cilk.c:438:77: error: could not convert template argument ‘fill_decls_vec’ to ‘bool (*)(tree_node*&, tree_node* const&, auto_vec<cilk_decls>*)’ In file included from /home/jbglaw/repos/gcc/gcc/hash-table.h:553:0, from /home/jbglaw/repos/gcc/gcc/coretypes.h:317, from /home/jbglaw/repos/gcc/gcc/c-family/cilk.c:25: /home/jbglaw/repos/gcc/gcc/hash-map.h:181:8: note: template<class Arg, bool (* f)(tree_node*&, tree_node**, Arg)> void hash_map::traverse(Arg) const [with Arg = Arg; bool (* f)(typename Traits::key_type&, Value*, Arg) = f; KeyId = tree_node*; Value = tree_node*; Traits = simple_hashmap_traits<default_hash_traits<tree_node*> >] /home/jbglaw/repos/gcc/gcc/hash-map.h:181:8: note: template argument deduction/substitution failed: /home/jbglaw/repos/gcc/gcc/c-family/cilk.c:438:77: error: could not convert template argument ‘fill_decls_vec’ to ‘bool (*)(tree_node*&, tree_node**, auto_vec<cilk_decls>*)’ /home/jbglaw/repos/gcc/gcc/c-family/cilk.c: In function ‘void cilk_outline(tree, tree_node**, void*)’: /home/jbglaw/repos/gcc/gcc/c-family/cilk.c:542:77: error: no matching function for call to ‘hash_map<tree_node*, tree_node*>::traverse(auto_vec<cilk_decls>*)’ /home/jbglaw/repos/gcc/gcc/c-family/cilk.c:542:77: note: candidates are: In file included from /home/jbglaw/repos/gcc/gcc/hash-table.h:553:0, from /home/jbglaw/repos/gcc/gcc/coretypes.h:317, from /home/jbglaw/repos/gcc/gcc/c-family/cilk.c:25: /home/jbglaw/repos/gcc/gcc/hash-map.h:173:8: note: template<class Arg, bool (* f)(tree_node*&, tree_node* const&, Arg)> void hash_map::traverse(Arg) const [with Arg = Arg; bool (* f)(typename Traits::key_type&, const Value&, Arg) = f; KeyId = tree_node*; Value = tree_node*; Traits = simple_hashmap_traits<default_hash_traits<tree_node*> >] /home/jbglaw/repos/gcc/gcc/hash-map.h:173:8: note: template argument deduction/substitution failed: /home/jbglaw/repos/gcc/gcc/c-family/cilk.c:542:77: error: could not convert template argument ‘fill_decls_vec’ to ‘bool (*)(tree_node*&, tree_node* const&, auto_vec<cilk_decls>*)’ In file included from /home/jbglaw/repos/gcc/gcc/hash-table.h:553:0, from /home/jbglaw/repos/gcc/gcc/coretypes.h:317, from /home/jbglaw/repos/gcc/gcc/c-family/cilk.c:25: /home/jbglaw/repos/gcc/gcc/hash-map.h:181:8: note: template<class Arg, bool (* f)(tree_node*&, tree_node**, Arg)> void hash_map::traverse(Arg) const [with Arg = Arg; bool (* f)(typename Traits::key_type&, Value*, Arg) = f; KeyId = tree_node*; Value = tree_node*; Traits = simple_hashmap_traits<default_hash_traits<tree_node*> >] /home/jbglaw/repos/gcc/gcc/hash-map.h:181:8: note: template argument deduction/substitution failed: /home/jbglaw/repos/gcc/gcc/c-family/cilk.c:542:77: error: could not convert template argument ‘fill_decls_vec’ to ‘bool (*)(tree_node*&, tree_node**, auto_vec<cilk_decls>*)’ /home/jbglaw/repos/gcc/gcc/c-family/cilk.c: In function ‘tree_node* create_cilk_wrapper(tree, tree_node**)’: /home/jbglaw/repos/gcc/gcc/c-family/cilk.c:749:76: error: no matching function for call to ‘hash_map<tree_node*, tree_node*>::traverse(auto_vec<cilk_decls>*)’ /home/jbglaw/repos/gcc/gcc/c-family/cilk.c:749:76: note: candidates are: In file included from /home/jbglaw/repos/gcc/gcc/hash-table.h:553:0, from /home/jbglaw/repos/gcc/gcc/coretypes.h:317, from /home/jbglaw/repos/gcc/gcc/c-family/cilk.c:25: /home/jbglaw/repos/gcc/gcc/hash-map.h:173:8: note: template<class Arg, bool (* f)(tree_node*&, tree_node* const&, Arg)> void hash_map::traverse(Arg) const [with Arg = Arg; bool (* f)(typename Traits::key_type&, const Value&, Arg) = f; KeyId = tree_node*; Value = tree_node*; Traits = simple_hashmap_traits<default_hash_traits<tree_node*> >] /home/jbglaw/repos/gcc/gcc/hash-map.h:173:8: note: template argument deduction/substitution failed: /home/jbglaw/repos/gcc/gcc/c-family/cilk.c:749:76: error: could not convert template argument ‘fill_decls_vec’ to ‘bool (*)(tree_node*&, tree_node* const&, auto_vec<cilk_decls>*)’ In file included from /home/jbglaw/repos/gcc/gcc/hash-table.h:553:0, from /home/jbglaw/repos/gcc/gcc/coretypes.h:317, from /home/jbglaw/repos/gcc/gcc/c-family/cilk.c:25: /home/jbglaw/repos/gcc/gcc/hash-map.h:181:8: note: template<class Arg, bool (* f)(tree_node*&, tree_node**, Arg)> void hash_map::traverse(Arg) const [with Arg = Arg; bool (* f)(typename Traits::key_type&, Value*, Arg) = f; KeyId = tree_node*; Value = tree_node*; Traits = simple_hashmap_traits<default_hash_traits<tree_node*> >] /home/jbglaw/repos/gcc/gcc/hash-map.h:181:8: note: template argument deduction/substitution failed: /home/jbglaw/repos/gcc/gcc/c-family/cilk.c:749:76: error: could not convert template argument ‘fill_decls_vec’ to ‘bool (*)(tree_node*&, tree_node**, auto_vec<cilk_decls>*)’ make[1]: *** [c-family/cilk.o] Error 1 make[1]: Leaving directory `/home/jbglaw/build/cris/build-gcc/gcc' make: *** [all-gcc] Error 2 See eg. http://toolchain.lug-owl.de/buildbot/show_build_details.php?id=448826 MfG, JBG
Rainer Orth <ro@cebitec.uni-bielefeld.de> writes: > Jeff Law <law@redhat.com> writes: > >> On 06/23/2015 08:57 AM, Richard Sandiford wrote: >>> At this point all hash_map traits know what kind of key they're >>> dealing with, so we can make that a traits typedef, like it is for >>> hash_table traits. Then, if we make the default hash traits for >>> T be T, we can use hash_table-style traits as the first template >>> parameter to hash_map, without the need for a third. That is, if >>> foo_hash hashes elements of type foo_type: >>> >>> typedef simple_hashmap_traits <foo_hash> foo_traits; >>> hash_map <foo_type, value_type, foo_traits> x; >>> >>> becomes just: >>> >>> hash_map <foo_hash, value_type> x; >>> >>> just like a hash_table of foo_types would be: >>> >>> hash_table <foo_hash> y; >>> >>> This patch makes that simplification. >>> >>> >>> gcc/ >>> * hash-map-traits.h (simple_hashmap_traits::key_type): New typedef. >>> (unbounded_int_hashmap_traits::key_type): Likewise. >>> * hash-map.h (hash_map): Get the key type from the traits. >>> * hash-traits.h (default_hash_traits): By default, inherit from the >>> template parameter. >>> * alias.c (alias_set_traits): Delete. >>> (alias_set_entry_d::children): Use alias_set_hash as the first >>> template parameter. >>> (record_alias_subset): Update accordingly. >>> * except.c (tree_hash_traits): Delete. >>> (type_to_runtime_map): Use tree_hash as the first template parameter. >>> (init_eh): Update accordingly. >>> * genmatch.c (capture_id_map_hasher): Delete. >>> (cid_map_t): Use nofree_string_hash as first template parameter. >>> * ipa-icf.h (symbol_compare_hashmap_traits): Delete. >>> * ipa-icf.c (sem_item_optimizer::subdivide_classes_by_sensitive_refs): >>> Use symbol_compare_hash as the first template parameter in >>> subdivide_hash_map. >>> * mem-stats.h (mem_usage_pair::mem_alloc_hashmap_traits): Delete. >>> (mem_usage_pair::mem_map_t): Use mem_location_hash as the first >>> template parameter. >>> * passes.c (pass_registry_hasher): Delete. >>> (name_to_pass_map): Use nofree_string_hash as the first template >>> parameter. >>> (register_pass_name): Update accordingly. >>> * sanopt.c (sanopt_tree_map_traits): Delete. >>> (sanopt_tree_triplet_map_traits): Delete. >>> (sanopt_ctx::asan_check_map): Use tree_operand_hash as the first >>> template parameter. >>> (sanopt_ctx::vptr_check_map): Use sanopt_tree_triplet_hash as >>> the first template parameter. >>> * sese.c (rename_map_hasher): Delete. >>> (rename_map_type): Use tree_ssa_name_hash as the first template >>> parameter. >>> * symbol-summary.h (function_summary::summary_hashmap_traits): Delete. >>> (function_summary::m_map): Use map_hash as the first template >>> parameter. >>> (function_summary::release): Update accordingly. >>> * tree-if-conv.c (phi_args_hash_traits): Delete. >>> (predicate_scalar_phi): Use tree_operand_hash as the first template >>> parameter to phi_arg_map. >>> * tree-inline.h (dependence_hasher): Delete. >>> (copy_body_data::dependence_map): Use dependence_hash as the first >>> template parameter. >>> * tree-inline.c (remap_dependence_clique): Update accordingly. >>> * tree-ssa-strlen.c (stridxlist_hash_traits): Delete. >>> (decl_to_stridxlist_htab): Use tree_decl_hash as the first template >>> parameter. >>> (addr_stridxptr): Update accordingly. >>> * value-prof.c (profile_id_traits): Delete. >>> (cgraph_node_map): Use profile_id_hash as the first template >>> parameter. >>> (init_node_map): Update accordingly. >>> * config/alpha/alpha.c (string_traits): Delete. >>> (machine_function::links): Use nofree_string_hash as the first >>> template parameter. >>> (alpha_use_linkage, alpha_write_linkage): Update accordingly. >>> * config/m32c/m32c.c (pragma_traits): Delete. >>> (pragma_htab): Use nofree_string_hash as the first template parameter. >>> (m32c_note_pragma_address): Update accordingly. >>> * config/mep/mep.c (pragma_traits): Delete. >>> (pragma_htab): Use nofree_string_hash as the first template parameter. >>> (mep_note_pragma_flag): Update accordingly. >>> * config/mips/mips.c (mips16_flip_traits): Delete. >>> (mflip_mips16_htab): Use nofree_string_hash as the first template >>> parameter. >>> (mflip_mips16_use_mips16_p): Update accordingly. >>> (local_alias_traits): Delete. >>> (mips16_local_aliases): Use nofree_string_hash as the first template >>> parameter. >>> (mips16_local_alias): Update accordingly. >> Phew. OK. > > According to a reghunt, this patch broke bootstrap (at least with g++ > 4.7 as bootstrap compiler): Which target are you using? I just tried with a gcc 4.7 host compiler on x86_64-linux-gnu and it seemed to work. Thanks, Richard
On Fri, 2015-06-26 15:36:01 +0100, Richard Sandiford <richard.sandiford@arm.com> wrote: > Rainer Orth <ro@cebitec.uni-bielefeld.de> writes: > > Jeff Law <law@redhat.com> writes: > > > On 06/23/2015 08:57 AM, Richard Sandiford wrote: > > > > At this point all hash_map traits know what kind of key they're > > > > dealing with, so we can make that a traits typedef, like it is for > > > > hash_table traits. Then, if we make the default hash traits for > > > > T be T, we can use hash_table-style traits as the first template > > > > parameter to hash_map, without the need for a third. That is, if > > > > foo_hash hashes elements of type foo_type: [...] > > According to a reghunt, this patch broke bootstrap (at least with g++ > > 4.7 as bootstrap compiler): > > Which target are you using? I just tried with a gcc 4.7 host compiler > on x86_64-linux-gnu and it seemed to work. It's with all targets, see http://toolchain.lug-owl.de/buildbot/timeline.php MfG, JBG
Richard Sandiford <richard.sandiford@arm.com> writes: > Rainer Orth <ro@cebitec.uni-bielefeld.de> writes: >> Jeff Law <law@redhat.com> writes: >> >>> On 06/23/2015 08:57 AM, Richard Sandiford wrote: >>>> At this point all hash_map traits know what kind of key they're >>>> dealing with, so we can make that a traits typedef, like it is for >>>> hash_table traits. Then, if we make the default hash traits for >>>> T be T, we can use hash_table-style traits as the first template >>>> parameter to hash_map, without the need for a third. That is, if >>>> foo_hash hashes elements of type foo_type: >>>> >>>> typedef simple_hashmap_traits <foo_hash> foo_traits; >>>> hash_map <foo_type, value_type, foo_traits> x; >>>> >>>> becomes just: >>>> >>>> hash_map <foo_hash, value_type> x; >>>> >>>> just like a hash_table of foo_types would be: >>>> >>>> hash_table <foo_hash> y; >>>> >>>> This patch makes that simplification. >>>> >>>> >>>> gcc/ >>>> * hash-map-traits.h (simple_hashmap_traits::key_type): New typedef. >>>> (unbounded_int_hashmap_traits::key_type): Likewise. >>>> * hash-map.h (hash_map): Get the key type from the traits. >>>> * hash-traits.h (default_hash_traits): By default, inherit from the >>>> template parameter. >>>> * alias.c (alias_set_traits): Delete. >>>> (alias_set_entry_d::children): Use alias_set_hash as the first >>>> template parameter. >>>> (record_alias_subset): Update accordingly. >>>> * except.c (tree_hash_traits): Delete. >>>> (type_to_runtime_map): Use tree_hash as the first template parameter. >>>> (init_eh): Update accordingly. >>>> * genmatch.c (capture_id_map_hasher): Delete. >>>> (cid_map_t): Use nofree_string_hash as first template parameter. >>>> * ipa-icf.h (symbol_compare_hashmap_traits): Delete. >>>> * ipa-icf.c (sem_item_optimizer::subdivide_classes_by_sensitive_refs): >>>> Use symbol_compare_hash as the first template parameter in >>>> subdivide_hash_map. >>>> * mem-stats.h (mem_usage_pair::mem_alloc_hashmap_traits): Delete. >>>> (mem_usage_pair::mem_map_t): Use mem_location_hash as the first >>>> template parameter. >>>> * passes.c (pass_registry_hasher): Delete. >>>> (name_to_pass_map): Use nofree_string_hash as the first template >>>> parameter. >>>> (register_pass_name): Update accordingly. >>>> * sanopt.c (sanopt_tree_map_traits): Delete. >>>> (sanopt_tree_triplet_map_traits): Delete. >>>> (sanopt_ctx::asan_check_map): Use tree_operand_hash as the first >>>> template parameter. >>>> (sanopt_ctx::vptr_check_map): Use sanopt_tree_triplet_hash as >>>> the first template parameter. >>>> * sese.c (rename_map_hasher): Delete. >>>> (rename_map_type): Use tree_ssa_name_hash as the first template >>>> parameter. >>>> * symbol-summary.h (function_summary::summary_hashmap_traits): Delete. >>>> (function_summary::m_map): Use map_hash as the first template >>>> parameter. >>>> (function_summary::release): Update accordingly. >>>> * tree-if-conv.c (phi_args_hash_traits): Delete. >>>> (predicate_scalar_phi): Use tree_operand_hash as the first template >>>> parameter to phi_arg_map. >>>> * tree-inline.h (dependence_hasher): Delete. >>>> (copy_body_data::dependence_map): Use dependence_hash as the first >>>> template parameter. >>>> * tree-inline.c (remap_dependence_clique): Update accordingly. >>>> * tree-ssa-strlen.c (stridxlist_hash_traits): Delete. >>>> (decl_to_stridxlist_htab): Use tree_decl_hash as the first template >>>> parameter. >>>> (addr_stridxptr): Update accordingly. >>>> * value-prof.c (profile_id_traits): Delete. >>>> (cgraph_node_map): Use profile_id_hash as the first template >>>> parameter. >>>> (init_node_map): Update accordingly. >>>> * config/alpha/alpha.c (string_traits): Delete. >>>> (machine_function::links): Use nofree_string_hash as the first >>>> template parameter. >>>> (alpha_use_linkage, alpha_write_linkage): Update accordingly. >>>> * config/m32c/m32c.c (pragma_traits): Delete. >>>> (pragma_htab): Use nofree_string_hash as the first template parameter. >>>> (m32c_note_pragma_address): Update accordingly. >>>> * config/mep/mep.c (pragma_traits): Delete. >>>> (pragma_htab): Use nofree_string_hash as the first template parameter. >>>> (mep_note_pragma_flag): Update accordingly. >>>> * config/mips/mips.c (mips16_flip_traits): Delete. >>>> (mflip_mips16_htab): Use nofree_string_hash as the first template >>>> parameter. >>>> (mflip_mips16_use_mips16_p): Update accordingly. >>>> (local_alias_traits): Delete. >>>> (mips16_local_aliases): Use nofree_string_hash as the first template >>>> parameter. >>>> (mips16_local_alias): Update accordingly. >>> Phew. OK. >> >> According to a reghunt, this patch broke bootstrap (at least with g++ >> 4.7 as bootstrap compiler): > > Which target are you using? I just tried with a gcc 4.7 host compiler > on x86_64-linux-gnu and it seemed to work. I see it on i386-pc-solaris2.1[01] and sparc-sun-solaris2.1[01]. gcc 4.9 works there, though. Rainer
Rainer Orth <ro@cebitec.uni-bielefeld.de> writes: > Richard Sandiford <richard.sandiford@arm.com> writes: > >> Rainer Orth <ro@cebitec.uni-bielefeld.de> writes: >>> Jeff Law <law@redhat.com> writes: >>> >>>> On 06/23/2015 08:57 AM, Richard Sandiford wrote: >>>>> At this point all hash_map traits know what kind of key they're >>>>> dealing with, so we can make that a traits typedef, like it is for >>>>> hash_table traits. Then, if we make the default hash traits for >>>>> T be T, we can use hash_table-style traits as the first template >>>>> parameter to hash_map, without the need for a third. That is, if >>>>> foo_hash hashes elements of type foo_type: >>>>> >>>>> typedef simple_hashmap_traits <foo_hash> foo_traits; >>>>> hash_map <foo_type, value_type, foo_traits> x; >>>>> >>>>> becomes just: >>>>> >>>>> hash_map <foo_hash, value_type> x; >>>>> >>>>> just like a hash_table of foo_types would be: >>>>> >>>>> hash_table <foo_hash> y; >>>>> >>>>> This patch makes that simplification. >>>>> >>>>> >>>>> gcc/ >>>>> * hash-map-traits.h (simple_hashmap_traits::key_type): New typedef. >>>>> (unbounded_int_hashmap_traits::key_type): Likewise. >>>>> * hash-map.h (hash_map): Get the key type from the traits. >>>>> * hash-traits.h (default_hash_traits): By default, inherit from the >>>>> template parameter. >>>>> * alias.c (alias_set_traits): Delete. >>>>> (alias_set_entry_d::children): Use alias_set_hash as the first >>>>> template parameter. >>>>> (record_alias_subset): Update accordingly. >>>>> * except.c (tree_hash_traits): Delete. >>>>> (type_to_runtime_map): Use tree_hash as the first template parameter. >>>>> (init_eh): Update accordingly. >>>>> * genmatch.c (capture_id_map_hasher): Delete. >>>>> (cid_map_t): Use nofree_string_hash as first template parameter. >>>>> * ipa-icf.h (symbol_compare_hashmap_traits): Delete. >>>>> * ipa-icf.c (sem_item_optimizer::subdivide_classes_by_sensitive_refs): >>>>> Use symbol_compare_hash as the first template parameter in >>>>> subdivide_hash_map. >>>>> * mem-stats.h (mem_usage_pair::mem_alloc_hashmap_traits): Delete. >>>>> (mem_usage_pair::mem_map_t): Use mem_location_hash as the first >>>>> template parameter. >>>>> * passes.c (pass_registry_hasher): Delete. >>>>> (name_to_pass_map): Use nofree_string_hash as the first template >>>>> parameter. >>>>> (register_pass_name): Update accordingly. >>>>> * sanopt.c (sanopt_tree_map_traits): Delete. >>>>> (sanopt_tree_triplet_map_traits): Delete. >>>>> (sanopt_ctx::asan_check_map): Use tree_operand_hash as the first >>>>> template parameter. >>>>> (sanopt_ctx::vptr_check_map): Use sanopt_tree_triplet_hash as >>>>> the first template parameter. >>>>> * sese.c (rename_map_hasher): Delete. >>>>> (rename_map_type): Use tree_ssa_name_hash as the first template >>>>> parameter. >>>>> * symbol-summary.h (function_summary::summary_hashmap_traits): Delete. >>>>> (function_summary::m_map): Use map_hash as the first template >>>>> parameter. >>>>> (function_summary::release): Update accordingly. >>>>> * tree-if-conv.c (phi_args_hash_traits): Delete. >>>>> (predicate_scalar_phi): Use tree_operand_hash as the first template >>>>> parameter to phi_arg_map. >>>>> * tree-inline.h (dependence_hasher): Delete. >>>>> (copy_body_data::dependence_map): Use dependence_hash as the first >>>>> template parameter. >>>>> * tree-inline.c (remap_dependence_clique): Update accordingly. >>>>> * tree-ssa-strlen.c (stridxlist_hash_traits): Delete. >>>>> (decl_to_stridxlist_htab): Use tree_decl_hash as the first template >>>>> parameter. >>>>> (addr_stridxptr): Update accordingly. >>>>> * value-prof.c (profile_id_traits): Delete. >>>>> (cgraph_node_map): Use profile_id_hash as the first template >>>>> parameter. >>>>> (init_node_map): Update accordingly. >>>>> * config/alpha/alpha.c (string_traits): Delete. >>>>> (machine_function::links): Use nofree_string_hash as the first >>>>> template parameter. >>>>> (alpha_use_linkage, alpha_write_linkage): Update accordingly. >>>>> * config/m32c/m32c.c (pragma_traits): Delete. >>>>> (pragma_htab): Use nofree_string_hash as the first template parameter. >>>>> (m32c_note_pragma_address): Update accordingly. >>>>> * config/mep/mep.c (pragma_traits): Delete. >>>>> (pragma_htab): Use nofree_string_hash as the first template parameter. >>>>> (mep_note_pragma_flag): Update accordingly. >>>>> * config/mips/mips.c (mips16_flip_traits): Delete. >>>>> (mflip_mips16_htab): Use nofree_string_hash as the first template >>>>> parameter. >>>>> (mflip_mips16_use_mips16_p): Update accordingly. >>>>> (local_alias_traits): Delete. >>>>> (mips16_local_aliases): Use nofree_string_hash as the first template >>>>> parameter. >>>>> (mips16_local_alias): Update accordingly. >>>> Phew. OK. >>> >>> According to a reghunt, this patch broke bootstrap (at least with g++ >>> 4.7 as bootstrap compiler): >> >> Which target are you using? I just tried with a gcc 4.7 host compiler >> on x86_64-linux-gnu and it seemed to work. > > I see it on i386-pc-solaris2.1[01] and sparc-sun-solaris2.1[01]. > > gcc 4.9 works there, though. OK, I can reproduce it with 4.7.2 but it seems to be fixed in 4.7.4. Trying to find out what changed as well as find a workaround. Thanks, Richard
On 06/26/2015 04:37 PM, Rainer Orth wrote: > /vol/gcc/src/hg/trunk/local/gcc/hash-map.h:173:8: note: template<class Arg, bool (* f)(tree_node*&, tree_node* const&, Arg)> void hash_map::traverse(Arg) const [with Arg = Arg; bool (* f)(typename Traits::key_type&, const Value&, Arg) = f; KeyId = tree_node*; Value = tree_node*; Traits = simple_hashmap_traits<default_hash_traits<tree_node*> >] > /vol/gcc/src/hg/trunk/local/gcc/hash-map.h:173:8: note: template argument deduction/substitution failed: > /vol/gcc/src/hg/trunk/local/gcc/c-family/cilk.c:747:76: error: could not convert template argument 'fill_decls_vec' to 'bool (*)(tree_node*&, tree_node* const&, auto_vec<cilk_decls>*)' > In file included from /vol/gcc/src/hg/trunk/local/gcc/hash-table.h:553:0, > from /vol/gcc/src/hg/trunk/local/gcc/coretypes.h:317, > from /vol/gcc/src/hg/trunk/local/gcc/c-family/cilk.c:25: > /vol/gcc/src/hg/trunk/local/gcc/hash-map.h:181:8: note: template<class Arg, bool (* f)(tree_node*&, tree_node**, Arg)> void hash_map::traverse(Arg) const [with Arg = Arg; bool (* f)(typename Traits::key_type&, Value*, Arg) = f; KeyId = tree_node*; Value = tree_node*; Traits = simple_hashmap_traits<default_hash_traits<tree_node*> >] > /vol/gcc/src/hg/trunk/local/gcc/hash-map.h:181:8: note: template argument deduction/substitution failed: > /vol/gcc/src/hg/trunk/local/gcc/c-family/cilk.c:747:76: error: could not convert template argument 'fill_decls_vec' to 'bool (*)(tree_node*&, tree_node**, auto_vec<cilk_decls>*)' > make: *** [c-family/cilk.o] Error 1 > > Rainer > It seems that I can also reproduce this issue. The following code was reduced from GCC r224910, genmatch.c: $ cat ./test2.ii template <typename Descriptor, template <typename> class> class hash_table { typedef typename Descriptor::value_type value_type; template <typename Argument, int (*)(value_type *, Argument)> void traverse(Argument); }; template <typename Descriptor, template <typename> class Allocator> template < typename Argument, int (*)(typename hash_table<Descriptor, Allocator>::value_type *, Argument)> void hash_table<Descriptor, Allocator>::traverse(Argument) {} It is accepted by current GCC and Clang but rejected by EDG: $ /opt/intel/bin/icpc -V Intel(R) C++ Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 15.0.3.187 Build 20150407 Copyright (C) 1985-2015 Intel Corporation. All rights reserved. FOR NON-COMMERCIAL USE ONLY $ /opt/intel/bin/icpc -c ./test2.ii ./test2.ii(11): error: declaration is incompatible with function template "void hash_table<Descriptor, <unnamed>>::traverse<Argument,<unnamed>>(Argument)" (declared at line 4) void hash_table<Descriptor, Allocator>::traverse(Argument) {} ^ compilation aborted for ./test2.ii (code 2)
Index: gcc/hash-map-traits.h =================================================================== --- gcc/hash-map-traits.h 2015-06-23 15:56:38.990174759 +0100 +++ gcc/hash-map-traits.h 2015-06-23 15:56:38.986174805 +0100 @@ -31,9 +31,9 @@ #define HASH_MAP_TRAITS_H template <typename H> struct simple_hashmap_traits { - static inline hashval_t hash (const typename H::value_type &); - static inline bool equal_keys (const typename H::value_type &, - const typename H::value_type &); + typedef typename H::value_type key_type; + static inline hashval_t hash (const key_type &); + static inline bool equal_keys (const key_type &, const key_type &); template <typename T> static inline void remove (T &); template <typename T> static inline bool is_empty (const T &); template <typename T> static inline bool is_deleted (const T &); @@ -43,15 +43,14 @@ struct simple_hashmap_traits template <typename H> inline hashval_t -simple_hashmap_traits <H>::hash (const typename H::value_type &h) +simple_hashmap_traits <H>::hash (const key_type &h) { return H::hash (h); } template <typename H> inline bool -simple_hashmap_traits <H>::equal_keys (const typename H::value_type &k1, - const typename H::value_type &k2) +simple_hashmap_traits <H>::equal_keys (const key_type &k1, const key_type &k2) { return H::equal (k1, k2); } @@ -158,6 +157,7 @@ unbounded_hashmap_traits <Value>::mark_d template <typename Key, typename Value> struct unbounded_int_hashmap_traits : unbounded_hashmap_traits <Value> { + typedef Key key_type; static inline hashval_t hash (Key); static inline bool equal_keys (Key, Key); }; Index: gcc/hash-map.h =================================================================== --- gcc/hash-map.h 2015-06-23 15:56:38.990174759 +0100 +++ gcc/hash-map.h 2015-06-23 15:56:38.986174805 +0100 @@ -21,10 +21,11 @@ Software Foundation; either version 3, o #ifndef hash_map_h #define hash_map_h -template<typename Key, typename Value, +template<typename KeyId, typename Value, typename Traits> class GTY((user)) hash_map { + typedef typename Traits::key_type Key; struct hash_entry { Key m_key; Index: gcc/hash-traits.h =================================================================== --- gcc/hash-traits.h 2015-06-23 15:56:38.990174759 +0100 +++ gcc/hash-traits.h 2015-06-23 15:56:38.986174805 +0100 @@ -278,7 +278,7 @@ struct ggc_cache_ptr_hash : pointer_hash struct nofree_string_hash : string_hash, typed_noop_remove <const char *> {}; -template <typename T> struct default_hash_traits; +template <typename T> struct default_hash_traits : T {}; template <typename T> struct default_hash_traits <T *> : ggc_ptr_hash <T> {}; Index: gcc/alias.c =================================================================== --- gcc/alias.c 2015-06-23 15:56:38.990174759 +0100 +++ gcc/alias.c 2015-06-23 15:56:38.974174944 +0100 @@ -144,7 +144,6 @@ Software Foundation; either version 3, o error to attempt to explicitly construct a subset of zero. */ struct alias_set_hash : int_hash <int, INT_MIN, INT_MIN + 1> {}; -struct alias_set_traits : simple_hashmap_traits <alias_set_hash> {}; struct GTY(()) alias_set_entry_d { /* The alias set number, as stored in MEM_ALIAS_SET. */ @@ -157,7 +156,7 @@ struct GTY(()) alias_set_entry_d { continuing our example above, the children here will be all of `int', `double', `float', and `struct S'. */ - hash_map<int, int, alias_set_traits> *children; + hash_map<alias_set_hash, int> *children; /* Nonzero if would have a child of zero: this effectively makes this alias set the same as alias set zero. */ @@ -1136,7 +1135,7 @@ record_alias_subset (alias_set_type supe subset_entry = get_alias_set_entry (subset); if (!superset_entry->children) superset_entry->children - = hash_map<int, int, alias_set_traits>::create_ggc (64); + = hash_map<alias_set_hash, int>::create_ggc (64); /* If there is an entry for the subset, enter all of its children (if they are not already present) as children of the SUPERSET. */ if (subset_entry) @@ -1148,7 +1147,7 @@ record_alias_subset (alias_set_type supe if (subset_entry->children) { - hash_map<int, int, alias_set_traits>::iterator iter + hash_map<alias_set_hash, int>::iterator iter = subset_entry->children->begin (); for (; iter != subset_entry->children->end (); ++iter) superset_entry->children->put ((*iter).first, (*iter).second); Index: gcc/except.c =================================================================== --- gcc/except.c 2015-06-23 15:56:38.990174759 +0100 +++ gcc/except.c 2015-06-23 15:56:38.978174900 +0100 @@ -165,8 +165,7 @@ Software Foundation; either version 3, o static GTY(()) int call_site_base; -struct tree_hash_traits : simple_hashmap_traits <tree_hash> {}; -static GTY (()) hash_map<tree, tree, tree_hash_traits> *type_to_runtime_map; +static GTY (()) hash_map<tree_hash, tree> *type_to_runtime_map; /* Describe the SjLj_Function_Context structure. */ static GTY(()) tree sjlj_fc_type_node; @@ -249,8 +248,7 @@ init_eh (void) if (! flag_exceptions) return; - type_to_runtime_map - = hash_map<tree, tree, tree_hash_traits>::create_ggc (31); + type_to_runtime_map = hash_map<tree_hash, tree>::create_ggc (31); /* Create the SjLj_Function_Context structure. This should match the definition in unwind-sjlj.c. */ Index: gcc/genmatch.c =================================================================== --- gcc/genmatch.c 2015-06-23 15:56:38.990174759 +0100 +++ gcc/genmatch.c 2015-06-23 15:56:38.974174944 +0100 @@ -392,9 +392,7 @@ get_operator (const char *id) return 0; } -typedef simple_hashmap_traits<nofree_string_hash> capture_id_map_hasher; - -typedef hash_map<const char *, unsigned, capture_id_map_hasher> cid_map_t; +typedef hash_map<nofree_string_hash, unsigned> cid_map_t; /* The AST produced by parsing of the pattern definitions. */ Index: gcc/ipa-icf.h =================================================================== --- gcc/ipa-icf.h 2015-06-23 15:56:38.990174759 +0100 +++ gcc/ipa-icf.h 2015-06-23 15:56:38.970174986 +0100 @@ -125,8 +125,6 @@ struct symbol_compare_hash : nofree_ptr_ return true; } }; -typedef simple_hashmap_traits <symbol_compare_hash> - symbol_compare_hashmap_traits; /* Semantic item usage pair. */ Index: gcc/ipa-icf.c =================================================================== --- gcc/ipa-icf.c 2015-06-23 15:56:38.990174759 +0100 +++ gcc/ipa-icf.c 2015-06-23 15:56:38.970174986 +0100 @@ -2911,8 +2911,7 @@ sem_item_optimizer::subdivide_classes_by unsigned sem_item_optimizer::subdivide_classes_by_sensitive_refs () { - typedef hash_map <symbol_compare_collection *, vec <sem_item *>, - symbol_compare_hashmap_traits> subdivide_hash_map; + typedef hash_map <symbol_compare_hash, vec <sem_item *> > subdivide_hash_map; unsigned newly_created_classes = 0; Index: gcc/mem-stats.h =================================================================== --- gcc/mem-stats.h 2015-06-23 15:56:38.990174759 +0100 +++ gcc/mem-stats.h 2015-06-23 15:56:38.974174944 +0100 @@ -260,10 +260,9 @@ struct mem_usage_pair && l1->m_line == l2->m_line; } }; - typedef simple_hashmap_traits<mem_location_hash> mem_alloc_hashmap_traits; /* Internal class type definitions. */ - typedef hash_map <mem_location *, T *, mem_alloc_hashmap_traits> mem_map_t; + typedef hash_map <mem_location_hash, T *> mem_map_t; typedef hash_map <const void *, mem_usage_pair<T> > reverse_mem_map_t; typedef hash_map <const void *, std::pair<T *, size_t> > reverse_object_map_t; typedef std::pair <mem_location *, T *> mem_list_t; Index: gcc/passes.c =================================================================== --- gcc/passes.c 2015-06-23 15:56:38.990174759 +0100 +++ gcc/passes.c 2015-06-23 15:56:38.978174900 +0100 @@ -861,10 +861,7 @@ pass_manager::register_dump_files (opt_p while (pass); } -typedef simple_hashmap_traits<nofree_string_hash> pass_registry_hasher; - -static hash_map<const char *, opt_pass *, pass_registry_hasher> - *name_to_pass_map; +static hash_map<nofree_string_hash, opt_pass *> *name_to_pass_map; /* Register PASS with NAME. */ @@ -872,8 +869,7 @@ typedef simple_hashmap_traits<nofree_str register_pass_name (opt_pass *pass, const char *name) { if (!name_to_pass_map) - name_to_pass_map - = new hash_map<const char *, opt_pass *, pass_registry_hasher> (256); + name_to_pass_map = new hash_map<nofree_string_hash, opt_pass *> (256); if (name_to_pass_map->get (name)) return; /* Ignore plugin passes. */ Index: gcc/sanopt.c =================================================================== --- gcc/sanopt.c 2015-06-23 15:56:38.990174759 +0100 +++ gcc/sanopt.c 2015-06-23 15:56:38.974174944 +0100 @@ -99,8 +99,6 @@ maybe_get_single_definition (tree t) return NULL_TREE; } -typedef simple_hashmap_traits <tree_operand_hash> sanopt_tree_map_traits; - /* Tree triplet for vptr_check_map. */ struct sanopt_tree_triplet { @@ -156,8 +154,6 @@ struct sanopt_tree_triplet_hash : typed_ return ref.t1 == NULL; } }; -typedef simple_hashmap_traits <sanopt_tree_triplet_hash> - sanopt_tree_triplet_map_traits; /* This is used to carry various hash maps and variables used in sanopt_optimize_walker. */ @@ -170,13 +166,12 @@ struct sanopt_ctx /* This map maps a pointer (the second argument of ASAN_CHECK) to a vector of ASAN_CHECK call statements that check the access. */ - hash_map<tree, auto_vec<gimple>, sanopt_tree_map_traits> asan_check_map; + hash_map<tree_operand_hash, auto_vec<gimple> > asan_check_map; /* This map maps a tree triplet (the first, second and fourth argument of UBSAN_VPTR) to a vector of UBSAN_VPTR call statements that check that virtual table pointer. */ - hash_map<sanopt_tree_triplet, auto_vec<gimple>, - sanopt_tree_triplet_map_traits> vptr_check_map; + hash_map<sanopt_tree_triplet_hash, auto_vec<gimple> > vptr_check_map; /* Number of IFN_ASAN_CHECK statements. */ int asan_num_accesses; Index: gcc/sese.c =================================================================== --- gcc/sese.c 2015-06-23 15:56:38.990174759 +0100 +++ gcc/sese.c 2015-06-23 15:56:38.990174759 +0100 @@ -79,8 +79,7 @@ debug_rename_map_1 (tree_node *const &ol return true; } -typedef simple_hashmap_traits<tree_ssa_name_hash> rename_map_hasher; -typedef hash_map<tree, tree, rename_map_hasher> rename_map_type; +typedef hash_map<tree_ssa_name_hash, tree> rename_map_type; /* Print to stderr all the elements of RENAME_MAP. */ Index: gcc/symbol-summary.h =================================================================== --- gcc/symbol-summary.h 2015-06-23 15:56:38.990174759 +0100 +++ gcc/symbol-summary.h 2015-06-23 15:56:38.970174986 +0100 @@ -83,7 +83,7 @@ class GTY((user)) function_summary <T *> m_symtab_duplication_hook = NULL; /* Release all summaries. */ - typedef typename hash_map <int, T *, summary_hashmap_traits>::iterator map_iterator; + typedef typename hash_map <map_hash, T *>::iterator map_iterator; for (map_iterator it = m_map.begin (); it != m_map.end (); ++it) release ((*it).second); } @@ -201,7 +201,6 @@ class GTY((user)) function_summary <T *> private: typedef int_hash <int, 0, -1> map_hash; - typedef simple_hashmap_traits <map_hash> summary_hashmap_traits; /* Getter for summary callgraph ID. */ T* get (int uid) @@ -215,7 +214,7 @@ class GTY((user)) function_summary <T *> } /* Main summary store, where summary ID is used as key. */ - hash_map <int, T *, summary_hashmap_traits> m_map; + hash_map <map_hash, T *> m_map; /* Internal summary insertion hook pointer. */ cgraph_node_hook_list *m_symtab_insertion_hook; /* Internal summary removal hook pointer. */ Index: gcc/tree-if-conv.c =================================================================== --- gcc/tree-if-conv.c 2015-06-23 15:56:38.990174759 +0100 +++ gcc/tree-if-conv.c 2015-06-23 15:56:38.970174986 +0100 @@ -1595,8 +1595,6 @@ convert_scalar_cond_reduction (gimple re return rhs; } -typedef simple_hashmap_traits <tree_operand_hash> phi_args_hash_traits; - /* Produce condition for all occurrences of ARG in PHI node. */ static tree @@ -1747,7 +1745,7 @@ predicate_scalar_phi (gphi *phi, gimple_ /* Create hashmap for PHI node which contain vector of argument indexes having the same value. */ bool swap = false; - hash_map<tree, auto_vec<int>, phi_args_hash_traits> phi_arg_map; + hash_map<tree_operand_hash, auto_vec<int> > phi_arg_map; unsigned int num_args = gimple_phi_num_args (phi); int max_ind = -1; /* Vector of different PHI argument values. */ Index: gcc/tree-inline.h =================================================================== --- gcc/tree-inline.h 2015-06-23 15:56:38.990174759 +0100 +++ gcc/tree-inline.h 2015-06-23 15:56:38.978174900 +0100 @@ -36,7 +36,6 @@ enum copy_body_cge_which }; typedef int_hash <unsigned short, 0> dependence_hash; -typedef simple_hashmap_traits <dependence_hash> dependence_hasher; /* Data required for function body duplication. */ @@ -148,7 +147,7 @@ struct copy_body_data /* A map from the inlined functions dependence info cliques to equivalents in the function into which it is being inlined. */ - hash_map<unsigned short, unsigned short, dependence_hasher> *dependence_map; + hash_map<dependence_hash, unsigned short> *dependence_map; }; /* Weights of constructions for estimate_num_insns. */ Index: gcc/tree-inline.c =================================================================== --- gcc/tree-inline.c 2015-06-23 15:56:38.990174759 +0100 +++ gcc/tree-inline.c 2015-06-23 15:56:38.978174900 +0100 @@ -864,8 +864,7 @@ remap_dependence_clique (copy_body_data if (clique == 0) return 0; if (!id->dependence_map) - id->dependence_map - = new hash_map<unsigned short, unsigned short, dependence_hasher>; + id->dependence_map = new hash_map<dependence_hash, unsigned short>; bool existed; unsigned short &newc = id->dependence_map->get_or_insert (clique, &existed); if (!existed) Index: gcc/tree-ssa-strlen.c =================================================================== --- gcc/tree-ssa-strlen.c 2015-06-23 15:56:38.990174759 +0100 +++ gcc/tree-ssa-strlen.c 2015-06-23 15:56:38.974174944 +0100 @@ -156,12 +156,9 @@ struct decl_stridxlist_map struct stridxlist list; }; -typedef simple_hashmap_traits <tree_decl_hash> stridxlist_hash_traits; - /* Hash table for mapping decls to a chained list of offset -> idx mappings. */ -static hash_map<tree, stridxlist, stridxlist_hash_traits> - *decl_to_stridxlist_htab; +static hash_map<tree_decl_hash, stridxlist> *decl_to_stridxlist_htab; /* Obstack for struct stridxlist and struct decl_stridxlist_map. */ static struct obstack stridx_obstack; @@ -327,7 +324,7 @@ addr_stridxptr (tree exp) if (!decl_to_stridxlist_htab) { decl_to_stridxlist_htab - = new hash_map<tree, stridxlist, stridxlist_hash_traits> (64); + = new hash_map<tree_decl_hash, stridxlist> (64); gcc_obstack_init (&stridx_obstack); } Index: gcc/value-prof.c =================================================================== --- gcc/value-prof.c 2015-06-23 15:56:38.990174759 +0100 +++ gcc/value-prof.c 2015-06-23 15:56:38.986174805 +0100 @@ -1251,10 +1251,8 @@ gimple_mod_subtract_transform (gimple_st } typedef int_hash <unsigned int, 0, UINT_MAX> profile_id_hash; -typedef simple_hashmap_traits <profile_id_hash> profile_id_traits; -static hash_map<unsigned int, cgraph_node *, profile_id_traits> * -cgraph_node_map = 0; +static hash_map<profile_id_hash, cgraph_node *> *cgraph_node_map = 0; /* Returns true if node graph is initialized. This is used to test if profile_id has been created @@ -1274,8 +1272,7 @@ coverage_node_map_initialized_p (void) init_node_map (bool local) { struct cgraph_node *n; - cgraph_node_map - = new hash_map<unsigned int, cgraph_node *, profile_id_traits>; + cgraph_node_map = new hash_map<profile_id_hash, cgraph_node *>; FOR_EACH_DEFINED_FUNCTION (n) if (n->has_gimple_body_p ()) Index: gcc/config/alpha/alpha.c =================================================================== --- gcc/config/alpha/alpha.c 2015-06-23 15:56:38.990174759 +0100 +++ gcc/config/alpha/alpha.c 2015-06-23 15:56:38.982174853 +0100 @@ -4808,8 +4808,6 @@ alpha_multipass_dfa_lookahead (void) struct GTY(()) alpha_links; -typedef simple_hashmap_traits <nofree_string_hash> string_traits; - struct GTY(()) machine_function { /* For flag_reorder_blocks_and_partition. */ @@ -4819,7 +4817,7 @@ struct GTY(()) machine_function bool uses_condition_handler; /* Linkage entries. */ - hash_map<const char *, alpha_links *, string_traits> *links; + hash_map<nofree_string_hash, alpha_links *> *links; }; /* How to allocate a 'struct machine_function'. */ @@ -9546,7 +9544,7 @@ alpha_use_linkage (rtx func, bool lflag, } else cfun->machine->links - = hash_map<const char *, alpha_links *, string_traits>::create_ggc (64); + = hash_map<nofree_string_hash, alpha_links *>::create_ggc (64); if (al == NULL) { @@ -9637,7 +9635,7 @@ alpha_write_linkage (FILE *stream, const if (cfun->machine->links) { - hash_map<const char *, alpha_links *, string_traits>::iterator iter + hash_map<nofree_string_hash, alpha_links *>::iterator iter = cfun->machine->links->begin (); for (; iter != cfun->machine->links->end (); ++iter) alpha_write_one_linkage ((*iter).first, (*iter).second, stream); Index: gcc/config/m32c/m32c.c =================================================================== --- gcc/config/m32c/m32c.c 2015-06-23 15:56:38.990174759 +0100 +++ gcc/config/m32c/m32c.c 2015-06-23 15:56:38.982174853 +0100 @@ -3055,17 +3055,14 @@ m32c_insert_attributes (tree node ATTRIB } } -typedef simple_hashmap_traits<nofree_string_hash> pragma_traits; - /* Hash table of pragma info. */ -static GTY(()) hash_map<const char *, unsigned, pragma_traits> *pragma_htab; +static GTY(()) hash_map<nofree_string_hash, unsigned> *pragma_htab; void m32c_note_pragma_address (const char *varname, unsigned address) { if (!pragma_htab) - pragma_htab - = hash_map<const char *, unsigned, pragma_traits>::create_ggc (31); + pragma_htab = hash_map<nofree_string_hash, unsigned>::create_ggc (31); const char *name = ggc_strdup (varname); unsigned int *slot = &pragma_htab->get_or_insert (name); Index: gcc/config/mep/mep.c =================================================================== --- gcc/config/mep/mep.c 2015-06-23 15:56:38.990174759 +0100 +++ gcc/config/mep/mep.c 2015-06-23 15:56:38.986174805 +0100 @@ -4073,18 +4073,14 @@ struct GTY(()) pragma_entry { int flag; }; -typedef simple_hashmap_traits<nofree_string_hash> pragma_traits; - /* Hash table of farcall-tagged sections. */ -static GTY(()) hash_map<const char *, pragma_entry, pragma_traits> * - pragma_htab; +static GTY(()) hash_map<nofree_string_hash, pragma_entry> *pragma_htab; static void mep_note_pragma_flag (const char *funcname, int flag) { if (!pragma_htab) - pragma_htab - = hash_map<const char *, pragma_entry, pragma_traits>::create_ggc (31); + pragma_htab = hash_map<nofree_string_hash, pragma_entry>::create_ggc (31); bool existed; const char *name = ggc_strdup (funcname); Index: gcc/config/mips/mips.c =================================================================== --- gcc/config/mips/mips.c 2015-06-23 15:56:38.990174759 +0100 +++ gcc/config/mips/mips.c 2015-06-23 15:56:38.986174805 +0100 @@ -1265,12 +1265,9 @@ static int mips_register_move_cost (mach static unsigned int mips_function_arg_boundary (machine_mode, const_tree); static machine_mode mips_get_reg_raw_mode (int regno); -struct mips16_flip_traits : simple_hashmap_traits <nofree_string_hash> {}; - /* This hash table keeps track of implicit "mips16" and "nomips16" attributes for -mflip_mips16. It maps decl names onto a boolean mode setting. */ -static GTY (()) hash_map<const char *, bool, mips16_flip_traits> * - mflip_mips16_htab; +static GTY (()) hash_map<nofree_string_hash, bool> *mflip_mips16_htab; /* True if -mflip-mips16 should next add an attribute for the default MIPS16 mode, false if it should next add an attribute for the opposite mode. */ @@ -1291,8 +1288,7 @@ mflip_mips16_use_mips16_p (tree decl) return !base_is_mips16; if (!mflip_mips16_htab) - mflip_mips16_htab - = hash_map<const char *, bool, mips16_flip_traits>::create_ggc (37); + mflip_mips16_htab = hash_map<nofree_string_hash, bool>::create_ggc (37); name = IDENTIFIER_POINTER (DECL_NAME (decl)); @@ -6593,13 +6589,10 @@ mips_load_call_address (enum mips_call_t } } -struct local_alias_traits : simple_hashmap_traits <nofree_string_hash> {}; - /* Each locally-defined hard-float MIPS16 function has a local symbol associated with it. This hash table maps the function symbol (FUNC) to the local symbol (LOCAL). */ -static GTY (()) hash_map<const char *, rtx, local_alias_traits> - *mips16_local_aliases; +static GTY (()) hash_map<nofree_string_hash, rtx> *mips16_local_aliases; /* FUNC is the symbol for a locally-defined hard-float MIPS16 function. Return a local alias for it, creating a new one if necessary. */ @@ -6609,8 +6602,7 @@ mips16_local_alias (rtx func) { /* Create the hash table if this is the first call. */ if (mips16_local_aliases == NULL) - mips16_local_aliases - = hash_map<const char *, rtx, local_alias_traits>::create_ggc (37); + mips16_local_aliases = hash_map<nofree_string_hash, rtx>::create_ggc (37); /* Look up the function symbol, creating a new entry if need be. */ bool existed;