svf-lib 1.0.807 → 1.0.808

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.
Binary file
@@ -131,8 +131,12 @@ public:
131
131
  }
132
132
  //@}
133
133
 
134
+ /// Return accumulated constant offset given OffsetValueVec
134
135
  s64_t accumulateConstantOffset() const;
135
136
 
137
+ /// Return element number of a type.
138
+ u32_t getElementNum(const Type* type) const;
139
+
136
140
  bool addOffsetValue(const Value* offsetValue, const Type* type);
137
141
 
138
142
  /// Return TRUE if this is a constant location set.
@@ -438,6 +438,10 @@ public:
438
438
  return ls;
439
439
  }
440
440
 
441
+ inline s64_t accumulateConstantOffset() const
442
+ {
443
+ return ls.accumulateConstantOffset();
444
+ }
441
445
  /// offset of the gep statement
442
446
  inline s64_t getConstantFieldIdx() const
443
447
  {
@@ -364,7 +364,11 @@ public:
364
364
  }
365
365
 
366
366
  ///Get a reference to the components of struct_info.
367
- const std::vector<u32_t>& getFlattenedFieldIdxVec(const Type *T);
367
+ /// Flatterned full offset information of a struct including its array fields
368
+ const std::vector<u32_t>& getFlattenedOffsetVec(const StructType *T);
369
+ /// Flatterned field index information of a struct ignoring any array field
370
+ const std::vector<u32_t>& getFlattenedFieldIdxVec(const StructType *T);
371
+
368
372
  const std::vector<FlattenedFieldInfo>& getFlattenedFieldInfoVec(const Type *T);
369
373
 
370
374
  /// struct A { int id; int salary; }; struct B { char name[20]; struct A a;} B b;
@@ -501,25 +505,32 @@ public:
501
505
 
502
506
 
503
507
  /*!
504
- * Struct information
508
+ * Flatterned type information of StructType, ArrayType and SingleValueType
505
509
  */
506
510
  class StInfo
507
511
  {
508
512
 
509
513
  private:
510
- /// flattened field indices of a struct
514
+ /// flattened field indices of a struct (ignoring arrays)
511
515
  std::vector<u32_t> fldIdxVec;
516
+ /// flattened full offset (including array strides)
517
+ std::vector<u32_t> fullOffsetVec;
512
518
  /// Types of all fields of a struct
513
519
  Map<u32_t, const Type*> fldIdx2TypeMap;
514
520
  /// All field infos after flattening a struct
515
521
  std::vector<FlattenedFieldInfo> finfo;
516
-
522
+ /// stride represents the number of repetitive elements if this StInfo represent an ArrayType. stride is 1 by default.
523
+ u32_t stride;
517
524
  /// Max field limit
518
525
  static u32_t maxFieldLimit;
519
526
 
527
+ StInfo(); ///< place holder
528
+ StInfo(const StInfo& st); ///< place holder
529
+ void operator=(const StInfo&); ///< place holder
530
+
520
531
  public:
521
532
  /// Constructor
522
- StInfo()
533
+ StInfo(u32_t s) : stride(s)
523
534
  {
524
535
  }
525
536
  /// Destructor
@@ -560,6 +571,10 @@ public:
560
571
  {
561
572
  return fldIdxVec;
562
573
  }
574
+ inline std::vector<u32_t>& getFlattenedOffsetVec()
575
+ {
576
+ return fullOffsetVec;
577
+ }
563
578
  inline std::vector<FlattenedFieldInfo>& getFlattenedFieldInfoVec()
564
579
  {
565
580
  return finfo;
@@ -567,11 +582,17 @@ public:
567
582
  //@}
568
583
 
569
584
  /// Add field (index and offset) with its corresponding type
570
- inline void addFldWithType(u32_t fldIdx, const Type* type)
585
+ inline void addFldWithType(u32_t fldIdx, const Type* type, u32_t fullOffset)
571
586
  {
572
587
  fldIdxVec.push_back(fldIdx);
588
+ fullOffsetVec.push_back(fullOffset);
573
589
  fldIdx2TypeMap[fldIdx] = type;
574
590
  }
591
+
592
+ /// Array Type can have
593
+ inline u32_t getStride() const {
594
+ return stride;
595
+ }
575
596
  };
576
597
 
577
598
  /*!
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svf-lib",
3
- "version": "1.0.807",
3
+ "version": "1.0.808",
4
4
  "description": "SVF's npm support",
5
5
  "main": "index.js",
6
6
  "scripts": {