Annotation of gcc/print-tree.c, revision 1.1.1.6

1.1       root        1: /* Prints out tree in human readable form - GNU C-compiler
1.1.1.6 ! root        2:    Copyright (C) 1990, 1991, 1993, 1994 Free Software Foundation, Inc.
1.1       root        3: 
                      4: This file is part of GNU CC.
                      5: 
                      6: GNU CC is free software; you can redistribute it and/or modify
                      7: it under the terms of the GNU General Public License as published by
                      8: the Free Software Foundation; either version 2, or (at your option)
                      9: any later version.
                     10: 
                     11: GNU CC is distributed in the hope that it will be useful,
                     12: but WITHOUT ANY WARRANTY; without even the implied warranty of
                     13: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
                     14: GNU General Public License for more details.
                     15: 
                     16: You should have received a copy of the GNU General Public License
                     17: along with GNU CC; see the file COPYING.  If not, write to
                     18: the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
                     19: 
                     20: 
                     21: #include "config.h"
                     22: #include "tree.h"
                     23: #include <stdio.h>
                     24: 
                     25: extern char **tree_code_name;
                     26: 
                     27: extern char *mode_name[];
                     28: 
                     29: void print_node ();
                     30: void indent_to ();
                     31: 
                     32: /* Define the hash table of nodes already seen.
                     33:    Such nodes are not repeated; brief cross-references are used.  */
                     34: 
                     35: #define HASH_SIZE 37
                     36: 
                     37: struct bucket
                     38: {
                     39:   tree node;
                     40:   struct bucket *next;
                     41: };
                     42: 
                     43: static struct bucket **table;
                     44: 
                     45: /* Print the node NODE on standard error, for debugging.
                     46:    Most nodes referred to by this one are printed recursively
                     47:    down to a depth of six.  */
                     48: 
                     49: void
                     50: debug_tree (node)
                     51:      tree node;
                     52: {
                     53:   char *object = (char *) oballoc (0);
1.1.1.6 ! root       54: 
1.1       root       55:   table = (struct bucket **) oballoc (HASH_SIZE * sizeof (struct bucket *));
1.1.1.6 ! root       56:   bzero ((char *) table, HASH_SIZE * sizeof (struct bucket *));
1.1       root       57:   print_node (stderr, "", node, 0);
                     58:   table = 0;
                     59:   obfree (object);
                     60:   fprintf (stderr, "\n");
                     61: }
                     62: 
                     63: /* Print a node in brief fashion, with just the code, address and name.  */
                     64: 
                     65: void
                     66: print_node_brief (file, prefix, node, indent)
                     67:      FILE *file;
                     68:      char *prefix;
                     69:      tree node;
                     70:      int indent;
                     71: {
                     72:   char class;
                     73: 
                     74:   if (node == 0)
                     75:     return;
                     76: 
                     77:   class = TREE_CODE_CLASS (TREE_CODE (node));
                     78: 
                     79:   /* Always print the slot this node is in, and its code, address and
                     80:      name if any.  */
                     81:   if (indent > 0)
                     82:     fprintf (file, " ");
1.1.1.3   root       83:   fprintf (file, "%s <%s ", prefix, tree_code_name[(int) TREE_CODE (node)]);
1.1.1.4   root       84:   fprintf (file, HOST_PTR_PRINTF, (HOST_WIDE_INT) node);
1.1       root       85: 
                     86:   if (class == 'd')
                     87:     {
                     88:       if (DECL_NAME (node))
                     89:        fprintf (file, " %s", IDENTIFIER_POINTER (DECL_NAME (node)));
                     90:     }
                     91:   else if (class == 't')
                     92:     {
                     93:       if (TYPE_NAME (node))
                     94:        {
                     95:          if (TREE_CODE (TYPE_NAME (node)) == IDENTIFIER_NODE)
                     96:            fprintf (file, " %s", IDENTIFIER_POINTER (TYPE_NAME (node)));
                     97:          else if (TREE_CODE (TYPE_NAME (node)) == TYPE_DECL
                     98:                   && DECL_NAME (TYPE_NAME (node)))
                     99:            fprintf (file, " %s",
                    100:                     IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (node))));
                    101:        }
                    102:     }
                    103:   if (TREE_CODE (node) == IDENTIFIER_NODE)
                    104:     fprintf (file, " %s", IDENTIFIER_POINTER (node));
                    105:   /* We might as well always print the value of an integer.  */
                    106:   if (TREE_CODE (node) == INTEGER_CST)
                    107:     {
1.1.1.6 ! root      108:       if (TREE_CONSTANT_OVERFLOW (node))
        !           109:        fprintf (file, " overflow");
        !           110: 
1.1       root      111:       if (TREE_INT_CST_HIGH (node) == 0)
1.1.1.6 ! root      112:        fprintf (file,
        !           113: #if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT
        !           114:                 " %1u",
        !           115: #else
        !           116:                 " %1lu",
        !           117: #endif
        !           118:                 TREE_INT_CST_LOW (node));
1.1       root      119:       else if (TREE_INT_CST_HIGH (node) == -1
                    120:               && TREE_INT_CST_LOW (node) != 0)
1.1.1.6 ! root      121:        fprintf (file,
        !           122: #if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT
        !           123:                 " -%1u",
        !           124: #else
        !           125:                 " -%1lu",
        !           126: #endif
        !           127:                 -TREE_INT_CST_LOW (node));
1.1       root      128:       else
1.1.1.3   root      129:        fprintf (file,
                    130: #if HOST_BITS_PER_WIDE_INT == 64
                    131: #if HOST_BITS_PER_WIDE_INT != HOST_BITS_PER_INT
                    132:                 " 0x%lx%016lx",
                    133: #else
                    134:                 " 0x%x%016x",
                    135: #endif
                    136: #else
                    137: #if HOST_BITS_PER_WIDE_INT != HOST_BITS_PER_INT
                    138:                 " 0x%lx%08lx",
                    139: #else
                    140:                 " 0x%x%08x",
                    141: #endif
                    142: #endif
                    143:                 TREE_INT_CST_HIGH (node), TREE_INT_CST_LOW (node));
1.1       root      144:     }
                    145:   if (TREE_CODE (node) == REAL_CST)
                    146:     {
1.1.1.6 ! root      147:       REAL_VALUE_TYPE d;
        !           148: 
        !           149:       if (TREE_OVERFLOW (node))
        !           150:        fprintf (file, " overflow");
        !           151: 
        !           152: #if !defined(REAL_IS_NOT_DOUBLE) || defined(REAL_ARITHMETIC)
        !           153:       d = TREE_REAL_CST (node);
        !           154:       if (REAL_VALUE_ISINF (d))
        !           155:        fprintf (file, " Inf");
        !           156:       else if (REAL_VALUE_ISNAN (d))
        !           157:        fprintf (file, " Nan");
        !           158:       else
        !           159:        {
        !           160:          char string[100];
        !           161: 
        !           162:          REAL_VALUE_TO_DECIMAL (d, "%e", string);
        !           163:          fprintf (file, " %s", string);
        !           164:        }
1.1       root      165: #else
                    166:       {
                    167:        int i;
1.1.1.5   root      168:        unsigned char *p = (unsigned char *) &TREE_REAL_CST (node);
1.1       root      169:        fprintf (file, " 0x");
                    170:        for (i = 0; i < sizeof TREE_REAL_CST (node); i++)
                    171:          fprintf (file, "%02x", *p++);
                    172:        fprintf (file, "");
                    173:       }
1.1.1.6 ! root      174: #endif
1.1       root      175:     }
                    176: 
                    177:   fprintf (file, ">");
                    178: }
                    179: 
                    180: void
                    181: indent_to (file, column)
                    182:      FILE *file;
                    183:      int column;
                    184: {
                    185:   int i;
                    186: 
                    187:   /* Since this is the long way, indent to desired column.  */
                    188:   if (column > 0)
                    189:     fprintf (file, "\n");
                    190:   for (i = 0; i < column; i++)
                    191:     fprintf (file, " ");
                    192: }
                    193: 
                    194: /* Print the node NODE in full on file FILE, preceded by PREFIX,
                    195:    starting in column INDENT.  */
                    196: 
                    197: void
                    198: print_node (file, prefix, node, indent)
                    199:      FILE *file;
                    200:      char *prefix;
                    201:      tree node;
                    202:      int indent;
                    203: {
                    204:   int hash;
                    205:   struct bucket *b;
                    206:   enum machine_mode mode;
                    207:   char class;
                    208:   int len;
                    209:   int first_rtl;
                    210:   int i;
                    211: 
                    212:   if (node == 0)
                    213:     return;
                    214: 
                    215:   class = TREE_CODE_CLASS (TREE_CODE (node));
                    216: 
                    217:   /* Don't get too deep in nesting.  If the user wants to see deeper,
                    218:      it is easy to use the address of a lowest-level node
                    219:      as an argument in another call to debug_tree.  */
                    220: 
                    221:   if (indent > 24)
                    222:     {
                    223:       print_node_brief (file, prefix, node, indent);
                    224:       return;
                    225:     }
                    226: 
                    227:   if (indent > 8 && (class == 't' || class == 'd'))
                    228:     {
                    229:       print_node_brief (file, prefix, node, indent);
                    230:       return;
                    231:     }
                    232: 
                    233:   /* It is unsafe to look at any other filds of an ERROR_MARK node. */
                    234:   if (TREE_CODE (node) == ERROR_MARK)
                    235:     {
                    236:       print_node_brief (file, prefix, node, indent);
                    237:       return;
                    238:     }
                    239: 
1.1.1.3   root      240:   hash = ((unsigned HOST_WIDE_INT) node) % HASH_SIZE;
1.1       root      241: 
                    242:   /* If node is in the table, just mention its address.  */
                    243:   for (b = table[hash]; b; b = b->next)
                    244:     if (b->node == node)
                    245:       {
                    246:        print_node_brief (file, prefix, node, indent);
                    247:        return;
                    248:       }
                    249: 
                    250:   /* Add this node to the table.  */
                    251:   b = (struct bucket *) oballoc (sizeof (struct bucket));
                    252:   b->node = node;
                    253:   b->next = table[hash];
                    254:   table[hash] = b;
                    255: 
                    256:   /* Indent to the specified column, since this is the long form.  */
                    257:   indent_to (file, indent);
                    258: 
                    259:   /* Print the slot this node is in, and its code, and address.  */
1.1.1.3   root      260:   fprintf (file, "%s <%s ", prefix, tree_code_name[(int) TREE_CODE (node)]);
1.1.1.4   root      261:   fprintf (file, HOST_PTR_PRINTF, (HOST_WIDE_INT) node);
1.1       root      262: 
                    263:   /* Print the name, if any.  */
                    264:   if (class == 'd')
                    265:     {
                    266:       if (DECL_NAME (node))
                    267:        fprintf (file, " %s", IDENTIFIER_POINTER (DECL_NAME (node)));
                    268:     }
                    269:   else if (class == 't')
                    270:     {
                    271:       if (TYPE_NAME (node))
                    272:        {
                    273:          if (TREE_CODE (TYPE_NAME (node)) == IDENTIFIER_NODE)
                    274:            fprintf (file, " %s", IDENTIFIER_POINTER (TYPE_NAME (node)));
                    275:          else if (TREE_CODE (TYPE_NAME (node)) == TYPE_DECL
                    276:                   && DECL_NAME (TYPE_NAME (node)))
                    277:            fprintf (file, " %s",
                    278:                     IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (node))));
                    279:        }
                    280:     }
                    281:   if (TREE_CODE (node) == IDENTIFIER_NODE)
                    282:     fprintf (file, " %s", IDENTIFIER_POINTER (node));
                    283: 
                    284:   if (TREE_CODE (node) == INTEGER_CST)
                    285:     {
                    286:       if (indent <= 4)
                    287:        print_node_brief (file, "type", TREE_TYPE (node), indent + 4);
                    288:     }
                    289:   else
                    290:     {
                    291:       print_node (file, "type", TREE_TYPE (node), indent + 4);
                    292:       if (TREE_TYPE (node))
                    293:        indent_to (file, indent + 3);
1.1.1.5   root      294: 
                    295:       print_obstack_name ((char *) node, file, "");
                    296:       indent_to (file, indent + 3);
1.1       root      297:     }
                    298: 
                    299:   /* If a permanent object is in the wrong obstack, or the reverse, warn.  */
                    300:   if (object_permanent_p (node) != TREE_PERMANENT (node))
                    301:     {
                    302:       if (TREE_PERMANENT (node))
                    303:        fputs (" !!permanent object in non-permanent obstack!!", file);
                    304:       else
                    305:        fputs (" !!non-permanent object in permanent obstack!!", file);
                    306:       indent_to (file, indent + 3);
                    307:     }
                    308: 
                    309:   if (TREE_SIDE_EFFECTS (node))
                    310:     fputs (" side-effects", file);
                    311:   if (TREE_READONLY (node))
                    312:     fputs (" readonly", file);
                    313:   if (TREE_CONSTANT (node))
                    314:     fputs (" constant", file);
                    315:   if (TREE_ADDRESSABLE (node))
                    316:     fputs (" addressable", file);
                    317:   if (TREE_THIS_VOLATILE (node))
                    318:     fputs (" volatile", file);
                    319:   if (TREE_UNSIGNED (node))
                    320:     fputs (" unsigned", file);
                    321:   if (TREE_ASM_WRITTEN (node))
                    322:     fputs (" asm_written", file);
                    323:   if (TREE_USED (node))
                    324:     fputs (" used", file);
1.1.1.3   root      325:   if (TREE_RAISES (node))
                    326:     fputs (" raises", file);
1.1       root      327:   if (TREE_PERMANENT (node))
                    328:     fputs (" permanent", file);
                    329:   if (TREE_PUBLIC (node))
                    330:     fputs (" public", file);
                    331:   if (TREE_STATIC (node))
                    332:     fputs (" static", file);
                    333:   if (TREE_LANG_FLAG_0 (node))
                    334:     fputs (" tree_0", file);
                    335:   if (TREE_LANG_FLAG_1 (node))
                    336:     fputs (" tree_1", file);
                    337:   if (TREE_LANG_FLAG_2 (node))
                    338:     fputs (" tree_2", file);
                    339:   if (TREE_LANG_FLAG_3 (node))
                    340:     fputs (" tree_3", file);
                    341:   if (TREE_LANG_FLAG_4 (node))
                    342:     fputs (" tree_4", file);
                    343:   if (TREE_LANG_FLAG_5 (node))
                    344:     fputs (" tree_5", file);
                    345:   if (TREE_LANG_FLAG_6 (node))
                    346:     fputs (" tree_6", file);
                    347: 
                    348:   /* DECL_ nodes have additional attributes.  */
                    349: 
                    350:   switch (TREE_CODE_CLASS (TREE_CODE (node)))
                    351:     {
                    352:     case 'd':
                    353:       mode = DECL_MODE (node);
                    354: 
1.1.1.6 ! root      355:       if (DECL_IGNORED_P (node))
        !           356:        fputs (" ignored", file);
        !           357:       if (DECL_ABSTRACT (node))
        !           358:        fputs (" abstract", file);
        !           359:       if (DECL_IN_SYSTEM_HEADER (node))
        !           360:        fputs (" in_system_header", file);
        !           361:       if (DECL_COMMON (node))
        !           362:        fputs (" common", file);
1.1.1.3   root      363:       if (DECL_EXTERNAL (node))
1.1       root      364:        fputs (" external", file);
1.1.1.3   root      365:       if (DECL_REGISTER (node))
1.1       root      366:        fputs (" regdecl", file);
1.1.1.6 ! root      367:       if (DECL_PACKED (node))
        !           368:        fputs (" packed", file);
        !           369:       if (DECL_NONLOCAL (node))
        !           370:        fputs (" nonlocal", file);
1.1.1.3   root      371:       if (DECL_INLINE (node))
1.1       root      372:        fputs (" inline", file);
1.1.1.6 ! root      373: 
        !           374:       if (TREE_CODE (node) == TYPE_DECL && TYPE_DECL_SUPPRESS_DEBUG (node))
        !           375:        fputs (" supress-debug", file);
        !           376: 
        !           377:       if (TREE_CODE (node) == FUNCTION_DECL && DECL_BUILT_IN (node))
        !           378:        fputs (" built-in", file);
        !           379:       if (TREE_CODE (node) == FUNCTION_DECL && DECL_BUILT_IN_NONANSI (node))
        !           380:        fputs (" built-in-nonansi", file);
        !           381: 
        !           382:       if (TREE_CODE (node) == FIELD_DECL && DECL_BIT_FIELD (node))
1.1       root      383:        fputs (" bit-field", file);
1.1.1.6 ! root      384:       if (TREE_CODE (node) == LABEL_DECL && DECL_TOO_LATE (node))
        !           385:        fputs (" too-late", file);
        !           386:       if (TREE_CODE (node) == VAR_DECL && DECL_IN_TEXT_SECTION (node))
        !           387:        fputs (" in-text-section", file);
        !           388: 
1.1       root      389:       if (DECL_VIRTUAL_P (node))
                    390:        fputs (" virtual", file);
1.1.1.6 ! root      391:       if (DECL_DEFER_OUTPUT (node))
        !           392:        fputs (" defer-output", file);
        !           393:       if (DECL_TRANSPARENT_UNION (node))
        !           394:        fputs (" transparent-union", file);
        !           395: 
1.1       root      396:       if (DECL_LANG_FLAG_0 (node))
                    397:        fputs (" decl_0", file);
                    398:       if (DECL_LANG_FLAG_1 (node))
                    399:        fputs (" decl_1", file);
                    400:       if (DECL_LANG_FLAG_2 (node))
                    401:        fputs (" decl_2", file);
                    402:       if (DECL_LANG_FLAG_3 (node))
                    403:        fputs (" decl_3", file);
                    404:       if (DECL_LANG_FLAG_4 (node))
                    405:        fputs (" decl_4", file);
                    406:       if (DECL_LANG_FLAG_5 (node))
                    407:        fputs (" decl_5", file);
                    408:       if (DECL_LANG_FLAG_6 (node))
                    409:        fputs (" decl_6", file);
                    410:       if (DECL_LANG_FLAG_7 (node))
                    411:        fputs (" decl_7", file);
                    412: 
                    413:       fprintf (file, " %s", mode_name[(int) mode]);
                    414: 
                    415:       fprintf (file, " file %s line %d",
                    416:               DECL_SOURCE_FILE (node), DECL_SOURCE_LINE (node));
                    417: 
                    418:       print_node (file, "size", DECL_SIZE (node), indent + 4);
                    419:       indent_to (file, indent + 3);
1.1.1.2   root      420:       if (TREE_CODE (node) != FUNCTION_DECL)
                    421:        fprintf (file, " align %d", DECL_ALIGN (node));
1.1.1.3   root      422:       else if (DECL_INLINE (node))
1.1.1.2   root      423:        fprintf (file, " frame_size %d", DECL_FRAME_SIZE (node));
                    424:       else if (DECL_BUILT_IN (node))
                    425:        fprintf (file, " built-in code %d", DECL_FUNCTION_CODE (node));
1.1       root      426:       if (TREE_CODE (node) == FIELD_DECL)
                    427:        print_node (file, "bitpos", DECL_FIELD_BITPOS (node), indent + 4);
                    428:       print_node_brief (file, "context", DECL_CONTEXT (node), indent + 4);
1.1.1.3   root      429:       print_node_brief (file, "abstract_origin",
                    430:                        DECL_ABSTRACT_ORIGIN (node), indent + 4);
1.1       root      431: 
                    432:       print_node (file, "arguments", DECL_ARGUMENTS (node), indent + 4);
                    433:       print_node (file, "result", DECL_RESULT (node), indent + 4);
                    434:       print_node_brief (file, "initial", DECL_INITIAL (node), indent + 4);
                    435: 
                    436:       print_lang_decl (file, node, indent);
                    437: 
                    438:       if (DECL_RTL (node) != 0)
                    439:        {
                    440:          indent_to (file, indent + 4);
                    441:          print_rtl (file, DECL_RTL (node));
                    442:        }
                    443: 
                    444:       if (DECL_SAVED_INSNS (node) != 0)
                    445:        {
                    446:          indent_to (file, indent + 4);
                    447:          if (TREE_CODE (node) == PARM_DECL)
                    448:            {
                    449:              fprintf (file, "incoming-rtl ");
                    450:              print_rtl (file, DECL_INCOMING_RTL (node));
                    451:            }
                    452:          else if (TREE_CODE (node) == FUNCTION_DECL)
1.1.1.3   root      453:            {
                    454:              fprintf (file, "saved-insns ");
1.1.1.4   root      455:              fprintf (file, HOST_PTR_PRINTF,
                    456:                       (HOST_WIDE_INT) DECL_SAVED_INSNS (node));
1.1.1.3   root      457:            }
1.1       root      458:        }
                    459: 
                    460:       /* Print the decl chain only if decl is at second level.  */
                    461:       if (indent == 4)
                    462:        print_node (file, "chain", TREE_CHAIN (node), indent + 4);
                    463:       else
                    464:        print_node_brief (file, "chain", TREE_CHAIN (node), indent + 4);
                    465:       break;
                    466: 
                    467:     case 't':
                    468:       if (TYPE_NO_FORCE_BLK (node))
1.1.1.6 ! root      469:        fputs (" no-force-blk", file);
        !           470:       if (TYPE_STRING_FLAG (node))
        !           471:        fputs (" string-flag", file);
        !           472:       if (TYPE_NEEDS_CONSTRUCTING (node))
        !           473:        fputs (" needs-constructing", file);
        !           474:       if (TYPE_TRANSPARENT_UNION (node))
        !           475:        fputs (" transparent-union", file);
        !           476: 
1.1       root      477:       if (TYPE_LANG_FLAG_0 (node))
                    478:        fputs (" type_0", file);
                    479:       if (TYPE_LANG_FLAG_1 (node))
                    480:        fputs (" type_1", file);
                    481:       if (TYPE_LANG_FLAG_2 (node))
                    482:        fputs (" type_2", file);
                    483:       if (TYPE_LANG_FLAG_3 (node))
                    484:        fputs (" type_3", file);
                    485:       if (TYPE_LANG_FLAG_4 (node))
                    486:        fputs (" type_4", file);
                    487:       if (TYPE_LANG_FLAG_5 (node))
                    488:        fputs (" type_5", file);
                    489:       if (TYPE_LANG_FLAG_6 (node))
                    490:        fputs (" type_6", file);
                    491: 
                    492:       mode = TYPE_MODE (node);
                    493:       fprintf (file, " %s", mode_name[(int) mode]);
                    494: 
                    495:       print_node (file, "size", TYPE_SIZE (node), indent + 4);
                    496:       indent_to (file, indent + 3);
                    497: 
                    498:       fprintf (file, " align %d", TYPE_ALIGN (node));
                    499:       fprintf (file, " symtab %d", TYPE_SYMTAB_ADDRESS (node));
                    500: 
1.1.1.6 ! root      501:       print_node (file, "attributes", TYPE_ATTRIBUTES (node), indent + 4);
        !           502: 
1.1       root      503:       if (TREE_CODE (node) == ARRAY_TYPE || TREE_CODE (node) == SET_TYPE)
                    504:        print_node (file, "domain", TYPE_DOMAIN (node), indent + 4);
1.1.1.3   root      505:       else if (TREE_CODE (node) == INTEGER_TYPE
                    506:               || TREE_CODE (node) == BOOLEAN_TYPE
                    507:               || TREE_CODE (node) == CHAR_TYPE)
1.1       root      508:        {
                    509:          fprintf (file, " precision %d", TYPE_PRECISION (node));
                    510:          print_node (file, "min", TYPE_MIN_VALUE (node), indent + 4);
                    511:          print_node (file, "max", TYPE_MAX_VALUE (node), indent + 4);
                    512:        }
                    513:       else if (TREE_CODE (node) == ENUMERAL_TYPE)
                    514:        {
                    515:          fprintf (file, " precision %d", TYPE_PRECISION (node));
                    516:          print_node (file, "min", TYPE_MIN_VALUE (node), indent + 4);
                    517:          print_node (file, "max", TYPE_MAX_VALUE (node), indent + 4);
                    518:          print_node (file, "values", TYPE_VALUES (node), indent + 4);
                    519:        }
                    520:       else if (TREE_CODE (node) == REAL_TYPE)
                    521:        fprintf (file, " precision %d", TYPE_PRECISION (node));
1.1.1.4   root      522:       else if (TREE_CODE (node) == RECORD_TYPE
                    523:               || TREE_CODE (node) == UNION_TYPE
                    524:               || TREE_CODE (node) == QUAL_UNION_TYPE)
1.1       root      525:        print_node (file, "fields", TYPE_FIELDS (node), indent + 4);
                    526:       else if (TREE_CODE (node) == FUNCTION_TYPE || TREE_CODE (node) == METHOD_TYPE)
                    527:        {
                    528:          if (TYPE_METHOD_BASETYPE (node))
                    529:            print_node_brief (file, "method basetype", TYPE_METHOD_BASETYPE (node), indent + 4);
                    530:          print_node (file, "arg-types", TYPE_ARG_TYPES (node), indent + 4);
                    531:        }
                    532:       if (TYPE_CONTEXT (node))
                    533:        print_node_brief (file, "context", TYPE_CONTEXT (node), indent + 4);
                    534: 
                    535:       print_lang_type (file, node, indent);
                    536: 
                    537:       if (TYPE_POINTER_TO (node) || TREE_CHAIN (node))
                    538:        indent_to (file, indent + 3);
                    539:       print_node_brief (file, "pointer_to_this", TYPE_POINTER_TO (node), indent + 4);
                    540:       print_node_brief (file, "reference_to_this", TYPE_REFERENCE_TO (node), indent + 4);
                    541:       print_node_brief (file, "chain", TREE_CHAIN (node), indent + 4);
                    542:       break;
                    543: 
1.1.1.3   root      544:     case 'b':
                    545:       print_node (file, "vars", BLOCK_VARS (node), indent + 4);
                    546:       print_node (file, "tags", BLOCK_TYPE_TAGS (node), indent + 4);
                    547:       print_node (file, "supercontext", BLOCK_SUPERCONTEXT (node), indent + 4);
                    548:       print_node (file, "subblocks", BLOCK_SUBBLOCKS (node), indent + 4);
                    549:       print_node (file, "chain", BLOCK_CHAIN (node), indent + 4);
                    550:       print_node (file, "abstract_origin",
                    551:                  BLOCK_ABSTRACT_ORIGIN (node), indent + 4);
                    552:       return;
                    553: 
1.1       root      554:     case 'e':
                    555:     case '<':
                    556:     case '1':
                    557:     case '2':
                    558:     case 'r':
                    559:     case 's':
                    560:       switch (TREE_CODE (node))
                    561:        {
                    562:        case BIND_EXPR:
                    563:          print_node (file, "vars", TREE_OPERAND (node, 0), indent + 4);
                    564:          print_node (file, "body", TREE_OPERAND (node, 1), indent + 4);
1.1.1.2   root      565:          print_node (file, "block", TREE_OPERAND (node, 2), indent + 4);
1.1       root      566:          return;
                    567:        }
                    568: 
                    569:       first_rtl = len = tree_code_length[(int) TREE_CODE (node)];
                    570:       /* These kinds of nodes contain rtx's, not trees,
                    571:         after a certain point.  Print the rtx's as rtx's.  */
                    572:       switch (TREE_CODE (node))
                    573:        {
                    574:        case SAVE_EXPR:
                    575:          first_rtl = 2;
                    576:          break;
                    577:        case CALL_EXPR:
                    578:          first_rtl = 2;
                    579:          break;
                    580:        case METHOD_CALL_EXPR:
                    581:          first_rtl = 3;
                    582:          break;
                    583:        case WITH_CLEANUP_EXPR:
                    584:          /* Should be defined to be 2.  */
                    585:          first_rtl = 1;
                    586:          break;
                    587:        case RTL_EXPR:
                    588:          first_rtl = 0;
                    589:        }
                    590:       for (i = 0; i < len; i++)
                    591:        {
                    592:          if (i >= first_rtl)
                    593:            {
                    594:              indent_to (file, indent + 4);
                    595:              fprintf (file, "rtl %d ", i);
                    596:              if (TREE_OPERAND (node, i))
1.1.1.4   root      597:                print_rtl (file, (struct rtx_def *) TREE_OPERAND (node, i));
1.1       root      598:              else
                    599:                fprintf (file, "(nil)");
                    600:              fprintf (file, "\n");
                    601:            }
                    602:          else
                    603:            {
                    604:              char temp[10];
                    605: 
                    606:              sprintf (temp, "arg %d", i);
                    607:              print_node (file, temp, TREE_OPERAND (node, i), indent + 4);
                    608:            }
                    609:        }
                    610:       break;
                    611: 
                    612:     case 'c':
                    613:     case 'x':
                    614:       switch (TREE_CODE (node))
                    615:        {
                    616:        case INTEGER_CST:
1.1.1.6 ! root      617:          if (TREE_CONSTANT_OVERFLOW (node))
        !           618:            fprintf (file, " overflow");
        !           619: 
1.1       root      620:          if (TREE_INT_CST_HIGH (node) == 0)
1.1.1.6 ! root      621:            fprintf (file,
        !           622: #if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT
        !           623:                     " %1u",
        !           624: #else
        !           625:                     " %1lu",
        !           626: #endif
        !           627:                     TREE_INT_CST_LOW (node));
1.1       root      628:          else if (TREE_INT_CST_HIGH (node) == -1
                    629:                   && TREE_INT_CST_LOW (node) != 0)
1.1.1.6 ! root      630:            fprintf (file,
        !           631: #if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT
        !           632:                     " -%1u",
        !           633: #else
        !           634:                     " -%1lu",
        !           635: #endif
        !           636:                     -TREE_INT_CST_LOW (node));
1.1       root      637:          else
1.1.1.3   root      638:            fprintf (file,
                    639: #if HOST_BITS_PER_WIDE_INT == 64
                    640: #if HOST_BITS_PER_WIDE_INT != HOST_BITS_PER_INT
                    641:                     " 0x%lx%016lx",
                    642: #else
                    643:                     " 0x%x%016x",
                    644: #endif
                    645: #else
                    646: #if HOST_BITS_PER_WIDE_INT != HOST_BITS_PER_INT
                    647:                     " 0x%lx%08lx",
                    648: #else
                    649:                     " 0x%x%08x",
                    650: #endif
                    651: #endif
                    652:                     TREE_INT_CST_HIGH (node), TREE_INT_CST_LOW (node));
1.1       root      653:          break;
                    654: 
                    655:        case REAL_CST:
                    656:          {
1.1.1.6 ! root      657:            REAL_VALUE_TYPE d;
        !           658: 
        !           659:            if (TREE_OVERFLOW (node))
        !           660:              fprintf (file, " overflow");
        !           661: 
        !           662: #if !defined(REAL_IS_NOT_DOUBLE) || defined(REAL_ARITHMETIC)
        !           663:            d = TREE_REAL_CST (node);
        !           664:            if (REAL_VALUE_ISINF (d))
        !           665:              fprintf (file, " Inf");
        !           666:            else if (REAL_VALUE_ISNAN (d))
        !           667:              fprintf (file, " Nan");
        !           668:            else
        !           669:              {
        !           670:                char string[100];
        !           671: 
        !           672:                REAL_VALUE_TO_DECIMAL (d, "%e", string);
        !           673:                fprintf (file, " %s", string);
        !           674:              }
        !           675: #else
        !           676:            {
        !           677:              int i;
        !           678:              unsigned char *p = (unsigned char *) &TREE_REAL_CST (node);
        !           679:              fprintf (file, " 0x");
        !           680:              for (i = 0; i < sizeof TREE_REAL_CST (node); i++)
        !           681:                fprintf (file, "%02x", *p++);
        !           682:              fprintf (file, "");
        !           683:            }
        !           684: #endif
1.1       root      685:          }
                    686:          break;
                    687: 
                    688:        case COMPLEX_CST:
                    689:          print_node (file, "real", TREE_REALPART (node), indent + 4);
                    690:          print_node (file, "imag", TREE_IMAGPART (node), indent + 4);
                    691:          break;
                    692: 
                    693:        case STRING_CST:
                    694:          fprintf (file, " \"%s\"", TREE_STRING_POINTER (node));
1.1.1.4   root      695:          /* Print the chain at second level.  */
                    696:          if (indent == 4)
                    697:            print_node (file, "chain", TREE_CHAIN (node), indent + 4);
                    698:          else
                    699:            print_node_brief (file, "chain", TREE_CHAIN (node), indent + 4);
1.1       root      700:          break;
                    701: 
                    702:        case IDENTIFIER_NODE:
                    703:          print_lang_identifier (file, node, indent);
                    704:          break;
                    705: 
                    706:        case TREE_LIST:
                    707:          print_node (file, "purpose", TREE_PURPOSE (node), indent + 4);
                    708:          print_node (file, "value", TREE_VALUE (node), indent + 4);
                    709:          print_node (file, "chain", TREE_CHAIN (node), indent + 4);
                    710:          break;
                    711: 
                    712:        case TREE_VEC:
                    713:          len = TREE_VEC_LENGTH (node);
                    714:          for (i = 0; i < len; i++)
1.1.1.3   root      715:            if (TREE_VEC_ELT (node, i))
                    716:              {
                    717:                char temp[10];
                    718:                sprintf (temp, "elt %d", i);
                    719:                indent_to (file, indent + 4);
                    720:                print_node_brief (file, temp, TREE_VEC_ELT (node, i), 0);
                    721:              }
1.1       root      722:          break;
                    723: 
                    724:        case OP_IDENTIFIER:
                    725:          print_node (file, "op1", TREE_PURPOSE (node), indent + 4);
                    726:          print_node (file, "op2", TREE_VALUE (node), indent + 4);
                    727:        }
                    728: 
                    729:       break;
                    730:     }
1.1.1.3   root      731: 
                    732:   fprintf (file, ">");
1.1       root      733: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.