30 #ifndef POINTERANALYSIS_H_
31 #define POINTERANALYSIS_H_
308 assert(mem &&
"memory object is null??");
315 assert(mem &&
"memory object is null??");
324 return (SVFUtil::isa<FIObjVar>(
pag->
getGNode(
id)));
418 return "Pointer Analysis";
Common base for class hierarchy graph. Only implements what PointerAnalysis needs.
NodeType * getGNode(NodeID id) const
Get a node.
NodeID getBlackHoleNode() const
NodeID getConstantNode() const
bool isFieldInsensitive() const
Return true if its field limit is 0.
void setFieldInsensitive()
Set the memory object to be field insensitive.
u32_t getNumOfResolvedIndCallEdge() const
bool hasIndCSCallees(const CallICFGNode *cs) const
PTACallGraphNode * getCallGraphNode(NodeID id) const
Get call graph node.
const FunctionSet & getIndCSCallees(const CallICFGNode *cs) const
CallEdgeMap & getIndCallMap()
Get callees from an indirect callsite.
void getVFnsFromPts(const CallICFGNode *cs, const PointsTo &target, VFunSet &vfns)
void destroy()
Release the memory.
virtual void validateTests()
Alias check functions to verify correctness of pointer analysis.
PTATY
Pointer analysis type list.
@ Cxt_DDA
context sensitive DDA
@ CFLFICI_WPA
Flow-, context-, insensitive CFL-reachability-based analysis.
@ VFS_WPA
Versioned sparse flow-sensitive WPA.
@ FSCS_WPA
Flow-, context- sensitive WPA.
@ FSDATAFLOW_WPA
Traditional Dataflow-based flow sensitive WPA.
@ AndersenSCD_WPA
Selective cycle detection andersen-style WPA.
@ Andersen_BASE
Base Andersen PTA.
@ FlowS_DDA
Flow sensitive DDA.
@ Andersen_WPA
Andersen PTA.
@ CFLFSCS_WPA
Flow-, context-, CFL-reachability-based analysis.
@ FieldS_DDA
Field sensitive DDA.
@ AndersenWaveDiff_WPA
Diff wave propagation andersen-style WPA.
@ CSCallString_WPA
Call string based context sensitive WPA.
@ PathS_DDA
Guarded value-flow DDA.
@ TypeCPP_WPA
Type-based analysis for C++.
@ AndersenSFR_WPA
Stride-based field representation.
@ Steensgaard_WPA
Steensgaard PTA.
@ FSSPARSE_WPA
Sparse flow sensitive WPA.
@ Default_PTA
default pta without any analysis
@ CSSummary_WPA
Summary based context sensitive WPA.
@ CFLFSCI_WPA
Flow-insensitive, context-sensitive CFL-reachability-based analysis.
virtual void computeDDAPts(NodeID)
Compute points-to results on-demand, overridden by derived classes.
CallGraphSCC * getCallGraphSCC() const
Return call graph SCC.
CommonCHGraph * chgraph
CHGraph.
static const std::string aliasTestNoAliasMangled
PTAStat * getStat() const
Get PTA stat.
virtual AliasResult alias(NodeID node1, NodeID node2)=0
Interface exposed to users of our pointer analysis, given PAGNodeID.
bool isFieldInsensitive(NodeID id) const
bool isLocalVarInRecursiveFun(NodeID id) const
Whether a local variable is in function recursions.
virtual void finalize()
Finalization of a pointer analysis, including checking alias correctness.
static const std::string aliasTestMayAliasMangled
PointerAnalysis(SVFIR *pag, PTATY ty=Default_PTA, bool alias_check=true)
Constructor.
static const std::string aliasTestFailNoAlias
virtual void dumpPts(NodeID ptr, const PointsTo &pts)
CallEdgeMap & getIndCallMap()
Get callees from an indirect callsite.
static const std::string aliasTestFailMayAlias
bool print_stat
User input flags.
OrderedMap< const CallICFGNode *, FunctionSet > CallEdgeMap
virtual void initialize()
Initialization of a pointer analysis, including building symbol table and SVFIR etc.
virtual bool isBlkObjOrConstantObj(NodeID ptd) const
bool printStat()
Whether print statistics.
virtual ~PointerAnalysis()
Destructor.
virtual const PointsTo & getPts(NodeID ptr)=0
Get points-to targets of a pointer. It needs to be implemented in child class.
Set< const CallICFGNode * > CallSiteSet
Indirect call edges type, map a callsite to a set of callees.
bool containBlackHoleNode(const PointsTo &pts)
Determine whether a points-to contains a black hole or constant node.
Set< const SVFGlobalValue * > VTableSet
PTAImplTy ptaImplTy
PTA implementation type.
virtual const NodeBS & getAllFieldsObjVars(NodeID id)
PTAStat * stat
Statistics.
OrderedNodeSet & getAllValidPtrs()
Get all Valid Pointers for resolution.
virtual void dumpTopLevelPtsTo()
static const std::string aliasTestFailMayAliasMangled
NodeID getFIObjVar(NodeID id)
void connectVCallToVFns(const CallICFGNode *cs, const VFunSet &vfns, CallEdgeMap &newEdges)
void resetObjFieldSensitive()
Reset all object node as field-sensitive.
static const std::string aliasTestMustAlias
static const std::string aliasTestMayAlias
PTACallGraph * getCallGraph() const
Return call graph.
virtual void validateSuccessTests(std::string fun)
SVFModule * svfMod
Module.
static const std::string aliasTestPartialAlias
virtual void dumpAllPts()
bool isArrayMemObj(NodeID id) const
virtual void resolveIndCalls(const CallICFGNode *cs, const PointsTo &target, CallEdgeMap &newEdges)
Resolve indirect call edges.
ICFG * icfg
Interprocedural control-flow graph.
const CallSiteToFunPtrMap & getIndirectCallsites() const
Return all indirect callsites.
NodeID getBaseObjVar(NodeID id)
bool isInRecursion(const SVFFunction *fun) const
Set< const SVFFunction * > VFunSet
bool alias_validation
Flag for validating points-to/alias results.
NodeID getGepObjVar(NodeID id, const APOffset &ap)
void callGraphSCCDetection()
PTACallGraph SCC related methods.
void dumpStat()
Dump the statistics.
virtual void validateExpectedFailureTests(std::string fun)
bool hasIndCSCallees(const CallICFGNode *cs) const
virtual void resolveCPPIndCalls(const CallICFGNode *cs, const PointsTo &target, CallEdgeMap &newEdges)
Resolve cpp indirect call edges.
PTAImplTy
Implementation type: BVDataPTAImpl or CondPTAImpl.
@ BaseImpl
Represents PointerAnalaysis.
@ BVDataImpl
Represents BVDataPTAImpl.
@ CondImpl
Represents CondPTAImpl.
PTAImplTy getImplTy() const
Return implementation type of the pointer analysis.
Set< const SVFFunction * > FunctionSet
PTATY getAnalysisTy() const
Type of pointer analysis.
static const std::string aliasTestNoAlias
SCCDetection< PTACallGraph * > CallGraphSCC
void setObjFieldInsensitive(NodeID id)
static const std::string aliasTestPartialAliasMangled
PTACallGraph * callgraph
Call graph used for pointer analysis.
u32_t getNumOfResolvedIndCallEdge() const
Return number of resolved indirect call edges.
SVFModule * getModule() const
Module.
SVFIR::CallSiteToFunPtrMap CallSiteToFunPtrMap
virtual const NodeSet & getRevPts(NodeID nodeId)=0
NodeID getFunPtr(const CallICFGNode *cs) const
Return function pointer PAGNode at a callsite cs.
void getVFnsFromCHA(const CallICFGNode *cs, VFunSet &vfns)
PTATY ptaTy
Pointer analysis Type.
ICFG * getICFG() const
Get ICFG.
const FunctionSet & getIndCSCallees(const CallICFGNode *cs) const
virtual AliasResult alias(const SVFValue *V1, const SVFValue *V2)=0
Interface exposed to users of our pointer analysis, given Value infos.
virtual void analyze()=0
Start Analysis here (main part of pointer analysis). It needs to be implemented in child class.
CommonCHGraph * getCHGraph() const
get CHGraph
CallGraphSCC * callGraphSCC
SCC for PTACallGraph.
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 SC...
bool isHeapMemObj(NodeID id) const
Whether this object is heap or array.
NodeID getCallGraphSCCRepNode(NodeID id) const
Get SCC rep node of a SVFG node.
static const std::string aliasTestMustAliasMangled
virtual const std::string PTAName() const
Return PTA name.
static const std::string aliasTestFailNoAliasMangled
void disablePrintStat()
Whether print statistics.
bool isFIObjNode(NodeID id) const
bool containConstantNode(const PointsTo &pts)
u32_t OnTheFlyIterBudgetForStat
Flag for iteration budget for on-the-fly statistics.
bool test(u32_t n) const
Returns true if n is in this set.
NodeID repNode(NodeID n) const
get the rep node if not found return itself
bool isInCycle(NodeID n) const
whether the node is in a cycle
NodeID getId() const
Get ID.
NodeID getFunPtr(const CallICFGNode *cs) const
NodeID getFIObjVar(const MemObj *obj) const
Get a field-insensitive obj SVFIR node according to a mem obj.
const CallSiteToFunPtrMap & getIndirectCallsites() const
Add/get indirect callsites.
const MemObj * getObject(NodeID id) const
OrderedMap< const CallICFGNode *, NodeID > CallSiteToFunPtrMap
NodeBS & getAllFieldsObjVars(const MemObj *obj)
Get all fields of an object.
NodeID getBaseObjVar(NodeID id) const
Base and Offset methods for Value and Object node.
OrderedNodeSet & getAllValidPtrs()
Return valid pointers.
bool isBlkObjOrConstantObj(NodeID id) const
NodeID getGepObjVar(const MemObj *obj, const APOffset &ap)
Get a field SVFIR Object node according to base mem obj and offset.
const MemObj * getBaseObj(NodeID id) const
OrderedSet< NodeID > OrderedNodeSet
Set< const SVFFunction * > VFunSet
std::map< Key, Value, Compare, Allocator > OrderedMap
std::unordered_set< Key, Hash, KeyEqual, Allocator > Set