LCOV - code coverage report
Current view: top level - gcc - print-tree.cc (source / functions) Coverage Total Hit
Test: gcc.info Lines: 42.6 % 745 317
Test Date: 2026-02-28 14:20:25 Functions: 23.1 % 26 6
Legend: Lines:     hit not hit

            Line data    Source code
       1              : /* Prints out tree in human readable form - GCC
       2              :    Copyright (C) 1990-2026 Free Software Foundation, Inc.
       3              : 
       4              : This file is part of GCC.
       5              : 
       6              : GCC is free software; you can redistribute it and/or modify it under
       7              : the terms of the GNU General Public License as published by the Free
       8              : Software Foundation; either version 3, or (at your option) any later
       9              : version.
      10              : 
      11              : GCC is distributed in the hope that it will be useful, but WITHOUT ANY
      12              : WARRANTY; without even the implied warranty of MERCHANTABILITY or
      13              : FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
      14              : for more details.
      15              : 
      16              : You should have received a copy of the GNU General Public License
      17              : along with GCC; see the file COPYING3.  If not see
      18              : <http://www.gnu.org/licenses/>.  */
      19              : 
      20              : 
      21              : #include "config.h"
      22              : #include "system.h"
      23              : #include "coretypes.h"
      24              : #include "tm.h"
      25              : #include "tree.h"
      26              : #include "cgraph.h"
      27              : #include "diagnostic.h"
      28              : #include "varasm.h"
      29              : #include "print-rtl.h"
      30              : #include "stor-layout.h"
      31              : #include "langhooks.h"
      32              : #include "tree-iterator.h"
      33              : #include "gimple-pretty-print.h" /* FIXME */
      34              : #include "tree-cfg.h"
      35              : #include "dumpfile.h"
      36              : #include "print-tree.h"
      37              : #include "file-prefix-map.h"
      38              : 
      39              : /* Define the hash table of nodes already seen.
      40              :    Such nodes are not repeated; brief cross-references are used.  */
      41              : 
      42              : #define HASH_SIZE 37
      43              : 
      44              : static hash_set<tree> *table = NULL;
      45              : 
      46              : /* Print PREFIX and ADDR to FILE.  */
      47              : void
      48        37413 : dump_addr (FILE *file, const char *prefix, const void *addr)
      49              : {
      50        37413 :   if (flag_dump_noaddr || flag_dump_unnumbered)
      51        25852 :     fprintf (file, "%s#", prefix);
      52              :   else
      53        11561 :     fprintf (file, "%s" HOST_PTR_PRINTF, prefix, addr);
      54        37413 : }
      55              : 
      56              : /* Print to FILE a NODE representing a REAL_CST constant, including
      57              :    Infinity and NaN.  Be verbose when BFRIEF is false.  */
      58              : 
      59              : static void
      60            0 : print_real_cst (FILE *file, const_tree node, bool brief)
      61              : {
      62            0 :   if (TREE_OVERFLOW (node))
      63            0 :     fprintf (file, " overflow");
      64              : 
      65            0 :   REAL_VALUE_TYPE d = TREE_REAL_CST (node);
      66            0 :   if (REAL_VALUE_ISINF (d))
      67            0 :     fprintf (file,  REAL_VALUE_NEGATIVE (d) ? " -Inf" : " Inf");
      68            0 :   else if (REAL_VALUE_ISNAN (d))
      69              :     {
      70              :       /* Print a NaN in the format [-][Q]NaN[(significand[exponent])]
      71              :          where significand is a hexadecimal string that starts with
      72              :          the 0x prefix followed by 0 if the number is not canonical
      73              :          and a non-zero digit if it is, and exponent is decimal.  */
      74            0 :       unsigned start = 0;
      75              :       const char *psig = (const char *) d.sig;
      76            0 :       for (unsigned i = 0; i != sizeof d.sig; ++i)
      77            0 :         if (psig[i])
      78              :           {
      79              :             start = i;
      80              :             break;
      81              :           }
      82              : 
      83            0 :       fprintf (file, " %s%sNaN", d.sign ? "-" : "",
      84            0 :                d.signalling ? "S" : "Q");
      85              : 
      86            0 :       if (brief)
      87            0 :         return;
      88              : 
      89            0 :       if (start)
      90            0 :         fprintf (file, "(0x%s", d.canonical ? "" : "0");
      91            0 :       else if (d.uexp)
      92            0 :         fprintf (file, "(%s", d.canonical ? "" : "0");
      93            0 :       else if (!d.canonical)
      94              :         {
      95            0 :           fprintf (file, "(0)");
      96            0 :           return;
      97              :         }
      98              : 
      99            0 :       if (psig[start])
     100              :         {
     101            0 :           for (unsigned i = start; i != sizeof d.sig; ++i)
     102            0 :             if (i == start)
     103            0 :               fprintf (file, "%x", psig[i]);
     104              :             else
     105            0 :               fprintf (file, "%02x", psig[i]);
     106              :         }
     107              : 
     108            0 :       if (d.uexp)
     109            0 :         fprintf (file, "%se%u)", psig[start] ? "," : "", d.uexp);
     110            0 :       else if (psig[start])
     111            0 :         fputc (')', file);
     112              :     }
     113              :   else
     114              :     {
     115            0 :       char string[64];
     116            0 :       real_to_decimal (string, &d, sizeof (string), 0, 1);
     117            0 :       fprintf (file, " %s", string);
     118              :     }
     119              : }
     120              : 
     121              : /* Print a node in brief fashion, with just the code, address and name.  */
     122              : 
     123              : void
     124        34298 : print_node_brief (FILE *file, const char *prefix, const_tree node, int indent)
     125              : {
     126        34298 :   enum tree_code_class tclass;
     127              : 
     128        34298 :   if (node == 0)
     129              :     return;
     130              : 
     131        34123 :   tclass = TREE_CODE_CLASS (TREE_CODE (node));
     132              : 
     133              :   /* Always print the slot this node is in, and its code, address and
     134              :      name if any.  */
     135        34123 :   if (indent > 0)
     136        33791 :     fprintf (file, " ");
     137        34123 :   fprintf (file, "%s <%s", prefix, get_tree_code_name (TREE_CODE (node)));
     138        34123 :   dump_addr (file, " ", node);
     139              : 
     140        34123 :   if (tclass == tcc_declaration)
     141              :     {
     142        32734 :       if (DECL_NAME (node))
     143        32662 :         fprintf (file, " %s", IDENTIFIER_POINTER (DECL_NAME (node)));
     144           72 :       else if (TREE_CODE (node) == LABEL_DECL
     145           72 :                && LABEL_DECL_UID (node) != -1)
     146              :         {
     147           36 :           if (dump_flags & TDF_NOUID)
     148            0 :             fprintf (file, " L.xxxx");
     149              :           else
     150           36 :             fprintf (file, " L.%d", (int) LABEL_DECL_UID (node));
     151              :         }
     152              :       else
     153              :         {
     154           36 :           if (dump_flags & TDF_NOUID)
     155           24 :             fprintf (file, " %c.xxxx",
     156              :                      TREE_CODE (node) == CONST_DECL ? 'C' : 'D');
     157              :           else
     158           24 :             fprintf (file, " %c.%u",
     159              :                      TREE_CODE (node) == CONST_DECL ? 'C' : 'D',
     160           24 :                      DECL_UID (node));
     161              :         }
     162              :     }
     163         1389 :   else if (tclass == tcc_type)
     164              :     {
     165          581 :       if (TYPE_NAME (node))
     166              :         {
     167          176 :           if (TREE_CODE (TYPE_NAME (node)) == IDENTIFIER_NODE)
     168          141 :             fprintf (file, " %s", IDENTIFIER_POINTER (TYPE_NAME (node)));
     169           35 :           else if (TREE_CODE (TYPE_NAME (node)) == TYPE_DECL
     170           35 :                    && DECL_NAME (TYPE_NAME (node)))
     171           70 :             fprintf (file, " %s",
     172           35 :                      IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (node))));
     173              :         }
     174          581 :       if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node)))
     175            0 :         fprintf (file, " address-space-%d", TYPE_ADDR_SPACE (node));
     176              :     }
     177        34123 :   if (TREE_CODE (node) == IDENTIFIER_NODE)
     178          168 :     fprintf (file, " %s", IDENTIFIER_POINTER (node));
     179              : 
     180              :   /* We might as well always print the value of an integer or real.  */
     181        34123 :   if (TREE_CODE (node) == INTEGER_CST)
     182              :     {
     183          300 :       if (TREE_OVERFLOW (node))
     184            0 :         fprintf (file, " overflow");
     185              : 
     186          300 :       fprintf (file, " ");
     187          300 :       print_dec (wi::to_wide (node), file, TYPE_SIGN (TREE_TYPE (node)));
     188              :     }
     189        34123 :   if (TREE_CODE (node) == REAL_CST)
     190            0 :     print_real_cst (file, node, true);
     191        34123 :   if (TREE_CODE (node) == FIXED_CST)
     192              :     {
     193            0 :       FIXED_VALUE_TYPE f;
     194            0 :       char string[60];
     195              : 
     196            0 :       if (TREE_OVERFLOW (node))
     197            0 :         fprintf (file, " overflow");
     198              : 
     199            0 :       f = TREE_FIXED_CST (node);
     200            0 :       fixed_to_decimal (string, &f, sizeof (string));
     201            0 :       fprintf (file, " %s", string);
     202              :     }
     203              : 
     204        34123 :   fprintf (file, ">");
     205              : }
     206              : 
     207              : void
     208          332 : indent_to (FILE *file, int column)
     209              : {
     210          332 :   int i;
     211              : 
     212              :   /* Since this is the long way, indent to desired column.  */
     213          332 :   if (column > 0)
     214          306 :     fprintf (file, "\n");
     215         2511 :   for (i = 0; i < column; i++)
     216         2179 :     fprintf (file, " ");
     217          332 : }
     218              : 
     219              : /* Print the node NODE in full on file FILE, preceded by PREFIX,
     220              :    starting in column INDENT.  */
     221              : 
     222              : void
     223          340 : print_node (FILE *file, const char *prefix, tree node, int indent,
     224              :             bool brief_for_visited)
     225              : {
     226          340 :   machine_mode mode;
     227          340 :   enum tree_code_class tclass;
     228          340 :   int len;
     229          340 :   int i;
     230          340 :   expanded_location xloc;
     231          340 :   enum tree_code code;
     232              : 
     233          340 :   if (node == 0)
     234          153 :     return;
     235              : 
     236          230 :   code = TREE_CODE (node);
     237              : 
     238              :   /* It is unsafe to look at any other fields of a node with ERROR_MARK or
     239              :      invalid code.  */
     240          230 :   if (code == ERROR_MARK || code >= MAX_TREE_CODES)
     241              :     {
     242            0 :       print_node_brief (file, prefix, node, indent);
     243            0 :       return;
     244              :     }
     245              : 
     246          230 :   tclass = TREE_CODE_CLASS (code);
     247              : 
     248              :   /* Don't get too deep in nesting.  If the user wants to see deeper,
     249              :      it is easy to use the address of a lowest-level node
     250              :      as an argument in another call to debug_tree.  */
     251              : 
     252          230 :   if (indent > 24)
     253              :     {
     254            0 :       print_node_brief (file, prefix, node, indent);
     255            0 :       return;
     256              :     }
     257              : 
     258          230 :   if (indent > 8 && (tclass == tcc_type || tclass == tcc_declaration))
     259              :     {
     260           13 :       print_node_brief (file, prefix, node, indent);
     261           13 :       return;
     262              :     }
     263              : 
     264              :   /* Allow this function to be called if the table is not there.  */
     265          217 :   if (table)
     266              :     {
     267              :       /* If node is in the table, just mention its address.  */
     268          165 :       if (table->contains (node) && brief_for_visited)
     269              :         {
     270           30 :           print_node_brief (file, prefix, node, indent);
     271           30 :           return;
     272              :         }
     273              : 
     274          135 :       table->add (node);
     275              :     }
     276              : 
     277              :   /* Indent to the specified column, since this is the long form.  */
     278          187 :   indent_to (file, indent);
     279              : 
     280              :   /* Print the slot this node is in, and its code, and address.  */
     281          187 :   fprintf (file, "%s <%s", prefix, get_tree_code_name (code));
     282          187 :   dump_addr (file, " ", node);
     283              : 
     284              :   /* Print the name, if any.  */
     285          187 :   if (tclass == tcc_declaration)
     286              :     {
     287           16 :       if (DECL_NAME (node))
     288           16 :         fprintf (file, " %s", IDENTIFIER_POINTER (DECL_NAME (node)));
     289            0 :       else if (code == LABEL_DECL
     290            0 :                && LABEL_DECL_UID (node) != -1)
     291              :         {
     292            0 :           if (dump_flags & TDF_NOUID)
     293            0 :             fprintf (file, " L.xxxx");
     294              :           else
     295            0 :             fprintf (file, " L.%d", (int) LABEL_DECL_UID (node));
     296              :         }
     297              :       else
     298              :         {
     299            0 :           if (dump_flags & TDF_NOUID)
     300            0 :             fprintf (file, " %c.xxxx", code == CONST_DECL ? 'C' : 'D');
     301              :           else
     302            0 :             fprintf (file, " %c.%u", code == CONST_DECL ? 'C' : 'D',
     303            0 :                      DECL_UID (node));
     304              :         }
     305              :     }
     306          171 :   else if (tclass == tcc_type)
     307              :     {
     308           55 :       if (TYPE_NAME (node))
     309              :         {
     310           27 :           if (TREE_CODE (TYPE_NAME (node)) == IDENTIFIER_NODE)
     311            5 :             fprintf (file, " %s", IDENTIFIER_POINTER (TYPE_NAME (node)));
     312           22 :           else if (TREE_CODE (TYPE_NAME (node)) == TYPE_DECL
     313           22 :                    && DECL_NAME (TYPE_NAME (node)))
     314           44 :             fprintf (file, " %s",
     315           22 :                      IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (node))));
     316              :         }
     317              :     }
     318          187 :   if (code == IDENTIFIER_NODE)
     319            0 :     fprintf (file, " %s", IDENTIFIER_POINTER (node));
     320              : 
     321          187 :   if (code == INTEGER_CST)
     322              :     {
     323          112 :       if (indent <= 4)
     324           32 :         print_node_brief (file, "type", TREE_TYPE (node), indent + 4);
     325              :     }
     326           75 :   else if (CODE_CONTAINS_STRUCT (code, TS_TYPED))
     327              :     {
     328           75 :       print_node (file, "type", TREE_TYPE (node), indent + 4);
     329           75 :       if (TREE_TYPE (node))
     330           44 :         indent_to (file, indent + 3);
     331              :     }
     332              : 
     333          187 :   if (!TYPE_P (node) && TREE_SIDE_EFFECTS (node))
     334            0 :     fputs (" side-effects", file);
     335              : 
     336          187 :   if (TYPE_P (node) ? TYPE_READONLY (node) : TREE_READONLY (node))
     337            7 :     fputs (" readonly", file);
     338          187 :   if (TYPE_P (node) && TYPE_ATOMIC (node))
     339            0 :     fputs (" atomic", file);
     340          187 :   if (!TYPE_P (node) && TREE_CONSTANT (node))
     341          112 :     fputs (" constant", file);
     342           75 :   else if (TYPE_P (node) && TYPE_SIZES_GIMPLIFIED (node))
     343            2 :     fputs (" sizes-gimplified", file);
     344              : 
     345          187 :   if (TYPE_P (node) && !ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node)))
     346            0 :     fprintf (file, " address-space-%d", TYPE_ADDR_SPACE (node));
     347              : 
     348          187 :   if (TREE_ADDRESSABLE (node))
     349            1 :     fputs (" addressable", file);
     350          187 :   if (TREE_THIS_VOLATILE (node))
     351            0 :     fputs (" volatile", file);
     352          187 :   if (TREE_ASM_WRITTEN (node))
     353            0 :     fputs (" asm_written", file);
     354          187 :   if (TREE_USED (node))
     355            6 :     fputs (" used", file);
     356          187 :   if (TREE_NOTHROW (node))
     357            0 :     fputs (" nothrow", file);
     358          187 :   if (TREE_PUBLIC (node))
     359           27 :     fputs (" public", file);
     360          187 :   if (TREE_PRIVATE (node))
     361            0 :     fputs (" private", file);
     362          187 :   if (TREE_PROTECTED (node))
     363            0 :     fputs (" protected", file);
     364          187 :   if (TREE_STATIC (node))
     365           12 :     fputs (code == CALL_EXPR ? " must-tail-call" : " static", file);
     366          187 :   if (TREE_DEPRECATED (node))
     367            0 :     fputs (" deprecated", file);
     368          187 :   if (TREE_VISITED (node))
     369           10 :     fputs (" visited", file);
     370              : 
     371          187 :   if (code != TREE_VEC && code != INTEGER_CST && code != SSA_NAME)
     372              :     {
     373           75 :       if (TREE_UNAVAILABLE (node))
     374            0 :         fputs (" unavailable", file);
     375           75 :       if (TREE_LANG_FLAG_0 (node))
     376            0 :         fputs (" tree_0", file);
     377           75 :       if (TREE_LANG_FLAG_1 (node))
     378            0 :         fputs (" tree_1", file);
     379           75 :       if (TREE_LANG_FLAG_2 (node))
     380            0 :         fputs (" tree_2", file);
     381           75 :       if (TREE_LANG_FLAG_3 (node))
     382            0 :         fputs (" tree_3", file);
     383           75 :       if (TREE_LANG_FLAG_4 (node))
     384            0 :         fputs (" tree_4", file);
     385           75 :       if (TREE_LANG_FLAG_5 (node))
     386            0 :         fputs (" tree_5", file);
     387           75 :       if (TREE_LANG_FLAG_6 (node))
     388            0 :         fputs (" tree_6", file);
     389              :     }
     390              : 
     391              :   /* DECL_ nodes have additional attributes.  */
     392              : 
     393          187 :   switch (TREE_CODE_CLASS (code))
     394              :     {
     395           16 :     case tcc_declaration:
     396           16 :       if (CODE_CONTAINS_STRUCT (code, TS_DECL_COMMON))
     397              :         {
     398           16 :           if (DECL_UNSIGNED (node))
     399            4 :             fputs (" unsigned", file);
     400           16 :           if (DECL_IGNORED_P (node))
     401            0 :             fputs (" ignored", file);
     402           16 :           if (DECL_ABSTRACT_P (node))
     403            0 :             fputs (" abstract", file);
     404           16 :           if (DECL_EXTERNAL (node))
     405            0 :             fputs (" external", file);
     406           16 :           if (DECL_NONLOCAL (node))
     407            0 :             fputs (" nonlocal", file);
     408              :         }
     409           16 :       if (CODE_CONTAINS_STRUCT (code, TS_DECL_WITH_VIS))
     410              :         {
     411           16 :           if (DECL_WEAK (node))
     412            0 :             fputs (" weak", file);
     413           16 :           if (DECL_IN_SYSTEM_HEADER (node))
     414            0 :             fputs (" in_system_header", file);
     415              :         }
     416           16 :       if (CODE_CONTAINS_STRUCT (code, TS_DECL_WRTL)
     417              :           && code != LABEL_DECL
     418           16 :           && code != FUNCTION_DECL
     419           32 :           && DECL_REGISTER (node))
     420            0 :         fputs (" regdecl", file);
     421              : 
     422           16 :       if (code == TYPE_DECL && TYPE_DECL_SUPPRESS_DEBUG (node))
     423            0 :         fputs (" suppress-debug", file);
     424              : 
     425           16 :       if (code == FUNCTION_DECL
     426           16 :           && DECL_FUNCTION_SPECIFIC_TARGET (node))
     427            0 :         fputs (" function-specific-target", file);
     428           16 :       if (code == FUNCTION_DECL
     429           16 :           && DECL_FUNCTION_SPECIFIC_OPTIMIZATION (node))
     430            0 :         fputs (" function-specific-opt", file);
     431           16 :       if (code == FUNCTION_DECL && DECL_DECLARED_INLINE_P (node))
     432            0 :         fputs (" autoinline", file);
     433           16 :       if (code == FUNCTION_DECL && DECL_UNINLINABLE (node))
     434            0 :         fputs (" uninlinable", file);
     435           16 :       if (code == FUNCTION_DECL && fndecl_built_in_p (node))
     436            0 :         fputs (" built-in", file);
     437           16 :       if (code == FUNCTION_DECL && DECL_STATIC_CHAIN (node))
     438            0 :         fputs (" static-chain", file);
     439           16 :       if (TREE_CODE (node) == FUNCTION_DECL && decl_is_tm_clone (node))
     440            0 :         fputs (" tm-clone", file);
     441              : 
     442           16 :       if (code == FIELD_DECL && DECL_PACKED (node))
     443            0 :         fputs (" packed", file);
     444           16 :       if (code == FIELD_DECL && DECL_BIT_FIELD (node))
     445            0 :         fputs (" bit-field", file);
     446           16 :       if (code == FIELD_DECL && DECL_NONADDRESSABLE_P (node))
     447            0 :         fputs (" nonaddressable", file);
     448              : 
     449           16 :       if (code == LABEL_DECL && EH_LANDING_PAD_NR (node))
     450            0 :         fprintf (file, " landing-pad:%d", EH_LANDING_PAD_NR (node));
     451              : 
     452           16 :       if (code == VAR_DECL && DECL_IN_TEXT_SECTION (node))
     453            0 :         fputs (" in-text-section", file);
     454           16 :       if (code == VAR_DECL && DECL_IN_CONSTANT_POOL (node))
     455            0 :         fputs (" in-constant-pool", file);
     456           16 :       if (code == VAR_DECL && DECL_COMMON (node))
     457            1 :         fputs (" common", file);
     458           16 :       if ((code == VAR_DECL || code == PARM_DECL) && DECL_READ_P (node))
     459            6 :         fputs (" read", file);
     460           16 :       if (code == VAR_DECL && DECL_THREAD_LOCAL_P (node))
     461              :         {
     462            0 :           fputs (" ", file);
     463            0 :           fputs (tls_model_names[DECL_TLS_MODEL (node)], file);
     464              :         }
     465              : 
     466           16 :       if (CODE_CONTAINS_STRUCT (code, TS_DECL_COMMON))
     467              :         {
     468           16 :           if (DECL_VIRTUAL_P (node))
     469            0 :             fputs (" virtual", file);
     470           16 :           if (DECL_PRESERVE_P (node))
     471            0 :             fputs (" preserve", file);
     472           16 :           if (DECL_LANG_FLAG_0 (node))
     473            0 :             fputs (" decl_0", file);
     474           16 :           if (DECL_LANG_FLAG_1 (node))
     475            0 :             fputs (" decl_1", file);
     476           16 :           if (DECL_LANG_FLAG_2 (node))
     477            0 :             fputs (" decl_2", file);
     478           16 :           if (DECL_LANG_FLAG_3 (node))
     479            0 :             fputs (" decl_3", file);
     480           16 :           if (DECL_LANG_FLAG_4 (node))
     481            0 :             fputs (" decl_4", file);
     482           16 :           if (DECL_LANG_FLAG_5 (node))
     483            0 :             fputs (" decl_5", file);
     484           16 :           if (DECL_LANG_FLAG_6 (node))
     485            0 :             fputs (" decl_6", file);
     486           16 :           if (DECL_LANG_FLAG_7 (node))
     487            0 :             fputs (" decl_7", file);
     488           16 :           if (DECL_LANG_FLAG_8 (node))
     489            0 :             fputs (" decl_8", file);
     490              : 
     491           16 :           mode = DECL_MODE (node);
     492           16 :           fprintf (file, " %s", GET_MODE_NAME (mode));
     493              :         }
     494              : 
     495           16 :       if ((code == VAR_DECL || code == PARM_DECL || code == RESULT_DECL)
     496           16 :           && DECL_BY_REFERENCE (node))
     497            0 :         fputs (" passed-by-reference", file);
     498              : 
     499           16 :       if (CODE_CONTAINS_STRUCT (code, TS_DECL_WITH_VIS)  && DECL_DEFER_OUTPUT (node))
     500            0 :         fputs (" defer-output", file);
     501              : 
     502              : 
     503           16 :       xloc = expand_location (DECL_SOURCE_LOCATION (node));
     504           16 :       fprintf (file, " %s:%d:%d", xloc.file, xloc.line,
     505              :                xloc.column);
     506              : 
     507           16 :       if (CODE_CONTAINS_STRUCT (code, TS_DECL_COMMON))
     508              :         {
     509           16 :           print_node (file, "size", DECL_SIZE (node), indent + 4);
     510           16 :           print_node (file, "unit-size", DECL_SIZE_UNIT (node), indent + 4);
     511              : 
     512           16 :           if (code != FUNCTION_DECL || fndecl_built_in_p (node))
     513           16 :             indent_to (file, indent + 3);
     514              : 
     515           16 :           if (DECL_USER_ALIGN (node))
     516            0 :             fprintf (file, " user");
     517              : 
     518           16 :           fprintf (file, " align:%d warn_if_not_align:%d",
     519           16 :                    DECL_ALIGN (node), DECL_WARN_IF_NOT_ALIGN (node));
     520           16 :           if (code == FIELD_DECL)
     521              :             {
     522            0 :               fprintf (file, " offset_align " HOST_WIDE_INT_PRINT_UNSIGNED,
     523            0 :                        DECL_OFFSET_ALIGN (node));
     524            0 :               fprintf (file, " decl_not_flexarray: %d",
     525            0 :                        DECL_NOT_FLEXARRAY (node));
     526              :             }
     527              : 
     528           16 :           if (code == FUNCTION_DECL && fndecl_built_in_p (node))
     529              :             {
     530            0 :               if (DECL_BUILT_IN_CLASS (node) == BUILT_IN_MD)
     531            0 :                 fprintf (file, " built-in: BUILT_IN_MD:%d",
     532              :                          DECL_MD_FUNCTION_CODE (node));
     533            0 :               else if (DECL_BUILT_IN_CLASS (node) == BUILT_IN_FRONTEND)
     534            0 :                 fprintf (file, " built-in: BUILT_IN_FRONTEND:%d",
     535              :                          DECL_FE_FUNCTION_CODE (node));
     536              :               else
     537            0 :                 fprintf (file, " built-in: %s:%s",
     538            0 :                          built_in_class_names[(int) DECL_BUILT_IN_CLASS (node)],
     539            0 :                          built_in_names[(int) DECL_FUNCTION_CODE (node)]);
     540              :             }
     541              :         }
     542           16 :       if (code == FIELD_DECL)
     543              :         {
     544            0 :           print_node (file, "offset", DECL_FIELD_OFFSET (node), indent + 4);
     545            0 :           print_node (file, "bit-offset", DECL_FIELD_BIT_OFFSET (node),
     546              :                       indent + 4);
     547            0 :           if (DECL_BIT_FIELD_TYPE (node))
     548            0 :             print_node (file, "bit_field_type", DECL_BIT_FIELD_TYPE (node),
     549              :                         indent + 4);
     550              :         }
     551              : 
     552           16 :       print_node_brief (file, "context", DECL_CONTEXT (node), indent + 4);
     553              : 
     554           16 :       if (CODE_CONTAINS_STRUCT (code, TS_DECL_COMMON))
     555              :         {
     556           16 :           print_node (file, "attributes",
     557           16 :                             DECL_ATTRIBUTES (node), indent + 4);
     558           16 :           if (code != PARM_DECL)
     559           16 :             print_node_brief (file, "initial", DECL_INITIAL (node),
     560              :                               indent + 4);
     561              :         }
     562           16 :       if (CODE_CONTAINS_STRUCT (code, TS_DECL_WRTL))
     563              :         {
     564           32 :           print_node_brief (file, "abstract_origin",
     565           16 :                             DECL_ABSTRACT_ORIGIN (node), indent + 4);
     566              :         }
     567           16 :       if (CODE_CONTAINS_STRUCT (code, TS_DECL_NON_COMMON))
     568              :         {
     569            0 :           print_node (file, "result", DECL_RESULT_FLD (node), indent + 4);
     570              :         }
     571              : 
     572           16 :       lang_hooks.print_decl (file, node, indent);
     573              : 
     574           16 :       if (DECL_RTL_SET_P (node))
     575              :         {
     576            0 :           indent_to (file, indent + 4);
     577            0 :           print_rtl (file, DECL_RTL (node));
     578              :         }
     579              : 
     580           16 :       if (code == PARM_DECL)
     581              :         {
     582            0 :           print_node (file, "arg-type", DECL_ARG_TYPE (node), indent + 4);
     583              : 
     584            0 :           if (DECL_INCOMING_RTL (node) != 0)
     585              :             {
     586            0 :               indent_to (file, indent + 4);
     587            0 :               fprintf (file, "incoming-rtl ");
     588            0 :               print_rtl (file, DECL_INCOMING_RTL (node));
     589              :             }
     590              :         }
     591           16 :       else if (code == FUNCTION_DECL
     592           16 :                && DECL_STRUCT_FUNCTION (node) != 0)
     593              :         {
     594            0 :           print_node (file, "arguments", DECL_ARGUMENTS (node), indent + 4);
     595            0 :           indent_to (file, indent + 4);
     596            0 :           dump_addr (file, "struct-function ", DECL_STRUCT_FUNCTION (node));
     597              :         }
     598              : 
     599           16 :       if ((code == VAR_DECL || code == PARM_DECL)
     600           16 :           && DECL_HAS_VALUE_EXPR_P (node))
     601            0 :         print_node (file, "value-expr", DECL_VALUE_EXPR (node), indent + 4);
     602              : 
     603              :       /* Print the decl chain only if decl is at second level.  */
     604           16 :       if (indent == 4)
     605            0 :         print_node (file, "chain", TREE_CHAIN (node), indent + 4);
     606              :       else
     607           16 :         print_node_brief (file, "chain", TREE_CHAIN (node), indent + 4);
     608              :       break;
     609              : 
     610           55 :     case tcc_type:
     611           55 :       if (TYPE_UNSIGNED (node))
     612            9 :         fputs (" unsigned", file);
     613              : 
     614           55 :       if (TYPE_NO_FORCE_BLK (node))
     615            0 :         fputs (" no-force-blk", file);
     616              : 
     617           55 :       if (code == ARRAY_TYPE && TYPE_STRING_FLAG (node))
     618            0 :         fputs (" string-flag", file);
     619              : 
     620           55 :       if (TYPE_NEEDS_CONSTRUCTING (node))
     621            0 :         fputs (" needs-constructing", file);
     622              : 
     623           55 :       if ((code == RECORD_TYPE
     624              :            || code == UNION_TYPE
     625              :            || code == QUAL_UNION_TYPE
     626           55 :            || code == ARRAY_TYPE)
     627           55 :           && TYPE_REVERSE_STORAGE_ORDER (node))
     628            0 :         fputs (" reverse-storage-order", file);
     629              : 
     630           55 :       if ((code == RECORD_TYPE
     631           55 :            || code == UNION_TYPE)
     632           55 :           && TYPE_CXX_ODR_P (node))
     633            0 :         fputs (" cxx-odr-p", file);
     634              : 
     635           55 :       if ((code == RECORD_TYPE
     636              :            || code == UNION_TYPE)
     637           55 :           && TYPE_INCLUDES_FLEXARRAY (node))
     638            0 :         fputs (" includes-flexarray", file);
     639              : 
     640              :       /* The transparent-union flag is used for different things in
     641              :          different nodes.  */
     642           55 :       if ((code == UNION_TYPE || code == RECORD_TYPE)
     643           55 :           && TYPE_TRANSPARENT_AGGR (node))
     644            0 :         fputs (" transparent-aggr", file);
     645           55 :       else if (code == ARRAY_TYPE
     646           55 :                && TYPE_NONALIASED_COMPONENT (node))
     647            0 :         fputs (" nonaliased-component", file);
     648              : 
     649           55 :       if (TYPE_PACKED (node))
     650            0 :         fputs (" packed", file);
     651              : 
     652           55 :       if (TYPE_RESTRICT (node))
     653            0 :         fputs (" restrict", file);
     654              : 
     655           55 :       if (TYPE_LANG_FLAG_0 (node))
     656            0 :         fputs (" type_0", file);
     657           55 :       if (TYPE_LANG_FLAG_1 (node))
     658            0 :         fputs (" type_1", file);
     659           55 :       if (TYPE_LANG_FLAG_2 (node))
     660            0 :         fputs (" type_2", file);
     661           55 :       if (TYPE_LANG_FLAG_3 (node))
     662            0 :         fputs (" type_3", file);
     663           55 :       if (TYPE_LANG_FLAG_4 (node))
     664            0 :         fputs (" type_4", file);
     665           55 :       if (TYPE_LANG_FLAG_5 (node))
     666            0 :         fputs (" type_5", file);
     667           55 :       if (TYPE_LANG_FLAG_6 (node))
     668            0 :         fputs (" type_6", file);
     669           55 :       if (TYPE_LANG_FLAG_7 (node))
     670            0 :         fputs (" type_7", file);
     671              : 
     672           55 :       mode = TYPE_MODE (node);
     673           55 :       fprintf (file, " %s", GET_MODE_NAME (mode));
     674              : 
     675           55 :       print_node (file, "size", TYPE_SIZE (node), indent + 4);
     676           55 :       print_node (file, "unit-size", TYPE_SIZE_UNIT (node), indent + 4);
     677           55 :       indent_to (file, indent + 3);
     678              : 
     679           55 :       if (TYPE_USER_ALIGN (node))
     680            0 :         fprintf (file, " user");
     681              : 
     682           55 :       fprintf (file, " align:%d warn_if_not_align:%d symtab:%d alias-set "
     683              :                HOST_WIDE_INT_PRINT_DEC,
     684           55 :                TYPE_ALIGN (node), TYPE_WARN_IF_NOT_ALIGN (node),
     685           55 :                TYPE_SYMTAB_ADDRESS (node),
     686           55 :                (HOST_WIDE_INT) TYPE_ALIAS_SET (node));
     687              : 
     688           55 :       if (TYPE_STRUCTURAL_EQUALITY_P (node))
     689            0 :         fprintf (file, " structural-equality");
     690              :       else
     691           55 :         dump_addr (file, " canonical-type ", TYPE_CANONICAL (node));
     692              : 
     693           55 :       print_node (file, "attributes", TYPE_ATTRIBUTES (node), indent + 4);
     694              : 
     695           55 :       if (INTEGRAL_TYPE_P (node) || code == REAL_TYPE
     696           18 :           || code == FIXED_POINT_TYPE)
     697              :         {
     698           37 :           fprintf (file, " precision:%d", TYPE_PRECISION (node));
     699           37 :           print_node_brief (file, "min", TYPE_MIN_VALUE (node), indent + 4);
     700           37 :           print_node_brief (file, "max", TYPE_MAX_VALUE (node), indent + 4);
     701              :         }
     702              : 
     703           55 :       if (code == ENUMERAL_TYPE)
     704            0 :         print_node (file, "values", TYPE_VALUES (node), indent + 4);
     705              :       else if (code == ARRAY_TYPE)
     706           10 :         print_node (file, "domain", TYPE_DOMAIN (node), indent + 4);
     707              :       else if (code == VECTOR_TYPE)
     708              :         {
     709            0 :           fprintf (file, " nunits:");
     710            0 :           print_dec (TYPE_VECTOR_SUBPARTS (node), file);
     711              :         }
     712              :       else if (code == RECORD_TYPE
     713              :                || code == UNION_TYPE
     714              :                || code == QUAL_UNION_TYPE)
     715            0 :         print_node (file, "fields", TYPE_FIELDS (node), indent + 4);
     716              :       else if (code == FUNCTION_TYPE
     717              :                || code == METHOD_TYPE)
     718              :         {
     719            4 :           if (TYPE_METHOD_BASETYPE (node))
     720            0 :             print_node_brief (file, "method basetype",
     721            0 :                               TYPE_METHOD_BASETYPE (node), indent + 4);
     722            4 :           print_node (file, "arg-types", TYPE_ARG_TYPES (node), indent + 4);
     723              :         }
     724              :       else if (code == OFFSET_TYPE)
     725            0 :         print_node_brief (file, "basetype", TYPE_OFFSET_BASETYPE (node),
     726              :                           indent + 4);
     727              : 
     728           55 :       if (TYPE_CONTEXT (node))
     729            0 :         print_node_brief (file, "context", TYPE_CONTEXT (node), indent + 4);
     730              : 
     731           55 :       lang_hooks.print_type (file, node, indent);
     732              : 
     733           55 :       if (TYPE_POINTER_TO (node) || TREE_CHAIN (node))
     734           30 :         indent_to (file, indent + 3);
     735              : 
     736           55 :       print_node_brief (file, "pointer_to_this", TYPE_POINTER_TO (node),
     737              :                         indent + 4);
     738           55 :       print_node_brief (file, "reference_to_this", TYPE_REFERENCE_TO (node),
     739              :                         indent + 4);
     740           55 :       print_node_brief (file, "chain", TREE_CHAIN (node), indent + 4);
     741           55 :       break;
     742              : 
     743            0 :     case tcc_expression:
     744            0 :     case tcc_comparison:
     745            0 :     case tcc_unary:
     746            0 :     case tcc_binary:
     747            0 :     case tcc_reference:
     748            0 :     case tcc_statement:
     749            0 :     case tcc_vl_exp:
     750            0 :       if ((code == MEM_REF || code == TARGET_MEM_REF)
     751            0 :           && MR_DEPENDENCE_CLIQUE (node) != 0)
     752              :         {
     753            0 :           indent_to (file, indent + 4);
     754            0 :           fprintf (file, "clique: %d base: %d",
     755            0 :                    MR_DEPENDENCE_CLIQUE (node),
     756            0 :                    MR_DEPENDENCE_BASE (node));
     757              :         }
     758            0 :       if (code == BIND_EXPR)
     759              :         {
     760            0 :           print_node (file, "vars", TREE_OPERAND (node, 0), indent + 4);
     761            0 :           print_node (file, "body", TREE_OPERAND (node, 1), indent + 4);
     762            0 :           print_node (file, "block", TREE_OPERAND (node, 2), indent + 4);
     763            0 :           break;
     764              :         }
     765            0 :       if (code == CALL_EXPR)
     766              :         {
     767            0 :           print_node (file, "fn", CALL_EXPR_FN (node), indent + 4);
     768            0 :           print_node (file, "static_chain", CALL_EXPR_STATIC_CHAIN (node),
     769              :                       indent + 4);
     770              : 
     771            0 :           call_expr_arg_iterator iter;
     772            0 :           init_call_expr_arg_iterator (node, &iter);
     773            0 :           while (more_call_expr_args_p (&iter))
     774              :             {
     775              :               /* Buffer big enough to format a 32-bit UINT_MAX into, plus
     776              :                  the text.  */
     777            0 :               char temp[15];
     778            0 :               sprintf (temp, "arg:%u", iter.i);
     779            0 :               tree arg = next_call_expr_arg (&iter);
     780            0 :               if (arg)
     781            0 :                 print_node (file, temp, arg, indent + 4);
     782              :               else
     783              :                 {
     784            0 :                   indent_to (file, indent + 4);
     785            0 :                   fprintf (file, "%s NULL", temp);
     786              :                 }
     787              :             }
     788              :         }
     789              :       else
     790              :         {
     791            0 :           len = TREE_OPERAND_LENGTH (node);
     792              : 
     793            0 :           for (i = 0; i < len; i++)
     794              :             {
     795              :               /* Buffer big enough to format a 32-bit UINT_MAX into, plus
     796              :                  the text.  */
     797            0 :               char temp[16];
     798              : 
     799            0 :               sprintf (temp, "arg:%d", i);
     800            0 :               print_node (file, temp, TREE_OPERAND (node, i), indent + 4);
     801              :             }
     802              :         }
     803            0 :       if (CODE_CONTAINS_STRUCT (code, TS_COMMON))
     804            0 :         print_node (file, "chain", TREE_CHAIN (node), indent + 4);
     805              :       break;
     806              : 
     807          116 :     case tcc_constant:
     808          116 :     case tcc_exceptional:
     809          116 :       switch (code)
     810              :         {
     811          112 :         case INTEGER_CST:
     812          112 :           if (TREE_OVERFLOW (node))
     813            0 :             fprintf (file, " overflow");
     814              : 
     815          112 :           fprintf (file, " ");
     816          112 :           print_dec (wi::to_wide (node), file, TYPE_SIGN (TREE_TYPE (node)));
     817          112 :           break;
     818              : 
     819            0 :         case REAL_CST:
     820            0 :           print_real_cst (file, node, false);
     821            0 :           break;
     822              : 
     823            0 :         case FIXED_CST:
     824            0 :           {
     825            0 :             FIXED_VALUE_TYPE f;
     826            0 :             char string[64];
     827              : 
     828            0 :             if (TREE_OVERFLOW (node))
     829            0 :               fprintf (file, " overflow");
     830              : 
     831            0 :             f = TREE_FIXED_CST (node);
     832            0 :             fixed_to_decimal (string, &f, sizeof (string));
     833            0 :             fprintf (file, " %s", string);
     834              :           }
     835            0 :           break;
     836              : 
     837            0 :         case VECTOR_CST:
     838            0 :           {
     839              :             /* Big enough for UINT_MAX plus the string below.  */
     840            0 :             char buf[32];
     841              : 
     842            0 :             fprintf (file, " npatterns:%u nelts-per-pattern:%u",
     843            0 :                      VECTOR_CST_NPATTERNS (node),
     844            0 :                      VECTOR_CST_NELTS_PER_PATTERN (node));
     845            0 :             unsigned int count = vector_cst_encoded_nelts (node);
     846            0 :             for (unsigned int i = 0; i < count; ++i)
     847              :               {
     848            0 :                 sprintf (buf, "elt:%u: ", i);
     849            0 :                 print_node (file, buf, VECTOR_CST_ENCODED_ELT (node, i),
     850              :                             indent + 4);
     851              :               }
     852              :           }
     853            0 :           break;
     854              : 
     855            0 :         case COMPLEX_CST:
     856            0 :           print_node (file, "real", TREE_REALPART (node), indent + 4);
     857            0 :           print_node (file, "imag", TREE_IMAGPART (node), indent + 4);
     858            0 :           break;
     859              : 
     860            0 :         case STRING_CST:
     861            0 :           {
     862            0 :             const char *p = TREE_STRING_POINTER (node);
     863            0 :             int i = TREE_STRING_LENGTH (node);
     864            0 :             fputs (" \"", file);
     865            0 :             while (--i >= 0)
     866              :               {
     867            0 :                 char ch = *p++;
     868            0 :                 if (ch >= ' ' && ch < 127)
     869            0 :                   putc (ch, file);
     870              :                 else
     871            0 :                   fprintf (file, "\\%03o", ch & 0xFF);
     872              :               }
     873            0 :             fputc ('\"', file);
     874              :           }
     875            0 :           break;
     876              : 
     877              :         case POLY_INT_CST:
     878              :           {
     879              :             char buf[10];
     880            0 :             for (unsigned int i = 0; i < NUM_POLY_INT_COEFFS; ++i)
     881              :               {
     882            0 :                 snprintf (buf, sizeof (buf), "elt%u:", i);
     883            0 :                 print_node (file, buf, POLY_INT_CST_COEFF (node, i),
     884              :                             indent + 4);
     885              :               }
     886              :           }
     887            0 :           break;
     888              : 
     889            0 :         case IDENTIFIER_NODE:
     890            0 :           lang_hooks.print_identifier (file, node, indent);
     891            0 :           break;
     892              : 
     893            4 :         case TREE_LIST:
     894            4 :           print_node (file, "purpose", TREE_PURPOSE (node), indent + 4);
     895            4 :           print_node (file, "value", TREE_VALUE (node), indent + 4);
     896            4 :           print_node (file, "chain", TREE_CHAIN (node), indent + 4);
     897            4 :           break;
     898              : 
     899            0 :         case TREE_VEC:
     900            0 :           len = TREE_VEC_LENGTH (node);
     901            0 :           fprintf (file, " length:%d", len);
     902            0 :           for (i = 0; i < len; i++)
     903            0 :             if (TREE_VEC_ELT (node, i))
     904              :               {
     905              :               /* Buffer big enough to format a 32-bit UINT_MAX into, plus
     906              :                  the text.  */
     907            0 :                 char temp[16];
     908            0 :                 sprintf (temp, "elt:%d", i);
     909            0 :                 print_node (file, temp, TREE_VEC_ELT (node, i), indent + 4);
     910              :               }
     911              :           break;
     912              : 
     913            0 :         case CONSTRUCTOR:
     914            0 :           {
     915            0 :             unsigned HOST_WIDE_INT cnt;
     916            0 :             tree index, value;
     917            0 :             len = CONSTRUCTOR_NELTS (node);
     918            0 :             fprintf (file, " length:%d", len);
     919            0 :             FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (node),
     920              :                                       cnt, index, value)
     921              :               {
     922            0 :                 print_node (file, "idx", index, indent + 4, false);
     923            0 :                 print_node (file, "val", value, indent + 4, false);
     924              :               }
     925              :           }
     926              :           break;
     927              : 
     928            0 :         case STATEMENT_LIST:
     929            0 :           dump_addr (file, " head ", node->stmt_list.head);
     930            0 :           dump_addr (file, " tail ", node->stmt_list.tail);
     931            0 :           fprintf (file, " stmts");
     932            0 :           {
     933            0 :             tree_stmt_iterator i;
     934            0 :             for (i = tsi_start (node); !tsi_end_p (i); tsi_next (&i))
     935              :               {
     936              :                 /* Not printing the addresses of the (not-a-tree)
     937              :                    'struct tree_stmt_list_node's.  */
     938            0 :                 dump_addr (file, " ", tsi_stmt (i));
     939              :               }
     940            0 :             fprintf (file, "\n");
     941            0 :             for (i = tsi_start (node); !tsi_end_p (i); tsi_next (&i))
     942              :               {
     943              :                 /* Not printing the addresses of the (not-a-tree)
     944              :                    'struct tree_stmt_list_node's.  */
     945            0 :                 print_node (file, "stmt", tsi_stmt (i), indent + 4);
     946              :               }
     947              :           }
     948            0 :           break;
     949              : 
     950            0 :         case BLOCK:
     951            0 :           print_node (file, "vars", BLOCK_VARS (node), indent + 4);
     952            0 :           print_node (file, "supercontext", BLOCK_SUPERCONTEXT (node),
     953              :                       indent + 4);
     954            0 :           print_node (file, "subblocks", BLOCK_SUBBLOCKS (node), indent + 4);
     955            0 :           print_node (file, "chain", BLOCK_CHAIN (node), indent + 4);
     956            0 :           print_node (file, "abstract_origin",
     957            0 :                       BLOCK_ABSTRACT_ORIGIN (node), indent + 4);
     958            0 :           break;
     959              : 
     960            0 :         case SSA_NAME:
     961            0 :           print_node_brief (file, "var", SSA_NAME_VAR (node), indent + 4);
     962            0 :           indent_to (file, indent + 4);
     963            0 :           fprintf (file, "def_stmt ");
     964            0 :           {
     965            0 :             pretty_printer pp;
     966            0 :             pp.set_output_stream (file);
     967            0 :             pp_gimple_stmt_1 (&pp, SSA_NAME_DEF_STMT (node), indent + 4,
     968              :                               TDF_NONE);
     969            0 :             pp_flush (&pp);
     970            0 :           }
     971              : 
     972            0 :           indent_to (file, indent + 4);
     973            0 :           fprintf (file, "version:%u", SSA_NAME_VERSION (node));
     974            0 :           if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (node))
     975            0 :             fprintf (file, " in-abnormal-phi");
     976            0 :           if (SSA_NAME_IN_FREE_LIST (node))
     977            0 :             fprintf (file, " in-free-list");
     978              : 
     979            0 :           if (SSA_NAME_PTR_INFO (node))
     980              :             {
     981            0 :               indent_to (file, indent + 3);
     982            0 :               if (SSA_NAME_PTR_INFO (node))
     983            0 :                 dump_addr (file, " ptr-info ", SSA_NAME_PTR_INFO (node));
     984              :             }
     985              :           break;
     986              : 
     987            0 :         case OMP_CLAUSE:
     988            0 :             {
     989            0 :               int i;
     990            0 :               fprintf (file, " %s",
     991            0 :                        omp_clause_code_name[OMP_CLAUSE_CODE (node)]);
     992            0 :               for (i = 0; i < omp_clause_num_ops[OMP_CLAUSE_CODE (node)]; i++)
     993              :                 {
     994            0 :                   indent_to (file, indent + 4);
     995            0 :                   fprintf (file, "op-%d:", i);
     996            0 :                   print_node_brief (file, "", OMP_CLAUSE_OPERAND (node, i), 0);
     997              :                 }
     998              :             }
     999              :           break;
    1000              : 
    1001            0 :         case OPTIMIZATION_NODE:
    1002            0 :           cl_optimization_print (file, indent + 4, TREE_OPTIMIZATION (node));
    1003            0 :           break;
    1004              : 
    1005            0 :         case TARGET_OPTION_NODE:
    1006            0 :           cl_target_option_print (file, indent + 4, TREE_TARGET_OPTION (node));
    1007            0 :           break;
    1008            0 :         case IMPORTED_DECL:
    1009            0 :           fprintf (file, " imported-declaration");
    1010            0 :           print_node_brief (file, "associated-declaration",
    1011            0 :                             IMPORTED_DECL_ASSOCIATED_DECL (node),
    1012              :                             indent + 4);
    1013            0 :           break;
    1014              : 
    1015            0 :         case TREE_BINFO:
    1016            0 :           fprintf (file, " bases:%d",
    1017            0 :                    vec_safe_length (BINFO_BASE_BINFOS (node)));
    1018            0 :           print_node_brief (file, "offset", BINFO_OFFSET (node), indent + 4);
    1019            0 :           print_node_brief (file, "virtuals", BINFO_VIRTUALS (node),
    1020              :                             indent + 4);
    1021            0 :           print_node_brief (file, "inheritance-chain",
    1022            0 :                             BINFO_INHERITANCE_CHAIN (node),
    1023              :                             indent + 4);
    1024            0 :           break;
    1025              : 
    1026            0 :         default:
    1027            0 :           lang_hooks.print_xnode (file, node, indent);
    1028            0 :           break;
    1029              :         }
    1030              : 
    1031              :       break;
    1032              :     }
    1033              : 
    1034          187 :   if (EXPR_HAS_LOCATION (node))
    1035              :     {
    1036            0 :       expanded_location xloc = expand_location (EXPR_LOCATION (node));
    1037            0 :       indent_to (file, indent+4);
    1038            0 :       fprintf (file, "%s:%d:%d", xloc.file, xloc.line, xloc.column);
    1039              : 
    1040              :       /* Print the range, if any */
    1041            0 :       source_range r = EXPR_LOCATION_RANGE (node);
    1042            0 :       if (r.m_start)
    1043              :         {
    1044            0 :           xloc = expand_location (r.m_start);
    1045            0 :           fprintf (file, " start: %s:%d:%d", xloc.file, xloc.line, xloc.column);
    1046              :         }
    1047              :       else
    1048              :         {
    1049            0 :           fprintf (file, " start: unknown");
    1050              :         }
    1051            0 :       if (r.m_finish)
    1052              :         {
    1053            0 :           xloc = expand_location (r.m_finish);
    1054            0 :           fprintf (file, " finish: %s:%d:%d", xloc.file, xloc.line, xloc.column);
    1055              :         }
    1056              :       else
    1057              :         {
    1058            0 :           fprintf (file, " finish: unknown");
    1059              :         }
    1060              :     }
    1061              : 
    1062          187 :   fprintf (file, ">");
    1063              : }
    1064              : 
    1065              : /* Print the identifier for DECL according to FLAGS.  */
    1066              : 
    1067              : void
    1068          337 : print_decl_identifier (FILE *file, tree decl, int flags)
    1069              : {
    1070          337 :   bool needs_colon = false;
    1071          337 :   const char *name;
    1072          337 :   char c;
    1073              : 
    1074          337 :   if (flags & PRINT_DECL_ORIGIN)
    1075              :     {
    1076          331 :       if (DECL_IS_UNDECLARED_BUILTIN (decl))
    1077            0 :         fputs ("<built-in>", file);
    1078              :       else
    1079              :         {
    1080          331 :           expanded_location loc
    1081          331 :             = expand_location (DECL_SOURCE_LOCATION (decl));
    1082          331 :           const char *f = flags & PRINT_DECL_REMAP_DEBUG
    1083          331 :             ? remap_debug_filename (loc.file)
    1084              :             : loc.file;
    1085          331 :           fprintf (file, "%s:%d:%d", f, loc.line, loc.column);
    1086              :         }
    1087              :       needs_colon = true;
    1088              :     }
    1089              : 
    1090          337 :   if (flags & PRINT_DECL_UNIQUE_NAME)
    1091              :     {
    1092            4 :       name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
    1093            4 :       if (!TREE_PUBLIC (decl)
    1094            4 :           || (DECL_WEAK (decl) && !DECL_EXTERNAL (decl)))
    1095              :         /* The symbol has internal or weak linkage so its assembler name
    1096              :            is not necessarily unique among the compilation units of the
    1097              :            program.  We therefore have to further mangle it.  But we can't
    1098              :            simply use DECL_SOURCE_FILE because it contains the name of the
    1099              :            file the symbol originates from so, e.g. for function templates
    1100              :            in C++ where the templates are defined in a header file, we can
    1101              :            have symbols with the same assembler name and DECL_SOURCE_FILE.
    1102              :            That's why we use the name of the top-level source file of the
    1103              :            compilation unit.  ??? Unnecessary for Ada.  */
    1104            0 :         name = ACONCAT ((main_input_filename, ":", name, NULL));
    1105              :     }
    1106          333 :   else if (flags & PRINT_DECL_NAME)
    1107              :     {
    1108              :       /* We don't want to print the full qualified name because it can be long,
    1109              :          so we strip the scope prefix, but we may need to deal with the suffix
    1110              :          created by the compiler.  */
    1111          331 :       const char *suffix = strchr (IDENTIFIER_POINTER (DECL_NAME (decl)), '.');
    1112          331 :       name = lang_hooks.decl_printable_name (decl, 2);
    1113          331 :       if (suffix)
    1114              :         {
    1115            0 :           const char *dot = strchr (name, '.');
    1116            0 :           while (dot && strcasecmp (dot, suffix) != 0)
    1117              :             {
    1118            0 :               name = dot + 1;
    1119            0 :               dot = strchr (name, '.');
    1120              :             }
    1121              :         }
    1122              :       else
    1123              :         {
    1124          331 :           const char *dot = strrchr (name, '.');
    1125          331 :           if (dot)
    1126            0 :             name = dot + 1;
    1127              :         }
    1128              :     }
    1129              :   else
    1130              :     return;
    1131              : 
    1132          335 :   if (needs_colon)
    1133          329 :     fputc (':', file);
    1134              : 
    1135         3078 :   while ((c = *name++) != '\0')
    1136              :     {
    1137              :       /* Strip double-quotes because of VCG.  */
    1138         2743 :       if (c == '"')
    1139            0 :         continue;
    1140         2743 :       fputc (c, file);
    1141              :     }
    1142              : }
    1143              : 
    1144              : 
    1145              : /* Print the node NODE on standard error, for debugging.
    1146              :    Most nodes referred to by this one are printed recursively
    1147              :    down to a depth of six.  */
    1148              : 
    1149              : DEBUG_FUNCTION void
    1150           20 : debug_tree (tree node)
    1151              : {
    1152           20 :   table = new hash_set<tree> (HASH_SIZE);
    1153           20 :   print_node (stderr, "", node, 0);
    1154           40 :   delete table;
    1155           20 :   table = NULL;
    1156           20 :   putc ('\n', stderr);
    1157           20 : }
    1158              : 
    1159              : DEBUG_FUNCTION void
    1160            0 : debug (tree node)
    1161              : {
    1162            0 :   debug_tree (node);
    1163            0 : }
    1164              : 
    1165              : DEBUG_FUNCTION void
    1166            0 : debug_raw (const tree_node &ref)
    1167              : {
    1168            0 :   debug_tree (const_cast <tree> (&ref));
    1169            0 : }
    1170              : 
    1171              : DEBUG_FUNCTION void
    1172            0 : debug_raw (const tree_node *ptr)
    1173              : {
    1174            0 :   if (ptr)
    1175            0 :     debug_raw (*ptr);
    1176              :   else
    1177            0 :     fprintf (stderr, "<nil>\n");
    1178            0 : }
    1179              : 
    1180              : static void
    1181            0 : dump_tree_via_hooks (const tree_node *ptr, dump_flags_t options)
    1182              : {
    1183            0 :   if (DECL_P (ptr))
    1184            0 :     lang_hooks.print_decl (stderr, const_cast <tree_node*> (ptr), 0);
    1185            0 :   else if (TYPE_P (ptr))
    1186            0 :     lang_hooks.print_type (stderr, const_cast <tree_node*> (ptr), 0);
    1187            0 :   else if (TREE_CODE (ptr) == IDENTIFIER_NODE)
    1188            0 :     lang_hooks.print_identifier (stderr, const_cast <tree_node*> (ptr), 0);
    1189              :   else
    1190            0 :     print_generic_expr (stderr, const_cast <tree_node*> (ptr), options);
    1191            0 :   fprintf (stderr, "\n");
    1192            0 : }
    1193              : 
    1194              : DEBUG_FUNCTION void
    1195            0 : debug (const tree_node &ref)
    1196              : {
    1197            0 :   dump_tree_via_hooks (&ref, TDF_NONE);
    1198            0 : }
    1199              : 
    1200              : DEBUG_FUNCTION void
    1201            0 : debug (const tree_node *ptr)
    1202              : {
    1203            0 :   if (ptr)
    1204            0 :     debug_tree (const_cast <tree> (ptr));
    1205              :   else
    1206            0 :     fprintf (stderr, "<nil>\n");
    1207            0 : }
    1208              : 
    1209              : DEBUG_FUNCTION void
    1210            0 : debug_head (const tree_node &ref)
    1211              : {
    1212            0 :   debug (ref);
    1213            0 : }
    1214              : 
    1215              : DEBUG_FUNCTION void
    1216            0 : debug_head (const tree_node *ptr)
    1217              : {
    1218            0 :   if (ptr)
    1219            0 :     debug_head (*ptr);
    1220              :   else
    1221            0 :     fprintf (stderr, "<nil>\n");
    1222            0 : }
    1223              : 
    1224              : DEBUG_FUNCTION void
    1225            0 : debug_body (const tree_node &ref)
    1226              : {
    1227            0 :   if (TREE_CODE (&ref) == FUNCTION_DECL)
    1228            0 :     dump_function_to_file (const_cast <tree_node*> (&ref), stderr, TDF_NONE);
    1229              :   else
    1230            0 :     debug (ref);
    1231            0 : }
    1232              : 
    1233              : DEBUG_FUNCTION void
    1234            0 : debug_body (const tree_node *ptr)
    1235              : {
    1236            0 :   if (ptr)
    1237            0 :     debug_body (*ptr);
    1238              :   else
    1239            0 :     fprintf (stderr, "<nil>\n");
    1240            0 : }
    1241              : 
    1242              : /* Print the vector of trees VEC on standard error, for debugging.
    1243              :    Most nodes referred to by this one are printed recursively
    1244              :    down to a depth of six.  */
    1245              : 
    1246              : DEBUG_FUNCTION void
    1247            0 : debug_raw (vec<tree, va_gc> &ref)
    1248              : {
    1249            0 :   tree elt;
    1250            0 :   unsigned ix;
    1251              : 
    1252              :   /* Print the slot this node is in, and its code, and address.  */
    1253            0 :   fprintf (stderr, "<VEC");
    1254            0 :   dump_addr (stderr, " ", ref.address ());
    1255              : 
    1256            0 :   FOR_EACH_VEC_ELT (ref, ix, elt)
    1257              :     {
    1258            0 :       fprintf (stderr, "elt:%d ", ix);
    1259            0 :       debug_raw (elt);
    1260              :     }
    1261            0 : }
    1262              : 
    1263              : DEBUG_FUNCTION void
    1264            0 : debug_raw (vec<tree, va_gc> *ptr)
    1265              : {
    1266            0 :   if (ptr)
    1267            0 :     debug_raw (*ptr);
    1268              :   else
    1269            0 :     fprintf (stderr, "<nil>\n");
    1270            0 : }
    1271              : 
    1272              : static void
    1273            0 : debug_slim (tree t)
    1274              : {
    1275            0 :   print_node_brief (stderr, "", t, 0);
    1276            0 : }
    1277              : 
    1278            0 : DEFINE_DEBUG_VEC (tree)
    1279            0 : DEFINE_DEBUG_HASH_SET (tree)
        

Generated by: LCOV version 2.4-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.