svf-lib 1.0.2193 → 1.0.2195

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 (36) hide show
  1. package/SVF-linux/Release-build/bin/ae +0 -0
  2. package/SVF-linux/Release-build/bin/cfl +0 -0
  3. package/SVF-linux/Release-build/bin/dvf +0 -0
  4. package/SVF-linux/Release-build/bin/llvm2svf +0 -0
  5. package/SVF-linux/Release-build/bin/mta +0 -0
  6. package/SVF-linux/Release-build/bin/saber +0 -0
  7. package/SVF-linux/Release-build/bin/svf-ex +0 -0
  8. package/SVF-linux/Release-build/bin/wpa +0 -0
  9. package/SVF-linux/Release-build/include/Graphs/BasicBlockG.h +310 -0
  10. package/SVF-linux/Release-build/include/Graphs/GenericGraph.h +1 -0
  11. package/SVF-linux/Release-build/include/SVF-LLVM/LLVMModule.h +8 -4
  12. package/SVF-linux/Release-build/include/SVFIR/SVFValue.h +25 -124
  13. package/SVF-linux/Release-build/lib/libSvfCore.a +0 -0
  14. package/SVF-linux/Release-build/lib/libSvfLLVM.a +0 -0
  15. package/SVF-osx/Release-build/bin/ae +0 -0
  16. package/SVF-osx/Release-build/bin/cfl +0 -0
  17. package/SVF-osx/Release-build/bin/dvf +0 -0
  18. package/SVF-osx/Release-build/bin/mta +0 -0
  19. package/SVF-osx/Release-build/bin/saber +0 -0
  20. package/SVF-osx/Release-build/bin/svf-ex +0 -0
  21. package/SVF-osx/Release-build/bin/wpa +0 -0
  22. package/SVF-osx/Release-build/include/AE/Svfexe/AbsExtAPI.h +0 -7
  23. package/SVF-osx/Release-build/include/CFL/CFLAlias.h +0 -8
  24. package/SVF-osx/Release-build/include/DDA/DDAPass.h +4 -1
  25. package/SVF-osx/Release-build/include/Graphs/ConsG.h +0 -5
  26. package/SVF-osx/Release-build/include/Graphs/IRGraph.h +0 -24
  27. package/SVF-osx/Release-build/include/MSSA/MemRegion.h +1 -1
  28. package/SVF-osx/Release-build/include/MemoryModel/PointerAnalysis.h +2 -2
  29. package/SVF-osx/Release-build/include/MemoryModel/PointerAnalysisImpl.h +7 -4
  30. package/SVF-osx/Release-build/include/SVFIR/SVFIR.h +3 -3
  31. package/SVF-osx/Release-build/include/SVFIR/SVFVariables.h +3 -3
  32. package/SVF-osx/Release-build/include/Util/SVFUtil.h +0 -16
  33. package/SVF-osx/Release-build/include/WPA/WPAPass.h +0 -7
  34. package/SVF-osx/Release-build/lib/libSvfCore.a +0 -0
  35. package/SVF-osx/Release-build/lib/libSvfLLVM.a +0 -0
  36. package/package.json +1 -1
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,310 @@
1
+ //===- BasicBlockG.h -- BasicBlock node------------------------------------------------//
2
+ //
3
+ // SVF: Static Value-Flow Analysis
4
+ //
5
+ // Copyright (C) <2013-2025> <Yulei Sui>
6
+ //
7
+
8
+ // This program is free software: you can redistribute it and/or modify
9
+ // it under the terms of the GNU Affero General Public License as published by
10
+ // the Free Software Foundation, either version 3 of the License, or
11
+ // (at your option) any later version.
12
+
13
+ // This program is distributed in the hope that it will be useful,
14
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ // GNU Affero General Public License for more details.
17
+
18
+ // You should have received a copy of the GNU Affero General Public License
19
+ // along with this program. If not, see <http://www.gnu.org/licenses/>.
20
+ //
21
+ //===----------------------------------------------------------------------===//
22
+
23
+ /*
24
+ * ICFGNode.h
25
+ *
26
+ * Created on: 23 Jan, 2025
27
+ * Author: Jiawei, Xiao
28
+ */
29
+
30
+ #ifndef BASICBLOCKGRAPH_H_
31
+ #define BASICBLOCKGRAPH_H_
32
+ #include "GenericGraph.h"
33
+ #include <sstream>
34
+ #include <algorithm>
35
+
36
+
37
+ namespace SVF
38
+ {
39
+ class SVFBasicBlock;
40
+ class BasicBlockEdge;
41
+ class ICFGNode;
42
+ class SVFFunction;
43
+ typedef GenericEdge<SVFBasicBlock> GenericBasicBlockEdgeTy;
44
+ class BasicBlockEdge: public GenericBasicBlockEdgeTy
45
+ {
46
+ friend class SVFIRWriter;
47
+ friend class SVFIRReader;
48
+
49
+ public:
50
+ public:
51
+ /// Constructor
52
+ BasicBlockEdge(SVFBasicBlock* s, SVFBasicBlock* d) : GenericBasicBlockEdgeTy(s, d, 0)
53
+ {
54
+ }
55
+ /// Destructor
56
+ ~BasicBlockEdge() {}
57
+
58
+ /// Overloading operator << for dumping ICFG node ID
59
+ //@{
60
+ friend OutStream& operator<<(OutStream& o, const BasicBlockEdge& edge)
61
+ {
62
+ o << edge.toString();
63
+ return o;
64
+ }
65
+ //@}
66
+
67
+ virtual const std::string toString() const;
68
+ };
69
+
70
+
71
+ typedef GenericNode<SVFBasicBlock, BasicBlockEdge> GenericBasicBlockNodeTy;
72
+ class SVFBasicBlock : public GenericBasicBlockNodeTy
73
+ {
74
+ friend class LLVMModuleSet;
75
+ friend class SVFIRWriter;
76
+ friend class SVFIRReader;
77
+ friend class SVFIRBuilder;
78
+ friend class SVFFunction;
79
+ friend class ICFGBuilder;
80
+ friend class ICFG;
81
+
82
+ public:
83
+ typedef std::vector<const ICFGNode*>::const_iterator const_iterator;
84
+ std::vector<const SVFBasicBlock*> succBBs;
85
+ std::vector<const SVFBasicBlock*> predBBs;
86
+
87
+ private:
88
+ std::vector<const ICFGNode*> allICFGNodes; ///< all ICFGNodes in this BasicBlock
89
+ const SVFFunction* fun; /// Function where this BasicBlock is
90
+
91
+
92
+
93
+ protected:
94
+ ///@{ attributes to be set only through Module builders e.g., LLVMModule
95
+
96
+ inline void addICFGNode(const ICFGNode* icfgNode)
97
+ {
98
+ assert(std::find(getICFGNodeList().begin(), getICFGNodeList().end(),
99
+ icfgNode) == getICFGNodeList().end() && "duplicated icfgnode");
100
+ allICFGNodes.push_back(icfgNode);
101
+ }
102
+
103
+ /// @}
104
+
105
+ public:
106
+ /// Constructor without name
107
+ SVFBasicBlock(NodeID id, const SVFFunction* f): GenericBasicBlockNodeTy(id, BasicBlockKd), fun(f)
108
+ {
109
+
110
+ }
111
+ SVFBasicBlock() = delete;
112
+ ~SVFBasicBlock()
113
+ {
114
+
115
+ }
116
+
117
+ static inline bool classof(const SVFBaseNode* node)
118
+ {
119
+ return node->getNodeKind() == SVFBaseNode::BasicBlockKd;
120
+ }
121
+
122
+ static inline bool classof(const SVFBasicBlock* node)
123
+ {
124
+ return true;
125
+ }
126
+
127
+ //@{
128
+ friend OutStream &operator<<(OutStream &o, const SVFBasicBlock&node)
129
+ {
130
+ o << node.toString();
131
+ return o;
132
+ }
133
+ //@}
134
+
135
+
136
+ inline const std::vector<const ICFGNode*>& getICFGNodeList() const
137
+ {
138
+ return allICFGNodes;
139
+ }
140
+
141
+ inline const_iterator begin() const
142
+ {
143
+ return allICFGNodes.begin();
144
+ }
145
+
146
+ inline const_iterator end() const
147
+ {
148
+ return allICFGNodes.end();
149
+ }
150
+
151
+ inline void addSuccBasicBlock(const SVFBasicBlock* succ2)
152
+ {
153
+ // check if the edge already exists
154
+ for (auto edge: this->getOutEdges())
155
+ {
156
+ if (edge->getDstNode() == succ2)
157
+ return;
158
+ }
159
+
160
+ SVFBasicBlock* succ = const_cast<SVFBasicBlock*>(succ2);
161
+ BasicBlockEdge* edge = new BasicBlockEdge(this, succ);
162
+ this->addOutgoingEdge(edge);
163
+ succ->addIncomingEdge(edge);
164
+ this->succBBs.push_back(succ);
165
+ succ->predBBs.push_back(this);
166
+ }
167
+
168
+ inline void addPredBasicBlock(const SVFBasicBlock* pred2)
169
+ {
170
+ // check if the edge already exists
171
+ for (auto edge: this->getInEdges())
172
+ {
173
+ if (edge->getSrcNode() == pred2)
174
+ return;
175
+ }
176
+ SVFBasicBlock* pred = const_cast<SVFBasicBlock*>(pred2);
177
+ BasicBlockEdge* edge = new BasicBlockEdge(pred, this);
178
+ this->addIncomingEdge(edge);
179
+ pred->addOutgoingEdge(edge);
180
+ this->predBBs.push_back(pred);
181
+ pred->succBBs.push_back(this);
182
+ }
183
+
184
+ inline const SVFFunction* getParent() const
185
+ {
186
+ return fun;
187
+ }
188
+
189
+ inline const SVFFunction* getFunction() const
190
+ {
191
+ return fun;
192
+ }
193
+
194
+ inline const ICFGNode* front() const
195
+ {
196
+ assert(!allICFGNodes.empty() && "bb empty?");
197
+ return allICFGNodes.front();
198
+ }
199
+
200
+ inline const ICFGNode* back() const
201
+ {
202
+ assert(!allICFGNodes.empty() && "bb empty?");
203
+ return allICFGNodes.back();
204
+ }
205
+
206
+ inline std::vector<const SVFBasicBlock*> getSuccessors() const
207
+ {
208
+ std::vector<const SVFBasicBlock*> res;
209
+ for (auto edge : this->getOutEdges())
210
+ {
211
+ res.push_back(edge->getDstNode());
212
+ }
213
+ return res;
214
+ }
215
+
216
+ inline std::vector<const SVFBasicBlock*> getPredecessors() const
217
+ {
218
+ std::vector<const SVFBasicBlock*> res;
219
+ for (auto edge : this->getInEdges())
220
+ {
221
+ res.push_back(edge->getSrcNode());
222
+ }
223
+ return res;
224
+ }
225
+ u32_t getNumSuccessors() const
226
+ {
227
+ return this->getOutEdges().size();
228
+ }
229
+ u32_t getBBSuccessorPos(const SVFBasicBlock* Succ)
230
+ {
231
+ u32_t i = 0;
232
+ for (const SVFBasicBlock* SuccBB: succBBs)
233
+ {
234
+ if (SuccBB == Succ)
235
+ return i;
236
+ i++;
237
+ }
238
+ assert(false && "Didn't find successor edge?");
239
+ return 0;
240
+ }
241
+ u32_t getBBSuccessorPos(const SVFBasicBlock* Succ) const
242
+ {
243
+ u32_t i = 0;
244
+ for (const SVFBasicBlock* SuccBB: succBBs)
245
+ {
246
+ if (SuccBB == Succ)
247
+ return i;
248
+ i++;
249
+ }
250
+ assert(false && "Didn't find successor edge?");
251
+ return 0;
252
+
253
+ }
254
+ u32_t getBBPredecessorPos(const SVFBasicBlock* succbb)
255
+ {
256
+ u32_t pos = 0;
257
+ for (const SVFBasicBlock* PredBB : succbb->getPredecessors())
258
+ {
259
+ if(PredBB == this)
260
+ return pos;
261
+ ++pos;
262
+ }
263
+ assert(false && "Didn't find predecessor edge?");
264
+ return pos;
265
+ }
266
+ u32_t getBBPredecessorPos(const SVFBasicBlock* succbb) const
267
+ {
268
+ u32_t pos = 0;
269
+ for (const SVFBasicBlock* PredBB : succbb->getPredecessors())
270
+ {
271
+ if(PredBB == this)
272
+ return pos;
273
+ ++pos;
274
+ }
275
+ assert(false && "Didn't find predecessor edge?");
276
+ return pos;
277
+ }
278
+
279
+ const std::string toString() const;
280
+
281
+ };
282
+
283
+
284
+
285
+ typedef GenericGraph<SVFBasicBlock, BasicBlockEdge> GenericBasicBlockGraphTy;
286
+ class BasicBlockGraph: public GenericBasicBlockGraphTy
287
+ {
288
+ private:
289
+ NodeID id{0};
290
+ const SVFFunction* fun;
291
+ public:
292
+ /// Constructor
293
+ BasicBlockGraph(const SVFFunction* f): fun(f)
294
+ {
295
+
296
+ }
297
+
298
+ SVFBasicBlock* addBasicBlock(const std::string& bbname)
299
+ {
300
+ id++;
301
+ SVFBasicBlock* bb = new SVFBasicBlock(id, fun);
302
+ addGNode(id, bb);
303
+ bb->setName(bbname);
304
+ return bb;
305
+ }
306
+
307
+ };
308
+ }
309
+
310
+ #endif
@@ -240,6 +240,7 @@ public:
240
240
  ConstraintNodeKd, // Constraint graph node
241
241
  TCTNodeKd, // Thread creation tree node
242
242
  DCHNodeKd, // DCHG node
243
+ BasicBlockKd, // Basic block node
243
244
  OtherKd // Other node kind
244
245
  };
245
246
 
@@ -34,6 +34,7 @@
34
34
  #include "SVFIR/SVFValue.h"
35
35
  #include "SVFIR/SVFModule.h"
36
36
  #include "Util/Options.h"
37
+ #include "Graphs/BasicBlockG.h"
37
38
 
38
39
  namespace SVF
39
40
  {
@@ -177,11 +178,14 @@ public:
177
178
 
178
179
  void addFunctionMap(const Function* func, CallGraphNode* svfFunc);
179
180
 
180
- inline void addBasicBlockMap(const BasicBlock* bb, SVFBasicBlock* svfBB)
181
+ // create a SVFBasicBlock according to LLVM BasicBlock, then add it to SVFFunction's BasicBlockGraph
182
+ inline void addBasicBlock(SVFFunction* fun, const BasicBlock* bb)
181
183
  {
184
+ SVFBasicBlock* svfBB = fun->getBasicBlockGraph()->addBasicBlock(bb->getName().str());
182
185
  LLVMBB2SVFBB[bb] = svfBB;
183
- setValueAttr(bb,svfBB);
186
+ SVFBaseNode2LLVMValue[svfBB] = bb;
184
187
  }
188
+
185
189
  inline void addInstructionMap(const Instruction* inst, SVFInstruction* svfInst)
186
190
  {
187
191
  LLVMInst2SVFInst[inst] = svfInst;
@@ -246,7 +250,7 @@ public:
246
250
  const Value* getLLVMValue(const SVFBaseNode* value) const
247
251
  {
248
252
  SVFBaseNode2LLVMValueMap ::const_iterator it = SVFBaseNode2LLVMValue.find(value);
249
- assert(it!=SVFBaseNode2LLVMValue.end() && "can't find corresponding llvm value!");
253
+ assert(it != SVFBaseNode2LLVMValue.end() && "can't find corresponding llvm value!");
250
254
  return it->second;
251
255
  }
252
256
 
@@ -264,7 +268,7 @@ public:
264
268
  return it->second;
265
269
  }
266
270
 
267
- inline SVFBasicBlock* getSVFBasicBlock(const BasicBlock* bb) const
271
+ SVFBasicBlock* getSVFBasicBlock(const BasicBlock* bb)
268
272
  {
269
273
  LLVMBB2SVFBBMap::const_iterator it = LLVMBB2SVFBB.find(bb);
270
274
  assert(it!=LLVMBB2SVFBB.end() && "SVF BasicBlock not found!");
@@ -33,6 +33,7 @@
33
33
  #include "SVFIR/SVFType.h"
34
34
  #include "Graphs/GraphPrinter.h"
35
35
  #include "Util/Casting.h"
36
+ #include "Graphs/BasicBlockG.h"
36
37
 
37
38
  namespace SVF
38
39
  {
@@ -299,7 +300,8 @@ class SVFFunction : public SVFValue
299
300
  friend class SVFIRBuilder;
300
301
 
301
302
  public:
302
- typedef std::vector<const SVFBasicBlock*>::const_iterator const_iterator;
303
+ typename BasicBlockGraph::IDToNodeMapTy::iterator iterator;
304
+ typedef BasicBlockGraph::IDToNodeMapTy::const_iterator const_iterator;
303
305
  typedef SVFLoopAndDomInfo::BBSet BBSet;
304
306
  typedef SVFLoopAndDomInfo::BBList BBList;
305
307
  typedef SVFLoopAndDomInfo::LoopBBs LoopBBs;
@@ -314,10 +316,10 @@ private:
314
316
  const SVFFunctionType* funcType; /// FunctionType, which is different from the type (PointerType) of this SVFFunction
315
317
  SVFLoopAndDomInfo* loopAndDom; /// the loop and dominate information
316
318
  const SVFFunction* realDefFun; /// the definition of a function across multiple modules
317
- std::vector<const SVFBasicBlock*> allBBs; /// all BasicBlocks of this function
318
319
  std::vector<const SVFArgument*> allArgs; /// all formal arguments of this function
319
320
  SVFBasicBlock *exitBlock; /// a 'single' basic block having no successors and containing return instruction in a function
320
321
  const CallGraphNode *callGraphNode; /// call graph node for this function
322
+ BasicBlockGraph* bbGraph; /// the basic block graph of this function
321
323
 
322
324
  protected:
323
325
  inline void setCallGraphNode(CallGraphNode *cgn)
@@ -325,12 +327,6 @@ protected:
325
327
  callGraphNode = cgn;
326
328
  }
327
329
 
328
- ///@{ attributes to be set only through Module builders e.g., LLVMModule
329
- inline void addBasicBlock(const SVFBasicBlock* bb)
330
- {
331
- allBBs.push_back(bb);
332
- }
333
-
334
330
  inline void addArgument(SVFArgument* arg)
335
331
  {
336
332
  allArgs.push_back(arg);
@@ -376,6 +372,21 @@ public:
376
372
  return isDecl;
377
373
  }
378
374
 
375
+ void setBasicBlockGraph(BasicBlockGraph* graph)
376
+ {
377
+ this->bbGraph = graph;
378
+ }
379
+
380
+ BasicBlockGraph* getBasicBlockGraph()
381
+ {
382
+ return bbGraph;
383
+ }
384
+
385
+ const BasicBlockGraph* getBasicBlockGraph() const
386
+ {
387
+ return bbGraph;
388
+ }
389
+
379
390
  inline bool isIntrinsic() const
380
391
  {
381
392
  return intrinsic;
@@ -411,13 +422,14 @@ public:
411
422
 
412
423
  inline bool hasBasicBlock() const
413
424
  {
414
- return !allBBs.empty();
425
+ return bbGraph && bbGraph->begin() != bbGraph->end();
415
426
  }
416
427
 
417
428
  inline const SVFBasicBlock* getEntryBlock() const
418
429
  {
419
430
  assert(hasBasicBlock() && "function does not have any Basicblock, external function?");
420
- return allBBs.front();
431
+ assert(bbGraph->begin()->second->getInEdges().size() == 0 && "the first basic block is not entry block");
432
+ return bbGraph->begin()->second;
421
433
  }
422
434
 
423
435
  /// Carefully! when you call getExitBB, you need ensure the function has return instruction
@@ -437,23 +449,19 @@ public:
437
449
  /// Carefully! 'back' is just the last basic block of function,
438
450
  /// but not necessarily a exit basic block
439
451
  /// more refer to: https://github.com/SVF-tools/SVF/pull/1262
440
- return allBBs.back();
452
+ return std::prev(bbGraph->end())->second;
441
453
  }
442
454
 
443
455
  inline const_iterator begin() const
444
456
  {
445
- return allBBs.begin();
457
+ return bbGraph->begin();
446
458
  }
447
459
 
448
460
  inline const_iterator end() const
449
461
  {
450
- return allBBs.end();
462
+ return bbGraph->end();
451
463
  }
452
464
 
453
- inline const std::vector<const SVFBasicBlock*>& getBasicBlockList() const
454
- {
455
- return allBBs;
456
- }
457
465
 
458
466
  inline const std::vector<const SVFBasicBlock*>& getReachableBBs() const
459
467
  {
@@ -523,113 +531,6 @@ public:
523
531
 
524
532
  class ICFGNode;
525
533
 
526
- class SVFBasicBlock : public SVFValue
527
- {
528
- friend class LLVMModuleSet;
529
- friend class SVFIRWriter;
530
- friend class SVFIRReader;
531
- friend class SVFIRBuilder;
532
- friend class SVFFunction;
533
- friend class ICFGBuilder;
534
- friend class ICFG;
535
-
536
- public:
537
- typedef std::vector<const ICFGNode*>::const_iterator const_iterator;
538
-
539
- private:
540
- std::vector<const ICFGNode*> allICFGNodes; ///< all ICFGNodes in this BasicBlock
541
- std::vector<const SVFBasicBlock*> succBBs; ///< all successor BasicBlocks of this BasicBlock
542
- std::vector<const SVFBasicBlock*> predBBs; ///< all predecessor BasicBlocks of this BasicBlock
543
- const SVFFunction* fun; /// Function where this BasicBlock is
544
-
545
- protected:
546
- ///@{ attributes to be set only through Module builders e.g., LLVMModule
547
-
548
- inline void addICFGNode(const ICFGNode* icfgNode)
549
- {
550
- assert(std::find(getICFGNodeList().begin(), getICFGNodeList().end(),
551
- icfgNode) == getICFGNodeList().end() && "duplicated icfgnode");
552
- allICFGNodes.push_back(icfgNode);
553
- }
554
-
555
- inline void addSuccBasicBlock(const SVFBasicBlock* succ)
556
- {
557
- succBBs.push_back(succ);
558
- }
559
-
560
- inline void addPredBasicBlock(const SVFBasicBlock* pred)
561
- {
562
- predBBs.push_back(pred);
563
- }
564
- /// @}
565
-
566
- public:
567
- /// Constructor without name
568
- SVFBasicBlock(const SVFType* ty, const SVFFunction* f);
569
- SVFBasicBlock() = delete;
570
- ~SVFBasicBlock() override;
571
-
572
- static inline bool classof(const SVFValue *node)
573
- {
574
- return node->getKind() == SVFBB;
575
- }
576
-
577
- inline const std::vector<const ICFGNode*>& getICFGNodeList() const
578
- {
579
- return allICFGNodes;
580
- }
581
-
582
- inline const_iterator begin() const
583
- {
584
- return allICFGNodes.begin();
585
- }
586
-
587
- inline const_iterator end() const
588
- {
589
- return allICFGNodes.end();
590
- }
591
-
592
- inline const SVFFunction* getParent() const
593
- {
594
- return fun;
595
- }
596
-
597
- inline const SVFFunction* getFunction() const
598
- {
599
- return fun;
600
- }
601
-
602
- inline const ICFGNode* front() const
603
- {
604
- assert(!allICFGNodes.empty() && "bb empty?");
605
- return allICFGNodes.front();
606
- }
607
-
608
- inline const ICFGNode* back() const
609
- {
610
- assert(!allICFGNodes.empty() && "bb empty?");
611
- return allICFGNodes.back();
612
- }
613
-
614
- inline const std::vector<const SVFBasicBlock*>& getSuccessors() const
615
- {
616
- return succBBs;
617
- }
618
-
619
- inline const std::vector<const SVFBasicBlock*>& getPredecessors() const
620
- {
621
- return predBBs;
622
- }
623
- u32_t getNumSuccessors() const
624
- {
625
- return succBBs.size();
626
- }
627
- u32_t getBBSuccessorPos(const SVFBasicBlock* succbb);
628
- u32_t getBBSuccessorPos(const SVFBasicBlock* succbb) const;
629
- u32_t getBBPredecessorPos(const SVFBasicBlock* succbb);
630
- u32_t getBBPredecessorPos(const SVFBasicBlock* succbb) const;
631
- };
632
-
633
534
  class SVFInstruction : public SVFValue
634
535
  {
635
536
  friend class SVFIRWriter;
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -130,13 +130,6 @@ public:
130
130
  */
131
131
  AbstractState& getAbsStateFromTrace(const ICFGNode* node);
132
132
 
133
- /**
134
- * @brief Retrieves the SVF variable from a given SVF value.
135
- * @param val Pointer to the SVF value.
136
- * @return Pointer to the corresponding SVF variable.
137
- */
138
- const SVFVar* getSVFVar(const SVFValue* val);
139
-
140
133
  protected:
141
134
  SVFIR* svfir; ///< Pointer to the SVF intermediate representation.
142
135
  ICFG* icfg; ///< Pointer to the interprocedural control flow graph.
@@ -61,14 +61,6 @@ public:
61
61
  /// Solving CFL Reachability
62
62
  virtual void solve();
63
63
 
64
- /// Interface exposed to users of our Alias analysis, given Value infos
65
- virtual AliasResult alias(const SVFValue* v1, const SVFValue* v2)
66
- {
67
- NodeID n1 = svfir->getValueNode(v1);
68
- NodeID n2 = svfir->getValueNode(v2);
69
- return alias(n1,n2);
70
- }
71
-
72
64
  /// Interface exposed to users of our Alias analysis, given PAGNodeID
73
65
  virtual AliasResult alias(NodeID node1, NodeID node2)
74
66
  {
@@ -57,7 +57,10 @@ public:
57
57
  ~DDAPass();
58
58
 
59
59
  /// Interface expose to users of our pointer analysis, given Value infos
60
- virtual AliasResult alias(const SVFValue* V1, const SVFValue* V2);
60
+ virtual AliasResult alias(const SVFVar* V1, const SVFVar* V2)
61
+ {
62
+ return alias(V1->getId(), V2->getId());
63
+ }
61
64
 
62
65
  /// Interface expose to users of our pointer analysis, given PAGNodes
63
66
  virtual AliasResult alias(NodeID V1, NodeID V2);
@@ -76,11 +76,6 @@ protected:
76
76
 
77
77
  /// Wrappers used internally, not expose to Andersen Pass
78
78
  //@{
79
- inline NodeID getValueNode(const SVFValue* value) const
80
- {
81
- return sccRepNode(pag->getValueNode(value));
82
- }
83
-
84
79
  inline NodeID getReturnNode(const SVFFunction* value) const
85
80
  {
86
81
  return pag->getReturnNode(value);
@@ -53,7 +53,6 @@ class IRGraph : public GenericGraph<SVFVar, SVFStmt>
53
53
 
54
54
  public:
55
55
  typedef Set<const SVFStmt*> SVFStmtSet;
56
- typedef Map<const SVFValue*,SVFStmtSet> ValueToEdgeMap;
57
56
 
58
57
  protected:
59
58
  SVFStmt::KindToSVFStmtMapTy KindToSVFStmtSetMap; ///< SVFIR edge map containing all PAGEdges
@@ -61,7 +60,6 @@ protected:
61
60
  bool fromFile; ///< Whether the SVFIR is built according to user specified data from a txt file
62
61
  NodeID nodeNumAfterPAGBuild; ///< initial node number after building SVFIR, excluding later added nodes, e.g., gepobj nodes
63
62
  u32_t totalPTAPAGEdge;
64
- ValueToEdgeMap valueToEdgeMap; ///< Map SVFValues (e.g., ICFGNodes) to all corresponding PAGEdges
65
63
  SymbolTableInfo* symInfo;
66
64
 
67
65
  /// Add a node into the graph
@@ -86,22 +84,11 @@ protected:
86
84
  SVFStmt* hasLabeledEdge(SVFVar* src, SVFVar* op1, SVFStmt::PEDGEK kind,
87
85
  const SVFVar* op2);
88
86
 
89
- /// Map a value to a set of edges
90
- inline void mapValueToEdge(const SVFValue* V, SVFStmt *edge)
91
- {
92
- auto inserted = valueToEdgeMap.emplace(V, SVFStmtSet{edge});
93
- if (!inserted.second)
94
- {
95
- inserted.first->second.emplace(edge);
96
- }
97
- }
98
87
  public:
99
88
  IRGraph(bool buildFromFile)
100
89
  : fromFile(buildFromFile), nodeNumAfterPAGBuild(0), totalPTAPAGEdge(0)
101
90
  {
102
91
  symInfo = SymbolTableInfo::SymbolInfo();
103
- // insert dummy value if a correct value cannot be found
104
- valueToEdgeMap[nullptr] = SVFStmtSet();
105
92
  }
106
93
 
107
94
  virtual ~IRGraph();
@@ -115,17 +102,6 @@ public:
115
102
  {
116
103
  return fromFile;
117
104
  }
118
- /// Get all SVFIR Edges that corresponds to an LLVM value
119
- inline const SVFStmtSet& getValueEdges(const SVFValue* V)
120
- {
121
- auto it = valueToEdgeMap.find(V);
122
- if (it == valueToEdgeMap.end())
123
- {
124
- //special empty set
125
- return valueToEdgeMap.at(nullptr);
126
- }
127
- return it->second;
128
- }
129
105
 
130
106
  /// Get SVFIR Node according to LLVM value
131
107
  ///getNode - Return the node corresponding to the specified pointer.
@@ -480,7 +480,7 @@ public:
480
480
  NodeBS getModInfoForCall(const CallICFGNode* cs);
481
481
  NodeBS getRefInfoForCall(const CallICFGNode* cs);
482
482
  ModRefInfo getModRefInfo(const CallICFGNode* cs);
483
- ModRefInfo getModRefInfo(const CallICFGNode* cs, const SVFValue* V);
483
+ ModRefInfo getModRefInfo(const CallICFGNode* cs, const SVFVar* V);
484
484
  ModRefInfo getModRefInfo(const CallICFGNode* cs1, const CallICFGNode* cs2);
485
485
  //@}
486
486
 
@@ -233,8 +233,8 @@ public:
233
233
  virtual void computeDDAPts(NodeID) {}
234
234
 
235
235
  /// Interface exposed to users of our pointer analysis, given Value infos
236
- virtual AliasResult alias(const SVFValue* V1,
237
- const SVFValue* V2) = 0;
236
+ virtual AliasResult alias(const SVFVar* V1,
237
+ const SVFVar* V2) = 0;
238
238
 
239
239
  /// Interface exposed to users of our pointer analysis, given PAGNodeID
240
240
  virtual AliasResult alias(NodeID node1, NodeID node2) = 0;
@@ -215,8 +215,11 @@ private:
215
215
 
216
216
  public:
217
217
  /// Interface expose to users of our pointer analysis, given Value infos
218
- AliasResult alias(const SVFValue* V1,
219
- const SVFValue* V2) override;
218
+ AliasResult alias(const SVFVar* V1,
219
+ const SVFVar* V2) override
220
+ {
221
+ return alias(V1->getId(), V2->getId());
222
+ }
220
223
 
221
224
  /// Interface expose to users of our pointer analysis, given PAGNodeID
222
225
  AliasResult alias(NodeID node1, NodeID node2) override;
@@ -501,9 +504,9 @@ public:
501
504
  }
502
505
 
503
506
  /// Interface expose to users of our pointer analysis, given Value infos
504
- virtual inline AliasResult alias(const SVFValue* V1, const SVFValue* V2)
507
+ virtual inline AliasResult alias(const SVFVar* V1, const SVFVar* V2)
505
508
  {
506
- return alias(pag->getValueNode(V1),pag->getValueNode(V2));
509
+ return alias(V1->getId(), V2->getId());
507
510
  }
508
511
  /// Interface expose to users of our pointer analysis, given two pointers
509
512
  virtual inline AliasResult alias(NodeID node1, NodeID node2)
@@ -70,7 +70,7 @@ public:
70
70
  typedef std::pair<NodeID, AccessPath> NodeAccessPath;
71
71
  typedef Map<NodeOffset,NodeID> NodeOffsetMap;
72
72
  typedef Map<NodeAccessPath,NodeID> NodeAccessPathMap;
73
- typedef Map<const SVFValue*, NodeAccessPathMap> GepValueVarMap;
73
+ typedef Map<NodeID, NodeAccessPathMap> GepValueVarMap;
74
74
  typedef std::pair<const SVFType*, std::vector<AccessPath>> SVFTypeLocSetsPair;
75
75
  typedef Map<NodeID, SVFTypeLocSetsPair> TypeLocSetsMap;
76
76
  typedef Map<NodePair,NodeID> NodePairSetMap;
@@ -343,7 +343,7 @@ public:
343
343
  //@}
344
344
 
345
345
  /// Due to constraint expression, curInst is used to distinguish different instructions (e.g., memorycpy) when creating GepValVar.
346
- NodeID getGepValVar(const SVFValue* curInst, NodeID base,
346
+ NodeID getGepValVar(NodeID curInst, NodeID base,
347
347
  const AccessPath& ap) const;
348
348
 
349
349
  /// Add/get indirect callsites
@@ -693,7 +693,7 @@ private:
693
693
  }
694
694
 
695
695
  /// Add a temp field value node, this method can only invoked by getGepValVar
696
- NodeID addGepValNode(const SVFValue* curInst,const SVFValue* val, const AccessPath& ap, NodeID i, const SVFType* type, const ICFGNode* node);
696
+ NodeID addGepValNode(NodeID curInst, const ValVar* base, const AccessPath& ap, NodeID i, const SVFType* type, const ICFGNode* node);
697
697
  /// Add a field obj node, this method can only invoked by getGepObjVar
698
698
  NodeID addGepObjNode(const BaseObjVar* baseObj, const APOffset& apOffset, const NodeID gepId);
699
699
  /// Add a field-insensitive node, this method can only invoked by getFIGepObjNode
@@ -443,7 +443,7 @@ class GepValVar: public ValVar
443
443
 
444
444
  private:
445
445
  AccessPath ap; // AccessPath
446
- ValVar* base; // base node
446
+ const ValVar* base; // base node
447
447
  const SVFType* gepValType;
448
448
 
449
449
  /// Constructor to create empty GeValVar (for SVFIRReader/deserialization)
@@ -475,7 +475,7 @@ public:
475
475
  //@}
476
476
 
477
477
  /// Constructor
478
- GepValVar(ValVar* baseNode, NodeID i, const AccessPath& ap,
478
+ GepValVar(const ValVar* baseNode, NodeID i, const AccessPath& ap,
479
479
  const SVFType* ty, const ICFGNode* node);
480
480
 
481
481
  /// offset of the base value variable
@@ -485,7 +485,7 @@ public:
485
485
  }
486
486
 
487
487
  /// Return the base object from which this GEP node came from.
488
- inline ValVar* getBaseNode(void) const
488
+ inline const ValVar* getBaseNode(void) const
489
489
  {
490
490
  return base;
491
491
  }
@@ -171,14 +171,6 @@ bool isIntrinsicInst(const SVFInstruction* inst);
171
171
  bool isIntrinsicInst(const ICFGNode* inst);
172
172
  //@}
173
173
 
174
- /// Whether an instruction is a call or invoke instruction
175
- inline bool isCallSite(const SVFValue* val)
176
- {
177
- if(SVFUtil::isa<SVFCallInst>(val))
178
- return true;
179
- else
180
- return false;
181
- }
182
174
 
183
175
  bool isCallSite(const ICFGNode* inst);
184
176
 
@@ -342,14 +334,6 @@ inline bool isProgExitFunction (const SVFFunction * fun)
342
334
  fun->getName() == "__assert_fail" );
343
335
  }
344
336
 
345
- /// Return true if this argument belongs to an uncalled function
346
- inline bool isArgOfUncalledFunction(const SVFValue* svfval)
347
- {
348
- if(const SVFArgument* arg = SVFUtil::dyn_cast<SVFArgument>(svfval))
349
- return arg->isArgOfUncalledFunction();
350
- else
351
- return false;
352
- }
353
337
 
354
338
  bool isArgOfUncalledFunction(const SVFVar* svfvar);
355
339
 
@@ -75,11 +75,7 @@ public:
75
75
  /// Destructor
76
76
  virtual ~WPAPass();
77
77
 
78
- /// Interface expose to users of our pointer analysis, given Value infos
79
- virtual AliasResult alias(const SVFValue* V1, const SVFValue* V2);
80
-
81
78
  /// Retrieve points-to set information
82
- virtual const PointsTo& getPts(const SVFValue* value);
83
79
  virtual const PointsTo& getPts(NodeID var);
84
80
 
85
81
  /// Print all alias pairs
@@ -94,9 +90,6 @@ public:
94
90
  // return getModRefInfo(callInst, Loc.Ptr);
95
91
  // }
96
92
 
97
- /// Interface of mod-ref analysis to determine whether a CallSite instruction can mod or ref a specific memory location, given Value infos
98
- virtual ModRefInfo getModRefInfo(const CallICFGNode* callInst, const SVFValue* V);
99
-
100
93
  /// Interface of mod-ref analysis between two CallSite instructions
101
94
  virtual ModRefInfo getModRefInfo(const CallICFGNode* callInst1, const CallICFGNode* callInst2);
102
95
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svf-lib",
3
- "version": "1.0.2193",
3
+ "version": "1.0.2195",
4
4
  "description": "SVF's npm support",
5
5
  "main": "index.js",
6
6
  "scripts": {