|
Static Value-Flow Analysis
|
#include <TCT.h>
Public Member Functions | |
| TCT (PointerAnalysis *p) | |
| Constructor. | |
| virtual | ~TCT () |
| Destructor. | |
| ThreadCallGraph * | getThreadCallGraph () const |
| Get TCG. | |
| PointerAnalysis * | getPTA () const |
| Get PTA. | |
| TCTNode * | getTCTNode (NodeID id) const |
| Get TCT node. | |
| TCTEdge * | hasGraphEdge (TCTNode *src, TCTNode *dst, TCTEdge::CEDGEK kind) const |
| Whether we have already created this call graph edge. | |
| TCTEdge * | getGraphEdge (TCTNode *src, TCTNode *dst, TCTEdge::CEDGEK kind) |
| Get call graph edge via nodes. | |
| ThreadCreateEdgeSet::const_iterator | getChildrenBegin (const TCTNode *node) const |
| Get children and parent nodes. | |
| ThreadCreateEdgeSet::const_iterator | getChildrenEnd (const TCTNode *node) const |
| ThreadCreateEdgeSet::const_iterator | getParentsBegin (const TCTNode *node) const |
| ThreadCreateEdgeSet::const_iterator | getParentsEnd (const TCTNode *node) const |
| const FunSet & | getMakredProcs () const |
| Get marked candidate functions. | |
| const FunSet & | getEntryProcs () const |
| Get marked candidate functions. | |
| u32_t | getTCTNodeNum () const |
| Get Statistics. | |
| u32_t | getTCTEdgeNum () const |
| u32_t | getMaxCxtSize () const |
| bool | isExtCall (const ICFGNode *inst) |
| Whether it is calling an external function. | |
| bool | isCallSite (const ICFGNode *inst) |
| Whether it is a callsite. | |
| bool | hasTCTNode (const CxtThread &ct) const |
| Find/Get TCT node. | |
| TCTNode * | getTCTNode (const CxtThread &ct) const |
| bool | isCandidateFun (const CallGraph::FunctionSet &callees) const |
| Whether it is a candidate function for indirect call. | |
| bool | isCandidateFun (const FunObjVar *fun) const |
| bool | inSameCallGraphSCC (const CallGraphNode *src, const CallGraphNode *dst) |
| Whether two functions in the same callgraph scc. | |
| bool | hasParentThread (NodeID tid) const |
| Get parent and sibling threads. | |
| NodeID | getParentThread (NodeID tid) const |
| Get parent thread. | |
| const NodeBS | getAncestorThread (NodeID tid) const |
| Get all ancestor threads. | |
| const NodeBS | getSiblingThread (NodeID tid) const |
| Get sibling threads. | |
| const CallStrCxt & | getCxtOfCxtThread (const CxtThread &ct) const |
| get the context of a thread at its spawning site (fork site) | |
| const FunObjVar * | getStartRoutineOfCxtThread (const CxtThread &ct) const |
| get the start routine function of a thread | |
| LoopBBs & | getJoinLoop (const CallICFGNode *join) |
| Get loop for join site. | |
| bool | hasJoinLoop (const CallICFGNode *join) const |
| bool | hasLoop (const SVFBasicBlock *bb) const |
| bool | hasLoop (const ICFGNode *inst) const |
| bool | isJoinMustExecutedInLoop (const LoopBBs &lp, const ICFGNode *join) |
| Return true if a join instruction must be executed inside a loop. | |
| const LoopBBs & | getLoop (const ICFGNode *inst) |
| Get loop for an instruction. | |
| const LoopBBs & | getLoop (const SVFBasicBlock *bb) |
| Get loop for fork/join site. | |
| void | pushCxt (CallStrCxt &cxt, const CallICFGNode *call, const FunObjVar *callee) |
| Push calling context. | |
| bool | matchCxt (CallStrCxt &cxt, const CallICFGNode *call, const FunObjVar *callee) |
| Match context. | |
| void | pushCxt (CallStrCxt &cxt, CallSiteID csId) |
| bool | isJoinSiteInRecursion (const CallICFGNode *join) const |
| Whether a join site is in recursion. | |
| void | dumpCxt (CallStrCxt &cxt) |
| Dump calling context. | |
| void | dump (const std::string &filename) |
| Dump the graph. | |
| void | print () const |
| Print TCT information. | |
Public Member Functions inherited from SVF::GenericGraph< NodeTy, EdgeTy > | |
| GenericGraph () | |
| Constructor. | |
| virtual | ~GenericGraph () |
| Destructor. | |
| void | destroy () |
| Release memory. | |
| iterator | begin () |
| Iterators. | |
| iterator | end () |
| const_iterator | begin () const |
| const_iterator | end () const |
| void | addGNode (NodeID id, NodeType *node) |
| Add a Node. | |
| NodeType * | getGNode (NodeID id) const |
| Get a node. | |
| bool | hasGNode (NodeID id) const |
| Has a node. | |
| void | removeGNode (NodeType *node) |
| Delete a node. | |
| u32_t | getTotalNodeNum () const |
| Get total number of node/edge. | |
| u32_t | getTotalEdgeNum () const |
| void | incNodeNum () |
| Increase number of node/edge. | |
| void | incEdgeNum () |
Private Member Functions | |
| TCTNode * | addTCTNode (const CxtThread &ct) |
| Add TCT node. | |
| bool | addTCTEdge (TCTNode *src, TCTNode *dst) |
| Add TCT edge. | |
| void | build () |
| Build TCT. | |
| void | markRelProcs () |
| Mark relevant procedures that are backward reachable from any fork/join site. | |
| void | markRelProcs (const FunObjVar *fun) |
| void | collectEntryFunInCallGraph () |
| Get entry functions that are neither called by other functions nor extern functions. | |
| void | collectMultiForkedThreads () |
| void | collectLoopInfoForJoin () |
| Handle join site in loop. | |
| bool | isLoopHeaderOfJoinLoop (const SVFBasicBlock *bb) |
| Whether a given bb is a loop head of a inloop join site. | |
| bool | isLoopExitOfJoinLoop (const SVFBasicBlock *bb) |
| Whether a given bb is an exit of a inloop join site. | |
| bool | isInLoopInstruction (const ICFGNode *inst) |
| Multi-forked threads. | |
| bool | isInRecursion (const ICFGNode *inst) const |
| Whether an instruction is in a recursion. | |
| void | handleCallRelation (CxtThreadProc &ctp, const CallGraphEdge *cgEdge, const CallICFGNode *call) |
| Handle call relations. | |
| TCTNode * | getOrCreateTCTNode (const CallStrCxt &cxt, const ICFGNode *fork, const CallStrCxt &oldCxt, const FunObjVar *routine) |
| Get or create a tct node based on CxtThread. | |
| void | setMultiForkedAttrs (CxtThread &ct) |
| Set multi-forked thread attributes. | |
| void | addCxtOfCxtThread (const CallStrCxt &cxt, const CxtThread &ct) |
| Add context for a thread at its spawning site (fork site) | |
| void | addStartRoutineOfCxtThread (const FunObjVar *fun, const CxtThread &ct) |
| Add start routine function of a cxt thread. | |
| bool | pushToCTPWorkList (const CxtThreadProc &ctp) |
| WorkList helper functions. | |
| CxtThreadProc | popFromCTPWorkList () |
| bool | isVisitedCTPs (const CxtThreadProc &ctp) const |
| void | destroy () |
| Clean up memory. | |
Private Attributes | |
| ThreadCallGraph * | tcg |
| PointerAnalysis * | pta |
| u32_t | TCTNodeNum |
| u32_t | TCTEdgeNum |
| u32_t | MaxCxtSize |
| FunSet | entryFuncSet |
| FunSet | candidateFuncSet |
| Procedures that are neither called by other functions nor extern functions. | |
| ThreadCallGraphSCC * | tcgSCC |
| Procedures we care about during call graph traversing when creating TCT. | |
| CxtThreadProcVec | ctpList |
| Thread call graph SCC. | |
| CxtThreadProcSet | visitedCTPs |
| CxtThreadProc List. | |
| CxtThreadToNodeMap | ctpToNodeMap |
| Record all visited ctps. | |
| CxtThreadToForkCxt | ctToForkCxtMap |
| Map a ctp to its graph node. | |
| CxtThreadToFun | ctToRoutineFunMap |
| Map a CxtThread to the context at its spawning site (fork site). | |
| InstToLoopMap | joinSiteToLoopMap |
| Map a CxtThread to its start routine function. | |
| Set< const ICFGNode * > | inRecurJoinSites |
| Fork or Join sites in recursions. | |
Additional Inherited Members | |
Public Attributes inherited from SVF::GenericGraph< NodeTy, EdgeTy > | |
| u32_t | edgeNum |
| total num of node | |
| u32_t | nodeNum |
| total num of edge | |
Protected Attributes inherited from SVF::GenericGraph< NodeTy, EdgeTy > | |
| IDToNodeMapTy | IDToNodeMap |
| node map | |
| typedef ThreadCreateEdgeSet::iterator SVF::TCT::TCTNodeIter |
|
inline |
Constructor.
Definition at line 173 of file TCT.h.
|
inlinevirtual |
Destructor.
|
inlineprivate |
|
inlineprivate |
Add TCT edge.
Definition at line 455 of file TCT.h.
Add TCT node.
Definition at line 444 of file TCT.h.
|
private |
Build TCT.
Start building TCT
Definition at line 384 of file TCT.cpp.
|
private |
Get entry functions that are neither called by other functions nor extern functions.
Get Main function
Definition at line 187 of file TCT.cpp.
|
private |
Handle join site in loop.
collect loop info for join sites
Collect loop info for join sites the in-loop join site must be joined if the loop is executed
Definition at line 315 of file TCT.cpp.
|
private |
Collect multi-forked threads whose 1, cxt is in loop or recursion; 2, parent thread is a multi-forked thread.
Collect all multi-forked threads
Definition at line 207 of file TCT.cpp.
|
inlineprivate |
| void TCT::dump | ( | const std::string & | filename | ) |
Dump the graph.
Dump call graph into dot file
Definition at line 514 of file TCT.cpp.
| void TCT::dumpCxt | ( | CallStrCxt & | cxt | ) |
Dump calling context.
Dump calling context information
Definition at line 496 of file TCT.cpp.
Get all ancestor threads.
Definition at line 323 of file TCT.h.
|
inline |
Get marked candidate functions.
| TCTEdge * TCT::getGraphEdge | ( | TCTNode * | src, |
| TCTNode * | dst, | ||
| TCTEdge::CEDGEK | kind | ||
| ) |
Get call graph edge via nodes.
get PTACallGraph edge via nodes
Definition at line 552 of file TCT.cpp.
|
inline |
Get loop for join site.
Definition at line 379 of file TCT.h.
| const TCT::LoopBBs & TCT::getLoop | ( | const SVFBasicBlock * | bb | ) |
Get loop for fork/join site.
Get loop for fork/join site
|
inline |
|
inlineprivate |
Get or create a tct node based on CxtThread.
Definition at line 507 of file TCT.h.
|
inline |
Get sibling threads.
Definition at line 344 of file TCT.h.
|
inline |
Get TCT node.
|
inline |
|
inline |
|
private |
Handle call relations.
Handle call relations
Create spawnee TCT node
Add TCT nodes and edge
Definition at line 245 of file TCT.cpp.
| TCTEdge * TCT::hasGraphEdge | ( | TCTNode * | src, |
| TCTNode * | dst, | ||
| TCTEdge::CEDGEK | kind | ||
| ) | const |
|
inline |
|
inline |
Get parent and sibling threads.
Has parent thread
Find/Get TCT node.
|
inline |
|
inline |
Multi-forked threads.
Whether an instruction is in a loop
An instruction i is in loop (1) the instruction i itself (2) all the callsites invoke the function where i resides in
Definition at line 46 of file TCT.cpp.
Whether an instruction is in a recursion.
An instruction i is in a recursion (1) the function f where i resides in is in a recursion (2) any caller function starting from the function f in is in a recursion
Definition at line 91 of file TCT.cpp.
Return true if a join instruction must be executed inside a loop.
Return true if a join instruction must be executed inside a loop joinbb should post dominate the successive basic block of a loop header
Definition at line 291 of file TCT.cpp.
|
inline |
|
private |
Whether a given bb is an exit of a inloop join site.
Whether a given bb is an exit of a inloop join site
Definition at line 354 of file TCT.cpp.
|
private |
Whether a given bb is a loop head of a inloop join site.
Return true if a given bb is a loop head of a inloop join site
Definition at line 340 of file TCT.cpp.
|
inlineprivate |
|
private |
Mark relevant procedures that are backward reachable from any fork/join site.
Mark relevant procedures that are backward reachable from any fork/join site
Definition at line 133 of file TCT.cpp.
Definition at line 161 of file TCT.cpp.
| bool TCT::matchCxt | ( | CallStrCxt & | cxt, |
| const CallICFGNode * | call, | ||
| const FunObjVar * | callee | ||
| ) |
Match context.
Match calling context
handle calling context for candidate functions only
partial match
Definition at line 466 of file TCT.cpp.
|
inlineprivate |
| void TCT::print | ( | ) | const |
|
inline |
| void TCT::pushCxt | ( | CallStrCxt & | cxt, |
| const CallICFGNode * | call, | ||
| const FunObjVar * | callee | ||
| ) |
|
inlineprivate |
|
inlineprivate |
Set multi-forked thread attributes.
non-main thread
main thread
Definition at line 525 of file TCT.h.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |