pub enum Unit {
Int,
Mul,
Div,
Load,
Store,
Branch,
Float,
FloatDiv,
Free,
Fixed,
}Expand description
The parts of a machine a scheduler counts.
A summary of a real processor’s ports rather than a description of them. What it has to get right is which instructions compete with each other, and the ones that compete are the ones that are scarce: there are several units that add and one that divides, so a block full of divisions is limited by the divider and a block full of additions is limited by the width.
Variants§
Int
Ordinary integer work: an addition, a shift, a comparison, a move between registers.
Mul
An integer multiply, which every machine here has fewer of than it has adders.
Div
An integer divide, which is the one integer instruction that is not pipelined anywhere.
Load
A read of memory, including the read folded into an instruction that then does arithmetic.
Store
A write of memory.
Branch
A branch, a call and a return.
Float
Floating point arithmetic, including the conversions between floating point and integers.
FloatDiv
A floating point divide, which is not pipelined for the reason the integer one is not.
Free
Nothing the machine has to find room for, which is what an instruction that encodes to nothing costs.
Fixed
Something the model does not describe, and which nothing may be reordered around.
A fence, a trap, a landing pad, a run of padding a patcher was promised, a hint to a spin
loop, and the instruction that sets the old floating point unit’s rounding mode. Each of
them is in the function for a reason that is not a value anything reads, so the operands do
not say what it does and a scheduler reading only the operands would move it or move
something past it. rucc_codegen::schedule stops at one.
It is a unit rather than a flag of its own because a scheduler asks one question of the model about each instruction and this is one of the answers: the machine is doing something here, and what it is doing is not on the list.