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 const char *source_file = __FILE__;
00046 static char *rcs_id = "$Source: /proj/osprey/CVS/open64/osprey1.0/crayf90/sgi/sgi_cmd_line.cxx,v $ $Revision: 1.1.1.1 $";
00047
00048 #define __STDC_LIMIT_MACROS
00049 #include <stdint.h>
00050
00051 #include "stamp.h"
00052 #include "defs.h"
00053 #include "config.h"
00054 #include "config_debug.h"
00055 #include "file_util.h"
00056 #include "flags.h"
00057 #include "glob.h"
00058 #include "tracing.h"
00059 #include "util.h"
00060 #include "wn.h"
00061
00062 #include "erglob.h"
00063 #include "erlib.h"
00064 #include "tracing.h"
00065 #include "err_host.tab"
00066 #ifdef KEY
00067 # include "path_intrinsic_list.h"
00068 #endif
00069 #ifdef KEY
00070 #include "../../../clibinc/cray/io_byteswap.h"
00071 #endif
00072 #ifdef KEY
00073 #include "decorate_utils.h"
00074 #endif
00075
00076
00077 #include "sgi_cmd_line.h"
00078 #include "cwh_mkdepend.h"
00079
00080
00081 #include "version.h"
00082
00083 #include <cmplrs/make_depend.h>
00084 #include <stdarg.h>
00085 #include <signal.h>
00086
00087 BOOL IO_Comments = TRUE;
00088 BOOL Use_Three_Call= FALSE;
00089
00090 BOOL FE_Full_Split_Set = FALSE;
00091 BOOL FE_Full_Split = FALSE;
00092 BOOL FE_Endloop_Marker = FALSE;
00093
00094 static BOOL Matmul_Inline = FALSE;
00095 static BOOL Mv_Matmul_Inline = FALSE;
00096 static BOOL Matmul_Inline_Set = FALSE;
00097 static BOOL Mv_Matmul_Inline_Set = FALSE;
00098
00099 char *rii_file_name=NULL;
00100 BOOL enable_dsm_recompile = FALSE;
00101 BOOL enable_dsm_processing = FALSE;
00102 static BOOL enable_mp_processing = FALSE;
00103
00104 BOOL Full_arrayexp = TRUE;
00105 BOOL Full_arrayexp_set = FALSE;
00106 mUINT16 FE_align=8;
00107
00108 char *FE_gdar_filename = NULL;
00109 #ifdef KEY
00110 char *F2C_ABI_filename = NULL;
00111 #endif
00112 #ifdef KEY
00113 BOOL option_underscoring = TRUE;
00114 BOOL option_second_underscore = TRUE;
00115 #endif
00116
00117 INT32 global_chunk_pragma_value;
00118 BOOL global_chunk_pragma_set = FALSE;
00119
00120 INT32 global_schedtype_pragma_val;
00121 BOOL global_schedtype_pragma_set = FALSE;
00122
00123 BOOL process_cri_mp_pragmas=FALSE;
00124
00125 #ifdef KEY
00126 BOOL disable_old_mp = TRUE;
00127 #else
00128 BOOL disable_old_mp = FALSE;
00129 #endif
00130 BOOL disable_open_mp = FALSE;
00131
00132 BOOL FE_Call_Never_Return = TRUE;
00133
00134
00135
00136
00137
00138
00139
00140 static MEM_POOL FE_Mempool_s;
00141 MEM_POOL *FE_Mempool=&FE_Mempool_s;
00142
00143 #ifdef KEY
00144 char *preprocessor_output_file;
00145 #endif
00146 #ifdef KEY
00147 int io_byteswap = IO_DEFAULT;
00148 #endif
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158 # define DEF_DEBUG_LEVEL 0
00159 INT8 Debug_Level = DEF_DEBUG_LEVEL;
00160 # define MAX_PROFILE_LEVEL 0
00161 # define DEF_PROFILE_LEVEL 0
00162 INT8 Profile_Level = DEF_PROFILE_LEVEL;
00163 # define MAX_MSG_LEVEL 2
00164 # define DEF_MSG_LEVEL 2
00165
00166
00167
00168 static OPTION_DESC Options_FE[] = {
00169 { OVK_NAME, OV_INTERNAL, FALSE, "cmdline", "cmdline",
00170 0, 0, 0, &FE_command_line, NULL },
00171 { OVK_BOOL, OV_INTERNAL, FALSE, "iocomment", "ioc",
00172 0, 0, 0, &IO_Comments , NULL },
00173 { OVK_BOOL, OV_INTERNAL, FALSE, "three_call", "three_call",
00174 0, 0, 0, &Use_Three_Call, NULL },
00175 { OVK_BOOL, OV_INTERNAL, FALSE, "full_split", "full",
00176 0, 0, 0, &FE_Full_Split, &FE_Full_Split_Set },
00177 { OVK_BOOL, OV_INTERNAL, FALSE, "arrayexp", "arrayexp",
00178 0, 0, 0, &Full_arrayexp, &Full_arrayexp_set },
00179 { OVK_NAME, OV_INTERNAL, FALSE, "gdar", "gdar",
00180 0, 0, 0, &FE_gdar_filename, NULL },
00181 { OVK_BOOL, OV_INTERNAL, FALSE, "endloop_markers", "endloop_marker",
00182 0, 0, 0, &FE_Endloop_Marker, NULL },
00183 { OVK_BOOL, OV_INTERNAL, FALSE, "matmul_inline", "matmul_inline",
00184 0, 0, 0, &Matmul_Inline, &Matmul_Inline_Set },
00185 { OVK_BOOL, OV_INTERNAL, FALSE, "mv_matmul_inline", "mv_matmul_inline",
00186 0, 0, 0, &Mv_Matmul_Inline, &Mv_Matmul_Inline_Set },
00187 { OVK_BOOL, OV_INTERNAL, FALSE, "call_never_return", "call_never_return",
00188 0, 0, 0, &FE_Call_Never_Return, NULL },
00189 { OVK_COUNT }
00190 };
00191
00192 OPTION_GROUP FE_Option_Groups [] = {
00193 { "FE", ':', '=', Options_FE },
00194 { NULL }
00195 };
00196
00197
00198 INT argc_cray;
00199 char **argv_cray;
00200 INT size_cray_argv;
00201 INT num_cray_args;
00202
00203 char **deferred_argv_cray;
00204 INT size_deferred_cray_argv;
00205 INT num_deferred_cray_args;
00206
00207 char **save_argv;
00208 INT save_argc;
00209
00210 static char *object_file_name=NULL;
00211
00212 static WN_PRAGMA_SCHEDTYPE_KIND
00213 identify_schedtype(char *text)
00214 {
00215 if (strncasecmp(text, "simple",6)==0 ||
00216 strncasecmp(text, "static",6)==0) {
00217 return WN_PRAGMA_SCHEDTYPE_SIMPLE;
00218 } else if (strncasecmp(text, "dynamic",7)==0) {
00219 return WN_PRAGMA_SCHEDTYPE_DYNAMIC;
00220 } else if (strncasecmp(text, "interleaved",11)==0) {
00221 return WN_PRAGMA_SCHEDTYPE_INTERLEAVE;
00222 } else if ( strncasecmp(text, "interleave",10)==0) {
00223 return WN_PRAGMA_SCHEDTYPE_INTERLEAVE;
00224 } else if (strncasecmp(text, "runtime",7)==0) {
00225 return WN_PRAGMA_SCHEDTYPE_RUNTIME;
00226 } else if (strncasecmp(text, "gss",3)==0) {
00227 return WN_PRAGMA_SCHEDTYPE_GSS;
00228 } else if (strncasecmp(text, "guided",6)==0) {
00229 return WN_PRAGMA_SCHEDTYPE_GSS;
00230 } else if (strncasecmp(text, "pseudolowered",13)==0) {
00231 return WN_PRAGMA_SCHEDTYPE_PSEUDOLOWERED;
00232 } else {
00233 ErrMsg(EC_Unknown_Mpsched,text);
00234 return WN_PRAGMA_SCHEDTYPE_UNKNOWN;
00235 }
00236 }
00237
00238
00239 void add_cray_args(const char *arg)
00240 {
00241
00242
00243 if (num_cray_args >= size_cray_argv) {
00244
00245 size_cray_argv += 16;
00246 argv_cray = (char **) realloc(argv_cray,size_cray_argv*sizeof(char *));
00247 }
00248
00249 if (arg) {
00250 argv_cray[num_cray_args] = strdup(arg);
00251 } else {
00252 argv_cray[num_cray_args] = NULL;
00253 }
00254 ++num_cray_args;
00255 }
00256
00257 void add_deferred_cray_args(char *arg)
00258 {
00259
00260
00261 if (num_deferred_cray_args >= size_deferred_cray_argv) {
00262
00263 size_deferred_cray_argv += 16;
00264 deferred_argv_cray = (char **) realloc(deferred_argv_cray,
00265 size_deferred_cray_argv*sizeof(char *));
00266 }
00267
00268 if (arg) {
00269 deferred_argv_cray[num_deferred_cray_args] = strdup(arg);
00270 } else {
00271 deferred_argv_cray[num_deferred_cray_args] = NULL;
00272 }
00273 ++num_deferred_cray_args;
00274 }
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296 void
00297 Cray_Woff ( char *list )
00298 {
00299 char *temp = (char *) malloc ( strlen(list)+3 );
00300
00301 strcpy ( temp, "-M" );
00302 strcat ( temp, list );
00303 add_cray_args ( temp );
00304 free ( temp );
00305 }
00306
00307
00308
00309
00310
00311
00312
00313
00314
00315
00316
00317 void Process_Command_Line (INT argc, char ** argv)
00318
00319 {
00320 INT i;
00321 char *cp;
00322 char *temp;
00323 char ch,c;
00324 BOOL pass_option;
00325 #ifdef KEY
00326 BOOL opt_set = FALSE;
00327 #else
00328 BOOL opt_set;
00329 #endif
00330 INT j;
00331 FILE *f;
00332 INT command_line_length;
00333
00334 argc_cray = argc;
00335 num_cray_args = 1;
00336 size_cray_argv = argc + 1;
00337
00338
00339 argv_cray = (char **) malloc(size_cray_argv*sizeof(char *));
00340 argv_cray[0] = argv[0];
00341
00342
00343 num_deferred_cray_args=0;
00344 size_deferred_cray_argv = 1;
00345 deferred_argv_cray = (char **)malloc(size_deferred_cray_argv*sizeof(char *));
00346
00347
00348 for (i=1; i<argc; i++ ) {
00349 if ( argv[i] != NULL && *(argv[i]) == '-' ) {
00350 cp = argv[i]+1;
00351 if (Process_Command_Line_Group(cp, Common_Option_Groups)) {
00352 pass_option = FALSE;
00353 #ifdef KEY
00354 if (LANG_IEEE_Minus_Zero_On) {
00355 add_cray_args("-ez");
00356 }
00357 #else
00358 switch ( *cp++ ) {
00359 case 'L':
00360 if ((strncmp(cp, "ANG:IEEE_minus_zero", 19) == 0) &&
00361 (strncmp(cp, "ANG:IEEE_minus_zero=off", 23) != 0) &&
00362 (strncmp(cp, "ANG:IEEE_minus_zero=OFF", 23) != 0)) {
00363 add_cray_args("-ez");
00364 }
00365 }
00366 #endif
00367 } else if (Process_Command_Line_Group(cp, FE_Option_Groups)) {
00368 pass_option = FALSE;
00369 } else {
00370 pass_option = TRUE;
00371 switch ( *cp++ ) {
00372 case 'a':
00373 if (strcmp(cp,"lign32")==0) {
00374 pass_option = TRUE;
00375 FE_align = 4;
00376 } else if (strcmp(cp,"lign64")==0) {
00377 pass_option = TRUE;
00378 FE_align = 8;
00379 } else if (strcmp(cp,"nsi")==0) {
00380 pass_option = FALSE;
00381 add_cray_args("-en");
00382 } else if (strncmp(cp,"uto_use=",8)==0) {
00383 cp += 8;
00384 temp = (char *) malloc (strlen(cp) + 3);
00385 strcpy(temp,"-A");
00386 strcat(temp,cp);
00387 add_cray_args(temp);
00388 free(temp);
00389 pass_option = FALSE;
00390 }
00391 break;
00392
00393 #ifdef KEY
00394 case 'b':
00395 if (strcmp(cp, "yteswapio")==0) {
00396 io_byteswap = IO_SWAP;
00397 pass_option = FALSE;
00398 }
00399 break;
00400 #endif
00401
00402 case 'c':
00403 if (strcmp(cp,"ol72")==0) {
00404 pass_option = FALSE;
00405 add_cray_args("-N72");
00406 } else if (strcmp(cp,"ol80")==0) {
00407 pass_option = FALSE;
00408 add_cray_args("-N80");
00409 } else if (strcmp(cp,"ol120")==0) {
00410 pass_option = FALSE;
00411 add_cray_args("-N120");
00412 } else if (strcmp(cp,"if")==0) {
00413 pass_option = FALSE;
00414 add_cray_args("-Ca");
00415 } else if (strncmp(cp,"hunk=",5)==0) {
00416 cp += 5;
00417 global_chunk_pragma_set = TRUE;
00418 global_chunk_pragma_value = Get_Numeric_Flag ( &cp, 0, INT32_MAX,0,argv[i] );
00419 pass_option = FALSE;
00420 } else if (strcmp(cp,"ray_mp")==0) {
00421 pass_option = FALSE;
00422 process_cri_mp_pragmas = TRUE;
00423 add_cray_args("-Otask1");
00424 }
00425 #ifdef KEY
00426 else if (strcmp(cp,"onvert")==0) {
00427 pass_option = FALSE;
00428 cp = argv[++i];
00429 if (strcmp(cp, "native")==0) {
00430 io_byteswap = IO_NATIVE;
00431 } else if (strcmp(cp, "big_endian")==0 ||
00432 strcmp(cp, "big-endian")==0) {
00433 io_byteswap = IO_BIG_ENDIAN;
00434 } else if (strcmp(cp, "little_endian")==0 ||
00435 strcmp(cp, "little-endian")==0) {
00436 io_byteswap = IO_LITTLE_ENDIAN;
00437 } else {
00438
00439
00440
00441
00442
00443 cp = argv[--i] + 1;
00444 pass_option = TRUE;
00445 }
00446 }
00447 #endif
00448 break;
00449
00450 case 'd':
00451 if (strcmp(cp,"16")==0) {
00452 pass_option = FALSE;
00453 add_cray_args("-sdoubleprecision16");
00454 add_cray_args("-sdoublecomplex16");
00455 } else if (strcmp(cp,"8")==0) {
00456 pass_option = FALSE;
00457 } else if (strcmp(cp,"sm")==0) {
00458
00459 enable_dsm_processing = TRUE;
00460 add_cray_args("-udsm");
00461 pass_option = FALSE;
00462 } else if (strcmp(cp,"sm_recompile")==0) {
00463
00464 enable_dsm_recompile = TRUE;
00465 pass_option = FALSE;
00466 } else if (strcmp(cp,"efault64")==0) {
00467 pass_option = FALSE;
00468 add_cray_args("-ucray_compatible");
00469 } else if (strcmp(cp,"isable_old_mp")==0) {
00470 pass_option = FALSE;
00471 disable_old_mp = TRUE;
00472 } else if (strcmp(cp,"isable_open_mp")==0) {
00473 pass_option = FALSE;
00474 disable_open_mp = TRUE;
00475 }
00476 else if (strcmp(cp,"_lines")==0) {
00477 pass_option = FALSE;
00478 add_cray_args("-ed");
00479 }
00480 break;
00481
00482 case 'e':
00483 if (strcmp(cp,"xtend_source")==0) {
00484 pass_option = FALSE;
00485 add_cray_args("-N132");
00486 }
00487 break;
00488
00489 case 'E':
00490 pass_option = FALSE;
00491 add_cray_args("-eZ");
00492 break;
00493
00494 case 'f':
00495 if ( strcmp(cp,"ullwarn") == 0 ) {
00496
00497 Min_Error_Severity = ES_ADVISORY;
00498 add_cray_args("-m2");
00499 pass_option = FALSE;
00500 } else if ( strcmp(cp,"tpp") == 0 ) {
00501 pass_option = FALSE;
00502 add_cray_args("-eT");
00503 } else if ( strcmp(cp,"no-second-underscore") == 0 ) {
00504 add_cray_args("-dN");
00505 pass_option = FALSE;
00506 #ifdef KEY
00507 option_second_underscore = FALSE;
00508 #endif
00509 } else if ( strcmp(cp,"second-underscore") == 0 ) {
00510 add_cray_args("-eN");
00511 pass_option = FALSE;
00512 } else if ( strcmp(cp,"no-underscoring") == 0 ) {
00513 add_cray_args("-dO");
00514 pass_option = FALSE;
00515 #ifdef KEY
00516 option_underscoring = FALSE;
00517 #endif
00518 } else if ( strcmp(cp,"underscoring") == 0 ) {
00519 add_cray_args("-eO");
00520 pass_option = FALSE;
00521 #ifdef KEY
00522 } else if ( strcmp(cp,"f2c-abi") == 0 ) {
00523 F2C_ABI_filename = strdup ( argv[i+1] );
00524 i++;
00525 pass_option = FALSE;
00526 #endif
00527 #ifdef KEY
00528 } else if ( strcmp(cp,"decorate") == 0 ) {
00529 parse_decorate_script(argv[i+1]);
00530 i++;
00531 pass_option = FALSE;
00532 #endif
00533 } else {
00534 c = *cp++;
00535 if ( (ch=*cp++) != ',' && ch != ':' ) {
00536 if ( c == 0 ) c = '?';
00537 pass_option = TRUE;
00538 break;
00539 }
00540
00541 pass_option = FALSE;
00542 switch ( c ) {
00543
00544 case 'b':
00545 Lib_File_Name = strdup(cp);
00546 break;
00547
00548 case 'B':
00549 Irb_File_Name = strdup(cp);
00550 break;
00551
00552 case 'C':
00553 temp = (char *) malloc (strlen(cp) + 4);
00554 strcpy(temp,"-CZ");
00555 strcat(temp,cp);
00556 add_cray_args(temp);
00557 free(temp);
00558 pass_option = FALSE;
00559 break;
00560
00561 case 'D':
00562 #ifdef KEY // Bug 933.
00563
00564 {
00565 char *p, *t;
00566 temp = (char *) malloc (strlen(cp) * 2 + 8);
00567 strcpy(temp,"-ufile=");
00568 t = temp + 7;
00569
00570 for (p = cp; *p; p++) {
00571 if (*p == ' ' || *p == '\\')
00572 *t++ = '\\';
00573 *t++ = *p;
00574 }
00575 *t = '\0';
00576 }
00577 #else
00578 temp = (char *) malloc (strlen(cp) + 8);
00579 strcpy(temp,"-ufile=");
00580 strcat(temp,cp);
00581 #endif
00582 add_cray_args(temp);
00583 free(temp);
00584 pass_option = FALSE;
00585 break;
00586
00587 case 'S':
00588 Orig_Src_File_Name = strdup(cp);
00589 break;
00590
00591 case 'e':
00592 Err_File_Name = strdup(cp);
00593 break;
00594
00595 case 'I':
00596 break;
00597
00598 case 'l':
00599 Lst_File_Name = strdup(cp);
00600 break;
00601
00602 case 'o':
00603 object_file_name = strdup(cp);
00604 break;
00605
00606 case 't':
00607 Tracing_Enabled = TRUE;
00608 Trc_File_Name = strdup(cp);
00609 break;
00610
00611 default:
00612 pass_option = TRUE;
00613 }
00614 }
00615 break;
00616
00617 case 'g':
00618 Debug_Level = Get_Numeric_Flag
00619 ( &cp, 0, MAX_DEBUG_LEVEL,
00620 2, argv[i] );
00621 if (!opt_set)
00622 Opt_Level = 0;
00623 pass_option = FALSE;
00624 add_cray_args("-Gd");
00625 break;
00626
00627 case 'G':
00628 Max_Sdata_Elt_Size = Get_Numeric_Flag
00629 ( &cp, 0, MAX_SDATA_ELT_SIZE,
00630 DEF_SDATA_ELT_SIZE, argv[i] );
00631 pass_option = FALSE;
00632 break;
00633
00634 case 'i':
00635 if (strcmp(cp, "eee_minus_zero") == 0) {
00636 add_cray_args("-ez");
00637 pass_option = FALSE;
00638 }
00639 else if ( strncmp(cp, "nclude=", 7) == 0) {
00640
00641 cp += 7;
00642 temp = (char *) malloc (strlen(cp) + 3);
00643 strcpy(temp+2,cp);
00644 temp[0] = '-'; temp[1] = 'I';
00645 add_cray_args(temp);
00646
00647 temp[1] = 'p';
00648 add_cray_args(temp);
00649 free(temp);
00650 pass_option = FALSE;
00651 } else if (strcmp(cp,"4") == 0) {
00652 pass_option = FALSE;
00653 } else if (strcmp(cp,"8") == 0) {
00654 add_cray_args("-sinteger8");
00655 add_cray_args("-slogical8");
00656 pass_option = FALSE;
00657 }
00658 #ifdef KEY
00659 # define NTRINSIC "ntrinsic="
00660 # define NTRINSIC_LEN ((sizeof NTRINSIC) - 1)
00661 else if (0 == strncmp(cp, NTRINSIC, NTRINSIC_LEN)) {
00662 path_intrinsic_list.add(cp + NTRINSIC_LEN, 1);
00663 pass_option = FALSE;
00664 }
00665 #endif
00666
00667 break;
00668
00669 case 'k':
00670 if ( strcmp(cp,"eep") == 0 ) {
00671 add_cray_args("-ek");
00672 pass_option = FALSE;
00673 }
00674
00675 break;
00676
00677 case 'm':
00678 {
00679 if (strcmp(cp,"p") == 0) {
00680 pass_option = FALSE;
00681 enable_mp_processing = TRUE;
00682 } else if (strncmp(cp,"p_chunk=",8) == 0) {
00683 cp += 8;
00684 global_chunk_pragma_set = TRUE;
00685 global_chunk_pragma_value = Get_Numeric_Flag ( &cp, 0, INT32_MAX,0,argv[i] );
00686 pass_option = FALSE;
00687 } else if (strncmp(cp,"p_schedtype=",12) == 0) {
00688 cp += 12;
00689 global_schedtype_pragma_val = identify_schedtype(cp);
00690 if (global_schedtype_pragma_val != WN_PRAGMA_SCHEDTYPE_UNKNOWN) {
00691 global_schedtype_pragma_set = TRUE;
00692 }
00693 pass_option = FALSE;
00694 } else {
00695 int cray_num;
00696 char temp[4];
00697
00698 cray_num = 3;
00699 j = Get_Numeric_Flag ( &cp, 0, MAX_MSG_LEVEL,
00700 MAX_MSG_LEVEL, argv[i] );
00701 switch (j) {
00702 case 0:
00703 Min_Error_Severity = ES_ERROR;
00704 cray_num=4;
00705 break;
00706 case 1:
00707 Min_Error_Severity = ES_WARNING;
00708 cray_num = 3;
00709 break;
00710 case 2:
00711 cray_num=0;
00712 Min_Error_Severity = ES_ADVISORY;
00713 break;
00714 }
00715 sprintf(temp,"-m%1d",cray_num);
00716 add_cray_args(temp);
00717 pass_option = FALSE;
00718 }
00719 }
00720 break;
00721 case 'M':
00722 if (strcmp(cp, "Dtarget") == 0) {
00723 mdtarget_file = strdup(argv[i+1]);
00724 ++i;
00725 pass_option = FALSE;
00726 } else if (strcmp(cp, "Dupdate") == 0) {
00727 mdupdate_file = strdup(argv[i+1]);
00728 ++i;
00729 pass_option = FALSE;
00730 }
00731 break;
00732
00733 case 'n':
00734 if ( strcmp(cp, "owarn") == 0) {
00735
00736
00737 Min_Error_Severity = ES_ERROR;
00738 add_cray_args("-m4");
00739 pass_option = FALSE;
00740 } else if (strcmp(cp,"oextend_source")==0) {
00741 add_cray_args("-N72");
00742 pass_option = FALSE;
00743 } else if (strcmp(cp,"ocpp")==0) {
00744 add_cray_args("-dT");
00745 pass_option = FALSE;
00746 } else if (strcmp(cp,"og77mangle")==0) {
00747 add_cray_args("-dN");
00748 pass_option = FALSE;
00749 }
00750 #ifdef KEY
00751 # define OINTRINSIC "o-intrinsic="
00752 # define OINTRINSIC_LEN ((sizeof OINTRINSIC) - 1)
00753 else if (0 == strncmp(cp, OINTRINSIC, OINTRINSIC_LEN)) {
00754 path_intrinsic_list.add(cp + OINTRINSIC_LEN, 0);
00755 pass_option = FALSE;
00756 }
00757 #endif
00758 break;
00759
00760 #ifdef KEY
00761 case 'o':
00762
00763
00764
00765 if ((i + 1) < argc) {
00766 preprocessor_output_file = strdup(argv[++i]);
00767 }
00768 pass_option = FALSE;
00769 break;
00770 #endif
00771
00772 case 'O':
00773 Opt_Level = Get_Numeric_Flag
00774 ( &cp, 0, MAX_OPT_LEVEL, DEF_O_LEVEL, argv[i] );
00775 opt_set = TRUE;
00776 pass_option = FALSE;
00777 break;
00778
00779 case 'p':
00780 if (strcmp(cp,"ad_char_literals")==0) {
00781 pass_option = FALSE;
00782 add_cray_args("-ec");
00783 }
00784 break;
00785
00786 case 'P':
00787 pass_option = FALSE;
00788 add_cray_args("-dk");
00789 break;
00790
00791 case 'r':
00792 if (strcmp(cp,"4") == 0) {
00793 pass_option = FALSE;
00794 } else if (strcmp(cp,"8") == 0) {
00795 add_cray_args("-sreal8");
00796 add_cray_args("-scomplex8");
00797 pass_option = FALSE;
00798 } else if (strncmp(cp,"ii",2) == 0)
00799 {
00800
00801 cp += 2;
00802 rii_file_name = strdup(cp);
00803 pass_option = FALSE;
00804 }
00805 break;
00806
00807 case 's':
00808 if ( strcmp(cp,"how") == 0) {
00809
00810 Show_Progress = TRUE;
00811 pass_option = FALSE;
00812 } else if ( strcmp(cp,"tatic_threadprivate") == 0) {
00813
00814 add_cray_args("-astatic_threadprivate");
00815 pass_option = FALSE;
00816 } else if ( strcmp(cp,"tatic-data") == 0) {
00817
00818 add_cray_args("-ev");
00819 pass_option = FALSE;
00820 } else if ( strcmp(cp,"tatic") == 0) {
00821
00822 add_cray_args("-ev");
00823 pass_option = FALSE;
00824 }
00825 break;
00826
00827 case 't':
00828
00829
00830
00831
00832
00833 Process_Trace_Option ( cp-2 );
00834 pass_option = FALSE;
00835 break;
00836
00837 case 'u':
00838 if (*cp=='\0') {
00839
00840 add_cray_args("-eI");
00841 pass_option = FALSE;
00842 }
00843 break;
00844
00845 case 'v':
00846 if ( strcmp(cp,"ersion") == 0) {
00847
00848
00849 fprintf(stderr, "mfef90 version %s\n", INCLUDE_STAMP);
00850 fprintf(stderr, "Changeset: %s\n", cset_id);
00851 fprintf(stderr, "Built by: %s@%s in %s\n", build_user, build_host, build_root);
00852 fprintf(stderr, "Built on: %s\n", mfef90_compiler_build_date);
00853 pass_option = FALSE;
00854 }
00855 break;
00856
00857 case 'w':
00858 if (*cp=='\0') {
00859 add_cray_args("-m4");
00860 pass_option = FALSE;
00861 Min_Error_Severity = ES_ERROR;
00862 } else if ( strncmp(cp, "off", 3) == 0) {
00863 Cray_Woff(cp+3);
00864 pass_option = FALSE;
00865 } else if ( *cp=='2') {
00866 Min_Error_Severity = ES_WARNING;
00867 }
00868 else if ( *cp=='3') {
00869 Min_Error_Severity = ES_ERROR;
00870 }
00871 pass_option = FALSE;
00872 break;
00873 }
00874 if (pass_option) {
00875 add_cray_args(argv[i]);
00876 }
00877 }
00878 } else {
00879
00880 add_deferred_cray_args(argv[i]);
00881 }
00882 }
00883
00884 #ifdef KEY
00885
00886
00887 Enable_WN_Simp = TRUE;
00888 #endif
00889
00890
00891 if (FE_align==8) {
00892 add_cray_args("-adalign");
00893 }
00894
00895
00896 if (FE_command_line) {
00897 f = fopen(FE_command_line,"r");
00898 command_line_length = 0;
00899 if (f) {
00900 while ( getc(f) != '\n' ) ++command_line_length;
00901 fseek (f,0,SEEK_SET);
00902 temp = (char *) malloc(command_line_length+2);
00903 fgets(temp,command_line_length+1,f);
00904 temp[command_line_length] = 0;
00905 fclose(f);
00906 add_cray_args("-CY");
00907 add_cray_args(temp);
00908 free(temp);
00909 }
00910 }
00911 }
00912
00913
00914
00915
00916
00917
00918
00919 void sgi_cmd_line (INT *argc, char ***argv)
00920 {
00921 INT i;
00922 INT len;
00923 char msg_num[10];
00924 char *chp;
00925 option_list *opt_list;
00926
00927
00928
00929
00930 save_argv = (char **) malloc((*argc) * sizeof(char *));
00931 save_argc = *argc;
00932
00933 for(i=0; i < *argc; i++) {
00934 len = strlen((*argv)[i]);
00935 save_argv[i] = (char *) malloc((len + 1)*sizeof(char));
00936 strcpy(save_argv[i], (*argv)[i]);
00937 }
00938
00939 Set_Error_Tables (Phases, host_errlist);
00940 Init_Error_Handler ( 100 );
00941 Set_Error_Line ( ERROR_LINE_UNKNOWN );
00942 Set_Error_File ( NULL );
00943 Set_Error_Phase ( "Front End Parse/Semantic");
00944 Handle_Signals();
00945
00946
00947 Language = LANG_F90;
00948 Preconfigure ();
00949
00950
00951 Process_Command_Line ( *argc, *argv);
00952
00953 MEM_Initialize() ;
00954 MEM_POOL_Initialize(FE_Mempool,"FE_Mempool",TRUE);
00955 MEM_POOL_Push(FE_Mempool);
00956
00957 Configure ();
00958 Configure_Source (NULL);
00959
00960 IPA_Configure_Target ();
00961
00962
00963 if (mdtarget_file == NULL ) mdtarget_file = object_file_name;
00964
00965
00966 if (Pointer_Size == 8) {
00967 add_cray_args("-spointer8");
00968 }
00969
00970 if (FTN_Short_Circuit_On) {
00971 add_cray_args("-Oshortcircuit0");
00972 } else {
00973 add_cray_args("-Oshortcircuit1");
00974 }
00975
00976
00977 if (!Mv_Matmul_Inline_Set) {
00978 Mv_Matmul_Inline = (Opt_Level >= 3);
00979 }
00980 if (!Matmul_Inline_Set) {
00981 Matmul_Inline = (Opt_Level >= 3);
00982 }
00983 if (Matmul_Inline) {
00984 add_cray_args("-Omatmul_inline");
00985 }
00986 if (Mv_Matmul_Inline) {
00987 add_cray_args("-Omv_matmul_inline");
00988 }
00989
00990
00991
00992 if (DEBUG_Subscript_Check) {
00993 add_cray_args("-Rb");
00994 }
00995
00996 if (DEBUG_Fullwarn) {
00997 add_cray_args("-m2");
00998 }
00999
01000
01001
01002 if (Current_DEBUG->error_set) {
01003 opt_list = Current_DEBUG->error;
01004
01005 while (opt_list != NULL) {
01006 chp = strtok(opt_list->val, ",");
01007
01008 while(chp != NULL) {
01009 add_cray_args("-M");
01010 msg_num[0] = 'E';
01011 strcpy(&msg_num[1], chp);
01012 add_cray_args(msg_num);
01013 chp = strtok(NULL, ",");
01014 }
01015 opt_list = opt_list->next;
01016 }
01017 }
01018
01019 if (Current_DEBUG->warning_set) {
01020 opt_list = Current_DEBUG->warning;
01021
01022 while (opt_list != NULL) {
01023 chp = strtok(opt_list->val, ",");
01024
01025 while(chp != NULL) {
01026 add_cray_args("-M");
01027 msg_num[0] = 'W';
01028 strcpy(&msg_num[1], chp);
01029 add_cray_args(msg_num);
01030 chp = strtok(NULL, ",");
01031 }
01032 opt_list = opt_list->next;
01033 }
01034 }
01035
01036 if (enable_mp_processing) {
01037
01038 if (! disable_old_mp) {
01039 add_cray_args("-ump");
01040 }
01041
01042 if (! disable_open_mp) {
01043 add_cray_args("-uopen_mp");
01044 }
01045 }
01046
01047
01048 for (i = 0 ; i < num_deferred_cray_args; i++) {
01049 add_cray_args(deferred_argv_cray[i]);
01050 }
01051
01052 add_cray_args(NULL);
01053 --num_cray_args;
01054
01055
01056 free(deferred_argv_cray);
01057
01058 argc_cray = num_cray_args;
01059 *argc = argc_cray;
01060 *argv = argv_cray;
01061
01062 if (Get_Trace(TP_IRB, 1) != 0) {
01063 fprintf(TFile,"Cray command line arguments:\n");
01064 for (i = 0; i < argc_cray; i++) {
01065 fprintf(TFile,"Arg %d: |%s|\n",i,argv_cray[i]);
01066 }
01067 fprintf(TFile,"\n");
01068 }
01069 return;
01070 }
01071