Enum Instruction

Source
#[repr(u16)]
pub enum Instruction {
Show 32 variants Nop { length: NonZero<u32>, }, SetPrivate_Label { label: Label, }, SetPublic_Label { label: Label, }, Ret, Mov_RegImm64 { dst: GPR, src: Immediate64, }, Mov_RegImm { dst: GPR, src: Immediate, }, Mov_MemImm { dst: Memory, src: Immediate, }, Mov_RegReg { dst: GPR, src: GPR, }, Mov_MemReg { dst: Memory, src: GPR, }, Mov_RegMem { dst: GPR, src: Memory, }, Add_RegImm { dst: GPR, src: Immediate, }, Add_MemImm { dst: Memory, src: Immediate, }, Add_RegReg { dst: GPR, src: GPR, }, Add_MemReg { dst: Memory, src: GPR, }, Add_RegMem { dst: GPR, src: Memory, }, Sub_RegImm { dst: GPR, src: Immediate, }, Sub_MemImm { dst: Memory, src: Immediate, }, Sub_RegReg { dst: GPR, src: GPR, }, Sub_MemReg { dst: Memory, src: GPR, }, Sub_RegMem { dst: GPR, src: Memory, }, Xor_RegImm { dst: GPR, src: Immediate, }, Xor_MemImm { dst: Memory, src: Immediate, }, Xor_RegReg { dst: GPR, src: GPR, }, Xor_MemReg { dst: Memory, src: GPR, }, Xor_RegMem { dst: GPR, src: Memory, }, Jump_Label { dst: Label, }, Jump_Reg { dst: GPR, }, Jump_Mem { dst: Memory, }, Call_Label { dst: Label, }, Call_Reg { dst: GPR, }, Call_Mem { dst: Memory, }, CondJump_Label { condition: Condition, dst: Label, },
}
Expand description

Represents custom assembly language instructions.

Variants§

§

Nop

nop extended to specified length

Fields

§length: NonZero<u32>
§

SetPrivate_Label

Pseudoinstruction: sets label at current position. “Private” means that the label won’t be visible outside the compiled code.

Fields

§label: Label
§

SetPublic_Label

Pseudoinstruction: sets label at current position. “Public” means that the label will be visible and reachable from outside the compiled code.

Fields

§label: Label
§

Ret

ret

§

Mov_RegImm64

mov reg, imm64

§Notes

The only instruction that uses 64-bit immediate.

Fields

§dst: GPR
§

Mov_RegImm

mov reg, imm

Fields

§dst: GPR
§

Mov_MemImm

mov [mem], imm

Fields

§

Mov_RegReg

mov reg, reg

Fields

§dst: GPR
§src: GPR
§

Mov_MemReg

mov [mem], reg

Fields

§src: GPR
§

Mov_RegMem

mov reg, [mem]

Fields

§dst: GPR
§

Add_RegImm

add reg, imm

Fields

§dst: GPR
§

Add_MemImm

add [mem], imm

Fields

§

Add_RegReg

add reg, reg

Fields

§dst: GPR
§src: GPR
§

Add_MemReg

add [mem], reg

Fields

§src: GPR
§

Add_RegMem

add reg, [mem]

Fields

§dst: GPR
§

Sub_RegImm

sub reg, imm

Fields

§dst: GPR
§

Sub_MemImm

sub [mem], imm

Fields

§

Sub_RegReg

sub reg, reg

Fields

§dst: GPR
§src: GPR
§

Sub_MemReg

sub [mem], reg

Fields

§src: GPR
§

Sub_RegMem

sub reg, [mem]

Fields

§dst: GPR
§

Xor_RegImm

xor reg, imm

Fields

§dst: GPR
§

Xor_MemImm

xor [mem], imm

Fields

§

Xor_RegReg

xor reg, reg

Fields

§dst: GPR
§src: GPR
§

Xor_MemReg

xor [mem], reg

Fields

§src: GPR
§

Xor_RegMem

xor reg, [mem]

Fields

§dst: GPR
§

Jump_Label

Pseudoinstruction: jumps to label.

Fields

§dst: Label
§

Jump_Reg

jmp reg

Fields

§dst: GPR
§

Jump_Mem

jmp [mem]

Fields

§

Call_Label

Pseudoinstruction: calls label.

Fields

§dst: Label
§

Call_Reg

call reg

Fields

§dst: GPR
§

Call_Mem

call [mem]

Fields

§

CondJump_Label

Pseudoinstruction: conditionally jumps to label.

Fields

§condition: Condition
§dst: Label

Trait Implementations§

Source§

impl Clone for Instruction

Source§

fn clone(&self) -> Instruction

Returns a duplicate of the value. Read more
1.0.0 · Source§

const 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 Hash for Instruction

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

const 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 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, 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 = 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.