print-tree.c (107604) | print-tree.c (117404) |
---|---|
1/* Prints out tree in human readable form - GNU C-compiler 2 Copyright (C) 1990, 1991, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 3 2001, 2002 Free Software Foundation, Inc. 4 5This file is part of GCC. 6 7GCC is free software; you can redistribute it and/or modify it under 8the terms of the GNU General Public License as published by the Free --- 9 unchanged lines hidden (view full) --- 18along with GCC; see the file COPYING. If not, write to the Free 19Software Foundation, 59 Temple Place - Suite 330, Boston, MA 2002111-1307, USA. */ 21 22 23#include "config.h" 24#include "system.h" 25#include "tree.h" | 1/* Prints out tree in human readable form - GNU C-compiler 2 Copyright (C) 1990, 1991, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 3 2001, 2002 Free Software Foundation, Inc. 4 5This file is part of GCC. 6 7GCC is free software; you can redistribute it and/or modify it under 8the terms of the GNU General Public License as published by the Free --- 9 unchanged lines hidden (view full) --- 18along with GCC; see the file COPYING. If not, write to the Free 19Software Foundation, 59 Temple Place - Suite 330, Boston, MA 2002111-1307, USA. */ 21 22 23#include "config.h" 24#include "system.h" 25#include "tree.h" |
26#include "real.h" |
|
26#include "ggc.h" 27#include "langhooks.h" 28 29/* Define the hash table of nodes already seen. 30 Such nodes are not repeated; brief cross-references are used. */ 31 32#define HASH_SIZE 37 33 --- 8 unchanged lines hidden (view full) --- 42/* Print the node NODE on standard error, for debugging. 43 Most nodes referred to by this one are printed recursively 44 down to a depth of six. */ 45 46void 47debug_tree (node) 48 tree node; 49{ | 27#include "ggc.h" 28#include "langhooks.h" 29 30/* Define the hash table of nodes already seen. 31 Such nodes are not repeated; brief cross-references are used. */ 32 33#define HASH_SIZE 37 34 --- 8 unchanged lines hidden (view full) --- 43/* Print the node NODE on standard error, for debugging. 44 Most nodes referred to by this one are printed recursively 45 down to a depth of six. */ 46 47void 48debug_tree (node) 49 tree node; 50{ |
50 table = (struct bucket **) permalloc (HASH_SIZE * sizeof (struct bucket *)); 51 memset ((char *) table, 0, HASH_SIZE * sizeof (struct bucket *)); | 51 table = (struct bucket **) xcalloc (HASH_SIZE, sizeof (struct bucket *)); |
52 print_node (stderr, "", node, 0); 53 table = 0; 54 fprintf (stderr, "\n"); 55} 56 57/* Print a node in brief fashion, with just the code, address and name. */ 58 59void --- 59 unchanged lines hidden (view full) --- 119 } 120 if (TREE_CODE (node) == REAL_CST) 121 { 122 REAL_VALUE_TYPE d; 123 124 if (TREE_OVERFLOW (node)) 125 fprintf (file, " overflow"); 126 | 52 print_node (stderr, "", node, 0); 53 table = 0; 54 fprintf (stderr, "\n"); 55} 56 57/* Print a node in brief fashion, with just the code, address and name. */ 58 59void --- 59 unchanged lines hidden (view full) --- 119 } 120 if (TREE_CODE (node) == REAL_CST) 121 { 122 REAL_VALUE_TYPE d; 123 124 if (TREE_OVERFLOW (node)) 125 fprintf (file, " overflow"); 126 |
127#if !defined(REAL_IS_NOT_DOUBLE) || defined(REAL_ARITHMETIC) | |
128 d = TREE_REAL_CST (node); 129 if (REAL_VALUE_ISINF (d)) 130 fprintf (file, " Inf"); 131 else if (REAL_VALUE_ISNAN (d)) 132 fprintf (file, " Nan"); 133 else 134 { | 127 d = TREE_REAL_CST (node); 128 if (REAL_VALUE_ISINF (d)) 129 fprintf (file, " Inf"); 130 else if (REAL_VALUE_ISNAN (d)) 131 fprintf (file, " Nan"); 132 else 133 { |
135 char string[100]; 136 137 REAL_VALUE_TO_DECIMAL (d, "%e", string); | 134 char string[60]; 135 real_to_decimal (string, &d, sizeof (string), 0, 1); |
138 fprintf (file, " %s", string); 139 } | 136 fprintf (file, " %s", string); 137 } |
140#else 141 { 142 int i; 143 unsigned char *p = (unsigned char *) &TREE_REAL_CST (node); 144 fprintf (file, " 0x"); 145 for (i = 0; i < sizeof TREE_REAL_CST (node); i++) 146 fprintf (file, "%02x", *p++); 147 fprintf (file, ""); 148 } 149#endif | |
150 } 151 152 fprintf (file, ">"); 153} 154 155void 156indent_to (file, column) 157 FILE *file; --- 60 unchanged lines hidden (view full) --- 218 for (b = table[hash]; b; b = b->next) 219 if (b->node == node) 220 { 221 print_node_brief (file, prefix, node, indent); 222 return; 223 } 224 225 /* Add this node to the table. */ | 138 } 139 140 fprintf (file, ">"); 141} 142 143void 144indent_to (file, column) 145 FILE *file; --- 60 unchanged lines hidden (view full) --- 206 for (b = table[hash]; b; b = b->next) 207 if (b->node == node) 208 { 209 print_node_brief (file, prefix, node, indent); 210 return; 211 } 212 213 /* Add this node to the table. */ |
226 b = (struct bucket *) permalloc (sizeof (struct bucket)); | 214 b = (struct bucket *) xmalloc (sizeof (struct bucket)); |
227 b->node = node; 228 b->next = table[hash]; 229 table[hash] = b; 230 231 /* Indent to the specified column, since this is the long form. */ 232 indent_to (file, indent); 233 234 /* Print the slot this node is in, and its code, and address. */ --- 100 unchanged lines hidden (view full) --- 335 && TREE_CODE (node) != LABEL_DECL) 336 fputs (" regdecl", file); 337 if (DECL_NONLOCAL (node)) 338 fputs (" nonlocal", file); 339 340 if (TREE_CODE (node) == TYPE_DECL && TYPE_DECL_SUPPRESS_DEBUG (node)) 341 fputs (" suppress-debug", file); 342 | 215 b->node = node; 216 b->next = table[hash]; 217 table[hash] = b; 218 219 /* Indent to the specified column, since this is the long form. */ 220 indent_to (file, indent); 221 222 /* Print the slot this node is in, and its code, and address. */ --- 100 unchanged lines hidden (view full) --- 323 && TREE_CODE (node) != LABEL_DECL) 324 fputs (" regdecl", file); 325 if (DECL_NONLOCAL (node)) 326 fputs (" nonlocal", file); 327 328 if (TREE_CODE (node) == TYPE_DECL && TYPE_DECL_SUPPRESS_DEBUG (node)) 329 fputs (" suppress-debug", file); 330 |
343 if (TREE_CODE (node) == FUNCTION_DECL && DECL_INLINE (node)) | 331 if (TREE_CODE (node) == FUNCTION_DECL && DID_INLINE_FUNC (node)) 332 fputs (" autoinline", file); 333 else if (TREE_CODE (node) == FUNCTION_DECL && DECL_INLINE (node)) |
344 fputs (" inline", file); 345 if (TREE_CODE (node) == FUNCTION_DECL && DECL_BUILT_IN (node)) 346 fputs (" built-in", file); 347 if (TREE_CODE (node) == FUNCTION_DECL && DECL_BUILT_IN_NONANSI (node)) 348 fputs (" built-in-nonansi", file); 349 if (TREE_CODE (node) == FUNCTION_DECL && DECL_NO_STATIC_CHAIN (node)) 350 fputs (" no-static-chain", file); 351 --- 6 unchanged lines hidden (view full) --- 358 359 if (TREE_CODE (node) == LABEL_DECL && DECL_TOO_LATE (node)) 360 fputs (" too-late", file); 361 if (TREE_CODE (node) == LABEL_DECL && DECL_ERROR_ISSUED (node)) 362 fputs (" error-issued", file); 363 364 if (TREE_CODE (node) == VAR_DECL && DECL_IN_TEXT_SECTION (node)) 365 fputs (" in-text-section", file); | 334 fputs (" inline", file); 335 if (TREE_CODE (node) == FUNCTION_DECL && DECL_BUILT_IN (node)) 336 fputs (" built-in", file); 337 if (TREE_CODE (node) == FUNCTION_DECL && DECL_BUILT_IN_NONANSI (node)) 338 fputs (" built-in-nonansi", file); 339 if (TREE_CODE (node) == FUNCTION_DECL && DECL_NO_STATIC_CHAIN (node)) 340 fputs (" no-static-chain", file); 341 --- 6 unchanged lines hidden (view full) --- 348 349 if (TREE_CODE (node) == LABEL_DECL && DECL_TOO_LATE (node)) 350 fputs (" too-late", file); 351 if (TREE_CODE (node) == LABEL_DECL && DECL_ERROR_ISSUED (node)) 352 fputs (" error-issued", file); 353 354 if (TREE_CODE (node) == VAR_DECL && DECL_IN_TEXT_SECTION (node)) 355 fputs (" in-text-section", file); |
356 if (TREE_CODE (node) == VAR_DECL && DECL_THREAD_LOCAL (node)) 357 fputs (" thread-local", file); |
|
366 367 if (TREE_CODE (node) == PARM_DECL && DECL_TRANSPARENT_UNION (node)) 368 fputs (" transparent-union", file); 369 370 if (DECL_VIRTUAL_P (node)) 371 fputs (" virtual", file); 372 if (DECL_DEFER_OUTPUT (node)) 373 fputs (" defer-output", file); --- 16 unchanged lines hidden (view full) --- 390 fputs (" decl_7", file); 391 392 fprintf (file, " %s", GET_MODE_NAME (mode)); 393 fprintf (file, " file %s line %d", 394 DECL_SOURCE_FILE (node), DECL_SOURCE_LINE (node)); 395 396 print_node (file, "size", DECL_SIZE (node), indent + 4); 397 print_node (file, "unit size", DECL_SIZE_UNIT (node), indent + 4); | 358 359 if (TREE_CODE (node) == PARM_DECL && DECL_TRANSPARENT_UNION (node)) 360 fputs (" transparent-union", file); 361 362 if (DECL_VIRTUAL_P (node)) 363 fputs (" virtual", file); 364 if (DECL_DEFER_OUTPUT (node)) 365 fputs (" defer-output", file); --- 16 unchanged lines hidden (view full) --- 382 fputs (" decl_7", file); 383 384 fprintf (file, " %s", GET_MODE_NAME (mode)); 385 fprintf (file, " file %s line %d", 386 DECL_SOURCE_FILE (node), DECL_SOURCE_LINE (node)); 387 388 print_node (file, "size", DECL_SIZE (node), indent + 4); 389 print_node (file, "unit size", DECL_SIZE_UNIT (node), indent + 4); |
398 | 390 |
399 if (TREE_CODE (node) != FUNCTION_DECL 400 || DECL_INLINE (node) || DECL_BUILT_IN (node)) 401 indent_to (file, indent + 3); 402 403 if (TREE_CODE (node) != FUNCTION_DECL) 404 { 405 if (DECL_USER_ALIGN (node)) 406 fprintf (file, " user"); --- 14 unchanged lines hidden (view full) --- 421 fprintf (file, " built-in %s:%s", 422 built_in_class_names[(int) DECL_BUILT_IN_CLASS (node)], 423 built_in_names[(int) DECL_FUNCTION_CODE (node)]); 424 } 425 426 if (DECL_POINTER_ALIAS_SET_KNOWN_P (node)) 427 { 428 fprintf (file, " alias set "); | 391 if (TREE_CODE (node) != FUNCTION_DECL 392 || DECL_INLINE (node) || DECL_BUILT_IN (node)) 393 indent_to (file, indent + 3); 394 395 if (TREE_CODE (node) != FUNCTION_DECL) 396 { 397 if (DECL_USER_ALIGN (node)) 398 fprintf (file, " user"); --- 14 unchanged lines hidden (view full) --- 413 fprintf (file, " built-in %s:%s", 414 built_in_class_names[(int) DECL_BUILT_IN_CLASS (node)], 415 built_in_names[(int) DECL_FUNCTION_CODE (node)]); 416 } 417 418 if (DECL_POINTER_ALIAS_SET_KNOWN_P (node)) 419 { 420 fprintf (file, " alias set "); |
429 fprintf (file, HOST_WIDE_INT_PRINT_DEC, | 421 fprintf (file, HOST_WIDE_INT_PRINT_DEC, |
430 DECL_POINTER_ALIAS_SET (node)); 431 } 432 433 if (TREE_CODE (node) == FIELD_DECL) 434 { 435 print_node (file, "offset", DECL_FIELD_OFFSET (node), indent + 4); 436 print_node (file, "bit offset", DECL_FIELD_BIT_OFFSET (node), 437 indent + 4); --- 74 unchanged lines hidden (view full) --- 512 fputs (" nonaliased-component", file); 513 else if (TREE_CODE (node) == FUNCTION_TYPE 514 && TYPE_AMBIENT_BOUNDEDNESS (node)) 515 fputs (" ambient-boundedness", file); 516 517 if (TYPE_PACKED (node)) 518 fputs (" packed", file); 519 | 422 DECL_POINTER_ALIAS_SET (node)); 423 } 424 425 if (TREE_CODE (node) == FIELD_DECL) 426 { 427 print_node (file, "offset", DECL_FIELD_OFFSET (node), indent + 4); 428 print_node (file, "bit offset", DECL_FIELD_BIT_OFFSET (node), 429 indent + 4); --- 74 unchanged lines hidden (view full) --- 504 fputs (" nonaliased-component", file); 505 else if (TREE_CODE (node) == FUNCTION_TYPE 506 && TYPE_AMBIENT_BOUNDEDNESS (node)) 507 fputs (" ambient-boundedness", file); 508 509 if (TYPE_PACKED (node)) 510 fputs (" packed", file); 511 |
512 if (TYPE_RESTRICT (node)) 513 fputs (" restrict", file); 514 |
|
520 if (TYPE_LANG_FLAG_0 (node)) 521 fputs (" type_0", file); 522 if (TYPE_LANG_FLAG_1 (node)) 523 fputs (" type_1", file); 524 if (TYPE_LANG_FLAG_2 (node)) 525 fputs (" type_2", file); 526 if (TYPE_LANG_FLAG_3 (node)) 527 fputs (" type_3", file); --- 111 unchanged lines hidden (view full) --- 639 sprintf (temp, "arg %d", i); 640 print_node (file, temp, TREE_OPERAND (node, i), indent + 4); 641 } 642 } 643 644 if (TREE_CODE (node) == EXPR_WITH_FILE_LOCATION) 645 { 646 indent_to (file, indent+4); | 515 if (TYPE_LANG_FLAG_0 (node)) 516 fputs (" type_0", file); 517 if (TYPE_LANG_FLAG_1 (node)) 518 fputs (" type_1", file); 519 if (TYPE_LANG_FLAG_2 (node)) 520 fputs (" type_2", file); 521 if (TYPE_LANG_FLAG_3 (node)) 522 fputs (" type_3", file); --- 111 unchanged lines hidden (view full) --- 634 sprintf (temp, "arg %d", i); 635 print_node (file, temp, TREE_OPERAND (node, i), indent + 4); 636 } 637 } 638 639 if (TREE_CODE (node) == EXPR_WITH_FILE_LOCATION) 640 { 641 indent_to (file, indent+4); |
647 fprintf (file, "%s:%d:%d", | 642 fprintf (file, "%s:%d:%d", |
648 (EXPR_WFL_FILENAME_NODE (node ) ? 649 EXPR_WFL_FILENAME (node) : "(no file info)"), 650 EXPR_WFL_LINENO (node), EXPR_WFL_COLNO (node)); 651 } 652 print_node (file, "chain", TREE_CHAIN (node), indent + 4); 653 break; 654 655 case 'c': --- 22 unchanged lines hidden (view full) --- 678 679 case REAL_CST: 680 { 681 REAL_VALUE_TYPE d; 682 683 if (TREE_OVERFLOW (node)) 684 fprintf (file, " overflow"); 685 | 643 (EXPR_WFL_FILENAME_NODE (node ) ? 644 EXPR_WFL_FILENAME (node) : "(no file info)"), 645 EXPR_WFL_LINENO (node), EXPR_WFL_COLNO (node)); 646 } 647 print_node (file, "chain", TREE_CHAIN (node), indent + 4); 648 break; 649 650 case 'c': --- 22 unchanged lines hidden (view full) --- 673 674 case REAL_CST: 675 { 676 REAL_VALUE_TYPE d; 677 678 if (TREE_OVERFLOW (node)) 679 fprintf (file, " overflow"); 680 |
686#if !defined(REAL_IS_NOT_DOUBLE) || defined(REAL_ARITHMETIC) | |
687 d = TREE_REAL_CST (node); 688 if (REAL_VALUE_ISINF (d)) 689 fprintf (file, " Inf"); 690 else if (REAL_VALUE_ISNAN (d)) 691 fprintf (file, " Nan"); 692 else 693 { | 681 d = TREE_REAL_CST (node); 682 if (REAL_VALUE_ISINF (d)) 683 fprintf (file, " Inf"); 684 else if (REAL_VALUE_ISNAN (d)) 685 fprintf (file, " Nan"); 686 else 687 { |
694 char string[100]; 695 696 REAL_VALUE_TO_DECIMAL (d, "%e", string); | 688 char string[64]; 689 real_to_decimal (string, &d, sizeof (string), 0, 1); |
697 fprintf (file, " %s", string); 698 } | 690 fprintf (file, " %s", string); 691 } |
699#else 700 { 701 int i; 702 unsigned char *p = (unsigned char *) &TREE_REAL_CST (node); 703 fprintf (file, " 0x"); 704 for (i = 0; i < sizeof TREE_REAL_CST (node); i++) 705 fprintf (file, "%02x", *p++); 706 fprintf (file, ""); 707 } 708#endif | |
709 } 710 break; 711 712 case VECTOR_CST: 713 { 714 tree vals = TREE_VECTOR_CST_ELTS (node); 715 char buf[10]; 716 tree link; --- 9 unchanged lines hidden (view full) --- 726 break; 727 728 case COMPLEX_CST: 729 print_node (file, "real", TREE_REALPART (node), indent + 4); 730 print_node (file, "imag", TREE_IMAGPART (node), indent + 4); 731 break; 732 733 case STRING_CST: | 692 } 693 break; 694 695 case VECTOR_CST: 696 { 697 tree vals = TREE_VECTOR_CST_ELTS (node); 698 char buf[10]; 699 tree link; --- 9 unchanged lines hidden (view full) --- 709 break; 710 711 case COMPLEX_CST: 712 print_node (file, "real", TREE_REALPART (node), indent + 4); 713 print_node (file, "imag", TREE_IMAGPART (node), indent + 4); 714 break; 715 716 case STRING_CST: |
734 fprintf (file, " \"%s\"", TREE_STRING_POINTER (node)); | 717 { 718 const char *p = TREE_STRING_POINTER (node); 719 int i = TREE_STRING_LENGTH (node); 720 fputs (" \"", file); 721 while (--i >= 0) 722 { 723 char ch = *p++; 724 if (ch >= ' ' && ch < 127) 725 putc (ch, file); 726 else 727 fprintf(file, "\\%03o", ch & 0xFF); 728 } 729 fputc ('\"', file); 730 } |
735 /* Print the chain at second level. */ 736 if (indent == 4) 737 print_node (file, "chain", TREE_CHAIN (node), indent + 4); 738 else 739 print_node_brief (file, "chain", TREE_CHAIN (node), indent + 4); 740 break; 741 742 case IDENTIFIER_NODE: --- 32 unchanged lines hidden --- | 731 /* Print the chain at second level. */ 732 if (indent == 4) 733 print_node (file, "chain", TREE_CHAIN (node), indent + 4); 734 else 735 print_node_brief (file, "chain", TREE_CHAIN (node), indent + 4); 736 break; 737 738 case IDENTIFIER_NODE: --- 32 unchanged lines hidden --- |