00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef opt_wovp_INCLUDED
00028 #define opt_wovp_INCLUDED "opt_wovp.h"
00029
00030 #include "opt_bb.h"
00031 #include "cxx_memory.h"
00032 #include "opt_cfg.h"
00033 #include "opt_sym.h"
00034 #include "opt_htable.h"
00035 #include "errors.h"
00036 #include "defs.h"
00037 #include "vector"
00038
00039 using namespace std;
00040
00041 class WO_LOC{
00042 private:
00043 IDTYPE _lhs_aux_id;
00044 IDTYPE _rhs_aux_id;
00045 STMTREP* _stmtrep;
00046 BOOL _promote;
00047 public:
00048 WO_LOC(IDTYPE l, IDTYPE r, STMTREP* st){
00049 _lhs_aux_id = l;
00050 _rhs_aux_id = r;
00051 _stmtrep = st;
00052 _promote = FALSE;
00053 }
00054 ~WO_LOC(){}
00055 IDTYPE& Get_lid() {return _lhs_aux_id;}
00056 IDTYPE& Get_rid() {return _rhs_aux_id;}
00057 STMTREP* Get_stmt() {return _stmtrep;}
00058 BOOL Get_promote() {return _promote;}
00059 void Set_promote(BOOL p) {_promote = p;}
00060 };
00061
00062 class WOVP{
00063 private:
00064 vector<WO_LOC*> _wovp_loc;
00065 MEM_POOL _pool;
00066 CFG *_cfg;
00067 OPT_STAB *_opt_stab;
00068
00069 void Add_wo_loc(IDTYPE l, IDTYPE r, STMTREP* stmt)
00070 {
00071 Is_True(stmt!=NULL, ("StmtREP is NULL"));
00072 _wovp_loc.push_back(CXX_NEW(WO_LOC(l, r, stmt), &_pool));
00073 }
00074 CODEREP* Find_by_id(CODEREP *cr, IDTYPE id);
00075 void Print_wo_loc(FILE *fp=stderr);
00076 BOOL Write_once_check(IDTYPE id, BB_LIST_CONTAINER *bb_queue);
00077
00078 public:
00079 WOVP(CFG *cfg, OPT_STAB *opt_stab)
00080 {
00081 _cfg = cfg;
00082 _opt_stab = opt_stab;
00083 MEM_POOL_Initialize(&_pool, "WOVP_pool", FALSE);
00084 MEM_POOL_Push(&_pool);
00085 }
00086 ~WOVP()
00087 {
00088 MEM_POOL_Pop(&_pool);
00089 MEM_POOL_Delete(&_pool);
00090 }
00091
00092 void Find_mm_pair();
00093 BOOL Is_write_once(IDTYPE id);
00094 void Promote(void);
00095 void Do_wovp();
00096 };
00097 #endif // opt_wovp_INCLUDE