FLANG
fir::AliasAnalysis Struct Reference

Classes

struct  Source

Public Member Functions

 ENUM_CLASS (SourceKind, Allocate, Global, Argument, HostAssoc, Indirect, Unknown)
 Kind of the memory source referenced by a value.
 ENUM_CLASS (Attribute, Target, Pointer, IntentIn, CrayPointer, CrayPointee)
 Attributes of the memory source object.
mlir::AliasResult alias (Source lhsSrc, Source rhsSrc, mlir::Value lhs, mlir::Value rhs)
 Given the values and their sources, return their aliasing behavior.
mlir::AliasResult alias (mlir::Value lhs, mlir::Value rhs)
 Given two values, return their aliasing behavior.
mlir::ModRefResult getModRef (mlir::Operation *op, mlir::Value location)
 Return the modify-reference behavior of op on location.
mlir::ModRefResult getModRef (mlir::Region &region, mlir::Value location)
fir::AliasAnalysis::Source getSource (mlir::Value, bool getLastInstantiationPoint=false, bool collectScopedOrigins=true)
void enableSourceCache ()
void disableSourceCache ()
 Disable getSource() memoization and drop any cached entries.
std::size_t getSourceCacheSizeForTesting () const
 Testing only: number of entries currently held in the getSource() cache.
std::size_t getSourceCacheHitsForTesting () const
 Testing only: cumulative getSource() cache hits / misses on this instance.
std::size_t getSourceCacheMissesForTesting () const
bool functionHasMultipleScopes (mlir::Value v)

Static Public Member Functions

static bool isPointerReference (mlir::Type ty)

Friends

llvm::raw_ostream & operator<< (llvm::raw_ostream &os, const AliasAnalysis::Source &op)

Member Function Documentation

◆ enableSourceCache()

void fir::AliasAnalysis::enableSourceCache ( )

Enable memoization of getSource() results on this analysis instance. Caching is opt-in and off by default; a client that does not mutate the IR in a way that affects getSource() (see getSource()) may enable it to avoid recomputing sources for repeated queries.

◆ functionHasMultipleScopes()

bool fir::AliasAnalysis::functionHasMultipleScopes ( mlir::Value v)

Return true if the function containing v has more than one fir.dummy_scope op (e.g. the function body has been inlined into). Scope-aware disambiguation in alias(lhs, rhs) is only meaningful in that case; skipping it for functions with just one scope avoids the getDeclarationScope/DominanceInfo overhead in getSource. Both true and false results are cached in multiScopeCache so the function walk is paid at most once per funcOp per AliasAnalysis instance.

◆ getModRef()

ModRefResult fir::AliasAnalysis::getModRef ( mlir::Region & region,
mlir::Value location )

Return the modify-reference behavior of operations inside region on location. Contrary to getModRef(operation, location), this will visit nested regions recursively according to the HasRecursiveMemoryEffects trait.

◆ getSource()

AliasAnalysis::Source fir::AliasAnalysis::getSource ( mlir::Value v,
bool getLastInstantiationPoint = false,
bool collectScopedOrigins = true )

Return the memory source of a value. If getLastInstantiationPoint is true, the search for the source will stop at [hl]fir.declare if it represents a dummy argument declaration (i.e. it has the dummy_scope operand). If collectScopedOrigins is false, the per-declare ScopedOrigin snapshots are not collected, and getSource performs only the SourceKind/origin classification without that bookkeeping side effect.

When source caching is enabled (see enableSourceCache()), the result is memoized keyed on (value, flags), and recursive sub-queries share the same cache. The cache is a frozen snapshot with no automatic invalidation: it is only valid while the IR reachable from the queried values is not mutated in a way that would change the source. It lives no longer than this AliasAnalysis instance, so a client enables caching only for a region in which it does not perform such mutations (e.g. a pass that only moves operations).

◆ isPointerReference()

bool fir::AliasAnalysis::isPointerReference ( mlir::Type ty)
static

Return true, if ty is a reference type to a boxed POINTER object or a raw fir::PointerType.


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