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 static char USMID[] = "\n@(#)5.0_pl/sources/p_driver.c 5.13 10/20/99 16:13:01\n";
00046
00047 # include "defines.h"
00048
00049 # include "host.m"
00050 # include "host.h"
00051 # include "target.m"
00052 # include "target.h"
00053
00054 # include "globals.m"
00055 # include "tokens.m"
00056 # include "sytb.m"
00057 # include "p_globals.m"
00058 # include "debug.m"
00059
00060 # include "globals.h"
00061 # include "tokens.h"
00062 # include "sytb.h"
00063 # include "p_globals.h"
00064 # include "p_driver.h"
00065 # include "fmath.h"
00066 #ifdef KEY
00067 # include "../sgi/path_intrinsic_list.h"
00068 #endif
00069
00070
00071
00072
00073
00074
00075 void init_parse_prog_unit(void);
00076 static void check_for_dup_derived_type_lbl(void);
00077 static void ck_lbl_construct_name(void);
00078 static void enter_intrinsic_info (void);
00079 static void init_const_tbl(void);
00080 static void set_integer_default_type(void);
00081 static void stmt_level_semantics(void);
00082
00083 # if defined(_EXPRESSION_EVAL)
00084 static void parse_expr_for_evaluator(void);
00085 # endif
00086
00087 #ifdef KEY
00088
00089
00090 typedef struct {
00091 char *name;
00092 int idx;
00093 } intrin_root_t;
00094 #endif
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113 void complete_intrinsic_definition(int generic_attr)
00114
00115 {
00116 int al_idx;
00117 int arg_attr_idx;
00118 int arg_idx;
00119 int attr_idx;
00120 int intrin_tbl_idx;
00121 int j;
00122 id_str_type name;
00123 int np_idx;
00124 int result_attr;
00125 int sn_idx;
00126 int tmp_len;
00127 id_str_type tmp_nam;
00128 int dp_specific_args;
00129 int dp_specific_rslt;
00130
00131
00132 TRACE (Func_Entry, "complete_intrinsic_definition", NULL);
00133
00134 # if defined(_DEBUG)
00135
00136 if ((ATI_FIRST_SPECIFIC_IDX(generic_attr) == NULL_IDX &&
00137 ATI_NUM_SPECIFICS(generic_attr) > 0)||
00138 (ATI_FIRST_SPECIFIC_IDX(generic_attr) != NULL_IDX &&
00139 ATI_NUM_SPECIFICS(generic_attr) == 0)) {
00140 PRINTMSG(stmt_start_line, 626, Internal, 0,
00141 "correct intrinsic", "complete_intrinsic_definition");
00142 }
00143 # endif
00144
00145 intrin_tbl_idx = ATI_INTRIN_TBL_IDX(generic_attr);
00146 #ifdef KEY
00147 int non_ansi = (0 == (intrin_tbl[intrin_tbl_idx].families & ANSI_FAMILY));
00148 #endif
00149 j = intrin_tbl_idx + 1;
00150
00151 while ((! intrin_tbl[j].generic) &&
00152 #ifdef KEY
00153 (j < MAX_INTRIN_TBL_SIZE) &&
00154 #endif
00155 (intrin_tbl[j].name_len > 0)) {
00156
00157 if (cmd_line_flags.s_pointer8) {
00158 if ((strcmp("_MALLOC_I4_I4", (char *)&intrin_tbl[j].id_str) == 0) ||
00159 (strcmp("_MALLOC_I4_I8", (char *)&intrin_tbl[j].id_str) == 0)) {
00160 j = j + 1;
00161
00162 while (intrin_tbl[j].intrin_enum == 0 &&
00163 intrin_tbl[j].external == 0) {
00164 j = j + 1;
00165 }
00166 }
00167 }
00168
00169 if (INTEGER_DEFAULT_TYPE == Integer_8 ||
00170 LOGICAL_DEFAULT_TYPE == Logical_8) {
00171 if ((strcmp("_SIZE_4", (char *)&intrin_tbl[j].id_str) == 0) ||
00172 (strcmp("_SCAN_4", (char *)&intrin_tbl[j].id_str) == 0) ||
00173 (strcmp("_SIZEOF_4", (char *)&intrin_tbl[j].id_str) == 0) ||
00174 (strcmp("_LBOUND0_4", (char *)&intrin_tbl[j].id_str) == 0) ||
00175 #ifdef KEY
00176
00177 #else
00178 (strcmp("_SYSTEM_CLOCK_4", (char *)&intrin_tbl[j].id_str) == 0) ||
00179 #endif
00180 (strcmp("_ASSOCIATED_4", (char *)&intrin_tbl[j].id_str) == 0) ||
00181 (strcmp("_SELECTED_REAL_KIND_4",
00182 (char *)&intrin_tbl[j].id_str) == 0) ||
00183 (strcmp("_FP_CLASS_I4_H",
00184 (char *)&intrin_tbl[j].id_str) == 0) ||
00185 (strcmp("_FP_CLASS_I4_R",
00186 (char *)&intrin_tbl[j].id_str) == 0) ||
00187 (strcmp("_FP_CLASS_I4_D",
00188 (char *)&intrin_tbl[j].id_str) == 0) ||
00189 (strcmp("_UBOUND0_4", (char *)&intrin_tbl[j].id_str) == 0)) {
00190 j = j + 1;
00191
00192 while (intrin_tbl[j].intrin_enum == 0 &&
00193 intrin_tbl[j].external == 0) {
00194 j = j + 1;
00195 }
00196 }
00197 }
00198
00199 dp_specific_args = 0;
00200 dp_specific_rslt = 0;
00201
00202
00203
00204
00205
00206 # if defined(_TARGET_OS_LINUX) || defined(_TARGET_OS_DARWIN)
00207 if (intrin_tbl[intrin_tbl_idx].n_specifics == 1) {
00208 if (intrin_tbl[intrin_tbl_idx].id_str.string[0] == 'Q' ||
00209 (intrin_tbl[intrin_tbl_idx].id_str.string[0] == 'C' &&
00210 intrin_tbl[intrin_tbl_idx].id_str.string[1] == 'Q')) {
00211 PRINTMSG (stmt_start_line, 541, Error, 1);
00212 }
00213 }
00214 # endif
00215
00216 if (intrin_tbl[intrin_tbl_idx].n_specifics == 1 &&
00217 #ifdef KEY
00218
00219 (0 != strcmp("IDIM", (char *)&intrin_tbl[intrin_tbl_idx].id_str)) &&
00220 #endif
00221 # if defined(_QUAD_PRECISION)
00222 (intrin_tbl[intrin_tbl_idx].id_str.string[0] == 'D' ||
00223 (intrin_tbl[intrin_tbl_idx].id_str.string[0] == 'I' &&
00224 intrin_tbl[intrin_tbl_idx].id_str.string[1] == 'D') ||
00225 (intrin_tbl[intrin_tbl_idx].id_str.string[0] == 'C' &&
00226 intrin_tbl[intrin_tbl_idx].id_str.string[1] == 'D'))) {
00227 # else
00228
00229
00230
00231
00232
00233 (intrin_tbl[intrin_tbl_idx].id_str.string[0] == 'D' ||
00234 intrin_tbl[intrin_tbl_idx].id_str.string[0] == 'Q' ||
00235 (intrin_tbl[intrin_tbl_idx].id_str.string[0] == 'I' &&
00236 intrin_tbl[intrin_tbl_idx].id_str.string[1] == 'D') ||
00237 (intrin_tbl[intrin_tbl_idx].id_str.string[0] == 'I' &&
00238 intrin_tbl[intrin_tbl_idx].id_str.string[1] == 'Q') ||
00239 (intrin_tbl[intrin_tbl_idx].id_str.string[0] == 'C' &&
00240 intrin_tbl[intrin_tbl_idx].id_str.string[1] == 'D') ||
00241 (intrin_tbl[intrin_tbl_idx].id_str.string[0] == 'C' &&
00242 intrin_tbl[intrin_tbl_idx].id_str.string[1] == 'Q'))) {
00243 # endif
00244
00245 if ((intrin_tbl[j].data_type == Real_8 ||
00246 intrin_tbl[j].data_type == Real_16) &&
00247 (1<<intrin_tbl[j].data_type) == intrin_tbl[j+1].data_type) {
00248 dp_specific_args = (1<<DOUBLE_DEFAULT_TYPE);
00249 dp_specific_rslt = DOUBLE_DEFAULT_TYPE;
00250 }
00251 else if (intrin_tbl[j].data_type == Integer_4) {
00252 dp_specific_args = (1<<DOUBLE_DEFAULT_TYPE);
00253 dp_specific_rslt = INTEGER_DEFAULT_TYPE;
00254 }
00255 else if ((intrin_tbl[j].data_type == Complex_8 ||
00256 intrin_tbl[j].data_type == Complex_16) &&
00257 (1<<intrin_tbl[j].data_type) == intrin_tbl[j+1].data_type) {
00258 dp_specific_args = (1<<DOUBLE_COMPLEX_DEFAULT_TYPE);
00259 dp_specific_rslt = DOUBLE_COMPLEX_DEFAULT_TYPE;
00260 }
00261
00262 if (strcmp("CDABS", (char *)&intrin_tbl[intrin_tbl_idx].id_str) == 0) {
00263 dp_specific_args = (1<<DOUBLE_COMPLEX_DEFAULT_TYPE);
00264 dp_specific_rslt = DOUBLE_DEFAULT_TYPE;
00265 }
00266
00267 if (strcmp("DIMAG", (char *)&intrin_tbl[intrin_tbl_idx].id_str) == 0) {
00268 dp_specific_args = (1<<DOUBLE_COMPLEX_DEFAULT_TYPE);
00269 dp_specific_rslt = DOUBLE_DEFAULT_TYPE;
00270 }
00271
00272 if (strcmp("DREAL", (char *)&intrin_tbl[intrin_tbl_idx].id_str) == 0) {
00273 dp_specific_args = intrin_tbl[j+1].data_type;
00274 dp_specific_rslt = DOUBLE_DEFAULT_TYPE;
00275 }
00276
00277 # ifndef _QUAD_PRECISION
00278 if (strcmp("CQABS", (char *)&intrin_tbl[intrin_tbl_idx].id_str) == 0) {
00279 dp_specific_args = (1<<DOUBLE_COMPLEX_DEFAULT_TYPE);
00280 dp_specific_rslt = DOUBLE_DEFAULT_TYPE;
00281 }
00282
00283 if (strcmp("QIMAG", (char *)&intrin_tbl[intrin_tbl_idx].id_str) == 0) {
00284 dp_specific_args = (1<<DOUBLE_COMPLEX_DEFAULT_TYPE);
00285 dp_specific_rslt = DOUBLE_DEFAULT_TYPE;
00286 }
00287
00288 if (strcmp("QREAL", (char *)&intrin_tbl[intrin_tbl_idx].id_str) == 0) {
00289 dp_specific_args = intrin_tbl[j+1].data_type;
00290 dp_specific_rslt = DOUBLE_DEFAULT_TYPE;
00291 }
00292 # endif
00293
00294 }
00295
00296 tmp_len = intrin_tbl[j].name_len;
00297 strcpy(&tmp_nam.string[0], &intrin_tbl[j].id_str.string[0]);
00298
00299 CREATE_ID(name,
00300 tmp_nam.string,
00301 tmp_len);
00302
00303 NTR_NAME_POOL(&(name.words[0]), intrin_tbl[j].name_len, np_idx);
00304
00305 NTR_ATTR_TBL(attr_idx);
00306 COPY_COMMON_ATTR_INFO(generic_attr, attr_idx, Pgm_Unit);
00307 AT_NAME_LEN(attr_idx) = intrin_tbl[j].name_len;
00308 AT_NAME_IDX(attr_idx) = np_idx;
00309
00310 NTR_INTERFACE_IN_SN_TBL(sn_idx,
00311 attr_idx,
00312 generic_attr,
00313 stmt_start_line,
00314 stmt_start_col);
00315
00316 AT_OBJ_CLASS(attr_idx) = Pgm_Unit;
00317 AT_ELEMENTAL_INTRIN(attr_idx) = intrin_tbl[j].elemental;
00318 #ifdef KEY
00319
00320
00321 ATP_ELEMENTAL(attr_idx) = intrin_tbl[j].elemental &&
00322 (!non_ansi) &&
00323 (intrin_tbl[j].intrin_enum !=
00324 Random_Number_Intrinsic);
00325 #else
00326 ATP_ELEMENTAL(attr_idx) = intrin_tbl[j].elemental &&
00327 !(intrin_tbl[j].non_ansi);
00328 #endif
00329 ATP_PURE(attr_idx) = ATP_ELEMENTAL(attr_idx);
00330 ATP_PROC(attr_idx) = Intrin_Proc;
00331 AT_IS_INTRIN(attr_idx) = TRUE;
00332 ATP_EXPL_ITRFC(attr_idx) = TRUE;
00333 MAKE_EXTERNAL_NAME(attr_idx,
00334 AT_NAME_IDX(attr_idx),
00335 AT_NAME_LEN(attr_idx));
00336 ATP_IN_INTERFACE_BLK(attr_idx) = TRUE;
00337 ATP_EXTERNAL_INTRIN(attr_idx) = intrin_tbl[j].external;
00338 #ifdef KEY
00339 ATP_NON_ANSI_INTRIN(attr_idx) = non_ansi;
00340 #else
00341 ATP_NON_ANSI_INTRIN(attr_idx) = intrin_tbl[j].non_ansi;
00342 #endif
00343 ATP_INTRIN_ENUM(attr_idx) = intrin_tbl[j].intrin_enum;
00344
00345 if (intrin_tbl[j].function) {
00346 NTR_ATTR_TBL(result_attr);
00347 COPY_COMMON_ATTR_INFO(attr_idx, result_attr, Data_Obj);
00348 ATD_CLASS(result_attr) = Function_Result;
00349 ATP_RSLT_IDX(attr_idx) = result_attr;
00350 ATD_FUNC_IDX(result_attr) = attr_idx;
00351 ATD_TYPE_IDX(result_attr) = intrin_tbl[j].data_type;
00352
00353 if (dp_specific_rslt != 0)
00354 ATD_TYPE_IDX(result_attr) = dp_specific_rslt;
00355
00356 if ((strcmp("KIND", (char *)&intrin_tbl[j].id_str) == 0) ||
00357 (strcmp("_LBOUND", (char *)&intrin_tbl[j].id_str) == 0) ||
00358 (strcmp("_UBOUND", (char *)&intrin_tbl[j].id_str) == 0)) {
00359 ATD_TYPE_IDX(result_attr) = INTEGER_DEFAULT_TYPE;
00360 }
00361
00362 ATD_ARRAY_IDX(result_attr) = intrin_tbl[j].n_specifics;
00363 ATD_IM_A_DOPE(result_attr) = intrin_tbl[j].dope;
00364 ATP_PGM_UNIT(attr_idx) = Function;
00365 ATP_NOSIDE_EFFECTS(attr_idx) = TRUE;
00366 ATP_PURE(attr_idx) = TRUE;
00367 }
00368 else {
00369 ATP_PGM_UNIT(attr_idx) = Subroutine;
00370 }
00371
00372 ATP_SCP_IDX(attr_idx) = curr_scp_idx;
00373
00374 j = j + 1;
00375
00376 while ((intrin_tbl[j].intrin_enum == 0) &&
00377 (intrin_tbl[j].name_len > 0) &&
00378 (!intrin_tbl[j].external) &&
00379 (!intrin_tbl[j].generic)) {
00380 CREATE_ID(name,
00381 intrin_tbl[j].id_str.string,
00382 intrin_tbl[j].name_len);
00383
00384 NTR_NAME_POOL(&(name.words[0]),
00385 intrin_tbl[j].name_len,
00386 np_idx);
00387
00388 NTR_ATTR_TBL(arg_attr_idx);
00389 AT_DEF_LINE(arg_attr_idx) = stmt_start_line;
00390 AT_DEF_COLUMN(arg_attr_idx) = stmt_start_col;
00391 AT_NAME_LEN(arg_attr_idx) = intrin_tbl[j].name_len;
00392 AT_NAME_IDX(arg_attr_idx) = np_idx;
00393
00394 NTR_SN_TBL(arg_idx);
00395 SN_ATTR_IDX(arg_idx) = arg_attr_idx;
00396 SN_NAME_LEN(arg_idx) = intrin_tbl[j].name_len;
00397 SN_NAME_IDX(arg_idx) = np_idx;
00398
00399 if (ATP_FIRST_IDX(attr_idx) == NULL_IDX) {
00400 ATP_FIRST_IDX(attr_idx) = arg_idx;
00401 }
00402
00403 ATP_NUM_DARGS(attr_idx) += 1;
00404
00405 if (intrin_tbl[j].function) {
00406 AT_OBJ_CLASS(arg_attr_idx) = Pgm_Unit;
00407 AT_NAME_LEN(arg_attr_idx) = intrin_tbl[j].name_len;
00408 AT_NAME_IDX(arg_attr_idx) = np_idx;
00409 ATP_PROC(arg_attr_idx) = Dummy_Proc;
00410 ATP_EXT_NAME_LEN(arg_attr_idx) = intrin_tbl[j].name_len;
00411 ATP_EXT_NAME_IDX(arg_attr_idx) = np_idx;
00412 }
00413 else {
00414 AT_OBJ_CLASS(arg_attr_idx) = Data_Obj;
00415 ATD_CLASS(arg_attr_idx) = Dummy_Argument;
00416 ATD_INTRIN_DARG(arg_attr_idx) = TRUE;
00417 ATD_INTRIN_DARG_TYPE(arg_attr_idx) = intrin_tbl[j].data_type;
00418 if (dp_specific_args != 0)
00419 ATD_INTRIN_DARG_TYPE(arg_attr_idx) = dp_specific_args;
00420 ATD_IM_A_DOPE(arg_attr_idx) = intrin_tbl[j].dope;
00421 ATD_ARRAY_IDX(arg_attr_idx) = intrin_tbl[j].n_specifics;
00422 }
00423
00424 AT_IS_DARG(arg_attr_idx) = TRUE;
00425 AT_OPTIONAL(arg_attr_idx) = intrin_tbl[j].optional;
00426 j = j + 1;
00427 }
00428
00429 if (!cmd_line_flags.s_pointer8) {
00430 if ((strcmp("_MALLOC_I8_I4", (char *)&intrin_tbl[j].id_str) == 0) ||
00431 (strcmp("_MALLOC_I8_I8", (char *)&intrin_tbl[j].id_str) == 0)) {
00432 j = j + 1;
00433
00434 while ((intrin_tbl[j].intrin_enum == 0) &&
00435 (! intrin_tbl[j].generic)) {
00436 j = j + 1;
00437 }
00438 }
00439 }
00440
00441 if (INTEGER_DEFAULT_TYPE == Integer_4 ||
00442 LOGICAL_DEFAULT_TYPE == Logical_4) {
00443 if ((strcmp("_SIZE_8", (char *)&intrin_tbl[j].id_str) == 0) ||
00444 (strcmp("_SCAN_8", (char *)&intrin_tbl[j].id_str) == 0) ||
00445 (strcmp("_SIZEOF_8", (char *)&intrin_tbl[j].id_str) == 0) ||
00446 (strcmp("_LBOUND0_8", (char *)&intrin_tbl[j].id_str) == 0) ||
00447 #ifdef KEY
00448
00449 #else
00450 (strcmp("_SYSTEM_CLOCK_8", (char *)&intrin_tbl[j].id_str) == 0) ||
00451 #endif
00452 (strcmp("_ASSOCIATED_8", (char *)&intrin_tbl[j].id_str) == 0) ||
00453 (strcmp("_SELECTED_REAL_KIND_8",
00454 (char *)&intrin_tbl[j].id_str) == 0) ||
00455 (strcmp("_FP_CLASS_I8_H",
00456 (char *)&intrin_tbl[j].id_str) == 0) ||
00457 (strcmp("_FP_CLASS_I8_R",
00458 (char *)&intrin_tbl[j].id_str) == 0) ||
00459 (strcmp("_FP_CLASS_I8_D",
00460 (char *)&intrin_tbl[j].id_str) == 0) ||
00461 (strcmp("_UBOUND0_8", (char *)&intrin_tbl[j].id_str) == 0)) {
00462 j = j + 1;
00463
00464 while ((intrin_tbl[j].intrin_enum == 0) &&
00465 (! intrin_tbl[j].generic)) {
00466 j = j + 1;
00467 }
00468 }
00469 }
00470 }
00471
00472
00473
00474
00475 al_idx = expanded_intrinsic_list;
00476
00477 while (al_idx != NULL_IDX) {
00478
00479 if (generic_attr == AL_ATTR_IDX(al_idx)) {
00480 break;
00481 }
00482 al_idx = AL_NEXT_IDX(al_idx);
00483 }
00484
00485 if (al_idx == NULL_IDX) {
00486 NTR_ATTR_LIST_TBL(al_idx);
00487 AL_ATTR_IDX(al_idx) = generic_attr;
00488 AL_NEXT_IDX(al_idx) = expanded_intrinsic_list;
00489 expanded_intrinsic_list = al_idx;
00490 }
00491
00492 TRACE (Func_Exit, "complete_intrinsic_definition", NULL);
00493
00494 return;
00495
00496 }
00497
00498 #ifdef KEY
00499
00500
00501
00502
00503
00504
00505
00506
00507
00508
00509
00510
00511
00512
00513
00514
00515
00516
00517
00518
00519
00520
00521
00522
00523
00524
00525
00526
00527
00528
00529
00530
00531
00532
00533
00534
00535
00536
00537
00538
00539
00540
00541
00542
00543
00544
00545
00546 typedef enum {
00547 imt_inline,
00548 imt_extern,
00549 imt_type
00550 } imt_kind;
00551
00552 typedef struct {
00553 char *name;
00554 imt_kind kind;
00555 intrinsic_type index;
00556 } imt_entry;
00557
00558
00559 static imt_entry intrinsic_module_table[] = {
00560 { "C_ASSOCIATED_FUNPTR", imt_extern, Unknown_Intrinsic},
00561 { "C_ASSOCIATED_PTR", imt_extern, Unknown_Intrinsic},
00562
00563
00564
00565 { "C_FUNLOC", imt_extern, C_Funloc_Intrinsic},
00566 { "C_FUNPTR", imt_type, Unknown_Intrinsic},
00567 { "C_F_POINTERA", imt_extern, C_F_Pointer_Intrinsic},
00568 { "C_F_POINTERS", imt_extern, C_F_Pointer_Intrinsic},
00569 { "C_F_PROCPOINTER", imt_inline, C_F_Procpointer_Intrinsic},
00570 { "C_LOC", imt_extern, C_Loc_Iso_Intrinsic},
00571 { "C_PTR", imt_type, Unknown_Intrinsic},
00572 { "IEEE_CLASS_4", imt_extern, Unknown_Intrinsic},
00573 { "IEEE_CLASS_8", imt_extern, Unknown_Intrinsic},
00574 { "IEEE_COPY_SIGN_4", imt_inline, Ieee_Copy_Sign_Intrinsic},
00575 { "IEEE_COPY_SIGN_4_8", imt_inline, Ieee_Copy_Sign_Intrinsic},
00576 { "IEEE_COPY_SIGN_8", imt_inline, Ieee_Copy_Sign_Intrinsic},
00577 { "IEEE_COPY_SIGN_8_4", imt_inline, Ieee_Copy_Sign_Intrinsic},
00578 { "IEEE_GET_FLAG", imt_extern, Unknown_Intrinsic},
00579 { "IEEE_GET_HALTING_MODE", imt_extern, Unknown_Intrinsic},
00580 { "IEEE_GET_ROUNDING_MODE", imt_extern, Unknown_Intrinsic},
00581 { "IEEE_GET_STATUS", imt_extern, Unknown_Intrinsic},
00582 { "IEEE_GET_UNDERFLOW_MODE", imt_extern, Unknown_Intrinsic},
00583 { "IEEE_IS_FINITE_4", imt_inline, Ieee_Finite_Intrinsic},
00584 { "IEEE_IS_FINITE_8", imt_inline, Ieee_Finite_Intrinsic},
00585 { "IEEE_IS_NAN_4", imt_inline, Ieee_Is_Nan_Intrinsic},
00586 { "IEEE_IS_NAN_8", imt_inline, Ieee_Is_Nan_Intrinsic},
00587 { "IEEE_IS_NEGATIVE_4", imt_extern, Unknown_Intrinsic},
00588 { "IEEE_IS_NEGATIVE_8", imt_extern, Unknown_Intrinsic},
00589 { "IEEE_IS_NORMAL_4", imt_extern, Unknown_Intrinsic},
00590 { "IEEE_IS_NORMAL_8", imt_extern, Unknown_Intrinsic},
00591 { "IEEE_LOGB_4", imt_extern, Unknown_Intrinsic},
00592 { "IEEE_LOGB_8", imt_extern, Unknown_Intrinsic},
00593 { "IEEE_NEXT_AFTER_4", imt_inline, Ieee_Next_After_Intrinsic},
00594 { "IEEE_NEXT_AFTER_4_8", imt_inline, Ieee_Next_After_Intrinsic},
00595 { "IEEE_NEXT_AFTER_8", imt_inline, Ieee_Next_After_Intrinsic},
00596 { "IEEE_NEXT_AFTER_8_4", imt_inline, Ieee_Next_After_Intrinsic},
00597 { "IEEE_REM_4", imt_inline, Ieee_Remainder_Intrinsic},
00598 { "IEEE_REM_4_8", imt_inline, Ieee_Remainder_Intrinsic},
00599 { "IEEE_REM_8", imt_inline, Ieee_Remainder_Intrinsic},
00600 { "IEEE_REM_8_4", imt_inline, Ieee_Remainder_Intrinsic},
00601 { "IEEE_RINT_4", imt_extern, Unknown_Intrinsic},
00602 { "IEEE_RINT_8", imt_extern, Unknown_Intrinsic},
00603 { "IEEE_SCALB_4", imt_inline, Ieee_Binary_Scale_Intrinsic},
00604 { "IEEE_SCALB_4_8", imt_inline, Ieee_Binary_Scale_Intrinsic},
00605 { "IEEE_SCALB_8", imt_inline, Ieee_Binary_Scale_Intrinsic},
00606 { "IEEE_SCALB_8_4", imt_inline, Ieee_Binary_Scale_Intrinsic},
00607 { "IEEE_SELECTED_REAL_KIND", imt_inline, SRK_Intrinsic},
00608 { "IEEE_SET_FLAG", imt_extern, Unknown_Intrinsic},
00609 { "IEEE_SET_HALTING_MODE", imt_extern, Unknown_Intrinsic},
00610 { "IEEE_SET_ROUNDING_MODE", imt_extern, Unknown_Intrinsic},
00611 { "IEEE_SET_STATUS", imt_extern, Unknown_Intrinsic},
00612 { "IEEE_SET_UNDERFLOW_MODE", imt_extern, Unknown_Intrinsic},
00613 { "IEEE_SUPPORT_DATATYPE", imt_inline, True_Intrinsic},
00614 { "IEEE_SUPPORT_DATATYPE_4", imt_inline, True_Intrinsic},
00615 { "IEEE_SUPPORT_DATATYPE_4A", imt_inline, True_Intrinsic},
00616 { "IEEE_SUPPORT_DATATYPE_4B", imt_inline, True_Intrinsic},
00617 { "IEEE_SUPPORT_DATATYPE_4C", imt_inline, True_Intrinsic},
00618 { "IEEE_SUPPORT_DATATYPE_4D", imt_inline, True_Intrinsic},
00619 { "IEEE_SUPPORT_DATATYPE_4E", imt_inline, True_Intrinsic},
00620 { "IEEE_SUPPORT_DATATYPE_4F", imt_inline, True_Intrinsic},
00621 { "IEEE_SUPPORT_DATATYPE_4G", imt_inline, True_Intrinsic},
00622 { "IEEE_SUPPORT_DATATYPE_8", imt_inline, True_Intrinsic},
00623 { "IEEE_SUPPORT_DATATYPE_8A", imt_inline, True_Intrinsic},
00624 { "IEEE_SUPPORT_DATATYPE_8B", imt_inline, True_Intrinsic},
00625 { "IEEE_SUPPORT_DATATYPE_8C", imt_inline, True_Intrinsic},
00626 { "IEEE_SUPPORT_DATATYPE_8D", imt_inline, True_Intrinsic},
00627 { "IEEE_SUPPORT_DATATYPE_8E", imt_inline, True_Intrinsic},
00628 { "IEEE_SUPPORT_DATATYPE_8F", imt_inline, True_Intrinsic},
00629 { "IEEE_SUPPORT_DATATYPE_8G", imt_inline, True_Intrinsic},
00630 { "IEEE_SUPPORT_DENORMAL", imt_inline, True_Intrinsic},
00631 { "IEEE_SUPPORT_DENORMAL_4", imt_inline, True_Intrinsic},
00632 { "IEEE_SUPPORT_DENORMAL_4A", imt_inline, True_Intrinsic},
00633 { "IEEE_SUPPORT_DENORMAL_4B", imt_inline, True_Intrinsic},
00634 { "IEEE_SUPPORT_DENORMAL_4C", imt_inline, True_Intrinsic},
00635 { "IEEE_SUPPORT_DENORMAL_4D", imt_inline, True_Intrinsic},
00636 { "IEEE_SUPPORT_DENORMAL_4E", imt_inline, True_Intrinsic},
00637 { "IEEE_SUPPORT_DENORMAL_4F", imt_inline, True_Intrinsic},
00638 { "IEEE_SUPPORT_DENORMAL_4G", imt_inline, True_Intrinsic},
00639 { "IEEE_SUPPORT_DENORMAL_8", imt_inline, True_Intrinsic},
00640 { "IEEE_SUPPORT_DENORMAL_8A", imt_inline, True_Intrinsic},
00641 { "IEEE_SUPPORT_DENORMAL_8B", imt_inline, True_Intrinsic},
00642 { "IEEE_SUPPORT_DENORMAL_8C", imt_inline, True_Intrinsic},
00643 { "IEEE_SUPPORT_DENORMAL_8D", imt_inline, True_Intrinsic},
00644 { "IEEE_SUPPORT_DENORMAL_8E", imt_inline, True_Intrinsic},
00645 { "IEEE_SUPPORT_DENORMAL_8F", imt_inline, True_Intrinsic},
00646 { "IEEE_SUPPORT_DENORMAL_8G", imt_inline, True_Intrinsic},
00647 { "IEEE_SUPPORT_DIVIDE", imt_inline, True_Intrinsic},
00648 { "IEEE_SUPPORT_DIVIDE_4", imt_inline, True_Intrinsic},
00649 { "IEEE_SUPPORT_DIVIDE_4A", imt_inline, True_Intrinsic},
00650 { "IEEE_SUPPORT_DIVIDE_4B", imt_inline, True_Intrinsic},
00651 { "IEEE_SUPPORT_DIVIDE_4C", imt_inline, True_Intrinsic},
00652 { "IEEE_SUPPORT_DIVIDE_4D", imt_inline, True_Intrinsic},
00653 { "IEEE_SUPPORT_DIVIDE_4E", imt_inline, True_Intrinsic},
00654 { "IEEE_SUPPORT_DIVIDE_4F", imt_inline, True_Intrinsic},
00655 { "IEEE_SUPPORT_DIVIDE_4G", imt_inline, True_Intrinsic},
00656 { "IEEE_SUPPORT_DIVIDE_8", imt_inline, True_Intrinsic},
00657 { "IEEE_SUPPORT_DIVIDE_8A", imt_inline, True_Intrinsic},
00658 { "IEEE_SUPPORT_DIVIDE_8B", imt_inline, True_Intrinsic},
00659 { "IEEE_SUPPORT_DIVIDE_8C", imt_inline, True_Intrinsic},
00660 { "IEEE_SUPPORT_DIVIDE_8D", imt_inline, True_Intrinsic},
00661 { "IEEE_SUPPORT_DIVIDE_8E", imt_inline, True_Intrinsic},
00662 { "IEEE_SUPPORT_DIVIDE_8F", imt_inline, True_Intrinsic},
00663 { "IEEE_SUPPORT_DIVIDE_8G", imt_inline, True_Intrinsic},
00664 { "IEEE_SUPPORT_FLAG", imt_inline, True_Intrinsic},
00665 { "IEEE_SUPPORT_FLAG_4", imt_inline, True_Intrinsic},
00666 { "IEEE_SUPPORT_FLAG_4A", imt_inline, True_Intrinsic},
00667 { "IEEE_SUPPORT_FLAG_4B", imt_inline, True_Intrinsic},
00668 { "IEEE_SUPPORT_FLAG_4C", imt_inline, True_Intrinsic},
00669 { "IEEE_SUPPORT_FLAG_4D", imt_inline, True_Intrinsic},
00670 { "IEEE_SUPPORT_FLAG_4E", imt_inline, True_Intrinsic},
00671 { "IEEE_SUPPORT_FLAG_4F", imt_inline, True_Intrinsic},
00672 { "IEEE_SUPPORT_FLAG_4G", imt_inline, True_Intrinsic},
00673 { "IEEE_SUPPORT_FLAG_8", imt_inline, True_Intrinsic},
00674 { "IEEE_SUPPORT_FLAG_8A", imt_inline, True_Intrinsic},
00675 { "IEEE_SUPPORT_FLAG_8B", imt_inline, True_Intrinsic},
00676 { "IEEE_SUPPORT_FLAG_8C", imt_inline, True_Intrinsic},
00677 { "IEEE_SUPPORT_FLAG_8D", imt_inline, True_Intrinsic},
00678 { "IEEE_SUPPORT_FLAG_8E", imt_inline, True_Intrinsic},
00679 { "IEEE_SUPPORT_FLAG_8F", imt_inline, True_Intrinsic},
00680 { "IEEE_SUPPORT_FLAG_8G", imt_inline, True_Intrinsic},
00681 { "IEEE_SUPPORT_HALTING", imt_inline, True_Intrinsic},
00682 { "IEEE_SUPPORT_INF", imt_inline, True_Intrinsic},
00683 { "IEEE_SUPPORT_INF_4", imt_inline, True_Intrinsic},
00684 { "IEEE_SUPPORT_INF_4A", imt_inline, True_Intrinsic},
00685 { "IEEE_SUPPORT_INF_4B", imt_inline, True_Intrinsic},
00686 { "IEEE_SUPPORT_INF_4C", imt_inline, True_Intrinsic},
00687 { "IEEE_SUPPORT_INF_4D", imt_inline, True_Intrinsic},
00688 { "IEEE_SUPPORT_INF_4E", imt_inline, True_Intrinsic},
00689 { "IEEE_SUPPORT_INF_4F", imt_inline, True_Intrinsic},
00690 { "IEEE_SUPPORT_INF_4G", imt_inline, True_Intrinsic},
00691 { "IEEE_SUPPORT_INF_8", imt_inline, True_Intrinsic},
00692 { "IEEE_SUPPORT_INF_8A", imt_inline, True_Intrinsic},
00693 { "IEEE_SUPPORT_INF_8B", imt_inline, True_Intrinsic},
00694 { "IEEE_SUPPORT_INF_8C", imt_inline, True_Intrinsic},
00695 { "IEEE_SUPPORT_INF_8D", imt_inline, True_Intrinsic},
00696 { "IEEE_SUPPORT_INF_8E", imt_inline, True_Intrinsic},
00697 { "IEEE_SUPPORT_INF_8F", imt_inline, True_Intrinsic},
00698 { "IEEE_SUPPORT_INF_8G", imt_inline, True_Intrinsic},
00699 { "IEEE_SUPPORT_IO", imt_inline, True_Intrinsic},
00700 { "IEEE_SUPPORT_IO_4", imt_inline, True_Intrinsic},
00701 { "IEEE_SUPPORT_IO_4A", imt_inline, True_Intrinsic},
00702 { "IEEE_SUPPORT_IO_4B", imt_inline, True_Intrinsic},
00703 { "IEEE_SUPPORT_IO_4C", imt_inline, True_Intrinsic},
00704 { "IEEE_SUPPORT_IO_4D", imt_inline, True_Intrinsic},
00705 { "IEEE_SUPPORT_IO_4E", imt_inline, True_Intrinsic},
00706 { "IEEE_SUPPORT_IO_4F", imt_inline, True_Intrinsic},
00707 { "IEEE_SUPPORT_IO_4G", imt_inline, True_Intrinsic},
00708 { "IEEE_SUPPORT_IO_8", imt_inline, True_Intrinsic},
00709 { "IEEE_SUPPORT_IO_8A", imt_inline, True_Intrinsic},
00710 { "IEEE_SUPPORT_IO_8B", imt_inline, True_Intrinsic},
00711 { "IEEE_SUPPORT_IO_8C", imt_inline, True_Intrinsic},
00712 { "IEEE_SUPPORT_IO_8D", imt_inline, True_Intrinsic},
00713 { "IEEE_SUPPORT_IO_8E", imt_inline, True_Intrinsic},
00714 { "IEEE_SUPPORT_IO_8F", imt_inline, True_Intrinsic},
00715 { "IEEE_SUPPORT_IO_8G", imt_inline, True_Intrinsic},
00716 { "IEEE_SUPPORT_NAN", imt_inline, True_Intrinsic},
00717 { "IEEE_SUPPORT_NAN_4", imt_inline, True_Intrinsic},
00718 { "IEEE_SUPPORT_NAN_4A", imt_inline, True_Intrinsic},
00719 { "IEEE_SUPPORT_NAN_4B", imt_inline, True_Intrinsic},
00720 { "IEEE_SUPPORT_NAN_4C", imt_inline, True_Intrinsic},
00721 { "IEEE_SUPPORT_NAN_4D", imt_inline, True_Intrinsic},
00722 { "IEEE_SUPPORT_NAN_4E", imt_inline, True_Intrinsic},
00723 { "IEEE_SUPPORT_NAN_4F", imt_inline, True_Intrinsic},
00724 { "IEEE_SUPPORT_NAN_4G", imt_inline, True_Intrinsic},
00725 { "IEEE_SUPPORT_NAN_8", imt_inline, True_Intrinsic},
00726 { "IEEE_SUPPORT_NAN_8A", imt_inline, True_Intrinsic},
00727 { "IEEE_SUPPORT_NAN_8B", imt_inline, True_Intrinsic},
00728 { "IEEE_SUPPORT_NAN_8C", imt_inline, True_Intrinsic},
00729 { "IEEE_SUPPORT_NAN_8D", imt_inline, True_Intrinsic},
00730 { "IEEE_SUPPORT_NAN_8E", imt_inline, True_Intrinsic},
00731 { "IEEE_SUPPORT_NAN_8F", imt_inline, True_Intrinsic},
00732 { "IEEE_SUPPORT_NAN_8G", imt_inline, True_Intrinsic},
00733 { "IEEE_SUPPORT_ROUNDING", imt_inline, True_Intrinsic},
00734 { "IEEE_SUPPORT_ROUNDING_4", imt_inline, True_Intrinsic},
00735 { "IEEE_SUPPORT_ROUNDING_4A", imt_inline, True_Intrinsic},
00736 { "IEEE_SUPPORT_ROUNDING_4B", imt_inline, True_Intrinsic},
00737 { "IEEE_SUPPORT_ROUNDING_4C", imt_inline, True_Intrinsic},
00738 { "IEEE_SUPPORT_ROUNDING_4D", imt_inline, True_Intrinsic},
00739 { "IEEE_SUPPORT_ROUNDING_4E", imt_inline, True_Intrinsic},
00740 { "IEEE_SUPPORT_ROUNDING_4F", imt_inline, True_Intrinsic},
00741 { "IEEE_SUPPORT_ROUNDING_4G", imt_inline, True_Intrinsic},
00742 { "IEEE_SUPPORT_ROUNDING_8", imt_inline, True_Intrinsic},
00743 { "IEEE_SUPPORT_ROUNDING_8A", imt_inline, True_Intrinsic},
00744 { "IEEE_SUPPORT_ROUNDING_8B", imt_inline, True_Intrinsic},
00745 { "IEEE_SUPPORT_ROUNDING_8C", imt_inline, True_Intrinsic},
00746 { "IEEE_SUPPORT_ROUNDING_8D", imt_inline, True_Intrinsic},
00747 { "IEEE_SUPPORT_ROUNDING_8E", imt_inline, True_Intrinsic},
00748 { "IEEE_SUPPORT_ROUNDING_8F", imt_inline, True_Intrinsic},
00749 { "IEEE_SUPPORT_ROUNDING_8G", imt_inline, True_Intrinsic},
00750 { "IEEE_SUPPORT_SQRT", imt_inline, True_Intrinsic},
00751 { "IEEE_SUPPORT_SQRT_4", imt_inline, True_Intrinsic},
00752 { "IEEE_SUPPORT_SQRT_4A", imt_inline, True_Intrinsic},
00753 { "IEEE_SUPPORT_SQRT_4B", imt_inline, True_Intrinsic},
00754 { "IEEE_SUPPORT_SQRT_4C", imt_inline, True_Intrinsic},
00755 { "IEEE_SUPPORT_SQRT_4D", imt_inline, True_Intrinsic},
00756 { "IEEE_SUPPORT_SQRT_4E", imt_inline, True_Intrinsic},
00757 { "IEEE_SUPPORT_SQRT_4F", imt_inline, True_Intrinsic},
00758 { "IEEE_SUPPORT_SQRT_4G", imt_inline, True_Intrinsic},
00759 { "IEEE_SUPPORT_SQRT_8", imt_inline, True_Intrinsic},
00760 { "IEEE_SUPPORT_SQRT_8A", imt_inline, True_Intrinsic},
00761 { "IEEE_SUPPORT_SQRT_8B", imt_inline, True_Intrinsic},
00762 { "IEEE_SUPPORT_SQRT_8C", imt_inline, True_Intrinsic},
00763 { "IEEE_SUPPORT_SQRT_8D", imt_inline, True_Intrinsic},
00764 { "IEEE_SUPPORT_SQRT_8E", imt_inline, True_Intrinsic},
00765 { "IEEE_SUPPORT_SQRT_8F", imt_inline, True_Intrinsic},
00766 { "IEEE_SUPPORT_SQRT_8G", imt_inline, True_Intrinsic},
00767 { "IEEE_SUPPORT_STANDARD", imt_inline, True_Intrinsic},
00768 { "IEEE_SUPPORT_STANDARD_4", imt_inline, True_Intrinsic},
00769 { "IEEE_SUPPORT_STANDARD_4A", imt_inline, True_Intrinsic},
00770 { "IEEE_SUPPORT_STANDARD_4B", imt_inline, True_Intrinsic},
00771 { "IEEE_SUPPORT_STANDARD_4C", imt_inline, True_Intrinsic},
00772 { "IEEE_SUPPORT_STANDARD_4D", imt_inline, True_Intrinsic},
00773 { "IEEE_SUPPORT_STANDARD_4E", imt_inline, True_Intrinsic},
00774 { "IEEE_SUPPORT_STANDARD_4F", imt_inline, True_Intrinsic},
00775 { "IEEE_SUPPORT_STANDARD_4G", imt_inline, True_Intrinsic},
00776 { "IEEE_SUPPORT_STANDARD_8", imt_inline, True_Intrinsic},
00777 { "IEEE_SUPPORT_STANDARD_8A", imt_inline, True_Intrinsic},
00778 { "IEEE_SUPPORT_STANDARD_8B", imt_inline, True_Intrinsic},
00779 { "IEEE_SUPPORT_STANDARD_8C", imt_inline, True_Intrinsic},
00780 { "IEEE_SUPPORT_STANDARD_8D", imt_inline, True_Intrinsic},
00781 { "IEEE_SUPPORT_STANDARD_8E", imt_inline, True_Intrinsic},
00782 { "IEEE_SUPPORT_STANDARD_8F", imt_inline, True_Intrinsic},
00783 { "IEEE_SUPPORT_STANDARD_8G", imt_inline, True_Intrinsic},
00784 { "IEEE_SUPPORT_UNDERFLOW_CONTROL", imt_inline, Support_Uflow_Intrinsic},
00785 { "IEEE_SUPPORT_UNDERFLOW_CONTROL_4", imt_inline, Support_Uflow_Intrinsic},
00786 { "IEEE_SUPPORT_UNDERFLOW_CONTROL_4A",imt_inline, Support_Uflow_Intrinsic},
00787 { "IEEE_SUPPORT_UNDERFLOW_CONTROL_4B",imt_inline, Support_Uflow_Intrinsic},
00788 { "IEEE_SUPPORT_UNDERFLOW_CONTROL_4C",imt_inline, Support_Uflow_Intrinsic},
00789 { "IEEE_SUPPORT_UNDERFLOW_CONTROL_4D",imt_inline, Support_Uflow_Intrinsic},
00790 { "IEEE_SUPPORT_UNDERFLOW_CONTROL_4E",imt_inline, Support_Uflow_Intrinsic},
00791 { "IEEE_SUPPORT_UNDERFLOW_CONTROL_4F",imt_inline, Support_Uflow_Intrinsic},
00792 { "IEEE_SUPPORT_UNDERFLOW_CONTROL_4G",imt_inline, Support_Uflow_Intrinsic},
00793 { "IEEE_SUPPORT_UNDERFLOW_CONTROL_8", imt_inline, Support_Uflow_Intrinsic},
00794 { "IEEE_SUPPORT_UNDERFLOW_CONTROL_8A",imt_inline, Support_Uflow_Intrinsic},
00795 { "IEEE_SUPPORT_UNDERFLOW_CONTROL_8B",imt_inline, Support_Uflow_Intrinsic},
00796 { "IEEE_SUPPORT_UNDERFLOW_CONTROL_8C",imt_inline, Support_Uflow_Intrinsic},
00797 { "IEEE_SUPPORT_UNDERFLOW_CONTROL_8D",imt_inline, Support_Uflow_Intrinsic},
00798 { "IEEE_SUPPORT_UNDERFLOW_CONTROL_8E",imt_inline, Support_Uflow_Intrinsic},
00799 { "IEEE_SUPPORT_UNDERFLOW_CONTROL_8F",imt_inline, Support_Uflow_Intrinsic},
00800 { "IEEE_SUPPORT_UNDERFLOW_CONTROL_8G",imt_inline, Support_Uflow_Intrinsic},
00801 { "IEEE_UNORDERED_4", imt_inline, Ieee_Unordered_Intrinsic},
00802 { "IEEE_UNORDERED_4_8", imt_inline, Ieee_Unordered_Intrinsic},
00803 { "IEEE_UNORDERED_8", imt_inline, Ieee_Unordered_Intrinsic},
00804 { "IEEE_UNORDERED_8_4", imt_inline, Ieee_Unordered_Intrinsic},
00805 { "IEEE_VALUE_4", imt_extern, Unknown_Intrinsic},
00806 { "IEEE_VALUE_8", imt_extern, Unknown_Intrinsic}
00807 };
00808
00809 static int intrinsic_module_cmp(const void *va, const void *vb)
00810 {
00811 imt_entry *a = (imt_entry *) va;
00812 imt_entry *b = (imt_entry *) vb;
00813 return strcmp(a->name, b->name);
00814 }
00815
00816
00817
00818
00819
00820 static imt_entry *
00821 find_imt(char *name) {
00822 imt_entry key;
00823 key.name = name;
00824 return bsearch(&key,
00825 intrinsic_module_table,
00826 ((sizeof intrinsic_module_table) / (sizeof *intrinsic_module_table)),
00827 sizeof *intrinsic_module_table,
00828 intrinsic_module_cmp);
00829 }
00830
00831
00832
00833
00834
00835
00836
00837
00838 int intrinsic_module_lookup(int attr_idx)
00839 {
00840
00841 obj_class_type obj_class = AT_OBJ_CLASS(attr_idx);
00842 if (Derived_Type == obj_class) {
00843 imt_entry *keyp = find_imt(AT_ORIG_NAME_PTR(attr_idx));
00844 if (keyp) {
00845 if (is_x8664_n32() && keyp->kind == imt_type) {
00846 AT_IS_INTRIN(attr_idx) = TRUE;
00847 if (AT_OBJ_CLASS(attr_idx) == Derived_Type) {
00848 ATT_NUM_CPNTS(attr_idx) = 0;
00849 ATT_FIRST_CPNT_IDX(attr_idx) = 0;
00850 }
00851 return 1;
00852 }
00853 return 0;
00854 }
00855 }
00856 else if (Interface != obj_class && Derived_Type != obj_class) {
00857 return 0;
00858 }
00859
00860
00861
00862 int spec_sn_idx = ATI_FIRST_SPECIFIC_IDX(attr_idx);
00863 int found = 0;
00864 int elemental = 0;
00865 for (int s = ATI_NUM_SPECIFICS(attr_idx); s > 0; s -= 1) {
00866 int spec_idx = SN_ATTR_IDX(spec_sn_idx);
00867 imt_entry *keyp = find_imt(AT_ORIG_NAME_PTR(spec_idx));
00868 if (keyp) {
00869 found = keyp->index;
00870 if (imt_inline == keyp->kind || Unknown_Intrinsic != keyp->index) {
00871 elemental = AT_ELEMENTAL_INTRIN(spec_idx) = ATP_ELEMENTAL(spec_idx);
00872 ATP_PROC(spec_idx) = Intrin_Proc;
00873 AT_IS_INTRIN(spec_idx) = TRUE;
00874 ATP_EXTERNAL_INTRIN(spec_idx) = (imt_extern == keyp->kind);
00875 ATP_NON_ANSI_INTRIN(spec_idx) = FALSE;
00876 ATP_INTRIN_ENUM(spec_idx) = keyp->index;
00877 }
00878 if (imt_extern == keyp->kind) {
00879
00880
00881
00882
00883
00884 char *user_name = ATP_EXT_NAME_PTR(spec_idx);
00885 char *dot = strchr(user_name, '.');
00886 if (0 == dot) {
00887 dot = user_name + strlen(user_name) - 1;
00888 }
00889 else {
00890 *(dot + 1) = '\0';
00891 }
00892 for (dot -= 1; dot > user_name; dot -= 1) {
00893 *(dot + 1) = tolower(*dot);
00894 }
00895 *(dot + 1) = toupper(*dot);
00896 *user_name = '_';
00897 }
00898
00899
00900
00901
00902
00903
00904
00905 if (is_x8664_n32() && (keyp->index == C_Loc_Iso_Intrinsic ||
00906 keyp->index == C_Funloc_Intrinsic)) {
00907 ATP_EXTRA_DARG(spec_idx) = FALSE;
00908 ATP_NUM_DARGS(spec_idx) = 1;
00909 ATP_FIRST_IDX(spec_idx) += 1;
00910 }
00911 }
00912 spec_sn_idx = SN_SIBLING_LINK(spec_sn_idx);
00913 }
00914
00915
00916 if (found) {
00917 AT_IS_INTRIN(attr_idx) = TRUE;
00918 ATI_INTRIN_TBL_IDX(attr_idx) = found;
00919 ATI_INTRIN_PASSABLE(attr_idx) = FALSE;
00920 ATI_GENERIC_INTRINSIC(attr_idx) = FALSE;
00921 AT_ELEMENTAL_INTRIN(attr_idx) = elemental;
00922 }
00923
00924 return found;
00925 }
00926
00927 #endif
00928 #ifdef KEY
00929
00930 static int root_cmp(const void *o1, const void *o2) {
00931 intrin_root_t *i1 = *(intrin_root_t **) o1;
00932 intrin_root_t *i2 = *(intrin_root_t **) o2;
00933 return strcmp(i1->name, i2->name);
00934 }
00935
00936
00937 static int family_cmp(const void *o1, const void *o2) {
00938 intrin_family_t *f1 = (intrin_family_t *) o1;
00939 intrin_family_t *f2 = (intrin_family_t *) o2;
00940 return strcmp(f1->name, f2->name);
00941 }
00942
00943 #endif
00944
00945
00946
00947
00948
00949
00950
00951
00952
00953
00954
00955
00956
00957
00958
00959
00960 static void enter_intrinsic_info (void)
00961
00962 {
00963 int attr_idx;
00964 int name_idx = 2;
00965 token_type tmp_token;
00966 int i;
00967
00968 TRACE (Func_Entry, "enter_intrinsic_info", NULL);
00969
00970 i = 1;
00971 tmp_token = initial_token;
00972 TOKEN_COLUMN(tmp_token) = 1;
00973 TOKEN_LINE(tmp_token) = 1;
00974 TOKEN_VALUE(tmp_token) = Tok_Id;
00975
00976 #ifdef KEY
00977 int intrin_roots_len = 0;
00978 intrin_root_t **intrin_roots =
00979 malloc(MAX_INTRIN_TBL_SIZE * (sizeof *intrin_roots));
00980 intrin_root_t *intrin_roots_data =
00981 malloc(MAX_INTRIN_TBL_SIZE * (sizeof intrin_roots));
00982 for (int e = 1; e < MAX_INTRIN_TBL_SIZE; e += 1) {
00983 if (!intrin_tbl[e].generic) {
00984 continue;
00985 }
00986
00987
00988 intrin_tbl[e].families |= EVERY_FAMILY;
00989
00990
00991
00992 int families = intrin_tbl[e].families;
00993 int default_family = on_off_flags.issue_ansi_messages ?
00994 ANSI_FAMILY :
00995 TRADITIONAL_FAMILY;
00996 intrin_tbl[e].enabled = ((0 != (families & default_family)) ||
00997 (dump_flags.open_mp && (0 != (families & OMP_FAMILY))));
00998
00999
01000
01001
01002 intrin_roots[intrin_roots_len] = &(intrin_roots_data[intrin_roots_len]);
01003 intrin_roots[intrin_roots_len]->name = intrin_tbl[e].id_str.string;
01004 intrin_roots[intrin_roots_len++]->idx = e;
01005 }
01006 qsort(intrin_roots, intrin_roots_len, sizeof *intrin_roots, root_cmp);
01007
01008 int olen = path_intrinsic_list_length();
01009 intrin_option_t **options = path_intrinsic_list_list();
01010 for (int o = 0; o < olen; o += 1) {
01011 boolean found = FALSE;
01012 intrin_option_t *option = options[o];
01013
01014
01015 if (option->isfamily_) {
01016 intrin_family_t key;
01017 key.name = option->name_;
01018 intrin_family_t *keyp = (intrin_family_t *) bsearch(&key,
01019 intrin_families, SIZEOF_INTRIN_FAMILIES, (sizeof *intrin_families),
01020 family_cmp);
01021 if (keyp) {
01022 for (int r = 0; r < intrin_roots_len; r += 1) {
01023 intrin_tbl_type *entry = &(intrin_tbl[intrin_roots[r]->idx]);
01024 if (0 != (entry->families & keyp->mask)) {
01025 entry->enabled = option->added_;
01026 }
01027 }
01028 found = TRUE;
01029 }
01030 }
01031
01032
01033 if (!found) {
01034 char subr_name[sizeof intrin_tbl[0].id_str.string];
01035 intrin_root_t key;
01036 intrin_root_t *keyp = &key;
01037 key.name = option->name_;
01038 for (int k = 0; k <= 1; k += 1) {
01039 intrin_root_t **keypp = (intrin_root_t **) bsearch(&keyp, intrin_roots,
01040 intrin_roots_len, sizeof *intrin_roots, root_cmp);
01041 if (keypp) {
01042 intrin_tbl[(*keypp)->idx].enabled = option->added_;
01043
01044 if (option->isfamily_ && !found) {
01045 PRINTMSG(0, 1681, Log_Warning, 0, option->name_);
01046 }
01047 found = TRUE;
01048 }
01049
01050
01051 key.name = strcat(strcpy(subr_name, option->name_),
01052 INTRIN_SUBR_SUFFIX);
01053 }
01054 }
01055
01056
01057 if (!found) {
01058 PRINTMSG(0, 701, Log_Error, 0, option->name_);
01059 }
01060 }
01061 #endif
01062
01063 #ifdef KEY
01064 for (int r = 0; r < intrin_roots_len; r += 1) {
01065 i = intrin_roots[r]->idx;
01066
01067 if (!intrin_tbl[i].enabled) {
01068 continue;
01069 }
01070 #else
01071 while (i < MAX_INTRIN_TBL_SIZE) {
01072 if (intrin_tbl[i].generic) {
01073 #endif
01074
01075 CREATE_ID(TOKEN_ID(tmp_token),
01076 intrin_tbl[i].id_str.string,
01077 intrin_tbl[i].name_len);
01078
01079 TOKEN_LEN(tmp_token) = intrin_tbl[i].name_len;
01080
01081 attr_idx = ntr_sym_tbl(&tmp_token, name_idx);
01082
01083 AT_OBJ_CLASS(attr_idx) = Interface;
01084 AT_IS_INTRIN(attr_idx) = TRUE;
01085 ATI_INTRIN_PASSABLE(attr_idx) = intrin_tbl[i].passable;
01086 ATI_GENERIC_INTRINSIC(attr_idx) = intrin_tbl[i].dope;
01087 AT_ELEMENTAL_INTRIN(attr_idx) = intrin_tbl[i].elemental;
01088
01089 if (intrin_tbl[i].function) {
01090 ATI_INTERFACE_CLASS(attr_idx) = Generic_Function_Interface;
01091 }
01092 else {
01093 ATI_INTERFACE_CLASS(attr_idx) = Generic_Subroutine_Interface;
01094 }
01095
01096 ATI_INTRIN_TBL_IDX(attr_idx) = i;
01097 name_idx = name_idx + 1;
01098 #ifndef KEY
01099 }
01100
01101 i = i + 1;
01102 }
01103 #else
01104 }
01105 #endif
01106
01107 expanded_intrinsic_list = NULL_IDX;
01108
01109 TRACE (Func_Exit, "enter_intrinsic_info", NULL);
01110
01111 return;
01112
01113 }
01114
01115
01116
01117
01118
01119
01120
01121
01122
01123
01124
01125
01126
01127
01128
01129
01130
01131
01132
01133
01134
01135
01136 void parse_prog_unit (void)
01137
01138 {
01139 int defer_msg = 0;
01140 int name_idx;
01141 int need_ez_debug_label = FALSE;
01142 int prev_stmt_start_line;
01143 int save_blk_stk_idx;
01144 int sh_idx;
01145
01146 # if (defined(_TARGET_OS_IRIX) || defined(_TARGET_OS_LINUX) || defined(_TARGET_OS_DARWIN))
01147 int ir_idx;
01148 # endif
01149
01150
01151 TRACE (PU_Start, NULL, NULL);
01152
01153 TRACE (Func_Entry, "parse_prog_unit", NULL);
01154
01155 if (first_time_tbl_alloc) {
01156 first_time_tbl_alloc = FALSE;
01157
01158 }
01159 else {
01160 init_parse_prog_unit();
01161 }
01162
01163 prev_stmt_start_line = stmt_start_line;
01164 pgm_unit_start_line = stmt_start_line;
01165
01166 # if defined(_EXPRESSION_EVAL)
01167
01168 if (cmd_line_flags.expression_eval_expr) {
01169 parse_expr_for_evaluator();
01170 }
01171
01172 # endif
01173
01174 while (!EOPU_encountered) {
01175
01176 TRACE_NEW_STMT(NULL);
01177
01178 stmt_type = Null_Stmt;
01179
01180 if (need_new_sh) {
01181 sh_idx = curr_stmt_sh_idx;
01182 curr_stmt_sh_idx = ntr_sh_tbl();
01183 SH_NEXT_IDX(sh_idx) = curr_stmt_sh_idx;
01184 SH_PREV_IDX(curr_stmt_sh_idx) = sh_idx;
01185 }
01186 else {
01187
01188
01189 sh_idx = SH_PREV_IDX(curr_stmt_sh_idx);
01190 CLEAR_TBL_NTRY(sh_tbl, curr_stmt_sh_idx);
01191 SH_PREV_IDX(curr_stmt_sh_idx) = sh_idx;
01192 }
01193
01194 ck_lbl_construct_name();
01195
01196 if (MATCHED_TOKEN_CLASS(Tok_Class_Keyword)) {
01197 determine_stmt_type();
01198
01199 if (curr_stmt_category == Init_Stmt_Cat &&
01200 cdir_switches.implicit_use_idx != NULL_IDX) {
01201
01202
01203
01204 switch (stmt_type) {
01205 case Blockdata_Stmt:
01206 case Elemental_Stmt:
01207 case Function_Stmt:
01208 case Module_Stmt:
01209 case Program_Stmt:
01210 case Pure_Stmt:
01211 case Recursive_Stmt:
01212 case Subroutine_Stmt:
01213
01214
01215
01216
01217 case Directive_Stmt:
01218
01219
01220
01221
01222
01223 break;
01224
01225 case Type_Decl_Stmt:
01226
01227 if ((TOKEN_VALUE(token) == Tok_Kwd_Type &&
01228 LA_CH_VALUE != LPAREN) ||
01229 stmt_has_double_colon()) {
01230
01231
01232
01233
01234 implicit_use_semantics();
01235 }
01236
01237
01238
01239 break;
01240
01241 default:
01242 implicit_use_semantics();
01243 break;
01244 }
01245 }
01246
01247 if (stmt_type != Use_Stmt &&
01248 SCP_USED_MODULE_LIST(curr_scp_idx) != NULL_IDX) {
01249 use_stmt_semantics();
01250 }
01251
01252 if (need_ez_debug_label) {
01253 gen_debug_lbl_stmt(curr_stmt_sh_idx, Ldbg_Stmt_Lbl, NULL_IDX);
01254 need_ez_debug_label = FALSE;
01255 }
01256
01257 if (cmd_line_flags.debug_lvl == Debug_Lvl_0) {
01258
01259
01260
01261 if (prev_stmt_start_line != stmt_start_line) {
01262
01263
01264
01265 switch (stmt_type) {
01266 case Allocate_Stmt:
01267 case Arith_If_Stmt:
01268 case Assign_Stmt:
01269 case Assignment_Stmt:
01270 case Backspace_Stmt:
01271 case Buffer_Stmt:
01272 case Call_Stmt:
01273 case Case_Stmt:
01274 case Close_Stmt:
01275 case Continue_Stmt:
01276 case Cycle_Stmt:
01277 case Deallocate_Stmt:
01278 case Decode_Stmt:
01279 case Do_Iterative_Stmt:
01280 case Do_While_Stmt:
01281 case Do_Infinite_Stmt:
01282 case Else_Where_Stmt:
01283 case Encode_Stmt:
01284 case Endfile_Stmt:
01285 case Entry_Stmt:
01286 case Exit_Stmt:
01287 case Goto_Stmt:
01288 case If_Cstrct_Stmt:
01289 case If_Stmt:
01290 case Inquire_Stmt:
01291 case Nullify_Stmt:
01292 case Open_Stmt:
01293 case Outmoded_If_Stmt:
01294 case Pause_Stmt:
01295 case Print_Stmt:
01296 case Read_Stmt:
01297 case Return_Stmt:
01298 case Rewind_Stmt:
01299 case Select_Stmt:
01300 case Stop_Stmt:
01301 case Then_Stmt:
01302 case Where_Cstrct_Stmt:
01303 case Where_Stmt:
01304 case Write_Stmt:
01305 gen_debug_lbl_stmt(curr_stmt_sh_idx,
01306 Ldbg_Stmt_Lbl,
01307 NULL_IDX);
01308 break;
01309
01310 }
01311 }
01312 prev_stmt_start_line = stmt_start_line;
01313 }
01314
01315 if (stmt_label_idx != NULL_IDX) {
01316 gen_attr_and_IR_for_lbl(TRUE);
01317 }
01318
01319 (*stmt_parsers[stmt_type])();
01320
01321 stmt_level_semantics();
01322
01323 if (cdir_switches.implicit_use_idx != NULL_IDX) {
01324
01325
01326
01327
01328 implicit_use_semantics();
01329 }
01330
01331 if (cmd_line_flags.debug_lvl == Debug_Lvl_1) {
01332
01333
01334
01335
01336 switch (stmt_type) {
01337 case If_Cstrct_Stmt:
01338 case Else_Stmt:
01339 case Else_If_Stmt:
01340 case Else_Where_Stmt:
01341 case Case_Stmt:
01342 case Where_Cstrct_Stmt:
01343 need_ez_debug_label = TRUE;
01344 break;
01345 }
01346 }
01347 }
01348 else {
01349
01350
01351
01352
01353
01354
01355
01356
01357
01358
01359
01360
01361
01362 stmt_start_line = LA_CH_LINE;
01363 stmt_start_col = LA_CH_COLUMN;
01364 SH_GLB_LINE(curr_stmt_sh_idx) = stmt_start_line;
01365 SH_COL_NUM(curr_stmt_sh_idx) = stmt_start_col;
01366 SH_STMT_TYPE(curr_stmt_sh_idx) = stmt_type;
01367
01368 if (SCP_ATTR_IDX(curr_scp_idx) == glb_tbl_idx[Main_Attr_Idx] &&
01369 !AT_DEFINED(glb_tbl_idx[Main_Attr_Idx]) &&
01370 !AT_DCL_ERR(glb_tbl_idx[Main_Attr_Idx])) {
01371
01372 if (curr_stmt_category == Init_Stmt_Cat) {
01373 curr_stmt_category = Use_Stmt_Cat;
01374 }
01375
01376 token = main_token;
01377 TOKEN_LINE(token) = stmt_start_line;
01378 TOKEN_COLUMN(token) = stmt_start_col;
01379 save_blk_stk_idx = blk_stk_idx;
01380 blk_stk_idx = BLK_HEAD_IDX;
01381 defer_msg = 1;
01382
01383 start_new_prog_unit(Program, Program_Blk, TRUE, FALSE, &defer_msg);
01384
01385 CURR_BLK_NAME = NULL_IDX;
01386 blk_stk_idx = save_blk_stk_idx;
01387 }
01388
01389 if (cif_need_unit_rec &&
01390 stmt_type != Directive_Stmt &&
01391 stmt_type != End_Parallel_Stmt &&
01392 stmt_type != End_Do_Parallel_Stmt &&
01393 stmt_type != End_Parallel_Case_Stmt &&
01394 stmt_type != Parallel_Case_Stmt &&
01395 stmt_type != End_Guard_Stmt &&
01396 stmt_type != Open_MP_Section_Stmt &&
01397 stmt_type != Open_MP_End_Parallel_Stmt &&
01398 stmt_type != Open_MP_End_Do_Stmt &&
01399 stmt_type != Open_MP_End_Parallel_Sections_Stmt &&
01400 stmt_type != Open_MP_End_Sections_Stmt &&
01401 stmt_type != Open_MP_End_Section_Stmt &&
01402 stmt_type != Open_MP_End_Single_Stmt &&
01403 stmt_type != Open_MP_End_Parallel_Do_Stmt &&
01404 stmt_type != Open_MP_End_Master_Stmt &&
01405 stmt_type != Open_MP_End_Critical_Stmt &&
01406 stmt_type != Open_MP_End_Ordered_Stmt &&
01407 stmt_type != SGI_Section_Stmt &&
01408 stmt_type != SGI_End_Psection_Stmt &&
01409 stmt_type != SGI_End_Pdo_Stmt &&
01410 stmt_type != SGI_End_Parallel_Stmt &&
01411 stmt_type != SGI_End_Critical_Section_Stmt &&
01412 stmt_type != SGI_End_Single_Process_Stmt &&
01413 stmt_type != SGI_Region_End_Stmt) {
01414
01415 cif_unit_rec();
01416
01417 if (cif_flags) {
01418 cif_begin_scope_rec();
01419
01420 if (cif_flags & XREF_RECS) {
01421 cif_usage_rec(glb_tbl_idx[Main_Attr_Idx],
01422 AT_Tbl_Idx,
01423 stmt_start_line,
01424 stmt_start_col,
01425 CIF_Symbol_Declaration);
01426 }
01427 }
01428 }
01429
01430 if ((stmt_label_idx | stmt_construct_idx) == NULL_IDX) {
01431
01432 if (LA_CH_CLASS == Ch_Class_Digit && ! label_ok) {
01433 PRINTMSG (LA_CH_LINE, 407, Error, LA_CH_COLUMN);
01434 }
01435 else {
01436
01437
01438
01439
01440 PRINTMSG (LA_CH_LINE, 100, Error, LA_CH_COLUMN);
01441 }
01442 }
01443 else {
01444
01445
01446
01447
01448 if (stmt_label_idx != NULL_IDX) {
01449 PRINTMSG (LA_CH_LINE, 6, Error, LA_CH_COLUMN);
01450
01451
01452
01453
01454
01455 if (CURR_BLK != Derived_Type_Blk) {
01456 stmt_label_idx = srch_sym_tbl(TOKEN_STR(label_token),
01457 TOKEN_LEN(label_token),
01458 &name_idx);
01459
01460 if (stmt_label_idx != NULL_IDX &&
01461 ! AT_DEFINED(stmt_label_idx) &&
01462 ATL_FWD_REF_IDX(stmt_label_idx) != NULL_IDX) {
01463 AT_DCL_ERR(stmt_label_idx) = TRUE;
01464 resolve_fwd_lbl_refs();
01465 }
01466 }
01467 }
01468
01469
01470
01471
01472 if (stmt_construct_idx != NULL_IDX) {
01473 PRINTMSG (LA_CH_LINE, 6, Error, LA_CH_COLUMN);
01474 AT_DCL_ERR(stmt_construct_idx) = TRUE;
01475 }
01476 }
01477 parse_err_flush(Find_EOS, NULL);
01478 NEXT_LA_CH;
01479
01480 if (defer_msg > 1 && LA_CH_CLASS != Ch_Class_EOF) {
01481 PRINTMSG (AT_DEF_LINE(SCP_ATTR_IDX(curr_scp_idx)), defer_msg,
01482
01483 # if defined(_ERROR_DUPLICATE_GLOBALS)
01484 Error,
01485 # else
01486 Warning,
01487 # endif
01488 AT_DEF_COLUMN(SCP_ATTR_IDX(curr_scp_idx)));
01489 }
01490
01491 }
01492
01493 # if (defined(_TARGET_OS_IRIX) || defined(_TARGET_OS_LINUX) || defined(_TARGET_OS_DARWIN))
01494 if (stmt_type != Directive_Stmt) {
01495 directives_are_global = FALSE;
01496 }
01497
01498 if (stmt_type != Directive_Stmt &&
01499 stmt_type != End_Parallel_Stmt &&
01500 stmt_type != End_Do_Parallel_Stmt &&
01501 stmt_type != End_Parallel_Case_Stmt &&
01502 stmt_type != Parallel_Case_Stmt &&
01503 stmt_type != End_Guard_Stmt &&
01504 stmt_type != Open_MP_Section_Stmt &&
01505 stmt_type != Open_MP_End_Parallel_Stmt &&
01506 stmt_type != Open_MP_End_Do_Stmt &&
01507 stmt_type != Open_MP_End_Parallel_Sections_Stmt &&
01508 stmt_type != Open_MP_End_Sections_Stmt &&
01509 stmt_type != Open_MP_End_Section_Stmt &&
01510 stmt_type != Open_MP_End_Single_Stmt &&
01511 stmt_type != Open_MP_End_Parallel_Do_Stmt &&
01512 stmt_type != Open_MP_End_Master_Stmt &&
01513 stmt_type != Open_MP_End_Critical_Stmt &&
01514 stmt_type != Open_MP_End_Ordered_Stmt &&
01515 stmt_type != SGI_Section_Stmt &&
01516 stmt_type != SGI_End_Psection_Stmt &&
01517 stmt_type != SGI_End_Pdo_Stmt &&
01518 stmt_type != SGI_End_Parallel_Stmt &&
01519 stmt_type != SGI_End_Critical_Section_Stmt &&
01520 stmt_type != SGI_End_Single_Process_Stmt &&
01521 stmt_type != SGI_Region_End_Stmt &&
01522 cdir_switches.inline_here_sgi) {
01523
01524
01525
01526 need_new_sh = TRUE;
01527
01528 if (SH_IR_IDX(curr_stmt_sh_idx)) {
01529
01530
01531 #ifdef KEY
01532
01533
01534 int new_stmt = ntr_sh_tbl();
01535 SH_NEXT_IDX(curr_stmt_sh_idx) = new_stmt;
01536 #else
01537 SH_NEXT_IDX(curr_stmt_sh_idx) = ntr_sh_tbl();
01538 #endif
01539 SH_PREV_IDX(SH_NEXT_IDX(curr_stmt_sh_idx)) = curr_stmt_sh_idx;
01540 curr_stmt_sh_idx = SH_NEXT_IDX(curr_stmt_sh_idx);
01541 SH_STMT_TYPE(curr_stmt_sh_idx) = Directive_Stmt;
01542 }
01543
01544 SH_GLB_LINE(curr_stmt_sh_idx)= stmt_start_line;
01545 SH_COL_NUM(curr_stmt_sh_idx) = stmt_start_col;
01546
01547 NTR_IR_TBL(ir_idx);
01548 IR_OPR(ir_idx) = End_Inline_Here_Star_Opr;
01549
01550
01551
01552 IR_TYPE_IDX(ir_idx) = TYPELESS_DEFAULT_TYPE;
01553 IR_LINE_NUM(ir_idx) = stmt_start_line;
01554 IR_COL_NUM(ir_idx) = stmt_start_col;
01555
01556 SH_IR_IDX(curr_stmt_sh_idx) = ir_idx;
01557 cdir_switches.inline_here_sgi = FALSE;
01558 }
01559 # endif
01560
01561 if (LA_CH_CLASS == Ch_Class_EOF) {
01562 EOPU_encountered = TRUE;
01563 }
01564 }
01565
01566 # if defined(_EXPRESSION_EVAL)
01567
01568
01569
01570
01571 if (cmd_line_flags.expression_eval_stmt ||
01572 cmd_line_flags.expression_eval_expr) {
01573
01574 stmt_type = End_Stmt;
01575
01576 if (need_new_sh) {
01577 sh_idx = curr_stmt_sh_idx;
01578 curr_stmt_sh_idx = ntr_sh_tbl();
01579 SH_NEXT_IDX(sh_idx) = curr_stmt_sh_idx;
01580 SH_PREV_IDX(curr_stmt_sh_idx) = sh_idx;
01581 }
01582 else {
01583
01584
01585 sh_idx = SH_PREV_IDX(curr_stmt_sh_idx);
01586 CLEAR_TBL_NTRY(sh_tbl, curr_stmt_sh_idx);
01587 SH_PREV_IDX(curr_stmt_sh_idx) = sh_idx;
01588 }
01589
01590 expression_eval_end();
01591 }
01592
01593 # endif
01594
01595 if (blk_stk_idx != NULL_IDX) {
01596
01597 if (SCP_ATTR_IDX(curr_scp_idx) == glb_tbl_idx[Main_Attr_Idx] &&
01598 stmt_start_line == AT_DEF_LINE(glb_tbl_idx[Main_Attr_Idx]) &&
01599 !SCP_IN_ERR(curr_scp_idx) &&
01600 LA_CH_CLASS == Ch_Class_EOF) {
01601
01602
01603
01604 SCP_IN_ERR(curr_scp_idx) = TRUE;
01605 AT_DCL_ERR(SCP_ATTR_IDX(curr_scp_idx)) = TRUE;
01606 PRINTMSG (stmt_start_line, 1581, Error, stmt_start_col);
01607 }
01608
01609
01610
01611
01612 clearing_blk_stk = TRUE;
01613
01614 if (need_new_sh) {
01615 sh_idx = curr_stmt_sh_idx;
01616 curr_stmt_sh_idx = ntr_sh_tbl();
01617 SH_NEXT_IDX(sh_idx) = curr_stmt_sh_idx;
01618 SH_PREV_IDX(curr_stmt_sh_idx) = sh_idx;
01619 }
01620 else {
01621 sh_idx = SH_PREV_IDX(curr_stmt_sh_idx);
01622 CLEAR_TBL_NTRY(sh_tbl, curr_stmt_sh_idx);
01623 SH_PREV_IDX(curr_stmt_sh_idx) = sh_idx;
01624 need_new_sh = TRUE;
01625 }
01626
01627 SH_ERR_FLG(curr_stmt_sh_idx) = TRUE;
01628
01629 pop_and_err_blk_stk(NULL_IDX, TRUE);
01630
01631 clearing_blk_stk = FALSE;
01632 }
01633
01634
01635
01636 TBL_FREE(blk_stk);
01637
01638 TRACE (Func_Exit, "parse_prog_unit", NULL);
01639
01640 return;
01641
01642 }
01643
01644
01645
01646
01647
01648
01649
01650
01651
01652
01653
01654
01655
01656
01657
01658
01659
01660
01661 void init_parse_prog_unit()
01662
01663 {
01664 int i;
01665 int idx;
01666 id_str_type name;
01667 int name_idx;
01668 token_type npes_token;
01669 int npes_attr;
01670 int save_stmt_start_line;
01671 long *type_tbl_base;
01672 long *static_type_tbl_base;
01673
01674
01675 TRACE (Func_Entry, "init_parse_prog_unit", NULL);
01676
01677 save_stmt_start_line = stmt_start_line;
01678 stmt_start_line = 1;
01679
01680
01681
01682
01683
01684 set_integer_default_type();
01685
01686
01687 if (on_off_flags.recognize_minus_zero) {
01688 for (i = 0; i < MAX_INTRIN_MAP_SIZE; i++) {
01689 if ((strcmp("SIGN", (char *)&intrin_map[i].id_str) == 0) ||
01690 (strcmp("DSIGN", (char *)&intrin_map[i].id_str) == 0)) {
01691 #ifdef KEY
01692
01693 intrin_map[i].mapped_4.string[1] = 'I';
01694 intrin_map[i].mapped_8.string[1] = 'I';
01695 #else
01696 intrin_map[i].mapped_4.string[8] = '_';
01697 intrin_map[i].mapped_8.string[8] = '_';
01698 #endif
01699 }
01700 }
01701 }
01702
01703
01704
01705
01706
01707
01708
01709
01710
01711
01712
01713 CHECK_INITIAL_ALLOC (blk_stk, NULL_IDX);
01714
01715 CHECK_INITIAL_ALLOC (attr_list_tbl, NULL_IDX);
01716 CHECK_INITIAL_ALLOC (attr_tbl, NULL_IDX);
01717 CHECK_INITIAL_ALLOC (attr_aux_tbl, NULL_IDX);
01718 CHECK_INITIAL_ALLOC (bounds_tbl, BD_LAST_USED_IDX);
01719 CHECK_INITIAL_ALLOC (const_tbl, NULL_IDX);
01720 CHECK_INITIAL_ALLOC (const_pool, NULL_IDX);
01721 CHECK_INITIAL_ALLOC (sec_name_tbl, NULL_IDX);
01722 CHECK_INITIAL_ALLOC (stor_blk_tbl, NULL_IDX);
01723 CHECK_INITIAL_ALLOC (loc_name_tbl, NULL_IDX);
01724 CHECK_INITIAL_ALLOC (hidden_name_tbl,NULL_IDX);
01725 CHECK_INITIAL_ALLOC (name_pool, NP_LAST_USED_IDX);
01726 CHECK_INITIAL_ALLOC (scp_tbl, NULL_IDX);
01727 CHECK_INITIAL_ALLOC (type_tbl, TYP_LAST_USED_IDX);
01728 CHECK_INITIAL_ALLOC (equiv_tbl, NULL_IDX);
01729
01730 CHECK_INITIAL_ALLOC (ir_tbl, NULL_IDX);
01731 CHECK_INITIAL_ALLOC (sh_tbl, NULL_IDX);
01732 CHECK_INITIAL_ALLOC (ir_list_tbl, NULL_IDX);
01733
01734
01735
01736
01737
01738 CLEAR_TBL_NTRY(attr_list_tbl, NULL_IDX);
01739 CLEAR_TBL_NTRY(ir_tbl, NULL_IDX);
01740 CLEAR_TBL_NTRY(ir_list_tbl, NULL_IDX);
01741 CLEAR_TBL_NTRY(sh_tbl, NULL_IDX);
01742 CLEAR_TBL_NTRY(bounds_tbl, NULL_IDX);
01743
01744
01745
01746
01747 for (idx = 0; idx < Num_Glb_Tbl_Idxs; idx++) {
01748 glb_tbl_idx[idx] = 0;
01749 }
01750
01751 init_target_opnd = null_opnd;
01752
01753 type_tbl_base = (long *) type_tbl;
01754 static_type_tbl_base = (long *) type_init_tbl;
01755
01756 for (idx = 0; idx < ((Num_Linear_Types+2) * NUM_TYP_WDS); idx++) {
01757 type_tbl_base[idx] = static_type_tbl_base[idx];
01758 }
01759
01760
01761
01762
01763 type_tbl[NULL_IDX] = type_tbl[INTEGER_DEFAULT_TYPE];
01764
01765
01766
01767
01768
01769
01770
01771
01772
01773
01774 name_pool[0].name_long = 0;
01775 name_pool[1].name_long = 0;
01776 name_pool[2].name_long = LARGE_WORD_FOR_TBL_SRCH;
01777
01778 curr_scp_idx = INTRINSIC_SCP_IDX;
01779
01780 CLEAR_TBL_NTRY(scp_tbl, INTRINSIC_SCP_IDX);
01781
01782 init_name_and_stor_tbls(INTRINSIC_SCP_IDX, FALSE);
01783
01784 enter_intrinsic_info();
01785
01786 SCP_FIRST_CHILD_IDX(INTRINSIC_SCP_IDX) = 1;
01787 SCP_NUM_CHILDREN(INTRINSIC_SCP_IDX) = 1;
01788
01789 NTR_SCP_TBL(curr_scp_idx);
01790
01791 SCP_PARENT_IDX(curr_scp_idx) = 0;
01792
01793
01794
01795
01796 init_name_and_stor_tbls(curr_scp_idx, TRUE);
01797
01798
01799
01800
01801
01802
01803
01804 NTR_ATTR_TBL(glb_tbl_idx[Main_Attr_Idx]);
01805 AT_NAME_LEN(glb_tbl_idx[Main_Attr_Idx]) = 5;
01806 AT_NAME_IDX(glb_tbl_idx[Main_Attr_Idx]) = name_pool_idx + 1;
01807 AT_DEF_LINE(glb_tbl_idx[Main_Attr_Idx]) = curr_glb_line;
01808 AT_DEF_COLUMN(glb_tbl_idx[Main_Attr_Idx]) = 1;
01809 AT_OBJ_CLASS(glb_tbl_idx[Main_Attr_Idx]) = Pgm_Unit;
01810 ATP_EXT_NAME_LEN(glb_tbl_idx[Main_Attr_Idx]) = 5;
01811 ATP_EXT_NAME_IDX(glb_tbl_idx[Main_Attr_Idx]) = name_pool_idx + 1;
01812 ATP_PGM_UNIT(glb_tbl_idx[Main_Attr_Idx]) = Program;
01813 ATP_SCP_IDX(glb_tbl_idx[Main_Attr_Idx]) = curr_scp_idx;
01814 ATP_EXPL_ITRFC(glb_tbl_idx[Main_Attr_Idx]) = TRUE;
01815
01816 CREATE_ID(name, UNNAMED_PROGRAM_NAME, UNNAMED_PROGRAM_NAME_LEN);
01817 NTR_NAME_POOL(&(name.words[0]), UNNAMED_PROGRAM_NAME_LEN, idx);
01818
01819 SCP_ATTR_IDX(curr_scp_idx) = glb_tbl_idx[Main_Attr_Idx];
01820
01821 PUSH_BLK_STK(Program_Blk);
01822 SCP_IMPL_NONE(curr_scp_idx) = FALSE;
01823 SCP_PARENT_NONE(curr_scp_idx) = FALSE;
01824
01825 for (idx = 0; idx < MAX_IMPL_CHS; idx++) {
01826 IM_TYPE_IDX(curr_scp_idx, idx) = REAL_DEFAULT_TYPE;
01827 IM_SET(curr_scp_idx, idx) = FALSE;
01828 }
01829
01830 for (idx = IMPL_IDX('I'); idx <= IMPL_IDX('N'); idx++) {
01831 IM_TYPE_IDX(curr_scp_idx, idx) = INTEGER_DEFAULT_TYPE;
01832 }
01833
01834 init_const_tbl();
01835
01836
01837
01838 CREATE_ID(TOKEN_ID(npes_token), "N$PES", 5);
01839
01840 TOKEN_COLUMN(npes_token) = 1;
01841 TOKEN_LEN(npes_token) = 5;
01842 TOKEN_LINE(npes_token) = curr_glb_line;
01843 npes_attr = srch_sym_tbl(TOKEN_STR(npes_token),
01844 TOKEN_LEN(npes_token),
01845 &name_idx);
01846 npes_attr = ntr_sym_tbl(&npes_token,name_idx);
01847 LN_DEF_LOC(name_idx) = TRUE;
01848 AT_OBJ_CLASS(npes_attr) = Data_Obj;
01849 AT_COMPILER_GEND(npes_attr) = TRUE;
01850 AT_SEMANTICS_DONE(npes_attr) = TRUE;
01851 ATD_SYMBOLIC_CONSTANT(npes_attr) = TRUE;
01852 ATD_TYPE_IDX(npes_attr) = CG_INTEGER_DEFAULT_TYPE;
01853
01854
01855
01856
01857
01858
01859 if (cmd_line_flags.MPP_num_pes == 0) {
01860 ATD_CLASS(npes_attr) = Variable;
01861 }
01862 else {
01863 ATD_CLASS(npes_attr) = Constant;
01864 AT_DEFINED(npes_attr) = TRUE;
01865 ATD_FLD(npes_attr) = CN_Tbl_Idx;
01866 ATD_CONST_IDX(npes_attr) = C_INT_TO_CN(CG_INTEGER_DEFAULT_TYPE,
01867 cmd_line_flags.MPP_num_pes);
01868 }
01869
01870 const_safevl_idx = C_INT_TO_CN(CG_INTEGER_DEFAULT_TYPE,
01871 target_safevl);
01872
01873
01874
01875 TYP_IDX(Character_1) = CN_INTEGER_ONE_IDX;
01876 TYP_FLD(Character_1) = CN_Tbl_Idx;
01877 TYP_IDX(Character_2) = CN_INTEGER_ONE_IDX;
01878 TYP_FLD(Character_1) = CN_Tbl_Idx;
01879 TYP_IDX(Character_4) = CN_INTEGER_ONE_IDX;
01880 TYP_FLD(Character_4) = CN_Tbl_Idx;
01881
01882
01883
01884
01885
01886 # ifdef _TARGET_OS_SOLARIS
01887
01888 if (TYP_LINEAR(INTEGER_DEFAULT_TYPE) == Integer_8) {
01889 storage_bit_size_tbl[CRI_Ptr_8] = 64;
01890 }
01891
01892 # endif
01893
01894
01895
01896
01897 for (idx = BD_DEFERRED_1_IDX; idx <= BD_DEFERRED_7_IDX; idx++) {
01898 CLEAR_TBL_NTRY(bounds_tbl, idx);
01899 BD_ARRAY_CLASS(idx) = Deferred_Shape;
01900 BD_RANK(idx) = idx;
01901 BD_USED_NTRY(idx) = TRUE;
01902 BD_NTRY_SIZE(idx) = 1;
01903 BD_GLOBAL_IDX(idx) = idx;
01904 }
01905
01906 PRINT_INTRIN;
01907
01908 EOPU_encountered = FALSE;
01909 curr_stmt_category = Init_Stmt_Cat;
01910 curr_internal_lbl = 0;
01911 curr_debug_lbl = 0;
01912 if_stmt_lbl_idx = NULL_IDX;
01913
01914 cif_prog_unit_init();
01915
01916 curr_stmt_sh_idx = ntr_sh_tbl();
01917 SH_STMT_TYPE(curr_stmt_sh_idx) = Null_Stmt;
01918 SCP_FIRST_SH_IDX(curr_scp_idx) = curr_stmt_sh_idx;
01919 CURR_BLK_FIRST_SH_IDX = curr_stmt_sh_idx;
01920 need_new_sh = FALSE;
01921
01922
01923
01924 init_directive (1);
01925 stmt_start_line = save_stmt_start_line;
01926
01927 TRACE (Func_Exit, "init_parse_prog_unit", NULL);
01928
01929 return;
01930
01931 }
01932
01933
01934
01935
01936
01937
01938
01939
01940
01941
01942
01943
01944
01945
01946
01947
01948
01949
01950
01951
01952
01953 static void ck_lbl_construct_name(void)
01954
01955 {
01956 int ir_idx;
01957 int name_idx;
01958 int sh_idx;
01959
01960
01961 TRACE (Func_Entry, "ck_lbl_construct_name", NULL);
01962
01963 stmt_label_idx = NULL_IDX;
01964 stmt_construct_idx = NULL_IDX;
01965
01966
01967
01968
01969
01970 if (label_ok &&
01971 MATCHED_TOKEN_CLASS(Tok_Class_Label) &&
01972 ! TOKEN_ERR(token)) {
01973
01974
01975
01976
01977
01978
01979
01980
01981
01982
01983
01984
01985
01986 label_token = token;
01987 stmt_label_idx = -911;
01988 }
01989
01990 if (MATCHED_TOKEN_CLASS(Tok_Class_Construct_Def)) {
01991
01992
01993
01994 stmt_construct_idx = srch_sym_tbl(TOKEN_STR(token),
01995 TOKEN_LEN(token),
01996 &name_idx);
01997
01998 if (stmt_construct_idx == NULL_IDX ||
01999 AT_OBJ_CLASS(stmt_construct_idx) != Label) {
02000
02001 if (stmt_construct_idx == NULL_IDX) {
02002 stmt_construct_idx = ntr_sym_tbl(&token, name_idx);
02003 }
02004 else {
02005 fnd_semantic_err(Obj_Construct,
02006 TOKEN_LINE(token),
02007 TOKEN_COLUMN(token),
02008 stmt_construct_idx,
02009 TRUE);
02010 CREATE_ERR_ATTR(stmt_construct_idx, TOKEN_LINE(token),
02011 TOKEN_COLUMN(token), Label);
02012 }
02013
02014 LN_DEF_LOC(name_idx) = TRUE;
02015 AT_OBJ_CLASS(stmt_construct_idx) = Label;
02016 AT_DEFINED(stmt_construct_idx) = TRUE;
02017 AT_DEF_LINE(stmt_construct_idx) = TOKEN_LINE(token);
02018 ATL_DEBUG_CLASS(stmt_construct_idx) = Ldbg_Construct_Name;
02019
02020 gen_sh(Before, Construct_Def, TOKEN_LINE(token), TOKEN_COLUMN(token),
02021 FALSE, FALSE, FALSE);
02022
02023 sh_idx = SH_PREV_IDX(curr_stmt_sh_idx);
02024
02025 if (SCP_FIRST_SH_IDX(curr_scp_idx) == curr_stmt_sh_idx) {
02026 SCP_FIRST_SH_IDX(curr_scp_idx) = sh_idx;
02027 }
02028
02029 NTR_IR_TBL(ir_idx);
02030 SH_IR_IDX(sh_idx) = ir_idx;
02031 IR_OPR(ir_idx) = Label_Opr;
02032 IR_TYPE_IDX(ir_idx) = TYPELESS_DEFAULT_TYPE;
02033 IR_LINE_NUM(ir_idx) = TOKEN_LINE(token);
02034 IR_COL_NUM(ir_idx) = TOKEN_COLUMN(token);
02035 IR_LINE_NUM_L(ir_idx) = TOKEN_LINE(token);
02036 IR_COL_NUM_L(ir_idx) = TOKEN_COLUMN(token);
02037 IR_FLD_L(ir_idx) = AT_Tbl_Idx;
02038 IR_IDX_L(ir_idx) = stmt_construct_idx;
02039 IR_FLD_R(ir_idx) = SH_Tbl_Idx;
02040 IR_IDX_R(ir_idx) = curr_stmt_sh_idx;
02041
02042 if (cif_flags & XREF_RECS) {
02043 cif_usage_rec(stmt_construct_idx, AT_Tbl_Idx,
02044 TOKEN_LINE(token), TOKEN_COLUMN(token),
02045 CIF_Symbol_Declaration);
02046 }
02047
02048 }
02049 else {
02050 AT_DCL_ERR(stmt_construct_idx) = TRUE;
02051 PRINTMSG(TOKEN_LINE(token), 171, Error, TOKEN_COLUMN(token),
02052 AT_OBJ_NAME_PTR(stmt_construct_idx),
02053 AT_DEF_LINE(stmt_construct_idx));
02054 }
02055 }
02056
02057 TRACE (Func_Exit, "ck_lbl_construct_name", NULL);
02058
02059 return;
02060
02061 }
02062
02063
02064
02065
02066
02067
02068
02069
02070
02071
02072
02073
02074
02075
02076
02077
02078
02079
02080
02081
02082
02083
02084
02085
02086 void gen_attr_and_IR_for_lbl(boolean check_stmt_type)
02087
02088 {
02089 int ir_idx;
02090 int name_idx;
02091 int sh_idx;
02092
02093
02094 TRACE (Func_Entry, "gen_attr_and_IR_for_lbl", NULL);
02095
02096 if (check_stmt_type &&
02097 (stmt_type == Type_Decl_Stmt ||
02098 stmt_type == Function_Stmt ||
02099 stmt_type == Recursive_Stmt ||
02100 stmt_type == Subroutine_Stmt ||
02101 stmt_type == Pure_Stmt ||
02102 stmt_type == Elemental_Stmt ||
02103 stmt_type == End_Stmt)) {
02104 goto EXIT;
02105 }
02106
02107 stmt_label_idx = srch_sym_tbl(TOKEN_STR(label_token),
02108 TOKEN_LEN(label_token),
02109 &name_idx);
02110
02111 if (stmt_label_idx == NULL_IDX) {
02112 stmt_label_idx = ntr_sym_tbl(&label_token, name_idx);
02113 AT_OBJ_CLASS(stmt_label_idx) = Label;
02114 ATL_DEBUG_CLASS(stmt_label_idx) = Ldbg_User_Lbl;
02115
02116 if (! check_stmt_type) {
02117 ATL_CLASS(stmt_label_idx) = Lbl_User;
02118 }
02119
02120 LN_DEF_LOC(name_idx) = TRUE;
02121 }
02122
02123 if (AT_DEFINED(stmt_label_idx)) {
02124 PRINTMSG(TOKEN_LINE(label_token), 146, Error,
02125 TOKEN_COLUMN(label_token),
02126 AT_OBJ_NAME_PTR(stmt_label_idx),
02127 AT_DEF_LINE(stmt_label_idx));
02128 }
02129 else {
02130
02131
02132
02133
02134 if (ATL_FWD_REF_IDX(stmt_label_idx) == NULL_IDX) {
02135 AT_DEFINED(stmt_label_idx) = TRUE;
02136 ATL_DEF_STMT_IDX(stmt_label_idx) = curr_stmt_sh_idx;
02137 }
02138
02139 if (! cdir_switches.vector) {
02140 ATL_NOVECTOR(stmt_label_idx) = TRUE;
02141 }
02142
02143 AT_DEF_LINE(stmt_label_idx) = TOKEN_LINE(label_token);
02144 SH_LABELED(curr_stmt_sh_idx) = TRUE;
02145
02146 gen_sh(Before, Label_Def,
02147 TOKEN_LINE(label_token), TOKEN_COLUMN(label_token),
02148 FALSE, FALSE, FALSE);
02149
02150 sh_idx = SH_PREV_IDX(curr_stmt_sh_idx);
02151
02152 if (SCP_FIRST_SH_IDX(curr_scp_idx) == curr_stmt_sh_idx) {
02153 SCP_FIRST_SH_IDX(curr_scp_idx) = sh_idx;
02154 }
02155
02156 NTR_IR_TBL(ir_idx);
02157 SH_IR_IDX(sh_idx) = ir_idx;
02158 IR_OPR(ir_idx) = Label_Opr;
02159 IR_TYPE_IDX(ir_idx) = TYPELESS_DEFAULT_TYPE;
02160 IR_LINE_NUM(ir_idx) = TOKEN_LINE(label_token);
02161 IR_COL_NUM(ir_idx) = TOKEN_COLUMN(label_token);
02162 IR_LINE_NUM_L(ir_idx) = TOKEN_LINE(label_token);
02163 IR_COL_NUM_L(ir_idx) = TOKEN_COLUMN(label_token);
02164 IR_FLD_L(ir_idx) = AT_Tbl_Idx;
02165 IR_IDX_L(ir_idx) = stmt_label_idx;
02166 IR_FLD_R(ir_idx) = SH_Tbl_Idx;
02167 IR_IDX_R(ir_idx) = curr_stmt_sh_idx;
02168
02169 if (cif_flags & XREF_RECS) {
02170 cif_usage_rec(stmt_label_idx, AT_Tbl_Idx,
02171 TOKEN_LINE(label_token), TOKEN_COLUMN(label_token),
02172 CIF_Symbol_Declaration);
02173 }
02174
02175 }
02176
02177 EXIT:
02178
02179 TRACE (Func_Exit, "gen_attr_and_IR_for_lbl", NULL);
02180
02181 return;
02182
02183 }
02184
02185
02186
02187
02188
02189
02190
02191
02192
02193
02194
02195
02196
02197
02198
02199
02200
02201
02202
02203
02204
02205 void determine_stmt_type(void)
02206
02207 {
02208 int buf_idx;
02209 int stmt_num;
02210
02211 TRACE (Func_Entry, "determine_stmt_type", NULL);
02212 stmt_start_line = TOKEN_LINE(token);
02213 stmt_start_col = TOKEN_COLUMN(token);
02214 buf_idx = TOKEN_BUF_IDX(token);
02215 stmt_num = TOKEN_STMT_NUM(token);
02216 stmt_type = token_to_stmt_type [TOKEN_VALUE(token)];
02217
02218 SH_GLB_LINE(curr_stmt_sh_idx) = stmt_start_line;
02219 SH_COL_NUM(curr_stmt_sh_idx) = stmt_start_col;
02220
02221 #ifdef KEY
02222
02223 #else
02224 if (stmt_type == Format_Stmt &&
02225 stmt_label_idx &&
02226 LA_CH_VALUE == LPAREN) {
02227
02228
02229
02230
02231 }
02232 else
02233 #endif
02234 if (stmt_type != Assignment_Stmt &&
02235 stmt_type != Directive_Stmt &&
02236 stmt_type != End_Parallel_Stmt &&
02237 stmt_type != End_Do_Parallel_Stmt &&
02238 stmt_type != End_Parallel_Case_Stmt &&
02239 stmt_type != Parallel_Case_Stmt &&
02240 stmt_type != End_Guard_Stmt &&
02241 stmt_type != Open_MP_Section_Stmt &&
02242 stmt_type != Open_MP_End_Parallel_Stmt &&
02243 stmt_type != Open_MP_End_Do_Stmt &&
02244 stmt_type != Open_MP_End_Parallel_Sections_Stmt &&
02245 stmt_type != Open_MP_End_Sections_Stmt &&
02246 stmt_type != Open_MP_End_Section_Stmt &&
02247 stmt_type != Open_MP_End_Single_Stmt &&
02248 stmt_type != Open_MP_End_Parallel_Do_Stmt &&
02249 stmt_type != Open_MP_End_Master_Stmt &&
02250 stmt_type != Open_MP_End_Critical_Stmt &&
02251 stmt_type != Open_MP_End_Ordered_Stmt &&
02252 stmt_type != SGI_Section_Stmt &&
02253 stmt_type != SGI_End_Psection_Stmt &&
02254 stmt_type != SGI_End_Pdo_Stmt &&
02255 stmt_type != SGI_End_Parallel_Stmt &&
02256 stmt_type != SGI_End_Critical_Section_Stmt &&
02257 stmt_type != SGI_End_Single_Process_Stmt &&
02258 stmt_type != SGI_Region_End_Stmt) {
02259
02260 if (TOKEN_VALUE(token) == Tok_Kwd_Double && ! set_stmt_type_known()) {
02261
02262
02263
02264
02265 reset_lex (buf_idx, stmt_num);
02266 MATCHED_TOKEN_CLASS (Tok_Class_DO);
02267 stmt_type = Do_Iterative_Stmt;
02268 }
02269
02270 if (stmt_type == Do_Iterative_Stmt) {
02271
02272 if (! set_stmt_type_known() ) {
02273
02274 if (! stmt_is_DO_stmt () ) {
02275 stmt_type = Assignment_Stmt;
02276 }
02277 }
02278 }
02279 else if (stmt_type == Data_Stmt) {
02280
02281 if ( ! stmt_is_DATA_stmt () ) {
02282 stmt_type = Assignment_Stmt;
02283 }
02284 }
02285 else if (! set_stmt_type_known() ) {
02286 stmt_type = Assignment_Stmt;
02287 }
02288 }
02289
02290 if (stmt_type == Assignment_Stmt) {
02291
02292 if (TOKEN_VALUE(token) != Tok_Id) {
02293
02294
02295
02296
02297
02298
02299
02300 reset_lex (buf_idx, stmt_num);
02301 MATCHED_TOKEN_CLASS(Tok_Class_Id);
02302 }
02303 }
02304
02305
02306
02307 SH_STMT_TYPE(curr_stmt_sh_idx) = stmt_type;
02308
02309
02310
02311
02312
02313
02314 need_new_sh = TRUE;
02315
02316
02317
02318
02319
02320
02321
02322
02323 if (cif_flags & MISC_RECS) {
02324 cif_stmt_type_rec(FALSE, CIF_Not_Exact, statement_number);
02325 }
02326
02327 TRACE (Func_Exit, "determine_stmt_type", NULL);
02328
02329 return;
02330
02331 }
02332
02333
02334
02335
02336
02337
02338
02339
02340
02341
02342
02343
02344
02345
02346
02347
02348
02349
02350
02351 boolean iss_blk_stk_err(void)
02352
02353 {
02354 int blk_idx;
02355 int err_msg;
02356 boolean iss_msg;
02357
02358
02359 TRACE (Func_Entry, "iss_blk_stk_err", NULL);
02360
02361
02362
02363
02364
02365 if (if_stmt_lbl_idx != NULL_IDX) {
02366 iss_msg = FALSE;
02367 goto EXIT;
02368 }
02369
02370 err_msg = 5;
02371 iss_msg = TRUE;
02372
02373 if (STMT_CANT_BE_IN_BLK(stmt_type, CURR_BLK)) {
02374
02375 for (blk_idx = blk_stk_idx;
02376
02377
02378
02379
02380 blk_idx > NULL_IDX &&
02381 BLK_ERR(blk_idx) == TRUE &&
02382 STMT_CANT_BE_IN_BLK(stmt_type, BLK_TYPE(blk_idx));
02383
02384 blk_idx--);
02385
02386 if (blk_idx > NULL_IDX) {
02387 err_msg = (STMT_CANT_BE_IN_BLK(stmt_type, BLK_TYPE(blk_idx))) ?
02388 blk_err_msgs[BLK_TYPE(blk_idx)] : FALSE;
02389 }
02390 }
02391
02392 switch (stmt_type) {
02393
02394 case Blockdata_Stmt:
02395 case Module_Stmt:
02396 case Program_Stmt:
02397
02398 pop_and_err_blk_stk(NULL_IDX, TRUE);
02399 init_parse_prog_unit();
02400 err_msg = 0;
02401 iss_msg = FALSE;
02402 break;
02403
02404 case Function_Stmt:
02405 case Subroutine_Stmt:
02406 for (blk_idx = blk_stk_idx;
02407 (blk_idx > NULL_IDX &&
02408 BLK_TYPE(blk_idx) != Interface_Blk &&
02409 BLK_TYPE(blk_idx) != Contains_Blk);
02410 blk_idx--);
02411
02412
02413
02414
02415 pop_and_err_blk_stk(blk_idx, TRUE);
02416
02417 if (blk_idx == NULL_IDX) {
02418
02419
02420 if (cif_flags & BASIC_RECS) {
02421 cif_send_sytb();
02422 }
02423 init_parse_prog_unit();
02424 }
02425
02426 err_msg = 0;
02427 iss_msg = FALSE;
02428 break;
02429
02430 case Return_Stmt:
02431 if (ATP_PGM_UNIT(SCP_ATTR_IDX(curr_scp_idx)) != Function &&
02432 ATP_PGM_UNIT(SCP_ATTR_IDX(curr_scp_idx)) != Subroutine) {
02433
02434 switch (ATP_PGM_UNIT(SCP_ATTR_IDX(curr_scp_idx))) {
02435 case Module:
02436 err_msg = 19;
02437 break;
02438
02439 case Blockdata:
02440 err_msg = 15;
02441 break;
02442
02443 case Program:
02444 err_msg = 16;
02445 break;
02446 # ifdef _DEBUG
02447 default:
02448 PRINTMSG(stmt_start_line, 179, Internal,
02449 stmt_start_col, "iss_blk_stk_err");
02450 break;
02451 # endif
02452 }
02453 }
02454 break;
02455
02456 case Private_Stmt:
02457 case Public_Stmt:
02458
02459 if (STMT_LEGAL_IN_BLK(stmt_type, CURR_BLK)) {
02460
02461 if (STMT_CANT_BE_IN_BLK(stmt_type, BLK_TYPE(BLK_HEAD_IDX))) {
02462 err_msg = blk_err_msgs[BLK_TYPE(BLK_HEAD_IDX)];
02463 iss_msg = TRUE;
02464 }
02465 }
02466 break;
02467
02468 default:
02469 break;
02470
02471 }
02472
02473 if (iss_msg && err_msg != 0) {
02474 PRINTMSG(stmt_start_line, err_msg, Error, stmt_start_col,
02475 stmt_type_str[stmt_type]);
02476
02477 if (err_msg != 5) {
02478 SCP_IN_ERR(curr_scp_idx) = TRUE;
02479 }
02480 }
02481
02482 EXIT:
02483
02484 TRACE (Func_Exit, "iss_blk_stk_err", NULL);
02485
02486 return(iss_msg);
02487
02488 }
02489
02490
02491
02492
02493
02494
02495
02496
02497
02498
02499
02500
02501
02502
02503
02504
02505
02506
02507 void parse_bad_stmt(void)
02508
02509 {
02510 TRACE (Func_Entry, "parse_bad_stmt", NULL);
02511
02512 PRINTMSG(TOKEN_LINE(token), 141, Internal, TOKEN_COLUMN(token));
02513
02514 TRACE (Func_Exit, "parse_bad_stmt", NULL);
02515
02516 return;
02517
02518 }
02519
02520
02521
02522
02523
02524
02525
02526
02527
02528
02529
02530
02531
02532
02533
02534
02535
02536
02537 static void check_for_dup_derived_type_lbl(void)
02538 {
02539 int al_idx;
02540 int lbl_list_idx;
02541 int np_idx;
02542
02543
02544 TRACE (Func_Entry, "check_for_dup_derived_type_lbl", NULL);
02545
02546 if (CURR_BLK_NAME == NULL_IDX || AT_DCL_ERR(CURR_BLK_NAME) || CURR_BLK_ERR) {
02547
02548
02549
02550 stmt_label_idx = NULL_IDX;
02551 return;
02552 }
02553
02554 lbl_list_idx = (stmt_type == End_Type_Stmt) ?
02555 ATT_LABEL_LIST_IDX(BLK_NAME(blk_stk_idx + 1)) :
02556 ATT_LABEL_LIST_IDX(CURR_BLK_NAME);
02557
02558 while (lbl_list_idx != NULL_IDX &&
02559 ! EQUAL_STRS(TOKEN_STR(label_token),
02560 AT_OBJ_NAME_PTR(AL_ATTR_IDX(lbl_list_idx)))) {
02561 lbl_list_idx = AL_NEXT_IDX(lbl_list_idx);
02562 }
02563
02564 if (lbl_list_idx == NULL_IDX) {
02565 NTR_ATTR_TBL(stmt_label_idx);
02566 AT_DEF_COLUMN(stmt_label_idx) = TOKEN_COLUMN(label_token);
02567 AT_DEF_LINE(stmt_label_idx) = TOKEN_LINE(label_token);
02568
02569 NTR_NAME_POOL(TOKEN_ID(label_token).words,
02570 TOKEN_LEN(label_token),
02571 np_idx);
02572
02573 AT_NAME_IDX(stmt_label_idx) = np_idx;
02574 AT_NAME_LEN(stmt_label_idx) = TOKEN_LEN(label_token);
02575 AT_OBJ_CLASS(stmt_label_idx) = Label;
02576 AT_DEFINED(stmt_label_idx) = TRUE;
02577 ATL_CLASS(stmt_label_idx) = Lbl_User;
02578 ATL_DEF_STMT_IDX(stmt_label_idx) = curr_stmt_sh_idx;
02579 ATL_DEBUG_CLASS(stmt_label_idx) = Ldbg_User_Lbl;
02580
02581 NTR_ATTR_LIST_TBL(al_idx);
02582 AL_ATTR_IDX(al_idx) = stmt_label_idx;
02583 AL_NEXT_IDX(al_idx) = ATT_LABEL_LIST_IDX(CURR_BLK_NAME);
02584 ATT_LABEL_LIST_IDX(CURR_BLK_NAME) = al_idx;
02585
02586 if (cif_flags & INFO_RECS) {
02587 cif_label_rec(stmt_label_idx);
02588 }
02589
02590 if (cif_flags & XREF_RECS) {
02591 cif_usage_rec(stmt_label_idx,
02592 AT_Tbl_Idx,
02593 AT_DEF_LINE(stmt_label_idx),
02594 AT_DEF_COLUMN(stmt_label_idx),
02595 CIF_Symbol_Declaration);
02596 }
02597 }
02598 else {
02599 PRINTMSG(TOKEN_LINE(label_token), 146, Error,
02600 TOKEN_COLUMN(label_token),
02601 TOKEN_STR(label_token),
02602 AT_DEF_LINE(AL_ATTR_IDX(lbl_list_idx)));
02603 stmt_label_idx = AL_ATTR_IDX(lbl_list_idx);
02604 }
02605
02606 TRACE (Func_Exit, "check_for_dup_derived_type_lbl", NULL);
02607
02608 return;
02609
02610 }
02611
02612
02613
02614
02615
02616
02617
02618
02619
02620
02621
02622
02623
02624
02625
02626
02627
02628
02629
02630 extern void init_type(void)
02631
02632 {
02633 linear_type_type dp_linear_type;
02634
02635 TRACE (Func_Entry, "init_type", NULL);
02636
02637 set_integer_default_type();
02638
02639
02640
02641 dp_linear_type = half_linear_type[Fortran_Double];
02642
02643 type_init_tbl[DOUBLE_PRECISION_TYPE_IDX].fld.linear_type =
02644 (cmd_line_flags.s_doubleprecision16) ? Real_16 :
02645 init_default_linear_type[Fortran_Double];
02646
02647 type_init_tbl[DOUBLE_COMPLEX_TYPE_IDX].fld.linear_type =
02648 (cmd_line_flags.s_doublecomplex16) ? Complex_16:
02649 init_default_linear_type[Fortran_Double_Complex];
02650
02651 LOGICAL_DEFAULT_TYPE = (cmd_line_flags.s_logical8) ? Logical_8 :
02652 init_default_linear_type[Fortran_Logical];
02653 REAL_DEFAULT_TYPE = (cmd_line_flags.s_real8) ? Real_8 :
02654 init_default_linear_type[Fortran_Real];
02655 COMPLEX_DEFAULT_TYPE = (cmd_line_flags.s_complex8) ? Complex_8 :
02656 init_default_linear_type[Fortran_Complex];
02657
02658 CHARACTER_DEFAULT_TYPE = init_default_linear_type[Fortran_Character];
02659
02660 # if defined(_ACCEPT_CMD_s_32)
02661
02662 if (cmd_line_flags.s_default32) {
02663 CHARACTER_DEFAULT_TYPE = half_linear_type[Fortran_Character];
02664 COMPLEX_DEFAULT_TYPE = half_linear_type[Fortran_Complex];
02665 LOGICAL_DEFAULT_TYPE = half_linear_type[Fortran_Logical];
02666 REAL_DEFAULT_TYPE = half_linear_type[Fortran_Real];
02667
02668 type_init_tbl[DOUBLE_PRECISION_TYPE_IDX].fld.linear_type =
02669 half_linear_type[Fortran_Double];
02670
02671 type_init_tbl[DOUBLE_COMPLEX_TYPE_IDX].fld.linear_type =
02672 half_linear_type[Fortran_Double_Complex];
02673
02674
02675 # ifdef _TARGET_OS_MAX
02676 dp_linear_type = half_linear_type[Fortran_Real];
02677 # endif
02678
02679 }
02680
02681 # endif
02682
02683
02684 # if defined(_TARGET32) || defined(_WHIRL_HOST64_TARGET64) || (defined(_HOST32) && defined(_TARGET64))
02685
02686 if (cmd_line_flags.s_default64) {
02687 CHARACTER_DEFAULT_TYPE = double_linear_type[Fortran_Character];
02688 COMPLEX_DEFAULT_TYPE = double_linear_type[Fortran_Complex];
02689 LOGICAL_DEFAULT_TYPE = double_linear_type[Fortran_Logical];
02690 REAL_DEFAULT_TYPE = double_linear_type[Fortran_Real];
02691
02692 # ifdef KEY
02693 type_init_tbl[DOUBLE_PRECISION_TYPE_IDX].fld.linear_type =
02694 init_default_linear_type[Fortran_Double];
02695 # else
02696 type_init_tbl[DOUBLE_PRECISION_TYPE_IDX].fld.linear_type =
02697 double_linear_type[Fortran_Double];
02698 # endif
02699
02700 type_init_tbl[DOUBLE_COMPLEX_TYPE_IDX].fld.linear_type =
02701 double_linear_type[Fortran_Double_Complex];
02702 }
02703 else if (cmd_line_flags.s_float64) {
02704 CHARACTER_DEFAULT_TYPE = init_default_linear_type[Fortran_Character];
02705 LOGICAL_DEFAULT_TYPE = init_default_linear_type[Fortran_Logical];
02706 REAL_DEFAULT_TYPE = double_linear_type[Fortran_Real];
02707 COMPLEX_DEFAULT_TYPE = double_linear_type[Fortran_Complex];
02708
02709 type_init_tbl[DOUBLE_PRECISION_TYPE_IDX].fld.linear_type =
02710 double_linear_type[Fortran_Double];
02711
02712 type_init_tbl[DOUBLE_COMPLEX_TYPE_IDX].fld.linear_type =
02713 double_linear_type[Fortran_Double_Complex];
02714 }
02715
02716 # endif
02717
02718 if (!on_off_flags.enable_double_precision) {
02719 type_init_tbl[DOUBLE_PRECISION_TYPE_IDX].fld.linear_type = dp_linear_type;
02720
02721 type_init_tbl[DOUBLE_COMPLEX_TYPE_IDX].fld.linear_type =
02722 COMPLEX_DEFAULT_TYPE;
02723
02724 type_init_tbl[DOUBLE_PRECISION_TYPE_IDX].fld.dp_hit_me = TRUE;
02725 type_init_tbl[DOUBLE_COMPLEX_TYPE_IDX].fld.dp_hit_me = TRUE;
02726 }
02727
02728
02729 # if (defined(_TARGET_OS_IRIX) || defined(_TARGET_OS_LINUX) || defined(_TARGET_OS_DARWIN))
02730
02731 if (cmd_line_flags.s_pointer8) {
02732 storage_bit_size_tbl[CRI_Ptr_8] = 64;
02733 storage_bit_size_tbl[CRI_Ch_Ptr_8] = 128;
02734 storage_bit_size_tbl[CRI_Parcel_Ptr_8] = 64;
02735 }
02736
02737 # endif
02738
02739
02740 TRACE (Func_Exit, "init_type", NULL);
02741
02742 return;
02743
02744 }
02745
02746
02747
02748
02749
02750
02751
02752
02753
02754
02755
02756
02757
02758
02759
02760
02761
02762
02763
02764 static void set_integer_default_type(void)
02765
02766 {
02767 TRACE (Func_Entry, "set_integer_default_type", NULL);
02768
02769
02770
02771
02772 if (cmd_line_flags.integer_32) {
02773 INTEGER_DEFAULT_TYPE = Integer_4;
02774 }
02775 else {
02776 # if defined(_TARGET32) || defined(_WHIRL_HOST64_TARGET64) || (defined(_HOST32) && defined(_TARGET64))
02777 INTEGER_DEFAULT_TYPE = Integer_4;
02778 # else
02779 INTEGER_DEFAULT_TYPE = Integer_8;
02780 # endif
02781 }
02782
02783 if (cmd_line_flags.s_integer8) {
02784 INTEGER_DEFAULT_TYPE = Integer_8;
02785 }
02786
02787
02788 # if defined(_ACCEPT_CMD_s_32)
02789 if (cmd_line_flags.s_default32) {
02790 INTEGER_DEFAULT_TYPE = half_linear_type[Fortran_Integer];
02791 }
02792 # endif
02793
02794 # if defined(_TARGET32)
02795 if (cmd_line_flags.s_default64) {
02796 INTEGER_DEFAULT_TYPE = double_linear_type[Fortran_Integer];
02797 }
02798 # endif
02799
02800 TRACE (Func_Exit, "set_integer_default_type", NULL);
02801
02802 return;
02803
02804 }
02805
02806
02807
02808
02809
02810
02811
02812
02813
02814
02815
02816
02817
02818
02819
02820
02821
02822
02823
02824 static void init_const_tbl(void)
02825 {
02826 int idx;
02827
02828
02829 TRACE (Func_Entry, "init_const_tbl", NULL);
02830
02831
02832
02833
02834
02835 for (idx = 0; idx < Num_Linear_Types; idx++) {
02836 cn_root_idx[idx] = 0;
02837 }
02838
02839
02840
02841
02842
02843
02844
02845
02846
02847
02848
02849
02850 idx = C_INT_TO_CN(CG_INTEGER_DEFAULT_TYPE, 0);
02851
02852 # ifdef _DEBUG
02853 if (idx != CN_INTEGER_ZERO_IDX) {
02854 PRINTMSG(1, 626, Internal, 0,
02855 "CN_INTEGER_ZERO_IDX = 1", "init_const_tbl");
02856 }
02857 # endif
02858
02859 idx = C_INT_TO_CN(CG_INTEGER_DEFAULT_TYPE, 1);
02860
02861 # ifdef _DEBUG
02862 if (idx != CN_INTEGER_ONE_IDX) {
02863 PRINTMSG(1, 626, Internal, 0,
02864 "CN_INTEGER_ONE_IDX = 2", "init_const_tbl");
02865 }
02866 # endif
02867
02868 idx = C_INT_TO_CN(CG_INTEGER_DEFAULT_TYPE, 2);
02869
02870 # ifdef _DEBUG
02871 if (idx != CN_INTEGER_TWO_IDX) {
02872 PRINTMSG(1, 626, Internal, 0,
02873 "CN_INTEGER_TWO_IDX = 3", "init_const_tbl");
02874 }
02875 # endif
02876
02877 idx = C_INT_TO_CN(CG_INTEGER_DEFAULT_TYPE, 3);
02878
02879 # ifdef _DEBUG
02880 if (idx != CN_INTEGER_THREE_IDX) {
02881 PRINTMSG(1, 626, Internal, 0,
02882 "CN_INTEGER_THREE_IDX = 4", "init_const_tbl");
02883 }
02884 # endif
02885
02886 idx = C_INT_TO_CN(CG_INTEGER_DEFAULT_TYPE, -1);
02887
02888 # ifdef _DEBUG
02889 if (idx != CN_INTEGER_NEG_ONE_IDX) {
02890 PRINTMSG(1, 626, Internal, 0,
02891 "CN_INTEGER_NEG_ONE_IDX = 5", "init_const_tbl");
02892 }
02893 # endif
02894
02895
02896 idx = C_INT_TO_CN(CG_INTEGER_DEFAULT_TYPE,
02897 storage_bit_size_tbl[CG_INTEGER_DEFAULT_TYPE]);
02898
02899 # ifdef _DEBUG
02900 if (idx != CN_INTEGER_BITS_PER_WORD_IDX) {
02901 PRINTMSG(1, 626, Internal, 0,
02902 "CN_INTEGER_BITS_PER_WORD_IDX = 6", "init_const_tbl");
02903 }
02904 # endif
02905
02906 idx = C_INT_TO_CN(CG_INTEGER_DEFAULT_TYPE, CHAR_BIT);
02907
02908 # ifdef _DEBUG
02909 if (idx != CN_INTEGER_CHAR_BIT_IDX) {
02910 PRINTMSG(1, 626, Internal, 0,
02911 "CN_INTEGER_CHAR_BIT_IDX = 7", "init_const_tbl");
02912 }
02913 # endif
02914
02915
02916
02917
02918 for (idx = 0; idx < 18; ++idx) {
02919 ieee_const_tbl_idx[idx] = NULL_IDX;
02920 }
02921
02922 TRACE (Func_Exit, "init_const_tbl", NULL);
02923
02924 return;
02925
02926 }
02927
02928
02929
02930
02931
02932
02933
02934
02935
02936
02937
02938
02939
02940
02941
02942
02943
02944
02945 void implicit_use_semantics(void)
02946 {
02947 int attr_idx;
02948 int fp_idx;
02949 int list_idx;
02950 int name_idx;
02951 token_type name_token;
02952
02953
02954 TRACE (Func_Entry, "implicit_use_semantics", NULL);
02955
02956 fp_idx = cdir_switches.implicit_use_idx;
02957 cdir_switches.implicit_use_idx = NULL_IDX;
02958
02959 while (fp_idx != NULL_IDX) {
02960 CREATE_ID(TOKEN_ID(name_token),(FP_NAME_PTR(fp_idx)),FP_NAME_LEN(fp_idx));
02961
02962 TOKEN_COLUMN(name_token) = 1;
02963 TOKEN_LEN(name_token) = FP_NAME_LEN(fp_idx);
02964 TOKEN_LINE(name_token) = stmt_start_line;
02965
02966 attr_idx = srch_sym_tbl(TOKEN_STR(name_token),
02967 TOKEN_LEN(name_token),
02968 &name_idx);
02969
02970 if (attr_idx != NULL_IDX) {
02971
02972 if (AT_OBJ_CLASS(attr_idx) == Pgm_Unit &&
02973 ATP_PGM_UNIT(attr_idx) == Module) {
02974
02975
02976
02977
02978 list_idx = SCP_USED_MODULE_LIST(curr_scp_idx);
02979
02980 while (list_idx != NULL_IDX) {
02981
02982 if (AL_ATTR_IDX(list_idx) == attr_idx) {
02983 break;
02984 }
02985 list_idx = AL_NEXT_IDX(list_idx);
02986 }
02987
02988 if (list_idx == NULL_IDX) {
02989
02990
02991
02992
02993
02994
02995
02996
02997 NTR_ATTR_LIST_TBL(list_idx);
02998 AL_ATTR_IDX(list_idx) = attr_idx;
02999 AL_PREV_MODULE_IDX(SCP_USED_MODULE_LIST(curr_scp_idx))= list_idx;
03000 AL_NEXT_IDX(list_idx) = SCP_USED_MODULE_LIST(curr_scp_idx);
03001 SCP_USED_MODULE_LIST(curr_scp_idx) = list_idx;
03002 AT_USE_ASSOCIATED(attr_idx) = TRUE;
03003 AT_MODULE_IDX(attr_idx) = attr_idx;
03004 }
03005 }
03006 else {
03007 PRINTMSG(TOKEN_LINE(name_token), 1496, Error,
03008 TOKEN_COLUMN(name_token),
03009 AT_OBJ_NAME_PTR(attr_idx));
03010 }
03011 }
03012 else {
03013 attr_idx = ntr_sym_tbl(&name_token, name_idx);
03014 AT_OBJ_CLASS(attr_idx) = Pgm_Unit;
03015 ATP_PGM_UNIT(attr_idx) = Module;
03016 ATP_SCP_IDX(attr_idx) = curr_scp_idx;
03017 ATP_IMPLICIT_USE_MODULE(attr_idx) = TRUE;
03018 MAKE_EXTERNAL_NAME(attr_idx,
03019 AT_NAME_IDX(attr_idx),
03020 AT_NAME_LEN(attr_idx));
03021 NTR_ATTR_LIST_TBL(list_idx);
03022 AL_ATTR_IDX(list_idx) = attr_idx;
03023 AL_PREV_MODULE_IDX(SCP_USED_MODULE_LIST(curr_scp_idx)) = list_idx;
03024 AL_NEXT_IDX(list_idx) = SCP_USED_MODULE_LIST(curr_scp_idx);
03025 SCP_USED_MODULE_LIST(curr_scp_idx)= list_idx;
03026 AT_USE_ASSOCIATED(attr_idx) = TRUE;
03027 AT_MODULE_IDX(attr_idx) = attr_idx;
03028 LN_DEF_LOC(name_idx) = TRUE;
03029 }
03030
03031 if (AT_ORIG_NAME_IDX(attr_idx) == NULL_IDX) {
03032 AT_ORIG_NAME_IDX(attr_idx) = AT_NAME_IDX(attr_idx);
03033 AT_ORIG_NAME_LEN(attr_idx) = AT_NAME_LEN(attr_idx);
03034 }
03035
03036 fp_idx = FP_NEXT_FILE_IDX(fp_idx);
03037 }
03038
03039 TRACE (Func_Exit, "implicit_use_semantics", NULL);
03040
03041 return;
03042
03043 }
03044
03045
03046
03047
03048
03049
03050
03051
03052
03053
03054
03055
03056
03057
03058
03059
03060
03061
03062 static void stmt_level_semantics(void)
03063 {
03064 int blk_idx;
03065 int defer_msg;
03066 int save_blk_stk_idx;
03067 boolean stmt_is_directive;
03068
03069
03070 TRACE (Func_Entry, "stmt_level_semantics", NULL);
03071
03072 switch (stmt_type) {
03073 case Directive_Stmt:
03074 case End_Parallel_Stmt:
03075 case End_Do_Parallel_Stmt:
03076 case End_Parallel_Case_Stmt:
03077 case Parallel_Case_Stmt:
03078 case End_Guard_Stmt:
03079 case Open_MP_Section_Stmt:
03080 case Open_MP_End_Parallel_Stmt:
03081 case Open_MP_End_Do_Stmt:
03082 case Open_MP_End_Parallel_Sections_Stmt:
03083 case Open_MP_End_Sections_Stmt:
03084 case Open_MP_End_Section_Stmt:
03085 case Open_MP_End_Single_Stmt:
03086 case Open_MP_End_Parallel_Do_Stmt:
03087 case Open_MP_End_Master_Stmt:
03088 case Open_MP_End_Critical_Stmt:
03089 case Open_MP_End_Ordered_Stmt:
03090 case Open_MP_End_Parallel_Workshare_Stmt:
03091 case Open_MP_End_Workshare_Stmt:
03092 case SGI_Section_Stmt:
03093 case SGI_End_Psection_Stmt:
03094 case SGI_End_Pdo_Stmt:
03095 case SGI_End_Parallel_Stmt:
03096 case SGI_End_Critical_Section_Stmt:
03097 case SGI_End_Single_Process_Stmt:
03098 case SGI_Region_End_Stmt:
03099
03100
03101
03102
03103
03104 if (LA_CH_CLASS == Ch_Class_EOF) {
03105 stmt_is_directive = FALSE;
03106 defer_msg = 1;
03107 }
03108 else {
03109 stmt_is_directive = TRUE;
03110 defer_msg = 0;
03111 }
03112
03113 break;
03114
03115 default:
03116 stmt_is_directive = FALSE;
03117 defer_msg = 0;
03118 break;
03119 }
03120
03121
03122
03123
03124
03125
03126
03127
03128
03129
03130
03131
03132 if (SCP_ATTR_IDX(curr_scp_idx) == glb_tbl_idx[Main_Attr_Idx] &&
03133 !AT_DEFINED(glb_tbl_idx[Main_Attr_Idx]) &&
03134 !AT_DCL_ERR(glb_tbl_idx[Main_Attr_Idx]) &&
03135 (!stmt_is_directive || LA_CH_CLASS == Ch_Class_EOF)) {
03136
03137 if (curr_stmt_category == Init_Stmt_Cat && !stmt_is_directive) {
03138 curr_stmt_category = Use_Stmt_Cat;
03139 }
03140
03141 token = main_token;
03142 TOKEN_LINE(token) = stmt_start_line;
03143 TOKEN_COLUMN(token) = stmt_start_col;
03144 save_blk_stk_idx = blk_stk_idx;
03145 blk_stk_idx = BLK_HEAD_IDX;
03146
03147 start_new_prog_unit(Program, Program_Blk, TRUE, FALSE, &defer_msg);
03148
03149 CURR_BLK_NAME = NULL_IDX;
03150 blk_stk_idx = save_blk_stk_idx;
03151 }
03152
03153
03154
03155
03156
03157
03158
03159 if (cif_need_unit_rec && !stmt_is_directive) {
03160
03161
03162
03163
03164
03165 if (blk_stk_idx == 0) {
03166 cif_pgm_unit_error_recovery = TRUE;
03167 }
03168
03169 if (cif_pgm_unit_error_recovery) {
03170
03171
03172
03173
03174 if (cif_flags == 0) {
03175 cif_pgm_unit_error_recovery = FALSE;
03176 }
03177
03178 blk_stk_idx = 1;
03179 cif_unit_rec();
03180 blk_stk_idx = 0;
03181 }
03182 else {
03183 cif_unit_rec();
03184 }
03185
03186 if (cif_flags != 0) {
03187
03188 if (cif_pgm_unit_error_recovery) {
03189
03190
03191
03192
03193 blk_stk_idx = 1;
03194 cif_begin_scope_rec();
03195 blk_stk_idx = 0;
03196 cif_copy_temp_to_actual_CIF();
03197 cif_pgm_unit_error_recovery = FALSE;
03198 }
03199 else if (BLK_CIF_SCOPE_ID(blk_stk_idx) == 0) {
03200 cif_begin_scope_rec();
03201 }
03202 else if (CURR_BLK == Do_Blk) {
03203
03204
03205
03206 save_blk_stk_idx = blk_stk_idx;
03207 --blk_stk_idx;
03208 cif_begin_scope_rec();
03209 blk_stk_idx = save_blk_stk_idx;
03210 }
03211 }
03212 }
03213
03214
03215
03216
03217
03218
03219 if (stmt_label_idx != NULL_IDX) {
03220
03221 switch(stmt_type) {
03222 case Allocate_Stmt:
03223 case Arith_If_Stmt:
03224 case Assign_Stmt:
03225 case Assignment_Stmt:
03226 case Backspace_Stmt:
03227 case Buffer_Stmt:
03228 case Call_Stmt:
03229 case Case_Stmt:
03230 case Close_Stmt:
03231 case Continue_Stmt:
03232 case Cycle_Stmt:
03233 case Deallocate_Stmt:
03234 case Decode_Stmt:
03235 case Do_Iterative_Stmt:
03236 case Do_While_Stmt:
03237 case Do_Infinite_Stmt:
03238 case Else_Stmt:
03239 case Else_If_Stmt:
03240 case Else_Where_Stmt:
03241 case Encode_Stmt:
03242 case Endfile_Stmt:
03243 case Entry_Stmt:
03244 case Exit_Stmt:
03245 case Forall_Cstrct_Stmt:
03246 case Forall_Stmt:
03247 case Goto_Stmt:
03248 case If_Cstrct_Stmt:
03249 case If_Stmt:
03250 case Inquire_Stmt:
03251 case Nullify_Stmt:
03252 case Open_Stmt:
03253 case Outmoded_If_Stmt:
03254 case Pause_Stmt:
03255 case Print_Stmt:
03256 case Read_Stmt:
03257 case Return_Stmt:
03258 case Rewind_Stmt:
03259 case Select_Stmt:
03260 case Stop_Stmt:
03261 case Then_Stmt:
03262 case Where_Cstrct_Stmt:
03263 case Where_Stmt:
03264 case Write_Stmt:
03265
03266 #ifdef KEY
03267
03268
03269
03270
03271
03272
03273 if (Lbl_Format == ATL_CLASS(stmt_label_idx)) {
03274 break;
03275 }
03276 #endif
03277 ATL_EXECUTABLE(stmt_label_idx) = TRUE;
03278 ATL_CLASS(stmt_label_idx) = Lbl_User;
03279 ATL_DEBUG_CLASS(stmt_label_idx) = Ldbg_User_Lbl;
03280
03281
03282
03283
03284 blk_idx = blk_stk_idx;
03285
03286 while (blk_idx > 0) {
03287
03288 if (BLK_IS_PARALLEL_REGION(blk_idx)) {
03289 ATL_CMIC_BLK_STMT_IDX(stmt_label_idx) =
03290 BLK_FIRST_SH_IDX(blk_idx);
03291 break;
03292 }
03293 blk_idx--;
03294 }
03295
03296
03297
03298
03299
03300
03301
03302
03303
03304
03305
03306
03307
03308
03309
03310
03311 switch (stmt_type) {
03312 case If_Cstrct_Stmt:
03313
03314 if (!AT_DCL_ERR(stmt_label_idx) ) {
03315 blk_idx = blk_stk_idx - 2;
03316
03317 while (BLK_IS_PARALLEL_REGION(blk_idx) ||
03318 BLK_TYPE(blk_idx) == Do_Parallel_Blk ||
03319 BLK_TYPE(blk_idx) == Wait_Blk ||
03320 BLK_TYPE(blk_idx) == SGI_Region_Blk) {
03321 blk_idx--;
03322 }
03323
03324 if (BLK_TYPE(blk_idx) > Interface_Body_Blk) {
03325 ATL_BLK_STMT_IDX(stmt_label_idx) =
03326 BLK_FIRST_SH_IDX(blk_idx);
03327 }
03328 }
03329 break;
03330
03331 case Do_Iterative_Stmt:
03332 case Do_While_Stmt:
03333 case Do_Infinite_Stmt:
03334 case Select_Stmt:
03335 case Where_Cstrct_Stmt:
03336 case Forall_Cstrct_Stmt:
03337 blk_idx = blk_stk_idx - 1;
03338
03339 while (BLK_IS_PARALLEL_REGION(blk_idx) ||
03340 BLK_TYPE(blk_idx) == Do_Parallel_Blk ||
03341 BLK_TYPE(blk_idx) == Wait_Blk ||
03342 BLK_TYPE(blk_idx) == SGI_Region_Blk) {
03343 blk_idx--;
03344 }
03345
03346 if (BLK_TYPE(blk_idx) > Interface_Body_Blk) {
03347 ATL_BLK_STMT_IDX(stmt_label_idx)=BLK_FIRST_SH_IDX(blk_idx);
03348 }
03349 break;
03350
03351 default:
03352 blk_idx = blk_stk_idx;
03353
03354 while (BLK_IS_PARALLEL_REGION(blk_idx) ||
03355 BLK_TYPE(blk_idx) == Do_Parallel_Blk ||
03356 BLK_TYPE(blk_idx) == Wait_Blk ||
03357 BLK_TYPE(blk_idx) == SGI_Region_Blk) {
03358 blk_idx--;
03359 }
03360
03361 if (BLK_TYPE(blk_idx) > Interface_Body_Blk) {
03362 ATL_BLK_STMT_IDX(stmt_label_idx)=BLK_FIRST_SH_IDX(blk_idx);
03363 }
03364 break;
03365
03366 }
03367
03368 end_labeled_do();
03369 break;
03370
03371 case Elemental_Stmt:
03372 case Function_Stmt:
03373 case Pure_Stmt:
03374 case Recursive_Stmt:
03375 case Subroutine_Stmt:
03376 gen_attr_and_IR_for_lbl(FALSE);
03377 break;
03378
03379 case Null_Stmt:
03380 case Allocatable_Stmt:
03381 case Automatic_Stmt:
03382 #ifdef KEY
03383 case Bind_Stmt:
03384 #endif
03385 case Common_Stmt:
03386 case Contains_Stmt:
03387 case Cpnt_Decl_Stmt:
03388 case Data_Stmt:
03389 case Derived_Type_Stmt:
03390 case Dimension_Stmt:
03391 case Directive_Stmt:
03392 case Equivalence_Stmt:
03393 case External_Stmt:
03394 case Format_Stmt:
03395 case Implicit_Stmt:
03396 case Implicit_None_Stmt:
03397 #ifdef KEY
03398 case Import_Stmt:
03399 #endif
03400 #ifdef KEY
03401 case Enum_Stmt:
03402 case Enumerator_Stmt:
03403 #endif
03404 case Intent_Stmt:
03405 case Interface_Stmt:
03406 case Intrinsic_Stmt:
03407 case Module_Proc_Stmt:
03408 case Namelist_Stmt:
03409 case Optional_Stmt:
03410 case Parameter_Stmt:
03411 case Pointer_Stmt:
03412 case Private_Stmt:
03413 case Public_Stmt:
03414 case Save_Stmt:
03415 case Sequence_Stmt:
03416 case Stmt_Func_Stmt:
03417 case Target_Stmt:
03418 case Task_Common_Stmt:
03419 case Type_Decl_Stmt:
03420 case Use_Stmt:
03421 case Volatile_Stmt:
03422 #ifdef KEY
03423 case Value_Stmt:
03424 #endif
03425
03426
03427
03428
03429
03430 if (stmt_type != Data_Stmt) {
03431 SH_P2_SKIP_ME(curr_stmt_sh_idx) = TRUE;
03432 }
03433
03434
03435
03436
03437
03438
03439
03440
03441
03442 if (CURR_BLK == Derived_Type_Blk) {
03443 check_for_dup_derived_type_lbl();
03444 }
03445 else if (stmt_type == Type_Decl_Stmt) {
03446 gen_attr_and_IR_for_lbl(FALSE);
03447 }
03448
03449
03450
03451
03452 end_labeled_do();
03453 break;
03454
03455 case Blockdata_Stmt:
03456 case Module_Stmt:
03457 case Program_Stmt:
03458 case End_Blockdata_Stmt:
03459 case End_Do_Stmt:
03460 case End_Function_Stmt:
03461 case End_If_Stmt:
03462 case End_Interface_Stmt:
03463 #ifdef KEY
03464 case End_Enum_Stmt:
03465 #endif
03466 case End_Module_Stmt:
03467 case End_Program_Stmt:
03468 case End_Select_Stmt:
03469 case End_Stmt:
03470 case End_Subroutine_Stmt:
03471 case End_Type_Stmt:
03472 case End_Where_Stmt:
03473 case End_Forall_Stmt:
03474 case Type_Init_Stmt:
03475 case Label_Def:
03476 case Construct_Def:
03477 case Automatic_Base_Calc_Stmt:
03478 case Automatic_Base_Size_Stmt:
03479 case End_Parallel_Stmt:
03480 case End_Do_Parallel_Stmt:
03481 case End_Parallel_Case_Stmt:
03482 case Parallel_Case_Stmt:
03483 case End_Guard_Stmt:
03484 case Statement_Num_Stmt:
03485 case SGI_Section_Stmt:
03486 case SGI_End_Psection_Stmt:
03487 case SGI_End_Pdo_Stmt:
03488 case SGI_End_Parallel_Stmt:
03489 case SGI_End_Critical_Section_Stmt:
03490 case SGI_End_Single_Process_Stmt:
03491 case SGI_Region_End_Stmt:
03492 case Open_MP_Section_Stmt:
03493 case Open_MP_End_Parallel_Stmt:
03494 case Open_MP_End_Do_Stmt:
03495 case Open_MP_End_Parallel_Sections_Stmt:
03496 case Open_MP_End_Sections_Stmt:
03497 case Open_MP_End_Section_Stmt:
03498 case Open_MP_End_Single_Stmt:
03499 case Open_MP_End_Parallel_Do_Stmt:
03500 case Open_MP_End_Master_Stmt:
03501 case Open_MP_End_Critical_Stmt:
03502 case Open_MP_End_Ordered_Stmt:
03503 case Open_MP_End_Parallel_Workshare_Stmt:
03504 case Open_MP_End_Workshare_Stmt:
03505
03506
03507
03508
03509 blk_idx = blk_stk_idx + 1;
03510
03511 while (blk_idx > 0) {
03512
03513 if (BLK_IS_PARALLEL_REGION(blk_idx)) {
03514 ATL_CMIC_BLK_STMT_IDX(stmt_label_idx) =
03515 BLK_FIRST_SH_IDX(blk_idx);
03516 break;
03517 }
03518 blk_idx--;
03519 }
03520
03521
03522
03523
03524
03525
03526
03527
03528
03529 switch (stmt_type) {
03530 case End_Do_Stmt:
03531 ATL_EXECUTABLE(stmt_label_idx) = TRUE;
03532 ATL_CLASS(stmt_label_idx) = Lbl_User;
03533 ATL_DEBUG_CLASS(stmt_label_idx) = Ldbg_User_Lbl;
03534
03535 blk_idx = blk_stk_idx + 1;
03536
03537 while (BLK_IS_PARALLEL_REGION(blk_idx) ||
03538 BLK_TYPE(blk_idx) == Do_Parallel_Blk ||
03539 BLK_TYPE(blk_idx) == Wait_Blk ||
03540 BLK_TYPE(blk_idx) == SGI_Region_Blk) {
03541
03542 blk_idx++;
03543 }
03544
03545 ATL_BLK_STMT_IDX(stmt_label_idx) = BLK_FIRST_SH_IDX(blk_idx);
03546 break;
03547
03548 case End_If_Stmt:
03549 case End_Select_Stmt:
03550 case End_Where_Stmt:
03551 ATL_EXECUTABLE(stmt_label_idx) = TRUE;
03552 ATL_CLASS(stmt_label_idx) = Lbl_User;
03553 ATL_DEBUG_CLASS(stmt_label_idx) = Ldbg_User_Lbl;
03554
03555 blk_idx = blk_stk_idx + 1;
03556
03557 while (BLK_IS_PARALLEL_REGION(blk_idx) ||
03558 BLK_TYPE(blk_idx) == Do_Parallel_Blk ||
03559 BLK_TYPE(blk_idx) == Wait_Blk ||
03560 BLK_TYPE(blk_idx) == SGI_Region_Blk) {
03561
03562 blk_idx++;
03563 }
03564
03565 ATL_BLK_STMT_IDX(stmt_label_idx) = BLK_FIRST_SH_IDX(blk_idx);
03566
03567 end_labeled_do();
03568 break;
03569
03570 case End_Type_Stmt:
03571 SH_P2_SKIP_ME(curr_stmt_sh_idx) = TRUE;
03572 check_for_dup_derived_type_lbl();
03573 break;
03574
03575 #ifdef KEY
03576 case End_Enum_Stmt:
03577 #endif
03578 case End_Interface_Stmt:
03579 SH_P2_SKIP_ME(curr_stmt_sh_idx) = TRUE;
03580 break;
03581
03582 default:
03583 break;
03584 }
03585 break;
03586 }
03587
03588
03589
03590
03591 if (stmt_label_idx != NULL_IDX &&
03592 !AT_DEFINED(stmt_label_idx) &&
03593 ATL_FWD_REF_IDX(stmt_label_idx) != NULL_IDX ) {
03594 resolve_fwd_lbl_refs();
03595 }
03596 }
03597 else {
03598
03599
03600
03601
03602
03603 switch (stmt_type) {
03604 case Allocatable_Stmt:
03605 case Automatic_Stmt:
03606 #ifdef KEY
03607 case Bind_Stmt:
03608 #endif
03609 case Common_Stmt:
03610 case Contains_Stmt:
03611 case Cpnt_Decl_Stmt:
03612 case Derived_Type_Stmt:
03613 case Dimension_Stmt:
03614 case Equivalence_Stmt:
03615 case External_Stmt:
03616 case Format_Stmt:
03617 case Implicit_Stmt:
03618 case Implicit_None_Stmt:
03619 #ifdef KEY
03620 case Import_Stmt:
03621 #endif
03622 #ifdef KEY
03623 case Enum_Stmt:
03624 case Enumerator_Stmt:
03625 #endif
03626 case Intent_Stmt:
03627 case Interface_Stmt:
03628 case Intrinsic_Stmt:
03629 case Module_Proc_Stmt:
03630 case Namelist_Stmt:
03631 case Optional_Stmt:
03632 case Parameter_Stmt:
03633 case Pointer_Stmt:
03634 case Private_Stmt:
03635 case Public_Stmt:
03636 case Save_Stmt:
03637 case Sequence_Stmt:
03638 case Stmt_Func_Stmt:
03639 case Target_Stmt:
03640 case Task_Common_Stmt:
03641 case Type_Decl_Stmt:
03642 case End_Interface_Stmt:
03643 #ifdef KEY
03644 case End_Enum_Stmt:
03645 #endif
03646 case End_Type_Stmt:
03647 case Volatile_Stmt:
03648 #ifdef KEY
03649 case Value_Stmt:
03650 #endif
03651 need_new_sh = FALSE;
03652 break;
03653
03654 default:
03655 break;
03656 }
03657 }
03658
03659 if (stmt_construct_idx != NULL_IDX) {
03660
03661
03662
03663
03664
03665 PRINTMSG(stmt_start_line, 7, Error, stmt_start_col,
03666 stmt_type_str[stmt_type]);
03667 }
03668
03669 TRACE (Func_Exit, "stmt_level_semantics", NULL);
03670
03671 return;
03672
03673 }
03674
03675 # if defined(_EXPRESSION_EVAL)
03676
03677
03678
03679
03680
03681
03682
03683
03684
03685
03686
03687
03688
03689
03690
03691
03692
03693
03694 static void parse_expr_for_evaluator(void)
03695 {
03696 int attr_idx;
03697 int ir_idx;
03698 opnd_type opnd;
03699 int sh_idx;
03700
03701
03702 TRACE (Func_Entry, "parse_expr_for_evaluator", NULL);
03703
03704 stmt_type = Assignment_Stmt;
03705 sh_idx = curr_stmt_sh_idx;
03706 curr_stmt_sh_idx = ntr_sh_tbl();
03707 SH_NEXT_IDX(sh_idx) = curr_stmt_sh_idx;
03708 SH_PREV_IDX(curr_stmt_sh_idx)= sh_idx;
03709
03710 if (parse_expr(&opnd)) {
03711
03712 # if 0
03713
03714
03715 GEN_COMPILER_TMP_ASG(ir_idx,
03716 attr_idx,
03717 TRUE,
03718 OPND_LINE_NUM(opnd),
03719 OPND_COL_NUM(opnd),
03720 INTEGER_DEFAULT_TYPE,
03721 Priv);
03722
03723 SH_IR_IDX(curr_stmt_sh_idx) = ir_idx;
03724 COPY_OPND(IR_OPND_R(ir_idx),opnd);
03725 # endif
03726 stmt_level_semantics();
03727 }
03728 else {
03729 }
03730
03731 NEXT_LA_CH;
03732
03733 TRACE (Func_Exit, "parse_expr_for_evaluator", NULL);
03734
03735 return;
03736
03737 }
03738 # endif