diff options
author | Florian Weimer <fw@deneb.enyo.de> | 2013-09-26 18:39:28 +0200 |
---|---|---|
committer | Florian Weimer <fw@gcc.gnu.org> | 2013-09-26 18:39:28 +0200 |
commit | 84f48495e979dee9adf890c0d14b87bf1bf911a1 (patch) | |
tree | bf45465f8dc31f1e73a75ecfc906676391b0d3a8 /gcc/tree-ssa.c | |
parent | 74fc8b8ab93cc6be30282b9c01010198a37510ee (diff) | |
download | gcc-84f48495e979dee9adf890c0d14b87bf1bf911a1.zip gcc-84f48495e979dee9adf890c0d14b87bf1bf911a1.tar.gz gcc-84f48495e979dee9adf890c0d14b87bf1bf911a1.tar.bz2 |
tree-ssa.h (walk_use_def_chains_fn, [...]): Delete.
2013-09-26 Florian Weimer <fw@deneb.enyo.de>
* tree-ssa.h (walk_use_def_chains_fn, walk_use_def_chains): Delete.
* tree-ssa.c (walk_use_def_chains_1, walk_use_def_chains): Delete.
* doc/tree-ssa.texi (Walking use-def chains): Delete.
From-SVN: r202951
Diffstat (limited to 'gcc/tree-ssa.c')
-rw-r--r-- | gcc/tree-ssa.c | 109 |
1 files changed, 0 insertions, 109 deletions
diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c index 8c340de..1452126 100644 --- a/gcc/tree-ssa.c +++ b/gcc/tree-ssa.c @@ -1347,115 +1347,6 @@ ssa_undefined_value_p (tree t) } -/* Internal helper for walk_use_def_chains. VAR, FN and DATA are as - described in walk_use_def_chains. - - VISITED is a pointer set used to mark visited SSA_NAMEs to avoid - infinite loops. We used to have a bitmap for this to just mark - SSA versions we had visited. But non-sparse bitmaps are way too - expensive, while sparse bitmaps may cause quadratic behavior. - - IS_DFS is true if the caller wants to perform a depth-first search - when visiting PHI nodes. A DFS will visit each PHI argument and - call FN after each one. Otherwise, all the arguments are - visited first and then FN is called with each of the visited - arguments in a separate pass. */ - -static bool -walk_use_def_chains_1 (tree var, walk_use_def_chains_fn fn, void *data, - struct pointer_set_t *visited, bool is_dfs) -{ - gimple def_stmt; - - if (pointer_set_insert (visited, var)) - return false; - - def_stmt = SSA_NAME_DEF_STMT (var); - - if (gimple_code (def_stmt) != GIMPLE_PHI) - { - /* If we reached the end of the use-def chain, call FN. */ - return fn (var, def_stmt, data); - } - else - { - size_t i; - - /* When doing a breadth-first search, call FN before following the - use-def links for each argument. */ - if (!is_dfs) - for (i = 0; i < gimple_phi_num_args (def_stmt); i++) - if (fn (gimple_phi_arg_def (def_stmt, i), def_stmt, data)) - return true; - - /* Follow use-def links out of each PHI argument. */ - for (i = 0; i < gimple_phi_num_args (def_stmt); i++) - { - tree arg = gimple_phi_arg_def (def_stmt, i); - - /* ARG may be NULL for newly introduced PHI nodes. */ - if (arg - && TREE_CODE (arg) == SSA_NAME - && walk_use_def_chains_1 (arg, fn, data, visited, is_dfs)) - return true; - } - - /* When doing a depth-first search, call FN after following the - use-def links for each argument. */ - if (is_dfs) - for (i = 0; i < gimple_phi_num_args (def_stmt); i++) - if (fn (gimple_phi_arg_def (def_stmt, i), def_stmt, data)) - return true; - } - - return false; -} - - - -/* Walk use-def chains starting at the SSA variable VAR. Call - function FN at each reaching definition found. FN takes three - arguments: VAR, its defining statement (DEF_STMT) and a generic - pointer to whatever state information that FN may want to maintain - (DATA). FN is able to stop the walk by returning true, otherwise - in order to continue the walk, FN should return false. - - Note, that if DEF_STMT is a PHI node, the semantics are slightly - different. The first argument to FN is no longer the original - variable VAR, but the PHI argument currently being examined. If FN - wants to get at VAR, it should call PHI_RESULT (PHI). - - If IS_DFS is true, this function will: - - 1- walk the use-def chains for all the PHI arguments, and, - 2- call (*FN) (ARG, PHI, DATA) on all the PHI arguments. - - If IS_DFS is false, the two steps above are done in reverse order - (i.e., a breadth-first search). */ - -void -walk_use_def_chains (tree var, walk_use_def_chains_fn fn, void *data, - bool is_dfs) -{ - gimple def_stmt; - - gcc_assert (TREE_CODE (var) == SSA_NAME); - - def_stmt = SSA_NAME_DEF_STMT (var); - - /* We only need to recurse if the reaching definition comes from a PHI - node. */ - if (gimple_code (def_stmt) != GIMPLE_PHI) - (*fn) (var, def_stmt, data); - else - { - struct pointer_set_t *visited = pointer_set_create (); - walk_use_def_chains_1 (var, fn, data, visited, is_dfs); - pointer_set_destroy (visited); - } -} - - /* If necessary, rewrite the base of the reference tree *TP from a MEM_REF to a plain or converted symbol. */ |