MimIR
MimIR is my Intermediate Representation
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
6
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.
13public:
14 using RWPhase::RWPhase;
15
16private:
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
Base class for all Defs.
Definition def.h:289
RWPhase(World &world, std::string name, Analysis *analysis=nullptr)
Definition phase.h:334
Data constructor for a Sigma.
Definition tuple.h:84
Escape analysis for closures: closure literals get their function wrapped in clos....
RWPhase(World &world, std::string name, Analysis *analysis=nullptr)
Definition phase.h:334
const Def * rewrite_imm_Tuple(const Tuple *) final
bool analyze() final
One escape-propagation round over the old world; RWPhase::start() iterates until fixpoint.
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
GIDSet< const Def * > DefSet
Definition def.h:94