24 #ifndef OTAWA_DFA_HAI_WIDENINGFIXPOINT_H_
25 #define OTAWA_DFA_HAI_WIDENINGFIXPOINT_H_
33 #include <elm/genstruct/Vector.h>
36 # define HAIW_TRACE(t) cerr << t;
38 # define HAIW_TRACE(t)
41 namespace otawa {
namespace dfa {
namespace hai {
43 template <
class Listener>
48 typedef typename Listener::Problem
Problem;
49 typedef typename Problem::Domain
Domain;
113 template <
class Listener >
119 template <
class Listener >
123 Domain newHeaderState(bottom());
128 assign(newHeaderState, ai->entryEdgeUnion(bb));
131 HAIW_TRACE(
"before widening, state + 1: " << newHeaderState << io::endl);
133 prob.widening(bb, newHeaderState, ai->backEdgeUnion(bb));
136 if (prob.equals(newHeaderState, fpstate->
headerState))
141 assign(in, newHeaderState);
142 HAIW_TRACE(
"after widening " << in << io::endl);
145 template <
class Listener >
163 prob.assign(**
STATE(e), s);
167 template <
class Listener >
173 template <
class Listener >
183 template <
class Listener >
185 return(prob.bottom());
188 template <
class Listener >
190 return(prob.entry());
193 template <
class Listener >
198 template <
class Listener >
203 template <
class Listener >
205 return (prob.equals(a,b));
208 template <
class Listener >
210 prob.update(out,in,bb);
213 template <
class Listener >
215 list.blockInterpreted(
this, bb, in, out, cur_cfg, callStack);
218 template <
class Listener >
220 list.fixPointReached(
this, bb);
223 template <
class Listener >
225 prob.enterContext(dom, bb, ctx);
228 template <
class Listener >
230 prob.leaveContext(dom, bb, ctx);
233 template <
class Listener >
235 prob.updateEdge(edge, dom);
dtd::Element edge(dtd::make("edge", _EDGE).attr(source).attr(target).attr(called))
Listener & list
Definition: WideningFixPoint.h:58
void fixPointReached(BasicBlock *bb) const
This listener is called whenever a fixpoint is reached for a loop.
Definition: WideningFixPoint.h:219
FixPointState * newState(void)
Definition: WideningFixPoint.h:70
void leaveContext(Domain &dom, BasicBlock *bb, hai_context_t ctx) const
This is called whenever we leave a loop.
Definition: WideningFixPoint.h:229
void init(HalfAbsInt< WideningFixPoint > *_ai)
Is called by HalfAbsInt for fixpoint object initializeation.
Definition: WideningFixPoint.h:114
const Domain & bottom(void) const
This function gets the bottom of the problem's lattice This is usually delegated to the Problem...
Definition: WideningFixPoint.h:184
void fixPoint(BasicBlock *bb, bool &fixpoint, Domain &in, bool firstTime) const
Main fixPoint function: is called by HalfAbsInt whenever the analysis reaches a loop header...
Definition: WideningFixPoint.h:120
void update(Domain &out, const Domain &in, BasicBlock *bb)
Is called whenever the analysis needs to get the Output state for a basic block, given its input stat...
Definition: WideningFixPoint.h:209
Domain headerState
Definition: WideningFixPoint.h:65
Definition: WideningFixPoint.h:44
bool equals(const Domain &a, const Domain &b) const
Tests a and b for equality.
Definition: WideningFixPoint.h:204
#define HAIW_TRACE(t)
Definition: WideningFixPoint.h:38
void updateEdge(Edge *edge, Domain &dom)
Definition: WideningFixPoint.h:234
FixPointState(const Domain &bottom)
Definition: WideningFixPoint.h:66
dtd::Element bb(dtd::make("bb", _BB).attr(id).attr(address).attr(size))
void unmarkEdge(PropList *e)
Unmark a proplist (typically an edge)
Definition: WideningFixPoint.h:168
Control Flow Graph representation.
Definition: CFG.h:42
void markEdge(PropList *e, const Domain &s)
Marks a proplist (typically an edge) e with state s.
Definition: WideningFixPoint.h:146
void enterContext(Domain &dom, BasicBlock *bb, hai_context_t ctx) const
This is called whenever we enter a loop.
Definition: WideningFixPoint.h:224
void lub(Domain &a, const Domain &b) const
Performs operation: a = a lub b This is delegated to the Problem.
Definition: WideningFixPoint.h:194
Implements abstract interpretation.
Definition: HalfAbsInt.h:64
Problem & prob
Definition: WideningFixPoint.h:57
Identifier< State * > STATE("otawa::stack::STATE", 0)
Stack analysis state at entry of BBs.
HalfAbsInt< WideningFixPoint > * ai
Definition: WideningFixPoint.h:59
Problem::Domain Domain
Definition: WideningFixPoint.h:49
sys::SystemOutStream & out
Domain * getMark(PropList *e)
Get the mark of a proplist (typically an edge)
Definition: WideningFixPoint.h:174
WideningFixPoint(Listener &_list)
Definition: WideningFixPoint.h:75
hai_context_t
Definition: HalfAbsInt.h:50
This class represents edges in the CFG representation.
Definition: Edge.h:33
void blockInterpreted(BasicBlock *bb, const Domain &in, const Domain &out, CFG *cur_cfg, elm::genstruct::Vector< Edge * > *callStack) const
This listener is called whenever HalfAbsInt has processed a basic block.
Definition: WideningFixPoint.h:214
This is the minimal definition of a basic block.
Definition: BasicBlock.h:43
static Identifier< Domain * > STATE
Definition: WideningFixPoint.h:56
This a list of properties.
Definition: PropList.h:63
const Domain & entry(void) const
This function returns the entry state of the whole program to be analyzed.
Definition: WideningFixPoint.h:189
~WideningFixPoint()
Definition: WideningFixPoint.h:80
Definition: WideningFixPoint.h:63
void assign(Domain &a, const Domain &b) const
Performs operation a = b This is delegated to the Problem.
Definition: WideningFixPoint.h:199
Listener::Problem Problem
Definition: WideningFixPoint.h:48