svf-lib 1.0.2676 → 1.0.2678

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.
Files changed (59) hide show
  1. package/SVF-linux-aarch64/bin/mta +0 -0
  2. package/SVF-linux-aarch64/bin/svf-ex +0 -0
  3. package/SVF-linux-aarch64/include/Graphs/CallGraph.h +18 -0
  4. package/SVF-linux-aarch64/include/Graphs/DOTGraphTraits.h +33 -20
  5. package/SVF-linux-aarch64/include/Graphs/GraphPrinter.h +1 -1
  6. package/SVF-linux-aarch64/include/Graphs/GraphWriter.h +6 -7
  7. package/SVF-linux-aarch64/include/Graphs/ICFG.h +40 -0
  8. package/SVF-linux-aarch64/include/Graphs/SVFG.h +8 -0
  9. package/SVF-linux-aarch64/include/Graphs/SlicedGraphs.h +1801 -0
  10. package/SVF-linux-aarch64/include/Graphs/ThreadCallGraph.h +13 -4
  11. package/SVF-linux-aarch64/include/MSSA/MemRegion.h +17 -0
  12. package/SVF-linux-aarch64/include/MSSA/MemSSA.h +7 -5
  13. package/SVF-linux-aarch64/include/MSSA/SVFGBuilder.h +6 -0
  14. package/SVF-linux-aarch64/include/MTA/FSMPTA.h +91 -0
  15. package/SVF-linux-aarch64/include/MTA/LockAnalysis.h +40 -25
  16. package/SVF-linux-aarch64/include/MTA/MHP.h +54 -21
  17. package/SVF-linux-aarch64/include/MTA/MTA.h +186 -3
  18. package/SVF-linux-aarch64/include/MTA/MTASVFGBuilder.h +176 -0
  19. package/SVF-linux-aarch64/include/MTA/MTASlicer.h +275 -0
  20. package/SVF-linux-aarch64/include/MTA/MTAStat.h +0 -2
  21. package/SVF-linux-aarch64/include/MTA/TCT.h +70 -29
  22. package/SVF-linux-aarch64/include/Util/CommandLine.h +5 -0
  23. package/SVF-linux-aarch64/include/Util/CxtStmt.h +29 -19
  24. package/SVF-linux-aarch64/include/Util/Options.h +12 -6
  25. package/SVF-linux-aarch64/include/Util/ThreadAPI.h +12 -0
  26. package/SVF-linux-aarch64/lib/cmake/SVF/SVFTargets.cmake +1 -1
  27. package/SVF-linux-aarch64/lib/libSvfCore.so.3.4 +0 -0
  28. package/SVF-linux-x86_64/bin/ae +0 -0
  29. package/SVF-linux-x86_64/bin/cfl +0 -0
  30. package/SVF-linux-x86_64/bin/dvf +0 -0
  31. package/SVF-linux-x86_64/bin/mta +0 -0
  32. package/SVF-linux-x86_64/bin/saber +0 -0
  33. package/SVF-linux-x86_64/bin/svf-ex +0 -0
  34. package/SVF-linux-x86_64/include/Graphs/CallGraph.h +18 -0
  35. package/SVF-linux-x86_64/include/Graphs/DOTGraphTraits.h +33 -20
  36. package/SVF-linux-x86_64/include/Graphs/GraphPrinter.h +1 -1
  37. package/SVF-linux-x86_64/include/Graphs/GraphWriter.h +6 -7
  38. package/SVF-linux-x86_64/include/Graphs/ICFG.h +40 -0
  39. package/SVF-linux-x86_64/include/Graphs/SVFG.h +8 -0
  40. package/SVF-linux-x86_64/include/Graphs/SlicedGraphs.h +1801 -0
  41. package/SVF-linux-x86_64/include/Graphs/ThreadCallGraph.h +13 -4
  42. package/SVF-linux-x86_64/include/MSSA/MemRegion.h +17 -0
  43. package/SVF-linux-x86_64/include/MSSA/MemSSA.h +7 -5
  44. package/SVF-linux-x86_64/include/MSSA/SVFGBuilder.h +6 -0
  45. package/SVF-linux-x86_64/include/MTA/FSMPTA.h +91 -0
  46. package/SVF-linux-x86_64/include/MTA/LockAnalysis.h +40 -25
  47. package/SVF-linux-x86_64/include/MTA/MHP.h +54 -21
  48. package/SVF-linux-x86_64/include/MTA/MTA.h +186 -3
  49. package/SVF-linux-x86_64/include/MTA/MTASVFGBuilder.h +176 -0
  50. package/SVF-linux-x86_64/include/MTA/MTASlicer.h +275 -0
  51. package/SVF-linux-x86_64/include/MTA/MTAStat.h +0 -2
  52. package/SVF-linux-x86_64/include/MTA/TCT.h +70 -29
  53. package/SVF-linux-x86_64/include/Util/CommandLine.h +5 -0
  54. package/SVF-linux-x86_64/include/Util/CxtStmt.h +29 -19
  55. package/SVF-linux-x86_64/include/Util/Options.h +12 -6
  56. package/SVF-linux-x86_64/include/Util/ThreadAPI.h +12 -0
  57. package/SVF-linux-x86_64/lib/cmake/SVF/SVFTargets.cmake +1 -1
  58. package/SVF-linux-x86_64/lib/libSvfCore.so.3.4 +0 -0
  59. package/package.json +1 -1
Binary file
Binary file
@@ -502,6 +502,24 @@ struct GenericGraphTraits<Inverse<SVF::CallGraphNode*> > : public GenericGraphTr
502
502
  template<> struct GenericGraphTraits<SVF::CallGraph*> : public GenericGraphTraits<SVF::GenericGraph<SVF::CallGraphNode,SVF::CallGraphEdge>* >
503
503
  {
504
504
  typedef SVF::CallGraphNode*NodeRef;
505
+
506
+ // Graph-intrinsic queries shared with the sliced-view specialisation
507
+ // (GenericGraphTraits<const SlicedThreadCallGraphView*>).
508
+ //@{
509
+ /// In-edges of n under this graph (whole CallGraph: all of them).
510
+ static void getInEdges(const SVF::CallGraph*, const SVF::CallGraphNode* n,
511
+ std::vector<const SVF::CallGraphEdge*>& out)
512
+ {
513
+ out.clear();
514
+ for (SVF::CallGraphEdge* e : n->getInEdges())
515
+ out.push_back(e);
516
+ }
517
+ /// The CallGraph object whose nodes an analysis over this graph scans.
518
+ static const SVF::CallGraph* getCallGraph(const SVF::CallGraph* g)
519
+ {
520
+ return g;
521
+ }
522
+ //@}
505
523
  };
506
524
 
507
525
  } // End namespace llvm
@@ -66,18 +66,29 @@ public:
66
66
  return false;
67
67
  }
68
68
 
69
+ /// getNodeIdentifier - The value written after "Node" as the dot node id.
70
+ /// Defaults to the node reference reinterpreted as an address, which works
71
+ /// for pointer NodeRefs; value NodeRefs (e.g. sliced views) override this to
72
+ /// return a stable per-node address. (Node params below are templated so the
73
+ /// defaults accept any NodeRef, pointer or value.)
74
+ template <typename NodeT>
75
+ static const void *getNodeIdentifier(NodeT N)
76
+ {
77
+ return static_cast<const void *>(N);
78
+ }
79
+
69
80
  /// isNodeHidden - If the function returns true, the given node is not
70
81
  /// displayed in the graph.
71
- template <typename GraphType>
72
- static bool isNodeHidden(const void *, const GraphType &)
82
+ template <typename NodeT, typename GraphType>
83
+ static bool isNodeHidden(NodeT, const GraphType &)
73
84
  {
74
85
  return false;
75
86
  }
76
87
 
77
88
  /// getNodeLabel - Given a node and a pointer to the top level graph, return
78
89
  /// the label to print in the node.
79
- template<typename GraphType>
80
- std::string getNodeLabel(const void *, const GraphType &)
90
+ template<typename NodeT, typename GraphType>
91
+ std::string getNodeLabel(NodeT, const GraphType &)
81
92
  {
82
93
  return "";
83
94
  }
@@ -85,22 +96,22 @@ public:
85
96
  // getNodeIdentifierLabel - Returns a string representing the
86
97
  // address or other unique identifier of the node. (Only used if
87
98
  // non-empty.)
88
- template <typename GraphType>
89
- static std::string getNodeIdentifierLabel(const void *, const GraphType &)
99
+ template <typename NodeT, typename GraphType>
100
+ static std::string getNodeIdentifierLabel(NodeT, const GraphType &)
90
101
  {
91
102
  return "";
92
103
  }
93
104
 
94
- template<typename GraphType>
95
- static std::string getNodeDescription(const void *, const GraphType &)
105
+ template<typename NodeT, typename GraphType>
106
+ static std::string getNodeDescription(NodeT, const GraphType &)
96
107
  {
97
108
  return "";
98
109
  }
99
110
 
100
111
  /// If you want to specify custom node attributes, this is the place to do so
101
112
  ///
102
- template<typename GraphType>
103
- static std::string getNodeAttributes(const void *,
113
+ template<typename NodeT, typename GraphType>
114
+ static std::string getNodeAttributes(NodeT,
104
115
  const GraphType &)
105
116
  {
106
117
  return "";
@@ -108,8 +119,8 @@ public:
108
119
 
109
120
  /// If you want to override the dot attributes printed for a particular edge,
110
121
  /// override this method.
111
- template<typename EdgeIter, typename GraphType>
112
- static std::string getEdgeAttributes(const void *, EdgeIter,
122
+ template<typename NodeT, typename EdgeIter, typename GraphType>
123
+ static std::string getEdgeAttributes(NodeT, EdgeIter,
113
124
  const GraphType &)
114
125
  {
115
126
  return "";
@@ -117,8 +128,8 @@ public:
117
128
 
118
129
  /// getEdgeSourceLabel - If you want to label the edge source itself,
119
130
  /// implement this method.
120
- template<typename EdgeIter>
121
- static std::string getEdgeSourceLabel(const void *, EdgeIter)
131
+ template<typename NodeT, typename EdgeIter>
132
+ static std::string getEdgeSourceLabel(NodeT, EdgeIter)
122
133
  {
123
134
  return "";
124
135
  }
@@ -126,8 +137,8 @@ public:
126
137
  /// edgeTargetsEdgeSource - This method returns true if this outgoing edge
127
138
  /// should actually target another edge source, not a node. If this method is
128
139
  /// implemented, getEdgeTarget should be implemented.
129
- template<typename EdgeIter>
130
- static bool edgeTargetsEdgeSource(const void *, EdgeIter)
140
+ template<typename NodeT, typename EdgeIter>
141
+ static bool edgeTargetsEdgeSource(NodeT, EdgeIter)
131
142
  {
132
143
  return false;
133
144
  }
@@ -135,8 +146,8 @@ public:
135
146
  /// getEdgeTarget - If edgeTargetsEdgeSource returns true, this method is
136
147
  /// called to determine which outgoing edge of Node is the target of this
137
148
  /// edge.
138
- template<typename EdgeIter>
139
- static EdgeIter getEdgeTarget(const void *, EdgeIter I)
149
+ template<typename NodeT, typename EdgeIter>
150
+ static EdgeIter getEdgeTarget(NodeT, EdgeIter I)
140
151
  {
141
152
  return I;
142
153
  }
@@ -150,14 +161,16 @@ public:
150
161
 
151
162
  /// numEdgeDestLabels - If hasEdgeDestLabels, this function returns the
152
163
  /// number of incoming edge labels the given node has.
153
- static unsigned numEdgeDestLabels(const void *)
164
+ template<typename NodeT>
165
+ static unsigned numEdgeDestLabels(NodeT)
154
166
  {
155
167
  return 0;
156
168
  }
157
169
 
158
170
  /// getEdgeDestLabel - If hasEdgeDestLabels, this function returns the
159
171
  /// incoming edge label with the given index in the given node.
160
- static std::string getEdgeDestLabel(const void *, unsigned)
172
+ template<typename NodeT>
173
+ static std::string getEdgeDestLabel(NodeT, unsigned)
161
174
  {
162
175
  return "";
163
176
  }
@@ -92,7 +92,7 @@ public:
92
92
  node_iterator E = GTraits::nodes_end(GT);
93
93
  for (; I != E; ++I)
94
94
  {
95
- NodeRef *Node = *I;
95
+ NodeRef Node = *I;
96
96
  O << "node :" << Node << "'\n";
97
97
  child_iterator EI = GTraits::child_begin(Node);
98
98
  child_iterator EE = GTraits::child_end(Node);
@@ -72,10 +72,9 @@ class GraphWriter
72
72
  using child_iterator = typename GTraits::ChildIteratorType;
73
73
  DOTTraits DTraits;
74
74
 
75
- static_assert(std::is_pointer<NodeRef>::value,
76
- "FIXME: Currently GraphWriter requires the NodeRef type to be "
77
- "a pointer.\nThe pointer usage should be moved to "
78
- "DOTGraphTraits, and removed from GraphWriter itself.");
75
+ // NodeRef may be a pointer or a value type (e.g. a sliced-view contextual
76
+ // NodeRef). Node identity for the dot output is obtained from
77
+ // DOTGraphTraits::getNodeIdentifier (defaults to the pointer value).
79
78
 
80
79
  // Writes the edge labels of the node to O and returns true if there are any
81
80
  // edge labels not equal to the empty string "".
@@ -172,7 +171,7 @@ public:
172
171
  {
173
172
  std::string NodeAttributes = DTraits.getNodeAttributes(Node, G);
174
173
 
175
- O << "\tNode" << static_cast<const void*>(Node) << " [";
174
+ O << "\tNode" << DTraits.getNodeIdentifier(Node) << " [";
176
175
  if (!NodeAttributes.empty()) O << NodeAttributes << ",";
177
176
  O << "label=\"{";
178
177
 
@@ -271,8 +270,8 @@ public:
271
270
  if (DTraits.getEdgeSourceLabel(Node, EI).empty())
272
271
  edgeidx = -1;
273
272
 
274
- emitEdge(static_cast<const void*>(Node), edgeidx,
275
- static_cast<const void*>(TargetNode), DestPort,
273
+ emitEdge(DTraits.getNodeIdentifier(Node), edgeidx,
274
+ DTraits.getNodeIdentifier(TargetNode), DestPort,
276
275
  DTraits.getEdgeAttributes(Node, EI, G));
277
276
  }
278
277
  }
@@ -299,6 +299,46 @@ struct GenericGraphTraits<Inverse<SVF::ICFGNode *> > : public GenericGraphTraits
299
299
  template<> struct GenericGraphTraits<SVF::ICFG*> : public GenericGraphTraits<SVF::GenericGraph<SVF::ICFGNode,SVF::ICFGEdge>* >
300
300
  {
301
301
  typedef SVF::ICFGNode *NodeRef;
302
+
303
+ // Graph-intrinsic queries shared with the sliced-view specialisation
304
+ // (GenericGraphTraits<const SlicedICFGView*>), so a graph-parameterised
305
+ // analysis resolves the right behaviour from the graph type alone.
306
+ //@{
307
+ /// Entry node of fun under this graph (whole ICFG: the entry block's front).
308
+ static const SVF::ICFGNode* getFunEntry(SVF::ICFG*, const SVF::FunObjVar* fun)
309
+ {
310
+ return fun->getEntryBlock()->front();
311
+ }
312
+ /// Nodes of fun contained in this graph (whole ICFG: all of them).
313
+ static void getFunICFGNodes(SVF::ICFG*, const SVF::FunObjVar* fun,
314
+ std::vector<const SVF::ICFGNode*>& out)
315
+ {
316
+ out.clear();
317
+ for (auto it : *fun)
318
+ for (const SVF::ICFGNode* n : it.second->getICFGNodeList())
319
+ out.push_back(n);
320
+ }
321
+ /// Successors / predecessors of n under this graph.
322
+ static void getSuccNodes(SVF::ICFG*, const SVF::ICFGNode* n,
323
+ std::vector<const SVF::ICFGNode*>& out)
324
+ {
325
+ out.clear();
326
+ for (const SVF::ICFGEdge* e : n->getOutEdges())
327
+ out.push_back(e->getDstNode());
328
+ }
329
+ static void getPredNodes(SVF::ICFG*, const SVF::ICFGNode* n,
330
+ std::vector<const SVF::ICFGNode*>& out)
331
+ {
332
+ out.clear();
333
+ for (const SVF::ICFGEdge* e : n->getInEdges())
334
+ out.push_back(e->getSrcNode());
335
+ }
336
+ /// Whether n belongs to this graph (whole ICFG contains every node).
337
+ static bool containsNode(SVF::ICFG*, const SVF::ICFGNode*)
338
+ {
339
+ return true;
340
+ }
341
+ //@}
302
342
  };
303
343
 
304
344
  } // End namespace llvm
@@ -500,6 +500,14 @@ namespace SVF
500
500
  template<> struct GenericGraphTraits<SVF::SVFG*> : public GenericGraphTraits<SVF::GenericGraph<SVF::SVFGNode,SVF::SVFGEdge>* >
501
501
  {
502
502
  typedef SVF::SVFGNode *NodeRef;
503
+
504
+ /// Whether n belongs to this graph (the whole SVFG contains every node).
505
+ /// Mirrored by GenericGraphTraits<const SlicedSVFGView*>, so a solver
506
+ /// templated on the graph type restricts itself to the graph's nodes.
507
+ static bool containsNode(SVF::SVFG*, const SVF::SVFGNode*)
508
+ {
509
+ return true;
510
+ }
503
511
  };
504
512
 
505
513
  } // End namespace llvm