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/Arithmetic/IR/Arithmetic.h"
10 #include "mlir/Dialect/Complex/IR/Complex.h"
11 #include "mlir/Dialect/Tensor/IR/Tensor.h"
12 #include "mlir/Transforms/InliningUtils.h"
13 
14 using namespace mlir;
15 using namespace mlir::tensor;
16 
17 #include "mlir/Dialect/Tensor/IR/TensorOpsDialect.cpp.inc"
18 
19 //===----------------------------------------------------------------------===//
20 // TensorDialect Dialect Interfaces
21 //===----------------------------------------------------------------------===//
22 
23 namespace {
24 struct TensorInlinerInterface : public DialectInlinerInterface {
25   using DialectInlinerInterface::DialectInlinerInterface;
26   bool isLegalToInline(Region *dest, Region *src, bool wouldBeCloned,
27                        BlockAndValueMapping &valueMapping) const final {
28     return true;
29   }
30   bool isLegalToInline(Operation *, Region *, bool wouldBeCloned,
31                        BlockAndValueMapping &) const final {
32     return true;
33   }
34 };
35 } // namespace
36 
37 //===----------------------------------------------------------------------===//
38 // TensorDialect Methods
39 //===----------------------------------------------------------------------===//
40 
41 void TensorDialect::initialize() {
42   addOperations<
43 #define GET_OP_LIST
44 #include "mlir/Dialect/Tensor/IR/TensorOps.cpp.inc"
45       >();
46   addInterfaces<TensorInlinerInterface>();
47 }
48