22 #ifndef OTAWA_DFA_ABSINTLITE_H_
23 #define OTAWA_DFA_ABSINTLITE_H_
25 #include <elm/genstruct/VectorQueue.h>
26 #include <elm/util/BitVector.h>
28 namespace otawa {
namespace dfa {
30 #ifdef OTAWA_AIL_DEBUG
31 # define OTAWA_AILD(x) x
33 # define OTAWA_AILD(x)
37 template <
class G,
class T>
42 vals =
new typename T::t[
g.count()];
45 inline void push(
typename G::Vertex v) {
52 inline typename G::Vertex
pop(
void) {
53 typename G::Vertex v =
todo.
get();
61 for(
int i = 0; i <
g.count(); i++)
62 d.set(
vals[i],
d.bottom());
65 d.set(
vals[
g.index(
g.entry())],
d.initial());
72 for(
typename G::Successor succ(
g,
g.entry()); succ; succ++)
73 push(
g.sinkOf(*succ));
79 typename G::Vertex v =
pop();
85 inline void step(
typename G::Vertex v) {
102 for(
typename G::Successor succ(
g, v); succ; succ++) {
103 push(
g.sinkOf(*succ));
109 inline const typename T::t&
in(
typename G::Vertex v) {
110 d.set(
tmp,
d.bottom());
111 for(
typename G::Predecessor pred(
g, v); pred; pred++) {
112 d.set(
t2,
vals[
g.index(
g.sourceOf(*pred))]);
119 if(
g.isLoopHeader(v))
124 inline const typename T::t&
out(
typename G::Vertex v)
const {
125 return vals[
g.index(v)];
134 inline typename T::t&
item(
void) {
if(
i == -1)
return tmp;
else return vals[
i]; }
151 template <
class G,
class D>
154 typedef typename D::t
t;
159 inline bool equals(
const t& v1,
const t& v2) {
return dom.equals(v1, v2); }
160 inline void set(
t& d,
const t& s) {
dom.set(d, s); }
162 inline void update(
typename G::Vertex v,
t &d) {
dom.update(v, d); }
163 inline void filter(
typename G::Edge e,
t &d) { }
164 inline void widen(
typename G::Vertex v,
t &d) { }
170 template <
class G,
class T>
AbsIntLiteEx(const G &graph, T &domain)
Definition: AbsIntLite.h:41
const T::t & out(typename G::Vertex v) const
Definition: AbsIntLite.h:124
void dump(io::Output &out, const t &v)
Definition: AbsIntLite.h:161
const T::t & in(typename G::Vertex v)
Definition: AbsIntLite.h:109
G::Vertex pop(void)
Definition: AbsIntLite.h:52
void step(typename G::Vertex v)
Definition: AbsIntLite.h:85
#define OTAWA_AILD(x)
Definition: AbsIntLite.h:33
void widen(typename G::Vertex v, t &d)
Definition: AbsIntLite.h:164
void push(typename G::Vertex v)
Definition: AbsIntLite.h:45
int i
Definition: AbsIntLite.h:137
t initial(void)
Definition: AbsIntLite.h:156
DomainIter(const DomainIter &iter)
Definition: AbsIntLite.h:131
void set(t &d, const t &s)
Definition: AbsIntLite.h:160
bool bit(int index) const
T::t t2
Definition: AbsIntLite.h:144
const AbsIntLiteEx & ail
Definition: AbsIntLite.h:136
void join(t &d, const t &s)
Definition: AbsIntLite.h:158
T::t * vals
Definition: AbsIntLite.h:143
T & d
Definition: AbsIntLite.h:142
BitVector set
Definition: AbsIntLite.h:146
AbsIntLiteExtender< G, T > e
Definition: AbsIntLite.h:175
T::t tmp
Definition: AbsIntLite.h:144
Definition: AbsIntLite.h:128
AbsIntLite(const G &graph, T &domain)
Build the analyzer.
Definition: AbsIntLite.h:173
D & dom
Definition: AbsIntLite.h:166
This class provides a light implementation for abstract interpretation.
Definition: AbsIntLite.h:171
void next(void)
Definition: AbsIntLite.h:133
void set(int index) const
sys::SystemOutStream & out
void clear(int index) const
bool equals(const t &v1, const t &v2)
Definition: AbsIntLite.h:159
DomainIter(const AbsIntLiteEx &_ail)
Definition: AbsIntLite.h:130
t bottom(void)
Definition: AbsIntLite.h:157
void update(typename G::Vertex v, t &d)
Definition: AbsIntLite.h:162
AbsIntLiteExtender(D &domain)
Definition: AbsIntLite.h:155
void filter(typename G::Edge e, t &d)
Definition: AbsIntLite.h:163
genstruct::VectorQueue< typename G::Vertex > todo
Definition: AbsIntLite.h:145
T::t & item(void)
Definition: AbsIntLite.h:134
void process(void)
Definition: AbsIntLite.h:58
Definition: AbsIntLite.h:38
bool ended(void) const
Definition: AbsIntLite.h:132
D::t t
Definition: AbsIntLite.h:154
Definition: AbsIntLite.h:152
const G & g
Definition: AbsIntLite.h:141