Ghidra Decompiler Analysis Engine
|
Class that determines a ValueSet for each Varnode in a data-flow system. More...
#include <rangeutil.hh>
Public Member Functions | |
void | establishValueSets (const vector< Varnode * > &sinks, const vector< PcodeOp * > &reads, Varnode *stackReg, bool indirectAsCopy) |
Build value sets for a data-flow system. More... | |
void | solve (int4 max, Widener &widener) |
Iterate the ValueSet system until it stabilizes. More... | |
Class that determines a ValueSet for each Varnode in a data-flow system.
This class uses value set analysis to calculate (an overestimation of) the range of values that can reach each Varnode. The system is formed by providing a set of Varnodes for which the range is desired (the sinks) via establishValueSets(). This creates a system of Varnodes (within the single function) that can flow to the sinks. Running the method solve() does the analysis, and the caller can examine the results by examining the ValueSet attached to any of the Varnodes in the system (via Varnode::getValueSet()). The ValueSetSolver::solve() starts with minimal value sets and does iteration steps by pushing them through the PcodeOps until stability is reached. A Widener object is passed to solve() which selects the specific strategy for accelerating convergence.
void ValueSetSolver::establishValueSets | ( | const vector< Varnode * > & | sinks, |
const vector< PcodeOp * > & | reads, | ||
Varnode * | stackReg, | ||
bool | indirectAsCopy | ||
) |
Build value sets for a data-flow system.
Given a set of sinks, find all the Varnodes that flow directly into them and set up their initial ValueSet objects.
sinks | is the list terminating Varnodes |
reads | are add-on PcodeOps where we would like to know input ValueSets at the point of read |
stackReg | (if non-NULL) gives the stack pointer (for keeping track of relative offsets) |
indirectAsCopy | is true if solver should treat CPUI_INDIRECT as CPUI_COPY operations |
void ValueSetSolver::solve | ( | int4 | max, |
Widener & | widener | ||
) |
Iterate the ValueSet system until it stabilizes.
The ValueSets are recalculated in the established topological ordering, with looping at various levels until a fixed point is reached.
max | is the maximum number of iterations to allow before forcing termination |
widener | is the Widening strategy to use to accelerate stabilization |