The machine-independent surface of the native backends x86 and arm. A backend plugin loads it and supplies its own instructions, registers, and condition codes; this plugin holds the types, pseudo-instructions, and phases they share. The phases work on the one loaded backend (Driver::target) and read their arguments as that backend's, e.g. -X x86:k=<n>.
The condition flags that a comparison sets and a condition code tests.
A spill slot holding a value of type T. It is no register value; the emitter gives it a place in the stack frame.
in r v is v, which lives in register r of the class of v's type; n is the number of registers of the backend. Register allocation wraps every use of a value, so all uses of v share one in r v. It is no instruction: it is neither scheduled nor on the chain.
zext d v is v zero-extended to Idx d, where the register of v holds it zero-extended already, as after a load. Like in, it is no instruction: uses of it are uses of v in the register of v. It folds a literal, which a backend keeps as an operand.
Places the pure instruction f x on the mem.M 0 chain right after m: let (m, y) = mach.sched x86.add m (a, b). The chain token makes each placement a distinct Def, so copies, spills, and reloads at different points never merge.
Reserves n bytes in the stack frame and yields their address.
Loads a T from the address p.
Stores x to the address p.
spill x stores x into a spill slot; it is placed on the chain via sched like any other pure instruction.
reload x loads x from its spill slot.
A backend supports math.f32 and math.f64 only; its float instructions check the format in their codomain.
math.f32 or math.f64.
x, if pe is math.f32 or math.f64: the check of fpe for a codomain that does not name the format, e.g. Idx (fok pe 2) for Bool.
The types of math's float operations and of a backend's float instructions, as the parameters of isel rule families.
A math operation op onto a backend's instruction insn.
The guard lit x of an isel rule holds if x is a literal.
Turns each operation that a backend has no instruction for into a call of its C library function (see mim::plug::mach::LibCall). A math operation becomes a call of libm, e.g. math.exp on an f32 of expf; it covers exp, tri, pow, rt.cb, er, gamma, round, arith.rem, and extrema.fmin/fmax on f32 and f64. mem.strlen, mem.malloc, and mem.free become calls of strlen, malloc, and free. It runs before mem.add_mem, which threads the memory through the calls of the memory-free ones.
Turns every Nat value and every pointer into an I64, so that instruction selection only sees register types (see mim::plug::mach::Legalize). mem.lea becomes a core.wrap.add of its byte offset by the layout of core.trait, mem.load and mem.store become load and store, mem.mslot of a literal size becomes slot, and the Nat operations become their I64 counterparts. Only address space 0 is supported.
Makes each continuation's mem.M 0 chain total over the instructions of the backend, in a topological order (see mim::plug::mach::Schedule). Memory instructions are rethreaded onto the chain; all others are wrapped in sched.
Closes every join of a scheduled function over its values (see mim::plug::mach::Close): the values it uses but does not define become parameters, which every jump passes. A branch target or a return continuation has a single predecessor and stays nested in it. The parameters of a join are sorted by register class, the mem.M 0 first.
Spills and reloads until at most k values of each register class are live at every point (Braun & Hack, CC 2009). It assumes the ABI at every call; regalloc spills with the conventions of known callees instead. k is the number of allocatable registers of the class by default, and -X <backend>:k=<n> overrides it for the general-purpose one.
Moves the operands that an instruction needs in a fixed register, and a two-address operand that stays live, into a fresh continuation right before it. The jump is the copy, so the copies' live ranges end at the instruction and the interference graph stays chordal. The fixed operands are wrapped in in. Likewise, a fixed result that stays live is passed on to a fresh continuation right after its instruction.
Allocates registers function by function, callees first: it spills like spilling, splits like constrain, and colors. Coloring assigns a register to every value by one PBQP per function and register class (Buchwald, Zwinkau, Bersch, CC 2011) and wraps each use of a value in in. Jumps, calls, and returns are parallel copies: their arguments only prefer the registers of the parameters they bind. It removes chain instructions whose results are all dead. A function that is only called or jumped to gets a convention of its own, so its callers spill and color against its actual clobbers. -X <backend>:color-dot=<file> writes the PBQP graph of each function in Graphviz DOT format, with the chosen options highlighted.
Prints the liveness of every scheduled function to stdout, or to -X <backend>:live=<file>: per block its parameters, the live-in and live-out values, and the maximum number of live values per register class. It is not part of the default pipeline.