14 #ifndef MLIR_ANALYSIS_ALIASANALYSIS_H_
15 #define MLIR_ANALYSIS_ALIASANALYSIS_H_
49 explicit operator bool()
const {
return kind !=
NoAlias; }
71 void print(raw_ostream &os)
const;
126 [[nodiscard]]
bool isNoModRef()
const {
return kind == Kind::NoModRef; }
130 return static_cast<int>(kind) &
static_cast<int>(Kind::Mod);
135 return static_cast<int>(kind) &
static_cast<int>(Kind::Ref);
139 [[nodiscard]]
bool isModOrRef()
const {
return kind != Kind::NoModRef; }
142 [[nodiscard]]
bool isModAndRef()
const {
return kind == Kind::ModRef; }
146 return ModRefResult(
static_cast<Kind
>(
static_cast<int>(kind) |
147 static_cast<int>(other.kind)));
151 return ModRefResult(
static_cast<Kind
>(
static_cast<int>(kind) &
152 static_cast<int>(other.kind)));
156 void print(raw_ostream &os)
const;
196 template <
typename ImplT>
204 return impl.alias(lhs, rhs);
209 return impl.getModRef(op, location);
234 template <
typename ImplT>
257 template <
typename AnalysisT>
259 aliasImpls.push_back(
static void print(spirv::VerCapExtAttr triple, DialectAsmPrinter &printer)
This class represents the main alias analysis interface in MLIR.
AliasAnalysis(Operation *op)
ModRefResult getModRef(Operation *op, Value location)
Return the modify-reference behavior of op on location.
AliasResult alias(Value lhs, Value rhs)
Given two values, return their aliasing behavior.
void addAnalysisImplementation(AnalysisT &&analysis)
Add a new alias analysis implementation AnalysisT to this analysis aggregate.
The possible results of an alias query.
bool isPartial() const
Returns if this result is a partial alias.
bool operator==(const AliasResult &other) const
bool isMay() const
Returns if this result is a may alias.
AliasResult merge(AliasResult other) const
Merge this alias result with other and return a new result that represents the conservative merge of ...
bool operator!=(const AliasResult &other) const
void print(raw_ostream &os) const
Print this alias result to the provided output stream.
bool isMust() const
Returns if this result is a must alias.
bool isNo() const
Returns if this result indicates no possibility of aliasing.
@ MustAlias
The two locations precisely alias each other.
@ MayAlias
The two locations may or may not alias.
@ NoAlias
The two locations do not alias at all.
@ PartialAlias
The two locations alias, but only due to a partial overlap.
The possible results of whether a memory access modifies or references a memory location.
bool isModAndRef() const
Returns if this result modifies and references memory.
ModRefResult intersect(const ModRefResult &other)
Intersect this ModRef result with other and return the result.
ModRefResult merge(const ModRefResult &other)
Merge this ModRef result with other and return the result.
static ModRefResult getRef()
Return a new result that indicates that the memory access may reference the value stored in memory.
static ModRefResult getNoModRef()
Return a new result that indicates that the memory access neither references nor modifies the value s...
bool isMod() const
Returns if this result modifies memory.
bool operator==(const ModRefResult &rhs) const
bool isNoModRef() const
Returns if this result does not modify or reference memory.
static ModRefResult getModAndRef()
Return a new result that indicates that the memory access may reference and may modify the value stor...
void print(raw_ostream &os) const
Print this ModRef result to the provided output stream.
bool operator!=(const ModRefResult &rhs) const
static ModRefResult getMod()
Return a new result that indicates that the memory access may modify the value stored in memory.
bool isRef() const
Returns if this result references memory.
bool isModOrRef() const
Returns if this result modifies or references memory.
Operation is the basic unit of execution within MLIR.
This class represents an instance of an SSA value in the MLIR system, representing a computable value...
This class represents the Concept of an alias analysis implementation.
virtual ModRefResult getModRef(Operation *op, Value location)=0
Return the modify-reference behavior of op on location.
virtual AliasResult alias(Value lhs, Value rhs)=0
Given two values, return their aliasing behavior.
virtual ~Concept()=default
This class represents the Model of an alias analysis implementation ImplT.
AliasResult alias(Value lhs, Value rhs) final
Given two values, return their aliasing behavior.
~Model() override=default
ModRefResult getModRef(Operation *op, Value location) final
Return the modify-reference behavior of op on location.
Kind
An enumeration of the kinds of predicates.
Include the generated interface declarations.
@ Mod
RHS of mod is always a constant or a symbolic expression with a positive value.
raw_ostream & operator<<(raw_ostream &os, const AliasResult &result)
This class contains various internal trait classes used by the main AliasAnalysis class below.