svf-lib 1.0.1419 → 1.0.1420
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/svf/libSvfCore.a +0 -0
- package/SVF-linux/Release-build/svf-llvm/libSvfLLVM.a +0 -0
- package/SVF-linux/svf/include/CFL/CFLAlias.h +16 -2
- package/SVF-linux/svf/include/CFL/CFLGrammar.txt +1 -1
- package/SVF-linux/svf/include/CFL/CFLSolver.h +86 -106
- package/SVF-linux/svf/include/Util/Options.h +1 -0
- package/package.json +1 -1
|
Binary file
|
|
Binary file
|
|
@@ -51,6 +51,10 @@ public:
|
|
|
51
51
|
/// Initialize the grammar, graph, solver
|
|
52
52
|
virtual void initialize();
|
|
53
53
|
|
|
54
|
+
/// Initialize Solver
|
|
55
|
+
virtual void initializeSolver();
|
|
56
|
+
|
|
57
|
+
|
|
54
58
|
/// Print grammar and graph
|
|
55
59
|
virtual void finalize();
|
|
56
60
|
|
|
@@ -143,9 +147,19 @@ public:
|
|
|
143
147
|
POCRAlias(SVFIR* ir) : CFLAlias(ir)
|
|
144
148
|
{
|
|
145
149
|
}
|
|
150
|
+
/// Initialize POCR Solver
|
|
151
|
+
virtual void initializeSolver();
|
|
152
|
+
};
|
|
146
153
|
|
|
147
|
-
|
|
148
|
-
|
|
154
|
+
class POCRHybrid : public CFLAlias
|
|
155
|
+
{
|
|
156
|
+
public:
|
|
157
|
+
POCRHybrid(SVFIR* ir) : CFLAlias(ir)
|
|
158
|
+
{
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/// Initialize POCRHybrid Solver
|
|
162
|
+
virtual void initializeSolver();
|
|
149
163
|
};
|
|
150
164
|
} // End namespace SVF
|
|
151
165
|
|
|
@@ -3,7 +3,7 @@ Start:
|
|
|
3
3
|
Terminal:
|
|
4
4
|
addr copy store load gep vgep
|
|
5
5
|
Productions:
|
|
6
|
-
F -> epsilon | F copy | addr Memflow | F store V load | store Memflow load;
|
|
6
|
+
F -> epsilon | F copy | addr Memflow | F store V load | store Memflow load | F F;
|
|
7
7
|
Fbar -> epsilon | copybar Fbar | Memflowbar addrbar | loadbar V storebar Fbar | loadbar Memflowbar storebar;
|
|
8
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
9
|
copy -> vgep;
|
|
@@ -40,112 +40,6 @@ namespace SVF
|
|
|
40
40
|
{
|
|
41
41
|
typedef GrammarBase::Symbol Label;
|
|
42
42
|
|
|
43
|
-
/*!
|
|
44
|
-
* Hybrid graph representation for transitive relations
|
|
45
|
-
* The implementation is based on
|
|
46
|
-
* Yuxiang Lei, Yulei Sui, Shuo Ding, and Qirun Zhang.
|
|
47
|
-
* Taming Transitive Redundancy for Context-Free Language Reachability.
|
|
48
|
-
* ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications
|
|
49
|
-
*/
|
|
50
|
-
class HybridData
|
|
51
|
-
{
|
|
52
|
-
public:
|
|
53
|
-
struct TreeNode
|
|
54
|
-
{
|
|
55
|
-
NodeID id;
|
|
56
|
-
std::unordered_set<TreeNode*> children;
|
|
57
|
-
|
|
58
|
-
TreeNode(NodeID nId) : id(nId)
|
|
59
|
-
{}
|
|
60
|
-
|
|
61
|
-
~TreeNode()
|
|
62
|
-
{
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
inline bool operator==(const TreeNode& rhs) const
|
|
66
|
-
{
|
|
67
|
-
return id == rhs.id;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
inline bool operator<(const TreeNode& rhs) const
|
|
71
|
-
{
|
|
72
|
-
return id < rhs.id;
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
public:
|
|
78
|
-
Map<NodeID, std::unordered_map<NodeID, TreeNode*>> indMap; // indMap[v][u] points to node v in tree(u)
|
|
79
|
-
|
|
80
|
-
HybridData()
|
|
81
|
-
{}
|
|
82
|
-
|
|
83
|
-
~HybridData()
|
|
84
|
-
{
|
|
85
|
-
for (auto iter1: indMap)
|
|
86
|
-
{
|
|
87
|
-
for (auto iter2: iter1.second)
|
|
88
|
-
{
|
|
89
|
-
delete iter2.second;
|
|
90
|
-
iter2.second = NULL;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
bool hasInd(NodeID src, NodeID dst)
|
|
96
|
-
{
|
|
97
|
-
auto it = indMap.find(dst);
|
|
98
|
-
if (it == indMap.end())
|
|
99
|
-
return false;
|
|
100
|
-
return (it->second.find(src) != it->second.end());
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
/// Add a node dst to tree(src)
|
|
104
|
-
TreeNode* addInd(NodeID src, NodeID dst)
|
|
105
|
-
{
|
|
106
|
-
auto resIns = indMap[dst].insert(std::make_pair(src, new TreeNode(dst)));
|
|
107
|
-
if (resIns.second)
|
|
108
|
-
return resIns.first->second;
|
|
109
|
-
return nullptr;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
/// Get the node dst in tree(src)
|
|
113
|
-
TreeNode* getNode(NodeID src, NodeID dst)
|
|
114
|
-
{
|
|
115
|
-
return indMap[dst][src];
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
/// add v into desc(x) as a child of u
|
|
119
|
-
void insertEdge(TreeNode* u, TreeNode* v)
|
|
120
|
-
{
|
|
121
|
-
u->children.insert(v);
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
void addArc(NodeID src, NodeID dst)
|
|
125
|
-
{
|
|
126
|
-
if (!hasInd(src, dst))
|
|
127
|
-
{
|
|
128
|
-
for (auto iter: indMap[src])
|
|
129
|
-
{
|
|
130
|
-
meld(iter.first, getNode(iter.first, src), getNode(dst, dst));
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
void meld(NodeID x, TreeNode* uNode, TreeNode* vNode)
|
|
136
|
-
{
|
|
137
|
-
TreeNode* newVNode = addInd(x, vNode->id);
|
|
138
|
-
if (!newVNode)
|
|
139
|
-
return;
|
|
140
|
-
|
|
141
|
-
insertEdge(uNode, newVNode);
|
|
142
|
-
for (TreeNode* vChild: vNode->children)
|
|
143
|
-
{
|
|
144
|
-
meld(x, newVNode, vChild);
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
};
|
|
148
|
-
|
|
149
43
|
class CFLSolver
|
|
150
44
|
{
|
|
151
45
|
|
|
@@ -389,6 +283,92 @@ public:
|
|
|
389
283
|
|
|
390
284
|
virtual void initialize();
|
|
391
285
|
};
|
|
286
|
+
/*!
|
|
287
|
+
* Hybrid graph representation for transitive relations
|
|
288
|
+
* The implementation is based on
|
|
289
|
+
* Yuxiang Lei, Yulei Sui, Shuo Ding, and Qirun Zhang.
|
|
290
|
+
* Taming Transitive Redundancy for Context-Free Language Reachability.
|
|
291
|
+
* ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications
|
|
292
|
+
*/
|
|
293
|
+
/// Solver Utilize Hybrid Representation of Graph
|
|
294
|
+
class POCRHybridSolver : public POCRSolver
|
|
295
|
+
{
|
|
296
|
+
//Hybrid
|
|
297
|
+
//{@
|
|
298
|
+
public:
|
|
299
|
+
struct TreeNode
|
|
300
|
+
{
|
|
301
|
+
NodeID id;
|
|
302
|
+
std::unordered_set<TreeNode*> children;
|
|
303
|
+
|
|
304
|
+
TreeNode(NodeID nId) : id(nId)
|
|
305
|
+
{}
|
|
306
|
+
|
|
307
|
+
~TreeNode()
|
|
308
|
+
{
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
inline bool operator==(const TreeNode& rhs) const
|
|
312
|
+
{
|
|
313
|
+
return id == rhs.id;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
inline bool operator<(const TreeNode& rhs) const
|
|
317
|
+
{
|
|
318
|
+
return id < rhs.id;
|
|
319
|
+
}
|
|
320
|
+
};
|
|
321
|
+
|
|
322
|
+
public:
|
|
323
|
+
Map<NodeID, std::unordered_map<NodeID, TreeNode*>> indMap; // indMap[v][u] points to node v in tree(u)
|
|
324
|
+
|
|
325
|
+
bool hasInd_h(NodeID src, NodeID dst);
|
|
326
|
+
|
|
327
|
+
/// Add a node dst to tree(src)
|
|
328
|
+
TreeNode* addInd_h(NodeID src, NodeID dst);
|
|
329
|
+
|
|
330
|
+
/// Get the node dst in tree(src)
|
|
331
|
+
TreeNode* getNode_h(NodeID src, NodeID dst)
|
|
332
|
+
{
|
|
333
|
+
return indMap[dst][src];
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
/// add v into desc(x) as a child of u
|
|
337
|
+
void insertEdge_h(TreeNode* u, TreeNode* v)
|
|
338
|
+
{
|
|
339
|
+
u->children.insert(v);
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
void addArc_h(NodeID src, NodeID dst);
|
|
343
|
+
|
|
344
|
+
void meld_h(NodeID x, TreeNode* uNode, TreeNode* vNode);
|
|
345
|
+
//@}
|
|
346
|
+
public:
|
|
347
|
+
POCRHybridSolver(CFLGraph* _graph, CFLGrammar* _grammar) : POCRSolver(_graph, _grammar)
|
|
348
|
+
{
|
|
349
|
+
}
|
|
350
|
+
/// Destructor
|
|
351
|
+
virtual ~POCRHybridSolver()
|
|
352
|
+
{
|
|
353
|
+
for (auto iter1: indMap)
|
|
354
|
+
{
|
|
355
|
+
for (auto iter2: iter1.second)
|
|
356
|
+
{
|
|
357
|
+
delete iter2.second;
|
|
358
|
+
iter2.second = NULL;
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
/// Process CFLEdge
|
|
364
|
+
virtual void processCFLEdge(const CFLEdge* Y_edge);
|
|
365
|
+
|
|
366
|
+
virtual void initialize();
|
|
367
|
+
|
|
368
|
+
public:
|
|
369
|
+
void addArc(NodeID src, NodeID dst);
|
|
370
|
+
void meld(NodeID x, TreeNode* uNode, TreeNode* vNode);
|
|
371
|
+
};
|
|
392
372
|
}
|
|
393
373
|
|
|
394
374
|
#endif /* INCLUDE_CFL_CFLSolver_H_*/
|