Static Value-Flow Analysis
Loading...
Searching...
No Matches
TCT.h
Go to the documentation of this file.
1//===- TCT.h -- Thread creation tree-------------//
2//
3// SVF: Static Value-Flow Analysis
4//
5// Copyright (C) <2013-> <Yulei Sui>
6//
7
8// This program is free software: you can redistribute it and/or modify
9// it under the terms of the GNU Affero General Public License as published by
10// the Free Software Foundation, either version 3 of the License, or
11// (at your option) any later version.
12
13// This program is distributed in the hope that it will be useful,
14// but WITHOUT ANY WARRANTY; without even the implied warranty of
15// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16// GNU Affero General Public License for more details.
17
18// You should have received a copy of the GNU Affero General Public License
19// along with this program. If not, see <http://www.gnu.org/licenses/>.
20//
21//===----------------------------------------------------------------------===//
22
23/*
24 * TCT.h
25 *
26 * Created on: Jun 24, 2015
27 * Author: Yulei Sui, Peng Di
28 */
29
30#ifndef TCTNodeDetector_H_
31#define TCTNodeDetector_H_
32
33#include <vector>
34
36#include "Graphs/SCC.h"
38#include "Util/CxtStmt.h"
39#include "Util/GeneralType.h"
40#include "Util/SVFUtil.h"
41
42namespace SVF
43{
44
45class TCTNode;
46
47/*
48 * Thread creation edge represents a spawning relation between two context sensitive threads
49 */
52{
53public:
54 enum CEDGEK
55 {
57 };
60 GenericTCTEdgeTy(s, d, kind)
61 {
62 }
64 virtual ~TCTEdge()
65 {
66 }
68
69 static inline bool classof(const TCTEdge*)
70 {
71 return true;
72 }
73 static inline bool classof(const GenericTCTEdgeTy *edge)
74 {
75 return edge->getEdgeKind() == TCTEdge::ThreadCreateEdge;
76 }
79
80};
81
82/*
83 * Each node represents a context-sensitive thread
84 */
87{
88
89public:
95
96 void dump()
97 {
98 SVFUtil::outs() << "---\ntid: " << this->getId() << " inloop:" << ctx.isInloop() << " incycle:" << ctx.isIncycle() << " multiforked:"<< isMultiforked();
99 }
100
102 inline const CxtThread& getCxtThread() const
103 {
104 return ctx;
105 }
106
108
109 inline bool isInloop() const
110 {
111 return ctx.isInloop();
112 }
113 inline bool isIncycle() const
114 {
115 return ctx.isIncycle();
116 }
117 inline void setMultiforked(bool value)
118 {
119 multiforked = value;
120 }
121 inline bool isMultiforked() const
122 {
123 return multiforked;
124 }
126
128
129 static inline bool classof(const TCTNode *)
130 {
131 return true;
132 }
133
134 static inline bool classof(const GenericTCTNodeTy *node)
135 {
136 return node->getNodeKind() == TCTNodeKd;
137 }
138 static inline bool classof(const SVFValue*node)
139 {
140 return node->getNodeKind() == TCTNodeKd;
141 }
143
144
145protected:
148};
149
155{
156
157public:
160 typedef ThreadCreateEdgeSet::iterator TCTNodeIter;
164 {
165 bool operator()(const FunObjVar* lhs, const FunObjVar* rhs) const
166 {
167 if (lhs == nullptr || rhs == nullptr)
168 return lhs == nullptr && rhs != nullptr;
169 return lhs->getId() < rhs->getId();
170 }
171 };
173 typedef std::vector<const ICFGNode*> InstVec;
185
188
190 virtual ~TCT();
191
194 {
195 return tcg;
196 }
198 inline PointerAnalysis* getPTA() const
199 {
200 return pta;
201 }
203 inline TCTNode* getTCTNode(NodeID id) const
204 {
205 return getGNode(id);
206 }
208 TCTEdge* hasGraphEdge(TCTNode* src, TCTNode* dst, TCTEdge::CEDGEK kind) const;
211
213
214 inline ThreadCreateEdgeSet::const_iterator getChildrenBegin(const TCTNode* node) const
215 {
216 return node->OutEdgeBegin();
217 }
218 inline ThreadCreateEdgeSet::const_iterator getChildrenEnd(const TCTNode* node) const
219 {
220 return node->OutEdgeEnd();
221 }
222 inline ThreadCreateEdgeSet::const_iterator getParentsBegin(const TCTNode* node) const
223 {
224 return node->InEdgeBegin();
225 }
226 inline ThreadCreateEdgeSet::const_iterator getParentsEnd(const TCTNode* node) const
227 {
228 return node->InEdgeEnd();
229 }
231
233 inline const FunSet& getMakredProcs() const
234 {
235 return candidateFuncSet;
236 }
237
239 inline const FunSet& getEntryProcs() const
240 {
241 return entryFuncSet;
242 }
243
245
246 inline u32_t getTCTNodeNum() const
247 {
248 return TCTNodeNum;
249 }
250 inline u32_t getTCTEdgeNum() const
251 {
252 return TCTEdgeNum;
253 }
254 inline u32_t getMaxCxtSize() const
255 {
256 return MaxCxtSize;
257 }
259
261 inline bool isExtCall(const ICFGNode* inst)
262 {
263 if(const CallICFGNode* call = SVFUtil::dyn_cast<CallICFGNode>(inst))
264 return SVFUtil::isExtCall(call);
265 return false;
266 }
268 inline bool isCallSite(const ICFGNode* inst)
269 {
270 return SVFUtil::isa<CallICFGNode>(inst);
271 }
272
274
275 inline bool hasTCTNode(const CxtThread& ct) const
276 {
277 return ctpToNodeMap.find(ct)!=ctpToNodeMap.end();
278 }
279 inline TCTNode* getTCTNode(const CxtThread& ct) const
280 {
281 CxtThreadToNodeMap::const_iterator it = ctpToNodeMap.find(ct);
282 assert(it!=ctpToNodeMap.end() && "TCT node not found??");
283 return it->second;
284 }
286
289 {
290 for(CallGraph::FunctionSet::const_iterator cit = callees.begin(),
291 ecit = callees.end(); cit!=ecit; cit++)
292 {
293 if(candidateFuncSet.find((*cit))!=candidateFuncSet.end())
294 return true;
295 }
296 return false;
297 }
298 inline bool isCandidateFun(const FunObjVar* fun) const
299 {
300 return candidateFuncSet.find(fun)!=candidateFuncSet.end();
301 }
303 inline bool inSameCallGraphSCC(const CallGraphNode* src,const CallGraphNode* dst)
304 {
305 return (tcgSCC->repNode(src->getId()) == tcgSCC->repNode(dst->getId()));
306 }
307
309
310
311 inline bool hasParentThread(NodeID tid) const
312 {
313 const TCTNode* node = getTCTNode(tid);
314 return node->getInEdges().size()==1;
315 }
318 {
320 const TCTNode* node = getTCTNode(tid);
321 assert(node->getInEdges().size()>=1 && "does not have a parent thread");
322
323 for (const TCTEdge* edge : node->getInEdges())
324 {
325 parentTds.set(edge->getSrcID());
326 }
327 return parentTds;
328 }
331 {
332 NodeBS tds;
333 if(hasParentThread(tid) == false)
334 return tds;
335
336 FIFOWorkList<NodeID> worklist;
338 worklist.push(parentTid);
339
340 while(!worklist.empty())
341 {
342 NodeID t = worklist.pop();
343 if(tds.test_and_set(t))
344 {
345 if(hasParentThread(t))
347 worklist.push(parentTid);
348 }
349 }
350 return tds;
351 }
353 inline const NodeBS getSiblingThread(NodeID tid) const
354 {
355 NodeBS tds;
356 if(hasParentThread(tid) == false)
357 return tds;
359 {
361 for(ThreadCreateEdgeSet::const_iterator it = getChildrenBegin(parentNode),
362 eit = getChildrenEnd(parentNode); it!=eit; ++it)
363 {
364 NodeID child = (*it)->getDstNode()->getId();
365 if(child!=tid)
366 tds.set(child);
367 }
368 }
369 return tds;
370 }
372
375 {
376 CxtThreadToForkCxtSet::const_iterator it = ctToForkCxtsMap.find(ct);
377 assert(it!=ctToForkCxtsMap.end() && "Cxt Thread not found!!");
378 return it->second;
379 }
380
383 {
384 CxtThreadToFun::const_iterator it = ctToRoutineFunMap.find(ct);
385 assert(it!=ctToRoutineFunMap.end() && "Cxt Thread not found!!");
386 return it->second;
387 }
388
391 {
392 assert(tcg->getThreadAPI()->isTDJoin(join) && "not a join site");
393 InstToLoopMap::iterator it = joinSiteToLoopMap.find(join);
394 assert(it!=joinSiteToLoopMap.end() && "loop not found");
395 return it->second;
396 }
397
398 inline bool hasJoinLoop(const CallICFGNode* join) const
399 {
400 assert(tcg->getThreadAPI()->isTDJoin(join) && "not a join site");
401 InstToLoopMap::const_iterator it = joinSiteToLoopMap.find(join);
402 return it!=joinSiteToLoopMap.end();
403 }
404
405 bool hasLoop(const SVFBasicBlock* bb) const
406 {
407 const FunObjVar* fun = bb->getFunction();
408 return fun->hasLoopInfo(bb);
409 }
410 bool hasLoop(const ICFGNode* inst) const
411 {
412 return hasLoop(inst->getBB());
413 }
415 bool isJoinMustExecutedInLoop(const LoopBBs& lp,const ICFGNode* join);
417 const LoopBBs& getLoop(const ICFGNode* inst);
419 const LoopBBs& getLoop(const SVFBasicBlock* bb);
420
422
423
424 virtual void pushCxt(CallStrCxt& cxt, const CallICFGNode* call, const FunObjVar* callee);
426 bool matchAndPopCxt(CallStrCxt& cxt, const CallICFGNode* call, const FunObjVar* callee);
428 bool isContextSuffix(const CallStrCxt& lhs, const CallStrCxt& call);
430
432 inline bool isJoinSiteInRecursion(const CallICFGNode* join) const
433 {
434 assert(tcg->getThreadAPI()->isTDJoin(join) && "not a join site");
435 return inRecurJoinSites.find(join)!=inRecurJoinSites.end();
436 }
438 void dumpCxt(CallStrCxt& cxt);
439
441 void dump(const std::string& filename);
442
444 void print() const;
445
446protected:
452
455 {
456 assert(ctpToNodeMap.find(ct)==ctpToNodeMap.end() && "Already has this node!!");
457 NodeID id = TCTNodeNum;
458 TCTNode* node = new TCTNode(id, ct);
459 addGNode(id, node);
460 TCTNodeNum++;
461 ctpToNodeMap[ct] = node;
462 return node;
463 }
465 inline bool addTCTEdge(TCTNode* src, TCTNode* dst)
466 {
468 {
470 dst->addIncomingEdge(edge);
471 src->addOutgoingEdge(edge);
472 TCTEdgeNum++;
473 return true;
474 }
475 return false;
476 }
477
479 virtual void build();
480
483 void reset()
484 {
485 destroy();
486 IDToNodeMap.clear();
487 ctpToNodeMap.clear();
488 ctToForkCxtsMap.clear();
489 ctToRoutineFunMap.clear();
490 candidateFuncSet.clear();
491 entryFuncSet.clear();
492 joinSiteToLoopMap.clear();
493 inRecurJoinSites.clear();
494 ctpList.clear();
495 visitedCTPs.clear();
496 TCTNodeNum = 0;
497 TCTEdgeNum = 0;
498 MaxCxtSize = 0;
499 }
500
502
503 virtual void markRelProcs();
504 virtual void markRelProcs(const FunObjVar* fun);
506
508 virtual void collectEntryFunInCallGraph();
509
513
515
516
517 virtual void collectLoopInfoForJoin();
521 bool isLoopExitOfJoinLoop(const SVFBasicBlock* bb);
523
525
526
527 bool isInLoopInstruction(const ICFGNode* inst);
529 bool isInRecursion(const ICFGNode* inst) const;
531
533 virtual void handleCallRelation(CxtThreadProc& ctp, const CallGraphEdge* cgEdge, const CallICFGNode* call);
534
536
538 {
539 CxtThread ct(cxt,fork);
540 CxtThreadToNodeMap::const_iterator it = ctpToNodeMap.find(ct);
541 if(it!=ctpToNodeMap.end())
542 {
543 // A second spawn context merged onto this truncated CxtThread: the
544 // node stands for multiple dynamic instances, so mark it multiforked.
545 if (addCxtOfCxtThread(forkSiteCtp.getTid(), forkSiteCtp.getContext(), ct))
546 it->second->setMultiforked(true);
547 return it->second;
548 }
549
550 addCxtOfCxtThread(forkSiteCtp.getTid(), forkSiteCtp.getContext(), ct);
552
554 return addTCTNode(ct);
555 }
557
560 {
566 if(ct.getThread() != nullptr &&
567 dummyForkSites.find(ct.getThread()) == dummyForkSites.end())
568 {
569 const ICFGNode* svfInst = ct.getThread();
570 ct.setInloop(isInLoopInstruction(svfInst));
571 ct.setIncycle(isInRecursion(svfInst));
572 }
574 else
575 {
576 ct.setInloop(false);
577 ct.setIncycle(false);
578 }
579 }
580
584 {
585 return ctToForkCxtsMap[ct].insert(std::make_pair(pTid, cxt)).second;
586 }
587
590 {
591 ctToRoutineFunMap[ct] = fun;
592 }
593
601
603
605 {
606 if(isVisitedCTPs(ctp)==false)
607 {
608 visitedCTPs.insert(ctp);
609 return ctpList.push(ctp);
610 }
611 return false;
612 }
614 {
616 return ctp;
617 }
618 inline bool isVisitedCTPs(const CxtThreadProc& ctp) const
619 {
620 return visitedCTPs.find(ctp)!=visitedCTPs.end();
621 }
623
636};
637
638} // End namespace SVF
639
640namespace SVF
641{
642/* !
643 * GenericGraphTraits specializations for constraint graph so that they can be treated as
644 * graphs by the generic graph algorithms.
645 * Provide graph traits for traversing from a constraint node using standard graph traversals.
646 */
647template<> struct GenericGraphTraits<SVF::TCTNode*> : public GenericGraphTraits<SVF::GenericNode<SVF::TCTNode,SVF::TCTEdge>* >
648{
649};
650
652template<>
653struct GenericGraphTraits<Inverse<SVF::TCTNode *> > : public GenericGraphTraits<Inverse<SVF::GenericNode<SVF::TCTNode,SVF::TCTEdge>* > >
654{
655};
656
657template<> struct GenericGraphTraits<SVF::TCT*> : public GenericGraphTraits<SVF::GenericGraph<SVF::TCTNode,SVF::TCTEdge>* >
658{
660};
661
662} // End namespace llvm
663
664#endif /* TCTNodeDetector_H_ */
cJSON * p
Definition cJSON.cpp:2559
#define false
Definition cJSON.cpp:70
cJSON * child
Definition cJSON.cpp:2723
Set< const FunObjVar * > FunctionSet
Definition CallGraph.h:247
bool isInloop() const
Definition CxtStmt.h:262
bool isIncycle() const
Definition CxtStmt.h:270
bool push(const Data &data)
Definition WorkList.h:180
bool empty() const
Definition WorkList.h:161
bool hasLoopInfo(const SVFBasicBlock *bb) const
void addGNode(NodeID id, NodeType *node)
Add a Node.
IDToNodeMapTy IDToNodeMap
node map
NodeType * getGNode(NodeID id) const
Get a node.
void destroy()
Release memory.
OrderedSet< EdgeType *, typename EdgeType::equalGEdge > GEdgeSetTy
Edge kind.
iterator OutEdgeEnd()
const GEdgeSetTy & getInEdges() const
bool addIncomingEdge(EdgeType *inEdge)
Add incoming and outgoing edges.
iterator OutEdgeBegin()
iterators
iterator InEdgeBegin()
bool addOutgoingEdge(EdgeType *outEdge)
iterator InEdgeEnd()
virtual const SVFBasicBlock * getBB() const
Return the basic block of this ICFGNode.
Definition ICFGNode.h:81
const FunObjVar * getFunction() const
NodeID getId() const
Get ID.
Definition SVFValue.h:158
GNodeK getNodeKind() const
Get node kind.
Definition SVFValue.h:164
static bool classof(const GenericTCTEdgeTy *edge)
Definition TCT.h:73
@ ThreadCreateEdge
Definition TCT.h:56
GenericNode< TCTNode, TCTEdge >::GEdgeSetTy ThreadCreateEdgeSet
Definition TCT.h:78
TCTEdge(TCTNode *s, TCTNode *d, CEDGEK kind)
Constructor.
Definition TCT.h:59
static bool classof(const TCTEdge *)
Classof.
Definition TCT.h:69
virtual ~TCTEdge()
Destructor.
Definition TCT.h:64
const CxtThread & getCxtThread() const
Get thread creation context, <fork site, call string context>
Definition TCT.h:102
void setMultiforked(bool value)
Definition TCT.h:117
bool multiforked
Thread creation context, <fork site, call string context>
Definition TCT.h:147
bool isIncycle() const
Definition TCT.h:113
bool isInloop() const
inloop, incycle attributes
Definition TCT.h:109
void dump()
Definition TCT.h:96
bool isMultiforked() const
Definition TCT.h:121
const CxtThread ctx
Definition TCT.h:146
static bool classof(const TCTNode *)
Methods for support type inquiry through isa, cast, and dyn_cast:
Definition TCT.h:129
static bool classof(const SVFValue *node)
Definition TCT.h:138
static bool classof(const GenericTCTNodeTy *node)
Definition TCT.h:134
TCTNode(NodeID i, const CxtThread &cctx)
Constructor.
Definition TCT.h:91
bool pushToCTPWorkList(const CxtThreadProc &ctp)
WorkList helper functions.
Definition TCT.h:604
const FunSet & getMakredProcs() const
Get marked candidate functions.
Definition TCT.h:233
const NodeBS getAncestorThreads(NodeID tid) const
Get all ancestor threads.
Definition TCT.h:330
bool isInRecursion(const ICFGNode *inst) const
Whether an instruction is in a recursion.
Definition TCT.cpp:113
CxtThreadToForkCxtSet ctToForkCxtsMap
Map a ctp to its graph node.
Definition TCT.h:630
TCTNode * getTCTNode(NodeID id) const
Get TCT node.
Definition TCT.h:203
Set< CxtThreadProc > CxtThreadProcSet
Definition TCT.h:182
CxtThreadToNodeMap ctpToNodeMap
Record all visited ctps.
Definition TCT.h:629
bool isContextSuffix(const CallStrCxt &lhs, const CallStrCxt &call)
If lhs is a suffix of rhs, including equal.
Definition TCT.cpp:521
OrderedSet< const FunObjVar *, FunObjVarIdCmp > FunSet
Definition TCT.h:172
bool isCandidateFun(const FunObjVar *fun) const
Definition TCT.h:298
Set< const ICFGNode * > InstSet
Definition TCT.h:174
void setMultiForkedAttrs(CxtThread &ct)
Set multi-forked thread attributes.
Definition TCT.h:559
FunSet entryFuncSet
Definition TCT.h:624
TCTNode * getOrCreateTCTNode(const CallStrCxt &cxt, const ICFGNode *fork, const CxtThreadProc &forkSiteCtp, const FunObjVar *routine)
Get or create a tct node based on CxtThread.
Definition TCT.h:537
bool isJoinSiteInRecursion(const CallICFGNode *join) const
Whether a join site is in recursion.
Definition TCT.h:432
FIFOWorkList< CxtThreadProc > CxtThreadProcVec
Definition TCT.h:181
virtual void collectLoopInfoForJoin()
Handle join site in loop.
Definition TCT.cpp:340
bool isCallSite(const ICFGNode *inst)
Whether it is a callsite.
Definition TCT.h:268
ThreadCallGraphSCC * tcgSCC
Procedures we care about during call graph traversing when creating TCT.
Definition TCT.h:626
virtual void collectEntryFunInCallGraph()
Get entry functions that are neither called by other functions nor extern functions.
Definition TCT.cpp:209
NodeBS getParentThreads(NodeID tid) const
Get parent threads.
Definition TCT.h:317
CxtThreadToFun ctToRoutineFunMap
Map a CxtThread to the context at its spawning site (fork site).
Definition TCT.h:631
PointerAnalysis * getPTA() const
Get PTA.
Definition TCT.h:198
CxtThreadProcSet visitedCTPs
CxtThreadProc List.
Definition TCT.h:628
bool hasJoinLoop(const CallICFGNode *join) const
Definition TCT.h:398
u32_t getMaxCxtSize() const
Definition TCT.h:254
Set< const CallGraphNode * > PTACGNodeSet
Definition TCT.h:175
ThreadCreateEdgeSet::const_iterator getChildrenBegin(const TCTNode *node) const
Get children and parent nodes.
Definition TCT.h:214
u32_t TCTNodeNum
Definition TCT.h:449
ICFGNode * createDummyForkSite()
Create and get a new dummy fork site for starter routines.
Definition TCT.h:595
Map< CxtThread, const FunObjVar * > CxtThreadToFun
Definition TCT.h:179
ThreadCallGraph * getThreadCallGraph() const
Get TCG.
Definition TCT.h:193
DummyForkSiteSet dummyForkSites
set of dummy fork sites for starter routines
Definition TCT.h:634
bool hasLoop(const ICFGNode *inst) const
Definition TCT.h:410
InstToLoopMap joinSiteToLoopMap
Map a CxtThread to its start routine function.
Definition TCT.h:632
bool hasTCTNode(const CxtThread &ct) const
Find/Get TCT node.
Definition TCT.h:275
ThreadCreateEdgeSet::const_iterator getParentsEnd(const TCTNode *node) const
Definition TCT.h:226
const NodeBS getSiblingThread(NodeID tid) const
Get sibling threads.
Definition TCT.h:353
bool hasParentThread(NodeID tid) const
Get parent and sibling threads.
Definition TCT.h:311
bool isVisitedCTPs(const CxtThreadProc &ctp) const
Definition TCT.h:618
u32_t getTCTEdgeNum() const
Definition TCT.h:250
virtual ~TCT()
Destructor.
Definition TCT.cpp:55
ThreadCreateEdgeSet::iterator TCTNodeIter
Definition TCT.h:160
NodeID dummyForkICFGNodeID
unique ID generator for dummy
Definition TCT.h:635
bool addCxtOfCxtThread(NodeID pTid, const CallStrCxt &cxt, const CxtThread &ct)
Definition TCT.h:583
void dump(const std::string &filename)
Dump the graph.
Definition TCT.cpp:559
FunSet candidateFuncSet
Procedures that are neither called by other functions nor extern functions.
Definition TCT.h:625
void addStartRoutineOfCxtThread(const FunObjVar *fun, const CxtThread &ct)
Add start routine function of a cxt thread.
Definition TCT.h:589
bool inSameCallGraphSCC(const CallGraphNode *src, const CallGraphNode *dst)
Whether two functions in the same callgraph scc.
Definition TCT.h:303
bool hasLoop(const SVFBasicBlock *bb) const
Definition TCT.h:405
TCTEdge * getGraphEdge(TCTNode *src, TCTNode *dst, TCTEdge::CEDGEK kind)
Get call graph edge via nodes.
Definition TCT.cpp:596
TCTEdge::ThreadCreateEdgeSet ThreadCreateEdgeSet
Definition TCT.h:159
TCTNode * addTCTNode(const CxtThread &ct)
Add TCT node.
Definition TCT.h:454
bool isCandidateFun(const CallGraph::FunctionSet &callees) const
Whether it is a candidate function for indirect call.
Definition TCT.h:288
CxtThreadProcVec ctpList
Thread call graph SCC.
Definition TCT.h:627
std::vector< const ICFGNode * > InstVec
Definition TCT.h:173
SCCDetection< CallGraph * > ThreadCallGraphSCC
Definition TCT.h:183
u32_t TCTEdgeNum
Definition TCT.h:450
bool matchAndPopCxt(CallStrCxt &cxt, const CallICFGNode *call, const FunObjVar *callee)
Match context.
Definition TCT.cpp:493
Map< CxtThread, CallStrCxtSet > CxtThreadToForkCxtSet
Definition TCT.h:178
bool isInLoopInstruction(const ICFGNode *inst)
Multi-forked threads.
Definition TCT.cpp:68
bool isJoinMustExecutedInLoop(const LoopBBs &lp, const ICFGNode *join)
Return true if a join instruction must be executed inside a loop.
Definition TCT.cpp:316
virtual void markRelProcs()
Mark relevant procedures that are backward reachable from any fork/join site.
Definition TCT.cpp:155
Set< const ICFGNode * > inRecurJoinSites
Fork or Join sites in recursions.
Definition TCT.h:633
LoopBBs & getJoinLoop(const CallICFGNode *join)
Get loop for join site.
Definition TCT.h:390
PointerAnalysis * pta
Definition TCT.h:448
TCTNode * getTCTNode(const CxtThread &ct) const
Definition TCT.h:279
void dumpCxt(CallStrCxt &cxt)
Dump calling context.
Definition TCT.cpp:541
bool addTCTEdge(TCTNode *src, TCTNode *dst)
Add TCT edge.
Definition TCT.h:465
u32_t MaxCxtSize
Definition TCT.h:451
const FunSet & getEntryProcs() const
Get marked candidate functions.
Definition TCT.h:239
bool isLoopHeaderOfJoinLoop(const SVFBasicBlock *bb)
Whether a given bb is a loop head of a inloop join site.
Definition TCT.cpp:365
virtual void build()
Build TCT.
Definition TCT.cpp:409
void print() const
Print TCT information.
Definition TCT.cpp:567
virtual void handleCallRelation(CxtThreadProc &ctp, const CallGraphEdge *cgEdge, const CallICFGNode *call)
Handle call relations.
Definition TCT.cpp:267
ThreadCallGraph * tcg
Definition TCT.h:447
Map< const ICFGNode *, LoopBBs > InstToLoopMap
Definition TCT.h:180
void collectMultiForkedThreads()
Definition TCT.cpp:229
Set< std::pair< NodeID, CallStrCxt > > CallStrCxtSet
Definition TCT.h:177
CxtThreadProc popFromCTPWorkList()
Definition TCT.h:613
TCTEdge * hasGraphEdge(TCTNode *src, TCTNode *dst, TCTEdge::CEDGEK kind) const
Whether we have already created this call graph edge.
Definition TCT.cpp:579
Set< const ICFGNode * > DummyForkSiteSet
Definition TCT.h:184
bool isLoopExitOfJoinLoop(const SVFBasicBlock *bb)
Whether a given bb is an exit of a inloop join site.
Definition TCT.cpp:379
SVFLoopAndDomInfo::LoopBBs LoopBBs
Definition TCT.h:158
bool isExtCall(const ICFGNode *inst)
Whether it is calling an external function.
Definition TCT.h:261
u32_t getTCTNodeNum() const
Get Statistics.
Definition TCT.h:246
const LoopBBs & getLoop(const ICFGNode *inst)
Get loop for an instruction.
ThreadCreateEdgeSet::const_iterator getChildrenEnd(const TCTNode *node) const
Definition TCT.h:218
void reset()
Definition TCT.h:483
ThreadCreateEdgeSet::const_iterator getParentsBegin(const TCTNode *node) const
Definition TCT.h:222
virtual void pushCxt(CallStrCxt &cxt, const CallICFGNode *call, const FunObjVar *callee)
Context helper functions.
Definition TCT.cpp:473
Map< CxtThread, TCTNode * > CxtThreadToNodeMap
Definition TCT.h:176
const FunObjVar * getStartRoutineOfCxtThread(const CxtThread &ct) const
get the start routine function of a thread
Definition TCT.h:382
const CallStrCxtSet & getCxtOfCxtThread(const CxtThread &ct) const
get the contexts of a thread at its spawning sites (fork sites)
Definition TCT.h:374
bool isTDJoin(const CallICFGNode *inst) const
Return true if this call wait for a worker thread.
ThreadAPI * getThreadAPI() const
Thread API.
bool isExtCall(const FunObjVar *fun)
Definition SVFUtil.cpp:441
std::ostream & outs()
Overwrite llvm::outs()
Definition SVFUtil.h:52
for isBitcode
Definition BasicTypes.h:70
GenericEdge< TCTNode > GenericTCTEdgeTy
Definition TCT.h:50
GenericNode< TCTNode, TCTEdge > GenericTCTNodeTy
Definition TCT.h:85
u32_t NodeID
Definition GeneralType.h:76
GenericGraph< TCTNode, TCTEdge > GenericThreadCreateTreeTy
Definition TCT.h:153
llvm::IRBuilder IRBuilder
Definition BasicTypes.h:76
std::vector< u32_t > CallStrCxt
Definition GeneralType.h:96
unsigned u32_t
Definition GeneralType.h:67
bool operator()(const FunObjVar *lhs, const FunObjVar *rhs) const
Definition TCT.h:165