24
24
#include " mlir/IR/Value.h"
25
25
#include " mlir/Interfaces/ViewLikeInterface.h"
26
26
#include " mlir/Support/LLVM.h"
27
+ #include " mlir/Transforms/InliningUtils.h"
27
28
#include " llvm/ADT/ArrayRef.h"
28
29
#include " llvm/ADT/STLExtras.h"
29
30
#include " llvm/ADT/SmallSet.h"
@@ -74,6 +75,26 @@ static DimensionSize operator*(DimensionSize lhs, DimensionSize rhs) {
74
75
return lhs.value () * rhs.value ();
75
76
}
76
77
78
+ // ===----------------------------------------------------------------------===//
79
+ // Inliner
80
+ // ===----------------------------------------------------------------------===//
81
+
82
+ namespace {
83
+ struct MeshInlinerInterface : public DialectInlinerInterface {
84
+ using DialectInlinerInterface::DialectInlinerInterface;
85
+ // Currently no restrictions are encoded for inlining.
86
+ bool isLegalToInline (Operation *, Operation *, bool ) const final {
87
+ return true ;
88
+ }
89
+ bool isLegalToInline (Region *, Region *, bool , IRMapping &) const final {
90
+ return true ;
91
+ }
92
+ bool isLegalToInline (Operation *, Region *, bool , IRMapping &) const final {
93
+ return true ;
94
+ }
95
+ };
96
+ } // namespace
97
+
77
98
// ===----------------------------------------------------------------------===//
78
99
// Mesh dialect
79
100
// ===----------------------------------------------------------------------===//
@@ -91,6 +112,7 @@ void MeshDialect::initialize() {
91
112
#define GET_TYPEDEF_LIST
92
113
#include " mlir/Dialect/Mesh/IR/MeshTypes.cpp.inc"
93
114
>();
115
+ addInterface<MeshInlinerInterface>();
94
116
}
95
117
96
118
Operation *MeshDialect::materializeConstant (OpBuilder &builder, Attribute value,
0 commit comments