aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-sccvn.c
diff options
context:
space:
mode:
authorKugan Vivekanandarajah <kuganv@linaro.org>2016-09-15 02:03:51 +0000
committerKugan Vivekanandarajah <kugan@gcc.gnu.org>2016-09-15 02:03:51 +0000
commit46aa019a01e8278b12961c63fb457306e09cf13f (patch)
tree39c6eda48c393bf21246adc888f27ba357e13f17 /gcc/tree-ssa-sccvn.c
parent7332afeab41a577291ea7bc20a353bcab0bd7476 (diff)
downloadgcc-46aa019a01e8278b12961c63fb457306e09cf13f.zip
gcc-46aa019a01e8278b12961c63fb457306e09cf13f.tar.gz
gcc-46aa019a01e8278b12961c63fb457306e09cf13f.tar.bz2
Iterator to visit SSA
Iterator to visit SSA gcc/ChangeLog: 2016-09-15 Kugan Vivekanandarajah <kuganv@linaro.org> * tree-ssanames.h (FOR_EACH_SSA_NAME): New. * cfgexpand.c (update_alias_info_with_stack_vars): Use FOR_EACH_SSA_NAME to iterate over SSA variables. (pass_expand::execute): Likewise. * omp-simd-clone.c (ipa_simd_modify_function_body): Likewise. * tree-cfg.c (dump_function_to_file): Likewise. * tree-into-ssa.c (pass_build_ssa::execute): Likewise. (update_ssa): Likewise. * tree-ssa-alias.c (dump_alias_info): Likewise. * tree-ssa-ccp.c (ccp_finalize): Likewise. * tree-ssa-coalesce.c (build_ssa_conflict_graph): Likewise. (create_outofssa_var_map): Likewise. (coalesce_ssa_name): Likewise. * tree-ssa-operands.c (dump_immediate_uses): Likewise. * tree-ssa-pre.c (compute_avail): Likewise. * tree-ssa-sccvn.c (init_scc_vn): Likewise. (scc_vn_restore_ssa_info): Likewise. (free_scc_vn): Likwise. (run_scc_vn): Likewise. * tree-ssa-structalias.c (compute_points_to_sets): Likewise. * tree-ssa-ter.c (new_temp_expr_table): Likewise. * tree-ssa-copy.c (fini_copy_prop): Likewise. * tree-ssa.c (verify_ssa): Likewise. From-SVN: r240152
Diffstat (limited to 'gcc/tree-ssa-sccvn.c')
-rw-r--r--gcc/tree-ssa-sccvn.c50
1 files changed, 20 insertions, 30 deletions
diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c
index 21b3d56..e120b4f 100644
--- a/gcc/tree-ssa-sccvn.c
+++ b/gcc/tree-ssa-sccvn.c
@@ -4290,7 +4290,6 @@ free_vn_table (vn_tables_t table)
static void
init_scc_vn (void)
{
- size_t i;
int j;
int *rpo_numbers_temp;
@@ -4339,12 +4338,11 @@ init_scc_vn (void)
/* Create the VN_INFO structures, and initialize value numbers to
TOP or VARYING for parameters. */
- for (i = 1; i < num_ssa_names; i++)
- {
- tree name = ssa_name (i);
- if (!name)
- continue;
+ size_t i;
+ tree name;
+ FOR_EACH_SSA_NAME (i, name, cfun)
+ {
VN_INFO_GET (name)->valnum = VN_TOP;
VN_INFO (name)->needs_insertion = false;
VN_INFO (name)->expr = NULL;
@@ -4402,11 +4400,12 @@ init_scc_vn (void)
void
scc_vn_restore_ssa_info (void)
{
- for (unsigned i = 0; i < num_ssa_names; i++)
+ unsigned i;
+ tree name;
+
+ FOR_EACH_SSA_NAME (i, name, cfun)
{
- tree name = ssa_name (i);
- if (name
- && has_VN_INFO (name))
+ if (has_VN_INFO (name))
{
if (VN_INFO (name)->needs_insertion)
;
@@ -4428,6 +4427,7 @@ void
free_scc_vn (void)
{
size_t i;
+ tree name;
delete constant_to_value_id;
constant_to_value_id = NULL;
@@ -4436,11 +4436,9 @@ free_scc_vn (void)
shared_lookup_references.release ();
XDELETEVEC (rpo_numbers);
- for (i = 0; i < num_ssa_names; i++)
+ FOR_EACH_SSA_NAME (i, name, cfun)
{
- tree name = ssa_name (i);
- if (name
- && has_VN_INFO (name)
+ if (has_VN_INFO (name)
&& VN_INFO (name)->needs_insertion)
release_ssa_name (name);
}
@@ -4797,13 +4795,11 @@ run_scc_vn (vn_lookup_kind default_vn_walk_kind_)
/* Initialize the value ids and prune out remaining VN_TOPs
from dead code. */
- for (i = 1; i < num_ssa_names; ++i)
+ tree name;
+
+ FOR_EACH_SSA_NAME (i, name, cfun)
{
- tree name = ssa_name (i);
- vn_ssa_aux_t info;
- if (!name)
- continue;
- info = VN_INFO (name);
+ vn_ssa_aux_t info = VN_INFO (name);
if (!info->visited)
info->valnum = name;
if (info->valnum == name
@@ -4814,13 +4810,9 @@ run_scc_vn (vn_lookup_kind default_vn_walk_kind_)
}
/* Propagate. */
- for (i = 1; i < num_ssa_names; ++i)
+ FOR_EACH_SSA_NAME (i, name, cfun)
{
- tree name = ssa_name (i);
- vn_ssa_aux_t info;
- if (!name)
- continue;
- info = VN_INFO (name);
+ vn_ssa_aux_t info = VN_INFO (name);
if (TREE_CODE (info->valnum) == SSA_NAME
&& info->valnum != name
&& info->value_id != VN_INFO (info->valnum)->value_id)
@@ -4832,11 +4824,9 @@ run_scc_vn (vn_lookup_kind default_vn_walk_kind_)
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "Value numbers:\n");
- for (i = 0; i < num_ssa_names; i++)
+ FOR_EACH_SSA_NAME (i, name, cfun)
{
- tree name = ssa_name (i);
- if (name
- && VN_INFO (name)->visited
+ if (VN_INFO (name)->visited
&& SSA_VAL (name) != name)
{
print_generic_expr (dump_file, name, 0);