ESBMC
Efficient SMT-based Context-Bounded Model Checker
Loading...
Searching...
No Matches
irep2_expr.h
Go to the documentation of this file.
1#ifndef IREP2_EXPR_H_
2#define IREP2_EXPR_H_
3
5#include <util/lang/c_types.h>
9#include <irep2/irep2_type.h>
10
11// So - make some type definitions for the different types we're going to be
12// working with. This is to avoid the repeated use of template names in later
13// definitions. If you'd like to add another type - don't. Vast tracts of code
14// only expect the types below, it's be extremely difficult to hack new ones in.
15
16// Start of definitions for expressions. Forward decls
17//
18// Forward-declare a concrete <kind>2t class for every entry in the
19// expr_kinds.inc manifest. The same manifest drives the expr_ids
20// enum (in irep2.h) and the is_/to_/try_to_ predicate generators
21// further down this file.
22#define IREP2_EXPR(kind, pretty) class kind##2t;
23#include <irep2/expr_kinds.inc>
24#undef IREP2_EXPR
25
27{
28 DEFAULT, /* "" */
29 WIDE, /* L"" */
30 UNICODE, /* u8"", u"" and U"" */
31};
32
61
66 const type2tc &t,
68 const expr2tc &v1,
69 const expr2tc &v2);
70
73{
87 old_snapshot, // For __ESBMC_old() in function contracts
88 assigns_target, // For __ESBMC_assigns() in function contracts
89 statement_expression, // GNU C ({ ... }) extension
90 temporary_object, // C++ temporary created inline (constructor)
91 gcc_conditional_expression, // GNU C `a ?: b` (omitted middle operand)
92 cpp_delete, // C++ `delete p` in expression position
93 cpp_delete_array // C++ `delete[] p` in expression position
94};
95
111
115
116#define irep_typedefs(basename) \
117 template <typename... Args> \
118 inline expr2tc basename##2tc(Args && ...args) \
119 { \
120 return make_irep<basename##2t>(std::forward<Args>(args)...); \
121 }
122
123irep_typedefs(constant_int);
124irep_typedefs(constant_fixedbv);
125irep_typedefs(constant_floatbv);
126irep_typedefs(constant_struct);
127irep_typedefs(constant_union);
128irep_typedefs(constant_array);
129irep_typedefs(constant_vector);
130irep_typedefs(constant_bool);
131irep_typedefs(constant_array_of);
132irep_typedefs(constant_string);
141irep_typedefs(greaterthan);
142irep_typedefs(lessthanequal);
143irep_typedefs(greaterthanequal);
144irep_typedefs(cmp_three_way);
167irep_typedefs(ieee_sqrt);
172irep_typedefs(pointer_offset);
173irep_typedefs(pointer_object);
174irep_typedefs(pointer_capability);
175irep_typedefs(address_of);
176irep_typedefs(byte_extract);
177irep_typedefs(byte_update);
180irep_typedefs(member_ref);
185irep_typedefs(overflow_cast);
186irep_typedefs(overflow_neg);
189irep_typedefs(null_object);
190irep_typedefs(dynamic_object);
192irep_typedefs(valid_object);
193irep_typedefs(races_check);
194irep_typedefs(deallocated_obj);
195irep_typedefs(dynamic_size);
196irep_typedefs(sideeffect);
197irep_typedefs(code_block);
198irep_typedefs(code_assign);
199irep_typedefs(code_decl);
200irep_typedefs(code_dead);
201irep_typedefs(code_printf);
202irep_typedefs(code_expression);
203irep_typedefs(code_return);
204irep_typedefs(code_skip);
205irep_typedefs(code_free);
206irep_typedefs(code_goto);
207irep_typedefs(object_descriptor);
208irep_typedefs(code_function_call);
209irep_typedefs(code_ifthenelse);
210irep_typedefs(code_while);
211irep_typedefs(code_dowhile);
213irep_typedefs(code_switch);
214irep_typedefs(code_break);
215irep_typedefs(code_continue);
216irep_typedefs(code_label);
217irep_typedefs(code_switch_case);
218irep_typedefs(code_assert);
219irep_typedefs(code_assume);
220irep_typedefs(sideeffect_assign);
221irep_typedefs(code_comma);
222irep_typedefs(invalid_pointer);
224irep_typedefs(code_cpp_del_array);
225irep_typedefs(code_cpp_delete);
226irep_typedefs(code_cpp_catch);
227irep_typedefs(code_cpp_throw);
236irep_typedefs(capability_base);
237irep_typedefs(capability_top);
240irep_typedefs(isinstance);
243irep_typedefs(new_object);
245irep_typedefs(uninterpreted_func);
246
247class exists2t : public expr2t
248{
249public:
251 exists2t(const type2tc &type, const expr2tc &sym, const expr2tc &predicate)
252 : expr2t(type, exists_id), side_1(sym), side_2(predicate)
253 {
254 }
255 exists2t(const exists2t &ref) = default;
256
257 static constexpr auto fields =
258 std::make_tuple(&expr2t::type, &exists2t::side_1, &exists2t::side_2);
259 static std::string field_names[esbmct::num_type_fields];
260};
261
262class forall2t : public expr2t
263{
264public:
266 forall2t(const type2tc &type, const expr2tc &sym, const expr2tc &predicate)
267 : expr2t(type, forall_id), side_1(sym), side_2(predicate)
268 {
269 }
270 forall2t(const forall2t &ref) = default;
271
272 static constexpr auto fields =
273 std::make_tuple(&expr2t::type, &forall2t::side_1, &forall2t::side_2);
274 static std::string field_names[esbmct::num_type_fields];
275};
276
282class constant_int2t : public expr2t
283{
284public:
293
299 const type2tc &type,
300 const BigInt &input,
301 const irep_idt &fmt = irep_idt())
302 : expr2t(type, constant_int_id), value(input), cformat(fmt)
303 {
304 }
305 constant_int2t(const constant_int2t &ref) = default;
306
308 unsigned long as_ulong() const;
310 long as_long() const;
311
312 static constexpr auto fields =
313 std::make_tuple(&expr2t::type, &constant_int2t::value);
314 static constexpr std::size_t excluded_field_bytes = sizeof(irep_idt);
315 static std::string field_names[esbmct::num_type_fields];
316};
317
323{
324public:
326
331 : expr2t(value.spec.get_type(), constant_fixedbv_id), value(value)
332 {
333 }
335
336 static constexpr auto fields =
337 std::make_tuple(&expr2t::type, &constant_fixedbv2t::value);
338 static std::string field_names[esbmct::num_type_fields];
339};
340
345{
346public:
352
357 : expr2t(value.spec.get_type(), constant_floatbv_id),
358 value(value),
359 cformat(fmt)
360 {
361 }
363
364 static constexpr auto fields =
365 std::make_tuple(&expr2t::type, &constant_floatbv2t::value);
366 static constexpr std::size_t excluded_field_bytes = sizeof(irep_idt);
367 static std::string field_names[esbmct::num_type_fields];
368};
369
374{
375public:
376 bool value;
377
380 : expr2t(get_bool_type(), constant_bool_id), value(value)
381 {
382 }
383 constant_bool2t(const constant_bool2t &ref) = default;
384
386 bool is_true() const;
388 bool is_false() const;
389
390 static constexpr auto fields =
391 std::make_tuple(&expr2t::type, &constant_bool2t::value);
392 static std::string field_names[esbmct::num_type_fields];
393};
394
399{
400public:
402
405
415 const type2tc &type,
416 const irep_idt &stringref,
418 : expr2t(type, constant_string_id), value(stringref), kind(kind)
419 {
420 }
422
423 static constexpr auto fields = std::make_tuple(
427
429 expr2tc to_array() const;
430
435 size_t array_size() const;
436
442 expr2tc at(size_t i) const;
443
444 static std::string field_names[esbmct::num_type_fields];
445};
446
453{
454public:
455 std::vector<expr2tc> datatype_members;
456
461 constant_struct2t(const type2tc &type, const std::vector<expr2tc> &members)
462 : expr2t(type, constant_struct_id), datatype_members(members)
463 {
464 // complex_type2t is a primitive subtype but lowers to a 2-element
465 // struct view at the SMT boundary (see struct_union_members), and
466 // the clang frontend builds complex literals as struct-id exprt
467 // with a complex type — accept that shape here.
468 //
469 // A symbol_id type is permitted ONLY as a transient pre-resolution state,
470 // the same V.1k "two-phase source invariant" the member2t/index2t asserts
471 // carry: the Python frontend stores class instances with a by-name
472 // symbol_type and resolves it lazily, so migrating a constant aggregate
473 // before the IREP2-native adjuster has followed the type would otherwise
474 // abort here. The adjuster re-establishes the strong invariant before
475 // symex; no frontend builds a constant_struct2t pre-adjust today, so this
476 // disjunct is staged enabling infra exercised by the --python-irep2-adjust
477 // path.
478 assert(
479 type->type_id == type2t::struct_id ||
480 type->type_id == type2t::complex_id ||
481 type->type_id == type2t::symbol_id);
482 }
484
485 expr2tc do_simplify() const override;
486
487 static constexpr auto fields =
489 static std::string field_names[esbmct::num_type_fields];
490};
491
505{
506public:
507 std::vector<expr2tc> datatype_members;
509
515 const type2tc &type,
516 irep_idt if_,
517 const std::vector<expr2tc> &members)
518 : expr2t(type, constant_union_id),
519 datatype_members(members),
520 init_field(std::move(if_))
521 {
522 // A symbol_id type is permitted on the same terms constant_struct2t
523 // permits it above: a transient pre-resolution state. migrate_expr builds
524 // a union literal from `constant_union2tc(migrate_type(expr.type()), ...)`
525 // (migrate.cpp:923), and a frontend whose union tag is still by-name at
526 // that point yields symbol_type2t rather than union_type2t -- which aborted
527 // here for 12 of regression/esbmc's tests under --clang-c-irep2-adjust,
528 // while the identical shape passed for structs. The asymmetry was an
529 // oversight, not a rule: NDEBUG builds already construct these nodes.
530 assert(is_union_type(type) || type->type_id == type2t::symbol_id);
531 // smt_conv.cpp's counterexample reconstruction intentionally builds unions
532 // with multiple members (see TODO in get_by_ast), so we can't check if the
533 // union has at most 1 member initializer, with
534 // assert(this->datatype_members.size() <= 1);
535 }
536 constant_union2t(const constant_union2t &ref) = default;
537
538 static constexpr auto fields = std::make_tuple(
542 static std::string field_names[esbmct::num_type_fields];
543};
544
551{
552public:
553 std::vector<expr2tc> datatype_members;
554
559 constant_array2t(const type2tc &type, const std::vector<expr2tc> &members)
560 : expr2t(type, constant_array_id), datatype_members(members)
561 {
562 assert(type->type_id == type2t::array_id);
563 }
564 constant_array2t(const constant_array2t &ref) = default;
565
566 expr2tc do_simplify() const override;
567
568 static constexpr auto fields =
570 static std::string field_names[esbmct::num_type_fields];
571};
572
578{
579public:
580 std::vector<expr2tc> datatype_members;
581
586 constant_vector2t(const type2tc &type, const std::vector<expr2tc> &members)
587 : expr2t(type, constant_vector_id), datatype_members(members)
588 {
589 }
591
592 static constexpr auto fields =
594 static std::string field_names[esbmct::num_type_fields];
595};
596
602{
603public:
605
611 : expr2t(type, constant_array_of_id), initializer(init)
612 {
613 }
615
616 static constexpr auto fields =
618 static std::string field_names[esbmct::num_type_fields];
619};
620
624class symbol2t : public expr2t
625{
626public:
628
631 unsigned int level1_num;
632 unsigned int level2_num;
633 unsigned int thread_num;
634 unsigned int node_num;
635
641 const type2tc &type,
642 const irep_idt &init,
643 renaming_level lev = renaming_level::level0,
644 unsigned int l1 = 0,
645 unsigned int l2 = 0,
646 unsigned int trd = 0,
647 unsigned int node = 0)
649 thename(init),
650 rlevel(lev),
651 level1_num(l1),
652 level2_num(l2),
653 thread_num(trd),
654 node_num(node)
655 {
656 /* At some point in the past, symbols named "NULL" and "0" were equivalent.
657 * The symbol called "0" should no longer be created for uniformity reasons.
658 * Confirm that here, since support for it has been removed from
659 * smt_solver_baset. No other reason to disallow "0" as a symbol. */
660 assert(init != "0");
661 }
662
663 symbol2t(const symbol2t &ref) = default;
664
665 std::string get_symbol_name() const;
666
667 static constexpr auto fields = std::make_tuple(
675 static std::string field_names[esbmct::num_type_fields];
676};
677
682class nearbyint2t : public expr2t
683{
684public:
687
694 const type2tc &type,
695 const expr2tc &from_,
696 const expr2tc &rounding_mode_)
697 : expr2t(type, nearbyint_id), from(from_), rounding_mode(rounding_mode_)
698 {
699 }
700
706 nearbyint2t(const type2tc &type, const expr2tc &from_)
707 : expr2t(type, nearbyint_id),
708 from(from_),
709 rounding_mode(symbol2tc(get_int32_type(), "c:@__ESBMC_rounding_mode"))
710 {
711 }
712
713 nearbyint2t(const nearbyint2t &ref) = default;
714
715 expr2tc do_simplify() const override;
716
717 static constexpr auto fields = std::make_tuple(
721 static std::string field_names[esbmct::num_type_fields];
722};
723
728class typecast2t : public expr2t
729{
730public:
733
742
745
746 /** Primary constructor.
747 * @param type Type to typecast to
748 * @param from Expression to cast from.
749 * @param rounding_mode Rounding mode, important only for floatbvs
752 const type2tc &type,
753 const expr2tc &from_,
754 const expr2tc &rounding_mode_,
755 const irep_idt &derived_to_base_ = irep_idt(),
756 bool base_to_derived_ = false)
757 : expr2t(type, typecast_id),
758 from(from_),
759 rounding_mode(rounding_mode_),
760 derived_to_base(derived_to_base_),
761 base_to_derived(base_to_derived_)
763 }
766
766 * the __ESBMC_rounding_mode symbol
767 * @param type Type to typecast to
768 * @param from Expression to cast from.
769 */
771 const type2tc &type,
772 const expr2tc &from_,
773 const irep_idt &derived_to_base_ = irep_idt(),
774 bool base_to_derived_ = false)
775 : expr2t(type, typecast_id),
776 from(from_),
777 rounding_mode(symbol2tc(get_int32_type(), "c:@__ESBMC_rounding_mode")),
778 derived_to_base(derived_to_base_),
779 base_to_derived(base_to_derived_)
780 {
781 }
782
783 typecast2t(const typecast2t &ref) = default;
784 expr2tc do_simplify() const override;
785
786 static constexpr auto fields = std::make_tuple(
792 static std::string field_names[esbmct::num_type_fields];
793};
794
807class bitcast2t : public expr2t
808{
809public:
811
816 bitcast2t(const type2tc &type, const expr2tc &from_)
817 : expr2t(type, bitcast_id), from(from_)
818 {
819 try
820 {
821 assert(type->get_width() == from_->type->get_width());
822 }
823 catch (const type2t::symbolic_type_excp &)
824 {
825 /* ignore */
826 }
827 }
828
829 bitcast2t(const bitcast2t &ref) = default;
830
831 expr2tc do_simplify() const override;
833 static constexpr auto fields =
834 std::make_tuple(&expr2t::type, &bitcast2t::from);
835 static std::string field_names[esbmct::num_type_fields];
836};
837
841class if2t : public expr2t
843public:
848 location; // not reflected: carries the ? position for witness branching
849 static constexpr std::size_t excluded_field_bytes = sizeof(locationt);
852
852 * @param type Type this expression evaluates to.
853 * @param cond Condition to evaulate which side of ternary operator is used.
854 * @param trueval Value to use if cond evaluates to true.
855 * @param falseval Value to use if cond evaluates to false.
856 * @param loc Source location of the ? token (optional).
857 */
859 const type2tc &type,
860 const expr2tc &cond_,
861 const expr2tc &trueval,
862 const expr2tc &falseval,
863 const locationt &loc = locationt())
864 : expr2t(type, if_id),
865 cond(cond_),
866 true_value(trueval),
867 false_value(falseval),
869 {
870 assert(type->type_id == trueval->type->type_id);
871 assert(type->type_id == falseval->type->type_id);
873 if2t(const if2t &ref) = default;
874
875 expr2tc do_simplify() const override;
876
877 static constexpr auto fields = std::make_tuple(
879 &if2t::cond,
883};
884
889#define ESBMC_DEFINE_RELATION2T(name) \
890 class name##2t : public expr2t \
891 { \
892 public: \
893 expr2tc side_1, side_2; \
894 name##2t(const expr2tc &v1, const expr2tc &v2) \
895 : expr2t(get_bool_type(), name##_id), side_1(v1), side_2(v2) \
896 { \
897 } \
898 name##2t(const name##2t & ref) = default; \
899 expr2tc do_simplify() const override; \
900 static constexpr auto fields = \
901 std::make_tuple(&expr2t::type, &name##2t ::side_1, &name##2t ::side_2); \
902 static std::string field_names[esbmct::num_type_fields]; \
903 }
904
910ESBMC_DEFINE_RELATION2T(greaterthanequal);
911#undef ESBMC_DEFINE_RELATION2T
913/* The macros below fold sets of `*2t` classes that share a constructor
914 * shape and behaviour. Each generated class still inherits directly
915 * from expr2t and owns its own fields; the macro just spares the
916 * repetition of writing six near-identical class bodies. */
917
918
918/** Arithmetic two-operand node (`add`/`sub`/`mul`/`div`/`modulus`). */
919#define ESBMC_DEFINE_ARITH_2OP(name) \
920 class name##2t : public expr2t \
921 { \
922 public: \
923 expr2tc side_1, side_2; \
924 name##2t(const type2tc &type, const expr2tc &v1, const expr2tc &v2) \
925 : expr2t(type, name##_id), side_1(v1), side_2(v2) \
926 { \
927 assert_arith_2ops_consistency(type, name##_id, v1, v2); \
928 } \
929 name##2t(const name##2t & ref) = default; \
930 expr2tc do_simplify() const override; \
931 static constexpr auto fields = \
932 std::make_tuple(&expr2t::type, &name##2t ::side_1, &name##2t ::side_2); \
933 static std::string field_names[esbmct::num_type_fields]; \
935
941#undef ESBMC_DEFINE_ARITH_2OP
944
944 * `shl`/`ashr`/`lshr`). */
945#define ESBMC_DEFINE_BIT_2OP(name) \
946 class name##2t : public expr2t \
947 { \
948 public: \
949 expr2tc side_1, side_2; \
950 name##2t(const type2tc &type, const expr2tc &v1, const expr2tc &v2) \
951 : expr2t(type, name##_id), side_1(v1), side_2(v2) \
952 { \
953 } \
954 name##2t(const name##2t & ref) = default; \
955 expr2tc do_simplify() const override; \
956 static constexpr auto fields = \
957 std::make_tuple(&expr2t::type, &name##2t ::side_1, &name##2t ::side_2); \
958 static std::string field_names[esbmct::num_type_fields]; \
959 }
960
967#undef ESBMC_DEFINE_BIT_2OP
968
970#define ESBMC_DEFINE_ARITH_1OP(name) \
971 class name##2t : public expr2t \
972 { \
973 public: \
974 expr2tc value; \
975 name##2t(const type2tc &type, const expr2tc &v) \
976 : expr2t(type, name##_id), value(v) \
977 { \
978 } \
979 name##2t(const name##2t & ref) = default; \
980 expr2tc do_simplify() const override; \
981 static constexpr auto fields = \
982 std::make_tuple(&expr2t::type, &name##2t ::value); \
983 static std::string field_names[esbmct::num_type_fields]; \
984 }
985
990#undef ESBMC_DEFINE_ARITH_1OP
991
992
993#define ESBMC_DEFINE_POINTER_1OP(name) \
994 class name##2t : public expr2t \
995 { \
996 public: \
997 expr2tc ptr_obj; \
998 name##2t(const type2tc &type, const expr2tc &v) \
999 : expr2t(type, name##_id), ptr_obj(v) \
1000 { \
1001 } \
1002 name##2t(const name##2t & ref) = default; \
1003 expr2tc do_simplify() const override; \
1004 static constexpr auto fields = \
1005 std::make_tuple(&expr2t::type, &name##2t ::ptr_obj); \
1006 static std::string field_names[esbmct::num_type_fields]; \
1007 }
1008
1010ESBMC_DEFINE_POINTER_1OP(pointer_capability);
1011#undef ESBMC_DEFINE_POINTER_1OP
1012
1016#define ESBMC_DEFINE_LOGIC_2OP(name) \
1017 class name##2t : public expr2t \
1018 { \
1019 public: \
1020 expr2tc side_1, side_2; \
1021 name##2t(const expr2tc &s1, const expr2tc &s2) \
1022 : expr2t(get_bool_type(), name##_id), side_1(s1), side_2(s2) \
1023 { \
1024 } \
1025 name##2t(const name##2t & ref) = default; \
1026 expr2tc do_simplify() const override; \
1027 static constexpr auto fields = \
1028 std::make_tuple(&expr2t::type, &name##2t ::side_1, &name##2t ::side_2); \
1029 static std::string field_names[esbmct::num_type_fields]; \
1030 }
1031
1039#undef ESBMC_DEFINE_LOGIC_2OP
1040
1043#define ESBMC_DEFINE_FP_PREDICATE_1OP(name) \
1044 class name##2t : public expr2t \
1045 { \
1046 public: \
1047 expr2tc value; \
1048 name##2t(const expr2tc &operand) \
1049 : expr2t(get_bool_type(), name##_id), value(operand) \
1050 { \
1051 } \
1052 name##2t(const name##2t & ref) = default; \
1053 expr2tc do_simplify() const override; \
1054 static constexpr auto fields = std::make_tuple(&name##2t ::value); \
1055 static std::string field_names[esbmct::num_type_fields]; \
1056 }
1057
1062#undef ESBMC_DEFINE_FP_PREDICATE_1OP
1063
1066#define ESBMC_DEFINE_OBJECT_PREDICATE_1OP(name) \
1067 class name##2t : public expr2t \
1068 { \
1069 public: \
1070 expr2tc value; \
1071 name##2t(const expr2tc &operand) \
1072 : expr2t(get_bool_type(), name##_id), value(operand) \
1073 { \
1074 } \
1075 name##2t(const name##2t & ref) = default; \
1076 expr2tc do_simplify() const override; \
1077 static constexpr auto fields = std::make_tuple(&name##2t ::value); \
1078 static std::string field_names[esbmct::num_type_fields]; \
1079 }
1080
1084#undef ESBMC_DEFINE_OBJECT_PREDICATE_1OP
1085
1088#define ESBMC_DEFINE_OBJECT_SIZE_1OP(name) \
1089 class name##2t : public expr2t \
1090 { \
1091 public: \
1092 expr2tc value; \
1093 name##2t(const expr2tc &operand) \
1094 : expr2t(size_type2(), name##_id), value(operand) \
1095 { \
1096 } \
1097 name##2t(const name##2t & ref) = default; \
1098 expr2tc do_simplify() const override; \
1099 static constexpr auto fields = std::make_tuple(&name##2t ::value); \
1100 static std::string field_names[esbmct::num_type_fields]; \
1101 }
1102
1106#undef ESBMC_DEFINE_OBJECT_SIZE_1OP
1107
1110#define ESBMC_DEFINE_OVERFLOW_INT32_1OP(name) \
1111 class name##2t : public expr2t \
1112 { \
1113 public: \
1114 expr2tc operand; \
1115 name##2t(const expr2tc &op) \
1116 : expr2t(get_int32_type(), name##_id), operand(op) \
1117 { \
1118 } \
1119 name##2t(const name##2t & ref) = default; \
1120 expr2tc do_simplify() const override; \
1121 static constexpr auto fields = \
1122 std::make_tuple(&expr2t::type, &name##2t ::operand); \
1123 static std::string field_names[esbmct::num_type_fields]; \
1124 }
1125
1128#undef ESBMC_DEFINE_OVERFLOW_INT32_1OP
1129
1132#define ESBMC_DEFINE_TYPE_ONLY(name) \
1133 class name##2t : public expr2t \
1134 { \
1135 public: \
1136 name##2t(const type2tc &type) : expr2t(type, name##_id) \
1137 { \
1138 } \
1139 name##2t(const name##2t & ref) = default; \
1140 expr2tc do_simplify() const override; \
1141 static constexpr auto fields = std::make_tuple(&expr2t::type); \
1142 static std::string field_names[esbmct::num_type_fields]; \
1143 }
1144
1148#undef ESBMC_DEFINE_TYPE_ONLY
1149
1153#define ESBMC_DEFINE_CODE_EXPRESSION_1OP(name) \
1154 class name##2t : public expr2t \
1155 { \
1156 public: \
1157 expr2tc operand; \
1158 locationt location; /* not reflected: source loc travels with the stmt */ \
1159 static constexpr std::size_t excluded_field_bytes = sizeof(locationt); \
1160 name##2t(const expr2tc &op, const locationt &loc = locationt()) \
1161 : expr2t(get_empty_type(), name##_id), operand(op), location(loc) \
1162 { \
1163 } \
1164 name##2t(const name##2t & ref) = default; \
1165 expr2tc do_simplify() const override; \
1166 static constexpr auto fields = std::make_tuple(&name##2t ::operand); \
1167 static std::string field_names[esbmct::num_type_fields]; \
1168 }
1169
1175#undef ESBMC_DEFINE_CODE_EXPRESSION_1OP
1176
1180#define ESBMC_DEFINE_CODE_DECL(name) \
1181 class name##2t : public expr2t \
1182 { \
1183 public: \
1184 irep_idt value; \
1185 locationt location; /* not reflected: source loc travels with the stmt */ \
1186 static constexpr std::size_t excluded_field_bytes = sizeof(locationt); \
1187 name##2t( \
1188 const type2tc &type, \
1189 const irep_idt &n, \
1190 const locationt &loc = locationt()) \
1191 : expr2t(type, name##_id), value(n), location(loc) \
1192 { \
1193 } \
1194 name##2t(const name##2t & ref) = default; \
1195 expr2tc do_simplify() const override; \
1196 static constexpr auto fields = \
1197 std::make_tuple(&expr2t::type, &name##2t ::value); \
1198 static std::string field_names[esbmct::num_type_fields]; \
1199 }
1200
1202#undef ESBMC_DEFINE_CODE_DECL
1203
1212class code_decl2t : public expr2t
1213{
1214public:
1215 irep_idt value; // symbol name
1216 expr2tc init; // optional initializer; nil when absent
1217 locationt location; // not reflected: source loc travels with the stmt
1218 static constexpr std::size_t excluded_field_bytes = sizeof(locationt);
1220 const type2tc &type,
1221 const irep_idt &n,
1222 const expr2tc &i = expr2tc(),
1223 const locationt &loc = locationt())
1224 : expr2t(type, code_decl_id), value(n), init(i), location(loc)
1225 {
1226 }
1227 code_decl2t(const code_decl2t &ref) = default;
1228 expr2tc do_simplify() const override;
1229 static constexpr auto fields =
1231 static std::string field_names[esbmct::num_type_fields];
1232};
1233
1248{
1249public:
1252
1253 cmp_three_way2t(const type2tc &t, const expr2tc &v1, const expr2tc &v2)
1254 : expr2t(t, cmp_three_way_id), side_1(v1), side_2(v2)
1255 {
1256 }
1257 cmp_three_way2t(const cmp_three_way2t &ref) = default;
1258
1259 expr2tc do_simplify() const override;
1260
1261 static constexpr auto fields = std::make_tuple(
1262 &expr2t::type,
1265 static std::string field_names[esbmct::num_type_fields];
1266};
1267
1269class not2t : public expr2t
1270{
1271public:
1273
1275 not2t(const expr2tc &val) : expr2t(get_bool_type(), not_id), value(val)
1276 {
1277 }
1278 not2t(const not2t &ref) = default;
1279
1280 expr2tc do_simplify() const override;
1281
1282 static constexpr auto fields = std::make_tuple(&not2t::value);
1283 static std::string field_names[esbmct::num_type_fields];
1284};
1285
1290#define ESBMC_DEFINE_IEEE_ARITH_2OP(name) \
1291 class name##2t : public expr2t \
1292 { \
1293 public: \
1294 expr2tc rounding_mode, side_1, side_2; \
1295 name##2t( \
1296 const type2tc &type, \
1297 const expr2tc &v1, \
1298 const expr2tc &v2, \
1299 const expr2tc &rm) \
1300 : expr2t(type, name##_id), rounding_mode(rm), side_1(v1), side_2(v2) \
1301 { \
1302 } \
1303 name##2t(const name##2t & ref) = default; \
1304 expr2tc do_simplify() const override; \
1305 static constexpr auto fields = std::make_tuple( \
1306 &expr2t::type, \
1307 &name##2t ::rounding_mode, \
1308 &name##2t ::side_1, \
1309 &name##2t ::side_2); \
1310 static std::string field_names[esbmct::num_type_fields]; \
1311 }
1312
1321#undef ESBMC_DEFINE_IEEE_ARITH_2OP
1322
1326class ieee_fma2t : public expr2t
1327{
1328public:
1333
1341 const type2tc &type,
1342 const expr2tc &v1,
1343 const expr2tc &v2,
1344 const expr2tc &v3,
1345 const expr2tc &rm)
1346 : expr2t(type, ieee_fma_id),
1347 rounding_mode(rm),
1348 value_1(v1),
1349 value_2(v2),
1350 value_3(v3)
1351 {
1352 }
1353 ieee_fma2t(const ieee_fma2t &ref) = default;
1354
1355 expr2tc do_simplify() const override;
1356
1357 static constexpr auto fields = std::make_tuple(
1358 &expr2t::type,
1363 static std::string field_names[esbmct::num_type_fields];
1364};
1365
1368class ieee_sqrt2t : public expr2t
1369{
1370public:
1373
1378 ieee_sqrt2t(const type2tc &type, const expr2tc &v1, const expr2tc &rm)
1379 : expr2t(type, ieee_sqrt_id), rounding_mode(rm), value(v1)
1380 {
1381 }
1382 ieee_sqrt2t(const ieee_sqrt2t &ref) = default;
1383
1384 expr2tc do_simplify() const override;
1385
1386 static constexpr auto fields = std::make_tuple(
1387 &expr2t::type,
1390 static std::string field_names[esbmct::num_type_fields];
1391};
1392
1396class same_object2t : public expr2t
1397{
1398public:
1401
1403 same_object2t(const expr2tc &v1, const expr2tc &v2)
1404 : expr2t(get_bool_type(), same_object_id), side_1(v1), side_2(v2)
1405 {
1406 }
1407 same_object2t(const same_object2t &ref) = default;
1408
1409 expr2tc do_simplify() const override;
1410
1411 static constexpr auto fields = std::make_tuple(
1412 &expr2t::type,
1415 static std::string field_names[esbmct::num_type_fields];
1416};
1417
1422{
1423public:
1425
1429 pointer_offset2t(const type2tc &type, const expr2tc &ptrobj)
1430 : expr2t(type, pointer_offset_id), ptr_obj(ptrobj)
1431 {
1432 assert(type->type_id == type2t::signedbv_id);
1433 assert(type->get_width() == config.ansi_c.address_width);
1434 }
1435 pointer_offset2t(const pointer_offset2t &ref) = default;
1436
1437 expr2tc do_simplify() const override;
1438
1439 static constexpr auto fields =
1440 std::make_tuple(&expr2t::type, &pointer_offset2t::ptr_obj);
1441 static std::string field_names[esbmct::num_type_fields];
1442};
1443
1447class address_of2t : public expr2t
1448{
1449public:
1451
1464
1466 const type2tc &subtype,
1467 const expr2tc &ptrobj,
1468 bool is_implicit = false,
1470 : expr2t(pointer_type2tc(subtype, false, rk), address_of_id),
1471 ptr_obj(ptrobj),
1472 implicit(is_implicit)
1473 {
1474 assert(ptrobj->expr_id != expr2t::constant_int_id);
1475 assert(ptrobj->expr_id != expr2t::address_of_id);
1476 }
1477 address_of2t(const address_of2t &ref) = default;
1478
1479 expr2tc do_simplify() const override;
1480
1481 static constexpr auto fields = std::make_tuple(
1482 &expr2t::type,
1485 static std::string field_names[esbmct::num_type_fields];
1486};
1487
1493{
1494public:
1498
1506 const type2tc &type,
1507 const expr2tc &source,
1508 const expr2tc &offset,
1509 bool is_big_endian)
1510 : expr2t(type, byte_extract_id),
1511 source_value(source),
1512 source_offset(offset),
1513 big_endian(is_big_endian)
1514 {
1515 }
1516 byte_extract2t(const byte_extract2t &ref) = default;
1517
1518 expr2tc do_simplify() const override;
1519
1520 static constexpr auto fields = std::make_tuple(
1521 &expr2t::type,
1525 static std::string field_names[esbmct::num_type_fields];
1526};
1527
1532class byte_update2t : public expr2t
1533{
1534public:
1539
1546 const type2tc &type,
1547 const expr2tc &source,
1548 const expr2tc &offset,
1549 const expr2tc &updateval,
1550 bool is_big_endian)
1551 : expr2t(type, byte_update_id),
1552 source_value(source),
1553 source_offset(offset),
1554 update_value(updateval),
1555 big_endian(is_big_endian)
1556 {
1557 }
1558 byte_update2t(const byte_update2t &ref) = default;
1559
1560 expr2tc do_simplify() const override;
1561
1562 static constexpr auto fields = std::make_tuple(
1563 &expr2t::type,
1568 static std::string field_names[esbmct::num_type_fields];
1569};
1570
1575class with2t : public expr2t
1576{
1577 void assert_consistency() const;
1578
1579public:
1583
1590 const type2tc &type,
1591 const expr2tc &source,
1592 const expr2tc &field,
1593 const expr2tc &value)
1594 : expr2t(type, with_id),
1595 source_value(source),
1596 update_field(field),
1598 {
1599#ifndef NDEBUG
1600 assert_consistency();
1601#endif
1602 }
1603 with2t(const with2t &ref) = default;
1604
1605 expr2tc do_simplify() const override;
1606
1607 static constexpr auto fields = std::make_tuple(
1608 &expr2t::type,
1612 static std::string field_names[esbmct::num_type_fields];
1613};
1614
1617class member2t : public expr2t
1618{
1619public:
1622
1627 member2t(const type2tc &type, const expr2tc &source, const irep_idt &memb)
1628 : expr2t(type, member_id), source_value(source), member(memb)
1629 {
1630#ifndef NDEBUG /* only check consistency in non-Release builds */
1631 /* The source is normally a resolved struct/union/complex. A `symbol_id`
1632 source is permitted ONLY as a transient pre-resolution state: the
1633 IREP2-migration V.1k "two-phase source invariant" lets a frontend build a
1634 member2t before type resolution (the Python converter, ahead of the
1635 IREP2-native adjuster) hand a by-name `symbol_type2t` here; the adjuster
1636 MUST follow it to a struct before symex. The strong invariant is
1637 re-enforced post-adjust by that pass, not dropped. No existing frontend
1638 builds member2t pre-adjust (all go through migrate at goto-convert, which
1639 is post-adjust), so this disjunct is staged enabling infra, exercised
1640 once the V.1k converter/adjuster pilot lands. */
1641 /* A `pointer_id` source is the same transient state index2t already
1642 permits, and for the same reason: a legacy `member` over a pointer base
1643 is what the C adjuster's adjust_member rewrites to
1644 `member(dereference(base))`, so migrating a symbol value before that arm
1645 has run hands one here. index2t's sibling comment names this pairing; the
1646 relaxation had been applied there and not here. An `array_id` source is
1647 the same thing for adjust_member other branch, which rewrites an array
1648 base to `member(index(base, 0))`. */
1649 assert(
1650 source->type->type_id == type2t::struct_id ||
1651 source->type->type_id == type2t::union_id ||
1652 source->type->type_id == type2t::complex_id ||
1653 source->type->type_id == type2t::symbol_id ||
1654 source->type->type_id == type2t::pointer_id ||
1655 source->type->type_id == type2t::array_id);
1656 /* member must exist exactly once in the parent struct/union — only
1657 checkable once the source type is resolved (skipped for the transient
1658 cases above; the lookup throws on an unresolved source -- without that
1659 guard `python2goto` cannot build the Python OM library, §162.2).
1660
1661 A code-typed member is the exception, and it is checked the other way
1662 round: it names a method, methods are no part of a struct_type2t, so it
1663 must NOT resolve to a component. What verifies such a member exists at
1664 all is upstream, where a namespace is in hand --
1665 clang_cpp_adjust_irep2::adjust_cpp_member looks it up by name and asserts
1666 the symbol is code (docs/roadmap/frontends-to-irep2.md §76). */
1667 if (
1668 source->type->type_id != type2t::symbol_id &&
1669 source->type->type_id != type2t::pointer_id &&
1670 source->type->type_id != type2t::array_id)
1671 assert(
1672 struct_union_get_component_number(source->type, memb).has_value() ==
1673 (type->type_id != type2t::code_id));
1674#endif
1675 }
1676 member2t(const member2t &ref) = default;
1677
1678 expr2tc do_simplify() const override;
1679
1680 static constexpr auto fields =
1682 static std::string field_names[esbmct::num_type_fields];
1683};
1684
1687class member_ref2t : public expr2t
1688{
1689public:
1691
1695 member_ref2t(const type2tc &type, const irep_idt &memb)
1696 : expr2t(type, member_ref_id), member(memb)
1697 {
1698 }
1699 member_ref2t(const member_ref2t &ref) = default;
1700
1701 static constexpr auto fields =
1702 std::make_tuple(&expr2t::type, &member_ref2t::member);
1703 static std::string field_names[esbmct::num_type_fields];
1704};
1705
1708class ptr_mem2t : public expr2t
1709{
1710public:
1713
1717 ptr_mem2t(const type2tc &type, const expr2tc &source, const expr2tc &pointer)
1718 : expr2t(type, ptr_mem_id), source_value(source), member_pointer(pointer)
1719 {
1720 }
1721 ptr_mem2t(const ptr_mem2t &ref) = default;
1722
1723 static constexpr auto fields = std::make_tuple(
1724 &expr2t::type,
1727 static std::string field_names[esbmct::num_type_fields];
1728};
1729
1732class index2t : public expr2t
1733{
1734public:
1737
1742 index2t(const type2tc &type, const expr2tc &source, const expr2tc &idx)
1743 : expr2t(type, index_id), source_value(source), index(idx)
1744 {
1745 /* A `symbol_id` or `pointer_id` source is permitted only as a transient
1746 pre-resolution state (V.1k two-phase source invariant, see member2t
1747 above); the IREP2-native adjuster resolves a symbol source to an
1748 array/vector and rewrites a pointer source `p[i]` to `*(p+i)` before
1749 symex. A pointer source arises when a legacy `index` over a decayed
1750 array (a Python string, char*) is migrated via get_value2(). */
1751 assert(
1752 is_array_type(source) || is_vector_type(source) ||
1753 source->type->type_id == type2t::symbol_id ||
1754 source->type->type_id == type2t::pointer_id);
1755 }
1756 index2t(const index2t &ref) = default;
1757
1758 expr2tc do_simplify() const override;
1759
1760 static constexpr auto fields =
1762 static std::string field_names[esbmct::num_type_fields];
1763};
1764
1771class overflow2t : public expr2t
1772{
1773public:
1775
1779 overflow2t(const expr2tc &operand_)
1780 : expr2t(get_bool_type(), overflow_id), operand(operand_)
1781 {
1782 }
1783 overflow2t(const overflow2t &ref) = default;
1784
1785 expr2tc do_simplify() const override;
1786
1787 static constexpr auto fields =
1788 std::make_tuple(&expr2t::type, &overflow2t::operand);
1789 static std::string field_names[esbmct::num_type_fields];
1790};
1791
1796{
1797public:
1799 unsigned int bits;
1800
1804 overflow_cast2t(const expr2tc &operand_, unsigned int bits_)
1805 : expr2t(get_bool_type(), overflow_cast_id), operand(operand_), bits(bits_)
1806 {
1807 }
1808 overflow_cast2t(const overflow_cast2t &ref) = default;
1809
1810 expr2tc do_simplify() const override;
1811
1812 static constexpr auto fields = std::make_tuple(
1813 &expr2t::type,
1816 static std::string field_names[esbmct::num_type_fields];
1817};
1818
1823{
1824public:
1826
1828 overflow_neg2t(const expr2tc &operand_)
1829 : expr2t(get_bool_type(), overflow_neg_id), operand(operand_)
1830 {
1831 }
1832 overflow_neg2t(const overflow_neg2t &ref) = default;
1833
1834 static constexpr auto fields =
1835 std::make_tuple(&expr2t::type, &overflow_neg2t::operand);
1836 static std::string field_names[esbmct::num_type_fields];
1837};
1838
1843{
1844public:
1848
1850 const type2tc &type,
1851 const expr2tc &inst,
1852 bool inv,
1853 bool uknown)
1854 : expr2t(type, dynamic_object_id),
1855 instance(inst),
1856 invalid(inv),
1857 unknown(uknown)
1858 {
1859 }
1860 dynamic_object2t(const dynamic_object2t &ref) = default;
1861
1862 static constexpr auto fields = std::make_tuple(
1863 &expr2t::type,
1867 static std::string field_names[esbmct::num_type_fields];
1868};
1869
1875class dereference2t : public expr2t
1876{
1877public:
1879
1883 dereference2t(const type2tc &type, const expr2tc &operand)
1884 : expr2t(type, dereference_id), value(operand)
1885 {
1886 }
1887 dereference2t(const dereference2t &ref) = default;
1888
1889 static constexpr auto fields =
1890 std::make_tuple(&expr2t::type, &dereference2t::value);
1891 static std::string field_names[esbmct::num_type_fields];
1892};
1893
1905class sideeffect2t : public expr2t
1906{
1907public:
1909
1912 std::vector<expr2tc> arguments;
1915
1931
1932 locationt location; // not reflected: source loc travels with the stmt
1933 static constexpr std::size_t excluded_field_bytes = sizeof(locationt);
1934
1946 const type2tc &t,
1947 const expr2tc &oper,
1948 const expr2tc &sz,
1949 const std::vector<expr2tc> &a,
1950 const type2tc &alloct,
1952 const locationt &loc = locationt(),
1953 bool ctor = false)
1954 : expr2t(t, sideeffect_id),
1955 operand(oper),
1956 size(sz),
1957 arguments(a),
1958 alloctype(alloct),
1959 kind(k),
1960 constructor(ctor),
1961 location(loc)
1962 {
1964 assert(oper->type == sz->type);
1965 }
1966 sideeffect2t(const sideeffect2t &ref) = default;
1967
1968 static constexpr auto fields = std::make_tuple(
1969 &expr2t::type,
1975 static std::string field_names[esbmct::num_type_fields];
1976};
1977
1978class code_block2t : public expr2t
1979{
1980public:
1981 std::vector<expr2tc> operands;
1982 locationt location; // not reflected: source loc travels with the stmt
1983 // not reflected: the closing-brace location travels with the block too, so a
1984 // code_block2t consumed natively by goto_convert (W1, esbmc/esbmc#4715) keeps
1985 // the end location convert_block needs for destructor placement.
1987 static constexpr std::size_t excluded_field_bytes = 2 * sizeof(locationt);
1988
1990 const std::vector<expr2tc> &ops,
1991 const locationt &loc = locationt(),
1992 const locationt &end_loc = locationt())
1993 : expr2t(get_empty_type(), code_block_id),
1994 operands(ops),
1995 location(loc),
1996 end_location(end_loc)
1997 {
1998 }
1999 code_block2t(const code_block2t &ref) = default;
2000
2001 static constexpr auto fields =
2002 std::make_tuple(&expr2t::type, &code_block2t::operands);
2003 static std::string field_names[esbmct::num_type_fields];
2004};
2005
2006class code_assign2t : public expr2t
2007{
2008public:
2011 locationt location; // not reflected: source loc travels with the stmt
2012 static constexpr std::size_t excluded_field_bytes = sizeof(locationt);
2013
2015 const expr2tc &tgt,
2016 const expr2tc &src,
2017 const locationt &loc = locationt())
2018 : expr2t(get_empty_type(), code_assign_id),
2019 target(tgt),
2020 source(src),
2021 location(loc)
2022 {
2023 }
2024 code_assign2t(const code_assign2t &ref) = default;
2025
2026 static constexpr auto fields = std::make_tuple(
2027 &expr2t::type,
2030 static std::string field_names[esbmct::num_type_fields];
2031};
2032
2033class code_printf2t : public expr2t
2034{
2035public:
2036 std::vector<expr2tc> operands;
2038 locationt location; // not reflected: source loc travels with the stmt
2039 static constexpr std::size_t excluded_field_bytes = sizeof(locationt);
2040
2042 const std::vector<expr2tc> &opers,
2043 printf_kindt k,
2044 const locationt &loc = locationt())
2045 : expr2t(get_empty_type(), code_printf_id),
2046 operands(opers),
2047 kind(k),
2048 location(loc)
2049 {
2050 }
2051 code_printf2t(const code_printf2t &ref) = default;
2052
2053 static constexpr auto fields = std::make_tuple(
2054 &expr2t::type,
2057 static std::string field_names[esbmct::num_type_fields];
2058};
2059
2060class code_skip2t : public expr2t
2061{
2062public:
2063 locationt location; // not reflected: source loc travels with the stmt
2064 static constexpr std::size_t excluded_field_bytes = sizeof(locationt);
2066 : expr2t(type, code_skip_id), location(loc)
2067 {
2068 }
2069 code_skip2t(const code_skip2t &ref) = default;
2070
2071 static constexpr auto fields = std::make_tuple(&expr2t::type);
2072 static std::string field_names[esbmct::num_type_fields];
2073};
2074
2078class new_object2t : public expr2t
2079{
2080public:
2081 new_object2t(const type2tc &type) : expr2t(type, new_object_id)
2082 {
2083 }
2084 new_object2t(const new_object2t &ref) = default;
2085
2086 expr2tc do_simplify() const override;
2087 static constexpr auto fields = std::make_tuple(&expr2t::type);
2088 static std::string field_names[esbmct::num_type_fields];
2089};
2090
2102{
2103public:
2108 std::vector<expr2tc> arguments;
2109
2111 const type2tc &type,
2112 const irep_idt &name,
2113 const std::vector<expr2tc> &args)
2114 : expr2t(type, uninterpreted_func_id), function_name(name), arguments(args)
2115 {
2116 }
2118
2119 static constexpr auto fields = std::make_tuple(
2120 &expr2t::type,
2123 static std::string field_names[esbmct::num_type_fields];
2124};
2125
2126class code_goto2t : public expr2t
2127{
2128public:
2130 locationt location; // not reflected: source loc travels with the stmt
2131 static constexpr std::size_t excluded_field_bytes = sizeof(locationt);
2132
2133 code_goto2t(const irep_idt &targ, const locationt &loc = locationt())
2134 : expr2t(get_empty_type(), code_goto_id), target(targ), location(loc)
2135 {
2136 }
2137 code_goto2t(const code_goto2t &ref) = default;
2138
2139 static constexpr auto fields =
2140 std::make_tuple(&expr2t::type, &code_goto2t::target);
2141 static std::string field_names[esbmct::num_type_fields];
2142};
2143
2145{
2146public:
2149 unsigned int alignment;
2150
2152 const type2tc &t,
2153 const expr2tc &root,
2154 const expr2tc &offs,
2155 unsigned int align)
2156 : expr2t(t, object_descriptor_id),
2157 object(root),
2158 offset(offs),
2159 alignment(align)
2160 {
2161 }
2163
2164 const expr2tc &get_root_object() const;
2165
2166 static constexpr auto fields = std::make_tuple(
2167 &expr2t::type,
2171 static std::string field_names[esbmct::num_type_fields];
2172};
2173
2175{
2176public:
2179 std::vector<expr2tc> operands;
2180 locationt location; // not reflected: source loc travels with the stmt
2181 static constexpr std::size_t excluded_field_bytes = sizeof(locationt);
2182
2184 const expr2tc &r,
2185 const expr2tc &func,
2186 const std::vector<expr2tc> &args,
2187 const locationt &loc = locationt())
2188 : expr2t(get_empty_type(), code_function_call_id),
2189 ret(r),
2190 function(func),
2191 operands(args),
2192 location(loc)
2193 {
2194 }
2196
2197 static constexpr auto fields = std::make_tuple(
2198 &expr2t::type,
2202 static std::string field_names[esbmct::num_type_fields];
2203};
2204
2205// V.4 (esbmc/esbmc#4715): structured control-flow code kinds. IREP2 had only
2206// the flat goto-level code kinds; these mirror the legacy structured codet
2207// statements (ifthenelse/while/for/switch/break/continue/label) so the
2208// frontend can build IREP2 bodies and goto_convert can consume them, removing
2209// the per-instruction back-migration at the body seam (wall W1). Shipped
2210// dead-but-tested first: nothing builds them until the goto_convert wiring
2211// phase, so they are behaviour-inert and only the round-trip unit tests
2212// exercise them (the V-track pattern).
2213//
2214// V.4.1: each kind carries a `locationt location` so a future IREP2-native
2215// goto_convert can stamp each instruction's source location -- the legacy
2216// codet carries it on the node, but expr2t/migrate do not, so an IREP2 body
2217// would otherwise lose all counterexample line numbers. The field is
2218// deliberately NOT part of the `fields` tuple, so it does not enter the IREP2
2219// hash/equality (matching how a goto instructiont stores its locationt
2220// separately); it is preserved through clone() by the defaulted copy ctor and
2221// threaded by hand in migrate (forward copies code.location(), back restores
2222// it).
2224{
2225public:
2228 expr2tc else_case; // nil when there is no else branch
2229 locationt location; // not reflected (see note above)
2230 static constexpr std::size_t excluded_field_bytes = sizeof(locationt);
2231
2233 const expr2tc &c,
2234 const expr2tc &t,
2235 const expr2tc &e,
2236 const locationt &loc = locationt())
2237 : expr2t(get_empty_type(), code_ifthenelse_id),
2238 cond(c),
2239 then_case(t),
2240 else_case(e),
2241 location(loc)
2242 {
2243 }
2245
2246 static constexpr auto fields = std::make_tuple(
2247 &expr2t::type,
2251 static std::string field_names[esbmct::num_type_fields];
2252};
2253
2254class code_while2t : public expr2t
2255{
2256public:
2259 locationt location; // not reflected (see note above)
2260 // `#pragma unroll N` count: travels with the loop statement so the
2261 // --irep2-bodies round-trip preserves the per-loop unwind bound that
2262 // goto_convert later stamps onto the loop's GOTO instruction. Not
2263 // reflected, so it stays out of value identity (like `location`).
2265 static constexpr std::size_t excluded_field_bytes =
2266 sizeof(locationt) + sizeof(unsigned);
2267
2269 const expr2tc &c,
2270 const expr2tc &b,
2271 const locationt &loc = locationt(),
2272 unsigned pragma = 0)
2273 : expr2t(get_empty_type(), code_while_id),
2274 cond(c),
2275 body(b),
2276 location(loc),
2277 pragma_unroll_count(pragma)
2278 {
2279 }
2280 code_while2t(const code_while2t &ref) = default;
2281
2282 static constexpr auto fields =
2284 static std::string field_names[esbmct::num_type_fields];
2285};
2286
2288{
2289public:
2292 locationt location; // not reflected (see note above)
2293 // `#pragma unroll N` count (see code_while2t).
2295 static constexpr std::size_t excluded_field_bytes =
2296 sizeof(locationt) + sizeof(unsigned);
2297
2299 const expr2tc &c,
2300 const expr2tc &b,
2301 const locationt &loc = locationt(),
2302 unsigned pragma = 0)
2303 : expr2t(get_empty_type(), code_dowhile_id),
2304 cond(c),
2305 body(b),
2306 location(loc),
2307 pragma_unroll_count(pragma)
2308 {
2309 }
2310 code_dowhile2t(const code_dowhile2t &ref) = default;
2311
2312 static constexpr auto fields = std::make_tuple(
2313 &expr2t::type,
2316 static std::string field_names[esbmct::num_type_fields];
2317};
2318
2319class code_for2t : public expr2t
2320{
2321public:
2322 expr2tc init; // nil when absent
2323 expr2tc cond; // nil when absent
2324 expr2tc iter; // nil when absent
2326 locationt location; // not reflected (see note above)
2327 // `#pragma unroll N` count (see code_while2t).
2329 static constexpr std::size_t excluded_field_bytes =
2330 sizeof(locationt) + sizeof(unsigned);
2331
2333 const expr2tc &i,
2334 const expr2tc &c,
2335 const expr2tc &it,
2336 const expr2tc &b,
2337 const locationt &loc = locationt(),
2338 unsigned pragma = 0)
2339 : expr2t(get_empty_type(), code_for_id),
2340 init(i),
2341 cond(c),
2342 iter(it),
2343 body(b),
2344 location(loc),
2345 pragma_unroll_count(pragma)
2346 {
2347 }
2348 code_for2t(const code_for2t &ref) = default;
2349
2350 static constexpr auto fields = std::make_tuple(
2351 &expr2t::type,
2356 static std::string field_names[esbmct::num_type_fields];
2357};
2358
2359class code_switch2t : public expr2t
2360{
2361public:
2364 locationt location; // not reflected (see note above)
2365 static constexpr std::size_t excluded_field_bytes = sizeof(locationt);
2366
2368 const expr2tc &v,
2369 const expr2tc &b,
2370 const locationt &loc = locationt())
2371 : expr2t(get_empty_type(), code_switch_id), value(v), body(b), location(loc)
2372 {
2373 }
2374 code_switch2t(const code_switch2t &ref) = default;
2375
2376 static constexpr auto fields =
2378 static std::string field_names[esbmct::num_type_fields];
2379};
2380
2381class code_break2t : public expr2t
2382{
2383public:
2384 locationt location; // not reflected (see note above)
2385 static constexpr std::size_t excluded_field_bytes = sizeof(locationt);
2386
2388 : expr2t(get_empty_type(), code_break_id), location(loc)
2389 {
2390 }
2391 code_break2t(const code_break2t &ref) = default;
2392
2393 static constexpr auto fields = std::make_tuple(&expr2t::type);
2394 static std::string field_names[esbmct::num_type_fields];
2395};
2396
2398{
2399public:
2400 locationt location; // not reflected (see note above)
2401 static constexpr std::size_t excluded_field_bytes = sizeof(locationt);
2402
2404 : expr2t(get_empty_type(), code_continue_id), location(loc)
2405 {
2406 }
2407 code_continue2t(const code_continue2t &ref) = default;
2408
2409 static constexpr auto fields = std::make_tuple(&expr2t::type);
2410 static std::string field_names[esbmct::num_type_fields];
2411};
2412
2413class code_label2t : public expr2t
2414{
2415public:
2418 locationt location; // not reflected (see note above)
2419 static constexpr std::size_t excluded_field_bytes = sizeof(locationt);
2420
2422 const irep_idt &l,
2423 const expr2tc &c,
2424 const locationt &loc = locationt())
2425 : expr2t(get_empty_type(), code_label_id), label(l), code(c), location(loc)
2426 {
2427 }
2428 code_label2t(const code_label2t &ref) = default;
2429
2430 static constexpr auto fields =
2432 static std::string field_names[esbmct::num_type_fields];
2433};
2434
2439{
2440public:
2442 expr2tc case_op; // nil when is_default
2443 expr2tc case_op_hi; // GNU `case lo ... hi:` upper bound; nil otherwise
2445 locationt location; // not reflected (see note above)
2446 static constexpr std::size_t excluded_field_bytes = sizeof(locationt);
2447
2449 bool _is_default,
2450 const expr2tc &_case_op,
2451 const expr2tc &_code,
2452 const locationt &loc = locationt(),
2453 const expr2tc &_case_op_hi = expr2tc())
2454 : expr2t(get_empty_type(), code_switch_case_id),
2455 is_default(_is_default),
2456 case_op(_case_op),
2457 case_op_hi(_case_op_hi),
2458 code(_code),
2459 location(loc)
2460 {
2461 }
2463
2464 static constexpr auto fields = std::make_tuple(
2465 &expr2t::type,
2470 static std::string field_names[esbmct::num_type_fields];
2471};
2472
2477class code_assert2t : public expr2t
2478{
2479public:
2481 locationt location; // not reflected (see note above)
2482 static constexpr std::size_t excluded_field_bytes = sizeof(locationt);
2483
2484 code_assert2t(const expr2tc &g, const locationt &loc = locationt())
2485 : expr2t(get_empty_type(), code_assert_id), guard(g), location(loc)
2486 {
2487 }
2488 code_assert2t(const code_assert2t &ref) = default;
2489
2490 static constexpr auto fields =
2491 std::make_tuple(&expr2t::type, &code_assert2t::guard);
2492 static std::string field_names[esbmct::num_type_fields];
2493};
2494
2495class code_assume2t : public expr2t
2496{
2497public:
2499 locationt location; // not reflected (see note above)
2500 static constexpr std::size_t excluded_field_bytes = sizeof(locationt);
2501
2502 code_assume2t(const expr2tc &g, const locationt &loc = locationt())
2503 : expr2t(get_empty_type(), code_assume_id), guard(g), location(loc)
2504 {
2505 }
2506 code_assume2t(const code_assume2t &ref) = default;
2507
2508 static constexpr auto fields =
2509 std::make_tuple(&expr2t::type, &code_assume2t::guard);
2510 static std::string field_names[esbmct::num_type_fields];
2511};
2512
2519{
2520public:
2521 irep_idt op; // "assign", "assign+", "assign-", "assign*", etc.
2522
2540
2543 locationt location; // not reflected: source loc travels with the stmt
2544 static constexpr std::size_t excluded_field_bytes = sizeof(locationt);
2545
2547 const type2tc &t,
2548 const irep_idt &o,
2549 const expr2tc &l,
2550 const expr2tc &r,
2551 const locationt &loc = locationt(),
2552 bool member_init_ = false)
2553 : expr2t(t, sideeffect_assign_id),
2554 op(o),
2555 member_init(member_init_),
2556 lhs(l),
2557 rhs(r),
2558 location(loc)
2559 {
2560 }
2562
2563 static constexpr auto fields = std::make_tuple(
2564 &expr2t::type,
2568 static std::string field_names[esbmct::num_type_fields];
2569};
2570
2571class code_comma2t : public expr2t
2572{
2573public:
2576
2577 code_comma2t(const type2tc &t, const expr2tc &s1, const expr2tc &s2)
2578 : expr2t(t, code_comma_id), side_1(s1), side_2(s2)
2579 {
2580 }
2581 code_comma2t(const code_comma2t &ref) = default;
2582
2583 static constexpr auto fields = std::make_tuple(
2584 &expr2t::type,
2587 static std::string field_names[esbmct::num_type_fields];
2588};
2589
2591{
2592public:
2594
2596 : expr2t(get_bool_type(), invalid_pointer_id), ptr_obj(obj)
2597 {
2598 }
2600
2601 static constexpr auto fields = std::make_tuple(&invalid_pointer2t::ptr_obj);
2602 static std::string field_names[esbmct::num_type_fields];
2603};
2604
2605class code_asm2t : public expr2t
2606{
2607public:
2609 locationt location; // not reflected: source loc travels with the stmt
2610 static constexpr std::size_t excluded_field_bytes = sizeof(locationt);
2611
2613 const type2tc &type,
2614 const irep_idt &stringref,
2615 const locationt &loc = locationt())
2616 : expr2t(type, code_asm_id), value(stringref), location(loc)
2617 {
2618 }
2619 code_asm2t(const code_asm2t &ref) = default;
2620
2621 static constexpr auto fields =
2622 std::make_tuple(&expr2t::type, &code_asm2t::value);
2623 static std::string field_names[esbmct::num_type_fields];
2624};
2625
2627{
2628public:
2629 std::vector<irep_idt> exception_list;
2630 // Source-level try/catch operands: operands[0] is the try block, operands
2631 // [1..N] the catch-handler blocks (parallel to exception_list). Empty for
2632 // the post-goto-convert CATCH-push/pop marker instructions, which carry only
2633 // the catchable-type list. Retained so a try/catch body survives the
2634 // --irep2-bodies round-trip (esbmc/esbmc#4715); convert_catch reads it back.
2635 std::vector<expr2tc> operands;
2636 locationt location; // not reflected: source loc travels with the stmt
2637 static constexpr std::size_t excluded_field_bytes = sizeof(locationt);
2638
2640 const std::vector<irep_idt> &el,
2641 const locationt &loc = locationt())
2642 : expr2t(get_empty_type(), code_cpp_catch_id),
2643 exception_list(el),
2644 location(loc)
2645 {
2646 }
2648 const std::vector<irep_idt> &el,
2649 const std::vector<expr2tc> &ops,
2650 const locationt &loc = locationt())
2651 : expr2t(get_empty_type(), code_cpp_catch_id),
2652 exception_list(el),
2653 operands(ops),
2654 location(loc)
2655 {
2656 }
2657 code_cpp_catch2t(const code_cpp_catch2t &ref) = default;
2658
2659 static constexpr auto fields = std::make_tuple(
2660 &expr2t::type,
2663 static std::string field_names[esbmct::num_type_fields];
2664};
2665
2667{
2668public:
2670 std::vector<irep_idt> exception_list;
2671 locationt location; // not reflected: source loc travels with the stmt
2672 static constexpr std::size_t excluded_field_bytes = sizeof(locationt);
2673
2675 const expr2tc &o,
2676 const std::vector<irep_idt> &l,
2677 const locationt &loc = locationt())
2678 : expr2t(get_empty_type(), code_cpp_throw_id),
2679 operand(o),
2680 exception_list(l),
2681 location(loc)
2682 {
2683 }
2684 code_cpp_throw2t(const code_cpp_throw2t &ref) = default;
2685
2686 static constexpr auto fields = std::make_tuple(
2687 &expr2t::type,
2690 static std::string field_names[esbmct::num_type_fields];
2691};
2692
2694class concat2t : public expr2t
2695{
2696public:
2699
2700 concat2t(const type2tc &type, const expr2tc &forward, const expr2tc &aft)
2701 : expr2t(type, concat_id), side_1(forward), side_2(aft)
2702 {
2703 assert(is_unsignedbv_type(forward));
2704 assert(is_unsignedbv_type(aft));
2705 }
2706 concat2t(const concat2t &ref) = default;
2707
2708 expr2tc do_simplify() const override;
2709
2710 static constexpr auto fields =
2711 std::make_tuple(&expr2t::type, &concat2t::side_1, &concat2t::side_2);
2712 static std::string field_names[esbmct::num_type_fields];
2713};
2714
2715class extract2t : public expr2t
2716{
2717public:
2719 unsigned int upper;
2720 unsigned int lower;
2721
2723 const type2tc &type,
2724 const expr2tc &from_,
2725 unsigned int upper_,
2726 unsigned int lower_)
2727 : expr2t(type, extract_id), from(from_), upper(upper_), lower(lower_)
2728 {
2729 }
2730 extract2t(const extract2t &ref) = default;
2731
2732 expr2tc do_simplify() const override;
2733
2734 static constexpr auto fields = std::make_tuple(
2735 &expr2t::type,
2739 static std::string field_names[esbmct::num_type_fields];
2740};
2741
2756class sizeof2t : public expr2t
2757{
2758public:
2761
2762 sizeof2t(const type2tc &type, const expr2tc &val, const type2tc &sizeof_t)
2763 : expr2t(type, sizeof_id), value(val), sizeof_type(sizeof_t)
2764 {
2765 }
2766 sizeof2t(const sizeof2t &ref) = default;
2767
2768 expr2tc do_simplify() const override;
2769
2770 static constexpr auto fields =
2772 static std::string field_names[esbmct::num_type_fields];
2773};
2774
2775// Same deal as for "type_macros": is_<name>2t predicates plus to_<name>2t
2776// downcasts routed through irep2_checked_expr_cast so a bad to_*2t throws
2777// irep2_cast_error in every build mode.
2778#define expr_macros(name) \
2779 inline bool is_##name##2t(const expr2tc &t) \
2780 { \
2781 return t->expr_id == expr2t::name##_id; \
2782 } \
2783 inline const name##2t & to_##name##2t(const expr2tc &t) \
2784 { \
2785 return irep2_checked_expr_cast<const name##2t>( \
2786 *t, expr2t::name##_id, #name); \
2787 } \
2788 inline name##2t & to_##name##2t(expr2tc & t) \
2789 { \
2790 return irep2_checked_expr_cast<name##2t>( \
2791 *t.get(), expr2t::name##_id, #name); \
2792 } \
2793 inline const name##2t * try_to_##name##2t(const expr2tc &t) \
2794 { \
2795 return is_##name##2t(t) ? &to_##name##2t(t) : nullptr; \
2796 }
2797
2798// Instantiate the is_/to_/try_to_ predicate triple for every kind in
2799// expr_kinds.inc. Same manifest as the enum and forward declarations
2800// above, so adding a kind is a single line there.
2801#define IREP2_EXPR(kind, pretty) expr_macros(kind)
2802#include <irep2/expr_kinds.inc>
2803#undef IREP2_EXPR
2804
2805#undef expr_macros
2806
2807#endif /* IREP2_EXPR_H_ */
@ nearbyint
Definition builtin_names.h:36
type2tc get_int32_type()
Definition c_types.cpp:372
type2tc get_empty_type()
Definition c_types.cpp:424
type2tc get_bool_type()
Definition c_types.cpp:418
Definition bigint.hh:58
expr2tc do_simplify() const override
expr-specific simplification methods.
Definition expr_simplifier.cpp:3865
expr2tc ptr_obj
Definition irep2_expr.h:1450
static constexpr auto fields
Definition irep2_expr.h:1481
static std::string field_names[esbmct::num_type_fields]
Definition irep2_expr.h:850
address_of2t(const address_of2t &ref)=default
bool implicit
Primary constructor.
Definition irep2_expr.h:1463
address_of2t(const type2tc &subtype, const expr2tc &ptrobj, bool is_implicit=false, pointer_ref_kindt rk=pointer_ref_kindt::NONE)
Definition irep2_expr.h:1465
bitcast2t(const type2tc &type, const expr2tc &from_)
Primary constructor.
Definition irep2_expr.h:816
expr2tc do_simplify() const override
expr-specific simplification methods.
Definition expr_simplifier.cpp:3459
static constexpr auto fields
Definition irep2_expr.h:833
bitcast2t(const bitcast2t &ref)=default
expr2tc from
Definition irep2_expr.h:810
static std::string field_names[esbmct::num_type_fields]
Definition irep2_expr.h:852
expr2tc source_offset
Definition irep2_expr.h:1496
expr2tc do_simplify() const override
expr-specific simplification methods.
Definition expr_simplifier.cpp:6570
byte_extract2t(const byte_extract2t &ref)=default
expr2tc source_value
Definition irep2_expr.h:1495
static constexpr auto fields
Definition irep2_expr.h:1520
byte_extract2t(const type2tc &type, const expr2tc &source, const expr2tc &offset, bool is_big_endian)
Primary constructor.
Definition irep2_expr.h:1505
bool big_endian
Definition irep2_expr.h:1497
expr2tc source_offset
Definition irep2_expr.h:1536
expr2tc do_simplify() const override
expr-specific simplification methods.
Definition expr_simplifier.cpp:6688
bool big_endian
Definition irep2_expr.h:1538
static std::string field_names[esbmct::num_type_fields]
Definition irep2_expr.h:854
expr2tc source_value
Definition irep2_expr.h:1535
static constexpr auto fields
Definition irep2_expr.h:1562
byte_update2t(const byte_update2t &ref)=default
byte_update2t(const type2tc &type, const expr2tc &source, const expr2tc &offset, const expr2tc &updateval, bool is_big_endian)
Primary constructor.
Definition irep2_expr.h:1545
expr2tc update_value
Definition irep2_expr.h:1537
expr2tc side_1
Definition irep2_expr.h:1250
cmp_three_way2t(const cmp_three_way2t &ref)=default
static constexpr auto fields
Definition irep2_expr.h:1261
cmp_three_way2t(const type2tc &t, const expr2tc &v1, const expr2tc &v2)
Definition irep2_expr.h:1253
expr2tc side_2
Definition irep2_expr.h:1251
expr2tc do_simplify() const override
expr-specific simplification methods.
Definition expr_simplifier.cpp:5089
static std::string field_names[esbmct::num_type_fields]
Definition irep2_expr.h:788
static constexpr auto fields
Definition irep2_expr.h:2621
static constexpr std::size_t excluded_field_bytes
Definition irep2_expr.h:2610
code_asm2t(const code_asm2t &ref)=default
locationt location
Definition irep2_expr.h:2609
irep_idt value
Definition irep2_expr.h:2608
static std::string field_names[esbmct::num_type_fields]
Definition irep2_expr.h:950
code_asm2t(const type2tc &type, const irep_idt &stringref, const locationt &loc=locationt())
Definition irep2_expr.h:2612
locationt location
Definition irep2_expr.h:2481
static constexpr std::size_t excluded_field_bytes
Definition irep2_expr.h:2482
expr2tc guard
Definition irep2_expr.h:2480
code_assert2t(const code_assert2t &ref)=default
static constexpr auto fields
Definition irep2_expr.h:2490
static std::string field_names[esbmct::num_type_fields]
Definition irep2_expr.h:940
code_assert2t(const expr2tc &g, const locationt &loc=locationt())
Definition irep2_expr.h:2484
locationt location
Definition irep2_expr.h:2011
code_assign2t(const expr2tc &tgt, const expr2tc &src, const locationt &loc=locationt())
Definition irep2_expr.h:2014
expr2tc source
Definition irep2_expr.h:2010
static std::string field_names[esbmct::num_type_fields]
Definition irep2_expr.h:896
expr2tc target
Definition irep2_expr.h:2009
static constexpr std::size_t excluded_field_bytes
Definition irep2_expr.h:2012
static constexpr auto fields
Definition irep2_expr.h:2026
code_assign2t(const code_assign2t &ref)=default
static constexpr std::size_t excluded_field_bytes
Definition irep2_expr.h:2500
static constexpr auto fields
Definition irep2_expr.h:2508
code_assume2t(const expr2tc &g, const locationt &loc=locationt())
Definition irep2_expr.h:2502
code_assume2t(const code_assume2t &ref)=default
locationt location
Definition irep2_expr.h:2499
static std::string field_names[esbmct::num_type_fields]
Definition irep2_expr.h:942
expr2tc guard
Definition irep2_expr.h:2498
static constexpr auto fields
Definition irep2_expr.h:2001
locationt location
Definition irep2_expr.h:1982
std::vector< expr2tc > operands
Definition irep2_expr.h:1981
static constexpr std::size_t excluded_field_bytes
Definition irep2_expr.h:1987
code_block2t(const std::vector< expr2tc > &ops, const locationt &loc=locationt(), const locationt &end_loc=locationt())
Definition irep2_expr.h:1989
locationt end_location
Definition irep2_expr.h:1986
code_block2t(const code_block2t &ref)=default
static std::string field_names[esbmct::num_type_fields]
Definition irep2_expr.h:894
locationt location
Definition irep2_expr.h:2384
static constexpr std::size_t excluded_field_bytes
Definition irep2_expr.h:2385
static std::string field_names[esbmct::num_type_fields]
Definition irep2_expr.h:932
static constexpr auto fields
Definition irep2_expr.h:2393
code_break2t(const locationt &loc=locationt())
Definition irep2_expr.h:2387
code_break2t(const code_break2t &ref)=default
expr2tc side_1
Definition irep2_expr.h:2574
static std::string field_names[esbmct::num_type_fields]
Definition irep2_expr.h:946
code_comma2t(const code_comma2t &ref)=default
expr2tc side_2
Definition irep2_expr.h:2575
code_comma2t(const type2tc &t, const expr2tc &s1, const expr2tc &s2)
Definition irep2_expr.h:2577
static constexpr auto fields
Definition irep2_expr.h:2583
code_continue2t(const locationt &loc=locationt())
Definition irep2_expr.h:2403
static constexpr auto fields
Definition irep2_expr.h:2409
static std::string field_names[esbmct::num_type_fields]
Definition irep2_expr.h:934
static constexpr std::size_t excluded_field_bytes
Definition irep2_expr.h:2401
locationt location
Definition irep2_expr.h:2400
code_continue2t(const code_continue2t &ref)=default
code_cpp_catch2t(const std::vector< irep_idt > &el, const std::vector< expr2tc > &ops, const locationt &loc=locationt())
Definition irep2_expr.h:2647
static constexpr auto fields
Definition irep2_expr.h:2659
std::vector< irep_idt > exception_list
Definition irep2_expr.h:2629
static std::string field_names[esbmct::num_type_fields]
Definition irep2_expr.h:956
code_cpp_catch2t(const std::vector< irep_idt > &el, const locationt &loc=locationt())
Definition irep2_expr.h:2639
static constexpr std::size_t excluded_field_bytes
Definition irep2_expr.h:2637
code_cpp_catch2t(const code_cpp_catch2t &ref)=default
locationt location
Definition irep2_expr.h:2636
std::vector< expr2tc > operands
Definition irep2_expr.h:2635
static std::string field_names[esbmct::num_type_fields]
Definition irep2_expr.h:958
code_cpp_throw2t(const code_cpp_throw2t &ref)=default
code_cpp_throw2t(const expr2tc &o, const std::vector< irep_idt > &l, const locationt &loc=locationt())
Definition irep2_expr.h:2674
std::vector< irep_idt > exception_list
Definition irep2_expr.h:2670
static constexpr auto fields
Definition irep2_expr.h:2686
static constexpr std::size_t excluded_field_bytes
Definition irep2_expr.h:2672
locationt location
Definition irep2_expr.h:2671
expr2tc operand
Definition irep2_expr.h:2669
code_decl2t(const code_decl2t &ref)=default
expr2tc do_simplify() const override
expr-specific simplification methods.
code_decl2t(const type2tc &type, const irep_idt &n, const expr2tc &i=expr2tc(), const locationt &loc=locationt())
Definition irep2_expr.h:1219
irep_idt value
Definition irep2_expr.h:1215
expr2tc init
Definition irep2_expr.h:1216
static constexpr std::size_t excluded_field_bytes
Definition irep2_expr.h:1218
static constexpr auto fields
Definition irep2_expr.h:1229
static std::string field_names[esbmct::num_type_fields]
Definition irep2_expr.h:898
locationt location
Definition irep2_expr.h:1217
code_dowhile2t(const code_dowhile2t &ref)=default
static constexpr std::size_t excluded_field_bytes
Definition irep2_expr.h:2295
locationt location
Definition irep2_expr.h:2292
expr2tc body
Definition irep2_expr.h:2291
static std::string field_names[esbmct::num_type_fields]
Definition irep2_expr.h:926
static constexpr auto fields
Definition irep2_expr.h:2312
code_dowhile2t(const expr2tc &c, const expr2tc &b, const locationt &loc=locationt(), unsigned pragma=0)
Definition irep2_expr.h:2298
unsigned pragma_unroll_count
Definition irep2_expr.h:2294
expr2tc cond
Definition irep2_expr.h:2290
expr2tc iter
Definition irep2_expr.h:2324
static std::string field_names[esbmct::num_type_fields]
Definition irep2_expr.h:928
locationt location
Definition irep2_expr.h:2326
unsigned pragma_unroll_count
Definition irep2_expr.h:2328
static constexpr std::size_t excluded_field_bytes
Definition irep2_expr.h:2329
static constexpr auto fields
Definition irep2_expr.h:2350
expr2tc body
Definition irep2_expr.h:2325
code_for2t(const code_for2t &ref)=default
code_for2t(const expr2tc &i, const expr2tc &c, const expr2tc &it, const expr2tc &b, const locationt &loc=locationt(), unsigned pragma=0)
Definition irep2_expr.h:2332
expr2tc init
Definition irep2_expr.h:2322
expr2tc cond
Definition irep2_expr.h:2323
code_function_call2t(const code_function_call2t &ref)=default
static constexpr std::size_t excluded_field_bytes
Definition irep2_expr.h:2181
expr2tc ret
Definition irep2_expr.h:2177
static constexpr auto fields
Definition irep2_expr.h:2197
static std::string field_names[esbmct::num_type_fields]
Definition irep2_expr.h:920
locationt location
Definition irep2_expr.h:2180
expr2tc function
Definition irep2_expr.h:2178
std::vector< expr2tc > operands
Definition irep2_expr.h:2179
code_function_call2t(const expr2tc &r, const expr2tc &func, const std::vector< expr2tc > &args, const locationt &loc=locationt())
Definition irep2_expr.h:2183
static constexpr std::size_t excluded_field_bytes
Definition irep2_expr.h:2131
code_goto2t(const code_goto2t &ref)=default
locationt location
Definition irep2_expr.h:2130
static constexpr auto fields
Definition irep2_expr.h:2139
irep_idt target
Definition irep2_expr.h:2129
static std::string field_names[esbmct::num_type_fields]
Definition irep2_expr.h:916
code_goto2t(const irep_idt &targ, const locationt &loc=locationt())
Definition irep2_expr.h:2133
expr2tc then_case
Definition irep2_expr.h:2227
expr2tc cond
Definition irep2_expr.h:2226
static constexpr std::size_t excluded_field_bytes
Definition irep2_expr.h:2230
expr2tc else_case
Definition irep2_expr.h:2228
static std::string field_names[esbmct::num_type_fields]
Definition irep2_expr.h:922
locationt location
Definition irep2_expr.h:2229
code_ifthenelse2t(const code_ifthenelse2t &ref)=default
static constexpr auto fields
Definition irep2_expr.h:2246
code_ifthenelse2t(const expr2tc &c, const expr2tc &t, const expr2tc &e, const locationt &loc=locationt())
Definition irep2_expr.h:2232
irep_idt label
Definition irep2_expr.h:2416
code_label2t(const code_label2t &ref)=default
static constexpr std::size_t excluded_field_bytes
Definition irep2_expr.h:2419
static std::string field_names[esbmct::num_type_fields]
Definition irep2_expr.h:936
static constexpr auto fields
Definition irep2_expr.h:2430
code_label2t(const irep_idt &l, const expr2tc &c, const locationt &loc=locationt())
Definition irep2_expr.h:2421
locationt location
Definition irep2_expr.h:2418
expr2tc code
Definition irep2_expr.h:2417
code_printf2t(const std::vector< expr2tc > &opers, printf_kindt k, const locationt &loc=locationt())
Definition irep2_expr.h:2041
code_printf2t(const code_printf2t &ref)=default
static constexpr auto fields
Definition irep2_expr.h:2053
std::vector< expr2tc > operands
Definition irep2_expr.h:2036
static constexpr std::size_t excluded_field_bytes
Definition irep2_expr.h:2039
static std::string field_names[esbmct::num_type_fields]
Definition irep2_expr.h:902
printf_kindt kind
Definition irep2_expr.h:2037
locationt location
Definition irep2_expr.h:2038
static constexpr auto fields
Definition irep2_expr.h:2071
code_skip2t(const code_skip2t &ref)=default
locationt location
Definition irep2_expr.h:2063
code_skip2t(const type2tc &type, const locationt &loc=locationt())
Definition irep2_expr.h:2065
static constexpr std::size_t excluded_field_bytes
Definition irep2_expr.h:2064
static std::string field_names[esbmct::num_type_fields]
Definition irep2_expr.h:908
static std::string field_names[esbmct::num_type_fields]
Definition irep2_expr.h:930
code_switch2t(const expr2tc &v, const expr2tc &b, const locationt &loc=locationt())
Definition irep2_expr.h:2367
static constexpr auto fields
Definition irep2_expr.h:2376
static constexpr std::size_t excluded_field_bytes
Definition irep2_expr.h:2365
expr2tc body
Definition irep2_expr.h:2363
expr2tc value
Definition irep2_expr.h:2362
locationt location
Definition irep2_expr.h:2364
code_switch2t(const code_switch2t &ref)=default
static constexpr std::size_t excluded_field_bytes
Definition irep2_expr.h:2446
static constexpr auto fields
Definition irep2_expr.h:2464
code_switch_case2t(const code_switch_case2t &ref)=default
expr2tc case_op_hi
Definition irep2_expr.h:2443
expr2tc code
Definition irep2_expr.h:2444
static std::string field_names[esbmct::num_type_fields]
Definition irep2_expr.h:938
expr2tc case_op
Definition irep2_expr.h:2442
locationt location
Definition irep2_expr.h:2445
bool is_default
Definition irep2_expr.h:2441
code_switch_case2t(bool _is_default, const expr2tc &_case_op, const expr2tc &_code, const locationt &loc=locationt(), const expr2tc &_case_op_hi=expr2tc())
Definition irep2_expr.h:2448
static constexpr std::size_t excluded_field_bytes
Definition irep2_expr.h:2265
static std::string field_names[esbmct::num_type_fields]
Definition irep2_expr.h:924
expr2tc cond
Definition irep2_expr.h:2257
locationt location
Definition irep2_expr.h:2259
expr2tc body
Definition irep2_expr.h:2258
code_while2t(const expr2tc &c, const expr2tc &b, const locationt &loc=locationt(), unsigned pragma=0)
Definition irep2_expr.h:2268
static constexpr auto fields
Definition irep2_expr.h:2282
unsigned pragma_unroll_count
Definition irep2_expr.h:2264
code_while2t(const code_while2t &ref)=default
expr2tc side_1
Definition irep2_expr.h:2697
concat2t(const type2tc &type, const expr2tc &forward, const expr2tc &aft)
Definition irep2_expr.h:2700
expr2tc side_2
Definition irep2_expr.h:2698
concat2t(const concat2t &ref)=default
static constexpr auto fields
Definition irep2_expr.h:2710
static std::string field_names[esbmct::num_type_fields]
Definition irep2_expr.h:972
expr2tc do_simplify() const override
expr-specific simplification methods.
Definition expr_simplifier.cpp:5665
constant_array2t(const constant_array2t &ref)=default
expr2tc do_simplify() const override
expr-specific simplification methods.
Definition expr_simplifier.cpp:6557
std::vector< expr2tc > datatype_members
Definition irep2_expr.h:553
constant_array2t(const type2tc &type, const std::vector< expr2tc > &members)
Primary constructor.
Definition irep2_expr.h:559
static constexpr auto fields
Definition irep2_expr.h:568
static std::string field_names[esbmct::num_type_fields]
Definition irep2_expr.h:758
constant_array_of2t(const constant_array_of2t &ref)=default
expr2tc initializer
Definition irep2_expr.h:604
static std::string field_names[esbmct::num_type_fields]
Definition irep2_expr.h:760
constant_array_of2t(const type2tc &type, const expr2tc &init)
Primary constructor.
Definition irep2_expr.h:610
static constexpr auto fields
Definition irep2_expr.h:616
constant_bool2t(bool value)
Primary constructor.
Definition irep2_expr.h:379
static std::string field_names[esbmct::num_type_fields]
Definition irep2_expr.h:756
static constexpr auto fields
Definition irep2_expr.h:390
constant_bool2t(const constant_bool2t &ref)=default
bool value
Definition irep2_expr.h:376
bool is_false() const
Return whether contained boolean is false.
Definition irep2_expr.cpp:123
bool is_true() const
Return whether contained boolean is true.
Definition irep2_expr.cpp:118
constant_fixedbv2t(const constant_fixedbv2t &ref)=default
static std::string field_names[esbmct::num_type_fields]
Definition irep2_expr.h:748
static constexpr auto fields
Definition irep2_expr.h:336
constant_fixedbv2t(const fixedbvt &value)
Primary constructor.
Definition irep2_expr.h:330
fixedbvt value
Definition irep2_expr.h:325
constant_floatbv2t(const constant_floatbv2t &ref)=default
static constexpr std::size_t excluded_field_bytes
Definition irep2_expr.h:366
constant_floatbv2t(const ieee_floatt &value, const irep_idt &fmt=irep_idt())
Primary constructor.
Definition irep2_expr.h:356
ieee_floatt value
Definition irep2_expr.h:347
static constexpr auto fields
Definition irep2_expr.h:364
static std::string field_names[esbmct::num_type_fields]
Definition irep2_expr.h:750
irep_idt cformat
The literal's source spelling; see constant_int2t::cformat.
Definition irep2_expr.h:351
unsigned long as_ulong() const
Accessor for fetching machine-word unsigned integer of this constant.
Definition irep2_expr.cpp:99
constant_int2t(const constant_int2t &ref)=default
static std::string field_names[esbmct::num_type_fields]
Definition irep2_expr.h:746
BigInt value
Definition irep2_expr.h:285
constant_int2t(const type2tc &type, const BigInt &input, const irep_idt &fmt=irep_idt())
Primary constructor.
Definition irep2_expr.h:298
irep_idt cformat
How the literal was written in the source, as #cformat records it.
Definition irep2_expr.h:292
long as_long() const
Accessor for fetching machine-word integer of this constant.
Definition irep2_expr.cpp:109
static constexpr auto fields
Definition irep2_expr.h:312
static constexpr std::size_t excluded_field_bytes
Definition irep2_expr.h:314
constant_string2t(const constant_string2t &ref)=default
constant_string2t(const type2tc &type, const irep_idt &stringref, constant_string_kindt kind)
Primary constructor.
Definition irep2_expr.h:414
irep_idt value
Definition irep2_expr.h:403
constant_string_kindt kind
Definition irep2_expr.h:404
static constexpr auto fields
Definition irep2_expr.h:423
static std::string field_names[esbmct::num_type_fields]
Definition irep2_expr.h:762
constant_string_kindt kindt
Definition irep2_expr.h:401
size_t array_size() const
sizeof(literal)/sizeof(*literal), i.e., the number of elements in the underlying array,...
Definition irep2_expr.cpp:285
expr2tc to_array() const
Convert string to a constant length array of characters.
Definition irep2_expr.cpp:273
expr2tc at(size_t i) const
Extract the i-th element from the string for i between 0 and to_array_type(this->type)....
Definition irep2_expr.cpp:290
static std::string field_names[esbmct::num_type_fields]
Definition irep2_expr.h:752
expr2tc do_simplify() const override
expr-specific simplification methods.
Definition expr_simplifier.cpp:6552
constant_struct2t(const constant_struct2t &ref)=default
static constexpr auto fields
Definition irep2_expr.h:487
constant_struct2t(const type2tc &type, const std::vector< expr2tc > &members)
Primary constructor.
Definition irep2_expr.h:461
std::vector< expr2tc > datatype_members
Definition irep2_expr.h:455
static std::string field_names[esbmct::num_type_fields]
Definition irep2_expr.h:754
constant_union2t(const type2tc &type, irep_idt if_, const std::vector< expr2tc > &members)
Primary constructor.
Definition irep2_expr.h:514
static constexpr auto fields
Definition irep2_expr.h:538
irep_idt init_field
Definition irep2_expr.h:508
std::vector< expr2tc > datatype_members
Definition irep2_expr.h:507
constant_union2t(const constant_union2t &ref)=default
static constexpr auto fields
Definition irep2_expr.h:592
static std::string field_names[esbmct::num_type_fields]
Definition irep2_expr.h:764
constant_vector2t(const constant_vector2t &ref)=default
std::vector< expr2tc > datatype_members
Definition irep2_expr.h:580
constant_vector2t(const type2tc &type, const std::vector< expr2tc > &members)
Primary constructor.
Definition irep2_expr.h:586
dereference2t(const dereference2t &ref)=default
static constexpr auto fields
Definition irep2_expr.h:1889
expr2tc value
Definition irep2_expr.h:1878
static std::string field_names[esbmct::num_type_fields]
Definition irep2_expr.h:882
dereference2t(const type2tc &type, const expr2tc &operand)
Primary constructor.
Definition irep2_expr.h:1883
dynamic_object2t(const dynamic_object2t &ref)=default
bool invalid
Definition irep2_expr.h:1846
dynamic_object2t(const type2tc &type, const expr2tc &inst, bool inv, bool uknown)
Definition irep2_expr.h:1849
static constexpr auto fields
Definition irep2_expr.h:1862
expr2tc instance
Definition irep2_expr.h:1845
bool unknown
Definition irep2_expr.h:1847
static std::string field_names[esbmct::num_type_fields]
Definition irep2_expr.h:880
expr2tc side_1
Definition irep2_expr.h:250
exists2t(const exists2t &ref)=default
exists2t(const type2tc &type, const expr2tc &sym, const expr2tc &predicate)
Definition irep2_expr.h:251
static constexpr auto fields
Definition irep2_expr.h:257
expr2tc side_2
Definition irep2_expr.h:250
static std::string field_names[esbmct::num_type_fields]
Definition irep2_expr.h:982
expr2t(const type2tc &type, expr_ids id)
Primary constructor.
Definition irep2_expr.cpp:49
expr_ids
Enumeration identifying each sort of expr.
Definition irep2.h:730
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
unsigned int lower
Definition irep2_expr.h:2720
static std::string field_names[esbmct::num_type_fields]
Definition irep2_expr.h:974
static constexpr auto fields
Definition irep2_expr.h:2734
extract2t(const extract2t &ref)=default
extract2t(const type2tc &type, const expr2tc &from_, unsigned int upper_, unsigned int lower_)
Definition irep2_expr.h:2722
unsigned int upper
Definition irep2_expr.h:2719
expr2tc from
Definition irep2_expr.h:2718
expr2tc do_simplify() const override
expr-specific simplification methods.
Definition expr_simplifier.cpp:5784
Definition fixedbv.h:38
forall2t(const type2tc &type, const expr2tc &sym, const expr2tc &predicate)
Definition irep2_expr.h:266
static std::string field_names[esbmct::num_type_fields]
Definition irep2_expr.h:980
static constexpr auto fields
Definition irep2_expr.h:272
forall2t(const forall2t &ref)=default
expr2tc side_2
Definition irep2_expr.h:265
expr2tc side_1
Definition irep2_expr.h:265
Definition ieee_float.h:75
static constexpr auto fields
Definition irep2_expr.h:1357
expr2tc do_simplify() const override
expr-specific simplification methods.
Definition expr_simplifier.cpp:6469
ieee_fma2t(const ieee_fma2t &ref)=default
ieee_fma2t(const type2tc &type, const expr2tc &v1, const expr2tc &v2, const expr2tc &v3, const expr2tc &rm)
Primary constructor.
Definition irep2_expr.h:1340
expr2tc value_3
Definition irep2_expr.h:1332
static std::string field_names[esbmct::num_type_fields]
Definition irep2_expr.h:832
expr2tc value_1
Definition irep2_expr.h:1330
expr2tc rounding_mode
Definition irep2_expr.h:1329
expr2tc value_2
Definition irep2_expr.h:1331
ieee_sqrt2t(const type2tc &type, const expr2tc &v1, const expr2tc &rm)
Primary constructor.
Definition irep2_expr.h:1378
expr2tc value
Definition irep2_expr.h:1372
static std::string field_names[esbmct::num_type_fields]
Definition irep2_expr.h:834
expr2tc do_simplify() const override
expr-specific simplification methods.
Definition expr_simplifier.cpp:6527
expr2tc rounding_mode
Definition irep2_expr.h:1371
static constexpr auto fields
Definition irep2_expr.h:1386
ieee_sqrt2t(const ieee_sqrt2t &ref)=default
expr2tc do_simplify() const override
expr-specific simplification methods.
Definition expr_simplifier.cpp:5179
expr2tc true_value
Definition irep2_expr.h:845
expr2tc false_value
Definition irep2_expr.h:846
static constexpr auto fields
Definition irep2_expr.h:877
static constexpr std::size_t excluded_field_bytes
Definition irep2_expr.h:849
if2t(const type2tc &type, const expr2tc &cond_, const expr2tc &trueval, const expr2tc &falseval, const locationt &loc=locationt())
Primary constructor.
Definition irep2_expr.h:858
expr2tc cond
Definition irep2_expr.h:844
locationt location
Definition irep2_expr.h:848
if2t(const if2t &ref)=default
index2t(const type2tc &type, const expr2tc &source, const expr2tc &idx)
Primary constructor.
Definition irep2_expr.h:1742
static constexpr auto fields
Definition irep2_expr.h:1760
expr2tc do_simplify() const override
expr-specific simplification methods.
Definition expr_simplifier.cpp:2069
index2t(const index2t &ref)=default
expr2tc source_value
Definition irep2_expr.h:1735
expr2tc index
Definition irep2_expr.h:1736
static std::string field_names[esbmct::num_type_fields]
Definition irep2_expr.h:864
invalid_pointer2t(const expr2tc &obj)
Definition irep2_expr.h:2595
static std::string field_names[esbmct::num_type_fields]
Definition irep2_expr.h:948
invalid_pointer2t(const invalid_pointer2t &ref)=default
static constexpr auto fields
Definition irep2_expr.h:2601
expr2tc ptr_obj
Definition irep2_expr.h:2593
Definition irep_idt.h:12
Definition location.h:7
static constexpr auto fields
Definition irep2_expr.h:1680
expr2tc do_simplify() const override
expr-specific simplification methods.
Definition expr_simplifier.cpp:1661
static std::string field_names[esbmct::num_type_fields]
Definition irep2_expr.h:858
expr2tc source_value
Definition irep2_expr.h:1620
irep_idt member
Definition irep2_expr.h:1621
member2t(const member2t &ref)=default
member2t(const type2tc &type, const expr2tc &source, const irep_idt &memb)
Primary constructor.
Definition irep2_expr.h:1627
static std::string field_names[esbmct::num_type_fields]
Definition irep2_expr.h:860
static constexpr auto fields
Definition irep2_expr.h:1701
member_ref2t(const member_ref2t &ref)=default
member_ref2t(const type2tc &type, const irep_idt &memb)
Primary constructor.
Definition irep2_expr.h:1695
irep_idt member
Definition irep2_expr.h:1690
nearbyint2t(const nearbyint2t &ref)=default
nearbyint2t(const type2tc &type, const expr2tc &from_)
Primary constructor.
Definition irep2_expr.h:706
nearbyint2t(const type2tc &type, const expr2tc &from_, const expr2tc &rounding_mode_)
Primary constructor.
Definition irep2_expr.h:693
expr2tc do_simplify() const override
expr-specific simplification methods.
Definition expr_simplifier.cpp:3791
expr2tc rounding_mode
Definition irep2_expr.h:686
expr2tc from
Definition irep2_expr.h:685
static constexpr auto fields
Definition irep2_expr.h:717
static std::string field_names[esbmct::num_type_fields]
Definition irep2_expr.h:772
new_object2t(const type2tc &type)
Definition irep2_expr.h:2081
expr2tc do_simplify() const override
expr-specific simplification methods.
new_object2t(const new_object2t &ref)=default
static std::string field_names[esbmct::num_type_fields]
Definition irep2_expr.h:910
static constexpr auto fields
Definition irep2_expr.h:2087
expr2tc value
Definition irep2_expr.h:1272
not2t(const not2t &ref)=default
static constexpr auto fields
Definition irep2_expr.h:1282
not2t(const expr2tc &val)
Primary constructor.
Definition irep2_expr.h:1275
expr2tc do_simplify() const override
expr-specific simplification methods.
Definition expr_simplifier.cpp:2146
static std::string field_names[esbmct::num_type_fields]
Definition irep2_expr.h:790
expr2tc offset
Definition irep2_expr.h:2148
const expr2tc & get_root_object() const
Definition irep2_expr.cpp:364
expr2tc object
Definition irep2_expr.h:2147
static std::string field_names[esbmct::num_type_fields]
Definition irep2_expr.h:918
object_descriptor2t(const object_descriptor2t &ref)=default
object_descriptor2t(const type2tc &t, const expr2tc &root, const expr2tc &offs, unsigned int align)
Definition irep2_expr.h:2151
static constexpr auto fields
Definition irep2_expr.h:2166
unsigned int alignment
Definition irep2_expr.h:2149
overflow2t(const expr2tc &operand_)
Primary constructor.
Definition irep2_expr.h:1779
static constexpr auto fields
Definition irep2_expr.h:1787
expr2tc operand
Definition irep2_expr.h:1774
static std::string field_names[esbmct::num_type_fields]
Definition irep2_expr.h:868
overflow2t(const overflow2t &ref)=default
expr2tc do_simplify() const override
expr-specific simplification methods.
Definition expr_simplifier.cpp:5469
static std::string field_names[esbmct::num_type_fields]
Definition irep2_expr.h:870
expr2tc do_simplify() const override
expr-specific simplification methods.
Definition expr_simplifier.cpp:5436
overflow_cast2t(const expr2tc &operand_, unsigned int bits_)
Primary constructor.
Definition irep2_expr.h:1804
overflow_cast2t(const overflow_cast2t &ref)=default
unsigned int bits
Definition irep2_expr.h:1799
static constexpr auto fields
Definition irep2_expr.h:1812
expr2tc operand
Definition irep2_expr.h:1798
static std::string field_names[esbmct::num_type_fields]
Definition irep2_expr.h:872
static constexpr auto fields
Definition irep2_expr.h:1834
overflow_neg2t(const expr2tc &operand_)
Primary constructor.
Definition irep2_expr.h:1828
overflow_neg2t(const overflow_neg2t &ref)=default
expr2tc operand
Definition irep2_expr.h:1825
pointer_offset2t(const pointer_offset2t &ref)=default
pointer_offset2t(const type2tc &type, const expr2tc &ptrobj)
Primary constructor.
Definition irep2_expr.h:1429
expr2tc ptr_obj
Definition irep2_expr.h:1424
static std::string field_names[esbmct::num_type_fields]
Definition irep2_expr.h:844
static constexpr auto fields
Definition irep2_expr.h:1439
expr2tc do_simplify() const override
expr-specific simplification methods.
Definition expr_simplifier.cpp:1800
static std::string field_names[esbmct::num_type_fields]
Definition irep2_expr.h:862
ptr_mem2t(const ptr_mem2t &ref)=default
expr2tc member_pointer
Definition irep2_expr.h:1712
ptr_mem2t(const type2tc &type, const expr2tc &source, const expr2tc &pointer)
Primary constructor.
Definition irep2_expr.h:1717
static constexpr auto fields
Definition irep2_expr.h:1723
expr2tc source_value
Definition irep2_expr.h:1711
expr2tc side_2
Definition irep2_expr.h:1400
same_object2t(const same_object2t &ref)=default
expr2tc side_1
Definition irep2_expr.h:1399
static std::string field_names[esbmct::num_type_fields]
Definition irep2_expr.h:842
same_object2t(const expr2tc &v1, const expr2tc &v2)
Primary constructor.
Definition irep2_expr.h:1403
expr2tc do_simplify() const override
expr-specific simplification methods.
Definition expr_simplifier.cpp:5616
static constexpr auto fields
Definition irep2_expr.h:1411
static constexpr std::size_t excluded_field_bytes
Definition irep2_expr.h:1933
expr2tc operand
Definition irep2_expr.h:1910
sideeffect_allockind kind
Definition irep2_expr.h:1914
sideeffect2t(const sideeffect2t &ref)=default
sideeffect2t(const type2tc &t, const expr2tc &oper, const expr2tc &sz, const std::vector< expr2tc > &a, const type2tc &alloct, sideeffect_allockind k, const locationt &loc=locationt(), bool ctor=false)
Primary constructor.
Definition irep2_expr.h:1945
sideeffect_allockind allockind
Definition irep2_expr.h:1908
type2tc alloctype
Definition irep2_expr.h:1913
static std::string field_names[esbmct::num_type_fields]
Definition irep2_expr.h:892
static constexpr auto fields
Definition irep2_expr.h:1968
std::vector< expr2tc > arguments
Definition irep2_expr.h:1912
locationt location
Definition irep2_expr.h:1932
expr2tc size
Definition irep2_expr.h:1911
bool constructor
This call constructs an object.
Definition irep2_expr.h:1930
expr2tc rhs
Definition irep2_expr.h:2542
expr2tc lhs
Definition irep2_expr.h:2541
sideeffect_assign2t(const type2tc &t, const irep_idt &o, const expr2tc &l, const expr2tc &r, const locationt &loc=locationt(), bool member_init_=false)
Definition irep2_expr.h:2546
irep_idt op
Definition irep2_expr.h:2521
static constexpr std::size_t excluded_field_bytes
Definition irep2_expr.h:2544
locationt location
Definition irep2_expr.h:2543
sideeffect_assign2t(const sideeffect_assign2t &ref)=default
bool member_init
This assignment is a constructor's member initialiser.
Definition irep2_expr.h:2539
static constexpr auto fields
Definition irep2_expr.h:2563
static std::string field_names[esbmct::num_type_fields]
Definition irep2_expr.h:944
sizeof2t(const type2tc &type, const expr2tc &val, const type2tc &sizeof_t)
Definition irep2_expr.h:2762
static constexpr auto fields
Definition irep2_expr.h:2770
type2tc sizeof_type
Definition irep2_expr.h:2760
expr2tc value
Definition irep2_expr.h:2759
static std::string field_names[esbmct::num_type_fields]
Definition irep2_expr.h:990
expr2tc do_simplify() const override
expr-specific simplification methods.
Definition expr_simplifier.cpp:5846
sizeof2t(const sizeof2t &ref)=default
symbol_renaming_level renaming_level
Definition irep2_expr.h:627
static std::string field_names[esbmct::num_type_fields]
Definition irep2_expr.h:766
unsigned int thread_num
Definition irep2_expr.h:633
unsigned int level2_num
Definition irep2_expr.h:632
symbol2t(const type2tc &type, const irep_idt &init, renaming_level lev=renaming_level::level0, unsigned int l1=0, unsigned int l2=0, unsigned int trd=0, unsigned int node=0)
Primary constructor.
Definition irep2_expr.h:640
symbol2t(const symbol2t &ref)=default
static constexpr auto fields
Definition irep2_expr.h:667
unsigned int level1_num
Definition irep2_expr.h:631
irep_idt thename
Definition irep2_expr.h:629
symbol_renaming_level rlevel
Definition irep2_expr.h:630
unsigned int node_num
Definition irep2_expr.h:634
std::string get_symbol_name() const
Definition irep2_expr.cpp:128
Definition symbol_id.h:6
Symbolic type exception class.
Definition irep2.h:572
unsigned int get_width() const
Fetch bit width of this type.
Definition irep2_type.cpp:352
const type_ids type_id
Instance of type_ids recording this types type.
Definition irep2.h:693
bool base_to_derived
The mirror: a downcast whose operand points at a base subobject.
Definition irep2_expr.h:744
typecast2t(const typecast2t &ref)=default
expr2tc from
Definition irep2_expr.h:731
expr2tc rounding_mode
Definition irep2_expr.h:732
static constexpr auto fields
Definition irep2_expr.h:786
expr2tc do_simplify() const override
expr-specific simplification methods.
Definition expr_simplifier.cpp:3701
typecast2t(const type2tc &type, const expr2tc &from_, const expr2tc &rounding_mode_, const irep_idt &derived_to_base_=irep_idt(), bool base_to_derived_=false)
Primary constructor.
Definition irep2_expr.h:751
irep_idt derived_to_base
The base class this cast converts to, when the frontend could not route the conversion through a @bas...
Definition irep2_expr.h:741
uninterpreted_func2t(const uninterpreted_func2t &ref)=default
uninterpreted_func2t(const type2tc &type, const irep_idt &name, const std::vector< expr2tc > &args)
Definition irep2_expr.h:2110
irep_idt function_name
Mangled callee name; the stable key under which the solver declares the function symbol,...
Definition irep2_expr.h:2107
static constexpr auto fields
Definition irep2_expr.h:2119
std::vector< expr2tc > arguments
Definition irep2_expr.h:2108
static std::string field_names[esbmct::num_type_fields]
Definition irep2_expr.h:912
Definition toml.hpp:1531
static std::string field_names[esbmct::num_type_fields]
Definition irep2_expr.h:856
expr2tc source_value
Definition irep2_expr.h:1580
expr2tc update_value
Definition irep2_expr.h:1582
expr2tc update_field
Definition irep2_expr.h:1581
expr2tc do_simplify() const override
expr-specific simplification methods.
Definition expr_simplifier.cpp:1471
with2t(const type2tc &type, const expr2tc &source, const expr2tc &field, const expr2tc &value)
Primary constructor.
Definition irep2_expr.h:1589
static constexpr auto fields
Definition irep2_expr.h:1607
with2t(const with2t &ref)=default
configt config
Definition config.cpp:8
@ unknown
Definition config.h:14
pthread_cond_t cond
Definition cuda.h:50
static bool same_object(const expr2tc &a, const expr2tc &b)
Definition gcse.cpp:330
void dereference(goto_programt::const_targett target, expr2tc &expr, const namespacet &ns, value_setst &value_sets)
Definition goto_program_dereference.cpp:239
irep_container< type2t > type2tc
Definition irep2.h:430
irep_container< expr2t > expr2tc
Definition irep2.h:431
printf_kindt
Which member of the printf family a code_printf2t represents.
Definition irep2_expr.h:98
@ VPRINTF
Definition irep2_expr.h:105
@ ASPRINTF
Definition irep2_expr.h:108
@ SPRINTF
Definition irep2_expr.h:102
@ SNPRINTF
Definition irep2_expr.h:104
@ DPRINTF
Definition irep2_expr.h:101
@ FPRINTF
Definition irep2_expr.h:100
@ PRINTF
Definition irep2_expr.h:99
@ VFPRINTF
Definition irep2_expr.h:103
@ VASPRINTF
Definition irep2_expr.h:109
@ VSPRINTF
Definition irep2_expr.h:106
@ VSNPRINTF
Definition irep2_expr.h:107
constant_string_kindt
Definition irep2_expr.h:27
@ DEFAULT
Definition irep2_expr.h:28
@ UNICODE
Definition irep2_expr.h:30
@ WIDE
Definition irep2_expr.h:29
#define ESBMC_DEFINE_FP_PREDICATE_1OP(name)
FP classification single-operand predicate (isnan/isinf/ isnormal/isfinite).
Definition irep2_expr.h:1043
#define ESBMC_DEFINE_OBJECT_PREDICATE_1OP(name)
Pointer-object boolean predicate (valid_object/races_check/ deallocated_obj).
Definition irep2_expr.h:1066
#define ESBMC_DEFINE_TYPE_ONLY(name)
Marker node holding only a type (no operands).
Definition irep2_expr.h:1132
#define ESBMC_DEFINE_ARITH_2OP(name)
Arithmetic two-operand node (add/sub/mul/div/modulus).
Definition irep2_expr.h:919
#define ESBMC_DEFINE_BIT_2OP(name)
Bitwise / shift two-operand node (bitand/bitor/bitxor/ shl/ashr/lshr).
Definition irep2_expr.h:945
#define ESBMC_DEFINE_CODE_EXPRESSION_1OP(name)
code_* statement with empty type and a single expr2tc operand (code_expression/code_return/code_free/...
Definition irep2_expr.h:1153
#define ESBMC_DEFINE_OVERFLOW_INT32_1OP(name)
Single-operand overflow-family op returning int32 (signbit/ popcount).
Definition irep2_expr.h:1110
printf_kindt printf_kind_from_name(const irep_idt &name)
Maps the textual base_name of a printf-family symbol (e.g.
Definition irep2_expr.cpp:379
symbol_renaming_level
Symex renaming level for symbol2t.
Definition irep2_expr.h:54
@ level2_global
Definition irep2_expr.h:59
@ level1
Definition irep2_expr.h:56
@ level1_global
Definition irep2_expr.h:58
@ level2
Definition irep2_expr.h:57
@ level0
Definition irep2_expr.h:55
void assert_arith_2ops_consistency(const type2tc &t, expr2t::expr_ids id, const expr2tc &v1, const expr2tc &v2)
Debug-only consistency check for arith_2ops operands and result type.
Definition irep2_expr.cpp:716
#define ESBMC_DEFINE_IEEE_ARITH_2OP(name)
Defines an IEEE two-operand floating-point arithmetic node (add/sub/mul/div).
Definition irep2_expr.h:1290
#define ESBMC_DEFINE_CODE_DECL(name)
code_* declaration carrying (type, irep_idt name).
Definition irep2_expr.h:1180
#define ESBMC_DEFINE_RELATION2T(name)
Defines one of the six binary boolean relation nodes.
Definition irep2_expr.h:889
#define ESBMC_DEFINE_LOGIC_2OP(name)
Logical two-operand boolean-result node.
Definition irep2_expr.h:1016
#define ESBMC_DEFINE_OBJECT_SIZE_1OP(name)
Pointer-object size-returning op (capability_base/capability_top/ dynamic_size).
Definition irep2_expr.h:1088
sideeffect_allockind
Enumeration identifying each particular kind of side effect.
Definition irep2_expr.h:73
@ predecrement
Definition irep2_expr.h:85
@ cpp_new_arr
Definition irep2_expr.h:78
@ gcc_conditional_expression
Definition irep2_expr.h:91
@ statement_expression
Definition irep2_expr.h:89
@ old_snapshot
Definition irep2_expr.h:87
@ temporary_object
Definition irep2_expr.h:90
@ cpp_delete
Definition irep2_expr.h:92
@ printf2
Definition irep2_expr.h:81
@ cpp_new
Definition irep2_expr.h:77
@ cpp_delete_array
Definition irep2_expr.h:93
@ postdecrement
Definition irep2_expr.h:86
@ postincrement
Definition irep2_expr.h:84
@ preincrement
Definition irep2_expr.h:83
@ function_call
Definition irep2_expr.h:82
@ alloca
Definition irep2_expr.h:76
@ assigns_target
Definition irep2_expr.h:88
#define ESBMC_DEFINE_POINTER_1OP(name)
Pointer one-operand node (pointer_object/pointer_capability).
Definition irep2_expr.h:993
#define irep_typedefs(basename)
Definition irep2_expr.h:116
#define ESBMC_DEFINE_ARITH_1OP(name)
Arithmetic one-operand node (neg/abs/bswap/bitnot).
Definition irep2_expr.h:970
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
pointer_ref_kindt
How the source spelled a pointer.
Definition irep2_type.h:556
@ NONE
Definition irep2_type.h:557
literalt neg(literalt a)
Definition literal.h:126
const unsigned int num_type_fields
Maximum number of fields to support in expr2t subclasses.
Definition irep2.h:998
Definition format.h:30
Definition nondet.py:1
Definition exception.cpp:51
@ l1
Definition numpy_call_expr.cpp:2087
@ l2
Definition numpy_call_expr.cpp:2086
#define va_arg(v, l)
Definition stdarg.h:18
#define false
Definition stdbool.h:10
div_t div(int numerator, int denominator)
void * malloc(size_t size)
void * realloc(void *ptr, size_t size)
int abs(int n)
void add(int64_t *A, int64_t *B, int64_t *C, int64_t a_rows, int64_t a_cols, int64_t b_rows, int64_t b_cols)
Definition umath.c:23