| 1 | //===- IndexDialect.cpp - Index dialect definition -------------------------==// |
|---|---|
| 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/Index/IR/IndexDialect.h" |
| 10 | #include "mlir/Conversion/ConvertToLLVM/ToLLVMInterface.h" |
| 11 | #include "mlir/Transforms/InliningUtils.h" |
| 12 | |
| 13 | using namespace mlir; |
| 14 | using namespace mlir::index; |
| 15 | |
| 16 | //===----------------------------------------------------------------------===// |
| 17 | // IndexDialect |
| 18 | //===----------------------------------------------------------------------===// |
| 19 | namespace { |
| 20 | /// This class defines the interface for handling inlining for index |
| 21 | /// dialect operations. |
| 22 | struct IndexInlinerInterface : public DialectInlinerInterface { |
| 23 | using DialectInlinerInterface::DialectInlinerInterface; |
| 24 | |
| 25 | /// All index dialect ops can be inlined. |
| 26 | bool isLegalToInline(Operation *, Region *, bool, IRMapping &) const final { |
| 27 | return true; |
| 28 | } |
| 29 | }; |
| 30 | } // namespace |
| 31 | |
| 32 | void IndexDialect::initialize() { |
| 33 | registerAttributes(); |
| 34 | registerOperations(); |
| 35 | addInterfaces<IndexInlinerInterface>(); |
| 36 | declarePromisedInterface<ConvertToLLVMPatternInterface, IndexDialect>(); |
| 37 | } |
| 38 | |
| 39 | //===----------------------------------------------------------------------===// |
| 40 | // ODS-Generated Definitions |
| 41 | //===----------------------------------------------------------------------===// |
| 42 | |
| 43 | #include "mlir/Dialect/Index/IR/IndexOpsDialect.cpp.inc" |
| 44 |