MimIR 0.1
MimIR is my Intermediate Representation
Loading...
Searching...
No Matches
autodiff_zero_cleanup.cpp
Go to the documentation of this file.
2
3#include <iostream>
4
5#include <mim/lam.h>
6
10#include "mim/plug/mem/mem.h"
11
12namespace mim::plug::autodiff {
13
15 // Ideally this code segment is never reached.
16 // (all zeros are resolved before)
17 if (auto zero_app = match<zero>(def); zero_app) {
18 // callee = zero
19 // arg = type T
20 auto T = zero_app->arg();
21 world().DLOG("found a remaining autodiff::zero of {}", T);
22 // generate ⊥:T
23 auto dummy = world().bot(T);
24 return dummy;
25 }
26
27 return def;
28}
29
30} // namespace mim::plug::autodiff
World & world()
Definition pass.h:296
Helper class to retrieve Infer::arg if present.
Definition def.h:86
Ref bot(Ref type)
Definition world.h:435
The automatic differentiation Plugin
Definition autodiff.h:6
auto match(Ref def)
Definition axiom.h:112