Thorin 1.9.0
The Higher ORder INtermediate representation
Loading...
Searching...
No Matches
The direct style Plugin
See also
thorin::plug::direct

This plugin has three jobs:

  1. Convert inline direct style calls to CPS (and their functions).
  2. Wrap DS functions to CPS functions using an axiom.
  3. Convert CPS functions to DS functions using an axiom.

Dependencies

.import compile;

Operations

%direct.ds2cps

// .ax %direct.ds2cps: Π [T: *, U: *] -> (T -> U) -> .Cn [T, .Cn U];

%direct.cps2ds

This axiom lets the user call a cps function in direct style. The function is not converted. Only the call site is changed.

.ax %direct.cps2ds: Π [T: *, U: *] -> .Cn [T, .Cn U] -> (T -> U), normalize_cps2ds, 2;
.ax %direct.cps2ds_dep: Π [T: *, U: T -> *] -> .Cn [t: T, .Cn U t] -> [Π [t:T] -> U t], 2;

Passes and Phases

Passes

.ax %direct.ds2cps_pass: %compile.Pass;
.ax %direct.cps2ds_pass: %compile.Pass;

Phases

.let direct_phases = {
%compile.combined_phase (%compile.phase_list
(%compile.single_pass_phase %direct.ds2cps_pass)
(%compile.single_pass_phase %direct.cps2ds_pass)
optimization_phase
)
};