MimIR 0.1
MimIR is my Intermediate Representation
Loading...
Searching...
No Matches
lower_typed_clos_prep.h
Go to the documentation of this file.
1#pragma once
2
3#include <mim/pass/eta_exp.h>
4#include <mim/pass/pass.h>
5
7
8namespace mim::plug::clos {
9
10class LowerTypedClosPrep : public FPPass<LowerTypedClosPrep, Lam> {
11public:
13 : FPPass<LowerTypedClosPrep, Lam>(man, "lower_typed_clos_prep") {}
14
15private:
16 Ref rewrite(Ref) override;
17 undo_t analyze(Ref) override;
18
19 bool is_esc(Ref def) {
20 if (auto [_, lam] = ca_isa_var<Lam>(def); lam && !lam->is_set()) return true;
21 return esc_.contains(def);
22 }
23 undo_t set_esc(Ref);
24
25 DefSet esc_;
26};
27
28} // namespace mim::plug::clos
Inherit from this class using CRTP, if you do need a Pass with a state and a fixed-point.
Definition pass.h:242
A function.
Definition lam.h:96
An optimizer that combines several optimizations in an optimal way.
Definition pass.h:107
PassMan & man()
Definition pass.h:30
Helper class to retrieve Infer::arg if present.
Definition def.h:85
The clos Plugin
Definition clos.h:7
std::tuple< const Extract *, N * > ca_isa_var(Ref def)
Checks is def is the variable of a mut of type N.
Definition clos.h:79
GIDSet< const Def * > DefSet
Definition def.h:58
size_t undo_t
Definition pass.h:14