|
IDA C++ SDK 9.2
|
Helper class to generate the initial microcode. More...
#include <hexrays.hpp>
Public Member Functions | |
| codegen_t ()=delete | |
| virtual | ~codegen_t () |
| void hexapi | clear () |
| virtual merror_t idaapi | analyze_prolog (const class qflow_chart_t &fc, const class bitset_t &reachable)=0 |
| Analyze prolog/epilog of the function to decompile. | |
| virtual merror_t idaapi | gen_micro ()=0 |
| Generate microcode for one instruction. | |
| virtual mreg_t idaapi | load_operand (int opnum, int flags=0)=0 |
| Generate microcode to load one operand. | |
| virtual void idaapi | microgen_completed () |
| This method is called when the microcode generation is done. | |
| virtual merror_t idaapi | prepare_gen_micro () |
| Setup internal data to handle new instruction. | |
| virtual mreg_t idaapi | load_effective_address (int n, int flags=0)=0 |
| Generate microcode to calculate the address of a memory operand. | |
| virtual bool idaapi | store_operand (int n, const mop_t &mop, int flags=0, minsn_t **outins=nullptr) |
| Generate microcode to store an operand. | |
| minsn_t *hexapi | emit (mcode_t code, int width, uval_t l, uval_t r, uval_t d, int offsize) |
| Emit one microinstruction. | |
| minsn_t *idaapi | emit_micro_mvm (mcode_t code, op_dtype_t dtype, uval_t l, uval_t r, uval_t d, int offsize) |
| Emit one microinstruction. | |
| minsn_t *hexapi | emit (mcode_t code, const mop_t *l, const mop_t *r, const mop_t *d) |
| Emit one microinstruction. | |
Public Attributes | |
| mba_t * | mba |
| mblock_t * | mb = nullptr |
| insn_t | insn |
| char | ignore_micro = IM_NONE |
| cdg_insn_iterator_t | ii |
| size_t | reserved [4] |
Helper class to generate the initial microcode.
|
delete |
|
inlinevirtual |
|
inline |
|
pure virtual |
Analyze prolog/epilog of the function to decompile.
If prolog is found, allocate and fill 'mba->pi' structure.
| fc | flow chart |
| reachable | bitmap of reachable blocks |
|
pure virtual |
Generate microcode for one instruction.
The instruction is in INSN
|
pure virtual |
Generate microcode to load one operand.
| opnum | number of INSN operand |
| flags | reserved for future use |
|
inlinevirtual |
This method is called when the microcode generation is done.
|
inlinevirtual |
Setup internal data to handle new instruction.
This method should be called before calling gen_micro(). Usually gen_micro() is called by the decompiler. You have to call this function explicitly only if you yourself call gen_micro(). The instruction is in INSN
|
pure virtual |
Generate microcode to calculate the address of a memory operand.
| n | - number of INSN operand |
| flags | - reserved for future use |
|
virtual |
Generate microcode to store an operand.
In case of success an arbitrary number of instructions can be generated (and even no instruction if the source and target are the same)
| n | - number of target INSN operand |
| mop | - operand to be stored |
| flags | - reserved for future use |
| outins | - (OUT) the last generated instruction |
|
inline |
Emit one microinstruction.
The L, R, D arguments usually mean the register number. However, they depend on CODE. For example:
| code | instruction opcode |
| width | operand size in bytes |
| l | left operand |
| r | right operand |
| d | destination operand |
| offsize | for ldx/stx, the size of the offset operand for ldc, operand number of the constant value -1, set the FP instruction (e.g. for m_mov) |
|
inline |
Emit one microinstruction.
This variant takes a data type not a size.
|
inline |
Emit one microinstruction.
This variant accepts pointers to operands. It is more difficult to use but permits to create virtually any instruction. Operands may be nullptr when it makes sense.
| mba_t* codegen_t::mba |
| mblock_t* codegen_t::mb = nullptr |
| insn_t codegen_t::insn |
| char codegen_t::ignore_micro = IM_NONE |
| cdg_insn_iterator_t codegen_t::ii |
| size_t codegen_t::reserved[4] |