MLIR: include/mlir/Analysis/AliasAnalysis.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14 #ifndef MLIR_ANALYSIS_ALIASANALYSIS_H_
15 #define MLIR_ANALYSIS_ALIASANALYSIS_H_
16
18
19 namespace mlir {
20
21
22
23
24
25
27 public:
29
30
31
32
33
35
36
38
40
42 };
43
47
48
49 explicit operator bool() const { return kind != NoAlias; }
50
51
52
53
54
55
57
58
60
61
63
64
66
67
69
70
71 void print(raw_ostream &os) const;
72
73 private:
74
76 };
77
80 return os;
81 }
82
83
84
85
86
87
88
89
91
92
93
94 enum class Kind {
95
96 NoModRef = 0,
97
98 Ref = 1,
99
101
102 ModRef = Ref | Mod,
103 };
104
105 public:
108
109
110
112
113
114
116
117
118
120
121
122
124
125
126 [[nodiscard]] bool isNoModRef() const { return kind == Kind::NoModRef; }
127
128
129 [[nodiscard]] bool isMod() const {
130 return static_cast<int>(kind) & static_cast<int>(Kind::Mod);
131 }
132
133
134 [[nodiscard]] bool isRef() const {
135 return static_cast<int>(kind) & static_cast<int>(Kind::Ref);
136 }
137
138
139 [[nodiscard]] bool isModOrRef() const { return kind != Kind::NoModRef; }
140
141
142 [[nodiscard]] bool isModAndRef() const { return kind == Kind::ModRef; }
143
144
146 return ModRefResult(static_cast<Kind>(static_cast<int>(kind) |
147 static_cast<int>(other.kind)));
148 }
149
151 return ModRefResult(static_cast<Kind>(static_cast<int>(kind) &
152 static_cast<int>(other.kind)));
153 }
154
155
156 void print(raw_ostream &os) const;
157
158 private:
160
161
163 };
164
166 result.print(os);
167 return os;
168 }
169
170
171
172
173
174 namespace detail {
175
176
178
179
180
182 public:
184
185
187
188
190 };
191
192
193
194
195
196 template
198 public:
201
202
204 return impl.alias(lhs, rhs);
205 }
206
207
209 return impl.getModRef(op, location);
210 }
211
212 private:
214 };
215 };
216 }
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
234 template
236
237 public:
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257 template
259 aliasImpls.push_back(
260 std::make_unique<Model>(std::forward(analysis)));
261 }
262
263
264
265
266
267
269
270
271
272
273
274
276
277 private:
278
280 };
281
282 }
283
284 #endif
union mlir::linalg::@1203::ArityGroupAndKind::Kind kind
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.