Go to the documentation of this file.
15 #include <unordered_set>
39 if(expr.
type().
id() == ID_array)
66 if(expr.
id() == ID_address_of)
73 else if(expr.
id() == ID_plus || expr.
id() == ID_minus)
81 "An offset must be an integral amount");
83 if(expr.
id() == ID_minus)
97 std::make_shared<offset_entryt>(offset_value), environment, ns);
105 const auto access =
stack.front()->get_access_expr();
107 !access.second && access.first.id() == ID_symbol,
108 "The base should be an addressable location (i.e. symbol)");
110 if(access.first.type().id() != ID_array)
135 if(expr.
id() == ID_member)
137 add_to_stack(std::make_shared<simple_entryt>(expr), environment, ns);
141 else if(expr.
id() == ID_symbol || expr.
id() == ID_dynamic_object)
143 add_to_stack(std::make_shared<simple_entryt>(expr), environment, ns);
145 else if(expr.
id() == ID_index)
166 environment.
eval(index_expr.
index(), ns);
168 add_to_stack(std::make_shared<offset_entryt>(offset_value), environment, ns);
180 exprt access_expr =
stack.front()->get_access_expr().first;
181 for(
auto it = std::next(
stack.begin()); it !=
stack.end(); ++it)
183 const auto access = (*it)->get_access_expr();
185 access_expr =
index_exprt{access_expr, access.first};
187 access_expr = access.first;
190 return std::move(top_expr);
207 auto const access =
stack.back()->get_access_expr();
212 if(access.first.id() == ID_member || access.first.id() == ID_symbol)
215 if(access.first.id() == ID_index)
235 std::shared_ptr<write_stack_entryt> entry_pointer,
241 !
stack.front()->try_squash_in(entry_pointer, environment, ns))
256 exprt &out_base_expr,
257 exprt &out_integral_expr)
261 static const std::unordered_set<irep_idt, irep_id_hash> integral_types = {
262 ID_signedbv, ID_unsignedbv, ID_integer};
263 if(integral_types.find(binary_e.lhs().type().id()) != integral_types.cend())
265 out_integral_expr = binary_e.lhs();
266 out_base_expr = binary_e.rhs();
270 integral_types.find(binary_e.rhs().type().id()) != integral_types.cend())
272 out_integral_expr = binary_e.rhs();
273 out_base_expr = binary_e.lhs();
bool is_top_value() const
Is the stack representing an unknown value and hence can't be written to or read from.
sharing_ptrt< class abstract_objectt > abstract_object_pointert
const index_exprt & to_index_expr(const exprt &expr)
Cast an exprt to an index_exprt.
Base class for all expressions.
const binary_exprt & to_binary_expr(const exprt &expr)
Cast an exprt to a binary_exprt.
unsignedbv_typet unsigned_long_int_type()
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
typet & type()
Return the type of the expression.
exprt target_expression(size_t depth) const
void construct_stack_to_lvalue(const exprt &expr, const abstract_environmentt &environment, const namespacet &ns)
Construct a stack up to a specific l-value (i.e.
#define PRECONDITION(CONDITION)
signedbv_typet signed_size_type()
The unary minus expression.
virtual abstract_object_pointert eval(const exprt &expr, const namespacet &ns) const
These three are really the heart of the method.
const irep_idt & id() const
void construct_stack_to_pointer(const exprt &expr, const abstract_environmentt &environment, const namespacet &ns)
Add to the stack the elements to get to a pointer.
exprt offset_expression() const
static integral_resultt get_which_side_integral(const exprt &expr, exprt &out_base_expr, exprt &out_integral_expr)
Utility function to find out which side of a binary operation has an integral type,...
void construct_stack_to_array_index(const index_exprt &expr, const abstract_environmentt &environment, const namespacet &ns)
Construct a stack for an array position l-value.
const member_exprt & to_member_expr(const exprt &expr)
Cast an exprt to a member_exprt.
const address_of_exprt & to_address_of_expr(const exprt &expr)
Cast an exprt to an address_of_exprt.
Operator to return the address of an object.
write_stackt()
Build a topstack.
void add_to_stack(std::shared_ptr< write_stack_entryt > entry_pointer, const abstract_environmentt environment, const namespacet &ns)
Add an element to the top of the stack.
exprt to_expression() const
Convert the stack to an expression that can be used to write to.
continuation_stack_storet stack