svf-lib 1.0.733 → 1.0.737

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/Release-build/lib/libSvf.a +0 -0
  2. package/SVF-linux/include/DDA/ContextDDA.h +1 -1
  3. package/SVF-linux/include/DDA/DDAClient.h +8 -8
  4. package/SVF-linux/include/DDA/DDAVFSolver.h +5 -5
  5. package/SVF-linux/include/DDA/FlowDDA.h +1 -1
  6. package/SVF-linux/include/Graphs/CHG.h +351 -0
  7. package/SVF-linux/include/Graphs/ConsG.h +6 -6
  8. package/SVF-linux/include/Graphs/ConsGEdge.h +2 -2
  9. package/SVF-linux/include/Graphs/ConsGNode.h +1 -1
  10. package/SVF-linux/include/Graphs/ExternalPAG.h +14 -14
  11. package/SVF-linux/include/Graphs/GenericGraph.h +1 -1
  12. package/SVF-linux/include/Graphs/ICFGNode.h +14 -14
  13. package/SVF-linux/include/Graphs/IRGraph.h +236 -0
  14. package/SVF-linux/include/Graphs/OfflineConsG.h +1 -1
  15. package/SVF-linux/include/Graphs/SVFG.h +1 -1
  16. package/SVF-linux/include/Graphs/SVFGOPT.h +3 -3
  17. package/SVF-linux/include/Graphs/VFG.h +53 -52
  18. package/SVF-linux/include/Graphs/VFGNode.h +60 -8
  19. package/SVF-linux/include/MSSA/MemRegion.h +11 -11
  20. package/SVF-linux/include/MSSA/MemSSA.h +4 -4
  21. package/SVF-linux/include/MTA/FSMPTA.h +1 -1
  22. package/SVF-linux/include/MemoryModel/PAGBuilderFromFile.h +8 -8
  23. package/SVF-linux/include/MemoryModel/PTAStat.h +31 -31
  24. package/SVF-linux/include/MemoryModel/PointerAnalysis.h +9 -9
  25. package/SVF-linux/include/MemoryModel/PointerAnalysisImpl.h +3 -3
  26. package/SVF-linux/include/MemoryModel/SVFIR.h +525 -233
  27. package/SVF-linux/include/MemoryModel/SVFStatements.h +970 -0
  28. package/SVF-linux/include/MemoryModel/SVFVariables.h +842 -0
  29. package/SVF-linux/include/MemoryModel/SymbolTableInfo.h +346 -55
  30. package/SVF-linux/include/SABER/SaberSVFGBuilder.h +0 -2
  31. package/SVF-linux/include/SABER/SrcSnkDDA.h +3 -3
  32. package/SVF-linux/include/SVF-FE/CHGBuilder.h +69 -0
  33. package/SVF-linux/include/SVF-FE/DCHG.h +1 -1
  34. package/SVF-linux/include/SVF-FE/Graph2Json.h +1 -3
  35. package/SVF-linux/include/SVF-FE/SVFIRBuilder.h +405 -0
  36. package/SVF-linux/include/SVF-FE/SymbolTableBuilder.h +0 -1
  37. package/SVF-linux/include/Util/CFLSolver.h +1 -1
  38. package/SVF-linux/include/Util/ExtAPI.h +1 -1
  39. package/SVF-linux/include/Util/IRAnnotator.h +6 -6
  40. package/SVF-linux/include/Util/Options.h +1 -1
  41. package/SVF-linux/include/Util/TypeBasedHeapCloning.h +11 -11
  42. package/SVF-linux/include/WPA/Andersen.h +11 -11
  43. package/SVF-linux/include/WPA/AndersenSFR.h +4 -4
  44. package/SVF-linux/include/WPA/FlowSensitive.h +2 -2
  45. package/SVF-linux/include/WPA/FlowSensitiveTBHC.h +1 -1
  46. package/SVF-linux/include/WPA/Steensgaard.h +2 -2
  47. package/SVF-linux/include/WPA/TypeAnalysis.h +1 -1
  48. package/SVF-linux/include/WPA/VersionedFlowSensitive.h +2 -2
  49. package/SVF-linux/include/WPA/WPAStat.h +1 -2
  50. package/SVF-osx/Release-build/lib/CUDD/libCudd.a +0 -0
  51. package/SVF-osx/Release-build/lib/libSvf.a +0 -0
  52. package/SVF-osx/include/Graphs/GenericGraph.h +1 -1
  53. package/SVF-osx/include/Graphs/IRGraph.h +6 -15
  54. package/SVF-osx/include/Graphs/VFG.h +26 -41
  55. package/SVF-osx/include/Graphs/VFGNode.h +2 -2
  56. package/SVF-osx/include/MemoryModel/SVFIR.h +29 -96
  57. package/SVF-osx/include/MemoryModel/SVFStatements.h +156 -22
  58. package/SVF-osx/include/SVF-FE/SVFIRBuilder.h +12 -6
  59. package/package.json +1 -1
@@ -28,7 +28,7 @@ class ContextDDA : public CondPTAImpl<ContextCond>, public DDAVFSolver<CxtVar,Cx
28
28
 
29
29
  public:
30
30
  /// Constructor
31
- ContextDDA(PAG* _pag, DDAClient* client);
31
+ ContextDDA(SVFIR* _pag, DDAClient* client);
32
32
 
33
33
  /// Destructor
34
34
  virtual ~ContextDDA();
@@ -11,7 +11,7 @@
11
11
  #ifndef DDACLIENT_H_
12
12
  #define DDACLIENT_H_
13
13
 
14
- #include "Graphs/PAG.h"
14
+ #include "MemoryModel/SVFIR.h"
15
15
  #include "MemoryModel/PointerAnalysisImpl.h"
16
16
  #include "Graphs/SVFG.h"
17
17
  #include "Util/BasicTypes.h"
@@ -32,7 +32,7 @@ public:
32
32
  virtual inline void initialise(SVFModule*) {}
33
33
 
34
34
  /// Collect candidate pointers for query.
35
- virtual inline OrderedNodeSet& collectCandidateQueries(PAG* p)
35
+ virtual inline OrderedNodeSet& collectCandidateQueries(SVFIR* p)
36
36
  {
37
37
  setPAG(p);
38
38
  if (solveAll)
@@ -52,8 +52,8 @@ public:
52
52
 
53
53
  /// Call back used by DDAVFSolver.
54
54
  virtual inline void handleStatement(const SVFGNode*, NodeID) {}
55
- /// Set PAG graph.
56
- inline void setPAG(PAG* g)
55
+ /// Set SVFIR graph.
56
+ inline void setPAG(SVFIR* g)
57
57
  {
58
58
  pag = g;
59
59
  }
@@ -81,11 +81,11 @@ public:
81
81
  protected:
82
82
  void addCandidate(NodeID id)
83
83
  {
84
- if (pag->isValidTopLevelPtr(pag->getPAGNode(id)))
84
+ if (pag->isValidTopLevelPtr(pag->getGNode(id)))
85
85
  candidateQueries.insert(id);
86
86
  }
87
87
 
88
- PAG* pag; ///< PAG graph used by current DDA analysis
88
+ SVFIR* pag; ///< SVFIR graph used by current DDA analysis
89
89
  SVFModule* module; ///< LLVM module
90
90
  NodeID curPtr; ///< current pointer being queried
91
91
  OrderedNodeSet candidateQueries; ///< store all candidate pointers to be queried
@@ -109,7 +109,7 @@ public:
109
109
  ~FunptrDDAClient() {}
110
110
 
111
111
  /// Only collect function pointers as query candidates.
112
- virtual OrderedNodeSet& collectCandidateQueries(PAG* p);
112
+ virtual OrderedNodeSet& collectCandidateQueries(SVFIR* p);
113
113
  virtual void performStat(PointerAnalysis* pta);
114
114
  };
115
115
 
@@ -128,7 +128,7 @@ public:
128
128
  ~AliasDDAClient() {}
129
129
 
130
130
  /// Only collect function pointers as query candidates.
131
- virtual OrderedNodeSet& collectCandidateQueries(PAG* pag);
131
+ virtual OrderedNodeSet& collectCandidateQueries(SVFIR* pag);
132
132
 
133
133
  virtual void performStat(PointerAnalysis* pta);
134
134
 
@@ -29,7 +29,7 @@ public:
29
29
  typedef SCCDetection<SVFG*> SVFGSCC;
30
30
  typedef SCCDetection<PTACallGraph*> CallGraphSCC;
31
31
  typedef PTACallGraphEdge::CallInstSet CallInstSet;
32
- typedef PAG::CallSiteSet CallSiteSet;
32
+ typedef SVFIR::CallSiteSet CallSiteSet;
33
33
  typedef OrderedSet<DPIm> DPTItemSet;
34
34
  typedef OrderedMap<DPIm, CPtSet> DPImToCPtSetMap;
35
35
  typedef OrderedMap<DPIm,CVar> DPMToCVarMap;
@@ -287,7 +287,7 @@ protected:
287
287
  }
288
288
 
289
289
  /// Build SVFG
290
- virtual inline void buildSVFG(PAG* pag)
290
+ virtual inline void buildSVFG(SVFIR* pag)
291
291
  {
292
292
  _ander = AndersenWaveDiff::createAndersenWaveDiff(pag);
293
293
  _svfg = svfgBuilder.buildPTROnlySVFGWithoutOPT(_ander);
@@ -473,7 +473,7 @@ protected:
473
473
  {
474
474
  NodeID funPtr = _pag->getFunPtr(cbn);
475
475
  DPIm funPtrDpm(dpm);
476
- funPtrDpm.setLocVar(getSVFG()->getDefSVFGNode(_pag->getPAGNode(funPtr)),funPtr);
476
+ funPtrDpm.setLocVar(getSVFG()->getDefSVFGNode(_pag->getGNode(funPtr)),funPtr);
477
477
  findPT(funPtrDpm);
478
478
  }
479
479
  }
@@ -486,7 +486,7 @@ protected:
486
486
  {
487
487
  NodeID funPtr = _pag->getFunPtr(*it);
488
488
  DPIm funPtrDpm(dpm);
489
- funPtrDpm.setLocVar(getSVFG()->getDefSVFGNode(_pag->getPAGNode(funPtr)),funPtr);
489
+ funPtrDpm.setLocVar(getSVFG()->getDefSVFGNode(_pag->getGNode(funPtr)),funPtr);
490
490
  findPT(funPtrDpm);
491
491
  }
492
492
  }
@@ -750,7 +750,7 @@ protected:
750
750
  }
751
751
 
752
752
  bool outOfBudgetQuery; ///< Whether the current query is out of step limits
753
- PAG* _pag; ///< PAG
753
+ SVFIR* _pag; ///< SVFIR
754
754
  SVFG* _svfg; ///< SVFG
755
755
  AndersenWaveDiff* _ander; ///< Andersen's analysis
756
756
  NodeBS candidateQueries; ///< candidate pointers;
@@ -30,7 +30,7 @@ public:
30
30
  typedef BVDataPTAImpl::CallEdgeMap CallEdgeMap;
31
31
  typedef BVDataPTAImpl::FunctionSet FunctionSet;
32
32
  /// Constructor
33
- FlowDDA(PAG* _pag, DDAClient* client): BVDataPTAImpl(_pag, PointerAnalysis::FlowS_DDA),
33
+ FlowDDA(SVFIR* _pag, DDAClient* client): BVDataPTAImpl(_pag, PointerAnalysis::FlowS_DDA),
34
34
  DDAVFSolver<NodeID,PointsTo,LocDPItem>(),
35
35
  _client(client)
36
36
  {
@@ -0,0 +1,351 @@
1
+ //===----- CHG.h -- Base class of pointer analyses ---------------------------//
2
+ //
3
+ // SVF: Static Value-Flow Analysis
4
+ //
5
+ // Copyright (C) <2013-2017> <Yulei Sui>
6
+ //
7
+
8
+ // This program is free software: you can redistribute it and/or modify
9
+ // it under the terms of the GNU General Public License as published by
10
+ // the Free Software Foundation, either version 3 of the License, or
11
+ // (at your option) any later version.
12
+
13
+ // This program is distributed in the hope that it will be useful,
14
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ // GNU General Public License for more details.
17
+
18
+ // You should have received a copy of the GNU General Public License
19
+ // along with this program. If not, see <http://www.gnu.org/licenses/>.
20
+ //
21
+ //===----------------------------------------------------------------------===//
22
+
23
+ /*
24
+ * CHG.h (previously CHA.h)
25
+ *
26
+ * Created on: Apr 13, 2016
27
+ * Author: Xiaokang Fan
28
+ *
29
+ * Created on: Aug 24, 2019
30
+ * Author: Mohamad Barbar
31
+ */
32
+
33
+ #ifndef CHA_H_
34
+ #define CHA_H_
35
+
36
+ #include "Util/SVFModule.h"
37
+ #include "Graphs/GenericGraph.h"
38
+ #include "Util/WorkList.h"
39
+
40
+ namespace SVF
41
+ {
42
+
43
+ class SVFModule;
44
+ class CHNode;
45
+
46
+ typedef Set<const GlobalValue*> VTableSet;
47
+ typedef Set<const SVFFunction*> VFunSet;
48
+
49
+ /// Common base for class hierarchy graph. Only implements what PointerAnalysis needs.
50
+ class CommonCHGraph
51
+ {
52
+ public:
53
+ virtual ~CommonCHGraph() { };
54
+ enum CHGKind
55
+ {
56
+ Standard,
57
+ DI
58
+ };
59
+
60
+ virtual bool csHasVFnsBasedonCHA(CallSite cs) = 0;
61
+ virtual const VFunSet &getCSVFsBasedonCHA(CallSite cs) = 0;
62
+ virtual bool csHasVtblsBasedonCHA(CallSite cs) = 0;
63
+ virtual const VTableSet &getCSVtblsBasedonCHA(CallSite cs) = 0;
64
+ virtual void getVFnsFromVtbls(CallSite cs, const VTableSet &vtbls, VFunSet &virtualFunctions) = 0;
65
+
66
+ CHGKind getKind(void) const
67
+ {
68
+ return kind;
69
+ }
70
+
71
+ protected:
72
+ CHGKind kind;
73
+ };
74
+
75
+
76
+ typedef GenericEdge<CHNode> GenericCHEdgeTy;
77
+ class CHEdge: public GenericCHEdgeTy
78
+ {
79
+ public:
80
+ typedef enum
81
+ {
82
+ INHERITANCE = 0x1, // inheritance relation
83
+ INSTANTCE = 0x2 // template-instance relation
84
+ } CHEDGETYPE;
85
+
86
+ typedef GenericNode<CHNode,CHEdge>::GEdgeSetTy CHEdgeSetTy;
87
+
88
+ CHEdge(CHNode *s, CHNode *d, CHEDGETYPE et, GEdgeFlag k = 0):
89
+ GenericCHEdgeTy(s,d,k)
90
+ {
91
+ edgeType = et;
92
+ }
93
+
94
+ CHEDGETYPE getEdgeType() const
95
+ {
96
+ return edgeType;
97
+ }
98
+
99
+ private:
100
+ CHEDGETYPE edgeType;
101
+ };
102
+
103
+ typedef GenericNode<CHNode,CHEdge> GenericCHNodeTy;
104
+ class CHNode: public GenericCHNodeTy
105
+ {
106
+ public:
107
+ typedef enum
108
+ {
109
+ PURE_ABSTRACT = 0x1, // pure virtual abstract class
110
+ MULTI_INHERITANCE = 0x2, // multi inheritance class
111
+ TEMPLATE = 0x04 // template class
112
+ } CLASSATTR;
113
+
114
+ typedef std::vector<const SVFFunction*> FuncVector;
115
+
116
+ CHNode (const std::string name, NodeID i = 0, GNodeK k = 0):
117
+ GenericCHNodeTy(i, k), vtable(nullptr), className(name), flags(0)
118
+ {
119
+ }
120
+ ~CHNode()
121
+ {
122
+ }
123
+ std::string getName() const
124
+ {
125
+ return className;
126
+ }
127
+ /// Flags
128
+ //@{
129
+ inline void setFlag(CLASSATTR mask)
130
+ {
131
+ flags |= mask;
132
+ }
133
+ inline bool hasFlag(CLASSATTR mask) const
134
+ {
135
+ return (flags & mask) == mask;
136
+ }
137
+ //@}
138
+
139
+ /// Attribute
140
+ //@{
141
+ inline void setPureAbstract()
142
+ {
143
+ setFlag(PURE_ABSTRACT);
144
+ }
145
+ inline void setMultiInheritance()
146
+ {
147
+ setFlag(MULTI_INHERITANCE);
148
+ }
149
+ inline void setTemplate()
150
+ {
151
+ setFlag(TEMPLATE);
152
+ }
153
+ inline bool isPureAbstract() const
154
+ {
155
+ return hasFlag(PURE_ABSTRACT);
156
+ }
157
+ inline bool isMultiInheritance() const
158
+ {
159
+ return hasFlag(MULTI_INHERITANCE);
160
+ }
161
+ inline bool isTemplate() const
162
+ {
163
+ return hasFlag(TEMPLATE);
164
+ }
165
+ //@}
166
+
167
+ void addVirtualFunctionVector(FuncVector vfuncvec)
168
+ {
169
+ virtualFunctionVectors.push_back(vfuncvec);
170
+ }
171
+ const std::vector<FuncVector> &getVirtualFunctionVectors() const
172
+ {
173
+ return virtualFunctionVectors;
174
+ }
175
+ void getVirtualFunctions(u32_t idx, FuncVector &virtualFunctions) const;
176
+
177
+ const GlobalValue *getVTable() const
178
+ {
179
+ return vtable;
180
+ }
181
+
182
+ void setVTable(const GlobalValue *vtbl)
183
+ {
184
+ vtable = vtbl;
185
+ }
186
+
187
+ private:
188
+ const GlobalValue* vtable;
189
+ std::string className;
190
+ size_t flags;
191
+ /*
192
+ * virtual functions inherited from different classes are separately stored
193
+ * to model different vtables inherited from different fathers.
194
+ *
195
+ * Example:
196
+ * class C: public A, public B
197
+ * vtableC = {Af1, Af2, ..., inttoptr, Bg1, Bg2, ...} ("inttoptr"
198
+ * instruction works as the delimiter for separating virtual functions
199
+ * inherited from different classes)
200
+ *
201
+ * virtualFunctionVectors = {{Af1, Af2, ...}, {Bg1, Bg2, ...}}
202
+ */
203
+ std::vector<FuncVector> virtualFunctionVectors;
204
+ };
205
+
206
+ /// class hierarchy graph
207
+ typedef GenericGraph<CHNode,CHEdge> GenericCHGraphTy;
208
+ class CHGraph: public CommonCHGraph, public GenericCHGraphTy
209
+ {
210
+ friend class CHGBuilder;
211
+
212
+ public:
213
+ typedef Set<const CHNode*> CHNodeSetTy;
214
+ typedef FIFOWorkList<const CHNode*> WorkList;
215
+ typedef Map<std::string, CHNodeSetTy> NameToCHNodesMap;
216
+ typedef Map<CallSite, CHNodeSetTy> CallSiteToCHNodesMap;
217
+ typedef Map<CallSite, VTableSet> CallSiteToVTableSetMap;
218
+ typedef Map<CallSite, VFunSet> CallSiteToVFunSetMap;
219
+
220
+ typedef enum
221
+ {
222
+ CONSTRUCTOR = 0x1, // connect node based on constructor
223
+ DESTRUCTOR = 0x2 // connect node based on destructor
224
+ } RELATIONTYPE;
225
+
226
+ CHGraph(SVFModule* svfModule): svfMod(svfModule), classNum(0), vfID(0), buildingCHGTime(0)
227
+ {
228
+ this->kind = Standard;
229
+ }
230
+ ~CHGraph() override = default;
231
+
232
+ void addEdge(const std::string className,
233
+ const std::string baseClassName,
234
+ CHEdge::CHEDGETYPE edgeType);
235
+ CHNode *getNode(const std::string name) const;
236
+ void getVFnsFromVtbls(CallSite cs, const VTableSet &vtbls, VFunSet &virtualFunctions) override;
237
+ void dump(const std::string& filename);
238
+ void view();
239
+ void printCH();
240
+
241
+ inline s32_t getVirtualFunctionID(const SVFFunction* vfn) const
242
+ {
243
+ Map<const SVFFunction*, s32_t>::const_iterator it =
244
+ virtualFunctionToIDMap.find(vfn);
245
+ if (it != virtualFunctionToIDMap.end())
246
+ return it->second;
247
+ else
248
+ return -1;
249
+ }
250
+ inline const SVFFunction* getVirtualFunctionBasedonID(s32_t id) const
251
+ {
252
+ Map<const SVFFunction*, s32_t>::const_iterator it, eit;
253
+ for (it = virtualFunctionToIDMap.begin(), eit =
254
+ virtualFunctionToIDMap.end(); it != eit; ++it)
255
+ {
256
+ if (it->second == id)
257
+ return it->first;
258
+ }
259
+ return nullptr;
260
+ }
261
+
262
+ inline void addInstances(const std::string templateName, CHNode* node)
263
+ {
264
+ NameToCHNodesMap::iterator it = templateNameToInstancesMap.find(
265
+ templateName);
266
+ if (it != templateNameToInstancesMap.end())
267
+ it->second.insert(node);
268
+ else
269
+ templateNameToInstancesMap[templateName].insert(node);
270
+ }
271
+ inline const CHNodeSetTy &getDescendants(const std::string className)
272
+ {
273
+ return classNameToDescendantsMap[className];
274
+ }
275
+ inline const CHNodeSetTy &getInstances(const std::string className)
276
+ {
277
+ return templateNameToInstancesMap[className];
278
+ }
279
+
280
+ inline bool csHasVtblsBasedonCHA(CallSite cs) override
281
+ {
282
+ CallSiteToVTableSetMap::const_iterator it = csToCHAVtblsMap.find(cs);
283
+ return it != csToCHAVtblsMap.end();
284
+ }
285
+ inline bool csHasVFnsBasedonCHA(CallSite cs) override
286
+ {
287
+ CallSiteToVFunSetMap::const_iterator it = csToCHAVFnsMap.find(cs);
288
+ return it != csToCHAVFnsMap.end();
289
+ }
290
+ inline const VTableSet &getCSVtblsBasedonCHA(CallSite cs) override
291
+ {
292
+ CallSiteToVTableSetMap::const_iterator it = csToCHAVtblsMap.find(cs);
293
+ assert(it != csToCHAVtblsMap.end() && "cs does not have vtabls based on CHA.");
294
+ return it->second;
295
+ }
296
+ inline const VFunSet &getCSVFsBasedonCHA(CallSite cs) override
297
+ {
298
+ CallSiteToVFunSetMap::const_iterator it = csToCHAVFnsMap.find(cs);
299
+ assert(it != csToCHAVFnsMap.end() && "cs does not have vfns based on CHA.");
300
+ return it->second;
301
+ }
302
+
303
+ static inline bool classof(const CommonCHGraph *chg)
304
+ {
305
+ return chg->getKind() == Standard;
306
+ }
307
+
308
+
309
+ private:
310
+ SVFModule* svfMod;
311
+ u32_t classNum;
312
+ s32_t vfID;
313
+ double buildingCHGTime;
314
+ Map<std::string, CHNode *> classNameToNodeMap;
315
+ NameToCHNodesMap classNameToDescendantsMap;
316
+ NameToCHNodesMap classNameToAncestorsMap;
317
+ NameToCHNodesMap classNameToInstAndDescsMap;
318
+ NameToCHNodesMap templateNameToInstancesMap;
319
+ CallSiteToCHNodesMap csToClassesMap;
320
+
321
+ Map<const SVFFunction*, s32_t> virtualFunctionToIDMap;
322
+ CallSiteToVTableSetMap csToCHAVtblsMap;
323
+ CallSiteToVFunSetMap csToCHAVFnsMap;
324
+ };
325
+
326
+ } // End namespace SVF
327
+
328
+ namespace llvm
329
+ {
330
+ /* !
331
+ * GraphTraits specializations for generic graph algorithms.
332
+ * Provide graph traits for traversing from a constraint node using standard graph traversals.
333
+ */
334
+ template<> struct GraphTraits<SVF::CHNode*> : public GraphTraits<SVF::GenericNode<SVF::CHNode,SVF::CHEdge>* >
335
+ {
336
+ };
337
+
338
+ /// Inverse GraphTraits specializations for call graph node, it is used for inverse traversal.
339
+ template<>
340
+ struct GraphTraits<Inverse<SVF::CHNode*> > : public GraphTraits<Inverse<SVF::GenericNode<SVF::CHNode,SVF::CHEdge>* > >
341
+ {
342
+ };
343
+
344
+ template<> struct GraphTraits<SVF::CHGraph*> : public GraphTraits<SVF::GenericGraph<SVF::CHNode,SVF::CHEdge>* >
345
+ {
346
+ typedef SVF::CHNode *NodeRef;
347
+ };
348
+
349
+ } // End namespace llvm
350
+
351
+ #endif /* CHA_H_ */
@@ -52,7 +52,7 @@ public:
52
52
  typedef FIFOWorkList<NodeID> WorkList;
53
53
 
54
54
  protected:
55
- PAG*pag;
55
+ SVFIR*pag;
56
56
  NodeToRepMap nodeToRepMap;
57
57
  NodeToSubsMap nodeToSubsMap;
58
58
  WorkList nodesToBeCollapsed;
@@ -92,7 +92,7 @@ protected:
92
92
 
93
93
  public:
94
94
  /// Constructor
95
- ConstraintGraph(PAG* p): pag(p), edgeIndex(0)
95
+ ConstraintGraph(SVFIR* p): pag(p), edgeIndex(0)
96
96
  {
97
97
  buildCG();
98
98
  }
@@ -172,7 +172,7 @@ public:
172
172
  }
173
173
  }
174
174
 
175
- ///Add a PAG edge into Edge map
175
+ ///Add a SVFIR edge into Edge map
176
176
  //@{
177
177
  /// Add Address edge
178
178
  AddrCGEdge* addAddrCGEdge(NodeID src, NodeID dst);
@@ -187,7 +187,7 @@ public:
187
187
  StoreCGEdge* addStoreCGEdge(NodeID src, NodeID dst);
188
188
  //@}
189
189
 
190
- ///Get PAG edge
190
+ ///Get SVFIR edge
191
191
  //@{
192
192
  /// Get Address edges
193
193
  inline ConstraintEdge::ConstraintEdgeSetTy& getAddrCGEdges()
@@ -296,9 +296,9 @@ public:
296
296
  return false;
297
297
  }
298
298
 
299
- /// Wrappers for invoking PAG methods
299
+ /// Wrappers for invoking SVFIR methods
300
300
  //@{
301
- inline const PAG::CallSiteToFunPtrMap& getIndirectCallsites() const
301
+ inline const SVFIR::CallSiteToFunPtrMap& getIndirectCallsites() const
302
302
  {
303
303
  return pag->getIndirectCallsites();
304
304
  }
@@ -30,7 +30,7 @@
30
30
  #ifndef CONSGEDGE_H_
31
31
  #define CONSGEDGE_H_
32
32
 
33
- #include "Graphs/PAG.h"
33
+ #include "MemoryModel/SVFIR.h"
34
34
  #include "Util/WorkList.h"
35
35
 
36
36
  #include <map>
@@ -42,7 +42,7 @@ namespace SVF
42
42
  class ConstraintNode;
43
43
  /*!
44
44
  * Self-defined edge for constraint resolution
45
- * including add/remove/re-target, but all the operations do not affect original PAG Edges
45
+ * including add/remove/re-target, but all the operations do not affect original SVFIR Edges
46
46
  */
47
47
  typedef GenericEdge<ConstraintNode> GenericConsEdgeTy;
48
48
  class ConstraintEdge : public GenericConsEdgeTy
@@ -101,7 +101,7 @@ public:
101
101
  }
102
102
  //@}
103
103
 
104
- /// Direct and Indirect PAG edges
104
+ /// Direct and Indirect SVFIR edges
105
105
  inline bool isdirectEdge(ConstraintEdge::ConstraintEdgeK kind)
106
106
  {
107
107
  return (kind == ConstraintEdge::Copy || kind == ConstraintEdge::NormalGep || kind == ConstraintEdge::VariantGep );
@@ -10,15 +10,15 @@
10
10
  #ifndef EXTERNALPAG_H_
11
11
  #define EXTERNALPAG_H_
12
12
 
13
- #include "Graphs/PAGNode.h"
13
+ #include "MemoryModel/SVFVariables.h"
14
14
 
15
15
  extern llvm::cl::list<std::string> DumpPAGFunctions;
16
16
 
17
17
  namespace SVF
18
18
  {
19
19
 
20
- /// Represents the PAG of a function loaded externally (i.e. from file).
21
- /// It's purpose is to be attached to the main PAG (almost) seamlessly.
20
+ /// Represents the SVFIR of a function loaded externally (i.e. from file).
21
+ /// It's purpose is to be attached to the main SVFIR (almost) seamlessly.
22
22
  class ExternalPAG
23
23
  {
24
24
  private:
@@ -28,17 +28,17 @@ private:
28
28
  functionToExternalPAGEntries;
29
29
  static Map<const SVFFunction*, PAGNode *> functionToExternalPAGReturns;
30
30
 
31
- /// Name of the function this external PAG represents.
31
+ /// Name of the function this external SVFIR represents.
32
32
  std::string functionName;
33
33
 
34
- /// Value nodes in this external PAG, represented by NodeIDs
35
- /// because we will rebuild these nodes in the main PAG.
34
+ /// Value nodes in this external SVFIR, represented by NodeIDs
35
+ /// because we will rebuild these nodes in the main SVFIR.
36
36
  NodeSet valueNodes;
37
- /// Object nodes in this external PAG, represented by NodeIDs
38
- /// because we will rebuild these nodes in the main PAG.
37
+ /// Object nodes in this external SVFIR, represented by NodeIDs
38
+ /// because we will rebuild these nodes in the main SVFIR.
39
39
  NodeSet objectNodes;
40
- /// Edges in this external PAG, represented by the parts of an Edge because
41
- /// we will rebuild these edges in the main PAG.
40
+ /// Edges in this external SVFIR, represented by the parts of an Edge because
41
+ /// we will rebuild these edges in the main SVFIR.
42
42
  OrderedSet<std::tuple<NodeID, NodeID, std::string, int>> edges;
43
43
 
44
44
  // Special nodes.
@@ -82,15 +82,15 @@ public:
82
82
  ~ExternalPAG() {}
83
83
 
84
84
  /// Parses command line arguments and attaches external PAGs to main
85
- /// PAG.
85
+ /// SVFIR.
86
86
  static void initialise(SVFModule* svfModule);
87
87
 
88
- /// Connects callsite if a external PAG implementing the relevant function
88
+ /// Connects callsite if a external SVFIR implementing the relevant function
89
89
  /// has been added.
90
90
  /// Returns true on success, false otherwise.
91
91
  static bool connectCallsiteToExternalPAG(CallSite *cs);
92
92
 
93
- /// Whether an external PAG implementing function exists.
93
+ /// Whether an external SVFIR implementing function exists.
94
94
  static bool hasExternalPAG(const SVFFunction* function);
95
95
 
96
96
  /// Dump individual PAGs of specified functions. Currently to outs().
@@ -136,7 +136,7 @@ public:
136
136
  }
137
137
 
138
138
  /// Adds (creates new equivalents) all the nodes and edges of this extpag to
139
- /// the main PAG. function is used as a key for future lookups.
139
+ /// the main SVFIR. function is used as a key for future lookups.
140
140
  /// Returns true on success, false otherwise (incl. if it already exists).
141
141
  bool addExternalPAG(const SVFFunction* function);
142
142
 
@@ -108,7 +108,7 @@ public:
108
108
  }
109
109
  } equalGEdge;
110
110
 
111
- inline bool operator==(const GenericEdge<NodeType>* rhs) const
111
+ virtual inline bool operator==(const GenericEdge<NodeType>* rhs) const
112
112
  {
113
113
  return (rhs->edgeFlag == this->edgeFlag && rhs->getSrcID() == this->getSrcID()
114
114
  && rhs->getDstID() == this->getDstID());