svf-lib 1.0.730 → 1.0.734

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 (98) 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 +6 -6
  5. package/SVF-linux/include/DDA/FlowDDA.h +1 -1
  6. package/SVF-linux/include/Graphs/ConsG.h +6 -6
  7. package/SVF-linux/include/Graphs/ConsGEdge.h +2 -2
  8. package/SVF-linux/include/Graphs/ConsGNode.h +1 -1
  9. package/SVF-linux/include/Graphs/ExternalPAG.h +14 -14
  10. package/SVF-linux/include/Graphs/ICFGNode.h +14 -14
  11. package/SVF-linux/include/Graphs/IRGraph.h +245 -0
  12. package/SVF-linux/include/Graphs/OfflineConsG.h +1 -1
  13. package/SVF-linux/include/Graphs/PAG.h +4 -4
  14. package/SVF-linux/include/Graphs/PAGNode.h +3 -3
  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 +19 -19
  18. package/SVF-linux/include/Graphs/VFGNode.h +2 -3
  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 +591 -233
  27. package/SVF-linux/include/MemoryModel/SVFStatements.h +738 -0
  28. package/SVF-linux/include/MemoryModel/SVFSymbols.h +648 -0
  29. package/SVF-linux/include/MemoryModel/SVFVariables.h +842 -0
  30. package/SVF-linux/include/MemoryModel/SymbolTableInfo.h +343 -40
  31. package/SVF-linux/include/SABER/SaberSVFGBuilder.h +0 -2
  32. package/SVF-linux/include/SABER/SrcSnkDDA.h +3 -3
  33. package/SVF-linux/include/SVF-FE/Graph2Json.h +1 -3
  34. package/SVF-linux/include/SVF-FE/SVFIRBuilder.h +392 -0
  35. package/SVF-linux/include/SVF-FE/SymbolTableBuilder.h +0 -1
  36. package/SVF-linux/include/Util/CFLSolver.h +1 -1
  37. package/SVF-linux/include/Util/ExtAPI.h +1 -1
  38. package/SVF-linux/include/Util/IRAnnotator.h +6 -6
  39. package/SVF-linux/include/Util/Options.h +1 -1
  40. package/SVF-linux/include/Util/TypeBasedHeapCloning.h +11 -11
  41. package/SVF-linux/include/WPA/Andersen.h +11 -11
  42. package/SVF-linux/include/WPA/AndersenSFR.h +4 -4
  43. package/SVF-linux/include/WPA/FlowSensitive.h +2 -2
  44. package/SVF-linux/include/WPA/FlowSensitiveTBHC.h +1 -1
  45. package/SVF-linux/include/WPA/Steensgaard.h +2 -2
  46. package/SVF-linux/include/WPA/TypeAnalysis.h +1 -1
  47. package/SVF-linux/include/WPA/VersionedFlowSensitive.h +2 -2
  48. package/SVF-linux/include/WPA/WPAStat.h +1 -2
  49. package/SVF-osx/Release-build/lib/CUDD/libCudd.a +0 -0
  50. package/SVF-osx/Release-build/lib/libSvf.a +0 -0
  51. package/SVF-osx/include/DDA/ContextDDA.h +1 -1
  52. package/SVF-osx/include/DDA/DDAClient.h +8 -8
  53. package/SVF-osx/include/DDA/DDAVFSolver.h +6 -6
  54. package/SVF-osx/include/DDA/FlowDDA.h +1 -1
  55. package/SVF-osx/include/Graphs/ConsG.h +6 -6
  56. package/SVF-osx/include/Graphs/ConsGEdge.h +2 -2
  57. package/SVF-osx/include/Graphs/ConsGNode.h +1 -1
  58. package/SVF-osx/include/Graphs/ExternalPAG.h +14 -14
  59. package/SVF-osx/include/Graphs/ICFGNode.h +14 -14
  60. package/SVF-osx/include/Graphs/IRGraph.h +245 -0
  61. package/SVF-osx/include/Graphs/OfflineConsG.h +1 -1
  62. package/SVF-osx/include/Graphs/PAG.h +4 -4
  63. package/SVF-osx/include/Graphs/PAGNode.h +3 -3
  64. package/SVF-osx/include/Graphs/SVFG.h +1 -1
  65. package/SVF-osx/include/Graphs/SVFGOPT.h +3 -3
  66. package/SVF-osx/include/Graphs/VFG.h +19 -19
  67. package/SVF-osx/include/Graphs/VFGNode.h +2 -3
  68. package/SVF-osx/include/MSSA/MemRegion.h +11 -11
  69. package/SVF-osx/include/MSSA/MemSSA.h +4 -4
  70. package/SVF-osx/include/MTA/FSMPTA.h +1 -1
  71. package/SVF-osx/include/MemoryModel/PAGBuilderFromFile.h +8 -8
  72. package/SVF-osx/include/MemoryModel/PTAStat.h +31 -31
  73. package/SVF-osx/include/MemoryModel/PointerAnalysis.h +9 -9
  74. package/SVF-osx/include/MemoryModel/PointerAnalysisImpl.h +3 -3
  75. package/SVF-osx/include/MemoryModel/SVFIR.h +591 -233
  76. package/SVF-osx/include/MemoryModel/SVFStatements.h +738 -0
  77. package/SVF-osx/include/MemoryModel/SVFSymbols.h +648 -0
  78. package/SVF-osx/include/MemoryModel/SVFVariables.h +842 -0
  79. package/SVF-osx/include/MemoryModel/SymbolTableInfo.h +343 -40
  80. package/SVF-osx/include/SABER/SaberSVFGBuilder.h +0 -2
  81. package/SVF-osx/include/SABER/SrcSnkDDA.h +3 -3
  82. package/SVF-osx/include/SVF-FE/Graph2Json.h +1 -3
  83. package/SVF-osx/include/SVF-FE/SVFIRBuilder.h +392 -0
  84. package/SVF-osx/include/SVF-FE/SymbolTableBuilder.h +0 -1
  85. package/SVF-osx/include/Util/CFLSolver.h +1 -1
  86. package/SVF-osx/include/Util/ExtAPI.h +1 -1
  87. package/SVF-osx/include/Util/IRAnnotator.h +6 -6
  88. package/SVF-osx/include/Util/Options.h +1 -1
  89. package/SVF-osx/include/Util/TypeBasedHeapCloning.h +11 -11
  90. package/SVF-osx/include/WPA/Andersen.h +11 -11
  91. package/SVF-osx/include/WPA/AndersenSFR.h +4 -4
  92. package/SVF-osx/include/WPA/FlowSensitive.h +2 -2
  93. package/SVF-osx/include/WPA/FlowSensitiveTBHC.h +1 -1
  94. package/SVF-osx/include/WPA/Steensgaard.h +2 -2
  95. package/SVF-osx/include/WPA/TypeAnalysis.h +1 -1
  96. package/SVF-osx/include/WPA/VersionedFlowSensitive.h +2 -2
  97. package/SVF-osx/include/WPA/WPAStat.h +1 -2
  98. package/package.json +1 -1
@@ -0,0 +1,245 @@
1
+ //===- SVFIR.h -- SVF IR Graph or PAG (Program Assignment Graph)--------------------------------------//
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
+ * IRGraph.h
25
+ *
26
+ * Created on: Nov 1, 2013
27
+ * Author: Yulei Sui
28
+ */
29
+
30
+
31
+ #ifndef IRGRAPH_H_
32
+ #define IRGRAPH_H_
33
+
34
+ #include "MemoryModel/SVFStatements.h"
35
+ #include "MemoryModel/SVFVariables.h"
36
+ #include "Util/NodeIDAllocator.h"
37
+ #include "Util/SVFUtil.h"
38
+ #include "Graphs/ICFG.h"
39
+
40
+ namespace SVF
41
+ {
42
+ typedef SVFVar PAGNode;
43
+ typedef SVFStmt PAGEdge;
44
+
45
+ /*
46
+ * Graph representation of SVF IR. It can be seen as a program assignment graph (PAG)
47
+ */
48
+ class IRGraph : public GenericGraph<SVFVar,SVFStmt>
49
+ {
50
+ public:
51
+ typedef Set<const SVFStmt*> PAGEdgeSet;
52
+ typedef Map<const Value*,PAGEdgeSet> ValueToEdgeMap;
53
+
54
+ private:
55
+ bool fromFile; ///< Whether the SVFIR is built according to user specified data from a txt file
56
+ NodeID nodeNumAfterPAGBuild; // initial node number after building SVFIR, excluding later added nodes, e.g., gepobj nodes
57
+ u32_t totalPTAPAGEdge;
58
+ SVFStmt::PAGKindToEdgeSetMapTy PAGEdgeKindToSetMap; // < SVFIR edge map containing all PAGEdges
59
+ SVFStmt::PAGKindToEdgeSetMapTy PTAPAGEdgeKindToSetMap; // < SVFIR edge map containing only pointer-related edges, i.e, both RHS and RHS are of pointer type
60
+ ValueToEdgeMap valueToEdgeMap; ///< Map llvm::Values to all corresponding PAGEdges
61
+ SymbolTableInfo* symInfo;
62
+
63
+ protected:
64
+ /// Add a node into the graph
65
+ inline NodeID addNode(SVFVar* node, NodeID i)
66
+ {
67
+ addGNode(i,node);
68
+ return i;
69
+ }
70
+ /// Add an edge into the graph
71
+ bool addEdge(SVFVar* src, SVFVar* dst, SVFStmt* edge);
72
+
73
+ //// Return true if this edge exits
74
+ SVFStmt* hasNonlabeledEdge(SVFVar* src, SVFVar* dst, SVFStmt::PEDGEK kind);
75
+ /// Return true if this labeled edge exits, including store, call and load
76
+ /// two store edge can have same dst and src but located in different basic blocks, thus flags are needed to distinguish them
77
+ SVFStmt* hasLabeledEdge(SVFVar* src, SVFVar* dst, SVFStmt::PEDGEK kind, const ICFGNode* cs);
78
+ /// Map a value to a set of edges
79
+ inline void mapValueToEdge(const Value *V, SVFStmt *edge)
80
+ {
81
+ auto inserted = valueToEdgeMap.emplace(V, PAGEdgeSet{edge});
82
+ if (!inserted.second) {
83
+ inserted.first->second.emplace(edge);
84
+ }
85
+ }
86
+ /// get MemObj according to LLVM value
87
+ inline const MemObj* getMemObj(const Value* val) const{
88
+ return symInfo->getObj(symInfo->getObjSym(val));
89
+ }
90
+
91
+ public:
92
+ IRGraph(bool buildFromFile): fromFile(buildFromFile), nodeNumAfterPAGBuild(0), totalPTAPAGEdge(0){
93
+ symInfo = SymbolTableInfo::SymbolInfo();
94
+ // insert dummy value if a correct value cannot be found
95
+ valueToEdgeMap[nullptr] = PAGEdgeSet();
96
+ }
97
+
98
+ virtual ~IRGraph();
99
+
100
+ /// Whether this SVFIR built from a txt file
101
+ inline bool isBuiltFromFile()
102
+ {
103
+ return fromFile;
104
+ }
105
+ /// Get edges set according to its kind
106
+ inline SVFStmt::PAGEdgeSetTy& getEdgeSet(SVFStmt::PEDGEK kind)
107
+ {
108
+ return PAGEdgeKindToSetMap[kind];
109
+ }
110
+ /// Get PTA edges set according to its kind
111
+ inline SVFStmt::PAGEdgeSetTy& getPTAEdgeSet(SVFStmt::PEDGEK kind)
112
+ {
113
+ return PTAPAGEdgeKindToSetMap[kind];
114
+ }
115
+
116
+ /// Get all SVFIR Edges that corresponds to an LLVM value
117
+ inline const PAGEdgeSet& getValueEdges(const Value *V)
118
+ {
119
+ auto it = valueToEdgeMap.find(V);
120
+ if (it == valueToEdgeMap.end()) {
121
+ //special empty set
122
+ return valueToEdgeMap.at(nullptr);
123
+ }
124
+ return it->second;
125
+ }
126
+
127
+ /// Get SVFIR Node according to LLVM value
128
+ ///getNode - Return the node corresponding to the specified pointer.
129
+ inline NodeID getValueNode(const Value *V)
130
+ {
131
+ return symInfo->getValSym(V);
132
+ }
133
+ inline bool hasValueNode(const Value* V)
134
+ {
135
+ return symInfo->hasValSym(V);
136
+ }
137
+ /// getObject - Return the obj node id refer to the memory object for the
138
+ /// specified global, heap or alloca instruction according to llvm value.
139
+ inline NodeID getObjectNode(const Value *V)
140
+ {
141
+ return symInfo->getObjSym(V);
142
+ }
143
+ /// GetReturnNode - Return the unique node representing the return value of a function
144
+ inline NodeID getReturnNode(const SVFFunction* func) const
145
+ {
146
+ return symInfo->getRetSym(func->getLLVMFun());
147
+ }
148
+ /// getVarargNode - Return the unique node representing the variadic argument of a variadic function.
149
+ inline NodeID getVarargNode(const SVFFunction* func) const
150
+ {
151
+ return symInfo->getVarargSym(func->getLLVMFun());
152
+ }
153
+ inline NodeID getBlackHoleNode() const
154
+ {
155
+ return symInfo->blackholeSymID();
156
+ }
157
+ inline NodeID getConstantNode() const
158
+ {
159
+ return symInfo->constantSymID();
160
+ }
161
+ inline NodeID getBlkPtr() const
162
+ {
163
+ return symInfo->blkPtrSymID();
164
+ }
165
+ inline NodeID getNullPtr() const
166
+ {
167
+ return symInfo->nullPtrSymID();
168
+ }
169
+ inline const MemObj* getBlackHoleObj() const
170
+ {
171
+ return symInfo->getBlkObj();
172
+ }
173
+ inline const MemObj* getConstantObj() const
174
+ {
175
+ return symInfo->getConstantObj();
176
+ }
177
+
178
+ inline Size_t getValueNodeNum() const
179
+ {
180
+ return symInfo->valSyms().size();
181
+ }
182
+ inline Size_t getObjectNodeNum() const
183
+ {
184
+ return symInfo->idToObjMap().size();
185
+ }
186
+ inline u32_t getNodeNumAfterPAGBuild() const
187
+ {
188
+ return nodeNumAfterPAGBuild;
189
+ }
190
+ inline void setNodeNumAfterPAGBuild(u32_t num)
191
+ {
192
+ nodeNumAfterPAGBuild = num;
193
+ }
194
+
195
+ inline Size_t getPAGNodeNum() const
196
+ {
197
+ return nodeNum;
198
+ }
199
+ inline Size_t getPAGEdgeNum() const
200
+ {
201
+ return edgeNum;
202
+ }
203
+ inline Size_t getPTAPAGEdgeNum() const
204
+ {
205
+ return totalPTAPAGEdge;
206
+ }
207
+ /// Return graph name
208
+ inline std::string getGraphName() const
209
+ {
210
+ return "SVFIR";
211
+ }
212
+
213
+ /// Dump SVFIR
214
+ void dump(std::string name);
215
+
216
+ /// View graph from the debugger
217
+ void view();
218
+ };
219
+
220
+ }
221
+
222
+
223
+ namespace llvm
224
+ {
225
+
226
+ /* !
227
+ * GraphTraits specializations of SVFIR to be used for the generic graph algorithms.
228
+ * Provide graph traits for tranversing from a SVFIR node using standard graph traversals.
229
+ */
230
+ template<> struct GraphTraits<SVF::SVFVar*> : public GraphTraits<SVF::GenericNode<SVF::SVFVar,SVF::SVFStmt>* >
231
+ {
232
+ };
233
+
234
+ /// Inverse GraphTraits specializations for SVFIR node, it is used for inverse traversal.
235
+ template<> struct GraphTraits<Inverse<SVF::SVFVar *> > : public GraphTraits<Inverse<SVF::GenericNode<SVF::SVFVar,SVF::SVFStmt>* > >
236
+ {
237
+ };
238
+
239
+ template<> struct GraphTraits<SVF::IRGraph*> : public GraphTraits<SVF::GenericGraph<SVF::SVFVar,SVF::SVFStmt>* >
240
+ {
241
+ typedef SVF::SVFVar *NodeRef;
242
+ };
243
+
244
+ } // End namespace llvm
245
+ #endif /* IRGRAPH_H_ */
@@ -55,7 +55,7 @@ protected:
55
55
  NodeToRepMap norToRepMap; // for each *a construct a --> rep, i.e., mapping a node of to a rep node for online constraint solving
56
56
 
57
57
  public:
58
- OfflineConsG(PAG *p) : ConstraintGraph(p),
58
+ OfflineConsG(SVFIR *p) : ConstraintGraph(p),
59
59
  nodeToRefMap( {}), norToRepMap({})
60
60
  {
61
61
  buildOfflineCG();
@@ -561,7 +561,7 @@ public:
561
561
  /// getObject - return mem object id
562
562
  inline NodeID getObjectNode(const MemObj *mem)
563
563
  {
564
- return mem->getSymId();
564
+ return mem->getId();
565
565
  }
566
566
  /// Get all PAG Edges that corresponds to an LLVM value
567
567
  inline const PAGEdgeSet& getValueEdges(const Value *V)
@@ -618,7 +618,7 @@ public:
618
618
  //@{
619
619
  inline NodeID getFIObjNode(const MemObj* obj) const
620
620
  {
621
- return obj->getSymId();
621
+ return obj->getId();
622
622
  }
623
623
  inline NodeID getFIObjNode(NodeID id) const
624
624
  {
@@ -716,7 +716,7 @@ public:
716
716
  LocationSet getLocationSetFromBaseNode(NodeID nodeId);
717
717
  inline NodeID getBaseObjNode(NodeID id) const
718
718
  {
719
- return getBaseObj(id)->getSymId();
719
+ return getBaseObj(id)->getId();
720
720
  }
721
721
  inline const MemObj* getBaseObj(NodeID id) const
722
722
  {
@@ -752,7 +752,7 @@ public:
752
752
  inline NodeID addObjNode(const Value* val, NodeID i)
753
753
  {
754
754
  MemObj* mem = symInfo->getObj(symInfo->getObjSym(val));
755
- assert(((mem->getSymId() == i)) && "not same object id?");
755
+ assert(((mem->getId() == i)) && "not same object id?");
756
756
  return addFIObjNode(mem);
757
757
  }
758
758
  /// Add a unique return node for a procedure
@@ -31,7 +31,7 @@
31
31
  #define PAGNODE_H_
32
32
 
33
33
  #include "Graphs/GenericGraph.h"
34
- #include "MemoryModel/MemModel.h"
34
+ #include "MemoryModel/SVFSymbols.h"
35
35
  #include "MemoryModel/SymbolTableInfo.h"
36
36
  #include "SVF-FE/LLVMUtil.h"
37
37
  #include "Graphs/PAGEdge.h"
@@ -483,9 +483,9 @@ public:
483
483
 
484
484
  /// Constructor
485
485
  GepObjPN(const MemObj* mem, NodeID i, const LocationSet& l, PNODEK ty = GepObjNode) :
486
- ObjPN(mem->getRefVal(), i, mem, ty), ls(l)
486
+ ObjPN(mem->getValue(), i, mem, ty), ls(l)
487
487
  {
488
- base = mem->getSymId();
488
+ base = mem->getId();
489
489
  }
490
490
 
491
491
  /// offset of the mem object
@@ -369,7 +369,7 @@ protected:
369
369
  }
370
370
  else
371
371
  {
372
- assert((it->second == node->getId()) && "a PAG node can only have unique definition ");
372
+ assert((it->second == node->getId()) && "a SVFIR node can only have unique definition ");
373
373
  }
374
374
  }
375
375
  inline NodeID getDef(const MRVer* mvar) const
@@ -259,7 +259,7 @@ private:
259
259
  inline void resetDef(const PAGNode* pagNode, const SVFGNode* node)
260
260
  {
261
261
  PAGNodeToDefMapTy::iterator it = PAGNodeToDefMap.find(pagNode);
262
- assert(it != PAGNodeToDefMap.end() && "a PAG node doesn't have definition before");
262
+ assert(it != PAGNodeToDefMap.end() && "a SVFIR node doesn't have definition before");
263
263
  PAGNodeToDefMap[pagNode] = node->getId();
264
264
  }
265
265
 
@@ -290,11 +290,11 @@ private:
290
290
  //@{
291
291
  inline bool actualInOfIndCS(const ActualINSVFGNode* ai) const
292
292
  {
293
- return (PAG::getPAG()->isIndirectCallSites(ai->getCallSite()));
293
+ return (SVFIR::getPAG()->isIndirectCallSites(ai->getCallSite()));
294
294
  }
295
295
  inline bool actualOutOfIndCS(const ActualOUTSVFGNode* ao) const
296
296
  {
297
- return (PAG::getPAG()->isIndirectCallSites(ao->getCallSite()));
297
+ return (SVFIR::getPAG()->isIndirectCallSites(ao->getCallSite()));
298
298
  }
299
299
  //@}
300
300
 
@@ -31,7 +31,7 @@
31
31
  #define INCLUDE_UTIL_VFG_H_
32
32
 
33
33
 
34
- #include "Graphs/PAG.h"
34
+ #include "MemoryModel/SVFIR.h"
35
35
  #include "Graphs/PTACallGraph.h"
36
36
  #include "Graphs/VFGNode.h"
37
37
  #include "Graphs/VFGEdge.h"
@@ -78,7 +78,7 @@ public:
78
78
  typedef VFGEdge::VFGEdgeSetTy::iterator VFGNodeIter;
79
79
  typedef VFGNodeIDToNodeMapTy::iterator iterator;
80
80
  typedef VFGNodeIDToNodeMapTy::const_iterator const_iterator;
81
- typedef PAG::PAGEdgeSet PAGEdgeSet;
81
+ typedef SVFIR::PAGEdgeSet PAGEdgeSet;
82
82
  typedef Set<const VFGNode*> GlobalVFGNodeSet;
83
83
  typedef Set<const PAGNode*> PAGNodeSet;
84
84
 
@@ -99,7 +99,7 @@ protected:
99
99
 
100
100
  GlobalVFGNodeSet globalVFGNodes; ///< set of global store VFG nodes
101
101
  PTACallGraph* callgraph;
102
- PAG* pag;
102
+ SVFIR* pag;
103
103
  VFGK kind;
104
104
 
105
105
  /// Clean up memory
@@ -127,8 +127,8 @@ public:
127
127
  return (kind == PTRONLYSVFG) || (kind == PTRONLYSVFG_OPT);
128
128
  }
129
129
 
130
- /// Return PAG
131
- inline PAG* getPAG() const
130
+ /// Return SVFIR
131
+ inline SVFIR* getPAG() const
132
132
  {
133
133
  return pag;
134
134
  }
@@ -261,12 +261,12 @@ public:
261
261
  const VFGNode* defNode = getVFGNode(getDef(pagNode));
262
262
  if (const AddrVFGNode* addr = SVFUtil::dyn_cast<AddrVFGNode>(defNode))
263
263
  {
264
- if (PAG::getPAG()->isBlkObjOrConstantObj(addr->getPAGEdge()->getSrcID()))
264
+ if (SVFIR::getPAG()->isBlkObjOrConstantObj(addr->getPAGEdge()->getSrcID()))
265
265
  return true;
266
266
  }
267
267
  else if(const CopyVFGNode* copy = SVFUtil::dyn_cast<CopyVFGNode>(defNode))
268
268
  {
269
- if (PAG::getPAG()->isNullPtr(copy->getPAGEdge()->getSrcID()))
269
+ if (SVFIR::getPAG()->isNullPtr(copy->getPAGEdge()->getSrcID()))
270
270
  return true;
271
271
  }
272
272
  }
@@ -400,13 +400,13 @@ protected:
400
400
  }
401
401
  else
402
402
  {
403
- assert((it->second == node->getId()) && "a PAG node can only have unique definition ");
403
+ assert((it->second == node->getId()) && "a SVFIR node can only have unique definition ");
404
404
  }
405
405
  }
406
406
  inline NodeID getDef(const PAGNode* pagNode) const
407
407
  {
408
408
  PAGNodeToDefMapTy::const_iterator it = PAGNodeToDefMap.find(pagNode);
409
- assert(it!=PAGNodeToDefMap.end() && "PAG node does not have a definition??");
409
+ assert(it!=PAGNodeToDefMap.end() && "SVFIR node does not have a definition??");
410
410
  return it->second;
411
411
  }
412
412
  inline bool hasDef(const PAGNode* pagNode) const
@@ -503,7 +503,7 @@ protected:
503
503
  setDef(load->getDstNode(),sNode);
504
504
  }
505
505
  /// Add a Store VFG node,
506
- /// To be noted store does not create a new pointer, we do not set def for any PAG node
506
+ /// To be noted store does not create a new pointer, we do not set def for any SVFIR node
507
507
  void addStoreVFGNode(const StorePE* store)
508
508
  {
509
509
  StoreVFGNode* sNode = new StoreVFGNode(totalVFGNode++,store);
@@ -545,7 +545,7 @@ protected:
545
545
  PAGNodeToFormalRetMap[uniqueFunRet] = sNode;
546
546
  /// if this uniqueFunRet is a phi node, which means it will receive values from multiple return instructions of fun
547
547
  /// we will set this phi node's def later
548
- /// Ideally, every function uniqueFunRet should be a PhiNode (PAGBuilder.cpp), unless it does not have ret instruction
548
+ /// Ideally, every function uniqueFunRet should be a PhiNode (SVFIRBuilder.cpp), unless it does not have ret instruction
549
549
  if (!pag->isPhiNode(uniqueFunRet)){
550
550
  std::string warn = fun->getName().str();
551
551
  SVFUtil::writeWrnMsg(warn + " does not have any ret instruction!");
@@ -561,12 +561,12 @@ protected:
561
561
  PAGNodeToActualRetMap[ret] = sNode;
562
562
  }
563
563
  /// Add an llvm PHI VFG node
564
- inline void addIntraPHIVFGNode(const PAGNode* phiResNode, PAG::CopyPEList& oplist)
564
+ inline void addIntraPHIVFGNode(const PAGNode* phiResNode, SVFIR::CopyPEList& oplist)
565
565
  {
566
566
  IntraPHIVFGNode* sNode = new IntraPHIVFGNode(totalVFGNode++,phiResNode);
567
567
  u32_t pos = 0;
568
568
  const PAGEdge* edge = nullptr;
569
- for(PAG::CopyPEList::const_iterator it = oplist.begin(), eit=oplist.end(); it!=eit; ++it,++pos)
569
+ for(SVFIR::CopyPEList::const_iterator it = oplist.begin(), eit=oplist.end(); it!=eit; ++it,++pos)
570
570
  {
571
571
  edge = *it;
572
572
  sNode->setOpVerAndBB(pos, edge->getSrcNode(), edge->getICFGNode());
@@ -577,12 +577,12 @@ protected:
577
577
  PAGNodeToIntraPHIVFGNodeMap[phiResNode] = sNode;
578
578
  }
579
579
  /// Add a Compare VFG node
580
- inline void addCmpVFGNode(const PAGNode* resNode, PAG::CmpPEList& oplist)
580
+ inline void addCmpVFGNode(const PAGNode* resNode, SVFIR::CmpPEList& oplist)
581
581
  {
582
582
  CmpVFGNode* sNode = new CmpVFGNode(totalVFGNode++, resNode);
583
583
  u32_t pos = 0;
584
584
  const PAGEdge* edge = nullptr;
585
- for(PAG::CmpPEList::const_iterator it = oplist.begin(), eit=oplist.end(); it!=eit; ++it,++pos)
585
+ for(SVFIR::CmpPEList::const_iterator it = oplist.begin(), eit=oplist.end(); it!=eit; ++it,++pos)
586
586
  {
587
587
  edge = *it;
588
588
  sNode->setOpVer(pos, edge->getSrcNode());
@@ -593,12 +593,12 @@ protected:
593
593
  PAGNodeToCmpVFGNodeMap[resNode] = sNode;
594
594
  }
595
595
  /// Add a BinaryOperator VFG node
596
- inline void addBinaryOPVFGNode(const PAGNode* resNode, PAG::BinaryOPList& oplist)
596
+ inline void addBinaryOPVFGNode(const PAGNode* resNode, SVFIR::BinaryOPList& oplist)
597
597
  {
598
598
  BinaryOPVFGNode* sNode = new BinaryOPVFGNode(totalVFGNode++, resNode);
599
599
  u32_t pos = 0;
600
600
  const PAGEdge* edge = nullptr;
601
- for(PAG::BinaryOPList::const_iterator it = oplist.begin(), eit=oplist.end(); it!=eit; ++it,++pos)
601
+ for(SVFIR::BinaryOPList::const_iterator it = oplist.begin(), eit=oplist.end(); it!=eit; ++it,++pos)
602
602
  {
603
603
  edge = *it;
604
604
  sNode->setOpVer(pos, (*it)->getSrcNode());
@@ -610,12 +610,12 @@ protected:
610
610
  PAGNodeToBinaryOPVFGNodeMap[resNode] = sNode;
611
611
  }
612
612
  /// Add a UnaryOperator VFG node
613
- inline void addUnaryOPVFGNode(const PAGNode* resNode, PAG::UnaryOPList& oplist)
613
+ inline void addUnaryOPVFGNode(const PAGNode* resNode, SVFIR::UnaryOPList& oplist)
614
614
  {
615
615
  UnaryOPVFGNode* sNode = new UnaryOPVFGNode(totalVFGNode++, resNode);
616
616
  u32_t pos = 0;
617
617
  const PAGEdge* edge = nullptr;
618
- for(PAG::UnaryOPList::const_iterator it = oplist.begin(), eit=oplist.end(); it!=eit; ++it,++pos)
618
+ for(SVFIR::UnaryOPList::const_iterator it = oplist.begin(), eit=oplist.end(); it!=eit; ++it,++pos)
619
619
  {
620
620
  edge = *it;
621
621
  sNode->setOpVer(pos, (*it)->getSrcNode());
@@ -33,8 +33,7 @@
33
33
  #include "Graphs/GenericGraph.h"
34
34
  #include "Graphs/VFGEdge.h"
35
35
  #include "Graphs/ICFGNode.h"
36
- #include "Graphs/PAGNode.h"
37
- #include "Graphs/PAGEdge.h"
36
+ #include "MemoryModel/SVFIR.h"
38
37
 
39
38
  namespace SVF
40
39
  {
@@ -1092,7 +1091,7 @@ public:
1092
1091
  return node->isPointer();
1093
1092
  }
1094
1093
  /// Return corresponding PAGNode
1095
- const PAGNode* getPAGNode() const
1094
+ const PAGNode* getGNode() const
1096
1095
  {
1097
1096
  return node;
1098
1097
  }
@@ -30,7 +30,7 @@
30
30
  #ifndef MEMORYREGION_H_
31
31
  #define MEMORYREGION_H_
32
32
 
33
- #include "Graphs/PAG.h"
33
+ #include "MemoryModel/SVFIR.h"
34
34
  #include "Graphs/PTACallGraph.h"
35
35
  #include "Util/SCC.h"
36
36
  #include "Util/WorkList.h"
@@ -168,8 +168,8 @@ public:
168
168
 
169
169
  typedef Map<NodeID, NodeBS> NodeToPTSSMap;
170
170
 
171
- /// PAG edge list
172
- typedef PAG::PAGEdgeList PAGEdgeList;
171
+ /// SVFIR edge list
172
+ typedef SVFIR::PAGEdgeList PAGEdgeList;
173
173
  /// Call Graph SCC
174
174
  typedef SCCDetection<PTACallGraph*> SCC;
175
175
 
@@ -197,17 +197,17 @@ private:
197
197
 
198
198
  /// Map a function to all its memory regions
199
199
  FunToMRsMap funToMRsMap;
200
- /// Map a load PAG Edge to its memory regions sets in order for inserting mus in Memory SSA
200
+ /// Map a load SVFIR Edge to its memory regions sets in order for inserting mus in Memory SSA
201
201
  LoadsToMRsMap loadsToMRsMap;
202
- /// Map a store PAG Edge to its memory regions sets in order for inserting chis in Memory SSA
202
+ /// Map a store SVFIR Edge to its memory regions sets in order for inserting chis in Memory SSA
203
203
  StoresToMRsMap storesToMRsMap;
204
204
  /// Map a callsite to its refs regions
205
205
  CallSiteToMRsMap callsiteToRefMRsMap;
206
206
  /// Map a callsite to its mods regions
207
207
  CallSiteToMRsMap callsiteToModMRsMap;
208
- /// Map a load PAG Edge to its CPts set map
208
+ /// Map a load SVFIR Edge to its CPts set map
209
209
  LoadsToPointsToMap loadsToPointsToMap;
210
- /// Map a store PAG Edge to its CPts set map
210
+ /// Map a store SVFIR Edge to its CPts set map
211
211
  StoresToPointsToMap storesToPointsToMap;
212
212
  /// Map a callsite to it refs cpts set
213
213
  CallSiteToPointsToMap callsiteToRefPointsToMap;
@@ -235,7 +235,7 @@ private:
235
235
  /// Map a pointer to its cached points-to chain;
236
236
  NodeToPTSSMap cachedPtsChainMap;
237
237
 
238
- /// All global variable PAG node ids
238
+ /// All global variable SVFIR node ids
239
239
  NodeBS allGlobals;
240
240
 
241
241
  /// Clean up memory
@@ -427,11 +427,11 @@ public:
427
427
  /// Start generating memory regions
428
428
  virtual void generateMRs();
429
429
 
430
- /// Get the function which PAG Edge located
430
+ /// Get the function which SVFIR Edge located
431
431
  const SVFFunction* getFunction(const PAGEdge* pagEdge) const
432
432
  {
433
433
  PAGEdgeToFunMap::const_iterator it = pagEdgeToFunMap.find(pagEdge);
434
- assert(it!=pagEdgeToFunMap.end() && "can not find its function, it is a global PAG edge");
434
+ assert(it!=pagEdgeToFunMap.end() && "can not find its function, it is a global SVFIR edge");
435
435
  return it->second;
436
436
  }
437
437
  /// Get Memory Region set
@@ -465,7 +465,7 @@ public:
465
465
  return callsiteToModMRsMap[cs];
466
466
  }
467
467
  //@}
468
- /// Whether this instruction has PAG Edge
468
+ /// Whether this instruction has SVFIR Edge
469
469
  bool hasPAGEdgeList(const Instruction* inst);
470
470
  /// Given an instruction, get all its the PAGEdge (statement) in sequence
471
471
  PAGEdgeList& getPAGEdgesFromInst(const Instruction* inst);
@@ -93,8 +93,8 @@ public:
93
93
  typedef Map<const MemRegion*, std::vector<MRVer*> > MemRegToVerStackMap;
94
94
  typedef Map<const MemRegion*, MRVERSION> MemRegToCounterMap;
95
95
 
96
- /// PAG edge list
97
- typedef PAG::PAGEdgeList PAGEdgeList;
96
+ /// SVFIR edge list
97
+ typedef SVFIR::PAGEdgeList PAGEdgeList;
98
98
 
99
99
  /// Statistics
100
100
  //@{
@@ -309,8 +309,8 @@ public:
309
309
  {
310
310
  destroy();
311
311
  }
312
- /// Return PAG
313
- inline PAG* getPAG();
312
+ /// Return SVFIR
313
+ inline SVFIR* getPAG();
314
314
  /// Return PTA
315
315
  inline BVDataPTAImpl* getPTA() const
316
316
  {
@@ -184,7 +184,7 @@ public:
184
184
  /// Initialize analysis
185
185
  void initialize(SVFModule* module);
186
186
 
187
- inline PAG* getPAG() {
187
+ inline SVFIR* getPAG() {
188
188
  return mhp->getTCT()->getPTA()->getPAG();
189
189
  }
190
190
 
@@ -1,4 +1,4 @@
1
- //===- PAGBuilderFromFile.h -- Building PAG from File--------------------------------//
1
+ //===- PAGBuilderFromFile.h -- Building SVFIR from File--------------------------------//
2
2
  //
3
3
  // SVF: Static Value-Flow Analysis
4
4
  //
@@ -30,24 +30,24 @@
30
30
  #ifndef INCLUDE_MEMORYMODEL_PAGBUILDERFROMFILE_H_
31
31
  #define INCLUDE_MEMORYMODEL_PAGBUILDERFROMFILE_H_
32
32
 
33
- #include "Graphs/PAG.h"
33
+ #include "MemoryModel/SVFIR.h"
34
34
 
35
35
  namespace SVF
36
36
  {
37
37
 
38
38
  /*!
39
- * Build PAG from a user specified file (for debugging purpose)
39
+ * Build SVFIR from a user specified file (for debugging purpose)
40
40
  */
41
41
  class PAGBuilderFromFile
42
42
  {
43
43
 
44
44
  private:
45
- PAG* pag;
45
+ SVFIR* pag;
46
46
  std::string file;
47
47
  public:
48
48
  /// Constructor
49
49
  PAGBuilderFromFile(std::string f) :
50
- pag(PAG::getPAG(true)), file(f)
50
+ pag(SVFIR::getPAG(true)), file(f)
51
51
  {
52
52
  }
53
53
  /// Destructor
@@ -55,8 +55,8 @@ public:
55
55
  {
56
56
  }
57
57
 
58
- /// Return PAG
59
- PAG* getPAG() const
58
+ /// Return SVFIR
59
+ SVFIR* getPAG() const
60
60
  {
61
61
  return pag;
62
62
  }
@@ -68,7 +68,7 @@ public:
68
68
  }
69
69
 
70
70
  /// Start building
71
- PAG* build();
71
+ SVFIR* build();
72
72
 
73
73
  // Add edges
74
74
  void addEdge(NodeID nodeSrc, NodeID nodeDst, Size_t offset,