Latest available version: IDA and decompilers v8.4.240527sp2 see all releases
Hex-Rays logo State-of-the-art binary code analysis tools
email icon
optinsn_t Struct Referenceabstract

User defined callback to optimize individual microcode instructions. More...

#include <hexrays.hpp>

Public Member Functions

virtual int func (mblock_t *blk, minsn_t *ins, int optflags)=0
 Optimize an instruction. More...

Detailed Description

User defined callback to optimize individual microcode instructions.

hexrays_sample10.cpp, and hexrays_sample16.cpp.

Definition at line 2108 of file hexrays.hpp.

Member Function Documentation

◆ func()

virtual int optinsn_t::func ( mblock_t blk,
minsn_t ins,
int  optflags 
pure virtual

Optimize an instruction.

blkcurrent basic block. maybe nullptr, which means that the instruction must be optimized without context
insinstruction to optimize; it is always a top-level instruction. the callback may not delete the instruction but may convert it into nop (see mblock_t::make_nop). to optimize sub-instructions, visit them using minsn_visitor_t. sub-instructions may not be converted into nop but can be converted to "mov x,x". for example: add x,0,x => mov x,x this callback may change other instructions in the block, but should do this with care, e.g. to no break the propagation algorithm if called with OPTI_NO_LDXOPT.
optflagscombination of optimization flags bits
number of changes made to the instruction. if after this call the instruction's use/def lists have changed, you must mark the block level lists as dirty (see mark_lists_dirty)
hexrays_sample10.cpp, and hexrays_sample16.cpp.