svf-lib 1.0.1820 → 1.0.1821
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-osx/Release-build/svf/libSvfCore.a +0 -0
- package/SVF-osx/Release-build/svf-llvm/libSvfLLVM.a +0 -0
- package/SVF-osx/svf/include/AbstractExecution/BoundedZ3Expr.h +2 -0
- package/SVF-osx/svf/include/AbstractExecution/CFBasicBlockGWTO.h +83 -0
- package/SVF-osx/svf/include/AbstractExecution/ConsExeState.h +8 -0
- package/SVF-osx/svf/include/AbstractExecution/ExeState.h +8 -0
- package/SVF-osx/svf/include/AbstractExecution/ICFGWTO.h +78 -0
- package/SVF-osx/svf/include/AbstractExecution/IntervalExeState.h +7 -0
- package/SVF-osx/svf/include/AbstractExecution/IntervalValue.h +3 -0
- package/SVF-osx/svf/include/AbstractExecution/NumericLiteral.h +2 -0
- package/SVF-osx/svf/include/AbstractExecution/RelExeState.h +1 -0
- package/SVF-osx/svf/include/AbstractExecution/RelationSolver.h +1 -0
- package/SVF-osx/svf/include/AbstractExecution/SVFIR2ConsExeState.h +1 -0
- package/SVF-osx/svf/include/AbstractExecution/SVFIR2ItvExeState.h +4 -0
- package/SVF-osx/svf/include/AbstractExecution/SingleAbsValue.h +2 -0
- package/SVF-osx/svf/include/AbstractExecution/SymState.h +4 -0
- package/SVF-osx/svf/include/CFL/CFGrammar.h +4 -0
- package/SVF-osx/svf/include/CFL/CFLAlias.h +1 -0
- package/SVF-osx/svf/include/CFL/CFLGraphBuilder.h +1 -0
- package/SVF-osx/svf/include/CFL/CFLStat.h +1 -0
- package/SVF-osx/svf/include/CFL/CFLVF.h +1 -0
- package/SVF-osx/svf/include/DDA/ContextDDA.h +1 -0
- package/SVF-osx/svf/include/DDA/DDAClient.h +5 -0
- package/SVF-osx/svf/include/DDA/DDAPass.h +3 -2
- package/SVF-osx/svf/include/DDA/DDAVFSolver.h +2 -2
- package/SVF-osx/svf/include/FastCluster/fastcluster.h +1 -0
- package/SVF-osx/svf/include/Graphs/CDG.h +3 -0
- package/SVF-osx/svf/include/Graphs/CFBasicBlockG.h +3 -0
- package/SVF-osx/svf/include/Graphs/CFLGraph.h +1 -0
- package/SVF-osx/svf/include/Graphs/CHG.h +4 -2
- package/SVF-osx/svf/include/Graphs/ConsGEdge.h +5 -0
- package/SVF-osx/svf/include/Graphs/ConsGNode.h +1 -0
- package/SVF-osx/svf/include/Graphs/DOTGraphTraits.h +1 -0
- package/SVF-osx/svf/include/Graphs/GenericGraph.h +1 -0
- package/SVF-osx/svf/include/Graphs/GraphPrinter.h +3 -0
- package/SVF-osx/svf/include/Graphs/GraphTraits.h +2 -2
- package/SVF-osx/svf/include/Graphs/ICFG.h +1 -0
- package/SVF-osx/svf/include/Graphs/ICFGNode.h +3 -0
- package/SVF-osx/svf/include/Graphs/ICFGStat.h +2 -0
- package/SVF-osx/svf/include/Graphs/IRGraph.h +1 -0
- package/SVF-osx/svf/include/Graphs/PTACallGraph.h +3 -0
- package/SVF-osx/svf/include/Graphs/SCC.h +354 -0
- package/SVF-osx/svf/include/Graphs/SVFG.h +2 -0
- package/SVF-osx/svf/include/Graphs/SVFGEdge.h +1 -0
- package/SVF-osx/svf/include/Graphs/SVFGNode.h +7 -0
- package/SVF-osx/svf/include/Graphs/SVFGOPT.h +3 -0
- package/SVF-osx/svf/include/Graphs/SVFGStat.h +3 -1
- package/SVF-osx/svf/include/Graphs/ThreadCallGraph.h +3 -0
- package/SVF-osx/svf/include/Graphs/VFG.h +2 -0
- package/SVF-osx/svf/include/Graphs/VFGEdge.h +3 -0
- package/SVF-osx/svf/include/Graphs/VFGNode.h +8 -0
- package/SVF-osx/svf/include/Graphs/WTO.h +859 -0
- package/SVF-osx/svf/include/MSSA/MSSAMuChi.h +4 -0
- package/SVF-osx/svf/include/MSSA/MemPartition.h +1 -0
- package/SVF-osx/svf/include/MSSA/MemRegion.h +4 -3
- package/SVF-osx/svf/include/MSSA/MemSSA.h +1 -0
- package/SVF-osx/svf/include/MTA/FSMPTA.h +6 -0
- package/SVF-osx/svf/include/MTA/LockAnalysis.h +5 -0
- package/SVF-osx/svf/include/MTA/MHP.h +3 -0
- package/SVF-osx/svf/include/MTA/MTA.h +1 -0
- package/SVF-osx/svf/include/MTA/MTAResultValidator.h +2 -0
- package/SVF-osx/svf/include/MTA/TCT.h +3 -2
- package/SVF-osx/svf/include/MemoryModel/AbstractPointsToDS.h +2 -0
- package/SVF-osx/svf/include/MemoryModel/AccessPath.h +5 -0
- package/SVF-osx/svf/include/MemoryModel/ConditionalPT.h +5 -0
- package/SVF-osx/svf/include/MemoryModel/PersistentPointsToDS.h +1 -0
- package/SVF-osx/svf/include/MemoryModel/PointerAnalysis.h +6 -5
- package/SVF-osx/svf/include/MemoryModel/PointerAnalysisImpl.h +1 -0
- package/SVF-osx/svf/include/MemoryModel/PointsTo.h +1 -0
- package/SVF-osx/svf/include/SABER/DoubleFreeChecker.h +1 -0
- package/SVF-osx/svf/include/SABER/ProgSlice.h +1 -0
- package/SVF-osx/svf/include/SABER/SaberCondAllocator.h +4 -0
- package/SVF-osx/svf/include/SABER/SaberSVFGBuilder.h +1 -0
- package/SVF-osx/svf/include/SVFIR/SVFIR.h +2 -0
- package/SVF-osx/svf/include/SVFIR/SVFStatements.h +2 -0
- package/SVF-osx/svf/include/SVFIR/SVFType.h +2 -0
- package/SVF-osx/svf/include/SVFIR/SVFValue.h +3 -0
- package/SVF-osx/svf/include/SVFIR/SVFVariables.h +5 -0
- package/SVF-osx/svf/include/SVFIR/SymbolTableInfo.h +5 -0
- package/SVF-osx/svf/include/Util/CDGBuilder.h +8 -0
- package/SVF-osx/svf/include/Util/CallGraphBuilder.h +2 -0
- package/SVF-osx/svf/include/Util/Casting.h +2 -1
- package/SVF-osx/svf/include/Util/CommandLine.h +1 -0
- package/SVF-osx/svf/include/Util/CxtStmt.h +4 -0
- package/SVF-osx/svf/include/Util/DPItem.h +2 -0
- package/SVF-osx/svf/include/Util/NodeIDAllocator.h +2 -2
- package/SVF-osx/svf/include/Util/PTAStat.h +1 -0
- package/SVF-osx/svf/include/Util/SVFBugReport.h +1 -0
- package/SVF-osx/svf/include/Util/SVFStat.h +1 -0
- package/SVF-osx/svf/include/Util/SVFUtil.h +1 -0
- package/SVF-osx/svf/include/Util/ThreadAPI.h +1 -0
- package/SVF-osx/svf/include/Util/WorkList.h +1 -0
- package/SVF-osx/svf/include/Util/Z3Expr.h +4 -0
- package/SVF-osx/svf/include/Util/iterator.h +2 -2
- package/SVF-osx/svf/include/WPA/Andersen.h +6 -0
- package/SVF-osx/svf/include/WPA/AndersenPWC.h +3 -0
- package/SVF-osx/svf/include/WPA/CSC.h +3 -3
- package/SVF-osx/svf/include/WPA/WPAFSSolver.h +5 -0
- package/SVF-osx/svf/include/WPA/WPAPass.h +2 -0
- package/SVF-osx/svf/include/WPA/WPASolver.h +2 -0
- package/SVF-osx/svf/include/WPA/WPAStat.h +1 -0
- package/SVF-osx/svf-llvm/include/SVF-LLVM/BreakConstantExpr.h +1 -0
- package/SVF-osx/svf-llvm/include/SVF-LLVM/DCHG.h +1 -0
- package/SVF-osx/svf-llvm/include/SVF-LLVM/GEPTypeBridgeIterator.h +3 -0
- package/SVF-osx/svf-llvm/include/SVF-LLVM/LLVMModule.h +1 -0
- package/SVF-osx/svf-llvm/include/SVF-LLVM/LLVMUtil.h +1 -0
- package/SVF-osx/svf-llvm/include/SVF-LLVM/SVFIRBuilder.h +1 -0
- package/SVF-osx/svf-llvm/include/SVF-LLVM/SymbolTableBuilder.h +1 -0
- package/package.json +1 -1
|
@@ -86,6 +86,7 @@ public:
|
|
|
86
86
|
|
|
87
87
|
};
|
|
88
88
|
|
|
89
|
+
|
|
89
90
|
/*!
|
|
90
91
|
* Copy edge
|
|
91
92
|
*/
|
|
@@ -116,6 +117,7 @@ public:
|
|
|
116
117
|
AddrCGEdge(ConstraintNode* s, ConstraintNode* d, EdgeID id);
|
|
117
118
|
};
|
|
118
119
|
|
|
120
|
+
|
|
119
121
|
/*!
|
|
120
122
|
* Copy edge
|
|
121
123
|
*/
|
|
@@ -148,6 +150,7 @@ public:
|
|
|
148
150
|
}
|
|
149
151
|
};
|
|
150
152
|
|
|
153
|
+
|
|
151
154
|
/*!
|
|
152
155
|
* Store edge
|
|
153
156
|
*/
|
|
@@ -181,6 +184,7 @@ public:
|
|
|
181
184
|
}
|
|
182
185
|
};
|
|
183
186
|
|
|
187
|
+
|
|
184
188
|
/*!
|
|
185
189
|
* Load edge
|
|
186
190
|
*/
|
|
@@ -214,6 +218,7 @@ public:
|
|
|
214
218
|
}
|
|
215
219
|
};
|
|
216
220
|
|
|
221
|
+
|
|
217
222
|
/*!
|
|
218
223
|
* Gep edge
|
|
219
224
|
*/
|
|
@@ -172,6 +172,7 @@ public:
|
|
|
172
172
|
static void addCustomGraphFeatures(const GraphType &, GraphWriter &) {}
|
|
173
173
|
};
|
|
174
174
|
|
|
175
|
+
|
|
175
176
|
/// DOTGraphTraits - Template class that can be specialized to customize how
|
|
176
177
|
/// graphs are converted to 'dot' graphs. When specializing, you may inherit
|
|
177
178
|
/// from DefaultDOTGraphTraits if you don't need to override everything.
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
//
|
|
21
21
|
//===----------------------------------------------------------------------===//
|
|
22
22
|
|
|
23
|
+
|
|
23
24
|
/*
|
|
24
25
|
* GraphPrinter.h
|
|
25
26
|
*
|
|
@@ -105,4 +106,6 @@ public:
|
|
|
105
106
|
|
|
106
107
|
} // End namespace llvm
|
|
107
108
|
|
|
109
|
+
|
|
110
|
+
|
|
108
111
|
#endif /* INCLUDE_GRAPHS_GRAPHPRINTER_H_ */
|
|
@@ -115,7 +115,7 @@ nodes(const GraphType &G)
|
|
|
115
115
|
}
|
|
116
116
|
template <class GraphType>
|
|
117
117
|
iter_range<typename GenericGraphTraits<Inverse<GraphType>>::nodes_iterator>
|
|
118
|
-
|
|
118
|
+
inverse_nodes(const GraphType &G)
|
|
119
119
|
{
|
|
120
120
|
return make_range(GenericGraphTraits<Inverse<GraphType>>::nodes_begin(G),
|
|
121
121
|
GenericGraphTraits<Inverse<GraphType>>::nodes_end(G));
|
|
@@ -131,7 +131,7 @@ children(const typename GenericGraphTraits<GraphType>::NodeRef &G)
|
|
|
131
131
|
|
|
132
132
|
template <class GraphType>
|
|
133
133
|
iter_range<typename GenericGraphTraits<Inverse<GraphType>>::ChildIteratorType>
|
|
134
|
-
|
|
134
|
+
inverse_children(const typename GenericGraphTraits<GraphType>::NodeRef &G)
|
|
135
135
|
{
|
|
136
136
|
return make_range(GenericGraphTraits<Inverse<GraphType>>::child_begin(G),
|
|
137
137
|
GenericGraphTraits<Inverse<GraphType>>::child_end(G));
|
|
@@ -94,6 +94,7 @@ public:
|
|
|
94
94
|
return bb;
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
+
|
|
97
98
|
/// Overloading operator << for dumping ICFG node ID
|
|
98
99
|
//@{
|
|
99
100
|
friend OutStream &operator<<(OutStream &o, const ICFGNode &node)
|
|
@@ -253,6 +254,7 @@ public:
|
|
|
253
254
|
//@}
|
|
254
255
|
};
|
|
255
256
|
|
|
257
|
+
|
|
256
258
|
/*!
|
|
257
259
|
* Function entry ICFGNode containing a set of FormalParmVFGNodes of a function
|
|
258
260
|
*/
|
|
@@ -478,6 +480,7 @@ public:
|
|
|
478
480
|
virtual const std::string toString() const;
|
|
479
481
|
};
|
|
480
482
|
|
|
483
|
+
|
|
481
484
|
/*!
|
|
482
485
|
* Return ICFGNode containing (at most one) ActualRetVFGNode at a callsite
|
|
483
486
|
*/
|
|
@@ -123,6 +123,7 @@ public:
|
|
|
123
123
|
else if (SVFUtil::isa<FunExitICFGNode>(node))
|
|
124
124
|
numOfExitNodes++;
|
|
125
125
|
|
|
126
|
+
|
|
126
127
|
ICFGEdge::ICFGEdgeSetTy::iterator edgeIt =
|
|
127
128
|
it->second->OutEdgeBegin();
|
|
128
129
|
ICFGEdge::ICFGEdgeSetTy::iterator edgeEit =
|
|
@@ -160,3 +161,4 @@ public:
|
|
|
160
161
|
} // End namespace SVF
|
|
161
162
|
|
|
162
163
|
#endif /* INCLUDE_UTIL_ICFGSTAT_H_ */
|
|
164
|
+
|
|
@@ -41,6 +41,7 @@ namespace SVF
|
|
|
41
41
|
class PTACallGraphNode;
|
|
42
42
|
class SVFModule;
|
|
43
43
|
|
|
44
|
+
|
|
44
45
|
/*
|
|
45
46
|
* Call Graph edge representing a calling relation between two functions
|
|
46
47
|
* Multiple calls from function A to B are merged into one call edge
|
|
@@ -57,6 +58,7 @@ public:
|
|
|
57
58
|
CallRetEdge,TDForkEdge,TDJoinEdge,HareParForEdge
|
|
58
59
|
};
|
|
59
60
|
|
|
61
|
+
|
|
60
62
|
private:
|
|
61
63
|
CallInstSet directCalls;
|
|
62
64
|
CallInstSet indirectCalls;
|
|
@@ -196,6 +198,7 @@ public:
|
|
|
196
198
|
/// Return TRUE if this function can be reached from main.
|
|
197
199
|
bool isReachableFromProgEntry() const;
|
|
198
200
|
|
|
201
|
+
|
|
199
202
|
/// Overloading operator << for dumping ICFG node ID
|
|
200
203
|
//@{
|
|
201
204
|
friend OutStream& operator<< (OutStream &o, const PTACallGraphNode &node)
|
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
//===- SCC.h -- SCC detection algorithm---------------------------------------//
|
|
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 Affero 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 Affero General Public License for more details.
|
|
17
|
+
|
|
18
|
+
// You should have received a copy of the GNU Affero General Public License
|
|
19
|
+
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
20
|
+
//
|
|
21
|
+
//===----------------------------------------------------------------------===//
|
|
22
|
+
|
|
23
|
+
/*
|
|
24
|
+
* SCC.h
|
|
25
|
+
*
|
|
26
|
+
* Esko Nuutila and Eljas Soisalon-Soininen, "On finding the
|
|
27
|
+
* strongly connected components in a directed graph".
|
|
28
|
+
* Inf. Process. Letters, 49(1):9-14, 1994.
|
|
29
|
+
*
|
|
30
|
+
* The implementation is derived from the pseudo code in the following paper:
|
|
31
|
+
* Pereira and Berlin, "Wave Propagation and Deep Propagation for Pointer Analysis",
|
|
32
|
+
* CGO 2009, 126-135, 2009.
|
|
33
|
+
*
|
|
34
|
+
* And influenced by implementation from Open64 compiler
|
|
35
|
+
*
|
|
36
|
+
* Created on: Jul 12, 2013
|
|
37
|
+
* Author: yusui
|
|
38
|
+
*/
|
|
39
|
+
|
|
40
|
+
#ifndef SCC_H_
|
|
41
|
+
#define SCC_H_
|
|
42
|
+
|
|
43
|
+
#include "SVFIR/SVFValue.h" // for NodeBS
|
|
44
|
+
#include <limits.h>
|
|
45
|
+
#include <stack>
|
|
46
|
+
#include <map>
|
|
47
|
+
|
|
48
|
+
namespace SVF
|
|
49
|
+
{
|
|
50
|
+
|
|
51
|
+
class GNodeSCCInfo;
|
|
52
|
+
|
|
53
|
+
template<class GraphType>
|
|
54
|
+
class SCCDetection
|
|
55
|
+
{
|
|
56
|
+
|
|
57
|
+
private:
|
|
58
|
+
///Define the GTraits and node iterator for printing
|
|
59
|
+
typedef SVF::GenericGraphTraits<GraphType> GTraits;
|
|
60
|
+
typedef typename GTraits::NodeRef GNODE;
|
|
61
|
+
typedef typename GTraits::nodes_iterator node_iterator;
|
|
62
|
+
typedef typename GTraits::ChildIteratorType child_iterator;
|
|
63
|
+
typedef unsigned NodeID ;
|
|
64
|
+
|
|
65
|
+
public:
|
|
66
|
+
typedef std::stack<NodeID> GNodeStack;
|
|
67
|
+
|
|
68
|
+
class GNodeSCCInfo
|
|
69
|
+
{
|
|
70
|
+
public:
|
|
71
|
+
GNodeSCCInfo() : _visited(false), _inSCC(false), _rep(UINT_MAX) {}
|
|
72
|
+
|
|
73
|
+
inline bool visited(void) const
|
|
74
|
+
{
|
|
75
|
+
return _visited;
|
|
76
|
+
}
|
|
77
|
+
inline void visited(bool v)
|
|
78
|
+
{
|
|
79
|
+
_visited = v;
|
|
80
|
+
}
|
|
81
|
+
inline bool inSCC(void) const
|
|
82
|
+
{
|
|
83
|
+
return _inSCC;
|
|
84
|
+
}
|
|
85
|
+
inline void inSCC(bool v)
|
|
86
|
+
{
|
|
87
|
+
_inSCC = v;
|
|
88
|
+
}
|
|
89
|
+
inline NodeID rep(void)const
|
|
90
|
+
{
|
|
91
|
+
return _rep;
|
|
92
|
+
}
|
|
93
|
+
inline void rep(NodeID n)
|
|
94
|
+
{
|
|
95
|
+
_rep = n;
|
|
96
|
+
}
|
|
97
|
+
inline void addSubNodes(NodeID n)
|
|
98
|
+
{
|
|
99
|
+
_subNodes.set(n);
|
|
100
|
+
}
|
|
101
|
+
inline NodeBS& subNodes()
|
|
102
|
+
{
|
|
103
|
+
return _subNodes;
|
|
104
|
+
}
|
|
105
|
+
inline const NodeBS& subNodes() const
|
|
106
|
+
{
|
|
107
|
+
return _subNodes;
|
|
108
|
+
}
|
|
109
|
+
private:
|
|
110
|
+
bool _visited;
|
|
111
|
+
bool _inSCC;
|
|
112
|
+
NodeID _rep;
|
|
113
|
+
NodeBS _subNodes; /// nodes in the scc represented by this node
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
typedef Map<NodeID,GNodeSCCInfo > GNODESCCInfoMap;
|
|
117
|
+
typedef Map<NodeID, NodeID> NodeToNodeMap;
|
|
118
|
+
|
|
119
|
+
SCCDetection(const GraphType >)
|
|
120
|
+
: _graph(GT),
|
|
121
|
+
_I(0)
|
|
122
|
+
{}
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
// Return a handle to the stack of nodes in topological
|
|
126
|
+
// order. This will be used to seed the initial solution
|
|
127
|
+
// and improve efficiency.
|
|
128
|
+
inline GNodeStack &topoNodeStack()
|
|
129
|
+
{
|
|
130
|
+
return _T;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
const inline GNODESCCInfoMap &GNodeSCCInfo() const
|
|
134
|
+
{
|
|
135
|
+
return _NodeSCCAuxInfo;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/// get the rep node if not found return itself
|
|
139
|
+
inline NodeID repNode(NodeID n) const
|
|
140
|
+
{
|
|
141
|
+
typename GNODESCCInfoMap::const_iterator it = _NodeSCCAuxInfo.find(n);
|
|
142
|
+
assert(it!=_NodeSCCAuxInfo.end() && "scc rep not found");
|
|
143
|
+
NodeID rep = it->second.rep();
|
|
144
|
+
return rep!= UINT_MAX ? rep : n ;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
/// whether the node is in a cycle
|
|
149
|
+
inline bool isInCycle(NodeID n) const
|
|
150
|
+
{
|
|
151
|
+
NodeID rep = repNode(n);
|
|
152
|
+
// multi-node cycle
|
|
153
|
+
if (subNodes(rep).count() > 1)
|
|
154
|
+
{
|
|
155
|
+
return true;
|
|
156
|
+
}
|
|
157
|
+
// self-cycle
|
|
158
|
+
else
|
|
159
|
+
{
|
|
160
|
+
child_iterator EI = GTraits::direct_child_begin(Node(rep));
|
|
161
|
+
child_iterator EE = GTraits::direct_child_end(Node(rep));
|
|
162
|
+
for (; EI != EE; ++EI)
|
|
163
|
+
{
|
|
164
|
+
NodeID w = Node_Index(*EI);
|
|
165
|
+
if(w==rep)
|
|
166
|
+
return true;
|
|
167
|
+
}
|
|
168
|
+
return false;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/// get all subnodes in one scc, if size is empty insert itself into the set
|
|
173
|
+
inline const NodeBS& subNodes(NodeID n) const
|
|
174
|
+
{
|
|
175
|
+
typename GNODESCCInfoMap::const_iterator it = _NodeSCCAuxInfo.find(n);
|
|
176
|
+
assert(it!=_NodeSCCAuxInfo.end() && "scc rep not found");
|
|
177
|
+
return it->second.subNodes();
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/// get all repNodeID
|
|
181
|
+
inline const NodeBS &getRepNodes() const
|
|
182
|
+
{
|
|
183
|
+
return repNodes;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
const inline GraphType & graph()
|
|
187
|
+
{
|
|
188
|
+
return _graph;
|
|
189
|
+
}
|
|
190
|
+
private:
|
|
191
|
+
|
|
192
|
+
GNODESCCInfoMap _NodeSCCAuxInfo;
|
|
193
|
+
|
|
194
|
+
const GraphType & _graph;
|
|
195
|
+
NodeID _I;
|
|
196
|
+
NodeToNodeMap _D;
|
|
197
|
+
GNodeStack _SS;
|
|
198
|
+
GNodeStack _T;
|
|
199
|
+
NodeBS repNodes;
|
|
200
|
+
|
|
201
|
+
inline bool visited(NodeID n)
|
|
202
|
+
{
|
|
203
|
+
return _NodeSCCAuxInfo[n].visited();
|
|
204
|
+
}
|
|
205
|
+
inline bool inSCC(NodeID n)
|
|
206
|
+
{
|
|
207
|
+
return _NodeSCCAuxInfo[n].inSCC();
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
inline void setVisited(NodeID n,bool v)
|
|
211
|
+
{
|
|
212
|
+
_NodeSCCAuxInfo[n].visited(v);
|
|
213
|
+
}
|
|
214
|
+
inline void setInSCC(NodeID n,bool v)
|
|
215
|
+
{
|
|
216
|
+
_NodeSCCAuxInfo[n].inSCC(v);
|
|
217
|
+
}
|
|
218
|
+
inline void rep(NodeID n, NodeID r)
|
|
219
|
+
{
|
|
220
|
+
_NodeSCCAuxInfo[n].rep(r);
|
|
221
|
+
_NodeSCCAuxInfo[r].addSubNodes(n);
|
|
222
|
+
if (n != r)
|
|
223
|
+
{
|
|
224
|
+
_NodeSCCAuxInfo[n].subNodes().clear();
|
|
225
|
+
repNodes.reset(n);
|
|
226
|
+
repNodes.set(r);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
inline NodeID rep(NodeID n)
|
|
231
|
+
{
|
|
232
|
+
return _NodeSCCAuxInfo[n].rep();
|
|
233
|
+
}
|
|
234
|
+
inline bool isInSCC(NodeID n)
|
|
235
|
+
{
|
|
236
|
+
return _NodeSCCAuxInfo[n].inSCC();
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
inline GNODE Node(NodeID id) const
|
|
240
|
+
{
|
|
241
|
+
return GTraits::getNode(_graph, id);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
inline NodeID Node_Index(GNODE node) const
|
|
245
|
+
{
|
|
246
|
+
return GTraits::getNodeID(node);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
void visit(NodeID v)
|
|
250
|
+
{
|
|
251
|
+
// SVFUtil::outs() << "visit GNODE: " << Node_Index(v)<< "\n";
|
|
252
|
+
_I += 1;
|
|
253
|
+
_D[v] = _I;
|
|
254
|
+
this->rep(v,v);
|
|
255
|
+
this->setVisited(v,true);
|
|
256
|
+
|
|
257
|
+
child_iterator EI = GTraits::direct_child_begin(Node(v));
|
|
258
|
+
child_iterator EE = GTraits::direct_child_end(Node(v));
|
|
259
|
+
|
|
260
|
+
for (; EI != EE; ++EI)
|
|
261
|
+
{
|
|
262
|
+
NodeID w = Node_Index(*EI);
|
|
263
|
+
|
|
264
|
+
if (!this->visited(w))
|
|
265
|
+
visit(w);
|
|
266
|
+
if (!this->inSCC(w))
|
|
267
|
+
{
|
|
268
|
+
NodeID rep;
|
|
269
|
+
rep = _D[this->rep(v)] < _D[this->rep(w)] ?
|
|
270
|
+
this->rep(v) : this->rep(w);
|
|
271
|
+
this->rep(v,rep);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
if (this->rep(v) == v)
|
|
275
|
+
{
|
|
276
|
+
this->setInSCC(v,true);
|
|
277
|
+
while (!_SS.empty())
|
|
278
|
+
{
|
|
279
|
+
NodeID w = _SS.top();
|
|
280
|
+
if (_D[w] <= _D[v])
|
|
281
|
+
break;
|
|
282
|
+
else
|
|
283
|
+
{
|
|
284
|
+
_SS.pop();
|
|
285
|
+
this->setInSCC(w,true);
|
|
286
|
+
this->rep(w,v);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
_T.push(v);
|
|
290
|
+
}
|
|
291
|
+
else
|
|
292
|
+
_SS.push(v);
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
void clear()
|
|
296
|
+
{
|
|
297
|
+
_NodeSCCAuxInfo.clear();
|
|
298
|
+
_I = 0;
|
|
299
|
+
_D.clear();
|
|
300
|
+
repNodes.clear();
|
|
301
|
+
while(!_SS.empty())
|
|
302
|
+
_SS.pop();
|
|
303
|
+
while(!_T.empty())
|
|
304
|
+
_T.pop();
|
|
305
|
+
}
|
|
306
|
+
public:
|
|
307
|
+
|
|
308
|
+
void find(void)
|
|
309
|
+
{
|
|
310
|
+
// Visit each unvisited root node. A root node is defined
|
|
311
|
+
// to be a node that has no incoming copy/skew edges
|
|
312
|
+
clear();
|
|
313
|
+
node_iterator I = GTraits::nodes_begin(_graph);
|
|
314
|
+
node_iterator E = GTraits::nodes_end(_graph);
|
|
315
|
+
for (; I != E; ++I)
|
|
316
|
+
{
|
|
317
|
+
NodeID node = Node_Index(*I);
|
|
318
|
+
if (!this->visited(node))
|
|
319
|
+
{
|
|
320
|
+
// We skip any nodes that have a representative other than
|
|
321
|
+
// themselves. Such nodes occur as a result of merging
|
|
322
|
+
// nodes either through unifying an ACC or other node
|
|
323
|
+
// merging optimizations. Any such node should have no
|
|
324
|
+
// outgoing edges and therefore should no longer be a member
|
|
325
|
+
// of an SCC.
|
|
326
|
+
if (this->rep(node) == UINT_MAX || this->rep(node) == node)
|
|
327
|
+
visit(node);
|
|
328
|
+
else
|
|
329
|
+
this->visited(node);
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
void find(NodeSet &candidates)
|
|
335
|
+
{
|
|
336
|
+
// This function is reloaded to only visit candidate NODES
|
|
337
|
+
clear();
|
|
338
|
+
for (NodeID node : candidates)
|
|
339
|
+
{
|
|
340
|
+
if (!this->visited(node))
|
|
341
|
+
{
|
|
342
|
+
if (this->rep(node) == UINT_MAX || this->rep(node) == node)
|
|
343
|
+
visit(node);
|
|
344
|
+
else
|
|
345
|
+
this->visited(node);
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
};
|
|
351
|
+
|
|
352
|
+
} // End namespace SVF
|
|
353
|
+
|
|
354
|
+
#endif /* SCC_H_ */
|
|
@@ -57,6 +57,7 @@ typedef PHIVFGNode PHISVFGNode;
|
|
|
57
57
|
typedef IntraPHIVFGNode IntraPHISVFGNode;
|
|
58
58
|
typedef InterPHIVFGNode InterPHISVFGNode;
|
|
59
59
|
|
|
60
|
+
|
|
60
61
|
/*!
|
|
61
62
|
* Sparse value flow graph
|
|
62
63
|
* Each node stands for a definition, each edge stands for value flow relations
|
|
@@ -345,6 +346,7 @@ protected:
|
|
|
345
346
|
}
|
|
346
347
|
//@}
|
|
347
348
|
|
|
349
|
+
|
|
348
350
|
/// Given a PAGNode, set/get its def SVFG node (definition of top level pointers)
|
|
349
351
|
//@{
|
|
350
352
|
inline void setDef(const PAGNode* pagNode, const SVFGNode* node)
|
|
@@ -131,6 +131,7 @@ public:
|
|
|
131
131
|
virtual const std::string toString() const;
|
|
132
132
|
};
|
|
133
133
|
|
|
134
|
+
|
|
134
135
|
/*
|
|
135
136
|
* SVFG Node stands for return mu node (address-taken variables)
|
|
136
137
|
*/
|
|
@@ -172,6 +173,7 @@ public:
|
|
|
172
173
|
virtual const std::string toString() const;
|
|
173
174
|
};
|
|
174
175
|
|
|
176
|
+
|
|
175
177
|
/*
|
|
176
178
|
* SVFG Node stands for callsite mu node (address-taken variables)
|
|
177
179
|
*/
|
|
@@ -200,6 +202,7 @@ public:
|
|
|
200
202
|
return ver;
|
|
201
203
|
}
|
|
202
204
|
|
|
205
|
+
|
|
203
206
|
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
|
204
207
|
//@{
|
|
205
208
|
static inline bool classof(const ActualINSVFGNode *)
|
|
@@ -219,6 +222,7 @@ public:
|
|
|
219
222
|
virtual const std::string toString() const;
|
|
220
223
|
};
|
|
221
224
|
|
|
225
|
+
|
|
222
226
|
/*
|
|
223
227
|
* SVFG Node stands for callsite chi node (address-taken variables)
|
|
224
228
|
*/
|
|
@@ -265,6 +269,7 @@ public:
|
|
|
265
269
|
virtual const std::string toString() const;
|
|
266
270
|
};
|
|
267
271
|
|
|
272
|
+
|
|
268
273
|
/*
|
|
269
274
|
* SVFG Node stands for a memory ssa phi node or formalIn or ActualOut
|
|
270
275
|
*/
|
|
@@ -392,6 +397,7 @@ public:
|
|
|
392
397
|
virtual const std::string toString() const;
|
|
393
398
|
};
|
|
394
399
|
|
|
400
|
+
|
|
395
401
|
/*
|
|
396
402
|
* Inter MSSA PHI (formalIN/ActualOUT)
|
|
397
403
|
*/
|
|
@@ -501,6 +507,7 @@ private:
|
|
|
501
507
|
const Version version;
|
|
502
508
|
};
|
|
503
509
|
|
|
510
|
+
|
|
504
511
|
} // End namespace SVF
|
|
505
512
|
|
|
506
513
|
#endif /* INCLUDE_MSSA_SVFGNODE_H_ */
|
|
@@ -32,9 +32,11 @@
|
|
|
32
32
|
*
|
|
33
33
|
*/
|
|
34
34
|
|
|
35
|
+
|
|
35
36
|
#ifndef SVFGOPT_H_
|
|
36
37
|
#define SVFGOPT_H_
|
|
37
38
|
|
|
39
|
+
|
|
38
40
|
#include "Graphs/SVFG.h"
|
|
39
41
|
#include "Util/WorkList.h"
|
|
40
42
|
|
|
@@ -343,6 +345,7 @@ private:
|
|
|
343
345
|
}
|
|
344
346
|
//@}
|
|
345
347
|
|
|
348
|
+
|
|
346
349
|
NodeIDToNodeIDMap actualInToDefMap; ///< map actual-in to its def-site node
|
|
347
350
|
NodeIDToNodeIDMap formalOutToDefMap; ///< map formal-out to its def-site node
|
|
348
351
|
NodeBS defNodes; ///< preserved def nodes of formal-in/actual-out
|
|
@@ -32,12 +32,13 @@
|
|
|
32
32
|
*
|
|
33
33
|
*/
|
|
34
34
|
|
|
35
|
+
|
|
35
36
|
#ifndef SVFGSTAT_H_
|
|
36
37
|
#define SVFGSTAT_H_
|
|
37
38
|
|
|
38
39
|
#include "Graphs/SVFG.h"
|
|
40
|
+
#include "SCC.h"
|
|
39
41
|
#include "Util/PTAStat.h"
|
|
40
|
-
#include "Util/SCC.h"
|
|
41
42
|
|
|
42
43
|
namespace SVF
|
|
43
44
|
{
|
|
@@ -87,6 +88,7 @@ private:
|
|
|
87
88
|
MemSSA* mssa;
|
|
88
89
|
};
|
|
89
90
|
|
|
91
|
+
|
|
90
92
|
class SVFGStat : public PTAStat
|
|
91
93
|
{
|
|
92
94
|
public:
|
|
@@ -153,6 +153,7 @@ public:
|
|
|
153
153
|
typedef GenericNode<PTACallGraphNode, HareParForEdge>::GEdgeSetTy ParForEdgeSet;
|
|
154
154
|
};
|
|
155
155
|
|
|
156
|
+
|
|
156
157
|
/*!
|
|
157
158
|
* Thread sensitive call graph
|
|
158
159
|
*/
|
|
@@ -196,6 +197,7 @@ public:
|
|
|
196
197
|
/// Update join edge using pointer analysis results
|
|
197
198
|
void updateJoinEdge(PointerAnalysis* pta);
|
|
198
199
|
|
|
200
|
+
|
|
199
201
|
/// Get call graph edge via call instruction
|
|
200
202
|
//@{
|
|
201
203
|
/// whether this call instruction has a valid call graph edge
|
|
@@ -360,6 +362,7 @@ public:
|
|
|
360
362
|
void addIndirectParForEdge(const CallICFGNode* cs, const SVFFunction* callee);
|
|
361
363
|
//@}
|
|
362
364
|
|
|
365
|
+
|
|
363
366
|
/// map call instruction to its CallGraphEdge map
|
|
364
367
|
inline void addThreadForkEdgeSetMap(const CallICFGNode* cs, ThreadForkEdge* edge)
|
|
365
368
|
{
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
#ifndef INCLUDE_UTIL_VFG_H_
|
|
31
31
|
#define INCLUDE_UTIL_VFG_H_
|
|
32
32
|
|
|
33
|
+
|
|
33
34
|
#include "SVFIR/SVFIR.h"
|
|
34
35
|
#include "Graphs/PTACallGraph.h"
|
|
35
36
|
#include "Graphs/VFGNode.h"
|
|
@@ -82,6 +83,7 @@ public:
|
|
|
82
83
|
typedef Set<const VFGNode*> GlobalVFGNodeSet;
|
|
83
84
|
typedef Set<const PAGNode*> PAGNodeSet;
|
|
84
85
|
|
|
86
|
+
|
|
85
87
|
protected:
|
|
86
88
|
NodeID totalVFGNode;
|
|
87
89
|
PAGNodeToDefMapTy PAGNodeToDefMap; ///< map a pag node to its definition SVG node
|