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 "predict.h"
#include "memmodel.h"
#include "tm_p.h"
#include "insn-config.h"
#include "regs.h"
#include "ira.h"
#include "ira-int.h"
#include "sparseset.h"
#include "addresses.h"
Macros | |
#define | OBJECTS_CONFLICT_P(C1, C2) |
#define | REG_SUBREG_P(x) |
Functions | |
static void | record_object_conflict (ira_object_t obj1, ira_object_t obj2) |
static bool | build_conflict_bit_table (void) |
static bool | allocnos_conflict_for_copy_p (ira_allocno_t a1, ira_allocno_t a2) |
static rtx | go_through_subreg (rtx x, int *offset) |
static int | get_freq_for_shuffle_copy (int freq) |
static bool | process_regs_for_copy (rtx reg1, rtx reg2, bool constraint_p, rtx_insn *insn, int freq, bool single_input_op_has_cstr_p=true) |
static bool | can_use_same_reg_p (rtx_insn *insn, int output, int input) |
static void | process_reg_shuffles (rtx_insn *insn, rtx reg, int op_num, int freq, bool *bound_p) |
static void | add_insn_allocno_copies (rtx_insn *insn) |
static void | add_copies (ira_loop_tree_node_t loop_tree_node) |
static void | propagate_copies (void) |
static void | build_object_conflicts (ira_object_t obj) |
static void | build_conflicts (void) |
static void | print_hard_reg_set (FILE *file, const char *title, HARD_REG_SET set) |
static void | print_allocno_conflicts (FILE *file, bool reg_p, ira_allocno_t a) |
static void | print_conflicts (FILE *file, bool reg_p) |
void | ira_debug_conflicts (bool reg_p) |
void | ira_build_conflicts (void) |
Variables | |
static IRA_INT_TYPE ** | conflicts |
static ira_object_t * | collected_conflict_objects |
#define OBJECTS_CONFLICT_P | ( | C1, | |
C2 ) |
Macro to test a conflict of C1 and C2 in `conflicts'.
Referenced by allocnos_conflict_for_copy_p().
#define REG_SUBREG_P | ( | x | ) |
Check that X is REG or SUBREG of REG.
Referenced by add_insn_allocno_copies(), process_reg_shuffles(), and process_regs_for_copy().
|
static |
Add copies originated from BB given by LOOP_TREE_NODE.
References add_insn_allocno_copies(), ira_loop_tree_node::bb, FOR_BB_INSNS, NONDEBUG_INSN_P, and NULL.
Referenced by ira_build_conflicts().
|
static |
Process INSN and create allocno copies if necessary. For example, it might be because INSN is a pseudo-register move or INSN is two operand insn.
References BLOCK_FOR_INSN(), find_reg_note(), get_freq_for_shuffle_copy(), i, ira_get_dup_out_num(), ira_setup_alts(), recog_data_d::n_operands, NULL, NULL_RTX, recog_data_d::operand, process_reg_shuffles(), process_regs_for_copy(), recog_data, REG_FREQ_FROM_BB, REG_P, REG_SUBREG_P, SET_DEST, SET_SRC, side_effects_p(), single_set(), and SUBREG_REG.
Referenced by add_copies().
|
static |
Return true iff allocnos A1 and A2 cannot be allocated to the same register due to conflicts.
References ALLOCNO_OBJECT, and OBJECTS_CONFLICT_P.
Referenced by process_regs_for_copy(), and propagate_copies().
|
static |
Build allocno conflict table by processing allocno live ranges. Return true if the table was built. The table is not built if it is too big.
References ALLOCNO_CLASS, conflicts, EXECUTE_IF_SET_IN_SPARSESET, live_range::finish_next, fmt_size_t, FOR_EACH_ALLOCNO, FOR_EACH_ALLOCNO_OBJECT, gcc_assert, HOST_SIZE_T_PRINT_UNSIGNED, i, internal_flag_ira_verbose, ira_allocate(), ira_dump_file, ira_finish_point_ranges, IRA_INT_BITS, IRA_INT_TYPE, ira_max_point, ira_object_id_map, ira_objects_num, ira_reg_classes_intersect_p, ira_start_point_ranges, NULL, OBJECT_ALLOCNO, OBJECT_CONFLICT_ID, OBJECT_MAX, OBJECT_MIN, objects_live, r, record_object_conflict(), sparseset_alloc(), sparseset_clear_bit(), sparseset_free, sparseset_set_bit(), and live_range::start_next.
Referenced by ira_build_conflicts().
|
static |
Build conflict vectors or bit conflict vectors (whatever is more profitable) of all allocnos from the conflict table.
References a, ALLOCNO_CAP, ALLOCNO_NEXT_REGNO_ALLOCNO, ALLOCNO_NUM_OBJECTS, ALLOCNO_OBJECT, build_object_conflicts(), collected_conflict_objects, gcc_assert, i, ira_allocate(), ira_free(), ira_objects_num, ira_regno_allocno_map, max_reg_num(), and NULL.
Referenced by ira_build_conflicts().
|
static |
Build conflict vectors or bit conflict vectors (whatever is more profitable) for object OBJ from the conflict table.
References a, ALLOCNO_CLASS, ALLOCNO_NUM, ALLOCNO_NUM_OBJECTS, ALLOCNO_OBJECT, collected_conflict_objects, conflicts, FOR_EACH_BIT_IN_MINMAX_SET, i, ira_allocate_conflict_vec(), ira_assert, ira_conflict_vector_profitable_p(), IRA_INT_BITS, IRA_INT_TYPE, ira_object_id_map, ira_parent_or_cap_allocno(), ira_reg_classes_intersect_p, NULL, OBJECT_ALLOCNO, OBJECT_CONFLICT_ARRAY, OBJECT_CONFLICT_ARRAY_SIZE, OBJECT_CONFLICT_ID, OBJECT_CONFLICT_VEC, OBJECT_MAX, OBJECT_MIN, OBJECT_NUM_CONFLICTS, OBJECT_SUBWORD, and SET_MINMAX_SET_BIT.
Referenced by build_conflicts().
Return true if output operand OUTPUT and input operand INPUT of INSN can use the same register class for at least one alternative. INSN is already described in recog_data and recog_op_alt.
References get_preferred_alternatives(), ira_reg_class_intersect, recog_data_d::n_alternatives, recog_data_d::n_operands, recog_data, recog_op_alt, and TEST_BIT.
Referenced by process_reg_shuffles().
|
static |
Return the recomputed frequency for this shuffle copy or its similar case, since it's not for a real move insn, make it smaller.
Referenced by add_insn_allocno_copies(), and process_regs_for_copy().
Return X if X is a REG, otherwise it should be SUBREG of REG and the function returns the reg in this case. *OFFSET will be set to 0 in the first case or the regno offset in the first case.
References gcc_unreachable, GET_CODE, GET_MODE, ira_assert, offset, REG_P, REGMODE_NATURAL_SIZE, REGNO, SUBREG_BYTE, SUBREG_REG, and subreg_regno_offset().
Referenced by process_regs_for_copy().
void ira_build_conflicts | ( | void | ) |
Entry function which builds allocno conflicts and allocno copies and accumulate some allocno info on upper level regions.
References a, add_copies(), ADDR_SPACE_GENERIC, ALLOCNO_CALLS_CROSSED_NUM, ALLOCNO_CLASS, ALLOCNO_MODE, ALLOCNO_NUM_OBJECTS, ALLOCNO_OBJECT, ALLOCNO_REGNO, ALLOCNO_WMODE, base_reg_class(), build_conflict_bit_table(), build_conflicts(), CLEAR_HARD_REG_SET, conflicts, crtl, FOR_EACH_ALLOCNO, FOR_EACH_OBJECT, i, in_hard_reg_set_p(), internal_flag_ira_verbose, ira_class_hard_regs, ira_class_hard_regs_num, ira_conflicts_p, ira_dump_file, ira_free(), ira_loop_tree_root, ira_need_caller_save_regs(), IRA_REGION_ALL, IRA_REGION_MIXED, ira_traverse_loop_tree(), NULL, OBJECT_CONFLICT_ARRAY, OBJECT_CONFLICT_HARD_REGS, OBJECT_CONFLICT_ID, OBJECT_TOTAL_CONFLICT_HARD_REGS, paradoxical_subreg_p(), print_conflicts(), propagate_copies(), reg_class_contents, reg_is_parm_p(), REG_USERVAR_P, regno_reg_rtx, SET_HARD_REG_BIT, simplify_subreg_regno(), and targetm.
Referenced by ira_build().
void ira_debug_conflicts | ( | bool | reg_p | ) |
Print information about allocno or only regno (if REG_P) conflicts to stderr.
References print_conflicts().
|
static |
References a, ALLOCNO_CLASS, ALLOCNO_LOOP_TREE_NODE, ALLOCNO_NUM, ALLOCNO_NUM_OBJECTS, ALLOCNO_OBJECT, ALLOCNO_REGNO, FOR_EACH_OBJECT_CONFLICT, i, basic_block_def::index, NULL, OBJECT_ALLOCNO, OBJECT_CONFLICT_ARRAY, OBJECT_CONFLICT_HARD_REGS, OBJECT_SUBWORD, OBJECT_TOTAL_CONFLICT_HARD_REGS, print_hard_reg_set(), and reg_class_contents.
Referenced by print_conflicts().
|
static |
Print information about allocno or only regno (if REG_P) conflicts to FILE.
References a, FOR_EACH_ALLOCNO, and print_allocno_conflicts().
Referenced by ira_build_conflicts(), and ira_debug_conflicts().
|
static |
Print hard reg set SET with TITLE to FILE.
References end(), i, and TEST_HARD_REG_BIT.
Referenced by print_allocno_conflicts().
|
static |
Process all of the output registers of the current insn (INSN) which are not bound (BOUND_P) and the input register REG (its operand number OP_NUM) which dies in the insn as if there were a move insn between them with frequency FREQ.
References can_use_same_reg_p(), recog_data_d::constraints, gcc_assert, i, recog_data_d::n_operands, NULL, OP_OUT, recog_data_d::operand, recog_data_d::operand_type, process_regs_for_copy(), recog_data, and REG_SUBREG_P.
Referenced by add_insn_allocno_copies().
|
static |
Process registers REG1 and REG2 in move INSN with execution frequency FREQ. The function also processes the registers in a potential move insn (INSN == NULL in this case) with frequency FREQ. The function can modify hard register costs of the corresponding allocnos or create a copy involving the corresponding allocnos. The function does nothing if the both registers are hard registers. When nothing is changed, the function returns FALSE. SINGLE_INPUT_OP_HAS_CSTR_P is only meaningful when constraint_p is true, see function ira_get_dup_out_num for its meaning.
References a, ALLOCNO_CLASS, ALLOCNO_CLASS_COST, ALLOCNO_CONFLICT_HARD_REG_COSTS, ALLOCNO_HARD_REG_COSTS, ALLOCNO_MODE, allocnos_conflict_for_copy_p(), bitmap_set_bit, gcc_assert, get_freq_for_shuffle_copy(), GET_MODE_PRECISION(), go_through_subreg(), HARD_REGISTER_P, IN_RANGE, ira_add_allocno_copy(), ira_add_allocno_pref(), ira_allocate_and_set_costs(), ira_class_hard_reg_index, ira_curr_loop_tree_node, ira_curr_regno_allocno_map, ira_init_register_move_cost_if_necessary(), ira_parent_or_cap_allocno(), ira_reg_class_max_nregs, ira_register_move_cost, ira_loop_tree_node::local_copies, NULL, NULL_RTX, ira_allocno_copy::num, reg_class_size, REG_P, REG_SUBREG_P, and REGNO.
Referenced by add_insn_allocno_copies(), and process_reg_shuffles().
|
static |
Propagate copies the corresponding allocnos on upper loop tree level.
References ALLOCNO_LOOP_TREE_NODE, allocnos_conflict_for_copy_p(), ira_allocno_copy::constraint_p, ira_allocno_copy::first, FOR_EACH_COPY, ira_allocno_copy::freq, ira_allocno_copy::insn, ira_add_allocno_copy(), ira_assert, ira_loop_tree_root, ira_parent_or_cap_allocno(), ira_allocno_copy::loop_tree_node, NULL, and ira_allocno_copy::second.
Referenced by ira_build_conflicts().
|
static |
Record a conflict between objects OBJ1 and OBJ2. If necessary, canonicalize the conflict by recording it for lower-order subobjects of the corresponding allocnos.
References ALLOCNO_OBJECT, conflicts, OBJECT_ALLOCNO, OBJECT_CONFLICT_ID, OBJECT_MAX, OBJECT_MIN, OBJECT_SUBWORD, and SET_MINMAX_SET_BIT.
Referenced by build_conflict_bit_table().
|
static |
Array used to collect all conflict allocnos for given allocno.
Referenced by build_conflicts(), and build_object_conflicts().
|
static |
IRA conflict builder. Copyright (C) 2006-2024 Free Software Foundation, Inc. Contributed by Vladimir Makarov <vmakarov@redhat.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/>.
This file contains code responsible for allocno conflict creation, allocno copy creation and allocno info accumulation on upper level regions.
ira_allocnos_num array of arrays of bits, recording whether two allocno's conflict (can't go in the same hardware register). Some arrays will be used as conflict bit vector of the corresponding allocnos see function build_object_conflicts.
Referenced by build_conflict_bit_table(), build_object_conflicts(), initialize_conflict_count(), ira_build_conflicts(), ira_propagate_hard_reg_costs(), ira_total_conflict_hard_regs(), move_spill_restore(), oacc_do_neutering(), record_object_conflict(), and sort_coalesce_list().