pub struct EncoderRequest {
pub mnemonic: Mnemonic,
pub operands: [EncoderOperand; 5],
pub operand_count: u8,
pub operand_size: u8,
pub address_size: u8,
pub mask_reg: Option<Register>,
pub zeroing_mode: EvexZeroingMode,
pub preferred_encoding: Option<EncodableEncoding>,
pub branch_type: BranchType,
pub branch_width: BranchWidth,
pub hints: EncoderHints,
}Expand description
Request to encode an x86/x64 instruction
This structure contains all the information needed to encode an instruction, including the mnemonic, operands, and size overrides.
Fields§
§mnemonic: MnemonicThe instruction mnemonic
operands: [EncoderOperand; 5]Operands for the instruction
operand_count: u8Number of valid operands
operand_size: u8Effective operand size override (0 = default, 16/32/64 = override)
address_size: u8Effective address size override (0 = default, 16/32/64 = override)
mask_reg: Option<Register>Mask register for AVX-512 (k0-k7), None for no masking
zeroing_mode: EvexZeroingModeZeroing mode for AVX-512 masked operations
preferred_encoding: Option<EncodableEncoding>Preferred encoding type (None = auto-select)
branch_type: BranchTypeBranch type (None = auto-select, Short/Near/Far = explicit)
branch_width: BranchWidthBranch width (None = auto-select based on offset)
hints: EncoderHintsEncoder hints for advanced features
Implementations§
Source§impl EncoderRequest
impl EncoderRequest
Sourcepub fn with_operand(self, operand: EncoderOperand) -> Self
pub fn with_operand(self, operand: EncoderOperand) -> Self
Add an operand to the request
Operands are added in order. Up to MAX_ENCODER_OPERANDS operands can be added.
Sourcepub fn with_mem(self, memory: MemoryOperand) -> Self
pub fn with_mem(self, memory: MemoryOperand) -> Self
Add a memory operand
Sourcepub fn with_operand_size(self, size: u16) -> Self
pub fn with_operand_size(self, size: u16) -> Self
Set the operand size override (16, 32, or 64 bits)
Sourcepub fn with_address_size(self, size: u16) -> Self
pub fn with_address_size(self, size: u16) -> Self
Set the address size override (16, 32, or 64 bits)
Sourcepub fn with_mask(self, mask: Register) -> Self
pub fn with_mask(self, mask: Register) -> Self
Set the mask register for AVX-512 operations (k0-k7)
Sourcepub fn with_zeroing(self, zeroing: EvexZeroingMode) -> Self
pub fn with_zeroing(self, zeroing: EvexZeroingMode) -> Self
Set the zeroing mode for AVX-512 masked operations
Sourcepub fn with_zeroing_enabled(self) -> Self
pub fn with_zeroing_enabled(self) -> Self
Enable zeroing mode (convenience method)
Sourcepub fn with_encoding(self, encoding: EncodableEncoding) -> Self
pub fn with_encoding(self, encoding: EncodableEncoding) -> Self
Set the preferred encoding type
Sourcepub fn with_branch_type(self, branch_type: BranchType) -> Self
pub fn with_branch_type(self, branch_type: BranchType) -> Self
Set the branch type (Short, Near, Far)
Sourcepub fn with_branch_width(self, branch_width: BranchWidth) -> Self
pub fn with_branch_width(self, branch_width: BranchWidth) -> Self
Set the branch width
Sourcepub fn with_broadcast(self, mode: BroadcastMode) -> Self
pub fn with_broadcast(self, mode: BroadcastMode) -> Self
Set broadcast mode for AVX-512
Sourcepub fn with_rounding(self, mode: RoundingMode) -> Self
pub fn with_rounding(self, mode: RoundingMode) -> Self
Set rounding mode for AVX-512
Sourcepub fn with_hints(self, hints: EncoderHints) -> Self
pub fn with_hints(self, hints: EncoderHints) -> Self
Set encoder hints
Sourcepub const fn is_zeroing(&self) -> bool
pub const fn is_zeroing(&self) -> bool
Check if zeroing mode is enabled
Sourcepub const fn has_preferred_encoding(&self) -> bool
pub const fn has_preferred_encoding(&self) -> bool
Check if a specific encoding is requested
Sourcepub const fn has_broadcast(&self) -> bool
pub const fn has_broadcast(&self) -> bool
Check if broadcast mode is enabled
Sourcepub const fn has_rounding(&self) -> bool
pub const fn has_rounding(&self) -> bool
Check if rounding mode is specified
Sourcepub const fn has_branch_type(&self) -> bool
pub const fn has_branch_type(&self) -> bool
Check if a specific branch type is requested
Sourcepub fn from_decoded(instruction: &DecodedInstruction) -> Self
pub fn from_decoded(instruction: &DecodedInstruction) -> Self
Create from a decoded instruction
This is useful for re-encoding a decoded instruction, possibly with modifications.
Sourcepub fn operand(&self, index: usize) -> Option<&EncoderOperand>
pub fn operand(&self, index: usize) -> Option<&EncoderOperand>
Get an operand by index
Sourcepub fn operands(&self) -> impl Iterator<Item = &EncoderOperand>
pub fn operands(&self) -> impl Iterator<Item = &EncoderOperand>
Iterate over valid operands
Sourcepub const fn has_operands(&self) -> bool
pub const fn has_operands(&self) -> bool
Check if the request has any operands
Sourcepub const fn has_operand_size_override(&self) -> bool
pub const fn has_operand_size_override(&self) -> bool
Check if the request has an operand size override
Sourcepub const fn has_address_size_override(&self) -> bool
pub const fn has_address_size_override(&self) -> bool
Check if the request has an address size override
Sourcepub fn has_memory_operand(&self) -> bool
pub fn has_memory_operand(&self) -> bool
Check if any operand is a memory operand
Sourcepub fn has_immediate_operand(&self) -> bool
pub fn has_immediate_operand(&self) -> bool
Check if any operand is an immediate
Sourcepub fn has_relative_operand(&self) -> bool
pub fn has_relative_operand(&self) -> bool
Check if any operand is a relative offset
Sourcepub fn has_zmm_operand(&self) -> bool
pub fn has_zmm_operand(&self) -> bool
Check if any operand is a ZMM register (for AVX-512 detection)
Sourcepub fn clear_operands(&mut self)
pub fn clear_operands(&mut self)
Clear all operands
Trait Implementations§
Source§impl Clone for EncoderRequest
impl Clone for EncoderRequest
Source§fn clone(&self) -> EncoderRequest
fn clone(&self) -> EncoderRequest
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more