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;
158 bool isDummyArgument()
const;
160 bool isBoxData()
const;
185 mlir::Type getType()
const;
188 friend llvm::raw_ostream &operator<<(llvm::raw_ostream &os,
192 mlir::AliasResult
alias(Source lhsSrc, Source rhsSrc, mlir::Value lhs,
196 mlir::AliasResult
alias(mlir::Value lhs, mlir::Value rhs);
199 mlir::ModRefResult
getModRef(mlir::Operation *op, mlir::Value location);
205 mlir::ModRefResult
getModRef(mlir::Region ®ion, mlir::Value location);
212 bool getLastInstantiationPoint =
false);
217 static bool isRecordWithPointerComponent(mlir::Type ty);
221 static bool isPointerReference(mlir::Type ty);
228inline bool operator!=(
const AliasAnalysis::Source::SourceOrigin &lhs,
229 const AliasAnalysis::Source::SourceOrigin &rhs) {
230 return !(lhs == rhs);
233inline llvm::raw_ostream &operator<<(llvm::raw_ostream &os,
234 const AliasAnalysis::Source &op) {
Definition: AbstractConverter.h:31
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:107
Attributes attributes
Attributes of the memory source object, e.g. Target.
Definition: AliasAnalysis.h:145
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:51
bool mayBePtrDummyArgOrHostAssoc() const
mayBeDummyArgOrHostAssoc and the address of a pointer?
Definition: AliasAnalysis.cpp:122
bool isTargetOrPointer() const
Return true, if Target or Pointer attribute is set.
Definition: AliasAnalysis.cpp:82
bool mayBeDummyArgOrHostAssoc() const
Definition: AliasAnalysis.cpp:118
bool approximateSource
Definition: AliasAnalysis.h:148
bool mayBeActualArgWithPtr(const mlir::Value *val) const
Definition: AliasAnalysis.cpp:137
mlir::Type valueType
Value type of the source definition.
Definition: AliasAnalysis.h:143
bool mayBeActualArg() const
The address of an actual argument of the current function?
Definition: AliasAnalysis.cpp:133
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:160
ENUM_CLASS(Attribute, Target, Pointer, IntentIn)
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:521
mlir::ModRefResult getModRef(mlir::Operation *op, mlir::Value location)
Return the modify-reference behavior of op on location.