File tree Expand file tree Collapse file tree 2 files changed +54
-35
lines changed Expand file tree Collapse file tree 2 files changed +54
-35
lines changed Original file line number Diff line number Diff line change
1
+ /* ******************************************************************\
2
+
3
+ Module: Symbolic Execution Constant Propagation
4
+
5
+ Author: Michael Tautschig, [email protected]
6
+
7
+ \*******************************************************************/
8
+
9
+ // / \file
10
+ // / GOTO Symex constant propagation
11
+
12
+ #ifndef CPROVER_GOTO_SYMEX_GOTO_SYMEX_IS_CONSTANT_H
13
+ #define CPROVER_GOTO_SYMEX_GOTO_SYMEX_IS_CONSTANT_H
14
+
15
+ #include < util/expr.h>
16
+ #include < util/expr_util.h>
17
+
18
+ class goto_symex_is_constantt : public is_constantt
19
+ {
20
+ protected:
21
+ bool is_constant (const exprt &expr) const override
22
+ {
23
+ if (expr.id () == ID_mult)
24
+ {
25
+ // propagate stuff with sizeof in it
26
+ forall_operands (it, expr)
27
+ {
28
+ if (it->find (ID_C_c_sizeof_type).is_not_nil ())
29
+ return true ;
30
+ else if (!is_constant (*it))
31
+ return false ;
32
+ }
33
+
34
+ return true ;
35
+ }
36
+ else if (expr.id () == ID_with)
37
+ {
38
+ // this is bad
39
+ /*
40
+ forall_operands(it, expr)
41
+ if(!is_constant(expr.op0()))
42
+ return false;
43
+
44
+ return true;
45
+ */
46
+ return false ;
47
+ }
48
+
49
+ return is_constantt::is_constant (expr);
50
+ }
51
+ };
52
+
53
+ #endif // CPROVER_GOTO_SYMEX_GOTO_SYMEX_IS_CONSTANT_H
Original file line number Diff line number Diff line change 10
10
// / Symbolic Execution
11
11
12
12
#include " goto_symex_state.h"
13
+ #include " goto_symex_is_constant.h"
13
14
14
15
#include < cstdlib>
15
16
#include < iostream>
@@ -130,41 +131,6 @@ static bool check_renaming(const exprt &expr)
130
131
return false ;
131
132
}
132
133
133
- class goto_symex_is_constantt : public is_constantt
134
- {
135
- protected:
136
- bool is_constant (const exprt &expr) const override
137
- {
138
- if (expr.id () == ID_mult)
139
- {
140
- // propagate stuff with sizeof in it
141
- forall_operands (it, expr)
142
- {
143
- if (it->find (ID_C_c_sizeof_type).is_not_nil ())
144
- return true ;
145
- else if (!is_constant (*it))
146
- return false ;
147
- }
148
-
149
- return true ;
150
- }
151
- else if (expr.id () == ID_with)
152
- {
153
- // this is bad
154
- /*
155
- forall_operands(it, expr)
156
- if(!is_constant(expr.op0()))
157
- return false;
158
-
159
- return true;
160
- */
161
- return false ;
162
- }
163
-
164
- return is_constantt::is_constant (expr);
165
- }
166
- };
167
-
168
134
template <>
169
135
renamedt<ssa_exprt, L0>
170
136
goto_symex_statet::set_indices<L0>(ssa_exprt ssa_expr, const namespacet &ns)
You can’t perform that action at this time.
0 commit comments