Skip to content

Commit 5ea6df5

Browse files
committed
Change region_contextt to liveness_contextt
1 parent f786079 commit 5ea6df5

10 files changed

+44
-43
lines changed

regression/goto-analyzer/region-tracking/test-region-tracking.desc renamed to regression/goto-analyzer/liveness/test-liveness.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
CORE
22
main.c
3-
--variable-sensitivity --vsd-values set-of-constants --vsd-region-tracking --show
3+
--variable-sensitivity --vsd-values set-of-constants --vsd-liveness --show
44
^EXIT=0$
55
^SIGNAL=0$
66
^main::1::x .* value-set-begin: 2, 3 :value-set-end @ \[7\]

src/analyses/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ SRC = ai.cpp \
4545
variable-sensitivity/full_array_abstract_object.cpp \
4646
variable-sensitivity/full_struct_abstract_object.cpp \
4747
variable-sensitivity/interval_abstract_value.cpp \
48-
variable-sensitivity/region_context.cpp \
48+
variable-sensitivity/liveness_context.cpp \
4949
variable-sensitivity/three_way_merge_abstract_interpreter.cpp \
5050
variable-sensitivity/two_value_pointer_abstract_object.cpp \
5151
variable-sensitivity/value_set_abstract_object.cpp \

src/analyses/variable-sensitivity/region_context.cpp renamed to src/analyses/variable-sensitivity/liveness_context.cpp

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
77
\*******************************************************************/
88

9-
#include "region_context.h"
9+
#include "liveness_context.h"
1010

11-
abstract_objectt::locationt region_contextt::get_location() const
11+
abstract_objectt::locationt liveness_contextt::get_location() const
1212
{
1313
return *assign_location;
1414
}
@@ -29,7 +29,7 @@ abstract_objectt::locationt region_contextt::get_location() const
2929
* \return the abstract_objectt representing the result of writing
3030
* to a specific component.
3131
*/
32-
abstract_object_pointert region_contextt::write(
32+
abstract_object_pointert liveness_contextt::write(
3333
abstract_environmentt &environment,
3434
const namespacet &ns,
3535
const std::stack<exprt> &stack,
@@ -47,12 +47,13 @@ abstract_object_pointert region_contextt::write(
4747
// Need to ensure the result of the write is still wrapped in a dependency
4848
// context
4949
const auto &result =
50-
std::dynamic_pointer_cast<region_contextt>(mutable_clone());
50+
std::dynamic_pointer_cast<liveness_contextt>(mutable_clone());
5151

5252
result->set_child(updated_child);
5353

5454
// Update the child and record the updated write locations
55-
auto value_context = std::dynamic_pointer_cast<const region_contextt>(value);
55+
auto value_context =
56+
std::dynamic_pointer_cast<const liveness_contextt>(value);
5657
if(value_context)
5758
result->set_location(value_context->get_location());
5859

@@ -69,11 +70,11 @@ abstract_object_pointert region_contextt::write(
6970
* \return the result of the merge, or 'this' if the merge would not change
7071
* the current abstract object
7172
*/
72-
abstract_object_pointert region_contextt::merge(
73+
abstract_object_pointert liveness_contextt::merge(
7374
const abstract_object_pointert &other,
7475
const widen_modet &widen_mode) const
7576
{
76-
auto cast_other = std::dynamic_pointer_cast<const region_contextt>(other);
77+
auto cast_other = std::dynamic_pointer_cast<const liveness_contextt>(other);
7778

7879
if(cast_other)
7980
{
@@ -97,26 +98,27 @@ abstract_objectt::combine_result object_meet(
9798
}
9899

99100
abstract_object_pointert
100-
region_contextt::meet(const abstract_object_pointert &other) const
101+
liveness_contextt::meet(const abstract_object_pointert &other) const
101102
{
102-
auto cast_other = std::dynamic_pointer_cast<const region_contextt>(other);
103+
auto cast_other = std::dynamic_pointer_cast<const liveness_contextt>(other);
103104

104105
if(cast_other)
105106
return combine(cast_other, object_meet);
106107

107108
return abstract_objectt::meet(other);
108109
}
109110

110-
abstract_object_pointert
111-
region_contextt::combine(const region_context_ptrt &other, combine_fn fn) const
111+
abstract_object_pointert liveness_contextt::combine(
112+
const region_context_ptrt &other,
113+
combine_fn fn) const
112114
{
113115
auto combined_child = fn(child_abstract_object, other->child_abstract_object);
114116
auto location_match = get_location() == other->get_location();
115117

116118
if(combined_child.modified || location_match)
117119
{
118120
const auto &result =
119-
std::dynamic_pointer_cast<region_contextt>(mutable_clone());
121+
std::dynamic_pointer_cast<liveness_contextt>(mutable_clone());
120122
result->set_child(combined_child.object);
121123
result->reset_location();
122124
return result;
@@ -125,21 +127,21 @@ region_contextt::combine(const region_context_ptrt &other, combine_fn fn) const
125127
return shared_from_this();
126128
}
127129

128-
void region_contextt::reset_location()
130+
void liveness_contextt::reset_location()
129131
{
130132
assign_location.reset();
131133
}
132134

133135
context_abstract_objectt::context_abstract_object_ptrt
134-
region_contextt::update_location_context_internal(
136+
liveness_contextt::update_location_context_internal(
135137
const locationst &locations) const
136138
{
137-
auto result = std::dynamic_pointer_cast<region_contextt>(mutable_clone());
139+
auto result = std::dynamic_pointer_cast<liveness_contextt>(mutable_clone());
138140
result->set_location(*locations.cbegin());
139141
return result;
140142
}
141143

142-
void region_contextt::set_location(const locationt &location)
144+
void liveness_contextt::set_location(const locationt &location)
143145
{
144146
assign_location.emplace(location);
145147
}
@@ -152,7 +154,7 @@ void region_contextt::set_location(const locationt &location)
152154
* (that contains the object ... )
153155
* \param ns the current namespace
154156
*/
155-
void region_contextt::output(
157+
void liveness_contextt::output(
156158
std::ostream &out,
157159
const ai_baset &ai,
158160
const namespacet &ns) const
@@ -175,14 +177,14 @@ void region_contextt::output(
175177
* \return true if 'this' is considered to have been modified in comparison
176178
* to 'before', false otherwise.
177179
*/
178-
bool region_contextt::has_been_modified(
180+
bool liveness_contextt::has_been_modified(
179181
const abstract_object_pointert &before) const
180182
{
181183
if(this == before.get())
182184
return false;
183185

184186
auto before_context =
185-
std::dynamic_pointer_cast<const region_contextt>(before);
187+
std::dynamic_pointer_cast<const liveness_contextt>(before);
186188

187189
if(!before_context)
188190
{
@@ -204,12 +206,12 @@ bool region_contextt::has_been_modified(
204206
}
205207

206208
abstract_object_pointert
207-
region_contextt::merge_location_context(const locationt &location) const
209+
liveness_contextt::merge_location_context(const locationt &location) const
208210
{
209211
if(assign_location.has_value())
210212
return shared_from_this();
211213

212-
auto update = std::dynamic_pointer_cast<region_contextt>(mutable_clone());
214+
auto update = std::dynamic_pointer_cast<liveness_contextt>(mutable_clone());
213215
update->assign_location = location;
214216
return update;
215217
}

src/analyses/variable-sensitivity/region_context.h renamed to src/analyses/variable-sensitivity/liveness_context.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*******************************************************************\
22
3-
Module: analyses variable-sensitivity region_context
3+
Module: analyses variable-sensitivity liveness_contextt
44
55
Author: Jez Higgins
66
@@ -9,11 +9,11 @@
99
/**
1010
* \file
1111
* Maintain a context in the variable sensitvity domain that records
12-
* the assignment region for a given abstract_objectt.
12+
* the liveness region for a given abstract_objectt.
1313
*/
1414

15-
#ifndef CPROVER_ANALYSES_VARIABLE_SENSITIVITY_REGION_CONTEXT_H
16-
#define CPROVER_ANALYSES_VARIABLE_SENSITIVITY_REGION_CONTEXT_H
15+
#ifndef CPROVER_ANALYSES_VARIABLE_SENSITIVITY_LIVENESS_CONTEXT_H
16+
#define CPROVER_ANALYSES_VARIABLE_SENSITIVITY_LIVENESS_CONTEXT_H
1717

1818
#include <analyses/variable-sensitivity/context_abstract_object.h>
1919
#include <iostream>
@@ -30,17 +30,17 @@
3030
* of this, 'context_abstract_objectt<T>' which provides the same
3131
* constructors as the standard 'abstract_objectt' class.
3232
*/
33-
class region_contextt : public context_abstract_objectt
33+
class liveness_contextt : public context_abstract_objectt
3434
{
3535
public:
36-
explicit region_contextt(
36+
explicit liveness_contextt(
3737
const abstract_object_pointert child,
3838
const typet &type)
3939
: context_abstract_objectt(child, type)
4040
{
4141
}
4242

43-
region_contextt(
43+
liveness_contextt(
4444
const abstract_object_pointert child,
4545
const typet &type,
4646
bool top,
@@ -49,7 +49,7 @@ class region_contextt : public context_abstract_objectt
4949
{
5050
}
5151

52-
explicit region_contextt(
52+
explicit liveness_contextt(
5353
const abstract_object_pointert child,
5454
const exprt &expr,
5555
const abstract_environmentt &environment,
@@ -58,7 +58,7 @@ class region_contextt : public context_abstract_objectt
5858
{
5959
}
6060

61-
virtual ~region_contextt()
61+
virtual ~liveness_contextt()
6262
{
6363
}
6464

@@ -94,7 +94,7 @@ class region_contextt : public context_abstract_objectt
9494
using combine_fn = std::function<abstract_objectt::combine_result(
9595
const abstract_object_pointert &op1,
9696
const abstract_object_pointert &op2)>;
97-
using region_context_ptrt = std::shared_ptr<const region_contextt>;
97+
using region_context_ptrt = std::shared_ptr<const liveness_contextt>;
9898

9999
abstract_object_pointert
100100
combine(const region_context_ptrt &other, combine_fn fn) const;
@@ -107,4 +107,4 @@ class region_contextt : public context_abstract_objectt
107107
void set_location(const locationt &location);
108108
};
109109

110-
#endif // CPROVER_ANALYSES_VARIABLE_SENSITIVITY_REGION_CONTEXT_H
110+
#endif // CPROVER_ANALYSES_VARIABLE_SENSITIVITY_LIVENESS_CONTEXT_H

src/analyses/variable-sensitivity/variable_sensitivity_configuration.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ vsd_configt vsd_configt::from_options(const optionst &options)
3535
config.context_tracking.last_write_context = true;
3636
config.context_tracking.data_dependency_context =
3737
options.get_bool_option("data-dependencies");
38-
config.context_tracking.region_context =
39-
options.get_bool_option("region-tracking");
38+
config.context_tracking.liveness = options.get_bool_option("liveness");
4039

4140
config.flow_sensitivity = (options.get_bool_option("flow-insensitive"))
4241
? flow_sensitivityt::insensitive

src/analyses/variable-sensitivity/variable_sensitivity_configuration.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ struct vsd_configt
5353

5454
struct
5555
{
56-
bool region_context;
56+
bool liveness;
5757
bool data_dependency_context;
5858
bool last_write_context;
5959
} context_tracking;

src/analyses/variable-sensitivity/variable_sensitivity_domain.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
"(vsd-unions):" \
8080
"(vsd-flow-insensitive)" \
8181
"(vsd-data-dependencies)" \
82-
"(vsd-region-tracking)"
82+
"(vsd-liveness)"
8383
// clang-format off
8484
#define HELP_VSD \
8585
" --vsd-values value tracking - constants|intervals|set-of-constants\n" /* NOLINT(whitespace/line_length) */ \
@@ -89,7 +89,7 @@
8989
" --vsd-unions union sensitive analysis - top-bottom\n" \
9090
" --vsd-flow-insensitive disables flow sensitivity\n" \
9191
" --vsd-data-dependencies track data dependencies\n" \
92-
" --vsd-region-tracking track SSA regions\n" \
92+
" --vsd-liveness track variable liveness\n" \
9393

9494
// cland-format on
9595

@@ -101,7 +101,7 @@
101101
options.set_option("unions", cmdline.get_value("vsd-unions")); \
102102
options.set_option("flow-insensitive", cmdline.isset("vsd-flow-insensitive")); /* NOLINT(whitespace/line_length) */ \
103103
options.set_option("data-dependencies", cmdline.isset("vsd-data-dependencies")); /* NOLINT(whitespace/line_length) */ \
104-
options.set_option("region-tracking", cmdline.isset("vsd-region-tracking")); /* NOLINT(whitespace/line_length) */ \
104+
options.set_option("liveness", cmdline.isset("vsd-liveness")); /* NOLINT(whitespace/line_length) */ \
105105
(void)0
106106

107107
class variable_sensitivity_domaint : public ai_domain_baset

src/analyses/variable-sensitivity/variable_sensitivity_object_factory.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
\*******************************************************************/
88
#include "variable_sensitivity_object_factory.h"
99
#include "full_array_abstract_object.h"
10-
#include "region_context.h"
10+
#include "liveness_context.h"
1111
#include "value_set_pointer_abstract_object.h"
1212

1313
template <class context_classt>
@@ -38,8 +38,8 @@ abstract_object_pointert wrap_with_context_object(
3838
const abstract_object_pointert &abstract_object,
3939
const vsd_configt &configuration)
4040
{
41-
if(configuration.context_tracking.region_context)
42-
return create_context_abstract_object<region_contextt>(abstract_object);
41+
if(configuration.context_tracking.liveness)
42+
return create_context_abstract_object<liveness_contextt>(abstract_object);
4343

4444
if(configuration.context_tracking.data_dependency_context)
4545
return create_context_abstract_object<data_dependency_contextt>(

0 commit comments

Comments
 (0)