Skip to content

Commit

Permalink
Update svflib
Browse files Browse the repository at this point in the history
  • Loading branch information
yuleisui committed Aug 26, 2024
1 parent 6f44015 commit ed9fbe8
Show file tree
Hide file tree
Showing 12 changed files with 16 additions and 92 deletions.
Binary file modified SVF-osx/Release-build/bin/ae
Binary file not shown.
Binary file modified SVF-osx/Release-build/bin/cfl
Binary file not shown.
Binary file modified SVF-osx/Release-build/bin/dvf
Binary file not shown.
Binary file modified SVF-osx/Release-build/bin/llvm2svf
Binary file not shown.
Binary file modified SVF-osx/Release-build/bin/mta
Binary file not shown.
Binary file modified SVF-osx/Release-build/bin/saber
Binary file not shown.
Binary file modified SVF-osx/Release-build/bin/svf-ex
Binary file not shown.
Binary file modified SVF-osx/Release-build/bin/wpa
Binary file not shown.
52 changes: 15 additions & 37 deletions SVF-osx/Release-build/include/Util/SVFUtil.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,14 +169,8 @@ void dumpPointsToList(const PointsToList& ptl);
/// Return true if it is an llvm intrinsic instruction
bool isIntrinsicInst(const SVFInstruction* inst);
bool isIntrinsicInst(const ICFGNode* inst);

//@}

/// Whether an instruction is a call or invoke instruction
inline bool isCallSite(const SVFInstruction* inst)
{
return SVFUtil::isa<SVFCallInst>(inst);
}
/// Whether an instruction is a call or invoke instruction
inline bool isCallSite(const SVFValue* val)
{
Expand Down Expand Up @@ -207,31 +201,15 @@ inline bool isNonInstricCallSite(const ICFGNode* inst)
}



/// Return callsite given an instruction
CallSite getSVFCallSite(const ICFGNode* inst);

/// Return callsite given an instruction
inline CallSite getSVFCallSite(const SVFInstruction* inst)
{
assert(isCallSite(inst) && "not a callsite?");
CallSite cs(inst);
return cs;
}

/// Match arguments for callsite at caller and callee
/// if the arg size does not match then we do not need to connect this parameter
/// unless the callee is a variadic function (the first parameter of variadic function is its parameter number)
bool matchArgs(const CallSite cs, const SVFFunction* callee);
bool matchArgs(const CallICFGNode* cs, const SVFFunction* callee);

/// Return LLVM callsite given a value
inline CallSite getSVFCallSite(const SVFValue* value)
{
assert(isCallSite(value) && "not a callsite?");
const SVFCallInst* svfInst = SVFUtil::cast<SVFCallInst>(value);
CallSite cs(svfInst);
return cs;
}

/// Split into two substrings around the first occurrence of a separator string.
inline std::vector<std::string> split(const std::string& s, char separator)
Expand Down Expand Up @@ -423,7 +401,7 @@ inline bool isArgOfUncalledFunction(const SVFValue* svfval)

/// Return thread fork function
//@{
inline const SVFValue* getForkedFun(const SVFInstruction *inst)
inline const SVFValue* getForkedFun(const ICFGNode *inst)
{
return ThreadAPI::getThreadAPI()->getForkedFun(inst);
}
Expand Down Expand Up @@ -488,57 +466,57 @@ inline bool isReallocExtCall(const CallSite cs)

/// Return true if this is a thread creation call
///@{
inline bool isThreadForkCall(const SVFInstruction *inst)
inline bool isThreadForkCall(const ICFGNode *inst)
{
return ThreadAPI::getThreadAPI()->isTDFork(inst);
}
//@}

/// Return true if this is a thread join call
///@{
inline bool isThreadJoinCall(const CallSite cs)
inline bool isThreadJoinCall(const ICFGNode* cs)
{
return ThreadAPI::getThreadAPI()->isTDJoin(cs.getInstruction());
return ThreadAPI::getThreadAPI()->isTDJoin(cs);
}
//@}

/// Return true if this is a thread exit call
///@{
inline bool isThreadExitCall(const CallSite cs)
inline bool isThreadExitCall(const ICFGNode* cs)
{
return ThreadAPI::getThreadAPI()->isTDExit(cs.getInstruction());
return ThreadAPI::getThreadAPI()->isTDExit(cs);
}
//@}

/// Return true if this is a lock acquire call
///@{
inline bool isLockAquireCall(const CallSite cs)
inline bool isLockAquireCall(const ICFGNode* cs)
{
return ThreadAPI::getThreadAPI()->isTDAcquire(cs.getInstruction());
return ThreadAPI::getThreadAPI()->isTDAcquire(cs);
}
//@}

/// Return true if this is a lock acquire call
///@{
inline bool isLockReleaseCall(const CallSite cs)
inline bool isLockReleaseCall(const ICFGNode* cs)
{
return ThreadAPI::getThreadAPI()->isTDRelease(cs.getInstruction());
return ThreadAPI::getThreadAPI()->isTDRelease(cs);
}
//@}

/// Return true if this is a barrier wait call
//@{
inline bool isBarrierWaitCall(const CallSite cs)
inline bool isBarrierWaitCall(const ICFGNode* cs)
{
return ThreadAPI::getThreadAPI()->isTDBarWait(cs.getInstruction());
return ThreadAPI::getThreadAPI()->isTDBarWait(cs);
}
//@}

/// Return sole argument of the thread routine
//@{
inline const SVFValue* getActualParmAtForkSite(const CallSite cs)
inline const SVFValue* getActualParmAtForkSite(const ICFGNode* cs)
{
return ThreadAPI::getThreadAPI()->getActualParmAtForkSite(cs.getInstruction());
return ThreadAPI::getThreadAPI()->getActualParmAtForkSite(cs);
}
//@}

Expand Down
56 changes: 1 addition & 55 deletions SVF-osx/Release-build/include/Util/ThreadAPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ namespace SVF

class SVFModule;
class ICFGNode;
class CallICFGNode;

/*
* ThreadAPI class contains interfaces for pthread programs
Expand Down Expand Up @@ -121,8 +122,6 @@ class ThreadAPI
/// Return the callee/callsite/func
//@{
const SVFFunction* getCallee(const ICFGNode *inst) const;
const SVFFunction* getCallee(const SVFInstruction *inst) const;
const CallSite getSVFCallSite(const SVFInstruction *inst) const;
const CallSite getSVFCallSite(const ICFGNode *inst) const;
//@}

Expand All @@ -132,10 +131,6 @@ class ThreadAPI
{
return getType(getCallee(inst)) == TD_FORK;
}
inline bool isTDFork(const SVFInstruction* cs) const
{
return getType(getCallee(cs)) == TD_FORK;
}
//@}

/// Return arguments/attributes of pthread_create / hare_parallel_for
Expand All @@ -148,13 +143,6 @@ class ThreadAPI
CallSite cs = getSVFCallSite(inst);
return cs.getArgument(0);
}
inline const SVFValue* getForkedThread(const SVFInstruction* inst) const
{
assert(isTDFork(inst) && "not a thread fork function!");
CallSite cs = getSVFCallSite(inst);
return cs.getArgument(0);
}

/// Return the third argument of the call,
/// Note that, it could be function type or a void* pointer
inline const SVFValue* getForkedFun(const ICFGNode *inst) const
Expand All @@ -163,12 +151,6 @@ class ThreadAPI
CallSite cs = getSVFCallSite(inst);
return cs.getArgument(2);
}
inline const SVFValue* getForkedFun(const SVFInstruction* inst) const
{
assert(isTDFork(inst) && "not a thread fork function!");
CallSite cs = getSVFCallSite(inst);
return cs.getArgument(2);
}

/// Return the forth argument of the call,
/// Note that, it is the sole argument of start routine ( a void* pointer )
Expand All @@ -178,12 +160,6 @@ class ThreadAPI
CallSite cs = getSVFCallSite(inst);
return cs.getArgument(3);
}
inline const SVFValue* getActualParmAtForkSite(const SVFInstruction* inst) const
{
assert(isTDFork(inst) && "not a thread fork function!");
CallSite cs = getSVFCallSite(inst);
return cs.getArgument(3);
}
//@}

/// Return true if this call wait for a worker thread
Expand All @@ -192,10 +168,6 @@ class ThreadAPI
{
return getType(getCallee(inst)) == TD_JOIN;
}
inline bool isTDJoin(const SVFInstruction* inst) const
{
return getType(getCallee(inst)) == TD_JOIN;
}
//@}

/// Return arguments/attributes of pthread_join
Expand All @@ -211,12 +183,6 @@ class ThreadAPI
CallSite cs = getSVFCallSite(inst);
return cs.getArgument(1);
}
inline const SVFValue* getRetParmAtJoinedSite(const SVFInstruction* inst) const
{
assert(isTDJoin(inst) && "not a thread join function!");
CallSite cs = getSVFCallSite(inst);
return cs.getArgument(1);
}
//@}


Expand All @@ -226,11 +192,6 @@ class ThreadAPI
{
return getType(getCallee(inst)) == TD_EXIT;
}

inline bool isTDExit(const SVFInstruction* inst) const
{
return getType(getCallee(inst)) == TD_EXIT;
}
//@}

/// Return true if this call acquire a lock
Expand All @@ -239,11 +200,6 @@ class ThreadAPI
{
return getType(getCallee(inst)) == TD_ACQUIRE;
}

inline bool isTDAcquire(const SVFInstruction* inst) const
{
return getType(getCallee(inst)) == TD_ACQUIRE;
}
//@}

/// Return true if this call release a lock
Expand All @@ -252,11 +208,6 @@ class ThreadAPI
{
return getType(getCallee(inst)) == TD_RELEASE;
}

inline bool isTDRelease(const SVFInstruction* inst) const
{
return getType(getCallee(inst)) == TD_RELEASE;
}
//@}

/// Return lock value
Expand All @@ -271,11 +222,6 @@ class ThreadAPI
{
return getType(getCallee(inst)) == TD_BAR_WAIT;
}

inline bool isTDBarWait(const SVFInstruction* inst) const
{
return getType(getCallee(inst)) == TD_BAR_WAIT;
}
//@}

void performAPIStat(SVFModule* m);
Expand Down
Binary file modified SVF-osx/Release-build/lib/libSvfCore.a
Binary file not shown.
Binary file modified SVF-osx/Release-build/lib/libSvfLLVM.a
Binary file not shown.

0 comments on commit ed9fbe8

Please sign in to comment.