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

Functions

static void free_live_range ()
static void free_live_range_list ()
static lra_live_range_t create_live_range ()
static lra_live_range_t copy_live_range ()
lra_live_range_t lra_copy_live_range_list ()
lra_live_range_t lra_merge_live_ranges ()
bool lra_intersected_live_ranges_p ()
static void make_hard_regno_born ()
static void make_hard_regno_dead ()
static void mark_pseudo_live ()
static void mark_pseudo_dead ()
static bool mark_regno_live ()
static bool mark_regno_dead ()
static bool bb_has_abnormal_call_pred ()
static void next_program_point ()
void lra_setup_reload_pseudo_preferenced_hard_reg (int regno, int hard_regno, int profit)
static void check_pseudos_live_through_calls ()
static void process_bb_lives ()
static void remove_some_program_points_and_update_live_ranges ()
void lra_print_live_range_list ()
DEBUG_FUNCTION void debug ()
void lra_debug_live_range_list ()
static void print_pseudo_live_ranges ()
void lra_debug_pseudo_live_ranges ()
static void print_live_ranges ()
void lra_debug_live_ranges ()
static void compress_live_ranges ()
void lra_create_live_ranges ()
void lra_clear_live_ranges ()
void lra_live_ranges_init ()
void lra_live_ranges_finish ()

Variables

int lra_live_max_point
int lra_hard_reg_usage [FIRST_PSEUDO_REGISTER]
static bool complete_info_p
static sparseset pseudos_live
static sparseset pseudos_live_through_calls
static sparseset pseudos_live_through_setjumps
static HARD_REG_SET hard_regs_live
static sparseset start_living
static sparseset start_dying
static sparseset unused_set
static sparseset dead_set
static alloc_pool live_range_pool
static rtx curr_insn
static lra_insn_recog_data_t curr_id
static struct
lra_static_insn_data
curr_static_id
static vec< int > point_freq_vec
int * lra_point_freq
int lra_live_range_iter

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_lives().

static void check_pseudos_live_through_calls ( )
inlinestatic
Check that REGNO living through calls and setjumps, set up conflict
   regs, and clear corresponding bits in PSEUDOS_LIVE_THROUGH_CALLS and
   PSEUDOS_LIVE_THROUGH_SETJUMPS.   

References lra_reg::call_p, lra_reg_info, sparseset_bit_p(), and sparseset_clear_bit().

Referenced by process_bb_lives().

static void compress_live_ranges ( )
static
static lra_live_range_t copy_live_range ( )
static
Copy live range R and return the result.   

References pool_alloc().

Referenced by lra_copy_live_range_list().

static lra_live_range_t create_live_range ( )
static
Create and return pseudo live range with given attributes.   

References lra_live_range::finish, lra_live_range::next, pool_alloc(), lra_live_range::regno, and lra_live_range::start.

Referenced by mark_pseudo_live().

DEBUG_FUNCTION void debug ( )
static void free_live_range ( )
static
Free live range LR.        

References pool_free().

Referenced by free_live_range_list(), and remove_some_program_points_and_update_live_ranges().

static void free_live_range_list ( )
static
Free live range list LR.   

References free_live_range(), and lra_live_range::next.

Referenced by lra_clear_live_ranges().

void lra_clear_live_ranges ( void  )
Finish all live ranges.   

References free_live_range_list(), lra_reg_info, and max_reg_num().

Referenced by lra().

lra_live_range_t lra_copy_live_range_list ( )
Copy live range list given by its head R and return the result.   

References copy_live_range(), first, and lra_live_range::next.

void lra_debug_live_range_list ( )
Print live ranges R to stderr.   

References lra_print_live_range_list().

void lra_debug_live_ranges ( void  )
Print live ranges of all pseudos to stderr.        

References print_live_ranges().

void lra_debug_pseudo_live_ranges ( )
Print live ranges of pseudo REGNO to stderr.        

References print_pseudo_live_ranges().

bool lra_intersected_live_ranges_p ( )
Return TRUE if live ranges R1 and R2 intersect.   

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

void lra_live_ranges_finish ( void  )
Finish live ranges data once per function.   

References free_alloc_pool().

Referenced by lra().

void lra_live_ranges_init ( void  )
Initialize live ranges data once per function.   

References create_alloc_pool().

Referenced by lra().

lra_live_range_t lra_merge_live_ranges ( )
Merge *non-intersected* ranges R1 and R2 and returns the result.
   The function maintains the order of ranges and tries to minimize
   size of the result range list.  Ranges R1 and R2 may not be used
   after the call.   

References lra_live_range::finish, first, last, lra_live_range::next, pool_free(), and lra_live_range::start.

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

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

void lra_setup_reload_pseudo_preferenced_hard_reg ( int  regno,
int  hard_regno,
int  profit 
)
static void make_hard_regno_born ( )
static
The function processing birth of hard register REGNO.  It updates
   living hard regs, conflict hard regs for living pseudos, and
   START_LIVING.   

References hard_regs_live, lra_no_alloc_regs, lra_reg_info, and sparseset_set_bit().

Referenced by mark_regno_live(), and process_bb_lives().

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

References hard_regs_live, lra_no_alloc_regs, and sparseset_set_bit().

Referenced by mark_regno_dead(), and process_bb_lives().

static void mark_pseudo_dead ( )
static
Mark pseudo REGNO as not living at program point POINT and update
   START_DYING.
   This finishes the current live range for the pseudo corresponding
   to REGNO.   

References complete_info_p, lra_live_range::finish, lra_reg::live_ranges, lra_get_regno_hard_regno(), lra_reg_info, sparseset_bit_p(), sparseset_clear_bit(), and sparseset_set_bit().

Referenced by mark_regno_dead(), and process_bb_lives().

static void mark_pseudo_live ( )
static
Mark pseudo REGNO as living at program point POINT, update conflicting
   hard registers of the pseudo and START_LIVING, and start a new live
   range for the pseudo corresponding to REGNO if it is necessary.   

References complete_info_p, create_live_range(), lra_live_range::finish, hard_regs_live, lra_reg::live_ranges, lra_get_regno_hard_regno(), lra_reg_info, sparseset_bit_p(), and sparseset_set_bit().

Referenced by mark_regno_live(), and process_bb_lives().

static bool mark_regno_dead ( )
static
Mark register REGNO in MODE as dead at program point POINT.
   Return TRUE if the liveness tracking sets were modified,
   or FALSE if nothing changed.   

References changed, last, make_hard_regno_dead(), mark_pseudo_dead(), and sparseset_bit_p().

Referenced by process_bb_lives().

static bool mark_regno_live ( )
static
Mark register REGNO (pseudo or hard register) in MODE as live
   at program point POINT.
   Return TRUE if the liveness tracking sets were modified,
   or FALSE if nothing changed.   

References changed, last, make_hard_regno_born(), mark_pseudo_live(), and sparseset_bit_p().

Referenced by process_bb_lives().

static void next_program_point ( )
static
Increment the current program point POINT to the next point which has
   execution frequency FREQ.   

References lra_point_freq.

Referenced by process_bb_lives().

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

References max_reg_num(), max_regno, and print_pseudo_live_ranges().

Referenced by compress_live_ranges(), lra_create_live_ranges(), and lra_debug_live_ranges().

static void print_pseudo_live_ranges ( )
static
Print live ranges of pseudo REGNO to file F.        

References lra_print_live_range_list(), and lra_reg_info.

Referenced by lra_debug_pseudo_live_ranges(), and print_live_ranges().

static void remove_some_program_points_and_update_live_ranges ( )
static
Compress pseudo live ranges by removing program points where
   nothing happens.  Complexity of many algorithms in LRA is linear
   function of program points number.  To speed up the code we try to
   minimize the number of the program points here.   

References bitmap_bit_p(), bitmap_clear(), bitmap_ior(), bitmap_set_bit(), lra_live_range::finish, free(), free_live_range(), lra_dump_file, lra_live_max_point, lra_point_freq, lra_reg_info, map, max_reg_num(), max_regno, lra_live_range::next, sbitmap_alloc(), sbitmap_free(), and lra_live_range::start.

Referenced by compress_live_ranges().


Variable Documentation

bool complete_info_p
static
A global flag whose true value says to build live ranges for all
   pseudos, otherwise the live ranges only for pseudos got memory is
   build.  True value means also building copies and setting up hard
   register preferences.  The complete info is necessary only for the
   assignment pass.  The complete info is not needed for the
   coalescing and spill passes.   

Referenced by lra_create_live_ranges(), mark_pseudo_dead(), mark_pseudo_live(), and process_bb_lives().

lra_insn_recog_data_t curr_id
static
The insn data.   
rtx curr_insn
static
Insn currently scanned.   

Referenced by process_bb_lives().

struct lra_static_insn_data* curr_static_id
static
The insn static data.   
sparseset dead_set
static
HARD_REG_SET hard_regs_live
static
Set of hard regs (except eliminable ones) currently live.   

Referenced by make_hard_regno_born(), make_hard_regno_dead(), mark_pseudo_live(), and process_bb_lives().

alloc_pool live_range_pool
static
Pool for pseudo live ranges.        
int lra_hard_reg_usage[FIRST_PSEUDO_REGISTER]
Accumulated execution frequency of all references for each hard
   register.   

Referenced by find_hard_regno_for(), lra_create_live_ranges(), lra_setup_reg_renumber(), process_bb_lives(), and setup_live_pseudos_and_spill_after_risky_transforms().

int lra_live_max_point
@verbatim Build live ranges for pseudos.

Copyright (C) 2010-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/.

This file contains code to build pseudo live-ranges (analogous
   structures used in IRA, so read comments about the live-ranges
   there) and other info necessary for other passes to assign
   hard-registers to pseudos, coalesce the spilled pseudos, and assign
   stack memory slots to spilled pseudos.   
Program points are enumerated by numbers from range
   0..LRA_LIVE_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 assign_spill_hard_regs(), create_live_range_start_chains(), init_live_reload_and_inheritance_pseudos(), init_lives(), lra_create_live_ranges(), and remove_some_program_points_and_update_live_ranges().

int lra_live_range_iter
The number of the current live range pass.   

Referenced by lra().

int* lra_point_freq
The start of the above vector elements.   

Referenced by lra_create_live_ranges(), next_program_point(), and remove_some_program_points_and_update_live_ranges().

vec<int> point_freq_vec
static
Vec containing execution frequencies of program points.   
sparseset pseudos_live
static
Pseudos live at current point in the RTL scan.   
sparseset pseudos_live_through_calls
static
Pseudos probably living through calls and setjumps.       As setjump is
   a call too, if a bit in PSEUDOS_LIVE_THROUGH_SETJUMPS is set up
   then the corresponding bit in PSEUDOS_LIVE_THROUGH_CALLS is set up
   too.  These data are necessary for cases when only one subreg of a
   multi-reg pseudo is set up after a call.  So we decide it is
   probably live when traversing bb backward.  We are sure about
   living when we see its usage or definition of the pseudo.   
sparseset pseudos_live_through_setjumps
static
sparseset start_dying
static
sparseset start_living
static
Set of pseudos and hard registers start living/dying in the current
   insn.  These sets are used to update REG_DEAD and REG_UNUSED notes
   in the insn.   
sparseset unused_set
static
Set of pseudos and hard regs dead and unused in the current
   insn.