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

Public Member Functions

 __init__ (self, *args, **kwargs)
 
None mark_lists_dirty (self)
 
None request_propagation (self)
 
bool needs_propagation (self)
 
None request_demote64 (self)
 
bool lists_dirty (self)
 
bool lists_ready (self)
 
int make_lists_ready (self)
 
int npred (self)
 
int nsucc (self)
 
int pred (self, int n)
 
int succ (self, int n)
 
bool empty (self)
 
None dump (self)
 
None dump_block (self, str title)
 
'minsn_t *' insert_into_block (self, 'minsn_t' nm, 'minsn_t' om)
 
'minsn_t *' remove_from_block (self, 'minsn_t' m)
 
int for_all_insns (self, 'minsn_visitor_t' mv)
 
int for_all_ops (self, 'mop_visitor_t' mv)
 
int for_all_uses (self, 'mlist_t' list, 'minsn_t' i1, 'minsn_t' i2, 'mlist_mop_visitor_t' mmv)
 
int optimize_insn (self, *args)
 
int optimize_block (self)
 
int build_lists (self, bool kill_deads)
 
int optimize_useless_jump (self)
 
None append_use_list (self, *args)
 
None append_def_list (self, 'mlist_t' list, 'mop_t' op, 'maymust_t' maymust)
 
'mlist_tbuild_use_list (self, 'minsn_t' ins, 'maymust_t' maymust)
 
'mlist_tbuild_def_list (self, 'minsn_t' ins, 'maymust_t' maymust)
 
bool is_used (self, *args)
 
'minsn_t *' find_first_use (self, *args)
 
bool is_redefined (self, *args)
 
'minsn_t *' find_redefinition (self, *args)
 
bool is_rhs_redefined (self, 'minsn_t' ins, 'minsn_t' i1, 'minsn_t' i2)
 
'minsn_t *' find_access (self, 'mop_t' op, 'minsn_t **' parent, 'minsn_t' mend, int fdflags)
 
'minsn_t *' find_def (self, 'mop_t' op, 'minsn_t **' p_i1, 'minsn_t' i2, int fdflags)
 
'minsn_t *' find_use (self, 'mop_t' op, 'minsn_t **' p_i1, 'minsn_t' i2, int fdflags)
 
bool get_valranges (self, *args)
 
None make_nop (self, 'minsn_t' m)
 
'size_t' get_reginsn_qty (self)
 
bool is_call_block (self)
 
bool is_unknown_call (self)
 
bool is_nway (self)
 
bool is_branch (self)
 
bool is_simple_goto_block (self)
 
bool is_simple_jcnd_block (self)
 
 preds (self)
 
 succs (self)
 

Static Public Attributes

str nextb
 
str prevb
 
str flags
 
str start
 
str end
 
str head
 
str tail
 
str mba
 
str serial
 
str type
 
str dead_at_start
 
str mustbuse
 
str maybuse
 
str mustbdef
 
str maybdef
 
str dnu
 
str maxbsp
 
str minbstkref
 
str minbargref
 
str predset
 
str succset
 

Protected Member Functions

None _print (self, 'vd_printer_t' vp)
 

Properties

 thisown
 

Constructor & Destructor Documentation

◆ __init__()

__init__ ( self,
* args,
** kwargs )

Member Function Documentation

◆ _print()

None _print ( self,
'vd_printer_t' vp )
protected

◆ append_def_list()

None append_def_list ( self,
'mlist_t' list,
'mop_t' op,
'maymust_t' maymust )
Append def-list of an operand. This function calculates list of locations that may or must be modified by the operand and appends it to LIST. 

@param list: ptr to the output buffer. we will append to it.
@param op: operand to calculate the def list of
@param maymust: should we calculate 'may-def' or 'must-def' list? see maymust_t for more details.

◆ append_use_list()

None append_use_list ( self,
* args )
Append use-list of an operand. This function calculates list of locations that may or must be used by the operand and appends it to LIST. 

@param list: ptr to the output buffer. we will append to it.
@param op: operand to calculate the use list of
@param maymust: should we calculate 'may-use' or 'must-use' list? see maymust_t for more details.
@param mask: if only part of the operand should be considered, a bitmask can be used to specify which part. example: op=AX,mask=0xFF means that we will consider only AL.

◆ build_def_list()

'mlist_t' build_def_list ( self,
'minsn_t' ins,
'maymust_t' maymust )
Build def-list of an instruction. This function calculates list of locations that may or must be modified by the instruction. Examples: "stx ebx.4, ds.2, eax.4", may-list: all aliasable memory "stx ebx.4, ds.2, eax.4", must-list: empty Since STX uses EAX for indirect access, it may modify any aliasable memory. On the other hand, we cannot tell for sure which memory cells will be modified, this is why the must-list is empty. 

@param ins: instruction to calculate the def list of
@param maymust: should we calculate 'may-def' or 'must-def' list? see maymust_t for more details.
@returns the calculated def-list

◆ build_lists()

int build_lists ( self,
bool kill_deads )
Build def-use lists and eliminate deads. 

@param kill_deads: do delete dead instructions?
@returns the number of eliminated instructions Better mblock_t::call make_lists_ready() rather than this function.

◆ build_use_list()

'mlist_t' build_use_list ( self,
'minsn_t' ins,
'maymust_t' maymust )
Build use-list of an instruction. This function calculates list of locations that may or must be used by the instruction. Examples: "ldx ds.2, eax.4, ebx.4", may-list: all aliasable memory "ldx ds.2, eax.4, ebx.4", must-list: empty Since LDX uses EAX for indirect access, it may access any aliasable memory. On the other hand, we cannot tell for sure which memory cells will be accessed, this is why the must-list is empty. 

@param ins: instruction to calculate the use list of
@param maymust: should we calculate 'may-use' or 'must-use' list? see maymust_t for more details.
@returns the calculated use-list

◆ dump()

None dump ( self)
Dump block info. This function is useful for debugging, see mba_t::dump for info 

◆ dump_block()

None dump_block ( self,
str title )

◆ empty()

bool empty ( self)

◆ find_access()

'minsn_t *' find_access ( self,
'mop_t' op,
'minsn_t **' parent,
'minsn_t' mend,
int fdflags )
Find the instruction that accesses the specified operand. This function search inside one block. 

@param op: operand to search for
@param parent: ptr to ptr to a top level instruction. in: denotes the beginning of the search range. out: denotes the parent of the found instruction.
@param mend: end instruction of the range (must be a top level insn) mend is excluded from the range. it can be specified as nullptr. parent and mend must belong to the same block.
@param fdflags: combination of bits for mblock_t::find_access bits
@returns the instruction that accesses the operand. this instruction may be a sub-instruction. to find out the top level instruction, check out *parent. nullptr means 'not found'.

◆ find_def()

'minsn_t *' find_def ( self,
'mop_t' op,
'minsn_t **' p_i1,
'minsn_t' i2,
int fdflags )

◆ find_first_use()

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

0. find_first_use(list: mlist_t *, i1: const minsn_t *, i2: const minsn_t *, maymust: maymust_t=MAY_ACCESS) -> const minsn_t *
1. find_first_use(list: mlist_t *, i1: minsn_t *, i2: const minsn_t *, maymust: maymust_t=MAY_ACCESS) -> minsn_t *

# 0: find_first_use(list: mlist_t *, i1: const minsn_t *, i2: const minsn_t *, maymust: maymust_t=MAY_ACCESS) -> const minsn_t *

Find the first insn that uses the specified list in the insn range. 

@returns pointer to such instruction or nullptr. Upon return LIST will contain only locations not redefined by insns [i1..result]

# 1: find_first_use(list: mlist_t *, i1: minsn_t *, i2: const minsn_t *, maymust: maymust_t=MAY_ACCESS) -> minsn_t *

◆ find_redefinition()

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

0. find_redefinition(list: const mlist_t &, i1: const minsn_t *, i2: const minsn_t *, maymust: maymust_t=MAY_ACCESS) -> const minsn_t *
1. find_redefinition(list: const mlist_t &, i1: minsn_t *, i2: const minsn_t *, maymust: maymust_t=MAY_ACCESS) -> minsn_t *

# 0: find_redefinition(list: const mlist_t &, i1: const minsn_t *, i2: const minsn_t *, maymust: maymust_t=MAY_ACCESS) -> const minsn_t *

Find the first insn that redefines any part of the list in the insn range. 

@returns pointer to such instruction or nullptr.

# 1: find_redefinition(list: const mlist_t &, i1: minsn_t *, i2: const minsn_t *, maymust: maymust_t=MAY_ACCESS) -> minsn_t *

◆ find_use()

'minsn_t *' find_use ( self,
'mop_t' op,
'minsn_t **' p_i1,
'minsn_t' i2,
int fdflags )

◆ for_all_insns()

int for_all_insns ( self,
'minsn_visitor_t' mv )
Visit all instructions. This function visits subinstructions too. 

@param mv: instruction visitor
@returns zero or the value returned by mv.visit_insn() See also mba_t::for_all_topinsns()

◆ for_all_ops()

int for_all_ops ( self,
'mop_visitor_t' mv )
Visit all operands. This function visit subinstruction operands too. 

@param mv: operand visitor
@returns zero or the value returned by mv.visit_mop()

◆ for_all_uses()

int for_all_uses ( self,
'mlist_t' list,
'minsn_t' i1,
'minsn_t' i2,
'mlist_mop_visitor_t' mmv )
Visit all operands that use LIST. 

@param list: ptr to the list of locations. it may be modified: parts that get redefined by the instructions in [i1,i2) will be deleted.
@param i1: starting instruction. must be a top level insn.
@param i2: ending instruction (excluded). must be a top level insn.
@param mmv: operand visitor
@returns zero or the value returned by mmv.visit_mop()

◆ get_reginsn_qty()

'size_t' get_reginsn_qty ( self)
Calculate number of regular instructions in the block. Assertions are skipped by this function. 

@returns Number of non-assertion instructions in the block.

◆ get_valranges()

bool get_valranges ( self,
* args )
This function has the following signatures:

0. get_valranges(res: valrng_t *, vivl: const vivl_t &, vrflags: int) -> bool
1. get_valranges(res: valrng_t *, vivl: const vivl_t &, m: const minsn_t *, vrflags: int) -> bool

# 0: get_valranges(res: valrng_t *, vivl: const vivl_t &, vrflags: int) -> bool

Find possible values for a block. 


# 1: get_valranges(res: valrng_t *, vivl: const vivl_t &, m: const minsn_t *, vrflags: int) -> bool

Find possible values for an instruction. 

◆ insert_into_block()

'minsn_t *' insert_into_block ( self,
'minsn_t' nm,
'minsn_t' om )
Insert instruction into the doubly linked list 

@param nm: new instruction
@param om: existing instruction, part of the doubly linked list if nullptr, then the instruction will be inserted at the beginning of the list NM will be inserted immediately after OM
@returns pointer to NM

◆ is_branch()

bool is_branch ( self)

◆ is_call_block()

bool is_call_block ( self)

◆ is_nway()

bool is_nway ( self)

◆ is_redefined()

bool is_redefined ( self,
* args )
Is the list redefined by the specified instructions? 

@param list: list of locations to check.
@param i1: starting instruction of the range (must be a top level insn)
@param i2: end instruction of the range (must be a top level insn) i2 is excluded from the range. it can be specified as nullptr. i1 and i2 must belong to the same block.
@param maymust: should we search in 'may-access' or 'must-access' mode?

◆ is_rhs_redefined()

bool is_rhs_redefined ( self,
'minsn_t' ins,
'minsn_t' i1,
'minsn_t' i2 )
Is the right hand side of the instruction redefined the insn range? "right hand side" corresponds to the source operands of the instruction. 

@param ins: instruction to consider
@param i1: starting instruction of the range (must be a top level insn)
@param i2: end instruction of the range (must be a top level insn) i2 is excluded from the range. it can be specified as nullptr. i1 and i2 must belong to the same block.

◆ is_simple_goto_block()

bool is_simple_goto_block ( self)

◆ is_simple_jcnd_block()

bool is_simple_jcnd_block ( self)

◆ is_unknown_call()

bool is_unknown_call ( self)

◆ is_used()

bool is_used ( self,
* args )
Is the list used by the specified instruction range? 

@param list: list of locations. LIST may be modified by the function: redefined locations will be removed from it.
@param i1: starting instruction of the range (must be a top level insn)
@param i2: end instruction of the range (must be a top level insn) i2 is excluded from the range. it can be specified as nullptr. i1 and i2 must belong to the same block.
@param maymust: should we search in 'may-access' or 'must-access' mode?

◆ lists_dirty()

bool lists_dirty ( self)

◆ lists_ready()

bool lists_ready ( self)

◆ make_lists_ready()

int make_lists_ready ( self)

◆ make_nop()

None make_nop ( self,
'minsn_t' m )
Erase the instruction (convert it to nop) and mark the lists dirty. This is the recommended function to use because it also marks the block use-def lists dirty. 

◆ mark_lists_dirty()

None mark_lists_dirty ( self)

◆ needs_propagation()

bool needs_propagation ( self)

◆ npred()

int npred ( self)
Get number of block predecessors.

◆ nsucc()

int nsucc ( self)
Get number of block successors.

◆ optimize_block()

int optimize_block ( self)
Optimize a basic block. Usually there is no need to call this function explicitly because the decompiler will call it itself if optinsn_t::func or optblock_t::func return non-zero. 

@returns number of changes made to the block

◆ optimize_insn()

int optimize_insn ( self,
* args )
Optimize one instruction in the context of the block. 

@param m: pointer to a top level instruction
@param optflags: combination of optimization flags bits
@returns number of changes made to the block This function may change other instructions in the block too. However, it will not destroy top level instructions (it may convert them to nop's). This function performs only intrablock modifications. See also minsn_t::optimize_solo()

◆ optimize_useless_jump()

int optimize_useless_jump ( self)
Remove a jump at the end of the block if it is useless. This function preserves any side effects when removing a useless jump. Both conditional and unconditional jumps are handled (and jtbl too). This function deletes useless jumps, not only replaces them with a nop. (please note that \\optimize_insn does not handle useless jumps). 

@returns number of changes made to the block

◆ pred()

int pred ( self,
int n )

◆ preds()

preds ( self)
Iterates the list of predecessor blocks

◆ remove_from_block()

'minsn_t *' remove_from_block ( self,
'minsn_t' m )
Remove instruction from the doubly linked list 

@param m: instruction to remove The removed instruction is not deleted, the caller gets its ownership
@returns pointer to the next instruction

◆ request_demote64()

None request_demote64 ( self)

◆ request_propagation()

None request_propagation ( self)

◆ succ()

int succ ( self,
int n )

◆ succs()

succs ( self)
Iterates the list of successor blocks

Member Data Documentation

◆ dead_at_start

str dead_at_start
static
Initial value:
= property(_ida_hexrays.
mblock_t_dead_at_start_get, _ida_hexrays.mblock_t_dead_at_start_set)

◆ dnu

str dnu
static
Initial value:
= property(_ida_hexrays.mblock_t_dnu_get, _ida_hexrays.
mblock_t_dnu_set)

◆ end

str end
static
Initial value:
= property(_ida_hexrays.mblock_t_end_get, _ida_hexrays.
mblock_t_end_set)

◆ flags

str flags
static
Initial value:
= property(_ida_hexrays.mblock_t_flags_get,
_ida_hexrays.mblock_t_flags_set)

◆ head

str head
static
Initial value:
= property(_ida_hexrays.mblock_t_head_get,
_ida_hexrays.mblock_t_head_set)

◆ maxbsp

str maxbsp
static
Initial value:
= property(_ida_hexrays.mblock_t_maxbsp_get,
_ida_hexrays.mblock_t_maxbsp_set)

◆ maybdef

str maybdef
static
Initial value:
= property(_ida_hexrays.mblock_t_maybdef_get,
_ida_hexrays.mblock_t_maybdef_set)

◆ maybuse

str maybuse
static
Initial value:
= property(_ida_hexrays.mblock_t_maybuse_get,
_ida_hexrays.mblock_t_maybuse_set)

◆ mba

str mba
static
Initial value:
= property(_ida_hexrays.mblock_t_mba_get, _ida_hexrays.
mblock_t_mba_set)

◆ minbargref

str minbargref
static
Initial value:
= property(_ida_hexrays.mblock_t_minbargref_get,
_ida_hexrays.mblock_t_minbargref_set)

◆ minbstkref

str minbstkref
static
Initial value:
= property(_ida_hexrays.mblock_t_minbstkref_get,
_ida_hexrays.mblock_t_minbstkref_set)

◆ mustbdef

str mustbdef
static
Initial value:
= property(_ida_hexrays.mblock_t_mustbdef_get,
_ida_hexrays.mblock_t_mustbdef_set)

◆ mustbuse

str mustbuse
static
Initial value:
= property(_ida_hexrays.mblock_t_mustbuse_get,
_ida_hexrays.mblock_t_mustbuse_set)

◆ nextb

str nextb
static
Initial value:
= property(_ida_hexrays.mblock_t_nextb_get,
_ida_hexrays.mblock_t_nextb_set)

◆ predset

str predset
static
Initial value:
= property(_ida_hexrays.mblock_t_predset_get,
_ida_hexrays.mblock_t_predset_set)

◆ prevb

str prevb
static
Initial value:
= property(_ida_hexrays.mblock_t_prevb_get,
_ida_hexrays.mblock_t_prevb_set)

◆ serial

str serial
static
Initial value:
= property(_ida_hexrays.mblock_t_serial_get, _ida_hexrays
.mblock_t_serial_set)

◆ start

str start
static
Initial value:
= property(_ida_hexrays.mblock_t_start_get, _ida_hexrays.
mblock_t_start_set)

◆ succset

str succset
static
Initial value:
= property(_ida_hexrays.mblock_t_succset_get,
_ida_hexrays.mblock_t_succset_set)

◆ tail

str tail
static
Initial value:
= property(_ida_hexrays.mblock_t_tail_get,
_ida_hexrays.mblock_t_tail_set)

◆ type

str type
static
Initial value:
= property(_ida_hexrays.mblock_t_type_get,
_ida_hexrays.mblock_t_type_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: