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

pub struct EncodingBits {
    pub opcode_byte: u8,
    pub prefix: OpcodePrefix,
    pub rrr: Integer<u8, Bits3>,
    pub rex_w: Integer<u8, Bits1>,
}

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)

Fields

opcode_byte: u8

Instruction opcode byte, without the prefix.

prefix: OpcodePrefix

Prefix kind for the instruction, as an enum.

rrr: Integer<u8, Bits3>

Bits for the ModR/M byte for certain opcodes.

rex_w: Integer<u8, Bits1>

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

Methods

impl EncodingBits[src]

pub fn packed_struct_display_formatter<'a>(
    &'a self
) -> PackedStructDisplay<'a, Self, [u8; 2]>
[src]

Display formatter for console applications

impl EncodingBits[src]

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

Constructs a new EncodingBits from parts.

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

Returns the raw bits.

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.

Trait Implementations

impl From<u16> for EncodingBits[src]

impl Clone for EncodingBits[src]

impl Copy for EncodingBits[src]

impl PartialEq<EncodingBits> for EncodingBits[src]

impl Display for EncodingBits[src]

impl StructuralPartialEq for EncodingBits[src]

impl PackedStruct<[u8; 2]> for EncodingBits[src]

Structure that can be packed an unpacked into 2 bytes.

Bit, MSB0NameType
8:15opcode_byteu8
4:7prefixOpcodePrefix
1:3rrrInteger < u8 , packed_bits :: Bits3 >
0rex_wInteger < u8 , packed_bits :: Bits1 >

impl PackedStructInfo for EncodingBits[src]

impl PackedStructSlice for EncodingBits[src]

impl PackedStructDebug for EncodingBits[src]

Auto Trait Implementations

Blanket Implementations

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

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

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

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

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.

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

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

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