MimIR 0.1
MimIR is my Intermediate Representation
|
Classes | |
class | BranchClosElim |
class | Clos2SJLJ |
class | ClosConv |
Performs typed closure conversion. More... | |
class | ClosConvPrep |
class | ClosLit |
Wrapper around a Def that can be used to match closures (see isa_clos_lit). More... | |
class | FreeDefAna |
Transitively compute free Def's on demand. More... | |
class | LowerTypedClos |
This pass lowers typed closures to untyped closures. More... | |
class | LowerTypedClosPrep |
Enumerations | |
%clos.BufPtr | |
enum class | BufPtr : flags_t |
%clos.alloc_jmpbuf | |
enum class | alloc_jmpbuf : flags_t |
%clos.setjmp | |
enum class | setjmp : flags_t |
%clos.longjmp | |
enum class | longjmp : flags_t |
%clos.clos_conv_prep_pass | |
enum class | clos_conv_prep_pass : flags_t |
%clos.branch_clos_pass | |
enum class | branch_clos_pass : flags_t |
%clos.lower_typed_clos_prep_pass | |
enum class | lower_typed_clos_prep_pass : flags_t |
%clos.clos2sjlj_pass | |
enum class | clos2sjlj_pass : flags_t |
%clos.eta_red_bool_pass | |
enum class | eta_red_bool_pass : flags_t |
%clos.clos_conv_phase | |
enum class | clos_conv_phase : flags_t |
%clos.lower_typed_clos_phase | |
enum class | lower_typed_clos_phase : flags_t |
Functions | |
void | register_normalizers (Normalizers &normalizers) |
Closures | |
ClosLit | isa_clos_lit (Ref def, bool fn_isa_lam=true) |
Tries to match a closure literal. | |
Ref | clos_pack (Ref env, Ref fn, Ref ct=nullptr) |
Pack a typed closure. This assumes that fn expects the environment as its Clos_Env_Paramth argument. | |
std::tuple< Ref, Ref, Ref > | clos_unpack (Ref c) |
Deconstruct a closure into (env_type, function, env) . | |
Ref | clos_apply (Ref closure, Ref args) |
Apply a closure to arguments. | |
Ref | apply_closure (Ref closure, Defs args) |
template<class N > | |
std::tuple< const Extract *, N * > | ca_isa_var (Ref def) |
Checks is def is the variable of a mut of type N. | |
Closure Types | |
const Sigma * | isa_clos_type (Ref def) |
Sigma * | clos_type (const Pi *pi) |
Creates a typed closure type from pi . | |
const Pi * | clos_type_to_pi (Ref ct, Ref new_env_type=nullptr) |
Convert a closure type to a Pi, where the environment type has been removed or replaced by new_env_type (if new_env_type != nullptr ) | |
Variables | |
static constexpr plugin_t | Plugin_Id = 0x10d4140000000000 |
%clos.attr | |
enum class | attr : flags_t { returning = 0x10d4140000000400 , freeBB = 0x10d4140000000401 , fstclassBB = 0x10d4140000000402 , esc = 0x10d4140000000403 , bottom = 0x10d4140000000404 } |
template<attr o> | |
Ref | normalize_clos (Ref type, Ref callee, Ref arg) |
Closure Environment | |
static constexpr size_t | Clos_Env_Param = 1_u64 |
Describes where the environment is placed in the argument list. | |
size_t | shift_env (size_t i) |
size_t | skip_env (size_t i) |
Ref | ctype (World &w, Defs doms, Ref env_type=nullptr) |
Ref | clos_insert_env (size_t i, Ref env, std::function< Ref(size_t)> f) |
Ref | clos_insert_env (size_t i, Ref env, Ref a) |
Ref | clos_insert_env (Ref env, Ref tup_or_sig) |
Ref | clos_remove_env (size_t i, std::function< Ref(size_t)> f) |
Ref | clos_remove_env (size_t i, Ref def) |
Ref | clos_remove_env (Ref tup_or_sig) |
Ref | clos_sub_env (Ref tup_or_sig, Ref new_env) |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
Definition at line 72 of file clos.h.
References clos_apply(), and mim::Def::world().
Checks is def is the variable of a mut of type N.
Definition at line 79 of file clos.h.
References mim::Var::mut().
Apply a closure to arguments.
Definition at line 100 of file clos.cpp.
References clos_unpack(), and mim::Def::world().
Referenced by apply_closure(), and mim::plug::clos::Clos2SJLJ::enter().
Definition at line 123 of file clos.h.
References mim::Def::num_projs(), and mim::Def::world().
Definition at line 119 of file clos.h.
References clos_insert_env().
Definition at line 139 of file clos.cpp.
References Clos_Env_Param, and shift_env().
Referenced by clos_insert_env().
Pack a typed closure. This assumes that fn
expects the environment as its Clos_Env_Paramth argument.
Definition at line 78 of file clos.cpp.
References Clos_Env_Param, clos_remove_env(), clos_type(), isa_clos_type(), mim::Def::type(), and mim::Def::world().
Referenced by mim::plug::clos::Clos2SJLJ::enter(), mim::plug::clos::Clos2SJLJ::rewrite(), and mim::plug::clos::LowerTypedClosPrep::rewrite().
Definition at line 133 of file clos.h.
References mim::Def::num_projs(), and mim::Def::world().
Definition at line 130 of file clos.h.
References clos_remove_env(), and mim::Def::proj().
Definition at line 143 of file clos.cpp.
References skip_env().
Referenced by clos_pack(), clos_remove_env(), clos_type_to_pi(), and mim::plug::clos::BranchClosElim::rewrite().
Definition at line 139 of file clos.h.
References Clos_Env_Param, and mim::Def::refine().
Referenced by clos_type_to_pi().
Creates a typed closure type from pi
.
Definition at line 121 of file clos.cpp.
References mim::Def::as_mut(), ctype(), and mim::Def::world().
Referenced by clos_pack(), and mim::plug::clos::Clos2SJLJ::enter().
Convert a closure type to a Pi, where the environment type has been removed or replaced by new_env_type
(if new_env_type
!= nullptr
)
Definition at line 127 of file clos.cpp.
References clos_remove_env(), clos_sub_env(), isa_clos_type(), mim::Def::op(), and mim::Def::world().
Deconstruct a closure into (env_type, function, env)
.
Important: use this or ClosLit to destruct closures, since typechecking dependent pairs is currently broken.
Definition at line 88 of file clos.cpp.
References isa_clos_type().
Referenced by clos_apply(), mim::plug::clos::ClosLit::env(), and mim::plug::clos::ClosLit::fnc().
Definition at line 145 of file clos.cpp.
References ctype().
Referenced by clos_type(), and ctype().
Tries to match a closure literal.
Definition at line 64 of file clos.cpp.
Referenced by mim::plug::clos::LowerTypedClosPrep::analyze(), mim::plug::clos::Clos2SJLJ::rewrite(), and mim::plug::clos::LowerTypedClosPrep::rewrite().
Returns def
if def
is a closure and nullptr
otherwise
Definition at line 111 of file clos.cpp.
References Clos_Env_Param, mim::Pi::isa_cn(), mim::Def::isa_mut(), mim::Def::num_ops(), mim::Def::op(), mim::Def::var(), and mim::Def::world().
Referenced by clos_pack(), clos_type_to_pi(), and clos_unpack().
Definition at line 5 of file normalizers.cpp.
References bottom, and mim::Def::world().
void mim::plug::clos::register_normalizers | ( | Normalizers & | normalizers | ) |
Referenced by mim_get_plugin().
|
inline |
|
inline |
|
staticconstexpr |
Describes where the environment is placed in the argument list.
tup_or_sig
should generally be a Tuple, Sigma or Var.
Definition at line 107 of file clos.h.
Referenced by clos_insert_env(), clos_pack(), clos_sub_env(), mim::plug::clos::ClosLit::env_var(), isa_clos_type(), shift_env(), and skip_env().