GCC Middle and Back End API Reference
|
#include <pointer-query.h>
Public Member Functions | |
access_ref () | |
gphi * | phi () const |
void | merge_ref (vec< access_ref > *all_refs, tree, gimple *, int, bool, ssa_name_limit_t &, pointer_query &) |
tree | get_ref (vec< access_ref > *, access_ref *=nullptr, int=1, ssa_name_limit_t *=nullptr, pointer_query *=nullptr) const |
bool | offset_zero () const |
bool | offset_bounded () const |
offset_int | size_remaining (offset_int *=nullptr) const |
bool | offset_in_range (const offset_int &) const |
bool | ref_declared () const |
void | set_max_size_range () |
void | add_offset (const offset_int &off) |
void | add_offset (const offset_int &, const offset_int &) |
void | add_max_offset () |
void | inform_access (access_mode, int=1) const |
void | dump (FILE *) const |
Data Fields | |
tree | ref |
offset_int | offrng [2] |
offset_int | sizrng [2] |
offset_int | offmax [2] |
tree(* | eval )(tree) |
int | deref |
bool | ref_nullptr_p |
bool | trail1special |
bool | base0 |
bool | parmarray |
Describes a reference to an object used in an access.
access_ref::access_ref | ( | ) |
Initialize the object.
|
inline |
References add_offset(), ptrdiff_type_node, wi::to_offset(), and TYPE_MAX_VALUE.
Referenced by add_offset(), handle_component_ref(), handle_min_max_size(), and merge_ref().
void access_ref::add_offset | ( | const offset_int & | min, |
const offset_int & | max ) |
Add the range [MIN, MAX] to the offset range. For known objects (with zero-based offsets) at least one of whose offset's bounds is in range, constrain the other (or both) to the bounds of the object (i.e., zero and the upper bound of its size). This improves the quality of diagnostics.
References wi::abs(), add_max_offset(), base0, offmax, offrng, ptrdiff_type_node, size_remaining(), sizrng, wi::to_offset(), and TYPE_MAX_VALUE.
|
inline |
References add_offset().
Referenced by add_max_offset(), add_offset(), and handle_component_ref().
void access_ref::dump | ( | FILE * | file | ) | const |
Dump *THIS to FILE.
References base0, deref, fputc(), gimple_phi_arg_def(), gimple_phi_num_args(), i, max_object_size(), offrng, phi(), print_generic_expr(), ref, sizrng, and wi::to_offset().
Referenced by pointer_query::dump().
tree access_ref::get_ref | ( | vec< access_ref > * | all_refs, |
access_ref * | pref = nullptr, | ||
int | ostype = 1, | ||
ssa_name_limit_t * | psnlim = nullptr, | ||
pointer_query * | qry = nullptr ) const |
Determine and return the largest object to which *THIS refers. If *THIS refers to a PHI and PREF is nonnull, fill *PREF with the details of the object determined by compute_objsize(ARG, OSTYPE) for each PHI argument ARG.
References base0, gcc_assert, gimple_assign_rhs1(), gimple_assign_rhs2(), gimple_assign_rhs_code(), gimple_phi_arg_def(), gimple_phi_num_args(), i, is_gimple_assign(), ssa_name_limit_t::leave_phi(), max_object_size(), merge_ref(), NULL, NULL_TREE, phi(), pref, ref, sizrng, SSA_NAME_DEF_STMT, wi::to_offset(), TREE_CODE, and ssa_name_limit_t::visit_phi().
Referenced by inform_access(), and merge_ref().
void access_ref::inform_access | ( | access_mode | mode, |
int | ostype = 1 ) const |
Issue one inform message describing each target of an access REF. WRITE is set for a write access and clear for a read access.
References access_read_only, access_read_write, access_write_only, base0, compute_objsize(), DECL_P, DECL_SOURCE_LOCATION, EXPR_HAS_LOCATION, EXPR_LOCATION, EXPR_P, wi::fits_shwi_p(), get_identifier_with_length(), get_ref(), gimple_assign_rhs1(), gimple_assign_rhs2(), gimple_assign_rhs_code(), gimple_assign_single_p(), gimple_call_builtin_p(), gimple_call_fn(), gimple_call_fndecl(), gimple_call_lhs(), gimple_location(), gimple_nop_p(), i, IDENTIFIER_POINTER, inform(), inform_access(), is_gimple_assign(), is_gimple_call(), NULL_TREE, offrng, phi(), ptrdiff_type_node, ref, ref_nullptr_p, size_remaining(), sizrng, wi::smax(), SSA_NAME_DEF_STMT, SSA_NAME_IDENTIFIER, SSA_NAME_VAR, TREE_CODE, TREE_OPERAND, tree_to_shwi(), TYPE_MAX_VALUE, TYPE_MIN_VALUE, and UNKNOWN_LOCATION.
Referenced by check_access(), array_bounds_checker::check_mem_ref(), inform_access(), and strlen_pass::maybe_warn_overflow().
void access_ref::merge_ref | ( | vec< access_ref > * | all_refs, |
tree | arg, | ||
gimple * | stmt, | ||
int | ostype, | ||
bool | skip_null, | ||
ssa_name_limit_t & | snlim, | ||
pointer_query & | qry ) |
Determine the size and offset for ARG, append it to ALL_REFS, and merge the result with *THIS. Ignore ARG if SKIP_NULL is set and ARG refers to the null pointer. Return true on success and false on failure.
References add_max_offset(), base0, compute_objsize_r(), deref, get_ref(), integer_zerop(), max_object_size(), offrng, parmarray, pointer_query::put_ref(), set_max_size_range(), sizrng, wi::to_offset(), and TREE_CODE.
Referenced by get_ref().
bool access_ref::offset_bounded | ( | ) | const |
Return true if OFFRNG is bounded to a subrange of offset values valid for the largest possible object.
References offrng, ptrdiff_type_node, wi::to_offset(), TYPE_MAX_VALUE, and TYPE_MIN_VALUE.
bool access_ref::offset_in_range | ( | const offset_int & | size | ) | const |
Return true if the offset and object size are in range for SIZE.
References base0, offmax, ptrdiff_type_node, size_remaining(), sizrng, wi::to_offset(), and TYPE_MAX_VALUE.
Referenced by array_bounds_checker::check_mem_ref().
gphi * access_ref::phi | ( | ) | const |
Return the PHI node REF refers to or null if it doesn't.
References as_a(), NULL, ref, SSA_NAME_DEF_STMT, and TREE_CODE.
Referenced by dump(), get_ref(), inform_access(), and maybe_warn_for_bound().
|
inline |
References max_object_size(), sizrng, and wi::to_offset().
Referenced by handle_min_max_size(), and merge_ref().
offset_int access_ref::size_remaining | ( | offset_int * | pmin = nullptr | ) | const |
Return the maximum amount of space remaining and if non-null, set argument to the minimum.
References base0, gcc_checking_assert, max_object_size(), offrng, sizrng, and wi::to_offset().
Referenced by add_offset(), check_access(), get_maxbound(), handle_component_ref(), inform_access(), maybe_warn_for_bound(), strlen_pass::maybe_warn_overflow(), and offset_in_range().
bool access_ref::base0 |
Referenced by add_offset(), compute_objsize(), dump(), get_ref(), handle_min_max_size(), inform_access(), merge_ref(), offset_in_range(), ref_declared(), and size_remaining().
int access_ref::deref |
Referenced by dump(), merge_ref(), ref_declared(), and warn_dealloc_offset().
offset_int access_ref::offmax[2] |
Referenced by add_offset(), array_bounds_checker::check_mem_ref(), and offset_in_range().
offset_int access_ref::offrng[2] |
bool access_ref::parmarray |
Referenced by check_access(), and merge_ref().
tree access_ref::ref |
Referenced by check_access(), array_bounds_checker::check_mem_ref(), compute_objsize(), dump(), pointer_query::dump(), get_maxbound(), get_ref(), pointer_query::get_ref(), handle_component_ref(), handle_min_max_size(), inform_access(), maybe_warn_for_bound(), phi(), pointer_query::put_ref(), ref_declared(), and warn_dealloc_offset().
bool access_ref::ref_nullptr_p |
Referenced by inform_access().
offset_int access_ref::sizrng[2] |
bool access_ref::trail1special |