On Tue, Dec 11, 2012 at 5:44 PM, Lawrence Crowl <cr...@googlers.com> wrote:
> Convert tree-sra.c'candidates from htab_t to hash_table.
>
> Fold uid_decl_map_hash and uid_decl_map_eq into new struct
> uid_decl_hasher.  This change moves the definitions from tree-ssa.c
> into tree-sra.c and removes the declarations from tree-flow.h
>
> Update dependent calls and types to hash_table.
>
> Tested on x86_64.
>
> Okay for branch?
>
>
> Index: gcc/tree-sra.c
> ===================================================================
> --- gcc/tree-sra.c      (revision 194381)
> +++ gcc/tree-sra.c      (working copy)
> @@ -74,6 +74,7 @@ along with GCC; see the file COPYING3.
>  #include "config.h"
>  #include "system.h"
>  #include "coretypes.h"
> +#include "hash-table.h"
>  #include "alloc-pool.h"
>  #include "tm.h"
>  #include "tree.h"
> @@ -269,18 +270,44 @@ static alloc_pool link_pool;
>  /* Base (tree) -> Vector (vec<access_p> *) map.  */
>  static struct pointer_map_t *base_access_vec;
>
> +/* Candidate ashtable helpers.  */

s/ashtable/hash table/

> +
> +struct uid_decl_hasher : typed_noop_remove <tree_node>
> +{
> +  typedef tree_node value_type;
> +  typedef tree_node compare_type;
> +  static inline hashval_t hash (const value_type *);
> +  static inline bool equal (const value_type *, const compare_type *);
> +};
> +
> +/* Hash a tree in a uid_decl_map.  */
> +
> +inline hashval_t
> +uid_decl_hasher::hash (const value_type *item)
> +{
> +  return item->decl_minimal.uid;
> +}
> +
> +/* Return true if the DECL_UID in both trees are equal.  */
> +
> +inline bool
> +uid_decl_hasher::equal (const value_type *a, const compare_type *b)
> +{
> +  return (a->decl_minimal.uid == b->decl_minimal.uid);
> +}
> +

ISTR other places where we hash decls.  I wonder if we shouldn't move
this to some common spot.  Maybe later.

The patch is OK.


Diego.

Reply via email to