10#define IREP2_TYPE(kind, pretty) class kind##_type2t;
16#define irep_typedefs(basename) \
17 template <typename... Args> \
18 inline type2tc basename##_type2tc(Args &&...args) \
20 return make_irep<basename##_type2t>(std::forward<Args>(args)...); \
52 static constexpr auto fields = std::make_tuple();
68 static constexpr auto fields = std::make_tuple();
107 const std::vector<type2tc> &_members,
108 const std::vector<irep_idt> &memb_names,
109 const std::vector<irep_idt> &memb_pretty_names,
111 bool _packed =
false,
112 const std::vector<irep_idt> &memb_base_names = {},
113 const BigInt &_alignment = 0,
115 bool _has_bases =
false,
116 const std::vector<irep_idt> &_bases = {})
130 memb_base_names.empty() || memb_base_names.size() == _members.size());
172 static constexpr auto fields = std::make_tuple(
183 2 *
sizeof(std::vector<irep_idt>) +
sizeof(
BigInt) +
sizeof(
irep_idt) +
202 const std::vector<type2tc> &_members,
203 const std::vector<irep_idt> &memb_names,
204 const std::vector<irep_idt> &memb_pretty_names,
206 bool _packed =
false)
224 static constexpr auto fields = std::make_tuple(
243 bool qualified =
false,
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");
295 bool qualified =
false,
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");
336 const std::vector<type2tc> &args,
338 const std::vector<irep_idt> &names,
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(),
346 const std::vector<type2tc> &exc_decl = {})
360 assert(
args.size() == names.size());
361 assert(base_names.empty() || base_names.size() ==
args.size());
362 assert(defaults.empty() || defaults.size() ==
args.size());
402 static constexpr auto fields = std::make_tuple(
408 2 *
sizeof(std::vector<irep_idt>) +
sizeof(std::vector<expr2tc>) +
409 sizeof(std::vector<type2tc>) + 2 *
sizeof(
irep_idt) +
sizeof(
bool);
446 if (size->
expr_id != expr2t::constant_int_id)
469 const char *
what() const noexcept
override
471 return "array size is not statically known";
480 const char *
what() const noexcept
override
482 return "infinite sized array encountered";
496 const char *
what() const noexcept
override
498 return "Sizeof nondeterministically sized array encountered";
508 static constexpr auto fields = std::make_tuple(
533 expr2tc sz = size->simplify();
534 if (!is_nil_expr(sz))
545 static constexpr auto fields = std::make_tuple(
571 const bool &p =
false,
583 static constexpr auto fields = std::make_tuple(
700#define type_macros(name) \
701 inline bool is_##name##_type(const expr2tc &e) \
703 return e->type->type_id == type2t::name##_id; \
705 inline bool is_##name##_type(const type2tc &t) \
707 return t->type_id == type2t::name##_id; \
709 inline const name##_type2t &to_##name##_type(const type2tc &t) \
711 return irep2_checked_type_cast<const name##_type2t>( \
712 *t.get(), type2t::name##_id, #name); \
714 inline name##_type2t &to_##name##_type(type2tc &t) \
716 return irep2_checked_type_cast<name##_type2t>( \
717 *t.get(), type2t::name##_id, #name); \
719 inline const name##_type2t *try_to_##name##_type(const type2tc &t) \
721 return is_##name##_type(t) ? &to_##name##_type(t) : nullptr; \
726#define IREP2_TYPE(kind, pretty) type_macros(kind);
760std::optional<unsigned int>
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
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
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
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
#define false
Definition stdbool.h:10
#define bool
Definition stdbool.h:9