A set of benchmarks to compare a new prototype MiniZinc implementation
1/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2
3/*
4 * Main authors:
5 * Guido Tack <guido.tack@monash.edu>
6 */
7
8/* This Source Code Form is subject to the terms of the Mozilla Public
9 * License, v. 2.0. If a copy of the MPL was not distributed with this
10 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
11
12namespace MiniZinc {
13
14inline bool Expression::equal(const Expression* e0, const Expression* e1) {
15 if (e0 == e1) return true;
16 if (e0 == NULL || e1 == NULL) return false;
17 if (e0->isUnboxedInt() || e1->isUnboxedInt()) return false;
18 if (e0->isUnboxedFloatVal() || e1->isUnboxedFloatVal()) {
19 if (e0->isUnboxedFloatVal() && e1->isUnboxedFloatVal()) {
20 return e0->unboxedFloatToFloatVal() == e1->unboxedFloatToFloatVal();
21 }
22 return false;
23 }
24 if (e0->_id != e1->_id) return false;
25 if (e0->type() != e1->type()) return false;
26 if (e0->hash() != e1->hash()) return false;
27 return equal_internal(e0, e1);
28}
29
30inline void Expression::type(const Type& t) {
31 if (isUnboxedVal()) {
32 assert(!isUnboxedInt() || t == Type::parint());
33 assert(!isUnboxedFloatVal() || t == Type::parfloat());
34 return;
35 }
36 if (eid() == E_VARDECL) {
37 this->cast<VarDecl>()->id()->_type = t;
38 } else if (eid() == E_ID && this->cast<Id>()->decl()) {
39 assert(_type.bt() == Type::BT_UNKNOWN || _type.dim() == t.dim() || t.dim() != -1);
40 this->cast<Id>()->decl()->_type = t;
41 }
42 _type = t;
43}
44
45inline IntLit::IntLit(const Location& loc, IntVal v)
46 : Expression(loc, E_INTLIT, Type::parint()), _v(v) {
47 rehash();
48}
49
50inline IntLit* IntLit::a(MiniZinc::IntVal v) {
51 if (v.isFinite()) {
52 IntLit* ret = intToUnboxedInt(v.toInt());
53 if (ret) {
54 return ret;
55 }
56 }
57
58 std::unordered_map<IntVal, WeakRef>::iterator it = constants().integerMap.find(v);
59 if (it == constants().integerMap.end() || it->second() == NULL) {
60 IntLit* il = new IntLit(Location().introduce(), v);
61 if (it == constants().integerMap.end()) {
62 constants().integerMap.insert(std::make_pair(v, il));
63 } else {
64 it->second = il;
65 }
66 return il;
67 } else {
68 return it->second()->cast<IntLit>();
69 }
70}
71
72inline IntLit* IntLit::aEnum(IntVal v, unsigned int enumId) {
73 if (enumId == 0) return a(v);
74 IntLit* il = new IntLit(Location().introduce(), v);
75 Type tt(il->type());
76 tt.enumId(enumId);
77 il->type(tt);
78 return il;
79}
80
81inline ASTString Location::LocVec::filename(void) const {
82 return static_cast<ASTStringO*>(_data[0]);
83}
84inline unsigned int Location::LocVec::first_line(void) const {
85 if (_size == 2) {
86 static const unsigned int pointerBits = sizeof(IntLit*) * 8;
87 IntLit* il = static_cast<IntLit*>(_data[1]);
88 long long unsigned int mask = pointerBits <= 32 ? 0xFF : 0xFFFFF;
89 union {
90 long long int i;
91 unsigned long long int u;
92 } ui;
93 ui.i = il->v().toInt();
94 return static_cast<unsigned int>(ui.u & mask);
95 } else {
96 IntLit* il = static_cast<IntLit*>(_data[1]);
97 return il->v().toInt();
98 }
99}
100inline unsigned int Location::LocVec::last_line(void) const {
101 if (_size == 2) {
102 static const unsigned int pointerBits = sizeof(IntLit*) * 8;
103 IntLit* il = static_cast<IntLit*>(_data[1]);
104 long long unsigned int first_line_size = pointerBits <= 32 ? 8 : 20;
105 long long unsigned int mask = pointerBits <= 32 ? 0xFF : 0xFFFFF;
106 long long unsigned int offsetmask = pointerBits <= 32 ? 0x7F : 0xFFFFF;
107 union {
108 long long int i;
109 unsigned long long int u;
110 } ui;
111 ui.i = il->v().toInt();
112 // return first line (8 bit) + offset (7 bit)
113 return static_cast<unsigned int>((ui.u & mask) + ((ui.u >> first_line_size) & offsetmask));
114 } else {
115 IntLit* il = static_cast<IntLit*>(_data[2]);
116 return il->v().toInt();
117 }
118}
119inline unsigned int Location::LocVec::first_column(void) const {
120 if (_size == 2) {
121 static const unsigned int pointerBits = sizeof(IntLit*) * 8;
122 IntLit* il = static_cast<IntLit*>(_data[1]);
123 long long unsigned int first_col_offset = pointerBits <= 32 ? 8 + 7 : 20 + 20;
124 long long unsigned int mask = pointerBits <= 32 ? 0x3F : 0x3FF;
125 union {
126 long long int i;
127 unsigned long long int u;
128 } ui;
129 ui.i = il->v().toInt();
130 // return first line (8 bit) + offset (7 bit)
131 return static_cast<unsigned int>((ui.u >> first_col_offset) & mask);
132 } else {
133 IntLit* il = static_cast<IntLit*>(_data[3]);
134 return il->v().toInt();
135 }
136}
137inline unsigned int Location::LocVec::last_column(void) const {
138 if (_size == 2) {
139 static const unsigned int pointerBits = sizeof(IntLit*) * 8;
140 IntLit* il = static_cast<IntLit*>(_data[1]);
141 long long unsigned int last_col_offset = pointerBits <= 32 ? 8 + 7 + 6 : 20 + 20 + 10;
142 long long unsigned int mask = pointerBits <= 32 ? 0x7F : 0x3FF;
143 union {
144 long long int i;
145 unsigned long long int u;
146 } ui;
147 ui.i = il->v().toInt();
148 // return first line (8 bit) + offset (7 bit)
149 return static_cast<unsigned int>((ui.u >> last_col_offset) & mask);
150 } else {
151 IntLit* il = static_cast<IntLit*>(_data[4]);
152 return il->v().toInt();
153 }
154}
155
156inline FloatLit::FloatLit(const Location& loc, FloatVal v)
157 : Expression(loc, E_FLOATLIT, Type::parfloat()), _v(v) {
158 rehash();
159}
160
161inline FloatLit* FloatLit::a(MiniZinc::FloatVal v) {
162 if (sizeof(double) <= sizeof(FloatLit*) && v.isFinite()) {
163 FloatLit* ret = Expression::doubleToUnboxedFloatVal(v.toDouble());
164 if (ret) {
165 return ret;
166 }
167 }
168
169 std::unordered_map<FloatVal, WeakRef>::iterator it = constants().floatMap.find(v);
170 if (it == constants().floatMap.end() || it->second() == NULL) {
171 FloatLit* fl = new FloatLit(Location().introduce(), v);
172 if (it == constants().floatMap.end()) {
173 constants().floatMap.insert(std::make_pair(v, fl));
174 } else {
175 it->second = fl;
176 }
177 return fl;
178 } else {
179 return it->second()->cast<FloatLit>();
180 }
181}
182
183inline SetLit::SetLit(const Location& loc, const std::vector<Expression*>& v)
184 : Expression(loc, E_SETLIT, Type()), _v(ASTExprVec<Expression>(v)) {
185 _u.isv = NULL;
186 rehash();
187}
188
189inline SetLit::SetLit(const Location& loc, ASTExprVec<Expression> v)
190 : Expression(loc, E_SETLIT, Type()), _v(v) {
191 _u.isv = NULL;
192 rehash();
193}
194
195inline SetLit::SetLit(const Location& loc, IntSetVal* isv) : Expression(loc, E_SETLIT, Type()) {
196 _type = Type::parsetint();
197 _u.isv = isv;
198 rehash();
199}
200
201inline SetLit::SetLit(const Location& loc, FloatSetVal* fsv) : Expression(loc, E_SETLIT, Type()) {
202 _type = Type::parsetfloat();
203 _u.fsv = fsv;
204 rehash();
205}
206
207inline BoolLit::BoolLit(const Location& loc, bool v)
208 : Expression(loc, E_BOOLLIT, Type::parbool()), _v(v) {
209 rehash();
210}
211
212inline StringLit::StringLit(const Location& loc, const std::string& v)
213 : Expression(loc, E_STRINGLIT, Type::parstring()), _v(ASTString(v)) {
214 rehash();
215}
216
217inline StringLit::StringLit(const Location& loc, const ASTString& v)
218 : Expression(loc, E_STRINGLIT, Type::parstring()), _v(v) {
219 rehash();
220}
221
222inline Id::Id(const Location& loc, const std::string& v0, VarDecl* decl)
223 : Expression(loc, E_ID, Type()), _decl(decl) {
224 v(v0);
225 rehash();
226}
227
228inline Id::Id(const Location& loc, const ASTString& v0, VarDecl* decl)
229 : Expression(loc, E_ID, Type()), _decl(decl) {
230 v(v0);
231 rehash();
232}
233
234inline Id::Id(const Location& loc, long long int idn0, VarDecl* decl)
235 : Expression(loc, E_ID, Type()), _decl(decl) {
236 idn(idn0);
237 rehash();
238}
239
240inline void Id::decl(VarDecl* d) { _decl = d; }
241
242inline ASTString Id::v(void) const {
243 if (_decl && _decl->isa<Id>()) {
244 Expression* d = _decl;
245 while (d && d->isa<Id>()) {
246 d = d->cast<Id>()->_decl;
247 }
248 return d->cast<VarDecl>()->id()->v();
249 } else {
250 assert((reinterpret_cast<ptrdiff_t>(_v_or_idn) & static_cast<ptrdiff_t>(1)) == 0);
251 return ASTString(reinterpret_cast<ASTStringO*>(_v_or_idn));
252 }
253}
254
255inline long long int Id::idn(void) const {
256 if (_decl && _decl->isa<Id>()) {
257 Expression* d = _decl;
258 while (d && d->isa<Id>()) {
259 d = d->cast<Id>()->_decl;
260 }
261 return d->cast<VarDecl>()->id()->idn();
262 } else {
263 if ((reinterpret_cast<ptrdiff_t>(_v_or_idn) & static_cast<ptrdiff_t>(1)) == 0) return -1;
264 long long int i = reinterpret_cast<ptrdiff_t>(_v_or_idn) & ~static_cast<ptrdiff_t>(1);
265 return i >> 1;
266 }
267}
268
269inline TIId::TIId(const Location& loc, const std::string& v)
270 : Expression(loc, E_TIID, Type()), _v(ASTString(v)) {
271 rehash();
272}
273
274inline AnonVar::AnonVar(const Location& loc) : Expression(loc, E_ANON, Type()) { rehash(); }
275
276inline ArrayLit::ArrayLit(const Location& loc, ArrayLit& v,
277 const std::vector<std::pair<int, int> >& dims)
278 : Expression(loc, E_ARRAYLIT, Type()) {
279 _flag_1 = false;
280 _flag_2 = v._flag_2;
281 if (_flag_2) {
282 _u._al = v._u._al;
283 std::vector<int> d(dims.size() * 2 + v._dims.size() - v.dims() * 2);
284 for (unsigned int i = static_cast<unsigned int>(dims.size()); i--;) {
285 d[i * 2] = dims[i].first;
286 d[i * 2 + 1] = dims[i].second;
287 }
288 int sliceOffset = static_cast<int>(dims.size()) * 2;
289 int origSliceOffset = v.dims() * 2;
290 for (int i = 0; i < _u._al->dims() * 2; i++) {
291 d[sliceOffset + i] = v._dims[origSliceOffset + i];
292 }
293 _dims = ASTIntVec(d);
294 } else {
295 std::vector<int> d(dims.size() * 2);
296 for (unsigned int i = static_cast<unsigned int>(dims.size()); i--;) {
297 d[i * 2] = dims[i].first;
298 d[i * 2 + 1] = dims[i].second;
299 }
300 if (v._u._v->flag() || d.size() != 2 || d[0] != 1) {
301 // only allocate dims vector if it is not a 1d array indexed from 1
302 _dims = ASTIntVec(d);
303 }
304 _u._v = v._u._v;
305 }
306 rehash();
307}
308
309inline ArrayLit::ArrayLit(const Location& loc, ArrayLit& v) : Expression(loc, E_ARRAYLIT, Type()) {
310 _flag_1 = false;
311 _flag_2 = v._flag_2;
312 if (_flag_2) {
313 _u._al = v._u._al;
314 std::vector<int> d(2 + v._dims.size() - v.dims() * 2);
315 d[0] = 1;
316 d[1] = v.size();
317 int sliceOffset = 2;
318 int origSliceOffset = v.dims() * 2;
319 for (int i = 0; i < _u._al->dims() * 2; i++) {
320 d[sliceOffset + i] = v._dims[origSliceOffset + i];
321 }
322 _dims = ASTIntVec(d);
323 } else {
324 _u._v = v._u._v;
325 if (_u._v->flag()) {
326 std::vector<int> d(2);
327 d[0] = 1;
328 d[1] = v.length();
329 _dims = ASTIntVec(d);
330 } else {
331 // don't allocate dims vector since this is a 1d array indexed from 1
332 }
333 }
334 rehash();
335}
336
337inline ArrayLit::ArrayLit(const Location& loc, const std::vector<Expression*>& v)
338 : Expression(loc, E_ARRAYLIT, Type()) {
339 _flag_1 = false;
340 _flag_2 = false;
341 std::vector<int> d(2);
342 d[0] = 1;
343 d[1] = static_cast<int>(v.size());
344 compress(v, d);
345 rehash();
346}
347
348inline ArrayLit::ArrayLit(const Location& loc, const std::vector<KeepAlive>& v)
349 : Expression(loc, E_ARRAYLIT, Type()) {
350 _flag_1 = false;
351 _flag_2 = false;
352 std::vector<int> d(2);
353 d[0] = 1;
354 d[1] = static_cast<int>(v.size());
355 std::vector<Expression*> vv(v.size());
356 for (unsigned int i = 0; i < v.size(); i++) {
357 vv[i] = v[i]();
358 }
359 compress(vv, d);
360 rehash();
361}
362
363inline ArrayLit::ArrayLit(const Location& loc, const std::vector<std::vector<Expression*> >& v)
364 : Expression(loc, E_ARRAYLIT, Type()) {
365 _flag_1 = false;
366 _flag_2 = false;
367 std::vector<int> dims(4);
368 dims[0] = 1;
369 dims[1] = static_cast<int>(v.size());
370 dims[2] = 1;
371 dims[3] = v.size() > 0 ? static_cast<int>(v[0].size()) : 0;
372 std::vector<Expression*> vv;
373 for (unsigned int i = 0; i < v.size(); i++)
374 for (unsigned int j = 0; j < v[i].size(); j++) vv.push_back(v[i][j]);
375 compress(vv, dims);
376 rehash();
377}
378
379inline ArrayAccess::ArrayAccess(const Location& loc, Expression* v,
380 const std::vector<Expression*>& idx)
381 : Expression(loc, E_ARRAYACCESS, Type()) {
382 _v = v;
383 _idx = ASTExprVec<Expression>(idx);
384 rehash();
385}
386
387inline ArrayAccess::ArrayAccess(const Location& loc, Expression* v, ASTExprVec<Expression> idx)
388 : Expression(loc, E_ARRAYACCESS, Type()) {
389 _v = v;
390 _idx = idx;
391 rehash();
392}
393
394inline void Comprehension::init(Expression* e, Generators& g) {
395 _e = e;
396 std::vector<Expression*> es;
397 std::vector<int> idx;
398 for (unsigned int i = 0; i < g._g.size(); i++) {
399 idx.push_back(static_cast<int>(es.size()));
400 es.push_back(g._g[i]._in);
401 es.push_back(g._g[i]._where);
402 for (unsigned int j = 0; j < g._g[i]._v.size(); j++) {
403 es.push_back(g._g[i]._v[j]);
404 }
405 }
406 idx.push_back(static_cast<int>(es.size()));
407 _g = ASTExprVec<Expression>(es);
408 _g_idx = ASTIntVec(idx);
409 rehash();
410}
411inline Comprehension::Comprehension(const Location& loc, Expression* e, Generators& g, bool set)
412 : Expression(loc, E_COMP, Type()) {
413 _flag_1 = set;
414 init(e, g);
415}
416inline void ITE::init(const std::vector<Expression*>& e_if_then, Expression* e_else) {
417 _e_if_then = ASTExprVec<Expression>(e_if_then);
418 _e_else = e_else;
419 rehash();
420}
421inline ITE::ITE(const Location& loc, const std::vector<Expression*>& e_if_then, Expression* e_else)
422 : Expression(loc, E_ITE, Type()) {
423 init(e_if_then, e_else);
424}
425
426inline BinOp::BinOp(const Location& loc, Expression* e0, BinOpType op, Expression* e1)
427 : Expression(loc, E_BINOP, Type()), _e0(e0), _e1(e1), _decl(NULL) {
428 _sec_id = op;
429 rehash();
430}
431
432inline UnOp::UnOp(const Location& loc, UnOpType op, Expression* e)
433 : Expression(loc, E_UNOP, Type()), _e0(e), _decl(NULL) {
434 _sec_id = op;
435 rehash();
436}
437
438inline bool Call::hasId(void) const {
439 return (reinterpret_cast<ptrdiff_t>(_u_id._decl) & static_cast<ptrdiff_t>(1)) == 0;
440}
441
442inline ASTString Call::id(void) const { return hasId() ? _u_id._id : decl()->id(); }
443
444inline void Call::id(const ASTString& i) {
445 _u_id._id = i.aststr();
446 assert(hasId());
447 assert(decl() == NULL);
448}
449
450inline FunctionI* Call::decl(void) const {
451 return hasId() ? NULL
452 : reinterpret_cast<FunctionI*>(reinterpret_cast<ptrdiff_t>(_u_id._decl) &
453 ~static_cast<ptrdiff_t>(1));
454}
455
456inline void Call::decl(FunctionI* f) {
457 assert(f != NULL);
458 _u_id._decl =
459 reinterpret_cast<FunctionI*>(reinterpret_cast<ptrdiff_t>(f) | static_cast<ptrdiff_t>(1));
460}
461
462inline Call::Call(const Location& loc, const std::string& id0, const std::vector<Expression*>& args)
463 : Expression(loc, E_CALL, Type()) {
464 id(ASTString(id0));
465 if (args.size() == 1) {
466 _u._oneArg = args[0]->isUnboxedVal() ? args[0] : args[0]->tag();
467 } else {
468 _u._args = ASTExprVec<Expression>(args).vec();
469 }
470 rehash();
471 assert(hasId());
472 assert(decl() == NULL);
473}
474
475inline Call::Call(const Location& loc, const ASTString& id0, const std::vector<Expression*>& args)
476 : Expression(loc, E_CALL, Type()) {
477 id(ASTString(id0));
478 if (args.size() == 1) {
479 _u._oneArg = args[0]->isUnboxedVal() ? args[0] : args[0]->tag();
480 } else {
481 _u._args = ASTExprVec<Expression>(args).vec();
482 }
483 rehash();
484 assert(hasId());
485 assert(decl() == NULL);
486}
487
488inline VarDecl::VarDecl(const Location& loc, TypeInst* ti, const ASTString& id, Expression* e)
489 : Expression(loc, E_VARDECL, ti ? ti->type() : Type()), _id(NULL), _flat(NULL) {
490 _id = new Id(loc, id, this);
491 _flag_1 = true;
492 _flag_2 = false;
493 _ti = ti;
494 _e = e;
495 _id->type(type());
496 _payload = 0;
497 rehash();
498}
499
500inline VarDecl::VarDecl(const Location& loc, TypeInst* ti, long long int idn, Expression* e)
501 : Expression(loc, E_VARDECL, ti ? ti->type() : Type()), _id(NULL), _flat(NULL) {
502 _id = new Id(loc, idn, this);
503 _flag_1 = true;
504 _flag_2 = false;
505 _ti = ti;
506 _e = e;
507 _id->type(type());
508 _payload = 0;
509 rehash();
510}
511
512inline VarDecl::VarDecl(const Location& loc, TypeInst* ti, const std::string& id, Expression* e)
513 : Expression(loc, E_VARDECL, ti->type()), _id(NULL), _flat(NULL) {
514 _id = new Id(loc, ASTString(id), this);
515 _flag_1 = true;
516 _flag_2 = false;
517 _ti = ti;
518 _e = e;
519 _id->type(type());
520 _payload = 0;
521 rehash();
522}
523
524inline VarDecl::VarDecl(const Location& loc, TypeInst* ti, Id* id, Expression* e)
525 : Expression(loc, E_VARDECL, ti->type()), _id(NULL), _flat(NULL) {
526 if (id->idn() == -1)
527 _id = new Id(loc, id->v(), this);
528 else
529 _id = new Id(loc, id->idn(), this);
530 _flag_1 = true;
531 _flag_2 = false;
532 _ti = ti;
533 _e = e;
534 _id->type(type());
535 _payload = 0;
536 rehash();
537}
538
539inline Expression* VarDecl::e(void) const {
540 return (_e == nullptr || _e->isUnboxedVal()) ? _e : _e->untag();
541}
542
543inline void VarDecl::e(Expression* rhs) {
544 assert(rhs == NULL || !rhs->isa<Id>() || rhs->cast<Id>() != _id);
545 _e = rhs;
546}
547
548inline bool VarDecl::toplevel(void) const { return _flag_1; }
549inline void VarDecl::toplevel(bool t) { _flag_1 = t; }
550inline bool VarDecl::introduced(void) const { return _flag_2; }
551inline void VarDecl::introduced(bool t) { _flag_2 = t; }
552inline bool VarDecl::evaluated(void) const { return _e->isUnboxedVal() || _e->isTagged(); }
553inline void VarDecl::evaluated(bool t) {
554 if (!_e->isUnboxedVal()) {
555 if (t)
556 _e = _e->tag();
557 else
558 _e = _e->untag();
559 }
560}
561inline void VarDecl::flat(VarDecl* vd) { _flat = WeakRef(vd); }
562
563inline TypeInst::TypeInst(const Location& loc, const Type& type, ASTExprVec<TypeInst> ranges,
564 Expression* domain)
565 : Expression(loc, E_TI, type), _ranges(ranges), _domain(domain) {
566 _flag_1 = false;
567 _flag_2 = false;
568 rehash();
569}
570
571inline TypeInst::TypeInst(const Location& loc, const Type& type, Expression* domain)
572 : Expression(loc, E_TI, type), _domain(domain) {
573 _flag_1 = false;
574 _flag_2 = false;
575 rehash();
576}
577
578inline IncludeI::IncludeI(const Location& loc, const ASTString& f)
579 : Item(loc, II_INC), _f(f), _m(NULL) {}
580
581inline VarDeclI::VarDeclI(const Location& loc, VarDecl* e) : Item(loc, II_VD), _e(e) {}
582
583inline AssignI::AssignI(const Location& loc, const std::string& id, Expression* e)
584 : Item(loc, II_ASN), _id(ASTString(id)), _e(e), _decl(NULL) {}
585
586inline ConstraintI::ConstraintI(const Location& loc, Expression* e) : Item(loc, II_CON), _e(e) {}
587
588inline SolveI::SolveI(const Location& loc, Expression* e) : Item(loc, II_SOL), _e(e) {}
589inline SolveI* SolveI::sat(const Location& loc) {
590 SolveI* si = new SolveI(loc, NULL);
591 si->_sec_id = ST_SAT;
592 return si;
593}
594inline SolveI* SolveI::min(const Location& loc, Expression* e) {
595 SolveI* si = new SolveI(loc, e);
596 si->_sec_id = ST_MIN;
597 return si;
598}
599inline SolveI* SolveI::max(const Location& loc, Expression* e) {
600 SolveI* si = new SolveI(loc, e);
601 si->_sec_id = ST_MAX;
602 return si;
603}
604inline SolveI::SolveType SolveI::st(void) const { return static_cast<SolveType>(_sec_id); }
605inline void SolveI::st(SolveI::SolveType s) { _sec_id = s; }
606
607inline OutputI::OutputI(const Location& loc, Expression* e) : Item(loc, II_OUT), _e(e) {}
608
609inline FunctionI::FunctionI(const Location& loc, const std::string& id, TypeInst* ti,
610 const std::vector<VarDecl*>& params, Expression* e)
611 : Item(loc, II_FUN), _id(ASTString(id)), _ti(ti), _params(ASTExprVec<VarDecl>(params)), _e(e) {
612 _builtins.e = NULL;
613 _builtins.b = NULL;
614 _builtins.f = NULL;
615 _builtins.i = NULL;
616 _builtins.s = NULL;
617 _builtins.str = NULL;
618 _from_stdlib =
619 (loc.filename() == "builtins.mzn" || loc.filename().endsWith("/builtins.mzn") ||
620 loc.filename() == "stdlib.mzn" || loc.filename().endsWith("/stdlib.mzn") ||
621 loc.filename() == "mzncc_builtins.mzn" || loc.filename().endsWith("/mzncc_builtins.mzn") ||
622 loc.filename() == "flatzinc_builtins.mzn" ||
623 loc.filename().endsWith("/flatzinc_builtins.mzn"));
624}
625
626inline FunctionI::FunctionI(const Location& loc, const ASTString& id, TypeInst* ti,
627 const ASTExprVec<VarDecl>& params, Expression* e)
628 : Item(loc, II_FUN), _id(id), _ti(ti), _params(params), _e(e) {
629 _builtins.e = NULL;
630 _builtins.b = NULL;
631 _builtins.f = NULL;
632 _builtins.i = NULL;
633 _builtins.s = NULL;
634 _builtins.str = NULL;
635 _from_stdlib =
636 (loc.filename() == "builtins.mzn" || loc.filename().endsWith("/builtins.mzn") ||
637 loc.filename() == "stdlib.mzn" || loc.filename().endsWith("/stdlib.mzn") ||
638 loc.filename() == "mzncc_builtins.mzn" || loc.filename().endsWith("/mzncc_builtins.mzn") ||
639 loc.filename() == "flatzinc_builtins.mzn" ||
640 loc.filename().endsWith("/flatzinc_builtins.mzn"));
641}
642
643} // namespace MiniZinc