30#ifndef POINTERANALYSIS_H_
31#define POINTERANALYSIS_H_
313 assert(mem &&
"memory object is null??");
322 return (SVFUtil::isa<BaseObjVar>(
pag->
getGNode(
id)));
416 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
const FunctionSet & getIndCSCallees(const CallICFGNode *cs) const
CallEdgeMap & getIndCallMap()
Get callees from an indirect callsite.
bool hasIndCSCallees(const CallICFGNode *cs) const
PTACallGraphNode * getCallGraphNode(NodeID id) const
Get call graph node.
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.
virtual const PointsTo & getPts(NodeID ptr)=0
Get points-to targets of a pointer. It needs to be implemented in child class.
CommonCHGraph * getCHGraph() const
get CHGraph
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.
CommonCHGraph * chgraph
CHGraph.
static const std::string aliasTestNoAliasMangled
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
static const std::string aliasTestFailNoAlias
virtual void dumpPts(NodeID ptr, const PointsTo &pts)
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.
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.
PTAStat * stat
Statistics.
virtual void dumpTopLevelPtsTo()
static const std::string aliasTestFailMayAliasMangled
NodeID getFIObjVar(NodeID id)
void connectVCallToVFns(const CallICFGNode *cs, const VFunSet &vfns, CallEdgeMap &newEdges)
OrderedNodeSet & getAllValidPtrs()
Get all Valid Pointers for resolution.
void resetObjFieldSensitive()
Reset all object node as field-sensitive.
static const std::string aliasTestMustAlias
static const std::string aliasTestMayAlias
virtual void validateSuccessTests(std::string fun)
SVFModule * svfMod
Module.
const CallSiteToFunPtrMap & getIndirectCallsites() const
Return all indirect callsites.
static const std::string aliasTestPartialAlias
virtual void dumpAllPts()
const FunctionSet & getIndCSCallees(const CallICFGNode *cs) const
bool isArrayMemObj(NodeID id) const
virtual void resolveIndCalls(const CallICFGNode *cs, const PointsTo &target, CallEdgeMap &newEdges)
Resolve indirect call edges.
ICFG * getICFG() const
Get ICFG.
PTACallGraph * getCallGraph() const
Return call graph.
ICFG * icfg
Interprocedural control-flow graph.
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)
virtual const NodeSet & getRevPts(NodeID nodeId)=0
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.
CallEdgeMap & getIndCallMap()
Get callees from an indirect callsite.
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)
PTAStat * getStat() const
Get PTA stat.
static const std::string aliasTestPartialAliasMangled
PTACallGraph * callgraph
Call graph used for pointer analysis.
u32_t getNumOfResolvedIndCallEdge() const
Return number of resolved indirect call edges.
SVFIR::CallSiteToFunPtrMap CallSiteToFunPtrMap
NodeID getFunPtr(const CallICFGNode *cs) const
Return function pointer PAGNode at a callsite cs.
SVFModule * getModule() const
Module.
void getVFnsFromCHA(const CallICFGNode *cs, VFunSet &vfns)
PTATY ptaTy
Pointer analysis Type.
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.
CallGraphSCC * callGraphSCC
SCC for PTACallGraph.
CallGraphSCC * getCallGraphSCC() const
Return call graph SCC.
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.
virtual const NodeBS & getAllFieldsObjVars(NodeID id)
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.
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.
OrderedMap< const CallICFGNode *, NodeID > CallSiteToFunPtrMap
OrderedNodeSet & getAllValidPtrs()
Return valid pointers.
const BaseObjVar * getBaseObject(NodeID id) const
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.
const MemObj * getBaseObj(NodeID id) const
const CallSiteToFunPtrMap & getIndirectCallsites() const
Add/get indirect callsites.
const MemObj * getObject(NodeID id) const
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.
OrderedSet< NodeID > OrderedNodeSet
llvm::IRBuilder IRBuilder
Set< const SVFFunction * > VFunSet