decompiler
1.0.0
|
All paths from a (putative) switch variable to the CPUI_BRANCHIND. More...
#include <jumptable.hh>
Classes | |
struct | RootedOp |
A PcodeOp in the path set associated with the last Varnode in the intersection. More... | |
Public Member Functions | |
void | set (const PathMeld &op2) |
Copy paths from another container. More... | |
void | set (const vector< PcodeOp * > &path, const vector< int4 > &slot) |
Initialize this to be a single path. More... | |
void | set (PcodeOp *op, Varnode *vn) |
Initialize this container to a single node "path". More... | |
void | append (const PathMeld &op2) |
Append a new set of paths to this set of paths. More... | |
void | clear (void) |
Clear this to be an empty container. | |
void | meld (vector< PcodeOp * > &path, vector< int4 > &slot) |
Meld a new path into this container. More... | |
void | markPaths (bool val, int4 startVarnode) |
Mark PcodeOps paths from the given start. More... | |
PcodeOp * | getEarliestOp (int4 pos) const |
Find earliest PcodeOp that has a specific common Varnode as input. More... | |
Private Member Functions | |
void | internalIntersect (vector< int4 > &parentMap) |
Calculate intersection of a new Varnode path with the old path. More... | |
int4 | meldOps (const vector< PcodeOp * > &path, int4 cutOff, const vector< int4 > &parentMap) |
Meld in PcodeOps from a new path into this container. More... | |
void | truncatePaths (int4 cutPoint) |
Truncate all paths at the given new Varnode. More... | |
Private Attributes | |
vector< Varnode * > | commonVn |
Varnodes in common with all paths. | |
vector< RootedOp > | opMeld |
All the ops for the melded paths. | |
All paths from a (putative) switch variable to the CPUI_BRANCHIND.
This is a container for intersecting paths during the construction of a JumpModel. It contains every PcodeOp from some starting Varnode through all paths to a specific BRANCHIND. The paths can split and rejoin. This also keeps track of Varnodes that are present on all paths, as these are the potential switch variables for the model.
void PathMeld::append | ( | const PathMeld & | op2 | ) |
Append a new set of paths to this set of paths.
The new paths must all start at the common end-point of the paths in this container. The new set of melded paths start at the original common start point for this container, flow through this old common end-point, and end at the new common end-point.
op2 | is the set of paths to be appended |
References commonVn, and opMeld.
Referenced by JumpBasic2::recoverModel().
PcodeOp * PathMeld::getEarliestOp | ( | int4 | pos | ) | const |
Find earliest PcodeOp that has a specific common Varnode as input.
The Varnode is specified by an index into sequence of Varnodes common to all paths in this PathMeld. We find the earliest (as in executed first) PcodeOp, within this PathMeld that uses the Varnode as input.
pos | is the index of the Varnode |
References opMeld.
Referenced by JumpBasic::findSmallestNormal().
|
private |
Calculate intersection of a new Varnode path with the old path.
The new path of Varnodes must all be marked. The old path, commonVn, is replaced with the intersection. A map is created from the index of each Varnode in the old path with its index in the new path. If the Varnode is not in the intersection, its index is mapped to -1.
parentMap | will hold the new index map |
References commonVn.
Referenced by meld().
void PathMeld::markPaths | ( | bool | val, |
int4 | startVarnode | ||
) |
Mark PcodeOps paths from the given start.
The starting Varnode, common to all paths, is provided as an index. All PcodeOps up to the final BRANCHIND are (un)marked.
val | is true for marking, false for unmarking |
startVarnode | is the index of the starting PcodeOp |
References opMeld.
Referenced by JumpBasic::markModel().
void PathMeld::meld | ( | vector< PcodeOp * > & | path, |
vector< int4 > & | slot | ||
) |
Meld a new path into this container.
Add the new path, recalculating the set of Varnodes common to all paths. Paths are trimmed to ensure that any path that splits from the common intersection must eventually rejoin.
path | is the new path of PcodeOps to meld, in reverse execution order |
slot | is the set of Varnodes in the new path presented as input slots to the corresponding PcodeOp |
References internalIntersect(), meldOps(), and truncatePaths().
Referenced by JumpBasic::findDeterminingVarnodes().
|
private |
Meld in PcodeOps from a new path into this container.
Execution order of the PcodeOps in the container is maintained. Each PcodeOp, old or new, has its split point from the common path recalculated. PcodeOps that split (use a vn not in intersection) and do not rejoin (have a predecessor Varnode in the intersection) get removed. If splitting PcodeOps can't be ordered with the existing meld, we get a new cut point.
path | is the new path of PcodeOps in sequence |
cutOff | is the number of PcodeOps with an input in the common path |
parentMap | is the map from old common Varnodes to the new common Varnodes |
References opMeld.
Referenced by meld().
void PathMeld::set | ( | const PathMeld & | op2 | ) |
Copy paths from another container.
op2 | is the path container to copy from |
References commonVn, and opMeld.
Referenced by JumpBasic::findDeterminingVarnodes(), and JumpBasic2::initializeStart().
void PathMeld::set | ( | const vector< PcodeOp * > & | path, |
const vector< int4 > & | slot | ||
) |
|
private |
Truncate all paths at the given new Varnode.
The given Varnode is provided as an index into the current common Varnode list. All Varnodes and PcodeOps involved in execution before this new cut point are removed.
cutPoint | is the given new Varnode |
References commonVn, and opMeld.
Referenced by meld().