svf-lib 1.0.732 → 1.0.736

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 (94) 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 +5 -5
  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/GenericGraph.h +1 -1
  11. package/SVF-linux/include/Graphs/ICFGNode.h +14 -14
  12. package/SVF-linux/include/Graphs/IRGraph.h +236 -0
  13. package/SVF-linux/include/Graphs/OfflineConsG.h +1 -1
  14. package/SVF-linux/include/Graphs/SVFG.h +1 -1
  15. package/SVF-linux/include/Graphs/SVFGOPT.h +3 -3
  16. package/SVF-linux/include/Graphs/VFG.h +37 -52
  17. package/SVF-linux/include/Graphs/VFGNode.h +2 -3
  18. package/SVF-linux/include/MSSA/MemRegion.h +11 -11
  19. package/SVF-linux/include/MSSA/MemSSA.h +4 -4
  20. package/SVF-linux/include/MTA/FSMPTA.h +1 -1
  21. package/SVF-linux/include/MemoryModel/PAGBuilderFromFile.h +8 -8
  22. package/SVF-linux/include/MemoryModel/PTAStat.h +31 -31
  23. package/SVF-linux/include/MemoryModel/PointerAnalysis.h +9 -9
  24. package/SVF-linux/include/MemoryModel/PointerAnalysisImpl.h +3 -3
  25. package/SVF-linux/include/MemoryModel/SVFIR.h +526 -235
  26. package/SVF-linux/include/MemoryModel/SVFStatements.h +872 -0
  27. package/SVF-linux/include/MemoryModel/SVFVariables.h +842 -0
  28. package/SVF-linux/include/MemoryModel/SymbolTableInfo.h +346 -55
  29. package/SVF-linux/include/SABER/SaberSVFGBuilder.h +0 -2
  30. package/SVF-linux/include/SABER/SrcSnkDDA.h +3 -3
  31. package/SVF-linux/include/SVF-FE/Graph2Json.h +1 -3
  32. package/SVF-linux/include/SVF-FE/SVFIRBuilder.h +398 -0
  33. package/SVF-linux/include/SVF-FE/SymbolTableBuilder.h +0 -1
  34. package/SVF-linux/include/Util/CFLSolver.h +1 -1
  35. package/SVF-linux/include/Util/ExtAPI.h +1 -1
  36. package/SVF-linux/include/Util/IRAnnotator.h +6 -6
  37. package/SVF-linux/include/Util/Options.h +1 -1
  38. package/SVF-linux/include/Util/TypeBasedHeapCloning.h +11 -11
  39. package/SVF-linux/include/WPA/Andersen.h +11 -11
  40. package/SVF-linux/include/WPA/AndersenSFR.h +4 -4
  41. package/SVF-linux/include/WPA/FlowSensitive.h +2 -2
  42. package/SVF-linux/include/WPA/FlowSensitiveTBHC.h +1 -1
  43. package/SVF-linux/include/WPA/Steensgaard.h +2 -2
  44. package/SVF-linux/include/WPA/TypeAnalysis.h +1 -1
  45. package/SVF-linux/include/WPA/VersionedFlowSensitive.h +2 -2
  46. package/SVF-linux/include/WPA/WPAStat.h +1 -2
  47. package/SVF-osx/Release-build/lib/CUDD/libCudd.a +0 -0
  48. package/SVF-osx/Release-build/lib/libSvf.a +0 -0
  49. package/SVF-osx/include/DDA/ContextDDA.h +1 -1
  50. package/SVF-osx/include/DDA/DDAClient.h +8 -8
  51. package/SVF-osx/include/DDA/DDAVFSolver.h +5 -5
  52. package/SVF-osx/include/DDA/FlowDDA.h +1 -1
  53. package/SVF-osx/include/Graphs/ConsG.h +6 -6
  54. package/SVF-osx/include/Graphs/ConsGEdge.h +2 -2
  55. package/SVF-osx/include/Graphs/ConsGNode.h +1 -1
  56. package/SVF-osx/include/Graphs/ExternalPAG.h +14 -14
  57. package/SVF-osx/include/Graphs/GenericGraph.h +1 -1
  58. package/SVF-osx/include/Graphs/ICFGNode.h +14 -14
  59. package/SVF-osx/include/Graphs/IRGraph.h +236 -0
  60. package/SVF-osx/include/Graphs/OfflineConsG.h +1 -1
  61. package/SVF-osx/include/Graphs/SVFG.h +1 -1
  62. package/SVF-osx/include/Graphs/SVFGOPT.h +3 -3
  63. package/SVF-osx/include/Graphs/VFG.h +37 -52
  64. package/SVF-osx/include/Graphs/VFGNode.h +2 -3
  65. package/SVF-osx/include/MSSA/MemRegion.h +11 -11
  66. package/SVF-osx/include/MSSA/MemSSA.h +4 -4
  67. package/SVF-osx/include/MTA/FSMPTA.h +1 -1
  68. package/SVF-osx/include/MemoryModel/PAGBuilderFromFile.h +8 -8
  69. package/SVF-osx/include/MemoryModel/PTAStat.h +31 -31
  70. package/SVF-osx/include/MemoryModel/PointerAnalysis.h +9 -9
  71. package/SVF-osx/include/MemoryModel/PointerAnalysisImpl.h +3 -3
  72. package/SVF-osx/include/MemoryModel/SVFIR.h +526 -235
  73. package/SVF-osx/include/MemoryModel/SVFStatements.h +872 -0
  74. package/SVF-osx/include/MemoryModel/SVFVariables.h +842 -0
  75. package/SVF-osx/include/MemoryModel/SymbolTableInfo.h +346 -55
  76. package/SVF-osx/include/SABER/SaberSVFGBuilder.h +0 -2
  77. package/SVF-osx/include/SABER/SrcSnkDDA.h +3 -3
  78. package/SVF-osx/include/SVF-FE/Graph2Json.h +1 -3
  79. package/SVF-osx/include/SVF-FE/SVFIRBuilder.h +398 -0
  80. package/SVF-osx/include/SVF-FE/SymbolTableBuilder.h +0 -1
  81. package/SVF-osx/include/Util/CFLSolver.h +1 -1
  82. package/SVF-osx/include/Util/ExtAPI.h +1 -1
  83. package/SVF-osx/include/Util/IRAnnotator.h +6 -6
  84. package/SVF-osx/include/Util/Options.h +1 -1
  85. package/SVF-osx/include/Util/TypeBasedHeapCloning.h +11 -11
  86. package/SVF-osx/include/WPA/Andersen.h +11 -11
  87. package/SVF-osx/include/WPA/AndersenSFR.h +4 -4
  88. package/SVF-osx/include/WPA/FlowSensitive.h +2 -2
  89. package/SVF-osx/include/WPA/FlowSensitiveTBHC.h +1 -1
  90. package/SVF-osx/include/WPA/Steensgaard.h +2 -2
  91. package/SVF-osx/include/WPA/TypeAnalysis.h +1 -1
  92. package/SVF-osx/include/WPA/VersionedFlowSensitive.h +2 -2
  93. package/SVF-osx/include/WPA/WPAStat.h +1 -2
  94. package/package.json +1 -1
@@ -0,0 +1,872 @@
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, Phi, Cmp, BinaryOp, UnaryOp, ThreadFork, ThreadJoin
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::Cmp ||
91
+ edge->getEdgeKind() == SVFStmt::BinaryOp ||
92
+ edge->getEdgeKind() == SVFStmt::UnaryOp ||
93
+ edge->getEdgeKind() == SVFStmt::ThreadFork ||
94
+ edge->getEdgeKind() == SVFStmt::ThreadJoin;
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 second variable operand for MultiOpndStmt.
139
+ static inline GEdgeFlag makeEdgeFlagWithAddionalOpnd(GEdgeKind k, const SVFVar* var)
140
+ {
141
+ Var2LabelMap::const_iterator iter = var2LabelMap.find(var);
142
+ u64_t label = (iter != var2LabelMap.end()) ?
143
+ iter->second : multiOpndLabelCounter++;
144
+ return (label << EdgeKindMaskBits) | k;
145
+ }
146
+
147
+ /// Compute the unique edgeFlag value from edge kind and call site Instruction.
148
+ static inline GEdgeFlag makeEdgeFlagWithCallInst(GEdgeKind k, const ICFGNode* cs)
149
+ {
150
+ Inst2LabelMap::const_iterator iter = inst2LabelMap.find(cs);
151
+ u64_t label = (iter != inst2LabelMap.end()) ?
152
+ iter->second : callEdgeLabelCounter++;
153
+ return (label << EdgeKindMaskBits) | k;
154
+ }
155
+
156
+ /// Compute the unique edgeFlag value from edge kind and store Instruction.
157
+ /// Two store instructions may share the same StorePAGEdge
158
+ static inline GEdgeFlag makeEdgeFlagWithStoreInst(GEdgeKind k, const ICFGNode* store)
159
+ {
160
+ Inst2LabelMap::const_iterator iter = inst2LabelMap.find(store);
161
+ u64_t label = (iter != inst2LabelMap.end()) ?
162
+ iter->second : storeEdgeLabelCounter++;
163
+ return (label << EdgeKindMaskBits) | k;
164
+ }
165
+
166
+ virtual const std::string toString() const;
167
+
168
+ //@}
169
+ /// Overloading operator << for dumping SVFVar value
170
+ //@{
171
+ friend raw_ostream& operator<< (raw_ostream &o, const SVFStmt &edge)
172
+ {
173
+ o << edge.toString();
174
+ return o;
175
+ }
176
+ //@}
177
+
178
+ typedef GenericNode<SVFVar,SVFStmt>::GEdgeSetTy PAGEdgeSetTy;
179
+ typedef Map<EdgeID, PAGEdgeSetTy> PAGEdgeToSetMapTy;
180
+ typedef PAGEdgeToSetMapTy PAGKindToEdgeSetMapTy;
181
+
182
+ private:
183
+ typedef Map<const ICFGNode*, u32_t> Inst2LabelMap;
184
+ typedef Map<const SVFVar*, u32_t> Var2LabelMap;
185
+ static Inst2LabelMap inst2LabelMap; ///< Call site Instruction to label map
186
+ static Var2LabelMap var2LabelMap; ///< Second operand of MultiOpndStmt to label map
187
+ static u64_t callEdgeLabelCounter; ///< Call site Instruction counter
188
+ static u64_t storeEdgeLabelCounter; ///< Store Instruction counter
189
+ static u64_t multiOpndLabelCounter; ///< MultiOpndStmt counter
190
+ };
191
+
192
+
193
+ /*!
194
+ * Copy edge
195
+ */
196
+ class AddrPE: public SVFStmt
197
+ {
198
+ private:
199
+ AddrPE(); ///< place holder
200
+ AddrPE(const AddrPE &); ///< place holder
201
+ void operator=(const AddrPE &); ///< place holder
202
+ public:
203
+ /// Methods for support type inquiry through isa, cast, and dyn_cast:
204
+ //@{
205
+ static inline bool classof(const AddrPE *)
206
+ {
207
+ return true;
208
+ }
209
+ static inline bool classof(const SVFStmt *edge)
210
+ {
211
+ return edge->getEdgeKind() == SVFStmt::Addr;
212
+ }
213
+ static inline bool classof(const GenericPAGEdgeTy *edge)
214
+ {
215
+ return edge->getEdgeKind() == SVFStmt::Addr;
216
+ }
217
+ //@}
218
+
219
+ /// constructor
220
+ AddrPE(SVFVar* s, SVFVar* d) : SVFStmt(s,d,SVFStmt::Addr)
221
+ {
222
+ }
223
+
224
+ virtual const std::string toString() const override;
225
+ };
226
+
227
+
228
+ /*!
229
+ * Copy edge
230
+ */
231
+ class CopyPE: public SVFStmt
232
+ {
233
+ private:
234
+ CopyPE(); ///< place holder
235
+ CopyPE(const CopyPE &); ///< place holder
236
+ void operator=(const CopyPE &); ///< place holder
237
+ public:
238
+ /// Methods for support type inquiry through isa, cast, and dyn_cast:
239
+ //@{
240
+ static inline bool classof(const CopyPE *)
241
+ {
242
+ return true;
243
+ }
244
+ static inline bool classof(const SVFStmt *edge)
245
+ {
246
+ return edge->getEdgeKind() == SVFStmt::Copy;
247
+ }
248
+ static inline bool classof(const GenericPAGEdgeTy *edge)
249
+ {
250
+ return edge->getEdgeKind() == SVFStmt::Copy;
251
+ }
252
+ //@}
253
+
254
+ /// constructor
255
+ CopyPE(SVFVar* s, SVFVar* d) : SVFStmt(s,d,SVFStmt::Copy)
256
+ {
257
+ }
258
+
259
+ virtual const std::string toString() const override;
260
+ };
261
+
262
+ class MultiOpndStmt : public SVFStmt{
263
+ public:
264
+ typedef std::vector<SVFVar*> OPVars;
265
+ protected:
266
+ OPVars opVars;
267
+ public:
268
+ /// Constructor, only used by subclassess but not external users
269
+ MultiOpndStmt(SVFVar* r, const OPVars& opnds, GEdgeFlag k): SVFStmt(opnds.at(0), r, k), opVars(opnds)
270
+ {
271
+ }
272
+ /// Methods for support type inquiry through isa, cast, and dyn_cast:
273
+ //@{
274
+ static inline bool classof(const MultiOpndStmt *)
275
+ {
276
+ return true;
277
+ }
278
+ static inline bool classof(const SVFStmt *node)
279
+ {
280
+ return node->getEdgeKind() == Phi ||
281
+ node->getEdgeKind() == BinaryOp ||
282
+ node->getEdgeKind() == Cmp;
283
+ }
284
+ static inline bool classof(const GenericPAGEdgeTy *node)
285
+ {
286
+ return node->getEdgeKind() == Phi ||
287
+ node->getEdgeKind() == BinaryOp ||
288
+ node->getEdgeKind() == Cmp;
289
+ }
290
+ //@}
291
+ /// Operands and result at a BinaryNode e.g., p = q + r, `p` is resVar and `r` is OpVar
292
+ //@{
293
+ /// Operand SVFVars
294
+ inline const SVFVar* getOpVar(u32_t pos) const
295
+ {
296
+ return opVars.at(pos);
297
+ }
298
+ /// Result SVFVar
299
+ inline const SVFVar* getRes() const
300
+ {
301
+ return getDstNode();
302
+ }
303
+
304
+ NodeID getOpVarID(u32_t pos) const;
305
+ NodeID getResID() const;
306
+
307
+ inline u32_t getOpVarNum() const
308
+ {
309
+ return opVars.size();
310
+ }
311
+ inline const OPVars& getOpndVars() const{
312
+ return opVars;
313
+ }
314
+ inline OPVars::const_iterator opVarBegin() const
315
+ {
316
+ return opVars.begin();
317
+ }
318
+ inline OPVars::const_iterator opVerEnd() const
319
+ {
320
+ return opVars.end();
321
+ }
322
+ //@}
323
+ };
324
+
325
+ /*!
326
+ * Phi instruction edge
327
+ */
328
+ class PhiPE: public MultiOpndStmt
329
+ {
330
+ private:
331
+ PhiPE(); ///< place holder
332
+ PhiPE(const PhiPE &); ///< place holder
333
+ void operator=(const PhiPE &); ///< place holder
334
+ SVFVar* getSrcNode(); ///< place holder, not allowed since this SVFStmt has multiple operands but not a single source
335
+ SVFVar* getDstNode(); ///< place holder, use getRes() instead
336
+ SVFVar* getSrcID(); ///< place holder, use getOpVarID(pos) instead
337
+ SVFVar* getDstID(); ///< place holder, use getResID() instead
338
+
339
+ public:
340
+ /// Methods for support type inquiry through isa, cast, and dyn_cast:
341
+ //@{
342
+ static inline bool classof(const PhiPE *)
343
+ {
344
+ return true;
345
+ }
346
+ static inline bool classof(const SVFStmt *edge)
347
+ {
348
+ return edge->getEdgeKind() == SVFStmt::Phi;
349
+ }
350
+ static inline bool classof(const MultiOpndStmt *edge)
351
+ {
352
+ return edge->getEdgeKind() == SVFStmt::Phi;
353
+ }
354
+ static inline bool classof(const GenericPAGEdgeTy *edge)
355
+ {
356
+ return edge->getEdgeKind() == SVFStmt::Phi;
357
+ }
358
+ //@}
359
+
360
+ /// constructor
361
+ PhiPE(SVFVar* s, const OPVars& opnds) : MultiOpndStmt(s,opnds,SVFStmt::Phi)
362
+ {
363
+ }
364
+ void addOpVar(SVFVar* op){
365
+ opVars.push_back(op);
366
+ }
367
+ virtual const std::string toString() const override;
368
+ };
369
+
370
+
371
+ /*!
372
+ * Compare instruction edge
373
+ */
374
+ class CmpPE: public MultiOpndStmt
375
+ {
376
+ private:
377
+ CmpPE(); ///< place holder
378
+ CmpPE(const CmpPE &); ///< place holder
379
+ void operator=(const CmpPE &); ///< place holder
380
+ SVFVar* getSrcNode(); ///< place holder, not allowed since this SVFStmt has multiple operands but not a single source
381
+ SVFVar* getDstNode(); ///< place holder, use getRes() instead
382
+ SVFVar* getSrcID(); ///< place holder, use getOpVarID(pos) instead
383
+ SVFVar* getDstID(); ///< place holder, use getResID() instead
384
+ public:
385
+ /// Methods for support type inquiry through isa, cast, and dyn_cast:
386
+ //@{
387
+ static inline bool classof(const CmpPE *)
388
+ {
389
+ return true;
390
+ }
391
+ static inline bool classof(const SVFStmt *edge)
392
+ {
393
+ return edge->getEdgeKind() == SVFStmt::Cmp;
394
+ }
395
+ static inline bool classof(const MultiOpndStmt *edge)
396
+ {
397
+ return edge->getEdgeKind() == SVFStmt::Cmp;
398
+ }
399
+ static inline bool classof(const GenericPAGEdgeTy *edge)
400
+ {
401
+ return edge->getEdgeKind() == SVFStmt::Cmp;
402
+ }
403
+ //@}
404
+
405
+ /// constructor
406
+ CmpPE(SVFVar* s, const OPVars& opnds) : MultiOpndStmt(s,opnds,SVFStmt::Cmp)
407
+ {
408
+ }
409
+ virtual const std::string toString() const override;
410
+ };
411
+
412
+
413
+ /*!
414
+ * Binary instruction edge
415
+ */
416
+ class BinaryOPPE: public MultiOpndStmt
417
+ {
418
+ private:
419
+ BinaryOPPE(); ///< place holder
420
+ BinaryOPPE(const BinaryOPPE &); ///< place holder
421
+ void operator=(const BinaryOPPE &); ///< place holder
422
+ SVFVar* getSrcNode(); ///< place holder, not allowed since this SVFStmt has multiple operands but not a single source
423
+ SVFVar* getDstNode(); ///< place holder, use getRes() instead
424
+ SVFVar* getSrcID(); ///< place holder, use getOpVarID(pos) instead
425
+ SVFVar* getDstID(); ///< place holder, use getResID() instead
426
+
427
+ public:
428
+ /// Methods for support type inquiry through isa, cast, and dyn_cast:
429
+ //@{
430
+ static inline bool classof(const BinaryOPPE *)
431
+ {
432
+ return true;
433
+ }
434
+ static inline bool classof(const SVFStmt *edge)
435
+ {
436
+ return edge->getEdgeKind() == SVFStmt::BinaryOp;
437
+ }
438
+ static inline bool classof(const MultiOpndStmt *edge)
439
+ {
440
+ return edge->getEdgeKind() == SVFStmt::BinaryOp;
441
+ }
442
+ static inline bool classof(const GenericPAGEdgeTy *edge)
443
+ {
444
+ return edge->getEdgeKind() == SVFStmt::BinaryOp;
445
+ }
446
+ //@}
447
+
448
+ /// constructor
449
+ BinaryOPPE(SVFVar* s, const OPVars& opnds) : MultiOpndStmt(s,opnds,SVFStmt::BinaryOp)
450
+ {
451
+ }
452
+ virtual const std::string toString() const override;
453
+ };
454
+
455
+ /*!
456
+ * Unary instruction edge
457
+ */
458
+ class UnaryOPPE: public SVFStmt
459
+ {
460
+ private:
461
+ UnaryOPPE(); ///< place holder
462
+ UnaryOPPE(const UnaryOPPE &); ///< place holder
463
+ void operator=(const UnaryOPPE &); ///< place holder
464
+ public:
465
+ /// Methods for support type inquiry through isa, cast, and dyn_cast:
466
+ //@{
467
+ static inline bool classof(const UnaryOPPE *)
468
+ {
469
+ return true;
470
+ }
471
+ static inline bool classof(const SVFStmt *edge)
472
+ {
473
+ return edge->getEdgeKind() == SVFStmt::UnaryOp;
474
+ }
475
+ static inline bool classof(const GenericPAGEdgeTy *edge)
476
+ {
477
+ return edge->getEdgeKind() == SVFStmt::UnaryOp;
478
+ }
479
+ //@}
480
+
481
+ /// constructor
482
+ UnaryOPPE(SVFVar* s, SVFVar* d) : SVFStmt(s,d,SVFStmt::UnaryOp)
483
+ {
484
+ }
485
+
486
+ virtual const std::string toString() const override;
487
+ };
488
+
489
+
490
+ /*!
491
+ * Store edge
492
+ */
493
+ class StorePE: public SVFStmt
494
+ {
495
+ private:
496
+ StorePE(); ///< place holder
497
+ StorePE(const StorePE &); ///< place holder
498
+ void operator=(const StorePE &); ///< place holder
499
+
500
+ public:
501
+ /// Methods for support type inquiry through isa, cast, and dyn_cast:
502
+ //@{
503
+ static inline bool classof(const StorePE *)
504
+ {
505
+ return true;
506
+ }
507
+ static inline bool classof(const SVFStmt *edge)
508
+ {
509
+ return edge->getEdgeKind() == SVFStmt::Store;
510
+ }
511
+ static inline bool classof(const GenericPAGEdgeTy *edge)
512
+ {
513
+ return edge->getEdgeKind() == SVFStmt::Store;
514
+ }
515
+ //@}
516
+
517
+ /// constructor
518
+ StorePE(SVFVar* s, SVFVar* d, const IntraBlockNode* st) :
519
+ SVFStmt(s, d, makeEdgeFlagWithStoreInst(SVFStmt::Store, st))
520
+ {
521
+ }
522
+
523
+ virtual const std::string toString() const override;
524
+ };
525
+
526
+
527
+ /*!
528
+ * Load edge
529
+ */
530
+ class LoadPE: public SVFStmt
531
+ {
532
+ private:
533
+ LoadPE(); ///< place holder
534
+ LoadPE(const LoadPE &); ///< place holder
535
+ void operator=(const LoadPE &); ///< place holder
536
+
537
+ public:
538
+ /// Methods for support type inquiry through isa, cast, and dyn_cast:
539
+ //@{
540
+ static inline bool classof(const LoadPE *)
541
+ {
542
+ return true;
543
+ }
544
+ static inline bool classof(const SVFStmt *edge)
545
+ {
546
+ return edge->getEdgeKind() == SVFStmt::Load;
547
+ }
548
+ static inline bool classof(const GenericPAGEdgeTy *edge)
549
+ {
550
+ return edge->getEdgeKind() == SVFStmt::Load;
551
+ }
552
+ //@}
553
+
554
+ /// constructor
555
+ LoadPE(SVFVar* s, SVFVar* d) : SVFStmt(s,d,SVFStmt::Load)
556
+ {
557
+ }
558
+
559
+ virtual const std::string toString() const override;
560
+ };
561
+
562
+
563
+ /*!
564
+ * Gep edge
565
+ */
566
+ class GepPE: public SVFStmt
567
+ {
568
+ private:
569
+ GepPE(); ///< place holder
570
+ GepPE(const GepPE &); ///< place holder
571
+ void operator=(const GepPE &); ///< place holder
572
+
573
+ public:
574
+ /// Methods for support type inquiry through isa, cast, and dyn_cast:
575
+ //@{
576
+ static inline bool classof(const GepPE *)
577
+ {
578
+ return true;
579
+ }
580
+ static inline bool classof(const SVFStmt *edge)
581
+ {
582
+ return edge->getEdgeKind() == SVFStmt::NormalGep ||
583
+ edge->getEdgeKind() == SVFStmt::VariantGep;
584
+ }
585
+ static inline bool classof(const GenericPAGEdgeTy *edge)
586
+ {
587
+ return edge->getEdgeKind() == SVFStmt::NormalGep ||
588
+ edge->getEdgeKind() == SVFStmt::VariantGep;
589
+ }
590
+ //@}
591
+
592
+ protected:
593
+ /// constructor
594
+ GepPE(SVFVar* s, SVFVar* d, PEDGEK k) : SVFStmt(s,d,k)
595
+ {
596
+
597
+ }
598
+
599
+ virtual const std::string toString() const;
600
+ };
601
+
602
+
603
+ /*!
604
+ * Gep edge with a fixed offset
605
+ */
606
+ class NormalGepPE : public GepPE
607
+ {
608
+ private:
609
+ NormalGepPE(); ///< place holder
610
+ NormalGepPE(const NormalGepPE&); ///< place holder
611
+ void operator=(const NormalGepPE&); ///< place holder
612
+
613
+ LocationSet ls; ///< location set of the gep edge
614
+
615
+ public:
616
+ /// Methods for support type inquiry through isa, cast, and dyn_cast:
617
+ //@{
618
+ static inline bool classof(const NormalGepPE *)
619
+ {
620
+ return true;
621
+ }
622
+ static inline bool classof(const GepPE *edge)
623
+ {
624
+ return edge->getEdgeKind() == SVFStmt::NormalGep;
625
+ }
626
+ static inline bool classof(const SVFStmt *edge)
627
+ {
628
+ return edge->getEdgeKind() == SVFStmt::NormalGep;
629
+ }
630
+ static inline bool classof(const GenericPAGEdgeTy *edge)
631
+ {
632
+ return edge->getEdgeKind() == SVFStmt::NormalGep;
633
+ }
634
+ //@}
635
+
636
+ /// constructor
637
+ NormalGepPE(SVFVar* s, SVFVar* d, const LocationSet& l) : GepPE(s,d,SVFStmt::NormalGep), ls(l)
638
+ {}
639
+
640
+ /// offset of the gep edge
641
+ inline u32_t getOffset() const
642
+ {
643
+ return ls.getOffset();
644
+ }
645
+ inline const LocationSet& getLocationSet() const
646
+ {
647
+ return ls;
648
+ }
649
+
650
+ virtual const std::string toString() const override;
651
+ };
652
+
653
+ /*!
654
+ * Gep edge with a variant offset
655
+ */
656
+ class VariantGepPE : public GepPE
657
+ {
658
+ private:
659
+ VariantGepPE(); ///< place holder
660
+ VariantGepPE(const VariantGepPE&); ///< place holder
661
+ void operator=(const VariantGepPE&); ///< place holder
662
+
663
+ public:
664
+ /// Methods for support type inquiry through isa, cast, and dyn_cast:
665
+ //@{
666
+ static inline bool classof(const VariantGepPE *)
667
+ {
668
+ return true;
669
+ }
670
+ static inline bool classof(const GepPE *edge)
671
+ {
672
+ return edge->getEdgeKind() == SVFStmt::VariantGep;
673
+ }
674
+ static inline bool classof(const SVFStmt *edge)
675
+ {
676
+ return edge->getEdgeKind() == SVFStmt::VariantGep;
677
+ }
678
+ static inline bool classof(const GenericPAGEdgeTy *edge)
679
+ {
680
+ return edge->getEdgeKind() == SVFStmt::VariantGep;
681
+ }
682
+ //@}
683
+
684
+ /// constructor
685
+ VariantGepPE(SVFVar* s, SVFVar* d) : GepPE(s,d,SVFStmt::VariantGep) {}
686
+
687
+ virtual const std::string toString() const override;
688
+
689
+ };
690
+
691
+
692
+ /*!
693
+ * Call edge
694
+ */
695
+ class CallPE: public SVFStmt
696
+ {
697
+ private:
698
+ CallPE(); ///< place holder
699
+ CallPE(const CallPE &); ///< place holder
700
+ void operator=(const CallPE &); ///< place holder
701
+
702
+ const CallBlockNode* inst; ///< llvm instruction for this call
703
+ public:
704
+ /// Methods for support type inquiry through isa, cast, and dyn_cast:
705
+ //@{
706
+ static inline bool classof(const CallPE *)
707
+ {
708
+ return true;
709
+ }
710
+ static inline bool classof(const SVFStmt *edge)
711
+ {
712
+ return edge->getEdgeKind() == SVFStmt::Call
713
+ || edge->getEdgeKind() == SVFStmt::ThreadFork;
714
+ }
715
+ static inline bool classof(const GenericPAGEdgeTy *edge)
716
+ {
717
+ return edge->getEdgeKind() == SVFStmt::Call
718
+ || edge->getEdgeKind() == SVFStmt::ThreadFork;
719
+ }
720
+ //@}
721
+
722
+ /// constructor
723
+ CallPE(SVFVar* s, SVFVar* d, const CallBlockNode* i, GEdgeKind k = SVFStmt::Call) :
724
+ SVFStmt(s,d,makeEdgeFlagWithCallInst(k,i)), inst(i)
725
+ {
726
+ }
727
+
728
+ /// Get method for the call instruction
729
+ //@{
730
+ inline const CallBlockNode* getCallInst() const
731
+ {
732
+ return inst;
733
+ }
734
+ inline const CallBlockNode* getCallSite() const
735
+ {
736
+ return inst;
737
+ }
738
+ //@}
739
+
740
+ virtual const std::string toString() const override;
741
+ };
742
+
743
+
744
+ /*!
745
+ * Return edge
746
+ */
747
+ class RetPE: public SVFStmt
748
+ {
749
+ private:
750
+ RetPE(); ///< place holder
751
+ RetPE(const RetPE &); ///< place holder
752
+ void operator=(const RetPE &); ///< place holder
753
+
754
+ const CallBlockNode* inst; /// the callsite instruction return to
755
+ public:
756
+ /// Methods for support type inquiry through isa, cast, and dyn_cast:
757
+ //@{
758
+ static inline bool classof(const RetPE *)
759
+ {
760
+ return true;
761
+ }
762
+ static inline bool classof(const SVFStmt *edge)
763
+ {
764
+ return edge->getEdgeKind() == SVFStmt::Ret
765
+ || edge->getEdgeKind() == SVFStmt::ThreadJoin;
766
+ }
767
+ static inline bool classof(const GenericPAGEdgeTy *edge)
768
+ {
769
+ return edge->getEdgeKind() == SVFStmt::Ret
770
+ || edge->getEdgeKind() == SVFStmt::ThreadJoin;
771
+ }
772
+ //@}
773
+
774
+ /// constructor
775
+ RetPE(SVFVar* s, SVFVar* d, const CallBlockNode* i, GEdgeKind k = SVFStmt::Ret) :
776
+ SVFStmt(s,d,makeEdgeFlagWithCallInst(k,i)), inst(i)
777
+ {
778
+ }
779
+
780
+ /// Get method for call instruction at caller
781
+ //@{
782
+ inline const CallBlockNode* getCallInst() const
783
+ {
784
+ return inst;
785
+ }
786
+ inline const CallBlockNode* getCallSite() const
787
+ {
788
+ return inst;
789
+ }
790
+ //@}
791
+
792
+ virtual const std::string toString() const override;
793
+ };
794
+
795
+
796
+ /*!
797
+ * Thread Fork Edge
798
+ */
799
+ class TDForkPE: public CallPE
800
+ {
801
+ private:
802
+ TDForkPE(); ///< place holder
803
+ TDForkPE(const TDForkPE &); ///< place holder
804
+ void operator=(const TDForkPE &); ///< place holder
805
+
806
+ public:
807
+ /// Methods for support type inquiry through isa, cast, and dyn_cast:
808
+ //@{
809
+ static inline bool classof(const TDForkPE *)
810
+ {
811
+ return true;
812
+ }
813
+ static inline bool classof(const SVFStmt *edge)
814
+ {
815
+ return edge->getEdgeKind() == SVFStmt::ThreadFork;
816
+ }
817
+ static inline bool classof(const GenericPAGEdgeTy *edge)
818
+ {
819
+ return edge->getEdgeKind() == SVFStmt::ThreadFork;
820
+ }
821
+ //@}
822
+
823
+ /// constructor
824
+ TDForkPE(SVFVar* s, SVFVar* d, const CallBlockNode* i) :
825
+ CallPE(s,d,i,SVFStmt::ThreadFork)
826
+ {
827
+ }
828
+
829
+ virtual const std::string toString() const;
830
+ };
831
+
832
+
833
+
834
+ /*!
835
+ * Thread Join Edge
836
+ */
837
+ class TDJoinPE: public RetPE
838
+ {
839
+ private:
840
+ TDJoinPE(); ///< place holder
841
+ TDJoinPE(const TDJoinPE &); ///< place holder
842
+ void operator=(const TDJoinPE &); ///< place holder
843
+
844
+ public:
845
+ /// Methods for support type inquiry through isa, cast, and dyn_cast:
846
+ //@{
847
+ static inline bool classof(const TDJoinPE *)
848
+ {
849
+ return true;
850
+ }
851
+ static inline bool classof(const SVFStmt *edge)
852
+ {
853
+ return edge->getEdgeKind() == SVFStmt::ThreadJoin;
854
+ }
855
+ static inline bool classof(const GenericPAGEdgeTy *edge)
856
+ {
857
+ return edge->getEdgeKind() == SVFStmt::ThreadJoin;
858
+ }
859
+ //@}
860
+
861
+ /// Constructor
862
+ TDJoinPE(SVFVar* s, SVFVar* d, const CallBlockNode* i) :
863
+ RetPE(s,d,i,SVFStmt::ThreadJoin)
864
+ {
865
+ }
866
+
867
+ virtual const std::string toString() const;
868
+ };
869
+
870
+ } // End namespace SVF
871
+
872
+ #endif /* PAGEDGE_H_ */