Static Value-Flow Analysis
|
#include <CFLAlias.h>
Public Member Functions | |
CFLAlias (SVFIR *ir) | |
virtual void | initialize () |
Initialize the grammar, graph, solver. | |
virtual void | initializeSolver () |
Initialize Solver. | |
virtual void | finalize () |
Print grammar and graph. | |
virtual void | solve () |
Solving CFL Reachability. | |
virtual AliasResult | alias (const SVFValue *v1, const SVFValue *v2) |
Interface exposed to users of our Alias analysis, given Value infos. | |
virtual AliasResult | alias (NodeID node1, NodeID node2) |
Interface exposed to users of our Alias analysis, given PAGNodeID. | |
virtual const PointsTo & | getCFLPts (NodeID ptr) |
Get points-to targets of a pointer. V In this context. | |
virtual bool | addCopyEdge (NodeID src, NodeID dst) |
Need Original one for virtual table. | |
virtual const NodeSet & | getRevPts (NodeID nodeId) |
Given an object, get all the nodes having whose pointsto contains the object. | |
virtual bool | updateCallGraph (const CallSiteToFunPtrMap &callsites) |
Update call graph for the input indirect callsites. | |
virtual void | onTheFlyCallGraphSolve (const CallSiteToFunPtrMap &callsites, CallEdgeMap &newEdges) |
On the fly call graph construction. | |
void | connectCaller2CalleeParams (const CallICFGNode *cs, const SVFFunction *F) |
Connect formal and actual parameters for indirect callsites. | |
void | heapAllocatorViaIndCall (const CallICFGNode *cs) |
Public Member Functions inherited from SVF::CFLBase | |
CFLBase (SVFIR *ir, PointerAnalysis::PTATY pty) | |
virtual | ~CFLBase () |
Destructor. | |
virtual void | checkParameter () |
Parameter Checking. | |
virtual void | buildCFLGrammar () |
Build Grammar from text file. | |
virtual void | buildCFLGraph () |
Build CFLGraph based on Option. | |
virtual void | normalizeCFLGrammar () |
Normalize grammar. | |
CFLGraph * | getCFLGraph () |
Get CFL graph. | |
virtual void | countSumEdges () |
Count the num of Nonterminal Edges. | |
virtual void | analyze () |
Perform analyze (main part of CFLR Analysis) | |
Public Member Functions inherited from SVF::BVDataPTAImpl | |
BVDataPTAImpl (SVFIR *pag, PointerAnalysis::PTATY type, bool alias_check=true) | |
Constructor. | |
~BVDataPTAImpl () override=default | |
Destructor. | |
PersistentPointsToCache< PointsTo > & | getPtCache () |
const PointsTo & | getPts (NodeID id) override |
virtual void | clearPts (NodeID id, NodeID element) |
Remove element from the points-to set of id. | |
virtual void | clearFullPts (NodeID id) |
Clear points-to set of id. | |
virtual bool | unionPts (NodeID id, const PointsTo &target) |
virtual bool | unionPts (NodeID id, NodeID ptd) |
virtual bool | addPts (NodeID id, NodeID ptd) |
virtual void | clearAllPts () |
Clear all data. | |
virtual void | expandFIObjs (const PointsTo &pts, PointsTo &expandedPts) |
Expand FI objects. | |
virtual void | expandFIObjs (const NodeBS &pts, NodeBS &expandedPts) |
TODO: remove repetition. | |
void | remapPointsToSets (void) |
Remap all points-to sets to use the current mapping. | |
virtual void | writeToFile (const std::string &filename) |
Interface for analysis result storage on filesystem. | |
virtual void | writeObjVarToFile (const std::string &filename) |
virtual void | writePtsResultToFile (std::fstream &f) |
virtual void | writeGepObjVarMapToFile (std::fstream &f) |
virtual bool | readFromFile (const std::string &filename) |
virtual void | readPtsResultFromFile (std::ifstream &f) |
virtual void | readGepObjVarMapFromFile (std::ifstream &f) |
virtual void | readAndSetObjFieldSensitivity (std::ifstream &f, const std::string &delimiterStr) |
virtual AliasResult | alias (const PointsTo &pts1, const PointsTo &pts2) |
Interface expose to users of our pointer analysis, given two pts. | |
void | dumpCPts () override |
dump and debug, print out conditional pts | |
void | dumpTopLevelPtsTo () override |
void | dumpAllPts () override |
Public Member Functions inherited from SVF::PointerAnalysis | |
ICFG * | getICFG () const |
Get ICFG. | |
u32_t | getNumOfResolvedIndCallEdge () const |
Return number of resolved indirect call edges. | |
PTACallGraph * | getCallGraph () const |
Return call graph. | |
CallGraphSCC * | getCallGraphSCC () const |
Return call graph SCC. | |
PointerAnalysis (SVFIR *pag, PTATY ty=Default_PTA, bool alias_check=true) | |
Constructor. | |
PTATY | getAnalysisTy () const |
Type of pointer analysis. | |
PTAImplTy | getImplTy () const |
Return implementation type of the pointer analysis. | |
bool | printStat () |
Whether print statistics. | |
void | disablePrintStat () |
Whether print statistics. | |
CallEdgeMap & | getIndCallMap () |
Get callees from an indirect callsite. | |
bool | hasIndCSCallees (const CallICFGNode *cs) const |
const FunctionSet & | getIndCSCallees (const CallICFGNode *cs) const |
virtual void | resolveIndCalls (const CallICFGNode *cs, const PointsTo &target, CallEdgeMap &newEdges) |
Resolve indirect call edges. | |
void | callGraphSCCDetection () |
PTACallGraph SCC related methods. | |
NodeID | getCallGraphSCCRepNode (NodeID id) const |
Get SCC rep node of a SVFG node. | |
bool | inSameCallGraphSCC (const SVFFunction *fun1, const SVFFunction *fun2) |
Return TRUE if this edge is inside a PTACallGraph SCC, i.e., src node and dst node are in the same SCC on the SVFG. | |
bool | isInRecursion (const SVFFunction *fun) const |
bool | isLocalVarInRecursiveFun (NodeID id) const |
Whether a local variable is in function recursions. | |
virtual const std::string | PTAName () const |
Return PTA name. | |
CommonCHGraph * | getCHGraph () const |
get CHGraph | |
void | getVFnsFromCHA (const CallICFGNode *cs, VFunSet &vfns) |
void | getVFnsFromPts (const CallICFGNode *cs, const PointsTo &target, VFunSet &vfns) |
void | connectVCallToVFns (const CallICFGNode *cs, const VFunSet &vfns, CallEdgeMap &newEdges) |
virtual void | resolveCPPIndCalls (const CallICFGNode *cs, const PointsTo &target, CallEdgeMap &newEdges) |
Resolve cpp indirect call edges. | |
SVFIR * | getPAG () const |
PTAStat * | getStat () const |
Get PTA stat. | |
SVFModule * | getModule () const |
Module. | |
OrderedNodeSet & | getAllValidPtrs () |
Get all Valid Pointers for resolution. | |
virtual void | computeDDAPts (NodeID) |
Compute points-to results on-demand, overridden by derived classes. | |
void | printIndCSTargets (const CallICFGNode *cs, const FunctionSet &targets) |
Print targets of a function pointer. | |
virtual void | dumpPts (NodeID ptr, const PointsTo &pts) |
void | printIndCSTargets () |
void | dumpAllTypes () |
void | dumpStat () |
Dump the statistics. | |
bool | containBlackHoleNode (const PointsTo &pts) |
Determine whether a points-to contains a black hole or constant node. | |
bool | containConstantNode (const PointsTo &pts) |
virtual bool | isBlkObjOrConstantObj (NodeID ptd) const |
bool | isHeapMemObj (NodeID id) const |
Whether this object is heap or array. | |
bool | isArrayMemObj (NodeID id) const |
bool | isFIObjNode (NodeID id) const |
NodeID | getBaseObjVar (NodeID id) |
NodeID | getFIObjVar (NodeID id) |
NodeID | getGepObjVar (NodeID id, const APOffset &ap) |
virtual const NodeBS & | getAllFieldsObjVars (NodeID id) |
void | setObjFieldInsensitive (NodeID id) |
bool | isFieldInsensitive (NodeID id) const |
Private Attributes | |
CallSite2DummyValPN | callsite2DummyValPN |
Map an instruction to a dummy obj which created at an indirect callsite, which invokes a heap allocator. | |
Additional Inherited Members | |
Static Public Member Functions inherited from SVF::BVDataPTAImpl | |
static bool | classof (const PointerAnalysis *pta) |
Static Public Attributes inherited from SVF::CFLBase | |
static double | timeOfBuildCFLGrammar = 0 |
Statistics. | |
static double | timeOfNormalizeGrammar = 0 |
static double | timeOfBuildCFLGraph = 0 |
static double | numOfTerminalEdges = 0 |
static double | numOfTemporaryNonterminalEdges = 0 |
static double | numOfNonterminalEdges = 0 |
static double | numOfStartEdges = 0 |
static double | numOfIteration = 1 |
static double | numOfChecks = 1 |
static double | timeOfSolving = 0 |
Static Public Attributes inherited from SVF::PointerAnalysis | |
static const std::string | aliasTestMayAlias = "MAYALIAS" |
static const std::string | aliasTestMayAliasMangled = "_Z8MAYALIASPvS_" |
static const std::string | aliasTestNoAlias = "NOALIAS" |
static const std::string | aliasTestNoAliasMangled = "_Z7NOALIASPvS_" |
static const std::string | aliasTestPartialAlias = "PARTIALALIAS" |
static const std::string | aliasTestPartialAliasMangled = "_Z12PARTIALALIASPvS_" |
static const std::string | aliasTestMustAlias = "MUSTALIAS" |
static const std::string | aliasTestMustAliasMangled = "_Z9MUSTALIASPvS_" |
static const std::string | aliasTestFailMayAlias = "EXPECTEDFAIL_MAYALIAS" |
static const std::string | aliasTestFailMayAliasMangled = "_Z21EXPECTEDFAIL_MAYALIASPvS_" |
static const std::string | aliasTestFailNoAlias = "EXPECTEDFAIL_NOALIAS" |
static const std::string | aliasTestFailNoAliasMangled = "_Z20EXPECTEDFAIL_NOALIASPvS_" |
Protected Member Functions inherited from SVF::BVDataPTAImpl | |
PTDataTy * | getPTDataTy () const |
Get points-to data structure. | |
DiffPTDataTy * | getDiffPTDataTy () const |
DFPTDataTy * | getDFPTDataTy () const |
MutDFPTDataTy * | getMutDFPTDataTy () const |
VersionedPTDataTy * | getVersionedPTDataTy () const |
virtual void | onTheFlyThreadCallGraphSolve (const CallSiteToFunPtrMap &callsites, CallEdgeMap &newForkEdges) |
On the fly thread call graph construction respecting forksite. | |
virtual void | normalizePointsTo () |
Protected Member Functions inherited from SVF::PointerAnalysis | |
const CallSiteToFunPtrMap & | getIndirectCallsites () const |
Return all indirect callsites. | |
NodeID | getFunPtr (const CallICFGNode *cs) const |
Return function pointer PAGNode at a callsite cs. | |
virtual void | validateTests () |
Alias check functions to verify correctness of pointer analysis. | |
virtual void | validateSuccessTests (std::string fun) |
virtual void | validateExpectedFailureTests (std::string fun) |
void | resetObjFieldSensitive () |
Reset all object node as field-sensitive. | |
Protected Attributes inherited from SVF::CFLBase | |
SVFIR * | svfir |
CFLGraph * | graph |
GrammarBase * | grammarBase |
CFGrammar * | grammar |
CFLSolver * | solver |
Protected Attributes inherited from SVF::PointerAnalysis | |
bool | print_stat |
User input flags. | |
bool | alias_validation |
Flag for validating points-to/alias results. | |
u32_t | OnTheFlyIterBudgetForStat |
Flag for iteration budget for on-the-fly statistics. | |
SVFModule * | svfMod |
Module. | |
PTATY | ptaTy |
Pointer analysis Type. | |
PTAImplTy | ptaImplTy |
PTA implementation type. | |
PTAStat * | stat |
Statistics. | |
PTACallGraph * | callgraph |
Call graph used for pointer analysis. | |
CallGraphSCC * | callGraphSCC |
SCC for PTACallGraph. | |
ICFG * | icfg |
Interprocedural control-flow graph. | |
CommonCHGraph * | chgraph |
CHGraph. | |
Static Protected Attributes inherited from SVF::PointerAnalysis | |
static SVFIR * | pag = nullptr |
SVFIR. | |
Definition at line 41 of file CFLAlias.h.
Definition at line 45 of file CFLAlias.h.
|
inline |
Definition at line 47 of file CFLAlias.h.
Need Original one for virtual table.
Add copy edge on constraint graph
Definition at line 118 of file CFLAlias.h.
Interface exposed to users of our Alias analysis, given Value infos.
Reimplemented from SVF::BVDataPTAImpl.
Definition at line 65 of file CFLAlias.h.
|
inlinevirtual |
Interface exposed to users of our Alias analysis, given PAGNodeID.
Reimplemented from SVF::BVDataPTAImpl.
Definition at line 73 of file CFLAlias.h.
void CFLAlias::connectCaller2CalleeParams | ( | const CallICFGNode * | cs, |
const SVFFunction * | F | ||
) |
Connect formal and actual parameters for indirect callsites.
Connect formal and actual parameters for indirect callsites
Definition at line 62 of file CFLAlias.cpp.
|
virtual |
Print grammar and graph.
Reimplemented from SVF::CFLBase.
Definition at line 213 of file CFLAlias.cpp.
Get points-to targets of a pointer. V In this context.
Check V Dst of ptr.
Definition at line 82 of file CFLAlias.h.
Given an object, get all the nodes having whose pointsto contains the object.
Check Outgoing flowtobar edge dst of ptr
Reimplemented from SVF::BVDataPTAImpl.
Definition at line 133 of file CFLAlias.h.
void CFLAlias::heapAllocatorViaIndCall | ( | const CallICFGNode * | cs | ) |
Definition at line 145 of file CFLAlias.cpp.
|
virtual |
Initialize the grammar, graph, solver.
Reimplemented from SVF::PointerAnalysis.
Definition at line 188 of file CFLAlias.cpp.
|
virtual |
Initialize Solver.
Reimplemented in SVF::POCRAlias, and SVF::POCRHybrid.
Definition at line 208 of file CFLAlias.cpp.
|
virtual |
On the fly call graph construction.
On the fly call graph construction callsites is candidate indirect callsites need to be analyzed based on points-to results newEdges is the new indirect call edges discovered
Reimplemented from SVF::BVDataPTAImpl.
Definition at line 39 of file CFLAlias.cpp.
|
virtual |
Solving CFL Reachability.
Reimplemented from SVF::CFLBase.
Definition at line 228 of file CFLAlias.cpp.
|
virtual |
Update call graph for the input indirect callsites.
Update call graph for the input indirect callsites
Reimplemented from SVF::BVDataPTAImpl.
Definition at line 173 of file CFLAlias.cpp.
|
private |
Map an instruction to a dummy obj which created at an indirect callsite, which invokes a heap allocator.
Definition at line 151 of file CFLAlias.h.