From: Richard Sandiford Date: Thu, 25 Jun 2015 17:16:51 +0000 (+0000) Subject: ipa-icf.h (symbol_compare_hash): New class. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9654754bd9ab263c3d2a6e04bbd1a4dc36f9f280;p=gcc.git ipa-icf.h (symbol_compare_hash): New class. gcc/ * ipa-icf.h (symbol_compare_hash): New class. (symbol_compare_hashmap_traits): Use it. * mem-stats.h (mem_alloc_description::mem_location_hash): New class. (mem_alloc_description::mem_alloc_hashmap_traits): Use it. (mem_alloc_description::reverse_mem_map_t): Remove redundant default_hashmap_traits. * sanopt.c (sanopt_tree_triplet_hash): New class. (sanopt_tree_triplet_map_traits): Use it. From-SVN: r224974 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index fed4758760f..68b7b027b47 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2015-06-25 Richard Sandiford + + * ipa-icf.h (symbol_compare_hash): New class. + (symbol_compare_hashmap_traits): Use it. + * mem-stats.h (mem_alloc_description::mem_location_hash): New class. + (mem_alloc_description::mem_alloc_hashmap_traits): Use it. + (mem_alloc_description::reverse_mem_map_t): Remove redundant + default_hashmap_traits. + * sanopt.c (sanopt_tree_triplet_hash): New class. + (sanopt_tree_triplet_map_traits): Use it. + 2015-06-25 Richard Sandiford * gengtype-parse.c (require_template_declaration): Allow '+' in diff --git a/gcc/ipa-icf.h b/gcc/ipa-icf.h index f229ca18ecf..b94a38e6f4e 100644 --- a/gcc/ipa-icf.h +++ b/gcc/ipa-icf.h @@ -87,10 +87,10 @@ public: /* Hash traits for symbol_compare_collection map. */ -struct symbol_compare_hashmap_traits: default_hashmap_traits +struct symbol_compare_hash : nofree_ptr_hash { static hashval_t - hash (const symbol_compare_collection *v) + hash (value_type v) { inchash::hash hstate; hstate.add_int (v->m_references.length ()); @@ -107,8 +107,7 @@ struct symbol_compare_hashmap_traits: default_hashmap_traits } static bool - equal_keys (const symbol_compare_collection *a, - const symbol_compare_collection *b) + equal (value_type a, value_type b) { if (a->m_references.length () != b->m_references.length () || a->m_interposables.length () != b->m_interposables.length ()) @@ -126,6 +125,8 @@ struct symbol_compare_hashmap_traits: default_hashmap_traits return true; } }; +typedef simple_hashmap_traits + symbol_compare_hashmap_traits; /* Semantic item usage pair. */ diff --git a/gcc/mem-stats.h b/gcc/mem-stats.h index 63277b302ce..a9580ab442e 100644 --- a/gcc/mem-stats.h +++ b/gcc/mem-stats.h @@ -238,10 +238,10 @@ template class mem_alloc_description { public: - struct mem_alloc_hashmap_traits: default_hashmap_traits + struct mem_location_hash : nofree_ptr_hash { static hashval_t - hash (const mem_location *l) + hash (value_type l) { inchash::hash hstate; @@ -253,18 +253,18 @@ public: } static bool - equal_keys (const mem_location *l1, const mem_location *l2) + equal (value_type l1, value_type l2) { return l1->m_filename == l2->m_filename && l1->m_function == l2->m_function && l1->m_line == l2->m_line; } }; + typedef simple_hashmap_traits mem_alloc_hashmap_traits; /* Internal class type definitions. */ typedef hash_map mem_map_t; - typedef hash_map , default_hashmap_traits> - reverse_mem_map_t; + typedef hash_map > reverse_mem_map_t; typedef hash_map > reverse_object_map_t; typedef std::pair mem_list_t; diff --git a/gcc/sanopt.c b/gcc/sanopt.c index f0ca8e00dd8..e8dfc5f6e8b 100644 --- a/gcc/sanopt.c +++ b/gcc/sanopt.c @@ -107,8 +107,11 @@ struct sanopt_tree_triplet /* Traits class for tree triplet hash maps below. */ -struct sanopt_tree_triplet_map_traits : default_hashmap_traits +struct sanopt_tree_triplet_hash : typed_noop_remove { + typedef sanopt_tree_triplet value_type; + typedef sanopt_tree_triplet compare_type; + static inline hashval_t hash (const sanopt_tree_triplet &ref) { @@ -120,41 +123,39 @@ struct sanopt_tree_triplet_map_traits : default_hashmap_traits } static inline bool - equal_keys (const sanopt_tree_triplet &ref1, const sanopt_tree_triplet &ref2) + equal (const sanopt_tree_triplet &ref1, const sanopt_tree_triplet &ref2) { return operand_equal_p (ref1.t1, ref2.t1, 0) && operand_equal_p (ref1.t2, ref2.t2, 0) && operand_equal_p (ref1.t3, ref2.t3, 0); } - template static inline void - mark_deleted (T &e) + mark_deleted (sanopt_tree_triplet &ref) { - e.m_key.t1 = reinterpret_cast (1); + ref.t1 = reinterpret_cast (1); } - template static inline void - mark_empty (T &e) + mark_empty (sanopt_tree_triplet &ref) { - e.m_key.t1 = NULL; + ref.t1 = NULL; } - template static inline bool - is_deleted (T &e) + is_deleted (const sanopt_tree_triplet &ref) { - return e.m_key.t1 == (void *) 1; + return ref.t1 == (void *) 1; } - template static inline bool - is_empty (T &e) + is_empty (const sanopt_tree_triplet &ref) { - return e.m_key.t1 == NULL; + return ref.t1 == NULL; } }; +typedef simple_hashmap_traits + sanopt_tree_triplet_map_traits; /* This is used to carry various hash maps and variables used in sanopt_optimize_walker. */