svf-lib 1.0.2245 → 1.0.2246
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.
- package/SVF-linux-aarch64/Release-build/bin/ae +0 -0
- package/SVF-linux-aarch64/Release-build/bin/cfl +0 -0
- package/SVF-linux-aarch64/Release-build/bin/dvf +0 -0
- package/SVF-linux-aarch64/Release-build/bin/mta +0 -0
- package/SVF-linux-aarch64/Release-build/bin/saber +0 -0
- package/SVF-linux-aarch64/Release-build/bin/svf-ex +0 -0
- package/SVF-linux-aarch64/Release-build/bin/wpa +0 -0
- package/SVF-linux-aarch64/Release-build/include/Graphs/CHG.h +0 -1
- package/SVF-linux-aarch64/Release-build/include/Graphs/CallGraph.h +0 -1
- package/SVF-linux-aarch64/Release-build/include/Graphs/ThreadCallGraph.h +0 -1
- package/SVF-linux-aarch64/Release-build/include/MTA/MTA.h +0 -1
- package/SVF-linux-aarch64/Release-build/include/MemoryModel/PointerAnalysis.h +0 -1
- package/SVF-linux-aarch64/Release-build/include/SVF-LLVM/BreakConstantExpr.h +0 -1
- package/SVF-linux-aarch64/Release-build/include/SVF-LLVM/CppUtil.h +1 -1
- package/SVF-linux-aarch64/Release-build/include/SVF-LLVM/DCHG.h +3 -7
- package/SVF-linux-aarch64/Release-build/include/SVF-LLVM/LLVMModule.h +67 -139
- package/SVF-linux-aarch64/Release-build/include/SVF-LLVM/LLVMUtil.h +4 -9
- package/SVF-linux-aarch64/Release-build/include/SVF-LLVM/ObjTypeInference.h +0 -1
- package/SVF-linux-aarch64/Release-build/include/SVF-LLVM/SVFIRBuilder.h +21 -18
- package/SVF-linux-aarch64/Release-build/include/SVF-LLVM/SymbolTableBuilder.h +1 -1
- package/SVF-linux-aarch64/Release-build/include/SVFIR/SVFVariables.h +11 -3
- package/SVF-linux-aarch64/Release-build/include/Util/CallGraphBuilder.h +0 -1
- package/SVF-linux-aarch64/Release-build/include/Util/ThreadAPI.h +0 -1
- package/SVF-linux-aarch64/Release-build/include/WPA/Andersen.h +0 -1
- package/SVF-linux-aarch64/Release-build/include/WPA/FlowSensitive.h +0 -1
- package/SVF-linux-aarch64/Release-build/include/WPA/VersionedFlowSensitive.h +0 -1
- package/SVF-linux-aarch64/Release-build/include/WPA/WPAPass.h +0 -1
- package/SVF-linux-aarch64/Release-build/lib/libSvfCore.so +0 -0
- package/SVF-linux-aarch64/Release-build/lib/libSvfLLVM.so.16 +0 -0
- package/package.json +1 -1
- package/SVF-linux-aarch64/Release-build/include/SVF-LLVM/SVFLLVMValue.h +0 -387
- package/SVF-linux-aarch64/Release-build/include/SVF-LLVM/SVFModule.h +0 -186
|
@@ -955,6 +955,7 @@ class FunObjVar : public BaseObjVar
|
|
|
955
955
|
friend class SVFIRWriter;
|
|
956
956
|
friend class SVFIRReader;
|
|
957
957
|
friend class SVFIRBuilder;
|
|
958
|
+
friend class LLVMModuleSet;
|
|
958
959
|
|
|
959
960
|
public:
|
|
960
961
|
typedef SVFLoopAndDomInfo::BBSet BBSet;
|
|
@@ -976,7 +977,7 @@ private:
|
|
|
976
977
|
const FunObjVar * realDefFun; /// the definition of a function across multiple modules
|
|
977
978
|
BasicBlockGraph* bbGraph; /// the basic block graph of this function
|
|
978
979
|
std::vector<const ArgValVar*> allArgs; /// all formal arguments of this function
|
|
979
|
-
SVFBasicBlock *exitBlock; /// a 'single' basic block having no successors and containing return instruction in a function
|
|
980
|
+
const SVFBasicBlock *exitBlock; /// a 'single' basic block having no successors and containing return instruction in a function
|
|
980
981
|
|
|
981
982
|
|
|
982
983
|
private:
|
|
@@ -1015,9 +1016,16 @@ public:
|
|
|
1015
1016
|
/// Constructor
|
|
1016
1017
|
FunObjVar(NodeID i, ObjTypeInfo* ti, const SVFType* svfType, const ICFGNode* node);
|
|
1017
1018
|
|
|
1019
|
+
|
|
1020
|
+
virtual ~FunObjVar()
|
|
1021
|
+
{
|
|
1022
|
+
delete loopAndDom;
|
|
1023
|
+
delete bbGraph;
|
|
1024
|
+
}
|
|
1025
|
+
|
|
1018
1026
|
void initFunObjVar(bool decl, bool intrinc, bool addr, bool uncalled, bool notret, bool vararg, const SVFFunctionType *ft,
|
|
1019
1027
|
SVFLoopAndDomInfo *ld, const FunObjVar *real, BasicBlockGraph *bbg,
|
|
1020
|
-
const std::vector<const ArgValVar *> &allarg, SVFBasicBlock *exit);
|
|
1028
|
+
const std::vector<const ArgValVar *> &allarg, const SVFBasicBlock *exit);
|
|
1021
1029
|
|
|
1022
1030
|
void setRelDefFun(const FunObjVar *real)
|
|
1023
1031
|
{
|
|
@@ -1072,7 +1080,7 @@ public:
|
|
|
1072
1080
|
return funcType->getReturnType();
|
|
1073
1081
|
}
|
|
1074
1082
|
|
|
1075
|
-
inline SVFLoopAndDomInfo* getLoopAndDomInfo()
|
|
1083
|
+
inline SVFLoopAndDomInfo* getLoopAndDomInfo() const
|
|
1076
1084
|
{
|
|
1077
1085
|
return loopAndDom;
|
|
1078
1086
|
}
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,387 +0,0 @@
|
|
|
1
|
-
//===- BasicTypes.h -- Basic types used in SVF-------------------------------//
|
|
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 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
|
-
* BasicTypes.h
|
|
25
|
-
*
|
|
26
|
-
* Created on: Apr 1, 2014
|
|
27
|
-
* Author: Yulei Sui
|
|
28
|
-
*/
|
|
29
|
-
|
|
30
|
-
#ifndef INCLUDE_SVFLLVM_SVFVALUE_H_
|
|
31
|
-
#define INCLUDE_SVFLLVM_SVFVALUE_H_
|
|
32
|
-
|
|
33
|
-
#include "SVFIR/SVFType.h"
|
|
34
|
-
#include "Graphs/GraphPrinter.h"
|
|
35
|
-
#include "Util/Casting.h"
|
|
36
|
-
#include "Graphs/BasicBlockG.h"
|
|
37
|
-
#include "SVFIR/SVFValue.h"
|
|
38
|
-
#include "Util/SVFLoopAndDomInfo.h"
|
|
39
|
-
|
|
40
|
-
namespace SVF
|
|
41
|
-
{
|
|
42
|
-
|
|
43
|
-
/// LLVM Aliases and constants
|
|
44
|
-
typedef SVF::GraphPrinter GraphPrinter;
|
|
45
|
-
|
|
46
|
-
class CallGraphNode;
|
|
47
|
-
class SVFInstruction;
|
|
48
|
-
class SVFBasicBlock;
|
|
49
|
-
class SVFArgument;
|
|
50
|
-
class SVFFunction;
|
|
51
|
-
class SVFType;
|
|
52
|
-
|
|
53
|
-
class SVFLLVMValue
|
|
54
|
-
{
|
|
55
|
-
friend class SVFIRWriter;
|
|
56
|
-
friend class SVFIRReader;
|
|
57
|
-
friend class LLVMModuleSet;
|
|
58
|
-
|
|
59
|
-
public:
|
|
60
|
-
typedef s64_t GNodeK;
|
|
61
|
-
|
|
62
|
-
enum SVFValKind
|
|
63
|
-
{
|
|
64
|
-
SVFVal,
|
|
65
|
-
SVFFunc,
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
private:
|
|
69
|
-
GNodeK kind; ///< used for classof
|
|
70
|
-
bool ptrInUncalledFun; ///< true if this pointer is in an uncalled function
|
|
71
|
-
bool constDataOrAggData; ///< true if this value is a ConstantData (e.g., numbers, string, floats) or a constantAggregate
|
|
72
|
-
|
|
73
|
-
protected:
|
|
74
|
-
const SVFType* type; ///< Type of this SVFValue
|
|
75
|
-
std::string name; ///< Short name of value for printing & debugging
|
|
76
|
-
std::string sourceLoc; ///< Source code information of this value
|
|
77
|
-
/// Constructor without name
|
|
78
|
-
SVFLLVMValue(const SVFType* ty, SVFValKind k = SVFVal)
|
|
79
|
-
: kind(k), ptrInUncalledFun(false),
|
|
80
|
-
constDataOrAggData(false), type(ty), sourceLoc("NoLoc")
|
|
81
|
-
{
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
///@{ attributes to be set only through Module builders e.g.,
|
|
85
|
-
/// LLVMModule
|
|
86
|
-
inline void setConstDataOrAggData()
|
|
87
|
-
{
|
|
88
|
-
constDataOrAggData = true;
|
|
89
|
-
}
|
|
90
|
-
inline void setPtrInUncalledFunction()
|
|
91
|
-
{
|
|
92
|
-
ptrInUncalledFun = true;
|
|
93
|
-
}
|
|
94
|
-
///@}
|
|
95
|
-
public:
|
|
96
|
-
SVFLLVMValue() = delete;
|
|
97
|
-
virtual ~SVFLLVMValue() = default;
|
|
98
|
-
|
|
99
|
-
/// Get the type of this SVFValue
|
|
100
|
-
inline GNodeK getKind() const
|
|
101
|
-
{
|
|
102
|
-
return kind;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
inline const std::string &getName() const
|
|
106
|
-
{
|
|
107
|
-
return name;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
inline void setName(std::string&& n)
|
|
111
|
-
{
|
|
112
|
-
name = std::move(n);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
inline virtual const SVFType* getType() const
|
|
116
|
-
{
|
|
117
|
-
return type;
|
|
118
|
-
}
|
|
119
|
-
inline bool isConstDataOrAggData() const
|
|
120
|
-
{
|
|
121
|
-
return constDataOrAggData;
|
|
122
|
-
}
|
|
123
|
-
inline bool ptrInUncalledFunction() const
|
|
124
|
-
{
|
|
125
|
-
return ptrInUncalledFun;
|
|
126
|
-
}
|
|
127
|
-
inline virtual void setSourceLoc(const std::string& sourceCodeInfo)
|
|
128
|
-
{
|
|
129
|
-
sourceLoc = sourceCodeInfo;
|
|
130
|
-
}
|
|
131
|
-
inline virtual const std::string getSourceLoc() const
|
|
132
|
-
{
|
|
133
|
-
return sourceLoc;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
/// Needs to be implemented by a SVF front end
|
|
137
|
-
std::string toString() const;
|
|
138
|
-
|
|
139
|
-
/// Overloading operator << for dumping ICFG node ID
|
|
140
|
-
//@{
|
|
141
|
-
friend OutStream& operator<<(OutStream &os, const SVFLLVMValue &value)
|
|
142
|
-
{
|
|
143
|
-
return os << value.toString();
|
|
144
|
-
}
|
|
145
|
-
//@}
|
|
146
|
-
};
|
|
147
|
-
|
|
148
|
-
class ArgValVar;
|
|
149
|
-
|
|
150
|
-
class SVFFunction : public SVFLLVMValue
|
|
151
|
-
{
|
|
152
|
-
friend class LLVMModuleSet;
|
|
153
|
-
friend class SVFIRWriter;
|
|
154
|
-
friend class SVFIRReader;
|
|
155
|
-
friend class SVFIRBuilder;
|
|
156
|
-
|
|
157
|
-
public:
|
|
158
|
-
typename BasicBlockGraph::IDToNodeMapTy::iterator iterator;
|
|
159
|
-
typedef BasicBlockGraph::IDToNodeMapTy::const_iterator const_iterator;
|
|
160
|
-
typedef SVFLoopAndDomInfo::BBSet BBSet;
|
|
161
|
-
typedef SVFLoopAndDomInfo::BBList BBList;
|
|
162
|
-
typedef SVFLoopAndDomInfo::LoopBBs LoopBBs;
|
|
163
|
-
|
|
164
|
-
private:
|
|
165
|
-
bool isDecl; /// return true if this function does not have a body
|
|
166
|
-
bool intrinsic; /// return true if this function is an intrinsic function (e.g., llvm.dbg), which does not reside in the application code
|
|
167
|
-
bool addrTaken; /// return true if this function is address-taken (for indirect call purposes)
|
|
168
|
-
bool isUncalled; /// return true if this function is never called
|
|
169
|
-
bool isNotRet; /// return true if this function never returns
|
|
170
|
-
bool varArg; /// return true if this function supports variable arguments
|
|
171
|
-
const SVFFunctionType* funcType; /// FunctionType, which is different from the type (PointerType) of this SVFFunction
|
|
172
|
-
SVFLoopAndDomInfo* loopAndDom; /// the loop and dominate information
|
|
173
|
-
const SVFFunction* realDefFun; /// the definition of a function across multiple modules
|
|
174
|
-
std::vector<const ArgValVar*> allArgs; /// all formal arguments of this function
|
|
175
|
-
SVFBasicBlock *exitBlock; /// a 'single' basic block having no successors and containing return instruction in a function
|
|
176
|
-
BasicBlockGraph* bbGraph; /// the basic block graph of this function
|
|
177
|
-
|
|
178
|
-
protected:
|
|
179
|
-
|
|
180
|
-
inline void addArgument(const ArgValVar* arg)
|
|
181
|
-
{
|
|
182
|
-
allArgs.push_back(arg);
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
inline void setIsUncalledFunction(bool uncalledFunction)
|
|
186
|
-
{
|
|
187
|
-
isUncalled = uncalledFunction;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
inline void setIsNotRet(bool notRet)
|
|
191
|
-
{
|
|
192
|
-
isNotRet = notRet;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
inline void setDefFunForMultipleModule(const SVFFunction* deffun)
|
|
196
|
-
{
|
|
197
|
-
realDefFun = deffun;
|
|
198
|
-
}
|
|
199
|
-
/// @}
|
|
200
|
-
|
|
201
|
-
public:
|
|
202
|
-
SVFFunction(const SVFType* ty,const SVFFunctionType* ft, bool declare, bool intrinsic, bool addrTaken, bool varg, SVFLoopAndDomInfo* ld);
|
|
203
|
-
SVFFunction(void) = delete;
|
|
204
|
-
virtual ~SVFFunction();
|
|
205
|
-
|
|
206
|
-
static inline bool classof(const SVFLLVMValue *node)
|
|
207
|
-
{
|
|
208
|
-
return node->getKind() == SVFFunc;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
inline SVFLoopAndDomInfo* getLoopAndDomInfo()
|
|
212
|
-
{
|
|
213
|
-
return loopAndDom;
|
|
214
|
-
}
|
|
215
|
-
inline bool isDeclaration() const
|
|
216
|
-
{
|
|
217
|
-
return isDecl;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
void setBasicBlockGraph(BasicBlockGraph* graph)
|
|
221
|
-
{
|
|
222
|
-
this->bbGraph = graph;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
BasicBlockGraph* getBasicBlockGraph()
|
|
226
|
-
{
|
|
227
|
-
return bbGraph;
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
const BasicBlockGraph* getBasicBlockGraph() const
|
|
231
|
-
{
|
|
232
|
-
return bbGraph;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
inline bool isIntrinsic() const
|
|
236
|
-
{
|
|
237
|
-
return intrinsic;
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
inline bool hasAddressTaken() const
|
|
241
|
-
{
|
|
242
|
-
return addrTaken;
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
/// Returns the FunctionType
|
|
246
|
-
inline const SVFFunctionType* getFunctionType() const
|
|
247
|
-
{
|
|
248
|
-
return funcType;
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
/// Returns the FunctionType
|
|
252
|
-
inline const SVFType* getReturnType() const
|
|
253
|
-
{
|
|
254
|
-
return funcType->getReturnType();
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
inline const SVFFunction* getDefFunForMultipleModule() const
|
|
258
|
-
{
|
|
259
|
-
if(realDefFun==nullptr)
|
|
260
|
-
return this;
|
|
261
|
-
return realDefFun;
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
u32_t arg_size() const;
|
|
265
|
-
const ArgValVar* getArg(u32_t idx) const;
|
|
266
|
-
bool isVarArg() const;
|
|
267
|
-
|
|
268
|
-
inline bool hasBasicBlock() const
|
|
269
|
-
{
|
|
270
|
-
return bbGraph && bbGraph->begin() != bbGraph->end();
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
inline const SVFBasicBlock* getEntryBlock() const
|
|
274
|
-
{
|
|
275
|
-
assert(hasBasicBlock() && "function does not have any Basicblock, external function?");
|
|
276
|
-
assert(bbGraph->begin()->second->getInEdges().size() == 0 && "the first basic block is not entry block");
|
|
277
|
-
return bbGraph->begin()->second;
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
/// Carefully! when you call getExitBB, you need ensure the function has return instruction
|
|
281
|
-
/// more refer to: https://github.com/SVF-tools/SVF/pull/1262
|
|
282
|
-
const SVFBasicBlock* getExitBB() const;
|
|
283
|
-
|
|
284
|
-
void setExitBlock(SVFBasicBlock *bb);
|
|
285
|
-
|
|
286
|
-
inline const SVFBasicBlock* front() const
|
|
287
|
-
{
|
|
288
|
-
return getEntryBlock();
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
inline const SVFBasicBlock* back() const
|
|
292
|
-
{
|
|
293
|
-
assert(hasBasicBlock() && "function does not have any Basicblock, external function?");
|
|
294
|
-
/// Carefully! 'back' is just the last basic block of function,
|
|
295
|
-
/// but not necessarily a exit basic block
|
|
296
|
-
/// more refer to: https://github.com/SVF-tools/SVF/pull/1262
|
|
297
|
-
return std::prev(bbGraph->end())->second;
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
inline const_iterator begin() const
|
|
301
|
-
{
|
|
302
|
-
return bbGraph->begin();
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
inline const_iterator end() const
|
|
306
|
-
{
|
|
307
|
-
return bbGraph->end();
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
inline const std::vector<const SVFBasicBlock*>& getReachableBBs() const
|
|
312
|
-
{
|
|
313
|
-
return loopAndDom->getReachableBBs();
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
inline bool isUncalledFunction() const
|
|
317
|
-
{
|
|
318
|
-
return isUncalled;
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
inline bool hasReturn() const
|
|
322
|
-
{
|
|
323
|
-
return !isNotRet;
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
inline void getExitBlocksOfLoop(const SVFBasicBlock* bb, BBList& exitbbs) const
|
|
327
|
-
{
|
|
328
|
-
return loopAndDom->getExitBlocksOfLoop(bb,exitbbs);
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
inline bool hasLoopInfo(const SVFBasicBlock* bb) const
|
|
332
|
-
{
|
|
333
|
-
return loopAndDom->hasLoopInfo(bb);
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
const LoopBBs& getLoopInfo(const SVFBasicBlock* bb) const
|
|
337
|
-
{
|
|
338
|
-
return loopAndDom->getLoopInfo(bb);
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
inline const SVFBasicBlock* getLoopHeader(const BBList& lp) const
|
|
342
|
-
{
|
|
343
|
-
return loopAndDom->getLoopHeader(lp);
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
inline bool loopContainsBB(const BBList& lp, const SVFBasicBlock* bb) const
|
|
347
|
-
{
|
|
348
|
-
return loopAndDom->loopContainsBB(lp,bb);
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
inline const Map<const SVFBasicBlock*,BBSet>& getDomTreeMap() const
|
|
352
|
-
{
|
|
353
|
-
return loopAndDom->getDomTreeMap();
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
inline const Map<const SVFBasicBlock*,BBSet>& getDomFrontierMap() const
|
|
357
|
-
{
|
|
358
|
-
return loopAndDom->getDomFrontierMap();
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
inline bool isLoopHeader(const SVFBasicBlock* bb) const
|
|
362
|
-
{
|
|
363
|
-
return loopAndDom->isLoopHeader(bb);
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
inline bool dominate(const SVFBasicBlock* bbKey, const SVFBasicBlock* bbValue) const
|
|
367
|
-
{
|
|
368
|
-
return loopAndDom->dominate(bbKey,bbValue);
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
inline bool postDominate(const SVFBasicBlock* bbKey, const SVFBasicBlock* bbValue) const
|
|
372
|
-
{
|
|
373
|
-
return loopAndDom->postDominate(bbKey,bbValue);
|
|
374
|
-
}
|
|
375
|
-
};
|
|
376
|
-
|
|
377
|
-
/// [FOR DEBUG ONLY, DON'T USE IT UNSIDE `svf`!]
|
|
378
|
-
/// Converts an SVFValue to corresponding LLVM::Value, then get the string
|
|
379
|
-
/// representation of it. Use it only when you are debugging. Don't use
|
|
380
|
-
/// it in any SVF algorithm because it relies on information stored in LLVM bc.
|
|
381
|
-
std::string dumpLLVMValue(const SVFLLVMValue* svfValue);
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
} // End namespace SVF
|
|
386
|
-
|
|
387
|
-
#endif /* INCLUDE_SVFLLVM_SVFVALUE_H_ */
|
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
//===- SVFModule.h -- SVFModule* class----------------------------------------//
|
|
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 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
|
-
* SVFModule.h
|
|
25
|
-
*
|
|
26
|
-
* Created on: Aug 4, 2017
|
|
27
|
-
* Author: Xiaokang Fan
|
|
28
|
-
*/
|
|
29
|
-
|
|
30
|
-
#ifndef INCLUDE_SVFMODULE_H_
|
|
31
|
-
#define INCLUDE_SVFMODULE_H_
|
|
32
|
-
|
|
33
|
-
#include "SVF-LLVM/SVFLLVMValue.h"
|
|
34
|
-
#include "Util/NodeIDAllocator.h"
|
|
35
|
-
#include "Util/ThreadAPI.h"
|
|
36
|
-
|
|
37
|
-
namespace SVF
|
|
38
|
-
{
|
|
39
|
-
|
|
40
|
-
class SVFModule
|
|
41
|
-
{
|
|
42
|
-
friend class SVFIRWriter;
|
|
43
|
-
friend class SVFIRReader;
|
|
44
|
-
|
|
45
|
-
public:
|
|
46
|
-
typedef std::vector<const SVFFunction*> FunctionSetType;
|
|
47
|
-
typedef std::vector<SVFLLVMValue*> GlobalSetType;
|
|
48
|
-
typedef std::vector<SVFLLVMValue*> AliasSetType;
|
|
49
|
-
typedef std::vector<SVFLLVMValue*> ConstantType;
|
|
50
|
-
typedef std::vector<SVFLLVMValue*> OtherValueType;
|
|
51
|
-
|
|
52
|
-
/// Iterators type def
|
|
53
|
-
typedef FunctionSetType::iterator iterator;
|
|
54
|
-
typedef FunctionSetType::const_iterator const_iterator;
|
|
55
|
-
typedef GlobalSetType::iterator global_iterator;
|
|
56
|
-
typedef GlobalSetType::const_iterator const_global_iterator;
|
|
57
|
-
typedef AliasSetType::iterator alias_iterator;
|
|
58
|
-
typedef AliasSetType::const_iterator const_alias_iterator;
|
|
59
|
-
typedef ConstantType::iterator cdata_iterator;
|
|
60
|
-
typedef ConstantType::const_iterator const_cdata_iterator;
|
|
61
|
-
typedef OtherValueType::iterator ovalue_iterator;
|
|
62
|
-
typedef OtherValueType::const_iterator const_ovalue_iterator;
|
|
63
|
-
|
|
64
|
-
private:
|
|
65
|
-
static SVFModule* svfModule;
|
|
66
|
-
FunctionSetType FunctionSet; ///< The Functions in the module
|
|
67
|
-
GlobalSetType GlobalSet; ///< The Global Variables in the module
|
|
68
|
-
AliasSetType AliasSet; ///< The Aliases in the module
|
|
69
|
-
ConstantType ConstantSet; ///< The ConstantData in the module
|
|
70
|
-
OtherValueType OtherValueSet; ///< All other values in the module
|
|
71
|
-
|
|
72
|
-
/// Constructors
|
|
73
|
-
SVFModule() = default;
|
|
74
|
-
|
|
75
|
-
public:
|
|
76
|
-
static SVFModule* getSVFModule();
|
|
77
|
-
static void releaseSVFModule();
|
|
78
|
-
|
|
79
|
-
~SVFModule();
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
const SVFFunction* getSVFFunction(const std::string& name);
|
|
83
|
-
|
|
84
|
-
///@{
|
|
85
|
-
inline void addFunctionSet(SVFFunction* svfFunc)
|
|
86
|
-
{
|
|
87
|
-
FunctionSet.push_back(svfFunc);
|
|
88
|
-
}
|
|
89
|
-
inline void addGlobalSet(SVFLLVMValue* glob)
|
|
90
|
-
{
|
|
91
|
-
GlobalSet.push_back(glob);
|
|
92
|
-
}
|
|
93
|
-
inline void addAliasSet(SVFLLVMValue* alias)
|
|
94
|
-
{
|
|
95
|
-
AliasSet.push_back(alias);
|
|
96
|
-
}
|
|
97
|
-
inline void addConstant(SVFLLVMValue* cd)
|
|
98
|
-
{
|
|
99
|
-
ConstantSet.push_back(cd);
|
|
100
|
-
}
|
|
101
|
-
inline void addOtherValue(SVFLLVMValue* ov)
|
|
102
|
-
{
|
|
103
|
-
OtherValueSet.push_back(ov);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
///@}
|
|
107
|
-
|
|
108
|
-
/// Iterators
|
|
109
|
-
///@{
|
|
110
|
-
global_iterator global_begin()
|
|
111
|
-
{
|
|
112
|
-
return GlobalSet.begin();
|
|
113
|
-
}
|
|
114
|
-
const_global_iterator global_begin() const
|
|
115
|
-
{
|
|
116
|
-
return GlobalSet.begin();
|
|
117
|
-
}
|
|
118
|
-
global_iterator global_end()
|
|
119
|
-
{
|
|
120
|
-
return GlobalSet.end();
|
|
121
|
-
}
|
|
122
|
-
const_global_iterator global_end() const
|
|
123
|
-
{
|
|
124
|
-
return GlobalSet.end();
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
alias_iterator alias_begin()
|
|
128
|
-
{
|
|
129
|
-
return AliasSet.begin();
|
|
130
|
-
}
|
|
131
|
-
const_alias_iterator alias_begin() const
|
|
132
|
-
{
|
|
133
|
-
return AliasSet.begin();
|
|
134
|
-
}
|
|
135
|
-
alias_iterator alias_end()
|
|
136
|
-
{
|
|
137
|
-
return AliasSet.end();
|
|
138
|
-
}
|
|
139
|
-
const_alias_iterator alias_end() const
|
|
140
|
-
{
|
|
141
|
-
return AliasSet.end();
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
cdata_iterator constant_begin()
|
|
145
|
-
{
|
|
146
|
-
return ConstantSet.begin();
|
|
147
|
-
}
|
|
148
|
-
const_cdata_iterator constant_begin() const
|
|
149
|
-
{
|
|
150
|
-
return ConstantSet.begin();
|
|
151
|
-
}
|
|
152
|
-
cdata_iterator constant_end()
|
|
153
|
-
{
|
|
154
|
-
return ConstantSet.end();
|
|
155
|
-
}
|
|
156
|
-
const_cdata_iterator constant_end() const
|
|
157
|
-
{
|
|
158
|
-
return ConstantSet.end();
|
|
159
|
-
}
|
|
160
|
-
///@}
|
|
161
|
-
|
|
162
|
-
inline const FunctionSetType& getFunctionSet() const
|
|
163
|
-
{
|
|
164
|
-
return FunctionSet;
|
|
165
|
-
}
|
|
166
|
-
inline const ConstantType& getConstantSet() const
|
|
167
|
-
{
|
|
168
|
-
return ConstantSet;
|
|
169
|
-
}
|
|
170
|
-
inline const GlobalSetType& getGlobalSet() const
|
|
171
|
-
{
|
|
172
|
-
return GlobalSet;
|
|
173
|
-
}
|
|
174
|
-
inline const AliasSetType& getAliasSet() const
|
|
175
|
-
{
|
|
176
|
-
return AliasSet;
|
|
177
|
-
}
|
|
178
|
-
inline const OtherValueType& getOtherValueSet() const
|
|
179
|
-
{
|
|
180
|
-
return OtherValueSet;
|
|
181
|
-
}
|
|
182
|
-
};
|
|
183
|
-
|
|
184
|
-
} // End namespace SVF
|
|
185
|
-
|
|
186
|
-
#endif /* INCLUDE_SVFMODULE_H_ */
|