MimIR 0.1
MimIR is my Intermediate Representation
Loading...
Searching...
No Matches
cps2ds.h
Go to the documentation of this file.
1#pragma once
2
3#include "mim/def.h"
4#include "mim/phase.h"
5#include "mim/rewrite.h"
6#include "mim/schedule.h"
7
8namespace mim::plug::direct {
9
10/// Rewrite direct.cps2ds to cps.
11class CPS2DSPhase : public Phase {
12public:
15
16 void start() final;
17
18private:
19 const Def* rewrite(const Def* def);
20 const Def* rewrite_lam(Lam* lam);
21
22 Lam* make_continuation(const Def* cn_type, const Def* arg, Sym prefix);
23 Lam* result_lam(Lam* lam);
24 Scheduler& scheduler(const Def*);
25 const Nest& curr_external_nest() const;
26
27 Lam2Lam lam2lam_;
28 Def2Def rewritten_;
29 mim::DefMap<Nest> nests_;
30 mim::DefMap<Scheduler> scheduler_;
31 Lam* current_external_;
32};
33
34} // namespace mim::plug::direct
Base class for all Defs.
Definition def.h:251
A function.
Definition lam.h:110
Builds a nesting tree of all immutables‍/binders.
Definition nest.h:11
Phase(World &world, std::string name)
Definition phase.h:30
World & world()
Definition pass.h:64
flags_t annex() const
Definition pass.h:68
The World represents the whole program and manages creation of MimIR nodes (Defs).
Definition world.h:31
CPS2DSPhase(World &world, flags_t annex)
Definition cps2ds.h:13
void start() final
Actual entry.
Definition cps2ds.cpp:16
The direct style Plugin
Definition direct.h:8
Definition ast.h:14
DefMap< const Def * > Def2Def
Definition def.h:75
u64 flags_t
Definition types.h:46
GIDMap< const Def *, To > DefMap
Definition def.h:73
LamMap< Lam * > Lam2Lam
Definition lam.h:221