ESBMC
Efficient SMT-based Context-Bounded Model Checker
Loading...
Searching...
No Matches
irep2_type.h
Go to the documentation of this file.
1#ifndef IREP2_TYPE_H_
2#define IREP2_TYPE_H_
3
4#include <optional>
5#include <irep2/irep2.h>
6
7// Forward-declare a concrete <kind>_type2t class for every entry in
8// type_kinds.inc. The same manifest drives the type_ids enum in
9// irep2.h and the is_/to_/try_to_ predicate generators below.
10#define IREP2_TYPE(kind, pretty) class kind##_type2t;
11#include <irep2/type_kinds.inc>
12#undef IREP2_TYPE
13
14// Then give them a typedef name
15
16#define irep_typedefs(basename) \
17 template <typename... Args> \
18 inline type2tc basename##_type2tc(Args &&...args) \
19 { \
20 return make_irep<basename##_type2t>(std::forward<Args>(args)...); \
21 }
22
28irep_typedefs(unsignedbv);
29irep_typedefs(signedbv);
36irep_typedefs(cpp_name);
38#undef irep_typedefs
39
43class bool_type2t : public type2t
44{
45public:
46 bool_type2t() : type2t(bool_id)
47 {
48 }
49 bool_type2t(const bool_type2t &ref) = default;
50 unsigned int get_width() const;
51
52 static constexpr auto fields = std::make_tuple();
53 static std::string field_names[esbmct::num_type_fields];
54};
55
59class empty_type2t : public type2t
60{
61public:
62 empty_type2t() : type2t(empty_id)
63 {
64 }
65 empty_type2t(const empty_type2t &ref) = default;
66 unsigned int get_width() const;
67
68 static constexpr auto fields = std::make_tuple();
69 static std::string field_names[esbmct::num_type_fields];
70};
71
76class symbol_type2t : public type2t
77{
78public:
80 symbol_type2t(const irep_idt &sym_name)
81 : type2t(symbol_id), symbol_name(sym_name)
82 {
83 }
84 symbol_type2t(const symbol_type2t &ref) = default;
85 unsigned int get_width() const;
86
88
89 static constexpr auto fields = std::make_tuple(&symbol_type2t::symbol_name);
90 static std::string field_names[esbmct::num_type_fields];
91};
92
98class struct_type2t : public type2t
99{
100public:
107 const std::vector<type2tc> &_members,
108 const std::vector<irep_idt> &memb_names,
109 const std::vector<irep_idt> &memb_pretty_names,
110 const irep_idt &_name,
111 bool _packed = false,
112 const std::vector<irep_idt> &memb_base_names = {},
113 const BigInt &_alignment = 0,
114 const irep_idt &_python_aggregate = irep_idt(),
115 bool _has_bases = false,
116 const std::vector<irep_idt> &_bases = {})
117 : type2t(struct_id),
118 members(_members),
119 member_names(memb_names),
120 member_pretty_names(memb_pretty_names),
121 member_base_names(memb_base_names),
122 name(_name),
123 packed(_packed),
124 has_bases(_has_bases),
125 alignment(_alignment),
126 python_aggregate(_python_aggregate),
127 bases(_bases)
128 {
129 assert(
130 memb_base_names.empty() || memb_base_names.size() == _members.size());
131 }
132 struct_type2t(const struct_type2t &ref) = default;
133 unsigned int get_width() const;
134
135 std::vector<type2tc> members;
136 std::vector<irep_idt> member_names;
137 std::vector<irep_idt> member_pretty_names;
143 std::vector<irep_idt> member_base_names;
145 bool packed;
149
158
165
170 std::vector<irep_idt> bases;
171
172 static constexpr auto fields = std::make_tuple(
182 static constexpr std::size_t excluded_field_bytes =
183 2 * sizeof(std::vector<irep_idt>) + sizeof(BigInt) + sizeof(irep_idt) +
184 sizeof(bool);
185 static std::string field_names[esbmct::num_type_fields];
186};
187
193class union_type2t : public type2t
194{
195public:
202 const std::vector<type2tc> &_members,
203 const std::vector<irep_idt> &memb_names,
204 const std::vector<irep_idt> &memb_pretty_names,
205 const irep_idt &_name,
206 bool _packed = false)
207 : type2t(union_id),
208 members(_members),
209 member_names(memb_names),
210 member_pretty_names(memb_pretty_names),
211 name(_name),
212 packed(_packed)
213 {
214 }
215 union_type2t(const union_type2t &ref) = default;
216 unsigned int get_width() const;
217
218 std::vector<type2tc> members;
219 std::vector<irep_idt> member_names;
220 std::vector<irep_idt> member_pretty_names;
222 bool packed;
223
224 static constexpr auto fields = std::make_tuple(
230 static std::string field_names[esbmct::num_type_fields];
231};
232
238{
239public:
242 unsigned int w,
243 bool qualified = false,
244 const irep_idt &cpp = irep_idt())
245 : type2t(unsignedbv_id),
246 width(w),
247 cpp_type(cpp),
248 constant_qualified(qualified)
249 {
250 // assert(w != 0 && "Must have nonzero width for integer type");
251 // XXX -- zero sized bitfields are permissible. Oh my.
252 }
254 unsigned int get_width() const;
255
256 unsigned int width;
269
270 static constexpr auto fields = std::make_tuple(&unsignedbv_type2t::width);
271 static constexpr std::size_t excluded_field_bytes =
272 sizeof(irep_idt) + sizeof(bool);
277 static_assert(
278 sizeof(unsigned int) + sizeof(irep_idt) + sizeof(bool) <=
279 2 * sizeof(void *),
280 "unsignedbv_type2t's reflected + excluded fields no longer fit the pinned "
281 "layout; re-check fields_cover_class's margin before adding a field");
282 static std::string field_names[esbmct::num_type_fields];
283};
284
290{
291public:
294 signed int w,
295 bool qualified = false,
296 const irep_idt &cpp = irep_idt())
297 : type2t(signedbv_id),
298 width(w),
299 cpp_type(cpp),
300 constant_qualified(qualified)
301 {
302 }
303 signedbv_type2t(const signedbv_type2t &ref) = default;
304 unsigned int get_width() const;
305
306 unsigned int width;
315
316 static constexpr auto fields = std::make_tuple(&signedbv_type2t::width);
317 static constexpr std::size_t excluded_field_bytes =
318 sizeof(irep_idt) + sizeof(bool);
323 static_assert(
324 sizeof(unsigned int) + sizeof(irep_idt) + sizeof(bool) <=
325 2 * sizeof(void *),
326 "signedbv_type2t's reflected + excluded fields no longer fit the pinned "
327 "layout; re-check fields_cover_class's margin before adding a field");
328 static std::string field_names[esbmct::num_type_fields];
329};
330
332class code_type2t : public type2t
333{
334public:
336 const std::vector<type2tc> &args,
337 const type2tc &ret,
338 const std::vector<irep_idt> &names,
339 bool e,
340 const std::vector<irep_idt> &base_names = {},
341 const std::vector<expr2tc> &defaults = {},
342 const irep_idt &exc_kind = irep_idt(),
343 const std::vector<irep_idt> &exc_types = {},
344 const irep_idt &ret_marker = irep_idt(),
345 bool implicit_union_copy_move = false,
346 const std::vector<type2tc> &exc_decl = {})
347 : type2t(code_id),
349 ret_type(ret),
350 argument_names(names),
351 argument_base_names(base_names),
352 argument_defaults(defaults),
353 exception_types(exc_types),
354 exception_decl(exc_decl),
355 exception_kind(exc_kind),
356 return_marker(ret_marker),
357 ellipsis(e),
359 {
360 assert(args.size() == names.size());
361 assert(base_names.empty() || base_names.size() == args.size());
362 assert(defaults.empty() || defaults.size() == args.size());
363 }
364 code_type2t(const code_type2t &ref) = default;
365 unsigned int get_width() const;
366
367 std::vector<type2tc> arguments;
369 std::vector<irep_idt> argument_names;
371 /// reflected: C11 6.7.6.3p15 makes a parameter's spelling no part of the
372 /// function type, so two signatures differing only here are the same type and
373 /// must hash and compare equal. Kept because a consumer reads it back --
374 /// clang_cpp_convert_vft.cpp's thunk argument loop does
375 /// (docs/roadmap/frontends-to-irep2.md §44).
376 std::vector<irep_idt> argument_base_names;
377 /// The arguments' `#default_value`s, null where an argument has none, and
378 /// empty when none has one. Unreflected: a default is no part of the
379 /// function's type. Carried because Python call lowering fills a missing
380 /// argument from it (converter_funcall.cpp, function_call/expr.cpp).
381 std::vector<expr2tc> argument_defaults;
383 /// `exception_spec_types` record it (util/lang/exception_specification.h);
384 /// empty when there is none. Unreflected, like the fields above: two
385 /// signatures differing only here still compare equal. Carried because
386 /// goto_convert_functions decodes it from the function symbol's type.
387 std::vector<irep_idt> exception_types;
389 /// finalize_exception_specification resolves them to `exception_types`.
390 std::vector<type2tc> exception_decl;
393 /// "destructor"), which ret_type models as empty; and whether it is an
394 /// implicit copy/move constructor of a union. Unreflected, like the fields
395 /// above. Carried because vptr initialisation and the union copy/move
396 /// synthesis read them (docs/roadmap/frontends-to-irep2.md §50.2,
397 /// scope-clang-cpp-irep2.md §12).
401
402 static constexpr auto fields = std::make_tuple(
407 static constexpr std::size_t excluded_field_bytes =
408 2 * sizeof(std::vector<irep_idt>) + sizeof(std::vector<expr2tc>) +
409 sizeof(std::vector<type2tc>) + 2 * sizeof(irep_idt) + sizeof(bool);
410 static std::string field_names[esbmct::num_type_fields];
411};
412
421class array_type2t : public type2t
422{
423public:
429 array_type2t(const type2tc &_subtype, const expr2tc &size, bool inf)
430 : type2t(array_id),
431 subtype(_subtype),
432 array_size(size),
434 {
435 // Constant-fold the size expression so identical array types compare
436 // equal regardless of how their size was constructed. Skip the work
437 // when the size is already a constant_int (the common case from the
438 // frontend) — simplify() would just return nil for it but the walk
439 // still costs a few cycles. Long-term fix is to normalise sizes at
440 // the frontend / migration boundary instead.
441 if (!is_nil_expr(size))
442 {
443 assert(
444 size->type->type_id == signedbv_id ||
445 size->type->type_id == unsignedbv_id);
446 if (size->expr_id != expr2t::constant_int_id)
447 {
448 expr2tc sz = size->simplify();
449 if (!is_nil_expr(sz))
450 array_size = sz;
451 }
452 }
453 }
454 array_type2t(const array_type2t &ref) = default;
455
456 virtual ~array_type2t() = default;
457
458 unsigned int get_width() const;
459
466 class array_size_excp : public std::exception
467 {
468 public:
469 const char *what() const noexcept override
470 {
471 return "array size is not statically known";
472 }
473 };
474
478 {
479 public:
480 const char *what() const noexcept override
481 {
482 return "infinite sized array encountered";
483 }
484 };
485
490 {
491 public:
492 dyn_sized_array_excp(const expr2tc &_size) : size(_size)
493 {
494 }
495
496 const char *what() const noexcept override
497 {
498 return "Sizeof nondeterministically sized array encountered";
499 }
500
502 };
503
507
508 static constexpr auto fields = std::make_tuple(
512 static std::string field_names[esbmct::num_type_fields];
513};
514
516class vector_type2t : public type2t
517{
518public:
523 vector_type2t(const type2tc &_subtype, const expr2tc &size)
524 : type2t(vector_id),
525 subtype(_subtype),
526 array_size(size),
528 {
529 // Mirror array_type2t: skip simplify() when the size is already a
530 // literal. See note in array_type2t for the normalisation rationale.
531 if (!is_nil_expr(size) && size->expr_id != expr2t::constant_int_id)
532 {
533 expr2tc sz = size->simplify();
534 if (!is_nil_expr(sz))
535 array_size = sz;
536 }
537 }
538 vector_type2t(const vector_type2t &ref) = default;
539 unsigned int get_width() const;
540
544
545 static constexpr auto fields = std::make_tuple(
549 static std::string field_names[esbmct::num_type_fields];
550};
551
561
565class pointer_type2t : public type2t
566{
567public:
570 const type2tc &st,
571 const bool &p = false,
573 : type2t(pointer_id), subtype(st), carry_provenance(p), ref_kind(rk)
574 {
575 }
576 pointer_type2t(const pointer_type2t &ref) = default;
577 unsigned int get_width() const;
578
582
583 static constexpr auto fields = std::make_tuple(
587 static std::string field_names[esbmct::num_type_fields];
588};
589
594class fixedbv_type2t : public type2t
595{
596public:
601 fixedbv_type2t(unsigned int w, unsigned int ib)
602 : type2t(fixedbv_id), width(w), integer_bits(ib)
603 {
604 }
605 fixedbv_type2t(const fixedbv_type2t &ref) = default;
606 unsigned int get_width() const;
607
608 unsigned int width;
609 unsigned int integer_bits;
610
611 static constexpr auto fields =
613 static std::string field_names[esbmct::num_type_fields];
614};
615
620class floatbv_type2t : public type2t
621{
622public:
628 unsigned int f,
629 unsigned int e,
630 const irep_idt &cpp = irep_idt())
631 : type2t(floatbv_id), fraction(f), exponent(e), cpp_type(cpp)
632 {
633 }
634 floatbv_type2t(const floatbv_type2t &ref) = default;
635 unsigned int get_width() const;
636
637 unsigned int fraction;
638 unsigned int exponent;
642
643 static constexpr auto fields =
645 static constexpr std::size_t excluded_field_bytes = sizeof(irep_idt);
646 static std::string field_names[esbmct::num_type_fields];
647};
648
653class complex_type2t : public type2t
654{
655public:
656 complex_type2t(const type2tc &st) : type2t(complex_id), subtype(st)
657 {
658 }
659 complex_type2t(const complex_type2t &ref) = default;
660 unsigned int get_width() const;
661
663
664 static constexpr auto fields = std::make_tuple(&complex_type2t::subtype);
665 static std::string field_names[esbmct::num_type_fields];
666};
667
673{
674public:
679 cpp_name_type2t(const irep_idt &n, const std::vector<type2tc> &ta)
680 : type2t(cpp_name_id), name(n), template_args(ta)
681 {
682 }
683 cpp_name_type2t(const cpp_name_type2t &ref) = default;
684
685 unsigned int get_width() const;
686
688 std::vector<type2tc> template_args;
689
690 static constexpr auto fields =
692 static std::string field_names[esbmct::num_type_fields];
693};
694
695// Generate "is_<name>_type" predicates and "to_<name>_type" downcasts. The
696// downcasts route through irep2_checked_type_cast so a bad to_*_type throws
697// irep2_cast_error in every build mode rather than invoking undefined
698// behaviour under NDEBUG (the previous design redefined dynamic_cast as
699// static_cast in release).
700#define type_macros(name) \
701 inline bool is_##name##_type(const expr2tc &e) \
702 { \
703 return e->type->type_id == type2t::name##_id; \
704 } \
705 inline bool is_##name##_type(const type2tc &t) \
706 { \
707 return t->type_id == type2t::name##_id; \
708 } \
709 inline const name##_type2t &to_##name##_type(const type2tc &t) \
710 { \
711 return irep2_checked_type_cast<const name##_type2t>( \
712 *t.get(), type2t::name##_id, #name); \
713 } \
714 inline name##_type2t &to_##name##_type(type2tc &t) \
715 { \
716 return irep2_checked_type_cast<name##_type2t>( \
717 *t.get(), type2t::name##_id, #name); \
718 } \
719 inline const name##_type2t *try_to_##name##_type(const type2tc &t) \
720 { \
721 return is_##name##_type(t) ? &to_##name##_type(t) : nullptr; \
722 }
723
724// Instantiate the is_/to_/try_to_ predicate triple for every kind in
725// type_kinds.inc. Same manifest as the enum and forward declarations.
726#define IREP2_TYPE(kind, pretty) type_macros(kind);
727#include <irep2/type_kinds.inc>
728#undef IREP2_TYPE
729#undef type_macros
730
731// struct_type2t and union_type2t each own a 5-field block
732// (members / member_names / member_pretty_names / name / packed);
733// complex_type2t stores only its element type but the SMT tuple
734// lowering treats it as a (real, imag) 2-tuple of that type. The
735// helpers below give callers a uniform "tuple view" of all three
736// without forcing them to dispatch by hand: for struct/union they
737// copy the kind's stored vectors, for complex they synthesise the
738// 2-element view from the subtype. Return-by-value lets the helper
739// be uniform; callers bind to `const auto &x = ...` and rely on
740// temporary lifetime extension.
741//
742// Small per-call copies in exchange for a single point of truth per
743// field. Direct mutation goes via the mutating overload below (or via
744// the concrete kind, e.g. `to_struct_type(t).members`).
745std::vector<type2tc> struct_union_members(const type2tc &t);
746std::vector<irep_idt> struct_union_member_names(const type2tc &t);
748bool struct_union_packed(const type2tc &t);
749
756std::vector<type2tc> &struct_union_members(type2tc &t);
757
760std::optional<unsigned int>
762
763#endif /* IREP2_TYPE_H_ */
Definition bigint.hh:58
Common base for the two array-sizing exceptions thrown by array_type2t::get_width (and friends).
Definition irep2_type.h:467
const char * what() const noexcept override
Definition irep2_type.h:469
const char * what() const noexcept override
Definition irep2_type.h:496
expr2tc size
Definition irep2_type.h:501
dyn_sized_array_excp(const expr2tc &_size)
Definition irep2_type.h:492
Exception for invalid manipulations of an infinitely sized array.
Definition irep2_type.h:478
const char * what() const noexcept override
Definition irep2_type.h:480
expr2tc array_size
Definition irep2_type.h:505
virtual ~array_type2t()=default
static constexpr auto fields
Definition irep2_type.h:508
static std::string field_names[esbmct::num_type_fields]
Definition irep2_type.h:385
array_type2t(const type2tc &_subtype, const expr2tc &size, bool inf)
Primary constructor.
Definition irep2_type.h:429
type2tc subtype
Definition irep2_type.h:504
unsigned int get_width() const
Definition irep2_type.cpp:131
bool size_is_infinite
Definition irep2_type.h:506
array_type2t(const array_type2t &ref)=default
Definition toml.hpp:6607
bool_type2t()
Definition irep2_type.h:46
unsigned int get_width() const
Definition irep2_type.cpp:115
static constexpr auto fields
Definition irep2_type.h:52
bool_type2t(const bool_type2t &ref)=default
static std::string field_names[esbmct::num_type_fields]
Definition irep2_type.h:369
std::vector< irep_idt > argument_names
Definition irep2_type.h:369
std::vector< type2tc > exception_decl
A dynamic specification's declared types before finalize_exception_specification resolves them to exc...
Definition irep2_type.h:390
code_type2t(const std::vector< type2tc > &args, const type2tc &ret, const std::vector< irep_idt > &names, bool e, const std::vector< irep_idt > &base_names={}, const std::vector< expr2tc > &defaults={}, const irep_idt &exc_kind=irep_idt(), const std::vector< irep_idt > &exc_types={}, const irep_idt &ret_marker=irep_idt(), bool implicit_union_copy_move=false, const std::vector< type2tc > &exc_decl={})
Definition irep2_type.h:335
std::vector< type2tc > arguments
Definition irep2_type.h:367
type2tc ret_type
Definition irep2_type.h:368
static constexpr auto fields
Definition irep2_type.h:402
bool implicit_union_copy_move
Definition irep2_type.h:400
irep_idt return_marker
A C++ constructor's or destructor's pseudo return type ("constructor" / "destructor"),...
Definition irep2_type.h:398
static constexpr std::size_t excluded_field_bytes
Definition irep2_type.h:407
bool ellipsis
Definition irep2_type.h:399
std::vector< irep_idt > argument_base_names
The arguments' #base_names, carried across the migrate seam but not reflected: C11 6....
Definition irep2_type.h:376
code_type2t(const code_type2t &ref)=default
std::vector< expr2tc > argument_defaults
The arguments' #default_values, null where an argument has none, and empty when none has one.
Definition irep2_type.h:381
irep_idt exception_kind
Definition irep2_type.h:391
unsigned int get_width() const
Definition irep2_type.cpp:241
std::vector< irep_idt > exception_types
A resolved C++ exception specification, as exception_spec_kind and exception_spec_types record it (ut...
Definition irep2_type.h:387
static std::string field_names[esbmct::num_type_fields]
Definition irep2_type.h:383
complex_type2t(const complex_type2t &ref)=default
unsigned int get_width() const
Definition irep2_type.cpp:235
complex_type2t(const type2tc &st)
Definition irep2_type.h:656
static constexpr auto fields
Definition irep2_type.h:664
static std::string field_names[esbmct::num_type_fields]
Definition irep2_type.h:395
type2tc subtype
Definition irep2_type.h:662
static std::string field_names[esbmct::num_type_fields]
Definition irep2_type.h:397
std::vector< type2tc > template_args
Definition irep2_type.h:688
static constexpr auto fields
Definition irep2_type.h:690
unsigned int get_width() const
Definition irep2_type.cpp:197
cpp_name_type2t(const cpp_name_type2t &ref)=default
irep_idt name
Definition irep2_type.h:687
cpp_name_type2t(const irep_idt &n, const std::vector< type2tc > &ta)
Primary constructor.
Definition irep2_type.h:679
unsigned int get_width() const
Definition irep2_type.cpp:187
static constexpr auto fields
Definition irep2_type.h:68
empty_type2t(const empty_type2t &ref)=default
static std::string field_names[esbmct::num_type_fields]
Definition irep2_type.h:371
empty_type2t()
Definition irep2_type.h:62
const expr_ids expr_id
Instance of expr_ids recording tihs exprs type.
Definition irep2.h:907
const type2tc type
Type of this expr.
Definition irep2.h:910
expr2tc simplify() const
Simplify an expression.
Definition expr_simplifier.cpp:40
fixedbv_type2t(unsigned int w, unsigned int ib)
Primary constructor.
Definition irep2_type.h:601
unsigned int get_width() const
Definition irep2_type.cpp:225
unsigned int width
Definition irep2_type.h:608
fixedbv_type2t(const fixedbv_type2t &ref)=default
static std::string field_names[esbmct::num_type_fields]
Definition irep2_type.h:391
static constexpr auto fields
Definition irep2_type.h:611
unsigned int integer_bits
Definition irep2_type.h:609
static constexpr auto fields
Definition irep2_type.h:643
irep_idt cpp_type
The source language's own spelling of this type, as #cpp_type records it.
Definition irep2_type.h:641
unsigned int exponent
Definition irep2_type.h:638
static std::string field_names[esbmct::num_type_fields]
Definition irep2_type.h:393
floatbv_type2t(unsigned int f, unsigned int e, const irep_idt &cpp=irep_idt())
Primary constructor.
Definition irep2_type.h:627
unsigned int fraction
Definition irep2_type.h:637
unsigned int get_width() const
Definition irep2_type.cpp:230
static constexpr std::size_t excluded_field_bytes
Definition irep2_type.h:645
floatbv_type2t(const floatbv_type2t &ref)=default
Definition irep_idt.h:12
unsigned int get_width() const
Definition irep2_type.cpp:181
bool carry_provenance
Definition irep2_type.h:580
type2tc subtype
Definition irep2_type.h:579
pointer_ref_kindt ref_kind
Definition irep2_type.h:581
pointer_type2t(const type2tc &st, const bool &p=false, pointer_ref_kindt rk=pointer_ref_kindt::NONE)
Primary constructor.
Definition irep2_type.h:569
static constexpr auto fields
Definition irep2_type.h:583
pointer_type2t(const pointer_type2t &ref)=default
static std::string field_names[esbmct::num_type_fields]
Definition irep2_type.h:389
static std::string field_names[esbmct::num_type_fields]
cpp_type pushes constant_qualified into a fresh slot, so this class now carries four bytes of trailin...
Definition irep2_type.h:381
static constexpr auto fields
Definition irep2_type.h:316
unsigned int width
Definition irep2_type.h:306
signedbv_type2t(signed int w, bool qualified=false, const irep_idt &cpp=irep_idt())
Primary constructor.
Definition irep2_type.h:293
signedbv_type2t(const signedbv_type2t &ref)=default
unsigned int get_width() const
Definition irep2_type.cpp:126
static constexpr std::size_t excluded_field_bytes
Definition irep2_type.h:317
irep_idt cpp_type
The source language's own spelling of this type, as #cpp_type records it.
Definition irep2_type.h:309
bool constant_qualified
Whether the source qualified this const, as #constant records it.
Definition irep2_type.h:314
std::vector< irep_idt > member_names
Definition irep2_type.h:136
static constexpr std::size_t excluded_field_bytes
Covers the deliberately unreflected members: member_base_names (a member's spelling is no part of the...
Definition irep2_type.h:182
bool packed
Definition irep2_type.h:145
std::vector< type2tc > members
Definition irep2_type.h:135
bool has_bases
Whether the legacy type had a bases list at all, which an empty one is not the same as: the key takes...
Definition irep2_type.h:148
std::vector< irep_idt > member_base_names
The components' plain base_names – a different field from the #base_name that code_type2t::argument_b...
Definition irep2_type.h:143
std::vector< irep_idt > bases
The class ids bases lists, as the C++ and Python frontends write it.
Definition irep2_type.h:170
struct_type2t(const std::vector< type2tc > &_members, const std::vector< irep_idt > &memb_names, const std::vector< irep_idt > &memb_pretty_names, const irep_idt &_name, bool _packed=false, const std::vector< irep_idt > &memb_base_names={}, const BigInt &_alignment=0, const irep_idt &_python_aggregate=irep_idt(), bool _has_bases=false, const std::vector< irep_idt > &_bases={})
Primary constructor.
Definition irep2_type.h:106
irep_idt name
Definition irep2_type.h:144
struct_type2t(const struct_type2t &ref)=default
static constexpr auto fields
Definition irep2_type.h:172
unsigned int get_width() const
Definition irep2_type.cpp:202
BigInt alignment
An explicit alignas, in bytes; zero when the record has none.
Definition irep2_type.h:157
static std::string field_names[esbmct::num_type_fields]
Definition irep2_type.h:375
irep_idt python_aggregate
The Python model-aggregate kind ("tuple", "dict", "optional") that #python_aggregate records; empty f...
Definition irep2_type.h:164
std::vector< irep_idt > member_pretty_names
Definition irep2_type.h:137
Definition symbol_id.h:6
static constexpr auto fields
Definition irep2_type.h:89
irep_idt symbol_name
Definition irep2_type.h:87
symbol_type2t(const symbol_type2t &ref)=default
unsigned int get_width() const
Definition irep2_type.cpp:192
static std::string field_names[esbmct::num_type_fields]
Definition irep2_type.h:373
symbol_type2t(const irep_idt &sym_name)
Primary constructor.
Definition irep2_type.h:80
type2t(type_ids id)
Primary constructor.
Definition irep2_type.cpp:72
const type_ids type_id
Instance of type_ids recording this types type.
Definition irep2.h:693
irep_idt name
Definition irep2_type.h:221
std::vector< irep_idt > member_names
Definition irep2_type.h:219
std::vector< type2tc > members
Definition irep2_type.h:218
static constexpr auto fields
Definition irep2_type.h:224
std::vector< irep_idt > member_pretty_names
Definition irep2_type.h:220
unsigned int get_width() const
Definition irep2_type.cpp:214
bool packed
Definition irep2_type.h:222
union_type2t(const std::vector< type2tc > &_members, const std::vector< irep_idt > &memb_names, const std::vector< irep_idt > &memb_pretty_names, const irep_idt &_name, bool _packed=false)
Primary constructor.
Definition irep2_type.h:201
static std::string field_names[esbmct::num_type_fields]
Definition irep2_type.h:377
union_type2t(const union_type2t &ref)=default
static std::string field_names[esbmct::num_type_fields]
cpp_type pushes constant_qualified into a fresh slot, so this class now carries four bytes of trailin...
Definition irep2_type.h:379
unsignedbv_type2t(unsigned int w, bool qualified=false, const irep_idt &cpp=irep_idt())
Primary constructor.
Definition irep2_type.h:241
static constexpr auto fields
Definition irep2_type.h:270
unsigned int get_width() const
Definition irep2_type.cpp:121
static constexpr std::size_t excluded_field_bytes
Definition irep2_type.h:271
unsignedbv_type2t(const unsignedbv_type2t &ref)=default
unsigned int width
Definition irep2_type.h:256
irep_idt cpp_type
The source language's own spelling of this type, as #cpp_type records it.
Definition irep2_type.h:263
bool constant_qualified
Whether the source qualified this const, as #constant records it.
Definition irep2_type.h:268
vector_type2t(const type2tc &_subtype, const expr2tc &size)
Primary constructor.
Definition irep2_type.h:523
type2tc subtype
Definition irep2_type.h:541
expr2tc array_size
Definition irep2_type.h:542
static std::string field_names[esbmct::num_type_fields]
Definition irep2_type.h:387
bool size_is_infinite
Definition irep2_type.h:543
static constexpr auto fields
Definition irep2_type.h:545
unsigned int get_width() const
Definition irep2_type.cpp:159
vector_type2t(const vector_type2t &ref)=default
Classes and definitions for non-stringy internal representation.
irep_container< type2t > type2tc
Definition irep2.h:430
bool is_nil_expr(const expr2tc &exp)
Definition irep2.h:916
irep_container< expr2t > expr2tc
Definition irep2.h:431
std::vector< type2tc > struct_union_members(const type2tc &t)
Definition irep2_type.cpp:400
std::vector< irep_idt > struct_union_member_names(const type2tc &t)
Definition irep2_type.cpp:431
irep_idt struct_union_name(const type2tc &t)
Definition irep2_type.cpp:447
pointer_ref_kindt
How the source spelled a pointer.
Definition irep2_type.h:556
@ RVALUE
Definition irep2_type.h:559
@ LVALUE
Definition irep2_type.h:558
@ NONE
Definition irep2_type.h:557
#define irep_typedefs(basename)
Definition irep2_type.h:16
bool struct_union_packed(const type2tc &t)
Definition irep2_type.cpp:463
std::optional< unsigned int > struct_union_get_component_number(const type2tc &t, const irep_idt &comp)
Index of comp in struct/union/complex member_names, or nullopt if it is missing or duplicated (the la...
Definition irep2_type.cpp:479
float e
Definition cmath.py:18
const unsigned int num_type_fields
Maximum number of fields to support in expr2t subclasses.
Definition irep2.h:998
Definition int.py:1
args
Definition transform.py:10
#define false
Definition stdbool.h:10
#define bool
Definition stdbool.h:9