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

This pass lowers typed closures to untyped closures. More...

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

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

Public Member Functions

 LowerTypedClos (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

This pass lowers typed closures to untyped closures.

For details on typed closures, see ClosConv. In general, untyped closure have the form (pointer-to-environment, code) with the following exceptions:

  • Lams in callee-position should be λ-lifted and thus don't receive an environment.
  • External and imported (not set) Lams also don't receive an environment. They are appropriately η-wrapped by ClosConv.
  • If the environment is of integer type, it's directly stored in the environment-pointer ("unboxed").
    Note
    In theory this should work for other primitive types as well, but the LL backend does not handle the required conversion correctly.
    Further, first class continuations are rewritten to returning functions. They receive as a dummy continuation. Therefore Clos2SJLJ should have taken place prior to this pass.

This pass will heap-allocate ClosKind::esc closures and stack-allocate everything else. These annotations are introduced by LowerTypedClosPrep.

Definition at line 28 of file lower_typed_clos.h.

Constructor & Destructor Documentation

◆ LowerTypedClos()

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

Definition at line 30 of file lower_typed_clos.h.

Member Function Documentation

◆ start()

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

Actual entry.

Implements mim::Phase.

Definition at line 17 of file lower_typed_clos.cpp.

References mim::World::bot(), and mim::Phase::world().


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