Skip to content

Commit b902e0b

Browse files
authored
Merge pull request diffblue#5810 from diffblue/remove-boolbvt-literals
remove dead boolbvt::literals(...)
2 parents 5fd8562 + 37762a1 commit b902e0b

File tree

4 files changed

+0
-107
lines changed

4 files changed

+0
-107
lines changed

src/solvers/flattening/boolbv.cpp

Lines changed: 0 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -31,89 +31,6 @@ Author: Daniel Kroening, [email protected]
3131
#include <solvers/floatbv/float_utils.h>
3232
#include <solvers/lowering/expr_lowering.h>
3333

34-
bool boolbvt::literal(
35-
const exprt &expr,
36-
const std::size_t bit,
37-
literalt &dest) const
38-
{
39-
if(expr.type().id()==ID_bool)
40-
{
41-
INVARIANT(
42-
bit == 0,
43-
"boolean expressions shall be represented by a single bit and hence the "
44-
"only valid bit index is 0");
45-
return prop_conv_solvert::literal(to_symbol_expr(expr), dest);
46-
}
47-
else
48-
{
49-
if(expr.id()==ID_symbol ||
50-
expr.id()==ID_nondet_symbol)
51-
{
52-
const irep_idt &identifier=expr.get(ID_identifier);
53-
54-
boolbv_mapt::mappingt::const_iterator it_m=
55-
map.mapping.find(identifier);
56-
57-
if(it_m==map.mapping.end())
58-
return true;
59-
60-
const boolbv_mapt::map_entryt &map_entry=it_m->second;
61-
62-
INVARIANT(
63-
bit < map_entry.literal_map.size(), "bit index shall be within bounds");
64-
if(!map_entry.literal_map[bit].is_set)
65-
return true;
66-
67-
dest=map_entry.literal_map[bit].l;
68-
return false;
69-
}
70-
else if(expr.id()==ID_index)
71-
{
72-
const index_exprt &index_expr=to_index_expr(expr);
73-
74-
std::size_t element_width=boolbv_width(index_expr.type());
75-
CHECK_RETURN(element_width != 0);
76-
77-
const auto &index = index_expr.index();
78-
PRECONDITION(index.id() == ID_constant);
79-
mp_integer index_int =
80-
numeric_cast_v<mp_integer>(to_constant_expr(index));
81-
82-
std::size_t offset =
83-
numeric_cast_v<std::size_t>(index_int * element_width);
84-
85-
return literal(index_expr.array(), bit+offset, dest);
86-
}
87-
else if(expr.id()==ID_member)
88-
{
89-
const member_exprt &member_expr=to_member_expr(expr);
90-
91-
const struct_typet::componentst &components=
92-
to_struct_type(expr.type()).components();
93-
const irep_idt &component_name=member_expr.get_component_name();
94-
95-
std::size_t offset=0;
96-
97-
for(const auto &c : components)
98-
{
99-
const typet &subtype = c.type();
100-
101-
if(c.get_name() == component_name)
102-
return literal(member_expr.struct_op(), bit + offset, dest);
103-
104-
std::size_t element_width=boolbv_width(subtype);
105-
CHECK_RETURN(element_width != 0);
106-
107-
offset+=element_width;
108-
}
109-
110-
INVARIANT(false, "struct type should have accessed component");
111-
}
112-
}
113-
114-
INVARIANT(false, "expression should have a corresponding literal");
115-
}
116-
11734
/// Convert expression to vector of literalts, using an internal
11835
/// cache to speed up conversion if available. Also assert the resultant
11936
/// vector is of a specific size, and freeze any elements if appropriate.

src/solvers/flattening/boolbv.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,6 @@ class boolbvt:public arrayst
7777
SUB::post_process();
7878
}
7979

80-
// get literals for variables/expressions, if available
81-
virtual bool literal(
82-
const exprt &expr,
83-
std::size_t bit,
84-
literalt &literal) const;
85-
8680
enum class unbounded_arrayt { U_NONE, U_ALL, U_AUTO };
8781
unbounded_arrayt unbounded_array;
8882

src/solvers/prop/prop_conv_solver.cpp

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -57,21 +57,6 @@ exprt prop_conv_solvert::handle(const exprt &expr)
5757
return literal_exprt(l);
5858
}
5959

60-
bool prop_conv_solvert::literal(const symbol_exprt &expr, literalt &dest) const
61-
{
62-
PRECONDITION(expr.type().id() == ID_bool);
63-
64-
const irep_idt &identifier = expr.get_identifier();
65-
66-
symbolst::const_iterator result = symbols.find(identifier);
67-
68-
if(result == symbols.end())
69-
return true;
70-
71-
dest = result->second;
72-
return false;
73-
}
74-
7560
literalt prop_conv_solvert::get_literal(const irep_idt &identifier)
7661
{
7762
auto result =

src/solvers/prop/prop_conv_solver.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,6 @@ class prop_conv_solvert : public conflict_providert,
6969

7070
void pop() override;
7171

72-
// get literal for expression, if available
73-
bool literal(const symbol_exprt &expr, literalt &literal) const;
74-
7572
bool use_cache = true;
7673
bool equality_propagation = true;
7774
bool freeze_all = false; // freezing variables (for incremental solving)

0 commit comments

Comments
 (0)