Skip to main content

Operand

Enum Operand 

Source
pub enum Operand {
Show 13 variants Missing, Register(Register), Immediate(i128), Memory(Box<MemoryOperand>), Label(String), Expression(Expr), RegisterList(Vec<Register>), LiteralPoolValue(i128), VectorRegister(Register, VectorArrangement), SvePredicate(Register, SvePredQual), VectorElement(Register, ElementSize, u8), PsrField(PsrField), Shift(ShiftOp, ShiftAmount),
}
Expand description

A resolved or unresolved operand.

Variants§

§

Missing

No operand.

Fills the unused slots of an OperandList, and is what indexing past the end of one yields. Operand counts come from parsed input, so an encoder that indexes further than the instruction actually goes must produce a diagnostic rather than panic — every operand-extraction helper rejects this variant, so the error falls out naturally.

§

Register(Register)

A register operand.

§

Immediate(i128)

An immediate value.

§

Memory(Box<MemoryOperand>)

A memory (indirect) operand.

§

Label(String)

A label reference (resolved later).

§

Expression(Expr)

An expression (e.g., label + 4).

§

RegisterList(Vec<Register>)

A register list (ARM {R0, R1, R4, LR}).

§

LiteralPoolValue(i128)

A literal pool value (LDR Xn, =0x1234). The assembler will place the constant in a nearby literal pool and emit a PC-relative LDR to load it.

§

VectorRegister(Register, VectorArrangement)

A vector register with arrangement specifier (AArch64 NEON/SVE). E.g., V0.4S, V1.16B, Z0.S, Z1.D.

§

SvePredicate(Register, SvePredQual)

SVE predicate register with qualifier (P0/M, P0/Z).

§

VectorElement(Register, ElementSize, u8)

A single lane of an AArch64 vector register: V0.S[0].

Element accesses name one lane rather than an arrangement, so they carry an element size plus an index instead of a VectorArrangement.

§

PsrField(PsrField)

An ARM32 program status register with a field selector (cpsr_f, spsr_cxsf, …), as used by MSR and MRS.

§

Shift(ShiftOp, ShiftAmount)

A barrel-shift or register-extend modifier applied to the preceding operand (ARM32, Thumb, AArch64).

UAL writes these as a trailing operand — add x0, x1, x2, lsl #3 is four operands, the last being lsl #3 — so they are modelled the same way rather than being folded into the register operand. That keeps the IR shaped like the source and lets a shift attach to an immediate (movz x0, #0x5678, lsl #16) as naturally as to a register.

Trait Implementations§

Source§

impl Clone for Operand

Source§

fn clone(&self) -> Operand

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 Operand

Source§

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

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

impl Default for Operand

Source§

fn default() -> Self

The sentinel for an absent operand.

Source§

impl Display for Operand

Source§

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

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

impl PartialEq for Operand

Source§

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

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.