svf-lib 1.0.2533 → 1.0.2534

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
@@ -42,6 +42,8 @@
42
42
  #include <llvm/IR/DerivedTypes.h>
43
43
  #include <llvm/IR/Statepoint.h>
44
44
  #include <llvm/IR/Intrinsics.h>
45
+ #include <llvm/IR/InlineAsm.h>
46
+ #include <llvm/IR/Constants.h>
45
47
 
46
48
  #include <llvm/Analysis/MemoryLocation.h>
47
49
  #include <llvm/Analysis/DominanceFrontier.h>
@@ -127,6 +129,9 @@ typedef llvm::Constant Constant;
127
129
  typedef llvm::ConstantInt ConstantInt;
128
130
  typedef llvm::ConstantFP ConstantFP;
129
131
  typedef llvm::ConstantPointerNull ConstantPointerNull;
132
+ typedef llvm::InlineAsm InlineAsm;
133
+ typedef llvm::DSOLocalEquivalent DSOLocalEquivalent;
134
+ typedef llvm::NoCFIValue NoCFIValue;
130
135
  typedef llvm::GlobalAlias GlobalAlias;
131
136
  typedef llvm::GlobalIFunc GlobalIFunc;
132
137
  typedef llvm::GlobalVariable GlobalVariable;
@@ -837,6 +837,18 @@ private:
837
837
  {
838
838
  return addDummyValNode(getBlkPtr(), nullptr);
839
839
  }
840
+ inline NodeID addIntrinsicValNode(NodeID i, const SVFType* type)
841
+ {
842
+ return addValNode(new IntrinsicValVar(i, type));
843
+ }
844
+ inline NodeID addBasicBlockValNode(NodeID i, const SVFType* type)
845
+ {
846
+ return addValNode(new BasicBlockValVar(i, type));
847
+ }
848
+ inline NodeID addAsmPCValNode(NodeID i, const SVFType* type)
849
+ {
850
+ return addValNode(new AsmPCValVar(i, type));
851
+ }
840
852
  //@}
841
853
 
842
854
  /// Add a value (pointer) node
@@ -80,6 +80,9 @@ public:
80
80
  ConstNullptrValNode, // │ └── Represents a constant nullptr value node
81
81
  // │ └─ Subclass: DummyValVar
82
82
  DummyValNode, // │ └── Dummy node for uninitialized values
83
+ IntrinsicValNode, // │ └── LLVM intrinsic call instruction (e.g. llvm.dbg.declare)
84
+ BasicBlockValNode, // │ └── LLVM BasicBlock (label operand of br/switch)
85
+ AsmPCValNode, // │ └── InlineAsm, DSOLocalEquivalent, NoCFIValue
83
86
 
84
87
  // └─ Subclass: ObjVar (Object variable nodes)
85
88
  ObjNode, // ├── Represents an object variable
@@ -230,7 +233,7 @@ protected:
230
233
 
231
234
  static inline bool isSVFVarKind(GNodeK n)
232
235
  {
233
- static_assert(DummyObjNode - ValNode == 26,
236
+ static_assert(DummyObjNode - ValNode == 29,
234
237
  "The number of SVFVarKinds has changed, make sure the "
235
238
  "range is correct");
236
239
 
@@ -239,10 +242,10 @@ protected:
239
242
 
240
243
  static inline bool isValVarKinds(GNodeK n)
241
244
  {
242
- static_assert(DummyValNode - ValNode == 13,
245
+ static_assert(AsmPCValNode - ValNode == 16,
243
246
  "The number of ValVarKinds has changed, make sure the "
244
247
  "range is correct");
245
- return n <= DummyValNode && n >= ValNode;
248
+ return n <= AsmPCValNode && n >= ValNode;
246
249
  }
247
250
 
248
251
 
@@ -283,10 +283,7 @@ public:
283
283
  //@}
284
284
 
285
285
  /// Constructor
286
- ValVar(NodeID i, const SVFType* svfType, const ICFGNode* node, PNODEK ty = ValNode)
287
- : SVFVar(i, svfType, ty), icfgNode(node)
288
- {
289
- }
286
+ ValVar(NodeID i, const SVFType* svfType, const ICFGNode* node, PNODEK ty = ValNode);
290
287
  /// Return name of a LLVM value
291
288
  inline const std::string getValueName() const
292
289
  {
@@ -2111,6 +2108,8 @@ public:
2111
2108
  VarArgValPN(NodeID i, const FunObjVar* node, const SVFType* svfType, const ICFGNode* icn)
2112
2109
  : ValVar(i, svfType, icn, VarargValNode), callGraphNode(node)
2113
2110
  {
2111
+ assert((node->isDeclaration() || icn) &&
2112
+ "VarArgValPN of a defined function must have a valid ICFGNode");
2114
2113
  }
2115
2114
 
2116
2115
  virtual const FunObjVar* getFunction() const;
@@ -2176,6 +2175,133 @@ public:
2176
2175
  virtual const std::string toString() const;
2177
2176
  };
2178
2177
 
2178
+ /*
2179
+ * Represents an LLVM intrinsic call instruction (e.g. llvm.dbg.declare).
2180
+ * These are collected into valSyms but have no corresponding ICFGNode.
2181
+ */
2182
+ class IntrinsicValVar: public ValVar
2183
+ {
2184
+ friend class GraphDBClient;
2185
+
2186
+ public:
2187
+ //@{ Methods for support type inquiry through isa, cast, and dyn_cast:
2188
+ static inline bool classof(const IntrinsicValVar*)
2189
+ {
2190
+ return true;
2191
+ }
2192
+ static inline bool classof(const SVFVar* node)
2193
+ {
2194
+ return node->getNodeKind() == SVFVar::IntrinsicValNode;
2195
+ }
2196
+ static inline bool classof(const ValVar* node)
2197
+ {
2198
+ return node->getNodeKind() == SVFVar::IntrinsicValNode;
2199
+ }
2200
+ static inline bool classof(const GenericPAGNodeTy* node)
2201
+ {
2202
+ return node->getNodeKind() == SVFVar::IntrinsicValNode;
2203
+ }
2204
+ static inline bool classof(const SVFValue* node)
2205
+ {
2206
+ return node->getNodeKind() == SVFVar::IntrinsicValNode;
2207
+ }
2208
+ //@}
2209
+
2210
+ IntrinsicValVar(NodeID i, const SVFType* svfType)
2211
+ : ValVar(i, svfType, nullptr, IntrinsicValNode)
2212
+ {
2213
+ }
2214
+
2215
+ inline const std::string getValueName() const
2216
+ {
2217
+ return "intrinsicVal";
2218
+ }
2219
+
2220
+ virtual const std::string toString() const;
2221
+ };
2222
+
2223
+ /*
2224
+ * Represents an LLVM BasicBlock (label operand of br/switch).
2225
+ * Collected into valSyms as a branch operand but has no ICFGNode.
2226
+ */
2227
+ class BasicBlockValVar: public ValVar
2228
+ {
2229
+ friend class GraphDBClient;
2230
+
2231
+ public:
2232
+ static inline bool classof(const BasicBlockValVar*)
2233
+ {
2234
+ return true;
2235
+ }
2236
+ static inline bool classof(const SVFVar* node)
2237
+ {
2238
+ return node->getNodeKind() == SVFVar::BasicBlockValNode;
2239
+ }
2240
+ static inline bool classof(const ValVar* node)
2241
+ {
2242
+ return node->getNodeKind() == SVFVar::BasicBlockValNode;
2243
+ }
2244
+ static inline bool classof(const GenericPAGNodeTy* node)
2245
+ {
2246
+ return node->getNodeKind() == SVFVar::BasicBlockValNode;
2247
+ }
2248
+ static inline bool classof(const SVFValue* node)
2249
+ {
2250
+ return node->getNodeKind() == SVFVar::BasicBlockValNode;
2251
+ }
2252
+
2253
+ BasicBlockValVar(NodeID i, const SVFType* svfType)
2254
+ : ValVar(i, svfType, nullptr, BasicBlockValNode) {}
2255
+
2256
+ inline const std::string getValueName() const
2257
+ {
2258
+ return "basicBlockVal";
2259
+ }
2260
+ virtual const std::string toString() const;
2261
+ };
2262
+
2263
+ /*
2264
+ * Represents InlineAsm, DSOLocalEquivalent, and NoCFIValue.
2265
+ * These are non-instruction values related to inline assembly,
2266
+ * position-independent code (PIC), or control-flow integrity (CFI).
2267
+ * They have no corresponding ICFGNode.
2268
+ */
2269
+ class AsmPCValVar: public ValVar
2270
+ {
2271
+ friend class GraphDBClient;
2272
+
2273
+ public:
2274
+ static inline bool classof(const AsmPCValVar*)
2275
+ {
2276
+ return true;
2277
+ }
2278
+ static inline bool classof(const SVFVar* node)
2279
+ {
2280
+ return node->getNodeKind() == SVFVar::AsmPCValNode;
2281
+ }
2282
+ static inline bool classof(const ValVar* node)
2283
+ {
2284
+ return node->getNodeKind() == SVFVar::AsmPCValNode;
2285
+ }
2286
+ static inline bool classof(const GenericPAGNodeTy* node)
2287
+ {
2288
+ return node->getNodeKind() == SVFVar::AsmPCValNode;
2289
+ }
2290
+ static inline bool classof(const SVFValue* node)
2291
+ {
2292
+ return node->getNodeKind() == SVFVar::AsmPCValNode;
2293
+ }
2294
+
2295
+ AsmPCValVar(NodeID i, const SVFType* svfType)
2296
+ : ValVar(i, svfType, nullptr, AsmPCValNode) {}
2297
+
2298
+ inline const std::string getValueName() const
2299
+ {
2300
+ return "asmPCVal";
2301
+ }
2302
+ virtual const std::string toString() const;
2303
+ };
2304
+
2179
2305
  /*
2180
2306
  * Dummy object variable
2181
2307
  */
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svf-lib",
3
- "version": "1.0.2533",
3
+ "version": "1.0.2534",
4
4
  "description": "SVF's npm support",
5
5
  "main": "index.js",
6
6
  "scripts": {