svf-lib 1.0.885 → 1.0.889

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 (38) hide show
  1. package/SVF-osx/Release-build/lib/CUDD/libCudd.a +0 -0
  2. package/SVF-osx/Release-build/lib/libSvf.a +0 -0
  3. package/SVF-osx/include/DDA/DDAPass.h +2 -14
  4. package/SVF-osx/include/Graphs/GraphPrinter.h +2 -2
  5. package/SVF-osx/include/Graphs/ICFGEdge.h +1 -1
  6. package/SVF-osx/include/Graphs/ICFGNode.h +1 -1
  7. package/SVF-osx/include/Graphs/ICFGStat.h +4 -4
  8. package/SVF-osx/include/Graphs/PTACallGraph.h +2 -2
  9. package/SVF-osx/include/Graphs/VFG.h +1 -1
  10. package/SVF-osx/include/Graphs/VFGEdge.h +1 -1
  11. package/SVF-osx/include/Graphs/VFGNode.h +1 -1
  12. package/SVF-osx/include/MSSA/MemSSA.h +1 -1
  13. package/SVF-osx/include/MTA/MTA.h +0 -8
  14. package/SVF-osx/include/MemoryModel/ConditionalPT.h +2 -3
  15. package/SVF-osx/include/MemoryModel/MutablePointsToDS.h +14 -15
  16. package/SVF-osx/include/MemoryModel/PersistentPointsToCache.h +19 -19
  17. package/SVF-osx/include/MemoryModel/PointerAnalysis.h +1 -1
  18. package/SVF-osx/include/MemoryModel/PointerAnalysisImpl.h +5 -5
  19. package/SVF-osx/include/MemoryModel/SVFStatements.h +1 -1
  20. package/SVF-osx/include/MemoryModel/SVFVariables.h +1 -1
  21. package/SVF-osx/include/MemoryModel/SymbolTableInfo.h +0 -6
  22. package/SVF-osx/include/SABER/SaberCheckerAPI.h +1 -1
  23. package/SVF-osx/include/SVF-FE/BasicTypes.h +19 -0
  24. package/SVF-osx/include/SVF-FE/BreakConstantExpr.h +0 -11
  25. package/SVF-osx/include/SVF-FE/DataFlowUtil.h +0 -6
  26. package/SVF-osx/include/SVF-FE/LLVMUtil.h +15 -5
  27. package/SVF-osx/include/SVF-FE/SVFIRBuilder.h +1 -0
  28. package/SVF-osx/include/Util/BasicTypes.h +1 -15
  29. package/SVF-osx/include/Util/Conditions.h +1 -1
  30. package/SVF-osx/include/Util/CxtStmt.h +7 -3
  31. package/SVF-osx/include/Util/DPItem.h +0 -1
  32. package/SVF-osx/include/Util/ExtAPI.h +5 -2
  33. package/SVF-osx/include/Util/IRAnnotator.h +2 -2
  34. package/SVF-osx/include/Util/SVFBasicTypes.h +21 -3
  35. package/SVF-osx/include/Util/SVFUtil.h +7 -7
  36. package/SVF-osx/include/Util/ThreadAPI.h +1 -1
  37. package/SVF-osx/include/WPA/WPAPass.h +2 -16
  38. package/package.json +1 -1
Binary file
@@ -21,7 +21,7 @@ namespace SVF
21
21
  * Demand-Driven Pointer Analysis.
22
22
  * This class performs various pointer analysis on the given module.
23
23
  */
24
- class DDAPass: public ModulePass
24
+ class DDAPass
25
25
  {
26
26
 
27
27
  public:
@@ -31,21 +31,9 @@ public:
31
31
  typedef OrderedSet<const SVFGEdge*> SVFGEdgeSet;
32
32
  typedef std::vector<PointerAnalysis*> PTAVector;
33
33
 
34
- DDAPass() : ModulePass(ID), _pta(nullptr), _client(nullptr) {}
34
+ DDAPass() : _pta(nullptr), _client(nullptr) {}
35
35
  ~DDAPass();
36
36
 
37
- virtual inline void getAnalysisUsage(AnalysisUsage &au) const
38
- {
39
- // declare your dependencies here.
40
- /// do not intend to change the IR in this pass,
41
- au.setPreservesAll();
42
- }
43
-
44
- virtual inline void* getAdjustedAnalysisPointer(AnalysisID)
45
- {
46
- return this;
47
- }
48
-
49
37
  /// Interface expose to users of our pointer analysis, given Location infos
50
38
  virtual inline AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB)
51
39
  {
@@ -54,7 +54,7 @@ public:
54
54
  * Write the graph into dot file for debugging purpose
55
55
  */
56
56
  template<class GraphType>
57
- static void WriteGraphToFile(llvm::raw_ostream &O,
57
+ static void WriteGraphToFile(SVF::OutStream &O,
58
58
  const std::string &GraphName, const GraphType &GT, bool simple = false)
59
59
  {
60
60
  // Filename of the output dot file
@@ -83,7 +83,7 @@ public:
83
83
  * Print the graph to command line
84
84
  */
85
85
  template<class GraphType>
86
- static void PrintGraph(llvm::raw_ostream &O, const std::string &GraphName,
86
+ static void PrintGraph(SVF::OutStream &O, const std::string &GraphName,
87
87
  const GraphType &GT)
88
88
  {
89
89
  ///Define the GTraits and node iterator for printing
@@ -96,7 +96,7 @@ public:
96
96
 
97
97
  /// Overloading operator << for dumping ICFG node ID
98
98
  //@{
99
- friend raw_ostream& operator<< (raw_ostream &o, const ICFGEdge &edge)
99
+ friend OutStream& operator<< (OutStream &o, const ICFGEdge &edge)
100
100
  {
101
101
  o << edge.toString();
102
102
  return o;
@@ -91,7 +91,7 @@ public:
91
91
 
92
92
  /// Overloading operator << for dumping ICFG node ID
93
93
  //@{
94
- friend raw_ostream &operator<<(raw_ostream &o, const ICFGNode &node)
94
+ friend OutStream &operator<<(OutStream &o, const ICFGNode &node)
95
95
  {
96
96
  o << node.toString();
97
97
  return o;
@@ -145,16 +145,16 @@ public:
145
145
  void printStat(string statname)
146
146
  {
147
147
 
148
- std::cout << "\n************ " << statname << " ***************\n";
149
- std::cout.flags(std::ios::left);
148
+ SVFUtil::outs() << "\n************ " << statname << " ***************\n";
149
+ SVFUtil::outs().flags(std::ios::left);
150
150
  unsigned field_width = 20;
151
151
  for(NUMStatMap::iterator it = PTNumStatMap.begin(), eit = PTNumStatMap.end(); it!=eit; ++it)
152
152
  {
153
153
  // format out put with width 20 space
154
- std::cout << std::setw(field_width) << it->first << it->second << "\n";
154
+ SVFUtil::outs() << std::setw(field_width) << it->first << it->second << "\n";
155
155
  }
156
156
  PTNumStatMap.clear();
157
- std::cout.flush();
157
+ SVFUtil::outs().flush();
158
158
  }
159
159
  };
160
160
 
@@ -154,7 +154,7 @@ public:
154
154
 
155
155
  /// Overloading operator << for dumping ICFG node ID
156
156
  //@{
157
- friend raw_ostream& operator<< (raw_ostream &o, const PTACallGraphEdge &edge)
157
+ friend OutStream& operator<< (OutStream &o, const PTACallGraphEdge &edge)
158
158
  {
159
159
  o << edge.toString();
160
160
  return o;
@@ -201,7 +201,7 @@ public:
201
201
 
202
202
  /// Overloading operator << for dumping ICFG node ID
203
203
  //@{
204
- friend raw_ostream& operator<< (raw_ostream &o, const PTACallGraphNode &node)
204
+ friend OutStream& operator<< (OutStream &o, const PTACallGraphNode &node)
205
205
  {
206
206
  o << node.toString();
207
207
  return o;
@@ -555,7 +555,7 @@ protected:
555
555
  /// we will set this phi node's def later
556
556
  /// Ideally, every function uniqueFunRet should be a PhiNode (SVFIRBuilder.cpp), unless it does not have ret instruction
557
557
  if (!pag->isPhiNode(uniqueFunRet)){
558
- std::string warn = fun->getName().str();
558
+ std::string warn = fun->getName();
559
559
  SVFUtil::writeWrnMsg(warn + " does not have any ret instruction!");
560
560
  setDef(uniqueFunRet, sNode);
561
561
  }
@@ -124,7 +124,7 @@ public:
124
124
 
125
125
  /// Overloading operator << for dumping ICFG node ID
126
126
  //@{
127
- friend raw_ostream& operator<< (raw_ostream &o, const VFGEdge &edge)
127
+ friend OutStream& operator<< (OutStream &o, const VFGEdge &edge)
128
128
  {
129
129
  o << edge.toString();
130
130
  return o;
@@ -94,7 +94,7 @@ public:
94
94
 
95
95
  /// Overloading operator << for dumping ICFG node ID
96
96
  //@{
97
- friend raw_ostream& operator<< (raw_ostream &o, const VFGNode &node)
97
+ friend OutStream& operator<< (OutStream &o, const VFGNode &node)
98
98
  {
99
99
  o << node.toString();
100
100
  return o;
@@ -451,7 +451,7 @@ public:
451
451
  //@}
452
452
 
453
453
  /// Print Memory SSA
454
- void dumpMSSA(raw_ostream & Out = SVFUtil::outs());
454
+ void dumpMSSA(OutStream & Out = SVFUtil::outs());
455
455
  };
456
456
 
457
457
  } // End namespace SVF
@@ -68,14 +68,6 @@ public:
68
68
 
69
69
  void dump(Module &module, MHP *mhp, LockAnalysis *lsa);
70
70
 
71
- /// Get analysis usage
72
- inline virtual void getAnalysisUsage(AnalysisUsage& au) const
73
- {
74
- /// do not intend to change the IR in this pass,
75
- au.setPreservesAll();
76
- au.addRequired<ScalarEvolutionWrapperPass>();
77
- }
78
-
79
71
  // Get ScalarEvolution for Function F.
80
72
  static inline ScalarEvolution* getSE(const Function *F)
81
73
  {
@@ -31,7 +31,6 @@
31
31
  #define CONDVAR_H_
32
32
 
33
33
  #include "Util/SVFUtil.h"
34
- #include "llvm/Support/raw_ostream.h"
35
34
  #include "MemoryModel/PointsTo.h"
36
35
 
37
36
  namespace SVF
@@ -114,7 +113,7 @@ public:
114
113
  return rawstr.str();
115
114
  }
116
115
 
117
- friend raw_ostream& operator<< (raw_ostream &o, const CondVar<Cond> &cvar)
116
+ friend OutStream& operator<< (OutStream &o, const CondVar<Cond> &cvar)
118
117
  {
119
118
  o << cvar.toString();
120
119
  return o;
@@ -708,7 +707,7 @@ public:
708
707
 
709
708
  // Print all points-to targets
710
709
  //@{
711
- inline void dump(raw_ostream & O) const
710
+ inline void dump(OutStream & O) const
712
711
  {
713
712
  CondPtsConstIter it = cptsBegin();
714
713
  CondPtsConstIter eit = cptsEnd();
@@ -4,6 +4,8 @@
4
4
  #ifndef MUTABLE_POINTSTO_H_
5
5
  #define MUTABLE_POINTSTO_H_
6
6
 
7
+ #include<fstream>
8
+
7
9
  #include "MemoryModel/AbstractPointsToDS.h"
8
10
  #include "Util/SVFBasicTypes.h"
9
11
  #include "Util/SVFUtil.h"
@@ -124,7 +126,7 @@ public:
124
126
  ///@}
125
127
 
126
128
  protected:
127
- virtual inline void dumpPts(const PtsMap & ptsSet,raw_ostream & O = SVFUtil::outs()) const
129
+ virtual inline void dumpPts(const PtsMap & ptsSet,OutStream & O = SVFUtil::outs()) const
128
130
  {
129
131
  for (PtsMapConstIter nodeIt = ptsSet.begin(); nodeIt != ptsSet.end(); nodeIt++)
130
132
  {
@@ -581,10 +583,9 @@ public:
581
583
  mutPTData.dumpPTData();
582
584
  /// dump points-to of address-taken variables
583
585
  std::error_code ErrInfo;
584
- ToolOutputFile F("svfg_pts.data", ErrInfo, llvm::sys::fs::OF_None);
585
- if (!ErrInfo)
586
+ std::fstream f("svfg_pts.data", std::ios_base::out);
587
+ if (f.good())
586
588
  {
587
- raw_fd_ostream & osm = F.os();
588
589
  NodeBS locs;
589
590
  for(DFPtsMapconstIter it = dfInPtsMap.begin(), eit = dfInPtsMap.end(); it!=eit; ++it)
590
591
  locs.set(it->first);
@@ -597,31 +598,29 @@ public:
597
598
  LocID loc = *it;
598
599
  if (this->hasDFInSet(loc))
599
600
  {
600
- osm << "Loc:" << loc << " IN:{";
601
- this->dumpPts(this->getDFInPtsMap(loc), osm);
602
- osm << "}\n";
601
+ f << "Loc:" << loc << " IN:{";
602
+ this->dumpPts(this->getDFInPtsMap(loc), f);
603
+ f << "}\n";
603
604
  }
604
605
 
605
606
  if (this->hasDFOutSet(loc))
606
607
  {
607
- osm << "Loc:" << loc << " OUT:{";
608
- this->dumpPts(this->getDFOutPtsMap(loc), osm);
609
- osm << "}\n";
608
+ f << "Loc:" << loc << " OUT:{";
609
+ this->dumpPts(this->getDFOutPtsMap(loc), f);
610
+ f << "}\n";
610
611
  }
611
612
  }
612
- F.os().close();
613
- if (!F.os().has_error())
613
+ f.close();
614
+ if (f.good())
614
615
  {
615
616
  SVFUtil::outs() << "\n";
616
- F.keep();
617
617
  return;
618
618
  }
619
619
  }
620
620
  SVFUtil::outs() << " error opening file for writing!\n";
621
- F.os().clear_error();
622
621
  }
623
622
 
624
- virtual inline void dumpPts(const PtsMap & ptsSet,raw_ostream & O = SVFUtil::outs()) const
623
+ virtual inline void dumpPts(const PtsMap & ptsSet,OutStream & O = SVFUtil::outs()) const
625
624
  {
626
625
  for (PtsMapConstIter nodeIt = ptsSet.begin(); nodeIt != ptsSet.end(); nodeIt++)
627
626
  {
@@ -296,31 +296,31 @@ public:
296
296
  void printStats(const std::string subtitle) const
297
297
  {
298
298
  static const unsigned fieldWidth = 25;
299
- std::cout.flags(std::ios::left);
299
+ SVFUtil::outs().flags(std::ios::left);
300
300
 
301
- std::cout << "****Persistent Points-To Cache Statistics: " << subtitle << "****\n";
301
+ SVFUtil::outs() << "****Persistent Points-To Cache Statistics: " << subtitle << "****\n";
302
302
 
303
- std::cout << std::setw(fieldWidth) << "UniquePointsToSets" << idToPts.size() << "\n";
303
+ SVFUtil::outs() << std::setw(fieldWidth) << "UniquePointsToSets" << idToPts.size() << "\n";
304
304
 
305
- std::cout << std::setw(fieldWidth) << "TotalUnions" << totalUnions << "\n";
306
- std::cout << std::setw(fieldWidth) << "PropertyUnions" << propertyUnions << "\n";
307
- std::cout << std::setw(fieldWidth) << "UniqueUnions" << uniqueUnions << "\n";
308
- std::cout << std::setw(fieldWidth) << "LookupUnions" << lookupUnions << "\n";
309
- std::cout << std::setw(fieldWidth) << "PreemptiveUnions" << preemptiveUnions << "\n";
305
+ SVFUtil::outs() << std::setw(fieldWidth) << "TotalUnions" << totalUnions << "\n";
306
+ SVFUtil::outs() << std::setw(fieldWidth) << "PropertyUnions" << propertyUnions << "\n";
307
+ SVFUtil::outs() << std::setw(fieldWidth) << "UniqueUnions" << uniqueUnions << "\n";
308
+ SVFUtil::outs() << std::setw(fieldWidth) << "LookupUnions" << lookupUnions << "\n";
309
+ SVFUtil::outs() << std::setw(fieldWidth) << "PreemptiveUnions" << preemptiveUnions << "\n";
310
310
 
311
- std::cout << std::setw(fieldWidth) << "TotalComplements" << totalComplements << "\n";
312
- std::cout << std::setw(fieldWidth) << "PropertyComplements" << propertyComplements << "\n";
313
- std::cout << std::setw(fieldWidth) << "UniqueComplements" << uniqueComplements << "\n";
314
- std::cout << std::setw(fieldWidth) << "LookupComplements" << lookupComplements << "\n";
315
- std::cout << std::setw(fieldWidth) << "PreemptiveComplements" << preemptiveComplements << "\n";
311
+ SVFUtil::outs() << std::setw(fieldWidth) << "TotalComplements" << totalComplements << "\n";
312
+ SVFUtil::outs() << std::setw(fieldWidth) << "PropertyComplements" << propertyComplements << "\n";
313
+ SVFUtil::outs() << std::setw(fieldWidth) << "UniqueComplements" << uniqueComplements << "\n";
314
+ SVFUtil::outs() << std::setw(fieldWidth) << "LookupComplements" << lookupComplements << "\n";
315
+ SVFUtil::outs() << std::setw(fieldWidth) << "PreemptiveComplements" << preemptiveComplements << "\n";
316
316
 
317
- std::cout << std::setw(fieldWidth) << "TotalIntersections" << totalIntersections << "\n";
318
- std::cout << std::setw(fieldWidth) << "PropertyIntersections" << propertyIntersections << "\n";
319
- std::cout << std::setw(fieldWidth) << "UniqueIntersections" << uniqueIntersections << "\n";
320
- std::cout << std::setw(fieldWidth) << "LookupIntersections" << lookupIntersections << "\n";
321
- std::cout << std::setw(fieldWidth) << "PreemptiveIntersections" << preemptiveIntersections << "\n";
317
+ SVFUtil::outs() << std::setw(fieldWidth) << "TotalIntersections" << totalIntersections << "\n";
318
+ SVFUtil::outs() << std::setw(fieldWidth) << "PropertyIntersections" << propertyIntersections << "\n";
319
+ SVFUtil::outs() << std::setw(fieldWidth) << "UniqueIntersections" << uniqueIntersections << "\n";
320
+ SVFUtil::outs() << std::setw(fieldWidth) << "LookupIntersections" << lookupIntersections << "\n";
321
+ SVFUtil::outs() << std::setw(fieldWidth) << "PreemptiveIntersections" << preemptiveIntersections << "\n";
322
322
 
323
- std::cout.flush();
323
+ SVFUtil::outs().flush();
324
324
  }
325
325
 
326
326
  /// Returns all points-to sets stored by this cache as keys to a map.
@@ -400,7 +400,7 @@ public:
400
400
  //@}
401
401
 
402
402
  /// Resolve indirect call edges
403
- virtual void resolveIndCalls(const CallICFGNode* cs, const PointsTo& target, CallEdgeMap& newEdges,LLVMCallGraph* callgraph = nullptr);
403
+ virtual void resolveIndCalls(const CallICFGNode* cs, const PointsTo& target, CallEdgeMap& newEdges);
404
404
  /// Match arguments for callsite at caller and callee
405
405
  bool matchArgs(const CallICFGNode* cs, const SVFFunction* callee);
406
406
 
@@ -536,15 +536,15 @@ public:
536
536
  CPtSet cpts2;
537
537
  expandFIObjs(pts2,cpts2);
538
538
  if (containBlackHoleNode(cpts1) || containBlackHoleNode(cpts2))
539
- return llvm::AliasResult::MayAlias;
539
+ return AliasResult::MayAlias;
540
540
  else if(this->getAnalysisTy()==PathS_DDA && contains(cpts1,cpts2) && contains(cpts2,cpts1))
541
541
  {
542
- return llvm::AliasResult::MustAlias;
542
+ return AliasResult::MustAlias;
543
543
  }
544
544
  else if(overlap(cpts1,cpts2))
545
- return llvm::AliasResult::MayAlias;
545
+ return AliasResult::MayAlias;
546
546
  else
547
- return llvm::AliasResult::NoAlias;
547
+ return AliasResult::NoAlias;
548
548
  }
549
549
  /// Test blk node for cpts
550
550
  inline bool containBlackHoleNode(const CPtSet& cpts)
@@ -583,7 +583,7 @@ public:
583
583
  }
584
584
  else if (!SVFUtil::isa<DummyValVar>(node))
585
585
  {
586
- SVFUtil::outs() << "##<" << node->getValue()->getName() << "> ";
586
+ SVFUtil::outs() << "##<" << node->getValue()->getName().str() << "> ";
587
587
  //SVFUtil::outs() << "Source Loc: " << SVFUtil::getSourceLoc(node->getValue());
588
588
  }
589
589
 
@@ -167,7 +167,7 @@ public:
167
167
  //@}
168
168
  /// Overloading operator << for dumping SVFVar value
169
169
  //@{
170
- friend raw_ostream& operator<< (raw_ostream &o, const SVFStmt &edge)
170
+ friend OutStream& operator<< (OutStream &o, const SVFStmt &edge)
171
171
  {
172
172
  o << edge.toString();
173
173
  return o;
@@ -250,7 +250,7 @@ public:
250
250
  //@}
251
251
  /// Overloading operator << for dumping SVFVar value
252
252
  //@{
253
- friend raw_ostream& operator<< (raw_ostream &o, const SVFVar &node)
253
+ friend OutStream& operator<< (OutStream &o, const SVFVar &node)
254
254
  {
255
255
  o << node.toString();
256
256
  return o;
@@ -173,12 +173,6 @@ public:
173
173
  return dl;
174
174
  }
175
175
 
176
- /// Helper method to get the size of the type from target data layout
177
- //@{
178
- u32_t getTypeSizeInBytes(const Type* type);
179
- u32_t getTypeSizeInBytes(const StructType *sty, u32_t field_index);
180
- //@}
181
-
182
176
  /// special value
183
177
  // @{
184
178
  static bool isNullPtrSym(const Value *val);
@@ -77,7 +77,7 @@ private:
77
77
  {
78
78
  if(F)
79
79
  {
80
- TDAPIMap::const_iterator it= tdAPIMap.find(F->getName().str());
80
+ TDAPIMap::const_iterator it= tdAPIMap.find(F->getName());
81
81
  if(it != tdAPIMap.end())
82
82
  return it->second;
83
83
  }
@@ -0,0 +1,19 @@
1
+ #ifndef SVF_FE_BASIC_TYPES_H
2
+ #define SVF_FE_BASIC_TYPES_H
3
+
4
+ #include <llvm/IR/Instructions.h>
5
+ #include <llvm/IR/Metadata.h>
6
+
7
+ #include <llvm/Support/SourceMgr.h>
8
+
9
+ typedef llvm::SMDiagnostic SMDiagnostic;
10
+
11
+ typedef llvm::ExtractValueInst ExtractValueInst;
12
+ typedef llvm::ExtractElementInst ExtractElementInst;
13
+ typedef llvm::MetadataAsValue MetadataAsValue;
14
+ typedef llvm::BlockAddress BlockAddress;
15
+
16
+ typedef llvm::ConstantAggregate ConstantAggregate;
17
+ typedef llvm::ConstantAggregateZero ConstantAggregateZero;
18
+
19
+ #endif // SVF_FE_BASIC_TYPES_H
@@ -42,11 +42,6 @@ public:
42
42
  return "Remove Constant GEP Expressions";
43
43
  }
44
44
  virtual bool runOnModule (Module & M);
45
- virtual void getAnalysisUsage(AnalysisUsage &AU) const
46
- {
47
- // This pass does not modify the control-flow graph of the function
48
- AU.setPreservesCFG();
49
- }
50
45
  };
51
46
 
52
47
 
@@ -92,12 +87,6 @@ public:
92
87
  assert(!fn.isDeclaration() && "external function does not have DF");
93
88
  return &getAnalysis<UnifyFunctionExitNodes>(const_cast<Function&>(fn));
94
89
  }
95
- virtual void getAnalysisUsage(AnalysisUsage &AU) const
96
- {
97
- // This pass does not modify the control-flow graph of the function
98
- AU.addRequired<UnifyFunctionExitNodes>();
99
- AU.addPreserved<BreakConstantGEPs>();
100
- }
101
90
  };
102
91
 
103
92
  } // End namespace SVF
@@ -169,12 +169,6 @@ public:
169
169
  {
170
170
  }
171
171
 
172
- virtual void getAnalysisUsage(AnalysisUsage &AU) const
173
- {
174
- AU.setPreservesAll();
175
- // AU.addRequired<DominanceFrontier>();
176
- }
177
-
178
172
  // virtual bool runOnFunction(Function &m) {
179
173
  // Frontiers.clear();
180
174
  // DF = &getAnalysis<DominanceFrontier>();
@@ -30,7 +30,9 @@
30
30
  #ifndef INCLUDE_SVF_FE_LLVMUTIL_H_
31
31
  #define INCLUDE_SVF_FE_LLVMUTIL_H_
32
32
 
33
+ #include "SVF-FE/BasicTypes.h"
33
34
  #include "Util/SVFUtil.h"
35
+ #include "SVF-FE/BasicTypes.h"
34
36
  #include "Util/BasicTypes.h"
35
37
  #include "Util/ExtAPI.h"
36
38
  #include "Util/ThreadAPI.h"
@@ -416,12 +418,12 @@ inline bool ArgInDeadFunction (const Value * val)
416
418
  /// Return true if this is a program entry function (e.g. main)
417
419
  inline bool isProgEntryFunction (const SVFFunction * fun)
418
420
  {
419
- return fun && fun->getName().str() == "main";
421
+ return fun && fun->getName() == "main";
420
422
  }
421
423
 
422
424
  inline bool isProgEntryFunction (const Function * fun)
423
425
  {
424
- return fun && fun->getName().str() == "main";
426
+ return fun && fun->getName() == "main";
425
427
  }
426
428
 
427
429
  /// Get program entry function from module.
@@ -462,9 +464,9 @@ bool isPtrInDeadFunction (const Value * value);
462
464
  //@{
463
465
  inline bool isProgExitFunction (const SVFFunction * fun)
464
466
  {
465
- return fun && (fun->getName().str() == "exit" ||
466
- fun->getName().str() == "__assert_rtn" ||
467
- fun->getName().str() == "__assert_fail" );
467
+ return fun && (fun->getName() == "exit" ||
468
+ fun->getName() == "__assert_rtn" ||
469
+ fun->getName() == "__assert_fail" );
468
470
  }
469
471
 
470
472
  inline bool isProgExitCall(const CallSite cs)
@@ -636,6 +638,14 @@ bool isIRFile(const std::string &filename);
636
638
  void processArguments(int argc, char **argv, int &arg_num, char **arg_value,
637
639
  std::vector<std::string> &moduleNameVec);
638
640
 
641
+ /// Helper method to get the size of the type from target data layout
642
+ //@{
643
+ u32_t getTypeSizeInBytes(const Type* type);
644
+ u32_t getTypeSizeInBytes(const StructType *sty, u32_t field_index);
645
+ //@}
646
+
647
+ const std::string type2String(const Type* type);
648
+
639
649
  } // End namespace SVFUtil
640
650
 
641
651
  } // End namespace SVF
@@ -32,6 +32,7 @@
32
32
 
33
33
  #include "MemoryModel/SVFIR.h"
34
34
  #include "Util/ExtAPI.h"
35
+ #include "SVF-FE/BasicTypes.h"
35
36
  #include "SVF-FE/ICFGBuilder.h"
36
37
 
37
38
  namespace SVF
@@ -46,7 +46,6 @@
46
46
  #include <llvm/Analysis/CallGraph.h> // call graph
47
47
  #include <llvm/IR/GlobalVariable.h> // for GlobalVariable
48
48
 
49
- #include <llvm/Support/SourceMgr.h> // for SMDiagnostic
50
49
  #include <llvm/Bitcode/BitcodeWriter.h> // for WriteBitcodeToFile
51
50
  #include <llvm/Bitcode/BitcodeReader.h> /// for isBitcode
52
51
  #include <llvm/IRReader/IRReader.h> // IR reader for bit file
@@ -70,7 +69,6 @@ class BddCond;
70
69
 
71
70
 
72
71
  /// LLVM Basic classes
73
- typedef llvm::SMDiagnostic SMDiagnostic;
74
72
  typedef llvm::LLVMContext LLVMContext;
75
73
  typedef llvm::Type Type;
76
74
  typedef llvm::Function Function;
@@ -82,7 +80,6 @@ typedef llvm::GlobalObject GlobalObject;
82
80
  typedef llvm::GlobalValue GlobalValue;
83
81
  typedef llvm::GlobalVariable GlobalVariable;
84
82
  typedef llvm::Module Module;
85
- typedef llvm::CallGraph LLVMCallGraph;
86
83
  typedef llvm::User User;
87
84
  typedef llvm::Use Use;
88
85
  typedef llvm::Loop Loop;
@@ -93,10 +90,8 @@ typedef llvm::LoopInfo LoopInfo;
93
90
  typedef llvm::UnifyFunctionExitNodes UnifyFunctionExitNodes;
94
91
  #endif
95
92
  typedef llvm::ModulePass ModulePass;
96
- typedef llvm::AnalysisUsage AnalysisUsage;
97
93
 
98
94
  /// LLVM outputs
99
- typedef llvm::raw_ostream raw_ostream;
100
95
  typedef llvm::raw_string_ostream raw_string_ostream;
101
96
  typedef llvm::raw_fd_ostream raw_fd_ostream;
102
97
  typedef llvm::StringRef StringRef;
@@ -108,8 +103,6 @@ typedef llvm::ArrayType ArrayType;
108
103
  typedef llvm::PointerType PointerType;
109
104
  typedef llvm::FunctionType FunctionType;
110
105
  typedef llvm::VectorType VectorType;
111
- typedef llvm::MetadataAsValue MetadataAsValue;
112
- typedef llvm::BlockAddress BlockAddress;
113
106
 
114
107
  /// LLVM data layout
115
108
  typedef llvm::DataLayout DataLayout;
@@ -122,8 +115,6 @@ typedef llvm::MemoryLocation MemoryLocation;
122
115
  typedef llvm::Argument Argument;
123
116
  typedef llvm::Constant Constant;
124
117
  typedef llvm::ConstantData ConstantData;
125
- typedef llvm::ConstantAggregate ConstantAggregate;
126
- typedef llvm::ConstantAggregateZero ConstantAggregateZero;
127
118
  typedef llvm::ConstantDataSequential ConstantDataSequential;
128
119
  typedef llvm::ConstantInt ConstantInt;
129
120
  typedef llvm::ConstantFP ConstantFP;
@@ -132,9 +123,6 @@ typedef llvm::ConstantExpr ConstantExpr;
132
123
  typedef llvm::ConstantPointerNull ConstantPointerNull;
133
124
  typedef llvm::ConstantArray ConstantArray;
134
125
  typedef llvm::GlobalAlias GlobalAlias;
135
- typedef llvm::AliasResult AliasResult;
136
- typedef llvm::ModRefInfo ModRefInfo;
137
- typedef llvm::AnalysisID AnalysisID;
138
126
  typedef llvm::ConstantDataArray ConstantDataArray;
139
127
 
140
128
  /// LLVM metadata
@@ -160,13 +148,11 @@ typedef llvm::IntToPtrInst IntToPtrInst;
160
148
  typedef llvm::CmpInst CmpInst;
161
149
  typedef llvm::BranchInst BranchInst;
162
150
  typedef llvm::SwitchInst SwitchInst;
163
- typedef llvm::ExtractValueInst ExtractValueInst;
164
151
  typedef llvm::InsertValueInst InsertValueInst;
165
152
  typedef llvm::BinaryOperator BinaryOperator;
166
153
  typedef llvm::UnaryOperator UnaryOperator;
167
154
  typedef llvm::PtrToIntInst PtrToIntInst;
168
155
  typedef llvm::VAArgInst VAArgInst;
169
- typedef llvm::ExtractElementInst ExtractElementInst;
170
156
  typedef llvm::InsertElementInst InsertElementInst;
171
157
  typedef llvm::ShuffleVectorInst ShuffleVectorInst;
172
158
  typedef llvm::LandingPadInst LandingPadInst;
@@ -332,7 +318,7 @@ public:
332
318
  };
333
319
 
334
320
  template <typename F, typename S>
335
- raw_ostream& operator<< (raw_ostream &o, const std::pair<F, S> &var)
321
+ OutStream& operator<< (OutStream &o, const std::pair<F, S> &var)
336
322
  {
337
323
  o << "<" << var.first << ", " << var.second << ">";
338
324
  return o;
@@ -162,7 +162,7 @@ public:
162
162
  void ddClearFlag(BranchCond * f) const;
163
163
  void BddSupportStep( BranchCond * f, NodeBS &support) const;
164
164
  void extractSubConds( BranchCond * f, NodeBS &support) const;
165
- void dump(BranchCond* lhs, raw_ostream & O);
165
+ void dump(BranchCond* lhs, OutStream & O);
166
166
  std::string dumpStr(BranchCond* lhs) const;
167
167
 
168
168
  private:
@@ -108,7 +108,7 @@ public:
108
108
  /// Dump CxtStmt
109
109
  inline void dump() const
110
110
  {
111
- SVFUtil::outs() << "[ Current Stmt: " << SVFUtil::getSourceLoc(inst) << " " << *inst << "\t Contexts: " << cxtToStr() << " ]\n";
111
+ SVFUtil::outs() << "[ Current Stmt: " << SVFUtil::getSourceLoc(inst) << " " << SVFUtil::value2String(inst) << "\t Contexts: " << cxtToStr() << " ]\n";
112
112
  }
113
113
 
114
114
  protected:
@@ -174,7 +174,7 @@ public:
174
174
  /// Dump CxtThreadStmt
175
175
  inline void dump() const
176
176
  {
177
- SVFUtil::outs() << "[ Current Thread id: " << tid << " Stmt: " << SVFUtil::getSourceLoc(inst) << " " << *inst << "\t Contexts: " << cxtToStr() << " ]\n";
177
+ SVFUtil::outs() << "[ Current Thread id: " << tid << " Stmt: " << SVFUtil::getSourceLoc(inst) << " " << SVFUtil::value2String(inst) << "\t Contexts: " << cxtToStr() << " ]\n";
178
178
  }
179
179
 
180
180
  private:
@@ -281,11 +281,15 @@ public:
281
281
  std::string cycle = incycle?", incycle":"";
282
282
 
283
283
  if(forksite)
284
- SVFUtil::outs() << "[ Thread: $" << SVFUtil::getSourceLoc(forksite) << "$ " << *forksite << "\t Contexts: " << cxtToStr()
284
+ {
285
+ SVFUtil::outs() << "[ Thread: $" << SVFUtil::getSourceLoc(forksite) << "$ " << SVFUtil::value2String(forksite) << "\t Contexts: " << cxtToStr()
285
286
  << loop << cycle <<" ]\n";
287
+ }
286
288
  else
289
+ {
287
290
  SVFUtil::outs() << "[ Thread: " << "main " << "\t Contexts: " << cxtToStr()
288
291
  << loop << cycle <<" ]\n";
292
+ }
289
293
  }
290
294
  protected:
291
295
  CallStrCxt cxt;
@@ -32,7 +32,6 @@
32
32
 
33
33
  #include "Util/Conditions.h"
34
34
  #include "MemoryModel/ConditionalPT.h"
35
- #include "llvm/Support/raw_ostream.h"
36
35
  #include <algorithm> // std::sort
37
36
 
38
37
  namespace SVF
@@ -53,6 +53,7 @@ public:
53
53
  EFT_ALLOC, //returns a ptr to a newly allocated object
54
54
  EFT_REALLOC, //like L_A0 if arg0 is a non-null ptr, else ALLOC
55
55
  EFT_FREE, //free memory arg0 and all pointers passing into free function
56
+ EFT_FREE_MULTILEVEL, //any argument with 2-level pointer passing too a free wrapper function e.g., XFree(void**) which frees memory for void* and void**
56
57
  EFT_NOSTRUCT_ALLOC, //like ALLOC but only allocates non-struct data
57
58
  EFT_STAT, //retval points to an unknown static var X
58
59
  EFT_STAT2, //ret -> X -> Y (X, Y - external static vars)
@@ -133,10 +134,12 @@ public:
133
134
  extf_t get_type(const SVFFunction* F) const
134
135
  {
135
136
  assert(F);
136
- std::string funName = F->getName().str();
137
+ std::string funName = F->getName();
137
138
  if(F->isIntrinsic())
138
139
  {
139
- funName = "llvm." + F->getName().split('.').second.split('.').first.str();
140
+ unsigned start = funName.find('.');
141
+ unsigned end = funName.substr(start + 1).find('.');
142
+ funName = "llvm." + funName.substr(start + 1, end);
140
143
  }
141
144
  llvm::StringMap<extf_t>::const_iterator it= info.find(funName);
142
145
  if(it == info.end())
@@ -138,8 +138,8 @@ private:
138
138
  }
139
139
  else
140
140
  {
141
- std::cout << "Value is NOT a Instruction, Argument, Function, GlobalVariable, BasicBlock, Constant or InlineAsm" << std::endl;
142
- SVFUtil::outs() << *value << "\n";
141
+ SVFUtil::outs() << "Value is NOT a Instruction, Argument, Function, GlobalVariable, BasicBlock, Constant or InlineAsm" << std::endl;
142
+ SVFUtil::outs() << SVFUtil::value2String(value) << "\n";
143
143
  }
144
144
  }
145
145
 
@@ -32,10 +32,10 @@
32
32
  #define INCLUDE_UTIL_SVFBASICTYPES_H_
33
33
 
34
34
  #include <llvm/ADT/SparseBitVector.h> // for points-to
35
- #include <llvm/Support/raw_ostream.h> // for output
36
35
  #include <llvm/Support/CommandLine.h> // for command line options
37
36
  #include <llvm/ADT/StringMap.h> // for StringMap
38
37
 
38
+ #include <iostream>
39
39
  #include <vector>
40
40
  #include <list>
41
41
  #include <set>
@@ -72,6 +72,8 @@ template <class T> struct Hash {
72
72
  }
73
73
  };
74
74
 
75
+ typedef std::ostream OutStream;
76
+
75
77
  typedef unsigned u32_t;
76
78
  typedef signed s32_t;
77
79
  typedef unsigned long long u64_t;
@@ -179,6 +181,22 @@ template <> struct Hash<NodePair>
179
181
  /// Size of native integer that we'll use for bit vectors, in bits.
180
182
  #define NATIVE_INT_SIZE (sizeof(unsigned long long) * CHAR_BIT)
181
183
 
184
+ enum ModRefInfo
185
+ {
186
+ ModRef,
187
+ Ref,
188
+ Mod,
189
+ NoModRef,
190
+ };
191
+
192
+ enum AliasResult
193
+ {
194
+ MustAlias,
195
+ MayAlias,
196
+ PartialAlias,
197
+ NoAlias,
198
+ };
199
+
182
200
  class SVFValue
183
201
  {
184
202
 
@@ -228,7 +246,7 @@ public:
228
246
  }
229
247
  //@}
230
248
 
231
- const llvm::StringRef getName() const
249
+ const std::string getName() const
232
250
  {
233
251
  return value;
234
252
  }
@@ -240,7 +258,7 @@ public:
240
258
 
241
259
  /// Overloading operator << for dumping ICFG node ID
242
260
  //@{
243
- friend llvm::raw_ostream& operator<< (llvm::raw_ostream &o, const SVFValue &node)
261
+ friend OutStream& operator<< (OutStream &o, const SVFValue &node)
244
262
  {
245
263
  o << node.getName();
246
264
  return o;
@@ -46,20 +46,20 @@ namespace SVFUtil
46
46
  {
47
47
 
48
48
  /// Overwrite llvm::outs()
49
- inline raw_ostream &outs()
49
+ inline std::ostream &outs()
50
50
  {
51
- return llvm::outs();
51
+ return std::cout;
52
52
  }
53
53
 
54
54
  /// Overwrite llvm::errs()
55
- inline raw_ostream &errs()
55
+ inline std::ostream &errs()
56
56
  {
57
- return llvm::errs();
57
+ return std::cerr;
58
58
  }
59
59
 
60
60
  /// Dump sparse bitvector set
61
- void dumpSet(NodeBS To, raw_ostream & O = SVFUtil::outs());
62
- void dumpSet(PointsTo To, raw_ostream & O = SVFUtil::outs());
61
+ void dumpSet(NodeBS To, OutStream & O = SVFUtil::outs());
62
+ void dumpSet(PointsTo To, OutStream & O = SVFUtil::outs());
63
63
 
64
64
  /// Dump points-to set
65
65
  void dumpPointsToSet(unsigned node, NodeBS To) ;
@@ -89,7 +89,7 @@ std::string bugMsg3(std::string msg);
89
89
  std::string pasMsg(std::string msg);
90
90
 
91
91
  /// Print memory usage in KB.
92
- void reportMemoryUsageKB(const std::string& infor, raw_ostream & O = SVFUtil::outs());
92
+ void reportMemoryUsageKB(const std::string& infor, OutStream & O = SVFUtil::outs());
93
93
 
94
94
  /// Get memory usage from system file. Return TRUE if succeed.
95
95
  bool getMemoryUsageKB(u32_t* vmrss_kb, u32_t* vmsize_kb);
@@ -90,7 +90,7 @@ private:
90
90
  {
91
91
  if(F)
92
92
  {
93
- TDAPIMap::const_iterator it= tdAPIMap.find(F->getName().str());
93
+ TDAPIMap::const_iterator it= tdAPIMap.find(F->getName());
94
94
  if(it != tdAPIMap.end())
95
95
  return it->second;
96
96
  }
@@ -51,7 +51,7 @@ class SVFG;
51
51
  */
52
52
  // excised ", public llvm::AliasAnalysis" as that has a very light interface
53
53
  // and I want to see what breaks.
54
- class WPAPass : public ModulePass
54
+ class WPAPass
55
55
  {
56
56
  typedef std::vector<PointerAnalysis*> PTAVector;
57
57
 
@@ -67,7 +67,7 @@ public:
67
67
  };
68
68
 
69
69
  /// Constructor needs TargetLibraryInfo to be passed to the AliasAnalysis
70
- WPAPass() : ModulePass(ID)
70
+ WPAPass()
71
71
  {
72
72
 
73
73
  }
@@ -75,20 +75,6 @@ public:
75
75
  /// Destructor
76
76
  virtual ~WPAPass();
77
77
 
78
- /// LLVM analysis usage
79
- virtual inline void getAnalysisUsage(AnalysisUsage &au) const
80
- {
81
- // declare your dependencies here.
82
- /// do not intend to change the IR in this pass,
83
- au.setPreservesAll();
84
- }
85
-
86
- /// Get adjusted analysis for alias analysis
87
- virtual inline void* getAdjustedAnalysisPointer(AnalysisID)
88
- {
89
- return this;
90
- }
91
-
92
78
  /// Interface expose to users of our pointer analysis, given Location infos
93
79
  virtual inline AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB)
94
80
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svf-lib",
3
- "version": "1.0.885",
3
+ "version": "1.0.889",
4
4
  "description": "SVF's npm support",
5
5
  "main": "index.js",
6
6
  "scripts": {