FastFormatter

class iced_x86.FastFormatter

Fast formatter with less formatting options and with a masm-like syntax.

Use it if formatting speed is more important than being able to re-assemble formatted instructions.

This formatter is ~1.25x faster than the other formatters (the time includes decoding + formatting).

Examples:

from iced_x86 import *

data = b"\x62\xF2\x4F\xDD\x72\x50\x01"
decoder = Decoder(64, data)
instr = decoder.decode()

formatter = FastFormatter()
formatter.space_after_operand_separator = True
disasm = formatter.format(instr)
assert disasm == "vcvtne2ps2bf16 zmm2{k5}{z}, zmm6, dword bcst [rax+4h]"
always_show_memory_size

Always show the size of memory operands

Default

Value

Example

Example

True

mov eax,dword ptr [ebx]

add byte ptr [eax],0x12

👍

False

mov eax,[ebx]

add byte ptr [eax],0x12

Type:

bool

always_show_segment_register

Always show the effective segment register.

If the option is False, only show the segment register if there’s a segment override prefix.

Default

Value

Example

True

mov eax,ds:[ecx]

👍

False

mov eax,[ecx]

Type:

bool

format(instruction)

Formats the whole instruction: prefixes, mnemonic, operands

Parameters:

instruction (Instruction) – Instruction to format

Returns:

The formatted string

Return type:

str

rip_relative_addresses

Show RIP+displ or the virtual address

Default

Value

Example

True

mov eax,[rip+12345678h]

👍

False

mov eax,[1029384756AFBECDh]

Type:

bool

show_symbol_address

Show the original value after the symbol name

Default

Value

Example

True

mov eax,[myfield (12345678)]

👍

False

mov eax,[myfield]

Type:

bool

space_after_operand_separator

Add a space after the operand separator

Default

Value

Example

True

mov rax, rcx

👍

False

mov rax,rcx

Type:

bool

uppercase_hex

Use uppercase hex digits

Default

Value

Example

👍

True

0xFF

False

0xff

Type:

bool

use_hex_prefix

Use a hex prefix (0x) or a hex suffix (h)

Default

Value

Example

True

0x5A

👍

False

5Ah

Type:

bool

use_pseudo_ops

Use pseudo instructions

Default

Value

Example

👍

True

vcmpnltsd xmm2,xmm6,xmm3

False

vcmpsd xmm2,xmm6,xmm3,5

Type:

bool