Struct cranelift_codegen_shared::isa::x86::EncodingBits[][src]

pub struct EncodingBits(_);
Expand description

Named interface to the u16 Encoding bits, representing an opcode.

Cranelift requires each recipe to have a single encoding size in bytes. X86 opcodes are variable length, so we use separate recipes for different styles of opcodes and prefixes. The opcode format is indicated by the recipe name prefix.

VEX/XOP and EVEX prefixes are not yet supported. Encodings using any of these prefixes are represented by separate recipes.

The encoding bits are:

0-7: The opcode byte . 8-9: pp, mandatory prefix: 00: none (Op*) 01: 66 (Mp*) 10: F3 (Mp*) 11: F2 (Mp*) 10-11: mm, opcode map: 00: (Op1/Mp1) 01: 0F (Op2/Mp2) 10: 0F 38 (Op3/Mp3) 11: 0F 3A (Op3/Mp3) 12-14 rrr, opcode bits for the ModR/M byte for certain opcodes. 15: REX.W bit (or VEX.W/E)

Implementations

impl EncodingBits[src]

pub fn new(op_bytes: &[u8], rrr: u16, rex_w: u16) -> Self[src]

Constructs a new EncodingBits from parts.

pub fn with_rrr(self, rrr: u8) -> Self[src]

Returns a copy of the EncodingBits with the RRR bits set.

pub fn with_rex_w(self) -> Self[src]

Returns a copy of the EncodingBits with the REX.W bit set.

pub fn bits(self) -> u16[src]

Returns the raw bits.

pub fn opcode_byte(self) -> u8[src]

Instruction opcode byte, without the prefix.

pub fn prefix(self) -> OpcodePrefix[src]

Prefix kind for the instruction, as an enum.

pub fn pp(self) -> u8[src]

Extracts the PP bits of the OpcodePrefix.

pub fn mm(self) -> u8[src]

Extracts the MM bits of the OpcodePrefix.

pub fn rrr(self) -> u8[src]

Bits for the ModR/M byte for certain opcodes.

pub fn rex_w(self) -> u8[src]

REX.W bit (or VEX.W/E).

Trait Implementations

impl Clone for EncodingBits[src]

fn clone(&self) -> EncodingBits[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl From<u16> for EncodingBits[src]

fn from(bits: u16) -> Self[src]

Performs the conversion.

impl PartialEq<EncodingBits> for EncodingBits[src]

fn eq(&self, other: &EncodingBits) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, other: &EncodingBits) -> bool[src]

This method tests for !=.

impl Copy for EncodingBits[src]

impl StructuralPartialEq for EncodingBits[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.