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
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053 #ifndef opt_rvitab_INCLUDED
00054 #define opt_rvitab_INCLUDED "opt_rvitab.h"
00055 #ifdef _KEEP_RCS_ID
00056 static char *opt_rvitabrcs_id = opt_rvitab_INCLUDED"$ $Revision$";
00057 #endif
00058
00059 #ifndef wn_INCLUDED
00060 #include "wn.h"
00061 #endif // wn_INCLUDED
00062 #ifndef mempool_INCLUDED
00063 #include "mempool.h"
00064 #endif // mempool_INCLUDED
00065 #ifndef stab_INCLUDED
00066 #include "stab.h"
00067 #endif // stab_INCLUDED
00068 #ifndef opt_array_INCLUDED
00069 #include "opt_array.h"
00070 #endif // opt_array_INCLUDED
00071
00072
00073
00074 class ALIAS_MANAGER;
00075 class RVI_LR;
00076 class RVI_LR_LIST;
00077 class RVI_LRBB;
00078
00079
00080
00081
00082 class RVI_NODE : public SLIST_NODE {
00083 private:
00084 IDX_32 _bitpos;
00085 WN *_loadwn;
00086 WN *_storewn;
00087 RVI_LRBB_LIST *_appearances;
00088 RVI_LR_LIST *_live_ranges;
00089
00090 RVI_NODE( void );
00091 RVI_NODE& operator = (const RVI_NODE&);
00092 public:
00093 RVI_NODE( IDX_32 bp, WN *loadwn, WN *storewn ) :
00094 _bitpos(bp), _loadwn(loadwn), _storewn(storewn)
00095 { _live_ranges = NULL;
00096 _appearances = NULL;
00097 }
00098 ~RVI_NODE( void )
00099 {}
00100
00101
00102 IDX_32 Bitpos( void ) const
00103 { return _bitpos; }
00104 WN *Loadwn( void ) const
00105 { return _loadwn; }
00106 void Set_loadwn( WN *loadwn )
00107 { _loadwn = loadwn; }
00108 WN *Storewn( void ) const
00109 { return _storewn; }
00110 void Set_storewn( WN *storewn )
00111 { _storewn = storewn; }
00112 RVI_LRBB_LIST *Appearances( void )
00113 { return _appearances; }
00114 void Set_appearances( RVI_LRBB_LIST *appearances )
00115 { _appearances = appearances; }
00116 RVI_LR_LIST *Live_ranges( void ) const
00117 { return _live_ranges; }
00118 void Set_live_ranges( RVI_LR_LIST *live_ranges )
00119 { _live_ranges = live_ranges; }
00120
00121
00122 MTYPE Mtype( void ) const;
00123
00124 ST *St( void ) const;
00125
00126 const char *Name( void ) const;
00127
00128 WN *New_home_wn( ALIAS_MANAGER * ) const;
00129
00130
00131 BOOL Match_constant( const WN *wn ) const;
00132
00133
00134 void Add_reference( BB_NODE *bb, BOOL is_load, MEM_POOL *pool );
00135
00136
00137
00138
00139 BOOL Is_volatile( void ) const;
00140
00141
00142 WN *Create_load( INT32 preg, ALIAS_MANAGER *alias_mgr ) const;
00143
00144 WN *Create_store( INT32 preg, ALIAS_MANAGER *alias_mgr ) const;
00145
00146
00147 void Print( FILE *fp = stderr ) const;
00148 };
00149
00150
00151
00152 class RVI_NODE_LIST : public SLIST {
00153 private:
00154 RVI_NODE_LIST(const RVI_NODE_LIST&);
00155 RVI_NODE_LIST& operator = (const RVI_NODE_LIST&);
00156
00157 DECLARE_SLIST_CLASS(RVI_NODE_LIST,RVI_NODE)
00158
00159 public:
00160 ~RVI_NODE_LIST(void) {}
00161 };
00162
00163
00164
00165
00166 class RVI_NODE_ITER : public SLIST_ITER {
00167 DECLARE_SLIST_ITER_CLASS(RVI_NODE_ITER, RVI_NODE, RVI_NODE_LIST)
00168 public:
00169 void Init( void ) const {}
00170 };
00171
00172
00173
00174
00175 class RVI_CTAB {
00176 friend class RVI_CTAB_ITER;
00177 private:
00178 ARRAY<RVI_NODE_LIST *> _ctab;
00179 MEM_POOL *_mem_pool;
00180
00181 RVI_CTAB( void );
00182 RVI_CTAB& operator = (const RVI_CTAB&);
00183
00184 public:
00185
00186 RVI_CTAB( MEM_POOL *mem_pool );
00187 ~RVI_CTAB( void );
00188
00189
00190
00191 RVI_NODE *Find( const WN *wn, IDX_32 hash_val ) const;
00192
00193
00194 RVI_NODE *Add_unique( WN *wn, IDX_32 bitpos, IDX_32 hash_val ) const;
00195
00196
00197 IDX_32 Hash( const WN *wn ) const;
00198
00199
00200 void Print( FILE *fp = stderr ) const;
00201 };
00202
00203
00204
00205
00206 class RVI_CTAB_ITER {
00207 private:
00208 const RVI_CTAB*_ctab;
00209 INT _ctab_index;
00210 RVI_NODE_ITER _cnode_iter;
00211 RVI_NODE *_cnode;
00212 BOOL _did_first;
00213
00214 RVI_CTAB_ITER& operator = (const RVI_CTAB_ITER&);
00215
00216 public:
00217 void Init( const RVI_CTAB *ctab )
00218 { _ctab = ctab;
00219 _ctab_index = 0;
00220 _cnode = NULL;
00221 _did_first = FALSE;
00222 }
00223
00224 RVI_CTAB_ITER( void )
00225 { Init( NULL ); }
00226 RVI_CTAB_ITER( const RVI_CTAB *ctab )
00227 { Init( ctab ); }
00228 ~RVI_CTAB_ITER( void ) {}
00229
00230 RVI_NODE *First( void );
00231 RVI_NODE *Next( void );
00232 BOOL Is_Empty( void );
00233 };
00234
00235
00236
00237
00238 class RVI_VTAB {
00239 private:
00240 ARRAY<RVI_NODE *> _vtab;
00241 INT32 _size;
00242 MEM_POOL *_mem_pool;
00243
00244 RVI_VTAB( void );
00245 RVI_VTAB& operator = (const RVI_VTAB&);
00246
00247 public:
00248
00249
00250 RVI_VTAB( INT num_vars, MEM_POOL *mem_pool );
00251 ~RVI_VTAB( void );
00252
00253 INT32 Size( void ) const
00254 { return _size; }
00255
00256
00257
00258 RVI_NODE *Find( IDX_32 bitpos ) const
00259 { return _vtab[bitpos]; }
00260
00261
00262
00263 RVI_NODE *Find_match( const WN *wn ) const;
00264
00265
00266 RVI_NODE *Add_store( WN *storewn, IDX_32 bitpos ) const;
00267 RVI_NODE *Add_load( WN *loadwn, IDX_32 bitpos ) const;
00268
00269
00270 void Print( FILE *fp = stderr ) const;
00271 };
00272
00273
00274
00275
00276 class RVI_VTAB_ITER {
00277 private:
00278 const RVI_VTAB*_vtab;
00279 INT _vtab_index;
00280 RVI_NODE *_vnode;
00281 BOOL _did_first;
00282
00283 RVI_VTAB_ITER& operator = (const RVI_VTAB_ITER&);
00284
00285 public:
00286 void Init( const RVI_VTAB *vtab )
00287 { _vtab = vtab;
00288 _vtab_index = 0;
00289 _vnode = NULL;
00290 _did_first = FALSE;
00291 }
00292
00293 RVI_VTAB_ITER( void )
00294 { Init( NULL ); }
00295 RVI_VTAB_ITER( const RVI_VTAB *vtab )
00296 { Init( vtab ); }
00297 ~RVI_VTAB_ITER( void ) {}
00298
00299 RVI_NODE *First( void );
00300 RVI_NODE *Next( void );
00301 BOOL Is_Empty( void );
00302 };
00303
00304 #endif // opt_rvitab_INCLUDED