00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef T1T2BLOCK_H_
00010 #define T1T2BLOCK_H_
00011 #include <set>
00012 #include <queue>
00013 #include <vector>
00014 #include <map>
00015 using namespace std;
00016
00017 namespace sail {
00018
00019 class T1T2Block;
00020 class BasicBlock;
00021 class CfgEdge;
00022 class Symbol;
00023 class Compare:public binary_function<T1T2Block*, T1T2Block*, bool> {
00024
00025 public:
00026 bool operator()(const T1T2Block* b1, const T1T2Block* b2) const;
00027 };
00028
00029 T1T2Block* make_T1T2Block(BasicBlock* b);
00030 void clear_map_t1t2();
00031
00032 class T1T2Block {
00033
00034 public:
00035 int pred_count;
00036 set<T1T2Block*> succs;
00037 set<T1T2Block*> preds;
00038 set<BasicBlock*> representees;
00039 BasicBlock* representative_block;
00040
00041 T1T2Block(BasicBlock *b);
00042 T1T2Block(const T1T2Block& other, T1T2Block* pred,
00043 BasicBlock* rep_block, set<BasicBlock*>& representatives);
00044 virtual ~T1T2Block();
00045
00046 void split_node(set<T1T2Block*, Compare>& heap,
00047 set<BasicBlock*>& blocks, BasicBlock* & old_exit,
00048 BasicBlock* & old_exception);
00049
00054 BasicBlock* copy_equivalence_class(BasicBlock* rep,
00055 set<BasicBlock*> & rep_class, set<BasicBlock*>& blocks,
00056 set<BasicBlock*> & exit_blocks, set<BasicBlock*> & exception_blocks,
00057 BasicBlock* & old_exit, BasicBlock* & old_exception);
00058
00059 set<CfgEdge*>* get_edges(set<BasicBlock*> & rep_class);
00060 BasicBlock* get_block(BasicBlock*old, set<BasicBlock*> & rep_class,
00061 set<BasicBlock*>& blocks, map<BasicBlock*, BasicBlock*> &old_to_new,
00062 set<BasicBlock*> & exit_blocks, set<BasicBlock*> & exception_blocks,
00063 BasicBlock* & old_exit, BasicBlock* & old_exception);
00064
00065 void merge(T1T2Block *other,
00066 set<T1T2Block*, Compare> & heap);
00067
00068 void clear_original_class(set<BasicBlock*>& blocks);
00069 void connect_blocks(BasicBlock* b1, BasicBlock*b2, Symbol* cond);
00070 };
00071
00072
00073 }
00074
00075
00076 #endif