Otawa  0.10
PCG.h
Go to the documentation of this file.
1 #ifndef OTAWA_TEST_PCG_PCG_H
2 #define OTAWA_TEST_PCG_PCG_H
3 
4 #include <otawa/cfg/BasicBlock.h>
5 #include <otawa/cfg/CFG.h>
6 #include <elm/genstruct/Vector.h>
7 #include <elm/PreIterator.h>
8 
9 #include "PCGBlock.h"
10 namespace otawa {
11 
12 using namespace elm::io;
13 
14 class PCG: public PropList {
15  CFG * cfg;
16 protected:
18 public :
19 
20  PCG(CFG * cfg):cfg(cfg){};
21  ~PCG(){};
22  //void PCG_Construction(BasicBlock* bb,CFG* cfg,PCGBuilder *PCGBD);
23  //void afficherPCG(FrameWork *fw,PCGBuilder * PCGBD);
24 
25  class PCGIterator: public elm::PreIterator<PCGIterator, PCGBlock *> {
27  int pos;
28  public:
29  inline PCGIterator(PCG *pcg):pcgbs(pcg->_pcgbs),pos(0){};
30  inline bool ended(void) const {return pos>=pcgbs.length();};
31  inline PCGBlock *item(void) const {return pcgbs[pos];};
32  inline void next(void) {pos++;};
33  };
34  void addPCGBlock(PCGBlock * pcgb){_pcgbs.add(pcgb);};
35  int nbPCGBlocks(void){return _pcgbs.length();};
36  elm::genstruct::Vector<PCGBlock *>& pcgbs(void) {return _pcgbs;};
37  CFG* getCFG(void) {return cfg;};
38 
39  // Hook identifier
40  static Identifier<PCG *> ID;
41 };
42 
43 inline Output& operator<<(Output& out, const PCG& pcg) {
44  out << "<not printable>";
45  return out;
46 }
47 
48 }
49 #endif
Definition: PCG.h:14
void addPCGBlock(PCGBlock *pcgb)
Definition: PCG.h:34
PCG(CFG *cfg)
Definition: PCG.h:20
Definition: PCG.h:25
int pos
Definition: PCG.h:27
elm::genstruct::Vector< PCGBlock * > & pcgbs
Definition: PCG.h:26
elm::io::Output & operator<<(elm::io::Output &out, Address addr)
Definition: base.cpp:188
Control Flow Graph representation.
Definition: CFG.h:42
PCGIterator(PCG *pcg)
Definition: PCG.h:29
void next(void)
Definition: PCG.h:32
Definition: PCGBlock.h:10
CFG * cfg
Definition: PCG.h:15
sys::SystemOutStream & out
Definition: ipet_parser.cpp:122
dtd::Element cfg(dtd::make("cfg", _CFG).attr(id).content((entry,*bb, exit,*edge)))
int nbPCGBlocks(void)
Definition: PCG.h:35
bool ended(void) const
Definition: PCG.h:30
This class represents identifier with a typed associated value.
Definition: Identifier.h:51
~PCG()
Definition: PCG.h:21
This a list of properties.
Definition: PropList.h:63
genstruct::Vector< PCGBlock * > _pcgbs
Definition: PCG.h:17
elm::genstruct::Vector< PCGBlock * > & pcgbs(void)
Definition: PCG.h:36
PCGBlock * item(void) const
Definition: PCG.h:31