00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067 #ifdef USE_PCH
00068 #include "common_com_pch.h"
00069 #endif
00070 #pragma hdrstop
00071 #include <stdio.h>
00072 #include <string.h>
00073 #include <sys/types.h>
00074 #ifndef __MINGW32__
00075 #include <sys/mman.h>
00076 #endif
00077 #include <sys/stat.h>
00078 #include <fcntl.h>
00079 #include <stdarg.h>
00080 #include <ctype.h>
00081 #include <unistd.h>
00082 #include <cmplrs/rcodes.h>
00083
00084 #ifndef USE_STANDARD_TYPES
00085 #define USE_STANDARD_TYPES // to allow wn_tree_op.h to include ... vector.h
00086
00087 #endif
00088
00089 #include "wn_tree_util.h"
00090 #include "defs.h"
00091 #include "errors.h"
00092 #include "srcpos.h"
00093 #include "opcode.h"
00094 #include "stab.h"
00095 #include "const.h"
00096 #include "targ_const.h"
00097 extern char * Targ_Print (const char *fmt, TCON c );
00098 #include "targ_sim.h"
00099 #include "strtab.h"
00100 #include "irbdata.h"
00101 #include "wn.h"
00102 #include "wn_simp.h"
00103 #include "dwarf_DST.h"
00104 #include "dwarf_DST_mem.h"
00105 #include "ir_reader.h"
00106 #include "tracing.h"
00107
00108 #ifdef BACK_END
00109 #include "opt_alias_mgr.h"
00110 #endif
00111
00112 #include "wio.h"
00113 #include "wintrinsic.h"
00114 #include "wn_pragmas.h"
00115 #include "wutil.h"
00116 #if defined(TARG_NVISA)
00117 #include "intrn_info.h"
00118 #endif
00119 #ifdef BACK_END
00120 #include "intrn_info.h"
00121 #include "region_util.h"
00122 #include "dvector.h"
00123 #endif
00124
00125
00126
00127 enum OPR_EXTENDED {
00128 OPR_END_BLOCK = OPERATOR_LAST+1,
00129 OPR_BODY = OPERATOR_LAST+2,
00130 OPR_NOOP = OPERATOR_LAST+3,
00131 OPR_THEN = OPERATOR_LAST+4,
00132 OPR_ELSE = OPERATOR_LAST+5,
00133 OPR_END_IF = OPERATOR_LAST+6,
00134 OPR_INIT = OPERATOR_LAST+7,
00135 OPR_COMP = OPERATOR_LAST+8,
00136 OPR_INCR = OPERATOR_LAST+9,
00137 OPR_END_COMPGOTO = OPERATOR_LAST+10,
00138 OPR_END_XGOTO = OPERATOR_LAST+11,
00139 OPR_LOC = OPERATOR_LAST+12,
00140 OPR_END_LINFO = OPERATOR_LAST+13,
00141 OPR_END_SWITCH = OPERATOR_LAST+14,
00142 };
00143
00144 enum OPC_EXTENDED {
00145 OPC_END_BLOCK = OPCODE_LAST+1,
00146 OPC_BODY = OPCODE_LAST+2,
00147 OPC_NOOP = OPCODE_LAST+3,
00148 OPC_THEN = OPCODE_LAST+4,
00149 OPC_ELSE = OPCODE_LAST+5,
00150 OPC_END_IF = OPCODE_LAST+6,
00151 OPC_INIT = OPCODE_LAST+7,
00152 OPC_COMP = OPCODE_LAST+8,
00153 OPC_INCR = OPCODE_LAST+9,
00154 OPC_END_COMPGOTO = OPCODE_LAST+10,
00155 OPC_END_XGOTO = OPCODE_LAST+11,
00156 OPC_LOC = OPCODE_LAST+12,
00157 OPC_END_LINFO = OPCODE_LAST+13,
00158 OPC_END_SWITCH = OPCODE_LAST+14,
00159 MAX_OPCODE = OPCODE_LAST+15,
00160 };
00161
00162 typedef struct {
00163 const char *pr_name;
00164 INT n_kids;
00165 INT flags;
00166 } IR_OPCODE_TABLE;
00167
00168
00169 IR_OPCODE_TABLE ir_opcode_table[1];
00170
00171
00172 #define HASH_LEN 2413
00173 #define IR_MAX_ARGS 3
00174
00175 IR_OPCODE_TABLE *opcode_hash[HASH_LEN];
00176
00177 #define LINE_LEN 1024
00178
00179 typedef struct {
00180 OPCODE opcode;
00181 INT _operator;
00182 INT n_kids;
00183 INT flags;
00184 ST *st;
00185 TY_IDX ty;
00186 TY_IDX load_addr_ty;
00187 INT id;
00188 INT num_dim;
00189 INT num_entries;
00190 INT last_label;
00191 WN_OFFSET offset;
00192 INT16 offset1_of_2;
00193 INT16 offset2_of_2;
00194 WN_ESIZE esize;
00195 INT16 cvtl_bits;
00196 INT64 const_val;
00197 INT32 label_number;
00198 UINT32 flags_val;
00199 INT cgoto;
00200 INT intrinsic;
00201 char *intrinsic_name;
00202 char *args[IR_MAX_ARGS+1];
00203 } TOKEN;
00204
00205 static void ir_error(const char *s);
00206 static INT ir_get_expr_list(void);
00207 static WN * ir_get_expr(void);
00208 static WN * ir_get_stmt(void);
00209 static void ir_skip_token(void);
00210 static char *ir_read_line(char *buf, INT size, FILE *ir_file);
00211 static void ir_match_token(OPERATOR opr);
00212 static void ir_expect_token(OPERATOR opc);
00213 static TOKEN *ir_next_token(void);
00214 static void ir_get_token(TOKEN *token);
00215 static BOOL ir_insert_hash(const char *s, IR_OPCODE_TABLE *irt);
00216 static INT ir_lookup(char *s);
00217 static void ir_build_hashtable(void);
00218 static void ir_put_wn(WN * wn, INT indent);
00219 static void ir_put_expr(WN * wn, INT indent);
00220 static void ir_put_marker(const char *str, INT indent);
00221 static void ir_put_stmt(WN * wn, INT indent);
00222 static void WN_TREE_put_stmt(WN *, INT);
00223
00224
00225
00226
00227 static BOOL dump_parent_before_children = FALSE;
00228
00229 #ifdef BACK_END
00230
00231
00232
00233
00234 extern void fdump_dep_tree(FILE *, const WN *, struct ALIAS_MANAGER *);
00235
00236
00237
00238 #if defined(__linux__) || defined(BUILD_OS_DARWIN) || !defined(SHARED_BUILD)
00239 extern void (*CG_Dump_Region_p) (FILE*, WN*);
00240 #define CG_Dump_Region (*CG_Dump_Region_p)
00241 #else
00242 #pragma weak CG_Dump_Region
00243 #endif // __linux__
00244
00245 #endif
00246
00247 BOOL IR_dump_map_info = FALSE;
00248 BOOL IR_dump_region = FALSE;
00249 BOOL IR_DUMPDEP_info = FALSE;
00250 BOOL IR_dump_line_numbers = FALSE;
00251 BOOL IR_dump_wn_addr = FALSE;
00252
00253 WN_MAP IR_alias_map = WN_MAP_UNDEFINED;
00254 const struct ALIAS_MANAGER *IR_alias_mgr = NULL;
00255 WN_MAP IR_freq_map = WN_MAP_UNDEFINED;
00256
00257 #define OPCODE_has_alias_info(opc) (OPCODE_is_load(opc) ||\
00258 OPCODE_is_store(opc) ||\
00259 OPCODE_operator(opc) == OPR_PARM)
00260
00261 #define IR_dump_alias_info(opc) (IR_alias_map != WN_MAP_UNDEFINED && OPCODE_has_alias_info(opc))
00262
00263 typedef struct DUMPDEP
00264 {
00265 WN *node;
00266 INT32 id;
00267 struct DUMPDEP *next;
00268 } DUMPDEP, *DUMPDEPp;
00269
00270 #define DUMPDEP_node(x) (x)->node
00271 #define DUMPDEP_id(x) (x)->id
00272 #define DUMPDEP_next(x) ((x)->next)
00273
00274
00275 DUMPDEPp IR_DUMPDEP_head= NULL;
00276 static INT32 AddToDUMPDEP(WN *node);
00277
00278
00279
00280
00281
00282
00283
00284 static INT32 AddToDUMPDEP(WN *node)
00285 {
00286 static DUMPDEPp last;
00287 static INT32 id= 0;
00288
00289 if (IR_DUMPDEP_head==NULL)
00290 {
00291 id= 1;
00292 last= NULL;
00293 }
00294
00295 {
00296 DUMPDEPp p;
00297
00298 p = TYPE_L_ALLOC(DUMPDEP);
00299
00300 DUMPDEP_node(p)= node;
00301 DUMPDEP_id(p)= id++;
00302 DUMPDEP_next(p)= NULL;
00303
00304 if (last)
00305 {
00306 DUMPDEP_next(last) = p;
00307 last= p;
00308 }
00309 else
00310 {
00311 IR_DUMPDEP_head= p;
00312 last= p;
00313 }
00314 return DUMPDEP_id(p);
00315 }
00316 }
00317
00318
00319
00320
00321
00322
00323
00324
00325 #ifndef MONGOOSE_BE
00326 static FILE *ir_file;
00327 #endif
00328 static FILE *ir_ofile;
00329 static INT ir_line;
00330 #ifdef IR_TOOLS
00331 static char *line;
00332 static char *errmsg;
00333 #endif
00334 static BOOL follow_st;
00335 static USRCPOS last_srcpos;
00336 static BOOL is_initialized = FALSE;
00337 static WN_MAP ir_put_map = WN_MAP_UNDEFINED;
00338
00339 extern void IR_reader_init(void)
00340 {
00341 is_initialized = TRUE;
00342 MEM_POOL_Push(&MEM_local_pool);
00343 #ifdef IR_TOOLS
00344 errmsg = (char *) MEM_POOL_Alloc(&MEM_local_pool, LINE_LEN);
00345 line = (char *) MEM_POOL_Alloc(&MEM_local_pool, LINE_LEN);
00346
00347 #endif
00348 ir_ofile = stdout;
00349 follow_st = TRUE;
00350 USRCPOS_clear(last_srcpos);
00351 }
00352
00353
00354
00355
00356 extern BOOL IR_set_dump_order(BOOL prefix)
00357 {
00358 BOOL old_order;
00359 old_order = dump_parent_before_children;
00360 dump_parent_before_children = prefix;
00361 return (old_order);
00362 }
00363
00364
00365 #ifndef MONGOOSE_BE
00366 extern void IR_reader_finish(void)
00367 {
00368 MEM_POOL_Pop(&MEM_local_pool);
00369 }
00370
00371
00372 extern FILE *IR_open(char *filename)
00373 {
00374 char prefix_check[6];
00375 ir_file = fopen(filename, "r");
00376 ir_line = 0;
00377
00378
00379 (void) fread(prefix_check,6,1,ir_file);
00380 if (strncmp(prefix_check,"PREFIX",6)==0) {
00381 fclose(ir_file);
00382 fprintf(stderr,"File %s is prefix ordered and cannot be read.\n",filename);
00383 } else {
00384
00385 rewind(ir_file);
00386 }
00387 return ir_file;
00388 }
00389
00390 extern void IR_close(void)
00391 {
00392 fclose(ir_file);
00393 }
00394
00395
00396
00397
00398
00399 extern BOOL IR_open_output(char *filename)
00400 {
00401 if (filename == NULL)
00402 ir_ofile = stdout;
00403 else
00404 if ((ir_ofile = fopen(filename, "w+")) == NULL) {
00405 ir_error("cannot open file for write");
00406 return FALSE;
00407 }
00408 return TRUE;
00409 }
00410
00411
00412 extern void IR_close_output(void)
00413 {
00414 if (ir_ofile != NULL && ir_ofile != stdout)
00415 fclose(ir_ofile);
00416 }
00417 #endif
00418
00419
00420
00421
00422
00423
00424
00425
00426 #define ir_chk_kids(m,n) {if (m != n) ir_error("wrong number of kids"); }
00427
00428 static void ir_error(const char *s)
00429 {
00430 fprintf(stderr, "Error parsing ascii IR at line %d: %s.\n", ir_line, s);
00431 exit(RC_INTERNAL_ERROR);
00432 }
00433
00434
00435
00436
00437
00438
00439
00440
00441 typedef struct {
00442 char *filename;
00443 INT incl_index;
00444 FILE *fileptr;
00445 INT max_line_printed;
00446 } file_info;
00447
00448 static file_info *file_table = NULL;
00449 static char **incl_table;
00450 static INT cur_file_index = 0;
00451 static BOOL file_table_generated = FALSE;
00452
00453
00454
00455
00456
00457
00458 static void ir_print_filename(BOOL dump_filenames)
00459 {
00460
00461
00462
00463
00464
00465 INT count;
00466 DST_IDX idx;
00467 DST_FILE_NAME *file;
00468 char *name;
00469 INT file_table_size;
00470 INT new_size;
00471
00472
00473 file_table_size = 0;
00474 file_table = NULL;
00475 count = 1;
00476 for (idx = DST_get_file_names ();
00477 !DST_IS_NULL(idx);
00478 idx = DST_FILE_NAME_next(file))
00479 {
00480 file = DST_FILE_IDX_TO_PTR (idx);
00481 if (DST_IS_NULL(DST_FILE_NAME_name(file))) {
00482 name = "NULLNAME";
00483 }
00484 else {
00485 name = DST_STR_IDX_TO_PTR (DST_FILE_NAME_name(file));
00486 }
00487 if (count >= file_table_size) {
00488 new_size = count + 10;
00489 if (file_table == NULL)
00490 file_table = (file_info *) malloc (new_size * sizeof (file_info));
00491 else
00492 file_table = (file_info *) realloc (file_table,
00493 new_size * sizeof (file_info));
00494 if (file_table == NULL)
00495 fprintf(stderr, "IR_Dwarf_Gen_File_Table: Run out of memory\n");
00496 file_table_size = new_size;
00497 }
00498 file_table[count].filename = name;
00499 file_table[count].incl_index = DST_FILE_NAME_dir(file);
00500 file_table[count].fileptr = NULL;
00501 file_table[count].max_line_printed = 0;
00502 if (dump_filenames)
00503 fprintf (ir_ofile, " LOC 0 0 source files:\t%d\t\"%s/%s\"\n",
00504 count,
00505 incl_table[DST_FILE_NAME_dir(file)],
00506 name);
00507 count++;
00508 }
00509
00510 while (count < file_table_size) {
00511 file_table[count].fileptr = NULL;
00512 count++;
00513 }
00514
00515 }
00516
00517 extern void IR_Dwarf_Gen_File_Table (BOOL dump_filenames)
00518 {
00519
00520
00521
00522
00523
00524
00525
00526
00527
00528 INT count;
00529 DST_IDX idx;
00530 DST_INCLUDE_DIR *incl;
00531 char *name;
00532 INT incl_table_size;
00533 INT new_size;
00534
00535 if (file_table_generated && file_table != NULL) {
00536
00537 for (count = 1; file_table[count].fileptr != NULL; count++) {
00538 fclose (file_table[count].fileptr);
00539 file_table[count].fileptr = NULL;
00540 file_table[count].max_line_printed = 0;
00541 }
00542 cur_file_index = 0;
00543 return;
00544 }
00545
00546 incl_table_size = 0;
00547 incl_table = NULL;
00548 file_table = NULL;
00549 count = 1;
00550 for (idx = DST_get_include_dirs ();
00551 !DST_IS_NULL(idx);
00552 idx = DST_INCLUDE_DIR_next(incl))
00553 {
00554 incl = DST_DIR_IDX_TO_PTR (idx);
00555 name = DST_STR_IDX_TO_PTR (DST_INCLUDE_DIR_path(incl));
00556 if (count >= incl_table_size) {
00557 new_size = count + 10;
00558 if (incl_table == NULL)
00559 incl_table = (char **) malloc (new_size * sizeof (char *));
00560 else
00561 incl_table = (char **) realloc (incl_table, new_size * sizeof (char *));
00562 if (incl_table == NULL)
00563 fprintf(stderr, "IR_Dwarf_Gen_File_Table: Run out of memory\n");
00564 incl_table_size = new_size;
00565 }
00566 incl_table[count] = name;
00567 count++;
00568 }
00569 #if defined(TARG_SL)
00570
00571
00572 if (incl_table == NULL)
00573 incl_table = (char **) malloc ((count + 2) * sizeof (char *));
00574 incl_table[0] = "./";
00575 #endif
00576
00577 ir_print_filename(dump_filenames);
00578
00579 file_table_generated = TRUE;
00580 }
00581
00582
00583 extern void IR_Srcpos_Filename(SRCPOS srcpos,
00584 const char **fname,
00585 const char **dirname)
00586 {
00587
00588
00589
00590
00591
00592
00593
00594 USRCPOS usrcpos;
00595
00596 USRCPOS_srcpos(usrcpos) = srcpos;
00597 if (USRCPOS_filenum(usrcpos) == 0)
00598 {
00599 *fname = NULL;
00600 *dirname = NULL;
00601 }
00602 else
00603 {
00604 file_info *cur_file;
00605
00606 if (!file_table_generated)
00607 IR_Dwarf_Gen_File_Table(FALSE);
00608
00609 cur_file = &file_table[USRCPOS_filenum(usrcpos)];
00610 *fname = cur_file->filename;
00611 *dirname = incl_table[cur_file->incl_index];
00612 }
00613 }
00614
00615
00616
00617
00618
00619
00620
00621 static void
00622 print_source (SRCPOS srcpos)
00623 {
00624 USRCPOS usrcpos;
00625 char srcfile[1024];
00626 char text[1024];
00627 file_info *cur_file;
00628 INT i;
00629 INT newmax;
00630
00631 USRCPOS_srcpos(usrcpos) = srcpos;
00632
00633 if (USRCPOS_filenum(usrcpos) == 0) {
00634
00635 fprintf(ir_ofile, "LOC 0 %d\n", USRCPOS_linenum(usrcpos));
00636 return;
00637 }
00638
00639 cur_file = &file_table[USRCPOS_filenum(usrcpos)];
00640 if (USRCPOS_filenum(usrcpos) != cur_file_index) {
00641 if (cur_file_index != 0) {
00642
00643 file_info *prev_file = &file_table[cur_file_index];
00644 fclose (prev_file->fileptr);
00645 prev_file->fileptr = NULL;
00646 }
00647 cur_file_index = USRCPOS_filenum(usrcpos);
00648 cur_file = &file_table[cur_file_index];
00649
00650 sprintf (srcfile, "%s/%s", incl_table[cur_file->incl_index],
00651 cur_file->filename);
00652 cur_file->fileptr = fopen (srcfile, "r");
00653 if (cur_file->fileptr == NULL) {
00654 cur_file_index = 0;
00655 fprintf (ir_ofile, " LOC %d %d\n", cur_file_index,
00656 USRCPOS_linenum(usrcpos));
00657 return;
00658 }
00659 cur_file->max_line_printed = 0;
00660 newmax = USRCPOS_linenum(usrcpos) - 2;
00661 }
00662 else {
00663 newmax = USRCPOS_linenum(usrcpos) - 5;
00664 }
00665 if (cur_file->max_line_printed < newmax) {
00666 for (i = cur_file->max_line_printed; i < newmax; i++) {
00667 fgets (text, sizeof(text), cur_file->fileptr);
00668 }
00669 cur_file->max_line_printed = newmax;
00670 }
00671 if (cur_file->max_line_printed < USRCPOS_linenum(usrcpos)) {
00672 for (i = cur_file->max_line_printed; i < USRCPOS_linenum(usrcpos); i++) {
00673 if (fgets (text, sizeof(text), cur_file->fileptr) != NULL)
00674 fprintf (ir_ofile, " LOC %d %d %s", cur_file_index, i+1, text);
00675 }
00676 cur_file->max_line_printed = USRCPOS_linenum(usrcpos);
00677 }
00678 else if (cur_file->max_line_printed != USRCPOS_linenum(usrcpos)
00679 && USRCPOS_linenum(usrcpos) != 0)
00680 {
00681
00682
00683
00684
00685 fprintf (ir_ofile, " LOC %d %d\n", cur_file_index,
00686 USRCPOS_linenum(usrcpos));
00687 }
00688 }
00689
00690
00691
00692
00693
00694
00695
00696
00697 #ifdef IR_TOOLS
00698
00699
00700
00701
00702
00703
00704
00705
00706
00707
00708
00709
00710
00711
00712
00713 static BOOL ir_insert_hash(const char *s, IR_OPCODE_TABLE *opcode_entry)
00714 {
00715 const char *p;
00716 UINT sum = 0;
00717 INT i;
00718
00719 for (p = s; *p != '\0'; p++)
00720 sum = (sum+sum+3377)^*p;
00721
00722 sum %= HASH_LEN;
00723 for (i = 0; i < HASH_LEN; i++) {
00724 if (opcode_hash[sum] == NULL) {
00725 opcode_hash[sum] = opcode_entry;
00726 return TRUE;
00727 }
00728 if (strcmp(opcode_hash[sum]->pr_name, s) == 0)
00729 return FALSE;
00730 sum = (sum + 1) % HASH_LEN;
00731 }
00732 return FALSE;
00733 }
00734
00735
00736
00737
00738
00739 static INT ir_lookup(char *s)
00740 {
00741 char *p;
00742 INT sum = 0;
00743 INT i;
00744
00745 for (p = s; *p != '\0'; p++)
00746 sum = (sum+sum+3377)^*p;
00747 sum %= HASH_LEN;
00748 for (i = 0; i < HASH_LEN; i++) {
00749 if (opcode_hash[sum] == NULL)
00750 return -1;
00751 if (strcmp(opcode_hash[sum]->pr_name, s) == 0)
00752 return (opcode_hash[sum] - ir_opcode_table);
00753 sum = (sum + 1) % HASH_LEN;
00754 }
00755 return -1;
00756 }
00757
00758
00759
00760
00761
00762 static void enter_opcode_table(const char *name, OPCODE opc, INT opr)
00763 {
00764 ir_opcode_table[opc].pr_name = name;
00765 if (!ir_insert_hash(ir_opcode_table[opc].pr_name, &ir_opcode_table[opc])) {
00766 sprintf(errmsg, "cannot insert %s into hash table", OPCODE_name(opc));
00767 ir_error(errmsg);
00768 }
00769 }
00770
00771
00772 static inline
00773 void enter_opcode_table (const char *name, OPC_EXTENDED opc, INT opr)
00774 {
00775 enter_opcode_table (name, (OPCODE) opc, opr);
00776 }
00777
00778
00779
00780
00781 static void ir_build_hashtable(void)
00782 {
00783 INT i;
00784 INT opr;
00785
00786
00787 memset(ir_opcode_table, 0, sizeof(ir_opcode_table));
00788 memset(opcode_hash, 0, sizeof(opcode_hash));
00789
00790
00791 for (i = OPCODE_FIRST; i <= OPCODE_LAST; i++) {
00792 OPCODE opc = (OPCODE) i;
00793 opr = OPCODE_operator(opc);
00794 enter_opcode_table(((char *)OPCODE_name(opc))+strlen("OPC_"), opc, opr);
00795 }
00796
00797
00798 enter_opcode_table("BODY", OPC_BODY, OPR_BODY);
00799 enter_opcode_table("NOOP", OPC_NOOP, OPR_NOOP);
00800 enter_opcode_table("END_BLOCK", OPC_END_BLOCK, OPR_END_BLOCK);
00801 enter_opcode_table("THEN", OPC_THEN, OPR_THEN);
00802 enter_opcode_table("ELSE", OPC_ELSE, OPR_ELSE);
00803 enter_opcode_table("END_IF", OPC_END_IF, OPR_END_IF);
00804 enter_opcode_table("INIT", OPC_INIT, OPR_INIT);
00805 enter_opcode_table("COMP", OPC_COMP, OPR_COMP);
00806 enter_opcode_table("INCR", OPC_INCR, OPR_INCR);
00807 enter_opcode_table("END_COMPGOTO", OPC_END_COMPGOTO, OPR_END_COMPGOTO);
00808 enter_opcode_table("END_XGOTO", OPC_END_XGOTO, OPR_END_XGOTO);
00809 enter_opcode_table("LOC", OPC_LOC, OPR_LOC);
00810 enter_opcode_table("END_LOOP_INFO", OPC_END_LINFO, OPR_END_LINFO);
00811 enter_opcode_table("END_SWITCH", OPC_END_SWITCH, OPR_END_SWITCH);
00812 }
00813
00814 #endif
00815
00816
00817
00818
00819
00820
00821
00822
00823
00824
00825
00826
00827 static void
00828 ir_put_st (ST_IDX st_idx)
00829 {
00830 char *name;
00831 char *p;
00832
00833 if (st_idx == (ST_IDX) 0) {
00834
00835 fprintf(ir_ofile, " <null-st>");
00836
00837 } else if (!follow_st) {
00838
00839
00840 fprintf(ir_ofile, " <st %d>", (INT32) st_idx);
00841
00842 } else {
00843 const ST* st = &St_Table[st_idx];
00844 if (ST_class(st) == CLASS_CONST) {
00845 name = Targ_Print(NULL, STC_val(st));
00846
00847
00848
00849 for (p = name; *p != '\0'; p++)
00850 switch (*p) {
00851 case ' ':
00852 case '\t':
00853 case '\n':
00854 *p = '_';
00855 }
00856 } else
00857 name = ST_name(st);
00858 fprintf (ir_ofile, " <%d,%d,%s>", ST_level (st), ST_index (st), name);
00859 }
00860 }
00861
00862 #ifdef BACK_END
00863 extern "C" UINT16 LNOGetVertex(WN *);
00864 extern "C" BOOL LnoDependenceEdge(WN *, WN *, mUINT16 *, DIRECTION *, BOOL *, BOOL *);
00865 #endif
00866
00867
00868
00869
00870
00871 static void
00872 ir_put_ty(TY_IDX ty)
00873 {
00874 fprintf(ir_ofile, " T<%d,%s,%d", TY_id(ty),
00875 TY_name(ty),TY_align(ty));
00876
00877 if (TY_is_restrict(ty))
00878 fprintf(ir_ofile, ",R");
00879
00880 if (TY_is_volatile(ty))
00881 fprintf(ir_ofile, ",V");
00882
00883 if (TY_is_const(ty))
00884 fprintf(ir_ofile, ",C");
00885
00886 fprintf(ir_ofile, ">");
00887 }
00888
00889
00890
00891
00892 static void ir_put_wn(WN * wn, INT indent)
00893 {
00894 OPCODE opcode;
00895
00896 if (wn == NULL) {
00897
00898 fprintf(ir_ofile, "### error: null WN pointer\n");
00899 return;
00900 } else {
00901 if (IR_dump_wn_addr) {
00902 fprintf(ir_ofile, "0x%8p: ", wn);
00903 }
00904 opcode = WN_opcode(wn);
00905 }
00906 if (opcode == 0) {
00907 fprintf(ir_ofile,"### error: WN opcode 0\n");
00908 return;
00909 }
00910
00911
00912
00913 if (IR_DUMPDEP_info) {
00914 INT32 handle= 0;
00915 if (OPCODE_has_alias_info(WN_opcode(wn)) && WN_map_id(wn) != -1) {
00916 handle= AddToDUMPDEP(wn);
00917 }
00918 fprintf(ir_ofile, "[%5d]", handle);
00919 }
00920
00921 if (indent > 0 && opcode == OPC_LABEL)
00922 fprintf(ir_ofile, "%*s", indent-1, "");
00923 else
00924 fprintf(ir_ofile, "%*s", indent, "");
00925
00926 fprintf(ir_ofile, "%s", OPCODE_name(opcode) + strlen("OPC_"));
00927 if (OPCODE_has_offset(opcode)) {
00928 if (OPCODE_operator(opcode) == OPR_PRAGMA ||
00929 OPCODE_operator(opcode) == OPR_XPRAGMA)
00930 fprintf(ir_ofile, " %d %d", WN_pragma_flags(wn), WN_pragma(wn));
00931 else
00932 fprintf(ir_ofile, " %d", WN_offset(wn));
00933 } else if (OPCODE_has_2offsets(opcode)) {
00934 fprintf(ir_ofile, " %d %d",
00935 WN_loop_trip_est(wn), WN_loop_depth(wn));
00936 }
00937
00938 switch (OPCODE_operator(opcode)) {
00939
00940 case OPR_INTRINSIC_OP:
00941 case OPR_ARRAYEXP:
00942 #ifdef KEY
00943 case OPR_PURE_CALL_OP:
00944 #endif
00945 fprintf(ir_ofile, " %d", WN_kid_count(wn));
00946 break;
00947
00948 case OPR_REGION:
00949 fprintf(ir_ofile, " %d", WN_region_id(wn));
00950 #ifdef BACK_END
00951 {
00952 RID *rid = REGION_get_rid(wn);
00953 if (rid != NULL)
00954 fprintf(ir_ofile, " %d", RID_id(rid));
00955 }
00956 #endif
00957 fprintf(ir_ofile, " (kind=%d)",WN_region_kind(wn));
00958 break;
00959 #if defined(TARG_SL)
00960 case OPR_LDA:
00961 case OPR_ISTORE:
00962 fprintf(ir_ofile, "im:%d", WN_is_internal_mem_ofst(wn));
00963 break;
00964 #endif
00965 case OPR_LDBITS:
00966 case OPR_ILDBITS:
00967 case OPR_STBITS:
00968 case OPR_ISTBITS:
00969 case OPR_EXTRACT_BITS:
00970 case OPR_COMPOSE_BITS:
00971 fprintf(ir_ofile, " <bofst:%d bsize:%d>", WN_bit_offset(wn),
00972 WN_bit_size(wn));
00973 break;
00974
00975 case OPR_ASM_INPUT:
00976 fprintf(ir_ofile, " opnd:%d", WN_asm_opnd_num(wn));
00977 break;
00978
00979 default:
00980 break;
00981 }
00982
00983 if (OPCODE_has_inumber(opcode)) {
00984 switch (opcode) {
00985 case OPC_IO:
00986 fprintf(ir_ofile, " <%d,%s,%s>", WN_intrinsic(wn),
00987 IOSTATEMENT_name((IOSTATEMENT) WN_intrinsic(wn)),
00988 get_iolibrary_name(WN_IO_Library(wn)));
00989 break;
00990 case OPC_IO_ITEM:
00991 fprintf(ir_ofile, " <%d,%s>", WN_intrinsic(wn),
00992 IOITEM_name((IOITEM) WN_intrinsic(wn)));
00993 break;
00994 default:
00995 Is_True(OPCODE_operator(opcode) == OPR_INTRINSIC_OP ||
00996 OPCODE_operator(opcode) == OPR_INTRINSIC_CALL,
00997 ("ir_put_wn, expected an intrinsic"));
00998 #if defined(BACK_END) || defined(TARG_NVISA)
00999 fprintf(ir_ofile, " <%d,%s>", WN_intrinsic(wn),
01000 INTRINSIC_name((INTRINSIC) WN_intrinsic(wn)));
01001 #endif
01002 break;
01003 }
01004 }
01005
01006 if (OPCODE_has_bits(opcode))
01007 fprintf(ir_ofile, " %d", WN_cvtl_bits(wn));
01008 if (OPCODE_has_label(opcode))
01009 fprintf(ir_ofile, " L%d", WN_label_number(wn));
01010 if (OPCODE_has_flags(opcode))
01011 fprintf(ir_ofile, " %d", WN_flag(wn));
01012 if (OPCODE_has_sym(opcode)) {
01013 ir_put_st (WN_st_idx(wn));
01014 }
01015
01016 if (OPCODE_has_1ty(opcode)) {
01017 if (WN_ty(wn) != (TY_IDX) 0)
01018 ir_put_ty(WN_ty(wn));
01019 else
01020 if (opcode != OPC_IO_ITEM)
01021 fprintf(ir_ofile, " T<### ERROR: null ptr>");
01022 } else if (OPCODE_has_2ty(opcode)) {
01023 if (WN_ty(wn) != (TY_IDX) 0)
01024 ir_put_ty(WN_ty(wn));
01025 else
01026 fprintf(ir_ofile, " T<### ERROR: null ptr>");
01027 if (WN_load_addr_ty(wn) != (TY_IDX) 0)
01028 ir_put_ty(WN_load_addr_ty(wn));
01029 else
01030 fprintf(ir_ofile, " T<### ERROR: null ptr>");
01031 }
01032
01033 if (OPCODE_has_ndim(opcode))
01034 fprintf(ir_ofile, " %d", WN_num_dim(wn));
01035 if (OPCODE_has_esize(opcode))
01036 fprintf(ir_ofile, " %" LL_FORMAT "d", WN_element_size(wn));
01037
01038 if (OPCODE_has_num_entries(opcode))
01039 fprintf(ir_ofile, " %d", WN_num_entries(wn));
01040 if (OPCODE_has_last_label(opcode))
01041 fprintf(ir_ofile, " %d", WN_last_label(wn));
01042
01043 if (OPCODE_has_value(opcode)) {
01044 fprintf(ir_ofile, " %" LL_FORMAT "d", WN_const_val(wn));
01045
01046 if (OPCODE_operator(opcode) == OPR_INTCONST || opcode == OPC_PRAGMA) {
01047 fprintf(ir_ofile, " (0x%" LL_FORMAT "x)", WN_const_val(wn));
01048 }
01049 }
01050
01051 if (OPCODE_has_field_id(opcode) && WN_field_id(wn)) {
01052 fprintf(ir_ofile, " <field_id:%u>", WN_field_id(wn));
01053 }
01054
01055
01056 if (OPCODE_has_ereg_supp(opcode)) {
01057 INITO_IDX ino = WN_ereg_supp(wn);
01058 if (ino != 0)
01059 fprintf (ir_ofile, " INITO<%d,%s>", INITO_IDX_index (ino),
01060 ST_name (INITO_st_idx (Inito_Table[ino])));
01061 }
01062 if (opcode == OPC_COMMENT) {
01063 fprintf(ir_ofile, " # %s", Index_To_Str(WN_offset(wn)));
01064 }
01065
01066 if (follow_st && OPCODE_has_sym(opcode) && OPCODE_has_offset(opcode)
01067 && WN_st_idx(wn) != (ST_IDX) 0 && (ST_class(WN_st(wn)) == CLASS_PREG)
01068 && opcode != OPC_PRAGMA)
01069 {
01070 if (Preg_Is_Dedicated(WN_offset(wn))) {
01071 if (Preg_Offset_Is_Int(WN_offset(wn))) {
01072 fprintf(ir_ofile, " # $r%d", WN_offset(wn));
01073 }
01074 else if (Preg_Offset_Is_Float(WN_offset(wn))) {
01075 fprintf(ir_ofile, " # $f%d",
01076 WN_offset(wn) - Float_Preg_Min_Offset);
01077 }
01078 #ifdef TARG_X8664
01079 else if (Preg_Offset_Is_X87(WN_offset(wn))) {
01080 fprintf(ir_ofile, " # $st%d",
01081 WN_offset(wn) - X87_Preg_Min_Offset);
01082 }
01083 #endif
01084 }
01085 else {
01086
01087 if ((WN_offset(wn) - Last_Dedicated_Preg_Offset)
01088 < PREG_Table_Size (CURRENT_SYMTAB) )
01089 fprintf(ir_ofile, " # %s", Preg_Name(WN_offset(wn)));
01090 else
01091 fprintf(ir_ofile, " # <Invalid PREG Table index (%d)>",
01092 WN_offset(wn));
01093 }
01094 }
01095
01096 if (opcode == OPC_XPRAGMA) {
01097 fprintf(ir_ofile, " # %s", WN_pragmas[WN_pragma(wn)].name);
01098 }
01099
01100 if (OPCODE_operator(opcode) == OPR_ASM_INPUT) {
01101 fprintf(ir_ofile, " # \"%s\"", WN_asm_input_constraint(wn));
01102 }
01103
01104 if (opcode == OPC_PRAGMA) {
01105 fprintf(ir_ofile, " # %s", WN_pragmas[WN_pragma(wn)].name);
01106 switch(WN_pragma(wn)) {
01107 case WN_PRAGMA_DISTRIBUTE:
01108 case WN_PRAGMA_REDISTRIBUTE:
01109 case WN_PRAGMA_DISTRIBUTE_RESHAPE:
01110 fprintf(ir_ofile, ", %d",WN_pragma_index(wn));
01111 switch(WN_pragma_distr_type(wn)) {
01112 case DISTRIBUTE_STAR:
01113 fprintf(ir_ofile, ", *");
01114 break;
01115 case DISTRIBUTE_BLOCK:
01116 fprintf(ir_ofile, ", BLOCK");
01117 break;
01118 case DISTRIBUTE_CYCLIC_CONST:
01119 fprintf(ir_ofile, ", CYCLIC(%d)", WN_pragma_preg(wn));
01120 break;
01121 case DISTRIBUTE_CYCLIC_EXPR:
01122 fprintf(ir_ofile, ", CYCLIC(expr)");
01123 break;
01124 }
01125 break;
01126 case WN_PRAGMA_ASM_CONSTRAINT:
01127 fprintf(ir_ofile, ", \"%s\", opnd:%d preg:%d",
01128 WN_pragma_asm_constraint(wn),
01129 WN_pragma_asm_opnd_num(wn),
01130 WN_pragma_asm_copyout_preg(wn));
01131 break;
01132 default:
01133 if (WN_pragma_arg2(wn) != 0 )
01134 fprintf(ir_ofile, ", %d, %d", WN_pragma_arg1(wn), WN_pragma_arg2(wn));
01135 else
01136 if (WN_pragma_arg1(wn) != 0 )
01137 fprintf(ir_ofile, ", %d", WN_pragma_arg1(wn));
01138 break;
01139 }
01140 }
01141
01142 if (OPCODE_operator(opcode) == OPR_ASM_STMT) {
01143 fprintf(ir_ofile, " # \"%s\"", WN_asm_string(wn));
01144 if (WN_Asm_Volatile(wn))
01145 fprintf(ir_ofile, " (volatile)");
01146 if (WN_Asm_Clobbers_Mem(wn))
01147 fprintf(ir_ofile, " (memory)");
01148 if (WN_Asm_Clobbers_Cc(wn))
01149 fprintf(ir_ofile, " (cc)");
01150 }
01151
01152 if (OPCODE_is_call(opcode))
01153 fprintf(ir_ofile, " # flags 0x%x", WN_call_flag(wn));
01154
01155 if (OPCODE_operator(opcode) == OPR_PARM) {
01156 INT flag = WN_flag(wn);
01157 fprintf(ir_ofile, " # ");
01158 if (flag & WN_PARM_BY_REFERENCE) fprintf(ir_ofile, " by_reference ");
01159 #if defined(TARG_SL)
01160 if (flag & WN_PARM_DEREFERENCE) fprintf(ir_ofile, " by_dereference ");
01161 #endif
01162 if (flag & WN_PARM_BY_VALUE) fprintf(ir_ofile, " by_value ");
01163 if (flag & WN_PARM_OUT) fprintf(ir_ofile, " out ");
01164 if (flag & WN_PARM_DUMMY) fprintf(ir_ofile, " dummy ");
01165 if (flag & WN_PARM_READ_ONLY) fprintf(ir_ofile, " read_only ");
01166 if (flag & WN_PARM_PASSED_NOT_SAVED) fprintf(ir_ofile, "passed_not_saved ");
01167 if (flag & WN_PARM_NOT_EXPOSED_USE) fprintf(ir_ofile, " not_euse ");
01168 if (flag & WN_PARM_IS_KILLED) fprintf(ir_ofile, " killed ");
01169 }
01170
01171 if (IR_dump_map_info) {
01172 fprintf(ir_ofile, " # <id %d:%d>", OPCODE_mapcat(opcode),
01173 WN_map_id(wn));
01174 if (ir_put_map && ( WN_map_id(wn) != -1 )) {
01175 switch ( WN_MAP_Get_Kind( ir_put_map ) ) {
01176 case WN_MAP_KIND_VOIDP:
01177 fprintf(ir_ofile, " <map %8p>", WN_MAP_Get( ir_put_map, wn ));
01178 break;
01179 case WN_MAP_KIND_INT32:
01180 fprintf(ir_ofile, " <map %08x>", WN_MAP32_Get( ir_put_map, wn ));
01181 break;
01182 case WN_MAP_KIND_INT64:
01183 fprintf(ir_ofile, " <map %08llx>", WN_MAP64_Get( ir_put_map, wn ));
01184 break;
01185 }
01186 }
01187 #ifdef BACK_END
01188 if (UINT16 vertex = LNOGetVertex(wn)) {
01189 fprintf(ir_ofile, " <lno vertex %d>", vertex);
01190 }
01191 #endif
01192 }
01193
01194 if (IR_dump_line_numbers &&
01195 (OPCODE_is_scf(WN_opcode(wn)) || OPCODE_is_stmt(WN_opcode(wn)))) {
01196
01197 USRCPOS srcpos;
01198 USRCPOS_srcpos(srcpos) = WN_Get_Linenum(wn);
01199
01200 fprintf(ir_ofile, " {line: %d}", USRCPOS_linenum(srcpos));
01201 }
01202
01203 #ifdef BACK_END
01204 if (IR_dump_alias_info(WN_opcode(wn))) {
01205 fprintf(ir_ofile, " [alias_id: %d%s]", WN_MAP32_Get(IR_alias_map, wn),
01206 IR_alias_mgr && IR_alias_mgr->Safe_to_speculate(wn) ? ",fixed" : "");
01207 }
01208 #endif
01209
01210 if (IR_freq_map != WN_MAP_UNDEFINED && (OPCODE_is_scf(WN_opcode(wn)) ||
01211 OPCODE_is_stmt(WN_opcode(wn)))) {
01212 USRCPOS srcpos;
01213 USRCPOS_srcpos(srcpos) = WN_Get_Linenum(wn);
01214
01215 fprintf(ir_ofile, " {freq: %d, ln: %d, col: %d}",
01216 WN_MAP32_Get(IR_freq_map, wn),
01217 USRCPOS_linenum(srcpos),
01218 USRCPOS_column(srcpos));
01219 }
01220 if (Current_Map_Tab != NULL
01221 && WN_MAP32_Get(WN_MAP_ALIAS_CLASS, wn) != 0)
01222 {
01223 fprintf(ir_ofile, " {class %d}",
01224 WN_MAP32_Get(WN_MAP_ALIAS_CLASS, wn));
01225 }
01226 fprintf(ir_ofile, "\n");
01227 }
01228
01229
01230
01231
01232
01233
01234 static void ir_put_expr(WN * wn, INT indent)
01235 {
01236 INT i;
01237 WN * wn2;
01238
01239
01240 if (dump_parent_before_children) {
01241 ir_put_wn(wn,indent);
01242 }
01243 for (i = 0; i < WN_kid_count(wn); i++) {
01244 wn2 = WN_kid(wn,i);
01245 if (wn2) {
01246 OPCODE op = WN_opcode(wn2);
01247 if ((OPCODE_FIRST <= op && op <= OPCODE_LAST) &&
01248 (OPCODE_is_expression(op) || OPCODE_is_call(op)))
01249 ir_put_expr(WN_kid(wn,i), indent+1);
01250 else
01251 if ( op == OPC_BLOCK
01252 && ( (WN_operator(wn) == OPR_RCOMMA && i == 1)
01253 || (WN_operator(wn) == OPR_COMMA && i == 0)))
01254 ir_put_stmt(wn2, indent+1);
01255 else
01256 fprintf(ir_ofile, "%*sopcode %d not an expression\n", indent+1, "", op);
01257 } else
01258 fprintf(ir_ofile, "%*snull-expression\n", indent+1, "");
01259 }
01260 if (!dump_parent_before_children) {
01261 ir_put_wn(wn, indent);
01262 }
01263 }
01264
01265
01266
01267
01268
01269 static void ir_put_marker(const char *str, INT indent)
01270 {
01271 fprintf(ir_ofile, "%*s%s\n", indent, "", str);
01272 }
01273
01274
01275
01276
01277
01278 static void ir_put_stmt(WN * wn, INT indent)
01279 {
01280 INT i;
01281 WN * wn2;
01282 USRCPOS srcpos;
01283
01284 if (wn) {
01285 OPCODE opc = WN_opcode(wn);
01286 BOOL already_dumped_wn = FALSE;
01287 USRCPOS_srcpos(srcpos) = WN_Get_Linenum(wn);
01288 if (USRCPOS_srcpos(srcpos) != 0 &&
01289 USRCPOS_srcpos(srcpos) != USRCPOS_srcpos(last_srcpos)) {
01290 last_srcpos = srcpos;
01291 #ifdef FRONT_END
01292 fprintf(ir_ofile, "%*sLOC %d %d\n", indent, "",
01293 USRCPOS_filenum(srcpos), USRCPOS_linenum(srcpos));
01294 #else
01295 print_source(USRCPOS_srcpos(srcpos));
01296 #endif
01297 }
01298
01299 if (OPCODE_is_scf(opc) || dump_parent_before_children) {
01300 ir_put_wn(wn, indent);
01301 already_dumped_wn = TRUE;
01302 }
01303
01304 switch (opc) {
01305
01306 case OPC_BLOCK:
01307 wn2 = WN_first(wn);
01308 while (wn2) {
01309 ir_put_stmt(wn2, indent);
01310 wn2 = WN_next(wn2);
01311 }
01312 ir_put_marker("END_BLOCK", indent);
01313 break;
01314
01315 case OPC_REGION:
01316 ir_put_marker("REGION EXITS", indent);
01317 ir_put_stmt(WN_region_exits(wn), indent+1);
01318
01319 ir_put_marker("REGION PRAGMAS", indent);
01320 ir_put_stmt(WN_region_pragmas(wn), indent+1);
01321
01322 ir_put_marker("REGION BODY", indent);
01323 ir_put_stmt(WN_region_body(wn), indent+1);
01324
01325
01326
01327 #ifdef BACK_END
01328 if (IR_dump_region)
01329 CG_Dump_Region(ir_ofile, wn);
01330 #endif
01331 { char str[20];
01332 sprintf(str,"END_REGION %d", WN_region_id(wn));
01333 ir_put_marker(str, indent);
01334 }
01335 break;
01336
01337 case OPC_LABEL:
01338 ir_put_wn(wn, indent);
01339 if ( WN_label_loop_info(wn) != NULL ) {
01340 ir_put_stmt(WN_label_loop_info(wn), indent+1);
01341 }
01342 already_dumped_wn = TRUE;
01343 break;
01344
01345 case OPC_IF:
01346 ir_put_expr(WN_if_test(wn), indent+1);
01347 if (WN_then(wn)) {
01348 ir_put_marker("THEN", indent);
01349 ir_put_stmt(WN_then(wn), indent+1);
01350 }
01351 if (WN_else(wn)) {
01352 ir_put_marker("ELSE", indent);
01353 ir_put_stmt(WN_else(wn), indent+1);
01354 }
01355 ir_put_marker("END_IF", indent);
01356 break;
01357
01358 case OPC_DO_LOOP:
01359 ir_put_expr(WN_index(wn), indent+1);
01360 ir_put_marker("INIT",indent);
01361 ir_put_stmt(WN_start(wn), indent+1);
01362 ir_put_marker("COMP", indent);
01363 ir_put_expr(WN_end(wn), indent+1);
01364 ir_put_marker("INCR", indent);
01365 ir_put_stmt(WN_step(wn), indent+1);
01366
01367 if ( WN_do_loop_info(wn) != NULL ) {
01368 ir_put_stmt(WN_do_loop_info(wn), indent);
01369 }
01370 ir_put_marker("BODY", indent);
01371 ir_put_stmt(WN_do_body(wn), indent+1);
01372 break;
01373
01374 case OPC_LOOP_INFO:
01375 ir_put_wn(wn, indent);
01376 if ( WN_loop_induction(wn) != NULL ) {
01377 ir_put_expr(WN_loop_induction(wn), indent+1);
01378 }
01379 if ( WN_loop_trip(wn) != NULL ) {
01380 ir_put_expr(WN_loop_trip(wn), indent+1);
01381 }
01382 ir_put_marker("END_LOOP_INFO", indent);
01383 already_dumped_wn = TRUE;
01384 break;
01385
01386 case OPC_COMPGOTO:
01387 ir_put_wn(wn, indent);
01388 ir_put_expr(WN_kid(wn,0), indent+1);
01389 ir_put_stmt(WN_kid(wn,1), indent+1);
01390 if (WN_kid_count(wn) > 2)
01391 ir_put_stmt(WN_kid(wn,2), indent+1);
01392 ir_put_marker("END_COMPGOTO", indent);
01393 already_dumped_wn = TRUE;
01394 break;
01395
01396 case OPC_SWITCH:
01397 ir_put_wn(wn, indent);
01398 ir_put_expr(WN_kid(wn,0), indent+1);
01399 ir_put_stmt(WN_kid(wn,1), indent+1);
01400 if (WN_kid_count(wn) > 2)
01401 ir_put_stmt(WN_kid(wn,2), indent+1);
01402 ir_put_marker("END_SWITCH", indent);
01403 already_dumped_wn = TRUE;
01404 break;
01405
01406 case OPC_XGOTO:
01407 ir_put_wn(wn, indent);
01408 ir_put_expr(WN_kid(wn,0), indent+1);
01409 ir_put_stmt(WN_kid(wn,1), indent+1);
01410 ir_put_marker("END_XGOTO", indent);
01411 already_dumped_wn = TRUE;
01412 break;
01413
01414 case OPC_WHERE:
01415 ir_put_expr(WN_kid(wn,0), indent+1);
01416 ir_put_marker("BODY", indent);
01417 ir_put_stmt(WN_kid(wn,1), indent+1);
01418 ir_put_stmt(WN_kid(wn,2), indent+1);
01419 break;
01420
01421 case OPC_EXC_SCOPE_BEGIN:
01422 {
01423 INT i;
01424 for (i = 0; i < WN_kid_count(wn); i++)
01425 ir_put_stmt(WN_kid(wn, i), indent+1);
01426 break;
01427 }
01428 case OPC_EXC_SCOPE_END:
01429 break;
01430
01431 case OPC_ASM_STMT:
01432 ir_put_wn(wn, indent);
01433 already_dumped_wn = TRUE;
01434 ir_put_stmt(WN_kid(wn,0), indent+1);
01435 ir_put_stmt(WN_kid(wn,1), indent+1);
01436 ir_put_marker("ASM_INPUTS", indent);
01437 {
01438 INT i;
01439 for (i = 2; i < WN_kid_count(wn); i++) {
01440 ir_put_expr(WN_kid(wn,i), indent+1);
01441 }
01442 }
01443 ir_put_marker("END_ASM_INPUTS", indent);
01444 break;
01445
01446 default:
01447 {
01448 INT last_is_expr = TRUE;
01449 OPCODE opc2;
01450 for (i = 0; i < WN_kid_count(wn); i++) {
01451 wn2 = WN_kid(wn,i);
01452 if (wn2) {
01453 opc2 = WN_opcode(wn2);
01454 if (opc2 == 0) {
01455 fprintf(ir_ofile, "### error: WN opcode 0\n");
01456 } else if (OPCODE_is_expression(opc2)) {
01457 ir_put_expr(wn2, indent+1);
01458 last_is_expr = 1;
01459 }
01460 else if (OPCODE_is_stmt(opc2) || OPCODE_is_scf(opc2)) {
01461 if (last_is_expr) {
01462 ir_put_marker("BODY", indent);
01463 ir_put_stmt(wn2, indent+1);
01464 } else
01465 ir_put_stmt(WN_kid(wn,i), indent+1);
01466 last_is_expr = 0;
01467 } else {
01468 fprintf(ir_ofile, "### error: unknown opcode type %d\n",opc2);
01469 }
01470 } else
01471 ir_put_stmt(wn2, indent+1);
01472 }
01473 }
01474 }
01475 if (!already_dumped_wn)
01476 ir_put_wn(wn, indent);
01477 } else
01478 ir_put_wn(wn, indent);
01479 }
01480
01481 #ifdef BACK_END
01482
01483 static void fdump_DUMPDEP(FILE *f, DUMPDEPp head, struct ALIAS_MANAGER *alias)
01484 {
01485 DUMPDEPp p,q;
01486
01487 fprintf(f, "\nDUMP DEPENDENCY DUMP: == SAME_LOCATION, != NOT_ALIASED, ? POSSIBLY ALIASED\n");
01488 fprintf(f, "LNO dependency edges are <id: distance is_must direction>\n");
01489
01490 for(p= head; p; p= DUMPDEP_next(p))
01491 {
01492 WN *node= DUMPDEP_node(p);
01493
01494 if (OPCODE_is_load(WN_opcode(node)))
01495 continue;
01496 if (OPCODE_is_store(WN_opcode(node)))
01497 {
01498 fprintf(f, "STORE[%d] ", DUMPDEP_id(p));
01499 }
01500 else if (WN_operator(node) == OPR_PARM)
01501 {
01502 fprintf(f, "PARM[%d] ", DUMPDEP_id(p));
01503 }
01504 if (Valid_alias(alias, node))
01505 {
01506 fprintf(f, "\t== {");
01507 for(q= head; q; q= DUMPDEP_next(q))
01508 {
01509 WN *wn = DUMPDEP_node(q);
01510 if (Valid_alias(alias, wn) &&
01511 SAME_LOCATION == Aliased(alias, node, wn))
01512 fprintf(f, "%d,", DUMPDEP_id(q));
01513 }
01514 fprintf(f, "}\n\t\t!= {");
01515
01516 for(q= head; q; q= DUMPDEP_next(q))
01517 {
01518 WN *wn = DUMPDEP_node(q);
01519 if (Valid_alias(alias, wn) &&
01520 NOT_ALIASED == Aliased(alias, node, wn))
01521 fprintf(f, "%d,", DUMPDEP_id(q));
01522 }
01523
01524 fprintf(f, "}\n\t\t? {");
01525 for(q= head; q; q= DUMPDEP_next(q))
01526 {
01527 WN *wn = DUMPDEP_node(q);
01528 if (Valid_alias(alias, wn) &&
01529 POSSIBLY_ALIASED == Aliased(alias, node, wn))
01530 fprintf(f, "%d,", DUMPDEP_id(q));
01531 }
01532 fprintf(f, "}\n");
01533 }
01534
01535
01536
01537
01538 fprintf(f, "\t\t== LNO {");
01539 for(q= head; q; q= DUMPDEP_next(q))
01540 {
01541 mUINT16 dist;
01542 DIRECTION dir;
01543 BOOL is_must, ok;
01544
01545
01546 if (LnoDependenceEdge( node, DUMPDEP_node(q), &dist, &dir, &is_must, &ok))
01547 {
01548 fprintf(f, "<%d: %d, %s",
01549 DUMPDEP_id(q), dist, is_must ? "MUST " : "");
01550 DIRECTION_Print(dir, f);
01551 fprintf(f, ">, ");
01552 }
01553 }
01554 fprintf(f, "}\n");
01555 }
01556 }
01557 #endif
01558
01559
01560
01561
01562 extern void IR_put_func(WN * wn, FILE *f)
01563 {
01564 FILE *save;
01565 if (f) {
01566 save = ir_ofile;
01567 ir_ofile = f;
01568 }
01569 ir_put_stmt(wn, 0);
01570 if (f) {
01571 ir_ofile = save;
01572 }
01573 }
01574
01575
01576
01577
01578
01579
01580
01581
01582
01583
01584
01585 extern void dump_wn(WN *wn)
01586 {
01587 FILE *save;
01588
01589 if (!is_initialized) IR_reader_init();
01590 save = ir_ofile;
01591 ir_ofile = stdout;
01592 IR_Dwarf_Gen_File_Table(TRUE);
01593 ir_put_wn(wn, 0);
01594 ir_ofile = save;
01595 }
01596
01597 extern void fdump_wn(FILE *fp, WN *wn)
01598 {
01599 FILE *save;
01600
01601 if (!is_initialized) IR_reader_init();
01602 save = ir_ofile;
01603 ir_ofile = fp;
01604 IR_Dwarf_Gen_File_Table(TRUE);
01605 ir_put_wn(wn, 0);
01606 ir_ofile = save;
01607 }
01608
01609 extern void dump_tree(WN *wn)
01610 {
01611 fdump_tree(stdout,wn);
01612 }
01613
01614 #ifdef BACK_END
01615 extern void dump_dep_tree(WN *wn, struct ALIAS_MANAGER *alias)
01616 {
01617 fdump_dep_tree(stdout, wn, alias);
01618 }
01619 #endif
01620
01621 extern void dump_region_tree(WN *wn)
01622 {
01623 BOOL save = IR_dump_region;
01624 IR_dump_region = TRUE;
01625 fdump_tree(stdout, wn);
01626 IR_dump_region = save;
01627 }
01628
01629 extern void dump_wn_no_st(WN *wn)
01630 {
01631 BOOL save_follow_st;
01632 if (!is_initialized) IR_reader_init();
01633 save_follow_st = follow_st;
01634 follow_st = FALSE;
01635 dump_wn(wn);
01636 follow_st = save_follow_st;
01637 }
01638
01639 extern void fdump_wn_no_st(FILE *fp, WN *wn)
01640 {
01641 BOOL save_follow_st;
01642 FILE *save = ir_ofile;
01643 if (!is_initialized) IR_reader_init();
01644 save_follow_st = follow_st;
01645 ir_ofile = fp;
01646 follow_st = FALSE;
01647 IR_Dwarf_Gen_File_Table(TRUE);
01648 ir_put_wn(wn, 0);
01649 follow_st = save_follow_st;
01650 ir_ofile = save;
01651 }
01652
01653 extern void dump_tree_no_st(WN *wn)
01654 {
01655 BOOL save_follow_st;
01656 if (!is_initialized) IR_reader_init();
01657 save_follow_st = follow_st;
01658 follow_st = FALSE;
01659 dump_tree(wn);
01660 follow_st = save_follow_st;
01661 }
01662
01663 extern void fdump_tree(FILE *f, WN *wn)
01664 {
01665 FILE *save;
01666
01667
01668 if (!is_initialized) IR_reader_init();
01669 save = ir_ofile;
01670 ir_ofile = f;
01671 IR_Dwarf_Gen_File_Table(TRUE);
01672 if (!wn) {
01673 fprintf(ir_ofile, "<null whirl tree>\n");
01674 } else if (OPCODE_is_stmt(WN_opcode(wn)) || OPCODE_is_scf(WN_opcode(wn)))
01675 ir_put_stmt(wn, 0);
01676 else if (OPCODE_is_expression(WN_opcode(wn)))
01677 ir_put_expr(wn, 0);
01678 else if (WN_opcode(wn) == OPC_FUNC_ENTRY)
01679 IR_put_func(wn, NULL);
01680 else
01681 fprintf(ir_ofile, "unknown opcode in (WN *) 0x%p\n", wn);
01682 ir_ofile = save;
01683 }
01684
01685
01686 extern void fdump_tree_no_st( FILE *f, WN *wn )
01687 {
01688 BOOL save_follow_st;
01689 if (!is_initialized) IR_reader_init();
01690 save_follow_st = follow_st;
01691 follow_st = FALSE;
01692 fdump_tree( f, wn );
01693 follow_st = save_follow_st;
01694 }
01695
01696 extern void fdump_tree_with_alias( FILE *f, const WN *wn, WN_MAP map, const struct ALIAS_MANAGER *am)
01697 {
01698 WN_MAP save = IR_alias_map;
01699 const struct ALIAS_MANAGER *save_am = am;
01700 IR_alias_map = map;
01701 IR_alias_mgr = am;
01702 fdump_tree( f, (WN *)wn );
01703 IR_alias_map = save;
01704 IR_alias_mgr = save_am;
01705 }
01706
01707 extern void enable_tree_freq_display(void)
01708 {
01709 IR_freq_map = WN_MAP_FEEDBACK;
01710 }
01711
01712 extern void disable_tree_freq_display(void)
01713 {
01714 IR_freq_map = WN_MAP_UNDEFINED;
01715 }
01716
01717 extern void fdump_tree_with_freq( FILE *f, const WN *wn, WN_MAP map)
01718 {
01719 WN_MAP save = IR_freq_map;
01720 IR_freq_map = map;
01721 fdump_tree( f, (WN *)wn );
01722 IR_freq_map = save;
01723 }
01724
01725 extern void fdump_region_tree(FILE *f, WN *wn)
01726 {
01727 BOOL save = IR_dump_region;
01728 IR_dump_region = TRUE;
01729 fdump_tree(f, wn);
01730 IR_dump_region = save;
01731 }
01732
01733
01734
01735
01736
01737
01738
01739
01740
01741 static void WN_TREE_put_expr(WN * wn, INT indent) {
01742 WN * wn2;
01743 WN * parent_wn;
01744
01745 Is_True(OPCODE_is_expression(WN_opcode(wn)) || OPCODE_is_call(WN_opcode(wn)),
01746 ("WN_TREE_put_expr invoked with non-expression, opcode = %s",
01747 OPCODE_name(WN_opcode(wn))));
01748
01749
01750 if (dump_parent_before_children) {
01751
01752
01753 WN_TREE_ITER<PRE_ORDER> tree_iter(wn);
01754
01755 #ifndef __GNU_BUG_WORKAROUND
01756 while (tree_iter != LAST_PRE_ORDER_ITER) {
01757 #else
01758 while (tree_iter != WN_TREE_ITER<PRE_ORDER, WN*>()) {
01759 #endif
01760 wn2 = tree_iter.Wn();
01761
01762 if (OPCODE_is_expression(WN_opcode(wn2)) ||
01763 OPCODE_is_call(WN_opcode(wn2)))
01764 ir_put_wn(wn2,indent+tree_iter.Depth());
01765
01766 else if (WN_operator(wn2) == OPR_BLOCK) {
01767
01768 parent_wn = tree_iter.Get_parent_wn();
01769 Is_True(parent_wn &&
01770 ((WN_operator(parent_wn) == OPR_COMMA) ||
01771 (WN_operator(parent_wn) == OPR_RCOMMA)),
01772 ("block under expression not a part of comma/rcomma"));
01773
01774 WN_TREE_put_stmt(wn2, indent + tree_iter.Depth());
01775 tree_iter.Unwind();
01776
01777 }
01778
01779 else
01780 fprintf(ir_ofile, "%*sopcode %d not an expression\n",
01781 indent+1,"", WN_opcode(wn2));
01782 ++tree_iter;
01783 }
01784 }
01785 else {
01786
01787
01788
01789
01790
01791 ir_put_expr(wn,indent);
01792 }
01793 }
01794
01795
01796
01797
01798
01799
01800
01801 static void WN_TREE_put_stmt(WN * wn, INT indent)
01802 {
01803 INT i;
01804 WN * wn2;
01805 USRCPOS srcpos;
01806
01807 Is_True(wn != 0, ("WN_TREE_put_stmt called with null whirl tree"));
01808
01809 OPCODE opc = WN_opcode(wn);
01810 Is_True(OPCODE_is_scf(opc) || OPCODE_is_stmt(opc),
01811 ("WN_TREE_put_stmt invoked on non statement: opcode = %s",
01812 OPCODE_name(opc)));
01813
01814 if (wn) {
01815 BOOL already_dumped_wn = FALSE;
01816 USRCPOS_srcpos(srcpos) = WN_Get_Linenum(wn);
01817 if (USRCPOS_srcpos(srcpos) != 0 &&
01818 USRCPOS_srcpos(srcpos) != USRCPOS_srcpos(last_srcpos)) {
01819 last_srcpos = srcpos;
01820 #ifdef FRONT_END
01821 fprintf(ir_ofile, "%*sLOC %d %d\n", indent, "",
01822 USRCPOS_filenum(srcpos), USRCPOS_linenum(srcpos));
01823 #else
01824 print_source(USRCPOS_srcpos(srcpos));
01825 #endif
01826 }
01827
01828 if (OPCODE_is_scf(opc) || dump_parent_before_children) {
01829 ir_put_wn(wn, indent);
01830 already_dumped_wn = TRUE;
01831 }
01832
01833
01834 WN_TREE_ITER<PRE_ORDER> tree_iter(wn);
01835
01836 switch (opc) {
01837
01838 case OPC_BLOCK:
01839 if (WN_first(wn)) {
01840 ++tree_iter;
01841 #ifndef __GNU_BUG_WORKAROUND
01842 while (tree_iter != LAST_PRE_ORDER_ITER) {
01843 #else
01844 while (tree_iter != WN_TREE_ITER<PRE_ORDER, WN*>()) {
01845 #endif
01846 wn2 = tree_iter.Wn();
01847 WN_TREE_put_stmt(wn2, indent);
01848 tree_iter.Unwind();
01849
01850 }
01851 }
01852 ir_put_marker("END_BLOCK", indent);
01853 break;
01854
01855 case OPC_REGION:
01856 ir_put_marker("REGION EXITS", indent);
01857 WN_TREE_put_stmt(WN_region_exits(wn), indent+1);
01858
01859 ir_put_marker("REGION PRAGMAS", indent);
01860 WN_TREE_put_stmt(WN_region_pragmas(wn), indent+1);
01861
01862 ir_put_marker("REGION BODY", indent);
01863 WN_TREE_put_stmt(WN_region_body(wn), indent+1);
01864
01865
01866
01867 #ifdef BACK_END
01868 if (IR_dump_region)
01869 CG_Dump_Region(ir_ofile, wn);
01870 #endif
01871 { char str[20];
01872 sprintf(str,"END_REGION %d", WN_region_id(wn));
01873 ir_put_marker(str, indent);
01874 }
01875 break;
01876
01877 case OPC_LABEL:
01878 ir_put_wn(wn, indent);
01879 if ( WN_label_loop_info(wn) != NULL ) {
01880 WN_TREE_put_stmt(WN_label_loop_info(wn), indent+1);
01881 }
01882 already_dumped_wn = TRUE;
01883 break;
01884
01885 case OPC_IF:
01886 WN_TREE_put_expr(WN_if_test(wn), indent+1);
01887 if (WN_then(wn)) {
01888 ir_put_marker("THEN", indent);
01889 WN_TREE_put_stmt(WN_then(wn), indent+1);
01890 }
01891 if (WN_else(wn)) {
01892 ir_put_marker("ELSE", indent);
01893 WN_TREE_put_stmt(WN_else(wn), indent+1);
01894 }
01895 ir_put_marker("END_IF", indent);
01896 break;
01897
01898 case OPC_DO_LOOP:
01899 WN_TREE_put_expr(WN_index(wn), indent+1);
01900 ir_put_marker("INIT",indent);
01901 WN_TREE_put_stmt(WN_start(wn), indent+1);
01902 ir_put_marker("COMP", indent);
01903 WN_TREE_put_expr(WN_end(wn), indent+1);
01904 ir_put_marker("INCR", indent);
01905 WN_TREE_put_stmt(WN_step(wn), indent+1);
01906
01907 if ( WN_do_loop_info(wn) != NULL ) {
01908 WN_TREE_put_stmt(WN_do_loop_info(wn), indent);
01909 }
01910 ir_put_marker("BODY", indent);
01911 WN_TREE_put_stmt(WN_do_body(wn), indent+1);
01912 break;
01913
01914 case OPC_LOOP_INFO:
01915 ir_put_wn(wn, indent);
01916 if ( WN_loop_induction(wn) != NULL ) {
01917 WN_TREE_put_expr(WN_loop_induction(wn), indent+1);
01918 }
01919 if ( WN_loop_trip(wn) != NULL ) {
01920 WN_TREE_put_expr(WN_loop_trip(wn), indent+1);
01921 }
01922 ir_put_marker("END_LOOP_INFO", indent);
01923 already_dumped_wn = TRUE;
01924 break;
01925
01926 case OPC_COMPGOTO:
01927 ir_put_wn(wn, indent);
01928 WN_TREE_put_expr(WN_kid(wn,0), indent+1);
01929 WN_TREE_put_stmt(WN_kid(wn,1), indent+1);
01930 if (WN_kid_count(wn) > 2)
01931 WN_TREE_put_stmt(WN_kid(wn,2), indent+1);
01932 ir_put_marker("END_COMPGOTO", indent);
01933 already_dumped_wn = TRUE;
01934 break;
01935
01936 case OPC_SWITCH:
01937 ir_put_wn(wn, indent);
01938 WN_TREE_put_expr(WN_kid(wn,0), indent+1);
01939 WN_TREE_put_stmt(WN_kid(wn,1), indent+1);
01940 if (WN_kid_count(wn) > 2)
01941 WN_TREE_put_stmt(WN_kid(wn,2), indent+1);
01942 ir_put_marker("END_SWITCH", indent);
01943 already_dumped_wn = TRUE;
01944 break;
01945
01946 case OPC_XGOTO:
01947 ir_put_wn(wn, indent);
01948 WN_TREE_put_expr(WN_kid(wn,0), indent+1);
01949 WN_TREE_put_stmt(WN_kid(wn,1), indent+1);
01950 ir_put_marker("END_XGOTO", indent);
01951 already_dumped_wn = TRUE;
01952 break;
01953
01954 case OPC_WHERE:
01955 WN_TREE_put_expr(WN_kid(wn,0), indent+1);
01956 ir_put_marker("BODY", indent);
01957 WN_TREE_put_stmt(WN_kid(wn,1), indent+1);
01958 WN_TREE_put_stmt(WN_kid(wn,2), indent+1);
01959 break;
01960
01961 case OPC_EXC_SCOPE_BEGIN:
01962 {
01963 INT i;
01964 for (i = 0; i < WN_kid_count(wn); i++)
01965 WN_TREE_put_stmt(WN_kid(wn, i), indent+1);
01966 break;
01967 }
01968 case OPC_EXC_SCOPE_END:
01969 break;
01970 default:
01971 {
01972 INT last_is_expr = TRUE;
01973 OPCODE opc2;
01974 for (i = 0; i < WN_kid_count(wn); i++) {
01975 wn2 = WN_kid(wn,i);
01976 if (wn2) {
01977 opc2 = WN_opcode(wn2);
01978 if (opc2 == 0) {
01979 fprintf(ir_ofile, "### error: WN opcode 0\n");
01980 } else if (OPCODE_is_expression(opc2)) {
01981 WN_TREE_put_expr(wn2, indent+1);
01982 last_is_expr = 1;
01983 }
01984 else if (OPCODE_is_stmt(opc2) || OPCODE_is_scf(opc2)) {
01985 if (last_is_expr) {
01986 ir_put_marker("BODY", indent);
01987 WN_TREE_put_stmt(wn2, indent+1);
01988 } else
01989 WN_TREE_put_stmt(WN_kid(wn,i), indent+1);
01990 last_is_expr = 0;
01991 } else {
01992 fprintf(ir_ofile, "### error: unknown opcode type %d\n",opc2);
01993 }
01994 } else
01995 WN_TREE_put_stmt(wn2, indent+1);
01996 }
01997 }
01998 }
01999 if (!already_dumped_wn)
02000 ir_put_wn(wn, indent);
02001 } else
02002 ir_put_wn(wn, indent);
02003 }
02004
02005 extern void WN_TREE_put_func(WN * wn, FILE *f)
02006 {
02007 FILE *save;
02008 if (f) {
02009 save = ir_ofile;
02010 ir_ofile = f;
02011 }
02012 WN_TREE_put_stmt(wn, 0);
02013 if (f) {
02014 ir_ofile = save;
02015 }
02016 }
02017
02018 extern void WN_TREE_fdump_tree(FILE *f, WN *wn)
02019 {
02020 FILE *save;
02021
02022
02023 if (!is_initialized) IR_reader_init();
02024 save = ir_ofile;
02025 ir_ofile = f;
02026 IR_Dwarf_Gen_File_Table(TRUE);
02027 ir_print_filename(TRUE);
02028 if (!wn) {
02029 fprintf(ir_ofile, "<null whirl tree>\n");
02030 } else if (OPCODE_is_stmt(WN_opcode(wn)) || OPCODE_is_scf(WN_opcode(wn)))
02031 WN_TREE_put_stmt(wn, 0);
02032 else if (OPCODE_is_expression(WN_opcode(wn)))
02033 WN_TREE_put_expr(wn, 0);
02034 else if (WN_opcode(wn) == OPC_FUNC_ENTRY)
02035 WN_TREE_put_func(wn, NULL);
02036 else
02037 fprintf(ir_ofile, "unknown opcode in (WN *) 0x%p\n", wn);
02038 ir_ofile = save;
02039 }
02040
02041 extern void WN_TREE_dump_tree(WN *wn)
02042 {
02043 WN_TREE_fdump_tree(stdout,wn);
02044 }
02045
02046
02047 #ifdef BACK_END
02048 extern void fdump_dep_tree( FILE *f, WN *wn, struct ALIAS_MANAGER *alias)
02049 {
02050 if (alias)
02051 {
02052 BOOL save= IR_dump_map_info;
02053
02054 L_Save();
02055 IR_dump_map_info= TRUE;
02056 IR_DUMPDEP_info = TRUE;
02057 IR_DUMPDEP_head= NULL;;
02058
02059 fdump_tree( f, (WN *)wn );
02060 fdump_DUMPDEP(f, IR_DUMPDEP_head, alias);
02061
02062
02063 L_Free();
02064 IR_DUMPDEP_head= NULL;;
02065 IR_DUMPDEP_info = FALSE;
02066 IR_dump_map_info = save;
02067 }
02068 else
02069 {
02070 fprintf(f, "\talias manager not initialized\n");
02071 }
02072 }
02073 #endif
02074
02075 extern void Check_for_IR_Dump(INT phase, WN *pu, const char *phase_name)
02076 {
02077 BOOL dump_ir;
02078 BOOL dump_symtab;
02079 dump_ir = Get_Trace ( TKIND_IR, phase );
02080 dump_symtab = Get_Trace ( TKIND_SYMTAB, phase );
02081 if (dump_ir || dump_symtab) {
02082 fprintf(TFile,"\n\n========== Driver dump after %s ==========\n",
02083 phase_name);
02084 if (dump_ir) fdump_tree (TFile,pu);
02085 if (dump_symtab) {
02086 Print_symtab (TFile, GLOBAL_SYMTAB);
02087 Print_symtab (TFile, CURRENT_SYMTAB);
02088 }
02089 }
02090 }