MimIR 0.1
MimIR is my Intermediate Representation
|
Performs typed closure conversion. More...
#include <mim/plug/clos/phase/clos_conv.h>
Public Member Functions | |
ClosConv (World &world, flags_t annex) | |
void | start () override |
Actual entry. | |
![]() | |
Phase (World &world, std::string name) | |
Phase (World &world, flags_t annex) | |
bool | todo () const |
virtual void | run () |
Entry point and generates some debug output; invokes Phase::start. | |
![]() | |
World & | world () |
Driver & | driver () |
Log & | log () const |
std::string_view | name () const |
flags_t | annex () const |
Stage (World &world, std::string name) | |
Stage (World &world, flags_t annex) | |
virtual | ~Stage ()=default |
virtual std::unique_ptr< Stage > | recreate () |
Creates a new instance; needed by a fixed-point PhaseMan. | |
virtual void | apply (const App *) |
Invoked if your Stage has additional args. | |
virtual void | apply (Stage &) |
Dito, but invoked by Stage::recreate. | |
Additional Inherited Members | |
template<class P, class... Args> | |
static void | run (Args &&... args) |
Runs a single Phase. | |
static auto | create (const Flags2Stages &stages, const Def *def) |
template<class A, class P> | |
static void | hook (Flags2Stages &stages) |
![]() | |
bool | todo_ = false |
Set to true to indicate that you want to rerun all Phasees in current your fixed-point PhaseMan. | |
![]() | |
std::string | name_ |
Performs typed closure conversion.
This is based on the Simply Typed Closure Conversion. Closures are represented using tuples: [Env: *, Cn [Env, Args..], Env]
. In general only continuations are converted. Different kind of Lams may be rewritten differently:
This pass relies on ClosConvPrep to introduce annotations for these cases.
Note: Since direct-style Defs are not rewritten, this can lead to problems with certain Axms: ax : (B : *, int -> B) -> (int -> B)
won't be converted, possible arguments may. Further, there is no machinery to handle free variables in a Lams type; this may lead to problems with polymorphic functions.
Definition at line 89 of file clos_conv.h.
Definition at line 91 of file clos_conv.h.
References mim::Stage::annex(), mim::Phase::Phase(), and mim::Stage::world().
|
overridevirtual |
Actual entry.
Implements mim::Phase.
Definition at line 126 of file clos_conv.cpp.
References DLOG, and mim::Stage::world().