30#ifndef POINTERANALYSIS_H_
31#define POINTERANALYSIS_H_
114 return pag->getICFG();
164 return pag->getAllValidPtrs();
227 return pag->getIndirectCallsites();
232 return pag->getFunPtr(cs);
252 return pts.
test(
pag->getBlackHoleNode());
256 return pts.
test(
pag->getConstantNode());
260 return pag->isBlkObjOrConstantObj(ptd);
274 assert(obj &&
"base object is null??");
287 return pag->getBaseObjVarID(
id);
291 return pag->getFIObjVar(
id);
295 return pag->getGepObjVar(
id, ap);
299 return pag->getAllFieldsObjVars(
id);
377 return "Pointer Analysis";
void setFieldInsensitive()
Set the memory object to be field insensitive.
bool isFieldInsensitive() const
Return true if its field limit is 0.
bool hasIndCSCallees(const CallICFGNode *cs) const
u32_t getNumOfResolvedIndCallEdge() const
const FunctionSet & getIndCSCallees(const CallICFGNode *cs) const
CallEdgeMap & getIndCallMap()
Get callees from an indirect callsite.
Common base for class hierarchy graph. Only implements what PointerAnalysis needs.
OrderedMap< const CallICFGNode *, NodeID > CallSiteToFunPtrMap
virtual NodeBS getMayAliases(NodeID 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
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
Set< const GlobalObjVar * > VTableSet
virtual void initialize()
Initialization of a pointer analysis, including building symbol table and PAG 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.
PTAImplTy ptaImplTy
PTA implementation type.
PTAStat * stat
Statistics.
virtual void dumpTopLevelPtsTo()
static const std::string aliasTestFailMayAliasMangled
NodeID getBaseObjVarID(NodeID id)
NodeID getFIObjVar(NodeID id)
void connectVCallToVFns(const CallICFGNode *cs, const VFunSet &vfns, CallEdgeMap &newEdges)
bool mayAlias(const SVFVar *V1, const SVFVar *V2)
Convenience bool wrappers: return true if the two operands may/must/partial alias.
CallGraph * getCallGraph() const
Return call graph.
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
Set< const FunObjVar * > FunctionSet
virtual void validateSuccessTests(std::string fun)
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 AliasResult alias(const SVFVar *V1, const SVFVar *V2)=0
Interface exposed to users of our pointer analysis, given Value infos.
virtual void resolveIndCalls(const CallICFGNode *cs, const PointsTo &target, CallEdgeMap &newEdges)
Resolve indirect call edges.
ICFG * getICFG() const
Get ICFG.
ICFG * icfg
Interprocedural control-flow graph.
CallGraph * callgraph
Call graph used for pointer analysis.
bool inSameCallGraphSCC(const FunObjVar *fun1, const FunObjVar *fun2)
Return TRUE if this edge is inside a PTACallGraph SCC, i.e., src node and dst node are in the same SC...
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.
CallEdgeMap & getIndCallMap()
Get callees from an indirect callsite.
PTAImplTy getImplTy() const
Return implementation type of the pointer analysis.
PTATY getAnalysisTy() const
Type of pointer analysis.
static const std::string aliasTestNoAlias
void setObjFieldInsensitive(NodeID id)
SCCDetection< CallGraph * > CallGraphSCC
PTAStat * getStat() const
Get PTA stat.
static const std::string aliasTestPartialAliasMangled
bool mayAlias(NodeID node1, NodeID node2)
u32_t getNumOfResolvedIndCallEdge() const
Return number of resolved indirect call edges.
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.
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 isInRecursion(const FunObjVar *fun) const
bool isHeapMemObj(NodeID id) const
Whether this object is heap or array.
PointerAnalysis(PAG *pag, PTATY ty=PTATY::Default_PTA, bool alias_check=true)
Constructor.
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.
Set< const FunObjVar * > VFunSet
bool isFIObjNode(NodeID id) const
bool containConstantNode(const PointsTo &pts)
PAG::CallSiteToFunPtrMap CallSiteToFunPtrMap
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 getId() const
Get ID.
LLVM_NODISCARD bool isa(const Y &Val)
std::map< Key, Value, Compare, Allocator > OrderedMap
PTAImplTy
Implementation type: BVDataPTAImpl or CondPTAImpl.
PTATY
Pointer analysis type list.
@ Default_PTA
default pta without any analysis
OrderedSet< NodeID > OrderedNodeSet
std::unordered_set< Key, Hash, KeyEqual, Allocator > Set
Set< const FunObjVar * > VFunSet