2424#include " mlir/IR/Value.h"
2525#include " mlir/Interfaces/ViewLikeInterface.h"
2626#include " mlir/Support/LLVM.h"
27+ #include " mlir/Transforms/InliningUtils.h"
2728#include " llvm/ADT/ArrayRef.h"
2829#include " llvm/ADT/STLExtras.h"
2930#include " llvm/ADT/SmallSet.h"
@@ -74,6 +75,26 @@ static DimensionSize operator*(DimensionSize lhs, DimensionSize rhs) {
7475 return lhs.value () * rhs.value ();
7576}
7677
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+
7798// ===----------------------------------------------------------------------===//
7899// Mesh dialect
79100// ===----------------------------------------------------------------------===//
@@ -91,6 +112,7 @@ void MeshDialect::initialize() {
91112#define GET_TYPEDEF_LIST
92113#include " mlir/Dialect/Mesh/IR/MeshTypes.cpp.inc"
93114 >();
115+ addInterface<MeshInlinerInterface>();
94116}
95117
96118Operation *MeshDialect::materializeConstant (OpBuilder &builder, Attribute value,
0 commit comments