00001 #ifndef _Loop_h_ 00002 #define _Loop_h_ 00003 00004 #include <Base.h> 00005 #include <BitSet.h> 00006 #include <Function.h> 00007 00008 class Loop : public Base { 00009 protected: 00010 uint32_t index; 00011 FlowGraph* flowGraph; 00012 BitSet<BasicBlock*>* blocks; 00013 BasicBlock* head; 00014 BasicBlock* tail; 00015 public: 00016 Loop(BasicBlock* h, BasicBlock* t, FlowGraph* cfg, BitSet<BasicBlock*>* newBlocks); 00017 ~Loop(); 00018 BasicBlock* getHead() { return head; } 00019 BasicBlock* getTail() { return tail; } 00020 uint32_t getNumberOfBlocks() { return blocks->size(); } 00021 uint32_t getAllBlocks(BasicBlock** arr); 00022 bool isBlockIn(uint32_t idx) { return blocks->contains(idx); } 00023 bool isInnerLoop(Loop* loop); 00024 bool isIdenticalLoop(Loop* loop); 00025 void print(); 00026 void setIndex(uint32_t idx) { index = idx; } 00027 uint32_t getIndex() { return index; } 00028 }; 00029 00030 #endif // _Loop_h_ 00031