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/SymbolTable.h"
16#include "mlir/IR/Value.h"
17#include "llvm/ADT/DenseMap.h"
18#include "llvm/ADT/PointerUnion.h"
50 ENUM_CLASS(Attribute, Target, Pointer, IntentIn, CrayPointer, CrayPointee);
118 using SourceUnion = llvm::PointerUnion<mlir::SymbolRefAttr, mlir::Value>;
155 void print(llvm::raw_ostream &os)
const;
175 bool isDummyArgument()
const;
177 bool isBoxData()
const;
202 mlir::Type getType()
const;
205 friend llvm::raw_ostream &operator<<(llvm::raw_ostream &os,
209 mlir::AliasResult
alias(Source lhsSrc, Source rhsSrc, mlir::Value lhs,
213 mlir::AliasResult
alias(mlir::Value lhs, mlir::Value rhs);
216 mlir::ModRefResult
getModRef(mlir::Operation *op, mlir::Value location);
222 mlir::ModRefResult
getModRef(mlir::Region ®ion, mlir::Value location);
229 bool getLastInstantiationPoint =
false);
238 static bool isRecordWithPointerComponent(mlir::Type ty);
243 const mlir::SymbolTable *getNearestSymbolTable(mlir::Operation *from);
248 bool symbolMayHaveTargetAttr(mlir::SymbolRefAttr symbol,
249 mlir::Operation *from);
264 llvm::DenseMap<mlir::Operation *, mlir::SymbolTable> symTabMap;
271inline bool operator!=(
const AliasAnalysis::Source::SourceOrigin &lhs,
272 const AliasAnalysis::Source::SourceOrigin &rhs) {
273 return !(lhs == rhs);
276inline llvm::raw_ostream &operator<<(llvm::raw_ostream &os,
Definition AbstractConverter.h:37
Definition AliasAnalysis.h:121
mlir::Operation * instantiationPoint
Definition AliasAnalysis.h:134
SourceUnion u
Source definition of a value.
Definition AliasAnalysis.h:123
bool isData
Whether the source was reached following data or box reference.
Definition AliasAnalysis.h:137
Definition AliasAnalysis.h:117
bool isCrayPointer() const
Return true, if CrayPointer attribute is set.
Definition AliasAnalysis.cpp:165
bool isCapturedInInternalProcedure
Source object is used in an internal procedure via host association.
Definition AliasAnalysis.h:152
bool isFortranUserVariable() const
Is this source a variable from the Fortran source?
Definition AliasAnalysis.cpp:186
Attributes attributes
Attributes of the memory source object, e.g. Target.
Definition AliasAnalysis.h:147
bool isPointer() const
Return true, if Pointer attribute is set.
Definition AliasAnalysis.cpp:157
SourceKind kind
Kind of the memory source.
Definition AliasAnalysis.h:143
bool isCrayPointee() const
Return true, if CrayPointee attribute is set.
Definition AliasAnalysis.cpp:161
void print(llvm::raw_ostream &os) const
Print information about the memory source to os.
Definition AliasAnalysis.cpp:117
bool mayBePtrDummyArgOrHostAssoc() const
mayBeDummyArgOrHostAssoc and the address of a pointer?
Definition AliasAnalysis.cpp:201
bool isTargetOrPointer() const
Return true, if Target or Pointer attribute is set.
Definition AliasAnalysis.cpp:148
bool mayBeDummyArgOrHostAssoc() const
Definition AliasAnalysis.cpp:197
bool approximateSource
Definition AliasAnalysis.h:150
bool mayBeActualArgWithPtr(const mlir::Value *val) const
Definition AliasAnalysis.cpp:216
mlir::Type valueType
Value type of the source definition.
Definition AliasAnalysis.h:145
bool isCrayPointerOrPointee() const
Return true, if CrayPointer or CrayPointee attribute is set.
Definition AliasAnalysis.cpp:169
bool isTarget() const
Return true, if Target attribute is set.
Definition AliasAnalysis.cpp:153
bool mayBeActualArg() const
The address of an actual argument of the current function?
Definition AliasAnalysis.cpp:212
Definition AliasAnalysis.h:25
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:239
static bool isPointerReference(mlir::Type ty)
Definition AliasAnalysis.cpp:140
ENUM_CLASS(Attribute, Target, Pointer, IntentIn, CrayPointer, CrayPointee)
Attributes of the memory source object.
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:603
mlir::ModRefResult getModRef(mlir::Operation *op, mlir::Value location)
Return the modify-reference behavior of op on location.