GCC Middle and Back End API Reference
|
Data Structures | |
struct | elim_table |
struct | elim_table_1 |
Typedefs | |
typedef rtx * | rtx_p |
Stack of addresses where an rtx has been changed. We can undo the changes by popping items off the stack and restoring the original value at each location. We use this simplistic undo capability rather than copy_rtx as copy_rtx will not make a deep copy of a normally sharable rtx, such as (const (plus (symbol_ref) (const_int))). If such an expression appears as R1 in gen_reload_chain_without_interm_reg_p, then a shared rtx expression would be changed. See PR 42431.
|
static |
References add_auto_inc_notes(), add_reg_note(), and auto_inc_p().
|
static |
Find a spill register to use as a reload register for reload R. LAST_RELOAD is nonzero if this is the last reload for the insn being processed. Set rld[R].reg_rtx to the register allocated. We return 1 if successful, or 0 if we couldn't find a spill reg and we didn't change anything.
References count, free_for_value_p(), ira_bad_reload_regno(), last_spill_reg, reload::mode, n_spills, nr, reload::nregs, reload_reg_free_p(), reload_reg_used, reload_reg_used_at_all, reload_reg_used_for_inherit, rld, set_reload_reg(), spill_reg_order, and spill_regs.
Referenced by choose_reload_regs().
|
static |
Referenced by delete_output_reload(), eliminate_regs_1(), emit_input_reload_insns(), finish_spills(), and reload().
|
static |
Modify the home of pseudo-reg I. The new home is present in reg_renumber[I]. FROM_REG may be the hard reg that the pseudo-reg is being spilled from; or it may be -1, meaning there is none or it is not relevant. This is used so that all pseudos spilled from a given hard reg can share one stack slot.
References assign_stack_local(), ira_conflicts_p, ira_mark_new_stack_slot(), ira_reuse_stack_slot(), min_align(), mode_for_size(), reg_max_ref_width, REG_N_REFS(), reg_renumber, regno_reg_rtx, set_mem_attrs_for_spill(), something_was_spilled, spill_stack_slot, and spill_stack_slot_width.
void calculate_elim_costs_all_insns | ( | void | ) |
This function is called from the register allocator to set up estimates for the cost of eliminating pseudos which have REG_EQUIV equivalences to an invariant. The structure is similar to calculate_needs_all_insns.
References dump_file, eliminate_regs_1(), elimination_costs_in_insn(), free(), get_insns(), init_elim_table(), init_eliminable_invariants(), insn_chain::insn, ira_adjust_equiv_reg_cost(), max_regno, num_eliminable, num_eliminable_invariants, offsets_at, offsets_known_at, optimize_bb_for_speed_p(), reg_renumber, set_initial_elim_offsets(), set_initial_label_offsets(), set_label_offsets(), set_src_cost(), and update_eliminable_offsets().
Referenced by ira_costs().
|
static |
Referenced by reload().
|
static |
Walk the chain of insns, and determine for each whether it needs reloads and/or eliminations. Build the corresponding insns_need_reload list, and set something_needs_elimination as appropriate.
References copy_reloads(), delete_insn(), eliminate_regs_in_insn(), find_reloads(), insn_chain::insn, insns_need_reload, ira_conflicts_p, ira_mark_memory_move_deletion(), n_reloads, insn_chain::n_reloads, insn_chain::need_elim, insn_chain::need_operand_change, insn_chain::need_reload, insn_chain::next, insn_chain::next_need_reload, num_eliminable, num_eliminable_invariants, insn_chain::prev, reg_renumber, reload_insn_firstobj, reload_obstack, rtx_equal_p(), set_label_offsets(), something_needs_elimination, something_needs_operands_changed, spill_reg_order, unused_insn_chains, and update_eliminable_offsets().
|
static |
Referenced by check_eliminable_occurrences(), eliminate_regs_in_insn(), and elimination_costs_in_insn().
|
static |
Descend through rtx X and verify that no references to eliminable registers remain. If any do remain, mark the involved register as not eliminable.
References elim_table::can_eliminate, check_eliminable_occurrences(), and elim_table::from_rtx.
|
static |
Referenced by reload_as_needed().
|
static |
Assign hard reg targets for the pseudo-registers we must reload into hard regs for this insn. Also output the instructions to copy them in and out of the hard regs. For machines with register classes, we are responsible for finding a reload reg in the proper class.
References add_to_hard_reg_set(), allocate_reload_reg(), choose_reload_regs_init(), clear_reload_reg_in_use(), failed_reload(), find_equiv_reg(), free_for_value_p(), gen_rtx_REG(), get_secondary_mem(), i1, reload::in, insn_chain::insn, mark_reload_reg_in_use(), max_regno, memory_move_cost(), reload::mode, n_earlyclobbers, n_reloads, insn_chain::n_reloads, n_spills, nr, reload::nregs, reload::out, reload::rclass, reg_classes_intersect_p(), reg_is_output_reload, reg_last_reload_reg, reg_overlap_mentioned_for_reload_p(), reg_reloaded_contents, reg_reloaded_dead, reg_reloaded_insn, reg_reloaded_valid, reload::reg_rtx, reg_used_in_insn, register_move_cost(), reload::regno, regno_clobbered_p(), reload_earlyclobbers, RELOAD_FOR_INPADDR_ADDRESS, RELOAD_FOR_INPUT, RELOAD_FOR_INPUT_ADDRESS, RELOAD_FOR_INSN, RELOAD_FOR_OPADDR_ADDR, RELOAD_FOR_OPERAND_ADDRESS, RELOAD_FOR_OTHER_ADDRESS, RELOAD_FOR_OUTPUT, reload_inheritance_insn, reload_inherited, reload_order, RELOAD_OTHER, reload_override_in, reload_reg_class_lower(), reload_reg_unavailable, reload_reg_used_at_all, reload_reg_used_for_inherit, reload_spill_index, remove_address_replacements(), replaced_subreg(), rld, insn_chain::rld, RTX_AUTOINC, rtx_equal_p(), secondary_reload_class(), set_reload_reg(), spill_reg_order, spill_reg_store, spill_regs, subreg_regno(), subreg_regno_offset(), true_regnum(), and reload::when_needed.
|
static |
Referenced by choose_reload_regs().
|
static |
Initialize all the tables needed to allocate reload registers. CHAIN is the insn currently being processed; SAVE_RELOAD_REG_RTX is the array we use to restore the reg_rtx field for every reload.
References compute_use_by_pseudos(), insn_chain::dead_or_set, insn_chain::live_throughout, mark_reload_reg_in_use(), memset(), n_reloads, reg_used_in_insn, reload_inheritance_insn, reload_inherited, reload_n_operands, reload_override_in, reload_reg_unavailable, reload_reg_used, reload_reg_used_at_all, reload_reg_used_for_inherit, reload_reg_used_in_inpaddr_addr, reload_reg_used_in_input, reload_reg_used_in_input_addr, reload_reg_used_in_insn, reload_reg_used_in_op_addr, reload_reg_used_in_op_addr_reload, reload_reg_used_in_other_addr, reload_reg_used_in_outaddr_addr, reload_reg_used_in_output, reload_reg_used_in_output_addr, rld, and insn_chain::used_spill_regs.
|
static |
Similarly, but show REGNO is no longer in use for a reload.
References end_hard_regno(), n_reloads, RELOAD_FOR_INPADDR_ADDRESS, RELOAD_FOR_INPUT, RELOAD_FOR_INPUT_ADDRESS, RELOAD_FOR_INSN, RELOAD_FOR_OPADDR_ADDR, RELOAD_FOR_OPERAND_ADDRESS, RELOAD_FOR_OTHER_ADDRESS, RELOAD_FOR_OUTADDR_ADDRESS, RELOAD_FOR_OUTPUT, RELOAD_FOR_OUTPUT_ADDRESS, RELOAD_OTHER, reload_reg_used, reload_reg_used_in_inpaddr_addr, reload_reg_used_in_input, reload_reg_used_in_input_addr, reload_reg_used_in_insn, reload_reg_used_in_op_addr, reload_reg_used_in_op_addr_reload, reload_reg_used_in_other_addr, reload_reg_used_in_outaddr_addr, reload_reg_used_in_output, reload_reg_used_in_output_addr, rld, and true_regnum().
Referenced by choose_reload_regs(), and deallocate_reload_reg().
void compute_use_by_pseudos | ( | ) |
Small utility function to set all regs in hard reg set TO which are allocated to pseudos in regset FROM.
References add_to_hard_reg_set(), ira_conflicts_p, reg_renumber, and reload_completed.
|
static |
Referenced by emit_input_reload_insns().
|
static |
Determine whether the reload reg X overlaps any rtx'es used for overriding inheritance. Return nonzero if so.
References n_reloads, reg_overlap_mentioned_p(), and reload_override_in.
|
static |
Referenced by calculate_needs_all_insns().
|
static |
Copy the global variables n_reloads and rld into the corresponding elts of CHAIN.
References memcpy(), n_reloads, insn_chain::n_reloads, reload_insn_firstobj, reload_obstack, rld, and insn_chain::rld.
|
static |
Referenced by order_regs_for_reload().
|
static |
Update the spill cost arrays, considering that pseudo REG is live.
References hard_regno_to_pseudo_regno, ira_conflicts_p, reg_renumber, spill_add_cost, and spill_cost.
|
static |
Referenced by find_reg().
|
static |
We decided to spill hard register SPILLED, which has a size of SPILLED_NREGS. Determine how pseudo REG, which is live during the insn, is affected. We will add it to SPILLED_PSEUDOS if necessary, and we will update SPILL_COST/SPILL_ADD_COST.
References hard_regno_to_pseudo_regno, ira_conflicts_p, reg_renumber, spill_add_cost, and spill_cost.
void deallocate_reload_reg | ( | ) |
Deallocate the reload register for reload R. This is called from remove_address_replacements.
References clear_reload_reg_in_use(), reload::reg_rtx, reload_spill_index, rld, spill_reg_order, and true_regnum().
Referenced by delete_output_reload().
|
static |
We are going to delete DEAD_INSN. Recursively delete loads of reload registers used in DEAD_INSN that are not used till CURRENT_INSN. CURRENT_INSN is being reloaded, so we have to check its reloads too.
References delete_address_reloads_1(), delete_related_insns(), insn_chain::next, insn_chain::prev, and rtx_equal_p().
Referenced by delete_address_reloads(), and delete_address_reloads_1().
|
static |
Subfunction of delete_address_reloads: process registers found in X.
References delete_address_reloads_1(), delete_insn(), i2, n_reloads, insn_chain::prev, reg_referenced_p(), reg_reloaded_contents, reg_set_p(), reload_first_uid, reload_inherited, reload_override_in, rld, rtx_equal_p(), and spill_reg_order.
|
static |
Delete all insns that were inserted by emit_caller_save_insns during this iteration.
References delete_insn(), insn_chain::insn, insn_chain::is_caller_save_insn, insn_chain::next, insn_chain::prev, reload_insn_chain, and unused_insn_chains.
Referenced by reload().
|
static |
Referenced by eliminate_regs_in_insn(), and reload().
|
static |
Delete an unneeded INSN and any previous insns who sole purpose is loading data that is dead in INSN.
References find_regno_note(), need_dce, insn_chain::prev, prev_active_insn(), reg_mentioned_p(), SET, and side_effects_p().
Referenced by do_input_reload(), do_output_reload(), and emit_input_reload_insns().
|
static |
Delete a previously made output-reload whose result we now believe is not needed. First we double-check. INSN is the insn now being processed. LAST_RELOAD_REG is the hard register number for which we want to delete the last output reload. J is the reload-number that originally used REG. The caller has made certain that reload J doesn't use REG any longer for input. NEW_RELOAD_REG is reload register that reload J is using for REG.
References alter_reg(), count_occurrences(), delete_address_reloads(), delete_insn(), eliminate_regs(), find_regno_note(), i1, i2, reload::in, reload::in_reg, insn_chain::insn, ira_conflicts_p, ira_mark_allocation_change(), n_occurrences, n_reloads, refers_to_regno_p(), reg_mentioned_p(), REG_N_SETS(), reg_renumber, reload_inherited, reload_override_in, rld, rtx_equal_p(), spill_reg_store, and spill_reg_stored_to.
|
static |
Referenced by emit_reload_insns().
|
static |
Do input reloading for reload RL, which is for the insn described by CHAIN and has the number J.
References dead_or_set_p(), delete_output_reload(), emit_input_reload_insns(), reload::in, reload::in_reg, reload::inmode, insn_chain::insn, reload::out, reload::out_reg, reg_reloaded_contents, reg_reloaded_valid, reload::reg_rtx, regno_reg_rtx, reload_adjust_reg_for_mode(), reload_inherited, reload_override_in, reload_reg_rtx_for_input, reload_spill_index, rld, rtx_equal_p(), spill_reg_store, and spill_reg_stored_to.
|
static |
Referenced by emit_reload_insns().
|
static |
Do output reloading for reload RL, which is for the insn described by CHAIN and has the number J. ??? At some point we need to support handling output reloads of JUMP_INSNs or insns that set cc0.
References asm_noperands(), delete_output_reload(), emit_output_reload_insns(), error_for_asm(), find_reg_note(), gen_lowpart_common(), gen_rtx_REG(), reload::in_reg, insn_chain::insn, reload::out, reload::out_reg, reg_last_reload_reg, reg_reloaded_contents, reg_reloaded_valid, reload::reg_rtx, reload_adjust_reg_for_mode(), reload_reg_rtx_for_output, rld, rtx_equal_p(), spill_reg_store, spill_reg_stored_to, and word_mode.
rtx eliminate_regs | ( | ) |
References eliminate_regs_1().
|
static |
Scan X and replace any eliminable registers (such as fp) with a replacement (such as sp), plus an offset. MEM_MODE is the mode of an enclosing MEM. We need this to know how much to adjust a register for, e.g., PRE_DEC. Also, if we are inside a MEM, we are allowed to replace a sum of a register and the constant zero with the register, which we cannot do outside a MEM. In addition, we need to record the fact that a register is referenced outside a MEM. If INSN is an insn, it is the insn containing X. If we replace a REG in a SET_DEST with an equivalent MEM and INSN is nonzero, write a CLOBBER of the pseudo after INSN so find_equiv_regs will know that the REG is being modified. Alternatively, INSN may be a note (an EXPR_LIST or INSN_LIST). That's used when we eliminate in expressions stored in notes. This means, do not set ref_outside_mem even if the reference is outside of MEMs. If FOR_COSTS is true, we are being called before reload in order to estimate the costs of keeping registers with an equivalence unallocated. REG_EQUIV_MEM and REG_EQUIV_ADDRESS contain address that have had replacements done assuming all offsets are at their initial values. If they are not, or if REG_EQUIV_ADDRESS is nonzero for a pseudo we encounter, return the actual location so that find_reloads will do the proper thing.
References alloc_reg_note(), alter_reg(), elim_table::can_eliminate, copy_rtx(), current_function_decl, for_each_rtx(), form_sum(), elim_table::from_rtx, gen_rtvec_v(), gen_rtx_SUBREG(), note_reg_elim_costly(), paradoxical_subreg_p(), plus_constant(), elim_table::previous_offset, elim_table::ref_outside_mem, reg_renumber, replace_equiv_address_nv(), SET, and elim_table::to_rtx.
Referenced by calculate_elim_costs_all_insns(), eliminate_regs(), eliminate_regs_in_insn(), elimination_costs_in_insn(), note_reg_elim_costly(), and replace_pseudos_in().
|
static |
|
static |
Scan INSN and eliminate all eliminable registers in it. If REPLACE is nonzero, do the replacement destructively. Also delete the insn as dead it if it is setting an eliminable register. If REPLACE is zero, do all our allocations in reload_obstack. If no eliminations were done and this insn doesn't require any elimination processing (these are not identical conditions: it might be updating sp, but not referencing fp; this needs to be seen during reload_as_needed so that the offset between fp and sp can be taken into consideration), zero is returned. Otherwise, 1 is returned.
References apply_change_group(), asm_noperands(), elim_table::can_eliminate, check_eliminable_occurrences(), copy_insn(), copy_insn_1(), delete_dead_insn(), recog_data_d::dup_loc, recog_data_d::dup_num, eliminate_regs(), eliminate_regs_1(), elimination_effects(), emit_insn_after(), extract_insn(), elim_table::from, elim_table::from_rtx, gen_clobber(), HOST_WIDE_INT, insn_data, recog_data_d::n_dups, recog_data_d::n_operands, elim_table::offset, offset, OP_IN, recog_data_d::operand, recog_data_d::operand_loc, recog_data_d::operand_type, plus_constant(), prev_nonnote_insn(), elim_table::previous_offset, recog(), recog_data, recog_memoized(), elim_table::ref_outside_mem, rtx_equal_p(), SET, subreg_lowpart_p(), elim_table::to, elim_table::to_rtx, trunc_int_for_mode(), and validate_change().
|
static |
Referenced by calculate_elim_costs_all_insns().
|
static |
Like eliminate_regs_in_insn, but only estimate costs for the use of the register allocator. INSN is the instruction we need to examine, we perform eliminations in its operands and record cases where eliminating a reg with an invariant equivalence would add extra cost.
References asm_noperands(), elim_table::can_eliminate, check_eliminable_occurrences(), recog_data_d::dup_loc, recog_data_d::dup_num, eliminate_regs_1(), elimination_effects(), extract_insn(), elim_table::from_rtx, insn_data, recog_data_d::n_dups, recog_data_d::n_operands, note_reg_elim_costly(), elim_table::offset, OP_IN, recog_data_d::operand, recog_data_d::operand_loc, recog_data_d::operand_type, elim_table::previous_offset, recog_data, recog_memoized(), and elim_table::ref_outside_mem.
|
static |
Referenced by eliminate_regs_in_insn(), elimination_costs_in_insn(), and elimination_effects().
|
static |
Scan rtx X for modifications of elimination target registers. Update the table of eliminables to reflect the changed state. MEM_MODE is the mode of an enclosing MEM rtx, or VOIDmode if not within a MEM.
References elim_table::can_eliminate, elimination_effects(), elim_table::from_rtx, function_invariant_p(), elim_table::offset, elim_table::ref_outside_mem, reg_renumber, SET, and elim_table::to_rtx.
bool elimination_target_reg_p | ( | ) |
Return true if X is used as the target register of an elimination.
References elim_table::can_eliminate, and elim_table::to_rtx.
|
static |
Generate insns to perform reload RL, which is for the insn in CHAIN and has the number J. OLD contains the value to be used as input.
References alter_reg(), asm_noperands(), function::can_throw_non_call_exceptions, cfun, conflicts_with_override(), constrain_operands(), copy_reg_eh_region_note_forward(), count_occurrences(), dead_or_set_p(), delete_output_reload(), emit_insn(), end_sequence(), extract_insn(), free_for_value_p(), gen_lowpart_SUBREG(), gen_reload(), get_insns(), secondary_reload_info::icode, reload::in, reload::in_reg, reload::inc, inc_for_reload(), inpaddr_address_reload_insns, input_address_reload_insns, input_reload_insns, insn_chain::insn, ira_conflicts_p, ira_mark_allocation_change(), reload::mode, num_not_at_initial_offset, operand_reload_insns, reload::opnum, other_input_address_reload_insns, other_input_reload_insns, other_operand_reload_insns, reload::out, reload::out_reg, outaddr_address_reload_insns, output_address_reload_insns, secondary_reload_info::prev_sri, push_to_sequence(), reload::rclass, REG_N_SETS(), reg_renumber, reload::reg_rtx, reload_adjust_reg_for_icode(), reload_adjust_reg_for_temp(), RELOAD_FOR_INPADDR_ADDRESS, RELOAD_FOR_INPUT, RELOAD_FOR_INPUT_ADDRESS, RELOAD_FOR_OPADDR_ADDR, RELOAD_FOR_OPERAND_ADDRESS, RELOAD_FOR_OTHER_ADDRESS, RELOAD_FOR_OUTADDR_ADDRESS, RELOAD_FOR_OUTPUT_ADDRESS, reload_inherited, RELOAD_OTHER, reload_override_in, reload_reg_rtx_for_input, replace_rtx(), rld, rtx_equal_p(), reload::secondary_in_icode, reload::secondary_in_reload, SET, spill_reg_store, spill_reg_stored_to, targetm, and reload::when_needed.
Referenced by do_input_reload().
Referenced by gen_reload().
|
static |
Go through the motions to emit INSN and test if it is strictly valid. Return the emitted insn if valid, else return NULL.
References constrain_operands(), delete_insns_since(), emit_insn(), extract_insn(), get_last_insn(), insn_chain::insn, last, and recog_memoized().
|
static |
Generate insns to for the output reload RL, which is for the insn described by CHAIN and has the number J.
References function::can_throw_non_call_exceptions, cfun, copy_reg_eh_region_note_forward(), emit_insn(), end_sequence(), find_regno_note(), forget_old_reloads_1(), gen_reload(), get_insns(), insn_chain::insn, reload::mode, new_spill_reg_store, insn_chain::next, note_stores(), reload::opnum, other_output_reload_insns, reload::out, reload::out_reg, output_reload_insns, push_to_sequence(), reload::rclass, reg_is_output_reload, reg_mentioned_p(), reg_reloaded_died, reload::reg_rtx, regno_clobbered_p(), reload_adjust_reg_for_mode(), RELOAD_OTHER, reload_reg_rtx_for_output, reload_reg_rtx_reaches_end_p(), reload_spill_index, rld, rtx_equal_p(), reload::secondary_out_icode, reload::secondary_out_reload, secondary_reload_class(), start_sequence(), strip_paradoxical_subreg(), and reload::when_needed.
Referenced by do_output_reload().
|
static |
Referenced by reload_as_needed().
|
static |
Output insns to reload values in and out of the chosen reload regs.
AUTO_INC
References debug_reload_to_stream(), do_input_reload(), do_output_reload(), dump_file, emit_insn_after(), emit_insn_before(), find_regno_note(), forget_old_reloads_1(), reload::in, reload::in_reg, inherit_piecemeal_p(), inpaddr_address_reload_insns, input_address_reload_insns, input_reload_insns, insn_chain::insn, n_reloads, new_spill_reg_store, nr, operand_reload_insns, other_input_address_reload_insns, other_input_reload_insns, other_operand_reload_insns, other_output_reload_insns, reload::out, reload::out_reg, outaddr_address_reload_insns, output_address_reload_insns, output_reload_insns, reg_is_output_reload, reg_last_reload_reg, reg_reloaded_call_part_clobbered, reg_reloaded_contents, reg_reloaded_dead, reg_reloaded_died, reg_reloaded_insn, reg_reloaded_valid, reg_set_p(), regno_reg_rtx, reload_inherited, reload_n_operands, reload_order, reload_override_in, reload_reg_reaches_end_p(), reload_reg_rtx_for_input, reload_reg_rtx_for_output, reload_reg_rtx_reaches_end_p(), reload_spill_index, rld, spill_reg_store, and spill_reg_stored_to.
|
static |
Referenced by choose_reload_regs().
|
static |
Give an error message saying we failed to find a reload for INSN, and clear out reload R.
References asm_noperands(), error_for_asm(), reload::in, reload::optional, reload::out, reload::reg_rtx, rld, and reload::secondary_p.
|
static |
Referenced by find_reload_regs().
|
static |
Find reload register to use for reload number ORDER.
References bad_spill_regs, bad_spill_regs_global, count_spilled_pseudo(), insn_chain::dead_or_set, dump_file, hard_regno_to_pseudo_regno, reload::in, insn_chain::insn, ira_better_spill_reload_regno_p(), ira_conflicts_p, insn_chain::live_throughout, reload::mode, reload::nregs, order, reload::out, reload::rclass, reload::regno, reload_order, reloads_conflict(), rld, spill_add_cost, spill_cost, and used_spill_regs_local.
|
static |
Referenced by select_reload_regs().
|
static |
Find more reload regs to satisfy the remaining need of an insn, which is given by CHAIN. Do it by ascending class number, since otherwise a reg might be spilled for a big class and might fail to count for a smaller class even though it belongs to that class.
References dump_file, failure, find_reg(), reload::in, insn_chain::insn, memcpy(), n_reloads, insn_chain::n_reloads, reload::nregs, reload::optional, order_regs_for_reload(), reload::out, reload::rclass, reload::reg_rtx, reload::regno, reload_order, reload_reg_class_lower(), rld, insn_chain::rld, reload::secondary_p, spill_failure(), used_spill_regs, insn_chain::used_spill_regs, and used_spill_regs_local.
|
static |
Referenced by reload().
|
static |
After find_reload_regs has been run for all insn that need reloads, and/or spill_hard_regs was called, this function is used to actually spill pseudo registers and try to reallocate them. It also sets up the spill_regs array for use by choose_reload_regs.
References alter_reg(), bad_spill_regs_global, compute_use_by_pseudos(), insn_chain::dead_or_set, df_regs_ever_live_p(), df_set_regs_ever_live(), dump_file, ira_conflicts_p, ira_mark_allocation_change(), ira_reassign_pseudos(), insn_chain::live_throughout, max_regno, memset(), n_spills, insn_chain::need_reload, insn_chain::next, insn_chain::next_need_reload, num_eliminable, pseudo_forbidden_regs, pseudo_previous_regs, reg_old_renumber, reg_renumber, spill_reg_order, spill_regs, temp_pseudo_reg_arr, used_spill_regs, and insn_chain::used_spill_regs.
|
static |
A subroutine of reload_as_needed. If INSN has a REG_EH_REGION note, examine all of the reload insns between PREV and NEXT exclusive, and annotate all that may trap.
References copy_reg_eh_region_note_forward(), find_reg_note(), insn_could_throw_p(), and remove_note().
Referenced by reload_as_needed().
|
static |
Referenced by reload_as_needed().
|
static |
Forget the reloads marked in regset by previous function.
References n_reloads, reg_is_output_reload, reg_last_reload_reg, reg_reloaded_valid, and spill_reg_store.
Discard all record of any value reloaded from X, or reloaded in X from someplace else; unless X is an output reload reg of the current insn. X may be a hard reg (the reload reg) or it may be a pseudo reg that was reloaded from. When DATA is non-NULL just mark the registers in regset to be forgotten later.
References n_reloads, nr, reg_is_output_reload, reg_last_reload_reg, reg_reloaded_valid, and spill_reg_store.
Referenced by emit_output_reload_insns(), emit_reload_insns(), and reload_as_needed().
|
static |
Return 1 if the value in reload reg REGNO, as used by a reload needed for the part of the insn specified by OPNUM and TYPE, may be used to load VALUE into it. MODE is the mode in which the register is used, this is needed to determine how many hard regs to test. Other read-only reloads with the same value do not conflict unless OUT is nonzero and these other reloads have to live while output reloads live. If OUT is CONST0_RTX, this is a special case: it means that the test should not be for using register REGNO as reload register, but for copying from register REGNO into the reload register. RELOADNUM is the number of the reload we want to load this value for; a reload does not conflict with itself. When IGNORE_ADDRESS_RELOADS is set, we can not have conflicts with reloads that load an address for the very reload we are considering. The caller has to make sure that there is no conflict with the return register.
References reload_reg_free_for_value_p().
Referenced by allocate_reload_reg(), choose_reload_regs(), and emit_input_reload_insns().
|
static |
Indicate that we no longer have known memory locations or constants. Free all data involved in tracking these.
References free(), free_EXPR_LIST_list(), offsets_at, offsets_known_at, and vec_free().
Referenced by reload().
int function_invariant_p | ( | ) |
Return nonzero if the rtx X is invariant over the current function.
??? Actually, the places where we use this expect exactly what is tested here, and not everything that is function invariant. In particular, the frame pointer and arg pointer are special cased; pic_offset_table_rtx is not, and we must not spill these things to memory.
Referenced by dead_or_predicable(), elimination_effects(), init_eliminable_invariants(), iv_analyze_op(), replace_single_def_regs(), setup_reg_equiv(), and simple_rhs_p().
Referenced by emit_input_reload_insns(), emit_output_reload_insns(), and gen_reload().
|
static |
Emit code to perform a reload from IN (which may be a reload register) to OUT (which may also be a reload register). IN or OUT is from operand OPNUM with reload type TYPE. Returns first insn emitted.
References emit_insn(), emit_insn_if_valid_for_reload(), find_replacement(), gen_add2_insn(), gen_move_insn(), gen_reload(), gen_rtx_REG(), get_insns(), get_last_insn(), get_secondary_mem(), insn_chain::insn, insn_operand_matches(), last, mark_jump_label(), optab_handler(), reg_or_subregno(), reg_overlap_mentioned_p(), replaced_subreg(), rtx_equal_p(), set_dst_reg_note(), set_unique_reg_note(), and strip_paradoxical_subreg().
|
static |
Referenced by reloads_conflict().
|
static |
The function returns TRUE if chain of reload R1 and R2 (in any order) can be evaluated without usage of intermediate register for the reload containing another reload. It is important to see gen_reload to understand what the function is trying to do. As an example, let us have reload chain r2: const r1: <something> + const and reload R2 got reload reg HR. The function returns true if there is a correct insn HR = HR + <something>. Otherwise, gen_reload will use intermediate register (and this is the reload reg for R1) to reload <something>. We need this function to find a conflict for chain reloads. In our example, if HR = HR + <something> is incorrect insn, then we cannot use HR as a reload register for R2. If we do use it then we get a wrong code: HR = const HR = <something> HR = HR + HR
References constrain_operands(), delete_insns_since(), emit_insn(), extract_insn(), gen_rtx_REG(), get_last_insn(), reload::in, insn_chain::insn, last, recog_memoized(), reg_mentioned_p(), reload::regno, rld, strip_paradoxical_subreg(), and substitute().
void grow_reg_equivs | ( | void | ) |
Grow (or allocate) the REG_EQUIVS array from its current size (which may be zero elements) to MAX_REG_NUM elements. Initialize all new fields to NULL and update REG_EQUIVS_SIZE.
References max_reg_num(), max_regno, memset(), vec_safe_length(), and vec_safe_reserve().
Referenced by emit_move_list(), fix_reg_equiv_init(), init_eliminable_invariants(), ira(), reload(), and update_equiv_regs().
|
static |
Determine if the current function has an exception receiver block that reaches the exit block via non-exceptional edges
References bb_has_abnormal_pred(), edge_def::flags, basic_block_def::flags, free(), basic_block_def::preds, edge_def::src, and worklist.
Referenced by reload().
Referenced by emit_input_reload_insns().
|
static |
Output reload-insns to reload VALUE into RELOADREG. VALUE is an autoincrement or autodecrement RTX whose operand is a register or memory location; so reloading involves incrementing that location. IN is either identical to VALUE, or some cheaper place to reload from. INC_AMOUNT is the number to increment or decrement by (always positive). This cannot be deduced from VALUE.
References add_insn(), constrain_operands(), delete_insns_since(), emit_insn(), extract_insn(), find_replacement(), gen_add2_insn(), gen_move_insn(), gen_sub2_insn(), get_last_insn(), last, recog_memoized(), and reg_last_reload_reg.
|
static |
A reload copies values of MODE from register SRC to register DEST. Return true if it can be treated for inheritance purposes like a group of reloads, each one reloading a single hard register. The caller has already checked that (reg:MODE SRC) and (reg:MODE DEST) occupy the same number of hard registers.
Referenced by emit_reload_insns().
|
static |
Initialize the table of registers to eliminate. Pre-condition: global flag frame_pointer_needed has been set before calling this function.
References elim_table::can_eliminate, elim_table::can_eliminate_previous, elim_table::from, elim_table_1::from, elim_table::from_rtx, gen_rtx_REG(), num_eliminable, reg_eliminate_1, targetm, elim_table::to, elim_table_1::to, and elim_table::to_rtx.
Referenced by calculate_elim_costs_all_insns(), and reload().
|
static |
Referenced by calculate_elim_costs_all_insns(), and reload().
|
static |
Find all the pseudo registers that didn't get hard regs but do have known equivalent constants or memory slots. These include parameters (known equivalent to parameter slots) and cse'd or loop-moved constant memory addresses. Record constant equivalents in reg_equiv_constant so they will be substituted by find_reloads. Record memory equivalents in reg_mem_equiv so they can be substituted eventually by altering the REG-rtx's.
Look for REG_EQUIV notes; record what each pseudo is equivalent to. If DO_SUBREGS is true, also find all paradoxical subregs and find largest such for each pseudo. FIRST is the head of the insn list.
References copy_rtx(), dump_file, find_reg_note(), first_label_num, force_const_mem(), function_invariant_p(), get_first_label_num(), grow_reg_equivs(), HOST_WIDE_INT, max_label_num(), max_regno, memory_operand(), num_eliminable_invariants, num_labels, offsets_at, offsets_known_at, print_inline_rtx(), reg_max_ref_width, scan_paradoxical_subregs(), and targetm.
void init_reload | ( | void | ) |
Initialize the reload pass. This is called at the beginning of compilation and may be called again if the target is reinitialized.
References gen_rtx_MEM(), gen_rtx_REG(), plus_constant(), reload_obstack, and reload_startobj.
Referenced by backend_init_target().
void mark_home_live | ( | ) |
Mark the slots in regs_ever_live for the hard regs used by pseudo-reg number REGNO.
References mark_home_live_1(), and reg_renumber.
|
static |
Mark the slots in regs_ever_live for the hard regs used by pseudo-reg number REGNO, accessed in MODE.
References df_set_regs_ever_live(), end_hard_regno(), and reg_renumber.
Referenced by mark_home_live(), and scan_paradoxical_subregs().
|
static |
Given X, a SET or CLOBBER of DEST, if DEST is the target of a register replacement we currently believe is valid, mark it as not eliminable if X modifies DEST in any way other than by adding a constant integer to it. If DEST is the frame pointer, we do nothing because we assume that all assignments to the hard frame pointer are nonlocal gotos and are being done at a time when they are valid and do not disturb anything else. Some machines want to eliminate a fake argument pointer with either the frame or stack pointer. Assignments to the hard frame pointer must not prevent this elimination. Called via note_stores from reload before starting its passes to scan the insns of the function.
References elim_table::can_eliminate, elim_table::can_eliminate_previous, num_eliminable, SET, and elim_table::to_rtx.
|
static |
Mark reg REGNO as in use for a reload of the sort spec'd by OPNUM and TYPE. MODE is used to indicate how many consecutive regs are actually used.
References add_to_hard_reg_set(), RELOAD_FOR_INPADDR_ADDRESS, RELOAD_FOR_INPUT, RELOAD_FOR_INPUT_ADDRESS, RELOAD_FOR_INSN, RELOAD_FOR_OPADDR_ADDR, RELOAD_FOR_OPERAND_ADDRESS, RELOAD_FOR_OTHER_ADDRESS, RELOAD_FOR_OUTADDR_ADDRESS, RELOAD_FOR_OUTPUT, RELOAD_FOR_OUTPUT_ADDRESS, RELOAD_OTHER, reload_reg_used, reload_reg_used_at_all, reload_reg_used_in_inpaddr_addr, reload_reg_used_in_input, reload_reg_used_in_input_addr, reload_reg_used_in_insn, reload_reg_used_in_op_addr, reload_reg_used_in_op_addr_reload, reload_reg_used_in_other_addr, reload_reg_used_in_outaddr_addr, reload_reg_used_in_output, and reload_reg_used_in_output_addr.
Referenced by choose_reload_regs(), choose_reload_regs_init(), and set_reload_reg().
|
static |
Yet another special case. Unfortunately, reg-stack forces people to write incorrect clobbers in asm statements. These clobbers must not cause the register to appear in bad_spill_regs, otherwise we'll call fatal_insn later. We clear the corresponding regnos in the live register sets to avoid this. The whole thing is rather sick, I'm afraid.
References asm_noperands(), base_reg_class(), constraints, insn_chain::dead_or_set, decode_asm_operands(), insn_chain::insn, insn_chain::live_throughout, insn_chain::next, recog_data_d::operand, recog_data_d::operand_loc, and recog_data.
Referenced by reload().
|
read |
Allocate an empty insn_chain structure.
References insn_chain::dead_or_set, insn_chain::is_caller_save_insn, insn_chain::live_throughout, insn_chain::need_elim, insn_chain::need_operand_change, insn_chain::need_reload, insn_chain::next, reload_obstack, and unused_insn_chains.
Referenced by build_insn_chain(), and insert_one_insn().
|
static |
Called through for_each_rtx, this function examines every reg that occurs in PX and adjusts the costs for its elimination which are gathered by IRA. DATA is the insn in which PX occurs. We do not recurse into MEM expressions.
References eliminate_regs_1(), ira_adjust_equiv_reg_cost(), optimize_bb_for_speed_p(), and set_src_cost().
Referenced by eliminate_regs_1(), and elimination_costs_in_insn().
|
static |
Referenced by find_reload_regs().
|
static |
Calculate the SPILL_COST and SPILL_ADD_COST arrays and determine the contents of BAD_SPILL_REGS for the insn described by CHAIN.
References bad_spill_regs, count_pseudo(), insn_chain::dead_or_set, hard_regno_to_pseudo_regno, insn_chain::live_throughout, memset(), spill_add_cost, and spill_cost.
bool reload | ( | ) |
Main entry point for the reload pass. FIRST is the first insn of the function being compiled. GLOBAL nonzero means we were called from global_alloc and should attempt to reallocate any pseudoregs that we displace from hard regs we will use for reloads. If GLOBAL is zero, we do not have enough information to do that, so any pseudo reg that is spilled must go to the stack. Return value is TRUE if reload likely left dead insns in the stream and a DCE pass should be run to elimiante them. Else the return value is FALSE.
References add_auto_inc_notes(), alter_reg(), asm_noperands(), assign_stack_local(), bad_spill_regs_global, bitmap_clear_bit(), bitmap_empty_p(), bitmap_ones(), calculate_needs_all_insns(), caller_save_needed, elim_table::can_eliminate, can_throw_internal(), function::can_throw_non_call_exceptions, cfun, cleanup_subreg_operands(), clear_secondary_mem(), commit_edge_insertions(), constrain_operands(), delete_caller_save_insns(), delete_dead_insn(), delete_insn(), df_get_live_in(), df_insn_rescan_debug_internal(), df_regs_ever_live_p(), df_set_regs_ever_live(), eliminate_regs(), emit_note(), error_for_asm(), extract_insn(), failure, find_many_sub_basic_blocks(), find_reg_note(), finish_spills(), fixup_abnormal_edges(), free(), free_reg_equiv(), elim_table::from, GENERIC_STACK_CHECK, get_frame_size(), get_max_uid(), grow_reg_equivs(), has_nonexceptional_receiver(), function::has_nonlocal_label, HOST_WIDE_INT, init_elim_table(), init_eliminable_invariants(), init_recog(), init_save_areas(), inserted, insn_chain::insn, ira_conflicts_p, ira_sort_regnos_for_alter_reg(), last_spill_reg, mark_elimination(), mark_home_live(), mark_not_eliminable(), max_regno, maybe_fix_stack_asms(), memcpy(), memset(), n_spills, need_dce, note_stores(), num_eliminable, pseudo_forbidden_regs, pseudo_previous_regs, reg_max_ref_width, reg_old_renumber, reg_renumber, reg_set_p(), regno_reg_rtx, reload_as_needed(), reload_completed, reload_first_uid, reload_firstobj, reload_in_progress, reload_obstack, reload_startobj, replace_pseudos_in(), save_call_clobbered_regs(), sbitmap_alloc(), sbitmap_free(), select_reload_regs(), SET, set_initial_elim_offsets(), set_initial_label_offsets(), setup_save_areas(), simplify_replace_rtx(), something_needs_elimination, something_needs_operands_changed, something_was_spilled, spill_hard_reg, spill_regs, spill_stack_slot, spill_stack_slot_width, strict_memory_address_addr_space_p(), targetm, temp_pseudo_reg_arr, elim_table::to, unshare_all_rtl_again(), update_eliminables(), used_spill_regs, verify_initial_elim_offsets(), and warning().
|
static |
Check if *RELOAD_REG is suitable as a scratch register for the reload pattern with insn_code ICODE, or alternatively, if alt_reload_reg is nonzero, if that is suitable. On success, change *RELOAD_REG to the adjusted register, and return true. Otherwise, return false.
References insn_data, new_mode(), reload_adjust_reg_for_temp(), and scratch_reload_class().
Referenced by emit_input_reload_insns().
|
static |
Check if *RELOAD_REG is suitable as an intermediate or scratch register of class NEW_CLASS with mode NEW_MODE. Or alternatively, if alt_reload_reg is nonzero, if that is suitable. On success, change *RELOAD_REG to the adjusted register, and return true. Otherwise, return false.
References reload_adjust_reg_for_mode().
Referenced by emit_input_reload_insns(), and reload_adjust_reg_for_icode().
|
static |
Referenced by reload().
|
static |
Reload pseudo-registers into hard regs around each insn as needed. Additional register load insns are output before the insn that needs it and perhaps store insns after insns that modify the reloaded pseudo reg. reg_last_reload_reg and reg_reloaded_contents keep track of which registers are already available in reload registers. We update these for the reloads that we perform, as the insns are scanned.
References add_reg_note(), asm_noperands(), function::can_throw_non_call_exceptions, cancel_changes(), cfun, choose_reload_regs(), confirm_change_group(), constrain_operands(), count_occurrences(), delete_insn(), eliminate_regs(), eliminate_regs_in_insn(), emit_note(), emit_reload_insns(), error_for_asm(), extract_insn(), find_reg_note(), find_reloads(), fixup_args_size_notes(), fixup_eh_region_note(), forget_marked_reloads(), forget_old_reloads_1(), free(), reload::in_reg, insn_chain::insn, max_regno, memset(), n_reloads, insn_chain::need_elim, insn_chain::need_operand_change, insn_chain::need_reload, insn_chain::next, note_stores(), num_eliminable, num_eliminable_invariants, insn_chain::prev, recog_memoized(), reg_is_output_reload, reg_last_reload_reg, reg_reloaded_call_part_clobbered, reg_reloaded_contents, reg_reloaded_insn, reg_reloaded_valid, reload::reg_rtx, reg_set_p(), remove_note(), reorder_insns_nobb(), replace_reg(), rld, set_initial_elim_offsets(), set_offsets_for_label(), spill_reg_order, spill_reg_rtx, spill_reg_store, subst_reloads(), unlink_insn_chain(), update_eliminable_offsets(), validate_replace_rtx_group(), and verify_changes().
|
static |
Referenced by choose_reload_regs(), and find_reload_regs().
|
static |
Comparison function for qsort to decide which of two reloads should be handled first. *P1 and *P2 are the reload numbers.
References reload::nregs, reload::optional, reload::rclass, and rld.
|
static |
Subroutine of free_for_value_p, used to check a single register. START_REGNO is the starting regno of the full reload register (possibly comprising multiple hard registers) that we are considering.
References copy(), earlyclobber_operand_p(), reload::in, n_reloads, reload::opnum, reload::reg_rtx, RELOAD_FOR_INPADDR_ADDRESS, RELOAD_FOR_INPUT, RELOAD_FOR_INPUT_ADDRESS, RELOAD_FOR_INSN, RELOAD_FOR_OPADDR_ADDR, RELOAD_FOR_OPERAND_ADDRESS, RELOAD_FOR_OTHER_ADDRESS, RELOAD_FOR_OUTADDR_ADDRESS, RELOAD_FOR_OUTPUT, RELOAD_FOR_OUTPUT_ADDRESS, RELOAD_OTHER, reload_reg_unavailable, rld, rtx_equal_p(), and true_regnum().
Referenced by free_for_value_p().
|
static |
Referenced by allocate_reload_reg().
|
static |
1 if reg REGNO is free as a reload reg for a reload of the sort specified by OPNUM and TYPE.
References RELOAD_FOR_INPADDR_ADDRESS, RELOAD_FOR_INPUT, RELOAD_FOR_INPUT_ADDRESS, RELOAD_FOR_INSN, RELOAD_FOR_OPADDR_ADDR, RELOAD_FOR_OPERAND_ADDRESS, RELOAD_FOR_OTHER_ADDRESS, RELOAD_FOR_OUTADDR_ADDRESS, RELOAD_FOR_OUTPUT, RELOAD_FOR_OUTPUT_ADDRESS, reload_n_operands, RELOAD_OTHER, reload_reg_unavailable, reload_reg_used, reload_reg_used_in_inpaddr_addr, reload_reg_used_in_input, reload_reg_used_in_input_addr, reload_reg_used_in_insn, reload_reg_used_in_op_addr, reload_reg_used_in_op_addr_reload, reload_reg_used_in_other_addr, reload_reg_used_in_outaddr_addr, reload_reg_used_in_output, and reload_reg_used_in_output_addr.
|
static |
Return 1 if the value in reload reg REGNO, as used by the reload with the number RELOADNUM, is still available in REGNO at the end of the insn. We can assume that the reload reg was already tested for availability at the time it is needed, and we should not check this again, in case the reg has already been marked in use.
References n_reloads, reload::opnum, reload::reg_rtx, RELOAD_FOR_INPADDR_ADDRESS, RELOAD_FOR_INPUT, RELOAD_FOR_INPUT_ADDRESS, RELOAD_FOR_INSN, RELOAD_FOR_OPADDR_ADDR, RELOAD_FOR_OPERAND_ADDRESS, RELOAD_FOR_OTHER_ADDRESS, RELOAD_FOR_OUTADDR_ADDRESS, RELOAD_FOR_OUTPUT, RELOAD_FOR_OUTPUT_ADDRESS, reload_n_operands, RELOAD_OTHER, reload_reg_used, reload_reg_used_in_inpaddr_addr, reload_reg_used_in_input, reload_reg_used_in_input_addr, reload_reg_used_in_insn, reload_reg_used_in_op_addr, reload_reg_used_in_op_addr_reload, reload_reg_used_in_outaddr_addr, reload_reg_used_in_output, reload_reg_used_in_output_addr, rld, and reload::when_needed.
Referenced by emit_reload_insns(), and reload_reg_rtx_reaches_end_p().
|
static |
Like reload_reg_reaches_end_p, but check that the condition holds for every register in REG.
References reload_reg_reaches_end_p().
Referenced by emit_output_reload_insns(), and emit_reload_insns().
|
static |
Referenced by find_reg().
|
static |
Return 1 if the reloads denoted by R1 and R2 cannot share a register. Return 0 otherwise. This function uses the same algorithm as reload_reg_free_p above.
References gen_reload_chain_without_interm_reg_p(), reload::opnum, RELOAD_FOR_INPADDR_ADDRESS, RELOAD_FOR_INPUT, RELOAD_FOR_INPUT_ADDRESS, RELOAD_FOR_INSN, RELOAD_FOR_OPADDR_ADDR, RELOAD_FOR_OPERAND_ADDRESS, RELOAD_FOR_OTHER_ADDRESS, RELOAD_FOR_OUTADDR_ADDRESS, RELOAD_FOR_OUTPUT, RELOAD_FOR_OUTPUT_ADDRESS, RELOAD_OTHER, reloads_unique_chain_p(), rld, and reload::when_needed.
|
static |
Returns whether R1 and R2 are uniquely chained: the value of one is used by the other, and that value is not used by any other reload for this insn. This is used to partially undo the decision made in find_reloads when in the case of multiple RELOAD_FOR_OPERAND_ADDRESS reloads it converts all RELOAD_FOR_OPADDR_ADDR reloads into RELOAD_FOR_OPERAND_ADDRESS reloads. This code tries to avoid the conflict created by that change. It might be cleaner to explicitly keep track of which RELOAD_FOR_OPADDR_ADDR reload is associated with which RELOAD_FOR_OPERAND_ADDRESS reload, rather than to try to detect this after the fact.
References n_reloads, reg_mentioned_p(), rld, and rtx_equal_p().
Referenced by reloads_conflict().
Referenced by reload(), and replace_pseudos_in().
|
static |
Replace all pseudos found in LOC with their corresponding equivalences.
References eliminate_regs_1(), gen_rtx_MEM(), regno_reg_rtx, replace_pseudos_in(), and usage().
|
static |
If X is not a subreg, return it unmodified. If it is a subreg, look up whether we made a replacement for the SUBREG_REG. Return either the replacement or the SUBREG_REG.
References find_replacement().
Referenced by choose_reload_regs(), and gen_reload().
|
static |
Referenced by init_eliminable_invariants(), and scan_paradoxical_subregs().
|
static |
Find all paradoxical subregs within X and update reg_max_ref_width.
References mark_home_live_1(), reg_max_ref_width, and scan_paradoxical_subregs().
|
static |
References find_reload_regs(), and insn_chain::next_need_reload.
Referenced by reload().
|
static |
Subroutine of set_initial_label_offsets called via for_each_eh_label.
References set_label_offsets().
Referenced by set_initial_label_offsets().
|
static |
Reset all offsets on eliminable registers to their initial values.
References elim_table::from, elim_table::initial_offset, num_not_at_initial_offset, elim_table::offset, elim_table::previous_offset, reg_eliminate, and elim_table::to.
Referenced by calculate_elim_costs_all_insns(), reload(), and reload_as_needed().
|
static |
Initialize the known label offsets. Set a known offset for each forced label to be at the initial offset of each elimination. We do this because we assume that all computed jumps occur from a location where each elimination is at its initial offset. For all other labels, show that we don't know the offsets.
References for_each_eh_label(), memset(), num_labels, offsets_known_at, set_initial_eh_label_offset(), and set_label_offsets().
Referenced by calculate_elim_costs_all_insns(), and reload().
|
static |
This function handles the tracking of elimination offsets around branches. X is a piece of RTL being scanned. INSN is the insn that it came from, if any. INITIAL_P is nonzero if we are to set the offset to be the initial offset and zero if we are setting the offset of the label to be the current offset.
References elim_table::can_eliminate, first_label_num, elim_table::initial_offset, elim_table::offset, offset, offsets_at, offsets_known_at, pc_rtx, prev_nonnote_insn(), SET, set_label_offsets(), and set_offsets_for_label().
|
static |
Referenced by reload_as_needed(), and set_label_offsets().
|
static |
Set all elimination offsets to the known values for the code label given by INSN.
References elim_table::can_eliminate, first_label_num, elim_table::initial_offset, num_not_at_initial_offset, elim_table::offset, offsets_at, and elim_table::previous_offset.
|
static |
Referenced by allocate_reload_reg(), and choose_reload_regs().
|
static |
I is the index in SPILL_REG_RTX of the reload register we are to allocate for reload R. If it's valid, get an rtx for it. Return nonzero if successful.
References gen_rtx_REG(), last_spill_reg, mark_reload_reg_in_use(), reload::reg_rtx, reload_spill_index, rld, spill_reg_rtx, spill_regs, and true_regnum().
|
static |
Referenced by find_reload_regs().
|
static |
Handle the failure to find a register to spill. INSN should be one of the insns which needed this particular spill reg.
References asm_noperands(), debug_reload_to_stream(), dump_file, error(), error_for_asm(), and reg_class_names.
|
static |
|
static |
Kick all pseudos out of hard register REGNO. If CANT_ELIMINATE is nonzero, it means that we are doing this spill because we found we can't eliminate some register. In the case, no pseudos are allowed to be in the register, even if they are only in a block that doesn't require spill registers, unlike the case when we are spilling this hard reg to produce another spill register. Return nonzero if any pseudos needed to be kicked out.
References bad_spill_regs_global, df_set_regs_ever_live(), end_hard_regno(), max_regno, and reg_renumber.
|
static |
*OP_PTR and *OTHER_PTR are two operands to a conceptual reload. If *OP_PTR is a paradoxical subreg, try to remove that subreg and apply the corresponding narrowing subreg to *OTHER_PTR. Return true if the operands were changed, false otherwise.
References gen_lowpart_common(), and paradoxical_subreg_p().
Referenced by emit_output_reload_insns(), gen_reload(), and gen_reload_chain_without_interm_reg_p().
|
static |
The recursive function change all occurrences of WHAT in *WHERE to REPL.
References rtx_equal_p(), and substitute().
|
static |
Loop through all elimination pairs. Recalculate the number not at initial offset. Compute the maximum offset (minimum offset if the stack does not grow downward) for each elimination pair.
References elim_table::can_eliminate, elim_table::initial_offset, num_not_at_initial_offset, elim_table::offset, and elim_table::previous_offset.
Referenced by calculate_elim_costs_all_insns(), calculate_needs_all_insns(), and reload_as_needed().
|
static |
Referenced by reload().
|
static |
See if anything that happened changes which eliminations are valid. For example, on the SPARC, whether or not the frame pointer can be eliminated can depend on what registers have been used. We need not check some conditions again (such as flag_omit_frame_pointer) since they can't have changed.
References elim_table::can_eliminate, elim_table::can_eliminate_previous, elim_table::from, num_eliminable, targetm, and elim_table::to.
|
static |
Verify that the initial elimination offsets did not change since the last call to set_initial_elim_offsets. This is used to catch cases where something illegal happened during reload_as_needed that could cause incorrect code to be generated if we did not check for it.
References elim_table::from, HOST_WIDE_INT, elim_table::initial_offset, num_eliminable, and elim_table::to.
Referenced by reload().
|
static |
This reg set indicates registers that can't be used as spill registers for the currently processed insn. These are the hard registers which are live during the insn, but not allocated to pseudos, as well as fixed registers.
Referenced by find_reg(), and order_regs_for_reload().
|
static |
These are the hard registers that can't be used as spill register for any insn. This includes registers used for user variables and registers that we can't eliminate. A register that appears in this set also can't be used to retry register allocation.
Referenced by find_reg(), finish_spills(), reload(), and spill_hard_reg().
int caller_save_needed |
Flag set by local-alloc or global-alloc if anything is live in a call-clobbered reg across calls.
Referenced by allocno_reload_assign(), lra(), prepare_function_start(), reload(), and setup_reg_renumber().
|
static |
Record which pseudos changed their allocation in finish_spills.
struct target_reload default_target_reload |
@verbatim Reload pseudo regs into hard regs for insns that require hard regs.
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/.
This file contains the reload pass of the compiler, which is run after register allocation has been done. It checks that each insn is valid (operands required to be in registers really are in registers of the proper class) and fixes up invalid ones by copying values temporarily into registers for the insns that need them. The results of register allocation are described by the vector reg_renumber; the insns still contain pseudo regs, but reg_renumber can be used to find which hard reg, if any, a pseudo reg is in. The technique we always use is to free up a few hard regs that are called ``reload regs'', and for each place where a pseudo reg must be in a hard reg, copy it temporarily into one of the reload regs. Reload regs are allocated locally for every instruction that needs reloads. When there are pseudos which are allocated to a register that has been chosen as a reload reg, such pseudos must be ``spilled''. This means that they go to other hard regs, or to stack slots if no other available hard regs can be found. Spilling can invalidate more insns, requiring additional need for reloads, so we must keep checking until the process stabilizes. For machines with different classes of registers, we must keep track of the register class needed for each reload, and make sure that we allocate enough reload registers of each class. The file reload.c contains the code that checks one insn for validity and reports the reloads that it needs. This file is in charge of scanning the entire rtl code, accumulating the reload needs, spilling, assigning reload registers to use for fixing up each insn, and generating the new insns to copy values into the reload registers.
|
static |
Global variables used by reload and its subroutines.
The current basic block while in calculate_elim_costs_all_insns.
|
static |
Nonzero means we couldn't get enough spill regs.
Referenced by check_unique_operand_names(), expand_builtin_atomic_compare_exchange(), find_reload_regs(), gimplify_expr(), and reload().
|
static |
For each label, we record the offset of each elimination. If we reach a label by more than one path and an offset differs, we cannot do the elimination. This information is indexed by the difference of the number of the label and the first label number. We can't offset the pointer itself as this can cause problems on machines with segmented memory. The first table is an array of flags that records whether we have yet encountered a label and the second table is an array of arrays, one entry in the latter array for each elimination.
Referenced by get_first_label_num(), init_eliminable_invariants(), init_emit(), maybe_set_first_label_num(), set_label_offsets(), and set_offsets_for_label().
|
static |
Map of hard regno to pseudo regno currently occupying the hard reg.
Referenced by count_pseudo(), count_spilled_pseudo(), find_reg(), and order_regs_for_reload().
|
static |
Referenced by emit_input_reload_insns(), and emit_reload_insns().
|
static |
Referenced by emit_input_reload_insns(), and emit_reload_insns().
|
static |
These arrays are filled by emit_reload_insns and its subroutines.
Referenced by emit_input_reload_insns(), and emit_reload_insns().
|
static |
List of all insns needing reloads.
Referenced by calculate_needs_all_insns().
|
static |
Index of last register assigned as a spill register. We allocate in a round-robin fashion.
Referenced by allocate_reload_reg(), reload(), and set_reload_reg().
|
static |
Number of spill-regs so far; number of valid elements of spill_regs.
Referenced by allocate_reload_reg(), choose_reload_regs(), finish_spills(), and reload().
|
static |
TRUE if we potentially left dead insns in the insn stream and want to run DCE immediately after reload, FALSE otherwise.
Referenced by delete_dead_insn(), do_reload(), and reload().
|
static |
Values to be put in spill_reg_store are put here first. Instructions must only be placed here if the associated reload register reaches the end of the instruction's reload sequence.
Referenced by emit_output_reload_insns(), and emit_reload_insns().
|
static |
Count the number of registers that we may be able to eliminate.
Referenced by calculate_elim_costs_all_insns(), calculate_needs_all_insns(), finish_spills(), init_elim_table(), mark_not_eliminable(), reload(), reload_as_needed(), update_eliminables(), and verify_initial_elim_offsets().
|
static |
And the number of registers that are equivalent to a constant that can be eliminated to frame_pointer / arg_pointer + constant.
Referenced by calculate_elim_costs_all_insns(), calculate_needs_all_insns(), init_eliminable_invariants(), and reload_as_needed().
|
static |
Number of labels in the current function.
Referenced by init_eliminable_invariants(), and set_initial_label_offsets().
int num_not_at_initial_offset |
Record the number of pending eliminations that have an offset not equal to their initial offset. If nonzero, we use a new copy of each replacement result in any insns encountered.
Referenced by emit_input_reload_insns(), find_reloads(), find_reloads_address(), find_reloads_address_1(), find_reloads_toplev(), set_initial_elim_offsets(), set_offsets_for_label(), subst_reg_equivs(), and update_eliminable_offsets().
|
static |
|
static |
|
static |
Referenced by emit_input_reload_insns(), and emit_reload_insns().
|
static |
Referenced by emit_input_reload_insns(), and emit_reload_insns().
|
static |
Referenced by emit_input_reload_insns(), and emit_reload_insns().
|
static |
Referenced by emit_input_reload_insns(), and emit_reload_insns().
|
static |
Referenced by emit_output_reload_insns(), and emit_reload_insns().
|
static |
Referenced by emit_input_reload_insns(), and emit_reload_insns().
|
static |
Referenced by emit_input_reload_insns(), and emit_reload_insns().
|
static |
Referenced by emit_output_reload_insns(), and emit_reload_insns().
|
static |
This vector of reg sets indicates, for each pseudo, which hard registers may not be used for retrying global allocation because they are used as spill registers during one of the insns in which the pseudo is live.
Referenced by finish_spills(), and reload().
|
static |
This vector of reg sets indicates, for each pseudo, which hard registers may not be used for retrying global allocation because the register was formerly spilled from one of them. If we allowed reallocating a pseudo to a register that it was already allocated to, reload might not terminate.
Referenced by finish_spills(), and reload().
|
static |
Used for communication between order_regs_for_reload and count_pseudo. Used to avoid counting one pseudo twice.
|
static |
Referenced by set_initial_elim_offsets().
|
static |
Referenced by init_elim_table().
vec<reg_equivs_t, va_gc>* reg_equivs |
Referenced by do_reload(), emit_move_list(), and fix_reg_equiv_init().
|
static |
Elt N nonzero if reg_last_reload_reg[N] has been set in this insn for an output reload that stores into reg N.
|
static |
Indicates which hard regs are reload-registers for an output reload in the current insn.
Referenced by choose_reload_regs(), emit_output_reload_insns(), emit_reload_insns(), forget_marked_reloads(), forget_old_reloads_1(), and reload_as_needed().
|
static |
During reload_as_needed, element N contains a REG rtx for the hard reg into which reg N has been reloaded (perhaps for a previous insn).
Referenced by choose_reload_regs(), do_output_reload(), emit_reload_insns(), forget_marked_reloads(), forget_old_reloads_1(), inc_for_reload(), and reload_as_needed().
|
static |
Widest width in which each pseudo reg is referred to (via subreg).
Referenced by alter_reg(), init_eliminable_invariants(), ira_sort_regnos_for_alter_reg(), reload(), and scan_paradoxical_subregs().
|
static |
Vector to remember old contents of reg_renumber before spilling.
Referenced by finish_spills(), and reload().
|
static |
Indicate whether the register's current value is one that is not safe to retain across a call, even for registers that are normally call-saved. This is only meaningful for members of reg_reloaded_valid.
Referenced by emit_reload_insns(), and reload_as_needed().
|
static |
During reload_as_needed, element N contains the last pseudo regno reloaded into hard register N. If that pseudo reg occupied more than one register, reg_reloaded_contents points to that pseudo for each spill register in use; all of these must remain set for an inheritance to occur.
Referenced by choose_reload_regs(), delete_address_reloads_1(), do_input_reload(), do_output_reload(), emit_reload_insns(), and reload_as_needed().
|
static |
Indicate if the register was dead at the end of the reload. This is only valid if reg_reloaded_contents is set and valid.
Referenced by choose_reload_regs(), and emit_reload_insns().
|
static |
Referenced by emit_output_reload_insns(), and emit_reload_insns().
|
static |
During reload_as_needed, element N contains the insn for which hard register N was last used. Its contents are significant only when reg_reloaded_valid is set for this register.
Referenced by choose_reload_regs(), emit_reload_insns(), and reload_as_needed().
|
static |
Indicate if reg_reloaded_insn / reg_reloaded_contents is valid.
Referenced by choose_reload_regs(), do_input_reload(), do_output_reload(), emit_reload_insns(), forget_marked_reloads(), forget_old_reloads_1(), and reload_as_needed().
|
static |
Records which hard regs are used in any way, either as explicit use or by being allocated to a pseudo during any point of the current insn.
Referenced by choose_reload_regs(), and choose_reload_regs_init().
int reload_first_uid |
First uid used by insns created by reload in this function. Used in find_equiv_reg.
Referenced by delete_address_reloads_1(), find_equiv_reg(), and reload().
|
static |
The point after all insn_chain structures. Used to quickly deallocate memory allocated in copy_reloads during calculate_needs_all_insns.
Referenced by reload().
int reload_in_progress = 0 |
Set to 1 while reload_as_needed is operating. Required by some machines to handle any generated moves differently.
Referenced by change_address_1(), constrain_operands(), emit_move_change_mode(), emit_move_complex_parts(), emit_move_multi_word(), gen_rtx_REG(), insn_invalid_p(), reload(), and verify_rtx_sharing().
|
static |
For an inherited reload, this is the insn the reload was inherited from, if we know it. Otherwise, this is 0.
Referenced by choose_reload_regs(), and choose_reload_regs_init().
|
static |
Indexed by reload number, 1 if incoming value inherited from previous insns.
Referenced by choose_reload_regs(), choose_reload_regs_init(), delete_address_reloads_1(), delete_output_reload(), do_input_reload(), emit_input_reload_insns(), and emit_reload_insns().
struct insn_chain* reload_insn_chain |
List of insn_chain instructions, one for every insn that reload needs to examine.
Referenced by build_insn_chain(), delete_caller_save_insns(), insert_one_insn(), print_insn_chains(), save_call_clobbered_regs(), and setup_save_areas().
|
static |
This points before all local rtl generated by register elimination. Used to quickly free all memory after processing one insn.
Referenced by calculate_needs_all_insns(), and copy_reloads().
|
static |
This obstack is used for allocation of rtl during register elimination. The allocated storage can be freed once find_reloads has processed the insn.
Referenced by calculate_needs_all_insns(), copy_reloads(), init_reload(), new_insn_chain(), and reload().
|
static |
Vector of reload-numbers showing the order in which the reloads should be processed.
Referenced by choose_reload_regs(), emit_reload_insns(), find_reg(), and find_reload_regs().
|
static |
If nonzero, this is a place to get the value of the reload, rather than using reload_in.
Referenced by choose_reload_regs(), choose_reload_regs_init(), conflicts_with_override(), delete_address_reloads_1(), delete_output_reload(), do_input_reload(), emit_input_reload_insns(), and emit_reload_insns().
|
static |
Index X is the value of rld[X].reg_rtx, adjusted for the input mode.
Referenced by do_input_reload(), emit_input_reload_insns(), and emit_reload_insns().
|
static |
Index X is the value of rld[X].reg_rtx, adjusted for the output mode.
Referenced by do_output_reload(), emit_output_reload_insns(), and emit_reload_insns().
|
static |
The following HARD_REG_SETs indicate when each hard register is used for a reload of various parts of the current insn.
If reg is unavailable for all reloads.
Referenced by choose_reload_regs(), choose_reload_regs_init(), reload_reg_free_for_value_p(), and reload_reg_free_p().
|
static |
If reg is in use as a reload reg for a RELOAD_OTHER reload.
Referenced by allocate_reload_reg(), choose_reload_regs_init(), clear_reload_reg_in_use(), mark_reload_reg_in_use(), reload_reg_free_p(), and reload_reg_reaches_end_p().
|
static |
If reg is in use as a reload reg for any sort of reload.
Referenced by allocate_reload_reg(), choose_reload_regs(), choose_reload_regs_init(), and mark_reload_reg_in_use().
|
static |
If reg is use as an inherited reload. We just mark the first register in the group.
Referenced by allocate_reload_reg(), choose_reload_regs(), and choose_reload_regs_init().
|
static |
If reg is in use for a RELOAD_FOR_INPADDR_ADDRESS reload for operand I.
Referenced by choose_reload_regs_init(), clear_reload_reg_in_use(), mark_reload_reg_in_use(), reload_reg_free_p(), and reload_reg_reaches_end_p().
|
static |
If reg is in use for a RELOAD_FOR_INPUT reload for operand I.
Referenced by choose_reload_regs_init(), clear_reload_reg_in_use(), mark_reload_reg_in_use(), reload_reg_free_p(), and reload_reg_reaches_end_p().
|
static |
If reg is in use for a RELOAD_FOR_INPUT_ADDRESS reload for operand I.
Referenced by choose_reload_regs_init(), clear_reload_reg_in_use(), mark_reload_reg_in_use(), reload_reg_free_p(), and reload_reg_reaches_end_p().
|
static |
If reg is in use for a RELOAD_FOR_INSN reload.
Referenced by choose_reload_regs_init(), clear_reload_reg_in_use(), mark_reload_reg_in_use(), reload_reg_free_p(), and reload_reg_reaches_end_p().
|
static |
If reg is in use for a RELOAD_FOR_OPERAND_ADDRESS reload.
Referenced by choose_reload_regs_init(), clear_reload_reg_in_use(), mark_reload_reg_in_use(), reload_reg_free_p(), and reload_reg_reaches_end_p().
|
static |
If reg is in use for a RELOAD_FOR_OPADDR_ADDR reload.
Referenced by choose_reload_regs_init(), clear_reload_reg_in_use(), mark_reload_reg_in_use(), reload_reg_free_p(), and reload_reg_reaches_end_p().
|
static |
If reg is in use for a RELOAD_FOR_OTHER_ADDRESS reload.
Referenced by choose_reload_regs_init(), clear_reload_reg_in_use(), mark_reload_reg_in_use(), and reload_reg_free_p().
|
static |
If reg is in use for a RELOAD_FOR_OUTADDR_ADDRESS reload for operand I.
Referenced by choose_reload_regs_init(), clear_reload_reg_in_use(), mark_reload_reg_in_use(), reload_reg_free_p(), and reload_reg_reaches_end_p().
|
static |
If reg is in use for a RELOAD_FOR_OUTPUT reload for operand I.
Referenced by choose_reload_regs_init(), clear_reload_reg_in_use(), mark_reload_reg_in_use(), reload_reg_free_p(), and reload_reg_reaches_end_p().
|
static |
If reg is in use for a RELOAD_FOR_OUTPUT_ADDRESS reload for operand I.
Referenced by choose_reload_regs_init(), clear_reload_reg_in_use(), mark_reload_reg_in_use(), reload_reg_free_p(), and reload_reg_reaches_end_p().
|
static |
For each reload, the hard register number of the register used, or -1 if we did not need a register for this reload.
Referenced by choose_reload_regs(), deallocate_reload_reg(), do_input_reload(), emit_output_reload_insns(), emit_reload_insns(), and set_reload_reg().
|
static |
Points to the beginning of the reload_obstack. All insn_chain structures are allocated first.
Referenced by init_reload(), and reload().
|
static |
Set during calculate_needs if an insn needs register elimination.
Referenced by calculate_needs_all_insns(), and reload().
|
static |
Set during calculate_needs if an insn needs an operand changed.
Referenced by calculate_needs_all_insns(), and reload().
|
static |
Set by alter_regs if we spilled a register to the stack.
Referenced by alter_reg(), and reload().
|
static |
When spilling multiple hard registers, we use SPILL_COST for the first spilled hard reg and SPILL_ADD_COST for subsequent regs. SPILL_ADD_COST only the first hard reg for a multi-reg pseudo.
Referenced by count_pseudo(), count_spilled_pseudo(), find_reg(), and order_regs_for_reload().
|
static |
The cost of spilling each hard reg.
Referenced by count_pseudo(), count_spilled_pseudo(), find_reg(), improve_allocation(), and order_regs_for_reload().
|
static |
This table is the inverse mapping of spill_regs: indexed by hard reg number, it contains the position of that reg in spill_regs, or -1 for something that is not in spill_regs. ?!? This is no longer accurate.
Referenced by allocate_reload_reg(), calculate_needs_all_insns(), choose_reload_regs(), deallocate_reload_reg(), delete_address_reloads_1(), finish_spills(), and reload_as_needed().
|
static |
In parallel with spill_regs, contains REG rtx's for those regs. Holds the last rtx used for any given reg, or 0 if it has never been used for spilling yet. This rtx is reused, provided it has the proper mode.
Referenced by reload_as_needed(), and set_reload_reg().
|
static |
In parallel with spill_regs, contains nonzero for a spill reg that was stored after the last time it was used. The precise value is the insn generated to do the store.
Referenced by choose_reload_regs(), delete_output_reload(), do_input_reload(), do_output_reload(), emit_input_reload_insns(), emit_reload_insns(), forget_marked_reloads(), forget_old_reloads_1(), and reload_as_needed().
|
static |
This is the register that was stored with spill_reg_store. This is a copy of reload_out / reload_out_reg when the value was stored; if reload_out is a MEM, spill_reg_stored_to will be set to reload_out_reg.
Referenced by delete_output_reload(), do_input_reload(), do_output_reload(), emit_input_reload_insns(), and emit_reload_insns().
|
static |
Describes order of use of registers for reloading of spilled pseudo-registers. `n_spills' is the number of elements that are actually valid; new ones are added at the end. Both spill_regs and spill_reg_order are used on two occasions: once during find_reload_regs, where they keep track of the spill registers for a single insn, but also during reload_as_needed where they show all the registers ever used by reload. For the latter case, the information is calculated during finish_spills.
Referenced by allocate_reload_reg(), choose_reload_regs(), finish_spills(), reload(), and set_reload_reg().
|
static |
Record the stack slot for each spilled hard register.
Referenced by alter_reg(), and reload().
|
static |
Width allocated so far for that stack slot.
Referenced by alter_reg(), and reload().
|
static |
Record which pseudos needed to be spilled.
Referenced by spill_pseudos().
|
static |
Temporary array of pseudo-register number.
Referenced by finish_spills(), and reload().
struct target_reload* this_target_reload = &default_target_reload |
|
static |
List of insn chains that are currently unused.
Referenced by calculate_needs_all_insns(), delete_caller_save_insns(), and new_insn_chain().
|
static |
All hard regs that have been used as spill registers for any insn are marked in this set.
Referenced by find_reload_regs(), finish_spills(), and reload().
|
static |
This is used to keep track of the spill regs used in one insn.
Referenced by find_reg(), and find_reload_regs().