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-pre.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-pre.c')
-rw-r--r-- | gcc/tree-ssa-pre.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c index bc3381bd85e..6a075984ea5 100644 --- a/gcc/tree-ssa-pre.c +++ b/gcc/tree-ssa-pre.c @@ -173,7 +173,8 @@ typedef struct pre_expr_d : typed_noop_remove <pre_expr_d> pre_expr_union u; /* hash_table support. */ - typedef pre_expr_d T; + typedef pre_expr_d value_type; + typedef pre_expr_d compare_type; static inline hashval_t hash (const pre_expr_d *); static inline int equal (const pre_expr_d *, const pre_expr_d *); } *pre_expr; @@ -186,7 +187,7 @@ typedef struct pre_expr_d : typed_noop_remove <pre_expr_d> /* Compare E1 and E1 for equality. */ inline int -pre_expr_d::equal (const struct pre_expr_d *e1, const struct pre_expr_d *e2) +pre_expr_d::equal (const value_type *e1, const compare_type *e2) { if (e1->kind != e2->kind) return false; @@ -211,7 +212,7 @@ pre_expr_d::equal (const struct pre_expr_d *e1, const struct pre_expr_d *e2) /* Hash E. */ inline hashval_t -pre_expr_d::hash (const struct pre_expr_d *e) +pre_expr_d::hash (const value_type *e) { switch (e->kind) { @@ -499,9 +500,10 @@ typedef struct expr_pred_trans_d : typed_free_remove<expr_pred_trans_d> hashval_t hashcode; /* hash_table support. */ - typedef expr_pred_trans_d T; - static inline hashval_t hash (const expr_pred_trans_d *); - static inline int equal (const expr_pred_trans_d *, const expr_pred_trans_d *); + typedef expr_pred_trans_d value_type; + typedef expr_pred_trans_d compare_type; + static inline hashval_t hash (const value_type *); + static inline int equal (const value_type *, const compare_type *); } *expr_pred_trans_t; typedef const struct expr_pred_trans_d *const_expr_pred_trans_t; @@ -512,8 +514,8 @@ expr_pred_trans_d::hash (const expr_pred_trans_d *e) } inline int -expr_pred_trans_d::equal (const expr_pred_trans_d *ve1, - const expr_pred_trans_d *ve2) +expr_pred_trans_d::equal (const value_type *ve1, + const compare_type *ve2) { basic_block b1 = ve1->pred; basic_block b2 = ve2->pred; |