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

815 lines, 641 significant
1#define SOUFFLE_GENERATOR_VERSION "39d42a366"
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("mylib.MaybeCollect",0).
526in file call-graph.dl [14:1-14:40])_");
527[&](){
528CREATE_OP_CONTEXT(rel_might_collect_ef1d0b06d36e4ddc_op_ctxt,rel_might_collect_ef1d0b06d36e4ddc->createContext());
529Tuple<RamDomain,2> tuple{{ramBitCast(RamSigned(0)),ramBitCast(RamSigned(0))}};
530rel_might_collect_ef1d0b06d36e4ddc->insert(tuple,READ_OP_CONTEXT(rel_might_collect_ef1d0b06d36e4ddc_op_ctxt));
531}
532();signalHandler->setMsg(R"_(might_collect(f,s) :-
533 call(f,s,"mylib.MaybeCollect").
534in file call-graph.dl [15:1-15:57])_");
535if(!(rel_call_ee1d8972d66cc25f->empty())) {
536[&](){
537CREATE_OP_CONTEXT(rel_call_ee1d8972d66cc25f_op_ctxt,rel_call_ee1d8972d66cc25f->createContext());
538CREATE_OP_CONTEXT(rel_might_collect_ef1d0b06d36e4ddc_op_ctxt,rel_might_collect_ef1d0b06d36e4ddc->createContext());
539auto 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));
540for(const auto& env0 : range) {
541Tuple<RamDomain,2> tuple{{ramBitCast(env0[0]),ramBitCast(env0[1])}};
542rel_might_collect_ef1d0b06d36e4ddc->insert(tuple,READ_OP_CONTEXT(rel_might_collect_ef1d0b06d36e4ddc_op_ctxt));
543}
544}
545();}
546[&](){
547CREATE_OP_CONTEXT(rel_delta_might_collect_d651f71586aafe59_op_ctxt,rel_delta_might_collect_d651f71586aafe59->createContext());
548CREATE_OP_CONTEXT(rel_might_collect_ef1d0b06d36e4ddc_op_ctxt,rel_might_collect_ef1d0b06d36e4ddc->createContext());
549for(const auto& env0 : *rel_might_collect_ef1d0b06d36e4ddc) {
550Tuple<RamDomain,2> tuple{{ramBitCast(env0[0]),ramBitCast(env0[1])}};
551rel_delta_might_collect_d651f71586aafe59->insert(tuple,READ_OP_CONTEXT(rel_delta_might_collect_d651f71586aafe59_op_ctxt));
552}
553}
554();auto loop_counter = RamUnsigned(1);
555iter = 0;
556for(;;) {
557signalHandler->setMsg(R"_(might_collect(f,s) :-
558 call(f,s,g),
559 might_collect(g,_).
560in file call-graph.dl [16:1-16:59])_");
561if(!(rel_call_ee1d8972d66cc25f->empty()) && !(rel_delta_might_collect_d651f71586aafe59->empty())) {
562[&](){
563CREATE_OP_CONTEXT(rel_delta_might_collect_d651f71586aafe59_op_ctxt,rel_delta_might_collect_d651f71586aafe59->createContext());
564CREATE_OP_CONTEXT(rel_new_might_collect_5d48ef45a97e4618_op_ctxt,rel_new_might_collect_5d48ef45a97e4618->createContext());
565CREATE_OP_CONTEXT(rel_call_ee1d8972d66cc25f_op_ctxt,rel_call_ee1d8972d66cc25f->createContext());
566CREATE_OP_CONTEXT(rel_might_collect_ef1d0b06d36e4ddc_op_ctxt,rel_might_collect_ef1d0b06d36e4ddc->createContext());
567for(const auto& env0 : *rel_call_ee1d8972d66cc25f) {
568if( !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)))) {
569Tuple<RamDomain,2> tuple{{ramBitCast(env0[0]),ramBitCast(env0[1])}};
570rel_new_might_collect_5d48ef45a97e4618->insert(tuple,READ_OP_CONTEXT(rel_new_might_collect_5d48ef45a97e4618_op_ctxt));
571}
572}
573}
574();}
575if(rel_new_might_collect_5d48ef45a97e4618->empty()) break;
576[&](){
577CREATE_OP_CONTEXT(rel_new_might_collect_5d48ef45a97e4618_op_ctxt,rel_new_might_collect_5d48ef45a97e4618->createContext());
578CREATE_OP_CONTEXT(rel_might_collect_ef1d0b06d36e4ddc_op_ctxt,rel_might_collect_ef1d0b06d36e4ddc->createContext());
579for(const auto& env0 : *rel_new_might_collect_5d48ef45a97e4618) {
580Tuple<RamDomain,2> tuple{{ramBitCast(env0[0]),ramBitCast(env0[1])}};
581rel_might_collect_ef1d0b06d36e4ddc->insert(tuple,READ_OP_CONTEXT(rel_might_collect_ef1d0b06d36e4ddc_op_ctxt));
582}
583}
584();std::swap(rel_delta_might_collect_d651f71586aafe59, rel_new_might_collect_5d48ef45a97e4618);
585rel_new_might_collect_5d48ef45a97e4618->purge();
586loop_counter = (ramBitCast<RamUnsigned>(loop_counter) + ramBitCast<RamUnsigned>(RamUnsigned(1)));
587iter++;
588}
589iter = 0;
590rel_delta_might_collect_d651f71586aafe59->purge();
591rel_new_might_collect_5d48ef45a97e4618->purge();
592if (performIO) {
593try {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\"]}}"}});
594if (outputDirectory == "-"){directiveMap["IO"] = "stdout"; directiveMap["headers"] = "true";}
595else if (!outputDirectory.empty()) {directiveMap["output-dir"] = outputDirectory;}
596IOSystem::getInstance().getWriter(directiveMap, symTable, recordTable)->writeAll(*rel_might_collect_ef1d0b06d36e4ddc);
597} catch (std::exception& e) {std::cerr << e.what();exit(1);}
598}
599if (pruneImdtRels) rel_call_ee1d8972d66cc25f->purge();
600}
601
602} // namespace souffle
603
604namespace souffle {
605using namespace souffle;
606class Sf__: public SouffleProgram {
607public:
608 Sf__();
609 ~Sf__();
610void run();
611void runAll(std::string inputDirectoryArg = "",std::string outputDirectoryArg = "",bool performIOArg = true,bool pruneImdtRelsArg = true);
612void printAll([[maybe_unused]] std::string outputDirectoryArg = "");
613void loadAll([[maybe_unused]] std::string inputDirectoryArg = "");
614void dumpInputs();
615void dumpOutputs();
616SymbolTable& getSymbolTable();
617RecordTable& getRecordTable();
618void setNumThreads(std::size_t numThreadsValue);
619void executeSubroutine(std::string name,const std::vector<RamDomain>& args,std::vector<RamDomain>& ret);
620private:
621void runFunction(std::string inputDirectoryArg,std::string outputDirectoryArg,bool performIOArg,bool pruneImdtRelsArg);
622SymbolTableImpl symTable;
623SpecializedRecordTable<0> recordTable;
624ConcurrentCache<std::string,std::regex> regexCache;
625Own<t_btree_iii__2_0_1__001__111::Type> rel_call_ee1d8972d66cc25f;
626souffle::RelationWrapper<t_btree_iii__2_0_1__001__111::Type> wrapper_rel_call_ee1d8972d66cc25f;
627Own<t_btree_ii__0_1__11::Type> rel_might_collect_ef1d0b06d36e4ddc;
628souffle::RelationWrapper<t_btree_ii__0_1__11::Type> wrapper_rel_might_collect_ef1d0b06d36e4ddc;
629Own<t_btree_ii__0_1__11__10::Type> rel_delta_might_collect_d651f71586aafe59;
630Own<t_btree_ii__0_1__11__10::Type> rel_new_might_collect_5d48ef45a97e4618;
631Stratum_call_104fac07831e2229 stratum_call_587d2d7effb5d130;
632Stratum_might_collect_beadc513d07ff032 stratum_might_collect_cc50af26f53a71ac;
633std::string inputDirectory;
634std::string outputDirectory;
635SignalHandler* signalHandler{SignalHandler::instance()};
636std::atomic<RamDomain> ctr{};
637std::atomic<std::size_t> iter{};
638};
639} // namespace souffle
640namespace souffle {
641using namespace souffle;
642 Sf__::Sf__():
643symTable({
644 R"_(mylib.MaybeCollect)_",
645}),
646recordTable(),
647regexCache(),
648rel_call_ee1d8972d66cc25f(mk<t_btree_iii__2_0_1__001__111::Type>()),
649wrapper_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),
650rel_might_collect_ef1d0b06d36e4ddc(mk<t_btree_ii__0_1__11::Type>()),
651wrapper_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),
652rel_delta_might_collect_d651f71586aafe59(mk<t_btree_ii__0_1__11__10::Type>()),
653rel_new_might_collect_5d48ef45a97e4618(mk<t_btree_ii__0_1__11__10::Type>()),
654stratum_call_587d2d7effb5d130(symTable,recordTable,regexCache,pruneImdtRels,performIO,signalHandler,iter,ctr,inputDirectory,outputDirectory,*rel_call_ee1d8972d66cc25f),
655stratum_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){
656addRelation("call", wrapper_rel_call_ee1d8972d66cc25f, true, false);
657addRelation("might_collect", wrapper_rel_might_collect_ef1d0b06d36e4ddc, false, true);
658}
659
660 Sf__::~Sf__(){
661}
662
663void Sf__::runFunction(std::string inputDirectoryArg,std::string outputDirectoryArg,bool performIOArg,bool pruneImdtRelsArg){
664
665 this->inputDirectory = std::move(inputDirectoryArg);
666 this->outputDirectory = std::move(outputDirectoryArg);
667 this->performIO = performIOArg;
668 this->pruneImdtRels = pruneImdtRelsArg;
669
670 // set default threads (in embedded mode)
671 // if this is not set, and omp is used, the default omp setting of number of cores is used.
672#if defined(_OPENMP)
673 if (0 < getNumThreads()) { omp_set_num_threads(static_cast<int>(getNumThreads())); }
674#endif
675
676 signalHandler->set();
677// -- query evaluation --
678{
679 std::vector<RamDomain> args, ret;
680stratum_call_587d2d7effb5d130.run(args, ret);
681}
682{
683 std::vector<RamDomain> args, ret;
684stratum_might_collect_cc50af26f53a71ac.run(args, ret);
685}
686
687// -- relation hint statistics --
688signalHandler->reset();
689}
690
691void Sf__::run(){
692runFunction("", "", false, false);
693}
694
695void Sf__::runAll(std::string inputDirectoryArg,std::string outputDirectoryArg,bool performIOArg,bool pruneImdtRelsArg){
696runFunction(inputDirectoryArg, outputDirectoryArg, performIOArg, pruneImdtRelsArg);
697}
698
699void Sf__::printAll([[maybe_unused]] std::string outputDirectoryArg){
700try {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\"]}}"}});
701if (!outputDirectoryArg.empty()) {directiveMap["output-dir"] = outputDirectoryArg;}
702IOSystem::getInstance().getWriter(directiveMap, symTable, recordTable)->writeAll(*rel_might_collect_ef1d0b06d36e4ddc);
703} catch (std::exception& e) {std::cerr << e.what();exit(1);}
704}
705
706void Sf__::loadAll([[maybe_unused]] std::string inputDirectoryArg){
707try {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\"]}}"}});
708if (!inputDirectoryArg.empty()) {directiveMap["fact-dir"] = inputDirectoryArg;}
709IOSystem::getInstance().getReader(directiveMap, symTable, recordTable)->readAll(*rel_call_ee1d8972d66cc25f);
710} catch (std::exception& e) {std::cerr << "Error loading call data: " << e.what() << '\n';
711exit(1);
712}
713}
714
715void Sf__::dumpInputs(){
716try {std::map<std::string, std::string> rwOperation;
717rwOperation["IO"] = "stdout";
718rwOperation["name"] = "call";
719rwOperation["types"] = "{\"relation\": {\"arity\": 3, \"auxArity\": 0, \"types\": [\"s:Function\", \"i:Statement\", \"s:Function\"]}}";
720IOSystem::getInstance().getWriter(rwOperation, symTable, recordTable)->writeAll(*rel_call_ee1d8972d66cc25f);
721} catch (std::exception& e) {std::cerr << e.what();exit(1);}
722}
723
724void Sf__::dumpOutputs(){
725try {std::map<std::string, std::string> rwOperation;
726rwOperation["IO"] = "stdout";
727rwOperation["name"] = "might_collect";
728rwOperation["types"] = "{\"relation\": {\"arity\": 2, \"auxArity\": 0, \"types\": [\"s:Function\", \"i:Statement\"]}}";
729IOSystem::getInstance().getWriter(rwOperation, symTable, recordTable)->writeAll(*rel_might_collect_ef1d0b06d36e4ddc);
730} catch (std::exception& e) {std::cerr << e.what();exit(1);}
731}
732
733SymbolTable& Sf__::getSymbolTable(){
734return symTable;
735}
736
737RecordTable& Sf__::getRecordTable(){
738return recordTable;
739}
740
741void Sf__::setNumThreads(std::size_t numThreadsValue){
742SouffleProgram::setNumThreads(numThreadsValue);
743symTable.setNumLanes(getNumThreads());
744recordTable.setNumLanes(getNumThreads());
745regexCache.setNumLanes(getNumThreads());
746}
747
748void Sf__::executeSubroutine(std::string name,const std::vector<RamDomain>& args,std::vector<RamDomain>& ret){
749if (name == "call") {
750stratum_call_587d2d7effb5d130.run(args, ret);
751return;}
752if (name == "might_collect") {
753stratum_might_collect_cc50af26f53a71ac.run(args, ret);
754return;}
755fatal(("unknown subroutine " + name).c_str());
756}
757
758} // namespace souffle
759namespace souffle {
760SouffleProgram *newInstance__(){return new souffle::Sf__;}
761SymbolTable *getST__(SouffleProgram *p){return &reinterpret_cast<souffle::Sf__*>(p)->getSymbolTable();}
762} // namespace souffle
763
764#ifndef __EMBEDDED_SOUFFLE__
765#include "souffle/CompiledOptions.h"
766int main(int argc, char** argv)
767{
768try{
769souffle::CmdOptions opt(R"(mycpp/datalog/call-graph.dl)",
770R"()",
771R"()",
772false,
773R"()",
7741);
775if (!opt.parse(argc,argv)) return 1;
776souffle::Sf__ obj;
777#if defined(_OPENMP)
778obj.setNumThreads(opt.getNumJobs());
779
780#endif
781obj.runAll(opt.getInputFileDir(), opt.getOutputFileDir());
782return 0;
783} catch(std::exception &e) { souffle::SignalHandler::instance()->error(e.what());}
784}
785#endif
786
787namespace souffle {
788using namespace souffle;
789class factory_Sf__: souffle::ProgramFactory {
790public:
791souffle::SouffleProgram* newInstance();
792 factory_Sf__();
793private:
794};
795} // namespace souffle
796namespace souffle {
797using namespace souffle;
798souffle::SouffleProgram* factory_Sf__::newInstance(){
799return new souffle::Sf__();
800}
801
802 factory_Sf__::factory_Sf__():
803souffle::ProgramFactory("_"){
804}
805
806} // namespace souffle
807namespace souffle {
808
809#ifdef __EMBEDDED_SOUFFLE__
810extern "C" {
811souffle::factory_Sf__ __factory_Sf___instance;
812}
813#endif
814} // namespace souffle
815