Go to the source code of this file.
Typedefs | |
typedef void(* | transform_callback) (class loop *, void *) |
typedef void(* transform_callback) (class loop *, void *) |
Header file for High-level loop manipulation functions. Copyright (C) 2013-2025 Free Software Foundation, Inc. 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/>.
|
extern |
Returns true if we can unroll LOOP FACTOR times. Number of iterations of the loop is returned in NITER.
References affine_iv::base, tree_niter_desc::bound, can_duplicate_loop_p(), tree_niter_desc::cmp, contains_abnormal_ssa_name_p(), tree_niter_desc::control, eni_size_weights, tree_niter_desc::may_be_zero, number_of_iterations_exit(), single_dom_exit(), affine_iv::step, and tree_num_loop_insns().
Referenced by should_unroll_loop_p(), tree_loop_unroll_and_jam(), and pcom_worker::tree_predictive_commoning_loop().
Bases all the induction variables in LOOP on a single induction variable (with base 0 and step 1), whose final value is compared with *NIT. When the IV type precision has to be larger than *NIT type precision, *NIT is converted to the larger type, the conversion code is inserted before the loop, and *NIT is updated to the new definition. When BUMP_IN_LATCH is true, the induction variable is incremented in the loop latch, otherwise it is incremented in the loop header. Return the induction variable that was created.
References as_a(), build_int_cst(), build_int_cst_type(), build_nonstandard_integer_type(), create_iv(), extract_true_false_edges_from_block(), fold_convert, force_gimple_operand(), GET_MODE_PRECISION(), gimple_cond_set_code(), gimple_cond_set_lhs(), gimple_cond_set_rhs(), gsi_end_p(), gsi_insert_seq_on_edge_immediate(), gsi_last_bb(), gsi_last_nondebug_bb(), gsi_next(), gsi_start_phis(), loop::header, INTEGRAL_TYPE_P, loop::latch, loop_preheader_edge(), NULL, NULL_TREE, gphi_iterator::phi(), PHI_RESULT, POINTER_TYPE_P, opt_mode< T >::require(), rewrite_all_phi_nodes_with_iv(), single_dom_exit(), smallest_int_mode_for_size(), TREE_TYPE, type(), TYPE_PRECISION, TYPE_UNSIGNED, update_stmt(), and virtual_operand_p().
Referenced by gen_parallel_loop().
References verify_loop_closed_ssa().
Referenced by tree_transform_and_unroll_loop().
|
extern |
Creates an induction variable with value BASE (+/-) STEP * iteration in LOOP. If INCR_OP is PLUS_EXPR, the induction variable is BASE + STEP * iteration. If INCR_OP is MINUS_EXPR, the induction variable is BASE - STEP * iteration. It is expected that neither BASE nor STEP are shared with other expressions (unless the sharing rules allow this). Use VAR as a base var_decl for it (if NULL, a new temporary will be created). The increment will occur at INCR_POS (after it if AFTER is true, before it otherwise). INCR_POS and AFTER can be computed using standard_iv_increment_position. The ssa versions of the variable before and after increment will be stored in VAR_BEFORE and VAR_AFTER (unless they are NULL).
References add_phi_arg(), convert_to_ptrofftype, create_phi_node(), fold_build1, force_gimple_operand(), gcc_assert, gimple_build_assign(), gimple_location(), gimple_set_location(), gsi_bb(), gsi_end_p(), gsi_insert_after(), gsi_insert_before(), gsi_insert_seq_on_edge_immediate(), GSI_NEW_STMT, gsi_next_nondebug(), gsi_stmt(), loop::header, is_gimple_debug(), loop_latch_edge(), loop_preheader_edge(), make_ssa_name(), make_temp_ssa_name(), mark_addressable(), may_negate_without_overflow_p(), NULL, NULL_TREE, POINTER_TYPE_P, single_succ_edge(), TREE_CODE, tree_expr_nonnegative_warnv_p, tree_int_cst_lt(), TREE_OPERAND, TREE_TYPE, TYPE_UNSIGNED, and UNKNOWN_LOCATION.
Referenced by canonicalize_loop_induction_variables(), canonicalize_loop_ivs(), create_canonical_iv(), create_empty_loop_on_edge(), create_new_iv(), tree_loop_interchange::map_inductions_to_loop(), tree_transform_and_unroll_loop(), vect_create_data_ref_ptr(), vect_create_epilog_for_reduction(), vect_set_loop_condition_normal(), vect_set_loop_condition_partial_vectors_avx512(), vect_set_loop_controls_directly(), vectorizable_load(), and vectorizable_store().
|
extern |
The same as cfgloopmanip.cc:duplicate_loop_body_to_header_edge, but also updates the PHI nodes at start of the copied region. In order to achieve this, only loops whose exits all lead to the same location are handled. Notice that we do not completely update the SSA web after duplication. The caller is responsible for calling update_ssa after the loop has been duplicated.
References cfun, copy_phi_node_args(), duplicate_loop_body_to_header_edge(), flush_pending_stmts(), last_basic_block_for_fn, LOOPS_HAVE_PREHEADERS, LOOPS_HAVE_SIMPLE_LATCHES, loops_state_satisfies_p(), and scev_reset().
Referenced by tree_transform_and_unroll_loop(), try_peel_loop(), and try_unroll_loop_completely().
|
extern |
Returns the basic block in that statements should be emitted for induction variables incremented at the end of the LOOP.
References loop::latch.
Referenced by add_candidate(), add_iv_candidate_derived_from_uses(), allow_ip_end_pos_p(), create_new_iv(), determine_iv_cost(), and standard_iv_increment_position().
|
extern |
Returns the basic block in that statements should be emitted for induction variables incremented just before exit condition of a LOOP.
References EDGE_SUCC, flow_bb_inside_loop_p(), gsi_last_bb(), loop::latch, NULL, safe_is_a(), single_pred(), and single_pred_p().
Referenced by add_candidate(), add_iv_candidate_derived_from_uses(), allow_ip_end_pos_p(), create_new_iv(), standard_iv_increment_position(), and stmt_after_ip_normal_pos().
Moves invariants from loops. Only "expensive" invariants are moved out -- i.e. those that are likely to be win regardless of the register pressure. Only perform store motion if STORE_MOTION is true.
References analyze_memory_references(), BASIC_BLOCK_FOR_FN, cfun, coldest_outermost_loop, compute_invariantness(), current_loops, do_store_motion(), fill_always_executed_in(), fill_coldest_and_hotter_out_loop(), free(), gsi_commit_edge_inserts(), hotter_than_inner_loop, i, loop::inner, last_basic_block_for_fn, mark_ssa_maybe_undefs(), move_computations_worker(), need_ssa_update_p(), loop::next, NULL, number_of_loops(), pre_and_rev_post_order_compute_fn(), rewrite_into_loop_closed_ssa(), todo, TODO_update_ssa, tree_ssa_lim_finalize(), and tree_ssa_lim_initialize().
|
extern |
Rewrites the defs and uses into a loop closed ssa form. If CHANGED_BBS is not NULL, we look for uses outside loops only in the basic blocks in this set. UPDATE_FLAG is used in the call to update_ssa. See TODO_update_ssa* for documentation.
References rewrite_into_loop_closed_ssa_1(), and SSA_OP_ALL_USES.
Referenced by canonicalize_induction_variables(), loop_distribution::execute(), execute_ranger_vrp(), execute_update_addresses_taken(), loop_invariant_motion_in_fun(), repair_loop_structures(), tree_loop_unroll_and_jam(), tree_predictive_commoning(), tree_ssa_prefetch_arrays(), tree_ssa_split_loops(), and tree_unroll_loops_completely().
|
extern |
Split loop exit edge EXIT. The things are a bit complicated by a need to preserve the loop closed ssa form. If COPY_CONSTANTS_P is true then forwarder PHIs are also created for constant arguments. The newly created block is returned.
References add_phi_arg(), create_phi_node(), duplicate_ssa_name(), gimple_phi_arg_location_from_edge(), gsi_end_p(), gsi_next(), gsi_start_phis(), NULL, gphi_iterator::phi(), PHI_ARG_DEF_PTR_FROM_EDGE, PHI_RESULT, SET_USE, single_succ_edge(), split_edge(), TREE_CODE, and USE_FROM_PTR.
Referenced by create_parallel_loop(), emit_mfence_after_loop(), final_value_replacement_loop(), and vect_transform_loop().
|
extern |
Stores the standard position for induction variable increment in LOOP (just before the exit condition if it is available and latch block is empty, end of the latch block otherwise) to BSI. INSERT_AFTER is set to true if the increment should be inserted after *BSI.
References gsi_last_bb(), ip_end_pos(), ip_normal_pos(), last, last_nondebug_stmt(), and loop::latch.
Referenced by vect_create_data_ref_ptr(), vectorizable_load(), and vectorizable_store().
|
extern |
References add_phi_arg(), profile_probability::always(), loop::any_estimate, loop::any_likely_upper_bound, loop::any_upper_bound, profile_probability::apply_scale(), as_a(), bitmap_clear_bit(), bitmap_ones(), checking_verify_flow_info(), checking_verify_loop_closed_ssa(), checking_verify_loop_structure(), copy_ssa_name(), basic_block_def::count, create_iv(), create_phi_node(), determine_exit_conditions(), DLTHE_FLAG_FLAT_PROFILE, DLTHE_FLAG_UPDATE_FREQ, gcc_assert, gimple_build_cond(), gimple_cond_set_code(), gimple_cond_set_lhs(), gimple_cond_set_rhs(), gimple_duplicate_loop_body_to_header_edge(), gsi_end_p(), gsi_insert_after(), gsi_last_bb(), gsi_last_nondebug_bb(), GSI_NEW_STMT, gsi_next(), gsi_start_phis(), gsi_stmt(), profile_probability::guessed_always(), loop::header, integer_nonzerop(), integer_zero_node, profile_probability::invert(), loop::latch, loop_latch_edge(), loop_preheader_edge(), loop_version(), make_edge(), make_temp_ssa_name(), maybe_flat_loop_profile(), loop::nb_iterations_estimate, loop::nb_iterations_likely_upper_bound, loop::nb_iterations_upper_bound, profile_probability::never(), loop::next, NULL, NULL_TREE, operand_equal_for_phi_arg_p(), PHI_ARG_DEF_FROM_EDGE, PHI_ARG_DEF_PTR_FROM_EDGE, PROB_UNROLLED_LOOP_ENTERED, remove_path(), rescan_loop_exit(), scale_dominated_blocks_in_loop(), scale_loop_profile(), set_edge_probability_and_rescale_others(), SET_USE, single_dom_exit(), single_pred(), single_pred_edge(), split_edge(), TODO_update_ssa, TODO_update_ssa_no_phi, TREE_CODE, TREE_TYPE, wi::udiv_floor(), UNKNOWN_LOCATION, update_loop_exit_probability_scale_dom_bbs(), update_ssa(), update_stmt(), USE_FROM_PTR, and useless_type_conversion_p().
Referenced by pcom_worker::tree_predictive_commoning_loop(), and tree_unroll_loop().
|
extern |
Wrapper over tree_transform_and_unroll_loop for case we do not want to transform the loop before unrolling. The meaning of the arguments is the same as for tree_transform_and_unroll_loop.
References NULL, and tree_transform_and_unroll_loop().
Referenced by loop_prefetch_arrays(), and tree_loop_unroll_and_jam().
Checks that invariants of the loop closed ssa form are preserved. Call verify_ssa when VERIFY_SSA_P is true. Note all loops are checked if LOOP is NULL, otherwise, only LOOP is checked.
References cfun, check_loop_closed_ssa_bb(), FOR_EACH_BB_FN, free(), gcc_assert, get_loop_body(), i, basic_block_def::loop_father, need_ssa_update_p(), NULL, loop::num, loop::num_nodes, number_of_loops(), timevar_pop(), timevar_push(), and verify_ssa().
Referenced by checking_verify_loop_closed_ssa(), execute_function_todo(), and tree_unroll_loops_completely().