Static Value-Flow Analysis
|
#include <PointerAnalysisImpl.h>
Public Member Functions | |
BVDataPTAImpl (SVFIR *pag, PointerAnalysis::PTATY type, bool alias_check=true) | |
Constructor. More... | |
~BVDataPTAImpl () override=default | |
Destructor. More... | |
PersistentPointsToCache< PointsTo > & | getPtCache () |
Public Member Functions inherited from SVF::PointerAnalysis | |
ICFG * | getICFG () const |
Get ICFG. More... | |
u32_t | getNumOfResolvedIndCallEdge () const |
Return number of resolved indirect call edges. More... | |
PTACallGraph * | getCallGraph () const |
Return call graph. More... | |
CallGraphSCC * | getCallGraphSCC () const |
Return call graph SCC. More... | |
PointerAnalysis (SVFIR *pag, PTATY ty=Default_PTA, bool alias_check=true) | |
Constructor. More... | |
PTATY | getAnalysisTy () const |
Type of pointer analysis. More... | |
PTAImplTy | getImplTy () const |
Return implementation type of the pointer analysis. More... | |
bool | printStat () |
Whether print statistics. More... | |
void | disablePrintStat () |
Whether print statistics. More... | |
CallEdgeMap & | getIndCallMap () |
Get callees from an indirect callsite. More... | |
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. More... | |
void | callGraphSCCDetection () |
PTACallGraph SCC related methods. More... | |
NodeID | getCallGraphSCCRepNode (NodeID id) const |
Get SCC rep node of a SVFG node. More... | |
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. More... | |
bool | isInRecursion (const SVFFunction *fun) const |
bool | isLocalVarInRecursiveFun (NodeID id) const |
Whether a local variable is in function recursions. More... | |
virtual const std::string | PTAName () const |
Return PTA name. More... | |
CommonCHGraph * | getCHGraph () const |
get CHGraph More... | |
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. More... | |
SVFIR * | getPAG () const |
PTAStat * | getStat () const |
Get PTA stat. More... | |
SVFModule * | getModule () const |
Module. More... | |
OrderedNodeSet & | getAllValidPtrs () |
Get all Valid Pointers for resolution. More... | |
virtual | ~PointerAnalysis () |
Destructor. More... | |
virtual void | initialize () |
Initialization of a pointer analysis, including building symbol table and SVFIR etc. More... | |
virtual void | analyze ()=0 |
Start Analysis here (main part of pointer analysis). It needs to be implemented in child class. More... | |
virtual void | computeDDAPts (NodeID) |
Compute points-to results on-demand, overridden by derived classes. More... | |
void | printIndCSTargets (const CallICFGNode *cs, const FunctionSet &targets) |
Print targets of a function pointer. More... | |
virtual void | dumpPts (NodeID ptr, const PointsTo &pts) |
void | printIndCSTargets () |
void | dumpAllTypes () |
void | dumpStat () |
Dump the statistics. More... | |
bool | containBlackHoleNode (const PointsTo &pts) |
Determine whether a points-to contains a black hole or constant node. More... | |
bool | containConstantNode (const PointsTo &pts) |
virtual bool | isBlkObjOrConstantObj (NodeID ptd) const |
bool | isHeapMemObj (NodeID id) const |
Whether this object is heap or array. More... | |
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 |
Static Public Member Functions | |
static bool | classof (const PointerAnalysis *pta) |
std::unique_ptr< PTDataTy > | ptD |
Points-to data. More... | |
PersistentPointsToCache< PointsTo > | ptCache |
const PointsTo & | getPts (NodeID id) override |
const NodeSet & | getRevPts (NodeID nodeId) override |
virtual void | clearPts (NodeID id, NodeID element) |
Remove element from the points-to set of id. More... | |
virtual void | clearFullPts (NodeID id) |
Clear points-to set of id. More... | |
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. More... | |
virtual void | expandFIObjs (const PointsTo &pts, PointsTo &expandedPts) |
Expand FI objects. More... | |
virtual void | expandFIObjs (const NodeBS &pts, NodeBS &expandedPts) |
TODO: remove repetition. More... | |
void | remapPointsToSets (void) |
Remap all points-to sets to use the current mapping. More... | |
virtual void | writeToFile (const std::string &filename) |
Interface for analysis result storage on filesystem. More... | |
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) |
AliasResult | alias (const SVFValue *V1, const SVFValue *V2) override |
Interface expose to users of our pointer analysis, given Value infos. More... | |
AliasResult | alias (NodeID node1, NodeID node2) override |
Interface expose to users of our pointer analysis, given PAGNodeID. More... | |
virtual AliasResult | alias (const PointsTo &pts1, const PointsTo &pts2) |
Interface expose to users of our pointer analysis, given two pts. More... | |
void | dumpCPts () override |
dump and debug, print out conditional pts More... | |
void | dumpTopLevelPtsTo () override |
void | dumpAllPts () override |
PTDataTy * | getPTDataTy () const |
Get points-to data structure. More... | |
void | finalize () override |
Finalization of pointer analysis, and normalize points-to information to Bit Vector representation. More... | |
virtual bool | updateCallGraph (const CallSiteToFunPtrMap &) |
Update callgraph. This should be implemented by its subclass. More... | |
DiffPTDataTy * | getDiffPTDataTy () const |
DFPTDataTy * | getDFPTDataTy () const |
MutDFPTDataTy * | getMutDFPTDataTy () const |
VersionedPTDataTy * | getVersionedPTDataTy () const |
virtual void | onTheFlyCallGraphSolve (const CallSiteToFunPtrMap &callsites, CallEdgeMap &newEdges) |
On the fly call graph construction. More... | |
virtual void | onTheFlyThreadCallGraphSolve (const CallSiteToFunPtrMap &callsites, CallEdgeMap &newForkEdges) |
On the fly thread call graph construction respecting forksite. More... | |
virtual void | normalizePointsTo () |
Additional Inherited Members | |
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::PointerAnalysis | |
const CallSiteToFunPtrMap & | getIndirectCallsites () const |
Return all indirect callsites. More... | |
NodeID | getFunPtr (const CallICFGNode *cs) const |
Return function pointer PAGNode at a callsite cs. More... | |
virtual void | validateTests () |
Alias check functions to verify correctness of pointer analysis. More... | |
virtual void | validateSuccessTests (std::string fun) |
virtual void | validateExpectedFailureTests (std::string fun) |
void | resetObjFieldSensitive () |
Reset all object node as field-sensitive. More... | |
Protected Attributes inherited from SVF::PointerAnalysis | |
bool | print_stat |
User input flags. More... | |
bool | alias_validation |
Flag for validating points-to/alias results. More... | |
u32_t | OnTheFlyIterBudgetForStat |
Flag for iteration budget for on-the-fly statistics. More... | |
SVFModule * | svfMod |
Module. More... | |
PTATY | ptaTy |
Pointer analysis Type. More... | |
PTAImplTy | ptaImplTy |
PTA implementation type. More... | |
PTAStat * | stat |
Statistics. More... | |
PTACallGraph * | callgraph |
Call graph used for pointer analysis. More... | |
CallGraphSCC * | callGraphSCC |
SCC for PTACallGraph. More... | |
ICFG * | icfg |
Interprocedural control-flow graph. More... | |
CommonCHGraph * | chgraph |
CHGraph. More... | |
Static Protected Attributes inherited from SVF::PointerAnalysis | |
static SVFIR * | pag = nullptr |
SVFIR. More... | |
Pointer analysis implementation which uses bit vector based points-to data structure
Definition at line 42 of file PointerAnalysisImpl.h.
Definition at line 48 of file PointerAnalysisImpl.h.
Definition at line 47 of file PointerAnalysisImpl.h.
Definition at line 53 of file PointerAnalysisImpl.h.
Definition at line 52 of file PointerAnalysisImpl.h.
Definition at line 54 of file PointerAnalysisImpl.h.
Definition at line 51 of file PointerAnalysisImpl.h.
typedef MutableVersionedPTData<NodeID, NodeSet, NodeID, PointsTo, VersionedVar, Set<VersionedVar> > SVF::BVDataPTAImpl::MutVersionedPTDataTy |
Definition at line 55 of file PointerAnalysisImpl.h.
Definition at line 59 of file PointerAnalysisImpl.h.
typedef PersistentDiffPTData<NodeID, NodeSet, NodeID, PointsTo> SVF::BVDataPTAImpl::PersDiffPTDataTy |
Definition at line 58 of file PointerAnalysisImpl.h.
typedef PersistentIncDFPTData<NodeID, NodeSet, NodeID, PointsTo> SVF::BVDataPTAImpl::PersIncDFPTDataTy |
Definition at line 60 of file PointerAnalysisImpl.h.
Definition at line 57 of file PointerAnalysisImpl.h.
typedef PersistentVersionedPTData<NodeID, NodeSet, NodeID, PointsTo, VersionedVar, Set<VersionedVar> > SVF::BVDataPTAImpl::PersVersionedPTDataTy |
Definition at line 61 of file PointerAnalysisImpl.h.
Definition at line 46 of file PointerAnalysisImpl.h.
typedef VersionedPTData<NodeID, NodeSet, NodeID, PointsTo, VersionedVar, Set<VersionedVar> > SVF::BVDataPTAImpl::VersionedPTDataTy |
Definition at line 49 of file PointerAnalysisImpl.h.
How the PTData used is implemented.
Enumerator | |
---|---|
Mutable | |
Persistent |
Definition at line 64 of file PointerAnalysisImpl.h.
BVDataPTAImpl::BVDataPTAImpl | ( | SVFIR * | p, |
PointerAnalysis::PTATY | type, | ||
bool | alias_check = true |
||
) |
Constructor.
Constructor
Definition at line 44 of file PointerAnalysisImpl.cpp.
|
overridedefault |
Destructor.
Definition at line 121 of file PointerAnalysisImpl.h.
|
virtual |
Interface expose to users of our pointer analysis, given two pts.
Return alias results based on our points-to/alias analysis
Definition at line 626 of file PointerAnalysisImpl.cpp.
|
overridevirtual |
Interface expose to users of our pointer analysis, given Value infos.
Return alias results based on our points-to/alias analysis
Implements SVF::PointerAnalysis.
Definition at line 609 of file PointerAnalysisImpl.cpp.
|
overridevirtual |
Interface expose to users of our pointer analysis, given PAGNodeID.
Return alias results based on our points-to/alias analysis
Implements SVF::PointerAnalysis.
Definition at line 618 of file PointerAnalysisImpl.cpp.
|
inlinestatic |
Definition at line 81 of file PointerAnalysisImpl.h.
|
inlinevirtual |
|
inlinevirtual |
Clear points-to set of id.
Definition at line 105 of file PointerAnalysisImpl.h.
Remove element from the points-to set of id.
Definition at line 99 of file PointerAnalysisImpl.h.
|
overridevirtual |
Dump all points-to including top-level (ValVar) and address-taken (ObjVar) variables
Reimplemented from SVF::PointerAnalysis.
Definition at line 469 of file PointerAnalysisImpl.cpp.
|
inlineoverridevirtual |
dump and debug, print out conditional pts
Reimplemented from SVF::PointerAnalysis.
Definition at line 229 of file PointerAnalysisImpl.h.
|
overridevirtual |
Dump points-to of each pag node
Reimplemented from SVF::PointerAnalysis.
Reimplemented in SVF::Andersen.
Definition at line 436 of file PointerAnalysisImpl.cpp.
TODO: remove repetition.
Definition at line 143 of file PointerAnalysisImpl.cpp.
Expand FI objects.
Expand all fields of an aggregate in all points-to sets
Definition at line 131 of file PointerAnalysisImpl.cpp.
|
overrideprotectedvirtual |
Finalization of pointer analysis, and normalize points-to information to Bit Vector representation.
Reimplemented from SVF::PointerAnalysis.
Reimplemented in SVF::VersionedFlowSensitive, SVF::TypeAnalysis, SVF::FlowSensitive, SVF::AndersenBase, and SVF::Andersen.
Definition at line 91 of file PointerAnalysisImpl.cpp.
|
inlineprotected |
Definition at line 178 of file PointerAnalysisImpl.h.
|
inlineprotected |
Definition at line 171 of file PointerAnalysisImpl.h.
|
inlineprotected |
Definition at line 185 of file PointerAnalysisImpl.h.
|
inline |
Definition at line 76 of file PointerAnalysisImpl.h.
|
inlineprotected |
Get points-to data structure.
Definition at line 155 of file PointerAnalysisImpl.h.
Get points-to and reverse points-to
Implements SVF::PointerAnalysis.
Reimplemented in SVF::Steensgaard, and SVF::Andersen.
Definition at line 88 of file PointerAnalysisImpl.h.
Given an object, get all the nodes having whose pointsto contains the object. Similar to getPts, this also needs to be implemented in child classes.
Implements SVF::PointerAnalysis.
Definition at line 92 of file PointerAnalysisImpl.h.
|
inlineprotected |
Definition at line 192 of file PointerAnalysisImpl.h.
|
protectedvirtual |
Normalize points-to information for field-sensitive analysis, i.e., replace fieldObj with baseObj if it is field-insensitive
Normalize points-to information for field-sensitive analysis
Reimplemented in SVF::AndersenBase.
Definition at line 550 of file PointerAnalysisImpl.cpp.
|
protectedvirtual |
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 in SVF::CFLAlias.
Definition at line 492 of file PointerAnalysisImpl.cpp.
|
protectedvirtual |
On the fly thread call graph construction respecting forksite.
On the fly call graph construction respecting forksite callsites is candidate indirect callsites need to be analyzed based on points-to results newEdges is the new indirect call edges discovered
Definition at line 515 of file PointerAnalysisImpl.cpp.
|
virtual |
Definition at line 377 of file PointerAnalysisImpl.cpp.
|
virtual |
Load pointer analysis result form a file. It populates BVDataPTAImpl with the points-to data, and updates SVFIR with the SVFIR offset nodes created during Andersen's solving stage.
Definition at line 403 of file PointerAnalysisImpl.cpp.
|
virtual |
Definition at line 341 of file PointerAnalysisImpl.cpp.
|
virtual |
Definition at line 287 of file PointerAnalysisImpl.cpp.
void BVDataPTAImpl::remapPointsToSets | ( | void | ) |
Remap all points-to sets to use the current mapping.
Definition at line 155 of file PointerAnalysisImpl.cpp.
Union/add points-to. Add the reverse points-to for node collapse purpose To be noted that adding reverse pts might incur 10% total overhead during solving
Reimplemented in SVF::Steensgaard, and SVF::Andersen.
Definition at line 113 of file PointerAnalysisImpl.h.
Reimplemented in SVF::Steensgaard, and SVF::Andersen.
Definition at line 117 of file PointerAnalysisImpl.h.
|
inlineprotectedvirtual |
Update callgraph. This should be implemented by its subclass.
Reimplemented in SVF::FlowSensitive, SVF::AndersenSCD, SVF::CFLAlias, and SVF::AndersenBase.
Definition at line 165 of file PointerAnalysisImpl.h.
|
virtual |
Definition at line 222 of file PointerAnalysisImpl.cpp.
|
virtual |
Definition at line 160 of file PointerAnalysisImpl.cpp.
|
virtual |
Definition at line 196 of file PointerAnalysisImpl.cpp.
|
virtual |
Interface for analysis result storage on filesystem.
Store pointer analysis result into a file. It includes the points-to relations, and all SVFIR nodes including those created when solving Andersen's constraints.
Definition at line 244 of file PointerAnalysisImpl.cpp.
|
private |
Definition at line 214 of file PointerAnalysisImpl.h.
|
private |
Points-to data.
Definition at line 212 of file PointerAnalysisImpl.h.