Skip to content

VSD - Cross-representation expression evaluation #5880

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 22 commits into from
Mar 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
867d3ac
value_set_abstract_object merge unit tests
jezhiggins Feb 6, 2021
f87f13d
Merge a value_set and a constant
jezhiggins Feb 6, 2021
27e57fe
Merge a value-set of values with a top value
jezhiggins Feb 11, 2021
a415bfb
Unit tests for value-set binary operations
jezhiggins Feb 11, 2021
f590919
Pulled out value_set test helpers
jezhiggins Feb 11, 2021
30c32a0
Start making index_ranget more container-like
jezhiggins Feb 12, 2021
3efcd29
index_ranget iterators are now forward iterators
jezhiggins Feb 12, 2021
f345c98
Rename range_implementation to index_range_implementation
jezhiggins Feb 18, 2021
ca6547f
Added value_ranget value_range() to abstract_value_objectt
jezhiggins Feb 18, 2021
7390750
Adding a value_set and TOP should go TOP
jezhiggins Feb 18, 2021
bf8fc59
Rework constant_abstract_valuet merge tests to be more explicit
jezhiggins Feb 19, 2021
7b9f559
constant_abstract_valuet expression_transform unit tests
jezhiggins Feb 19, 2021
3a1428f
Adding constants and value sets
jezhiggins Feb 19, 2021
8329afd
Enable cross-representation expression transform for all values
jezhiggins Feb 19, 2021
8ef9acd
Build out constants_evaluator
jezhiggins Feb 19, 2021
9094f89
Pulled out interval_evaluator
jezhiggins Feb 25, 2021
a13d36d
Expand out for_each_comb. Doesn't need to be a template.
jezhiggins Feb 25, 2021
09d2199
Build value_set_evaluator - wraps value_set evaluation into a class
jezhiggins Feb 25, 2021
ea92e73
Fold evaluate_each_combination into value_set_evaluator
jezhiggins Feb 25, 2021
2d3ffb0
Explicitly create values with the required representation
jezhiggins Feb 25, 2021
d1fc4cd
Combine any_value_sets and any_intervals implementations
jezhiggins Feb 25, 2021
2fa8d96
Interval evaluation wants expressions rather than objects
jezhiggins Feb 26, 2021
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
18 changes: 18 additions & 0 deletions src/analyses/variable-sensitivity/abstract_object_set.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
\*******************************************************************/

#include <analyses/variable-sensitivity/abstract_object_set.h>
#include <analyses/variable-sensitivity/interval_abstract_value.h>
#include <util/interval.h>
#include <util/string_utils.h>

static bool by_length(const std::string &lhs, const std::string &rhs)
Expand Down Expand Up @@ -34,3 +36,19 @@ void abstract_object_sett::output(

join_strings(out, output_values.begin(), output_values.end(), ", ");
}

abstract_object_pointert abstract_object_sett::to_interval()
{
PRECONDITION(!values.empty());

exprt lower_expr = first()->to_constant();
exprt upper_expr = first()->to_constant();
for(const auto &value : values)
{
const auto &value_expr = value->to_constant();
lower_expr = constant_interval_exprt::get_min(lower_expr, value_expr);
upper_expr = constant_interval_exprt::get_max(upper_expr, value_expr);
}
return std::make_shared<interval_abstract_valuet>(
constant_interval_exprt(lower_expr, upper_expr));
}
15 changes: 15 additions & 0 deletions src/analyses/variable-sensitivity/abstract_object_set.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ class abstract_object_sett
{
values.insert(rhs.begin(), rhs.end());
}
void insert(const value_ranget &rhs)
{
for(auto const &value : rhs)
insert(value);
}

abstract_object_pointert first() const
{
Expand Down Expand Up @@ -67,9 +72,19 @@ class abstract_object_sett
return values == rhs.values;
}

void clear()
{
values.clear();
}

void
output(std::ostream &out, const ai_baset &ai, const namespacet &ns) const;

/// Cast the set of values \p other_values to an interval.
/// \param other_values: the value-set to be abstracted into an interval
/// \return the interval-abstract-object containing \p other_values
abstract_object_pointert to_interval();

private:
value_sett values;
};
Expand Down
Loading