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)
 
void start () override
 Actual entry.
 
- Public Member Functions inherited from mim::Phase
 Phase (World &world, std::string_view name, bool dirty)
 
virtual ~Phase ()=default
 
Worldworld ()
 
std::string_view name () const
 
bool is_dirty () const
 
virtual void run ()
 Entry point and generates some debug output; invokes Phase::start.
 

Additional Inherited Members

- Static Public Member Functions inherited from mim::Phase
template<class P , class... Args>
static void run (Args &&... args)
 Runs a single Phase.
 
- Protected Member Functions inherited from mim::Phase
- Protected Attributes inherited from mim::Phase
Worldworld_
 
std::string name_
 
bool dirty_
 

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 Axioms: 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 91 of file clos_conv.h.

Constructor & Destructor Documentation

◆ ClosConv()

mim::plug::clos::ClosConv::ClosConv ( World & world)
inline

Definition at line 93 of file clos_conv.h.

Member Function Documentation

◆ start()

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

Actual entry.

Implements mim::Phase.

Definition at line 107 of file clos_conv.cpp.

References mim::Vector(), and mim::Phase::world().


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