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

Data Structures

struct  elim_table
struct  elim_table_1

Functions

static void print_elim_table ()
void lra_debug_elim_table ()
static void setup_can_eliminate ()
static void setup_elimination_map ()
static rtx form_sum ()
int lra_get_elimination_hard_regno ()
static struct elim_tableget_elimination ()
rtx lra_eliminate_regs_1 (rtx x, enum machine_mode mem_mode, bool subst_p, bool update_p, bool full_p)
rtx lra_eliminate_regs (rtx x, enum machine_mode mem_mode, rtx insn)
static void mark_not_eliminable ()
static void eliminate_regs_in_insn ()
static void spill_pseudos ()
static bool update_reg_eliminate ()
static void init_elim_table ()
void lra_init_elimination ()
void lra_eliminate_reg_if_possible ()
static void process_insn_for_elimination ()
void lra_eliminate ()

Variables

static struct elim_tablereg_eliminate = 0
static struct elim_table_1 reg_eliminate_1 []
static struct elim_tableelimination_map [FIRST_PSEUDO_REGISTER]
static struct elim_table self_elim_table
static HOST_WIDE_INT self_elim_offsets [FIRST_PSEUDO_REGISTER]
static rtx eliminable_reg_rtx [FIRST_PSEUDO_REGISTER]

Function Documentation

static rtx form_sum ( )
static
Compute the sum of X and Y, making canonicalizations assumed in an
   address, namely: sum constant integers, surround the sum of two
   constants with a CONST, put the constant as the second operand, and
   group the constant on the outermost sum.

   This routine assumes both inputs are already in canonical form.   

References plus_constant().

Referenced by eliminate_regs_1(), form_sum(), lra_eliminate_regs_1(), and subst_indexed_address().

static struct elim_table* get_elimination ( )
staticread
static void init_elim_table ( void  )
static
void lra_debug_elim_table ( void  )
Print info about elimination table to stderr.   

References print_elim_table().

void lra_eliminate_reg_if_possible ( )
Eliminate hard reg given by its location LOC.   

References get_elimination(), lra_no_alloc_regs, and elim_table::to_rtx.

Referenced by in_class_p(), and valid_address_p().

rtx lra_eliminate_regs ( rtx  x,
enum machine_mode  mem_mode,
rtx  insn 
)
This function is used externally in subsequent passes of GCC.  It
   always does a full elimination of X.   

References lra_eliminate_regs_1().

Referenced by based_loc_descr(), and compute_frame_pointer_to_fb_displacement().

rtx lra_eliminate_regs_1 ( rtx  x,
enum machine_mode  mem_mode,
bool  subst_p,
bool  update_p,
bool  full_p 
)
Scan X and replace any eliminable registers (such as fp) with a
   replacement (such as sp) if SUBST_P, plus an offset.  The offset is
   a change in the offset between the eliminable register and its
   substitution if UPDATE_P, or the full offset if FULL_P, or
   otherwise zero.

   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 hard register
   and the constant zero with the hard register, which we cannot do
   outside a MEM.  In addition, we need to record the fact that a
   hard register is referenced outside a MEM.

   Alternatively, INSN may be a note (an EXPR_LIST or INSN_LIST).
   That's used when we eliminate in expressions stored in notes.   

References alloc_reg_note(), alter_subreg(), current_function_decl, form_sum(), elim_table::from_rtx, gen_rtvec_v(), get_elimination(), HOST_WIDE_INT, lra_eliminate_regs_1(), elim_table::offset, offset, plus_constant(), elim_table::previous_offset, replace_equiv_address_nv(), SET, simplify_gen_subreg(), elim_table::to, and elim_table::to_rtx.

Referenced by assign_mem_slot(), eliminate_regs_in_insn(), lra_eliminate(), lra_eliminate_regs(), and lra_eliminate_regs_1().

int lra_get_elimination_hard_regno ( )
Return the current substitution hard register of the elimination of
   HARD_REGNO.  If HARD_REGNO is not eliminable, return itself.   

References elim_table::to.

Referenced by get_final_hard_regno().

void lra_init_elimination ( void  )
Entry function for initialization of elimination once per
   function.   

References init_elim_table(), mark_not_eliminable(), and setup_elimination_map().

Referenced by ira_setup_eliminable_regset().

static void mark_not_eliminable ( )
static
Scan rtx X for references to elimination source or target registers
   in contexts that would prevent the elimination from happening.
   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::from_rtx, SET, setup_can_eliminate(), and elim_table::to_rtx.

Referenced by lra_init_elimination(), and reload().

static void print_elim_table ( )
static
static void process_insn_for_elimination ( )
static
Do (final if FINAL_P) elimination in INSN.  Add the insn for
   subsequent processing in the constraint pass, update the insn info.   

References eliminate_regs_in_insn(), lra_push_insn(), lra_set_used_insn_alternative(), lra_update_insn_recog_data(), lra_update_insn_regno_info(), and recog().

Referenced by lra_eliminate().

static void setup_can_eliminate ( )
static
Setup possibility of elimination in elimination table element EP to
   VALUE.  Setup FRAME_POINTER_NEEDED if elimination from frame
   pointer to stack pointer is not possible anymore.   

References elim_table::can_eliminate, elim_table::from, elim_table::prev_can_eliminate, and elim_table::to.

Referenced by init_elim_table(), mark_not_eliminable(), and update_reg_eliminate().

static void setup_elimination_map ( )
static
Set up ELIMINATION_MAP of the currently used eliminations.   

References elim_table::can_eliminate, and elim_table::from.

Referenced by lra_init_elimination(), and update_reg_eliminate().

static void spill_pseudos ( )
static
Spill pseudos which are assigned to hard registers in SET.  Add
   affected insns for processing in the subsequent constraint
   pass.   

References bitmap_bit_p(), bitmap_clear(), bitmap_ior_into(), get_insns(), hard_reg_set_empty_p(), lra_dump_file, lra_no_alloc_regs, lra_push_insn(), lra_reg_info, lra_set_used_insn_alternative(), max_reg_num(), overlaps_hard_reg_set_p(), reg_obstack, and reg_renumber.

Referenced by update_reg_eliminate().

static bool update_reg_eliminate ( )
static
Update all offsets and possibility for elimination on eliminable
   registers.  Spill pseudos assigned to registers which became
   uneliminable, update LRA_NO_ALLOC_REGS and ELIMINABLE_REG_SET.  Add
   insns to INSNS_WITH_CHANGED_OFFSETS containing eliminable hard
   registers whose offsets should be changed.  Return true if any
   elimination offset changed.   

References bitmap_ior_into(), elim_table::can_eliminate, eliminable_regset, elim_table::from, lra_reg::insn_bitmap, lra_dump_file, lra_no_alloc_regs, lra_reg_info, lra_update_reg_val_offset(), elim_table::offset, elim_table::prev_can_eliminate, elim_table::previous_offset, self_elim_offsets, setup_can_eliminate(), setup_elimination_map(), spill_pseudos(), targetm, elim_table::to, and lra_reg::val.

Referenced by lra_eliminate().


Variable Documentation

rtx eliminable_reg_rtx[FIRST_PSEUDO_REGISTER]
static
Map: hard regno -> RTL presentation.       RTL presentations of all
   potentially eliminable hard registers are stored in the map.   

Referenced by get_elimination(), and init_elim_table().

struct elim_table* elimination_map[FIRST_PSEUDO_REGISTER]
static
Map: eliminable "from" register -> its current elimination,
   or NULL if none.  The elimination table may contain more than
   one elimination for the same hard register, but this map specifies
   the one that we are currently using.   
struct elim_table* reg_eliminate = 0
static
The elimination table.  Each array entry describes one possible way
   of eliminating a register in favor of another.  If there is more
   than one way of eliminating a particular register, the most
   preferred should be specified first.   
struct elim_table_1 reg_eliminate_1[]
static

Referenced by init_elim_table().

HOST_WIDE_INT self_elim_offsets[FIRST_PSEUDO_REGISTER]
static
Offsets should be used to restore original offsets for eliminable
   hard register which just became not eliminable.  Zero,
   otherwise.   

Referenced by get_elimination(), init_elim_table(), and update_reg_eliminate().

struct elim_table self_elim_table
static
When an eliminable hard register becomes not eliminable, we use the
   following special structure to restore original offsets for the
   register.   

Referenced by get_elimination(), and init_elim_table().