GCC Middle and Back End API Reference
dse.c File Reference

Data Structures

struct  store_info
struct  read_info
struct  insn_info
struct  bb_info
struct  group_info
struct  deferred_change
struct  clear_alias_mode_holder
struct  invariant_group_base_hasher
struct  note_add_store_info

Macros

#define MAX_OFFSET   (64 * 1024)

Typedefs

typedef struct store_infostore_info_t
typedef struct read_inforead_info_t
typedef struct insn_infoinsn_info_t
typedef struct bb_infobb_info_t
typedef struct group_infogroup_info_t
typedef struct group_infoconst_group_info_t
typedef struct deferred_changedeferred_change_t

Functions

static unsigned HOST_WIDE_INT lowpart_bitmask ()
static bool gate_dse1 (void)
static bool gate_dse2 (void)
static struct
clear_alias_mode_holder
clear_alias_set_lookup ()
static group_info_t get_group_info ()
static void dse_step0 ()
static void free_store_info ()
static void note_add_store ()
static int emit_inc_dec_insn_before (rtx mem, rtx op, rtx dest, rtx src, rtx srcoff, void *arg)
static bool check_for_inc_dec_1 ()
bool check_for_inc_dec ()
static void delete_dead_store_insn ()
static bool local_variable_can_escape ()
static bool can_escape ()
static void set_usage_bits (group_info_t group, HOST_WIDE_INT offset, HOST_WIDE_INT width, tree expr)
static void reset_active_stores ()
static void free_read_records ()
static void add_wild_read ()
static void add_non_frame_wild_read ()
static bool const_or_frame_p ()
static bool canon_address (rtx mem, alias_set_type *alias_set_out, int *group_id, HOST_WIDE_INT *offset, cselib_val **base)
static void clear_rhs_from_active_local_stores ()
static void set_position_unneeded ()
static void set_all_positions_unneeded ()
static bool any_positions_needed_p ()
static bool all_positions_needed_p ()
static rtx get_stored_val (store_info_t, enum machine_mode, HOST_WIDE_INT, HOST_WIDE_INT, basic_block, bool)
static int record_store ()
static void dump_insn_info ()
static rtx find_shift_sequence (int access_size, store_info_t store_info, enum machine_mode read_mode, int shift, bool speed, bool require_cst)
static void look_for_hardregs ()
static bool replace_read (store_info_t store_info, insn_info_t store_insn, read_info_t read_info, insn_info_t read_insn, rtx *loc, bitmap regs_live)
static int check_mem_read_rtx ()
static void check_mem_read_use ()
static bool get_call_args ()
static bitmap copy_fixed_regs ()
static void scan_insn ()
static void remove_useless_values ()
static void dse_step1 ()
static void dse_step2_init ()
static bool dse_step2_nospill ()
static int get_bitmap_index ()
static void scan_stores_nospill ()
static void scan_stores_spill ()
static void scan_reads_nospill ()
static void scan_reads_spill ()
static insn_info_t find_insn_before_first_wild_read ()
static void dse_step3_scan ()
static void dse_step3_exit_block_scan ()
static void mark_reachable_blocks ()
static void dse_step3 ()
static void dse_confluence_0 ()
static bool dse_confluence_n ()
static bool dse_transfer_function ()
static void dse_step4 ()
static void dse_step5_nospill ()
static void dse_step6 ()
static void dse_step7 ()
static unsigned int rest_of_handle_dse ()
rtl_opt_passmake_pass_rtl_dse1 ()
rtl_opt_passmake_pass_rtl_dse2 ()

Variables

static bitmap_obstack dse_bitmap_obstack
static struct obstack dse_obstack
static bitmap scratch = NULL
static alloc_pool cse_store_info_pool
static alloc_pool rtx_store_info_pool
static alloc_pool read_info_pool
static alloc_pool insn_info_pool
static insn_info_t active_local_stores
static int active_local_stores_len
static alloc_pool bb_info_pool
static bb_info_tbb_table
static alloc_pool rtx_group_info_pool
static int rtx_group_next_id
static vec< group_info_trtx_group_vec
static alloc_pool deferred_change_pool
static deferred_change_t deferred_change_list = NULL
static group_info_t clear_alias_group
static htab_t clear_alias_mode_table
static bool stores_off_frame_dead_at_return
static int globally_deleted
static int locally_deleted
static int spill_deleted
static bitmap all_blocks
static bitmap kill_on_calls
static unsigned int current_position
static hash_table
< invariant_group_base_hasher
rtx_group_table

Macro Definition Documentation

#define MAX_OFFSET   (64 * 1024)
@verbatim RTL dead store elimination.

Copyright (C) 2005-2013 Free Software Foundation, Inc.

Contributed by Richard Sandiford rsand.nosp@m.ifor.nosp@m.@code.nosp@m.sour.nosp@m.cery..nosp@m.com and Kenneth Zadeck zadec.nosp@m.k@na.nosp@m.tural.nosp@m.brid.nosp@m.ge.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 three techniques for performing Dead Store
   Elimination (dse).

   * The first technique performs dse locally on any base address.  It
   is based on the cselib which is a local value numbering technique.
   This technique is local to a basic block but deals with a fairly
   general addresses.

   * The second technique performs dse globally but is restricted to
   base addresses that are either constant or are relative to the
   frame_pointer.

   * The third technique, (which is only done after register allocation)
   processes the spill spill slots.  This differs from the second
   technique because it takes advantage of the fact that spilling is
   completely free from the effects of aliasing.

   Logically, dse is a backwards dataflow problem.  A store can be
   deleted if it if cannot be reached in the backward direction by any
   use of the value being stored.  However, the local technique uses a
   forwards scan of the basic block because cselib requires that the
   block be processed in that order.

   The pass is logically broken into 7 steps:

   0) Initialization.

   1) The local algorithm, as well as scanning the insns for the two
   global algorithms.

   2) Analysis to see if the global algs are necessary.  In the case
   of stores base on a constant address, there must be at least two
   stores to that address, to make it possible to delete some of the
   stores.  In the case of stores off of the frame or spill related
   stores, only one store to an address is necessary because those
   stores die at the end of the function.

   3) Set up the global dataflow equations based on processing the
   info parsed in the first step.

   4) Solve the dataflow equations.

   5) Delete the insns that the global analysis has indicated are
   unnecessary.

   6) Delete insns that store the same value as preceding store
   where the earlier store couldn't be eliminated.

   7) Cleanup.

   This step uses cselib and canon_rtx to build the largest expression
   possible for each address.  This pass is a forwards pass through
   each basic block.  From the point of view of the global technique,
   the first pass could examine a block in either direction.  The
   forwards ordering is to accommodate cselib.

   We make a simplifying assumption: addresses fall into four broad
   categories:

   1) base has rtx_varies_p == false, offset is constant.
   2) base has rtx_varies_p == false, offset variable.
   3) base has rtx_varies_p == true, offset constant.
   4) base has rtx_varies_p == true, offset variable.

   The local passes are able to process all 4 kinds of addresses.  The
   global pass only handles 1).

   The global problem is formulated as follows:

     A store, S1, to address A, where A is not relative to the stack
     frame, can be eliminated if all paths from S1 to the end of the
     function contain another store to A before a read to A.

     If the address A is relative to the stack frame, a store S2 to A
     can be eliminated if there are no paths from S2 that reach the
     end of the function that read A before another store to A.  In
     this case S2 can be deleted if there are paths from S2 to the
     end of the function that have no reads or writes to A.  This
     second case allows stores to the stack frame to be deleted that
     would otherwise die when the function returns.  This cannot be
     done if stores_off_frame_dead_at_return is not true.  See the doc
     for that variable for when this variable is false.

     The global problem is formulated as a backwards set union
     dataflow problem where the stores are the gens and reads are the
     kills.  Set union problems are rare and require some special
     handling given our representation of bitmaps.  A straightforward
     implementation requires a lot of bitmaps filled with 1s.
     These are expensive and cumbersome in our bitmap formulation so
     care has been taken to avoid large vectors filled with 1s.  See
     the comments in bb_info and in the dataflow confluence functions
     for details.

   There are two places for further enhancements to this algorithm:

   1) The original dse which was embedded in a pass called flow also
   did local address forwarding.  For example in

   A <- r100
   ... <- A

   flow would replace the right hand side of the second insn with a
   reference to r100.  Most of the information is available to add this
   to this pass.  It has not done it because it is a lot of work in
   the case that either r100 is assigned to between the first and
   second insn and/or the second insn is a load of part of the value
   stored by the first insn.

   insn 5 in gcc.c-torture/compile/990203-1.c simple case.
   insn 15 in gcc.c-torture/execute/20001017-2.c simple case.
   insn 25 in gcc.c-torture/execute/20001026-1.c simple case.
   insn 44 in gcc.c-torture/execute/20010910-1.c simple case.

   2) The cleaning up of spill code is quite profitable.  It currently
   depends on reading tea leaves and chicken entrails left by reload.
   This pass depends on reload creating a singleton alias set for each
   spill slot and telling the next dse pass which of these alias sets
   are the singletons.  Rather than analyze the addresses of the
   spills, dse's spill processing just does analysis of the loads and
   stores that use those alias sets.  There are three cases where this
   falls short:

     a) Reload sometimes creates the slot for one mode of access, and
     then inserts loads and/or stores for a smaller mode.  In this
     case, the current code just punts on the slot.  The proper thing
     to do is to back out and use one bit vector position for each
     byte of the entity associated with the slot.  This depends on
     KNOWING that reload always generates the accesses for each of the
     bytes in some canonical (read that easy to understand several
     passes after reload happens) way.

     b) Reload sometimes decides that spill slot it allocated was not
     large enough for the mode and goes back and allocates more slots
     with the same mode and alias set.  The backout in this case is a
     little more graceful than (a).  In this case the slot is unmarked
     as being a spill slot and if final address comes out to be based
     off the frame pointer, the global algorithm handles this slot.

     c) For any pass that may prespill, there is currently no
     mechanism to tell the dse pass that the slot being used has the
     special properties that reload uses.  It may be that all that is
     required is to have those passes make the same calls that reload
     does, assuming that the alias sets can be manipulated in the same
     way.   
There are limits to the size of constant offsets we model for the
   global problem.  There are certainly test cases, that exceed this
   limit, however, it is unlikely that there are important programs
   that really have constant offsets this size.   

Referenced by record_store(), and set_usage_bits().


Typedef Documentation

typedef struct bb_info* bb_info_t
typedef struct group_info* const_group_info_t
typedef struct group_info* group_info_t
typedef struct insn_info* insn_info_t
typedef struct read_info* read_info_t
typedef struct store_info* store_info_t

Function Documentation

static void add_non_frame_wild_read ( )
static
Set the BB_INFO so that the last insn is marked as a wild read of
   non-frame locations.   

References free_read_records(), bb_info::last_insn, insn_info::non_frame_wild_read, and reset_active_stores().

Referenced by scan_insn().

static void add_wild_read ( )
static
Set the BB_INFO so that the last insn is marked as a wild read.   

References free_read_records(), bb_info::last_insn, reset_active_stores(), and insn_info::wild_read.

Referenced by check_mem_read_rtx(), record_store(), and scan_insn().

static bool all_positions_needed_p ( )
inlinestatic
Return TRUE if all bytes START through START+WIDTH-1 from S_INFO
   store are needed.   

References bitmap_bit_p(), HOST_WIDE_INT, store_info::is_large, store_info::large, lowpart_bitmask(), store_info::positions_needed, and store_info::small_bitmask.

Referenced by check_mem_read_rtx(), and record_store().

static bool any_positions_needed_p ( )
inlinestatic
Return TRUE if any bytes from S_INFO store are needed.   

References store_info::begin, store_info::end, HOST_WIDE_INT, store_info::is_large, store_info::large, store_info::positions_needed, and store_info::small_bitmask.

Referenced by record_store().

static bool can_escape ( )
static
Return whether EXPR can possibly escape the current function scope.   

References get_base_address(), local_variable_can_escape(), and may_be_aliased().

Referenced by set_usage_bits().

static bool canon_address ( rtx  mem,
alias_set_type alias_set_out,
int *  group_id,
HOST_WIDE_INT offset,
cselib_val **  base 
)
static
Take all reasonable action to put the address of MEM into the form
   that we can do analysis on.

   The gold standard is to get the address into the form: address +
   OFFSET where address is something that rtx_varies_p considers a
   constant.  When we can get the address in this form, we can do
   global analysis on it.  Note that for constant bases, address is
   not actually returned, only the group_id.  The address can be
   obtained from that.

   If that fails, we try cselib to get a value we can at least use
   locally.  If that fails we return false.

   The GROUP_ID is set to -1 for cselib bases and the index of the
   group for non_varying bases.

   FOR_READ is true if this is a mem read and false if not.   

References canon_rtx(), const_or_frame_p(), cselib_expand_value_rtx(), cselib_lookup(), dump_file, dump_flags, get_address_mode(), get_group_info(), group_info::id, and print_inline_rtx().

Referenced by check_mem_read_rtx(), and record_store().

bool check_for_inc_dec ( )
Entry point for postreload.  If you work on reload_cse, or you need this
   anywhere else, consider if you can provide register liveness information
   and add a parameter to this function so that it can be passed down in
   insn_info.fixed_regs_live.   

References emit_inc_dec_insn_before(), find_reg_note(), insn_info::fixed_regs_live, for_each_inc_dec(), and insn_info::insn.

Referenced by reload_cse_simplify().

static bool check_for_inc_dec_1 ( )
static
Before we delete INSN_INFO->INSN, make sure that the auto inc/dec, if it
   is there, is split into a separate insn.
   Return true on success (or if there was nothing to do), false on failure.   

References emit_inc_dec_insn_before(), find_reg_note(), for_each_inc_dec(), and insn_info::insn.

Referenced by delete_dead_store_insn(), and dse_step5_nospill().

static void check_mem_read_use ( )
static
A for_each_rtx callback in which DATA points the INSN_INFO for
   as check_mem_read_rtx.  Nullify the pointer if i_m_r_m_r returns
   true for any part of *LOC.   

References check_mem_read_rtx(), and for_each_rtx().

Referenced by scan_insn().

static struct clear_alias_mode_holder* clear_alias_set_lookup ( )
staticread
Find the entry associated with ALIAS_SET.   

References clear_alias_mode_holder::alias_set, and clear_alias_mode_table.

Referenced by record_store().

static void clear_rhs_from_active_local_stores ( )
static
Clear the rhs field from the active_local_stores array.   

References active_local_stores, store_info::const_rhs, store_info::is_set, store_info::next, insn_info::next_local_store, store_info::rhs, and insn_info::store_rec.

Referenced by record_store().

static bool const_or_frame_p ( )
static
Return true if X is a constant or one of the registers that behave
   as a constant over the life of a function.  This is equivalent to
   !rtx_varies_p for memory addresses.   

Referenced by canon_address().

static bitmap copy_fixed_regs ( )
static
Return a bitmap of the fixed registers contained in IN.   

References bitmap_and(), and fixed_reg_set_regset.

Referenced by scan_insn().

static void delete_dead_store_insn ( )
static
static void dse_confluence_0 ( )
static
Confluence function for blocks with no successors.  Create an out
   set from the gen set of the exit block.  This block logically has
   the exit block as a successor.   

References bitmap_copy(), bb_info::gen, basic_block_def::index, and bb_info::out.

Referenced by dse_step4().

static bool dse_confluence_n ( )
static
Propagate the information from the in set of the dest of E to the
   out set of the src of E.  If the various in or out sets are not
   there, that means they are all ones.   

References bitmap_and_into(), bitmap_copy(), edge_def::dest, bb_info::in, basic_block_def::index, bb_info::out, and edge_def::src.

Referenced by dse_step4().

static void dse_step3_exit_block_scan ( )
static
Set the gen set of the exit block, and also any block with no
   successors that does not have a wild read.   

References bitmap_ior_into(), group_info::frame_related, bb_info::gen, group_info::group_kill, group_info::process_globally, and stores_off_frame_dead_at_return.

Referenced by dse_step3().

static void dse_step3_scan ( )
static
Scan the insns in BB_INFO starting at PTR and going to the top of
   the block in order to build the gen and kill sets for the block.
   We start at ptr which may be the last insn in the block or may be
   the first insn with a wild read.  In the latter case we are able to
   skip the rest of the block because it just does not matter:
   anything that happens is hidden by the wild read.   

References bitmap_clear(), find_insn_before_first_wild_read(), bb_info::gen, basic_block_def::index, insn_info::insn, bb_info::kill, bb_info::last_insn, insn_info::prev_insn, insn_info::read_rec, scan_reads_nospill(), scan_reads_spill(), scan_stores_nospill(), scan_stores_spill(), and insn_info::store_rec.

Referenced by dse_step3().

static bool dse_transfer_function ( )
static
Propagate the info from the out to the in set of BB_INDEX's basic
   block.  There are three cases:

   1) The block has no kill set.  In this case the kill set is all
   ones.  It does not matter what the out set of the block is, none of
   the info can reach the top.  The only thing that reaches the top is
   the gen set and we just copy the set.

   2) There is a kill set but no out set and bb has successors.  In
   this case we just return. Eventually an out set will be created and
   it is better to wait than to create a set of ones.

   3) There is both a kill and out set.  We apply the obvious transfer
   function.

References bitmap_copy(), bitmap_ior_and_compl(), bb_info::gen, bb_info::in, bb_info::kill, and bb_info::out.

Referenced by dse_step4().

static void dump_insn_info ( )
static
static int emit_inc_dec_insn_before ( rtx  mem,
rtx  op,
rtx  dest,
rtx  src,
rtx  srcoff,
void *  arg 
)
static
static insn_info_t find_insn_before_first_wild_read ( )
static
Return the insn in BB_INFO before the first wild read or if there
   are no wild reads in the block, return the last insn.   

References bb_info::last_insn, insn_info::prev_insn, and insn_info::wild_read.

Referenced by dse_step3_scan().

static rtx find_shift_sequence ( int  access_size,
store_info_t  store_info,
enum machine_mode  read_mode,
int  shift,
bool  speed,
bool  require_cst 
)
static
If the modes are different and the value's source and target do not
   line up, we need to extract the value from lower part of the rhs of
   the store, shift it, and then put it into a form that can be shoved
   into the read_insn.  This function generates a right SHIFT of a
   value that is at least ACCESS_SIZE bytes wide of READ_MODE.  The
   shift sequence is returned or NULL if we failed to find a
   shift.   

References store_info::const_rhs, copy_rtx(), emit_insn(), emit_move_insn(), end_sequence(), expand_binop(), extract_low_bits(), gen_reg_rtx(), get_insns(), insn_rtx_cost(), store_info::mem, new_mode(), OPTAB_DIRECT, store_info::rhs, set_src_cost(), simplify_const_binary_operation(), simplify_subreg(), smallest_mode_for_size(), start_sequence(), and subreg_lowpart_offset().

Referenced by get_stored_val().

static void free_read_records ( )
static
Free all READ_REC of the LAST_INSN of BB_INFO.   

References bb_info::last_insn, read_info::next, pool_free(), and insn_info::read_rec.

Referenced by add_non_frame_wild_read(), and add_wild_read().

static bool gate_dse1 ( void  )
static

References dbg_cnt().

static bool gate_dse2 ( void  )
static

References dbg_cnt().

static int get_bitmap_index ( )
static
static bool get_call_args ( )
static
Get arguments passed to CALL_INSN.  Return TRUE if successful.
   So far it only handles arguments passed in registers.   

References cselib_expand_value_rtx(), gen_int_mode(), clear_alias_mode_holder::mode, pack_cumulative_args(), and targetm.

Referenced by scan_insn().

static group_info_t get_group_info ( )
static
Get the GROUP for BASE.  Add a new group if it is not there.   

References canon_rtx(), clear_alias_group, hash_table< Descriptor, Allocator >::find_slot(), gen_rtx_MEM(), memset(), pool_alloc(), group_info::rtx_base, and rtx_group_next_id.

Referenced by canon_address().

static rtx get_stored_val ( store_info_t  store_info,
enum machine_mode  read_mode,
HOST_WIDE_INT  read_begin,
HOST_WIDE_INT  read_end,
basic_block  bb,
bool  require_cst 
)
static
Helper function for replace_read and record_store.
   Attempt to return a value stored in STORE_INFO, from READ_BEGIN
   to one before READ_END bytes read in READ_MODE.  Return NULL
   if not successful.  If REQUIRE_CST is true, return always constant.   

References store_info::begin, store_info::const_rhs, copy_rtx(), store_info::end, extract_low_bits(), find_shift_sequence(), gen_int_mode(), HOST_BITS_PER_WIDE_INT, HOST_WIDE_INT, int_mode_for_mode(), store_info::mem, optimize_bb_for_speed_p(), store_info::rhs, and shift.

Referenced by record_store(), and replace_read().

static bool local_variable_can_escape ( )
static
Return whether DECL, a local variable, can possibly escape the current
   function scope.   

References cfun, gimple_df::decls_to_pointers, function::gimple_df, and pointer_map_contains().

Referenced by can_escape().

static void look_for_hardregs ( )
static
Call back for note_stores to find the hard regs set or clobbered by
   insn.  Data is a bitmap of the hardregs set so far.   

References bitmap_set_range(), and regs_set.

Referenced by replace_read().

static unsigned HOST_WIDE_INT lowpart_bitmask ( )
static
Return a bitmask with the first N low bits set.   

References HOST_BITS_PER_WIDE_INT, and HOST_WIDE_INT.

Referenced by all_positions_needed_p(), and record_store().

rtl_opt_pass* make_pass_rtl_dse1 ( )
rtl_opt_pass* make_pass_rtl_dse2 ( )
static void mark_reachable_blocks ( )
static
Find all of the blocks that are not backwards reachable from the
   exit block or any block with no successors (BB).  These are the
   infinite loops or infinite self loops.  These blocks will still
   have their bits set in UNREACHABLE_BLOCKS.   

References bitmap_bit_p(), bitmap_clear_bit(), basic_block_def::index, basic_block_def::preds, and edge_def::src.

Referenced by dse_step3().

static void note_add_store ( )
static
Callback for emit_inc_dec_insn_before via note_stores.
   Check if a register is clobbered which is live afterwards.   

References note_add_store_info::current, note_add_store_info::failure, note_add_store_info::first, note_add_store_info::fixed_regs_live, and reg_referenced_p().

Referenced by emit_inc_dec_insn_before().

static int record_store ( )
static
BODY is an instruction pattern that belongs to INSN.  Return 1 if
   there is a candidate store, after adding it to the appropriate
   local store group if so.   

References active_local_stores, active_local_stores_len, add_wild_read(), store_info::alias_set, all_positions_needed_p(), any_positions_needed_p(), store_info::begin, bitmap_set_bit(), insn_info::cannot_delete, canon_address(), group_info::canon_base_addr, canon_rtx(), canon_true_dependence(), clear_alias_set_lookup(), clear_rhs_from_active_local_stores(), store_info::const_rhs, insn_info::contains_cselib_groups, store_info::cse_base, cselib_expand_value_rtx(), delete_dead_store_insn(), dump_file, dump_flags, store_info::end, end_sequence(), find_reg_note(), get_address_mode(), get_insns(), get_stored_val(), store_info::group_id, HOST_BITS_PER_WIDE_INT, HOST_WIDE_INT, insn_info::insn, store_info::is_large, store_info::is_set, store_info::large, last, bb_info::last_insn, lowpart_bitmask(), MAX_OFFSET, may_be_sp_based_p(), store_info::mem, store_info::mem_addr, clear_alias_mode_holder::mode, store_info::next, insn_info::next_local_store, offset, group_info::offset_map_size_p, plus_constant(), pool_alloc(), store_info::positions_needed, store_info::redundant_reason, reload_completed, store_info::rhs, rtx_equal_p(), SET, set_all_positions_unneeded(), set_position_unneeded(), set_usage_bits(), store_info::small_bitmask, insn_info::stack_pointer_based, start_sequence(), group_info::store1_p, group_info::store2_p, insn_info::store_rec, and cselib_val_struct::val_rtx.

Referenced by scan_insn().

static void remove_useless_values ( )
static
Remove BASE from the set of active_local_stores.  This is a
   callback from cselib that is used to get rid of the stores in
   active_local_stores.   

References active_local_stores, active_local_stores_len, store_info::cse_base, free_store_info(), store_info::group_id, last, store_info::next, insn_info::next_local_store, and insn_info::store_rec.

Referenced by dse_step1().

static bool replace_read ( store_info_t  store_info,
insn_info_t  store_insn,
read_info_t  read_info,
insn_info_t  read_insn,
rtx loc,
bitmap  regs_live 
)
static
Take a sequence of:
     A <- r1
     ...
     ... <- A

   and change it into
   r2 <- r1
   A <- r1
   ...
   ... <- r2

   or

   r3 <- extract (r1)
   r3 <- r3 >> shift
   r2 <- extract (r3)
   ... <- r2

   or

   r2 <- extract (r1)
   ... <- r2

   Depending on the alignment and the mode of the store and
   subsequent load.


   The STORE_INFO and STORE_INSN are for the store and READ_INFO
   and READ_INSN are for the read.  Return true if the replacement
   went ok.   

References read_info::begin, bitmap_and_into(), bitmap_empty_p(), copy_to_mode_reg(), dbg_cnt(), deferred_change_list, df_print_regset(), dump_file, dump_flags, emit_insn_before(), read_info::end, end_sequence(), get_insns(), get_stored_val(), insn_info::insn, deferred_change::loc, look_for_hardregs(), store_info::mem, read_info::mem, read_info::next, deferred_change::next, note_stores(), pool_alloc(), pool_free(), print_simple_rtl(), insn_info::read_rec, deferred_change::reg, reg_obstack, regs_set, start_sequence(), this_insn, and validate_change().

Referenced by check_mem_read_rtx().

static void reset_active_stores ( )
static
static unsigned int rest_of_handle_dse ( )
static
-------------------------------------------------------------------------
   DSE
   -------------------------------------------------------------------------  
Callback for running pass_rtl_dse.   

References df_analyze(), DF_DEFER_INSN_RESCAN, DF_LR_RUN_DCE, df_note_add_problem(), df_set_flags(), dse_step0(), dse_step1(), dse_step2_init(), dse_step2_nospill(), dse_step3(), dse_step4(), dse_step5_nospill(), dse_step6(), dse_step7(), dump_file, dump_flags, globally_deleted, locally_deleted, and spill_deleted.

static void scan_reads_spill ( )
static
Process the READ_INFOs into the bitmaps into GEN and KILL.  KILL
   may be NULL.   

References read_info::alias_set, bitmap_clear_bit(), bitmap_set_bit(), get_bitmap_index(), and read_info::next.

Referenced by dse_step3_scan().

static void scan_stores_nospill ( )
static
Process the STORE_INFOs into the bitmaps into GEN and KILL.  KILL
   may be NULL.  

References store_info::begin, bitmap_clear_bit(), bitmap_set_bit(), get_bitmap_index(), store_info::group_id, HOST_WIDE_INT, store_info::next, and group_info::process_globally.

Referenced by dse_step3_scan(), and dse_step5_nospill().

static void scan_stores_spill ( )
static
Process the STORE_INFOs into the bitmaps into GEN and KILL.  KILL
   may be NULL.  

References store_info::alias_set, bitmap_clear_bit(), bitmap_set_bit(), get_bitmap_index(), and store_info::next.

Referenced by dse_step3_scan().

static void set_all_positions_unneeded ( )
inlinestatic
static void set_position_unneeded ( )
inlinestatic
Mark byte POS bytes from the beginning of store S_INFO as unneeded.   

References bitmap_set_bit(), HOST_WIDE_INT, store_info::is_large, store_info::large, store_info::positions_needed, and store_info::small_bitmask.

Referenced by record_store().

static void set_usage_bits ( group_info_t  group,
HOST_WIDE_INT  offset,
HOST_WIDE_INT  width,
tree  expr 
)
static

Variable Documentation

insn_info_t active_local_stores
static
The linked list of stores that are under consideration in this
   basic block.   

Referenced by check_mem_read_rtx(), clear_rhs_from_active_local_stores(), dse_step1(), record_store(), remove_useless_values(), and scan_insn().

alloc_pool bb_info_pool
static
bb_info_t* bb_table
static
Table to hold all bb_infos.   
group_info_t clear_alias_group
static
The group that holds all of the clear_alias_sets.   

Referenced by get_group_info().

htab_t clear_alias_mode_table
static
The modes of the clear_alias_sets.   

Referenced by clear_alias_set_lookup().

alloc_pool cse_store_info_pool
static
unsigned int current_position
static
The number of bits used in the global bitmaps.   

Referenced by dse_step2_nospill().

deferred_change_t deferred_change_list = NULL
static

Referenced by replace_read().

alloc_pool deferred_change_pool
static
bitmap_obstack dse_bitmap_obstack
static
Obstack for the DSE dataflow bitmaps.  We don't want to put these
   on the default obstack because these bitmaps can grow quite large
   (~2GB for the small (!) test case of PR54146) and we'll hold on to
   all that memory until the end of the compiler run.
   As a bonus, delete_tree_live_info can destroy all the bitmaps by just
   releasing the whole obstack.   
struct obstack dse_obstack
static
Obstack for other data.  As for above: Kinda nice to be able to
   throw it all away at the end in one big sweep.   

Referenced by dse_step0(), dse_step2_init(), and dse_step7().

int globally_deleted
static
Counter for stats.   

Referenced by dse_step0(), dse_step5_nospill(), and rest_of_handle_dse().

alloc_pool insn_info_pool
static
bitmap kill_on_calls
static
Locations that are killed by calls in the global phase.   
int locally_deleted
static
alloc_pool read_info_pool
static
alloc_pool rtx_group_info_pool
static
int rtx_group_next_id
static
Index into the rtx_group_vec.   

Referenced by dse_step0(), and get_group_info().

hash_table<invariant_group_base_hasher> rtx_group_table
static
Tables of group_info structures, hashed by base value.   
vec<group_info_t> rtx_group_vec
static
alloc_pool rtx_store_info_pool
static
bitmap scratch = NULL
static
Scratch bitmap for cselib's cselib_expand_value_rtx.   

Referenced by find_dead_or_set_registers(), and mark_target_live_regs().

int spill_deleted
static

Referenced by dse_step0(), and rest_of_handle_dse().

bool stores_off_frame_dead_at_return
static
This is true except if cfun->stdarg -- i.e. we cannot do
   this for vararg functions because they play games with the frame.   

Referenced by dse_step0(), dse_step1(), dse_step2_init(), and dse_step3_exit_block_scan().