24 if(expr.
id()==ID_struct && expr.
operands().size()==2)
46 if(expr.
id()==ID_typecast &&
48 expr.
type().
id()!=ID_complex)
51 if(expr.
type().
id()==ID_complex)
53 if(expr.
id()==ID_plus || expr.
id()==ID_minus ||
54 expr.
id()==ID_mult || expr.
id()==ID_div)
56 else if(expr.
id()==ID_unary_minus)
58 else if(expr.
id()==ID_complex)
60 else if(expr.
id()==ID_typecast)
64 if(expr.
id()==ID_complex_real)
66 else if(expr.
id()==ID_complex_imag)
81 if(type.
id()==ID_struct || type.
id()==ID_union)
87 else if(type.
id()==ID_pointer ||
88 type.
id()==ID_vector ||
91 else if(type.
id()==ID_complex)
105 if(expr.
id()==ID_typecast)
108 if(typecast_expr.op().type().id() == ID_complex)
110 if(typecast_expr.type().id() == ID_complex)
127 if(expr.
type().
id()==ID_complex)
129 if(expr.
id()==ID_plus || expr.
id()==ID_minus ||
130 expr.
id()==ID_mult || expr.
id()==ID_div)
156 else if(expr.
id()==ID_unary_minus)
167 struct_expr.op0().add_source_location() =
168 unary_minus_expr.source_location();
173 struct_expr.op1().add_source_location() =
174 unary_minus_expr.source_location();
178 else if(expr.
id()==ID_complex)
183 struct_expr.copy_to_operands(complex_expr.real(), complex_expr.imag());
184 expr.
swap(struct_expr);
186 else if(expr.
id()==ID_typecast)
191 if(typecast_expr.op().type().id() == ID_struct)
201 struct_expr.op0().add_source_location() =
202 typecast_expr.source_location();
207 struct_expr.op1().add_source_location() =
208 typecast_expr.source_location();
220 struct_expr.add_source_location() = typecast_expr.source_location();
227 if(expr.
id()==ID_complex_real)
231 else if(expr.
id()==ID_complex_imag)
245 if(type.
id()==ID_struct || type.
id()==ID_union)
249 for(struct_union_typet::componentst::iterator
257 else if(type.
id()==ID_pointer ||
258 type.
id()==ID_vector ||
263 else if(type.
id()==ID_complex)
271 struct_type.components().resize(2);
272 struct_type.components()[0].type()=type.
subtype();
273 struct_type.components()[0].set_name(ID_real);
274 struct_type.components()[1].type()=type.
subtype();
275 struct_type.components()[1].set_name(ID_imag);
291 for(
const auto &named_symbol : symbol_table.
symbols)
The type of an expression, extends irept.
Semantic type conversion.
Remove the 'complex' data type by compilation into structs.
exprt value
Initial value of symbol.
const componentst & components() const
static exprt complex_member(const exprt &expr, irep_idt id)
const complex_imag_exprt & to_complex_imag_expr(const exprt &expr)
Cast an exprt to a complex_imag_exprt.
typet & type()
Return the type of the expression.
symbol_tablet symbol_table
Symbol table.
Structure type, corresponds to C style structs.
Extract member of struct or union.
virtual symbolt * get_writeable(const irep_idt &name) override
Find a symbol in the symbol table for read-write access.
const irep_idt & id() const
A base class for binary expressions.
Real part of the expression describing a complex number.
const exprt & op1() const =delete
API to expression classes.
::goto_functiont goto_functiont
#define PRECONDITION(CONDITION)
#define forall_operands(it, expr)
A collection of goto functions.
const struct_typet & to_struct_type(const typet &type)
Cast a typet to a struct_typet.
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
The unary minus expression.
const source_locationt & source_location() const
typet type
Type of symbol.
Base type for structs and unions.
Base class for all expressions.
const struct_union_typet & to_struct_union_type(const typet &type)
Cast a typet to a struct_union_typet.
const complex_exprt & to_complex_expr(const exprt &expr)
Cast an exprt to a complex_exprt.
source_locationt & add_source_location()
#define Forall_goto_functions(it, functions)
const source_locationt & source_location() const
#define UNREACHABLE
This should be used to mark dead code.
const typecast_exprt & to_typecast_expr(const exprt &expr)
Cast an exprt to a typecast_exprt.
static bool have_to_remove_complex(const typet &type)
#define Forall_operands(it, expr)
source_locationt & add_source_location()
#define Forall_goto_program_instructions(it, program)
static void remove_complex(typet &)
removes complex data type
const typet & subtype() const
Struct constructor from list of elements.
const complex_real_exprt & to_complex_real_expr(const exprt &expr)
Cast an exprt to a complex_real_exprt.
goto_functionst goto_functions
GOTO functions.
const unary_minus_exprt & to_unary_minus_expr(const exprt &expr)
Cast an exprt to a unary_minus_exprt.