Skip to content

Commit f0a40b4

Browse files
Document renaming_level struct
1 parent f619dd1 commit f0a40b4

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

src/goto-symex/renaming_level.h

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,34 +18,41 @@ Author: Romain Brenguier, [email protected]
1818
#include <util/irep.h>
1919
#include <util/ssa_expr.h>
2020

21+
/// Wrapper for a \c current_names map, which maps each identifier to an SSA
22+
/// expression and a counter.
2123
struct renaming_levelt
2224
{
2325
virtual ~renaming_levelt() = default;
2426

27+
/// Map identifier to ssa_exprt and counter
2528
typedef std::map<irep_idt, std::pair<ssa_exprt, unsigned>> current_namest;
2629
current_namest current_names;
2730

31+
/// Counter corresponding to an identifier
2832
unsigned current_count(const irep_idt &identifier) const
2933
{
3034
const auto it = current_names.find(identifier);
3135
return it == current_names.end() ? 0 : it->second.second;
3236
}
3337

38+
/// Increase the counter corresponding to an identifier
3439
void increase_counter(const irep_idt &identifier)
3540
{
3641
PRECONDITION(current_names.find(identifier) != current_names.end());
3742
++current_names[identifier].second;
3843
}
3944

45+
/// Add the \c ssa_exprt of current_names to vars
4046
void get_variables(std::unordered_set<ssa_exprt, irep_hash> &vars) const
4147
{
4248
for(const auto &pair : current_names)
4349
vars.insert(pair.second.first);
4450
}
4551
};
4652

47-
// level 0 -- threads!
48-
// renaming built for one particular interleaving
53+
/// Functor to set the level 0 renaming of SSA expressions.
54+
/// Level 0 corresponds to threads.
55+
/// The renaming is built for one particular interleaving.
4956
struct symex_level0t : public renaming_levelt
5057
{
5158
void
@@ -55,20 +62,23 @@ struct symex_level0t : public renaming_levelt
5562
~symex_level0t() override = default;
5663
};
5764

58-
// level 1 -- function frames
59-
// this is to preserve locality in case of recursion
60-
65+
/// Functor to set the level 1 renaming of SSA expressions.
66+
/// Level 1 corresponds to function frames.
67+
/// This is to preserve locality in case of recursion
6168
struct symex_level1t : public renaming_levelt
6269
{
6370
void operator()(ssa_exprt &ssa_expr);
6471

72+
/// Insert the content of \p other into this renaming
6573
void restore_from(const current_namest &other);
6674

6775
symex_level1t() = default;
6876
~symex_level1t() override = default;
6977
};
7078

71-
// level 2 -- SSA
79+
/// Functor to set the level 2 renaming of SSA expressions.
80+
/// Level 2 corresponds to SSA.
81+
/// This is to ensure each variable is only assigned once.
7282
struct symex_level2t : public renaming_levelt
7383
{
7484
symex_level2t() = default;

0 commit comments

Comments
 (0)