GCC Middle and Back End API Reference
|
Data Structures | |
struct | reg_use |
Variables | |
struct { | |
struct reg_use reg_use [RELOAD_COMBINE_MAX_USES] | |
rtx offset | |
int use_index | |
int store_ruid | |
int real_store_ruid | |
int use_ruid | |
bool all_offsets_match | |
} | reg_state [FIRST_PSEUDO_REGISTER] |
static int | reload_combine_ruid |
static int | last_label_ruid |
static int | last_jump_ruid |
static int | first_index_reg = -1 |
static int | last_index_reg |
static int | reg_set_luid [FIRST_PSEUDO_REGISTER] |
static HOST_WIDE_INT | reg_offset [FIRST_PSEUDO_REGISTER] |
static int | reg_base_reg [FIRST_PSEUDO_REGISTER] |
static rtx | reg_symbol_ref [FIRST_PSEUDO_REGISTER] |
static enum machine_mode | reg_mode [FIRST_PSEUDO_REGISTER] |
static int | move2add_luid |
static int | move2add_last_label_luid |
|
static |
After we've moved an add insn, fix up any debug insns that occur between the old location of the add and the new location. REG is the destination register of the add insn; REPLACEMENT is the SET_SRC of the add. FROM and TO specify the range in which we should make this change on debug insns.
References reg_use::insn, simplify_replace_rtx(), and validate_change().
Referenced by reload_combine_recognize_const_pattern(), and reload_combine_recognize_pattern().
|
static |
References reload_completed.
rtl_opt_pass* make_pass_postreload_cse | ( | ) |
Referenced by reload_cse_move2add().
|
static |
SET is a SET or CLOBBER that sets DST. DATA is the insn which contains SET. Update reg_set_luid, reg_offset and reg_base_reg accordingly. Called from reload_cse_move2add via note_stores.
References find_reg_equal_equiv_note(), HOST_WIDE_INT, invalidate(), move2add_last_label_luid, move2add_luid, move2add_record_mode(), move2add_record_sym_value(), move2add_valid_value_p(), offset, reg_base_reg, reg_mode, reg_offset, reg_set_luid, reg_symbol_ref, SET, subreg_regno(), and trunc_int_for_mode().
|
static |
Record that REG is being set to a value with the mode of REG.
References reg_mode, subreg_nregs(), and subreg_regno().
Referenced by move2add_note_store(), move2add_record_sym_value(), and reload_cse_move2add().
|
static |
Record that REG is being set to the sum of SYM and OFF.
References move2add_luid, move2add_record_mode(), reg_base_reg, reg_offset, reg_set_luid, and reg_symbol_ref.
Referenced by move2add_note_store(), move2add_use_add2_insn(), and move2add_use_add3_insn().
|
static |
This function is called with INSN that sets REG to (SYM + OFF), while REG is known to already have value (SYM + offset). This function tries to change INSN into an add instruction (set (REG) (plus (REG) (OFF - offset))) using the known value. It also updates the information about REG's known value. Return true if we made a change.
References changed, costs_lt_p(), gen_int_mode(), gen_lowpart_common(), get_full_set_rtx_cost(), have_add2_insn(), have_insn_for(), move2add_record_sym_value(), optimize_bb_for_speed_p(), reg_offset, and validate_change().
Referenced by reload_cse_move2add().
|
static |
This function is called with INSN that sets REG to (SYM + OFF), but REG doesn't have known value (SYM + offset). This function tries to find another register which is known to already have value (SYM + offset) and change INSN into an add instruction (set (REG) (plus (the found register) (OFF - offset))) if such a register is found. It also updates the information about REG's known value. Return true iff we made a change.
References changed, costs_lt_p(), gen_int_mode(), gen_rtx_REG(), get_full_set_rtx_cost(), init_costs_to_max(), init_costs_to_zero(), move2add_luid, move2add_record_sym_value(), move2add_valid_value_p(), optimize_bb_for_speed_p(), reg_base_reg, reg_offset, reg_set_luid, reg_symbol_ref, rtx_equal_p(), full_rtx_costs::speed, and validate_change().
Referenced by reload_cse_move2add().
|
static |
Check if REGNO contains a valid value in MODE.
References move2add_last_label_luid, reg_mode, reg_set_luid, subreg_lowpart_offset(), and subreg_regno_offset().
Referenced by move2add_note_store(), move2add_use_add3_insn(), and reload_cse_move2add().
|
static |
References compute_use_by_pseudos(), condjump_in_parallel_p(), condjump_p(), control_flow_insn_p(), df_get_live_in(), first_index_reg, free(), get_first_label_num(), get_last_insn(), reg_use::insn, last_index_reg, last_jump_ruid, last_label_ruid, live, max_label_num(), min_labelno, note_stores(), reg_state, reload_combine_note_store(), reload_combine_note_use(), reload_combine_recognize_const_pattern(), reload_combine_recognize_pattern(), reload_combine_ruid, use_index, and volatile_insn_p().
Referenced by reload_cse_regs().
|
staticread |
Find the use of REGNO with the ruid that is highest among those lower than RUID_LIMIT, and return it if it is the only use of this reg in the insn. Return NULL otherwise.
References last_label_ruid, reg_state, and reg_use::ruid.
Referenced by reload_combine_recognize_const_pattern().
Referenced by reload_combine().
|
static |
Check if DST is a register or a subreg of a register; if it is, update store_ruid, real_store_ruid and use_index in the reg_state structure accordingly. Called via note_stores from reload_combine.
References reg_state, reload_combine_ruid, SET, and subreg_regno_offset().
|
static |
XP points to a piece of rtl that has to be checked for any uses of registers. *XP is the pattern of INSN, or a part of it. Called from reload_combine, and recursively by itself.
References reg_use::containing_mem, reg_use::insn, offset, reg_state, reload_combine_note_use(), rtx_equal_p(), reg_use::ruid, SET, store_ruid, use_index, and use_ruid.
|
static |
Called when we are about to rescan a previously encountered insn with reload_combine_note_use after modifying some part of it. This clears all information about uses in that particular insn.
References reg_state.
Referenced by reload_combine_recognize_const_pattern().
|
static |
Called when we need to forget about all uses of REGNO after an insn which is identified by RUID.
References reg_state.
Referenced by reload_combine_recognize_const_pattern().
|
static |
Called by reload_combine when scanning INSN. This function tries to detect patterns where a constant is added to a register, and the result is used in an address. Return true if no further processing is needed on INSN; false if it wasn't recognized and should be handled normally.
References reg_use::containing_mem, delete_insn(), fixup_debug_insns(), reg_use::insn, last_jump_ruid, real_store_ruid, reg_state, reload_combine_closest_single_use(), reload_combine_note_use(), reload_combine_purge_insn_uses(), reload_combine_purge_reg_uses_after_ruid(), reload_combine_ruid, reload_combine_split_ruids(), reorder_insns(), rtx_equal_p(), reg_use::ruid, sets_cc0_p(), store_ruid, try_replace_in_use(), use_ruid, and reg_use::usep.
Referenced by reload_combine().
|
static |
Called by reload_combine when scanning INSN. Try to detect a pattern we can handle and improve. Return true if no further processing is needed on INSN; false if it wasn't recognized and should be handled normally.
References all_offsets_match, apply_change_group(), reg_use::containing_mem, delete_insn(), df_regs_ever_live_p(), first_index_reg, fixup_debug_insns(), gen_rtx_REG(), global_regs, reg_use::insn, last_index_reg, last_label_ruid, offset, prev_nonnote_nondebug_insn(), reg_state, reload_combine_note_use(), remove_reg_equal_equiv_notes(), rtx_equal_p(), reg_use::ruid, store_ruid, targetm, use_index, use_ruid, reg_use::usep, validate_change(), and validate_unshare_change().
Referenced by reload_combine().
|
inlinestatic |
Subroutine of reload_combine_split_ruids, called to fix up a single ruid pointed to by *PRUID if it is higher than SPLIT_RUID.
Referenced by reload_combine_split_ruids().
|
static |
Called when we insert a new insn in a position we've already passed in the scan. Examine all our state, increasing all ruids that are higher than SPLIT_RUID by one in order to make room for a new insn.
References last_jump_ruid, last_label_ruid, real_store_ruid, reg_state, reload_combine_ruid, reload_combine_split_one_ruid(), reg_use::ruid, store_ruid, and use_ruid.
Referenced by reload_combine_recognize_const_pattern().
|
static |
Referenced by reload_cse_regs().
|
static |
Convert move insns with constant inputs to additions if they are cheaper. Return true if any changes were made.
References any_condjump_p(), changed, costs_add_n_insns(), costs_lt_p(), dbg_cnt(), delete_insn(), fis_get_condition(), gen_int_mode(), get_full_set_rtx_cost(), get_full_set_src_cost(), have_add2_insn(), HOST_WIDE_INT, move2add_last_label_luid, move2add_luid, move2add_note_store(), move2add_record_mode(), move2add_use_add2_insn(), move2add_use_add3_insn(), move2add_valid_value_p(), next_nonnote_nondebug_insn(), note_stores(), optimize_bb_for_speed_p(), reg_base_reg, reg_mode, reg_offset, reg_set_luid, reg_set_p(), reg_symbol_ref, rtx_equal_p(), SET, full_rtx_costs::speed, trunc_int_for_mode(), and validate_change().
|
static |
@verbatim Perform simple optimizations to clean up the result of reload.
Copyright (C) 1987-2013 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/.
Referenced by reload_cse_simplify().
|
static |
See whether a single set SET is a noop.
References cselib_reg_set_mode(), and rtx_equal_for_cselib_p().
|
static |
Call cse / combine like post-reload optimization phases. FIRST is the first instruction.
References first, reload_combine(), reload_cse_move2add(), and reload_cse_regs_1().
Referenced by rest_of_handle_postreload().
|
static |
Do a very simple CSE pass over the hard registers. This function detects no-op moves where we happened to assign two different pseudo-registers to the same hard register, and then copied one to the other. Reload will generate a useless instruction copying a register to itself. This function also detects cases where we load a value from memory into two different registers, and (if memory is more expensive than registers) changes it to simply copy the first register into the second register. Another optimization is performed that scans the operands of each instruction to see whether the value is already available in a hard register. It then replaces the operand with the hard register if possible, much like an optional reload would.
References cfg_changed, cleanup_cfg(), cselib_finish(), cselib_init(), cselib_process_insn(), CSELIB_RECORD_MEMORY, end_alias_analysis(), gen_rtx_REG(), init_alias_analysis(), and reload_cse_simplify().
Referenced by reload_cse_regs().
Referenced by reload_cse_regs_1().
|
static |
Try to simplify INSN. Return true if the CFG may have changed.
References apply_change_group(), asm_noperands(), check_for_inc_dec(), count, cselib_invalidate_rtx(), delete_insn_and_edges(), reload_cse_noop_set_p(), reload_cse_simplify_operands(), reload_cse_simplify_set(), SET, and basic_block_def::succs.
Referenced by reload_cse_simplify(), and reload_cse_simplify_operands().
|
static |
Try to replace operands in INSN with equivalent values that are already in registers. This can be viewed as optional reloading. For each non-register operand in the insn, see if any hard regs are known to be equivalent to that operand. Record the alternatives which can accept these hard registers. Among all alternatives, select the ones which are better or equal to the one currently matching, where "better" is in terms of '?' and '!' constraints. Among the remaining alternatives, select the one which replaces most operands with hard registers.
References recog_data_d::alternative_enabled_p, apply_change_group(), constrain_operands(), recog_data_d::constraints, constraints, cselib_lookup(), recog_data_d::dup_loc, recog_data_d::dup_num, extract_insn(), gen_rtx_REG(), elt_loc_list::loc, cselib_val_struct::locs, memset(), recog_data_d::n_alternatives, recog_data_d::n_dups, recog_data_d::n_operands, elt_loc_list::next, recog_data_d::operand, recog_data_d::operand_loc, recog_data_d::operand_mode, optimize_bb_for_speed_p(), recog_data, reg_fits_class_p(), reload_cse_simplify_operands(), set_src_cost(), side_effects_p(), true_regnum(), validate_change(), which_alternative, and word_mode.
Referenced by reload_cse_simplify().
|
static |
Try to simplify a single SET instruction. SET is the set pattern. INSN is the instruction it came from. This function only handles one case: if we set a register to a value which is not a register, we try to find that value in some other register and change the set into a register copy.
References cselib_lookup(), gen_rtx_REG(), HOST_WIDE_INT, elt_loc_list::loc, cselib_val_struct::locs, memory_move_cost(), elt_loc_list::next, optimize_bb_for_speed_p(), references_value_p(), register_move_cost(), set_src_cost(), side_effects_p(), true_regnum(), trunc_int_for_mode(), validate_change(), validate_unshare_change(), and word_mode.
|
static |
|
static |
Subroutine of reload_combine_recognize_const_pattern. Try to replace REG with SRC in the insn described by USE, taking costs into account. Return true if we made the replacement.
References address_cost(), reg_use::containing_mem, reg_use::insn, memory_address_addr_space_p(), new_cost(), optimize_bb_for_speed_p(), rtx_equal_p(), set_src_cost(), simplify_replace_rtx(), and validate_change().
Referenced by reload_combine_recognize_const_pattern().
bool all_offsets_match |
Referenced by reload_combine_recognize_pattern().
|
static |
The register numbers of the first and last index register. A value of -1 in LAST_INDEX_REG indicates that we've previously computed these values and found no suitable index registers.
Referenced by reload_combine(), and reload_combine_recognize_pattern().
|
static |
Referenced by reload_combine(), and reload_combine_recognize_pattern().
|
static |
The RUID of the last jump we encountered in reload_combine.
Referenced by reload_combine(), reload_combine_recognize_const_pattern(), and reload_combine_split_ruids().
|
static |
The RUID of the last label we encountered in reload_combine.
Referenced by reload_combine(), reload_combine_closest_single_use(), reload_combine_recognize_pattern(), and reload_combine_split_ruids().
|
static |
move2add_last_label_luid is set whenever a label is found. Labels invalidate all previously collected reg_offset data.
Referenced by move2add_note_store(), move2add_valid_value_p(), and reload_cse_move2add().
|
static |
move2add_luid is linearly increased while scanning the instructions from first to last. It is used to set reg_set_luid in reload_cse_move2add and move2add_note_store.
Referenced by move2add_note_store(), move2add_record_sym_value(), move2add_use_add3_insn(), and reload_cse_move2add().
rtx offset |
Referenced by add_AT_offset(), add_AT_range_list(), add_condition(), add_data_member_location_attribute(), add_iv_value_candidates(), add_ranges_by_labels(), add_stored_regs(), add_value_source(), addr_side_effect_eval(), adjust_address_1(), agg_replacements_to_vector(), alloc_stack_frame_space(), alter_subreg(), ao_ref_init_from_vn_reference(), asan_emit_stack_protection(), assign_parm_find_stack_rtl(), assign_parm_setup_stack(), attrs_list_insert(), avoid_constant_pool_reference(), branch_prob(), build_linearized_memory_access(), build_ref_for_offset(), build_simple_mem_ref_loc(), c_strlen(), can_store_by_pieces(), check_mem_read_rtx(), compute_argument_addresses(), compute_complex_ancestor_jump_func(), compute_complex_assign_jump_func(), compute_frame_pointer_to_fb_displacement(), compute_known_type_jump_func(), const_binop(), constant_pointer_difference(), constrain_operands(), copy_plats_to_inter(), coverage_begin_function(), coverage_checksum_string(), create_access(), create_access_1(), create_block_symbol(), create_component_ref_by_pieces_1(), dbxout_expand_expr(), decode_addr_const(), decode_field_reference(), decompose(), delegitimize_mem_from_attrs(), detect_type_change_1(), df_add_refs_to_table(), df_reorganize_refs_by_insn(), df_reorganize_refs_by_insn_bb(), df_reorganize_refs_by_reg_by_insn(), df_reorganize_refs_by_reg_by_reg(), dw_sra_loc_expr(), dwarf2out_frame_debug_cfa_offset(), dwarf2out_frame_debug_expr(), eliminate_regs_in_insn(), emit_note_insn_var_location(), emit_push_insn(), emit_single_push_insn_1(), excess_unit_span(), expand_assignment(), expand_builtin_init_dwarf_reg_sizes(), expand_call(), expand_debug_expr(), expand_expr_addr_expr_1(), expand_expr_real_1(), expand_fix(), expand_float(), expand_one_stack_var(), expand_one_stack_var_at(), expand_stack_vars(), expand_used_vars(), extr_type_from_vtbl_ptr_store(), extract_split_bit_field(), find_hard_regno_for(), find_reloads(), find_reloads_subreg_address(), find_variable_location_part(), fold_const_aggregate_ref_1(), fold_indirect_ref_1(), fold_unary_loc(), fortran_common(), frame_offset_overflow(), double_int::from_buffer(), gcov_write_length(), gen_addr_rtx(), gen_group_rtx(), gen_lowpart_common(), gen_lowpart_for_combine(), gen_lowpart_general(), gen_lowpart_if_possible(), get_access_for_expr(), get_address_cost(), get_bitmap_index(), get_computation_cost_at(), get_elimination(), get_final_hard_regno(), get_hard_regno(), get_inner_reference(), get_mem_align_offset(), get_object_alignment_2(), get_reg_attrs(), get_section_anchor(), get_stridx(), gimple_extract_devirt_binfo_from_cst(), gimple_fold_indirect_ref(), gimple_fold_stmt_to_constant_1(), gimple_get_virt_method_for_binfo(), gimplify_compound_lval(), gt_ggc_m_S(), hash_loc_operands(), indirect_operand(), init_caller_save(), init_return_column_size(), initial_return_save(), inline_merge_summary(), instantiate_new_reg(), instantiate_virtual_regs_in_insn(), instantiate_virtual_regs_in_rtx(), instrument_derefs(), instrument_expr(), instrument_mem_region_access(), interpret_rhs_expr(), ipa_analyze_indirect_call_uses(), ipa_read_jump_function(), ipa_set_ancestor_jf(), ipa_set_jf_known_type(), ipcp_transform_function(), iv_elimination_compare_lt(), jump_function_from_stmt(), ldgetname(), ldtbread(), load_assign_lhs_subreplacements(), loc_descr_plus_const(), loc_list_for_address_of_addr_expr_of_indirect_ref(), loc_list_from_tree(), lra_eliminate_regs_1(), make_extraction(), mark_aliased_reaching_defs_necessary_1(), maybe_fold_tmr(), maybe_mode_change(), merge_agg_lats_step(), merge_object_sizes(), move2add_note_store(), move_deaths(), narrow_bit_field_mem(), native_encode_int(), native_encode_real(), native_encode_vector(), native_interpret_real(), normalize_offset(), optimize_bit_field_compare(), optimize_location_into_implicit_ptr(), optimize_one_addr_into_implicit_ptr(), output_call_frame_info(), output_fde(), output_index_string_offset(), output_indirect_strings(), output_loc_operands(), output_loc_operands_raw(), output_object_block(), pad_to_arg_alignment(), pdr_stride_in_loop(), place_block_symbol(), place_field(), probe_stack_range(), process_command(), process_single_reg_class_operands(), read_big_archive(), record_store(), reg_save(), reload_combine_note_use(), reload_combine_recognize_pattern(), remove_invalid_subreg_refs(), replace_reg_with_saved_mem(), restructure_reference(), rtl_for_decl_location(), rtx_addr_can_trap_p_1(), run_gcc(), sbitmap_vector_alloc(), sdbout_reg_parms(), set_label_offsets(), set_mem_offset(), set_reg_attrs_from_value(), set_slot_part(), setup_live_pseudos_and_spill_after_risky_transforms(), simplify_binary_operation_1(), simplify_subreg(), simplify_while_replacing(), slsr_process_ref(), sra_ipa_modify_expr(), stmt_kills_ref_p_1(), store_bit_field(), store_constructor(), store_split_bit_field(), string_constant(), subreg_get_info(), subreg_highpart_offset(), subreg_lowpart_offset(), track_loc_p(), tree_mem_ref_addr(), try_combine(), undefined_operand_subword_p(), use_anchored_address(), use_related_value(), var_lowpart(), var_mem_delete(), var_mem_delete_and_set(), var_mem_set(), var_reg_delete(), var_reg_delete_and_set(), var_reg_set(), vect_analyze_data_refs(), vect_compute_data_ref_alignment(), vect_create_cond_for_align_checks(), vect_gen_niters_for_prolog_loop(), vect_update_init_of_dr(), vectorizable_load(), vn_reference_lookup_3(), vt_add_function_parameter(), vt_initialize(), and vt_stack_adjustments().
int real_store_ruid |
Referenced by reload_combine_recognize_const_pattern(), and reload_combine_split_ruids().
|
static |
Referenced by move2add_note_store(), move2add_record_sym_value(), move2add_use_add3_insn(), and reload_cse_move2add().
|
static |
|
static |
If reg_base_reg[n] is negative, register n has been set to reg_offset[n] or reg_symbol_ref[n] + reg_offset[n] in mode reg_mode[n]. If reg_base_reg[n] is non-negative, register n has been set to the sum of reg_offset[n] and the value of register reg_base_reg[n] before reg_set_luid[n], calculated in mode reg_mode[n] . For multi-hard-register registers, all but the first one are recorded as BLKmode in reg_mode. Setting reg_mode to VOIDmode marks it as invalid.
Referenced by move2add_note_store(), move2add_record_sym_value(), move2add_use_add2_insn(), move2add_use_add3_insn(), reload_cse_move2add(), and var_lowpart().
|
static |
See if we can reduce the cost of a constant by replacing a move with an add. We track situations in which a register is set to a constant or to a register plus a constant.
We cannot do our optimization across labels. Invalidating all the information about register contents we have would be costly, so we use move2add_last_label_luid to note where the label is and then later disable any optimization that would cross it. reg_offset[n] / reg_base_reg[n] / reg_symbol_ref[n] / reg_mode[n] are only valid if reg_set_luid[n] is greater than move2add_last_label_luid. For a set that established a new (potential) base register with non-constant value, we use move2add_luid from the place where the setting insn is encountered; registers based off that base then get the same reg_set_luid. Constants all get move2add_last_label_luid + 1 as their reg_set_luid.
Referenced by move2add_note_store(), move2add_record_sym_value(), move2add_use_add3_insn(), move2add_valid_value_p(), and reload_cse_move2add().
struct { ... } reg_state[FIRST_PSEUDO_REGISTER] |
If the register is used in some unknown fashion, USE_INDEX is negative. If it is dead, USE_INDEX is RELOAD_COMBINE_MAX_USES, and STORE_RUID indicates where it is first set or clobbered. Otherwise, USE_INDEX is the index of the last encountered use of the register (which is first among these we have seen since we scan backwards). USE_RUID indicates the first encountered, i.e. last, of these uses. If ALL_OFFSETS_MATCH is true, all encountered uses were inside a PLUS with a constant offset; OFFSET contains this constant in that case. STORE_RUID is always meaningful if we only want to use a value in a register in a different place: it denotes the next insn in the insn stream (i.e. the last encountered) that sets or clobbers the register. REAL_STORE_RUID is similar, but clobbers are ignored when updating it.
Referenced by reload_combine(), reload_combine_closest_single_use(), reload_combine_note_store(), reload_combine_note_use(), reload_combine_purge_insn_uses(), reload_combine_purge_reg_uses_after_ruid(), reload_combine_recognize_const_pattern(), reload_combine_recognize_pattern(), and reload_combine_split_ruids().
|
static |
Referenced by move2add_note_store(), move2add_record_sym_value(), move2add_use_add3_insn(), and reload_cse_move2add().
|
static |
Reverse linear uid. This is increased in reload_combine while scanning the instructions from last to first. It is used to set last_label_ruid and the store_ruid / use_ruid fields in reg_state.
Referenced by reload_combine(), reload_combine_note_store(), reload_combine_recognize_const_pattern(), and reload_combine_split_ruids().
int store_ruid |
int use_index |
Referenced by reload_combine(), reload_combine_note_use(), and reload_combine_recognize_pattern().
int use_ruid |