Enzyme main
Loading...
Searching...
No Matches
ImpulseUtils.h
Go to the documentation of this file.
1//===- ImpulseUtils.h - Utilities for Impulse dialect passes -----* C++
2//-*-===//
3//
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef ENZYME_MLIR_INTERFACES_IMPULSE_UTILS_H
11#define ENZYME_MLIR_INTERFACES_IMPULSE_UTILS_H
12
13#include "mlir/IR/IRMapping.h"
14#include "mlir/Interfaces/FunctionInterfaces.h"
15
16#include "CloneFunction.h"
17#include "EnzymeLogic.h"
18
19#include <functional>
20
21namespace mlir {
22namespace impulse {
23
24enum class ImpulseMode {
25 Call = 0,
26 Simulate = 1,
27 Generate = 2,
28 Regenerate = 3,
29};
30
32public:
33 FunctionOpInterface newFunc;
34
36 FunctionOpInterface oldFunc;
37 IRMapping originalToNewFn;
38 std::map<Operation *, Operation *> originalToNewFnOps;
39
41
42 ImpulseUtils(FunctionOpInterface newFunc_, FunctionOpInterface oldFunc_,
43 IRMapping &originalToNewFn_,
44 std::map<Operation *, Operation *> &originalToNewFnOps_,
45 ImpulseMode mode_)
46 : newFunc(newFunc_), mode(mode_), oldFunc(oldFunc_),
47 originalToNewFn(originalToNewFn_),
48 originalToNewFnOps(originalToNewFnOps_),
49 initializationBlock(&*(newFunc.getFunctionBody().begin())) {}
50
51 static ImpulseUtils *CreateFromClone(FunctionOpInterface toeval,
53 int64_t positionSize = -1,
54 int64_t constraintSize = -1);
55};
56
57} // namespace impulse
58} // namespace mlir
59
60#endif // ENZYME_MLIR_INTERFACES_IMPULSE_UTILS_H
FunctionOpInterface oldFunc
FunctionOpInterface newFunc
std::map< Operation *, Operation * > originalToNewFnOps
static ImpulseUtils * CreateFromClone(FunctionOpInterface toeval, ImpulseMode mode, int64_t positionSize=-1, int64_t constraintSize=-1)
ImpulseUtils(FunctionOpInterface newFunc_, FunctionOpInterface oldFunc_, IRMapping &originalToNewFn_, std::map< Operation *, Operation * > &originalToNewFnOps_, ImpulseMode mode_)