A microinstruction operand. More...
#include <hexrays.hpp>
Public Member Functions | |
void | set_impptr_done () |
void | set_udt () |
void | set_undef_val () |
void | set_lowaddr () |
bool | is_impptr_done () const |
bool | is_udt () const |
bool | probably_floating () const |
bool | is_undef_val () const |
bool | is_lowaddr () const |
bool | is_ccflags () const |
bool | is_pcval () const |
bool | is_glbaddr_from_fixup () const |
mop_t (const mop_t &rop) | |
mop_t (mreg_t _r, int _s) | |
mop_t & | operator= (const mop_t &rop) |
mop_t & | assign (const mop_t &rop) |
void | zero () |
void | swap (mop_t &rop) |
void | erase () |
void | erase_but_keep_size () |
void | print (qstring *vout, int shins_flags=SHINS_SHORT|SHINS_VALNUM) const |
const char * | dstr () const |
bool | create_from_mlist (mba_t *mba, const mlist_t &lst, sval_t fullsize) |
Create operand from mlist_t. More... | |
bool | create_from_ivlset (mba_t *mba, const ivlset_t &ivs, sval_t fullsize) |
Create operand from ivlset_t. More... | |
void | create_from_vdloc (mba_t *mba, const vdloc_t &loc, int _size) |
Create operand from vdloc_t. More... | |
void | create_from_scattered_vdloc (mba_t *mba, const char *name, tinfo_t type, const vdloc_t &loc) |
Create operand from scattered vdloc_t. More... | |
void | create_from_insn (const minsn_t *m) |
Create operand from an instruction. More... | |
void | make_number (uint64 _value, int _size, ea_t _ea=BADADDR, int opnum=0) |
Create an integer constant operand. More... | |
bool | make_fpnum (const void *bytes, size_t _size) |
Create a floating point constant operand. More... | |
void | _make_reg (mreg_t reg) |
Create a register operand without erasing previous data. More... | |
void | _make_reg (mreg_t reg, int _size) |
void | make_reg (mreg_t reg) |
Create a register operand. More... | |
void | make_reg (mreg_t reg, int _size) |
void | _make_lvar (mba_t *mba, int idx, sval_t off=0) |
Create a local variable operand. More... | |
void | _make_gvar (ea_t ea) |
Create a global variable operand without erasing previous data. More... | |
void | make_gvar (ea_t ea) |
Create a global variable operand. More... | |
void | _make_stkvar (mba_t *mba, sval_t off) |
Create a stack variable operand. More... | |
void | make_stkvar (mba_t *mba, sval_t off) |
void | make_reg_pair (int loreg, int hireg, int halfsize) |
Create pair of registers. More... | |
void | _make_insn (minsn_t *ins) |
Create a nested instruction without erasing previous data. More... | |
void | make_insn (minsn_t *ins) |
Create a nested instruction. More... | |
void | _make_blkref (int blknum) |
Create a block reference operand without erasing previous data. More... | |
void | make_blkref (int blknum) |
Create a global variable operand. More... | |
void | make_helper (const char *name) |
Create a helper operand. More... | |
void | _make_strlit (const char *str) |
Create a constant string operand. More... | |
void | _make_strlit (qstring *str) |
void | _make_callinfo (mcallinfo_t *fi) |
Create a call info operand without erasing previous data. More... | |
void | _make_cases (mcases_t *_cases) |
Create a 'switch cases' operand without erasing previous data. More... | |
void | _make_pair (mop_pair_t *_pair) |
Create a pair operand without erasing previous data. More... | |
bool | empty () const |
bool | is_reg () const |
Is a register operand? See also get_mreg_name() More... | |
bool | is_reg (mreg_t _r) const |
Is the specified register? More... | |
bool | is_reg (mreg_t _r, int _size) const |
Is the specified register of the specified size? More... | |
bool | is_arglist () const |
Is a list of arguments? More... | |
bool | is_cc () const |
Is a condition code? More... | |
bool | is_bit_reg () const |
bool | is_kreg () const |
Is a kernel register? More... | |
bool | is_mob (int serial) const |
Is a block reference to the specified block? More... | |
bool | is_scattered () const |
Is a scattered operand? More... | |
bool | is_glbaddr () const |
Is address of a global memory cell? More... | |
bool | is_glbaddr (ea_t ea) const |
Is address of the specified global memory cell? More... | |
bool | is_stkaddr () const |
Is address of a stack variable? More... | |
bool | is_insn () const |
Is a sub-instruction? More... | |
bool | is_insn (mcode_t code) const |
Is a sub-instruction with the specified opcode? More... | |
bool | has_side_effects (bool include_ldx_and_divs=false) const |
Has any side effects? More... | |
bool | may_use_aliased_memory () const |
Is it possible for the operand to use aliased memory? More... | |
bool | is01 () const |
Are the possible values of the operand only 0 and 1? This function returns true for 0/1 constants, bit registers, the result of 'set' insns, etc. More... | |
bool | is_sign_extended_from (int nbytes) const |
Does the high part of the operand consist of the sign bytes? More... | |
bool | is_zero_extended_from (int nbytes) const |
Does the high part of the operand consist of zero bytes? More... | |
bool | is_extended_from (int nbytes, bool is_signed) const |
Does the high part of the operand consist of zero or sign bytes? More... | |
bool | equal_mops (const mop_t &rop, int eqflags) const |
Compare operands. More... | |
bool | operator== (const mop_t &rop) const |
bool | operator!= (const mop_t &rop) const |
bool | operator< (const mop_t &rop) const |
Lexographical operand comparison. More... | |
int | lexcompare (const mop_t &rop) const |
int | for_all_ops (mop_visitor_t &mv, const tinfo_t *type=nullptr, bool is_target=false) |
Visit the operand and all its sub-operands. More... | |
int | for_all_scattered_submops (scif_visitor_t &sv) const |
Visit all sub-operands of a scattered operand. More... | |
uint64 | value (bool is_signed) const |
Retrieve value of a constant integer operand. More... | |
int64 | signed_value () const |
uint64 | unsigned_value () const |
void | update_numop_value (uint64 val) |
bool | is_constant (uint64 *out=nullptr, bool is_signed=true) const |
Retrieve value of a constant integer operand. More... | |
bool | is_equal_to (uint64 n, bool is_signed=true) const |
bool | is_zero () const |
bool | is_one () const |
bool | is_positive_constant () const |
bool | is_negative_constant () const |
member_t * | get_stkvar (uval_t *p_off) const |
Retrieve the referenced stack variable. More... | |
bool | get_stkoff (sval_t *p_off) const |
Get the referenced stack offset. More... | |
const minsn_t * | get_insn (mcode_t code) const |
Get subinstruction of the operand. More... | |
minsn_t * | get_insn (mcode_t code) |
bool | make_low_half (int width) |
Make the low part of the operand. More... | |
bool | make_high_half (int width) |
Make the high part of the operand. More... | |
bool | make_first_half (int width) |
Make the first part of the operand. More... | |
bool | make_second_half (int width) |
Make the second part of the operand. More... | |
bool | shift_mop (int offset) |
Shift the operand. More... | |
bool | change_size (int nsize, side_effect_t sideff=WITH_SIDEFF) |
Change the operand size. More... | |
bool | double_size (side_effect_t sideff=WITH_SIDEFF) |
bool | preserve_side_effects (mblock_t *blk, minsn_t *top, bool *moved_calls=nullptr) |
Move subinstructions with side effects out of the operand. More... | |
void | apply_ld_mcode (mcode_t mcode, ea_t ea, int newsize) |
Apply a unary opcode to the operand. More... | |
void | apply_xdu (ea_t ea, int newsize) |
void | apply_xds (ea_t ea, int newsize) |
Static Public Member Functions | |
static bool | is_bit_reg (mreg_t reg) |
Is a bit register? This includes condition codes and eventually other bit registers. More... | |
Public Attributes | |
mopt_t | t |
Operand type. More... | |
uint8 | oprops |
Operand properties. More... | |
uint16 | valnum |
Value number. More... | |
int | size |
Operand size. More... | |
union { | |
mreg_t r | |
mnumber_t * nnn | |
minsn_t * d | |
stkvar_ref_t * s | |
ea_t g | |
int b | |
mcallinfo_t * f | |
lvar_ref_t * l | |
mop_addr_t * a | |
char * helper | |
char * cstr | |
mcases_t * c | |
fnumber_t * fpc | |
mop_pair_t * pair | |
scif_t * scif | |
}; | |
The following union holds additional details about the operand. More... | |
Friends | |
int | lexcompare (const mop_t &a, const mop_t &b) |
Detailed Description
A microinstruction operand.
This is the smallest building block of our microcode. Operands will be part of instructions, which are then grouped into basic blocks. The microcode consists of an array of such basic blocks + some additional info.
- Examples
- hexrays_sample12.cpp, hexrays_sample16.cpp, and hexrays_sample18.cpp.
Definition at line 2440 of file hexrays.hpp.
Constructor & Destructor Documentation
◆ mop_t() [1/3]
mop_t::mop_t | ( | ) |
Definition at line 2514 of file hexrays.hpp.
◆ mop_t() [2/3]
mop_t::mop_t | ( | const mop_t & | rop | ) |
Definition at line 2515 of file hexrays.hpp.
◆ mop_t() [3/3]
mop_t::mop_t | ( | mreg_t | _r, |
int | _s | ||
) |
Definition at line 2516 of file hexrays.hpp.
◆ ~mop_t()
mop_t::~mop_t | ( | ) |
Definition at line 2519 of file hexrays.hpp.
Member Function Documentation
◆ _make_blkref()
void mop_t::_make_blkref | ( | int | blknum | ) |
Create a block reference operand without erasing previous data.
- Parameters
-
blknum block number Note: this function does not erase the previous contents of the operand; call erase() if necessary
Definition at line 2669 of file hexrays.hpp.
References mop_b.
◆ _make_callinfo()
void mop_t::_make_callinfo | ( | mcallinfo_t * | fi | ) |
Create a call info operand without erasing previous data.
- Parameters
-
fi callinfo Note: this function does not erase the previous contents of the operand; call erase() if necessary
Definition at line 2698 of file hexrays.hpp.
References mop_f.
◆ _make_cases()
void mop_t::_make_cases | ( | mcases_t * | _cases | ) |
Create a 'switch cases' operand without erasing previous data.
Note: this function does not erase the previous contents of the operand; call erase() if necessary
Definition at line 2707 of file hexrays.hpp.
References mop_c.
◆ _make_gvar()
void mop_t::_make_gvar | ( | ea_t | ea | ) |
Create a global variable operand without erasing previous data.
- Parameters
-
ea address of the variable Note: this function does not erase the previous contents of the operand; call erase() if necessary
Definition at line 10617 of file hexrays.hpp.
◆ _make_insn()
void mop_t::_make_insn | ( | minsn_t * | ins | ) |
Create a nested instruction without erasing previous data.
- Parameters
-
ins pointer to the instruction to encapsulate into the operand Note: this function does not erase the previous contents of the operand; call erase() if necessary See also create_from_insn, which is higher level
Definition at line 5274 of file hexrays.hpp.
References mop_d.
◆ _make_lvar()
void mop_t::_make_lvar | ( | mba_t * | mba, |
int | idx, | ||
sval_t | off = 0 |
||
) |
Create a local variable operand.
- Parameters
-
mba pointer to microcode idx index into mba->vars off offset from the beginning of the variable Note: this function does not erase the previous contents of the operand; call erase() if necessary
Definition at line 2624 of file hexrays.hpp.
References mop_l.
◆ _make_pair()
void mop_t::_make_pair | ( | mop_pair_t * | _pair | ) |
Create a pair operand without erasing previous data.
Note: this function does not erase the previous contents of the operand; call erase() if necessary
Definition at line 2716 of file hexrays.hpp.
References mop_p.
◆ _make_reg() [1/2]
void mop_t::_make_reg | ( | mreg_t | reg | ) |
Create a register operand without erasing previous data.
- Parameters
-
reg micro register number Note: this function does not erase the previous contents of the operand; call erase() if necessary
Definition at line 2603 of file hexrays.hpp.
References mop_r.
◆ _make_reg() [2/2]
void mop_t::_make_reg | ( | mreg_t | reg, |
int | _size | ||
) |
Definition at line 2608 of file hexrays.hpp.
◆ _make_stkvar()
void mop_t::_make_stkvar | ( | mba_t * | mba, |
sval_t | off | ||
) |
Create a stack variable operand.
- Parameters
-
mba pointer to microcode off decompiler stkoff Note: this function does not erase the previous contents of the operand; call erase() if necessary
Definition at line 2643 of file hexrays.hpp.
References mop_S.
◆ _make_strlit() [1/2]
void mop_t::_make_strlit | ( | const char * | str | ) |
◆ _make_strlit() [2/2]
void mop_t::_make_strlit | ( | qstring * | str | ) |
Definition at line 2688 of file hexrays.hpp.
◆ apply_ld_mcode()
void mop_t::apply_ld_mcode | ( | mcode_t | mcode, |
ea_t | ea, | ||
int | newsize | ||
) |
Apply a unary opcode to the operand.
- Parameters
-
mcode opcode to apply. it must accept 'l' and 'd' operands but not 'r'. examples: m_low/m_high/m_xds/m_xdu ea value of minsn_t::ea for the newly created insruction newsize new operand size Example: apply_ld_mcode(m_low) will convert op => low(op)
Definition at line 10749 of file hexrays.hpp.
◆ apply_xds()
void mop_t::apply_xds | ( | ea_t | ea, |
int | newsize | ||
) |
Definition at line 2966 of file hexrays.hpp.
◆ apply_xdu()
void mop_t::apply_xdu | ( | ea_t | ea, |
int | newsize | ||
) |
Definition at line 2965 of file hexrays.hpp.
◆ assign()
Definition at line 10545 of file hexrays.hpp.
◆ change_size()
bool mop_t::change_size | ( | int | nsize, |
side_effect_t | sideff = WITH_SIDEFF |
||
) |
Change the operand size.
Examples: change_size(AL.1, 2) -> AX.2 change_size(qword_00000008.8, 4) -> dword_00000008.4 change_size(xdu.8(op.4), 4) -> op.4 change_size(#0x12345678.4, 1) -> #0x78.1
- Parameters
-
nsize new operand size sideff may modify the database because of the size change?
- Returns
- success
Definition at line 10737 of file hexrays.hpp.
◆ create_from_insn()
void mop_t::create_from_insn | ( | const minsn_t * | m | ) |
Create operand from an instruction.
This function creates a nested instruction that can be used as an operand. Example: if m="add x,y,z", our operand will be (t=mop_d,d=m). The destination operand of 'add' (z) is lost.
- Parameters
-
m instruction to embed into operand. may not be nullptr.
Definition at line 10599 of file hexrays.hpp.
◆ create_from_ivlset()
Create operand from ivlset_t.
Example: if IVS contains [glbvar..glbvar+4), our operand will be (t=mop_v, g=&glbvar, size=4)
- Parameters
-
mba pointer to microcode ivs set of memory intervals fullsize mba->fullsize
- Returns
- success
Definition at line 10581 of file hexrays.hpp.
◆ create_from_mlist()
Create operand from mlist_t.
Example: if LST contains 4 bits for R0.4, our operand will be (t=mop_r, r=R0, size=4)
- Parameters
-
mba pointer to microcode lst list of locations fullsize mba->fullsize
- Returns
- success
Definition at line 10575 of file hexrays.hpp.
◆ create_from_scattered_vdloc()
void mop_t::create_from_scattered_vdloc | ( | mba_t * | mba, |
const char * | name, | ||
tinfo_t | type, | ||
const vdloc_t & | loc | ||
) |
Create operand from scattered vdloc_t.
Example: if LOC is (ALOC_DIST, {EAX.4, EDX.4}) and TYPE is _LARGE_INTEGER, our operand will be (t=mop_sc, scif={EAX.4, EDX.4})
- Parameters
-
mba pointer to microcode name name of the operand, if available type type of the operand, must be present loc a scattered location
- Returns
- success
Definition at line 10593 of file hexrays.hpp.
◆ create_from_vdloc()
Create operand from vdloc_t.
Example: if LOC contains (type=ALOC_REG1, r=R0), our operand will be (t=mop_r, r=R0, size=_SIZE)
- Parameters
-
mba pointer to microcode loc location _size operand size Note: this function cannot handle scattered locations.
- Returns
- success
Definition at line 10587 of file hexrays.hpp.
◆ double_size()
bool mop_t::double_size | ( | side_effect_t | sideff = WITH_SIDEFF | ) |
Definition at line 2938 of file hexrays.hpp.
◆ dstr()
const char * mop_t::dstr | ( | ) | const |
Definition at line 10569 of file hexrays.hpp.
◆ empty()
bool mop_t::empty | ( | ) | const |
Definition at line 2725 of file hexrays.hpp.
◆ equal_mops()
bool mop_t::equal_mops | ( | const mop_t & | rop, |
int | eqflags | ||
) | const |
Compare operands.
This is the main comparison function for operands.
- Parameters
-
rop operand to compare with eqflags combination of comparison bits bits
- Examples
- hexrays_sample16.cpp.
Definition at line 10671 of file hexrays.hpp.
◆ erase()
void mop_t::erase | ( | ) |
Definition at line 10557 of file hexrays.hpp.
◆ erase_but_keep_size()
void mop_t::erase_but_keep_size | ( | ) |
Definition at line 2527 of file hexrays.hpp.
◆ for_all_ops()
int mop_t::for_all_ops | ( | mop_visitor_t & | mv, |
const tinfo_t * | type = nullptr , |
||
bool | is_target = false |
||
) |
Visit the operand and all its sub-operands.
This function visits the current operand as well.
- Parameters
-
mv visitor object type operand type is_target is a destination operand?
Definition at line 10683 of file hexrays.hpp.
◆ for_all_scattered_submops()
int mop_t::for_all_scattered_submops | ( | scif_visitor_t & | sv | ) | const |
Visit all sub-operands of a scattered operand.
This function does not visit the current operand, only its sub-operands. All sub-operands are synthetic and are destroyed after the visitor. This function works only with scattered operands.
- Parameters
-
sv visitor object
Definition at line 10689 of file hexrays.hpp.
◆ get_insn() [1/2]
minsn_t * mop_t::get_insn | ( | mcode_t | code | ) |
Definition at line 5290 of file hexrays.hpp.
◆ get_insn() [2/2]
const minsn_t * mop_t::get_insn | ( | mcode_t | code | ) | const |
Get subinstruction of the operand.
If the operand has a subinstruction with the specified opcode, return it.
- Parameters
-
code desired opcode
- Returns
- pointer to the instruction or nullptr
Definition at line 5294 of file hexrays.hpp.
◆ get_stkoff()
bool mop_t::get_stkoff | ( | sval_t * | p_off | ) | const |
Get the referenced stack offset.
This function can also handle mop_sc if it is entirely mapped into a continuous stack region.
- Parameters
-
p_off the output buffer
- Returns
- success
Definition at line 10701 of file hexrays.hpp.
◆ get_stkvar()
member_t * mop_t::get_stkvar | ( | uval_t * | p_off | ) | const |
Retrieve the referenced stack variable.
- Parameters
-
p_off if specified, will hold IDA stkoff after the call.
- Returns
- pointer to the stack variable
Definition at line 2872 of file hexrays.hpp.
◆ has_side_effects()
bool mop_t::has_side_effects | ( | bool | include_ldx_and_divs = false | ) | const |
Has any side effects?
- Parameters
-
include_ldx_and_divs consider ldx/div/mod as having side effects?
Definition at line 5280 of file hexrays.hpp.
References has_side_effects().
Referenced by has_side_effects().
◆ is01()
bool mop_t::is01 | ( | ) | const |
Are the possible values of the operand only 0 and 1? This function returns true for 0/1 constants, bit registers, the result of 'set' insns, etc.
Definition at line 10653 of file hexrays.hpp.
◆ is_arglist()
bool mop_t::is_arglist | ( | ) | const |
Is a list of arguments?
Definition at line 2734 of file hexrays.hpp.
References mop_f.
Referenced by minsn_t::get_role().
◆ is_bit_reg() [1/2]
bool mop_t::is_bit_reg | ( | ) | const |
Definition at line 2740 of file hexrays.hpp.
◆ is_bit_reg() [2/2]
|
static |
Is a bit register? This includes condition codes and eventually other bit registers.
Definition at line 10641 of file hexrays.hpp.
References is_bit_reg().
Referenced by is_bit_reg().
◆ is_cc()
bool mop_t::is_cc | ( | ) | const |
Is a condition code?
Definition at line 2736 of file hexrays.hpp.
◆ is_ccflags()
bool mop_t::is_ccflags | ( | ) | const |
Definition at line 2500 of file hexrays.hpp.
◆ is_constant()
bool mop_t::is_constant | ( | uint64 * | out = nullptr , |
bool | is_signed = true |
||
) | const |
Retrieve value of a constant integer operand.
- Parameters
-
out pointer to the output buffer is_signed should treat the value as signed
- Returns
- true if the operand is mop_n
Definition at line 10695 of file hexrays.hpp.
◆ is_equal_to()
bool mop_t::is_equal_to | ( | uint64 | n, |
bool | is_signed = true |
||
) | const |
Definition at line 2848 of file hexrays.hpp.
◆ is_extended_from()
bool mop_t::is_extended_from | ( | int | nbytes, |
bool | is_signed | ||
) | const |
Does the high part of the operand consist of zero or sign bytes?
Definition at line 2783 of file hexrays.hpp.
◆ is_glbaddr() [1/2]
bool mop_t::is_glbaddr | ( | ) | const |
Is address of a global memory cell?
Definition at line 5304 of file hexrays.hpp.
◆ is_glbaddr() [2/2]
bool mop_t::is_glbaddr | ( | ea_t | ea | ) | const |
Is address of the specified global memory cell?
Definition at line 5309 of file hexrays.hpp.
◆ is_glbaddr_from_fixup()
bool mop_t::is_glbaddr_from_fixup | ( | ) | const |
Definition at line 2509 of file hexrays.hpp.
◆ is_impptr_done()
bool mop_t::is_impptr_done | ( | ) | const |
Definition at line 2495 of file hexrays.hpp.
◆ is_insn() [1/2]
bool mop_t::is_insn | ( | ) | const |
◆ is_insn() [2/2]
bool mop_t::is_insn | ( | mcode_t | code | ) | const |
Is a sub-instruction with the specified opcode?
Definition at line 5299 of file hexrays.hpp.
◆ is_kreg()
bool mop_t::is_kreg | ( | ) | const |
◆ is_lowaddr()
bool mop_t::is_lowaddr | ( | ) | const |
Definition at line 2499 of file hexrays.hpp.
◆ is_mob()
bool mop_t::is_mob | ( | int | serial | ) | const |
Is a block reference to the specified block?
Definition at line 2744 of file hexrays.hpp.
References mop_b.
◆ is_negative_constant()
bool mop_t::is_negative_constant | ( | ) | const |
Definition at line 2860 of file hexrays.hpp.
◆ is_one()
bool mop_t::is_one | ( | ) | const |
Definition at line 2854 of file hexrays.hpp.
◆ is_pcval()
bool mop_t::is_pcval | ( | ) | const |
Definition at line 2505 of file hexrays.hpp.
◆ is_positive_constant()
bool mop_t::is_positive_constant | ( | ) | const |
Definition at line 2855 of file hexrays.hpp.
◆ is_reg() [1/3]
bool mop_t::is_reg | ( | ) | const |
Is a register operand? See also get_mreg_name()
Definition at line 2728 of file hexrays.hpp.
References mop_r.
◆ is_reg() [2/3]
bool mop_t::is_reg | ( | mreg_t | _r | ) | const |
◆ is_reg() [3/3]
bool mop_t::is_reg | ( | mreg_t | _r, |
int | _size | ||
) | const |
Is the specified register of the specified size?
Definition at line 2732 of file hexrays.hpp.
References mop_r.
◆ is_scattered()
bool mop_t::is_scattered | ( | ) | const |
◆ is_sign_extended_from()
bool mop_t::is_sign_extended_from | ( | int | nbytes | ) | const |
Does the high part of the operand consist of the sign bytes?
- Parameters
-
nbytes number of bytes that were sign extended. the remaining size-nbytes high bytes must be sign bytes Example: is_sign_extended_from(xds.4(op.1), 1) -> true because the high 3 bytes are certainly sign bits
Definition at line 10659 of file hexrays.hpp.
◆ is_stkaddr()
bool mop_t::is_stkaddr | ( | ) | const |
Is address of a stack variable?
Definition at line 5314 of file hexrays.hpp.
◆ is_udt()
bool mop_t::is_udt | ( | ) | const |
Definition at line 2496 of file hexrays.hpp.
◆ is_undef_val()
bool mop_t::is_undef_val | ( | ) | const |
Definition at line 2498 of file hexrays.hpp.
◆ is_zero()
bool mop_t::is_zero | ( | ) | const |
Definition at line 2853 of file hexrays.hpp.
◆ is_zero_extended_from()
bool mop_t::is_zero_extended_from | ( | int | nbytes | ) | const |
Does the high part of the operand consist of zero bytes?
- Parameters
-
nbytes number of bytes that were zero extended. the remaining size-nbytes high bytes must be zero Example: is_zero_extended_from(xdu.8(op.1), 2) -> true because the high 6 bytes are certainly zero
Definition at line 10665 of file hexrays.hpp.
◆ lexcompare()
int mop_t::lexcompare | ( | const mop_t & | rop | ) | const |
Definition at line 10677 of file hexrays.hpp.
◆ make_blkref()
void mop_t::make_blkref | ( | int | blknum | ) |
Create a global variable operand.
Definition at line 2675 of file hexrays.hpp.
◆ make_first_half()
bool mop_t::make_first_half | ( | int | width | ) |
Make the first part of the operand.
This function does not care about the memory endianness
- Parameters
-
width the desired size of the operand part in bytes
- Returns
- success
Definition at line 10719 of file hexrays.hpp.
◆ make_fpnum()
bool mop_t::make_fpnum | ( | const void * | bytes, |
size_t | _size | ||
) |
Create a floating point constant operand.
- Parameters
-
bytes pointer to the floating point value as used by the current processor (e.g. for x86 it must be in IEEE 754) _size number of bytes occupied by the constant.
- Returns
- success
Definition at line 10611 of file hexrays.hpp.
◆ make_gvar()
void mop_t::make_gvar | ( | ea_t | ea | ) |
Create a global variable operand.
Definition at line 10623 of file hexrays.hpp.
◆ make_helper()
void mop_t::make_helper | ( | const char * | name | ) |
Create a helper operand.
A helper operand usually keeps a built-in function name like "va_start" It is essentially just an arbitrary identifier without any additional info.
Definition at line 10635 of file hexrays.hpp.
◆ make_high_half()
bool mop_t::make_high_half | ( | int | width | ) |
Make the high part of the operand.
This function takes into account the memory endianness (byte sex)
- Parameters
-
width the desired size of the operand part in bytes
- Returns
- success
Definition at line 10713 of file hexrays.hpp.
◆ make_insn()
void mop_t::make_insn | ( | minsn_t * | ins | ) |
Create a nested instruction.
Definition at line 2663 of file hexrays.hpp.
◆ make_low_half()
bool mop_t::make_low_half | ( | int | width | ) |
Make the low part of the operand.
This function takes into account the memory endianness (byte sex)
- Parameters
-
width the desired size of the operand part in bytes
- Returns
- success
Definition at line 10707 of file hexrays.hpp.
◆ make_number()
void mop_t::make_number | ( | uint64 | _value, |
int | _size, | ||
ea_t | _ea = BADADDR , |
||
int | opnum = 0 |
||
) |
Create an integer constant operand.
- Parameters
-
_value value to store in the operand _size size of the value in bytes (1,2,4,8) _ea address of the processor instruction that made the value opnum operand number of the processor instruction
- Examples
- hexrays_sample16.cpp, and hexrays_sample18.cpp.
Definition at line 10605 of file hexrays.hpp.
◆ make_reg() [1/2]
void mop_t::make_reg | ( | mreg_t | reg | ) |
Create a register operand.
- Examples
- hexrays_sample18.cpp.
Definition at line 2615 of file hexrays.hpp.
◆ make_reg() [2/2]
void mop_t::make_reg | ( | mreg_t | reg, |
int | _size | ||
) |
Definition at line 2616 of file hexrays.hpp.
◆ make_reg_pair()
void mop_t::make_reg_pair | ( | int | loreg, |
int | hireg, | ||
int | halfsize | ||
) |
Create pair of registers.
- Parameters
-
loreg register holding the low part of the value hireg register holding the high part of the value halfsize the size of each of loreg/hireg
Definition at line 10629 of file hexrays.hpp.
◆ make_second_half()
bool mop_t::make_second_half | ( | int | width | ) |
Make the second part of the operand.
This function does not care about the memory endianness
- Parameters
-
width the desired size of the operand part in bytes
- Returns
- success
Definition at line 10725 of file hexrays.hpp.
◆ make_stkvar()
void mop_t::make_stkvar | ( | mba_t * | mba, |
sval_t | off | ||
) |
Definition at line 2648 of file hexrays.hpp.
◆ may_use_aliased_memory()
bool mop_t::may_use_aliased_memory | ( | ) | const |
Is it possible for the operand to use aliased memory?
Definition at line 10647 of file hexrays.hpp.
◆ operator!=()
bool mop_t::operator!= | ( | const mop_t & | rop | ) | const |
Definition at line 2800 of file hexrays.hpp.
◆ operator<()
bool mop_t::operator< | ( | const mop_t & | rop | ) | const |
Lexographical operand comparison.
It can be used to store mop_t in various containers, like std::set
Definition at line 2804 of file hexrays.hpp.
◆ operator=()
Definition at line 2517 of file hexrays.hpp.
◆ operator==()
bool mop_t::operator== | ( | const mop_t & | rop | ) | const |
Definition at line 2799 of file hexrays.hpp.
◆ preserve_side_effects()
Move subinstructions with side effects out of the operand.
If we decide to delete an instruction operand, it is a good idea to call this function. Alternatively we should skip such operands by calling mop_t::has_side_effects() For example, if we transform: jnz x, x, @blk => goto @blk then we must call this function before deleting the X operands.
- Parameters
-
blk current block top top level instruction that contains our operand moved_calls pointer to the boolean that will track if all side effects get handled correctly. must be false initially.
- Returns
- false failed to preserve a side effect, it is not safe to delete the operand true no side effects or successfully preserved them
Definition at line 10743 of file hexrays.hpp.
◆ print()
void mop_t::print | ( | qstring * | vout, |
int | shins_flags = SHINS_SHORT|SHINS_VALNUM |
||
) | const |
Definition at line 10563 of file hexrays.hpp.
◆ probably_floating()
bool mop_t::probably_floating | ( | ) | const |
Definition at line 2497 of file hexrays.hpp.
◆ set_impptr_done()
void mop_t::set_impptr_done | ( | ) |
Definition at line 2491 of file hexrays.hpp.
◆ set_lowaddr()
void mop_t::set_lowaddr | ( | ) |
Definition at line 2494 of file hexrays.hpp.
◆ set_udt()
void mop_t::set_udt | ( | ) |
Definition at line 2492 of file hexrays.hpp.
◆ set_undef_val()
void mop_t::set_undef_val | ( | ) |
Definition at line 2493 of file hexrays.hpp.
◆ shift_mop()
bool mop_t::shift_mop | ( | int | offset | ) |
Shift the operand.
This function shifts only the beginning of the operand. The operand size will be changed. Examples: shift_mop(AH.1, -1) -> AX.2 shift_mop(qword_00000008.8, 4) -> dword_0000000C.4 shift_mop(xdu.8(op.4), 4) -> #0.4 shift_mop(#0x12345678.4, 3) -> #12.1
- Parameters
-
offset shift count (the number of bytes to shift)
- Returns
- success
- Examples
- hexrays_sample16.cpp.
Definition at line 10731 of file hexrays.hpp.
◆ signed_value()
int64 mop_t::signed_value | ( | ) | const |
Definition at line 2835 of file hexrays.hpp.
◆ swap()
void mop_t::swap | ( | mop_t & | rop | ) |
Definition at line 10551 of file hexrays.hpp.
◆ unsigned_value()
uint64 mop_t::unsigned_value | ( | ) | const |
Definition at line 2836 of file hexrays.hpp.
◆ update_numop_value()
void mop_t::update_numop_value | ( | uint64 | val | ) |
Definition at line 2837 of file hexrays.hpp.
◆ value()
uint64 mop_t::value | ( | bool | is_signed | ) | const |
Retrieve value of a constant integer operand.
These functions can be called only for mop_n operands. See is_constant() that can be called on any operand.
- Examples
- hexrays_sample16.cpp.
Definition at line 2834 of file hexrays.hpp.
◆ zero()
void mop_t::zero | ( | ) |
Definition at line 2524 of file hexrays.hpp.
Friends And Related Function Documentation
◆ lexcompare
Definition at line 2805 of file hexrays.hpp.
Member Data Documentation
◆
union { ... } mop_t::@8 |
The following union holds additional details about the operand.
Depending on the operand type different kinds of info are stored. You should access these fields only after verifying the operand type. All pointers are owned by the operand and are freed by its destructor.
◆ a
mop_addr_t* mop_t::a |
Definition at line 2481 of file hexrays.hpp.
◆ b
int mop_t::b |
- Examples
- hexrays_sample11.cpp.
Definition at line 2478 of file hexrays.hpp.
◆ c
mcases_t* mop_t::c |
Definition at line 2484 of file hexrays.hpp.
◆ cstr
char* mop_t::cstr |
- Examples
- hexrays_sample10.cpp.
Definition at line 2483 of file hexrays.hpp.
◆ d
minsn_t* mop_t::d |
Definition at line 2475 of file hexrays.hpp.
◆ f
mcallinfo_t* mop_t::f |
- Examples
- hexrays_sample10.cpp.
Definition at line 2479 of file hexrays.hpp.
◆ fpc
fnumber_t* mop_t::fpc |
Definition at line 2485 of file hexrays.hpp.
◆ g
ea_t mop_t::g |
Definition at line 2477 of file hexrays.hpp.
◆ helper
char* mop_t::helper |
Definition at line 2482 of file hexrays.hpp.
◆ l
lvar_ref_t* mop_t::l |
Definition at line 2480 of file hexrays.hpp.
◆ nnn
mnumber_t* mop_t::nnn |
- Examples
- hexrays_sample16.cpp.
Definition at line 2474 of file hexrays.hpp.
◆ oprops
uint8 mop_t::oprops |
Operand properties.
Definition at line 2448 of file hexrays.hpp.
◆ pair
mop_pair_t* mop_t::pair |
Definition at line 2486 of file hexrays.hpp.
◆ r
mreg_t mop_t::r |
Definition at line 2473 of file hexrays.hpp.
◆ s
stkvar_ref_t* mop_t::s |
Definition at line 2476 of file hexrays.hpp.
◆ scif
scif_t* mop_t::scif |
Definition at line 2487 of file hexrays.hpp.
◆ size
int mop_t::size |
Operand size.
Usually it is 1,2,4,8 or NOSIZE but for UDTs other sizes are permitted
- Examples
- hexrays_sample10.cpp, and hexrays_sample16.cpp.
Definition at line 2465 of file hexrays.hpp.
◆ t
mopt_t mop_t::t |
Operand type.
- Examples
- hexrays_sample10.cpp, and hexrays_sample16.cpp.
Definition at line 2445 of file hexrays.hpp.
Referenced by is_glbaddr(), and is_stkaddr().
◆ valnum
uint16 mop_t::valnum |
Value number.
Zero means unknown. Operands with the same value number are equal.
Definition at line 2461 of file hexrays.hpp.