decompiler
1.0.0
|
A cache of Cover intersection tests for HighVariables. More...
#include <variable.hh>
Public Member Functions | |
void | moveIntersectTests (HighVariable *high1, HighVariable *high2) |
Translate any intersection tests for high2 into tests for high1. More... | |
bool | updateHigh (HighVariable *a) |
Make sure given HighVariable's Cover is up-to-date. More... | |
bool | intersection (HighVariable *a, HighVariable *b) |
Test the intersection of two HighVariables and cache the result. More... | |
void | clear (void) |
Private Member Functions | |
bool | blockIntersection (HighVariable *a, HighVariable *b, int4 blk) |
Test if two HighVariables intersect on a given BlockBasic. More... | |
void | purgeHigh (HighVariable *high) |
Remove cached intersection tests for a given HighVariable. More... | |
Static Private Member Functions | |
static void | gatherBlockVarnodes (HighVariable *a, int4 blk, const Cover &cover, vector< Varnode *> &res) |
Gather Varnode instances of the given HighVariable that intersect a cover on a specific block. More... | |
static bool | testBlockIntersection (HighVariable *a, int4 blk, const Cover &cover, int4 relOff, const vector< Varnode *> &blist) |
Test instances of a the given HighVariable for intersection on a specific block with a cover. More... | |
Private Attributes | |
map< HighEdge, bool > | highedgemap |
A cache of intersection tests, sorted by HighVariable pair. | |
A cache of Cover intersection tests for HighVariables.
An test is performed by calling the intersect() method, which returns the result of a full Cover intersection test, taking into account, overlapping pieces, shadow Varnodes etc. The results of the test are cached in this object, so repeated calls do not need to perform the full calculation. The cache examines HighVariable dirtiness flags to determine if its Cover and cached tests are stale. The Cover can be externally updated, without performing a test, and still keeping the cached tests accurate, by calling the updateHigh() method. If two HighVariables to be merged, the cached tests can be updated by calling moveIntersectTest() before merging.
|
private |
Test if two HighVariables intersect on a given BlockBasic.
Intersections are checked only on the specified block.
a | is the first HighVariable |
b | is the second HighVariable |
blk | is the index of the BlockBasic on which to test intersection |
References ghidra::HighVariable::getCover(), ghidra::VariablePiece::getHigh(), ghidra::VariablePiece::getIntersection(), ghidra::VariablePiece::getOffset(), ghidra::VariablePiece::getSize(), ghidra::VariablePiece::numIntersection(), and ghidra::HighVariable::piece.
|
staticprivate |
Gather Varnode instances of the given HighVariable that intersect a cover on a specific block.
a | is the given HighVariable |
blk | is the specific block number |
cover | is the Cover to test for intersection |
res | will hold the resulting intersecting Varnodes |
References ghidra::Varnode::getCover(), ghidra::HighVariable::getInstance(), ghidra::Cover::intersectByBlock(), and ghidra::HighVariable::numInstances().
bool ghidra::HighIntersectTest::intersection | ( | HighVariable * | a, |
HighVariable * | b | ||
) |
Test the intersection of two HighVariables and cache the result.
If the Covers of the two variables intersect, this routine returns true. To avoid expensive computation on the Cover objects themselves, the test result associated with the pair of HighVariables is cached.
a | is the first HighVariable |
b | is the second HighVariable |
References ghidra::HighVariable::getCover(), and ghidra::Cover::intersectList().
void ghidra::HighIntersectTest::moveIntersectTests | ( | HighVariable * | high1, |
HighVariable * | high2 | ||
) |
Translate any intersection tests for high2 into tests for high1.
The two variables will be merged and high2, as an object, will be freed. We update the cached intersection tests for high2 so that they will now apply to new merged high1
high1 | is the variable object being kept |
high2 | is the variable object being eliminated |
References ghidra::HighVariable::setMark().
Referenced by ghidra::HighVariable::merge().
|
private |
Remove cached intersection tests for a given HighVariable.
All tests for pairs where either the first or second HighVariable matches the given one are removed.
high | is the given HighVariable to purge |
|
staticprivate |
Test instances of a the given HighVariable for intersection on a specific block with a cover.
A list of Varnodes has already been determined to intersect on the block. For an instance that does as well, a final test of copy shadowing is performed with the Varnode list. If there is no shadowing, a merging intersection has been found and true is returned.
a | is the given HighVariable |
blk | is the specific block number |
cover | is the Cover to test for intersection |
relOff | is the relative byte offset of the HighVariable to the Varnodes |
blist | is the list of Varnodes for copy shadow testing |
References ghidra::Varnode::copyShadow(), ghidra::Varnode::getCover(), ghidra::HighVariable::getInstance(), ghidra::Varnode::getSize(), ghidra::Cover::intersectByBlock(), ghidra::HighVariable::numInstances(), and ghidra::Varnode::partialCopyShadow().
bool ghidra::HighIntersectTest::updateHigh | ( | HighVariable * | a | ) |
Make sure given HighVariable's Cover is up-to-date.
As manipulations are made, Cover information gets out of date. A dirty flag is used to indicate a particular HighVariable Cover is out-of-date. This routine checks the dirty flag and updates the Cover information if it is set.
a | is the HighVariable to update |
References ghidra::HighVariable::isCoverDirty(), and ghidra::HighVariable::updateCover().