Enum pulley_interpreter::op::Op

source ·
pub enum Op {
Show 47 variants Ret(Ret), Call(Call), Jump(Jump), BrIf(BrIf), BrIfNot(BrIfNot), BrIfXeq32(BrIfXeq32), BrIfXneq32(BrIfXneq32), BrIfXslt32(BrIfXslt32), BrIfXslteq32(BrIfXslteq32), BrIfXult32(BrIfXult32), BrIfXulteq32(BrIfXulteq32), Xmov(Xmov), Fmov(Fmov), Vmov(Vmov), Xconst8(Xconst8), Xconst16(Xconst16), Xconst32(Xconst32), Xconst64(Xconst64), Xadd32(Xadd32), Xadd64(Xadd64), Xeq64(Xeq64), Xneq64(Xneq64), Xslt64(Xslt64), Xslteq64(Xslteq64), Xult64(Xult64), Xulteq64(Xulteq64), Xeq32(Xeq32), Xneq32(Xneq32), Xslt32(Xslt32), Xslteq32(Xslteq32), Xult32(Xult32), Xulteq32(Xulteq32), Load32U(Load32U), Load32S(Load32S), Load64(Load64), Load32UOffset8(Load32UOffset8), Load32SOffset8(Load32SOffset8), Load64Offset8(Load64Offset8), Store32(Store32), Store64(Store64), Store32SOffset8(Store32SOffset8), Store64Offset8(Store64Offset8), BitcastIntFromFloat32(BitcastIntFromFloat32), BitcastIntFromFloat64(BitcastIntFromFloat64), BitcastFloatFromInt32(BitcastFloatFromInt32), BitcastFloatFromInt64(BitcastFloatFromInt64), ExtendedOp(ExtendedOp),
}
Expand description

A complete, materialized operation/instruction.

This type is useful for debugging, writing tests, etc… but is not actually ever used by the interpreter, encoder, or decoder, all of which avoid materializing ops.

Variants§

§

Ret(Ret)

Transfer control the address in the lr register.

§

Call(Call)

Transfer control to the PC at the given offset and set the lr register to the PC just after this instruction.

§

Jump(Jump)

Unconditionally transfer control to the PC at the given offset.

§

BrIf(BrIf)

Conditionally transfer control to the given PC offset if cond contains a non-zero value.

§

BrIfNot(BrIfNot)

Conditionally transfer control to the given PC offset if cond contains a zero value.

§

BrIfXeq32(BrIfXeq32)

Branch if a == b.

§

BrIfXneq32(BrIfXneq32)

Branch if a != b.

§

BrIfXslt32(BrIfXslt32)

Branch if signed a < b.

§

BrIfXslteq32(BrIfXslteq32)

Branch if signed a <= b.

§

BrIfXult32(BrIfXult32)

Branch if unsigned a < b.

§

BrIfXulteq32(BrIfXulteq32)

Branch if unsigned a <= b.

§

Xmov(Xmov)

Move between x registers.

§

Fmov(Fmov)

Move between f registers.

§

Vmov(Vmov)

Move between v registers.

§

Xconst8(Xconst8)

Set dst = zero_extend(imm8).

§

Xconst16(Xconst16)

Set dst = zero_extend(imm16).

§

Xconst32(Xconst32)

Set dst = zero_extend(imm32).

§

Xconst64(Xconst64)

Set dst = imm64.

§

Xadd32(Xadd32)

32-bit wrapping addition: low32(dst) = low32(src1) + low32(src2).

The upper 32-bits of dst are unmodified.

§

Xadd64(Xadd64)

64-bit wrapping addition: dst = src1 + src2.

§

Xeq64(Xeq64)

64-bit equality.

§

Xneq64(Xneq64)

64-bit inequality.

§

Xslt64(Xslt64)

64-bit signed less-than.

§

Xslteq64(Xslteq64)

64-bit signed less-than-equal.

§

Xult64(Xult64)

64-bit unsigned less-than.

§

Xulteq64(Xulteq64)

64-bit unsigned less-than-equal.

§

Xeq32(Xeq32)

32-bit equality.

§

Xneq32(Xneq32)

32-bit inequality.

§

Xslt32(Xslt32)

32-bit signed less-than.

§

Xslteq32(Xslteq32)

32-bit signed less-than-equal.

§

Xult32(Xult32)

32-bit unsigned less-than.

§

Xulteq32(Xulteq32)

32-bit unsigned less-than-equal.

§

Load32U(Load32U)

dst = zero_extend(load32(ptr))

§

Load32S(Load32S)

dst = sign_extend(load32(ptr))

§

Load64(Load64)

dst = load64(ptr)

§

Load32UOffset8(Load32UOffset8)

dst = zero_extend(load32(ptr + offset8))

§

Load32SOffset8(Load32SOffset8)

dst = sign_extend(load32(ptr + offset8))

§

Load64Offset8(Load64Offset8)

dst = load64(ptr + offset8)

§

Store32(Store32)

*ptr = low32(src)

§

Store64(Store64)

*ptr = src

§

Store32SOffset8(Store32SOffset8)

*(ptr + sign_extend(offset8)) = low32(src)

§

Store64Offset8(Store64Offset8)

*(ptr + sign_extend(offset8)) = src

§

BitcastIntFromFloat32(BitcastIntFromFloat32)

low32(dst) = bitcast low32(src) as i32

§

BitcastIntFromFloat64(BitcastIntFromFloat64)

dst = bitcast src as i64

§

BitcastFloatFromInt32(BitcastFloatFromInt32)

low32(dst) = bitcast low32(src) as f32

§

BitcastFloatFromInt64(BitcastFloatFromInt64)

dst = bitcast src as f64

§

ExtendedOp(ExtendedOp)

An extended operation/instruction.

Implementations§

source§

impl Op

source

pub fn encode<E>(&self, into: &mut E)
where E: Extend<u8>,

Available on crate feature encode only.

Encode this op into the given sink.

Trait Implementations§

source§

impl<'arbitrary> Arbitrary<'arbitrary> for Op

source§

fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Self>

Generate an arbitrary value of Self from the given unstructured data. Read more
source§

fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<Self>

Generate an arbitrary value of Self from the entirety of the given unstructured data. Read more
source§

fn size_hint(depth: usize) -> (usize, Option<usize>)

Get a size hint for how many bytes out of an Unstructured this type needs to construct itself. Read more
source§

impl Clone for Op

source§

fn clone(&self) -> Op

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl Debug for Op

source§

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

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

impl From<BitcastFloatFromInt32> for Op

source§

fn from(op: BitcastFloatFromInt32) -> Self

Converts to this type from the input type.
source§

impl From<BitcastFloatFromInt64> for Op

source§

fn from(op: BitcastFloatFromInt64) -> Self

Converts to this type from the input type.
source§

impl From<BitcastIntFromFloat32> for Op

source§

fn from(op: BitcastIntFromFloat32) -> Self

Converts to this type from the input type.
source§

impl From<BitcastIntFromFloat64> for Op

source§

fn from(op: BitcastIntFromFloat64) -> Self

Converts to this type from the input type.
source§

impl From<BrIf> for Op

source§

fn from(op: BrIf) -> Self

Converts to this type from the input type.
source§

impl From<BrIfNot> for Op

source§

fn from(op: BrIfNot) -> Self

Converts to this type from the input type.
source§

impl From<BrIfXeq32> for Op

source§

fn from(op: BrIfXeq32) -> Self

Converts to this type from the input type.
source§

impl From<BrIfXneq32> for Op

source§

fn from(op: BrIfXneq32) -> Self

Converts to this type from the input type.
source§

impl From<BrIfXslt32> for Op

source§

fn from(op: BrIfXslt32) -> Self

Converts to this type from the input type.
source§

impl From<BrIfXslteq32> for Op

source§

fn from(op: BrIfXslteq32) -> Self

Converts to this type from the input type.
source§

impl From<BrIfXult32> for Op

source§

fn from(op: BrIfXult32) -> Self

Converts to this type from the input type.
source§

impl From<BrIfXulteq32> for Op

source§

fn from(op: BrIfXulteq32) -> Self

Converts to this type from the input type.
source§

impl From<Call> for Op

source§

fn from(op: Call) -> Self

Converts to this type from the input type.
source§

impl From<ExtendedOp> for Op

source§

fn from(op: ExtendedOp) -> Self

Converts to this type from the input type.
source§

impl From<Fmov> for Op

source§

fn from(op: Fmov) -> Self

Converts to this type from the input type.
source§

impl From<GetSp> for Op

source§

fn from(op: GetSp) -> Self

Converts to this type from the input type.
source§

impl From<Jump> for Op

source§

fn from(op: Jump) -> Self

Converts to this type from the input type.
source§

impl From<Load32S> for Op

source§

fn from(op: Load32S) -> Self

Converts to this type from the input type.
source§

impl From<Load32SOffset8> for Op

source§

fn from(op: Load32SOffset8) -> Self

Converts to this type from the input type.
source§

impl From<Load32U> for Op

source§

fn from(op: Load32U) -> Self

Converts to this type from the input type.
source§

impl From<Load32UOffset8> for Op

source§

fn from(op: Load32UOffset8) -> Self

Converts to this type from the input type.
source§

impl From<Load64> for Op

source§

fn from(op: Load64) -> Self

Converts to this type from the input type.
source§

impl From<Load64Offset8> for Op

source§

fn from(op: Load64Offset8) -> Self

Converts to this type from the input type.
source§

impl From<Nop> for Op

source§

fn from(op: Nop) -> Self

Converts to this type from the input type.
source§

impl From<Ret> for Op

source§

fn from(op: Ret) -> Self

Converts to this type from the input type.
source§

impl From<Store32> for Op

source§

fn from(op: Store32) -> Self

Converts to this type from the input type.
source§

impl From<Store32SOffset8> for Op

source§

fn from(op: Store32SOffset8) -> Self

Converts to this type from the input type.
source§

impl From<Store64> for Op

source§

fn from(op: Store64) -> Self

Converts to this type from the input type.
source§

impl From<Store64Offset8> for Op

source§

fn from(op: Store64Offset8) -> Self

Converts to this type from the input type.
source§

impl From<Trap> for Op

source§

fn from(op: Trap) -> Self

Converts to this type from the input type.
source§

impl From<Vmov> for Op

source§

fn from(op: Vmov) -> Self

Converts to this type from the input type.
source§

impl From<Xadd32> for Op

source§

fn from(op: Xadd32) -> Self

Converts to this type from the input type.
source§

impl From<Xadd64> for Op

source§

fn from(op: Xadd64) -> Self

Converts to this type from the input type.
source§

impl From<Xconst16> for Op

source§

fn from(op: Xconst16) -> Self

Converts to this type from the input type.
source§

impl From<Xconst32> for Op

source§

fn from(op: Xconst32) -> Self

Converts to this type from the input type.
source§

impl From<Xconst64> for Op

source§

fn from(op: Xconst64) -> Self

Converts to this type from the input type.
source§

impl From<Xconst8> for Op

source§

fn from(op: Xconst8) -> Self

Converts to this type from the input type.
source§

impl From<Xeq32> for Op

source§

fn from(op: Xeq32) -> Self

Converts to this type from the input type.
source§

impl From<Xeq64> for Op

source§

fn from(op: Xeq64) -> Self

Converts to this type from the input type.
source§

impl From<Xmov> for Op

source§

fn from(op: Xmov) -> Self

Converts to this type from the input type.
source§

impl From<Xneq32> for Op

source§

fn from(op: Xneq32) -> Self

Converts to this type from the input type.
source§

impl From<Xneq64> for Op

source§

fn from(op: Xneq64) -> Self

Converts to this type from the input type.
source§

impl From<Xslt32> for Op

source§

fn from(op: Xslt32) -> Self

Converts to this type from the input type.
source§

impl From<Xslt64> for Op

source§

fn from(op: Xslt64) -> Self

Converts to this type from the input type.
source§

impl From<Xslteq32> for Op

source§

fn from(op: Xslteq32) -> Self

Converts to this type from the input type.
source§

impl From<Xslteq64> for Op

source§

fn from(op: Xslteq64) -> Self

Converts to this type from the input type.
source§

impl From<Xult32> for Op

source§

fn from(op: Xult32) -> Self

Converts to this type from the input type.
source§

impl From<Xult64> for Op

source§

fn from(op: Xult64) -> Self

Converts to this type from the input type.
source§

impl From<Xulteq32> for Op

source§

fn from(op: Xulteq32) -> Self

Converts to this type from the input type.
source§

impl From<Xulteq64> for Op

source§

fn from(op: Xulteq64) -> Self

Converts to this type from the input type.
source§

impl Hash for Op

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 Op

source§

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

This method returns an Ordering between self and other. Read more
1.21.0 · source§

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

Compares and returns the maximum of two values. Read more
1.21.0 · source§

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

Compares and returns the minimum of two values. Read more
1.50.0 · source§

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

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

impl PartialEq for Op

source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd for Op

source§

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

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · 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 · 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 · 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 · 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 Copy for Op

source§

impl Eq for Op

source§

impl StructuralPartialEq for Op

Auto Trait Implementations§

§

impl Freeze for Op

§

impl RefUnwindSafe for Op

§

impl Send for Op

§

impl Sync for Op

§

impl Unpin for Op

§

impl UnwindSafe for Op

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§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

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

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

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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,

§

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>,

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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.