svf-lib 1.0.2245 → 1.0.2247
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/SVF-linux-x86_64/Release-build/bin/ae +0 -0
- package/SVF-linux-x86_64/Release-build/bin/cfl +0 -0
- package/SVF-linux-x86_64/Release-build/bin/dvf +0 -0
- package/SVF-linux-x86_64/Release-build/bin/mta +0 -0
- package/SVF-linux-x86_64/Release-build/bin/saber +0 -0
- package/SVF-linux-x86_64/Release-build/bin/svf-ex +0 -0
- package/SVF-linux-x86_64/Release-build/bin/wpa +0 -0
- package/SVF-linux-x86_64/Release-build/include/Graphs/CHG.h +0 -1
- package/SVF-linux-x86_64/Release-build/include/Graphs/CallGraph.h +0 -1
- package/SVF-linux-x86_64/Release-build/include/Graphs/ThreadCallGraph.h +0 -1
- package/SVF-linux-x86_64/Release-build/include/MTA/MTA.h +0 -1
- package/SVF-linux-x86_64/Release-build/include/MemoryModel/PointerAnalysis.h +0 -1
- package/SVF-linux-x86_64/Release-build/include/SVF-LLVM/BreakConstantExpr.h +0 -1
- package/SVF-linux-x86_64/Release-build/include/SVF-LLVM/CppUtil.h +1 -1
- package/SVF-linux-x86_64/Release-build/include/SVF-LLVM/DCHG.h +3 -7
- package/SVF-linux-x86_64/Release-build/include/SVF-LLVM/LLVMModule.h +67 -139
- package/SVF-linux-x86_64/Release-build/include/SVF-LLVM/LLVMUtil.h +4 -9
- package/SVF-linux-x86_64/Release-build/include/SVF-LLVM/ObjTypeInference.h +0 -1
- package/SVF-linux-x86_64/Release-build/include/SVF-LLVM/SVFIRBuilder.h +21 -18
- package/SVF-linux-x86_64/Release-build/include/SVF-LLVM/SymbolTableBuilder.h +1 -1
- package/SVF-linux-x86_64/Release-build/include/SVFIR/SVFVariables.h +11 -3
- package/SVF-linux-x86_64/Release-build/include/Util/CallGraphBuilder.h +0 -1
- package/SVF-linux-x86_64/Release-build/include/Util/ThreadAPI.h +0 -1
- package/SVF-linux-x86_64/Release-build/include/WPA/Andersen.h +0 -1
- package/SVF-linux-x86_64/Release-build/include/WPA/FlowSensitive.h +0 -1
- package/SVF-linux-x86_64/Release-build/include/WPA/VersionedFlowSensitive.h +0 -1
- package/SVF-linux-x86_64/Release-build/include/WPA/WPAPass.h +0 -1
- package/SVF-linux-x86_64/Release-build/lib/libSvfCore.so +0 -0
- package/SVF-linux-x86_64/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
- package/SVF-linux-x86_64/Release-build/include/SVF-LLVM/SVFLLVMValue.h +0 -387
- package/SVF-linux-x86_64/Release-build/include/SVF-LLVM/SVFModule.h +0 -186
|
@@ -39,7 +39,6 @@
|
|
|
39
39
|
namespace SVF
|
|
40
40
|
{
|
|
41
41
|
|
|
42
|
-
class SVFModule;
|
|
43
42
|
/*!
|
|
44
43
|
* SVFIR Builder to create SVF variables and statements and PAG
|
|
45
44
|
*/
|
|
@@ -48,13 +47,12 @@ class SVFIRBuilder: public llvm::InstVisitor<SVFIRBuilder>
|
|
|
48
47
|
|
|
49
48
|
private:
|
|
50
49
|
SVFIR* pag;
|
|
51
|
-
SVFModule* svfModule;
|
|
52
50
|
const SVFBasicBlock* curBB; ///< Current basic block during SVFIR construction when visiting the module
|
|
53
|
-
const
|
|
51
|
+
const Value* curVal; ///< Current Value during SVFIR construction when visiting the module
|
|
54
52
|
|
|
55
53
|
public:
|
|
56
54
|
/// Constructor
|
|
57
|
-
SVFIRBuilder(
|
|
55
|
+
SVFIRBuilder(): pag(SVFIR::getPAG()), curBB(nullptr),curVal(nullptr)
|
|
58
56
|
{
|
|
59
57
|
}
|
|
60
58
|
/// Destructor
|
|
@@ -71,12 +69,19 @@ public:
|
|
|
71
69
|
return pag;
|
|
72
70
|
}
|
|
73
71
|
|
|
72
|
+
void createFunObjVars();
|
|
73
|
+
void initFunObjVar();
|
|
74
|
+
|
|
74
75
|
/// Initialize nodes and edges
|
|
75
76
|
//@{
|
|
76
77
|
void initialiseNodes();
|
|
77
78
|
void initialiseBaseObjVars();
|
|
78
79
|
void initialiseValVars();
|
|
79
|
-
|
|
80
|
+
|
|
81
|
+
void initSVFBasicBlock(const Function* func);
|
|
82
|
+
|
|
83
|
+
void initDomTree(FunObjVar* func, const Function* f);
|
|
84
|
+
|
|
80
85
|
void addEdge(NodeID src, NodeID dst, SVFStmt::PEDGEK kind,
|
|
81
86
|
APOffset offset = 0, Instruction* cs = nullptr);
|
|
82
87
|
// @}
|
|
@@ -93,15 +98,13 @@ public:
|
|
|
93
98
|
processCE(V);
|
|
94
99
|
|
|
95
100
|
// strip off the constant cast and return the value node
|
|
96
|
-
|
|
97
|
-
return llvmModuleSet()->getValueNode(svfVal);
|
|
101
|
+
return llvmModuleSet()->getValueNode(V);
|
|
98
102
|
}
|
|
99
103
|
|
|
100
104
|
/// GetObject - Return the object node (stack/global/heap/function) according to a LLVM Value
|
|
101
105
|
inline NodeID getObjectNode(const Value* V)
|
|
102
106
|
{
|
|
103
|
-
|
|
104
|
-
return llvmModuleSet()->getObjectNode(svfVal);
|
|
107
|
+
return llvmModuleSet()->getObjectNode(V);
|
|
105
108
|
}
|
|
106
109
|
|
|
107
110
|
/// getReturnNode - Return the node representing the unique return value of a function.
|
|
@@ -209,7 +212,7 @@ public:
|
|
|
209
212
|
protected:
|
|
210
213
|
/// Handle globals including (global variable and functions)
|
|
211
214
|
//@{
|
|
212
|
-
void visitGlobal(
|
|
215
|
+
void visitGlobal();
|
|
213
216
|
void InitialGlobal(const GlobalVariable *gvar, Constant *C,
|
|
214
217
|
u32_t offset);
|
|
215
218
|
NodeID getGlobalVarField(const GlobalVariable *gvar, u32_t offset, SVFType* tpy);
|
|
@@ -237,21 +240,21 @@ protected:
|
|
|
237
240
|
//@{
|
|
238
241
|
virtual const Type *getBaseTypeAndFlattenedFields(const Value *V, std::vector<AccessPath> &fields, const Value* szValue);
|
|
239
242
|
virtual void addComplexConsForExt(Value *D, Value *S, const Value* sz);
|
|
240
|
-
virtual void handleExtCall(const CallBase* cs, const
|
|
243
|
+
virtual void handleExtCall(const CallBase* cs, const Function* callee);
|
|
241
244
|
//@}
|
|
242
245
|
|
|
243
246
|
/// Set current basic block in order to keep track of control flow information
|
|
244
247
|
inline void setCurrentLocation(const Value* val, const BasicBlock* bb)
|
|
245
248
|
{
|
|
246
249
|
curBB = (bb == nullptr? nullptr : llvmModuleSet()->getSVFBasicBlock(bb));
|
|
247
|
-
curVal = (val == nullptr ? nullptr:
|
|
250
|
+
curVal = (val == nullptr ? nullptr: val);
|
|
248
251
|
}
|
|
249
|
-
inline void setCurrentLocation(const
|
|
252
|
+
inline void setCurrentLocation(const Value* val, const SVFBasicBlock* bb)
|
|
250
253
|
{
|
|
251
254
|
curBB = bb;
|
|
252
255
|
curVal = val;
|
|
253
256
|
}
|
|
254
|
-
inline const
|
|
257
|
+
inline const Value* getCurrentValue() const
|
|
255
258
|
{
|
|
256
259
|
return curVal;
|
|
257
260
|
}
|
|
@@ -263,9 +266,9 @@ protected:
|
|
|
263
266
|
/// Add global black hole Address edge
|
|
264
267
|
void addGlobalBlackHoleAddrEdge(NodeID node, const ConstantExpr *int2Ptrce)
|
|
265
268
|
{
|
|
266
|
-
const
|
|
269
|
+
const Value* cval = getCurrentValue();
|
|
267
270
|
const SVFBasicBlock* cbb = getCurrentBB();
|
|
268
|
-
setCurrentLocation(int2Ptrce,nullptr);
|
|
271
|
+
setCurrentLocation(int2Ptrce,(SVFBasicBlock*) nullptr);
|
|
269
272
|
addBlackHoleAddrEdge(node);
|
|
270
273
|
setCurrentLocation(cval,cbb);
|
|
271
274
|
}
|
|
@@ -277,7 +280,7 @@ protected:
|
|
|
277
280
|
ConstantPointerNull* constNull = ConstantPointerNull::get(PointerType::getUnqual(cxt));
|
|
278
281
|
NodeID nullPtr = pag->addConstantNullPtrValNode(pag->getNullPtr(), nullptr, llvmModuleSet()->getSVFType(constNull->getType()));
|
|
279
282
|
llvmModuleSet()->addToSVFVar2LLVMValueMap(constNull, pag->getGNode(pag->getNullPtr()));
|
|
280
|
-
setCurrentLocation(constNull, nullptr);
|
|
283
|
+
setCurrentLocation(constNull, (SVFBasicBlock*) nullptr);
|
|
281
284
|
addBlackHoleAddrEdge(pag->getBlkPtr());
|
|
282
285
|
return nullPtr;
|
|
283
286
|
}
|
|
@@ -454,7 +457,7 @@ protected:
|
|
|
454
457
|
inline void addStoreEdge(NodeID src, NodeID dst)
|
|
455
458
|
{
|
|
456
459
|
ICFGNode* node;
|
|
457
|
-
if (const Instruction* inst = SVFUtil::dyn_cast<Instruction>(
|
|
460
|
+
if (const Instruction* inst = SVFUtil::dyn_cast<Instruction>(curVal))
|
|
458
461
|
node = llvmModuleSet()->getICFGNode(
|
|
459
462
|
SVFUtil::cast<Instruction>(inst));
|
|
460
463
|
else
|
|
@@ -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_ */
|