svf-lib 1.0.947 → 1.0.950

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 (30) hide show
  1. package/SVF-linux/Release-build/lib/libSvf.a +0 -0
  2. package/SVF-linux/include/DDA/DDAPass.h +0 -6
  3. package/SVF-linux/include/Graphs/VFGNode.h +4 -18
  4. package/SVF-linux/include/MemoryModel/PointerAnalysis.h +0 -4
  5. package/SVF-linux/include/MemoryModel/PointerAnalysisImpl.h +0 -10
  6. package/SVF-linux/include/MemoryModel/SVFVariables.h +4 -4
  7. package/SVF-linux/include/MemoryModel/SymbolTableInfo.h +0 -11
  8. package/SVF-linux/include/SABER/PathCondAllocator.h +1 -0
  9. package/SVF-linux/include/SVF-FE/BasicTypes.h +41 -2
  10. package/SVF-linux/include/SVF-FE/LLVMUtil.h +7 -0
  11. package/SVF-linux/include/Util/BasicTypes.h +0 -35
  12. package/SVF-linux/include/Util/SVFBasicTypes.h +6 -27
  13. package/SVF-linux/include/Util/SVFUtil.h +1 -1
  14. package/SVF-linux/include/WPA/WPAPass.h +0 -6
  15. package/SVF-osx/Release-build/lib/CUDD/libCudd.a +0 -0
  16. package/SVF-osx/Release-build/lib/libSvf.a +0 -0
  17. package/SVF-osx/include/DDA/DDAPass.h +0 -6
  18. package/SVF-osx/include/Graphs/VFGNode.h +4 -18
  19. package/SVF-osx/include/MemoryModel/PointerAnalysis.h +0 -4
  20. package/SVF-osx/include/MemoryModel/PointerAnalysisImpl.h +0 -10
  21. package/SVF-osx/include/MemoryModel/SVFVariables.h +4 -4
  22. package/SVF-osx/include/MemoryModel/SymbolTableInfo.h +0 -11
  23. package/SVF-osx/include/SABER/PathCondAllocator.h +1 -0
  24. package/SVF-osx/include/SVF-FE/BasicTypes.h +41 -2
  25. package/SVF-osx/include/SVF-FE/LLVMUtil.h +7 -0
  26. package/SVF-osx/include/Util/BasicTypes.h +0 -35
  27. package/SVF-osx/include/Util/SVFBasicTypes.h +6 -27
  28. package/SVF-osx/include/Util/SVFUtil.h +1 -1
  29. package/SVF-osx/include/WPA/WPAPass.h +0 -6
  30. package/package.json +1 -1
@@ -34,12 +34,6 @@ public:
34
34
  DDAPass() : _pta(nullptr), _client(nullptr) {}
35
35
  ~DDAPass();
36
36
 
37
- /// Interface expose to users of our pointer analysis, given Location infos
38
- virtual inline AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB)
39
- {
40
- return alias(LocA.Ptr, LocB.Ptr);
41
- }
42
-
43
37
  /// Interface expose to users of our pointer analysis, given Value infos
44
38
  virtual AliasResult alias(const Value* V1, const Value* V2);
45
39
 
@@ -336,11 +336,7 @@ private:
336
336
 
337
337
  public:
338
338
  /// Constructor
339
- CmpVFGNode(NodeID id,const PAGNode* r): VFGNode(id,Cmp), res(r)
340
- {
341
- const CmpInst* cmp = SVFUtil::dyn_cast<CmpInst>(r->getValue());
342
- assert(cmp && "not a compare operator?");
343
- }
339
+ CmpVFGNode(NodeID id,const PAGNode* r): VFGNode(id,Cmp), res(r) { }
344
340
  /// Methods for support type inquiry through isa, cast, and dyn_cast:
345
341
  //@{
346
342
  static inline bool classof(const CmpVFGNode *)
@@ -411,11 +407,7 @@ private:
411
407
 
412
408
  public:
413
409
  /// Constructor
414
- BinaryOPVFGNode(NodeID id,const PAGNode* r): VFGNode(id,BinaryOp), res(r)
415
- {
416
- const BinaryOperator* binary = SVFUtil::dyn_cast<BinaryOperator>(r->getValue());
417
- assert(binary && "not a binary operator?");
418
- }
410
+ BinaryOPVFGNode(NodeID id,const PAGNode* r): VFGNode(id,BinaryOp), res(r) { }
419
411
  /// Methods for support type inquiry through isa, cast, and dyn_cast:
420
412
  //@{
421
413
  static inline bool classof(const BinaryOPVFGNode *)
@@ -485,10 +477,7 @@ private:
485
477
 
486
478
  public:
487
479
  /// Constructor
488
- UnaryOPVFGNode(NodeID id, const PAGNode *r) : VFGNode(id, UnaryOp), res(r) {
489
- const Value *val = r->getValue();
490
- assert(SVFUtil::isa<UnaryOperator>(val) && "not a unary instruction ?");
491
- }
480
+ UnaryOPVFGNode(NodeID id, const PAGNode *r) : VFGNode(id, UnaryOp), res(r) { }
492
481
  /// Methods for support type inquiry through isa, cast, and dyn_cast:
493
482
  //@{
494
483
  static inline bool classof(const UnaryOPVFGNode *)
@@ -556,10 +545,7 @@ private:
556
545
  const BranchStmt* brstmt;
557
546
  public:
558
547
  /// Constructor
559
- BranchVFGNode(NodeID id, const BranchStmt* r) : VFGNode(id, Branch), brstmt(r) {
560
- const Value *val = r->getValue();
561
- assert((SVFUtil::isa<BranchInst>(val) || SVFUtil::isa<SwitchInst>(val)) && "not a BranchInst or a SwitchInst?");
562
- }
548
+ BranchVFGNode(NodeID id, const BranchStmt* r) : VFGNode(id, Branch), brstmt(r) { }
563
549
  /// Methods for support type inquiry through isa, cast, and dyn_cast:
564
550
  //@{
565
551
  static inline bool classof(const BranchVFGNode *)
@@ -239,10 +239,6 @@ public:
239
239
  /// Compute points-to results on-demand, overridden by derived classes
240
240
  virtual void computeDDAPts(NodeID) {}
241
241
 
242
- /// Interface exposed to users of our pointer analysis, given Location infos
243
- virtual AliasResult alias(const MemoryLocation &LocA,
244
- const MemoryLocation &LocB) = 0;
245
-
246
242
  /// Interface exposed to users of our pointer analysis, given Value infos
247
243
  virtual AliasResult alias(const Value* V1,
248
244
  const Value* V2) = 0;
@@ -217,10 +217,6 @@ private:
217
217
  PersistentPointsToCache<PointsTo> ptCache;
218
218
 
219
219
  public:
220
- /// Interface expose to users of our pointer analysis, given Location infos
221
- virtual AliasResult alias(const MemoryLocation &LocA,
222
- const MemoryLocation &LocB);
223
-
224
220
  /// Interface expose to users of our pointer analysis, given Value infos
225
221
  virtual AliasResult alias(const Value* V1,
226
222
  const Value* V2);
@@ -507,12 +503,6 @@ public:
507
503
  return objToNSRevPtsMap[obj];
508
504
  }
509
505
 
510
- /// Interface expose to users of our pointer analysis, given Location infos
511
- virtual inline AliasResult alias(const MemoryLocation &LocA,
512
- const MemoryLocation &LocB)
513
- {
514
- return alias(LocA.Ptr, LocB.Ptr);
515
- }
516
506
  /// Interface expose to users of our pointer analysis, given Value infos
517
507
  virtual inline AliasResult alias(const Value* V1, const Value* V2)
518
508
  {
@@ -422,8 +422,8 @@ public:
422
422
  inline const std::string getValueName() const
423
423
  {
424
424
  if (value && value->hasName())
425
- return value->getName().str() + "_" + llvm::utostr(getConstantFieldIdx());
426
- return "offset_" + llvm::utostr(getConstantFieldIdx());
425
+ return value->getName().str() + "_" + std::to_string(getConstantFieldIdx());
426
+ return "offset_" + std::to_string(getConstantFieldIdx());
427
427
  }
428
428
 
429
429
  inline const Type* getType() const
@@ -510,8 +510,8 @@ public:
510
510
  inline const std::string getValueName() const
511
511
  {
512
512
  if (value && value->hasName())
513
- return value->getName().str() + "_" + llvm::itostr(ls.accumulateConstantFieldIdx());
514
- return "offset_" + llvm::itostr(ls.accumulateConstantFieldIdx());
513
+ return value->getName().str() + "_" + std::to_string(ls.accumulateConstantFieldIdx());
514
+ return "offset_" + std::to_string(ls.accumulateConstantFieldIdx());
515
515
  }
516
516
 
517
517
  virtual const std::string toString() const;
@@ -81,9 +81,6 @@ public:
81
81
  //@}
82
82
 
83
83
  private:
84
- /// Data layout on a target machine
85
- static DataLayout *dl;
86
-
87
84
  ValueToIDMapTy valSymMap; ///< map a value to its sym id
88
85
  ValueToIDMapTy objSymMap; ///< map a obj reference to its sym id
89
86
  FunToIDMapTy returnSymMap; ///< return map
@@ -162,14 +159,6 @@ public:
162
159
  mod = m;
163
160
  }
164
161
 
165
- /// Get target machine data layout
166
- inline static DataLayout* getDataLayout(Module* mod)
167
- {
168
- if(dl==nullptr)
169
- return dl = new DataLayout(mod);
170
- return dl;
171
- }
172
-
173
162
  /// special value
174
163
  // @{
175
164
  static bool isNullPtrSym(const Value *val);
@@ -32,6 +32,7 @@
32
32
 
33
33
  #include "Util/SVFModule.h"
34
34
  #include "SVF-FE/DataFlowUtil.h"
35
+ #include "SVF-FE/BasicTypes.h"
35
36
  #include "Util/Conditions.h"
36
37
  #include "Util/WorkList.h"
37
38
  #include "Graphs/SVFG.h"
@@ -2,18 +2,57 @@
2
2
  #define SVF_FE_BASIC_TYPES_H
3
3
 
4
4
  #include <llvm/IR/Instructions.h>
5
+ #include <llvm/IR/IntrinsicInst.h>
5
6
  #include <llvm/IR/Metadata.h>
7
+ #include <llvm/IR/DataLayout.h>
8
+
9
+ #include <llvm/Analysis/MemoryLocation.h>
6
10
 
7
11
  #include <llvm/Support/SourceMgr.h>
8
12
 
9
13
  typedef llvm::SMDiagnostic SMDiagnostic;
10
14
 
11
- typedef llvm::ExtractValueInst ExtractValueInst;
12
- typedef llvm::ExtractElementInst ExtractElementInst;
13
15
  typedef llvm::MetadataAsValue MetadataAsValue;
14
16
  typedef llvm::BlockAddress BlockAddress;
15
17
 
18
+ // LLVM data layout
19
+ typedef llvm::StructLayout StructLayout;
20
+ typedef llvm::ConstantStruct ConstantStruct;
21
+ typedef llvm::MemoryLocation MemoryLocation;
22
+
23
+ // LLVM Aliases and constants
16
24
  typedef llvm::ConstantAggregate ConstantAggregate;
17
25
  typedef llvm::ConstantAggregateZero ConstantAggregateZero;
26
+ typedef llvm::ConstantDataSequential ConstantDataSequential;
27
+ typedef llvm::ConstantExpr ConstantExpr;
28
+
29
+ // LLVM Instructions
30
+ typedef llvm::AtomicCmpXchgInst AtomicCmpXchgInst;
31
+ typedef llvm::AtomicRMWInst AtomicRMWInst;
32
+ typedef llvm::BitCastInst BitCastInst;
33
+ typedef llvm::CallBrInst CallBrInst;
34
+ typedef llvm::CastInst CastInst;
35
+ typedef llvm::CmpInst CmpInst;
36
+ typedef llvm::ExtractValueInst ExtractValueInst;
37
+ typedef llvm::ExtractElementInst ExtractElementInst;
38
+ typedef llvm::GetElementPtrInst GetElementPtrInst;
39
+ typedef llvm::InvokeInst InvokeInst;
40
+ typedef llvm::ShuffleVectorInst ShuffleVectorInst;
41
+ typedef llvm::PHINode PHINode;
42
+ typedef llvm::IntToPtrInst IntToPtrInst;
43
+ typedef llvm::InsertValueInst InsertValueInst;
44
+ typedef llvm::FenceInst FenceInst;
45
+ typedef llvm::FreezeInst FreezeInst;
46
+ typedef llvm::UnreachableInst UnreachableInst;
47
+ typedef llvm::InsertElementInst InsertElementInst;
48
+ typedef llvm::LandingPadInst LandingPadInst;
49
+ typedef llvm::ResumeInst ResumeInst;
50
+ typedef llvm::SelectInst SelectInst;
51
+ typedef llvm::VAArgInst VAArgInst;
52
+ typedef llvm::VACopyInst VACopyInst;
53
+ typedef llvm::VAEndInst VAEndInst;
54
+ typedef llvm::VAStartInst VAStartInst;
55
+ typedef llvm::BinaryOperator BinaryOperator;
56
+ typedef llvm::UnaryOperator UnaryOperator;
18
57
 
19
58
  #endif // SVF_FE_BASIC_TYPES_H
@@ -617,6 +617,13 @@ inline const ConstantExpr *isUnaryConstantExpr(const Value *val)
617
617
  }
618
618
  //@}
619
619
 
620
+ inline static DataLayout* getDataLayout(Module* mod)
621
+ {
622
+ static DataLayout *dl = nullptr;
623
+ if (dl == nullptr) dl = new DataLayout(mod);
624
+ return dl;
625
+ }
626
+
620
627
  /// Get the next instructions following control flow
621
628
  void getNextInsts(const Instruction* curInst, std::vector<const Instruction*>& instList);
622
629
 
@@ -34,7 +34,6 @@
34
34
  #include "SVF-FE/GEPTypeBridgeIterator.h"
35
35
  #include "Graphs/GraphPrinter.h"
36
36
  #include "Util/Casting.h"
37
- #include <llvm/ADT/SmallVector.h> // for small vector
38
37
  #include <llvm/ADT/SparseBitVector.h>
39
38
  #include <llvm/IR/Instructions.h>
40
39
  #include <llvm/IR/InstVisitor.h> // for instruction visitor
@@ -106,20 +105,12 @@ typedef llvm::VectorType VectorType;
106
105
 
107
106
  /// LLVM data layout
108
107
  typedef llvm::DataLayout DataLayout;
109
- typedef llvm::StructLayout StructLayout;
110
- typedef llvm::SmallVector<BasicBlock*, 8> SmallBBVector;
111
- typedef llvm::ConstantStruct ConstantStruct;
112
- typedef llvm::MemoryLocation MemoryLocation;
113
108
 
114
109
  /// LLVM Aliases and constants
115
110
  typedef llvm::Argument Argument;
116
111
  typedef llvm::Constant Constant;
117
112
  typedef llvm::ConstantData ConstantData;
118
- typedef llvm::ConstantDataSequential ConstantDataSequential;
119
113
  typedef llvm::ConstantInt ConstantInt;
120
- typedef llvm::ConstantFP ConstantFP;
121
- typedef llvm::ConstantTokenNone ConstantTokenNone;
122
- typedef llvm::ConstantExpr ConstantExpr;
123
114
  typedef llvm::ConstantPointerNull ConstantPointerNull;
124
115
  typedef llvm::ConstantArray ConstantArray;
125
116
  typedef llvm::GlobalAlias GlobalAlias;
@@ -134,38 +125,12 @@ typedef llvm::MDNode MDNode;
134
125
  /// LLVM Instructions
135
126
  typedef llvm::AllocaInst AllocaInst;
136
127
  typedef llvm::CallInst CallInst;
137
- typedef llvm::InvokeInst InvokeInst;
138
- typedef llvm::CallBrInst CallBrInst;
139
128
  typedef llvm::StoreInst StoreInst;
140
129
  typedef llvm::LoadInst LoadInst;
141
- typedef llvm::PHINode PHINode;
142
- typedef llvm::GetElementPtrInst GetElementPtrInst;
143
- typedef llvm::CastInst CastInst;
144
- typedef llvm::BitCastInst BitCastInst;
145
130
  typedef llvm::ReturnInst ReturnInst;
146
- typedef llvm::SelectInst SelectInst;
147
- typedef llvm::IntToPtrInst IntToPtrInst;
148
- typedef llvm::CmpInst CmpInst;
149
131
  typedef llvm::BranchInst BranchInst;
150
132
  typedef llvm::SwitchInst SwitchInst;
151
- typedef llvm::InsertValueInst InsertValueInst;
152
- typedef llvm::BinaryOperator BinaryOperator;
153
- typedef llvm::UnaryOperator UnaryOperator;
154
- typedef llvm::PtrToIntInst PtrToIntInst;
155
- typedef llvm::VAArgInst VAArgInst;
156
- typedef llvm::InsertElementInst InsertElementInst;
157
- typedef llvm::ShuffleVectorInst ShuffleVectorInst;
158
- typedef llvm::LandingPadInst LandingPadInst;
159
- typedef llvm::ResumeInst ResumeInst;
160
- typedef llvm::UnreachableInst UnreachableInst;
161
- typedef llvm::FenceInst FenceInst;
162
- typedef llvm::AtomicCmpXchgInst AtomicCmpXchgInst;
163
- typedef llvm::AtomicRMWInst AtomicRMWInst;
164
133
  typedef llvm::UndefValue UndefValue;
165
- typedef llvm::VACopyInst VACopyInst;
166
- typedef llvm::VAEndInst VAEndInst;
167
- typedef llvm::VAStartInst VAStartInst;
168
- typedef llvm::FreezeInst FreezeInst;
169
134
 
170
135
  #if (LLVM_VERSION_MAJOR >= 9)
171
136
  typedef llvm::FunctionCallee FunctionCallee;
@@ -31,6 +31,10 @@
31
31
  #ifndef INCLUDE_UTIL_SVFBASICTYPES_H_
32
32
  #define INCLUDE_UTIL_SVFBASICTYPES_H_
33
33
 
34
+ // TODO: these are just for SmallBBVector.
35
+ #include <llvm/IR/BasicBlock.h>
36
+ #include <llvm/ADT/SmallVector.h>
37
+
34
38
  #include <llvm/ADT/SparseBitVector.h> // for points-to
35
39
  #include <llvm/Support/CommandLine.h> // for command line options
36
40
  #include <llvm/ADT/StringMap.h> // for StringMap
@@ -108,9 +112,7 @@ template<typename Key, typename Value, typename Compare = std::less<Key>,
108
112
  typename Allocator = std::allocator<std::pair<const Key, Value>>>
109
113
  using OrderedMap = std::map<Key, Value, Compare, Allocator>;
110
114
 
111
- template <typename T, unsigned N>
112
- using SmallVector = llvm::SmallVector<T, N>;
113
-
115
+ typedef llvm::SmallVector<llvm::BasicBlock*, 8> SmallBBVector;
114
116
  typedef std::pair<NodeID, NodeID> NodePair;
115
117
  typedef OrderedSet<NodeID> OrderedNodeSet;
116
118
  typedef Set<NodeID> NodeSet;
@@ -121,10 +123,8 @@ typedef std::vector<EdgeID> EdgeVector;
121
123
  typedef std::stack<NodeID> NodeStack;
122
124
  typedef std::list<NodeID> NodeList;
123
125
  typedef std::deque<NodeID> NodeDeque;
124
- typedef SmallVector<u32_t,16> SmallVector16;
125
- typedef SmallVector<u32_t,8> SmallVector8;
126
126
  typedef NodeSet EdgeSet;
127
- typedef SmallVector16 CallStrCxt;
127
+ typedef std::vector<u32_t> CallStrCxt;
128
128
  typedef llvm::StringMap<u32_t> StringMap;
129
129
 
130
130
  typedef unsigned Version;
@@ -290,27 +290,6 @@ template <> struct std::hash<SVF::NodePair> {
290
290
  }
291
291
  };
292
292
 
293
- /// Specialise hash for SmallVectors.
294
- template <typename T, unsigned N>
295
- struct std::hash<SVF::SmallVector<T, N>>
296
- {
297
- size_t operator()(const SVF::SmallVector<T, N> &sv) const {
298
- if (sv.empty()) return 0;
299
- if (sv.size() == 1) return sv[0];
300
-
301
- // Iterate and accumulate the hash.
302
- size_t hash = 0;
303
- SVF::Hash<std::pair<T, size_t>> hts;
304
- std::hash<T> ht;
305
- for (const T &t : sv)
306
- {
307
- hash = hts(std::make_pair(ht(t), hash));
308
- }
309
-
310
- return hash;
311
- }
312
- };
313
-
314
293
  /// Specialise hash for SparseBitVectors.
315
294
  template <unsigned N>
316
295
  struct std::hash<llvm::SparseBitVector<N>>
@@ -192,7 +192,7 @@ inline bool isIntrinsicInst(const Instruction* inst)
192
192
  /// Whether an instruction is a call or invoke instruction
193
193
  inline bool isCallSite(const Instruction* inst)
194
194
  {
195
- return SVFUtil::isa<CallInst>(inst) || SVFUtil::isa<InvokeInst>(inst) || SVFUtil::isa<CallBrInst>(inst);
195
+ return SVFUtil::isa<CallBase>(inst);
196
196
  }
197
197
  /// Whether an instruction is a call or invoke instruction
198
198
  inline bool isCallSite(const Value* val)
@@ -75,12 +75,6 @@ public:
75
75
  /// Destructor
76
76
  virtual ~WPAPass();
77
77
 
78
- /// Interface expose to users of our pointer analysis, given Location infos
79
- virtual inline AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB)
80
- {
81
- return alias(LocA.Ptr, LocB.Ptr);
82
- }
83
-
84
78
  /// Interface expose to users of our pointer analysis, given Value infos
85
79
  virtual AliasResult alias(const Value* V1, const Value* V2);
86
80
 
Binary file
@@ -34,12 +34,6 @@ public:
34
34
  DDAPass() : _pta(nullptr), _client(nullptr) {}
35
35
  ~DDAPass();
36
36
 
37
- /// Interface expose to users of our pointer analysis, given Location infos
38
- virtual inline AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB)
39
- {
40
- return alias(LocA.Ptr, LocB.Ptr);
41
- }
42
-
43
37
  /// Interface expose to users of our pointer analysis, given Value infos
44
38
  virtual AliasResult alias(const Value* V1, const Value* V2);
45
39
 
@@ -336,11 +336,7 @@ private:
336
336
 
337
337
  public:
338
338
  /// Constructor
339
- CmpVFGNode(NodeID id,const PAGNode* r): VFGNode(id,Cmp), res(r)
340
- {
341
- const CmpInst* cmp = SVFUtil::dyn_cast<CmpInst>(r->getValue());
342
- assert(cmp && "not a compare operator?");
343
- }
339
+ CmpVFGNode(NodeID id,const PAGNode* r): VFGNode(id,Cmp), res(r) { }
344
340
  /// Methods for support type inquiry through isa, cast, and dyn_cast:
345
341
  //@{
346
342
  static inline bool classof(const CmpVFGNode *)
@@ -411,11 +407,7 @@ private:
411
407
 
412
408
  public:
413
409
  /// Constructor
414
- BinaryOPVFGNode(NodeID id,const PAGNode* r): VFGNode(id,BinaryOp), res(r)
415
- {
416
- const BinaryOperator* binary = SVFUtil::dyn_cast<BinaryOperator>(r->getValue());
417
- assert(binary && "not a binary operator?");
418
- }
410
+ BinaryOPVFGNode(NodeID id,const PAGNode* r): VFGNode(id,BinaryOp), res(r) { }
419
411
  /// Methods for support type inquiry through isa, cast, and dyn_cast:
420
412
  //@{
421
413
  static inline bool classof(const BinaryOPVFGNode *)
@@ -485,10 +477,7 @@ private:
485
477
 
486
478
  public:
487
479
  /// Constructor
488
- UnaryOPVFGNode(NodeID id, const PAGNode *r) : VFGNode(id, UnaryOp), res(r) {
489
- const Value *val = r->getValue();
490
- assert(SVFUtil::isa<UnaryOperator>(val) && "not a unary instruction ?");
491
- }
480
+ UnaryOPVFGNode(NodeID id, const PAGNode *r) : VFGNode(id, UnaryOp), res(r) { }
492
481
  /// Methods for support type inquiry through isa, cast, and dyn_cast:
493
482
  //@{
494
483
  static inline bool classof(const UnaryOPVFGNode *)
@@ -556,10 +545,7 @@ private:
556
545
  const BranchStmt* brstmt;
557
546
  public:
558
547
  /// Constructor
559
- BranchVFGNode(NodeID id, const BranchStmt* r) : VFGNode(id, Branch), brstmt(r) {
560
- const Value *val = r->getValue();
561
- assert((SVFUtil::isa<BranchInst>(val) || SVFUtil::isa<SwitchInst>(val)) && "not a BranchInst or a SwitchInst?");
562
- }
548
+ BranchVFGNode(NodeID id, const BranchStmt* r) : VFGNode(id, Branch), brstmt(r) { }
563
549
  /// Methods for support type inquiry through isa, cast, and dyn_cast:
564
550
  //@{
565
551
  static inline bool classof(const BranchVFGNode *)
@@ -239,10 +239,6 @@ public:
239
239
  /// Compute points-to results on-demand, overridden by derived classes
240
240
  virtual void computeDDAPts(NodeID) {}
241
241
 
242
- /// Interface exposed to users of our pointer analysis, given Location infos
243
- virtual AliasResult alias(const MemoryLocation &LocA,
244
- const MemoryLocation &LocB) = 0;
245
-
246
242
  /// Interface exposed to users of our pointer analysis, given Value infos
247
243
  virtual AliasResult alias(const Value* V1,
248
244
  const Value* V2) = 0;
@@ -217,10 +217,6 @@ private:
217
217
  PersistentPointsToCache<PointsTo> ptCache;
218
218
 
219
219
  public:
220
- /// Interface expose to users of our pointer analysis, given Location infos
221
- virtual AliasResult alias(const MemoryLocation &LocA,
222
- const MemoryLocation &LocB);
223
-
224
220
  /// Interface expose to users of our pointer analysis, given Value infos
225
221
  virtual AliasResult alias(const Value* V1,
226
222
  const Value* V2);
@@ -507,12 +503,6 @@ public:
507
503
  return objToNSRevPtsMap[obj];
508
504
  }
509
505
 
510
- /// Interface expose to users of our pointer analysis, given Location infos
511
- virtual inline AliasResult alias(const MemoryLocation &LocA,
512
- const MemoryLocation &LocB)
513
- {
514
- return alias(LocA.Ptr, LocB.Ptr);
515
- }
516
506
  /// Interface expose to users of our pointer analysis, given Value infos
517
507
  virtual inline AliasResult alias(const Value* V1, const Value* V2)
518
508
  {
@@ -422,8 +422,8 @@ public:
422
422
  inline const std::string getValueName() const
423
423
  {
424
424
  if (value && value->hasName())
425
- return value->getName().str() + "_" + llvm::utostr(getConstantFieldIdx());
426
- return "offset_" + llvm::utostr(getConstantFieldIdx());
425
+ return value->getName().str() + "_" + std::to_string(getConstantFieldIdx());
426
+ return "offset_" + std::to_string(getConstantFieldIdx());
427
427
  }
428
428
 
429
429
  inline const Type* getType() const
@@ -510,8 +510,8 @@ public:
510
510
  inline const std::string getValueName() const
511
511
  {
512
512
  if (value && value->hasName())
513
- return value->getName().str() + "_" + llvm::itostr(ls.accumulateConstantFieldIdx());
514
- return "offset_" + llvm::itostr(ls.accumulateConstantFieldIdx());
513
+ return value->getName().str() + "_" + std::to_string(ls.accumulateConstantFieldIdx());
514
+ return "offset_" + std::to_string(ls.accumulateConstantFieldIdx());
515
515
  }
516
516
 
517
517
  virtual const std::string toString() const;
@@ -81,9 +81,6 @@ public:
81
81
  //@}
82
82
 
83
83
  private:
84
- /// Data layout on a target machine
85
- static DataLayout *dl;
86
-
87
84
  ValueToIDMapTy valSymMap; ///< map a value to its sym id
88
85
  ValueToIDMapTy objSymMap; ///< map a obj reference to its sym id
89
86
  FunToIDMapTy returnSymMap; ///< return map
@@ -162,14 +159,6 @@ public:
162
159
  mod = m;
163
160
  }
164
161
 
165
- /// Get target machine data layout
166
- inline static DataLayout* getDataLayout(Module* mod)
167
- {
168
- if(dl==nullptr)
169
- return dl = new DataLayout(mod);
170
- return dl;
171
- }
172
-
173
162
  /// special value
174
163
  // @{
175
164
  static bool isNullPtrSym(const Value *val);
@@ -32,6 +32,7 @@
32
32
 
33
33
  #include "Util/SVFModule.h"
34
34
  #include "SVF-FE/DataFlowUtil.h"
35
+ #include "SVF-FE/BasicTypes.h"
35
36
  #include "Util/Conditions.h"
36
37
  #include "Util/WorkList.h"
37
38
  #include "Graphs/SVFG.h"
@@ -2,18 +2,57 @@
2
2
  #define SVF_FE_BASIC_TYPES_H
3
3
 
4
4
  #include <llvm/IR/Instructions.h>
5
+ #include <llvm/IR/IntrinsicInst.h>
5
6
  #include <llvm/IR/Metadata.h>
7
+ #include <llvm/IR/DataLayout.h>
8
+
9
+ #include <llvm/Analysis/MemoryLocation.h>
6
10
 
7
11
  #include <llvm/Support/SourceMgr.h>
8
12
 
9
13
  typedef llvm::SMDiagnostic SMDiagnostic;
10
14
 
11
- typedef llvm::ExtractValueInst ExtractValueInst;
12
- typedef llvm::ExtractElementInst ExtractElementInst;
13
15
  typedef llvm::MetadataAsValue MetadataAsValue;
14
16
  typedef llvm::BlockAddress BlockAddress;
15
17
 
18
+ // LLVM data layout
19
+ typedef llvm::StructLayout StructLayout;
20
+ typedef llvm::ConstantStruct ConstantStruct;
21
+ typedef llvm::MemoryLocation MemoryLocation;
22
+
23
+ // LLVM Aliases and constants
16
24
  typedef llvm::ConstantAggregate ConstantAggregate;
17
25
  typedef llvm::ConstantAggregateZero ConstantAggregateZero;
26
+ typedef llvm::ConstantDataSequential ConstantDataSequential;
27
+ typedef llvm::ConstantExpr ConstantExpr;
28
+
29
+ // LLVM Instructions
30
+ typedef llvm::AtomicCmpXchgInst AtomicCmpXchgInst;
31
+ typedef llvm::AtomicRMWInst AtomicRMWInst;
32
+ typedef llvm::BitCastInst BitCastInst;
33
+ typedef llvm::CallBrInst CallBrInst;
34
+ typedef llvm::CastInst CastInst;
35
+ typedef llvm::CmpInst CmpInst;
36
+ typedef llvm::ExtractValueInst ExtractValueInst;
37
+ typedef llvm::ExtractElementInst ExtractElementInst;
38
+ typedef llvm::GetElementPtrInst GetElementPtrInst;
39
+ typedef llvm::InvokeInst InvokeInst;
40
+ typedef llvm::ShuffleVectorInst ShuffleVectorInst;
41
+ typedef llvm::PHINode PHINode;
42
+ typedef llvm::IntToPtrInst IntToPtrInst;
43
+ typedef llvm::InsertValueInst InsertValueInst;
44
+ typedef llvm::FenceInst FenceInst;
45
+ typedef llvm::FreezeInst FreezeInst;
46
+ typedef llvm::UnreachableInst UnreachableInst;
47
+ typedef llvm::InsertElementInst InsertElementInst;
48
+ typedef llvm::LandingPadInst LandingPadInst;
49
+ typedef llvm::ResumeInst ResumeInst;
50
+ typedef llvm::SelectInst SelectInst;
51
+ typedef llvm::VAArgInst VAArgInst;
52
+ typedef llvm::VACopyInst VACopyInst;
53
+ typedef llvm::VAEndInst VAEndInst;
54
+ typedef llvm::VAStartInst VAStartInst;
55
+ typedef llvm::BinaryOperator BinaryOperator;
56
+ typedef llvm::UnaryOperator UnaryOperator;
18
57
 
19
58
  #endif // SVF_FE_BASIC_TYPES_H
@@ -617,6 +617,13 @@ inline const ConstantExpr *isUnaryConstantExpr(const Value *val)
617
617
  }
618
618
  //@}
619
619
 
620
+ inline static DataLayout* getDataLayout(Module* mod)
621
+ {
622
+ static DataLayout *dl = nullptr;
623
+ if (dl == nullptr) dl = new DataLayout(mod);
624
+ return dl;
625
+ }
626
+
620
627
  /// Get the next instructions following control flow
621
628
  void getNextInsts(const Instruction* curInst, std::vector<const Instruction*>& instList);
622
629
 
@@ -34,7 +34,6 @@
34
34
  #include "SVF-FE/GEPTypeBridgeIterator.h"
35
35
  #include "Graphs/GraphPrinter.h"
36
36
  #include "Util/Casting.h"
37
- #include <llvm/ADT/SmallVector.h> // for small vector
38
37
  #include <llvm/ADT/SparseBitVector.h>
39
38
  #include <llvm/IR/Instructions.h>
40
39
  #include <llvm/IR/InstVisitor.h> // for instruction visitor
@@ -106,20 +105,12 @@ typedef llvm::VectorType VectorType;
106
105
 
107
106
  /// LLVM data layout
108
107
  typedef llvm::DataLayout DataLayout;
109
- typedef llvm::StructLayout StructLayout;
110
- typedef llvm::SmallVector<BasicBlock*, 8> SmallBBVector;
111
- typedef llvm::ConstantStruct ConstantStruct;
112
- typedef llvm::MemoryLocation MemoryLocation;
113
108
 
114
109
  /// LLVM Aliases and constants
115
110
  typedef llvm::Argument Argument;
116
111
  typedef llvm::Constant Constant;
117
112
  typedef llvm::ConstantData ConstantData;
118
- typedef llvm::ConstantDataSequential ConstantDataSequential;
119
113
  typedef llvm::ConstantInt ConstantInt;
120
- typedef llvm::ConstantFP ConstantFP;
121
- typedef llvm::ConstantTokenNone ConstantTokenNone;
122
- typedef llvm::ConstantExpr ConstantExpr;
123
114
  typedef llvm::ConstantPointerNull ConstantPointerNull;
124
115
  typedef llvm::ConstantArray ConstantArray;
125
116
  typedef llvm::GlobalAlias GlobalAlias;
@@ -134,38 +125,12 @@ typedef llvm::MDNode MDNode;
134
125
  /// LLVM Instructions
135
126
  typedef llvm::AllocaInst AllocaInst;
136
127
  typedef llvm::CallInst CallInst;
137
- typedef llvm::InvokeInst InvokeInst;
138
- typedef llvm::CallBrInst CallBrInst;
139
128
  typedef llvm::StoreInst StoreInst;
140
129
  typedef llvm::LoadInst LoadInst;
141
- typedef llvm::PHINode PHINode;
142
- typedef llvm::GetElementPtrInst GetElementPtrInst;
143
- typedef llvm::CastInst CastInst;
144
- typedef llvm::BitCastInst BitCastInst;
145
130
  typedef llvm::ReturnInst ReturnInst;
146
- typedef llvm::SelectInst SelectInst;
147
- typedef llvm::IntToPtrInst IntToPtrInst;
148
- typedef llvm::CmpInst CmpInst;
149
131
  typedef llvm::BranchInst BranchInst;
150
132
  typedef llvm::SwitchInst SwitchInst;
151
- typedef llvm::InsertValueInst InsertValueInst;
152
- typedef llvm::BinaryOperator BinaryOperator;
153
- typedef llvm::UnaryOperator UnaryOperator;
154
- typedef llvm::PtrToIntInst PtrToIntInst;
155
- typedef llvm::VAArgInst VAArgInst;
156
- typedef llvm::InsertElementInst InsertElementInst;
157
- typedef llvm::ShuffleVectorInst ShuffleVectorInst;
158
- typedef llvm::LandingPadInst LandingPadInst;
159
- typedef llvm::ResumeInst ResumeInst;
160
- typedef llvm::UnreachableInst UnreachableInst;
161
- typedef llvm::FenceInst FenceInst;
162
- typedef llvm::AtomicCmpXchgInst AtomicCmpXchgInst;
163
- typedef llvm::AtomicRMWInst AtomicRMWInst;
164
133
  typedef llvm::UndefValue UndefValue;
165
- typedef llvm::VACopyInst VACopyInst;
166
- typedef llvm::VAEndInst VAEndInst;
167
- typedef llvm::VAStartInst VAStartInst;
168
- typedef llvm::FreezeInst FreezeInst;
169
134
 
170
135
  #if (LLVM_VERSION_MAJOR >= 9)
171
136
  typedef llvm::FunctionCallee FunctionCallee;
@@ -31,6 +31,10 @@
31
31
  #ifndef INCLUDE_UTIL_SVFBASICTYPES_H_
32
32
  #define INCLUDE_UTIL_SVFBASICTYPES_H_
33
33
 
34
+ // TODO: these are just for SmallBBVector.
35
+ #include <llvm/IR/BasicBlock.h>
36
+ #include <llvm/ADT/SmallVector.h>
37
+
34
38
  #include <llvm/ADT/SparseBitVector.h> // for points-to
35
39
  #include <llvm/Support/CommandLine.h> // for command line options
36
40
  #include <llvm/ADT/StringMap.h> // for StringMap
@@ -108,9 +112,7 @@ template<typename Key, typename Value, typename Compare = std::less<Key>,
108
112
  typename Allocator = std::allocator<std::pair<const Key, Value>>>
109
113
  using OrderedMap = std::map<Key, Value, Compare, Allocator>;
110
114
 
111
- template <typename T, unsigned N>
112
- using SmallVector = llvm::SmallVector<T, N>;
113
-
115
+ typedef llvm::SmallVector<llvm::BasicBlock*, 8> SmallBBVector;
114
116
  typedef std::pair<NodeID, NodeID> NodePair;
115
117
  typedef OrderedSet<NodeID> OrderedNodeSet;
116
118
  typedef Set<NodeID> NodeSet;
@@ -121,10 +123,8 @@ typedef std::vector<EdgeID> EdgeVector;
121
123
  typedef std::stack<NodeID> NodeStack;
122
124
  typedef std::list<NodeID> NodeList;
123
125
  typedef std::deque<NodeID> NodeDeque;
124
- typedef SmallVector<u32_t,16> SmallVector16;
125
- typedef SmallVector<u32_t,8> SmallVector8;
126
126
  typedef NodeSet EdgeSet;
127
- typedef SmallVector16 CallStrCxt;
127
+ typedef std::vector<u32_t> CallStrCxt;
128
128
  typedef llvm::StringMap<u32_t> StringMap;
129
129
 
130
130
  typedef unsigned Version;
@@ -290,27 +290,6 @@ template <> struct std::hash<SVF::NodePair> {
290
290
  }
291
291
  };
292
292
 
293
- /// Specialise hash for SmallVectors.
294
- template <typename T, unsigned N>
295
- struct std::hash<SVF::SmallVector<T, N>>
296
- {
297
- size_t operator()(const SVF::SmallVector<T, N> &sv) const {
298
- if (sv.empty()) return 0;
299
- if (sv.size() == 1) return sv[0];
300
-
301
- // Iterate and accumulate the hash.
302
- size_t hash = 0;
303
- SVF::Hash<std::pair<T, size_t>> hts;
304
- std::hash<T> ht;
305
- for (const T &t : sv)
306
- {
307
- hash = hts(std::make_pair(ht(t), hash));
308
- }
309
-
310
- return hash;
311
- }
312
- };
313
-
314
293
  /// Specialise hash for SparseBitVectors.
315
294
  template <unsigned N>
316
295
  struct std::hash<llvm::SparseBitVector<N>>
@@ -192,7 +192,7 @@ inline bool isIntrinsicInst(const Instruction* inst)
192
192
  /// Whether an instruction is a call or invoke instruction
193
193
  inline bool isCallSite(const Instruction* inst)
194
194
  {
195
- return SVFUtil::isa<CallInst>(inst) || SVFUtil::isa<InvokeInst>(inst) || SVFUtil::isa<CallBrInst>(inst);
195
+ return SVFUtil::isa<CallBase>(inst);
196
196
  }
197
197
  /// Whether an instruction is a call or invoke instruction
198
198
  inline bool isCallSite(const Value* val)
@@ -75,12 +75,6 @@ public:
75
75
  /// Destructor
76
76
  virtual ~WPAPass();
77
77
 
78
- /// Interface expose to users of our pointer analysis, given Location infos
79
- virtual inline AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB)
80
- {
81
- return alias(LocA.Ptr, LocB.Ptr);
82
- }
83
-
84
78
  /// Interface expose to users of our pointer analysis, given Value infos
85
79
  virtual AliasResult alias(const Value* V1, const Value* V2);
86
80
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svf-lib",
3
- "version": "1.0.947",
3
+ "version": "1.0.950",
4
4
  "description": "SVF's npm support",
5
5
  "main": "index.js",
6
6
  "scripts": {