Enzyme main
Loading...
Searching...
No Matches
Dialect.cpp
Go to the documentation of this file.
1//===- EnzymeDialect.cpp - Enzyme dialect -----------------------*- C++ -*-===//
2//
3// This file is licensed 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 "Dialect.h"
10#include "Ops.h"
11#include "mlir/IR/DialectImplementation.h"
12
13#include "mlir/IR/Builders.h"
14#include "mlir/Transforms/InliningUtils.h"
15#include "llvm/ADT/TypeSwitch.h"
16
17#include "Dialect/EnzymeEnums.cpp.inc"
18#include "Dialect/EnzymeOpsDialect.cpp.inc"
19
20#define GET_OP_CLASSES
21#include "Dialect/EnzymeOps.cpp.inc"
22#define GET_TYPEDEF_CLASSES
23#include "Dialect/EnzymeOpsTypes.cpp.inc"
24// #include "Dialect/EnzymeTypes.cpp.inc"
25
26using namespace mlir;
27using namespace mlir::enzyme;
28
29//===----------------------------------------------------------------------===//
30// Enzyme dialect.
31//===----------------------------------------------------------------------===//
32
33namespace {
34struct EnzymeDialectInlinerInterface : public DialectInlinerInterface {
35 using DialectInlinerInterface::DialectInlinerInterface;
36
37 bool isLegalToInline(Operation * /*call*/, Operation * /*callable*/,
38 bool /*wouldBeCloned*/) const final {
39 return true;
40 }
41
42 bool isLegalToInline(Region * /*dest*/, Region * /*src*/,
43 bool /*wouldBeCloned*/,
44 IRMapping & /*valueMapping*/) const final {
45 return true;
46 }
47
48 bool isLegalToInline(Operation * /*op*/, Region * /*dest*/,
49 bool /*wouldBeCloned*/,
50 IRMapping & /*valueMapping*/) const final {
51 return true;
52 }
53};
54} // namespace
55
56void EnzymeDialect::initialize() {
57 addInterfaces<EnzymeDialectInlinerInterface>();
58 addOperations<
59#define GET_OP_LIST
60#include "Dialect/EnzymeOps.cpp.inc"
61 >();
62 addAttributes<
63#define GET_ATTRDEF_LIST
64#include "Dialect/EnzymeAttributes.cpp.inc"
65 >();
66 addTypes<
67#define GET_TYPEDEF_LIST
68#include "Dialect/EnzymeOpsTypes.cpp.inc"
69 >();
70}
71
72#define GET_ATTRDEF_CLASSES
73#include "Dialect/EnzymeAttributes.cpp.inc"