svf-lib 1.0.1806 → 1.0.1807
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-osx/Release-build/svf/libSvfCore.a +0 -0
- package/SVF-osx/Release-build/svf-llvm/libSvfLLVM.a +0 -0
- package/SVF-osx/svf/include/AbstractExecution/BoundedZ3Expr.h +0 -2
- package/SVF-osx/svf/include/AbstractExecution/ConsExeState.h +0 -8
- package/SVF-osx/svf/include/AbstractExecution/ExeState.h +0 -8
- package/SVF-osx/svf/include/AbstractExecution/IntervalExeState.h +272 -107
- package/SVF-osx/svf/include/AbstractExecution/IntervalValue.h +0 -3
- package/SVF-osx/svf/include/AbstractExecution/NumericLiteral.h +0 -2
- package/SVF-osx/svf/include/AbstractExecution/RelExeState.h +0 -1
- package/SVF-osx/svf/include/AbstractExecution/RelationSolver.h +9 -10
- package/SVF-osx/svf/include/AbstractExecution/SVFIR2ConsExeState.h +0 -1
- package/SVF-osx/svf/include/AbstractExecution/SVFIR2ItvExeState.h +0 -4
- package/SVF-osx/svf/include/AbstractExecution/SingleAbsValue.h +0 -2
- package/SVF-osx/svf/include/AbstractExecution/SymState.h +0 -4
- package/SVF-osx/svf/include/AbstractExecution/WTO.h +0 -5
- package/SVF-osx/svf/include/CFL/CFGrammar.h +0 -4
- package/SVF-osx/svf/include/CFL/CFLAlias.h +0 -1
- package/SVF-osx/svf/include/CFL/CFLGraphBuilder.h +0 -1
- package/SVF-osx/svf/include/CFL/CFLStat.h +0 -1
- package/SVF-osx/svf/include/CFL/CFLVF.h +0 -1
- package/SVF-osx/svf/include/DDA/ContextDDA.h +0 -1
- package/SVF-osx/svf/include/DDA/DDAClient.h +0 -5
- package/SVF-osx/svf/include/DDA/DDAPass.h +0 -1
- package/SVF-osx/svf/include/FastCluster/fastcluster.h +0 -1
- package/SVF-osx/svf/include/Graphs/CDG.h +0 -3
- package/SVF-osx/svf/include/Graphs/CFBasicBlockG.h +0 -3
- package/SVF-osx/svf/include/Graphs/CFLGraph.h +0 -1
- package/SVF-osx/svf/include/Graphs/CHG.h +2 -4
- package/SVF-osx/svf/include/Graphs/ConsGEdge.h +0 -5
- package/SVF-osx/svf/include/Graphs/ConsGNode.h +0 -1
- package/SVF-osx/svf/include/Graphs/DOTGraphTraits.h +0 -1
- package/SVF-osx/svf/include/Graphs/GenericGraph.h +0 -1
- package/SVF-osx/svf/include/Graphs/GraphPrinter.h +0 -3
- package/SVF-osx/svf/include/Graphs/GraphTraits.h +2 -2
- package/SVF-osx/svf/include/Graphs/ICFG.h +0 -1
- package/SVF-osx/svf/include/Graphs/ICFGNode.h +0 -3
- package/SVF-osx/svf/include/Graphs/ICFGStat.h +0 -2
- package/SVF-osx/svf/include/Graphs/IRGraph.h +0 -1
- package/SVF-osx/svf/include/Graphs/PTACallGraph.h +0 -3
- package/SVF-osx/svf/include/Graphs/SVFG.h +0 -2
- package/SVF-osx/svf/include/Graphs/SVFGEdge.h +0 -1
- package/SVF-osx/svf/include/Graphs/SVFGNode.h +0 -7
- package/SVF-osx/svf/include/Graphs/SVFGOPT.h +0 -3
- package/SVF-osx/svf/include/Graphs/SVFGStat.h +0 -2
- package/SVF-osx/svf/include/Graphs/ThreadCallGraph.h +0 -3
- package/SVF-osx/svf/include/Graphs/VFG.h +0 -2
- package/SVF-osx/svf/include/Graphs/VFGEdge.h +0 -3
- package/SVF-osx/svf/include/Graphs/VFGNode.h +0 -8
- package/SVF-osx/svf/include/MSSA/MSSAMuChi.h +0 -4
- package/SVF-osx/svf/include/MSSA/MemPartition.h +0 -1
- package/SVF-osx/svf/include/MSSA/MemRegion.h +0 -1
- package/SVF-osx/svf/include/MSSA/MemSSA.h +0 -1
- package/SVF-osx/svf/include/MTA/FSMPTA.h +0 -6
- package/SVF-osx/svf/include/MTA/LockAnalysis.h +0 -5
- package/SVF-osx/svf/include/MTA/MHP.h +0 -3
- package/SVF-osx/svf/include/MTA/MTA.h +0 -1
- package/SVF-osx/svf/include/MTA/MTAResultValidator.h +0 -2
- package/SVF-osx/svf/include/MTA/TCT.h +0 -1
- package/SVF-osx/svf/include/MemoryModel/AbstractPointsToDS.h +0 -2
- package/SVF-osx/svf/include/MemoryModel/AccessPath.h +0 -5
- package/SVF-osx/svf/include/MemoryModel/ConditionalPT.h +0 -5
- package/SVF-osx/svf/include/MemoryModel/PersistentPointsToDS.h +0 -1
- package/SVF-osx/svf/include/MemoryModel/PointerAnalysis.h +0 -1
- package/SVF-osx/svf/include/MemoryModel/PointerAnalysisImpl.h +0 -1
- package/SVF-osx/svf/include/MemoryModel/PointsTo.h +0 -1
- package/SVF-osx/svf/include/SABER/DoubleFreeChecker.h +0 -1
- package/SVF-osx/svf/include/SABER/ProgSlice.h +0 -1
- package/SVF-osx/svf/include/SABER/SaberCondAllocator.h +0 -4
- package/SVF-osx/svf/include/SABER/SaberSVFGBuilder.h +0 -1
- package/SVF-osx/svf/include/SVFIR/SVFIR.h +0 -2
- package/SVF-osx/svf/include/SVFIR/SVFStatements.h +0 -2
- package/SVF-osx/svf/include/SVFIR/SVFType.h +0 -2
- package/SVF-osx/svf/include/SVFIR/SVFValue.h +0 -3
- package/SVF-osx/svf/include/SVFIR/SVFVariables.h +0 -5
- package/SVF-osx/svf/include/SVFIR/SymbolTableInfo.h +0 -5
- package/SVF-osx/svf/include/Util/CDGBuilder.h +0 -8
- package/SVF-osx/svf/include/Util/CallGraphBuilder.h +0 -2
- package/SVF-osx/svf/include/Util/Casting.h +1 -2
- package/SVF-osx/svf/include/Util/CommandLine.h +0 -1
- package/SVF-osx/svf/include/Util/CxtStmt.h +0 -4
- package/SVF-osx/svf/include/Util/DPItem.h +0 -2
- package/SVF-osx/svf/include/Util/NodeIDAllocator.h +2 -2
- package/SVF-osx/svf/include/Util/SCC.h +0 -2
- package/SVF-osx/svf/include/Util/SVFBugReport.h +0 -1
- package/SVF-osx/svf/include/Util/SVFStat.h +0 -1
- package/SVF-osx/svf/include/Util/SVFUtil.h +0 -1
- package/SVF-osx/svf/include/Util/ThreadAPI.h +0 -1
- package/SVF-osx/svf/include/Util/WorkList.h +0 -1
- package/SVF-osx/svf/include/Util/Z3Expr.h +0 -4
- package/SVF-osx/svf/include/Util/iterator.h +2 -2
- package/SVF-osx/svf/include/WPA/Andersen.h +0 -6
- package/SVF-osx/svf/include/WPA/AndersenPWC.h +0 -3
- package/SVF-osx/svf/include/WPA/WPAFSSolver.h +0 -5
- package/SVF-osx/svf/include/WPA/WPAPass.h +0 -2
- package/SVF-osx/svf/include/WPA/WPASolver.h +0 -2
- package/SVF-osx/svf/include/WPA/WPAStat.h +0 -1
- package/SVF-osx/svf-llvm/include/SVF-LLVM/BreakConstantExpr.h +0 -1
- package/SVF-osx/svf-llvm/include/SVF-LLVM/DCHG.h +0 -1
- package/SVF-osx/svf-llvm/include/SVF-LLVM/GEPTypeBridgeIterator.h +0 -3
- package/SVF-osx/svf-llvm/include/SVF-LLVM/LLVMModule.h +0 -1
- package/SVF-osx/svf-llvm/include/SVF-LLVM/LLVMUtil.h +0 -1
- package/SVF-osx/svf-llvm/include/SVF-LLVM/SVFIRBuilder.h +0 -1
- package/SVF-osx/svf-llvm/include/SVF-LLVM/SymbolTableBuilder.h +0 -1
- package/package.json +1 -1
|
Binary file
|
|
Binary file
|
|
@@ -63,7 +63,6 @@ public:
|
|
|
63
63
|
|
|
64
64
|
BoundedZ3Expr(BoundedZ3Expr &&z3Expr) : Z3Expr(z3Expr) {}
|
|
65
65
|
|
|
66
|
-
|
|
67
66
|
inline BoundedZ3Expr &operator=(BoundedZ3Expr &&rhs)
|
|
68
67
|
{
|
|
69
68
|
Z3Expr::operator=(rhs);
|
|
@@ -388,4 +387,3 @@ struct std::hash<SVF::BoundedZ3Expr>
|
|
|
388
387
|
}
|
|
389
388
|
};
|
|
390
389
|
#endif //SVF_BOUNDEDZ3EXPR_H
|
|
391
|
-
|
|
@@ -57,7 +57,6 @@ public:
|
|
|
57
57
|
public:
|
|
58
58
|
ConsExeState(): ExeState(ExeState::SingleValueK) {}
|
|
59
59
|
|
|
60
|
-
|
|
61
60
|
/// Constructor
|
|
62
61
|
ConsExeState(VarToValMap varToValMap, LocToValMap locToValMap) : ExeState(ExeState::SingleValueK), _varToVal(
|
|
63
62
|
SVFUtil::move(varToValMap)), _locToVal(SVFUtil::move(locToValMap)) {}
|
|
@@ -361,8 +360,6 @@ public:
|
|
|
361
360
|
|
|
362
361
|
public:
|
|
363
362
|
|
|
364
|
-
|
|
365
|
-
|
|
366
363
|
s64_t getNumber(u32_t lhs);
|
|
367
364
|
|
|
368
365
|
static inline SingleAbsValue getIntOneZ3Expr()
|
|
@@ -409,14 +406,11 @@ public:
|
|
|
409
406
|
/// Whether two var to value map is equivalent
|
|
410
407
|
static bool eqVarToValMap(const VarToValMap &pre, const VarToValMap &nxt);
|
|
411
408
|
|
|
412
|
-
|
|
413
409
|
/// Whether lhs is less than rhs
|
|
414
410
|
static bool lessThanVarToValMap(const VarToValMap &lhs, const VarToValMap &rhs);
|
|
415
411
|
|
|
416
|
-
|
|
417
412
|
private:
|
|
418
413
|
|
|
419
|
-
|
|
420
414
|
static bool assign(SingleAbsValue &lhs, const SingleAbsValue &rhs);
|
|
421
415
|
|
|
422
416
|
inline bool store(u32_t objId, const SingleAbsValue &z3Expr)
|
|
@@ -446,6 +440,4 @@ struct std::hash<SVF::ConsExeState>
|
|
|
446
440
|
}
|
|
447
441
|
};
|
|
448
442
|
|
|
449
|
-
|
|
450
|
-
|
|
451
443
|
#endif // SVF_CONSEXESTATE_H
|
|
@@ -27,7 +27,6 @@
|
|
|
27
27
|
*
|
|
28
28
|
*/
|
|
29
29
|
|
|
30
|
-
|
|
31
30
|
#ifndef Z3_EXAMPLE_EXESTATE_H
|
|
32
31
|
#define Z3_EXAMPLE_EXESTATE_H
|
|
33
32
|
|
|
@@ -90,7 +89,6 @@ public:
|
|
|
90
89
|
return *this;
|
|
91
90
|
}
|
|
92
91
|
|
|
93
|
-
|
|
94
92
|
protected:
|
|
95
93
|
VarToAddrs _varToAddrs{{0, getVirtualMemAddress(0)}}; ///< Map a variable (symbol) to its memory addresses
|
|
96
94
|
VarToAddrs _locToAddrs; ///< Map a memory address to its stored memory addresses
|
|
@@ -115,7 +113,6 @@ public:
|
|
|
115
113
|
return _locToAddrs.find(id) != _locToAddrs.end();
|
|
116
114
|
}
|
|
117
115
|
|
|
118
|
-
|
|
119
116
|
inline virtual const VarToAddrs &getVarToAddrs() const
|
|
120
117
|
{
|
|
121
118
|
return _varToAddrs;
|
|
@@ -148,8 +145,6 @@ public:
|
|
|
148
145
|
return _kind;
|
|
149
146
|
}
|
|
150
147
|
|
|
151
|
-
|
|
152
|
-
|
|
153
148
|
public:
|
|
154
149
|
inline virtual void storeAddrs(u32_t addr, const Addrs &vaddrs)
|
|
155
150
|
{
|
|
@@ -285,11 +280,8 @@ public:
|
|
|
285
280
|
return AddressValue::getInternalID(idx);
|
|
286
281
|
}
|
|
287
282
|
|
|
288
|
-
|
|
289
283
|
}; // end class ExeState
|
|
290
284
|
|
|
291
|
-
|
|
292
|
-
|
|
293
285
|
} // end namespace SVF
|
|
294
286
|
|
|
295
287
|
template<>
|
|
@@ -51,38 +51,33 @@
|
|
|
51
51
|
|
|
52
52
|
namespace SVF
|
|
53
53
|
{
|
|
54
|
-
|
|
55
|
-
class IntervalExeState : public ExeState
|
|
54
|
+
class IntervalESBase: public ExeState
|
|
56
55
|
{
|
|
57
56
|
friend class SVFIR2ItvExeState;
|
|
58
57
|
friend class RelationSolver;
|
|
59
|
-
|
|
60
58
|
public:
|
|
61
59
|
typedef Map<u32_t, IntervalValue> VarToValMap;
|
|
62
60
|
|
|
63
61
|
typedef VarToValMap LocToValMap;
|
|
64
62
|
|
|
65
|
-
static IntervalExeState globalES;
|
|
66
|
-
|
|
67
63
|
public:
|
|
68
64
|
/// default constructor
|
|
69
|
-
|
|
65
|
+
IntervalESBase() : ExeState(ExeState::IntervalK) {}
|
|
70
66
|
|
|
71
|
-
|
|
67
|
+
IntervalESBase(VarToValMap &_varToValMap, LocToValMap &_locToValMap) : ExeState(ExeState::IntervalK),
|
|
72
68
|
_varToItvVal(_varToValMap),
|
|
73
69
|
_locToItvVal(_locToValMap) {}
|
|
74
70
|
|
|
75
71
|
/// copy constructor
|
|
76
|
-
|
|
72
|
+
IntervalESBase(const IntervalESBase &rhs) : ExeState(rhs), _varToItvVal(rhs.getVarToVal()),
|
|
77
73
|
_locToItvVal(rhs.getLocToVal())
|
|
78
74
|
{
|
|
79
75
|
|
|
80
76
|
}
|
|
81
77
|
|
|
82
|
-
virtual ~
|
|
83
|
-
|
|
78
|
+
virtual ~IntervalESBase() = default;
|
|
84
79
|
|
|
85
|
-
|
|
80
|
+
IntervalESBase &operator=(const IntervalESBase &rhs)
|
|
86
81
|
{
|
|
87
82
|
if (rhs != *this)
|
|
88
83
|
{
|
|
@@ -94,7 +89,7 @@ public:
|
|
|
94
89
|
}
|
|
95
90
|
|
|
96
91
|
/// move constructor
|
|
97
|
-
|
|
92
|
+
IntervalESBase(IntervalESBase &&rhs) : ExeState(std::move(rhs)),
|
|
98
93
|
_varToItvVal(std::move(rhs._varToItvVal)),
|
|
99
94
|
_locToItvVal(std::move(rhs._locToItvVal))
|
|
100
95
|
{
|
|
@@ -102,7 +97,7 @@ public:
|
|
|
102
97
|
}
|
|
103
98
|
|
|
104
99
|
/// operator= move constructor
|
|
105
|
-
|
|
100
|
+
IntervalESBase &operator=(IntervalESBase &&rhs)
|
|
106
101
|
{
|
|
107
102
|
if (&rhs != this)
|
|
108
103
|
{
|
|
@@ -114,9 +109,9 @@ public:
|
|
|
114
109
|
}
|
|
115
110
|
|
|
116
111
|
/// Set all value bottom
|
|
117
|
-
|
|
112
|
+
IntervalESBase bottom() const
|
|
118
113
|
{
|
|
119
|
-
|
|
114
|
+
IntervalESBase inv = *this;
|
|
120
115
|
for (auto &item: inv._varToItvVal)
|
|
121
116
|
{
|
|
122
117
|
item.second.set_to_bottom();
|
|
@@ -125,9 +120,9 @@ public:
|
|
|
125
120
|
}
|
|
126
121
|
|
|
127
122
|
/// Set all value top
|
|
128
|
-
|
|
123
|
+
IntervalESBase top() const
|
|
129
124
|
{
|
|
130
|
-
|
|
125
|
+
IntervalESBase inv = *this;
|
|
131
126
|
for (auto &item: inv._varToItvVal)
|
|
132
127
|
{
|
|
133
128
|
item.second.set_to_top();
|
|
@@ -136,9 +131,9 @@ public:
|
|
|
136
131
|
}
|
|
137
132
|
|
|
138
133
|
/// Copy some values and return a new IntervalExeState
|
|
139
|
-
|
|
134
|
+
IntervalESBase sliceState(Set<u32_t> &sl)
|
|
140
135
|
{
|
|
141
|
-
|
|
136
|
+
IntervalESBase inv;
|
|
142
137
|
for (u32_t id: sl)
|
|
143
138
|
{
|
|
144
139
|
inv._varToItvVal[id] = _varToItvVal[id];
|
|
@@ -156,51 +151,37 @@ public:
|
|
|
156
151
|
/// get memory addresses of variable
|
|
157
152
|
Addrs &getAddrs(u32_t id) override
|
|
158
153
|
{
|
|
159
|
-
|
|
160
|
-
if (it != _varToAddrs.end())
|
|
161
|
-
return it->second;
|
|
162
|
-
else
|
|
163
|
-
return globalES._varToAddrs[id];
|
|
154
|
+
return _varToAddrs[id];
|
|
164
155
|
}
|
|
165
156
|
|
|
166
157
|
/// get interval value of variable
|
|
167
|
-
inline IntervalValue &operator[](u32_t varId)
|
|
158
|
+
inline virtual IntervalValue &operator[](u32_t varId)
|
|
168
159
|
{
|
|
169
|
-
|
|
170
|
-
if(localIt != _varToItvVal.end())
|
|
171
|
-
return localIt->second;
|
|
172
|
-
else
|
|
173
|
-
{
|
|
174
|
-
return globalES._varToItvVal[varId];
|
|
175
|
-
}
|
|
160
|
+
return _varToItvVal[varId];
|
|
176
161
|
}
|
|
177
162
|
|
|
178
163
|
/// whether the variable is in varToAddrs table
|
|
179
164
|
inline bool inVarToAddrsTable(u32_t id) const override
|
|
180
165
|
{
|
|
181
|
-
return _varToAddrs.find(id) != _varToAddrs.end()
|
|
182
|
-
globalES._varToAddrs.find(id) != globalES._varToAddrs.end();
|
|
166
|
+
return _varToAddrs.find(id) != _varToAddrs.end();
|
|
183
167
|
}
|
|
184
168
|
|
|
185
169
|
/// whether the variable is in varToVal table
|
|
186
|
-
inline bool inVarToValTable(u32_t id) const
|
|
170
|
+
inline virtual bool inVarToValTable(u32_t id) const
|
|
187
171
|
{
|
|
188
|
-
return _varToItvVal.find(id) != _varToItvVal.end()
|
|
189
|
-
globalES._varToItvVal.find(id) != globalES._varToItvVal.end();
|
|
172
|
+
return _varToItvVal.find(id) != _varToItvVal.end();
|
|
190
173
|
}
|
|
191
174
|
|
|
192
175
|
/// whether the memory address stores memory addresses
|
|
193
176
|
inline bool inLocToAddrsTable(u32_t id) const override
|
|
194
177
|
{
|
|
195
|
-
return _locToAddrs.find(id) != _locToAddrs.end()
|
|
196
|
-
globalES._locToAddrs.find(id) != globalES._locToAddrs.end();
|
|
178
|
+
return _locToAddrs.find(id) != _locToAddrs.end();
|
|
197
179
|
}
|
|
198
180
|
|
|
199
181
|
/// whether the memory address stores interval value
|
|
200
|
-
inline bool inLocToValTable(u32_t id) const
|
|
182
|
+
inline virtual bool inLocToValTable(u32_t id) const
|
|
201
183
|
{
|
|
202
|
-
return _locToItvVal.find(id) != _locToItvVal.end()
|
|
203
|
-
globalES._locToItvVal.find(id) != globalES._locToItvVal.end();
|
|
184
|
+
return _locToItvVal.find(id) != _locToItvVal.end();
|
|
204
185
|
}
|
|
205
186
|
|
|
206
187
|
/// get var2val map
|
|
@@ -215,51 +196,25 @@ public:
|
|
|
215
196
|
return _locToItvVal;
|
|
216
197
|
}
|
|
217
198
|
|
|
218
|
-
inline bool inLocalLocToValTable(u32_t id) const
|
|
219
|
-
{
|
|
220
|
-
return _locToItvVal.find(id) != _locToItvVal.end();
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
inline bool inLocalLocToAddrsTable(u32_t id) const
|
|
224
|
-
{
|
|
225
|
-
return _locToAddrs.find(id) != _locToAddrs.end();
|
|
226
|
-
}
|
|
227
|
-
|
|
228
199
|
public:
|
|
229
200
|
|
|
230
|
-
inline void cpyItvToLocal(u32_t varId)
|
|
231
|
-
{
|
|
232
|
-
auto localIt = _varToItvVal.find(varId);
|
|
233
|
-
// local already have varId
|
|
234
|
-
if (localIt != _varToItvVal.end()) return;
|
|
235
|
-
auto globIt = globalES._varToItvVal.find(varId);
|
|
236
|
-
if (globIt != globalES._varToItvVal.end())
|
|
237
|
-
{
|
|
238
|
-
_varToItvVal[varId] = globIt->second;
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
|
|
242
201
|
/// domain widen with other, and return the widened domain
|
|
243
|
-
|
|
202
|
+
IntervalESBase widening(const IntervalESBase &other);
|
|
244
203
|
|
|
245
204
|
/// domain narrow with other, and return the narrowed domain
|
|
246
|
-
|
|
205
|
+
IntervalESBase narrowing(const IntervalESBase &other);
|
|
247
206
|
|
|
248
207
|
/// domain widen with other, important! other widen this.
|
|
249
|
-
void widenWith(const
|
|
208
|
+
void widenWith(const IntervalESBase &other);
|
|
250
209
|
|
|
251
210
|
/// domain join with other, important! other widen this.
|
|
252
|
-
void joinWith(const
|
|
211
|
+
void joinWith(const IntervalESBase &other);
|
|
253
212
|
|
|
254
213
|
/// domain narrow with other, important! other widen this.
|
|
255
|
-
void narrowWith(const
|
|
214
|
+
void narrowWith(const IntervalESBase &other);
|
|
256
215
|
|
|
257
216
|
/// domain meet with other, important! other widen this.
|
|
258
|
-
void meetWith(const
|
|
259
|
-
|
|
260
|
-
/// domain meet with other varToValMap
|
|
261
|
-
void meetWith(VarToValMap *other);
|
|
262
|
-
|
|
217
|
+
void meetWith(const IntervalESBase &other);
|
|
263
218
|
|
|
264
219
|
/// Return int value from an expression if it is a numeral, otherwise return an approximate value
|
|
265
220
|
inline s32_t Interval2NumValue(const IntervalValue &e) const
|
|
@@ -306,7 +261,7 @@ public:
|
|
|
306
261
|
_locToItvVal[objId] = val;
|
|
307
262
|
}
|
|
308
263
|
|
|
309
|
-
inline IntervalValue &load(u32_t addr)
|
|
264
|
+
inline virtual IntervalValue &load(u32_t addr)
|
|
310
265
|
{
|
|
311
266
|
assert(isVirtualMemAddress(addr) && "not virtual address?");
|
|
312
267
|
u32_t objId = getInternalID(addr);
|
|
@@ -315,15 +270,11 @@ public:
|
|
|
315
270
|
return it->second;
|
|
316
271
|
else
|
|
317
272
|
{
|
|
318
|
-
|
|
319
|
-
if(globIt != globalES._locToItvVal.end())
|
|
320
|
-
return globIt->second;
|
|
321
|
-
else
|
|
322
|
-
return _locToItvVal[objId];
|
|
273
|
+
return _locToItvVal[objId];
|
|
323
274
|
}
|
|
324
275
|
}
|
|
325
276
|
|
|
326
|
-
inline Addrs &loadAddrs(u32_t addr) override
|
|
277
|
+
inline virtual Addrs &loadAddrs(u32_t addr) override
|
|
327
278
|
{
|
|
328
279
|
assert(isVirtualMemAddress(addr) && "not virtual address?");
|
|
329
280
|
u32_t objId = getInternalID(addr);
|
|
@@ -332,41 +283,29 @@ public:
|
|
|
332
283
|
return it->second;
|
|
333
284
|
else
|
|
334
285
|
{
|
|
335
|
-
|
|
336
|
-
if(globIt != globalES._locToAddrs.end())
|
|
337
|
-
return globIt->second;
|
|
338
|
-
else
|
|
339
|
-
return _locToAddrs[objId];
|
|
286
|
+
return _locToAddrs[objId];
|
|
340
287
|
}
|
|
341
288
|
}
|
|
342
289
|
|
|
343
|
-
inline IntervalValue& getLocToVal(u32_t id)
|
|
290
|
+
inline virtual IntervalValue& getLocToVal(u32_t id)
|
|
344
291
|
{
|
|
345
292
|
auto it = _locToItvVal.find(id);
|
|
346
293
|
if(it != _locToItvVal.end())
|
|
347
294
|
return it->second;
|
|
348
295
|
else
|
|
349
296
|
{
|
|
350
|
-
|
|
351
|
-
if(globIt != globalES._locToItvVal.end())
|
|
352
|
-
return globIt->second;
|
|
353
|
-
else
|
|
354
|
-
return _locToItvVal[id];
|
|
297
|
+
return _locToItvVal[id];
|
|
355
298
|
}
|
|
356
299
|
}
|
|
357
300
|
|
|
358
|
-
inline Addrs& getLocAddrs(u32_t id)
|
|
301
|
+
inline virtual Addrs& getLocAddrs(u32_t id)
|
|
359
302
|
{
|
|
360
303
|
auto it = _locToAddrs.find(id);
|
|
361
304
|
if(it != _locToAddrs.end())
|
|
362
305
|
return it->second;
|
|
363
306
|
else
|
|
364
307
|
{
|
|
365
|
-
|
|
366
|
-
if(globIt != globalES._locToAddrs.end())
|
|
367
|
-
return globIt->second;
|
|
368
|
-
else
|
|
369
|
-
return _locToAddrs[id];
|
|
308
|
+
return _locToAddrs[id];
|
|
370
309
|
}
|
|
371
310
|
}
|
|
372
311
|
|
|
@@ -378,7 +317,7 @@ public:
|
|
|
378
317
|
return "";
|
|
379
318
|
}
|
|
380
319
|
|
|
381
|
-
bool equals(const
|
|
320
|
+
bool equals(const IntervalESBase &other) const;
|
|
382
321
|
|
|
383
322
|
static bool eqVarToValMap(const VarToValMap &lhs, const VarToValMap &rhs)
|
|
384
323
|
{
|
|
@@ -396,7 +335,6 @@ public:
|
|
|
396
335
|
return true;
|
|
397
336
|
}
|
|
398
337
|
|
|
399
|
-
|
|
400
338
|
static bool lessThanVarToValMap(const VarToValMap &lhs, const VarToValMap &rhs)
|
|
401
339
|
{
|
|
402
340
|
if (lhs.empty()) return !rhs.empty();
|
|
@@ -426,24 +364,23 @@ public:
|
|
|
426
364
|
|
|
427
365
|
using ExeState::operator==;
|
|
428
366
|
using ExeState::operator!=;
|
|
429
|
-
bool operator==(const
|
|
367
|
+
bool operator==(const IntervalESBase &rhs) const
|
|
430
368
|
{
|
|
431
369
|
return ExeState::operator==(rhs) && eqVarToValMap(_varToItvVal, rhs.getVarToVal()) &&
|
|
432
370
|
eqVarToValMap(_locToItvVal, rhs.getLocToVal());
|
|
433
371
|
}
|
|
434
372
|
|
|
435
|
-
bool operator!=(const
|
|
373
|
+
bool operator!=(const IntervalESBase &rhs) const
|
|
436
374
|
{
|
|
437
375
|
return !(*this == rhs);
|
|
438
376
|
}
|
|
439
377
|
|
|
440
|
-
bool operator<(const
|
|
378
|
+
bool operator<(const IntervalESBase &rhs) const
|
|
441
379
|
{
|
|
442
380
|
return !(*this >= rhs);
|
|
443
381
|
}
|
|
444
382
|
|
|
445
|
-
|
|
446
|
-
bool operator>=(const IntervalExeState &rhs) const
|
|
383
|
+
bool operator>=(const IntervalESBase &rhs) const
|
|
447
384
|
{
|
|
448
385
|
return geqVarToValMap(_varToItvVal, rhs.getVarToVal()) && geqVarToValMap(_locToItvVal, rhs.getLocToVal());
|
|
449
386
|
}
|
|
@@ -456,12 +393,240 @@ public:
|
|
|
456
393
|
_varToAddrs.clear();
|
|
457
394
|
}
|
|
458
395
|
|
|
459
|
-
|
|
460
|
-
private:
|
|
396
|
+
protected:
|
|
461
397
|
void printTable(const VarToValMap &table, std::ostream &oss) const;
|
|
462
398
|
|
|
463
399
|
void printTable(const VarToAddrs &table, std::ostream &oss) const;
|
|
464
400
|
};
|
|
401
|
+
|
|
402
|
+
class IntervalExeState : public IntervalESBase
|
|
403
|
+
{
|
|
404
|
+
friend class SVFIR2ItvExeState;
|
|
405
|
+
friend class RelationSolver;
|
|
406
|
+
|
|
407
|
+
public:
|
|
408
|
+
static IntervalExeState globalES;
|
|
409
|
+
|
|
410
|
+
public:
|
|
411
|
+
/// default constructor
|
|
412
|
+
IntervalExeState() : IntervalESBase() {}
|
|
413
|
+
|
|
414
|
+
IntervalExeState(VarToValMap &_varToValMap, LocToValMap &_locToValMap) : IntervalESBase(_varToValMap, _locToValMap) {}
|
|
415
|
+
|
|
416
|
+
/// copy constructor
|
|
417
|
+
IntervalExeState(const IntervalExeState &rhs) : IntervalESBase(rhs)
|
|
418
|
+
{
|
|
419
|
+
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
virtual ~IntervalExeState() = default;
|
|
423
|
+
|
|
424
|
+
IntervalExeState &operator=(const IntervalExeState &rhs)
|
|
425
|
+
{
|
|
426
|
+
IntervalESBase::operator=(rhs);
|
|
427
|
+
return *this;
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
/// move constructor
|
|
431
|
+
IntervalExeState(IntervalExeState &&rhs) : IntervalESBase(std::move(rhs))
|
|
432
|
+
{
|
|
433
|
+
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
/// operator= move constructor
|
|
437
|
+
IntervalExeState &operator=(IntervalExeState &&rhs)
|
|
438
|
+
{
|
|
439
|
+
IntervalESBase::operator=(std::move(rhs));
|
|
440
|
+
return *this;
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
public:
|
|
444
|
+
|
|
445
|
+
/// get memory addresses of variable
|
|
446
|
+
Addrs &getAddrs(u32_t id) override
|
|
447
|
+
{
|
|
448
|
+
auto it = _varToAddrs.find(id);
|
|
449
|
+
if (it != _varToAddrs.end())
|
|
450
|
+
return it->second;
|
|
451
|
+
else
|
|
452
|
+
return globalES._varToAddrs[id];
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
/// get interval value of variable
|
|
456
|
+
inline IntervalValue &operator[](u32_t varId) override
|
|
457
|
+
{
|
|
458
|
+
auto localIt = _varToItvVal.find(varId);
|
|
459
|
+
if(localIt != _varToItvVal.end())
|
|
460
|
+
return localIt->second;
|
|
461
|
+
else
|
|
462
|
+
{
|
|
463
|
+
return globalES._varToItvVal[varId];
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
/// whether the variable is in varToAddrs table
|
|
468
|
+
inline bool inVarToAddrsTable(u32_t id) const override
|
|
469
|
+
{
|
|
470
|
+
return _varToAddrs.find(id) != _varToAddrs.end() ||
|
|
471
|
+
globalES._varToAddrs.find(id) != globalES._varToAddrs.end();
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
/// whether the variable is in varToVal table
|
|
475
|
+
inline bool inVarToValTable(u32_t id) const override
|
|
476
|
+
{
|
|
477
|
+
return _varToItvVal.find(id) != _varToItvVal.end() ||
|
|
478
|
+
globalES._varToItvVal.find(id) != globalES._varToItvVal.end();
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
/// whether the memory address stores memory addresses
|
|
482
|
+
inline bool inLocToAddrsTable(u32_t id) const override
|
|
483
|
+
{
|
|
484
|
+
return _locToAddrs.find(id) != _locToAddrs.end() ||
|
|
485
|
+
globalES._locToAddrs.find(id) != globalES._locToAddrs.end();
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
/// whether the memory address stores interval value
|
|
489
|
+
inline bool inLocToValTable(u32_t id) const override
|
|
490
|
+
{
|
|
491
|
+
return _locToItvVal.find(id) != _locToItvVal.end() ||
|
|
492
|
+
globalES._locToItvVal.find(id) != globalES._locToItvVal.end();
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
inline bool inLocalLocToValTable(u32_t id) const
|
|
496
|
+
{
|
|
497
|
+
return _locToItvVal.find(id) != _locToItvVal.end();
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
inline bool inLocalLocToAddrsTable(u32_t id) const
|
|
501
|
+
{
|
|
502
|
+
return _locToAddrs.find(id) != _locToAddrs.end();
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
public:
|
|
506
|
+
|
|
507
|
+
inline void cpyItvToLocal(u32_t varId)
|
|
508
|
+
{
|
|
509
|
+
auto localIt = _varToItvVal.find(varId);
|
|
510
|
+
// local already have varId
|
|
511
|
+
if (localIt != _varToItvVal.end()) return;
|
|
512
|
+
auto globIt = globalES._varToItvVal.find(varId);
|
|
513
|
+
if (globIt != globalES._varToItvVal.end())
|
|
514
|
+
{
|
|
515
|
+
_varToItvVal[varId] = globIt->second;
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
/// domain widen with other, and return the widened domain
|
|
520
|
+
IntervalExeState widening(const IntervalExeState &other);
|
|
521
|
+
|
|
522
|
+
/// domain narrow with other, and return the narrowed domain
|
|
523
|
+
IntervalExeState narrowing(const IntervalExeState &other);
|
|
524
|
+
|
|
525
|
+
/// domain widen with other, important! other widen this.
|
|
526
|
+
void widenWith(const IntervalExeState &other);
|
|
527
|
+
|
|
528
|
+
/// domain join with other, important! other widen this.
|
|
529
|
+
void joinWith(const IntervalExeState &other);
|
|
530
|
+
|
|
531
|
+
/// domain narrow with other, important! other widen this.
|
|
532
|
+
void narrowWith(const IntervalExeState &other);
|
|
533
|
+
|
|
534
|
+
/// domain meet with other, important! other widen this.
|
|
535
|
+
void meetWith(const IntervalExeState &other);
|
|
536
|
+
|
|
537
|
+
u32_t hash() const override;
|
|
538
|
+
|
|
539
|
+
public:
|
|
540
|
+
|
|
541
|
+
inline IntervalValue &load(u32_t addr) override
|
|
542
|
+
{
|
|
543
|
+
assert(isVirtualMemAddress(addr) && "not virtual address?");
|
|
544
|
+
u32_t objId = getInternalID(addr);
|
|
545
|
+
auto it = _locToItvVal.find(objId);
|
|
546
|
+
if(it != _locToItvVal.end())
|
|
547
|
+
return it->second;
|
|
548
|
+
else
|
|
549
|
+
{
|
|
550
|
+
auto globIt = globalES._locToItvVal.find(objId);
|
|
551
|
+
if(globIt != globalES._locToItvVal.end())
|
|
552
|
+
return globIt->second;
|
|
553
|
+
else
|
|
554
|
+
return _locToItvVal[objId];
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
inline Addrs &loadAddrs(u32_t addr) override
|
|
559
|
+
{
|
|
560
|
+
assert(isVirtualMemAddress(addr) && "not virtual address?");
|
|
561
|
+
u32_t objId = getInternalID(addr);
|
|
562
|
+
auto it = _locToAddrs.find(objId);
|
|
563
|
+
if(it != _locToAddrs.end())
|
|
564
|
+
return it->second;
|
|
565
|
+
else
|
|
566
|
+
{
|
|
567
|
+
auto globIt = globalES._locToAddrs.find(objId);
|
|
568
|
+
if(globIt != globalES._locToAddrs.end())
|
|
569
|
+
return globIt->second;
|
|
570
|
+
else
|
|
571
|
+
return _locToAddrs[objId];
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
inline IntervalValue& getLocToVal(u32_t id) override
|
|
576
|
+
{
|
|
577
|
+
auto it = _locToItvVal.find(id);
|
|
578
|
+
if(it != _locToItvVal.end())
|
|
579
|
+
return it->second;
|
|
580
|
+
else
|
|
581
|
+
{
|
|
582
|
+
auto globIt = globalES._locToItvVal.find(id);
|
|
583
|
+
if(globIt != globalES._locToItvVal.end())
|
|
584
|
+
return globIt->second;
|
|
585
|
+
else
|
|
586
|
+
return _locToItvVal[id];
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
inline Addrs& getLocAddrs(u32_t id) override
|
|
591
|
+
{
|
|
592
|
+
auto it = _locToAddrs.find(id);
|
|
593
|
+
if(it != _locToAddrs.end())
|
|
594
|
+
return it->second;
|
|
595
|
+
else
|
|
596
|
+
{
|
|
597
|
+
auto globIt = globalES._locToAddrs.find(id);
|
|
598
|
+
if(globIt != globalES._locToAddrs.end())
|
|
599
|
+
return globIt->second;
|
|
600
|
+
else
|
|
601
|
+
return _locToAddrs[id];
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
bool equals(const IntervalExeState &other) const;
|
|
606
|
+
|
|
607
|
+
using ExeState::operator==;
|
|
608
|
+
using ExeState::operator!=;
|
|
609
|
+
bool operator==(const IntervalExeState &rhs) const
|
|
610
|
+
{
|
|
611
|
+
return ExeState::operator==(rhs) && eqVarToValMap(_varToItvVal, rhs._varToItvVal) &&
|
|
612
|
+
eqVarToValMap(_locToItvVal, rhs._locToItvVal);
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
bool operator!=(const IntervalExeState &rhs) const
|
|
616
|
+
{
|
|
617
|
+
return !(*this == rhs);
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
bool operator<(const IntervalExeState &rhs) const
|
|
621
|
+
{
|
|
622
|
+
return !(*this >= rhs);
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
bool operator>=(const IntervalExeState &rhs) const
|
|
626
|
+
{
|
|
627
|
+
return geqVarToValMap(_varToItvVal, rhs.getVarToVal()) && geqVarToValMap(_locToItvVal, rhs._locToItvVal);
|
|
628
|
+
}
|
|
629
|
+
};
|
|
465
630
|
}
|
|
466
631
|
|
|
467
632
|
template<>
|
|
@@ -27,7 +27,6 @@
|
|
|
27
27
|
*
|
|
28
28
|
*/
|
|
29
29
|
|
|
30
|
-
|
|
31
30
|
#ifndef Z3_EXAMPLE_IntervalValue_H
|
|
32
31
|
#define Z3_EXAMPLE_IntervalValue_H
|
|
33
32
|
|
|
@@ -321,7 +320,6 @@ public:
|
|
|
321
320
|
}
|
|
322
321
|
}
|
|
323
322
|
|
|
324
|
-
|
|
325
323
|
/// Equality comparison
|
|
326
324
|
bool equals(const IntervalValue &other) const
|
|
327
325
|
{
|
|
@@ -679,7 +677,6 @@ inline IntervalValue operator<(const IntervalValue &lhs, const IntervalValue &rh
|
|
|
679
677
|
}
|
|
680
678
|
}
|
|
681
679
|
|
|
682
|
-
|
|
683
680
|
// Compare two IntervalValues for greater than or equal to
|
|
684
681
|
inline IntervalValue operator>=(const IntervalValue &lhs, const IntervalValue &rhs)
|
|
685
682
|
{
|