svf-lib 1.0.732 → 1.0.736

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 (94) hide show
  1. package/SVF-linux/Release-build/lib/libSvf.a +0 -0
  2. package/SVF-linux/include/DDA/ContextDDA.h +1 -1
  3. package/SVF-linux/include/DDA/DDAClient.h +8 -8
  4. package/SVF-linux/include/DDA/DDAVFSolver.h +5 -5
  5. package/SVF-linux/include/DDA/FlowDDA.h +1 -1
  6. package/SVF-linux/include/Graphs/ConsG.h +6 -6
  7. package/SVF-linux/include/Graphs/ConsGEdge.h +2 -2
  8. package/SVF-linux/include/Graphs/ConsGNode.h +1 -1
  9. package/SVF-linux/include/Graphs/ExternalPAG.h +14 -14
  10. package/SVF-linux/include/Graphs/GenericGraph.h +1 -1
  11. package/SVF-linux/include/Graphs/ICFGNode.h +14 -14
  12. package/SVF-linux/include/Graphs/IRGraph.h +236 -0
  13. package/SVF-linux/include/Graphs/OfflineConsG.h +1 -1
  14. package/SVF-linux/include/Graphs/SVFG.h +1 -1
  15. package/SVF-linux/include/Graphs/SVFGOPT.h +3 -3
  16. package/SVF-linux/include/Graphs/VFG.h +37 -52
  17. package/SVF-linux/include/Graphs/VFGNode.h +2 -3
  18. package/SVF-linux/include/MSSA/MemRegion.h +11 -11
  19. package/SVF-linux/include/MSSA/MemSSA.h +4 -4
  20. package/SVF-linux/include/MTA/FSMPTA.h +1 -1
  21. package/SVF-linux/include/MemoryModel/PAGBuilderFromFile.h +8 -8
  22. package/SVF-linux/include/MemoryModel/PTAStat.h +31 -31
  23. package/SVF-linux/include/MemoryModel/PointerAnalysis.h +9 -9
  24. package/SVF-linux/include/MemoryModel/PointerAnalysisImpl.h +3 -3
  25. package/SVF-linux/include/MemoryModel/SVFIR.h +526 -235
  26. package/SVF-linux/include/MemoryModel/SVFStatements.h +872 -0
  27. package/SVF-linux/include/MemoryModel/SVFVariables.h +842 -0
  28. package/SVF-linux/include/MemoryModel/SymbolTableInfo.h +346 -55
  29. package/SVF-linux/include/SABER/SaberSVFGBuilder.h +0 -2
  30. package/SVF-linux/include/SABER/SrcSnkDDA.h +3 -3
  31. package/SVF-linux/include/SVF-FE/Graph2Json.h +1 -3
  32. package/SVF-linux/include/SVF-FE/SVFIRBuilder.h +398 -0
  33. package/SVF-linux/include/SVF-FE/SymbolTableBuilder.h +0 -1
  34. package/SVF-linux/include/Util/CFLSolver.h +1 -1
  35. package/SVF-linux/include/Util/ExtAPI.h +1 -1
  36. package/SVF-linux/include/Util/IRAnnotator.h +6 -6
  37. package/SVF-linux/include/Util/Options.h +1 -1
  38. package/SVF-linux/include/Util/TypeBasedHeapCloning.h +11 -11
  39. package/SVF-linux/include/WPA/Andersen.h +11 -11
  40. package/SVF-linux/include/WPA/AndersenSFR.h +4 -4
  41. package/SVF-linux/include/WPA/FlowSensitive.h +2 -2
  42. package/SVF-linux/include/WPA/FlowSensitiveTBHC.h +1 -1
  43. package/SVF-linux/include/WPA/Steensgaard.h +2 -2
  44. package/SVF-linux/include/WPA/TypeAnalysis.h +1 -1
  45. package/SVF-linux/include/WPA/VersionedFlowSensitive.h +2 -2
  46. package/SVF-linux/include/WPA/WPAStat.h +1 -2
  47. package/SVF-osx/Release-build/lib/CUDD/libCudd.a +0 -0
  48. package/SVF-osx/Release-build/lib/libSvf.a +0 -0
  49. package/SVF-osx/include/DDA/ContextDDA.h +1 -1
  50. package/SVF-osx/include/DDA/DDAClient.h +8 -8
  51. package/SVF-osx/include/DDA/DDAVFSolver.h +5 -5
  52. package/SVF-osx/include/DDA/FlowDDA.h +1 -1
  53. package/SVF-osx/include/Graphs/ConsG.h +6 -6
  54. package/SVF-osx/include/Graphs/ConsGEdge.h +2 -2
  55. package/SVF-osx/include/Graphs/ConsGNode.h +1 -1
  56. package/SVF-osx/include/Graphs/ExternalPAG.h +14 -14
  57. package/SVF-osx/include/Graphs/GenericGraph.h +1 -1
  58. package/SVF-osx/include/Graphs/ICFGNode.h +14 -14
  59. package/SVF-osx/include/Graphs/IRGraph.h +236 -0
  60. package/SVF-osx/include/Graphs/OfflineConsG.h +1 -1
  61. package/SVF-osx/include/Graphs/SVFG.h +1 -1
  62. package/SVF-osx/include/Graphs/SVFGOPT.h +3 -3
  63. package/SVF-osx/include/Graphs/VFG.h +37 -52
  64. package/SVF-osx/include/Graphs/VFGNode.h +2 -3
  65. package/SVF-osx/include/MSSA/MemRegion.h +11 -11
  66. package/SVF-osx/include/MSSA/MemSSA.h +4 -4
  67. package/SVF-osx/include/MTA/FSMPTA.h +1 -1
  68. package/SVF-osx/include/MemoryModel/PAGBuilderFromFile.h +8 -8
  69. package/SVF-osx/include/MemoryModel/PTAStat.h +31 -31
  70. package/SVF-osx/include/MemoryModel/PointerAnalysis.h +9 -9
  71. package/SVF-osx/include/MemoryModel/PointerAnalysisImpl.h +3 -3
  72. package/SVF-osx/include/MemoryModel/SVFIR.h +526 -235
  73. package/SVF-osx/include/MemoryModel/SVFStatements.h +872 -0
  74. package/SVF-osx/include/MemoryModel/SVFVariables.h +842 -0
  75. package/SVF-osx/include/MemoryModel/SymbolTableInfo.h +346 -55
  76. package/SVF-osx/include/SABER/SaberSVFGBuilder.h +0 -2
  77. package/SVF-osx/include/SABER/SrcSnkDDA.h +3 -3
  78. package/SVF-osx/include/SVF-FE/Graph2Json.h +1 -3
  79. package/SVF-osx/include/SVF-FE/SVFIRBuilder.h +398 -0
  80. package/SVF-osx/include/SVF-FE/SymbolTableBuilder.h +0 -1
  81. package/SVF-osx/include/Util/CFLSolver.h +1 -1
  82. package/SVF-osx/include/Util/ExtAPI.h +1 -1
  83. package/SVF-osx/include/Util/IRAnnotator.h +6 -6
  84. package/SVF-osx/include/Util/Options.h +1 -1
  85. package/SVF-osx/include/Util/TypeBasedHeapCloning.h +11 -11
  86. package/SVF-osx/include/WPA/Andersen.h +11 -11
  87. package/SVF-osx/include/WPA/AndersenSFR.h +4 -4
  88. package/SVF-osx/include/WPA/FlowSensitive.h +2 -2
  89. package/SVF-osx/include/WPA/FlowSensitiveTBHC.h +1 -1
  90. package/SVF-osx/include/WPA/Steensgaard.h +2 -2
  91. package/SVF-osx/include/WPA/TypeAnalysis.h +1 -1
  92. package/SVF-osx/include/WPA/VersionedFlowSensitive.h +2 -2
  93. package/SVF-osx/include/WPA/WPAStat.h +1 -2
  94. package/package.json +1 -1
@@ -0,0 +1,398 @@
1
+ //===- SVFIRBuilder.h -- Building SVFIR-------------------------------------------//
2
+ //
3
+ // SVF: Static Value-Flow Analysis
4
+ //
5
+ // Copyright (C) <2013-2017> <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 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 General Public License for more details.
17
+
18
+ // You should have received a copy of the GNU General Public License
19
+ // along with this program. If not, see <http://www.gnu.org/licenses/>.
20
+ //
21
+ //===----------------------------------------------------------------------===//
22
+
23
+ /*
24
+ * SVFIRBuilder.h
25
+ *
26
+ * Created on: Nov 1, 2013
27
+ * Author: Yulei Sui
28
+ */
29
+
30
+ #ifndef PAGBUILDER_H_
31
+ #define PAGBUILDER_H_
32
+
33
+ #include "MemoryModel/SVFIR.h"
34
+ #include "Util/ExtAPI.h"
35
+ #include "SVF-FE/ICFGBuilder.h"
36
+
37
+ namespace SVF
38
+ {
39
+
40
+ class SVFModule;
41
+ /*!
42
+ * SVFIR Builder to create SVF variables and statements and PAG
43
+ */
44
+ class SVFIRBuilder: public llvm::InstVisitor<SVFIRBuilder>
45
+ {
46
+
47
+ private:
48
+ SVFIR* pag;
49
+ SVFModule* svfMod;
50
+ const BasicBlock* curBB; ///< Current basic block during SVFIR construction when visiting the module
51
+ const Value* curVal; ///< Current Value during SVFIR construction when visiting the module
52
+
53
+ public:
54
+ /// Constructor
55
+ SVFIRBuilder(): pag(SVFIR::getPAG()), svfMod(nullptr), curBB(nullptr),curVal(nullptr)
56
+ {
57
+ }
58
+ /// Destructor
59
+ virtual ~SVFIRBuilder()
60
+ {
61
+ }
62
+
63
+ /// Start building SVFIR here
64
+ virtual SVFIR* build(SVFModule* svfModule);
65
+
66
+ /// Return SVFIR
67
+ SVFIR* getPAG() const
68
+ {
69
+ return pag;
70
+ }
71
+
72
+ /// Initialize nodes and edges
73
+ //@{
74
+ void initialiseNodes();
75
+ void addEdge(NodeID src, NodeID dst, PAGEdge::PEDGEK kind,
76
+ Size_t offset = 0, Instruction* cs = nullptr);
77
+ // @}
78
+
79
+ /// Sanity check for SVFIR
80
+ void sanityCheck();
81
+
82
+ /// Get different kinds of node
83
+ //@{
84
+ // GetValNode - Return the value node according to a LLVM Value.
85
+ NodeID getValueNode(const Value *V)
86
+ {
87
+ // first handle gep edge if val if a constant expression
88
+ processCE(V);
89
+
90
+ // strip off the constant cast and return the value node
91
+ return pag->getValueNode(V);
92
+ }
93
+
94
+ /// GetObject - Return the object node (stack/global/heap/function) according to a LLVM Value
95
+ inline NodeID getObjectNode(const Value *V)
96
+ {
97
+ return pag->getObjectNode(V);
98
+ }
99
+
100
+ /// getReturnNode - Return the node representing the unique return value of a function.
101
+ inline NodeID getReturnNode(const SVFFunction *func)
102
+ {
103
+ return pag->getReturnNode(func);
104
+ }
105
+
106
+ /// getVarargNode - Return the node representing the unique variadic argument of a function.
107
+ inline NodeID getVarargNode(const SVFFunction *func)
108
+ {
109
+ return pag->getVarargNode(func);
110
+ }
111
+ //@}
112
+
113
+ /// Handle globals including (global variable and functions)
114
+ //@{
115
+ void visitGlobal(SVFModule* svfModule);
116
+ void InitialGlobal(const GlobalVariable *gvar, Constant *C,
117
+ u32_t offset);
118
+ NodeID getGlobalVarField(const GlobalVariable *gvar, u32_t offset);
119
+ //@}
120
+
121
+ /// Process constant expression
122
+ void processCE(const Value *val);
123
+
124
+ /// Compute offset of a gep instruction or gep constant expression
125
+ bool computeGepOffset(const User *V, LocationSet& ls);
126
+
127
+ /// Handle direct call
128
+ void handleDirectCall(CallSite cs, const SVFFunction *F);
129
+
130
+ /// Handle indirect call
131
+ void handleIndCall(CallSite cs);
132
+
133
+ /// Handle external call
134
+ //@{
135
+ virtual void handleExtCall(CallSite cs, const SVFFunction *F);
136
+ const Type *getBaseTypeAndFlattenedFields(Value* v, std::vector<LocationSet> &fields);
137
+ void addComplexConsForExt(Value *D, Value *S,u32_t sz = 0);
138
+ //@}
139
+
140
+ /// Our visit overrides.
141
+ //@{
142
+ // Instructions that cannot be folded away.
143
+ virtual void visitAllocaInst(AllocaInst &AI);
144
+ void visitPHINode(PHINode &I);
145
+ void visitStoreInst(StoreInst &I);
146
+ void visitLoadInst(LoadInst &I);
147
+ void visitGetElementPtrInst(GetElementPtrInst &I);
148
+ void visitCallInst(CallInst &I)
149
+ {
150
+ visitCallSite(&I);
151
+ }
152
+ void visitInvokeInst(InvokeInst &II)
153
+ {
154
+ visitCallSite(&II);
155
+ }
156
+ void visitCallBrInst(CallBrInst &I) {
157
+ return visitCallSite(&I);
158
+ }
159
+ void visitCallSite(CallSite cs);
160
+ void visitReturnInst(ReturnInst &I);
161
+ void visitCastInst(CastInst &I);
162
+ void visitSelectInst(SelectInst &I);
163
+ void visitExtractValueInst(ExtractValueInst &EVI);
164
+ void visitBranchInst(BranchInst &I);
165
+ void visitSwitchInst(SwitchInst &I);
166
+ void visitInsertValueInst(InsertValueInst &I)
167
+ {
168
+ addBlackHoleAddrEdge(getValueNode(&I));
169
+ }
170
+ // TerminatorInst and UnwindInst have been removed since llvm-8.0.0
171
+ // void visitTerminatorInst(TerminatorInst &TI) {}
172
+ // void visitUnwindInst(UnwindInst &I) { /*returns void*/}
173
+
174
+ void visitBinaryOperator(BinaryOperator &I);
175
+ void visitUnaryOperator(UnaryOperator &I);
176
+ void visitCmpInst(CmpInst &I);
177
+
178
+ /// TODO: var arguments need to be handled.
179
+ /// https://llvm.org/docs/LangRef.html#id1911
180
+ void visitVAArgInst(VAArgInst&);
181
+ void visitVACopyInst(VACopyInst&){}
182
+ void visitVAEndInst(VAEndInst&){}
183
+ void visitVAStartInst(VAStartInst&){}
184
+
185
+ /// <result> = freeze ty <val>
186
+ /// If <val> is undef or poison, ‘freeze’ returns an arbitrary, but fixed value of type `ty`
187
+ /// Otherwise, this instruction is a no-op and returns the input <val>
188
+ void visitFreezeInst(FreezeInst& I);
189
+
190
+ void visitExtractElementInst(ExtractElementInst &I);
191
+
192
+ void visitInsertElementInst(InsertElementInst &I)
193
+ {
194
+ addBlackHoleAddrEdge(getValueNode(&I));
195
+ }
196
+ void visitShuffleVectorInst(ShuffleVectorInst &I)
197
+ {
198
+ addBlackHoleAddrEdge(getValueNode(&I));
199
+ }
200
+ void visitLandingPadInst(LandingPadInst &I)
201
+ {
202
+ addBlackHoleAddrEdge(getValueNode(&I));
203
+ }
204
+
205
+ /// Instruction not that often
206
+ void visitResumeInst(ResumeInst&) /*returns void*/
207
+ {
208
+ }
209
+ void visitUnreachableInst(UnreachableInst&) /*returns void*/
210
+ {
211
+ }
212
+ void visitFenceInst(FenceInst &I) /*returns void*/
213
+ {
214
+ addBlackHoleAddrEdge(getValueNode(&I));
215
+ }
216
+ void visitAtomicCmpXchgInst(AtomicCmpXchgInst &I)
217
+ {
218
+ addBlackHoleAddrEdge(getValueNode(&I));
219
+ }
220
+ void visitAtomicRMWInst(AtomicRMWInst &I)
221
+ {
222
+ addBlackHoleAddrEdge(getValueNode(&I));
223
+ }
224
+
225
+ /// Provide base case for our instruction visit.
226
+ inline void visitInstruction(Instruction&)
227
+ {
228
+ // If a new instruction is added to LLVM that we don't handle.
229
+ // TODO: ignore here:
230
+ }
231
+ //}@
232
+
233
+ /// Set current basic block in order to keep track of control flow information
234
+ inline void setCurrentLocation(const Value* val, const BasicBlock* bb)
235
+ {
236
+ curBB = bb;
237
+ curVal = val;
238
+ }
239
+ inline const Value *getCurrentValue() const
240
+ {
241
+ return curVal;
242
+ }
243
+ inline const BasicBlock *getCurrentBB() const
244
+ {
245
+ return curBB;
246
+ }
247
+
248
+ /// Add global black hole Address edge
249
+ void addGlobalBlackHoleAddrEdge(NodeID node, const ConstantExpr *int2Ptrce)
250
+ {
251
+ const Value* cval = getCurrentValue();
252
+ const BasicBlock* cbb = getCurrentBB();
253
+ setCurrentLocation(int2Ptrce,nullptr);
254
+ addBlackHoleAddrEdge(node);
255
+ setCurrentLocation(cval,cbb);
256
+ }
257
+
258
+ /// Add NullPtr PAGNode
259
+ inline NodeID addNullPtrNode()
260
+ {
261
+ NodeID nullPtr = pag->addDummyValNode(pag->getNullPtr());
262
+ /// let all undef value or non-determined pointers points-to black hole
263
+ LLVMContext &cxt = LLVMModuleSet::getLLVMModuleSet()->getContext();
264
+ ConstantPointerNull *constNull = ConstantPointerNull::get(Type::getInt8PtrTy(cxt));
265
+ setCurrentLocation(constNull, nullptr);
266
+ addBlackHoleAddrEdge(pag->getBlkPtr());
267
+ return nullPtr;
268
+ }
269
+
270
+ NodeID getGepValNode(const Value* val, const LocationSet& ls, const Type *baseType, u32_t fieldidx);
271
+
272
+ void setCurrentBBAndValueForPAGEdge(PAGEdge* edge);
273
+
274
+ inline PAGEdge* addBlackHoleAddrEdge(NodeID node)
275
+ {
276
+ PAGEdge *edge = pag->addBlackHoleAddrPE(node);
277
+ setCurrentBBAndValueForPAGEdge(edge);
278
+ return edge;
279
+ }
280
+
281
+ /// Add Address edge
282
+ inline AddrPE* addAddrEdge(NodeID src, NodeID dst)
283
+ {
284
+ AddrPE *edge = pag->addAddrPE(src, dst);
285
+ setCurrentBBAndValueForPAGEdge(edge);
286
+ return edge;
287
+ }
288
+ /// Add Copy edge
289
+ inline CopyPE* addCopyEdge(NodeID src, NodeID dst)
290
+ {
291
+ CopyPE *edge = pag->addCopyPE(src, dst);
292
+ setCurrentBBAndValueForPAGEdge(edge);
293
+ return edge;
294
+ }
295
+ /// Add Copy edge
296
+ inline PhiPE* addPhiNode(NodeID res, NodeID opnd)
297
+ {
298
+ const CopyPE* copy = addCopyEdge(opnd, res);
299
+ PhiPE *edge = pag->addPhiNode(res,opnd);
300
+ setCurrentBBAndValueForPAGEdge(edge);
301
+ return edge;
302
+ }
303
+ /// Add Copy edge
304
+ inline CmpPE* addCmpEdge(NodeID op1, NodeID op2, NodeID dst)
305
+ {
306
+ CmpPE *edge = pag->addCmpPE(op1, op2, dst);
307
+ setCurrentBBAndValueForPAGEdge(edge);
308
+ return edge;
309
+ }
310
+ /// Add Copy edge
311
+ inline BinaryOPPE* addBinaryOPEdge(NodeID op1, NodeID op2, NodeID dst)
312
+ {
313
+ BinaryOPPE *edge = pag->addBinaryOPPE(op1, op2, dst);
314
+ setCurrentBBAndValueForPAGEdge(edge);
315
+ return edge;
316
+ }
317
+ /// Add Unary edge
318
+ inline UnaryOPPE* addUnaryOPEdge(NodeID src, NodeID dst)
319
+ {
320
+ UnaryOPPE *edge = pag->addUnaryOPPE(src, dst);
321
+ setCurrentBBAndValueForPAGEdge(edge);
322
+ return edge;
323
+ }
324
+ /// Add Load edge
325
+ inline LoadPE* addLoadEdge(NodeID src, NodeID dst)
326
+ {
327
+ LoadPE *edge = pag->addLoadPE(src, dst);
328
+ setCurrentBBAndValueForPAGEdge(edge);
329
+ return edge;
330
+ }
331
+ /// Add Store edge
332
+ inline StorePE* addStoreEdge(NodeID src, NodeID dst)
333
+ {
334
+ IntraBlockNode* node;
335
+ if(const Instruction* inst = SVFUtil::dyn_cast<Instruction>(curVal))
336
+ node = pag->getICFG()->getIntraBlockNode(inst);
337
+ else
338
+ node = nullptr;
339
+ StorePE *edge = pag->addStorePE(src, dst, node);
340
+ setCurrentBBAndValueForPAGEdge(edge);
341
+ return edge;
342
+ }
343
+ /// Add Call edge
344
+ inline CallPE* addCallEdge(NodeID src, NodeID dst, const CallBlockNode* cs)
345
+ {
346
+ CallPE *edge = pag->addCallPE(src, dst, cs);
347
+ setCurrentBBAndValueForPAGEdge(edge);
348
+ return edge;
349
+ }
350
+ /// Add Return edge
351
+ inline RetPE* addRetEdge(NodeID src, NodeID dst, const CallBlockNode* cs)
352
+ {
353
+ RetPE *edge = pag->addRetPE(src, dst, cs);
354
+ setCurrentBBAndValueForPAGEdge(edge);
355
+ return edge;
356
+ }
357
+ /// Add Gep edge
358
+ inline GepPE* addGepEdge(NodeID src, NodeID dst, const LocationSet& ls, bool constGep)
359
+ {
360
+ GepPE *edge = pag->addGepPE(src, dst, ls, constGep);
361
+ setCurrentBBAndValueForPAGEdge(edge);
362
+ return edge;
363
+ }
364
+ /// Add Offset(Gep) edge
365
+ inline NormalGepPE* addNormalGepEdge(NodeID src, NodeID dst, const LocationSet& ls)
366
+ {
367
+ NormalGepPE *edge = pag->addNormalGepPE(src, dst, ls);
368
+ setCurrentBBAndValueForPAGEdge(edge);
369
+ return edge;
370
+ }
371
+ /// Add Variant(Gep) edge
372
+ inline VariantGepPE* addVariantGepEdge(NodeID src, NodeID dst)
373
+ {
374
+ VariantGepPE *edge = pag->addVariantGepPE(src, dst);
375
+ setCurrentBBAndValueForPAGEdge(edge);
376
+ return edge;
377
+ }
378
+ /// Add Thread fork edge for parameter passing
379
+ inline TDForkPE* addThreadForkEdge(NodeID src, NodeID dst, const CallBlockNode* cs)
380
+ {
381
+ TDForkPE *edge = pag->addThreadForkPE(src, dst, cs);
382
+ setCurrentBBAndValueForPAGEdge(edge);
383
+ return edge;
384
+ }
385
+ /// Add Thread join edge for parameter passing
386
+ inline TDJoinPE* addThreadJoinEdge(NodeID src, NodeID dst, const CallBlockNode* cs)
387
+ {
388
+ TDJoinPE *edge = pag->addThreadJoinPE(src, dst, cs);
389
+ setCurrentBBAndValueForPAGEdge(edge);
390
+ return edge;
391
+ }
392
+ //@}
393
+
394
+ };
395
+
396
+ } // End namespace SVF
397
+
398
+ #endif /* PAGBUILDER_H_ */
@@ -30,7 +30,6 @@
30
30
  #ifndef SymbolTableBuilder_H_
31
31
  #define SymbolTableBuilder_H_
32
32
 
33
- #include "MemoryModel/SVFSymbols.h"
34
33
  #include "SVF-FE/LLVMModule.h"
35
34
  #include "MemoryModel/SymbolTableInfo.h"
36
35
 
@@ -37,7 +37,7 @@ namespace SVF
37
37
  {
38
38
 
39
39
  /*
40
- * Generic CFL solver for demand-driven analysis based on different graphs (e.g. PAG, VFG, ThreadVFG)
40
+ * Generic CFL solver for demand-driven analysis based on different graphs (e.g. SVFIR, VFG, ThreadVFG)
41
41
  * Extend this class for sophisticated CFL-reachability resolution (e.g. field, flow, path)
42
42
  */
43
43
  template<class GraphType, class DPIm = DPItem>
@@ -105,7 +105,7 @@ private:
105
105
  isext_cache.clear();
106
106
  }
107
107
 
108
- // Singleton pattern here to enable instance of PAG can only be created once.
108
+ // Singleton pattern here to enable instance of SVFIR can only be created once.
109
109
  static ExtAPI* extAPI;
110
110
 
111
111
  public:
@@ -8,7 +8,7 @@
8
8
  #ifndef IRANNOTATOR_H_
9
9
  #define IRANNOTATOR_H_
10
10
 
11
- #include "Graphs/PAG.h"
11
+ #include "MemoryModel/SVFIR.h"
12
12
  #include "MemoryModel/PointerAnalysisImpl.h"
13
13
  #include "Util/SVFUtil.h"
14
14
  #include "llvm/IR/Metadata.h"
@@ -28,7 +28,7 @@ public:
28
28
  {}
29
29
  ~IRAnnotator() {}
30
30
 
31
- void processAndersenResults(PAG *pag, BVDataPTAImpl *ptsTo, bool writeFlag)
31
+ void processAndersenResults(SVFIR *pag, BVDataPTAImpl *ptsTo, bool writeFlag)
32
32
  {
33
33
  this->ptsTo = ptsTo;
34
34
  mainModule = LLVMModuleSet::getLLVMModuleSet()->getMainLLVMModule();
@@ -36,7 +36,7 @@ public:
36
36
  // Add a named metadata node used to check whether or not
37
37
  // this IR has been annotated with Andersen information
38
38
  if (writeFlag)
39
- mainModule->getOrInsertNamedMetadata("PAG-Annotated");
39
+ mainModule->getOrInsertNamedMetadata("SVFIR-Annotated");
40
40
 
41
41
  for (auto it = pag->begin(); it != pag->end(); ++it)
42
42
  {
@@ -59,7 +59,7 @@ public:
59
59
  }
60
60
 
61
61
  private:
62
- // Write the PAGgepNode to the IR such that metadata name is the PAG node id and the operands
62
+ // Write the PAGgepNode to the IR such that metadata name is the SVFIR node id and the operands
63
63
  // are its base node's id and location offset
64
64
  void writePAGgepNode(SVF::NodeID nodeId, GepObjPN* gepNode)
65
65
  {
@@ -77,9 +77,9 @@ private:
77
77
  mainModule->getOrInsertNamedMetadata(label)->addOperand(metadata);
78
78
  }
79
79
 
80
- // Reads the PAGGepNodes in the annotated IR and creates a new PAG Node based on the
80
+ // Reads the PAGGepNodes in the annotated IR and creates a new SVFIR Node based on the
81
81
  // data contained in the operands of the metadata node
82
- void readPAGgepNodes(PAG *pag)
82
+ void readPAGgepNodes(SVFIR *pag)
83
83
  {
84
84
  for (auto it = mainModule->named_metadata_begin(); it != mainModule->named_metadata_end(); ++it)
85
85
  {
@@ -108,7 +108,7 @@ public:
108
108
  // Offline constraint graph (OfflineConsG.cpp)
109
109
  static const llvm::cl::opt<bool> OCGDotGraph;
110
110
 
111
- // Program Assignment Graph for pointer analysis (PAG.cpp)
111
+ // Program Assignment Graph for pointer analysis (SVFIR.cpp)
112
112
  static llvm::cl::opt<bool> HandBlackHole;
113
113
  static const llvm::cl::opt<bool> FirstFieldEqBase;
114
114
 
@@ -11,7 +11,7 @@
11
11
  */
12
12
 
13
13
  #include "SVF-FE/DCHG.h"
14
- #include "Graphs/PAG.h"
14
+ #include "MemoryModel/SVFIR.h"
15
15
  #include "MemoryModel/PointerAnalysisImpl.h"
16
16
  #include "Util/BasicTypes.h"
17
17
 
@@ -48,8 +48,8 @@ protected:
48
48
 
49
49
  /// DCHG *must* be set by extending class once the DCHG is available.
50
50
  void setDCHG(DCHGraph *dchg);
51
- /// PAG *must* be set by extending class once the PAG is available.
52
- void setPAG(PAG *pag);
51
+ /// SVFIR *must* be set by extending class once the SVFIR is available.
52
+ void setPAG(SVFIR *pag);
53
53
 
54
54
  /// Check if an object is a black hole obj or a constant object. Required since
55
55
  /// other implementations obviously do not account for clones.
@@ -97,7 +97,7 @@ protected:
97
97
  const NodeBS &getGepObjs(NodeID base);
98
98
 
99
99
  /// Returns the GEP object node(s) of base for ls. This may include clones.
100
- /// If there are no GEP objects, then getGepObjNode is called on the PAG
100
+ /// If there are no GEP objects, then getGepObjNode is called on the SVFIR
101
101
  /// (through base's getGepObjNode) which will create one.
102
102
  const NodeBS getGepObjClones(NodeID base, unsigned offset);
103
103
 
@@ -109,11 +109,11 @@ protected:
109
109
  /// as a result of reuse.
110
110
  NodeID cloneObject(NodeID o, const DIType *type, bool reuse);
111
111
 
112
- /// Add clone dummy object node to PAG.
112
+ /// Add clone dummy object node to SVFIR.
113
113
  inline NodeID addCloneDummyObjNode(const MemObj *mem);
114
- /// Add clone GEP object node to PAG.
114
+ /// Add clone GEP object node to SVFIR.
115
115
  inline NodeID addCloneGepObjNode(const MemObj *mem, const LocationSet &l);
116
- /// Add clone FI object node to PAG.
116
+ /// Add clone FI object node to SVFIR.
117
117
  inline NodeID addCloneFIObjNode(const MemObj *mem);
118
118
 
119
119
  /// Returns the ctir type attached to the value, nullptr if non-existant.
@@ -145,20 +145,20 @@ protected:
145
145
  private:
146
146
  /// PTA extending this class.
147
147
  BVDataPTAImpl *pta;
148
- /// PAG the PTA uses. Just a shortcut for getPAG().
149
- PAG *ppag = nullptr;
148
+ /// SVFIR the PTA uses. Just a shortcut for getPAG().
149
+ SVFIR *ppag = nullptr;
150
150
 
151
151
  /// Object -> its type.
152
152
  Map<NodeID, const DIType *> objToType;
153
153
  /// Object -> allocation site.
154
154
  /// The value NodeID depends on the pointer analysis (could be
155
- /// an SVFG node or PAG node for example).
155
+ /// an SVFG node or SVFIR node for example).
156
156
  Map<NodeID, NodeID> objToAllocation;
157
157
  /// (Original) object -> set of its clones.
158
158
  Map<NodeID, NodeBS> objToClones;
159
159
  /// (Clone) object -> original object (opposite of objToclones).
160
160
  Map<NodeID, NodeID> cloneToOriginalObj;
161
- /// Maps nodes (a location like a PAG node or SVFG node) to their filter set.
161
+ /// Maps nodes (a location like a SVFIR node or SVFG node) to their filter set.
162
162
  Map<NodeID, PointsTo> locToFilterSet;
163
163
  /// Maps objects to the GEP nodes beneath them.
164
164
  Map<NodeID, NodeBS> objToGeps;
@@ -33,7 +33,7 @@
33
33
  #include "MemoryModel/PointerAnalysisImpl.h"
34
34
  #include "WPA/WPAStat.h"
35
35
  #include "WPA/WPASolver.h"
36
- #include "Graphs/PAG.h"
36
+ #include "MemoryModel/SVFIR.h"
37
37
  #include "Graphs/ConsG.h"
38
38
  #include "Graphs/OfflineConsG.h"
39
39
 
@@ -52,7 +52,7 @@ class AndersenBase: public WPAConstraintSolver, public BVDataPTAImpl
52
52
  public:
53
53
 
54
54
  /// Constructor
55
- AndersenBase(PAG* _pag, PTATY type = Andersen_BASE, bool alias_check = true)
55
+ AndersenBase(SVFIR* _pag, PTATY type = Andersen_BASE, bool alias_check = true)
56
56
  : BVDataPTAImpl(_pag, type, alias_check), consCG(nullptr)
57
57
  {
58
58
  iterationForPrintStat = OnTheFlyIterBudgetForStat;
@@ -155,7 +155,7 @@ public:
155
155
  typedef OrderedMap<CallSite, NodeID> CallSite2DummyValPN;
156
156
 
157
157
  /// Constructor
158
- Andersen(PAG* _pag, PTATY type = Andersen_WPA, bool alias_check = true)
158
+ Andersen(SVFIR* _pag, PTATY type = Andersen_WPA, bool alias_check = true)
159
159
  : AndersenBase(_pag, type, alias_check), pwcOpt(false), diffOpt(true)
160
160
  {
161
161
  }
@@ -424,10 +424,10 @@ private:
424
424
  static AndersenWaveDiff* diffWave; // static instance
425
425
 
426
426
  public:
427
- AndersenWaveDiff(PAG* _pag, PTATY type = AndersenWaveDiff_WPA, bool alias_check = true): Andersen(_pag, type, alias_check) {}
427
+ AndersenWaveDiff(SVFIR* _pag, PTATY type = AndersenWaveDiff_WPA, bool alias_check = true): Andersen(_pag, type, alias_check) {}
428
428
 
429
429
  /// Create an singleton instance directly instead of invoking llvm pass manager
430
- static AndersenWaveDiff* createAndersenWaveDiff(PAG* _pag)
430
+ static AndersenWaveDiff* createAndersenWaveDiff(SVFIR* _pag)
431
431
  {
432
432
  if(diffWave==nullptr)
433
433
  {
@@ -475,13 +475,13 @@ private:
475
475
  NodeSet lcdCandidates;
476
476
 
477
477
  public:
478
- AndersenLCD(PAG* _pag, PTATY type = AndersenLCD_WPA) :
478
+ AndersenLCD(SVFIR* _pag, PTATY type = AndersenLCD_WPA) :
479
479
  Andersen(_pag, type), metEdges({}), lcdCandidates( {})
480
480
  {
481
481
  }
482
482
 
483
483
  /// Create an singleton instance directly instead of invoking llvm pass manager
484
- static AndersenLCD* createAndersenLCD(PAG* _pag)
484
+ static AndersenLCD* createAndersenLCD(SVFIR* _pag)
485
485
  {
486
486
  if (lcdAndersen == nullptr)
487
487
  {
@@ -557,13 +557,13 @@ private:
557
557
  OfflineConsG* oCG;
558
558
 
559
559
  public:
560
- AndersenHCD(PAG* _pag, PTATY type = AndersenHCD_WPA) :
560
+ AndersenHCD(SVFIR* _pag, PTATY type = AndersenHCD_WPA) :
561
561
  Andersen(_pag, type), oCG(nullptr)
562
562
  {
563
563
  }
564
564
 
565
565
  /// Create an singleton instance directly instead of invoking llvm pass manager
566
- static AndersenHCD *createAndersenHCD(PAG* _pag)
566
+ static AndersenHCD *createAndersenHCD(SVFIR* _pag)
567
567
  {
568
568
  if (hcdAndersen == nullptr)
569
569
  {
@@ -628,13 +628,13 @@ private:
628
628
  static AndersenHLCD* hlcdAndersen;
629
629
 
630
630
  public:
631
- AndersenHLCD(PAG* _pag, PTATY type = AndersenHLCD_WPA) :
631
+ AndersenHLCD(SVFIR* _pag, PTATY type = AndersenHLCD_WPA) :
632
632
  Andersen(_pag, type), AndersenHCD(_pag, type), AndersenLCD(_pag, type)
633
633
  {
634
634
  }
635
635
 
636
636
  /// Create an singleton instance directly instead of invoking llvm pass manager
637
- static AndersenHLCD *createAndersenHLCD(PAG* _pag)
637
+ static AndersenHLCD *createAndersenHLCD(SVFIR* _pag)
638
638
  {
639
639
  if (hlcdAndersen == nullptr)
640
640
  {
@@ -52,13 +52,13 @@ protected:
52
52
  NodeToNodeMap pwcReps;
53
53
 
54
54
  public:
55
- AndersenSCD(PAG* _pag, PTATY type = AndersenSCD_WPA) :
55
+ AndersenSCD(SVFIR* _pag, PTATY type = AndersenSCD_WPA) :
56
56
  Andersen(_pag,type)
57
57
  {
58
58
  }
59
59
 
60
60
  /// Create an singleton instance directly instead of invoking llvm pass manager
61
- static AndersenSCD *createAndersenSCD(PAG* _pag)
61
+ static AndersenSCD *createAndersenSCD(SVFIR* _pag)
62
62
  {
63
63
  if (scdAndersen == nullptr)
64
64
  {
@@ -114,13 +114,13 @@ private:
114
114
  FieldReps fieldReps;
115
115
 
116
116
  public:
117
- AndersenSFR(PAG* _pag, PTATY type = AndersenSFR_WPA) :
117
+ AndersenSFR(SVFIR* _pag, PTATY type = AndersenSFR_WPA) :
118
118
  AndersenSCD(_pag, type), csc(nullptr)
119
119
  {
120
120
  }
121
121
 
122
122
  /// Create an singleton instance directly instead of invoking llvm pass manager
123
- static AndersenSFR *createAndersenSFR(PAG* _pag)
123
+ static AndersenSFR *createAndersenSFR(SVFIR* _pag)
124
124
  {
125
125
  if (sfrAndersen == nullptr)
126
126
  {
@@ -58,7 +58,7 @@ public:
58
58
  typedef BVDataPTAImpl::MutDFPTDataTy::PtsMap PtsMap;
59
59
 
60
60
  /// Constructor
61
- FlowSensitive(PAG* _pag, PTATY type = FSSPARSE_WPA) : WPASVFGFSSolver(), BVDataPTAImpl(_pag, type)
61
+ FlowSensitive(SVFIR* _pag, PTATY type = FSSPARSE_WPA) : WPASVFGFSSolver(), BVDataPTAImpl(_pag, type)
62
62
  {
63
63
  svfg = nullptr;
64
64
  solveTime = sccTime = processTime = propagationTime = updateTime = 0;
@@ -81,7 +81,7 @@ public:
81
81
  }
82
82
 
83
83
  /// Create signle instance of flow-sensitive pointer analysis
84
- static FlowSensitive* createFSWPA(PAG* _pag)
84
+ static FlowSensitive* createFSWPA(SVFIR* _pag)
85
85
  {
86
86
  if (fspta == nullptr)
87
87
  {