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