summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-live.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-ssa-live.c
parent75101febd89c94bf6a9ddca6742879af9044c1c4 (diff)
downloadgcc-4c124b4c6f4e9017f5682cede57bd84c1129da2a.tar.gz
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-ssa-live.c')
-rw-r--r--gcc/tree-ssa-live.c70
1 files changed, 18 insertions, 52 deletions
diff --git a/gcc/tree-ssa-live.c b/gcc/tree-ssa-live.c
index 6833c6f1eda..014ec2d5526 100644
--- a/gcc/tree-ssa-live.c
+++ b/gcc/tree-ssa-live.c
@@ -325,16 +325,11 @@ create_ssa_var_map (int flags)
tree dest, use;
tree stmt;
stmt_ann_t ann;
- use_optype uses;
- def_optype defs;
- unsigned x;
var_map map;
+ ssa_op_iter iter;
#ifdef ENABLE_CHECKING
sbitmap used_in_real_ops;
sbitmap used_in_virtual_ops;
- vuse_optype vuses;
- v_may_def_optype v_may_defs;
- v_must_def_optype v_must_defs;
#endif
map = init_var_map (num_ssa_names + 1);
@@ -378,10 +373,8 @@ create_ssa_var_map (int flags)
ann = stmt_ann (stmt);
/* Register USE and DEF operands in each statement. */
- uses = USE_OPS (ann);
- for (x = 0; x < NUM_USES (uses); x++)
+ FOR_EACH_SSA_TREE_OPERAND (use , stmt, iter, SSA_OP_USE)
{
- use = USE_OP (uses, x);
register_ssa_partition (map, use, true);
#ifdef ENABLE_CHECKING
@@ -389,10 +382,8 @@ create_ssa_var_map (int flags)
#endif
}
- defs = DEF_OPS (ann);
- for (x = 0; x < NUM_DEFS (defs); x++)
+ FOR_EACH_SSA_TREE_OPERAND (dest, stmt, iter, SSA_OP_DEF)
{
- dest = DEF_OP (defs, x);
register_ssa_partition (map, dest, false);
#ifdef ENABLE_CHECKING
@@ -402,26 +393,12 @@ create_ssa_var_map (int flags)
#ifdef ENABLE_CHECKING
/* Validate that virtual ops don't get used in funny ways. */
- vuses = VUSE_OPS (ann);
- for (x = 0; x < NUM_VUSES (vuses); x++)
+ FOR_EACH_SSA_TREE_OPERAND (use, stmt, iter,
+ SSA_OP_VIRTUAL_USES | SSA_OP_VMUSTDEF)
{
- tree var = VUSE_OP (vuses, x);
- SET_BIT (used_in_virtual_ops, var_ann (SSA_NAME_VAR (var))->uid);
+ SET_BIT (used_in_virtual_ops, var_ann (SSA_NAME_VAR (use))->uid);
}
- v_may_defs = V_MAY_DEF_OPS (ann);
- for (x = 0; x < NUM_V_MAY_DEFS (v_may_defs); x++)
- {
- tree var = V_MAY_DEF_OP (v_may_defs, x);
- SET_BIT (used_in_virtual_ops, var_ann (SSA_NAME_VAR (var))->uid);
- }
-
- v_must_defs = V_MUST_DEF_OPS (ann);
- for (x = 0; x < NUM_V_MUST_DEFS (v_must_defs); x++)
- {
- tree var = V_MUST_DEF_OP (v_must_defs, x);
- SET_BIT (used_in_virtual_ops, var_ann (SSA_NAME_VAR (var))->uid);
- }
#endif /* ENABLE_CHECKING */
mark_all_vars_used (bsi_stmt_ptr (bsi));
@@ -579,7 +556,7 @@ tree_live_info_p
calculate_live_on_entry (var_map map)
{
tree_live_info_p live;
- int num, i;
+ int i;
basic_block bb;
bitmap saw_def;
tree phi, var, stmt;
@@ -587,9 +564,12 @@ calculate_live_on_entry (var_map map)
edge e;
varray_type stack;
block_stmt_iterator bsi;
- use_optype uses;
- def_optype defs;
stmt_ann_t ann;
+ ssa_op_iter iter;
+#ifdef ENABLE_CHECKING
+ int num;
+#endif
+
saw_def = BITMAP_XMALLOC ();
@@ -636,19 +616,13 @@ calculate_live_on_entry (var_map map)
get_stmt_operands (stmt);
ann = stmt_ann (stmt);
- uses = USE_OPS (ann);
- num = NUM_USES (uses);
- for (i = 0; i < num; i++)
+ FOR_EACH_SSA_TREE_OPERAND (op, stmt, iter, SSA_OP_USE)
{
- op = USE_OP (uses, i);
add_livein_if_notdef (live, saw_def, op, bb);
}
- defs = DEF_OPS (ann);
- num = NUM_DEFS (defs);
- for (i = 0; i < num; i++)
+ FOR_EACH_SSA_TREE_OPERAND (op, stmt, iter, SSA_OP_DEF)
{
- op = DEF_OP (defs, i);
set_if_valid (map, saw_def, op);
}
}
@@ -1332,12 +1306,11 @@ build_tree_conflict_graph (tree_live_info_p liveinfo, tpa_p tpa,
conflict_graph graph;
var_map map;
bitmap live;
- int num, x, y, i;
+ int x, y, i;
basic_block bb;
varray_type partition_link, tpa_to_clear, tpa_nodes;
- def_optype defs;
- use_optype uses;
unsigned l;
+ ssa_op_iter iter;
map = live_var_map (liveinfo);
graph = conflict_graph_new (num_var_partitions (map));
@@ -1415,20 +1388,13 @@ build_tree_conflict_graph (tree_live_info_p liveinfo, tpa_p tpa,
if (!is_a_copy)
{
tree var;
-
- defs = DEF_OPS (ann);
- num = NUM_DEFS (defs);
- for (x = 0; x < num; x++)
+ FOR_EACH_SSA_TREE_OPERAND (var, stmt, iter, SSA_OP_DEF)
{
- var = DEF_OP (defs, x);
add_conflicts_if_valid (tpa, graph, map, live, var);
}
- uses = USE_OPS (ann);
- num = NUM_USES (uses);
- for (x = 0; x < num; x++)
+ FOR_EACH_SSA_TREE_OPERAND (var, stmt, iter, SSA_OP_USE)
{
- var = USE_OP (uses, x);
set_if_valid (map, live, var);
}
}