Static Value-Flow Analysis
Loading...
Searching...
No Matches
MHP.h
Go to the documentation of this file.
1//===- MHP.h -- May-happen-in-parallel analysis-------------//
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 * MHP.h
25 *
26 * Created on: Jan 21, 2014
27 * Author: Yulei Sui, Peng Di
28 */
29
30#ifndef MHP_H_
31#define MHP_H_
32
33#include "MTA/TCT.h"
34#include "Util/SVFUtil.h"
35namespace SVF
36{
37
38class ForkJoinAnalysis;
39class LockAnalysis;
40
45class MHP
46{
47
48public:
55
57
58 typedef std::pair<const FunObjVar*,const FunObjVar*> FuncPair;
60
62 MHP(TCT* t);
63
65 virtual ~MHP();
66
68 void analyze();
69
72
75 {
76 return tcg;
77 }
78
80 inline TCT* getTCT() const
81 {
82 return tct;
83 }
84
86 bool isConnectedfromMain(const FunObjVar* fun);
87
88// LockSpan getSpanfromCxtLock(NodeID l);
90 virtual bool mayHappenInParallel(const ICFGNode* i1, const ICFGNode* i2);
91 virtual bool mayHappenInParallelCache(const ICFGNode* i1, const ICFGNode* i2);
92 virtual bool mayHappenInParallelInst(const ICFGNode* i1, const ICFGNode* i2);
93 virtual bool executedByTheSameThread(const ICFGNode* i1, const ICFGNode* i2);
94
96
98 {
100 }
101 inline bool hasInterleavingThreads(const CxtThreadStmt& cts) const
102 {
104 }
106
108
109 inline const CxtThreadStmtSet& getThreadStmtSet(const ICFGNode* inst) const
110 {
111 InstToThreadStmtSetMap::const_iterator it = instToTSMap.find(inst);
112 assert(it!=instToTSMap.end() && "no thread access the instruction?");
113 return it->second;
114 }
115 inline bool hasThreadStmtSet(const ICFGNode* inst) const
116 {
117 return instToTSMap.find(inst)!=instToTSMap.end();
118 }
120
122 void printInterleaving();
123
124private:
125
127 {
128 tcg->getCallees(inst, callees);
129 return callees;
130 }
134
137
140
143
146
148 void handleRet(const CxtThreadStmt& cts);
149
151 void handleIntra(const CxtThreadStmt& cts);
152
154
156 {
157 if(threadStmtToThreadInterLeav[tgr].test_and_set(tid))
158 {
159 instToTSMap[tgr.getStmt()].insert(tgr);
161 }
162 }
163 inline void addInterleavingThread(const CxtThreadStmt& tgr, const CxtThreadStmt& src)
164 {
166 if(changed)
167 {
168 instToTSMap[tgr.getStmt()].insert(tgr);
170 }
171 }
173 {
175 for(NodeBS::iterator it = tids.begin(), eit = tids.end(); it!=eit; ++it)
176 {
177 if(isMustJoin(tgr.getTid(),joinsite))
178 joinedTids.set(*it);
179 }
180 if(threadStmtToThreadInterLeav[tgr].intersectWithComplement(joinedTids))
181 {
183 }
184 }
186
188
192
195
197 bool isMustJoin(const NodeID curTid, const ICFGNode* joinsite);
198
201 {
203 }
204
206
207
208 inline void pushCxt(CallStrCxt& cxt, const CallICFGNode* call, const FunObjVar* callee)
209 {
211 if(tct->isCandidateFun(call->getFun()) == false)
212 return;
213 tct->pushCxt(cxt,call,callee);
214 }
216 inline bool matchAndPopCxt(CallStrCxt& cxt, const CallICFGNode* call, const FunObjVar* callee)
217 {
218 return tct->matchAndPopCxt(cxt,call,callee);
219 }
221 inline bool isContextSuffix(const CallStrCxt& lhs, const CallStrCxt call)
222 {
223 return tct->isContextSuffix(lhs,call);
224 }
226
228
229 inline bool pushToCTSWorkList(const CxtThreadStmt& cs)
230 {
231 return cxtStmtList.push(cs);
232 }
234 {
236 return ctp;
237 }
238
240 inline bool isTDFork(const ICFGNode* call)
241 {
242 const CallICFGNode* fork = SVFUtil::dyn_cast<CallICFGNode>(call);
243 return fork && tcg->getThreadAPI()->isTDFork(fork);
244 }
246 inline bool isTDJoin(const ICFGNode* call)
247 {
248 const CallICFGNode* join = SVFUtil::dyn_cast<CallICFGNode>(call);
249 return join && tcg->getThreadAPI()->isTDJoin(join);
250 }
251
253 NodeBS getDirAndIndJoinedTid(const CallStrCxt& cxt, const ICFGNode* call);
254
256 bool hasJoinInSymmetricLoop(const CallStrCxt& cxt, const ICFGNode* call) const;
257
259 const LoopBBs& getJoinInSymmetricLoop(const CallStrCxt& cxt, const ICFGNode* call) const;
260
263
271
272
273public:
278};
279
280
281
286{
287
288public:
291 {
292 Empty, // initial(dummy) state
293 TDAlive, // thread is alive
294 TDDead, // thread is dead
295 };
296
304
307
308
310 {
312 }
314 void collectSCEVInfo();
315
319 void analyzeForkJoinPair();
320
323 {
324 return directJoinMap[cs];
325 }
328
330 inline const LoopBBs& getJoinInSymmetricLoop(const CxtStmt& cs) const
331 {
332 CxtStmtToLoopMap::const_iterator it = cxtJoinInLoop.find(cs);
333 assert(it!=cxtJoinInLoop.end() && "does not have the loop");
334 return it->second;
335 }
336 inline bool hasJoinInSymmetricLoop(const CxtStmt& cs) const
337 {
338 CxtStmtToLoopMap::const_iterator it = cxtJoinInLoop.find(cs);
339 return it!=cxtJoinInLoop.end();
340 }
343 {
344 bool nonhp = HBPair.find(std::make_pair(tid1,tid2))!=HBPair.end();
345 bool hp = HPPair.find(std::make_pair(tid1,tid2))!=HPPair.end();
346 return nonhp && !hp;
347 }
350 {
351 bool full = fullJoin.find(std::make_pair(tid1,tid2))!=fullJoin.end();
352 bool partial = partialJoin.find(std::make_pair(tid1,tid2))!=partialJoin.end();
353 return full && !partial;
354 }
355
357 inline LoopBBs& getJoinLoop(const CallICFGNode* inst)
358 {
359 return tct->getJoinLoop(inst);
360 }
361 inline bool hasJoinLoop(const CallICFGNode* inst)
362 {
363 return tct->hasJoinLoop(inst);
364 }
365private:
366
368 void handleFork(const CxtStmt& cts,NodeID rootTid);
369
371 void handleJoin(const CxtStmt& cts,NodeID rootTid);
372
374 void handleCall(const CxtStmt& cts,NodeID rootTid);
375
377 void handleRet(const CxtStmt& cts);
378
380 void handleIntra(const CxtStmt& cts);
381
383 bool isSameSCEV(const ICFGNode* forkSite, const ICFGNode* joinSite);
384
387
390 {
391 return tct->getPTA()->alias(getForkedThread(forkSite)->getId(), getJoinedThread(joinSite)->getId());
392 }
394
395
397 {
398 CxtStmtToAliveFlagMap::const_iterator it = cxtStmtToAliveFlagMap.find(cs);
399 if(it==cxtStmtToAliveFlagMap.end())
400 {
402 return Empty;
403 }
404 else
405 return it->second;
406 }
409 {
413 {
414 instToCxtStmt[tgr.getStmt()].insert(tgr);
416 }
417
418 }
420 void markCxtStmtFlag(const CxtStmt& tgr, const CxtStmt& src)
421 {
424 if(flag_tgr == Empty)
425 {
427 }
428 else if(flag_tgr == TDDead)
429 {
430 if(flag_src==TDAlive)
432 }
433 else
434 {
436 }
438 {
439 instToCxtStmt[tgr.getStmt()].insert(tgr);
441 }
442 }
444 inline void clearFlagMap()
445 {
446 cxtStmtToAliveFlagMap.clear();
448 }
450
452
453 inline bool pushToCTSWorkList(const CxtStmt& cs)
454 {
455 return cxtStmtList.push(cs);
456 }
458 {
460 return ctp;
461 }
463
465
466
467 inline void pushCxt(CallStrCxt& cxt, const CallICFGNode* call, const FunObjVar* callee)
468 {
470 if(tct->isCandidateFun(call->getFun()) == false)
471 return;
472 tct->pushCxt(cxt,call,callee);
473 }
475 inline bool matchAndPopCxt(CallStrCxt& cxt, const CallICFGNode* call, const FunObjVar* callee)
476 {
477 return tct->matchAndPopCxt(cxt,call,callee);
478 }
480 inline bool isContextSuffix(const CallStrCxt& lhs, const CallStrCxt call)
481 {
482 return tct->isContextSuffix(lhs,call);
483 }
485
487 inline bool isTDFork(const ICFGNode* call)
488 {
489 const CallICFGNode* fork = SVFUtil::dyn_cast<CallICFGNode>(call);
490 return fork && getTCG()->getThreadAPI()->isTDFork(fork);
491 }
493 inline bool isTDJoin(const ICFGNode* call)
494 {
495 const CallICFGNode* join = SVFUtil::dyn_cast<CallICFGNode>(call);
496 return join && getTCG()->getThreadAPI()->isTDJoin(join);
497 }
499 inline const SVFVar* getForkedThread(const CallICFGNode* call)
500 {
501 return getTCG()->getThreadAPI()->getForkedThread(call);
502 }
504 inline const SVFVar* getJoinedThread(const CallICFGNode* call)
505 {
506 return getTCG()->getThreadAPI()->getJoinedThread(call);
507 }
509 {
510 getTCG()->getCallees(SVFUtil::cast<CallICFGNode>(inst), callees);
511 return callees;
512 }
514 inline ThreadCallGraph* getTCG() const
515 {
516 return tct->getThreadCallGraph();
517 }
519 inline void addDirectlyJoinTID(const CxtStmt& cs, NodeID tid)
520 {
521 directJoinMap[cs].set(tid);
522 }
523
526
528 {
529 HPPair.insert(std::make_pair(tid1,tid2));
530 HPPair.insert(std::make_pair(tid2,tid1));
531 }
533 {
534 HBPair.insert(std::make_pair(tid1,tid2));
535 }
537
539
541 {
542 fullJoin.insert(std::make_pair(tid1,tid2));
543 }
545 {
546 partialJoin.insert(std::make_pair(tid1,tid2));
547 }
549
551 inline const CxtStmtSet& getCxtStmtsFromInst(const ICFGNode* inst) const
552 {
553 InstToCxtStmt::const_iterator it = instToCxtStmt.find(inst);
554 assert(it!=instToCxtStmt.end() && "no CxtStmt for the instruction?");
555 return it->second;
556 }
557 inline bool hasCxtStmtsFromInst(const ICFGNode* inst) const
558 {
559 return instToCxtStmt.find(inst)!=instToCxtStmt.end();
560 }
561
563 inline void addSymmetricLoopJoin(const CxtStmt& cs, LoopBBs& lp)
564 {
565 cxtJoinInLoop[cs] = lp;
566 }
578};
579
580} // End namespace SVF
581
582#endif /* MHP_H_ */
void getCallees(const CallICFGNode *cs, FunctionSet &callees)
Get all callees for a callsite.
Definition CallGraph.h:414
Set< const FunObjVar * > FunctionSet
Definition CallGraph.h:244
bool push(const Data &data)
Definition WorkList.h:165
void addToFullJoin(NodeID tid1, NodeID tid2)
full join and partial join
Definition MHP.h:540
const SVFVar * getForkedThread(const CallICFGNode *call)
Get forked thread.
Definition MHP.h:499
void markCxtStmtFlag(const CxtStmt &tgr, const CxtStmt &src)
Transfer function for marking context-sensitive statement.
Definition MHP.h:420
Map< CxtStmt, LoopBBs > CxtStmtToLoopMap
Definition MHP.h:302
FIFOWorkList< CxtStmt > CxtStmtWorkList
Definition MHP.h:303
ValDomain getMarkedFlag(const CxtStmt &cs)
Mark thread flags for cxtStmt.
Definition MHP.h:396
void addToHPPair(NodeID tid1, NodeID tid2)
Definition MHP.h:527
SVFLoopAndDomInfo::LoopBBs LoopBBs
Definition MHP.h:297
void analyzeForkJoinPair()
Definition MHP.cpp:760
bool hasJoinLoop(const CallICFGNode *inst)
Definition MHP.h:361
const CallGraph::FunctionSet & getCallee(const ICFGNode *inst, CallGraph::FunctionSet &callees)
Definition MHP.h:508
void addSymmetricLoopJoin(const CxtStmt &cs, LoopBBs &lp)
Add inloop join.
Definition MHP.h:563
void handleRet(const CxtStmt &cts)
Handle return.
Definition MHP.cpp:967
NodeBS getDirAndIndJoinedTid(const CxtStmt &cs)
Get directly and indirectly joined threadIDs based on a context-sensitive join site.
Definition MHP.cpp:1061
ThreadPairSet partialJoin
t1 partially joins t2 along some program path(s)
Definition MHP.h:576
ThreadPairSet fullJoin
t1 fully joins t2 along all program path
Definition MHP.h:575
ForkJoinAnalysis(TCT *t)
Definition MHP.h:309
bool matchAndPopCxt(CallStrCxt &cxt, const CallICFGNode *call, const FunObjVar *callee)
Match context.
Definition MHP.h:475
ThreadPairSet HPPair
threads happen-in-parallel
Definition MHP.h:574
CxtStmt popFromCTSWorkList()
Definition MHP.h:457
TCT::InstVec InstVec
Definition MHP.h:298
bool hasCxtStmtsFromInst(const ICFGNode *inst) const
Definition MHP.h:557
CxtStmtToLoopMap cxtJoinInLoop
a set of context-sensitive join inside loop
Definition MHP.h:572
void addToHBPair(NodeID tid1, NodeID tid2)
Definition MHP.h:532
ThreadCallGraph * getTCG() const
ThreadCallGraph.
Definition MHP.h:514
void addToPartial(NodeID tid1, NodeID tid2)
Definition MHP.h:544
Map< const ICFGNode *, CxtStmtSet > InstToCxtStmt
Definition MHP.h:306
Set< CxtStmt > CxtStmtSet
Definition MHP.h:305
void collectSCEVInfo()
functions
Definition MHP.cpp:706
void clearFlagMap()
Clear flags.
Definition MHP.h:444
bool pushToCTSWorkList(const CxtStmt &cs)
Worklist operations.
Definition MHP.h:453
Set< NodePair > ThreadPairSet
Definition MHP.h:301
bool isHBPair(NodeID tid1, NodeID tid2)
Whether thread t1 happens-before thread t2.
Definition MHP.h:342
void addDirectlyJoinTID(const CxtStmt &cs, NodeID tid)
maps a context-sensitive join site to a thread id
Definition MHP.h:519
ValDomain
semilattice Empty==>TDDead==>TDAlive
Definition MHP.h:291
const SVFVar * getJoinedThread(const CallICFGNode *call)
Get joined thread.
Definition MHP.h:504
Map< CxtStmt, NodeBS > CxtStmtToTIDMap
Definition MHP.h:300
LoopBBs & getJoinLoop(const CallICFGNode *inst)
Get loop for join site.
Definition MHP.h:357
void pushCxt(CallStrCxt &cxt, const CallICFGNode *call, const FunObjVar *callee)
Context helper functions.
Definition MHP.h:467
CxtStmtToAliveFlagMap cxtStmtToAliveFlagMap
flags for context-sensitive statements
Definition MHP.h:568
bool isTDFork(const ICFGNode *call)
Whether it is a fork site.
Definition MHP.h:487
ThreadPairSet HBPair
thread happens-before pair
Definition MHP.h:573
bool isContextSuffix(const CallStrCxt &lhs, const CallStrCxt call)
If lhs is a suffix of rhs, including equal.
Definition MHP.h:480
bool isFullJoin(NodeID tid1, NodeID tid2)
Whether t1 fully joins t2.
Definition MHP.h:349
CxtStmtToTIDMap dirAndIndJoinMap
maps a context-sensitive join site to directly and indirectly joined thread ids
Definition MHP.h:571
void handleCall(const CxtStmt &cts, NodeID rootTid)
Handle call.
Definition MHP.cpp:942
bool hasJoinInSymmetricLoop(const CxtStmt &cs) const
Definition MHP.h:336
InstToCxtStmt instToCxtStmt
Map a statement to all its context-sensitive statements.
Definition MHP.h:577
CxtStmtToTIDMap directJoinMap
maps a context-sensitive join site to directly joined thread ids
Definition MHP.h:570
bool sameLoopTripCount(const ICFGNode *forkSite, const ICFGNode *joinSite)
Same loop trip count.
Definition MHP.cpp:1160
bool isTDJoin(const ICFGNode *call)
Whether it is a join site.
Definition MHP.h:493
void markCxtStmtFlag(const CxtStmt &tgr, ValDomain flag)
Initialize TDAlive and TDDead flags.
Definition MHP.h:408
CxtStmtWorkList cxtStmtList
context-sensitive statement worklist
Definition MHP.h:569
Map< CxtStmt, ValDomain > CxtStmtToAliveFlagMap
Definition MHP.h:299
const LoopBBs & getJoinInSymmetricLoop(const CxtStmt &cs) const
Whether a context-sensitive join satisfies symmetric loop pattern.
Definition MHP.h:330
bool isAliasedForkJoin(const CallICFGNode *forkSite, const CallICFGNode *joinSite)
Whether it is a matched fork join pair.
Definition MHP.h:389
void handleIntra(const CxtStmt &cts)
Handle intra.
Definition MHP.cpp:1040
void handleFork(const CxtStmt &cts, NodeID rootTid)
Handle fork.
Definition MHP.cpp:846
NodeBS & getDirectlyJoinedTid(const CxtStmt &cs)
Get directly joined threadIDs based on a context-sensitive join site.
Definition MHP.h:322
void handleJoin(const CxtStmt &cts, NodeID rootTid)
Handle join.
Definition MHP.cpp:873
bool isSameSCEV(const ICFGNode *forkSite, const ICFGNode *joinSite)
Return true if the fork and join have the same SCEV.
Definition MHP.cpp:1136
const CxtStmtSet & getCxtStmtsFromInst(const ICFGNode *inst) const
Get CxtStmtSet for an instruction.
Definition MHP.h:551
virtual const FunObjVar * getFun() const
Return the function of this ICFGNode.
Definition ICFGNode.h:74
Definition MHP.h:46
void analyze()
Start analysis here.
Definition MHP.cpp:62
CxtThreadStmtWorkList cxtStmtList
CxtThreadStmt worklist.
Definition MHP.h:267
bool isRecurFullJoin(NodeID parentTid, NodeID curTid)
Thread curTid can be fully joined by parentTid recursively.
Definition MHP.cpp:485
bool isMultiForkedThread(NodeID curTid)
A thread is a multiForked thread if it is in a loop or recursion.
Definition MHP.h:200
Set< CxtStmt > LockSpan
Definition MHP.h:56
void rmInterleavingThread(const CxtThreadStmt &tgr, const NodeBS &tids, const ICFGNode *joinsite)
Definition MHP.h:172
virtual bool mayHappenInParallelCache(const ICFGNode *i1, const ICFGNode *i2)
Definition MHP.cpp:631
TCT * tct
TCT.
Definition MHP.h:265
FuncPairToBool nonCandidateFuncMHPRelMap
Definition MHP.h:270
void printInterleaving()
Print interleaving results.
Definition MHP.cpp:686
void updateSiblingThreads(NodeID tid)
Definition MHP.cpp:457
bool matchAndPopCxt(CallStrCxt &cxt, const CallICFGNode *call, const FunObjVar *callee)
Match context.
Definition MHP.h:216
u32_t numOfTotalQueries
Total number of queries.
Definition MHP.h:274
Set< CxtThreadStmt > CxtThreadStmtSet
Definition MHP.h:51
std::pair< const FunObjVar *, const FunObjVar * > FuncPair
Definition MHP.h:58
void handleNonCandidateFun(const CxtThreadStmt &cts)
Handle non-candidate function.
Definition MHP.cpp:179
SVFLoopAndDomInfo::LoopBBs LoopBBs
Definition MHP.h:54
bool isContextSuffix(const CallStrCxt &lhs, const CallStrCxt call)
If lhs is a suffix of rhs, including equal.
Definition MHP.h:221
Set< const FunObjVar * > FunSet
Definition MHP.h:49
void handleJoin(const CxtThreadStmt &cts, NodeID rootTid)
Handle join.
Definition MHP.cpp:231
bool hasInterleavingThreads(const CxtThreadStmt &cts) const
Definition MHP.h:101
void pushCxt(CallStrCxt &cxt, const CallICFGNode *call, const FunObjVar *callee)
Context helper functions.
Definition MHP.h:208
ThreadCallGraph * tcg
TCG.
Definition MHP.h:264
void addInterleavingThread(const CxtThreadStmt &tgr, NodeID tid)
Add/Remove interleaving thread for statement inst.
Definition MHP.h:155
const NodeBS & getInterleavingThreads(const CxtThreadStmt &cts)
Get interleaving thread for statement inst.
Definition MHP.h:97
InstToThreadStmtSetMap instToTSMap
Map a statement to its thread interleavings.
Definition MHP.h:269
virtual ~MHP()
Destructor.
Definition MHP.cpp:54
void addInterleavingThread(const CxtThreadStmt &tgr, const CxtThreadStmt &src)
Definition MHP.h:163
bool isHBPair(NodeID tid1, NodeID tid2)
Whether thread t1 happens before t2 based on ForkJoin Analysis.
Definition MHP.cpp:555
ThreadCallGraph * getThreadCallGraph() const
Get ThreadCallGraph.
Definition MHP.h:74
ThreadStmtToThreadInterleav threadStmtToThreadInterLeav
Definition MHP.h:268
bool isTDFork(const ICFGNode *call)
Whether it is a fork site.
Definition MHP.h:240
void handleRet(const CxtThreadStmt &cts)
Handle return.
Definition MHP.cpp:334
virtual bool executedByTheSameThread(const ICFGNode *i1, const ICFGNode *i2)
Definition MHP.cpp:665
virtual bool mayHappenInParallel(const ICFGNode *i1, const ICFGNode *i2)
Interface to query whether two instructions may happen-in-parallel.
Definition MHP.cpp:653
const CxtThreadStmtSet & getThreadStmtSet(const ICFGNode *inst) const
Get/has ThreadStmt.
Definition MHP.h:109
void handleFork(const CxtThreadStmt &cts, NodeID rootTid)
Handle fork.
Definition MHP.cpp:201
const LoopBBs & getJoinInSymmetricLoop(const CallStrCxt &cxt, const ICFGNode *call) const
Whether a context-sensitive join satisfies symmetric loop pattern.
Definition MHP.cpp:546
Map< const ICFGNode *, CxtThreadStmtSet > InstToThreadStmtSetMap
Definition MHP.h:53
ForkJoinAnalysis * fja
ForJoin Analysis.
Definition MHP.h:266
bool hasJoinInSymmetricLoop(const CallStrCxt &cxt, const ICFGNode *call) const
Whether a context-sensitive join satisfies symmetric loop pattern.
Definition MHP.cpp:539
const CallGraph::FunctionSet & getCallee(const CallICFGNode *inst, CallGraph::FunctionSet &callees)
Definition MHP.h:126
bool hasThreadStmtSet(const ICFGNode *inst) const
Definition MHP.h:115
double interleavingQueriesTime
Definition MHP.h:277
u32_t numOfMHPQueries
Number of queries are answered as may-happen-in-parallel.
Definition MHP.h:275
void updateNonCandidateFunInterleaving()
Definition MHP.cpp:141
Map< CxtThreadStmt, NodeBS > ThreadStmtToThreadInterleav
Definition MHP.h:52
bool isMustJoin(const NodeID curTid, const ICFGNode *joinsite)
Whether a join site must join a thread t.
Definition MHP.cpp:520
double interleavingTime
Definition MHP.h:276
bool isConnectedfromMain(const FunObjVar *fun)
Whether the function is connected from main function in thread call graph.
Definition MHP.cpp:560
CxtThreadStmt popFromCTSWorkList()
Definition MHP.h:233
void analyzeInterleaving()
Analyze thread interleaving.
Definition MHP.cpp:75
Map< FuncPair, bool > FuncPairToBool
Definition MHP.h:59
NodeBS getDirAndIndJoinedTid(const CallStrCxt &cxt, const ICFGNode *call)
Return thread id(s) which are directly or indirectly joined at this join site.
Definition MHP.cpp:530
void updateAncestorThreads(NodeID tid)
Update Ancestor and sibling threads.
Definition MHP.cpp:418
virtual bool mayHappenInParallelInst(const ICFGNode *i1, const ICFGNode *i2)
Definition MHP.cpp:595
FIFOWorkList< CxtThreadStmt > CxtThreadStmtWorkList
Definition MHP.h:50
bool pushToCTSWorkList(const CxtThreadStmt &cs)
WorkList helper functions.
Definition MHP.h:229
void handleIntra(const CxtThreadStmt &cts)
Handle intra.
Definition MHP.cpp:403
void handleCall(const CxtThreadStmt &cts, NodeID rootTid)
Handle call.
Definition MHP.cpp:288
TCT * getTCT() const
Get Thread Creation Tree.
Definition MHP.h:80
bool isTDJoin(const ICFGNode *call)
Whether it is a join site.
Definition MHP.h:246
virtual AliasResult alias(const SVFVar *V1, const SVFVar *V2)=0
Interface exposed to users of our pointer analysis, given Value infos.
void set(unsigned Idx)
bool isMultiforked() const
Definition TCT.h:120
TCTNode * getTCTNode(NodeID id) const
Get TCT node.
Definition TCT.h:200
bool isContextSuffix(const CallStrCxt &lhs, const CallStrCxt &call)
If lhs is a suffix of rhs, including equal.
Definition TCT.cpp:497
PointerAnalysis * getPTA() const
Get PTA.
Definition TCT.h:195
bool hasJoinLoop(const CallICFGNode *join) const
Definition TCT.h:395
ThreadCallGraph * getThreadCallGraph() const
Get TCG.
Definition TCT.h:190
bool isCandidateFun(const CallGraph::FunctionSet &callees) const
Whether it is a candidate function for indirect call.
Definition TCT.h:285
std::vector< const ICFGNode * > InstVec
Definition TCT.h:161
bool matchAndPopCxt(CallStrCxt &cxt, const CallICFGNode *call, const FunObjVar *callee)
Match context.
Definition TCT.cpp:469
LoopBBs & getJoinLoop(const CallICFGNode *join)
Get loop for join site.
Definition TCT.h:387
void pushCxt(CallStrCxt &cxt, const CallICFGNode *call, const FunObjVar *callee)
Context helper functions.
Definition TCT.cpp:449
bool isTDFork(const CallICFGNode *inst) const
Return true if this call create a new thread.
const ValVar * getForkedThread(const CallICFGNode *inst) const
Return arguments/attributes of pthread_create / hare_parallel_for.
bool isTDJoin(const CallICFGNode *inst) const
Return true if this call wait for a worker thread.
const SVFVar * getJoinedThread(const CallICFGNode *inst) const
Return arguments/attributes of pthread_join.
ThreadAPI * getThreadAPI() const
Thread API.
for isBitcode
Definition BasicTypes.h:68
u32_t NodeID
Definition GeneralType.h:56
llvm::IRBuilder IRBuilder
Definition BasicTypes.h:74
std::vector< u32_t > CallStrCxt
unsigned u32_t
Definition GeneralType.h:47