aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog11
-rw-r--r--gcc/ipa-icf.h9
-rw-r--r--gcc/mem-stats.h10
-rw-r--r--gcc/sanopt.c29
4 files changed, 36 insertions, 23 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index fed4758..68b7b02 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,16 @@
2015-06-25 Richard Sandiford <richard.sandiford@arm.com>
+ * 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 <richard.sandiford@arm.com>
+
* gengtype-parse.c (require_template_declaration): Allow '+' in
template parameters. Consolidate cases.
* hash-traits.h (int_hash): New class.
diff --git a/gcc/ipa-icf.h b/gcc/ipa-icf.h
index f229ca1..b94a38e 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 <symbol_compare_collection>
{
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_hash>
+ symbol_compare_hashmap_traits;
/* Semantic item usage pair. */
diff --git a/gcc/mem-stats.h b/gcc/mem-stats.h
index 63277b3..a9580ab 100644
--- a/gcc/mem-stats.h
+++ b/gcc/mem-stats.h
@@ -238,10 +238,10 @@ template <class T>
class mem_alloc_description
{
public:
- struct mem_alloc_hashmap_traits: default_hashmap_traits
+ struct mem_location_hash : nofree_ptr_hash <mem_location>
{
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_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 <const void *, mem_usage_pair<T>, default_hashmap_traits>
- reverse_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;
diff --git a/gcc/sanopt.c b/gcc/sanopt.c
index f0ca8e0..e8dfc5f 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 <sanopt_tree_triplet>
{
+ 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<typename T>
static inline void
- mark_deleted (T &e)
+ mark_deleted (sanopt_tree_triplet &ref)
{
- e.m_key.t1 = reinterpret_cast<T *> (1);
+ ref.t1 = reinterpret_cast<tree> (1);
}
- template<typename T>
static inline void
- mark_empty (T &e)
+ mark_empty (sanopt_tree_triplet &ref)
{
- e.m_key.t1 = NULL;
+ ref.t1 = NULL;
}
- template<typename T>
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<typename T>
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_hash>
+ sanopt_tree_triplet_map_traits;
/* This is used to carry various hash maps and variables used
in sanopt_optimize_walker. */