polkavm_common::program

Enum Instruction

Source
#[repr(u32)]
pub enum Instruction {
Show 141 variants trap = 0, fallthrough = 17, jump_indirect(RawReg, u32), load_imm(RawReg, u32), load_u8(RawReg, u32), load_i8(RawReg, u32), load_u16(RawReg, u32), load_i16(RawReg, u32), load_i32(RawReg, u32), load_u32(RawReg, u32), load_u64(RawReg, u32), store_u8(RawReg, u32), store_u16(RawReg, u32), store_u32(RawReg, u32), store_u64(RawReg, u32), load_imm_and_jump(RawReg, u32, u32), branch_eq_imm(RawReg, u32, u32), branch_not_eq_imm(RawReg, u32, u32), branch_less_unsigned_imm(RawReg, u32, u32), branch_less_signed_imm(RawReg, u32, u32), branch_greater_or_equal_unsigned_imm(RawReg, u32, u32), branch_greater_or_equal_signed_imm(RawReg, u32, u32), branch_less_or_equal_signed_imm(RawReg, u32, u32), branch_less_or_equal_unsigned_imm(RawReg, u32, u32), branch_greater_signed_imm(RawReg, u32, u32), branch_greater_unsigned_imm(RawReg, u32, u32), store_imm_indirect_u8(RawReg, u32, u32), store_imm_indirect_u16(RawReg, u32, u32), store_imm_indirect_u32(RawReg, u32, u32), store_imm_indirect_u64(RawReg, u32, u32), store_indirect_u8(RawReg, RawReg, u32), store_indirect_u16(RawReg, RawReg, u32), store_indirect_u32(RawReg, RawReg, u32), store_indirect_u64(RawReg, RawReg, u32), load_indirect_u8(RawReg, RawReg, u32), load_indirect_i8(RawReg, RawReg, u32), load_indirect_u16(RawReg, RawReg, u32), load_indirect_i16(RawReg, RawReg, u32), load_indirect_i32(RawReg, RawReg, u32), load_indirect_u32(RawReg, RawReg, u32), load_indirect_u64(RawReg, RawReg, u32), add_imm_32(RawReg, RawReg, u32), add_imm_64(RawReg, RawReg, u32), and_imm(RawReg, RawReg, u32), xor_imm(RawReg, RawReg, u32), or_imm(RawReg, RawReg, u32), mul_imm_32(RawReg, RawReg, u32), mul_imm_64(RawReg, RawReg, u32), set_less_than_unsigned_imm(RawReg, RawReg, u32), set_less_than_signed_imm(RawReg, RawReg, u32), shift_logical_left_imm_32(RawReg, RawReg, u32), shift_logical_left_imm_64(RawReg, RawReg, u32), shift_logical_right_imm_32(RawReg, RawReg, u32), shift_logical_right_imm_64(RawReg, RawReg, u32), shift_arithmetic_right_imm_32(RawReg, RawReg, u32), shift_arithmetic_right_imm_64(RawReg, RawReg, u32), negate_and_add_imm_32(RawReg, RawReg, u32), negate_and_add_imm_64(RawReg, RawReg, u32), set_greater_than_unsigned_imm(RawReg, RawReg, u32), set_greater_than_signed_imm(RawReg, RawReg, u32), shift_logical_right_imm_alt_32(RawReg, RawReg, u32), shift_logical_right_imm_alt_64(RawReg, RawReg, u32), shift_arithmetic_right_imm_alt_32(RawReg, RawReg, u32), shift_arithmetic_right_imm_alt_64(RawReg, RawReg, u32), shift_logical_left_imm_alt_32(RawReg, RawReg, u32), shift_logical_left_imm_alt_64(RawReg, RawReg, u32), cmov_if_zero_imm(RawReg, RawReg, u32), cmov_if_not_zero_imm(RawReg, RawReg, u32), rotate_right_32_imm(RawReg, RawReg, u32), rotate_right_32_imm_alt(RawReg, RawReg, u32), rotate_right_64_imm(RawReg, RawReg, u32), rotate_right_64_imm_alt(RawReg, RawReg, u32), branch_eq(RawReg, RawReg, u32), branch_not_eq(RawReg, RawReg, u32), branch_less_unsigned(RawReg, RawReg, u32), branch_less_signed(RawReg, RawReg, u32), branch_greater_or_equal_unsigned(RawReg, RawReg, u32), branch_greater_or_equal_signed(RawReg, RawReg, u32), add_32(RawReg, RawReg, RawReg), add_64(RawReg, RawReg, RawReg), sub_32(RawReg, RawReg, RawReg), sub_64(RawReg, RawReg, RawReg), and(RawReg, RawReg, RawReg), xor(RawReg, RawReg, RawReg), or(RawReg, RawReg, RawReg), mul_32(RawReg, RawReg, RawReg), mul_64(RawReg, RawReg, RawReg), mul_upper_signed_signed(RawReg, RawReg, RawReg), mul_upper_unsigned_unsigned(RawReg, RawReg, RawReg), mul_upper_signed_unsigned(RawReg, RawReg, RawReg), set_less_than_unsigned(RawReg, RawReg, RawReg), set_less_than_signed(RawReg, RawReg, RawReg), shift_logical_left_32(RawReg, RawReg, RawReg), shift_logical_left_64(RawReg, RawReg, RawReg), shift_logical_right_32(RawReg, RawReg, RawReg), shift_logical_right_64(RawReg, RawReg, RawReg), shift_arithmetic_right_32(RawReg, RawReg, RawReg), shift_arithmetic_right_64(RawReg, RawReg, RawReg), div_unsigned_32(RawReg, RawReg, RawReg), div_unsigned_64(RawReg, RawReg, RawReg), div_signed_32(RawReg, RawReg, RawReg), div_signed_64(RawReg, RawReg, RawReg), rem_unsigned_32(RawReg, RawReg, RawReg), rem_unsigned_64(RawReg, RawReg, RawReg), rem_signed_32(RawReg, RawReg, RawReg), rem_signed_64(RawReg, RawReg, RawReg), cmov_if_zero(RawReg, RawReg, RawReg), cmov_if_not_zero(RawReg, RawReg, RawReg), and_inverted(RawReg, RawReg, RawReg), or_inverted(RawReg, RawReg, RawReg), xnor(RawReg, RawReg, RawReg), maximum(RawReg, RawReg, RawReg), maximum_unsigned(RawReg, RawReg, RawReg), minimum(RawReg, RawReg, RawReg), minimum_unsigned(RawReg, RawReg, RawReg), rotate_left_32(RawReg, RawReg, RawReg), rotate_left_64(RawReg, RawReg, RawReg), rotate_right_32(RawReg, RawReg, RawReg), rotate_right_64(RawReg, RawReg, RawReg), jump(u32), ecalli(u32), store_imm_u8(u32, u32), store_imm_u16(u32, u32), store_imm_u32(u32, u32), store_imm_u64(u32, u32), move_reg(RawReg, RawReg), sbrk(RawReg, RawReg), count_leading_zero_bits_32(RawReg, RawReg), count_leading_zero_bits_64(RawReg, RawReg), count_trailing_zero_bits_32(RawReg, RawReg), count_trailing_zero_bits_64(RawReg, RawReg), count_set_bits_32(RawReg, RawReg), count_set_bits_64(RawReg, RawReg), sign_extend_8(RawReg, RawReg), sign_extend_16(RawReg, RawReg), zero_extend_16(RawReg, RawReg), or_combine_byte(RawReg, RawReg), reverse_byte(RawReg, RawReg), load_imm_and_jump_indirect(RawReg, RawReg, u32, u32), load_imm64(RawReg, u64), invalid = 256,
}

Variants§

§

trap = 0

§

fallthrough = 17

§

jump_indirect(RawReg, u32)

§

load_imm(RawReg, u32)

§

load_u8(RawReg, u32)

§

load_i8(RawReg, u32)

§

load_u16(RawReg, u32)

§

load_i16(RawReg, u32)

§

load_i32(RawReg, u32)

§

load_u32(RawReg, u32)

§

load_u64(RawReg, u32)

§

store_u8(RawReg, u32)

§

store_u16(RawReg, u32)

§

store_u32(RawReg, u32)

§

store_u64(RawReg, u32)

§

load_imm_and_jump(RawReg, u32, u32)

§

branch_eq_imm(RawReg, u32, u32)

§

branch_not_eq_imm(RawReg, u32, u32)

§

branch_less_unsigned_imm(RawReg, u32, u32)

§

branch_less_signed_imm(RawReg, u32, u32)

§

branch_greater_or_equal_unsigned_imm(RawReg, u32, u32)

§

branch_greater_or_equal_signed_imm(RawReg, u32, u32)

§

branch_less_or_equal_signed_imm(RawReg, u32, u32)

§

branch_less_or_equal_unsigned_imm(RawReg, u32, u32)

§

branch_greater_signed_imm(RawReg, u32, u32)

§

branch_greater_unsigned_imm(RawReg, u32, u32)

§

store_imm_indirect_u8(RawReg, u32, u32)

§

store_imm_indirect_u16(RawReg, u32, u32)

§

store_imm_indirect_u32(RawReg, u32, u32)

§

store_imm_indirect_u64(RawReg, u32, u32)

§

store_indirect_u8(RawReg, RawReg, u32)

§

store_indirect_u16(RawReg, RawReg, u32)

§

store_indirect_u32(RawReg, RawReg, u32)

§

store_indirect_u64(RawReg, RawReg, u32)

§

load_indirect_u8(RawReg, RawReg, u32)

§

load_indirect_i8(RawReg, RawReg, u32)

§

load_indirect_u16(RawReg, RawReg, u32)

§

load_indirect_i16(RawReg, RawReg, u32)

§

load_indirect_i32(RawReg, RawReg, u32)

§

load_indirect_u32(RawReg, RawReg, u32)

§

load_indirect_u64(RawReg, RawReg, u32)

§

add_imm_32(RawReg, RawReg, u32)

§

add_imm_64(RawReg, RawReg, u32)

§

and_imm(RawReg, RawReg, u32)

§

xor_imm(RawReg, RawReg, u32)

§

or_imm(RawReg, RawReg, u32)

§

mul_imm_32(RawReg, RawReg, u32)

§

mul_imm_64(RawReg, RawReg, u32)

§

set_less_than_unsigned_imm(RawReg, RawReg, u32)

§

set_less_than_signed_imm(RawReg, RawReg, u32)

§

shift_logical_left_imm_32(RawReg, RawReg, u32)

§

shift_logical_left_imm_64(RawReg, RawReg, u32)

§

shift_logical_right_imm_32(RawReg, RawReg, u32)

§

shift_logical_right_imm_64(RawReg, RawReg, u32)

§

shift_arithmetic_right_imm_32(RawReg, RawReg, u32)

§

shift_arithmetic_right_imm_64(RawReg, RawReg, u32)

§

negate_and_add_imm_32(RawReg, RawReg, u32)

§

negate_and_add_imm_64(RawReg, RawReg, u32)

§

set_greater_than_unsigned_imm(RawReg, RawReg, u32)

§

set_greater_than_signed_imm(RawReg, RawReg, u32)

§

shift_logical_right_imm_alt_32(RawReg, RawReg, u32)

§

shift_logical_right_imm_alt_64(RawReg, RawReg, u32)

§

shift_arithmetic_right_imm_alt_32(RawReg, RawReg, u32)

§

shift_arithmetic_right_imm_alt_64(RawReg, RawReg, u32)

§

shift_logical_left_imm_alt_32(RawReg, RawReg, u32)

§

shift_logical_left_imm_alt_64(RawReg, RawReg, u32)

§

cmov_if_zero_imm(RawReg, RawReg, u32)

§

cmov_if_not_zero_imm(RawReg, RawReg, u32)

§

rotate_right_32_imm(RawReg, RawReg, u32)

§

rotate_right_32_imm_alt(RawReg, RawReg, u32)

§

rotate_right_64_imm(RawReg, RawReg, u32)

§

rotate_right_64_imm_alt(RawReg, RawReg, u32)

§

branch_eq(RawReg, RawReg, u32)

§

branch_not_eq(RawReg, RawReg, u32)

§

branch_less_unsigned(RawReg, RawReg, u32)

§

branch_less_signed(RawReg, RawReg, u32)

§

branch_greater_or_equal_unsigned(RawReg, RawReg, u32)

§

branch_greater_or_equal_signed(RawReg, RawReg, u32)

§

add_32(RawReg, RawReg, RawReg)

§

add_64(RawReg, RawReg, RawReg)

§

sub_32(RawReg, RawReg, RawReg)

§

sub_64(RawReg, RawReg, RawReg)

§

and(RawReg, RawReg, RawReg)

§

xor(RawReg, RawReg, RawReg)

§

or(RawReg, RawReg, RawReg)

§

mul_32(RawReg, RawReg, RawReg)

§

mul_64(RawReg, RawReg, RawReg)

§

mul_upper_signed_signed(RawReg, RawReg, RawReg)

§

mul_upper_unsigned_unsigned(RawReg, RawReg, RawReg)

§

mul_upper_signed_unsigned(RawReg, RawReg, RawReg)

§

set_less_than_unsigned(RawReg, RawReg, RawReg)

§

set_less_than_signed(RawReg, RawReg, RawReg)

§

shift_logical_left_32(RawReg, RawReg, RawReg)

§

shift_logical_left_64(RawReg, RawReg, RawReg)

§

shift_logical_right_32(RawReg, RawReg, RawReg)

§

shift_logical_right_64(RawReg, RawReg, RawReg)

§

shift_arithmetic_right_32(RawReg, RawReg, RawReg)

§

shift_arithmetic_right_64(RawReg, RawReg, RawReg)

§

div_unsigned_32(RawReg, RawReg, RawReg)

§

div_unsigned_64(RawReg, RawReg, RawReg)

§

div_signed_32(RawReg, RawReg, RawReg)

§

div_signed_64(RawReg, RawReg, RawReg)

§

rem_unsigned_32(RawReg, RawReg, RawReg)

§

rem_unsigned_64(RawReg, RawReg, RawReg)

§

rem_signed_32(RawReg, RawReg, RawReg)

§

rem_signed_64(RawReg, RawReg, RawReg)

§

cmov_if_zero(RawReg, RawReg, RawReg)

§

cmov_if_not_zero(RawReg, RawReg, RawReg)

§

and_inverted(RawReg, RawReg, RawReg)

§

or_inverted(RawReg, RawReg, RawReg)

§

xnor(RawReg, RawReg, RawReg)

§

maximum(RawReg, RawReg, RawReg)

§

maximum_unsigned(RawReg, RawReg, RawReg)

§

minimum(RawReg, RawReg, RawReg)

§

minimum_unsigned(RawReg, RawReg, RawReg)

§

rotate_left_32(RawReg, RawReg, RawReg)

§

rotate_left_64(RawReg, RawReg, RawReg)

§

rotate_right_32(RawReg, RawReg, RawReg)

§

rotate_right_64(RawReg, RawReg, RawReg)

§

jump(u32)

§

ecalli(u32)

§

store_imm_u8(u32, u32)

§

store_imm_u16(u32, u32)

§

store_imm_u32(u32, u32)

§

store_imm_u64(u32, u32)

§

move_reg(RawReg, RawReg)

§

sbrk(RawReg, RawReg)

§

count_leading_zero_bits_32(RawReg, RawReg)

§

count_leading_zero_bits_64(RawReg, RawReg)

§

count_trailing_zero_bits_32(RawReg, RawReg)

§

count_trailing_zero_bits_64(RawReg, RawReg)

§

count_set_bits_32(RawReg, RawReg)

§

count_set_bits_64(RawReg, RawReg)

§

sign_extend_8(RawReg, RawReg)

§

sign_extend_16(RawReg, RawReg)

§

zero_extend_16(RawReg, RawReg)

§

or_combine_byte(RawReg, RawReg)

§

reverse_byte(RawReg, RawReg)

§

load_imm_and_jump_indirect(RawReg, RawReg, u32, u32)

§

load_imm64(RawReg, u64)

§

invalid = 256

Implementations§

Source§

impl Instruction

Source

pub fn visit<T>(self, visitor: &mut T) -> T::ReturnTy

Source

pub fn serialize_into(self, position: u32, buffer: &mut [u8]) -> usize

Source

pub fn opcode(self) -> Opcode

Source§

impl Instruction

Source

pub fn display<'a>(self, format: &'a InstructionFormat<'a>) -> impl Display + 'a

Source

pub fn starts_new_basic_block(self) -> bool

Trait Implementations§

Source§

impl Clone for Instruction

Source§

fn clone(&self) -> Instruction

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 Instruction

Source§

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

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

impl Display for Instruction

Source§

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

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

impl PartialEq for Instruction

Source§

fn eq(&self, other: &Instruction) -> 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 Copy for Instruction

Source§

impl Eq for Instruction

Source§

impl StructuralPartialEq for Instruction

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> CloneToUninit for T
where T: Clone,

Source§

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

🔬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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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

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.