cprover
Toggle main menu visibility
Loading...
Searching...
No Matches
goto_symex_can_forward_propagate.h
Go to the documentation of this file.
1
/*******************************************************************\
2
3
Module: Symbolic Execution Constant Propagation
4
5
Author: Michael Tautschig, tautschn@amazon.com
6
7
\*******************************************************************/
8
11
12
#ifndef CPROVER_GOTO_SYMEX_GOTO_SYMEX_CAN_FORWARD_PROPAGATE_H
13
#define CPROVER_GOTO_SYMEX_GOTO_SYMEX_CAN_FORWARD_PROPAGATE_H
14
15
#include <
util/expr.h
>
16
#include <
util/expr_util.h
>
17
18
class
goto_symex_can_forward_propagatet
:
public
can_forward_propagatet
19
{
20
public
:
21
explicit
goto_symex_can_forward_propagatet
(
const
namespacet
&
ns
)
22
:
can_forward_propagatet
(
ns
)
23
{
24
}
25
26
protected
:
27
bool
is_constant
(
const
exprt
&expr)
const override
28
{
29
if
(expr.
id
() == ID_mult)
30
{
31
bool
found_non_constant =
false
;
32
33
// propagate stuff with sizeof in it
34
for
(
const
auto
&op : expr.
operands
())
35
{
36
if
(op.find(ID_C_c_sizeof_type).is_not_nil())
37
return
true
;
38
else
if
(!
is_constant
(op))
39
found_non_constant =
true
;
40
}
41
42
return
!found_non_constant;
43
}
44
else
if
(expr.
id
() == ID_with)
45
{
46
// this is bad
47
#if 0
48
for
(
const
auto
&op : expr.
operands
())
49
{
50
if
(!
is_constant
(op))
51
return
false
;
52
}
53
54
return
true
;
55
#else
56
return
false
;
57
#endif
58
}
59
60
return
can_forward_propagatet::is_constant
(expr);
61
}
62
};
63
64
#endif
// CPROVER_GOTO_SYMEX_GOTO_SYMEX_CAN_FORWARD_PROPAGATE_H
can_forward_propagatet::is_constant
virtual bool is_constant(const exprt &) const
This function determines what expressions are to be propagated as "constants".
Definition
expr_util.cpp:198
can_forward_propagatet::ns
const namespacet & ns
Definition
expr_util.h:100
can_forward_propagatet::can_forward_propagatet
can_forward_propagatet(const namespacet &ns)
Definition
expr_util.h:89
exprt
Base class for all expressions.
Definition
expr.h:57
exprt::operands
operandst & operands()
Definition
expr.h:95
goto_symex_can_forward_propagatet::goto_symex_can_forward_propagatet
goto_symex_can_forward_propagatet(const namespacet &ns)
Definition
goto_symex_can_forward_propagate.h:21
goto_symex_can_forward_propagatet::is_constant
bool is_constant(const exprt &expr) const override
This function determines what expressions are to be propagated as "constants".
Definition
goto_symex_can_forward_propagate.h:27
irept::id
const irep_idt & id() const
Definition
irep.h:388
namespacet
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
Definition
namespace.h:91
expr.h
expr_util.h
Deprecated expression utility functions.
goto-symex
goto_symex_can_forward_propagate.h
Generated by
1.17.0