Skip to main content

Step

Enum Step 

Source
pub enum Step {
Show 13 variants Switches, Retries, Orderings, Overflows, Halves, Widths, Bytes, Counts, Quads, Floats, Bulk, Rounds, Varargs,
}
Expand description

One member of the group.

The name of the variant is the name of the construct rather than the name of the function that takes it out, because the membership is a list of constructs. Which function answers for one is something this file knows and nothing outside it needs to.

Variants§

§

Switches

A switch, as the decision tree document 24 describes.

§

Retries

A read modify write this machine has no single instruction for, as a loop around the compare and exchange.

Beside the switches rather than down with the rest of the rewriting, because both of them make blocks and nothing in crate::expand may.

§

Orderings

An ordered load or store, as the plain access and a barrier.

Above everything below it, since what an ordered access becomes here is a plain one and every pass below is written about a plain one by name. It is also why this is above the retries rather than below: the head of the loop they build reads with an ordered load.

§

Overflows

An arithmetic operation that also says whether it overflowed, as the arithmetic and the test.

Above the splitting rather than below it, because an overflow check is the one instruction whose result is two things and the splitting has no answer for that, while the arithmetic it becomes here is adds, multiplies and comparisons the splitting knows already. Nothing is lost by running it this early: the widths it is written for are the widths the machine has, so a check at any other width is refused by name either way round.

§

Halves

An integer wider than a register, as the two halves of one.

Ahead of the width legalisation and not part of it, because the two go in opposite directions: an integer of forty bits becomes one of sixty four down there and one of a hundred and twenty eight becomes two of sixty four here. Doing this first means a function holding both is one the step below still works on.

§

Widths

An integer at a width the machine does not have, as the width it is held in.

Before everything after it, because every pass after it is written about widths the machine has and an integer of forty bits is not one of them.

§

Bytes

A byte reversal, as the halving run of swaps it is.

§

Counts

A leading zero, trailing zero or set bit count, as the arithmetic that answers it.

§

Quads

Anything at all at the quad float format, as a call to the routine for it.

Above the float rewriting rather than part of it, because the two are written about different machines: every rewrite down there ends at an instruction this machine has, and every operation up here ends at a call because this machine has no instruction at the format at all. Running first means the step below never sees a quad.

§

Floats

A float constant, a negation and the conversions, as the integer work spec 10.2 asks for.

§

Bulk

A memcpy, a memset or a memmove, as the moves it is or as the call it is too big for.

§

Rounds

The size of a stack allocation, rounded up to what the stack pointer has to stay on.

The one step here that takes nothing out. It rewrites an operand of the instruction and leaves the instruction where it is, which is why Step::opcodes answers with nothing for it.

§

Varargs

A variable argument list, as spec 10.7’s split describes.

Implementations§

Source§

impl Step

Source

pub const GROUP: &'static [Self]

The group, in the order it runs, which is the membership section 36.1 asks to see.

Source

pub const fn name(self) -> &'static str

What it is called in a dump.

Source

pub const fn construct(self) -> &'static str

The construct it is the answer to, in the words section 36.1 uses for it.

Source

pub const fn opcodes(self) -> &'static [Opcode]

The opcodes it is the answer to, which is what Did::found and Did::left count.

Not a promise that none of them survive. Several of these steps have a case they leave where it stands, either because the machine turns out to have the construct after all or because this is a refusal being handed to the selector to name, and both of those show up here as a count that did not reach zero. What the pair of numbers is for is telling somebody reading a dump which of those happened.

Empty for Step::Rounds, which rewrites an operand rather than taking an instruction out, and empty for the three that work by type rather than by opcode: an integer of forty bits, one of a hundred and twenty eight and a quad float are all spelled with the same opcodes as anything else, and what makes them the construct is the type on the values.

Source

pub const fn whole_function(self) -> bool

Whether this step works on the whole function at once and says whether it rewrote it.

Two of them do. Both retype every value of a width, so either the whole function can be rewritten or none of it can, and they answer with a boolean for that reason. A false from one covers two different things, a function with nothing at that width in it and a function holding something the step did not understand, and neither is an error: the second leaves the selector to refuse by naming the construct it had no rule for.

Everything else here works instruction by instruction and has nothing to say at that scale, which is why Did::untouched is only ever true for these two.

Trait Implementations§

Source§

impl Clone for Step

Source§

fn clone(&self) -> Step

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 Step

Source§

impl Debug for Step

Source§

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

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

impl Eq for Step

Source§

impl Hash for Step

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Ord for Step

Source§

fn cmp(&self, other: &Step) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

fn clamp_to<R>(self, range: R) -> Self
where Self: Sized, R: ClampBounds<Self>,

🔬This is a nightly-only experimental API. (clamp_to)
Restrict a value to a certain range. Read more
Source§

impl PartialEq for Step

Source§

fn eq(&self, other: &Step) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl PartialOrd for Step

Source§

fn partial_cmp(&self, other: &Step) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl StructuralPartialEq for Step

Auto Trait Implementations§

§

impl Freeze for Step

§

impl RefUnwindSafe for Step

§

impl Send for Step

§

impl Sync for Step

§

impl Unpin for Step

§

impl UnsafeUnpin for Step

§

impl UnwindSafe for Step

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.