/* vec of vec of PHIs to rewrite in a basic block. Element I corresponds
the to basic block with index I. Allocated once per compilation, *not*
released between different functions. */
-static vec<gimple_vec> phis_to_rewrite;
+static vec< vec<gphi *> > phis_to_rewrite;
/* The bitmap of non-NULL elements of PHIS_TO_REWRITE. */
static bitmap blocks_with_phis_to_rewrite;
/* Marks phi node PHI in basic block BB for rewrite. */
static void
-mark_phi_for_rewrite (basic_block bb, gimple phi)
+mark_phi_for_rewrite (basic_block bb, gphi *phi)
{
- gimple_vec phis;
+ vec<gphi *> phis;
unsigned n, idx = bb->index;
if (rewrite_uses_p (phi))
{
unsigned bb_index;
edge e;
- gimple phi;
+ gphi *phi;
basic_block bb;
bitmap_iterator bi;
struct def_blocks_d *def_map = find_def_blocks_for (var);
FOR_EACH_EDGE (e, ei, bb->succs)
{
- gimple phi;
- gimple_stmt_iterator gsi;
+ gphi *phi;
+ gphi_iterator gsi;
for (gsi = gsi_start_phis (e->dest); !gsi_end_p (gsi);
gsi_next (&gsi))
tree currdef, res;
location_t loc;
- phi = gsi_stmt (gsi);
+ phi = gsi.phi ();
res = gimple_phi_result (phi);
currdef = get_reaching_def (SSA_NAME_VAR (res));
/* Virtual operand PHI args do not need a location. */
void
rewrite_dom_walker::before_dom_children (basic_block bb)
{
- gimple_stmt_iterator gsi;
-
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "\n\nRenaming block #%d\n\n", bb->index);
/* Step 1. Register new definitions for every PHI node in the block.
Conceptually, all the PHI nodes are executed in parallel and each PHI
node introduces a new version for the associated variable. */
- for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ for (gphi_iterator gsi = gsi_start_phis (bb); !gsi_end_p (gsi);
+ gsi_next (&gsi))
{
tree result = gimple_phi_result (gsi_stmt (gsi));
register_new_def (result, SSA_NAME_VAR (result));
with its immediate reaching definitions. Update the current definition
of a variable when a new real or virtual definition is found. */
if (bitmap_bit_p (interesting_blocks, bb->index))
- for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ for (gimple_stmt_iterator gsi = gsi_start_bb (bb); !gsi_end_p (gsi);
+ gsi_next (&gsi))
rewrite_stmt (&gsi);
/* Step 3. Visit all the successor blocks of BB looking for PHI nodes.
FOR_EACH_EDGE (e, ei, bb->succs)
{
- gimple phi;
- gimple_vec phis;
+ gphi *phi;
+ vec<gphi *> phis;
if (!bitmap_bit_p (blocks_with_phis_to_rewrite, e->dest->index))
continue;
else
{
gimple stmt = SSA_NAME_DEF_STMT (reaching_def);
+ gphi *other_phi = dyn_cast <gphi *> (stmt);
/* Single element PHI nodes behave like copies, so get the
location from the phi argument. */
- if (gimple_code (stmt) == GIMPLE_PHI
- && gimple_phi_num_args (stmt) == 1)
- locus = gimple_phi_arg_location (stmt, 0);
+ if (other_phi
+ && gimple_phi_num_args (other_phi) == 1)
+ locus = gimple_phi_arg_location (other_phi, 0);
else
locus = gimple_location (stmt);
}
rewrite_update_dom_walker::before_dom_children (basic_block bb)
{
bool is_abnormal_phi;
- gimple_stmt_iterator gsi;
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "Registering new PHI nodes in block #%d\n",
register it as a new definition for its corresponding name. Also
register definitions for names whose underlying symbols are
marked for renaming. */
- for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ for (gphi_iterator gsi = gsi_start_phis (bb); !gsi_end_p (gsi);
+ gsi_next (&gsi))
{
tree lhs, lhs_sym;
- gimple phi = gsi_stmt (gsi);
+ gphi *phi = gsi.phi ();
if (!register_defs_p (phi))
continue;
if (bitmap_bit_p (interesting_blocks, bb->index))
{
gcc_checking_assert (bitmap_bit_p (blocks_to_update, bb->index));
- for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); )
+ for (gimple_stmt_iterator gsi = gsi_start_bb (bb); !gsi_end_p (gsi); )
if (rewrite_update_stmt (gsi_stmt (gsi), gsi))
gsi_remove (&gsi, true);
else
mark_block_for_update (bb);
if (gimple_code (stmt) == GIMPLE_PHI)
- mark_phi_for_rewrite (def_bb, stmt);
+ mark_phi_for_rewrite (def_bb, as_a <gphi *> (stmt));
else
{
set_rewrite_uses (stmt, true);
prepare_block_for_update (basic_block bb, bool insert_phi_p)
{
basic_block son;
- gimple_stmt_iterator si;
edge e;
edge_iterator ei;
/* Process PHI nodes marking interesting those that define or use
the symbols that we are interested in. */
- for (si = gsi_start_phis (bb); !gsi_end_p (si); gsi_next (&si))
+ for (gphi_iterator si = gsi_start_phis (bb); !gsi_end_p (si);
+ gsi_next (&si))
{
- gimple phi = gsi_stmt (si);
+ gphi *phi = si.phi ();
tree lhs_sym, lhs = gimple_phi_result (phi);
if (TREE_CODE (lhs) == SSA_NAME
}
/* Process the statements. */
- for (si = gsi_start_bb (bb); !gsi_end_p (si); gsi_next (&si))
+ for (gimple_stmt_iterator si = gsi_start_bb (bb); !gsi_end_p (si);
+ gsi_next (&si))
{
gimple stmt;
ssa_op_iter i;
if (gimple_code (stmt) == GIMPLE_PHI)
{
int ix = PHI_ARG_INDEX_FROM_USE (use_p);
- edge e = gimple_phi_arg_edge (stmt, ix);
+ edge e = gimple_phi_arg_edge (as_a <gphi *> (stmt), ix);
mark_use_interesting (name, stmt, e->src, insert_phi_p);
}
else
if (blocks_with_phis_to_rewrite)
EXECUTE_IF_SET_IN_BITMAP (blocks_with_phis_to_rewrite, 0, i, bi)
{
- gimple_vec phis = phis_to_rewrite[i];
+ vec<gphi *> phis = phis_to_rewrite[i];
phis.release ();
phis_to_rewrite[i].create (0);
}
removed. */
void
-mark_virtual_phi_result_for_renaming (gimple phi)
+mark_virtual_phi_result_for_renaming (gphi *phi)
{
if (dump_file && (dump_flags & TDF_DETAILS))
{