-
Notifications
You must be signed in to change notification settings - Fork 278
[Draft] Refactor more simplify_plus to take plus_exprt #2946
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
[Draft] Refactor more simplify_plus to take plus_exprt #2946
Conversation
src/util/simplify_expr.cpp
Outdated
expr.operands().size() == 1, | ||
"typecasts must have exactly one argument"); | ||
auto const& typecast_expr = to_typecast_expr(expr); | ||
const typet &op_type=ns.follow(typecast_expr.op().type()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-format (several occurrences)
|
||
if(!to_struct_type(value_ptr_type). | ||
has_component(component_name)) | ||
const struct_typet &value_ptr_struct_type=to_struct_type(value_ptr_type); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The commit message could be a bit more specific regarding the kind of clean-ups this commit is doing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, that commit is not really a part of this PR and is just included because this depends on some of the changes made in a prior PR
src/util/simplify_expr_int.cpp
Outdated
return true; | ||
|
||
bool bit=(id2string(value)[width-integer2size_t(i)-1]=='1'); | ||
bool bit = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const
src/util/simplify_expr_int.cpp
Outdated
@@ -864,20 +864,15 @@ bool simplify_exprt::simplify_extractbit(exprt &expr) | |||
if(!is_bitvector_type(src_type)) | |||
return true; | |||
|
|||
std::size_t src_bit_width = to_bitvector_type(src_type).get_width(); | |||
const std::size_t src_bit_width = to_bitvector_type(src_type).get_width(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A more descriptive commit message would be appreciated.
src/util/simplify_expr_int.cpp
Outdated
@@ -887,12 +882,15 @@ bool simplify_exprt::simplify_extractbit(exprt &expr) | |||
const irep_idt &src_value = | |||
to_constant_expr(extractbit_expr.src()).get_value(); | |||
|
|||
if(src_value.size() != src_bit_width) | |||
|
|||
std::string src_value_as_string=id2string(src_value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-format
This is follow-up on #2939 and #2946, and the biggest change to the simplifier since its existence. It attempts to make the implementation of individual simplification steps more type safe, as opposed to using exprt. The alternative considered was to return optionalt<exprt>, which has the disadvantage that it doesn't "chain", i.e., given two transformations f and g one cannot write f(g(...)).
This is follow-up on #2939 and #2946, and the biggest change to the simplifier since its existence. It attempts to make the implementation of individual simplification steps more type safe, as opposed to using exprt. The alternative considered was to return optionalt<exprt>, which has the disadvantage that it doesn't "chain", i.e., given two transformations f and g one cannot write f(g(...)).
This is follow-up on #2939 and #2946, and the biggest change to the simplifier since its existence. It attempts to make the implementation of individual simplification steps more type safe, as opposed to using exprt. The alternative considered was to return optionalt<exprt>, which has the disadvantage that it doesn't "chain", i.e., given two transformations f and g one cannot write f(g(...)).
This is follow-up on diffblue#2939 and diffblue#2946, and the biggest change to the simplifier since its existence. It attempts to make the implementation of individual simplification steps more type safe, as opposed to using exprt. The alternative considered was to return optionalt<exprt>, which has the disadvantage that it doesn't "chain", i.e., given two transformations f and g one cannot write f(g(...)).
Based on #2939
Does the same sort of refactoring for plus_exprt. Because this depends on multiple PRs that each are still subject to change this should be considered a draft that's not ready to be merged.
Only 97cd898 is really new in this PR, the others are from work-in-progress PRs. Please disregard them.