MimIR
MimIR is my Intermediate Representation
Loading...
Searching...
No Matches
The ll Plugin

See also
-X ll:<arg>
mim::plug::ll

The LLVM backend. Loading this plugin (mim foo.mim -p ll) appends an emission phase to the compilation pipeline that writes the LLVM IR of the fully lowered program to <world>.ll (or a.ll if the world is unnamed). The output path can be overridden via the -X ll:o=<file> command-line argument. Some intrinsics are lowered to calls into a small C runtime (rt/mim_rt.c) whose LLVM IR is embedded into or linked with the output, controlled via -X ll:rt=embed/extern.

Dependencies

plugin opt;
import compile;

Phases

emit

Emits the LLVM IR of the current world to <world>.ll (or to the path given via -X ll:o=<file>). This phase is spliced into the default pipeline (see opt) whenever the ll plugin is loaded.

axm emit: compile.Phase;

Annotations

vec

The identity, used as a vectorization annotation on loops; it has no normalizer and is an opaque op to every phase. At the surface, wrapping a affine.For's body nominates that loop as a schedule's vector loop while keeping the For application's shape intact for every matcher (see vec_for in the btensor plugin). affine.lower_for moves the wrapper from the body onto the loop's exit condition — unique per loop, since the condition reads the header's own variable — but only when this plugin's module is loaded (otherwise the annotation is dropped). The emitter then attaches llvm.loop.vectorize.enable metadata to the branches into the annotated loop's header, which on the latch lifts LLVM's tiny-trip-count (< 16) bailout.

axm vec: {T: *} → T → T;