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 #ifndef intrn_info_INCLUDED
00040 #define intrn_info_INCLUDED "intrn_info.h"
00041
00042 #include "defs.h"
00043 #include "wintrinsic.h"
00044
00045
00046
00047
00048 typedef enum INTRN_RETKIND {
00049 IRETURN_UNKNOWN,
00050 IRETURN_V,
00051 IRETURN_I1,
00052 IRETURN_I2,
00053 IRETURN_I4,
00054 IRETURN_I8,
00055 IRETURN_U1,
00056 IRETURN_U2,
00057 IRETURN_U4,
00058 IRETURN_U8,
00059 IRETURN_F4,
00060 IRETURN_F8,
00061 IRETURN_FQ,
00062 IRETURN_C4,
00063 IRETURN_C8,
00064 IRETURN_CQ,
00065 IRETURN_PV,
00066 IRETURN_PU1,
00067 IRETURN_DA1,
00068 IRETURN_SZT,
00069 IRETURN_PC,
00070 IRETURN_F10,
00071 #ifdef TARG_X8664
00072 IRETURN_V16I2,
00073 IRETURN_V16I4,
00074 IRETURN_V16F4,
00075 IRETURN_V16F8,
00076 IRETURN_V16C8,
00077 IRETURN_M8I1,
00078 IRETURN_M8I2,
00079 IRETURN_M8I4,
00080 IRETURN_V16I8,
00081 IRETURN_V16I1,
00082 #endif
00083 IRETURN_PPU2,
00084 IRETURN_PPI4,
00085 } INTRN_RETKIND;
00086 #define INTRN_RETKIND_LAST IRETURN_F10
00087
00088
00089 #define BYVAL TRUE
00090 #define NOT_BYVAL FALSE
00091 #define PURE TRUE
00092 #define NOT_PURE FALSE
00093 #define NO_SIDEEFFECTS TRUE
00094 #define SIDEEFFECTS FALSE
00095 #define NEVER_RETURN TRUE
00096 #define DOES_RETURN FALSE
00097 #define ACTUAL TRUE
00098 #define NOT_ACTUAL FALSE
00099 #define CGINTRINSIC TRUE
00100 #define NOT_CGINTRINSIC FALSE
00101
00102 #ifdef TARG_SL
00103 #define NOT_SLAVE FALSE
00104 #define SLAVE TRUE
00105 #else
00106 #define NOT_SLAVE CGINTRINSIC
00107 #define SLAVE NOT_CGINTRINSIC
00108 #endif
00109
00110
00111 typedef struct intrn_info_t {
00112 mBOOL is_by_val;
00113 mBOOL is_pure;
00114 mBOOL has_no_side_effects;
00115 mBOOL never_returns;
00116 mBOOL is_actual;
00117 mBOOL is_cg_intrinsic;
00118 mBOOL slave;
00119 INTRN_RETKIND return_kind;
00120 const char *c_name;
00121 const char *specific_name;
00122 const char *runtime_name;
00123 } intrn_info_t;
00124
00125 extern const intrn_info_t intrn_info[];
00126
00127 inline BOOL INTRN_by_value (const INTRINSIC i)
00128 {
00129 return intrn_info[i].is_by_val;
00130 }
00131
00132 inline BOOL INTRN_is_pure (const INTRINSIC i)
00133 {
00134 return intrn_info[i].is_pure;
00135 }
00136
00137 inline BOOL INTRN_has_no_side_effects (const INTRINSIC i)
00138 {
00139 return intrn_info[i].has_no_side_effects;
00140 }
00141
00142 inline BOOL INTRN_never_returns (const INTRINSIC i)
00143 {
00144 return intrn_info[i].never_returns;
00145 }
00146
00147 inline BOOL INTRN_is_actual (const INTRINSIC i)
00148 {
00149 return intrn_info[i].is_actual;
00150 }
00151
00152 inline BOOL INTRN_cg_intrinsic (const INTRINSIC i)
00153 {
00154 return intrn_info[i].is_cg_intrinsic;
00155 }
00156
00157 inline INTRN_RETKIND INTRN_return_kind (const INTRINSIC i)
00158 {
00159 return intrn_info[i].return_kind;
00160 }
00161
00162 inline const char * INTRN_c_name (const INTRINSIC i)
00163 {
00164 return intrn_info[i].c_name;
00165 }
00166
00167 inline const char * INTRN_specific_name (const INTRINSIC i)
00168 {
00169 return intrn_info[i].specific_name;
00170 }
00171
00172 inline const char * INTRN_rt_name (const INTRINSIC i)
00173 {
00174 return intrn_info[i].runtime_name;
00175 }
00176 inline const char * INTRINSIC_name (const INTRINSIC i)
00177 {
00178 if (INTRN_c_name(i))
00179 return INTRN_c_name(i);
00180 else if (INTRN_rt_name(i))
00181 return INTRN_rt_name(i);
00182 else
00183 return intrn_info[i].specific_name;
00184 }
00185
00186 #if defined(TARG_SL)
00187 inline BOOL INTRN_is_sl (const INTRINSIC i)
00188 {
00189 if(i>=INTRN_SL_INTRN_BGN && i<=INTRN_SL_INTRN_END)
00190 return TRUE;
00191 else
00192 return FALSE;
00193 }
00194
00195 inline BOOL INTRN_is_slave (const INTRINSIC i)
00196 {
00197 return intrn_info[i].slave;
00198 }
00199
00200 inline BOOL INTRN_copy_addr(const INTRINSIC i)
00201 {
00202 if(i==INTRN_C3_INIT_ADDR || i==INTRN_C3_SAVE_ADDR ||
00203 i==INTRN_VBUF_OFFSET || i==INTRN_SBUF_OFFSET)
00204 return TRUE;
00205 return FALSE;
00206 }
00207
00208 #define SL_MAX_MEMOP_COUNT 2
00209
00210 typedef struct {
00211 INTRINSIC id;
00212 BOOL specific;
00213 BOOL like_store;
00214 INT32 memop_count;
00215 INT32 addr_id[SL_MAX_MEMOP_COUNT];
00216 struct{
00217 INT32 sw_id;
00218 INT32 macro_id;
00219 INT32 size_id;
00220 INT32 size_coeff;
00221 INT32 size_stride;
00222 BOOL maybe_strided;
00223 } mem_spec;
00224 } sl_intrn_meminfo_t;
00225
00226 #define INVALID_PID -1
00227 #define SL_INTRN_MEMINFO_LAST 27
00228 static sl_intrn_meminfo_t sl_intrn_meminfo_tab[SL_INTRN_MEMINFO_LAST] = {
00229
00230 INTRN_C3_SET_CIRCBUF, FALSE, FALSE, 2, {3, 4}, {0},
00231 INTRN_C3DMAC_A, FALSE, FALSE, 2, {2, 4}, {0},
00232 INTRN_C3DMULA_A, FALSE, FALSE, 1, {2, INVALID_PID}, {0},
00233 INTRN_C3LD, FALSE, FALSE, 1, {0, INVALID_PID}, {0},
00234 INTRN_C3ST, FALSE, TRUE, 1, {1, INVALID_PID}, {0},
00235 INTRN_C3MAC_A, FALSE, FALSE, 2, {2, 4}, {0},
00236 INTRN_C3MAC_AR, FALSE, FALSE, 1, {3, INVALID_PID}, {0},
00237 INTRN_C3MULA_A, FALSE, FALSE, 1, {2, 4}, {0},
00238 INTRN_C3MULA_AR, FALSE, FALSE, 1, {3, INVALID_PID}, {0},
00239 INTRN_C3SAADD_A, FALSE, FALSE, 2, {0, 2}, {0},
00240 INTRN_C3SAADDH_A, FALSE, FALSE, 2, {0, 2}, {0},
00241 INTRN_C3SADDA_A, FALSE, FALSE, 1, {2, INVALID_PID}, {0},
00242 INTRN_C3SAMULH_A, FALSE, FALSE, 2, {0, 2}, {0},
00243
00244 INTRN_C2_LD_V, TRUE, FALSE, 1, {1, INVALID_PID}, {2, 3, 5, 16, 0, FALSE},
00245 INTRN_C2_LD_G, TRUE, FALSE, 1, {0, INVALID_PID}, {INVALID_PID, INVALID_PID, 3, 1, 0, FALSE},
00246 INTRN_C2_LD_V2G, TRUE, FALSE, 1, {0, INVALID_PID}, {INVALID_PID, INVALID_PID, 2, 1, 16, TRUE},
00247 INTRN_C2_LD_V_IMM, TRUE, FALSE, 1, {4, INVALID_PID}, {INVALID_PID, 1, 3, 16, 0, FALSE},
00248 INTRN_C2_LD_C_IMM, TRUE, FALSE, 1, {1, INVALID_PID}, {INVALID_PID, INVALID_PID, INVALID_PID, 1, 0, FALSE},
00249 INTRN_C2_LD_G_IMM, TRUE, FALSE, 1, {2, INVALID_PID}, {INVALID_PID, INVALID_PID, 1, 1, 0, FALSE},
00250 INTRN_C2_LD_V2G_IMM, TRUE, FALSE, 1, {2, INVALID_PID}, {INVALID_PID, INVALID_PID, 1, 1, 16, TRUE},
00251 INTRN_C2_ST_V, TRUE, TRUE, 1, {1, INVALID_PID}, {INVALID_PID, 2, 3, 16, 0, FALSE},
00252 INTRN_C2_ST_G, TRUE, TRUE, 1, {1, INVALID_PID}, {INVALID_PID, INVALID_PID, 3, 1, 0, FALSE},
00253 INTRN_C2_ST_G2V, TRUE, TRUE, 1, {1, INVALID_PID}, {INVALID_PID, INVALID_PID, 2, 1, 16, TRUE},
00254 INTRN_C2_ST_V_IMM, TRUE, TRUE, 1, {3, INVALID_PID}, {INVALID_PID, 2, 1, 16, 0, FALSE},
00255 INTRN_C2_ST_C_IMM, TRUE, TRUE, 1, {1, INVALID_PID}, {INVALID_PID, INVALID_PID, INVALID_PID, 1, 0, FALSE},
00256 INTRN_C2_ST_G_IMM, TRUE, TRUE, 1, {2, INVALID_PID}, {INVALID_PID, INVALID_PID, 1, 1, 0, FALSE},
00257 INTRN_C2_ST_G2V_IMM, TRUE, TRUE, 1, {2, INVALID_PID}, {INVALID_PID, INVALID_PID, 1, 1, 16, TRUE},
00258 };
00259
00260
00261 inline INT32 INTRN_vbuf_linesize()
00262 {
00263 return 16;
00264 }
00265
00266 inline INT32 INTRN_vbuf_sw_crossline_size()
00267 {
00268 return 28;
00269 }
00270
00271 inline INT32 INTRN_vbuf_sw_crossline_hintbofs()
00272 {
00273 return 4;
00274 }
00275
00276 inline INT32 INTRN_vbuf_sw_crossline_hinthrd()
00277 {
00278 return 3;
00279 }
00280
00281 inline INT32 INTRN_get_max_scalar_size()
00282 {
00283 return 4;
00284 }
00285
00286 inline BOOL INTRN_carry_memop(INTRINSIC intrn)
00287 {
00288 for(INT i=0;i<SL_INTRN_MEMINFO_LAST;i++) {
00289 if(sl_intrn_meminfo_tab[i].id==intrn)
00290 return TRUE;
00291 }
00292 return FALSE;
00293 }
00294
00295 inline BOOL INTRN_like_store(INTRINSIC intrn) {
00296 for(INT i=0;i<SL_INTRN_MEMINFO_LAST;i++) {
00297 if(sl_intrn_meminfo_tab[i].id==intrn && sl_intrn_meminfo_tab[i].like_store==TRUE)
00298 return TRUE;
00299 }
00300 return FALSE;
00301 }
00302
00303 inline BOOL INTRN_specify_memop(INTRINSIC intrn)
00304 {
00305 for(INT i=0;i<SL_INTRN_MEMINFO_LAST;i++) {
00306 if(sl_intrn_meminfo_tab[i].id==intrn && sl_intrn_meminfo_tab[i].specific==TRUE)
00307 return TRUE;
00308 }
00309 return FALSE;
00310 }
00311
00312 inline INT32 INTRN_get_memop_count(INTRINSIC intrn)
00313 {
00314 for(INT i=0;i<SL_INTRN_MEMINFO_LAST;i++) {
00315 if(sl_intrn_meminfo_tab[i].id==intrn)
00316 return sl_intrn_meminfo_tab[i].memop_count;
00317 }
00318 return 0;
00319 }
00320
00321 inline INT32 INTRN_get_addr_parm(INTRINSIC intrn, INT id)
00322 {
00323 for(INT i=0;i<SL_INTRN_MEMINFO_LAST;i++) {
00324 if(sl_intrn_meminfo_tab[i].id==intrn)
00325 return sl_intrn_meminfo_tab[i].addr_id[id];
00326 }
00327 return INVALID_PID;
00328 }
00329
00330 inline INT32 INTRN_get_size_parm(INTRINSIC intrn)
00331 {
00332 for(INT i=0;i<SL_INTRN_MEMINFO_LAST;i++) {
00333 if(sl_intrn_meminfo_tab[i].id==intrn)
00334 return sl_intrn_meminfo_tab[i].mem_spec.size_id;
00335 }
00336 return INVALID_PID;
00337 }
00338
00339 inline INT32 INTRN_get_size(INT i)
00340 {
00341 switch(i){
00342 case 0: return 2;
00343 case 1: return 4;
00344 case 2: return 1;
00345 default:
00346 return -1;
00347 }
00348 }
00349
00350 inline INT32 INTRN_get_size_coeff(INTRINSIC intrn)
00351 {
00352 for(INT i=0;i<SL_INTRN_MEMINFO_LAST;i++) {
00353 if(sl_intrn_meminfo_tab[i].id==intrn)
00354 return sl_intrn_meminfo_tab[i].mem_spec.size_coeff;
00355 }
00356 return -1;
00357 }
00358
00359 inline INT32 INTRN_get_size_stride(INTRINSIC intrn)
00360 {
00361 for(INT i=0;i<SL_INTRN_MEMINFO_LAST;i++) {
00362 if(sl_intrn_meminfo_tab[i].id==intrn)
00363 return sl_intrn_meminfo_tab[i].mem_spec.size_stride;
00364 }
00365 return -1;
00366 }
00367
00368 inline INT32 INTRN_get_macro_parm(INTRINSIC intrn)
00369 {
00370 for(INT i=0;i<SL_INTRN_MEMINFO_LAST;i++) {
00371 if(sl_intrn_meminfo_tab[i].id==intrn)
00372 return sl_intrn_meminfo_tab[i].mem_spec.macro_id;
00373 }
00374 return INVALID_PID;
00375 }
00376
00377 inline INT32 INTRN_get_sw_parm(INTRINSIC intrn)
00378 {
00379 for(INT i=0;i<SL_INTRN_MEMINFO_LAST;i++) {
00380 if(sl_intrn_meminfo_tab[i].id==intrn)
00381 return sl_intrn_meminfo_tab[i].mem_spec.sw_id;
00382 }
00383 return INVALID_PID;
00384 }
00385
00386 inline BOOL INTRN_maybe_stride(INTRINSIC intrn)
00387 {
00388 for(INT i=0;i<SL_INTRN_MEMINFO_LAST;i++) {
00389 if(sl_intrn_meminfo_tab[i].id==intrn)
00390 return sl_intrn_meminfo_tab[i].mem_spec.maybe_strided;
00391 }
00392 return FALSE;
00393 }
00394
00395 #endif // TARG_SL
00396
00397 #endif