Skip to content

Operands

operands

Classes:

AddressingInfo dataclass

AddressingInfo(
    addressing_type: str,
    formatted_string: Optional[str] = None,
    address: Optional[ea_t] = None,
    symbol_name: Optional[str] = None,
    phrase_number: Optional[int] = None,
    displacement: Optional[int] = None,
    outer_displacement: Optional[int] = None,
    has_outer_displacement: bool = False,
)

Information about memory operand addressing.

Methods:

Attributes:

address class-attribute instance-attribute

address: Optional[ea_t] = None

addressing_type instance-attribute

addressing_type: str

displacement class-attribute instance-attribute

displacement: Optional[int] = None

formatted_string class-attribute instance-attribute

formatted_string: Optional[str] = None

has_outer_displacement class-attribute instance-attribute

has_outer_displacement: bool = False

outer_displacement class-attribute instance-attribute

outer_displacement: Optional[int] = None

phrase_number class-attribute instance-attribute

phrase_number: Optional[int] = None

symbol_name class-attribute instance-attribute

symbol_name: Optional[str] = None

has_displacement

has_displacement() -> bool

Check if this addressing mode has any displacement.

is_direct_memory

is_direct_memory() -> bool

Check if this is direct memory addressing.

is_register_based

is_register_based() -> bool

Check if this uses register-based addressing.

ImmediateInfo dataclass

ImmediateInfo(
    value: int,
    hex_value: str,
    is_address: bool,
    symbol_name: Optional[str] = None,
    signed_32bit: Optional[int] = None,
)

Information about an immediate operand.

Attributes:

hex_value instance-attribute

hex_value: str

is_address instance-attribute

is_address: bool

signed_32bit class-attribute instance-attribute

signed_32bit: Optional[int] = None

symbol_name class-attribute instance-attribute

symbol_name: Optional[str] = None

value instance-attribute

value: int

ImmediateOperand

ImmediateOperand(
    database: 'Database',
    operand: op_t,
    instruction_ea: ea_t,
)

Bases: Operand

Operand representing immediate values (o_imm, o_far, o_near).

Methods:

Attributes:

data_type property

data_type: OperandDataType

Get the operand data type as an enum.

flags property

flags: int

Get the operand flags.

is_shown property

is_shown: bool

Check if the operand should be displayed.

m_database instance-attribute

m_database = database

number property

number: int

Get the operand number (0, 1, 2, etc.).

raw_operand property

raw_operand: op_t

Get the underlying op_t object.

size_bits property

size_bits: int

Get the size of the operand in bits.

size_bytes property

size_bytes: int

Get the size of the operand in bytes.

type property

Get the operand type as an enum.

get_access_type

get_access_type() -> str

Get a string description of how this operand is accessed.

get_data_type_name

get_data_type_name() -> str

Get a human-readable name for the operand data type.

get_hex_value

get_hex_value() -> str

Get hex representation of the value.

get_immediate_info

get_immediate_info() -> ImmediateInfo

Get detailed immediate information.

get_info

get_info() -> OperandInfo

get_name

get_name() -> Optional[str]

Get the symbolic name for address operands.

get_register_info

get_register_info() -> RegisterInfo

Get detailed register information.

get_signed_32bit

get_signed_32bit() -> Optional[int]

Get signed 32-bit interpretation for large values.

get_type_name

get_type_name() -> str

get_value

get_value() -> int

Get the immediate value or address.

has_outer_displacement

has_outer_displacement() -> bool

Check if this operand has an outer displacement.

Returns True if the OF_OUTER_DISP flag is set.

is_address

is_address() -> bool

Check if this is an address operand (far/near).

is_floating_point

is_floating_point() -> bool

Check if this is a floating point operand.

is_read

is_read() -> bool

Check if this operand is read (used) by the instruction.

is_write

is_write() -> bool

Check if this operand is written (modified) by the instruction.

MemoryOperand

MemoryOperand(
    database: 'Database',
    operand: op_t,
    instruction_ea: ea_t,
)

Bases: Operand

Operand representing memory access (o_mem, o_phrase, o_displ).

Methods:

Attributes:

data_type property

data_type: OperandDataType

Get the operand data type as an enum.

flags property

flags: int

Get the operand flags.

is_shown property

is_shown: bool

Check if the operand should be displayed.

m_database instance-attribute

m_database = database

number property

number: int

Get the operand number (0, 1, 2, etc.).

raw_operand property

raw_operand: op_t

Get the underlying op_t object.

size_bits property

size_bits: int

Get the size of the operand in bits.

size_bytes property

size_bytes: int

Get the size of the operand in bytes.

type property

Get the operand type as an enum.

get_access_type

get_access_type() -> str

Get a string description of how this operand is accessed.

get_address

get_address() -> Optional[ea_t]

Get the address for direct memory operands.

get_addressing_info

get_addressing_info() -> AddressingInfo

Get detailed addressing information.

get_base_register

get_base_register() -> Optional[str]

Get the base register name (e.g., 'rsi', 'rbp').

get_data_type_name

get_data_type_name() -> str

Get a human-readable name for the operand data type.

get_displacement

get_displacement() -> Optional[int]

Get the base displacement value.

This is the primary displacement used in addressing modes like [reg + disp]. Stored in op_t.addr field.

get_formatted_string

get_formatted_string() -> Optional[str]

Get the formatted operand string from IDA.

get_index_register

get_index_register() -> Optional[str]

Get the index register name (e.g., 'rdi', 'rcx').

get_info

get_info() -> OperandInfo

get_name

get_name() -> Optional[str]

Get the symbolic name for direct memory operands.

get_outer_displacement

get_outer_displacement() -> Optional[int]

Get the outer displacement value for complex addressing modes.

Used in processors like 68k for nested addressing: ([reg + disp1], disp2) where disp1 is base displacement and disp2 is outer displacement. Only present when OF_OUTER_DISP flag is set. Stored in op_t.value field.

get_phrase_number

get_phrase_number() -> Optional[int]

Get the phrase number for register-based operands.

get_register_info

get_register_info() -> RegisterInfo

Get detailed register information.

get_scale

get_scale() -> Optional[int]

Get the scale factor (1, 2, 4, or 8).

get_sib_components

get_sib_components() -> tuple[
    Optional[str],
    Optional[str],
    Optional[int],
    Optional[int],
]

Get SIB components: (base_register, index_register, scale, displacement).

Returns: tuple: (base_reg, index_reg, scale, displacement) or (None, None, None, None) if fails

get_sib_displacement

get_sib_displacement() -> Optional[int]

Get the displacement value from SIB addressing.

get_type_name

get_type_name() -> str

get_value

get_value() -> Any

Get the primary value based on memory type.

has_outer_displacement

has_outer_displacement() -> bool

Check if this operand has an outer displacement.

Returns True if the OF_OUTER_DISP flag is set.

is_direct_memory

is_direct_memory() -> bool

Check if this is direct memory access.

is_floating_point

is_floating_point() -> bool

Check if this is a floating point operand.

is_read

is_read() -> bool

Check if this operand is read (used) by the instruction.

is_register_based

is_register_based() -> bool

Check if this uses register-based addressing.

is_write

is_write() -> bool

Check if this operand is written (modified) by the instruction.

Operand

Operand(
    database: 'Database',
    operand: op_t,
    instruction_ea: ea_t,
)

Bases: ABC

Abstract base class for all operand types.

Methods:

  • get_access_type

    Get a string description of how this operand is accessed.

  • get_data_type_name

    Get a human-readable name for the operand data type.

  • get_info

    Get structured information about the operand.

  • get_register_info

    Get detailed register information.

  • get_type_name

    Get a human-readable name for the operand type.

  • get_value

    Get the primary value of the operand.

  • is_floating_point

    Check if this is a floating point operand.

  • is_read

    Check if this operand is read (used) by the instruction.

  • is_write

    Check if this operand is written (modified) by the instruction.

Attributes:

data_type property

data_type: OperandDataType

Get the operand data type as an enum.

flags property

flags: int

Get the operand flags.

is_shown property

is_shown: bool

Check if the operand should be displayed.

m_database instance-attribute

m_database = database

number property

number: int

Get the operand number (0, 1, 2, etc.).

raw_operand property

raw_operand: op_t

Get the underlying op_t object.

size_bits property

size_bits: int

Get the size of the operand in bits.

size_bytes property

size_bytes: int

Get the size of the operand in bytes.

type property

Get the operand type as an enum.

get_access_type

get_access_type() -> str

Get a string description of how this operand is accessed.

get_data_type_name

get_data_type_name() -> str

Get a human-readable name for the operand data type.

get_info

get_info() -> OperandInfo

Get structured information about the operand.

get_register_info

get_register_info() -> RegisterInfo

Get detailed register information.

get_type_name abstractmethod

get_type_name() -> str

Get a human-readable name for the operand type.

get_value abstractmethod

get_value() -> Any

Get the primary value of the operand.

is_floating_point

is_floating_point() -> bool

Check if this is a floating point operand.

is_read

is_read() -> bool

Check if this operand is read (used) by the instruction.

is_write

is_write() -> bool

Check if this operand is written (modified) by the instruction.

OperandDataType

Bases: IntEnum

Enumeration of operand data types.

Attributes:

BITFIELD class-attribute instance-attribute

BITFIELD = dt_bitfild

BYTE class-attribute instance-attribute

BYTE = dt_byte

BYTE16 class-attribute instance-attribute

BYTE16 = dt_byte16

BYTE32 class-attribute instance-attribute

BYTE32 = dt_byte32

BYTE64 class-attribute instance-attribute

BYTE64 = dt_byte64

CODE class-attribute instance-attribute

CODE = dt_code

DOUBLE class-attribute instance-attribute

DOUBLE = dt_double

DWORD class-attribute instance-attribute

DWORD = dt_dword

FLOAT class-attribute instance-attribute

FLOAT = dt_float

FWORD class-attribute instance-attribute

FWORD = dt_fword

HALF class-attribute instance-attribute

HALF = dt_half

LDBL class-attribute instance-attribute

LDBL = dt_ldbl

PACKREAL class-attribute instance-attribute

PACKREAL = dt_packreal

QWORD class-attribute instance-attribute

QWORD = dt_qword

STRING class-attribute instance-attribute

STRING = dt_string

TBYTE class-attribute instance-attribute

TBYTE = dt_tbyte

UNICODE class-attribute instance-attribute

UNICODE = dt_unicode

VOID class-attribute instance-attribute

VOID = dt_void

WORD class-attribute instance-attribute

WORD = dt_word

OperandFactory

Factory for creating appropriate operand instances.

Methods:

  • create

    Create an operand instance based on the operand type.

create staticmethod

create(
    database: 'Database', operand: op_t, instruction_ea: int
) -> Optional[Operand]

Create an operand instance based on the operand type.

OperandInfo dataclass

OperandInfo(
    number: int,
    type_name: str,
    data_type_name: str,
    size_bytes: int,
    size_bits: Optional[int] = None,
    flags: Optional[str] = None,
    is_hidden: bool = False,
    special_value: Optional[str] = None,
    is_floating_point: bool = False,
    is_read: bool = False,
    is_write: bool = False,
    access_type: Optional[str] = None,
)

Basic information about an operand.

Attributes:

access_type class-attribute instance-attribute

access_type: Optional[str] = None

data_type_name instance-attribute

data_type_name: str

flags class-attribute instance-attribute

flags: Optional[str] = None

is_floating_point class-attribute instance-attribute

is_floating_point: bool = False

is_hidden class-attribute instance-attribute

is_hidden: bool = False

is_read class-attribute instance-attribute

is_read: bool = False

is_write class-attribute instance-attribute

is_write: bool = False

number instance-attribute

number: int

size_bits class-attribute instance-attribute

size_bits: Optional[int] = None

size_bytes instance-attribute

size_bytes: int

special_value class-attribute instance-attribute

special_value: Optional[str] = None

type_name instance-attribute

type_name: str

OperandType

Bases: IntEnum

Enumeration of operand types for easier identification.

Attributes:

DISPLACEMENT class-attribute instance-attribute

DISPLACEMENT = o_displ

FAR_ADDRESS class-attribute instance-attribute

FAR_ADDRESS = o_far

IMMEDIATE class-attribute instance-attribute

IMMEDIATE = o_imm

MEMORY class-attribute instance-attribute

MEMORY = o_mem

NEAR_ADDRESS class-attribute instance-attribute

NEAR_ADDRESS = o_near

PHRASE class-attribute instance-attribute

PHRASE = o_phrase

PROCESSOR_SPECIFIC_0 class-attribute instance-attribute

PROCESSOR_SPECIFIC_0 = o_idpspec0

PROCESSOR_SPECIFIC_1 class-attribute instance-attribute

PROCESSOR_SPECIFIC_1 = o_idpspec1

PROCESSOR_SPECIFIC_2 class-attribute instance-attribute

PROCESSOR_SPECIFIC_2 = o_idpspec2

PROCESSOR_SPECIFIC_3 class-attribute instance-attribute

PROCESSOR_SPECIFIC_3 = o_idpspec3

PROCESSOR_SPECIFIC_4 class-attribute instance-attribute

PROCESSOR_SPECIFIC_4 = o_idpspec4

PROCESSOR_SPECIFIC_5 class-attribute instance-attribute

PROCESSOR_SPECIFIC_5 = o_idpspec5

REGISTER class-attribute instance-attribute

REGISTER = o_reg

VOID class-attribute instance-attribute

VOID = o_void

ProcessorSpecificOperand

ProcessorSpecificOperand(
    database: 'Database', operand: op_t, instruction_ea: int
)

Bases: Operand

Operand representing processor-specific types (o_idpspec0-5).

Methods:

Attributes:

data_type property

data_type: OperandDataType

Get the operand data type as an enum.

flags property

flags: int

Get the operand flags.

is_shown property

is_shown: bool

Check if the operand should be displayed.

m_database instance-attribute

m_database = database

number property

number: int

Get the operand number (0, 1, 2, etc.).

raw_operand property

raw_operand: op_t

Get the underlying op_t object.

size_bits property

size_bits: int

Get the size of the operand in bits.

size_bytes property

size_bytes: int

Get the size of the operand in bytes.

type property

Get the operand type as an enum.

get_access_type

get_access_type() -> str

Get a string description of how this operand is accessed.

get_data_type_name

get_data_type_name() -> str

Get a human-readable name for the operand data type.

get_info

get_info() -> OperandInfo

get_register_info

get_register_info() -> RegisterInfo

Get detailed register information.

get_spec_type

get_spec_type() -> int

Get the processor-specific type number (0-5).

get_type_name

get_type_name() -> str

get_value

get_value() -> Any

Return raw value for processor-specific operands.

is_floating_point

is_floating_point() -> bool

Check if this is a floating point operand.

is_read

is_read() -> bool

Check if this operand is read (used) by the instruction.

is_write

is_write() -> bool

Check if this operand is written (modified) by the instruction.

RegisterInfo dataclass

RegisterInfo(register_number: int, register_name: str)

Information about a register operand.

Attributes:

register_name instance-attribute

register_name: str

register_number instance-attribute

register_number: int

RegisterOperand

RegisterOperand(
    database: 'Database',
    operand: op_t,
    instruction_ea: ea_t,
)

Bases: Operand

Operand representing a processor register (o_reg).

Methods:

Attributes:

data_type property

data_type: OperandDataType

Get the operand data type as an enum.

flags property

flags: int

Get the operand flags.

is_shown property

is_shown: bool

Check if the operand should be displayed.

m_database instance-attribute

m_database = database

number property

number: int

Get the operand number (0, 1, 2, etc.).

raw_operand property

raw_operand: op_t

Get the underlying op_t object.

register_number property

register_number: int

Get the register number.

size_bits property

size_bits: int

Get the size of the operand in bits.

size_bytes property

size_bytes: int

Get the size of the operand in bytes.

type property

Get the operand type as an enum.

get_access_type

get_access_type() -> str

Get a string description of how this operand is accessed.

get_data_type_name

get_data_type_name() -> str

Get a human-readable name for the operand data type.

get_info

get_info() -> OperandInfo

get_register_info

get_register_info() -> RegisterInfo

Get detailed register information.

get_register_name

get_register_name() -> str

Get the name of this register using the operand's size.

get_type_name

get_type_name() -> str

get_value

get_value() -> int

is_floating_point

is_floating_point() -> bool

Check if this is a floating point operand.

is_read

is_read() -> bool

Check if this operand is read (used) by the instruction.

is_write

is_write() -> bool

Check if this operand is written (modified) by the instruction.