GCC Middle and Back End API Reference
loop-invariant.cc File Reference
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "backend.h"
#include "target.h"
#include "rtl.h"
#include "tree.h"
#include "cfghooks.h"
#include "df.h"
#include "memmodel.h"
#include "tm_p.h"
#include "insn-config.h"
#include "regs.h"
#include "ira.h"
#include "recog.h"
#include "cfgrtl.h"
#include "cfgloop.h"
#include "expr.h"
#include "rtl-iter.h"
#include "dumpfile.h"
Include dependency graph for loop-invariant.cc:

Data Structures

class  loop_data
 
struct  use
 
struct  def
 
struct  invariant
 
struct  invariant_expr_entry
 
struct  invariant_expr_hasher
 

Macros

#define LOOP_DATA(LOOP)
 
#define MAX_CANON_ADDR_PARTS   (5)
 

Typedefs

typedef struct invariantinvariant_p
 
typedef hash_table< invariant_expr_hasherinvariant_htab_type
 

Functions

static void check_invariant_table_size (void)
 
static bool check_maybe_invariant (rtx x)
 
static struct invariantinvariant_for_use (df_ref use)
 
static hashval_t hash_invariant_expr_1 (rtx_insn *insn, rtx x)
 
static bool invariant_expr_equal_p (rtx_insn *insn1, rtx e1, rtx_insn *insn2, rtx e2)
 
static struct invariantfind_or_insert_inv (invariant_htab_type *eq, rtx expr, machine_mode mode, struct invariant *inv)
 
static void find_identical_invariants (invariant_htab_type *eq, struct invariant *inv)
 
static void merge_identical_invariants (void)
 
static void compute_always_reached (class loop *loop, basic_block *body, bitmap may_exit, bitmap always_reached)
 
static void find_exits (class loop *loop, basic_block *body, bitmap may_exit, bitmap has_exit)
 
static bool may_assign_reg_p (rtx x)
 
static void find_defs (class loop *loop)
 
static struct invariantcreate_new_invariant (struct def *def, rtx_insn *insn, bitmap depends_on, bool always_executed)
 
static void canonicalize_address_mult (rtx x)
 
static void collect_address_parts (rtx x, vec< rtx > *addr_parts)
 
static int compare_address_parts (const void *x, const void *y)
 
static rtx canonicalize_address (rtx x)
 
static bool inv_can_prop_to_addr_use (struct def *def, df_ref use)
 
static void record_use (struct def *def, df_ref use)
 
static bool check_dependency (basic_block bb, df_ref use, bitmap depends_on)
 
static bool check_dependencies (rtx_insn *insn, bitmap depends_on)
 
static bool pre_check_invariant_p (bool simple, rtx dest)
 
static void find_invariant_insn (rtx_insn *insn, bool always_reached, bool always_executed)
 
static void record_uses (rtx_insn *insn)
 
static void find_invariants_insn (rtx_insn *insn, bool always_reached, bool always_executed)
 
static void find_invariants_bb (class loop *loop, basic_block bb, bool always_reached, bool always_executed)
 
static void find_invariants_body (class loop *loop, basic_block *body, bitmap always_reached, bitmap always_executed)
 
static void find_invariants (class loop *loop)
 
static void free_use_list (struct use *use)
 
static enum reg_class get_pressure_class_and_nregs (rtx_insn *insn, int *nregs)
 
static int get_inv_cost (struct invariant *inv, int *comp_cost, unsigned *regs_needed, enum reg_class *cl)
 
static int gain_for_invariant (struct invariant *inv, unsigned *regs_needed, unsigned *new_regs, unsigned regs_used, bool speed, bool call_p)
 
static int best_gain_for_invariant (struct invariant **best, unsigned *regs_needed, unsigned *new_regs, unsigned regs_used, bool speed, bool call_p)
 
static void set_move_mark (unsigned invno, int gain)
 
static void find_invariants_to_move (bool speed, bool call_p)
 
static int replace_uses (struct invariant *inv, rtx reg, bool in_group)
 
static bool can_move_invariant_reg (class loop *loop, struct invariant *inv, rtx reg)
 
static bool move_invariant_reg (class loop *loop, unsigned invno)
 
static void move_invariants (class loop *loop)
 
static void init_inv_motion_data (void)
 
static void free_inv_motion_data (void)
 
static void move_single_loop_invariants (class loop *loop)
 
static void free_loop_data (class loop *loop)
 
static enum reg_class get_regno_pressure_class (int regno, int *nregs)
 
static void change_pressure (int regno, bool incr_p)
 
static void mark_regno_live (int regno)
 
static void mark_regno_death (int regno)
 
static void mark_reg_store (rtx reg, const_rtx setter, void *data)
 
static void mark_reg_clobber (rtx reg, const_rtx setter, void *data)
 
static void mark_reg_death (rtx reg)
 
static void mark_ref_regs (rtx x)
 
static void calculate_loop_reg_pressure (void)
 
void move_loop_invariants (void)
 

Variables

static class loopcurr_loop
 
static unsigned int invariant_table_size = 0
 
static struct invariant ** invariant_table
 
static unsigned actual_stamp
 
static vec< invariant_pinvariants
 
static bitmap_head curr_regs_live
 
static int curr_reg_pressure [N_REG_CLASSES]
 
static rtx regs_set [(FIRST_PSEUDO_REGISTER > MAX_RECOG_OPERANDS ? FIRST_PSEUDO_REGISTER :MAX_RECOG_OPERANDS) *2]
 
static int n_regs_set
 

Macro Definition Documentation

◆ LOOP_DATA

#define LOOP_DATA ( LOOP)

◆ MAX_CANON_ADDR_PARTS

#define MAX_CANON_ADDR_PARTS   (5)
Maximum number of sub expressions in address.  We set it to
a small integer since it's unlikely to have a complicated
address expression.   

Referenced by canonicalize_address().

Typedef Documentation

◆ invariant_htab_type

◆ invariant_p

typedef struct invariant* invariant_p

Function Documentation

◆ best_gain_for_invariant()

static int best_gain_for_invariant ( struct invariant ** best,
unsigned * regs_needed,
unsigned * new_regs,
unsigned regs_used,
bool speed,
bool call_p )
static
Finds invariant with best gain for moving.  Returns the gain, stores
the invariant in *BEST and number of registers needed for it to
*REGS_NEEDED.  REGS_USED is the number of registers used in the loop.
NEW_REGS is the number of new variables already added due to invariant
motion.   

References invariant::eqto, FOR_EACH_VEC_ELT, gain_for_invariant(), i, invariants, invariant::invno, ira_pressure_classes, ira_pressure_classes_num, and invariant::move.

Referenced by find_invariants_to_move().

◆ calculate_loop_reg_pressure()

◆ can_move_invariant_reg()

static bool can_move_invariant_reg ( class loop * loop,
struct invariant * inv,
rtx reg )
static

◆ canonicalize_address()

static rtx canonicalize_address ( rtx x)
static
Return a canonical version address for X by following steps:
  1) Rewrite ASHIFT into MULT recursively.
  2) Divide address into sub expressions with PLUS as the
     separator.
  3) Sort sub expressions according to precedence defined
     for communative operations.
  4) Simplify CONST_INT_P sub expressions.
  5) Create new canonicalized address and return.
Callers should prepare a copy of X because this function may
modify it in place.   

References canonicalize_address_mult(), collect_address_parts(), compare_address_parts(), CONST_INT_P, gcc_assert, GET_MODE, i, MAX_CANON_ADDR_PARTS, and simplify_gen_binary().

Referenced by inv_can_prop_to_addr_use().

◆ canonicalize_address_mult()

static void canonicalize_address_mult ( rtx x)
static
Return a canonical version of X for the address, from the point of view,
that all multiplications are represented as MULT instead of the multiply
by a power of 2 being represented as ASHIFT.

Callers should prepare a copy of X because this function may modify it
in place.   

References CONST_INT_P, FOR_EACH_SUBRTX_VAR, gen_int_mode(), GET_CODE, GET_MODE, GET_MODE_BITSIZE(), HOST_WIDE_INT_1, INTVAL, is_a(), PUT_CODE, shift, and XEXP.

Referenced by canonicalize_address().

◆ change_pressure()

static void change_pressure ( int regno,
bool incr_p )
static
Increase (if INCR_P) or decrease current register pressure for
register REGNO.   

References curr_loop, curr_reg_pressure, get_regno_pressure_class(), LOOP_DATA, and loop_data::max_reg_pressure.

Referenced by calculate_loop_reg_pressure(), mark_regno_death(), and mark_regno_live().

◆ check_dependencies()

static bool check_dependencies ( rtx_insn * insn,
bitmap depends_on )
static
Finds the invariants INSN depends on and store them to the DEPENDS_ON
bitmap.  Returns true if all dependencies of INSN are known to be
loop invariants, false otherwise.   

References BLOCK_FOR_INSN(), check_dependency(), DF_INSN_INFO_GET, FOR_EACH_INSN_INFO_EQ_USE, FOR_EACH_INSN_INFO_USE, and df_insn_info::insn.

Referenced by find_invariant_insn().

◆ check_dependency()

static bool check_dependency ( basic_block bb,
df_ref use,
bitmap depends_on )
static
Finds the invariants USE depends on and store them to the DEPENDS_ON
bitmap.  Returns true if all dependencies of USE are known to be
loop invariants, false otherwise.   

References bitmap_set_bit, CDI_DOMINATORS, check_invariant_table_size(), invariant::def, defs, invariant::depends_on, DF_HARD_REG_LIVE, DF_REF_BB, DF_REF_CHAIN, DF_REF_FLAGS, DF_REF_ID, DF_REF_READ_WRITE, DF_REF_REGNO, dominated_by_p(), gcc_assert, invariant_table, def::invno, insn_def::next, NULL, and targetm.

Referenced by check_dependencies().

◆ check_invariant_table_size()

static void check_invariant_table_size ( void )
static
Check the size of the invariant table and realloc if necessary.   

References DF_DEFS_TABLE_SIZE, invariant_table, and invariant_table_size.

Referenced by check_dependency(), find_defs(), find_invariant_insn(), free_inv_motion_data(), and invariant_for_use().

◆ check_maybe_invariant()

static bool check_maybe_invariant ( rtx x)
static

◆ collect_address_parts()

static void collect_address_parts ( rtx x,
vec< rtx > * addr_parts )
static
Collect sub expressions in address X with PLUS as the seperator.
Sub expressions are stored in vector ADDR_PARTS.   

References FOR_EACH_SUBRTX_VAR, and GET_CODE.

Referenced by canonicalize_address().

◆ compare_address_parts()

static int compare_address_parts ( const void * x,
const void * y )
static
Compare function for sorting sub expressions X and Y based on
precedence defined for communitive operations.   

References commutative_operand_precedence(), and y.

Referenced by canonicalize_address().

◆ compute_always_reached()

static void compute_always_reached ( class loop * loop,
basic_block * body,
bitmap may_exit,
bitmap always_reached )
static
Determines the basic blocks inside LOOP that are always executed and
stores their bitmap to ALWAYS_REACHED.  MAY_EXIT is a bitmap of
basic blocks that may either exit the loop, or contain the call that
does not have to return.  BODY is body of the loop obtained by
get_loop_body_in_dom_order.   

References bitmap_bit_p, bitmap_set_bit, CDI_DOMINATORS, dominated_by_p(), i, loop::latch, and loop::num_nodes.

Referenced by find_invariants().

◆ create_new_invariant()

static struct invariant * create_new_invariant ( struct def * def,
rtx_insn * insn,
bitmap depends_on,
bool always_executed )
static
Creates a new invariant for definition DEF in INSN, depending on invariants
in DEPENDS_ON.  ALWAYS_EXECUTED is true if the insn is always executed,
unless the program ends due to a function call.  The newly created invariant
is returned.   

References ADDR_SPACE_GENERIC, address_cost(), invariant::always_executed, BLOCK_FOR_INSN(), invariant::cheap_address, invariant::cost, invariant::def, invariant::depends_on, dump_bitmap(), dump_file, invariant::eqno, invariant::eqto, GET_MODE, invariant::insn, INSN_UID(), invariants, def::invno, invariant::invno, invariant::move, NULL_RTX, optimize_bb_for_speed_p(), invariant::orig_regno, invariant::reg, SCALAR_INT_MODE_P, SET_DEST, set_rtx_cost(), SET_SRC, set_src_cost(), single_set(), invariant::stamp, and word_mode.

Referenced by find_invariant_insn().

◆ find_defs()

static void find_defs ( class loop * loop)
static
Finds definitions that may correspond to invariants in LOOP with body
BODY.   

References check_invariant_table_size(), df_analyze_loop(), df_chain_add_problem(), df_dump_region(), DF_RD_PRUNE_DEAD_DEFS, df_set_flags(), DF_UD_CHAIN, dump_file, and loop::num.

Referenced by find_invariants().

◆ find_exits()

static void find_exits ( class loop * loop,
basic_block * body,
bitmap may_exit,
bitmap has_exit )
static
Finds exits out of the LOOP with body BODY.  Marks blocks in that we may
exit the loop by cfg edge to HAS_EXIT and MAY_EXIT.  In MAY_EXIT
additionally mark blocks that may exit due to a call.   

References loop::aux, bitmap_initialize(), bitmap_set_bit, CALL_P, find_common_loop(), flow_bb_inside_loop_p(), flow_loop_nested_p(), FOR_BB_INSNS, FOR_EACH_EDGE, i, LOOP_DATA, NULL, loop::num_nodes, reg_obstack, RTL_CONST_OR_PURE_CALL_P, and RTL_LOOPING_CONST_OR_PURE_CALL_P.

Referenced by find_invariants().

◆ find_identical_invariants()

static void find_identical_invariants ( invariant_htab_type * eq,
struct invariant * inv )
static

◆ find_invariant_insn()

static void find_invariant_insn ( rtx_insn * insn,
bool always_reached,
bool always_executed )
static
Finds invariant in INSN.  ALWAYS_REACHED is true if the insn is always
executed.  ALWAYS_EXECUTED is true if the insn is always executed,
unless the program ends due to a function call.   

References invariant::always_executed, BITMAP_ALLOC, BITMAP_FREE, can_throw_internal(), check_dependencies(), check_invariant_table_size(), check_maybe_invariant(), create_new_invariant(), invariant::depends_on, df_find_def(), DF_REF_ID, HARD_REGISTER_P, invariant::insn, invariant_table, JUMP_P, may_assign_reg_p(), may_trap_or_fault_p(), NULL, PATTERN(), pre_check_invariant_p(), REG_P, SET_DEST, SET_SRC, and single_set().

Referenced by find_invariants_insn().

◆ find_invariants()

◆ find_invariants_bb()

static void find_invariants_bb ( class loop * loop,
basic_block bb,
bool always_reached,
bool always_executed )
static
Finds invariants in basic block BB.  ALWAYS_REACHED is true if the
basic block is always executed.  ALWAYS_EXECUTED is true if the basic
block is always executed, unless the program ends due to a function
call.   

References invariant::always_executed, CALL_P, basic_block_def::count, dump_file, find_invariants_insn(), FOR_BB_INSNS, basic_block_def::index, invariant::insn, loop_preheader_edge(), NONDEBUG_INSN_P, loop::num, RTL_CONST_OR_PURE_CALL_P, and RTL_LOOPING_CONST_OR_PURE_CALL_P.

Referenced by find_invariants_body().

◆ find_invariants_body()

static void find_invariants_body ( class loop * loop,
basic_block * body,
bitmap always_reached,
bitmap always_executed )
static
Finds invariants in LOOP with body BODY.  ALWAYS_REACHED is the bitmap of
basic blocks in BODY that are always executed.  ALWAYS_EXECUTED is the
bitmap of basic blocks in BODY that are always executed unless the program
ends due to a function call.   

References invariant::always_executed, bitmap_bit_p, find_invariants_bb(), i, and loop::num_nodes.

Referenced by find_invariants().

◆ find_invariants_insn()

static void find_invariants_insn ( rtx_insn * insn,
bool always_reached,
bool always_executed )
static
Finds invariants in INSN.  ALWAYS_REACHED is true if the insn is always
executed.  ALWAYS_EXECUTED is true if the insn is always executed,
unless the program ends due to a function call.   

References invariant::always_executed, find_invariant_insn(), invariant::insn, and record_uses().

Referenced by find_invariants_bb().

◆ find_invariants_to_move()

static void find_invariants_to_move ( bool speed,
bool call_p )
static

◆ find_or_insert_inv()

static struct invariant * find_or_insert_inv ( invariant_htab_type * eq,
rtx expr,
machine_mode mode,
struct invariant * inv )
static
Checks whether invariant with value EXPR in machine mode MODE is
recorded in EQ.  If this is the case, return the invariant.  Otherwise
insert INV to the table for this expression and return INV.   

References expr, invariant_expr_entry::expr, hash_table< Descriptor, Lazy, Allocator >::find_slot_with_hash(), invariant_expr_entry::hash, hash_invariant_expr_1(), invariant::insn, invariant_expr_entry::inv, and invariant_expr_entry::mode.

Referenced by find_identical_invariants().

◆ free_inv_motion_data()

static void free_inv_motion_data ( void )
static

◆ free_loop_data()

static void free_loop_data ( class loop * loop)
static
Releases the auxiliary data for LOOP.   

References loop::aux, bitmap_clear(), free(), LOOP_DATA, NULL, loop_data::regs_live, and loop_data::regs_ref.

Referenced by move_loop_invariants().

◆ free_use_list()

static void free_use_list ( struct use * use)
static
Frees a list of uses USE.   

References free(), and use::next.

Referenced by free_inv_motion_data().

◆ gain_for_invariant()

static int gain_for_invariant ( struct invariant * inv,
unsigned * regs_needed,
unsigned * new_regs,
unsigned regs_used,
bool speed,
bool call_p )
static
Calculates gain for eliminating invariant INV.  REGS_USED is the number
of registers used in the loop, NEW_REGS is the number of new variables
already added due to the invariant motion.  The number of registers needed
for it is stored in *REGS_NEEDED.  SPEED and CALL_P are flags passed
through to estimate_reg_pressure_cost.  

References actual_stamp, curr_loop, estimate_reg_pressure_cost(), get_inv_cost(), i, ira_class_hard_regs_num, ira_pressure_classes, ira_pressure_classes_num, LOOP_DATA, and reg_classes_intersect_p().

Referenced by best_gain_for_invariant().

◆ get_inv_cost()

static int get_inv_cost ( struct invariant * inv,
int * comp_cost,
unsigned * regs_needed,
enum reg_class * cl )
static
Calculates cost and number of registers needed for moving invariant INV
out of the loop and stores them to *COST and *REGS_NEEDED.  *CL will be
the REG_CLASS of INV.  Return
  -1: if INV is invalid.
   0: if INV and its depends_on have same reg_class
   1: if INV and its depends_on have different reg_classes.   

References actual_stamp, invariant::always_executed, def::can_prop_to_addr_uses, invariant::cheap_address, constant_pool_constant_p(), invariant::cost, invariant::def, invariant::depends_on, invariant::eqno, invariant::eqto, EXECUTE_IF_SET_IN_BITMAP, get_inv_cost(), GET_MODE, get_pressure_class_and_nregs(), i, invariant::insn, invariants, ira_pressure_classes, ira_pressure_classes_num, ira_stack_reg_pressure_class, invariant::move, def::n_addr_uses, def::n_uses, use::next, SET_SRC, single_set(), invariant::stamp, and def::uses.

Referenced by gain_for_invariant(), and get_inv_cost().

◆ get_pressure_class_and_nregs()

static enum reg_class get_pressure_class_and_nregs ( rtx_insn * insn,
int * nregs )
static
Return pressure class and number of hard registers (through *NREGS)
for destination of INSN.  

References gcc_assert, GET_CODE, GET_MODE, use::insn, ira_pressure_class_translate, ira_reg_class_max_nregs, MEM_P, NULL_RTX, reg_allocno_class(), REG_P, REGNO, SET_DEST, SET_SRC, single_set(), and SUBREG_REG.

Referenced by get_inv_cost().

◆ get_regno_pressure_class()

static enum reg_class get_regno_pressure_class ( int regno,
int * nregs )
static
Return pressure class and number of needed hard registers (through
*NREGS) of register REGNO.   

References eliminable_regset, ira_no_alloc_regs, ira_pressure_class_translate, ira_reg_class_max_nregs, PSEUDO_REGNO_MODE, reg_allocno_class(), and TEST_HARD_REG_BIT.

Referenced by calculate_loop_reg_pressure(), and change_pressure().

◆ hash_invariant_expr_1()

static hashval_t hash_invariant_expr_1 ( rtx_insn * insn,
rtx x )
static

◆ init_inv_motion_data()

static void init_inv_motion_data ( void )
static
Initializes invariant motion data.   

References actual_stamp, and invariants.

Referenced by move_single_loop_invariants().

◆ inv_can_prop_to_addr_use()

static bool inv_can_prop_to_addr_use ( struct def * def,
df_ref use )
static
Given invariant DEF and its address USE, check if the corresponding
invariant expr can be propagated into the use or not.   

References cancel_changes(), canonicalize_address(), invariant::cheap_address, copy_rtx(), DF_REF_INSN, DF_REF_REAL_LOC, GET_MODE, invariant::insn, invariants, def::invno, MEM_ADDR_SPACE, MEM_P, memory_address_addr_space_p(), NULL_RTX, SET_DEST, SET_SRC, single_set(), validate_unshare_change(), verify_changes(), and XEXP.

Referenced by record_use().

◆ invariant_expr_equal_p()

static bool invariant_expr_equal_p ( rtx_insn * insn1,
rtx e1,
rtx_insn * insn2,
rtx e2 )
static
Returns true if the invariant expressions E1 and E2 used in insns INSN1
and INSN2 have always the same value.   

References CASE_CONST_ANY, df_find_use(), invariant::eqto, gcc_assert, GET_CODE, GET_MODE, GET_RTX_FORMAT, GET_RTX_LENGTH, i, invariant_expr_equal_p(), invariant_for_use(), NULL, rtx_equal_p(), SUBREG_BYTE, XEXP, XINT, XVECEXP, and XVECLEN.

Referenced by invariant_expr_hasher::equal(), and invariant_expr_equal_p().

◆ invariant_for_use()

static struct invariant * invariant_for_use ( df_ref use)
static

◆ mark_ref_regs()

static void mark_ref_regs ( rtx x)
static
Mark occurrence of registers in X for the current loop.   

References bitmap_set_bit, curr_loop, current_loops, GET_CODE, GET_RTX_FORMAT, GET_RTX_LENGTH, i, LOOP_DATA, loop_outer(), mark_ref_regs(), REGNO, RTX_CODE, XEXP, XVECEXP, and XVECLEN.

Referenced by calculate_loop_reg_pressure(), and mark_ref_regs().

◆ mark_reg_clobber()

static void mark_reg_clobber ( rtx reg,
const_rtx setter,
void * data )
static
Mark clobbering register REG.   

References GET_CODE, and mark_reg_store().

Referenced by calculate_loop_reg_pressure().

◆ mark_reg_death()

static void mark_reg_death ( rtx reg)
static
Mark register REG death.   

References END_REGNO(), mark_regno_death(), and REGNO.

Referenced by calculate_loop_reg_pressure().

◆ mark_reg_store()

static void mark_reg_store ( rtx reg,
const_rtx setter,
void * data )
static
Mark setting register REG.   

References END_REGNO(), GET_CODE, mark_regno_live(), n_regs_set, REG_P, REGNO, regs_set, and SUBREG_REG.

Referenced by calculate_loop_reg_pressure(), and mark_reg_clobber().

◆ mark_regno_death()

static void mark_regno_death ( int regno)
static
Mark REGNO death.   

References bitmap_clear_bit(), change_pressure(), and curr_regs_live.

Referenced by mark_reg_death().

◆ mark_regno_live()

static void mark_regno_live ( int regno)
static

◆ may_assign_reg_p()

static bool may_assign_reg_p ( rtx x)
static
Check whether we may assign a value to X from a register.   

References can_copy_p(), frame_pointer_rtx, GET_MODE, HARD_REGISTER_P, REG_P, and REGNO.

Referenced by find_invariant_insn().

◆ merge_identical_invariants()

static void merge_identical_invariants ( void )
static
Find invariants with the same value and record the equivalences.   

References find_identical_invariants(), FOR_EACH_VEC_ELT, i, and invariants.

Referenced by find_invariants().

◆ move_invariant_reg()

◆ move_invariants()

static void move_invariants ( class loop * loop)
static

◆ move_loop_invariants()

◆ move_single_loop_invariants()

static void move_single_loop_invariants ( class loop * loop)
static

◆ pre_check_invariant_p()

static bool pre_check_invariant_p ( bool simple,
rtx dest )
static
Pre-check candidate DEST to skip the one which cannot make a valid insn
during move_invariant_reg.  SIMPLE is to skip HARD_REGISTER.   

References DF_INSN_INFO_GET, DF_REF_INSN, DF_REF_NEXT_REG, DF_REF_REGNO, DF_REG_DEF_COUNT, DF_REG_USE_CHAIN, FOR_EACH_INSN_INFO_DEF, i, REG_P, and REGNO.

Referenced by find_invariant_insn().

◆ record_use()

◆ record_uses()

static void record_uses ( rtx_insn * insn)
static
Record registers used in INSN that have a unique invariant definition.   

References invariant::def, DF_INSN_INFO_GET, FOR_EACH_INSN_INFO_EQ_USE, FOR_EACH_INSN_INFO_USE, df_insn_info::insn, invariant_for_use(), and record_use().

Referenced by find_invariants_insn().

◆ replace_uses()

static int replace_uses ( struct invariant * inv,
rtx reg,
bool in_group )
static
Replace the uses, reached by the definition of invariant INV, by REG.

IN_GROUP is nonzero if this is part of a group of changes that must be
performed as a group.  In that case, the changes will be stored.  The
function `apply_change_group' will validate and apply the changes.   

References apply_change_group(), invariant::def, use::insn, use::next, use::pos, def::uses, and validate_change().

Referenced by move_invariant_reg().

◆ set_move_mark()

static void set_move_mark ( unsigned invno,
int gain )
static
Marks invariant INVNO and all its dependencies for moving.   

References invariant::depends_on, dump_file, invariant::eqto, EXECUTE_IF_SET_IN_BITMAP, invariants, invariant::invno, invariant::move, and set_move_mark().

Referenced by find_invariants_to_move(), and set_move_mark().

Variable Documentation

◆ actual_stamp

unsigned actual_stamp
static
The actual stamp for marking already visited invariants during determining
costs of movements.   

Referenced by gain_for_invariant(), get_inv_cost(), and init_inv_motion_data().

◆ curr_loop

◆ curr_reg_pressure

int curr_reg_pressure[N_REG_CLASSES]
static
Current reg pressure for each pressure class.   

Referenced by calculate_loop_reg_pressure(), and change_pressure().

◆ curr_regs_live

bitmap_head curr_regs_live
static

◆ invariant_table

◆ invariant_table_size

unsigned int invariant_table_size = 0
static
Table of invariants indexed by the df_ref uid field.   

Referenced by check_invariant_table_size(), and move_loop_invariants().

◆ invariants

◆ n_regs_set

int n_regs_set
static
Number of regs stored in the previous array.   

Referenced by calculate_loop_reg_pressure(), and mark_reg_store().

◆ regs_set

rtx regs_set[(FIRST_PSEUDO_REGISTER > MAX_RECOG_OPERANDS ? FIRST_PSEUDO_REGISTER :MAX_RECOG_OPERANDS) *2]
static
Record all regs that are set in any one insn.  Communication from
mark_reg_{store,clobber} and global_conflicts.  Asm can refer to
all hard-registers.   

Referenced by calculate_loop_reg_pressure(), look_for_hardregs(), mark_reg_store(), replace_read(), and store_ops_ok().