svf-lib 1.0.1698 → 1.0.1699
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 +5 -5
- package/SVF-linux/svf/include/MemoryModel/AccessPath.h +24 -6
- package/SVF-linux/svf/include/SVFIR/SVFStatements.h +2 -2
- package/SVF-linux/svf/include/SVFIR/SVFType.h +19 -0
- package/package.json +1 -1
|
Binary file
|
|
Binary file
|
|
@@ -74,17 +74,17 @@ public:
|
|
|
74
74
|
VAddrs getGepObjAddress(u32_t pointer, APOffset offset);
|
|
75
75
|
|
|
76
76
|
/// Return the byte offset from one gep param offset
|
|
77
|
-
std::pair<APOffset, APOffset> getBytefromGepTypePair(const AccessPath::VarAndGepTypePair& gep_pair, const GepStmt *gep
|
|
77
|
+
std::pair<APOffset, APOffset> getBytefromGepTypePair(const AccessPath::VarAndGepTypePair& gep_pair, const GepStmt *gep);
|
|
78
78
|
|
|
79
79
|
/// Return the Index offset from one gep param offset
|
|
80
80
|
std::pair<APOffset, APOffset> getIndexfromGepTypePair(const AccessPath::VarAndGepTypePair& gep_pair, const GepStmt *gep);
|
|
81
81
|
|
|
82
82
|
/// Return the byte offset expression of a GepStmt
|
|
83
83
|
/// elemBytesize is the element byte size of an static alloc or heap alloc array
|
|
84
|
-
/// e.g. GepStmt* gep =
|
|
85
|
-
/// s32_t
|
|
86
|
-
///
|
|
87
|
-
std::pair<APOffset, APOffset> getGepByteOffset(const GepStmt *gep
|
|
84
|
+
/// e.g. GepStmt* gep = [i32*10], x, and x is [0,3]
|
|
85
|
+
/// std::pair<s32_t, s32_t> byteOffset = getGepByteOffset(gep);
|
|
86
|
+
/// byteOffset should be [0, 12] since i32 is 4 bytes.
|
|
87
|
+
std::pair<APOffset, APOffset> getGepByteOffset(const GepStmt *gep);
|
|
88
88
|
|
|
89
89
|
/// Return the offset expression of a GepStmt
|
|
90
90
|
std::pair<APOffset, APOffset> getGepOffset(const GepStmt *gep);
|
|
@@ -109,13 +109,31 @@ public:
|
|
|
109
109
|
}
|
|
110
110
|
//@}
|
|
111
111
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
112
|
+
/**
|
|
113
|
+
* Computes the total constant byte offset of an access path.
|
|
114
|
+
* This function iterates over the offset-variable-type pairs in reverse order,
|
|
115
|
+
* accumulating the total byte offset for constant offsets. For each pair,
|
|
116
|
+
* it retrieves the corresponding SVFValue and determines the type of offset
|
|
117
|
+
* (whether it's an array, pointer, or structure). If the offset corresponds
|
|
118
|
+
* to a structure, it further resolves the actual element type based on the
|
|
119
|
+
* offset value. It then multiplies the offset value by the size of the type
|
|
120
|
+
* to compute the byte offset. This is used to handle composite types where
|
|
121
|
+
* offsets are derived from the type's internal structure, such as arrays
|
|
122
|
+
* or structures with fields of various types and sizes. The function asserts
|
|
123
|
+
* that the access path must have a constant offset, and it is intended to be
|
|
124
|
+
* used when the offset is known to be constant at compile time.
|
|
125
|
+
*
|
|
126
|
+
* @return APOffset representing the computed total constant byte offset.
|
|
127
|
+
*/
|
|
128
|
+
/// e.g. GepStmt* gep = [i32*4], 2
|
|
129
|
+
/// APOffset byteOffset = gep->accumulateConstantByteOffset();
|
|
130
|
+
/// byteOffset should be 8 since i32 is 4 bytes and index is 2.
|
|
131
|
+
APOffset computeConstantByteOffset() const;
|
|
118
132
|
/// Return accumulated constant offset given OffsetVarVec
|
|
133
|
+
/// compard to computeConstantByteOffset, it is field offset rather than byte offset
|
|
134
|
+
/// e.g. GepStmt* gep = [i32*4], 2
|
|
135
|
+
/// APOffset byteOffset = gep->computeConstantOffset();
|
|
136
|
+
/// byteOffset should be 2 since it is field offset.
|
|
119
137
|
APOffset computeConstantOffset() const;
|
|
120
138
|
|
|
121
139
|
/// Return element number of a type.
|
|
@@ -505,9 +505,9 @@ public:
|
|
|
505
505
|
/// e.g. GepStmt* gep = **,
|
|
506
506
|
/// s32_t elemBytesize = LLVMUtil::SVFType2ByteSize(gep->getRHSVar()->getValue()->getType());
|
|
507
507
|
/// APOffset byteOffset = gep->accumulateConstantByteOffset(elemBytesize);
|
|
508
|
-
inline APOffset accumulateConstantByteOffset(
|
|
508
|
+
inline APOffset accumulateConstantByteOffset() const
|
|
509
509
|
{
|
|
510
|
-
return getAccessPath().computeConstantByteOffset(
|
|
510
|
+
return getAccessPath().computeConstantByteOffset();
|
|
511
511
|
}
|
|
512
512
|
|
|
513
513
|
/// Return accumulated constant offset (when accessing array or struct) if this offset is a constant.
|
|
@@ -299,6 +299,8 @@ public:
|
|
|
299
299
|
return getPointerToTy;
|
|
300
300
|
}
|
|
301
301
|
|
|
302
|
+
u32_t getLLVMByteSize() const;
|
|
303
|
+
|
|
302
304
|
inline void setTypeInfo(StInfo* ti)
|
|
303
305
|
{
|
|
304
306
|
typeinfo = ti;
|
|
@@ -321,6 +323,16 @@ public:
|
|
|
321
323
|
return kind == SVFPointerTy;
|
|
322
324
|
}
|
|
323
325
|
|
|
326
|
+
inline bool isArrayTy() const
|
|
327
|
+
{
|
|
328
|
+
return kind == SVFArrayTy;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
inline bool isStructTy() const
|
|
332
|
+
{
|
|
333
|
+
return kind == SVFStructTy;
|
|
334
|
+
}
|
|
335
|
+
|
|
324
336
|
inline bool isSingleValueType() const
|
|
325
337
|
{
|
|
326
338
|
return isSingleValTy;
|
|
@@ -462,6 +474,11 @@ public:
|
|
|
462
474
|
|
|
463
475
|
void print(std::ostream& os) const override;
|
|
464
476
|
|
|
477
|
+
const SVFType* getTypeOfElement() const
|
|
478
|
+
{
|
|
479
|
+
return typeOfElement;
|
|
480
|
+
}
|
|
481
|
+
|
|
465
482
|
void setTypeOfElement(const SVFType* elemType)
|
|
466
483
|
{
|
|
467
484
|
typeOfElement = elemType;
|
|
@@ -471,6 +488,8 @@ public:
|
|
|
471
488
|
{
|
|
472
489
|
numOfElement = elemNum;
|
|
473
490
|
}
|
|
491
|
+
|
|
492
|
+
|
|
474
493
|
};
|
|
475
494
|
|
|
476
495
|
class SVFOtherType : public SVFType
|