Otawa  0.10
PCGBlock.h
Go to the documentation of this file.
1 #ifndef OTAWA_TEST_PCG_PCGBLOCK_H
2 #define OTAWA_TEST_PCG_PCGBLOCK_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 namespace otawa {
10 class PCGBlock: public PropList {
13  CFG* cfg;
14 public:
15  inline PCGBlock(BasicBlock *bb,CFG* cfg):bb(bb),cfg(cfg){};
16  virtual inline ~PCGBlock(void){};
17  inline void addInLink(PCGBlock *pcgb) { ins.add(pcgb); };
18  inline void addOutLink(PCGBlock *pcgb) { outs.add(pcgb); };
19  inline BasicBlock* getBB(void){return bb;};
20  inline address_t getAddress(){return cfg->address();};
21  inline String getName(){return cfg->label();};
24  inline CFG *getCFG(void) const { return cfg; }
25 
26  class PCGBlockInIterator: public elm::PreIterator<PCGBlockInIterator, PCGBlock *> {
28  int pos;
29  public:
30  inline PCGBlockInIterator(PCGBlock *pcgb): ins(pcgb->ins), pos(0){};
31  inline bool ended(void) const {return pos>=ins.length();};
32  inline PCGBlock *item(void) const {return ins[pos];};
33  inline void next(void) {pos++;};
34  };
35 
36  class PCGBlockOutIterator: public elm::PreIterator<PCGBlockOutIterator, PCGBlock *> {
38  int pos;
39  public:
40  inline PCGBlockOutIterator(PCGBlock* pcgb):outs(pcgb->outs),pos(0){};
41  inline bool ended(void) const {return pos>=outs.length();};
42  inline PCGBlock *item(void) const {return outs[pos];};
43  inline void next(void){pos++;};
44  };
45 };
46 
47 }
48 
49 #endif
elm::genstruct::Vector< PCGBlock * > ins
Definition: PCGBlock.h:12
Definition: PCGBlock.h:36
void next(void)
Definition: PCGBlock.h:33
virtual ~PCGBlock(void)
Definition: PCGBlock.h:16
int pos
Definition: PCGBlock.h:28
elm::genstruct::Vector< PCGBlock * > & outs
Definition: PCGBlock.h:37
PCGBlock * item(void) const
Definition: PCGBlock.h:42
bool ended(void) const
Definition: PCGBlock.h:31
PCGBlockInIterator(PCGBlock *pcgb)
Definition: PCGBlock.h:30
address_t address(void)
Get the address of the first instruction of the CFG.
Definition: CFG.cpp:404
Definition: PCGBlock.h:26
CFG * cfg
Definition: PCGBlock.h:13
elm::genstruct::Vector< PCGBlock * > & getFathers()
Definition: PCGBlock.h:22
Control Flow Graph representation.
Definition: CFG.h:42
PCGBlock(BasicBlock *bb, CFG *cfg)
Definition: PCGBlock.h:15
int pos
Definition: PCGBlock.h:38
void addInLink(PCGBlock *pcgb)
Definition: PCGBlock.h:17
address_t getAddress()
Definition: PCGBlock.h:20
elm::genstruct::Vector< PCGBlock * > & getSons()
Definition: PCGBlock.h:23
void next(void)
Definition: PCGBlock.h:43
BasicBlock * getBB(void)
Definition: PCGBlock.h:19
The representation of an address in OTAWA.
Definition: base.h:54
Definition: PCGBlock.h:10
BasicBlock * bb
Definition: PCGBlock.h:11
bool ended(void) const
Definition: PCGBlock.h:41
CFG * getCFG(void) const
Definition: PCGBlock.h:24
PCGBlockOutIterator(PCGBlock *pcgb)
Definition: PCGBlock.h:40
This is the minimal definition of a basic block.
Definition: BasicBlock.h:43
string label(void)
Get some label to identify the CFG.
Definition: CFG.cpp:368
elm::genstruct::Vector< PCGBlock * > & ins
Definition: PCGBlock.h:27
This a list of properties.
Definition: PropList.h:63
void addOutLink(PCGBlock *pcgb)
Definition: PCGBlock.h:18
String getName()
Definition: PCGBlock.h:21
elm::genstruct::Vector< PCGBlock * > outs
Definition: PCGBlock.h:12
PCGBlock * item(void) const
Definition: PCGBlock.h:32