83 for(SVFIR::CallSiteToFunPtrMap::const_iterator it =
pag->getIndirectCallsites().begin(),
84 eit =
pag->getIndirectCallsites().end(); it!=eit; ++it)
86 if (it->first->isVirtualCall())
88 const SVFVar* vtblPtr = it->first->getVtablePtr();
89 assert(vtblPtr !=
nullptr &&
"not a vtable pointer?");
106 u32_t totalCallsites = 0;
107 u32_t morePreciseCallsites = 0;
108 u32_t zeroTargetCallsites = 0;
109 u32_t oneTargetCallsites = 0;
110 u32_t twoTargetCallsites = 0;
111 u32_t moreThanTwoCallsites = 0;
116 NodeID vtptr = nIter->first;
131 if(callees.size() == 0)
132 zeroTargetCallsites++;
133 else if(callees.size() == 1)
134 oneTargetCallsites++;
135 else if(callees.size() == 2)
136 twoTargetCallsites++;
138 moreThanTwoCallsites++;
148 ++morePreciseCallsites;
149 outs() <<
"============more precise callsite =================\n";
150 outs() << (nIter->second)->toString() <<
"\n";
151 outs() << (nIter->second)->getSourceLoc() <<
"\n";
153 outs() <<
"------ander pts or vtable num---(" << anderPts.
count() <<
")--\n";
154 outs() <<
"------DDA vfn num---(" << ander_vfns.size() <<
")--\n";
156 outs() <<
"------DDA pts or vtable num---(" << ddaPts.
count() <<
")--\n";
157 outs() <<
"------DDA vfn num---(" << dda_vfns.size() <<
")--\n";
159 outs() <<
"-------------------------\n";
161 outs() <<
"=================================================\n";
164 outs() <<
"=================================================\n";
166 outs() <<
"Total analyzed virtual callsites: " << totalCallsites <<
"\n";
168 outs() <<
"Precise callsites: " << morePreciseCallsites <<
"\n";
169 outs() <<
"Zero target callsites: " << zeroTargetCallsites <<
"\n";
170 outs() <<
"One target callsites: " << oneTargetCallsites <<
"\n";
171 outs() <<
"Two target callsites: " << twoTargetCallsites <<
"\n";
172 outs() <<
"More than two target callsites: " << moreThanTwoCallsites <<
"\n";
173 outs() <<
"=================================================\n";
182 for (SVFStmt::SVFStmtSetTy::iterator iter = loads.begin(), eiter =
183 loads.end(); iter != eiter; ++iter)
185 PAGNode* loadsrc = (*iter)->getSrcNode();
191 for (SVFStmt::SVFStmtSetTy::iterator iter = stores.begin(), eiter =
192 stores.end(); iter != eiter; ++iter)
194 PAGNode* storedst = (*iter)->getDstNode();
199 for (SVFStmt::SVFStmtSetTy::iterator iter = geps.begin(), eiter =
200 geps.end(); iter != eiter; ++iter)
202 PAGNode* gepsrc = (*iter)->getSrcNode();
219 outs() <<
"\n=================================================\n";
222 outs() <<
"[NodeID:" << node1->
getId() <<
", NodeID:" << node2->
getId() <<
" " << result <<
"]\n";
223 outs() <<
"=================================================\n";
#define DBOUT(TYPE, X)
LLVM debug macros, define type of your DBUG model of each pass.
virtual OrderedNodeSet & collectCandidateQueries(SVFIR *pag)
Only collect function pointers as query candidates.
virtual void performStat(PointerAnalysis *pta)
static AndersenWaveDiff * createAndersenWaveDiff(SVFIR *_pag)
Create an singleton instance directly instead of invoking llvm pass manager.
virtual const PointsTo & getPts(NodeID id)
Operation of points-to set.
bool hasIndCSCallees(const CallICFGNode *cs) const
const FunctionSet & getIndCSCallees(const CallICFGNode *cs) const
CallEdgeMap & getIndCallMap()
Get callees from an indirect callsite.
Set< const FunObjVar * > FunctionSet
void setPAG(SVFIR *g)
Set SVFIR graph.
virtual void answerQueries(PointerAnalysis *pta)
void setCurrentQueryPtr(NodeID ptr)
Set the pointer being queried.
SVFIR * pag
SVFIR graph used by current DDA analysis.
void addCandidate(NodeID id)
OrderedNodeSet candidateQueries
store all candidate pointers to be queried
virtual OrderedNodeSet & collectCandidateQueries(SVFIR *p)
Collect candidate pointers for query.
VTablePtrToCallSiteMap vtableToCallSiteMap
virtual OrderedNodeSet & collectCandidateQueries(SVFIR *p)
Only collect function pointers as query candidates.
virtual void performStat(PointerAnalysis *pta)
void setMemUsageBefore(u32_t vmrss, u32_t vmsize)
void setMemUsageAfter(u32_t vmrss, u32_t vmsize)
void getVFnsFromPts(const CallICFGNode *cs, const PointsTo &target, VFunSet &vfns)
virtual const PointsTo & getPts(NodeID ptr)=0
Get points-to targets of a pointer. It needs to be implemented in child class.
virtual void computeDDAPts(NodeID)
Compute points-to results on-demand, overridden by derived classes.
CallGraph * getCallGraph() const
Return call graph.
virtual AliasResult alias(const SVFVar *V1, const SVFVar *V2)=0
Interface exposed to users of our pointer analysis, given Value infos.
PTAStat * getStat() const
Get PTA stat.
bool empty() const
Returns true if set is empty.
u32_t count() const
Returns number of elements.
bool isValidTopLevelPtr(const SVFVar *node)
const SVFVar * getSVFVar(NodeID id) const
ObjVar/GepObjVar/BaseObjVar.
GenericNode< SVFVar, SVFStmt >::GEdgeSetTy SVFStmtSetTy
NodeID getId() const
Get ID.
const std::string valueOnlyToString() const
bool getMemoryUsageKB(u32_t *vmrss_kb, u32_t *vmsize_kb)
Get memory usage from system file. Return TRUE if succeed.
std::ostream & outs()
Overwrite llvm::outs().
OrderedSet< NodeID > OrderedNodeSet
std::unordered_set< Key, Hash, KeyEqual, Allocator > Set