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

pub struct EncodingBits(_);

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)

Methods

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]

impl Copy for EncodingBits[src]

impl From<u16> for EncodingBits[src]

impl PartialEq<EncodingBits> for EncodingBits[src]

impl StructuralPartialEq for EncodingBits[src]

Auto Trait Implementations

Blanket Implementations

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

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

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

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

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

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

type Owned = T

The resulting type after obtaining ownership.

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.

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.