This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch] Statement operand iterators
- From: Zdenek Dvorak <rakdver at atrey dot karlin dot mff dot cuni dot cz>
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 24 Jun 2004 17:44:07 +0200
- Subject: [patch] Statement operand iterators
Hello,
currently, we have operands of statements split into 6 different
cathegories, with a separate accessor macros for each of them.
In addition we have a completely separate way of accessing arguments
of phi nodes.
This means that if I for example want to run some code over all uses
of the statement (both real and virtual), it means that I first have
to check whether I work with a phi node, or with a normal statement,
and in the later case prepare three optype variables and for each of them
run a separate loop. In total I need either to duplicate the code
four times, or create a function for it
Given that this is a fairly common operation, this is way too much work.
This patch introduces operand iterators. With them, I may solve the
above with simply writing
oii oi;
for (oi_init (&oi, stmt, OI_ALL_USES); !oi_end_p (&oi); oi_next (&oi))
code (oi_op (&oi));
Now the bad side: of course it does not come for free. The patch below
that makes us use the iterators everywhere slows down compilation of
preprocessed gcc sources from 3m32.661s to 3m42.554s.
Bootstrapped & regtested on i686.
Zdenek
* tree-flow-inline.h (oi_init_ann, oi_init, oi_end_p, oi_next, oi_op,
oi_index, oi_set_op, oi_def_p, oi_virtual_p, num_operands_of_types,
oi_use_ptr, oi_def_ptr, oi_use_ptr_from_vdef_def,
oi_def_ptr_from_vdef_use): New functions.
* tree-ssa-operands.h (oi_init_ann, oi_init, oi_end_p, oi_next, oi_op,
oi_index, oi_set_op, oi_def_p, oi_virtual_p, num_operands_of_types,
oi_use_ptr, oi_def_ptr, oi_use_ptr_from_vdef_def,
oi_def_ptr_from_vdef_use): Declare.
(enum oi_op_type, union op_strs, struct op_iterator, oii): New types.
(OI_USES, OI_VUSES, OI_USES_AND_VUSES, OI_ALL_USES, OI_V_MAY_DEFS,
OI_DEFS, OI_VDEFS, OI_ALL_DEFS, OI_ALL_REAL, OI_ALL_VIRTUAL,
OI_STMT_OPS, OI_PHI_OPS, OI_PHI_VOPS): New macros.
* tree-dfa.c (compute_immediate_uses_for_stmt, redirect_immediate_uses):
Use operand iterators.
* tree-into-ssa.c (mark_def_sites, rewrite_stmt): Ditto.
* tree-ssa-alias.c (compute_points_to_and_addr_escape,
dump_points_to_info): Ditto.
* tree-ssa-ccp.c (visit_stmt, ccp_fold, initialize, replace_uses_in,
likely_value, set_rhs): Ditto.
* tree-ssa-copy.c (cprop_into_stmt): Ditto.
* tree-ssa-dce.c (mark_stmt_if_obviously_necessary,
propagate_necessity): Ditto.
* tree-ssa-dom.c (redirect_edges_and_update_ssa_graph,
thread_across_edge, record_equivalences_from_stmt, avail_expr_hash,
register_definitions_for_stmt): Ditto.
* tree-ssa-dse.c (fix_phi_uses, fix_stmt_v_may_defs,
dse_optimize_stmt): Ditto.
* tree-ssa.c (verify_ssa, replace_immediate_uses): Ditto.
* tree-tailcall.c (eliminate_tail_call): Ditto.
* tree-ssa-live.c (create_ssa_var_map, calculate_live_on_entry,
build_tree_conflict_graph, register_ssa_partitions_for_vars): Ditto.
* tree-ssa-loop.c (mark_defs_for_rewrite): Ditto.
* tree-sra.c (mark_all_v_may_defs, mark_all_v_must_defs): Merged to ...
(mark_all_vdefs): ... new function.
(create_scalar_copies): Use mark_all_vdefs.
Index: tree-dfa.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-dfa.c,v
retrieving revision 2.13
diff -c -3 -p -r2.13 tree-dfa.c
*** tree-dfa.c 23 Jun 2004 20:12:42 -0000 2.13
--- tree-dfa.c 24 Jun 2004 00:20:08 -0000
*************** compute_immediate_uses_for_phi (tree phi
*** 274,284 ****
static void
compute_immediate_uses_for_stmt (tree stmt, int flags, bool (*calc_for)(tree))
{
! size_t i;
! use_optype uses;
! vuse_optype vuses;
! v_may_def_optype v_may_defs;
! stmt_ann_t ann;
#ifdef ENABLE_CHECKING
/* PHI nodes are handled elsewhere. */
--- 274,281 ----
static void
compute_immediate_uses_for_stmt (tree stmt, int flags, bool (*calc_for)(tree))
{
! oii oi;
! unsigned types = 0;
#ifdef ENABLE_CHECKING
/* PHI nodes are handled elsewhere. */
*************** compute_immediate_uses_for_stmt (tree st
*** 287,324 ****
#endif
/* Look at USE_OPS or VUSE_OPS according to FLAGS. */
- ann = stmt_ann (stmt);
if (flags & TDFA_USE_OPS)
! {
! uses = USE_OPS (ann);
! for (i = 0; i < NUM_USES (uses); i++)
! {
! tree use = USE_OP (uses, i);
! tree imm_stmt = SSA_NAME_DEF_STMT (use);
! if (!IS_EMPTY_STMT (imm_stmt) && (!calc_for || calc_for (use)))
! add_immediate_use (imm_stmt, stmt);
! }
! }
if (flags & TDFA_USE_VOPS)
! {
! vuses = VUSE_OPS (ann);
! for (i = 0; i < NUM_VUSES (vuses); i++)
! {
! tree vuse = VUSE_OP (vuses, i);
! tree imm_rdef_stmt = SSA_NAME_DEF_STMT (vuse);
! if (!IS_EMPTY_STMT (imm_rdef_stmt) && (!calc_for || calc_for (vuse)))
! add_immediate_use (imm_rdef_stmt, stmt);
! }
! v_may_defs = V_MAY_DEF_OPS (ann);
! for (i = 0; i < NUM_V_MAY_DEFS (v_may_defs); i++)
! {
! tree vuse = V_MAY_DEF_OP (v_may_defs, i);
! tree imm_rdef_stmt = SSA_NAME_DEF_STMT (vuse);
! if (!IS_EMPTY_STMT (imm_rdef_stmt) && (!calc_for || calc_for (vuse)))
! add_immediate_use (imm_rdef_stmt, stmt);
! }
}
}
--- 284,301 ----
#endif
/* Look at USE_OPS or VUSE_OPS according to FLAGS. */
if (flags & TDFA_USE_OPS)
! types |= OI_USES;
if (flags & TDFA_USE_VOPS)
! types |= OI_VUSES;
! for (oi_init (&oi, stmt, types); !oi_end_p (&oi); oi_next (&oi))
! {
! tree use = oi_op (&oi);
! tree imm_stmt = SSA_NAME_DEF_STMT (use);
! if (!IS_EMPTY_STMT (imm_stmt) && (!calc_for || calc_for (use)))
! add_immediate_use (imm_stmt, stmt);
}
}
*************** redirect_immediate_use (tree use, tree o
*** 384,404 ****
void
redirect_immediate_uses (tree old, tree new)
{
! stmt_ann_t ann = get_stmt_ann (old);
! use_optype uses = USE_OPS (ann);
! vuse_optype vuses = VUSE_OPS (ann);
! v_may_def_optype v_may_defs = V_MAY_DEF_OPS (ann);
! unsigned int i;
! /* Look at USE_OPS or VUSE_OPS according to FLAGS. */
! for (i = 0; i < NUM_USES (uses); i++)
! redirect_immediate_use (USE_OP (uses, i), old, new);
!
! for (i = 0; i < NUM_VUSES (vuses); i++)
! redirect_immediate_use (VUSE_OP (vuses, i), old, new);
!
! for (i = 0; i < NUM_V_MAY_DEFS (v_may_defs); i++)
! redirect_immediate_use (V_MAY_DEF_OP (v_may_defs, i), old, new);
}
--- 361,370 ----
void
redirect_immediate_uses (tree old, tree new)
{
! oii oi;
! for (oi_init (&oi, old, OI_ALL_USES); !oi_end_p (&oi); oi_next (&oi))
! redirect_immediate_use (oi_op (&oi), old, new);
}
Index: tree-flow-inline.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-flow-inline.h,v
retrieving revision 2.11
diff -c -3 -p -r2.11 tree-flow-inline.h
*** tree-flow-inline.h 18 Jun 2004 14:05:19 -0000 2.11
--- tree-flow-inline.h 24 Jun 2004 00:20:08 -0000
*************** get_tree_ann (tree t)
*** 765,768 ****
--- 765,1093 ----
return (ann) ? ann : create_tree_ann (t);
}
+ /* Inline definitions of the operand iterator functions. */
+
+ /* Initializes the operand iterator OI on statement annotations ANN for
+ operands of types TYPES. */
+
+ static inline void
+ oi_init_ann (struct op_iterator *oi, struct stmt_ann_d *ann, unsigned types)
+ {
+ oi->atype = OT_NONE;
+ oi->ann = ann;
+ oi->types = types & OI_STMT_OPS;
+ oi->aop = 0;
+ oi->aop_max = 0;
+ oi->index = 0;
+ oi_next (oi);
+ oi->index = 0;
+ }
+
+ /* Initializes the operand iterator OI on statement STMT for operands
+ of types TYPES. */
+
+ static inline void
+ oi_init (struct op_iterator *oi, tree stmt, unsigned types)
+ {
+ oi->atype = OT_NONE;
+ if (TREE_CODE (stmt) == PHI_NODE)
+ {
+ oi->aops.phi = stmt;
+ if (is_gimple_reg (PHI_RESULT (stmt)))
+ types &= OI_PHI_OPS;
+ else
+ types &= OI_PHI_VOPS;
+ }
+ else
+ {
+ oi->ann = stmt_ann (stmt);
+ types &= OI_STMT_OPS;
+ }
+
+ oi->types = types;
+ oi->aop = 0;
+ oi->aop_max = 0;
+ oi->index = 0;
+ oi_next (oi);
+ oi->index = 0;
+ }
+
+ /* Checks whether we have already processed all operands through iterator
+ OI. */
+
+ static inline bool
+ oi_end_p (const struct op_iterator *oi)
+ {
+ return oi->atype == OT_MAX;
+ }
+
+ /* Moves operand iterator OI to the next operand. */
+
+ static inline void
+ oi_next (struct op_iterator *oi)
+ {
+ enum oi_op_type type;
+
+ if (oi->atype == OT_MAX)
+ return;
+
+ oi->aop++;
+ oi->index++;
+ if (oi->aop < oi->aop_max)
+ return;
+
+ for (type = oi->atype + 1; type != OT_MAX; type++)
+ {
+ if (!(oi->types & (1 << type)))
+ continue;
+
+ switch (type)
+ {
+ case OT_DEF:
+ oi->aops.defs = DEF_OPS (oi->ann);
+ oi->aop_max = NUM_DEFS (oi->aops.defs);
+ break;
+
+ case OT_USE:
+ oi->aops.uses = USE_OPS (oi->ann);
+ oi->aop_max = NUM_USES (oi->aops.uses);
+ break;
+
+ case OT_VDEF_DEF:
+ case OT_VDEF_USE:
+ oi->aops.v_may_defs = V_MAY_DEF_OPS (oi->ann);
+ oi->aop_max = NUM_V_MAY_DEFS (oi->aops.v_may_defs);
+ break;
+
+ case OT_VMUST_DEF:
+ oi->aops.v_must_defs = V_MUST_DEF_OPS (oi->ann);
+ oi->aop_max = NUM_V_MUST_DEFS (oi->aops.v_must_defs);
+ break;
+
+ case OT_VUSE:
+ oi->aops.vuses = VUSE_OPS (oi->ann);
+ oi->aop_max = NUM_VUSES (oi->aops.vuses);
+ break;
+
+ case OT_PHI_USE:
+ case OT_PHI_VUSE:
+ oi->aop_max = PHI_NUM_ARGS (oi->aops.phi);
+ break;
+
+ case OT_PHI_DEF:
+ case OT_PHI_VDEF:
+ oi->aop_max = 1;
+ break;
+
+ default:
+ abort ();
+ }
+
+ if (oi->aop_max)
+ break;
+ }
+
+ oi->atype = type;
+ oi->aop = 0;
+ }
+
+ /* Gets the operand pointed to by OI. */
+
+ static inline tree
+ oi_op (const struct op_iterator *oi)
+ {
+ switch (oi->atype)
+ {
+ case OT_DEF:
+ return DEF_OP (oi->aops.defs, oi->aop);
+
+ case OT_USE:
+ return USE_OP (oi->aops.uses, oi->aop);
+
+ case OT_VDEF_DEF:
+ return V_MAY_DEF_RESULT (oi->aops.v_may_defs, oi->aop);
+
+ case OT_VDEF_USE:
+ return V_MAY_DEF_OP (oi->aops.v_may_defs, oi->aop);
+
+ case OT_VMUST_DEF:
+ return V_MUST_DEF_OP (oi->aops.v_must_defs, oi->aop);
+
+ case OT_VUSE:
+ return VUSE_OP (oi->aops.vuses, oi->aop);
+
+ case OT_PHI_USE:
+ case OT_PHI_VUSE:
+ return PHI_ARG_DEF (oi->aops.phi, oi->aop);
+
+ case OT_PHI_DEF:
+ case OT_PHI_VDEF:
+ return PHI_RESULT (oi->aops.phi);
+
+ default:
+ abort ();
+ }
+ }
+
+ /* Gets the index of the operand pointed to by OI. */
+
+ static inline unsigned
+ oi_index (const struct op_iterator *oi)
+ {
+ return oi->index;
+ }
+
+ /* Sets the operand pointed to by OI to VAL. */
+
+ static inline void
+ oi_set_op (struct op_iterator *oi, tree val)
+ {
+ switch (oi->atype)
+ {
+ case OT_DEF:
+ SET_DEF_OP (oi->aops.defs, oi->aop, val);
+ break;
+
+ case OT_USE:
+ SET_USE_OP (oi->aops.uses, oi->aop, val);
+ break;
+
+ case OT_VDEF_DEF:
+ SET_V_MAY_DEF_RESULT (oi->aops.v_may_defs, oi->aop, val);
+ break;
+
+ case OT_VDEF_USE:
+ SET_V_MAY_DEF_OP (oi->aops.v_may_defs, oi->aop, val);
+ break;
+
+ case OT_VMUST_DEF:
+ SET_V_MUST_DEF_OP (oi->aops.v_must_defs, oi->aop, val);
+ break;
+
+ case OT_VUSE:
+ SET_VUSE_OP (oi->aops.vuses, oi->aop, val);
+ break;
+
+ case OT_PHI_USE:
+ case OT_PHI_VUSE:
+ SET_PHI_ARG_DEF (oi->aops.phi, oi->aop, val);
+ break;
+
+ case OT_PHI_DEF:
+ case OT_PHI_VDEF:
+ SET_PHI_RESULT (oi->aops.phi, val);
+ break;
+
+ default:
+ abort ();
+ }
+ }
+
+ /* Returns true if operand pointed to by OI is a definition. */
+
+ static inline bool
+ oi_def_p (const struct op_iterator *oi)
+ {
+ return ((1 << oi->atype) & OI_ALL_DEFS) != 0;
+ }
+
+ /* Returns true if operand pointed to by OI is virtual. */
+
+ static inline bool
+ oi_virtual_p (const struct op_iterator *oi)
+ {
+ return ((1 << oi->atype) & OI_ALL_VIRTUAL) != 0;
+ }
+
+ /* Counts number of operands of STMT of type in TYPES. */
+
+ static inline unsigned
+ num_operands_of_types (tree stmt, unsigned types)
+ {
+ unsigned ret = 0;
+ oii oi;
+
+ for (oi_init (&oi, stmt, types); !oi_end_p (&oi); oi_next (&oi))
+ {
+ ret += oi.aop_max;
+ oi.aop = oi.aop_max;
+ }
+
+ return ret;
+ }
+
+ /* Gets the use_ptr to operand pointed to by OI. */
+
+ static inline use_operand_p
+ oi_use_ptr (const struct op_iterator *oi)
+ {
+ switch (oi->atype)
+ {
+ case OT_USE:
+ return USE_OP_PTR (oi->aops.uses, oi->aop);
+
+ case OT_VDEF_USE:
+ return V_MAY_DEF_OP_PTR (oi->aops.v_may_defs, oi->aop);
+
+ case OT_VUSE:
+ return VUSE_OP_PTR (oi->aops.vuses, oi->aop);
+
+ case OT_PHI_USE:
+ case OT_PHI_VUSE:
+ return PHI_ARG_DEF_PTR (oi->aops.phi, oi->aop);
+
+ default:
+ abort ();
+ }
+ }
+
+ /* Gets the def_ptr to operand pointed to by OI. */
+
+ static inline def_operand_p
+ oi_def_ptr (const struct op_iterator *oi)
+ {
+ switch (oi->atype)
+ {
+ case OT_DEF:
+ return DEF_OP_PTR (oi->aops.defs, oi->aop);
+
+ case OT_VDEF_DEF:
+ return V_MAY_DEF_RESULT_PTR (oi->aops.v_may_defs, oi->aop);
+
+ case OT_VMUST_DEF:
+ return V_MUST_DEF_OP_PTR (oi->aops.v_must_defs, oi->aop);
+
+ case OT_PHI_DEF:
+ case OT_PHI_VDEF:
+ return PHI_RESULT_PTR (oi->aops.phi);
+
+ default:
+ abort ();
+ }
+ }
+
+ /* For operand iterator OI pointing to V_MAY_DEF_RESULT,
+ return use_ptr of corresponding V_MAY_DEF_OP. */
+
+ static inline use_operand_p
+ oi_use_ptr_from_vdef_def (const struct op_iterator *oi)
+ {
+ if (oi->atype != OT_VDEF_DEF)
+ abort ();
+
+ return V_MAY_DEF_OP_PTR (oi->aops.v_may_defs, oi->aop);
+ }
+
+ /* For operand iterator OI pointing to V_MAY_DEF_OP,
+ return def_ptr of corresponding V_MAY_DEF_RESULT. */
+
+ static inline def_operand_p
+ oi_def_ptr_from_vdef_use (const struct op_iterator *oi)
+ {
+ if (oi->atype != OT_VDEF_USE)
+ abort ();
+
+ return V_MAY_DEF_RESULT_PTR (oi->aops.v_may_defs, oi->aop);
+ }
+
#endif /* _TREE_FLOW_INLINE_H */
Index: tree-into-ssa.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-into-ssa.c,v
retrieving revision 2.11
diff -c -3 -p -r2.11 tree-into-ssa.c
*** tree-into-ssa.c 17 Jun 2004 18:13:15 -0000 2.11
--- tree-into-ssa.c 24 Jun 2004 00:20:08 -0000
*************** mark_def_sites (struct dom_walk_data *wa
*** 212,294 ****
{
struct mark_def_sites_global_data *gd = walk_data->global_data;
sbitmap kills = gd->kills;
! v_may_def_optype v_may_defs;
! v_must_def_optype v_must_defs;
! vuse_optype vuses;
! def_optype defs;
! use_optype uses;
! size_t i, uid;
tree stmt;
- stmt_ann_t ann;
/* Mark all the blocks that have definitions for each variable in the
VARS_TO_RENAME bitmap. */
stmt = bsi_stmt (bsi);
get_stmt_operands (stmt);
- ann = stmt_ann (stmt);
/* If a variable is used before being set, then the variable is live
across a block boundary, so mark it live-on-entry to BB. */
! uses = USE_OPS (ann);
! for (i = 0; i < NUM_USES (uses); i++)
{
! use_operand_p use_p = USE_OP_PTR (uses, i);
if (prepare_use_operand_for_rename (use_p, &uid)
&& !TEST_BIT (kills, uid))
set_livein_block (USE_FROM_PTR (use_p), bb);
}
-
- /* Similarly for virtual uses. */
- vuses = VUSE_OPS (ann);
- for (i = 0; i < NUM_VUSES (vuses); i++)
- {
- use_operand_p use_p = VUSE_OP_PTR (vuses, i);
-
- if (prepare_use_operand_for_rename (use_p, &uid))
- set_livein_block (USE_FROM_PTR (use_p), bb);
- }
! /* Note that virtual definitions are irrelevant for computing KILLS
! because a V_MAY_DEF does not constitute a killing definition of the
! variable. However, the operand of a virtual definitions is a use
! of the variable, so it may cause the variable to be considered
! live-on-entry. */
! v_may_defs = V_MAY_DEF_OPS (ann);
! for (i = 0; i < NUM_V_MAY_DEFS (v_may_defs); i++)
{
! use_operand_p use_p = V_MAY_DEF_OP_PTR (v_may_defs, i);
if (prepare_use_operand_for_rename (use_p, &uid))
{
/* If we do not already have an SSA_NAME for our destination,
then set the destination to the source. */
! if (TREE_CODE (V_MAY_DEF_RESULT (v_may_defs, i)) != SSA_NAME)
! SET_V_MAY_DEF_RESULT (v_may_defs, i, USE_FROM_PTR (use_p));
set_livein_block (USE_FROM_PTR (use_p), bb);
! set_def_block (V_MAY_DEF_RESULT (v_may_defs, i), bb);
! }
! }
!
! /* Now process the virtual must-defs made by this statement. */
! v_must_defs = V_MUST_DEF_OPS (ann);
! for (i = 0; i < NUM_V_MUST_DEFS (v_must_defs); i++)
! {
! tree def = V_MUST_DEF_OP (v_must_defs, i);
!
! if (prepare_def_operand_for_rename (def, &uid))
! {
! set_def_block (def, bb);
! SET_BIT (kills, uid);
}
}
/* Now process the definition made by this statement. Mark the
variables in KILLS. */
! defs = DEF_OPS (ann);
! for (i = 0; i < NUM_DEFS (defs); i++)
{
! tree def = DEF_OP (defs, i);
if (prepare_def_operand_for_rename (def, &uid))
{
--- 212,260 ----
{
struct mark_def_sites_global_data *gd = walk_data->global_data;
sbitmap kills = gd->kills;
! oii oi;
! size_t uid;
tree stmt;
/* Mark all the blocks that have definitions for each variable in the
VARS_TO_RENAME bitmap. */
stmt = bsi_stmt (bsi);
get_stmt_operands (stmt);
/* If a variable is used before being set, then the variable is live
across a block boundary, so mark it live-on-entry to BB. */
! for (oi_init (&oi, stmt, OI_USES_AND_VUSES); !oi_end_p (&oi); oi_next (&oi))
{
! use_operand_p use_p = oi_use_ptr (&oi);
if (prepare_use_operand_for_rename (use_p, &uid)
&& !TEST_BIT (kills, uid))
set_livein_block (USE_FROM_PTR (use_p), bb);
}
! /* Process the virtual may-defs made by this statement. These do not set
! or test KILL. */
! for (oi_init (&oi, stmt, OI_V_MAY_DEFS); !oi_end_p (&oi); oi_next (&oi))
{
! use_operand_p use_p = oi_use_ptr_from_vdef_def (&oi);
!
if (prepare_use_operand_for_rename (use_p, &uid))
{
/* If we do not already have an SSA_NAME for our destination,
then set the destination to the source. */
! if (TREE_CODE (oi_op (&oi)) != SSA_NAME)
! oi_set_op (&oi, USE_FROM_PTR (use_p));
set_livein_block (USE_FROM_PTR (use_p), bb);
! set_def_block (oi_op (&oi), bb);
}
}
/* Now process the definition made by this statement. Mark the
variables in KILLS. */
! for (oi_init (&oi, stmt, OI_ALL_DEFS); !oi_end_p (&oi); oi_next (&oi))
{
! tree def = oi_op (&oi);
if (prepare_def_operand_for_rename (def, &uid))
{
*************** rewrite_stmt (struct dom_walk_data *walk
*** 740,759 ****
basic_block bb ATTRIBUTE_UNUSED,
block_stmt_iterator si)
{
- size_t i;
- stmt_ann_t ann;
tree stmt;
- vuse_optype vuses;
- v_may_def_optype v_may_defs;
- v_must_def_optype v_must_defs;
- def_optype defs;
- use_optype uses;
struct rewrite_block_data *bd;
bd = VARRAY_TOP_GENERIC_PTR (walk_data->block_data_stack);
stmt = bsi_stmt (si);
- ann = stmt_ann (stmt);
if (dump_file && (dump_flags & TDF_DETAILS))
{
--- 706,718 ----
basic_block bb ATTRIBUTE_UNUSED,
block_stmt_iterator si)
{
tree stmt;
struct rewrite_block_data *bd;
+ oii oi;
bd = VARRAY_TOP_GENERIC_PTR (walk_data->block_data_stack);
stmt = bsi_stmt (si);
if (dump_file && (dump_flags & TDF_DETAILS))
{
*************** rewrite_stmt (struct dom_walk_data *walk
*** 765,792 ****
#if defined ENABLE_CHECKING
/* We have just scanned the code for operands. No statement should
be modified. */
! if (ann->modified)
abort ();
#endif
- defs = DEF_OPS (ann);
- uses = USE_OPS (ann);
- vuses = VUSE_OPS (ann);
- v_may_defs = V_MAY_DEF_OPS (ann);
- v_must_defs = V_MUST_DEF_OPS (ann);
-
/* Step 1. Rewrite USES and VUSES in the statement. */
! for (i = 0; i < NUM_USES (uses); i++)
! rewrite_operand (USE_OP_PTR (uses, i));
! /* Rewrite virtual uses in the statement. */
! for (i = 0; i < NUM_VUSES (vuses); i++)
! rewrite_operand (VUSE_OP_PTR (vuses, i));
!
! /* Step 2. Register the statement's DEF and VDEF operands. */
! for (i = 0; i < NUM_DEFS (defs); i++)
{
! def_operand_p def_p = DEF_OP_PTR (defs, i);
if (TREE_CODE (DEF_FROM_PTR (def_p)) != SSA_NAME)
SET_DEF (def_p, make_ssa_name (DEF_FROM_PTR (def_p), stmt));
--- 724,740 ----
#if defined ENABLE_CHECKING
/* We have just scanned the code for operands. No statement should
be modified. */
! if (stmt_modified_p (stmt))
abort ();
#endif
/* Step 1. Rewrite USES and VUSES in the statement. */
! for (oi_init (&oi, stmt, OI_ALL_USES); !oi_end_p (&oi); oi_next (&oi))
! rewrite_operand (oi_use_ptr (&oi));
! for (oi_init (&oi, stmt, OI_ALL_DEFS); !oi_end_p (&oi); oi_next (&oi))
{
! def_operand_p def_p = oi_def_ptr (&oi);
if (TREE_CODE (DEF_FROM_PTR (def_p)) != SSA_NAME)
SET_DEF (def_p, make_ssa_name (DEF_FROM_PTR (def_p), stmt));
*************** rewrite_stmt (struct dom_walk_data *walk
*** 795,830 ****
doesn't need to be renamed. */
register_new_def (DEF_FROM_PTR (def_p), &bd->block_defs);
}
-
- /* Register new virtual definitions made by the statement. */
- for (i = 0; i < NUM_V_MAY_DEFS (v_may_defs); i++)
- {
- rewrite_operand (V_MAY_DEF_OP_PTR (v_may_defs, i));
-
- if (TREE_CODE (V_MAY_DEF_RESULT (v_may_defs, i)) != SSA_NAME)
- SET_V_MAY_DEF_RESULT (v_may_defs, i,
- make_ssa_name (V_MAY_DEF_RESULT (v_may_defs, i),
- stmt));
-
- /* FIXME: We shouldn't be registering new defs if the variable
- doesn't need to be renamed. */
- register_new_def (V_MAY_DEF_RESULT (v_may_defs, i), &bd->block_defs);
- }
-
- /* Register new virtual mustdefs made by the statement. */
- for (i = 0; i < NUM_V_MUST_DEFS (v_must_defs); i++)
- {
- def_operand_p v_must_def_p = V_MUST_DEF_OP_PTR (v_must_defs, i);
-
- if (TREE_CODE (DEF_FROM_PTR (v_must_def_p)) != SSA_NAME)
- SET_DEF (v_must_def_p,
- make_ssa_name (DEF_FROM_PTR (v_must_def_p), stmt));
-
- /* FIXME: We shouldn't be registering new mustdefs if the variable
- doesn't need to be renamed. */
- register_new_def (DEF_FROM_PTR (v_must_def_p), &bd->block_defs);
- }
-
}
--- 743,748 ----
Index: tree-sra.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-sra.c,v
retrieving revision 2.8
diff -c -3 -p -r2.8 tree-sra.c
*** tree-sra.c 22 Jun 2004 03:06:41 -0000 2.8
--- tree-sra.c 24 Jun 2004 00:20:08 -0000
*************** sra_elt_eq (const void *x, const void *y
*** 111,152 ****
return true;
}
! /* Mark all the variables in V_MAY_DEF operands for STMT for renaming.
This becomes necessary when we modify all of a non-scalar. */
static void
! mark_all_v_may_defs (tree stmt)
{
! v_may_def_optype v_may_defs;
! size_t i, n;
get_stmt_operands (stmt);
- v_may_defs = V_MAY_DEF_OPS (stmt_ann (stmt));
- n = NUM_V_MAY_DEFS (v_may_defs);
! for (i = 0; i < n; i++)
{
! tree sym = V_MAY_DEF_RESULT (v_may_defs, i);
! bitmap_set_bit (vars_to_rename, var_ann (sym)->uid);
! }
! }
!
! /* Mark all the variables in V_MUST_DEF operands for STMT for renaming.
! This becomes necessary when we modify all of a non-scalar. */
!
! static void
! mark_all_v_must_defs (tree stmt)
! {
! v_must_def_optype v_must_defs;
! size_t i, n;
!
! get_stmt_operands (stmt);
! v_must_defs = V_MUST_DEF_OPS (stmt_ann (stmt));
! n = NUM_V_MUST_DEFS (v_must_defs);
!
! for (i = 0; i < n; i++)
! {
! tree sym = V_MUST_DEF_OP (v_must_defs, i);
bitmap_set_bit (vars_to_rename, var_ann (sym)->uid);
}
}
--- 111,129 ----
return true;
}
! /* Mark all the variables in VDEF operands for STMT for renaming.
This becomes necessary when we modify all of a non-scalar. */
static void
! mark_all_vdefs (tree stmt)
{
! oii oi;
get_stmt_operands (stmt);
! for (oi_init (&oi, stmt, OI_VDEFS); !oi_end_p (&oi); oi_next (&oi))
{
! tree sym = oi_op (&oi);
bitmap_set_bit (vars_to_rename, var_ann (sym)->uid);
}
}
*************** create_scalar_copies (tree lhs, tree rhs
*** 704,711 ****
/* Mark all the variables in VDEF operands for renaming, because
the VA_ARG_EXPR will now be in a different statement. */
! mark_all_v_may_defs (stmt);
! mark_all_v_must_defs (stmt);
/* Set RHS to be the new temporary TMP. */
rhs = tmp;
--- 681,687 ----
/* Mark all the variables in VDEF operands for renaming, because
the VA_ARG_EXPR will now be in a different statement. */
! mark_all_vdefs (stmt);
/* Set RHS to be the new temporary TMP. */
rhs = tmp;
*************** create_scalar_copies (tree lhs, tree rhs
*** 804,811 ****
/* Otherwise, mark all the symbols in the VDEFs for the last
scalarized statement just created. Since all the statements
introduce the same VDEFs, we only need to check the last one. */
! mark_all_v_may_defs (tsi_stmt (tsi));
! mark_all_v_must_defs (tsi_stmt (tsi));
}
else
abort ();
--- 780,786 ----
/* Otherwise, mark all the symbols in the VDEFs for the last
scalarized statement just created. Since all the statements
introduce the same VDEFs, we only need to check the last one. */
! mark_all_vdefs (tsi_stmt (tsi));
}
else
abort ();
Index: tree-ssa-alias.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-alias.c,v
retrieving revision 2.8
diff -c -3 -p -r2.8 tree-ssa-alias.c
*** tree-ssa-alias.c 16 Jun 2004 23:03:31 -0000 2.8
--- tree-ssa-alias.c 24 Jun 2004 00:20:08 -0000
*************** compute_points_to_and_addr_escape (struc
*** 524,529 ****
--- 524,530 ----
{
basic_block bb;
size_t i;
+ oii oi;
timevar_push (TV_TREE_PTA);
*************** compute_points_to_and_addr_escape (struc
*** 534,544 ****
for (si = bsi_start (bb); !bsi_end_p (si); bsi_next (&si))
{
- use_optype uses;
- def_optype defs;
- v_may_def_optype v_may_defs;
- v_must_def_optype v_must_defs;
- stmt_ann_t ann;
bitmap addr_taken;
tree stmt = bsi_stmt (si);
bool stmt_escapes_p = is_escape_site (stmt, &ai->num_calls_found);
--- 535,540 ----
*************** compute_points_to_and_addr_escape (struc
*** 577,587 ****
mark_call_clobbered (var);
});
! ann = stmt_ann (stmt);
! uses = USE_OPS (ann);
! for (i = 0; i < NUM_USES (uses); i++)
{
! tree op = USE_OP (uses, i);
var_ann_t v_ann = var_ann (SSA_NAME_VAR (op));
struct ptr_info_def *pi;
bool is_store;
--- 573,581 ----
mark_call_clobbered (var);
});
! for (oi_init (&oi, stmt, OI_USES); !oi_end_p (&oi); oi_next (&oi))
{
! tree op = oi_op (&oi);
var_ann_t v_ann = var_ann (SSA_NAME_VAR (op));
struct ptr_info_def *pi;
bool is_store;
*************** compute_points_to_and_addr_escape (struc
*** 648,657 ****
/* Update reference counter for definitions to any
potentially aliased variable. This is used in the alias
grouping heuristics. */
! defs = DEF_OPS (ann);
! for (i = 0; i < NUM_DEFS (defs); i++)
{
! tree op = DEF_OP (defs, i);
tree var = SSA_NAME_VAR (op);
var_ann_t ann = var_ann (var);
bitmap_set_bit (ai->written_vars, ann->uid);
--- 642,651 ----
/* Update reference counter for definitions to any
potentially aliased variable. This is used in the alias
grouping heuristics. */
!
! for (oi_init (&oi, stmt, OI_DEFS); !oi_end_p (&oi); oi_next (&oi))
{
! tree op = oi_op (&oi);
tree var = SSA_NAME_VAR (op);
var_ann_t ann = var_ann (var);
bitmap_set_bit (ai->written_vars, ann->uid);
*************** compute_points_to_and_addr_escape (struc
*** 660,684 ****
}
/* Mark variables in V_MAY_DEF operands as being written to. */
! v_may_defs = V_MAY_DEF_OPS (ann);
! for (i = 0; i < NUM_V_MAY_DEFS (v_may_defs); i++)
{
! tree op = V_MAY_DEF_OP (v_may_defs, i);
tree var = SSA_NAME_VAR (op);
var_ann_t ann = var_ann (var);
bitmap_set_bit (ai->written_vars, ann->uid);
}
- /* Mark variables in V_MUST_DEF operands as being written to. */
- v_must_defs = V_MUST_DEF_OPS (ann);
- for (i = 0; i < NUM_V_MUST_DEFS (v_must_defs); i++)
- {
- tree op = V_MUST_DEF_OP (v_must_defs, i);
- tree var = SSA_NAME_VAR (op);
- var_ann_t ann = var_ann (var);
- bitmap_set_bit (ai->written_vars, ann->uid);
- }
-
/* After promoting variables and computing aliasing we will
need to re-scan most statements. FIXME: Try to minimize the
number of statements re-scanned. It's not really necessary to
--- 654,667 ----
}
/* Mark variables in V_MAY_DEF operands as being written to. */
! for (oi_init (&oi, stmt, OI_VDEFS); !oi_end_p (&oi); oi_next (&oi))
{
! tree op = oi_op (&oi);
tree var = SSA_NAME_VAR (op);
var_ann_t ann = var_ann (var);
bitmap_set_bit (ai->written_vars, ann->uid);
}
/* After promoting variables and computing aliasing we will
need to re-scan most statements. FIXME: Try to minimize the
number of statements re-scanned. It's not really necessary to
*************** dump_points_to_info (FILE *file)
*** 2103,2114 ****
for (si = bsi_start (bb); !bsi_end_p (si); bsi_next (&si))
{
! stmt_ann_t ann = stmt_ann (bsi_stmt (si));
! def_optype defs = DEF_OPS (ann);
! if (defs)
! for (i = 0; i < NUM_DEFS (defs); i++)
! if (POINTER_TYPE_P (TREE_TYPE (DEF_OP (defs, i))))
! dump_points_to_info_for (file, DEF_OP (defs, i));
}
}
--- 2086,2098 ----
for (si = bsi_start (bb); !bsi_end_p (si); bsi_next (&si))
{
! oii oi;
!
! for (oi_init (&oi, bsi_stmt (si), OI_DEFS);
! !oi_end_p (&oi);
! oi_next (&oi))
! if (POINTER_TYPE_P (TREE_TYPE (oi_op (&oi))))
! dump_points_to_info_for (file, oi_op (&oi));
}
}
Index: tree-ssa-ccp.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-ccp.c,v
retrieving revision 2.13
diff -c -3 -p -r2.13 tree-ssa-ccp.c
*** tree-ssa-ccp.c 23 Jun 2004 00:25:55 -0000 2.13
--- tree-ssa-ccp.c 24 Jun 2004 00:20:09 -0000
*************** cp_lattice_meet (value val1, value val2)
*** 608,618 ****
static void
visit_stmt (tree stmt)
{
- size_t i;
stmt_ann_t ann;
! def_optype defs;
! v_may_def_optype v_may_defs;
! v_must_def_optype v_must_defs;
/* If the statement has already been deemed to be VARYING, don't simulate
it again. */
--- 608,615 ----
static void
visit_stmt (tree stmt)
{
stmt_ann_t ann;
! oii oi;
/* If the statement has already been deemed to be VARYING, don't simulate
it again. */
*************** visit_stmt (tree stmt)
*** 644,657 ****
/* Definitions made by statements other than assignments to SSA_NAMEs
represent unknown modifications to their outputs. Mark them VARYING. */
! else if (NUM_DEFS (defs = DEF_OPS (ann)) != 0)
{
DONT_SIMULATE_AGAIN (stmt) = 1;
! for (i = 0; i < NUM_DEFS (defs); i++)
! {
! tree def = DEF_OP (defs, i);
! def_to_varying (def);
! }
}
/* If STMT is a conditional branch, see if we can determine which branch
--- 641,651 ----
/* Definitions made by statements other than assignments to SSA_NAMEs
represent unknown modifications to their outputs. Mark them VARYING. */
! else if (NUM_DEFS (DEF_OPS (ann)) != 0)
{
DONT_SIMULATE_AGAIN (stmt) = 1;
! for (oi_init (&oi, stmt, OI_DEFS); !oi_end_p (&oi); oi_next (&oi))
! def_to_varying (oi_op (&oi));
}
/* If STMT is a conditional branch, see if we can determine which branch
*************** visit_stmt (tree stmt)
*** 671,685 ****
add_outgoing_control_edges (bb_for_stmt (stmt));
}
! /* Mark all V_MAY_DEF operands VARYING. */
! v_may_defs = V_MAY_DEF_OPS (ann);
! for (i = 0; i < NUM_V_MAY_DEFS (v_may_defs); i++)
! def_to_varying (V_MAY_DEF_RESULT (v_may_defs, i));
!
! /* Mark all V_MUST_DEF operands VARYING. */
! v_must_defs = V_MUST_DEF_OPS (ann);
! for (i = 0; i < NUM_V_MUST_DEFS (v_must_defs); i++)
! def_to_varying (V_MUST_DEF_OP (v_must_defs, i));
}
--- 665,673 ----
add_outgoing_control_edges (bb_for_stmt (stmt));
}
! /* Mark all VDEF operands VARYING. */
! for (oi_init (&oi, stmt, OI_VDEFS); !oi_end_p (&oi); oi_next (&oi))
! def_to_varying (oi_op (&oi));
}
*************** ccp_fold (tree stmt)
*** 932,955 ****
== FUNCTION_DECL)
&& DECL_BUILT_IN (TREE_OPERAND (TREE_OPERAND (rhs, 0), 0)))
{
! use_optype uses = STMT_USE_OPS (stmt);
! if (NUM_USES (uses) != 0)
{
tree *orig;
! size_t i;
/* Preserve the original values of every operand. */
! orig = xmalloc (sizeof (tree) * NUM_USES (uses));
! for (i = 0; i < NUM_USES (uses); i++)
! orig[i] = USE_OP (uses, i);
/* Substitute operands with their values and try to fold. */
replace_uses_in (stmt, NULL);
retval = fold_builtin (rhs);
/* Restore operands to their original form. */
! for (i = 0; i < NUM_USES (uses); i++)
! SET_USE_OP (uses, i, orig[i]);
free (orig);
}
}
--- 920,943 ----
== FUNCTION_DECL)
&& DECL_BUILT_IN (TREE_OPERAND (TREE_OPERAND (rhs, 0), 0)))
{
! unsigned num = num_operands_of_types (stmt, OI_USES);
! if (num > 0)
{
tree *orig;
! oii oi;
/* Preserve the original values of every operand. */
! orig = xmalloc (sizeof (tree) * num);
! for (oi_init (&oi, stmt, OI_USES); !oi_end_p (&oi); oi_next (&oi))
! orig[oi_index (&oi)] = oi_op (&oi);
/* Substitute operands with their values and try to fold. */
replace_uses_in (stmt, NULL);
retval = fold_builtin (rhs);
/* Restore operands to their original form. */
! for (oi_init (&oi, stmt, OI_USES); !oi_end_p (&oi); oi_next (&oi))
! oi_set_op (&oi, orig[oi_index (&oi)]);
free (orig);
}
}
*************** initialize (void)
*** 1137,1148 ****
{
block_stmt_iterator i;
tree stmt;
- stmt_ann_t ann;
- def_optype defs;
- v_may_def_optype v_may_defs;
- v_must_def_optype v_must_defs;
- size_t x;
int vary;
/* Get the default value for each definition. */
for (i = bsi_start (bb); !bsi_end_p (i); bsi_next (&i))
--- 1125,1132 ----
{
block_stmt_iterator i;
tree stmt;
int vary;
+ oii oi;
/* Get the default value for each definition. */
for (i = bsi_start (bb); !bsi_end_p (i); bsi_next (&i))
*************** initialize (void)
*** 1150,1182 ****
vary = 0;
stmt = bsi_stmt (i);
get_stmt_operands (stmt);
! ann = stmt_ann (stmt);
! defs = DEF_OPS (ann);
! for (x = 0; x < NUM_DEFS (defs); x++)
{
! tree def = DEF_OP (defs, x);
if (get_value (def)->lattice_val == VARYING)
vary = 1;
}
DONT_SIMULATE_AGAIN (stmt) = vary;
! /* Mark all V_MAY_DEF operands VARYING. */
! v_may_defs = V_MAY_DEF_OPS (ann);
! for (x = 0; x < NUM_V_MAY_DEFS (v_may_defs); x++)
{
! tree res = V_MAY_DEF_RESULT (v_may_defs, x);
get_value (res)->lattice_val = VARYING;
SET_BIT (virtual_var, SSA_NAME_VERSION (res));
}
-
- /* Mark all V_MUST_DEF operands VARYING. */
- v_must_defs = V_MUST_DEF_OPS (ann);
- for (x = 0; x < NUM_V_MUST_DEFS (v_must_defs); x++)
- {
- tree v_must_def = V_MUST_DEF_OP (v_must_defs, x);
- get_value (v_must_def)->lattice_val = VARYING;
- SET_BIT (virtual_var, SSA_NAME_VERSION (v_must_def));
- }
}
for (e = bb->succ; e; e = e->succ_next)
--- 1134,1155 ----
vary = 0;
stmt = bsi_stmt (i);
get_stmt_operands (stmt);
!
! for (oi_init (&oi, stmt, OI_DEFS); !oi_end_p (&oi); oi_next (&oi))
{
! tree def = oi_op (&oi);
if (get_value (def)->lattice_val == VARYING)
vary = 1;
}
DONT_SIMULATE_AGAIN (stmt) = vary;
! /* Mark all VDEF operands VARYING. */
! for (oi_init (&oi, stmt, OI_VDEFS); !oi_end_p (&oi); oi_next (&oi))
{
! tree res = oi_op (&oi);
get_value (res)->lattice_val = VARYING;
SET_BIT (virtual_var, SSA_NAME_VERSION (res));
}
}
for (e = bb->succ; e; e = e->succ_next)
*************** static bool
*** 1415,1439 ****
replace_uses_in (tree stmt, bool *replaced_addresses_p)
{
bool replaced = false;
! use_optype uses;
! size_t i;
if (replaced_addresses_p)
*replaced_addresses_p = false;
get_stmt_operands (stmt);
! uses = STMT_USE_OPS (stmt);
! for (i = 0; i < NUM_USES (uses); i++)
{
! use_operand_p use = USE_OP_PTR (uses, i);
! value *val = get_value (USE_FROM_PTR (use));
if (val->lattice_val == CONSTANT)
{
! SET_USE (use, val->const_val);
replaced = true;
! if (POINTER_TYPE_P (TREE_TYPE (USE_FROM_PTR (use)))
&& replaced_addresses_p)
*replaced_addresses_p = true;
}
--- 1388,1410 ----
replace_uses_in (tree stmt, bool *replaced_addresses_p)
{
bool replaced = false;
! oii oi;
if (replaced_addresses_p)
*replaced_addresses_p = false;
get_stmt_operands (stmt);
! for (oi_init (&oi, stmt, OI_USES); !oi_end_p (&oi); oi_next (&oi))
{
! tree use = oi_op (&oi);
! value *val = get_value (use);
if (val->lattice_val == CONSTANT)
{
! oi_set_op (&oi, val->const_val);
replaced = true;
! if (POINTER_TYPE_P (TREE_TYPE (use))
&& replaced_addresses_p)
*replaced_addresses_p = true;
}
*************** replace_uses_in (tree stmt, bool *replac
*** 1455,1464 ****
static latticevalue
likely_value (tree stmt)
{
- use_optype uses;
- size_t i;
int found_constant = 0;
stmt_ann_t ann;
/* If the statement makes aliased loads or has volatile operands, it
won't fold to a constant value. */
--- 1426,1435 ----
static latticevalue
likely_value (tree stmt)
{
int found_constant = 0;
stmt_ann_t ann;
+ oii oi;
+ bool no_uses = true;
/* If the statement makes aliased loads or has volatile operands, it
won't fold to a constant value. */
*************** likely_value (tree stmt)
*** 1473,1484 ****
get_stmt_operands (stmt);
! uses = USE_OPS (ann);
! for (i = 0; i < NUM_USES (uses); i++)
{
! tree use = USE_OP (uses, i);
value *val = get_value (use);
if (val->lattice_val == UNDEFINED)
return UNDEFINED;
--- 1444,1456 ----
get_stmt_operands (stmt);
! for (oi_init (&oi, stmt, OI_USES); !oi_end_p (&oi); oi_next (&oi))
{
! tree use = oi_op (&oi);
value *val = get_value (use);
+ no_uses = false;
+
if (val->lattice_val == UNDEFINED)
return UNDEFINED;
*************** likely_value (tree stmt)
*** 1486,1492 ****
found_constant = 1;
}
! return ((found_constant || !uses) ? CONSTANT : VARYING);
}
/* A subroutine of fold_stmt_r. Attempts to fold *(A+O) to A[X].
--- 1458,1464 ----
found_constant = 1;
}
! return ((found_constant || no_uses) ? CONSTANT : VARYING);
}
/* A subroutine of fold_stmt_r. Attempts to fold *(A+O) to A[X].
*************** set_rhs (tree *stmt_p, tree expr)
*** 2160,2192 ****
if (TREE_SIDE_EFFECTS (expr))
{
! def_optype defs;
! v_may_def_optype v_may_defs;
! v_must_def_optype v_must_defs;
! size_t i;
/* Fix all the SSA_NAMEs created by *STMT_P to point to its new
replacement. */
- defs = DEF_OPS (ann);
- for (i = 0; i < NUM_DEFS (defs); i++)
- {
- tree var = DEF_OP (defs, i);
- if (TREE_CODE (var) == SSA_NAME)
- SSA_NAME_DEF_STMT (var) = *stmt_p;
- }
! v_may_defs = V_MAY_DEF_OPS (ann);
! for (i = 0; i < NUM_V_MAY_DEFS (v_may_defs); i++)
! {
! tree var = V_MAY_DEF_RESULT (v_may_defs, i);
! if (TREE_CODE (var) == SSA_NAME)
! SSA_NAME_DEF_STMT (var) = *stmt_p;
! }
!
! v_must_defs = V_MUST_DEF_OPS (ann);
! for (i = 0; i < NUM_V_MUST_DEFS (v_must_defs); i++)
{
! tree var = V_MUST_DEF_OP (v_must_defs, i);
if (TREE_CODE (var) == SSA_NAME)
SSA_NAME_DEF_STMT (var) = *stmt_p;
}
--- 2132,2145 ----
if (TREE_SIDE_EFFECTS (expr))
{
! oii oi;
/* Fix all the SSA_NAMEs created by *STMT_P to point to its new
replacement. */
! for (oi_init (&oi, stmt, OI_ALL_DEFS); !oi_end_p (&oi); oi_next (&oi))
{
! tree var = oi_op (&oi);
if (TREE_CODE (var) == SSA_NAME)
SSA_NAME_DEF_STMT (var) = *stmt_p;
}
Index: tree-ssa-copy.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-copy.c,v
retrieving revision 2.7
diff -c -3 -p -r2.7 tree-ssa-copy.c
*** tree-ssa-copy.c 17 Jun 2004 18:13:17 -0000 2.7
--- tree-ssa-copy.c 24 Jun 2004 00:20:09 -0000
*************** bool
*** 254,294 ****
cprop_into_stmt (tree stmt, varray_type const_and_copies)
{
bool may_have_exposed_new_symbols = false;
stmt_ann_t ann = stmt_ann (stmt);
- size_t i, num_uses, num_vuses, num_v_may_defs;
- vuse_optype vuses;
- v_may_def_optype v_may_defs;
- use_optype uses;
-
- uses = USE_OPS (ann);
- num_uses = NUM_USES (uses);
- for (i = 0; i < num_uses; i++)
- {
- use_operand_p op_p = USE_OP_PTR (uses, i);
- if (TREE_CODE (USE_FROM_PTR (op_p)) == SSA_NAME)
- may_have_exposed_new_symbols
- |= cprop_operand (ann, op_p, const_and_copies);
- }
! vuses = VUSE_OPS (ann);
! num_vuses = NUM_VUSES (vuses);
! for (i = 0; i < num_vuses; i++)
{
! use_operand_p op_p = VUSE_OP_PTR (vuses, i);
if (TREE_CODE (USE_FROM_PTR (op_p)) == SSA_NAME)
may_have_exposed_new_symbols
|= cprop_operand (ann, op_p, const_and_copies);
}
- v_may_defs = V_MAY_DEF_OPS (ann);
- num_v_may_defs = NUM_V_MAY_DEFS (v_may_defs);
- for (i = 0; i < num_v_may_defs; i++)
- {
- use_operand_p op_p = V_MAY_DEF_OP_PTR (v_may_defs, i);
- if (TREE_CODE (USE_FROM_PTR (op_p)) == SSA_NAME)
- may_have_exposed_new_symbols
- |= cprop_operand (ann, op_p, const_and_copies);
- }
return may_have_exposed_new_symbols;
}
--- 254,270 ----
cprop_into_stmt (tree stmt, varray_type const_and_copies)
{
bool may_have_exposed_new_symbols = false;
+ oii oi;
stmt_ann_t ann = stmt_ann (stmt);
! for (oi_init (&oi, stmt, OI_ALL_USES); !oi_end_p (&oi); oi_next (&oi))
{
! use_operand_p op_p = oi_use_ptr (&oi);
if (TREE_CODE (USE_FROM_PTR (op_p)) == SSA_NAME)
may_have_exposed_new_symbols
|= cprop_operand (ann, op_p, const_and_copies);
}
return may_have_exposed_new_symbols;
}
Index: tree-ssa-dce.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-dce.c,v
retrieving revision 2.7
diff -c -3 -p -r2.7 tree-ssa-dce.c
*** tree-ssa-dce.c 16 Jun 2004 23:03:32 -0000 2.7
--- tree-ssa-dce.c 24 Jun 2004 00:20:09 -0000
*************** need_to_preserve_store (tree ssa_name)
*** 285,295 ****
static void
mark_stmt_if_obviously_necessary (tree stmt, bool aggressive)
{
! def_optype defs;
! v_may_def_optype v_may_defs;
! v_must_def_optype v_must_defs;
stmt_ann_t ann;
- size_t i;
/* Statements that are implicitly live. Most function calls, asm and return
statements are required. Labels and BIND_EXPR nodes are kept because
--- 285,292 ----
static void
mark_stmt_if_obviously_necessary (tree stmt, bool aggressive)
{
! oii oi;
stmt_ann_t ann;
/* Statements that are implicitly live. Most function calls, asm and return
statements are required. Labels and BIND_EXPR nodes are kept because
*************** mark_stmt_if_obviously_necessary (tree s
*** 377,386 ****
get_stmt_operands (stmt);
! defs = DEF_OPS (ann);
! for (i = 0; i < NUM_DEFS (defs); i++)
{
! tree def = DEF_OP (defs, i);
if (need_to_preserve_store (def))
{
mark_stmt_necessary (stmt, true);
--- 374,382 ----
get_stmt_operands (stmt);
! for (oi_init (&oi, stmt, OI_ALL_DEFS); !oi_end_p (&oi); oi_next (&oi))
{
! tree def = oi_op (&oi);
if (need_to_preserve_store (def))
{
mark_stmt_necessary (stmt, true);
*************** mark_stmt_if_obviously_necessary (tree s
*** 388,415 ****
}
}
- v_may_defs = V_MAY_DEF_OPS (ann);
- for (i = 0; i < NUM_V_MAY_DEFS (v_may_defs); i++)
- {
- tree v_may_def = V_MAY_DEF_RESULT (v_may_defs, i);
- if (need_to_preserve_store (v_may_def))
- {
- mark_stmt_necessary (stmt, true);
- return;
- }
- }
-
- v_must_defs = V_MUST_DEF_OPS (ann);
- for (i = 0; i < NUM_V_MUST_DEFS (v_must_defs); i++)
- {
- tree v_must_def = V_MUST_DEF_OP (v_must_defs, i);
- if (need_to_preserve_store (v_must_def))
- {
- mark_stmt_necessary (stmt, true);
- return;
- }
- }
-
return;
}
--- 384,389 ----
*************** propagate_necessity (struct edge_list *e
*** 580,609 ****
/* Propagate through the operands. Examine all the USE, VUSE and
V_MAY_DEF operands in this statement. Mark all the statements
which feed this statement's uses as necessary. */
! vuse_optype vuses;
! v_may_def_optype v_may_defs;
! use_optype uses;
! stmt_ann_t ann;
! size_t k;
!
get_stmt_operands (i);
- ann = stmt_ann (i);
! uses = USE_OPS (ann);
! for (k = 0; k < NUM_USES (uses); k++)
! mark_operand_necessary (USE_OP (uses, k));
!
! vuses = VUSE_OPS (ann);
! for (k = 0; k < NUM_VUSES (vuses); k++)
! mark_operand_necessary (VUSE_OP (vuses, k));
!
! /* The operands of V_MAY_DEF expressions are also needed as they
! represent potential definitions that may reach this
! statement (V_MAY_DEF operands allow us to follow def-def
! links). */
! v_may_defs = V_MAY_DEF_OPS (ann);
! for (k = 0; k < NUM_V_MAY_DEFS (v_may_defs); k++)
! mark_operand_necessary (V_MAY_DEF_OP (v_may_defs, k));
}
}
}
--- 554,564 ----
/* Propagate through the operands. Examine all the USE, VUSE and
V_MAY_DEF operands in this statement. Mark all the statements
which feed this statement's uses as necessary. */
! oii oi;
get_stmt_operands (i);
! for (oi_init (&oi, i, OI_ALL_USES); !oi_end_p (&oi); oi_next (&oi))
! mark_operand_necessary (oi_op (&oi));
}
}
}
Index: tree-ssa-dom.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-dom.c,v
retrieving revision 2.13
diff -c -3 -p -r2.13 tree-ssa-dom.c
*** tree-ssa-dom.c 17 Jun 2004 18:13:17 -0000 2.13
--- tree-ssa-dom.c 24 Jun 2004 00:20:09 -0000
*************** redirect_edges_and_update_ssa_graph (var
*** 345,380 ****
are bypassing must also be taken our of SSA form. */
for (bsi = bsi_start (e->dest); ! bsi_end_p (bsi); bsi_next (&bsi))
{
- unsigned int j;
- def_optype defs;
- v_may_def_optype v_may_defs;
- v_must_def_optype v_must_defs;
tree stmt = bsi_stmt (bsi);
! stmt_ann_t ann = stmt_ann (stmt);
if (TREE_CODE (stmt) == COND_EXPR)
break;
get_stmt_operands (stmt);
! defs = DEF_OPS (ann);
! for (j = 0; j < NUM_DEFS (defs); j++)
{
! tree op = SSA_NAME_VAR (DEF_OP (defs, j));
! bitmap_set_bit (vars_to_rename, var_ann (op)->uid);
! }
!
! v_may_defs = STMT_V_MAY_DEF_OPS (stmt);
! for (j = 0; j < NUM_V_MAY_DEFS (v_may_defs); j++)
! {
! tree op = V_MAY_DEF_RESULT (v_may_defs, j);
! bitmap_set_bit (vars_to_rename, var_ann (op)->uid);
! }
!
! v_must_defs = STMT_V_MUST_DEF_OPS (stmt);
! for (j = 0; j < NUM_V_MUST_DEFS (v_must_defs); j++)
! {
! tree op = V_MUST_DEF_OP (v_must_defs, j);
bitmap_set_bit (vars_to_rename, var_ann (op)->uid);
}
}
--- 345,363 ----
are bypassing must also be taken our of SSA form. */
for (bsi = bsi_start (e->dest); ! bsi_end_p (bsi); bsi_next (&bsi))
{
tree stmt = bsi_stmt (bsi);
! oii oi;
if (TREE_CODE (stmt) == COND_EXPR)
break;
get_stmt_operands (stmt);
! for (oi_init (&oi, stmt, OI_ALL_DEFS); !oi_end_p (&oi); oi_next (&oi))
{
! tree op = oi_op (&oi);
! if (TREE_CODE (op) == SSA_NAME)
! op = SSA_NAME_VAR (op);
bitmap_set_bit (vars_to_rename, var_ann (op)->uid);
}
}
*************** thread_across_edge (struct dom_walk_data
*** 744,793 ****
if (!cached_lhs)
{
/* Copy the operands. */
! stmt_ann_t ann = stmt_ann (stmt);
! use_optype uses = USE_OPS (ann);
! vuse_optype vuses = VUSE_OPS (ann);
! tree *uses_copy = xcalloc (NUM_USES (uses), sizeof (tree));
! tree *vuses_copy = xcalloc (NUM_VUSES (vuses), sizeof (tree));
! unsigned int i;
/* Make a copy of the uses into USES_COPY, then cprop into
the use operands. */
! for (i = 0; i < NUM_USES (uses); i++)
! {
! tree tmp = NULL;
!
! uses_copy[i] = USE_OP (uses, i);
! if (TREE_CODE (USE_OP (uses, i)) == SSA_NAME)
! tmp = get_value_for (USE_OP (uses, i), const_and_copies);
! if (tmp)
! SET_USE_OP (uses, i, tmp);
! }
!
! /* Similarly for virtual uses. */
! for (i = 0; i < NUM_VUSES (vuses); i++)
{
tree tmp = NULL;
! vuses_copy[i] = VUSE_OP (vuses, i);
! if (TREE_CODE (VUSE_OP (vuses, i)) == SSA_NAME)
! tmp = get_value_for (VUSE_OP (vuses, i), const_and_copies);
if (tmp)
! SET_VUSE_OP (vuses, i, tmp);
}
/* Try to lookup the new expression. */
cached_lhs = lookup_avail_expr (stmt, NULL, false);
/* Restore the statement's original uses/defs. */
! for (i = 0; i < NUM_USES (uses); i++)
! SET_USE_OP (uses, i, uses_copy[i]);
!
! for (i = 0; i < NUM_VUSES (vuses); i++)
! SET_VUSE_OP (vuses, i, vuses_copy[i]);
free (uses_copy);
- free (vuses_copy);
/* If we still did not find the expression in the hash table,
then we can not ignore this statement. */
--- 727,763 ----
if (!cached_lhs)
{
/* Copy the operands. */
! unsigned num_uses = num_operands_of_types (stmt, OI_USES_AND_VUSES);
! tree *uses_copy = xcalloc (num_uses, sizeof (tree));
! oii oi;
/* Make a copy of the uses into USES_COPY, then cprop into
the use operands. */
!
! for (oi_init (&oi, stmt, OI_USES_AND_VUSES);
! !oi_end_p (&oi);
! oi_next (&oi))
{
+ tree op = oi_op (&oi);
tree tmp = NULL;
! uses_copy[oi_index (&oi)] = op;
! if (TREE_CODE (op) == SSA_NAME)
! tmp = get_value_for (op, const_and_copies);
if (tmp)
! oi_set_op (&oi, tmp);
}
/* Try to lookup the new expression. */
cached_lhs = lookup_avail_expr (stmt, NULL, false);
/* Restore the statement's original uses/defs. */
! for (oi_init (&oi, stmt, OI_USES_AND_VUSES);
! !oi_end_p (&oi);
! oi_next (&oi))
! oi_set_op (&oi, uses_copy[oi_index (&oi)]);
free (uses_copy);
/* If we still did not find the expression in the hash table,
then we can not ignore this statement. */
*************** record_equivalences_from_stmt (tree stmt
*** 2494,2500 ****
{
tree rhs = TREE_OPERAND (stmt, 1);
tree new;
- size_t j;
/* FIXME: If the LHS of the assignment is a bitfield and the RHS
is a constant, we need to adjust the constant to fit into the
--- 2464,2469 ----
*************** record_equivalences_from_stmt (tree stmt
*** 2519,2526 ****
if (rhs)
{
! v_may_def_optype v_may_defs = V_MAY_DEF_OPS (ann);
! v_must_def_optype v_must_defs = V_MUST_DEF_OPS (ann);
/* Build a new statement with the RHS and LHS exchanged. */
new = build (MODIFY_EXPR, TREE_TYPE (stmt), rhs, lhs);
--- 2488,2494 ----
if (rhs)
{
! oii oi;
/* Build a new statement with the RHS and LHS exchanged. */
new = build (MODIFY_EXPR, TREE_TYPE (stmt), rhs, lhs);
*************** record_equivalences_from_stmt (tree stmt
*** 2539,2555 ****
/* For each VDEF on the original statement, we want to create a
VUSE of the V_MAY_DEF result or V_MUST_DEF op on the new
statement. */
! for (j = 0; j < NUM_V_MAY_DEFS (v_may_defs); j++)
! {
! tree op = V_MAY_DEF_RESULT (v_may_defs, j);
! add_vuse (op, new);
! }
!
! for (j = 0; j < NUM_V_MUST_DEFS (v_must_defs); j++)
! {
! tree op = V_MUST_DEF_OP (v_must_defs, j);
! add_vuse (op, new);
! }
finalize_ssa_stmt_operands (new);
--- 2507,2514 ----
/* For each VDEF on the original statement, we want to create a
VUSE of the V_MAY_DEF result or V_MUST_DEF op on the new
statement. */
! for (oi_init_ann (&oi, ann, OI_VDEFS); !oi_end_p (&oi); oi_next (&oi))
! add_vuse (oi_op (&oi), new);
finalize_ssa_stmt_operands (new);
*************** avail_expr_hash (const void *p)
*** 3092,3099 ****
stmt_ann_t ann = ((struct expr_hash_elt *)p)->ann;
tree rhs = ((struct expr_hash_elt *)p)->rhs;
hashval_t val = 0;
! size_t i;
! vuse_optype vuses;
/* iterative_hash_expr knows how to deal with any expression and
deals with commutative operators as well, so just use it instead
--- 3051,3057 ----
stmt_ann_t ann = ((struct expr_hash_elt *)p)->ann;
tree rhs = ((struct expr_hash_elt *)p)->rhs;
hashval_t val = 0;
! oii oi;
/* iterative_hash_expr knows how to deal with any expression and
deals with commutative operators as well, so just use it instead
*************** avail_expr_hash (const void *p)
*** 3110,3118 ****
because compound variables like arrays are not renamed in the
operands. Rather, the rename is done on the virtual variable
representing all the elements of the array. */
! vuses = VUSE_OPS (ann);
! for (i = 0; i < NUM_VUSES (vuses); i++)
! val = iterative_hash_expr (VUSE_OP (vuses, i), val);
return val;
}
--- 3068,3076 ----
because compound variables like arrays are not renamed in the
operands. Rather, the rename is done on the virtual variable
representing all the elements of the array. */
!
! for (oi_init_ann (&oi, ann, (1 << OT_VUSE)); !oi_end_p (&oi); oi_next (&oi))
! val = iterative_hash_expr (oi_op (&oi), val);
return val;
}
*************** avail_expr_eq (const void *p1, const voi
*** 3185,3221 ****
static void
register_definitions_for_stmt (stmt_ann_t ann, varray_type *block_defs_p)
{
! def_optype defs;
! v_may_def_optype v_may_defs;
! v_must_def_optype v_must_defs;
! unsigned int i;
! defs = DEF_OPS (ann);
! for (i = 0; i < NUM_DEFS (defs); i++)
{
! tree def = DEF_OP (defs, i);
/* FIXME: We shouldn't be registering new defs if the variable
doesn't need to be renamed. */
register_new_def (def, block_defs_p);
}
-
- /* Register new virtual definitions made by the statement. */
- v_may_defs = V_MAY_DEF_OPS (ann);
- for (i = 0; i < NUM_V_MAY_DEFS (v_may_defs); i++)
- {
- /* FIXME: We shouldn't be registering new defs if the variable
- doesn't need to be renamed. */
- register_new_def (V_MAY_DEF_RESULT (v_may_defs, i), block_defs_p);
- }
-
- /* Register new virtual mustdefs made by the statement. */
- v_must_defs = V_MUST_DEF_OPS (ann);
- for (i = 0; i < NUM_V_MUST_DEFS (v_must_defs); i++)
- {
- /* FIXME: We shouldn't be registering new defs if the variable
- doesn't need to be renamed. */
- register_new_def (V_MUST_DEF_OP (v_must_defs, i), block_defs_p);
- }
}
--- 3143,3157 ----
static void
register_definitions_for_stmt (stmt_ann_t ann, varray_type *block_defs_p)
{
! oii oi;
! for (oi_init_ann (&oi, ann, OI_ALL_DEFS); !oi_end_p (&oi); oi_next (&oi))
{
! tree def = oi_op (&oi);
/* FIXME: We shouldn't be registering new defs if the variable
doesn't need to be renamed. */
register_new_def (def, block_defs_p);
}
}
Index: tree-ssa-dse.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-dse.c,v
retrieving revision 2.4
diff -c -3 -p -r2.4 tree-ssa-dse.c
*** tree-ssa-dse.c 17 Jun 2004 18:13:18 -0000 2.4
--- tree-ssa-dse.c 24 Jun 2004 00:20:09 -0000
*************** need_imm_uses_for (tree var)
*** 115,138 ****
static void
fix_phi_uses (tree phi, tree stmt)
{
! stmt_ann_t ann = stmt_ann (stmt);
! v_may_def_optype v_may_defs;
! unsigned int i;
int j;
get_stmt_operands (stmt);
- v_may_defs = V_MAY_DEF_OPS (ann);
/* Walk each V_MAY_DEF in STMT. */
! for (i = 0; i < NUM_V_MAY_DEFS (v_may_defs); i++)
{
! tree v_may_def = V_MAY_DEF_RESULT (v_may_defs, i);
/* Find any uses in the PHI which match V_MAY_DEF and replace
them with the appropriate V_MAY_DEF_OP. */
for (j = 0; j < PHI_NUM_ARGS (phi); j++)
if (v_may_def == PHI_ARG_DEF (phi, j))
! SET_PHI_ARG_DEF (phi, j, V_MAY_DEF_OP (v_may_defs, i));
}
}
--- 115,137 ----
static void
fix_phi_uses (tree phi, tree stmt)
{
! oii oi;
int j;
get_stmt_operands (stmt);
/* Walk each V_MAY_DEF in STMT. */
!
! for (oi_init (&oi, stmt, OI_V_MAY_DEFS); !oi_end_p (&oi); oi_next (&oi))
{
! tree v_may_def = oi_op (&oi);
! tree v_may_use = USE_FROM_PTR (oi_use_ptr_from_vdef_def (&oi));
/* Find any uses in the PHI which match V_MAY_DEF and replace
them with the appropriate V_MAY_DEF_OP. */
for (j = 0; j < PHI_NUM_ARGS (phi); j++)
if (v_may_def == PHI_ARG_DEF (phi, j))
! SET_PHI_ARG_DEF (phi, j, v_may_use);
}
}
*************** fix_phi_uses (tree phi, tree stmt)
*** 142,170 ****
static void
fix_stmt_v_may_defs (tree stmt1, tree stmt2)
{
! stmt_ann_t ann1 = stmt_ann (stmt1);
! stmt_ann_t ann2 = stmt_ann (stmt2);
! v_may_def_optype v_may_defs1;
! v_may_def_optype v_may_defs2;
! unsigned int i, j;
!
! get_stmt_operands (stmt1);
! get_stmt_operands (stmt2);
! v_may_defs1 = V_MAY_DEF_OPS (ann1);
! v_may_defs2 = V_MAY_DEF_OPS (ann2);
/* Walk each V_MAY_DEF_OP in stmt1. */
! for (i = 0; i < NUM_V_MAY_DEFS (v_may_defs1); i++)
{
! tree v_may_def1 = V_MAY_DEF_OP (v_may_defs1, i);
/* Find the appropriate V_MAY_DEF_RESULT in STMT2. */
! for (j = 0; j < NUM_V_MAY_DEFS (v_may_defs2); j++)
{
! if (v_may_def1 == V_MAY_DEF_RESULT (v_may_defs2, j))
{
/* Update. */
! SET_V_MAY_DEF_OP (v_may_defs1, i, V_MAY_DEF_OP (v_may_defs2, j));
break;
}
}
--- 141,163 ----
static void
fix_stmt_v_may_defs (tree stmt1, tree stmt2)
{
! oii oi1, oi2;
/* Walk each V_MAY_DEF_OP in stmt1. */
! for (oi_init (&oi1, stmt1, (1 << OT_VDEF_USE)); !oi_end_p (&oi1); oi_next (&oi1))
{
! tree v_may_def1 = oi_op (&oi1);
/* Find the appropriate V_MAY_DEF_RESULT in STMT2. */
! for (oi_init (&oi2, stmt2, (1 << OT_VDEF_USE));
! !oi_end_p (&oi2);
! oi_next (&oi2))
{
! tree v_may_def2 = DEF_FROM_PTR (oi_def_ptr_from_vdef_use (&oi2));
! if (v_may_def1 == v_may_def2)
{
/* Update. */
! oi_set_op (&oi1, oi_op (&oi2));
break;
}
}
*************** fix_stmt_v_may_defs (tree stmt1, tree st
*** 172,178 ****
#ifdef ENABLE_CHECKING
/* If we did not find a corresponding V_MAY_DEF_RESULT, then something
has gone terribly wrong. */
! if (j == NUM_V_MAY_DEFS (v_may_defs2))
abort ();
#endif
--- 165,171 ----
#ifdef ENABLE_CHECKING
/* If we did not find a corresponding V_MAY_DEF_RESULT, then something
has gone terribly wrong. */
! if (oi_end_p (&oi2))
abort ();
#endif
*************** dse_optimize_stmt (struct dom_walk_data
*** 234,247 ****
struct dse_global_data *dse_gd = walk_data->global_data;
tree stmt = bsi_stmt (bsi);
stmt_ann_t ann = stmt_ann (stmt);
- v_may_def_optype v_may_defs;
get_stmt_operands (stmt);
- v_may_defs = V_MAY_DEF_OPS (ann);
/* If this statement has no virtual uses, then there is nothing
to do. */
! if (NUM_V_MAY_DEFS (v_may_defs) == 0)
return;
/* We know we have virtual definitions. If this is a MODIFY_EXPR, then
--- 227,238 ----
struct dse_global_data *dse_gd = walk_data->global_data;
tree stmt = bsi_stmt (bsi);
stmt_ann_t ann = stmt_ann (stmt);
get_stmt_operands (stmt);
/* If this statement has no virtual uses, then there is nothing
to do. */
! if (num_operands_of_types (stmt, 1 << OT_VDEF_DEF) == 0)
return;
/* We know we have virtual definitions. If this is a MODIFY_EXPR, then
Index: tree-ssa-live.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-live.c,v
retrieving revision 2.10
diff -c -3 -p -r2.10 tree-ssa-live.c
*** tree-ssa-live.c 17 Jun 2004 18:13:18 -0000 2.10
--- tree-ssa-live.c 24 Jun 2004 00:20:09 -0000
*************** create_ssa_var_map (int flags)
*** 294,309 ****
{
block_stmt_iterator bsi;
basic_block bb;
! tree dest, use;
tree stmt;
- stmt_ann_t ann;
- vuse_optype vuses;
- v_may_def_optype v_may_defs;
- v_must_def_optype v_must_defs;
- use_optype uses;
- def_optype defs;
- unsigned x;
var_map map;
#if defined ENABLE_CHECKING
sbitmap used_in_real_ops;
sbitmap used_in_virtual_ops;
--- 294,303 ----
{
block_stmt_iterator bsi;
basic_block bb;
! tree use;
tree stmt;
var_map map;
+ oii oi;
#if defined ENABLE_CHECKING
sbitmap used_in_real_ops;
sbitmap used_in_virtual_ops;
*************** create_ssa_var_map (int flags)
*** 345,409 ****
{
stmt = bsi_stmt (bsi);
get_stmt_operands (stmt);
- ann = stmt_ann (stmt);
/* Register USE and DEF operands in each statement. */
! uses = USE_OPS (ann);
! for (x = 0; x < NUM_USES (uses); x++)
{
! use = USE_OP (uses, x);
! register_ssa_partition (map, use, true);
#if defined ENABLE_CHECKING
SET_BIT (used_in_real_ops, var_ann (SSA_NAME_VAR (use))->uid);
#endif
}
- defs = DEF_OPS (ann);
- for (x = 0; x < NUM_DEFS (defs); x++)
- {
- dest = DEF_OP (defs, x);
- register_ssa_partition (map, dest, false);
-
- #if defined ENABLE_CHECKING
- SET_BIT (used_in_real_ops, var_ann (SSA_NAME_VAR (dest))->uid);
- #endif
- }
-
/* While we do not care about virtual operands for
out of SSA, we do need to look at them to make sure
we mark all the variables which are used. */
! vuses = VUSE_OPS (ann);
! for (x = 0; x < NUM_VUSES (vuses); x++)
! {
! tree var = VUSE_OP (vuses, x);
! set_is_used (var);
!
! #if defined ENABLE_CHECKING
! SET_BIT (used_in_virtual_ops, var_ann (SSA_NAME_VAR (var))->uid);
! #endif
! }
!
! 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_is_used (var);
#if defined ENABLE_CHECKING
SET_BIT (used_in_virtual_ops, var_ann (SSA_NAME_VAR (var))->uid);
#endif
}
-
- 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_is_used (var);
- #if defined ENABLE_CHECKING
- SET_BIT (used_in_virtual_ops, var_ann (SSA_NAME_VAR (var))->uid);
- #endif
- }
}
}
--- 339,368 ----
{
stmt = bsi_stmt (bsi);
get_stmt_operands (stmt);
/* Register USE and DEF operands in each statement. */
! for (oi_init (&oi, stmt, OI_ALL_REAL); !oi_end_p (&oi); oi_next (&oi))
{
! use = oi_op (&oi);
! register_ssa_partition (map, use, !oi_def_p (&oi));
#if defined ENABLE_CHECKING
SET_BIT (used_in_real_ops, var_ann (SSA_NAME_VAR (use))->uid);
#endif
}
/* While we do not care about virtual operands for
out of SSA, we do need to look at them to make sure
we mark all the variables which are used. */
! for (oi_init (&oi, stmt, OI_ALL_VIRTUAL); !oi_end_p (&oi); oi_next (&oi))
{
! tree var = oi_op (&oi);
set_is_used (var);
#if defined ENABLE_CHECKING
SET_BIT (used_in_virtual_ops, var_ann (SSA_NAME_VAR (var))->uid);
#endif
}
}
}
*************** calculate_live_on_entry (var_map map)
*** 562,574 ****
basic_block bb;
bitmap saw_def;
tree phi, var, stmt;
- tree op;
edge e;
varray_type stack;
block_stmt_iterator bsi;
- use_optype uses;
- def_optype defs;
- stmt_ann_t ann;
saw_def = BITMAP_XMALLOC ();
--- 521,529 ----
*************** calculate_live_on_entry (var_map map)
*** 611,635 ****
for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
{
stmt = bsi_stmt (bsi);
get_stmt_operands (stmt);
- ann = stmt_ann (stmt);
! uses = USE_OPS (ann);
! num = NUM_USES (uses);
! for (i = 0; i < num; i++)
! {
! 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++)
! {
! op = DEF_OP (defs, i);
! set_if_valid (map, saw_def, op);
! }
}
}
--- 566,581 ----
for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
{
+ oii oi;
+
stmt = bsi_stmt (bsi);
get_stmt_operands (stmt);
! for (oi_init (&oi, stmt, OI_USES); !oi_end_p (&oi); oi_next (&oi))
! add_livein_if_notdef (live, saw_def, oi_op (&oi), bb);
! for (oi_init (&oi, stmt, OI_DEFS); !oi_end_p (&oi); oi_next (&oi))
! set_if_valid (map, saw_def, oi_op (&oi));
}
}
*************** build_tree_conflict_graph (tree_live_inf
*** 1311,1321 ****
conflict_graph graph;
var_map map;
bitmap live;
! int num, x, y, i;
basic_block bb;
varray_type partition_link, tpa_to_clear, tpa_nodes;
- def_optype defs;
- use_optype uses;
unsigned l;
map = live_var_map (liveinfo);
--- 1257,1265 ----
conflict_graph graph;
var_map map;
bitmap live;
! int x, y, i;
basic_block bb;
varray_type partition_link, tpa_to_clear, tpa_nodes;
unsigned l;
map = live_var_map (liveinfo);
*************** build_tree_conflict_graph (tree_live_inf
*** 1342,1351 ****
{
bool is_a_copy = false;
tree stmt = bsi_stmt (bsi);
- stmt_ann_t ann;
get_stmt_operands (stmt);
- ann = stmt_ann (stmt);
/* A copy between 2 partitions does not introduce an interference
by itself. If they did, you would never be able to coalesce
--- 1286,1293 ----
*************** build_tree_conflict_graph (tree_live_inf
*** 1393,1415 ****
if (!is_a_copy)
{
! tree var;
! defs = DEF_OPS (ann);
! num = NUM_DEFS (defs);
! for (x = 0; x < num; x++)
! {
! 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++)
! {
! var = USE_OP (uses, x);
! set_if_valid (map, live, var);
! }
}
}
--- 1335,1347 ----
if (!is_a_copy)
{
! oii oi;
! for (oi_init (&oi, stmt, OI_DEFS); !oi_end_p (&oi); oi_next (&oi))
! add_conflicts_if_valid (tpa, graph, map, live, oi_op (&oi));
! for (oi_init (&oi, stmt, OI_USES); !oi_end_p (&oi); oi_next (&oi))
! set_if_valid (map, live, oi_op (&oi));
}
}
*************** register_ssa_partitions_for_vars (bitmap
*** 1870,1897 ****
statement in this block. */
for (bsi = bsi_start (bb); ! bsi_end_p (bsi); bsi_next (&bsi))
{
! stmt_ann_t ann = stmt_ann (bsi_stmt (bsi));
! use_optype uses = USE_OPS (ann);
! def_optype defs = DEF_OPS (ann);
! unsigned int i;
! for (i = 0; i < NUM_USES (uses); i++)
{
! tree op = USE_OP (uses, i);
if (TREE_CODE (op) == SSA_NAME
&& bitmap_bit_p (vars, var_ann (SSA_NAME_VAR (op))->uid))
! register_ssa_partition (map, op, 1);
! }
!
! for (i = 0; i < NUM_DEFS (defs); i++)
! {
! tree op = DEF_OP (defs, i);
!
! if (TREE_CODE (op) == SSA_NAME
! && bitmap_bit_p (vars,
! var_ann (SSA_NAME_VAR (op))->uid))
! register_ssa_partition (map, op, 0);
}
}
}
--- 1802,1818 ----
statement in this block. */
for (bsi = bsi_start (bb); ! bsi_end_p (bsi); bsi_next (&bsi))
{
! oii oi;
! for (oi_init (&oi, bsi_stmt (bsi), OI_ALL_REAL);
! !oi_end_p (&oi);
! oi_next (&oi))
{
! tree op = oi_op (&oi);
if (TREE_CODE (op) == SSA_NAME
&& bitmap_bit_p (vars, var_ann (SSA_NAME_VAR (op))->uid))
! register_ssa_partition (map, op, !oi_def_p (&oi));
}
}
}
Index: tree-ssa-loop.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-loop.c,v
retrieving revision 2.5
diff -c -3 -p -r2.5 tree-ssa-loop.c
*** tree-ssa-loop.c 17 Jun 2004 18:13:18 -0000 2.5
--- tree-ssa-loop.c 24 Jun 2004 00:20:09 -0000
*************** mark_defs_for_rewrite (basic_block bb)
*** 102,113 ****
{
tree stmt, var;
block_stmt_iterator bsi;
! stmt_ann_t ann;
! def_optype defs;
! v_may_def_optype v_may_defs;
! vuse_optype vuses;
! v_must_def_optype v_must_defs;
! unsigned i;
for (stmt = phi_nodes (bb); stmt; stmt = PHI_CHAIN (stmt))
{
--- 102,108 ----
{
tree stmt, var;
block_stmt_iterator bsi;
! oii oi;
for (stmt = phi_nodes (bb); stmt; stmt = PHI_CHAIN (stmt))
{
*************** mark_defs_for_rewrite (basic_block bb)
*** 126,137 ****
{
stmt = bsi_stmt (bsi);
get_stmt_operands (stmt);
- ann = stmt_ann (stmt);
! defs = DEF_OPS (ann);
! for (i = 0; i < NUM_DEFS (defs); i++)
{
! var = SSA_NAME_VAR (DEF_OP (defs, i));
bitmap_set_bit (vars_to_rename, var_ann (var)->uid);
/* If we have a type_mem_tag, add it as well. Due to rewriting the
--- 121,132 ----
{
stmt = bsi_stmt (bsi);
get_stmt_operands (stmt);
! for (oi_init (&oi, stmt, OI_ALL_DEFS | OI_VUSES);
! !oi_end_p (&oi);
! oi_next (&oi))
{
! var = SSA_NAME_VAR (oi_op (&oi));
bitmap_set_bit (vars_to_rename, var_ann (var)->uid);
/* If we have a type_mem_tag, add it as well. Due to rewriting the
*************** mark_defs_for_rewrite (basic_block bb)
*** 141,171 ****
if (var)
bitmap_set_bit (vars_to_rename, var_ann (var)->uid);
}
-
- v_may_defs = V_MAY_DEF_OPS (ann);
- for (i = 0; i < NUM_V_MAY_DEFS (v_may_defs); i++)
- {
- var = SSA_NAME_VAR (V_MAY_DEF_RESULT (v_may_defs, i));
- bitmap_set_bit (vars_to_rename, var_ann (var)->uid);
- }
-
- v_must_defs = V_MUST_DEF_OPS (ann);
- for (i = 0; i < NUM_V_MUST_DEFS (v_must_defs); i++)
- {
- var = SSA_NAME_VAR (V_MUST_DEF_OP (v_must_defs, i));
- bitmap_set_bit (vars_to_rename, var_ann (var)->uid);
- }
-
- /* We also need to rewrite vuses, since we will copy the statements
- and the ssa versions could not be recovered in the copy. We do
- not have to do this for operands of V_MAY_DEFS explicitly, since
- they have the same underlying variable as the results. */
- vuses = VUSE_OPS (ann);
- for (i = 0; i < NUM_VUSES (vuses); i++)
- {
- var = SSA_NAME_VAR (VUSE_OP (vuses, i));
- bitmap_set_bit (vars_to_rename, var_ann (var)->uid);
- }
}
}
--- 136,141 ----
Index: tree-ssa-operands.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-operands.h,v
retrieving revision 2.3
diff -c -3 -p -r2.3 tree-ssa-operands.h
*** tree-ssa-operands.h 17 Jun 2004 18:13:19 -0000 2.3
--- tree-ssa-operands.h 24 Jun 2004 00:20:09 -0000
*************** extern void remove_vuses (tree);
*** 165,168 ****
--- 165,247 ----
extern void remove_v_may_defs (tree);
extern void remove_v_must_defs (tree);
+ /* Types of operators. */
+ enum oi_op_type
+ {
+ OT_NONE,
+ OT_DEF,
+ OT_USE,
+ OT_VDEF_DEF,
+ OT_VDEF_USE,
+ OT_VMUST_DEF,
+ OT_VUSE,
+ OT_PHI_USE,
+ OT_PHI_DEF,
+ OT_PHI_VUSE,
+ OT_PHI_VDEF,
+ OT_MAX
+ };
+
+ #define OI_USES ((1 << OT_USE) | (1 << OT_PHI_USE))
+ #define OI_VUSES ((1 << OT_VUSE) | (1 << OT_VDEF_USE) | (1 << OT_PHI_VUSE))
+ #define OI_USES_AND_VUSES ((1 << OT_USE) | (1 << OT_PHI_USE) \
+ | (1 << OT_VUSE) | (1 << OT_PHI_VUSE))
+
+ #define OI_ALL_USES (OI_USES | OI_VUSES)
+
+ #define OI_V_MAY_DEFS (1 << OT_VDEF_DEF)
+
+ #define OI_DEFS ((1 << OT_DEF) | (1 << OT_PHI_DEF))
+ #define OI_VDEFS ((1 << OT_VDEF_DEF) | (1 << OT_VMUST_DEF) | (1 << OT_PHI_VDEF))
+ #define OI_ALL_DEFS (OI_DEFS | OI_VDEFS)
+
+ #define OI_ALL_REAL (OI_USES | OI_DEFS)
+ #define OI_ALL_VIRTUAL (OI_VUSES | OI_VDEFS)
+
+ #define OI_STMT_OPS ((1 << OT_USE) | (1 << OT_VUSE) | (1 << OT_VDEF_USE) \
+ | (1 << OT_DEF) | (1 << OT_VDEF_USE) | (1 << OT_VDEF_DEF) \
+ | (1 << OT_VMUST_DEF))
+ #define OI_PHI_OPS ((1 << OT_PHI_USE) | (1 << OT_PHI_DEF))
+ #define OI_PHI_VOPS ((1 << OT_PHI_VDEF) | (1 << OT_PHI_VUSE))
+
+ /* The operator structures. */
+ union op_strs
+ {
+ use_optype uses;
+ vuse_optype vuses;
+ def_optype defs;
+ v_may_def_optype v_may_defs;
+ v_must_def_optype v_must_defs;
+ tree phi;
+ };
+
+ /* Operator iterator. */
+ struct op_iterator
+ {
+ unsigned types; /* Types of operands to walk. */
+ enum oi_op_type atype; /* The actual type. */
+ unsigned aop; /* The actual operand. */
+ unsigned aop_max; /* The maximal operand number for the actual type. */
+ struct stmt_ann_d *ann; /* The annotation of the statement. */
+ unsigned index; /* Index of the operand. */
+ union op_strs aops; /* The structure for operands of the actual type. */
+ };
+
+ typedef struct op_iterator oii;
+
+ static inline void oi_init_ann (struct op_iterator *, struct stmt_ann_d *, unsigned);
+ static inline void oi_init (struct op_iterator *, tree, unsigned);
+ static inline bool oi_end_p (const struct op_iterator *);
+ static inline void oi_next (struct op_iterator *);
+ static inline tree oi_op (const struct op_iterator *);
+ static inline unsigned oi_index (const struct op_iterator *);
+ static inline void oi_set_op (struct op_iterator *, tree);
+ static inline bool oi_def_p (const struct op_iterator *);
+ static inline bool oi_virtual_p (const struct op_iterator *);
+ static inline use_operand_p oi_use_ptr (const struct op_iterator *);
+ static inline def_operand_p oi_def_ptr (const struct op_iterator *);
+ static inline use_operand_p oi_use_ptr_from_vdef_def (const struct op_iterator *);
+ static inline def_operand_p oi_def_ptr_from_vdef_use (const struct op_iterator *);
+ static inline unsigned num_operands_of_types (tree, unsigned);
+
#endif /* GCC_TREE_SSA_OPERANDS_H */
Index: tree-ssa.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa.c,v
retrieving revision 2.15
diff -c -3 -p -r2.15 tree-ssa.c
*** tree-ssa.c 23 Jun 2004 20:12:43 -0000 2.15
--- tree-ssa.c 24 Jun 2004 00:20:09 -0000
*************** verify_ssa (void)
*** 293,298 ****
--- 293,299 ----
bool err = false;
basic_block bb;
basic_block *definition_block = xcalloc (num_ssa_names, sizeof (basic_block));
+ oii oi;
timevar_push (TV_TREE_SSA_VERIFY);
*************** verify_ssa (void)
*** 312,333 ****
{
tree stmt;
stmt_ann_t ann;
- unsigned int j;
- v_may_def_optype v_may_defs;
- v_must_def_optype v_must_defs;
- def_optype defs;
stmt = bsi_stmt (bsi);
ann = stmt_ann (stmt);
get_stmt_operands (stmt);
! v_may_defs = V_MAY_DEF_OPS (ann);
! if (ann->makes_aliased_stores && NUM_V_MAY_DEFS (v_may_defs) == 0)
error ("Makes aliased stores, but no V_MAY_DEFS");
!
! for (j = 0; j < NUM_V_MAY_DEFS (v_may_defs); j++)
{
! tree op = V_MAY_DEF_RESULT (v_may_defs, j);
if (is_gimple_reg (op))
{
error ("Found a virtual definition for a GIMPLE register");
--- 313,330 ----
{
tree stmt;
stmt_ann_t ann;
stmt = bsi_stmt (bsi);
ann = stmt_ann (stmt);
get_stmt_operands (stmt);
! if (ann->makes_aliased_stores
! && num_operands_of_types (stmt, OI_V_MAY_DEFS) == 0)
error ("Makes aliased stores, but no V_MAY_DEFS");
!
! for (oi_init (&oi, stmt, OI_V_MAY_DEFS); !oi_end_p (&oi); oi_next (&oi))
{
! tree op = oi_op (&oi);
if (is_gimple_reg (op))
{
error ("Found a virtual definition for a GIMPLE register");
*************** verify_ssa (void)
*** 338,347 ****
err |= verify_def (bb, definition_block, op, stmt);
}
! v_must_defs = STMT_V_MUST_DEF_OPS (stmt);
! for (j = 0; j < NUM_V_MUST_DEFS (v_must_defs); j++)
{
! tree op = V_MUST_DEF_OP (v_must_defs, j);
if (is_gimple_reg (op))
{
error ("Found a virtual must-def for a GIMPLE register");
--- 335,343 ----
err |= verify_def (bb, definition_block, op, stmt);
}
! for (oi_init (&oi, stmt, 1 << OT_VMUST_DEF); !oi_end_p (&oi); oi_next (&oi))
{
! tree op = oi_op (&oi);
if (is_gimple_reg (op))
{
error ("Found a virtual must-def for a GIMPLE register");
*************** verify_ssa (void)
*** 352,361 ****
err |= verify_def (bb, definition_block, op, stmt);
}
! defs = DEF_OPS (ann);
! for (j = 0; j < NUM_DEFS (defs); j++)
{
! tree op = DEF_OP (defs, j);
if (TREE_CODE (op) == SSA_NAME && !is_gimple_reg (op))
{
error ("Found a real definition for a non-GIMPLE register");
--- 348,356 ----
err |= verify_def (bb, definition_block, op, stmt);
}
! for (oi_init (&oi, stmt, OI_DEFS); !oi_end_p (&oi); oi_next (&oi))
{
! tree op = oi_op (&oi);
if (TREE_CODE (op) == SSA_NAME && !is_gimple_reg (op))
{
error ("Found a real definition for a non-GIMPLE register");
*************** verify_ssa (void)
*** 398,413 ****
for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
{
tree stmt = bsi_stmt (bsi);
- stmt_ann_t ann = stmt_ann (stmt);
- unsigned int j;
- vuse_optype vuses;
- v_may_def_optype v_may_defs;
- use_optype uses;
! vuses = VUSE_OPS (ann);
! for (j = 0; j < NUM_VUSES (vuses); j++)
{
! tree op = VUSE_OP (vuses, j);
if (is_gimple_reg (op))
{
--- 393,402 ----
for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
{
tree stmt = bsi_stmt (bsi);
! for (oi_init (&oi, stmt, 1 << OT_VUSE); !oi_end_p (&oi); oi_next (&oi))
{
! tree op = oi_op (&oi);
if (is_gimple_reg (op))
{
*************** verify_ssa (void)
*** 420,429 ****
op, stmt, false);
}
! v_may_defs = V_MAY_DEF_OPS (ann);
! for (j = 0; j < NUM_V_MAY_DEFS (v_may_defs); j++)
{
! tree op = V_MAY_DEF_OP (v_may_defs, j);
if (is_gimple_reg (op))
{
--- 409,417 ----
op, stmt, false);
}
! for (oi_init (&oi, stmt, 1 << OT_VDEF_USE); !oi_end_p (&oi); oi_next (&oi))
{
! tree op = oi_op (&oi);
if (is_gimple_reg (op))
{
*************** verify_ssa (void)
*** 436,445 ****
op, stmt, false);
}
! uses = USE_OPS (ann);
! for (j = 0; j < NUM_USES (uses); j++)
{
! tree op = USE_OP (uses, j);
if (TREE_CODE (op) == SSA_NAME && !is_gimple_reg (op))
{
--- 424,432 ----
op, stmt, false);
}
! for (oi_init (&oi, stmt, OI_USES); !oi_end_p (&oi); oi_next (&oi))
{
! tree op = oi_op (&oi);
if (TREE_CODE (op) == SSA_NAME && !is_gimple_reg (op))
{
*************** propagate_into_addr (tree stmt, tree var
*** 750,763 ****
static void
replace_immediate_uses (tree var, tree repl)
{
! use_optype uses;
! vuse_optype vuses;
! v_may_def_optype v_may_defs;
! int i, j, n;
dataflow_t df;
tree stmt;
- stmt_ann_t ann;
bool mark_new_vars;
df = get_immediate_uses (SSA_NAME_DEF_STMT (var));
n = num_immediate_uses (df);
--- 737,747 ----
static void
replace_immediate_uses (tree var, tree repl)
{
! int i, n;
dataflow_t df;
tree stmt;
bool mark_new_vars;
+ oii oi;
df = get_immediate_uses (SSA_NAME_DEF_STMT (var));
n = num_immediate_uses (df);
*************** replace_immediate_uses (tree var, tree r
*** 765,774 ****
for (i = 0; i < n; i++)
{
stmt = immediate_use (df, i);
- ann = stmt_ann (stmt);
if (TREE_CODE (stmt) == PHI_NODE)
{
for (j = 0; j < PHI_NUM_ARGS (stmt); j++)
if (PHI_ARG_DEF (stmt, j) == var)
{
--- 749,759 ----
for (i = 0; i < n; i++)
{
stmt = immediate_use (df, i);
if (TREE_CODE (stmt) == PHI_NODE)
{
+ int j;
+
for (j = 0; j < PHI_NUM_ARGS (stmt); j++)
if (PHI_ARG_DEF (stmt, j) == var)
{
*************** replace_immediate_uses (tree var, tree r
*** 791,815 ****
propagate_into_addr (stmt, var, &TREE_OPERAND (stmt, 1), repl);
}
! uses = USE_OPS (ann);
! for (j = 0; j < (int) NUM_USES (uses); j++)
! if (USE_OP (uses, j) == var)
{
! propagate_value (USE_OP_PTR (uses, j), repl);
mark_new_vars = POINTER_TYPE_P (TREE_TYPE (repl));
}
}
else
{
! vuses = VUSE_OPS (ann);
! for (j = 0; j < (int) NUM_VUSES (vuses); j++)
! if (VUSE_OP (vuses, j) == var)
! propagate_value (VUSE_OP_PTR (vuses, j), repl);
!
! v_may_defs = V_MAY_DEF_OPS (ann);
! for (j = 0; j < (int) NUM_V_MAY_DEFS (v_may_defs); j++)
! if (V_MAY_DEF_OP (v_may_defs, j) == var)
! propagate_value (V_MAY_DEF_OP_PTR (v_may_defs, j), repl);
}
/* If REPL is a pointer, it may have different memory tags associated
--- 776,796 ----
propagate_into_addr (stmt, var, &TREE_OPERAND (stmt, 1), repl);
}
! for (oi_init (&oi, stmt, OI_USES); !oi_end_p (&oi); oi_next (&oi))
! if (oi_op (&oi) == var)
{
! propagate_value (oi_use_ptr (&oi), repl);
mark_new_vars = POINTER_TYPE_P (TREE_TYPE (repl));
}
}
else
{
! for (oi_init (&oi, stmt, OI_VUSES); !oi_end_p (&oi); oi_next (&oi))
! if (oi_op (&oi) == var)
! {
! propagate_value (oi_use_ptr (&oi), repl);
! mark_new_vars = POINTER_TYPE_P (TREE_TYPE (repl));
! }
}
/* If REPL is a pointer, it may have different memory tags associated
Index: tree-tailcall.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-tailcall.c,v
retrieving revision 2.12
diff -c -3 -p -r2.12 tree-tailcall.c
*** tree-tailcall.c 18 Jun 2004 14:05:20 -0000 2.12
--- tree-tailcall.c 24 Jun 2004 00:20:09 -0000
*************** eliminate_tail_call (struct tailcall *t)
*** 644,652 ****
basic_block bb, first;
edge e;
tree phi;
stmt_ann_t ann;
- v_may_def_optype v_may_defs;
- unsigned i;
stmt = bsi_stmt (t->call_bsi);
get_stmt_operands (stmt);
--- 644,651 ----
basic_block bb, first;
edge e;
tree phi;
+ oii oi;
stmt_ann_t ann;
stmt = bsi_stmt (t->call_bsi);
get_stmt_operands (stmt);
*************** eliminate_tail_call (struct tailcall *t)
*** 697,706 ****
}
/* Add phi nodes for the call clobbered variables. */
! v_may_defs = V_MAY_DEF_OPS (ann);
! for (i = 0; i < NUM_V_MAY_DEFS (v_may_defs); i++)
{
! param = SSA_NAME_VAR (V_MAY_DEF_RESULT (v_may_defs, i));
for (phi = phi_nodes (first); phi; phi = PHI_CHAIN (phi))
if (param == SSA_NAME_VAR (PHI_RESULT (phi)))
break;
--- 696,706 ----
}
/* Add phi nodes for the call clobbered variables. */
! for (oi_init_ann (&oi, ann, OI_V_MAY_DEFS); !oi_end_p (&oi); oi_next (&oi))
{
! tree use;
!
! param = SSA_NAME_VAR (oi_op (&oi));
for (phi = phi_nodes (first); phi; phi = PHI_CHAIN (phi))
if (param == SSA_NAME_VAR (PHI_RESULT (phi)))
break;
*************** eliminate_tail_call (struct tailcall *t)
*** 722,728 ****
abort ();
}
! add_phi_arg (&phi, V_MAY_DEF_OP (v_may_defs, i), e);
}
/* Update the values of accumulators. */
--- 722,729 ----
abort ();
}
! use = USE_FROM_PTR (oi_use_ptr_from_vdef_def (&oi));
! add_phi_arg (&phi, use, e);
}
/* Update the values of accumulators. */