|
| LaneDivide (Funcdata *f, Varnode *root, const LaneDescription &desc, bool allowDowncast) |
| Constructor. More...
|
|
bool | doTrace (void) |
| Trace lanes as far as possible from the root Varnode. More...
|
|
| TransformManager (Funcdata *f) |
| Constructor.
|
|
virtual | ~TransformManager (void) |
| Destructor.
|
|
virtual bool | preserveAddress (Varnode *vn, int4 bitSize, int4 lsbOffset) const |
| Should the address of the given Varnode be preserved when constructing a piece. More...
|
|
Funcdata * | getFunction (void) const |
| Get function being transformed.
|
|
void | clearVarnodeMarks (void) |
| Clear mark for all Varnodes in the map.
|
|
TransformVar * | newPreexistingVarnode (Varnode *vn) |
| Make placeholder for preexisting Varnode. More...
|
|
TransformVar * | newUnique (int4 size) |
| Make placeholder for new unique space Varnode. More...
|
|
TransformVar * | newConstant (int4 size, int4 lsbOffset, uintb val) |
| Make placeholder for constant Varnode. More...
|
|
TransformVar * | newIop (Varnode *vn) |
| Make placeholder for special iop constant. More...
|
|
TransformVar * | newPiece (Varnode *vn, int4 bitSize, int4 lsbOffset) |
| Make placeholder for piece of a Varnode. More...
|
|
TransformVar * | newSplit (Varnode *vn, const LaneDescription &description) |
| Create placeholder nodes splitting a Varnode into its lanes. More...
|
|
TransformVar * | newSplit (Varnode *vn, const LaneDescription &description, int4 numLanes, int4 startLane) |
| Create placeholder nodes splitting a Varnode into a subset of lanes in the given description. More...
|
|
TransformOp * | newOpReplace (int4 numParams, OpCode opc, PcodeOp *replace) |
| Create a new placeholder op intended to replace an existing op. More...
|
|
TransformOp * | newOp (int4 numParams, OpCode opc, TransformOp *follow) |
| Create a new placeholder op that will not replace an existing op. More...
|
|
TransformOp * | newPreexistingOp (int4 numParams, OpCode opc, PcodeOp *originalOp) |
| Create a new placeholder op for an existing PcodeOp. More...
|
|
TransformVar * | getPreexistingVarnode (Varnode *vn) |
| Get (or create) placeholder for preexisting Varnode. More...
|
|
TransformVar * | getPiece (Varnode *vn, int4 bitSize, int4 lsbOffset) |
| Get (or create) placeholder piece. More...
|
|
TransformVar * | getSplit (Varnode *vn, const LaneDescription &description) |
| Find (or create) placeholder nodes splitting a Varnode into its lanes. More...
|
|
TransformVar * | getSplit (Varnode *vn, const LaneDescription &description, int4 numLanes, int4 startLane) |
| Find (or create) placeholder nodes splitting a Varnode into a subset of lanes from a description. More...
|
|
void | opSetInput (TransformOp *rop, TransformVar *rvn, int4 slot) |
| Mark given variable as input to given op. More...
|
|
void | opSetOutput (TransformOp *rop, TransformVar *rvn) |
| Mark given variable as output of given op. More...
|
|
void | apply (void) |
| Apply the full transform to the function.
|
|
|
TransformVar * | setReplacement (Varnode *vn, int4 numLanes, int4 skipLanes) |
| Find or build the placeholder objects for a Varnode that needs to be split into lanes. More...
|
|
void | buildUnaryOp (OpCode opc, PcodeOp *op, TransformVar *inVars, TransformVar *outVars, int4 numLanes) |
| Build unary op placeholders with the same opcode across a set of lanes. More...
|
|
void | buildBinaryOp (OpCode opc, PcodeOp *op, TransformVar *in0Vars, TransformVar *in1Vars, TransformVar *outVars, int4 numLanes) |
| Build binary op placeholders with the same opcode across a set of lanes. More...
|
|
bool | buildPiece (PcodeOp *op, TransformVar *outVars, int4 numLanes, int4 skipLanes) |
| Convert a CPUI_PIECE operation into copies between placeholders, given the output lanes. More...
|
|
bool | buildMultiequal (PcodeOp *op, TransformVar *outVars, int4 numLanes, int4 skipLanes) |
| Split a given CPUI_MULTIEQUAL operation into placeholders given the output lanes. More...
|
|
bool | buildStore (PcodeOp *op, int4 numLanes, int4 skipLanes) |
| Split a given CPUI_STORE operation into a sequence of STOREs of individual lanes. More...
|
|
bool | buildLoad (PcodeOp *op, TransformVar *outVars, int4 numLanes, int4 skipLanes) |
| Split a given CPUI_LOAD operation into a sequence of LOADs of individual lanes. More...
|
|
bool | buildRightShift (PcodeOp *op, TransformVar *outVars, int4 numLanes, int4 skipLanes) |
| Check that a CPUI_INT_RIGHT respects the lanes then generate lane placeholders. More...
|
|
bool | traceForward (TransformVar *rvn, int4 numLanes, int4 skipLanes) |
| Push the logical lanes forward through any PcodeOp reading the given variable. More...
|
|
bool | traceBackward (TransformVar *rvn, int4 numLanes, int4 skipLanes) |
| Pull the logical lanes back through the defining PcodeOp of the given variable. More...
|
|
bool | processNextWork (void) |
| Process the next Varnode on the work list. More...
|
|
bool LaneDivide::buildLoad |
( |
PcodeOp * |
op, |
|
|
TransformVar * |
outVars, |
|
|
int4 |
numLanes, |
|
|
int4 |
skipLanes |
|
) |
| |
|
private |
Split a given CPUI_LOAD operation into a sequence of LOADs of individual lanes.
A new pointer is constructed for each individual lane into a temporary, then a LOAD is created using the pointer that loads an individual lane.
- Parameters
-
op | is the given CPUI_LOAD PcodeOp |
outVars | is the output placeholders for the LOAD |
numLanes | is the number of lanes the LOAD is split into |
skipLanes | is the starting lane (within the global description) of the value being loaded |
- Returns
- true if the CPUI_LOAD was successfully modeled on lanes
References CPUI_INT_ADD, CPUI_LOAD, Varnode::getAddr(), PcodeOp::getIn(), Varnode::getOffset(), PcodeOp::getOut(), TransformManager::getPreexistingVarnode(), Varnode::getSize(), Address::getSpaceFromConst(), AddrSpace::isBigEndian(), TransformManager::newConstant(), TransformManager::newOp(), TransformManager::newOpReplace(), TransformManager::newUnique(), TransformManager::opSetInput(), and TransformManager::opSetOutput().
bool LaneDivide::buildMultiequal |
( |
PcodeOp * |
op, |
|
|
TransformVar * |
outVars, |
|
|
int4 |
numLanes, |
|
|
int4 |
skipLanes |
|
) |
| |
|
private |
bool LaneDivide::buildPiece |
( |
PcodeOp * |
op, |
|
|
TransformVar * |
outVars, |
|
|
int4 |
numLanes, |
|
|
int4 |
skipLanes |
|
) |
| |
|
private |
bool LaneDivide::buildRightShift |
( |
PcodeOp * |
op, |
|
|
TransformVar * |
outVars, |
|
|
int4 |
numLanes, |
|
|
int4 |
skipLanes |
|
) |
| |
|
private |
Check that a CPUI_INT_RIGHT respects the lanes then generate lane placeholders.
For the given lane scheme, check that the RIGHT shift is copying whole lanes to each other. If so, generate the placeholder COPYs that model the shift.
- Parameters
-
op | is the given CPUI_INT_RIGHT PcodeOp |
outVars | is the output placeholders for the RIGHT shift |
numLanes | is the number of lanes the shift is split into |
skipLanes | is the starting lane (within the global description) of the value being loaded |
- Returns
- true if the CPUI_INT_RIGHT was successfully modeled on lanes
References CPUI_COPY, PcodeOp::getIn(), Varnode::getOffset(), Varnode::isConstant(), TransformManager::newConstant(), TransformManager::newOpReplace(), TransformManager::opSetInput(), TransformManager::opSetOutput(), and SubfloatFlow::setReplacement().
bool LaneDivide::buildStore |
( |
PcodeOp * |
op, |
|
|
int4 |
numLanes, |
|
|
int4 |
skipLanes |
|
) |
| |
|
private |
Split a given CPUI_STORE operation into a sequence of STOREs of individual lanes.
A new pointer is constructed for each individual lane into a temporary, then a STORE is created using the pointer that stores an individual lane.
- Parameters
-
op | is the given CPUI_STORE PcodeOp |
numLanes | is the number of lanes the STORE is split into |
skipLanes | is the starting lane (within the global description) of the value being stored |
- Returns
- true if the CPUI_STORE was successfully modeled on lanes
References CPUI_INT_ADD, CPUI_STORE, Varnode::getAddr(), PcodeOp::getIn(), Varnode::getOffset(), TransformManager::getPreexistingVarnode(), Varnode::getSize(), Address::getSpaceFromConst(), AddrSpace::isBigEndian(), TransformManager::newConstant(), TransformManager::newOp(), TransformManager::newOpReplace(), TransformManager::newUnique(), TransformManager::opSetInput(), TransformManager::opSetOutput(), and SubfloatFlow::setReplacement().
bool LaneDivide::traceBackward |
( |
TransformVar * |
rvn, |
|
|
int4 |
numLanes, |
|
|
int4 |
skipLanes |
|
) |
| |
|
private |
Pull the logical lanes back through the defining PcodeOp of the given variable.
Determine if the logical lanes can be pulled back naturally, and create placeholder variables and ops representing the logical data-flow. Update the worklist with any new Varnodes that the lanes get pulled back into.
- Parameters
-
rvn | is the placeholder variable to pull back |
numLanes | is the number of lanes represented by the placeholder variable |
skipLanes | is the index of the starting lane within the global description of the placeholder variable |
- Returns
- true if the lanes can be naturally pulled back
References PcodeOp::code(), CPUI_COPY, CPUI_INT_AND, CPUI_INT_NEGATE, CPUI_INT_OR, CPUI_INT_RIGHT, CPUI_INT_XOR, CPUI_LOAD, CPUI_MULTIEQUAL, CPUI_PIECE, CPUI_SUBPIECE, Varnode::getDef(), PcodeOp::getIn(), Varnode::getOffset(), TransformVar::getOriginal(), Varnode::getSize(), and SubfloatFlow::setReplacement().
bool LaneDivide::traceForward |
( |
TransformVar * |
rvn, |
|
|
int4 |
numLanes, |
|
|
int4 |
skipLanes |
|
) |
| |
|
private |
Push the logical lanes forward through any PcodeOp reading the given variable.
Determine if the logical lanes can be pushed forward naturally, and create placeholder variables and ops representing the logical data-flow. Update the worklist with any new Varnodes that the lanes get pushed into.
- Parameters
-
rvn | is the placeholder variable to push forward from |
numLanes | is the number of lanes represented by the placeholder variable |
skipLanes | is the index of the starting lane within the global description of the placeholder variable |
- Returns
- true if the lanes can be naturally pushed forward
References Varnode::beginDescend(), PcodeOp::code(), CPUI_COPY, CPUI_INT_AND, CPUI_INT_NEGATE, CPUI_INT_OR, CPUI_INT_RIGHT, CPUI_INT_XOR, CPUI_MULTIEQUAL, CPUI_PIECE, CPUI_STORE, CPUI_SUBPIECE, Varnode::endDescend(), PcodeOp::getIn(), Varnode::getOffset(), TransformVar::getOriginal(), PcodeOp::getOut(), Varnode::getSize(), Varnode::isConstant(), Varnode::isMark(), TransformManager::newConstant(), TransformManager::newPreexistingOp(), TransformManager::opSetInput(), and SubfloatFlow::setReplacement().