29 std::pair<cachet::iterator, bool> cache_result=
30 cache.insert(std::pair<typet, entryt>(type,
entryt()));
32 entryt &entry=cache_result.first->second;
34 if(!cache_result.second)
41 if(type_id==ID_struct)
47 entry.
members.resize(components.size());
49 for(std::size_t i=0; i<entry.
members.size(); i++)
51 std::size_t sub_width=
operator()(components[i].type());
53 entry.
members[i].width=sub_width;
59 else if(type_id==ID_union)
64 entry.
members.resize(components.size());
66 std::size_t max_width=0;
68 for(std::size_t i=0; i<entry.
members.size(); i++)
70 std::size_t sub_width=
operator()(components[i].type());
71 entry.
members[i].width=sub_width;
72 max_width=std::max(max_width, sub_width);
77 else if(type_id==ID_bool)
79 else if(type_id==ID_c_bool)
84 else if(type_id==ID_signedbv)
89 else if(type_id==ID_unsignedbv)
94 else if(type_id==ID_floatbv)
99 else if(type_id==ID_fixedbv)
104 else if(type_id==ID_bv)
109 else if(type_id==ID_verilog_signedbv ||
110 type_id==ID_verilog_unsignedbv)
116 else if(type_id==ID_range)
129 else if(type_id==ID_array)
145 throw "array too large for flattening";
150 else if(type_id==ID_vector)
166 throw "vector too large for flattening";
171 else if(type_id==ID_complex)
176 else if(type_id==ID_code)
179 else if(type_id==ID_enumeration)
186 else if(type_id==ID_c_enum)
192 else if(type_id==ID_incomplete_c_enum)
196 else if(type_id==ID_pointer ||
197 type_id==ID_reference)
201 else if(type_id==ID_symbol)
203 else if(type_id==ID_struct_tag)
205 else if(type_id==ID_union_tag)
207 else if(type_id==ID_c_enum_tag)
209 else if(type_id==ID_c_bit_field)
213 else if(type_id==ID_string)
The type of an expression.
const typet & follow(const typet &src) const
struct configt::ansi_ct ansi_c
const mp_integer string2integer(const std::string &n, unsigned base)
const union_typet & to_union_type(const typet &type)
Cast a generic typet to a union_typet.
std::vector< componentt > componentst
const componentst & components() const
const floatbv_typet & to_floatbv_type(const typet &type)
Cast a generic typet to a floatbv_typet.
const typet & follow_tag(const union_tag_typet &src) const
const irep_idt & id() const
const array_typet & to_array_type(const typet &type)
Cast a generic typet to an array_typet.
const c_bool_typet & to_c_bool_type(const typet &type)
Cast a generic typet to a c_bool_typet.
const membert & get_member(const struct_typet &type, const irep_idt &member) const
std::size_t operator()(const typet &type) const
const c_enum_tag_typet & to_c_enum_tag_type(const typet &type)
Cast a generic typet to a c_enum_tag_typet.
A constant-size array type.
const exprt & size() const
const exprt & size() const
const c_bit_field_typet & to_c_bit_field_type(const typet &type)
Cast a generic typet to a c_bit_field_typet.
const unsignedbv_typet & to_unsignedbv_type(const typet &type)
Cast a generic typet to an unsignedbv_typet.
boolbv_widtht(const namespacet &_ns)
std::vector< membert > members
const irept::subt & elements() const
std::size_t get_width() const
const struct_typet & to_struct_type(const typet &type)
Cast a generic typet to a struct_typet.
const bv_typet & to_bv_type(const typet &type)
Cast a generic typet to a bv_typet.
unsigned integer2unsigned(const mp_integer &n)
const struct_tag_typet & to_struct_tag_type(const typet &type)
Cast a generic typet to a union_tag_typet.
const fixedbv_typet & to_fixedbv_type(const typet &type)
Cast a generic typet to a fixedbv_typet.
const union_tag_typet & to_union_tag_type(const typet &type)
Cast a generic typet to a union_tag_typet.
std::size_t component_number(const irep_idt &component_name) const
const signedbv_typet & to_signedbv_type(const typet &type)
Cast a generic typet to a signedbv_typet.
const std::string & get_string(const irep_namet &name) const
unsigned int get_unsigned_int(const irep_namet &name) const
const typet & subtype() const
const vector_typet & to_vector_type(const typet &type)
Cast a generic typet to a vector_typet.
const enumeration_typet & to_enumeration_type(const typet &type)
Cast a generic typet to a enumeration_typet.
const entryt & get_entry(const typet &type) const