svf-tools 1.0.1034 → 1.0.1036
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.
- package/package.json +1 -1
- package/svf/include/AE/Svfexe/AbsExtAPI.h +0 -7
- package/svf/include/CFL/CFLAlias.h +0 -8
- package/svf/include/DDA/DDAPass.h +4 -1
- package/svf/include/Graphs/ConsG.h +0 -5
- package/svf/include/Graphs/IRGraph.h +236 -51
- package/svf/include/MSSA/MemRegion.h +1 -1
- package/svf/include/MemoryModel/AccessPath.h +0 -1
- package/svf/include/MemoryModel/PointerAnalysis.h +2 -2
- package/svf/include/MemoryModel/PointerAnalysisImpl.h +7 -4
- package/svf/include/SVFIR/ObjTypeInfo.h +225 -0
- package/svf/include/SVFIR/SVFIR.h +12 -22
- package/svf/include/SVFIR/SVFVariables.h +7 -12
- package/svf/include/Util/SVFUtil.h +0 -16
- package/svf/include/WPA/WPAPass.h +0 -7
- package/svf/lib/AE/Core/AbstractState.cpp +3 -3
- package/svf/lib/AE/Svfexe/AbsExtAPI.cpp +0 -6
- package/svf/lib/AE/Svfexe/AbstractInterpretation.cpp +1 -1
- package/svf/lib/DDA/DDAPass.cpp +0 -27
- package/svf/lib/Graphs/IRGraph.cpp +281 -2
- package/svf/lib/MSSA/MemRegion.cpp +12 -15
- package/svf/lib/MemoryModel/AccessPath.cpp +4 -4
- package/svf/lib/MemoryModel/PointerAnalysis.cpp +1 -1
- package/svf/lib/MemoryModel/PointerAnalysisImpl.cpp +0 -8
- package/svf/lib/SVFIR/PAGBuilderFromFile.cpp +1 -1
- package/svf/lib/SVFIR/SVFIR.cpp +5 -5
- package/svf/lib/SVFIR/SVFModule.cpp +1 -1
- package/svf/lib/SVFIR/SVFStatements.cpp +2 -2
- package/svf/lib/SVFIR/SVFVariables.cpp +12 -1
- package/svf/lib/Util/SVFStat.cpp +1 -1
- package/svf/lib/WPA/WPAPass.cpp +0 -62
- package/svf-llvm/include/SVF-LLVM/LLVMModule.h +1 -1
- package/svf-llvm/include/SVF-LLVM/SymbolTableBuilder.h +3 -3
- package/svf-llvm/lib/CHGBuilder.cpp +2 -2
- package/svf-llvm/lib/DCHG.cpp +1 -1
- package/svf-llvm/lib/LLVMModule.cpp +7 -7
- package/svf-llvm/lib/LLVMUtil.cpp +1 -1
- package/svf-llvm/lib/SVFIRBuilder.cpp +40 -43
- package/svf-llvm/lib/SVFIRExtAPI.cpp +8 -8
- package/svf-llvm/lib/SymbolTableBuilder.cpp +36 -38
- package/svf/include/SVFIR/SymbolTableInfo.h +0 -545
- package/svf/lib/SVFIR/SymbolTableInfo.cpp +0 -392
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svf-tools",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1036",
|
|
4
4
|
"description": "* <b>[TypeClone](https://github.com/SVF-tools/SVF/wiki/TypeClone) published in our [ECOOP paper](https://yuleisui.github.io/publications/ecoop20.pdf) is now available in SVF </b> * <b>SVF now uses a single script for its build. Just type [`source ./build.sh`](https://github.com/SVF-tools/SVF/blob/master/build.sh) in your terminal, that's it!</b> * <b>SVF now supports LLVM-10.0.0! </b> * <b>We thank [bsauce](https://github.com/bsauce) for writing a user manual of SVF ([link1](https://www.jianshu.com/p/068a08ec749c) and [link2](https://www.jianshu.com/p/777c30d4240e)) in Chinese </b> * <b>SVF now supports LLVM-9.0.0 (Thank [Byoungyoung Lee](https://github.com/SVF-tools/SVF/issues/142) for his help!). </b> * <b>SVF now supports a set of [field-sensitive pointer analyses](https://yuleisui.github.io/publications/sas2019a.pdf). </b> * <b>[Use SVF as an external lib](https://github.com/SVF-tools/SVF/wiki/Using-SVF-as-a-lib-in-your-own-tool) for your own project (Contributed by [Hongxu Chen](https://github.com/HongxuChen)). </b> * <b>SVF now supports LLVM-7.0.0. </b> * <b>SVF now supports Docker. [Try SVF in Docker](https://github.com/SVF-tools/SVF/wiki/Try-SVF-in-Docker)! </b> * <b>SVF now supports [LLVM-6.0.0](https://github.com/svf-tools/SVF/pull/38) (Contributed by [Jack Anthony](https://github.com/jackanth)). </b> * <b>SVF now supports [LLVM-4.0.0](https://github.com/svf-tools/SVF/pull/23) (Contributed by Jared Carlson. Thank [Jared](https://github.com/jcarlson23) and [Will](https://github.com/dtzWill) for their in-depth [discussions](https://github.com/svf-tools/SVF/pull/18) about updating SVF!) </b> * <b>SVF now supports analysis for C++ programs.</b> <br />",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -130,13 +130,6 @@ public:
|
|
|
130
130
|
*/
|
|
131
131
|
AbstractState& getAbsStateFromTrace(const ICFGNode* node);
|
|
132
132
|
|
|
133
|
-
/**
|
|
134
|
-
* @brief Retrieves the SVF variable from a given SVF value.
|
|
135
|
-
* @param val Pointer to the SVF value.
|
|
136
|
-
* @return Pointer to the corresponding SVF variable.
|
|
137
|
-
*/
|
|
138
|
-
const SVFVar* getSVFVar(const SVFValue* val);
|
|
139
|
-
|
|
140
133
|
protected:
|
|
141
134
|
SVFIR* svfir; ///< Pointer to the SVF intermediate representation.
|
|
142
135
|
ICFG* icfg; ///< Pointer to the interprocedural control flow graph.
|
|
@@ -61,14 +61,6 @@ public:
|
|
|
61
61
|
/// Solving CFL Reachability
|
|
62
62
|
virtual void solve();
|
|
63
63
|
|
|
64
|
-
/// Interface exposed to users of our Alias analysis, given Value infos
|
|
65
|
-
virtual AliasResult alias(const SVFValue* v1, const SVFValue* v2)
|
|
66
|
-
{
|
|
67
|
-
NodeID n1 = svfir->getValueNode(v1);
|
|
68
|
-
NodeID n2 = svfir->getValueNode(v2);
|
|
69
|
-
return alias(n1,n2);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
64
|
/// Interface exposed to users of our Alias analysis, given PAGNodeID
|
|
73
65
|
virtual AliasResult alias(NodeID node1, NodeID node2)
|
|
74
66
|
{
|
|
@@ -57,7 +57,10 @@ public:
|
|
|
57
57
|
~DDAPass();
|
|
58
58
|
|
|
59
59
|
/// Interface expose to users of our pointer analysis, given Value infos
|
|
60
|
-
virtual AliasResult alias(const
|
|
60
|
+
virtual AliasResult alias(const SVFVar* V1, const SVFVar* V2)
|
|
61
|
+
{
|
|
62
|
+
return alias(V1->getId(), V2->getId());
|
|
63
|
+
}
|
|
61
64
|
|
|
62
65
|
/// Interface expose to users of our pointer analysis, given PAGNodes
|
|
63
66
|
virtual AliasResult alias(NodeID V1, NodeID V2);
|
|
@@ -76,11 +76,6 @@ protected:
|
|
|
76
76
|
|
|
77
77
|
/// Wrappers used internally, not expose to Andersen Pass
|
|
78
78
|
//@{
|
|
79
|
-
inline NodeID getValueNode(const SVFValue* value) const
|
|
80
|
-
{
|
|
81
|
-
return sccRepNode(pag->getValueNode(value));
|
|
82
|
-
}
|
|
83
|
-
|
|
84
79
|
inline NodeID getReturnNode(const SVFFunction* value) const
|
|
85
80
|
{
|
|
86
81
|
return pag->getReturnNode(value);
|
|
@@ -42,6 +42,8 @@ namespace SVF
|
|
|
42
42
|
typedef SVFVar PAGNode;
|
|
43
43
|
typedef SVFStmt PAGEdge;
|
|
44
44
|
|
|
45
|
+
class ObjTypeInfo;
|
|
46
|
+
|
|
45
47
|
/*
|
|
46
48
|
* Graph representation of SVF IR.
|
|
47
49
|
* It can be seen as a program assignment graph (PAG).
|
|
@@ -50,10 +52,61 @@ class IRGraph : public GenericGraph<SVFVar, SVFStmt>
|
|
|
50
52
|
{
|
|
51
53
|
friend class SVFIRWriter;
|
|
52
54
|
friend class SVFIRReader;
|
|
55
|
+
friend class SymbolTableBuilder;
|
|
56
|
+
|
|
57
|
+
public:
|
|
58
|
+
|
|
59
|
+
/// Symbol types
|
|
60
|
+
enum SYMTYPE
|
|
61
|
+
{
|
|
62
|
+
NullPtr,
|
|
63
|
+
BlkPtr,
|
|
64
|
+
BlackHole,
|
|
65
|
+
ConstantObj,
|
|
66
|
+
ValSymbol,
|
|
67
|
+
ObjSymbol,
|
|
68
|
+
RetSymbol,
|
|
69
|
+
VarargSymbol
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
/// various maps defined
|
|
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
|
+
/// sym id to obj type info map
|
|
78
|
+
typedef OrderedMap<NodeID, ObjTypeInfo*> IDToTypeInfoMapTy;
|
|
79
|
+
|
|
80
|
+
/// function to sym id map
|
|
81
|
+
typedef OrderedMap<const SVFFunction*, NodeID> FunToIDMapTy;
|
|
82
|
+
/// struct type to struct info map
|
|
83
|
+
typedef Set<const SVFType*> SVFTypeSet;
|
|
84
|
+
//@}
|
|
85
|
+
|
|
86
|
+
private:
|
|
87
|
+
ValueToIDMapTy valSymMap; ///< map a value to its sym id
|
|
88
|
+
ValueToIDMapTy objSymMap; ///< map a obj reference to its sym id
|
|
89
|
+
FunToIDMapTy returnSymMap; ///< return map
|
|
90
|
+
FunToIDMapTy varargSymMap; ///< vararg map
|
|
91
|
+
IDToTypeInfoMapTy objTypeInfoMap; ///< map a memory sym id to its obj
|
|
92
|
+
|
|
93
|
+
/// (owned) All SVF Types
|
|
94
|
+
/// Every type T is mapped to StInfo
|
|
95
|
+
/// which contains size (fsize) , offset(foffset)
|
|
96
|
+
/// fsize[i] is the number of fields in the largest such struct, else fsize[i] = 1.
|
|
97
|
+
/// fsize[0] is always the size of the expanded struct.
|
|
98
|
+
SVFTypeSet svfTypes;
|
|
99
|
+
|
|
100
|
+
/// @brief (owned) All StInfo
|
|
101
|
+
Set<const StInfo*> stInfos;
|
|
102
|
+
|
|
103
|
+
/// total number of symbols
|
|
104
|
+
NodeID totalSymNum;
|
|
105
|
+
|
|
106
|
+
void destorySymTable();
|
|
53
107
|
|
|
54
108
|
public:
|
|
55
109
|
typedef Set<const SVFStmt*> SVFStmtSet;
|
|
56
|
-
typedef Map<const SVFValue*,SVFStmtSet> ValueToEdgeMap;
|
|
57
110
|
|
|
58
111
|
protected:
|
|
59
112
|
SVFStmt::KindToSVFStmtMapTy KindToSVFStmtSetMap; ///< SVFIR edge map containing all PAGEdges
|
|
@@ -61,8 +114,6 @@ protected:
|
|
|
61
114
|
bool fromFile; ///< Whether the SVFIR is built according to user specified data from a txt file
|
|
62
115
|
NodeID nodeNumAfterPAGBuild; ///< initial node number after building SVFIR, excluding later added nodes, e.g., gepobj nodes
|
|
63
116
|
u32_t totalPTAPAGEdge;
|
|
64
|
-
ValueToEdgeMap valueToEdgeMap; ///< Map SVFValues (e.g., ICFGNodes) to all corresponding PAGEdges
|
|
65
|
-
SymbolTableInfo* symInfo;
|
|
66
117
|
|
|
67
118
|
/// Add a node into the graph
|
|
68
119
|
inline NodeID addNode(SVFVar* node)
|
|
@@ -86,98 +137,205 @@ protected:
|
|
|
86
137
|
SVFStmt* hasLabeledEdge(SVFVar* src, SVFVar* op1, SVFStmt::PEDGEK kind,
|
|
87
138
|
const SVFVar* op2);
|
|
88
139
|
|
|
89
|
-
/// Map a value to a set of edges
|
|
90
|
-
inline void mapValueToEdge(const SVFValue* V, SVFStmt *edge)
|
|
91
|
-
{
|
|
92
|
-
auto inserted = valueToEdgeMap.emplace(V, SVFStmtSet{edge});
|
|
93
|
-
if (!inserted.second)
|
|
94
|
-
{
|
|
95
|
-
inserted.first->second.emplace(edge);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
140
|
public:
|
|
99
141
|
IRGraph(bool buildFromFile)
|
|
100
|
-
: fromFile(buildFromFile), nodeNumAfterPAGBuild(0), totalPTAPAGEdge(0)
|
|
142
|
+
: totalSymNum(0), fromFile(buildFromFile), nodeNumAfterPAGBuild(0), totalPTAPAGEdge(0),
|
|
143
|
+
maxStruct(nullptr), maxStSize(0)
|
|
101
144
|
{
|
|
102
|
-
symInfo = SymbolTableInfo::SymbolInfo();
|
|
103
|
-
// insert dummy value if a correct value cannot be found
|
|
104
|
-
valueToEdgeMap[nullptr] = SVFStmtSet();
|
|
105
145
|
}
|
|
106
146
|
|
|
107
147
|
virtual ~IRGraph();
|
|
108
148
|
|
|
109
|
-
|
|
110
|
-
{
|
|
111
|
-
return symInfo;
|
|
112
|
-
}
|
|
149
|
+
|
|
113
150
|
/// Whether this SVFIR built from a txt file
|
|
114
151
|
inline bool isBuiltFromFile()
|
|
115
152
|
{
|
|
116
153
|
return fromFile;
|
|
117
154
|
}
|
|
118
|
-
|
|
119
|
-
|
|
155
|
+
|
|
156
|
+
/// special value
|
|
157
|
+
// @{
|
|
158
|
+
static inline bool isBlkPtr(NodeID id)
|
|
159
|
+
{
|
|
160
|
+
return (id == BlkPtr);
|
|
161
|
+
}
|
|
162
|
+
static inline bool isNullPtr(NodeID id)
|
|
163
|
+
{
|
|
164
|
+
return (id == NullPtr);
|
|
165
|
+
}
|
|
166
|
+
static inline bool isBlkObj(NodeID id)
|
|
167
|
+
{
|
|
168
|
+
return (id == BlackHole);
|
|
169
|
+
}
|
|
170
|
+
static inline bool isConstantSym(NodeID id)
|
|
171
|
+
{
|
|
172
|
+
return (id == ConstantObj);
|
|
173
|
+
}
|
|
174
|
+
static inline bool isBlkObjOrConstantObj(NodeID id)
|
|
120
175
|
{
|
|
121
|
-
|
|
122
|
-
if (it == valueToEdgeMap.end())
|
|
123
|
-
{
|
|
124
|
-
//special empty set
|
|
125
|
-
return valueToEdgeMap.at(nullptr);
|
|
126
|
-
}
|
|
127
|
-
return it->second;
|
|
176
|
+
return (isBlkObj(id) || isConstantSym(id));
|
|
128
177
|
}
|
|
129
178
|
|
|
130
|
-
|
|
131
|
-
///getNode - Return the node corresponding to the specified pointer.
|
|
132
|
-
inline NodeID getValueNode(const SVFValue* V)
|
|
179
|
+
inline NodeID blkPtrSymID() const
|
|
133
180
|
{
|
|
134
|
-
return
|
|
181
|
+
return BlkPtr;
|
|
135
182
|
}
|
|
136
|
-
|
|
183
|
+
|
|
184
|
+
inline NodeID nullPtrSymID() const
|
|
137
185
|
{
|
|
138
|
-
return
|
|
186
|
+
return NullPtr;
|
|
139
187
|
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
inline NodeID getObjectNode(const SVFValue* V)
|
|
188
|
+
|
|
189
|
+
inline NodeID constantSymID() const
|
|
143
190
|
{
|
|
144
|
-
return
|
|
191
|
+
return ConstantObj;
|
|
145
192
|
}
|
|
146
|
-
|
|
147
|
-
inline NodeID
|
|
193
|
+
|
|
194
|
+
inline NodeID blackholeSymID() const
|
|
148
195
|
{
|
|
149
|
-
return
|
|
196
|
+
return BlackHole;
|
|
150
197
|
}
|
|
151
|
-
|
|
152
|
-
|
|
198
|
+
|
|
199
|
+
/// Statistics
|
|
200
|
+
//@{
|
|
201
|
+
inline u32_t getTotalSymNum() const
|
|
202
|
+
{
|
|
203
|
+
return totalSymNum;
|
|
204
|
+
}
|
|
205
|
+
inline u32_t getMaxStructSize() const
|
|
206
|
+
{
|
|
207
|
+
return maxStSize;
|
|
208
|
+
}
|
|
209
|
+
//@}
|
|
210
|
+
|
|
211
|
+
/// Get different kinds of syms maps
|
|
212
|
+
//@{
|
|
213
|
+
inline ValueToIDMapTy& valSyms()
|
|
214
|
+
{
|
|
215
|
+
return valSymMap;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
inline ValueToIDMapTy& objSyms()
|
|
219
|
+
{
|
|
220
|
+
return objSymMap;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
inline IDToTypeInfoMapTy& idToObjTypeInfoMap()
|
|
224
|
+
{
|
|
225
|
+
return objTypeInfoMap;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
inline const IDToTypeInfoMapTy& idToObjTypeInfoMap() const
|
|
153
229
|
{
|
|
154
|
-
return
|
|
230
|
+
return objTypeInfoMap;
|
|
155
231
|
}
|
|
232
|
+
|
|
233
|
+
inline FunToIDMapTy& retSyms()
|
|
234
|
+
{
|
|
235
|
+
return returnSymMap;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
inline FunToIDMapTy& varargSyms()
|
|
239
|
+
{
|
|
240
|
+
return varargSymMap;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
//@}
|
|
244
|
+
|
|
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
|
+
inline ObjTypeInfo* getObjTypeInfo(NodeID id) const
|
|
256
|
+
{
|
|
257
|
+
IDToTypeInfoMapTy::const_iterator iter = objTypeInfoMap.find(id);
|
|
258
|
+
assert(iter!=objTypeInfoMap.end() && "obj type info not found");
|
|
259
|
+
return iter->second;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/// GetReturnNode - Return the unique node representing the return value of a function
|
|
263
|
+
NodeID getReturnNode(const SVFFunction* func) const;
|
|
264
|
+
|
|
265
|
+
/// getVarargNode - Return the unique node representing the variadic argument of a variadic function.
|
|
266
|
+
NodeID getVarargNode(const SVFFunction* func) const;
|
|
267
|
+
|
|
156
268
|
inline NodeID getBlackHoleNode() const
|
|
157
269
|
{
|
|
158
|
-
return
|
|
270
|
+
return blackholeSymID();
|
|
159
271
|
}
|
|
160
272
|
inline NodeID getConstantNode() const
|
|
161
273
|
{
|
|
162
|
-
return
|
|
274
|
+
return constantSymID();
|
|
163
275
|
}
|
|
164
276
|
inline NodeID getBlkPtr() const
|
|
165
277
|
{
|
|
166
|
-
return
|
|
278
|
+
return blkPtrSymID();
|
|
167
279
|
}
|
|
168
280
|
inline NodeID getNullPtr() const
|
|
169
281
|
{
|
|
170
|
-
return
|
|
282
|
+
return nullPtrSymID();
|
|
171
283
|
}
|
|
172
284
|
|
|
173
285
|
inline u32_t getValueNodeNum() const
|
|
174
286
|
{
|
|
175
|
-
return
|
|
287
|
+
return valSymMap.size();
|
|
176
288
|
}
|
|
177
289
|
inline u32_t getObjectNodeNum() const
|
|
178
290
|
{
|
|
179
|
-
return
|
|
291
|
+
return objTypeInfoMap.size();
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
/// Constant reader that won't change the state of the symbol table
|
|
295
|
+
//@{
|
|
296
|
+
inline const SVFTypeSet& getSVFTypes() const
|
|
297
|
+
{
|
|
298
|
+
return svfTypes;
|
|
180
299
|
}
|
|
300
|
+
|
|
301
|
+
inline const Set<const StInfo*>& getStInfos() const
|
|
302
|
+
{
|
|
303
|
+
return stInfos;
|
|
304
|
+
}
|
|
305
|
+
//@}
|
|
306
|
+
/// Given an offset from a Gep Instruction, return it modulus offset by considering memory layout
|
|
307
|
+
virtual APOffset getModulusOffset(const BaseObjVar* baseObj, const APOffset& apOffset);
|
|
308
|
+
/// Get struct info
|
|
309
|
+
//@{
|
|
310
|
+
///Get a reference to StructInfo.
|
|
311
|
+
const StInfo* getTypeInfo(const SVFType* T) const;
|
|
312
|
+
inline bool hasSVFTypeInfo(const SVFType* T)
|
|
313
|
+
{
|
|
314
|
+
return svfTypes.find(T) != svfTypes.end();
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
/// Create an objectInfo based on LLVM type (value is null, and type could be null, representing a dummy object)
|
|
318
|
+
ObjTypeInfo* createObjTypeInfo(const SVFType* type);
|
|
319
|
+
|
|
320
|
+
const ObjTypeInfo* createDummyObjTypeInfo(NodeID symId, const SVFType* type);
|
|
321
|
+
|
|
322
|
+
///Get a reference to the components of struct_info.
|
|
323
|
+
/// Number of flattened elements of an array or struct
|
|
324
|
+
u32_t getNumOfFlattenElements(const SVFType* T);
|
|
325
|
+
/// Flattened element idx of an array or struct by considering stride
|
|
326
|
+
u32_t getFlattenedElemIdx(const SVFType* T, u32_t origId);
|
|
327
|
+
/// Return the type of a flattened element given a flattened index
|
|
328
|
+
const SVFType* getFlatternedElemType(const SVFType* baseType, u32_t flatten_idx);
|
|
329
|
+
/// struct A { int id; int salary; }; struct B { char name[20]; struct A a;} B b;
|
|
330
|
+
/// OriginalElemType of b with field_idx 1 : Struct A
|
|
331
|
+
/// FlatternedElemType of b with field_idx 1 : int
|
|
332
|
+
const SVFType* getOriginalElemType(const SVFType* baseType, u32_t origId) const;
|
|
333
|
+
//@}
|
|
334
|
+
|
|
335
|
+
/// Debug method
|
|
336
|
+
void printFlattenFields(const SVFType* type);
|
|
337
|
+
|
|
338
|
+
|
|
181
339
|
inline u32_t getNodeNumAfterPAGBuild() const
|
|
182
340
|
{
|
|
183
341
|
return nodeNumAfterPAGBuild;
|
|
@@ -205,11 +363,38 @@ public:
|
|
|
205
363
|
return "SVFIR";
|
|
206
364
|
}
|
|
207
365
|
|
|
366
|
+
void dumpSymTable();
|
|
367
|
+
|
|
208
368
|
/// Dump SVFIR
|
|
209
369
|
void dump(std::string name);
|
|
210
370
|
|
|
211
371
|
/// View graph from the debugger
|
|
212
372
|
void view();
|
|
373
|
+
|
|
374
|
+
|
|
375
|
+
|
|
376
|
+
///The struct type with the most fields
|
|
377
|
+
const SVFType* maxStruct;
|
|
378
|
+
|
|
379
|
+
///The number of fields in max_struct
|
|
380
|
+
u32_t maxStSize;
|
|
381
|
+
|
|
382
|
+
inline void addTypeInfo(const SVFType* ty)
|
|
383
|
+
{
|
|
384
|
+
bool inserted = svfTypes.insert(ty).second;
|
|
385
|
+
if(!inserted)
|
|
386
|
+
assert(false && "this type info has been added before");
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
inline void addStInfo(StInfo* stInfo)
|
|
390
|
+
{
|
|
391
|
+
stInfos.insert(stInfo);
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
protected:
|
|
395
|
+
|
|
396
|
+
/// Return the flattened field type for struct type only
|
|
397
|
+
const std::vector<const SVFType*>& getFlattenFieldTypes(const SVFStructType *T);
|
|
213
398
|
};
|
|
214
399
|
|
|
215
400
|
}
|
|
@@ -480,7 +480,7 @@ public:
|
|
|
480
480
|
NodeBS getModInfoForCall(const CallICFGNode* cs);
|
|
481
481
|
NodeBS getRefInfoForCall(const CallICFGNode* cs);
|
|
482
482
|
ModRefInfo getModRefInfo(const CallICFGNode* cs);
|
|
483
|
-
ModRefInfo getModRefInfo(const CallICFGNode* cs, const
|
|
483
|
+
ModRefInfo getModRefInfo(const CallICFGNode* cs, const SVFVar* V);
|
|
484
484
|
ModRefInfo getModRefInfo(const CallICFGNode* cs1, const CallICFGNode* cs2);
|
|
485
485
|
//@}
|
|
486
486
|
|
|
@@ -233,8 +233,8 @@ public:
|
|
|
233
233
|
virtual void computeDDAPts(NodeID) {}
|
|
234
234
|
|
|
235
235
|
/// Interface exposed to users of our pointer analysis, given Value infos
|
|
236
|
-
virtual AliasResult alias(const
|
|
237
|
-
const
|
|
236
|
+
virtual AliasResult alias(const SVFVar* V1,
|
|
237
|
+
const SVFVar* V2) = 0;
|
|
238
238
|
|
|
239
239
|
/// Interface exposed to users of our pointer analysis, given PAGNodeID
|
|
240
240
|
virtual AliasResult alias(NodeID node1, NodeID node2) = 0;
|
|
@@ -215,8 +215,11 @@ private:
|
|
|
215
215
|
|
|
216
216
|
public:
|
|
217
217
|
/// Interface expose to users of our pointer analysis, given Value infos
|
|
218
|
-
AliasResult alias(const
|
|
219
|
-
const
|
|
218
|
+
AliasResult alias(const SVFVar* V1,
|
|
219
|
+
const SVFVar* V2) override
|
|
220
|
+
{
|
|
221
|
+
return alias(V1->getId(), V2->getId());
|
|
222
|
+
}
|
|
220
223
|
|
|
221
224
|
/// Interface expose to users of our pointer analysis, given PAGNodeID
|
|
222
225
|
AliasResult alias(NodeID node1, NodeID node2) override;
|
|
@@ -501,9 +504,9 @@ public:
|
|
|
501
504
|
}
|
|
502
505
|
|
|
503
506
|
/// Interface expose to users of our pointer analysis, given Value infos
|
|
504
|
-
virtual inline AliasResult alias(const
|
|
507
|
+
virtual inline AliasResult alias(const SVFVar* V1, const SVFVar* V2)
|
|
505
508
|
{
|
|
506
|
-
return alias(
|
|
509
|
+
return alias(V1->getId(), V2->getId());
|
|
507
510
|
}
|
|
508
511
|
/// Interface expose to users of our pointer analysis, given two pointers
|
|
509
512
|
virtual inline AliasResult alias(NodeID node1, NodeID node2)
|