svf-lib 1.0.2219 → 1.0.2221

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.
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -58,9 +58,9 @@ public:
58
58
  typedef Map<const Function*, FunObjVar*> LLVMFun2FunObjVarMap;
59
59
  typedef Map<const BasicBlock*, SVFBasicBlock*> LLVMBB2SVFBBMap;
60
60
  typedef Map<const Instruction*, SVFInstruction*> LLVMInst2SVFInstMap;
61
- typedef Map<const Argument*, SVFArgument*> LLVMArgument2SVFArgumentMap;
62
- typedef Map<const Constant*, SVFConstant*> LLVMConst2SVFConstMap;
63
- typedef Map<const Value*, SVFOtherValue*> LLVMValue2SVFOtherValueMap;
61
+ typedef Map<const Argument*, SVFLLVMValue*> LLVMArgument2SVFArgumentMap;
62
+ typedef Map<const Constant*, SVFLLVMValue*> LLVMConst2SVFConstMap;
63
+ typedef Map<const Value*, SVFLLVMValue*> LLVMValue2SVFOtherValueMap;
64
64
  typedef Map<const SVFLLVMValue*, const Value*> SVFValue2LLVMValueMap;
65
65
  typedef Map<const SVFValue*, const Value*> SVFBaseNode2LLVMValueMap;
66
66
  typedef Map<const Type*, SVFType*> LLVMType2SVFTypeMap;
@@ -254,12 +254,12 @@ public:
254
254
  addToSVFVar2LLVMValueMap(inst, svfInst);
255
255
  }
256
256
 
257
- inline void addArgumentMap(const Argument* arg, SVFArgument* svfArg)
257
+ inline void addArgumentMap(const Argument* arg, SVFLLVMValue* svfArg)
258
258
  {
259
259
  LLVMArgument2SVFArgument[arg] = svfArg;
260
260
  setValueAttr(arg,svfArg);
261
261
  }
262
- inline void addGlobalValueMap(const GlobalValue* glob, SVFGlobalValue* svfglob)
262
+ inline void addGlobalValueMap(const GlobalValue* glob, SVFLLVMValue* svfglob)
263
263
  {
264
264
  if (auto glob_var = llvm::dyn_cast<llvm::GlobalVariable>(glob);
265
265
  hasGlobalRep(glob_var))
@@ -269,17 +269,17 @@ public:
269
269
  LLVMConst2SVFConst[glob] = svfglob;
270
270
  setValueAttr(glob,svfglob);
271
271
  }
272
- inline void addConstantDataMap(const ConstantData* cd, SVFConstantData* svfcd)
272
+ inline void addConstantDataMap(const ConstantData* cd, SVFLLVMValue* svfcd)
273
273
  {
274
274
  LLVMConst2SVFConst[cd] = svfcd;
275
275
  setValueAttr(cd,svfcd);
276
276
  }
277
- inline void addOtherConstantMap(const Constant* cons, SVFConstant* svfcons)
277
+ inline void addOtherConstantMap(const Constant* cons, SVFLLVMValue* svfcons)
278
278
  {
279
279
  LLVMConst2SVFConst[cons] = svfcons;
280
280
  setValueAttr(cons,svfcons);
281
281
  }
282
- inline void addOtherValueMap(const Value* ov, SVFOtherValue* svfov)
282
+ inline void addOtherValueMap(const Value* ov, SVFLLVMValue* svfov)
283
283
  {
284
284
  LLVMValue2SVFOtherValue[ov] = svfov;
285
285
  setValueAttr(ov,svfov);
@@ -353,14 +353,14 @@ public:
353
353
  return it->second;
354
354
  }
355
355
 
356
- inline SVFArgument* getSVFArgument(const Argument* arg) const
356
+ inline SVFLLVMValue* getSVFArgument(const Argument* arg) const
357
357
  {
358
358
  LLVMArgument2SVFArgumentMap::const_iterator it = LLVMArgument2SVFArgument.find(arg);
359
359
  assert(it!=LLVMArgument2SVFArgument.end() && "SVF Argument not found!");
360
360
  return it->second;
361
361
  }
362
362
 
363
- inline SVFGlobalValue* getSVFGlobalValue(const GlobalValue* g) const
363
+ inline SVFLLVMValue* getSVFGlobalValue(const GlobalValue* g) const
364
364
  {
365
365
  if (auto glob_var = llvm::dyn_cast<llvm::GlobalVariable>(g);
366
366
  hasGlobalRep(glob_var))
@@ -369,14 +369,13 @@ public:
369
369
  }
370
370
  LLVMConst2SVFConstMap::const_iterator it = LLVMConst2SVFConst.find(g);
371
371
  assert(it!=LLVMConst2SVFConst.end() && "SVF Global not found!");
372
- assert(SVFUtil::isa<SVFGlobalValue>(it->second) && "not a SVFGlobal type!");
373
- return SVFUtil::cast<SVFGlobalValue>(it->second);
372
+ return it->second;
374
373
  }
375
374
 
376
- SVFConstantData* getSVFConstantData(const ConstantData* cd);
377
- SVFConstant* getOtherSVFConstant(const Constant* oc);
375
+ SVFLLVMValue* getSVFConstantData(const ConstantData* cd);
376
+ SVFLLVMValue* getOtherSVFConstant(const Constant* oc);
378
377
 
379
- SVFOtherValue* getSVFOtherValue(const Value* ov);
378
+ SVFLLVMValue* getSVFOtherValue(const Value* ov);
380
379
 
381
380
  /// Get the corresponding Function based on its name
382
381
  inline const SVFFunction* getSVFFunction(const std::string& name)
@@ -63,16 +63,7 @@ public:
63
63
  {
64
64
  SVFVal,
65
65
  SVFFunc,
66
- SVFBB,
67
66
  SVFInst,
68
- SVFCall,
69
- SVFVCall,
70
- SVFGlob,
71
- SVFArg,
72
- SVFConst,
73
- SVFConstData,
74
- SVFMetaAsValue,
75
- SVFOther
76
67
  };
77
68
 
78
69
  private:
@@ -85,9 +76,9 @@ protected:
85
76
  std::string name; ///< Short name of value for printing & debugging
86
77
  std::string sourceLoc; ///< Source code information of this value
87
78
  /// Constructor without name
88
- SVFLLVMValue(const SVFType* ty, SVFValKind k)
79
+ SVFLLVMValue(const SVFType* ty, SVFValKind k = SVFVal)
89
80
  : kind(k), ptrInUncalledFun(false),
90
- constDataOrAggData(SVFConstData == k), type(ty), sourceLoc("NoLoc")
81
+ constDataOrAggData(false), type(ty), sourceLoc("NoLoc")
91
82
  {
92
83
  }
93
84
 
@@ -405,9 +396,7 @@ public:
405
396
 
406
397
  static inline bool classof(const SVFLLVMValue *node)
407
398
  {
408
- return node->getKind() == SVFInst ||
409
- node->getKind() == SVFCall ||
410
- node->getKind() == SVFVCall;
399
+ return node->getKind() == SVFInst;
411
400
  }
412
401
 
413
402
  inline const SVFBasicBlock* getParent() const
@@ -426,242 +415,6 @@ public:
426
415
  }
427
416
  };
428
417
 
429
- class SVFCallInst : public SVFInstruction
430
- {
431
- friend class SVFIRWriter;
432
- friend class SVFIRReader;
433
- friend class LLVMModuleSet;
434
- friend class SVFIRBuilder;
435
-
436
- private:
437
- std::vector<const SVFLLVMValue*> args;
438
- bool varArg;
439
- const SVFLLVMValue* calledVal;
440
-
441
- protected:
442
- ///@{ attributes to be set only through Module builders e.g., LLVMModule
443
- inline void addArgument(const SVFLLVMValue* a)
444
- {
445
- args.push_back(a);
446
- }
447
- inline void setCalledOperand(const SVFLLVMValue* v)
448
- {
449
- calledVal = v;
450
- }
451
- /// @}
452
-
453
- public:
454
- SVFCallInst(const SVFType* ty, const SVFBasicBlock* b, bool va, bool tm, SVFValKind k = SVFCall) :
455
- SVFInstruction(ty, b, tm, false, k), varArg(va), calledVal(nullptr)
456
- {
457
- }
458
- SVFCallInst(void) = delete;
459
-
460
- static inline bool classof(const SVFLLVMValue *node)
461
- {
462
- return node->getKind() == SVFCall || node->getKind() == SVFVCall;
463
- }
464
- static inline bool classof(const SVFInstruction *node)
465
- {
466
- return node->getKind() == SVFCall || node->getKind() == SVFVCall;
467
- }
468
- inline u32_t arg_size() const
469
- {
470
- return args.size();
471
- }
472
- inline bool arg_empty() const
473
- {
474
- return args.empty();
475
- }
476
- inline const SVFLLVMValue* getArgOperand(u32_t i) const
477
- {
478
- assert(i < arg_size() && "out of bound access of the argument");
479
- return args[i];
480
- }
481
- inline u32_t getNumArgOperands() const
482
- {
483
- return arg_size();
484
- }
485
- inline const SVFLLVMValue* getCalledOperand() const
486
- {
487
- return calledVal;
488
- }
489
- inline bool isVarArg() const
490
- {
491
- return varArg;
492
- }
493
- inline const SVFFunction* getCalledFunction() const
494
- {
495
- return SVFUtil::dyn_cast<SVFFunction>(calledVal);
496
- }
497
- inline const FunObjVar* getCaller() const
498
- {
499
- return getFunction();
500
- }
501
- };
502
-
503
- class SVFConstant : public SVFLLVMValue
504
- {
505
- friend class SVFIRWriter;
506
- friend class SVFIRReader;
507
- public:
508
- SVFConstant(const SVFType* ty, SVFValKind k = SVFConst): SVFLLVMValue(ty, k)
509
- {
510
- }
511
- SVFConstant() = delete;
512
-
513
- static inline bool classof(const SVFLLVMValue *node)
514
- {
515
- return node->getKind() == SVFConst ||
516
- node->getKind() == SVFGlob ||
517
- node->getKind() == SVFConstData;
518
- }
519
-
520
- };
521
-
522
- class SVFGlobalValue : public SVFConstant
523
- {
524
- friend class SVFIRWriter;
525
- friend class SVFIRReader;
526
- friend class LLVMModuleSet;
527
-
528
- private:
529
- const SVFLLVMValue* realDefGlobal; /// the definition of a function across multiple modules
530
-
531
- protected:
532
- inline void setDefGlobalForMultipleModule(const SVFLLVMValue* defg)
533
- {
534
- realDefGlobal = defg;
535
- }
536
-
537
- public:
538
- SVFGlobalValue(const SVFType* ty): SVFConstant(ty, SVFLLVMValue::SVFGlob), realDefGlobal(nullptr)
539
- {
540
- }
541
- SVFGlobalValue(std::string&& name, const SVFType* ty) : SVFGlobalValue(ty)
542
- {
543
- setName(std::move(name));
544
- }
545
- SVFGlobalValue() = delete;
546
-
547
- inline const SVFLLVMValue* getDefGlobalForMultipleModule() const
548
- {
549
- if(realDefGlobal==nullptr)
550
- return this;
551
- return realDefGlobal;
552
- }
553
- static inline bool classof(const SVFLLVMValue *node)
554
- {
555
- return node->getKind() == SVFGlob;
556
- }
557
- static inline bool classof(const SVFConstant *node)
558
- {
559
- return node->getKind() == SVFGlob;
560
- }
561
- };
562
-
563
- class SVFArgument : public SVFLLVMValue
564
- {
565
- friend class SVFIRWriter;
566
- friend class SVFIRReader;
567
- private:
568
- const SVFFunction* fun;
569
- u32_t argNo;
570
- bool uncalled;
571
- public:
572
- SVFArgument(const SVFType* ty, const SVFFunction* fun, u32_t argNo,
573
- bool uncalled)
574
- : SVFLLVMValue(ty, SVFLLVMValue::SVFArg), fun(fun), argNo(argNo),
575
- uncalled(uncalled)
576
- {
577
- }
578
- SVFArgument() = delete;
579
-
580
- inline const SVFFunction* getParent() const
581
- {
582
- return fun;
583
- }
584
-
585
- /// Return the index of this formal argument in its containing function.
586
- /// For example in "void foo(int a, float b)" a is 0 and b is 1.
587
- inline u32_t getArgNo() const
588
- {
589
- return argNo;
590
- }
591
-
592
- inline bool isArgOfUncalledFunction() const
593
- {
594
- return uncalled;
595
- }
596
-
597
- static inline bool classof(const SVFLLVMValue *node)
598
- {
599
- return node->getKind() == SVFArg;
600
- }
601
- };
602
-
603
- class SVFConstantData : public SVFConstant
604
- {
605
- friend class SVFIRWriter;
606
- friend class SVFIRReader;
607
- public:
608
- SVFConstantData(const SVFType* ty, SVFValKind k = SVFConstData)
609
- : SVFConstant(ty, k)
610
- {
611
- }
612
- SVFConstantData() = delete;
613
-
614
- static inline bool classof(const SVFLLVMValue *node)
615
- {
616
- return node->getKind() == SVFConstData;
617
- }
618
- static inline bool classof(const SVFConstantData *node)
619
- {
620
- return node->getKind() == SVFConstData;
621
- }
622
- };
623
-
624
- class SVFOtherValue : public SVFLLVMValue
625
- {
626
- friend class SVFIRWriter;
627
- friend class SVFIRReader;
628
- public:
629
- SVFOtherValue(const SVFType* ty, SVFValKind k = SVFLLVMValue::SVFOther)
630
- : SVFLLVMValue(ty, k)
631
- {
632
- }
633
- SVFOtherValue() = delete;
634
-
635
- static inline bool classof(const SVFLLVMValue *node)
636
- {
637
- return node->getKind() == SVFOther || node->getKind() == SVFMetaAsValue;
638
- }
639
- };
640
-
641
- /*
642
- * This class is only for LLVM's MetadataAsValue
643
- */
644
- class SVFMetadataAsValue : public SVFOtherValue
645
- {
646
- friend class SVFIRWriter;
647
- friend class SVFIRReader;
648
- public:
649
- SVFMetadataAsValue(const SVFType* ty)
650
- : SVFOtherValue(ty, SVFLLVMValue::SVFMetaAsValue)
651
- {
652
- }
653
- SVFMetadataAsValue() = delete;
654
-
655
- static inline bool classof(const SVFLLVMValue *node)
656
- {
657
- return node->getKind() == SVFMetaAsValue;
658
- }
659
- static inline bool classof(const SVFOtherValue *node)
660
- {
661
- return node->getKind() == SVFMetaAsValue;
662
- }
663
- };
664
-
665
418
 
666
419
  /// [FOR DEBUG ONLY, DON'T USE IT UNSIDE `svf`!]
667
420
  /// Converts an SVFValue to corresponding LLVM::Value, then get the string
@@ -44,10 +44,10 @@ class SVFModule
44
44
 
45
45
  public:
46
46
  typedef std::vector<const SVFFunction*> FunctionSetType;
47
- typedef std::vector<SVFGlobalValue*> GlobalSetType;
48
- typedef std::vector<SVFGlobalValue*> AliasSetType;
49
- typedef std::vector<SVFConstant*> ConstantType;
50
- typedef std::vector<SVFOtherValue*> OtherValueType;
47
+ typedef std::vector<SVFLLVMValue*> GlobalSetType;
48
+ typedef std::vector<SVFLLVMValue*> AliasSetType;
49
+ typedef std::vector<SVFLLVMValue*> ConstantType;
50
+ typedef std::vector<SVFLLVMValue*> OtherValueType;
51
51
 
52
52
  /// Iterators type def
53
53
  typedef FunctionSetType::iterator iterator;
@@ -86,21 +86,19 @@ public:
86
86
  {
87
87
  FunctionSet.push_back(svfFunc);
88
88
  }
89
- inline void addGlobalSet(SVFGlobalValue* glob)
89
+ inline void addGlobalSet(SVFLLVMValue* glob)
90
90
  {
91
91
  GlobalSet.push_back(glob);
92
- addConstant(glob);
93
92
  }
94
- inline void addAliasSet(SVFGlobalValue* alias)
93
+ inline void addAliasSet(SVFLLVMValue* alias)
95
94
  {
96
95
  AliasSet.push_back(alias);
97
- addConstant(alias);
98
96
  }
99
- inline void addConstant(SVFConstant* cd)
97
+ inline void addConstant(SVFLLVMValue* cd)
100
98
  {
101
99
  ConstantSet.push_back(cd);
102
100
  }
103
- inline void addOtherValue(SVFOtherValue* ov)
101
+ inline void addOtherValue(SVFLLVMValue* ov)
104
102
  {
105
103
  OtherValueSet.push_back(ov);
106
104
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svf-lib",
3
- "version": "1.0.2219",
3
+ "version": "1.0.2221",
4
4
  "description": "SVF's npm support",
5
5
  "main": "index.js",
6
6
  "scripts": {