GCC Middle and Back End API Reference
var-tracking.c File Reference

Data Structures

struct  micro_operation_def
struct  attrs_def
struct  location_chain_def
struct  loc_exp_dep_s
struct  expand_depth_struct
struct  onepart_aux
struct  variable_part_def
union  variable_part_def::variable_aux
struct  variable_def
struct  variable_hasher
struct  emit_note_data_def
struct  shared_hash_def
struct  dataflow_set_def
struct  variable_tracking_info_def
struct  parm_reg
struct  adjust_mem_data
struct  overlapping_mems
struct  variable_union_info
struct  dfset_merge
struct  dfset_post_merge
struct  count_use_info
struct  expand_loc_callback_data

Typedefs

typedef struct micro_operation_def micro_operation
typedef void * decl_or_value
typedef struct attrs_defattrs
typedef struct location_chain_deflocation_chain
typedef struct loc_exp_dep_s loc_exp_dep
typedef struct expand_depth_struct expand_depth
typedef struct variable_part_def variable_part
typedef enum onepart_enum onepart_enum_t
typedef struct variable_defvariable
typedef struct variable_defconst_variable
typedef unsigned int dvuid
typedef hash_table
< variable_hasher
variable_table_type
typedef
variable_table_type::iterator 
variable_iterator_type
typedef struct emit_note_data_def emit_note_data
typedef struct shared_hash_defshared_hash
typedef struct dataflow_set_def dataflow_set
typedef struct
variable_tracking_info_def
variable_tracking_info
typedef struct parm_reg parm_reg_t

Enumerations

enum  micro_operation_type {
  MO_USE, MO_USE_NO_VAR, MO_VAL_USE, MO_VAL_LOC,
  MO_VAL_SET, MO_SET, MO_COPY, MO_CLOBBER,
  MO_CALL, MO_ADJUST
}
enum  emit_note_where { EMIT_NOTE_BEFORE_INSN, EMIT_NOTE_AFTER_INSN, EMIT_NOTE_AFTER_CALL_INSN }
enum  onepart_enum { NOT_ONEPART = 0, ONEPART_VDECL = 1, ONEPART_DEXPR = 2, ONEPART_VALUE = 3 }

Functions

static bool dv_is_decl_p ()
static bool dv_is_value_p ()
static tree dv_as_decl ()
static rtx dv_as_value ()
static void * dv_as_opaque ()
static dvuid dv_uid ()
static hashval_t dv_uid2hash ()
static hashval_t dv_htab_hash ()
static void variable_htab_free (void *)
static void stack_adjust_offset_pre_post (rtx, HOST_WIDE_INT *, HOST_WIDE_INT *)
static void insn_stack_adjust_offset_pre_post (rtx, HOST_WIDE_INT *, HOST_WIDE_INT *)
static bool vt_stack_adjustments (void)
static void init_attrs_list_set (attrs *)
static void attrs_list_clear (attrs *)
static attrs attrs_list_member (attrs, decl_or_value, HOST_WIDE_INT)
static void attrs_list_insert (attrs *, decl_or_value, HOST_WIDE_INT, rtx)
static void attrs_list_copy (attrs *, attrs)
static void attrs_list_union (attrs *, attrs)
static variable_def ** unshare_variable (dataflow_set *set, variable_def **slot, variable var, enum var_init_status)
static void vars_copy (variable_table_type, variable_table_type)
static tree var_debug_decl (tree)
static void var_reg_set (dataflow_set *, rtx, enum var_init_status, rtx)
static void var_reg_delete_and_set (dataflow_set *, rtx, bool, enum var_init_status, rtx)
static void var_reg_delete (dataflow_set *, rtx, bool)
static void var_regno_delete (dataflow_set *, int)
static void var_mem_set (dataflow_set *, rtx, enum var_init_status, rtx)
static void var_mem_delete_and_set (dataflow_set *, rtx, bool, enum var_init_status, rtx)
static void var_mem_delete (dataflow_set *, rtx, bool)
static void dataflow_set_init (dataflow_set *)
static void dataflow_set_clear (dataflow_set *)
static void dataflow_set_copy (dataflow_set *, dataflow_set *)
static int variable_union_info_cmp_pos (const void *, const void *)
static void dataflow_set_union (dataflow_set *, dataflow_set *)
static location_chain find_loc_in_1pdv (rtx, variable, variable_table_type)
static bool canon_value_cmp (rtx, rtx)
static int loc_cmp (rtx, rtx)
static bool variable_part_different_p (variable_part *, variable_part *)
static bool onepart_variable_different_p (variable, variable)
static bool variable_different_p (variable, variable)
static bool dataflow_set_different (dataflow_set *, dataflow_set *)
static void dataflow_set_destroy (dataflow_set *)
static bool contains_symbol_ref (rtx)
static bool track_expr_p (tree, bool)
static bool same_variable_part_p (rtx, tree, HOST_WIDE_INT)
static int add_uses (rtx *, void *)
static void add_uses_1 (rtx *, void *)
static void add_stores (rtx, const_rtx, void *)
static bool compute_bb_dataflow (basic_block)
static bool vt_find_locations (void)
static void dump_attrs_list (attrs)
static void dump_var (variable)
static void dump_vars (variable_table_type)
static void dump_dataflow_set (dataflow_set *)
static void dump_dataflow_sets (void)
static void set_dv_changed (decl_or_value, bool)
static void variable_was_changed (variable, dataflow_set *)
static variable_def ** set_slot_part (dataflow_set *, rtx, variable_def **, decl_or_value, HOST_WIDE_INT, enum var_init_status, rtx)
static void set_variable_part (dataflow_set *, rtx, decl_or_value, HOST_WIDE_INT, enum var_init_status, rtx, enum insert_option)
static variable_def ** clobber_slot_part (dataflow_set *, rtx, variable_def **, HOST_WIDE_INT, rtx)
static void clobber_variable_part (dataflow_set *, rtx, decl_or_value, HOST_WIDE_INT, rtx)
static variable_def ** delete_slot_part (dataflow_set *, rtx, variable_def **, HOST_WIDE_INT)
static void delete_variable_part (dataflow_set *, rtx, decl_or_value, HOST_WIDE_INT)
static void emit_notes_in_bb (basic_block, dataflow_set *)
static void vt_emit_notes (void)
static bool vt_get_decl_and_offset (rtx, tree *, HOST_WIDE_INT *)
static void vt_add_function_parameters (void)
static bool vt_initialize (void)
static void vt_finalize (void)
static rtx compute_cfa_pointer ()
static int use_narrower_mode_test ()
static rtx use_narrower_mode ()
static rtx adjust_mems ()
static void adjust_mem_uses ()
static void adjust_mem_stores ()
static void adjust_insn ()
static rtx dv_as_rtx ()
static onepart_enum_t dv_onepart_p ()
static alloc_pool onepart_pool ()
static decl_or_value dv_from_decl ()
static decl_or_value dv_from_value ()
static decl_or_value dv_from_rtx ()
void debug_dv (decl_or_value dv)
DEBUG_FUNCTION void debug_dv ()
static void loc_exp_dep_clear (variable var)
static void variable_htab_free ()
static void init_attrs_list_set ()
static void attrs_list_clear ()
static attrs attrs_list_member ()
static void attrs_list_copy ()
static void attrs_list_union ()
static void attrs_list_mpdv_union ()
static bool shared_hash_shared ()
static variable_table_type shared_hash_htab ()
static bool shared_var_p ()
static shared_hash shared_hash_unshare ()
static shared_hash shared_hash_copy ()
static void shared_hash_destroy ()
static variable_def ** shared_hash_find_slot_unshare_1 (shared_hash *pvars, decl_or_value dv, hashval_t dvhash, enum insert_option ins)
static variable_def ** shared_hash_find_slot_unshare (shared_hash *pvars, decl_or_value dv, enum insert_option ins)
static variable_def ** shared_hash_find_slot_1 ()
static variable_def ** shared_hash_find_slot ()
static variable_def ** shared_hash_find_slot_noinsert_1 (shared_hash vars, decl_or_value dv, hashval_t dvhash)
static variable_def ** shared_hash_find_slot_noinsert ()
static variable shared_hash_find_1 ()
static variable shared_hash_find ()
static bool canon_value_cmp ()
static void vars_copy ()
static tree var_debug_decl ()
static void var_reg_decl_set (dataflow_set *set, rtx loc, enum var_init_status initialized, decl_or_value dv, HOST_WIDE_INT offset, rtx set_src, enum insert_option iopt)
static enum var_init_status get_init_value ()
static void var_reg_delete ()
static void var_regno_delete ()
static bool negative_power_of_two_p ()
static rtx vt_get_canonicalize_base ()
static rtx vt_canonicalize_addr (dataflow_set *, rtx)
static rtx get_addr_from_global_cache ()
static rtx get_addr_from_local_cache ()
static rtx vt_canonicalize_addr ()
static bool vt_canon_true_dep ()
int drop_overlapping_mem_locs ()
static void clobber_overlapping_mems ()
static void var_mem_decl_set (dataflow_set *set, rtx loc, enum var_init_status initialized, decl_or_value dv, HOST_WIDE_INT offset, rtx set_src, enum insert_option iopt)
static void var_mem_delete ()
static bool unsuitable_loc ()
static void val_bind ()
static void val_store ()
static bool local_get_addr_clear_given_value (const void *v, void **slot, void *x)
static void val_reset ()
static void val_resolve ()
static void dataflow_set_init ()
static void dataflow_set_clear ()
static void dataflow_set_copy ()
static int variable_union_info_cmp_pos ()
static int variable_union ()
static void dataflow_set_union ()
static void set_dv_changed ()
static bool dv_changed_p ()
static location_chain find_loc_in_1pdv ()
static void insert_into_intersection (location_chain *nodep, rtx loc, enum var_init_status status)
static void intersect_loc_chains (rtx val, location_chain *dest, struct dfset_merge *dsm, location_chain s1node, variable s2var)
static int loc_cmp ()
int canonicalize_loc_order_check (variable_def **slot, dataflow_set *data)
int canonicalize_values_mark ()
int canonicalize_values_star ()
int canonicalize_vars_star ()
static int variable_merge_over_cur ()
static int variable_merge_over_src ()
static void dataflow_set_merge ()
static void dataflow_set_equiv_regs ()
static void remove_duplicate_values ()
int variable_post_merge_new_vals ()
int variable_post_merge_perm_vals ()
static void dataflow_post_merge_adjust ()
static location_chain find_mem_expr_in_1pdv ()
static bool mem_dies_at_call ()
int dataflow_set_preserve_mem_locs ()
int dataflow_set_remove_mem_locs ()
static void dataflow_set_clear_at_call ()
static bool variable_part_different_p ()
static bool onepart_variable_different_p ()
static bool variable_different_p ()
static bool dataflow_set_different ()
static void dataflow_set_destroy ()
static bool contains_symbol_ref ()
static bool track_expr_p ()
static bool same_variable_part_p ()
static bool track_loc_p (rtx loc, tree expr, HOST_WIDE_INT offset, bool store_reg_p, enum machine_mode *mode_out, HOST_WIDE_INT *offset_out)
static rtx var_lowpart ()
static cselib_valfind_use_val ()
static rtx replace_expr_with_values ()
static int rtx_debug_expr_p ()
static enum micro_operation_type use_type ()
static void log_op_type (rtx x, basic_block bb, rtx insn, enum micro_operation_type mopt, FILE *out)
static void preserve_value ()
static int non_suitable_const ()
static int add_uses ()
static void add_uses_1 ()
static void reverse_op ()
static void add_stores ()
static void prepare_call_arguments ()
static void add_with_sets ()
static enum var_init_status find_src_status ()
static rtx find_src_set_src ()
static bool compute_bb_dataflow ()
static void dump_attrs_list ()
int dump_var_tracking_slot ()
static void dump_var ()
static void dump_vars ()
static void dump_dataflow_set ()
static variable variable_from_dropped ()
static struct onepart_auxrecover_dropped_1paux ()
static void variable_was_changed ()
static int find_variable_location_part (variable var, HOST_WIDE_INT offset, int *insertion_point)
static void loc_exp_dep_alloc ()
static void loc_exp_dep_clear ()
static void loc_exp_insert_dep ()
static bool loc_exp_dep_set (variable var, rtx result, rtx *value, int count, variable_table_type vars)
static void notify_dependents_of_resolved_value ()
static rtx vt_expand_loc_callback (rtx x, bitmap regs, int max_depth, void *data)
static expand_depth update_depth ()
static rtx vt_expand_var_loc_chain ()
static void resolve_expansions_pending_recursion ()
static rtx vt_expand_loc ()
static rtx vt_expand_1pvar ()
int emit_note_insn_var_location ()
int var_track_values_to_stack (variable_def **slot, vec< rtx, va_heap > *changed_values_stack)
static void remove_value_from_changed_variables ()
static void notify_dependents_of_changed_value (rtx val, variable_table_type htab, vec< rtx, va_heap > *changed_values_stack)
static void process_changed_values ()
static void emit_notes_for_changes (rtx insn, enum emit_note_where where, shared_hash vars)
int emit_notes_for_differences_1 ()
int emit_notes_for_differences_2 ()
static void emit_notes_for_differences (rtx insn, dataflow_set *old_set, dataflow_set *new_set)
static rtx next_non_note_insn_var_location ()
static void emit_notes_in_bb ()
static bool vt_get_decl_and_offset ()
static void record_entry_value ()
static void vt_add_function_parameter ()
static void vt_init_cfa_base ()
static void delete_debug_insns ()
static void vt_debug_insns_local ()
static unsigned int variable_tracking_main_1 ()
unsigned int variable_tracking_main ()
static bool gate_handle_var_tracking ()
rtl_opt_passmake_pass_variable_tracking ()

Variables

char check_value_val [(int) VALUE==(int) IDENTIFIER_NODE?1:-1]
static const char *const micro_operation_type_name []
static alloc_pool attrs_pool
static alloc_pool var_pool
static alloc_pool valvar_pool
static alloc_pool loc_chain_pool
static alloc_pool shared_hash_pool
static alloc_pool loc_exp_dep_pool
static variable_table_type changed_variables
static bool emit_notes
static variable_table_type dropped_values
static shared_hash empty_shared_hash
static bitmap scratch_regs = NULL
static vec< parm_reg_t, va_gc > * windowed_parm_regs = NULL
static bool cselib_hook_called
static rtx cfa_base_rtx
static HOST_WIDE_INT cfa_base_offset
static HOST_WIDE_INT hard_frame_pointer_adjustment = -1
static bool dst_can_be_shared
static struct pointer_map_tglobal_get_addr_cache
static struct pointer_map_tlocal_get_addr_cache
static struct variable_union_infovui_vec
static int vui_allocated
static vec< rtxpreserved_values
static rtx call_arguments
static int debug_label_num = 1

Typedef Documentation

typedef struct attrs_def * attrs
   Description of location of a part of a variable.  The content of a physical
   register is described by a chain of these structures.
   The chains are pretty short (usually 1 or 2 elements) and thus
   chain is the best data structure.  
typedef struct variable_def* const_variable
   Structure holding the IN or OUT set for a basic block.  
typedef void* decl_or_value
   A declaration of a variable, or an RTL value being handled like a
   declaration.  
typedef unsigned int dvuid
   Structure for passing some other parameters to function
   emit_note_insn_var_location.  
   This data structure holds information about the depth of a variable
   expansion.  
typedef struct loc_exp_dep_s loc_exp_dep
   A vector of loc_exp_dep holds the active dependencies of a one-part
   DV on VALUEs, i.e., the VALUEs expanded so as to form the current
   location of DV.  Each entry is also part of VALUE' s linked-list of
   backlinks back to DV.  
   Structure for chaining the locations.  
   Structure holding information about micro operation.  
   Enumeration type used to discriminate various types of one-part
   variables.  
typedef struct parm_reg parm_reg_t
typedef struct shared_hash_def * shared_hash
   Structure holding a refcounted hash table.  If refcount > 1,
   it must be first unshared before modified.  
typedef struct variable_def * variable
   Structure describing where the variable is located.  
typedef variable_table_type::iterator variable_iterator_type
   Structure describing one part of variable.  
   The structure (one for each basic block) containing the information
   needed for variable tracking.  

Enumeration Type Documentation

   Where shall the note be emitted?  BEFORE or AFTER the instruction.
   Notes emitted as AFTER_CALL are to take effect during the call,
   rather than after the call.  
Enumerator:
EMIT_NOTE_BEFORE_INSN 
EMIT_NOTE_AFTER_INSN 
EMIT_NOTE_AFTER_CALL_INSN 
   Type of micro operation.  
Enumerator:
MO_USE 
MO_USE_NO_VAR 
MO_VAL_USE 
MO_VAL_LOC 
MO_VAL_SET 
MO_SET 
MO_COPY 
MO_CLOBBER 
MO_CALL 
MO_ADJUST 
   Enumeration type used to discriminate various types of one-part
   variables.  
Enumerator:
NOT_ONEPART 
     Not a one-part variable.  
ONEPART_VDECL 
     A one-part DECL that is not a DEBUG_EXPR_DECL.  
ONEPART_DEXPR 
     A DEBUG_EXPR_DECL.  
ONEPART_VALUE 
     A VALUE.  

Function Documentation

static void add_stores ( rtx  ,
const_rtx  ,
void *   
)
static
static void add_stores ( )
static
   Add stores (register and memory references) LOC which will be tracked
   to VTI (bb)->mos.  EXPR is the RTL expression containing the store.
   CUIP->insn is instruction which the LOC is part of.  
                     If this is an instruction copying (part of) a parameter
                     passed by invisible reference to its register location,
                     pretend it's a SET so that the initial memory location
                     is discarded, as the parameter register can be reused
                     for other purposes and we do not track locations based
                     on generic registers.  
         Avoid the mode mismatch between oexpr and expr.  
               No point in duplicating.  
           No point in duplicating.  
     The loc of a MO_VAL_SET may have various forms:

     (concat val dst): dst now holds val

     (concat val (set dst src)): dst now holds val, copied from src

     (concat (concat val dstv) dst): dst now holds val; dstv is dst
     after replacing mems and non-top-level regs with values.

     (concat (concat val dstv) (set dst src)): dst now holds val,
     copied from src.  dstv is a value-based representation of dst, if
     it differs from dst.  If resolution is needed, src is a REG, and
     its mode is the same as that of val.

     (concat (concat val (set dstv srcv)) (set dst src)): src
     copied to dst, holding val.  dstv and srcv are value-based
     representations of dst and src, respectively.

References cselib_lookup(), cselib_preserved_value_p(), simplify_subreg(), and cselib_val_struct::val_rtx.

static int add_uses ( rtx ,
void *   
)
static
static int add_uses ( )
static
   Add uses (register and memory references) LOC which will be tracked
   to VTI (bb)->mos.  INSN is instruction which the LOC is part of.  
               For constants don't look up any value.  
             The loc of a MO_VAL_USE may have two forms:

             (concat val src): val is at src, a value-based
             representation.

             (concat (concat val use) src): same as above, with use as
             the MO_USE tracked value, if it differs from src.
static void add_uses_1 ( rtx ,
void *   
)
static
static void add_uses_1 ( )
static
   Helper function for finding all uses of REG/MEM in X in insn INSN.  
static void add_with_sets ( )
static
   Callback for cselib_record_sets_hook, that records as micro
   operations uses and stores in an insn after cselib_record_sets has
   analyzed the sets in an insn, but before it modifies the stored
   values in the internal tables, unless cselib_record_sets doesn't
   call it directly (perhaps because we're not doing cselib in the
   first place, in which case sets and n_sets will be 0).  
     Order the MO_USEs to be before MO_USE_NO_VARs and MO_VAL_USE, and
     MO_VAL_LOC last.  
     This will record NEXT_INSN (insn), such that we can
     insert notes before it without worrying about any
     notes that MO_USEs might emit after the insn.  
     Order the MO_VAL_USEs first (note_stores does nothing
     on DEBUG_INSNs, so there are no MO_VAL_LOCs from this
     insn), then MO_CLOBBERs, then MO_SET/MO_COPY/MO_VAL_SET.  
static void adjust_insn ( )
static
   Simplify INSN.  Remove all {PRE,POST}_{INC,DEC,MODIFY} rtxes,
   replace them with their value in the insn and add the side-effects
   as other sets to the insn.  
     If the target machine has an explicit window save instruction, the
     transformation OUTGOING_REGNO -> INCOMING_REGNO is done there.  
             Do not clobber the attached DECL, but only the REG.  
         inline-asm with multiple sets is tiny bit more complicated,
         because the 3 vectors in ASM_OPERANDS need to be shared between
         all ASM_OPERANDS in the instruction.  adjust_mems will
         not touch ASM_OPERANDS other than the first one, asm_noperands
         test above needs to be called before that (otherwise it would fail)
         and afterwards this code fixes it up.  
     For read-only MEMs containing some constant, prefer those
     constants.  

Referenced by vt_get_decl_and_offset().

static void adjust_mem_stores ( )
static
   Helper function for replacement of stores.  
static void adjust_mem_uses ( )
static
   Helper function for replacement of uses.  
static rtx adjust_mems ( )
static
   Helper function for adjusting used MEMs.  
         Don't do any sp or fp replacements outside of MEM addresses
         on the LHS.  
         First try without delegitimization of whole MEMs and
         avoid_constant_pool_reference, which is more likely to succeed.  
         Don't do any replacements in second and following
         ASM_OPERANDS of inline-asm with multiple sets.
         ASM_OPERANDS_INPUT_VEC, ASM_OPERANDS_INPUT_CONSTRAINT_VEC
         and ASM_OPERANDS_LABEL_VEC need to be equal between
         all the ASM_OPERANDs in the insn and adjust_insn will
         fix this up.  
static void attrs_list_clear ( attrs )
static

Referenced by dv_from_value().

static void attrs_list_clear ( )
static
static void attrs_list_copy ( attrs ,
attrs   
)
static
static void attrs_list_copy ( )
static
   Copy all nodes from SRC and create a list *DSTP of the copies.  
static void attrs_list_insert ( attrs listp,
decl_or_value  dv,
HOST_WIDE_INT  offset,
rtx  loc 
)
static
   Insert the triplet DECL, OFFSET, LOC to the list *LISTP.  

Referenced by canonicalize_values_star(), and debug_dv().

static attrs attrs_list_member ( attrs  ,
decl_or_value  ,
HOST_WIDE_INT   
)
static
static attrs attrs_list_member ( )
static
   Return true if the pair of DECL and OFFSET is the member of the LIST.  

References hash_table< Descriptor, Allocator >::find_slot_with_hash(), shared_hash_htab(), shared_hash_shared(), and shared_hash_unshare().

static void attrs_list_mpdv_union ( )
static
   Combine nodes that are not onepart nodes from SRC and SRC2 into
   *DSTP.  
static void attrs_list_union ( attrs ,
attrs   
)
static
static void attrs_list_union ( )
static
   Add all nodes from SRC which are not in *DSTP to *DSTP.  

References hash_table< Descriptor, Allocator >::find_with_hash(), and shared_hash_htab().

static bool canon_value_cmp ( rtx  ,
rtx   
)
static

Referenced by dump_attrs_list().

static bool canon_value_cmp ( )
inlinestatic
   Return true if TVAL is better than CVAL as a canonival value.  We
   choose lowest-numbered VALUEs, using the RTX address as a
   tie-breaker.  The idea is to arrange them into a star topology,
   such that all of them are at most one step away from the canonical
   value, and the canonical value has backlinks to all of them, in
   addition to all the actual locations.  We don't enforce this
   topology throughout the entire dataflow analysis, though.
int canonicalize_loc_order_check ( variable_def **  slot,
dataflow_set data 
)
   Check the order of entries in one-part variables.   
int canonicalize_values_mark ( )
   Mark with VALUE_RECURSED_INTO values that have neighbors that are
   more likely to be chosen as canonical for an equivalence set.
   Ensure less likely values can reach more likely neighbors, making
   the connections bidirectional.  
int canonicalize_values_star ( )
   Remove redundant entries from equivalence lists in onepart
   variables, canonicalizing equivalence sets into star shapes.  
         Keep it marked so that we revisit it, either after visiting a
         child node, or after visiting a new parent that might be
         found out.  
                   The canonical value was reset and dropped.
                   Remove it.  
     Push values to the canonical one.  
                   If it could have been a local minimum, it's not any more,
                   since it's now neighbor to cval, so it may have to push
                   to it.  Conversely, if it wouldn't have prevailed over
                   val, then whatever mark it has is fine: if it was to
                   push, it will now push to a more canonical node, but if
                   it wasn't, then it has already pushed any values it might
                   have to.  
                   Make sure we visit node->loc by ensuring we cval is
                   visited too.  
                 If we have no need to "recurse" into this node, it's
                 already "canonicalized", so drop the link to the old
                 parent.  
               Change an existing attribute referring to dv so that it
               refers to cdv, removing any duplicate this might
               introduce, and checking that no previous duplicates
               existed, all in a single pass.  
     Variable may have been unshared.  

References attrs_list_insert(), delete_slot_part(), dfset_merge::dst, dst_can_be_shared, attrs_def::dv, variable_def::dv, dv_as_value(), dv_from_value(), dv_htab_hash(), dv_is_value_p(), location_chain_def::init, intersect_loc_chains(), attrs_def::loc, location_chain_def::loc, variable_def::n_var_parts, attrs_def::next, location_chain_def::next, onepart_pool(), ONEPART_VALUE, onepart_variable_different_p(), pool_alloc(), variable_def::refcount, dataflow_set_def::regs, set_slot_part(), set_variable_part(), shared_hash_find_1(), shared_hash_find_slot_noinsert(), shared_hash_find_slot_noinsert_1(), shared_hash_find_slot_unshare(), shared_hash_find_slot_unshare_1(), shared_hash_shared(), dfset_merge::src, dfset_merge::src_onepart_cnt, variable_union(), and dataflow_set_def::vars.

int canonicalize_vars_star ( )
   Bind one-part variables to the canonical value in an equivalence
   set.  Not doing this causes dataflow convergence failure in rare
   circumstances, see PR42873.  Unfortunately we can't do this
   efficiently as part of canonicalize_values_star, since we may not
   have determined or even seen the canonical value of a set when we
   get to a variable that references another member of the set.  
     Push values to the canonical one.  
     CVAL is canonical if its value list contains non-VALUEs or VALUEs
     that are not “more canonical” than it.  
     CVAL was found to be non-canonical.  Change the variable to point
     to the canonical VALUE.  
static void clobber_overlapping_mems ( )
static
   Remove from SET all VALUE bindings to MEMs that overlap with LOC.  

References vt_get_canonicalize_base().

Referenced by drop_overlapping_mem_locs().

static variable_def ** clobber_slot_part ( dataflow_set set,
rtx  loc,
variable_def **  slot,
HOST_WIDE_INT  offset,
rtx  set_src 
)
static
   Remove all recorded register locations for the given variable part
   from dataflow set SET, except for those that are identical to loc.
   The variable part is specified by variable's declaration or value
   DV and offset OFFSET.  
         Remove the register locations from the dataflow set.  
                     Remove the variable part from the register's
                     list, but preserve any other variable parts
                     that might be regarded as live in that same
                     register.  
static void clobber_variable_part ( dataflow_set set,
rtx  loc,
decl_or_value  dv,
HOST_WIDE_INT  offset,
rtx  set_src 
)
static
   Remove all recorded register locations for the given variable part
   from dataflow set SET, except for those that are identical to loc.
   The variable part is specified by variable's declaration or value
   DV and offset OFFSET.  
static bool compute_bb_dataflow ( basic_block  )
static
static bool compute_bb_dataflow ( )
static
   Compute the changes of variable locations in the basic block BB.  
static rtx compute_cfa_pointer ( )
inlinestatic
   Compute a CFA-based value for an ADJUSTMENT made to stack_pointer_rtx
   or hard_frame_pointer_rtx.  
static bool contains_symbol_ref ( rtx  )
static
static bool contains_symbol_ref ( )
static
   Return true if RTL X contains a SYMBOL_REF.  
static void dataflow_post_merge_adjust ( )
static
   Just checking stuff and registering register attributes for
   now.  
static void dataflow_set_clear ( dataflow_set )
static
static void dataflow_set_clear ( )
static
   Delete the contents of dataflow set SET.  
static void dataflow_set_clear_at_call ( )
static
   Remove all variable-location information about call-clobbered
   registers, as well as associations between MEMs and VALUEs.  
static void dataflow_set_copy ( dataflow_set ,
dataflow_set  
)
static
static void dataflow_set_copy ( )
static
   Copy the contents of dataflow set SRC to DST.  

References location_chain_def::loc, and location_chain_def::next.

static void dataflow_set_destroy ( dataflow_set )
static
static void dataflow_set_destroy ( )
static
   Free the contents of dataflow set SET.  

References cselib_lookup(), get_address_mode(), replace_equiv_address_nv(), and cselib_val_struct::val_rtx.

static bool dataflow_set_different ( dataflow_set ,
dataflow_set  
)
static
static bool dataflow_set_different ( )
static
   Return true if dataflow sets OLD_SET and NEW_SET differ.  
     No need to traverse the second hashtab, if both have the same number
     of elements and the second one had all entries found in the first one,
     then it can't have any extra entries.  
static void dataflow_set_equiv_regs ( )
static
   Mark register equivalences.  
         If the list is empty or one entry, no need to canonicalize
         anything.  

References attrs_def::dv, dv_as_value(), location_chain_def::init, and set_variable_part().

static void dataflow_set_init ( dataflow_set )
static
static void dataflow_set_init ( )
static
   Initialize dataflow set SET to be empty.
   VARS_SIZE is the initial size of hash table VARS.  

References location_chain_def::loc, location_chain_def::next, and rtx_equal_p().

static void dataflow_set_merge ( )
static
   Combine dataflow set information from SRC2 into DST, using PDST
   to carry over information across passes.  
int dataflow_set_preserve_mem_locs ( )
   Remove all MEMs from the location list of a hash table entry for a
   one-part variable, except those whose MEM attributes map back to
   the variable itself, directly or within a VALUE.  
                 We want to remove dying MEMs that doesn't refer to DECL.  
                 We want to move here MEMs that do refer to DECL.  
                 ??? This picks up only one out of multiple MEMs that
                 refer to the same variable.  Do we ever need to be
                 concerned about dealing with more than one, or, given
                 that they should all map to the same variable
                 location, their addresses will have been merged and
                 they will be regarded as equivalent?  

References dump_file, and dump_var().

int dataflow_set_remove_mem_locs ( )
   Remove all MEMs from the location list of a hash table entry for a
   value.  
             If we have deleted the location which was last emitted
             we have to emit new location so add the variable to set
             of changed variables.  
static void dataflow_set_union ( dataflow_set ,
dataflow_set  
)
static
static void dataflow_set_union ( )
static
   Compute union of dataflow sets SRC and DST and store it to DST.  

References intersect_loc_chains(), and location_chain_def::loc.

void debug_dv ( decl_or_value  dv)
DEBUG_FUNCTION void debug_dv ( )
static void delete_debug_insns ( )
static
   Get rid of all debug insns from the insn stream.  
static variable_def ** delete_slot_part ( dataflow_set set,
rtx  loc,
variable_def **  slot,
HOST_WIDE_INT  offset 
)
static
   Delete the part of variable's location from dataflow set SET.  The
   variable part is specified by its SET->vars slot SLOT and offset
   OFFSET and the part's location by LOC.  
             If the variable contains the location part we have to
             make a copy of the variable.  
         Delete the location part.  
                 If we have deleted the location which was last emitted
                 we have to emit new location so add the variable to set
                 of changed variables.  

References expand_depth_struct::complexity, and expand_depth_struct::entryvals.

Referenced by canonicalize_values_star().

static void delete_variable_part ( dataflow_set set,
rtx  loc,
decl_or_value  dv,
HOST_WIDE_INT  offset 
)
static
   Delete the part of variable's location from dataflow set SET.  The
   variable part is specified by variable's declaration or value DV
   and offset OFFSET and the part's location by LOC.  
int drop_overlapping_mem_locs ( )
   Remove all MEMs that overlap with COMS->LOC from the location list
   of a hash table entry for a value.  COMS->ADDR must be a
   canonicalized form of COMS->LOC's address, and COMS->LOC must be
   canonicalized itself.  
             If we have deleted the location which was last emitted
             we have to emit new location so add the variable to set
             of changed variables.  

References canonical_cselib_val(), clobber_overlapping_mems(), dv_from_value(), elt_loc_list::loc, cselib_val_struct::locs, elt_loc_list::next, VAR_INIT_STATUS_INITIALIZED, and var_mem_decl_set().

static void dump_attrs_list ( attrs  )
static
static void dump_attrs_list ( )
static
   Print the content of the LIST to dump file.  

References canon_value_cmp(), and location_chain_def::loc.

static void dump_dataflow_set ( dataflow_set )
static
static void dump_dataflow_set ( )
static
   Print the dataflow set SET to dump file.  
static void dump_dataflow_sets ( )
static
   Print the IN and OUT sets for each basic block to dump file.  

References shared_var_p(), and unshare_variable().

static void dump_var ( variable  )
static
static void dump_var ( )
static
   Print the information about variable VAR to dump file.  

References location_chain_def::loc.

int dump_var_tracking_slot ( )
   Print the information about variable *SLOT to dump file.  
     Continue traversing the hash table.  
static void dump_vars ( variable_table_type  )
static
static void dump_vars ( )
static
   Print the information about variables from hash table VARS to dump file.  
static tree dv_as_decl ( )
inlinestatic
   Return the decl in the decl_or_value.  
static void* dv_as_opaque ( )
inlinestatic
   Return the opaque pointer in the decl_or_value.  
static rtx dv_as_rtx ( )
inlinestatic
   Return the DEBUG_EXPR of a DEBUG_EXPR_DECL or the VALUE in DV.  
static rtx dv_as_value ( )
inlinestatic
   Return the value in the decl_or_value.  

References attrs_def::next.

Referenced by canonicalize_values_star(), dataflow_set_equiv_regs(), val_bind(), and var_mem_decl_set().

static bool dv_changed_p ( )
inlinestatic
   Return true if DV needs to have its cur_loc recomputed.  

References loc_cmp().

Referenced by loc_exp_dep_clear().

static decl_or_value dv_from_decl ( )
inlinestatic
   Build a decl_or_value out of a decl.  

Referenced by shared_hash_find().

static decl_or_value dv_from_rtx ( )
inlinestatic
   Return a value or the decl of a debug_expr as a decl_or_value.  

Referenced by loc_exp_dep_clear().

static decl_or_value dv_from_value ( )
inlinestatic
static hashval_t dv_htab_hash ( )
inlinestatic
   The hash function for a mask table in a shared_htab chain.  

References variable_def::refcount.

Referenced by canonicalize_values_star(), shared_hash_find_slot_unshare(), and vt_find_locations().

static bool dv_is_decl_p ( )
inlinestatic
   Return true if a decl_or_value DV is a DECL or NULL.  
static bool dv_is_value_p ( )
inlinestatic
   Return true if a decl_or_value is a VALUE rtl.  

Referenced by canonicalize_values_star(), and val_bind().

static onepart_enum_t dv_onepart_p ( )
inlinestatic
   Return nonzero if a decl_or_value must not have more than one
   variable part.  The returned value discriminates among various
   kinds of one-part DVs ccording to enum onepart_enum.  

References attrs_pool, attrs_def::next, and pool_free().

Referenced by debug_dv().

static dvuid dv_uid ( )
inlinestatic
   Return the uid of DV.  
static hashval_t dv_uid2hash ( )
inlinestatic
   Compute the hash from the uid.  
int emit_note_insn_var_location ( )
   Emit the NOTE_INSN_VAR_LOCATION for variable *VARP.  DATA contains
   additional parameters: WHERE specifies whether the note shall be emitted
   before or after instruction INSN.  
         Attempt to merge adjacent registers or memory.  
         Make sure that the call related notes come first.  
     Continue traversing the hash table.  
static void emit_notes_for_changes ( rtx  insn,
enum emit_note_where  where,
shared_hash  vars 
)
static
   Emit NOTE_INSN_VAR_LOCATION note for each variable from a chain
   CHANGED_VARIABLES and delete this chain.  WHERE specifies whether
   the notes shall be emitted before of after instruction INSN.  

References hash_table< Descriptor, Allocator >::create(), create_alloc_pool(), cselib_get_next_uid(), dropped_values, and loc_exp_dep_pool.

static void emit_notes_for_differences ( rtx  insn,
dataflow_set old_set,
dataflow_set new_set 
)
static
   Emit notes before INSN for differences between dataflow sets OLD_SET and
   NEW_SET.  
int emit_notes_for_differences_1 ( )
   Add variable *SLOT to the chain CHANGED_VARIABLES if it differs from the
   same variable in hash table DATA or is not there at all.  
         Variable has disappeared.  
             Propagate the auxiliary data to (ultimately)
             changed_variables.  
         Continue traversing the hash table.  
     Update cur_loc and one-part auxiliary data, before new_var goes
     through variable_was_changed.  
     Continue traversing the hash table.  
int emit_notes_for_differences_2 ( )
   Add variable *SLOT to the chain CHANGED_VARIABLES if it is not in hash
   table DATA.  
     Continue traversing the hash table.  

References current_function_decl, plus_constant(), and replace_equiv_address_nv().

static void emit_notes_in_bb ( basic_block  ,
dataflow_set  
)
static
static void emit_notes_in_bb ( )
static
   Emit the notes for changes of location parts in the basic block BB.  
                     If expansion is successful, keep it in the list.  
                     Otherwise, if the following item is data_value for it,
                     drop it too too.  
                     Just drop this item.  
static location_chain find_loc_in_1pdv ( rtx  ,
variable  ,
variable_table_type   
)
static
static location_chain find_loc_in_1pdv ( )
static
   Return a location list node whose loc is rtx_equal to LOC, in the
   location list of a one-part variable or value VAR, or in that of
   any values recursively mentioned in the location lists.  VARS must
   be in star-canonical form.  
         Since we're in star-canonical form, we don't need to visit
         non-canonical nodes: one-part variables and non-canonical
         values would only point back to the canonical node.  
             Skip all subsequent VALUEs.  
     ??? Gotta look in cselib_val locations too.  
static location_chain find_mem_expr_in_1pdv ( )
static
   Return a node whose loc is a MEM that refers to EXPR in the
   location list of a one-part variable or value VAR, or in that of
   any values recursively mentioned in the location lists.  
static rtx find_src_set_src ( )
static
   SRC is the source of an assignment.  Use SET to try to find what
   was ultimately assigned to SRC.  Return that value if known,
   otherwise return SRC itself.  

References bitmap_bit_p(), bitmap_clear(), bitmap_clear_bit(), bitmap_set_bit(), changed, hash_table< Descriptor, Allocator >::elements(), first, shared_hash_htab(), hash_table< Descriptor, Allocator >::size(), dataflow_set_def::vars, and worklist.

Referenced by remove_value_from_changed_variables().

static enum var_init_status find_src_status ( )
static
static cselib_val* find_use_val ( )
inlinestatic
   Find a VALUE corresponding to X.   
         This is called after uses are set up and before stores are
         processed by cselib, so it's safe to look up srcs, but not
         dsts.  So we look up expressions that appear in srcs or in
         dest expressions, but we search the sets array for dests of
         stores.  
             Some targets represent memset and memcpy patterns
             by (set (mem:BLK ...) (reg:[QHSD]I ...)) or
             (set (mem:BLK ...) (const_int ...)) or
             (set (mem:BLK ...) (mem:BLK ...)).  Don't return anything
             in that case, otherwise we end up with mode mismatches.  
static int find_variable_location_part ( variable  var,
HOST_WIDE_INT  offset,
int *  insertion_point 
)
inlinestatic
   Look for the index in VAR->var_part corresponding to OFFSET.
   Return -1 if not found.  If INSERTION_POINT is non-NULL, the
   referenced int will be set to the index that the part has or should
   have, if it should be inserted.  
     Find the location part.  

References location_chain_def::loc, rtx_equal_p(), unshare_variable(), and VAR_INIT_STATUS_UNKNOWN.

static bool gate_handle_var_tracking ( )
static
static rtx get_addr_from_global_cache ( )
static
   Return the canonical address for LOC, that must be a VALUE, using a
   cached global equivalence or computing it and storing it in the
   global cache.  
     Tentative, avoiding infinite recursion.  
             The table may have moved during recursion, recompute
             SLOT.  
static rtx get_addr_from_local_cache ( )
static
   Return the canonical address for LOC, that must be a VALUE, using a
   cached local equivalence or computing it and storing it in the
   local cache.  
     Tentative, avoiding infinite recursion.  
     Recurse to cache local expansion of X, or if we need to search
     for a VALUE in the expansion.  
     Look for an improved equivalent expression.  

References changed, location_chain_def::loc, loc_chain_pool, variable_def::n_var_parts, location_chain_def::next, pool_free(), shared_var_p(), unshare_variable(), VAR_INIT_STATUS_UNKNOWN, variable_was_changed(), and vt_canon_true_dep().

static enum var_init_status get_init_value ( )
static
static void init_attrs_list_set ( attrs )
static
static void init_attrs_list_set ( )
static
   Initialize the set (array) SET of attrs to empty lists.  

References shared_hash_def::refcount.

static void insert_into_intersection ( location_chain nodep,
rtx  loc,
enum var_init_status  status 
)
static
   Insert LOC in *DNODE, if it's not there yet.  The list must be in
   loc_cmp order, and it is maintained as such.  
static void insn_stack_adjust_offset_pre_post ( rtx  insn,
HOST_WIDE_INT pre,
HOST_WIDE_INT post 
)
static
   Given an INSN, calculate the amount of stack adjustment it contains
   PRE- and POST-modifying stack pointer.  
         There may be stack adjustments inside compound insns.  Search
         for them.  

Referenced by vt_get_decl_and_offset().

static void intersect_loc_chains ( rtx  val,
location_chain dest,
struct dfset_merge dsm,
location_chain  s1node,
variable  s2var 
)
static
   Insert in DEST the intersection of the locations present in both
   S1NODE and S2VAR, directly or indirectly.  S1NODE is from a
   variable in DSM->cur, whereas S2VAR is from DSM->src.  dvar is in
   DSM->dst.  
         ??? gotta look in cselib_val locations too.  
         ??? if the location is equivalent to any location in src,
         searched recursively

           add to dst the values needed to represent the equivalence

     telling whether locations S is equivalent to another dv's
     location list:

       for each location D in the list

         if S and D satisfy rtx_equal_p, then it is present

         else if D is a value, recurse without cycles

         else if S and D have the same CODE and MODE

           for each operand oS and the corresponding oD

             if oS and oD are not equivalent, then S an D are not equivalent

             else if they are RTX vectors

               if any vector oS element is not equivalent to its respective oD,
               then S and D are not equivalent

References location_chain_def::loc, variable_def::n_var_parts, and location_chain_def::next.

Referenced by canonicalize_values_star(), and dataflow_set_union().

static int loc_cmp ( rtx  ,
rtx   
)
static

Referenced by dv_changed_p().

static int loc_cmp ( )
static
   Return -1 if X should be before Y in a location list for a 1-part
   variable, 1 if Y should be before X, and 0 if they're equivalent
   and should not appear in the list.  
         Don't assert the modes are the same, that is true only
         when not recursing.  (subreg:QI (value:SI 1:1) 0)
         and (subreg:QI (value:DI 2:2) 0) can be compared,
         even when the modes are different.  
     Entry value is the least preferable kind of expression.  
       Compare operands below.  
           Compare the vector length first.  
             Compare the vectors elements.  
           These are just backpointers, so they don't matter.  
           It is believed that rtx's at this level will never
           contain anything but integers and other rtx's,
           except for within LABEL_REFs and SYMBOL_REFs.  
static void loc_exp_dep_alloc ( )
static
   Allocate the one-part auxiliary data structure for VAR, with enough
   room for COUNT dependencies.  
     We can be called with COUNT == 0 to allocate the data structure
     without any dependencies, e.g. for the backlinks only.  However,
     if we are specifying a COUNT, then the dependency list must have
     been emptied before.  It would be possible to adjust pointers or
     force it empty here, but this is better done at an earlier point
     in the algorithm, so we instead leave an assertion to catch
     errors.  
         If the reallocation moves the onepaux structure, the
         back-pointer to BACKLINKS in the first list member will still
         point to its old location.  Adjust it.  
static void loc_exp_dep_clear ( variable  var)
static
static void loc_exp_dep_clear ( )
static
   Remove all entries from the vector of active dependencies of VAR,
   removing them from the back-links lists too.  

References variable_def::dv, dv_changed_p(), dv_from_rtx(), and set_dv_changed().

static bool loc_exp_dep_set ( variable  var,
rtx  result,
rtx value,
int  count,
variable_table_type  vars 
)
static
   Create active dependencies of VAR on COUNT values starting at
   VALUE, and corresponding back-links to the entries in VARS.  Return
   true if we found any pending-recursion results.  
     Set up all dependencies from last_child (as set up at the end of
     the loop above) to the end.  
static void loc_exp_insert_dep ( )
static
   Insert an active dependency from VAR on X to the vector of
   dependencies, and add the corresponding back-link to X's list of
   back-links in VARS.  
     ??? Build a vector of variables parallel to EXPANDING, to avoid
     an additional look up?  
     No point in adding the same backlink more than once.  This may
     arise if say the same value appears in two complex expressions in
     the same loc_list, or even more than once in a single
     expression.  

References cselib_expand_value_rtx_cb(), scratch_regs, and vt_expand_loc_callback().

static bool local_get_addr_clear_given_value ( const void *  v,
void **  slot,
void *  x 
)
static
   Clear (canonical address) slots that reference X.  
static void log_op_type ( rtx  x,
basic_block  bb,
rtx  insn,
enum micro_operation_type  mopt,
FILE *  out 
)
inlinestatic
   Log to OUT information about micro-operation MOPT involving X in
   INSN of BB.  

References count_use_info::bb, cfa_base_rtx, micro_operation_def::loc, MO_CLOBBER, MO_USE, MO_VAL_SET, SET, micro_operation_def::type, micro_operation_def::u, and unsuitable_loc().

Referenced by vt_add_function_parameter(), and vt_get_decl_and_offset().

rtl_opt_pass* make_pass_variable_tracking ( )
static bool mem_dies_at_call ( )
static
   Return TRUE if the value of MEM may vary across a call.  
static bool negative_power_of_two_p ( )
static
   Return true if I is the negated value of a power of two.  

Referenced by var_reg_decl_set(), and var_regno_delete().

static rtx next_non_note_insn_var_location ( )
static
   Return the next insn after INSN that is not a NOTE_INSN_VAR_LOCATION.  
static int non_suitable_const ( )
static
   Helper function for MO_VAL_LOC handling.  Return non-zero if
   any rtxes not suitable for CONST use not replaced by VALUEs
   are discovered.  
static void notify_dependents_of_changed_value ( rtx  val,
variable_table_type  htab,
vec< rtx, va_heap > *  changed_values_stack 
)
static
   If VAL (a value or debug_expr) has backlinks to variables actively
   dependent on it in HTAB or in CHANGED_VARIABLES, mark them as
   changed, adding to CHANGED_VALUES_STACK any dependencies that may
   have dependencies of their own to notify.  
         Deactivate and remove the backlink, as it was “used up”.  It
         makes no sense to attempt to notify the same entity again:
         either it will be recomputed and re-register an active
         dependency, or it will still have the changed mark.  
static void notify_dependents_of_resolved_value ( )
static
   Notify the back-links of IVAR that are pending recursion that we
   have found a non-NIL value for it, so they are cleared for another
   attempt to compute a current location.  
             If we have already resolved it, leave it alone.  
             Check that VALUE_RECURSED_INTO, true from the test above,
             implies NO_LOC_P.  
             We won't notify variables that are being expanded,
             because their dependency list is cleared before
             recursing.  
static alloc_pool onepart_pool ( )
inlinestatic
   Return the variable pool to be used for a dv of type ONEPART.  

Referenced by canonicalize_values_star(), and vt_find_locations().

static bool onepart_variable_different_p ( variable  ,
variable   
)
static
static bool onepart_variable_different_p ( )
static
   Return true if one-part variables VAR1 and VAR2 are different.
   They must be in canonical order.  
static void prepare_call_arguments ( )
static
   Compute call_arguments.  
             Can't do anything for these, if the original type mode
             isn't known or can't be converted.  
                   For non-integer stack argument see also if they weren't
                   initialized by integers.  
                       Try harder, when passing address of a constant
                       pool integer it can be easily read back.  
     Add debug arguments.  
     Reverse call_arguments chain.  
           Don't record anything.  

Referenced by record_entry_value().

static void preserve_value ( )
static
   Ensure VAL is preserved and remember it in a vector for vt_emit_notes.  

References micro_operation_def::loc, MO_SET, SET, micro_operation_def::type, micro_operation_def::u, and var_lowpart().

static void process_changed_values ( )
static
   Take out of changed_variables any entries that don't refer to use
   variables.  Back-propagate change notifications from values and
   debug_exprs to their active dependencies in HTAB or in
   CHANGED_VARIABLES.  
     Move values from changed_variables to changed_values_stack.  
     Back-propagate change notifications in values while popping
     them from the stack.  
         This condition will hold when visiting each of the entries
         originally in changed_variables.  We can't remove them
         earlier because this could drop the backlinks before we got a
         chance to use them.  
static void record_entry_value ( )
static
   Record the value for the ENTRY_VALUE of RTL as a global equivalence
   of VAL.  

References cselib_process_insn(), dump_cselib_table(), dump_file, dump_flags, prepare_call_arguments(), and print_rtl_single().

static struct onepart_aux* recover_dropped_1paux ( )
staticread
   Recover the one-part aux from dropped_values.  

Referenced by vt_find_locations().

static void remove_duplicate_values ( )
static
   Remove any redundant values in the location list of VAR, which must
   be unshared and 1-part.  
                 Remove duplicate value node.  
static void remove_value_from_changed_variables ( )
static
   Remove from changed_variables the entry whose DV corresponds to
   value or debug_expr VAL.  

References find_src_set_src(), find_src_status(), SET, and VAR_INIT_STATUS_INITIALIZED.

static rtx replace_expr_with_values ( )
static
   Replace all registers and addresses in an expression with VALUE
   expressions that map back to them, unless the expression is a
   register.  If no mapping is or can be performed, returns NULL.  
static void resolve_expansions_pending_recursion ( )
static
   While expanding variables, we may encounter recursion cycles
   because of mutual (possibly indirect) dependencies between two
   particular variables (or values), say A and B.  If we're trying to
   expand A when we get to B, which in turn attempts to expand A, if
   we can't find any other expansion for B, we'll add B to this
   pending-recursion stack, and tentatively return NULL for its
   location.  This tentative value will be used for any other
   occurrences of B, unless A gets some other location, in which case
   it will notify B that it is worth another try at computing a
   location for it, and it will use the location computed for A then.
   At the end of the expansion, the tentative NULL locations become
   final for all members of PENDING that didn't get a notification.
   This function performs this finalization of NULL locations.  
static void reverse_op ( )
static
   Attempt to reverse the EXPR operation in the debug info and record
   it in the cselib table.  Say for reg1 = reg2 + 6 even when reg2 is
   no longer live we can express its value as VAL - 6.  
     Use canonical V to avoid creating multiple redundant expressions
     for different VALUES equivalent to V.  
     Adding a reverse op isn't useful if V already has an always valid
     location.  Ignore ENTRY_VALUE, while it is always constant, we should
     prefer non-ENTRY_VALUE locations whenever possible.  
       Avoid creating too large locs lists.  
           Ensure ret isn't VALUE itself (which can happen e.g. for
           (plus (reg1) (reg2)) when reg2 is known to be 0), as that
           breaks a lot of routines during var-tracking.  

References aggregate_value_p(), build_pointer_type(), get_call_rtx_from(), list_length(), memset(), pack_cumulative_args(), and targetm.

static int rtx_debug_expr_p ( )
static
   Return true if *X is a DEBUG_EXPR.  Usable as an argument to
   for_each_rtx to tell whether there are any DEBUG_EXPRs within
   RTX.  
static bool same_variable_part_p ( rtx  ,
tree  ,
HOST_WIDE_INT   
)
static
static bool same_variable_part_p ( )
static
   Determine whether a given LOC refers to the same variable part as
   EXPR+OFFSET.  

References cselib_preserve_value(), and cselib_val_struct::val_rtx.

static void set_dv_changed ( decl_or_value  ,
bool   
)
static
static void set_dv_changed ( )
inlinestatic
   Record (if NEWV) that DV needs to have its cur_loc recomputed.  For
   user DECLs, this means they're in changed_variables.  Values and
   debug exprs may be left with this flag set if no user variable
   requires them to be evaluated.  
         Fall through...  
static variable_def ** set_slot_part ( dataflow_set set,
rtx  loc,
variable_def **  slot,
decl_or_value  dv,
HOST_WIDE_INT  offset,
enum var_init_status  initialized,
rtx  set_src 
)
static
         Create new variable information.  
                 LOC is in the beginning of the chain so we have nothing
                 to do.  
                 We have to make a copy of a shared variable.  
             We have not found the location part, new one will be created.  
             We have to make a copy of the shared variable.  
             We track only variables whose size is <= MAX_VAR_PARTS bytes
             thus there are at most MAX_VAR_PARTS different offsets.  
             We have to move the elements of array starting at index
             inspos to the next position.  
         Delete the location from the list.  
                 Save these values, to assign to the new node, before
                 deleting this one.  
     Add the location to the beginning.  
     If no location was emitted do so.  

Referenced by canonicalize_values_star(), and variable_was_changed().

static void set_variable_part ( dataflow_set set,
rtx  loc,
decl_or_value  dv,
HOST_WIDE_INT  offset,
enum var_init_status  initialized,
rtx  set_src,
enum insert_option  iopt 
)
static
   Set the part of variable's location in the dataflow set SET.  The
   variable part is specified by variable's declaration in DV and
   offset OFFSET and the part's location by LOC.  IOPT should be
   NO_INSERT if the variable is known to be in SET already and the
   variable hash table must not be resized, and INSERT otherwise.  

Referenced by canonicalize_values_star(), dataflow_set_equiv_regs(), and val_bind().

static shared_hash shared_hash_copy ( )
inlinestatic
   Increment reference counter on VARS and return it.  
static void shared_hash_destroy ( )
static
   Decrement reference counter and destroy hash table if not shared
   anymore.  
static variable shared_hash_find ( )
inlinestatic
static variable shared_hash_find_1 ( )
inlinestatic
   Return variable for DV or NULL if not already present in the hash
   table.  

Referenced by canonicalize_values_star().

static variable_def** shared_hash_find_slot ( )
inlinestatic

Referenced by variable_was_changed().

static variable_def** shared_hash_find_slot_1 ( )
inlinestatic
   Return slot for DV, if it is already present in the hash table.
   If it is not present, insert it only VARS is not shared, otherwise
   return NULL.  
static variable_def** shared_hash_find_slot_noinsert ( )
inlinestatic
static variable_def** shared_hash_find_slot_noinsert_1 ( shared_hash  vars,
decl_or_value  dv,
hashval_t  dvhash 
)
inlinestatic
   Return slot for DV only if it is already present in the hash table.  

Referenced by canonicalize_values_star().

static variable_def** shared_hash_find_slot_unshare ( shared_hash pvars,
decl_or_value  dv,
enum insert_option  ins 
)
inlinestatic
static variable_def** shared_hash_find_slot_unshare_1 ( shared_hash pvars,
decl_or_value  dv,
hashval_t  dvhash,
enum insert_option  ins 
)
inlinestatic
   Unshare *PVARS if shared and return slot for DV.  If INS is
   INSERT, insert it if not already present.  

Referenced by canonicalize_values_star().

static variable_table_type shared_hash_htab ( )
inlinestatic
   Return the hash table for VARS.  

Referenced by attrs_list_member(), attrs_list_union(), find_src_set_src(), and vt_find_locations().

static bool shared_hash_shared ( )
inlinestatic
   Shared hashtable support.  
   Return true if VARS is shared.  

Referenced by attrs_list_member(), canonicalize_values_star(), and vt_find_locations().

static shared_hash shared_hash_unshare ( )
static
   Copy variables into a new hash table.  

Referenced by attrs_list_member().

static bool shared_var_p ( )
inlinestatic
   Return true if VAR is shared, or maybe because VARS is shared.  
     Don't count an entry in the changed_variables table as a duplicate.  

References emit_notes.

Referenced by dump_dataflow_sets(), and get_addr_from_local_cache().

static void stack_adjust_offset_pre_post ( rtx  pattern,
HOST_WIDE_INT pre,
HOST_WIDE_INT post 
)
static
   Local function prototypes.  
   Given a SET, calculate the amount of stack adjustment it contains
   PRE- and POST-modifying stack pointer.
   This function is similar to stack_adjust_offset.  
         (set (reg sp) (plus (reg sp) (const_int))) 
         (set (mem (pre_dec (reg sp))) (foo)) 
                 We handle only adjustments by constant amount.  
static bool track_expr_p ( tree  ,
bool   
)
static
static bool track_expr_p ( )
static
   Shall EXPR be tracked?  
     If EXPR is not a parameter or a variable do not track it.  
     It also must have a name...  
     ... and a RTL assigned to it.  
     If this expression is really a debug alias of some other declaration, we
     don't need to track this expression if the ultimate declaration is
     ignored.  
     Do not track EXPR if REALDECL it should be ignored for debugging
     purposes.  
     Do not track global variables until we are able to emit correct location
     list for them.  
     When the EXPR is a DECL for alias of some variable (see example)
     the TREE_STATIC flag is not used.  Disable tracking all DECLs whose
     DECL_RTL contains SYMBOL_REF.

     Example:
     extern char **_dl_argv_internal __attribute__ ((alias ("_dl_argv")));
     char **_dl_argv;
     If RTX is a memory it should not be very large (because it would be
     an array or struct).  
         Do not track structures and arrays.  
static bool track_loc_p ( rtx  loc,
tree  expr,
HOST_WIDE_INT  offset,
bool  store_reg_p,
enum machine_mode *  mode_out,
HOST_WIDE_INT offset_out 
)
static
   LOC is a REG or MEM that we would like to track if possible.
   If EXPR is null, we don't know what expression LOC refers to,
   otherwise it refers to EXPR + OFFSET.  STORE_REG_P is true if
   LOC is an lvalue register.

   Return true if EXPR is nonnull and if LOC, or some lowpart of it,
   is something we can track.  When returning true, store the mode of
   the lowpart we can track in *MODE_OUT (if nonnull) and its offset
   from EXPR in *OFFSET_OUT (if nonnull).  
     If REG was a paradoxical subreg, its REG_ATTRS will describe the
     whole subreg, but only the old inner part is really relevant.  
     If LOC is a paradoxical lowpart of EXPR, refer to EXPR itself.
     Do the same if we are storing to a register and EXPR occupies
     the whole of register LOC; in that case, the whole of EXPR is
     being changed.  We exclude complex modes from the second case
     because the real and imaginary parts are represented as separate
     pseudo registers, even if the whole complex value fits into one
     hard register.  
static variable_def ** unshare_variable ( dataflow_set set,
variable_def **  slot,
variable  var,
enum var_init_status  initialized 
)
static
   Return a copy of a variable VAR and insert it to dataflow set SET.  
             One-part auxiliary data is only used while emitting
             notes, so propagate it to the new variable in the active
             dataflow set.  If we're not emitting notes, this will be
             a no-op.  

References location_chain_def::init.

Referenced by dump_dataflow_sets(), find_variable_location_part(), and get_addr_from_local_cache().

static bool unsuitable_loc ( )
inlinestatic
   Return true if LOC should not be expanded for location expressions,
   or used in them.  

References dump_file, dump_flags, dv_from_value(), print_inline_rtx(), and val_reset().

Referenced by log_op_type().

static expand_depth update_depth ( )
inlinestatic
   Return the combined depth, when one sub-expression evaluated to
   BEST_DEPTH and the previous known depth was SAVED_DEPTH.  
     If we didn't find anything, stick with what we had.  
     If we found hadn't found anything, use the depth of the current
     expression.  Do NOT add one extra level, we want to compute the
     maximum depth among sub-expressions.  We'll increment it later,
     if appropriate.  
     Combine the entryval count so that regardless of which one we
     return, the entryval count is accurate.  
static rtx use_narrower_mode ( )
static
   Transform X into narrower mode MODE from wider mode WMODE.  
static int use_narrower_mode_test ( )
static
   Helper for adjust_mems.  Return 1 if *loc is unsuitable for
   transformation of wider mode arithmetics to narrower mode,
   -1 if it is suitable and subexpressions shouldn't be
   traversed and 0 if it is suitable and subexpressions should
   be traversed.  Called through for_each_rtx.  

Referenced by vt_stack_adjustments().

static enum micro_operation_type use_type ( )
static
   Determine what kind of micro operation to choose for a USE.  Return
   MO_CLOBBER if no micro operation is to be generated.  
                     ??? flag_float_store and volatile mems are never
                     given values, but we could in theory use them for
                     locations.  
                  Multi-part variables shouldn't refer to one-part
                  variable names such as VALUEs (never happens) or
                  DEBUG_EXPRs (only happens in the presence of debug
                  insns).  
static void val_bind ( )
inlinestatic
   Bind VAL to LOC in SET.  If MODIFIED, detach LOC from any values
   bound to it.  
         If this MEM is a global constant, we don't need it in the
         dynamic tables.  ??? We should test this before emitting the
         micro-op in the first place.  
         Other kinds of equivalences are necessarily static, at least
         so long as we do not perform substitutions while merging
         expressions.  

References attrs_def::dv, dv_as_value(), dv_from_value(), dv_is_value_p(), attrs_def::next, attrs_def::offset, set_variable_part(), and VAR_INIT_STATUS_INITIALIZED.

static void val_reset ( )
static
   Reset this node, detaching all its equivalences.  Return the slot
   in the variable hash table that holds dv, if there is one.  
         Relationships in the global cache don't change, so reset the
         local cache entry only.  
             If the value resolved back to itself, odds are that other
             values may have cached it too.  These entries now refer
             to the old X, so detach them too.  Entries that used the
             old X but resolved to something else remain ok as long as
             that something else isn't also reset.  
           Redirect the equivalence link to the new canonical
           value, or simply remove it if it would point at
           itself.  
         Keep the remaining values connected, accummulating links
         in the canonical value.  
     We remove this last, to make sure that the canonical value is not
     removed to the point of requiring reinsertion.  

Referenced by unsuitable_loc().

static void val_resolve ( )
static
   Find the values in a given location and map the val to another
   value, if it is unique, or add the location as one holding the
   value.  
               Map incoming equivalences.  ??? Wouldn't it be nice if
             we just started sharing the location lists?  Maybe a
             circular list ending at the value itself or some
             such.  
         If we didn't find any equivalence, we need to remember that
         this value is held in the named register.  
     ??? Attempt to find and merge equivalent MEMs or other
     expressions too.  
static void val_store ( )
static
   Bind a value to a location it was just stored in.  If MODIFIED
   holds, assume the location was modified, detaching it from any
   values bound to it.  
static tree var_debug_decl ( tree  )
static
static tree var_debug_decl ( )
inlinestatic
   Map a decl to its main debug decl.  
static rtx var_lowpart ( )
static
   Return the MODE lowpart of LOC, or null if LOC is not something we
   want to track.  When returning nonnull, make sure that the attributes
   on the returned value are updated.  

Referenced by preserve_value().

static void var_mem_decl_set ( dataflow_set set,
rtx  loc,
enum var_init_status  initialized,
decl_or_value  dv,
HOST_WIDE_INT  offset,
rtx  set_src,
enum insert_option  iopt 
)
static
   Set the location of DV, OFFSET as the MEM LOC.  

References dv_as_value(), local_get_addr_cache, and pointer_map_contains().

Referenced by drop_overlapping_mem_locs().

static void var_mem_delete ( dataflow_set ,
rtx  ,
bool   
)
static
static void var_mem_delete ( )
static
   Delete the location part LOC from dataflow set SET.  If CLOBBER is
   true, also delete any other live copies of the same variable part.
   Adjust the address first if it is stack pointer based.  
static void var_mem_delete_and_set ( dataflow_set set,
rtx  loc,
bool  modify,
enum var_init_status  initialized,
rtx  set_src 
)
static
   Delete and set the location part of variable MEM_EXPR (LOC) in
   dataflow set SET to LOC.  If MODIFY is true, any other live copies
   of the same variable part are also deleted from the dataflow set,
   otherwise the variable part is assumed to be copied from another
   location holding the same part.
   Adjust the address first if it is stack pointer based.  
static void var_mem_set ( dataflow_set set,
rtx  loc,
enum var_init_status  initialized,
rtx  set_src 
)
static
   Set the location part of variable MEM_EXPR (LOC) in dataflow set
   SET to LOC.
   Adjust the address first if it is stack pointer based.  
static void var_reg_decl_set ( dataflow_set set,
rtx  loc,
enum var_init_status  initialized,
decl_or_value  dv,
HOST_WIDE_INT  offset,
rtx  set_src,
enum insert_option  iopt 
)
static
   Set the register LOC to contain DV, OFFSET.  

References negative_power_of_two_p().

Referenced by shared_hash_find().

static void var_reg_delete ( dataflow_set ,
rtx  ,
bool   
)
static
static void var_reg_delete ( )
static
   Delete the association of register LOC in dataflow set SET with any
   variables that aren't onepart.  If CLOBBER is true, also delete any
   other live copies of the same variable part, and delete the
   association with onepart dvs too.  
static void var_reg_delete_and_set ( dataflow_set set,
rtx  loc,
bool  modify,
enum var_init_status  initialized,
rtx  set_src 
)
static
   Delete current content of register LOC in dataflow set SET and set
   the register to contain REG_EXPR (LOC), REG_OFFSET (LOC).  If
   MODIFY is true, any other live copies of the same variable part are
   also deleted from the dataflow set, otherwise the variable part is
   assumed to be copied from another location holding the same
   part.  
static void var_reg_set ( dataflow_set set,
rtx  loc,
enum var_init_status  initialized,
rtx  set_src 
)
static
   Set the register to contain REG_EXPR (LOC), REG_OFFSET (LOC).  
static void var_regno_delete ( dataflow_set ,
int   
)
static
static void var_regno_delete ( )
static
   Delete content of register with number REGNO in dataflow set SET.  

References negative_power_of_two_p(), and vt_canonicalize_addr().

int var_track_values_to_stack ( variable_def **  slot,
vec< rtx, va_heap > *  changed_values_stack 
)
   While traversing changed_variables, push onto DATA (a stack of RTX
   values) entries that aren't user variables.  
static bool variable_different_p ( variable  ,
variable   
)
static
static bool variable_different_p ( )
static
   Return true if variables VAR1 and VAR2 are different.  
         One-part values have locations in a canonical order.  
static variable variable_from_dropped ( )
inlinestatic
   Return the variable for DV in dropped_values, inserting one if
   requested with INSERT.  
static void variable_htab_free ( void *  )
static

Referenced by vt_find_locations().

static void variable_htab_free ( )
static
   Free the element of VARIABLE_HTAB (its type is struct variable_def).  
         These may be reused across functions, so reset
         e.g. NO_LOC_P.  

References shared_hash_def::refcount.

static int variable_merge_over_cur ( )
static
   Combine variable or value in *S1SLOT (in DSM->cur) with the
   corresponding entry in DSM->src.  Multi-part variables are combined
   with variable_union, whereas onepart dvs are combined with
   intersection.  
     If the incoming onepart variable has an empty location list, then
     the intersection will be just as empty.  For other variables,
     it's always union.  
             If this value became canonical for another value that had
             this register, we want to leave it alone.  
                 Since nextp points into the removed node, we can't
                 use it.  The pointer to the next node moved to nodep.
                 However, if the variable we're walking is unshared
                 during our walk, we'll keep walking the location list
                 of the previously-shared variable, in which case the
                 node won't have been removed, and we'll want to skip
                 it.  That's why we test *nodep here.  
           Canonicalization puts registers first, so we don't have to
           walk it all.  
         Mark all referenced nodes for canonicalization, and make sure
         we have mutual equivalence links.  
         If we have one value and anything else, we're going to
         canonicalize this, so make sure all values have an entry in
         the table and are marked for canonicalization.  
                 If this was marked during register canonicalization,
                 we know we have to canonicalize values.  
static int variable_merge_over_src ( )
static
   Copy s2slot (in DSM->src) to DSM->dst if the variable is a
   multi-part variable.  Unions of multi-part variables and
   intersections of one-part ones will be handled in
   variable_merge_over_cur().  
static bool variable_part_different_p ( variable_part ,
variable_part  
)
static
static bool variable_part_different_p ( )
static

References track_expr_p().

int variable_post_merge_new_vals ( )
   Create values for incoming expressions associated with one-part
   variables that don't have value numbers for them.  
                         Create a unique value to hold this register,
                         that ought to be found and reused in
                         subsequent rounds.  
                 Remove attribute referring to the decl, which now
                 uses the value for the register, already existing or
                 to be added when we bring perm in.  
int variable_post_merge_perm_vals ( )
   Reset values in the permanent set that are not associated with the
   chosen expression.  
         Although variable_post_merge_new_vals may have made decls
         non-star-canonical, values that pre-existed in canonical form
         remain canonical, and newly-created values reference a single
         REG, so they are canonical as well.  Since VAR has the
         location list for a VALUE, using find_loc_in_1pdv for it is
         fine, since VALUEs don't map back to DECLs.  
     If there is a value associated with this register already, create
     an equivalence.  
unsigned int variable_tracking_main ( void  )
   In var-tracking.c 
static unsigned int variable_tracking_main_1 ( )
inlinestatic
   The entry point to variable tracking pass.  
         This is later restored by our caller.  
static int variable_union ( )
static
   Compute union of location parts of variable *SLOT and the same variable
   from hash table DATA.  Compute "sorted" union of the location chains
   for common offsets, i.e. the locations of a variable part are sorted by
   a priority where the priority is the sum of the positions in the 2 chains
   (if a location is only in one list the position in the second list is
   defined to be larger than the length of the chains).
   When we are updating the location parts the newest location is in the
   beginning of the chain, so when we do the described "sorted" union
   we keep the newest locations in the beginning.  
         Continue traversing the hash table.  
     We can combine one-part variables very efficiently, because their
     entries are in canonical order.  
     Count the number of location parts, result is K.  
     We track only variables whose size is <= MAX_VAR_PARTS bytes
     thus there are at most MAX_VAR_PARTS different offsets.  
             Compute the "sorted" union of the chains, i.e. the locations which
             are in both chains go first, they are sorted by the sum of
             positions in the chains.  
             If DST is shared compare the location chains.
             If they are different we will modify the chain in DST with
             high probability so make a copy of DST.  
                 The most common case, much simpler, no qsort is needed.  
                       Copy the location from SRC.  
                 Fill in the locations from DST.  
                     Pos plus value larger than a sum of 2 valid positions.  
                 Fill in the locations from SRC.  
                     Find location from NODE.  
                         Copy the location from SRC.  
                     Special case still very common case.  For dst_l == 2
                     all entries dst_l ... n-1 are sorted, with for i >= dst_l
                     vui[i].pos == i + src_l + dst_l.  
                         Order should be 1, 0, 2... 
                             Order should be 0, 2, 1, 3... 
                             Order should be 0, 1, 2... 
                     Reconnect the nodes in sorted order.  
             Copy the chain from SRC.  
     Continue traversing the hash table.  

References variable_union_info::pos.

Referenced by canonicalize_values_star().

static int variable_union_info_cmp_pos ( const void *  ,
const void *   
)
static
static int variable_union_info_cmp_pos ( )
static
   Compare function for qsort, order the structures by POS element.  
static void variable_was_changed ( variable  ,
dataflow_set  
)
static
static void variable_was_changed ( )
static
   Add variable VAR to the hash table of changed variables and
   if it has no locations delete it from SET's hash table.  
         Remember this decl or VALUE has been added to changed_variables.  
                 Restore the auxiliary info from an empty variable
                 previously created for changed_variables, so it is
                 not lost.  

References set_slot_part(), shared_hash_find_slot(), shared_hash_find_slot_noinsert(), and shared_hash_find_slot_unshare().

static void vars_copy ( variable_table_type  ,
variable_table_type   
)
static
static void vars_copy ( )
static
   Copy all variables from hash table SRC to hash table DST.  
static void vt_add_function_parameter ( )
static
   Insert function parameter PARM in IN and OUT sets of ENTRY_BLOCK.  
     If there is a DRAP register or a pseudo in internal_arg_pointer,
     rewrite the incoming location of parameters passed on the stack
     into MEMs based on the argument pointer, so that incoming doesn't
     depend on a pseudo.  
     DECL_INCOMING_RTL uses the INCOMING_REGNO of parameter registers.
     If the target machine has an explicit window save instruction, the
     actual entry value is the corresponding OUTGOING_REGNO instead.  
             This means argument is passed by invisible reference.  
         If that DECL_RTL wasn't a pseudo that got spilled to
         memory, bail out.  Otherwise, the spill slot sharing code
         will force the memory to reference spill_slot_decl (%sfp),
         so we don't match above.  That's ok, the pseudo must have
         referenced the entire parameter, so just reset OFFSET.  
         We can't deal with these right now, because this kind of
         variable is single-part.  ??? We could handle parallels
         that describe multiple locations for the same single
         value, but ATM we don't.  
         ??? We shouldn't ever hit this, but it may happen because
         arguments passed by invisible reference aren't dealt with
         above: incoming-rtl will have Pmode rather than the
         expected mode for the type.  
         ??? Float-typed values in memory are not handled by
         cselib.  

References micro_operation_def::adjust, dump_file, dump_flags, micro_operation_def::insn, log_op_type(), MO_ADJUST, micro_operation_def::type, and micro_operation_def::u.

static void vt_add_function_parameters ( )
static
   Insert function parameters to IN and OUT sets of ENTRY_BLOCK.  
static bool vt_canon_true_dep ( )
inlinestatic
   Return true iff there's a true dependence between MLOC and LOC.
   MADDR must be a canonicalized version of MLOC's address.  

Referenced by get_addr_from_local_cache().

static rtx vt_canonicalize_addr ( dataflow_set ,
rtx   
)
static

Referenced by var_regno_delete().

static rtx vt_canonicalize_addr ( )
static
   Canonicalize LOC using equivalences from SET in addition to those
   in the cselib static table.  It expects a VALUE-based expression,
   and it will only substitute VALUEs with other VALUEs or
   function-global equivalences, so that, if two addresses have base
   VALUEs that are locally or globally related in ways that
   memrefs_conflict_p cares about, they will both canonicalize to
   expressions that have the same base VALUE.

   The use of VALUEs as canonical base addresses enables the canonical
   RTXs to remain unchanged globally, if they resolve to a constant,
   or throughout a basic block otherwise, so that they can be cached
   and the cache needs not be invalidated when REGs, MEMs or such
   change.  
         Alignment operations can't normally be combined, so just
         canonicalize the base and we're done.  We'll normally have
         only one stack alignment anyway.  
             Consolidate plus_constants.  
     Add OFST back in.  
         Don't build new RTL if we can help it.  
static void vt_debug_insns_local ( )
static
   Run a fast, BB-local only version of var tracking, to take care of
   information that we don't do global analysis on, such that not all
   information is lost.  If SKIPPED holds, we're skipping the global
   pass entirely, so we should try to use information it would have
   handled as well..  
     ??? Just skip it all for now.  
static void vt_emit_notes ( )
static
   Emit notes for the whole function.  
     Free memory occupied by the out hash tables, as they aren't used
     anymore.  
     Enable emitting notes by functions (mainly by set_variable_part and
     delete_variable_part).  
         Emit the notes for changes of variable locations between two
         subsequent basic blocks.  
         Emit the notes for the changes in the basic block itself.  
         Free memory occupied by the in hash table, we won't need it
         again.  
static rtx vt_expand_1pvar ( )
static
   Expand the one-part VARiable to a location, using the equivalences
   in VARS, updating their CUR_LOCs in the process.  
static rtx vt_expand_loc ( )
static
   Expand VALUEs and DEBUG_EXPRs in LOC to a location, using the
   equivalences in VARS, updating their CUR_LOCs in the process.  
static rtx vt_expand_loc_callback ( rtx  x,
bitmap  regs,
int  max_depth,
void *  data 
)
static
   Callback for cselib_expand_value, that looks for expressions
   holding the value in the var-tracking hash tables.  Return X for
   standard processing, anything else is to be used as-is.  
         Invalid SUBREGs are ok in debug info.  ??? We could try
         alternate expansions for the VALUE as well.  
     Check that VALUE_RECURSED_INTO implies NO_LOC_P.  
     This is tentative, but it makes some tests simpler.  

Referenced by loc_exp_insert_dep().

static rtx vt_expand_var_loc_chain ( )
inlinestatic
   Expand VAR to a location RTX, updating its cur_loc.  Use REGS and
   DATA for cselib expand callback.  If PENDRECP is given, indicate in
   it whether any sub-expression couldn't be fully evaluated because
   it is pending recursion resolution.  
     Clear all backlinks pointing at this, so that we're not notified
     while we're active.  
     Attempt to expand each available location in turn.  
         Set it up in case we leave the loop.  
         We found entries with ENTRY_VALUEs and skipped them.  Since
         we could not find any expansions without ENTRY_VALUEs, but we
         found at least one with them, go back and get an entry with
         the minimum number ENTRY_VALUE count that we found.  We could
         avoid looping, but since each sub-loc is already resolved,
         the re-expansion should be trivial.  ??? Should we record all
         attempted locs as dependencies, so that we retry the
         expansion should any of them change, in the hope it can give
         us a new entry without an ENTRY_VALUE?  
     Register all encountered dependencies as active.  
     Record where the expansion came from.  
     Indicate whether any of the dependencies are pending recursion
     resolution.  
static void vt_finalize ( )
static
   Free the data structures needed for variable tracking.  
static bool vt_find_locations ( )
static
   Find the locations of variables in the whole function.  
     Compute reverse completion order of depth first search of the CFG
     so that the data-flow runs faster.  
                     Calculate the IN set as the intersection of
                     predecessor OUT sets.  
                         Merge and merge_adjust should keep entries in
                         canonical order.  
                     Calculate the IN set as union of predecessor OUT sets.  
                                 Send E->DEST to next round.  
                             Add E->DEST to current round.  

References changed_variables, hash_table< Descriptor, Allocator >::clear_slot(), dropped_values, variable_def::dv, dv_htab_hash(), emit_notes, hash_table< Descriptor, Allocator >::find_slot_with_hash(), variable_def::n_var_parts, ONEPART_DEXPR, onepart_pool(), ONEPART_VALUE, pool_alloc(), recover_dropped_1paux(), variable_def::refcount, set_dv_changed(), shared_hash_find_slot_noinsert(), shared_hash_find_slot_unshare(), shared_hash_htab(), shared_hash_shared(), and variable_htab_free().

static rtx vt_get_canonicalize_base ( )
static
   Strip constant offsets and alignments off of LOC.  Return the base
   expression.  

Referenced by clobber_overlapping_mems().

static bool vt_get_decl_and_offset ( rtx  ,
tree ,
HOST_WIDE_INT  
)
static
static bool vt_get_decl_and_offset ( )
static
   If there is a declaration and offset associated with register/memory RTL
   assign declaration to *DECLP and offset to *OFFSETP, and return true.  

References micro_operation_def::adjust, adjust_insn(), cselib_hook_called, dump_file, dump_flags, micro_operation_def::insn, insn_stack_adjust_offset_pre_post(), log_op_type(), MO_ADJUST, micro_operation_def::type, and micro_operation_def::u.

static void vt_init_cfa_base ( )
static
   Initialize cfa_base_rtx, create a preserved VALUE for it and
   ensure it isn't flushed during cselib_reset_table.
   Can be called only if frame_pointer_rtx resp. arg_pointer_rtx
   has been eliminated.  
     Tell alias analysis that cfa_base_rtx should share
     find_base_term value with stack pointer or hard frame pointer.  
static bool vt_initialize ( )
static
   Allocate and initialize the data structures for variable tracking
   and parse the RTL to get the micro operations.  
     Init the IN and OUT sets.  
     In order to factor out the adjustments made to the stack pointer or to
     the hard frame pointer and thus be able to use DW_OP_fbreg operations
     instead of individual location lists, we're going to rewrite MEMs based
     on them into MEMs based on the CFA by de-eliminating stack_pointer_rtx
     or hard_frame_pointer_rtx to the virtual CFA pointer frame_pointer_rtx
     resp. arg_pointer_rtx.  We can do this either when there is no frame
     pointer in the function and stack adjustments are consistent for all
     basic blocks or when there is a frame pointer and no stack realignment.
     But we first have to check that frame_pointer_rtx resp. arg_pointer_rtx
     has been eliminated.  
     If the stack is realigned and a DRAP register is used, we're going to
     rewrite MEMs based on it representing incoming locations of parameters
     passed on the stack into MEMs based on the argument pointer.  Although
     we aren't going to rewrite other MEMs, we still need to initialize the
     virtual CFA pointer in order to ensure that the argument pointer will
     be seen as a constant throughout the function.

     ??? This doesn't work if FRAME_POINTER_CFA_OFFSET is defined.  
         Add the micro-operations to the vector.  
                         Disassociate sp from fp now.  
static bool vt_stack_adjustments ( )
static
   Compute stack adjustments for all blocks by traversing DFS tree.
   Return true when the adjustments on all incoming edges are consistent.
   Heavily borrowed from pre_and_rev_post_order_compute.  
     Initialize entry block.  
     Allocate stack for back-tracking up CFG.  
     Push the first edge on to the stack.  
         Look at the edge on the top of the stack.  
         Check if the edge destination has been visited yet.  
               Since the DEST node has been visited for the first
               time, check its successors.  
             Check whether the adjustments on the edges are the same.  
               Go to the next edge.  
               Return to previous level if there are no more edges.  

References cselib_lookup(), for_each_rtx(), subreg_lowpart_offset(), use_narrower_mode_test(), and validate_subreg().


Variable Documentation

alloc_pool attrs_pool
static
   Alloc pool for struct attrs_def.  

Referenced by dv_from_value(), and dv_onepart_p().

rtx call_arguments
static
   Arguments to the call.  
HOST_WIDE_INT cfa_base_offset
static
rtx cfa_base_rtx
static
   arg_pointer_rtx resp. frame_pointer_rtx if stack_pointer_rtx or
   hard_frame_pointer_rtx is being mapped to it and offset for it.  

Referenced by log_op_type().

variable_table_type changed_variables
static
   Changed variables, notes will be emitted for them.  

Referenced by vt_find_locations().

char check_value_val[(int) VALUE==(int) IDENTIFIER_NODE?1:-1]
@verbatim 

Variable tracking routines for the GNU compiler. Copyright (C) 2002-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/.

   This file contains the variable tracking pass.  It computes where
   variables are located (which registers or where in memory) at each position
   in instruction stream and emits notes describing the locations.
   Debug information (DWARF2 location lists) is finally generated from
   these notes.
   With this debug information, it is possible to show variables
   even when debugging optimized code.

   How does the variable tracking pass work?

   First, it scans RTL code for uses, stores and clobbers (register/memory
   references in instructions), for call insns and for stack adjustments
   separately for each basic block and saves them to an array of micro
   operations.
   The micro operations of one instruction are ordered so that
   pre-modifying stack adjustment < use < use with no var < call insn <
     < clobber < set < post-modifying stack adjustment

   Then, a forward dataflow analysis is performed to find out how locations
   of variables change through code and to propagate the variable locations
   along control flow graph.
   The IN set for basic block BB is computed as a union of OUT sets of BB's
   predecessors, the OUT set for BB is copied from the IN set for BB and
   is changed according to micro operations in BB.

   The IN and OUT sets for basic blocks consist of a current stack adjustment
   (used for adjusting offset of variables addressed using stack pointer),
   the table of structures describing the locations of parts of a variable
   and for each physical register a linked list for each physical register.
   The linked list is a list of variable parts stored in the register,
   i.e. it is a list of triplets (reg, decl, offset) where decl is
   REG_EXPR (reg) and offset is REG_OFFSET (reg).  The linked list is used for
   effective deleting appropriate variable parts when we set or clobber the
   register.

   There may be more than one variable part in a register.  The linked lists
   should be pretty short so it is a good data structure here.
   For example in the following code, register allocator may assign same
   register to variables A and B, and both of them are stored in the same
   register in CODE:

     if (cond)
       set A;
     else
       set B;
     CODE;
     if (cond)
       use A;
     else
       use B;

   Finally, the NOTE_INSN_VAR_LOCATION notes describing the variable locations
   are emitted to appropriate positions in RTL code.  Each such a note describes
   the location of one variable at the point in instruction stream where the
   note is.  There is no need to emit a note for each variable before each
   instruction, we only emit these notes where the location of variable changes
   (this means that we also emit notes for changes between the OUT set of the
   previous block and the IN set of the current block).

   The notes consist of two parts:
   1. the declaration (from REG_EXPR or MEM_EXPR)
   2. the location of a variable - it is either a simple register/memory
      reference (for simple variables, for example int),
      or a parallel of register/memory references (for a large variables
      which consist of several parts, for example long long).
   var-tracking.c assumes that tree code with the same value as VALUE rtx code
   has no chance to appear in REG_EXPR/MEM_EXPRs and isn't a decl.
   Currently the value is the same as IDENTIFIER_NODE, which has such
   a property.  If this compile time assertion ever fails, make sure that
   the new tree code that equals (int) VALUE has the same property.  
bool cselib_hook_called
static
   Variable used to tell whether cselib_process_insn called our hook.  

Referenced by vt_get_decl_and_offset().

int debug_label_num = 1
static
   This is *not* reset after each function.  It gives each
   NOTE_INSN_DELETED_DEBUG_LABEL in the entire compilation
   a unique label number.  
variable_table_type dropped_values
static
   Values whose dynamic location lists have gone empty, but whose
   cselib location lists are still usable.  Use this to hold the
   current location, the backlinks, etc, during emit_notes.  

Referenced by emit_notes_for_changes(), and vt_find_locations().

bool dst_can_be_shared
static
bool emit_notes
static
   Shall notes be emitted?  

Referenced by shared_var_p(), and vt_find_locations().

shared_hash empty_shared_hash
static
   Empty shared hashtable.  
struct pointer_map_t* global_get_addr_cache
static
   This caches canonicalized addresses for VALUEs, computed using
   information in the global cselib table.  
HOST_WIDE_INT hard_frame_pointer_adjustment = -1
static
   Adjustment for hard_frame_pointer_rtx to cfa base reg,
   or -1 if the replacement shouldn't be done.  
alloc_pool loc_chain_pool
static
   Alloc pool for struct location_chain_def.  

Referenced by get_addr_from_local_cache().

alloc_pool loc_exp_dep_pool
static
   Alloc pool for struct loc_exp_dep_s for NOT_ONEPART variables.  

Referenced by emit_notes_for_changes().

struct pointer_map_t* local_get_addr_cache
static
   This caches canonicalized addresses for VALUEs, computed using
   information from the global cache and information pertaining to a
   basic block being analyzed.  

Referenced by var_mem_decl_set().

const char* const micro_operation_type_name[]
static
Initial value:
{
"MO_USE",
"MO_USE_NO_VAR",
"MO_VAL_USE",
"MO_VAL_LOC",
"MO_VAL_SET",
"MO_SET",
"MO_COPY",
"MO_CLOBBER",
"MO_CALL",
"MO_ADJUST"
}
vec<rtx> preserved_values
static
   All preserved VALUEs.  
bitmap scratch_regs = NULL
static
   Scratch register bitmap used by cselib_expand_value_rtx.  

Referenced by loc_exp_insert_dep().

alloc_pool shared_hash_pool
static
   Alloc pool for struct shared_hash_def.  

Referenced by attrs_list_clear().

alloc_pool valvar_pool
static
   Alloc pool for struct variable_def with a single var_part entry.  
alloc_pool var_pool
static
   Alloc pool for struct variable_def with MAX_VAR_PARTS entries.  
int vui_allocated
static
struct variable_union_info* vui_vec
static
   Buffer for location list sorting and its allocated size.  
vec<parm_reg_t, va_gc>* windowed_parm_regs = NULL
static
   Vector of windowed parameter registers, if any.