IDAPython 8.4
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, *args)
 mark_lists_dirty(self)
 
"void" request_propagation (self, *args)
 request_propagation(self)
 
"bool" needs_propagation (self, *args)
 needs_propagation(self) -> bool
 
"void" request_demote64 (self, *args)
 request_demote64(self)
 
"bool" lists_dirty (self, *args)
 lists_dirty(self) -> bool
 
"bool" lists_ready (self, *args)
 lists_ready(self) -> bool
 
"int" make_lists_ready (self, *args)
 make_lists_ready(self) -> int
 
"int" npred (self, *args)
 npred(self) -> int Get number of block predecessors.
 
"int" nsucc (self, *args)
 nsucc(self) -> int Get number of block successors.
 
"int" pred (self, *args)
 pred(self, n) -> int
 
"int" succ (self, *args)
 succ(self, n) -> int
 
"bool" empty (self, *args)
 empty(self) -> bool
 
"void" dump (self, *args)
 dump(self) Dump block info.
 
"void" dump_block (self, *args)
 dump_block(self, title)
 
"minsn_t *" insert_into_block (self, *args)
 insert_into_block(self, nm, om) -> minsn_t Insert instruction into the doubly linked list
 
"minsn_t *" remove_from_block (self, *args)
 remove_from_block(self, m) -> minsn_t Remove instruction from the doubly linked list
 
"int" for_all_insns (self, *args)
 for_all_insns(self, mv) -> int Visit all instructions.
 
"int" for_all_ops (self, *args)
 for_all_ops(self, mv) -> int Visit all operands.
 
"int" for_all_uses (self, *args)
 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, *args)
 optimize_block(self) -> int Optimize a basic block.
 
"int" build_lists (self, *args)
 build_lists(self, kill_deads) -> int Build def-use lists and eliminate deads.
 
"int" optimize_useless_jump (self, *args)
 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, *args)
 append_def_list(self, list, op, maymust) Append def-list of an operand.
 
"mlist_t" build_use_list (self, *args)
 build_use_list(self, ins, maymust) -> mlist_t Build use-list of an instruction.
 
"mlist_t" build_def_list (self, *args)
 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, *args)
 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, *args)
 find_access(self, op, parent, mend, fdflags) -> minsn_t Find the instruction that accesses the specified operand.
 
"minsn_t *" find_def (self, *args)
 find_def(self, op, p_i1, i2, fdflags) -> minsn_t
 
"minsn_t *" find_use (self, *args)
 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, *args)
 make_nop(self, m) Erase the instruction (convert it to nop) and mark the lists dirty.
 
"size_t" get_reginsn_qty (self, *args)
 get_reginsn_qty(self) -> size_t Calculate number of regular instructions in the block.
 
"bool" is_call_block (self, *args)
 is_call_block(self) -> bool
 
"bool" is_unknown_call (self, *args)
 is_unknown_call(self) -> bool
 
"bool" is_nway (self, *args)
 is_nway(self) -> bool
 
"bool" is_branch (self, *args)
 is_branch(self) -> bool
 
"bool" is_simple_goto_block (self, *args)
 is_simple_goto_block(self) -> bool
 
"bool" is_simple_jcnd_block (self, *args)
 is_simple_jcnd_block(self) -> bool
 
 preds (self)
 Iterates the list of predecessor blocks.
 
 succs (self)
 Iterates the list of successor blocks.
 

Protected Member Functions

"void" _print (self, *args)
 _print(self, vp)
 

Properties

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

Constructor & Destructor Documentation

◆ __init__()

__init__ ( self,
* args,
** kwargs )

Member Function Documentation

◆ _print()

"void" _print ( self,
* args )
protected

Parameters

vp: vd_printer_t &

◆ append_def_list()

"void" append_def_list ( self,
* args )

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,
* args )

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,
* args )
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,
* args )

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,
* args )

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

◆ dump_block()

"void" dump_block ( self,
* args )
Parameters
titlechar const *

◆ empty()

"bool" empty ( self,
* args )

◆ find_access()

"minsn_t *" find_access ( self,
* args )

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,
* args )
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,
* args )
Parameters
opmop_t const &
p_i1minsn_t **
i2minsn_t const *
fdflagsint

◆ for_all_insns()

"int" for_all_insns ( self,
* args )

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,
* args )

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,
* args )
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,
* args )

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,
* args )
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,
* args )

◆ is_call_block()

"bool" is_call_block ( self,
* args )

◆ is_nway()

"bool" is_nway ( self,
* args )

◆ 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,
* args )
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,
* args )

◆ is_simple_jcnd_block()

"bool" is_simple_jcnd_block ( self,
* args )

◆ is_unknown_call()

"bool" is_unknown_call ( self,
* args )

◆ 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,
* args )

◆ lists_ready()

"bool" lists_ready ( self,
* args )

◆ make_lists_ready()

"int" make_lists_ready ( self,
* args )

◆ make_nop()

"void" make_nop ( self,
* args )

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,
* args )

◆ needs_propagation()

"bool" needs_propagation ( self,
* args )

◆ npred()

"int" npred ( self,
* args )

◆ nsucc()

"int" nsucc ( self,
* args )

◆ optimize_block()

"int" optimize_block ( self,
* args )

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,
* args )

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,
* args )
Parameters
nint

◆ preds()

preds ( self)

◆ remove_from_block()

"minsn_t *" remove_from_block ( self,
* args )
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,
* args )

◆ request_propagation()

"void" request_propagation ( self,
* args )

◆ succ()

"int" succ ( self,
* args )
Parameters
nint

◆ succs()

succs ( self)

Property Documentation

◆ dead_at_start

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

◆ dnu

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

◆ end

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

◆ flags

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

◆ head

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

◆ maxbsp

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

◆ maybdef

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

◆ maybuse

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

◆ mba

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

◆ minbargref

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

◆ minbstkref

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

◆ mustbdef

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

◆ mustbuse

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

◆ nextb

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

◆ predset

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

◆ prevb

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

◆ serial

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

◆ start

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

◆ succset

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

◆ tail

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

◆ thisown

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

◆ type

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

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