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... | |
int4 | numCommonVarnode (void) const |
Return the number of Varnodes common to all paths. | |
int4 | numOps (void) const |
Return the number of PcodeOps across all paths. | |
Varnode * | getVarnode (int4 i) const |
Get the i-th common Varnode. | |
Varnode * | getOpParent (int4 i) const |
Get the split-point for the i-th PcodeOp. | |
PcodeOp * | getOp (int4 i) const |
Get the i-th PcodeOp. | |
PcodeOp * | getEarliestOp (int4 pos) const |
Find earliest PcodeOp that has a specific common Varnode as input. More... | |
bool | empty (void) const |
Return true if this container holds no paths. | |
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 |
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 |
|
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 Varnode::clearMark(), and Varnode::isMark().
void PathMeld::markPaths | ( | bool | val, |
int4 | startVarnode | ||
) |
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 Varnode::clearMark(), Varnode::isMark(), and Varnode::setMark().
|
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 SeqNum::getOrder(), PcodeOp::getParent(), and PcodeOp::getSeqNum().
void PathMeld::set | ( | const PathMeld & | op2 | ) |
void PathMeld::set | ( | const vector< PcodeOp * > & | path, |
const vector< int4 > & | slot | ||
) |
Initialize this to be a single path.
This container is initialized to hold a single data-flow path.
path | is the list of PcodeOps in the path (in reverse execution order) |
slot | is the list of each Varnode presented as an input slot in the corresponding PcodeOp |
References PcodeOp::getIn().
|
private |