Skip to content

move bitvector-related expression classes into separate header file #5759

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 18, 2021
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
1 change: 1 addition & 0 deletions jbmc/src/java_bytecode/character_refine_preprocess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Date: March 2017
#include "character_refine_preprocess.h"

#include <util/arith_tools.h>
#include <util/bitvector_expr.h>
#include <util/std_expr.h>

/// converts based on a function on expressions
Expand Down
2 changes: 2 additions & 0 deletions jbmc/src/java_bytecode/java_string_library_preprocess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ Date: April 2017
/// java.lang.StringBuilder, java.lang.StringBuffer.

#include <goto-programs/class_identifier.h>

#include <util/allocate_objects.h>
#include <util/arith_tools.h>
#include <util/bitvector_expr.h>
#include <util/c_types.h>
#include <util/expr_initializer.h>
#include <util/fresh_symbol.h>
Expand Down
4 changes: 2 additions & 2 deletions scripts/expected_doxygen_warnings.txt
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ 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 (181), 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 (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.
Expand All @@ -96,6 +96,6 @@ warning: Included by graph for 'namespace.h' not generated, too many nodes (112)
warning: Included by graph for 'prefix.h' not generated, too many nodes (86), threshold is 60. Consider increasing DOT_GRAPH_MAX_NODES.
warning: Included by graph for 'simplify_expr.h' not generated, too many nodes (76), threshold is 60. Consider increasing DOT_GRAPH_MAX_NODES.
warning: Included by graph for 'std_code.h' not generated, too many nodes (78), threshold is 60. Consider increasing DOT_GRAPH_MAX_NODES.
warning: Included by graph for 'std_expr.h' not generated, too many nodes (247), threshold is 60. Consider increasing DOT_GRAPH_MAX_NODES.
warning: Included by graph for 'std_expr.h' not generated, too many nodes (248), threshold is 60. Consider increasing DOT_GRAPH_MAX_NODES.
warning: Included by graph for 'std_types.h' not generated, too many nodes (124), threshold is 60. Consider increasing DOT_GRAPH_MAX_NODES.
warning: Included by graph for 'symbol_table.h' not generated, too many nodes (95), threshold is 60. Consider increasing DOT_GRAPH_MAX_NODES.
1 change: 1 addition & 0 deletions src/analyses/goto_check.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Author: Daniel Kroening, [email protected]

#include <util/arith_tools.h>
#include <util/array_name.h>
#include <util/bitvector_expr.h>
#include <util/c_types.h>
#include <util/config.h>
#include <util/cprover_prefix.h>
Expand Down
13 changes: 7 additions & 6 deletions src/analyses/goto_rw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,16 @@ Date: April 2010
#include <limits>
#include <memory>

#include <util/expr_util.h>
#include <util/std_code.h>
#include <util/std_expr.h>
#include <util/pointer_offset_size.h>
#include <util/arith_tools.h>
#include <util/bitvector_expr.h>
#include <util/byte_operators.h>
#include <util/endianness_map.h>
#include <util/arith_tools.h>
#include <util/simplify_expr.h>
#include <util/expr_util.h>
#include <util/make_unique.h>
#include <util/pointer_offset_size.h>
#include <util/simplify_expr.h>
#include <util/std_code.h>
#include <util/std_expr.h>

#include <langapi/language_util.h>

Expand Down
5 changes: 3 additions & 2 deletions src/ansi-c/c_typecheck_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@ Author: Daniel Kroening, [email protected]
#ifndef CPROVER_ANSI_C_C_TYPECHECK_BASE_H
#define CPROVER_ANSI_C_C_TYPECHECK_BASE_H

#include <util/symbol_table.h>
#include <util/typecheck.h>
#include <util/bitvector_expr.h>
#include <util/namespace.h>
#include <util/std_code.h>
#include <util/std_expr.h>
#include <util/std_types.h>
#include <util/symbol_table.h>
#include <util/typecheck.h>

#include "ansi_c_declaration.h"
#include "designator.h"
Expand Down
1 change: 1 addition & 0 deletions src/ansi-c/expr2c_class.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Author: Daniel Kroening, [email protected]
#include <unordered_map>
#include <unordered_set>

#include <util/bitvector_expr.h>
#include <util/byte_operators.h>
#include <util/mathematical_expr.h>
#include <util/std_code.h>
Expand Down
1 change: 1 addition & 0 deletions src/goto-programs/interpreter_evaluate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Author: Daniel Kroening, [email protected]

#include "interpreter_class.h"

#include <util/bitvector_expr.h>
#include <util/byte_operators.h>
#include <util/fixedbv.h>
#include <util/ieee_float.h>
Expand Down
1 change: 1 addition & 0 deletions src/solvers/flattening/boolbv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Author: Daniel Kroening, [email protected]
#include <set>

#include <util/arith_tools.h>
#include <util/bitvector_expr.h>
#include <util/magic.h>
#include <util/mp_arith.h>
#include <util/prefix.h>
Expand Down
5 changes: 4 additions & 1 deletion src/solvers/flattening/boolbv.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,13 @@ Author: Daniel Kroening, [email protected]
#include "boolbv_map.h"
#include "arrays.h"

class array_comprehension_exprt;
class bswap_exprt;
class concatenation_exprt;
class extractbit_exprt;
class extractbits_exprt;
class array_comprehension_exprt;
class member_exprt;
class replication_exprt;

class boolbvt:public arrayst
{
Expand Down
3 changes: 2 additions & 1 deletion src/solvers/flattening/boolbv_bitwise.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ Author: Daniel Kroening, [email protected]

\*******************************************************************/


#include "boolbv.h"

#include <util/bitvector_expr.h>

bvt boolbvt::convert_bitwise(const exprt &expr)
{
const std::size_t width = boolbv_width(expr.type());
Expand Down
1 change: 1 addition & 0 deletions src/solvers/flattening/boolbv_bswap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Author: Michael Tautschnig

#include "boolbv.h"

#include <util/bitvector_expr.h>
#include <util/invariant.h>

bvt boolbvt::convert_bswap(const bswap_exprt &expr)
Expand Down
1 change: 1 addition & 0 deletions src/solvers/flattening/boolbv_concatenation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Author: Daniel Kroening, [email protected]

#include "boolbv.h"

#include <util/bitvector_expr.h>
#include <util/invariant.h>

bvt boolbvt::convert_concatenation(const concatenation_exprt &expr)
Expand Down
1 change: 1 addition & 0 deletions src/solvers/flattening/boolbv_extractbit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Author: Daniel Kroening, [email protected]
#include <algorithm>

#include <util/arith_tools.h>
#include <util/bitvector_expr.h>
#include <util/exception_utils.h>
#include <util/std_expr.h>
#include <util/std_types.h>
Expand Down
1 change: 1 addition & 0 deletions src/solvers/flattening/boolbv_extractbits.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Author: Daniel Kroening, [email protected]
#include "boolbv.h"

#include <util/arith_tools.h>
#include <util/bitvector_expr.h>

bvt boolbvt::convert_extractbits(const extractbits_exprt &expr)
{
Expand Down
1 change: 1 addition & 0 deletions src/solvers/flattening/boolbv_replication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Author: Daniel Kroening, [email protected]
#include "boolbv.h"

#include <util/arith_tools.h>
#include <util/bitvector_expr.h>

bvt boolbvt::convert_replication(const replication_exprt &expr)
{
Expand Down
1 change: 1 addition & 0 deletions src/solvers/flattening/bv_pointers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Author: Daniel Kroening, [email protected]
#include "bv_pointers.h"

#include <util/arith_tools.h>
#include <util/bitvector_expr.h>
#include <util/c_types.h>
#include <util/config.h>
#include <util/exception_utils.h>
Expand Down
3 changes: 2 additions & 1 deletion src/solvers/floatbv/float_bv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ Author: Daniel Kroening, [email protected]

#include <algorithm>

#include <util/std_expr.h>
#include <util/arith_tools.h>
#include <util/bitvector_expr.h>
#include <util/std_expr.h>

exprt float_bvt::convert(const exprt &expr) const
{
Expand Down
1 change: 1 addition & 0 deletions src/solvers/lowering/byte_operators.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Author: Daniel Kroening, [email protected]
#include <algorithm>

#include <util/arith_tools.h>
#include <util/bitvector_expr.h>
#include <util/byte_operators.h>
#include <util/c_types.h>
#include <util/endianness_map.h>
Expand Down
1 change: 1 addition & 0 deletions src/solvers/lowering/popcount.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Author: Michael Tautschnig
#include "expr_lowering.h"

#include <util/arith_tools.h>
#include <util/bitvector_expr.h>
#include <util/invariant.h>
#include <util/pointer_offset_size.h>
#include <util/std_expr.h>
Expand Down
1 change: 1 addition & 0 deletions src/solvers/qbf/qdimacs_core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Author: CM Wintersteiger
#include "qdimacs_core.h"

#include <util/arith_tools.h>
#include <util/bitvector_expr.h>
#include <util/std_expr.h>

void qdimacs_coret::simplify_extractbits(exprt &expr) const
Expand Down
1 change: 1 addition & 0 deletions src/solvers/smt2/smt2_conv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Author: Daniel Kroening, [email protected]
#include "smt2_conv.h"

#include <util/arith_tools.h>
#include <util/bitvector_expr.h>
#include <util/c_types.h>
#include <util/config.h>
#include <util/expr_iterator.h>
Expand Down
1 change: 1 addition & 0 deletions src/solvers/smt2/smt2_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Author: Daniel Kroening, [email protected]
#include "smt2_format.h"

#include <util/arith_tools.h>
#include <util/bitvector_expr.h>
#include <util/ieee_float.h>
#include <util/invariant.h>
#include <util/mathematical_expr.h>
Expand Down
6 changes: 4 additions & 2 deletions src/solvers/strings/string_constraint_generator_float.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ Author: Romain Brenguier, [email protected]
/// Generates string constraints for functions generating strings from other
/// types, in particular int, long, float, double, char, bool

#include <solvers/floatbv/float_bv.h>

#include "string_constraint_generator.h"

#include <util/bitvector_expr.h>

#include <solvers/floatbv/float_bv.h>

/// Gets the unbiased exponent in a floating-point bit-vector
///
/// \todo Refactor with float_bv.cpp float_utils.h
Expand Down
2 changes: 2 additions & 0 deletions src/solvers/strings/string_format_builtin_function.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ Author: Romain Brenguier, Joel Allred
#include "format_specifier.h"
#include "string_format_builtin_function.h"
#include "string_refinement_util.h"

#include <util/bitvector_expr.h>
#include <util/range.h>
#include <util/simplify_expr.h>
#include <util/symbol_table.h>
Expand Down
1 change: 1 addition & 0 deletions src/util/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ SRC = allocate_objects.cpp \
array_element_from_pointer.cpp \
array_name.cpp \
base_type.cpp \
bitvector_expr.cpp \
bv_arithmetic.cpp \
byte_operators.cpp \
c_types.cpp \
Expand Down
42 changes: 42 additions & 0 deletions src/util/bitvector_expr.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*******************************************************************\

Module: API to expression classes for bitvectors

Author: Daniel Kroening, [email protected]

\*******************************************************************/

#include "bitvector_expr.h"

#include "arith_tools.h"
#include "mathematical_types.h"

shift_exprt::shift_exprt(
exprt _src,
const irep_idt &_id,
const std::size_t _distance)
: binary_exprt(std::move(_src), _id, from_integer(_distance, integer_typet()))
{
}

extractbit_exprt::extractbit_exprt(exprt _src, const std::size_t _index)
: binary_predicate_exprt(
std::move(_src),
ID_extractbit,
from_integer(_index, integer_typet()))
{
}

extractbits_exprt::extractbits_exprt(
exprt _src,
const std::size_t _upper,
const std::size_t _lower,
typet _type)
: expr_protectedt(ID_extractbits, std::move(_type))
{
PRECONDITION(_upper >= _lower);
add_to_operands(
std::move(_src),
from_integer(_upper, integer_typet()),
from_integer(_lower, integer_typet()));
}
Loading