MimIR 0.1
MimIR is my Intermediate Representation
Loading...
Searching...
No Matches
beta_red.h
Go to the documentation of this file.
1#pragma once
2
3#include <mim/pass.h>
4
5namespace mim {
6
7/// Optimistically performs β-reduction (aka inlining).
8/// β-reduction of `f e` happens if `f` only occurs exactly once in the program in callee position.
9class BetaRed : public FPPass<BetaRed, Def> {
10public:
13
14 using Data = LamSet;
15
16 void keep(Lam* lam) { keep_.emplace(lam); }
17
18private:
19 const Def* rewrite(const Def*) override;
20 undo_t analyze(const Proxy*) override;
21 undo_t analyze(const Def*) override;
22
23 LamSet keep_;
24};
25
26} // namespace mim
const Def * rewrite(const Def *) override
Definition beta_red.cpp:5
void keep(Lam *lam)
Definition beta_red.h:16
LamSet Data
Definition beta_red.h:14
BetaRed(World &world, flags_t annex)
Definition beta_red.h:11
undo_t analyze(const Proxy *) override
Definition beta_red.cpp:18
Base class for all Defs.
Definition def.h:251
FPPass(World &world, std::string name)
Definition pass.h:323
A function.
Definition lam.h:111
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:36
Definition ast.h:14
GIDSet< Lam * > LamSet
Definition lam.h:221
u64 flags_t
Definition types.h:45
size_t undo_t
Definition pass.h:21