diff options
author | dnovillo <dnovillo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-05-16 13:38:13 +0000 |
---|---|---|
committer | dnovillo <dnovillo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-05-16 13:38:13 +0000 |
commit | ec415c454f37dbd00b9c58c00bc8a2f47ea44c99 (patch) | |
tree | c4014ffdd31e6929c2b0896e695bc7a7780f9040 /gcc/tree-dfa.c | |
parent | c27baad4400d165080bcd69ea555a2e32785cae6 (diff) | |
download | gcc-ec415c454f37dbd00b9c58c00bc8a2f47ea44c99.tar.gz |
2008-05-16 Kenneth Zadeck <zadeck@naturalbridge.com>
* tree-ssa-dse (max_stmt_uid): Removed.
(get_stmt_uid, dse_possible_dead_store_p, dse_optimize_stmt,
tree_ssa_dse): Encapsulate all uses of stmt_ann->uid.
* tree-ssa-sccvn.c (compare_ops, init_scc_vn): Ditto.
* function.h (cfun.last_stmt_uid): New field.
* tree-flow-inline.h (set_gimple_stmt_uid, gimple_stmt_uid,
gimple_stmt_max_uid, set_gimple_stmt_max_uid,
inc_gimple_stmt_max_uid): New functions.
* tree-dfa.c (renumber_gimple_stmt_uids): New function.
(create_stmt_ann): Initialize the ann->uid field.
* tree-ssa-pre.c (compute_avail): Encapsulate the stmt_ann->uid
with new calls.
* tree-flow.h (renumber_gimple_stmt_uids): New function.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@135419 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-dfa.c')
-rw-r--r-- | gcc/tree-dfa.c | 64 |
1 files changed, 56 insertions, 8 deletions
diff --git a/gcc/tree-dfa.c b/gcc/tree-dfa.c index f9784411e41..0a8f88de297 100644 --- a/gcc/tree-dfa.c +++ b/gcc/tree-dfa.c @@ -85,13 +85,30 @@ find_referenced_vars (void) { basic_block bb; block_stmt_iterator si; + tree phi; FOR_EACH_BB (bb) - for (si = bsi_start (bb); !bsi_end_p (si); bsi_next (&si)) - { - tree *stmt_p = bsi_stmt_ptr (si); - walk_tree (stmt_p, find_vars_r, NULL, NULL); - } + { + for (si = bsi_start (bb); !bsi_end_p (si); bsi_next (&si)) + { + tree *stmt_p = bsi_stmt_ptr (si); + walk_tree (stmt_p, find_vars_r, NULL, NULL); + } + + for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi)) + { + int len = PHI_NUM_ARGS (phi); + int i; + + walk_tree (&phi, find_vars_r, NULL, NULL); + + for (i = 0; i < len; i++) + { + tree arg = PHI_ARG_DEF (phi, i); + walk_tree (&arg, find_vars_r, NULL, NULL); + } + } + } return 0; } @@ -110,8 +127,8 @@ struct gimple_opt_pass pass_referenced_vars = PROP_gimple_leh | PROP_cfg, /* properties_required */ PROP_referenced_vars, /* properties_provided */ 0, /* properties_destroyed */ - 0, /* todo_flags_start */ - 0 /* todo_flags_finish */ + TODO_dump_func, /* todo_flags_start */ + TODO_dump_func /* todo_flags_finish */ } }; @@ -194,11 +211,37 @@ create_stmt_ann (tree t) /* Since we just created the annotation, mark the statement modified. */ ann->modified = true; + ann->uid = inc_gimple_stmt_max_uid (cfun); t->base.ann = (tree_ann_t) ann; return ann; } +/* Renumber all of the gimple stmt uids. */ + +void +renumber_gimple_stmt_uids (void) +{ + basic_block bb; + + set_gimple_stmt_max_uid (cfun, 0); + FOR_ALL_BB (bb) + { + block_stmt_iterator bsi; + for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi)) + { + tree stmt = bsi_stmt (bsi); + /* If the stmt has an annotation, then overwrite it, if not, + the process of getting it will set the number + properly. */ + if (has_stmt_ann (stmt)) + set_gimple_stmt_uid (stmt, inc_gimple_stmt_max_uid (cfun)); + else + get_stmt_ann (stmt); + } + } +} + /* Create a new annotation for a tree T. */ tree_ann_common_t @@ -572,9 +615,14 @@ collect_dfa_stats_r (tree *tp, int *walk_subtrees ATTRIBUTE_UNUSED, static tree find_vars_r (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED) { + /* If we are reading the lto info back in, we need to rescan the + referenced vars. */ + if (TREE_CODE (*tp) == SSA_NAME) + add_referenced_var (SSA_NAME_VAR (*tp)); + /* If T is a regular variable that the optimizers are interested in, add it to the list of variables. */ - if (SSA_VAR_P (*tp)) + else if (SSA_VAR_P (*tp)) add_referenced_var (*tp); /* Type, _DECL and constant nodes have no interesting children. |