svf-lib 1.0.992 → 1.0.993
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/SVF-linux/Release-build/lib/libSvf.a +0 -0
- package/SVF-linux/include/CFL/CFGNormalizer.h +6 -3
- package/SVF-linux/include/CFL/CFLAlias.h +26 -15
- package/SVF-linux/include/CFL/CFLGrammar.h +30 -16
- package/SVF-linux/include/CFL/CFLSolver.h +9 -5
- package/SVF-linux/include/CFL/GrammarBuilder.h +10 -7
- package/SVF-linux/include/CUDD/cudd.h +20 -11
- package/SVF-linux/include/CUDD/cuddInt.h +48 -31
- package/SVF-linux/include/CUDD/epd.h +35 -29
- package/SVF-linux/include/CUDD/mtr.h +4 -3
- package/SVF-linux/include/CUDD/st.h +7 -4
- package/SVF-linux/include/CUDD/util.h +6 -6
- package/SVF-linux/include/FastCluster/fastcluster.h +13 -12
- package/SVF-linux/include/Graphs/CFLGraph.h +16 -10
- package/SVF-linux/include/Graphs/CHG.h +2 -2
- package/SVF-linux/include/Graphs/ConsG.h +2 -1
- package/SVF-linux/include/Graphs/GenericGraph.h +3 -3
- package/SVF-linux/include/Graphs/ICFG.h +2 -2
- package/SVF-linux/include/Graphs/ICFGEdge.h +16 -9
- package/SVF-linux/include/Graphs/ICFGNode.h +2 -2
- package/SVF-linux/include/Graphs/IRGraph.h +10 -6
- package/SVF-linux/include/Graphs/PTACallGraph.h +1 -1
- package/SVF-linux/include/Graphs/SVFG.h +4 -3
- package/SVF-linux/include/Graphs/SVFGNode.h +14 -8
- package/SVF-linux/include/Graphs/ThreadCallGraph.h +4 -2
- package/SVF-linux/include/Graphs/VFG.h +45 -39
- package/SVF-linux/include/Graphs/VFGNode.h +8 -4
- package/SVF-linux/include/MSSA/MemSSA.h +1 -1
- package/SVF-linux/include/MTA/FSMPTA.h +55 -44
- package/SVF-linux/include/MTA/LockAnalysis.h +11 -9
- package/SVF-linux/include/MTA/LockResultValidator.h +64 -54
- package/SVF-linux/include/MTA/MHP.h +17 -13
- package/SVF-linux/include/MTA/MTAResultValidator.h +24 -20
- package/SVF-linux/include/MTA/PCG.h +9 -7
- package/SVF-linux/include/MTA/TCT.h +27 -22
- package/SVF-linux/include/MemoryModel/LocationSet.h +5 -3
- package/SVF-linux/include/MemoryModel/PersistentPointsToCache.h +28 -13
- package/SVF-linux/include/MemoryModel/PersistentPointsToDS.h +2 -2
- package/SVF-linux/include/MemoryModel/PointerAnalysis.h +5 -4
- package/SVF-linux/include/MemoryModel/PointsTo.h +8 -2
- package/SVF-linux/include/MemoryModel/SVFIR.h +6 -5
- package/SVF-linux/include/MemoryModel/SVFStatements.h +65 -45
- package/SVF-linux/include/MemoryModel/SVFVariables.h +6 -5
- package/SVF-linux/include/MemoryModel/SymbolTableInfo.h +18 -15
- package/SVF-linux/include/SABER/PathCondAllocator.h +14 -7
- package/SVF-linux/include/SABER/ProgSlice.h +2 -1
- package/SVF-linux/include/SABER/SaberSVFGBuilder.h +1 -1
- package/SVF-linux/include/SABER/SrcSnkDDA.h +8 -4
- package/SVF-linux/include/SVF-FE/CHGBuilder.h +4 -2
- package/SVF-linux/include/SVF-FE/DataFlowUtil.h +10 -9
- package/SVF-linux/include/SVF-FE/IRAnnotator.h +8 -8
- package/SVF-linux/include/SVF-FE/LLVMModule.h +13 -12
- package/SVF-linux/include/SVF-FE/LLVMUtil.h +4 -4
- package/SVF-linux/include/SVF-FE/SVFIRBuilder.h +13 -9
- package/SVF-linux/include/SVF-FE/SymbolTableBuilder.h +3 -2
- package/SVF-linux/include/Util/BDDExpr.h +32 -16
- package/SVF-linux/include/Util/BasicTypes.h +77 -25
- package/SVF-linux/include/Util/CoreBitVector.h +2 -1
- package/SVF-linux/include/Util/CxtStmt.h +37 -27
- package/SVF-linux/include/Util/ExeState.h +42 -22
- package/SVF-linux/include/Util/ExtAPI.h +1 -1
- package/SVF-linux/include/Util/NodeIDAllocator.h +7 -4
- package/SVF-linux/include/Util/Options.h +3 -3
- package/SVF-linux/include/Util/SVFBasicTypes.h +49 -40
- package/SVF-linux/include/Util/SVFModule.h +5 -5
- package/SVF-linux/include/Util/SVFUtil.h +12 -9
- package/SVF-linux/include/Util/Z3Expr.h +191 -144
- package/SVF-linux/include/WPA/Andersen.h +11 -11
- package/SVF-linux/include/WPA/VersionedFlowSensitive.h +4 -1
- package/package.json +1 -1
|
@@ -123,7 +123,8 @@ typedef unsigned int MtrHalfWord;
|
|
|
123
123
|
typedef unsigned short MtrHalfWord;
|
|
124
124
|
#endif
|
|
125
125
|
|
|
126
|
-
typedef struct MtrNode
|
|
126
|
+
typedef struct MtrNode
|
|
127
|
+
{
|
|
127
128
|
MtrHalfWord flags;
|
|
128
129
|
MtrHalfWord low;
|
|
129
130
|
MtrHalfWord size;
|
|
@@ -166,9 +167,9 @@ extern MtrNode * Mtr_InitGroupTree (int lower, int size);
|
|
|
166
167
|
extern MtrNode * Mtr_MakeGroup (MtrNode *root, unsigned int low, unsigned int high, unsigned int flags);
|
|
167
168
|
extern MtrNode * Mtr_FindGroup (MtrNode *root, unsigned int low, unsigned int high);
|
|
168
169
|
extern void Mtr_ReorderGroups(MtrNode *treenode, int *permutation);
|
|
169
|
-
|
|
170
|
+
|
|
170
171
|
extern void Mtr_PrintGroups (MtrNode *root, int silent);
|
|
171
|
-
|
|
172
|
+
extern int Mtr_PrintGroupedOrder(MtrNode * root, int *invperm, FILE *fp);
|
|
172
173
|
|
|
173
174
|
/**AutomaticEnd***************************************************************/
|
|
174
175
|
|
|
@@ -50,14 +50,16 @@ extern "C" {
|
|
|
50
50
|
/*---------------------------------------------------------------------------*/
|
|
51
51
|
|
|
52
52
|
typedef struct st_table_entry st_table_entry;
|
|
53
|
-
struct st_table_entry
|
|
53
|
+
struct st_table_entry
|
|
54
|
+
{
|
|
54
55
|
char *key;
|
|
55
56
|
char *record;
|
|
56
57
|
st_table_entry *next;
|
|
57
58
|
};
|
|
58
59
|
|
|
59
60
|
typedef struct st_table st_table;
|
|
60
|
-
struct st_table
|
|
61
|
+
struct st_table
|
|
62
|
+
{
|
|
61
63
|
int (*compare)(const char *, const char *);
|
|
62
64
|
int (*hash)(char *, int);
|
|
63
65
|
int num_bins;
|
|
@@ -69,7 +71,8 @@ struct st_table {
|
|
|
69
71
|
};
|
|
70
72
|
|
|
71
73
|
typedef struct st_generator st_generator;
|
|
72
|
-
struct st_generator
|
|
74
|
+
struct st_generator
|
|
75
|
+
{
|
|
73
76
|
st_table *table;
|
|
74
77
|
st_table_entry *entry;
|
|
75
78
|
int index;
|
|
@@ -201,7 +204,7 @@ typedef int (*ST_PFICPI)(char *, int); /* type for hash function */
|
|
|
201
204
|
/*---------------------------------------------------------------------------*/
|
|
202
205
|
|
|
203
206
|
extern st_table *st_init_table_with_params (ST_PFICPCP, ST_PFICPI, int, int, double, int);
|
|
204
|
-
extern st_table *st_init_table (ST_PFICPCP, ST_PFICPI);
|
|
207
|
+
extern st_table *st_init_table (ST_PFICPCP, ST_PFICPI);
|
|
205
208
|
extern void st_free_table (st_table *);
|
|
206
209
|
extern int st_lookup (st_table *, void *, void *);
|
|
207
210
|
extern int st_lookup_int (st_table *, void *, int *);
|
|
@@ -109,15 +109,15 @@ extern int pclose();
|
|
|
109
109
|
# include <stdlib.h>
|
|
110
110
|
#else
|
|
111
111
|
# ifndef _IBMR2
|
|
112
|
-
|
|
112
|
+
extern VOID_OR_INT abort(), exit();
|
|
113
113
|
# endif
|
|
114
114
|
# if !defined(MNEMOSYNE) && !defined(_IBMR2)
|
|
115
|
-
|
|
116
|
-
|
|
115
|
+
extern VOID_OR_INT free (void *);
|
|
116
|
+
extern VOID_OR_CHAR *malloc(), *realloc();
|
|
117
117
|
# endif
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
118
|
+
extern char *getenv();
|
|
119
|
+
extern int system();
|
|
120
|
+
extern double atof();
|
|
121
121
|
#endif
|
|
122
122
|
|
|
123
123
|
|
|
@@ -62,18 +62,19 @@ void cutree_cdist(int n, const int* merge, double* height, double cdist, int* la
|
|
|
62
62
|
// 1 = invalid method
|
|
63
63
|
//
|
|
64
64
|
int hclust_fast(int n, double* distmat, int method, int* merge, double* height);
|
|
65
|
-
enum hclust_fast_methods
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
65
|
+
enum hclust_fast_methods
|
|
66
|
+
{
|
|
67
|
+
// single link with the minimum spanning tree algorithm (Rohlf, 1973)
|
|
68
|
+
HCLUST_METHOD_SINGLE = 0,
|
|
69
|
+
// complete link with the nearest-neighbor-chain algorithm (Murtagh, 1984)
|
|
70
|
+
HCLUST_METHOD_COMPLETE = 1,
|
|
71
|
+
// omplete link with the nearest-neighbor-chain algorithm (Murtagh, 1984)
|
|
72
|
+
HCLUST_METHOD_AVERAGE = 2,
|
|
73
|
+
// median link with the generic algorithm (Müllner, 2011)
|
|
74
|
+
HCLUST_METHOD_MEDIAN = 3,
|
|
75
|
+
// To indicate to try all methods and pick the best.
|
|
76
|
+
HCLUST_METHOD_SVF_BEST = 4
|
|
76
77
|
};
|
|
77
|
-
|
|
78
|
+
|
|
78
79
|
|
|
79
80
|
#endif
|
|
@@ -81,13 +81,16 @@ public:
|
|
|
81
81
|
~CFLGraph() override = default;
|
|
82
82
|
|
|
83
83
|
/// Build graph by copying nodes and edges from any graph inherited from GenericGraph
|
|
84
|
-
template<class N, class E>
|
|
85
|
-
void build(GenericGraph<N,E>* graph)
|
|
86
|
-
|
|
84
|
+
template<class N, class E>
|
|
85
|
+
void build(GenericGraph<N,E>* graph)
|
|
86
|
+
{
|
|
87
|
+
for(auto it = graph->begin(); it!= graph->end(); it++)
|
|
88
|
+
{
|
|
87
89
|
CFLNode* node = new CFLNode((*it).first);
|
|
88
90
|
addCFLNode((*it).first, node);
|
|
89
91
|
}
|
|
90
|
-
for(auto it = graph->begin(); it!= graph->end(); it++)
|
|
92
|
+
for(auto it = graph->begin(); it!= graph->end(); it++)
|
|
93
|
+
{
|
|
91
94
|
N* node = (*it).second;
|
|
92
95
|
for(E* edge : node->getOutEdges())
|
|
93
96
|
{
|
|
@@ -97,18 +100,21 @@ public:
|
|
|
97
100
|
}
|
|
98
101
|
|
|
99
102
|
/// Build Bidirectional graph by copying nodes and edges from any graph inherited from GenericGraph
|
|
100
|
-
template<class N, class E>
|
|
101
|
-
void buildBigraph(GenericGraph<N,E>* graph)
|
|
102
|
-
|
|
103
|
+
template<class N, class E>
|
|
104
|
+
void buildBigraph(GenericGraph<N,E>* graph)
|
|
105
|
+
{
|
|
106
|
+
for(auto it = graph->begin(); it!= graph->end(); it++)
|
|
107
|
+
{
|
|
103
108
|
CFLNode* node = new CFLNode((*it).first);
|
|
104
109
|
addCFLNode((*it).first, node);
|
|
105
110
|
}
|
|
106
|
-
for(auto it = graph->begin(); it!= graph->end(); it++)
|
|
111
|
+
for(auto it = graph->begin(); it!= graph->end(); it++)
|
|
112
|
+
{
|
|
107
113
|
N* node = (*it).second;
|
|
108
114
|
for(E* edge : node->getOutEdges())
|
|
109
115
|
{
|
|
110
116
|
addCFLEdge(getGNode(edge->getSrcID()), getGNode(edge->getDstID()), edge->getEdgeKind());
|
|
111
|
-
std::string key = "";
|
|
117
|
+
std::string key = "";
|
|
112
118
|
for (auto &i : this->label2SymMap)
|
|
113
119
|
{
|
|
114
120
|
if (i.second == edge->getEdgeKind())
|
|
@@ -134,7 +140,7 @@ public:
|
|
|
134
140
|
|
|
135
141
|
/// Build graph from file
|
|
136
142
|
void build(std::string filename);
|
|
137
|
-
|
|
143
|
+
|
|
138
144
|
/// Build graph from Dot
|
|
139
145
|
void buildFromDot(std::string filename);
|
|
140
146
|
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
*
|
|
26
26
|
* Created on: Apr 13, 2016
|
|
27
27
|
* Author: Xiaokang Fan
|
|
28
|
-
*
|
|
28
|
+
*
|
|
29
29
|
* Created on: Aug 24, 2019
|
|
30
30
|
* Author: Mohamad Barbar
|
|
31
31
|
*/
|
|
@@ -207,7 +207,7 @@ private:
|
|
|
207
207
|
typedef GenericGraph<CHNode,CHEdge> GenericCHGraphTy;
|
|
208
208
|
class CHGraph: public CommonCHGraph, public GenericCHGraphTy
|
|
209
209
|
{
|
|
210
|
-
friend class CHGBuilder;
|
|
210
|
+
friend class CHGBuilder;
|
|
211
211
|
|
|
212
212
|
public:
|
|
213
213
|
typedef Set<const CHNode*> CHNodeSetTy;
|
|
@@ -157,8 +157,8 @@ public:
|
|
|
157
157
|
/// Destructor
|
|
158
158
|
virtual ~GenericNode()
|
|
159
159
|
{
|
|
160
|
-
|
|
161
|
-
|
|
160
|
+
for (auto * edge : OutEdges)
|
|
161
|
+
delete edge;
|
|
162
162
|
}
|
|
163
163
|
|
|
164
164
|
/// Get ID
|
|
@@ -354,7 +354,7 @@ public:
|
|
|
354
354
|
void destroy()
|
|
355
355
|
{
|
|
356
356
|
for (auto &entry : IDToNodeMap)
|
|
357
|
-
|
|
357
|
+
delete entry.second;
|
|
358
358
|
}
|
|
359
359
|
/// Iterators
|
|
360
360
|
//@{
|
|
@@ -46,7 +46,7 @@ typedef GenericGraph<ICFGNode,ICFGEdge> GenericICFGTy;
|
|
|
46
46
|
class ICFG : public GenericICFGTy
|
|
47
47
|
{
|
|
48
48
|
|
|
49
|
-
friend class ICFGBuilder;
|
|
49
|
+
friend class ICFGBuilder;
|
|
50
50
|
|
|
51
51
|
public:
|
|
52
52
|
|
|
@@ -182,7 +182,7 @@ public:
|
|
|
182
182
|
//@}
|
|
183
183
|
|
|
184
184
|
private:
|
|
185
|
-
|
|
185
|
+
|
|
186
186
|
/// Get/Add IntraBlock ICFGNode
|
|
187
187
|
inline IntraICFGNode* getIntraBlock(const Instruction* inst)
|
|
188
188
|
{
|
|
@@ -134,16 +134,19 @@ public:
|
|
|
134
134
|
}
|
|
135
135
|
//@}
|
|
136
136
|
|
|
137
|
-
const Value* getCondition() const
|
|
137
|
+
const Value* getCondition() const
|
|
138
|
+
{
|
|
138
139
|
return conditionVar;
|
|
139
140
|
}
|
|
140
141
|
|
|
141
|
-
s32_t getSuccessorCondValue() const
|
|
142
|
+
s32_t getSuccessorCondValue() const
|
|
143
|
+
{
|
|
142
144
|
assert(getCondition() && "this is not a conditional branch edge");
|
|
143
145
|
return branchCondVal;
|
|
144
146
|
}
|
|
145
147
|
|
|
146
|
-
void setBranchCondition(const Value* c, s32_t bVal)
|
|
148
|
+
void setBranchCondition(const Value* c, s32_t bVal)
|
|
149
|
+
{
|
|
147
150
|
conditionVar = c;
|
|
148
151
|
branchCondVal = bVal;
|
|
149
152
|
}
|
|
@@ -166,7 +169,7 @@ class CallCFGEdge : public ICFGEdge
|
|
|
166
169
|
{
|
|
167
170
|
|
|
168
171
|
private:
|
|
169
|
-
|
|
172
|
+
const Instruction* cs;
|
|
170
173
|
std::vector<const CallPE*> callPEs;
|
|
171
174
|
public:
|
|
172
175
|
/// Constructor
|
|
@@ -180,11 +183,13 @@ public:
|
|
|
180
183
|
return cs;
|
|
181
184
|
}
|
|
182
185
|
/// Add call parameter edge to this CallCFGEdge
|
|
183
|
-
inline void addCallPE(const CallPE* callPE)
|
|
186
|
+
inline void addCallPE(const CallPE* callPE)
|
|
187
|
+
{
|
|
184
188
|
callPEs.push_back(callPE);
|
|
185
189
|
}
|
|
186
190
|
/// Add get parameter edge to this CallCFGEdge
|
|
187
|
-
inline const std::vector<const CallPE*>& getCallPEs() const
|
|
191
|
+
inline const std::vector<const CallPE*>& getCallPEs() const
|
|
192
|
+
{
|
|
188
193
|
return callPEs;
|
|
189
194
|
}
|
|
190
195
|
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
@@ -212,7 +217,7 @@ class RetCFGEdge : public ICFGEdge
|
|
|
212
217
|
{
|
|
213
218
|
|
|
214
219
|
private:
|
|
215
|
-
|
|
220
|
+
const Instruction* cs;
|
|
216
221
|
const RetPE* retPE;
|
|
217
222
|
public:
|
|
218
223
|
/// Constructor
|
|
@@ -226,12 +231,14 @@ public:
|
|
|
226
231
|
return cs;
|
|
227
232
|
}
|
|
228
233
|
/// Add call parameter edge to this CallCFGEdge
|
|
229
|
-
inline void addRetPE(const RetPE* ret)
|
|
234
|
+
inline void addRetPE(const RetPE* ret)
|
|
235
|
+
{
|
|
230
236
|
assert(retPE==nullptr && "we can only have one retPE for each RetCFGEdge");
|
|
231
237
|
retPE = ret;
|
|
232
238
|
}
|
|
233
239
|
/// Add get parameter edge to this CallCFGEdge
|
|
234
|
-
inline const RetPE* getRetPE() const
|
|
240
|
+
inline const RetPE* getRetPE() const
|
|
241
|
+
{
|
|
235
242
|
return retPE;
|
|
236
243
|
}
|
|
237
244
|
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
@@ -145,7 +145,7 @@ class GlobalICFGNode : public ICFGNode
|
|
|
145
145
|
public:
|
|
146
146
|
GlobalICFGNode(NodeID id) : ICFGNode(id, GlobalBlock)
|
|
147
147
|
{
|
|
148
|
-
|
|
148
|
+
bb = nullptr;
|
|
149
149
|
}
|
|
150
150
|
|
|
151
151
|
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
@@ -385,7 +385,7 @@ public:
|
|
|
385
385
|
/// Return callsite
|
|
386
386
|
inline const RetICFGNode* getRetICFGNode() const
|
|
387
387
|
{
|
|
388
|
-
|
|
388
|
+
assert(ret && "RetICFGNode not set?");
|
|
389
389
|
return ret;
|
|
390
390
|
}
|
|
391
391
|
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
//===----------------------------------------------------------------------===//
|
|
22
22
|
|
|
23
23
|
/*
|
|
24
|
-
* IRGraph.h
|
|
24
|
+
* IRGraph.h
|
|
25
25
|
*
|
|
26
26
|
* Created on: Nov 1, 2013
|
|
27
27
|
* Author: Yulei Sui
|
|
@@ -81,17 +81,20 @@ protected:
|
|
|
81
81
|
inline void mapValueToEdge(const Value *V, SVFStmt *edge)
|
|
82
82
|
{
|
|
83
83
|
auto inserted = valueToEdgeMap.emplace(V, SVFStmtSet{edge});
|
|
84
|
-
if (!inserted.second)
|
|
84
|
+
if (!inserted.second)
|
|
85
|
+
{
|
|
85
86
|
inserted.first->second.emplace(edge);
|
|
86
87
|
}
|
|
87
88
|
}
|
|
88
89
|
/// get MemObj according to LLVM value
|
|
89
|
-
inline const MemObj* getMemObj(const Value* val) const
|
|
90
|
+
inline const MemObj* getMemObj(const Value* val) const
|
|
91
|
+
{
|
|
90
92
|
return symInfo->getObj(symInfo->getObjSym(val));
|
|
91
93
|
}
|
|
92
|
-
|
|
94
|
+
|
|
93
95
|
public:
|
|
94
|
-
IRGraph(bool buildFromFile): fromFile(buildFromFile), nodeNumAfterPAGBuild(0), totalPTAPAGEdge(0)
|
|
96
|
+
IRGraph(bool buildFromFile): fromFile(buildFromFile), nodeNumAfterPAGBuild(0), totalPTAPAGEdge(0)
|
|
97
|
+
{
|
|
95
98
|
symInfo = SymbolTableInfo::SymbolInfo();
|
|
96
99
|
// insert dummy value if a correct value cannot be found
|
|
97
100
|
valueToEdgeMap[nullptr] = SVFStmtSet();
|
|
@@ -108,7 +111,8 @@ public:
|
|
|
108
111
|
inline const SVFStmtSet& getValueEdges(const Value *V)
|
|
109
112
|
{
|
|
110
113
|
auto it = valueToEdgeMap.find(V);
|
|
111
|
-
if (it == valueToEdgeMap.end())
|
|
114
|
+
if (it == valueToEdgeMap.end())
|
|
115
|
+
{
|
|
112
116
|
//special empty set
|
|
113
117
|
return valueToEdgeMap.at(nullptr);
|
|
114
118
|
}
|
|
@@ -251,7 +251,8 @@ public:
|
|
|
251
251
|
}
|
|
252
252
|
|
|
253
253
|
/// Return total SVFG node number
|
|
254
|
-
inline u32_t getSVFGNodeNum() const
|
|
254
|
+
inline u32_t getSVFGNodeNum() const
|
|
255
|
+
{
|
|
255
256
|
return nodeNum;
|
|
256
257
|
}
|
|
257
258
|
|
|
@@ -428,8 +429,8 @@ protected:
|
|
|
428
429
|
}
|
|
429
430
|
|
|
430
431
|
/// Add memory SSA PHI SVFG node
|
|
431
|
-
inline void addIntraMSSAPHISVFGNode(ICFGNode* BlockICFGNode, const Map<u32_t,const MRVer*>::const_iterator opVerBegin,
|
|
432
|
-
|
|
432
|
+
inline void addIntraMSSAPHISVFGNode(ICFGNode* BlockICFGNode, const Map<u32_t,const MRVer*>::const_iterator opVerBegin,
|
|
433
|
+
const Map<u32_t,const MRVer*>::const_iterator opVerEnd, const MRVer* resVer, const NodeID nodeId)
|
|
433
434
|
{
|
|
434
435
|
IntraMSSAPHISVFGNode* sNode = new IntraMSSAPHISVFGNode(nodeId, resVer);
|
|
435
436
|
addSVFGNode(sNode, BlockICFGNode);
|
|
@@ -94,7 +94,7 @@ class FormalINSVFGNode : public MRSVFGNode
|
|
|
94
94
|
{
|
|
95
95
|
private:
|
|
96
96
|
const MRVer* ver;
|
|
97
|
-
const FunEntryICFGNode* funEntryNode;
|
|
97
|
+
const FunEntryICFGNode* funEntryNode;
|
|
98
98
|
|
|
99
99
|
public:
|
|
100
100
|
/// Constructor
|
|
@@ -102,7 +102,7 @@ public:
|
|
|
102
102
|
{
|
|
103
103
|
cpts = resVer->getMR()->getPointsTo();
|
|
104
104
|
ver = resVer;
|
|
105
|
-
funEntryNode = funEntry;
|
|
105
|
+
funEntryNode = funEntry;
|
|
106
106
|
}
|
|
107
107
|
inline const MRVer* getMRVer() const
|
|
108
108
|
{
|
|
@@ -139,7 +139,7 @@ class FormalOUTSVFGNode : public MRSVFGNode
|
|
|
139
139
|
{
|
|
140
140
|
private:
|
|
141
141
|
const MRVer* ver;
|
|
142
|
-
const FunExitICFGNode* funExitNode;
|
|
142
|
+
const FunExitICFGNode* funExitNode;
|
|
143
143
|
|
|
144
144
|
public:
|
|
145
145
|
/// Constructor
|
|
@@ -279,7 +279,7 @@ public:
|
|
|
279
279
|
typedef Map<u32_t,const MRVer*> OPVers;
|
|
280
280
|
|
|
281
281
|
protected:
|
|
282
|
-
const MRVer* ver;
|
|
282
|
+
const MRVer* ver;
|
|
283
283
|
OPVers opVers;
|
|
284
284
|
|
|
285
285
|
public:
|
|
@@ -287,9 +287,9 @@ public:
|
|
|
287
287
|
MSSAPHISVFGNode(NodeID id, const MRVer* resVer,VFGNodeK k = MPhi): MRSVFGNode(id, k)
|
|
288
288
|
{
|
|
289
289
|
cpts = resVer->getMR()->getPointsTo();
|
|
290
|
-
ver = resVer;
|
|
290
|
+
ver = resVer;
|
|
291
291
|
}
|
|
292
|
-
|
|
292
|
+
/// Ver
|
|
293
293
|
inline const MRVer* getResVer() const
|
|
294
294
|
{
|
|
295
295
|
return ver;
|
|
@@ -473,8 +473,14 @@ public:
|
|
|
473
473
|
: VFGNode(id, DummyVProp), object(object), version(version)
|
|
474
474
|
{ }
|
|
475
475
|
|
|
476
|
-
NodeID getObject(void) const
|
|
477
|
-
|
|
476
|
+
NodeID getObject(void) const
|
|
477
|
+
{
|
|
478
|
+
return object;
|
|
479
|
+
}
|
|
480
|
+
Version getVersion(void) const
|
|
481
|
+
{
|
|
482
|
+
return version;
|
|
483
|
+
}
|
|
478
484
|
|
|
479
485
|
/// Methods to support type inquiry through isa, cast, and dyn_cast:
|
|
480
486
|
//@{
|
|
@@ -67,7 +67,8 @@ public:
|
|
|
67
67
|
}
|
|
68
68
|
//@}
|
|
69
69
|
|
|
70
|
-
virtual const std::string toString() const
|
|
70
|
+
virtual const std::string toString() const
|
|
71
|
+
{
|
|
71
72
|
std::string str;
|
|
72
73
|
raw_string_ostream rawstr(str);
|
|
73
74
|
rawstr << "ThreadForkEdge ";
|
|
@@ -106,7 +107,8 @@ public:
|
|
|
106
107
|
return edge->getEdgeKind() == PTACallGraphEdge::TDJoinEdge;
|
|
107
108
|
}
|
|
108
109
|
|
|
109
|
-
virtual const std::string toString() const
|
|
110
|
+
virtual const std::string toString() const
|
|
111
|
+
{
|
|
110
112
|
std::string str;
|
|
111
113
|
raw_string_ostream rawstr(str);
|
|
112
114
|
rawstr << "ThreadJoinEdge ";
|
|
@@ -281,28 +281,33 @@ public:
|
|
|
281
281
|
return false;
|
|
282
282
|
}
|
|
283
283
|
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
284
|
+
/// Return all the VFGNodes of a function
|
|
285
|
+
///@{
|
|
286
|
+
inline VFGNodeSet& getVFGNodes(const SVFFunction *fun)
|
|
287
|
+
{
|
|
288
|
+
return funToVFGNodesMap[fun];
|
|
289
|
+
}
|
|
290
|
+
inline bool hasVFGNodes(const SVFFunction *fun) const
|
|
291
|
+
{
|
|
292
|
+
return funToVFGNodesMap.find(fun) != funToVFGNodesMap.end();
|
|
293
|
+
}
|
|
294
|
+
inline bool VFGNodes(const SVFFunction *fun) const
|
|
295
|
+
{
|
|
296
|
+
return funToVFGNodesMap.find(fun) != funToVFGNodesMap.end();
|
|
297
|
+
}
|
|
298
|
+
inline VFGNodeSet::const_iterator getVFGNodeBegin(const SVFFunction *fun) const
|
|
299
|
+
{
|
|
300
|
+
FunToVFGNodesMapTy::const_iterator it = funToVFGNodesMap.find(fun);
|
|
301
|
+
assert(it != funToVFGNodesMap.end() && "this function does not have any VFGNode");
|
|
302
|
+
return it->second.begin();
|
|
303
|
+
}
|
|
304
|
+
inline VFGNodeSet::const_iterator getVFGNodeEnd(const SVFFunction *fun) const
|
|
305
|
+
{
|
|
306
|
+
FunToVFGNodesMapTy::const_iterator it = funToVFGNodesMap.find(fun);
|
|
307
|
+
assert(it != funToVFGNodesMap.end() && "this function does not have any VFGNode");
|
|
308
|
+
return it->second.end();
|
|
309
|
+
}
|
|
310
|
+
///@}
|
|
306
311
|
/// Add control-flow edges for top level pointers
|
|
307
312
|
//@{
|
|
308
313
|
VFGEdge* addIntraDirectVFEdge(NodeID srcId, NodeID dstId);
|
|
@@ -462,9 +467,9 @@ protected:
|
|
|
462
467
|
icfgNode->addVFGNode(vfgNode);
|
|
463
468
|
|
|
464
469
|
if(const SVFFunction* fun = icfgNode->getFun())
|
|
465
|
-
|
|
470
|
+
funToVFGNodesMap[fun].insert(vfgNode);
|
|
466
471
|
else
|
|
467
|
-
|
|
472
|
+
globalVFGNodes.insert(vfgNode);
|
|
468
473
|
}
|
|
469
474
|
|
|
470
475
|
/// Add a VFG node for program statement
|
|
@@ -545,20 +550,21 @@ protected:
|
|
|
545
550
|
/// Otherwise, we need to handle formalRet using <PAGNodeID,CallSiteID> pair to find FormalRetVFG node same as handling actual parameters
|
|
546
551
|
inline void addFormalRetVFGNode(const PAGNode* uniqueFunRet, const SVFFunction* fun, RetPESet& retPEs)
|
|
547
552
|
{
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
553
|
+
FormalRetVFGNode *sNode = new FormalRetVFGNode(totalVFGNode++, uniqueFunRet, fun);
|
|
554
|
+
addVFGNode(sNode, pag->getICFG()->getFunExitICFGNode(fun));
|
|
555
|
+
for (RetPESet::const_iterator it = retPEs.begin(), eit = retPEs.end(); it != eit; ++it)
|
|
556
|
+
sNode->addRetPE(*it);
|
|
557
|
+
|
|
558
|
+
PAGNodeToFormalRetMap[uniqueFunRet] = sNode;
|
|
559
|
+
/// if this uniqueFunRet is a phi node, which means it will receive values from multiple return instructions of fun
|
|
560
|
+
/// we will set this phi node's def later
|
|
561
|
+
/// Ideally, every function uniqueFunRet should be a PhiNode (SVFIRBuilder.cpp), unless it does not have ret instruction
|
|
562
|
+
if (!pag->isPhiNode(uniqueFunRet))
|
|
563
|
+
{
|
|
564
|
+
std::string warn = fun->getName();
|
|
565
|
+
SVFUtil::writeWrnMsg(warn + " does not have any ret instruction!");
|
|
566
|
+
setDef(uniqueFunRet, sNode);
|
|
567
|
+
}
|
|
562
568
|
}
|
|
563
569
|
/// Add a callsite Receive VFG node
|
|
564
570
|
inline void addActualRetVFGNode(const PAGNode* ret,const CallICFGNode* cs)
|
|
@@ -619,7 +625,7 @@ protected:
|
|
|
619
625
|
setDef(edge->getRes(),sNode);
|
|
620
626
|
PAGNodeToUnaryOPVFGNodeMap[edge->getRes()] = sNode;
|
|
621
627
|
}
|
|
622
|
-
/// Add a BranchVFGNode
|
|
628
|
+
/// Add a BranchVFGNode
|
|
623
629
|
inline void addBranchVFGNode(const BranchStmt* edge)
|
|
624
630
|
{
|
|
625
631
|
BranchVFGNode* sNode = new BranchVFGNode(totalVFGNode++, edge);
|
|
@@ -563,18 +563,22 @@ public:
|
|
|
563
563
|
//@}
|
|
564
564
|
|
|
565
565
|
/// Return the branch statement
|
|
566
|
-
const BranchStmt* getBranchStmt() const
|
|
566
|
+
const BranchStmt* getBranchStmt() const
|
|
567
|
+
{
|
|
567
568
|
return brstmt;
|
|
568
569
|
}
|
|
569
570
|
/// Successors of this branch statement
|
|
570
571
|
///@{
|
|
571
|
-
u32_t getNumSuccessors() const
|
|
572
|
+
u32_t getNumSuccessors() const
|
|
573
|
+
{
|
|
572
574
|
return brstmt->getNumSuccessors();
|
|
573
575
|
}
|
|
574
|
-
const BranchStmt::SuccAndCondPairVec& getSuccessors() const
|
|
576
|
+
const BranchStmt::SuccAndCondPairVec& getSuccessors() const
|
|
577
|
+
{
|
|
575
578
|
return brstmt->getSuccessors();
|
|
576
579
|
}
|
|
577
|
-
const ICFGNode* getSuccessor (u32_t i) const
|
|
580
|
+
const ICFGNode* getSuccessor (u32_t i) const
|
|
581
|
+
{
|
|
578
582
|
return brstmt->getSuccessor(i);
|
|
579
583
|
}
|
|
580
584
|
///@}
|