23 #include <unordered_set>
40 if(expr.
type().
id() == ID_array)
67 if(expr.
id() == ID_address_of)
74 else if(expr.
id() == ID_plus || expr.
id() == ID_minus)
82 "An offset must be an integral amount");
84 if(expr.
id() == ID_minus)
98 std::make_shared<offset_entryt>(offset_value), environment, ns);
106 const auto access =
stack.front()->get_access_expr();
108 !access.second && access.first.id() == ID_symbol,
109 "The base should be an addressable location (i.e. symbol)");
111 if(access.first.type().id() != ID_array)
136 if(expr.
id() == ID_member)
138 add_to_stack(std::make_shared<simple_entryt>(expr), environment, ns);
142 else if(expr.
id() == ID_symbol || expr.
id() == ID_dynamic_object)
144 add_to_stack(std::make_shared<simple_entryt>(expr), environment, ns);
146 else if(expr.
id() == ID_index)
167 environment.
eval(index_expr.
index(), ns);
169 add_to_stack(std::make_shared<offset_entryt>(offset_value), environment, ns);
181 exprt access_expr =
stack.front()->get_access_expr().first;
182 for(
auto it = std::next(
stack.begin()); it !=
stack.end(); ++it)
184 const auto access = (*it)->get_access_expr();
186 access_expr =
index_exprt{access_expr, access.first};
188 access_expr = access.first;
191 return std::move(top_expr);
208 auto const access =
stack.back()->get_access_expr();
213 if(access.first.id() == ID_member || access.first.id() == ID_symbol)
216 if(access.first.id() == ID_index)
236 std::shared_ptr<write_stack_entryt> entry_pointer,
242 !
stack.front()->try_squash_in(entry_pointer, environment, ns))
257 exprt &out_base_expr,
258 exprt &out_integral_expr)
262 static const std::unordered_set<irep_idt, irep_id_hash> integral_types = {
263 ID_signedbv, ID_unsignedbv, ID_integer};
264 if(integral_types.find(binary_e.lhs().type().id()) != integral_types.cend())
266 out_integral_expr = binary_e.lhs();
267 out_base_expr = binary_e.rhs();
271 integral_types.find(binary_e.rhs().type().id()) != integral_types.cend())
273 out_integral_expr = binary_e.rhs();
274 out_base_expr = binary_e.lhs();
An abstract version of a program environment.
sharing_ptrt< class abstract_objectt > abstract_object_pointert
unsignedbv_typet unsigned_long_int_type()
signedbv_typet signed_size_type()
virtual abstract_object_pointert eval(const exprt &expr, const namespacet &ns) const
These three are really the heart of the method.
Operator to return the address of an object.
Base class for all expressions.
typet & type()
Return the type of the expression.
const irep_idt & id() const
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
The unary minus expression.
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.
exprt target_expression(size_t depth) const
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_lvalue(const exprt &expr, const abstract_environmentt &environment, const namespacet &ns)
Construct a stack up to a specific l-value (i.e.
write_stackt()
Build a topstack.
bool is_top_value() const
Is the stack representing an unknown value and hence can't be written to or read from.
exprt to_expression() const
Convert the stack to an expression that can be used to write to.
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.
continuation_stack_storet stack
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.
API to expression classes for Pointers.
const address_of_exprt & to_address_of_expr(const exprt &expr)
Cast an exprt to an address_of_exprt.
#define PRECONDITION(CONDITION)
API to expression classes.
const binary_exprt & to_binary_expr(const exprt &expr)
Cast an exprt to a binary_exprt.
const member_exprt & to_member_expr(const exprt &expr)
Cast an exprt to a member_exprt.
const index_exprt & to_index_expr(const exprt &expr)
Cast an exprt to an index_exprt.
Represents a stack of write operations to an addressable memory location.
Represents an entry in the write_stackt.