svf-lib 1.0.730 → 1.0.734

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.
Files changed (98) hide show
  1. package/SVF-linux/Release-build/lib/libSvf.a +0 -0
  2. package/SVF-linux/include/DDA/ContextDDA.h +1 -1
  3. package/SVF-linux/include/DDA/DDAClient.h +8 -8
  4. package/SVF-linux/include/DDA/DDAVFSolver.h +6 -6
  5. package/SVF-linux/include/DDA/FlowDDA.h +1 -1
  6. package/SVF-linux/include/Graphs/ConsG.h +6 -6
  7. package/SVF-linux/include/Graphs/ConsGEdge.h +2 -2
  8. package/SVF-linux/include/Graphs/ConsGNode.h +1 -1
  9. package/SVF-linux/include/Graphs/ExternalPAG.h +14 -14
  10. package/SVF-linux/include/Graphs/ICFGNode.h +14 -14
  11. package/SVF-linux/include/Graphs/IRGraph.h +245 -0
  12. package/SVF-linux/include/Graphs/OfflineConsG.h +1 -1
  13. package/SVF-linux/include/Graphs/PAG.h +4 -4
  14. package/SVF-linux/include/Graphs/PAGNode.h +3 -3
  15. package/SVF-linux/include/Graphs/SVFG.h +1 -1
  16. package/SVF-linux/include/Graphs/SVFGOPT.h +3 -3
  17. package/SVF-linux/include/Graphs/VFG.h +19 -19
  18. package/SVF-linux/include/Graphs/VFGNode.h +2 -3
  19. package/SVF-linux/include/MSSA/MemRegion.h +11 -11
  20. package/SVF-linux/include/MSSA/MemSSA.h +4 -4
  21. package/SVF-linux/include/MTA/FSMPTA.h +1 -1
  22. package/SVF-linux/include/MemoryModel/PAGBuilderFromFile.h +8 -8
  23. package/SVF-linux/include/MemoryModel/PTAStat.h +31 -31
  24. package/SVF-linux/include/MemoryModel/PointerAnalysis.h +9 -9
  25. package/SVF-linux/include/MemoryModel/PointerAnalysisImpl.h +3 -3
  26. package/SVF-linux/include/MemoryModel/SVFIR.h +591 -233
  27. package/SVF-linux/include/MemoryModel/SVFStatements.h +738 -0
  28. package/SVF-linux/include/MemoryModel/SVFSymbols.h +648 -0
  29. package/SVF-linux/include/MemoryModel/SVFVariables.h +842 -0
  30. package/SVF-linux/include/MemoryModel/SymbolTableInfo.h +343 -40
  31. package/SVF-linux/include/SABER/SaberSVFGBuilder.h +0 -2
  32. package/SVF-linux/include/SABER/SrcSnkDDA.h +3 -3
  33. package/SVF-linux/include/SVF-FE/Graph2Json.h +1 -3
  34. package/SVF-linux/include/SVF-FE/SVFIRBuilder.h +392 -0
  35. package/SVF-linux/include/SVF-FE/SymbolTableBuilder.h +0 -1
  36. package/SVF-linux/include/Util/CFLSolver.h +1 -1
  37. package/SVF-linux/include/Util/ExtAPI.h +1 -1
  38. package/SVF-linux/include/Util/IRAnnotator.h +6 -6
  39. package/SVF-linux/include/Util/Options.h +1 -1
  40. package/SVF-linux/include/Util/TypeBasedHeapCloning.h +11 -11
  41. package/SVF-linux/include/WPA/Andersen.h +11 -11
  42. package/SVF-linux/include/WPA/AndersenSFR.h +4 -4
  43. package/SVF-linux/include/WPA/FlowSensitive.h +2 -2
  44. package/SVF-linux/include/WPA/FlowSensitiveTBHC.h +1 -1
  45. package/SVF-linux/include/WPA/Steensgaard.h +2 -2
  46. package/SVF-linux/include/WPA/TypeAnalysis.h +1 -1
  47. package/SVF-linux/include/WPA/VersionedFlowSensitive.h +2 -2
  48. package/SVF-linux/include/WPA/WPAStat.h +1 -2
  49. package/SVF-osx/Release-build/lib/CUDD/libCudd.a +0 -0
  50. package/SVF-osx/Release-build/lib/libSvf.a +0 -0
  51. package/SVF-osx/include/DDA/ContextDDA.h +1 -1
  52. package/SVF-osx/include/DDA/DDAClient.h +8 -8
  53. package/SVF-osx/include/DDA/DDAVFSolver.h +6 -6
  54. package/SVF-osx/include/DDA/FlowDDA.h +1 -1
  55. package/SVF-osx/include/Graphs/ConsG.h +6 -6
  56. package/SVF-osx/include/Graphs/ConsGEdge.h +2 -2
  57. package/SVF-osx/include/Graphs/ConsGNode.h +1 -1
  58. package/SVF-osx/include/Graphs/ExternalPAG.h +14 -14
  59. package/SVF-osx/include/Graphs/ICFGNode.h +14 -14
  60. package/SVF-osx/include/Graphs/IRGraph.h +245 -0
  61. package/SVF-osx/include/Graphs/OfflineConsG.h +1 -1
  62. package/SVF-osx/include/Graphs/PAG.h +4 -4
  63. package/SVF-osx/include/Graphs/PAGNode.h +3 -3
  64. package/SVF-osx/include/Graphs/SVFG.h +1 -1
  65. package/SVF-osx/include/Graphs/SVFGOPT.h +3 -3
  66. package/SVF-osx/include/Graphs/VFG.h +19 -19
  67. package/SVF-osx/include/Graphs/VFGNode.h +2 -3
  68. package/SVF-osx/include/MSSA/MemRegion.h +11 -11
  69. package/SVF-osx/include/MSSA/MemSSA.h +4 -4
  70. package/SVF-osx/include/MTA/FSMPTA.h +1 -1
  71. package/SVF-osx/include/MemoryModel/PAGBuilderFromFile.h +8 -8
  72. package/SVF-osx/include/MemoryModel/PTAStat.h +31 -31
  73. package/SVF-osx/include/MemoryModel/PointerAnalysis.h +9 -9
  74. package/SVF-osx/include/MemoryModel/PointerAnalysisImpl.h +3 -3
  75. package/SVF-osx/include/MemoryModel/SVFIR.h +591 -233
  76. package/SVF-osx/include/MemoryModel/SVFStatements.h +738 -0
  77. package/SVF-osx/include/MemoryModel/SVFSymbols.h +648 -0
  78. package/SVF-osx/include/MemoryModel/SVFVariables.h +842 -0
  79. package/SVF-osx/include/MemoryModel/SymbolTableInfo.h +343 -40
  80. package/SVF-osx/include/SABER/SaberSVFGBuilder.h +0 -2
  81. package/SVF-osx/include/SABER/SrcSnkDDA.h +3 -3
  82. package/SVF-osx/include/SVF-FE/Graph2Json.h +1 -3
  83. package/SVF-osx/include/SVF-FE/SVFIRBuilder.h +392 -0
  84. package/SVF-osx/include/SVF-FE/SymbolTableBuilder.h +0 -1
  85. package/SVF-osx/include/Util/CFLSolver.h +1 -1
  86. package/SVF-osx/include/Util/ExtAPI.h +1 -1
  87. package/SVF-osx/include/Util/IRAnnotator.h +6 -6
  88. package/SVF-osx/include/Util/Options.h +1 -1
  89. package/SVF-osx/include/Util/TypeBasedHeapCloning.h +11 -11
  90. package/SVF-osx/include/WPA/Andersen.h +11 -11
  91. package/SVF-osx/include/WPA/AndersenSFR.h +4 -4
  92. package/SVF-osx/include/WPA/FlowSensitive.h +2 -2
  93. package/SVF-osx/include/WPA/FlowSensitiveTBHC.h +1 -1
  94. package/SVF-osx/include/WPA/Steensgaard.h +2 -2
  95. package/SVF-osx/include/WPA/TypeAnalysis.h +1 -1
  96. package/SVF-osx/include/WPA/VersionedFlowSensitive.h +2 -2
  97. package/SVF-osx/include/WPA/WPAStat.h +1 -2
  98. package/package.json +1 -1
@@ -0,0 +1,738 @@
1
+ //===- SVFStatements.h -- SVF statements-------------------------------------------//
2
+ //
3
+ // SVF: Static Value-Flow Analysis
4
+ //
5
+ // Copyright (C) <2013-2017> <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 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 General Public License for more details.
17
+
18
+ // You should have received a copy of the GNU General Public License
19
+ // along with this program. If not, see <http://www.gnu.org/licenses/>.
20
+ //
21
+ //===----------------------------------------------------------------------===//
22
+
23
+
24
+ /*
25
+ * SVFStatements.h
26
+ *
27
+ * Created on: Nov 10, 2013
28
+ * Author: Yulei Sui
29
+ */
30
+
31
+ #ifndef PAGEDGE_H_
32
+ #define PAGEDGE_H_
33
+
34
+ #include "Graphs/GenericGraph.h"
35
+ #include "MemoryModel/LocationSet.h"
36
+ #include "Graphs/ICFGNode.h"
37
+
38
+ namespace SVF
39
+ {
40
+
41
+ class SVFVar;
42
+
43
+ /*
44
+ * SVFIR edge between nodes
45
+ */
46
+ typedef GenericEdge<SVFVar> GenericPAGEdgeTy;
47
+ class SVFStmt : public GenericPAGEdgeTy
48
+ {
49
+
50
+ public:
51
+ /// Thirteen kinds of SVFIR edges
52
+ /// Gep represents offset edge for field sensitivity
53
+ /// ThreadFork/ThreadJoin is to model parameter passings between thread spawners and spawnees.
54
+ enum PEDGEK
55
+ {
56
+ Addr, Copy, Store, Load, Call, Ret, NormalGep, VariantGep, ThreadFork, ThreadJoin, Cmp, BinaryOp, UnaryOp
57
+ };
58
+
59
+ private:
60
+ const Value* value; ///< LLVM value
61
+ const BasicBlock *basicBlock; ///< LLVM BasicBlock
62
+ ICFGNode *icfgNode; ///< ICFGNode
63
+ EdgeID edgeId; ///< Edge ID
64
+ public:
65
+ static Size_t totalEdgeNum; ///< Total edge number
66
+
67
+ /// Constructor
68
+ SVFStmt(SVFVar* s, SVFVar* d, GEdgeFlag k);
69
+ /// Destructor
70
+ ~SVFStmt()
71
+ {
72
+ }
73
+
74
+ /// ClassOf
75
+ //@{
76
+ static inline bool classof(const SVFStmt*)
77
+ {
78
+ return true;
79
+ }
80
+ static inline bool classof(const GenericPAGEdgeTy *edge)
81
+ {
82
+ return edge->getEdgeKind() == SVFStmt::Addr ||
83
+ edge->getEdgeKind() == SVFStmt::Copy ||
84
+ edge->getEdgeKind() == SVFStmt::Store ||
85
+ edge->getEdgeKind() == SVFStmt::Load ||
86
+ edge->getEdgeKind() == SVFStmt::Call ||
87
+ edge->getEdgeKind() == SVFStmt::Ret ||
88
+ edge->getEdgeKind() == SVFStmt::NormalGep ||
89
+ edge->getEdgeKind() == SVFStmt::VariantGep ||
90
+ edge->getEdgeKind() == SVFStmt::ThreadFork ||
91
+ edge->getEdgeKind() == SVFStmt::ThreadJoin ||
92
+ edge->getEdgeKind() == SVFStmt::Cmp ||
93
+ edge->getEdgeKind() == SVFStmt::BinaryOp ||
94
+ edge->getEdgeKind() == SVFStmt::UnaryOp;
95
+ }
96
+ ///@}
97
+
98
+ /// Return Edge ID
99
+ inline EdgeID getEdgeID() const
100
+ {
101
+ return edgeId;
102
+ }
103
+ /// Whether src and dst nodes are both of pointer type
104
+ bool isPTAEdge() const;
105
+
106
+ /// Get/set methods for llvm instruction
107
+ //@{
108
+ inline const Instruction* getInst() const
109
+ {
110
+ return SVFUtil::dyn_cast<Instruction>(value);
111
+ }
112
+ inline void setValue(const Value *val)
113
+ {
114
+ value = val;
115
+ }
116
+ inline const Value* getValue() const
117
+ {
118
+ return value;
119
+ }
120
+ inline void setBB(const BasicBlock *bb)
121
+ {
122
+ basicBlock = bb;
123
+ }
124
+ inline const BasicBlock* getBB() const
125
+ {
126
+ return basicBlock;
127
+ }
128
+ inline void setICFGNode(ICFGNode *node)
129
+ {
130
+ icfgNode = node;
131
+ }
132
+ inline ICFGNode* getICFGNode() const
133
+ {
134
+ return icfgNode;
135
+ }
136
+ //@}
137
+
138
+ /// Compute the unique edgeFlag value from edge kind and call site Instruction.
139
+ static inline GEdgeFlag makeEdgeFlagWithCallInst(GEdgeKind k, const ICFGNode* cs)
140
+ {
141
+ Inst2LabelMap::const_iterator iter = inst2LabelMap.find(cs);
142
+ u64_t label = (iter != inst2LabelMap.end()) ?
143
+ iter->second : callEdgeLabelCounter++;
144
+ return (label << EdgeKindMaskBits) | k;
145
+ }
146
+
147
+ /// Compute the unique edgeFlag value from edge kind and store Instruction.
148
+ /// Two store instructions may share the same StorePAGEdge
149
+ static inline GEdgeFlag makeEdgeFlagWithStoreInst(GEdgeKind k, const ICFGNode* store)
150
+ {
151
+ Inst2LabelMap::const_iterator iter = inst2LabelMap.find(store);
152
+ u64_t label = (iter != inst2LabelMap.end()) ?
153
+ iter->second : storeEdgeLabelCounter++;
154
+ return (label << EdgeKindMaskBits) | k;
155
+ }
156
+
157
+ virtual const std::string toString() const;
158
+
159
+ //@}
160
+ /// Overloading operator << for dumping SVFVar value
161
+ //@{
162
+ friend raw_ostream& operator<< (raw_ostream &o, const SVFStmt &edge)
163
+ {
164
+ o << edge.toString();
165
+ return o;
166
+ }
167
+ //@}
168
+
169
+ typedef GenericNode<SVFVar,SVFStmt>::GEdgeSetTy PAGEdgeSetTy;
170
+ typedef Map<EdgeID, PAGEdgeSetTy> PAGEdgeToSetMapTy;
171
+ typedef PAGEdgeToSetMapTy PAGKindToEdgeSetMapTy;
172
+
173
+ private:
174
+ typedef Map<const ICFGNode*, u32_t> Inst2LabelMap;
175
+ static Inst2LabelMap inst2LabelMap; ///< Call site Instruction to label map
176
+ static u64_t callEdgeLabelCounter; ///< Call site Instruction counter
177
+ static u64_t storeEdgeLabelCounter; ///< Store Instruction counter
178
+ };
179
+
180
+
181
+
182
+ /*!
183
+ * Copy edge
184
+ */
185
+ class AddrPE: public SVFStmt
186
+ {
187
+ private:
188
+ AddrPE(); ///< place holder
189
+ AddrPE(const AddrPE &); ///< place holder
190
+ void operator=(const AddrPE &); ///< place holder
191
+ public:
192
+ /// Methods for support type inquiry through isa, cast, and dyn_cast:
193
+ //@{
194
+ static inline bool classof(const AddrPE *)
195
+ {
196
+ return true;
197
+ }
198
+ static inline bool classof(const SVFStmt *edge)
199
+ {
200
+ return edge->getEdgeKind() == SVFStmt::Addr;
201
+ }
202
+ static inline bool classof(const GenericPAGEdgeTy *edge)
203
+ {
204
+ return edge->getEdgeKind() == SVFStmt::Addr;
205
+ }
206
+ //@}
207
+
208
+ /// constructor
209
+ AddrPE(SVFVar* s, SVFVar* d) : SVFStmt(s,d,SVFStmt::Addr)
210
+ {
211
+ }
212
+
213
+ virtual const std::string toString() const;
214
+ };
215
+
216
+
217
+ /*!
218
+ * Copy edge
219
+ */
220
+ class CopyPE: public SVFStmt
221
+ {
222
+ private:
223
+ CopyPE(); ///< place holder
224
+ CopyPE(const CopyPE &); ///< place holder
225
+ void operator=(const CopyPE &); ///< place holder
226
+ public:
227
+ /// Methods for support type inquiry through isa, cast, and dyn_cast:
228
+ //@{
229
+ static inline bool classof(const CopyPE *)
230
+ {
231
+ return true;
232
+ }
233
+ static inline bool classof(const SVFStmt *edge)
234
+ {
235
+ return edge->getEdgeKind() == SVFStmt::Copy;
236
+ }
237
+ static inline bool classof(const GenericPAGEdgeTy *edge)
238
+ {
239
+ return edge->getEdgeKind() == SVFStmt::Copy;
240
+ }
241
+ //@}
242
+
243
+ /// constructor
244
+ CopyPE(SVFVar* s, SVFVar* d) : SVFStmt(s,d,SVFStmt::Copy)
245
+ {
246
+ }
247
+
248
+ virtual const std::string toString() const;
249
+ };
250
+
251
+
252
+ /*!
253
+ * Compare instruction edge
254
+ */
255
+ class CmpPE: public SVFStmt
256
+ {
257
+ private:
258
+ CmpPE(); ///< place holder
259
+ CmpPE(const CmpPE &); ///< place holder
260
+ void operator=(const CmpPE &); ///< place holder
261
+ public:
262
+ /// Methods for support type inquiry through isa, cast, and dyn_cast:
263
+ //@{
264
+ static inline bool classof(const CmpPE *)
265
+ {
266
+ return true;
267
+ }
268
+ static inline bool classof(const SVFStmt *edge)
269
+ {
270
+ return edge->getEdgeKind() == SVFStmt::Cmp;
271
+ }
272
+ static inline bool classof(const GenericPAGEdgeTy *edge)
273
+ {
274
+ return edge->getEdgeKind() == SVFStmt::Cmp;
275
+ }
276
+ //@}
277
+
278
+ /// constructor
279
+ CmpPE(SVFVar* s, SVFVar* d) : SVFStmt(s,d,SVFStmt::Cmp)
280
+ {
281
+ }
282
+
283
+ virtual const std::string toString() const;
284
+ };
285
+
286
+
287
+ /*!
288
+ * Binary instruction edge
289
+ */
290
+ class BinaryOPPE: public SVFStmt
291
+ {
292
+ private:
293
+ BinaryOPPE(); ///< place holder
294
+ BinaryOPPE(const BinaryOPPE &); ///< place holder
295
+ void operator=(const BinaryOPPE &); ///< place holder
296
+ public:
297
+ /// Methods for support type inquiry through isa, cast, and dyn_cast:
298
+ //@{
299
+ static inline bool classof(const BinaryOPPE *)
300
+ {
301
+ return true;
302
+ }
303
+ static inline bool classof(const SVFStmt *edge)
304
+ {
305
+ return edge->getEdgeKind() == SVFStmt::BinaryOp;
306
+ }
307
+ static inline bool classof(const GenericPAGEdgeTy *edge)
308
+ {
309
+ return edge->getEdgeKind() == SVFStmt::BinaryOp;
310
+ }
311
+ //@}
312
+
313
+ /// constructor
314
+ BinaryOPPE(SVFVar* s, SVFVar* d) : SVFStmt(s,d,SVFStmt::BinaryOp)
315
+ {
316
+ }
317
+
318
+ virtual const std::string toString() const;
319
+ };
320
+
321
+ /*!
322
+ * Unary instruction edge
323
+ */
324
+ class UnaryOPPE: public SVFStmt
325
+ {
326
+ private:
327
+ UnaryOPPE(); ///< place holder
328
+ UnaryOPPE(const UnaryOPPE &); ///< place holder
329
+ void operator=(const UnaryOPPE &); ///< place holder
330
+ public:
331
+ /// Methods for support type inquiry through isa, cast, and dyn_cast:
332
+ //@{
333
+ static inline bool classof(const UnaryOPPE *)
334
+ {
335
+ return true;
336
+ }
337
+ static inline bool classof(const SVFStmt *edge)
338
+ {
339
+ return edge->getEdgeKind() == SVFStmt::UnaryOp;
340
+ }
341
+ static inline bool classof(const GenericPAGEdgeTy *edge)
342
+ {
343
+ return edge->getEdgeKind() == SVFStmt::UnaryOp;
344
+ }
345
+ //@}
346
+
347
+ /// constructor
348
+ UnaryOPPE(SVFVar* s, SVFVar* d) : SVFStmt(s,d,SVFStmt::UnaryOp)
349
+ {
350
+ }
351
+
352
+ virtual const std::string toString() const;
353
+ };
354
+
355
+
356
+ /*!
357
+ * Store edge
358
+ */
359
+ class StorePE: public SVFStmt
360
+ {
361
+ private:
362
+ StorePE(); ///< place holder
363
+ StorePE(const StorePE &); ///< place holder
364
+ void operator=(const StorePE &); ///< place holder
365
+
366
+ public:
367
+ /// Methods for support type inquiry through isa, cast, and dyn_cast:
368
+ //@{
369
+ static inline bool classof(const StorePE *)
370
+ {
371
+ return true;
372
+ }
373
+ static inline bool classof(const SVFStmt *edge)
374
+ {
375
+ return edge->getEdgeKind() == SVFStmt::Store;
376
+ }
377
+ static inline bool classof(const GenericPAGEdgeTy *edge)
378
+ {
379
+ return edge->getEdgeKind() == SVFStmt::Store;
380
+ }
381
+ //@}
382
+
383
+ /// constructor
384
+ StorePE(SVFVar* s, SVFVar* d, const IntraBlockNode* st) :
385
+ SVFStmt(s, d, makeEdgeFlagWithStoreInst(SVFStmt::Store, st))
386
+ {
387
+ }
388
+
389
+ virtual const std::string toString() const;
390
+ };
391
+
392
+
393
+ /*!
394
+ * Load edge
395
+ */
396
+ class LoadPE: public SVFStmt
397
+ {
398
+ private:
399
+ LoadPE(); ///< place holder
400
+ LoadPE(const LoadPE &); ///< place holder
401
+ void operator=(const LoadPE &); ///< place holder
402
+
403
+ public:
404
+ /// Methods for support type inquiry through isa, cast, and dyn_cast:
405
+ //@{
406
+ static inline bool classof(const LoadPE *)
407
+ {
408
+ return true;
409
+ }
410
+ static inline bool classof(const SVFStmt *edge)
411
+ {
412
+ return edge->getEdgeKind() == SVFStmt::Load;
413
+ }
414
+ static inline bool classof(const GenericPAGEdgeTy *edge)
415
+ {
416
+ return edge->getEdgeKind() == SVFStmt::Load;
417
+ }
418
+ //@}
419
+
420
+ /// constructor
421
+ LoadPE(SVFVar* s, SVFVar* d) : SVFStmt(s,d,SVFStmt::Load)
422
+ {
423
+ }
424
+
425
+ virtual const std::string toString() const;
426
+ };
427
+
428
+
429
+ /*!
430
+ * Gep edge
431
+ */
432
+ class GepPE: public SVFStmt
433
+ {
434
+ private:
435
+ GepPE(); ///< place holder
436
+ GepPE(const GepPE &); ///< place holder
437
+ void operator=(const GepPE &); ///< place holder
438
+
439
+ public:
440
+ /// Methods for support type inquiry through isa, cast, and dyn_cast:
441
+ //@{
442
+ static inline bool classof(const GepPE *)
443
+ {
444
+ return true;
445
+ }
446
+ static inline bool classof(const SVFStmt *edge)
447
+ {
448
+ return edge->getEdgeKind() == SVFStmt::NormalGep ||
449
+ edge->getEdgeKind() == SVFStmt::VariantGep;
450
+ }
451
+ static inline bool classof(const GenericPAGEdgeTy *edge)
452
+ {
453
+ return edge->getEdgeKind() == SVFStmt::NormalGep ||
454
+ edge->getEdgeKind() == SVFStmt::VariantGep;
455
+ }
456
+ //@}
457
+
458
+ protected:
459
+ /// constructor
460
+ GepPE(SVFVar* s, SVFVar* d, PEDGEK k) : SVFStmt(s,d,k)
461
+ {
462
+
463
+ }
464
+
465
+ virtual const std::string toString() const;
466
+ };
467
+
468
+
469
+ /*!
470
+ * Gep edge with a fixed offset
471
+ */
472
+ class NormalGepPE : public GepPE
473
+ {
474
+ private:
475
+ NormalGepPE(); ///< place holder
476
+ NormalGepPE(const NormalGepPE&); ///< place holder
477
+ void operator=(const NormalGepPE&); ///< place holder
478
+
479
+ LocationSet ls; ///< location set of the gep edge
480
+
481
+ public:
482
+ /// Methods for support type inquiry through isa, cast, and dyn_cast:
483
+ //@{
484
+ static inline bool classof(const NormalGepPE *)
485
+ {
486
+ return true;
487
+ }
488
+ static inline bool classof(const GepPE *edge)
489
+ {
490
+ return edge->getEdgeKind() == SVFStmt::NormalGep;
491
+ }
492
+ static inline bool classof(const SVFStmt *edge)
493
+ {
494
+ return edge->getEdgeKind() == SVFStmt::NormalGep;
495
+ }
496
+ static inline bool classof(const GenericPAGEdgeTy *edge)
497
+ {
498
+ return edge->getEdgeKind() == SVFStmt::NormalGep;
499
+ }
500
+ //@}
501
+
502
+ /// constructor
503
+ NormalGepPE(SVFVar* s, SVFVar* d, const LocationSet& l) : GepPE(s,d,SVFStmt::NormalGep), ls(l)
504
+ {}
505
+
506
+ /// offset of the gep edge
507
+ inline u32_t getOffset() const
508
+ {
509
+ return ls.getOffset();
510
+ }
511
+ inline const LocationSet& getLocationSet() const
512
+ {
513
+ return ls;
514
+ }
515
+
516
+ virtual const std::string toString() const;
517
+ };
518
+
519
+ /*!
520
+ * Gep edge with a variant offset
521
+ */
522
+ class VariantGepPE : public GepPE
523
+ {
524
+ private:
525
+ VariantGepPE(); ///< place holder
526
+ VariantGepPE(const VariantGepPE&); ///< place holder
527
+ void operator=(const VariantGepPE&); ///< place holder
528
+
529
+ public:
530
+ /// Methods for support type inquiry through isa, cast, and dyn_cast:
531
+ //@{
532
+ static inline bool classof(const VariantGepPE *)
533
+ {
534
+ return true;
535
+ }
536
+ static inline bool classof(const GepPE *edge)
537
+ {
538
+ return edge->getEdgeKind() == SVFStmt::VariantGep;
539
+ }
540
+ static inline bool classof(const SVFStmt *edge)
541
+ {
542
+ return edge->getEdgeKind() == SVFStmt::VariantGep;
543
+ }
544
+ static inline bool classof(const GenericPAGEdgeTy *edge)
545
+ {
546
+ return edge->getEdgeKind() == SVFStmt::VariantGep;
547
+ }
548
+ //@}
549
+
550
+ /// constructor
551
+ VariantGepPE(SVFVar* s, SVFVar* d) : GepPE(s,d,SVFStmt::VariantGep) {}
552
+
553
+ virtual const std::string toString() const;
554
+
555
+ };
556
+
557
+
558
+ /*!
559
+ * Call edge
560
+ */
561
+ class CallPE: public SVFStmt
562
+ {
563
+ private:
564
+ CallPE(); ///< place holder
565
+ CallPE(const CallPE &); ///< place holder
566
+ void operator=(const CallPE &); ///< place holder
567
+
568
+ const CallBlockNode* inst; ///< llvm instruction for this call
569
+ public:
570
+ /// Methods for support type inquiry through isa, cast, and dyn_cast:
571
+ //@{
572
+ static inline bool classof(const CallPE *)
573
+ {
574
+ return true;
575
+ }
576
+ static inline bool classof(const SVFStmt *edge)
577
+ {
578
+ return edge->getEdgeKind() == SVFStmt::Call
579
+ || edge->getEdgeKind() == SVFStmt::ThreadFork;
580
+ }
581
+ static inline bool classof(const GenericPAGEdgeTy *edge)
582
+ {
583
+ return edge->getEdgeKind() == SVFStmt::Call
584
+ || edge->getEdgeKind() == SVFStmt::ThreadFork;
585
+ }
586
+ //@}
587
+
588
+ /// constructor
589
+ CallPE(SVFVar* s, SVFVar* d, const CallBlockNode* i, GEdgeKind k = SVFStmt::Call) :
590
+ SVFStmt(s,d,makeEdgeFlagWithCallInst(k,i)), inst(i)
591
+ {
592
+ }
593
+
594
+ /// Get method for the call instruction
595
+ //@{
596
+ inline const CallBlockNode* getCallInst() const
597
+ {
598
+ return inst;
599
+ }
600
+ inline const CallBlockNode* getCallSite() const
601
+ {
602
+ return inst;
603
+ }
604
+ //@}
605
+
606
+ virtual const std::string toString() const;
607
+ };
608
+
609
+
610
+ /*!
611
+ * Return edge
612
+ */
613
+ class RetPE: public SVFStmt
614
+ {
615
+ private:
616
+ RetPE(); ///< place holder
617
+ RetPE(const RetPE &); ///< place holder
618
+ void operator=(const RetPE &); ///< place holder
619
+
620
+ const CallBlockNode* inst; /// the callsite instruction return to
621
+ public:
622
+ /// Methods for support type inquiry through isa, cast, and dyn_cast:
623
+ //@{
624
+ static inline bool classof(const RetPE *)
625
+ {
626
+ return true;
627
+ }
628
+ static inline bool classof(const SVFStmt *edge)
629
+ {
630
+ return edge->getEdgeKind() == SVFStmt::Ret
631
+ || edge->getEdgeKind() == SVFStmt::ThreadJoin;
632
+ }
633
+ static inline bool classof(const GenericPAGEdgeTy *edge)
634
+ {
635
+ return edge->getEdgeKind() == SVFStmt::Ret
636
+ || edge->getEdgeKind() == SVFStmt::ThreadJoin;
637
+ }
638
+ //@}
639
+
640
+ /// constructor
641
+ RetPE(SVFVar* s, SVFVar* d, const CallBlockNode* i, GEdgeKind k = SVFStmt::Ret) :
642
+ SVFStmt(s,d,makeEdgeFlagWithCallInst(k,i)), inst(i)
643
+ {
644
+ }
645
+
646
+ /// Get method for call instruction at caller
647
+ //@{
648
+ inline const CallBlockNode* getCallInst() const
649
+ {
650
+ return inst;
651
+ }
652
+ inline const CallBlockNode* getCallSite() const
653
+ {
654
+ return inst;
655
+ }
656
+ //@}
657
+
658
+ virtual const std::string toString() const;
659
+ };
660
+
661
+
662
+ /*!
663
+ * Thread Fork Edge
664
+ */
665
+ class TDForkPE: public CallPE
666
+ {
667
+ private:
668
+ TDForkPE(); ///< place holder
669
+ TDForkPE(const TDForkPE &); ///< place holder
670
+ void operator=(const TDForkPE &); ///< place holder
671
+
672
+ public:
673
+ /// Methods for support type inquiry through isa, cast, and dyn_cast:
674
+ //@{
675
+ static inline bool classof(const TDForkPE *)
676
+ {
677
+ return true;
678
+ }
679
+ static inline bool classof(const SVFStmt *edge)
680
+ {
681
+ return edge->getEdgeKind() == SVFStmt::ThreadFork;
682
+ }
683
+ static inline bool classof(const GenericPAGEdgeTy *edge)
684
+ {
685
+ return edge->getEdgeKind() == SVFStmt::ThreadFork;
686
+ }
687
+ //@}
688
+
689
+ /// constructor
690
+ TDForkPE(SVFVar* s, SVFVar* d, const CallBlockNode* i) :
691
+ CallPE(s,d,i,SVFStmt::ThreadFork)
692
+ {
693
+ }
694
+
695
+ virtual const std::string toString() const;
696
+ };
697
+
698
+
699
+
700
+ /*!
701
+ * Thread Join Edge
702
+ */
703
+ class TDJoinPE: public RetPE
704
+ {
705
+ private:
706
+ TDJoinPE(); ///< place holder
707
+ TDJoinPE(const TDJoinPE &); ///< place holder
708
+ void operator=(const TDJoinPE &); ///< place holder
709
+
710
+ public:
711
+ /// Methods for support type inquiry through isa, cast, and dyn_cast:
712
+ //@{
713
+ static inline bool classof(const TDJoinPE *)
714
+ {
715
+ return true;
716
+ }
717
+ static inline bool classof(const SVFStmt *edge)
718
+ {
719
+ return edge->getEdgeKind() == SVFStmt::ThreadJoin;
720
+ }
721
+ static inline bool classof(const GenericPAGEdgeTy *edge)
722
+ {
723
+ return edge->getEdgeKind() == SVFStmt::ThreadJoin;
724
+ }
725
+ //@}
726
+
727
+ /// Constructor
728
+ TDJoinPE(SVFVar* s, SVFVar* d, const CallBlockNode* i) :
729
+ RetPE(s,d,i,SVFStmt::ThreadJoin)
730
+ {
731
+ }
732
+
733
+ virtual const std::string toString() const;
734
+ };
735
+
736
+ } // End namespace SVF
737
+
738
+ #endif /* PAGEDGE_H_ */