GCC Middle and Back End API 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_info * | store_info_t |
typedef struct read_info * | read_info_t |
typedef struct insn_info * | insn_info_t |
typedef struct bb_info * | bb_info_t |
typedef struct group_info * | group_info_t |
typedef struct group_info * | const_group_info_t |
typedef struct deferred_change * | deferred_change_t |
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_t * | bb_table |
static alloc_pool | rtx_group_info_pool |
static int | rtx_group_next_id |
static vec< group_info_t > | rtx_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 |
#define MAX_OFFSET (64 * 1024) |
@verbatim RTL dead store elimination.
Copyright (C) 2005-2013 Free Software Foundation, Inc.
Contributed by Richard Sandiford rsand and Kenneth Zadeck ifor @code sour cery. comzadec k@na tural brid ge.co 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 struct group_info* const_group_info_t |
typedef struct deferred_change* deferred_change_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 |
|
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 |
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().
|
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().
|
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 |
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 |
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 |
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 |
A for_each_rtx callback in which DATA is the bb_info. Check to see if LOC is a mem and if it is look at the address and kill any appropriate stores that may be active.
References active_local_stores, active_local_stores_len, add_wild_read(), store_info::alias_set, read_info::alias_set, all_positions_needed_p(), store_info::begin, read_info::begin, insn_info::cannot_delete, canon_address(), group_info::canon_base_addr, canon_true_dependence(), store_info::cse_base, dump_file, dump_flags, dump_insn_info(), read_info::end, get_address_mode(), store_info::group_id, read_info::group_id, HOST_WIDE_INT, insn_info::insn, store_info::is_set, last, bb_info::last_insn, store_info::mem, read_info::mem, store_info::mem_addr, store_info::next, read_info::next, insn_info::next_local_store, offset, plus_constant(), pool_alloc(), print_inline_rtx(), insn_info::read_rec, bb_info::regs_live, replace_read(), store_info::rhs, insn_info::store_rec, and cselib_val_struct::val_rtx.
Referenced by 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().
|
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 |
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 |
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 |
Return a bitmap of the fixed registers contained in IN.
References bitmap_and(), and fixed_reg_set_regset.
Referenced by scan_insn().
|
static |
Delete the insn and free all of the fields inside INSN_INFO.
References store_info::alias_set, check_for_inc_dec_1(), dbg_cnt(), delete_insn(), dump_file, dump_flags, free_store_info(), insn_info::insn, locally_deleted, read_info::next, pool_free(), insn_info::read_rec, insn_info::store_rec, and insn_info::wild_read.
Referenced by dse_step1(), dse_step6(), and record_store().
|
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 |
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 |
Initialization of data structures.
References bitmap_obstack_initialize(), cfun, hash_table< Descriptor, Allocator >::create(), create_alloc_pool(), dse_obstack, globally_deleted, init_alias_analysis(), locally_deleted, reg_obstack, rtx_group_next_id, spill_deleted, function::stdarg, and stores_off_frame_dead_at_return.
Referenced by rest_of_handle_dse().
|
static |
Do all of step 1.
References active_local_stores, active_local_stores_len, store_info::alias_set, bitmap_copy(), bitmap_set_bit(), insn_info::cannot_delete, insn_info::contains_cselib_groups, create_alloc_pool(), cselib_clear_table(), cselib_discard_hook, cselib_finish(), cselib_init(), cselib_process_insn(), delete_dead_store_insn(), df_simulate_initialize_forwards(), df_simulate_one_insn_forwards(), dump_file, dump_flags, hash_table< Descriptor, Allocator >::empty(), group_info::frame_related, free_alloc_pool(), free_store_info(), store_info::group_id, basic_block_def::index, insn_info::insn, store_info::is_large, store_info::is_set, store_info::large, bb_info::last_insn, deferred_change::loc, memset(), store_info::next, deferred_change::next, insn_info::next_local_store, pool_alloc(), pool_free(), store_info::positions_needed, insn_info::prev_insn, store_info::redundant_reason, deferred_change::reg, reg_obstack, bb_info::regs_live, remove_useless_values(), scan_insn(), single_succ(), single_succ_p(), insn_info::store_rec, stores_off_frame_dead_at_return, and basic_block_def::succs.
Referenced by rest_of_handle_dse().
|
static |
References bitmap_count_bits(), bitmap_ior_into(), bitmap_print(), dse_obstack, dump_file, dump_flags, group_info::frame_related, group_info::offset_map_n, group_info::offset_map_p, group_info::offset_map_size_n, group_info::offset_map_size_p, group_info::process_globally, group_info::store1_n, group_info::store1_p, group_info::store2_n, group_info::store2_p, and stores_off_frame_dead_at_return.
Referenced by rest_of_handle_dse().
|
static |
Init the offset tables for the normal case.
References bitmap_bit_p(), bitmap_clear(), bitmap_set_bit(), current_position, group_info::escaped_n, group_info::escaped_p, group_info::group_kill, memset(), group_info::offset_map_n, group_info::offset_map_p, group_info::offset_map_size_n, group_info::offset_map_size_p, group_info::process_globally, group_info::store2_n, and group_info::store2_p.
Referenced by rest_of_handle_dse().
|
static |
Build the transfer functions for the function.
References bitmap_bit_p(), bitmap_clear(), bitmap_copy(), bitmap_ior_into(), bitmap_ones(), dse_step3_exit_block_scan(), dse_step3_scan(), bb_info::gen, group_info::group_kill, bb_info::in, basic_block_def::index, mark_reachable_blocks(), bb_info::out, sbitmap_alloc(), sbitmap_free(), and basic_block_def::succs.
Referenced by rest_of_handle_dse().
|
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 |
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 |
Solve the dataflow equations.
References bitmap_print(), DF_BACKWARD, df_get_n_blocks(), df_get_postorder(), df_print_bb_index(), df_simple_dataflow(), dse_confluence_0(), dse_confluence_n(), dse_transfer_function(), dump_file, dump_flags, bb_info::gen, bb_info::in, basic_block_def::index, bb_info::kill, and bb_info::out.
Referenced by rest_of_handle_dse().
|
static |
References store_info::alias_set, store_info::begin, bitmap_bit_p(), bitmap_clear(), bitmap_empty_p(), bitmap_print(), insn_info::cannot_delete, check_for_inc_dec_1(), dbg_cnt(), delete_insn(), deleted, dump_file, dump_flags, get_bitmap_index(), globally_deleted, store_info::group_id, HOST_WIDE_INT, basic_block_def::index, insn_info::insn, store_info::is_set, bb_info::last_insn, store_info::next, insn_info::non_frame_wild_read, bb_info::out, insn_info::prev_insn, insn_info::read_rec, scan_reads_nospill(), scan_stores_nospill(), insn_info::store_rec, and insn_info::wild_read.
Referenced by rest_of_handle_dse().
|
static |
|
static |
References bitmap_obstack_release(), hash_table< Descriptor, Allocator >::dispose(), dse_obstack, end_alias_analysis(), free(), and free_alloc_pool().
Referenced by rest_of_handle_dse().
|
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 |
References dump_file, insn_info::insn, and insn_info::store_rec.
Referenced by check_mem_read_rtx(), and scan_insn().
|
static |
Callback for for_each_inc_dec that emits an INSN that sets DEST to SRC + SRCOFF before insn ARG.
References note_add_store_info::current, emit_insn(), emit_insn_before(), end_sequence(), note_add_store_info::failure, note_add_store_info::first, insn_info::fixed_regs_live, note_add_store_info::fixed_regs_live, gen_add3_insn(), gen_move_insn(), get_insns(), insn_info::insn, note_add_store(), note_stores(), and start_sequence().
Referenced by check_for_inc_dec(), and check_for_inc_dec_1().
|
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 |
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 |
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 |
Delete all of the store_info recs from INSN_INFO.
References insn_info::cannot_delete, insn_info::contains_cselib_groups, store_info::cse_base, store_info::is_large, store_info::large, store_info::next, pool_free(), store_info::positions_needed, and insn_info::store_rec.
Referenced by delete_dead_store_insn(), dse_step1(), and remove_useless_values().
|
static |
References dbg_cnt().
|
static |
References dbg_cnt().
|
static |
Look up the bitmap index for OFFSET in GROUP_INFO. If it is not there, return 0.
References HOST_WIDE_INT, offset, group_info::offset_map_n, group_info::offset_map_p, group_info::offset_map_size_n, and group_info::offset_map_size_p.
Referenced by dse_step5_nospill(), scan_reads_nospill(), scan_reads_spill(), scan_stores_nospill(), and scan_stores_spill().
|
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
References active_local_stores_len.
Referenced by add_non_frame_wild_read(), and add_wild_read().
|
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 |
Apply record_store to all candidate stores in INSN. Mark INSN if some part of it is not a candidate store and assigns to a non-register target.
References active_local_stores, active_local_stores_len, add_non_frame_wild_read(), add_wild_read(), block_clear_fn, BUILT_IN_NORMAL, function::can_delete_dead_exceptions, insn_info::cannot_delete, cfun, check_mem_read_use(), copy_fixed_regs(), dump_file, dump_flags, dump_insn_info(), find_reg_note(), insn_info::fixed_regs_live, insn_info::frame_read, gen_rtx_MEM(), get_call_args(), get_call_rtx_from(), store_info::group_id, insn_info::insn, insn_nothrow_p(), store_info::is_set, last, bb_info::last_insn, memset(), store_info::next, insn_info::next_local_store, note_uses(), pool_alloc(), insn_info::prev_insn, record_store(), bb_info::regs_live, reload_completed, set_mem_size(), insn_info::stack_pointer_based, insn_info::store_rec, volatile_insn_p(), and volatile_refs_p().
Referenced by dse_step1().
|
static |
Process the READ_INFOs into the bitmaps into GEN and KILL. KILL may be NULL.
References group_info::base_mem, read_info::begin, bitmap_and_compl_into(), bitmap_clear_bit(), bitmap_ior_into(), bitmap_set_bit(), group_info::canon_base_addr, canon_true_dependence(), read_info::end, insn_info::frame_read, group_info::frame_related, get_bitmap_index(), read_info::group_id, group_info::group_kill, HOST_WIDE_INT, read_info::mem, read_info::next, insn_info::non_frame_wild_read, group_info::process_globally, and insn_info::read_rec.
Referenced by dse_step3_scan(), and dse_step5_nospill().
|
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 |
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 |
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().
|
inlinestatic |
Mark the whole store S_INFO as unneeded.
References store_info::begin, bitmap_set_bit(), 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().
|
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 |
Set the store* bitmaps offset_map_size* fields in GROUP based on OFFSET and WIDTH.
References bitmap_set_bit(), can_escape(), group_info::escaped_n, group_info::escaped_p, HOST_WIDE_INT, MAX_OFFSET, group_info::offset_map_size_n, group_info::offset_map_size_p, group_info::store1_n, group_info::store1_p, group_info::store2_n, and group_info::store2_p.
Referenced by record_store().
|
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().
|
static |
Referenced by check_mem_read_rtx(), dse_step1(), record_store(), remove_useless_values(), reset_active_stores(), and scan_insn().
|
static |
Referenced by all_blocks(), df_live_verify_transfer_functions(), df_lr_verify_transfer_functions(), fast_dce(), and get_block_vector().
|
static |
|
static |
Table to hold all bb_infos.
|
static |
The group that holds all of the clear_alias_sets.
Referenced by get_group_info().
|
static |
The modes of the clear_alias_sets.
Referenced by clear_alias_set_lookup().
|
static |
|
static |
The number of bits used in the global bitmaps.
Referenced by dse_step2_nospill().
|
static |
Referenced by replace_read().
|
static |
|
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.
|
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().
|
static |
Counter for stats.
Referenced by dse_step0(), dse_step5_nospill(), and rest_of_handle_dse().
|
static |
|
static |
Locations that are killed by calls in the global phase.
|
static |
Referenced by delete_dead_store_insn(), dse_step0(), and rest_of_handle_dse().
|
static |
|
static |
|
static |
Index into the rtx_group_vec.
Referenced by dse_step0(), and get_group_info().
|
static |
Tables of group_info structures, hashed by base value.
|
static |
|
static |
|
static |
Scratch bitmap for cselib's cselib_expand_value_rtx.
Referenced by find_dead_or_set_registers(), and mark_target_live_regs().
|
static |
Referenced by dse_step0(), and rest_of_handle_dse().
|
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().