pub enum Op {
Show 72 variants
Ret(Ret),
Call(Call),
CallIndirect(CallIndirect),
Jump(Jump),
BrIf(BrIf),
BrIfNot(BrIfNot),
BrIfXeq32(BrIfXeq32),
BrIfXneq32(BrIfXneq32),
BrIfXslt32(BrIfXslt32),
BrIfXslteq32(BrIfXslteq32),
BrIfXult32(BrIfXult32),
BrIfXulteq32(BrIfXulteq32),
BrIfXeq64(BrIfXeq64),
BrIfXneq64(BrIfXneq64),
BrIfXslt64(BrIfXslt64),
BrIfXslteq64(BrIfXslteq64),
BrIfXult64(BrIfXult64),
BrIfXulteq64(BrIfXulteq64),
BrTable32(BrTable32),
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),
Load32UOffset64(Load32UOffset64),
Load32SOffset64(Load32SOffset64),
Load64Offset64(Load64Offset64),
Store32(Store32),
Store64(Store64),
Store32SOffset8(Store32SOffset8),
Store64Offset8(Store64Offset8),
Store32SOffset64(Store32SOffset64),
Store64Offset64(Store64Offset64),
PushFrame(PushFrame),
PopFrame(PopFrame),
XPush32(XPush32),
XPush32Many(XPush32Many),
XPush64(XPush64),
XPush64Many(XPush64Many),
XPop32(XPop32),
XPop32Many(XPop32Many),
XPop64(XPop64),
XPop64Many(XPop64Many),
BitcastIntFromFloat32(BitcastIntFromFloat32),
BitcastIntFromFloat64(BitcastIntFromFloat64),
BitcastFloatFromInt32(BitcastFloatFromInt32),
BitcastFloatFromInt64(BitcastFloatFromInt64),
StackAlloc32(StackAlloc32),
StackFree32(StackFree32),
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.
CallIndirect(CallIndirect)
Transfer control to the PC in reg
and set lr
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
.
BrIfXeq64(BrIfXeq64)
Branch if a == b
.
BrIfXneq64(BrIfXneq64)
Branch if a !=
b.
BrIfXslt64(BrIfXslt64)
Branch if signed a < b
.
BrIfXslteq64(BrIfXslteq64)
Branch if signed a <= b
.
BrIfXult64(BrIfXult64)
Branch if unsigned a < b
.
BrIfXulteq64(BrIfXulteq64)
Branch if unsigned a <= b
.
BrTable32(BrTable32)
Branch to the label indicated by idx
.
After this instruction are amt
instances of PcRelOffset
and the idx
selects which one will be branched to. The value
of idx
is clamped to amt - 1
(e.g. the last offset is the
“default” one.
Xmov(Xmov)
Move between x
registers.
Fmov(Fmov)
Move between f
registers.
Vmov(Vmov)
Move between v
registers.
Xconst8(Xconst8)
Set dst = sign_extend(imm8)
.
Xconst16(Xconst16)
Set dst = sign_extend(imm16)
.
Xconst32(Xconst32)
Set dst = sign_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)
Load32UOffset64(Load32UOffset64)
dst = zero_extend(load32(ptr + offset64))
Load32SOffset64(Load32SOffset64)
dst = sign_extend(load32(ptr + offset64))
Load64Offset64(Load64Offset64)
dst = load64(ptr + offset64)
Store32(Store32)
*ptr = low32(src)
Store64(Store64)
*ptr = src
Store32SOffset8(Store32SOffset8)
*(ptr + sign_extend(offset8)) = low32(src)
Store64Offset8(Store64Offset8)
*(ptr + sign_extend(offset8)) = src
Store32SOffset64(Store32SOffset64)
*(ptr + sign_extend(offset64)) = low32(src)
Store64Offset64(Store64Offset64)
*(ptr + sign_extend(offset64)) = src
PushFrame(PushFrame)
push lr; push fp; fp = sp
PopFrame(PopFrame)
sp = fp; pop fp; pop lr
XPush32(XPush32)
*sp = low32(src); sp = sp.checked_add(4)
XPush32Many(XPush32Many)
for src in srcs { xpush32 src }
XPush64(XPush64)
*sp = src; sp = sp.checked_add(8)
XPush64Many(XPush64Many)
for src in srcs { xpush64 src }
XPop32(XPop32)
*dst = *sp; sp -= 4
XPop32Many(XPop32Many)
for dst in dsts.rev() { xpop32 dst }
XPop64(XPop64)
*dst = *sp; sp -= 8
XPop64Many(XPop64Many)
for dst in dsts.rev() { xpop64 dst }
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
StackAlloc32(StackAlloc32)
sp = sp.checked_sub(amt)
StackFree32(StackFree32)
sp = sp + amt
ExtendedOp(ExtendedOp)
An extended operation/instruction.
Implementations§
Trait Implementations§
Source§impl<'arbitrary> Arbitrary<'arbitrary> for Op
impl<'arbitrary> Arbitrary<'arbitrary> for Op
Source§fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Self>
fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Self>
Self
from the given unstructured data. Read moreSource§fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<Self>
fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<Self>
Self
from the entirety of the given
unstructured data. Read more