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
00234 #ifndef sdlist_INCLUDED
00235 #define sdlist_INCLUDED "sdlist.h"
00236
00237 #ifndef cxx_hash_INCLUDED
00238 #include "cxx_hash.h"
00239 #endif
00240
00241 #define SD_HASH_SIZE 512
00242
00243 class SD_PNODE : public CHAIN_NODE {
00244 private:
00245 SYMBOL _symbol;
00246 mINT8 _innermost_depth;
00247 BOOL _above;
00248 HASH_TABLE<WN*,INT> _in_closure;
00249 public:
00250 SD_PNODE(const SYMBOL& symbol, INT innermost_depth, BOOL above);
00251 ~SD_PNODE() {}
00252 const SYMBOL& Symbol() const {return _symbol;}
00253 mINT8 Innermost_Depth() const {return _innermost_depth;}
00254 void Set_Innermost_Depth(INT v) {_innermost_depth = v;}
00255 BOOL Above() {return _above;}
00256 void Set_Above(BOOL v) {_above = v;}
00257 void Add_Closure(WN* wn) {_in_closure.Enter(wn, 1);}
00258 BOOL In_Closure(WN* wn) {return _in_closure.Find(wn);}
00259 void Print(FILE* fp) const;
00260 };
00261
00262 class SD_PLIST: public CHAIN {
00263 DECLARE_CHAIN_CLASS(SD_PLIST, SD_PNODE);
00264 private:
00265 MEM_POOL* _pool;
00266 public:
00267 SD_PLIST(MEM_POOL* pool) : _pool(pool), CHAIN() {}
00268 SD_PNODE* Find(const SYMBOL& sym);
00269 const SD_PNODE* Find(const SYMBOL& sym) const;
00270 void Print(FILE *fp) const;
00271 MEM_POOL* Pool() {return _pool;}
00272 ~SD_PLIST();
00273 };
00274
00275 class SD_PITER: public CHAIN_ITER {
00276 DECLARE_CHAIN_ITER_CLASS(SD_PITER, SD_PNODE, SD_PLIST)
00277 public:
00278 ~SD_PITER() {}
00279 };
00280
00281 class SD_CONST_PITER: public CHAIN_ITER {
00282 DECLARE_CHAIN_CONST_ITER_CLASS(SD_CONST_PITER, SD_PNODE, SD_PLIST)
00283 public:
00284 ~SD_CONST_PITER() {}
00285 };
00286
00287 class SD_INFO {
00288 private:
00289 WN* _wn_outer;
00290 mINT8 _max_inner_depth;
00291 BOOL Is_Worst_Case(SD_PNODE* sd_ref)
00292 {return sd_ref->Innermost_Depth() == _max_inner_depth;}
00293 BOOL Update(SD_PNODE* sd_ref, WN* wn);
00294 void Set_Worst_Case(SD_PNODE* sd_ref);
00295 BOOL Push_Memory_Nodes(WN* wn_orig, SD_PNODE* sd_ref, STACK<WN*>* st_closure);
00296 BOOL Register_Ldid(WN* wn_ldid, SD_PNODE* sd_ref);
00297 BOOL Register_Stid(WN* wn_stid, SD_PNODE* sd_ref);
00298 BOOL Register_ILoad(WN* wn_iload, SD_PNODE* sd_ref);
00299 BOOL Register_IStore(WN* wn_istore, SD_PNODE* sd_ref);
00300 BOOL Closure_Ldid(WN* wn_ldid, SD_PNODE* sd_ref, STACK<WN*>* st_closure);
00301 BOOL Closure_Stid(WN* wn_stid, SD_PNODE* sd_ref, STACK<WN*>* st_closure);
00302 BOOL Closure_ILoad(WN* wn_iload, SD_PNODE* sd_ref, STACK<WN*>* st_closure);
00303 BOOL Closure_IStore(WN* wn_istore, SD_PNODE* sd_ref, STACK<WN*>* st_closure);
00304 void Closure(WN* wn_ref);
00305 void Handle_Def(WN* wn);
00306 public:
00307 SD_PLIST Plist;
00308 SD_INFO(MEM_POOL* pool) : Plist(pool) {}
00309 ~SD_INFO() {}
00310 SD_PNODE* Find(const SYMBOL& sym);
00311 const SD_PNODE* Find(const SYMBOL& sym) const;
00312 void Enter(const SYMBOL& symbol, INT innermost_depth, BOOL above);
00313 void Create(const SYMBOL& symbol, WN* wn);
00314 void Remove(SD_PNODE* sdn);
00315 void Print(FILE* fp) const;
00316 void Make_Sd_Info(WN* wn_outer, INT nloops);
00317 INT Distribution_Range(INT depth, SX_INFO* sx_info);
00318 };
00319
00320 #endif