Class for caching a chunk of p-code, prior to emitting.
More...
#include <sleigh.hh>
Class for caching a chunk of p-code, prior to emitting.
The engine accumulates PcodeData and VarnodeData objects for a single instruction. Once the full instruction is constructed, the objects are passed to the emitter (PcodeEmit) via the emit() method. The class acts as a pool of memory for PcodeData and VarnodeData objects that can be reused repeatedly to emit multiple instructions.
◆ addLabel()
void PcodeCacher::addLabel |
( |
uint4 |
id | ) |
|
Attach a label to the next p-code instruction.
The label has an id that is referred to by Varnodes holding intra-instruction branch targets, prior to converting them to a relative branch offset. The label is associated with the absolute index of the next PcodeData object to be issued, facilitating this conversion.
- Parameters
-
id | is the given id of the label |
◆ addLabelRef()
Denote a Varnode holding a relative branch offset.
Store off a reference to the Varnode and the absolute index of the next instruction. The Varnode must be an operand of the current instruction.
- Parameters
-
◆ allocateInstruction()
PcodeData* PcodeCacher::allocateInstruction |
( |
void |
| ) |
|
|
inline |
Allocate a data object for a new p-code operation.
- Returns
- the new PcodeData object
◆ allocateVarnodes()
VarnodeData* PcodeCacher::allocateVarnodes |
( |
uint4 |
size | ) |
|
|
inline |
Allocate data objects for a new set of Varnodes.
- Parameters
-
size | is the number of objects to allocate |
- Returns
- a pointer to the array of available VarnodeData objects
◆ emit()
Pass the cached p-code data to the emitter.
Each p-code operation is presented to the emitter via its dump() method.
- Parameters
-
addr | is the Address associated with the p-code operation |
emt | is the emitter |
◆ resolveRelatives()
void PcodeCacher::resolveRelatives |
( |
void |
| ) |
|
Rewrite branch target Varnodes as relative offsets.
Assuming all the PcodeData has been generated for an instruction, go resolve any relative offsets and back patch their value(s) into the PcodeData
The documentation for this class was generated from the following files: