118 assert(!
"ei_pairs not grouped by type");
127 assert(!
"duplicate name in ei_pairs");
189 assert(
funArgList.size() == 1 &&
"num of pthread forked function args is not 1!");
201 const CallICFGNode* call = SVFUtil::dyn_cast<CallICFGNode>(cs);
202 assert(call &&
"not a call ICFGNode?");
213 if(SVFUtil::isa<LoadStmt>(
stmt))
214 return stmt->getSrcNode();
216 if(SVFUtil::isa<SVFArgument>(
join->getValue()))
219 assert(
false &&
"the value of the first argument at join is not a load instruction?");
388 std::string
name(
module->getModuleIdentifier());
395 <<
")###############\n";
406 SVFUtil::outs() <<
"#######################################################"
static const ei_pair ei_pairs[]
static const ei_pair ei_pairs[]
const ValVar * getArgument(u32_t ArgNo) const
Parameter operations.
const SVFFunction * getCalledFunction() const
const std::vector< const ICFGNode * > & getICFGNodeList() const
const_iterator end() const
std::vector< constSVFBasicBlock * >::const_iterator const_iterator
CallGraph * getCallGraph()
std::vector< const SVFVar * > SVFVarList
const SVFVarList & getFunArgsList(const SVFFunction *func) const
Get function arguments list.
static SVFIR * getPAG(bool buildFromFile=false)
Singleton design here to make sure we only have one instance during any analysis.
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.
const SVFVar * getFormalParmOfForkedFun(const SVFFunction *F) const
Return the formal parm of forked function (the first arg in pthread)
bool isTDRelease(const CallICFGNode *inst) const
Return true if this call release a lock.
void performAPIStat(SVFModule *m)
const SVFVar * getLockVal(const ICFGNode *inst) const
Return lock value.
TD_TYPE getType(const SVFFunction *F) const
Get the function type if it is a threadAPI function.
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.
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.
bool isCallSite(const SVFValue *val)
Whether an instruction is a call or invoke instruction.
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