OILS / prebuilt / datalog / call-graph.cc View on Github | oilshell.org

808 lines, 635 significant
1#define SOUFFLE_GENERATOR_VERSION "UNKNOWN"
2#include "souffle/CompiledSouffle.h"
3#include "souffle/SignalHandler.h"
4#include "souffle/SouffleInterface.h"
5#include "souffle/datastructure/BTree.h"
6#include "souffle/io/IOSystem.h"
7#include <any>
8namespace functors {
9extern "C" {
10}
11} //namespace functors
12namespace souffle::t_btree_iii__2_0_1__001__111 {
13using namespace souffle;
14struct Type {
15static constexpr Relation::arity_type Arity = 3;
16using t_tuple = Tuple<RamDomain, 3>;
17struct t_comparator_0{
18 int operator()(const t_tuple& a, const t_tuple& b) const {
19 return (ramBitCast<RamSigned>(a[2]) < ramBitCast<RamSigned>(b[2])) ? -1 : (ramBitCast<RamSigned>(a[2]) > ramBitCast<RamSigned>(b[2])) ? 1 :((ramBitCast<RamSigned>(a[0]) < ramBitCast<RamSigned>(b[0])) ? -1 : (ramBitCast<RamSigned>(a[0]) > ramBitCast<RamSigned>(b[0])) ? 1 :((ramBitCast<RamSigned>(a[1]) < ramBitCast<RamSigned>(b[1])) ? -1 : (ramBitCast<RamSigned>(a[1]) > ramBitCast<RamSigned>(b[1])) ? 1 :(0)));
20 }
21bool less(const t_tuple& a, const t_tuple& b) const {
22 return (ramBitCast<RamSigned>(a[2]) < ramBitCast<RamSigned>(b[2]))|| ((ramBitCast<RamSigned>(a[2]) == ramBitCast<RamSigned>(b[2])) && ((ramBitCast<RamSigned>(a[0]) < ramBitCast<RamSigned>(b[0]))|| ((ramBitCast<RamSigned>(a[0]) == ramBitCast<RamSigned>(b[0])) && ((ramBitCast<RamSigned>(a[1]) < ramBitCast<RamSigned>(b[1]))))));
23 }
24bool equal(const t_tuple& a, const t_tuple& b) const {
25return (ramBitCast<RamSigned>(a[2]) == ramBitCast<RamSigned>(b[2]))&&(ramBitCast<RamSigned>(a[0]) == ramBitCast<RamSigned>(b[0]))&&(ramBitCast<RamSigned>(a[1]) == ramBitCast<RamSigned>(b[1]));
26 }
27};
28using t_ind_0 = btree_set<t_tuple,t_comparator_0>;
29t_ind_0 ind_0;
30using iterator = t_ind_0::iterator;
31struct context {
32t_ind_0::operation_hints hints_0_lower;
33t_ind_0::operation_hints hints_0_upper;
34};
35context createContext() { return context(); }
36bool insert(const t_tuple& t);
37bool insert(const t_tuple& t, context& h);
38bool insert(const RamDomain* ramDomain);
39bool insert(RamDomain a0,RamDomain a1,RamDomain a2);
40bool contains(const t_tuple& t, context& h) const;
41bool contains(const t_tuple& t) const;
42std::size_t size() const;
43iterator find(const t_tuple& t, context& h) const;
44iterator find(const t_tuple& t) const;
45range<iterator> lowerUpperRange_000(const t_tuple& /* lower */, const t_tuple& /* upper */, context& /* h */) const;
46range<iterator> lowerUpperRange_000(const t_tuple& /* lower */, const t_tuple& /* upper */) const;
47range<t_ind_0::iterator> lowerUpperRange_001(const t_tuple& lower, const t_tuple& upper, context& h) const;
48range<t_ind_0::iterator> lowerUpperRange_001(const t_tuple& lower, const t_tuple& upper) const;
49range<t_ind_0::iterator> lowerUpperRange_111(const t_tuple& lower, const t_tuple& upper, context& h) const;
50range<t_ind_0::iterator> lowerUpperRange_111(const t_tuple& lower, const t_tuple& upper) const;
51bool empty() const;
52std::vector<range<iterator>> partition() const;
53void purge();
54iterator begin() const;
55iterator end() const;
56void printStatistics(std::ostream& o) const;
57};
58} // namespace souffle::t_btree_iii__2_0_1__001__111
59namespace souffle::t_btree_iii__2_0_1__001__111 {
60using namespace souffle;
61using t_ind_0 = Type::t_ind_0;
62using iterator = Type::iterator;
63using context = Type::context;
64bool Type::insert(const t_tuple& t) {
65context h;
66return insert(t, h);
67}
68bool Type::insert(const t_tuple& t, context& h) {
69if (ind_0.insert(t, h.hints_0_lower)) {
70return true;
71} else return false;
72}
73bool Type::insert(const RamDomain* ramDomain) {
74RamDomain data[3];
75std::copy(ramDomain, ramDomain + 3, data);
76const t_tuple& tuple = reinterpret_cast<const t_tuple&>(data);
77context h;
78return insert(tuple, h);
79}
80bool Type::insert(RamDomain a0,RamDomain a1,RamDomain a2) {
81RamDomain data[3] = {a0,a1,a2};
82return insert(data);
83}
84bool Type::contains(const t_tuple& t, context& h) const {
85return ind_0.contains(t, h.hints_0_lower);
86}
87bool Type::contains(const t_tuple& t) const {
88context h;
89return contains(t, h);
90}
91std::size_t Type::size() const {
92return ind_0.size();
93}
94iterator Type::find(const t_tuple& t, context& h) const {
95return ind_0.find(t, h.hints_0_lower);
96}
97iterator Type::find(const t_tuple& t) const {
98context h;
99return find(t, h);
100}
101range<iterator> Type::lowerUpperRange_000(const t_tuple& /* lower */, const t_tuple& /* upper */, context& /* h */) const {
102return range<iterator>(ind_0.begin(),ind_0.end());
103}
104range<iterator> Type::lowerUpperRange_000(const t_tuple& /* lower */, const t_tuple& /* upper */) const {
105return range<iterator>(ind_0.begin(),ind_0.end());
106}
107range<t_ind_0::iterator> Type::lowerUpperRange_001(const t_tuple& lower, const t_tuple& upper, context& h) const {
108t_comparator_0 comparator;
109int cmp = comparator(lower, upper);
110if (cmp > 0) {
111 return make_range(ind_0.end(), ind_0.end());
112}
113return make_range(ind_0.lower_bound(lower, h.hints_0_lower), ind_0.upper_bound(upper, h.hints_0_upper));
114}
115range<t_ind_0::iterator> Type::lowerUpperRange_001(const t_tuple& lower, const t_tuple& upper) const {
116context h;
117return lowerUpperRange_001(lower,upper,h);
118}
119range<t_ind_0::iterator> Type::lowerUpperRange_111(const t_tuple& lower, const t_tuple& upper, context& h) const {
120t_comparator_0 comparator;
121int cmp = comparator(lower, upper);
122if (cmp == 0) {
123 auto pos = ind_0.find(lower, h.hints_0_lower);
124 auto fin = ind_0.end();
125 if (pos != fin) {fin = pos; ++fin;}
126 return make_range(pos, fin);
127}
128if (cmp > 0) {
129 return make_range(ind_0.end(), ind_0.end());
130}
131return make_range(ind_0.lower_bound(lower, h.hints_0_lower), ind_0.upper_bound(upper, h.hints_0_upper));
132}
133range<t_ind_0::iterator> Type::lowerUpperRange_111(const t_tuple& lower, const t_tuple& upper) const {
134context h;
135return lowerUpperRange_111(lower,upper,h);
136}
137bool Type::empty() const {
138return ind_0.empty();
139}
140std::vector<range<iterator>> Type::partition() const {
141return ind_0.getChunks(400);
142}
143void Type::purge() {
144ind_0.clear();
145}
146iterator Type::begin() const {
147return ind_0.begin();
148}
149iterator Type::end() const {
150return ind_0.end();
151}
152void Type::printStatistics(std::ostream& o) const {
153o << " arity 3 direct b-tree index 0 lex-order [2,0,1]\n";
154ind_0.printStats(o);
155}
156} // namespace souffle::t_btree_iii__2_0_1__001__111
157namespace souffle::t_btree_ii__0_1__11 {
158using namespace souffle;
159struct Type {
160static constexpr Relation::arity_type Arity = 2;
161using t_tuple = Tuple<RamDomain, 2>;
162struct t_comparator_0{
163 int operator()(const t_tuple& a, const t_tuple& b) const {
164 return (ramBitCast<RamSigned>(a[0]) < ramBitCast<RamSigned>(b[0])) ? -1 : (ramBitCast<RamSigned>(a[0]) > ramBitCast<RamSigned>(b[0])) ? 1 :((ramBitCast<RamSigned>(a[1]) < ramBitCast<RamSigned>(b[1])) ? -1 : (ramBitCast<RamSigned>(a[1]) > ramBitCast<RamSigned>(b[1])) ? 1 :(0));
165 }
166bool less(const t_tuple& a, const t_tuple& b) const {
167 return (ramBitCast<RamSigned>(a[0]) < ramBitCast<RamSigned>(b[0]))|| ((ramBitCast<RamSigned>(a[0]) == ramBitCast<RamSigned>(b[0])) && ((ramBitCast<RamSigned>(a[1]) < ramBitCast<RamSigned>(b[1]))));
168 }
169bool equal(const t_tuple& a, const t_tuple& b) const {
170return (ramBitCast<RamSigned>(a[0]) == ramBitCast<RamSigned>(b[0]))&&(ramBitCast<RamSigned>(a[1]) == ramBitCast<RamSigned>(b[1]));
171 }
172};
173using t_ind_0 = btree_set<t_tuple,t_comparator_0>;
174t_ind_0 ind_0;
175using iterator = t_ind_0::iterator;
176struct context {
177t_ind_0::operation_hints hints_0_lower;
178t_ind_0::operation_hints hints_0_upper;
179};
180context createContext() { return context(); }
181bool insert(const t_tuple& t);
182bool insert(const t_tuple& t, context& h);
183bool insert(const RamDomain* ramDomain);
184bool insert(RamDomain a0,RamDomain a1);
185bool contains(const t_tuple& t, context& h) const;
186bool contains(const t_tuple& t) const;
187std::size_t size() const;
188iterator find(const t_tuple& t, context& h) const;
189iterator find(const t_tuple& t) const;
190range<iterator> lowerUpperRange_00(const t_tuple& /* lower */, const t_tuple& /* upper */, context& /* h */) const;
191range<iterator> lowerUpperRange_00(const t_tuple& /* lower */, const t_tuple& /* upper */) const;
192range<t_ind_0::iterator> lowerUpperRange_11(const t_tuple& lower, const t_tuple& upper, context& h) const;
193range<t_ind_0::iterator> lowerUpperRange_11(const t_tuple& lower, const t_tuple& upper) const;
194bool empty() const;
195std::vector<range<iterator>> partition() const;
196void purge();
197iterator begin() const;
198iterator end() const;
199void printStatistics(std::ostream& o) const;
200};
201} // namespace souffle::t_btree_ii__0_1__11
202namespace souffle::t_btree_ii__0_1__11 {
203using namespace souffle;
204using t_ind_0 = Type::t_ind_0;
205using iterator = Type::iterator;
206using context = Type::context;
207bool Type::insert(const t_tuple& t) {
208context h;
209return insert(t, h);
210}
211bool Type::insert(const t_tuple& t, context& h) {
212if (ind_0.insert(t, h.hints_0_lower)) {
213return true;
214} else return false;
215}
216bool Type::insert(const RamDomain* ramDomain) {
217RamDomain data[2];
218std::copy(ramDomain, ramDomain + 2, data);
219const t_tuple& tuple = reinterpret_cast<const t_tuple&>(data);
220context h;
221return insert(tuple, h);
222}
223bool Type::insert(RamDomain a0,RamDomain a1) {
224RamDomain data[2] = {a0,a1};
225return insert(data);
226}
227bool Type::contains(const t_tuple& t, context& h) const {
228return ind_0.contains(t, h.hints_0_lower);
229}
230bool Type::contains(const t_tuple& t) const {
231context h;
232return contains(t, h);
233}
234std::size_t Type::size() const {
235return ind_0.size();
236}
237iterator Type::find(const t_tuple& t, context& h) const {
238return ind_0.find(t, h.hints_0_lower);
239}
240iterator Type::find(const t_tuple& t) const {
241context h;
242return find(t, h);
243}
244range<iterator> Type::lowerUpperRange_00(const t_tuple& /* lower */, const t_tuple& /* upper */, context& /* h */) const {
245return range<iterator>(ind_0.begin(),ind_0.end());
246}
247range<iterator> Type::lowerUpperRange_00(const t_tuple& /* lower */, const t_tuple& /* upper */) const {
248return range<iterator>(ind_0.begin(),ind_0.end());
249}
250range<t_ind_0::iterator> Type::lowerUpperRange_11(const t_tuple& lower, const t_tuple& upper, context& h) const {
251t_comparator_0 comparator;
252int cmp = comparator(lower, upper);
253if (cmp == 0) {
254 auto pos = ind_0.find(lower, h.hints_0_lower);
255 auto fin = ind_0.end();
256 if (pos != fin) {fin = pos; ++fin;}
257 return make_range(pos, fin);
258}
259if (cmp > 0) {
260 return make_range(ind_0.end(), ind_0.end());
261}
262return make_range(ind_0.lower_bound(lower, h.hints_0_lower), ind_0.upper_bound(upper, h.hints_0_upper));
263}
264range<t_ind_0::iterator> Type::lowerUpperRange_11(const t_tuple& lower, const t_tuple& upper) const {
265context h;
266return lowerUpperRange_11(lower,upper,h);
267}
268bool Type::empty() const {
269return ind_0.empty();
270}
271std::vector<range<iterator>> Type::partition() const {
272return ind_0.getChunks(400);
273}
274void Type::purge() {
275ind_0.clear();
276}
277iterator Type::begin() const {
278return ind_0.begin();
279}
280iterator Type::end() const {
281return ind_0.end();
282}
283void Type::printStatistics(std::ostream& o) const {
284o << " arity 2 direct b-tree index 0 lex-order [0,1]\n";
285ind_0.printStats(o);
286}
287} // namespace souffle::t_btree_ii__0_1__11
288namespace souffle::t_btree_ii__0_1__11__10 {
289using namespace souffle;
290struct Type {
291static constexpr Relation::arity_type Arity = 2;
292using t_tuple = Tuple<RamDomain, 2>;
293struct t_comparator_0{
294 int operator()(const t_tuple& a, const t_tuple& b) const {
295 return (ramBitCast<RamSigned>(a[0]) < ramBitCast<RamSigned>(b[0])) ? -1 : (ramBitCast<RamSigned>(a[0]) > ramBitCast<RamSigned>(b[0])) ? 1 :((ramBitCast<RamSigned>(a[1]) < ramBitCast<RamSigned>(b[1])) ? -1 : (ramBitCast<RamSigned>(a[1]) > ramBitCast<RamSigned>(b[1])) ? 1 :(0));
296 }
297bool less(const t_tuple& a, const t_tuple& b) const {
298 return (ramBitCast<RamSigned>(a[0]) < ramBitCast<RamSigned>(b[0]))|| ((ramBitCast<RamSigned>(a[0]) == ramBitCast<RamSigned>(b[0])) && ((ramBitCast<RamSigned>(a[1]) < ramBitCast<RamSigned>(b[1]))));
299 }
300bool equal(const t_tuple& a, const t_tuple& b) const {
301return (ramBitCast<RamSigned>(a[0]) == ramBitCast<RamSigned>(b[0]))&&(ramBitCast<RamSigned>(a[1]) == ramBitCast<RamSigned>(b[1]));
302 }
303};
304using t_ind_0 = btree_set<t_tuple,t_comparator_0>;
305t_ind_0 ind_0;
306using iterator = t_ind_0::iterator;
307struct context {
308t_ind_0::operation_hints hints_0_lower;
309t_ind_0::operation_hints hints_0_upper;
310};
311context createContext() { return context(); }
312bool insert(const t_tuple& t);
313bool insert(const t_tuple& t, context& h);
314bool insert(const RamDomain* ramDomain);
315bool insert(RamDomain a0,RamDomain a1);
316bool contains(const t_tuple& t, context& h) const;
317bool contains(const t_tuple& t) const;
318std::size_t size() const;
319iterator find(const t_tuple& t, context& h) const;
320iterator find(const t_tuple& t) const;
321range<iterator> lowerUpperRange_00(const t_tuple& /* lower */, const t_tuple& /* upper */, context& /* h */) const;
322range<iterator> lowerUpperRange_00(const t_tuple& /* lower */, const t_tuple& /* upper */) const;
323range<t_ind_0::iterator> lowerUpperRange_11(const t_tuple& lower, const t_tuple& upper, context& h) const;
324range<t_ind_0::iterator> lowerUpperRange_11(const t_tuple& lower, const t_tuple& upper) const;
325range<t_ind_0::iterator> lowerUpperRange_10(const t_tuple& lower, const t_tuple& upper, context& h) const;
326range<t_ind_0::iterator> lowerUpperRange_10(const t_tuple& lower, const t_tuple& upper) const;
327bool empty() const;
328std::vector<range<iterator>> partition() const;
329void purge();
330iterator begin() const;
331iterator end() const;
332void printStatistics(std::ostream& o) const;
333};
334} // namespace souffle::t_btree_ii__0_1__11__10
335namespace souffle::t_btree_ii__0_1__11__10 {
336using namespace souffle;
337using t_ind_0 = Type::t_ind_0;
338using iterator = Type::iterator;
339using context = Type::context;
340bool Type::insert(const t_tuple& t) {
341context h;
342return insert(t, h);
343}
344bool Type::insert(const t_tuple& t, context& h) {
345if (ind_0.insert(t, h.hints_0_lower)) {
346return true;
347} else return false;
348}
349bool Type::insert(const RamDomain* ramDomain) {
350RamDomain data[2];
351std::copy(ramDomain, ramDomain + 2, data);
352const t_tuple& tuple = reinterpret_cast<const t_tuple&>(data);
353context h;
354return insert(tuple, h);
355}
356bool Type::insert(RamDomain a0,RamDomain a1) {
357RamDomain data[2] = {a0,a1};
358return insert(data);
359}
360bool Type::contains(const t_tuple& t, context& h) const {
361return ind_0.contains(t, h.hints_0_lower);
362}
363bool Type::contains(const t_tuple& t) const {
364context h;
365return contains(t, h);
366}
367std::size_t Type::size() const {
368return ind_0.size();
369}
370iterator Type::find(const t_tuple& t, context& h) const {
371return ind_0.find(t, h.hints_0_lower);
372}
373iterator Type::find(const t_tuple& t) const {
374context h;
375return find(t, h);
376}
377range<iterator> Type::lowerUpperRange_00(const t_tuple& /* lower */, const t_tuple& /* upper */, context& /* h */) const {
378return range<iterator>(ind_0.begin(),ind_0.end());
379}
380range<iterator> Type::lowerUpperRange_00(const t_tuple& /* lower */, const t_tuple& /* upper */) const {
381return range<iterator>(ind_0.begin(),ind_0.end());
382}
383range<t_ind_0::iterator> Type::lowerUpperRange_11(const t_tuple& lower, const t_tuple& upper, context& h) const {
384t_comparator_0 comparator;
385int cmp = comparator(lower, upper);
386if (cmp == 0) {
387 auto pos = ind_0.find(lower, h.hints_0_lower);
388 auto fin = ind_0.end();
389 if (pos != fin) {fin = pos; ++fin;}
390 return make_range(pos, fin);
391}
392if (cmp > 0) {
393 return make_range(ind_0.end(), ind_0.end());
394}
395return make_range(ind_0.lower_bound(lower, h.hints_0_lower), ind_0.upper_bound(upper, h.hints_0_upper));
396}
397range<t_ind_0::iterator> Type::lowerUpperRange_11(const t_tuple& lower, const t_tuple& upper) const {
398context h;
399return lowerUpperRange_11(lower,upper,h);
400}
401range<t_ind_0::iterator> Type::lowerUpperRange_10(const t_tuple& lower, const t_tuple& upper, context& h) const {
402t_comparator_0 comparator;
403int cmp = comparator(lower, upper);
404if (cmp > 0) {
405 return make_range(ind_0.end(), ind_0.end());
406}
407return make_range(ind_0.lower_bound(lower, h.hints_0_lower), ind_0.upper_bound(upper, h.hints_0_upper));
408}
409range<t_ind_0::iterator> Type::lowerUpperRange_10(const t_tuple& lower, const t_tuple& upper) const {
410context h;
411return lowerUpperRange_10(lower,upper,h);
412}
413bool Type::empty() const {
414return ind_0.empty();
415}
416std::vector<range<iterator>> Type::partition() const {
417return ind_0.getChunks(400);
418}
419void Type::purge() {
420ind_0.clear();
421}
422iterator Type::begin() const {
423return ind_0.begin();
424}
425iterator Type::end() const {
426return ind_0.end();
427}
428void Type::printStatistics(std::ostream& o) const {
429o << " arity 2 direct b-tree index 0 lex-order [0,1]\n";
430ind_0.printStats(o);
431}
432} // namespace souffle::t_btree_ii__0_1__11__10
433namespace souffle {
434using namespace souffle;
435class Stratum_call_104fac07831e2229 {
436public:
437 Stratum_call_104fac07831e2229(SymbolTable& symTable,RecordTable& recordTable,ConcurrentCache<std::string,std::regex>& regexCache,bool& pruneImdtRels,bool& performIO,SignalHandler*& signalHandler,std::atomic<std::size_t>& iter,std::atomic<RamDomain>& ctr,std::string& inputDirectory,std::string& outputDirectory,t_btree_iii__2_0_1__001__111::Type& rel_call_ee1d8972d66cc25f);
438void run([[maybe_unused]] const std::vector<RamDomain>& args,[[maybe_unused]] std::vector<RamDomain>& ret);
439private:
440SymbolTable& symTable;
441RecordTable& recordTable;
442ConcurrentCache<std::string,std::regex>& regexCache;
443bool& pruneImdtRels;
444bool& performIO;
445SignalHandler*& signalHandler;
446std::atomic<std::size_t>& iter;
447std::atomic<RamDomain>& ctr;
448std::string& inputDirectory;
449std::string& outputDirectory;
450t_btree_iii__2_0_1__001__111::Type* rel_call_ee1d8972d66cc25f;
451};
452} // namespace souffle
453namespace souffle {
454using namespace souffle;
455 Stratum_call_104fac07831e2229::Stratum_call_104fac07831e2229(SymbolTable& symTable,RecordTable& recordTable,ConcurrentCache<std::string,std::regex>& regexCache,bool& pruneImdtRels,bool& performIO,SignalHandler*& signalHandler,std::atomic<std::size_t>& iter,std::atomic<RamDomain>& ctr,std::string& inputDirectory,std::string& outputDirectory,t_btree_iii__2_0_1__001__111::Type& rel_call_ee1d8972d66cc25f):
456symTable(symTable),
457recordTable(recordTable),
458regexCache(regexCache),
459pruneImdtRels(pruneImdtRels),
460performIO(performIO),
461signalHandler(signalHandler),
462iter(iter),
463ctr(ctr),
464inputDirectory(inputDirectory),
465outputDirectory(outputDirectory),
466rel_call_ee1d8972d66cc25f(&rel_call_ee1d8972d66cc25f){
467}
468
469void Stratum_call_104fac07831e2229::run([[maybe_unused]] const std::vector<RamDomain>& args,[[maybe_unused]] std::vector<RamDomain>& ret){
470if (performIO) {
471try {std::map<std::string, std::string> directiveMap({{"IO","file"},{"attributeNames","caller\ts\tcallee"},{"auxArity","0"},{"fact-dir","."},{"name","call"},{"operation","input"},{"params","{\"records\": {}, \"relation\": {\"arity\": 3, \"params\": [\"caller\", \"s\", \"callee\"]}}"},{"types","{\"ADTs\": {}, \"records\": {}, \"relation\": {\"arity\": 3, \"types\": [\"s:Function\", \"i:Statement\", \"s:Function\"]}}"}});
472if (!inputDirectory.empty()) {directiveMap["fact-dir"] = inputDirectory;}
473IOSystem::getInstance().getReader(directiveMap, symTable, recordTable)->readAll(*rel_call_ee1d8972d66cc25f);
474} catch (std::exception& e) {std::cerr << "Error loading call data: " << e.what() << '\n';
475exit(1);
476}
477}
478}
479
480} // namespace souffle
481
482namespace souffle {
483using namespace souffle;
484class Stratum_might_collect_beadc513d07ff032 {
485public:
486 Stratum_might_collect_beadc513d07ff032(SymbolTable& symTable,RecordTable& recordTable,ConcurrentCache<std::string,std::regex>& regexCache,bool& pruneImdtRels,bool& performIO,SignalHandler*& signalHandler,std::atomic<std::size_t>& iter,std::atomic<RamDomain>& ctr,std::string& inputDirectory,std::string& outputDirectory,t_btree_ii__0_1__11__10::Type& rel_delta_might_collect_d651f71586aafe59,t_btree_ii__0_1__11__10::Type& rel_new_might_collect_5d48ef45a97e4618,t_btree_iii__2_0_1__001__111::Type& rel_call_ee1d8972d66cc25f,t_btree_ii__0_1__11::Type& rel_might_collect_ef1d0b06d36e4ddc);
487void run([[maybe_unused]] const std::vector<RamDomain>& args,[[maybe_unused]] std::vector<RamDomain>& ret);
488private:
489SymbolTable& symTable;
490RecordTable& recordTable;
491ConcurrentCache<std::string,std::regex>& regexCache;
492bool& pruneImdtRels;
493bool& performIO;
494SignalHandler*& signalHandler;
495std::atomic<std::size_t>& iter;
496std::atomic<RamDomain>& ctr;
497std::string& inputDirectory;
498std::string& outputDirectory;
499t_btree_ii__0_1__11__10::Type* rel_delta_might_collect_d651f71586aafe59;
500t_btree_ii__0_1__11__10::Type* rel_new_might_collect_5d48ef45a97e4618;
501t_btree_iii__2_0_1__001__111::Type* rel_call_ee1d8972d66cc25f;
502t_btree_ii__0_1__11::Type* rel_might_collect_ef1d0b06d36e4ddc;
503};
504} // namespace souffle
505namespace souffle {
506using namespace souffle;
507 Stratum_might_collect_beadc513d07ff032::Stratum_might_collect_beadc513d07ff032(SymbolTable& symTable,RecordTable& recordTable,ConcurrentCache<std::string,std::regex>& regexCache,bool& pruneImdtRels,bool& performIO,SignalHandler*& signalHandler,std::atomic<std::size_t>& iter,std::atomic<RamDomain>& ctr,std::string& inputDirectory,std::string& outputDirectory,t_btree_ii__0_1__11__10::Type& rel_delta_might_collect_d651f71586aafe59,t_btree_ii__0_1__11__10::Type& rel_new_might_collect_5d48ef45a97e4618,t_btree_iii__2_0_1__001__111::Type& rel_call_ee1d8972d66cc25f,t_btree_ii__0_1__11::Type& rel_might_collect_ef1d0b06d36e4ddc):
508symTable(symTable),
509recordTable(recordTable),
510regexCache(regexCache),
511pruneImdtRels(pruneImdtRels),
512performIO(performIO),
513signalHandler(signalHandler),
514iter(iter),
515ctr(ctr),
516inputDirectory(inputDirectory),
517outputDirectory(outputDirectory),
518rel_delta_might_collect_d651f71586aafe59(&rel_delta_might_collect_d651f71586aafe59),
519rel_new_might_collect_5d48ef45a97e4618(&rel_new_might_collect_5d48ef45a97e4618),
520rel_call_ee1d8972d66cc25f(&rel_call_ee1d8972d66cc25f),
521rel_might_collect_ef1d0b06d36e4ddc(&rel_might_collect_ef1d0b06d36e4ddc){
522}
523
524void Stratum_might_collect_beadc513d07ff032::run([[maybe_unused]] const std::vector<RamDomain>& args,[[maybe_unused]] std::vector<RamDomain>& ret){
525signalHandler->setMsg(R"_(might_collect(f,s) :-
526 call(f,s,"mylib.MaybeCollect").
527in file call-graph.dl [14:1-14:57])_");
528if(!(rel_call_ee1d8972d66cc25f->empty())) {
529[&](){
530CREATE_OP_CONTEXT(rel_call_ee1d8972d66cc25f_op_ctxt,rel_call_ee1d8972d66cc25f->createContext());
531CREATE_OP_CONTEXT(rel_might_collect_ef1d0b06d36e4ddc_op_ctxt,rel_might_collect_ef1d0b06d36e4ddc->createContext());
532auto range = rel_call_ee1d8972d66cc25f->lowerUpperRange_001(Tuple<RamDomain,3>{{ramBitCast<RamDomain>(MIN_RAM_SIGNED), ramBitCast<RamDomain>(MIN_RAM_SIGNED), ramBitCast(RamSigned(0))}},Tuple<RamDomain,3>{{ramBitCast<RamDomain>(MAX_RAM_SIGNED), ramBitCast<RamDomain>(MAX_RAM_SIGNED), ramBitCast(RamSigned(0))}},READ_OP_CONTEXT(rel_call_ee1d8972d66cc25f_op_ctxt));
533for(const auto& env0 : range) {
534Tuple<RamDomain,2> tuple{{ramBitCast(env0[0]),ramBitCast(env0[1])}};
535rel_might_collect_ef1d0b06d36e4ddc->insert(tuple,READ_OP_CONTEXT(rel_might_collect_ef1d0b06d36e4ddc_op_ctxt));
536}
537}
538();}
539[&](){
540CREATE_OP_CONTEXT(rel_delta_might_collect_d651f71586aafe59_op_ctxt,rel_delta_might_collect_d651f71586aafe59->createContext());
541CREATE_OP_CONTEXT(rel_might_collect_ef1d0b06d36e4ddc_op_ctxt,rel_might_collect_ef1d0b06d36e4ddc->createContext());
542for(const auto& env0 : *rel_might_collect_ef1d0b06d36e4ddc) {
543Tuple<RamDomain,2> tuple{{ramBitCast(env0[0]),ramBitCast(env0[1])}};
544rel_delta_might_collect_d651f71586aafe59->insert(tuple,READ_OP_CONTEXT(rel_delta_might_collect_d651f71586aafe59_op_ctxt));
545}
546}
547();auto loop_counter = RamUnsigned(1);
548iter = 0;
549for(;;) {
550signalHandler->setMsg(R"_(might_collect(f,s) :-
551 call(f,s,g),
552 might_collect(g,_).
553in file call-graph.dl [15:1-15:59])_");
554if(!(rel_call_ee1d8972d66cc25f->empty()) && !(rel_delta_might_collect_d651f71586aafe59->empty())) {
555[&](){
556CREATE_OP_CONTEXT(rel_delta_might_collect_d651f71586aafe59_op_ctxt,rel_delta_might_collect_d651f71586aafe59->createContext());
557CREATE_OP_CONTEXT(rel_new_might_collect_5d48ef45a97e4618_op_ctxt,rel_new_might_collect_5d48ef45a97e4618->createContext());
558CREATE_OP_CONTEXT(rel_call_ee1d8972d66cc25f_op_ctxt,rel_call_ee1d8972d66cc25f->createContext());
559CREATE_OP_CONTEXT(rel_might_collect_ef1d0b06d36e4ddc_op_ctxt,rel_might_collect_ef1d0b06d36e4ddc->createContext());
560for(const auto& env0 : *rel_call_ee1d8972d66cc25f) {
561if( !rel_delta_might_collect_d651f71586aafe59->lowerUpperRange_10(Tuple<RamDomain,2>{{ramBitCast(env0[2]), ramBitCast<RamDomain>(MIN_RAM_SIGNED)}},Tuple<RamDomain,2>{{ramBitCast(env0[2]), ramBitCast<RamDomain>(MAX_RAM_SIGNED)}},READ_OP_CONTEXT(rel_delta_might_collect_d651f71586aafe59_op_ctxt)).empty() && !(rel_might_collect_ef1d0b06d36e4ddc->contains(Tuple<RamDomain,2>{{ramBitCast(env0[0]),ramBitCast(env0[1])}},READ_OP_CONTEXT(rel_might_collect_ef1d0b06d36e4ddc_op_ctxt)))) {
562Tuple<RamDomain,2> tuple{{ramBitCast(env0[0]),ramBitCast(env0[1])}};
563rel_new_might_collect_5d48ef45a97e4618->insert(tuple,READ_OP_CONTEXT(rel_new_might_collect_5d48ef45a97e4618_op_ctxt));
564}
565}
566}
567();}
568if(rel_new_might_collect_5d48ef45a97e4618->empty()) break;
569[&](){
570CREATE_OP_CONTEXT(rel_new_might_collect_5d48ef45a97e4618_op_ctxt,rel_new_might_collect_5d48ef45a97e4618->createContext());
571CREATE_OP_CONTEXT(rel_might_collect_ef1d0b06d36e4ddc_op_ctxt,rel_might_collect_ef1d0b06d36e4ddc->createContext());
572for(const auto& env0 : *rel_new_might_collect_5d48ef45a97e4618) {
573Tuple<RamDomain,2> tuple{{ramBitCast(env0[0]),ramBitCast(env0[1])}};
574rel_might_collect_ef1d0b06d36e4ddc->insert(tuple,READ_OP_CONTEXT(rel_might_collect_ef1d0b06d36e4ddc_op_ctxt));
575}
576}
577();std::swap(rel_delta_might_collect_d651f71586aafe59, rel_new_might_collect_5d48ef45a97e4618);
578rel_new_might_collect_5d48ef45a97e4618->purge();
579loop_counter = (ramBitCast<RamUnsigned>(loop_counter) + ramBitCast<RamUnsigned>(RamUnsigned(1)));
580iter++;
581}
582iter = 0;
583rel_delta_might_collect_d651f71586aafe59->purge();
584rel_new_might_collect_5d48ef45a97e4618->purge();
585if (performIO) {
586try {std::map<std::string, std::string> directiveMap({{"IO","file"},{"attributeNames","f\ts"},{"auxArity","0"},{"name","might_collect"},{"operation","output"},{"output-dir","."},{"params","{\"records\": {}, \"relation\": {\"arity\": 2, \"params\": [\"f\", \"s\"]}}"},{"types","{\"ADTs\": {}, \"records\": {}, \"relation\": {\"arity\": 2, \"types\": [\"s:Function\", \"i:Statement\"]}}"}});
587if (outputDirectory == "-"){directiveMap["IO"] = "stdout"; directiveMap["headers"] = "true";}
588else if (!outputDirectory.empty()) {directiveMap["output-dir"] = outputDirectory;}
589IOSystem::getInstance().getWriter(directiveMap, symTable, recordTable)->writeAll(*rel_might_collect_ef1d0b06d36e4ddc);
590} catch (std::exception& e) {std::cerr << e.what();exit(1);}
591}
592if (pruneImdtRels) rel_call_ee1d8972d66cc25f->purge();
593}
594
595} // namespace souffle
596
597namespace souffle {
598using namespace souffle;
599class Sf__: public SouffleProgram {
600public:
601 Sf__();
602 ~Sf__();
603void run();
604void runAll(std::string inputDirectoryArg = "",std::string outputDirectoryArg = "",bool performIOArg = true,bool pruneImdtRelsArg = true);
605void printAll([[maybe_unused]] std::string outputDirectoryArg = "");
606void loadAll([[maybe_unused]] std::string inputDirectoryArg = "");
607void dumpInputs();
608void dumpOutputs();
609SymbolTable& getSymbolTable();
610RecordTable& getRecordTable();
611void setNumThreads(std::size_t numThreadsValue);
612void executeSubroutine(std::string name,const std::vector<RamDomain>& args,std::vector<RamDomain>& ret);
613private:
614void runFunction(std::string inputDirectoryArg,std::string outputDirectoryArg,bool performIOArg,bool pruneImdtRelsArg);
615SymbolTableImpl symTable;
616SpecializedRecordTable<0> recordTable;
617ConcurrentCache<std::string,std::regex> regexCache;
618Own<t_btree_iii__2_0_1__001__111::Type> rel_call_ee1d8972d66cc25f;
619souffle::RelationWrapper<t_btree_iii__2_0_1__001__111::Type> wrapper_rel_call_ee1d8972d66cc25f;
620Own<t_btree_ii__0_1__11::Type> rel_might_collect_ef1d0b06d36e4ddc;
621souffle::RelationWrapper<t_btree_ii__0_1__11::Type> wrapper_rel_might_collect_ef1d0b06d36e4ddc;
622Own<t_btree_ii__0_1__11__10::Type> rel_delta_might_collect_d651f71586aafe59;
623Own<t_btree_ii__0_1__11__10::Type> rel_new_might_collect_5d48ef45a97e4618;
624Stratum_call_104fac07831e2229 stratum_call_587d2d7effb5d130;
625Stratum_might_collect_beadc513d07ff032 stratum_might_collect_cc50af26f53a71ac;
626std::string inputDirectory;
627std::string outputDirectory;
628SignalHandler* signalHandler{SignalHandler::instance()};
629std::atomic<RamDomain> ctr{};
630std::atomic<std::size_t> iter{};
631};
632} // namespace souffle
633namespace souffle {
634using namespace souffle;
635 Sf__::Sf__():
636symTable({
637 R"_(mylib.MaybeCollect)_",
638}),
639recordTable(),
640regexCache(),
641rel_call_ee1d8972d66cc25f(mk<t_btree_iii__2_0_1__001__111::Type>()),
642wrapper_rel_call_ee1d8972d66cc25f(0, *rel_call_ee1d8972d66cc25f, *this, "call", std::array<const char *,3>{{"s:Function","i:Statement","s:Function"}}, std::array<const char *,3>{{"caller","s","callee"}}, 0),
643rel_might_collect_ef1d0b06d36e4ddc(mk<t_btree_ii__0_1__11::Type>()),
644wrapper_rel_might_collect_ef1d0b06d36e4ddc(1, *rel_might_collect_ef1d0b06d36e4ddc, *this, "might_collect", std::array<const char *,2>{{"s:Function","i:Statement"}}, std::array<const char *,2>{{"f","s"}}, 0),
645rel_delta_might_collect_d651f71586aafe59(mk<t_btree_ii__0_1__11__10::Type>()),
646rel_new_might_collect_5d48ef45a97e4618(mk<t_btree_ii__0_1__11__10::Type>()),
647stratum_call_587d2d7effb5d130(symTable,recordTable,regexCache,pruneImdtRels,performIO,signalHandler,iter,ctr,inputDirectory,outputDirectory,*rel_call_ee1d8972d66cc25f),
648stratum_might_collect_cc50af26f53a71ac(symTable,recordTable,regexCache,pruneImdtRels,performIO,signalHandler,iter,ctr,inputDirectory,outputDirectory,*rel_delta_might_collect_d651f71586aafe59,*rel_new_might_collect_5d48ef45a97e4618,*rel_call_ee1d8972d66cc25f,*rel_might_collect_ef1d0b06d36e4ddc){
649addRelation("call", wrapper_rel_call_ee1d8972d66cc25f, true, false);
650addRelation("might_collect", wrapper_rel_might_collect_ef1d0b06d36e4ddc, false, true);
651}
652
653 Sf__::~Sf__(){
654}
655
656void Sf__::runFunction(std::string inputDirectoryArg,std::string outputDirectoryArg,bool performIOArg,bool pruneImdtRelsArg){
657
658 this->inputDirectory = std::move(inputDirectoryArg);
659 this->outputDirectory = std::move(outputDirectoryArg);
660 this->performIO = performIOArg;
661 this->pruneImdtRels = pruneImdtRelsArg;
662
663 // set default threads (in embedded mode)
664 // if this is not set, and omp is used, the default omp setting of number of cores is used.
665#if defined(_OPENMP)
666 if (0 < getNumThreads()) { omp_set_num_threads(static_cast<int>(getNumThreads())); }
667#endif
668
669 signalHandler->set();
670// -- query evaluation --
671{
672 std::vector<RamDomain> args, ret;
673stratum_call_587d2d7effb5d130.run(args, ret);
674}
675{
676 std::vector<RamDomain> args, ret;
677stratum_might_collect_cc50af26f53a71ac.run(args, ret);
678}
679
680// -- relation hint statistics --
681signalHandler->reset();
682}
683
684void Sf__::run(){
685runFunction("", "", false, false);
686}
687
688void Sf__::runAll(std::string inputDirectoryArg,std::string outputDirectoryArg,bool performIOArg,bool pruneImdtRelsArg){
689runFunction(inputDirectoryArg, outputDirectoryArg, performIOArg, pruneImdtRelsArg);
690}
691
692void Sf__::printAll([[maybe_unused]] std::string outputDirectoryArg){
693try {std::map<std::string, std::string> directiveMap({{"IO","file"},{"attributeNames","f\ts"},{"auxArity","0"},{"name","might_collect"},{"operation","output"},{"output-dir","."},{"params","{\"records\": {}, \"relation\": {\"arity\": 2, \"params\": [\"f\", \"s\"]}}"},{"types","{\"ADTs\": {}, \"records\": {}, \"relation\": {\"arity\": 2, \"types\": [\"s:Function\", \"i:Statement\"]}}"}});
694if (!outputDirectoryArg.empty()) {directiveMap["output-dir"] = outputDirectoryArg;}
695IOSystem::getInstance().getWriter(directiveMap, symTable, recordTable)->writeAll(*rel_might_collect_ef1d0b06d36e4ddc);
696} catch (std::exception& e) {std::cerr << e.what();exit(1);}
697}
698
699void Sf__::loadAll([[maybe_unused]] std::string inputDirectoryArg){
700try {std::map<std::string, std::string> directiveMap({{"IO","file"},{"attributeNames","caller\ts\tcallee"},{"auxArity","0"},{"fact-dir","."},{"name","call"},{"operation","input"},{"params","{\"records\": {}, \"relation\": {\"arity\": 3, \"params\": [\"caller\", \"s\", \"callee\"]}}"},{"types","{\"ADTs\": {}, \"records\": {}, \"relation\": {\"arity\": 3, \"types\": [\"s:Function\", \"i:Statement\", \"s:Function\"]}}"}});
701if (!inputDirectoryArg.empty()) {directiveMap["fact-dir"] = inputDirectoryArg;}
702IOSystem::getInstance().getReader(directiveMap, symTable, recordTable)->readAll(*rel_call_ee1d8972d66cc25f);
703} catch (std::exception& e) {std::cerr << "Error loading call data: " << e.what() << '\n';
704exit(1);
705}
706}
707
708void Sf__::dumpInputs(){
709try {std::map<std::string, std::string> rwOperation;
710rwOperation["IO"] = "stdout";
711rwOperation["name"] = "call";
712rwOperation["types"] = "{\"relation\": {\"arity\": 3, \"auxArity\": 0, \"types\": [\"s:Function\", \"i:Statement\", \"s:Function\"]}}";
713IOSystem::getInstance().getWriter(rwOperation, symTable, recordTable)->writeAll(*rel_call_ee1d8972d66cc25f);
714} catch (std::exception& e) {std::cerr << e.what();exit(1);}
715}
716
717void Sf__::dumpOutputs(){
718try {std::map<std::string, std::string> rwOperation;
719rwOperation["IO"] = "stdout";
720rwOperation["name"] = "might_collect";
721rwOperation["types"] = "{\"relation\": {\"arity\": 2, \"auxArity\": 0, \"types\": [\"s:Function\", \"i:Statement\"]}}";
722IOSystem::getInstance().getWriter(rwOperation, symTable, recordTable)->writeAll(*rel_might_collect_ef1d0b06d36e4ddc);
723} catch (std::exception& e) {std::cerr << e.what();exit(1);}
724}
725
726SymbolTable& Sf__::getSymbolTable(){
727return symTable;
728}
729
730RecordTable& Sf__::getRecordTable(){
731return recordTable;
732}
733
734void Sf__::setNumThreads(std::size_t numThreadsValue){
735SouffleProgram::setNumThreads(numThreadsValue);
736symTable.setNumLanes(getNumThreads());
737recordTable.setNumLanes(getNumThreads());
738regexCache.setNumLanes(getNumThreads());
739}
740
741void Sf__::executeSubroutine(std::string name,const std::vector<RamDomain>& args,std::vector<RamDomain>& ret){
742if (name == "call") {
743stratum_call_587d2d7effb5d130.run(args, ret);
744return;}
745if (name == "might_collect") {
746stratum_might_collect_cc50af26f53a71ac.run(args, ret);
747return;}
748fatal(("unknown subroutine " + name).c_str());
749}
750
751} // namespace souffle
752namespace souffle {
753SouffleProgram *newInstance__(){return new souffle::Sf__;}
754SymbolTable *getST__(SouffleProgram *p){return &reinterpret_cast<souffle::Sf__*>(p)->getSymbolTable();}
755} // namespace souffle
756
757#ifndef __EMBEDDED_SOUFFLE__
758#include "souffle/CompiledOptions.h"
759int main(int argc, char** argv)
760{
761try{
762souffle::CmdOptions opt(R"(mycpp/datalog/call-graph.dl)",
763R"()",
764R"()",
765false,
766R"()",
7671);
768if (!opt.parse(argc,argv)) return 1;
769souffle::Sf__ obj;
770#if defined(_OPENMP)
771obj.setNumThreads(opt.getNumJobs());
772
773#endif
774obj.runAll(opt.getInputFileDir(), opt.getOutputFileDir());
775return 0;
776} catch(std::exception &e) { souffle::SignalHandler::instance()->error(e.what());}
777}
778#endif
779
780namespace souffle {
781using namespace souffle;
782class factory_Sf__: souffle::ProgramFactory {
783public:
784souffle::SouffleProgram* newInstance();
785 factory_Sf__();
786private:
787};
788} // namespace souffle
789namespace souffle {
790using namespace souffle;
791souffle::SouffleProgram* factory_Sf__::newInstance(){
792return new souffle::Sf__();
793}
794
795 factory_Sf__::factory_Sf__():
796souffle::ProgramFactory("_"){
797}
798
799} // namespace souffle
800namespace souffle {
801
802#ifdef __EMBEDDED_SOUFFLE__
803extern "C" {
804souffle::factory_Sf__ __factory_Sf___instance;
805}
806#endif
807} // namespace souffle
808