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/Tensor/IR/Tensor.h" 10 #include "mlir/Transforms/InliningUtils.h" 11 12 using namespace mlir; 13 using namespace mlir::tensor; 14 15 #include "mlir/Dialect/Tensor/IR/TensorOpsDialect.cpp.inc" 16 17 //===----------------------------------------------------------------------===// 18 // TensorDialect Dialect Interfaces 19 //===----------------------------------------------------------------------===// 20 21 namespace { 22 struct TensorInlinerInterface : 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 //===----------------------------------------------------------------------===// 36 // TensorDialect Methods 37 //===----------------------------------------------------------------------===// 38 39 void TensorDialect::initialize() { 40 addOperations< 41 #define GET_OP_LIST 42 #include "mlir/Dialect/Tensor/IR/TensorOps.cpp.inc" 43 >(); 44 addInterfaces<TensorInlinerInterface>(); 45 } 46