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