diff options
author | crowl <crowl@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-10-25 21:45:28 +0000 |
---|---|---|
committer | crowl <crowl@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-10-25 21:45:28 +0000 |
commit | c580da876e6aea7485467ca8e3d19377ecba4fc7 (patch) | |
tree | 723cd03031244c4befb8e0f3f168067dec16d361 /gcc/tree-ssa-tail-merge.c | |
parent | 2e8d2f3202c34da752b421f1f78edff2325503e9 (diff) | |
download | gcc-c580da876e6aea7485467ca8e3d19377ecba4fc7.tar.gz |
Change hash_table to support a comparator type different from the
value type stored in the hash table. The 'find' functions now may
take a different type from the value type. This requires introducing
a second typedef into the Descriptor conceptual type. Change the
Descriptor concept to use typedefs value_type and compare_type instead
of T. Change all users to match.
Add usage documentation to hash-table.h.
Tested on x86-64.
Index: gcc/ChangeLog
2012-10-25 Lawrence Crowl <crowl@google.com>
* hash-table.h: Add usage documentation.
(template struct typed_free_remove): Clarify documentation.
Rename template parameter.
(struct typed_noop_remove): Likewise.
(descriptor concept): Change typedef T to value_type.
Add typedef compare_type. Use more precise template parameter name,
Descriptor instead of Descr. Update users to match.
(struct hash_table): Change 'find' parameters to use compare_type
instead of the value type.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@192823 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-tail-merge.c')
-rw-r--r-- | gcc/tree-ssa-tail-merge.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/gcc/tree-ssa-tail-merge.c b/gcc/tree-ssa-tail-merge.c index 79fb1a6b05b..f9dc8806439 100644 --- a/gcc/tree-ssa-tail-merge.c +++ b/gcc/tree-ssa-tail-merge.c @@ -226,10 +226,11 @@ struct same_succ_def hashval_t hashval; /* hash_table support. */ - typedef same_succ_def T; - static inline hashval_t hash (const same_succ_def *); - static int equal (const same_succ_def *, const same_succ_def *); - static void remove (same_succ_def *); + typedef same_succ_def value_type; + typedef same_succ_def compare_type; + static inline hashval_t hash (const value_type *); + static int equal (const value_type *, const compare_type *); + static void remove (value_type *); }; typedef struct same_succ_def *same_succ; typedef const struct same_succ_def *const_same_succ; @@ -237,7 +238,7 @@ typedef const struct same_succ_def *const_same_succ; /* hash routine for hash_table support, returns hashval of E. */ inline hashval_t -same_succ_def::hash (const same_succ_def *e) +same_succ_def::hash (const value_type *e) { return e->hashval; } @@ -528,7 +529,7 @@ inverse_flags (const_same_succ e1, const_same_succ e2) /* Compares SAME_SUCCs E1 and E2. */ int -same_succ_def::equal (const_same_succ e1, const_same_succ e2) +same_succ_def::equal (const value_type *e1, const compare_type *e2) { unsigned int i, first1, first2; gimple_stmt_iterator gsi1, gsi2; |