GCC Middle and Back End API Reference
|
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "backend.h"
#include "target.h"
#include "rtl.h"
#include "tree.h"
#include "gimple.h"
#include "df.h"
#include "memmodel.h"
#include "tm_p.h"
#include "gimple-ssa.h"
#include "emit-rtl.h"
#include "alias.h"
#include "fold-const.h"
#include "varasm.h"
#include "cselib.h"
#include "langhooks.h"
#include "cfganal.h"
#include "rtl-iter.h"
#include "cgraph.h"
#include "ipa-utils.h"
#include "gt-alias.h"
Data Structures | |
struct | alias_set_hash |
struct | alias_set_entry |
Macros | |
#define | SIZE_FOR_MODE(X) |
#define | MAX_ALIAS_LOOP_PASSES 10 |
#define | UNIQUE_BASE_VALUE_SP -1 |
#define | UNIQUE_BASE_VALUE_ARGP -2 |
#define | UNIQUE_BASE_VALUE_FP -3 |
#define | UNIQUE_BASE_VALUE_HFP -4 |
#define | static_reg_base_value (this_target_rtl->x_static_reg_base_value) |
#define | REG_BASE_VALUE(X) |
Variables | ||
struct { | ||
unsigned long long num_alias_zero | ||
unsigned long long num_same_alias_set | ||
unsigned long long num_same_objects | ||
unsigned long long num_volatile | ||
unsigned long long num_dag | ||
unsigned long long num_universal | ||
unsigned long long num_disambiguated | ||
} | alias_stats | |
static vec< rtx, va_gc > * | reg_base_value | |
static rtx * | new_reg_base_value | |
static rtx | arg_base_value | |
static int | unique_id | |
static vec< rtx, va_gc > * | old_reg_base_value | |
static vec< rtx, va_gc > * | reg_known_value | |
static sbitmap | reg_known_equiv_p | |
static bool | copying_arguments | |
static vec< alias_set_entry *, va_gc > * | alias_sets | |
static alias_set_type | varargs_set = -1 | |
static alias_set_type | frame_set = -1 | |
static sbitmap | reg_seen | |
static bool | memory_modified | |
#define MAX_ALIAS_LOOP_PASSES 10 |
Cap the number of passes we make over the insns propagating alias information through set chains. ??? 10 is a completely arbitrary choice. This should be based on the maximum loop depth in the CFG, but we do not have this information available (even if current_loops _is_ available).
Referenced by init_alias_analysis().
#define REG_BASE_VALUE | ( | X | ) |
Referenced by find_base_term(), and vt_equate_reg_base_value().
#define SIZE_FOR_MODE | ( | X | ) |
Set up all info needed to perform alias analysis on memory references.
Returns the size in bytes of the mode of X.
Referenced by true_dependence_1(), and write_dependence_p().
#define static_reg_base_value (this_target_rtl->x_static_reg_base_value) |
Referenced by find_base_term(), init_alias_analysis(), init_alias_target(), and may_be_sp_based_p().
#define UNIQUE_BASE_VALUE_ARGP -2 |
Referenced by init_alias_target().
#define UNIQUE_BASE_VALUE_FP -3 |
Referenced by init_alias_target().
#define UNIQUE_BASE_VALUE_HFP -4 |
Referenced by init_alias_target().
#define UNIQUE_BASE_VALUE_SP -1 |
Values of XINT (address, 0) of Pmode ADDRESS rtxes for special registers.
Referenced by init_alias_target().
|
static |
Return the address of the (N_REFS + 1)th memory reference to ADDR where SIZE is the size in bytes of the memory reference. If ADDR is not modified by the memory reference then ADDR is returned.
References canon_rtx(), GET_CODE, GET_MODE, offset, plus_constant(), and XEXP.
Referenced by memrefs_conflict_p().
|
static |
Walk up the COMPONENT_REF list in X and adjust *OFFSET to compensate for the offset of the field reference. *KNOWN_P says whether the offset is known.
References component_ref_field_offset(), DECL_FIELD_BIT_OFFSET, offset, poly_int_tree_p(), wi::to_offset(), wi::to_poly_offset(), poly_int< N, C >::to_shwi(), TREE_CODE, and TREE_OPERAND.
Referenced by nonoverlapping_memrefs_p().
Return whether the pointer-types T1 and T2 used to determine two alias sets of two references will yield the same answer from get_deref_alias_set.
References get_deref_alias_set(), ref_all_alias_ptr_type_p(), TREE_TYPE, and TYPE_MAIN_VARIANT.
Referenced by ao_compare::compare_ao_refs(), and operand_compare::operand_equal_p().
bool alias_set_subset_of | ( | alias_set_type | set1, |
alias_set_type | set2 ) |
Return true if the first alias set is a subset of the second.
References alias_set_entry::children, hash_map< KeyId, Value, Traits >::get(), get_alias_set_entry(), alias_set_entry::has_pointer, alias_set_entry::has_zero_child, alias_set_entry::is_pointer, ptr_type_node, and TYPE_ALIAS_SET.
Referenced by access_path_may_continue_p(), compute_avail(), cse_insn(), dse_optimize_redundant_stores(), eliminate_dom_walker::eliminate_stmt(), mems_same_for_tbaa_p(), refs_same_for_tbaa_p(), and visit_reference_op_store().
bool alias_sets_conflict_p | ( | alias_set_type | set1, |
alias_set_type | set2 ) |
Return true if the two specified alias sets may conflict.
References alias_sets_must_conflict_p(), alias_stats, alias_set_entry::children, hash_map< KeyId, Value, Traits >::get(), get_alias_set_entry(), alias_set_entry::has_pointer, alias_set_entry::is_pointer, ptr_type_node, and TYPE_ALIAS_SET.
Referenced by check_scan_store(), dr_may_alias_p(), gimplify_init_ctor_preeval_1(), indirect_ref_may_alias_decl_p(), indirect_refs_may_alias_p(), mems_in_disjoint_alias_sets_p(), modref_may_conflict(), refs_may_alias_p_2(), safe_from_p(), same_type_for_tbaa(), set_mem_alias_set(), vect_analyze_data_ref_dependence(), vect_create_data_ref_ptr(), vectorizable_load(), and vectorizable_store().
bool alias_sets_must_conflict_p | ( | alias_set_type | set1, |
alias_set_type | set2 ) |
Return true if the two specified alias sets will always conflict.
References alias_stats.
Referenced by alias_sets_conflict_p(), and objects_must_conflict_p().
Anti dependence: X is written after read in MEM takes place.
References NULL_RTX, and write_dependence_p().
Referenced by load_kills_store(), memory_modified_1(), and validate_equiv_mem_from_store().
Build a decomposed reference object for querying the alias-oracle from the MEM rtx and store it in *REF. Returns false if MEM is not suitable for the alias-oracle.
References ao_ref_base(), ao_ref_init(), DECL_P, DECL_SIZE, get_spill_slot_decl(), maybe_gt, MEM_ALIAS_SET, MEM_EXPR, MEM_OFFSET, MEM_OFFSET_KNOWN_P, MEM_SIZE, MEM_SIZE_KNOWN_P, NULL_TREE, poly_int_tree_p(), TMR_BASE, wi::to_poly_offset(), TREE_CODE, and TREE_OPERAND.
Referenced by rtx_refs_may_alias_p().
|
static |
Return false if the addresses X and Y are known to point to different objects, true if they might be pointers to the same object.
References canon_rtx(), compare_base_symbol_refs(), CONST_INT_P, find_base_term(), GET_CODE, GET_MODE_UNIT_SIZE, INTVAL, rtx_equal_p(), unique_base_value_p(), XEXP, and y.
Referenced by may_alias_p(), true_dependence_1(), and write_dependence_p().
bool canon_anti_dependence | ( | const_rtx | mem, |
bool | mem_canonicalized, | ||
const_rtx | x, | ||
machine_mode | x_mode, | ||
rtx | x_addr ) |
Likewise, but we already have a canonicalized MEM, and X_ADDR for X. Also, consider X in X_MODE (which might be from an enclosing STRICT_LOW_PART / ZERO_EXTRACT). If MEM_CANONICALIZED is true, MEM is canonicalized.
References write_dependence_p().
Referenced by check_dependence(), and cselib_invalidate_mem().
bool canon_output_dependence | ( | const_rtx | mem, |
bool | mem_canonicalized, | ||
const_rtx | x, | ||
machine_mode | x_mode, | ||
rtx | x_addr ) |
Likewise, but we already have a canonicalized MEM, and X_ADDR for X. Also, consider X in X_MODE (which might be from an enclosing STRICT_LOW_PART / ZERO_EXTRACT). If MEM_CANONICALIZED is true, MEM is canonicalized.
References write_dependence_p().
Referenced by record_store().
Returns a canonical version of X, from the point of view alias analysis. (For example, if X is a MEM whose address is a register, and the register has a known value (say a SYMBOL_REF), then a MEM whose address is the SYMBOL_REF is returned.)
References canon_rtx(), GET_CODE, GET_MODE, get_reg_known_value(), MEM_P, REG_P, REGNO, replace_equiv_address_nv(), simplify_gen_binary(), and XEXP.
Referenced by addr_side_effect_eval(), base_alias_check(), canon_address(), canon_list_insert(), canon_rtx(), clobber_overlapping_mems(), compute_transp(), cselib_invalidate_mem(), get_addr_from_global_cache(), get_group_info(), invalidate(), memrefs_conflict_p(), record_store(), rtx_equal_for_memref_p(), true_dependence_1(), vt_canonicalize_addr(), and write_dependence_p().
bool canon_true_dependence | ( | const_rtx | mem, |
machine_mode | mem_mode, | ||
rtx | mem_addr, | ||
const_rtx | x, | ||
rtx | x_addr ) |
Canonical true dependence: X is read after store in MEM takes place. Variant of true_dependence which assumes MEM has already been canonicalized (hence we no longer do that here). The mem_addr argument has been added, since true_dependence_1 computed this value prior to canonicalizing.
References true_dependence_1().
Referenced by check_mem_read_rtx(), compute_transp(), scan_reads(), and vt_canon_true_dep().
BASE1 and BASE2 are decls. Return 1 if they refer to same object, 0 if they refer to different objects and -1 if we cannot decide.
References DECL_ASSEMBLER_NAME_RAW, DECL_ASSEMBLER_NAME_SET_P, DECL_HARD_REGISTER, decl_in_symtab_p(), DECL_P, symtab_node::equal_address_to(), gcc_checking_assert, symtab_node::get(), and VAR_P.
Referenced by compare_base_symbol_refs(), decl_refs_may_alias_p(), nonoverlapping_memrefs_p(), and ptr_deref_may_alias_decl_p().
|
static |
Compare SYMBOL_REFs X_BASE and Y_BASE. - Return 1 if Y_BASE - X_BASE is constant, adding that constant to *DISTANCE if DISTANCE is nonnull. - Return 0 if no accesses based on X_BASE can alias Y_BASE. - Return -1 if one of the two results applies, but we can't tell which at compile time. Update DISTANCE in the same way as for a return value of 1, for the case in which that holds.
References compare_base_decls(), symtab_node::decl, decl_binds_to_current_def_p(), DECL_RTL, symtab_node::definition, symtab_node::get_create(), SYMBOL_REF_BLOCK, SYMBOL_REF_BLOCK_OFFSET, SYMBOL_REF_DECL, SYMBOL_REF_HAS_BLOCK_INFO_P, TREE_PUBLIC, TREE_STATIC, symtab_node::ultimate_alias_target(), VAR_P, XEXP, and XSTR.
Referenced by base_alias_check(), memrefs_conflict_p(), and rtx_equal_for_memref_p().
tree component_uses_parent_alias_set_from | ( | const_tree | t | ) |
Return the outermost parent of component present in the chain of component references handled by get_inner_reference in T with the following property: - the component is non-addressable or NULL_TREE if no such parent exists. In the former cases, the alias set of this parent is the alias set that must be used for T itself.
References ends_tbaa_access_path_p(), handled_component_p(), NULL_TREE, and TREE_OPERAND.
Referenced by reference_alias_ptr_type_1(), and set_mem_attributes_minus_bitpos().
Look at the bottom of the COMPONENT_REF list for a DECL, and return it.
References DECL_P, NULL_TREE, TREE_CODE, and TREE_OPERAND.
Referenced by nonoverlapping_memrefs_p().
void dump_alias_stats_in_alias_c | ( | FILE * | s | ) |
References alias_stats.
Referenced by dump_alias_stats().
void end_alias_analysis | ( | void | ) |
References old_reg_base_value, reg_base_value, reg_known_equiv_p, reg_known_value, sbitmap_free(), and vec_free().
Referenced by cse_main(), dse_step7(), gcse_after_reload_main(), ira(), one_code_hoisting_pass(), one_pre_gcse_pass(), one_store_motion_pass(), and reload_cse_regs_1().
bool ends_tbaa_access_path_p | ( | const_tree | t | ) |
Return true if T is an end of the access path which can be used by type based alias oracle.
References DECL_NONADDRESSABLE_P, gcc_unreachable, TREE_CODE, TREE_OPERAND, TREE_TYPE, and TYPE_NONALIASED_COMPONENT.
Referenced by aliasing_component_refs_p(), ao_compare::compare_ao_refs(), component_uses_parent_alias_set_from(), nonoverlapping_component_refs_p(), and nonoverlapping_refs_since_match_p().
Wrapper around the worker above which removes locs from visited VALUEs to avoid visiting them multiple times. We unwind that changes here.
References find_base_term(), and i.
|
static |
References CONST_INT_P, CONSTANT_P, convert_memory_address, cselib_sp_based_value_p(), CSELIB_VAL_PTR, find_base_term(), GET_CODE, GET_MODE, GET_MODE_PRECISION(), INTVAL, is_a(), elt_loc_list::loc, cselib_val::locs, elt_loc_list::next, NULL, NULL_RTX, pic_offset_table_rtx, REG_BASE_VALUE, static_reg_base_value, target_default_pointer_address_modes_p(), and XEXP.
Referenced by base_alias_check(), find_base_term(), find_base_term(), may_alias_p(), may_be_sp_based_p(), true_dependence_1(), and write_dependence_p().
Inside SRC, the source of a SET, find a base address.
References arg_base_value, arg_pointer_rtx, CONST_INT_P, CONSTANT_P, convert_memory_address, copying_arguments, DF_REG_DEF_COUNT, find_base_value(), fixed_regs, GET_CODE, GET_MODE, GET_MODE_PRECISION(), INTVAL, is_a(), new_reg_base_value, reg_base_value, REGNO, target_default_pointer_address_modes_p(), vec_safe_length(), and XEXP.
Referenced by find_base_value(), and record_set().
Convert the address X into something we can use. This is done by returning it unchanged unless it is a VALUE or VALUE +/- constant; for VALUE we call cselib to get a more useful rtx.
References canonical_cselib_val(), CONST_SCALAR_INT_P, CONSTANT_P, cselib_have_permanent_equivalences(), CSELIB_VAL_PTR, get_addr(), GET_CODE, GET_MODE, elt_loc_list::loc, cselib_val::locs, MEM_P, elt_loc_list::next, plus_constant(), poly_int_rtx_p(), refs_newer_value_p(), REG_P, simplify_gen_binary(), cselib_val::val_rtx, and XEXP.
Referenced by canon_list_insert(), check_mem_read_rtx(), compute_transp(), cselib_invalidate_mem(), get_addr(), get_addr_from_global_cache(), invalidate(), may_alias_p(), memrefs_conflict_p(), true_dependence_1(), and write_dependence_p().
alias_set_type get_alias_set | ( | tree | t | ) |
Return the alias set for T, which may be either a type or an expression. Call language-specific routine for help, if needed.
References AGGREGATE_TYPE_P, build_pointer_type(), build_reference_type(), canonical_type_used_p(), COMPLETE_TYPE_P, DECL_RTL, DECL_RTL_SET_P, error_mark_node, gcc_checking_assert, get_alias_set(), lang_hooks::get_alias_set, get_alias_set_entry(), get_deref_alias_set(), alias_set_entry::has_pointer, init_alias_set_entry(), alias_set_entry::is_pointer, MEM_ALIAS_SET, MEM_P, new_alias_set(), NULL, odr_type_p(), POINTER_TYPE_P, prevailing_odr_type(), ptr_type_node, record_component_aliases(), reference_alias_ptr_type_1(), STRIP_NOPS, TREE_CODE, TREE_TYPE, TYPE_ALIAS_SET, TYPE_ALIAS_SET_KNOWN_P, TYPE_CANONICAL, TYPE_MAIN_VARIANT, TYPE_NONALIASED_COMPONENT, TYPE_P, TYPE_STRUCTURAL_EQUALITY_P, TYPE_TYPELESS_STORAGE, type_with_alias_set_p(), and VAR_P.
Referenced by ao_ref_alias_set(), ao_ref_base_alias_set(), assign_stack_temp_for_type(), check_scan_store(), dr_may_alias_p(), dump_lto_records(), expand_assignment(), expand_builtin_va_copy(), get_alias_set(), get_deref_alias_set(), ipa_polymorphic_call_context::get_dynamic_type(), get_group_alias_ptr_type(), gimple_get_alias_set(), gimplify_init_constructor(), gimplify_init_ctor_preeval_1(), make_bit_field_ref(), objects_must_conflict_p(), record_component_aliases(), record_component_aliases(), safe_from_p(), same_type_for_tbaa(), set_mem_attributes_minus_bitpos(), store_constructor(), vect_analyze_data_ref_dependence(), vect_create_data_ref_ptr(), vectorizable_load(), and vectorizable_store().
|
inlinestatic |
Returns a pointer to the alias set entry for ALIAS_SET, if there is such an entry, or NULL otherwise.
References alias_sets.
Referenced by alias_set_subset_of(), alias_sets_conflict_p(), get_alias_set(), init_alias_set_entry(), and record_alias_subset().
alias_set_type get_deref_alias_set | ( | tree | t | ) |
Return the alias set for the memory pointed to by T, which may be either a type or an expression.
References get_alias_set(), get_deref_alias_set_1(), TREE_TYPE, and TYPE_P.
Referenced by alias_ptr_types_compatible_p(), call_may_clobber_ref_p_1(), get_alias_set(), ipa_icf::sem_item_optimizer::read_section(), ref_maybe_used_by_call_p_1(), and vn_reference_lookup_3().
|
static |
Return the alias set for the memory pointed to by T, which may be either a type or an expression. Return -1 if there is nothing special about dereferencing T.
References ref_all_alias_ptr_type_p(), TREE_TYPE, and TYPE_P.
Referenced by get_deref_alias_set().
alias_set_type get_frame_alias_set | ( | void | ) |
References frame_set, and new_alias_set().
Referenced by gen_frame_mem(), gen_tmp_stack_mem(), and setup_save_areas().
rtx get_reg_base_value | ( | unsigned int | regno | ) |
Return REG_BASE_VALUE for REGNO. Selective scheduler uses this to avoid using hard registers with non-null REG_BASE_VALUE for renaming.
References reg_base_value.
bool get_reg_known_equiv_p | ( | unsigned int | regno | ) |
Similarly for reg_known_equiv_p.
References bitmap_bit_p, reg_known_equiv_p, reg_known_value, and vec_safe_length().
rtx get_reg_known_value | ( | unsigned int | regno | ) |
If a value is known for REGNO, return it.
References NULL, reg_known_value, and vec_safe_length().
Referenced by canon_rtx(), and init_alias_analysis().
alias_set_type get_varargs_alias_set | ( | void | ) |
References new_alias_set(), and varargs_set.
void init_alias_analysis | ( | void | ) |
Initialize the aliasing machinery. Initialize the REG_KNOWN_VALUE array.
References BASIC_BLOCK_FOR_FN, bitmap_clear(), bitmap_set_bit, cfun, changed, copying_arguments, DF_REG_DEF_COUNT, find_reg_equal_equiv_note(), find_reg_note(), FOR_BB_INSNS, FOR_EACH_VEC_ELT, frame_pointer_needed, free(), gcc_assert, GET_CODE, GET_MODE, get_reg_known_value(), HARD_FRAME_POINTER_REGNUM, hard_frame_pointer_rtx, i, MAX_ALIAS_LOOP_PASSES, max_reg_num(), modified_in_p(), n_basic_blocks_for_fn, new_reg_base_value, NONDEBUG_INSN_P, NOTE_KIND, NOTE_P, note_stores(), NULL, NULL_RTX, offset, old_reg_base_value, PATTERN(), plus_constant(), poly_int_rtx_p(), pre_and_rev_post_order_compute(), record_set(), reg_base_value, reg_known_equiv_p, reg_known_value, REG_NOTE_KIND, REG_NOTES, reg_overlap_mentioned_p(), REG_P, reg_seen, REGNO, regno_reg_rtx, reload_completed, rtx_equal_p(), rtx_varies_p(), sbitmap_alloc(), sbitmap_free(), SET, SET_DEST, set_reg_known_equiv_p(), set_reg_known_value(), SET_SRC, single_set(), static_reg_base_value, targetm, timevar_pop(), timevar_push(), ui, unique_id, vec_safe_grow_cleared(), and XEXP.
Referenced by cse_main(), dse_step0(), gcse_after_reload_main(), ira(), one_code_hoisting_pass(), one_pre_gcse_pass(), one_store_motion_pass(), and reload_cse_regs_1().
alias_set_entry * init_alias_set_entry | ( | alias_set_type | set | ) |
Create emptry alias set entry.
References alias_set_entry::alias_set, alias_set_entry::children, gcc_checking_assert, get_alias_set_entry(), ggc_alloc(), alias_set_entry::has_pointer, alias_set_entry::has_zero_child, alias_set_entry::is_pointer, and NULL.
Referenced by get_alias_set(), and record_alias_subset().
void init_alias_target | ( | void | ) |
Check whether X may be aliased with MEM. Don't do offset-based memory disambiguation & TBAA.
References ALIAS_SET_MEMORY_BARRIER, base_alias_check(), find_base_term(), get_addr(), GET_CODE, GET_MODE, MEM_ADDR_SPACE, MEM_ALIAS_SET, MEM_READONLY_P, MEM_VOLATILE_P, nonoverlapping_memrefs_p(), rtx_refs_may_alias_p(), and XEXP.
Return true if accesses to address X may alias accesses based on the stack pointer.
References find_base_term(), and static_reg_base_value.
Referenced by record_store(), and store_killed_in_insn().
References anti_dependence(), MEM_P, memory_modified, and output_dependence().
Referenced by memory_modified_in_insn_p().
Return true when INSN possibly modify memory contents of MEM (i.e. address can be modified).
References as_a(), CALL_P, CONST_CAST_RTX, INSN_P, memory_modified, memory_modified_1(), and note_stores().
Referenced by load_modified_by_store_p(), modified_between_p(), modified_in_p(), and store_modifies_mem_p().
|
static |
Return one if X and Y (memory addresses) reference the same location in memory or if the references overlap. Return zero if they do not overlap, else return minus one in which case they still might reference the same location. C is an offset accumulator. When C is nonzero, we are testing aliases between X and Y + C. XSIZE is the size in bytes of the X reference, similarly YSIZE is the size in bytes for Y. Expect that canon_rtx has been already called for X and Y. If XSIZE or YSIZE is zero, we do not know the amount of memory being referenced (the reference was BLKmode), so make the most pessimistic assumptions. If XSIZE or YSIZE is negative, we may access memory outside the object being referenced as a side effect. This can happen when using AND to align memory references, as is done on the Alpha. Nice to notice that varying addresses cannot conflict with fp if no local variables had their addresses taken, but that's too hard now. ??? Contrary to the tree alias oracle this does not return one for X + non-constant and Y + non-constant when X and Y are equal. If that is fixed the TBAA hack for union type-punning can be removed.
References addr_side_effect_eval(), canon_rtx(), canonical_cselib_val(), compare_base_symbol_refs(), const0_rtx, CONST_INT_P, CONSTANT_P, CSELIB_VAL_PTR, get_addr(), GET_CODE, INTVAL, elt_loc_list::loc, maybe_gt, memrefs_conflict_p(), elt_loc_list::next, NULL, offset_overlap_p(), poly_int_rtx_p(), pow2_or_zerop(), REG_P, rtx_equal_for_memref_p(), sc, uc, XEXP, and y.
Referenced by memrefs_conflict_p(), true_dependence_1(), and write_dependence_p().
Returns true if the alias sets for MEM1 and MEM2 are such that the two MEMs cannot alias each other.
References alias_sets_conflict_p(), and MEM_ALIAS_SET.
Referenced by true_dependence_1().
Similar to refs_same_for_tbaa_p() but for use on MEM rtxs.
References alias_set_subset_of(), gcc_assert, MEM_ALIAS_SET, MEM_EXPR, MEM_P, and refs_same_for_tbaa_p().
Referenced by cselib_redundant_set_p(), record_store(), and store_expr().
alias_set_type new_alias_set | ( | void | ) |
Return a brand-new alias set.
References alias_sets, NULL, and vec_safe_push().
Referenced by asan_init_shadow_ptr_types(), expand_builtin_longjmp(), expand_builtin_setjmp_setup(), get_alias_set(), get_frame_alias_set(), get_spill_slot_decl(), get_varargs_alias_set(), and rt_bb_visited::rt_bb_visited().
Return true if we can determine the exprs corresponding to memrefs X and Y and they do not overlap. If LOOP_VARIANT is set, skip offset-based disambiguation
References adjust_offset_for_component_ref(), compare_base_decls(), CONSTANT_P, decl_for_component_ref(), DECL_P, DECL_RTL, DECL_RTL_SET_P, GET_MODE, GET_MODE_SIZE(), get_spill_slot_decl(), is_gimple_reg(), MEM_ADDR_SPACE, MEM_EXPR, MEM_OFFSET, MEM_OFFSET_KNOWN_P, MEM_P, MEM_SIZE, MEM_SIZE_KNOWN_P, offset_overlap_p(), REG_P, REGNO, REGNO_PTR_FRAME_P, rtx_equal_p(), strip_offset_and_add(), TREE_CODE, XEXP, and y.
Referenced by may_alias_p(), true_dependence_1(), and write_dependence_p().
Return true if any MEM object of type T1 will always conflict (using the dependency routines in this file) with any MEM object of type T2. This is used when allocating temporary storage. If T1 and/or T2 are NULL_TREE, it means we know nothing about the storage.
References alias_sets_must_conflict_p(), alias_stats, get_alias_set(), and TYPE_VOLATILE.
Referenced by assign_stack_temp_for_type().
|
inlinestatic |
Return TRUE if an object X sized at XSIZE bytes and another object Y sized at YSIZE bytes, starting C bytes after X, may overlap. If any of the sizes is zero, assume an overlap, otherwise use the absolute value of the sizes as the actual sizes.
References known_eq, maybe_ge, and maybe_gt.
Referenced by memrefs_conflict_p(), and nonoverlapping_memrefs_p().
Output dependence: X is written after store in MEM takes place.
References NULL_RTX, and write_dependence_p().
Referenced by memory_modified_1(), and store_killed_in_pat().
Functions to compute memory dependencies. Since we process the insns in execution order, we can build tables to keep track of what registers are fixed (and not aliased), what registers are varying in known ways, and what registers are varying in unknown ways. If both memory references are volatile, then there must always be a dependence between the two references, since their order cannot be changed. A volatile and non-volatile reference can be interchanged though. We also must allow AND addresses, because they may generate accesses outside the object being referenced. This is used to generate aligned addresses from unaligned addresses, for instance, the alpha storeqi_unaligned pattern.
Read dependence: X is read after read in MEM takes place. There can only be a dependence here if both reads are volatile, or if either is an explicit barrier.
References ALIAS_SET_MEMORY_BARRIER, MEM_ALIAS_SET, and MEM_VOLATILE_P.
void record_alias_subset | ( | alias_set_type | superset, |
alias_set_type | subset ) |
Indicate that things in SUBSET can alias things in SUPERSET, but that not everything that aliases SUPERSET also aliases SUBSET. For example, in C, a store to an `int' can alias a load of a structure containing an `int', and vice versa. But it can't alias a load of a 'double' member of the same structure. Here, the structure would be the SUPERSET and `int' the SUBSET. This relationship is also described in the comment at the beginning of this file. This function should be called only once per SUPERSET/SUBSET pair. It is illegal for SUPERSET to be zero; everything is implicitly a subset of alias set zero.
References hash_map< KeyId, Value, Traits >::begin(), alias_set_entry::children, hash_map< KeyId, Value, Traits >::create_ggc(), hash_map< KeyId, Value, Traits >::end(), gcc_assert, get_alias_set_entry(), alias_set_entry::has_pointer, alias_set_entry::has_zero_child, init_alias_set_entry(), and hash_map< KeyId, Value, Traits >::put().
Referenced by record_component_aliases().
void record_component_aliases | ( | tree | type | ) |
Record that component types of TYPE, if any, are part of that type for aliasing purposes. For record types, we only record component types for fields that are not marked non-addressable. For array types, we only record the component type if it is not marked non-aliased.
References get_alias_set(), and record_component_aliases().
void record_component_aliases | ( | tree | type, |
alias_set_type | superset ) |
Record that component types of TYPE, if any, are part of SUPERSET for aliasing purposes. For record types, we only record component types for fields that are not marked non-addressable. For array types, we only record the component type if it is not marked non-aliased.
References canonical_type_used_p(), DECL_CHAIN, DECL_NONADDRESSABLE_P, gcc_checking_assert, get_alias_set(), odr_based_tbaa_p(), odr_type_p(), POINTER_TYPE_P, ptr_type_node, record_alias_subset(), record_component_aliases(), TREE_CODE, TREE_TYPE, TYPE_FIELDS, and TYPE_STRUCTURAL_EQUALITY_P.
Referenced by get_alias_set(), record_component_aliases(), and record_component_aliases().
References bitmap_bit_p, bitmap_set_bit, CONST_INT_P, find_base_value(), fixed_regs, gcc_checking_assert, GET_CODE, new_reg_base_value, NULL_RTX, REG_NREGS, REG_P, reg_seen, REGNO, SET_SRC, unique_base_value(), unique_id, and XEXP.
Referenced by init_alias_analysis().
|
static |
Return whether the pointer-type T effective for aliasing may access everything and thus the reference has to be assigned alias-set zero.
References TREE_TYPE, TYPE_REF_CAN_ALIAS_ALL, and VOID_TYPE_P.
Referenced by alias_ptr_types_compatible_p(), get_deref_alias_set_1(), and reference_alias_ptr_type_1().
Return the pointer-type relevant for TBAA purposes from the gimple memory reference tree T. This is the type to be used for the offset operand of MEM_REF or TARGET_MEM_REF replacements of T and guarantees that get_alias_set will return the same alias set for T and the replacement.
References build_pointer_type(), lang_hooks::get_alias_set, NULL_TREE, ptr_type_node, reference_alias_ptr_type_1(), TREE_CODE, TREE_OPERAND, TREE_TYPE, and TYPE_MAIN_VARIANT.
Referenced by ao_ref_alias_ptr_type(), ao_ref_base_alias_ptr_type(), build_debug_ref_for_model(), build_ref_for_offset(), check_scan_store(), compute_avail(), dr_analyze_indices(), gather_mem_refs_stmt(), get_group_alias_ptr_type(), gimplify_expr(), initialize_data_dependence_relation(), instrument_bool_enum_load(), maybe_trim_constructor_store(), predicate_load_or_store(), ref_at_iteration(), rewrite_use_address(), set_mem_attributes_minus_bitpos(), vect_recog_cond_store_pattern(), vect_setup_realignment(), vectorizable_load(), vectorizable_scan_store(), and vectorizable_store().
Return the pointer-type relevant for TBAA purposes from the memory reference tree *T or NULL_TREE in which case *T is adjusted to point to the outermost component reference that can be used for assigning an alias set.
References component_uses_parent_alias_set_from(), handled_component_p(), INDIRECT_REF_P, NULL_TREE, ref_all_alias_ptr_type_p(), TMR_OFFSET, TREE_CODE, TREE_OPERAND, TREE_TYPE, TYPE_MAIN_VARIANT, and view_converted_memref_p().
Referenced by get_alias_set(), and reference_alias_ptr_type().
Return TRUE if EXPR refers to a VALUE whose uid is greater than (or equal to) that of V.
References CSELIB_VAL_PTR, FOR_EACH_SUBRTX, and GET_CODE.
Referenced by get_addr().
Return true if the ref EARLIER behaves the same as LATER with respect to TBAA for every memory reference that might follow LATER.
References alias_set_subset_of(), ao_ref_alias_set(), ao_ref_base_alias_set(), and ao_ref_init().
Referenced by cse_insn(), mems_same_for_tbaa_p(), and dom_opt_dom_walker::optimize_stmt().
Return true if X and Y are identical-looking rtx's. Expect that X and Y has been already canonicalized. We use the data in reg_known_value above to see if two registers with different numbers are, in fact, equivalent.
References canon_rtx(), CASE_CONST_UNIQUE, COMMUTATIVE_P, compare_base_symbol_refs(), ENTRY_VALUE_EXP, gcc_unreachable, GET_CODE, GET_MODE, GET_RTX_FORMAT, GET_RTX_LENGTH, i, label_ref_label(), NON_COMMUTATIVE_P, REGNO, rtx_equal_for_memref_p(), rtx_equal_p(), SUBREG_BYTE, UNARY_P, XEXP, XINT, XSTR, XVECEXP, XVECLEN, and y.
Referenced by memrefs_conflict_p(), and rtx_equal_for_memref_p().
Query the alias-oracle on whether the two memory rtx X and MEM may alias. If TBAA_P is set also apply TBAA. Returns true if the two rtxen may alias, false otherwise.
References ao_ref_from_mem(), MEM_ALIAS_SET, and refs_may_alias_p_1().
Referenced by may_alias_p(), true_dependence_1(), and write_dependence_p().
|
static |
References bitmap_clear_bit(), bitmap_set_bit, reg_known_equiv_p, reg_known_value, and vec_safe_length().
Referenced by init_alias_analysis().
|
static |
True dependence: X is read after store in MEM takes place.
References NULL_RTX, and true_dependence_1().
Referenced by find_mem_conflicts(), load_kills_store(), memref_referenced_p(), mems_conflict_for_gcse_p(), and safe_from_p().
|
static |
Helper for true_dependence and canon_true_dependence. Checks for true dependence: X is read after store in MEM takes place. If MEM_CANONICALIZED is FALSE, then X_ADDR and MEM_ADDR should be NULL_RTX, and the canonical addresses of MEM and X are both computed here. If MEM_CANONICALIZED, then MEM must be already canonicalized. If X_ADDR is non-NULL, it is used in preference of XEXP (x, 0). Returns true if there is a true dependence, false otherwise.
References ALIAS_SET_MEMORY_BARRIER, base_alias_check(), canon_rtx(), CONSTANT_POOL_ADDRESS_P, find_base_term(), gcc_checking_assert, get_addr(), GET_CODE, GET_MODE, GET_MODE_SIZE(), MEM_ADDR_SPACE, MEM_ALIAS_SET, MEM_READONLY_P, MEM_VOLATILE_P, memrefs_conflict_p(), mems_in_disjoint_alias_sets_p(), nonoverlapping_memrefs_p(), NULL_RTX, rtx_refs_may_alias_p(), SIZE_FOR_MODE, and XEXP.
Referenced by canon_true_dependence(), and true_dependence().
|
static |
Create a new, unique base with id ID.
Referenced by init_alias_target(), and record_set().
Return true if accesses based on any other base value cannot alias those based on X.
References GET_CODE, and GET_MODE.
Referenced by base_alias_check().
Equate REG_BASE_VALUE (reg1) to REG_BASE_VALUE (reg2). Special API for var-tracking pass purposes.
References REG_BASE_VALUE, and REGNO.
Referenced by vt_init_cfa_base().
|
static |
Returns true if a write to X might alias a previous read from (or, if WRITEP is true, a write to) MEM. If X_CANONCALIZED is true, then X_ADDR is the canonicalized address of X, and X_MODE the mode for that access. If MEM_CANONICALIZED is true, MEM is canonicalized.
References ALIAS_SET_MEMORY_BARRIER, base_alias_check(), canon_rtx(), CONSTANT_POOL_ADDRESS_P, find_base_term(), gcc_checking_assert, get_addr(), GET_CODE, GET_MODE, GET_MODE_SIZE(), MEM_ADDR_SPACE, MEM_ALIAS_SET, MEM_READONLY_P, MEM_VOLATILE_P, memrefs_conflict_p(), nonoverlapping_memrefs_p(), NULL_RTX, rtx_refs_may_alias_p(), SIZE_FOR_MODE, and XEXP.
Referenced by anti_dependence(), canon_anti_dependence(), canon_output_dependence(), and output_dependence().
|
static |
The splay-tree used to store the various alias set entries.
Referenced by get_alias_set_entry(), and new_alias_set().
struct { ... } alias_stats |
Query statistics for the different low-level disambiguators. A high-level query may trigger multiple of them.
Referenced by alias_sets_conflict_p(), alias_sets_must_conflict_p(), dump_alias_stats_in_alias_c(), and objects_must_conflict_p().
|
static |
The single VOIDmode ADDRESS that represents all argument bases. It has id 0.
Referenced by find_base_value(), and init_alias_target().
|
static |
True when scanning insns from the start of the rtl to the NOTE_INSN_FUNCTION_BEG note.
Referenced by find_base_value(), and init_alias_analysis().
|
static |
Likewise, but used for the fixed portions of the frame, e.g., register save areas.
Referenced by get_frame_alias_set().
|
static |
Set MEMORY_MODIFIED when X modifies DATA (that is assumed to be memory reference.
Referenced by memory_modified_1(), and memory_modified_in_insn_p().
|
static |
Referenced by find_base_value(), init_alias_analysis(), and record_set().
unsigned long long num_alias_zero |
unsigned long long num_dag |
unsigned long long num_disambiguated |
unsigned long long num_same_alias_set |
unsigned long long num_same_objects |
unsigned long long num_universal |
unsigned long long num_volatile |
We preserve the copy of old array around to avoid amount of garbage produced. About 8% of garbage produced were attributed to this array.
Referenced by end_alias_analysis(), and init_alias_analysis().
reg_base_value[N] gives an address to which register N is related. If all sets after the first add or subtract to the current value or otherwise modify it so it does not point to a different top level object, reg_base_value[N] is equal to the address part of the source of the first set. A base address can be an ADDRESS, SYMBOL_REF, or LABEL_REF. ADDRESS expressions represent three types of base: 1. incoming arguments. There is just one ADDRESS to represent all arguments, since we do not know at this level whether accesses based on different arguments can alias. The ADDRESS has id 0. 2. stack_pointer_rtx, frame_pointer_rtx, hard_frame_pointer_rtx (if distinct from frame_pointer_rtx) and arg_pointer_rtx. Each of these rtxes has a separate ADDRESS associated with it, each with a negative id. GCC is (and is required to be) precise in which register it chooses to access a particular region of stack. We can therefore assume that accesses based on one of these rtxes do not alias accesses based on another of these rtxes. 3. bases that are derived from malloc()ed memory (REG_NOALIAS). Each such piece of memory has a separate ADDRESS associated with it, each with an id greater than 0. Accesses based on one ADDRESS do not alias accesses based on other ADDRESSes. Accesses based on ADDRESSes in groups (2) and (3) do not alias globals either; the ADDRESSes have Pmode to indicate this. The ADDRESS in group (1) _may_ alias globals; it has VOIDmode to indicate this.
Referenced by end_alias_analysis(), find_base_value(), get_reg_base_value(), and init_alias_analysis().
|
static |
Vector recording for each reg_known_value whether it is due to a REG_EQUIV note. Future passes (viz., reload) may replace the pseudo with the equivalent expression and so we account for the dependences that would be introduced if that happens. The REG_EQUIV notes created in assign_parms may mention the arg pointer, and there are explicit insns in the RTL that modify the arg pointer. Thus we must ensure that such insns don't get scheduled across each other because that would invalidate the REG_EQUIV notes. One could argue that the REG_EQUIV notes are wrong, but solving the problem in the scheduler will likely give better code, so we do it here.
Referenced by end_alias_analysis(), get_reg_known_equiv_p(), init_alias_analysis(), and set_reg_known_equiv_p().
Vector indexed by N giving the initial (unchanging) value known for pseudo-register N. This vector is initialized in init_alias_analysis, and does not change until end_alias_analysis is called.
Referenced by end_alias_analysis(), get_reg_known_equiv_p(), get_reg_known_value(), init_alias_analysis(), set_reg_known_equiv_p(), and set_reg_known_value().
|
static |
Called from init_alias_analysis indirectly through note_stores, or directly if DEST is a register with a REG_NOALIAS note attached. SET is null in the latter case.
While scanning insns to find base values, reg_seen[N] is nonzero if register N has been set in this function.
Referenced by init_alias_analysis(), and record_set().
|
static |
Used to allocate unique ids to each REG_NOALIAS ADDRESS.
Referenced by init_alias_analysis(), and record_set().
|
static |
Allocate an alias set for use in storing and reading from the varargs spill area.
Referenced by get_varargs_alias_set().