GCC Middle and Back End API Reference
|
Data Structures | |
struct | pseudo_slot |
struct | slot |
Functions | |
static void | assign_mem_slot () |
static int | regno_freq_compare () |
static int | pseudo_reg_slot_compare () |
static int | assign_spill_hard_regs () |
static void | add_pseudo_to_slot () |
static void | assign_stack_slot_num_and_sort_pseudos () |
static void | remove_pseudos () |
static void | spill_pseudos () |
bool | lra_need_for_spills_p () |
void | lra_spill () |
static bool | alter_subregs () |
void | lra_final_code_change () |
Variables | |
static int | regs_num |
static rtx * | spill_hard_reg |
static struct pseudo_slot * | pseudo_slots |
static struct slot * | slots |
static int | slots_num |
|
static |
Add pseudo REGNO to slot SLOT_NUM.
References pseudo_slot::first, first, slot::live_ranges, lra_copy_live_range_list(), lra_merge_live_ranges(), lra_reg_info, pseudo_slot::mem, pseudo_slot::next, slot::regno, and pseudo_slot::slot_num.
Referenced by assign_stack_slot_num_and_sort_pseudos().
|
static |
Apply alter_subreg for subregs of regs in *LOC. Use FINAL_P for alter_subreg calls. Return true if any subreg of reg is processed.
References alter_subreg().
Referenced by lra_final_code_change().
|
static |
Set up memory of the spilled pseudo I. The function can allocate the corresponding stack slot if it is not done yet.
References assign_stack_local(), lra_eliminate_regs_1(), lra_reg_info, pseudo_slot::mem, slot::mem, min_align(), mode_for_size(), reg_renumber, regno_reg_rtx, set_mem_attrs_for_spill(), and pseudo_slot::slot_num.
Referenced by lra_spill().
|
static |
Assign spill hard registers to N pseudos in PSEUDO_REGNOS which is sorted in order of highest frequency first. Put the pseudos which did not get a spill hard register at the beginning of array PSEUDO_REGNOS. Return the number of such pseudos.
References add_to_hard_reg_set(), lra_reg::biggest_mode, bitmap_bit_p(), bitmap_clear(), bitmap_intersect_compl_p(), bitmap_set_bit(), df_set_regs_ever_live(), free(), gen_raw_REG(), slot::hard_regno, slot::live_ranges, lra_dump_file, lra_get_allocno_class(), lra_get_regno_hard_regno(), lra_live_max_point, lra_no_alloc_regs, lra_reg_info, lra_reg_spill_p, lra_live_range::next, nr, overlaps_hard_reg_set_p(), reg_obstack, slot::regno, regs_num, regstat_get_setjmp_crosses(), spill_hard_reg, lra_live_range::start, and targetm.
Referenced by lra_spill().
|
static |
Assign stack slot numbers to pseudos in array PSEUDO_REGNOS of length N. Sort pseudos in PSEUDO_REGNOS for subsequent assigning memory stack slots.
References add_pseudo_to_slot(), slot::hard_regno, slot::live_ranges, lra_intersected_live_ranges_p(), lra_reg_info, slot::mem, pseudo_reg_slot_compare(), slot::regno, and slots_num.
Referenced by lra_spill().
void lra_final_code_change | ( | void | ) |
Final change of pseudos got hard registers into the corresponding hard registers and removing temporary clobbers.
References alter_subregs(), delete_insn(), lra_insn_recog_data::insn_static_data, lra_operand_data::is_operator, lra_get_insn_recog_data(), lra_get_regno_hard_regno(), lra_invalidate_insn_data(), lra_reg_info, lra_update_dup(), lra_update_operator_dups(), max_reg_num(), max_regno, lra_static_insn_data::n_operands, lra_static_insn_data::operand, lra_insn_recog_data::operand_loc, and regno_reg_rtx.
Referenced by lra().
bool lra_need_for_spills_p | ( | void | ) |
Return true if we need to change some pseudos into memory.
References lra_former_scratch_p(), lra_get_regno_hard_regno(), lra_reg_info, max_reg_num(), and max_regno.
Referenced by lra().
void lra_spill | ( | void | ) |
Change spilled pseudos into memory or spill hard regs. Put changed insns on the constraint stack (these insns will be considered on the next constraint pass). The changed insns are all insns in which pseudos were changed.
References assign_mem_slot(), assign_spill_hard_regs(), assign_stack_local(), assign_stack_slot_num_and_sort_pseudos(), free(), lra_dump_file, lra_former_scratch_p(), lra_get_regno_hard_regno(), lra_reg_info, max_reg_num(), pseudo_slot::mem, pseudo_slot::next, pseudo_slots, regno_freq_compare(), regs_num, slots_num, spill_hard_reg, and spill_pseudos().
Referenced by lra().
|
static |
Sort pseudos according to their slots, putting the slots in the order that they should be allocated. Slots with lower numbers have the highest priority and should get the smallest displacement from the stack or frame pointer (whichever is being used). The first allocated slot is always closest to the frame pointer, so prefer lower slot numbers when frame_pointer_needed. If the stack and frame grow in the same direction, then the first allocated slot is always closest to the initial stack pointer and furthest away from the final stack pointer, so allocate higher numbers first when using the stack pointer in that case. The reverse is true if the stack and frame grow in opposite directions.
References lra_reg_info, and pseudo_slot::slot_num.
Referenced by assign_stack_slot_num_and_sort_pseudos().
|
static |
|
static |
Recursively process LOC in INSN and change spilled pseudos to the corresponding memory or spilled hard reg. Ignore spilled pseudos created from the scratches.
References copy_rtx(), lra_former_scratch_p(), lra_get_regno_hard_regno(), pseudo_slot::mem, and spill_hard_reg.
Referenced by lra_undo_inheritance(), and spill_pseudos().
|
static |
Convert spilled pseudos into their stack slots or spill hard regs, put insns to process on the constraint stack (that is all insns in which pseudos were changed to memory or spill hard regs).
References bitmap_and_compl_into(), bitmap_bit_p(), bitmap_clear(), bitmap_ior_into(), bitmap_set_bit(), df_get_live_in(), df_get_live_out(), lra_dump_file, lra_former_scratch_p(), lra_get_regno_hard_regno(), lra_push_insn(), lra_reg_info, lra_reg_spill_p, lra_set_used_insn_alternative(), reg_obstack, regs_num, remove_pseudos(), spilled_pseudos, and targetm.
Referenced by lra_spill().
|
static |
The stack slots for each spilled pseudo. Indexed by regnos.
Referenced by lra_spill().
|
static |
@verbatim Change pseudos by memory.
Copyright (C) 2010-2013 Free Software Foundation, Inc. Contributed by Vladimir Makarov vmaka. rov@ redha t.co m
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see http://www.gnu.org/licenses/.
This file contains code for a pass to change spilled pseudos into memory. The pass creates necessary stack slots and assigns spilled pseudos to the stack slots in following way: for all spilled pseudos P most frequently used first do for all stack slots S do if P doesn't conflict with pseudos assigned to S then assign S to P and goto to the next pseudo process end end create new stack slot S and assign P to S end The actual algorithm is bit more complicated because of different pseudo sizes. After that the code changes spilled pseudos (except ones created from scratches) by corresponding stack slot memory in RTL. If at least one stack slot was created, we need to run more passes because we have new addresses which should be checked and because the old address displacements might change and address constraints (or insn memory constraints) might not be satisfied any more. For some targets, the pass can spill some pseudos into hard registers of different class (usually into vector registers) instead of spilling them into memory if it is possible and profitable. Spilling GENERAL_REGS pseudo into SSE registers for Intel Corei7 is an example of such optimization. And this is actually recommended by Intel optimization guide. The file also contains code for final change of pseudos on hard regs correspondingly assigned to them.
Max regno at the start of the pass.
Referenced by assign_spill_hard_regs(), lra_eliminate(), lra_spill(), and spill_pseudos().
|
static |
Array containing info about the stack slots. The array element is indexed by the stack slot number in the range [0..slots_num).
Referenced by change_stack(), pointer_map< T >::insert(), make_return_insns(), pointer_map< T >::pointer_map(), pointer_map< T >::traverse(), and pointer_map< T >::~pointer_map().
|
static |
The number of the stack slots currently existing.
Referenced by assign_stack_slot_num_and_sort_pseudos(), and lra_spill().
|
static |
Map spilled regno -> hard regno used instead of memory for spilling.
Referenced by assign_spill_hard_regs(), lra_spill(), reload(), and remove_pseudos().