9#ifndef FORTRAN_OPTIMIZER_ANALYSIS_ALIASANALYSIS_H
10#define FORTRAN_OPTIMIZER_ANALYSIS_ALIASANALYSIS_H
12#include "flang/Common/enum-class.h"
13#include "flang/Common/enum-set.h"
14#include "mlir/Analysis/AliasAnalysis.h"
15#include "mlir/IR/Value.h"
16#include "llvm/ADT/PointerUnion.h"
116 using SourceUnion = llvm::PointerUnion<mlir::SymbolRefAttr, mlir::Value>;
153 void print(llvm::raw_ostream &os)
const;
164 bool isDummyArgument()
const;
166 bool isBoxData()
const;
191 mlir::Type getType()
const;
194 friend llvm::raw_ostream &operator<<(llvm::raw_ostream &os,
198 mlir::AliasResult
alias(Source lhsSrc, Source rhsSrc, mlir::Value lhs,
202 mlir::AliasResult
alias(mlir::Value lhs, mlir::Value rhs);
205 mlir::ModRefResult
getModRef(mlir::Operation *op, mlir::Value location);
211 mlir::ModRefResult
getModRef(mlir::Region ®ion, mlir::Value location);
218 bool getLastInstantiationPoint =
false);
227 static bool isRecordWithPointerComponent(mlir::Type ty);
234inline bool operator!=(
const AliasAnalysis::Source::SourceOrigin &lhs,
235 const AliasAnalysis::Source::SourceOrigin &rhs) {
236 return !(lhs == rhs);
239inline llvm::raw_ostream &operator<<(llvm::raw_ostream &os,
240 const AliasAnalysis::Source &op) {
Definition: AbstractConverter.h:34
Definition: AliasAnalysis.h:119
mlir::Operation * instantiationPoint
Definition: AliasAnalysis.h:132
SourceUnion u
Source definition of a value.
Definition: AliasAnalysis.h:121
bool isData
Whether the source was reached following data or box reference.
Definition: AliasAnalysis.h:135
Definition: AliasAnalysis.h:115
bool isCapturedInInternalProcedure
Source object is used in an internal procedure via host association.
Definition: AliasAnalysis.h:150
bool isFortranUserVariable() const
Is this source a variable from the Fortran source?
Definition: AliasAnalysis.cpp:134
Attributes attributes
Attributes of the memory source object, e.g. Target.
Definition: AliasAnalysis.h:145
bool isPointer() const
Return true, if Pointer attribute is set.
Definition: AliasAnalysis.cpp:117
SourceKind kind
Kind of the memory source.
Definition: AliasAnalysis.h:141
void print(llvm::raw_ostream &os) const
Print information about the memory source to os.
Definition: AliasAnalysis.cpp:77
bool mayBePtrDummyArgOrHostAssoc() const
mayBeDummyArgOrHostAssoc and the address of a pointer?
Definition: AliasAnalysis.cpp:149
bool isTargetOrPointer() const
Return true, if Target or Pointer attribute is set.
Definition: AliasAnalysis.cpp:108
bool mayBeDummyArgOrHostAssoc() const
Definition: AliasAnalysis.cpp:145
bool approximateSource
Definition: AliasAnalysis.h:148
bool mayBeActualArgWithPtr(const mlir::Value *val) const
Definition: AliasAnalysis.cpp:164
mlir::Type valueType
Value type of the source definition.
Definition: AliasAnalysis.h:143
bool isTarget() const
Return true, if Target attribute is set.
Definition: AliasAnalysis.cpp:113
bool mayBeActualArg() const
The address of an actual argument of the current function?
Definition: AliasAnalysis.cpp:160
Definition: AliasAnalysis.h:23
mlir::AliasResult alias(Source lhsSrc, Source rhsSrc, mlir::Value lhs, mlir::Value rhs)
Given the values and their sources, return their aliasing behavior.
Definition: AliasAnalysis.cpp:187
ENUM_CLASS(Attribute, Target, Pointer, IntentIn)
Attributes of the memory source object.
static bool isPointerReference(mlir::Type ty)
Definition: AliasAnalysis.cpp:100
ENUM_CLASS(SourceKind, Allocate, Global, Argument, HostAssoc, Indirect, Unknown)
Kind of the memory source referenced by a value.
fir::AliasAnalysis::Source getSource(mlir::Value, bool getLastInstantiationPoint=false)
Definition: AliasAnalysis.cpp:521
mlir::ModRefResult getModRef(mlir::Operation *op, mlir::Value location)
Return the modify-reference behavior of op on location.