Skip to content

Commit ef4e270

Browse files
authored
Merge pull request #7330 from tautschnig/feature/move-byte-op-lowering
Move byte-operator lowering to util [depends-on: #7329]
2 parents ca15201 + c708326 commit ef4e270

14 files changed

+163
-174
lines changed

src/solvers/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,6 @@ SRC = $(BOOLEFORCE_SRC) \
140140
floatbv/float_bv.cpp \
141141
floatbv/float_utils.cpp \
142142
floatbv/float_approximation.cpp \
143-
lowering/byte_operators.cpp \
144143
lowering/functions.cpp \
145144
bdd/miniBDD/miniBDD.cpp \
146145
prop/bdd_expr.cpp \

src/solvers/flattening/boolbv_byte_extract.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ Author: Daniel Kroening, [email protected]
1414
#include <util/pointer_offset_size.h>
1515
#include <util/std_expr.h>
1616

17-
#include <solvers/lowering/expr_lowering.h>
18-
1917
bvt map_bv(const endianness_mapt &map, const bvt &src)
2018
{
2119
PRECONDITION(map.number_of_bits() == src.size());

src/solvers/flattening/boolbv_byte_update.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ Author: Daniel Kroening, [email protected]
1212
#include <util/byte_operators.h>
1313
#include <util/invariant.h>
1414

15-
#include <solvers/lowering/expr_lowering.h>
16-
1715
bvt boolbvt::convert_byte_update(const byte_update_exprt &expr)
1816
{
1917
// if we update (from) an unbounded array, lower the expression as the array

src/solvers/flattening/boolbv_equality.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ Author: Daniel Kroening, [email protected]
1010
#include <util/invariant.h>
1111
#include <util/std_expr.h>
1212

13-
#include <solvers/lowering/expr_lowering.h>
14-
1513
#include "boolbv.h"
1614

1715
literalt boolbvt::convert_equality(const equal_exprt &expr)

src/solvers/flattening/boolbv_index.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ Author: Daniel Kroening, [email protected]
1818
#include <util/simplify_expr.h>
1919
#include <util/std_expr.h>
2020

21-
#include <solvers/lowering/expr_lowering.h>
22-
2321
bvt boolbvt::convert_index(const index_exprt &expr)
2422
{
2523
const exprt &array=expr.array();

src/solvers/lowering/expr_lowering.h

Lines changed: 0 additions & 44 deletions
This file was deleted.

src/solvers/smt2/smt2_conv.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ Author: Daniel Kroening, [email protected]
3838
#include <solvers/flattening/boolbv_width.h>
3939
#include <solvers/flattening/c_bit_field_replacement_type.h>
4040
#include <solvers/floatbv/float_bv.h>
41-
#include <solvers/lowering/expr_lowering.h>
4241
#include <solvers/prop/literal_expr.h>
4342

4443
#include "smt2_tokenizer.h"

src/solvers/smt2_incremental/smt2_incremental_decision_procedure.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include "smt2_incremental_decision_procedure.h"
44

55
#include <util/arith_tools.h>
6+
#include <util/byte_operators.h>
67
#include <util/expr.h>
78
#include <util/namespace.h>
89
#include <util/nodiscard.h>
@@ -11,7 +12,6 @@
1112
#include <util/string_utils.h>
1213
#include <util/symbol.h>
1314

14-
#include <solvers/lowering/expr_lowering.h>
1515
#include <solvers/smt2_incremental/ast/smt_commands.h>
1616
#include <solvers/smt2_incremental/ast/smt_responses.h>
1717
#include <solvers/smt2_incremental/ast/smt_terms.h>

src/util/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ SRC = arith_tools.cpp \
4646
json_stream.cpp \
4747
lispexpr.cpp \
4848
lispirep.cpp \
49+
lower_byte_operators.cpp \
4950
mathematical_expr.cpp \
5051
mathematical_types.cpp \
5152
memory_info.cpp \

src/util/byte_operators.h

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,4 +166,30 @@ make_byte_update(const exprt &_op, const exprt &_offset, const exprt &_value);
166166
/// update expression.
167167
bool has_byte_operator(const exprt &src);
168168

169+
/// Rewrite a byte extract expression to more fundamental operations.
170+
/// \param src: Byte extract expression
171+
/// \param ns: Namespace
172+
/// \return Semantically equivalent expression such that the top-level
173+
/// expression no longer is a \ref byte_extract_exprt or
174+
/// \ref byte_update_exprt. Use \ref lower_byte_operators to also remove all
175+
/// byte operators from any operands of \p src.
176+
exprt lower_byte_extract(const byte_extract_exprt &src, const namespacet &ns);
177+
178+
/// Rewrite a byte update expression to more fundamental operations.
179+
/// \param src: Byte update expression
180+
/// \param ns: Namespace
181+
/// \return Semantically equivalent expression such that the top-level
182+
/// expression no longer is a \ref byte_extract_exprt or
183+
/// \ref byte_update_exprt. Use \ref lower_byte_operators to also remove all
184+
/// byte operators from any operands of \p src.
185+
exprt lower_byte_update(const byte_update_exprt &src, const namespacet &ns);
186+
187+
/// Rewrite an expression possibly containing byte-extract or -update
188+
/// expressions to more fundamental operations.
189+
/// \param src: Input expression
190+
/// \param ns: Namespace
191+
/// \return Semantically equivalent expression that does not contain any \ref
192+
/// byte_extract_exprt or \ref byte_update_exprt.
193+
exprt lower_byte_operators(const exprt &src, const namespacet &ns);
194+
169195
#endif // CPROVER_UTIL_BYTE_OPERATORS_H

0 commit comments

Comments
 (0)