This plugin provides the building blocks for MimIR's optimization pipeline: its axioms denote mim::Phases and the combinators that assemble them into a pipeline. Invoke the pipeline by defining a function _compile: [] → compile.Phase (or rely on a plugin-provided _default_compile such as the one in the opt plugin).
The type of compilation phases.
Makes a fixed-point flag switchable from the command line. compile.aggr fallback yields tt if -X compile:aggr was passed, ff if -X compile:no-aggr was passed, and otherwise the given fallback. Use it as the Bool of a compile.phases to make that pipeline's fixed-point iteration switchable via the CLI.
Yields phase if the named plugin is loaded, otherwise compile.null. Used to gate whole sub-pipelines on a plugin without importing it.
Checks whether the given plugin is loaded.
Resolves to the compile.Phase annex with the given fully-qualified name (e.g. "clos.clos_conv"). Resolution is deferred until the phase pipeline is built so that the referenced plugin's .mim file does not have to be imported by users of this axm. If the named annex is missing at pipeline build time (its plugin is not loaded), it is silently elided, i.e. the enclosing compile.phases simply skips it.
Bundles n phases into one pipeline (a mim::PhaseMan). The Bool selects fixed-point iteration: tt reruns the pipeline until no phase requests another round, ff runs it once.
The phases this plugin itself registers; every other one is contributed by the plugin that implements it.
Aggressive dead code elimination; removes Lam params nobody needs (mim::ADCE).
β-reduction; inlines Lams that occur exactly once in the program (mim::BetaRed).
Removes dead and unreachable code by rebuilding the World (mim::Cleanup).
η-expands non-Lam dispatch targets so every target of a jump table is a Lam (mim::DispatchNormalize).
Combined, idempotent η-reduction/η-expansion (mim::EtaConv).
Specializes a Lam at its call site by inlining higher-order arguments (mim::LamSpec).
Eliminates all nominal newtypes so that none reaches a backend (mim::NomErasure). nom N = T degrades to T, and both v inj N and #v to v.
Does nothing; useful as an elided placeholder.
Prepares return continuations for the backend (mim::RetWrap).
Flattens function signatures (mim::Scalarize).
Sparse Conditional Constant Propagation; propagates arbitrary expressions, not just constants (mim::SCCP).
Eliminates all types with exactly one inhabitant so that none reaches a backend (mim::SingleErasure). Within an aggregate the component is dropped; elsewhere «e» degrades to [] and ‹e› to (). Besides «e» this also catches [] and Idx 1.
Drops params that recursive calls merely forward, turning them into loops (mim::StaticArgOpt).