svf-lib 1.0.1907 → 1.0.1909
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/bin/ae +0 -0
- package/SVF-linux/Release-build/bin/cfl +0 -0
- package/SVF-linux/Release-build/bin/dvf +0 -0
- package/SVF-linux/Release-build/bin/llvm2svf +0 -0
- package/SVF-linux/Release-build/bin/mta +0 -0
- package/SVF-linux/Release-build/bin/saber +0 -0
- package/SVF-linux/Release-build/bin/svf-ex +0 -0
- package/SVF-linux/Release-build/bin/wpa +0 -0
- package/SVF-linux/Release-build/include/AE/Core/BoundedZ3Expr.h +31 -20
- package/SVF-linux/Release-build/include/AE/Core/IntervalValue.h +56 -4
- package/SVF-linux/Release-build/include/AE/Core/NumericLiteral.h +25 -1
- package/SVF-linux/Release-build/include/AE/Svfexe/SVFIR2ItvExeState.h +10 -0
- package/SVF-linux/Release-build/include/SVF-LLVM/SVFIRBuilder.h +39 -3
- package/SVF-linux/Release-build/include/SVFIR/SVFIR.h +2 -1
- package/SVF-linux/Release-build/include/SVFIR/SVFStatements.h +12 -2
- package/SVF-linux/Release-build/include/Util/GeneralType.h +4 -0
- package/SVF-linux/Release-build/lib/libSvfCore.a +0 -0
- package/SVF-linux/Release-build/lib/libSvfLLVM.a +0 -0
- package/package.json +1 -1
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -345,31 +345,42 @@ public:
|
|
|
345
345
|
return getExpr().is_true();
|
|
346
346
|
}
|
|
347
347
|
|
|
348
|
+
inline bool is_int() const
|
|
349
|
+
{
|
|
350
|
+
return getExpr().is_int();
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
inline bool is_real() const
|
|
354
|
+
{
|
|
355
|
+
return getExpr().is_real();
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
inline s64_t getIntNumeral() const
|
|
359
|
+
{
|
|
360
|
+
assert(is_int() && "not an integer");
|
|
361
|
+
int64_t i;
|
|
362
|
+
if (getExpr().is_numeral_i64(i))
|
|
363
|
+
return (s64_t)get_numeral_int64();
|
|
364
|
+
else
|
|
365
|
+
return (getExpr() < 0).simplify().is_true() ? INT64_MIN : INT64_MAX;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
inline double getRealNumeral() const
|
|
369
|
+
{
|
|
370
|
+
assert(is_real() && "not a real");
|
|
371
|
+
std::string decstr = getExpr().get_decimal_string(10);
|
|
372
|
+
return std::stod(decstr);
|
|
373
|
+
}
|
|
374
|
+
|
|
348
375
|
/// Return Numeral
|
|
349
376
|
inline s64_t getNumeral() const
|
|
350
377
|
{
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
if (getExpr().is_numeral_i64(i))
|
|
355
|
-
return (s64_t)get_numeral_int64();
|
|
356
|
-
else
|
|
357
|
-
{
|
|
358
|
-
return (getExpr() < 0).simplify().is_true() ? INT64_MIN : INT64_MAX;
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
if (is_minus_infinite())
|
|
362
|
-
{
|
|
363
|
-
return INT64_MIN;
|
|
364
|
-
}
|
|
365
|
-
else if (is_plus_infinite())
|
|
366
|
-
{
|
|
367
|
-
return INT64_MAX;
|
|
368
|
-
}
|
|
378
|
+
int64_t i;
|
|
379
|
+
if (getExpr().is_numeral_i64(i))
|
|
380
|
+
return (s64_t)get_numeral_int64();
|
|
369
381
|
else
|
|
370
382
|
{
|
|
371
|
-
|
|
372
|
-
abort();
|
|
383
|
+
return (getExpr() < 0).simplify().is_true() ? INT64_MIN : INT64_MAX;
|
|
373
384
|
}
|
|
374
385
|
}
|
|
375
386
|
|
|
@@ -111,7 +111,9 @@ public:
|
|
|
111
111
|
|
|
112
112
|
explicit IntervalValue(s64_t lb, s64_t ub) : IntervalValue(NumericLiteral(lb), NumericLiteral(ub)) {}
|
|
113
113
|
|
|
114
|
-
explicit IntervalValue(double lb, double ub) : IntervalValue(NumericLiteral(
|
|
114
|
+
explicit IntervalValue(double lb, double ub) : IntervalValue(NumericLiteral(lb), NumericLiteral(ub)) {}
|
|
115
|
+
|
|
116
|
+
explicit IntervalValue(float lb, float ub) : IntervalValue(NumericLiteral(lb), NumericLiteral(ub)) {}
|
|
115
117
|
|
|
116
118
|
explicit IntervalValue(s32_t lb, s32_t ub) : IntervalValue((s64_t) lb, (s64_t) ub) {}
|
|
117
119
|
|
|
@@ -259,6 +261,22 @@ public:
|
|
|
259
261
|
return _lb.is_infinity() || _ub.is_infinity();
|
|
260
262
|
}
|
|
261
263
|
|
|
264
|
+
bool is_int() const
|
|
265
|
+
{
|
|
266
|
+
bool lb_int = _lb.is_int();
|
|
267
|
+
bool ub_int = _ub.is_int();
|
|
268
|
+
assert (lb_int == ub_int && "lb and ub should be both int or both float");
|
|
269
|
+
return _lb.is_int();
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
bool is_real() const
|
|
273
|
+
{
|
|
274
|
+
bool lb_real = _lb.is_real();
|
|
275
|
+
bool ub_real = _ub.is_real();
|
|
276
|
+
assert (lb_real == ub_real && "lb and ub should be both real or both int");
|
|
277
|
+
return _lb.is_real();
|
|
278
|
+
}
|
|
279
|
+
|
|
262
280
|
/// Return
|
|
263
281
|
s64_t getNumeral() const
|
|
264
282
|
{
|
|
@@ -266,6 +284,18 @@ public:
|
|
|
266
284
|
return _lb.getNumeral();
|
|
267
285
|
}
|
|
268
286
|
|
|
287
|
+
s64_t getIntNumeral() const
|
|
288
|
+
{
|
|
289
|
+
assert(is_numeral() && "this IntervalValue is not numeral");
|
|
290
|
+
return _lb.getIntNumeral();
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
double getRealNumeral() const
|
|
294
|
+
{
|
|
295
|
+
assert(is_numeral() && "this IntervalValue is not numeral");
|
|
296
|
+
return _lb.getRealNumeral();
|
|
297
|
+
}
|
|
298
|
+
|
|
269
299
|
/// Return true if the IntervalValue is a number [num, num]
|
|
270
300
|
bool is_numeral() const
|
|
271
301
|
{
|
|
@@ -335,9 +365,31 @@ public:
|
|
|
335
365
|
}
|
|
336
366
|
else
|
|
337
367
|
{
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
368
|
+
if (this->is_real() && other.is_real())
|
|
369
|
+
{
|
|
370
|
+
return this->_lb.equal(other._lb) && this->_ub.equal(other._ub);
|
|
371
|
+
}
|
|
372
|
+
else if (this->is_int() && other.is_int())
|
|
373
|
+
{
|
|
374
|
+
return this->_lb.equal(other._lb) && this->_ub.equal(other._ub);
|
|
375
|
+
}
|
|
376
|
+
else if (this->is_int())
|
|
377
|
+
{
|
|
378
|
+
double thislb = this->_lb.getIntNumeral();
|
|
379
|
+
double thisub = this->_ub.getIntNumeral();
|
|
380
|
+
double otherlb = other._lb.getRealNumeral();
|
|
381
|
+
double otherub = other._ub.getRealNumeral();
|
|
382
|
+
return thislb == otherlb && thisub == otherub;
|
|
383
|
+
}
|
|
384
|
+
else
|
|
385
|
+
{
|
|
386
|
+
double thislb = this->_lb.getRealNumeral();
|
|
387
|
+
double thisub = this->_ub.getRealNumeral();
|
|
388
|
+
double otherlb = other._lb.getIntNumeral();
|
|
389
|
+
double otherub = other._ub.getIntNumeral();
|
|
390
|
+
return thislb == otherlb && thisub == otherub;
|
|
391
|
+
}
|
|
392
|
+
assert(false && "not implemented");
|
|
341
393
|
}
|
|
342
394
|
}
|
|
343
395
|
|
|
@@ -50,6 +50,10 @@ public:
|
|
|
50
50
|
|
|
51
51
|
NumericLiteral(const z3::expr &e) : _n(e) {}
|
|
52
52
|
|
|
53
|
+
NumericLiteral(float i) : _n(getContext().real_val(std::to_string(i).c_str())) {}
|
|
54
|
+
|
|
55
|
+
NumericLiteral(double i) : _n(getContext().real_val(std::to_string(i).c_str())) {}
|
|
56
|
+
|
|
53
57
|
NumericLiteral(s32_t i) : _n(i) {}
|
|
54
58
|
|
|
55
59
|
NumericLiteral(s64_t i) : _n(i) {}
|
|
@@ -114,12 +118,32 @@ public:
|
|
|
114
118
|
return _n.is_zero();
|
|
115
119
|
}
|
|
116
120
|
|
|
117
|
-
|
|
121
|
+
inline bool is_int() const
|
|
122
|
+
{
|
|
123
|
+
return _n.is_int();
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
inline bool is_real() const
|
|
127
|
+
{
|
|
128
|
+
return _n.is_real();
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/// Return Numeral, default type is double in case to support both int and float
|
|
118
132
|
inline s64_t getNumeral() const
|
|
119
133
|
{
|
|
120
134
|
return _n.getNumeral();
|
|
121
135
|
}
|
|
122
136
|
|
|
137
|
+
inline double getRealNumeral() const
|
|
138
|
+
{
|
|
139
|
+
return _n.getRealNumeral();
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
inline s64_t getIntNumeral() const
|
|
143
|
+
{
|
|
144
|
+
return _n.getIntNumeral();
|
|
145
|
+
}
|
|
146
|
+
|
|
123
147
|
/// Check two object is equal
|
|
124
148
|
bool equal(const NumericLiteral &rhs) const
|
|
125
149
|
{
|
|
@@ -79,6 +79,15 @@ public:
|
|
|
79
79
|
/// Return the value range of Integer SVF Type, e.g. unsigned i8 Type->[0, 255], signed i8 Type->[-128, 127]
|
|
80
80
|
IntervalValue getRangeLimitFromType(const SVFType* type);
|
|
81
81
|
|
|
82
|
+
IntervalValue getZExtValue(const SVFVar* var);
|
|
83
|
+
IntervalValue getSExtValue(const SVFVar* var);
|
|
84
|
+
IntervalValue getFPToSIntValue(const SVFVar* var);
|
|
85
|
+
IntervalValue getFPToUIntValue(const SVFVar* var);
|
|
86
|
+
IntervalValue getSIntToFPValue(const SVFVar* var);
|
|
87
|
+
IntervalValue getUIntToFPValue(const SVFVar* var);
|
|
88
|
+
IntervalValue getTruncValue(const SVFVar* var, const SVFType* dstType);
|
|
89
|
+
IntervalValue getFPTruncValue(const SVFVar* var, const SVFType* dstType);
|
|
90
|
+
|
|
82
91
|
/// Return the byte offset expression of a GepStmt
|
|
83
92
|
/// elemBytesize is the element byte size of an static alloc or heap alloc array
|
|
84
93
|
/// e.g. GepStmt* gep = [i32*10], x, and x is [0,3]
|
|
@@ -206,6 +215,7 @@ private:
|
|
|
206
215
|
RelExeState _relEs;
|
|
207
216
|
|
|
208
217
|
Map<NodeID, IntervalExeState *> _br_cond;
|
|
218
|
+
IntervalValue getZExtValue(const SVFVar* var, const SVFType*);
|
|
209
219
|
};
|
|
210
220
|
}
|
|
211
221
|
|
|
@@ -358,16 +358,52 @@ protected:
|
|
|
358
358
|
return edge;
|
|
359
359
|
}
|
|
360
360
|
|
|
361
|
-
|
|
362
|
-
inline CopyStmt* addCopyEdge(NodeID src, NodeID dst)
|
|
361
|
+
inline CopyStmt* addCopyEdge(NodeID src, NodeID dst, CopyStmt::CopyKind kind)
|
|
363
362
|
{
|
|
364
|
-
if(CopyStmt *edge = pag->addCopyStmt(src, dst))
|
|
363
|
+
if(CopyStmt *edge = pag->addCopyStmt(src, dst, kind))
|
|
365
364
|
{
|
|
366
365
|
setCurrentBBAndValueForPAGEdge(edge);
|
|
367
366
|
return edge;
|
|
368
367
|
}
|
|
369
368
|
return nullptr;
|
|
370
369
|
}
|
|
370
|
+
|
|
371
|
+
inline CopyStmt::CopyKind getCopyKind(const Value* val)
|
|
372
|
+
{
|
|
373
|
+
// COPYVAL, ZEXT, SEXT, BITCAST, FPTRUNC, FPTOUI, FPTOSI, UITOFP, SITOFP, INTTOPTR, PTRTOINT
|
|
374
|
+
if (const Instruction* inst = SVFUtil::dyn_cast<Instruction>(val))
|
|
375
|
+
{
|
|
376
|
+
switch (inst->getOpcode())
|
|
377
|
+
{
|
|
378
|
+
case Instruction::ZExt:
|
|
379
|
+
return CopyStmt::ZEXT;
|
|
380
|
+
case Instruction::SExt:
|
|
381
|
+
return CopyStmt::SEXT;
|
|
382
|
+
case Instruction::BitCast:
|
|
383
|
+
return CopyStmt::BITCAST;
|
|
384
|
+
case Instruction ::Trunc:
|
|
385
|
+
return CopyStmt::TRUNC;
|
|
386
|
+
case Instruction::FPTrunc:
|
|
387
|
+
return CopyStmt::FPTRUNC;
|
|
388
|
+
case Instruction::FPToUI:
|
|
389
|
+
return CopyStmt::FPTOUI;
|
|
390
|
+
case Instruction::FPToSI:
|
|
391
|
+
return CopyStmt::FPTOSI;
|
|
392
|
+
case Instruction::UIToFP:
|
|
393
|
+
return CopyStmt::UITOFP;
|
|
394
|
+
case Instruction::SIToFP:
|
|
395
|
+
return CopyStmt::SITOFP;
|
|
396
|
+
case Instruction::IntToPtr:
|
|
397
|
+
return CopyStmt::INTTOPTR;
|
|
398
|
+
case Instruction::PtrToInt:
|
|
399
|
+
return CopyStmt::PTRTOINT;
|
|
400
|
+
default:
|
|
401
|
+
return CopyStmt::COPYVAL;
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
assert (false && "Unknown cast inst!");
|
|
405
|
+
}
|
|
406
|
+
|
|
371
407
|
/// Add Copy edge
|
|
372
408
|
inline void addPhiStmt(NodeID res, NodeID opnd, const ICFGNode* pred)
|
|
373
409
|
{
|
|
@@ -638,7 +638,8 @@ private:
|
|
|
638
638
|
/// Add Address edge
|
|
639
639
|
AddrStmt* addAddrStmt(NodeID src, NodeID dst);
|
|
640
640
|
/// Add Copy edge
|
|
641
|
-
CopyStmt* addCopyStmt(NodeID src, NodeID dst);
|
|
641
|
+
CopyStmt* addCopyStmt(NodeID src, NodeID dst, CopyStmt::CopyKind type);
|
|
642
|
+
|
|
642
643
|
/// Add phi node information
|
|
643
644
|
PhiStmt* addPhiStmt(NodeID res, NodeID opnd, const ICFGNode* pred);
|
|
644
645
|
/// Add SelectStmt
|
|
@@ -365,13 +365,15 @@ class CopyStmt: public AssignStmt
|
|
|
365
365
|
{
|
|
366
366
|
friend class SVFIRWriter;
|
|
367
367
|
friend class SVFIRReader;
|
|
368
|
-
|
|
369
368
|
private:
|
|
370
369
|
/// Constructs empty CopyStmt (for SVFIRReader/serialization)
|
|
371
370
|
CopyStmt() : AssignStmt(SVFStmt::Copy) {}
|
|
372
371
|
CopyStmt(const CopyStmt&); ///< place holder
|
|
373
372
|
void operator=(const CopyStmt&); ///< place holder
|
|
374
373
|
public:
|
|
374
|
+
enum CopyKind {COPYVAL, ZEXT, SEXT, BITCAST, TRUNC, FPTRUNC,
|
|
375
|
+
FPTOUI, FPTOSI, UITOFP, SITOFP, INTTOPTR, PTRTOINT
|
|
376
|
+
};
|
|
375
377
|
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
376
378
|
//@{
|
|
377
379
|
static inline bool classof(const CopyStmt*)
|
|
@@ -388,10 +390,18 @@ public:
|
|
|
388
390
|
}
|
|
389
391
|
//@}
|
|
390
392
|
|
|
393
|
+
/// Return the kind of the copy statement
|
|
394
|
+
inline u32_t getCopyKind() const
|
|
395
|
+
{
|
|
396
|
+
return copyKind;
|
|
397
|
+
}
|
|
398
|
+
|
|
391
399
|
/// constructor
|
|
392
|
-
CopyStmt(SVFVar* s, SVFVar* d) : AssignStmt(s, d, SVFStmt::Copy) {}
|
|
400
|
+
CopyStmt(SVFVar* s, SVFVar* d, CopyKind k) : AssignStmt(s, d, SVFStmt::Copy), copyKind(k) {}
|
|
393
401
|
|
|
394
402
|
virtual const std::string toString() const override;
|
|
403
|
+
private:
|
|
404
|
+
u32_t copyKind;
|
|
395
405
|
};
|
|
396
406
|
|
|
397
407
|
/*!
|
|
@@ -47,6 +47,10 @@ typedef unsigned u32_t;
|
|
|
47
47
|
typedef signed s32_t;
|
|
48
48
|
typedef unsigned long long u64_t;
|
|
49
49
|
typedef signed long long s64_t;
|
|
50
|
+
typedef unsigned char u8_t;
|
|
51
|
+
typedef signed char s8_t;
|
|
52
|
+
typedef unsigned short u16_t;
|
|
53
|
+
typedef signed short s16_t;
|
|
50
54
|
|
|
51
55
|
typedef u32_t NodeID;
|
|
52
56
|
typedef u32_t EdgeID;
|
|
Binary file
|
|
Binary file
|