svf-lib 1.0.1301 → 1.0.1302

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 (45) hide show
  1. package/package.json +1 -1
  2. package/SVF-linux/include/SVF-FE/BasicTypes.h +0 -219
  3. package/SVF-linux/include/SVF-FE/BreakConstantExpr.h +0 -94
  4. package/SVF-linux/include/SVF-FE/CHG.h +0 -334
  5. package/SVF-linux/include/SVF-FE/CHGBuilder.h +0 -73
  6. package/SVF-linux/include/SVF-FE/CPPUtil.h +0 -130
  7. package/SVF-linux/include/SVF-FE/CallGraphBuilder.h +0 -74
  8. package/SVF-linux/include/SVF-FE/CommonCHG.h +0 -49
  9. package/SVF-linux/include/SVF-FE/DCHG.h +0 -470
  10. package/SVF-linux/include/SVF-FE/DataFlowUtil.h +0 -190
  11. package/SVF-linux/include/SVF-FE/GEPTypeBridgeIterator.h +0 -183
  12. package/SVF-linux/include/SVF-FE/Graph2Json.h +0 -30
  13. package/SVF-linux/include/SVF-FE/ICFGBuilder.h +0 -106
  14. package/SVF-linux/include/SVF-FE/IRAnnotator.h +0 -323
  15. package/SVF-linux/include/SVF-FE/LLVMLoopAnalysis.h +0 -59
  16. package/SVF-linux/include/SVF-FE/LLVMModule.h +0 -319
  17. package/SVF-linux/include/SVF-FE/LLVMUtil.h +0 -303
  18. package/SVF-linux/include/SVF-FE/LocMemModel.h +0 -35
  19. package/SVF-linux/include/SVF-FE/MemModelBuilder.h +0 -102
  20. package/SVF-linux/include/SVF-FE/PAGBuilder.h +0 -390
  21. package/SVF-linux/include/SVF-FE/SVFIRBuilder.h +0 -412
  22. package/SVF-linux/include/SVF-FE/SymbolTableBuilder.h +0 -99
  23. package/SVF-linux/include/SVF-FE/SymbolTableInfo.h +0 -439
  24. package/SVF-osx/include/SVF-FE/BasicTypes.h +0 -219
  25. package/SVF-osx/include/SVF-FE/BreakConstantExpr.h +0 -94
  26. package/SVF-osx/include/SVF-FE/CHG.h +0 -334
  27. package/SVF-osx/include/SVF-FE/CHGBuilder.h +0 -73
  28. package/SVF-osx/include/SVF-FE/CPPUtil.h +0 -130
  29. package/SVF-osx/include/SVF-FE/CallGraphBuilder.h +0 -74
  30. package/SVF-osx/include/SVF-FE/CommonCHG.h +0 -49
  31. package/SVF-osx/include/SVF-FE/DCHG.h +0 -470
  32. package/SVF-osx/include/SVF-FE/DataFlowUtil.h +0 -190
  33. package/SVF-osx/include/SVF-FE/GEPTypeBridgeIterator.h +0 -183
  34. package/SVF-osx/include/SVF-FE/Graph2Json.h +0 -30
  35. package/SVF-osx/include/SVF-FE/ICFGBuilder.h +0 -106
  36. package/SVF-osx/include/SVF-FE/IRAnnotator.h +0 -323
  37. package/SVF-osx/include/SVF-FE/LLVMLoopAnalysis.h +0 -59
  38. package/SVF-osx/include/SVF-FE/LLVMModule.h +0 -319
  39. package/SVF-osx/include/SVF-FE/LLVMUtil.h +0 -303
  40. package/SVF-osx/include/SVF-FE/LocMemModel.h +0 -35
  41. package/SVF-osx/include/SVF-FE/MemModelBuilder.h +0 -102
  42. package/SVF-osx/include/SVF-FE/PAGBuilder.h +0 -390
  43. package/SVF-osx/include/SVF-FE/SVFIRBuilder.h +0 -412
  44. package/SVF-osx/include/SVF-FE/SymbolTableBuilder.h +0 -99
  45. package/SVF-osx/include/SVF-FE/SymbolTableInfo.h +0 -439
@@ -1,102 +0,0 @@
1
- //===- LocMemModel.h -- Memory model builder-----------------------//
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
- * MemModelBuilder.h
25
- *
26
- * Created on: Apr 28, 2014
27
- * Author: Yulei
28
- */
29
-
30
- #ifndef MEMMODELBUILDER_H_
31
- #define MEMMODELBUILDER_H_
32
-
33
- #include "MemoryModel/MemModel.h"
34
- #include "SVF-FE/LLVMModule.h"
35
- #include "SVF-FE/SymbolTableInfo.h"
36
-
37
- /*
38
- * This class is to build SymbolTableInfo, MemObjs and ObjTypeInfo
39
- */
40
- namespace SVF
41
- {
42
-
43
- class MemModelBuilder
44
- {
45
-
46
- private:
47
- SymbolTableInfo* symInfo;
48
-
49
- public:
50
- /// Constructor
51
- MemModelBuilder(SymbolTableInfo* si): symInfo(si){
52
-
53
- }
54
-
55
- /// Start building memory model
56
- void buildMemModel(SVFModule* svfModule);
57
-
58
- /// collect the syms
59
- //@{
60
- void collectSym(const Value *val);
61
-
62
- void collectVal(const Value *val);
63
-
64
- void collectObj(const Value *val);
65
-
66
- void collectRet(const Function *val);
67
-
68
- void collectVararg(const Function *val);
69
- //@}
70
-
71
- /// Handle constant expression
72
- // @{
73
- void handleGlobalCE(const GlobalVariable *G);
74
- void handleGlobalInitializerCE(const Constant *C, u32_t offset);
75
- void handleCE(const Value *val);
76
- // @}
77
-
78
-
79
- // /// Collect the struct info
80
- // virtual void collectStructInfo(const StructType *T);
81
- // /// Collect the array info
82
- // virtual void collectArrayInfo(const ArrayType* T);
83
- // /// Collect simple type (non-aggregate) info
84
- // virtual void collectSimpleTypeInfo(const Type* T);
85
-
86
- /// Create an objectInfo based on LLVM value
87
- ObjTypeInfo* createObjTypeInfo(const Value *val);
88
- /// Create an objectInfo based on LLVM type (value is null, and type could be null, representing a dummy object)
89
- // ObjTypeInfo* createObjTypeInfo(const Type *type = nullptr);
90
-
91
- /// Initialize TypeInfo based on LLVM Value
92
- void initTypeInfo(ObjTypeInfo* typeinfo, const Value* value);
93
- /// Analyse types of all flattened fields of this object
94
- void analyzeGlobalStackObjType(ObjTypeInfo* typeinfo, const Value* val);
95
- /// Return size of this object based on LLVM value
96
- u32_t getObjSize(const Value* val);
97
-
98
- };
99
-
100
- }
101
-
102
- #endif /* MEMMODELBUILDER_H_ */
@@ -1,390 +0,0 @@
1
- //===- PAGBuilder.h -- Building PAG-------------------------------------------//
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
- * PAGBuilder.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 "Graphs/PAG.h"
34
- #include "Util/ExtAPI.h"
35
- #include "SVF-FE/ICFGBuilder.h"
36
-
37
- namespace SVF
38
- {
39
-
40
- class SVFModule;
41
- /*!
42
- * PAG Builder
43
- */
44
- class PAGBuilder: public llvm::InstVisitor<PAGBuilder>
45
- {
46
-
47
- private:
48
- PAG* pag;
49
- SVFModule* svfMod;
50
- const BasicBlock* curBB; ///< Current basic block during PAG construction when visiting the module
51
- const Value* curVal; ///< Current Value during PAG construction when visiting the module
52
-
53
- public:
54
- /// Constructor
55
- PAGBuilder(): pag(PAG::getPAG()), svfMod(nullptr), curBB(nullptr),curVal(nullptr)
56
- {
57
- }
58
- /// Destructor
59
- virtual ~PAGBuilder()
60
- {
61
- }
62
-
63
- /// Start building PAG here
64
- virtual PAG* build(SVFModule* svfModule);
65
-
66
- /// Return PAG
67
- PAG* 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 PAG
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 CmpPE* addCmpEdge(NodeID src, NodeID dst)
297
- {
298
- CmpPE *edge = pag->addCmpPE(src, dst);
299
- setCurrentBBAndValueForPAGEdge(edge);
300
- return edge;
301
- }
302
- /// Add Copy edge
303
- inline BinaryOPPE* addBinaryOPEdge(NodeID src, NodeID dst)
304
- {
305
- BinaryOPPE *edge = pag->addBinaryOPPE(src, dst);
306
- setCurrentBBAndValueForPAGEdge(edge);
307
- return edge;
308
- }
309
- /// Add Unary edge
310
- inline UnaryOPPE* addUnaryOPEdge(NodeID src, NodeID dst)
311
- {
312
- UnaryOPPE *edge = pag->addUnaryOPPE(src, dst);
313
- setCurrentBBAndValueForPAGEdge(edge);
314
- return edge;
315
- }
316
- /// Add Load edge
317
- inline LoadPE* addLoadEdge(NodeID src, NodeID dst)
318
- {
319
- LoadPE *edge = pag->addLoadPE(src, dst);
320
- setCurrentBBAndValueForPAGEdge(edge);
321
- return edge;
322
- }
323
- /// Add Store edge
324
- inline StorePE* addStoreEdge(NodeID src, NodeID dst)
325
- {
326
- IntraBlockNode* node;
327
- if(const Instruction* inst = SVFUtil::dyn_cast<Instruction>(curVal))
328
- node = pag->getICFG()->getIntraBlockNode(inst);
329
- else
330
- node = nullptr;
331
- StorePE *edge = pag->addStorePE(src, dst, node);
332
- setCurrentBBAndValueForPAGEdge(edge);
333
- return edge;
334
- }
335
- /// Add Call edge
336
- inline CallPE* addCallEdge(NodeID src, NodeID dst, const CallBlockNode* cs)
337
- {
338
- CallPE *edge = pag->addCallPE(src, dst, cs);
339
- setCurrentBBAndValueForPAGEdge(edge);
340
- return edge;
341
- }
342
- /// Add Return edge
343
- inline RetPE* addRetEdge(NodeID src, NodeID dst, const CallBlockNode* cs)
344
- {
345
- RetPE *edge = pag->addRetPE(src, dst, cs);
346
- setCurrentBBAndValueForPAGEdge(edge);
347
- return edge;
348
- }
349
- /// Add Gep edge
350
- inline GepPE* addGepEdge(NodeID src, NodeID dst, const LocationSet& ls, bool constGep)
351
- {
352
- GepPE *edge = pag->addGepPE(src, dst, ls, constGep);
353
- setCurrentBBAndValueForPAGEdge(edge);
354
- return edge;
355
- }
356
- /// Add Offset(Gep) edge
357
- inline NormalGepPE* addNormalGepEdge(NodeID src, NodeID dst, const LocationSet& ls)
358
- {
359
- NormalGepPE *edge = pag->addNormalGepPE(src, dst, ls);
360
- setCurrentBBAndValueForPAGEdge(edge);
361
- return edge;
362
- }
363
- /// Add Variant(Gep) edge
364
- inline VariantGepPE* addVariantGepEdge(NodeID src, NodeID dst)
365
- {
366
- VariantGepPE *edge = pag->addVariantGepPE(src, dst);
367
- setCurrentBBAndValueForPAGEdge(edge);
368
- return edge;
369
- }
370
- /// Add Thread fork edge for parameter passing
371
- inline TDForkPE* addThreadForkEdge(NodeID src, NodeID dst, const CallBlockNode* cs)
372
- {
373
- TDForkPE *edge = pag->addThreadForkPE(src, dst, cs);
374
- setCurrentBBAndValueForPAGEdge(edge);
375
- return edge;
376
- }
377
- /// Add Thread join edge for parameter passing
378
- inline TDJoinPE* addThreadJoinEdge(NodeID src, NodeID dst, const CallBlockNode* cs)
379
- {
380
- TDJoinPE *edge = pag->addThreadJoinPE(src, dst, cs);
381
- setCurrentBBAndValueForPAGEdge(edge);
382
- return edge;
383
- }
384
- //@}
385
-
386
- };
387
-
388
- } // End namespace SVF
389
-
390
- #endif /* PAGBUILDER_H_ */