Skip to main content

ShortInsts

Struct ShortInsts 

Source
pub struct ShortInsts {
    pub prefix: &'static str,
    pub zeroing: &'static [Zeroed],
    pub narrowing: &'static [Narrowed],
    pub testing: &'static [Tested],
    pub stepping: &'static [Stepped],
    pub copying: &'static [Copied],
}
Expand description

The shorter spellings this target has.

Fields§

§prefix: &'static str

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

§zeroing: &'static [Zeroed]

Every instruction that puts a constant in a register and has a shorter way of putting zero there.

§narrowing: &'static [Narrowed]

Every instruction that puts a constant in a register and has a narrower one that writes the same register and clears the rest of it.

§testing: &'static [Tested]

Every instruction that compares a register against a constant and has a shorter one that asks the same thing of the register against itself when the constant is zero.

§stepping: &'static [Stepped]

Every instruction that adds a constant to a register and has a shorter one that carries the number in its opcode, for the one or two numbers that shorter one is about.

§copying: &'static [Copied]

Every instruction that works out an address and keeps it, and the move that says the same thing when the address is one register and nothing else.

Implementations§

Source§

impl ShortInsts

Source

pub fn zeroed(&self, name: &str) -> Option<&'static str>

The shorter way of writing zero into a register, for the instruction of that name.

Source

pub fn narrowed(&self, name: &str) -> Option<Narrowed>

The narrower instruction that writes the same register, for the instruction of that name.

Source

pub fn tested(&self, name: &str) -> Option<&'static str>

The shorter way of comparing a register against zero, for the instruction of that name.

Source

pub fn stepped(&self, name: &str, by: i64) -> Option<&'static str>

The shorter way of adding that number to a register, for the instruction of that name.

Both halves are the key. One instruction has a shorter spelling for more than one number, since an addition of one and a subtraction of one are each other going the other way, and which of the two shorter instructions is meant depends on which number was written.

Source

pub fn copied(&self, name: &str) -> Option<&'static str>

The move that says the same thing as the address computation of that name.

Only the name is the key, because what makes the two the same is the addressing mode rather than anything about the opcode, and the addressing mode is not a thing a table of names could hold. The pass is what looks at it.

Source

pub fn steps(&self, name: &str) -> bool

Whether the instruction of that name is one of the shorter ones that leaves the carry alone.

Asked of an instruction the walk is looking past rather than of one it is thinking about rewriting, so what it is really asking is whether this instruction ends the life of a carry something in front of it set. One of these does not, which is the whole of what makes it shorter and the whole of what makes the rewrite conditional.

Trait Implementations§

Source§

impl Debug for ShortInsts

Source§

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

Formats the value using the given formatter. 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> 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, 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.