GCC Middle and Back End API Reference
|
|
static |
Insert the statement pointed-to by GSI into edge E. Every attempt is made to place the statement in an existing basic block, but sometimes that isn't possible. When it isn't possible, the edge is split and the statement is added to the new block. In all cases, the returned *GSI points to the correct location. The return value is true if insertion should be done after the location, or false if it should be done before the location. If a new basic block has to be created, it is stored in *NEW_BB.
If the destination has one predecessor which has no PHI nodes, insert there. Except for the exit block. The requirement for no PHI nodes could be relaxed. Basically we would have to examine the PHIs to prove that none of them used the value set by the statement we want to insert on E. That hardly seems worth the effort.
Make sure we insert after any leading labels.
If the source has one successor, the edge is not abnormal and the last statement does not end a basic block, insert there. Except for the entry block.
Otherwise, create a new basic block, and split this edge.
Referenced by gsi_insert_on_edge_immediate().
void gsi_commit_edge_inserts | ( | void | ) |
This routine will commit all pending edge insertions, creating any new basic blocks which are necessary.
Referenced by close_phi_written_to_memory(), find_switch_asserts(), and translate_clast_for_loop().
void gsi_commit_one_edge_insert | ( | ) |
Commit insertions pending at edge E. If a new block is created, set NEW_BB to this block, otherwise set it to NULL.
gimple_stmt_iterator gsi_for_stmt | ( | ) |
Finds iterator for STMT.
References gsi_bb(), gsi_end_p(), gsi_last_bb(), gsi_move_after(), gsi_move_before(), gsi_stmt(), and is_ctrl_stmt().
Referenced by build_one_array(), eliminate_phi(), follow_inital_value_to_phi(), forward_propagate_addr_expr(), gimple_gen_one_value_profiler(), gimple_gen_pow2_profiler(), gimple_value_profile_transformations(), ifcombine_ifandif(), is_phi_for_stmt(), may_reassociate_p(), profitable_increment_p(), replace_phi_args_in(), rewrite_use_nonlinear_expr(), set_strinfo(), stmt_is_power_of_op(), swap_ops_for_binary_stmt(), and zero_one_operation().
void gsi_insert_after | ( | gimple_stmt_iterator * | i, |
gimple | stmt, | ||
enum gsi_iterator_update | m | ||
) |
Insert statement STMT after the statement pointed-to by iterator I. Update STMT's basic block and scan it for new operands. M specifies how to update iterator I after insertion (see enum gsi_iterator_update).
Referenced by create_iv(), create_phi_for_local_result(), estimate_num_insns_fn(), examine_assign_tm(), expand_omp_for(), expand_transaction(), factor_computed_gotos(), find_goto_replacement(), generate_subtree_copies(), gimple_redirect_edge_and_branch(), instrument_builtin_call(), make_blocks(), remove_dead_stmt(), split_critical_edges(), split_function(), sra_modify_expr(), thunk_adjust(), tm_log_emit(), tm_mangle(), trivially_conflicts_p(), and update_dominators_in_loop().
void gsi_insert_after_without_update | ( | gimple_stmt_iterator * | i, |
gimple | stmt, | ||
enum gsi_iterator_update | m | ||
) |
Insert statement STMT after the statement pointed-to by iterator I. M specifies how to update iterator I after insertion (see enum gsi_iterator_update). This function does not scan for new operands. It is provided for the use of the gimplifier, which manipulates statements for which def/use information has not yet been constructed. Most callers should use gsi_insert_after.
Referenced by gsi_insert_before_without_update().
void gsi_insert_before | ( | gimple_stmt_iterator * | i, |
gimple | stmt, | ||
enum gsi_iterator_update | m | ||
) |
Insert statement STMT before the statement pointed-to by iterator I. Update STMT's basic block and scan it for new operands. M specifies how to update iterator I after insertion (see enum gsi_iterator_update).
Referenced by attempt_builtin_powi(), build_one_array(), build_tm_store(), create_call_for_reduction(), create_iv(), expand_omp_atomic_load(), generate_subtree_copies(), gimple_expand_builtin_powi(), gimple_gen_pow2_profiler(), insert_out_of_ssa_copy_on_edge(), insert_reciprocals(), instrument_builtin_call(), instrument_memory_accesses(), ipa_modify_call_arguments(), ipa_tm_diagnose_tm_safe(), is_phi_for_stmt(), lower_gimple_return(), mark_phi_for_rewrite(), remap_ssa_name(), replace_phi_args_in(), rewrite_use_nonlinear_expr(), shrink_wrap_one_built_in_call(), simplify_bitwise_binary_boolean(), swap_ops_for_binary_stmt(), trivially_conflicts_p(), and vect_permute_store_chain().
void gsi_insert_before_without_update | ( | gimple_stmt_iterator * | i, |
gimple | stmt, | ||
enum gsi_iterator_update | m | ||
) |
Insert statement STMT before the statement pointed-to by iterator I. M specifies how to update iterator I after insertion (see enum gsi_iterator_update). This function does not scan for new operands. It is provided for the use of the gimplifier, which manipulates statements for which def/use information has not yet been constructed. Most callers should use gsi_insert_before.
References gsi_insert_after_without_update(), and update_modified_stmt().
Referenced by gsi_replace_with_seq().
void gsi_insert_on_edge | ( | ) |
Add STMT to the pending list of edge E. No actual insertion is made until a call to gsi_commit_edge_inserts () is made.
References gsi_end_p(), gsi_next(), and gsi_stmt().
basic_block gsi_insert_on_edge_immediate | ( | ) |
Similar to gsi_insert_on_edge+gsi_commit_edge_inserts. If a new block has to be created, it is returned.
References gimple_stmt_iterator_d::bb, gimple_find_edge_insert_loc(), gimple_seq_first(), gsi_insert_seq_after(), gsi_insert_seq_before(), GSI_NEW_STMT, and update_call_edge_frequencies().
Referenced by dump_var_infos(), and vect_permute_store_chain().
void gsi_insert_seq_after | ( | gimple_stmt_iterator * | i, |
gimple_seq | seq, | ||
enum gsi_iterator_update | mode | ||
) |
Links sequence SEQ after the statement pointed-to by iterator I. MODE is as in gsi_insert_after. Scan the statements in SEQ for new operands.
Referenced by expand_complex_conjugate(), extract_component(), find_goto_replacement(), and gsi_insert_on_edge_immediate().
void gsi_insert_seq_after_without_update | ( | gimple_stmt_iterator * | i, |
gimple_seq | seq, | ||
enum gsi_iterator_update | mode | ||
) |
Links sequence SEQ after the statement pointed-to by iterator I. MODE is as in gsi_insert_after. This function does not scan for new operands. It is provided for the use of the gimplifier, which manipulates statements for which def/use information has not yet been constructed. Most callers should use gsi_insert_seq_after.
Don't allow inserting a sequence into itself.
Empty sequences need no work.
void gsi_insert_seq_before | ( | gimple_stmt_iterator * | i, |
gimple_seq | seq, | ||
enum gsi_iterator_update | mode | ||
) |
Inserts the sequence of statements SEQ before the statement pointed by iterator I. MODE indicates what to do with the iterator after insertion (see enum gsi_iterator_update). Scan the statements in SEQ for new operands.
References gsi_bb(), gimple_statement_base::prev, gimple_stmt_iterator_d::ptr, and update_bb_for_stmts().
Referenced by gsi_insert_on_edge_immediate(), gsi_replace(), and replace_goto_queue_cond_clause().
void gsi_insert_seq_before_without_update | ( | gimple_stmt_iterator * | i, |
gimple_seq | seq, | ||
enum gsi_iterator_update | mode | ||
) |
Inserts the sequence of statements SEQ before the statement pointed by iterator I. MODE indicates what to do with the iterator after insertion (see enum gsi_iterator_update). This function does not scan for new operands. It is provided for the use of the gimplifier, which manipulates statements for which def/use information has not yet been constructed. Most callers should use gsi_insert_seq_before.
Don't allow inserting a sequence into itself.
Empty sequences need no work.
|
static |
Insert the sequence delimited by nodes FIRST and LAST after iterator I. M specifies how to update iterator I after insertion (see enum gsi_iterator_update). This routine assumes that there is a forward and backward path between FIRST and LAST (i.e., they are linked in a doubly-linked list). Additionally, if FIRST == LAST, this routine will properly insert a single node.
If the iterator is inside a basic block, we need to update the basic block information for all the nodes between FIRST and LAST.
Link SEQ after CUR.
Update the iterator, if requested.
References first, gimple_seq_set_last(), last, gimple_statement_base::next, gimple_statement_base::prev, and gimple_stmt_iterator_d::seq.
|
static |
Insert the sequence delimited by nodes FIRST and LAST before iterator I. M specifies how to update iterator I after insertion (see enum gsi_iterator_update). This routine assumes that there is a forward and backward path between FIRST and LAST (i.e., they are linked in a doubly-linked list). Additionally, if FIRST == LAST, this routine will properly insert a single node.
Link SEQ before CUR in the sequence.
If CUR is NULL, we link at the end of the sequence (this case happens when gsi_after_labels is called for a basic block that contains only labels, so it returns an iterator after the end of the block, and we need to insert before it; it might be cleaner to add a flag to the iterator saying whether we are at the start or end of the list).
Update the iterator, if requested.
void gsi_insert_seq_on_edge | ( | ) |
Add the sequence of statements SEQ to the pending list of edge E. No actual insertion is made until a call to gsi_commit_edge_inserts is made.
Referenced by copy_edges_for_bb(), inhibit_phi_insertion(), lower_emutls_function_body(), and translate_clast_for_loop().
basic_block gsi_insert_seq_on_edge_immediate | ( | ) |
Insert STMTS on edge E. If a new block has to be created, it is returned.
Referenced by create_iv(), and vect_do_peeling_for_loop_bound().
void gsi_move_after | ( | ) |
Move the statement at FROM so it comes right after the statement at TO.
We must have GSI_NEW_STMT here, as gsi_move_after is sometimes used to move statements to an empty block.
References gimple_seq_add_stmt().
Referenced by gsi_for_stmt().
void gsi_move_before | ( | ) |
Move the statement at FROM so it comes right before the statement at TO.
For consistency with gsi_move_after, it might be better to have GSI_NEW_STMT here; however, that breaks several places that expect that TO does not change.
References edge_def::dest.
Referenced by gsi_for_stmt().
void gsi_move_to_bb_end | ( | ) |
Move the statement at FROM to the end of basic block BB.
Have to check gsi_end_p because it could be an empty block.
References gsi_end_p(), gsi_start_bb(), and gsi_stmt().
bool gsi_remove | ( | ) |
Remove the current stmt from the sequence. The iterator is updated to point to the next statement. REMOVE_PERMANENTLY is true when the statement is going to be removed from the IL and not reinserted elsewhere. In that case we remove the statement pointed to by iterator I from the EH tables, and free its operand caches. Otherwise we do not modify this information. Returns true whether EH edge cleanup is required.
Free all the data flow information for STMT.
Update the iterator and re-wire the links in I->SEQ.
See gsi_set_stmt for why we don't reset prev/next of STMT.
Cur is not last.
Cur is last but not first.
Cur is not first.
Cur is first.
Referenced by dse_optimize_stmt(), execute_lower_resx(), expand_omp_for(), expand_omp_sections(), expand_omp_target(), gsi_replace(), handle_pointer_plus(), lower_stmt(), process_assert_insertions_for(), replace_goto_queue_cond_clause(), and stmt_is_power_of_op().
void gsi_replace | ( | ) |
Replace the statement pointed-to by GSI to STMT. If UPDATE_EH_INFO is true, the exception handling information of the original statement is moved to the new statement. Assignments must only be replaced with assignments to the same LHS.
Preserve EH region information from the original statement, if requested by the caller.
Free all the data flow information for ORIG_STMT.
References gimple_seq_empty_p(), gsi_insert_seq_before(), gsi_remove(), GSI_SAME_STMT, gsi_stmt(), and last.
Referenced by fold_gimple_cond(), lower_omp_sections(), maybe_add_implicit_barrier_cancel(), and valid_gimple_call_p().
void gsi_replace_with_seq | ( | gimple_stmt_iterator * | gsi, |
gimple_seq | seq, | ||
bool | update_eh_info | ||
) |
Replace the statement pointed-to by GSI with the sequence SEQ. If UPDATE_EH_INFO is true, the exception handling information of the original statement is moved to the last statement of the new sequence. If the old statement is an assignment, then so must be the last statement of the new sequence, and they must have the same LHS.
References gsi_insert_before_without_update(), and update_modified_stmt().
void gsi_set_stmt | ( | ) |
Set the statement to which GSI points to STMT. This only updates the iterator and the gimple sequence, it doesn't do the bookkeeping of gsi_replace.
Note how we don't clear next/prev of orig_stmt. This is so that copies of *GSI our callers might still hold (to orig_stmt) can be advanced as if they too were replaced.
References gimple_seq_last(), gimple_seq_set_first(), gimple_seq_set_last(), gimple_statement_base::next, gimple_statement_base::prev, gimple_stmt_iterator_d::ptr, and gimple_stmt_iterator_d::seq.
Referenced by gsi_split_seq_before().
gimple_seq gsi_split_seq_after | ( | ) |
Move all statements in the sequence after I to a new sequence. Return this new sequence.
How can we possibly split after the end, or before the beginning?
References gimple_seq_set_first(), gimple_seq_set_last(), gsi_stmt(), gimple_statement_base::next, gimple_statement_base::prev, gimple_stmt_iterator_d::ptr, and gimple_stmt_iterator_d::seq.
void gsi_split_seq_before | ( | ) |
Move all statements in the sequence before I to a new sequence. Return this new sequence. I is set to the head of the new list.
How can we possibly split after the end?
Set the limits on NEW_SEQ.
Cut OLD_SEQ before I.
References cfun, delink_stmt_imm_use(), gimple_duplicate_stmt_histograms(), gimple_get_lhs(), gimple_has_lhs(), gimple_location(), gimple_remove_stmt_histograms(), gimple_set_bb(), gimple_set_location(), gimple_set_modified(), gsi_bb(), gsi_set_stmt(), gsi_stmt(), maybe_clean_or_replace_eh_stmt(), and update_modified_stmt().
Referenced by gimple_make_forwarder_block().
gimple_stmt_iterator gsi_start_phis | ( | ) |
Returns iterator at the start of the list of phi nodes of BB.
Referenced by add_tree_to_fld_list(), attempt_coalesce(), build_new_reduction(), build_one_array(), create_loads_and_stores_for_name(), create_loop_fn(), deps_ok_for_redirect(), do_partial_partial_insertion(), eliminate_useless_phis(), find_subloop_latch_edge_by_profile(), get_iv(), init_parameter_lattice_values(), limit_scops(), new_loop_vec_info(), pt_solution_includes_1(), record_const_or_copy(), record_temporary_equivalences(), redirect_edge_var_map_destroy(), remove_phi_args(), renumber_gimple_stmt_uids(), renumber_gimple_stmt_uids_in_blocks(), scev_reset(), set_var_live_on_entry(), update_complex_assignment(), vect_can_advance_ivs_p(), vect_create_cond_for_alias_checks(), and verify_loop_closed_ssa().
|
static |
Set BB to be the basic block for all the statements in the list starting at FIRST and LAST.
References gimple_set_bb().
Referenced by gsi_insert_seq_before().
|
static |
Set the frequencies for the cgraph_edges for each of the calls starting at FIRST for their new position within BB.
These function calls are expensive enough that we want to avoid calling them if we never see any calls.
References cgraph_edge(), cgraph_get_node(), compute_call_stmt_bb_frequency(), current_function_decl, and cgraph_edge::frequency.
Referenced by gsi_insert_on_edge_immediate().
|
inlinestatic |
@verbatim
Iterator routines for GIMPLE statements. Copyright (C) 2007-2013 Free Software Foundation, Inc. Contributed by Aldy Hernandez aldy@ ques ejoda .com
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see http://www.gnu.org/licenses/.
Mark the statement STMT as modified, and update it.
Referenced by gsi_insert_before_without_update(), gsi_replace_with_seq(), and gsi_split_seq_before().
|
static |
Mark the statements in SEQ as modified, and update them.