diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-08-17 08:03:54 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-08-17 08:03:54 +0000 |
commit | 494bbaae2b5244cea9d6874a1f0ec5c20598670b (patch) | |
tree | f5e13f0401d96073f145438cc14798458718ef90 /gcc/tree-ssa-threadupdate.c | |
parent | a4c520802d7ca59a01099503df749de2dedbf501 (diff) | |
download | gcc-494bbaae2b5244cea9d6874a1f0ec5c20598670b.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@190471 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-threadupdate.c')
-rw-r--r-- | gcc/tree-ssa-threadupdate.c | 49 |
1 files changed, 24 insertions, 25 deletions
diff --git a/gcc/tree-ssa-threadupdate.c b/gcc/tree-ssa-threadupdate.c index 3ecb3030d03..86ad74f1bc8 100644 --- a/gcc/tree-ssa-threadupdate.c +++ b/gcc/tree-ssa-threadupdate.c @@ -110,7 +110,7 @@ struct el may have many incoming edges threaded to the same outgoing edge. This can be naturally implemented with a hash table. */ -struct redirection_data +struct redirection_data : typed_free_remove<redirection_data> { /* A duplicate of B with the trailing control statement removed and which targets a single successor of B. */ @@ -125,8 +125,30 @@ struct redirection_data /* A list of incoming edges which we want to thread to OUTGOING_EDGE->dest. */ struct el *incoming_edges; + + /* hash_table support. */ + typedef redirection_data T; + static inline hashval_t hash (const redirection_data *); + static inline int equal (const redirection_data *, const redirection_data *); }; +inline hashval_t +redirection_data::hash (const redirection_data *p) +{ + edge e = p->outgoing_edge; + return e->dest->index; +} + +inline int +redirection_data::equal (const redirection_data *p1, const redirection_data *p2) +{ + edge e1 = p1->outgoing_edge; + edge e2 = p2->outgoing_edge; + edge e3 = p1->intermediate_edge; + edge e4 = p2->intermediate_edge; + return e1 == e2 && e3 == e4; +} + /* Data structure of information to pass to hash table traversal routines. */ struct ssa_local_info_t { @@ -217,32 +239,9 @@ create_block_for_threading (basic_block bb, struct redirection_data *rd) rd->dup_block->count = 0; } -/* Hashing and equality routines for our hash table. */ -inline hashval_t -ssa_redirection_data_hash (const struct redirection_data *p) -{ - edge e = p->outgoing_edge; - return e->dest->index; -} - -inline int -ssa_redirection_data_eq (const struct redirection_data *p1, - const struct redirection_data *p2) -{ - edge e1 = p1->outgoing_edge; - edge e2 = p2->outgoing_edge; - edge e3 = p1->intermediate_edge; - edge e4 = p2->intermediate_edge; - - return e1 == e2 && e3 == e4; -} - /* Main data structure to hold information for duplicates of BB. */ -static hash_table <struct redirection_data, ssa_redirection_data_hash, - ssa_redirection_data_eq, - typed_free_remove<struct redirection_data> > - redirection_data; +static hash_table <redirection_data> redirection_data; /* Given an outgoing edge E lookup and return its entry in our hash table. |