MimIR
0.5-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.anno.esc` or `clos.anno.bottom`,
11
/// depending on whether their environment escapes.
12
class
LowerTypedClosPrep
:
public
RWPhase
{
13
public
:
14
using
RWPhase::RWPhase
;
15
16
private
:
17
/// One escape-propagation round over the old world; RWPhase::start() iterates until fixpoint.
18
bool
analyze
()
final
;
19
const
Def
*
rewrite_imm_Tuple
(
const
Tuple
*)
final
;
20
21
bool
is_esc(
const
Def
* def) {
22
if
(
auto
[_, lam] =
isa_var_proj<Lam>
(def); lam && !lam->is_set())
return
true
;
23
return
esc_.contains(def);
24
}
25
bool
set_esc(
const
Def
*);
26
27
DefSet
esc_;
28
};
29
30
}
// namespace mim::plug::clos::phase
mim::Def
Base class for all Defs.
Definition
def.h:289
mim::RWPhase::RWPhase
RWPhase(World &world, std::string name, Analysis *analysis=nullptr)
Definition
phase.h:334
mim::Tuple
Data constructor for a Sigma.
Definition
tuple.h:84
mim::plug::clos::phase::LowerTypedClosPrep
Escape analysis for closures: closure literals get their function wrapped in clos....
Definition
lower_typed_clos_prep.h:12
mim::plug::clos::phase::LowerTypedClosPrep::RWPhase
RWPhase(World &world, std::string name, Analysis *analysis=nullptr)
Definition
phase.h:334
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; RWPhase::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::DefSet
GIDSet< const Def * > DefSet
Definition
def.h:94
phase.h
include
mim
plug
clos
phase
lower_typed_clos_prep.h
Generated by
1.18.0