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

Functions

static bool find_call_stack_args (rtx, bool, bool, bitmap)
static bool deletable_insn_p_1 ()
static bool deletable_insn_p ()
static int marked_insn_p ()
static void mark_insn ()
static void mark_nonreg_stores_1 ()
static void mark_nonreg_stores_2 ()
static void mark_nonreg_stores ()
static bool check_argument_store (rtx mem, HOST_WIDE_INT off, HOST_WIDE_INT min_sp_off, HOST_WIDE_INT max_sp_off, bitmap sp_bytes)
static void remove_reg_equal_equiv_notes_for_defs ()
static void reset_unmarked_insns_debug_uses ()
static void delete_unmarked_insns ()
static void prescan_insns_for_dce ()
static void mark_artificial_uses ()
static void mark_reg_dependencies ()
static void init_dce ()
static void fini_dce ()
static unsigned int rest_of_handle_ud_dce ()
static bool gate_ud_dce ()
rtl_opt_passmake_pass_ud_rtl_dce ()
static bool word_dce_process_block (basic_block bb, bool redo_out, struct dead_debug_global *global_debug)
static bool dce_process_block (basic_block bb, bool redo_out, bitmap au, struct dead_debug_global *global_debug)
static void fast_dce ()
static unsigned int rest_of_handle_fast_dce ()
void run_word_dce ()
void run_fast_df_dce ()
void run_fast_dce ()
static bool gate_fast_dce ()
rtl_opt_passmake_pass_fast_rtl_dce ()

Variables

static bool df_in_progress = false
static bool can_alter_cfg = false
static vec< rtxworklist
static sbitmap marked
static bitmap_obstack dce_blocks_bitmap_obstack
static bitmap_obstack dce_tmp_bitmap_obstack

Function Documentation

static bool check_argument_store ( rtx  mem,
HOST_WIDE_INT  off,
HOST_WIDE_INT  min_sp_off,
HOST_WIDE_INT  max_sp_off,
bitmap  sp_bytes 
)
static
Return true if store to MEM, starting OFF bytes from stack pointer,
   is a call argument store, and clear corresponding bits from SP_BYTES
   bitmap if it is.   

References bitmap_clear_bit(), and HOST_WIDE_INT.

Referenced by find_call_stack_args().

static bool dce_process_block ( basic_block  bb,
bool  redo_out,
bitmap  au,
struct dead_debug_global global_debug 
)
static
Process basic block BB.  Return true if the live_in set has
   changed. REDO_OUT is true if the info at the bottom of the block
   needs to be recalculated before starting.  AU is the proper set of
   artificial uses.  Track global substitution of uses of dead pseudos
   in debug insns using GLOBAL_DEBUG.   

References bitmap_bit_p(), bitmap_clear(), bitmap_copy(), bitmap_empty_p(), bitmap_equal_p(), control_flow_insn_p(), dead_debug_add(), dead_debug_insert_temp(), dead_debug_local_finish(), dead_debug_local_init(), DEBUG_TEMP_AFTER_WITH_REG_FORCE, DEBUG_TEMP_BEFORE_WITH_VALUE, df_print_regset(), df_simulate_defs(), df_simulate_finalize_backwards(), df_simulate_initialize_backwards(), df_simulate_uses(), dump_file, basic_block_def::index, mark_insn(), marked_insn_p(), basic_block_def::succs, and dead_debug_local::used.

Referenced by fast_dce().

static bool deletable_insn_p ( )
static
Return true if INSN is a normal instruction that can be deleted by
   the DCE pass.   

References can_alter_cfg, function::can_delete_dead_exceptions, cfun, deletable_insn_p_1(), df_in_progress, find_call_stack_args(), global_regs, insn_nothrow_p(), and reload_completed.

Referenced by find_call_stack_args(), and prescan_insns_for_dce().

static bool deletable_insn_p_1 ( )
static
A subroutine for which BODY is part of the instruction being tested;
   either the top-level pattern, or an element of a PARALLEL.  The
   instruction is known not to be a bare USE or CLOBBER.   

References volatile_refs_p().

Referenced by deletable_insn_p().

static void delete_unmarked_insns ( )
static
static bool find_call_stack_args ( rtx  call_insn,
bool  do_mark,
bool  fast,
bitmap  arg_stores 
)
static
Try to find all stack stores of CALL_INSN arguments if
   ACCUMULATE_OUTGOING_ARGS.  If all stack stores have been found
   and it is therefore safe to eliminate the call, return true,
   otherwise return false.  This function should be first called
   with DO_MARK false, and only when the CALL_INSN is actually
   going to be marked called again with DO_MARK true.   

References bitmap_clear(), bitmap_empty_p(), bitmap_set_bit(), check_argument_store(), defs, deletable_insn_p(), HOST_WIDE_INT, mark_insn(), df_link::next, df_link::ref, and rtx_equal_p().

Referenced by deletable_insn_p(), and mark_insn().

static void fini_dce ( )
static
Free the data allocated by init_dce.   

References bitmap_obstack_release(), and sbitmap_free().

Referenced by rest_of_handle_fast_dce(), rest_of_handle_ud_dce(), and run_word_dce().

static bool gate_fast_dce ( )
static

References dbg_cnt().

static bool gate_ud_dce ( )
static

References dbg_cnt().

rtl_opt_pass* make_pass_fast_rtl_dce ( )
rtl_opt_pass* make_pass_ud_rtl_dce ( )
static void mark_artificial_uses ( )
static
UD-based DSE routines.  
Mark instructions that define artificially-used registers, such as
   the frame pointer and the stack pointer.   

References defs, df_get_artificial_uses(), basic_block_def::index, mark_insn(), df_link::next, and df_link::ref.

Referenced by rest_of_handle_ud_dce().

static void mark_insn ( )
static
static void mark_nonreg_stores ( )
static
Mark INSN if BODY stores to a non-register destination.   

References mark_nonreg_stores_1(), mark_nonreg_stores_2(), and note_stores().

Referenced by prescan_insns_for_dce().

static void mark_nonreg_stores_1 ( )
static
A note_stores callback used by mark_nonreg_stores.  DATA is the
   instruction containing DEST.   

References mark_insn().

Referenced by mark_nonreg_stores().

static void mark_nonreg_stores_2 ( )
static
A note_stores callback used by mark_nonreg_stores.  DATA is the
   instruction containing DEST.   

References mark_insn().

Referenced by mark_nonreg_stores().

static void mark_reg_dependencies ( )
static
Mark every instruction that defines a register value that INSN uses.   

References defs, dump_file, mark_insn(), df_link::next, print_simple_rtl(), and df_link::ref.

Referenced by rest_of_handle_ud_dce().

static int marked_insn_p ( )
inlinestatic
Return true if INSN has been marked as needed.   

References bitmap_bit_p().

Referenced by dce_process_block(), delete_unmarked_insns(), mark_insn(), reset_unmarked_insns_debug_uses(), and word_dce_process_block().

static void prescan_insns_for_dce ( )
static
Go through the instructions and mark those whose necessity is not
   dependent on inter-instruction information.  Make sure all other
   instructions are not marked.   

References bitmap_bit_p(), bitmap_clear(), deletable_insn_p(), df_in_progress, dump_file, mark_insn(), and mark_nonreg_stores().

Referenced by fast_dce(), and rest_of_handle_ud_dce().

static void remove_reg_equal_equiv_notes_for_defs ( )
static
Remove all REG_EQUAL and REG_EQUIV notes referring to the registers INSN
   writes to.   

References remove_reg_equal_equiv_notes_for_regno().

Referenced by delete_unmarked_insns().

static void reset_unmarked_insns_debug_uses ( )
static
Scan all BBs for debug insns and reset those that reference values
   defined in unmarked insns.   

References defs, df_insn_rescan_debug_internal(), marked_insn_p(), df_link::next, and df_link::ref.

Referenced by rest_of_handle_ud_dce().

static unsigned int rest_of_handle_fast_dce ( )
static
Fast register level DCE.   

References fast_dce(), fini_dce(), and init_dce().

Referenced by run_fast_dce(), and run_fast_df_dce().

void run_fast_dce ( void  )
Run a fast DCE pass.   

References rest_of_handle_fast_dce().

Referenced by cleanup_cfg(), and do_reload().

void run_fast_df_dce ( void  )
This is an internal call that is used by the df live register
   problem to run fast dce as a side effect of creating the live
   information.  The stack is organized so that the lr problem is run,
   this pass is run, which updates the live info and the df scanning
   info, and then returns to allow the rest of the problems to be run.

   This can be called by elsewhere but it will not update the bit
   vectors for any other problems than LR.   

References df_clear_flags(), DF_DEFER_INSN_RESCAN, df_in_progress, DF_NO_INSN_RESCAN, df_set_flags(), and rest_of_handle_fast_dce().

Referenced by df_lr_finalize().

static bool word_dce_process_block ( basic_block  bb,
bool  redo_out,
struct dead_debug_global global_debug 
)
static
-------------------------------------------------------------------------
   Fast DCE functions
   -------------------------------------------------------------------------  
Process basic block BB.  Return true if the live_in set has
   changed. REDO_OUT is true if the info at the bottom of the block
   needs to be recalculated before starting.  AU is the proper set of
   artificial uses.  Track global substitution of uses of dead pseudos
   in debug insns using GLOBAL_DEBUG.   

References bitmap_bit_p(), bitmap_clear(), bitmap_copy(), bitmap_empty_p(), bitmap_equal_p(), control_flow_insn_p(), dead_debug_add(), dead_debug_insert_temp(), dead_debug_local_finish(), dead_debug_local_init(), DEBUG_TEMP_AFTER_WITH_REG_FORCE, DEBUG_TEMP_BEFORE_WITH_VALUE, df_print_word_regset(), df_word_lr_simulate_defs(), df_word_lr_simulate_uses(), dump_file, basic_block_def::index, mark_insn(), marked_insn_p(), basic_block_def::succs, and dead_debug_local::used.

Referenced by fast_dce().


Variable Documentation

bool can_alter_cfg = false
static
True if we are allowed to alter the CFG in this pass.   

Referenced by deletable_insn_p(), and init_dce().

bitmap_obstack dce_blocks_bitmap_obstack
static
Bitmap obstacks used for block processing by the fast algorithm.   
bitmap_obstack dce_tmp_bitmap_obstack
static
bool df_in_progress = false
static
@verbatim RTL dead code elimination.

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

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/.

-------------------------------------------------------------------------
   Core mark/delete routines
   -------------------------------------------------------------------------  
True if we are invoked while the df engine is running; in this case,
   we don't want to reenter it.   

Referenced by deletable_insn_p(), init_dce(), mark_insn(), prescan_insns_for_dce(), and run_fast_df_dce().

sbitmap marked
static
Bitmap of instructions marked as needed indexed by INSN_UID.   

Referenced by check_regexp_units_distribution(), const_ok_for_output_1(), and dbxout_symbol_location().