MimIR 0.1
MimIR is my Intermediate Representation
Loading...
Searching...
No Matches
The direct style Plugin

See also
mim::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

// axm %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.

axm %direct.cps2ds: [T: *, U: *] → Cn [T, Cn U] → (T → U), normalize_cps2ds, 2;
axm %direct.cps2ds_dep: [T: *, U: T → *] → Cn [t: T, Cn U t] → [[t: T] → U t], 2;

Passes and Phases

Passes

axm %direct.ds2cps_pass: %compile.Pass;
axm %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);