diff options
Diffstat (limited to 'gcc/gimple.h')
-rw-r--r-- | gcc/gimple.h | 357 |
1 files changed, 1 insertions, 356 deletions
diff --git a/gcc/gimple.h b/gcc/gimple.h index 4f34a9eea92..db24800b43a 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 */ |