pub struct TimingInsts {
pub prefix: &'static str,
pub model: &'static str,
pub accurate: bool,
pub width: u32,
pub slots: fn(Unit) -> u32,
pub timing: fn(&str) -> Option<Timing>,
}Expand description
What a scheduler has to know about a machine to put a block in an order.
Fields§
§prefix: &'static strWhat a rule file and the machine IR put in front of this target’s opcodes, such as x64..
model: &'static strWhich processor the numbers describe, and where they were read out of.
A sentence rather than a name, because the useful thing to know about a model is not what
it is called but what it was taken from and when. It is printed by --print-config and it
is the first thing anybody comparing two runs of a benchmark wants.
accurate: boolWhether the numbers are a cycle accurate model of that processor’s pipeline.
See the module comment. No target here says true, and a target that starts saying it has
to mean it: the scheduler answers this by enforcing the unit counts below cycle by cycle,
which turns a wrong unit count from a heuristic that led nowhere into instructions held
back for a reason that was not real.
width: u32How many instructions the machine starts in one cycle.
slots: fn(Unit) -> u32How many of each unit the machine has.
Unit::Free and Unit::Fixed answer with the width, since an instruction that needs no
unit is held back by nothing but the width, and answering zero would be a machine that
cannot run a nop.
timing: fn(&str) -> Option<Timing>What an instruction of that name costs, or None for a name this target does not have.
None rather than a guess, for the reason crate::MachineInsts::operands answers
None: a pass that is told a made up number about an instruction nobody described has no
way to find out it was made up, and a pass that is told nothing stops.
Implementations§
Source§impl TimingInsts
impl TimingInsts
Sourcepub fn bare<'a>(&self, name: &'a str) -> &'a str
pub fn bare<'a>(&self, name: &'a str) -> &'a str
The name with this target’s prefix taken off, which is how its own description spells it.
Sourcepub fn of(&self, name: &str) -> Option<Timing>
pub fn of(&self, name: &str) -> Option<Timing>
What an instruction of that name costs on this machine.
Sourcepub fn slots(&self, unit: Unit) -> u32
pub fn slots(&self, unit: Unit) -> u32
How many of that unit this machine has, never fewer than one.
Never fewer than one because a unit no instruction can ever get a slot on is a scheduler that does not terminate, and a target that wrote a zero meant that the unit is not there rather than that the instructions needing it never run.
Trait Implementations§
Source§impl Clone for TimingInsts
impl Clone for TimingInsts
impl Copy for TimingInsts
Source§impl Debug for TimingInsts
impl Debug for TimingInsts
impl Eq for TimingInsts
Source§impl PartialEq for TimingInsts
impl PartialEq for TimingInsts
Source§fn eq(&self, other: &Self) -> bool
fn eq(&self, other: &Self) -> bool
Whether the two are the same model, which is what the target’s own name for it says.
The two functions are left out. Comparing those would be comparing addresses, and the
compiler is right that an address says nothing here: one function can have two of them and
two functions can share one. Every one of these is a static a target wrote out by hand
with its name in TimingInsts::model, so the name is the question anybody holding two of
these is asking.