35 using namespace SVFUtil;
50 for (
NodeID nId : sccCandidates)
51 pushIntoWorklist(nId);
52 sccCandidates.clear();
55 while (!nodeStack.empty())
57 NodeID nodeId = nodeStack.top();
60 if (sccRepNode(nodeId) == nodeId)
62 collapsePWCNode(nodeId);
64 if (isInWorklist(nodeId))
66 pushIntoWorklist(nodeId);
68 double propStart = stat->getClk();
72 double propEnd = stat->getClk();
73 timeOfProcessCopyGep += (propEnd - propStart) /
TIMEINTERVAL;
80 while (!isWorklistEmpty())
82 NodeID nodeId = popFromWorklist();
84 double insertStart = stat->getClk();
87 handleLoadStore(node);
88 double insertEnd = stat->getClk();
89 timeOfProcessLoadStore += (insertEnd - insertStart) /
TIMEINTERVAL;
101 double sccStart = stat->getClk();
102 getSCCDetector()->find(sccCandidates);
103 double sccEnd = stat->getClk();
106 double mergeStart = stat->getClk();
108 double mergeEnd = stat->getClk();
109 timeOfSCCMerges += (mergeEnd - mergeStart)/
TIMEINTERVAL;
113 sccStart = stat->getClk();
115 sccEnd = stat->getClk();
116 timeOfSCCDetection += (sccEnd - sccStart) /
TIMEINTERVAL;
119 return getSCCDetector()->topoNodeStack();
129 NodeSet tmpSccCandidates = sccCandidates;
130 sccCandidates.clear();
131 for (
NodeID candidate : tmpSccCandidates)
132 sccCandidates.insert(sccRepNode(candidate));
133 tmpSccCandidates.clear();
139 getSCCDetector()->find(sccCandidates);
142 setDetectPWC(pwcFlag);
155 else if(isInWorklist(nodeId))
168 for (
NodeID nId : getSCCDetector()->subNodes(repId))
169 pwcNodes.insert(nId);
172 for (
NodeID subId : pwcNodes)
173 if (isInWorklist(subId))
174 tmpWorkList.
push(subId);
176 while (!tmpWorkList.
empty())
179 computeDiffPts(nodeId);
181 if (!getDiffPts(nodeId).empty())
186 bool changed = processCopy(nodeId, edge);
187 if (changed && pwcNodes.find(edge->getDstID()) != pwcNodes.end())
188 tmpWorkList.
push(edge->getDstID());
192 if (
GepCGEdge *gepEdge = SVFUtil::dyn_cast<GepCGEdge>(edge))
194 bool changed = processGep(nodeId, gepEdge);
195 if (changed && pwcNodes.find(edge->getDstID()) != pwcNodes.end())
196 tmpWorkList.
push(edge->getDstID());
210 double insertStart = stat->getClk();
217 getPts(nodeId).end(); piter != epiter; ++piter)
220 if (processLoad(ptd, *it))
230 getPts(nodeId).end(); piter != epiter; ++piter)
233 if (processStore(ptd, *it))
239 double insertEnd = stat->getClk();
240 timeOfProcessLoadStore += (insertEnd - insertStart) /
TIMEINTERVAL;
249 numOfProcessedAddr++;
254 addSccCandidate(dst);
265 addSccCandidate(src);
277 double cgUpdateStart = stat->getClk();
280 onTheFlyCallGraphSolve(callsites,newEdges);
282 for(CallEdgeMap::iterator it = newEdges.begin(), eit = newEdges.end(); it!=eit; ++it )
284 for(FunctionSet::iterator cit = it->second.begin(), ecit = it->second.end(); cit!=ecit; ++cit)
286 connectCaller2CalleeParams(it->first,*cit,cpySrcNodes);
290 double cgUpdateEnd = stat->getClk();
291 timeOfUpdateCallGraph += (cgUpdateEnd - cgUpdateStart) /
TIMEINTERVAL;
293 return (!newEdges.empty());
virtual bool addCopyEdge(NodeID src, NodeID dst)
static AndersenSCD * scdAndersen
virtual bool updateCallGraph(const CallSiteToFunPtrMap &callsites)
virtual void processAddr(const AddrCGEdge *addr)
virtual NodeStack & SCCDetect()
virtual void handleLoadStore(ConstraintNode *node)
virtual void solveWorklist()
virtual void handleCopyGep(ConstraintNode *node)
virtual void processPWC(ConstraintNode *rep)
virtual bool addCopyEdge(NodeID src, NodeID dst)
Add copy edge on constraint graph.
virtual void handleCopyGep(ConstraintNode *node)
const_iterator outgoingLoadsEnd() const
const ConstraintEdge::ConstraintEdgeSetTy & getGepOutEdges() const
const_iterator incomingStoresBegin() const
const_iterator incomingStoresEnd() const
ConstraintEdge::ConstraintEdgeSetTy::const_iterator const_iterator
const ConstraintEdge::ConstraintEdgeSetTy & getCopyOutEdges() const
const_iterator outgoingLoadsBegin() const
bool push(const Data &data)
NodeID getSrcID() const
get methods of the components
static Option< bool > DetectPWC
OrderedMap< const CallICFGNode *, FunctionSet > CallEdgeMap
SVFIR::CallSiteToFunPtrMap CallSiteToFunPtrMap
NodeID getId() const
Get ID.
std::stack< NodeID > NodeStack
Set< NodePair > NodePairSet