MLIR 23.0.0git
IndexDialect.cpp
Go to the documentation of this file.
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
12
13using namespace mlir;
14using namespace mlir::index;
15
16//===----------------------------------------------------------------------===//
17// IndexDialect
18//===----------------------------------------------------------------------===//
19namespace {
20/// This class defines the interface for handling inlining for index
21/// dialect operations.
22struct 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
32void 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"
static bool isLegalToInline(InlinerInterface &interface, Region *src, Region *insertRegion, bool shouldCloneInlinedRegion, IRMapping &valueMapping)
Utility to check that all of the operations within 'src' can be inlined.
Include the generated interface declarations.