IDAPython 9.0
Loading...
Searching...
No Matches
mblock_t Class Reference

Proxy of C++ mblock_t class.

Inheritance diagram for mblock_t:

Public Member Functions

 __init__ (self, *args, **kwargs)
 
"void" mark_lists_dirty (self)
 mark_lists_dirty(self)
 
"void" request_propagation (self)
 request_propagation(self)
 
"bool" needs_propagation (self)
 needs_propagation(self) -> bool
 
"void" request_demote64 (self)
 request_demote64(self)
 
"bool" lists_dirty (self)
 lists_dirty(self) -> bool
 
"bool" lists_ready (self)
 lists_ready(self) -> bool
 
"int" make_lists_ready (self)
 make_lists_ready(self) -> int
 
"int" npred (self)
 npred(self) -> int Get number of block predecessors.
 
"int" nsucc (self)
 nsucc(self) -> int Get number of block successors.
 
"int" pred (self, "int" n)
 pred(self, n) -> int
 
"int" succ (self, "int" n)
 succ(self, n) -> int
 
"bool" empty (self)
 empty(self) -> bool
 
"void" dump (self)
 dump(self) Dump block info.
 
"void" dump_block (self, "char const *" title)
 dump_block(self, title)
 
"minsn_t *" insert_into_block (self, "minsn_t" nm, "minsn_t" om)
 insert_into_block(self, nm, om) -> minsn_t Insert instruction into the doubly linked list
 
"minsn_t *" remove_from_block (self, "minsn_t" m)
 remove_from_block(self, m) -> minsn_t Remove instruction from the doubly linked list
 
"int" for_all_insns (self, "minsn_visitor_t" mv)
 for_all_insns(self, mv) -> int Visit all instructions.
 
"int" for_all_ops (self, "mop_visitor_t" mv)
 for_all_ops(self, mv) -> int Visit all operands.
 
"int" for_all_uses (self, "mlist_t" list, "minsn_t" i1, "minsn_t" i2, "mlist_mop_visitor_t" mmv)
 for_all_uses(self, list, i1, i2, mmv) -> int Visit all operands that use LIST.
 
"int" optimize_insn (self, *args)
 optimize_insn(self, m, optflags=0x0002|0x0004) -> int Optimize one instruction in the context of the block.
 
"int" optimize_block (self)
 optimize_block(self) -> int Optimize a basic block.
 
"int" build_lists (self, "bool" kill_deads)
 build_lists(self, kill_deads) -> int Build def-use lists and eliminate deads.
 
"int" optimize_useless_jump (self)
 optimize_useless_jump(self) -> int Remove a jump at the end of the block if it is useless.
 
"void" append_use_list (self, *args)
 append_use_list(self, list, op, maymust, mask=bitrange_t(0, USHRT_MAX)) Append use-list of an operand.
 
"void" append_def_list (self, "mlist_t" list, "mop_t" op, "maymust_t" maymust)
 append_def_list(self, list, op, maymust) Append def-list of an operand.
 
"mlist_t" build_use_list (self, "minsn_t" ins, "maymust_t" maymust)
 build_use_list(self, ins, maymust) -> mlist_t Build use-list of an instruction.
 
"mlist_t" build_def_list (self, "minsn_t" ins, "maymust_t" maymust)
 build_def_list(self, ins, maymust) -> mlist_t Build def-list of an instruction.
 
"bool" is_used (self, *args)
 is_used(self, list, i1, i2, maymust=MAY_ACCESS) -> bool Is the list used by the specified instruction range?
 
"minsn_t *" find_first_use (self, *args)
 find_first_use(self, list, i1, i2, maymust=MAY_ACCESS) -> minsn_t
 
"bool" is_redefined (self, *args)
 is_redefined(self, list, i1, i2, maymust=MAY_ACCESS) -> bool Is the list redefined by the specified instructions?
 
"minsn_t *" find_redefinition (self, *args)
 find_redefinition(self, list, i1, i2, maymust=MAY_ACCESS) -> minsn_t
 
"bool" is_rhs_redefined (self, "minsn_t" ins, "minsn_t" i1, "minsn_t" i2)
 is_rhs_redefined(self, ins, i1, i2) -> bool Is the right hand side of the instruction redefined the insn range? "right hand side" corresponds to the source operands of the instruction.
 
"minsn_t *" find_access (self, "mop_t" op, "minsn_t **" parent, "minsn_t" mend, "int" fdflags)
 find_access(self, op, parent, mend, fdflags) -> minsn_t Find the instruction that accesses the specified operand.
 
"minsn_t *" find_def (self, "mop_t" op, "minsn_t **" p_i1, "minsn_t" i2, "int" fdflags)
 find_def(self, op, p_i1, i2, fdflags) -> minsn_t
 
"minsn_t *" find_use (self, "mop_t" op, "minsn_t **" p_i1, "minsn_t" i2, "int" fdflags)
 find_use(self, op, p_i1, i2, fdflags) -> minsn_t
 
"bool" get_valranges (self, *args)
 get_valranges(self, res, vivl, vrflags) -> bool Find possible values for an instruction.
 
"void" make_nop (self, "minsn_t" m)
 make_nop(self, m) Erase the instruction (convert it to nop) and mark the lists dirty.
 
"size_t" get_reginsn_qty (self)
 get_reginsn_qty(self) -> size_t Calculate number of regular instructions in the block.
 
"bool" is_call_block (self)
 is_call_block(self) -> bool
 
"bool" is_unknown_call (self)
 is_unknown_call(self) -> bool
 
"bool" is_nway (self)
 is_nway(self) -> bool
 
"bool" is_branch (self)
 is_branch(self) -> bool
 
"bool" is_simple_goto_block (self)
 is_simple_goto_block(self) -> bool
 
"bool" is_simple_jcnd_block (self)
 is_simple_jcnd_block(self) -> bool
 
 preds (self)
 Iterates the list of predecessor blocks.
 
 succs (self)
 Iterates the list of successor blocks.
 

Static Public Attributes

str nextb = property(_ida_hexrays.mblock_t_nextb_get, _ida_hexrays.mblock_t_nextb_set, doc=)
 
str prevb = property(_ida_hexrays.mblock_t_prevb_get, _ida_hexrays.mblock_t_prevb_set, doc=)
 
str flags = property(_ida_hexrays.mblock_t_flags_get, _ida_hexrays.mblock_t_flags_set, doc=)
 
str start = property(_ida_hexrays.mblock_t_start_get, _ida_hexrays.mblock_t_start_set, doc=)
 
str end = property(_ida_hexrays.mblock_t_end_get, _ida_hexrays.mblock_t_end_set, doc=)
 
str head = property(_ida_hexrays.mblock_t_head_get, _ida_hexrays.mblock_t_head_set, doc=)
 
str tail = property(_ida_hexrays.mblock_t_tail_get, _ida_hexrays.mblock_t_tail_set, doc=)
 
str mba = property(_ida_hexrays.mblock_t_mba_get, _ida_hexrays.mblock_t_mba_set, doc=)
 
str serial = property(_ida_hexrays.mblock_t_serial_get, _ida_hexrays.mblock_t_serial_set, doc=)
 
str type = property(_ida_hexrays.mblock_t_type_get, _ida_hexrays.mblock_t_type_set, doc=)
 
str dead_at_start = property(_ida_hexrays.mblock_t_dead_at_start_get, _ida_hexrays.mblock_t_dead_at_start_set, doc=)
 
str mustbuse = property(_ida_hexrays.mblock_t_mustbuse_get, _ida_hexrays.mblock_t_mustbuse_set, doc=)
 
str maybuse = property(_ida_hexrays.mblock_t_maybuse_get, _ida_hexrays.mblock_t_maybuse_set, doc=)
 
str mustbdef = property(_ida_hexrays.mblock_t_mustbdef_get, _ida_hexrays.mblock_t_mustbdef_set, doc=)
 
str maybdef = property(_ida_hexrays.mblock_t_maybdef_get, _ida_hexrays.mblock_t_maybdef_set, doc=)
 
str dnu = property(_ida_hexrays.mblock_t_dnu_get, _ida_hexrays.mblock_t_dnu_set, doc=)
 
str maxbsp = property(_ida_hexrays.mblock_t_maxbsp_get, _ida_hexrays.mblock_t_maxbsp_set, doc=)
 
str minbstkref = property(_ida_hexrays.mblock_t_minbstkref_get, _ida_hexrays.mblock_t_minbstkref_set, doc=)
 
str minbargref = property(_ida_hexrays.mblock_t_minbargref_get, _ida_hexrays.mblock_t_minbargref_set, doc=)
 
str predset = property(_ida_hexrays.mblock_t_predset_get, _ida_hexrays.mblock_t_predset_set, doc=)
 
str succset = property(_ida_hexrays.mblock_t_succset_get, _ida_hexrays.mblock_t_succset_set, doc=)
 

Protected Member Functions

"void" _print (self, "vd_printer_t" vp)
 _print(self, vp)
 

Properties

 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
 

Constructor & Destructor Documentation

◆ __init__()

__init__ ( self,
* args,
** kwargs )

Member Function Documentation

◆ _print()

"void" _print ( self,
"vd_printer_t" vp )
protected

Parameters

vp: vd_printer_t &

◆ append_def_list()

"void" append_def_list ( self,
"mlist_t" list,
"mop_t" op,
"maymust_t" maymust )

This function calculates list of locations that may or must be modified by the operand and appends it to LIST.

Parameters
list(C++: mlist_t *) ptr to the output buffer. we will append to it.
op(C++: const mop_t &) operand to calculate the def list of
maymust(C++: maymust_t) should we calculate 'may-def' or 'must-def' list? see maymust_t for more details.

◆ append_use_list()

"void" append_use_list ( self,
* args )

This function calculates list of locations that may or must be used by the operand and appends it to LIST.

Parameters
list(C++: mlist_t *) ptr to the output buffer. we will append to it.
op(C++: const mop_t &) operand to calculate the use list of
maymust(C++: maymust_t) should we calculate 'may-use' or 'must-use' list? see maymust_t for more details.
mask(C++: bitrange_t) 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 )

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.

Parameters
ins(C++: const minsn_t &) instruction to calculate the def list of
maymust(C++: maymust_t) 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 )
Parameters
kill_deads(C++: bool) 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 )

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.

Parameters
ins(C++: const minsn_t &) instruction to calculate the use list of
maymust(C++: maymust_t) should we calculate 'may-use' or 'must-use' list? see maymust_t for more details.
Returns
: the calculated use-list

◆ dump()

"void" dump ( self)

This function is useful for debugging, see mba_t.dump for info

◆ dump_block()

"void" dump_block ( self,
"char const *" title )
Parameters
titlechar const *

◆ empty()

"bool" empty ( self)

◆ find_access()

"minsn_t *" find_access ( self,
"mop_t" op,
"minsn_t **" parent,
"minsn_t" mend,
"int" fdflags )

This function search inside one block.

Parameters
op(C++: const mop_t &) operand to search for
parent(C++: minsn_t **) ptr to ptr to a top level instruction. denotes the beginning of the search range.
mend(C++: const minsn_t *) 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.
fdflags(C++: int) 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 *p_i1. nullptr means 'not found'.

◆ find_def()

"minsn_t *" find_def ( self,
"mop_t" op,
"minsn_t **" p_i1,
"minsn_t" i2,
"int" fdflags )
Parameters
opmop_t const &
p_i1minsn_t **
i2minsn_t const *
fdflagsint

◆ find_first_use()

"minsn_t *" find_first_use ( self,
* args )
Parameters
listmlist_t *
i1minsn_t *
i2minsn_t const *
maymustmaymust_t

◆ find_redefinition()

"minsn_t *" find_redefinition ( self,
* args )
Parameters
listmlist_t const &
i1minsn_t *
i2minsn_t const *
maymustmaymust_t

◆ find_use()

"minsn_t *" find_use ( self,
"mop_t" op,
"minsn_t **" p_i1,
"minsn_t" i2,
"int" fdflags )
Parameters
opmop_t const &
p_i1minsn_t **
i2minsn_t const *
fdflagsint

◆ for_all_insns()

"int" for_all_insns ( self,
"minsn_visitor_t" mv )

This function visits subinstructions too.

Parameters
mv(C++: minsn_visitor_t &) 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 )

This function visit subinstruction operands too.

Parameters
mv(C++: mop_visitor_t &) 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 )
Parameters
list(C++: mlist_t *) ptr to the list of locations. it may be modified: parts that get redefined by the instructions in [i1,i2) will be deleted.
i1(C++: minsn_t *) starting instruction. must be a top level insn.
i2(C++: minsn_t *) ending instruction (excluded). must be a top level insn.
mmv(C++: mlist_mop_visitor_t &) operand visitor
Returns
: zero or the value returned by mmv.visit_mop()

◆ get_reginsn_qty()

"size_t" get_reginsn_qty ( self)

Assertions are skipped by this function.

Returns
: Number of non-assertion instructions in the block.

◆ get_valranges()

"bool" get_valranges ( self,
* args )
Parameters
res(C++: valrng_t *) set of value ranges
vivl(C++: const vivl_t &) what to search for
vrflags(C++: int) combination of bits for get_valranges bits get_valranges(self, res, vivl, m, vrflags) -> bool
resvalrng_t *
vivlvivl_t const &
mminsn_t const *
vrflagsint

◆ insert_into_block()

"minsn_t *" insert_into_block ( self,
"minsn_t" nm,
"minsn_t" om )
Parameters
nm(C++: minsn_t *) new instruction
om(C++: minsn_t *) 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 )
Parameters
list(C++: const mlist_t &) list of locations to check.
i1(C++: const minsn_t *) starting instruction of the range (must be a top level insn)
i2(C++: const minsn_t *) 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.
maymust(C++: maymust_t) 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 )
Parameters
ins(C++: const minsn_t *) instruction to consider
i1(C++: const minsn_t *) starting instruction of the range (must be a top level insn)
i2(C++: const minsn_t *) 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 )
Parameters
list(C++: mlist_t *) list of locations. LIST may be modified by the function: redefined locations will be removed from it.
i1(C++: const minsn_t *) starting instruction of the range (must be a top level insn)
i2(C++: const minsn_t *) 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.
maymust(C++: maymust_t) 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()

"void" make_nop ( self,
"minsn_t" m )

This is the recommended function to use because it also marks the block use-def lists dirty.

Parameters
m(C++: minsn_t *)

◆ mark_lists_dirty()

"void" mark_lists_dirty ( self)

◆ needs_propagation()

"bool" needs_propagation ( self)

◆ npred()

"int" npred ( self)

◆ nsucc()

"int" nsucc ( self)

◆ optimize_block()

"int" optimize_block ( self)

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 )
Parameters
m(C++: minsn_t *) pointer to a top level instruction
optflags(C++: int) 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)

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 )
Parameters
nint

◆ preds()

preds ( self)

◆ remove_from_block()

"minsn_t *" remove_from_block ( self,
"minsn_t" m )
Parameters
m(C++: minsn_t *) instruction to remove The removed instruction is not deleted, the caller gets its ownership
Returns
: pointer to the next instruction

◆ request_demote64()

"void" request_demote64 ( self)

◆ request_propagation()

"void" request_propagation ( self)

◆ succ()

"int" succ ( self,
"int" n )
Parameters
nint

◆ succs()

succs ( self)

Member Data Documentation

◆ dead_at_start

str dead_at_start = property(_ida_hexrays.mblock_t_dead_at_start_get, _ida_hexrays.mblock_t_dead_at_start_set, doc=)
static

◆ dnu

str dnu = property(_ida_hexrays.mblock_t_dnu_get, _ida_hexrays.mblock_t_dnu_set, doc=)
static

◆ end

str end = property(_ida_hexrays.mblock_t_end_get, _ida_hexrays.mblock_t_end_set, doc=)
static

◆ flags

str flags = property(_ida_hexrays.mblock_t_flags_get, _ida_hexrays.mblock_t_flags_set, doc=)
static

◆ head

str head = property(_ida_hexrays.mblock_t_head_get, _ida_hexrays.mblock_t_head_set, doc=)
static

◆ maxbsp

str maxbsp = property(_ida_hexrays.mblock_t_maxbsp_get, _ida_hexrays.mblock_t_maxbsp_set, doc=)
static

◆ maybdef

str maybdef = property(_ida_hexrays.mblock_t_maybdef_get, _ida_hexrays.mblock_t_maybdef_set, doc=)
static

◆ maybuse

str maybuse = property(_ida_hexrays.mblock_t_maybuse_get, _ida_hexrays.mblock_t_maybuse_set, doc=)
static

◆ mba

str mba = property(_ida_hexrays.mblock_t_mba_get, _ida_hexrays.mblock_t_mba_set, doc=)
static

◆ minbargref

str minbargref = property(_ida_hexrays.mblock_t_minbargref_get, _ida_hexrays.mblock_t_minbargref_set, doc=)
static

◆ minbstkref

str minbstkref = property(_ida_hexrays.mblock_t_minbstkref_get, _ida_hexrays.mblock_t_minbstkref_set, doc=)
static

◆ mustbdef

str mustbdef = property(_ida_hexrays.mblock_t_mustbdef_get, _ida_hexrays.mblock_t_mustbdef_set, doc=)
static

◆ mustbuse

str mustbuse = property(_ida_hexrays.mblock_t_mustbuse_get, _ida_hexrays.mblock_t_mustbuse_set, doc=)
static

◆ nextb

str nextb = property(_ida_hexrays.mblock_t_nextb_get, _ida_hexrays.mblock_t_nextb_set, doc=)
static

◆ predset

str predset = property(_ida_hexrays.mblock_t_predset_get, _ida_hexrays.mblock_t_predset_set, doc=)
static

◆ prevb

str prevb = property(_ida_hexrays.mblock_t_prevb_get, _ida_hexrays.mblock_t_prevb_set, doc=)
static

◆ serial

str serial = property(_ida_hexrays.mblock_t_serial_get, _ida_hexrays.mblock_t_serial_set, doc=)
static

◆ start

str start = property(_ida_hexrays.mblock_t_start_get, _ida_hexrays.mblock_t_start_set, doc=)
static

◆ succset

str succset = property(_ida_hexrays.mblock_t_succset_get, _ida_hexrays.mblock_t_succset_set, doc=)
static

◆ tail

str tail = property(_ida_hexrays.mblock_t_tail_get, _ida_hexrays.mblock_t_tail_set, doc=)
static

◆ type

str type = property(_ida_hexrays.mblock_t_type_get, _ida_hexrays.mblock_t_type_set, doc=)
static

Property Documentation

◆ thisown

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

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