svf-lib 1.0.849 → 1.0.853
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/MemoryModel/SVFIR.h +4 -36
- package/SVF-linux/include/MemoryModel/SVFVariables.h +2 -13
- package/SVF-linux/include/MemoryModel/SymbolTableInfo.h +6 -18
- package/SVF-linux/include/SVF-FE/SymbolTableBuilder.h +8 -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/MemoryModel/SVFIR.h +4 -36
- package/SVF-osx/include/MemoryModel/SVFVariables.h +2 -13
- package/SVF-osx/include/MemoryModel/SymbolTableInfo.h +6 -18
- package/SVF-osx/include/SVF-FE/SymbolTableBuilder.h +8 -1
- package/package.json +1 -1
|
Binary file
|
|
@@ -292,20 +292,7 @@ public:
|
|
|
292
292
|
//@}
|
|
293
293
|
|
|
294
294
|
/// Due to constaint expression, curInst is used to distinguish different instructions (e.g., memorycpy) when creating GepValVar.
|
|
295
|
-
|
|
296
|
-
{
|
|
297
|
-
GepValueVarMap::const_iterator iter = GepValObjMap.find(curInst);
|
|
298
|
-
if(iter==GepValObjMap.end()){
|
|
299
|
-
return UINT_MAX;
|
|
300
|
-
}
|
|
301
|
-
else{
|
|
302
|
-
NodeLocationSetMap::const_iterator lit = iter->second.find(std::make_pair(base, ls));
|
|
303
|
-
if(lit==iter->second.end())
|
|
304
|
-
return UINT_MAX;
|
|
305
|
-
else
|
|
306
|
-
return lit->second;
|
|
307
|
-
}
|
|
308
|
-
}
|
|
295
|
+
NodeID getGepValVar(const Value* curInst, NodeID base, const LocationSet& ls) const;
|
|
309
296
|
|
|
310
297
|
/// Add/get indirect callsites
|
|
311
298
|
//@{
|
|
@@ -411,27 +398,8 @@ public:
|
|
|
411
398
|
assert(obj && "not an object node?");
|
|
412
399
|
return SymbolTableInfo::isConstantObj(id) || obj->isConstDataOrConstGlobal();
|
|
413
400
|
}
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
SVFVar* node = getGNode(id);
|
|
417
|
-
if (FIObjVar* fiNode = SVFUtil::dyn_cast<FIObjVar>(node))
|
|
418
|
-
{
|
|
419
|
-
return (fiNode->getMemObj()->hasPtrObj() == false);
|
|
420
|
-
}
|
|
421
|
-
else if (GepObjVar* gepNode = SVFUtil::dyn_cast<GepObjVar>(node))
|
|
422
|
-
{
|
|
423
|
-
return (gepNode->getMemObj()->isNonPtrFieldObj(gepNode->getLocationSet()));
|
|
424
|
-
}
|
|
425
|
-
else if (SVFUtil::isa<DummyObjVar>(node))
|
|
426
|
-
{
|
|
427
|
-
return false;
|
|
428
|
-
}
|
|
429
|
-
else
|
|
430
|
-
{
|
|
431
|
-
assert(false && "expecting a object node");
|
|
432
|
-
return false;
|
|
433
|
-
}
|
|
434
|
-
}
|
|
401
|
+
/// Whether an object can point to any other object or any of its fields is a pointer type.
|
|
402
|
+
bool isNonPointerObj(NodeID id) const;
|
|
435
403
|
//@}
|
|
436
404
|
|
|
437
405
|
/// Base and Offset methods for Value and Object node
|
|
@@ -462,7 +430,7 @@ public:
|
|
|
462
430
|
{
|
|
463
431
|
return addDummyValNode(NodeIDAllocator::get()->allocateValueId());
|
|
464
432
|
}
|
|
465
|
-
inline NodeID addDummyObjNode(const Type* type
|
|
433
|
+
inline NodeID addDummyObjNode(const Type* type)
|
|
466
434
|
{
|
|
467
435
|
return addDummyObjNode(NodeIDAllocator::get()->allocateObjectId(), type);
|
|
468
436
|
}
|
|
@@ -81,8 +81,7 @@ protected:
|
|
|
81
81
|
const Value* value; ///< value of this SVFIR node
|
|
82
82
|
SVFStmt::KindToSVFStmtMapTy InEdgeKindToSetMap;
|
|
83
83
|
SVFStmt::KindToSVFStmtMapTy OutEdgeKindToSetMap;
|
|
84
|
-
bool
|
|
85
|
-
bool isATPointer; /// address-taken pointer
|
|
84
|
+
bool isPtr; /// whether it is a pointer (top-level or address-taken)
|
|
86
85
|
|
|
87
86
|
public:
|
|
88
87
|
/// Constructor
|
|
@@ -117,17 +116,7 @@ public:
|
|
|
117
116
|
/// Whether it is a pointer
|
|
118
117
|
virtual inline bool isPointer() const
|
|
119
118
|
{
|
|
120
|
-
return
|
|
121
|
-
}
|
|
122
|
-
/// Whether it is a top-level pointer
|
|
123
|
-
inline bool isTopLevelPtr() const
|
|
124
|
-
{
|
|
125
|
-
return isTLPointer;
|
|
126
|
-
}
|
|
127
|
-
/// Whether it is an address-taken pointer
|
|
128
|
-
inline bool isAddressTakenPtr() const
|
|
129
|
-
{
|
|
130
|
-
return isATPointer;
|
|
119
|
+
return isPtr;
|
|
131
120
|
}
|
|
132
121
|
/// Whether it is constant data, i.e., "0", "1.001", "str"
|
|
133
122
|
/// or llvm's metadata, i.e., metadata !4087
|
|
@@ -389,7 +389,7 @@ protected:
|
|
|
389
389
|
virtual void collectSimpleTypeInfo(const Type* T);
|
|
390
390
|
|
|
391
391
|
/// Create an objectInfo based on LLVM type (value is null, and type could be null, representing a dummy object)
|
|
392
|
-
ObjTypeInfo* createObjTypeInfo(const Type *type
|
|
392
|
+
ObjTypeInfo* createObjTypeInfo(const Type *type);
|
|
393
393
|
|
|
394
394
|
/// Every type T is mapped to StInfo
|
|
395
395
|
/// which contains size (fsize) , offset(foffset)
|
|
@@ -592,7 +592,7 @@ public:
|
|
|
592
592
|
*/
|
|
593
593
|
class ObjTypeInfo
|
|
594
594
|
{
|
|
595
|
-
|
|
595
|
+
friend class SymbolTableBuilder;
|
|
596
596
|
public:
|
|
597
597
|
typedef enum
|
|
598
598
|
{
|
|
@@ -619,30 +619,18 @@ private:
|
|
|
619
619
|
/// maximum number of field object can be created
|
|
620
620
|
/// minimum number is 0 (field insensitive analysis)
|
|
621
621
|
u32_t maxOffsetLimit;
|
|
622
|
+
|
|
623
|
+
void resetTypeForHeapStaticObj(const Type* type);
|
|
622
624
|
public:
|
|
623
625
|
|
|
624
626
|
/// Constructors
|
|
625
|
-
ObjTypeInfo(const
|
|
626
|
-
type(t), flags(0), maxOffsetLimit(max)
|
|
627
|
-
{
|
|
628
|
-
}
|
|
629
|
-
/// Constructor
|
|
630
|
-
ObjTypeInfo(u32_t max, const Type* t) : type(t), flags(0), maxOffsetLimit(max)
|
|
631
|
-
{
|
|
627
|
+
ObjTypeInfo(const Type* t, u32_t max);
|
|
632
628
|
|
|
633
|
-
}
|
|
634
629
|
/// Destructor
|
|
635
630
|
virtual ~ObjTypeInfo()
|
|
636
631
|
{
|
|
637
|
-
|
|
638
632
|
}
|
|
639
|
-
|
|
640
|
-
/// Analyse types of heap and static objects
|
|
641
|
-
void analyzeHeapObjType(const Type* type);
|
|
642
|
-
|
|
643
|
-
/// Analyse types of heap and static objects
|
|
644
|
-
void analyzeStaticObjType(const Type* type);
|
|
645
|
-
|
|
633
|
+
|
|
646
634
|
/// Get LLVM type
|
|
647
635
|
inline const Type* getType() const
|
|
648
636
|
{
|
|
@@ -79,7 +79,14 @@ public:
|
|
|
79
79
|
/// Initialize TypeInfo based on LLVM Value
|
|
80
80
|
void initTypeInfo(ObjTypeInfo* typeinfo, const Value* value);
|
|
81
81
|
/// Analyse types of all flattened fields of this object
|
|
82
|
-
void
|
|
82
|
+
void analyzeObjType(ObjTypeInfo* typeinfo, const Value* val);
|
|
83
|
+
/// Analyse types of heap and static objects
|
|
84
|
+
void analyzeHeapObjType(ObjTypeInfo* typeinfo, const Value* val);
|
|
85
|
+
/// Analyse types of heap and static objects
|
|
86
|
+
void analyzeStaticObjType(ObjTypeInfo* typeinfo, const Value* val);
|
|
87
|
+
/// Return the bitcast instruction which is val's only use site, otherwise return nullptr
|
|
88
|
+
const Value* getUniqueUseViaCastInst(const Value* val);
|
|
89
|
+
|
|
83
90
|
/// Return size of this object based on LLVM value
|
|
84
91
|
u32_t getObjSize(const Value* val);
|
|
85
92
|
};
|
|
Binary file
|
|
Binary file
|
|
@@ -292,20 +292,7 @@ public:
|
|
|
292
292
|
//@}
|
|
293
293
|
|
|
294
294
|
/// Due to constaint expression, curInst is used to distinguish different instructions (e.g., memorycpy) when creating GepValVar.
|
|
295
|
-
|
|
296
|
-
{
|
|
297
|
-
GepValueVarMap::const_iterator iter = GepValObjMap.find(curInst);
|
|
298
|
-
if(iter==GepValObjMap.end()){
|
|
299
|
-
return UINT_MAX;
|
|
300
|
-
}
|
|
301
|
-
else{
|
|
302
|
-
NodeLocationSetMap::const_iterator lit = iter->second.find(std::make_pair(base, ls));
|
|
303
|
-
if(lit==iter->second.end())
|
|
304
|
-
return UINT_MAX;
|
|
305
|
-
else
|
|
306
|
-
return lit->second;
|
|
307
|
-
}
|
|
308
|
-
}
|
|
295
|
+
NodeID getGepValVar(const Value* curInst, NodeID base, const LocationSet& ls) const;
|
|
309
296
|
|
|
310
297
|
/// Add/get indirect callsites
|
|
311
298
|
//@{
|
|
@@ -411,27 +398,8 @@ public:
|
|
|
411
398
|
assert(obj && "not an object node?");
|
|
412
399
|
return SymbolTableInfo::isConstantObj(id) || obj->isConstDataOrConstGlobal();
|
|
413
400
|
}
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
SVFVar* node = getGNode(id);
|
|
417
|
-
if (FIObjVar* fiNode = SVFUtil::dyn_cast<FIObjVar>(node))
|
|
418
|
-
{
|
|
419
|
-
return (fiNode->getMemObj()->hasPtrObj() == false);
|
|
420
|
-
}
|
|
421
|
-
else if (GepObjVar* gepNode = SVFUtil::dyn_cast<GepObjVar>(node))
|
|
422
|
-
{
|
|
423
|
-
return (gepNode->getMemObj()->isNonPtrFieldObj(gepNode->getLocationSet()));
|
|
424
|
-
}
|
|
425
|
-
else if (SVFUtil::isa<DummyObjVar>(node))
|
|
426
|
-
{
|
|
427
|
-
return false;
|
|
428
|
-
}
|
|
429
|
-
else
|
|
430
|
-
{
|
|
431
|
-
assert(false && "expecting a object node");
|
|
432
|
-
return false;
|
|
433
|
-
}
|
|
434
|
-
}
|
|
401
|
+
/// Whether an object can point to any other object or any of its fields is a pointer type.
|
|
402
|
+
bool isNonPointerObj(NodeID id) const;
|
|
435
403
|
//@}
|
|
436
404
|
|
|
437
405
|
/// Base and Offset methods for Value and Object node
|
|
@@ -462,7 +430,7 @@ public:
|
|
|
462
430
|
{
|
|
463
431
|
return addDummyValNode(NodeIDAllocator::get()->allocateValueId());
|
|
464
432
|
}
|
|
465
|
-
inline NodeID addDummyObjNode(const Type* type
|
|
433
|
+
inline NodeID addDummyObjNode(const Type* type)
|
|
466
434
|
{
|
|
467
435
|
return addDummyObjNode(NodeIDAllocator::get()->allocateObjectId(), type);
|
|
468
436
|
}
|
|
@@ -81,8 +81,7 @@ protected:
|
|
|
81
81
|
const Value* value; ///< value of this SVFIR node
|
|
82
82
|
SVFStmt::KindToSVFStmtMapTy InEdgeKindToSetMap;
|
|
83
83
|
SVFStmt::KindToSVFStmtMapTy OutEdgeKindToSetMap;
|
|
84
|
-
bool
|
|
85
|
-
bool isATPointer; /// address-taken pointer
|
|
84
|
+
bool isPtr; /// whether it is a pointer (top-level or address-taken)
|
|
86
85
|
|
|
87
86
|
public:
|
|
88
87
|
/// Constructor
|
|
@@ -117,17 +116,7 @@ public:
|
|
|
117
116
|
/// Whether it is a pointer
|
|
118
117
|
virtual inline bool isPointer() const
|
|
119
118
|
{
|
|
120
|
-
return
|
|
121
|
-
}
|
|
122
|
-
/// Whether it is a top-level pointer
|
|
123
|
-
inline bool isTopLevelPtr() const
|
|
124
|
-
{
|
|
125
|
-
return isTLPointer;
|
|
126
|
-
}
|
|
127
|
-
/// Whether it is an address-taken pointer
|
|
128
|
-
inline bool isAddressTakenPtr() const
|
|
129
|
-
{
|
|
130
|
-
return isATPointer;
|
|
119
|
+
return isPtr;
|
|
131
120
|
}
|
|
132
121
|
/// Whether it is constant data, i.e., "0", "1.001", "str"
|
|
133
122
|
/// or llvm's metadata, i.e., metadata !4087
|
|
@@ -389,7 +389,7 @@ protected:
|
|
|
389
389
|
virtual void collectSimpleTypeInfo(const Type* T);
|
|
390
390
|
|
|
391
391
|
/// Create an objectInfo based on LLVM type (value is null, and type could be null, representing a dummy object)
|
|
392
|
-
ObjTypeInfo* createObjTypeInfo(const Type *type
|
|
392
|
+
ObjTypeInfo* createObjTypeInfo(const Type *type);
|
|
393
393
|
|
|
394
394
|
/// Every type T is mapped to StInfo
|
|
395
395
|
/// which contains size (fsize) , offset(foffset)
|
|
@@ -592,7 +592,7 @@ public:
|
|
|
592
592
|
*/
|
|
593
593
|
class ObjTypeInfo
|
|
594
594
|
{
|
|
595
|
-
|
|
595
|
+
friend class SymbolTableBuilder;
|
|
596
596
|
public:
|
|
597
597
|
typedef enum
|
|
598
598
|
{
|
|
@@ -619,30 +619,18 @@ private:
|
|
|
619
619
|
/// maximum number of field object can be created
|
|
620
620
|
/// minimum number is 0 (field insensitive analysis)
|
|
621
621
|
u32_t maxOffsetLimit;
|
|
622
|
+
|
|
623
|
+
void resetTypeForHeapStaticObj(const Type* type);
|
|
622
624
|
public:
|
|
623
625
|
|
|
624
626
|
/// Constructors
|
|
625
|
-
ObjTypeInfo(const
|
|
626
|
-
type(t), flags(0), maxOffsetLimit(max)
|
|
627
|
-
{
|
|
628
|
-
}
|
|
629
|
-
/// Constructor
|
|
630
|
-
ObjTypeInfo(u32_t max, const Type* t) : type(t), flags(0), maxOffsetLimit(max)
|
|
631
|
-
{
|
|
627
|
+
ObjTypeInfo(const Type* t, u32_t max);
|
|
632
628
|
|
|
633
|
-
}
|
|
634
629
|
/// Destructor
|
|
635
630
|
virtual ~ObjTypeInfo()
|
|
636
631
|
{
|
|
637
|
-
|
|
638
632
|
}
|
|
639
|
-
|
|
640
|
-
/// Analyse types of heap and static objects
|
|
641
|
-
void analyzeHeapObjType(const Type* type);
|
|
642
|
-
|
|
643
|
-
/// Analyse types of heap and static objects
|
|
644
|
-
void analyzeStaticObjType(const Type* type);
|
|
645
|
-
|
|
633
|
+
|
|
646
634
|
/// Get LLVM type
|
|
647
635
|
inline const Type* getType() const
|
|
648
636
|
{
|
|
@@ -79,7 +79,14 @@ public:
|
|
|
79
79
|
/// Initialize TypeInfo based on LLVM Value
|
|
80
80
|
void initTypeInfo(ObjTypeInfo* typeinfo, const Value* value);
|
|
81
81
|
/// Analyse types of all flattened fields of this object
|
|
82
|
-
void
|
|
82
|
+
void analyzeObjType(ObjTypeInfo* typeinfo, const Value* val);
|
|
83
|
+
/// Analyse types of heap and static objects
|
|
84
|
+
void analyzeHeapObjType(ObjTypeInfo* typeinfo, const Value* val);
|
|
85
|
+
/// Analyse types of heap and static objects
|
|
86
|
+
void analyzeStaticObjType(ObjTypeInfo* typeinfo, const Value* val);
|
|
87
|
+
/// Return the bitcast instruction which is val's only use site, otherwise return nullptr
|
|
88
|
+
const Value* getUniqueUseViaCastInst(const Value* val);
|
|
89
|
+
|
|
83
90
|
/// Return size of this object based on LLVM value
|
|
84
91
|
u32_t getObjSize(const Value* val);
|
|
85
92
|
};
|