Add gsi_after_labels overload for gimple_seq
The following adds gsi_after_labels for gimple_seq so I do not have to open-code it. I took the liberty to remove the two #defines wrapping gsi_start_1 and gsi_last_1 as we now have C++ references. 2022-02-01 Richard Biener <rguenther@suse.de> * gimple-iterator.h (gsi_after_labels): Add overload for gimple_seq. (gsi_start_1): Rename to gsi_start and take a reference. (gsi_last_1): Likewise. * gimple-iterator.cc (gsi_for_stmt): Use gsi_start. * omp-low.cc (lower_rec_input_clauses): Likewise. (lower_omp_scan): Likewise.
This commit is contained in:
parent
44b09adb9b
commit
4aa61e08ad
|
@ -632,7 +632,7 @@ gsi_for_stmt (gimple *stmt)
|
|||
gimple_stmt_iterator
|
||||
gsi_for_stmt (gimple *stmt, gimple_seq *seq)
|
||||
{
|
||||
gimple_stmt_iterator i = gsi_start_1 (seq);
|
||||
gimple_stmt_iterator i = gsi_start (*seq);
|
||||
i.ptr = stmt;
|
||||
return i;
|
||||
}
|
||||
|
@ -934,7 +934,7 @@ gsi_start_phis (basic_block bb)
|
|||
{
|
||||
gimple_seq *pseq = phi_nodes_ptr (bb);
|
||||
|
||||
/* Adapted from gsi_start_1. */
|
||||
/* Adapted from gsi_start. */
|
||||
gphi_iterator i;
|
||||
|
||||
i.ptr = gimple_seq_first (*pseq);
|
||||
|
|
|
@ -96,19 +96,17 @@ extern void update_modified_stmts (gimple_seq);
|
|||
/* Return a new iterator pointing to GIMPLE_SEQ's first statement. */
|
||||
|
||||
static inline gimple_stmt_iterator
|
||||
gsi_start_1 (gimple_seq *seq)
|
||||
gsi_start (gimple_seq &seq)
|
||||
{
|
||||
gimple_stmt_iterator i;
|
||||
|
||||
i.ptr = gimple_seq_first (*seq);
|
||||
i.seq = seq;
|
||||
i.ptr = gimple_seq_first (seq);
|
||||
i.seq = &seq;
|
||||
i.bb = i.ptr ? gimple_bb (i.ptr) : NULL;
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
#define gsi_start(x) gsi_start_1 (&(x))
|
||||
|
||||
static inline gimple_stmt_iterator
|
||||
gsi_none (void)
|
||||
{
|
||||
|
@ -140,19 +138,17 @@ gimple_stmt_iterator gsi_start_edge (edge e);
|
|||
/* Return a new iterator initially pointing to GIMPLE_SEQ's last statement. */
|
||||
|
||||
static inline gimple_stmt_iterator
|
||||
gsi_last_1 (gimple_seq *seq)
|
||||
gsi_last (gimple_seq &seq)
|
||||
{
|
||||
gimple_stmt_iterator i;
|
||||
|
||||
i.ptr = gimple_seq_last (*seq);
|
||||
i.seq = seq;
|
||||
i.ptr = gimple_seq_last (seq);
|
||||
i.seq = &seq;
|
||||
i.bb = i.ptr ? gimple_bb (i.ptr) : NULL;
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
#define gsi_last(x) gsi_last_1 (&(x))
|
||||
|
||||
/* Return a new iterator pointing to the last statement in basic block BB. */
|
||||
|
||||
static inline gimple_stmt_iterator
|
||||
|
@ -232,6 +228,25 @@ gsi_after_labels (basic_block bb)
|
|||
return gsi;
|
||||
}
|
||||
|
||||
/* Return a statement iterator that points to the first
|
||||
non-label statement in sequence SEQ. */
|
||||
|
||||
static inline gimple_stmt_iterator
|
||||
gsi_after_labels (gimple_seq &seq)
|
||||
{
|
||||
gimple_stmt_iterator gsi = gsi_start (seq);
|
||||
|
||||
for (; !gsi_end_p (gsi); )
|
||||
{
|
||||
if (gimple_code (gsi_stmt (gsi)) == GIMPLE_LABEL)
|
||||
gsi_next (&gsi);
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
return gsi;
|
||||
}
|
||||
|
||||
/* Advance the iterator to the next non-debug gimple statement. */
|
||||
|
||||
static inline void
|
||||
|
|
|
@ -6232,7 +6232,7 @@ lower_rec_input_clauses (tree clauses, gimple_seq *ilist, gimple_seq *dlist,
|
|||
x = lang_hooks.decls.omp_clause_copy_ctor (c, iv, x);
|
||||
gimplify_and_add (x, ilist);
|
||||
gimple_stmt_iterator gsi
|
||||
= gsi_start_1 (gimple_omp_body_ptr (ctx->stmt));
|
||||
= gsi_start (*gimple_omp_body_ptr (ctx->stmt));
|
||||
gassign *g
|
||||
= gimple_build_assign (unshare_expr (lvar), iv);
|
||||
gsi_insert_before_without_update (&gsi, g,
|
||||
|
@ -6897,7 +6897,7 @@ lower_rec_input_clauses (tree clauses, gimple_seq *ilist, gimple_seq *dlist,
|
|||
uid, integer_zero_node,
|
||||
nonconst_simd_if);
|
||||
gimple_call_set_lhs (g, sctx.lane);
|
||||
gimple_stmt_iterator gsi = gsi_start_1 (gimple_omp_body_ptr (ctx->stmt));
|
||||
gimple_stmt_iterator gsi = gsi_start (*gimple_omp_body_ptr (ctx->stmt));
|
||||
gsi_insert_before_without_update (&gsi, g, GSI_SAME_STMT);
|
||||
g = gimple_build_assign (sctx.lane, INTEGER_CST,
|
||||
build_int_cst (unsigned_type_node, 0));
|
||||
|
@ -10324,7 +10324,7 @@ lower_omp_scan (gimple_stmt_iterator *gsi_p, omp_context *ctx)
|
|||
lower_omp (gimple_omp_body_ptr (stmt), octx);
|
||||
if (before)
|
||||
{
|
||||
gimple_stmt_iterator gsi = gsi_start_1 (gimple_omp_body_ptr (stmt));
|
||||
gimple_stmt_iterator gsi = gsi_start (*gimple_omp_body_ptr (stmt));
|
||||
gsi_insert_seq_before (&gsi, before, GSI_SAME_STMT);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue