svf-lib 1.0.862 → 1.0.866

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.
@@ -39,30 +39,6 @@
39
39
  namespace SVF
40
40
  {
41
41
 
42
- /*!
43
- * Field information of an aggregate object
44
- */
45
- class FlattenedFieldInfo
46
- {
47
- private:
48
- u32_t flattenedFldIdx;
49
- const Type* flattenedElemTy;
50
- public:
51
- FlattenedFieldInfo(u32_t idx, const Type* ty) :
52
- flattenedFldIdx(idx), flattenedElemTy(ty)
53
- {
54
- }
55
- inline u32_t getFlattenFldIdx() const
56
- {
57
- return flattenedFldIdx;
58
- }
59
- inline const Type* getFlattenElemTy() const
60
- {
61
- return flattenedElemTy;
62
- }
63
- };
64
-
65
-
66
42
  /*
67
43
  * Location set represents a set of locations in a memory block with following offsets:
68
44
  * { offset + \sum_{i=0}^N (stride_i * j_i) | 0 \leq j_i < M_i }
@@ -503,7 +503,7 @@ public:
503
503
  /// Return the type of this gep object
504
504
  inline virtual const Type* getType() const
505
505
  {
506
- return SymbolTableInfo::SymbolInfo()->getOriginalFieldType(mem->getType(), ls.accumulateConstantFieldIdx());
506
+ return SymbolTableInfo::SymbolInfo()->getFlatternedElemType(mem->getType(), ls.accumulateConstantFieldIdx());
507
507
  }
508
508
 
509
509
  /// Return name of a LLVM value
@@ -358,13 +358,12 @@ public:
358
358
  /// Flatterned element idx of an array or struct by considering stride
359
359
  u32_t getFlattenedElemIdx(const Type *T, s64_t origId);
360
360
 
361
- const std::vector<FlattenedFieldInfo>& getFlattenedFieldInfoVec(const Type *T);
362
-
363
361
  /// struct A { int id; int salary; }; struct B { char name[20]; struct A a;} B b;
364
- /// OriginalFieldType of b with field_idx 1 : Struct A
365
- /// FlatternedFieldType of b with field_idx 1 : int
366
- const Type* getOriginalFieldType(const Type* baseType, u32_t field_idx);
367
- const Type* getFlatternedFieldType(const Type* baseType, u32_t field_idx);
362
+ /// OriginalElemType of b with field_idx 1 : Struct A
363
+ /// FlatternedElemType of b with field_idx 1 : int
364
+ const Type* getOriginalElemType(const Type* baseType, u32_t origId);
365
+ /// Return the type of a flattened element given a flattened index
366
+ const Type* getFlatternedElemType(const Type* baseType, u32_t flatten_idx);
368
367
  //@}
369
368
 
370
369
  /// Collect type info
@@ -381,6 +380,9 @@ public:
381
380
  virtual void dump();
382
381
 
383
382
  protected:
383
+ /// Return the flattened field type for struct type only
384
+ const std::vector<const Type*>& getFlattenFieldTypes(const StructType *T);
385
+
384
386
  /// Collect the struct info
385
387
  virtual void collectStructInfo(const StructType *T);
386
388
  /// Collect the array info
@@ -507,13 +509,15 @@ private:
507
509
  /// Types of all fields of a struct
508
510
  Map<u32_t, const Type*> fldIdx2TypeMap;
509
511
  /// All field infos after flattening a struct
510
- std::vector<FlattenedFieldInfo> finfo;
512
+ std::vector<const Type*> finfo;
511
513
  /// stride represents the number of repetitive elements if this StInfo represent an ArrayType. stride is 1 by default.
512
514
  u32_t stride;
513
515
  /// number of elements after flattenning (including array elements)
514
516
  u32_t numOfFlattenElements;
515
517
  /// number of fields after flattenning (ignoring array elements)
516
518
  u32_t numOfFlattenFields;
519
+ /// Type vector of fields
520
+ std::vector<const Type*> flattenElementTypes;
517
521
  /// Max field limit
518
522
  static u32_t maxFieldLimit;
519
523
 
@@ -545,8 +549,7 @@ public:
545
549
  /// OriginalFieldType of b with field_idx 1 : Struct A
546
550
  /// FlatternedFieldType of b with field_idx 1 : int
547
551
  //{@
548
- const Type* getOriginalFieldType(u32_t fldIdx);
549
- const Type* getFlatternedFieldType(u32_t fldIdx);
552
+ const Type* getOriginalElemType(u32_t fldIdx);
550
553
 
551
554
  inline std::vector<u32_t>& getFlattenedFieldIdxVec()
552
555
  {
@@ -556,7 +559,11 @@ public:
556
559
  {
557
560
  return elemIdxVec;
558
561
  }
559
- inline std::vector<FlattenedFieldInfo>& getFlattenedFieldInfoVec()
562
+ inline std::vector<const Type*>& getFlattenElementTypes()
563
+ {
564
+ return flattenElementTypes;
565
+ }
566
+ inline std::vector<const Type*>& getFlattenFieldTypes()
560
567
  {
561
568
  return finfo;
562
569
  }
Binary file
@@ -39,30 +39,6 @@
39
39
  namespace SVF
40
40
  {
41
41
 
42
- /*!
43
- * Field information of an aggregate object
44
- */
45
- class FlattenedFieldInfo
46
- {
47
- private:
48
- u32_t flattenedFldIdx;
49
- const Type* flattenedElemTy;
50
- public:
51
- FlattenedFieldInfo(u32_t idx, const Type* ty) :
52
- flattenedFldIdx(idx), flattenedElemTy(ty)
53
- {
54
- }
55
- inline u32_t getFlattenFldIdx() const
56
- {
57
- return flattenedFldIdx;
58
- }
59
- inline const Type* getFlattenElemTy() const
60
- {
61
- return flattenedElemTy;
62
- }
63
- };
64
-
65
-
66
42
  /*
67
43
  * Location set represents a set of locations in a memory block with following offsets:
68
44
  * { offset + \sum_{i=0}^N (stride_i * j_i) | 0 \leq j_i < M_i }
@@ -503,7 +503,7 @@ public:
503
503
  /// Return the type of this gep object
504
504
  inline virtual const Type* getType() const
505
505
  {
506
- return SymbolTableInfo::SymbolInfo()->getOriginalFieldType(mem->getType(), ls.accumulateConstantFieldIdx());
506
+ return SymbolTableInfo::SymbolInfo()->getFlatternedElemType(mem->getType(), ls.accumulateConstantFieldIdx());
507
507
  }
508
508
 
509
509
  /// Return name of a LLVM value
@@ -358,13 +358,12 @@ public:
358
358
  /// Flatterned element idx of an array or struct by considering stride
359
359
  u32_t getFlattenedElemIdx(const Type *T, s64_t origId);
360
360
 
361
- const std::vector<FlattenedFieldInfo>& getFlattenedFieldInfoVec(const Type *T);
362
-
363
361
  /// struct A { int id; int salary; }; struct B { char name[20]; struct A a;} B b;
364
- /// OriginalFieldType of b with field_idx 1 : Struct A
365
- /// FlatternedFieldType of b with field_idx 1 : int
366
- const Type* getOriginalFieldType(const Type* baseType, u32_t field_idx);
367
- const Type* getFlatternedFieldType(const Type* baseType, u32_t field_idx);
362
+ /// OriginalElemType of b with field_idx 1 : Struct A
363
+ /// FlatternedElemType of b with field_idx 1 : int
364
+ const Type* getOriginalElemType(const Type* baseType, u32_t origId);
365
+ /// Return the type of a flattened element given a flattened index
366
+ const Type* getFlatternedElemType(const Type* baseType, u32_t flatten_idx);
368
367
  //@}
369
368
 
370
369
  /// Collect type info
@@ -381,6 +380,9 @@ public:
381
380
  virtual void dump();
382
381
 
383
382
  protected:
383
+ /// Return the flattened field type for struct type only
384
+ const std::vector<const Type*>& getFlattenFieldTypes(const StructType *T);
385
+
384
386
  /// Collect the struct info
385
387
  virtual void collectStructInfo(const StructType *T);
386
388
  /// Collect the array info
@@ -507,7 +509,7 @@ private:
507
509
  /// Types of all fields of a struct
508
510
  Map<u32_t, const Type*> fldIdx2TypeMap;
509
511
  /// All field infos after flattening a struct
510
- std::vector<FlattenedFieldInfo> finfo;
512
+ std::vector<const Type*> finfo;
511
513
  /// stride represents the number of repetitive elements if this StInfo represent an ArrayType. stride is 1 by default.
512
514
  u32_t stride;
513
515
  /// number of elements after flattenning (including array elements)
@@ -547,8 +549,7 @@ public:
547
549
  /// OriginalFieldType of b with field_idx 1 : Struct A
548
550
  /// FlatternedFieldType of b with field_idx 1 : int
549
551
  //{@
550
- const Type* getOriginalFieldType(u32_t fldIdx);
551
- const Type* getFlatternedFieldType(u32_t fldIdx);
552
+ const Type* getOriginalElemType(u32_t fldIdx);
552
553
 
553
554
  inline std::vector<u32_t>& getFlattenedFieldIdxVec()
554
555
  {
@@ -562,7 +563,7 @@ public:
562
563
  {
563
564
  return flattenElementTypes;
564
565
  }
565
- inline std::vector<FlattenedFieldInfo>& getFlattenedFieldInfoVec()
566
+ inline std::vector<const Type*>& getFlattenFieldTypes()
566
567
  {
567
568
  return finfo;
568
569
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svf-lib",
3
- "version": "1.0.862",
3
+ "version": "1.0.866",
4
4
  "description": "SVF's npm support",
5
5
  "main": "index.js",
6
6
  "scripts": {