Thorin 1.9.0
The Higher ORder INtermediate representation
Loading...
Searching...
No Matches
thorin::plug::clos::LowerTypedClos Class Reference

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

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

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

Public Member Functions

 LowerTypedClos (World &world)
 
void start () override
 Actual entry.
 
- Public Member Functions inherited from thorin::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 thorin::Phase
template<class P , class... Args>
static void run (Args &&... args)
 Runs a single Phase.
 
- Protected Attributes inherited from thorin::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()

thorin::plug::clos::LowerTypedClos::LowerTypedClos ( World world)
inline

Definition at line 30 of file lower_typed_clos.h.

Member Function Documentation

◆ start()

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

Actual entry.

Implements thorin::Phase.

Definition at line 17 of file lower_typed_clos.cpp.

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


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