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
|
Binary file
|
|
@@ -58,7 +58,7 @@ public:
|
|
|
58
58
|
virtual void solve();
|
|
59
59
|
|
|
60
60
|
/// Interface exposed to users of our Alias analysis, given Value infos
|
|
61
|
-
virtual AliasResult alias(const
|
|
61
|
+
virtual AliasResult alias(const SVFValue* v1, const SVFValue* v2)
|
|
62
62
|
{
|
|
63
63
|
NodeID n1 = svfir->getValueNode(v1);
|
|
64
64
|
NodeID n2 = svfir->getValueNode(v2);
|
|
@@ -34,10 +34,10 @@
|
|
|
34
34
|
#ifndef DDACLIENT_H_
|
|
35
35
|
#define DDACLIENT_H_
|
|
36
36
|
|
|
37
|
-
#include "
|
|
37
|
+
#include "SVFIR/SVFIR.h"
|
|
38
38
|
#include "MemoryModel/PointerAnalysisImpl.h"
|
|
39
39
|
#include "Graphs/SVFG.h"
|
|
40
|
-
#include "
|
|
40
|
+
#include "SVFIR/SVFValue.h"
|
|
41
41
|
|
|
42
42
|
namespace SVF
|
|
43
43
|
{
|
|
@@ -57,13 +57,13 @@ public:
|
|
|
57
57
|
~DDAPass();
|
|
58
58
|
|
|
59
59
|
/// Interface expose to users of our pointer analysis, given Value infos
|
|
60
|
-
virtual AliasResult alias(const
|
|
60
|
+
virtual AliasResult alias(const SVFValue* V1, const SVFValue* V2);
|
|
61
61
|
|
|
62
62
|
/// Interface expose to users of our pointer analysis, given PAGNodes
|
|
63
63
|
virtual AliasResult alias(NodeID V1, NodeID V2);
|
|
64
64
|
|
|
65
65
|
/// We start from here
|
|
66
|
-
virtual void runOnModule(
|
|
66
|
+
virtual void runOnModule(SVFIR* module);
|
|
67
67
|
|
|
68
68
|
/// Select a client
|
|
69
69
|
virtual void selectClient(SVFModule* module);
|
|
@@ -78,7 +78,7 @@ private:
|
|
|
78
78
|
/// Print queries' pts
|
|
79
79
|
void printQueryPTS();
|
|
80
80
|
/// Create pointer analysis according to specified kind and analyze the module.
|
|
81
|
-
void runPointerAnalysis(
|
|
81
|
+
void runPointerAnalysis(SVFIR* module, u32_t kind);
|
|
82
82
|
/// Context insensitive Edge for DDA
|
|
83
83
|
void initCxtInsensitiveEdges(PointerAnalysis* pta, const SVFG* svfg,const SVFGSCC* svfgSCC, SVFGEdgeSet& insensitveEdges);
|
|
84
84
|
/// Return TRUE if this edge is inside a SVFG SCC, i.e., src node and dst node are in the same SCC on the SVFG.
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
#ifndef CHA_H_
|
|
34
34
|
#define CHA_H_
|
|
35
35
|
|
|
36
|
-
#include "
|
|
36
|
+
#include "SVFIR/SVFModule.h"
|
|
37
37
|
#include "Graphs/GenericGraph.h"
|
|
38
38
|
#include "Util/WorkList.h"
|
|
39
39
|
|
|
@@ -43,7 +43,7 @@ namespace SVF
|
|
|
43
43
|
class SVFModule;
|
|
44
44
|
class CHNode;
|
|
45
45
|
|
|
46
|
-
typedef Set<const
|
|
46
|
+
typedef Set<const SVFGlobalValue*> VTableSet;
|
|
47
47
|
typedef Set<const SVFFunction*> VFunSet;
|
|
48
48
|
|
|
49
49
|
/// Common base for class hierarchy graph. Only implements what PointerAnalysis needs.
|
|
@@ -174,18 +174,18 @@ public:
|
|
|
174
174
|
}
|
|
175
175
|
void getVirtualFunctions(u32_t idx, FuncVector &virtualFunctions) const;
|
|
176
176
|
|
|
177
|
-
const
|
|
177
|
+
const SVFGlobalValue *getVTable() const
|
|
178
178
|
{
|
|
179
179
|
return vtable;
|
|
180
180
|
}
|
|
181
181
|
|
|
182
|
-
void setVTable(const
|
|
182
|
+
void setVTable(const SVFGlobalValue *vtbl)
|
|
183
183
|
{
|
|
184
184
|
vtable = vtbl;
|
|
185
185
|
}
|
|
186
186
|
|
|
187
187
|
private:
|
|
188
|
-
const
|
|
188
|
+
const SVFGlobalValue* vtable;
|
|
189
189
|
std::string className;
|
|
190
190
|
size_t flags;
|
|
191
191
|
/*
|
|
@@ -158,7 +158,7 @@ protected:
|
|
|
158
158
|
/// Add control-flow edges for top level pointers
|
|
159
159
|
//@{
|
|
160
160
|
ICFGEdge* addIntraEdge(ICFGNode* srcNode, ICFGNode* dstNode);
|
|
161
|
-
ICFGEdge* addConditionalIntraEdge(ICFGNode* srcNode, ICFGNode* dstNode, const
|
|
161
|
+
ICFGEdge* addConditionalIntraEdge(ICFGNode* srcNode, ICFGNode* dstNode, const SVFValue* condition, s32_t branchCondVal);
|
|
162
162
|
ICFGEdge* addCallEdge(ICFGNode* srcNode, ICFGNode* dstNode, const SVFInstruction* cs);
|
|
163
163
|
ICFGEdge* addRetEdge(ICFGNode* srcNode, ICFGNode* dstNode, const SVFInstruction* cs);
|
|
164
164
|
//@}
|
|
@@ -134,7 +134,7 @@ public:
|
|
|
134
134
|
}
|
|
135
135
|
//@}
|
|
136
136
|
|
|
137
|
-
const
|
|
137
|
+
const SVFValue* getCondition() const
|
|
138
138
|
{
|
|
139
139
|
return conditionVar;
|
|
140
140
|
}
|
|
@@ -145,7 +145,7 @@ public:
|
|
|
145
145
|
return branchCondVal;
|
|
146
146
|
}
|
|
147
147
|
|
|
148
|
-
void setBranchCondition(const
|
|
148
|
+
void setBranchCondition(const SVFValue* c, s32_t bVal)
|
|
149
149
|
{
|
|
150
150
|
conditionVar = c;
|
|
151
151
|
branchCondVal = bVal;
|
|
@@ -158,7 +158,7 @@ private:
|
|
|
158
158
|
/// branchCondVal is the value when this condition should hold to execute this CFGEdge.
|
|
159
159
|
/// e.g., Inst1: br %cmp label 0, label 1, Inst2 is label 0 and Inst 3 is label 1;
|
|
160
160
|
/// for edge between Inst1 and Inst 2, the first element is %cmp and second element is 0
|
|
161
|
-
const
|
|
161
|
+
const SVFValue* conditionVar;
|
|
162
162
|
s32_t branchCondVal;
|
|
163
163
|
};
|
|
164
164
|
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
#ifndef IRGRAPH_H_
|
|
32
32
|
#define IRGRAPH_H_
|
|
33
33
|
|
|
34
|
-
#include "
|
|
35
|
-
#include "
|
|
34
|
+
#include "SVFIR/SVFStatements.h"
|
|
35
|
+
#include "SVFIR/SVFVariables.h"
|
|
36
36
|
#include "Util/NodeIDAllocator.h"
|
|
37
37
|
#include "Util/SVFUtil.h"
|
|
38
38
|
#include "Graphs/ICFG.h"
|
|
@@ -49,7 +49,7 @@ class IRGraph : public GenericGraph<SVFVar,SVFStmt>
|
|
|
49
49
|
{
|
|
50
50
|
public:
|
|
51
51
|
typedef Set<const SVFStmt*> SVFStmtSet;
|
|
52
|
-
typedef Map<const
|
|
52
|
+
typedef Map<const SVFValue*,SVFStmtSet> ValueToEdgeMap;
|
|
53
53
|
|
|
54
54
|
protected:
|
|
55
55
|
SVFStmt::KindToSVFStmtMapTy KindToSVFStmtSetMap; // < SVFIR edge map containing all PAGEdges
|
|
@@ -78,7 +78,7 @@ protected:
|
|
|
78
78
|
SVFStmt* hasLabeledEdge(SVFVar* src, SVFVar* op1, SVFStmt::PEDGEK kind, const SVFVar* op2);
|
|
79
79
|
|
|
80
80
|
/// Map a value to a set of edges
|
|
81
|
-
inline void mapValueToEdge(const
|
|
81
|
+
inline void mapValueToEdge(const SVFValue* V, SVFStmt *edge)
|
|
82
82
|
{
|
|
83
83
|
auto inserted = valueToEdgeMap.emplace(V, SVFStmtSet{edge});
|
|
84
84
|
if (!inserted.second)
|
|
@@ -87,7 +87,7 @@ protected:
|
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
/// get MemObj according to LLVM value
|
|
90
|
-
inline const MemObj* getMemObj(const
|
|
90
|
+
inline const MemObj* getMemObj(const SVFValue* val) const
|
|
91
91
|
{
|
|
92
92
|
return symInfo->getObj(symInfo->getObjSym(val));
|
|
93
93
|
}
|
|
@@ -102,13 +102,17 @@ public:
|
|
|
102
102
|
|
|
103
103
|
virtual ~IRGraph();
|
|
104
104
|
|
|
105
|
+
inline SymbolTableInfo* getSymbolInfo() const
|
|
106
|
+
{
|
|
107
|
+
return symInfo;
|
|
108
|
+
}
|
|
105
109
|
/// Whether this SVFIR built from a txt file
|
|
106
110
|
inline bool isBuiltFromFile()
|
|
107
111
|
{
|
|
108
112
|
return fromFile;
|
|
109
113
|
}
|
|
110
114
|
/// Get all SVFIR Edges that corresponds to an LLVM value
|
|
111
|
-
inline const SVFStmtSet& getValueEdges(const
|
|
115
|
+
inline const SVFStmtSet& getValueEdges(const SVFValue* V)
|
|
112
116
|
{
|
|
113
117
|
auto it = valueToEdgeMap.find(V);
|
|
114
118
|
if (it == valueToEdgeMap.end())
|
|
@@ -121,17 +125,17 @@ public:
|
|
|
121
125
|
|
|
122
126
|
/// Get SVFIR Node according to LLVM value
|
|
123
127
|
///getNode - Return the node corresponding to the specified pointer.
|
|
124
|
-
inline NodeID getValueNode(const
|
|
128
|
+
inline NodeID getValueNode(const SVFValue* V)
|
|
125
129
|
{
|
|
126
130
|
return symInfo->getValSym(V);
|
|
127
131
|
}
|
|
128
|
-
inline bool hasValueNode(const
|
|
132
|
+
inline bool hasValueNode(const SVFValue* V)
|
|
129
133
|
{
|
|
130
134
|
return symInfo->hasValSym(V);
|
|
131
135
|
}
|
|
132
136
|
/// getObject - Return the obj node id refer to the memory object for the
|
|
133
137
|
/// specified global, heap or alloca instruction according to llvm value.
|
|
134
|
-
inline NodeID getObjectNode(const
|
|
138
|
+
inline NodeID getObjectNode(const SVFValue* V)
|
|
135
139
|
{
|
|
136
140
|
return symInfo->getObjSym(V);
|
|
137
141
|
}
|
|
@@ -303,11 +303,11 @@ private:
|
|
|
303
303
|
//@{
|
|
304
304
|
inline bool formalInOfAddressTakenFunc(const FormalINSVFGNode* fi) const
|
|
305
305
|
{
|
|
306
|
-
return (fi->getFun()->
|
|
306
|
+
return (fi->getFun()->hasAddressTaken());
|
|
307
307
|
}
|
|
308
308
|
inline bool formalOutOfAddressTakenFunc(const FormalOUTSVFGNode* fo) const
|
|
309
309
|
{
|
|
310
|
-
return (fo->getFun()->
|
|
310
|
+
return (fo->getFun()->hasAddressTaken());
|
|
311
311
|
}
|
|
312
312
|
//@}
|
|
313
313
|
|
|
@@ -70,7 +70,7 @@ public:
|
|
|
70
70
|
virtual const std::string toString() const
|
|
71
71
|
{
|
|
72
72
|
std::string str;
|
|
73
|
-
|
|
73
|
+
std::stringstream rawstr(str);
|
|
74
74
|
rawstr << "ThreadForkEdge ";
|
|
75
75
|
rawstr << "CallSite ID: " << getCallSiteID();
|
|
76
76
|
rawstr << " srcNode ID " << getSrcID() << " (fun: " << getSrcNode()->getFunction()->getName() << ")";
|
|
@@ -110,7 +110,7 @@ public:
|
|
|
110
110
|
virtual const std::string toString() const
|
|
111
111
|
{
|
|
112
112
|
std::string str;
|
|
113
|
-
|
|
113
|
+
std::stringstream rawstr(str);
|
|
114
114
|
rawstr << "ThreadJoinEdge ";
|
|
115
115
|
rawstr << "CallSite ID: " << getCallSiteID();
|
|
116
116
|
rawstr << " srcNode ID " << getSrcID() << " (fun: " << getSrcNode()->getFunction()->getName() << ")";
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
#include "Graphs/GenericGraph.h"
|
|
34
34
|
#include "Graphs/SVFGEdge.h"
|
|
35
35
|
#include "Graphs/ICFGNode.h"
|
|
36
|
-
#include "
|
|
36
|
+
#include "SVFIR/SVFIR.h"
|
|
37
37
|
|
|
38
38
|
namespace SVF
|
|
39
39
|
{
|
|
@@ -87,7 +87,7 @@ public:
|
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
/// Return the corresponding LLVM value, if possible, nullptr otherwise.
|
|
90
|
-
virtual const
|
|
90
|
+
virtual const SVFValue* getValue() const
|
|
91
91
|
{
|
|
92
92
|
return nullptr;
|
|
93
93
|
}
|
|
@@ -189,7 +189,7 @@ public:
|
|
|
189
189
|
}
|
|
190
190
|
//@}
|
|
191
191
|
|
|
192
|
-
const
|
|
192
|
+
const SVFValue* getValue() const override;
|
|
193
193
|
const std::string toString() const override;
|
|
194
194
|
};
|
|
195
195
|
|
|
@@ -384,7 +384,7 @@ public:
|
|
|
384
384
|
|
|
385
385
|
const NodeBS getDefSVFVars() const override;
|
|
386
386
|
|
|
387
|
-
const
|
|
387
|
+
const SVFValue* getValue() const override;
|
|
388
388
|
const std::string toString() const override;
|
|
389
389
|
};
|
|
390
390
|
|
|
@@ -455,7 +455,7 @@ public:
|
|
|
455
455
|
|
|
456
456
|
const NodeBS getDefSVFVars() const override;
|
|
457
457
|
|
|
458
|
-
const
|
|
458
|
+
const SVFValue* getValue() const override;
|
|
459
459
|
const std::string toString() const override;
|
|
460
460
|
};
|
|
461
461
|
|
|
@@ -699,7 +699,7 @@ public:
|
|
|
699
699
|
|
|
700
700
|
const NodeBS getDefSVFVars() const override;
|
|
701
701
|
|
|
702
|
-
const
|
|
702
|
+
const SVFValue* getValue() const override;
|
|
703
703
|
const std::string toString() const override;
|
|
704
704
|
};
|
|
705
705
|
|
|
@@ -836,7 +836,7 @@ public:
|
|
|
836
836
|
}
|
|
837
837
|
//@}
|
|
838
838
|
|
|
839
|
-
const
|
|
839
|
+
const SVFValue* getValue() const override;
|
|
840
840
|
const std::string toString() const override;
|
|
841
841
|
};
|
|
842
842
|
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
#ifndef MEMORYREGION_H_
|
|
35
35
|
#define MEMORYREGION_H_
|
|
36
36
|
|
|
37
|
-
#include "
|
|
37
|
+
#include "SVFIR/SVFIR.h"
|
|
38
38
|
#include "Graphs/PTACallGraph.h"
|
|
39
39
|
#include "Util/SCC.h"
|
|
40
40
|
#include "Util/WorkList.h"
|
|
@@ -480,7 +480,7 @@ public:
|
|
|
480
480
|
NodeBS getModInfoForCall(const CallICFGNode* cs);
|
|
481
481
|
NodeBS getRefInfoForCall(const CallICFGNode* cs);
|
|
482
482
|
ModRefInfo getModRefInfo(const CallICFGNode* cs);
|
|
483
|
-
ModRefInfo getModRefInfo(const CallICFGNode* cs, const
|
|
483
|
+
ModRefInfo getModRefInfo(const CallICFGNode* cs, const SVFValue* V);
|
|
484
484
|
ModRefInfo getModRefInfo(const CallICFGNode* cs1, const CallICFGNode* cs2);
|
|
485
485
|
//@}
|
|
486
486
|
|
|
@@ -34,7 +34,6 @@
|
|
|
34
34
|
*
|
|
35
35
|
*/
|
|
36
36
|
#include "MTA/TCT.h"
|
|
37
|
-
#include "SVF-FE/DataFlowUtil.h"
|
|
38
37
|
|
|
39
38
|
namespace SVF
|
|
40
39
|
{
|
|
@@ -437,8 +436,6 @@ private:
|
|
|
437
436
|
/// Match context
|
|
438
437
|
bool matchCxt(CallStrCxt& cxt, const SVFInstruction* call, const SVFFunction* callee);
|
|
439
438
|
|
|
440
|
-
void validateResults();
|
|
441
|
-
|
|
442
439
|
/// Whether it is a lock site
|
|
443
440
|
inline bool isTDFork(const SVFInstruction* call)
|
|
444
441
|
{
|
|
@@ -455,7 +452,7 @@ private:
|
|
|
455
452
|
return getTCG()->getThreadAPI()->isTDRelease(call);
|
|
456
453
|
}
|
|
457
454
|
/// Get lock value
|
|
458
|
-
inline const
|
|
455
|
+
inline const SVFValue* getLockVal(const SVFInstruction* call)
|
|
459
456
|
{
|
|
460
457
|
return getTCG()->getThreadAPI()->getLockVal(call);
|
|
461
458
|
}
|
|
@@ -32,7 +32,6 @@
|
|
|
32
32
|
|
|
33
33
|
#include "MTA/TCT.h"
|
|
34
34
|
#include "Util/SVFUtil.h"
|
|
35
|
-
#include "SVF-FE/LLVMUtil.h"
|
|
36
35
|
namespace SVF
|
|
37
36
|
{
|
|
38
37
|
|
|
@@ -54,6 +53,7 @@ public:
|
|
|
54
53
|
typedef Set<CxtThreadStmt> CxtThreadStmtSet;
|
|
55
54
|
typedef Map<CxtThreadStmt,NodeBS> ThreadStmtToThreadInterleav;
|
|
56
55
|
typedef Map<const SVFInstruction*,CxtThreadStmtSet> InstToThreadStmtSetMap;
|
|
56
|
+
typedef SVFLoopAndDomInfo::LoopBBs LoopBBs;
|
|
57
57
|
|
|
58
58
|
typedef Set<CxtStmt> LockSpan;
|
|
59
59
|
|
|
@@ -167,9 +167,6 @@ private:
|
|
|
167
167
|
/// Handle intra
|
|
168
168
|
void handleIntra(const CxtThreadStmt& cts);
|
|
169
169
|
|
|
170
|
-
/// Use RCResultValidator to validate mhp results
|
|
171
|
-
void validateResults();
|
|
172
|
-
|
|
173
170
|
/// Add/Remove interleaving thread for statement inst
|
|
174
171
|
//@{
|
|
175
172
|
inline void addInterleavingThread(const CxtThreadStmt& tgr, NodeID tid)
|
|
@@ -221,12 +218,6 @@ private:
|
|
|
221
218
|
{
|
|
222
219
|
return tct->getTCTNode(curTid)->isMultiforked();
|
|
223
220
|
}
|
|
224
|
-
|
|
225
|
-
/// Get the next instructions following control flow
|
|
226
|
-
inline void getNextInsts(const SVFInstruction* inst, InstVec& instVec)
|
|
227
|
-
{
|
|
228
|
-
tct->getNextInsts(inst,instVec);
|
|
229
|
-
}
|
|
230
221
|
/// Push calling context
|
|
231
222
|
inline void pushCxt(CallStrCxt& cxt, const SVFInstruction* call, const SVFFunction* callee)
|
|
232
223
|
{
|
|
@@ -265,7 +256,10 @@ private:
|
|
|
265
256
|
NodeBS getDirAndIndJoinedTid(const CallStrCxt& cxt, const SVFInstruction* call);
|
|
266
257
|
|
|
267
258
|
/// Whether a context-sensitive join satisfies symmetric loop pattern
|
|
268
|
-
|
|
259
|
+
bool hasJoinInSymmetricLoop(const CallStrCxt& cxt, const SVFInstruction* call) const;
|
|
260
|
+
|
|
261
|
+
/// Whether a context-sensitive join satisfies symmetric loop pattern
|
|
262
|
+
const LoopBBs& getJoinInSymmetricLoop(const CallStrCxt& cxt, const SVFInstruction* call) const;
|
|
269
263
|
|
|
270
264
|
/// Whether thread t1 happens before t2 based on ForkJoin Analysis
|
|
271
265
|
bool isHBPair(NodeID tid1, NodeID tid2);
|
|
@@ -303,13 +297,14 @@ public:
|
|
|
303
297
|
TDDead, // thread is dead
|
|
304
298
|
};
|
|
305
299
|
|
|
300
|
+
typedef SVFLoopAndDomInfo::LoopBBs LoopBBs;
|
|
306
301
|
typedef TCT::InstVec InstVec;
|
|
307
302
|
typedef Map<CxtStmt,ValDomain> CxtStmtToAliveFlagMap;
|
|
308
303
|
typedef Map<CxtStmt,NodeBS> CxtStmtToTIDMap;
|
|
309
304
|
typedef Set<NodePair> ThreadPairSet;
|
|
310
|
-
typedef Map<CxtStmt,
|
|
305
|
+
typedef Map<CxtStmt, LoopBBs> CxtStmtToLoopMap;
|
|
311
306
|
typedef FIFOWorkList<CxtStmt> CxtStmtWorkList;
|
|
312
|
-
|
|
307
|
+
|
|
313
308
|
ForkJoinAnalysis(TCT* t) : tct(t)
|
|
314
309
|
{
|
|
315
310
|
collectSCEVInfo();
|
|
@@ -331,12 +326,16 @@ public:
|
|
|
331
326
|
NodeBS getDirAndIndJoinedTid(const CxtStmt& cs);
|
|
332
327
|
|
|
333
328
|
/// Whether a context-sensitive join satisfies symmetric loop pattern
|
|
334
|
-
inline const
|
|
329
|
+
inline const LoopBBs& getJoinInSymmetricLoop(const CxtStmt& cs) const
|
|
335
330
|
{
|
|
336
331
|
CxtStmtToLoopMap::const_iterator it = cxtJoinInLoop.find(cs);
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
332
|
+
assert(it!=cxtJoinInLoop.end() && "does not have the loop");
|
|
333
|
+
return it->second;
|
|
334
|
+
}
|
|
335
|
+
inline bool hasJoinInSymmetricLoop(const CxtStmt& cs) const
|
|
336
|
+
{
|
|
337
|
+
CxtStmtToLoopMap::const_iterator it = cxtJoinInLoop.find(cs);
|
|
338
|
+
return it!=cxtJoinInLoop.end();
|
|
340
339
|
}
|
|
341
340
|
/// Whether thread t1 happens-before thread t2
|
|
342
341
|
inline bool isHBPair(NodeID tid1, NodeID tid2)
|
|
@@ -368,14 +367,13 @@ public:
|
|
|
368
367
|
}
|
|
369
368
|
|
|
370
369
|
/// Get loop for join site
|
|
371
|
-
inline
|
|
370
|
+
inline LoopBBs& getJoinLoop(const SVFInstruction* inst)
|
|
372
371
|
{
|
|
373
372
|
return tct->getJoinLoop(inst);
|
|
374
373
|
}
|
|
375
|
-
|
|
376
|
-
inline ScalarEvolution* getSE(const SVFInstruction* inst)
|
|
374
|
+
inline bool hasJoinLoop(const SVFInstruction* inst)
|
|
377
375
|
{
|
|
378
|
-
return tct->
|
|
376
|
+
return tct->hasJoinLoop(inst);
|
|
379
377
|
}
|
|
380
378
|
private:
|
|
381
379
|
|
|
@@ -476,11 +474,6 @@ private:
|
|
|
476
474
|
}
|
|
477
475
|
//@}
|
|
478
476
|
|
|
479
|
-
/// Get the next instructions following control flow
|
|
480
|
-
inline void getNextInsts(const SVFInstruction* inst, InstVec& instSet)
|
|
481
|
-
{
|
|
482
|
-
tct->getNextInsts(inst,instSet);
|
|
483
|
-
}
|
|
484
477
|
/// Push calling context
|
|
485
478
|
inline void pushCxt(CallStrCxt& cxt, const SVFInstruction* call, const SVFFunction* callee)
|
|
486
479
|
{
|
|
@@ -503,12 +496,12 @@ private:
|
|
|
503
496
|
return getTCG()->getThreadAPI()->isTDJoin(call);
|
|
504
497
|
}
|
|
505
498
|
/// Get forked thread
|
|
506
|
-
inline const
|
|
499
|
+
inline const SVFValue* getForkedThread(const SVFInstruction* call)
|
|
507
500
|
{
|
|
508
501
|
return getTCG()->getThreadAPI()->getForkedThread(call);
|
|
509
502
|
}
|
|
510
503
|
/// Get joined thread
|
|
511
|
-
inline const
|
|
504
|
+
inline const SVFValue* getJoinedThread(const SVFInstruction* call)
|
|
512
505
|
{
|
|
513
506
|
return getTCG()->getThreadAPI()->getJoinedThread(call);
|
|
514
507
|
}
|
|
@@ -555,7 +548,7 @@ private:
|
|
|
555
548
|
//@}
|
|
556
549
|
|
|
557
550
|
/// Add inloop join
|
|
558
|
-
inline void addSymmetricLoopJoin(const CxtStmt& cs,
|
|
551
|
+
inline void addSymmetricLoopJoin(const CxtStmt& cs, LoopBBs& lp)
|
|
559
552
|
{
|
|
560
553
|
cxtJoinInLoop[cs] = lp;
|
|
561
554
|
}
|
|
@@ -569,8 +562,6 @@ private:
|
|
|
569
562
|
ThreadPairSet HPPair; ///< threads happen-in-parallel
|
|
570
563
|
ThreadPairSet fullJoin; ///< t1 fully joins t2 along all program path
|
|
571
564
|
ThreadPairSet partialJoin; ///< t1 partially joins t2 along some program path(s)
|
|
572
|
-
PTACFInfoBuilder ptaCFInfo; ///< PTA control flow info
|
|
573
|
-
forkjoinToPTASCEVMap fkjnToPTASCEVMap; //< map a pointer at a fork/join site to its corresponing scev expression
|
|
574
565
|
};
|
|
575
566
|
|
|
576
567
|
} // End namespace SVF
|
|
@@ -36,8 +36,7 @@
|
|
|
36
36
|
|
|
37
37
|
#include <set>
|
|
38
38
|
#include <vector>
|
|
39
|
-
#include "
|
|
40
|
-
#include "SVF-FE/BasicTypes.h"
|
|
39
|
+
#include "SVFIR/SVFValue.h"
|
|
41
40
|
|
|
42
41
|
namespace SVF
|
|
43
42
|
{
|
|
@@ -54,19 +53,12 @@ class SVFModule;
|
|
|
54
53
|
/*!
|
|
55
54
|
* Base data race detector
|
|
56
55
|
*/
|
|
57
|
-
class MTA
|
|
56
|
+
class MTA
|
|
58
57
|
{
|
|
59
58
|
|
|
60
59
|
public:
|
|
61
|
-
typedef Set<const
|
|
62
|
-
typedef Set<const
|
|
63
|
-
typedef Map<const SVFFunction*, ScalarEvolution*> FunToSEMap;
|
|
64
|
-
typedef Map<const SVFFunction*, LoopInfo*> FunToLoopInfoMap;
|
|
65
|
-
|
|
66
|
-
/// Pass ID
|
|
67
|
-
static char ID;
|
|
68
|
-
|
|
69
|
-
static ModulePass* modulePass;
|
|
60
|
+
typedef Set<const SVFInstruction*> LoadSet;
|
|
61
|
+
typedef Set<const SVFInstruction*> StoreSet;
|
|
70
62
|
|
|
71
63
|
/// Constructor
|
|
72
64
|
MTA();
|
|
@@ -76,10 +68,7 @@ public:
|
|
|
76
68
|
|
|
77
69
|
|
|
78
70
|
/// We start the pass here
|
|
79
|
-
|
|
80
|
-
virtual bool runOnModule(Module& module);
|
|
81
|
-
/// We start the pass here
|
|
82
|
-
virtual bool runOnModule(SVFModule* module);
|
|
71
|
+
virtual bool runOnModule(SVFIR* module);
|
|
83
72
|
/// Compute MHP
|
|
84
73
|
virtual MHP* computeMHP(SVFModule* module);
|
|
85
74
|
/// Compute locksets
|
|
@@ -87,31 +76,23 @@ public:
|
|
|
87
76
|
/// Perform detection
|
|
88
77
|
virtual void detect(SVFModule* module);
|
|
89
78
|
|
|
90
|
-
/// Pass name
|
|
91
|
-
virtual llvm::StringRef getPassName() const
|
|
92
|
-
{
|
|
93
|
-
return "Multi threaded program analysis pass";
|
|
94
|
-
}
|
|
95
|
-
|
|
96
79
|
void dump(Module &module, MHP *mhp, LockAnalysis *lsa);
|
|
97
80
|
|
|
98
|
-
|
|
99
|
-
static inline ScalarEvolution* getSE(const SVFFunction* F)
|
|
81
|
+
MHP* getMHP()
|
|
100
82
|
{
|
|
101
|
-
|
|
102
|
-
if (it != func2ScevMap.end())
|
|
103
|
-
return it->second;
|
|
104
|
-
ScalarEvolutionWrapperPass *scev = &modulePass->getAnalysis<ScalarEvolutionWrapperPass>(*const_cast<Function*>(F->getLLVMFun()));
|
|
105
|
-
func2ScevMap[F] = &scev->getSE();
|
|
106
|
-
return &scev->getSE();
|
|
83
|
+
return mhp;
|
|
107
84
|
}
|
|
108
85
|
|
|
86
|
+
LockAnalysis* getLockAnalysis()
|
|
87
|
+
{
|
|
88
|
+
return lsa;
|
|
89
|
+
}
|
|
109
90
|
private:
|
|
110
91
|
ThreadCallGraph* tcg;
|
|
111
92
|
TCT* tct;
|
|
112
93
|
MTAStat* stat;
|
|
113
|
-
|
|
114
|
-
|
|
94
|
+
MHP* mhp;
|
|
95
|
+
LockAnalysis* lsa;
|
|
115
96
|
};
|
|
116
97
|
|
|
117
98
|
} // End namespace SVF
|