pub struct Inst { /* private fields */ }Expand description
A generic instruction: id + options + extra register + inline operand array.
The id is architecture-namespaced (x86::InstId, aarch64::InstId, riscv::Opcode,
all cast to u32); architectures may pack modifiers into high bits of the id (AArch64
packs a super::globals::CondCode). extra_reg carries the REP register or AVX-512
{k} selector where applicable and is Operand::new() (none) otherwise.
Implementations§
Source§impl Inst
impl Inst
Sourcepub fn for_arch(arch: Arch, id: u32) -> Result<Self, AsmError>
pub fn for_arch(arch: Arch, id: u32) -> Result<Self, AsmError>
Creates an architecture-tagged instruction without operands.
Sourcepub fn with_arch_operands(
arch: Arch,
id: u32,
ops: &[Operand],
) -> Result<Self, AsmError>
pub fn with_arch_operands( arch: Arch, id: u32, ops: &[Operand], ) -> Result<Self, AsmError>
Creates an architecture-tagged instruction without dropping operands.
Sourcepub const fn options(&self) -> InstOptions
pub const fn options(&self) -> InstOptions
Encoding options retained by deferred replay.
Sourcepub fn set_options(&mut self, options: InstOptions)
pub fn set_options(&mut self, options: InstOptions)
Sets encoding options retained by deferred replay.
Sourcepub fn set_extra_reg(&mut self, extra_reg: Operand)
pub fn set_extra_reg(&mut self, extra_reg: Operand)
Sets the optional extra register retained by deferred replay.
Sourcepub fn operands_mut(&mut self) -> &mut [Operand]
pub fn operands_mut(&mut self) -> &mut [Operand]
Returns the operands as a mutable slice.
Sourcepub fn operand(&self, index: usize) -> Option<&Operand>
pub fn operand(&self, index: usize) -> Option<&Operand>
Returns the operand at index, or None if out of range.
Sourcepub fn set_operand(&mut self, index: usize, op: Operand) -> Result<(), AsmError>
pub fn set_operand(&mut self, index: usize, op: Operand) -> Result<(), AsmError>
Sets the operand at index. index must be less than op_count.
Sourcepub fn add_operand(&mut self, op: Operand) -> Result<(), AsmError>
pub fn add_operand(&mut self, op: Operand) -> Result<(), AsmError>
Appends an operand, or returns AsmError::InvalidState if the operand array is full.
Sourcepub fn set_operands(&mut self, ops: &[Operand]) -> Result<(), AsmError>
pub fn set_operands(&mut self, ops: &[Operand]) -> Result<(), AsmError>
Sets all operands from ops, replacing the current operand list.
Returns AsmError::InvalidState if ops doesn’t fit into the operand array.