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 "df.h"
#include "memmodel.h"
#include "tm_p.h"
#include "insn-config.h"
#include "regs.h"
#include "ira.h"
#include "recog.h"
#include "diagnostic-core.h"
#include "reload.h"
#include "output.h"
#include "tree-pass.h"
#include "function-abi.h"
Data Structures | |
class | simplifiable_subreg |
struct | reg_pref |
Macros | |
#define | call_used_regs (this_target_hard_regs->x_call_used_regs) |
#define | regs_invalidated_by_call (this_target_hard_regs->x_regs_invalidated_by_call) |
#define | N_REG_INTS ((FIRST_PSEUDO_REGISTER + (32 - 1)) / 32) |
Variables | |
int | max_regno |
struct target_hard_regs | default_target_hard_regs |
struct target_regs | default_target_regs |
static const char | initial_fixed_regs [] = FIXED_REGISTERS |
static const char | initial_call_used_regs [] = CALL_USED_REGISTERS |
char | global_regs [FIRST_PSEUDO_REGISTER] |
HARD_REG_SET | global_reg_set |
tree | global_regs_decl [FIRST_PSEUDO_REGISTER] |
static const unsigned | int_reg_class_contents [N_REG_CLASSES][N_REG_INTS] = REG_CLASS_CONTENTS |
static const char *const | initial_reg_names [] = REGISTER_NAMES |
const char * | reg_class_names [] = REG_CLASS_NAMES |
static int | no_global_reg_vars = 0 |
static char | saved_fixed_regs [FIRST_PSEUDO_REGISTER] |
static char | saved_call_used_regs [FIRST_PSEUDO_REGISTER] |
static const char * | saved_reg_names [FIRST_PSEUDO_REGISTER] |
static HARD_REG_SET | saved_accessible_reg_set |
static HARD_REG_SET | saved_operand_reg_set |
static struct reg_pref * | reg_pref |
static int | reg_info_size |
static int | max_regno_since_last_resize |
static HARD_REG_SET ** | valid_mode_changes |
static obstack | valid_mode_changes_obstack |
#define call_used_regs (this_target_hard_regs->x_call_used_regs) |
Referenced by fix_register(), globalize_reg(), init_reg_sets(), init_reg_sets_1(), restore_register_info(), and save_register_info().
#define N_REG_INTS ((FIRST_PSEUDO_REGISTER + (32 - 1)) / 32) |
Used to initialize reg_alloc_order.
The same information, but as an array of unsigned ints. We copy from these unsigned ints to the table above. We do this so the tm.h files do not have to be aware of the wordsize for machines with <= 64 regs. Note that we hard-code 32 here, not HOST_BITS_PER_INT.
#define regs_invalidated_by_call (this_target_hard_regs->x_regs_invalidated_by_call) |
Referenced by globalize_reg(), and init_reg_sets_1().
|
static |
Allocate space for reg info and initilize it.
References reg_pref::allocnoclass, reg_pref::altclass, gcc_assert, i, max_reg_num(), max_regno_since_last_resize, reg_pref::prefclass, reg_info_size, and reg_renumber.
Referenced by resize_reg_info().
machine_mode choose_hard_reg_mode | ( | unsigned int | regno, |
unsigned int | nregs, | ||
const predefined_function_abi * | abi ) |
Return a machine mode that is legitimate for hard reg REGNO and large enough to save nregs. If we can't find one, return VOIDmode. If ABI is nonnull, only consider modes that are preserved across calls that use ABI.
References predefined_function_abi::clobbers_reg_p(), FOR_EACH_MODE_IN_CLASS, GET_MODE_SIZE(), hard_regno_nregs(), maybe_gt, and targetm.
Referenced by default_dwarf_frame_reg_mode(), init_reg_modes_target(), and zcur_select_mode_rtx().
|
static |
References global_regs, global_regs_decl, i, and NULL.
Referenced by reginfo_cc_finalize().
|
static |
Call record_subregs_of_mode for all the subregs in X.
References find_subregs_of_mode(), GET_CODE, GET_RTX_FORMAT, GET_RTX_LENGTH, i, record_subregs_of_mode(), XEXP, XVECEXP, and XVECLEN.
Referenced by find_subregs_of_mode(), and init_subregs_of_mode().
void finish_subregs_of_mode | ( | void | ) |
References NULL, valid_mode_changes, and valid_mode_changes_obstack.
Referenced by finish_costs().
void fix_register | ( | const char * | name, |
int | fixed, | ||
int | call_used ) |
Specify the usage characteristics of the register named NAME. It should be a fixed register if FIXED and a call-used register if CALL_USED.
References call_used_regs, decode_reg_name_and_count(), error(), fixed_regs, gcc_assert, gcc_unreachable, HARD_FRAME_POINTER_REGNUM, i, and warning().
Referenced by handle_common_deferred_options().
void free_reg_info | ( | void | ) |
Free up the space allocated by allocate_reg_info.
References free(), NULL, and reg_renumber.
Referenced by move_loop_invariants(), one_code_hoisting_pass(), and rest_of_handle_final().
void globalize_reg | ( | tree | decl, |
int | i ) |
Mark register number I as global.
References call_used_regs, DECL_SOURCE_LOCATION, error(), error_at(), fixed_reg_set, fixed_regs, function_abis, global_reg_set, global_regs, global_regs_decl, i, IN_RANGE, inform(), no_global_reg_vars, NUM_ABI_IDS, regs_invalidated_by_call, reinit_regs(), SET_HARD_REG_BIT, and warning_at().
Referenced by make_decl_rtl().
void init_fake_stack_mems | ( | void | ) |
Initialize some fake stack-frame MEM references for use in memory_move_secondary_cost.
References gen_rtx_MEM(), i, stack_pointer_rtx, and top_of_stack.
Referenced by backend_init_target().
|
extern |
In insn-preds.cc.
Referenced by init_reg_sets().
void init_reg_modes_target | ( | void | ) |
Compute the table of register modes. These values are used to record death information for individual registers (as opposed to a multi-register mode). This function might be invoked more than once, if the target has support for changing register usage conventions on a per-function basis.
References choose_hard_reg_mode(), hard_regno_nregs(), i, NULL, reg_raw_mode, targetm, this_target_regs, and word_mode.
Referenced by init_emit_regs().
void init_reg_sets | ( | void | ) |
Function called only once per target_globals to initialize the target_hard_regs structure. Once this is done, various switches may override.
References accessible_reg_set, call_used_regs, CLEAR_HARD_REG_SET, fixed_regs, gcc_assert, i, init_reg_class_start_regs(), initial_call_used_regs, initial_fixed_regs, initial_reg_names, int_reg_class_contents, operand_reg_set, reg_alloc_order, reg_class_contents, reg_names, SET_HARD_REG_BIT, and SET_HARD_REG_SET.
Referenced by general_init().
|
static |
After switches have been processed, which perhaps alter `fixed_regs' and `call_used_regs', convert them to HARD_REG_SETs.
References accessible_reg_set, call_used_regs, class_only_fixed_regs, CLEAR_HARD_REG_BIT, CLEAR_HARD_REG_SET, contains_allocatable_reg_of_mode, contains_reg_of_mode, default_function_abi, EH_RETURN_DATA_REGNO, eh_return_data_regs, fixed_nonglobal_reg_set, fixed_reg_set, fixed_regs, global_reg_set, global_regs, HARD_FRAME_POINTER_IS_FRAME_POINTER, HARD_FRAME_POINTER_REGNUM, hard_reg_set_intersect_p(), hard_reg_set_subset_p(), have_regs_of_mode, i, inv_reg_alloc_order, INVALID_REGNUM, operand_reg_set, PIC_OFFSET_TABLE_REG_CALL_CLOBBERED, PIC_OFFSET_TABLE_REGNUM, reg_alloc_order, reg_class_contents, reg_class_size, reg_class_subclasses, reg_class_subunion, reg_class_superunion, regs_invalidated_by_call, restore_register_info(), savable_regs, SET_HARD_REG_BIT, SET_HARD_REG_SET, targetm, and TEST_HARD_REG_BIT.
Referenced by init_regs().
void init_regs | ( | void | ) |
Finish initializing the register sets and initialize the register modes. This function might be invoked more than once, if the target has support for changing register usage conventions on a per-function basis.
References init_reg_sets_1().
Referenced by add_removable_extension(), backend_init(), reinit_regs(), and target_reinit().
void init_subregs_of_mode | ( | void | ) |
References cfun, DF_REF_FLAGS_IS_SET, DF_REF_PARTIAL, DF_REF_REG, find_subregs_of_mode(), FOR_BB_INSNS, FOR_EACH_BB_FN, FOR_EACH_INSN_DEF, gcc_obstack_init, max_reg_num(), NONDEBUG_INSN_P, PATTERN(), read_modify_subreg_p(), record_subregs_of_mode(), valid_mode_changes, and valid_mode_changes_obstack.
Referenced by init_costs().
rtl_opt_pass * make_pass_reginfo_init | ( | gcc::context * | ctxt | ) |
int memory_move_cost | ( | machine_mode | mode, |
reg_class_t | rclass, | ||
bool | in ) |
Compute cost of moving registers to/from memory.
References targetm.
Referenced by choose_reload_regs(), reload_cse_simplify_set(), and setup_class_subset_and_memory_move_costs().
int memory_move_secondary_cost | ( | machine_mode | mode, |
reg_class_t | rclass, | ||
bool | in ) |
Compute extra cost of moving registers to/from memory due to reloads. Only needed if secondary reloads are required for memory moves.
References memory_move_secondary_cost(), register_move_cost(), secondary_reload_class(), and top_of_stack.
Referenced by default_memory_move_cost(), and memory_move_secondary_cost().
Restrict the choice of register for SUBREG_REG (SUBREG) based on information about SUBREG. If PARTIAL_DEF, SUBREG is a partial definition of a multipart inner register and we want to ensure that the other parts of the inner register are correctly preserved. If !PARTIAL_DEF we need to ensure that SUBREG itself can be formed.
References gcc_checking_assert, GET_MODE_SIZE(), subreg_shape::inner_mode, known_ge, known_lt, subreg_shape::offset, subreg_shape::outer_mode, REG_P, REGMODE_NATURAL_SIZE, REGNO, shape_of_subreg(), simplifiable_subregs(), SUBREG_REG, valid_mode_changes, and valid_mode_changes_obstack.
Referenced by find_subregs_of_mode(), and init_subregs_of_mode().
enum reg_class reg_allocno_class | ( | int | regno | ) |
Return the reg_class which is used by IRA for its allocation.
References reg_pref::allocnoclass, gcc_assert, and reg_info_size.
Referenced by get_pressure_class_and_nregs(), get_pressure_class_and_nregs(), get_regno_pressure_class(), get_regno_pressure_class(), ira(), lra_get_allocno_class(), move_invariants(), and setup_preferred_alternate_classes_for_new_pseudos().
enum reg_class reg_alternate_class | ( | int | regno | ) |
References reg_pref::altclass, gcc_assert, and reg_info_size.
Referenced by dump_reg_info(), find_reloads(), ira(), move_invariants(), must_not_spill_p(), and setup_preferred_alternate_classes_for_new_pseudos().
bool reg_class_subset_p | ( | reg_class_t | c1, |
reg_class_t | c2 ) |
Return true if C1 is a subset of C2, i.e., if every register in C1 is also in C2.
References hard_reg_set_subset_p(), and reg_class_contents.
Referenced by combine_reloads(), default_secondary_reload(), find_reloads(), find_reusable_reload(), push_reload(), push_secondary_reload(), and setup_reg_class_relations().
bool reg_classes_intersect_p | ( | reg_class_t | c1, |
reg_class_t | c2 ) |
Return true if there is a register that is in both C1 and C2.
References hard_reg_set_intersect_p(), and reg_class_contents.
Referenced by check_and_make_def_conflict(), check_and_make_def_use_conflict(), choose_reload_regs(), gain_for_invariant(), and make_pseudo_conflict().
enum reg_class reg_preferred_class | ( | int | regno | ) |
Return the reg_class in which pseudo reg number REGNO is best allocated. This function is sometimes called before the info has been computed. When that happens, just return GENERAL_REGS, which is innocuous.
References gcc_assert, reg_pref::prefclass, and reg_info_size.
Referenced by dump_reg_info(), find_costs_and_classes(), find_hard_regno_for(), find_reloads(), ira(), ira_bad_reload_regno_1(), ira_get_dup_out_num(), move_invariants(), must_not_spill_p(), setup_preferred_alternate_classes_for_new_pseudos(), update_conflict_hard_reg_costs(), and update_equiv_regs().
void reg_scan | ( | rtx_insn * | f, |
unsigned int | nregs ) |
References INSN_P, NEXT_INSN(), PATTERN(), REG_NOTES, reg_scan_mark_refs(), timevar_pop(), and timevar_push().
Referenced by cse_main().
This is the `regscan' pass of the compiler, run just before cse and again just before loop. It finds the first and last use of each pseudo-register.
X is the expression to scan. INSN is the insn it appears in. NOTE_FLAG is nonzero if X is from INSN's notes rather than its body. We should only record information for REGs with numbers greater than or equal to MIN_REGNO.
References CASE_CONST_ANY, CONST_INT_P, DF_REG_DEF_COUNT, find_reg_note(), GET_CODE, GET_RTX_FORMAT, GET_RTX_LENGTH, i, MEM_P, REG_ATTRS, REG_P, REG_POINTER, reg_scan_mark_refs(), REG_USERVAR_P, REGNO, SET, SET_DEST, set_reg_attrs_from_value(), SET_SRC, XEXP, XVEC, XVECEXP, and XVECLEN.
Referenced by reg_scan(), and reg_scan_mark_refs().
void reg_set_to_hard_reg_set | ( | HARD_REG_SET * | to, |
const_bitmap | from ) |
Given a register bitmap, turn on the bits in a HARD_REG_SET that correspond to the hard registers, if any, set in that map. This could be done far more efficiently by having all sorts of special-cases with moving single words, but probably isn't worth the trouble.
References EXECUTE_IF_SET_IN_BITMAP, i, and SET_HARD_REG_BIT.
void reginfo_cc_finalize | ( | void | ) |
References clear_global_regs_cache(), CLEAR_HARD_REG_SET, global_reg_set, and no_global_reg_vars.
Referenced by toplev::finalize().
|
static |
Initialize some global data for this pass.
References df, df_compute_regs_ever_live(), max_regno_since_last_resize, no_global_reg_vars, NULL, and reg_info_size.
int register_move_cost | ( | machine_mode | mode, |
reg_class_t | from, | ||
reg_class_t | to ) |
Compute cost of moving data from a register of class FROM to one of TO, using MODE.
References targetm.
Referenced by choose_reload_regs(), find_reloads(), find_valid_class(), find_valid_class_1(), ira_init_register_move_cost(), memory_move_secondary_cost(), and reload_cse_simplify_set().
void reinit_regs | ( | void | ) |
The same as previous function plus initializing IRA.
References caller_save_initialized_p, init_regs(), ira_init(), recog_init(), and this_target_rtl.
Referenced by globalize_reg().
bool resize_reg_info | ( | void | ) |
Resize reg info. The new elements will be initialized. Return TRUE if new pseudos were added since the last call.
References allocate_reg_info(), reg_pref::allocnoclass, reg_pref::altclass, gcc_assert, i, max_reg_num(), max_regno_since_last_resize, NULL, reg_pref::prefclass, reg_info_size, and reg_renumber.
Referenced by expand_reg_data(), expand_reg_info(), find_costs_and_classes(), ira(), lra_get_allocno_class(), lra_get_regno_hard_regno(), and move_invariants().
|
static |
Restore the register information.
References accessible_reg_set, call_used_regs, fixed_regs, operand_reg_set, reg_names, saved_accessible_reg_set, saved_call_used_regs, saved_fixed_regs, saved_operand_reg_set, and saved_reg_names.
Referenced by init_reg_sets_1().
void save_register_info | ( | void | ) |
Save the register information.
References accessible_reg_set, call_used_regs, fixed_regs, gcc_assert, operand_reg_set, reg_names, saved_accessible_reg_set, saved_call_used_regs, saved_fixed_regs, saved_operand_reg_set, and saved_reg_names.
Referenced by backend_init().
void setup_reg_classes | ( | int | regno, |
enum reg_class | prefclass, | ||
enum reg_class | altclass, | ||
enum reg_class | allocnoclass ) |
Set up preferred, alternate, and allocno classes for REGNO as PREFCLASS, ALTCLASS, and ALLOCNOCLASS.
References reg_pref::allocnoclass, reg_pref::altclass, gcc_assert, max_reg_num(), NULL, reg_pref::prefclass, and reg_info_size.
Referenced by assign_by_spills(), expand_reg_info(), find_costs_and_classes(), ira(), lra_change_class(), lra_create_new_reg_with_unique_value(), move_invariants(), and setup_preferred_alternate_classes_for_new_pseudos().
const HARD_REG_SET & simplifiable_subregs | ( | const subreg_shape & | shape | ) |
Return the set of hard registers that are able to form the subreg described by SHAPE.
References inchash::hash::add_hwi(), inchash::hash::end(), i, subreg_shape::inner_mode, subreg_shape::offset, subreg_shape::outer_mode, SET_HARD_REG_BIT, simplifiable_subreg::simplifiable_regs, simplify_subreg_regno(), targetm, this_target_hard_regs, and subreg_shape::unique_id().
Referenced by record_subregs_of_mode().
const HARD_REG_SET * valid_mode_changes_for_regno | ( | unsigned int | regno | ) |
References valid_mode_changes.
Referenced by setup_regno_cost_classes_by_aclass(), and setup_regno_cost_classes_by_mode().
struct target_hard_regs default_target_hard_regs |
struct target_regs default_target_regs |
HARD_REG_SET global_reg_set |
The set of global registers.
Referenced by globalize_reg(), init_reg_sets_1(), reginfo_cc_finalize(), and rtx_properties::try_to_add_insn().
char global_regs[FIRST_PSEUDO_REGISTER] |
Indexed by hard register number, contains 1 for registers that are being used for global register decls. These must be exempt from ordinary flow analysis and are also considered fixed.
Referenced by can_combine_p(), can_move_insns_across(), check_new_reg_p(), clear_global_regs_cache(), copy_value(), deletable_insn_p(), df_get_call_refs(), df_get_entry_block_def_set(), df_get_exit_block_use_set(), df_lr_local_compute(), distribute_notes(), do_reload(), ext_dce_process_bb(), get_defs(), globalize_reg(), hash_rtx(), init_reg_sets_1(), init_resource_info(), ira_setup_eliminable_regset(), mark_referenced_resources(), mark_target_live_regs(), peep2_find_free_register(), reload_combine_recognize_pattern(), rename_chains(), simplify_context::simplify_plus_minus(), and rtx_properties::try_to_add_insn().
tree global_regs_decl[FIRST_PSEUDO_REGISTER] |
Declaration for the global register.
Referenced by clear_global_regs_cache(), do_reload(), and globalize_reg().
|
static |
Data for initializing call_used_regs.
Referenced by init_reg_sets().
|
static |
Data for initializing fixed_regs.
Referenced by init_reg_sets().
|
static |
Array containing all of the register names.
Referenced by init_reg_sets().
|
static |
Referenced by init_reg_sets().
int max_regno |
Compute different info about registers. Copyright (C) 1987-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/>.
This file contains regscan pass of the compiler and passes for dealing with info about modes of pseudo-registers inside subregisters. It also defines some tables of information about the hardware registers, function init_reg_sets to initialize the tables, and other auxiliary functions to deal with info about registers and their classes.
Maximum register number used in this function, plus one.
Referenced by assign_by_spills(), build_insn_chain(), calculate_elim_costs_all_insns(), choose_reload_regs(), create_live_range_start_chains(), dead_or_predicable(), finish_spills(), fix_reg_equiv_init(), grow_reg_equivs(), if_convert(), init_eliminable_invariants(), init_live_reload_and_inheritance_pseudos(), init_lives(), init_loop_tree_node(), init_regno_assign_info(), ira(), ira_print_disposition(), ira_sort_regnos_for_alter_reg(), lra_assign(), lra_coalesce(), lra_create_live_ranges_1(), lra_final_code_change(), lra_need_for_scratch_reg_p(), lra_need_for_spills_p(), lra_remat(), lra_split_hard_reg_for(), print_live_ranges(), rebuild_regno_allocno_maps(), regstat_compute_calls_crossed(), regstat_compute_ri(), regstat_init_n_sets_and_refs(), reload(), reload_as_needed(), remove_init_insns(), remove_some_program_points_and_update_live_ranges(), run_rtl_passes(), setup_live_pseudos_and_spill_after_risky_transforms(), setup_preferred_alternate_classes_for_new_pseudos(), setup_reg_equiv_init(), spill_hard_reg(), and subst_reloads().
|
static |
Max_reg_num still last resize_reg_info call.
Referenced by allocate_reg_info(), reginfo_init(), and resize_reg_info().
|
static |
No more global register variables may be declared; true once reginfo has been initialized.
Referenced by globalize_reg(), reginfo_cc_finalize(), and reginfo_init().
const char* reg_class_names[] = REG_CLASS_NAMES |
Array containing all of the register class names.
Referenced by assign_by_spills(), calculate_bb_reg_pressure(), calculate_loop_reg_pressure(), debug_reload_to_stream(), dump_def_use_chain(), dump_reg_info(), find_costs_and_classes(), inherit_reload_reg(), lra_change_class(), lra_create_new_reg_with_unique_value(), print_allocno_costs(), print_loop_title(), print_pseudo_costs(), print_translated_classes(), print_uniform_and_important_classes(), process_alt_operands(), record_reg_classes(), scan_one_insn(), setup_allocno_available_regs_num(), setup_preferred_alternate_classes_for_new_pseudos(), spill_failure(), and split_reg().
|
static |
Current size of reg_info.
Referenced by allocate_reg_info(), reg_allocno_class(), reg_alternate_class(), reg_preferred_class(), reginfo_init(), resize_reg_info(), and setup_reg_classes().
|
static |
Record preferences of each pseudo. This is available after RA is run.
|
static |
Referenced by restore_register_info(), and save_register_info().
|
static |
Referenced by restore_register_info(), and save_register_info().
|
static |
We need to save copies of some of the register information which can be munged by command-line switches so we can restore it during subsequent back-end reinitialization.
Referenced by restore_register_info(), and save_register_info().
|
static |
Referenced by restore_register_info(), and save_register_info().
|
static |
Referenced by restore_register_info(), and save_register_info().
|
static |
Passes for keeping and updating info about modes of registers inside subregisters.
Referenced by finish_subregs_of_mode(), init_subregs_of_mode(), record_subregs_of_mode(), and valid_mode_changes_for_regno().
|
static |
Referenced by finish_subregs_of_mode(), init_subregs_of_mode(), and record_subregs_of_mode().