svf-lib 1.0.2199 → 1.0.2200

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
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -71,9 +71,6 @@ public:
71
71
 
72
72
  /// various maps defined
73
73
  //{@
74
- /// llvm value to sym id map
75
- /// local (%) and global (@) identifiers are pointer types which have a value node id.
76
- typedef OrderedMap<const SVFValue*, NodeID> ValueToIDMapTy;
77
74
  /// sym id to obj type info map
78
75
  typedef OrderedMap<NodeID, ObjTypeInfo*> IDToTypeInfoMapTy;
79
76
 
@@ -84,8 +81,6 @@ public:
84
81
  //@}
85
82
 
86
83
  private:
87
- ValueToIDMapTy valSymMap; ///< map a value to its sym id
88
- ValueToIDMapTy objSymMap; ///< map a obj reference to its sym id
89
84
  FunToIDMapTy returnSymMap; ///< return map
90
85
  FunToIDMapTy varargSymMap; ///< vararg map
91
86
  IDToTypeInfoMapTy objTypeInfoMap; ///< map a memory sym id to its obj
@@ -114,6 +109,8 @@ protected:
114
109
  bool fromFile; ///< Whether the SVFIR is built according to user specified data from a txt file
115
110
  NodeID nodeNumAfterPAGBuild; ///< initial node number after building SVFIR, excluding later added nodes, e.g., gepobj nodes
116
111
  u32_t totalPTAPAGEdge;
112
+ u32_t valVarNum;
113
+ u32_t objVarNum;
117
114
 
118
115
  /// Add a node into the graph
119
116
  inline NodeID addNode(SVFVar* node)
@@ -139,7 +136,7 @@ protected:
139
136
 
140
137
  public:
141
138
  IRGraph(bool buildFromFile)
142
- : totalSymNum(0), fromFile(buildFromFile), nodeNumAfterPAGBuild(0), totalPTAPAGEdge(0),
139
+ : totalSymNum(0), fromFile(buildFromFile), nodeNumAfterPAGBuild(0), totalPTAPAGEdge(0), valVarNum(0), objVarNum(0),
143
140
  maxStruct(nullptr), maxStSize(0)
144
141
  {
145
142
  }
@@ -210,16 +207,6 @@ public:
210
207
 
211
208
  /// Get different kinds of syms maps
212
209
  //@{
213
- inline ValueToIDMapTy& valSyms()
214
- {
215
- return valSymMap;
216
- }
217
-
218
- inline ValueToIDMapTy& objSyms()
219
- {
220
- return objSymMap;
221
- }
222
-
223
210
  inline IDToTypeInfoMapTy& idToObjTypeInfoMap()
224
211
  {
225
212
  return objTypeInfoMap;
@@ -242,16 +229,6 @@ public:
242
229
 
243
230
  //@}
244
231
 
245
- /// Get SVFIR Node according to LLVM value
246
- ///getNode - Return the node corresponding to the specified pointer.
247
- NodeID getValueNode(const SVFValue* V);
248
-
249
- bool hasValueNode(const SVFValue* V);
250
-
251
- /// getObject - Return the obj node id refer to the memory object for the
252
- /// specified global, heap or alloca instruction according to llvm value.
253
- NodeID getObjectNode(const SVFValue* V);
254
-
255
232
  inline ObjTypeInfo* getObjTypeInfo(NodeID id) const
256
233
  {
257
234
  IDToTypeInfoMapTy::const_iterator iter = objTypeInfoMap.find(id);
@@ -282,14 +259,9 @@ public:
282
259
  return nullPtrSymID();
283
260
  }
284
261
 
285
- inline u32_t getValueNodeNum() const
286
- {
287
- return valSymMap.size();
288
- }
289
- inline u32_t getObjectNodeNum() const
290
- {
291
- return objTypeInfoMap.size();
292
- }
262
+ u32_t getValueNodeNum();
263
+
264
+ u32_t getObjectNodeNum();
293
265
 
294
266
  /// Constant reader that won't change the state of the symbol table
295
267
  //@{
@@ -39,13 +39,13 @@
39
39
  namespace SVF
40
40
  {
41
41
 
42
- class SymbolTableInfo;
43
42
  class ObjTypeInference;
44
43
 
45
44
  class LLVMModuleSet
46
45
  {
47
46
  friend class SVFIRBuilder;
48
47
  friend class ICFGBuilder;
48
+ friend class SymbolTableBuilder;
49
49
 
50
50
  public:
51
51
 
@@ -73,6 +73,10 @@ public:
73
73
  typedef Map<const Function*, FunEntryICFGNode *> FunToFunEntryNodeMapTy;
74
74
  typedef Map<const Function*, FunExitICFGNode *> FunToFunExitNodeMapTy;
75
75
 
76
+ /// llvm value to sym id map
77
+ /// local (%) and global (@) identifiers are pointer types which have a value node id.
78
+ typedef OrderedMap<const SVFValue*, NodeID> ValueToIDMapTy;
79
+
76
80
  private:
77
81
  static LLVMModuleSet* llvmModuleSet;
78
82
  static bool preProcessed;
@@ -112,6 +116,9 @@ private:
112
116
 
113
117
  Map<const Function*, DominatorTree> FunToDominatorTree;
114
118
 
119
+ ValueToIDMapTy valSymMap; ///< map a value to its sym id
120
+ ValueToIDMapTy objSymMap; ///< map a obj reference to its sym id
121
+
115
122
  /// Constructor
116
123
  LLVMModuleSet();
117
124
 
@@ -170,6 +177,41 @@ public:
170
177
  // Dump modules to files
171
178
  void dumpModulesToFile(const std::string& suffix);
172
179
 
180
+ public:
181
+
182
+ inline u32_t getValueNodeNum() const
183
+ {
184
+ return valSymMap.size();
185
+ }
186
+
187
+ inline u32_t getObjNodeNum() const
188
+ {
189
+ return objSymMap.size();
190
+ }
191
+
192
+ inline ValueToIDMapTy& valSyms()
193
+ {
194
+ return valSymMap;
195
+ }
196
+
197
+ inline ValueToIDMapTy& objSyms()
198
+ {
199
+ return objSymMap;
200
+ }
201
+
202
+ /// Get SVFIR Node according to LLVM value
203
+ ///getNode - Return the node corresponding to the specified pointer.
204
+ NodeID getValueNode(const SVFValue* V);
205
+
206
+ bool hasValueNode(const SVFValue* V);
207
+
208
+ /// getObject - Return the obj node id refer to the memory object for the
209
+ /// specified global, heap or alloca instruction according to llvm value.
210
+ NodeID getObjectNode(const SVFValue* V);
211
+
212
+ void dumpSymTable();
213
+
214
+ public:
173
215
  inline void addFunctionMap(const Function* func, SVFFunction* svfFunc)
174
216
  {
175
217
  LLVMFunc2SVFFunc[func] = svfFunc;
@@ -91,14 +91,14 @@ public:
91
91
 
92
92
  // strip off the constant cast and return the value node
93
93
  SVFValue* svfVal = llvmModuleSet()->getSVFValue(V);
94
- return pag->getValueNode(svfVal);
94
+ return llvmModuleSet()->getValueNode(svfVal);
95
95
  }
96
96
 
97
97
  /// GetObject - Return the object node (stack/global/heap/function) according to a LLVM Value
98
98
  inline NodeID getObjectNode(const Value* V)
99
99
  {
100
100
  SVFValue* svfVal = llvmModuleSet()->getSVFValue(V);
101
- return pag->getObjectNode(svfVal);
101
+ return llvmModuleSet()->getObjectNode(svfVal);
102
102
  }
103
103
 
104
104
  /// getReturnNode - Return the node representing the unique return value of a function.
@@ -84,6 +84,10 @@ protected:
84
84
  void handleCE(const Value* val);
85
85
  // @}
86
86
 
87
+ inline LLVMModuleSet* llvmModuleSet()
88
+ {
89
+ return LLVMModuleSet::getLLVMModuleSet();
90
+ }
87
91
 
88
92
  ObjTypeInference* getTypeInference();
89
93
 
@@ -118,9 +122,9 @@ protected:
118
122
  ///Get a reference to StructInfo.
119
123
  StInfo* getOrAddSVFTypeInfo(const Type* T);
120
124
 
121
- ObjTypeInfo* createBlkObjTypeInfo(SymID symId);
125
+ ObjTypeInfo* createBlkObjTypeInfo(NodeID symId);
122
126
 
123
- ObjTypeInfo* createConstantObjTypeInfo(SymID symId);
127
+ ObjTypeInfo* createConstantObjTypeInfo(NodeID symId);
124
128
  };
125
129
 
126
130
  } // End namespace SVF
@@ -39,7 +39,6 @@ class CallGraph;
39
39
  /*!
40
40
  * SVF Intermediate representation, representing variables and statements as a Program Assignment Graph (PAG)
41
41
  * Variables as nodes and statements as edges.
42
- * SymID and NodeID are equal here (same numbering).
43
42
  */
44
43
  class SVFIR : public IRGraph
45
44
  {
@@ -63,6 +62,7 @@ public:
63
62
  typedef Map<const CallICFGNode*,SVFVarList> CSToArgsListMap;
64
63
  typedef Map<const RetICFGNode*,const SVFVar*> CSToRetMap;
65
64
  typedef Map<const SVFFunction*,const SVFVar*> FunToRetMap;
65
+ typedef Map<const CallGraphNode*,const FunObjVar *> FunToFunObjVarMap;
66
66
  typedef Map<const SVFFunction*,SVFStmtSet> FunToPAGEdgeSetMap;
67
67
  typedef Map<const ICFGNode*,SVFStmtList> ICFGNode2SVFStmtsMap;
68
68
  typedef Map<NodeID, NodeID> NodeToNodeMap;
@@ -90,6 +90,7 @@ private:
90
90
  CSToArgsListMap callSiteArgsListMap; ///< Map a callsite to a list of all its actual parameters
91
91
  CSToRetMap callSiteRetMap; ///< Map a callsite to its callsite returns PAGNodes
92
92
  FunToRetMap funRetMap; ///< Map a function to its unique function return PAGNodes
93
+ FunToFunObjVarMap funToFunObjvarMap; ///< Map a function to its unique function object PAGNodes
93
94
  CallSiteToFunPtrMap indCallSiteToFunPtrMap; ///< Map an indirect callsite to its function pointer
94
95
  FunPtrToCallSitesMap funPtrToCallSitesMap; ///< Map a function pointer to the callsites where it is used
95
96
  /// Valid pointers for pointer analysis resolution connected by SVFIR edges (constraints)
@@ -330,6 +331,12 @@ public:
330
331
  }
331
332
  //@}
332
333
 
334
+ inline const FunObjVar* getFunObjVar(const CallGraphNode* node) const
335
+ {
336
+ FunToFunObjVarMap::const_iterator it = funToFunObjvarMap.find(node);
337
+ assert(it != funToFunObjvarMap.end() && "this function doesn't have funobjvar");
338
+ return it->second;
339
+ }
333
340
  /// Node and edge statistics
334
341
  //@{
335
342
  inline u32_t getFieldValNodeNum() const
@@ -622,6 +629,7 @@ private:
622
629
  {
623
630
  memToFieldsMap[id].set(id);
624
631
  FunObjVar* funObj = new FunObjVar(id, ti, callGraphNode, type, node);
632
+ funToFunObjvarMap[callGraphNode] = funObj;
625
633
  return addObjNode(funObj);
626
634
  }
627
635
 
@@ -598,7 +598,7 @@ public:
598
598
  virtual const std::string toString() const;
599
599
 
600
600
  /// Get the memory object id
601
- inline SymID getId() const
601
+ inline NodeID getId() const
602
602
  {
603
603
  return id;
604
604
  }
@@ -54,7 +54,6 @@ typedef signed short s16_t;
54
54
 
55
55
  typedef u32_t NodeID;
56
56
  typedef u32_t EdgeID;
57
- typedef unsigned SymID;
58
57
  typedef unsigned CallSiteID;
59
58
  typedef unsigned ThreadID;
60
59
  typedef s64_t APOffset;
@@ -167,7 +167,6 @@ typedef OrderedSet<PointsTo, equalPointsTo> PointsToList;
167
167
  void dumpPointsToList(const PointsToList& ptl);
168
168
 
169
169
  /// Return true if it is an llvm intrinsic instruction
170
- bool isIntrinsicInst(const SVFInstruction* inst);
171
170
  bool isIntrinsicInst(const ICFGNode* inst);
172
171
  //@}
173
172
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svf-lib",
3
- "version": "1.0.2199",
3
+ "version": "1.0.2200",
4
4
  "description": "SVF's npm support",
5
5
  "main": "index.js",
6
6
  "scripts": {