FLANG
fir::AliasAnalysis::Source::ScopedOrigin Struct Reference

#include <flang/Optimizer/Analysis/AliasAnalysis.h>

Public Attributes

mlir::Value scope
mlir::Value declValue
 Result SSA value of the [hl]fir.declare op.
AccessPath accessPath
Attributes attributes
bool approximateSource {false}
 Whether the path is approximate at the moment of the snapshot.
bool isData {false}

Detailed Description

A snapshot taken when getSource() walks through an [hl]fir.declare. Records the Fortran procedure scope of the declare (the dummy_scope SSA value – nullptr for non-dummy frames), the declare's result SSA value, and the access path and attributes accumulated FROM THE LEAF UP TO (and including) this declare. alias() uses these snapshots to rebuild intermediate Sources rooted at shared-scope declares via buildSourceAtDeclare().

Relationship to the enclosing Source's top-level fields:

  • Source::accessPath / Source::attributes / Source::approximateSource describe the walk's TERMINAL stop ("root-of-walk to leaf"). They are what every existing alias rule and external consumer reads.
  • The root-closest ScopedOrigin is a snapshot at the last declare crossed before that terminal stop. Because getSource() walks backwards (leaf -> root) and push_back()s each snapshot, this is the LAST element pushed, i.e. scopedOrigins.back() – see the ordering note on the scopedOrigins member below (front = leaf-closest, back = root-closest). Its accessPath is a prefix-truncation of Source::accessPath, and its attributes are a subset of Source::attributes; in the common case where the terminal stop IS a declare (dummy with dummy_scope, host-assoc, OpenMP private), they coincide. We keep both because:
  1. alias(Source, Source, ...) and external consumers (AddAliasTags, print, downstream analyses) read the top-level fields.
  2. When the terminal stop is not a declare (e.g. fir.alloca, fir.address_of with TARGET-attributed global), the top-level captures attributes the root-closest snapshot does not.
  3. When the walk terminates at Unknown without crossing any declare, scopedOrigins is empty and the top-level is the only answer.

Member Data Documentation

◆ accessPath

AccessPath fir::AliasAnalysis::Source::ScopedOrigin::accessPath

Path from the declare (treated as root) to the leaf Value the original getSource() call was started from, in root-to-leaf order.

◆ attributes

Attributes fir::AliasAnalysis::Source::ScopedOrigin::attributes

Attributes accumulated from the leaf up to and including this declare (includes getAttrsFromVariable(declare) and any path-acquired bits such as Pointer from intermediate box loads).

◆ isData

bool fir::AliasAnalysis::Source::ScopedOrigin::isData {false}

Whether the walk was following data (vs. a box reference) at the moment of the snapshot.

◆ scope

mlir::Value fir::AliasAnalysis::Source::ScopedOrigin::scope

The dummy_scope SSA value governing the declare. May be null Value when the declare has no explicit dummy_scope and no fir.dummy_scope op dominates it (e.g. globals at module scope).


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