Struct Inst

Source
pub struct Inst {
    pub mnemonic: String,
    pub format: Format,
    pub encoding: Encoding,
    pub features: Features,
}
Expand description

An x64 instruction.

Use inst to construct this within the instructions module. This structure is designed to represent all of the information for one instruction (a table row) in the x64 Instruction Set Reference or at least enough to generate code to emit the instruction.

Fields§

§mnemonic: String

The instruction name as represented in the x64 reference manual. This is the pretty-printed name used for disassembly. Multiple instructions may have the same mnemonic, though; the combination of this field and the format name must be unique (see Inst::name).

§format: Format

The instruction operands, typically represented in the “Instruction” column of the x64 reference manual.

§encoding: Encoding

The instruction encoding, typically represented in the “Opcode” column of the x64 reference manual.

§features: Features

The CPU features required to use this instruction; this combines the “64-bit/32-bit Mode Support” and “CPUID Feature Flag” columns of the x64 reference manual.

Implementations§

Source§

impl Inst

Source

pub fn name(&self) -> String

The unique name for this instruction.

To avoid ambiguity, this name combines the instruction mnemonic and the format name in snake case. This is used in generated code to name the instruction struct and builder functions.

In rare cases, this <mnemonic>_<format> scheme does not uniquely identify an instruction in x64 ISA (e.g., some extended versions, VEX/EVEX). In these cases, we append a minimal identifier to the format name (e.g., sx*) to keep this unique.

Source§

impl Inst

Source

pub fn generate_struct(&self, f: &mut Formatter)

struct <inst> { <op>: Reg, <op>: Reg, ... }

Source

pub fn generate_struct_impl(&self, f: &mut Formatter)

impl <inst> { ... }

Source

pub fn generate_new_function(&self, f: &mut Formatter)

Source

pub fn generate_display_impl(&self, f: &mut Formatter)

impl Display for <inst> { ... }

Source

pub fn generate_from_impl(&self, f: &mut Formatter)

impl From<struct> for Inst { ... }

Trait Implementations§

Source§

impl Display for Inst

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Inst

§

impl RefUnwindSafe for Inst

§

impl Send for Inst

§

impl Sync for Inst

§

impl Unpin for Inst

§

impl UnwindSafe for Inst

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