Expand description
One IR function to one machine function, which is every pass in this crate in order.
Design: spec/10-backend.md section 10.1, which is where the order comes from.
Each pass here is written and tested on its own and each is useful on its own, but there is exactly one order they run in and until now that order lived in the tests. A caller outside this crate would have had to know that splitting critical edges comes after lowering and before allocation, that the frame is worked out after allocation because the spill slots are the largest thing in it, and that the prologue is written after the frame. None of that is a decision a driver should be making, so it is written down once, here.
§What comes out
A function whose every register is physical, whose every offset into the frame is a constant, and whose blocks are in the order they run in with the jumps that order needs. That is the point at which a function is one an encoder could read, and there is nothing left in it that is not an instruction of the machine it was compiled for.
§What is still missing from the middle
The optimizing path, all of it. What runs here is spec/10-backend.md section 10.3’s fast
path: one rule per term, a linear scan, and a block order from the shape of the CFG rather
than from block frequency. No scheduling and no peepholes, so the redundant moves a coalescer
would take out are still in the output.
Structs§
- Flags
- What the command line says about a frame, as opposed to what the machine says.
- Machine
- Everything about a machine that compiling a function for it needs.
Functions§
- compile
- Compiles one function, from the IR the middle end produced to machine instructions.