Skip to main content

Control

Enum Control 

Source
pub enum Control {
    If {
        else_offset: usize,
        end_offset: usize,
    },
    Loop {
        count: u8,
        initial: u8,
        increment: u8,
        end_offset: usize,
    },
    Repeat {
        counts: [u8; 3],
        end_offset: usize,
    },
    Call {
        target: usize,
        encoded: [u32; 3],
    },
    Break,
    Return,
}
Expand description

What a flow-control instruction does.

Variants§

§

If

IFE: a conditional block.

Fields

§else_offset: usize

The byte offset of the else block.

§end_offset: usize

The byte offset where the block ends.

§

Loop

LOOP: the three byte fields of the second operand word are the count (bits 2 to 9), the initial counter value (10 to 17) and the increment (19 to 26), as RPCS3 and Mesa name them. No program on Tony Hawk’s SHRED disc uses it.

Fields

§count: u8

The iteration count.

§initial: u8

The initial counter value.

§increment: u8

The counter increment.

§end_offset: usize

The byte offset where the loop ends (the third operand word without its top bit).

§

Repeat

REP: the same three byte fields, which Mesa found always filled with one value (a repeat count) and names count1, count2 and count3; RPCS3 reads the first as the repeat count. Kept as stored, in that order.

Fields

§counts: [u8; 3]

The three counts as stored (bits 2 to 9, 10 to 17 and 19 to 26 of the second operand word).

§end_offset: usize

The byte offset where the repeated block ends.

§

Call

CAL: a subroutine call. The target is the second operand word without its top bit, a count of 32-bit words as every other branch offset is (Mesa’s NV40_FP_OP_SUB_OFFSET); it must be an instruction boundary.

Fields

§target: usize

The byte offset of the first instruction of the subroutine.

§encoded: [u32; 3]

The instruction’s three operand words, as stored.

§

Break

BRK.

§

Return

RET.

Trait Implementations§

Source§

impl Clone for Control

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 Debug for Control

Source§

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

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

impl Eq for Control

Source§

impl PartialEq for Control

Source§

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

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

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Control

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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.