svf-lib 1.0.992 → 1.0.995
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/Release-build/lib/libSvf.a +0 -0
- package/SVF-linux/include/CFL/CFGNormalizer.h +6 -3
- package/SVF-linux/include/CFL/CFLAlias.h +26 -15
- package/SVF-linux/include/CFL/CFLGrammar.h +30 -16
- package/SVF-linux/include/CFL/CFLSolver.h +9 -5
- package/SVF-linux/include/CFL/GrammarBuilder.h +10 -7
- package/SVF-linux/include/CUDD/cudd.h +20 -11
- package/SVF-linux/include/CUDD/cuddInt.h +48 -31
- package/SVF-linux/include/CUDD/epd.h +35 -29
- package/SVF-linux/include/CUDD/mtr.h +4 -3
- package/SVF-linux/include/CUDD/st.h +7 -4
- package/SVF-linux/include/CUDD/util.h +6 -6
- package/SVF-linux/include/FastCluster/fastcluster.h +13 -12
- package/SVF-linux/include/Graphs/CFLGraph.h +16 -10
- package/SVF-linux/include/Graphs/CHG.h +2 -2
- package/SVF-linux/include/Graphs/ConsG.h +2 -1
- package/SVF-linux/include/Graphs/GenericGraph.h +3 -3
- package/SVF-linux/include/Graphs/ICFG.h +2 -2
- package/SVF-linux/include/Graphs/ICFGEdge.h +16 -9
- package/SVF-linux/include/Graphs/ICFGNode.h +2 -2
- package/SVF-linux/include/Graphs/IRGraph.h +10 -6
- package/SVF-linux/include/Graphs/PTACallGraph.h +1 -1
- package/SVF-linux/include/Graphs/SVFG.h +4 -3
- package/SVF-linux/include/Graphs/SVFGNode.h +14 -8
- package/SVF-linux/include/Graphs/ThreadCallGraph.h +4 -2
- package/SVF-linux/include/Graphs/VFG.h +45 -39
- package/SVF-linux/include/Graphs/VFGNode.h +8 -4
- package/SVF-linux/include/MSSA/MemSSA.h +1 -1
- package/SVF-linux/include/MTA/FSMPTA.h +55 -44
- package/SVF-linux/include/MTA/LockAnalysis.h +11 -9
- package/SVF-linux/include/MTA/LockResultValidator.h +64 -54
- package/SVF-linux/include/MTA/MHP.h +17 -13
- package/SVF-linux/include/MTA/MTAResultValidator.h +24 -20
- package/SVF-linux/include/MTA/PCG.h +9 -7
- package/SVF-linux/include/MTA/TCT.h +27 -22
- package/SVF-linux/include/MemoryModel/LocationSet.h +5 -3
- package/SVF-linux/include/MemoryModel/PersistentPointsToCache.h +28 -13
- package/SVF-linux/include/MemoryModel/PersistentPointsToDS.h +2 -2
- package/SVF-linux/include/MemoryModel/PointerAnalysis.h +5 -4
- package/SVF-linux/include/MemoryModel/PointsTo.h +8 -2
- package/SVF-linux/include/MemoryModel/SVFIR.h +6 -5
- package/SVF-linux/include/MemoryModel/SVFStatements.h +65 -45
- package/SVF-linux/include/MemoryModel/SVFVariables.h +6 -5
- package/SVF-linux/include/MemoryModel/SymbolTableInfo.h +18 -15
- package/SVF-linux/include/SABER/PathCondAllocator.h +14 -7
- package/SVF-linux/include/SABER/ProgSlice.h +2 -1
- package/SVF-linux/include/SABER/SaberSVFGBuilder.h +1 -1
- package/SVF-linux/include/SABER/SrcSnkDDA.h +8 -4
- package/SVF-linux/include/SVF-FE/CHGBuilder.h +4 -2
- package/SVF-linux/include/SVF-FE/DataFlowUtil.h +10 -9
- package/SVF-linux/include/SVF-FE/IRAnnotator.h +8 -8
- package/SVF-linux/include/SVF-FE/LLVMModule.h +13 -12
- package/SVF-linux/include/SVF-FE/LLVMUtil.h +4 -4
- package/SVF-linux/include/SVF-FE/SVFIRBuilder.h +13 -9
- package/SVF-linux/include/SVF-FE/SymbolTableBuilder.h +3 -2
- package/SVF-linux/include/Util/BDDExpr.h +32 -16
- package/SVF-linux/include/Util/BasicTypes.h +77 -25
- package/SVF-linux/include/Util/CoreBitVector.h +2 -1
- package/SVF-linux/include/Util/CxtStmt.h +37 -27
- package/SVF-linux/include/Util/ExeState.h +42 -22
- package/SVF-linux/include/Util/ExtAPI.h +1 -1
- package/SVF-linux/include/Util/NodeIDAllocator.h +7 -4
- package/SVF-linux/include/Util/Options.h +3 -3
- package/SVF-linux/include/Util/SVFBasicTypes.h +49 -40
- package/SVF-linux/include/Util/SVFModule.h +5 -5
- package/SVF-linux/include/Util/SVFUtil.h +12 -9
- package/SVF-linux/include/Util/Z3Expr.h +191 -144
- package/SVF-linux/include/WPA/Andersen.h +11 -11
- package/SVF-linux/include/WPA/VersionedFlowSensitive.h +4 -1
- package/SVF-osx/Release-build/lib/CUDD/libCudd.a +0 -0
- package/SVF-osx/Release-build/lib/libSvf.a +0 -0
- package/SVF-osx/include/CFL/CFGNormalizer.h +6 -3
- package/SVF-osx/include/CFL/CFLAlias.h +26 -15
- package/SVF-osx/include/CFL/CFLGrammar.h +30 -16
- package/SVF-osx/include/CFL/CFLSolver.h +9 -5
- package/SVF-osx/include/CFL/GrammarBuilder.h +10 -7
- package/SVF-osx/include/CUDD/cudd.h +20 -11
- package/SVF-osx/include/CUDD/cuddInt.h +48 -31
- package/SVF-osx/include/CUDD/epd.h +35 -29
- package/SVF-osx/include/CUDD/mtr.h +4 -3
- package/SVF-osx/include/CUDD/st.h +7 -4
- package/SVF-osx/include/CUDD/util.h +6 -6
- package/SVF-osx/include/FastCluster/fastcluster.h +13 -12
- package/SVF-osx/include/Graphs/CFLGraph.h +16 -10
- package/SVF-osx/include/Graphs/CHG.h +2 -2
- package/SVF-osx/include/Graphs/ConsG.h +2 -1
- package/SVF-osx/include/Graphs/GenericGraph.h +3 -3
- package/SVF-osx/include/Graphs/ICFG.h +2 -2
- package/SVF-osx/include/Graphs/ICFGEdge.h +16 -9
- package/SVF-osx/include/Graphs/ICFGNode.h +2 -2
- package/SVF-osx/include/Graphs/IRGraph.h +10 -6
- package/SVF-osx/include/Graphs/PTACallGraph.h +1 -1
- package/SVF-osx/include/Graphs/SVFG.h +4 -3
- package/SVF-osx/include/Graphs/SVFGNode.h +14 -8
- package/SVF-osx/include/Graphs/ThreadCallGraph.h +4 -2
- package/SVF-osx/include/Graphs/VFG.h +45 -39
- package/SVF-osx/include/Graphs/VFGNode.h +8 -4
- package/SVF-osx/include/MSSA/MemSSA.h +1 -1
- package/SVF-osx/include/MTA/FSMPTA.h +55 -44
- package/SVF-osx/include/MTA/LockAnalysis.h +11 -9
- package/SVF-osx/include/MTA/LockResultValidator.h +64 -54
- package/SVF-osx/include/MTA/MHP.h +17 -13
- package/SVF-osx/include/MTA/MTAResultValidator.h +24 -20
- package/SVF-osx/include/MTA/PCG.h +9 -7
- package/SVF-osx/include/MTA/TCT.h +27 -22
- package/SVF-osx/include/MemoryModel/LocationSet.h +5 -3
- package/SVF-osx/include/MemoryModel/PersistentPointsToCache.h +28 -13
- package/SVF-osx/include/MemoryModel/PersistentPointsToDS.h +2 -2
- package/SVF-osx/include/MemoryModel/PointerAnalysis.h +5 -4
- package/SVF-osx/include/MemoryModel/PointsTo.h +8 -2
- package/SVF-osx/include/MemoryModel/SVFIR.h +6 -5
- package/SVF-osx/include/MemoryModel/SVFStatements.h +65 -45
- package/SVF-osx/include/MemoryModel/SVFVariables.h +6 -5
- package/SVF-osx/include/MemoryModel/SymbolTableInfo.h +18 -15
- package/SVF-osx/include/SABER/PathCondAllocator.h +14 -7
- package/SVF-osx/include/SABER/ProgSlice.h +2 -1
- package/SVF-osx/include/SABER/SaberSVFGBuilder.h +1 -1
- package/SVF-osx/include/SABER/SrcSnkDDA.h +8 -4
- package/SVF-osx/include/SVF-FE/CHGBuilder.h +4 -2
- package/SVF-osx/include/SVF-FE/DataFlowUtil.h +10 -9
- package/SVF-osx/include/SVF-FE/IRAnnotator.h +8 -8
- package/SVF-osx/include/SVF-FE/LLVMModule.h +13 -12
- package/SVF-osx/include/SVF-FE/LLVMUtil.h +4 -4
- package/SVF-osx/include/SVF-FE/SVFIRBuilder.h +13 -9
- package/SVF-osx/include/SVF-FE/SymbolTableBuilder.h +3 -2
- package/SVF-osx/include/Util/BDDExpr.h +32 -16
- package/SVF-osx/include/Util/BasicTypes.h +77 -25
- package/SVF-osx/include/Util/CoreBitVector.h +2 -1
- package/SVF-osx/include/Util/CxtStmt.h +37 -27
- package/SVF-osx/include/Util/ExeState.h +42 -22
- package/SVF-osx/include/Util/ExtAPI.h +1 -1
- package/SVF-osx/include/Util/NodeIDAllocator.h +7 -4
- package/SVF-osx/include/Util/Options.h +3 -3
- package/SVF-osx/include/Util/SVFBasicTypes.h +49 -40
- package/SVF-osx/include/Util/SVFModule.h +5 -5
- package/SVF-osx/include/Util/SVFUtil.h +12 -9
- package/SVF-osx/include/Util/Z3Expr.h +191 -144
- package/SVF-osx/include/WPA/Andersen.h +11 -11
- package/SVF-osx/include/WPA/VersionedFlowSensitive.h +4 -1
- package/package.json +1 -1
|
@@ -83,10 +83,11 @@ public:
|
|
|
83
83
|
SVFModule* buildSVFModule(Module &mod);
|
|
84
84
|
SVFModule* buildSVFModule(const std::vector<std::string> &moduleNameVec);
|
|
85
85
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
86
|
+
inline SVFModule* getSVFModule()
|
|
87
|
+
{
|
|
88
|
+
assert(svfModule && "svfModule has not been built yet!");
|
|
89
|
+
return svfModule;
|
|
90
|
+
}
|
|
90
91
|
|
|
91
92
|
void preProcessBCs(std::vector<std::string> &moduleNameVec);
|
|
92
93
|
|
|
@@ -148,15 +149,15 @@ public:
|
|
|
148
149
|
|
|
149
150
|
bool hasDeclaration(const SVFFunction *fun) const
|
|
150
151
|
{
|
|
151
|
-
|
|
152
|
-
|
|
152
|
+
if(fun->isDeclaration() && !hasDefinition(fun))
|
|
153
|
+
return false;
|
|
153
154
|
|
|
154
|
-
|
|
155
|
+
const SVFFunction* funDef = fun;
|
|
155
156
|
if(fun->isDeclaration() && hasDefinition(fun))
|
|
156
|
-
|
|
157
|
+
funDef = getDefinition(fun);
|
|
157
158
|
|
|
158
|
-
|
|
159
|
-
|
|
159
|
+
FunDefToDeclsMapTy::const_iterator it = FunDefToDeclsMap.find(funDef);
|
|
160
|
+
return it != FunDefToDeclsMap.end();
|
|
160
161
|
}
|
|
161
162
|
|
|
162
163
|
const FunctionSetType& getDeclaration(const Function *fun) const
|
|
@@ -166,9 +167,9 @@ public:
|
|
|
166
167
|
|
|
167
168
|
const FunctionSetType& getDeclaration(const SVFFunction *fun) const
|
|
168
169
|
{
|
|
169
|
-
|
|
170
|
+
const SVFFunction* funDef = fun;
|
|
170
171
|
if(fun->isDeclaration() && hasDefinition(fun))
|
|
171
|
-
|
|
172
|
+
funDef = getDefinition(fun);
|
|
172
173
|
|
|
173
174
|
FunDefToDeclsMapTy::const_iterator it = FunDefToDeclsMap.find(funDef);
|
|
174
175
|
assert(it != FunDefToDeclsMap.end() && "does not have a function definition (body)?");
|
|
@@ -406,10 +406,10 @@ bool isObject (const Value * ref);
|
|
|
406
406
|
/// Return true if the value refers to constant data, e.g., i32 0
|
|
407
407
|
inline bool isConstantData(const Value* val)
|
|
408
408
|
{
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
409
|
+
return SVFUtil::isa<ConstantData>(val)
|
|
410
|
+
|| SVFUtil::isa<ConstantAggregate>(val)
|
|
411
|
+
|| SVFUtil::isa<MetadataAsValue>(val)
|
|
412
|
+
|| SVFUtil::isa<BlockAddress>(val);
|
|
413
413
|
}
|
|
414
414
|
|
|
415
415
|
/// Method for dead function, which does not have any possible caller
|
|
@@ -130,8 +130,9 @@ public:
|
|
|
130
130
|
{
|
|
131
131
|
visitCallSite(&II);
|
|
132
132
|
}
|
|
133
|
-
void visitCallBrInst(CallBrInst &I)
|
|
134
|
-
|
|
133
|
+
void visitCallBrInst(CallBrInst &I)
|
|
134
|
+
{
|
|
135
|
+
return visitCallSite(&I);
|
|
135
136
|
}
|
|
136
137
|
void visitCallSite(CallSite cs);
|
|
137
138
|
void visitReturnInst(ReturnInst &I);
|
|
@@ -155,9 +156,9 @@ public:
|
|
|
155
156
|
/// TODO: var arguments need to be handled.
|
|
156
157
|
/// https://llvm.org/docs/LangRef.html#id1911
|
|
157
158
|
void visitVAArgInst(VAArgInst&);
|
|
158
|
-
void visitVACopyInst(VACopyInst&){}
|
|
159
|
-
void visitVAEndInst(VAEndInst&){}
|
|
160
|
-
void visitVAStartInst(VAStartInst&){}
|
|
159
|
+
void visitVACopyInst(VACopyInst&) {}
|
|
160
|
+
void visitVAEndInst(VAEndInst&) {}
|
|
161
|
+
void visitVAStartInst(VAStartInst&) {}
|
|
161
162
|
|
|
162
163
|
/// <result> = freeze ty <val>
|
|
163
164
|
/// If <val> is undef or poison, ‘freeze’ returns an arbitrary, but fixed value of type `ty`
|
|
@@ -293,7 +294,8 @@ protected:
|
|
|
293
294
|
/// Add Address edge
|
|
294
295
|
inline AddrStmt* addAddrEdge(NodeID src, NodeID dst)
|
|
295
296
|
{
|
|
296
|
-
if(AddrStmt *edge = pag->addAddrStmt(src, dst))
|
|
297
|
+
if(AddrStmt *edge = pag->addAddrStmt(src, dst))
|
|
298
|
+
{
|
|
297
299
|
setCurrentBBAndValueForPAGEdge(edge);
|
|
298
300
|
return edge;
|
|
299
301
|
}
|
|
@@ -302,7 +304,8 @@ protected:
|
|
|
302
304
|
/// Add Copy edge
|
|
303
305
|
inline CopyStmt* addCopyEdge(NodeID src, NodeID dst)
|
|
304
306
|
{
|
|
305
|
-
if(CopyStmt *edge = pag->addCopyStmt(src, dst))
|
|
307
|
+
if(CopyStmt *edge = pag->addCopyStmt(src, dst))
|
|
308
|
+
{
|
|
306
309
|
setCurrentBBAndValueForPAGEdge(edge);
|
|
307
310
|
return edge;
|
|
308
311
|
}
|
|
@@ -339,8 +342,9 @@ protected:
|
|
|
339
342
|
if(UnaryOPStmt *edge = pag->addUnaryOPStmt(src, dst, opcode))
|
|
340
343
|
setCurrentBBAndValueForPAGEdge(edge);
|
|
341
344
|
}
|
|
342
|
-
/// Add Branch statement
|
|
343
|
-
inline void addBranchStmt(NodeID br, NodeID cond, const BranchStmt::SuccAndCondPairVec& succs)
|
|
345
|
+
/// Add Branch statement
|
|
346
|
+
inline void addBranchStmt(NodeID br, NodeID cond, const BranchStmt::SuccAndCondPairVec& succs)
|
|
347
|
+
{
|
|
344
348
|
if(BranchStmt *edge = pag->addBranchStmt(br, cond, succs))
|
|
345
349
|
setCurrentBBAndValueForPAGEdge(edge);
|
|
346
350
|
}
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
namespace SVF
|
|
40
40
|
{
|
|
41
41
|
|
|
42
|
-
class SymbolTableBuilder
|
|
42
|
+
class SymbolTableBuilder
|
|
43
43
|
{
|
|
44
44
|
|
|
45
45
|
private:
|
|
@@ -47,7 +47,8 @@ private:
|
|
|
47
47
|
|
|
48
48
|
public:
|
|
49
49
|
/// Constructor
|
|
50
|
-
SymbolTableBuilder(SymbolTableInfo* si): symInfo(si)
|
|
50
|
+
SymbolTableBuilder(SymbolTableInfo* si): symInfo(si)
|
|
51
|
+
{
|
|
51
52
|
}
|
|
52
53
|
|
|
53
54
|
/// Start building memory model
|
|
@@ -36,9 +36,11 @@
|
|
|
36
36
|
#include "CUDD/cuddInt.h"
|
|
37
37
|
#include "z3++.h"
|
|
38
38
|
|
|
39
|
-
namespace SVF
|
|
39
|
+
namespace SVF
|
|
40
|
+
{
|
|
40
41
|
|
|
41
|
-
class BDDExprManager
|
|
42
|
+
class BDDExprManager
|
|
43
|
+
{
|
|
42
44
|
public:
|
|
43
45
|
typedef DdNode BDDExpr;
|
|
44
46
|
typedef Map<u32_t, BDDExpr *> IndexToBDDExpr;
|
|
@@ -47,11 +49,13 @@ private:
|
|
|
47
49
|
IndexToBDDExpr indexToBddCondMap;
|
|
48
50
|
DdManager *m_bdd_mgr;
|
|
49
51
|
|
|
50
|
-
inline BDDExpr *BddOne() const
|
|
52
|
+
inline BDDExpr *BddOne() const
|
|
53
|
+
{
|
|
51
54
|
return Cudd_ReadOne(m_bdd_mgr);
|
|
52
55
|
}
|
|
53
56
|
|
|
54
|
-
inline BDDExpr *BddZero() const
|
|
57
|
+
inline BDDExpr *BddZero() const
|
|
58
|
+
{
|
|
55
59
|
return Cudd_ReadLogicZero(m_bdd_mgr);
|
|
56
60
|
}
|
|
57
61
|
|
|
@@ -65,7 +69,8 @@ public:
|
|
|
65
69
|
//@{
|
|
66
70
|
static BDDExprManager *getBDDExprMgr();
|
|
67
71
|
|
|
68
|
-
static void releaseBDDExprMgr()
|
|
72
|
+
static void releaseBDDExprMgr()
|
|
73
|
+
{
|
|
69
74
|
delete bddExprMgr;
|
|
70
75
|
bddExprMgr = nullptr;
|
|
71
76
|
}
|
|
@@ -74,7 +79,8 @@ public:
|
|
|
74
79
|
/// Destructor
|
|
75
80
|
virtual ~BDDExprManager();
|
|
76
81
|
|
|
77
|
-
BDDExpr *createCond(u32_t i)
|
|
82
|
+
BDDExpr *createCond(u32_t i)
|
|
83
|
+
{
|
|
78
84
|
assert(indexToBddCondMap.find(i) == indexToBddCondMap.end() &&
|
|
79
85
|
"This should be fresh index to create new BDD");
|
|
80
86
|
BDDExpr *bddCond = Cudd_bddIthVar(m_bdd_mgr, i);
|
|
@@ -85,18 +91,21 @@ public:
|
|
|
85
91
|
virtual BDDExpr *createFreshBranchCond(const Instruction *inst);
|
|
86
92
|
|
|
87
93
|
/// Return the number of condition expressions
|
|
88
|
-
virtual inline u32_t getCondNumber()
|
|
94
|
+
virtual inline u32_t getCondNumber()
|
|
95
|
+
{
|
|
89
96
|
return Cudd_ReadNodeCount(m_bdd_mgr);
|
|
90
97
|
}
|
|
91
98
|
|
|
92
99
|
|
|
93
100
|
/// Return the unique true condition
|
|
94
|
-
inline BDDExpr *getTrueCond() const
|
|
101
|
+
inline BDDExpr *getTrueCond() const
|
|
102
|
+
{
|
|
95
103
|
return trueCond;
|
|
96
104
|
}
|
|
97
105
|
|
|
98
106
|
/// Return the unique false condition
|
|
99
|
-
inline BDDExpr *getFalseCond() const
|
|
107
|
+
inline BDDExpr *getFalseCond() const
|
|
108
|
+
{
|
|
100
109
|
return falseCond;
|
|
101
110
|
}
|
|
102
111
|
|
|
@@ -109,17 +118,20 @@ public:
|
|
|
109
118
|
virtual BDDExpr *NEG(BDDExpr *lhs);
|
|
110
119
|
//@}
|
|
111
120
|
|
|
112
|
-
virtual bool isNegCond(const BDDExpr *cond)
|
|
121
|
+
virtual bool isNegCond(const BDDExpr *cond)
|
|
122
|
+
{
|
|
113
123
|
return false;
|
|
114
124
|
}
|
|
115
125
|
|
|
116
126
|
/// Whether the condition is satisfiable
|
|
117
|
-
virtual bool isSatisfiable(const BDDExpr *cond)
|
|
127
|
+
virtual bool isSatisfiable(const BDDExpr *cond)
|
|
128
|
+
{
|
|
118
129
|
return cond != getFalseCond();
|
|
119
130
|
}
|
|
120
131
|
|
|
121
132
|
/// Whether lhs and rhs are equivalent branch conditions
|
|
122
|
-
virtual bool isEquivalentBranchCond(const BDDExpr *lhs, const BDDExpr *rhs)
|
|
133
|
+
virtual bool isEquivalentBranchCond(const BDDExpr *lhs, const BDDExpr *rhs)
|
|
134
|
+
{
|
|
123
135
|
return lhs == rhs;
|
|
124
136
|
}
|
|
125
137
|
|
|
@@ -127,7 +139,8 @@ public:
|
|
|
127
139
|
bool isAllPathReachable(const BDDExpr *e);
|
|
128
140
|
|
|
129
141
|
/// Get condition using condition id (z3 ast id)
|
|
130
|
-
virtual BDDExpr *getCond(u32_t id)
|
|
142
|
+
virtual BDDExpr *getCond(u32_t id)
|
|
143
|
+
{
|
|
131
144
|
auto it = indexToBddCondMap.find(id);
|
|
132
145
|
assert(it != indexToBddCondMap.end() && "condition not found!");
|
|
133
146
|
return it->second;
|
|
@@ -135,13 +148,15 @@ public:
|
|
|
135
148
|
|
|
136
149
|
/// Get/Set llvm conditional expression
|
|
137
150
|
//{@
|
|
138
|
-
inline const Instruction *getCondInst(const BDDExpr *cond) const
|
|
151
|
+
inline const Instruction *getCondInst(const BDDExpr *cond) const
|
|
152
|
+
{
|
|
139
153
|
CondToTermInstMap::const_iterator it = condToInstMap.find(cond);
|
|
140
154
|
assert(it != condToInstMap.end() && "this should be a fresh condition");
|
|
141
155
|
return it->second;
|
|
142
156
|
}
|
|
143
157
|
|
|
144
|
-
inline void setCondInst(const BDDExpr *cond, const Instruction *inst)
|
|
158
|
+
inline void setCondInst(const BDDExpr *cond, const Instruction *inst)
|
|
159
|
+
{
|
|
145
160
|
assert(condToInstMap.find(cond) == condToInstMap.end() && "this should be a fresh condition");
|
|
146
161
|
condToInstMap[cond] = inst;
|
|
147
162
|
}
|
|
@@ -161,7 +176,8 @@ public:
|
|
|
161
176
|
|
|
162
177
|
std::string dumpStr(const BDDExpr *e) const;
|
|
163
178
|
|
|
164
|
-
inline std::string getMemUsage()
|
|
179
|
+
inline std::string getMemUsage()
|
|
180
|
+
{
|
|
165
181
|
return std::to_string(Cudd_ReadMemoryInUse(m_bdd_mgr));
|
|
166
182
|
}
|
|
167
183
|
|
|
@@ -84,9 +84,9 @@ typedef llvm::Use Use;
|
|
|
84
84
|
typedef llvm::Loop Loop;
|
|
85
85
|
typedef llvm::LoopInfo LoopInfo;
|
|
86
86
|
#if LLVM_VERSION_MAJOR >= 12
|
|
87
|
-
|
|
87
|
+
typedef llvm::UnifyFunctionExitNodesLegacyPass UnifyFunctionExitNodes;
|
|
88
88
|
#else
|
|
89
|
-
|
|
89
|
+
typedef llvm::UnifyFunctionExitNodes UnifyFunctionExitNodes;
|
|
90
90
|
#endif
|
|
91
91
|
typedef llvm::ModulePass ModulePass;
|
|
92
92
|
|
|
@@ -150,9 +150,9 @@ typedef llvm::LoopInfoWrapperPass LoopInfoWrapperPass;
|
|
|
150
150
|
/// LLVM Iterators
|
|
151
151
|
typedef llvm::inst_iterator inst_iterator;
|
|
152
152
|
#if LLVM_VERSION_MAJOR >= 11
|
|
153
|
-
|
|
153
|
+
typedef llvm::const_succ_iterator succ_const_iterator;
|
|
154
154
|
#else
|
|
155
|
-
|
|
155
|
+
typedef llvm::succ_const_iterator succ_const_iterator;
|
|
156
156
|
#endif
|
|
157
157
|
typedef llvm::const_inst_iterator const_inst_iterator;
|
|
158
158
|
typedef llvm::const_pred_iterator const_pred_iterator;
|
|
@@ -251,32 +251,82 @@ public:
|
|
|
251
251
|
|
|
252
252
|
};
|
|
253
253
|
|
|
254
|
-
class CallSite
|
|
254
|
+
class CallSite
|
|
255
|
+
{
|
|
255
256
|
private:
|
|
256
257
|
CallBase *CB;
|
|
257
258
|
public:
|
|
258
259
|
CallSite(Instruction *I) : CB(SVFUtil::dyn_cast<CallBase>(I)) {}
|
|
259
260
|
CallSite(Value *I) : CB(SVFUtil::dyn_cast<CallBase>(I)) {}
|
|
260
261
|
|
|
261
|
-
CallBase *getInstruction() const
|
|
262
|
+
CallBase *getInstruction() const
|
|
263
|
+
{
|
|
264
|
+
return CB;
|
|
265
|
+
}
|
|
262
266
|
using arg_iterator = User::const_op_iterator;
|
|
263
|
-
Value *getArgument(unsigned ArgNo) const
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
267
|
+
Value *getArgument(unsigned ArgNo) const
|
|
268
|
+
{
|
|
269
|
+
return CB->getArgOperand(ArgNo);
|
|
270
|
+
}
|
|
271
|
+
Type *getType() const
|
|
272
|
+
{
|
|
273
|
+
return CB->getType();
|
|
274
|
+
}
|
|
275
|
+
User::const_op_iterator arg_begin() const
|
|
276
|
+
{
|
|
277
|
+
return CB->arg_begin();
|
|
278
|
+
}
|
|
279
|
+
User::const_op_iterator arg_end() const
|
|
280
|
+
{
|
|
281
|
+
return CB->arg_end();
|
|
282
|
+
}
|
|
283
|
+
unsigned arg_size() const
|
|
284
|
+
{
|
|
285
|
+
return CB->arg_size();
|
|
286
|
+
}
|
|
287
|
+
bool arg_empty() const
|
|
288
|
+
{
|
|
289
|
+
return CB->arg_empty();
|
|
290
|
+
}
|
|
291
|
+
Value *getArgOperand(unsigned i) const
|
|
292
|
+
{
|
|
293
|
+
return CB->getArgOperand(i);
|
|
294
|
+
}
|
|
295
|
+
unsigned getNumArgOperands() const
|
|
296
|
+
{
|
|
297
|
+
return CB->arg_size();
|
|
298
|
+
}
|
|
299
|
+
Function *getCalledFunction() const
|
|
300
|
+
{
|
|
301
|
+
return CB->getCalledFunction();
|
|
302
|
+
}
|
|
303
|
+
Value *getCalledValue() const
|
|
304
|
+
{
|
|
305
|
+
return CB->getCalledOperand();
|
|
306
|
+
}
|
|
307
|
+
Function *getCaller() const
|
|
308
|
+
{
|
|
309
|
+
return CB->getCaller();
|
|
310
|
+
}
|
|
311
|
+
FunctionType *getFunctionType() const
|
|
312
|
+
{
|
|
313
|
+
return CB->getFunctionType();
|
|
314
|
+
}
|
|
315
|
+
bool paramHasAttr(unsigned ArgNo, llvm::Attribute::AttrKind Kind) const
|
|
316
|
+
{
|
|
317
|
+
return CB->paramHasAttr(ArgNo, Kind);
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
bool operator==(const CallSite &CS) const
|
|
321
|
+
{
|
|
322
|
+
return CB == CS.CB;
|
|
323
|
+
}
|
|
324
|
+
bool operator!=(const CallSite &CS) const
|
|
325
|
+
{
|
|
326
|
+
return CB != CS.CB;
|
|
327
|
+
}
|
|
328
|
+
bool operator<(const CallSite &CS) const
|
|
329
|
+
{
|
|
280
330
|
return getInstruction() < CS.getInstruction();
|
|
281
331
|
}
|
|
282
332
|
|
|
@@ -292,8 +342,10 @@ OutStream& operator<< (OutStream &o, const std::pair<F, S> &var)
|
|
|
292
342
|
} // End namespace SVF
|
|
293
343
|
|
|
294
344
|
/// Specialise hash for CallSites.
|
|
295
|
-
template <> struct std::hash<SVF::CallSite>
|
|
296
|
-
|
|
345
|
+
template <> struct std::hash<SVF::CallSite>
|
|
346
|
+
{
|
|
347
|
+
size_t operator()(const SVF::CallSite &cs) const
|
|
348
|
+
{
|
|
297
349
|
std::hash<SVF::Instruction *> h;
|
|
298
350
|
return h(cs.getInstruction());
|
|
299
351
|
}
|
|
@@ -455,36 +455,46 @@ private:
|
|
|
455
455
|
|
|
456
456
|
} // End namespace SVF
|
|
457
457
|
// Specialise has for class defined in this header file
|
|
458
|
-
template <> struct std::hash<SVF::CxtThread>
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
458
|
+
template <> struct std::hash<SVF::CxtThread>
|
|
459
|
+
{
|
|
460
|
+
size_t operator()(const SVF::CxtThread& cs) const
|
|
461
|
+
{
|
|
462
|
+
std::hash<SVF::CallStrCxt> h;
|
|
463
|
+
return h(cs.getContext());
|
|
464
|
+
}
|
|
463
465
|
};
|
|
464
|
-
template <> struct std::hash<SVF::CxtThreadProc>
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
466
|
+
template <> struct std::hash<SVF::CxtThreadProc>
|
|
467
|
+
{
|
|
468
|
+
size_t operator()(const SVF::CxtThreadProc& ctp) const
|
|
469
|
+
{
|
|
470
|
+
std::hash<SVF::NodeID> h;
|
|
471
|
+
return h(ctp.getTid());
|
|
472
|
+
}
|
|
469
473
|
};
|
|
470
|
-
template <> struct std::hash<SVF::CxtThreadStmt>
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
474
|
+
template <> struct std::hash<SVF::CxtThreadStmt>
|
|
475
|
+
{
|
|
476
|
+
size_t operator()(const SVF::CxtThreadStmt& cts) const
|
|
477
|
+
{
|
|
478
|
+
std::hash<SVF::NodeID> h;
|
|
479
|
+
return h(cts.getTid());
|
|
480
|
+
}
|
|
475
481
|
};
|
|
476
|
-
template <> struct std::hash<SVF::CxtStmt>
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
+
template <> struct std::hash<SVF::CxtStmt>
|
|
483
|
+
{
|
|
484
|
+
size_t operator()(const SVF::CxtStmt& cs) const
|
|
485
|
+
{
|
|
486
|
+
std::hash<SVF::Instruction*> h;
|
|
487
|
+
SVF::Instruction* inst = const_cast<SVF::Instruction*> (cs.getStmt());
|
|
488
|
+
return h(inst);
|
|
489
|
+
}
|
|
482
490
|
};
|
|
483
|
-
template <> struct std::hash<SVF::CxtProc>
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
491
|
+
template <> struct std::hash<SVF::CxtProc>
|
|
492
|
+
{
|
|
493
|
+
size_t operator()(const SVF::CxtProc& cs) const
|
|
494
|
+
{
|
|
495
|
+
std::hash<SVF::SVFFunction*> h;
|
|
496
|
+
SVF::SVFFunction* fun = const_cast<SVF::SVFFunction*> (cs.getProc());
|
|
497
|
+
return h(fun);
|
|
498
|
+
}
|
|
489
499
|
};
|
|
490
500
|
#endif /* INCLUDE_UTIL_CXTSTMT_H_ */
|
|
@@ -31,12 +31,14 @@
|
|
|
31
31
|
#include "Util/Z3Expr.h"
|
|
32
32
|
#include "MemoryModel/SVFVariables.h"
|
|
33
33
|
|
|
34
|
-
namespace SVF
|
|
34
|
+
namespace SVF
|
|
35
|
+
{
|
|
35
36
|
|
|
36
37
|
#define AddressMask 0x7f000000
|
|
37
38
|
#define FlippedAddressMask (AddressMask^0xffffffff)
|
|
38
39
|
|
|
39
|
-
class ExeState
|
|
40
|
+
class ExeState
|
|
41
|
+
{
|
|
40
42
|
public:
|
|
41
43
|
typedef Map<u32_t, Z3Expr> VarToValMap;
|
|
42
44
|
typedef VarToValMap LocToValMap;
|
|
@@ -50,11 +52,12 @@ public:
|
|
|
50
52
|
ExeState() : pathConstraint(getContext().bool_val(true)) {}
|
|
51
53
|
|
|
52
54
|
ExeState(const Z3Expr &_pc, VarToValMap &_varToValMap, LocToValMap &_locToValMap) : varToVal(_varToValMap),
|
|
53
|
-
|
|
54
|
-
|
|
55
|
+
locToVal(_locToValMap),
|
|
56
|
+
pathConstraint(_pc) {}
|
|
55
57
|
|
|
56
58
|
ExeState(const ExeState &rhs) : varToVal(rhs.getVarToVal()), locToVal(rhs.getLocToVal()),
|
|
57
|
-
|
|
59
|
+
pathConstraint(rhs.getPathConstraint())
|
|
60
|
+
{
|
|
58
61
|
|
|
59
62
|
}
|
|
60
63
|
|
|
@@ -66,7 +69,8 @@ public:
|
|
|
66
69
|
bool operator==(const ExeState &rhs) const;
|
|
67
70
|
|
|
68
71
|
/// Overloading Operator!=
|
|
69
|
-
inline bool operator!=(const ExeState &rhs) const
|
|
72
|
+
inline bool operator!=(const ExeState &rhs) const
|
|
73
|
+
{
|
|
70
74
|
return !(*this == rhs);
|
|
71
75
|
}
|
|
72
76
|
|
|
@@ -75,27 +79,33 @@ public:
|
|
|
75
79
|
|
|
76
80
|
|
|
77
81
|
|
|
78
|
-
z3::context &getContext()
|
|
82
|
+
z3::context &getContext()
|
|
83
|
+
{
|
|
79
84
|
return Z3Expr::getContext();
|
|
80
85
|
}
|
|
81
86
|
|
|
82
|
-
const VarToValMap &getVarToVal() const
|
|
87
|
+
const VarToValMap &getVarToVal() const
|
|
88
|
+
{
|
|
83
89
|
return varToVal;
|
|
84
90
|
}
|
|
85
91
|
|
|
86
|
-
const LocToValMap &getLocToVal() const
|
|
92
|
+
const LocToValMap &getLocToVal() const
|
|
93
|
+
{
|
|
87
94
|
return locToVal;
|
|
88
95
|
}
|
|
89
96
|
|
|
90
|
-
const Z3Expr &getPathConstraint() const
|
|
97
|
+
const Z3Expr &getPathConstraint() const
|
|
98
|
+
{
|
|
91
99
|
return pathConstraint;
|
|
92
100
|
}
|
|
93
101
|
|
|
94
|
-
void setPathConstraint(const Z3Expr &pc)
|
|
102
|
+
void setPathConstraint(const Z3Expr &pc)
|
|
103
|
+
{
|
|
95
104
|
pathConstraint = pc.simplify();
|
|
96
105
|
}
|
|
97
106
|
|
|
98
|
-
inline Z3Expr &operator[](u32_t varId)
|
|
107
|
+
inline Z3Expr &operator[](u32_t varId)
|
|
108
|
+
{
|
|
99
109
|
return getZ3Expr(varId);
|
|
100
110
|
}
|
|
101
111
|
|
|
@@ -115,22 +125,26 @@ public:
|
|
|
115
125
|
Z3Expr &load(const Z3Expr &loc);
|
|
116
126
|
|
|
117
127
|
/// The physical address starts with 0x7f...... + idx
|
|
118
|
-
inline u32_t getVirtualMemAddress(u32_t idx) const
|
|
128
|
+
inline u32_t getVirtualMemAddress(u32_t idx) const
|
|
129
|
+
{
|
|
119
130
|
return AddressMask + idx;
|
|
120
131
|
}
|
|
121
132
|
|
|
122
133
|
/// Check bit value of val start with 0x7F000000, filter by 0xFF000000
|
|
123
|
-
inline bool isVirtualMemAddress(u32_t val)
|
|
134
|
+
inline bool isVirtualMemAddress(u32_t val)
|
|
135
|
+
{
|
|
124
136
|
return (val & 0xff000000) == AddressMask;
|
|
125
137
|
}
|
|
126
138
|
|
|
127
139
|
/// Return the internal index if idx is an address otherwise return the value of idx
|
|
128
|
-
inline u32_t getInternalID(u32_t idx) const
|
|
140
|
+
inline u32_t getInternalID(u32_t idx) const
|
|
141
|
+
{
|
|
129
142
|
return (idx & FlippedAddressMask);
|
|
130
143
|
}
|
|
131
144
|
|
|
132
145
|
/// Return int value from an expression if it is a numeral, otherwise return an approximate value
|
|
133
|
-
inline s32_t z3Expr2NumValue(const Z3Expr &e)
|
|
146
|
+
inline s32_t z3Expr2NumValue(const Z3Expr &e)
|
|
147
|
+
{
|
|
134
148
|
assert(e.is_numeral() && "not numeral?");
|
|
135
149
|
return e.get_numeral_int64();
|
|
136
150
|
}
|
|
@@ -142,30 +156,36 @@ private:
|
|
|
142
156
|
bool eqVarToValMap(const VarToValMap &lhs, const VarToValMap &rhs) const;
|
|
143
157
|
bool lessThanVarToValMap(const VarToValMap &lhs, const VarToValMap &rhs) const;
|
|
144
158
|
protected:
|
|
145
|
-
inline void store(u32_t objId, const Z3Expr &z3Expr)
|
|
159
|
+
inline void store(u32_t objId, const Z3Expr &z3Expr)
|
|
160
|
+
{
|
|
146
161
|
locToVal[objId] = z3Expr.simplify();
|
|
147
162
|
}
|
|
148
163
|
|
|
149
|
-
inline Z3Expr &load(u32_t objId)
|
|
164
|
+
inline Z3Expr &load(u32_t objId)
|
|
165
|
+
{
|
|
150
166
|
return locToVal[objId];
|
|
151
167
|
}
|
|
152
168
|
};
|
|
153
169
|
}
|
|
154
170
|
|
|
155
171
|
template<>
|
|
156
|
-
struct std::hash<SVF::ExeState>
|
|
157
|
-
|
|
172
|
+
struct std::hash<SVF::ExeState>
|
|
173
|
+
{
|
|
174
|
+
size_t operator()(const SVF::ExeState &exeState) const
|
|
175
|
+
{
|
|
158
176
|
|
|
159
177
|
size_t h = exeState.getVarToVal().size() * 2;
|
|
160
178
|
SVF::Hash<SVF::u32_t> hf;
|
|
161
|
-
for (const auto &t: exeState.getVarToVal())
|
|
179
|
+
for (const auto &t: exeState.getVarToVal())
|
|
180
|
+
{
|
|
162
181
|
h ^= hf(t.first) + 0x9e3779b9 + (h << 6) + (h >> 2);
|
|
163
182
|
h ^= hf(t.second.id()) + 0x9e3779b9 + (h << 6) + (h >> 2);
|
|
164
183
|
}
|
|
165
184
|
|
|
166
185
|
size_t h2 = exeState.getVarToVal().size() * 2;
|
|
167
186
|
|
|
168
|
-
for (const auto &t: exeState.getLocToVal())
|
|
187
|
+
for (const auto &t: exeState.getLocToVal())
|
|
188
|
+
{
|
|
169
189
|
h2 ^= hf(t.first) + 0x9e3779b9 + (h2 << 6) + (h2 >> 2);
|
|
170
190
|
h2 ^= hf(t.second.id()) + 0x9e3779b9 + (h2 << 6) + (h2 >> 2);
|
|
171
191
|
}
|