aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimple.h
diff options
context:
space:
mode:
authorAndrew Macleod <amacleod@gcc.gnu.org>2013-11-13 23:54:17 +0000
committerAndrew Macleod <amacleod@gcc.gnu.org>2013-11-13 23:54:17 +0000
commit5be5c238419ffa6985605af60bc1f047770b9bd8 (patch)
tree5212390dab318e009e54c4466b455352647db1a5 /gcc/gimple.h
parentd35e43b970679a09504e452ce6734657545dadc8 (diff)
downloadgcc-5be5c238419ffa6985605af60bc1f047770b9bd8.zip
gcc-5be5c238419ffa6985605af60bc1f047770b9bd8.tar.gz
gcc-5be5c238419ffa6985605af60bc1f047770b9bd8.tar.bz2
gimple-walk.h: New File.
* gimple-walk.h: New File. Relocate prototypes from gimple.h. (struct walk_stmt_info): Relocate here from gimple.h. * gimple-iterator.h: New File. Relocate prototypes from gimple.h. (struct gimple_stmt_iterator_d): Relocate here from gimple.h. (gsi_start_1, gsi_none, gsi_start_bb, gsi_last_1, gsi_last_bb, gsi_end_p, gsi_one_before_end_p, gsi_next, gsi_prev, gsi_stmt, gsi_after_labels, gsi_next_nondebug, gsi_prev_nondebug, gsi_start_nondebug_bb, gsi_start_nondebug_after_labels_bb, gsi_last_nondebug_bb, gsi_bb, gsi_seq): Relocate here from gimple.h. * gimple.h (struct gimple_stmt_iterator_d): Move to gimple-iterator.h. (gsi_start_1, gsi_none, gsi_start_bb, gsi_last_1, gsi_last_bb, gsi_end_p, gsi_one_before_end_p, gsi_next, gsi_prev, gsi_stmt, gsi_after_labels, gsi_next_nondebug, gsi_prev_nondebug, gsi_start_nondebug_bb, gsi_start_nondebug_after_labels_bb, gsi_last_nondebug_bb, gsi_bb, gsi_seq): Move to gimple-iterator.h. (struct walk_stmt_info): Move to gimple-walk.h. (gimple_seq_set_location): Move to gimple.c * gimple-walk.c: New File. (walk_gimple_seq_mod, walk_gimple_seq, walk_gimple_asm, walk_gimple_op, walk_gimple_stmt, get_base_loadstore, walk_stmt_load_store_addr_ops, walk_stmt_load_store_ops): Relocate here from gimple.c. * gimple-iterator.c: Include gimple-iterator.h. * gimple.c (walk_gimple_seq_mod, walk_gimple_seq, walk_gimple_asm, walk_gimple_op, walk_gimple_stmt, get_base_loadstore, walk_stmt_load_store_addr_ops, walk_stmt_load_store_ops): Move to gimple-walk.c. (gimple_seq_set_location): Relocate from gimple.h. * tree-phinodes.h (set_phi_nodes): Move to tree-phinodes.c. * tree-phinodes.c (set_phi_nodes): Relocate from tree-phinodes.h. * gengtype.c (open_base_files): Add gimple-iterator.h to include list. * Makefile.in (OBJS): Add gimple-walk.o * asan.c: Update Include list as required for gimple-iterator.h and gimple-walk.h. * cfgexpand.c: Likewise. * cfgloop.c: Likewise. * cfgloopmanip.c: Likewise. * cgraph.c: Likewise. * cgraphbuild.c: Likewise. * cgraphunit.c: Likewise. * gimple-fold.c: Likewise. * gimple-low.c: Likewise. * gimple-pretty-print.c: Likewise. * gimple-ssa-isolate-paths.c: Likewise. * gimple-ssa-strength-reduction.c: Likewise. * gimple-streamer-in.c: Likewise. * gimple-streamer-out.c: Likewise. * gimplify.c: Likewise. * graphite-blocking.c: Likewise. * graphite-clast-to-gimple.c: Likewise. * graphite-dependences.c: Likewise. * graphite-interchange.c: Likewise. * graphite-optimize-isl.c: Likewise. * graphite-poly.c: Likewise. * graphite-scop-detection.c: Likewise. * graphite-sese-to-poly.c: Likewise. * graphite.c: Likewise. * ipa-inline-analysis.c: Likewise. * ipa-profile.c: Likewise. * ipa-prop.c: Likewise. * ipa-pure-const.c: Likewise. * ipa-split.c: Likewise. * lto-streamer-in.c: Likewise. * lto-streamer-out.c: Likewise. * omp-low.c: Likewise. * predict.c: Likewise. * profile.c: Likewise. * sese.c: Likewise. * tracer.c: Likewise. * trans-mem.c: Likewise. * tree-call-cdce.c: Likewise. * tree-cfg.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-complex.c: Likewise. * tree-data-ref.c: Likewise. * tree-dfa.c: Likewise. * tree-eh.c: Likewise. * tree-emutls.c: Likewise. * tree-if-conv.c: Likewise. * tree-inline.c: Likewise. * tree-into-ssa.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-nested.c: Likewise. * tree-nrv.c: Likewise. * tree-object-size.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-parloops.c: Likewise. * tree-predcom.c: Likewise. * tree-profile.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree-ssa-copy.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-ssa-dse.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-loop-ch.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-propagate.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sink.c: Likewise. * tree-ssa-strlen.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa-tail-merge.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-ssa-threadedge.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-uncprop.c: Likewise. * tree-ssa-uninit.c: Likewise. * tree-ssa.c: Likewise. * tree-stdarg.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-tailcall.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-generic.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-slp.c: Likewise. * tree-vect-stmts.c: Likewise. * tree-vectorizer.c: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * tsan.c: Likewise. * value-prof.c: Likewise. * vtable-verify.c: Likewise. * config/aarch64/aarch64-builtins.c: Include gimple-iterator.h. * config/rs6000/rs6000.c: Include gimple-iterator.h and gimple-walk.h. * testsuite/g++.dg/plugin/selfassign.c: Include gimple-iterator.h. * testsuite/gcc.dg/plugin/selfassign.c: Likewise. From-SVN: r204763
Diffstat (limited to 'gcc/gimple.h')
-rw-r--r--gcc/gimple.h357
1 files changed, 1 insertions, 356 deletions
diff --git a/gcc/gimple.h b/gcc/gimple.h
index 4f34a9ee..db24800 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -141,21 +141,6 @@ enum plf_mask {
GF_PLF_2 = 1 << 1
};
-/* Iterator object for GIMPLE statement sequences. */
-
-struct gimple_stmt_iterator_d
-{
- /* Sequence node holding the current statement. */
- gimple_seq_node ptr;
-
- /* Sequence and basic block holding the statement. These fields
- are necessary to handle edge cases such as when statement is
- added to an empty basic block or when the last statement of a
- block/sequence is removed. */
- gimple_seq *seq;
- basic_block bb;
-};
-
/* Data structure definitions for GIMPLE tuples. NOTE: word markers
are for 64 bit hosts. */
@@ -847,13 +832,6 @@ extern bool gimple_compare_field_offset (tree, tree);
extern tree gimple_unsigned_type (tree);
extern tree gimple_signed_type (tree);
extern alias_set_type gimple_get_alias_set (tree);
-extern bool walk_stmt_load_store_addr_ops (gimple, void *,
- bool (*)(gimple, tree, void *),
- bool (*)(gimple, tree, void *),
- bool (*)(gimple, tree, void *));
-extern bool walk_stmt_load_store_ops (gimple, void *,
- bool (*)(gimple, tree, void *),
- bool (*)(gimple, tree, void *));
extern bool gimple_ior_addresses_taken (bitmap, gimple);
extern bool gimple_call_builtin_p (gimple, enum built_in_class);
extern bool gimple_call_builtin_p (gimple, enum built_in_function);
@@ -5223,227 +5201,6 @@ gimple_expr_type (const_gimple stmt)
return void_type_node;
}
-/* Return a new iterator pointing to GIMPLE_SEQ's first statement. */
-
-static inline gimple_stmt_iterator
-gsi_start_1 (gimple_seq *seq)
-{
- gimple_stmt_iterator i;
-
- 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)
-{
- gimple_stmt_iterator i;
- i.ptr = NULL;
- i.seq = NULL;
- i.bb = NULL;
- return i;
-}
-
-/* Return a new iterator pointing to the first statement in basic block BB. */
-
-static inline gimple_stmt_iterator
-gsi_start_bb (basic_block bb)
-{
- gimple_stmt_iterator i;
- gimple_seq *seq;
-
- seq = bb_seq_addr (bb);
- i.ptr = gimple_seq_first (*seq);
- i.seq = seq;
- i.bb = bb;
-
- return i;
-}
-
-
-/* Return a new iterator initially pointing to GIMPLE_SEQ's last statement. */
-
-static inline gimple_stmt_iterator
-gsi_last_1 (gimple_seq *seq)
-{
- gimple_stmt_iterator i;
-
- 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
-gsi_last_bb (basic_block bb)
-{
- gimple_stmt_iterator i;
- gimple_seq *seq;
-
- seq = bb_seq_addr (bb);
- i.ptr = gimple_seq_last (*seq);
- i.seq = seq;
- i.bb = bb;
-
- return i;
-}
-
-
-/* Return true if I is at the end of its sequence. */
-
-static inline bool
-gsi_end_p (gimple_stmt_iterator i)
-{
- return i.ptr == NULL;
-}
-
-
-/* Return true if I is one statement before the end of its sequence. */
-
-static inline bool
-gsi_one_before_end_p (gimple_stmt_iterator i)
-{
- return i.ptr != NULL && i.ptr->gsbase.next == NULL;
-}
-
-
-/* Advance the iterator to the next gimple statement. */
-
-static inline void
-gsi_next (gimple_stmt_iterator *i)
-{
- i->ptr = i->ptr->gsbase.next;
-}
-
-/* Advance the iterator to the previous gimple statement. */
-
-static inline void
-gsi_prev (gimple_stmt_iterator *i)
-{
- gimple prev = i->ptr->gsbase.prev;
- if (prev->gsbase.next)
- i->ptr = prev;
- else
- i->ptr = NULL;
-}
-
-/* Return the current stmt. */
-
-static inline gimple
-gsi_stmt (gimple_stmt_iterator i)
-{
- return i.ptr;
-}
-
-/* Return a block statement iterator that points to the first non-label
- statement in block BB. */
-
-static inline gimple_stmt_iterator
-gsi_after_labels (basic_block bb)
-{
- gimple_stmt_iterator gsi = gsi_start_bb (bb);
-
- while (!gsi_end_p (gsi) && gimple_code (gsi_stmt (gsi)) == GIMPLE_LABEL)
- gsi_next (&gsi);
-
- return gsi;
-}
-
-/* Advance the iterator to the next non-debug gimple statement. */
-
-static inline void
-gsi_next_nondebug (gimple_stmt_iterator *i)
-{
- do
- {
- gsi_next (i);
- }
- while (!gsi_end_p (*i) && is_gimple_debug (gsi_stmt (*i)));
-}
-
-/* Advance the iterator to the next non-debug gimple statement. */
-
-static inline void
-gsi_prev_nondebug (gimple_stmt_iterator *i)
-{
- do
- {
- gsi_prev (i);
- }
- while (!gsi_end_p (*i) && is_gimple_debug (gsi_stmt (*i)));
-}
-
-/* Return a new iterator pointing to the first non-debug statement in
- basic block BB. */
-
-static inline gimple_stmt_iterator
-gsi_start_nondebug_bb (basic_block bb)
-{
- gimple_stmt_iterator i = gsi_start_bb (bb);
-
- if (!gsi_end_p (i) && is_gimple_debug (gsi_stmt (i)))
- gsi_next_nondebug (&i);
-
- return i;
-}
-
-/* Return a new iterator pointing to the first non-debug non-label statement in
- basic block BB. */
-
-static inline gimple_stmt_iterator
-gsi_start_nondebug_after_labels_bb (basic_block bb)
-{
- gimple_stmt_iterator i = gsi_after_labels (bb);
-
- if (!gsi_end_p (i) && is_gimple_debug (gsi_stmt (i)))
- gsi_next_nondebug (&i);
-
- return i;
-}
-
-/* Return a new iterator pointing to the last non-debug statement in
- basic block BB. */
-
-static inline gimple_stmt_iterator
-gsi_last_nondebug_bb (basic_block bb)
-{
- gimple_stmt_iterator i = gsi_last_bb (bb);
-
- if (!gsi_end_p (i) && is_gimple_debug (gsi_stmt (i)))
- gsi_prev_nondebug (&i);
-
- return i;
-}
-
-
-/* Return the basic block associated with this iterator. */
-
-static inline basic_block
-gsi_bb (gimple_stmt_iterator i)
-{
- return i.bb;
-}
-
-
-/* Return the sequence associated with this iterator. */
-
-static inline gimple_seq
-gsi_seq (gimple_stmt_iterator i)
-{
- return *i.seq;
-}
-
-
enum gsi_iterator_update
{
GSI_NEW_STMT, /* Only valid when single statement is added, move
@@ -5454,112 +5211,8 @@ enum gsi_iterator_update
direction. */
};
-/* In gimple-iterator.c */
-gimple_stmt_iterator gsi_start_phis (basic_block);
-gimple_seq gsi_split_seq_after (gimple_stmt_iterator);
-void gsi_split_seq_before (gimple_stmt_iterator *, gimple_seq *);
-void gsi_set_stmt (gimple_stmt_iterator *, gimple);
-void gsi_replace (gimple_stmt_iterator *, gimple, bool);
-void gsi_replace_with_seq (gimple_stmt_iterator *, gimple_seq, bool);
-void gsi_insert_before (gimple_stmt_iterator *, gimple,
- enum gsi_iterator_update);
-void gsi_insert_before_without_update (gimple_stmt_iterator *, gimple,
- enum gsi_iterator_update);
-void gsi_insert_seq_before (gimple_stmt_iterator *, gimple_seq,
- enum gsi_iterator_update);
-void gsi_insert_seq_before_without_update (gimple_stmt_iterator *, gimple_seq,
- enum gsi_iterator_update);
-void gsi_insert_after (gimple_stmt_iterator *, gimple,
- enum gsi_iterator_update);
-void gsi_insert_after_without_update (gimple_stmt_iterator *, gimple,
- enum gsi_iterator_update);
-void gsi_insert_seq_after (gimple_stmt_iterator *, gimple_seq,
- enum gsi_iterator_update);
-void gsi_insert_seq_after_without_update (gimple_stmt_iterator *, gimple_seq,
- enum gsi_iterator_update);
-bool gsi_remove (gimple_stmt_iterator *, bool);
-gimple_stmt_iterator gsi_for_stmt (gimple);
-void gsi_move_after (gimple_stmt_iterator *, gimple_stmt_iterator *);
-void gsi_move_before (gimple_stmt_iterator *, gimple_stmt_iterator *);
-void gsi_move_to_bb_end (gimple_stmt_iterator *, basic_block);
-void gsi_insert_on_edge (edge, gimple);
-void gsi_insert_seq_on_edge (edge, gimple_seq);
-basic_block gsi_insert_on_edge_immediate (edge, gimple);
-basic_block gsi_insert_seq_on_edge_immediate (edge, gimple_seq);
-void gsi_commit_one_edge_insert (edge, basic_block *);
-void gsi_commit_edge_inserts (void);
gimple gimple_call_copy_skip_args (gimple, bitmap);
-/* Convenience routines to walk all statements of a gimple function.
- Note that this is useful exclusively before the code is converted
- into SSA form. Once the program is in SSA form, the standard
- operand interface should be used to analyze/modify statements. */
-struct walk_stmt_info
-{
- /* Points to the current statement being walked. */
- gimple_stmt_iterator gsi;
-
- /* Additional data that the callback functions may want to carry
- through the recursion. */
- void *info;
-
- /* Pointer map used to mark visited tree nodes when calling
- walk_tree on each operand. If set to NULL, duplicate tree nodes
- will be visited more than once. */
- struct pointer_set_t *pset;
-
- /* Operand returned by the callbacks. This is set when calling
- walk_gimple_seq. If the walk_stmt_fn or walk_tree_fn callback
- returns non-NULL, this field will contain the tree returned by
- the last callback. */
- tree callback_result;
-
- /* Indicates whether the operand being examined may be replaced
- with something that matches is_gimple_val (if true) or something
- slightly more complicated (if false). "Something" technically
- means the common subset of is_gimple_lvalue and is_gimple_rhs,
- but we never try to form anything more complicated than that, so
- we don't bother checking.
-
- Also note that CALLBACK should update this flag while walking the
- sub-expressions of a statement. For instance, when walking the
- statement 'foo (&var)', the flag VAL_ONLY will initially be set
- to true, however, when walking &var, the operand of that
- ADDR_EXPR does not need to be a GIMPLE value. */
- BOOL_BITFIELD val_only : 1;
-
- /* True if we are currently walking the LHS of an assignment. */
- BOOL_BITFIELD is_lhs : 1;
-
- /* Optional. Set to true by the callback functions if they made any
- changes. */
- BOOL_BITFIELD changed : 1;
-
- /* True if we're interested in location information. */
- BOOL_BITFIELD want_locations : 1;
-
- /* True if we've removed the statement that was processed. */
- BOOL_BITFIELD removed_stmt : 1;
-};
-
-/* Callback for walk_gimple_stmt. Called for every statement found
- during traversal. The first argument points to the statement to
- walk. The second argument is a flag that the callback sets to
- 'true' if it the callback handled all the operands and
- sub-statements of the statement (the default value of this flag is
- 'false'). The third argument is an anonymous pointer to data
- to be used by the callback. */
-typedef tree (*walk_stmt_fn) (gimple_stmt_iterator *, bool *,
- struct walk_stmt_info *);
-
-gimple walk_gimple_seq (gimple_seq, walk_stmt_fn, walk_tree_fn,
- struct walk_stmt_info *);
-gimple walk_gimple_seq_mod (gimple_seq *, walk_stmt_fn, walk_tree_fn,
- struct walk_stmt_info *);
-tree walk_gimple_stmt (gimple_stmt_iterator *, walk_stmt_fn, walk_tree_fn,
- struct walk_stmt_info *);
-tree walk_gimple_op (gimple, walk_tree_fn, struct walk_stmt_info *);
-
/* Enum and arrays used for allocation stats. Keep in sync with
gimple.c:gimple_alloc_kind_names. */
enum gimple_alloc_kind
@@ -5593,15 +5246,6 @@ gimple_alloc_kind (enum gimple_code code)
extern void dump_gimple_statistics (void);
-/* Set the location of all statements in SEQ to LOC. */
-
-static inline void
-gimple_seq_set_location (gimple_seq seq, location_t loc)
-{
- for (gimple_stmt_iterator i = gsi_start (seq); !gsi_end_p (i); gsi_next (&i))
- gimple_set_location (gsi_stmt (i), loc);
-}
-
/* Return true if a location should not be emitted for this statement
by annotate_all_with_location. */
@@ -5636,5 +5280,6 @@ gimple_set_do_not_emit_location (gimple g)
extern void sort_case_labels (vec<tree> );
extern void preprocess_case_label_vec_for_gimple (vec<tree> , tree, tree *);
+extern void gimple_seq_set_location (gimple_seq , location_t);
#endif /* GCC_GIMPLE_H */