svf-lib 1.0.1289 → 1.0.1291
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/SVF-linux/Release-build/lib/libSvf.a +0 -0
- package/SVF-linux/include/CFL/CFLAlias.h +1 -1
- package/SVF-linux/include/CFL/CFLBase.h +1 -1
- package/SVF-linux/include/CFL/CFLGrammar.h +1 -1
- package/SVF-linux/include/DDA/DDAClient.h +2 -2
- package/SVF-linux/include/DDA/DDAPass.h +3 -3
- package/SVF-linux/include/Graphs/CHG.h +5 -5
- package/SVF-linux/include/Graphs/ConsG.h +1 -1
- package/SVF-linux/include/Graphs/ConsGEdge.h +1 -1
- package/SVF-linux/include/Graphs/GenericGraph.h +1 -1
- package/SVF-linux/include/Graphs/ICFG.h +1 -1
- package/SVF-linux/include/Graphs/ICFGEdge.h +3 -3
- package/SVF-linux/include/Graphs/IRGraph.h +13 -9
- package/SVF-linux/include/Graphs/PTACallGraph.h +1 -1
- package/SVF-linux/include/Graphs/SVFGOPT.h +2 -2
- package/SVF-linux/include/Graphs/ThreadCallGraph.h +2 -2
- package/SVF-linux/include/Graphs/VFG.h +1 -1
- package/SVF-linux/include/Graphs/VFGNode.h +7 -7
- package/SVF-linux/include/MSSA/MemRegion.h +2 -2
- package/SVF-linux/include/MTA/LockAnalysis.h +1 -4
- package/SVF-linux/include/MTA/MHP.h +22 -31
- package/SVF-linux/include/MTA/MTA.h +13 -32
- package/SVF-linux/include/MTA/MTAResultValidator.h +17 -16
- package/SVF-linux/include/MTA/MTAStat.h +1 -1
- package/SVF-linux/include/MTA/TCT.h +25 -18
- package/SVF-linux/include/MemoryModel/AbstractPointsToDS.h +1 -1
- package/SVF-linux/include/MemoryModel/ConditionalPT.h +3 -2
- package/SVF-linux/include/MemoryModel/LocationSet.h +4 -4
- package/SVF-linux/include/MemoryModel/MutablePointsToDS.h +1 -1
- package/SVF-linux/include/MemoryModel/PersistentPointsToCache.h +1 -1
- package/SVF-linux/include/MemoryModel/PointerAnalysis.h +5 -4
- package/SVF-linux/include/MemoryModel/PointerAnalysisImpl.h +4 -4
- package/SVF-linux/include/MemoryModel/PointsTo.h +1 -1
- package/SVF-linux/include/MemoryModel/SVFLoop.h +1 -1
- package/SVF-linux/include/SABER/DoubleFreeChecker.h +2 -2
- package/SVF-linux/include/SABER/FileChecker.h +2 -2
- package/SVF-linux/include/SABER/LeakChecker.h +2 -2
- package/SVF-linux/include/SABER/ProgSlice.h +0 -3
- package/SVF-linux/include/SABER/SaberCondAllocator.h +7 -9
- package/SVF-linux/include/SABER/SaberSVFGBuilder.h +1 -1
- package/SVF-linux/include/SVF-LLVM/BasicTypes.h +248 -0
- package/SVF-linux/include/SVF-LLVM/BreakConstantExpr.h +94 -0
- package/SVF-linux/include/SVF-LLVM/CHGBuilder.h +73 -0
- package/SVF-linux/include/SVF-LLVM/CPPUtil.h +130 -0
- package/SVF-linux/include/SVF-LLVM/DCHG.h +481 -0
- package/SVF-linux/include/SVF-LLVM/GEPTypeBridgeIterator.h +183 -0
- package/SVF-linux/include/SVF-LLVM/ICFGBuilder.h +106 -0
- package/SVF-linux/include/SVF-LLVM/IRAnnotator.h +323 -0
- package/SVF-linux/include/SVF-LLVM/LLVMLoopAnalysis.h +59 -0
- package/SVF-linux/include/SVF-LLVM/LLVMModule.h +358 -0
- package/SVF-linux/include/SVF-LLVM/LLVMUtil.h +405 -0
- package/SVF-linux/include/SVF-LLVM/SVFIRBuilder.h +413 -0
- package/SVF-linux/include/SVF-LLVM/SymbolTableBuilder.h +113 -0
- package/SVF-linux/include/SVFIR/PAGBuilderFromFile.h +80 -0
- package/SVF-linux/include/SVFIR/SVFIR.h +661 -0
- package/SVF-linux/include/SVFIR/SVFModule.h +233 -0
- package/SVF-linux/include/SVFIR/SVFStatements.h +1101 -0
- package/SVF-linux/include/SVFIR/SVFType.h +514 -0
- package/SVF-linux/include/SVFIR/SVFValue.h +1129 -0
- package/SVF-linux/include/SVFIR/SVFVariables.h +721 -0
- package/SVF-linux/include/SVFIR/SymbolTableInfo.h +597 -0
- package/SVF-linux/include/Util/Annotator.h +1 -1
- package/SVF-linux/include/Util/CallGraphBuilder.h +74 -0
- package/SVF-linux/include/Util/Casting.h +1 -3
- package/SVF-linux/include/Util/CoreBitVector.h +1 -1
- package/SVF-linux/include/Util/CxtStmt.h +8 -8
- package/SVF-linux/include/Util/DPItem.h +1 -1
- package/SVF-linux/include/Util/ExtAPI.h +1 -1
- package/SVF-linux/include/Util/NodeIDAllocator.h +1 -1
- package/SVF-linux/include/Util/Options.h +1 -0
- package/SVF-linux/include/Util/PTAStat.h +1 -1
- package/SVF-linux/include/Util/SCC.h +1 -1
- package/SVF-linux/include/Util/SVFUtil.h +26 -95
- package/SVF-linux/include/Util/ThreadAPI.h +27 -27
- package/SVF-linux/include/Util/WorkList.h +1 -1
- package/SVF-linux/include/Util/Z3Expr.h +1 -1
- package/SVF-linux/include/WPA/Andersen.h +1 -1
- package/SVF-linux/include/WPA/CSC.h +1 -1
- package/SVF-linux/include/WPA/TypeAnalysis.h +0 -3
- package/SVF-linux/include/WPA/WPAPass.h +8 -8
- package/SVF-osx/Release-build/lib/libSvf.a +0 -0
- package/SVF-osx/include/CFL/CFLAlias.h +1 -1
- package/SVF-osx/include/CFL/CFLBase.h +1 -1
- package/SVF-osx/include/CFL/CFLGrammar.h +1 -1
- package/SVF-osx/include/DDA/DDAClient.h +2 -2
- package/SVF-osx/include/DDA/DDAPass.h +3 -3
- package/SVF-osx/include/Graphs/CHG.h +5 -5
- package/SVF-osx/include/Graphs/ConsG.h +1 -1
- package/SVF-osx/include/Graphs/ConsGEdge.h +1 -1
- package/SVF-osx/include/Graphs/GenericGraph.h +1 -1
- package/SVF-osx/include/Graphs/ICFG.h +1 -1
- package/SVF-osx/include/Graphs/ICFGEdge.h +3 -3
- package/SVF-osx/include/Graphs/IRGraph.h +13 -9
- package/SVF-osx/include/Graphs/PTACallGraph.h +1 -1
- package/SVF-osx/include/Graphs/SVFGOPT.h +2 -2
- package/SVF-osx/include/Graphs/ThreadCallGraph.h +2 -2
- package/SVF-osx/include/Graphs/VFG.h +1 -1
- package/SVF-osx/include/Graphs/VFGNode.h +7 -7
- package/SVF-osx/include/MSSA/MemRegion.h +2 -2
- package/SVF-osx/include/MTA/LockAnalysis.h +1 -4
- package/SVF-osx/include/MTA/MHP.h +22 -31
- package/SVF-osx/include/MTA/MTA.h +13 -32
- package/SVF-osx/include/MTA/MTAResultValidator.h +17 -16
- package/SVF-osx/include/MTA/MTAStat.h +1 -1
- package/SVF-osx/include/MTA/TCT.h +25 -18
- package/SVF-osx/include/MemoryModel/AbstractPointsToDS.h +1 -1
- package/SVF-osx/include/MemoryModel/ConditionalPT.h +3 -2
- package/SVF-osx/include/MemoryModel/LocationSet.h +4 -4
- package/SVF-osx/include/MemoryModel/MutablePointsToDS.h +1 -1
- package/SVF-osx/include/MemoryModel/PersistentPointsToCache.h +1 -1
- package/SVF-osx/include/MemoryModel/PointerAnalysis.h +5 -4
- package/SVF-osx/include/MemoryModel/PointerAnalysisImpl.h +4 -4
- package/SVF-osx/include/MemoryModel/PointsTo.h +1 -1
- package/SVF-osx/include/MemoryModel/SVFLoop.h +1 -1
- package/SVF-osx/include/SABER/DoubleFreeChecker.h +2 -2
- package/SVF-osx/include/SABER/FileChecker.h +2 -2
- package/SVF-osx/include/SABER/LeakChecker.h +2 -2
- package/SVF-osx/include/SABER/ProgSlice.h +0 -3
- package/SVF-osx/include/SABER/SaberCondAllocator.h +7 -9
- package/SVF-osx/include/SABER/SaberSVFGBuilder.h +1 -1
- package/SVF-osx/include/SVF-LLVM/BasicTypes.h +248 -0
- package/SVF-osx/include/SVF-LLVM/BreakConstantExpr.h +94 -0
- package/SVF-osx/include/SVF-LLVM/CHGBuilder.h +73 -0
- package/SVF-osx/include/SVF-LLVM/CPPUtil.h +130 -0
- package/SVF-osx/include/SVF-LLVM/DCHG.h +481 -0
- package/SVF-osx/include/SVF-LLVM/GEPTypeBridgeIterator.h +183 -0
- package/SVF-osx/include/SVF-LLVM/ICFGBuilder.h +106 -0
- package/SVF-osx/include/SVF-LLVM/IRAnnotator.h +323 -0
- package/SVF-osx/include/SVF-LLVM/LLVMLoopAnalysis.h +59 -0
- package/SVF-osx/include/SVF-LLVM/LLVMModule.h +358 -0
- package/SVF-osx/include/SVF-LLVM/LLVMUtil.h +405 -0
- package/SVF-osx/include/SVF-LLVM/SVFIRBuilder.h +413 -0
- package/SVF-osx/include/SVF-LLVM/SymbolTableBuilder.h +113 -0
- package/SVF-osx/include/SVFIR/PAGBuilderFromFile.h +80 -0
- package/SVF-osx/include/SVFIR/SVFIR.h +661 -0
- package/SVF-osx/include/SVFIR/SVFModule.h +233 -0
- package/SVF-osx/include/SVFIR/SVFStatements.h +1101 -0
- package/SVF-osx/include/SVFIR/SVFType.h +514 -0
- package/SVF-osx/include/SVFIR/SVFValue.h +1129 -0
- package/SVF-osx/include/SVFIR/SVFVariables.h +721 -0
- package/SVF-osx/include/SVFIR/SymbolTableInfo.h +597 -0
- package/SVF-osx/include/Util/Annotator.h +1 -1
- package/SVF-osx/include/Util/CallGraphBuilder.h +74 -0
- package/SVF-osx/include/Util/Casting.h +1 -3
- package/SVF-osx/include/Util/CoreBitVector.h +1 -1
- package/SVF-osx/include/Util/CxtStmt.h +8 -8
- package/SVF-osx/include/Util/DPItem.h +1 -1
- package/SVF-osx/include/Util/ExtAPI.h +1 -1
- package/SVF-osx/include/Util/NodeIDAllocator.h +1 -1
- package/SVF-osx/include/Util/Options.h +1 -0
- package/SVF-osx/include/Util/PTAStat.h +1 -1
- package/SVF-osx/include/Util/SCC.h +1 -1
- package/SVF-osx/include/Util/SVFUtil.h +26 -95
- package/SVF-osx/include/Util/ThreadAPI.h +27 -27
- package/SVF-osx/include/Util/WorkList.h +1 -1
- package/SVF-osx/include/Util/Z3Expr.h +1 -1
- package/SVF-osx/include/WPA/Andersen.h +1 -1
- package/SVF-osx/include/WPA/CSC.h +1 -1
- package/SVF-osx/include/WPA/TypeAnalysis.h +0 -3
- package/SVF-osx/include/WPA/WPAPass.h +8 -8
- package/package.json +1 -1
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
#ifndef INCLUDE_UTIL_CXTSTMT_H_
|
|
31
31
|
#define INCLUDE_UTIL_CXTSTMT_H_
|
|
32
32
|
|
|
33
|
-
#include "
|
|
33
|
+
#include "SVFIR/SVFValue.h"
|
|
34
34
|
|
|
35
35
|
namespace SVF
|
|
36
36
|
{
|
|
@@ -96,7 +96,7 @@ public:
|
|
|
96
96
|
inline std::string cxtToStr() const
|
|
97
97
|
{
|
|
98
98
|
std::string str;
|
|
99
|
-
|
|
99
|
+
std::stringstream rawstr(str);
|
|
100
100
|
rawstr << "[:";
|
|
101
101
|
for(CallStrCxt::const_iterator it = cxt.begin(), eit = cxt.end(); it!=eit; ++it)
|
|
102
102
|
{
|
|
@@ -108,7 +108,7 @@ public:
|
|
|
108
108
|
/// Dump CxtStmt
|
|
109
109
|
inline void dump() const
|
|
110
110
|
{
|
|
111
|
-
SVFUtil::outs() << "[ Current Stmt: " <<
|
|
111
|
+
SVFUtil::outs() << "[ Current Stmt: " << inst->getSourceLoc() << " " << inst->toString() << "\t Contexts: " << cxtToStr() << " ]\n";
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
protected:
|
|
@@ -174,7 +174,7 @@ public:
|
|
|
174
174
|
/// Dump CxtThreadStmt
|
|
175
175
|
inline void dump() const
|
|
176
176
|
{
|
|
177
|
-
SVFUtil::outs() << "[ Current Thread id: " << tid << " Stmt: " <<
|
|
177
|
+
SVFUtil::outs() << "[ Current Thread id: " << tid << " Stmt: " << inst->getSourceLoc() << " " << inst->toString() << "\t Contexts: " << cxtToStr() << " ]\n";
|
|
178
178
|
}
|
|
179
179
|
|
|
180
180
|
private:
|
|
@@ -244,7 +244,7 @@ public:
|
|
|
244
244
|
inline std::string cxtToStr() const
|
|
245
245
|
{
|
|
246
246
|
std::string str;
|
|
247
|
-
|
|
247
|
+
std::stringstream rawstr(str);
|
|
248
248
|
rawstr << "[:";
|
|
249
249
|
for(CallStrCxt::const_iterator it = cxt.begin(), eit = cxt.end(); it!=eit; ++it)
|
|
250
250
|
{
|
|
@@ -282,8 +282,8 @@ public:
|
|
|
282
282
|
|
|
283
283
|
if(forksite)
|
|
284
284
|
{
|
|
285
|
-
SVFUtil::outs() << "[ Thread: $" <<
|
|
286
|
-
<<
|
|
285
|
+
SVFUtil::outs() << "[ Thread: $" << forksite->getSourceLoc() << "$ "
|
|
286
|
+
<< forksite->toString() << "\t Contexts: " << cxtToStr()
|
|
287
287
|
<< loop << cycle <<" ]\n";
|
|
288
288
|
}
|
|
289
289
|
else
|
|
@@ -365,7 +365,7 @@ public:
|
|
|
365
365
|
inline std::string cxtToStr() const
|
|
366
366
|
{
|
|
367
367
|
std::string str;
|
|
368
|
-
|
|
368
|
+
std::stringstream rawstr(str);
|
|
369
369
|
rawstr << "[:";
|
|
370
370
|
for (CallStrCxt::const_iterator it = cxt.begin(), eit = cxt.end(); it != eit; ++it)
|
|
371
371
|
{
|
|
@@ -360,7 +360,7 @@ public:
|
|
|
360
360
|
inline std::string toString() const
|
|
361
361
|
{
|
|
362
362
|
std::string str;
|
|
363
|
-
|
|
363
|
+
std::stringstream rawstr(str);
|
|
364
364
|
rawstr << "[:";
|
|
365
365
|
for(CallStrCxt::const_iterator it = context.begin(), eit = context.end(); it!=eit; ++it)
|
|
366
366
|
{
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
#define AnalysisUtil_H_
|
|
32
32
|
|
|
33
33
|
#include "FastCluster/fastcluster.h"
|
|
34
|
-
#include "SVF-
|
|
35
|
-
#include "
|
|
34
|
+
#include "SVF-LLVM/LLVMModule.h"
|
|
35
|
+
#include "SVFIR/SVFValue.h"
|
|
36
36
|
#include "MemoryModel/PointsTo.h"
|
|
37
37
|
#include <time.h>
|
|
38
38
|
|
|
@@ -164,47 +164,24 @@ inline NodeBS ptsToNodeBS(const PointsTo &pts)
|
|
|
164
164
|
typedef OrderedSet<PointsTo, equalPointsTo> PointsToList;
|
|
165
165
|
void dumpPointsToList(const PointsToList& ptl);
|
|
166
166
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
if (func && (func->getIntrinsicID() == llvm::Intrinsic::donothing ||
|
|
170
|
-
func->getIntrinsicID() == llvm::Intrinsic::dbg_addr ||
|
|
171
|
-
func->getIntrinsicID() == llvm::Intrinsic::dbg_declare ||
|
|
172
|
-
func->getIntrinsicID() == llvm::Intrinsic::dbg_label ||
|
|
173
|
-
func->getIntrinsicID() == llvm::Intrinsic::dbg_value))
|
|
174
|
-
{
|
|
175
|
-
return true;
|
|
176
|
-
}
|
|
177
|
-
return false;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
/// Return true if it is an intrinsic instruction
|
|
181
|
-
inline bool isIntrinsicInst(const SVFInstruction* inst)
|
|
182
|
-
{
|
|
183
|
-
if (const llvm::CallBase* call = llvm::dyn_cast<llvm::CallBase>(inst->getLLVMInstruction()))
|
|
184
|
-
{
|
|
185
|
-
const Function* func = call->getCalledFunction();
|
|
186
|
-
if (isIntrinsicFun(func))
|
|
187
|
-
{
|
|
188
|
-
return true;
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
return false;
|
|
192
|
-
}
|
|
167
|
+
/// Return true if it is an llvm intrinsic instruction
|
|
168
|
+
bool isIntrinsicInst(const SVFInstruction* inst);
|
|
193
169
|
//@}
|
|
194
170
|
|
|
195
171
|
/// Whether an instruction is a call or invoke instruction
|
|
196
172
|
inline bool isCallSite(const SVFInstruction* inst)
|
|
197
173
|
{
|
|
198
|
-
return SVFUtil::isa<
|
|
174
|
+
return SVFUtil::isa<SVFCallInst>(inst);
|
|
199
175
|
}
|
|
200
176
|
/// Whether an instruction is a call or invoke instruction
|
|
201
|
-
inline bool isCallSite(const
|
|
177
|
+
inline bool isCallSite(const SVFValue* val)
|
|
202
178
|
{
|
|
203
|
-
if(SVFUtil::isa<
|
|
179
|
+
if(SVFUtil::isa<SVFCallInst>(val))
|
|
204
180
|
return true;
|
|
205
181
|
else
|
|
206
182
|
return false;
|
|
207
183
|
}
|
|
184
|
+
|
|
208
185
|
/// Whether an instruction is a callsite in the application code, excluding llvm intrinsic calls
|
|
209
186
|
inline bool isNonInstricCallSite(const SVFInstruction* inst)
|
|
210
187
|
{
|
|
@@ -214,7 +191,7 @@ inline bool isNonInstricCallSite(const SVFInstruction* inst)
|
|
|
214
191
|
}
|
|
215
192
|
|
|
216
193
|
/// Return LLVM callsite given an instruction
|
|
217
|
-
inline CallSite
|
|
194
|
+
inline CallSite getSVFCallSite(const SVFInstruction* inst)
|
|
218
195
|
{
|
|
219
196
|
assert(isCallSite(inst) && "not a callsite?");
|
|
220
197
|
CallSite cs(inst);
|
|
@@ -222,20 +199,14 @@ inline CallSite getLLVMCallSite(const SVFInstruction* inst)
|
|
|
222
199
|
}
|
|
223
200
|
|
|
224
201
|
/// Return LLVM callsite given a value
|
|
225
|
-
inline CallSite
|
|
202
|
+
inline CallSite getSVFCallSite(const SVFValue* value)
|
|
226
203
|
{
|
|
227
204
|
assert(isCallSite(value) && "not a callsite?");
|
|
228
|
-
const
|
|
205
|
+
const SVFCallInst* svfInst = SVFUtil::cast<SVFCallInst>(value);
|
|
229
206
|
CallSite cs(svfInst);
|
|
230
207
|
return cs;
|
|
231
208
|
}
|
|
232
209
|
|
|
233
|
-
/// Get the corresponding Function based on its name
|
|
234
|
-
inline const SVFFunction* getFunction(std::string name)
|
|
235
|
-
{
|
|
236
|
-
return LLVMModuleSet::getLLVMModuleSet()->getSVFFunction(name);
|
|
237
|
-
}
|
|
238
|
-
|
|
239
210
|
/// Split into two substrings around the first occurrence of a separator string.
|
|
240
211
|
inline std::vector<std::string> split(const std::string& s, char seperator)
|
|
241
212
|
{
|
|
@@ -251,35 +222,11 @@ inline std::vector<std::string> split(const std::string& s, char seperator)
|
|
|
251
222
|
return output;
|
|
252
223
|
}
|
|
253
224
|
|
|
254
|
-
/// find the unique defined global across multiple modules
|
|
255
|
-
inline const Value* getGlobalRep(const Value* val)
|
|
256
|
-
{
|
|
257
|
-
if(const GlobalVariable* gvar = SVFUtil::dyn_cast<GlobalVariable>(val))
|
|
258
|
-
{
|
|
259
|
-
if (LLVMModuleSet::getLLVMModuleSet()->hasGlobalRep(gvar))
|
|
260
|
-
val = LLVMModuleSet::getLLVMModuleSet()->getGlobalRep(gvar);
|
|
261
|
-
}
|
|
262
|
-
return val;
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
/// Get the definition of a function across multiple modules
|
|
266
|
-
inline const SVFFunction* getDefFunForMultipleModule(const Function* fun)
|
|
267
|
-
{
|
|
268
|
-
if(fun == nullptr) return nullptr;
|
|
269
|
-
LLVMModuleSet* llvmModuleset = LLVMModuleSet::getLLVMModuleSet();
|
|
270
|
-
const SVFFunction* svfFun = llvmModuleset->getSVFFunction(fun);
|
|
271
|
-
if (fun->isDeclaration() && llvmModuleset->hasDefinition(fun))
|
|
272
|
-
svfFun = llvmModuleset->getSVFFunction(LLVMModuleSet::getLLVMModuleSet()->getDefinition(fun));
|
|
273
|
-
return svfFun;
|
|
274
|
-
}
|
|
275
|
-
|
|
276
225
|
/// Return callee of a callsite. Return null if this is an indirect call
|
|
277
226
|
//@{
|
|
278
227
|
inline const SVFFunction* getCallee(const CallSite cs)
|
|
279
228
|
{
|
|
280
|
-
|
|
281
|
-
const Function* callee = SVFUtil::dyn_cast<Function>(cs.getCalledValue()->stripPointerCasts());
|
|
282
|
-
return getDefFunForMultipleModule(callee);
|
|
229
|
+
return cs.getCalledFunction();
|
|
283
230
|
}
|
|
284
231
|
|
|
285
232
|
inline const SVFFunction* getCallee(const SVFInstruction *inst)
|
|
@@ -291,13 +238,6 @@ inline const SVFFunction* getCallee(const SVFInstruction *inst)
|
|
|
291
238
|
}
|
|
292
239
|
//@}
|
|
293
240
|
|
|
294
|
-
/// Return source code including line number and file name from debug information
|
|
295
|
-
//@{
|
|
296
|
-
std::string getSourceLoc(const Value* val);
|
|
297
|
-
std::string getSourceLocOfFunction(const Function* F);
|
|
298
|
-
const std::string value2String(const Value* value);
|
|
299
|
-
//@}
|
|
300
|
-
|
|
301
241
|
/// Given a map mapping points-to sets to a count, adds from into to.
|
|
302
242
|
template <typename Data>
|
|
303
243
|
void mergePtsOccMaps(Map<Data, unsigned> &to, const Map<Data, unsigned> from)
|
|
@@ -444,42 +384,33 @@ inline bool isProgExitFunction (const SVFFunction * fun)
|
|
|
444
384
|
fun->getName() == "__assert_fail" );
|
|
445
385
|
}
|
|
446
386
|
|
|
447
|
-
/// Return true if
|
|
448
|
-
inline bool
|
|
387
|
+
/// Return true if this argument belongs to an uncalled function
|
|
388
|
+
inline bool isArgOfUncalledFunction(const SVFValue* svfval)
|
|
449
389
|
{
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
390
|
+
if(const SVFArgument* arg = SVFUtil::dyn_cast<SVFArgument>(svfval))
|
|
391
|
+
return arg->isArgOfUncalledFunction();
|
|
392
|
+
else
|
|
393
|
+
return false;
|
|
454
394
|
}
|
|
455
395
|
|
|
456
396
|
/// Return thread fork function
|
|
457
397
|
//@{
|
|
458
|
-
inline const
|
|
398
|
+
inline const SVFValue* getForkedFun(const CallSite cs)
|
|
459
399
|
{
|
|
460
400
|
return ThreadAPI::getThreadAPI()->getForkedFun(cs);
|
|
461
401
|
}
|
|
462
|
-
inline const
|
|
402
|
+
inline const SVFValue* getForkedFun(const SVFInstruction *inst)
|
|
463
403
|
{
|
|
464
404
|
return ThreadAPI::getThreadAPI()->getForkedFun(inst);
|
|
465
405
|
}
|
|
466
406
|
//@}
|
|
467
407
|
|
|
468
|
-
const std::string type2String(const Type* type);
|
|
469
|
-
|
|
470
408
|
/// This function servers a allocation wrapper detector
|
|
471
409
|
inline bool isAnAllocationWraper(const SVFInstruction*)
|
|
472
410
|
{
|
|
473
411
|
return false;
|
|
474
412
|
}
|
|
475
413
|
|
|
476
|
-
/// Return LLVM function if this value is
|
|
477
|
-
inline const Function* getLLVMFunction(const Value* val)
|
|
478
|
-
{
|
|
479
|
-
const Function* fun = SVFUtil::dyn_cast<Function>(val->stripPointerCasts());
|
|
480
|
-
return fun;
|
|
481
|
-
}
|
|
482
|
-
|
|
483
414
|
inline bool isExtCall(const CallSite cs)
|
|
484
415
|
{
|
|
485
416
|
return isExtCall(getCallee(cs));
|
|
@@ -671,11 +602,11 @@ inline bool isBarrierWaitCall(const SVFInstruction *inst)
|
|
|
671
602
|
|
|
672
603
|
/// Return sole argument of the thread routine
|
|
673
604
|
//@{
|
|
674
|
-
inline const
|
|
605
|
+
inline const SVFValue* getActualParmAtForkSite(const CallSite cs)
|
|
675
606
|
{
|
|
676
607
|
return ThreadAPI::getThreadAPI()->getActualParmAtForkSite(cs);
|
|
677
608
|
}
|
|
678
|
-
inline const
|
|
609
|
+
inline const SVFValue* getActualParmAtForkSite(const SVFInstruction *inst)
|
|
679
610
|
{
|
|
680
611
|
return ThreadAPI::getThreadAPI()->getActualParmAtForkSite(inst);
|
|
681
612
|
}
|
|
@@ -683,11 +614,11 @@ inline const Value* getActualParmAtForkSite(const SVFInstruction *inst)
|
|
|
683
614
|
|
|
684
615
|
/// Return the task function of the parallel_for routine
|
|
685
616
|
//@{
|
|
686
|
-
inline const
|
|
617
|
+
inline const SVFValue* getTaskFuncAtHareParForSite(const CallSite cs)
|
|
687
618
|
{
|
|
688
619
|
return ThreadAPI::getThreadAPI()->getTaskFuncAtHareParForSite(cs);
|
|
689
620
|
}
|
|
690
|
-
inline const
|
|
621
|
+
inline const SVFValue* getTaskFuncAtHareParForSite(const SVFInstruction *inst)
|
|
691
622
|
{
|
|
692
623
|
return ThreadAPI::getThreadAPI()->getTaskFuncAtHareParForSite(inst);
|
|
693
624
|
}
|
|
@@ -695,11 +626,11 @@ inline const Value* getTaskFuncAtHareParForSite(const SVFInstruction *inst)
|
|
|
695
626
|
|
|
696
627
|
/// Return the task data argument of the parallel_for rountine
|
|
697
628
|
//@{
|
|
698
|
-
inline const
|
|
629
|
+
inline const SVFValue* getTaskDataAtHareParForSite(const CallSite cs)
|
|
699
630
|
{
|
|
700
631
|
return ThreadAPI::getThreadAPI()->getTaskDataAtHareParForSite(cs);
|
|
701
632
|
}
|
|
702
|
-
inline const
|
|
633
|
+
inline const SVFValue* getTaskDataAtHareParForSite(const SVFInstruction *inst)
|
|
703
634
|
{
|
|
704
635
|
return ThreadAPI::getThreadAPI()->getTaskDataAtHareParForSite(inst);
|
|
705
636
|
}
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
#ifndef THREADAPI_H_
|
|
31
31
|
#define THREADAPI_H_
|
|
32
32
|
|
|
33
|
-
#include "
|
|
33
|
+
#include "SVFIR/SVFValue.h"
|
|
34
34
|
|
|
35
35
|
namespace SVF
|
|
36
36
|
{
|
|
@@ -121,7 +121,7 @@ public:
|
|
|
121
121
|
//@{
|
|
122
122
|
const SVFFunction* getCallee(const SVFInstruction *inst) const;
|
|
123
123
|
const SVFFunction* getCallee(const CallSite cs) const;
|
|
124
|
-
const CallSite
|
|
124
|
+
const CallSite getSVFCallSite(const SVFInstruction *inst) const;
|
|
125
125
|
//@}
|
|
126
126
|
|
|
127
127
|
/// Return true if this call create a new thread
|
|
@@ -152,39 +152,39 @@ public:
|
|
|
152
152
|
//@{
|
|
153
153
|
/// Return the first argument of the call,
|
|
154
154
|
/// Note that, it is the pthread_t pointer
|
|
155
|
-
inline const
|
|
155
|
+
inline const SVFValue* getForkedThread(const SVFInstruction *inst) const
|
|
156
156
|
{
|
|
157
157
|
assert(isTDFork(inst) && "not a thread fork function!");
|
|
158
|
-
CallSite cs =
|
|
158
|
+
CallSite cs = getSVFCallSite(inst);
|
|
159
159
|
return cs.getArgument(0);
|
|
160
160
|
}
|
|
161
|
-
inline const
|
|
161
|
+
inline const SVFValue* getForkedThread(CallSite cs) const
|
|
162
162
|
{
|
|
163
163
|
return getForkedThread(cs.getInstruction());
|
|
164
164
|
}
|
|
165
165
|
|
|
166
166
|
/// Return the third argument of the call,
|
|
167
167
|
/// Note that, it could be function type or a void* pointer
|
|
168
|
-
inline const
|
|
168
|
+
inline const SVFValue* getForkedFun(const SVFInstruction *inst) const
|
|
169
169
|
{
|
|
170
170
|
assert(isTDFork(inst) && "not a thread fork function!");
|
|
171
|
-
CallSite cs =
|
|
172
|
-
return cs.getArgument(2)
|
|
171
|
+
CallSite cs = getSVFCallSite(inst);
|
|
172
|
+
return cs.getArgument(2);
|
|
173
173
|
}
|
|
174
|
-
inline const
|
|
174
|
+
inline const SVFValue* getForkedFun(CallSite cs) const
|
|
175
175
|
{
|
|
176
176
|
return getForkedFun(cs.getInstruction());
|
|
177
177
|
}
|
|
178
178
|
|
|
179
179
|
/// Return the forth argument of the call,
|
|
180
180
|
/// Note that, it is the sole argument of start routine ( a void* pointer )
|
|
181
|
-
inline const
|
|
181
|
+
inline const SVFValue* getActualParmAtForkSite(const SVFInstruction *inst) const
|
|
182
182
|
{
|
|
183
183
|
assert(isTDFork(inst) && "not a thread fork function!");
|
|
184
|
-
CallSite cs =
|
|
184
|
+
CallSite cs = getSVFCallSite(inst);
|
|
185
185
|
return cs.getArgument(3);
|
|
186
186
|
}
|
|
187
|
-
inline const
|
|
187
|
+
inline const SVFValue* getActualParmAtForkSite(CallSite cs) const
|
|
188
188
|
{
|
|
189
189
|
return getActualParmAtForkSite(cs.getInstruction());
|
|
190
190
|
}
|
|
@@ -192,13 +192,13 @@ public:
|
|
|
192
192
|
|
|
193
193
|
/// Get the task function (i.e., the 5th parameter) of the hare_parallel_for call
|
|
194
194
|
//@{
|
|
195
|
-
inline const
|
|
195
|
+
inline const SVFValue* getTaskFuncAtHareParForSite(const SVFInstruction *inst) const
|
|
196
196
|
{
|
|
197
197
|
assert(isHareParFor(inst) && "not a hare_parallel_for function!");
|
|
198
|
-
CallSite cs =
|
|
199
|
-
return cs.getArgument(4)
|
|
198
|
+
CallSite cs = getSVFCallSite(inst);
|
|
199
|
+
return cs.getArgument(4);
|
|
200
200
|
}
|
|
201
|
-
inline const
|
|
201
|
+
inline const SVFValue* getTaskFuncAtHareParForSite(CallSite cs) const
|
|
202
202
|
{
|
|
203
203
|
return getTaskFuncAtHareParForSite(cs.getInstruction());
|
|
204
204
|
}
|
|
@@ -206,13 +206,13 @@ public:
|
|
|
206
206
|
|
|
207
207
|
/// Get the task data (i.e., the 6th parameter) of the hare_parallel_for call
|
|
208
208
|
//@{
|
|
209
|
-
inline const
|
|
209
|
+
inline const SVFValue* getTaskDataAtHareParForSite(const SVFInstruction *inst) const
|
|
210
210
|
{
|
|
211
211
|
assert(isHareParFor(inst) && "not a hare_parallel_for function!");
|
|
212
|
-
CallSite cs =
|
|
212
|
+
CallSite cs = getSVFCallSite(inst);
|
|
213
213
|
return cs.getArgument(5);
|
|
214
214
|
}
|
|
215
|
-
inline const
|
|
215
|
+
inline const SVFValue* getTaskDataAtHareParForSite(CallSite cs) const
|
|
216
216
|
{
|
|
217
217
|
return getTaskDataAtHareParForSite(cs.getInstruction());
|
|
218
218
|
}
|
|
@@ -234,20 +234,20 @@ public:
|
|
|
234
234
|
//@{
|
|
235
235
|
/// Return the first argument of the call,
|
|
236
236
|
/// Note that, it is the pthread_t pointer
|
|
237
|
-
const
|
|
238
|
-
inline const
|
|
237
|
+
const SVFValue* getJoinedThread(const SVFInstruction *inst) const;
|
|
238
|
+
inline const SVFValue* getJoinedThread(CallSite cs) const
|
|
239
239
|
{
|
|
240
240
|
return getJoinedThread(cs.getInstruction());
|
|
241
241
|
}
|
|
242
242
|
/// Return the send argument of the call,
|
|
243
243
|
/// Note that, it is the pthread_t pointer
|
|
244
|
-
inline const
|
|
244
|
+
inline const SVFValue* getRetParmAtJoinedSite(const SVFInstruction *inst) const
|
|
245
245
|
{
|
|
246
246
|
assert(isTDJoin(inst) && "not a thread join function!");
|
|
247
|
-
CallSite cs =
|
|
247
|
+
CallSite cs = getSVFCallSite(inst);
|
|
248
248
|
return cs.getArgument(1);
|
|
249
249
|
}
|
|
250
|
-
inline const
|
|
250
|
+
inline const SVFValue* getRetParmAtJoinedSite(CallSite cs) const
|
|
251
251
|
{
|
|
252
252
|
return getRetParmAtJoinedSite(cs.getInstruction());
|
|
253
253
|
}
|
|
@@ -296,13 +296,13 @@ public:
|
|
|
296
296
|
/// Return lock value
|
|
297
297
|
//@{
|
|
298
298
|
/// First argument of pthread_mutex_lock/pthread_mutex_unlock
|
|
299
|
-
inline const
|
|
299
|
+
inline const SVFValue* getLockVal(const SVFInstruction *inst) const
|
|
300
300
|
{
|
|
301
301
|
assert((isTDAcquire(inst) || isTDRelease(inst)) && "not a lock acquire or release function");
|
|
302
|
-
CallSite cs =
|
|
302
|
+
CallSite cs = getSVFCallSite(inst);
|
|
303
303
|
return cs.getArgument(0);
|
|
304
304
|
}
|
|
305
|
-
inline const
|
|
305
|
+
inline const SVFValue* getLockVal(CallSite cs) const
|
|
306
306
|
{
|
|
307
307
|
return getLockVal(cs.getInstruction());
|
|
308
308
|
}
|
|
@@ -76,7 +76,7 @@ public:
|
|
|
76
76
|
virtual ~WPAPass();
|
|
77
77
|
|
|
78
78
|
/// Interface expose to users of our pointer analysis, given Value infos
|
|
79
|
-
virtual AliasResult alias(const
|
|
79
|
+
virtual AliasResult alias(const SVFValue* V1, const SVFValue* V2);
|
|
80
80
|
|
|
81
81
|
/// Print all alias pairs
|
|
82
82
|
virtual void PrintAliasPairs(PointerAnalysis* pta);
|
|
@@ -85,19 +85,19 @@ public:
|
|
|
85
85
|
virtual ModRefInfo getModRefInfo(const CallSite callInst);
|
|
86
86
|
|
|
87
87
|
/// Interface of mod-ref analysis to determine whether a CallSite instruction can mod or ref a specific memory location, given Location infos
|
|
88
|
-
virtual inline ModRefInfo getModRefInfo(const CallSite callInst, const MemoryLocation& Loc)
|
|
89
|
-
{
|
|
90
|
-
|
|
91
|
-
}
|
|
88
|
+
// virtual inline ModRefInfo getModRefInfo(const CallSite callInst, const MemoryLocation& Loc)
|
|
89
|
+
// {
|
|
90
|
+
// return getModRefInfo(callInst, Loc.Ptr);
|
|
91
|
+
// }
|
|
92
92
|
|
|
93
93
|
/// Interface of mod-ref analysis to determine whether a CallSite instruction can mod or ref a specific memory location, given Value infos
|
|
94
|
-
virtual ModRefInfo getModRefInfo(const CallSite callInst, const
|
|
94
|
+
virtual ModRefInfo getModRefInfo(const CallSite callInst, const SVFValue* V);
|
|
95
95
|
|
|
96
96
|
/// Interface of mod-ref analysis between two CallSite instructions
|
|
97
97
|
virtual ModRefInfo getModRefInfo(const CallSite callInst1, const CallSite callInst2);
|
|
98
98
|
|
|
99
99
|
/// Run pointer analysis on SVFModule
|
|
100
|
-
virtual void runOnModule(
|
|
100
|
+
virtual void runOnModule(SVFIR* svfModule);
|
|
101
101
|
|
|
102
102
|
/// PTA name
|
|
103
103
|
virtual inline std::string getPassName() const
|
|
@@ -107,7 +107,7 @@ public:
|
|
|
107
107
|
|
|
108
108
|
private:
|
|
109
109
|
/// Create pointer analysis according to specified kind and analyze the module.
|
|
110
|
-
void runPointerAnalysis(
|
|
110
|
+
void runPointerAnalysis(SVFIR* pag, u32_t kind);
|
|
111
111
|
|
|
112
112
|
PTAVector ptaVector; ///< all pointer analysis to be executed.
|
|
113
113
|
PointerAnalysis* _pta; ///< pointer analysis to be executed.
|