diff options
author | Richard Guenther <rguenther@suse.de> | 2012-08-17 08:03:54 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2012-08-17 08:03:54 +0000 |
commit | 5deac3404d220cb68d893eb6c86ed2fa3ab3134c (patch) | |
tree | f5e13f0401d96073f145438cc14798458718ef90 /gcc/tree-ssa-coalesce.c | |
parent | c58c0d4c81fb4e313fa10a74e73800fd59efdf92 (diff) | |
download | gcc-5deac3404d220cb68d893eb6c86ed2fa3ab3134c.zip gcc-5deac3404d220cb68d893eb6c86ed2fa3ab3134c.tar.gz gcc-5deac3404d220cb68d893eb6c86ed2fa3ab3134c.tar.bz2 |
hash-table.h (class hash_table): Use a descriptor template argument instead of decomposed element type and...
2012-08-17 Richard Guenther <rguenther@suse.de>
* hash-table.h (class hash_table): Use a descriptor template
argument instead of decomposed element type and support
functions.
(struct pointer_hash): New generic typed pointer-hash.
(struct typed_free_remove, struct typed_noop_remove): Generic
hash_table support pieces.
* coverage.c (struct counts_entry): Add hash_table support
members.
* tree-ssa-ccp.c (gimple_htab): Use pointer_hash.
* tree-ssa-coalesce.c (struct ssa_name_var_hash): New generic
SSA name by SSA_NAME_VAR hash.
(coalesce_ssa_name): Use it.
* tree-ssa-pre.c (struct pre_expr_d): Add hash_table support.
(expression_to_id): Adjust.
(struct expr_pred_trans_d): Add hash_table support.
(phi_translate_table): Adjust.
(phi_trans_lookup): Likewise.
(phi_trans_add): Likewise.
(do_regular_insertion): Likewise.
* tree-ssa-tail-merge.c (struct same_succ_def): Add hash_table
support.
(same_succ_htab): Adjust.
(find_same_succ_bb): Likewise.
(find_same_succ): Likewise.
(update_worklist): Likewise.
* tree-ssa-threadupdate.c (struct redirection_data): Add hash_table
support.
(redirection_data): Adjust.
From-SVN: r190471
Diffstat (limited to 'gcc/tree-ssa-coalesce.c')
-rw-r--r-- | gcc/tree-ssa-coalesce.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/gcc/tree-ssa-coalesce.c b/gcc/tree-ssa-coalesce.c index c8557ac..dfcd4aa 100644 --- a/gcc/tree-ssa-coalesce.c +++ b/gcc/tree-ssa-coalesce.c @@ -1258,22 +1258,29 @@ coalesce_partitions (var_map map, ssa_conflicts_p graph, coalesce_list_p cl, } } -/* Returns a hash code for N. */ + +/* Hashtable support for storing SSA names hashed by their SSA_NAME_VAR. */ + +struct ssa_name_var_hash : typed_noop_remove <union tree_node> +{ + typedef union tree_node T; + static inline hashval_t hash (const_tree); + static inline int equal (const_tree, const_tree); +}; inline hashval_t -hash_ssa_name_by_var (const_tree n) +ssa_name_var_hash::hash (const_tree n) { - return (hashval_t) htab_hash_pointer (SSA_NAME_VAR (n)); + return DECL_UID (SSA_NAME_VAR (n)); } -/* Returns nonzero if N1 and N2 are equal. */ - inline int -eq_ssa_name_by_var (const_tree n1, const_tree n2) +ssa_name_var_hash::equal (const_tree n1, const_tree n2) { return SSA_NAME_VAR (n1) == SSA_NAME_VAR (n2); } + /* Reduce the number of copies by coalescing variables in the function. Return a partition map with the resulting coalesces. */ @@ -1286,9 +1293,7 @@ coalesce_ssa_name (void) bitmap used_in_copies = BITMAP_ALLOC (NULL); var_map map; unsigned int i; - static hash_table <tree_node, hash_ssa_name_by_var, eq_ssa_name_by_var, - typed_null_remove<tree_node> > - ssa_name_hash; + static hash_table <ssa_name_var_hash> ssa_name_hash; cl = create_coalesce_list (); map = create_outofssa_var_map (cl, used_in_copies); |