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.attr.esc` or `%clos.attr.bottom`,
11/// depending on whether their environment escapes.
13public:
16
17private:
18 /// One escape-propagation round over the old world; RWPhase::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
Base class for all Defs.
Definition def.h:261
flags_t annex() const
Definition phase.h:81
RWPhase(World &world, std::string name, Analysis *analysis=nullptr)
Definition phase.h:316
World & world()=delete
Hides both and forbids direct access.
Data constructor for a Sigma.
Definition tuple.h:70
The World represents the whole program and manages creation of MimIR nodes (Defs).
Definition world.h:36
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:72
u64 flags_t
Definition types.h:39
GIDSet< const Def * > DefSet
Definition def.h:76