IDA C++ SDK 9.2
Loading...
Searching...
No Matches
minsn_t Class Reference

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
bool was_unpaired () const
void set_optional ()
void hexapi 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.
 minsn_t (const minsn_t &m)
 HEXRAYS_MEMORY_ALLOCATION_FUNCS () minsn_t &operator
 Assignment operator. It does not copy prev/next fields.
void hexapi print (qstring *vout, int shins_flags=SHINS_SHORT|SHINS_VALNUM) const
 Generate insn text into the buffer.
const char *hexapi dstr () const
 Get displayable text without tags in a static buffer.
void hexapi setaddr (ea_t new_ea)
 Change the instruction address.
int optimize_solo (int optflags=0)
 Optimize one instruction without context.
int hexapi optimize_subtree (mblock_t *blk, minsn_t *top, minsn_t *parent, ea_t *converted_call, int optflags=OPTI_MINSTKREF)
 Optimize instruction in its context.
int hexapi for_all_ops (mop_visitor_t &mv)
 Visit all instruction operands.
int hexapi for_all_insns (minsn_visitor_t &mv)
 Visit all instructions.
void hexapi _make_nop ()
 Convert instruction to nop.
bool hexapi equal_insns (const minsn_t &m, int eqflags) const
 Compare instructions.
bool operator< (const minsn_t &ri) const
 Lexographical comparison It can be used to store minsn_t in various containers, like std::set.
int hexapi lexcompare (const minsn_t &ri) const
bool hexapi is_noret_call (int flags=0)
 Is a non-returing call?
bool is_unknown_call () const
 Is an unknown call?
bool hexapi is_helper (const char *name) const
 Is a helper call with the specified name?
minsn_t *hexapi find_call (bool with_helpers=false) const
 Find a call instruction.
bool contains_call (bool with_helpers=false) const
 Does the instruction contain a call?
bool hexapi has_side_effects (bool include_ldx_and_divs=false) const
 Does the instruction have a side effect?
funcrole_t get_role () const
 Get the function role of a call.
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?
const minsn_tfind_opcode (mcode_t mcode) const
 Find a (sub)insruction with the specified opcode.
minsn_t *hexapi find_opcode (mcode_t mcode)
const minsn_t *hexapi find_ins_op (const mop_t **other, mcode_t op=m_nop) const
 Find an operand that is a subinsruction with the specified opcode.
minsn_tfind_ins_op (mop_t **other, mcode_t op=m_nop)
const mop_t *hexapi find_num_op (const mop_t **other) const
 Find a numeric operand of the current instruction.
mop_tfind_num_op (mop_t **other)
bool is_mov () const
bool is_like_move () const
bool hexapi modifies_d () const
 Does the instruction modify its 'd' operand?
bool modifies_pair_mop () const
bool hexapi is_between (const minsn_t *m1, const minsn_t *m2) const
 Is the instruction in the specified range of instructions?
bool is_after (const minsn_t *m) const
 Is the instruction after the specified one?
bool hexapi may_use_aliased_memory () const
 Is it possible for the instruction to use aliased memory?
int hexapi serialize (bytevec_t *b) const
 Serialize an instruction.
bool hexapi deserialize (const uchar *bytes, size_t nbytes, int format_version)
 Deserialize an instruction.

Public Attributes

mcode_t opcode
 instruction opcode
int iprops
 combination of instruction property bits bits
minsn_tnext
 next insn in doubly linked list. check also nexti()
minsn_tprev
 prev insn in doubly linked list. check also previ()
ea_t ea
 instruction address
mop_t l
 left operand
mop_t r
 right operand
mop_t d
 destination operand

Detailed Description

Microinstruction class #insn.

Constructor & Destructor Documentation

◆ minsn_t() [1/2]

minsn_t::minsn_t ( ea_t _ea)
inline

Constructor.

◆ minsn_t() [2/2]

minsn_t::minsn_t ( const minsn_t & m)
inline

Member Function Documentation

◆ is_optional()

bool minsn_t::is_optional ( ) const
inline

◆ is_combined()

bool minsn_t::is_combined ( ) const
inline

◆ is_farcall()

bool minsn_t::is_farcall ( ) const
inline

◆ is_cleaning_pop()

bool minsn_t::is_cleaning_pop ( ) const
inline

◆ is_extstx()

bool minsn_t::is_extstx ( ) const
inline

◆ is_tailcall()

bool minsn_t::is_tailcall ( ) const
inline

◆ is_fpinsn()

bool minsn_t::is_fpinsn ( ) const
inline

◆ is_assert()

bool minsn_t::is_assert ( ) const
inline

◆ is_persistent()

bool minsn_t::is_persistent ( ) const
inline

◆ is_wild_match()

bool minsn_t::is_wild_match ( ) const
inline

◆ is_propagatable()

bool minsn_t::is_propagatable ( ) const
inline

◆ is_ignlowsrc()

bool minsn_t::is_ignlowsrc ( ) const
inline

◆ is_inverted_jx()

bool minsn_t::is_inverted_jx ( ) const
inline

◆ was_noret_icall()

bool minsn_t::was_noret_icall ( ) const
inline

◆ is_multimov()

bool minsn_t::is_multimov ( ) const
inline

◆ is_combinable()

bool minsn_t::is_combinable ( ) const
inline

◆ was_split()

bool minsn_t::was_split ( ) const
inline

◆ is_mbarrier()

bool minsn_t::is_mbarrier ( ) const
inline

◆ was_unmerged()

bool minsn_t::was_unmerged ( ) const
inline

◆ was_unpaired()

bool minsn_t::was_unpaired ( ) const
inline

◆ set_optional()

void minsn_t::set_optional ( )
inline

◆ set_combined()

void minsn_t::set_combined ( )
inline

◆ clr_combined()

void minsn_t::clr_combined ( )
inline

◆ set_farcall()

void minsn_t::set_farcall ( )
inline

◆ set_cleaning_pop()

void minsn_t::set_cleaning_pop ( )
inline

◆ set_extstx()

void minsn_t::set_extstx ( )
inline

◆ set_tailcall()

void minsn_t::set_tailcall ( )
inline

◆ clr_tailcall()

void minsn_t::clr_tailcall ( )
inline

◆ set_fpinsn()

void minsn_t::set_fpinsn ( )
inline

◆ clr_fpinsn()

void minsn_t::clr_fpinsn ( )
inline

◆ set_assert()

void minsn_t::set_assert ( )
inline

◆ clr_assert()

void minsn_t::clr_assert ( )
inline

◆ set_persistent()

void minsn_t::set_persistent ( )
inline

◆ set_wild_match()

void minsn_t::set_wild_match ( )
inline

◆ clr_propagatable()

void minsn_t::clr_propagatable ( )
inline

◆ set_ignlowsrc()

void minsn_t::set_ignlowsrc ( )
inline

◆ clr_ignlowsrc()

void minsn_t::clr_ignlowsrc ( )
inline

◆ set_inverted_jx()

void minsn_t::set_inverted_jx ( )
inline

◆ set_noret_icall()

void minsn_t::set_noret_icall ( )
inline

◆ clr_noret_icall()

void minsn_t::clr_noret_icall ( )
inline

◆ set_multimov()

void minsn_t::set_multimov ( )
inline

◆ clr_multimov()

void minsn_t::clr_multimov ( )
inline

◆ set_combinable()

void minsn_t::set_combinable ( )
inline

◆ clr_combinable()

void minsn_t::clr_combinable ( )
inline

◆ set_mbarrier()

void minsn_t::set_mbarrier ( )
inline

◆ set_unmerged()

void minsn_t::set_unmerged ( )
inline

◆ set_split_size()

void minsn_t::set_split_size ( int s)
inline

◆ get_split_size()

int minsn_t::get_split_size ( ) const
inline

◆ HEXRAYS_MEMORY_ALLOCATION_FUNCS()

minsn_t::HEXRAYS_MEMORY_ALLOCATION_FUNCS ( ) &

Assignment operator. It does not copy prev/next fields.

◆ print()

void minsn_t::print ( qstring * vout,
int shins_flags = SHINS_SHORT|SHINS_VALNUM ) const
inline

Generate insn text into the buffer.

◆ dstr()

const char * minsn_t::dstr ( ) const
inline

Get displayable text without tags in a static buffer.

◆ setaddr()

void minsn_t::setaddr ( ea_t new_ea)
inline

Change the instruction address.

This function modifies subinstructions as well.

◆ optimize_solo()

int minsn_t::optimize_solo ( int optflags = 0)
inline

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
optflagscombination of optimization flags bits
Returns
number of changes, 0-unchanged See also mblock_t::optimize_insn()

◆ optimize_subtree()

int minsn_t::optimize_subtree ( mblock_t * blk,
minsn_t * top,
minsn_t * parent,
ea_t * converted_call,
int optflags = OPTI_MINSTKREF )
inline

Optimize instruction in its context.

Do not use this function, use mblock_t::optimize()

◆ for_all_ops()

int minsn_t::for_all_ops ( mop_visitor_t & mv)
inline

Visit all instruction operands.

This function visits subinstruction operands as well.

Parameters
mvoperand visitor
Returns
non-zero value returned by mv.visit_mop() or zero

◆ for_all_insns()

int minsn_t::for_all_insns ( minsn_visitor_t & mv)
inline

Visit all instructions.

This function visits the instruction itself and all its subinstructions.

Parameters
mvinstruction visitor
Returns
non-zero value returned by mv.visit_mop() or zero

◆ _make_nop()

void minsn_t::_make_nop ( )
inline

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.

◆ equal_insns()

bool minsn_t::equal_insns ( const minsn_t & m,
int eqflags ) const
inline

Compare instructions.

This is the main comparison function for instructions.

Parameters
minstruction to compare with
eqflagscombination of comparison bits bits

◆ operator<()

bool minsn_t::operator< ( const minsn_t & ri) const
inline

Lexographical comparison It can be used to store minsn_t in various containers, like std::set.

◆ lexcompare()

int minsn_t::lexcompare ( const minsn_t & ri) const
inline

◆ is_noret_call()

bool minsn_t::is_noret_call ( int flags = 0)
inline

Is a non-returing call?

Parameters
flagscombination of NORET_... bits

◆ is_unknown_call()

bool minsn_t::is_unknown_call ( ) const
inline

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

◆ is_helper()

bool minsn_t::is_helper ( const char * name) const
inline

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.

◆ find_call()

minsn_t * minsn_t::find_call ( bool with_helpers = false) const
inline

Find a call instruction.

Check for the current instruction and its subinstructions.

Parameters
with_helpersconsider helper calls as well?

◆ contains_call()

bool minsn_t::contains_call ( bool with_helpers = false) const
inline

Does the instruction contain a call?

◆ has_side_effects()

bool minsn_t::has_side_effects ( bool include_ldx_and_divs = false) const
inline

Does the instruction have a side effect?

Parameters
include_ldx_and_divsconsider 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.

◆ get_role()

funcrole_t minsn_t::get_role ( ) const
inline

Get the function role of a call.

◆ is_memcpy()

bool minsn_t::is_memcpy ( ) const
inline

◆ is_memset()

bool minsn_t::is_memset ( ) const
inline

◆ is_alloca()

bool minsn_t::is_alloca ( ) const
inline

◆ is_bswap()

bool minsn_t::is_bswap ( ) const
inline

◆ is_readflags()

bool minsn_t::is_readflags ( ) const
inline

◆ contains_opcode()

bool minsn_t::contains_opcode ( mcode_t mcode) const
inline

Does the instruction have the specified opcode?

This function searches subinstructions as well.

Parameters
mcodeopcode to search for.

◆ find_opcode() [1/2]

const minsn_t * minsn_t::find_opcode ( mcode_t mcode) const
inline

Find a (sub)insruction with the specified opcode.

Parameters
mcodeopcode to search for.

◆ find_opcode() [2/2]

minsn_t * minsn_t::find_opcode ( mcode_t mcode)
inline

◆ find_ins_op() [1/2]

const minsn_t * minsn_t::find_ins_op ( const mop_t ** other,
mcode_t op = m_nop ) const
inline

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]otherpointer to the other operand (&r if we return &l and vice versa)
opopcode to search for
Returns
&l or &r or nullptr

◆ find_ins_op() [2/2]

minsn_t * minsn_t::find_ins_op ( mop_t ** other,
mcode_t op = m_nop )
inline

◆ find_num_op() [1/2]

const mop_t * minsn_t::find_num_op ( const mop_t ** other) const
inline

Find a numeric operand of the current instruction.

This function checks only the 'l' and 'r' operands of the current insn.

Parameters
[out]otherpointer to the other operand (&r if we return &l and vice versa)
Returns
&l or &r or nullptr

◆ find_num_op() [2/2]

mop_t * minsn_t::find_num_op ( mop_t ** other)
inline

◆ is_mov()

bool minsn_t::is_mov ( ) const
inline

◆ is_like_move()

bool minsn_t::is_like_move ( ) const
inline

◆ modifies_d()

bool minsn_t::modifies_d ( ) const
inline

Does the instruction modify its 'd' operand?

Some instructions (e.g. m_stx) do not modify the 'd' operand.

◆ modifies_pair_mop()

bool minsn_t::modifies_pair_mop ( ) const
inline

◆ is_between()

bool minsn_t::is_between ( const minsn_t * m1,
const minsn_t * m2 ) const
inline

Is the instruction in the specified range of instructions?

Parameters
m1beginning of the range in the doubly linked list
m2end 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.

◆ is_after()

bool minsn_t::is_after ( const minsn_t * m) const
inline

Is the instruction after the specified one?

Parameters
mthe instruction to compare against in the list

◆ may_use_aliased_memory()

bool minsn_t::may_use_aliased_memory ( ) const
inline

Is it possible for the instruction to use aliased memory?

◆ serialize()

int minsn_t::serialize ( bytevec_t * b) const
inline

Serialize an instruction.

Parameters
bthe output buffer
Returns
the serialization format that was used to store info

◆ deserialize()

bool minsn_t::deserialize ( const uchar * bytes,
size_t nbytes,
int format_version )
inline

Deserialize an instruction.

Parameters
bytespointer to serialized data
nbytesnumber of bytes to deserialize
format_versionserialization format version. this value is returned by minsn_t::serialize()
Returns
success

Member Data Documentation

◆ opcode

mcode_t minsn_t::opcode

instruction opcode

◆ iprops

int minsn_t::iprops

combination of instruction property bits bits

◆ next

minsn_t* minsn_t::next

next insn in doubly linked list. check also nexti()

◆ prev

minsn_t* minsn_t::prev

prev insn in doubly linked list. check also previ()

◆ ea

ea_t minsn_t::ea

instruction address

◆ l

mop_t minsn_t::l

left operand

◆ r

mop_t minsn_t::r

right operand

◆ d

mop_t minsn_t::d

destination operand


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