From 5831a5f0a8393c05a6da99f9a5995ffc7aa6b8ca Mon Sep 17 00:00:00 2001 From: Lawrence Crowl Date: Thu, 25 Oct 2012 21:45:28 +0000 Subject: 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 * 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 --- gcc/valtrack.h | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'gcc/valtrack.h') diff --git a/gcc/valtrack.h b/gcc/valtrack.h index 303ffa4..44f2d21 100644 --- a/gcc/valtrack.h +++ b/gcc/valtrack.h @@ -46,32 +46,33 @@ struct dead_debug_global_entry struct dead_debug_hash_descr { /* The hash table contains pointers to entries of this type. */ - typedef struct dead_debug_global_entry T; + typedef struct dead_debug_global_entry value_type; + typedef struct dead_debug_global_entry compare_type; /* Hash on the pseudo number. */ - static inline hashval_t hash (T const *my); + static inline hashval_t hash (const value_type *my); /* Entries are identical if they refer to the same pseudo. */ - static inline bool equal (T const *my, T const *other); + static inline bool equal (const value_type *my, const compare_type *other); /* Release entries when they're removed. */ - static inline void remove (T *p); + static inline void remove (value_type *p); }; /* Hash on the pseudo number. */ inline hashval_t -dead_debug_hash_descr::hash (T const *my) +dead_debug_hash_descr::hash (const value_type *my) { return REGNO (my->reg); } /* Entries are identical if they refer to the same pseudo. */ inline bool -dead_debug_hash_descr::equal (T const *my, T const *other) +dead_debug_hash_descr::equal (const value_type *my, const compare_type *other) { return my->reg == other->reg; } /* Release entries when they're removed. */ inline void -dead_debug_hash_descr::remove (T *p) +dead_debug_hash_descr::remove (value_type *p) { XDELETE (p); } -- cgit v1.1