|
Static Value-Flow Analysis
|
#include <MHP.h>
Public Types | |
| enum | ValDomain { Empty , TDAlive , TDDead } |
| semilattice Empty==>TDDead==>TDAlive More... | |
| typedef SVFLoopAndDomInfo::LoopBBs | LoopBBs |
| typedef TCT::InstVec | InstVec |
| typedef Map< CxtStmt, ValDomain > | CxtStmtToAliveFlagMap |
| typedef Map< CxtStmt, NodeBS > | CxtStmtToTIDMap |
| typedef Set< NodePair > | ThreadPairSet |
| typedef Map< CxtStmt, LoopBBs > | CxtStmtToLoopMap |
| typedef FIFOWorkList< CxtStmt > | CxtStmtWorkList |
| typedef Set< CxtStmt > | CxtStmtSet |
| typedef Map< const ICFGNode *, CxtStmtSet > | InstToCxtStmt |
Public Member Functions | |
| ForkJoinAnalysis (TCT *t) | |
| void | collectSCEVInfo () |
| functions | |
| template<class ICFGGraph, class CGGraph> | |
| void | analyzeForkJoinPair (ICFGGraph icfg, CGGraph cg) |
| NodeBS & | getDirectlyJoinedTid (const CxtStmt &cs) |
| Get directly joined threadIDs based on a context-sensitive join site. | |
| NodeBS | getDirAndIndJoinedTid (const CxtStmt &cs) |
| Get directly and indirectly joined threadIDs based on a context-sensitive join site. | |
| const LoopBBs & | getJoinInSymmetricLoop (const CxtStmt &cs) const |
| Whether a context-sensitive join satisfies symmetric loop pattern. | |
| bool | hasJoinInSymmetricLoop (const CxtStmt &cs) const |
| bool | isHBPair (NodeID tid1, NodeID tid2) |
| Whether thread t1 happens-before thread t2. | |
| bool | isFullJoin (NodeID tid1, NodeID tid2) |
| Whether t1 fully joins t2. | |
| LoopBBs & | getJoinLoop (const CallICFGNode *inst) |
| Get loop for join site. | |
| bool | hasJoinLoop (const CallICFGNode *inst) |
| const CxtStmtToLoopMap & | getSymmetricLoopJoins () const |
| All SCEV-symmetric in-loop joins and their loop blocks. | |
Private Member Functions | |
| template<class ICFGGraph, class CGGraph> | |
| void | handleFork (ICFGGraph icfg, CGGraph cg, const CxtStmt &cts, NodeID rootTid) |
| Handle fork. | |
| template<class ICFGGraph, class CGGraph> | |
| void | handleJoin (ICFGGraph icfg, CGGraph cg, const CxtStmt &cts, NodeID rootTid) |
| Handle join. | |
| template<class ICFGGraph, class CGGraph> | |
| void | handleCall (ICFGGraph icfg, CGGraph cg, const CxtStmt &cts) |
| Handle call. | |
| template<class ICFGGraph, class CGGraph> | |
| void | handleRet (ICFGGraph icfg, CGGraph cg, const CxtStmt &cts) |
| Handle return. | |
| template<class ICFGGraph> | |
| void | handleIntra (ICFGGraph icfg, const CxtStmt &cts) |
| Handle intra. | |
| bool | isSameSCEV (const ICFGNode *forkSite, const ICFGNode *joinSite) |
| Return true if the fork and join have the same SCEV. | |
| bool | sameLoopTripCount (const ICFGNode *forkSite, const ICFGNode *joinSite) |
| Same loop trip count. | |
| bool | isAliasedForkJoin (const CallICFGNode *forkSite, const CallICFGNode *joinSite) |
| Whether it is a matched fork join pair. | |
| ValDomain | getMarkedFlag (const CxtStmt &cs) |
| Mark thread flags for cxtStmt. | |
| void | markCxtStmtFlag (const CxtStmt &tgr, ValDomain flag) |
| Initialize TDAlive and TDDead flags. | |
| void | markCxtStmtFlag (const CxtStmt &tgr, const CxtStmt &src) |
| Transfer function for marking context-sensitive statement. | |
| void | clearFlagMap () |
| Clear flags. | |
| bool | pushToCTSWorkList (const CxtStmt &cs) |
| Worklist operations. | |
| CxtStmt | popFromCTSWorkList () |
| void | pushCxt (CallStrCxt &cxt, const CallICFGNode *call, const FunObjVar *callee) |
| Context helper functions. | |
| bool | matchAndPopCxt (CallStrCxt &cxt, const CallICFGNode *call, const FunObjVar *callee) |
| Match context. | |
| bool | isContextSuffix (const CallStrCxt &lhs, const CallStrCxt call) |
| If lhs is a suffix of rhs, including equal. | |
| bool | isTDFork (const ICFGNode *call) |
| Whether it is a fork site. | |
| bool | isTDJoin (const ICFGNode *call) |
| Whether it is a join site. | |
| const SVFVar * | getForkedThread (const CallICFGNode *call) |
| Get forked thread. | |
| const SVFVar * | getJoinedThread (const CallICFGNode *call) |
| Get joined thread. | |
| ThreadCallGraph * | getTCG () const |
| ThreadCallGraph. | |
| void | addDirectlyJoinTID (const CxtStmt &cs, NodeID tid) |
| maps a context-sensitive join site to a thread id | |
| void | addToHPPair (NodeID tid1, NodeID tid2) |
| void | addToHBPair (NodeID tid1, NodeID tid2) |
| void | addToFullJoin (NodeID tid1, NodeID tid2) |
| full join and partial join | |
| void | addToPartial (NodeID tid1, NodeID tid2) |
| const CxtStmtSet & | getCxtStmtsFromInst (const ICFGNode *inst) const |
| Get CxtStmtSet for an instruction. | |
| bool | hasCxtStmtsFromInst (const ICFGNode *inst) const |
| void | addSymmetricLoopJoin (const CxtStmt &cs, LoopBBs &lp) |
| Add inloop join. | |
Private Attributes | |
| ThreadAPI::ForkJoinAliasCache | forkJoinAliasCache |
| TCT * | tct |
| CxtStmtToAliveFlagMap | cxtStmtToAliveFlagMap |
| flags for context-sensitive statements | |
| CxtStmtWorkList | cxtStmtList |
| context-sensitive statement worklist | |
| CxtStmtToTIDMap | directJoinMap |
| maps a context-sensitive join site to directly joined thread ids | |
| CxtStmtToTIDMap | dirAndIndJoinMap |
| maps a context-sensitive join site to directly and indirectly joined thread ids | |
| CxtStmtToLoopMap | cxtJoinInLoop |
| a set of context-sensitive join inside loop | |
| ThreadPairSet | HBPair |
| thread happens-before pair | |
| ThreadPairSet | HPPair |
| threads happen-in-parallel | |
| ThreadPairSet | fullJoin |
| t1 fully joins t2 along all program path | |
| ThreadPairSet | partialJoin |
| t1 partially joins t2 along some program path(s) | |
| InstToCxtStmt | instToCxtStmt |
| Map a statement to all its context-sensitive statements. | |
| typedef Set<CxtStmt> SVF::ForkJoinAnalysis::CxtStmtSet |
| typedef Map<const ICFGNode*, CxtStmtSet> SVF::ForkJoinAnalysis::InstToCxtStmt |
|
inline |
maps a context-sensitive join site to a thread id
Definition at line 584 of file MHP.h.
Add inloop join.
Definition at line 628 of file MHP.h.
Definition at line 609 of file MHP.h.
| template void ForkJoinAnalysis::analyzeForkJoinPair< const SlicedICFGView *, const SlicedThreadCallGraphView * > | ( | ICFGGraph | icfg, |
| CGGraph | cg ) |
context-sensitive forward traversal from each fork site. Generate following results (1) fork join pair, maps a context-sensitive join site to its corresponding thread ids (2) never happen-in-parallel thread pairs
Context-sensitive forward traversal from each fork site
Start from the instruction next to the fork site
Propagate to the return site of the call instruction, only if the callee is a non-candidate function, while for candidate function, return site should be handled after the callee is handled.
If the current instruction is an exit instruction of the start routine of a parent context thread, we need to update the join information the parent context thread.
Definition at line 962 of file MHP.cpp.
|
inlineprivate |
Clear flags.
Definition at line 514 of file MHP.h.
| void ForkJoinAnalysis::collectSCEVInfo | ( | ) |
functions
Collect SCEV pass information for pointers at fork/join sites Because ScalarEvolution is a function pass, previous knowledge of a function may be overwritten when analyzing a new function. We use a internal wrapper class PTASCEV to record all the necessary information for determining symmetric fork/join inside loops
Definition at line 907 of file MHP.cpp.
|
inlineprivate |
Get CxtStmtSet for an instruction.
Definition at line 616 of file MHP.h.
Get directly and indirectly joined threadIDs based on a context-sensitive join site.
Return thread id(s) which are joined at this join site (1) thread t1 directly joins thread t2 (2) thread t1 indirectly joins thread t3 via directly joining t2 (t2 fully joins its child thread t3)
Definition at line 1306 of file MHP.cpp.
Get directly joined threadIDs based on a context-sensitive join site.
|
inlineprivate |
Get forked thread.
Definition at line 569 of file MHP.h.
|
inlineprivate |
Get joined thread.
Definition at line 574 of file MHP.h.
Whether a context-sensitive join satisfies symmetric loop pattern.
Definition at line 389 of file MHP.h.
|
inline |
Mark thread flags for cxtStmt.
Get the flag for a cxtStmt
Definition at line 466 of file MHP.h.
|
inline |
All SCEV-symmetric in-loop joins and their loop blocks.
|
inlineprivate |
|
private |
Handle call.
Definition at line 1169 of file MHP.cpp.
|
private |
Handle fork.
Definition at line 1054 of file MHP.cpp.
|
private |
Handle intra.
Definition at line 1283 of file MHP.cpp.
|
private |
Handle join.
for the join site in a loop loop which does not join the current thread we process the loop exit
Definition at line 1086 of file MHP.cpp.
|
private |
Handle return.
Definition at line 1199 of file MHP.cpp.
|
inlineprivate |
|
inline |
|
inline |
|
private |
Whether it is a matched fork join pair.
Definition at line 1431 of file MHP.cpp.
|
inlineprivate |
Return true if the fork and join have the same SCEV.
We assume a pair of fork and join sites are must-alias if they have same PTASCEV (1) SCEV not inside loop (2) SCEV inside two symmetric loops, then pointers of fork thread and join thread should have same scev start and step. and should have same loop trip count
Definition at line 1381 of file MHP.cpp.
|
inlineprivate |
Whether it is a fork site.
Definition at line 557 of file MHP.h.
|
inlineprivate |
Whether it is a join site.
Definition at line 563 of file MHP.h.
|
inlineprivate |
Transfer function for marking context-sensitive statement.
alive is at the bottom of the semilattice, nothing needs to be done here
Definition at line 490 of file MHP.h.
Initialize TDAlive and TDDead flags.
Definition at line 478 of file MHP.h.
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
Worklist operations.
|
private |
Same loop trip count.
The fork and join have same loop trip count
Definition at line 1405 of file MHP.cpp.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |