aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-outof-ssa.c
diff options
context:
space:
mode:
authorAndrew MacLeod <amacleod@redhat.com>2004-08-25 21:21:19 +0000
committerAndrew Macleod <amacleod@gcc.gnu.org>2004-08-25 21:21:19 +0000
commit4c124b4c6f4e9017f5682cede57bd84c1129da2a (patch)
tree22414e194e2c3d5262c72554997d72332edaa89c /gcc/tree-outof-ssa.c
parent75101febd89c94bf6a9ddca6742879af9044c1c4 (diff)
downloadgcc-4c124b4c6f4e9017f5682cede57bd84c1129da2a.zip
gcc-4c124b4c6f4e9017f5682cede57bd84c1129da2a.tar.gz
gcc-4c124b4c6f4e9017f5682cede57bd84c1129da2a.tar.bz2
tree-ssa-operands.h (struct ssa_operand_iterator_d): New.
2004-08-25 Andrew MacLeod <amacleod@redhat.com> * tree-ssa-operands.h (struct ssa_operand_iterator_d): New. SSA operand iterator controlling structure. (SSA_OP_USE, SSA_OP_DEF, SSA_OP_VUSE, SSA_OP_VMAYUSE, SSA_OP_VMAYDEF, SSA_OP_VMUSTDEF, SSA_OP_VIRTUAL_USES, SSA_OP_VIRTUAL_DEFS, SSA_OP_ALL_USES, SSA_OP_ALL_DEFS, SSA_OP_ALL_OPERANDS): New. Operand iterator flags. (FOR_EACH_SSA_TREE_OPERAND): New. Iterate over operands as trees. (FOR_EACH_SSA_USE_OPERAND): New. Iterate over operands as uses. (FOR_EACH_SSA_DEF_OPERAND): New. Iterate over operands as defs. (FOR_EACH_SSA_MAYDEF_OPERAND): New. Iterate over V_MAY_DEFs. * tree-ssa-operands.c (NULL_DEF_OPERAND_P, NULL_USE_OPERAND_P): New. Empty operand pointers. * tree-flow-inline.h (op_iter_done): New. Return true if finished. (op_iter_next_use): New. Return next use_operand_p. (op_iter_next_def): New. Return next def_operand_p. (op_iter_next_tree): New. Return next operands as a tree. (op_iter_init): New. Initialize an iterator structure. (op_iter_init_use): New. Initialize structure and get the first use. (op_iter_init_def): New. Initialize structure and get the first def. (op_iter_init_tree): New. Initialize structure and get the first tree. (op_iter_next_maydef): New. Return next V_MAY_DEF operands. (op_iter_init_maydef): New. Initialize structure and get the first V_MAY_DEF operands. * tree-cfg.c (tree_duplicate_bb): Use new operand iterator. * tree-dfa.c (compute_immediate_uses_for_stmt, redirect_immediate_uses): Use new operand iterator. (v_may_defs_disappeared_p, v_must_defs_disappeared_p): Delete. (mark_new_vars_to_rename): Use new operand iterator. Count virtual operands instead of using *_disappeared_p routines. * tree-into-ssa.c (mark_def_sites, ssa_mark_def_sites, rewrite_stmt, ssa_rewrite_stmt): Use new operand iterator. * tree-outof-ssa.c (check_replaceable, find_replaceable_in_bb, rewrite_trees): Use new operand iterator. * tree-pretty-print.c (dump_vops): Use new operand iterator. * tree-sra.c (mark_all_v_defs): Use new operand iterator. * tree-ssa-alias.c (compute_points_to_and_addr_escape, dump_points_to_info): Use new operand iterator. * tree-ssa-ccp.c (cp_lattice_meet, visit_stmt, initialize, replace_uses_in, replace_vuse_in, likely_value, set_rhs): Use new operand iterator. * tree-ssa-dce.c (mark_stmt_if_obviously_necessary, propagate_necessity): Use new operand iterator. * tree-ssa-dom.c (cprop_into_stmt, optimize_stmt): Use operand iterator. (register_definitions_for_stmt): Use new operand iterator. Take stmt as a parameter instead of a stmt_ann_t. * tree-ssa-live.c (create_ssa_var_map, calculate_live_on_entry, build_tree_conflict_graph): Use new operand iterator. * tree-ssa-loop-im.c (determine_max_movement, single_reachable_address, rewrite_mem_refs): Use new operand iterator. * tree-ssa-loop-manip.c (find_uses_to_rename_stmt, check_loop_closed_ssa_use): Use new operand iterator. * tree-ssa.c (verify_ssa, replace_immediate_uses): Use operand iterator. * tree-ssanames.c (release_defs): Use new operand iterator. * tree-vectorizer.c (vect_create_data_ref): Use new operand iterator. From-SVN: r86583
Diffstat (limited to 'gcc/tree-outof-ssa.c')
-rw-r--r--gcc/tree-outof-ssa.c33
1 files changed, 12 insertions, 21 deletions
diff --git a/gcc/tree-outof-ssa.c b/gcc/tree-outof-ssa.c
index 5b1e2a8..0245494 100644
--- a/gcc/tree-outof-ssa.c
+++ b/gcc/tree-outof-ssa.c
@@ -1461,8 +1461,9 @@ check_replaceable (temp_expr_table_p tab, tree stmt)
def_optype defs;
use_optype uses;
tree var, def;
- int num_use_ops, version, i;
+ int num_use_ops, version;
var_map map = tab->map;
+ ssa_op_iter iter;
if (TREE_CODE (stmt) != MODIFY_EXPR)
return false;
@@ -1512,9 +1513,8 @@ check_replaceable (temp_expr_table_p tab, tree stmt)
version = SSA_NAME_VERSION (def);
/* Add this expression to the dependency list for each use partition. */
- for (i = 0; i < num_use_ops; i++)
+ FOR_EACH_SSA_TREE_OPERAND (var, stmt, iter, SSA_OP_USE)
{
- var = USE_OP (uses, i);
add_dependance (tab, version, var);
}
@@ -1646,11 +1646,10 @@ find_replaceable_in_bb (temp_expr_table_p tab, basic_block bb)
block_stmt_iterator bsi;
tree stmt, def;
stmt_ann_t ann;
- int partition, num, i;
- use_optype uses;
- def_optype defs;
+ int partition;
var_map map = tab->map;
value_expr_p p;
+ ssa_op_iter iter;
for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
{
@@ -1658,11 +1657,8 @@ find_replaceable_in_bb (temp_expr_table_p tab, basic_block bb)
ann = stmt_ann (stmt);
/* Determine if this stmt finishes an existing expression. */
- uses = USE_OPS (ann);
- num = NUM_USES (uses);
- for (i = 0; i < num; i++)
+ FOR_EACH_SSA_TREE_OPERAND (def, stmt, iter, SSA_OP_USE)
{
- def = USE_OP (uses, i);
if (tab->version_info[SSA_NAME_VERSION (def)])
{
/* Mark expression as replaceable unless stmt is volatile. */
@@ -1674,11 +1670,8 @@ find_replaceable_in_bb (temp_expr_table_p tab, basic_block bb)
}
/* Next, see if this stmt kills off an active expression. */
- defs = DEF_OPS (ann);
- num = NUM_DEFS (defs);
- for (i = 0; i < num; i++)
+ FOR_EACH_SSA_TREE_OPERAND (def, stmt, iter, SSA_OP_DEF)
{
- def = DEF_OP (defs, i);
partition = var_to_partition (map, def);
if (partition != NO_PARTITION && tab->partition_dep_list[partition])
kill_expr (tab, partition, true);
@@ -1880,13 +1873,15 @@ rewrite_trees (var_map map, tree *values)
{
for (si = bsi_start (bb); !bsi_end_p (si); )
{
- size_t i, num_uses, num_defs;
+ size_t num_uses, num_defs;
use_optype uses;
def_optype defs;
tree stmt = bsi_stmt (si);
use_operand_p use_p;
+ def_operand_p def_p;
int remove = 0, is_copy = 0;
stmt_ann_t ann;
+ ssa_op_iter iter;
get_stmt_operands (stmt);
ann = stmt_ann (stmt);
@@ -1898,10 +1893,8 @@ rewrite_trees (var_map map, tree *values)
uses = USE_OPS (ann);
num_uses = NUM_USES (uses);
-
- for (i = 0; i < num_uses; i++)
+ FOR_EACH_SSA_USE_OPERAND (use_p, stmt, iter, SSA_OP_USE)
{
- use_p = USE_OP_PTR (uses, i);
if (replace_use_variable (map, use_p, values))
changed = true;
}
@@ -1921,10 +1914,8 @@ rewrite_trees (var_map map, tree *values)
}
if (!remove)
{
- for (i = 0; i < num_defs; i++)
+ FOR_EACH_SSA_DEF_OPERAND (def_p, stmt, iter, SSA_OP_DEF)
{
- def_operand_p def_p = DEF_OP_PTR (defs, i);
-
if (replace_def_variable (map, def_p, NULL))
changed = true;