|
Static Value-Flow Analysis
|
#include <PointerAnalysis.h>
Public Types | |
| typedef Set< const CallICFGNode * > | CallSiteSet |
| Indirect call edges type, map a callsite to a set of callees. | |
| typedef SVFIR::CallSiteToFunPtrMap | CallSiteToFunPtrMap |
| typedef Set< const FunObjVar * > | FunctionSet |
| typedef OrderedMap< const CallICFGNode *, FunctionSet > | CallEdgeMap |
| typedef SCCDetection< CallGraph * > | CallGraphSCC |
| typedef Set< const GlobalObjVar * > | VTableSet |
| typedef Set< const FunObjVar * > | VFunSet |
Static Public Attributes | |
| 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 Attributes | |
| 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. | |
| PTATY | ptaTy |
| Pointer analysis Type. | |
| PTAImplTy | ptaImplTy |
| PTA implementation type. | |
| PTAStat * | stat |
| Statistics. | |
| CallGraph * | callgraph |
| Call graph used for pointer analysis. | |
| CallGraphSCC * | callGraphSCC |
| SCC for PTACallGraph. | |
| ICFG * | icfg |
| Interprocedural control-flow graph. | |
| CommonCHGraph * | chgraph |
| CHGraph. | |
Static Protected Attributes | |
| static SVFIR * | pag = nullptr |
| SVFIR. | |
Private Member Functions | |
| void | destroy () |
| Release the memory. | |
| SVFIR * | getPAG () const |
| PTAStat * | getStat () const |
| Get PTA stat. | |
| OrderedNodeSet & | getAllValidPtrs () |
| Get all Valid Pointers for resolution. | |
| virtual void | initialize () |
| Initialization of a pointer analysis, including building symbol table and SVFIR etc. | |
| virtual void | finalize () |
| Finalization of a pointer analysis, including checking alias correctness. | |
| virtual void | analyze ()=0 |
| Start Analysis here (main part of pointer analysis). It needs to be implemented in child class. | |
| virtual void | computeDDAPts (NodeID) |
| Compute points-to results on-demand, overridden by derived classes. | |
| virtual AliasResult | alias (const SVFVar *V1, const SVFVar *V2)=0 |
| Interface exposed to users of our pointer analysis, given Value infos. | |
| virtual AliasResult | alias (NodeID node1, NodeID node2)=0 |
| Interface exposed to users of our pointer analysis, given PAGNodeID. | |
| virtual const PointsTo & | getPts (NodeID ptr)=0 |
| Get points-to targets of a pointer. It needs to be implemented in child class. | |
| virtual const NodeSet & | getRevPts (NodeID nodeId)=0 |
| bool | mayAlias (const SVFVar *V1, const SVFVar *V2) |
| Convenience bool wrappers: return true if the two operands may/must/partial alias. | |
| bool | mayAlias (NodeID node1, NodeID node2) |
| void | printIndCSTargets (const CallICFGNode *cs, const FunctionSet &targets) |
| Print targets of a function pointer. | |
| virtual void | dumpTopLevelPtsTo () |
| virtual void | dumpAllPts () |
| virtual void | dumpCPts () |
| 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 | getBaseObjVarID (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 |
| 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. | |
Definition at line 57 of file PointerAnalysis.h.
Definition at line 66 of file PointerAnalysis.h.
Definition at line 67 of file PointerAnalysis.h.
Indirect call edges type, map a callsite to a set of callees.
Definition at line 63 of file PointerAnalysis.h.
Definition at line 64 of file PointerAnalysis.h.
Definition at line 65 of file PointerAnalysis.h.
Definition at line 69 of file PointerAnalysis.h.
Definition at line 68 of file PointerAnalysis.h.
| PointerAnalysis::PointerAnalysis | ( | SVFIR * | p, |
| PTATY | ty = PTATY::Default_PTA, |
||
| bool | alias_check = true |
||
| ) |
Constructor.
Constructor
Definition at line 69 of file PointerAnalysis.cpp.
|
virtual |
Destructor.
Destructor
Definition at line 83 of file PointerAnalysis.cpp.
|
pure virtual |
Interface exposed to users of our pointer analysis, given Value infos.
Implemented in SVF::CondPTAImpl< Cond >, SVF::CondPTAImpl< ContextCond >, and SVF::BVDataPTAImpl.
|
pure virtual |
Interface exposed to users of our pointer analysis, given PAGNodeID.
Implemented in SVF::CFLAlias, SVF::CondPTAImpl< Cond >, SVF::CondPTAImpl< ContextCond >, and SVF::BVDataPTAImpl.
|
pure virtual |
Start Analysis here (main part of pointer analysis). It needs to be implemented in child class.
Implemented in SVF::CFLBase, SVF::ContextDDA, SVF::FlowDDA, SVF::AndersenBase, SVF::FlowSensitive, and SVF::TypeAnalysis.
|
inline |
PTACallGraph SCC related methods.
PTACallGraph SCC detection
Definition at line 351 of file PointerAnalysis.h.
Compute points-to results on-demand, overridden by derived classes.
Reimplemented in SVF::ContextDDA, and SVF::FlowDDA.
Definition at line 188 of file PointerAnalysis.h.
| void PointerAnalysis::connectVCallToVFns | ( | const CallICFGNode * | cs, |
| const VFunSet & | vfns, | ||
| CallEdgeMap & | newEdges | ||
| ) |
Definition at line 466 of file PointerAnalysis.cpp.
Determine whether a points-to contains a black hole or constant node.
Definition at line 254 of file PointerAnalysis.h.
Definition at line 258 of file PointerAnalysis.h.
|
private |
|
inline |
Whether print statistics.
Definition at line 324 of file PointerAnalysis.h.
|
inlinevirtual |
| void PointerAnalysis::dumpAllTypes | ( | ) |
Definition at line 233 of file PointerAnalysis.cpp.
|
inlinevirtual |
Reimplemented in SVF::CondPTAImpl< Cond >, SVF::CondPTAImpl< ContextCond >, and SVF::BVDataPTAImpl.
Definition at line 221 of file PointerAnalysis.h.
Dump points-to of top-level pointers (ValVar)
print the points-to set of node which has the maximum pts size.
Definition at line 254 of file PointerAnalysis.cpp.
| void PointerAnalysis::dumpStat | ( | ) |
|
inlinevirtual |
Reimplemented in SVF::CondPTAImpl< Cond >, SVF::CondPTAImpl< ContextCond >, SVF::Andersen, and SVF::BVDataPTAImpl.
Definition at line 219 of file PointerAnalysis.h.
|
virtual |
Finalization of a pointer analysis, including checking alias correctness.
Finalize the analysis after solving Given the alias results, verify whether it is correct or not using alias check functions
Print statistics
Dump results
Reimplemented in SVF::CFLAlias, SVF::CFLBase, SVF::CFLVF, SVF::CondPTAImpl< Cond >, SVF::CondPTAImpl< ContextCond >, SVF::Andersen, SVF::ContextDDA, SVF::FlowDDA, SVF::BVDataPTAImpl, SVF::AndersenBase, SVF::FlowSensitive, SVF::TypeAnalysis, and SVF::VersionedFlowSensitive.
Definition at line 177 of file PointerAnalysis.cpp.
Definition at line 301 of file PointerAnalysis.h.
|
inline |
Get all Valid Pointers for resolution.
Definition at line 170 of file PointerAnalysis.h.
|
inline |
Type of pointer analysis.
Definition at line 144 of file PointerAnalysis.h.
Definition at line 289 of file PointerAnalysis.h.
|
inline |
Return call graph.
Definition at line 130 of file PointerAnalysis.h.
|
inline |
Return call graph SCC.
Definition at line 135 of file PointerAnalysis.h.
Get SCC rep node of a SVFG node.
Definition at line 359 of file PointerAnalysis.h.
|
inline |
Definition at line 293 of file PointerAnalysis.h.
|
inlineprotected |
Return function pointer PAGNode at a callsite cs.
Definition at line 234 of file PointerAnalysis.h.
Definition at line 297 of file PointerAnalysis.h.
|
inline |
|
inline |
Return implementation type of the pointer analysis.
Definition at line 150 of file PointerAnalysis.h.
|
inline |
Get callees from an indirect callsite.
Definition at line 331 of file PointerAnalysis.h.
|
inline |
Definition at line 339 of file PointerAnalysis.h.
|
inlineprotected |
Return all indirect callsites.
Definition at line 229 of file PointerAnalysis.h.
|
inline |
Return number of resolved indirect call edges.
Definition at line 125 of file PointerAnalysis.h.
|
inline |
Get points-to targets of a pointer. It needs to be implemented in child class.
Implemented in SVF::Andersen, SVF::BVDataPTAImpl, SVF::Steensgaard, SVF::CondPTAImpl< Cond >, and SVF::CondPTAImpl< ContextCond >.
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.
Implemented in SVF::CFLAlias, SVF::BVDataPTAImpl, SVF::CondPTAImpl< Cond >, and SVF::CondPTAImpl< ContextCond >.
|
inline |
| void PointerAnalysis::getVFnsFromCHA | ( | const CallICFGNode * | cs, |
| VFunSet & | vfns | ||
| ) |
Definition at line 422 of file PointerAnalysis.cpp.
| void PointerAnalysis::getVFnsFromPts | ( | const CallICFGNode * | cs, |
| const PointsTo & | target, | ||
| VFunSet & | vfns | ||
| ) |
Definition at line 431 of file PointerAnalysis.cpp.
|
inline |
Definition at line 335 of file PointerAnalysis.h.
|
virtual |
Initialization of a pointer analysis, including building symbol table and SVFIR etc.
Initialization of pointer analysis
initialise pta call graph for every pointer analysis instance
Reimplemented in SVF::CFLAlias, SVF::CFLVF, SVF::Andersen, SVF::AndersenWaveDiff, SVF::AndersenSFR, SVF::ContextDDA, SVF::FlowDDA, SVF::AndersenBase, SVF::FlowSensitive, SVF::TypeAnalysis, and SVF::VersionedFlowSensitive.
Definition at line 106 of file PointerAnalysis.cpp.
|
inline |
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.
Definition at line 364 of file PointerAnalysis.h.
Definition at line 275 of file PointerAnalysis.h.
Definition at line 262 of file PointerAnalysis.h.
Definition at line 310 of file PointerAnalysis.h.
For field-sensitivity
Definition at line 285 of file PointerAnalysis.h.
Definition at line 370 of file PointerAnalysis.h.
Whether a local variable is in function recursions.
Return TRUE if this node is a local variable of recursive function.
Definition at line 134 of file PointerAnalysis.cpp.
Convenience bool wrappers: return true if the two operands may/must/partial alias.
Definition at line 205 of file PointerAnalysis.h.
Definition at line 209 of file PointerAnalysis.h.
| void PointerAnalysis::printIndCSTargets | ( | ) |
Print all indirect callsites
Definition at line 341 of file PointerAnalysis.cpp.
| void PointerAnalysis::printIndCSTargets | ( | const CallICFGNode * | cs, |
| const FunctionSet & | targets | ||
| ) |
Print targets of a function pointer.
Print indirect call targets at an indirect callsite
Definition at line 312 of file PointerAnalysis.cpp.
|
inline |
Whether print statistics.
Definition at line 318 of file PointerAnalysis.h.
Return PTA name.
Reimplemented in SVF::Andersen, SVF::ContextDDA, SVF::FlowDDA, SVF::FlowSensitive, and SVF::VersionedFlowSensitive.
Definition at line 379 of file PointerAnalysis.h.
|
protected |
Reset all object node as field-sensitive.
Reset field sensitivity
Definition at line 151 of file PointerAnalysis.cpp.
|
virtual |
Resolve cpp indirect call edges.
Definition at line 488 of file PointerAnalysis.cpp.
|
virtual |
Resolve indirect call edges.
Resolve indirect calls
discover indirect pointer target
Definition at line 376 of file PointerAnalysis.cpp.
|
inline |
Definition at line 305 of file PointerAnalysis.h.
|
protectedvirtual |
Pointer analysis validator
Definition at line 569 of file PointerAnalysis.cpp.
|
protectedvirtual |
Find the alias check functions annotated in the C files check whether the alias analysis results consistent with the alias check function itself
Definition at line 504 of file PointerAnalysis.cpp.
|
protectedvirtual |
Alias check functions to verify correctness of pointer analysis.
Validate test cases
Definition at line 215 of file PointerAnalysis.cpp.
|
protected |
Flag for validating points-to/alias results.
Definition at line 96 of file PointerAnalysis.h.
|
static |
Definition at line 80 of file PointerAnalysis.h.
|
static |
Definition at line 81 of file PointerAnalysis.h.
|
static |
Definition at line 82 of file PointerAnalysis.h.
|
static |
Definition at line 83 of file PointerAnalysis.h.
|
static |
Definition at line 72 of file PointerAnalysis.h.
|
static |
Definition at line 73 of file PointerAnalysis.h.
|
static |
Definition at line 78 of file PointerAnalysis.h.
|
static |
Definition at line 79 of file PointerAnalysis.h.
|
static |
Definition at line 74 of file PointerAnalysis.h.
|
static |
Definition at line 75 of file PointerAnalysis.h.
|
static |
Definition at line 76 of file PointerAnalysis.h.
|
static |
Definition at line 77 of file PointerAnalysis.h.
|
protected |
Call graph used for pointer analysis.
Definition at line 110 of file PointerAnalysis.h.
|
protected |
SCC for PTACallGraph.
Definition at line 112 of file PointerAnalysis.h.
|
protected |
Definition at line 116 of file PointerAnalysis.h.
|
protected |
Interprocedural control-flow graph.
Definition at line 114 of file PointerAnalysis.h.
|
protected |
Flag for iteration budget for on-the-fly statistics.
Definition at line 98 of file PointerAnalysis.h.
Definition at line 102 of file PointerAnalysis.h.
|
protected |
User input flags.
Flag for printing the statistic results
Definition at line 94 of file PointerAnalysis.h.
|
protected |
PTA implementation type.
Definition at line 106 of file PointerAnalysis.h.
|
protected |
Pointer analysis Type.
Definition at line 104 of file PointerAnalysis.h.
|
protected |
Statistics.
Definition at line 108 of file PointerAnalysis.h.