MimIR
0.1
MimIR is my Intermediate Representation
Loading...
Searching...
No Matches
compile.cpp
Go to the documentation of this file.
1
#include "
mim/plug/compile/compile.h
"
2
3
#include <memory>
4
5
#include <
mim/config.h
>
6
#include <
mim/driver.h
>
7
#include <
mim/pass.h
>
8
#include <
mim/phase.h
>
9
10
#include <
mim/pass/beta_red.h
>
11
#include <
mim/pass/eta_exp.h
>
12
#include <
mim/pass/eta_red.h
>
13
#include <
mim/pass/lam_spec.h
>
14
#include <
mim/pass/scalarize.h
>
15
#include <
mim/pass/tail_rec_elim.h
>
16
#include <
mim/phase/beta_red_phase.h
>
17
#include <
mim/phase/branch_normalize.h
>
18
#include <
mim/phase/eta_exp_phase.h
>
19
#include <
mim/phase/eta_red_phase.h
>
20
#include <
mim/phase/prefix_cleanup.h
>
21
#include <
mim/phase/ret_wrap.h
>
22
23
#include "
mim/plug/compile/autogen.h
"
24
25
using namespace
mim
;
26
using namespace
mim::plug
;
27
28
void
reg_stages
(
Flags2Stages
& stages) {
29
// clang-format off
30
assert_emplace
(stages,
Annex::base<compile::null_phase>
(), [](
World
&) {
return
std::unique_ptr<Phase>{}; });
31
assert_emplace
(stages,
Annex::base<compile::null_repl >
(), [](
World
&) {
return
std::unique_ptr<Repl >{}; });
32
assert_emplace
(stages,
Annex::base<compile::null_pass >
(), [](
World
&) {
return
std::unique_ptr<Pass >{}; });
33
// phases
34
Stage::hook<compile::beta_red_phase, BetaRedPhase >
(stages);
35
Stage::hook<compile::branch_normalize_phase, BranchNormalizePhase>
(stages);
36
Stage::hook<compile::cleanup_phase, Cleanup >
(stages);
37
Stage::hook<compile::eta_exp_phase, EtaExpPhase >
(stages);
38
Stage::hook<compile::eta_red_phase, EtaRedPhase >
(stages);
39
Stage::hook<compile::pass2phase, PassManPhase >
(stages);
40
Stage::hook<compile::repl2phase, ReplManPhase >
(stages);
41
Stage::hook<compile::phases, PhaseMan >
(stages);
42
Stage::hook<compile::prefix_cleanup_phase, PrefixCleanup >
(stages);
43
// repls
44
Stage::hook<compile::repls, ReplMan >
(stages);
45
// passes
46
Stage::hook<compile::beta_red_pass, BetaRed >
(stages);
47
Stage::hook<compile::eta_exp_pass, EtaExp >
(stages);
48
Stage::hook<compile::eta_red_pass, EtaRed >
(stages);
49
Stage::hook<compile::lam_spec_pass, LamSpec >
(stages);
50
Stage::hook<compile::passes, PassMan >
(stages);
51
Stage::hook<compile::ret_wrap_phase, RetWrap >
(stages);
52
Stage::hook<compile::scalarize_pass, Scalarize >
(stages);
53
Stage::hook<compile::tail_rec_elim_pass, TailRecElim >
(stages);
54
// clang-format on
55
}
56
57
extern
"C"
MIM_EXPORT
Plugin
mim_get_plugin
() {
58
return
{
"compile"
,
compile::register_normalizers
,
reg_stages
,
nullptr
};
59
}
reg_stages
void reg_stages(Flags2Stages &stages)
Definition
affine.cpp:11
beta_red.h
beta_red_phase.h
branch_normalize.h
mim::Stage::hook
static void hook(Flags2Stages &stages)
Definition
pass.h:57
mim::World
The World represents the whole program and manages creation of MimIR nodes (Defs).
Definition
world.h:36
autogen.h
reg_stages
void reg_stages(Flags2Stages &stages)
Definition
compile.cpp:28
compile.h
config.h
MIM_EXPORT
#define MIM_EXPORT
Definition
config.h:16
driver.h
eta_exp.h
eta_exp_phase.h
eta_red.h
eta_red_phase.h
lam_spec.h
mim::plug::compile::register_normalizers
void register_normalizers(Normalizers &normalizers)
mim::plug
Definition
lower_for.h:5
mim
Definition
ast.h:14
mim::assert_emplace
auto assert_emplace(C &container, Args &&... args)
Invokes emplace on container, asserts that insertion actually happened, and returns the iterator.
Definition
util.h:118
mim::Flags2Stages
absl::flat_hash_map< flags_t, std::function< std::unique_ptr< Stage >(World &)> > Flags2Stages
Maps an an axiom of a Stage to a function that creates one.
Definition
plugin.h:22
mim::mim_get_plugin
mim::Plugin mim_get_plugin()
pass.h
phase.h
prefix_cleanup.h
ret_wrap.h
scalarize.h
mim::Annex::base
static consteval flags_t base()
Definition
plugin.h:119
mim::Plugin
Basic info and registration function pointer to be returned from a specific plugin.
Definition
plugin.h:30
tail_rec_elim.h
src
mim
plug
compile
compile.cpp
Generated by
1.13.2