ESBMC
Efficient SMT-based Context-Bounded Model Checker
Loading...
Searching...
No Matches
esbmct Namespace Reference

Containers and field-walking infrastructure for irep2 nodes. More...

Classes

class  function_ref
 Type-erased callable reference: non-owning, two pointers wide, no heap allocation. More...
class  function_ref< R(Args...)>
struct  member_traits
struct  member_traits< M C::* >
struct  member_traits< const M C::* >
struct  kind_excluded_field_bytes
struct  kind_excluded_field_bytes< K, std::void_t< decltype(K::excluded_field_bytes)> >

Functions

const std::string & abstract_cpp_includes ()
void register_bundled_cpp ()
 Registers the bundled C++ operational models with file_operations.
template<class T>
void hash_combine (std::size_t &seed, const T &v)
 Mix a value into a running hash seed.
template<class K, std::size_t I>
constexpr std::size_t nth_field_size_in_derived ()
template<class K, std::size_t... Is>
constexpr std::size_t sum_derived_field_sizes (std::index_sequence< Is... >)
template<class K, std::size_t... Is>
constexpr std::size_t count_derived_field_entries (std::index_sequence< Is... >)
template<class K>
constexpr bool fields_cover_class ()
template<class K>
constexpr std::size_t derived_field_count ()
template<class K>
constexpr bool assert_kind_invariants ()
template<class K>
bool generic_cmp (const K &a, const expr2t &o)
template<class K>
int generic_lt (const K &a, const expr2t &o)
template<class K>
list_of_memberst generic_tostring (const K &a, unsigned int indent)
template<class K>
const expr2tc * generic_get_sub_expr (const K &a, size_t idx)
template<class K>
size_t generic_get_num_sub_exprs (const K &a)
template<class K>
void generic_foreach_operand_impl_const (const K &a, expr2t::const_op_delegate &f)
template<class K>
void generic_foreach_operand_impl (K &a, expr2t::op_delegate &f)
template<class K>
bool generic_cmp_type (const K &a, const type2t &o)
template<class K>
int generic_lt_type (const K &a, const type2t &o)
template<class K>
list_of_memberst generic_tostring_type (const K &a, unsigned int indent)
template<class K>
void generic_foreach_subtype_const (const K &a, type2t::const_subtype_delegate &f)
template<class K>
void generic_foreach_subtype (K &a, type2t::subtype_delegate &f)

Variables

const unsigned int num_type_fields = 6
 Maximum number of fields to support in expr2t subclasses.

Detailed Description

Containers and field-walking infrastructure for irep2 nodes.

Each concrete kind (e.g. add2t, if2t, array_type2t) inherits directly from expr2t / type2t and carries:

static constexpr auto fields = std::make_tuple(&Kind::field1, ...); static std::string field_names[num_type_fields];

The generic_*<K> helpers in irep2_dispatch.h walk that tuple via std::apply to implement clone/cmp/lt/crc/hash/tostring and operand iteration. The switch-on-id dispatchers on expr2t / type2t select the right K per kind from the X-macro manifests (expr_kinds.inc, type_kinds.inc).

Each kind also has a container alias <kind>2tc (alias for irep_container<expr2t> / irep_container<type2t>) and a factory <kind>2tc(args...) that wraps make_irep<T>(args...). Containers behave like value types via copy-on-write: const access shares the pointee, non-const get() / operator-> / operator* calls detach() first (clones into a fresh refcount=1 object when shared).

Identification and downcasting helpers is_<kind>2t(expr), to_<kind>2t(expr), try_to_<kind>2t(expr) are macro-generated by irep2_expr.h / irep2_type.h from the same manifests. to_* throws irep2_cast_error on a kind mismatch; try_to_* returns nullptr. The non-const downcast goes through the non-const container accessor, so it triggers detach automatically.

Function Documentation

◆ abstract_cpp_includes()

const std::string & esbmct::abstract_cpp_includes ( )

◆ assert_kind_invariants()

template<class K>
bool esbmct::assert_kind_invariants ( )
constexpr

◆ count_derived_field_entries()

template<class K, std::size_t... Is>
std::size_t esbmct::count_derived_field_entries ( std::index_sequence< Is... > )
constexpr

◆ derived_field_count()

template<class K>
std::size_t esbmct::derived_field_count ( )
constexpr

◆ fields_cover_class()

template<class K>
bool esbmct::fields_cover_class ( )
constexpr

◆ generic_cmp()

template<class K>
bool esbmct::generic_cmp ( const K & a,
const expr2t & o )

◆ generic_cmp_type()

template<class K>
bool esbmct::generic_cmp_type ( const K & a,
const type2t & o )

◆ generic_foreach_operand_impl()

template<class K>
void esbmct::generic_foreach_operand_impl ( K & a,
expr2t::op_delegate & f )

◆ generic_foreach_operand_impl_const()

template<class K>
void esbmct::generic_foreach_operand_impl_const ( const K & a,
expr2t::const_op_delegate & f )

◆ generic_foreach_subtype()

template<class K>
void esbmct::generic_foreach_subtype ( K & a,
type2t::subtype_delegate & f )

◆ generic_foreach_subtype_const()

template<class K>
void esbmct::generic_foreach_subtype_const ( const K & a,
type2t::const_subtype_delegate & f )

◆ generic_get_num_sub_exprs()

template<class K>
size_t esbmct::generic_get_num_sub_exprs ( const K & a)

◆ generic_get_sub_expr()

template<class K>
const expr2tc * esbmct::generic_get_sub_expr ( const K & a,
size_t idx )

◆ generic_lt()

template<class K>
int esbmct::generic_lt ( const K & a,
const expr2t & o )

◆ generic_lt_type()

template<class K>
int esbmct::generic_lt_type ( const K & a,
const type2t & o )

◆ generic_tostring()

template<class K>
list_of_memberst esbmct::generic_tostring ( const K & a,
unsigned int indent )

◆ generic_tostring_type()

template<class K>
list_of_memberst esbmct::generic_tostring_type ( const K & a,
unsigned int indent )

◆ hash_combine()

template<class T>
void esbmct::hash_combine ( std::size_t & seed,
const T & v )
inline

Mix a value into a running hash seed.

Traditional golden-ratio magic + shift mix. std::hash is used as the per-type hasher. There is no std::hash_combine in the standard library (yet — see WG21 proposals); this 3-line inline helper is the stdlib-equivalent.

◆ nth_field_size_in_derived()

template<class K, std::size_t I>
std::size_t esbmct::nth_field_size_in_derived ( )
constexpr

◆ register_bundled_cpp()

void esbmct::register_bundled_cpp ( )

Registers the bundled C++ operational models with file_operations.

◆ sum_derived_field_sizes()

template<class K, std::size_t... Is>
std::size_t esbmct::sum_derived_field_sizes ( std::index_sequence< Is... > )
constexpr

Variable Documentation

◆ num_type_fields

const unsigned int esbmct::num_type_fields = 6

Maximum number of fields to support in expr2t subclasses.

This value controls the types of any arrays that need to consider the number of fields. I've yet to find a way of making this play nice with the new variardic way of defining ireps.