MLIR 22.0.0git
MLProgramDialect.cpp
Go to the documentation of this file.
1//===- MLProgramDialect.cpp - MLProgram dialect implementation ------------===//
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#include "llvm/ADT/TypeSwitch.h"
13
14using namespace mlir;
15using namespace mlir::ml_program;
16
17//===----------------------------------------------------------------------===//
18/// Tablegen Definitions
19//===----------------------------------------------------------------------===//
20
21#include "mlir/Dialect/MLProgram/IR/MLProgramOpsDialect.cpp.inc"
22#define GET_ATTRDEF_CLASSES
23#include "mlir/Dialect/MLProgram/IR/MLProgramAttributes.cpp.inc"
24#define GET_TYPEDEF_CLASSES
25#include "mlir/Dialect/MLProgram/IR/MLProgramTypes.cpp.inc"
26
27namespace {
28
29struct MLProgramInlinerInterface : public DialectInlinerInterface {
31
32 bool isLegalToInline(Operation *, Region *, bool,
33 IRMapping &) const override {
34 // We have no specific opinion on whether ops defined in this dialect should
35 // be inlined.
36 return true;
37 }
38};
39
40struct MLProgramOpAsmDialectInterface : public OpAsmDialectInterface {
42};
43} // namespace
44
45void ml_program::MLProgramDialect::initialize() {
46#define GET_ATTRDEF_LIST
47 addAttributes<
48#include "mlir/Dialect/MLProgram/IR/MLProgramAttributes.cpp.inc"
49 >();
50
51#define GET_TYPEDEF_LIST
52 addTypes<
53#include "mlir/Dialect/MLProgram/IR/MLProgramTypes.cpp.inc"
54 >();
55
56 addOperations<
57#define GET_OP_LIST
58#include "mlir/Dialect/MLProgram/IR/MLProgramOps.cpp.inc"
59 >();
60
61 addInterfaces<MLProgramInlinerInterface, MLProgramOpAsmDialectInterface>();
62}
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.
This is the interface that must be implemented by the dialects of operations to be inlined.
DialectInlinerInterface(Dialect *dialect)
This is a utility class for mapping one set of IR entities to another.
Definition IRMapping.h:26
OpAsmDialectInterface(Dialect *dialect)
Operation is the basic unit of execution within MLIR.
Definition Operation.h:88
This class contains a list of basic blocks and a link to the parent operation it is attached to.
Definition Region.h:26
Include the generated interface declarations.