Microinstruction class #insn. More...
#include <hexrays.hpp>
Public Member Functions | |
bool | is_optional () const |
bool | is_combined () const |
bool | is_farcall () const |
bool | is_cleaning_pop () const |
bool | is_extstx () const |
bool | is_tailcall () const |
bool | is_fpinsn () const |
bool | is_assert () const |
bool | is_persistent () const |
bool | is_wild_match () const |
bool | is_propagatable () const |
bool | is_ignlowsrc () const |
bool | is_inverted_jx () const |
bool | was_noret_icall () const |
bool | is_multimov () const |
bool | is_combinable () const |
bool | was_split () const |
bool | is_mbarrier () const |
bool | was_unmerged () const |
void | set_optional () |
void | set_combined () |
void | clr_combined () |
void | set_farcall () |
void | set_cleaning_pop () |
void | set_extstx () |
void | set_tailcall () |
void | clr_tailcall () |
void | set_fpinsn () |
void | clr_fpinsn () |
void | set_assert () |
void | clr_assert () |
void | set_persistent () |
void | set_wild_match () |
void | clr_propagatable () |
void | set_ignlowsrc () |
void | clr_ignlowsrc () |
void | set_inverted_jx () |
void | set_noret_icall () |
void | clr_noret_icall () |
void | set_multimov () |
void | clr_multimov () |
void | set_combinable () |
void | clr_combinable () |
void | set_mbarrier () |
void | set_unmerged () |
void | set_split_size (int s) |
int | get_split_size () const |
minsn_t (ea_t _ea) | |
Constructor. More... | |
minsn_t (const minsn_t &m) | |
minsn_t & | operator= (const minsn_t &m) |
Assignment operator. It does not copy prev/next fields. More... | |
void | swap (minsn_t &m) |
Swap two instructions. More... | |
void | print (qstring *vout, int shins_flags=SHINS_SHORT|SHINS_VALNUM) const |
Generate insn text into the buffer. More... | |
const char * | dstr () const |
Get displayable text without tags in a static buffer. More... | |
void | setaddr (ea_t new_ea) |
Change the instruction address. More... | |
int | optimize_solo (int optflags=0) |
Optimize one instruction without context. More... | |
int | optimize_subtree (mblock_t *blk, minsn_t *top, minsn_t *parent, ea_t *converted_call, int optflags=OPTI_MINSTKREF) |
Optimize instruction in its context. More... | |
int | for_all_ops (mop_visitor_t &mv) |
Visit all instruction operands. More... | |
int | for_all_insns (minsn_visitor_t &mv) |
Visit all instructions. More... | |
void | _make_nop () |
Convert instruction to nop. More... | |
bool | equal_insns (const minsn_t &m, int eqflags) const |
Compare instructions. More... | |
bool | operator< (const minsn_t &ri) const |
Lexographical comparison It can be used to store minsn_t in various containers, like std::set. More... | |
int | lexcompare (const minsn_t &ri) const |
bool | is_noret_call (int flags=0) |
Is a non-returing call? More... | |
bool | is_unknown_call () const |
Is an unknown call? Unknown calls are calls without the argument list (mcallinfo_t). More... | |
bool | is_helper (const char *name) const |
Is a helper call with the specified name? Helper calls usually have well-known function names (see Well known function names) but they may have any other name. More... | |
minsn_t * | find_call (bool with_helpers=false) const |
Find a call instruction. More... | |
bool | contains_call (bool with_helpers=false) const |
Does the instruction contain a call? More... | |
bool | has_side_effects (bool include_ldx_and_divs=false) const |
Does the instruction have a side effect? More... | |
funcrole_t | get_role () const |
Get the function role of a call. More... | |
bool | is_memcpy () const |
bool | is_memset () const |
bool | is_alloca () const |
bool | is_bswap () const |
bool | is_readflags () const |
bool | contains_opcode (mcode_t mcode) const |
Does the instruction have the specified opcode? This function searches subinstructions as well. More... | |
const minsn_t * | find_opcode (mcode_t mcode) const |
Find a (sub)insruction with the specified opcode. More... | |
minsn_t * | find_opcode (mcode_t mcode) |
const minsn_t * | find_ins_op (const mop_t **other, mcode_t op=m_nop) const |
Find an operand that is a subinsruction with the specified opcode. More... | |
minsn_t * | find_ins_op (mop_t **other, mcode_t op=m_nop) |
const mop_t * | find_num_op (const mop_t **other) const |
Find a numeric operand of the current instruction. More... | |
mop_t * | find_num_op (mop_t **other) |
bool | is_mov () const |
bool | is_like_move () const |
bool | modifies_d () const |
Does the instruction modify its 'd' operand? Some instructions (e.g. More... | |
bool | modifies_pair_mop () const |
bool | is_between (const minsn_t *m1, const minsn_t *m2) const |
Is the instruction in the specified range of instructions? More... | |
bool | is_after (const minsn_t *m) const |
Is the instruction after the specified one? More... | |
bool | may_use_aliased_memory () const |
Is it possible for the instruction to use aliased memory? More... | |
int | serialize (bytevec_t *b) const |
Serialize an instruction. More... | |
bool | deserialize (const uchar *bytes, size_t nbytes, int format_version) |
Deserialize an instruction. More... | |
Public Attributes | |
mcode_t | opcode |
instruction opcode More... | |
int | iprops |
combination of instruction property bits bits More... | |
minsn_t * | next |
next insn in doubly linked list. check also nexti() More... | |
minsn_t * | prev |
prev insn in doubly linked list. check also previ() More... | |
ea_t | ea |
instruction address More... | |
mop_t | l |
left operand More... | |
mop_t | r |
right operand More... | |
mop_t | d |
destination operand More... | |
Detailed Description
Microinstruction class #insn.
- Examples
- hexrays_sample10.cpp, hexrays_sample11.cpp, hexrays_sample12.cpp, hexrays_sample15.cpp, hexrays_sample16.cpp, and hexrays_sample18.cpp.
Definition at line 3464 of file hexrays.hpp.
Constructor & Destructor Documentation
◆ minsn_t() [1/2]
minsn_t::minsn_t | ( | ea_t | _ea | ) |
Constructor.
Definition at line 3580 of file hexrays.hpp.
◆ minsn_t() [2/2]
minsn_t::minsn_t | ( | const minsn_t & | m | ) |
Definition at line 3581 of file hexrays.hpp.
Member Function Documentation
◆ _make_nop()
void minsn_t::_make_nop | ( | ) |
Convert instruction to nop.
This function erases all info but the prev/next fields. In most cases it is better to use mblock_t::make_nop(), which also marks the block lists as dirty.
Definition at line 10957 of file hexrays.hpp.
Referenced by mblock_t::make_nop().
◆ clr_assert()
void minsn_t::clr_assert | ( | ) |
Definition at line 3550 of file hexrays.hpp.
◆ clr_combinable()
void minsn_t::clr_combinable | ( | ) |
Definition at line 3562 of file hexrays.hpp.
◆ clr_combined()
void minsn_t::clr_combined | ( | ) |
Definition at line 3541 of file hexrays.hpp.
◆ clr_fpinsn()
void minsn_t::clr_fpinsn | ( | ) |
Definition at line 3548 of file hexrays.hpp.
◆ clr_ignlowsrc()
void minsn_t::clr_ignlowsrc | ( | ) |
Definition at line 3555 of file hexrays.hpp.
◆ clr_multimov()
void minsn_t::clr_multimov | ( | ) |
Definition at line 3560 of file hexrays.hpp.
◆ clr_noret_icall()
void minsn_t::clr_noret_icall | ( | ) |
Definition at line 3558 of file hexrays.hpp.
◆ clr_propagatable()
void minsn_t::clr_propagatable | ( | ) |
Definition at line 3553 of file hexrays.hpp.
◆ clr_tailcall()
void minsn_t::clr_tailcall | ( | ) |
Definition at line 3546 of file hexrays.hpp.
◆ contains_call()
bool minsn_t::contains_call | ( | bool | with_helpers = false | ) | const |
Does the instruction contain a call?
Definition at line 3693 of file hexrays.hpp.
◆ contains_opcode()
bool minsn_t::contains_opcode | ( | mcode_t | mcode | ) | const |
Does the instruction have the specified opcode? This function searches subinstructions as well.
- Parameters
-
mcode opcode to search for.
Definition at line 3715 of file hexrays.hpp.
◆ deserialize()
bool minsn_t::deserialize | ( | const uchar * | bytes, |
size_t | nbytes, | ||
int | format_version | ||
) |
Deserialize an instruction.
- Parameters
-
bytes pointer to serialized data nbytes number of bytes to deserialize format_version serialization format version. this value is returned by minsn_t::serialize()
- Returns
- success
Definition at line 11041 of file hexrays.hpp.
◆ dstr()
const char * minsn_t::dstr | ( | ) | const |
Get displayable text without tags in a static buffer.
- Examples
- hexrays_sample18.cpp.
Definition at line 10927 of file hexrays.hpp.
◆ equal_insns()
bool minsn_t::equal_insns | ( | const minsn_t & | m, |
int | eqflags | ||
) | const |
Compare instructions.
This is the main comparison function for instructions.
- Parameters
-
m instruction to compare with eqflags combination of comparison bits bits
Definition at line 10963 of file hexrays.hpp.
◆ find_call()
minsn_t * minsn_t::find_call | ( | bool | with_helpers = false | ) | const |
Find a call instruction.
Check for the current instruction and its subinstructions.
- Parameters
-
with_helpers consider helper calls as well?
Definition at line 10987 of file hexrays.hpp.
◆ find_ins_op() [1/2]
Find an operand that is a subinsruction with the specified opcode.
This function checks only the 'l' and 'r' operands of the current insn.
- Parameters
-
[out] other pointer to the other operand (&r if we return &l and vice versa) op opcode to search for
- Returns
- &l or &r or nullptr
Definition at line 11005 of file hexrays.hpp.
◆ find_ins_op() [2/2]
Definition at line 3729 of file hexrays.hpp.
◆ find_num_op() [1/2]
Find a numeric operand of the current instruction.
This function checks only the 'l' and 'r' operands of the current insn.
- Parameters
-
[out] other pointer to the other operand (&r if we return &l and vice versa)
- Returns
- &l or &r or nullptr
Definition at line 11011 of file hexrays.hpp.
◆ find_num_op() [2/2]
Definition at line 3737 of file hexrays.hpp.
◆ find_opcode() [1/2]
minsn_t * minsn_t::find_opcode | ( | mcode_t | mcode | ) |
Definition at line 10999 of file hexrays.hpp.
◆ find_opcode() [2/2]
const minsn_t * minsn_t::find_opcode | ( | mcode_t | mcode | ) | const |
Find a (sub)insruction with the specified opcode.
- Parameters
-
mcode opcode to search for.
Definition at line 3719 of file hexrays.hpp.
References find_opcode().
Referenced by find_opcode().
◆ for_all_insns()
int minsn_t::for_all_insns | ( | minsn_visitor_t & | mv | ) |
Visit all instructions.
This function visits the instruction itself and all its subinstructions.
- Parameters
-
mv instruction visitor
- Returns
- non-zero value returned by mv.visit_mop() or zero
Definition at line 10951 of file hexrays.hpp.
◆ for_all_ops()
int minsn_t::for_all_ops | ( | mop_visitor_t & | mv | ) |
Visit all instruction operands.
This function visits subinstruction operands as well.
- Parameters
-
mv operand visitor
- Returns
- non-zero value returned by mv.visit_mop() or zero
Definition at line 10945 of file hexrays.hpp.
◆ get_role()
funcrole_t minsn_t::get_role | ( | ) | const |
Get the function role of a call.
Definition at line 3702 of file hexrays.hpp.
References mop_t::is_arglist(), mcallinfo_t::role, and ROLE_UNK.
◆ get_split_size()
int minsn_t::get_split_size | ( | ) | const |
Definition at line 3573 of file hexrays.hpp.
◆ has_side_effects()
bool minsn_t::has_side_effects | ( | bool | include_ldx_and_divs = false | ) | const |
Does the instruction have a side effect?
- Parameters
-
include_ldx_and_divs consider ldx/div/mod as having side effects? stx is always considered as having side effects. Apart from ldx/std only call may have side effects.
Definition at line 10993 of file hexrays.hpp.
◆ is_after()
bool minsn_t::is_after | ( | const minsn_t * | m | ) | const |
Is the instruction after the specified one?
- Parameters
-
m the instruction to compare against in the list
Definition at line 3756 of file hexrays.hpp.
References next.
◆ is_alloca()
bool minsn_t::is_alloca | ( | ) | const |
Definition at line 3705 of file hexrays.hpp.
◆ is_assert()
bool minsn_t::is_assert | ( | ) | const |
Definition at line 3526 of file hexrays.hpp.
◆ is_between()
Is the instruction in the specified range of instructions?
- Parameters
-
m1 beginning of the range in the doubly linked list m2 end of the range in the doubly linked list (excluded, may be nullptr) This function assumes that m1 and m2 belong to the same basic block and they are top level instructions.
Definition at line 11023 of file hexrays.hpp.
◆ is_bswap()
bool minsn_t::is_bswap | ( | ) | const |
Definition at line 3706 of file hexrays.hpp.
◆ is_cleaning_pop()
bool minsn_t::is_cleaning_pop | ( | ) | const |
Definition at line 3522 of file hexrays.hpp.
◆ is_combinable()
bool minsn_t::is_combinable | ( | ) | const |
Definition at line 3534 of file hexrays.hpp.
◆ is_combined()
bool minsn_t::is_combined | ( | ) | const |
Definition at line 3520 of file hexrays.hpp.
◆ is_extstx()
bool minsn_t::is_extstx | ( | ) | const |
Definition at line 3523 of file hexrays.hpp.
◆ is_farcall()
bool minsn_t::is_farcall | ( | ) | const |
Definition at line 3521 of file hexrays.hpp.
◆ is_fpinsn()
bool minsn_t::is_fpinsn | ( | ) | const |
Definition at line 3525 of file hexrays.hpp.
◆ is_helper()
bool minsn_t::is_helper | ( | const char * | name | ) | const |
Is a helper call with the specified name? Helper calls usually have well-known function names (see Well known function names) but they may have any other name.
The decompiler does not assume any special meaning for non-well-known names.
- Examples
- hexrays_sample10.cpp.
Definition at line 10981 of file hexrays.hpp.
◆ is_ignlowsrc()
bool minsn_t::is_ignlowsrc | ( | ) | const |
Definition at line 3530 of file hexrays.hpp.
◆ is_inverted_jx()
bool minsn_t::is_inverted_jx | ( | ) | const |
Definition at line 3531 of file hexrays.hpp.
◆ is_like_move()
bool minsn_t::is_like_move | ( | ) | const |
Definition at line 3740 of file hexrays.hpp.
◆ is_mbarrier()
bool minsn_t::is_mbarrier | ( | ) | const |
Definition at line 3536 of file hexrays.hpp.
◆ is_memcpy()
bool minsn_t::is_memcpy | ( | ) | const |
Definition at line 3703 of file hexrays.hpp.
◆ is_memset()
bool minsn_t::is_memset | ( | ) | const |
Definition at line 3704 of file hexrays.hpp.
◆ is_mov()
bool minsn_t::is_mov | ( | ) | const |
Definition at line 3739 of file hexrays.hpp.
◆ is_multimov()
bool minsn_t::is_multimov | ( | ) | const |
Definition at line 3533 of file hexrays.hpp.
◆ is_noret_call()
bool minsn_t::is_noret_call | ( | int | flags = 0 | ) |
Is a non-returing call?
- Parameters
-
flags combination of NORET_... bits
Definition at line 10975 of file hexrays.hpp.
◆ is_optional()
bool minsn_t::is_optional | ( | ) | const |
Definition at line 3519 of file hexrays.hpp.
◆ is_persistent()
bool minsn_t::is_persistent | ( | ) | const |
Definition at line 3527 of file hexrays.hpp.
◆ is_propagatable()
bool minsn_t::is_propagatable | ( | ) | const |
Definition at line 3529 of file hexrays.hpp.
◆ is_readflags()
bool minsn_t::is_readflags | ( | ) | const |
Definition at line 3707 of file hexrays.hpp.
◆ is_tailcall()
bool minsn_t::is_tailcall | ( | ) | const |
Definition at line 3524 of file hexrays.hpp.
◆ is_unknown_call()
bool minsn_t::is_unknown_call | ( | ) | const |
Is an unknown call? Unknown calls are calls without the argument list (mcallinfo_t).
Usually the argument lists are determined by mba_t::analyze_calls(). Unknown calls exist until the MMAT_CALLS maturity level. See also mblock_t::is_call_block
Definition at line 3679 of file hexrays.hpp.
◆ is_wild_match()
bool minsn_t::is_wild_match | ( | ) | const |
Definition at line 3528 of file hexrays.hpp.
◆ lexcompare()
int minsn_t::lexcompare | ( | const minsn_t & | ri | ) | const |
Definition at line 10969 of file hexrays.hpp.
◆ may_use_aliased_memory()
bool minsn_t::may_use_aliased_memory | ( | ) | const |
Is it possible for the instruction to use aliased memory?
Definition at line 11029 of file hexrays.hpp.
◆ modifies_d()
bool minsn_t::modifies_d | ( | ) | const |
Does the instruction modify its 'd' operand? Some instructions (e.g.
m_stx) do not modify the 'd' operand.
Definition at line 11017 of file hexrays.hpp.
◆ modifies_pair_mop()
bool minsn_t::modifies_pair_mop | ( | ) | const |
Definition at line 3745 of file hexrays.hpp.
◆ operator<()
bool minsn_t::operator< | ( | const minsn_t & | ri | ) | const |
Lexographical comparison It can be used to store minsn_t in various containers, like std::set.
Definition at line 3662 of file hexrays.hpp.
◆ operator=()
Assignment operator. It does not copy prev/next fields.
Definition at line 3585 of file hexrays.hpp.
◆ optimize_solo()
int minsn_t::optimize_solo | ( | int | optflags = 0 | ) |
Optimize one instruction without context.
This function does not have access to the instruction context (the previous and next instructions in the list, the block number, etc). It performs only basic optimizations that are available without this info.
- Parameters
-
optflags combination of optimization flags bits
- Returns
- number of changes, 0-unchanged See also mblock_t::optimize_insn()
- Examples
- hexrays_sample16.cpp.
Definition at line 3609 of file hexrays.hpp.
◆ optimize_subtree()
int minsn_t::optimize_subtree | ( | mblock_t * | blk, |
minsn_t * | top, | ||
minsn_t * | parent, | ||
ea_t * | converted_call, | ||
int | optflags = OPTI_MINSTKREF |
||
) |
Optimize instruction in its context.
Do not use this function, use mblock_t::optimize()
Definition at line 10939 of file hexrays.hpp.
◆ print()
void minsn_t::print | ( | qstring * | vout, |
int | shins_flags = SHINS_SHORT|SHINS_VALNUM |
||
) | const |
Generate insn text into the buffer.
Definition at line 10921 of file hexrays.hpp.
◆ serialize()
int minsn_t::serialize | ( | bytevec_t * | b | ) | const |
Serialize an instruction.
- Parameters
-
b the output buffer
- Returns
- the serialization format that was used to store info
Definition at line 11035 of file hexrays.hpp.
◆ set_assert()
void minsn_t::set_assert | ( | ) |
Definition at line 3549 of file hexrays.hpp.
◆ set_cleaning_pop()
void minsn_t::set_cleaning_pop | ( | ) |
Definition at line 3543 of file hexrays.hpp.
◆ set_combinable()
void minsn_t::set_combinable | ( | ) |
Definition at line 3561 of file hexrays.hpp.
◆ set_combined()
void minsn_t::set_combined | ( | ) |
Definition at line 10909 of file hexrays.hpp.
◆ set_extstx()
void minsn_t::set_extstx | ( | ) |
Definition at line 3544 of file hexrays.hpp.
◆ set_farcall()
void minsn_t::set_farcall | ( | ) |
Definition at line 3542 of file hexrays.hpp.
◆ set_fpinsn()
void minsn_t::set_fpinsn | ( | ) |
Definition at line 3547 of file hexrays.hpp.
◆ set_ignlowsrc()
void minsn_t::set_ignlowsrc | ( | ) |
Definition at line 3554 of file hexrays.hpp.
◆ set_inverted_jx()
void minsn_t::set_inverted_jx | ( | ) |
Definition at line 3556 of file hexrays.hpp.
◆ set_mbarrier()
void minsn_t::set_mbarrier | ( | ) |
Definition at line 3563 of file hexrays.hpp.
◆ set_multimov()
void minsn_t::set_multimov | ( | ) |
Definition at line 3559 of file hexrays.hpp.
◆ set_noret_icall()
void minsn_t::set_noret_icall | ( | ) |
Definition at line 3557 of file hexrays.hpp.
◆ set_optional()
void minsn_t::set_optional | ( | ) |
Definition at line 3539 of file hexrays.hpp.
◆ set_persistent()
void minsn_t::set_persistent | ( | ) |
Definition at line 3551 of file hexrays.hpp.
◆ set_split_size()
void minsn_t::set_split_size | ( | int | s | ) |
Definition at line 3565 of file hexrays.hpp.
◆ set_tailcall()
void minsn_t::set_tailcall | ( | ) |
Definition at line 3545 of file hexrays.hpp.
◆ set_unmerged()
void minsn_t::set_unmerged | ( | ) |
Definition at line 3564 of file hexrays.hpp.
◆ set_wild_match()
void minsn_t::set_wild_match | ( | ) |
Definition at line 3552 of file hexrays.hpp.
◆ setaddr()
void minsn_t::setaddr | ( | ea_t | new_ea | ) |
Change the instruction address.
This function modifies subinstructions as well.
Definition at line 10933 of file hexrays.hpp.
◆ swap()
void minsn_t::swap | ( | minsn_t & | m | ) |
Swap two instructions.
The prev/next fields are not modified by this function because it would corrupt the doubly linked list.
Definition at line 10915 of file hexrays.hpp.
◆ was_noret_icall()
bool minsn_t::was_noret_icall | ( | ) | const |
Definition at line 3532 of file hexrays.hpp.
◆ was_split()
bool minsn_t::was_split | ( | ) | const |
Definition at line 3535 of file hexrays.hpp.
◆ was_unmerged()
bool minsn_t::was_unmerged | ( | ) | const |
Definition at line 3537 of file hexrays.hpp.
Member Data Documentation
◆ d
mop_t minsn_t::d |
destination operand
- Examples
- hexrays_sample10.cpp, hexrays_sample16.cpp, and hexrays_sample18.cpp.
Definition at line 3476 of file hexrays.hpp.
◆ ea
ea_t minsn_t::ea |
instruction address
- Examples
- hexrays_sample10.cpp, and hexrays_sample15.cpp.
Definition at line 3473 of file hexrays.hpp.
◆ iprops
int minsn_t::iprops |
combination of instruction property bits bits
- Examples
- hexrays_sample18.cpp.
Definition at line 3470 of file hexrays.hpp.
◆ l
mop_t minsn_t::l |
left operand
- Examples
- hexrays_sample11.cpp, hexrays_sample16.cpp, and hexrays_sample18.cpp.
Definition at line 3474 of file hexrays.hpp.
◆ next
minsn_t* minsn_t::next |
next insn in doubly linked list. check also nexti()
- Examples
- hexrays_sample12.cpp.
Definition at line 3471 of file hexrays.hpp.
Referenced by is_after().
◆ opcode
mcode_t minsn_t::opcode |
instruction opcode
- Examples
- hexrays_sample11.cpp, hexrays_sample16.cpp, and hexrays_sample18.cpp.
Definition at line 3469 of file hexrays.hpp.
◆ prev
minsn_t* minsn_t::prev |
prev insn in doubly linked list. check also previ()
- Examples
- hexrays_sample12.cpp, and hexrays_sample16.cpp.
Definition at line 3472 of file hexrays.hpp.
◆ r
mop_t minsn_t::r |