svf-tools 1.0.677 → 1.0.679
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-doxygen/wiki/cpu2017-wllvm.cfg +999 -0
- package/package.json +1 -1
- package/svf/include/Graphs/CHG.h +27 -14
- package/svf/include/Graphs/GenericGraph.h +10 -4
- package/svf/include/Graphs/ICFG.h +6 -1
- package/svf/include/Graphs/ICFGEdge.h +41 -31
- package/svf/include/Graphs/ICFGNode.h +14 -2
- package/svf/include/Graphs/IRGraph.h +22 -14
- package/svf/include/MemoryModel/LocationSet.h +10 -8
- package/svf/include/MemoryModel/SVFLoop.h +2 -0
- package/svf/include/SVFIR/SVFIR.h +42 -23
- package/svf/include/SVFIR/SVFIRRW.h +624 -0
- package/svf/include/SVFIR/SVFModule.h +1 -0
- package/svf/include/SVFIR/SVFModuleRW.h +3 -6
- package/svf/include/SVFIR/SVFStatements.h +247 -185
- package/svf/include/SVFIR/SVFType.h +4 -0
- package/svf/include/SVFIR/SVFValue.h +28 -9
- package/svf/include/SVFIR/SVFVariables.h +75 -78
- package/svf/include/SVFIR/SymbolTableInfo.h +19 -11
- package/svf/include/Util/CommandLine.h +1 -1
- package/svf/include/Util/Options.h +1 -0
- package/svf/include/Util/SparseBitVector.h +6 -0
- package/svf/include/Util/ThreadAPI.h +15 -15
- package/svf/lib/AbstractExecution/SVFIR2ItvExeState.cpp +61 -17
- package/svf/lib/Graphs/ICFG.cpp +2 -3
- package/svf/lib/SVFIR/SVFIRRW.cpp +1118 -0
- package/svf/lib/SVFIR/SymbolTableInfo.cpp +1 -1
- package/svf/lib/Util/Options.cpp +6 -0
- package/svf-llvm/include/SVF-LLVM/DCHG.h +36 -35
- package/svf-llvm/lib/LLVMModule.cpp +0 -5
- package/svf-llvm/lib/SVFIRBuilder.cpp +10 -2
- package/svf-llvm/tools/WPA/wpa.cpp +4 -0
|
@@ -50,30 +50,44 @@ class FunExitICFGNode;
|
|
|
50
50
|
typedef GenericEdge<SVFVar> GenericPAGEdgeTy;
|
|
51
51
|
class SVFStmt : public GenericPAGEdgeTy
|
|
52
52
|
{
|
|
53
|
+
friend class SVFIRWriter;
|
|
53
54
|
|
|
54
55
|
public:
|
|
55
56
|
/// Types of SVFIR statements
|
|
56
57
|
/// Gep represents (base + offset) for field sensitivity
|
|
57
|
-
/// ThreadFork/ThreadJoin is to model parameter passings between thread
|
|
58
|
+
/// ThreadFork/ThreadJoin is to model parameter passings between thread
|
|
59
|
+
/// spawners and spawnees.
|
|
58
60
|
enum PEDGEK
|
|
59
61
|
{
|
|
60
|
-
Addr,
|
|
62
|
+
Addr,
|
|
63
|
+
Copy,
|
|
64
|
+
Store,
|
|
65
|
+
Load,
|
|
66
|
+
Call,
|
|
67
|
+
Ret,
|
|
68
|
+
Gep,
|
|
69
|
+
Phi,
|
|
70
|
+
Select,
|
|
71
|
+
Cmp,
|
|
72
|
+
BinaryOp,
|
|
73
|
+
UnaryOp,
|
|
74
|
+
Branch,
|
|
75
|
+
ThreadFork,
|
|
76
|
+
ThreadJoin
|
|
61
77
|
};
|
|
62
78
|
|
|
63
79
|
private:
|
|
64
|
-
const SVFValue* value;
|
|
65
|
-
const SVFBasicBlock* basicBlock;
|
|
66
|
-
ICFGNode
|
|
67
|
-
EdgeID edgeId;
|
|
80
|
+
const SVFValue* value; ///< LLVM value
|
|
81
|
+
const SVFBasicBlock* basicBlock; ///< LLVM BasicBlock
|
|
82
|
+
ICFGNode* icfgNode; ///< ICFGNode
|
|
83
|
+
EdgeID edgeId; ///< Edge ID
|
|
68
84
|
public:
|
|
69
|
-
static u32_t totalEdgeNum;
|
|
85
|
+
static u32_t totalEdgeNum; ///< Total edge number
|
|
70
86
|
|
|
71
87
|
/// Constructor
|
|
72
|
-
SVFStmt(SVFVar* s, SVFVar* d, GEdgeFlag k, bool real=true);
|
|
88
|
+
SVFStmt(SVFVar* s, SVFVar* d, GEdgeFlag k, bool real = true);
|
|
73
89
|
/// Destructor
|
|
74
|
-
~SVFStmt()
|
|
75
|
-
{
|
|
76
|
-
}
|
|
90
|
+
~SVFStmt() {}
|
|
77
91
|
|
|
78
92
|
/// ClassOf
|
|
79
93
|
//@{
|
|
@@ -81,7 +95,7 @@ public:
|
|
|
81
95
|
{
|
|
82
96
|
return true;
|
|
83
97
|
}
|
|
84
|
-
static inline bool classof(const GenericPAGEdgeTy
|
|
98
|
+
static inline bool classof(const GenericPAGEdgeTy* edge)
|
|
85
99
|
{
|
|
86
100
|
return edge->getEdgeKind() == SVFStmt::Addr ||
|
|
87
101
|
edge->getEdgeKind() == SVFStmt::Copy ||
|
|
@@ -92,7 +106,7 @@ public:
|
|
|
92
106
|
edge->getEdgeKind() == SVFStmt::Gep ||
|
|
93
107
|
edge->getEdgeKind() == SVFStmt::Cmp ||
|
|
94
108
|
edge->getEdgeKind() == SVFStmt::BinaryOp ||
|
|
95
|
-
edge->getEdgeKind() == SVFStmt::UnaryOp
|
|
109
|
+
edge->getEdgeKind() == SVFStmt::UnaryOp ||
|
|
96
110
|
edge->getEdgeKind() == SVFStmt::ThreadFork ||
|
|
97
111
|
edge->getEdgeKind() == SVFStmt::ThreadJoin;
|
|
98
112
|
}
|
|
@@ -130,7 +144,7 @@ public:
|
|
|
130
144
|
{
|
|
131
145
|
return basicBlock;
|
|
132
146
|
}
|
|
133
|
-
inline void setICFGNode(ICFGNode
|
|
147
|
+
inline void setICFGNode(ICFGNode* node)
|
|
134
148
|
{
|
|
135
149
|
icfgNode = node;
|
|
136
150
|
}
|
|
@@ -140,31 +154,36 @@ public:
|
|
|
140
154
|
}
|
|
141
155
|
//@}
|
|
142
156
|
|
|
143
|
-
/// Compute the unique edgeFlag value from edge kind and second variable
|
|
144
|
-
|
|
157
|
+
/// Compute the unique edgeFlag value from edge kind and second variable
|
|
158
|
+
/// operand for MultiOpndStmt.
|
|
159
|
+
static inline GEdgeFlag makeEdgeFlagWithAddionalOpnd(GEdgeKind k,
|
|
160
|
+
const SVFVar* var)
|
|
145
161
|
{
|
|
146
162
|
Var2LabelMap::const_iterator iter = var2LabelMap.find(var);
|
|
147
|
-
u64_t label = (iter != var2LabelMap.end()) ?
|
|
148
|
-
|
|
163
|
+
u64_t label = (iter != var2LabelMap.end()) ? iter->second
|
|
164
|
+
: multiOpndLabelCounter++;
|
|
149
165
|
return (label << EdgeKindMaskBits) | k;
|
|
150
166
|
}
|
|
151
167
|
|
|
152
|
-
/// Compute the unique edgeFlag value from edge kind and call site
|
|
153
|
-
|
|
168
|
+
/// Compute the unique edgeFlag value from edge kind and call site
|
|
169
|
+
/// Instruction.
|
|
170
|
+
static inline GEdgeFlag makeEdgeFlagWithCallInst(GEdgeKind k,
|
|
171
|
+
const ICFGNode* cs)
|
|
154
172
|
{
|
|
155
173
|
Inst2LabelMap::const_iterator iter = inst2LabelMap.find(cs);
|
|
156
|
-
u64_t label = (iter != inst2LabelMap.end()) ?
|
|
157
|
-
|
|
174
|
+
u64_t label = (iter != inst2LabelMap.end()) ? iter->second
|
|
175
|
+
: callEdgeLabelCounter++;
|
|
158
176
|
return (label << EdgeKindMaskBits) | k;
|
|
159
177
|
}
|
|
160
178
|
|
|
161
179
|
/// Compute the unique edgeFlag value from edge kind and store Instruction.
|
|
162
180
|
/// Two store instructions may share the same StorePAGEdge
|
|
163
|
-
static inline GEdgeFlag makeEdgeFlagWithStoreInst(GEdgeKind k,
|
|
181
|
+
static inline GEdgeFlag makeEdgeFlagWithStoreInst(GEdgeKind k,
|
|
182
|
+
const ICFGNode* store)
|
|
164
183
|
{
|
|
165
184
|
Inst2LabelMap::const_iterator iter = inst2LabelMap.find(store);
|
|
166
|
-
u64_t label = (iter != inst2LabelMap.end()) ?
|
|
167
|
-
|
|
185
|
+
u64_t label = (iter != inst2LabelMap.end()) ? iter->second
|
|
186
|
+
: storeEdgeLabelCounter++;
|
|
168
187
|
return (label << EdgeKindMaskBits) | k;
|
|
169
188
|
}
|
|
170
189
|
|
|
@@ -202,6 +221,7 @@ private:
|
|
|
202
221
|
*/
|
|
203
222
|
class AssignStmt : public SVFStmt
|
|
204
223
|
{
|
|
224
|
+
friend class SVFIRWriter;
|
|
205
225
|
|
|
206
226
|
private:
|
|
207
227
|
AssignStmt(); ///< place holder
|
|
@@ -214,18 +234,16 @@ private:
|
|
|
214
234
|
|
|
215
235
|
protected:
|
|
216
236
|
/// constructor
|
|
217
|
-
AssignStmt(SVFVar* s, SVFVar* d, GEdgeFlag k) : SVFStmt(s,d,k)
|
|
218
|
-
{
|
|
219
|
-
}
|
|
237
|
+
AssignStmt(SVFVar* s, SVFVar* d, GEdgeFlag k) : SVFStmt(s, d, k) {}
|
|
220
238
|
|
|
221
239
|
public:
|
|
222
240
|
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
223
241
|
//@{
|
|
224
|
-
static inline bool classof(const AssignStmt
|
|
242
|
+
static inline bool classof(const AssignStmt*)
|
|
225
243
|
{
|
|
226
244
|
return true;
|
|
227
245
|
}
|
|
228
|
-
static inline bool classof(const SVFStmt
|
|
246
|
+
static inline bool classof(const SVFStmt* edge)
|
|
229
247
|
{
|
|
230
248
|
return edge->getEdgeKind() == SVFStmt::Addr ||
|
|
231
249
|
edge->getEdgeKind() == SVFStmt::Copy ||
|
|
@@ -237,7 +255,7 @@ public:
|
|
|
237
255
|
edge->getEdgeKind() == SVFStmt::ThreadFork ||
|
|
238
256
|
edge->getEdgeKind() == SVFStmt::ThreadJoin;
|
|
239
257
|
}
|
|
240
|
-
static inline bool classof(const GenericPAGEdgeTy
|
|
258
|
+
static inline bool classof(const GenericPAGEdgeTy* edge)
|
|
241
259
|
{
|
|
242
260
|
return edge->getEdgeKind() == SVFStmt::Addr ||
|
|
243
261
|
edge->getEdgeKind() == SVFStmt::Copy ||
|
|
@@ -276,67 +294,66 @@ public:
|
|
|
276
294
|
*/
|
|
277
295
|
class AddrStmt: public AssignStmt
|
|
278
296
|
{
|
|
297
|
+
friend class SVFIRWriter;
|
|
298
|
+
|
|
279
299
|
private:
|
|
280
300
|
AddrStmt(); ///< place holder
|
|
281
|
-
AddrStmt(const AddrStmt
|
|
282
|
-
void operator=(const AddrStmt
|
|
301
|
+
AddrStmt(const AddrStmt&); ///< place holder
|
|
302
|
+
void operator=(const AddrStmt&); ///< place holder
|
|
283
303
|
|
|
284
304
|
public:
|
|
285
305
|
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
286
306
|
//@{
|
|
287
|
-
static inline bool classof(const AddrStmt
|
|
307
|
+
static inline bool classof(const AddrStmt*)
|
|
288
308
|
{
|
|
289
309
|
return true;
|
|
290
310
|
}
|
|
291
|
-
static inline bool classof(const SVFStmt
|
|
311
|
+
static inline bool classof(const SVFStmt* edge)
|
|
292
312
|
{
|
|
293
313
|
return edge->getEdgeKind() == SVFStmt::Addr;
|
|
294
314
|
}
|
|
295
|
-
static inline bool classof(const GenericPAGEdgeTy
|
|
315
|
+
static inline bool classof(const GenericPAGEdgeTy* edge)
|
|
296
316
|
{
|
|
297
317
|
return edge->getEdgeKind() == SVFStmt::Addr;
|
|
298
318
|
}
|
|
299
319
|
//@}
|
|
300
320
|
|
|
301
321
|
/// constructor
|
|
302
|
-
AddrStmt(SVFVar* s, SVFVar* d) : AssignStmt(s,d,SVFStmt::Addr)
|
|
303
|
-
{
|
|
304
|
-
}
|
|
322
|
+
AddrStmt(SVFVar* s, SVFVar* d) : AssignStmt(s, d, SVFStmt::Addr) {}
|
|
305
323
|
|
|
306
324
|
virtual const std::string toString() const override;
|
|
307
325
|
};
|
|
308
326
|
|
|
309
|
-
|
|
310
327
|
/*!
|
|
311
328
|
* Copy statements (simple assignment and casting)
|
|
312
329
|
*/
|
|
313
330
|
class CopyStmt: public AssignStmt
|
|
314
331
|
{
|
|
332
|
+
friend class SVFIRWriter;
|
|
333
|
+
|
|
315
334
|
private:
|
|
316
335
|
CopyStmt(); ///< place holder
|
|
317
|
-
CopyStmt(const CopyStmt
|
|
318
|
-
void operator=(const CopyStmt
|
|
336
|
+
CopyStmt(const CopyStmt&); ///< place holder
|
|
337
|
+
void operator=(const CopyStmt&); ///< place holder
|
|
319
338
|
public:
|
|
320
339
|
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
321
340
|
//@{
|
|
322
|
-
static inline bool classof(const CopyStmt
|
|
341
|
+
static inline bool classof(const CopyStmt*)
|
|
323
342
|
{
|
|
324
343
|
return true;
|
|
325
344
|
}
|
|
326
|
-
static inline bool classof(const SVFStmt
|
|
345
|
+
static inline bool classof(const SVFStmt* edge)
|
|
327
346
|
{
|
|
328
347
|
return edge->getEdgeKind() == SVFStmt::Copy;
|
|
329
348
|
}
|
|
330
|
-
static inline bool classof(const GenericPAGEdgeTy
|
|
349
|
+
static inline bool classof(const GenericPAGEdgeTy* edge)
|
|
331
350
|
{
|
|
332
351
|
return edge->getEdgeKind() == SVFStmt::Copy;
|
|
333
352
|
}
|
|
334
353
|
//@}
|
|
335
354
|
|
|
336
355
|
/// constructor
|
|
337
|
-
CopyStmt(SVFVar* s, SVFVar* d) : AssignStmt(s,d,SVFStmt::Copy)
|
|
338
|
-
{
|
|
339
|
-
}
|
|
356
|
+
CopyStmt(SVFVar* s, SVFVar* d) : AssignStmt(s, d, SVFStmt::Copy) {}
|
|
340
357
|
|
|
341
358
|
virtual const std::string toString() const override;
|
|
342
359
|
};
|
|
@@ -346,23 +363,25 @@ public:
|
|
|
346
363
|
*/
|
|
347
364
|
class StoreStmt: public AssignStmt
|
|
348
365
|
{
|
|
366
|
+
friend class SVFIRWriter;
|
|
367
|
+
|
|
349
368
|
private:
|
|
350
369
|
StoreStmt(); ///< place holder
|
|
351
|
-
StoreStmt(const StoreStmt
|
|
352
|
-
void operator=(const StoreStmt
|
|
370
|
+
StoreStmt(const StoreStmt&); ///< place holder
|
|
371
|
+
void operator=(const StoreStmt&); ///< place holder
|
|
353
372
|
|
|
354
373
|
public:
|
|
355
374
|
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
356
375
|
//@{
|
|
357
|
-
static inline bool classof(const StoreStmt
|
|
376
|
+
static inline bool classof(const StoreStmt*)
|
|
358
377
|
{
|
|
359
378
|
return true;
|
|
360
379
|
}
|
|
361
|
-
static inline bool classof(const SVFStmt
|
|
380
|
+
static inline bool classof(const SVFStmt* edge)
|
|
362
381
|
{
|
|
363
382
|
return edge->getEdgeKind() == SVFStmt::Store;
|
|
364
383
|
}
|
|
365
|
-
static inline bool classof(const GenericPAGEdgeTy
|
|
384
|
+
static inline bool classof(const GenericPAGEdgeTy* edge)
|
|
366
385
|
{
|
|
367
386
|
return edge->getEdgeKind() == SVFStmt::Store;
|
|
368
387
|
}
|
|
@@ -374,48 +393,48 @@ public:
|
|
|
374
393
|
virtual const std::string toString() const override;
|
|
375
394
|
};
|
|
376
395
|
|
|
377
|
-
|
|
378
396
|
/*!
|
|
379
397
|
* Load statement
|
|
380
398
|
*/
|
|
381
399
|
class LoadStmt: public AssignStmt
|
|
382
400
|
{
|
|
401
|
+
friend class SVFIRWriter;
|
|
402
|
+
|
|
383
403
|
private:
|
|
384
404
|
LoadStmt(); ///< place holder
|
|
385
|
-
LoadStmt(const LoadStmt
|
|
386
|
-
void operator=(const LoadStmt
|
|
405
|
+
LoadStmt(const LoadStmt&); ///< place holder
|
|
406
|
+
void operator=(const LoadStmt&); ///< place holder
|
|
387
407
|
|
|
388
408
|
public:
|
|
389
409
|
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
390
410
|
//@{
|
|
391
|
-
static inline bool classof(const LoadStmt
|
|
411
|
+
static inline bool classof(const LoadStmt*)
|
|
392
412
|
{
|
|
393
413
|
return true;
|
|
394
414
|
}
|
|
395
|
-
static inline bool classof(const SVFStmt
|
|
415
|
+
static inline bool classof(const SVFStmt* edge)
|
|
396
416
|
{
|
|
397
417
|
return edge->getEdgeKind() == SVFStmt::Load;
|
|
398
418
|
}
|
|
399
|
-
static inline bool classof(const GenericPAGEdgeTy
|
|
419
|
+
static inline bool classof(const GenericPAGEdgeTy* edge)
|
|
400
420
|
{
|
|
401
421
|
return edge->getEdgeKind() == SVFStmt::Load;
|
|
402
422
|
}
|
|
403
423
|
//@}
|
|
404
424
|
|
|
405
425
|
/// constructor
|
|
406
|
-
LoadStmt(SVFVar* s, SVFVar* d) : AssignStmt(s,d,SVFStmt::Load)
|
|
407
|
-
{
|
|
408
|
-
}
|
|
426
|
+
LoadStmt(SVFVar* s, SVFVar* d) : AssignStmt(s, d, SVFStmt::Load) {}
|
|
409
427
|
|
|
410
428
|
virtual const std::string toString() const override;
|
|
411
429
|
};
|
|
412
430
|
|
|
413
|
-
|
|
414
431
|
/*!
|
|
415
432
|
* Gep statement for struct field access, array access and pointer arithmetic
|
|
416
433
|
*/
|
|
417
434
|
class GepStmt: public AssignStmt
|
|
418
435
|
{
|
|
436
|
+
friend class SVFIRWriter;
|
|
437
|
+
|
|
419
438
|
private:
|
|
420
439
|
GepStmt(); ///< place holder
|
|
421
440
|
GepStmt(const GepStmt &); ///< place holder
|
|
@@ -426,15 +445,15 @@ private:
|
|
|
426
445
|
public:
|
|
427
446
|
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
428
447
|
//@{
|
|
429
|
-
static inline bool classof(const GepStmt
|
|
448
|
+
static inline bool classof(const GepStmt*)
|
|
430
449
|
{
|
|
431
450
|
return true;
|
|
432
451
|
}
|
|
433
|
-
static inline bool classof(const SVFStmt
|
|
452
|
+
static inline bool classof(const SVFStmt* edge)
|
|
434
453
|
{
|
|
435
454
|
return edge->getEdgeKind() == SVFStmt::Gep;
|
|
436
455
|
}
|
|
437
|
-
static inline bool classof(const GenericPAGEdgeTy
|
|
456
|
+
static inline bool classof(const GenericPAGEdgeTy* edge)
|
|
438
457
|
{
|
|
439
458
|
return edge->getEdgeKind() == SVFStmt::Gep;
|
|
440
459
|
}
|
|
@@ -471,7 +490,8 @@ public:
|
|
|
471
490
|
}
|
|
472
491
|
|
|
473
492
|
/// constructor
|
|
474
|
-
GepStmt(SVFVar* s, SVFVar* d, const LocationSet& l, bool varfld=false)
|
|
493
|
+
GepStmt(SVFVar* s, SVFVar* d, const LocationSet& l, bool varfld = false)
|
|
494
|
+
: AssignStmt(s, d, SVFStmt::Gep), ls(l), variantField(varfld)
|
|
475
495
|
{
|
|
476
496
|
}
|
|
477
497
|
|
|
@@ -485,29 +505,31 @@ public:
|
|
|
485
505
|
*/
|
|
486
506
|
class CallPE: public AssignStmt
|
|
487
507
|
{
|
|
508
|
+
friend class SVFIRWriter;
|
|
509
|
+
|
|
488
510
|
private:
|
|
489
511
|
CallPE(); ///< place holder
|
|
490
|
-
CallPE(const CallPE
|
|
491
|
-
void operator=(const CallPE
|
|
512
|
+
CallPE(const CallPE&); ///< place holder
|
|
513
|
+
void operator=(const CallPE&); ///< place holder
|
|
492
514
|
|
|
493
|
-
const CallICFGNode* call;
|
|
494
|
-
const FunEntryICFGNode* entry;
|
|
515
|
+
const CallICFGNode* call; /// the callsite statement calling from
|
|
516
|
+
const FunEntryICFGNode* entry; /// the function exit statement calling to
|
|
495
517
|
public:
|
|
496
518
|
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
497
519
|
//@{
|
|
498
|
-
static inline bool classof(const CallPE
|
|
520
|
+
static inline bool classof(const CallPE*)
|
|
499
521
|
{
|
|
500
522
|
return true;
|
|
501
523
|
}
|
|
502
|
-
static inline bool classof(const SVFStmt
|
|
524
|
+
static inline bool classof(const SVFStmt* edge)
|
|
503
525
|
{
|
|
504
|
-
return edge->getEdgeKind() == SVFStmt::Call
|
|
505
|
-
|
|
526
|
+
return edge->getEdgeKind() == SVFStmt::Call ||
|
|
527
|
+
edge->getEdgeKind() == SVFStmt::ThreadFork;
|
|
506
528
|
}
|
|
507
|
-
static inline bool classof(const GenericPAGEdgeTy
|
|
529
|
+
static inline bool classof(const GenericPAGEdgeTy* edge)
|
|
508
530
|
{
|
|
509
|
-
return edge->getEdgeKind() == SVFStmt::Call
|
|
510
|
-
|
|
531
|
+
return edge->getEdgeKind() == SVFStmt::Call ||
|
|
532
|
+
edge->getEdgeKind() == SVFStmt::ThreadFork;
|
|
511
533
|
}
|
|
512
534
|
//@}
|
|
513
535
|
|
|
@@ -534,35 +556,36 @@ public:
|
|
|
534
556
|
virtual const std::string toString() const override;
|
|
535
557
|
};
|
|
536
558
|
|
|
537
|
-
|
|
538
559
|
/*!
|
|
539
560
|
* Return
|
|
540
561
|
*/
|
|
541
562
|
class RetPE: public AssignStmt
|
|
542
563
|
{
|
|
564
|
+
friend class SVFIRWriter;
|
|
565
|
+
|
|
543
566
|
private:
|
|
544
567
|
RetPE(); ///< place holder
|
|
545
|
-
RetPE(const RetPE
|
|
546
|
-
void operator=(const RetPE
|
|
568
|
+
RetPE(const RetPE&); ///< place holder
|
|
569
|
+
void operator=(const RetPE&); ///< place holder
|
|
547
570
|
|
|
548
|
-
const CallICFGNode* call;
|
|
549
|
-
const FunExitICFGNode* exit;
|
|
571
|
+
const CallICFGNode* call; /// the callsite statement returning to
|
|
572
|
+
const FunExitICFGNode* exit; /// the function exit statement returned from
|
|
550
573
|
public:
|
|
551
574
|
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
552
575
|
//@{
|
|
553
|
-
static inline bool classof(const RetPE
|
|
576
|
+
static inline bool classof(const RetPE*)
|
|
554
577
|
{
|
|
555
578
|
return true;
|
|
556
579
|
}
|
|
557
|
-
static inline bool classof(const SVFStmt
|
|
580
|
+
static inline bool classof(const SVFStmt* edge)
|
|
558
581
|
{
|
|
559
|
-
return edge->getEdgeKind() == SVFStmt::Ret
|
|
560
|
-
|
|
582
|
+
return edge->getEdgeKind() == SVFStmt::Ret ||
|
|
583
|
+
edge->getEdgeKind() == SVFStmt::ThreadJoin;
|
|
561
584
|
}
|
|
562
|
-
static inline bool classof(const GenericPAGEdgeTy
|
|
585
|
+
static inline bool classof(const GenericPAGEdgeTy* edge)
|
|
563
586
|
{
|
|
564
|
-
return edge->getEdgeKind() == SVFStmt::Ret
|
|
565
|
-
|
|
587
|
+
return edge->getEdgeKind() == SVFStmt::Ret ||
|
|
588
|
+
edge->getEdgeKind() == SVFStmt::ThreadJoin;
|
|
566
589
|
}
|
|
567
590
|
//@}
|
|
568
591
|
|
|
@@ -594,44 +617,45 @@ public:
|
|
|
594
617
|
*/
|
|
595
618
|
class MultiOpndStmt : public SVFStmt
|
|
596
619
|
{
|
|
620
|
+
friend class SVFIRWriter;
|
|
621
|
+
|
|
597
622
|
public:
|
|
598
623
|
typedef std::vector<SVFVar*> OPVars;
|
|
624
|
+
|
|
599
625
|
private:
|
|
600
626
|
MultiOpndStmt(); ///< place holder
|
|
601
|
-
MultiOpndStmt(const MultiOpndStmt
|
|
602
|
-
void operator=(const MultiOpndStmt
|
|
603
|
-
SVFVar* getSrcNode();
|
|
604
|
-
SVFVar* getDstNode();
|
|
605
|
-
NodeID getSrcID();
|
|
627
|
+
MultiOpndStmt(const MultiOpndStmt&); ///< place holder
|
|
628
|
+
void operator=(const MultiOpndStmt&); ///< place holder
|
|
629
|
+
SVFVar* getSrcNode(); ///< not allowed, use getOpVar(idx) instead
|
|
630
|
+
SVFVar* getDstNode(); ///< not allowed, use getRes() instead
|
|
631
|
+
NodeID getSrcID(); ///< not allowed, use getOpVarID(idx) instead
|
|
606
632
|
NodeID getDstID(); ///< not allowed, use getResID() instead
|
|
607
633
|
|
|
608
634
|
protected:
|
|
609
635
|
OPVars opVars;
|
|
610
636
|
/// Constructor, only used by subclassess but not external users
|
|
611
637
|
MultiOpndStmt(SVFVar* r, const OPVars& opnds, GEdgeFlag k);
|
|
638
|
+
|
|
612
639
|
public:
|
|
613
640
|
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
614
641
|
//@{
|
|
615
|
-
static inline bool classof(const MultiOpndStmt
|
|
642
|
+
static inline bool classof(const MultiOpndStmt*)
|
|
616
643
|
{
|
|
617
644
|
return true;
|
|
618
645
|
}
|
|
619
|
-
static inline bool classof(const SVFStmt
|
|
646
|
+
static inline bool classof(const SVFStmt* node)
|
|
620
647
|
{
|
|
621
|
-
return node->getEdgeKind() == Phi ||
|
|
622
|
-
node->getEdgeKind() ==
|
|
623
|
-
node->getEdgeKind() == BinaryOp ||
|
|
624
|
-
node->getEdgeKind() == Cmp;
|
|
648
|
+
return node->getEdgeKind() == Phi || node->getEdgeKind() == Select ||
|
|
649
|
+
node->getEdgeKind() == BinaryOp || node->getEdgeKind() == Cmp;
|
|
625
650
|
}
|
|
626
|
-
static inline bool classof(const GenericPAGEdgeTy
|
|
651
|
+
static inline bool classof(const GenericPAGEdgeTy* node)
|
|
627
652
|
{
|
|
628
|
-
return node->getEdgeKind() == Phi ||
|
|
629
|
-
node->getEdgeKind() ==
|
|
630
|
-
node->getEdgeKind() == BinaryOp ||
|
|
631
|
-
node->getEdgeKind() == Cmp;
|
|
653
|
+
return node->getEdgeKind() == Phi || node->getEdgeKind() == Select ||
|
|
654
|
+
node->getEdgeKind() == BinaryOp || node->getEdgeKind() == Cmp;
|
|
632
655
|
}
|
|
633
656
|
//@}
|
|
634
|
-
/// Operands and result at a BinaryNode e.g., p = q + r, `p` is resVar and
|
|
657
|
+
/// Operands and result at a BinaryNode e.g., p = q + r, `p` is resVar and
|
|
658
|
+
/// `r` is OpVar
|
|
635
659
|
//@{
|
|
636
660
|
/// Operand SVFVars
|
|
637
661
|
inline const SVFVar* getOpVar(u32_t pos) const
|
|
@@ -672,46 +696,52 @@ public:
|
|
|
672
696
|
*/
|
|
673
697
|
class PhiStmt: public MultiOpndStmt
|
|
674
698
|
{
|
|
699
|
+
friend class SVFIRWriter;
|
|
700
|
+
|
|
675
701
|
public:
|
|
676
|
-
typedef std::vector<const ICFGNode
|
|
702
|
+
typedef std::vector<const ICFGNode*> OpICFGNodeVec;
|
|
677
703
|
|
|
678
704
|
private:
|
|
679
705
|
PhiStmt(); ///< place holder
|
|
680
|
-
PhiStmt(const PhiStmt
|
|
681
|
-
void operator=(const PhiStmt
|
|
706
|
+
PhiStmt(const PhiStmt&); ///< place holder
|
|
707
|
+
void operator=(const PhiStmt&); ///< place holder
|
|
682
708
|
|
|
683
709
|
OpICFGNodeVec opICFGNodes;
|
|
710
|
+
|
|
684
711
|
public:
|
|
685
712
|
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
686
713
|
//@{
|
|
687
|
-
static inline bool classof(const PhiStmt
|
|
714
|
+
static inline bool classof(const PhiStmt*)
|
|
688
715
|
{
|
|
689
716
|
return true;
|
|
690
717
|
}
|
|
691
|
-
static inline bool classof(const SVFStmt
|
|
718
|
+
static inline bool classof(const SVFStmt* edge)
|
|
692
719
|
{
|
|
693
720
|
return edge->getEdgeKind() == SVFStmt::Phi;
|
|
694
721
|
}
|
|
695
|
-
static inline bool classof(const MultiOpndStmt
|
|
722
|
+
static inline bool classof(const MultiOpndStmt* edge)
|
|
696
723
|
{
|
|
697
724
|
return edge->getEdgeKind() == SVFStmt::Phi;
|
|
698
725
|
}
|
|
699
|
-
static inline bool classof(const GenericPAGEdgeTy
|
|
726
|
+
static inline bool classof(const GenericPAGEdgeTy* edge)
|
|
700
727
|
{
|
|
701
728
|
return edge->getEdgeKind() == SVFStmt::Phi;
|
|
702
729
|
}
|
|
703
730
|
//@}
|
|
704
731
|
|
|
705
732
|
/// constructor
|
|
706
|
-
PhiStmt(SVFVar* s, const OPVars& opnds, const OpICFGNodeVec& icfgNodes)
|
|
733
|
+
PhiStmt(SVFVar* s, const OPVars& opnds, const OpICFGNodeVec& icfgNodes)
|
|
734
|
+
: MultiOpndStmt(s, opnds, SVFStmt::Phi), opICFGNodes(icfgNodes)
|
|
707
735
|
{
|
|
708
|
-
assert(opnds.size()==icfgNodes.size() &&
|
|
736
|
+
assert(opnds.size() == icfgNodes.size() &&
|
|
737
|
+
"Numbers of operands and their ICFGNodes are not consistent?");
|
|
709
738
|
}
|
|
710
739
|
void addOpVar(SVFVar* op, const ICFGNode* inode)
|
|
711
740
|
{
|
|
712
741
|
opVars.push_back(op);
|
|
713
742
|
opICFGNodes.push_back(inode);
|
|
714
|
-
assert(opVars.size()==opICFGNodes.size() &&
|
|
743
|
+
assert(opVars.size() == opICFGNodes.size() &&
|
|
744
|
+
"Numbers of operands and their ICFGNodes are not consistent?");
|
|
715
745
|
}
|
|
716
746
|
|
|
717
747
|
/// Return the corresponding ICFGNode of this operand
|
|
@@ -732,28 +762,31 @@ public:
|
|
|
732
762
|
*/
|
|
733
763
|
class SelectStmt: public MultiOpndStmt
|
|
734
764
|
{
|
|
765
|
+
friend class SVFIRWriter;
|
|
766
|
+
|
|
735
767
|
private:
|
|
736
768
|
SelectStmt(); ///< place holder
|
|
737
|
-
SelectStmt(const SelectStmt
|
|
738
|
-
void operator=(const SelectStmt
|
|
769
|
+
SelectStmt(const SelectStmt&); ///< place holder
|
|
770
|
+
void operator=(const SelectStmt&); ///< place holder
|
|
739
771
|
|
|
740
772
|
const SVFVar* condition;
|
|
773
|
+
|
|
741
774
|
public:
|
|
742
775
|
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
743
776
|
//@{
|
|
744
|
-
static inline bool classof(const SelectStmt
|
|
777
|
+
static inline bool classof(const SelectStmt*)
|
|
745
778
|
{
|
|
746
779
|
return true;
|
|
747
780
|
}
|
|
748
|
-
static inline bool classof(const SVFStmt
|
|
781
|
+
static inline bool classof(const SVFStmt* edge)
|
|
749
782
|
{
|
|
750
783
|
return edge->getEdgeKind() == SVFStmt::Select;
|
|
751
784
|
}
|
|
752
|
-
static inline bool classof(const MultiOpndStmt
|
|
785
|
+
static inline bool classof(const MultiOpndStmt* edge)
|
|
753
786
|
{
|
|
754
787
|
return edge->getEdgeKind() == SVFStmt::Select;
|
|
755
788
|
}
|
|
756
|
-
static inline bool classof(const GenericPAGEdgeTy
|
|
789
|
+
static inline bool classof(const GenericPAGEdgeTy* edge)
|
|
757
790
|
{
|
|
758
791
|
return edge->getEdgeKind() == SVFStmt::Select;
|
|
759
792
|
}
|
|
@@ -769,11 +802,11 @@ public:
|
|
|
769
802
|
}
|
|
770
803
|
inline const SVFVar* getTrueValue() const
|
|
771
804
|
{
|
|
772
|
-
return
|
|
805
|
+
return getOpVar(0);
|
|
773
806
|
}
|
|
774
807
|
inline const SVFVar* getFalseValue() const
|
|
775
808
|
{
|
|
776
|
-
return
|
|
809
|
+
return getOpVar(1);
|
|
777
810
|
}
|
|
778
811
|
};
|
|
779
812
|
|
|
@@ -782,14 +815,16 @@ public:
|
|
|
782
815
|
*/
|
|
783
816
|
class CmpStmt: public MultiOpndStmt
|
|
784
817
|
{
|
|
818
|
+
friend class SVFIRWriter;
|
|
819
|
+
|
|
785
820
|
private:
|
|
786
821
|
CmpStmt(); ///< place holder
|
|
787
|
-
CmpStmt(const CmpStmt
|
|
788
|
-
void operator=(const CmpStmt
|
|
822
|
+
CmpStmt(const CmpStmt&); ///< place holder
|
|
823
|
+
void operator=(const CmpStmt&); ///< place holder
|
|
789
824
|
|
|
790
825
|
u32_t predicate;
|
|
791
|
-
public:
|
|
792
826
|
|
|
827
|
+
public:
|
|
793
828
|
/// OpCode for CmpStmt, enum value is same to llvm CmpInst
|
|
794
829
|
enum Predicate : unsigned
|
|
795
830
|
{
|
|
@@ -830,19 +865,19 @@ public:
|
|
|
830
865
|
|
|
831
866
|
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
832
867
|
//@{
|
|
833
|
-
static inline bool classof(const CmpStmt
|
|
868
|
+
static inline bool classof(const CmpStmt*)
|
|
834
869
|
{
|
|
835
870
|
return true;
|
|
836
871
|
}
|
|
837
|
-
static inline bool classof(const SVFStmt
|
|
872
|
+
static inline bool classof(const SVFStmt* edge)
|
|
838
873
|
{
|
|
839
874
|
return edge->getEdgeKind() == SVFStmt::Cmp;
|
|
840
875
|
}
|
|
841
|
-
static inline bool classof(const MultiOpndStmt
|
|
876
|
+
static inline bool classof(const MultiOpndStmt* edge)
|
|
842
877
|
{
|
|
843
878
|
return edge->getEdgeKind() == SVFStmt::Cmp;
|
|
844
879
|
}
|
|
845
|
-
static inline bool classof(const GenericPAGEdgeTy
|
|
880
|
+
static inline bool classof(const GenericPAGEdgeTy* edge)
|
|
846
881
|
{
|
|
847
882
|
return edge->getEdgeKind() == SVFStmt::Cmp;
|
|
848
883
|
}
|
|
@@ -859,41 +894,58 @@ public:
|
|
|
859
894
|
virtual const std::string toString() const override;
|
|
860
895
|
};
|
|
861
896
|
|
|
862
|
-
|
|
863
897
|
/*!
|
|
864
898
|
* Binary statement
|
|
865
899
|
*/
|
|
866
900
|
class BinaryOPStmt: public MultiOpndStmt
|
|
867
901
|
{
|
|
902
|
+
friend class SVFIRWriter;
|
|
903
|
+
|
|
868
904
|
private:
|
|
869
905
|
BinaryOPStmt(); ///< place holder
|
|
870
|
-
BinaryOPStmt(const BinaryOPStmt
|
|
871
|
-
void operator=(const BinaryOPStmt
|
|
906
|
+
BinaryOPStmt(const BinaryOPStmt&); ///< place holder
|
|
907
|
+
void operator=(const BinaryOPStmt&); ///< place holder
|
|
872
908
|
u32_t opcode;
|
|
873
909
|
|
|
874
910
|
public:
|
|
875
911
|
/// OpCode for BinaryOPStmt, enum value is same to llvm BinaryOperator
|
|
876
|
-
enum OpCode: unsigned
|
|
912
|
+
enum OpCode : unsigned
|
|
877
913
|
{
|
|
878
|
-
Add = 13,
|
|
879
|
-
|
|
914
|
+
Add = 13,
|
|
915
|
+
FAdd = 14,
|
|
916
|
+
Sub = 15,
|
|
917
|
+
FSub = 16,
|
|
918
|
+
Mul = 17,
|
|
919
|
+
FMul = 18,
|
|
920
|
+
UDiv = 19,
|
|
921
|
+
SDiv = 20,
|
|
922
|
+
FDiv = 21,
|
|
923
|
+
URem = 22,
|
|
924
|
+
SRem = 23,
|
|
925
|
+
FRem = 24,
|
|
926
|
+
Shl = 25,
|
|
927
|
+
LShr = 26,
|
|
928
|
+
AShr = 27,
|
|
929
|
+
And = 28,
|
|
930
|
+
Or = 29,
|
|
931
|
+
Xor = 30
|
|
880
932
|
};
|
|
881
933
|
|
|
882
934
|
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
883
935
|
//@{
|
|
884
|
-
static inline bool classof(const BinaryOPStmt
|
|
936
|
+
static inline bool classof(const BinaryOPStmt*)
|
|
885
937
|
{
|
|
886
938
|
return true;
|
|
887
939
|
}
|
|
888
|
-
static inline bool classof(const SVFStmt
|
|
940
|
+
static inline bool classof(const SVFStmt* edge)
|
|
889
941
|
{
|
|
890
942
|
return edge->getEdgeKind() == SVFStmt::BinaryOp;
|
|
891
943
|
}
|
|
892
|
-
static inline bool classof(const MultiOpndStmt
|
|
944
|
+
static inline bool classof(const MultiOpndStmt* edge)
|
|
893
945
|
{
|
|
894
946
|
return edge->getEdgeKind() == SVFStmt::BinaryOp;
|
|
895
947
|
}
|
|
896
|
-
static inline bool classof(const GenericPAGEdgeTy
|
|
948
|
+
static inline bool classof(const GenericPAGEdgeTy* edge)
|
|
897
949
|
{
|
|
898
950
|
return edge->getEdgeKind() == SVFStmt::BinaryOp;
|
|
899
951
|
}
|
|
@@ -915,16 +967,19 @@ public:
|
|
|
915
967
|
*/
|
|
916
968
|
class UnaryOPStmt: public SVFStmt
|
|
917
969
|
{
|
|
970
|
+
friend class SVFIRWriter;
|
|
971
|
+
|
|
918
972
|
private:
|
|
919
973
|
UnaryOPStmt(); ///< place holder
|
|
920
|
-
UnaryOPStmt(const UnaryOPStmt
|
|
921
|
-
void operator=(const UnaryOPStmt
|
|
922
|
-
SVFVar* getSrcNode();
|
|
923
|
-
SVFVar* getDstNode();
|
|
924
|
-
NodeID getSrcID();
|
|
974
|
+
UnaryOPStmt(const UnaryOPStmt&); ///< place holder
|
|
975
|
+
void operator=(const UnaryOPStmt&); ///< place holder
|
|
976
|
+
SVFVar* getSrcNode(); ///< place holder, use getOpVar() instead
|
|
977
|
+
SVFVar* getDstNode(); ///< place holder, use getRes() instead
|
|
978
|
+
NodeID getSrcID(); ///< place holder, use getOpVarID(pos) instead
|
|
925
979
|
NodeID getDstID(); ///< place holder, use getResID() instead
|
|
926
980
|
|
|
927
981
|
u32_t opcode;
|
|
982
|
+
|
|
928
983
|
public:
|
|
929
984
|
/// OpCode for UnaryOPStmt, enum value is same to llvm::UnaryOperator
|
|
930
985
|
enum OpCode : unsigned
|
|
@@ -934,22 +989,23 @@ public:
|
|
|
934
989
|
|
|
935
990
|
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
936
991
|
//@{
|
|
937
|
-
static inline bool classof(const UnaryOPStmt
|
|
992
|
+
static inline bool classof(const UnaryOPStmt*)
|
|
938
993
|
{
|
|
939
994
|
return true;
|
|
940
995
|
}
|
|
941
|
-
static inline bool classof(const SVFStmt
|
|
996
|
+
static inline bool classof(const SVFStmt* edge)
|
|
942
997
|
{
|
|
943
998
|
return edge->getEdgeKind() == SVFStmt::UnaryOp;
|
|
944
999
|
}
|
|
945
|
-
static inline bool classof(const GenericPAGEdgeTy
|
|
1000
|
+
static inline bool classof(const GenericPAGEdgeTy* edge)
|
|
946
1001
|
{
|
|
947
1002
|
return edge->getEdgeKind() == SVFStmt::UnaryOp;
|
|
948
1003
|
}
|
|
949
1004
|
//@}
|
|
950
1005
|
|
|
951
1006
|
/// constructor
|
|
952
|
-
UnaryOPStmt(SVFVar* s, SVFVar* d, u32_t oc)
|
|
1007
|
+
UnaryOPStmt(SVFVar* s, SVFVar* d, u32_t oc)
|
|
1008
|
+
: SVFStmt(s, d, SVFStmt::UnaryOp), opcode(oc)
|
|
953
1009
|
{
|
|
954
1010
|
}
|
|
955
1011
|
|
|
@@ -971,22 +1027,24 @@ public:
|
|
|
971
1027
|
virtual const std::string toString() const override;
|
|
972
1028
|
};
|
|
973
1029
|
|
|
974
|
-
|
|
975
1030
|
/*!
|
|
976
1031
|
* Branch statements including if/else and switch
|
|
977
1032
|
*/
|
|
978
1033
|
class BranchStmt: public SVFStmt
|
|
979
1034
|
{
|
|
1035
|
+
friend class SVFIRWriter;
|
|
1036
|
+
|
|
980
1037
|
public:
|
|
981
|
-
typedef std::vector<std::pair<const ICFGNode*, s32_t
|
|
1038
|
+
typedef std::vector<std::pair<const ICFGNode*, s32_t>> SuccAndCondPairVec;
|
|
1039
|
+
|
|
982
1040
|
private:
|
|
983
1041
|
BranchStmt(); ///< place holder
|
|
984
|
-
BranchStmt(const BranchStmt
|
|
985
|
-
void operator=(const BranchStmt
|
|
986
|
-
SVFVar* getSrcNode();
|
|
987
|
-
SVFVar* getDstNode();
|
|
988
|
-
NodeID getSrcID();
|
|
989
|
-
NodeID getDstID();
|
|
1042
|
+
BranchStmt(const BranchStmt&); ///< place holder
|
|
1043
|
+
void operator=(const BranchStmt&); ///< place holder
|
|
1044
|
+
SVFVar* getSrcNode(); ///< place holder, not allowed
|
|
1045
|
+
SVFVar* getDstNode(); ///< place holder, not allowed
|
|
1046
|
+
NodeID getSrcID(); ///< place holder, use getOpVarID(pos) instead
|
|
1047
|
+
NodeID getDstID(); ///< place holder, use getResID() instead
|
|
990
1048
|
|
|
991
1049
|
SuccAndCondPairVec successors;
|
|
992
1050
|
const SVFVar* cond;
|
|
@@ -995,22 +1053,24 @@ private:
|
|
|
995
1053
|
public:
|
|
996
1054
|
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
997
1055
|
//@{
|
|
998
|
-
static inline bool classof(const BranchStmt
|
|
1056
|
+
static inline bool classof(const BranchStmt*)
|
|
999
1057
|
{
|
|
1000
1058
|
return true;
|
|
1001
1059
|
}
|
|
1002
|
-
static inline bool classof(const SVFStmt
|
|
1060
|
+
static inline bool classof(const SVFStmt* edge)
|
|
1003
1061
|
{
|
|
1004
1062
|
return edge->getEdgeKind() == SVFStmt::Branch;
|
|
1005
1063
|
}
|
|
1006
|
-
static inline bool classof(const GenericPAGEdgeTy
|
|
1064
|
+
static inline bool classof(const GenericPAGEdgeTy* edge)
|
|
1007
1065
|
{
|
|
1008
1066
|
return edge->getEdgeKind() == SVFStmt::Branch;
|
|
1009
1067
|
}
|
|
1010
1068
|
//@}
|
|
1011
1069
|
|
|
1012
1070
|
/// constructor
|
|
1013
|
-
BranchStmt(SVFVar* inst, SVFVar* c, const SuccAndCondPairVec& succs)
|
|
1071
|
+
BranchStmt(SVFVar* inst, SVFVar* c, const SuccAndCondPairVec& succs)
|
|
1072
|
+
: SVFStmt(c, inst, SVFStmt::Branch), successors(succs), cond(c),
|
|
1073
|
+
brInst(inst)
|
|
1014
1074
|
{
|
|
1015
1075
|
}
|
|
1016
1076
|
|
|
@@ -1029,9 +1089,8 @@ public:
|
|
|
1029
1089
|
/// successor(0): stmt1, 1
|
|
1030
1090
|
/// successor(1): stmt2, 0
|
|
1031
1091
|
|
|
1032
|
-
/// For example switch(c) case 0: {stmt1; break;} case 1: {stmt2; break;}
|
|
1033
|
-
/// successor(0): stmt1, 0
|
|
1034
|
-
/// successor(1): stmt2, 1
|
|
1092
|
+
/// For example switch(c) case 0: {stmt1; break;} case 1: {stmt2; break;}
|
|
1093
|
+
/// default {stmt3: break} successor(0): stmt1, 0 successor(1): stmt2, 1
|
|
1035
1094
|
/// successor(3): stmt3, -1
|
|
1036
1095
|
|
|
1037
1096
|
/// Successors of this branch statement
|
|
@@ -1044,11 +1103,11 @@ public:
|
|
|
1044
1103
|
{
|
|
1045
1104
|
return successors;
|
|
1046
1105
|
}
|
|
1047
|
-
const ICFGNode* getSuccessor
|
|
1106
|
+
const ICFGNode* getSuccessor(u32_t i) const
|
|
1048
1107
|
{
|
|
1049
1108
|
return successors.at(i).first;
|
|
1050
1109
|
}
|
|
1051
|
-
s64_t getSuccessorCondValue
|
|
1110
|
+
s64_t getSuccessorCondValue(u32_t i) const
|
|
1052
1111
|
{
|
|
1053
1112
|
return successors.at(i).second;
|
|
1054
1113
|
}
|
|
@@ -1056,75 +1115,78 @@ public:
|
|
|
1056
1115
|
virtual const std::string toString() const override;
|
|
1057
1116
|
};
|
|
1058
1117
|
|
|
1059
|
-
|
|
1060
1118
|
/*!
|
|
1061
1119
|
* Thread Fork
|
|
1062
1120
|
*/
|
|
1063
1121
|
class TDForkPE: public CallPE
|
|
1064
1122
|
{
|
|
1123
|
+
friend class SVFIRWriter;
|
|
1124
|
+
|
|
1065
1125
|
private:
|
|
1066
1126
|
TDForkPE(); ///< place holder
|
|
1067
|
-
TDForkPE(const TDForkPE
|
|
1068
|
-
void operator=(const TDForkPE
|
|
1127
|
+
TDForkPE(const TDForkPE&); ///< place holder
|
|
1128
|
+
void operator=(const TDForkPE&); ///< place holder
|
|
1069
1129
|
|
|
1070
1130
|
public:
|
|
1071
1131
|
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
1072
1132
|
//@{
|
|
1073
|
-
static inline bool classof(const TDForkPE
|
|
1133
|
+
static inline bool classof(const TDForkPE*)
|
|
1074
1134
|
{
|
|
1075
1135
|
return true;
|
|
1076
1136
|
}
|
|
1077
|
-
static inline bool classof(const SVFStmt
|
|
1137
|
+
static inline bool classof(const SVFStmt* edge)
|
|
1078
1138
|
{
|
|
1079
1139
|
return edge->getEdgeKind() == SVFStmt::ThreadFork;
|
|
1080
1140
|
}
|
|
1081
|
-
static inline bool classof(const GenericPAGEdgeTy
|
|
1141
|
+
static inline bool classof(const GenericPAGEdgeTy* edge)
|
|
1082
1142
|
{
|
|
1083
1143
|
return edge->getEdgeKind() == SVFStmt::ThreadFork;
|
|
1084
1144
|
}
|
|
1085
1145
|
//@}
|
|
1086
1146
|
|
|
1087
1147
|
/// constructor
|
|
1088
|
-
TDForkPE(SVFVar* s, SVFVar* d, const CallICFGNode* i,
|
|
1089
|
-
|
|
1148
|
+
TDForkPE(SVFVar* s, SVFVar* d, const CallICFGNode* i,
|
|
1149
|
+
const FunEntryICFGNode* entry)
|
|
1150
|
+
: CallPE(s, d, i, entry, SVFStmt::ThreadFork)
|
|
1090
1151
|
{
|
|
1091
1152
|
}
|
|
1092
1153
|
|
|
1093
1154
|
virtual const std::string toString() const;
|
|
1094
1155
|
};
|
|
1095
1156
|
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
1157
|
/*!
|
|
1099
1158
|
* Thread Join
|
|
1100
1159
|
*/
|
|
1101
1160
|
class TDJoinPE: public RetPE
|
|
1102
1161
|
{
|
|
1162
|
+
friend class SVFIRWriter;
|
|
1163
|
+
|
|
1103
1164
|
private:
|
|
1104
1165
|
TDJoinPE(); ///< place holder
|
|
1105
|
-
TDJoinPE(const TDJoinPE
|
|
1106
|
-
void operator=(const TDJoinPE
|
|
1166
|
+
TDJoinPE(const TDJoinPE&); ///< place holder
|
|
1167
|
+
void operator=(const TDJoinPE&); ///< place holder
|
|
1107
1168
|
|
|
1108
1169
|
public:
|
|
1109
1170
|
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
1110
1171
|
//@{
|
|
1111
|
-
static inline bool classof(const TDJoinPE
|
|
1172
|
+
static inline bool classof(const TDJoinPE*)
|
|
1112
1173
|
{
|
|
1113
1174
|
return true;
|
|
1114
1175
|
}
|
|
1115
|
-
static inline bool classof(const SVFStmt
|
|
1176
|
+
static inline bool classof(const SVFStmt* edge)
|
|
1116
1177
|
{
|
|
1117
1178
|
return edge->getEdgeKind() == SVFStmt::ThreadJoin;
|
|
1118
1179
|
}
|
|
1119
|
-
static inline bool classof(const GenericPAGEdgeTy
|
|
1180
|
+
static inline bool classof(const GenericPAGEdgeTy* edge)
|
|
1120
1181
|
{
|
|
1121
1182
|
return edge->getEdgeKind() == SVFStmt::ThreadJoin;
|
|
1122
1183
|
}
|
|
1123
1184
|
//@}
|
|
1124
1185
|
|
|
1125
1186
|
/// Constructor
|
|
1126
|
-
TDJoinPE(SVFVar* s, SVFVar* d, const CallICFGNode* i,
|
|
1127
|
-
|
|
1187
|
+
TDJoinPE(SVFVar* s, SVFVar* d, const CallICFGNode* i,
|
|
1188
|
+
const FunExitICFGNode* e)
|
|
1189
|
+
: RetPE(s, d, i, e, SVFStmt::ThreadJoin)
|
|
1128
1190
|
{
|
|
1129
1191
|
}
|
|
1130
1192
|
|