mbl_array_t Class Reference

Micro block array (internal representation of the decompiled code). More...

Public Member Functions

sval_t stkoff_vd2ida (sval_t off) const
 
sval_t stkoff_ida2vd (sval_t off) const
 
sval_t argbase () const
 
vdloc_t idaloc2vd (const argloc_t &loc, int width) const
 
argloc_t vd2idaloc (const vdloc_t &loc, int width) const
 
bool is_stkarg (const lvar_t &v) const
 
member_t * get_stkvar (sval_t vd_stkoff, uval_t *poff) const
 
argloc_t get_ida_argloc (const lvar_t &v) const
 
bool write_to_const_detected (void) const
 
bool bad_call_sp_detected (void) const
 
bool regargs_is_not_aligned (void) const
 
bool has_bad_sp (void) const
 
void term (void)
 
void clear (void)
 
func_t * get_curfunc (void) const
 
bool use_frame (void) const
 
bool range_contains (ea_t ea) const
 
int optimize_local (int todo)
 Optimize each basic block locally. More...
 
merror_t build_graph (void)
 Build control flow graph This function may be called only once. More...
 
mbl_graph_tget_graph (void)
 Get control graph.
 
int analyze_calls (int acflags)
 Analyze calls and determine calling conventions. More...
 
merror_t optimize_global (void)
 Optimize microcode globally This function applies various optimization methods until we reach the fixed point. More...
 
void alloc_lvars (void)
 Allocate local variables. More...
 
void dump (void) const
 Dump microcode to a file The file will be created in the directory pointed by IDA_DUMPDIR envvar. More...
 
const mblock_tget_mblock (int n) const
 
mblock_tget_mblock (int n)
 
int for_all_ops (mop_visitor_t &mv)
 
int for_all_insns (minsn_visitor_t &mv)
 
int for_all_topinsns (minsn_visitor_t &mv)
 
bool remove_empty_blocks (void)
 
bool combine_blocks (void)
 
void vdump_mba (bool _verify, const char *title, va_list va) const
 
void print (vd_printer_t &vp) const
 
void serialize (bytevec_t &b) const
 
void verify (bool always) const
 
void make_chains_dirty (void)
 
lvar_targ (int n)
 
const lvar_targ (int n) const
 

Static Public Member Functions

static vdloc_t idaloc2vd (const argloc_t &loc, int width, sval_t spd)
 
static vdloc_t idaloc2vd (const mbl_array_t *mba, const argloc_t &loc, int width)
 
static argloc_t vd2idaloc (const vdloc_t &loc, int width, sval_t spd)
 

Public Attributes

mba_ranges_t mbr
 
ea_t entry_ea
 
ea_t last_prolog_ea
 
ea_t first_epilog_ea
 
int qty
 
int npurged
 
cm_t cc
 
sval_t tmpstk_size
 
sval_t frsize
 
sval_t frregs
 
sval_t fpd
 
int pfn_flags
 
int retsize
 
int shadow_args
 
sval_t fullsize
 
sval_t stacksize
 
sval_t inargoff
 
sval_t minstkref
 
ea_t minstkref_ea
 
sval_t minargref
 
ivl_t aliased_vars
 
ivl_t aliased_args
 
ivlset_t gotoff_stkvars
 
ivlset_t restricted_memory
 
ivlset_t aliased_memory
 
mlist_t nodel_memory
 
rlist_t consumed_argregs
 
mba_maturity_t maturity
 
mba_maturity_t reqmat
 
bool final_type
 
tinfo_t idb_type
 
reginfovec_t idb_spoiled
 
mlist_t spoiled_list
 
int fti_flags
 
netnode idb_node
 
qstring label
 
lvars_t vars
 
intvec_t argidx
 
int retvaridx
 
ea_t error_ea
 
qstring error_strarg
 
mblock_tblocks
 
mblock_t ** natural
 
hexwarns_t notes
 
uchar occurred_warns [32]
 
char reserved []
 

Detailed Description

Micro block array (internal representation of the decompiled code).

Array of micro blocks represents the currently decompiled function.

Intermediate representation of the decompiled function. The details of this class are not public yet because it will be modified in the near future. We plan to disclose them after porting the decompiler to ARM.

The first micro block is the entry point, the last one if the exit point. The entry and exit blocks are always empty. The exit block is generated at MMAT_LOCOPT maturity level.

Examples:
hexrays_sample11.cpp, hexrays_sample12.cpp, hexrays_sample13.cpp, hexrays_sample15.cpp, and hexrays_sample9.cpp.

Definition at line 63 of file hexrays.dox.

Member Function Documentation

◆ alloc_lvars()

void mbl_array_t::alloc_lvars ( void  )

Allocate local variables.

Must be called only immediately after optimize_global(). Converts registers, stack variables, and similar operands into mop_l. This call will not fail because all necessary checks were performed in optimize_global(). After this call the microcode reaches its final state. However, data dependency are lost after lvar allocation.

Definition at line 8189 of file hexrays.hpp.

References hexdsp.

◆ analyze_calls()

int mbl_array_t::analyze_calls ( int  acflags)

Analyze calls and determine calling conventions.

Parameters
acflagspermitted actions that are necessary for successful detection of calling conventions.
Returns
number of calls. -1 means error.
Examples:
hexrays_sample12.cpp.

Definition at line 8177 of file hexrays.hpp.

References hexdsp.

◆ build_graph()

merror_t mbl_array_t::build_graph ( void  )

Build control flow graph This function may be called only once.

It calculates the type of each basic block and the adjacency list.

Returns
error code
Examples:
hexrays_sample12.cpp.

Definition at line 8165 of file hexrays.hpp.

References hexdsp.

◆ dump()

void mbl_array_t::dump ( void  ) const

Dump microcode to a file The file will be created in the directory pointed by IDA_DUMPDIR envvar.

Dump will be created only if IDA is run under debugger.

Definition at line 8195 of file hexrays.hpp.

References hexdsp.

◆ optimize_global()

merror_t mbl_array_t::optimize_global ( void  )

Optimize microcode globally This function applies various optimization methods until we reach the fixed point.

At all preallocates lvars unless reqmat forbids it.

Returns
error code

Definition at line 8183 of file hexrays.hpp.

References hexdsp.

◆ optimize_local()

int mbl_array_t::optimize_local ( int  todo)

Optimize each basic block locally.

Returns
number of changes. 0 means nothing changed

Definition at line 8159 of file hexrays.hpp.

References hexdsp.