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 <memory>
34#include <vector>
35
37#include "Graphs/SCC.h"
39#include "Util/CxtStmt.h"
40#include "Util/GeneralType.h"
41#include "Util/SVFUtil.h"
42
43namespace SVF
44{
45
46class TCTNode;
47
48/*
49 * Thread creation edge represents a spawning relation between two context sensitive threads
50 */
53{
54public:
55 enum CEDGEK
56 {
58 };
61 GenericTCTEdgeTy(s, d, kind)
62 {
63 }
65 virtual ~TCTEdge()
66 {
67 }
69
70 static inline bool classof(const TCTEdge*)
71 {
72 return true;
73 }
74 static inline bool classof(const GenericTCTEdgeTy *edge)
75 {
76 return edge->getEdgeKind() == TCTEdge::ThreadCreateEdge;
77 }
80
81};
82
83/*
84 * Each node represents a context-sensitive thread
85 */
88{
89
90public:
96
97 void dump()
98 {
99 SVFUtil::outs() << "---\ntid: " << this->getId() << " inloop:" << ctx.isInloop() << " incycle:" << ctx.isIncycle() << " multiforked:"<< isMultiforked();
100 }
101
103 inline const CxtThread& getCxtThread() const
104 {
105 return ctx;
106 }
107
109
110 inline bool isInloop() const
111 {
112 return ctx.isInloop();
113 }
114 inline bool isIncycle() const
115 {
116 return ctx.isIncycle();
117 }
118 inline void setMultiforked(bool value)
119 {
120 multiforked = value;
121 }
122 inline bool isMultiforked() const
123 {
124 return multiforked;
125 }
127
129
130 static inline bool classof(const TCTNode *)
131 {
132 return true;
133 }
134
135 static inline bool classof(const GenericTCTNodeTy *node)
136 {
137 return node->getNodeKind() == TCTNodeKd;
138 }
139 static inline bool classof(const SVFValue*node)
140 {
141 return node->getNodeKind() == TCTNodeKd;
142 }
144
145
146protected:
149};
150
156{
157
158public:
161 typedef ThreadCreateEdgeSet::iterator TCTNodeIter;
165 {
166 bool operator()(const FunObjVar* lhs, const FunObjVar* rhs) const
167 {
168 if (lhs == nullptr || rhs == nullptr)
169 return lhs == nullptr && rhs != nullptr;
170 return lhs->getId() < rhs->getId();
171 }
172 };
174 typedef std::vector<const ICFGNode*> InstVec;
186
188 static std::unique_ptr<TCT> create(PointerAnalysis* p);
189
193 static std::unique_ptr<TCT> create(PointerAnalysis* p, u32_t contextLimit);
194
196 virtual ~TCT();
197
200 {
201 return tcg;
202 }
204 inline PointerAnalysis* getPTA() const
205 {
206 return pta;
207 }
209 inline TCTNode* getTCTNode(NodeID id) const
210 {
211 return getGNode(id);
212 }
214 TCTEdge* hasGraphEdge(TCTNode* src, TCTNode* dst, TCTEdge::CEDGEK kind) const;
217
219
220 inline ThreadCreateEdgeSet::const_iterator getChildrenBegin(const TCTNode* node) const
221 {
222 return node->OutEdgeBegin();
223 }
224 inline ThreadCreateEdgeSet::const_iterator getChildrenEnd(const TCTNode* node) const
225 {
226 return node->OutEdgeEnd();
227 }
228 inline ThreadCreateEdgeSet::const_iterator getParentsBegin(const TCTNode* node) const
229 {
230 return node->InEdgeBegin();
231 }
232 inline ThreadCreateEdgeSet::const_iterator getParentsEnd(const TCTNode* node) const
233 {
234 return node->InEdgeEnd();
235 }
237
239 inline const FunSet& getMakredProcs() const
240 {
241 return candidateFuncSet;
242 }
243
245 inline const FunSet& getEntryProcs() const
246 {
247 return entryFuncSet;
248 }
249
251
252 inline u32_t getTCTNodeNum() const
253 {
254 return TCTNodeNum;
255 }
256 inline u32_t getTCTEdgeNum() const
257 {
258 return TCTEdgeNum;
259 }
260 inline u32_t getMaxCxtSize() const
261 {
262 return MaxCxtSize;
263 }
265
267 inline bool isExtCall(const ICFGNode* inst)
268 {
269 if(const CallICFGNode* call = SVFUtil::dyn_cast<CallICFGNode>(inst))
270 return SVFUtil::isExtCall(call);
271 return false;
272 }
274 inline bool isCallSite(const ICFGNode* inst)
275 {
276 return SVFUtil::isa<CallICFGNode>(inst);
277 }
278
280
281 inline bool hasTCTNode(const CxtThread& ct) const
282 {
283 return ctpToNodeMap.find(ct)!=ctpToNodeMap.end();
284 }
285 inline TCTNode* getTCTNode(const CxtThread& ct) const
286 {
287 CxtThreadToNodeMap::const_iterator it = ctpToNodeMap.find(ct);
288 assert(it!=ctpToNodeMap.end() && "TCT node not found??");
289 return it->second;
290 }
292
295 {
296 for(CallGraph::FunctionSet::const_iterator cit = callees.begin(),
297 ecit = callees.end(); cit!=ecit; cit++)
298 {
299 if(candidateFuncSet.find((*cit))!=candidateFuncSet.end())
300 return true;
301 }
302 return false;
303 }
304 inline bool isCandidateFun(const FunObjVar* fun) const
305 {
306 return candidateFuncSet.find(fun)!=candidateFuncSet.end();
307 }
309 inline bool inSameCallGraphSCC(const CallGraphNode* src,const CallGraphNode* dst)
310 {
311 return (tcgSCC->repNode(src->getId()) == tcgSCC->repNode(dst->getId()));
312 }
313
315
316
317 inline bool hasParentThread(NodeID tid) const
318 {
319 const TCTNode* node = getTCTNode(tid);
320 return node->getInEdges().size()==1;
321 }
324 {
326 const TCTNode* node = getTCTNode(tid);
327 assert(node->getInEdges().size()>=1 && "does not have a parent thread");
328
329 for (const TCTEdge* edge : node->getInEdges())
330 {
331 parentTds.set(edge->getSrcID());
332 }
333 return parentTds;
334 }
337 {
338 NodeBS tds;
339 if(hasParentThread(tid) == false)
340 return tds;
341
342 FIFOWorkList<NodeID> worklist;
344 worklist.push(parentTid);
345
346 while(!worklist.empty())
347 {
348 NodeID t = worklist.pop();
349 if(tds.test_and_set(t))
350 {
351 if(hasParentThread(t))
353 worklist.push(parentTid);
354 }
355 }
356 return tds;
357 }
359 inline const NodeBS getSiblingThread(NodeID tid) const
360 {
361 NodeBS tds;
362 if(hasParentThread(tid) == false)
363 return tds;
365 {
367 for(ThreadCreateEdgeSet::const_iterator it = getChildrenBegin(parentNode),
368 eit = getChildrenEnd(parentNode); it!=eit; ++it)
369 {
370 NodeID child = (*it)->getDstNode()->getId();
371 if(child!=tid)
372 tds.set(child);
373 }
374 }
375 return tds;
376 }
378
381 {
382 CxtThreadToForkCxtSet::const_iterator it = ctToForkCxtsMap.find(ct);
383 assert(it!=ctToForkCxtsMap.end() && "Cxt Thread not found!!");
384 return it->second;
385 }
386
389 {
390 CxtThreadToFun::const_iterator it = ctToRoutineFunMap.find(ct);
391 assert(it!=ctToRoutineFunMap.end() && "Cxt Thread not found!!");
392 return it->second;
393 }
394
397 {
398 assert(tcg->getThreadAPI()->isTDJoin(join) && "not a join site");
399 InstToLoopMap::iterator it = joinSiteToLoopMap.find(join);
400 assert(it!=joinSiteToLoopMap.end() && "loop not found");
401 return it->second;
402 }
403
404 inline bool hasJoinLoop(const CallICFGNode* join) const
405 {
406 assert(tcg->getThreadAPI()->isTDJoin(join) && "not a join site");
407 InstToLoopMap::const_iterator it = joinSiteToLoopMap.find(join);
408 return it!=joinSiteToLoopMap.end();
409 }
410
411 bool hasLoop(const SVFBasicBlock* bb) const
412 {
413 const FunObjVar* fun = bb->getFunction();
414 return fun->hasLoopInfo(bb);
415 }
416 bool hasLoop(const ICFGNode* inst) const
417 {
418 return hasLoop(inst->getBB());
419 }
421 bool isJoinMustExecutedInLoop(const LoopBBs& lp,const ICFGNode* join);
423 const LoopBBs& getLoop(const ICFGNode* inst);
425 const LoopBBs& getLoop(const SVFBasicBlock* bb);
426
428
429
430 virtual void pushCxt(CallStrCxt& cxt, const CallICFGNode* call, const FunObjVar* callee);
432 bool matchAndPopCxt(CallStrCxt& cxt, const CallICFGNode* call, const FunObjVar* callee);
434 bool isContextSuffix(const CallStrCxt& lhs, const CallStrCxt& call);
436
438 inline bool isJoinSiteInRecursion(const CallICFGNode* join) const
439 {
440 assert(tcg->getThreadAPI()->isTDJoin(join) && "not a join site");
441 return inRecurJoinSites.find(join)!=inRecurJoinSites.end();
442 }
444 void dumpCxt(CallStrCxt& cxt);
445
447 void dump(const std::string& filename);
448
450 void print() const;
451
452protected:
456
463
466 {
467 assert(ctpToNodeMap.find(ct)==ctpToNodeMap.end() && "Already has this node!!");
468 NodeID id = TCTNodeNum;
469 TCTNode* node = new TCTNode(id, ct);
470 addGNode(id, node);
471 TCTNodeNum++;
472 ctpToNodeMap[ct] = node;
473 return node;
474 }
476 inline bool addTCTEdge(TCTNode* src, TCTNode* dst)
477 {
479 {
481 dst->addIncomingEdge(edge);
482 src->addOutgoingEdge(edge);
483 TCTEdgeNum++;
484 return true;
485 }
486 return false;
487 }
488
490 virtual void build();
491
493
494 virtual void markRelProcs();
495 virtual void markRelProcs(const FunObjVar* fun);
497
499 virtual void collectEntryFunInCallGraph();
500
504
506
507
508 virtual void collectLoopInfoForJoin();
512 bool isLoopExitOfJoinLoop(const SVFBasicBlock* bb);
514
516
517
518 bool isInLoopInstruction(const ICFGNode* inst);
520 bool isInRecursion(const ICFGNode* inst) const;
522
524 virtual void handleCallRelation(CxtThreadProc& ctp, const CallGraphEdge* cgEdge, const CallICFGNode* call);
525
527
529 {
530 CxtThread ct(cxt,fork);
531 CxtThreadToNodeMap::const_iterator it = ctpToNodeMap.find(ct);
532 if(it!=ctpToNodeMap.end())
533 {
534 // A second spawn context merged onto this truncated CxtThread: the
535 // node stands for multiple dynamic instances, so mark it multiforked.
536 if (addCxtOfCxtThread(forkSiteCtp.getTid(), forkSiteCtp.getContext(), ct))
537 it->second->setMultiforked(true);
538 return it->second;
539 }
540
541 addCxtOfCxtThread(forkSiteCtp.getTid(), forkSiteCtp.getContext(), ct);
543
545 return addTCTNode(ct);
546 }
548
551 {
557 if(ct.getThread() != nullptr &&
558 dummyForkSites.find(ct.getThread()) == dummyForkSites.end())
559 {
560 const ICFGNode* svfInst = ct.getThread();
561 ct.setInloop(isInLoopInstruction(svfInst));
562 ct.setIncycle(isInRecursion(svfInst));
563 }
565 else
566 {
567 ct.setInloop(false);
568 ct.setIncycle(false);
569 }
570 }
571
575 {
576 return ctToForkCxtsMap[ct].insert(std::make_pair(pTid, cxt)).second;
577 }
578
581 {
582 ctToRoutineFunMap[ct] = fun;
583 }
584
592
594
596 {
597 if(isVisitedCTPs(ctp)==false)
598 {
599 visitedCTPs.insert(ctp);
600 return ctpList.push(ctp);
601 }
602 return false;
603 }
605 {
607 return ctp;
608 }
609 inline bool isVisitedCTPs(const CxtThreadProc& ctp) const
610 {
611 return visitedCTPs.find(ctp)!=visitedCTPs.end();
612 }
614
627};
628
629} // End namespace SVF
630
631namespace SVF
632{
633/* !
634 * GenericGraphTraits specializations for constraint graph so that they can be treated as
635 * graphs by the generic graph algorithms.
636 * Provide graph traits for traversing from a constraint node using standard graph traversals.
637 */
638template<> struct GenericGraphTraits<SVF::TCTNode*> : public GenericGraphTraits<SVF::GenericNode<SVF::TCTNode,SVF::TCTEdge>* >
639{
640};
641
643template<>
644struct GenericGraphTraits<Inverse<SVF::TCTNode *> > : public GenericGraphTraits<Inverse<SVF::GenericNode<SVF::TCTNode,SVF::TCTEdge>* > >
645{
646};
647
648template<> struct GenericGraphTraits<SVF::TCT*> : public GenericGraphTraits<SVF::GenericGraph<SVF::TCTNode,SVF::TCTEdge>* >
649{
651};
652
653} // End namespace llvm
654
655#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.
NodeType * getGNode(NodeID id) const
Get a node.
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:74
@ ThreadCreateEdge
Definition TCT.h:57
GenericNode< TCTNode, TCTEdge >::GEdgeSetTy ThreadCreateEdgeSet
Definition TCT.h:79
TCTEdge(TCTNode *s, TCTNode *d, CEDGEK kind)
Constructor.
Definition TCT.h:60
static bool classof(const TCTEdge *)
Classof.
Definition TCT.h:70
virtual ~TCTEdge()
Destructor.
Definition TCT.h:65
const CxtThread & getCxtThread() const
Get thread creation context, <fork site, call string context>
Definition TCT.h:103
void setMultiforked(bool value)
Definition TCT.h:118
bool multiforked
Thread creation context, <fork site, call string context>
Definition TCT.h:148
bool isIncycle() const
Definition TCT.h:114
bool isInloop() const
inloop, incycle attributes
Definition TCT.h:110
void dump()
Definition TCT.h:97
bool isMultiforked() const
Definition TCT.h:122
const CxtThread ctx
Definition TCT.h:147
static bool classof(const TCTNode *)
Methods for support type inquiry through isa, cast, and dyn_cast:
Definition TCT.h:130
static bool classof(const SVFValue *node)
Definition TCT.h:139
static bool classof(const GenericTCTNodeTy *node)
Definition TCT.h:135
TCTNode(NodeID i, const CxtThread &cctx)
Constructor.
Definition TCT.h:92
bool pushToCTPWorkList(const CxtThreadProc &ctp)
WorkList helper functions.
Definition TCT.h:595
const FunSet & getMakredProcs() const
Get marked candidate functions.
Definition TCT.h:239
const NodeBS getAncestorThreads(NodeID tid) const
Get all ancestor threads.
Definition TCT.h:336
bool isInRecursion(const ICFGNode *inst) const
Whether an instruction is in a recursion.
Definition TCT.cpp:123
CxtThreadToForkCxtSet ctToForkCxtsMap
Map a ctp to its graph node.
Definition TCT.h:621
TCTNode * getTCTNode(NodeID id) const
Get TCT node.
Definition TCT.h:209
Set< CxtThreadProc > CxtThreadProcSet
Definition TCT.h:183
CxtThreadToNodeMap ctpToNodeMap
Record all visited ctps.
Definition TCT.h:620
bool isContextSuffix(const CallStrCxt &lhs, const CallStrCxt &call)
If lhs is a suffix of rhs, including equal.
Definition TCT.cpp:531
OrderedSet< const FunObjVar *, FunObjVarIdCmp > FunSet
Definition TCT.h:173
bool isCandidateFun(const FunObjVar *fun) const
Definition TCT.h:304
Set< const ICFGNode * > InstSet
Definition TCT.h:175
void setMultiForkedAttrs(CxtThread &ct)
Set multi-forked thread attributes.
Definition TCT.h:550
FunSet entryFuncSet
Definition TCT.h:615
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:528
bool isJoinSiteInRecursion(const CallICFGNode *join) const
Whether a join site is in recursion.
Definition TCT.h:438
FIFOWorkList< CxtThreadProc > CxtThreadProcVec
Definition TCT.h:182
virtual void collectLoopInfoForJoin()
Handle join site in loop.
Definition TCT.cpp:350
bool isCallSite(const ICFGNode *inst)
Whether it is a callsite.
Definition TCT.h:274
ThreadCallGraphSCC * tcgSCC
Procedures we care about during call graph traversing when creating TCT.
Definition TCT.h:617
virtual void collectEntryFunInCallGraph()
Get entry functions that are neither called by other functions nor extern functions.
Definition TCT.cpp:219
NodeBS getParentThreads(NodeID tid) const
Get parent threads.
Definition TCT.h:323
CxtThreadToFun ctToRoutineFunMap
Map a CxtThread to the context at its spawning site (fork site).
Definition TCT.h:622
PointerAnalysis * getPTA() const
Get PTA.
Definition TCT.h:204
CxtThreadProcSet visitedCTPs
CxtThreadProc List.
Definition TCT.h:619
bool hasJoinLoop(const CallICFGNode *join) const
Definition TCT.h:404
u32_t getMaxCxtSize() const
Definition TCT.h:260
Set< const CallGraphNode * > PTACGNodeSet
Definition TCT.h:176
ThreadCreateEdgeSet::const_iterator getChildrenBegin(const TCTNode *node) const
Get children and parent nodes.
Definition TCT.h:220
u32_t TCTNodeNum
Definition TCT.h:460
ICFGNode * createDummyForkSite()
Create and get a new dummy fork site for starter routines.
Definition TCT.h:586
Map< CxtThread, const FunObjVar * > CxtThreadToFun
Definition TCT.h:180
static std::unique_ptr< TCT > create(PointerAnalysis *p)
Construct and build a TCT with the command-line context bound.
Definition TCT.cpp:41
ThreadCallGraph * getThreadCallGraph() const
Get TCG.
Definition TCT.h:199
DummyForkSiteSet dummyForkSites
set of dummy fork sites for starter routines
Definition TCT.h:625
bool hasLoop(const ICFGNode *inst) const
Definition TCT.h:416
InstToLoopMap joinSiteToLoopMap
Map a CxtThread to its start routine function.
Definition TCT.h:623
bool hasTCTNode(const CxtThread &ct) const
Find/Get TCT node.
Definition TCT.h:281
ThreadCreateEdgeSet::const_iterator getParentsEnd(const TCTNode *node) const
Definition TCT.h:232
const NodeBS getSiblingThread(NodeID tid) const
Get sibling threads.
Definition TCT.h:359
bool hasParentThread(NodeID tid) const
Get parent and sibling threads.
Definition TCT.h:317
bool isVisitedCTPs(const CxtThreadProc &ctp) const
Definition TCT.h:609
u32_t getTCTEdgeNum() const
Definition TCT.h:256
virtual ~TCT()
Destructor.
Definition TCT.cpp:65
ThreadCreateEdgeSet::iterator TCTNodeIter
Definition TCT.h:161
NodeID dummyForkICFGNodeID
unique ID generator for dummy
Definition TCT.h:626
bool addCxtOfCxtThread(NodeID pTid, const CallStrCxt &cxt, const CxtThread &ct)
Definition TCT.h:574
void dump(const std::string &filename)
Dump the graph.
Definition TCT.cpp:569
FunSet candidateFuncSet
Procedures that are neither called by other functions nor extern functions.
Definition TCT.h:616
void addStartRoutineOfCxtThread(const FunObjVar *fun, const CxtThread &ct)
Add start routine function of a cxt thread.
Definition TCT.h:580
bool inSameCallGraphSCC(const CallGraphNode *src, const CallGraphNode *dst)
Whether two functions in the same callgraph scc.
Definition TCT.h:309
bool hasLoop(const SVFBasicBlock *bb) const
Definition TCT.h:411
TCTEdge * getGraphEdge(TCTNode *src, TCTNode *dst, TCTEdge::CEDGEK kind)
Get call graph edge via nodes.
Definition TCT.cpp:606
TCTEdge::ThreadCreateEdgeSet ThreadCreateEdgeSet
Definition TCT.h:160
TCTNode * addTCTNode(const CxtThread &ct)
Add TCT node.
Definition TCT.h:465
bool isCandidateFun(const CallGraph::FunctionSet &callees) const
Whether it is a candidate function for indirect call.
Definition TCT.h:294
CxtThreadProcVec ctpList
Thread call graph SCC.
Definition TCT.h:618
std::vector< const ICFGNode * > InstVec
Definition TCT.h:174
SCCDetection< CallGraph * > ThreadCallGraphSCC
Definition TCT.h:184
const u32_t contextLimit
Definition TCT.h:459
u32_t TCTEdgeNum
Definition TCT.h:461
bool matchAndPopCxt(CallStrCxt &cxt, const CallICFGNode *call, const FunObjVar *callee)
Match context.
Definition TCT.cpp:503
Map< CxtThread, CallStrCxtSet > CxtThreadToForkCxtSet
Definition TCT.h:179
bool isInLoopInstruction(const ICFGNode *inst)
Multi-forked threads.
Definition TCT.cpp:78
bool isJoinMustExecutedInLoop(const LoopBBs &lp, const ICFGNode *join)
Return true if a join instruction must be executed inside a loop.
Definition TCT.cpp:326
virtual void markRelProcs()
Mark relevant procedures that are backward reachable from any fork/join site.
Definition TCT.cpp:165
Set< const ICFGNode * > inRecurJoinSites
Fork or Join sites in recursions.
Definition TCT.h:624
LoopBBs & getJoinLoop(const CallICFGNode *join)
Get loop for join site.
Definition TCT.h:396
PointerAnalysis * pta
Definition TCT.h:458
TCTNode * getTCTNode(const CxtThread &ct) const
Definition TCT.h:285
void dumpCxt(CallStrCxt &cxt)
Dump calling context.
Definition TCT.cpp:551
bool addTCTEdge(TCTNode *src, TCTNode *dst)
Add TCT edge.
Definition TCT.h:476
u32_t MaxCxtSize
Definition TCT.h:462
const FunSet & getEntryProcs() const
Get marked candidate functions.
Definition TCT.h:245
bool isLoopHeaderOfJoinLoop(const SVFBasicBlock *bb)
Whether a given bb is a loop head of a inloop join site.
Definition TCT.cpp:375
virtual void build()
Build TCT.
Definition TCT.cpp:419
void print() const
Print TCT information.
Definition TCT.cpp:577
virtual void handleCallRelation(CxtThreadProc &ctp, const CallGraphEdge *cgEdge, const CallICFGNode *call)
Handle call relations.
Definition TCT.cpp:277
ThreadCallGraph * tcg
Definition TCT.h:457
Map< const ICFGNode *, LoopBBs > InstToLoopMap
Definition TCT.h:181
void collectMultiForkedThreads()
Definition TCT.cpp:239
Set< std::pair< NodeID, CallStrCxt > > CallStrCxtSet
Definition TCT.h:178
CxtThreadProc popFromCTPWorkList()
Definition TCT.h:604
TCTEdge * hasGraphEdge(TCTNode *src, TCTNode *dst, TCTEdge::CEDGEK kind) const
Whether we have already created this call graph edge.
Definition TCT.cpp:589
Set< const ICFGNode * > DummyForkSiteSet
Definition TCT.h:185
bool isLoopExitOfJoinLoop(const SVFBasicBlock *bb)
Whether a given bb is an exit of a inloop join site.
Definition TCT.cpp:389
SVFLoopAndDomInfo::LoopBBs LoopBBs
Definition TCT.h:159
bool isExtCall(const ICFGNode *inst)
Whether it is calling an external function.
Definition TCT.h:267
u32_t getTCTNodeNum() const
Get Statistics.
Definition TCT.h:252
const LoopBBs & getLoop(const ICFGNode *inst)
Get loop for an instruction.
ThreadCreateEdgeSet::const_iterator getChildrenEnd(const TCTNode *node) const
Definition TCT.h:224
ThreadCreateEdgeSet::const_iterator getParentsBegin(const TCTNode *node) const
Definition TCT.h:228
virtual void pushCxt(CallStrCxt &cxt, const CallICFGNode *call, const FunObjVar *callee)
Context helper functions.
Definition TCT.cpp:483
Map< CxtThread, TCTNode * > CxtThreadToNodeMap
Definition TCT.h:177
const FunObjVar * getStartRoutineOfCxtThread(const CxtThread &ct) const
get the start routine function of a thread
Definition TCT.h:388
const CallStrCxtSet & getCxtOfCxtThread(const CxtThread &ct) const
get the contexts of a thread at its spawning sites (fork sites)
Definition TCT.h:380
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:51
GenericNode< TCTNode, TCTEdge > GenericTCTNodeTy
Definition TCT.h:86
u32_t NodeID
Definition GeneralType.h:76
GenericGraph< TCTNode, TCTEdge > GenericThreadCreateTreeTy
Definition TCT.h:154
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:166