MimIR 0.1
MimIR is my Intermediate Representation
Loading...
Searching...
No Matches
mim::plug::clos::ClosConv Class Reference

Performs typed closure conversion. More...

#include <mim/plug/clos/phase/clos_conv.h>

Inheritance diagram for mim::plug::clos::ClosConv:
[legend]

Public Member Functions

 ClosConv (World &world, flags_t annex)
void start () override
 Actual entry.
Public Member Functions inherited from mim::Phase
 Phase (World &world, std::string name)
 Phase (World &world, flags_t annex)
bool todo () const
void invalidate (bool todo=true)
 Signals that another round of fixed-point iteration is required, either as part of.
virtual void run ()
 Entry point and generates some debug output; invokes Phase::start.
Public Member Functions inherited from mim::Stage
Worldworld ()
Driverdriver ()
Loglog () 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< Stagerecreate ()
 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)
Protected Attributes inherited from mim::Stage
std::string name_

Detailed Description

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:

  • returning continuations ("functions"), join-points and branches are fully closure converted.
  • return continuations are not closure converted.
  • first-class continuations get a "dummy" closure, they still have free variables.

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.

Constructor & Destructor Documentation

◆ ClosConv()

mim::plug::clos::ClosConv::ClosConv ( World & world,
flags_t annex )
inline

Definition at line 91 of file clos_conv.h.

References mim::Stage::annex(), mim::Phase::Phase(), and mim::Stage::world().

Member Function Documentation

◆ start()

void mim::plug::clos::ClosConv::start ( )
overridevirtual

Actual entry.

Implements mim::Phase.

Definition at line 126 of file clos_conv.cpp.

References DLOG, and mim::Stage::world().


The documentation for this class was generated from the following files: