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 "rtl-error.h"
#include "tree.h"
#include "predict.h"
#include "df.h"
#include "memmodel.h"
#include "tm_p.h"
#include "optabs.h"
#include "regs.h"
#include "ira.h"
#include "recog.h"
#include "expr.h"
#include "cfgrtl.h"
#include "cfgbuild.h"
#include "lra.h"
#include "lra-int.h"
#include "print-rtl.h"
#include "function-abi.h"
|
static |
This page contains code dealing with info about registers in insns.
Process X of INSN recursively and add info (operand type is given by TYPE) about registers in X to the insn DATA. If X can be early clobbered, alternatives in which it can be early clobbered are given by EARLY_CLOBBER_ALTS.
References add_regs_to_insn_regno_info(), ALL_ALTERNATIVES, lra_insn_reg::biggest_mode, bitmap_set_bit, lra_insn_reg::early_clobber_alts, expand_reg_info(), gcc_unreachable, GET_CODE, GET_MODE, GET_RTX_FORMAT, GET_RTX_LENGTH, i, INSN_UID(), lra_reg_info, new_insn_reg(), lra_insn_reg::next, NULL, OP_IN, OP_INOUT, OP_OUT, read_modify_subreg_p(), REG_P, REGNO, lra_insn_reg::regno, SET, SET_DEST, SET_SRC, lra_insn_reg::subreg_p, SUBREG_REG, lra_insn_reg::type, wider_subreg_mode(), XEXP, XVECEXP, and XVECLEN.
Referenced by add_regs_to_insn_regno_info(), and lra_update_insn_regno_info().
|
static |
Expand, if necessary, LRA data about insns.
References i, lra_insn_recog_data_len, and NULL.
Referenced by lra_set_insn_recog_data(), lra_set_used_insn_alternative_by_uid(), and lra_update_insn_recog_data().
|
static |
Function checks RTL for correctness. If FINAL_P is true, it is done at the end of LRA and the check is more rigorous.
References asm_noperands(), cfun, extract_constrain_insn(), fatal_insn_not_found, FOR_BB_INSNS, FOR_EACH_BB_FN, GET_CODE, lra_assert, NONDEBUG_INSN_P, PATTERN(), recog_memoized(), and reload_completed.
Referenced by lra().
|
static |
Recursively process X and collect info about registers, which are not the insn operands, in X with TYPE (in/out/inout) and flag that it is early clobbered in the insn (EARLY_CLOBBER) and add the info to LIST. X is a part of insn given by DATA. Return the result list.
References ALL_ALTERNATIVES, lra_insn_reg::biggest_mode, collect_non_operand_hard_regs(), lra_insn_reg::early_clobber_alts, end_hard_regno(), GET_CODE, GET_MODE, GET_RTX_FORMAT, GET_RTX_LENGTH, i, last, data::n_dups, data::n_operands, new_insn_reg(), lra_insn_reg::next, NULL, OP_IN, OP_INOUT, OP_OUT, data::operand, read_modify_subreg_p(), REG_P, REGNO, lra_insn_reg::regno, SET, SET_DEST, SET_SRC, lra_insn_reg::subreg_p, SUBREG_REG, lra_insn_reg::type, wider_subreg_mode(), XEXP, XVECEXP, and XVECLEN.
Referenced by collect_non_operand_hard_regs(), and lra_set_insn_recog_data().
Emit insn x = x + y. Return the insn. We use gen_add2_insn as the last resort.
References emit_add3_insn(), emit_insn(), gen_add2_insn(), NULL_RTX, and y.
Referenced by lra_emit_add().
Emit insn x = y + z. Return NULL if we failed to do it. Otherwise, return the insn. We don't use gen_add3_insn as it might clobber CC.
References delete_insns_since(), emit_insn(), gen_addptr3_insn(), get_last_insn(), GET_MODE, have_addptr3_insn(), last, lra_assert, NULL, NULL_RTX, recog_memoized(), and y.
Referenced by emit_add2_insn(), and lra_emit_add().
|
static |
Expand all regno related info needed for LRA.
References expand_reg_info(), i, ira_expand_reg_equiv(), lra_change_class(), max_reg_num(), and resize_reg_info().
Referenced by lra_create_new_reg_with_unique_value(), lra_emit_add(), and lra_emit_move().
|
static |
Expand common reg info if it is necessary.
References i, initialize_lra_reg_info_element(), lra_reg_info, max_reg_num(), and reg_info_size.
Referenced by add_regs_to_insn_regno_info(), expand_reg_data(), and lra().
|
static |
Called once per compiler work to finalize some LRA data related to insns.
References free(), i, insn_code_data, and NULL.
Referenced by lra_finish_once().
|
static |
Finish LRA data about all insns.
References finish_insn_regs(), free(), free_insn_recog_data(), i, lra_copy_pool, lra_insn_recog_data_len, lra_insn_recog_data_pool, lra_insn_reg_pool, and NULL.
Referenced by lra().
|
static |
Finish pool for insn reg info.
References lra_insn_reg_pool.
Referenced by finish_insn_recog_data().
|
static |
Finish common reg info and copies.
References bitmap_clear(), free(), i, lra_reg::insn_bitmap, lra_reg_info, and reg_info_size.
Referenced by lra().
|
static |
Finish LRA DATA about insn.
References free(), free_insn_regs(), lra_insn_recog_data_pool, NONDEBUG_INSN_P, and NULL.
Referenced by finish_insn_recog_data(), and invalidate_insn_recog_data().
|
static |
Free insn reg info list IR.
References lra_insn_reg_pool, lra_insn_reg::next, and NULL.
Referenced by free_insn_recog_data().
|
static |
Return execution frequency of INSN.
References BLOCK_FOR_INSN(), gcc_checking_assert, NULL, and REG_FREQ_FROM_BB.
Referenced by lra_invalidate_insn_regno_info(), lra_update_insn_recog_data(), and lra_update_insn_regno_info().
|
static |
Return info about insn give by UID. The info should be already set up.
References lra_assert, and NULL.
Referenced by lra_get_insn_regs().
|
static |
Return new register value.
References last_reg_value.
Referenced by initialize_lra_reg_info_element(), and lra_set_regno_unique_value().
Return new register of the same mode as ORIGINAL of class ALL_REGS. Used in ira_remove_scratches.
References GET_MODE, lra_create_new_reg(), and NULL.
Referenced by remove_insn_scratches().
|
static |
Return static insn data, allocate and setup if necessary. Although dup_num is static data (it depends only on icode), to set it up we need to extract insn first. So recog_data should be valid for normal insn (ICODE >= 0) before the call.
References insn_operand_data::constraint, operand_data::constraint, recog_data_d::dup_num, i, insn_code_data, insn_data, insn_operand_data::is_operator, lra_assert, insn_operand_data::mode, operand_data::mode, data::n_alternatives, data::n_dups, data::n_operands, NULL, OP_IN, OP_INOUT, OP_OUT, data::operand, insn_data_d::operand, recog_data, insn_operand_data::strict_low, and operand_data::strict_low.
Referenced by lra_set_insn_recog_data().
|
static |
Determine if the current function has an exception receiver block that reaches the exit block via non-exceptional edges
References cfun, EXIT_BLOCK_PTR_FOR_FN, basic_block_def::flags, FOR_EACH_BB_FN, FOR_EACH_EDGE, free(), n_basic_blocks_for_fn, basic_block_def::preds, and worklist.
Referenced by lra().
|
static |
Called once per compiler work to initialize some LRA data related to insns.
References insn_code_data.
Referenced by lra_init_once().
|
static |
|
static |
Initialize common reg info and copies.
References CLEAR_HARD_REG_SET, copy_vec, hard_regs_spilled_into, i, initialize_lra_reg_info_element(), last_reg_value, lra_reg_info, max_reg_num(), and reg_info_size.
Referenced by lra().
|
inlinestatic |
Initialize I-th element of lra_reg_info.
References lra_reg::biggest_mode, bitmap_initialize(), CLEAR_HARD_REG_SET, lra_reg::conflict_hard_regs, lra_reg::copies, lra_reg::exclude_start_hard_regs, lra_reg::freq, get_new_reg_value(), i, lra_reg::insn_bitmap, lra_reg::last_reload, lra_reg::live_ranges, lra_reg_info, lra_reg::nrefs, NULL, NULL_RTX, lra_reg::offset, lra_reg::preferred_hard_regno1, lra_reg::preferred_hard_regno2, lra_reg::preferred_hard_regno_profit1, lra_reg::preferred_hard_regno_profit2, reg_obstack, lra_reg::restore_rtx, and lra_reg::val.
Referenced by expand_reg_info(), and init_reg_info().
|
static |
Invalidate all reg info of INSN with DATA and execution frequency FREQ. Update common info about the invalidated registers.
References bitmap_clear_bit(), DEBUG_INSN_P, lra_reg::freq, i, INSN_UID(), lra_assert, lra_insn_reg_pool, lra_reg_info, lra_insn_reg::next, lra_reg::nrefs, NULL, and lra_insn_reg::regno.
Referenced by lra_invalidate_insn_regno_info(), lra_update_insn_recog_data(), and lra_update_insn_regno_info().
|
static |
Invalidate all info about insn given by its UID.
References free_insn_recog_data(), lra_assert, and NULL.
Referenced by lra_invalidate_insn_data(), and lra_update_insn_recog_data().
void lra | ( | FILE * | f, |
int | verbose ) |
Major LRA entry function. F is a file should be used to dump LRA debug info with given verbosity.
References assign_stack_local(), bitmap_clear(), bitmap_empty_p(), bitmap_initialize(), bitmap_ones(), cfun, check_rtl(), commit_edge_insertions(), crtl, DF_NO_INSN_RESCAN, df_set_flags(), df_set_regs_ever_live(), emit_note(), expand_reg_info(), find_many_sub_basic_blocks(), finish_insn_recog_data(), finish_reg_info(), fixed_regs, fixup_abnormal_edges(), gen_reg_rtx(), get_frame_size(), get_insns(), get_last_insn(), get_max_uid(), has_nonexceptional_receiver(), i, init_insn_recog_data(), init_reg_info(), INT_MAX, ira_no_alloc_regs, ira_restore_scratches(), last_basic_block_for_fn, LOCAL_REGNO, lra_asm_error_p, lra_assign(), lra_assignment_iter, lra_assignment_iter_after_spill, lra_bad_spill_regno_start, lra_clear_live_ranges(), lra_coalesce(), lra_coalesce_iter, lra_constraint_insn_stack, lra_constraint_insn_stack_bitmap, lra_constraint_iter, lra_constraint_new_regno_start, lra_constraints(), lra_constraints_finish(), lra_constraints_init(), lra_create_live_ranges(), lra_curr_reload_num, lra_dump_file, lra_eliminate(), lra_final_code_change(), lra_hard_reg_split_p, lra_in_progress, lra_inheritance(), lra_inheritance_iter, lra_inheritance_pseudos, lra_init_equiv(), lra_live_range_iter, lra_live_ranges_finish(), lra_live_ranges_init(), LRA_MAX_INHERITANCE_PASSES, LRA_MAX_REMATERIALIZATION_PASSES, lra_need_for_scratch_reg_p(), lra_need_for_spills_p(), lra_new_regno_start, lra_no_alloc_regs, lra_optional_reload_pseudos, lra_pmode_pseudo, lra_reg_spill_p, lra_remat(), lra_rematerialization_iter, lra_simple_p, lra_spill(), lra_split_hard_reg_for(), lra_split_regs, lra_subreg_reload_pseudos, lra_undo_inheritance(), lra_undo_inheritance_iter, lra_verbose, max_reg_num(), NULL, push_insns(), reg_obstack, regstat_free_n_sets_and_refs(), regstat_free_ri(), reload_completed, remove_scratches(), sbitmap_alloc(), sbitmap_free(), setup_reg_spill_flag(), timevar_pop(), timevar_push(), unshare_all_rtl_again(), update_inc_notes(), and verbose.
Referenced by do_reload().
void lra_asm_insn_error | ( | rtx_insn * | insn | ) |
Report asm insn error and modify the asm insn.
References const0_rtx, error_for_asm(), ira_nullify_asm_goto(), JUMP_P, lra_asm_error_p, lra_set_insn_deleted(), lra_update_insn_regno_info(), and PATTERN().
Referenced by curr_insn_transform(), and lra_split_hard_reg_for().
void lra_create_copy | ( | int | regno1, |
int | regno2, | ||
int | freq ) |
Create copy of two pseudos REGNO1 and REGNO2. The copy execution frequency is FREQ.
References lra_reg::copies, copy_vec, lra_copy::freq, lra_reg::freq, lra_assert, lra_copy_pool, lra_dump_file, lra_reg_info, NULL, lra_copy::regno1, lra_copy::regno1_dest_p, lra_copy::regno1_next, lra_copy::regno2, and lra_copy::regno2_next.
Referenced by process_bb_lives().
rtx lra_create_new_reg | ( | machine_mode | md_mode, |
rtx | original, | ||
enum reg_class | rclass, | ||
HARD_REG_SET * | exclude_start_hard_regs, | ||
const char * | title ) |
Analogous to the previous function but also inherits value of ORIGINAL.
References lra_assign_reg_val(), lra_create_new_reg_with_unique_value(), NULL_RTX, REG_P, and REGNO.
Referenced by base_plus_disp_to_reg(), base_to_reg(), curr_insn_transform(), get_reload_reg(), lra_autoinc_reload_context::get_reload_reg(), get_scratch_reg(), index_part_to_reg(), inherit_reload_reg(), match_reload(), process_address_1(), process_invariant_for_inheritance(), split_reg(), and update_scratch_ops().
rtx lra_create_new_reg_with_unique_value | ( | machine_mode | md_mode, |
rtx | original, | ||
enum reg_class | rclass, | ||
HARD_REG_SET * | exclude_start_hard_regs, | ||
const char * | title ) |
Create and return a new reg of ORIGINAL mode. If ORIGINAL is NULL or of VOIDmode, use MD_MODE for the new reg. Initialize its register class to RCLASS. Print message about assigning class RCLASS containing new register name TITLE unless it is NULL. Use attributes of ORIGINAL if it is a register. The created register will have unique held value.
References lra_reg::exclude_start_hard_regs, expand_reg_data(), gen_reg_rtx(), GET_MODE, lra_assert, lra_dump_file, lra_reg_info, max_reg_num(), NULL, NULL_RTX, ORIGINAL_REGNO, REG_ATTRS, reg_class_names, REG_P, REG_POINTER, REG_USERVAR_P, REGNO, and setup_reg_classes().
Referenced by check_and_process_move(), get_reload_reg(), lra_create_new_reg(), match_reload(), and process_addr_reg().
void lra_delete_dead_insn | ( | rtx_insn * | insn | ) |
Delete an unneeded INSN and any previous insns who sole purpose is loading data that is dead in INSN.
References find_regno_note(), GET_CODE, lra_delete_dead_insn(), lra_set_insn_deleted(), PATTERN(), prev_real_insn(), reg_mentioned_p(), REG_P, REGNO, SET, SET_DEST, SET_SRC, and side_effects_p().
Referenced by lra_delete_dead_insn().
void lra_dump_bitmap_with_title | ( | const char * | title, |
bitmap | set, | ||
int | index ) |
LRA (local register allocator) driver and LRA utilities. Copyright (C) 2010-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/>.
The Local Register Allocator (LRA) is a replacement of former reload pass. It is focused to simplify code solving the reload pass tasks, to make the code maintenance easier, and to implement new perspective optimizations. The major LRA design solutions are: o division small manageable, separated sub-tasks o reflection of all transformations and decisions in RTL as more as possible o insn constraints as a primary source of the info (minimizing number of target-depended macros/hooks) In brief LRA works by iterative insn process with the final goal is to satisfy all insn and address constraints: o New reload insns (in brief reloads) and reload pseudos might be generated; o Some pseudos might be spilled to assign hard registers to new reload pseudos; o Recalculating spilled pseudo values (rematerialization); o Changing spilled pseudos to stack memory or their equivalences; o Allocation stack memory changes the address displacement and new iteration is needed. Here is block diagram of LRA passes: ------------------------ --------------- | Undo inheritance for | --------------- | Memory-memory | | spilled pseudos, | | New (and old) | | move coalesce |<---| splits for pseudos got |<-- | pseudos | --------------- | the same hard regs, | | assignment | Start | | and optional reloads | --------------- | | ------------------------ ^ V | ---------------- | ----------- V | Update virtual | | | Remove |----> ------------>| register | | | scratches | ^ | displacements | | ----------- | ---------------- | | | | | V New | | ------------ pseudos ------------------- | |Constraints:| or insns | Inheritance/split | | | RTL |--------->| transformations | | | transfor- | | in EBB scope | | substi- | mations | ------------------- | tutions ------------ | | No change ---------------- V | Spilled pseudo | ------------------- | to memory |<----| Rematerialization | | substitution | ------------------- ---------------- | No susbtitions V ------------------------- | Hard regs substitution, | | devirtalization, and |------> Finish | restoring scratches got | | memory | ------------------------- To speed up the process: o We process only insns affected by changes on previous iterations; o We don't use DFA-infrastructure because it results in much slower compiler speed than a special IR described below does; o We use a special insn representation for quick access to insn info which is always *synchronized* with the current RTL; o Insn IR is minimized by memory. It is divided on three parts: o one specific for each insn in RTL (only operand locations); o one common for all insns in RTL with the same insn code (different operand attributes from machine descriptions); o one oriented for maintenance of live info (list of pseudos). o Pseudo data: o all insns where the pseudo is referenced; o live info (conflicting hard regs, live ranges, # of references etc); o data used for assigning (preferred hard regs, costs etc). This file contains LRA driver, LRA utility functions and data, and code for dealing with scratches.
Dump bitmap SET with TITLE and BB INDEX.
References bitmap_empty_p(), count, EXECUTE_IF_SET_IN_BITMAP, i, and lra_dump_file.
Referenced by dump_candidates_and_remat_bb_data(), and lra_create_live_ranges_1().
void lra_dump_insns | ( | FILE * | f | ) |
Dump all func insns in a slim form.
References dump_rtl_slim(), get_insns(), and NULL.
Referenced by lra_dump_insns_if_possible().
void lra_dump_insns_if_possible | ( | const char * | title | ) |
Dump all func insns in a slim form with TITLE when the dump file is open and lra_verbose >=7.
References lra_dump_file, lra_dump_insns(), lra_verbose, and NULL.
Referenced by lra_constraints(), lra_inheritance(), lra_remat(), lra_split_hard_reg_for(), and lra_undo_inheritance().
Target checks operands through operand predicates to recognize an insn. We should have a special precaution to generate add insns which are frequent results of elimination. Emit insns for x = y + z. X can be used to store intermediate values and should be not in Y and Z when we use X to store an intermediate value. Y + Z should form [base] [+ index[ * scale]] [ + disp] where base and index are registers, disp and scale are constants. Y should contain base if it is present, Z should contain disp if any. index[*scale] can be part of Y or Z.
References CONSTANT_P, delete_insns_since(), emit_add2_insn(), emit_add3_insn(), emit_move_insn(), expand_reg_data(), GET_CODE, get_last_insn(), GET_MODE, last, lra_assert, max_reg_num(), NULL, NULL_RTX, recog_memoized(), REG_P, XEXP, and y.
Referenced by base_plus_disp_to_reg(), and lra_emit_move().
Emit x := y, processing special case when y = u + v or y = u + v * scale + w through emit_add (Y can be an address which is base + index reg * scale + displacement in general case). X may be used as intermediate result therefore it should be not in Y.
References emit_insn(), emit_move_insn(), expand_reg_data(), GET_CODE, lra_reg::last_reload, lra_curr_reload_num, lra_emit_add(), lra_reg_info, max_reg_num(), NULL_RTX, ORIGINAL_REGNO, REG_P, remove_insn_scratches(), rtx_equal_p(), XEXP, and y.
Referenced by check_and_process_move(), curr_insn_transform(), inherit_reload_reg(), insert_move_for_subreg(), match_reload(), process_addr_reg(), process_address_1(), and process_invariant_for_inheritance().
void lra_finish_once | ( | void | ) |
Called once per compiler to finish LRA data which are initialize once.
References finish_insn_code_data_once().
Referenced by finalize().
void lra_free_copies | ( | void | ) |
Free all copies.
References lra_reg::copies, copy_vec, lra_copy_pool, lra_reg_info, NULL, lra_copy::regno1, and lra_copy::regno2.
Referenced by lra_create_live_ranges_1().
lra_copy_t lra_get_copy | ( | int | n | ) |
Return N-th (0, 1, ...) copy. If there is no copy, return NULL.
References copy_vec, and NULL.
Referenced by init_regno_assign_info().
struct lra_insn_reg * lra_get_insn_regs | ( | int | uid | ) |
Return reg info of insn given by it UID.
References get_insn_recog_data_by_uid().
Referenced by spill_for().
void lra_init_once | ( | void | ) |
Called once per compiler to initialize LRA data once.
References init_insn_code_data_once().
Referenced by ira_init_once().
unsigned int lra_insn_stack_length | ( | void | ) |
Return the current size of the insn stack.
References lra_constraint_insn_stack.
Referenced by lra_constraints().
void lra_invalidate_insn_data | ( | rtx_insn * | insn | ) |
Invalidate INSN related info used by LRA. The info should never be used after that.
References INSN_UID(), invalidate_insn_recog_data(), and lra_invalidate_insn_regno_info().
Referenced by curr_insn_transform(), lra_final_code_change(), lra_set_insn_deleted(), and spill_pseudos().
void lra_invalidate_insn_regno_info | ( | rtx_insn * | insn | ) |
Invalidate all reg info of INSN. Update common info about the invalidated registers.
References get_insn_freq(), invalidate_insn_data_regno_info(), and lra_get_insn_recog_data().
Referenced by lra_invalidate_insn_data().
rtx_insn * lra_pop_insn | ( | void | ) |
Take the last-inserted insns off the stack and return it.
References bitmap_clear_bit(), INSN_UID(), lra_constraint_insn_stack, and lra_constraint_insn_stack_bitmap.
Referenced by lra_constraints().
void lra_process_new_insns | ( | rtx_insn * | insn, |
rtx_insn * | before, | ||
rtx_insn * | after, | ||
const char * | title ) |
Emit insns BEFORE before INSN and insns AFTER after INSN. Put the insns onto the stack. Print about emitting the insns with TITLE.
References BB_END, BB_HEAD, BLOCK_FOR_INSN(), cfun, copy_insn(), copy_reg_eh_region_note_forward(), dump_insn_slim(), dump_rtl_slim(), EDGE_CRITICAL_P, eliminate_regs_in_insn(), emit_insn(), emit_insn_after(), emit_insn_after_noloc(), emit_insn_before(), emit_insn_before_noloc(), end_sequence(), EXIT_BLOCK_PTR_FOR_FN, find_reg_note(), FOR_EACH_EDGE, get_insns(), get_last_insn(), insn_could_throw_p(), JUMP_P, LABEL_P, last, lra_assert, lra_dump_file, lra_get_insn_recog_data(), lra_push_insn(), NEXT_INSN(), NOTE_INSN_BASIC_BLOCK_P, NULL, NULL_RTX, PATTERN(), PREV_INSN(), print_dec(), push_insns(), remove_note(), setup_sp_offset(), and start_sequence().
Referenced by check_and_process_move(), curr_insn_transform(), do_remat(), inherit_in_ebb(), inherit_reload_reg(), process_invariant_for_inheritance(), remove_inheritance_pseudos(), simplify_operand_subreg(), and split_reg().
void lra_push_insn | ( | rtx_insn * | insn | ) |
Put INSN on the stack.
References lra_push_insn_1().
Referenced by lra_process_new_insns(), lra_push_insn_by_uid(), process_insn_for_elimination(), push_insns(), spill_pseudos(), and spill_pseudos().
Put INSN on the stack. If ALWAYS_UPDATE is true, always update the reg info for INSN, otherwise only update it if INSN is not already on the stack.
References bitmap_bit_p, bitmap_set_bit, INSN_UID(), lra_constraint_insn_stack, lra_constraint_insn_stack_bitmap, lra_update_insn_regno_info(), sbitmap_resize(), and SBITMAP_SIZE.
Referenced by lra_push_insn(), and lra_push_insn_and_update_insn_regno_info().
void lra_push_insn_and_update_insn_regno_info | ( | rtx_insn * | insn | ) |
Put INSN on the stack and update its reg info.
References lra_push_insn_1().
Referenced by combine_reload_insn(), and remove_inheritance_pseudos().
void lra_push_insn_by_uid | ( | unsigned int | uid | ) |
Put insn with UID on the stack.
References lra_push_insn().
Referenced by lra_assign(), and lra_constraints().
hashval_t lra_rtx_hash | ( | rtx | x | ) |
Recursive hash function for RTL X.
References abort, GET_CODE, GET_RTX_FORMAT, GET_RTX_LENGTH, i, lra_rtx_hash(), REGNO, UINTVAL, XEXP, XINT, XSTR, XVECEXP, XVECLEN, and XWINT.
Referenced by invariant_hash(), and lra_rtx_hash().
void lra_set_insn_deleted | ( | rtx_insn * | insn | ) |
Mark INSN deleted and invalidate the insn related info used by LRA.
References lra_invalidate_insn_data(), and SET_INSN_DELETED.
Referenced by check_and_process_move(), curr_insn_transform(), delete_move_and_clobber(), do_remat(), lra_asm_insn_error(), lra_coalesce(), lra_constraints(), lra_delete_dead_insn(), process_bb_lives(), process_invariant_for_inheritance(), and update_ebb_live_info().
lra_insn_recog_data_t lra_set_insn_recog_data | ( | rtx_insn * | insn | ) |
Set up and return info about INSN. Set up the info if it is not set up yet.
References ALL_ALTERNATIVES, asm_noperands(), CALL_INSN_FUNCTION_USAGE, CALL_P, check_and_expand_insn_recog_data(), collect_non_operand_hard_regs(), lra_operand_data::constraint, constraints, DEBUG_BIND_INSN_P, debug_bind_static_data, DEBUG_INSN_P, DEBUG_MARKER_INSN_P, debug_marker_static_data, decode_asm_operands(), recog_data_d::dup_loc, gcc_assert, GET_CODE, get_preferred_alternatives(), get_static_insn_data(), lra_static_insn_data::hard_regs, i, INSN_CODE, insn_data, insn_extract(), INSN_UID(), INSN_VAR_LOCATION_LOC, lra_operand_data::is_address, lra_operand_data::is_operator, lra_assert, lra_insn_recog_data_pool, LRA_UNKNOWN_ALT, lra_operand_data::mode, n_alternatives(), lra_static_insn_data::n_dups, lra_static_insn_data::n_operands, n_operands, NULL, NULL_RTX, OP_IN, OP_INOUT, OP_OUT, lra_static_insn_data::operand, lra_static_insn_data::operand_alternative, recog_data_d::operand_loc, PATTERN(), preprocess_constraints(), preprocess_insn_constraints(), recog_data, recog_memoized(), REG_NREGS, REG_P, REGNO, SET, SET_DEST, setup_operand_alternative(), lra_operand_data::strict_low, lra_operand_data::type, operand::type, XEXP, XVECEXP, and XVECLEN.
Referenced by lra_get_insn_recog_data().
void lra_set_regno_unique_value | ( | int | regno | ) |
Set up for REGNO unique hold value.
References get_new_reg_value(), lra_reg_info, and lra_reg::val.
Referenced by curr_insn_transform(), and lra_coalesce().
void lra_set_used_insn_alternative | ( | rtx_insn * | insn, |
int | alt ) |
Set up that INSN is using alternative ALT now.
References lra_get_insn_recog_data().
Referenced by curr_insn_transform(), process_insn_for_elimination(), spill_pseudos(), and spill_pseudos().
void lra_set_used_insn_alternative_by_uid | ( | int | uid, |
int | alt ) |
Set up that insn with UID is using alternative ALT now. The insn info should be already set up.
References check_and_expand_insn_recog_data(), lra_assert, and NULL.
Referenced by lra_assign(), and remove_inheritance_pseudos().
Replace all references to register OLD_REGNO in *LOC with pseudo register NEW_REG. Try to simplify subreg of constant if SUBREG_P. DEBUG_P is if LOC is within a DEBUG_INSN. Return true if any change was made.
References const0_rtx, CONST_SCALAR_INT_P, CONSTANT_P, gen_rtx_SUBREG(), GET_CODE, GET_MODE, GET_RTX_FORMAT, GET_RTX_LENGTH, i, lra_substitute_pseudo(), NULL_RTX, offset, partial_subreg_p(), REG_P, REGNO, SCALAR_INT_MODE_P, simplify_subreg(), simplify_unary_operation(), SUBREG_BYTE, subreg_lowpart_offset(), lra_insn_reg::subreg_p, SUBREG_REG, subst(), XEXP, XVECEXP, XVECLEN, and y.
Referenced by inherit_reload_reg(), lra_substitute_pseudo(), lra_substitute_pseudo_within_insn(), and split_reg().
bool lra_substitute_pseudo_within_insn | ( | rtx_insn * | insn, |
int | old_regno, | ||
rtx | new_reg, | ||
bool | subreg_p ) |
Call lra_substitute_pseudo within an insn. Try to simplify subreg of constant if SUBREG_P. This won't update the insn ptr, just the contents of the insn.
References DEBUG_INSN_P, lra_substitute_pseudo(), and lra_insn_reg::subreg_p.
Referenced by inherit_reload_reg(), process_bb_lives(), remove_inheritance_pseudos(), and undo_optional_reloads().
void lra_update_dups | ( | lra_insn_recog_data_t | id, |
signed char * | nops ) |
Update insn operands which are duplication of operands whose numbers are in array of NOPS (with end marker -1). The insn is represented by its LRA internal representation ID.
References lra_static_insn_data::dup_num, i, and lra_static_insn_data::n_dups.
Referenced by combine_reload_insn(), and match_reload().
lra_insn_recog_data_t lra_update_insn_recog_data | ( | rtx_insn * | insn | ) |
Update all the insn info about INSN. It is usually called when something in the insn was changed. Return the updated info.
References asm_noperands(), check_and_expand_insn_recog_data(), check_bool_attrs(), lra_operand_data::constraint, constraints, DEBUG_INSN_P, decode_asm_operands(), recog_data_d::dup_loc, get_insn_freq(), i, INSN_CODE, insn_extract(), INSN_UID(), invalidate_insn_data_regno_info(), invalidate_insn_recog_data(), lra_operand_data::is_operator, lra_assert, lra_get_insn_recog_data(), LRA_UNKNOWN_ALT, lra_operand_data::mode, lra_static_insn_data::n_dups, data::n_operands, lra_static_insn_data::n_operands, NULL, OP_IN, OP_INOUT, OP_OUT, lra_static_insn_data::operand, recog_data_d::operand_loc, PATTERN(), recog_data, and lra_operand_data::type.
Referenced by eliminate_regs_in_insn(), process_insn_for_elimination(), and remove_pseudos().
void lra_update_insn_regno_info | ( | rtx_insn * | insn | ) |
Set up insn reg info of INSN. Update common reg info from reg info of INSN.
References add_regs_to_insn_regno_info(), CALL_INSN_FUNCTION_USAGE, CALL_P, lra_operand_data::early_clobber_alts, GET_CODE, get_insn_freq(), i, INSN_P, invalidate_insn_data_regno_info(), lra_get_insn_recog_data(), MEM_P, lra_static_insn_data::n_operands, NONDEBUG_INSN_P, NULL_RTX, OP_IN, OP_OUT, lra_static_insn_data::operand, PATTERN(), setup_insn_reg_info(), lra_operand_data::type, and XEXP.
Referenced by combine_reload_insn(), curr_insn_transform(), do_remat(), inherit_reload_reg(), lra_asm_insn_error(), lra_coalesce(), lra_constraints(), lra_push_insn_1(), process_bb_lives(), process_insn_for_elimination(), remove_inheritance_pseudos(), split_reg(), and undo_optional_reloads().
|
static |
Create LRA insn related info about a reference to REGNO in INSN with TYPE (in/out/inout), biggest reference mode MODE, flag that it is reference through subreg (SUBREG_P), and reference to the next insn reg info (NEXT). If REGNO can be early clobbered, alternatives in which it can be early clobbered are given by EARLY_CLOBBER_ALTS.
References lra_insn_reg::biggest_mode, lra_insn_reg::early_clobber_alts, lra_insn_reg_pool, lra_update_biggest_mode(), lra_insn_reg::next, NONDEBUG_INSN_P, lra_insn_reg::regno, lra_insn_reg::subreg_p, lra_insn_reg::type, and type().
Referenced by add_regs_to_insn_regno_info(), and collect_non_operand_hard_regs().
Push insns FROM to TO (excluding it) going in reverse order.
References INSN_P, lra_push_insn(), NULL_RTX, and PREV_INSN().
Referenced by lra(), and lra_process_new_insns().
|
static |
Remove all insn scratches in INSN.
References df_insn_rescan(), get_scratch_reg(), ira_remove_insn_scratches(), and lra_dump_file.
Referenced by lra_emit_move(), and remove_scratches().
|
static |
Remove all insn scratches in the current function.
References cfun, FOR_BB_INSNS, FOR_EACH_BB_FN, INSN_P, and remove_insn_scratches().
Referenced by lra().
|
static |
Update common reg info from reg info of insn given by its DATA and execution frequency FREQ.
References lra_reg::freq, i, lra_reg_info, lra_insn_reg::next, lra_reg::nrefs, NULL, and lra_insn_reg::regno.
Referenced by lra_update_insn_regno_info().
|
static |
Setup info about operands in alternatives of LRA DATA of insn.
References lra_static_insn_data::commutative, lra_operand_data::constraint, lra_operand_data::early_clobber_alts, operand_alternative::earlyclobber, i, lra_operand_data::is_address, operand_alternative::is_address, lra_assert, lra_static_insn_data::n_alternatives, lra_static_insn_data::n_operands, lra_static_insn_data::operand, and lra_static_insn_data::operand_alternative.
Referenced by lra_set_insn_recog_data().
|
static |
|
static |
Set up and return sp offset for insns in range [FROM, LAST]. The offset is taken from the BB insn before FROM after simulating its effects, or zero if there is no such insn.
References INSN_P, last, lra_get_insn_recog_data(), lra_update_sp_offset(), NEXT_INSN(), offset, PATTERN(), and prev_nonnote_nondebug_insn_bb().
Referenced by lra_process_new_insns().
|
static |
Remove all REG_DEAD and REG_UNUSED notes and regenerate REG_INC. We change pseudos by hard registers without notification of DF and that can make the notes obsolete. DF-infrastructure does not deal with REG_INC notes -- so we should regenerate them here.
References add_auto_inc_notes(), AUTO_INC_DEC, cfun, FOR_BB_INSNS, FOR_EACH_BB_FN, NONDEBUG_INSN_P, PATTERN(), REG_NOTE_KIND, REG_NOTES, and XEXP.
Referenced by lra().
|
static |
Vec referring to pseudo copies.
Referenced by init_reg_info(), lra_create_copy(), lra_free_copies(), and lra_get_copy().
|
static |
The following data are used as static insn data for all debug bind insns. If structure lra_static_insn_data is changed, the initializer should be changed too.
Referenced by lra_set_insn_recog_data().
|
static |
The following data are used as static insn data for all debug marker insns. If structure lra_static_insn_data is changed, the initializer should be changed too.
Referenced by lra_set_insn_recog_data().
|
static |
Debug insns are represented as a special insn with one input operand which is RTL expression in var_location.
The following data are used as static insn operand data for all debug insns. If structure lra_operand_data is changed, the initializer should be changed too.
HARD_REG_SET hard_regs_spilled_into |
struct lra_static_insn_data* insn_code_data[NUM_INSN_CODES] |
This page contains code dealing LRA insn info (or in other words LRA internal insn representation).
Map INSN_CODE -> the static insn data. This info is valid during all translation unit.
Referenced by finish_insn_code_data_once(), get_static_insn_data(), and init_insn_code_data_once().
|
static |
Last register value.
Referenced by get_new_reg_value(), and init_reg_info().
bool lra_asm_error_p |
True if we found an asm error.
Referenced by curr_insn_transform(), lra(), lra_asm_insn_error(), and lra_assign().
int lra_bad_spill_regno_start |
Avoid spilling pseudos with regno more than the following value if it is possible.
Referenced by lra(), and spill_for().
The stack itself.
Referenced by lra(), lra_insn_stack_length(), lra_pop_insn(), and lra_push_insn_1().
|
static |
This page contains code dealing with stack of the insns which should be processed by the next constraint pass.
Bitmap used to put an insn on the stack only in one exemplar.
Referenced by lra(), lra_pop_insn(), and lra_push_insn_1().
int lra_constraint_new_regno_start |
Start of reload pseudo regnos before the new spill pass.
Referenced by assign_by_spills(), create_cands(), create_live_range_start_chains(), find_all_spills_for(), find_hard_regno_for_1(), improve_inheritance(), inherit_in_ebb(), init_live_reload_and_inheritance_pseudos(), init_regno_assign_info(), lra(), lra_constraints(), lra_inheritance(), lra_setup_reload_pseudo_preferenced_hard_reg(), lra_split_hard_reg_for(), must_not_spill_p(), process_bb_lives(), process_copy_to_form_thread(), pseudo_prefix_title(), reload_pseudo_compare_func(), setup_live_pseudos_and_spill_after_risky_transforms(), and spill_for().
|
static |
Pools for copies.
Referenced by finish_insn_recog_data(), lra_create_copy(), and lra_free_copies().
int lra_curr_reload_num |
The number of emitted reload insns so far.
Referenced by lra(), lra_constraints(), and lra_emit_move().
FILE* lra_dump_file |
File used for output of LRA debug information.
Referenced by assign_by_spills(), assign_spill_hard_regs(), check_and_process_move(), combine_reload_insn(), compress_live_ranges(), curr_insn_transform(), dump_candidates_and_remat_bb_data(), equiv_address_substitution(), get_reload_reg(), improve_inheritance(), inherit_in_ebb(), inherit_reload_reg(), lra(), lra_assign(), lra_change_class(), lra_coalesce(), lra_constraints(), lra_create_copy(), lra_create_live_ranges(), lra_create_live_ranges_1(), lra_create_new_reg_with_unique_value(), lra_dump_bitmap_with_title(), lra_dump_insns_if_possible(), lra_eliminate(), lra_inheritance(), lra_process_new_insns(), lra_remat(), lra_setup_reg_renumber(), lra_setup_reload_pseudo_preferenced_hard_reg(), lra_spill(), lra_split_hard_reg_for(), lra_undo_inheritance(), lra_update_fp2sp_elimination(), print_curr_insn_alt(), process_addr_reg(), process_alt_operands(), process_bb_lives(), process_invariant_for_inheritance(), remove_inheritance_pseudos(), remove_insn_scratches(), remove_pseudos(), remove_some_program_points_and_update_live_ranges(), setup_live_pseudos_and_spill_after_risky_transforms(), spill_for(), spill_pseudos(), spill_pseudos(), split_reg(), undo_optional_reloads(), update_ebb_live_info(), and update_reg_eliminate().
bool lra_hard_reg_split_p |
True if we split hard reg after the last constraint sub-pass.
Referenced by lra(), and lra_assign().
Set to true while in LRA.
Referenced by change_address_1(), emit_move_insn_1(), gen_rtx_REG(), general_operand(), init_elim_table(), lra(), scratch_operand(), simplify_subreg_regno(), true_regnum(), and validate_subreg().
bitmap_head lra_inheritance_pseudos |
Inheritance pseudo regnos before the new spill pass.
Referenced by assign_by_spills(), find_all_spills_for(), improve_inheritance(), inherit_reload_reg(), lra(), lra_split_hard_reg_for(), lra_undo_inheritance(), must_not_spill_p(), process_invariant_for_inheritance(), pseudo_prefix_title(), remove_inheritance_pseudos(), and undo_optional_reloads().
lra_insn_recog_data_t* lra_insn_recog_data |
Map INSN_UID -> the insn recog data (NULL if unknown).
int lra_insn_recog_data_len |
The current length of the following array.
Referenced by check_and_expand_insn_recog_data(), finish_insn_recog_data(), init_insn_recog_data(), and lra_get_insn_recog_data().
|
static |
Alloc pool we allocate entries for lra_insn_recog_data from.
Referenced by finish_insn_recog_data(), free_insn_recog_data(), and lra_set_insn_recog_data().
object_allocator< lra_insn_reg > lra_insn_reg_pool("insn regs") | ( | "insn regs" | ) |
This page contains code dealing with info about registers in the insns.
Pools for insn reg info.
Referenced by finish_insn_recog_data(), finish_insn_regs(), free_insn_regs(), invalidate_insn_data_regno_info(), and new_insn_reg().
int lra_new_regno_start |
Start of pseudo regnos before the LRA.
Referenced by find_hard_regno_for(), lra(), and match_reload().
HARD_REG_SET lra_no_alloc_regs |
Hard registers currently not available for allocation. It can changed after some hard registers become not eliminable.
Referenced by assign_spill_hard_regs(), enough_allocatable_hard_regs_p(), find_hard_regno_for_1(), in_class_p(), inherit_in_ebb(), lra(), lra_eliminate_reg_if_possible(), need_for_split_p(), process_alt_operands(), setup_live_pseudos_and_spill_after_risky_transforms(), simplify_operand_subreg(), spill_hard_reg_in_range(), spill_pseudos(), and update_reg_eliminate().
bitmap_head lra_optional_reload_pseudos |
Reload pseudo regnos before the new assignment pass which still can be spilled after the assignment pass as memory is also accepted in insns for the reload pseudos.
Referenced by assign_by_spills(), combine_reload_insn(), curr_insn_transform(), find_all_spills_for(), lra(), lra_split_hard_reg_for(), must_not_spill_p(), pseudo_prefix_title(), and undo_optional_reloads().
rtx lra_pmode_pseudo |
A pseudo of Pmode.
Referenced by eliminate_regs_in_insn(), and lra().
class lra_reg* lra_reg_info |
Common info about each register.
Referenced by add_pseudo_to_slot(), add_regs_to_insn_regno_info(), assign_by_spills(), assign_hard_regno(), assign_mem_slot(), assign_spill_hard_regs(), assign_stack_slot_num_and_sort_pseudos(), assign_temporarily(), check_pseudos_live_through_calls(), create_live_range_start_chains(), curr_insn_transform(), expand_reg_info(), find_all_spills_for(), find_hard_regno_for_1(), find_reload_regno_insns(), finish_reg_info(), fix_bb_live_info(), improve_inheritance(), inherit_reload_reg(), init_live_reload_and_inheritance_pseudos(), init_reg_info(), init_regno_assign_info(), initialize_lra_reg_info_element(), insert_in_live_range_start_chain(), invalidate_insn_data_regno_info(), lra_assign(), lra_assign_reg_val(), lra_clear_live_ranges(), lra_coalesce(), lra_constraints(), lra_create_copy(), lra_create_live_ranges_1(), lra_create_new_reg_with_unique_value(), lra_eliminate(), lra_emit_move(), lra_final_code_change(), lra_free_copies(), lra_need_for_scratch_reg_p(), lra_need_for_spills_p(), lra_reg_val_equal_p(), lra_set_regno_unique_value(), lra_setup_reg_renumber(), lra_setup_reload_pseudo_preferenced_hard_reg(), lra_spill(), lra_split_hard_reg_for(), lra_undo_inheritance(), lra_update_biggest_mode(), lra_update_reg_val_offset(), make_hard_regno_dead(), mark_pseudo_dead(), merge_pseudos(), multi_block_pseudo_p(), need_for_split_p(), print_pseudo_live_ranges(), process_alt_operands(), process_bb_lives(), process_invariant_for_inheritance(), pseudo_compare_func(), pseudo_reg_slot_compare(), regno_freq_compare(), regno_val_use_in(), reload_pseudo_compare_func(), remove_inheritance_pseudos(), remove_pseudos(), remove_some_program_points_and_update_live_ranges(), setup_insn_reg_info(), setup_live_pseudos_and_spill_after_risky_transforms(), spill_for(), spill_hard_reg_in_range(), spill_pseudos(), spill_pseudos(), split_reg(), undo_optional_reloads(), update_hard_regno_preference(), update_lives(), update_pseudo_point(), and update_reg_eliminate().
bool lra_reg_spill_p |
True if we should try spill into registers of different classes instead of memory.
Referenced by assign_spill_hard_regs(), lra(), setup_reg_spill_flag(), and spill_pseudos().
bool lra_simple_p |
True if the current function is too big to use regular algorithms in LRA. In other words, we should use simpler and faster algorithms in LRA. It also means we should not worry about generation code for caller saves. The value is set up in IRA.
Referenced by assign_by_spills(), curr_insn_transform(), ira(), and lra().
bitmap_head lra_split_regs |
Split regnos before the new spill pass.
Referenced by assign_by_spills(), find_all_spills_for(), lra(), lra_split_hard_reg_for(), lra_undo_inheritance(), must_not_spill_p(), pseudo_prefix_title(), remove_inheritance_pseudos(), and split_reg().
bitmap_head lra_subreg_reload_pseudos |
Pseudo regnos used for subreg reloads before the new assignment pass. Such pseudos still can be spilled after the assignment pass.
Referenced by assign_by_spills(), lra(), lra_split_hard_reg_for(), must_not_spill_p(), pseudo_prefix_title(), and simplify_operand_subreg().
int lra_verbose |
How verbose should be the debug information.
Referenced by lra(), and lra_dump_insns_if_possible().
|
static |
This page contains code dealing with common register info and pseudo copies.
The size of the following array.
Referenced by expand_reg_info(), finish_reg_info(), and init_reg_info().