Skip to content

Move flatten_byte_* to lowering [blocks: #2068, #2501] #3290

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 2 commits into from
Nov 7, 2018
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
2 changes: 1 addition & 1 deletion src/solvers/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,12 @@ SRC = $(BOOLEFORCE_SRC) \
flattening/bv_utils.cpp \
flattening/c_bit_field_replacement_type.cpp \
flattening/equality.cpp \
flattening/flatten_byte_operators.cpp \
flattening/functions.cpp \
flattening/pointer_logic.cpp \
floatbv/float_bv.cpp \
floatbv/float_utils.cpp \
floatbv/float_approximation.cpp \
lowering/byte_operators.cpp \
lowering/popcount.cpp \
miniBDD/miniBDD.cpp \
prop/bdd_expr.cpp \
Expand Down
5 changes: 3 additions & 2 deletions src/solvers/flattening/boolbv_byte_extract.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ Author: Daniel Kroening, [email protected]
#include <util/std_expr.h>
#include <util/throw_with_nested.h>

#include <solvers/lowering/expr_lowering.h>
#include <solvers/lowering/flatten_byte_extract_exceptions.h>

#include "bv_conversion_exceptions.h"
#include "bv_endianness_map.h"
#include "flatten_byte_extract_exceptions.h"
#include "flatten_byte_operators.h"

bvt map_bv(const bv_endianness_mapt &map, const bvt &src)
{
Expand Down
3 changes: 2 additions & 1 deletion src/solvers/flattening/boolbv_equality.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ Author: Daniel Kroening, [email protected]
#include <util/base_type.h>
#include <util/invariant.h>

#include <solvers/lowering/expr_lowering.h>

#include "bv_conversion_exceptions.h"
#include "flatten_byte_operators.h"

literalt boolbvt::convert_equality(const equal_exprt &expr)
{
Expand Down
32 changes: 0 additions & 32 deletions src/solvers/flattening/flatten_byte_operators.h

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Author: Daniel Kroening, [email protected]

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

#include "flatten_byte_operators.h"
#include "expr_lowering.h"

#include <util/arith_tools.h>
#include <util/byte_operators.h>
Expand All @@ -18,6 +18,8 @@ Author: Daniel Kroening, [email protected]

#include "flatten_byte_extract_exceptions.h"

// clang-format off

/// rewrite an object into its individual bytes
/// \par parameters: src object to unpack
/// little_endian true, iff assumed endianness is little-endian
Expand Down Expand Up @@ -664,3 +666,4 @@ exprt flatten_byte_operators(
else
return tmp;
}
// clang-format on
10 changes: 10 additions & 0 deletions src/solvers/lowering/expr_lowering.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,19 @@ Author: Michael Tautschnig

#include <util/expr.h>

class byte_extract_exprt;
class byte_update_exprt;
class namespacet;
class popcount_exprt;

exprt flatten_byte_extract(const byte_extract_exprt &src, const namespacet &ns);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If flattening is different from lowering then why are the functions in lowering called flattening?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They will be renamed (I had already done so in 8cd566e), but I wanted to keep this one as easy as possible to review. I'll follow up with a PR doing the renaming shortly.


exprt flatten_byte_update(const byte_update_exprt &src, const namespacet &ns);

exprt flatten_byte_operators(const exprt &src, const namespacet &ns);

bool has_byte_operator(const exprt &src);

/// Lower a popcount_exprt to arithmetic and logic expressions
/// \param expr Input expression to be translated
/// \param ns Namespace for type lookups
Expand Down
1 change: 0 additions & 1 deletion src/solvers/smt2/smt2_conv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ Author: Daniel Kroening, [email protected]

#include <solvers/flattening/boolbv_width.h>
#include <solvers/flattening/c_bit_field_replacement_type.h>
#include <solvers/flattening/flatten_byte_operators.h>
#include <solvers/floatbv/float_bv.h>
#include <solvers/lowering/expr_lowering.h>

Expand Down