Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions scripts/expected_doxygen_warnings.txt
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ warning: Include graph for 'cbmc_parse_options.cpp' not generated, too many node
warning: Include graph for 'goto_instrument_parse_options.cpp' not generated, too many nodes (97), threshold is 60. Consider increasing DOT_GRAPH_MAX_NODES.
warning: Included by graph for 'goto_functions.h' not generated, too many nodes (66), threshold is 60. Consider increasing DOT_GRAPH_MAX_NODES.
warning: Included by graph for 'goto_model.h' not generated, too many nodes (109), threshold is 60. Consider increasing DOT_GRAPH_MAX_NODES.
warning: Included by graph for 'arith_tools.h' not generated, too many nodes (182), threshold is 60. Consider increasing DOT_GRAPH_MAX_NODES.
warning: Included by graph for 'c_types.h' not generated, too many nodes (111), threshold is 60. Consider increasing DOT_GRAPH_MAX_NODES.
warning: Included by graph for 'arith_tools.h' not generated, too many nodes (181), threshold is 60. Consider increasing DOT_GRAPH_MAX_NODES.
warning: Included by graph for 'c_types.h' not generated, too many nodes (110), threshold is 60. Consider increasing DOT_GRAPH_MAX_NODES.
warning: Included by graph for 'config.h' not generated, too many nodes (85), threshold is 60. Consider increasing DOT_GRAPH_MAX_NODES.
warning: Included by graph for 'exception_utils.h' not generated, too many nodes (61), threshold is 60. Consider increasing DOT_GRAPH_MAX_NODES.
warning: Included by graph for 'expr.h' not generated, too many nodes (87), threshold is 60. Consider increasing DOT_GRAPH_MAX_NODES.
Expand Down
1 change: 0 additions & 1 deletion src/solvers/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ SRC = $(BOOLEFORCE_SRC) \
flattening/boolbv_width.cpp \
flattening/boolbv_with.cpp \
flattening/bv_dimacs.cpp \
flattening/bv_endianness_map.cpp \
flattening/bv_minimize.cpp \
flattening/bv_pointers.cpp \
flattening/bv_utils.cpp \
Expand Down
15 changes: 13 additions & 2 deletions src/solvers/flattening/boolbv.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Author: Daniel Kroening, [email protected]
//

#include <util/byte_operators.h>
#include <util/endianness_map.h>
#include <util/expr.h>
#include <util/mp_arith.h>
#include <util/optional.h>
Expand Down Expand Up @@ -46,7 +47,7 @@ class boolbvt:public arrayst
bool get_array_constraints = false)
: arrayst(_ns, _prop, message_handler, get_array_constraints),
unbounded_array(unbounded_arrayt::U_NONE),
boolbv_width(_ns),
bv_width(_ns),
bv_utils(_prop),
functions(*this),
map(_prop)
Expand Down Expand Up @@ -92,9 +93,19 @@ class boolbvt:public arrayst
return map;
}

boolbv_widtht boolbv_width;
virtual std::size_t boolbv_width(const typet &type) const
{
return bv_width(type);
}

virtual endianness_mapt
endianness_map(const typet &type, bool little_endian) const
{
return endianness_mapt{type, little_endian, ns};
}

protected:
boolbv_widtht bv_width;
bv_utilst bv_utils;

// uninterpreted functions
Expand Down
8 changes: 3 additions & 5 deletions src/solvers/flattening/boolbv_byte_extract.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ Author: Daniel Kroening, [email protected]

#include <solvers/lowering/expr_lowering.h>

#include "bv_endianness_map.h"

bvt map_bv(const bv_endianness_mapt &map, const bvt &src)
bvt map_bv(const endianness_mapt &map, const bvt &src)
{
PRECONDITION(map.number_of_bits() == src.size());
bvt result;
Expand Down Expand Up @@ -101,11 +99,11 @@ bvt boolbvt::convert_byte_extract(const byte_extract_exprt &expr)
const bool little_endian = expr.id() == ID_byte_extract_little_endian;

// first do op0
const bv_endianness_mapt op_map(op.type(), little_endian, ns, boolbv_width);
const endianness_mapt op_map = endianness_map(op.type(), little_endian);
const bvt op_bv=map_bv(op_map, convert_bv(op));

// do result
bv_endianness_mapt result_map(expr.type(), little_endian, ns, boolbv_width);
endianness_mapt result_map = endianness_map(expr.type(), little_endian);
bvt bv;
bv.resize(width);

Expand Down
10 changes: 4 additions & 6 deletions src/solvers/flattening/boolbv_byte_update.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ Author: Daniel Kroening, [email protected]

#include <solvers/lowering/expr_lowering.h>

#include "bv_endianness_map.h"

bvt boolbvt::convert_byte_update(const byte_update_exprt &expr)
{
// if we update (from) an unbounded array, lower the expression as the array
Expand Down Expand Up @@ -67,8 +65,8 @@ bvt boolbvt::convert_byte_update(const byte_update_exprt &expr)
}
else
{
bv_endianness_mapt map_op(op.type(), false, ns, boolbv_width);
bv_endianness_mapt map_value(value.type(), false, ns, boolbv_width);
endianness_mapt map_op = endianness_map(op.type(), false);
endianness_mapt map_value = endianness_map(value.type(), false);

const std::size_t offset_i = numeric_cast_v<std::size_t>(offset);

Expand Down Expand Up @@ -99,8 +97,8 @@ bvt boolbvt::convert_byte_update(const byte_update_exprt &expr)
offset_expr, from_integer(offset / byte_width, offset_expr.type()));
literalt equal=convert(equality);

bv_endianness_mapt map_op(op.type(), little_endian, ns, boolbv_width);
bv_endianness_mapt map_value(value.type(), little_endian, ns, boolbv_width);
endianness_mapt map_op = endianness_map(op.type(), little_endian);
endianness_mapt map_value = endianness_map(value.type(), little_endian);

for(std::size_t bit=0; bit<update_width; bit++)
if(offset+bit<bv.size())
Expand Down
6 changes: 2 additions & 4 deletions src/solvers/flattening/boolbv_union.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ Author: Daniel Kroening, [email protected]
#include <util/arith_tools.h>
#include <util/config.h>

#include "bv_endianness_map.h"

bvt boolbvt::convert_union(const union_exprt &expr)
{
std::size_t width=boolbv_width(expr.type());
Expand Down Expand Up @@ -45,8 +43,8 @@ bvt boolbvt::convert_union(const union_exprt &expr)
config.ansi_c.endianness == configt::ansi_ct::endiannesst::IS_BIG_ENDIAN,
"endianness should be set to either little endian or big endian");

bv_endianness_mapt map_u(expr.type(), false, ns, boolbv_width);
bv_endianness_mapt map_op(expr.op().type(), false, ns, boolbv_width);
endianness_mapt map_u = endianness_map(expr.type(), false);
endianness_mapt map_op = endianness_map(expr.op().type(), false);

for(std::size_t i=0; i<op_bv.size(); i++)
bv[map_u.map_bit(i)]=op_bv[map_op.map_bit(i)];
Expand Down
11 changes: 4 additions & 7 deletions src/solvers/flattening/boolbv_width.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,13 @@ Author: Daniel Kroening, [email protected]
#include <util/arith_tools.h>
#include <util/exception_utils.h>
#include <util/invariant.h>
#include <util/namespace.h>
#include <util/std_types.h>

boolbv_widtht::boolbv_widtht(const namespacet &_ns):ns(_ns)
{
}

boolbv_widtht::~boolbv_widtht()
{
}

const boolbv_widtht::entryt &boolbv_widtht::get_entry(const typet &type) const
{
// check cache first
Expand Down Expand Up @@ -184,11 +181,11 @@ const boolbv_widtht::entryt &boolbv_widtht::get_entry(const typet &type) const
else if(type_id==ID_pointer)
entry.total_width = type_checked_cast<pointer_typet>(type).get_width();
else if(type_id==ID_struct_tag)
entry=get_entry(ns.follow_tag(to_struct_tag_type(type)));
entry.total_width = operator()(ns.follow_tag(to_struct_tag_type(type)));
else if(type_id==ID_union_tag)
entry=get_entry(ns.follow_tag(to_union_tag_type(type)));
entry.total_width = operator()(ns.follow_tag(to_union_tag_type(type)));
else if(type_id==ID_c_enum_tag)
entry=get_entry(ns.follow_tag(to_c_enum_tag_type(type)));
entry.total_width = operator()(ns.follow_tag(to_c_enum_tag_type(type)));
else if(type_id==ID_c_bit_field)
{
entry.total_width=to_c_bit_field_type(type).get_width();
Expand Down
7 changes: 4 additions & 3 deletions src/solvers/flattening/boolbv_width.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,16 @@ Author: Daniel Kroening, [email protected]
#define CPROVER_SOLVERS_FLATTENING_BOOLBV_WIDTH_H

#include <util/std_types.h>
#include <util/namespace.h>

class namespacet;

class boolbv_widtht
{
public:
explicit boolbv_widtht(const namespacet &_ns);
~boolbv_widtht();
virtual ~boolbv_widtht() = default;

std::size_t operator()(const typet &type) const
virtual std::size_t operator()(const typet &type) const
{
return get_entry(type).total_width;
}
Expand Down
6 changes: 2 additions & 4 deletions src/solvers/flattening/boolbv_with.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ Author: Daniel Kroening, [email protected]
#include <util/arith_tools.h>
#include <util/config.h>

#include "bv_endianness_map.h"

bvt boolbvt::convert_with(const with_exprt &expr)
{
bvt bv = convert_bv(expr.old());
Expand Down Expand Up @@ -248,8 +246,8 @@ void boolbvt::convert_with_union(
assert(
config.ansi_c.endianness==configt::ansi_ct::endiannesst::IS_BIG_ENDIAN);

bv_endianness_mapt map_u(type, false, ns, boolbv_width);
bv_endianness_mapt map_op2(op2.type(), false, ns, boolbv_width);
endianness_mapt map_u = endianness_map(type, false);
endianness_mapt map_op2 = endianness_map(op2.type(), false);

for(std::size_t i=0; i<op2_bv.size(); i++)
next_bv[map_u.map_bit(i)]=op2_bv[map_op2.map_bit(i)];
Expand Down
36 changes: 0 additions & 36 deletions src/solvers/flattening/bv_endianness_map.cpp

This file was deleted.

40 changes: 0 additions & 40 deletions src/solvers/flattening/bv_endianness_map.h

This file was deleted.

Loading