- 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 -X ll:o=<file>. 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
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.
Annotations
vec
A mim::Annotation nominating a loop for vectorization; it has no normalizer and is an opaque op to every phase. At the surface, wrapping an 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.
novec
The counterpart of vec: forbids vectorizing the annotated loop. A schedule puts it on the loops enclosing its vector loop; left alone, LLVM may vectorize one of those instead, and since they are strided that costs a gather per load. affine.lower_for moves it like vec, and the emitter attaches llvm.loop.vectorize.enable false.
