svf-lib 1.0.1253 → 1.0.1255
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/CFLAlias.h +10 -47
- package/SVF-linux/include/CFL/CFLBase.h +111 -0
- package/SVF-linux/include/CFL/CFLStat.h +4 -2
- package/SVF-linux/include/CFL/CFLVF.h +13 -23
- package/SVF-linux/include/Graphs/CFLGraph.h +5 -0
- package/SVF-osx/Release-build/lib/libSvf.a +0 -0
- package/SVF-osx/include/CFL/CFLAlias.h +10 -47
- package/SVF-osx/include/CFL/CFLBase.h +111 -0
- package/SVF-osx/include/CFL/CFLStat.h +4 -2
- package/SVF-osx/include/CFL/CFLVF.h +13 -23
- package/SVF-osx/include/Graphs/CFLGraph.h +5 -0
- package/package.json +1 -1
|
Binary file
|
|
@@ -30,14 +30,7 @@
|
|
|
30
30
|
#ifndef INCLUDE_CFL_CFLALIAS_H_
|
|
31
31
|
#define INCLUDE_CFL_CFLALIAS_H_
|
|
32
32
|
|
|
33
|
-
#include "CFL/
|
|
34
|
-
#include "CFL/CFGNormalizer.h"
|
|
35
|
-
#include "CFL/GrammarBuilder.h"
|
|
36
|
-
#include "CFL/CFLGraphBuilder.h"
|
|
37
|
-
#include "CFL/CFLGramGraphChecker.h"
|
|
38
|
-
#include "MemoryModel/PointerAnalysis.h"
|
|
39
|
-
#include "Graphs/ConsG.h"
|
|
40
|
-
#include "Util/Options.h"
|
|
33
|
+
#include "CFL/CFLBase.h"
|
|
41
34
|
#include "CFL/CFLStat.h"
|
|
42
35
|
|
|
43
36
|
namespace SVF
|
|
@@ -45,25 +38,27 @@ namespace SVF
|
|
|
45
38
|
|
|
46
39
|
class CFLStat;
|
|
47
40
|
|
|
48
|
-
class CFLAlias : public
|
|
41
|
+
class CFLAlias : public CFLBase
|
|
49
42
|
{
|
|
50
43
|
|
|
51
44
|
public:
|
|
52
45
|
typedef OrderedMap<CallSite, NodeID> CallSite2DummyValPN;
|
|
53
46
|
|
|
54
|
-
CFLAlias(SVFIR* ir) :
|
|
47
|
+
CFLAlias(SVFIR* ir) : CFLBase(ir, PointerAnalysis::CFLFICI_WPA)
|
|
55
48
|
{
|
|
56
49
|
}
|
|
57
50
|
|
|
58
|
-
///
|
|
59
|
-
virtual
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
51
|
+
/// Initialize the grammar, graph, solver
|
|
52
|
+
virtual void initialize();
|
|
53
|
+
|
|
54
|
+
/// Print grammar and graph
|
|
55
|
+
virtual void finalize();
|
|
63
56
|
|
|
64
57
|
/// Start Analysis here (main part of pointer analysis).
|
|
65
58
|
virtual void analyze();
|
|
66
59
|
|
|
60
|
+
virtual void countSumEdges();
|
|
61
|
+
|
|
67
62
|
/// Interface exposed to users of our pointer analysis, given Value infos
|
|
68
63
|
virtual AliasResult alias(const Value* v1, const Value* v2)
|
|
69
64
|
{
|
|
@@ -107,7 +102,6 @@ public:
|
|
|
107
102
|
|
|
108
103
|
/// Need Original one for virtual table
|
|
109
104
|
|
|
110
|
-
|
|
111
105
|
/// Add copy edge on constraint graph
|
|
112
106
|
virtual inline bool addCopyEdge(NodeID src, NodeID dst)
|
|
113
107
|
{
|
|
@@ -142,39 +136,8 @@ public:
|
|
|
142
136
|
|
|
143
137
|
void heapAllocatorViaIndCall(CallSite cs);
|
|
144
138
|
|
|
145
|
-
/// Get CFL graph
|
|
146
|
-
CFLGraph* getCFLGraph()
|
|
147
|
-
{
|
|
148
|
-
return graph;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
/// Statistics
|
|
152
|
-
//@{
|
|
153
|
-
static u32_t numOfProcessedAddr; /// Number of processed Addr edge
|
|
154
|
-
static u32_t numOfProcessedCopy; /// Number of processed Copy edge
|
|
155
|
-
static u32_t numOfProcessedGep; /// Number of processed Gep edge
|
|
156
|
-
static u32_t numOfProcessedLoad; /// Number of processed Load edge
|
|
157
|
-
static u32_t numOfProcessedStore; /// Number of processed Store edge
|
|
158
|
-
static u32_t numOfSfrs;
|
|
159
|
-
static u32_t numOfFieldExpand;
|
|
160
|
-
|
|
161
|
-
static u32_t numOfSCCDetection;
|
|
162
|
-
static double timeOfSCCDetection;
|
|
163
|
-
static double timeOfSCCMerges;
|
|
164
|
-
static double timeOfCollapse;
|
|
165
|
-
static u32_t AveragePointsToSetSize;
|
|
166
|
-
static u32_t MaxPointsToSetSize;
|
|
167
|
-
static double timeOfProcessCopyGep;
|
|
168
|
-
static double timeOfProcessLoadStore;
|
|
169
|
-
static double timeOfUpdateCallGraph;
|
|
170
|
-
//@}
|
|
171
|
-
|
|
172
139
|
private:
|
|
173
140
|
CallSite2DummyValPN callsite2DummyValPN; ///< Map an instruction to a dummy obj which created at an indirect callsite, which invokes a heap allocator
|
|
174
|
-
SVFIR* svfir;
|
|
175
|
-
CFLGraph* graph;
|
|
176
|
-
CFLGrammar* grammar;
|
|
177
|
-
CFLSolver *solver;
|
|
178
141
|
};
|
|
179
142
|
|
|
180
143
|
} // End namespace SVF
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
//===----- CFLBase.h -- CFL Analysis Client Base--------------//
|
|
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
|
+
* CFLAlias.h
|
|
25
|
+
*
|
|
26
|
+
* Created on: Oct 12, 2022
|
|
27
|
+
* Author: Pei Xu
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
#ifndef INCLUDE_CFL_CFLBASE_H_
|
|
31
|
+
#define INCLUDE_CFL_CFLBASE_H_
|
|
32
|
+
|
|
33
|
+
#include "CFL/CFLSolver.h"
|
|
34
|
+
#include "CFL/CFGNormalizer.h"
|
|
35
|
+
#include "CFL/GrammarBuilder.h"
|
|
36
|
+
#include "CFL/CFLGraphBuilder.h"
|
|
37
|
+
#include "CFL/CFLGramGraphChecker.h"
|
|
38
|
+
#include "MemoryModel/PointerAnalysis.h"
|
|
39
|
+
#include "Graphs/ConsG.h"
|
|
40
|
+
#include "Util/Options.h"
|
|
41
|
+
#include "Util/SVFBasicTypes.h"
|
|
42
|
+
|
|
43
|
+
namespace SVF
|
|
44
|
+
{
|
|
45
|
+
|
|
46
|
+
class CFLStat;
|
|
47
|
+
|
|
48
|
+
class CFLBase : public BVDataPTAImpl
|
|
49
|
+
{
|
|
50
|
+
|
|
51
|
+
public:
|
|
52
|
+
CFLBase(SVFIR* ir, PointerAnalysis::PTATY pty) : BVDataPTAImpl(ir, pty), svfir(ir), graph(nullptr), grammar(nullptr), solver(nullptr)
|
|
53
|
+
{
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/// Destructor
|
|
57
|
+
virtual ~CFLBase()
|
|
58
|
+
{
|
|
59
|
+
delete solver;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/// Initialize the grammar, graph, solver
|
|
63
|
+
virtual void initialize() = 0;
|
|
64
|
+
|
|
65
|
+
/// Print grammar and graph
|
|
66
|
+
virtual void finalize() = 0;
|
|
67
|
+
|
|
68
|
+
/// Start Analysis here (main part of pointer analysis).
|
|
69
|
+
virtual void analyze() = 0;
|
|
70
|
+
|
|
71
|
+
/// Get CFL graph
|
|
72
|
+
CFLGraph* getCFLGraph()
|
|
73
|
+
{
|
|
74
|
+
return graph;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
virtual void countSumEdges() = 0;
|
|
78
|
+
|
|
79
|
+
/// Statistics
|
|
80
|
+
//@{
|
|
81
|
+
static u32_t numOfProcessedAddr; /// Number of processed Addr edge
|
|
82
|
+
static u32_t numOfProcessedCopy; /// Number of processed Copy edge
|
|
83
|
+
static u32_t numOfProcessedGep; /// Number of processed Gep edge
|
|
84
|
+
static u32_t numOfProcessedLoad; /// Number of processed Load edge
|
|
85
|
+
static u32_t numOfProcessedStore; /// Number of processed Store edge
|
|
86
|
+
static u32_t numOfSfrs;
|
|
87
|
+
static u32_t numOfFieldExpand;
|
|
88
|
+
|
|
89
|
+
static u32_t numOfSCCDetection;
|
|
90
|
+
static double timeOfSCCDetection;
|
|
91
|
+
static double timeOfSCCMerges;
|
|
92
|
+
static double timeOfCollapse;
|
|
93
|
+
static u32_t AveragePointsToSetSize;
|
|
94
|
+
static u32_t MaxPointsToSetSize;
|
|
95
|
+
static double timeOfProcessCopyGep;
|
|
96
|
+
static double timeOfProcessLoadStore;
|
|
97
|
+
static double timeOfUpdateCallGraph;
|
|
98
|
+
static double timeOfSolving;
|
|
99
|
+
static double numOfSumEdges;
|
|
100
|
+
//@}
|
|
101
|
+
|
|
102
|
+
protected:
|
|
103
|
+
SVFIR* svfir;
|
|
104
|
+
CFLGraph* graph;
|
|
105
|
+
CFLGrammar* grammar;
|
|
106
|
+
CFLSolver *solver;
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
} // End namespace SVF
|
|
110
|
+
|
|
111
|
+
#endif /* INCLUDE_CFL_CFLBASE_H_*/
|
|
@@ -33,11 +33,13 @@
|
|
|
33
33
|
|
|
34
34
|
#include "Util/PTAStat.h"
|
|
35
35
|
#include "CFL/CFLAlias.h"
|
|
36
|
+
#include "CFL/CFLVF.h"
|
|
36
37
|
|
|
37
38
|
namespace SVF
|
|
38
39
|
{
|
|
39
40
|
|
|
40
41
|
class CFLAlias;
|
|
42
|
+
class CFLVF;
|
|
41
43
|
class SVFIR;
|
|
42
44
|
class ConstraintGraph;
|
|
43
45
|
|
|
@@ -48,7 +50,7 @@ class CFLStat : public PTAStat
|
|
|
48
50
|
{
|
|
49
51
|
|
|
50
52
|
private:
|
|
51
|
-
|
|
53
|
+
CFLBase* pta;
|
|
52
54
|
|
|
53
55
|
public:
|
|
54
56
|
static const char* CollapseTime;
|
|
@@ -65,7 +67,7 @@ public:
|
|
|
65
67
|
/// CFL Stat
|
|
66
68
|
u32_t _NumofCFLGraphNode;
|
|
67
69
|
|
|
68
|
-
CFLStat(
|
|
70
|
+
CFLStat(CFLBase* p);
|
|
69
71
|
|
|
70
72
|
virtual ~CFLStat()
|
|
71
73
|
{
|
|
@@ -30,44 +30,34 @@
|
|
|
30
30
|
#ifndef INCLUDE_CFL_CFLVF_H_
|
|
31
31
|
#define INCLUDE_CFL_CFLVF_H_
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
#include "CFL/
|
|
35
|
-
#include "CFL/
|
|
36
|
-
#include "CFL/CFLGraphBuilder.h"
|
|
37
|
-
#include "CFL/CFLGramGraphChecker.h"
|
|
38
|
-
#include "MemoryModel/PointerAnalysis.h"
|
|
39
|
-
#include "Graphs/ConsG.h"
|
|
40
|
-
#include "Util/Options.h"
|
|
33
|
+
|
|
34
|
+
#include "CFL/CFLBase.h"
|
|
35
|
+
#include "CFL/CFLStat.h"
|
|
41
36
|
#include "SABER/SaberSVFGBuilder.h"
|
|
37
|
+
#include "WPA/Andersen.h"
|
|
42
38
|
|
|
43
39
|
namespace SVF
|
|
44
40
|
{
|
|
45
|
-
|
|
46
|
-
class CFLVF : public BVDataPTAImpl
|
|
41
|
+
class CFLVF : public CFLBase
|
|
47
42
|
{
|
|
48
43
|
|
|
49
44
|
public:
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
CFLVF(SVFIR* ir) : BVDataPTAImpl(ir, PointerAnalysis::CFLFSCS_WPA, false), svfir(ir), graph(nullptr), grammar(nullptr), solver(nullptr)
|
|
45
|
+
CFLVF(SVFIR* ir) : CFLBase(ir, PointerAnalysis::CFLFSCS_WPA)
|
|
53
46
|
{
|
|
54
47
|
}
|
|
55
48
|
|
|
56
|
-
///
|
|
57
|
-
virtual
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
49
|
+
/// Initialize the grammar, graph, solver
|
|
50
|
+
virtual void initialize();
|
|
51
|
+
|
|
52
|
+
/// Print grammar and graph
|
|
53
|
+
virtual void finalize();
|
|
61
54
|
|
|
62
55
|
/// Start Analysis here (main part of pointer analysis).
|
|
63
56
|
virtual void analyze();
|
|
64
57
|
|
|
58
|
+
virtual void countSumEdges();
|
|
59
|
+
|
|
65
60
|
private:
|
|
66
|
-
CallSite2DummyValPN callsite2DummyValPN; ///< Map an instruction to a dummy obj which created at an indirect callsite, which invokes a heap allocator
|
|
67
|
-
SVFIR* svfir;
|
|
68
|
-
CFLGraph* graph;
|
|
69
|
-
CFLGrammar* grammar;
|
|
70
|
-
CFLSolver *solver;
|
|
71
61
|
SaberSVFGBuilder memSSA;
|
|
72
62
|
SVFG* svfg;
|
|
73
63
|
};
|
|
Binary file
|
|
@@ -30,14 +30,7 @@
|
|
|
30
30
|
#ifndef INCLUDE_CFL_CFLALIAS_H_
|
|
31
31
|
#define INCLUDE_CFL_CFLALIAS_H_
|
|
32
32
|
|
|
33
|
-
#include "CFL/
|
|
34
|
-
#include "CFL/CFGNormalizer.h"
|
|
35
|
-
#include "CFL/GrammarBuilder.h"
|
|
36
|
-
#include "CFL/CFLGraphBuilder.h"
|
|
37
|
-
#include "CFL/CFLGramGraphChecker.h"
|
|
38
|
-
#include "MemoryModel/PointerAnalysis.h"
|
|
39
|
-
#include "Graphs/ConsG.h"
|
|
40
|
-
#include "Util/Options.h"
|
|
33
|
+
#include "CFL/CFLBase.h"
|
|
41
34
|
#include "CFL/CFLStat.h"
|
|
42
35
|
|
|
43
36
|
namespace SVF
|
|
@@ -45,25 +38,27 @@ namespace SVF
|
|
|
45
38
|
|
|
46
39
|
class CFLStat;
|
|
47
40
|
|
|
48
|
-
class CFLAlias : public
|
|
41
|
+
class CFLAlias : public CFLBase
|
|
49
42
|
{
|
|
50
43
|
|
|
51
44
|
public:
|
|
52
45
|
typedef OrderedMap<CallSite, NodeID> CallSite2DummyValPN;
|
|
53
46
|
|
|
54
|
-
CFLAlias(SVFIR* ir) :
|
|
47
|
+
CFLAlias(SVFIR* ir) : CFLBase(ir, PointerAnalysis::CFLFICI_WPA)
|
|
55
48
|
{
|
|
56
49
|
}
|
|
57
50
|
|
|
58
|
-
///
|
|
59
|
-
virtual
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
51
|
+
/// Initialize the grammar, graph, solver
|
|
52
|
+
virtual void initialize();
|
|
53
|
+
|
|
54
|
+
/// Print grammar and graph
|
|
55
|
+
virtual void finalize();
|
|
63
56
|
|
|
64
57
|
/// Start Analysis here (main part of pointer analysis).
|
|
65
58
|
virtual void analyze();
|
|
66
59
|
|
|
60
|
+
virtual void countSumEdges();
|
|
61
|
+
|
|
67
62
|
/// Interface exposed to users of our pointer analysis, given Value infos
|
|
68
63
|
virtual AliasResult alias(const Value* v1, const Value* v2)
|
|
69
64
|
{
|
|
@@ -107,7 +102,6 @@ public:
|
|
|
107
102
|
|
|
108
103
|
/// Need Original one for virtual table
|
|
109
104
|
|
|
110
|
-
|
|
111
105
|
/// Add copy edge on constraint graph
|
|
112
106
|
virtual inline bool addCopyEdge(NodeID src, NodeID dst)
|
|
113
107
|
{
|
|
@@ -142,39 +136,8 @@ public:
|
|
|
142
136
|
|
|
143
137
|
void heapAllocatorViaIndCall(CallSite cs);
|
|
144
138
|
|
|
145
|
-
/// Get CFL graph
|
|
146
|
-
CFLGraph* getCFLGraph()
|
|
147
|
-
{
|
|
148
|
-
return graph;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
/// Statistics
|
|
152
|
-
//@{
|
|
153
|
-
static u32_t numOfProcessedAddr; /// Number of processed Addr edge
|
|
154
|
-
static u32_t numOfProcessedCopy; /// Number of processed Copy edge
|
|
155
|
-
static u32_t numOfProcessedGep; /// Number of processed Gep edge
|
|
156
|
-
static u32_t numOfProcessedLoad; /// Number of processed Load edge
|
|
157
|
-
static u32_t numOfProcessedStore; /// Number of processed Store edge
|
|
158
|
-
static u32_t numOfSfrs;
|
|
159
|
-
static u32_t numOfFieldExpand;
|
|
160
|
-
|
|
161
|
-
static u32_t numOfSCCDetection;
|
|
162
|
-
static double timeOfSCCDetection;
|
|
163
|
-
static double timeOfSCCMerges;
|
|
164
|
-
static double timeOfCollapse;
|
|
165
|
-
static u32_t AveragePointsToSetSize;
|
|
166
|
-
static u32_t MaxPointsToSetSize;
|
|
167
|
-
static double timeOfProcessCopyGep;
|
|
168
|
-
static double timeOfProcessLoadStore;
|
|
169
|
-
static double timeOfUpdateCallGraph;
|
|
170
|
-
//@}
|
|
171
|
-
|
|
172
139
|
private:
|
|
173
140
|
CallSite2DummyValPN callsite2DummyValPN; ///< Map an instruction to a dummy obj which created at an indirect callsite, which invokes a heap allocator
|
|
174
|
-
SVFIR* svfir;
|
|
175
|
-
CFLGraph* graph;
|
|
176
|
-
CFLGrammar* grammar;
|
|
177
|
-
CFLSolver *solver;
|
|
178
141
|
};
|
|
179
142
|
|
|
180
143
|
} // End namespace SVF
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
//===----- CFLBase.h -- CFL Analysis Client Base--------------//
|
|
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
|
+
* CFLAlias.h
|
|
25
|
+
*
|
|
26
|
+
* Created on: Oct 12, 2022
|
|
27
|
+
* Author: Pei Xu
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
#ifndef INCLUDE_CFL_CFLBASE_H_
|
|
31
|
+
#define INCLUDE_CFL_CFLBASE_H_
|
|
32
|
+
|
|
33
|
+
#include "CFL/CFLSolver.h"
|
|
34
|
+
#include "CFL/CFGNormalizer.h"
|
|
35
|
+
#include "CFL/GrammarBuilder.h"
|
|
36
|
+
#include "CFL/CFLGraphBuilder.h"
|
|
37
|
+
#include "CFL/CFLGramGraphChecker.h"
|
|
38
|
+
#include "MemoryModel/PointerAnalysis.h"
|
|
39
|
+
#include "Graphs/ConsG.h"
|
|
40
|
+
#include "Util/Options.h"
|
|
41
|
+
#include "Util/SVFBasicTypes.h"
|
|
42
|
+
|
|
43
|
+
namespace SVF
|
|
44
|
+
{
|
|
45
|
+
|
|
46
|
+
class CFLStat;
|
|
47
|
+
|
|
48
|
+
class CFLBase : public BVDataPTAImpl
|
|
49
|
+
{
|
|
50
|
+
|
|
51
|
+
public:
|
|
52
|
+
CFLBase(SVFIR* ir, PointerAnalysis::PTATY pty) : BVDataPTAImpl(ir, pty), svfir(ir), graph(nullptr), grammar(nullptr), solver(nullptr)
|
|
53
|
+
{
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/// Destructor
|
|
57
|
+
virtual ~CFLBase()
|
|
58
|
+
{
|
|
59
|
+
delete solver;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/// Initialize the grammar, graph, solver
|
|
63
|
+
virtual void initialize() = 0;
|
|
64
|
+
|
|
65
|
+
/// Print grammar and graph
|
|
66
|
+
virtual void finalize() = 0;
|
|
67
|
+
|
|
68
|
+
/// Start Analysis here (main part of pointer analysis).
|
|
69
|
+
virtual void analyze() = 0;
|
|
70
|
+
|
|
71
|
+
/// Get CFL graph
|
|
72
|
+
CFLGraph* getCFLGraph()
|
|
73
|
+
{
|
|
74
|
+
return graph;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
virtual void countSumEdges() = 0;
|
|
78
|
+
|
|
79
|
+
/// Statistics
|
|
80
|
+
//@{
|
|
81
|
+
static u32_t numOfProcessedAddr; /// Number of processed Addr edge
|
|
82
|
+
static u32_t numOfProcessedCopy; /// Number of processed Copy edge
|
|
83
|
+
static u32_t numOfProcessedGep; /// Number of processed Gep edge
|
|
84
|
+
static u32_t numOfProcessedLoad; /// Number of processed Load edge
|
|
85
|
+
static u32_t numOfProcessedStore; /// Number of processed Store edge
|
|
86
|
+
static u32_t numOfSfrs;
|
|
87
|
+
static u32_t numOfFieldExpand;
|
|
88
|
+
|
|
89
|
+
static u32_t numOfSCCDetection;
|
|
90
|
+
static double timeOfSCCDetection;
|
|
91
|
+
static double timeOfSCCMerges;
|
|
92
|
+
static double timeOfCollapse;
|
|
93
|
+
static u32_t AveragePointsToSetSize;
|
|
94
|
+
static u32_t MaxPointsToSetSize;
|
|
95
|
+
static double timeOfProcessCopyGep;
|
|
96
|
+
static double timeOfProcessLoadStore;
|
|
97
|
+
static double timeOfUpdateCallGraph;
|
|
98
|
+
static double timeOfSolving;
|
|
99
|
+
static double numOfSumEdges;
|
|
100
|
+
//@}
|
|
101
|
+
|
|
102
|
+
protected:
|
|
103
|
+
SVFIR* svfir;
|
|
104
|
+
CFLGraph* graph;
|
|
105
|
+
CFLGrammar* grammar;
|
|
106
|
+
CFLSolver *solver;
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
} // End namespace SVF
|
|
110
|
+
|
|
111
|
+
#endif /* INCLUDE_CFL_CFLBASE_H_*/
|
|
@@ -33,11 +33,13 @@
|
|
|
33
33
|
|
|
34
34
|
#include "Util/PTAStat.h"
|
|
35
35
|
#include "CFL/CFLAlias.h"
|
|
36
|
+
#include "CFL/CFLVF.h"
|
|
36
37
|
|
|
37
38
|
namespace SVF
|
|
38
39
|
{
|
|
39
40
|
|
|
40
41
|
class CFLAlias;
|
|
42
|
+
class CFLVF;
|
|
41
43
|
class SVFIR;
|
|
42
44
|
class ConstraintGraph;
|
|
43
45
|
|
|
@@ -48,7 +50,7 @@ class CFLStat : public PTAStat
|
|
|
48
50
|
{
|
|
49
51
|
|
|
50
52
|
private:
|
|
51
|
-
|
|
53
|
+
CFLBase* pta;
|
|
52
54
|
|
|
53
55
|
public:
|
|
54
56
|
static const char* CollapseTime;
|
|
@@ -65,7 +67,7 @@ public:
|
|
|
65
67
|
/// CFL Stat
|
|
66
68
|
u32_t _NumofCFLGraphNode;
|
|
67
69
|
|
|
68
|
-
CFLStat(
|
|
70
|
+
CFLStat(CFLBase* p);
|
|
69
71
|
|
|
70
72
|
virtual ~CFLStat()
|
|
71
73
|
{
|
|
@@ -30,44 +30,34 @@
|
|
|
30
30
|
#ifndef INCLUDE_CFL_CFLVF_H_
|
|
31
31
|
#define INCLUDE_CFL_CFLVF_H_
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
#include "CFL/
|
|
35
|
-
#include "CFL/
|
|
36
|
-
#include "CFL/CFLGraphBuilder.h"
|
|
37
|
-
#include "CFL/CFLGramGraphChecker.h"
|
|
38
|
-
#include "MemoryModel/PointerAnalysis.h"
|
|
39
|
-
#include "Graphs/ConsG.h"
|
|
40
|
-
#include "Util/Options.h"
|
|
33
|
+
|
|
34
|
+
#include "CFL/CFLBase.h"
|
|
35
|
+
#include "CFL/CFLStat.h"
|
|
41
36
|
#include "SABER/SaberSVFGBuilder.h"
|
|
37
|
+
#include "WPA/Andersen.h"
|
|
42
38
|
|
|
43
39
|
namespace SVF
|
|
44
40
|
{
|
|
45
|
-
|
|
46
|
-
class CFLVF : public BVDataPTAImpl
|
|
41
|
+
class CFLVF : public CFLBase
|
|
47
42
|
{
|
|
48
43
|
|
|
49
44
|
public:
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
CFLVF(SVFIR* ir) : BVDataPTAImpl(ir, PointerAnalysis::CFLFSCS_WPA, false), svfir(ir), graph(nullptr), grammar(nullptr), solver(nullptr)
|
|
45
|
+
CFLVF(SVFIR* ir) : CFLBase(ir, PointerAnalysis::CFLFSCS_WPA)
|
|
53
46
|
{
|
|
54
47
|
}
|
|
55
48
|
|
|
56
|
-
///
|
|
57
|
-
virtual
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
49
|
+
/// Initialize the grammar, graph, solver
|
|
50
|
+
virtual void initialize();
|
|
51
|
+
|
|
52
|
+
/// Print grammar and graph
|
|
53
|
+
virtual void finalize();
|
|
61
54
|
|
|
62
55
|
/// Start Analysis here (main part of pointer analysis).
|
|
63
56
|
virtual void analyze();
|
|
64
57
|
|
|
58
|
+
virtual void countSumEdges();
|
|
59
|
+
|
|
65
60
|
private:
|
|
66
|
-
CallSite2DummyValPN callsite2DummyValPN; ///< Map an instruction to a dummy obj which created at an indirect callsite, which invokes a heap allocator
|
|
67
|
-
SVFIR* svfir;
|
|
68
|
-
CFLGraph* graph;
|
|
69
|
-
CFLGrammar* grammar;
|
|
70
|
-
CFLSolver *solver;
|
|
71
61
|
SaberSVFGBuilder memSSA;
|
|
72
62
|
SVFG* svfg;
|
|
73
63
|
};
|