7 #ifndef OTAWA_DFA_XCFG_VISITOR_H
8 #define OTAWA_DFA_XCFG_VISITOR_H
10 #include <elm/assert.h>
13 #include <elm/genstruct/FragTable.h>
15 #include <elm/util/Pair.h>
17 namespace otawa {
namespace dfa {
20 using namespace elm::genstruct;
22 extern Identifier<int>
INDEX;
47 {
return dom.gen(cfgs[nodes[node].
cfg], nodes[node].
bb); }
49 {
return dom.preserve(cfgs[nodes[node].
cfg], nodes[node].
bb); }
55 inline int size(
void) {
return nodes.length(); }
65 offs(new int[cfgs.count() + 1]),
66 preds(new
Vector<int>[cfgs.count()])
80 int bbi = 0, cfgi = 0;
84 nodes[bbi].cfg = cfgi;
90 int called_index =
INDEX(called);
93 offs[called_index + 1] - 1;
126 node_t info = nodes[node];
129 for(
int i = 0; i < pred.
length(); i++)
130 engine.nextPred(pred[i]);
132 else if(info.
from != -1)
133 engine.nextPred(info.
from);
136 engine.nextPred(offs[info.
cfg] +
edge->source()->number());
146 #endif // OTAWA_DFA_XCFG_VISITOR_H
int cfg
Definition: XCFGVisitor.h:29
int from
Definition: XCFGVisitor.h:29
dtd::Element edge(dtd::make("edge", _EDGE).attr(source).attr(target).attr(called))
This class implements the visitor concept of XIterativeDFA class and allows applying an analysis on a...
Definition: XCFGVisitor.h:26
~XCFGVisitor(void)
Definition: XCFGVisitor.h:111
void visitSuccs(XIterativeDFA< XCFGVisitor< P > > &engine, int node)
Definition: XCFGVisitor.h:141
domain_t * gen(int node)
Definition: XCFGVisitor.h:46
Kind of an edge matching a sub-program call.
Definition: Edge.h:40
int size(void)
Definition: XCFGVisitor.h:55
Identifier< int > INDEX
Identifier used for storing in each basic block from the CFG its index.
Definition: CFG.h:39
const CFGCollection & cfgs
Definition: XCFGVisitor.h:33
dtd::Element bb(dtd::make("bb", _BB).attr(id).attr(address).attr(size))
Control Flow Graph representation.
Definition: CFG.h:42
bool isEntry(void) const
Test if the basic block is the CFG entry.
Definition: BasicBlock.h:136
FragTable< node_t > nodes
Definition: XCFGVisitor.h:34
dtd::RefAttr< CFG * > called("called", dtd::STRICT)
domain_t * preserve(int node)
Definition: XCFGVisitor.h:48
void free(domain_t *d)
Definition: XCFGVisitor.h:45
Contains a collection of CFGs (used with INVOLVED_CFGS property).
Definition: features.h:45
Definition: BasicBlock.h:165
int number(void) const
Get the number hooked on this basic block, that is, value of ID_Index property.
Definition: BasicBlock.h:146
node_t(void)
Definition: XCFGVisitor.h:30
int * offs
Definition: XCFGVisitor.h:35
domain_t * empty(void)
Definition: XCFGVisitor.h:44
Vector< int > * preds
Definition: XCFGVisitor.h:36
Iterator on the CFG contained in a CFGCollection.
Definition: features.h:54
void visitPreds(XIterativeDFA< XCFGVisitor< P > > &engine, int node)
Definition: XCFGVisitor.h:124
Definition: BasicBlock.h:160
P::domain_t domain_t
Definition: XCFGVisitor.h:43
Identifier< int > INDEX
Identifier used for internal use.
dtd::Element cfg(dtd::make("cfg", _CFG).attr(id).content((entry,*bb, exit,*edge)))
BasicBlock * bb
Definition: XCFGVisitor.h:28
int index(const key_t &key)
Definition: XCFGVisitor.h:52
This is the minimal definition of a basic block.
Definition: BasicBlock.h:43
P & dom
Definition: XCFGVisitor.h:32
int to
Definition: XCFGVisitor.h:29
The DFAEngine implements an extended Iterative Data Flow Algorithm, that is, it work on graphs with a...
Definition: XIterativeDFA.h:16
Pair< CFG *, BasicBlock * > key_t
Definition: XCFGVisitor.h:51
XCFGVisitor(const CFGCollection &cfgs, P &domain)
Build the visitor to apply on the given domain and CFG collection.
Definition: XCFGVisitor.h:62
Definition: XCFGVisitor.h:27