GCC Middle and Back End API Reference
tree-dfa.cc File Reference
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "backend.h"
#include "rtl.h"
#include "tree.h"
#include "gimple.h"
#include "tree-pass.h"
#include "ssa.h"
#include "tree-pretty-print.h"
#include "fold-const.h"
#include "stor-layout.h"
#include "langhooks.h"
#include "gimple-iterator.h"
#include "gimple-walk.h"
#include "tree-dfa.h"
#include "gimple-range.h"
Include dependency graph for tree-dfa.cc:

Data Structures

struct  dfa_stats_d
 
struct  numbered_tree
 

Functions

static void collect_dfa_stats (struct dfa_stats_d *)
 
void renumber_gimple_stmt_uids_in_block (struct function *fun, basic_block bb)
 
void renumber_gimple_stmt_uids (struct function *fun)
 
void renumber_gimple_stmt_uids_in_blocks (basic_block *blocks, int n_blocks)
 
void dump_variable (FILE *file, tree var)
 
DEBUG_FUNCTION void debug_variable (tree var)
 
void dump_dfa_stats (FILE *file)
 
DEBUG_FUNCTION void debug_dfa_stats (void)
 
tree ssa_default_def (struct function *fn, tree var)
 
void set_ssa_default_def (struct function *fn, tree var, tree def)
 
tree get_or_create_ssa_default_def (struct function *fn, tree var)
 
tree get_ref_base_and_extent (tree exp, poly_int64 *poffset, poly_int64 *psize, poly_int64 *pmax_size, bool *preverse)
 
tree get_ref_base_and_extent_hwi (tree exp, HOST_WIDE_INT *poffset, HOST_WIDE_INT *psize, bool *preverse)
 
tree get_addr_base_and_unit_offset_1 (tree exp, poly_int64 *poffset, tree(*valueize)(tree))
 
tree get_addr_base_and_unit_offset (tree exp, poly_int64 *poffset)
 
bool stmt_references_abnormal_ssa_name (gimple *stmt)
 
void replace_abnormal_ssa_names (gimple *stmt)
 
static int compare_decls_by_uid (const void *pa, const void *pb)
 
static tree dump_enumerated_decls_push (tree *tp, int *walk_subtrees, void *data)
 
void dump_enumerated_decls (FILE *file, dump_flags_t flags)
 

Function Documentation

◆ collect_dfa_stats()

static void collect_dfa_stats ( struct dfa_stats_d * dfa_stats_p)
static
Local functions.   
Collect DFA statistics and store them in the structure pointed to by
DFA_STATS_P.   

References cfun, FOR_EACH_BB_FN, gcc_assert, gimple_phi_num_args(), gimple_vdef(), gimple_vuse(), gsi_end_p(), gsi_next(), gsi_start_bb(), gsi_start_phis(), gsi_stmt(), NUM_SSA_OPERANDS, si, SSA_OP_DEF, and SSA_OP_USE.

Referenced by dump_dfa_stats().

◆ compare_decls_by_uid()

static int compare_decls_by_uid ( const void * pa,
const void * pb )
static
Compare two declarations references by their DECL_UID / sequence number.
Called via qsort.   

References DECL_UID, numbered_tree::num, and numbered_tree::t.

Referenced by dump_enumerated_decls().

◆ debug_dfa_stats()

DEBUG_FUNCTION void debug_dfa_stats ( void )
Dump DFA statistics on stderr.   

References dump_dfa_stats().

◆ debug_variable()

DEBUG_FUNCTION void debug_variable ( tree var)
Dump variable VAR and its may-aliases to stderr.   

References dump_variable().

◆ dump_dfa_stats()

◆ dump_enumerated_decls()

void dump_enumerated_decls ( FILE * file,
dump_flags_t flags )
Find all the declarations used by the current function, sort them by uid,
and emit the sorted list.  Each declaration is tagged with a sequence
number indicating when it was found during statement / tree walking,
so that TDF_NOUID comparisons of anonymous declarations are still
meaningful.  Where a declaration was encountered more than once, we
emit only the sequence number of the first encounter.
FILE is the dump file where to output the list and FLAGS is as in
print_generic_expr.   

References cfun, compare_decls_by_uid(), current_function_name(), dump_enumerated_decls_push(), FOR_EACH_BB_FN, FOR_EACH_VEC_ELT, walk_stmt_info::gsi, gsi_end_p(), gsi_next(), gsi_start_bb(), gsi_stmt(), is_gimple_debug(), last, NULL, NULL_TREE, numbered_tree::num, print_generic_decl(), numbered_tree::t, and walk_gimple_stmt().

Referenced by dump_function_to_file(), and execute_cleanup_cfg_post_optimizing().

◆ dump_enumerated_decls_push()

static tree dump_enumerated_decls_push ( tree * tp,
int * walk_subtrees,
void * data )
static
Called via walk_gimple_stmt / walk_gimple_op by dump_enumerated_decls.   

References DECL_P, NULL_TREE, numbered_tree::num, and numbered_tree::t.

Referenced by dump_enumerated_decls().

◆ dump_variable()

◆ get_addr_base_and_unit_offset()

◆ get_addr_base_and_unit_offset_1()

tree get_addr_base_and_unit_offset_1 ( tree exp,
poly_int64 * poffset,
tree(* valueize )(tree) )
Returns the base object and a constant BITS_PER_UNIT offset in *POFFSET that
denotes the starting address of the memory access EXP.
Returns NULL_TREE if the offset is not constant or any component
is not BITS_PER_UNIT-aligned.
VALUEIZE if non-NULL is used to valueize SSA names.  It should return
its argument or a constant if the argument is known to be constant.   

References array_ref_element_size(), array_ref_low_bound(), component_ref_field_offset(), DECL_FIELD_BIT_OFFSET, exp(), poly_int< N, C >::force_shwi(), integer_zerop(), mem_ref_offset(), NULL_TREE, poly_int_tree_p(), wi::sext(), sizetype, TMR_INDEX, TMR_INDEX2, TMR_OFFSET, wi::to_offset(), wi::to_poly_offset(), TREE_CODE, TREE_INT_CST_LOW, TREE_OPERAND, TREE_TYPE, TYPE_PRECISION, and TYPE_SIZE_UNIT.

Referenced by get_addr_base_and_unit_offset(), gimple_fold_stmt_to_constant_1(), vn_reference_fold_indirect(), and vn_reference_maybe_forwprop_address().

◆ get_or_create_ssa_default_def()

◆ get_ref_base_and_extent()

tree get_ref_base_and_extent ( tree exp,
poly_int64 * poffset,
poly_int64 * psize,
poly_int64 * pmax_size,
bool * preverse )
If EXP is a handled component reference for a structure, return the
base variable.  The access range is delimited by bit positions *POFFSET and
*POFFSET + *PMAX_SIZE.  The access size is *PSIZE bits.  If either
*PSIZE or *PMAX_SIZE is -1, they could not be determined.  If *PSIZE
and *PMAX_SIZE are equal, the access is non-variable.  If *PREVERSE is
true, the storage order of the reference is reversed.   

References ADDR_MAX_BITSIZE, array_ref_element_size(), array_ref_low_bound(), cfun, component_ref_field_offset(), CONSTANT_CLASS_P, DECL_CHAIN, DECL_COMMON, DECL_EXTERNAL, DECL_FIELD_BIT_OFFSET, DECL_P, DECL_SIZE, exp(), GET_MODE_BITSIZE(), wi::get_precision(), get_range_query(), integer_zerop(), known_le, known_lt, irange::lower_bound(), mem_ref_offset(), NULL, NULL_TREE, poly_int_tree_p(), range_query::range_of_expr(), reverse_storage_order_for_component_p(), wi::sext(), sizetype, TMR_BASE, TMR_INDEX, TMR_INDEX2, wi::to_offset(), wi::to_poly_offset(), poly_int< N, C >::to_shwi(), TREE_CODE, TREE_OPERAND, TREE_TYPE, TYPE_MODE, TYPE_PRECISION, TYPE_SIGN, TYPE_SIZE, vrange::undefined_p(), irange::upper_bound(), VAR_P, vrange::varying_p(), and VOID_TYPE_P.

Referenced by aliasing_matching_component_refs_p(), ao_ref_base(), avail_expr_hash(), ao_compare::compare_ao_refs(), create_access(), equal_mem_array_ref_p(), expand_debug_expr(), extr_type_from_vtbl_ptr_store(), fold_const_aggregate_ref_1(), get_access_for_expr(), get_base_constructor(), get_constraint_for_component_ref(), get_ref_base_and_extent_hwi(), mark_aliased_reaching_defs_necessary_1(), ipa_polymorphic_call_context::set_by_invariant(), stmt_kills_ref_p(), verify_sra_access_forest(), and vn_reference_lookup_3().

◆ get_ref_base_and_extent_hwi()

tree get_ref_base_and_extent_hwi ( tree exp,
HOST_WIDE_INT * poffset,
HOST_WIDE_INT * psize,
bool * preverse )

◆ renumber_gimple_stmt_uids()

void renumber_gimple_stmt_uids ( struct function * fun)
Renumber all of the gimple stmt uids.   

References FOR_ALL_BB_FN, renumber_gimple_stmt_uids_in_block(), and set_gimple_stmt_max_uid().

◆ renumber_gimple_stmt_uids_in_block()

void renumber_gimple_stmt_uids_in_block ( struct function * fun,
basic_block bb )
Renumber the gimple stmt uids in one block.  The caller is responsible
of calling set_gimple_stmt_max_uid (fun, 0) at some point.   

References gimple_set_uid(), gsi_end_p(), gsi_next(), gsi_start_bb(), gsi_start_phis(), gsi_stmt(), and inc_gimple_stmt_max_uid().

Referenced by renumber_gimple_stmt_uids(), and renumber_gimple_stmt_uids_in_blocks().

◆ renumber_gimple_stmt_uids_in_blocks()

void renumber_gimple_stmt_uids_in_blocks ( basic_block * blocks,
int n_blocks )
Like renumber_gimple_stmt_uids, but only do work on the basic blocks
in BLOCKS, of which there are N_BLOCKS.  Also renumbers PHIs.   

References cfun, i, renumber_gimple_stmt_uids_in_block(), and set_gimple_stmt_max_uid().

Referenced by cond_if_else_store_replacement(), tree_ssa_iv_optimize_loop(), and pcom_worker::try_combine_chains().

◆ replace_abnormal_ssa_names()

void replace_abnormal_ssa_names ( gimple * stmt)
If STMT takes any abnormal PHI values as input, replace them with
local copies.   

References FOR_EACH_SSA_USE_OPERAND, gimple_build_assign(), gsi_for_stmt(), gsi_insert_before(), GSI_SAME_STMT, make_ssa_name(), SET_USE, SSA_NAME_OCCURS_IN_ABNORMAL_PHI, SSA_OP_USE, TREE_CODE, TREE_TYPE, and USE_FROM_PTR.

Referenced by use_internal_fn().

◆ set_ssa_default_def()

◆ ssa_default_def()

◆ stmt_references_abnormal_ssa_name()

bool stmt_references_abnormal_ssa_name ( gimple * stmt)
Returns true if STMT references an SSA_NAME that has
SSA_NAME_OCCURS_IN_ABNORMAL_PHI set, otherwise false.   

References FOR_EACH_SSA_USE_OPERAND, SSA_NAME_OCCURS_IN_ABNORMAL_PHI, SSA_OP_USE, and USE_FROM_PTR.

Referenced by can_propagate_from().