GCC Middle and Back End API Reference
var-tracking.cc File Reference
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "backend.h"
#include "target.h"
#include "rtl.h"
#include "tree.h"
#include "cfghooks.h"
#include "alloc-pool.h"
#include "tree-pass.h"
#include "memmodel.h"
#include "tm_p.h"
#include "insn-config.h"
#include "regs.h"
#include "emit-rtl.h"
#include "recog.h"
#include "diagnostic.h"
#include "varasm.h"
#include "stor-layout.h"
#include "cfgrtl.h"
#include "cfganal.h"
#include "reload.h"
#include "ira.h"
#include "lra.h"
#include "calls.h"
#include "tree-dfa.h"
#include "tree-ssa.h"
#include "cselib.h"
#include "tree-pretty-print.h"
#include "rtl-iter.h"
#include "fibonacci_heap.h"
#include "print-rtl.h"
#include "function-abi.h"
#include "mux-utils.h"
Include dependency graph for var-tracking.cc:

Data Structures

struct  micro_operation
 
struct  attrs
 
struct  location_chain
 
struct  loc_exp_dep
 
struct  expand_depth
 
struct  onepart_aux
 
struct  variable_part
 
union  variable_part::variable_aux
 
struct  variable
 
struct  variable_hasher
 
struct  emit_note_data
 
struct  shared_hash
 
struct  dataflow_set
 
struct  variable_tracking_info
 
class  adjust_mem_data
 
struct  overlapping_mems
 
struct  variable_union_info
 
struct  dfset_merge
 
struct  dfset_post_merge
 
struct  count_use_info
 
class  expand_loc_callback_data
 

Macros

#define MAX_VAR_PARTS   16
 
#define VTI(BB)
 
#define VAR_PART_OFFSET(var, i)
 
#define VAR_LOC_1PAUX(var)
 
#define VAR_LOC_DEP_LST(var)
 
#define VAR_LOC_DEP_LSTP(var)
 
#define VAR_LOC_FROM(var)
 
#define VAR_LOC_DEPTH(var)
 
#define VAR_LOC_DEP_VEC(var)
 
#define VALUE_RECURSED_INTO(x)
 
#define NO_LOC_P(x)
 
#define VALUE_CHANGED(x)
 
#define DECL_CHANGED(x)
 
#define RETRUE
 
#define VAL_NEEDS_RESOLUTION(x)
 
#define VAL_HOLDS_TRACK_EXPR(x)
 
#define VAL_EXPR_IS_COPIED(x)
 
#define VAL_EXPR_IS_CLOBBERED(x)
 
#define EXPR_DEPTH   (INT_MAX)
 
#define EXPR_USE_DEPTH   (param_max_vartrack_expr_depth)
 
#define INIT_ELCD(d, v)
 
#define FINI_ELCD(d, l)
 

Typedefs

typedef fibonacci_heap< long, basic_block_defbb_heap_t
 
typedef pointer_mux< tree_node, rtx_defdecl_or_value
 
typedef vec< loc_exp_dep, va_heap, vl_embeddeps_vec
 
typedef unsigned int dvuid
 
typedef hash_table< variable_hashervariable_table_type
 
typedef variable_table_type::iterator variable_iterator_type
 

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 (decl_or_value dv)
 
static bool dv_is_value_p (decl_or_value dv)
 
static tree dv_as_decl (decl_or_value dv)
 
static rtx dv_as_value (decl_or_value dv)
 
static HOST_WIDE_INT int_mem_offset (const_rtx mem)
 
static deps_vecvar_loc_dep_vec (variable *var)
 
static dvuid dv_uid (decl_or_value dv)
 
static hashval_t dv_uid2hash (dvuid uid)
 
static hashval_t dv_htab_hash (decl_or_value dv)
 
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_insn *, 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 attrsattrs_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 ** unshare_variable (dataflow_set *set, variable **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_chainfind_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 track_expr_p (tree, bool)
 
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 ** set_slot_part (dataflow_set *, rtx, variable **, 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 ** clobber_slot_part (dataflow_set *, rtx, variable **, HOST_WIDE_INT, rtx)
 
static void clobber_variable_part (dataflow_set *, rtx, decl_or_value, HOST_WIDE_INT, rtx)
 
static variable ** delete_slot_part (dataflow_set *, rtx, variable **, 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 void vt_add_function_parameters (void)
 
static bool vt_initialize (void)
 
static void vt_finalize (void)
 
static int stack_adjust_offset_pre_post_cb (rtx, rtx op, rtx dest, rtx src, rtx srcoff, void *arg)
 
static rtx compute_cfa_pointer (poly_int64 adjustment)
 
static bool use_narrower_mode_test (rtx x, const_rtx subreg)
 
static rtx use_narrower_mode (rtx x, scalar_int_mode mode, scalar_int_mode wmode)
 
static rtx adjust_mems (rtx loc, const_rtx old_rtx, void *data)
 
static void adjust_mem_uses (rtx *x, void *data)
 
static void adjust_mem_stores (rtx loc, const_rtx expr, void *data)
 
static void adjust_insn (basic_block bb, rtx_insn *insn)
 
static rtx dv_as_rtx (decl_or_value dv)
 
static onepart_enum dv_onepart_p (decl_or_value dv)
 
static pool_allocatoronepart_pool (onepart_enum onepart)
 
static variableonepart_pool_allocate (onepart_enum onepart)
 
static decl_or_value dv_from_decl (tree decl)
 
static decl_or_value dv_from_value (rtx value)
 
static decl_or_value dv_from_rtx (rtx x)
 
void debug_dv (decl_or_value dv)
 
static void loc_exp_dep_clear (variable *var)
 
static void attrs_list_mpdv_union (attrs **dstp, attrs *src, attrs *src2)
 
static bool shared_hash_shared (shared_hash *vars)
 
static variable_table_typeshared_hash_htab (shared_hash *vars)
 
static bool shared_var_p (variable *var, shared_hash *vars)
 
static shared_hashshared_hash_unshare (shared_hash *vars)
 
static shared_hashshared_hash_copy (shared_hash *vars)
 
static void shared_hash_destroy (shared_hash *vars)
 
static variable ** shared_hash_find_slot_unshare_1 (shared_hash **pvars, decl_or_value dv, hashval_t dvhash, enum insert_option ins)
 
static variable ** shared_hash_find_slot_unshare (shared_hash **pvars, decl_or_value dv, enum insert_option ins)
 
static variable ** shared_hash_find_slot_1 (shared_hash *vars, decl_or_value dv, hashval_t dvhash)
 
static variable ** shared_hash_find_slot (shared_hash *vars, decl_or_value dv)
 
static variable ** shared_hash_find_slot_noinsert_1 (shared_hash *vars, decl_or_value dv, hashval_t dvhash)
 
static variable ** shared_hash_find_slot_noinsert (shared_hash *vars, decl_or_value dv)
 
static variableshared_hash_find_1 (shared_hash *vars, decl_or_value dv, hashval_t dvhash)
 
static variableshared_hash_find (shared_hash *vars, decl_or_value dv)
 
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 bool track_offset_p (poly_int64 offset, HOST_WIDE_INT *offset_out)
 
static HOST_WIDE_INT get_tracked_reg_offset (rtx loc)
 
static enum var_init_status get_init_value (dataflow_set *set, rtx loc, decl_or_value dv)
 
static bool negative_power_of_two_p (HOST_WIDE_INT i)
 
static rtx vt_get_canonicalize_base (rtx loc)
 
static rtx vt_canonicalize_addr (dataflow_set *, rtx)
 
static rtx get_addr_from_global_cache (rtx const loc)
 
static rtx get_addr_from_local_cache (dataflow_set *set, rtx const loc)
 
static bool vt_canon_true_dep (dataflow_set *set, rtx mloc, rtx maddr, rtx loc)
 
int drop_overlapping_mem_locs (variable **slot, overlapping_mems *coms)
 
static void clobber_overlapping_mems (dataflow_set *set, rtx loc)
 
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 bool unsuitable_loc (rtx loc)
 
static void val_bind (dataflow_set *set, rtx val, rtx loc, bool modified)
 
static void val_store (dataflow_set *set, rtx val, rtx loc, rtx_insn *insn, bool modified)
 
bool local_get_addr_clear_given_value (rtx const &, rtx *slot, rtx x)
 
static void val_reset (dataflow_set *set, decl_or_value dv)
 
static void val_resolve (dataflow_set *set, rtx val, rtx loc, rtx_insn *insn)
 
static int variable_union (variable *src, dataflow_set *set)
 
static bool dv_changed_p (decl_or_value dv)
 
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)
 
int canonicalize_loc_order_check (variable **slot, dataflow_set *data)
 
int canonicalize_values_mark (variable **slot, dataflow_set *set)
 
int canonicalize_values_star (variable **slot, dataflow_set *set)
 
int canonicalize_vars_star (variable **slot, dataflow_set *set)
 
static int variable_merge_over_cur (variable *s1var, struct dfset_merge *dsm)
 
static int variable_merge_over_src (variable *s2var, struct dfset_merge *dsm)
 
static void dataflow_set_merge (dataflow_set *dst, dataflow_set *src2)
 
static void dataflow_set_equiv_regs (dataflow_set *set)
 
static void remove_duplicate_values (variable *var)
 
int variable_post_merge_new_vals (variable **slot, dfset_post_merge *dfpm)
 
int variable_post_merge_perm_vals (variable **pslot, dfset_post_merge *dfpm)
 
static void dataflow_post_merge_adjust (dataflow_set *set, dataflow_set **permp)
 
static location_chainfind_mem_expr_in_1pdv (tree expr, rtx val, variable_table_type *vars)
 
static bool mem_dies_at_call (rtx mem)
 
int dataflow_set_preserve_mem_locs (variable **slot, dataflow_set *set)
 
int dataflow_set_remove_mem_locs (variable **slot, dataflow_set *set)
 
static void dataflow_set_clear_at_call (dataflow_set *set, rtx_insn *call_insn)
 
static void dump_onepart_variable_differences (variable *var1, variable *var2)
 
static bool tracked_record_parameter_p (tree t)
 
static bool same_variable_part_p (rtx loc, tree expr, poly_int64 offset)
 
static bool track_loc_p (rtx loc, tree expr, poly_int64 offset, bool store_reg_p, machine_mode *mode_out, HOST_WIDE_INT *offset_out)
 
static rtx var_lowpart (machine_mode mode, rtx loc)
 
static cselib_valfind_use_val (rtx x, machine_mode mode, struct count_use_info *cui)
 
static rtx replace_expr_with_values (rtx loc)
 
static bool rtx_debug_expr_p (const_rtx x)
 
static enum micro_operation_type use_type (rtx loc, struct count_use_info *cui, machine_mode *modep)
 
static void log_op_type (rtx x, basic_block bb, rtx_insn *insn, enum micro_operation_type mopt, FILE *out)
 
static void preserve_value (cselib_val *val)
 
static bool non_suitable_const (const_rtx x)
 
static void add_uses (rtx loc, struct count_use_info *cui)
 
static void reverse_op (rtx val, const_rtx expr, rtx_insn *insn)
 
static void prepare_call_arguments (basic_block bb, rtx_insn *insn)
 
static void add_with_sets (rtx_insn *insn, struct cselib_set *sets, int n_sets)
 
static enum var_init_status find_src_status (dataflow_set *in, rtx src)
 
static rtx find_src_set_src (dataflow_set *set, rtx src)
 
int dump_var_tracking_slot (variable **slot, void *data)
 
static variablevariable_from_dropped (decl_or_value dv, enum insert_option insert)
 
static struct onepart_auxrecover_dropped_1paux (variable *var)
 
static int find_variable_location_part (variable *var, HOST_WIDE_INT offset, int *insertion_point)
 
static void loc_exp_dep_alloc (variable *var, int count)
 
static void loc_exp_insert_dep (variable *var, rtx x, variable_table_type *vars)
 
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 (variable *ivar, variable_table_type *vars)
 
static rtx vt_expand_loc_callback (rtx x, bitmap regs, int max_depth, void *data)
 
static expand_depth update_depth (expand_depth saved_depth, expand_depth best_depth)
 
static rtx vt_expand_var_loc_chain (variable *var, bitmap regs, void *data, bool *pendrecp)
 
static void resolve_expansions_pending_recursion (vec< rtx, va_heap > *pending)
 
static rtx vt_expand_loc (rtx loc, variable_table_type *vars)
 
static rtx vt_expand_1pvar (variable *var, variable_table_type *vars)
 
int emit_note_insn_var_location (variable **varp, emit_note_data *data)
 
int var_track_values_to_stack (variable **slot, vec< rtx, va_heap > *changed_values_stack)
 
static void remove_value_from_changed_variables (rtx val)
 
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 (variable_table_type *htab)
 
static void emit_notes_for_changes (rtx_insn *insn, enum emit_note_where where, shared_hash *vars)
 
int emit_notes_for_differences_1 (variable **slot, variable_table_type *new_vars)
 
int emit_notes_for_differences_2 (variable **slot, variable_table_type *old_vars)
 
static void emit_notes_for_differences (rtx_insn *insn, dataflow_set *old_set, dataflow_set *new_set)
 
static rtx_insnnext_non_note_insn_var_location (rtx_insn *insn)
 
static bool vt_get_decl_and_offset (rtx rtl, tree *declp, poly_int64 *offsetp)
 
static void record_entry_value (cselib_val *val, rtx rtl)
 
static void vt_add_function_parameter (tree parm)
 
static void vt_init_cfa_base (void)
 
static rtx_insnreemit_marker_as_note (rtx_insn *insn)
 
static void delete_vta_debug_insn (rtx_insn *insn)
 
void delete_vta_debug_insns (bool use_cfg)
 
static void vt_debug_insns_local (bool skipped)
 
static unsigned int variable_tracking_main_1 (void)
 
unsigned int variable_tracking_main (void)
 
rtl_opt_passmake_pass_variable_tracking (gcc::context *ctxt)
 

Variables

char check_value_val [(int) VALUE==(int) IDENTIFIER_NODE ? 1 :-1]
 
static const char *const micro_operation_type_name []
 
object_allocator< attrsattrs_pool ("attrs pool")
 
static pool_allocator var_pool ("variable_def pool", sizeof(variable)+(MAX_VAR_PARTS - 1) *sizeof(((variable *) NULL) ->var_part[0]))
 
static pool_allocator valvar_pool ("small variable_def pool", sizeof(variable))
 
static object_allocator< location_chainlocation_chain_pool ("location_chain pool")
 
static object_allocator< shared_hashshared_hash_pool ("shared_hash pool")
 
object_allocator< loc_exp_deploc_exp_dep_pool ("loc_exp_dep pool")
 
static variable_table_typechanged_variables
 
static bool emit_notes
 
static variable_table_typedropped_values
 
static shared_hashempty_shared_hash
 
static bitmap scratch_regs = NULL
 
static bool cselib_hook_called
 
static rtx cfa_base_rtx
 
static HOST_WIDE_INT cfa_base_offset
 
static poly_int64 hard_frame_pointer_adjustment = -1
 
static bool dst_can_be_shared
 
static hash_map< rtx, rtx > * global_get_addr_cache
 
static hash_map< rtx, rtx > * local_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
 

Macro Definition Documentation

◆ DECL_CHANGED

#define DECL_CHANGED ( x)
Value:
#define TREE_VISITED(NODE)
Definition tree.h:2440
Whether cur_loc in the decl needs to be (re)computed.   

Referenced by dv_changed_p(), set_dv_changed(), and track_expr_p().

◆ EXPR_DEPTH

#define EXPR_DEPTH   (INT_MAX)
This is the value used during expansion of locations.  We want it
to be unbounded, so that variables expanded deep in a recursion
nest are fully evaluated, so that their values are cached
correctly.  We avoid recursion cycles through other means, and we
don't unshare RTL, so excess complexity is not a problem.   

Referenced by vt_expand_loc(), vt_expand_loc_callback(), and vt_expand_var_loc_chain().

◆ EXPR_USE_DEPTH

#define EXPR_USE_DEPTH   (param_max_vartrack_expr_depth)
We use this to keep too-complex expressions from being emitted as
location notes, and then to debug information.  Users can trade
compile time for ridiculously complex expressions, although they're
seldom useful, and they may often have to be discarded as not
representable anyway.   

Referenced by vt_expand_var_loc_chain().

◆ FINI_ELCD

#define FINI_ELCD ( d,
l )
Value:
do \
{ \
resolve_expansions_pending_recursion (&(d).pending); \
(d).pending.release (); \
(d).expanding.release (); \
\
if ((l) && MEM_P (l)) \
(l) = targetm.delegitimize_address (l); \
} \
while (0)
#define MEM_P(X)
Definition rtl.h:749
struct gcc_target targetm
Finalize expand_loc_callback_data D, resolved to location L.   

Referenced by vt_expand_1pvar(), and vt_expand_loc().

◆ INIT_ELCD

#define INIT_ELCD ( d,
v )
Value:
do \
{ \
(d).vars = (v); \
(d).depth.complexity = (d).depth.entryvals = 0; \
} \
while (0)
Initialize expand_loc_callback_data D with variable hash table V.
It must be a macro because of alloca (vec stack).   

Referenced by vt_expand_1pvar(), and vt_expand_loc().

◆ MAX_VAR_PARTS

#define MAX_VAR_PARTS   16

◆ NO_LOC_P

#define NO_LOC_P ( x)
Value:
(RTL_FLAG_CHECK2 ("NO_LOC_P", (x), VALUE, DEBUG_EXPR)->return_val)
#define RTL_FLAG_CHECK2(NAME, RTX, C1, C2)
Definition rtl.h:1337
Whether no expansion was found, saving useless lookups.
It must only be set when VALUE_CHANGED is clear.   

Referenced by notify_dependents_of_resolved_value(), resolve_expansions_pending_recursion(), set_dv_changed(), and vt_expand_loc_callback().

◆ RETRUE

#define RETRUE
Value:
do \
{ \
if (!details) \
return true; \
else \
diffound = true; \
} \
while (0)

Referenced by dataflow_set_different().

◆ VAL_EXPR_IS_CLOBBERED

#define VAL_EXPR_IS_CLOBBERED ( x)
Value:
(RTL_FLAG_CHECK1 ("VAL_EXPR_IS_CLOBBERED", (x), CONCAT)->unchanging)
#define RTL_FLAG_CHECK1(NAME, RTX, C1)
Definition rtl.h:1336
Whether the location in the CONCAT should be handled like a
MO_CLOBBER as well.   

Referenced by add_stores(), compute_bb_dataflow(), and emit_notes_in_bb().

◆ VAL_EXPR_IS_COPIED

#define VAL_EXPR_IS_COPIED ( x)
Value:
(RTL_FLAG_CHECK1 ("VAL_EXPR_IS_COPIED", (x), CONCAT)->jump)
Whether the location in the CONCAT should be handled like a MO_COPY
as well.   

Referenced by add_stores(), compute_bb_dataflow(), and emit_notes_in_bb().

◆ VAL_HOLDS_TRACK_EXPR

#define VAL_HOLDS_TRACK_EXPR ( x)
Value:
(RTL_FLAG_CHECK1 ("VAL_HOLDS_TRACK_EXPR", (x), CONCAT)->used)
Whether the location in the CONCAT is a tracked expression, that
should also be handled like a MO_USE.   

Referenced by add_stores(), add_uses(), compute_bb_dataflow(), and emit_notes_in_bb().

◆ VAL_NEEDS_RESOLUTION

#define VAL_NEEDS_RESOLUTION ( x)
Value:
(RTL_FLAG_CHECK1 ("VAL_NEEDS_RESOLUTION", (x), CONCAT)->volatil)
Tell whether the CONCAT used to holds a VALUE and its location
needs value resolution, i.e., an attempt of mapping the location
back to other incoming values.   

Referenced by add_stores(), add_uses(), compute_bb_dataflow(), and emit_notes_in_bb().

◆ VALUE_CHANGED

#define VALUE_CHANGED ( x)
Value:
(RTL_FLAG_CHECK1 ("VALUE_CHANGED", (x), VALUE)->frame_related)
Whether cur_loc in the value needs to be (re)computed.   

Referenced by dv_changed_p(), and set_dv_changed().

◆ VALUE_RECURSED_INTO

◆ VAR_LOC_1PAUX

◆ VAR_LOC_DEP_LST

#define VAR_LOC_DEP_LST ( var)
Value:
(VAR_LOC_1PAUX (var) \
? VAR_LOC_1PAUX (var)->backlinks \
: NULL)
#define NULL
Definition system.h:50
#define VAR_LOC_1PAUX(var)
Definition var-tracking.cc:421
These are accessor macros for the one-part auxiliary data.  When
convenient for users, they're guarded by tests that the data was
allocated.   

Referenced by loc_exp_dep_alloc(), loc_exp_insert_dep(), notify_dependents_of_changed_value(), notify_dependents_of_resolved_value(), and variable_htab_free().

◆ VAR_LOC_DEP_LSTP

#define VAR_LOC_DEP_LSTP ( var)
Value:
(VAR_LOC_1PAUX (var) \
? &VAR_LOC_1PAUX (var)->backlinks \
: NULL)

Referenced by loc_exp_dep_alloc(), and loc_exp_insert_dep().

◆ VAR_LOC_DEP_VEC

#define VAR_LOC_DEP_VEC ( var)
Value:
static deps_vec * var_loc_dep_vec(variable *var)
Definition var-tracking.cc:441

Referenced by loc_exp_dep_alloc(), loc_exp_dep_clear(), loc_exp_dep_set(), and loc_exp_insert_dep().

◆ VAR_LOC_DEPTH

#define VAR_LOC_DEPTH ( var)
Value:
(VAR_LOC_1PAUX (var)->depth)

Referenced by loc_exp_dep_alloc(), and vt_expand_var_loc_chain().

◆ VAR_LOC_FROM

◆ VAR_PART_OFFSET

#define VAR_PART_OFFSET ( var,
i )

◆ VTI

Typedef Documentation

◆ bb_heap_t

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

◆ decl_or_value

typedef pointer_mux<tree_node, rtx_def> decl_or_value
A declaration of a variable, or an RTL value being handled like a
declaration by pointer_mux.   

◆ deps_vec

Type for dependencies actively used when expand FROM into cur_loc.   

◆ dvuid

typedef unsigned int dvuid

◆ variable_iterator_type

◆ variable_table_type

Enumeration Type Documentation

◆ emit_note_where

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 

◆ micro_operation_type

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 

◆ onepart_enum

Enumeration type used to discriminate various types of one-part
variables.   
Enumerator
NOT_ONEPART 
ONEPART_VDECL 
ONEPART_DEXPR 
ONEPART_VALUE 

Function Documentation

◆ add_stores()

◆ add_uses()

◆ add_uses_1()

static void add_uses_1 ( rtx * x,
void * cui )
static
Helper function for finding all uses of REG/MEM in X in insn INSN.   

References add_uses(), and FOR_EACH_SUBRTX_VAR.

Referenced by add_with_sets().

◆ add_with_sets()

static void add_with_sets ( rtx_insn * insn,
struct cselib_set * sets,
int n_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).   

References add_stores(), add_uses_1(), count_use_info::bb, BLOCK_FOR_INSN(), call_arguments, CALL_P, cselib_hook_called, dump_file, dump_flags, count_use_info::insn, micro_operation::insn, micro_operation::loc, log_op_type(), MO_CALL, MO_CLOBBER, MO_USE, MO_VAL_LOC, MO_VAL_USE, count_use_info::n_sets, note_stores(), note_uses(), NULL_RTX, PATTERN(), count_use_info::sets, count_use_info::store_p, TDF_DETAILS, micro_operation::type, micro_operation::u, and VTI.

Referenced by vt_initialize().

◆ adjust_insn()

◆ adjust_mem_stores()

static void adjust_mem_stores ( rtx loc,
const_rtx expr,
void * data )
static
Helper function for replacement of stores.   

References adjust_mems(), CONST_CAST_RTX, MEM_P, NULL_RTX, SET_DEST, simplify_replace_fn_rtx(), and validate_change().

Referenced by adjust_insn().

◆ adjust_mem_uses()

static void adjust_mem_uses ( rtx * x,
void * data )
static
Helper function for replacement of uses.   

References adjust_mems(), NULL_RTX, simplify_replace_fn_rtx(), and validate_change().

Referenced by adjust_insn().

◆ adjust_mems()

◆ attrs_list_clear()

static void attrs_list_clear ( attrs ** listp)
static
Make the list *LISTP empty.   

References attrs::next, and NULL.

Referenced by attrs_list_copy(), dataflow_set_clear(), and dataflow_set_destroy().

◆ attrs_list_copy()

static void attrs_list_copy ( attrs ** dstp,
attrs * src )
static
Copy all nodes from SRC and create a list *DSTP of the copies.   

References attrs, attrs_list_clear(), attrs::dv, attrs::loc, attrs::next, and attrs::offset.

Referenced by dataflow_set_copy().

◆ attrs_list_insert()

static void attrs_list_insert ( attrs ** listp,
decl_or_value dv,
HOST_WIDE_INT offset,
rtx loc )
static

◆ attrs_list_member()

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

References attrs::dv, attrs::next, NULL, attrs::offset, and offset.

Referenced by attrs_list_mpdv_union(), and attrs_list_union().

◆ attrs_list_mpdv_union()

static void attrs_list_mpdv_union ( attrs ** dstp,
attrs * src,
attrs * src2 )
static
Combine nodes that are not onepart nodes from SRC and SRC2 into
*DSTP.   

References attrs_list_insert(), attrs_list_member(), attrs::dv, dv_onepart_p(), gcc_assert, attrs::loc, attrs::next, and attrs::offset.

Referenced by dataflow_set_merge().

◆ attrs_list_union()

static void attrs_list_union ( attrs ** dstp,
attrs * src )
static
Add all nodes from SRC which are not in *DSTP to *DSTP.   

References attrs_list_insert(), attrs_list_member(), attrs::dv, attrs::loc, attrs::next, and attrs::offset.

Referenced by dataflow_set_union().

◆ canon_value_cmp()

static bool canon_value_cmp ( rtx tval,
rtx cval )
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.

References CSELIB_VAL_PTR.

Referenced by canonicalize_values_mark(), canonicalize_values_star(), canonicalize_vars_star(), dataflow_set_equiv_regs(), find_loc_in_1pdv(), get_addr_from_local_cache(), loc_cmp(), set_slot_part(), and val_reset().

◆ canonicalize_loc_order_check()

◆ canonicalize_values_mark()

int canonicalize_values_mark ( variable ** slot,
dataflow_set * set )
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.   

References canon_value_cmp(), variable::dv, dv_as_value(), dv_from_value(), dv_is_value_p(), gcc_checking_assert, GET_CODE, location_chain::init, location_chain::loc, variable_part::loc_chain, variable::n_var_parts, location_chain::next, NULL_RTX, set_slot_part(), shared_hash_find_slot_noinsert(), VALUE_RECURSED_INTO, and variable::var_part.

Referenced by compute_bb_dataflow().

◆ canonicalize_values_star()

◆ canonicalize_vars_star()

int canonicalize_vars_star ( variable ** slot,
dataflow_set * set )
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.   

References canon_value_cmp(), clobber_slot_part(), variable::dv, dv_from_value(), gcc_assert, GET_CODE, location_chain::init, location_chain::loc, variable_part::loc_chain, variable::n_var_parts, location_chain::next, variable::onepart, ONEPART_VALUE, set_slot_part(), location_chain::set_src, shared_hash_find_slot_noinsert(), and variable::var_part.

Referenced by dataflow_post_merge_adjust().

◆ clobber_overlapping_mems()

◆ clobber_slot_part()

static variable ** clobber_slot_part ( dataflow_set * set,
rtx loc,
variable ** 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.   

References delete_slot_part(), attrs::dv, variable::dv, find_variable_location_part(), location_chain::loc, variable_part::loc_chain, MEM_P, attrs::next, location_chain::next, NULL, attrs::offset, offset, REG_P, REGNO, rtx_equal_p(), location_chain::set_src, and variable::var_part.

Referenced by canonicalize_values_star(), canonicalize_vars_star(), and clobber_variable_part().

◆ clobber_variable_part()

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.   

References clobber_slot_part(), DECL_P, dv_as_decl(), dv_is_value_p(), offset, and shared_hash_find_slot_noinsert().

Referenced by canonicalize_values_star(), compute_bb_dataflow(), emit_notes_in_bb(), val_reset(), var_mem_delete(), var_mem_delete_and_set(), var_reg_delete(), and var_reg_delete_and_set().

◆ compute_bb_dataflow()

static bool compute_bb_dataflow ( basic_block bb)
static

◆ compute_cfa_pointer()

static rtx compute_cfa_pointer ( poly_int64 adjustment)
inlinestatic
Compute a CFA-based value for an ADJUSTMENT made to stack_pointer_rtx
or hard_frame_pointer_rtx.   

References cfa_base_offset, cfa_base_rtx, and plus_constant().

Referenced by adjust_mems().

◆ dataflow_post_merge_adjust()

static void dataflow_post_merge_adjust ( dataflow_set * set,
dataflow_set ** permp )
static

◆ dataflow_set_clear()

static void dataflow_set_clear ( dataflow_set * set)
static
Delete the contents of dataflow set SET.   

References attrs_list_clear(), empty_shared_hash, i, shared_hash_copy(), and shared_hash_destroy().

Referenced by emit_notes_in_bb(), vt_emit_notes(), and vt_find_locations().

◆ dataflow_set_clear_at_call()

static void dataflow_set_clear_at_call ( dataflow_set * set,
rtx_insn * call_insn )
static

◆ dataflow_set_copy()

static void dataflow_set_copy ( dataflow_set * dst,
dataflow_set * src )
static

◆ dataflow_set_destroy()

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

References attrs_list_clear(), i, NULL, and shared_hash_destroy().

Referenced by compute_bb_dataflow(), dataflow_set_merge(), vt_emit_notes(), and vt_finalize().

◆ dataflow_set_different()

◆ dataflow_set_equiv_regs()

◆ dataflow_set_init()

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

References empty_shared_hash, init_attrs_list_set(), NULL, and shared_hash_copy().

Referenced by compute_bb_dataflow(), dataflow_set_merge(), variable_post_merge_new_vals(), vt_emit_notes(), and vt_initialize().

◆ dataflow_set_merge()

◆ dataflow_set_preserve_mem_locs()

int dataflow_set_preserve_mem_locs ( variable ** slot,
dataflow_set * set )

◆ dataflow_set_remove_mem_locs()

◆ dataflow_set_union()

static void dataflow_set_union ( dataflow_set * dst,
dataflow_set * src )
static

◆ debug_dv()

◆ delete_slot_part()

static variable ** delete_slot_part ( dataflow_set * set,
rtx loc,
variable ** slot,
HOST_WIDE_INT offset )
static

◆ delete_variable_part()

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.   

References delete_slot_part(), offset, and shared_hash_find_slot_noinsert().

Referenced by val_reset(), var_mem_delete(), var_reg_delete(), var_reg_delete_and_set(), and var_regno_delete().

◆ delete_vta_debug_insn()

static void delete_vta_debug_insn ( rtx_insn * insn)
inlinestatic

◆ delete_vta_debug_insns()

void delete_vta_debug_insns ( bool use_cfg)
Remove from the insn stream all debug insns used for variable
tracking at assignments.  USE_CFG should be false if the cfg is no
longer usable.   

References cfun, DEBUG_INSN_P, delete_vta_debug_insn(), FOR_BB_INSNS_SAFE, FOR_EACH_BB_FN, get_insns(), MAY_HAVE_DEBUG_INSNS, and NEXT_INSN().

Referenced by rest_of_handle_final(), variable_tracking_main_1(), and vt_debug_insns_local().

◆ drop_overlapping_mem_locs()

int drop_overlapping_mem_locs ( variable ** slot,
overlapping_mems * coms )
Remove all MEMs that overlap with COMS->LOC from the location list
of a hash table entry for a onepart variable.  COMS->ADDR must be a
canonicalized form of COMS->LOC's address, and COMS->LOC must be
canonicalized itself.   

References overlapping_mems::addr, changed, variable_part::cur_loc, gcc_assert, location_chain::loc, overlapping_mems::loc, variable_part::loc_chain, variable::n_var_parts, location_chain::next, NOT_ONEPART, NULL, variable::onepart, overlapping_mems::set, shared_var_p(), unshare_variable(), VAR_INIT_STATUS_UNKNOWN, VAR_LOC_1PAUX, VAR_LOC_FROM, variable::var_part, variable_was_changed(), and vt_canon_true_dep().

Referenced by clobber_overlapping_mems().

◆ dump_attrs_list()

static void dump_attrs_list ( attrs * list)
static

◆ dump_dataflow_set()

static void dump_dataflow_set ( dataflow_set * set)
static
Print the dataflow set SET to dump file.   

References dump_attrs_list(), dump_file, dump_vars(), HOST_WIDE_INT_PRINT_DEC, i, and shared_hash_htab().

Referenced by dump_dataflow_sets(), and vt_find_locations().

◆ dump_dataflow_sets()

static void dump_dataflow_sets ( void )
static
Print the IN and OUT sets for each basic block to dump file.   

References count_use_info::bb, cfun, dump_dataflow_set(), dump_file, FOR_EACH_BB_FN, basic_block_def::index, and VTI.

Referenced by variable_tracking_main_1().

◆ dump_onepart_variable_differences()

static void dump_onepart_variable_differences ( variable * var1,
variable * var2 )
static
Return true if one-part variables VAR1 and VAR2 are different.
They must be in canonical order.   

References dump_file, variable::dv, gcc_assert, gcc_unreachable, location_chain::loc, variable_part::loc_chain, loc_cmp(), variable::n_var_parts, location_chain::next, print_rtl_single(), and variable::var_part.

Referenced by dataflow_set_different().

◆ dump_var()

◆ dump_var_tracking_slot()

int dump_var_tracking_slot ( variable ** slot,
void * data )
Print the information about variable *SLOT to dump file.   

References dump_var().

Referenced by dump_vars().

◆ dump_vars()

static void dump_vars ( variable_table_type * vars)
static
Print the information about variables from hash table VARS to dump file.   

References dump_file, dump_var_tracking_slot(), hash_table< Descriptor, Lazy, Allocator >::is_empty(), NULL, and hash_table< Descriptor, Lazy, Allocator >::traverse().

Referenced by dump_dataflow_set().

◆ dv_as_decl()

◆ dv_as_rtx()

static rtx dv_as_rtx ( decl_or_value dv)
inlinestatic
Return the DEBUG_EXPR of a DEBUG_EXPR_DECL or the VALUE in DV.   

References DECL_RTL_KNOWN_SET, dv_as_decl(), dv_as_value(), dv_is_value_p(), gcc_checking_assert, and TREE_CODE.

Referenced by notify_dependents_of_changed_value().

◆ dv_as_value()

◆ dv_changed_p()

◆ dv_from_decl()

◆ dv_from_rtx()

◆ dv_from_value()

◆ dv_htab_hash()

◆ dv_is_decl_p()

static bool dv_is_decl_p ( decl_or_value dv)
inlinestatic

◆ dv_is_value_p()

◆ dv_onepart_p()

static onepart_enum dv_onepart_p ( decl_or_value dv)
inlinestatic

◆ dv_uid()

static dvuid dv_uid ( decl_or_value dv)
inlinestatic
Return the uid of DV.   

References CSELIB_VAL_PTR, DECL_UID, dv_as_decl(), dv_as_value(), and dv_is_value_p().

Referenced by dv_htab_hash().

◆ dv_uid2hash()

static hashval_t dv_uid2hash ( dvuid uid)
inlinestatic
Compute the hash from the uid.   

Referenced by dv_htab_hash().

◆ emit_note_insn_var_location()

◆ emit_notes_for_changes()

static void emit_notes_for_changes ( rtx_insn * 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 changed_variables, emit_note_insn_var_location(), hash_table< Descriptor, Lazy, Allocator >::is_empty(), MAY_HAVE_DEBUG_BIND_INSNS, process_changed_values(), shared_hash_htab(), hash_table< Descriptor, Lazy, Allocator >::traverse(), and expand_loc_callback_data::vars.

Referenced by emit_notes_for_differences(), and emit_notes_in_bb().

◆ emit_notes_for_differences()

static void emit_notes_for_differences ( rtx_insn * insn,
dataflow_set * old_set,
dataflow_set * new_set )
static

◆ emit_notes_for_differences_1()

◆ emit_notes_for_differences_2()

int emit_notes_for_differences_2 ( variable ** slot,
variable_table_type * old_vars )

◆ emit_notes_in_bb()

◆ find_loc_in_1pdv()

static location_chain * find_loc_in_1pdv ( rtx loc,
variable * var,
variable_table_type * vars )
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.   

References canon_value_cmp(), variable::dv, dv_as_value(), dv_from_value(), dv_htab_hash(), dv_is_value_p(), find_loc_in_1pdv(), hash_table< Descriptor, Lazy, Allocator >::find_with_hash(), gcc_checking_assert, GET_CODE, location_chain::loc, variable_part::loc_chain, variable::n_var_parts, location_chain::next, NULL, variable::onepart, rtx_equal_p(), and variable::var_part.

Referenced by find_loc_in_1pdv(), intersect_loc_chains(), and variable_post_merge_perm_vals().

◆ find_mem_expr_in_1pdv()

static location_chain * find_mem_expr_in_1pdv ( tree expr,
rtx val,
variable_table_type * vars )
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.   

References dv_from_value(), dv_htab_hash(), find_mem_expr_in_1pdv(), hash_table< Descriptor, Lazy, Allocator >::find_with_hash(), gcc_assert, GET_CODE, int_mem_offset(), location_chain::loc, variable_part::loc_chain, MEM_EXPR, MEM_P, variable::n_var_parts, location_chain::next, NULL, variable::onepart, VALUE_RECURSED_INTO, and variable::var_part.

Referenced by dataflow_set_preserve_mem_locs(), and find_mem_expr_in_1pdv().

◆ find_src_set_src()

static rtx find_src_set_src ( dataflow_set * set,
rtx 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 dv_from_decl(), i, location_chain::loc, variable_part::loc_chain, MEM_EXPR, MEM_P, variable::n_var_parts, location_chain::next, NULL_RTX, NULL_TREE, REG_EXPR, REG_P, rtx_equal_p(), location_chain::set_src, shared_hash_find(), var_debug_decl(), and variable::var_part.

Referenced by compute_bb_dataflow(), and emit_notes_in_bb().

◆ find_src_status()

◆ find_use_val()

static cselib_val * find_use_val ( rtx x,
machine_mode mode,
struct count_use_info * cui )
inlinestatic

◆ find_variable_location_part()

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.   

References variable::n_var_parts, offset, variable::onepart, and VAR_PART_OFFSET.

Referenced by clobber_slot_part(), delete_slot_part(), and set_slot_part().

◆ get_addr_from_global_cache()

static rtx get_addr_from_global_cache ( rtx const loc)
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.   

References canon_rtx(), gcc_checking_assert, get_addr(), GET_CODE, global_get_addr_cache, NULL, and vt_canonicalize_addr().

Referenced by get_addr_from_local_cache(), and vt_canonicalize_addr().

◆ get_addr_from_local_cache()

static rtx get_addr_from_local_cache ( dataflow_set * set,
rtx const loc )
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.   

References canon_value_cmp(), dv_from_rtx(), gcc_checking_assert, get_addr_from_global_cache(), GET_CODE, location_chain::loc, variable_part::loc_chain, local_get_addr_cache, location_chain::next, shared_hash_find(), variable::var_part, vt_canonicalize_addr(), and vt_get_canonicalize_base().

Referenced by vt_canonicalize_addr().

◆ get_init_value()

◆ get_tracked_reg_offset()

static HOST_WIDE_INT get_tracked_reg_offset ( rtx loc)
static
Return the offset of a register that track_offset_p says we
should track.   

References gcc_unreachable, offset, REG_OFFSET, and track_offset_p().

Referenced by var_reg_delete_and_set(), var_reg_set(), and vt_add_function_parameter().

◆ init_attrs_list_set()

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

References i, and NULL.

Referenced by dataflow_set_init().

◆ insert_into_intersection()

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.   

References location_chain::init, location_chain::loc, loc_cmp(), MIN, location_chain::next, NULL, r, and location_chain::set_src.

Referenced by intersect_loc_chains().

◆ insn_stack_adjust_offset_pre_post()

static void insn_stack_adjust_offset_pre_post ( rtx_insn * 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.   

References find_reg_note(), GET_CODE, i, NULL_RTX, PATTERN(), RTX_FRAME_RELATED_P, SET, stack_adjust_offset_pre_post(), XEXP, XVECEXP, and XVECLEN.

Referenced by vt_initialize(), and vt_stack_adjustments().

◆ int_mem_offset()

static HOST_WIDE_INT int_mem_offset ( const_rtx mem)
inlinestatic

◆ intersect_loc_chains()

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.   

References dfset_merge::cur, dv_from_value(), find_loc_in_1pdv(), gcc_checking_assert, GET_CODE, location_chain::init, insert_into_intersection(), intersect_loc_chains(), location_chain::loc, variable_part::loc_chain, MIN, variable::n_var_parts, location_chain::next, variable::onepart, shared_hash_find(), shared_hash_htab(), dfset_merge::src, VALUE_RECURSED_INTO, variable::var_part, and dataflow_set::vars.

Referenced by intersect_loc_chains(), and variable_merge_over_cur().

◆ loc_cmp()

static int loc_cmp ( rtx x,
rtx y )
static

◆ loc_exp_dep_alloc()

static void loc_exp_dep_alloc ( variable * var,
int count )
static
Allocate the one-part auxiliary data structure for VAR, with enough
room for COUNT dependencies.   

References count, deps, gcc_checking_assert, is_empty(), NULL, offsetof, variable::onepart, VAR_LOC_1PAUX, VAR_LOC_DEP_LST, VAR_LOC_DEP_LSTP, VAR_LOC_DEP_VEC, VAR_LOC_DEPTH, and VAR_LOC_FROM.

Referenced by loc_exp_dep_set(), and loc_exp_insert_dep().

◆ loc_exp_dep_clear()

static void loc_exp_dep_clear ( variable * var)
static
Remove all entries from the vector of active dependencies of VAR,
removing them from the back-links lists too.   

References is_empty(), loc_exp_dep::next, loc_exp_dep::pprev, and VAR_LOC_DEP_VEC.

Referenced by variable_htab_free(), and vt_expand_var_loc_chain().

◆ loc_exp_dep_set()

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.   

References count, gcc_checking_assert, is_empty(), loc_exp_dep_alloc(), loc_exp_insert_dep(), NULL, VALUE_RECURSED_INTO, and VAR_LOC_DEP_VEC.

Referenced by vt_expand_var_loc_chain().

◆ loc_exp_insert_dep()

static void loc_exp_insert_dep ( variable * var,
rtx x,
variable_table_type * vars )
static

◆ local_get_addr_clear_given_value()

bool local_get_addr_clear_given_value ( rtx const & ,
rtx * slot,
rtx x )
Clear (canonical address) slots that reference X.   

References NULL, and vt_get_canonicalize_base().

Referenced by val_reset().

◆ log_op_type()

static void log_op_type ( rtx x,
basic_block bb,
rtx_insn * insn,
enum micro_operation_type mopt,
FILE * out )
inlinestatic
Log to OUT information about micro-operation MOPT involving X in
INSN of BB.   

References fputc(), basic_block_def::index, INSN_UID(), micro_operation_type_name, print_inline_rtx(), and VTI.

Referenced by add_stores(), add_uses(), add_with_sets(), and vt_initialize().

◆ make_pass_variable_tracking()

rtl_opt_pass * make_pass_variable_tracking ( gcc::context * ctxt)

◆ mem_dies_at_call()

static bool mem_dies_at_call ( rtx mem)
static
Return TRUE if the value of MEM may vary across a call.   

References DECL_P, get_base_address(), is_global_var(), may_be_aliased(), MEM_EXPR, and TREE_READONLY.

Referenced by dataflow_set_preserve_mem_locs(), and dataflow_set_remove_mem_locs().

◆ negative_power_of_two_p()

static bool negative_power_of_two_p ( HOST_WIDE_INT i)
static
Return true if I is the negated value of a power of two.   

References i, and pow2_or_zerop().

Referenced by vt_canonicalize_addr(), and vt_get_canonicalize_base().

◆ next_non_note_insn_var_location()

static rtx_insn * next_non_note_insn_var_location ( rtx_insn * insn)
static
Return the next insn after INSN that is not a NOTE_INSN_VAR_LOCATION.   

References NEXT_INSN(), NOTE_KIND, and NOTE_P.

Referenced by emit_notes_in_bb().

◆ non_suitable_const()

static bool non_suitable_const ( const_rtx x)
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.   

References ALL, FOR_EACH_SUBRTX, GET_CODE, and MEM_READONLY_P.

Referenced by add_uses().

◆ notify_dependents_of_changed_value()

static void notify_dependents_of_changed_value ( rtx val,
variable_table_type * htab,
vec< rtx, va_heap > * changed_values_stack )
static

◆ notify_dependents_of_resolved_value()

static void notify_dependents_of_resolved_value ( variable * ivar,
variable_table_type * vars )
static

◆ onepart_pool()

static pool_allocator & onepart_pool ( onepart_enum onepart)
inlinestatic
Return the variable pool to be used for a dv of type ONEPART.   

References valvar_pool, and var_pool.

Referenced by onepart_pool_allocate(), and variable_htab_free().

◆ onepart_pool_allocate()

static variable * onepart_pool_allocate ( onepart_enum onepart)
inlinestatic

◆ onepart_variable_different_p()

static bool onepart_variable_different_p ( variable * var1,
variable * var2 )
static
Return true if one-part variables VAR1 and VAR2 are different.
They must be in canonical order.   

References gcc_assert, location_chain::loc, variable_part::loc_chain, loc_cmp(), variable::n_var_parts, location_chain::next, and variable::var_part.

Referenced by variable_different_p(), and variable_merge_over_cur().

◆ prepare_call_arguments()

◆ preserve_value()

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

References cselib_preserve_value(), preserved_values, and cselib_val::val_rtx.

Referenced by add_stores(), add_uses(), vt_add_function_parameter(), vt_init_cfa_base(), and vt_initialize().

◆ process_changed_values()

static void process_changed_values ( variable_table_type * htab)
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.   

References changed_variables, i, notify_dependents_of_changed_value(), remove_value_from_changed_variables(), hash_table< Descriptor, Lazy, Allocator >::traverse(), and var_track_values_to_stack().

Referenced by emit_notes_for_changes().

◆ record_entry_value()

static void record_entry_value ( cselib_val * val,
rtx rtl )
static
Record the value for the ENTRY_VALUE of RTL as a global equivalence
of VAL.   

References cselib_add_permanent_equiv(), ENTRY_VALUE_EXP, get_insns(), and GET_MODE.

Referenced by vt_add_function_parameter().

◆ recover_dropped_1paux()

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

References variable::dv, gcc_checking_assert, NULL, variable::onepart, ONEPART_VDECL, VAR_LOC_1PAUX, and variable_from_dropped().

Referenced by variable_was_changed().

◆ reemit_marker_as_note()

static rtx_insn * reemit_marker_as_note ( rtx_insn * insn)
static

◆ remove_duplicate_values()

static void remove_duplicate_values ( variable * var)
static
Remove any redundant values in the location list of VAR, which must
be unshared and 1-part.   

References gcc_assert, GET_CODE, location_chain::loc, variable_part::loc_chain, variable::n_var_parts, location_chain::next, variable::onepart, variable::refcount, VALUE_RECURSED_INTO, and variable::var_part.

Referenced by variable_post_merge_new_vals().

◆ remove_value_from_changed_variables()

static void remove_value_from_changed_variables ( rtx val)
static

◆ replace_expr_with_values()

static rtx replace_expr_with_values ( rtx loc)
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.   

References cselib_lookup(), cselib_subst_to_values(), get_address_mode(), GET_CODE, GET_MODE, MEM_P, NULL, REG_P, replace_equiv_address_nv(), cselib_val::val_rtx, and XEXP.

Referenced by add_stores(), and add_uses().

◆ resolve_expansions_pending_recursion()

static void resolve_expansions_pending_recursion ( vec< rtx, va_heap > * pending)
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.   

References dv_changed_p(), dv_from_rtx(), gcc_checking_assert, NO_LOC_P, expand_loc_callback_data::pending, set_dv_changed(), and VALUE_RECURSED_INTO.

◆ reverse_op()

static void reverse_op ( rtx val,
const_rtx expr,
rtx_insn * insn )
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.   

References canonical_cselib_val(), cfa_base_rtx, CONST_INT_P, CONSTANT_P, count, cselib_add_permanent_equiv(), cselib_expand_value_rtx(), cselib_lookup(), cselib_preserved_value_p(), gcc_unreachable, gen_lowpart_SUBREG(), GET_CODE, GET_MODE, elt_loc_list::loc, cselib_val::locs, MEM_P, elt_loc_list::next, NULL_RTX, references_value_p(), REG_P, SCALAR_INT_MODE_P, scratch_regs, SET, SET_DEST, SET_SRC, simplify_gen_binary(), cselib_set::src, cselib_val::val_rtx, and XEXP.

Referenced by add_stores().

◆ rtx_debug_expr_p()

static bool rtx_debug_expr_p ( const_rtx x)
static
Return true if X contains a DEBUG_EXPR.   

References ALL, FOR_EACH_SUBRTX, and GET_CODE.

Referenced by use_type().

◆ same_variable_part_p()

static bool same_variable_part_p ( rtx loc,
tree expr,
poly_int64 offset )
static
Determine whether a given LOC refers to the same variable part as
EXPR+OFFSET.   

References DECL_P, int_mem_offset(), known_eq, MEM_EXPR, MEM_P, offset, REG_EXPR, REG_OFFSET, REG_P, and var_debug_decl().

Referenced by add_stores().

◆ set_dv_changed()

static void set_dv_changed ( decl_or_value dv,
bool newv )
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.   

References DECL_CHANGED, DECL_RTL_KNOWN_SET, dv_as_decl(), dv_as_value(), dv_onepart_p(), NO_LOC_P, ONEPART_DEXPR, ONEPART_VALUE, and VALUE_CHANGED.

Referenced by emit_note_insn_var_location(), notify_dependents_of_changed_value(), resolve_expansions_pending_recursion(), variable_from_dropped(), variable_htab_free(), variable_was_changed(), and vt_expand_loc_callback().

◆ set_slot_part()

◆ set_variable_part()

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.   

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

Referenced by canonicalize_values_star(), compute_bb_dataflow(), dataflow_set_equiv_regs(), emit_notes_in_bb(), val_bind(), val_reset(), val_resolve(), var_mem_decl_set(), var_reg_decl_set(), variable_merge_over_cur(), variable_post_merge_perm_vals(), and vt_add_function_parameter().

◆ shared_hash_copy()

static shared_hash * shared_hash_copy ( shared_hash * vars)
inlinestatic
Increment reference counter on VARS and return it.   

References shared_hash::refcount.

Referenced by dataflow_set_clear(), dataflow_set_copy(), dataflow_set_init(), dataflow_set_union(), and vt_find_locations().

◆ shared_hash_destroy()

static void shared_hash_destroy ( shared_hash * vars)
static
Decrement reference counter and destroy hash table if not shared
anymore.   

References gcc_checking_assert, shared_hash::htab, and shared_hash::refcount.

Referenced by dataflow_set_clear(), dataflow_set_copy(), dataflow_set_destroy(), dataflow_set_merge(), dataflow_set_union(), and vt_find_locations().

◆ shared_hash_find()

◆ shared_hash_find_1()

static variable * shared_hash_find_1 ( shared_hash * vars,
decl_or_value dv,
hashval_t dvhash )
inlinestatic
Return variable for DV or NULL if not already present in the hash
table.   

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

Referenced by shared_hash_find(), and variable_merge_over_cur().

◆ shared_hash_find_slot()

static variable ** shared_hash_find_slot ( shared_hash * vars,
decl_or_value dv )
inlinestatic

◆ shared_hash_find_slot_1()

static variable ** shared_hash_find_slot_1 ( shared_hash * vars,
decl_or_value dv,
hashval_t dvhash )
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.   

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

Referenced by shared_hash_find_slot().

◆ shared_hash_find_slot_noinsert()

◆ shared_hash_find_slot_noinsert_1()

static variable ** 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.   

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

Referenced by shared_hash_find_slot_noinsert(), and variable_merge_over_cur().

◆ shared_hash_find_slot_unshare()

static variable ** shared_hash_find_slot_unshare ( shared_hash ** pvars,
decl_or_value dv,
enum insert_option ins )
inlinestatic

◆ shared_hash_find_slot_unshare_1()

static variable ** 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.   

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

Referenced by shared_hash_find_slot_unshare(), and variable_merge_over_cur().

◆ shared_hash_htab()

◆ shared_hash_shared()

static bool shared_hash_shared ( shared_hash * vars)
inlinestatic

◆ shared_hash_unshare()

static shared_hash * shared_hash_unshare ( shared_hash * vars)
static

◆ shared_var_p()

static bool shared_var_p ( variable * var,
shared_hash * vars )
inlinestatic

◆ stack_adjust_offset_pre_post()

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.   

References CONST_INT_P, for_each_inc_dec(), GET_CODE, INTVAL, SET_DEST, SET_SRC, stack_adjust_offset_pre_post_cb(), stack_pointer_rtx, and XEXP.

Referenced by insn_stack_adjust_offset_pre_post().

◆ stack_adjust_offset_pre_post_cb()

static int stack_adjust_offset_pre_post_cb ( rtx ,
rtx op,
rtx dest,
rtx src,
rtx srcoff,
void * arg )
static
Callback for stack_adjust_offset_pre_post, called via for_each_inc_dec.   

References CONST_INT_P, gcc_assert, gcc_unreachable, GET_CODE, INTVAL, stack_pointer_rtx, and XEXP.

Referenced by stack_adjust_offset_pre_post().

◆ track_expr_p()

◆ track_loc_p()

static bool track_loc_p ( rtx loc,
tree expr,
poly_int64 offset,
bool store_reg_p,
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).   

References byte_lowpart_offset(), COMPLEX_MODE_P, DECL_MODE, GET_MODE, HARD_REGISTER_NUM_P, hard_regno_nregs(), known_eq, NULL, offset, ORIGINAL_REGNO, paradoxical_subreg_p(), PSEUDO_REGNO_MODE, REG_P, REGNO, track_expr_p(), and track_offset_p().

Referenced by use_type(), and vt_add_function_parameter().

◆ track_offset_p()

static bool track_offset_p ( poly_int64 offset,
HOST_WIDE_INT * offset_out )
static
Return true if we should track a location that is OFFSET bytes from
a variable.  Store the constant offset in *OFFSET_OUT if so.   

References IN_RANGE, MAX_VAR_PARTS, and offset.

Referenced by get_tracked_reg_offset(), track_loc_p(), var_reg_delete(), and vt_get_decl_and_offset().

◆ tracked_record_parameter_p()

static bool tracked_record_parameter_p ( tree t)
static
Return true if T is a tracked parameter with non-degenerate record type.   

References DECL_CHAIN, DECL_MODE, NULL_TREE, TREE_CODE, TREE_TYPE, and TYPE_FIELDS.

Referenced by add_stores(), and track_expr_p().

◆ unshare_variable()

◆ unsuitable_loc()

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

References GET_CODE, and overlapping_mems::loc.

Referenced by add_stores(), add_uses(), val_resolve(), val_store(), and vt_expand_var_loc_chain().

◆ update_depth()

static expand_depth update_depth ( expand_depth saved_depth,
expand_depth best_depth )
inlinestatic
Return the combined depth, when one sub-expression evaluated to
BEST_DEPTH and the previous known depth was SAVED_DEPTH.   

References expand_depth::complexity, and expand_depth::entryvals.

Referenced by vt_expand_loc_callback(), and vt_expand_var_loc_chain().

◆ use_narrower_mode()

static rtx use_narrower_mode ( rtx x,
scalar_int_mode mode,
scalar_int_mode wmode )
static
Transform X into narrower mode MODE from wider mode WMODE.   

References as_a(), CONSTANT_P, gcc_unreachable, GET_CODE, GET_MODE, GET_MODE_PRECISION(), lowpart_subreg(), simplify_gen_binary(), use_narrower_mode(), and XEXP.

Referenced by adjust_mems(), and use_narrower_mode().

◆ use_narrower_mode_test()

static bool use_narrower_mode_test ( rtx x,
const_rtx subreg )
static
Helper for adjust_mems.  Return true if X is suitable for
transformation of wider mode arithmetics to narrower mode.   

References as_a(), CONSTANT_P, cselib_lookup(), FOR_EACH_SUBRTX_VAR, GET_CODE, GET_MODE, GET_MODE_PRECISION(), simplify_subreg(), subreg_lowpart_offset(), SUBREG_REG, validate_subreg(), and XEXP.

Referenced by adjust_mems().

◆ use_type()

◆ val_bind()

◆ val_reset()

◆ val_resolve()

static void val_resolve ( dataflow_set * set,
rtx val,
rtx loc,
rtx_insn * insn )
static

◆ val_store()

static void val_store ( dataflow_set * set,
rtx val,
rtx loc,
rtx_insn * insn,
bool modified )
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.   

References cselib_preserved_value_p(), CSELIB_VAL_PTR, dump_file, gcc_assert, gcc_checking_assert, INSN_UID(), elt_loc_list::loc, cselib_val::locs, elt_loc_list::next, print_inline_rtx(), elt_loc_list::setting_insn, unsuitable_loc(), and val_bind().

Referenced by compute_bb_dataflow(), and emit_notes_in_bb().

◆ var_debug_decl()

◆ var_loc_dep_vec()

static deps_vec * var_loc_dep_vec ( variable * var)
inlinestatic
Implements the VAR_LOC_DEP_VEC above as a function to work around
a bogus -Wnonnull (PR c/95554).  

References NULL, and VAR_LOC_1PAUX.

◆ var_lowpart()

static rtx var_lowpart ( machine_mode mode,
rtx loc )
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.   

References adjust_address_nv, byte_lowpart_offset(), gen_rtx_REG_offset(), GET_MODE, MEM_P, NULL, offset, reg_offset, REG_P, REGNO, subreg_lowpart_offset(), and subreg_regno_offset().

Referenced by add_stores(), add_uses(), and vt_add_function_parameter().

◆ var_mem_decl_set()

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_decl(), dv_from_decl(), dv_is_decl_p(), initialized, overlapping_mems::loc, offset, set_variable_part(), and var_debug_decl().

Referenced by val_bind(), val_reset(), and var_mem_set().

◆ var_mem_delete()

static void var_mem_delete ( dataflow_set * set,
rtx loc,
bool clobber )
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.   

References clobber_overlapping_mems(), clobber_variable_part(), delete_variable_part(), dv_from_decl(), int_mem_offset(), overlapping_mems::loc, MEM_EXPR, NULL, offset, and var_debug_decl().

Referenced by compute_bb_dataflow(), and emit_notes_in_bb().

◆ var_mem_delete_and_set()

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.   

References clobber_overlapping_mems(), clobber_variable_part(), dv_from_decl(), get_init_value(), initialized, int_mem_offset(), overlapping_mems::loc, MEM_EXPR, modify, NULL, offset, var_debug_decl(), VAR_INIT_STATUS_UNKNOWN, and var_mem_set().

Referenced by compute_bb_dataflow(), and emit_notes_in_bb().

◆ var_mem_set()

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.   

References dv_from_decl(), initialized, int_mem_offset(), overlapping_mems::loc, MEM_EXPR, offset, and var_mem_decl_set().

Referenced by compute_bb_dataflow(), emit_notes_in_bb(), and var_mem_delete_and_set().

◆ var_reg_decl_set()

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

◆ var_reg_delete()

static void var_reg_delete ( dataflow_set * set,
rtx loc,
bool clobber )
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.   

References clobber_variable_part(), delete_variable_part(), attrs::dv, dv_from_decl(), dv_onepart_p(), attrs::loc, attrs::next, NULL, attrs::offset, offset, REG_EXPR, REG_OFFSET, REGNO, track_offset_p(), and var_debug_decl().

Referenced by compute_bb_dataflow(), and emit_notes_in_bb().

◆ var_reg_delete_and_set()

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.   

References clobber_variable_part(), delete_variable_part(), attrs::dv, dv_from_decl(), get_init_value(), get_tracked_reg_offset(), initialized, attrs::loc, modify, attrs::next, attrs::offset, offset, REG_EXPR, REGNO, var_debug_decl(), VAR_INIT_STATUS_UNKNOWN, and var_reg_set().

Referenced by compute_bb_dataflow(), and emit_notes_in_bb().

◆ var_reg_set()

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

References dv_from_decl(), get_tracked_reg_offset(), initialized, offset, REG_EXPR, and var_reg_decl_set().

Referenced by compute_bb_dataflow(), emit_notes_in_bb(), and var_reg_delete_and_set().

◆ var_regno_delete()

static void var_regno_delete ( dataflow_set * set,
int regno )
static
Delete content of register with number REGNO in dataflow set SET.   

References delete_variable_part(), attrs::dv, attrs::loc, attrs::next, NULL, and attrs::offset.

Referenced by compute_bb_dataflow(), dataflow_set_clear_at_call(), emit_notes_in_bb(), and val_bind().

◆ var_track_values_to_stack()

int var_track_values_to_stack ( variable ** 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.   

References DECL_RTL_KNOWN_SET, variable::dv, dv_as_decl(), dv_as_value(), variable::onepart, ONEPART_DEXPR, and ONEPART_VALUE.

Referenced by process_changed_values().

◆ variable_different_p()

static bool variable_different_p ( variable * var1,
variable * var2 )
static

◆ variable_from_dropped()

◆ variable_htab_free()

◆ variable_merge_over_cur()

◆ variable_merge_over_src()

static int variable_merge_over_src ( variable * s2var,
struct dfset_merge * dsm )
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().   

References dfset_merge::dst, variable::dv, variable::onepart, variable::refcount, shared_hash_find_slot(), dfset_merge::src_onepart_cnt, and dataflow_set::vars.

Referenced by dataflow_set_merge().

◆ variable_part_different_p()

static bool variable_part_different_p ( variable_part * vp1,
variable_part * vp2 )
static

◆ variable_post_merge_new_vals()

◆ variable_post_merge_perm_vals()

◆ variable_tracking_main()

unsigned int variable_tracking_main ( void )
In var-tracking.cc  

References variable_tracking_main_1().

◆ variable_tracking_main_1()

◆ variable_union()

static int variable_union ( variable * src,
dataflow_set * set )
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.   

References variable_part::cur_loc, dst_can_be_shared, variable::dv, gcc_assert, gcc_checking_assert, i, location_chain::init, variable_union_info::lc, location_chain::loc, variable_part::loc_chain, loc_cmp(), MAX, MAX_VAR_PARTS, MEM_P, variable::n_var_parts, location_chain::next, NULL, variable::onepart, variable_union_info::pos, variable_union_info::pos_dst, qsort, r, variable::refcount, REG_P, REGNO, rtx_equal_p(), location_chain::set_src, shared_hash_find_slot(), shared_hash_find_slot_unshare(), shared_var_p(), unshare_variable(), VAR_INIT_STATUS_INITIALIZED, VAR_INIT_STATUS_UNKNOWN, variable::var_part, VAR_PART_OFFSET, variable_union_info_cmp_pos(), vui_allocated, and vui_vec.

Referenced by dataflow_set_union(), variable_merge_over_cur(), and variable_post_merge_perm_vals().

◆ variable_union_info_cmp_pos()

static int variable_union_info_cmp_pos ( const void * n1,
const void * n2 )
static
Compare function for qsort, order the structures by POS element.   

References i1, i2, and variable_union_info::pos.

Referenced by variable_union().

◆ variable_was_changed()

◆ vars_copy()

static void vars_copy ( variable_table_type * dst,
variable_table_type * src )
static

◆ vt_add_function_parameter()

◆ vt_add_function_parameters()

static void vt_add_function_parameters ( void )
static

◆ vt_canon_true_dep()

static bool vt_canon_true_dep ( dataflow_set * set,
rtx mloc,
rtx maddr,
rtx loc )
inlinestatic
Return true iff there's a true dependence between MLOC and LOC.
MADDR must be a canonicalized version of MLOC's address.   

References canon_true_dependence(), GET_CODE, GET_MODE, vt_canonicalize_addr(), and XEXP.

Referenced by drop_overlapping_mem_locs().

◆ vt_canonicalize_addr()

static rtx vt_canonicalize_addr ( dataflow_set * set,
rtx oloc )
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.   

References canon_rtx(), get_addr_from_global_cache(), get_addr_from_local_cache(), GET_CODE, GET_MODE, INTVAL, known_eq, negative_power_of_two_p(), plus_constant(), poly_int_rtx_p(), strip_offset(), vt_canonicalize_addr(), and XEXP.

Referenced by clobber_overlapping_mems(), get_addr_from_global_cache(), get_addr_from_local_cache(), vt_canon_true_dep(), and vt_canonicalize_addr().

◆ vt_debug_insns_local()

static void vt_debug_insns_local ( bool skipped)
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..   

References delete_vta_debug_insns().

Referenced by variable_tracking_main_1().

◆ vt_emit_notes()

◆ vt_expand_1pvar()

static rtx vt_expand_1pvar ( variable * var,
variable_table_type * vars )
static
Expand the one-part VARiable to a location, using the equivalences
in VARS, updating their CUR_LOCs in the process.   

References variable_part::cur_loc, variable::dv, dv_changed_p(), FINI_ELCD, gcc_checking_assert, INIT_ELCD, variable::n_var_parts, NULL, variable::onepart, scratch_regs, variable::var_part, expand_loc_callback_data::vars, and vt_expand_var_loc_chain().

Referenced by emit_note_insn_var_location().

◆ vt_expand_loc()

static rtx vt_expand_loc ( rtx loc,
variable_table_type * vars )
static
Expand VALUEs and DEBUG_EXPRs in LOC to a location, using the
equivalences in VARS, updating their CUR_LOCs in the process.   

References cselib_expand_value_rtx_cb(), EXPR_DEPTH, FINI_ELCD, INIT_ELCD, MAY_HAVE_DEBUG_BIND_INSNS, scratch_regs, expand_loc_callback_data::vars, and vt_expand_loc_callback().

Referenced by emit_note_insn_var_location(), and emit_notes_in_bb().

◆ vt_expand_loc_callback()

◆ vt_expand_var_loc_chain()

static rtx vt_expand_var_loc_chain ( variable * var,
bitmap regs,
void * data,
bool * pendrecp )
inlinestatic

◆ vt_finalize()

◆ vt_find_locations()

◆ vt_get_canonicalize_base()

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

References GET_CODE, INTVAL, negative_power_of_two_p(), and XEXP.

Referenced by get_addr_from_local_cache(), and local_get_addr_clear_given_value().

◆ vt_get_decl_and_offset()

static bool vt_get_decl_and_offset ( rtx rtl,
tree * declp,
poly_int64 * offsetp )
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 GET_CODE, i, int_mem_offset(), MAX_VAR_PARTS, MEM_ATTRS, MEM_EXPR, MEM_P, MIN, NULL_TREE, offset, REG_ATTRS, REG_EXPR, REG_OFFSET, REG_P, track_offset_p(), XEXP, XVECEXP, and XVECLEN.

Referenced by vt_add_function_parameter().

◆ vt_init_cfa_base()

static void vt_init_cfa_base ( void )
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.   

References ARG_POINTER_CFA_OFFSET, arg_pointer_rtx, cfa_base_offset, cfa_base_rtx, crtl, cselib_lookup_from_insn(), cselib_preserve_cfa_base_value(), current_function_decl, fixed_regs, frame_pointer_needed, frame_pointer_rtx, get_insns(), GET_MODE, hard_frame_pointer_rtx, MAY_HAVE_DEBUG_BIND_INSNS, NULL_RTX, preserve_value(), REGNO, stack_pointer_rtx, and vt_equate_reg_base_value().

Referenced by vt_initialize().

◆ vt_initialize()

static bool vt_initialize ( void )
static
Allocate and initialize the data structures for variable tracking
and parse the RTL to get the micro operations.   

References add_with_sets(), micro_operation::adjust, adjust_insn(), alloc_aux_for_blocks(), ARG_POINTER_CFA_OFFSET, arg_pointer_rtx, BB_HEAD, BITMAP_ALLOC, CALL_P, cancel_changes(), cfa_base_offset, cfa_base_rtx, cfun, changed_variables, crtl, cselib_add_permanent_equiv(), cselib_get_next_uid(), cselib_hook_called, cselib_init(), cselib_invalidate_rtx(), cselib_lookup(), cselib_lookup_from_insn(), cselib_preserve_cfa_base_value(), CSELIB_PRESERVE_CONSTANTS, cselib_preserve_only_values(), cselib_preserved_value_p(), cselib_process_insn(), CSELIB_RECORD_MEMORY, cselib_record_sets_hook, cselib_record_sp_cfa_base_equiv(), cselib_reset_table(), cselib_set_value_sp_based(), current_function_decl, dataflow_set_init(), DEBUG_MARKER_INSN_P, dump_cselib_table(), dump_file, dump_flags, dump_insn_slim(), eliminate_regs(), empty_shared_hash, ENTRY_BLOCK_PTR_FOR_FN, EXIT_BLOCK_PTR_FOR_FN, expr, find_edge(), fixed_regs, FOR_ALL_BB_FN, FOR_BB_BETWEEN, FOR_BB_INSNS_SAFE, FOR_EACH_BB_FN, fp_setter_insn(), frame_pointer_needed, frame_pointer_rtx, gcc_assert, GET_CODE, get_insns(), GET_MODE, global_get_addr_cache, hard_frame_pointer_adjustment, hard_frame_pointer_rtx, shared_hash::htab, INCOMING_FRAME_SP_OFFSET, micro_operation::insn, INSN_P, insn_stack_adjust_offset_pre_post(), ira_use_lra_p, known_eq, log_op_type(), lra_eliminate_regs(), MAY_HAVE_DEBUG_BIND_INSNS, MO_ADJUST, basic_block_def::next_bb, NULL, NULL_RTX, offset, PATTERN(), plus_constant(), prepare_call_arguments(), preserve_value(), preserved_values, print_rtl_single(), reemit_marker_as_note(), shared_hash::refcount, REGNO, rtx_to_poly_int64(), scratch_regs, shared_hash_pool, single_pred_p(), stack_pointer_rtx, stack_realign_drap, TDF_DETAILS, TDF_SLIM, micro_operation::type, micro_operation::u, vt_add_function_parameters(), vt_init_cfa_base(), vt_stack_adjustments(), VTI, and XEXP.

Referenced by variable_tracking_main_1().

◆ vt_stack_adjustments()

static bool vt_stack_adjustments ( void )
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.   

References BB_END, BB_HEAD, cfun, EDGE_COUNT, ei_edge(), ei_next(), ei_one_before_end_p(), ei_start, ENTRY_BLOCK_PTR_FOR_FN, EXIT_BLOCK_PTR_FOR_FN, free(), INCOMING_FRAME_SP_OFFSET, INSN_P, insn_stack_adjust_offset_pre_post(), n_basic_blocks_for_fn, NEXT_INSN(), offset, basic_block_def::succs, visited, and VTI.

Referenced by vt_initialize().

Variable Documentation

◆ attrs_pool

object_allocator< attrs > attrs_pool("attrs pool") ( "attrs pool" )
Alloc pool for struct attrs_def.   

Referenced by vt_finalize().

◆ call_arguments

rtx call_arguments
static
Arguments to the call.   

Referenced by add_with_sets(), and prepare_call_arguments().

◆ cfa_base_offset

HOST_WIDE_INT cfa_base_offset
static

◆ cfa_base_rtx

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 add_stores(), adjust_mems(), compute_cfa_pointer(), reverse_op(), use_type(), vt_init_cfa_base(), and vt_initialize().

◆ changed_variables

◆ check_value_val

char check_value_val[(int) VALUE==(int) IDENTIFIER_NODE ? 1 :-1]
extern
var-tracking.cc 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.   

◆ cselib_hook_called

bool cselib_hook_called
static
Variable used to tell whether cselib_process_insn called our hook.   

Referenced by add_with_sets(), and vt_initialize().

◆ debug_label_num

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.   

Referenced by delete_vta_debug_insn().

◆ dropped_values

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 notify_dependents_of_changed_value(), variable_from_dropped(), variable_was_changed(), and vt_emit_notes().

◆ dst_can_be_shared

◆ emit_notes

bool emit_notes
static

◆ empty_shared_hash

shared_hash* empty_shared_hash
static

◆ global_get_addr_cache

hash_map<rtx, rtx>* global_get_addr_cache
static
This caches canonicalized addresses for VALUEs, computed using
information in the global cselib table.   

Referenced by get_addr_from_global_cache(), vt_finalize(), and vt_initialize().

◆ hard_frame_pointer_adjustment

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

Referenced by add_stores(), adjust_mems(), and vt_initialize().

◆ loc_exp_dep_pool

object_allocator< loc_exp_dep > loc_exp_dep_pool("loc_exp_dep pool") ( "loc_exp_dep pool" )
Alloc pool for struct loc_exp_dep_s for NOT_ONEPART variables.   

Referenced by vt_finalize().

◆ local_get_addr_cache

hash_map<rtx, rtx>* 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 compute_bb_dataflow(), get_addr_from_local_cache(), val_reset(), and vt_emit_notes().

◆ location_chain_pool

object_allocator< location_chain > location_chain_pool("location_chain pool") ( "location_chain pool" )
static
Alloc pool for struct location_chain.   

Referenced by vt_finalize().

◆ micro_operation_type_name

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"
}

Referenced by log_op_type().

◆ preserved_values

vec<rtx> preserved_values
static
All preserved VALUEs.   

Referenced by preserve_value(), vt_finalize(), and vt_initialize().

◆ scratch_regs

bitmap scratch_regs = NULL
static
Scratch register bitmap used by cselib_expand_value_rtx.   

Referenced by reverse_op(), vt_expand_1pvar(), vt_expand_loc(), vt_finalize(), and vt_initialize().

◆ shared_hash_pool

object_allocator< shared_hash > shared_hash_pool("shared_hash pool") ( "shared_hash pool" )
static
Alloc pool for struct shared_hash.   

Referenced by vt_finalize(), and vt_initialize().

◆ valvar_pool

pool_allocator valvar_pool("small variable_def pool", sizeof(variable)) ( "small variable_def pool" ,
sizeof(variable)  )
static
Alloc pool for struct variable_def with a single var_part entry.   

Referenced by onepart_pool(), and vt_finalize().

◆ var_pool

pool_allocator var_pool("variable_def pool", sizeof(variable)+(MAX_VAR_PARTS - 1) *sizeof(((variable *) NULL) ->var_part[0])) ( "variable_def pool" ,
sizeof(variable)+(MAX_VAR_PARTS - 1) *sizeof(((variable *) NULL) ->var_part[0])  )
static
Alloc pool for struct variable_def with MAX_VAR_PARTS entries.   

Referenced by onepart_pool(), and vt_finalize().

◆ vui_allocated

int vui_allocated
static

Referenced by variable_union(), and vt_finalize().

◆ vui_vec

struct variable_union_info* vui_vec
static
Buffer for location list sorting and its allocated size.   

Referenced by variable_union(), and vt_finalize().