57 std::vector<const SVF::SVFVar*> worklist{
joinArg};
58 while (!worklist.empty())
62 if (!visited.insert(
v->getId()).second)
67 if (
const SVF::LoadStmt* load = SVF::SVFUtil::dyn_cast<SVF::LoadStmt>(
st))
70 worklist.push_back(
copy->getRHSVar());
73 worklist.push_back(
phi->getOpVar(
i));
75 worklist.push_back(
gep->getRHSVar());
76 else if (
const SVF::CallPE* call = SVF::SVFUtil::dyn_cast<SVF::CallPE>(
st))
78 worklist.push_back(call->getOpVar(
i));
162 assert(!
"ei_pairs not grouped by type");
171 assert(!
"duplicate name in ei_pairs");
245 assert(
funArgList.size() == 1 &&
"num of pthread forked function args is not 1!");
257 const CallICFGNode* call = SVFUtil::dyn_cast<CallICFGNode>(cs);
258 assert(call &&
"not a call ICFGNode?");
369 const FunObjVar* fun = SVFUtil::cast<CallICFGNode>(
svfInst)->getCalledFunction();
480 <<
")###############\n";
486 std::string
apiName = it->first;
491 SVFUtil::outs() <<
"#######################################################"
static const ei_pair ei_pairs[]
static const ei_pair ei_pairs[]
const ValVar * getArgument(u32_t ArgNo) const
Parameter operations.
const FunObjVar * getCalledFunction() const
BasicBlockGraph::IDToNodeMapTy::const_iterator const_bb_iterator
virtual const PointsTo & getPts(NodeID ptr)=0
Get points-to targets of a pointer. It needs to be implemented in child class.
virtual AliasResult alias(const SVFVar *V1, const SVFVar *V2)=0
Interface exposed to users of our pointer analysis, given Value infos.
const std::vector< const ICFGNode * > & getICFGNodeList() const
const ValVarList & getFunArgsList(const FunObjVar *func) const
Get function arguments list.
std::vector< const ValVar * > ValVarList
const CallGraph * getCallGraph()
Get CG.
static SVFIR * getPAG(bool buildFromFile=false)
Singleton design here to make sure we only have one instance during any analysis.
virtual const std::string & getName() const
const ValVar * getForkedFun(const CallICFGNode *inst) const
bool isTDFork(const CallICFGNode *inst) const
Return true if this call create a new thread.
static ThreadAPI * tdAPI
Static reference.
@ TD_COND_SIGNAL
wait a condition
@ TD_DETACH
wait for a thread to join
@ TD_CONDVAR_INI
initial a mutex variable
@ HARE_PAR_FOR
Barrier wait.
@ TD_BAR_INIT
initial a mutex variable
@ TD_ACQUIRE
detach a thread directly instead wait for it to join
@ TD_MUTEX_DESTROY
initial a mutex variable
@ TD_CONDVAR_DESTROY
initial a mutex variable
@ TD_JOIN
create a new thread
@ TD_BAR_WAIT
Barrier init.
@ TD_COND_BROADCAST
signal a condition
@ TD_COND_WAIT
cancel a thread by another
@ TD_TRY_ACQUIRE
acquire a lock
@ TD_MUTEX_INI
broadcast a condition
@ TD_RELEASE
try to acquire a lock
@ TD_CANCEL
exit/kill a thread
const ValVar * getForkedThread(const CallICFGNode *inst) const
Return arguments/attributes of pthread_create / hare_parallel_for.
TDAPIMap tdAPIMap
API map, from a string to threadAPI type.
bool isTDJoin(const CallICFGNode *inst) const
Return true if this call wait for a worker thread.
void init()
Initialize the map.
bool isTDRelease(const CallICFGNode *inst) const
Return true if this call release a lock.
const SVFVar * getFormalParmOfForkedFun(const FunObjVar *F) const
Return the formal parm of forked function (the first arg in pthread)
const SVFVar * getLockVal(const ICFGNode *inst) const
Return lock value.
bool isTDExit(const CallICFGNode *inst) const
Return true if this call exits/terminate a thread.
const SVFVar * getRetParmAtJoinedSite(const CallICFGNode *inst) const
void statInit(Map< std::string, u32_t > &tdAPIStatMap)
const SVFVar * getJoinedThread(const CallICFGNode *inst) const
Return arguments/attributes of pthread_join.
bool isAliasedForkJoin(PointerAnalysis *pta, const SVFVar *forkArg, const SVFVar *joinArg) const
const ValVar * getActualParmAtForkSite(const CallICFGNode *inst) const
bool isTDBarWait(const CallICFGNode *inst) const
Return true if this call waits for a barrier.
bool isTDAcquire(const CallICFGNode *inst) const
Return true if this call acquire a lock.
TD_TYPE getType(const FunObjVar *F) const
Get the function type if it is a threadAPI function.
bool isCallSite(const ICFGNode *inst)
std::ostream & outs()
Overwrite llvm::outs()
std::vector< std::string > split(const std::string &s, char separator)
Split into two substrings around the first occurrence of a separator string.
std::unordered_map< Key, Value, Hash, KeyEqual, Allocator > Map
llvm::IRBuilder IRBuilder
If fork join the same thread.