GCC Middle and Back End API Reference
|
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "backend.h"
#include "target.h"
#include "rtl.h"
#include "tree.h"
#include "cfghooks.h"
#include "df.h"
#include "regs.h"
#include "cfgcleanup.h"
#include "cfgloop.h"
#include "tree-pass.h"
#include "tree-ssa-loop-niter.h"
#include "loop-unroll.h"
#include "tree-scalar-evolution.h"
#include "tree-cfgcleanup.h"
Functions | |
static void | apply_loop_flags (unsigned flags) |
void | loop_optimizer_init (unsigned flags) |
void | loop_optimizer_finalize (struct function *fn, bool clean_loop_closed_phi) |
unsigned | fix_loop_structure (bitmap changed_bbs) |
rtl_opt_pass * | make_pass_loop2 (gcc::context *ctxt) |
static unsigned int | rtl_loop_init (void) |
rtl_opt_pass * | make_pass_rtl_loop_init (gcc::context *ctxt) |
rtl_opt_pass * | make_pass_rtl_loop_done (gcc::context *ctxt) |
rtl_opt_pass * | make_pass_rtl_move_loop_invariants (gcc::context *ctxt) |
rtl_opt_pass * | make_pass_rtl_unroll_loops (gcc::context *ctxt) |
rtl_opt_pass * | make_pass_rtl_doloop (gcc::context *ctxt) |
|
static |
Loop optimizer initialization routines and RTL loop optimization passes. Copyright (C) 2002-2024 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/>.
Apply FLAGS to the loop state.
References CP_FALLTHRU_PREHEADERS, CP_SIMPLE_PREHEADERS, create_preheaders(), disambiguate_loops_with_multiple_latches(), force_single_succ_latches(), gcc_assert, LOOPS_HAVE_FALLTHRU_PREHEADERS, LOOPS_HAVE_MARKED_IRREDUCIBLE_REGIONS, LOOPS_HAVE_PREHEADERS, LOOPS_HAVE_RECORDED_EXITS, LOOPS_HAVE_SIMPLE_LATCHES, LOOPS_MAY_HAVE_MULTIPLE_LATCHES, loops_state_set(), mark_irreducible_loops(), and record_loop_exits().
Referenced by fix_loop_structure(), and loop_optimizer_init().
unsigned fix_loop_structure | ( | bitmap | changed_bbs | ) |
The structure of loops might have changed. Some loops might get removed (and their headers and latches were set to NULL), loop exists might get removed (thus the loop nesting may be wrong), and some blocks and edges were changed (so the information about bb --> loop mapping does not have to be correct). But still for the remaining loops the header dominates the latch, and loops did not get new subloops (new loops might possibly get created, but we are not interested in them). Fix up the mess. If CHANGED_BBS is not NULL, basic blocks whose loop depth has changed are marked in it. Returns the number of new discovered plus the number of removed loops.
References apply_loop_flags(), basic_block_def::aux, BASIC_BLOCK_FOR_FN, basic_block_info_for_fn, bb_loop_header_p(), bitmap_set_bit, CDI_DOMINATORS, cfun, checking_verify_loop_structure(), current_loops, dom_info_state(), DOM_OK, dump_file, dump_flags, flow_loop_free(), flow_loop_tree_node_add(), flow_loop_tree_node_remove(), flow_loops_find(), FOR_EACH_BB_FN, FOR_EACH_VEC_ELT, loop::former_header, gcc_assert, get_loops(), loop::header, i, basic_block_def::index, loop::inner, LI_FROM_INNERMOST, loop_depth(), basic_block_def::loop_father, loop_outer(), LOOPS_HAVE_RECORDED_EXITS, LOOPS_NEED_FIXUP, loops_state_clear(), loops_state_satisfies_p(), NULL, loop::num, number_of_loops(), release_recorded_exits(), scev_initialized_p(), scev_reset_htab(), TDF_DETAILS, timevar_pop(), and timevar_push().
Referenced by cleanup_cfg(), loop_optimizer_init(), repair_loop_structures(), tree_function_versioning(), and unroll_loops().
Finalize loop structures.
References clean_up_loop_closed_phi(), function::curr_properties, flow_loops_free(), FOR_ALL_BB_FN, free_numbers_of_iterations_estimates(), free_simple_loop_desc(), ggc_free(), LOOP_CLOSED_SSA, basic_block_def::loop_father, loops_for_fn(), LOOPS_HAVE_FALLTHRU_PREHEADERS, LOOPS_HAVE_MARKED_IRREDUCIBLE_REGIONS, LOOPS_HAVE_PREHEADERS, LOOPS_HAVE_RECORDED_EXITS, LOOPS_HAVE_SIMPLE_LATCHES, LOOPS_MAY_HAVE_MULTIPLE_LATCHES, loops_state_clear(), loops_state_satisfies_p(), loops_state_set(), NULL, PROP_loops, release_recorded_exits(), set_loops_for_fn(), timevar_pop(), and timevar_push().
void loop_optimizer_init | ( | unsigned | flags | ) |
Initialize loop structures. This is used by the tree and RTL loop optimizers. FLAGS specify what properties to compute and/or ensure for loops.
References apply_loop_flags(), calculate_dominance_info(), CDI_DOMINATORS, cfun, checking_verify_loop_structure(), current_loops, dump_file, fix_loop_structure(), flow_loops_dump(), flow_loops_find(), gcc_assert, LOOPS_HAVE_RECORDED_EXITS, LOOPS_MAY_HAVE_MULTIPLE_LATCHES, LOOPS_NEED_FIXUP, loops_state_clear(), loops_state_satisfies_p(), loops_state_set(), NULL, PROP_loops, release_recorded_exits(), timevar_pop(), and timevar_push().
Referenced by autofdo::afdo_calculate_branch_prob(), analyze_function_body(), back_threader::back_threader(), compute_alignments(), execute_build_cfg(), execute_ranger_vrp(), finite_function_p(), fwprop_init(), if_convert(), init_reassoc(), ira(), lto_prepare_function_for_streaming(), perform_tree_ssa_dce(), rebuild_frequencies(), report_predictor_hitrates(), rtl_loop_init(), split_live_ranges_for_shrink_wrap(), split_paths(), and tree_function_versioning().
rtl_opt_pass * make_pass_loop2 | ( | gcc::context * | ctxt | ) |
rtl_opt_pass * make_pass_rtl_doloop | ( | gcc::context * | ctxt | ) |
rtl_opt_pass * make_pass_rtl_loop_done | ( | gcc::context * | ctxt | ) |
rtl_opt_pass * make_pass_rtl_loop_init | ( | gcc::context * | ctxt | ) |
rtl_opt_pass * make_pass_rtl_move_loop_invariants | ( | gcc::context * | ctxt | ) |
rtl_opt_pass * make_pass_rtl_unroll_loops | ( | gcc::context * | ctxt | ) |
|
static |
Initialization of the RTL loop passes.
References current_ir_type(), dump_file, dump_flags, dump_flow_info(), dump_reg_info(), gcc_assert, IR_RTL_CFGLAYOUT, loop_optimizer_init(), LOOPS_HAVE_RECORDED_EXITS, and LOOPS_NORMAL.