GCC Middle and Back End API Reference
modref_access_node Struct Reference

#include <ipa-modref-tree.h>

Collaboration diagram for modref_access_node:

Public Member Functions

bool useful_p () const
bool useful_for_kill_p () const
void dump (FILE *out)
bool operator== (modref_access_node &a) const
bool range_info_useful_p () const
tree get_call_arg (const gcall *stmt) const
bool get_ao_ref (const gcall *stmt, class ao_ref *ref) const
void stream_out (struct output_block *ob) const

Static Public Member Functions

static modref_access_node stream_in (struct lto_input_block *ib)
static int insert (vec< modref_access_node, va_gc > *&accesses, modref_access_node a, size_t max_accesses, bool record_adjustments)
static bool insert_kill (vec< modref_access_node > &kills, modref_access_node &a, bool record_adjustments)

Data Fields

poly_int64 offset
poly_int64 size
poly_int64 max_size
poly_int64 parm_offset
int parm_index
bool parm_offset_known
unsigned char adjustments

Private Member Functions

bool contains (const modref_access_node &) const
bool contains_for_kills (const modref_access_node &) const
void update (poly_int64, poly_int64, poly_int64, poly_int64, bool)
bool update_for_kills (poly_int64, poly_int64, poly_int64, poly_int64, poly_int64, bool)
bool merge (const modref_access_node &, bool)
bool merge_for_kills (const modref_access_node &, bool)
void forced_merge (const modref_access_node &, bool)
void update2 (poly_int64, poly_int64, poly_int64, poly_int64, poly_int64, poly_int64, poly_int64, bool)
bool combined_offsets (const modref_access_node &, poly_int64 *, poly_int64 *, poly_int64 *) const

Static Private Member Functions

static bool closer_pair_p (const modref_access_node &, const modref_access_node &, const modref_access_node &, const modref_access_node &)
static void try_merge_with (vec< modref_access_node, va_gc > *&, size_t)

Detailed Description

Modref record accesses relative to function parameters. This is entry for single access specifying its base and access range. Accesses can be collected to boundedly sized arrays using modref_access_node::insert.

Member Function Documentation

◆ closer_pair_p()

bool modref_access_node::closer_pair_p ( const modref_access_node & a1,
const modref_access_node & b1,
const modref_access_node & a2,
const modref_access_node & b2 )
staticprivate
Return true if A1 and B1 can be merged with lower information less than A2 and B2. Assume that no containment or lossless merging is possible.

References combined_offsets(), gcc_checking_assert, gcc_unreachable, known_ge, known_le, known_lt, max_size, parm_index, and parm_offset_known.

Referenced by insert().

◆ combined_offsets()

bool modref_access_node::combined_offsets ( const modref_access_node & a,
poly_int64 * new_parm_offset,
poly_int64 * new_offset,
poly_int64 * new_aoffset ) const
private
Given access nodes THIS and A, return true if they can be done with common parm_offsets. In this case return parm offset in new_parm_offset, new_offset which is start of range in THIS and new_aoffset that is start of range in A.

References a, gcc_checking_assert, known_le, offset, parm_offset, and parm_offset_known.

Referenced by closer_pair_p(), forced_merge(), merge(), and merge_for_kills().

◆ contains()

bool modref_access_node::contains ( const modref_access_node & a) const
private
Return true A is a subaccess.

References a, known_le, max_size, MODREF_UNKNOWN_PARM, offset, parm_index, parm_offset, parm_offset_known, range_info_useful_p(), and size.

Referenced by forced_merge(), insert(), and merge().

◆ contains_for_kills()

bool modref_access_node::contains_for_kills ( const modref_access_node & a) const
private

◆ dump()

◆ forced_merge()

void modref_access_node::forced_merge ( const modref_access_node & a,
bool record_adjustments )
private

◆ get_ao_ref()

bool modref_access_node::get_ao_ref ( const gcall * stmt,
class ao_ref * ref ) const
Return tree corresponding to parameter of the range in STMT.

References ao_ref_init_from_ptr_and_range(), get_call_arg(), max_size, offset, parm_offset, parm_offset_known, POINTER_TYPE_P, size, poly_int< N, C >::to_shwi(), and TREE_TYPE.

◆ get_call_arg()

tree modref_access_node::get_call_arg ( const gcall * stmt) const

◆ insert()

int modref_access_node::insert ( vec< modref_access_node, va_gc > *& accesses,
modref_access_node a,
size_t max_accesses,
bool record_adjustments )
static
Insert access with OFFSET and SIZE. Collapse tree if it has more than MAX_ACCESSES entries. If RECORD_ADJUSTMENTs is true avoid too many interval extensions. Return true if record was changed. Return 0 if nothing changed, 1 if insert was successful and -1 if entries should be collapsed.

References a, closer_pair_p(), contains(), dump_file, FOR_EACH_VEC_SAFE_ELT, gcc_assert, gcc_checking_assert, i, i2, insert(), merge(), parm_index, parm_offset_known, try_merge_with(), update(), useful_p(), and vec_safe_push().

Referenced by modref_ref_node< T >::insert_access().

◆ insert_kill()

bool modref_access_node::insert_kill ( vec< modref_access_node > & kills,
modref_access_node & a,
bool record_adjustments )
static
Insert new kill A into KILLS. If RECORD_ADJUSTMENTS is true limit number of changes to each entry. Return true if something changed.

References a, contains_for_kills(), dump_file, FOR_EACH_VEC_ELT, gcc_checking_assert, i, merge(), and merge_for_kills().

◆ merge()

bool modref_access_node::merge ( const modref_access_node & a,
bool record_adjustments )
private
Merge in access A if it is possible to do without losing precision. Return true if successful. If RECORD_ADJUSTMENTs is true, remember how many interval was prolonged and punt when there are too many.

References a, combined_offsets(), contains(), gcc_checking_assert, known_eq, known_ge, known_le, known_lt, max_size, MODREF_UNKNOWN_PARM, parm_index, parm_offset_known, range_info_useful_p(), size, update(), and update2().

Referenced by forced_merge(), insert(), and insert_kill().

◆ merge_for_kills()

bool modref_access_node::merge_for_kills ( const modref_access_node & a,
bool record_adjustments )
private
Merge in access A if it is possible to do without losing precision. Return true if successful. Unlike merge assume that both accesses are always executed and merge size the same was as max_size.

References a, combined_offsets(), contains_for_kills(), gcc_checking_assert, known_ge, known_le, max_size, parm_index, update_for_kills(), and useful_for_kill_p().

Referenced by insert_kill().

◆ operator==()

bool modref_access_node::operator== ( modref_access_node & a) const
Data structure for the modref pass. Copyright (C) 2020-2025 Free Software Foundation, Inc. Contributed by David Cepelik and Jan Hubicka This file is part of GCC. GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see <http://www.gnu.org/licenses/>.
Return true if both accesses are the same.

References a, known_eq, max_size, MODREF_GLOBAL_MEMORY_PARM, MODREF_UNKNOWN_PARM, offset, parm_index, parm_offset, parm_offset_known, range_info_useful_p(), and size.

◆ range_info_useful_p()

bool modref_access_node::range_info_useful_p ( ) const

◆ stream_in()

◆ stream_out()

void modref_access_node::stream_out ( struct output_block * ob) const

◆ try_merge_with()

void modref_access_node::try_merge_with ( vec< modref_access_node, va_gc > *& accesses,
size_t index )
staticprivate
Try to optimize the access ACCESSES list after entry INDEX was modified.

References a, gcc_checking_assert, and i.

Referenced by insert().

◆ update()

void modref_access_node::update ( poly_int64 parm_offset1,
poly_int64 offset1,
poly_int64 size1,
poly_int64 max_size1,
bool record_adjustments )
private
Update access range to new parameters. If RECORD_ADJUSTMENTS is true, record number of changes in the access and if threshold is exceeded start dropping precision so only constantly many updates are possible. This makes dataflow to converge.

References adjustments, dump_file, known_eq, max_size, offset, parm_offset, parm_offset_known, and size.

Referenced by insert(), merge(), and update2().

◆ update2()

void modref_access_node::update2 ( poly_int64 parm_offset1,
poly_int64 offset1,
poly_int64 size1,
poly_int64 max_size1,
poly_int64 offset2,
poly_int64 size2,
poly_int64 max_size2,
bool record_adjustments )
private
Merge two ranges both starting at parm_offset1 and update THIS with result.

References gcc_checking_assert, gcc_unreachable, known_le, and update().

Referenced by forced_merge(), and merge().

◆ update_for_kills()

bool modref_access_node::update_for_kills ( poly_int64 parm_offset1,
poly_int64 offset1,
poly_int64 max_size1,
poly_int64 offset2,
poly_int64 max_size2,
bool record_adjustments )
private
Merge two ranges both starting at parm_offset1 and update THIS with result.

References adjustments, gcc_checking_assert, gcc_unreachable, known_eq, known_le, max_size, offset, parm_offset, size, and useful_for_kill_p().

Referenced by merge_for_kills().

◆ useful_for_kill_p()

bool modref_access_node::useful_for_kill_p ( ) const
inline

◆ useful_p()

bool modref_access_node::useful_p ( ) const
inline

References MODREF_UNKNOWN_PARM, and parm_index.

Referenced by insert().

Field Documentation

◆ adjustments

unsigned char modref_access_node::adjustments

◆ max_size

◆ offset

◆ parm_index

◆ parm_offset

◆ parm_offset_known

◆ size


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