GCC Middle and Back End API 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"
Data Structures | |
struct | dfa_stats_d |
struct | numbered_tree |
|
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().
|
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_FUNCTION void debug_dfa_stats | ( | void | ) |
Dump DFA statistics on stderr.
References dump_dfa_stats().
DEBUG_FUNCTION void debug_variable | ( | tree | var | ) |
Dump variable VAR and its may-aliases to stderr.
References dump_variable().
void dump_dfa_stats | ( | FILE * | file | ) |
Dump various DFA statistics to FILE.
References collect_dfa_stats(), current_function_decl, lang_hooks::decl_printable_name, fmt_size_t, HOST_SIZE_T_PRINT_DEC, dfa_stats_d::max_num_phi_args, dfa_stats_d::num_defs, dfa_stats_d::num_phi_args, dfa_stats_d::num_phis, dfa_stats_d::num_uses, dfa_stats_d::num_vdefs, dfa_stats_d::num_vuses, PRsa, and SIZE_AMOUNT.
Referenced by debug_dfa_stats(), and rewrite_blocks().
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().
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().
void dump_variable | ( | FILE * | file, |
tree | var ) |
Dump variable VAR and its may-aliases to FILE.
References cfun, DECL_INITIAL, DECL_PT_UID, DECL_UID, dump_flags, dump_points_to_info_for(), is_global_var(), NULL_TREE, POINTER_TYPE_P, print_generic_expr(), ssa_default_def(), SSA_NAME_VAR, TREE_ADDRESSABLE, TREE_CODE, TREE_THIS_VOLATILE, and TREE_TYPE.
Referenced by debug_variable(), and dump_alias_info().
tree get_addr_base_and_unit_offset | ( | tree | exp, |
poly_int64 * | poffset ) |
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.
References exp(), get_addr_base_and_unit_offset_1(), and NULL.
Referenced by addr_stridxptr(), address_compare(), ao_ref_init_from_ptr_and_range(), array_ref_flexible_size_p(), build_debug_ref_for_model(), build_ref_for_offset(), build_simple_mem_ref_loc(), component_ref_size(), constant_byte_string(), constant_pointer_difference(), create_component_ref_by_pieces_1(), expand_simple_operations(), fold_binary_loc(), forward_propagate_addr_expr_1(), gather_mem_refs_stmt(), get_addr_stridx(), get_range_strlen_dynamic(), get_range_strlen_tree(), get_up_bounds_for_array_ref(), gimple_fold_builtin_memory_op(), jump_function_from_stmt(), lower_omp_target(), maybe_canonicalize_mem_ref_addr(), maybe_diag_stxncpy_trunc(), maybe_fold_tmr(), ipa_param_adjustments::modify_call(), optimize_memcpy_to_memset(), set_ssa_val_to(), pair_fusion_bb_info::track_via_mem_expr(), unadjusted_ptr_and_unit_offset(), visit_phi(), and vn_reference_lookup_3().
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().
Retrieve or create a default definition for VAR.
References gimple_build_nop(), make_ssa_name_fn(), NULL_TREE, set_ssa_default_def(), and ssa_default_def().
Referenced by addr_object_size(), create_default_def(), get_reaching_def(), get_repl_default_def_ssa_name(), gimple_fold_call(), gimple_lower_bitint(), initialize_root_vars_store_elim_2(), maybe_register_def(), parm_object_size(), replace_ref_with(), rewrite_stmt(), simd_clone_adjust(), simd_clone_linear_addend(), split_function(), vect_get_mask_load_else(), and vect_get_vec_defs_for_operand().
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().
tree get_ref_base_and_extent_hwi | ( | tree | exp, |
HOST_WIDE_INT * | poffset, | ||
HOST_WIDE_INT * | psize, | ||
bool * | preverse ) |
Like get_ref_base_and_extent, but for cases in which we only care about constant-width accesses at constant offsets. Return null if the access is anything else.
References exp(), get_ref_base_and_extent(), poly_int< N, C >::is_constant(), NULL_TREE, and offset.
Referenced by add_var_loc_to_decl(), check_stmt_for_type_change(), compute_complex_assign_jump_func(), determine_known_aggregate_parts(), do_structure_copy(), extract_mem_content(), get_ancestor_addr_info(), ipa_polymorphic_call_context::get_dynamic_type(), ipa_load_from_parm_agg(), ipa_polymorphic_call_context::ipa_polymorphic_call_context(), isra_get_ref_base_and_offset(), and track_expr_p().
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().
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().
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().
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().
Insert the pair VAR's UID, DEF into the default_defs hashtable of function FN.
References DECL_UID, DEFAULT_DEFS, gcc_assert, SSA_NAME_IS_DEFAULT_DEF, SSA_NAME_VAR, TREE_CODE, and VAR_P.
Referenced by expand_call_inline(), fixup_noreturn_call(), get_component_ssa_name(), get_or_create_ssa_default_def(), gimple_fold_call(), gimple_lower_bitint(), input_ssa_names(), ipa_simd_modify_function_body(), move_sese_region_to_fn(), cgraph_edge::redirect_call_stmt_to_callee(), remap_ssa_name(), remove_unused_locals(), setup_one_parameter(), tree_function_versioning(), and tree_optimize_tail_calls_1().
Lookup VAR UID in the default_defs hashtable and return the associated variable.
References DECL_UID, DEFAULT_DEFS, gcc_assert, function::gimple_df, NULL_TREE, TREE_CODE, and VAR_P.
Referenced by assign_parm_setup_block(), gimple_infer_range::check_assume_func(), coalesce_with_default(), compute_avail(), consider_split(), create_coalesce_list_for_region(), declare_return_variable(), do_warn_nonnull_compare(), dump_function_to_file(), dump_variable(), expand_call_inline(), expand_function_start(), find_tail_calls(), ipa_param_body_adjustments::get_ddef_if_exists_and_is_used(), get_omp_data_i_param(), get_or_create_ssa_default_def(), virtual_operand_live::init(), init_parameter_lattice_values(), initialize_inlined_parameters(), ipa_analyze_controlled_uses(), ipcp_update_vr(), oacc_entry_exit_single_gang(), points_to_local_or_readonly_memory_p(), remove_unused_locals(), ipa_param_body_adjustments::reset_debug_stmts(), set_parm_default_def_partition(), set_parm_rtl(), setup_one_parameter(), simd_clone_adjust(), split_function(), tree_function_versioning(), tree_optimize_tail_calls_1(), update_parameter_components(), verify_live_on_entry(), and verify_ssa().
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().