svf-lib 1.0.1557 → 1.0.1559
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/svf/libSvfCore.a +0 -0
- package/SVF-linux/Release-build/svf-llvm/libSvfLLVM.a +0 -0
- package/SVF-linux/svf/include/AbstractExecution/AddressValue.h +14 -3
- package/SVF-linux/svf/include/AbstractExecution/BoundedZ3Expr.h +47 -7
- package/SVF-linux/svf/include/AbstractExecution/NumericLiteral.h +1 -23
- package/SVF-linux/svf/include/Util/Options.h +3 -0
- 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/SVFIR/SVFType.h +6 -0
- package/SVF-osx/svf/include/SVFIR/SVFValue.h +6 -0
- package/package.json +1 -1
|
Binary file
|
|
Binary file
|
|
@@ -136,13 +136,22 @@ public:
|
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
/// Current AddressValue joins with another AddressValue
|
|
139
|
-
|
|
139
|
+
bool join_with(const AddressValue &other)
|
|
140
140
|
{
|
|
141
|
-
|
|
141
|
+
bool changed = false;
|
|
142
|
+
for (const auto &addr: other)
|
|
143
|
+
{
|
|
144
|
+
if (!_addrs.count(addr))
|
|
145
|
+
{
|
|
146
|
+
if (insert(addr).second)
|
|
147
|
+
changed = true;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
return changed;
|
|
142
151
|
}
|
|
143
152
|
|
|
144
153
|
/// Return a intersected AddressValue
|
|
145
|
-
|
|
154
|
+
bool meet_with(const AddressValue &other)
|
|
146
155
|
{
|
|
147
156
|
AddrSet s;
|
|
148
157
|
for (const auto &id: other._addrs)
|
|
@@ -152,7 +161,9 @@ public:
|
|
|
152
161
|
s.insert(id);
|
|
153
162
|
}
|
|
154
163
|
}
|
|
164
|
+
bool changed = (_addrs != s);
|
|
155
165
|
_addrs = std::move(s);
|
|
166
|
+
return changed;
|
|
156
167
|
}
|
|
157
168
|
|
|
158
169
|
/// Return true if the AddressValue contains n
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//===-
|
|
1
|
+
//===- BoundedZ3Expr.h ----Address Value Sets-------------------------//
|
|
2
2
|
//
|
|
3
3
|
// SVF: Static Value-Flow Analysis
|
|
4
4
|
//
|
|
@@ -248,17 +248,20 @@ public:
|
|
|
248
248
|
|
|
249
249
|
friend BoundedZ3Expr operator^(const BoundedZ3Expr &lhs, const BoundedZ3Expr &rhs)
|
|
250
250
|
{
|
|
251
|
-
|
|
251
|
+
const auto &maxBvLen = std::max(lhs.bvLen(), rhs.bvLen());
|
|
252
|
+
return bv2int(int2bv(maxBvLen, lhs.getExpr()) ^ int2bv(maxBvLen, rhs.getExpr()), true);
|
|
252
253
|
}
|
|
253
254
|
|
|
254
255
|
friend BoundedZ3Expr operator&(const BoundedZ3Expr &lhs, const BoundedZ3Expr &rhs)
|
|
255
256
|
{
|
|
256
|
-
|
|
257
|
+
const auto &maxBvLen = std::max(lhs.bvLen(), rhs.bvLen());
|
|
258
|
+
return bv2int(int2bv(maxBvLen, lhs.getExpr()) & int2bv(maxBvLen, rhs.getExpr()), true);
|
|
257
259
|
}
|
|
258
260
|
|
|
259
261
|
friend BoundedZ3Expr operator|(const BoundedZ3Expr &lhs, const BoundedZ3Expr &rhs)
|
|
260
262
|
{
|
|
261
|
-
|
|
263
|
+
const auto &maxBvLen = std::max(lhs.bvLen(), rhs.bvLen());
|
|
264
|
+
return bv2int(int2bv(maxBvLen, lhs.getExpr()) | int2bv(maxBvLen, rhs.getExpr()), true);
|
|
262
265
|
}
|
|
263
266
|
|
|
264
267
|
friend BoundedZ3Expr ashr(const BoundedZ3Expr &lhs, const BoundedZ3Expr &rhs)
|
|
@@ -270,7 +273,10 @@ public:
|
|
|
270
273
|
else if (rhs.is_infinite())
|
|
271
274
|
return ite(lhs.getExpr() >= 0, BoundedZ3Expr(0), BoundedZ3Expr(-1));
|
|
272
275
|
else
|
|
273
|
-
|
|
276
|
+
{
|
|
277
|
+
const auto &maxBvLen = std::max(lhs.bvLen(), rhs.bvLen());
|
|
278
|
+
return bv2int(ashr(int2bv(maxBvLen, lhs.getExpr()), int2bv(maxBvLen, rhs.getExpr())), true);
|
|
279
|
+
}
|
|
274
280
|
}
|
|
275
281
|
|
|
276
282
|
friend BoundedZ3Expr shl(const BoundedZ3Expr &lhs, const BoundedZ3Expr &rhs)
|
|
@@ -282,12 +288,16 @@ public:
|
|
|
282
288
|
else if (rhs.is_infinite())
|
|
283
289
|
return ite(lhs.getExpr() >= 0, plus_infinity(), minus_infinity());
|
|
284
290
|
else
|
|
285
|
-
|
|
291
|
+
{
|
|
292
|
+
const auto &maxBvLen = std::max(lhs.bvLen(), rhs.bvLen());
|
|
293
|
+
return bv2int(shl(int2bv(maxBvLen, lhs.getExpr()), int2bv(maxBvLen, rhs.getExpr())), true);
|
|
294
|
+
}
|
|
286
295
|
}
|
|
287
296
|
|
|
288
297
|
friend BoundedZ3Expr lshr(const BoundedZ3Expr &lhs, const BoundedZ3Expr &rhs)
|
|
289
298
|
{
|
|
290
|
-
|
|
299
|
+
const auto &maxBvLen = std::max(lhs.bvLen(), rhs.bvLen());
|
|
300
|
+
return bv2int(lshr(int2bv(maxBvLen, lhs.getExpr()), int2bv(maxBvLen, rhs.getExpr())), true);
|
|
291
301
|
}
|
|
292
302
|
|
|
293
303
|
friend BoundedZ3Expr int2bv(u32_t n, const BoundedZ3Expr &e)
|
|
@@ -340,6 +350,36 @@ public:
|
|
|
340
350
|
{
|
|
341
351
|
return getExpr().is_true();
|
|
342
352
|
}
|
|
353
|
+
|
|
354
|
+
/// Return Numeral
|
|
355
|
+
inline int64_t getNumeral() const
|
|
356
|
+
{
|
|
357
|
+
if (is_numeral())
|
|
358
|
+
{
|
|
359
|
+
int64_t i;
|
|
360
|
+
if (getExpr().is_numeral_i64(i))
|
|
361
|
+
return get_numeral_int64();
|
|
362
|
+
else
|
|
363
|
+
{
|
|
364
|
+
return (getExpr() < 0).simplify().is_true() ? INT64_MIN : INT64_MAX;
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
if (is_minus_infinite())
|
|
368
|
+
{
|
|
369
|
+
return INT64_MIN;
|
|
370
|
+
}
|
|
371
|
+
else if (is_plus_infinite())
|
|
372
|
+
{
|
|
373
|
+
return INT64_MAX;
|
|
374
|
+
}
|
|
375
|
+
else
|
|
376
|
+
{
|
|
377
|
+
assert(false && "other literal?");
|
|
378
|
+
abort();
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
int64_t bvLen() const;
|
|
343
383
|
//%}
|
|
344
384
|
}; // end class ConZ3Expr
|
|
345
385
|
} // end namespace SVF
|
|
@@ -119,29 +119,7 @@ public:
|
|
|
119
119
|
/// Return Numeral
|
|
120
120
|
inline int64_t getNumeral() const
|
|
121
121
|
{
|
|
122
|
-
|
|
123
|
-
{
|
|
124
|
-
int64_t i;
|
|
125
|
-
if(_n.getExpr().is_numeral_i64(i))
|
|
126
|
-
return _n.get_numeral_int64();
|
|
127
|
-
else
|
|
128
|
-
{
|
|
129
|
-
return leq(0) ? INT64_MIN : INT64_MAX;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
if (is_minus_infinity())
|
|
133
|
-
{
|
|
134
|
-
return INT64_MIN;
|
|
135
|
-
}
|
|
136
|
-
else if (is_plus_infinity())
|
|
137
|
-
{
|
|
138
|
-
return INT64_MAX;
|
|
139
|
-
}
|
|
140
|
-
else
|
|
141
|
-
{
|
|
142
|
-
assert(false && "other literal?");
|
|
143
|
-
abort();
|
|
144
|
-
}
|
|
122
|
+
return _n.getNumeral();
|
|
145
123
|
}
|
|
146
124
|
|
|
147
125
|
/// Check two object is equal
|
|
Binary file
|
|
Binary file
|
|
@@ -471,6 +471,12 @@ public:
|
|
|
471
471
|
void print(std::ostream& OS) const override;
|
|
472
472
|
};
|
|
473
473
|
|
|
474
|
+
/// [FOR DEBUG ONLY, DON'T USE IT UNSIDE `svf`!]
|
|
475
|
+
/// Converts an SVFType to corresponding LLVM::Type, then get the string
|
|
476
|
+
/// representation of it. Use it only when you are debugging. Don't use
|
|
477
|
+
/// it in any SVF algorithm because it relies on information stored in LLVM bc.
|
|
478
|
+
std::string dumpLLVMType(const SVFType* svfType);
|
|
479
|
+
|
|
474
480
|
// TODO: be explicit that this is a pair of 32-bit unsigneds?
|
|
475
481
|
template <> struct Hash<NodePair>
|
|
476
482
|
{
|
|
@@ -1140,6 +1140,12 @@ public:
|
|
|
1140
1140
|
}
|
|
1141
1141
|
};
|
|
1142
1142
|
|
|
1143
|
+
/// [FOR DEBUG ONLY, DON'T USE IT UNSIDE `svf`!]
|
|
1144
|
+
/// Converts an SVFValue to corresponding LLVM::Value, then get the string
|
|
1145
|
+
/// representation of it. Use it only when you are debugging. Don't use
|
|
1146
|
+
/// it in any SVF algorithm because it relies on information stored in LLVM bc.
|
|
1147
|
+
std::string dumpLLVMValue(const SVFValue* svfValue);
|
|
1148
|
+
|
|
1143
1149
|
template <typename F, typename S>
|
|
1144
1150
|
OutStream& operator<< (OutStream &o, const std::pair<F, S> &var)
|
|
1145
1151
|
{
|