diff options
author | Lawrence Crowl <crowl@google.com> | 2012-10-25 21:45:28 +0000 |
---|---|---|
committer | Lawrence Crowl <crowl@gcc.gnu.org> | 2012-10-25 21:45:28 +0000 |
commit | 5831a5f0a8393c05a6da99f9a5995ffc7aa6b8ca (patch) | |
tree | 723cd03031244c4befb8e0f3f168067dec16d361 /gcc/tree-ssa-pre.c | |
parent | 2257bc19401e4dfd76f199fa40c0aa6c3bfdc612 (diff) | |
download | gcc-5831a5f0a8393c05a6da99f9a5995ffc7aa6b8ca.zip gcc-5831a5f0a8393c05a6da99f9a5995ffc7aa6b8ca.tar.gz gcc-5831a5f0a8393c05a6da99f9a5995ffc7aa6b8ca.tar.bz2 |
Change hash_table to support a comparator type different from the value type stored in the hash table.
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.
From-SVN: r192823
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 bc3381bd..6a07598 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; |