svf-lib 1.0.2079 → 1.0.2080
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-osx/Release-build/bin/ae +0 -0
- package/SVF-osx/Release-build/bin/cfl +0 -0
- package/SVF-osx/Release-build/bin/dvf +0 -0
- package/SVF-osx/Release-build/bin/llvm2svf +0 -0
- package/SVF-osx/Release-build/bin/mta +0 -0
- package/SVF-osx/Release-build/bin/saber +0 -0
- package/SVF-osx/Release-build/bin/svf-ex +0 -0
- package/SVF-osx/Release-build/bin/wpa +0 -0
- package/SVF-osx/Release-build/include/AE/Svfexe/AbstractInterpretation.h +1 -1
- package/SVF-osx/Release-build/include/DDA/ContextDDA.h +2 -2
- package/SVF-osx/Release-build/include/DDA/DDAVFSolver.h +5 -5
- package/SVF-osx/Release-build/include/DDA/FlowDDA.h +1 -1
- package/SVF-osx/Release-build/include/Graphs/{PTACallGraph.h → CallGraph.h} +41 -41
- package/SVF-osx/Release-build/include/Graphs/ICFG.h +2 -2
- package/SVF-osx/Release-build/include/Graphs/ThreadCallGraph.h +24 -30
- package/SVF-osx/Release-build/include/Graphs/VFG.h +4 -4
- package/SVF-osx/Release-build/include/MSSA/MemRegion.h +4 -4
- package/SVF-osx/Release-build/include/MTA/LockAnalysis.h +42 -32
- package/SVF-osx/Release-build/include/MTA/MHP.h +34 -54
- package/SVF-osx/Release-build/include/MTA/MTAStat.h +1 -2
- package/SVF-osx/Release-build/include/MTA/TCT.h +43 -25
- package/SVF-osx/Release-build/include/MemoryModel/PointerAnalysis.h +13 -13
- package/SVF-osx/Release-build/include/SABER/SaberSVFGBuilder.h +1 -1
- package/SVF-osx/Release-build/include/SABER/SrcSnkDDA.h +7 -7
- package/SVF-osx/Release-build/include/SVF-LLVM/SVFIRBuilder.h +1 -1
- package/SVF-osx/Release-build/include/Util/CallGraphBuilder.h +5 -5
- package/SVF-osx/Release-build/include/Util/CxtStmt.h +13 -12
- package/SVF-osx/Release-build/include/Util/Options.h +1 -20
- package/SVF-osx/Release-build/include/Util/SVFUtil.h +8 -43
- package/SVF-osx/Release-build/include/Util/ThreadAPI.h +42 -85
- package/SVF-osx/Release-build/lib/libSvfCore.a +0 -0
- package/SVF-osx/Release-build/lib/libSvfLLVM.a +0 -0
- package/package.json +1 -1
- package/SVF-osx/Release-build/include/MTA/FSMPTA.h +0 -270
- package/SVF-osx/Release-build/include/MTA/MTAResultValidator.h +0 -448
- package/SVF-osx/Release-build/include/MTA/PCG.h +0 -229
|
@@ -36,6 +36,7 @@ namespace SVF
|
|
|
36
36
|
{
|
|
37
37
|
|
|
38
38
|
class SVFModule;
|
|
39
|
+
class ICFGNode;
|
|
39
40
|
|
|
40
41
|
/*
|
|
41
42
|
* ThreadAPI class contains interfaces for pthread programs
|
|
@@ -119,32 +120,21 @@ public:
|
|
|
119
120
|
|
|
120
121
|
/// Return the callee/callsite/func
|
|
121
122
|
//@{
|
|
123
|
+
const SVFFunction* getCallee(const ICFGNode *inst) const;
|
|
122
124
|
const SVFFunction* getCallee(const SVFInstruction *inst) const;
|
|
123
|
-
const SVFFunction* getCallee(const CallSite cs) const;
|
|
124
125
|
const CallSite getSVFCallSite(const SVFInstruction *inst) const;
|
|
126
|
+
const CallSite getSVFCallSite(const ICFGNode *inst) const;
|
|
125
127
|
//@}
|
|
126
128
|
|
|
127
129
|
/// Return true if this call create a new thread
|
|
128
130
|
//@{
|
|
129
|
-
inline bool isTDFork(const
|
|
131
|
+
inline bool isTDFork(const ICFGNode *inst) const
|
|
130
132
|
{
|
|
131
133
|
return getType(getCallee(inst)) == TD_FORK;
|
|
132
134
|
}
|
|
133
|
-
inline bool isTDFork(
|
|
135
|
+
inline bool isTDFork(const SVFInstruction* cs) const
|
|
134
136
|
{
|
|
135
|
-
return
|
|
136
|
-
}
|
|
137
|
-
//@}
|
|
138
|
-
|
|
139
|
-
/// Return true if this call proceeds a hare_parallel_for
|
|
140
|
-
//@{
|
|
141
|
-
inline bool isHareParFor(const SVFInstruction *inst) const
|
|
142
|
-
{
|
|
143
|
-
return getType(getCallee(inst)) == HARE_PAR_FOR;
|
|
144
|
-
}
|
|
145
|
-
inline bool isHareParFor(CallSite cs) const
|
|
146
|
-
{
|
|
147
|
-
return isTDFork(cs.getInstruction());
|
|
137
|
+
return getType(getCallee(cs)) == TD_FORK;
|
|
148
138
|
}
|
|
149
139
|
//@}
|
|
150
140
|
|
|
@@ -152,81 +142,59 @@ public:
|
|
|
152
142
|
//@{
|
|
153
143
|
/// Return the first argument of the call,
|
|
154
144
|
/// Note that, it is the pthread_t pointer
|
|
155
|
-
inline const SVFValue* getForkedThread(const
|
|
145
|
+
inline const SVFValue* getForkedThread(const ICFGNode *inst) const
|
|
156
146
|
{
|
|
157
147
|
assert(isTDFork(inst) && "not a thread fork function!");
|
|
158
148
|
CallSite cs = getSVFCallSite(inst);
|
|
159
149
|
return cs.getArgument(0);
|
|
160
150
|
}
|
|
161
|
-
inline const SVFValue* getForkedThread(
|
|
151
|
+
inline const SVFValue* getForkedThread(const SVFInstruction* inst) const
|
|
162
152
|
{
|
|
163
|
-
|
|
153
|
+
assert(isTDFork(inst) && "not a thread fork function!");
|
|
154
|
+
CallSite cs = getSVFCallSite(inst);
|
|
155
|
+
return cs.getArgument(0);
|
|
164
156
|
}
|
|
165
157
|
|
|
166
158
|
/// Return the third argument of the call,
|
|
167
159
|
/// Note that, it could be function type or a void* pointer
|
|
168
|
-
inline const SVFValue* getForkedFun(const
|
|
160
|
+
inline const SVFValue* getForkedFun(const ICFGNode *inst) const
|
|
169
161
|
{
|
|
170
162
|
assert(isTDFork(inst) && "not a thread fork function!");
|
|
171
163
|
CallSite cs = getSVFCallSite(inst);
|
|
172
164
|
return cs.getArgument(2);
|
|
173
165
|
}
|
|
174
|
-
inline const SVFValue* getForkedFun(
|
|
166
|
+
inline const SVFValue* getForkedFun(const SVFInstruction* inst) const
|
|
175
167
|
{
|
|
176
|
-
|
|
168
|
+
assert(isTDFork(inst) && "not a thread fork function!");
|
|
169
|
+
CallSite cs = getSVFCallSite(inst);
|
|
170
|
+
return cs.getArgument(2);
|
|
177
171
|
}
|
|
178
172
|
|
|
179
173
|
/// Return the forth argument of the call,
|
|
180
174
|
/// Note that, it is the sole argument of start routine ( a void* pointer )
|
|
181
|
-
inline const SVFValue* getActualParmAtForkSite(const
|
|
175
|
+
inline const SVFValue* getActualParmAtForkSite(const ICFGNode *inst) const
|
|
182
176
|
{
|
|
183
177
|
assert(isTDFork(inst) && "not a thread fork function!");
|
|
184
178
|
CallSite cs = getSVFCallSite(inst);
|
|
185
179
|
return cs.getArgument(3);
|
|
186
180
|
}
|
|
187
|
-
inline const SVFValue* getActualParmAtForkSite(
|
|
188
|
-
{
|
|
189
|
-
return getActualParmAtForkSite(cs.getInstruction());
|
|
190
|
-
}
|
|
191
|
-
//@}
|
|
192
|
-
|
|
193
|
-
/// Get the task function (i.e., the 5th parameter) of the hare_parallel_for call
|
|
194
|
-
//@{
|
|
195
|
-
inline const SVFValue* getTaskFuncAtHareParForSite(const SVFInstruction *inst) const
|
|
196
|
-
{
|
|
197
|
-
assert(isHareParFor(inst) && "not a hare_parallel_for function!");
|
|
198
|
-
CallSite cs = getSVFCallSite(inst);
|
|
199
|
-
return cs.getArgument(4);
|
|
200
|
-
}
|
|
201
|
-
inline const SVFValue* getTaskFuncAtHareParForSite(CallSite cs) const
|
|
202
|
-
{
|
|
203
|
-
return getTaskFuncAtHareParForSite(cs.getInstruction());
|
|
204
|
-
}
|
|
205
|
-
//@}
|
|
206
|
-
|
|
207
|
-
/// Get the task data (i.e., the 6th parameter) of the hare_parallel_for call
|
|
208
|
-
//@{
|
|
209
|
-
inline const SVFValue* getTaskDataAtHareParForSite(const SVFInstruction *inst) const
|
|
181
|
+
inline const SVFValue* getActualParmAtForkSite(const SVFInstruction* inst) const
|
|
210
182
|
{
|
|
211
|
-
assert(
|
|
183
|
+
assert(isTDFork(inst) && "not a thread fork function!");
|
|
212
184
|
CallSite cs = getSVFCallSite(inst);
|
|
213
|
-
return cs.getArgument(
|
|
214
|
-
}
|
|
215
|
-
inline const SVFValue* getTaskDataAtHareParForSite(CallSite cs) const
|
|
216
|
-
{
|
|
217
|
-
return getTaskDataAtHareParForSite(cs.getInstruction());
|
|
185
|
+
return cs.getArgument(3);
|
|
218
186
|
}
|
|
219
187
|
//@}
|
|
220
188
|
|
|
221
189
|
/// Return true if this call wait for a worker thread
|
|
222
190
|
//@{
|
|
223
|
-
inline bool isTDJoin(const
|
|
191
|
+
inline bool isTDJoin(const ICFGNode *inst) const
|
|
224
192
|
{
|
|
225
193
|
return getType(getCallee(inst)) == TD_JOIN;
|
|
226
194
|
}
|
|
227
|
-
inline bool isTDJoin(
|
|
195
|
+
inline bool isTDJoin(const SVFInstruction* inst) const
|
|
228
196
|
{
|
|
229
|
-
return
|
|
197
|
+
return getType(getCallee(inst)) == TD_JOIN;
|
|
230
198
|
}
|
|
231
199
|
//@}
|
|
232
200
|
|
|
@@ -234,90 +202,79 @@ public:
|
|
|
234
202
|
//@{
|
|
235
203
|
/// Return the first argument of the call,
|
|
236
204
|
/// Note that, it is the pthread_t pointer
|
|
237
|
-
const SVFValue* getJoinedThread(const
|
|
238
|
-
inline const SVFValue* getJoinedThread(CallSite cs) const
|
|
239
|
-
{
|
|
240
|
-
return getJoinedThread(cs.getInstruction());
|
|
241
|
-
}
|
|
205
|
+
const SVFValue* getJoinedThread(const ICFGNode *inst) const;
|
|
242
206
|
/// Return the send argument of the call,
|
|
243
207
|
/// Note that, it is the pthread_t pointer
|
|
244
|
-
inline const SVFValue* getRetParmAtJoinedSite(const
|
|
208
|
+
inline const SVFValue* getRetParmAtJoinedSite(const ICFGNode *inst) const
|
|
245
209
|
{
|
|
246
210
|
assert(isTDJoin(inst) && "not a thread join function!");
|
|
247
211
|
CallSite cs = getSVFCallSite(inst);
|
|
248
212
|
return cs.getArgument(1);
|
|
249
213
|
}
|
|
250
|
-
inline const SVFValue* getRetParmAtJoinedSite(
|
|
214
|
+
inline const SVFValue* getRetParmAtJoinedSite(const SVFInstruction* inst) const
|
|
251
215
|
{
|
|
252
|
-
|
|
216
|
+
assert(isTDJoin(inst) && "not a thread join function!");
|
|
217
|
+
CallSite cs = getSVFCallSite(inst);
|
|
218
|
+
return cs.getArgument(1);
|
|
253
219
|
}
|
|
254
220
|
//@}
|
|
255
221
|
|
|
256
222
|
|
|
257
223
|
/// Return true if this call exits/terminate a thread
|
|
258
224
|
//@{
|
|
259
|
-
inline bool isTDExit(const
|
|
225
|
+
inline bool isTDExit(const ICFGNode *inst) const
|
|
260
226
|
{
|
|
261
227
|
return getType(getCallee(inst)) == TD_EXIT;
|
|
262
228
|
}
|
|
263
229
|
|
|
264
|
-
inline bool isTDExit(
|
|
230
|
+
inline bool isTDExit(const SVFInstruction* inst) const
|
|
265
231
|
{
|
|
266
|
-
return getType(getCallee(
|
|
232
|
+
return getType(getCallee(inst)) == TD_EXIT;
|
|
267
233
|
}
|
|
268
234
|
//@}
|
|
269
235
|
|
|
270
236
|
/// Return true if this call acquire a lock
|
|
271
237
|
//@{
|
|
272
|
-
inline bool isTDAcquire(const
|
|
238
|
+
inline bool isTDAcquire(const ICFGNode* inst) const
|
|
273
239
|
{
|
|
274
240
|
return getType(getCallee(inst)) == TD_ACQUIRE;
|
|
275
241
|
}
|
|
276
242
|
|
|
277
|
-
inline bool isTDAcquire(
|
|
243
|
+
inline bool isTDAcquire(const SVFInstruction* inst) const
|
|
278
244
|
{
|
|
279
|
-
return getType(getCallee(
|
|
245
|
+
return getType(getCallee(inst)) == TD_ACQUIRE;
|
|
280
246
|
}
|
|
281
247
|
//@}
|
|
282
248
|
|
|
283
249
|
/// Return true if this call release a lock
|
|
284
250
|
//@{
|
|
285
|
-
inline bool isTDRelease(const
|
|
251
|
+
inline bool isTDRelease(const ICFGNode *inst) const
|
|
286
252
|
{
|
|
287
253
|
return getType(getCallee(inst)) == TD_RELEASE;
|
|
288
254
|
}
|
|
289
255
|
|
|
290
|
-
inline bool isTDRelease(
|
|
256
|
+
inline bool isTDRelease(const SVFInstruction* inst) const
|
|
291
257
|
{
|
|
292
|
-
return getType(getCallee(
|
|
258
|
+
return getType(getCallee(inst)) == TD_RELEASE;
|
|
293
259
|
}
|
|
294
260
|
//@}
|
|
295
261
|
|
|
296
262
|
/// Return lock value
|
|
297
263
|
//@{
|
|
298
264
|
/// First argument of pthread_mutex_lock/pthread_mutex_unlock
|
|
299
|
-
|
|
300
|
-
{
|
|
301
|
-
assert((isTDAcquire(inst) || isTDRelease(inst)) && "not a lock acquire or release function");
|
|
302
|
-
CallSite cs = getSVFCallSite(inst);
|
|
303
|
-
return cs.getArgument(0);
|
|
304
|
-
}
|
|
305
|
-
inline const SVFValue* getLockVal(CallSite cs) const
|
|
306
|
-
{
|
|
307
|
-
return getLockVal(cs.getInstruction());
|
|
308
|
-
}
|
|
265
|
+
const SVFValue* getLockVal(const ICFGNode *inst) const;
|
|
309
266
|
//@}
|
|
310
267
|
|
|
311
268
|
/// Return true if this call waits for a barrier
|
|
312
269
|
//@{
|
|
313
|
-
inline bool isTDBarWait(const
|
|
270
|
+
inline bool isTDBarWait(const ICFGNode *inst) const
|
|
314
271
|
{
|
|
315
272
|
return getType(getCallee(inst)) == TD_BAR_WAIT;
|
|
316
273
|
}
|
|
317
274
|
|
|
318
|
-
inline bool isTDBarWait(
|
|
275
|
+
inline bool isTDBarWait(const SVFInstruction* inst) const
|
|
319
276
|
{
|
|
320
|
-
return getType(getCallee(
|
|
277
|
+
return getType(getCallee(inst)) == TD_BAR_WAIT;
|
|
321
278
|
}
|
|
322
279
|
//@}
|
|
323
280
|
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,270 +0,0 @@
|
|
|
1
|
-
//===- FSMPTA.h -- Flow-sensitive analysis of multithreaded programs-------------//
|
|
2
|
-
//
|
|
3
|
-
// SVF: Static Value-Flow Analysis
|
|
4
|
-
//
|
|
5
|
-
// Copyright (C) <2013-> <Yulei Sui>
|
|
6
|
-
//
|
|
7
|
-
|
|
8
|
-
// This program is free software: you can redistribute it and/or modify
|
|
9
|
-
// it under the terms of the GNU Affero General Public License as published by
|
|
10
|
-
// the Free Software Foundation, either version 3 of the License, or
|
|
11
|
-
// (at your option) any later version.
|
|
12
|
-
|
|
13
|
-
// This program is distributed in the hope that it will be useful,
|
|
14
|
-
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
-
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
-
// GNU Affero General Public License for more details.
|
|
17
|
-
|
|
18
|
-
// You should have received a copy of the GNU Affero General Public License
|
|
19
|
-
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
20
|
-
//
|
|
21
|
-
//===----------------------------------------------------------------------===//
|
|
22
|
-
|
|
23
|
-
/*
|
|
24
|
-
* FSMPTA.h
|
|
25
|
-
*
|
|
26
|
-
* Created on: Jul 29, 2015
|
|
27
|
-
* Author: Yulei Sui, Peng Di
|
|
28
|
-
*
|
|
29
|
-
* The implementation is based on
|
|
30
|
-
* Yulei Sui, Peng Di, and Jingling Xue. "Sparse Flow-Sensitive Pointer Analysis for Multithreaded Programs".
|
|
31
|
-
* 2016 International Symposium on Code Generation and Optimization (CGO'16)
|
|
32
|
-
*/
|
|
33
|
-
|
|
34
|
-
#ifndef FSPTANALYSIS_H_
|
|
35
|
-
#define FSPTANALYSIS_H_
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
#include "WPA/FlowSensitive.h"
|
|
39
|
-
#include "MSSA/SVFGBuilder.h"
|
|
40
|
-
#include "MTA/LockAnalysis.h"
|
|
41
|
-
#include "MemoryModel/PointsTo.h"
|
|
42
|
-
#include "MTA/MHP.h"
|
|
43
|
-
|
|
44
|
-
namespace SVF
|
|
45
|
-
{
|
|
46
|
-
|
|
47
|
-
class MHP;
|
|
48
|
-
class LockAnalysis;
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
class SVFGNodeLockSpan
|
|
52
|
-
{
|
|
53
|
-
public:
|
|
54
|
-
SVFGNodeLockSpan(const StmtSVFGNode* SVFGnode, LockAnalysis::LockSpan lockspan) :
|
|
55
|
-
SVFGNode(SVFGnode), lockSpan(lockspan) {}
|
|
56
|
-
virtual ~SVFGNodeLockSpan() {}
|
|
57
|
-
|
|
58
|
-
inline bool operator< (const SVFGNodeLockSpan& rhs) const
|
|
59
|
-
{
|
|
60
|
-
if (SVFGNode != rhs.getSVFGNode())
|
|
61
|
-
return SVFGNode < rhs.getSVFGNode();
|
|
62
|
-
return lockSpan.size() < rhs.getLockSpan().size();
|
|
63
|
-
}
|
|
64
|
-
inline SVFGNodeLockSpan& operator= (const SVFGNodeLockSpan& rhs)
|
|
65
|
-
{
|
|
66
|
-
if(*this != rhs)
|
|
67
|
-
{
|
|
68
|
-
SVFGNode = rhs.getSVFGNode();
|
|
69
|
-
lockSpan = rhs.getLockSpan();
|
|
70
|
-
}
|
|
71
|
-
return *this;
|
|
72
|
-
}
|
|
73
|
-
inline bool operator== (const SVFGNodeLockSpan& rhs) const
|
|
74
|
-
{
|
|
75
|
-
return (SVFGNode == rhs.getSVFGNode() && lockSpan == rhs.getLockSpan());
|
|
76
|
-
}
|
|
77
|
-
inline bool operator!= (const SVFGNodeLockSpan& rhs) const
|
|
78
|
-
{
|
|
79
|
-
return !(*this == rhs);
|
|
80
|
-
}
|
|
81
|
-
inline const StmtSVFGNode* getSVFGNode() const
|
|
82
|
-
{
|
|
83
|
-
return SVFGNode;
|
|
84
|
-
}
|
|
85
|
-
inline const LockAnalysis::LockSpan getLockSpan() const
|
|
86
|
-
{
|
|
87
|
-
return lockSpan;
|
|
88
|
-
}
|
|
89
|
-
private:
|
|
90
|
-
const StmtSVFGNode* SVFGNode;
|
|
91
|
-
LockAnalysis::LockSpan lockSpan;
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
/*!
|
|
95
|
-
* SVFG builder for DDA
|
|
96
|
-
*/
|
|
97
|
-
class MTASVFGBuilder : public SVFGBuilder
|
|
98
|
-
{
|
|
99
|
-
|
|
100
|
-
public:
|
|
101
|
-
typedef PointerAnalysis::CallSiteSet CallSiteSet;
|
|
102
|
-
typedef PointerAnalysis::CallEdgeMap CallEdgeMap;
|
|
103
|
-
typedef PointerAnalysis::FunctionSet FunctionSet;
|
|
104
|
-
typedef Set<const SVFGNode*> SVFGNodeSet;
|
|
105
|
-
typedef std::vector<const SVFGNode*> SVFGNodeVec;
|
|
106
|
-
typedef NodeBS SVFGNodeIDSet;
|
|
107
|
-
typedef Set<const SVFInstruction*> InstSet;
|
|
108
|
-
typedef std::pair<NodeID,NodeID> NodeIDPair;
|
|
109
|
-
typedef Map<SVFGNodeLockSpan, bool> PairToBoolMap;
|
|
110
|
-
|
|
111
|
-
/// Constructor
|
|
112
|
-
MTASVFGBuilder(MHP* m, LockAnalysis* la) : SVFGBuilder(), mhp(m), lockana(la)
|
|
113
|
-
{
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
/// Destructor
|
|
117
|
-
virtual ~MTASVFGBuilder() {}
|
|
118
|
-
|
|
119
|
-
/// Number of newly added SVFG edges
|
|
120
|
-
static u32_t numOfNewSVFGEdges;
|
|
121
|
-
static u32_t numOfRemovedSVFGEdges;
|
|
122
|
-
static u32_t numOfRemovedPTS;
|
|
123
|
-
|
|
124
|
-
protected:
|
|
125
|
-
/// Re-write create SVFG method
|
|
126
|
-
virtual void buildSVFG();
|
|
127
|
-
|
|
128
|
-
private:
|
|
129
|
-
/// Record edges
|
|
130
|
-
bool recordEdge(NodeID id1, NodeID id2, PointsTo pts);
|
|
131
|
-
bool recordAddingEdge(NodeID id1, NodeID id2, PointsTo pts);
|
|
132
|
-
bool recordRemovingEdge(NodeID id1, NodeID id2, PointsTo pts);
|
|
133
|
-
/// perform adding/removing MHP Edges in value flow graph
|
|
134
|
-
void performAddingMHPEdges();
|
|
135
|
-
void performRemovingMHPEdges();
|
|
136
|
-
SVFGEdge* addTDEdges(NodeID srcId, NodeID dstId, PointsTo& pts);
|
|
137
|
-
/// Connect MHP indirect value-flow edges for two nodes that may-happen-in-parallel
|
|
138
|
-
void connectMHPEdges(PointerAnalysis* pta);
|
|
139
|
-
|
|
140
|
-
void handleStoreLoadNonSparse(const StmtSVFGNode* n1,const StmtSVFGNode* n2, PointerAnalysis* pta);
|
|
141
|
-
void handleStoreStoreNonSparse(const StmtSVFGNode* n1,const StmtSVFGNode* n2, PointerAnalysis* pta);
|
|
142
|
-
|
|
143
|
-
void handleStoreLoad(const StmtSVFGNode* n1,const StmtSVFGNode* n2, PointerAnalysis* pta);
|
|
144
|
-
void handleStoreStore(const StmtSVFGNode* n1,const StmtSVFGNode* n2, PointerAnalysis* pta);
|
|
145
|
-
|
|
146
|
-
void handleStoreLoadWithLockPrecisely(const StmtSVFGNode* n1,const StmtSVFGNode* n2, PointerAnalysis* pta);
|
|
147
|
-
void handleStoreStoreWithLockPrecisely(const StmtSVFGNode* n1,const StmtSVFGNode* n2, PointerAnalysis* pta);
|
|
148
|
-
|
|
149
|
-
void mergeSpan(NodeBS comlocks, InstSet& res);
|
|
150
|
-
void readPrecision();
|
|
151
|
-
|
|
152
|
-
SVFGNodeIDSet getPrevNodes(const StmtSVFGNode* n);
|
|
153
|
-
SVFGNodeIDSet getSuccNodes(const StmtSVFGNode* n);
|
|
154
|
-
SVFGNodeIDSet getSuccNodes(const StmtSVFGNode* n, NodeID o);
|
|
155
|
-
|
|
156
|
-
bool isHeadofSpan(const StmtSVFGNode* n, LockAnalysis::LockSpan lspan);
|
|
157
|
-
bool isTailofSpan(const StmtSVFGNode* n, LockAnalysis::LockSpan lspan);
|
|
158
|
-
bool isHeadofSpan(const StmtSVFGNode* n, InstSet mergespan);
|
|
159
|
-
bool isTailofSpan(const StmtSVFGNode* n, InstSet mergespan);
|
|
160
|
-
bool isHeadofSpan(const StmtSVFGNode* n);
|
|
161
|
-
bool isTailofSpan(const StmtSVFGNode* n);
|
|
162
|
-
/// Collect all loads/stores SVFGNodes
|
|
163
|
-
void collectLoadStoreSVFGNodes();
|
|
164
|
-
|
|
165
|
-
/// all stores/loads SVFGNodes
|
|
166
|
-
SVFGNodeSet stnodeSet;
|
|
167
|
-
SVFGNodeSet ldnodeSet;
|
|
168
|
-
|
|
169
|
-
/// MHP class
|
|
170
|
-
MHP* mhp;
|
|
171
|
-
LockAnalysis* lockana;
|
|
172
|
-
|
|
173
|
-
Set<NodeIDPair> recordedges;
|
|
174
|
-
Map<NodeIDPair, PointsTo> edge2pts;
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
Map<const StmtSVFGNode*, SVFGNodeIDSet> prevset;
|
|
178
|
-
Map<const StmtSVFGNode*, SVFGNodeIDSet> succset;
|
|
179
|
-
|
|
180
|
-
Map<const StmtSVFGNode*, bool> headmap;
|
|
181
|
-
Map<const StmtSVFGNode*, bool> tailmap;
|
|
182
|
-
|
|
183
|
-
PairToBoolMap pairheadmap;
|
|
184
|
-
PairToBoolMap pairtailmap;
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
static const u32_t ADDEDGE_NOEDGE= 0;
|
|
188
|
-
static const u32_t ADDEDGE_NONSPARSE= 1;
|
|
189
|
-
static const u32_t ADDEDGE_ALLOPT= 2;
|
|
190
|
-
static const u32_t ADDEDGE_NOMHP= 3;
|
|
191
|
-
static const u32_t ADDEDGE_NOALIAS= 4;
|
|
192
|
-
static const u32_t ADDEDGE_NOLOCK= 5;
|
|
193
|
-
static const u32_t ADDEDGE_NORP= 6;
|
|
194
|
-
// static const u32_t ADDEDGE_PRECISELOCK= 5;
|
|
195
|
-
|
|
196
|
-
};
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
/*!
|
|
200
|
-
* Flow-sensitive pointer analysis for multithreaded programs
|
|
201
|
-
*/
|
|
202
|
-
class FSMPTA : public FlowSensitive
|
|
203
|
-
{
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
public:
|
|
207
|
-
|
|
208
|
-
/// Constructor
|
|
209
|
-
FSMPTA(MHP* m, LockAnalysis* la) : FlowSensitive(m->getTCT()->getPTA()->getPAG()), mhp(m), lockana(la)
|
|
210
|
-
{
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
/// Destructor
|
|
214
|
-
~FSMPTA()
|
|
215
|
-
{
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
/// Initialize analysis
|
|
219
|
-
void initialize(SVFModule* module);
|
|
220
|
-
|
|
221
|
-
inline SVFIR* getPAG()
|
|
222
|
-
{
|
|
223
|
-
return mhp->getTCT()->getPTA()->getPAG();
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
/// Create single instance of flow-sensitive pointer analysis
|
|
227
|
-
static FSMPTA* createFSMPTA(SVFModule* module, MHP* m, LockAnalysis* la)
|
|
228
|
-
{
|
|
229
|
-
if (mfspta == nullptr)
|
|
230
|
-
{
|
|
231
|
-
mfspta = new FSMPTA(m,la);
|
|
232
|
-
mfspta->analyze();
|
|
233
|
-
}
|
|
234
|
-
return mfspta;
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
/// Release flow-sensitive pointer analysis
|
|
238
|
-
static void releaseFSMPTA()
|
|
239
|
-
{
|
|
240
|
-
if (mfspta)
|
|
241
|
-
delete mfspta;
|
|
242
|
-
mfspta = nullptr;
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
/// Get MHP
|
|
246
|
-
inline MHP* getMHP() const
|
|
247
|
-
{
|
|
248
|
-
return mhp;
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
private:
|
|
252
|
-
static FSMPTA* mfspta;
|
|
253
|
-
MHP* mhp;
|
|
254
|
-
LockAnalysis* lockana;
|
|
255
|
-
using FlowSensitive::initialize;
|
|
256
|
-
};
|
|
257
|
-
|
|
258
|
-
} // End namespace SVF
|
|
259
|
-
|
|
260
|
-
template <> struct std::hash<SVF::SVFGNodeLockSpan>
|
|
261
|
-
{
|
|
262
|
-
size_t operator()(const SVF::SVFGNodeLockSpan &cs) const
|
|
263
|
-
{
|
|
264
|
-
std::hash<SVF::StmtSVFGNode* >h;
|
|
265
|
-
SVF::StmtSVFGNode* node = const_cast<SVF::StmtSVFGNode* > (cs.getSVFGNode());
|
|
266
|
-
return h(node);
|
|
267
|
-
}
|
|
268
|
-
};
|
|
269
|
-
|
|
270
|
-
#endif /* FSPTANALYSIS_H_ */
|