GCC Middle and Back End API Reference
ira-lives.c File Reference

Functions

static void make_hard_regno_born ()
static void make_hard_regno_dead ()
static void make_object_born ()
static void update_allocno_pressure_excess_length ()
static void make_object_dead ()
static void inc_register_pressure ()
static void dec_register_pressure ()
static bool pseudo_regno_single_word_and_live_p ()
static void mark_pseudo_regno_live ()
static void mark_pseudo_regno_subword_live ()
static void mark_hard_reg_live ()
static void mark_pseudo_reg_live ()
static void mark_ref_live ()
static void mark_pseudo_regno_dead ()
static void mark_pseudo_regno_subword_dead ()
static void mark_hard_reg_dead ()
static void mark_pseudo_reg_dead ()
static void mark_ref_dead ()
static bool make_pseudo_conflict (rtx reg, enum reg_class cl, rtx dreg, rtx orig_dreg, bool advance_p)
static bool check_and_make_def_use_conflict (rtx dreg, rtx orig_dreg, enum reg_class def_cl, int use, enum reg_class use_cl, bool advance_p)
static void check_and_make_def_conflict ()
static void make_early_clobber_and_input_conflicts ()
static bool mark_hard_reg_early_clobbers ()
static enum reg_class single_reg_class ()
static enum reg_class single_reg_operand_class ()
void ira_implicitly_set_insn_hard_regs ()
static void process_single_reg_class_operands ()
static bool bb_has_abnormal_call_pred ()
static rtx find_call_crossed_cheap_reg ()
static void process_bb_node_lives ()
static void create_start_finish_chains ()
void ira_rebuild_start_finish_chains ()
static void remove_some_program_points_and_update_live_ranges ()
void ira_print_live_range_list ()
DEBUG_FUNCTION void debug ()
void ira_debug_live_range_list ()
static void print_object_live_ranges ()
static void print_allocno_live_ranges ()
void ira_debug_allocno_live_ranges ()
static void print_live_ranges ()
void ira_debug_live_ranges ()
void ira_create_allocno_live_ranges ()
void ira_compress_allocno_live_ranges ()
void ira_finish_allocno_live_ranges ()

Variables

int ira_max_point
live_range_tira_start_point_ranges
live_range_tira_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]

Function Documentation

static bool bb_has_abnormal_call_pred ( )
static
Return true when one of the predecessor edges of BB is marked with
   EDGE_ABNORMAL_CALL or EDGE_EH.   

References edge_def::flags, and basic_block_def::preds.

Referenced by process_bb_node_lives().

static void check_and_make_def_conflict ( )
static
static bool check_and_make_def_use_conflict ( rtx  dreg,
rtx  orig_dreg,
enum reg_class  def_cl,
int  use,
enum reg_class  use_cl,
bool  advance_p 
)
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.   

References recog_data_d::constraints, make_pseudo_conflict(), recog_data_d::n_operands, recog_data_d::operand, recog_data, and reg_classes_intersect_p().

Referenced by check_and_make_def_conflict().

static void create_start_finish_chains ( )
static
DEBUG_FUNCTION void debug ( )
static void dec_register_pressure ( )
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 curr_reg_pressure, high_pressure_start_point, ira_object_id_map, and update_allocno_pressure_excess_length().

Referenced by mark_hard_reg_dead(), mark_pseudo_regno_dead(), and mark_pseudo_regno_subword_dead().

static rtx find_call_crossed_cheap_reg ( )
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 exp(), modified_between_p(), pseudo_regno_single_word_and_live_p(), reg_overlap_mentioned_p(), rtx_equal_p(), and SET.

Referenced by process_bb_node_lives().

static void inc_register_pressure ( )
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 curr_point, curr_reg_pressure, high_pressure_start_point, and ira_loop_tree_node::reg_pressure.

Referenced by mark_hard_reg_live(), mark_pseudo_regno_live(), and mark_pseudo_regno_subword_live().

void ira_compress_allocno_live_ranges ( void  )
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.   

References allocno_saved_at_call, create_start_finish_chains(), curr_point, internal_flag_ira_verbose, ira_allocate(), ira_allocnos_num, ira_dump_file, ira_free(), ira_loop_tree_root, ira_max_point, ira_objects_num, ira_traverse_loop_tree(), last_call_num, memset(), print_live_ranges(), process_bb_node_lives(), and sparseset_alloc().

Referenced by ira_build().

void ira_debug_allocno_live_ranges ( )
Print live ranges of allocno A to stderr.   

References print_allocno_live_ranges().

void ira_debug_live_range_list ( )
Print live ranges R to stderr.   

References ira_print_live_range_list().

void ira_debug_live_ranges ( void  )
Print live ranges of all allocnos to stderr.   

References print_live_ranges().

void ira_finish_allocno_live_ranges ( void  )
Free arrays IRA_START_POINT_RANGES and IRA_FINISH_POINT_RANGES.   

References ira_free().

Referenced by ira_destroy().

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.   

References add_to_hard_reg_set(), recog_data_d::alternative_enabled_p, recog_data_d::constraints, recog_data_d::n_operands, recog_data_d::operand, and recog_data.

Referenced by implicit_clobber_conflict_p(), and sched_analyze_insn().

void ira_print_live_range_list ( )
Print live ranges R to file F.   

References live_range::finish, live_range::next, and live_range::start.

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.   

References create_start_finish_chains(), and ira_free().

Referenced by ira_compress_allocno_live_ranges(), ira_flattening(), remove_low_level_allocnos(), and remove_unnecessary_allocnos().

static void make_early_clobber_and_input_conflicts ( )
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.   

References check_and_make_def_conflict(), operand_alternative::cl, recog_data_d::n_alternatives, recog_data_d::n_operands, recog_data, and recog_op_alt.

Referenced by process_bb_node_lives().

static void make_hard_regno_born ( )
static
Record the birth of hard register REGNO, updating hard_regs_live and
   hard reg conflict information for living allocnos.   

References hard_regs_live, and ira_object_id_map.

Referenced by mark_hard_reg_live(), and process_bb_node_lives().

static void make_hard_regno_dead ( )
static
Process the death of hard register REGNO.  This updates
   hard_regs_live.   

References hard_regs_live.

Referenced by mark_hard_reg_dead().

static void make_object_born ( )
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 curr_point, live_range::finish, hard_regs_live, ira_add_live_range_to_object(), and sparseset_set_bit().

Referenced by mark_pseudo_regno_live(), and mark_pseudo_regno_subword_live().

static void make_object_dead ( )
static
Process the death of object OBJ, which is associated with allocno
   A.  This finishes the current live range for it.   

References curr_point, live_range::finish, sparseset_clear_bit(), and update_allocno_pressure_excess_length().

Referenced by mark_pseudo_regno_dead(), mark_pseudo_regno_subword_dead(), and process_bb_node_lives().

static bool make_pseudo_conflict ( rtx  reg,
enum reg_class  cl,
rtx  dreg,
rtx  orig_dreg,
bool  advance_p 
)
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.   

References curr_point, ira_curr_regno_allocno_map, mark_pseudo_reg_dead(), mark_pseudo_reg_live(), and reg_classes_intersect_p().

Referenced by check_and_make_def_use_conflict().

static void mark_hard_reg_dead ( )
static
Mark the hard register REG as dead.  Store a 0 in hard_regs_live for the
   register.   

References dec_register_pressure(), hard_regs_live, last, and make_hard_regno_dead().

Referenced by mark_ref_dead().

static bool mark_hard_reg_early_clobbers ( )
static
Mark early clobber hard registers of the current INSN as live (if
   LIVE_P) or dead.  Return true if there are such registers.   

References DF_REF_MUST_CLOBBER, mark_ref_dead(), and mark_ref_live().

Referenced by process_bb_node_lives().

static void mark_hard_reg_live ( )
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 eliminable_regset, hard_regs_live, inc_register_pressure(), last, and make_hard_regno_born().

Referenced by mark_ref_live().

static void mark_pseudo_reg_dead ( )
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.   

References df_read_modify_subreg_p(), mark_pseudo_regno_dead(), mark_pseudo_regno_subword_dead(), and subreg_lowpart_p().

Referenced by make_pseudo_conflict(), and mark_ref_dead().

static void mark_pseudo_reg_live ( )
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 df_read_modify_subreg_p(), mark_pseudo_regno_live(), mark_pseudo_regno_subword_live(), and subreg_lowpart_p().

Referenced by make_pseudo_conflict(), and mark_ref_live().

static void mark_pseudo_regno_dead ( )
static
Mark the pseudo register REGNO as dead.  Update all information about
   live ranges and register pressure.   

References allocno_saved_at_call, dec_register_pressure(), ira_curr_regno_allocno_map, make_object_dead(), and sparseset_bit_p().

Referenced by mark_pseudo_reg_dead().

static void mark_pseudo_regno_live ( )
static
Mark the pseudo register REGNO as live.  Update all information about
   live ranges and register pressure.   

References allocno_saved_at_call, inc_register_pressure(), ira_curr_regno_allocno_map, make_object_born(), and sparseset_bit_p().

Referenced by mark_pseudo_reg_live(), mark_pseudo_regno_subword_live(), and process_bb_node_lives().

static void mark_pseudo_regno_subword_dead ( )
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.   

References allocno_saved_at_call, dec_register_pressure(), ira_curr_regno_allocno_map, make_object_dead(), and sparseset_bit_p().

Referenced by mark_pseudo_reg_dead().

static void mark_pseudo_regno_subword_live ( )
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.   

References allocno_saved_at_call, inc_register_pressure(), ira_curr_regno_allocno_map, make_object_born(), mark_pseudo_regno_live(), and sparseset_bit_p().

Referenced by mark_pseudo_reg_live().

static void mark_ref_dead ( )
static
Mark the register referenced by definition DEF as dead, if the
   definition is a total one.   

References df_read_modify_subreg_p(), DF_REF_CONDITIONAL, DF_REF_PARTIAL, mark_hard_reg_dead(), and mark_pseudo_reg_dead().

Referenced by mark_hard_reg_early_clobbers(), and process_bb_node_lives().

static void mark_ref_live ( )
static
Mark the register referenced by use or def REF as live.   

References mark_hard_reg_live(), and mark_pseudo_reg_live().

Referenced by mark_hard_reg_early_clobbers(), and process_bb_node_lives().

static void print_allocno_live_ranges ( )
static
Print live ranges of allocno A to file F.   

References print_object_live_ranges().

Referenced by ira_debug_allocno_live_ranges(), and print_live_ranges().

static void print_live_ranges ( )
static
Print live ranges of all allocnos to file F.   

References print_allocno_live_ranges().

Referenced by ira_compress_allocno_live_ranges(), ira_create_allocno_live_ranges(), and ira_debug_live_ranges().

static void print_object_live_ranges ( )
static
Print live ranges of object OBJ to file F.   

References ira_print_live_range_list().

Referenced by print_allocno_live_ranges().

static void process_single_reg_class_operands ( )
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.   

References HOST_WIDE_INT, ira_allocate_and_set_costs(), ira_curr_regno_allocno_map, ira_init_register_move_cost_if_necessary(), ira_object_id_map, recog_data_d::n_operands, offset, OP_IN, OP_INOUT, OP_OUT, recog_data_d::operand, recog_data_d::operand_mode, recog_data_d::operand_type, recog_data, simplify_subreg_regno(), single_reg_operand_class(), and subreg_lowpart_offset().

Referenced by process_bb_node_lives().

static bool pseudo_regno_single_word_and_live_p ( )
static
Determine from the objects_live bitmap whether REGNO is currently live,
   and occupies only one object.  Return false if we have no information.   

References ira_curr_regno_allocno_map, and sparseset_bit_p().

Referenced by find_call_crossed_cheap_reg().

static void remove_some_program_points_and_update_live_ranges ( )
static
static enum reg_class single_reg_class ( )
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.   

References recog_data_d::alternative_enabled_p, recog_data_d::constraints, constraints, recog_data_d::operand, and recog_data.

Referenced by single_reg_operand_class().

static enum reg_class single_reg_operand_class ( )
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.   

References recog_data_d::constraints, recog_data_d::n_alternatives, recog_data_d::operand, recog_data, and single_reg_class().

Referenced by process_single_reg_class_operands().

static void update_allocno_pressure_excess_length ( )
static
Update ALLOCNO_EXCESS_PRESSURE_POINTS_NUM for the allocno
   associated with object OBJ.   

References curr_point, high_pressure_start_point, and live_range::start.

Referenced by dec_register_pressure(), and make_object_dead().


Variable Documentation

int* allocno_saved_at_call
static
sparseset allocnos_processed
static
A temporary bitmap used in functions that wish to avoid visiting an allocno
   multiple times.   
ira_loop_tree_node_t curr_bb_node
static
The loop tree node corresponding to the current basic block.   
int curr_reg_pressure[N_REG_CLASSES]
static
The current register pressures for each pressure class for the current
   basic block.   

Referenced by dec_register_pressure(), inc_register_pressure(), and process_bb_node_lives().

int high_pressure_start_point[N_REG_CLASSES]
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(), inc_register_pressure(), process_bb_node_lives(), and update_allocno_pressure_excess_length().

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.nosp@m.rov@.nosp@m.redha.nosp@m.t.co.nosp@m.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 add_range_and_copies_from_move_list(), build_conflict_bit_table(), create_start_finish_chains(), fast_allocation(), ira(), ira_build(), ira_create_allocno_live_ranges(), ira_flattening(), remove_some_program_points_and_update_live_ranges(), setup_min_max_allocno_live_range_point(), and setup_min_max_conflict_allocno_ids().

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.   

Referenced by build_conflict_bit_table(), and ira_flattening().

int last_call_num
static
The number of the last processed call.   

Referenced by ira_create_allocno_live_ranges(), and process_bb_node_lives().

sparseset objects_live
static
Objects live at current point in the scan.   

Referenced by build_conflict_bit_table(), and ira_flattening().