Skip to content

Refactor and add documentation for mmio goto-program pass #7553

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 9 commits into from
Feb 22, 2023

Conversation

thomasspriggs
Copy link
Contributor

This PR refactors and documents the mmio goto-program pass. I found it to be non-trivial to get an overview of what this transformation pass was doing to the goto-program. The refactoring and documentation in this PR is that which I carried out in order to further my own understanding. This PR is not intended to include any bugfixes or additional functionality, nor am I planning to carry out such work in the near future.

The functionality implemented in the mmio pass is tested by the regression/cbmc/mm_io1 test. I suggest that reviewers review commit by commit as every step-wise refactor is in its own commit, with justification in the commit body. So it should be easier to see that there are no functional changes based on the individual commits rather than reading the change set of PR as a whole.

  • Each commit message has a non-empty body, explaining why the change was made.
  • Methods or procedures I have added are documented, following the guidelines provided in CODING_STANDARD.md.
  • The feature or user visible behaviour I have added or modified has been documented in the User Guide in doc/cprover-manual/
  • Regression or unit tests are included, or existing tests cover the modified code (in this case I have detailed which ones those are in the commit message).
  • My commit message includes data points confirming performance improvements (if claimed).
  • My PR is restricted to a single feature or bugfix.
  • White-space or formatting changes outside the feature-related changed lines are in commits of their own.

In order to make the naming pattern easier to spot.
To make it clear that they are not mutated.
This ensures that the variable is only in scope when it is non-null.
To reduce indentation and make it clear that this check filters which
instructions the loop operates on.
This removes the need for an excessively vebose type, matches C++11
style and is suggested by clang-tidy.
So that there is an overview of the algorithm used and so that the
relevant markdown file about the related feature is more easily
discoverable.
This helps make it clearer that the dereference writes operation
considers only a single write per assignment, rather than a set of
writes.
This allows for `deref_expr_r` to be made constant, which makes it clear
that the set is rebuilt for each assign instruction and is built in one
place only. This also makes it clear that the result of the
`collect_deref_expr` function is its return value.

There is no performance cost to this refactor as Return Value
Optimization (RVO) applies in this case.
This makes it clear from reading the `.cpp` file only that this function
is not part of the external API and is used within this file only.
@peterschrammel peterschrammel removed their assignment Feb 22, 2023
@thomasspriggs thomasspriggs merged commit aec6269 into diffblue:develop Feb 22, 2023
@thomasspriggs thomasspriggs deleted the tas/mmio_cleanup branch February 22, 2023 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants