32 using namespace SVFUtil;
41 for(CallSiteToFunPtrMap::const_iterator iter = callsites.begin(), eiter = callsites.end(); iter!=eiter; ++iter)
49 assert(vtbl !=
nullptr);
51 resolveCPPIndCalls(cs, getCFLPts(vtblId), newEdges);
54 resolveIndCalls(iter->first,getCFLPts(iter->second),newEdges);
73 heapAllocatorViaIndCall(cs);
76 if (svfir->funHasRet(
F) && svfir->callsiteHasRet(retBlockNode))
78 const PAGNode* cs_return = svfir->getCallSiteRet(retBlockNode);
79 const PAGNode* fun_return = svfir->getFunRet(
F);
84 addCopyEdge(srcret, dstrec);
92 if (svfir->hasCallSiteArgsMap(callBlockNode) && svfir->hasFunArgsList(
F))
100 SVFIR::SVFVarList::const_iterator funArgIt = funArgList.begin(), funArgEit = funArgList.end();
101 SVFIR::SVFVarList::const_iterator csArgIt = csArgList.begin(), csArgEit = csArgList.end();
102 for (; funArgIt != funArgEit; ++csArgIt, ++funArgIt)
105 if (csArgIt == csArgEit)
110 const PAGNode *cs_arg = *csArgIt ;
111 const PAGNode *fun_arg = *funArgIt;
118 addCopyEdge(srcAA, dstFA);
125 NodeID vaF = svfir->getVarargNode(
F);
127 for (; csArgIt != csArgEit; ++csArgIt)
129 const PAGNode *cs_arg = *csArgIt;
133 addCopyEdge(vnAA,vaF);
137 if(csArgIt != csArgEit)
149 const PAGNode* cs_return = svfir->getCallSiteRet(retBlockNode);
151 CallSite2DummyValPN::const_iterator it = callsite2DummyValPN.find(cs);
152 if(it != callsite2DummyValPN.end())
158 NodeID valNode = svfir->addDummyValNode();
160 callsite2DummyValPN.insert(std::make_pair(cs,valNode));
161 graph->addCFLNode(valNode,
new CFLNode(valNode));
162 graph->addCFLNode(objNode,
new CFLNode(objNode));
167 addCopyEdge(srcret, dstrec);
176 onTheFlyCallGraphSolve(callsites,newEdges);
177 for(CallEdgeMap::iterator it = newEdges.begin(), eit = newEdges.end(); it!=eit; ++it )
179 for(FunctionSet::iterator cit = it->second.begin(), ecit = it->second.end(); cit!=ecit; ++cit)
181 connectCaller2CalleeParams(it->first,*cit);
185 return (!solver->isWorklistEmpty());
202 normalizeCFLGrammar();
215 numOfChecks = solver->numOfChecks;
221 grammar->dump(
"Grammar");
222 graph->dump(
"CFLGraph");
231 double start = stat->getClk(
true);
236 while (updateCallGraph(svfir->getIndirectCallsites()))
243 double end = stat->getClk(
true);
#define DBOUT(TYPE, X)
LLVM debug macros, define type of your DBUG model of each pass.
virtual void finalize()
Print grammar and graph.
virtual void onTheFlyCallGraphSolve(const CallSiteToFunPtrMap &callsites, CallEdgeMap &newEdges)
On the fly call graph construction.
virtual void initializeSolver()
Initialize Solver.
void connectCaller2CalleeParams(const CallICFGNode *cs, const SVFFunction *F)
Connect formal and actual parameters for indirect callsites.
void heapAllocatorViaIndCall(const CallICFGNode *cs)
virtual void solve()
Solving CFL Reachability.
virtual bool updateCallGraph(const CallSiteToFunPtrMap &callsites)
Update call graph for the input indirect callsites.
virtual void initialize()
Initialize the grammar, graph, solver.
const SVFFunction * getCalledFunction() const
const std::string toString() const override
const SVFVar * getVtablePtr() const
const std::string getSourceLoc() const override
bool isVirtualCall() const
const RetICFGNode * getRetICFGNode() const
Return callsite.
static const Option< std::string > CFLGraph
static const Option< bool > PrintCFL
virtual void initializeSolver()
Initialize POCR Solver.
Solver Utilize Hybrid Representation of Graph.
virtual void initializeSolver()
Initialize POCRHybrid Solver.
virtual void finalize()
Finalization of a pointer analysis, including checking alias correctness.
OrderedMap< const CallICFGNode *, FunctionSet > CallEdgeMap
SVFIR::CallSiteToFunPtrMap CallSiteToFunPtrMap
virtual const SVFType * getType() const
NodeID getId() const
Get ID.
std::vector< const SVFVar * > SVFVarList
virtual bool isPointer() const
Whether it is a pointer.
virtual const std::string toString() const
bool isHeapAllocExtFunViaRet(const SVFFunction *fun)
Return true if the call is a heap allocator/reallocator.
void writeWrnMsg(const std::string &msg)
Writes a message run through wrnMsg.
std::ostream & outs()
Overwrite llvm::outs()