1 //===----------------------------------------------------------------------===//
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 #include "mlir/Dialect/MemRef/IR/MemRef.h"
10 #include "mlir/Transforms/InliningUtils.h"
11 
12 using namespace mlir;
13 using namespace mlir::memref;
14 
15 #include "mlir/Dialect/MemRef/IR/MemRefOpsDialect.cpp.inc"
16 
17 //===----------------------------------------------------------------------===//
18 // MemRefDialect Dialect Interfaces
19 //===----------------------------------------------------------------------===//
20 
21 namespace {
22 struct MemRefInlinerInterface : public DialectInlinerInterface {
23   using DialectInlinerInterface::DialectInlinerInterface;
24   bool isLegalToInline(Region *dest, Region *src, bool wouldBeCloned,
25                        BlockAndValueMapping &valueMapping) const final {
26     return true;
27   }
28   bool isLegalToInline(Operation *, Region *, bool wouldBeCloned,
29                        BlockAndValueMapping &) const final {
30     return true;
31   }
32 };
33 } // end anonymous namespace
34 
35 void mlir::memref::MemRefDialect::initialize() {
36   addOperations<
37 #define GET_OP_LIST
38 #include "mlir/Dialect/MemRef/IR/MemRefOps.cpp.inc"
39       >();
40   addInterfaces<MemRefInlinerInterface>();
41 }
42