MimIR
0.4-dev
MimIR is my Intermediate Representation
Toggle main menu visibility
Loading...
Searching...
No Matches
lower_typed_clos_prep.h
Go to the documentation of this file.
1
#pragma once
2
3
#include <
mim/phase.h
>
4
5
#include "
mim/plug/clos/clos.h
"
6
7
namespace
mim::plug::clos::phase
{
8
9
/// Escape analysis for closures:
10
/// closure literals get their function wrapped in `clos.attr.esc` or `clos.attr.bottom`,
11
/// depending on whether their environment escapes.
12
class
LowerTypedClosPrep
:
public
RWPhase
{
13
public
:
14
LowerTypedClosPrep
(
World
&
world
,
flags_t
annex
)
15
:
RWPhase
(
world
,
annex
) {}
16
17
private
:
18
/// One escape-propagation round over the old world; RWBase::start() iterates until fixpoint.
19
bool
analyze
() final;
20
const
Def
*
rewrite_imm_Tuple
(const
Tuple
*) final;
21
22
bool
is_esc(const
Def
* def) {
23
if
(
auto
[_, lam] =
isa_var_proj<Lam>
(def); lam && !lam->is_set())
return
true
;
24
return
esc_.contains(def);
25
}
26
bool
set_esc(
const
Def
*);
27
28
DefSet
esc_;
29
};
30
31
}
// namespace mim::plug::clos::phase
mim::Def
Base class for all Defs.
Definition
def.h:273
mim::Phase::annex
flags_t annex() const
Definition
phase.h:81
mim::RWPhase::RWPhase
RWPhase(World &world, std::string name, Analysis *analysis=nullptr)
Definition
phase.h:431
mim::RWPhase::world
World & world()=delete
Hides both and forbids direct access.
mim::Tuple
Data constructor for a Sigma.
Definition
tuple.h:61
mim::World
The World represents the whole program and manages creation of MimIR nodes (Defs).
Definition
world.h:40
mim::plug::clos::phase::LowerTypedClosPrep::LowerTypedClosPrep
LowerTypedClosPrep(World &world, flags_t annex)
Definition
lower_typed_clos_prep.h:14
mim::plug::clos::phase::LowerTypedClosPrep::rewrite_imm_Tuple
const Def * rewrite_imm_Tuple(const Tuple *) final
Definition
lower_typed_clos_prep.cpp:106
mim::plug::clos::phase::LowerTypedClosPrep::analyze
bool analyze() final
One escape-propagation round over the old world; RWBase::start() iterates until fixpoint.
Definition
lower_typed_clos_prep.cpp:64
clos.h
mim::plug::clos::phase
Definition
branch_clos_elim.h:5
mim::plug::clos::isa_var_proj
std::tuple< const Extract *, N * > isa_var_proj(const Def *def)
If def is a projection var#i of the Var of some mutable of type N, returns (projection,...
Definition
clos.h:73
mim::flags_t
u64 flags_t
Definition
types.h:39
mim::DefSet
GIDSet< const Def * > DefSet
Definition
def.h:89
phase.h
include
mim
plug
clos
phase
lower_typed_clos_prep.h
Generated by
1.18.0