Static Value-Flow Analysis
|
#include <PCG.h>
Public Types | |
typedef Set< const SVFFunction * > | FunSet |
typedef std::vector< const SVFFunction * > | FunVec |
typedef Set< const SVFInstruction * > | CallInstSet |
typedef FIFOWorkList< const SVFFunction * > | FunWorkList |
typedef FIFOWorkList< const SVFBasicBlock * > | BBWorkList |
Public Member Functions | |
PCG (PointerAnalysis *an) | |
Constructor. More... | |
virtual bool | analyze () |
We start the pass here. More... | |
virtual | ~PCG () |
Destructor. More... | |
CallICFGNode * | getCallICFGNode (const SVFInstruction *inst) |
virtual bool | mayHappenInParallel (const SVFInstruction *i1, const SVFInstruction *i2) const |
Interface to query whether two function may happen-in-parallel. More... | |
bool | mayHappenInParallelBetweenFunctions (const SVFFunction *fun1, const SVFFunction *fun2) const |
const FunSet & | getMHPFunctions () const |
void | initFromThreadAPI (SVFModule *module) |
Initialize spawner and spawnee sets with threadAPI. More... | |
void | inferFromCallGraph () |
Infer spawner spawnee and followers sets by traversing on callGraph. More... | |
void | collectSpawners () |
void | collectSpawnees () |
void | collectFollowers () |
void | identifyFollowers () |
const FunSet & | getSpawners () const |
Get spawners/spawnees/followers. More... | |
const FunSet & | getSpawnees () const |
const FunSet & | getFollowers () const |
FunSet::const_iterator | spawnersBegin (const SVFFunction *fun) const |
Iterators for thread properties of a procedure. More... | |
FunSet::const_iterator | spawnersEnd (const SVFFunction *fun) const |
FunSet::const_iterator | spawneesBegin (const SVFFunction *fun) const |
FunSet::const_iterator | spawneesEnd (const SVFFunction *fun) const |
FunSet::const_iterator | followersBegin (const SVFFunction *fun) const |
FunSet::const_iterator | followersEnd (const SVFFunction *fun) const |
void | interferenceAnalysis () |
Thread interferenceAnalysis. More... | |
void | printResults () |
Print analysis results. More... | |
void | printTDFuns () |
Private Member Functions | |
bool | isSpawnerFun (const SVFFunction *fun) const |
Add/Get methods for thread properties of a procedure. More... | |
bool | isSpawneeFun (const SVFFunction *fun) const |
bool | isFollowerFun (const SVFFunction *fun) const |
bool | addSpawnerFun (const SVFFunction *fun) |
bool | addSpawneeFun (const SVFFunction *fun) |
bool | addFollowerFun (const SVFFunction *fun) |
bool | addSpawnsite (const SVFInstruction *callInst) |
Add/search spawn sites which directly or indirectly create a thread. More... | |
bool | isSpawnsite (const SVFInstruction *callInst) |
CallInstSet::const_iterator | spawnSitesBegin () const |
Spawn sites iterators. More... | |
CallInstSet::const_iterator | spawnSitesEnd () const |
Private Attributes | |
FunSet | spawners |
FunSet | spawnees |
FunSet | followers |
FunSet | mhpfuns |
PTACallGraph * | callgraph |
SVFModule * | mod |
PointerAnalysis * | pta |
ThreadAPI * | tdAPI |
CallInstSet | spawnCallSites |
Callsites direct or Indirect call a function which spawn a thread. More... | |
This class serves as a base may-happen in parallel analysis for multithreaded program It distinguish thread spawner, spawnee, follower in procedure level by modeling pthread_create, pthread_join, pthread_exit, pthread_cancel synchronization operations
typedef FIFOWorkList<const SVFBasicBlock*> SVF::PCG::BBWorkList |
typedef Set<const SVFInstruction*> SVF::PCG::CallInstSet |
typedef Set<const SVFFunction*> SVF::PCG::FunSet |
typedef std::vector<const SVFFunction*> SVF::PCG::FunVec |
typedef FIFOWorkList<const SVFFunction*> SVF::PCG::FunWorkList |
|
inline |
Constructor.
Definition at line 133 of file PCG.h.
|
inlinevirtual |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
virtual |
We start the pass here.
Whether two functions may happen in parallel
Definition at line 49 of file PCG.cpp.
void PCG::collectFollowers | ( | ) |
collect follower procedures which may be called after pthread_create is invoked directly or indirectly a procedure which is called from a follower is also a follower.
identify initial followers
find all the followers recursively on call graph
Definition at line 265 of file PCG.cpp.
void PCG::collectSpawnees | ( | ) |
spawnee: given a spawnee, all its callees on callgraph are spawnees
find all the spawnees recursively on call graph
Definition at line 187 of file PCG.cpp.
void PCG::collectSpawners | ( | ) |
spawner: given a spawner, all its callers on callgraph are spawners
find all the spawners recursively on call graph
add all the callsites from callers to callee (spawner) as a spawn site.
Definition at line 146 of file PCG.cpp.
|
inline |
|
inline |
|
inline |
Definition at line 148 of file PCG.h.
|
inline |
|
inline |
|
inline |
|
inline |
void PCG::identifyFollowers | ( | ) |
Identify initial followers a procedure whose callsite lies in a control flow path that starts just after a spawner's callsite
Definition at line 217 of file PCG.cpp.
void PCG::inferFromCallGraph | ( | ) |
Infer spawner spawnee and followers sets by traversing on callGraph.
Infer spawners and spawnees from call graph. The inference are recursively done spawners: procedures may create a thread and return with the created thread still running spawnees: procedures may be executed as a spawned thread followers: procedures may be invoked by a thread after the thread returns from a spawner (procedure may be called after pthread_creat is called).
Definition at line 133 of file PCG.cpp.
void PCG::initFromThreadAPI | ( | SVFModule * | module | ) |
Initialize spawner and spawnee sets with threadAPI.
Initialize thread spawners and spawnees from threadAPI functions a procedure is a spawner if it creates a thread and the created thread is still existent on its return a procedure is a spawnee if it is created by fork call
TODO: handle indirect call here for the fork Fun
Definition at line 96 of file PCG.cpp.
void PCG::interferenceAnalysis | ( | ) |
Thread interferenceAnalysis.
Thread interference analysis, Suppose we have a undirected graph G = {F,E,I} F denotes procedure, E represents interference edge (x,y) \in E, x \in F, y \in F means execution of x in one thread may overlap execution of y in another thread I(x,y) is a set of memory locations for this interference edge
Definition at line 302 of file PCG.cpp.
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
virtual |
bool PCG::mayHappenInParallelBetweenFunctions | ( | const SVFFunction * | fun1, |
const SVFFunction * | fun2 | ||
) | const |
void PCG::printResults | ( | ) |
Print analysis results.
Print analysis results
void PCG::printTDFuns | ( | ) |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlineprivate |
Spawn sites iterators.
|
inlineprivate |
|
private |
|
private |
|
private |