GCC Middle and Back End API Reference
store-motion.c File Reference

Data Structures

struct  st_expr
struct  st_expr_hasher

Functions

static struct st_exprst_expr_entry ()
static void free_st_expr_entry ()
static void free_store_motion_mems ()
static int enumerate_store_motion_mems ()
static struct st_exprfirst_st_expr ()
static struct st_exprnext_st_expr ()
static void print_store_motion_mems ()
static bool store_ops_ok ()
static int extract_mentioned_regs_1 ()
static rtx extract_mentioned_regs ()
static bool load_kills_store ()
static bool find_loads ()
static bool store_killed_in_pat ()
static bool store_killed_in_insn ()
static bool store_killed_after (const_rtx x, const_rtx x_regs, const_rtx insn, const_basic_block bb, int *regs_set_after, rtx *fail_insn)
static bool store_killed_before (const_rtx x, const_rtx x_regs, const_rtx insn, const_basic_block bb, int *regs_set_before)
static void find_moveable_store ()
static int compute_store_table ()
static void insert_insn_start_basic_block ()
static int insert_store ()
static void remove_reachable_equiv_notes ()
static void replace_store_insn ()
static void delete_store ()
static void build_store_vectors ()
static void free_store_memory ()
static int one_store_motion_pass ()
static bool gate_rtl_store_motion ()
static unsigned int execute_rtl_store_motion ()
rtl_opt_passmake_pass_rtl_store_motion ()

Variables

static struct st_exprstore_motion_mems = NULL
static sbitmapst_kill
static sbitmapst_avloc
static sbitmapst_antloc
static sbitmapst_transp
static sbitmapst_insert_map
static sbitmapst_delete_map
static int num_stores
static struct edge_listedge_list
static hash_table< st_expr_hasherstore_motion_mems_table

Function Documentation

static void build_store_vectors ( )
static
static void delete_store ( )
static
Delete a store, but copy the value that would have been stored into
   the reaching_reg for later storing.   

References st_expr::avail_stores, gen_reg_rtx_and_attrs(), st_expr::pattern, st_expr::reaching_reg, and replace_store_insn().

Referenced by one_store_motion_pass().

static int enumerate_store_motion_mems ( )
static
Assign each element of the list of mems a monotonically increasing value.   

References st_expr::index, and st_expr::next.

Referenced by compute_store_table().

static unsigned int execute_rtl_store_motion ( )
static
static rtx extract_mentioned_regs ( )
static
Returns a list of registers mentioned in X.
   FIXME: A regset would be prettier and less expensive.   

References extract_mentioned_regs_1(), and for_each_rtx().

Referenced by find_moveable_store().

static int extract_mentioned_regs_1 ( )
static
Helper for extract_mentioned_regs.   

References alloc_EXPR_LIST().

Referenced by extract_mentioned_regs().

static bool find_loads ( )
static
Go through the entire rtx X, looking for any loads which might alias
   STORE_PATTERN.  Return true if found.
   AFTER is true if we are checking the case when STORE_PATTERN occurs
   after the insn X.   

References load_kills_store(), and SET.

Referenced by store_killed_in_insn(), and store_killed_in_pat().

static void find_moveable_store ( )
static
Determine whether INSN is MEM store pattern that we will consider moving.
   REGS_SET_BEFORE is bitmap of registers set before (and including) the
   current insn, REGS_SET_AFTER is bitmap of registers set after (and
   including) the insn in this basic block.  We must be passing through BB from
   head to end, as we are using this fact to speed things up.

   The results are stored this way:

   -- the first anticipatable expression is added into ANTIC_STORES
   -- if the processed expression is not anticipatable, NULL_RTX is added
      there instead, so that we can use it as indicator that no further
      expression of this type may be anticipatable
   -- if the expression is available, it is added as head of AVAIL_STORES;
      consequently, all of them but this head are dead and may be deleted.
   -- if the expression is not available, the insn due to that it fails to be
      available is stored in REACHING_REG (via LAST_AVAIL_CHECK_FAILURE).

   The things are complicated a bit by fact that there already may be stores
   to the same MEM from other blocks; also caller must take care of the
   necessary cleanup of the temporary markers after end of the basic block.

References alloc_INSN_LIST(), st_expr::antic_stores, st_expr::avail_stores, can_assign_to_reg_without_clobbers_p(), function::can_throw_non_call_exceptions, cfun, extract_mentioned_regs(), find_reg_note(), may_trap_p(), st_expr::pattern_regs, side_effects_p(), st_expr_entry(), store_killed_after(), and store_killed_before().

Referenced by compute_store_table().

static struct st_expr* first_st_expr ( )
staticread
static void free_st_expr_entry ( )
static
Free up an individual st_expr entry.   

References st_expr::antic_stores, st_expr::avail_stores, free(), and free_INSN_LIST_list().

Referenced by compute_store_table(), and free_store_motion_mems().

static void free_store_memory ( )
static
Free memory used by store motion.   

References free_store_motion_mems(), and sbitmap_vector_free().

Referenced by one_store_motion_pass().

static void free_store_motion_mems ( )
static
static bool gate_rtl_store_motion ( )
static
static void insert_insn_start_basic_block ( )
static
In all code following after this, REACHING_REG has its original
   meaning again.  Avoid confusion, and undef the accessor macro for
   the temporary marks usage in compute_store_table.   
Insert an instruction at the beginning of a basic block, and update
   the BB_HEAD if needed.   

References dump_file, emit_insn_after_noloc(), basic_block_def::index, and print_inline_rtx().

Referenced by insert_store().

static int insert_store ( )
static
This routine will insert a store on an edge. EXPR is the st_expr entry for
   the memory reference, and E is the edge to insert it on.  Returns nonzero
   if an edge insertion was performed.   

References bitmap_bit_p(), bitmap_clear_bit(), copy_rtx(), edge_def::dest, dump_file, edge_def::flags, gen_move_insn(), st_expr::index, basic_block_def::index, insert_insn_on_edge(), insert_insn_start_basic_block(), st_expr::pattern, basic_block_def::preds, print_inline_rtx(), st_expr::reaching_reg, and edge_def::src.

Referenced by one_store_motion_pass().

static bool load_kills_store ( )
static
Check to see if the load X is aliased with STORE_PATTERN.
   AFTER is true if we are checking the case when STORE_PATTERN occurs
   after the X.   

References anti_dependence(), and true_dependence().

Referenced by find_loads().

rtl_opt_pass* make_pass_rtl_store_motion ( )
static struct st_expr* next_st_expr ( )
staticread
Return the next item in the list after the specified one.   

References st_expr::next.

Referenced by build_store_vectors(), compute_store_table(), one_store_motion_pass(), and print_store_motion_mems().

static void print_store_motion_mems ( )
static
Dump debugging info about the store_motion_mems list.   

References st_expr::antic_stores, st_expr::avail_stores, dump_file, first_st_expr(), st_expr::index, next_st_expr(), st_expr::pattern, and print_rtl().

Referenced by compute_store_table().

static void remove_reachable_equiv_notes ( )
static
Remove any REG_EQUAL or REG_EQUIV notes containing a reference to the
   memory location in SMEXPR set in basic block BB.

   This could be rather expensive.   

References st_expr::antic_stores, bitmap_bit_p(), bitmap_clear(), bitmap_set_bit(), edge_def::dest, dump_file, ei_container(), ei_edge(), ei_end_p(), ei_next(), exp_equiv_p(), find_reg_equal_equiv_note(), free(), st_expr::index, basic_block_def::index, last, st_expr::pattern, remove_note(), sbitmap_alloc(), sbitmap_free(), stack, basic_block_def::succs, and visited.

Referenced by replace_store_insn().

static void replace_store_insn ( )
static
static struct st_expr* st_expr_entry ( )
staticread
This will search the st_expr list for a matching expression. If it
   doesn't find one, we create one and initialize it.   

References st_expr::antic_stores, st_expr::avail_stores, hash_table< Descriptor, Allocator >::find_slot_with_hash(), st_expr::hash_index, hash_rtx(), st_expr::index, st_expr::next, st_expr::pattern, st_expr::pattern_regs, st_expr::reaching_reg, and store_motion_mems.

Referenced by find_moveable_store().

static bool store_killed_after ( const_rtx  x,
const_rtx  x_regs,
const_rtx  insn,
const_basic_block  bb,
int *  regs_set_after,
rtx fail_insn 
)
static
Returns true if the expression X is loaded or clobbered on or after INSN
   within basic block BB.  REGS_SET_AFTER is bitmap of registers set in
   or after the insn.  X_REGS is list of registers mentioned in X. If the store
   is killed, return the last insn in that it occurs in FAIL_INSN.   

References last, store_killed_in_insn(), and store_ops_ok().

Referenced by build_store_vectors(), and find_moveable_store().

static bool store_killed_before ( const_rtx  x,
const_rtx  x_regs,
const_rtx  insn,
const_basic_block  bb,
int *  regs_set_before 
)
static
Returns true if the expression X is loaded or clobbered on or before INSN
   within basic block BB. X_REGS is list of registers mentioned in X.
   REGS_SET_BEFORE is bitmap of registers set before or in this insn.   

References first, store_killed_in_insn(), and store_ops_ok().

Referenced by find_moveable_store().

static bool store_killed_in_insn ( )
static
Check if INSN kills the store pattern X (is aliased with it).
   AFTER is true if we are checking the case when store X occurs
   after the insn.  Return true if it does.   

References exp_equiv_p(), find_loads(), find_reg_equal_equiv_note(), may_be_sp_based_p(), SET, and store_killed_in_pat().

Referenced by store_killed_after(), and store_killed_before().

static bool store_killed_in_pat ( )
inlinestatic
Go through pattern PAT looking for any loads which might kill the
   store in X.  Return true if found.
   AFTER is true if we are checking the case when loads kill X occurs
   after the insn for PAT.   

References exp_equiv_p(), find_loads(), output_dependence(), and SET.

Referenced by store_killed_in_insn().

static bool store_ops_ok ( )
static
Return zero if some of the registers in list X are killed
   due to set of registers in bitmap REGS_SET.   

Referenced by store_killed_after(), and store_killed_before().


Variable Documentation

struct edge_list* edge_list
static
Contains the edge_list returned by pre_edge_lcm.   

Referenced by compute_pre_data(), one_pre_gcse_pass(), optimize_mode_switching(), pre_edge_lcm(), and pre_edge_rev_lcm().

int num_stores
static
Global holding the number of store expressions we are dealing with.   

Referenced by build_store_vectors(), infer_value_range(), and one_store_motion_pass().

sbitmap * st_antloc
static
sbitmap * st_avloc
static
sbitmap* st_delete_map
static
Nonzero for expressions which should be deleted in a specific block.   
sbitmap* st_insert_map
static
Nonzero for expressions which should be inserted on a specific edge.   
sbitmap* st_kill
static
These bitmaps will hold the local dataflow properties per basic block.   
sbitmap * st_transp
static
struct st_expr* store_motion_mems = NULL
static
Head of the list of load/store memory refs.   

Referenced by first_st_expr(), free_store_motion_mems(), and st_expr_entry().

hash_table<st_expr_hasher> store_motion_mems_table
static
Hashtable for the load/store memory refs.