svf-lib 1.0.1262 → 1.0.1264
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/CFLBase.h +2 -0
- package/SVF-linux/include/CFL/CFLGrammar.h +13 -0
- package/SVF-linux/include/CFL/CFLGrammar.txt +9 -33
- package/SVF-linux/include/CFL/CFLSolver.h +8 -0
- package/SVF-linux/include/CFL/CFLStat.h +3 -13
- package/SVF-linux/include/Graphs/CFLGraph.h +69 -0
- package/package.json +1 -1
|
Binary file
|
|
@@ -94,6 +94,8 @@ public:
|
|
|
94
94
|
static double numOfNonterminalEdges; // Number of nonterminal labeled edges
|
|
95
95
|
static double numOfStartEdges; // Number of start nonterminal labeled edges
|
|
96
96
|
// Solver
|
|
97
|
+
static double numOfIteration; // Number solving Iteration
|
|
98
|
+
static double numOfChecks; // Number of checks
|
|
97
99
|
static double timeOfSolving; // time of solving CFL Reachability
|
|
98
100
|
//@}
|
|
99
101
|
|
|
@@ -177,6 +177,16 @@ public:
|
|
|
177
177
|
this->terminals = terminals;
|
|
178
178
|
}
|
|
179
179
|
|
|
180
|
+
inline Map<std::string, Kind>& getEBNFSigns()
|
|
181
|
+
{
|
|
182
|
+
return this->EBNFSigns;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
inline void setEBNFSigns(Map<std::string, Kind>& EBNFSigns)
|
|
186
|
+
{
|
|
187
|
+
this->EBNFSigns = EBNFSigns;
|
|
188
|
+
}
|
|
189
|
+
|
|
180
190
|
inline SymbolMap<Symbol, Productions>& getRawProductions()
|
|
181
191
|
{
|
|
182
192
|
return this->rawProductions;
|
|
@@ -248,6 +258,8 @@ public:
|
|
|
248
258
|
|
|
249
259
|
Symbol insertTerminalSymbol(std::string strLit);
|
|
250
260
|
|
|
261
|
+
Symbol insertEBNFSigns(std::string strLit);
|
|
262
|
+
|
|
251
263
|
void insertAttribute(Kind kind, Attribute a);
|
|
252
264
|
|
|
253
265
|
inline static Kind getAttributedKind(Attribute attribute, Kind kind)
|
|
@@ -268,6 +280,7 @@ protected:
|
|
|
268
280
|
private:
|
|
269
281
|
Map<std::string, Kind> nonterminals;
|
|
270
282
|
Map<std::string, Kind> terminals;
|
|
283
|
+
Map<std::string, Kind> EBNFSigns; /// Map contains Signs' String and associated Symbols
|
|
271
284
|
Set<Kind> attributeKinds;
|
|
272
285
|
Map<Kind, Set<Attribute>> kind2AttrsMap;
|
|
273
286
|
SymbolMap<Symbol, Productions> rawProductions;
|
|
@@ -3,37 +3,13 @@ Start:
|
|
|
3
3
|
Terminal:
|
|
4
4
|
addr copy store load gep vgep
|
|
5
5
|
Productions:
|
|
6
|
-
F -> epsilon;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
F -> store Memflow load;
|
|
11
|
-
Fbar -> epsilon;
|
|
12
|
-
Fbar -> copybar Fbar;
|
|
13
|
-
Fbar -> Memflowbar addrbar;
|
|
14
|
-
Fbar -> loadbar V storebar Fbar;
|
|
15
|
-
Fbar -> loadbar Memflowbar storebar;
|
|
16
|
-
V -> Fbar V F;
|
|
17
|
-
V -> addrbar addr;
|
|
18
|
-
V -> gepbar_i V gep_i;
|
|
19
|
-
V -> gepbarpath V gep_0;
|
|
20
|
-
V -> gepbar_i F gep_i;
|
|
21
|
-
V -> gepbar_i Fbar gep_i;
|
|
22
|
-
copy -> vgep;
|
|
6
|
+
F -> epsilon | F copy | addr Memflow | F store V load | store Memflow load;
|
|
7
|
+
Fbar -> epsilon | copybar Fbar | Memflowbar addrbar | loadbar V storebar Fbar | loadbar Memflowbar storebar;
|
|
8
|
+
V -> Fbar V F | addrbar addr | gepbar_i V gep_i | gepbarpath V gep_0 | gepbar_i F gep_i | gepbar_i Fbar gep_i;
|
|
9
|
+
copy -> vgep;
|
|
23
10
|
copybar -> vgepbar;
|
|
24
|
-
gep_1 -> gep_0 F gep_1;
|
|
25
|
-
gepbar_1 -> gepbar_1 Fbar gepbar_0;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
gepbarpath -> gepbarpath gepbar_0;
|
|
30
|
-
Memflow -> load store;
|
|
31
|
-
Memflow -> Fbar Memflow;
|
|
32
|
-
Memflow -> F Memflow Fbar;
|
|
33
|
-
Memflow -> gep_i Memflow gepbar_i;
|
|
34
|
-
Memflow -> gepbar_i Memflow gep_i;
|
|
35
|
-
Memflowbar -> storebar loadbar;
|
|
36
|
-
Memflowbar -> Memflowbar F;
|
|
37
|
-
Memflowbar -> F Memflowbar Fbar;
|
|
38
|
-
Memflowbar -> gep_i Memflowbar gepbar_i;
|
|
39
|
-
Memflowbar -> gepbar_i Memflowbar gep_i;
|
|
11
|
+
gep_1 -> gep_0 F vgep | gep_0 F gep_1;
|
|
12
|
+
gepbar_1 -> gepbar_1 Fbar gepbar_0 | vgepbar Fbar gepbar_0;
|
|
13
|
+
gepbarpath -> gepbar_0 gepbar_0 | gepbarpath gepbar_0;
|
|
14
|
+
Memflow -> load store | Fbar Memflow | F Memflow Fbar | gep_i Memflow gepbar_i | gepbar_i Memflow gep_i;;
|
|
15
|
+
Memflowbar -> storebar loadbar | Memflowbar F | F Memflowbar Fbar | gep_i Memflowbar gepbar_i | gepbar_i Memflowbar gep_i;
|
|
@@ -47,6 +47,8 @@ public:
|
|
|
47
47
|
typedef CFLGrammar::Production Production;
|
|
48
48
|
typedef CFLGrammar::Symbol Symbol;
|
|
49
49
|
|
|
50
|
+
static double numOfChecks;
|
|
51
|
+
|
|
50
52
|
CFLSolver(CFLGraph* _graph, CFLGrammar* _grammar): graph(_graph), grammar(_grammar)
|
|
51
53
|
{
|
|
52
54
|
}
|
|
@@ -57,6 +59,12 @@ public:
|
|
|
57
59
|
delete grammar;
|
|
58
60
|
}
|
|
59
61
|
|
|
62
|
+
/// Initialize worklist
|
|
63
|
+
void initialize();
|
|
64
|
+
|
|
65
|
+
/// Process CFLEdge
|
|
66
|
+
void processCFLEdge(const CFLEdge* Y_edge);
|
|
67
|
+
|
|
60
68
|
/// Start solving
|
|
61
69
|
void solve();
|
|
62
70
|
|
|
@@ -38,38 +38,28 @@
|
|
|
38
38
|
namespace SVF
|
|
39
39
|
{
|
|
40
40
|
|
|
41
|
-
class CFLAlias;
|
|
42
|
-
class CFLVF;
|
|
43
|
-
class SVFIR;
|
|
44
|
-
class ConstraintGraph;
|
|
45
|
-
|
|
46
41
|
/*!
|
|
47
42
|
* Statistics of CFL's analysis
|
|
48
43
|
*/
|
|
49
44
|
class CFLStat : public PTAStat
|
|
50
45
|
{
|
|
51
|
-
|
|
52
46
|
private:
|
|
53
47
|
CFLBase* pta;
|
|
54
48
|
|
|
55
49
|
public:
|
|
56
|
-
/// CFL Stat
|
|
57
|
-
u32_t _NumofCFLGraphNode;
|
|
58
|
-
|
|
59
50
|
CFLStat(CFLBase* p);
|
|
60
51
|
|
|
61
52
|
virtual ~CFLStat()
|
|
62
53
|
{
|
|
63
|
-
|
|
64
54
|
}
|
|
65
55
|
|
|
66
56
|
virtual void performStat();
|
|
67
57
|
|
|
68
|
-
void
|
|
69
|
-
|
|
70
|
-
void constraintGraphStat();
|
|
58
|
+
void CFLGraphStat();
|
|
71
59
|
|
|
72
60
|
void CFLGrammarStat();
|
|
61
|
+
|
|
62
|
+
void CFLSolverStat();
|
|
73
63
|
};
|
|
74
64
|
|
|
75
65
|
} // End namespace SVF
|
|
@@ -47,6 +47,8 @@ typedef GenericEdge<CFLNode> GenericCFLEdgeTy;
|
|
|
47
47
|
class CFLEdge: public GenericCFLEdgeTy
|
|
48
48
|
{
|
|
49
49
|
public:
|
|
50
|
+
typedef GenericNode<CFLNode, CFLEdge>::GEdgeSetTy CFLEdgeSetTy;
|
|
51
|
+
|
|
50
52
|
CFLEdge(CFLNode *s, CFLNode *d, GEdgeFlag k = 0):
|
|
51
53
|
GenericCFLEdgeTy(s,d,k)
|
|
52
54
|
{
|
|
@@ -78,7 +80,74 @@ public:
|
|
|
78
80
|
GenericCFLNodeTy(i, k)
|
|
79
81
|
{
|
|
80
82
|
}
|
|
83
|
+
|
|
81
84
|
~CFLNode() override = default;
|
|
85
|
+
|
|
86
|
+
/// Different Kind(label) associated edges set
|
|
87
|
+
typedef std::map <GrammarBase::Symbol, CFLEdge::CFLEdgeSetTy> CFLEdgeDataTy;
|
|
88
|
+
|
|
89
|
+
private:
|
|
90
|
+
CFLEdgeDataTy inCFLEdges;
|
|
91
|
+
CFLEdgeDataTy outCFLEdges;
|
|
92
|
+
|
|
93
|
+
public:
|
|
94
|
+
inline const CFLEdge::CFLEdgeSetTy& getInEdgeWithTy(GrammarBase::Symbol s)
|
|
95
|
+
{
|
|
96
|
+
return inCFLEdges[s];
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
inline const CFLEdge::CFLEdgeSetTy& getOutEdgeWithTy(GrammarBase::Symbol s)
|
|
100
|
+
{
|
|
101
|
+
return outCFLEdges[s];
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
inline bool addInEdgeWithKind(CFLEdge* inEdge, GrammarBase::Symbol s)
|
|
105
|
+
{
|
|
106
|
+
assert(inEdge->getDstID() == this->getId());
|
|
107
|
+
bool added1 = GenericNode::addIncomingEdge(inEdge);
|
|
108
|
+
bool added2 = inCFLEdges[s].insert(inEdge).second;
|
|
109
|
+
|
|
110
|
+
return added1 && added2;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
inline bool addIngoingEdge(CFLEdge* inEdge)
|
|
114
|
+
{
|
|
115
|
+
return addInEdgeWithKind(inEdge, inEdge->getEdgeKind());
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
inline bool addOutEdgeWithKind(CFLEdge* outEdge, GrammarBase::Symbol s)
|
|
119
|
+
{
|
|
120
|
+
assert(outEdge->getSrcID() == this->getId());
|
|
121
|
+
bool added1 = GenericNode::addOutgoingEdge(outEdge);
|
|
122
|
+
bool added2 = outCFLEdges[s].insert(outEdge).second;
|
|
123
|
+
|
|
124
|
+
return added1 && added2;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
inline bool addOutgoingEdge(CFLEdge* OutEdge)
|
|
128
|
+
{
|
|
129
|
+
return addOutEdgeWithKind(OutEdge, OutEdge->getEdgeKind());
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
inline bool removeCFLInEdge(CFLEdge* inEdge)
|
|
133
|
+
{
|
|
134
|
+
u32_t num1 = removeIncomingEdge(inEdge);
|
|
135
|
+
|
|
136
|
+
GrammarBase::Symbol s = inEdge->getEdgeKind();
|
|
137
|
+
u32_t num2 = inCFLEdges[s].erase(inEdge);
|
|
138
|
+
|
|
139
|
+
return num1 && num2;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
inline bool removeCFLOutEdge(CFLEdge* outEdge)
|
|
143
|
+
{
|
|
144
|
+
u32_t num1 = removeOutgoingEdge(outEdge);
|
|
145
|
+
|
|
146
|
+
GrammarBase::Symbol s = outEdge->getEdgeKind();
|
|
147
|
+
u32_t num2 = outCFLEdges[s].erase(outEdge);
|
|
148
|
+
|
|
149
|
+
return num1 && num2;
|
|
150
|
+
}
|
|
82
151
|
};
|
|
83
152
|
|
|
84
153
|
/// Edge-labeled graph for CFL Reachability analysis
|