/home/arjun/llvm-project/mlir/include/mlir/IR/Operation.h
Line | Count | Source (jump to first uncovered line) |
1 | | //===- Operation.h - MLIR Operation Class -----------------------*- C++ -*-===// |
2 | | // |
3 | | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
4 | | // See https://llvm.org/LICENSE.txt for license information. |
5 | | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
6 | | // |
7 | | //===----------------------------------------------------------------------===// |
8 | | // |
9 | | // This file defines the Operation class. |
10 | | // |
11 | | //===----------------------------------------------------------------------===// |
12 | | |
13 | | #ifndef MLIR_IR_OPERATION_H |
14 | | #define MLIR_IR_OPERATION_H |
15 | | |
16 | | #include "mlir/IR/Block.h" |
17 | | #include "mlir/IR/Diagnostics.h" |
18 | | #include "mlir/IR/OperationSupport.h" |
19 | | #include "mlir/IR/Region.h" |
20 | | #include "llvm/ADT/Twine.h" |
21 | | |
22 | | namespace mlir { |
23 | | /// Operation is a basic unit of execution within a function. Operations can |
24 | | /// be nested within other operations effectively forming a tree. Child |
25 | | /// operations are organized into operation blocks represented by a 'Block' |
26 | | /// class. |
27 | | class Operation final |
28 | | : public llvm::ilist_node_with_parent<Operation, Block>, |
29 | | private llvm::TrailingObjects<Operation, detail::InLineOpResult, |
30 | | detail::TrailingOpResult, BlockOperand, |
31 | | Region, detail::OperandStorage> { |
32 | | public: |
33 | | /// Create a new Operation with the specific fields. |
34 | | static Operation *create(Location location, OperationName name, |
35 | | ArrayRef<Type> resultTypes, ArrayRef<Value> operands, |
36 | | ArrayRef<NamedAttribute> attributes, |
37 | | ArrayRef<Block *> successors, unsigned numRegions); |
38 | | |
39 | | /// Overload of create that takes an existing MutableDictionaryAttr to avoid |
40 | | /// unnecessarily uniquing a list of attributes. |
41 | | static Operation *create(Location location, OperationName name, |
42 | | ArrayRef<Type> resultTypes, ArrayRef<Value> operands, |
43 | | MutableDictionaryAttr attributes, |
44 | | ArrayRef<Block *> successors, unsigned numRegions); |
45 | | |
46 | | /// Create a new Operation from the fields stored in `state`. |
47 | | static Operation *create(const OperationState &state); |
48 | | |
49 | | /// Create a new Operation with the specific fields. |
50 | | static Operation *create(Location location, OperationName name, |
51 | | ArrayRef<Type> resultTypes, ArrayRef<Value> operands, |
52 | | MutableDictionaryAttr attributes, |
53 | | ArrayRef<Block *> successors = {}, |
54 | | RegionRange regions = {}); |
55 | | |
56 | | /// The name of an operation is the key identifier for it. |
57 | 0 | OperationName getName() { return name; } |
58 | | |
59 | | /// If this operation has a registered operation description, return it. |
60 | | /// Otherwise return null. |
61 | 0 | const AbstractOperation *getAbstractOperation() { |
62 | 0 | return getName().getAbstractOperation(); |
63 | 0 | } |
64 | | |
65 | | /// Returns true if this operation has a registered operation description, |
66 | | /// otherwise false. |
67 | 0 | bool isRegistered() { return getAbstractOperation(); } |
68 | | |
69 | | /// Remove this operation from its parent block and delete it. |
70 | | void erase(); |
71 | | |
72 | | /// Create a deep copy of this operation, remapping any operands that use |
73 | | /// values outside of the operation using the map that is provided (leaving |
74 | | /// them alone if no entry is present). Replaces references to cloned |
75 | | /// sub-operations to the corresponding operation that is copied, and adds |
76 | | /// those mappings to the map. |
77 | | Operation *clone(BlockAndValueMapping &mapper); |
78 | | Operation *clone(); |
79 | | |
80 | | /// Create a partial copy of this operation without traversing into attached |
81 | | /// regions. The new operation will have the same number of regions as the |
82 | | /// original one, but they will be left empty. |
83 | | /// Operands are remapped using `mapper` (if present), and `mapper` is updated |
84 | | /// to contain the results. |
85 | | Operation *cloneWithoutRegions(BlockAndValueMapping &mapper); |
86 | | |
87 | | /// Create a partial copy of this operation without traversing into attached |
88 | | /// regions. The new operation will have the same number of regions as the |
89 | | /// original one, but they will be left empty. |
90 | | Operation *cloneWithoutRegions(); |
91 | | |
92 | | /// Returns the operation block that contains this operation. |
93 | 0 | Block *getBlock() { return block; } |
94 | | |
95 | | /// Return the context this operation is associated with. |
96 | | MLIRContext *getContext(); |
97 | | |
98 | | /// Return the dialect this operation is associated with, or nullptr if the |
99 | | /// associated dialect is not registered. |
100 | | Dialect *getDialect(); |
101 | | |
102 | | /// The source location the operation was defined or derived from. |
103 | 0 | Location getLoc() { return location; } |
104 | | |
105 | | /// Set the source location the operation was defined or derived from. |
106 | 0 | void setLoc(Location loc) { location = loc; } |
107 | | |
108 | | /// Returns the region to which the instruction belongs. Returns nullptr if |
109 | | /// the instruction is unlinked. |
110 | | Region *getParentRegion(); |
111 | | |
112 | | /// Returns the closest surrounding operation that contains this operation |
113 | | /// or nullptr if this is a top-level operation. |
114 | | Operation *getParentOp(); |
115 | | |
116 | | /// Return the closest surrounding parent operation that is of type 'OpTy'. |
117 | 0 | template <typename OpTy> OpTy getParentOfType() { |
118 | 0 | auto *op = this; |
119 | 0 | while ((op = op->getParentOp())) |
120 | 0 | if (auto parentOp = dyn_cast<OpTy>(op)) |
121 | 0 | return parentOp; |
122 | 0 | return OpTy(); |
123 | 0 | } |
124 | | |
125 | | /// Returns the closest surrounding parent operation with trait `Trait`. |
126 | | template <template <typename T> class Trait> |
127 | 0 | Operation *getParentWithTrait() { |
128 | 0 | Operation *op = this; |
129 | 0 | while ((op = op->getParentOp())) |
130 | 0 | if (op->hasTrait<Trait>()) |
131 | 0 | return op; |
132 | 0 | return nullptr; |
133 | 0 | } |
134 | | |
135 | | /// Return true if this operation is a proper ancestor of the `other` |
136 | | /// operation. |
137 | | bool isProperAncestor(Operation *other); |
138 | | |
139 | | /// Return true if this operation is an ancestor of the `other` operation. An |
140 | | /// operation is considered as its own ancestor, use `isProperAncestor` to |
141 | | /// avoid this. |
142 | 0 | bool isAncestor(Operation *other) { |
143 | 0 | return this == other || isProperAncestor(other); |
144 | 0 | } |
145 | | |
146 | | /// Replace any uses of 'from' with 'to' within this operation. |
147 | | void replaceUsesOfWith(Value from, Value to); |
148 | | |
149 | | /// Replace all uses of results of this operation with the provided 'values'. |
150 | | template <typename ValuesT, |
151 | | typename = decltype(std::declval<ValuesT>().begin())> |
152 | 0 | void replaceAllUsesWith(ValuesT &&values) { |
153 | 0 | assert(std::distance(values.begin(), values.end()) == getNumResults() && |
154 | 0 | "expected 'values' to correspond 1-1 with the number of results"); |
155 | 0 |
|
156 | 0 | auto valueIt = values.begin(); |
157 | 0 | for (unsigned i = 0, e = getNumResults(); i != e; ++i) |
158 | 0 | getResult(i).replaceAllUsesWith(*(valueIt++)); |
159 | 0 | } |
160 | | |
161 | | /// Replace all uses of results of this operation with results of 'op'. |
162 | 0 | void replaceAllUsesWith(Operation *op) { |
163 | 0 | assert(getNumResults() == op->getNumResults()); |
164 | 0 | for (unsigned i = 0, e = getNumResults(); i != e; ++i) |
165 | 0 | getResult(i).replaceAllUsesWith(op->getResult(i)); |
166 | 0 | } |
167 | | |
168 | | /// Destroys this operation and its subclass data. |
169 | | void destroy(); |
170 | | |
171 | | /// This drops all operand uses from this operation, which is an essential |
172 | | /// step in breaking cyclic dependences between references when they are to |
173 | | /// be deleted. |
174 | | void dropAllReferences(); |
175 | | |
176 | | /// Drop uses of all values defined by this operation or its nested regions. |
177 | | void dropAllDefinedValueUses(); |
178 | | |
179 | | /// Unlink this operation from its current block and insert it right before |
180 | | /// `existingOp` which may be in the same or another block in the same |
181 | | /// function. |
182 | | void moveBefore(Operation *existingOp); |
183 | | |
184 | | /// Unlink this operation from its current block and insert it right before |
185 | | /// `iterator` in the specified block. |
186 | | void moveBefore(Block *block, llvm::iplist<Operation>::iterator iterator); |
187 | | |
188 | | /// Unlink this operation from its current block and insert it right after |
189 | | /// `existingOp` which may be in the same or another block in the same |
190 | | /// function. |
191 | | void moveAfter(Operation *existingOp); |
192 | | |
193 | | /// Unlink this operation from its current block and insert it right after |
194 | | /// `iterator` in the specified block. |
195 | | void moveAfter(Block *block, llvm::iplist<Operation>::iterator iterator); |
196 | | |
197 | | /// Given an operation 'other' that is within the same parent block, return |
198 | | /// whether the current operation is before 'other' in the operation list |
199 | | /// of the parent block. |
200 | | /// Note: This function has an average complexity of O(1), but worst case may |
201 | | /// take O(N) where N is the number of operations within the parent block. |
202 | | bool isBeforeInBlock(Operation *other); |
203 | | |
204 | | void print(raw_ostream &os, OpPrintingFlags flags = llvm::None); |
205 | | void print(raw_ostream &os, AsmState &state, |
206 | | OpPrintingFlags flags = llvm::None); |
207 | | void dump(); |
208 | | |
209 | | //===--------------------------------------------------------------------===// |
210 | | // Operands |
211 | | //===--------------------------------------------------------------------===// |
212 | | |
213 | | /// Replace the current operands of this operation with the ones provided in |
214 | | /// 'operands'. |
215 | | void setOperands(ValueRange operands); |
216 | | |
217 | | /// Replace the operands beginning at 'start' and ending at 'start' + 'length' |
218 | | /// with the ones provided in 'operands'. 'operands' may be smaller or larger |
219 | | /// than the range pointed to by 'start'+'length'. |
220 | | void setOperands(unsigned start, unsigned length, ValueRange operands); |
221 | | |
222 | | /// Insert the given operands into the operand list at the given 'index'. |
223 | | void insertOperands(unsigned index, ValueRange operands); |
224 | | |
225 | 0 | unsigned getNumOperands() { |
226 | 0 | return LLVM_LIKELY(hasOperandStorage) ? getOperandStorage().size() : 0; |
227 | 0 | } |
228 | | |
229 | 0 | Value getOperand(unsigned idx) { return getOpOperand(idx).get(); } |
230 | 0 | void setOperand(unsigned idx, Value value) { |
231 | 0 | return getOpOperand(idx).set(value); |
232 | 0 | } |
233 | | |
234 | | /// Erase the operand at position `idx`. |
235 | 0 | void eraseOperand(unsigned idx) { eraseOperands(idx); } |
236 | | |
237 | | /// Erase the operands starting at position `idx` and ending at position |
238 | | /// 'idx'+'length'. |
239 | 0 | void eraseOperands(unsigned idx, unsigned length = 1) { |
240 | 0 | getOperandStorage().eraseOperands(idx, length); |
241 | 0 | } |
242 | | |
243 | | // Support operand iteration. |
244 | | using operand_range = OperandRange; |
245 | | using operand_iterator = operand_range::iterator; |
246 | | |
247 | 0 | operand_iterator operand_begin() { return getOperands().begin(); } |
248 | 0 | operand_iterator operand_end() { return getOperands().end(); } |
249 | | |
250 | | /// Returns an iterator on the underlying Value's. |
251 | 0 | operand_range getOperands() { return operand_range(this); } |
252 | | |
253 | 0 | MutableArrayRef<OpOperand> getOpOperands() { |
254 | 0 | return LLVM_LIKELY(hasOperandStorage) ? getOperandStorage().getOperands() |
255 | 0 | : MutableArrayRef<OpOperand>(); |
256 | 0 | } |
257 | | |
258 | 0 | OpOperand &getOpOperand(unsigned idx) { return getOpOperands()[idx]; } |
259 | | |
260 | | // Support operand type iteration. |
261 | | using operand_type_iterator = operand_range::type_iterator; |
262 | | using operand_type_range = operand_range::type_range; |
263 | 0 | operand_type_iterator operand_type_begin() { return operand_begin(); } |
264 | 0 | operand_type_iterator operand_type_end() { return operand_end(); } |
265 | 0 | operand_type_range getOperandTypes() { return getOperands().getTypes(); } |
266 | | |
267 | | //===--------------------------------------------------------------------===// |
268 | | // Results |
269 | | //===--------------------------------------------------------------------===// |
270 | | |
271 | | /// Return the number of results held by this operation. |
272 | | unsigned getNumResults(); |
273 | | |
274 | | /// Get the 'idx'th result of this operation. |
275 | 0 | OpResult getResult(unsigned idx) { return OpResult(this, idx); } |
276 | | |
277 | | /// Support result iteration. |
278 | | using result_range = ResultRange; |
279 | | using result_iterator = result_range::iterator; |
280 | | |
281 | 0 | result_iterator result_begin() { return getResults().begin(); } |
282 | 0 | result_iterator result_end() { return getResults().end(); } |
283 | 0 | result_range getResults() { return result_range(this); } |
284 | | |
285 | 0 | result_range getOpResults() { return getResults(); } |
286 | 0 | OpResult getOpResult(unsigned idx) { return getResult(idx); } |
287 | | |
288 | | /// Support result type iteration. |
289 | | using result_type_iterator = result_range::type_iterator; |
290 | | using result_type_range = result_range::type_range; |
291 | 0 | result_type_iterator result_type_begin() { return getResultTypes().begin(); } |
292 | 0 | result_type_iterator result_type_end() { return getResultTypes().end(); } |
293 | | result_type_range getResultTypes(); |
294 | | |
295 | | //===--------------------------------------------------------------------===// |
296 | | // Attributes |
297 | | //===--------------------------------------------------------------------===// |
298 | | |
299 | | // Operations may optionally carry a list of attributes that associate |
300 | | // constants to names. Attributes may be dynamically added and removed over |
301 | | // the lifetime of an operation. |
302 | | |
303 | | /// Return all of the attributes on this operation. |
304 | 0 | ArrayRef<NamedAttribute> getAttrs() { return attrs.getAttrs(); } |
305 | | |
306 | | /// Return all of the attributes on this operation as a DictionaryAttr. |
307 | 0 | DictionaryAttr getAttrDictionary() { |
308 | 0 | return attrs.getDictionary(getContext()); |
309 | 0 | } |
310 | | |
311 | | /// Return mutable container of all the attributes on this operation. |
312 | 0 | MutableDictionaryAttr &getMutableAttrDict() { return attrs; } |
313 | | |
314 | | /// Set the attribute dictionary on this operation. |
315 | | /// Using a MutableDictionaryAttr is more efficient as it does not require new |
316 | | /// uniquing in the MLIRContext. |
317 | 0 | void setAttrs(MutableDictionaryAttr newAttrs) { attrs = newAttrs; } |
318 | | |
319 | | /// Return the specified attribute if present, null otherwise. |
320 | 0 | Attribute getAttr(Identifier name) { return attrs.get(name); } |
321 | 0 | Attribute getAttr(StringRef name) { return attrs.get(name); } |
322 | | |
323 | | template <typename AttrClass> AttrClass getAttrOfType(Identifier name) { |
324 | | return getAttr(name).dyn_cast_or_null<AttrClass>(); |
325 | | } |
326 | | |
327 | 0 | template <typename AttrClass> AttrClass getAttrOfType(StringRef name) { |
328 | 0 | return getAttr(name).dyn_cast_or_null<AttrClass>(); |
329 | 0 | } Unexecuted instantiation: _ZN4mlir9Operation13getAttrOfTypeINS_14DictionaryAttrEEET_N4llvm9StringRefE Unexecuted instantiation: _ZN4mlir9Operation13getAttrOfTypeINS_8TypeAttrEEET_N4llvm9StringRefE Unexecuted instantiation: _ZN4mlir9Operation13getAttrOfTypeINS_10StringAttrEEET_N4llvm9StringRefE Unexecuted instantiation: _ZN4mlir9Operation13getAttrOfTypeINS_20DenseIntElementsAttrEEET_N4llvm9StringRefE |
330 | | |
331 | | /// If the an attribute exists with the specified name, change it to the new |
332 | | /// value. Otherwise, add a new attribute with the specified name/value. |
333 | 0 | void setAttr(Identifier name, Attribute value) { attrs.set(name, value); } |
334 | 0 | void setAttr(StringRef name, Attribute value) { |
335 | 0 | setAttr(Identifier::get(name, getContext()), value); |
336 | 0 | } |
337 | | |
338 | | /// Remove the attribute with the specified name if it exists. The return |
339 | | /// value indicates whether the attribute was present or not. |
340 | 0 | MutableDictionaryAttr::RemoveResult removeAttr(Identifier name) { |
341 | 0 | return attrs.remove(name); |
342 | 0 | } |
343 | 0 | MutableDictionaryAttr::RemoveResult removeAttr(StringRef name) { |
344 | 0 | return attrs.remove(Identifier::get(name, getContext())); |
345 | 0 | } |
346 | | |
347 | | /// A utility iterator that filters out non-dialect attributes. |
348 | | class dialect_attr_iterator |
349 | | : public llvm::filter_iterator<ArrayRef<NamedAttribute>::iterator, |
350 | | bool (*)(NamedAttribute)> { |
351 | 0 | static bool filter(NamedAttribute attr) { |
352 | 0 | // Dialect attributes are prefixed by the dialect name, like operations. |
353 | 0 | return attr.first.strref().count('.'); |
354 | 0 | } |
355 | | |
356 | | explicit dialect_attr_iterator(ArrayRef<NamedAttribute>::iterator it, |
357 | | ArrayRef<NamedAttribute>::iterator end) |
358 | | : llvm::filter_iterator<ArrayRef<NamedAttribute>::iterator, |
359 | 0 | bool (*)(NamedAttribute)>(it, end, &filter) {} |
360 | | |
361 | | // Allow access to the constructor. |
362 | | friend Operation; |
363 | | }; |
364 | | using dialect_attr_range = iterator_range<dialect_attr_iterator>; |
365 | | |
366 | | /// Return a range corresponding to the dialect attributes for this operation. |
367 | 0 | dialect_attr_range getDialectAttrs() { |
368 | 0 | auto attrs = getAttrs(); |
369 | 0 | return {dialect_attr_iterator(attrs.begin(), attrs.end()), |
370 | 0 | dialect_attr_iterator(attrs.end(), attrs.end())}; |
371 | 0 | } |
372 | 0 | dialect_attr_iterator dialect_attr_begin() { |
373 | 0 | auto attrs = getAttrs(); |
374 | 0 | return dialect_attr_iterator(attrs.begin(), attrs.end()); |
375 | 0 | } |
376 | 0 | dialect_attr_iterator dialect_attr_end() { |
377 | 0 | auto attrs = getAttrs(); |
378 | 0 | return dialect_attr_iterator(attrs.end(), attrs.end()); |
379 | 0 | } |
380 | | |
381 | | /// Set the dialect attributes for this operation, and preserve all dependent. |
382 | | template <typename DialectAttrT> |
383 | | void setDialectAttrs(DialectAttrT &&dialectAttrs) { |
384 | | SmallVector<NamedAttribute, 16> attrs; |
385 | | attrs.assign(std::begin(dialectAttrs), std::end(dialectAttrs)); |
386 | | for (auto attr : getAttrs()) |
387 | | if (!attr.first.strref().count('.')) |
388 | | attrs.push_back(attr); |
389 | | setAttrs(llvm::makeArrayRef(attrs)); |
390 | | } |
391 | | |
392 | | //===--------------------------------------------------------------------===// |
393 | | // Blocks |
394 | | //===--------------------------------------------------------------------===// |
395 | | |
396 | | /// Returns the number of regions held by this operation. |
397 | 0 | unsigned getNumRegions() { return numRegions; } |
398 | | |
399 | | /// Returns the regions held by this operation. |
400 | 0 | MutableArrayRef<Region> getRegions() { |
401 | 0 | auto *regions = getTrailingObjects<Region>(); |
402 | 0 | return {regions, numRegions}; |
403 | 0 | } |
404 | | |
405 | | /// Returns the region held by this operation at position 'index'. |
406 | 0 | Region &getRegion(unsigned index) { |
407 | 0 | assert(index < numRegions && "invalid region index"); |
408 | 0 | return getRegions()[index]; |
409 | 0 | } |
410 | | |
411 | | //===--------------------------------------------------------------------===// |
412 | | // Successors |
413 | | //===--------------------------------------------------------------------===// |
414 | | |
415 | 0 | MutableArrayRef<BlockOperand> getBlockOperands() { |
416 | 0 | return {getTrailingObjects<BlockOperand>(), numSuccs}; |
417 | 0 | } |
418 | | |
419 | | // Successor iteration. |
420 | | using succ_iterator = SuccessorRange::iterator; |
421 | 0 | succ_iterator successor_begin() { return getSuccessors().begin(); } |
422 | 0 | succ_iterator successor_end() { return getSuccessors().end(); } |
423 | 0 | SuccessorRange getSuccessors() { return SuccessorRange(this); } |
424 | | |
425 | 0 | bool hasSuccessors() { return numSuccs != 0; } |
426 | 0 | unsigned getNumSuccessors() { return numSuccs; } |
427 | | |
428 | 0 | Block *getSuccessor(unsigned index) { |
429 | 0 | assert(index < getNumSuccessors()); |
430 | 0 | return getBlockOperands()[index].get(); |
431 | 0 | } |
432 | | void setSuccessor(Block *block, unsigned index); |
433 | | |
434 | | //===--------------------------------------------------------------------===// |
435 | | // Accessors for various properties of operations |
436 | | //===--------------------------------------------------------------------===// |
437 | | |
438 | | /// Returns whether the operation is commutative. |
439 | 0 | bool isCommutative() { |
440 | 0 | if (auto *absOp = getAbstractOperation()) |
441 | 0 | return absOp->hasProperty(OperationProperty::Commutative); |
442 | 0 | return false; |
443 | 0 | } |
444 | | |
445 | | /// Represents the status of whether an operation is a terminator. We |
446 | | /// represent an 'unknown' status because we want to support unregistered |
447 | | /// terminators. |
448 | | enum class TerminatorStatus { Terminator, NonTerminator, Unknown }; |
449 | | |
450 | | /// Returns the status of whether this operation is a terminator or not. |
451 | 0 | TerminatorStatus getTerminatorStatus() { |
452 | 0 | if (auto *absOp = getAbstractOperation()) { |
453 | 0 | return absOp->hasProperty(OperationProperty::Terminator) |
454 | 0 | ? TerminatorStatus::Terminator |
455 | 0 | : TerminatorStatus::NonTerminator; |
456 | 0 | } |
457 | 0 | return TerminatorStatus::Unknown; |
458 | 0 | } |
459 | | |
460 | | /// Returns if the operation is known to be a terminator. |
461 | 0 | bool isKnownTerminator() { |
462 | 0 | return getTerminatorStatus() == TerminatorStatus::Terminator; |
463 | 0 | } |
464 | | |
465 | | /// Returns if the operation is known to *not* be a terminator. |
466 | 0 | bool isKnownNonTerminator() { |
467 | 0 | return getTerminatorStatus() == TerminatorStatus::NonTerminator; |
468 | 0 | } |
469 | | |
470 | | /// Returns true if the operation is known to be completely isolated from |
471 | | /// enclosing regions, i.e., no internal regions reference values defined |
472 | | /// above this operation. |
473 | 0 | bool isKnownIsolatedFromAbove() { |
474 | 0 | if (auto *absOp = getAbstractOperation()) |
475 | 0 | return absOp->hasProperty(OperationProperty::IsolatedFromAbove); |
476 | 0 | return false; |
477 | 0 | } |
478 | | |
479 | | /// Attempt to fold this operation with the specified constant operand values |
480 | | /// - the elements in "operands" will correspond directly to the operands of |
481 | | /// the operation, but may be null if non-constant. If folding is successful, |
482 | | /// this fills in the `results` vector. If not, `results` is unspecified. |
483 | | LogicalResult fold(ArrayRef<Attribute> operands, |
484 | | SmallVectorImpl<OpFoldResult> &results); |
485 | | |
486 | | /// Returns if the operation was registered with a particular trait, e.g. |
487 | | /// hasTrait<OperandsAreSignlessIntegerLike>(). |
488 | 0 | template <template <typename T> class Trait> bool hasTrait() { |
489 | 0 | auto *absOp = getAbstractOperation(); |
490 | 0 | return absOp ? absOp->hasTrait<Trait>() : false; |
491 | 0 | } Unexecuted instantiation: _ZN4mlir9Operation8hasTraitINS_7OpTrait23HasRecursiveSideEffectsEEEbv Unexecuted instantiation: _ZN4mlir9Operation8hasTraitINS_7OpTrait12ConstantLikeEEEbv Unexecuted instantiation: _ZN4mlir9Operation8hasTraitINS_7OpTrait11AffineScopeEEEbv Unexecuted instantiation: _ZN4mlir9Operation8hasTraitINS_7OpTrait24AutomaticAllocationScopeEEEbv Unexecuted instantiation: _ZN4mlir9Operation8hasTraitINS_7OpTrait10ZeroRegionEEEbv Unexecuted instantiation: _ZN4mlir9Operation8hasTraitINS_7OpTrait11SymbolTableEEEbv |
492 | | |
493 | | //===--------------------------------------------------------------------===// |
494 | | // Operation Walkers |
495 | | //===--------------------------------------------------------------------===// |
496 | | |
497 | | /// Walk the operation in postorder, calling the callback for each nested |
498 | | /// operation(including this one). The callback method can take any of the |
499 | | /// following forms: |
500 | | /// void(Operation*) : Walk all operations opaquely. |
501 | | /// * op->walk([](Operation *nestedOp) { ...}); |
502 | | /// void(OpT) : Walk all operations of the given derived type. |
503 | | /// * op->walk([](ReturnOp returnOp) { ...}); |
504 | | /// WalkResult(Operation*|OpT) : Walk operations, but allow for |
505 | | /// interruption/cancellation. |
506 | | /// * op->walk([](... op) { |
507 | | /// // Interrupt, i.e cancel, the walk based on some invariant. |
508 | | /// if (some_invariant) |
509 | | /// return WalkResult::interrupt(); |
510 | | /// return WalkResult::advance(); |
511 | | /// }); |
512 | | template <typename FnT, typename RetT = detail::walkResultType<FnT>> |
513 | 0 | RetT walk(FnT &&callback) { |
514 | 0 | return detail::walkOperations(this, std::forward<FnT>(callback)); |
515 | 0 | } |
516 | | |
517 | | //===--------------------------------------------------------------------===// |
518 | | // Uses |
519 | | //===--------------------------------------------------------------------===// |
520 | | |
521 | | /// Drop all uses of results of this operation. |
522 | 0 | void dropAllUses() { |
523 | 0 | for (OpResult result : getOpResults()) |
524 | 0 | result.dropAllUses(); |
525 | 0 | } |
526 | | |
527 | | /// This class implements a use iterator for the Operation. This iterates over |
528 | | /// all uses of all results. |
529 | | class UseIterator final |
530 | | : public llvm::iterator_facade_base< |
531 | | UseIterator, std::forward_iterator_tag, OpOperand> { |
532 | | public: |
533 | | /// Initialize UseIterator for op, specify end to return iterator to last |
534 | | /// use. |
535 | | explicit UseIterator(Operation *op, bool end = false); |
536 | | |
537 | | using llvm::iterator_facade_base<UseIterator, std::forward_iterator_tag, |
538 | | OpOperand>::operator++; |
539 | | UseIterator &operator++(); |
540 | 0 | OpOperand *operator->() const { return use.getOperand(); } |
541 | 0 | OpOperand &operator*() const { return *use.getOperand(); } |
542 | | |
543 | 0 | bool operator==(const UseIterator &rhs) const { return use == rhs.use; } |
544 | 0 | bool operator!=(const UseIterator &rhs) const { return !(*this == rhs); } |
545 | | |
546 | | private: |
547 | | void skipOverResultsWithNoUsers(); |
548 | | |
549 | | /// The operation whose uses are being iterated over. |
550 | | Operation *op; |
551 | | /// The result of op who's uses are being iterated over. |
552 | | Operation::result_iterator res; |
553 | | /// The use of the result. |
554 | | Value::use_iterator use; |
555 | | }; |
556 | | using use_iterator = UseIterator; |
557 | | using use_range = iterator_range<use_iterator>; |
558 | | |
559 | 0 | use_iterator use_begin() { return use_iterator(this); } |
560 | 0 | use_iterator use_end() { return use_iterator(this, /*end=*/true); } |
561 | | |
562 | | /// Returns a range of all uses, which is useful for iterating over all uses. |
563 | 0 | use_range getUses() { return {use_begin(), use_end()}; } |
564 | | |
565 | | /// Returns true if this operation has exactly one use. |
566 | 0 | bool hasOneUse() { return llvm::hasSingleElement(getUses()); } |
567 | | |
568 | | /// Returns true if this operation has no uses. |
569 | 0 | bool use_empty() { |
570 | 0 | return llvm::all_of(getOpResults(), |
571 | 0 | [](OpResult result) { return result.use_empty(); }); |
572 | 0 | } |
573 | | |
574 | | /// Returns true if the results of this operation are used outside of the |
575 | | /// given block. |
576 | 0 | bool isUsedOutsideOfBlock(Block *block) { |
577 | 0 | return llvm::any_of(getOpResults(), [block](OpResult result) { |
578 | 0 | return result.isUsedOutsideOfBlock(block); |
579 | 0 | }); |
580 | 0 | } |
581 | | |
582 | | //===--------------------------------------------------------------------===// |
583 | | // Users |
584 | | //===--------------------------------------------------------------------===// |
585 | | |
586 | | using user_iterator = ValueUserIterator<use_iterator, OpOperand>; |
587 | | using user_range = iterator_range<user_iterator>; |
588 | | |
589 | 0 | user_iterator user_begin() { return user_iterator(use_begin()); } |
590 | 0 | user_iterator user_end() { return user_iterator(use_end()); } |
591 | | |
592 | | /// Returns a range of all users. |
593 | 0 | user_range getUsers() { return {user_begin(), user_end()}; } |
594 | | |
595 | | //===--------------------------------------------------------------------===// |
596 | | // Other |
597 | | //===--------------------------------------------------------------------===// |
598 | | |
599 | | /// Emit an error with the op name prefixed, like "'dim' op " which is |
600 | | /// convenient for verifiers. |
601 | | InFlightDiagnostic emitOpError(const Twine &message = {}); |
602 | | |
603 | | /// Emit an error about fatal conditions with this operation, reporting up to |
604 | | /// any diagnostic handlers that may be listening. |
605 | | InFlightDiagnostic emitError(const Twine &message = {}); |
606 | | |
607 | | /// Emit a warning about this operation, reporting up to any diagnostic |
608 | | /// handlers that may be listening. |
609 | | InFlightDiagnostic emitWarning(const Twine &message = {}); |
610 | | |
611 | | /// Emit a remark about this operation, reporting up to any diagnostic |
612 | | /// handlers that may be listening. |
613 | | InFlightDiagnostic emitRemark(const Twine &message = {}); |
614 | | |
615 | | private: |
616 | | //===--------------------------------------------------------------------===// |
617 | | // Ordering |
618 | | //===--------------------------------------------------------------------===// |
619 | | |
620 | | /// This value represents an invalid index ordering for an operation within a |
621 | | /// block. |
622 | | static constexpr unsigned kInvalidOrderIdx = -1; |
623 | | |
624 | | /// This value represents the stride to use when computing a new order for an |
625 | | /// operation. |
626 | | static constexpr unsigned kOrderStride = 5; |
627 | | |
628 | | /// Update the order index of this operation of this operation if necessary, |
629 | | /// potentially recomputing the order of the parent block. |
630 | | void updateOrderIfNecessary(); |
631 | | |
632 | | /// Returns true if this operation has a valid order. |
633 | 0 | bool hasValidOrder() { return orderIndex != kInvalidOrderIdx; } |
634 | | |
635 | | private: |
636 | | Operation(Location location, OperationName name, ArrayRef<Type> resultTypes, |
637 | | unsigned numSuccessors, unsigned numRegions, |
638 | | const MutableDictionaryAttr &attributes, bool hasOperandStorage); |
639 | | |
640 | | // Operations are deleted through the destroy() member because they are |
641 | | // allocated with malloc. |
642 | | ~Operation(); |
643 | | |
644 | | /// Returns the operand storage object. |
645 | 0 | detail::OperandStorage &getOperandStorage() { |
646 | 0 | assert(hasOperandStorage && "expected operation to have operand storage"); |
647 | 0 | return *getTrailingObjects<detail::OperandStorage>(); |
648 | 0 | } |
649 | | |
650 | | /// Returns a pointer to the use list for the given trailing result. |
651 | 0 | detail::TrailingOpResult *getTrailingResult(unsigned resultNumber) { |
652 | 0 | return getTrailingObjects<detail::TrailingOpResult>() + resultNumber; |
653 | 0 | } |
654 | | |
655 | | /// Returns a pointer to the use list for the given inline result. |
656 | 0 | detail::InLineOpResult *getInlineResult(unsigned resultNumber) { |
657 | 0 | return getTrailingObjects<detail::InLineOpResult>() + resultNumber; |
658 | 0 | } |
659 | | |
660 | | /// Provide a 'getParent' method for ilist_node_with_parent methods. |
661 | | /// We mark it as a const function because ilist_node_with_parent specifically |
662 | | /// requires a 'getParent() const' method. Once ilist_node removes this |
663 | | /// constraint, we should drop the const to fit the rest of the MLIR const |
664 | | /// model. |
665 | 0 | Block *getParent() const { return block; } |
666 | | |
667 | | /// The operation block that contains this operation. |
668 | | Block *block = nullptr; |
669 | | |
670 | | /// This holds information about the source location the operation was defined |
671 | | /// or derived from. |
672 | | Location location; |
673 | | |
674 | | /// Relative order of this operation in its parent block. Used for |
675 | | /// O(1) local dominance checks between operations. |
676 | | mutable unsigned orderIndex = 0; |
677 | | |
678 | | const unsigned numSuccs; |
679 | | const unsigned numRegions : 30; |
680 | | |
681 | | /// This bit signals whether this operation has an operand storage or not. The |
682 | | /// operand storage may be elided for operations that are known to never have |
683 | | /// operands. |
684 | | bool hasOperandStorage : 1; |
685 | | |
686 | | /// This holds the result types of the operation. There are three different |
687 | | /// states recorded here: |
688 | | /// - 0 results : The type below is null. |
689 | | /// - 1 result : The single result type is held here. |
690 | | /// - N results : The type here is a tuple holding the result types. |
691 | | /// Note: We steal a bit for 'hasSingleResult' from somewhere else so that we |
692 | | /// can use 'resultType` in an ArrayRef<Type>. |
693 | | bool hasSingleResult : 1; |
694 | | Type resultType; |
695 | | |
696 | | /// This holds the name of the operation. |
697 | | OperationName name; |
698 | | |
699 | | /// This holds general named attributes for the operation. |
700 | | MutableDictionaryAttr attrs; |
701 | | |
702 | | // allow ilist_traits access to 'block' field. |
703 | | friend struct llvm::ilist_traits<Operation>; |
704 | | |
705 | | // allow block to access the 'orderIndex' field. |
706 | | friend class Block; |
707 | | |
708 | | // allow value to access the 'ResultStorage' methods. |
709 | | friend class Value; |
710 | | |
711 | | // allow ilist_node_with_parent to access the 'getParent' method. |
712 | | friend class llvm::ilist_node_with_parent<Operation, Block>; |
713 | | |
714 | | // This stuff is used by the TrailingObjects template. |
715 | | friend llvm::TrailingObjects<Operation, detail::InLineOpResult, |
716 | | detail::TrailingOpResult, BlockOperand, Region, |
717 | | detail::OperandStorage>; |
718 | 0 | size_t numTrailingObjects(OverloadToken<detail::InLineOpResult>) const { |
719 | 0 | return OpResult::getNumInline( |
720 | 0 | const_cast<Operation *>(this)->getNumResults()); |
721 | 0 | } |
722 | 0 | size_t numTrailingObjects(OverloadToken<detail::TrailingOpResult>) const { |
723 | 0 | return OpResult::getNumTrailing( |
724 | 0 | const_cast<Operation *>(this)->getNumResults()); |
725 | 0 | } |
726 | 0 | size_t numTrailingObjects(OverloadToken<BlockOperand>) const { |
727 | 0 | return numSuccs; |
728 | 0 | } |
729 | 0 | size_t numTrailingObjects(OverloadToken<Region>) const { return numRegions; } |
730 | | }; |
731 | | |
732 | 0 | inline raw_ostream &operator<<(raw_ostream &os, Operation &op) { |
733 | 0 | op.print(os, OpPrintingFlags().useLocalScope()); |
734 | 0 | return os; |
735 | 0 | } |
736 | | |
737 | | } // end namespace mlir |
738 | | |
739 | | namespace llvm { |
740 | | /// Provide isa functionality for operation casts. |
741 | | template <typename T> struct isa_impl<T, ::mlir::Operation> { |
742 | 0 | static inline bool doit(const ::mlir::Operation &op) { |
743 | 0 | return T::classof(const_cast<::mlir::Operation *>(&op)); |
744 | 0 | } Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir15ConstantIndexOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir23MemoryEffectOpInterfaceENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir12AffineLoadOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir13AffineStoreOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir18AffineVectorLoadOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir19AffineVectorStoreOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir6ViewOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir9SubViewOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir7AllocOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir13AffineApplyOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir12MemRefCastOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir16AffineDmaStartOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir15AffineDmaWaitOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir18AffineTerminatorOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir10AffineIfOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir11AffineMaxOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir11AffineMinOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir16AffinePrefetchOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir6FuncOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir10ConstantOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir11AffineForOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir16AffineParallelOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir5DimOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir8ModuleOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir10DmaStartOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir9DmaWaitOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir6AbsFOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir7AddCFOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir6AddFOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir6AddIOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir8AllocaOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir5AndOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir17AssumeAlignmentOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir11AtomicRMWOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir13AtomicYieldOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir18GenericAtomicRMWOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir8BranchOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir17BranchOpInterfaceENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir14CallIndirectOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir6CallOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir7CeilFOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir6CmpFOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir6CmpIOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir12CondBranchOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir10CopySignOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir5CosOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir15CreateComplexOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir9DeallocOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir6DivFOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir6Exp2OpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir5ExpOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir16ExtractElementOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir7FPExtOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir8FPToSIOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir9FPTruncOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir4ImOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir11IndexCastOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir6LoadOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir7Log10OpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir6Log2OpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir5LogOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir6MulFOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir6MulIOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir6NegFOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir4OrOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir10PrefetchOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir6RankOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir4ReOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir6RemFOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir8ReturnOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir7RsqrtOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir8SIToFPOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir8SelectOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir11ShiftLeftOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir13SignExtendIOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir12SignedDivIOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir12SignedRemIOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir18SignedShiftRightOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir5SinOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir7SplatOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir6SqrtOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir7StoreOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir7SubCFOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir6SubFOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir6SubIOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir6TanhOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir12TensorCastOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir20TensorFromElementsOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir12TensorLoadOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir13TensorStoreOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir11TruncateIOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir14UnsignedDivIOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir14UnsignedRemIOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir20UnsignedShiftRightOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir5XOrOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir13ZeroExtendIOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir16OpAsmOpInterfaceENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir18ModuleTerminatorOpENS1_9OperationEvE4doitERKS3_ Unexecuted instantiation: _ZN4llvm8isa_implIN4mlir17SymbolOpInterfaceENS1_9OperationEvE4doitERKS3_ |
745 | | }; |
746 | | |
747 | | /// Provide specializations for operation casts as the resulting T is value |
748 | | /// typed. |
749 | | template <typename T> struct cast_retty_impl<T, ::mlir::Operation *> { |
750 | | using ret_type = T; |
751 | | }; |
752 | | template <typename T> struct cast_retty_impl<T, ::mlir::Operation> { |
753 | | using ret_type = T; |
754 | | }; |
755 | | template <class T> |
756 | | struct cast_convert_val<T, ::mlir::Operation, ::mlir::Operation> { |
757 | | static T doit(::mlir::Operation &val) { return T(&val); } |
758 | | }; |
759 | | template <class T> |
760 | | struct cast_convert_val<T, ::mlir::Operation *, ::mlir::Operation *> { |
761 | 0 | static T doit(::mlir::Operation *val) { return T(val); } Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir15ConstantIndexOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir23MemoryEffectOpInterfaceEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir12AffineLoadOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir13AffineStoreOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir18AffineVectorLoadOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir19AffineVectorStoreOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir6ViewOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir9SubViewOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir7AllocOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir12MemRefCastOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir16AffineDmaStartOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir15AffineDmaWaitOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir13AffineApplyOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir11AffineForOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir10AffineIfOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir11AffineMaxOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir11AffineMinOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir16AffineParallelOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir16AffinePrefetchOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir18AffineTerminatorOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir10ConstantOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir5DimOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir8ModuleOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir6FuncOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir10DmaStartOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir9DmaWaitOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir6AbsFOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir7AddCFOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir6AddFOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir6AddIOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir8AllocaOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir5AndOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir17AssumeAlignmentOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir11AtomicRMWOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir13AtomicYieldOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir8BranchOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir17BranchOpInterfaceEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir14CallIndirectOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir6CallOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir7CeilFOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir6CmpFOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir6CmpIOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir12CondBranchOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir10CopySignOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir5CosOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir15CreateComplexOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir9DeallocOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir6DivFOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir6Exp2OpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir5ExpOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir16ExtractElementOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir7FPExtOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir8FPToSIOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir9FPTruncOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir18GenericAtomicRMWOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir4ImOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir11IndexCastOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir6LoadOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir7Log10OpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir6Log2OpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir5LogOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir6MulFOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir6MulIOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir6NegFOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir4OrOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir10PrefetchOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir6RankOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir4ReOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir6RemFOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir8ReturnOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir7RsqrtOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir8SIToFPOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir8SelectOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir11ShiftLeftOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir13SignExtendIOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir12SignedDivIOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir12SignedRemIOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir18SignedShiftRightOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir5SinOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir7SplatOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir6SqrtOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir7StoreOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir7SubCFOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir6SubFOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir6SubIOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir6TanhOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir12TensorCastOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir20TensorFromElementsOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir12TensorLoadOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir13TensorStoreOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir11TruncateIOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir14UnsignedDivIOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir14UnsignedRemIOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir20UnsignedShiftRightOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir5XOrOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir13ZeroExtendIOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir16OpAsmOpInterfaceEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir18ModuleTerminatorOpEPNS1_9OperationES4_E4doitES4_ Unexecuted instantiation: _ZN4llvm16cast_convert_valIN4mlir17SymbolOpInterfaceEPNS1_9OperationES4_E4doitES4_ |
762 | | }; |
763 | | } // end namespace llvm |
764 | | |
765 | | #endif // MLIR_IR_OPERATION_H |