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

Performs typed closure conversion. More...

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

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

Public Member Functions

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

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

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

Definition at line 93 of file clos_conv.h.

Member Function Documentation

◆ start()

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

Actual entry.

Implements thorin::Phase.

Definition at line 107 of file clos_conv.cpp.

References thorin::Phase::world().


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