Commit 46aa019a by Kugan Vivekanandarajah Committed by Kugan Vivekanandarajah

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
parent 7332afea
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.
2016-09-14 Matthew Fortune <matthew.fortune@imgtec.com> 2016-09-14 Matthew Fortune <matthew.fortune@imgtec.com>
* config.gcc (mips*-mti-elf*, mips*-mti-linux*): Set mips32r2 * config.gcc (mips*-mti-elf*, mips*-mti-linux*): Set mips32r2
......
...@@ -815,16 +815,15 @@ update_alias_info_with_stack_vars (void) ...@@ -815,16 +815,15 @@ update_alias_info_with_stack_vars (void)
if (decls_to_partitions) if (decls_to_partitions)
{ {
unsigned i; unsigned i;
tree name;
hash_set<bitmap> visited; hash_set<bitmap> visited;
bitmap temp = BITMAP_ALLOC (&stack_var_bitmap_obstack); bitmap temp = BITMAP_ALLOC (&stack_var_bitmap_obstack);
for (i = 1; i < num_ssa_names; i++) FOR_EACH_SSA_NAME (i, name, cfun)
{ {
tree name = ssa_name (i);
struct ptr_info_def *pi; struct ptr_info_def *pi;
if (name if (POINTER_TYPE_P (TREE_TYPE (name))
&& POINTER_TYPE_P (TREE_TYPE (name))
&& ((pi = SSA_NAME_PTR_INFO (name)) != NULL)) && ((pi = SSA_NAME_PTR_INFO (name)) != NULL))
add_partitioned_vars_to_ptset (&pi->pt, decls_to_partitions, add_partitioned_vars_to_ptset (&pi->pt, decls_to_partitions,
&visited, temp); &visited, temp);
...@@ -6270,16 +6269,15 @@ pass_expand::execute (function *fun) ...@@ -6270,16 +6269,15 @@ pass_expand::execute (function *fun)
/* Now propagate the RTL assignment of each partition to the /* Now propagate the RTL assignment of each partition to the
underlying var of each SSA_NAME. */ underlying var of each SSA_NAME. */
for (i = 1; i < num_ssa_names; i++) tree name;
{
tree name = ssa_name (i);
if (!name FOR_EACH_SSA_NAME (i, name, cfun)
/* We might have generated new SSA names in {
update_alias_info_with_stack_vars. They will have a NULL /* We might have generated new SSA names in
defining statements, and won't be part of the partitioning, update_alias_info_with_stack_vars. They will have a NULL
so ignore those. */ defining statements, and won't be part of the partitioning,
|| !SSA_NAME_DEF_STMT (name)) so ignore those. */
if (!SSA_NAME_DEF_STMT (name))
continue; continue;
adjust_one_expanded_partition_var (name); adjust_one_expanded_partition_var (name);
...@@ -6288,17 +6286,15 @@ pass_expand::execute (function *fun) ...@@ -6288,17 +6286,15 @@ pass_expand::execute (function *fun)
/* Clean up RTL of variables that straddle across multiple /* Clean up RTL of variables that straddle across multiple
partitions, and check that the rtl of any PARM_DECLs that are not partitions, and check that the rtl of any PARM_DECLs that are not
cleaned up is that of their default defs. */ cleaned up is that of their default defs. */
for (i = 1; i < num_ssa_names; i++) FOR_EACH_SSA_NAME (i, name, cfun)
{ {
tree name = ssa_name (i);
int part; int part;
if (!name /* We might have generated new SSA names in
/* We might have generated new SSA names in update_alias_info_with_stack_vars. They will have a NULL
update_alias_info_with_stack_vars. They will have a NULL defining statements, and won't be part of the partitioning,
defining statements, and won't be part of the partitioning, so ignore those. */
so ignore those. */ if (!SSA_NAME_DEF_STMT (name))
|| !SSA_NAME_DEF_STMT (name))
continue; continue;
part = var_to_partition (SA.map, name); part = var_to_partition (SA.map, name);
if (part == NO_PARTITION) if (part == NO_PARTITION)
......
...@@ -931,11 +931,11 @@ ipa_simd_modify_function_body (struct cgraph_node *node, ...@@ -931,11 +931,11 @@ ipa_simd_modify_function_body (struct cgraph_node *node,
} }
l = adjustments.length (); l = adjustments.length ();
for (i = 1; i < num_ssa_names; i++) tree name;
FOR_EACH_SSA_NAME (i, name, cfun)
{ {
tree name = ssa_name (i); if (SSA_NAME_VAR (name)
if (name
&& SSA_NAME_VAR (name)
&& TREE_CODE (SSA_NAME_VAR (name)) == PARM_DECL) && TREE_CODE (SSA_NAME_VAR (name)) == PARM_DECL)
{ {
for (j = 0; j < l; j++) for (j = 0; j < l; j++)
......
...@@ -7581,11 +7581,13 @@ dump_function_to_file (tree fndecl, FILE *file, int flags) ...@@ -7581,11 +7581,13 @@ dump_function_to_file (tree fndecl, FILE *file, int flags)
any_var = true; any_var = true;
} }
tree name;
if (gimple_in_ssa_p (cfun)) if (gimple_in_ssa_p (cfun))
for (ix = 1; ix < num_ssa_names; ++ix) FOR_EACH_SSA_NAME (ix, name, cfun)
{ {
tree name = ssa_name (ix); if (!SSA_NAME_VAR (name))
if (name && !SSA_NAME_VAR (name))
{ {
fprintf (file, " "); fprintf (file, " ");
print_generic_expr (file, TREE_TYPE (name), flags); print_generic_expr (file, TREE_TYPE (name), flags);
......
...@@ -2341,7 +2341,6 @@ pass_build_ssa::execute (function *fun) ...@@ -2341,7 +2341,6 @@ pass_build_ssa::execute (function *fun)
{ {
bitmap_head *dfs; bitmap_head *dfs;
basic_block bb; basic_block bb;
unsigned i;
/* Initialize operand data structures. */ /* Initialize operand data structures. */
init_ssa_operands (fun); init_ssa_operands (fun);
...@@ -2385,13 +2384,14 @@ pass_build_ssa::execute (function *fun) ...@@ -2385,13 +2384,14 @@ pass_build_ssa::execute (function *fun)
/* Try to get rid of all gimplifier generated temporaries by making /* Try to get rid of all gimplifier generated temporaries by making
its SSA names anonymous. This way we can garbage collect them its SSA names anonymous. This way we can garbage collect them
all after removing unused locals which we do in our TODO. */ all after removing unused locals which we do in our TODO. */
for (i = 1; i < num_ssa_names; ++i) unsigned i;
tree name;
FOR_EACH_SSA_NAME (i, name, cfun)
{ {
tree decl, name = ssa_name (i); if (SSA_NAME_IS_DEFAULT_DEF (name))
if (!name
|| SSA_NAME_IS_DEFAULT_DEF (name))
continue; continue;
decl = SSA_NAME_VAR (name); tree decl = SSA_NAME_VAR (name);
if (decl if (decl
&& TREE_CODE (decl) == VAR_DECL && TREE_CODE (decl) == VAR_DECL
&& !VAR_DECL_IS_VIRTUAL_OPERAND (decl) && !VAR_DECL_IS_VIRTUAL_OPERAND (decl)
...@@ -3283,12 +3283,12 @@ update_ssa (unsigned update_flags) ...@@ -3283,12 +3283,12 @@ update_ssa (unsigned update_flags)
placement heuristics. */ placement heuristics. */
prepare_block_for_update (start_bb, insert_phi_p); prepare_block_for_update (start_bb, insert_phi_p);
tree name;
if (flag_checking) if (flag_checking)
for (i = 1; i < num_ssa_names; ++i) FOR_EACH_SSA_NAME (i, name, cfun)
{ {
tree name = ssa_name (i); if (virtual_operand_p (name))
if (!name
|| virtual_operand_p (name))
continue; continue;
/* For all but virtual operands, which do not have SSA names /* For all but virtual operands, which do not have SSA names
......
...@@ -450,6 +450,7 @@ void ...@@ -450,6 +450,7 @@ void
dump_alias_info (FILE *file) dump_alias_info (FILE *file)
{ {
unsigned i; unsigned i;
tree ptr;
const char *funcname const char *funcname
= lang_hooks.decl_printable_name (current_function_decl, 2); = lang_hooks.decl_printable_name (current_function_decl, 2);
tree var; tree var;
...@@ -471,13 +472,11 @@ dump_alias_info (FILE *file) ...@@ -471,13 +472,11 @@ dump_alias_info (FILE *file)
fprintf (file, "\n\nFlow-insensitive points-to information\n\n"); fprintf (file, "\n\nFlow-insensitive points-to information\n\n");
for (i = 1; i < num_ssa_names; i++) FOR_EACH_SSA_NAME (i, ptr, cfun)
{ {
tree ptr = ssa_name (i);
struct ptr_info_def *pi; struct ptr_info_def *pi;
if (ptr == NULL_TREE if (!POINTER_TYPE_P (TREE_TYPE (ptr))
|| !POINTER_TYPE_P (TREE_TYPE (ptr))
|| SSA_NAME_IN_FREE_LIST (ptr)) || SSA_NAME_IN_FREE_LIST (ptr))
continue; continue;
......
...@@ -898,24 +898,23 @@ ccp_finalize (bool nonzero_p) ...@@ -898,24 +898,23 @@ ccp_finalize (bool nonzero_p)
{ {
bool something_changed; bool something_changed;
unsigned i; unsigned i;
tree name;
do_dbg_cnt (); do_dbg_cnt ();
/* Derive alignment and misalignment information from partially /* Derive alignment and misalignment information from partially
constant pointers in the lattice or nonzero bits from partially constant pointers in the lattice or nonzero bits from partially
constant integers. */ constant integers. */
for (i = 1; i < num_ssa_names; ++i) FOR_EACH_SSA_NAME (i, name, cfun)
{ {
tree name = ssa_name (i);
ccp_prop_value_t *val; ccp_prop_value_t *val;
unsigned int tem, align; unsigned int tem, align;
if (!name if (!POINTER_TYPE_P (TREE_TYPE (name))
|| (!POINTER_TYPE_P (TREE_TYPE (name)) && (!INTEGRAL_TYPE_P (TREE_TYPE (name))
&& (!INTEGRAL_TYPE_P (TREE_TYPE (name)) /* Don't record nonzero bits before IPA to avoid
/* Don't record nonzero bits before IPA to avoid using too much memory. */
using too much memory. */ || !nonzero_p))
|| !nonzero_p)))
continue; continue;
val = get_value (name); val = get_value (name);
......
...@@ -955,12 +955,11 @@ build_ssa_conflict_graph (tree_live_info_p liveinfo) ...@@ -955,12 +955,11 @@ build_ssa_conflict_graph (tree_live_info_p liveinfo)
if (bb == entry) if (bb == entry)
{ {
unsigned i; unsigned i;
for (i = 1; i < num_ssa_names; i++) tree var;
{
tree var = ssa_name (i);
if (!var FOR_EACH_SSA_NAME (i, var, cfun)
|| !SSA_NAME_IS_DEFAULT_DEF (var) {
if (!SSA_NAME_IS_DEFAULT_DEF (var)
|| !SSA_NAME_VAR (var) || !SSA_NAME_VAR (var)
|| VAR_P (SSA_NAME_VAR (var))) || VAR_P (SSA_NAME_VAR (var)))
continue; continue;
...@@ -1261,10 +1260,9 @@ create_outofssa_var_map (coalesce_list *cl, bitmap used_in_copy) ...@@ -1261,10 +1260,9 @@ create_outofssa_var_map (coalesce_list *cl, bitmap used_in_copy)
/* Now process result decls and live on entry variables for entry into /* Now process result decls and live on entry variables for entry into
the coalesce list. */ the coalesce list. */
first = NULL_TREE; first = NULL_TREE;
for (i = 1; i < num_ssa_names; i++) FOR_EACH_SSA_NAME (i, var, cfun)
{ {
var = ssa_name (i); if (!virtual_operand_p (var))
if (var != NULL_TREE && !virtual_operand_p (var))
{ {
coalesce_with_default (var, cl, used_in_copy); coalesce_with_default (var, cl, used_in_copy);
...@@ -1806,6 +1804,7 @@ coalesce_ssa_name (void) ...@@ -1806,6 +1804,7 @@ coalesce_ssa_name (void)
bitmap used_in_copies = BITMAP_ALLOC (NULL); bitmap used_in_copies = BITMAP_ALLOC (NULL);
var_map map; var_map map;
unsigned int i; unsigned int i;
tree a;
cl = create_coalesce_list (); cl = create_coalesce_list ();
map = create_outofssa_var_map (cl, used_in_copies); map = create_outofssa_var_map (cl, used_in_copies);
...@@ -1817,12 +1816,9 @@ coalesce_ssa_name (void) ...@@ -1817,12 +1816,9 @@ coalesce_ssa_name (void)
{ {
hash_table<ssa_name_var_hash> ssa_name_hash (10); hash_table<ssa_name_var_hash> ssa_name_hash (10);
for (i = 1; i < num_ssa_names; i++) FOR_EACH_SSA_NAME (i, a, cfun)
{ {
tree a = ssa_name (i); if (SSA_NAME_VAR (a)
if (a
&& SSA_NAME_VAR (a)
&& !DECL_IGNORED_P (SSA_NAME_VAR (a)) && !DECL_IGNORED_P (SSA_NAME_VAR (a))
&& (!has_zero_uses (a) || !SSA_NAME_IS_DEFAULT_DEF (a) && (!has_zero_uses (a) || !SSA_NAME_IS_DEFAULT_DEF (a)
|| !VAR_P (SSA_NAME_VAR (a)))) || !VAR_P (SSA_NAME_VAR (a))))
......
...@@ -503,14 +503,13 @@ static bool ...@@ -503,14 +503,13 @@ static bool
fini_copy_prop (void) fini_copy_prop (void)
{ {
unsigned i; unsigned i;
tree var;
/* Set the final copy-of value for each variable by traversing the /* Set the final copy-of value for each variable by traversing the
copy-of chains. */ copy-of chains. */
for (i = 1; i < num_ssa_names; i++) FOR_EACH_SSA_NAME (i, var, cfun)
{ {
tree var = ssa_name (i); if (!copy_of[i].value
if (!var
|| !copy_of[i].value
|| copy_of[i].value == var) || copy_of[i].value == var)
continue; continue;
......
...@@ -1247,11 +1247,8 @@ dump_immediate_uses (FILE *file) ...@@ -1247,11 +1247,8 @@ dump_immediate_uses (FILE *file)
unsigned int x; unsigned int x;
fprintf (file, "Immediate_uses: \n\n"); fprintf (file, "Immediate_uses: \n\n");
for (x = 1; x < num_ssa_names; x++) FOR_EACH_SSA_NAME (x, var, cfun)
{ {
var = ssa_name (x);
if (!var)
continue;
dump_immediate_uses_for (file, var); dump_immediate_uses_for (file, var);
} }
} }
......
...@@ -3670,15 +3670,14 @@ compute_avail (void) ...@@ -3670,15 +3670,14 @@ compute_avail (void)
basic_block *worklist; basic_block *worklist;
size_t sp = 0; size_t sp = 0;
unsigned i; unsigned i;
tree name;
/* We pretend that default definitions are defined in the entry block. /* We pretend that default definitions are defined in the entry block.
This includes function arguments and the static chain decl. */ This includes function arguments and the static chain decl. */
for (i = 1; i < num_ssa_names; ++i) FOR_EACH_SSA_NAME (i, name, cfun)
{ {
tree name = ssa_name (i);
pre_expr e; pre_expr e;
if (!name if (!SSA_NAME_IS_DEFAULT_DEF (name)
|| !SSA_NAME_IS_DEFAULT_DEF (name)
|| has_zero_uses (name) || has_zero_uses (name)
|| virtual_operand_p (name)) || virtual_operand_p (name))
continue; continue;
......
...@@ -4290,7 +4290,6 @@ free_vn_table (vn_tables_t table) ...@@ -4290,7 +4290,6 @@ free_vn_table (vn_tables_t table)
static void static void
init_scc_vn (void) init_scc_vn (void)
{ {
size_t i;
int j; int j;
int *rpo_numbers_temp; int *rpo_numbers_temp;
...@@ -4339,12 +4338,11 @@ init_scc_vn (void) ...@@ -4339,12 +4338,11 @@ init_scc_vn (void)
/* Create the VN_INFO structures, and initialize value numbers to /* Create the VN_INFO structures, and initialize value numbers to
TOP or VARYING for parameters. */ TOP or VARYING for parameters. */
for (i = 1; i < num_ssa_names; i++) size_t i;
{ tree name;
tree name = ssa_name (i);
if (!name)
continue;
FOR_EACH_SSA_NAME (i, name, cfun)
{
VN_INFO_GET (name)->valnum = VN_TOP; VN_INFO_GET (name)->valnum = VN_TOP;
VN_INFO (name)->needs_insertion = false; VN_INFO (name)->needs_insertion = false;
VN_INFO (name)->expr = NULL; VN_INFO (name)->expr = NULL;
...@@ -4402,11 +4400,12 @@ init_scc_vn (void) ...@@ -4402,11 +4400,12 @@ init_scc_vn (void)
void void
scc_vn_restore_ssa_info (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 (has_VN_INFO (name))
if (name
&& has_VN_INFO (name))
{ {
if (VN_INFO (name)->needs_insertion) if (VN_INFO (name)->needs_insertion)
; ;
...@@ -4428,6 +4427,7 @@ void ...@@ -4428,6 +4427,7 @@ void
free_scc_vn (void) free_scc_vn (void)
{ {
size_t i; size_t i;
tree name;
delete constant_to_value_id; delete constant_to_value_id;
constant_to_value_id = NULL; constant_to_value_id = NULL;
...@@ -4436,11 +4436,9 @@ free_scc_vn (void) ...@@ -4436,11 +4436,9 @@ free_scc_vn (void)
shared_lookup_references.release (); shared_lookup_references.release ();
XDELETEVEC (rpo_numbers); XDELETEVEC (rpo_numbers);
for (i = 0; i < num_ssa_names; i++) FOR_EACH_SSA_NAME (i, name, cfun)
{ {
tree name = ssa_name (i); if (has_VN_INFO (name)
if (name
&& has_VN_INFO (name)
&& VN_INFO (name)->needs_insertion) && VN_INFO (name)->needs_insertion)
release_ssa_name (name); release_ssa_name (name);
} }
...@@ -4797,13 +4795,11 @@ run_scc_vn (vn_lookup_kind default_vn_walk_kind_) ...@@ -4797,13 +4795,11 @@ run_scc_vn (vn_lookup_kind default_vn_walk_kind_)
/* Initialize the value ids and prune out remaining VN_TOPs /* Initialize the value ids and prune out remaining VN_TOPs
from dead code. */ 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 = VN_INFO (name);
vn_ssa_aux_t info;
if (!name)
continue;
info = VN_INFO (name);
if (!info->visited) if (!info->visited)
info->valnum = name; info->valnum = name;
if (info->valnum == name if (info->valnum == name
...@@ -4814,13 +4810,9 @@ run_scc_vn (vn_lookup_kind default_vn_walk_kind_) ...@@ -4814,13 +4810,9 @@ run_scc_vn (vn_lookup_kind default_vn_walk_kind_)
} }
/* Propagate. */ /* 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 = VN_INFO (name);
vn_ssa_aux_t info;
if (!name)
continue;
info = VN_INFO (name);
if (TREE_CODE (info->valnum) == SSA_NAME if (TREE_CODE (info->valnum) == SSA_NAME
&& info->valnum != name && info->valnum != name
&& info->value_id != VN_INFO (info->valnum)->value_id) && info->value_id != VN_INFO (info->valnum)->value_id)
...@@ -4832,11 +4824,9 @@ run_scc_vn (vn_lookup_kind default_vn_walk_kind_) ...@@ -4832,11 +4824,9 @@ run_scc_vn (vn_lookup_kind default_vn_walk_kind_)
if (dump_file && (dump_flags & TDF_DETAILS)) if (dump_file && (dump_flags & TDF_DETAILS))
{ {
fprintf (dump_file, "Value numbers:\n"); 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 (VN_INFO (name)->visited
if (name
&& VN_INFO (name)->visited
&& SSA_VAL (name) != name) && SSA_VAL (name) != name)
{ {
print_generic_expr (dump_file, name, 0); print_generic_expr (dump_file, name, 0);
......
...@@ -7028,7 +7028,6 @@ static void ...@@ -7028,7 +7028,6 @@ static void
compute_points_to_sets (void) compute_points_to_sets (void)
{ {
basic_block bb; basic_block bb;
unsigned i;
varinfo_t vi; varinfo_t vi;
timevar_push (TV_TREE_PTA); timevar_push (TV_TREE_PTA);
...@@ -7077,11 +7076,12 @@ compute_points_to_sets (void) ...@@ -7077,11 +7076,12 @@ compute_points_to_sets (void)
cfun->gimple_df->escaped.escaped = 0; cfun->gimple_df->escaped.escaped = 0;
/* Compute the points-to sets for pointer SSA_NAMEs. */ /* Compute the points-to sets for pointer SSA_NAMEs. */
for (i = 0; i < num_ssa_names; ++i) unsigned i;
tree ptr;
FOR_EACH_SSA_NAME (i, ptr, cfun)
{ {
tree ptr = ssa_name (i); if (POINTER_TYPE_P (TREE_TYPE (ptr)))
if (ptr
&& POINTER_TYPE_P (TREE_TYPE (ptr)))
find_what_p_points_to (cfun->decl, ptr); find_what_p_points_to (cfun->decl, ptr);
} }
......
...@@ -185,8 +185,6 @@ extern void debug_ter (FILE *, temp_expr_table *); ...@@ -185,8 +185,6 @@ extern void debug_ter (FILE *, temp_expr_table *);
static temp_expr_table * static temp_expr_table *
new_temp_expr_table (var_map map) new_temp_expr_table (var_map map)
{ {
unsigned x;
temp_expr_table *t = XNEW (struct temp_expr_table); temp_expr_table *t = XNEW (struct temp_expr_table);
t->map = map; t->map = map;
...@@ -201,12 +199,13 @@ new_temp_expr_table (var_map map) ...@@ -201,12 +199,13 @@ new_temp_expr_table (var_map map)
t->replaceable_expressions = NULL; t->replaceable_expressions = NULL;
t->num_in_part = XCNEWVEC (int, num_var_partitions (map)); t->num_in_part = XCNEWVEC (int, num_var_partitions (map));
for (x = 1; x < num_ssa_names; x++)
unsigned x;
tree name;
FOR_EACH_SSA_NAME (x, name, cfun)
{ {
int p; int p;
tree name = ssa_name (x);
if (!name)
continue;
p = var_to_partition (map, name); p = var_to_partition (map, name);
if (p != NO_PARTITION) if (p != NO_PARTITION)
t->num_in_part[p]++; t->num_in_part[p]++;
......
...@@ -1005,7 +1005,6 @@ error: ...@@ -1005,7 +1005,6 @@ error:
DEBUG_FUNCTION void DEBUG_FUNCTION void
verify_ssa (bool check_modified_stmt, bool check_ssa_operands) verify_ssa (bool check_modified_stmt, bool check_ssa_operands)
{ {
size_t i;
basic_block bb; basic_block bb;
basic_block *definition_block = XCNEWVEC (basic_block, num_ssa_names); basic_block *definition_block = XCNEWVEC (basic_block, num_ssa_names);
ssa_op_iter iter; ssa_op_iter iter;
...@@ -1018,24 +1017,23 @@ verify_ssa (bool check_modified_stmt, bool check_ssa_operands) ...@@ -1018,24 +1017,23 @@ verify_ssa (bool check_modified_stmt, bool check_ssa_operands)
timevar_push (TV_TREE_SSA_VERIFY); timevar_push (TV_TREE_SSA_VERIFY);
/* Keep track of SSA names present in the IL. */ /* Keep track of SSA names present in the IL. */
for (i = 1; i < num_ssa_names; i++) size_t i;
tree name;
FOR_EACH_SSA_NAME (i, name, cfun)
{ {
tree name = ssa_name (i); gimple *stmt;
if (name) TREE_VISITED (name) = 0;
{
gimple *stmt;
TREE_VISITED (name) = 0;
verify_ssa_name (name, virtual_operand_p (name)); verify_ssa_name (name, virtual_operand_p (name));
stmt = SSA_NAME_DEF_STMT (name); stmt = SSA_NAME_DEF_STMT (name);
if (!gimple_nop_p (stmt)) if (!gimple_nop_p (stmt))
{ {
basic_block bb = gimple_bb (stmt); basic_block bb = gimple_bb (stmt);
if (verify_def (bb, definition_block, if (verify_def (bb, definition_block,
name, stmt, virtual_operand_p (name))) name, stmt, virtual_operand_p (name)))
goto err; goto err;
}
} }
} }
......
...@@ -62,6 +62,10 @@ struct GTY ((variable_size)) range_info_def { ...@@ -62,6 +62,10 @@ struct GTY ((variable_size)) range_info_def {
#define num_ssa_names (vec_safe_length (cfun->gimple_df->ssa_names)) #define num_ssa_names (vec_safe_length (cfun->gimple_df->ssa_names))
#define ssa_name(i) ((*cfun->gimple_df->ssa_names)[(i)]) #define ssa_name(i) ((*cfun->gimple_df->ssa_names)[(i)])
#define FOR_EACH_SSA_NAME(I, VAR, FN) \
for (I = 1; SSANAMES (FN)->iterate (I, &VAR); ++I) \
if (VAR)
/* Sets the value range to SSA. */ /* Sets the value range to SSA. */
extern void set_range_info (tree, enum value_range_type, const wide_int_ref &, extern void set_range_info (tree, enum value_range_type, const wide_int_ref &,
const wide_int_ref &); const wide_int_ref &);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment