svf-lib 1.0.1643 → 1.0.1644
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/SVFIR2ItvExeState.h +14 -0
- package/SVF-linux/svf/include/MemoryModel/AccessPath.h +6 -0
- package/SVF-linux/svf/include/SVFIR/SVFStatements.h +10 -0
- package/SVF-linux/svf-llvm/include/SVF-LLVM/LLVMUtil.h +17 -0
- package/package.json +1 -1
|
Binary file
|
|
Binary file
|
|
@@ -73,9 +73,23 @@ public:
|
|
|
73
73
|
/// Return the field address given a pointer points to a struct object and an offset
|
|
74
74
|
VAddrs getGepObjAddress(u32_t pointer, s32_t offset);
|
|
75
75
|
|
|
76
|
+
/// Return the byte offset from one gep param offset
|
|
77
|
+
std::pair<s32_t, s32_t> getBytefromGepTypePair(const AccessPath::VarAndGepTypePair& gep_pair, const GepStmt *gep, s32_t elem_bytesize);
|
|
78
|
+
|
|
79
|
+
/// Return the Index offset from one gep param offset
|
|
80
|
+
std::pair<s32_t, s32_t> getIndexfromGepTypePair(const AccessPath::VarAndGepTypePair& gep_pair, const GepStmt *gep);
|
|
81
|
+
|
|
82
|
+
/// Return the byte offset expression of a GepStmt
|
|
83
|
+
/// elemBytesize is the element byte size of an static alloc or heap alloc array
|
|
84
|
+
/// e.g. GepStmt* gep = **,
|
|
85
|
+
/// s32_t elemBytesize = LLVMUtil::SVFType2ByteSize(gep->getRHSVar()->getValue()->getType());
|
|
86
|
+
/// std::pair<s32_t, s32_t> byteOffset = getGepByteOffset(gep, elemBytesize);
|
|
87
|
+
std::pair<s32_t, s32_t> getGepByteOffset(const GepStmt *gep, s32_t elemBytesize);
|
|
88
|
+
|
|
76
89
|
/// Return the offset expression of a GepStmt
|
|
77
90
|
std::pair<s32_t, s32_t> getGepOffset(const GepStmt *gep);
|
|
78
91
|
|
|
92
|
+
|
|
79
93
|
static z3::context &getContext()
|
|
80
94
|
{
|
|
81
95
|
return Z3Expr::getContext();
|
|
@@ -109,6 +109,12 @@ public:
|
|
|
109
109
|
}
|
|
110
110
|
//@}
|
|
111
111
|
|
|
112
|
+
/// Return accumulated constant byte offset given OffsetVarVec and elemByteSize
|
|
113
|
+
/// elemBytesize is the element byte size of an static alloc or heap alloc array
|
|
114
|
+
/// e.g. GepStmt* gep = **,
|
|
115
|
+
/// s32_t elemBytesize = LLVMUtil::SVFType2ByteSize(gep->getRHSVar()->getValue()->getType());
|
|
116
|
+
/// APOffset byteOffset = gep->accumulateConstantByteOffset(elemBytesize);
|
|
117
|
+
APOffset computeConstantByteOffset(u32_t elemBytesize) const;
|
|
112
118
|
/// Return accumulated constant offset given OffsetVarVec
|
|
113
119
|
APOffset computeConstantOffset() const;
|
|
114
120
|
|
|
@@ -500,6 +500,16 @@ public:
|
|
|
500
500
|
{
|
|
501
501
|
return getAccessPath().isConstantOffset();
|
|
502
502
|
}
|
|
503
|
+
/// Return accumulated constant offset (when accessing array or struct) if this offset is a constant.
|
|
504
|
+
/// elemBytesize is the element byte size of an static alloc or heap alloc array
|
|
505
|
+
/// e.g. GepStmt* gep = **,
|
|
506
|
+
/// s32_t elemBytesize = LLVMUtil::SVFType2ByteSize(gep->getRHSVar()->getValue()->getType());
|
|
507
|
+
/// APOffset byteOffset = gep->accumulateConstantByteOffset(elemBytesize);
|
|
508
|
+
inline APOffset accumulateConstantByteOffset(u32_t elemBytesize) const
|
|
509
|
+
{
|
|
510
|
+
return getAccessPath().computeConstantByteOffset(elemBytesize);
|
|
511
|
+
}
|
|
512
|
+
|
|
503
513
|
/// Return accumulated constant offset (when accessing array or struct) if this offset is a constant.
|
|
504
514
|
inline APOffset accumulateConstantOffset() const
|
|
505
515
|
{
|
|
@@ -377,6 +377,23 @@ std::vector<const Function *> getCalledFunctions(const Function *F);
|
|
|
377
377
|
std::vector<std::string> getFunAnnotations(const Function* fun);
|
|
378
378
|
void removeFunAnnotations(std::vector<Function*>& removedFuncList);
|
|
379
379
|
|
|
380
|
+
inline u32_t SVFType2ByteSize(const SVFType* type)
|
|
381
|
+
{
|
|
382
|
+
const llvm::Type* llvm_rhs = LLVMModuleSet::getLLVMModuleSet()->getLLVMType(type);
|
|
383
|
+
u32_t llvm_rhs_size = LLVMUtil::getTypeSizeInBytes(llvm_rhs->getPointerElementType());
|
|
384
|
+
u32_t llvm_elem_size = -1;
|
|
385
|
+
if (llvm_rhs->getPointerElementType()->isArrayTy() && llvm_rhs_size > 0)
|
|
386
|
+
{
|
|
387
|
+
size_t array_len = llvm_rhs->getPointerElementType()->getArrayNumElements();
|
|
388
|
+
llvm_elem_size = llvm_rhs_size / array_len;
|
|
389
|
+
}
|
|
390
|
+
else
|
|
391
|
+
{
|
|
392
|
+
llvm_elem_size =llvm_rhs_size;
|
|
393
|
+
}
|
|
394
|
+
return llvm_elem_size;
|
|
395
|
+
}
|
|
396
|
+
|
|
380
397
|
inline void removeUnusedFuncsAndAnnotations(std::vector<Function*> removedFuncList)
|
|
381
398
|
{
|
|
382
399
|
/// Remove unused function annotations in extapi.bc
|