IDAPython 9.0
Loading...
Searching...
No Matches
codegen_t Class Reference
Inheritance diagram for codegen_t:

Public Member Functions

 __init__ (self, *args, **kwargs)
 
None clear (self)
 
'merror_t' analyze_prolog (self, 'qflow_chart_t' fc, 'bitset_t' reachable)
 
'merror_t' gen_micro (self)
 
'mreg_t' load_operand (self, int opnum, int flags=0)
 
None microgen_completed (self)
 
'merror_t' prepare_gen_micro (self)
 
'mreg_t' load_effective_address (self, int n, int flags=0)
 
bool store_operand (self, int n, 'mop_t' mop, int flags=0, 'minsn_t **' outins=None)
 
'minsn_t *' emit_micro_mvm (self, 'mcode_t' code, 'op_dtype_t' dtype, int l, int r, int d, int offsize)
 
'minsn_t *' emit (self, *args)
 

Static Public Attributes

str mba
 
str mb
 
str insn
 
str ignore_micro
 
str ii
 

Properties

 thisown
 

Constructor & Destructor Documentation

◆ __init__()

__init__ ( self,
* args,
** kwargs )

Member Function Documentation

◆ analyze_prolog()

'merror_t' analyze_prolog ( self,
'qflow_chart_t' fc,
'bitset_t' reachable )
Analyze prolog/epilog of the function to decompile. If prolog is found, allocate and fill 'mba->pi' structure. 

@param fc: flow chart
@param reachable: bitmap of reachable blocks
@returns error code

◆ clear()

None clear ( self)

◆ emit()

'minsn_t *' emit ( self,
* args )
This function has the following signatures:

0. emit(code: mcode_t, width: int, l: int, r: int, d: int, offsize: int) -> minsn_t *
1. emit(code: mcode_t, l: const mop_t *, r: const mop_t *, d: const mop_t *) -> minsn_t *

# 0: emit(code: mcode_t, width: int, l: int, r: int, d: int, offsize: int) -> minsn_t *

Emit one microinstruction. The L, R, D arguments usually mean the register number. However, they depend on CODE. For example:
* for m_goto and m_jcnd L is the target address
* for m_ldc L is the constant value to load



@returns created microinstruction. can be nullptr if the instruction got immediately optimized away.

# 1: emit(code: mcode_t, l: const mop_t *, r: const mop_t *, d: const mop_t *) -> minsn_t *

Emit one microinstruction. This variant accepts pointers to operands. It is more difficult to use but permits to create virtually any instruction. Operands may be nullptr when it makes sense. 

◆ emit_micro_mvm()

'minsn_t *' emit_micro_mvm ( self,
'mcode_t' code,
'op_dtype_t' dtype,
int l,
int r,
int d,
int offsize )
Emit one microinstruction. This variant takes a data type not a size. 

◆ gen_micro()

'merror_t' gen_micro ( self)
Generate microcode for one instruction. The instruction is in INSN 

@returns MERR_OK - all ok MERR_BLOCK - all ok, need to switch to new block MERR_BADBLK - delete current block and continue other error codes are fatal

◆ load_effective_address()

'mreg_t' load_effective_address ( self,
int n,
int flags = 0 )
Generate microcode to calculate the address of a memory operand. 

@param n: - number of INSN operand
@param flags: - reserved for future use
@returns register containing the operand address. mr_none - failed (not a memory operand)

◆ load_operand()

'mreg_t' load_operand ( self,
int opnum,
int flags = 0 )
Generate microcode to load one operand. 

@param opnum: number of INSN operand
@param flags: reserved for future use
@returns register containing the operand.

◆ microgen_completed()

None microgen_completed ( self)
This method is called when the microcode generation is done.

◆ prepare_gen_micro()

'merror_t' prepare_gen_micro ( self)
Setup internal data to handle new instruction. This method should be called before calling gen_micro(). Usually gen_micro() is called by the decompiler. You have to call this function explicitly only if you yourself call gen_micro(). The instruction is in INSN 

@returns MERR_OK - all ok other error codes are fatal

◆ store_operand()

bool store_operand ( self,
int n,
'mop_t' mop,
int flags = 0,
'minsn_t **' outins = None )
Generate microcode to store an operand. In case of success an arbitrary number of instructions can be generated (and even no instruction if the source and target are the same) 

@param n: - number of target INSN operand
@param mop: - operand to be stored
@param flags: - reserved for future use
@param outins: - (OUT) the last generated instruction
@returns success

Member Data Documentation

◆ ignore_micro

str ignore_micro
static
Initial value:
= property(_ida_hexrays.codegen_t_ignore_micro_get,
_ida_hexrays.codegen_t_ignore_micro_set)

◆ ii

str ii
static
Initial value:
= property(_ida_hexrays.codegen_t_ii_get,
_ida_hexrays.codegen_t_ii_set)

◆ insn

str insn
static
Initial value:
= property(_ida_hexrays.codegen_t_insn_get, _ida_hexrays
.codegen_t_insn_set)

◆ mb

str mb
static
Initial value:
= property(_ida_hexrays.codegen_t_mb_get, _ida_hexrays
.codegen_t_mb_set)

◆ mba

str mba
static
Initial value:
= property(_ida_hexrays.codegen_t_mba_get, _ida_hexrays.
codegen_t_mba_set)

Property Documentation

◆ thisown

thisown
static
Initial value:
= property(lambda x: x.this.own(), lambda x, v: x.this.own(v),
doc='The membership flag')

The documentation for this class was generated from the following file: