Skip to content

[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

Conversation

hannes-steffenhagen-diffblue
Copy link
Contributor

@hannes-steffenhagen-diffblue hannes-steffenhagen-diffblue commented Sep 13, 2018

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.

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());
Copy link
Member

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);
Copy link
Member

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.

Copy link
Contributor Author

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

return true;

bool bit=(id2string(value)[width-integer2size_t(i)-1]=='1');
bool bit =
Copy link
Member

Choose a reason for hiding this comment

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

const

@@ -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();
Copy link
Member

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.

@@ -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);
Copy link
Member

Choose a reason for hiding this comment

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

clang-format

@kroening kroening mentioned this pull request May 30, 2019
5 tasks
kroening pushed a commit that referenced this pull request May 30, 2019
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(...)).
kroening pushed a commit that referenced this pull request Jun 3, 2019
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(...)).
kroening pushed a commit that referenced this pull request Jun 5, 2019
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(...)).
angelhof pushed a commit to angelhof/cbmc that referenced this pull request Jul 17, 2019
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(...)).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants