svf-lib 1.0.733 → 1.0.737

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 (59) 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/CHG.h +351 -0
  7. package/SVF-linux/include/Graphs/ConsG.h +6 -6
  8. package/SVF-linux/include/Graphs/ConsGEdge.h +2 -2
  9. package/SVF-linux/include/Graphs/ConsGNode.h +1 -1
  10. package/SVF-linux/include/Graphs/ExternalPAG.h +14 -14
  11. package/SVF-linux/include/Graphs/GenericGraph.h +1 -1
  12. package/SVF-linux/include/Graphs/ICFGNode.h +14 -14
  13. package/SVF-linux/include/Graphs/IRGraph.h +236 -0
  14. package/SVF-linux/include/Graphs/OfflineConsG.h +1 -1
  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 +53 -52
  18. package/SVF-linux/include/Graphs/VFGNode.h +60 -8
  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 +525 -233
  27. package/SVF-linux/include/MemoryModel/SVFStatements.h +970 -0
  28. package/SVF-linux/include/MemoryModel/SVFVariables.h +842 -0
  29. package/SVF-linux/include/MemoryModel/SymbolTableInfo.h +346 -55
  30. package/SVF-linux/include/SABER/SaberSVFGBuilder.h +0 -2
  31. package/SVF-linux/include/SABER/SrcSnkDDA.h +3 -3
  32. package/SVF-linux/include/SVF-FE/CHGBuilder.h +69 -0
  33. package/SVF-linux/include/SVF-FE/DCHG.h +1 -1
  34. package/SVF-linux/include/SVF-FE/Graph2Json.h +1 -3
  35. package/SVF-linux/include/SVF-FE/SVFIRBuilder.h +405 -0
  36. package/SVF-linux/include/SVF-FE/SymbolTableBuilder.h +0 -1
  37. package/SVF-linux/include/Util/CFLSolver.h +1 -1
  38. package/SVF-linux/include/Util/ExtAPI.h +1 -1
  39. package/SVF-linux/include/Util/IRAnnotator.h +6 -6
  40. package/SVF-linux/include/Util/Options.h +1 -1
  41. package/SVF-linux/include/Util/TypeBasedHeapCloning.h +11 -11
  42. package/SVF-linux/include/WPA/Andersen.h +11 -11
  43. package/SVF-linux/include/WPA/AndersenSFR.h +4 -4
  44. package/SVF-linux/include/WPA/FlowSensitive.h +2 -2
  45. package/SVF-linux/include/WPA/FlowSensitiveTBHC.h +1 -1
  46. package/SVF-linux/include/WPA/Steensgaard.h +2 -2
  47. package/SVF-linux/include/WPA/TypeAnalysis.h +1 -1
  48. package/SVF-linux/include/WPA/VersionedFlowSensitive.h +2 -2
  49. package/SVF-linux/include/WPA/WPAStat.h +1 -2
  50. package/SVF-osx/Release-build/lib/CUDD/libCudd.a +0 -0
  51. package/SVF-osx/Release-build/lib/libSvf.a +0 -0
  52. package/SVF-osx/include/Graphs/GenericGraph.h +1 -1
  53. package/SVF-osx/include/Graphs/IRGraph.h +6 -15
  54. package/SVF-osx/include/Graphs/VFG.h +26 -41
  55. package/SVF-osx/include/Graphs/VFGNode.h +2 -2
  56. package/SVF-osx/include/MemoryModel/SVFIR.h +29 -96
  57. package/SVF-osx/include/MemoryModel/SVFStatements.h +156 -22
  58. package/SVF-osx/include/SVF-FE/SVFIRBuilder.h +12 -6
  59. package/package.json +1 -1
@@ -53,7 +53,7 @@ public:
53
53
  /// ThreadFork/ThreadJoin is to model parameter passings between thread spawners and spawnees.
54
54
  enum PEDGEK
55
55
  {
56
- Addr, Copy, Store, Load, Call, Ret, NormalGep, VariantGep, ThreadFork, ThreadJoin, Cmp, BinaryOp, UnaryOp
56
+ Addr, Copy, Store, Load, Call, Ret, NormalGep, VariantGep, Phi, Cmp, BinaryOp, UnaryOp, ThreadFork, ThreadJoin
57
57
  };
58
58
 
59
59
  private:
@@ -87,11 +87,11 @@ public:
87
87
  edge->getEdgeKind() == SVFStmt::Ret ||
88
88
  edge->getEdgeKind() == SVFStmt::NormalGep ||
89
89
  edge->getEdgeKind() == SVFStmt::VariantGep ||
90
- edge->getEdgeKind() == SVFStmt::ThreadFork ||
91
- edge->getEdgeKind() == SVFStmt::ThreadJoin ||
92
90
  edge->getEdgeKind() == SVFStmt::Cmp ||
93
91
  edge->getEdgeKind() == SVFStmt::BinaryOp ||
94
- edge->getEdgeKind() == SVFStmt::UnaryOp;
92
+ edge->getEdgeKind() == SVFStmt::UnaryOp ||
93
+ edge->getEdgeKind() == SVFStmt::ThreadFork ||
94
+ edge->getEdgeKind() == SVFStmt::ThreadJoin;
95
95
  }
96
96
  ///@}
97
97
 
@@ -135,6 +135,15 @@ public:
135
135
  }
136
136
  //@}
137
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
+
138
147
  /// Compute the unique edgeFlag value from edge kind and call site Instruction.
139
148
  static inline GEdgeFlag makeEdgeFlagWithCallInst(GEdgeKind k, const ICFGNode* cs)
140
149
  {
@@ -172,13 +181,15 @@ public:
172
181
 
173
182
  private:
174
183
  typedef Map<const ICFGNode*, u32_t> Inst2LabelMap;
184
+ typedef Map<const SVFVar*, u32_t> Var2LabelMap;
175
185
  static Inst2LabelMap inst2LabelMap; ///< Call site Instruction to label map
186
+ static Var2LabelMap var2LabelMap; ///< Second operand of MultiOpndStmt to label map
176
187
  static u64_t callEdgeLabelCounter; ///< Call site Instruction counter
177
188
  static u64_t storeEdgeLabelCounter; ///< Store Instruction counter
189
+ static u64_t multiOpndLabelCounter; ///< MultiOpndStmt counter
178
190
  };
179
191
 
180
192
 
181
-
182
193
  /*!
183
194
  * Copy edge
184
195
  */
@@ -210,7 +221,7 @@ public:
210
221
  {
211
222
  }
212
223
 
213
- virtual const std::string toString() const;
224
+ virtual const std::string toString() const override;
214
225
  };
215
226
 
216
227
 
@@ -245,19 +256,131 @@ public:
245
256
  {
246
257
  }
247
258
 
248
- virtual const std::string toString() const;
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;
249
368
  };
250
369
 
251
370
 
252
371
  /*!
253
372
  * Compare instruction edge
254
373
  */
255
- class CmpPE: public SVFStmt
374
+ class CmpPE: public MultiOpndStmt
256
375
  {
257
376
  private:
258
377
  CmpPE(); ///< place holder
259
378
  CmpPE(const CmpPE &); ///< place holder
260
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
261
384
  public:
262
385
  /// Methods for support type inquiry through isa, cast, and dyn_cast:
263
386
  //@{
@@ -269,6 +392,10 @@ public:
269
392
  {
270
393
  return edge->getEdgeKind() == SVFStmt::Cmp;
271
394
  }
395
+ static inline bool classof(const MultiOpndStmt *edge)
396
+ {
397
+ return edge->getEdgeKind() == SVFStmt::Cmp;
398
+ }
272
399
  static inline bool classof(const GenericPAGEdgeTy *edge)
273
400
  {
274
401
  return edge->getEdgeKind() == SVFStmt::Cmp;
@@ -276,23 +403,27 @@ public:
276
403
  //@}
277
404
 
278
405
  /// constructor
279
- CmpPE(SVFVar* s, SVFVar* d) : SVFStmt(s,d,SVFStmt::Cmp)
406
+ CmpPE(SVFVar* s, const OPVars& opnds) : MultiOpndStmt(s,opnds,SVFStmt::Cmp)
280
407
  {
281
408
  }
282
-
283
- virtual const std::string toString() const;
409
+ virtual const std::string toString() const override;
284
410
  };
285
411
 
286
412
 
287
413
  /*!
288
414
  * Binary instruction edge
289
415
  */
290
- class BinaryOPPE: public SVFStmt
416
+ class BinaryOPPE: public MultiOpndStmt
291
417
  {
292
418
  private:
293
419
  BinaryOPPE(); ///< place holder
294
420
  BinaryOPPE(const BinaryOPPE &); ///< place holder
295
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
+
296
427
  public:
297
428
  /// Methods for support type inquiry through isa, cast, and dyn_cast:
298
429
  //@{
@@ -304,6 +435,10 @@ public:
304
435
  {
305
436
  return edge->getEdgeKind() == SVFStmt::BinaryOp;
306
437
  }
438
+ static inline bool classof(const MultiOpndStmt *edge)
439
+ {
440
+ return edge->getEdgeKind() == SVFStmt::BinaryOp;
441
+ }
307
442
  static inline bool classof(const GenericPAGEdgeTy *edge)
308
443
  {
309
444
  return edge->getEdgeKind() == SVFStmt::BinaryOp;
@@ -311,11 +446,10 @@ public:
311
446
  //@}
312
447
 
313
448
  /// constructor
314
- BinaryOPPE(SVFVar* s, SVFVar* d) : SVFStmt(s,d,SVFStmt::BinaryOp)
449
+ BinaryOPPE(SVFVar* s, const OPVars& opnds) : MultiOpndStmt(s,opnds,SVFStmt::BinaryOp)
315
450
  {
316
451
  }
317
-
318
- virtual const std::string toString() const;
452
+ virtual const std::string toString() const override;
319
453
  };
320
454
 
321
455
  /*!
@@ -349,7 +483,7 @@ public:
349
483
  {
350
484
  }
351
485
 
352
- virtual const std::string toString() const;
486
+ virtual const std::string toString() const override;
353
487
  };
354
488
 
355
489
 
@@ -386,7 +520,7 @@ public:
386
520
  {
387
521
  }
388
522
 
389
- virtual const std::string toString() const;
523
+ virtual const std::string toString() const override;
390
524
  };
391
525
 
392
526
 
@@ -422,7 +556,7 @@ public:
422
556
  {
423
557
  }
424
558
 
425
- virtual const std::string toString() const;
559
+ virtual const std::string toString() const override;
426
560
  };
427
561
 
428
562
 
@@ -513,7 +647,7 @@ public:
513
647
  return ls;
514
648
  }
515
649
 
516
- virtual const std::string toString() const;
650
+ virtual const std::string toString() const override;
517
651
  };
518
652
 
519
653
  /*!
@@ -550,7 +684,7 @@ public:
550
684
  /// constructor
551
685
  VariantGepPE(SVFVar* s, SVFVar* d) : GepPE(s,d,SVFStmt::VariantGep) {}
552
686
 
553
- virtual const std::string toString() const;
687
+ virtual const std::string toString() const override;
554
688
 
555
689
  };
556
690
 
@@ -603,7 +737,7 @@ public:
603
737
  }
604
738
  //@}
605
739
 
606
- virtual const std::string toString() const;
740
+ virtual const std::string toString() const override;
607
741
  };
608
742
 
609
743
 
@@ -655,7 +789,7 @@ public:
655
789
  }
656
790
  //@}
657
791
 
658
- virtual const std::string toString() const;
792
+ virtual const std::string toString() const override;
659
793
  };
660
794
 
661
795
 
@@ -293,16 +293,24 @@ public:
293
293
  return edge;
294
294
  }
295
295
  /// Add Copy edge
296
- inline CmpPE* addCmpEdge(NodeID src, NodeID dst)
296
+ inline PhiPE* addPhiNode(NodeID res, NodeID opnd)
297
297
  {
298
- CmpPE *edge = pag->addCmpPE(src, dst);
298
+ const CopyPE* copy = addCopyEdge(opnd, res);
299
+ PhiPE *edge = pag->addPhiNode(res,opnd);
299
300
  setCurrentBBAndValueForPAGEdge(edge);
300
301
  return edge;
301
302
  }
302
303
  /// Add Copy edge
303
- inline BinaryOPPE* addBinaryOPEdge(NodeID src, NodeID dst)
304
+ inline CmpPE* addCmpEdge(NodeID op1, NodeID op2, NodeID dst)
304
305
  {
305
- BinaryOPPE *edge = pag->addBinaryOPPE(src, dst);
306
+ CmpPE *edge = pag->addCmpPE(op1, op2, dst);
307
+ setCurrentBBAndValueForPAGEdge(edge);
308
+ return edge;
309
+ }
310
+ /// Add Copy edge
311
+ inline BinaryOPPE* addBinaryOPEdge(NodeID op1, NodeID op2, NodeID dst)
312
+ {
313
+ BinaryOPPE *edge = pag->addBinaryOPPE(op1, op2, dst);
306
314
  setCurrentBBAndValueForPAGEdge(edge);
307
315
  return edge;
308
316
  }
@@ -385,8 +393,6 @@ public:
385
393
 
386
394
  };
387
395
 
388
- typedef SVFIRBuilder PAGBuilder;
389
-
390
396
  } // End namespace SVF
391
397
 
392
398
  #endif /* PAGBUILDER_H_ */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svf-lib",
3
- "version": "1.0.733",
3
+ "version": "1.0.737",
4
4
  "description": "SVF's npm support",
5
5
  "main": "index.js",
6
6
  "scripts": {