retdec
|
A CFG traversal that checks whether no variable in a given set is defined/modified between a start statement and a set of end statements. More...
#include <no_var_def_cfg_traversal.h>
Static Public Member Functions | |
static bool | noVarIsDefinedBetweenStmts (ShPtr< Statement > start, const StmtSet &ends, const VarSet &vars, ShPtr< CFG > cfg, ShPtr< ValueAnalysis > va) |
Returns true if no variable from vars is defined between start and statements from ends in cfg, false otherwise. More... | |
Private Member Functions | |
NoVarDefCFGTraversal (ShPtr< CFG > cfg, const StmtSet &ends, const VarSet &vars, ShPtr< ValueAnalysis > va) | |
Constructs a new traverser. More... | |
virtual bool | visitStmt (ShPtr< Statement > stmt) override |
Visits the given statement stmt. More... | |
virtual bool | getEndRetVal () const override |
Returns the value that should be returned when an end of the traversal is reached. More... | |
virtual bool | combineRetVals (bool origRetVal, bool newRetVal) const override |
Computes a new return value from the original return value (origRetVal) and the new return value (newRetVal). More... | |
Private Attributes | |
const StmtSet & | ends |
Statements at which we should end the traversal. More... | |
const VarSet & | vars |
Variables for whose definition/modification we're looking for. More... | |
ShPtr< ValueAnalysis > | va |
Analysis of values. More... | |
Additional Inherited Members | |
![]() | |
CFGTraversal (ShPtr< CFG > cfg, bool defaultCurrRetVal) | |
Constructs a new traverser. More... | |
~CFGTraversal ()=default | |
bool | getCurrRetVal () const |
Returns the value that should be returned as the result of visiting a statement. More... | |
bool | performTraversal (ShPtr< Statement > startStmt) |
Performs a traversal of the current CFG, starting at startStmt. More... | |
bool | performTraversalFromSuccessors (ShPtr< Statement > stmt) |
Performs a traversal of the current CFG, starting at the successor(s) of stmt. More... | |
bool | performReverseTraversal (ShPtr< Statement > startStmt) |
Performs a reverse traversal of the current CFG, starting at startStmt. More... | |
bool | performReverseTraversalFromPredecessors (ShPtr< Statement > stmt) |
Performs a reverse traversal of the current CFG, starting at the predecessor(s) of stmt. More... | |
![]() | |
ShPtr< CFG > | cfg |
CFG that is being traversed. More... | |
StmtUSet | checkedStmts |
Statements that have been checked (to prevent looping). More... | |
bool | currRetVal |
Current return value of visitStmt(). More... | |
bool | stopTraversal |
Should the traversal be stopped? More... | |
A CFG traversal that checks whether no variable in a given set is defined/modified between a start statement and a set of end statements.
Instances of this class have reference object semantics. This is a concrete traverser which should not be subclassed.
|
private |
Constructs a new traverser.
[in] | cfg | CFG that should be traversed. |
[in] | ends | Statements at which we should end the traversal. |
[in] | vars | Variables for whose definition/modification we're looking for. |
[in] | va | Analysis of values. |
|
overrideprivatevirtual |
Computes a new return value from the original return value (origRetVal) and the new return value (newRetVal).
Implements retdec::llvmir2hll::CFGTraversal.
|
overrideprivatevirtual |
Returns the value that should be returned when an end of the traversal is reached.
For example, the end may mean the end node of the CFG or a statement that has already been traversed.
Implements retdec::llvmir2hll::CFGTraversal.
|
static |
Returns true
if no variable from vars is defined between start and statements from ends in cfg, false
otherwise.
[in] | start | The search starts from the statement before start. |
[in] | ends | Statements at which we should end the traversal. |
[in] | vars | Variables for whose definition/modification we're looking for. |
[in] | cfg | CFG that should be traversed. |
[in] | va | Analysis of values. |
During the traversal, it is checked that there are no function calls.
This function leaves va in a valid state.
|
overrideprivatevirtual |
Visits the given statement stmt.
return true
if the traversing should continue, false
otherwise.
Note: checkedStmts
is modified in CFGTraversal, so it is not necessary for the implementation of this function to add stmt to checkedStmts
.
If you want the traversal to end prematurely, set the stopTraversal variable to true
. Otherwise, if you just return false
, the traversal may still continue from other branches because of recursion.
Implements retdec::llvmir2hll::CFGTraversal.
|
private |
Statements at which we should end the traversal.
|
private |
Analysis of values.
|
private |
Variables for whose definition/modification we're looking for.