Go to the documentation of this file.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 #ifndef anl_varlist_INCLUDED
00038 #define anl_varlist_INCLUDED
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053 #include "array_set.h"
00054
00055 class ANL_FUNC_ENTRY;
00056
00057 #define ANL_VAR_READ 0x00000001
00058 #define ANL_VAR_WRITTEN 0x00000002
00059
00060
00061 class ANL_VAR
00062 {
00063 private:
00064 ST *_st;
00065 ANL_VAR *_alias;
00066 UINT32 _status;
00067
00068 public:
00069
00070
00071
00072 ANL_VAR(): _st(NULL), _alias(this), _status(0) {}
00073 ANL_VAR(ST *st): _st(st), _alias(this), _status(0) {}
00074
00075
00076
00077
00078 INT32 Id() const {return (_st==NULL? 0 : ST_st_idx(_st));}
00079 BOOL operator==(const ANL_VAR &v) const {return Id() == v.Id();}
00080 BOOL operator!=(const ANL_VAR &v) const {return Id() != v.Id();}
00081 BOOL operator<(const ANL_VAR &v) const {return Id() < v.Id();}
00082 BOOL operator<=(const ANL_VAR &v) const {return Id() <= v.Id();}
00083 BOOL operator>(const ANL_VAR &v) const {return Id() > v.Id();}
00084 BOOL operator>=(const ANL_VAR &v) const {return Id() >= v.Id();}
00085
00086 BOOL Is_Read() {return ((_status & ANL_VAR_READ) != 0);}
00087 BOOL Is_Written() {return ((_status & ANL_VAR_WRITTEN) != 0);}
00088
00089
00090
00091
00092 ANL_VAR &operator=(const ANL_VAR &v)
00093 {
00094 _st = v._st;
00095 _status = v._status;
00096 return *this;
00097 }
00098
00099 void Set_Name_Alias(ANL_VAR *var);
00100
00101 void Set_Read() {_status = (_status | ANL_VAR_READ);}
00102 void Set_Written() {_status = (_status | ANL_VAR_WRITTEN);}
00103
00104 void Reset_References();
00105
00106
00107
00108
00109 void Write(ANL_CBUF *cbuf, ANL_FUNC_ENTRY *_func_entry);
00110
00111 };
00112
00113
00114 class ANL_VARLIST
00115 {
00116 private:
00117
00118 ARRAY_SET<ANL_VAR*> _vlist;
00119 ANL_FUNC_ENTRY *_func_entry;
00120 MEM_POOL *_pool;
00121
00122 mUINT32 _Binary_Search(INT32 id, mUINT32 from, mUINT32 till);
00123
00124 UINT32 _Get_Io_Item_Lda_Access_Status(WN *io_item);
00125
00126 UINT32 _Get_Lda_Access_Status(WN *lda);
00127
00128 public:
00129
00130
00131
00132 ANL_VARLIST(MEM_POOL *pool, ANL_FUNC_ENTRY *func_entry):
00133 _vlist(pool),
00134 _pool(pool),
00135 _func_entry(func_entry)
00136 {}
00137
00138 ~ANL_VARLIST()
00139 {
00140 for (INT i = 0; i < _vlist.Size(); i++)
00141 CXX_DELETE(_vlist.Indexed_Get(i), _pool);
00142 }
00143
00144
00145
00146
00147 ANL_VAR *Find(ST *st);
00148 ANL_VAR *Find_or_Insert(ST *st);
00149
00150
00151
00152
00153 void Insert_Var_Refs(WN *subtree);
00154
00155
00156
00157
00158 void Write(ANL_CBUF *cbuf, INT64 construct_id);
00159
00160
00161 };
00162
00163 #endif