GCC Middle and Back End API Reference
|
Variables | |
int | ira_max_point |
live_range_t * | ira_start_point_ranges |
live_range_t * | ira_finish_point_ranges |
static int | curr_point |
static int | high_pressure_start_point [N_REG_CLASSES] |
static sparseset | objects_live |
static sparseset | allocnos_processed |
static HARD_REG_SET | hard_regs_live |
static ira_loop_tree_node_t | curr_bb_node |
static int | last_call_num |
static int * | allocno_saved_at_call |
static int | curr_reg_pressure [N_REG_CLASSES] |
|
static |
Return true when one of the predecessor edges of BB is marked with EDGE_ABNORMAL_CALL or EDGE_EH.
References modified_between_p(), and pseudo_regno_single_word_and_live_p().
|
static |
Check and make if necessary conflicts for definition DEF of class DEF_CL of the current insn with input operands. Process only constraints of alternative ALT.
If there's any alternative that allows USE to match DEF, do not record a conflict. If that causes us to create an invalid instruction due to the earlyclobber, reload must fix it up.
|
static |
Check and make if necessary conflicts for pseudo DREG of class DEF_CL of the current insn with input operand USE of class USE_CL. ORIG_DREG is the rtx actually accessed, it may be identical to DREG or a subreg of it. Advance the current program point before making the conflict if ADVANCE_P. Return TRUE if we will need to advance the current program point.
Reload may end up swapping commutative operands, so you have to take both orderings into account. The constraints for the two operands can be completely different. (Indeed, if the constraints for the two operands are the same for all alternatives, there's no point marking them as commutative.)
|
static |
Create and set up IRA_START_POINT_RANGES and IRA_FINISH_POINT_RANGES.
DEBUG_FUNCTION void debug | ( | ) |
|
static |
Record that register pressure for PCLASS has decreased by NREGS registers; update current register pressure, start point of the register pressure excess, and register pressure excess length for living allocnos.
References high_pressure_start_point, ira_object_id_map, and update_allocno_pressure_excess_length().
Referenced by mark_pseudo_regno_subword_dead().
|
static |
Look through the CALL_INSN_FUNCTION_USAGE of a call insn INSN, and see if we find a SET rtx that we can use to deduce that a register can be cheaply caller-saved. Return such a register, or NULL_RTX if none is found.
References ira_loop_tree_node::bb, df_get_live_out(), eliminable_regset, hard_regs_live, high_pressure_start_point, last_call_num, mark_pseudo_regno_live(), ira_loop_tree_node::reg_pressure, and sparseset_clear().
Referenced by process_bb_node_lives().
|
static |
Record that register pressure for PCLASS increased by N registers. Update the current register pressure, maximal register pressure for the current BB and the start point of the register pressure excess.
References high_pressure_start_point.
Referenced by mark_pseudo_regno_live().
void ira_compress_allocno_live_ranges | ( | void | ) |
Compress allocno live ranges.
void ira_create_allocno_live_ranges | ( | void | ) |
The main entry function creates live ranges, set up CONFLICT_HARD_REGS and TOTAL_CONFLICT_HARD_REGS for objects, and calculate register pressure info.
Clean up.
void ira_debug_allocno_live_ranges | ( | ) |
Print live ranges of allocno A to stderr.
void ira_debug_live_range_list | ( | ) |
Print live ranges R to stderr.
References internal_flag_ira_verbose, ira_dump_file, ira_rebuild_start_finish_chains(), and remove_some_program_points_and_update_live_ranges().
void ira_debug_live_ranges | ( | void | ) |
Print live ranges of all allocnos to stderr.
void ira_finish_allocno_live_ranges | ( | void | ) |
Free arrays IRA_START_POINT_RANGES and IRA_FINISH_POINT_RANGES.
void ira_implicitly_set_insn_hard_regs | ( | ) |
The function sets up hard register set *SET to hard registers which might be used by insn reloads because the constraints are too strict.
There is no register pressure problem if all of the regs in this class are fixed.
Referenced by undo_transformations().
void ira_print_live_range_list | ( | ) |
Print live ranges R to file F.
References ira_objects_num, and sparseset_alloc().
void ira_rebuild_start_finish_chains | ( | void | ) |
Rebuild IRA_START_POINT_RANGES and IRA_FINISH_POINT_RANGES after new live ranges and program points were added as a result if new insn generation.
Referenced by ira_debug_live_range_list().
|
static |
Make conflicts of early clobber pseudo registers of the current insn with its inputs. Avoid introducing unnecessary conflicts by checking classes of the constraints and pseudos because otherwise significant code degradation is possible for some targets.
Referenced by process_bb_node_lives().
|
static |
Record the birth of hard register REGNO, updating hard_regs_live and hard reg conflict information for living allocnos.
References hard_regs_live.
|
static |
Process the death of hard register REGNO. This updates hard_regs_live.
Referenced by mark_pseudo_regno_subword_dead().
|
static |
Record the birth of object OBJ. Set a bit for it in objects_live, start a new live range for it if necessary and update hard register conflicts.
References high_pressure_start_point.
Referenced by mark_pseudo_regno_live().
|
static |
Process the death of object OBJ, which is associated with allocno A. This finishes the current live range for it.
|
static |
If REG is a pseudo or a subreg of it, and the class of its allocno intersects CL, make a conflict with pseudo DREG. ORIG_DREG is the rtx actually accessed, it may be identical to DREG or a subreg of it. Advance the current program point before making the conflict if ADVANCE_P. Return TRUE if we will need to advance the current program point.
|
static |
Mark the hard register REG as dead. Store a 0 in hard_regs_live for the register.
|
static |
Mark early clobber hard registers of the current INSN as live (if LIVE_P) or dead. Return true if there are such registers.
Hard register clobbers are believed to be early clobber because there is no way to say that non-operand hard register clobbers are not early ones.
Referenced by process_bb_node_lives().
|
static |
Mark the register REG as live. Store a 1 in hard_regs_live for this register, record how many consecutive hardware registers it actually needs.
References df_read_modify_subreg_p(), mark_pseudo_regno_live(), mark_pseudo_regno_subword_live(), and subreg_lowpart_p().
|
static |
Mark a pseudo, or one of its subwords, as dead. REGNO is the pseudo's register number; ORIG_REG is the access in the insn, which may be a subreg.
|
static |
Mark a pseudo, or one of its subwords, as live. REGNO is the pseudo's register number; ORIG_REG is the access in the insn, which may be a subreg.
References allocno_saved_at_call, and ira_curr_regno_allocno_map.
|
static |
Mark the pseudo register REGNO as dead. Update all information about live ranges and register pressure.
Invalidate because it is referenced.
We track every subobject separately.
|
static |
Mark the pseudo register REGNO as live. Update all information about live ranges and register pressure.
Invalidate because it is referenced.
We track every subobject separately.
References inc_register_pressure(), make_object_born(), and sparseset_bit_p().
Referenced by find_call_crossed_cheap_reg(), and mark_hard_reg_live().
|
static |
Like mark_pseudo_regno_dead, but called when we know that only part of the register dies. SUBWORD indicates which; a value of 0 indicates the low part.
Invalidate because it is referenced.
The allocno as a whole doesn't die in this case.
References dec_register_pressure(), hard_regs_live, and make_hard_regno_dead().
|
static |
Like mark_pseudo_regno_live, but try to only mark one subword of the pseudo as live. SUBWORD indicates which; a value of 0 indicates the low part.
Invalidate because it is referenced.
Referenced by mark_hard_reg_live().
|
static |
Mark the register referenced by definition DEF as dead, if the definition is a total one.
Referenced by process_bb_node_lives().
|
static |
Mark the register referenced by use or def REF as live.
Referenced by process_bb_node_lives().
|
static |
Print live ranges of allocno A to file F.
References ira_free().
|
static |
Print live ranges of all allocnos to file F.
Referenced by print_object_live_ranges().
|
static |
Print live ranges of object OBJ to file F.
References ira_dump_file, and print_live_ranges().
|
static |
Process insns of the basic block given by its LOOP_TREE_NODE to update allocno live ranges, allocno hard register conflicts, intersected calls, and register pressure info for allocnos for the basic block for and regions containing the basic block.
Invalidate all allocno_saved_at_call entries.
Scan the code of this basic block, noting which allocnos and hard regs are born or die. Note that this loop treats uninitialized values as live until the beginning of the block. For example, if an instruction uses (reg:DI foo), and only (subreg:SI (reg:DI foo) 0) is ever set, FOO will remain live until the beginning of the block. Likewise if FOO is not set at all. This is unnecessarily pessimistic, but it probably doesn't matter much in practice.
Mark each defined value as live. We need to do this for unused values because they still conflict with quantities that are live at the time of the definition. Ignore DF_REF_MAY_CLOBBERs on a call instruction. Such references represent the effect of the called function on a call-clobbered register. Marking the register as live would stop us from allocating it to a call-crossing allocno.
If INSN has multiple outputs, then any value used in one of the outputs conflicts with the other outputs. Model this by making the used value live during the output phase. It is unsafe to use !single_set here since it will ignore an unused output. Just because an output is unused does not mean the compiler can assume the side effect will not occur. Consider if ALLOCNO appears in the address of an output and we reload the output. If we allocate ALLOCNO to the same hard register as an unused output we could set the hard register before the output reload insn.
After the previous loop, this is a no-op if REG is contained within SET_DEST (SET).
See which defined values die here.
Try to find a SET in the CALL_INSN_FUNCTION_USAGE, and from there, try to find a pseudo that is live across the call but can be cheaply reconstructed from the return value.
The current set of live allocnos are live across the call.
Don't allocate allocnos that cross setjmps or any call, if this function receives a nonlocal goto.
Here we are mimicking caller-save.c behaviour which does not save hard register at a call if it was saved on previous call in the same basic block and the hard register was not mentioned between the two calls.
Mark it as saved at the next call.
Mark each used value as live.
Mark each hard reg as live again. For example, a hard register can be in clobber and in an insn input.
Allocnos can't go in stack regs at the start of a basic block that is reached by an abnormal edge. Likewise for call clobbered regs, because caller-save, fixup_abnormal_edges and possibly the table driven EH machinery are not quite ready to handle such allocnos live across such edges.
No need to record conflicts for call clobbered regs if we have nonlocal labels around, as we don't ever try to allocate such regs in this case.
Propagate register pressure to upper loop tree nodes:
References add_reg_note(), allocno_saved_at_call, can_throw_internal(), cfun, curr_point, DF_REF_MAY_CLOBBER, extract_insn(), find_call_crossed_cheap_reg(), find_reg_note(), function::has_nonlocal_label, internal_flag_ira_verbose, ira_dump_file, ira_object_id_map, last_call_num, ira_loop_tree_node::loop_num, make_early_clobber_and_input_conflicts(), mark_hard_reg_early_clobbers(), mark_ref_dead(), mark_ref_live(), multiple_sets(), ira_loop_tree_node::parent, preprocess_constraints(), process_single_reg_class_operands(), reg_overlap_mentioned_p(), SET, sparseset_bit_p(), sparseset_clear(), and sparseset_set_bit().
|
static |
Processes input operands, if IN_P, or output operands otherwise of the current insn with FREQ to find allocno which can use only one hard register and makes other currently living allocnos conflicting with the hard register.
View the desired allocation of OPERAND as: (REG:YMODE YREGNO), a simplification of: (subreg:YMODE (reg:XMODE XREGNO) OFFSET).
We could increase costs of A instead of making it conflicting with the hard register. But it works worse because it will be spilled in reload in anyway.
References ira_allocate_and_set_costs(), and ira_init_register_move_cost_if_necessary().
Referenced by process_bb_node_lives().
|
static |
Determine from the objects_live bitmap whether REGNO is currently live, and occupies only one object. Return false if we have no information.
Referenced by bb_has_abnormal_call_pred().
|
static |
Compress allocno live ranges by removing program points where nothing happens.
Referenced by ira_debug_live_range_list().
|
static |
Checks that CONSTRAINTS permits to use only one hard register. If it is so, the function returns the class of the hard register. Otherwise it returns NO_REGS.
??? what about memory
|
static |
The function checks that operand OP_NUM of the current insn can use only one hard register. If it is so, the function returns the class of the hard register. Otherwise it returns NO_REGS.
|
static |
Update ALLOCNO_EXCESS_PRESSURE_POINTS_NUM for the allocno associated with object OBJ.
Referenced by dec_register_pressure().
|
static |
The number of last call at which given allocno was saved.
Referenced by mark_pseudo_reg_live(), and process_bb_node_lives().
|
static |
A temporary bitmap used in functions that wish to avoid visiting an allocno multiple times.
|
static |
The loop tree node corresponding to the current basic block.
|
static |
Number of the current program point.
Referenced by lra_debug_live_range_list(), and process_bb_node_lives().
|
static |
The current register pressures for each pressure class for the current basic block.
|
static |
Set of hard regs (except eliminable ones) currently live.
Referenced by find_call_crossed_cheap_reg(), make_hard_regno_born(), and mark_pseudo_regno_subword_dead().
|
static |
Point where register pressure excess started or -1 if there is no register pressure excess. Excess pressure for a register class at some point means that there are more allocnos of given register class living at the point than number of hard-registers of the class available for the allocation. It is defined only for pressure classes.
Referenced by dec_register_pressure(), find_call_crossed_cheap_reg(), inc_register_pressure(), and make_object_born().
live_range_t * ira_finish_point_ranges |
int ira_max_point |
@verbatim
IRA processing allocno lives to build allocno live ranges. Copyright (C) 2006-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/.
The code in this file is similar to one in global but the code works on the allocno basis and creates live ranges instead of pseudo-register conflicts.
Program points are enumerated by numbers from range 0..IRA_MAX_POINT-1. There are approximately two times more program points than insns. Program points are places in the program where liveness info can be changed. In most general case (there are more complicated cases too) some program points correspond to places where input operand dies and other ones correspond to places where output operands are born.
Referenced by split_live_ranges_for_shrink_wrap().
live_range_t* ira_start_point_ranges |
Arrays of size IRA_MAX_POINT mapping a program point to the allocno live ranges with given start/finish point.
|
static |
The number of the last processed call.
Referenced by find_call_crossed_cheap_reg(), and process_bb_node_lives().
|
static |
Objects live at current point in the scan.