GCC Middle and Back End API Reference
access_ref Struct Reference

#include <pointer-query.h>

Public Member Functions

 access_ref ()
gphiphi () 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

Detailed Description

Describes a reference to an object used in an access.   

Constructor & Destructor Documentation

◆ access_ref()

access_ref::access_ref ( )
Initialize the object.   

Member Function Documentation

◆ add_max_offset()

void access_ref::add_max_offset ( )

◆ add_offset() [1/2]

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

References wi::abs(), add_max_offset(), base0, offmax, offrng, ptrdiff_type_node, size_remaining(), sizrng, wi::to_offset(), and TYPE_MAX_VALUE.

◆ add_offset() [2/2]

void access_ref::add_offset ( const offset_int & off)

◆ dump()

void access_ref::dump ( FILE * file) const

◆ get_ref()

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

◆ inform_access()

◆ merge_ref()

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

◆ offset_bounded()

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.

◆ offset_in_range()

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

◆ offset_zero()

bool access_ref::offset_zero ( ) const

References offrng.

◆ phi()

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

◆ ref_declared()

bool access_ref::ref_declared ( ) const

References base0, DECL_P, deref, and ref.

◆ set_max_size_range()

void access_ref::set_max_size_range ( )

◆ size_remaining()

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

Field Documentation

◆ base0

◆ deref

int access_ref::deref

◆ eval

tree(* access_ref::eval) (tree)

◆ offmax

offset_int access_ref::offmax[2]

◆ offrng

◆ parmarray

bool access_ref::parmarray

Referenced by check_access(), and merge_ref().

◆ ref

◆ ref_nullptr_p

bool access_ref::ref_nullptr_p

Referenced by inform_access().

◆ sizrng

◆ trail1special

bool access_ref::trail1special

The documentation for this struct was generated from the following files: