svf-lib 1.0.1033 → 1.0.1034
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/lib/CUDD/libCudd.a +0 -0
- package/SVF-osx/Release-build/lib/libSvf.a +0 -0
- package/SVF-osx/include/DDA/ContextDDA.h +0 -2
- package/SVF-osx/include/DDA/FlowDDA.h +0 -2
- package/SVF-osx/include/Graphs/ICFG.h +33 -3
- package/SVF-osx/include/MTA/TCT.h +0 -1
- package/SVF-osx/include/MemoryModel/SVFLoop.h +163 -0
- package/SVF-osx/include/SVF-FE/LLVMLoopAnalysis.h +59 -0
- package/SVF-osx/include/Util/Options.h +4 -0
- package/package.json +1 -1
|
Binary file
|
|
Binary file
|
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
#include "MemoryModel/PointerAnalysisImpl.h"
|
|
12
12
|
#include "DDA/DDAVFSolver.h"
|
|
13
13
|
#include "Util/DPItem.h"
|
|
14
|
-
#include "SVF-FE/DataFlowUtil.h"
|
|
15
14
|
|
|
16
15
|
namespace SVF
|
|
17
16
|
{
|
|
@@ -195,7 +194,6 @@ private:
|
|
|
195
194
|
ConstSVFGEdgeSet insensitveEdges;///< insensitive call-return edges
|
|
196
195
|
FlowDDA* flowDDA; ///< downgrade to flowDDA if out-of-budget
|
|
197
196
|
DDAClient* _client; ///< DDA client
|
|
198
|
-
PTACFInfoBuilder loopInfoBuilder; ///< LoopInfo
|
|
199
197
|
};
|
|
200
198
|
|
|
201
199
|
} // End namespace SVF
|
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
#include "MemoryModel/PointerAnalysisImpl.h"
|
|
12
12
|
#include "Util/DPItem.h"
|
|
13
13
|
#include "DDA/DDAVFSolver.h"
|
|
14
|
-
#include "SVF-FE/DataFlowUtil.h"
|
|
15
14
|
|
|
16
15
|
namespace SVF
|
|
17
16
|
{
|
|
@@ -143,7 +142,6 @@ public:
|
|
|
143
142
|
|
|
144
143
|
private:
|
|
145
144
|
DDAClient* _client; ///< DDA client
|
|
146
|
-
PTACFInfoBuilder loopInfoBuilder; ///< LoopInfo
|
|
147
145
|
};
|
|
148
146
|
|
|
149
147
|
} // End namespace SVF
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
#include "Graphs/ICFGNode.h"
|
|
34
34
|
#include "Graphs/ICFGEdge.h"
|
|
35
35
|
#include "Util/WorkList.h"
|
|
36
|
+
#include "MemoryModel/SVFLoop.h"
|
|
36
37
|
|
|
37
38
|
namespace SVF
|
|
38
39
|
{
|
|
@@ -60,6 +61,8 @@ public:
|
|
|
60
61
|
typedef Map<const Instruction*, CallICFGNode *> CSToCallNodeMapTy;
|
|
61
62
|
typedef Map<const Instruction*, RetICFGNode *> CSToRetNodeMapTy;
|
|
62
63
|
typedef Map<const Instruction*, IntraICFGNode *> InstToBlockNodeMapTy;
|
|
64
|
+
typedef std::vector<const SVFLoop *> SVFLoopVec;
|
|
65
|
+
typedef Map<const ICFGNode *, SVFLoopVec> ICFGNodeToSVFLoopVec;
|
|
63
66
|
|
|
64
67
|
NodeID totalICFGNode;
|
|
65
68
|
|
|
@@ -70,15 +73,15 @@ private:
|
|
|
70
73
|
CSToRetNodeMapTy CSToRetNodeMap; ///< map a callsite to its RetICFGNode
|
|
71
74
|
InstToBlockNodeMapTy InstToBlockNodeMap; ///< map a basic block to its ICFGNode
|
|
72
75
|
GlobalICFGNode* globalBlockNode; ///< unique basic block for all globals
|
|
76
|
+
ICFGNodeToSVFLoopVec icfgNodeToSVFLoopVec; ///< map ICFG node to the SVF loops where it resides
|
|
77
|
+
|
|
73
78
|
|
|
74
79
|
public:
|
|
75
80
|
/// Constructor
|
|
76
81
|
ICFG();
|
|
77
82
|
|
|
78
83
|
/// Destructor
|
|
79
|
-
virtual ~ICFG()
|
|
80
|
-
{
|
|
81
|
-
}
|
|
84
|
+
virtual ~ICFG();
|
|
82
85
|
|
|
83
86
|
/// Get a ICFG node
|
|
84
87
|
inline ICFGNode* getICFGNode(NodeID id) const
|
|
@@ -111,6 +114,33 @@ public:
|
|
|
111
114
|
/// update ICFG for indirect calls
|
|
112
115
|
void updateCallGraph(PTACallGraph* callgraph);
|
|
113
116
|
|
|
117
|
+
/// Whether node is in a loop
|
|
118
|
+
inline bool isInLoop(const ICFGNode *node)
|
|
119
|
+
{
|
|
120
|
+
auto it = icfgNodeToSVFLoopVec.find(node);
|
|
121
|
+
return it != icfgNodeToSVFLoopVec.end();
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/// Whether node is in a loop
|
|
125
|
+
inline bool isInLoop(const Instruction *inst)
|
|
126
|
+
{
|
|
127
|
+
return isInLoop(getICFGNode(inst));
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/// Insert (node, loop) to icfgNodeToSVFLoopVec
|
|
131
|
+
inline void addNodeToSVFLoop(const ICFGNode *node, const SVFLoop* loop)
|
|
132
|
+
{
|
|
133
|
+
icfgNodeToSVFLoopVec[node].push_back(loop);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/// Get loops where a node resides
|
|
137
|
+
inline SVFLoopVec& getSVFLoops(const ICFGNode *node)
|
|
138
|
+
{
|
|
139
|
+
auto it = icfgNodeToSVFLoopVec.find(node);
|
|
140
|
+
assert(it != icfgNodeToSVFLoopVec.end() && "node not in loop");
|
|
141
|
+
return it->second;
|
|
142
|
+
}
|
|
143
|
+
|
|
114
144
|
protected:
|
|
115
145
|
/// Remove a SVFG edge
|
|
116
146
|
inline void removeICFGEdge(ICFGEdge* edge)
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
//===- SVFLoop.h -- SVFLoop of SVF ------------------------------//
|
|
2
|
+
//
|
|
3
|
+
// SVF: Static Value-Flow Analysis
|
|
4
|
+
//
|
|
5
|
+
// Copyright (C) <2013-> <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
|
+
* SVFLoop.h
|
|
25
|
+
*
|
|
26
|
+
* Created on: 14, 06, 2022
|
|
27
|
+
* Author: Jiawei Wang, Xiao Cheng
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
#ifndef SVF_SVFLOOP_H
|
|
31
|
+
#define SVF_SVFLOOP_H
|
|
32
|
+
|
|
33
|
+
#include "Util/SVFBasicTypes.h"
|
|
34
|
+
|
|
35
|
+
namespace SVF
|
|
36
|
+
{
|
|
37
|
+
class SVFLoop
|
|
38
|
+
{
|
|
39
|
+
typedef Set<const ICFGEdge *> ICFGEdgeSet;
|
|
40
|
+
typedef Set<const ICFGNode *> ICFGNodeSet;
|
|
41
|
+
private:
|
|
42
|
+
ICFGEdgeSet entryICFGEdges, backICFGEdges, inICFGEdges, outICFGEdges;
|
|
43
|
+
ICFGNodeSet icfgNodes;
|
|
44
|
+
u32_t loopBound;
|
|
45
|
+
|
|
46
|
+
public:
|
|
47
|
+
SVFLoop(const ICFGNodeSet &_nodes, u32_t _bound) :
|
|
48
|
+
icfgNodes(_nodes), loopBound(_bound)
|
|
49
|
+
{
|
|
50
|
+
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
virtual ~SVFLoop() = default;
|
|
54
|
+
|
|
55
|
+
inline ICFGNodeSet::iterator ICFGNodesBegin()
|
|
56
|
+
{
|
|
57
|
+
return icfgNodes.begin();
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
inline ICFGNodeSet::iterator ICFGNodesEnd()
|
|
61
|
+
{
|
|
62
|
+
return icfgNodes.end();
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
inline bool isInLoop(const ICFGNode *icfgNode) const
|
|
66
|
+
{
|
|
67
|
+
return icfgNodes.find(icfgNode) != icfgNodes.end();
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
inline bool isEntryICFGEdge(const ICFGEdge *edge) const
|
|
71
|
+
{
|
|
72
|
+
return entryICFGEdges.find(edge) != entryICFGEdges.end();
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
inline bool isBackICFGEdge(const ICFGEdge *edge) const
|
|
76
|
+
{
|
|
77
|
+
return backICFGEdges.find(edge) != entryICFGEdges.end();
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
inline bool isInICFGEdge(const ICFGEdge *edge) const
|
|
81
|
+
{
|
|
82
|
+
return inICFGEdges.find(edge) != entryICFGEdges.end();
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
inline bool isOutICFGEdge(const ICFGEdge *edge) const
|
|
86
|
+
{
|
|
87
|
+
return outICFGEdges.find(edge) != entryICFGEdges.end();
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
inline void addEntryICFGEdge(const ICFGEdge *edge)
|
|
91
|
+
{
|
|
92
|
+
entryICFGEdges.insert(edge);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
inline ICFGEdgeSet::iterator entryICFGEdgesBegin()
|
|
96
|
+
{
|
|
97
|
+
return entryICFGEdges.begin();
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
inline ICFGEdgeSet::iterator entryICFGEdgesEnd()
|
|
101
|
+
{
|
|
102
|
+
return entryICFGEdges.end();
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
inline void addOutICFGEdge(const ICFGEdge *edge)
|
|
106
|
+
{
|
|
107
|
+
outICFGEdges.insert(edge);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
inline ICFGEdgeSet::iterator outICFGEdgesBegin()
|
|
111
|
+
{
|
|
112
|
+
return outICFGEdges.begin();
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
inline ICFGEdgeSet::iterator outICFGEdgesEnd()
|
|
116
|
+
{
|
|
117
|
+
return outICFGEdges.end();
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
inline void addBackICFGEdge(const ICFGEdge *edge)
|
|
121
|
+
{
|
|
122
|
+
backICFGEdges.insert(edge);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
inline ICFGEdgeSet::iterator backICFGEdgesBegin()
|
|
126
|
+
{
|
|
127
|
+
return backICFGEdges.begin();
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
inline ICFGEdgeSet::iterator backICFGEdgesEnd()
|
|
131
|
+
{
|
|
132
|
+
return backICFGEdges.end();
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
inline void addInICFGEdge(const ICFGEdge *edge)
|
|
136
|
+
{
|
|
137
|
+
inICFGEdges.insert(edge);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
inline ICFGEdgeSet::iterator inEdgesBegin()
|
|
141
|
+
{
|
|
142
|
+
return inICFGEdges.begin();
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
inline ICFGEdgeSet::iterator inEdgesEnd()
|
|
146
|
+
{
|
|
147
|
+
return inICFGEdges.end();
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
inline void setLoopBound(u32_t _bound)
|
|
151
|
+
{
|
|
152
|
+
loopBound = _bound;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
inline u32_t getLoopBound() const
|
|
156
|
+
{
|
|
157
|
+
return loopBound;
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
#endif //SVF_SVFLOOP_H
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
//===- LLVMLoopAnalysis.h -- LoopAnalysis of SVF --------------------//
|
|
2
|
+
//
|
|
3
|
+
// SVF: Static Value-Flow Analysis
|
|
4
|
+
//
|
|
5
|
+
// Copyright (C) <2013-2022> <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
|
+
* LLVMLoopAnalysis.h
|
|
25
|
+
*
|
|
26
|
+
* Created on: 14, 06, 2022
|
|
27
|
+
* Author: Jiawei Wang, Xiao Cheng
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
#ifndef SVF_LLVMLOOPANALYSIS_H
|
|
31
|
+
#define SVF_LLVMLOOPANALYSIS_H
|
|
32
|
+
|
|
33
|
+
#include "MemoryModel/SVFIR.h"
|
|
34
|
+
#include "MemoryModel/SVFLoop.h"
|
|
35
|
+
|
|
36
|
+
namespace SVF
|
|
37
|
+
{
|
|
38
|
+
class LLVMLoopAnalysis
|
|
39
|
+
{
|
|
40
|
+
public:
|
|
41
|
+
|
|
42
|
+
/// Constructor
|
|
43
|
+
LLVMLoopAnalysis() = default;;
|
|
44
|
+
|
|
45
|
+
/// Destructor
|
|
46
|
+
virtual ~LLVMLoopAnalysis() = default;
|
|
47
|
+
|
|
48
|
+
/// Build llvm loops based on LoopInfo analysis
|
|
49
|
+
virtual void buildLLVMLoops(SVFModule *mod, std::vector<const Loop *> &llvmLoops);
|
|
50
|
+
|
|
51
|
+
/// Start from here
|
|
52
|
+
virtual void build(ICFG *icfg);
|
|
53
|
+
|
|
54
|
+
/// Build SVF loops based on llvm loops
|
|
55
|
+
virtual void buildSVFLoops(ICFG *icfg, std::vector<const Loop *> &llvmLoops);
|
|
56
|
+
};
|
|
57
|
+
} // end fo SVF
|
|
58
|
+
|
|
59
|
+
#endif //SVF_LLVMLOOPANALYSIS_H
|
|
@@ -260,6 +260,10 @@ public:
|
|
|
260
260
|
static const llvm::cl::opt<bool> GraphIsFromDot;
|
|
261
261
|
static const llvm::cl::opt<bool> GrammarIsEBNF;
|
|
262
262
|
static const llvm::cl::opt<bool> FlexSymMap;
|
|
263
|
+
|
|
264
|
+
// Loop Analysis
|
|
265
|
+
static const llvm::cl::opt<bool> LoopAnalysis;
|
|
266
|
+
static const llvm::cl::opt<unsigned> LoopBound;
|
|
263
267
|
};
|
|
264
268
|
} // namespace SVF
|
|
265
269
|
|