/* Header file for gimple iterators.
- Copyright (C) 2013-2014 Free Software Foundation, Inc.
+ Copyright (C) 2013-2015 Free Software Foundation, Inc.
This file is part of GCC.
gimple_seq *seq;
basic_block bb;
};
+
+/* Iterator over GIMPLE_PHI statements. */
+struct gphi_iterator : public gimple_stmt_iterator
+{
+ gphi *phi () const
+ {
+ return as_a <gphi *> (ptr);
+ }
+};
enum gsi_iterator_update
{
extern gimple_seq gsi_split_seq_after (gimple_stmt_iterator);
extern void gsi_set_stmt (gimple_stmt_iterator *, gimple);
extern void gsi_split_seq_before (gimple_stmt_iterator *, gimple_seq *);
-extern void gsi_replace (gimple_stmt_iterator *, gimple, bool);
+extern bool gsi_replace (gimple_stmt_iterator *, gimple, bool);
extern void gsi_replace_with_seq (gimple_stmt_iterator *, gimple_seq, bool);
extern void gsi_insert_before_without_update (gimple_stmt_iterator *, gimple,
enum gsi_iterator_update);
enum gsi_iterator_update);
extern bool gsi_remove (gimple_stmt_iterator *, bool);
extern gimple_stmt_iterator gsi_for_stmt (gimple);
+extern gphi_iterator gsi_for_phi (gphi *);
extern void gsi_move_after (gimple_stmt_iterator *, gimple_stmt_iterator *);
extern void gsi_move_before (gimple_stmt_iterator *, gimple_stmt_iterator *);
extern void gsi_move_to_bb_end (gimple_stmt_iterator *, basic_block);
extern basic_block gsi_insert_seq_on_edge_immediate (edge, gimple_seq);
extern void gsi_commit_edge_inserts (void);
extern void gsi_commit_one_edge_insert (edge, basic_block *);
-extern gimple_stmt_iterator gsi_start_phis (basic_block);
+extern gphi_iterator gsi_start_phis (basic_block);
/* Return a new iterator pointing to GIMPLE_SEQ's first statement. */
return i;
}
+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
return i.ptr;
}
+/* Return a new iterator pointing to the first non-debug statement
+ in basic block BB. */
+
+static inline gimple_stmt_iterator
+gsi_start_bb_nondebug (basic_block bb)
+{
+ gimple_stmt_iterator gsi = gsi_start_bb (bb);
+ while (!gsi_end_p (gsi) && is_gimple_debug (gsi_stmt (gsi)))
+ gsi_next (&gsi);
+
+ return gsi;
+}
+
/* Return a block statement iterator that points to the first non-label
statement in block BB. */
while (!gsi_end_p (*i) && is_gimple_debug (gsi_stmt (*i)));
}
-/* Advance the iterator to the next non-debug gimple statement. */
+/* Advance the iterator to the previous non-debug gimple statement. */
static inline void
gsi_prev_nondebug (gimple_stmt_iterator *i)
return i;
}
+/* Iterates I statement iterator to the next non-virtual statement. */
+
+static inline void
+gsi_next_nonvirtual_phi (gphi_iterator *i)
+{
+ gphi *phi;
+
+ if (gsi_end_p (*i))
+ return;
+
+ phi = i->phi ();
+ gcc_assert (phi != NULL);
+
+ while (virtual_operand_p (gimple_phi_result (phi)))
+ {
+ gsi_next (i);
+
+ if (gsi_end_p (*i))
+ return;
+
+ phi = i->phi ();
+ }
+}
+
/* Return the basic block associated with this iterator. */
static inline basic_block