Go to the documentation of this file.
24 if(
auto member = expr_try_dynamic_cast<member_exprt>(expr))
27 <<
".." << member->get_component_name();
29 if(
auto index = expr_try_dynamic_cast<index_exprt>(expr))
34 if(
auto symbol = expr_try_dynamic_cast<symbol_exprt>(expr))
35 return os << symbol->get_identifier();
42 set(ID_C_SSA_symbol,
true);
43 add(ID_expression, expr);
44 std::ostringstream os;
46 const std::string
id = os.str();
48 set(ID_L1_object_identifier,
id);
55 static void build_ssa_identifier_rec(
61 std::ostream &l1_object_os)
63 if(expr.
id()==ID_member)
67 build_ssa_identifier_rec(member.
struct_op(), l0, l1, l2, os, l1_object_os);
72 else if(expr.
id()==ID_index)
76 build_ssa_identifier_rec(index.
array(), l0, l1, l2, os, l1_object_os);
79 os <<
"[[" << idx <<
"]]";
80 l1_object_os <<
"[[" << idx <<
"]]";
82 else if(expr.
id()==ID_symbol)
86 l1_object_os << symid;
92 l1_object_os <<
'!' << l0;
99 l1_object_os <<
'@' << l1;
112 static std::pair<irep_idt, irep_idt> build_identifier(
118 std::ostringstream oss;
119 std::ostringstream l1_object_oss;
121 build_ssa_identifier_rec(expr, l0, l1, l2, oss, l1_object_oss);
126 static void update_identifier(
ssa_exprt &ssa)
134 ssa.
set(ID_L1_object_identifier, idpair.second);
140 add(ID_expression, std::move(expr));
141 ::update_identifier(*
this);
148 if(original_expr.
id() == ID_symbol)
161 root.set(ID_L0,
get(ID_L0));
163 root.set(ID_L1,
get(ID_L1));
164 ::update_identifier(root);
176 return get(ID_L1_object_identifier);
183 ::update_identifier(*
this);
189 ::update_identifier(*
this);
195 ::update_identifier(*
this);
208 if(expr.
id() == ID_symbol)
210 else if(expr.
id() == ID_member)
212 else if(expr.
id() == ID_index)
#define UNREACHABLE
This should be used to mark dead code.
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
void set_level_0(std::size_t i)
const irep_idt get_level_0() const
const index_exprt & to_index_expr(const exprt &expr)
Cast an exprt to an index_exprt.
Split an expression into a base object and a (byte) offset.
Base class for all expressions.
irep_idt get_object_name() const
const exprt & root_object() const
Expression to hold a symbol (variable)
const exprt & get_original_expr() const
void set_level_1(std::size_t i)
const irep_idt & get(const irep_idt &name) const
Expression providing an SSA-renamed symbol of expressions.
typet & type()
Return the type of the expression.
const T & as_const(T &value)
Return a reference to the same object but ensures the type is const.
static bool can_build_identifier(const exprt &src)
Used to determine whether or not an identifier can be built before trying and getting an exception.
ssa_exprt(const exprt &expr)
Constructor.
void set(const irep_idt &name, const irep_idt &value)
const exprt & struct_op() const
const irep_idt & get_identifier() const
const ssa_exprt get_l1_object() const
void set_expression(exprt expr)
Replace the underlying, original expression by expr while maintaining SSA indices.
const irep_idt get_level_2() const
const symbol_exprt & to_symbol_expr(const exprt &expr)
Cast an exprt to a symbol_exprt.
const irep_idt & id() const
Extract member of struct or union.
irept & add(const irep_idt &name)
const irep_idt get_l1_object_identifier() const
void set_level_2(std::size_t i)
ssa_exprt remove_level_2(ssa_exprt ssa)
const irep_idt get_level_1() const
static std::ostream & initialize_ssa_identifier(std::ostream &os, const exprt &expr)
If expr is:
const member_exprt & to_member_expr(const exprt &expr)
Cast an exprt to a member_exprt.
irep_idt get_component_name() const
void remove(const irep_idt &name)
const irep_idt & get_value() const
void set_identifier(const irep_idt &identifier)
const constant_exprt & to_constant_expr(const exprt &expr)
Cast an exprt to a constant_exprt.