LCOV - code coverage report
Current view: top level - gcc - tree-dump.cc (source / functions) Coverage Total Hit
Test: gcc.info Lines: 81.7 % 438 358
Test Date: 2026-11-14 16:39:50 Functions: 73.3 % 15 11
Legend: Lines:     hit not hit

            Line data    Source code
       1              : /* Tree-dumping functionality for intermediate representation.
       2              :    Copyright (C) 1999-2026 Free Software Foundation, Inc.
       3              :    Written by Mark Mitchell <mark@codesourcery.com>
       4              : 
       5              : This file is part of GCC.
       6              : 
       7              : GCC is free software; you can redistribute it and/or modify it under
       8              : the terms of the GNU General Public License as published by the Free
       9              : Software Foundation; either version 3, or (at your option) any later
      10              : version.
      11              : 
      12              : GCC is distributed in the hope that it will be useful, but WITHOUT ANY
      13              : WARRANTY; without even the implied warranty of MERCHANTABILITY or
      14              : FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
      15              : for more details.
      16              : 
      17              : You should have received a copy of the GNU General Public License
      18              : along with GCC; see the file COPYING3.  If not see
      19              : <http://www.gnu.org/licenses/>.  */
      20              : 
      21              : #include "config.h"
      22              : #include "system.h"
      23              : #include "coretypes.h"
      24              : #include "tree.h"
      25              : #include "tree-pretty-print.h"
      26              : #include "tree-dump.h"
      27              : #include "langhooks.h"
      28              : #include "tree-iterator.h"
      29              : 
      30              : static unsigned int queue (dump_info_p, const_tree, int);
      31              : static void dump_index (dump_info_p, unsigned int);
      32              : static void dequeue_and_dump (dump_info_p);
      33              : static void dump_new_line (dump_info_p);
      34              : static void dump_maybe_newline (dump_info_p);
      35              : 
      36              : /* Add T to the end of the queue of nodes to dump.  Returns the index
      37              :    assigned to T.  */
      38              : 
      39              : static unsigned int
      40        44107 : queue (dump_info_p di, const_tree t, int flags)
      41              : {
      42        44107 :   dump_queue_p dq;
      43        44107 :   dump_node_info_p dni;
      44        44107 :   unsigned int index;
      45              : 
      46              :   /* Assign the next available index to T.  */
      47        44107 :   index = ++di->index;
      48              : 
      49              :   /* Obtain a new queue node.  */
      50        44107 :   if (di->free_list)
      51              :     {
      52        43826 :       dq = di->free_list;
      53        43826 :       di->free_list = dq->next;
      54              :     }
      55              :   else
      56          281 :     dq = XNEW (struct dump_queue);
      57              : 
      58              :   /* Create a new entry in the splay-tree.  */
      59        44107 :   dni = XNEW (struct dump_node_info);
      60        44107 :   dni->index = index;
      61        44107 :   dni->binfo_p = ((flags & DUMP_BINFO) != 0);
      62        44107 :   dq->node = splay_tree_insert (di->nodes, (splay_tree_key) t,
      63              :                                 (splay_tree_value) dni);
      64              : 
      65              :   /* Add it to the end of the queue.  */
      66        44107 :   dq->next = 0;
      67        44107 :   if (!di->queue_end)
      68         6271 :     di->queue = dq;
      69              :   else
      70        37836 :     di->queue_end->next = dq;
      71        44107 :   di->queue_end = dq;
      72              : 
      73              :   /* Return the index.  */
      74        44107 :   return index;
      75              : }
      76              : 
      77              : static void
      78       135986 : dump_index (dump_info_p di, unsigned int index)
      79              : {
      80       135986 :   fprintf (di->stream, "@%-6u ", index);
      81       135986 :   di->column += 8;
      82       135986 : }
      83              : 
      84              : /* If T has not already been output, queue it for subsequent output.
      85              :    FIELD is a string to print before printing the index.  Then, the
      86              :    index of T is printed.  */
      87              : 
      88              : void
      89       116720 : queue_and_dump_index (dump_info_p di, const char *field, const_tree t, int flags)
      90              : {
      91       116720 :   unsigned int index;
      92       116720 :   splay_tree_node n;
      93              : 
      94              :   /* If there's no node, just return.  This makes for fewer checks in
      95              :      our callers.  */
      96       116720 :   if (!t)
      97              :     return;
      98              : 
      99              :   /* See if we've already queued or dumped this node.  */
     100        91879 :   n = splay_tree_lookup (di->nodes, (splay_tree_key) t);
     101        91879 :   if (n)
     102        47781 :     index = ((dump_node_info_p) n->value)->index;
     103              :   else
     104              :     /* If we haven't, add it to the queue.  */
     105        44098 :     index = queue (di, t, flags);
     106              : 
     107              :   /* Print the index of the node.  */
     108        91879 :   dump_maybe_newline (di);
     109        91879 :   fprintf (di->stream, "%-4s: ", field);
     110        91879 :   di->column += 6;
     111        91879 :   dump_index (di, index);
     112              : }
     113              : 
     114              : /* Dump the type of T.  */
     115              : 
     116              : void
     117        16102 : queue_and_dump_type (dump_info_p di, const_tree t)
     118              : {
     119        16102 :   queue_and_dump_index (di, "type", TREE_TYPE (t), DUMP_NONE);
     120        16102 : }
     121              : 
     122              : /* Dump column control */
     123              : #define SOL_COLUMN 25           /* Start of line column.  */
     124              : #define EOL_COLUMN 55           /* End of line column.  */
     125              : #define COLUMN_ALIGNMENT 15     /* Alignment.  */
     126              : 
     127              : /* Insert a new line in the dump output, and indent to an appropriate
     128              :    place to start printing more fields.  */
     129              : 
     130              : static void
     131        56291 : dump_new_line (dump_info_p di)
     132              : {
     133        56291 :   fprintf (di->stream, "\n%*s", SOL_COLUMN, "");
     134        56291 :   di->column = SOL_COLUMN;
     135        56291 : }
     136              : 
     137              : /* If necessary, insert a new line.  */
     138              : 
     139              : static void
     140       206962 : dump_maybe_newline (dump_info_p di)
     141              : {
     142       206962 :   int extra;
     143              : 
     144              :   /* See if we need a new line.  */
     145       206962 :   if (di->column > EOL_COLUMN)
     146        56291 :     dump_new_line (di);
     147              :   /* See if we need any padding.  */
     148       150671 :   else if ((extra = (di->column - SOL_COLUMN) % COLUMN_ALIGNMENT) != 0)
     149              :     {
     150       104360 :       fprintf (di->stream, "%*s", COLUMN_ALIGNMENT - extra, "");
     151       104360 :       di->column += COLUMN_ALIGNMENT - extra;
     152              :     }
     153       206962 : }
     154              : 
     155              : /* Dump pointer PTR using FIELD to identify it.  */
     156              : 
     157              : void
     158            0 : dump_pointer (dump_info_p di, const char *field, void *ptr)
     159              : {
     160            0 :   dump_maybe_newline (di);
     161            0 :   fprintf (di->stream, "%-4s: %-8" HOST_WIDE_INT_PRINT "x ", field,
     162              :            (unsigned HOST_WIDE_INT) (uintptr_t) ptr);
     163            0 :   di->column += 15;
     164            0 : }
     165              : 
     166              : /* Dump integer I using FIELD to identify it.  */
     167              : 
     168              : void
     169        23010 : dump_int (dump_info_p di, const char *field, int i)
     170              : {
     171        23010 :   dump_maybe_newline (di);
     172        23010 :   fprintf (di->stream, "%-4s: %-7d ", field, i);
     173        23010 :   di->column += 14;
     174        23010 : }
     175              : 
     176              : /* Dump the floating point value R, using FIELD to identify it.  */
     177              : 
     178              : static void
     179            0 : dump_real (dump_info_p di, const char *field, const REAL_VALUE_TYPE *r)
     180              : {
     181            0 :   char buf[32];
     182            0 :   real_to_decimal (buf, r, sizeof (buf), 0, true);
     183            0 :   dump_maybe_newline (di);
     184            0 :   fprintf (di->stream, "%-4s: %s ", field, buf);
     185            0 :   di->column += strlen (buf) + 7;
     186            0 : }
     187              : 
     188              : /* Dump the fixed-point value F, using FIELD to identify it.  */
     189              : 
     190              : static void
     191            0 : dump_fixed (dump_info_p di, const char *field, const FIXED_VALUE_TYPE *f)
     192              : {
     193            0 :   char buf[32];
     194            0 :   fixed_to_decimal (buf, f, sizeof (buf));
     195            0 :   dump_maybe_newline (di);
     196            0 :   fprintf (di->stream, "%-4s: %s ", field, buf);
     197            0 :   di->column += strlen (buf) + 7;
     198            0 : }
     199              : 
     200              : 
     201              : /* Dump the string S.  */
     202              : 
     203              : void
     204            0 : dump_string (dump_info_p di, const char *string)
     205              : {
     206            0 :   dump_maybe_newline (di);
     207            0 :   fprintf (di->stream, "%-13s ", string);
     208            0 :   if (strlen (string) > 13)
     209            0 :     di->column += strlen (string) + 1;
     210              :   else
     211            0 :     di->column += 14;
     212            0 : }
     213              : 
     214              : /* Dump the string field S.  */
     215              : 
     216              : void
     217        77034 : dump_string_field (dump_info_p di, const char *field, const char *string)
     218              : {
     219        77034 :   dump_maybe_newline (di);
     220        77034 :   fprintf (di->stream, "%-4s: %-7s ", field, string);
     221        77034 :   if (strlen (string) > 7)
     222        44349 :     di->column += 6 + strlen (string) + 1;
     223              :   else
     224        32685 :     di->column += 14;
     225        77034 : }
     226              : 
     227              : /* Dump the next node in the queue.  */
     228              : 
     229              : static void
     230        44107 : dequeue_and_dump (dump_info_p di)
     231              : {
     232        44107 :   dump_queue_p dq;
     233        44107 :   splay_tree_node stn;
     234        44107 :   dump_node_info_p dni;
     235        44107 :   tree t;
     236        44107 :   unsigned int index;
     237        44107 :   enum tree_code code;
     238        44107 :   enum tree_code_class code_class;
     239        44107 :   const char* code_name;
     240              : 
     241              :   /* Get the next node from the queue.  */
     242        44107 :   dq = di->queue;
     243        44107 :   stn = dq->node;
     244        44107 :   t = (tree) stn->key;
     245        44107 :   dni = (dump_node_info_p) stn->value;
     246        44107 :   index = dni->index;
     247              : 
     248              :   /* Remove the node from the queue, and put it on the free list.  */
     249        44107 :   di->queue = dq->next;
     250        44107 :   if (!di->queue)
     251         6271 :     di->queue_end = 0;
     252        44107 :   dq->next = di->free_list;
     253        44107 :   di->free_list = dq;
     254              : 
     255              :   /* Print the node index.  */
     256        44107 :   dump_index (di, index);
     257              :   /* And the type of node this is.  */
     258        44107 :   if (dni->binfo_p)
     259              :     code_name = "binfo";
     260              :   else
     261        44080 :     code_name = get_tree_code_name (TREE_CODE (t));
     262        44107 :   fprintf (di->stream, "%-16s ", code_name);
     263        44107 :   di->column = 25;
     264              : 
     265              :   /* Figure out what kind of node this is.  */
     266        44107 :   code = TREE_CODE (t);
     267        44107 :   code_class = TREE_CODE_CLASS (code);
     268              : 
     269              :   /* Although BINFOs are TREE_VECs, we dump them specially so as to be
     270              :      more informative.  */
     271        44107 :   if (dni->binfo_p)
     272              :     {
     273           27 :       unsigned ix;
     274           27 :       tree base;
     275           27 :       vec<tree, va_gc> *accesses = BINFO_BASE_ACCESSES (t);
     276              : 
     277           27 :       dump_child ("type", BINFO_TYPE (t));
     278              : 
     279           27 :       if (BINFO_VIRTUAL_P (t))
     280            0 :         dump_string_field (di, "spec", "virt");
     281              : 
     282           27 :       dump_int (di, "bases", BINFO_N_BASE_BINFOS (t));
     283           57 :       for (ix = 0; BINFO_BASE_ITERATE (t, ix, base); ix++)
     284              :         {
     285            3 :           tree access = (accesses ? (*accesses)[ix] : access_public_node);
     286            3 :           const char *string = NULL;
     287              : 
     288            3 :           if (access == access_public_node)
     289              :             string = "pub";
     290            0 :           else if (access == access_protected_node)
     291              :             string = "prot";
     292            0 :           else if (access == access_private_node)
     293              :             string = "priv";
     294              :           else
     295            0 :             gcc_unreachable ();
     296              : 
     297            3 :           dump_string_field (di, "accs", string);
     298            3 :           queue_and_dump_index (di, "binf", base, DUMP_BINFO);
     299              :         }
     300              : 
     301           27 :       goto done;
     302              :     }
     303              : 
     304              :   /* We can knock off a bunch of expression nodes in exactly the same
     305              :      way.  */
     306        44080 :   if (IS_EXPR_CODE_CLASS (code_class))
     307              :     {
     308              :       /* If we're dumping children, dump them now.  */
     309          527 :       queue_and_dump_type (di, t);
     310              : 
     311          527 :       switch (code_class)
     312              :         {
     313          110 :         case tcc_unary:
     314          110 :           dump_child ("op 0", TREE_OPERAND (t, 0));
     315          110 :           break;
     316              : 
     317           48 :         case tcc_binary:
     318           48 :         case tcc_comparison:
     319           48 :           dump_child ("op 0", TREE_OPERAND (t, 0));
     320           48 :           dump_child ("op 1", TREE_OPERAND (t, 1));
     321           48 :           break;
     322              : 
     323              :         case tcc_expression:
     324              :         case tcc_reference:
     325              :         case tcc_statement:
     326              :         case tcc_vl_exp:
     327              :           /* These nodes are handled explicitly below.  */
     328              :           break;
     329              : 
     330              :         default:
     331              :           gcc_unreachable ();
     332              :         }
     333              :     }
     334        43553 :   else if (DECL_P (t))
     335              :     {
     336        15205 :       expanded_location xloc;
     337              :       /* All declarations have names.  */
     338        15205 :       if (DECL_NAME (t))
     339        15080 :         dump_child ("name", DECL_NAME (t));
     340        15205 :       if (HAS_DECL_ASSEMBLER_NAME_P (t)
     341        15019 :           && DECL_ASSEMBLER_NAME_SET_P (t)
     342        21455 :           && DECL_ASSEMBLER_NAME (t) != DECL_NAME (t))
     343         6038 :         dump_child ("mngl", DECL_ASSEMBLER_NAME (t));
     344        15205 :       if (DECL_ABSTRACT_ORIGIN (t))
     345           53 :         dump_child ("orig", DECL_ABSTRACT_ORIGIN (t));
     346              :       /* And types.  */
     347        15205 :       queue_and_dump_type (di, t);
     348        15205 :       dump_child ("scpe", DECL_CONTEXT (t));
     349              :       /* And a source position.  */
     350        15205 :       xloc = expand_location (DECL_SOURCE_LOCATION (t));
     351        15205 :       if (xloc.file)
     352              :         {
     353        15039 :           const char *filename = lbasename (xloc.file);
     354              : 
     355        15039 :           dump_maybe_newline (di);
     356        15039 :           fprintf (di->stream, "srcp: %s:%-6d ", filename,
     357              :                    xloc.line);
     358        15039 :           di->column += 6 + strlen (filename) + 8;
     359              :         }
     360              :       /* And any declaration can be compiler-generated.  */
     361        15205 :       if (CODE_CONTAINS_STRUCT (TREE_CODE (t), TS_DECL_COMMON)
     362        15205 :           && DECL_ARTIFICIAL (t))
     363        14870 :         dump_string_field (di, "note", "artificial");
     364        15205 :       if (DECL_CHAIN (t) && !dump_flag (di, TDF_SLIM, NULL))
     365        14777 :         dump_child ("chain", DECL_CHAIN (t));
     366              :     }
     367        28348 :   else if (code_class == tcc_type)
     368              :     {
     369              :       /* All types have qualifiers.  */
     370         4257 :       cv_qualifier quals;
     371         4257 :       addr_space_t as;
     372         4257 :       std::tie (quals, as) = lang_hooks.tree_dump.type_quals (t).split ();
     373              : 
     374         4257 :       if (quals != TYPE_UNQUALIFIED)
     375              :         {
     376          208 :           fprintf (di->stream, "qual: %c%c%c     ",
     377          104 :                    (quals & TYPE_QUAL_CONST) ? 'c' : ' ',
     378          104 :                    (quals & TYPE_QUAL_VOLATILE) ? 'v' : ' ',
     379          104 :                    (quals & TYPE_QUAL_RESTRICT) ? 'r' : ' ');
     380          104 :           di->column += 14;
     381              :         }
     382              : 
     383         4257 :       if (!ADDR_SPACE_GENERIC_P (as))
     384            0 :         dump_int (di, "addr-space", as);
     385              : 
     386              :       /* All types have associated declarations.  */
     387         4257 :       dump_child ("name", TYPE_NAME (t));
     388              : 
     389              :       /* All types have a main variant.  */
     390         4257 :       if (TYPE_MAIN_VARIANT (t) != t)
     391          205 :         dump_child ("unql", TYPE_MAIN_VARIANT (t));
     392              : 
     393              :       /* And sizes.  */
     394         4257 :       dump_child ("size", TYPE_SIZE (t));
     395              : 
     396              :       /* All types have alignments.  */
     397         4257 :       dump_int (di, "algn", TYPE_ALIGN (t));
     398              :     }
     399        24091 :   else if (code_class == tcc_constant)
     400              :     /* All constants can have types.  */
     401          370 :     queue_and_dump_type (di, t);
     402              : 
     403              :   /* Give the language-specific code a chance to print something.  If
     404              :      it's completely taken care of things, don't bother printing
     405              :      anything more ourselves.  */
     406        44080 :   if (lang_hooks.tree_dump.dump_tree (di, t))
     407           27 :     goto done;
     408              : 
     409              :   /* Now handle the various kinds of nodes.  */
     410        44053 :   switch (code)
     411              :     {
     412        18037 :       int i;
     413              : 
     414        18037 :     case IDENTIFIER_NODE:
     415        18037 :       dump_string_field (di, "strg", IDENTIFIER_POINTER (t));
     416        18037 :       dump_int (di, "lngt", IDENTIFIER_LENGTH (t));
     417        18037 :       break;
     418              : 
     419         5610 :     case TREE_LIST:
     420         5610 :       dump_child ("purp", TREE_PURPOSE (t));
     421         5610 :       dump_child ("valu", TREE_VALUE (t));
     422         5610 :       dump_child ("chan", TREE_CHAIN (t));
     423         5610 :       break;
     424              : 
     425           23 :     case STATEMENT_LIST:
     426           23 :       {
     427           23 :         tree_stmt_iterator it;
     428          116 :         for (i = 0, it = tsi_start (t); !tsi_end_p (it); tsi_next (&it), i++)
     429              :           {
     430           93 :             char buffer[32];
     431           93 :             sprintf (buffer, "%u", i);
     432           93 :             dump_child (buffer, tsi_stmt (it));
     433              :           }
     434              :       }
     435           23 :       break;
     436              : 
     437            0 :     case TREE_VEC:
     438            0 :       dump_int (di, "lngt", TREE_VEC_LENGTH (t));
     439            0 :       for (i = 0; i < TREE_VEC_LENGTH (t); ++i)
     440              :         {
     441            0 :           char buffer[32];
     442            0 :           sprintf (buffer, "%u", i);
     443            0 :           dump_child (buffer, TREE_VEC_ELT (t, i));
     444              :         }
     445              :       break;
     446              : 
     447          152 :     case INTEGER_TYPE:
     448          152 :     case ENUMERAL_TYPE:
     449          152 :       dump_int (di, "prec", TYPE_PRECISION (t));
     450          152 :       dump_string_field (di, "sign",
     451          152 :                          TYPE_UNSIGNED (t) ? "unsigned" : "signed");
     452          152 :       dump_child ("min", TYPE_MIN_VALUE (t));
     453          152 :       dump_child ("max", TYPE_MAX_VALUE (t));
     454              : 
     455          152 :       if (code == ENUMERAL_TYPE)
     456            4 :         dump_child ("csts", TYPE_VALUES (t));
     457              :       break;
     458              : 
     459          102 :     case REAL_TYPE:
     460          102 :       dump_int (di, "prec", TYPE_PRECISION (t));
     461          102 :       break;
     462              : 
     463            0 :     case FIXED_POINT_TYPE:
     464            0 :       dump_int (di, "prec", TYPE_PRECISION (t));
     465            0 :       dump_string_field (di, "sign",
     466            0 :                          TYPE_UNSIGNED (t) ? "unsigned" : "signed");
     467            0 :       dump_string_field (di, "saturating",
     468            0 :                          TYPE_SATURATING (t)
     469              :                          ? "saturating" : "non-saturating");
     470            0 :       break;
     471              : 
     472          324 :     case POINTER_TYPE:
     473          324 :       dump_child ("ptd", TREE_TYPE (t));
     474          324 :       break;
     475              : 
     476           22 :     case REFERENCE_TYPE:
     477           22 :       dump_child ("refd", TREE_TYPE (t));
     478           22 :       break;
     479              : 
     480           30 :     case METHOD_TYPE:
     481           30 :       dump_child ("clas", TYPE_METHOD_BASETYPE (t));
     482              :       /* Fall through.  */
     483              : 
     484         3289 :     case FUNCTION_TYPE:
     485         3289 :       dump_child ("retn", TREE_TYPE (t));
     486         3289 :       dump_child ("prms", TYPE_ARG_TYPES (t));
     487         3289 :       break;
     488              : 
     489           60 :     case ARRAY_TYPE:
     490           60 :       dump_child ("elts", TREE_TYPE (t));
     491           60 :       dump_child ("domn", TYPE_DOMAIN (t));
     492           60 :       break;
     493              : 
     494           71 :     case RECORD_TYPE:
     495           71 :     case UNION_TYPE:
     496           71 :       if (TREE_CODE (t) == RECORD_TYPE)
     497           71 :         dump_string_field (di, "tag", "struct");
     498              :       else
     499            0 :         dump_string_field (di, "tag", "union");
     500              : 
     501           71 :       dump_child ("flds", TYPE_FIELDS (t));
     502           71 :       queue_and_dump_index (di, "binf", TYPE_BINFO (t),
     503              :                             DUMP_BINFO);
     504           71 :       break;
     505              : 
     506            4 :     case CONST_DECL:
     507            4 :       dump_child ("cnst", DECL_INITIAL (t));
     508            4 :       break;
     509              : 
     510            0 :     case DEBUG_EXPR_DECL:
     511            0 :       dump_int (di, "-uid", DEBUG_TEMP_UID (t));
     512              :       /* Fall through.  */
     513              : 
     514          237 :     case VAR_DECL:
     515          237 :     case PARM_DECL:
     516          237 :     case FIELD_DECL:
     517          237 :     case RESULT_DECL:
     518          237 :       if (TREE_CODE (t) == PARM_DECL)
     519           80 :         dump_child ("argt", DECL_ARG_TYPE (t));
     520              :       else
     521          157 :         dump_child ("init", DECL_INITIAL (t));
     522          237 :       dump_child ("size", DECL_SIZE (t));
     523          237 :       dump_int (di, "algn", DECL_ALIGN (t));
     524              : 
     525          237 :       if (TREE_CODE (t) == FIELD_DECL)
     526              :         {
     527           86 :           if (DECL_FIELD_OFFSET (t))
     528           86 :             dump_child ("bpos", bit_position (t));
     529              :         }
     530          151 :       else if (VAR_P (t) || TREE_CODE (t) == PARM_DECL)
     531              :         {
     532          146 :           dump_int (di, "used", TREE_USED (t));
     533          146 :           if (DECL_REGISTER (t))
     534            0 :             dump_string_field (di, "spec", "register");
     535              :         }
     536              :       break;
     537              : 
     538        14569 :     case FUNCTION_DECL:
     539        14569 :       dump_child ("args", DECL_ARGUMENTS (t));
     540        14569 :       if (DECL_EXTERNAL (t))
     541        14532 :         dump_string_field (di, "body", "undefined");
     542        14569 :       if (TREE_PUBLIC (t))
     543        14567 :         dump_string_field (di, "link", "extern");
     544              :       else
     545            2 :         dump_string_field (di, "link", "static");
     546        14569 :       if (DECL_SAVED_TREE (t) && !dump_flag (di, TDF_SLIM, t))
     547           35 :         dump_child ("body", DECL_SAVED_TREE (t));
     548              :       break;
     549              : 
     550          356 :     case INTEGER_CST:
     551          356 :       fprintf (di->stream, "int: ");
     552          356 :       print_decs (wi::to_wide (t), di->stream);
     553          356 :       break;
     554              : 
     555            8 :     case STRING_CST:
     556            8 :       fprintf (di->stream, "strg: %-7s ", TREE_STRING_POINTER (t));
     557            8 :       dump_int (di, "lngt", TREE_STRING_LENGTH (t));
     558            8 :       break;
     559              : 
     560            0 :     case REAL_CST:
     561            0 :       dump_real (di, "valu", TREE_REAL_CST_PTR (t));
     562            0 :       break;
     563              : 
     564            0 :     case FIXED_CST:
     565            0 :       dump_fixed (di, "valu", TREE_FIXED_CST_PTR (t));
     566            0 :       break;
     567              : 
     568          132 :     case TRUTH_NOT_EXPR:
     569          132 :     case ADDR_EXPR:
     570          132 :     case INDIRECT_REF:
     571          132 :     case CLEANUP_POINT_EXPR:
     572          132 :     case VIEW_CONVERT_EXPR:
     573          132 :     case SAVE_EXPR:
     574          132 :     case REALPART_EXPR:
     575          132 :     case IMAGPART_EXPR:
     576              :       /* These nodes are unary, but do not have code class `1'.  */
     577          132 :       dump_child ("op 0", TREE_OPERAND (t, 0));
     578          132 :       break;
     579              : 
     580           64 :     case TRUTH_ANDIF_EXPR:
     581           64 :     case TRUTH_ORIF_EXPR:
     582           64 :     case INIT_EXPR:
     583           64 :     case MODIFY_EXPR:
     584           64 :     case COMPOUND_EXPR:
     585           64 :     case PREDECREMENT_EXPR:
     586           64 :     case PREINCREMENT_EXPR:
     587           64 :     case POSTDECREMENT_EXPR:
     588           64 :     case POSTINCREMENT_EXPR:
     589              :       /* These nodes are binary, but do not have code class `2'.  */
     590           64 :       dump_child ("op 0", TREE_OPERAND (t, 0));
     591           64 :       dump_child ("op 1", TREE_OPERAND (t, 1));
     592           64 :       break;
     593              : 
     594           55 :     case COMPONENT_REF:
     595           55 :     case BIT_FIELD_REF:
     596           55 :       dump_child ("op 0", TREE_OPERAND (t, 0));
     597           55 :       dump_child ("op 1", TREE_OPERAND (t, 1));
     598           55 :       dump_child ("op 2", TREE_OPERAND (t, 2));
     599           55 :       break;
     600              : 
     601           15 :     case ARRAY_REF:
     602           15 :     case ARRAY_RANGE_REF:
     603           15 :       dump_child ("op 0", TREE_OPERAND (t, 0));
     604           15 :       dump_child ("op 1", TREE_OPERAND (t, 1));
     605           15 :       dump_child ("op 2", TREE_OPERAND (t, 2));
     606           15 :       dump_child ("op 3", TREE_OPERAND (t, 3));
     607           15 :       break;
     608              : 
     609            5 :     case COND_EXPR:
     610            5 :       dump_child ("op 0", TREE_OPERAND (t, 0));
     611            5 :       dump_child ("op 1", TREE_OPERAND (t, 1));
     612            5 :       dump_child ("op 2", TREE_OPERAND (t, 2));
     613            5 :       break;
     614              : 
     615            7 :     case TRY_FINALLY_EXPR:
     616            7 :     case EH_ELSE_EXPR:
     617            7 :       dump_child ("op 0", TREE_OPERAND (t, 0));
     618            7 :       dump_child ("op 1", TREE_OPERAND (t, 1));
     619            7 :       break;
     620              : 
     621           31 :     case CALL_EXPR:
     622           31 :       {
     623           31 :         int i = 0;
     624           31 :         tree arg;
     625           31 :         call_expr_arg_iterator iter;
     626           31 :         dump_child ("fn", CALL_EXPR_FN (t));
     627          120 :         FOR_EACH_CALL_EXPR_ARG (arg, iter, t)
     628              :           {
     629           58 :             char buffer[32];
     630           58 :             sprintf (buffer, "%u", i);
     631           58 :             dump_child (buffer, arg);
     632           58 :             i++;
     633              :           }
     634              :       }
     635           31 :       break;
     636              : 
     637           27 :     case CONSTRUCTOR:
     638           27 :       {
     639           27 :         unsigned HOST_WIDE_INT cnt;
     640           27 :         tree index, value;
     641           27 :         dump_int (di, "lngt", CONSTRUCTOR_NELTS (t));
     642          117 :         FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (t), cnt, index, value)
     643              :           {
     644           63 :             dump_child ("idx", index);
     645           63 :             dump_child ("val", value);
     646              :           }
     647              :       }
     648              :       break;
     649              : 
     650           17 :     case BIND_EXPR:
     651           17 :       dump_child ("vars", TREE_OPERAND (t, 0));
     652           17 :       dump_child ("body", TREE_OPERAND (t, 1));
     653           17 :       break;
     654              : 
     655            1 :     case LOOP_EXPR:
     656            1 :       dump_child ("body", TREE_OPERAND (t, 0));
     657            1 :       break;
     658              : 
     659            0 :     case EXIT_EXPR:
     660            0 :       dump_child ("cond", TREE_OPERAND (t, 0));
     661            0 :       break;
     662              : 
     663            6 :     case RETURN_EXPR:
     664            6 :       dump_child ("expr", TREE_OPERAND (t, 0));
     665            6 :       break;
     666              : 
     667            0 :     case TARGET_EXPR:
     668            0 :       dump_child ("decl", TREE_OPERAND (t, 0));
     669            0 :       dump_child ("init", TREE_OPERAND (t, 1));
     670            0 :       dump_child ("clnp", TREE_OPERAND (t, 2));
     671              :       /* There really are two possible places the initializer can be.
     672              :          After RTL expansion, the second operand is moved to the
     673              :          position of the fourth operand, and the second operand
     674              :          becomes NULL.  */
     675            0 :       dump_child ("init", TREE_OPERAND (t, 3));
     676            0 :       break;
     677              : 
     678            0 :     case CASE_LABEL_EXPR:
     679            0 :       dump_child ("name", CASE_LABEL (t));
     680            0 :       if (CASE_LOW (t))
     681              :         {
     682            0 :           dump_child ("low ", CASE_LOW (t));
     683            0 :           if (CASE_HIGH (t))
     684            0 :             dump_child ("high", CASE_HIGH (t));
     685              :         }
     686              :       break;
     687            3 :     case LABEL_EXPR:
     688            3 :       dump_child ("name", TREE_OPERAND (t,0));
     689            3 :       break;
     690            1 :     case GOTO_EXPR:
     691            1 :       dump_child ("labl", TREE_OPERAND (t, 0));
     692            1 :       break;
     693            0 :     case SWITCH_EXPR:
     694            0 :       dump_child ("cond", TREE_OPERAND (t, 0));
     695            0 :       dump_child ("body", TREE_OPERAND (t, 1));
     696            0 :       break;
     697            0 :     case OMP_CLAUSE:
     698            0 :       {
     699            0 :         int i;
     700            0 :         fprintf (di->stream, "%s\n", omp_clause_code_name[OMP_CLAUSE_CODE (t)]);
     701            0 :         for (i = 0; i < omp_clause_num_ops[OMP_CLAUSE_CODE (t)]; i++)
     702            0 :           dump_child ("op: ", OMP_CLAUSE_OPERAND (t, i));
     703              :       }
     704              :       break;
     705              : 
     706            6 :     case OBJ_TYPE_REF:
     707            6 :       dump_child ("expr", OBJ_TYPE_REF_EXPR (t));
     708            6 :       dump_child ("obj", OBJ_TYPE_REF_OBJECT (t));
     709            6 :       dump_child ("tok", OBJ_TYPE_REF_TOKEN (t));
     710            6 :       break;
     711              : 
     712              :     default:
     713              :       /* There are no additional fields to print.  */
     714              :       break;
     715              :     }
     716              : 
     717        44107 :  done:
     718        44107 :   if (dump_flag (di, TDF_ADDRESS, NULL))
     719            0 :     dump_pointer (di, "addr", (void *)t);
     720              : 
     721              :   /* Terminate the line.  */
     722        44107 :   fprintf (di->stream, "\n");
     723        44107 : }
     724              : 
     725              : /* Return nonzero if FLAG has been specified for the dump, and NODE
     726              :    is not the root node of the dump.  */
     727              : 
     728        59074 : int dump_flag (dump_info_p di, dump_flags_t flag, const_tree node)
     729              : {
     730        59074 :   return (di->flags & flag) && (node != di->node);
     731              : }
     732              : 
     733              : /* Dump T, and all its children, on STREAM.  */
     734              : 
     735              : void
     736            9 : dump_node (const_tree t, dump_flags_t flags, FILE *stream)
     737              : {
     738            9 :   struct dump_info di;
     739            9 :   dump_queue_p dq;
     740            9 :   dump_queue_p next_dq;
     741              : 
     742              :   /* Initialize the dump-information structure.  */
     743            9 :   di.stream = stream;
     744            9 :   di.index = 0;
     745            9 :   di.column = 0;
     746            9 :   di.queue = 0;
     747            9 :   di.queue_end = 0;
     748            9 :   di.free_list = 0;
     749            9 :   di.flags = flags;
     750            9 :   di.node = t;
     751            9 :   di.nodes = splay_tree_new (splay_tree_compare_pointers, 0,
     752              :                              splay_tree_delete_pointers);
     753              : 
     754              :   /* Queue up the first node.  */
     755            9 :   queue (&di, t, DUMP_NONE);
     756              : 
     757              :   /* Until the queue is empty, keep dumping nodes.  */
     758        44125 :   while (di.queue)
     759        44107 :     dequeue_and_dump (&di);
     760              : 
     761              :   /* Now, clean up.  */
     762          290 :   for (dq = di.free_list; dq; dq = next_dq)
     763              :     {
     764          281 :       next_dq = dq->next;
     765          281 :       free (dq);
     766              :     }
     767            9 :   splay_tree_delete (di.nodes);
     768            9 : }
        

Generated by: LCOV version 2.5.0-beta

LCOV profile is generated on x86_64 machine using following configure options: configure --disable-bootstrap --enable-coverage=opt --enable-languages=c,c++,fortran,go,jit,lto,rust,m2 --enable-host-shared. GCC test suite is run with the built compiler.