MimIR
0.1
MimIR is my Intermediate Representation
Toggle main menu visibility
Main Page
Documentation
Mim Command-Line Reference
Mim Language Reference
Coding & Debugging
Developer Guide
Passes
Plugins
affine
autodiff
clos
compile
core
demo
direct
math
matrix
mem
opt
refly
regex
Namespaces
Namespace List
Namespace Members
All
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
z
Functions
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
z
Variables
Typedefs
a
b
d
f
g
j
l
m
n
p
r
s
t
u
v
w
Enumerations
a
b
c
d
e
f
g
i
j
l
m
n
p
q
r
s
t
v
w
z
Concepts
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
z
~
Functions
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
z
~
Variables
a
b
c
d
f
g
i
l
m
n
o
p
r
s
t
w
Typedefs
Enumerations
Enumerator
Related Symbols
a
b
c
d
f
i
l
n
o
p
s
w
Files
File List
File Members
All
a
c
d
e
g
h
i
m
r
v
w
Functions
Typedefs
Macros
a
c
d
e
g
h
i
m
v
w
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
Concepts
Loading...
Searching...
No Matches
cps2ds.h
Go to the documentation of this file.
1
#pragma once
2
3
#include <vector>
4
5
#include <
mim/def.h
>
6
7
#include <
mim/pass/pass.h
>
8
9
namespace
mim::plug::direct
{
10
11
/// This is the second part of ds2cps.
12
/// We replace all ds call sites of cps (or ds converted) functions with the cps calls.
13
/// `b = f args` becomes `f (args,cont)` with a newly introduced continuation `cont: Cn b`.
14
class
CPS2DS
:
public
RWPass
<CPS2DS, Lam> {
15
public
:
16
CPS2DS
(
PassMan
&
man
)
17
:
RWPass
(
man
,
"cps2ds"
) {}
16
CPS2DS
(
PassMan
&
man
) {
…
}
18
19
void
enter
()
override
;
20
21
private
:
22
Def2Def
rewritten_;
23
DefSet
rewritten_lams;
24
std::vector<Lam*> lam_stack;
25
Lam
* curr_lam_ =
nullptr
;
26
27
void
rewrite_lam(
Lam
* lam);
28
const
Def
* rewrite_body(
const
Def
*);
29
const
Def
* rewrite_body_(
const
Def
*);
30
};
14
class
CPS2DS
:
public
RWPass
<CPS2DS, Lam> {
…
};
31
32
}
// namespace mim::plug::direct
mim::Def
Base class for all Defs.
Definition
def.h:198
mim::Lam
A function.
Definition
lam.h:105
mim::Pass::man
PassMan & man()
Definition
pass.h:30
mim::Pass::PassMan
friend class PassMan
Definition
pass.h:101
mim::RWPass< CPS2DS, Lam >::RWPass
RWPass(PassMan &man, std::string_view name)
Definition
pass.h:222
mim::plug::direct::CPS2DS::enter
void enter() override
Invoked just before Pass::rewriteing PassMan::curr_mut's body.
Definition
cps2ds.cpp:13
mim::plug::direct::CPS2DS::CPS2DS
CPS2DS(PassMan &man)
Definition
cps2ds.h:16
def.h
mim::plug::direct
The direct style Plugin
Definition
direct.h:7
mim::Def2Def
DefMap< const Def * > Def2Def
Definition
def.h:48
mim::DefSet
GIDSet< const Def * > DefSet
Definition
def.h:47
pass.h
include
mim
plug
direct
pass
cps2ds.h
Generated by
1.13.2