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
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096 #ifndef lego_opts_INCLUDED
00097 #define lego_opts_INCLUDED "lego_opts.h"
00098
00099 #ifdef _KEEP_RCS_ID
00100 static char *lego_opts_rcs_id = access_vector_INCLUDED "$Source$ $Revision$";
00101 #endif
00102
00103 #include "access_vector.h"
00104 #include "stab.h"
00105 #include "wn.h"
00106 #include "lego_affinity.h"
00107
00108 class LEGO_INFO {
00109 BOOL _dynamic_affinity;
00110 SYMBOL *_array;
00111 INT32 _dim_num;
00112 INT32 _stride;
00113 INT32 _offset;
00114 INT32 _front_peel;
00115 INT32 _back_peel;
00116 INT32 _min_offset;
00117 INT32 _max_offset;
00118 BOOL _too_messy;
00119
00120 SYMBOL *_pid_sym0;
00121 SYMBOL *_pid_sym1;
00122 SYMBOL *_local_index_sym;
00123
00124 SYMBOL *_runtime_lb_sym;
00125 SYMBOL *_runtime_ub_sym;
00126 SYMBOL *_runtime_step_sym;
00127
00128 DYN_ARRAY<WN*> _local_index_wn;
00129
00130 public:
00131 LEGO_INFO(SYMBOL *array);
00132 LEGO_INFO(SYMBOL *array, INT32 dim, INT32 stride, INT32 offset);
00133 LEGO_INFO(SYMBOL *array, INT32 dim, INT32 stride, INT32 offset,
00134 INT32 front_peel, INT32 back_peel);
00135 LEGO_INFO(LEGO_INFO* lego_info, MEM_POOL *pool);
00136 ~LEGO_INFO();
00137 void Init(SYMBOL *array, INT32 dim, INT32 stride, INT32 offset,
00138 INT32 front_peel, INT32 back_peel);
00139
00140 BOOL Dynamic_Affinity () const { return _dynamic_affinity; }
00141 void Set_Dynamic_Affinity () { _dynamic_affinity = TRUE; }
00142 SYMBOL *Array() const { return _array; }
00143 INT32 Dim_Num() const { return _dim_num; }
00144 INT32 Stride() const { return _stride; }
00145 INT32 Offset() const { return _offset; }
00146 INT32 Front_Peel() const { return _front_peel; }
00147 INT32 Back_Peel() const { return _back_peel; }
00148 INT32 Min_Offset() const { return _min_offset; }
00149 INT32 Max_Offset() const { return _max_offset; }
00150 BOOL Is_Too_Messy() const { return _too_messy; }
00151
00152 SYMBOL *Pid_Sym0() const { return _pid_sym0; }
00153 SYMBOL *Pid_Sym1() const { return _pid_sym1; }
00154
00155 SYMBOL *Runtime_Lb_Sym() const { return _runtime_lb_sym; }
00156 SYMBOL *Runtime_Ub_Sym() const { return _runtime_ub_sym; }
00157 SYMBOL *Runtime_Step_Sym() const { return _runtime_step_sym; }
00158 void Set_Runtime_Lb_Sym(SYMBOL *lb_sym) { _runtime_lb_sym = lb_sym; }
00159 void Set_Runtime_Ub_Sym(SYMBOL *ub_sym) { _runtime_ub_sym = ub_sym; }
00160 void Set_Runtime_Step_Sym(SYMBOL *step_sym) { _runtime_step_sym = step_sym; }
00161
00162 SYMBOL *Local_Index_Sym() const { return _local_index_sym; }
00163 WN *Local_Index_WN(INT i) const { return _local_index_wn[i]; }
00164 BOOL Has_Local_Index() const { return (_local_index_sym != NULL); }
00165 INT64 Get_Local_Step(WN *doloop);
00166
00167 WN *Pid0(WN* curr_wn);
00168 WN *Pid1(WN* curr_wn);
00169 WN *Local_Index();
00170
00171 void Set_Front_Peel(INT32 front_peel) { _front_peel = front_peel; }
00172 void Set_Back_Peel(INT32 back_peel) { _back_peel = back_peel; }
00173 void Set_Min_Offset(INT32 min_offset) { _min_offset = min_offset; }
00174 void Set_Max_Offset(INT32 max_offset) { _max_offset = max_offset; }
00175 void Set_Too_Messy() { _too_messy = TRUE; }
00176 void Set_Pid0(SYMBOL *pid_sym);
00177 void Set_Pid1(SYMBOL *pid_sym);
00178 void Create_Local_Index(WN *doloop);
00179
00180 void Print(FILE* fp);
00181 };
00182
00183 extern BOOL Loop_Bounds_Simple(const WN *doloop);
00184 extern WN *Generate_Bounds(const WN *doloop,
00185 SYMBOL **new_lb, SYMBOL **new_ub,
00186 SYMBOL **new_step, INT bound = 0);
00187
00188 extern BOOL disable_divmod_opts;
00189 extern BOOL disable_rr_maps;
00190 extern WN_MAP RR_Map;
00191
00192 class RR_DIM {
00193 INT _offset;
00194 WN* _do_wn;
00195 INT _index;
00196 RR_DIM (const RR_DIM&);
00197 RR_DIM* operator= (const RR_DIM&);
00198 public:
00199 RR_DIM (void) {}
00200 void Init (INT offset, WN* do_wn, INT index) {
00201 _offset = offset;
00202 _do_wn = do_wn;
00203 _index = index;
00204 }
00205 void Init (RR_DIM* rrdim) {
00206 _offset = rrdim->_offset;
00207 _do_wn = rrdim->_do_wn;
00208 _index = rrdim->_index;
00209 }
00210 void Remotize () { _do_wn = NULL; }
00211 WN* Do_Loop () const { return _do_wn; }
00212 INT Index () const { return _index; }
00213 void Print (FILE* fp) {
00214 fprintf (fp, "offset %d proc_wn 0x%p index %d\n", _offset, _do_wn, _index);
00215 }
00216 };
00217
00218 class RR_INFO {
00219 INT _ndims;
00220 RR_DIM* _rrdim;
00221 RR_INFO (void);
00222 RR_INFO (const RR_INFO&);
00223 RR_INFO* operator= (const RR_INFO&);
00224 public:
00225 RR_INFO (INT ndims);
00226 RR_INFO (RR_INFO* rri);
00227 ~RR_INFO ();
00228 RR_DIM* Dim(INT i) const { return &(_rrdim[i]); }
00229 void Print (FILE* fp) {
00230 fprintf (fp, "RR_Map\n");
00231 for (INT i=0; i<_ndims; i++) {
00232 fprintf (fp, "\t%d: ", i);
00233 _rrdim[i].Print(fp);
00234 }
00235 }
00236 };
00237
00238 extern RR_INFO* Get_RR_Map (WN* wn);
00239 extern void Set_RR_Map (WN* wn, RR_INFO* rri);
00240 extern void Pre_Peel_RR_Map_Update (WN* do_wn, WN* prev_wn, BOOL create_loop);
00241 extern void Post_Peel_RR_Map_Update (WN* do_wn, WN* next_wn, BOOL create_loop);
00242 extern WN* Interleaved_Pragma_Chunksize(const WN* wn_loop, DU_MANAGER* du);
00243
00244 #endif
00245
00246
00247
00248