Skip to main content

TimingInsts

Struct TimingInsts 

Source
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 str

What a rule file and the machine IR put in front of this target’s opcodes, such as x64..

§model: &'static str

Which 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: bool

Whether 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: u32

How many instructions the machine starts in one cycle.

§slots: fn(Unit) -> u32

How 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

Source

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.

Source

pub fn of(&self, name: &str) -> Option<Timing>

What an instruction of that name costs on this machine.

Source

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

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for TimingInsts

Source§

impl Debug for TimingInsts

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for TimingInsts

Source§

impl PartialEq for TimingInsts

Source§

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.

1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.