MLIR  19.0.0git
LoopLikeInterface.h
Go to the documentation of this file.
1 //===- LoopLikeInterface.h - Loop-like operations interface ---------------===//
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 implements the operation interface for loop like operations.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef MLIR_INTERFACES_LOOPLIKEINTERFACE_H_
14 #define MLIR_INTERFACES_LOOPLIKEINTERFACE_H_
15 
16 #include "mlir/IR/OpDefinition.h"
17 
18 namespace mlir {
19 class RewriterBase;
20 
21 /// A function that returns the additional yielded values during
22 /// `replaceWithAdditionalYields`. `newBbArgs` are the newly added region
23 /// iter_args. This function should return as many values as there are block
24 /// arguments in `newBbArgs`.
25 using NewYieldValuesFn = std::function<SmallVector<Value>(
26  OpBuilder &b, Location loc, ArrayRef<BlockArgument> newBbArgs)>;
27 
28 namespace detail {
29 /// Verify invariants of the LoopLikeOpInterface.
31 } // namespace detail
32 
33 //===----------------------------------------------------------------------===//
34 // Traits
35 //===----------------------------------------------------------------------===//
36 
37 namespace OpTrait {
38 // A trait indicating that the single region contained in the operation has
39 // parallel execution semantics. This may have implications in a certain pass.
40 // For example, buffer hoisting is illegal in parallel loops, and local buffers
41 // may be accessed by parallel threads simultaneously.
42 template <typename ConcreteType>
43 class HasParallelRegion : public TraitBase<ConcreteType, HasParallelRegion> {
44 public:
46  return impl::verifyOneRegion(op);
47  }
48 };
49 
50 } // namespace OpTrait
51 } // namespace mlir
52 
53 //===----------------------------------------------------------------------===//
54 // Interfaces
55 //===----------------------------------------------------------------------===//
56 
57 /// Include the generated interface declarations.
58 #include "mlir/Interfaces/LoopLikeInterface.h.inc"
59 
60 #endif // MLIR_INTERFACES_LOOPLIKEINTERFACE_H_
This class defines the main interface for locations in MLIR and acts as a non-nullable wrapper around...
Definition: Location.h:63
This class helps build Operations.
Definition: Builders.h:209
static LogicalResult verifyTrait(Operation *op)
Helper class for implementing traits.
Definition: OpDefinition.h:373
Operation is the basic unit of execution within MLIR.
Definition: Operation.h:88
LogicalResult verifyOneRegion(Operation *op)
Definition: Operation.cpp:990
LogicalResult verifyLoopLikeOpInterface(Operation *op)
Verify invariants of the LoopLikeOpInterface.
Include the generated interface declarations.
std::function< SmallVector< Value >(OpBuilder &b, Location loc, ArrayRef< BlockArgument > newBbArgs)> NewYieldValuesFn
A function that returns the additional yielded values during replaceWithAdditionalYields.
This class represents an efficient way to signal success or failure.
Definition: LogicalResult.h:26