OSDN Git Service

predicate aware uninitialized analysis
[pf3gnuchains/gcc-fork.git] / gcc / print-tree.c
1 /* Prints out tree in human readable form - GCC
2    Copyright (C) 1990, 1991, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
3    2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
4    Free Software Foundation, Inc.
5
6 This file is part of GCC.
7
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 3, or (at your option) any later
11 version.
12
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
16 for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING3.  If not see
20 <http://www.gnu.org/licenses/>.  */
21
22
23 #include "config.h"
24 #include "system.h"
25 #include "coretypes.h"
26 #include "tm.h"
27 #include "tree.h"
28 #include "ggc.h"
29 #include "langhooks.h"
30 #include "tree-iterator.h"
31 #include "diagnostic.h"
32 #include "gimple-pretty-print.h"
33 #include "tree-flow.h"
34 #include "tree-pass.h"
35
36 /* Define the hash table of nodes already seen.
37    Such nodes are not repeated; brief cross-references are used.  */
38
39 #define HASH_SIZE 37
40
41 struct bucket
42 {
43   tree node;
44   struct bucket *next;
45 };
46
47 static struct bucket **table;
48
49 /* Print the node NODE on standard error, for debugging.
50    Most nodes referred to by this one are printed recursively
51    down to a depth of six.  */
52
53 void
54 debug_tree (tree node)
55 {
56   table = XCNEWVEC (struct bucket *, HASH_SIZE);
57   print_node (stderr, "", node, 0);
58   free (table);
59   table = 0;
60   putc ('\n', stderr);
61 }
62
63 /* Print PREFIX and ADDR to FILE.  */
64 void
65 dump_addr (FILE *file, const char *prefix, const void *addr)
66 {
67   if (flag_dump_noaddr || flag_dump_unnumbered)
68     fprintf (file, "%s#", prefix);
69   else
70     fprintf (file, "%s" HOST_PTR_PRINTF, prefix, addr);
71 }
72
73 /* Print a node in brief fashion, with just the code, address and name.  */
74
75 void
76 print_node_brief (FILE *file, const char *prefix, const_tree node, int indent)
77 {
78   enum tree_code_class tclass;
79
80   if (node == 0)
81     return;
82
83   tclass = TREE_CODE_CLASS (TREE_CODE (node));
84
85   /* Always print the slot this node is in, and its code, address and
86      name if any.  */
87   if (indent > 0)
88     fprintf (file, " ");
89   fprintf (file, "%s <%s", prefix, tree_code_name[(int) TREE_CODE (node)]);
90   dump_addr (file, " ", node);
91
92   if (tclass == tcc_declaration)
93     {
94       if (DECL_NAME (node))
95         fprintf (file, " %s", IDENTIFIER_POINTER (DECL_NAME (node)));
96       else if (TREE_CODE (node) == LABEL_DECL
97                && LABEL_DECL_UID (node) != -1)
98         {
99           if (dump_flags & TDF_NOUID)
100             fprintf (file, " L.xxxx");
101           else
102             fprintf (file, " L.%d", (int) LABEL_DECL_UID (node));
103         }
104       else
105         {
106           if (dump_flags & TDF_NOUID)
107             fprintf (file, " %c.xxxx",
108                      TREE_CODE (node) == CONST_DECL ? 'C' : 'D');
109           else
110             fprintf (file, " %c.%u",
111                      TREE_CODE (node) == CONST_DECL ? 'C' : 'D',
112                      DECL_UID (node));
113         }
114     }
115   else if (tclass == tcc_type)
116     {
117       if (TYPE_NAME (node))
118         {
119           if (TREE_CODE (TYPE_NAME (node)) == IDENTIFIER_NODE)
120             fprintf (file, " %s", IDENTIFIER_POINTER (TYPE_NAME (node)));
121           else if (TREE_CODE (TYPE_NAME (node)) == TYPE_DECL
122                    && DECL_NAME (TYPE_NAME (node)))
123             fprintf (file, " %s",
124                      IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (node))));
125         }
126       if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node)))
127         fprintf (file, " address-space-%d", TYPE_ADDR_SPACE (node));
128     }
129   if (TREE_CODE (node) == IDENTIFIER_NODE)
130     fprintf (file, " %s", IDENTIFIER_POINTER (node));
131
132   /* We might as well always print the value of an integer or real.  */
133   if (TREE_CODE (node) == INTEGER_CST)
134     {
135       if (TREE_OVERFLOW (node))
136         fprintf (file, " overflow");
137
138       fprintf (file, " ");
139       if (TREE_INT_CST_HIGH (node) == 0)
140         fprintf (file, HOST_WIDE_INT_PRINT_UNSIGNED, TREE_INT_CST_LOW (node));
141       else if (TREE_INT_CST_HIGH (node) == -1
142                && TREE_INT_CST_LOW (node) != 0)
143         fprintf (file, "-" HOST_WIDE_INT_PRINT_UNSIGNED,
144                  -TREE_INT_CST_LOW (node));
145       else
146         fprintf (file, HOST_WIDE_INT_PRINT_DOUBLE_HEX,
147                  (unsigned HOST_WIDE_INT) TREE_INT_CST_HIGH (node),
148                  (unsigned HOST_WIDE_INT) TREE_INT_CST_LOW (node));
149     }
150   if (TREE_CODE (node) == REAL_CST)
151     {
152       REAL_VALUE_TYPE d;
153
154       if (TREE_OVERFLOW (node))
155         fprintf (file, " overflow");
156
157       d = TREE_REAL_CST (node);
158       if (REAL_VALUE_ISINF (d))
159         fprintf (file,  REAL_VALUE_NEGATIVE (d) ? " -Inf" : " Inf");
160       else if (REAL_VALUE_ISNAN (d))
161         fprintf (file, " Nan");
162       else
163         {
164           char string[60];
165           real_to_decimal (string, &d, sizeof (string), 0, 1);
166           fprintf (file, " %s", string);
167         }
168     }
169   if (TREE_CODE (node) == FIXED_CST)
170     {
171       FIXED_VALUE_TYPE f;
172       char string[60];
173
174       if (TREE_OVERFLOW (node))
175         fprintf (file, " overflow");
176
177       f = TREE_FIXED_CST (node);
178       fixed_to_decimal (string, &f, sizeof (string));
179       fprintf (file, " %s", string);
180     }
181
182   fprintf (file, ">");
183 }
184
185 void
186 indent_to (FILE *file, int column)
187 {
188   int i;
189
190   /* Since this is the long way, indent to desired column.  */
191   if (column > 0)
192     fprintf (file, "\n");
193   for (i = 0; i < column; i++)
194     fprintf (file, " ");
195 }
196 \f
197 /* Print the node NODE in full on file FILE, preceded by PREFIX,
198    starting in column INDENT.  */
199
200 void
201 print_node (FILE *file, const char *prefix, tree node, int indent)
202 {
203   int hash;
204   struct bucket *b;
205   enum machine_mode mode;
206   enum tree_code_class tclass;
207   int len;
208   int i;
209   expanded_location xloc;
210   enum tree_code code;
211
212   if (node == 0)
213     return;
214
215   code = TREE_CODE (node);
216   tclass = TREE_CODE_CLASS (code);
217
218   /* Don't get too deep in nesting.  If the user wants to see deeper,
219      it is easy to use the address of a lowest-level node
220      as an argument in another call to debug_tree.  */
221
222   if (indent > 24)
223     {
224       print_node_brief (file, prefix, node, indent);
225       return;
226     }
227
228   if (indent > 8 && (tclass == tcc_type || tclass == tcc_declaration))
229     {
230       print_node_brief (file, prefix, node, indent);
231       return;
232     }
233
234   /* It is unsafe to look at any other fields of an ERROR_MARK node.  */
235   if (code == ERROR_MARK)
236     {
237       print_node_brief (file, prefix, node, indent);
238       return;
239     }
240
241   /* Allow this function to be called if the table is not there.  */
242   if (table)
243     {
244       hash = ((unsigned long) node) % HASH_SIZE;
245
246       /* If node is in the table, just mention its address.  */
247       for (b = table[hash]; b; b = b->next)
248         if (b->node == node)
249           {
250             print_node_brief (file, prefix, node, indent);
251             return;
252           }
253
254       /* Add this node to the table.  */
255       b = XNEW (struct bucket);
256       b->node = node;
257       b->next = table[hash];
258       table[hash] = b;
259     }
260
261   /* Indent to the specified column, since this is the long form.  */
262   indent_to (file, indent);
263
264   /* Print the slot this node is in, and its code, and address.  */
265   fprintf (file, "%s <%s", prefix, tree_code_name[(int) code]);
266   dump_addr (file, " ", node);
267
268   /* Print the name, if any.  */
269   if (tclass == tcc_declaration)
270     {
271       if (DECL_NAME (node))
272         fprintf (file, " %s", IDENTIFIER_POINTER (DECL_NAME (node)));
273       else if (code == LABEL_DECL
274                && LABEL_DECL_UID (node) != -1)
275         {
276           if (dump_flags & TDF_NOUID)
277             fprintf (file, " L.xxxx");
278           else
279             fprintf (file, " L.%d", (int) LABEL_DECL_UID (node));
280         }
281       else
282         {
283           if (dump_flags & TDF_NOUID)
284             fprintf (file, " %c.xxxx", code == CONST_DECL ? 'C' : 'D');
285           else
286             fprintf (file, " %c.%u", code == CONST_DECL ? 'C' : 'D',
287                      DECL_UID (node));
288         }
289     }
290   else if (tclass == tcc_type)
291     {
292       if (TYPE_NAME (node))
293         {
294           if (TREE_CODE (TYPE_NAME (node)) == IDENTIFIER_NODE)
295             fprintf (file, " %s", IDENTIFIER_POINTER (TYPE_NAME (node)));
296           else if (TREE_CODE (TYPE_NAME (node)) == TYPE_DECL
297                    && DECL_NAME (TYPE_NAME (node)))
298             fprintf (file, " %s",
299                      IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (node))));
300         }
301     }
302   if (code == IDENTIFIER_NODE)
303     fprintf (file, " %s", IDENTIFIER_POINTER (node));
304
305   if (code == INTEGER_CST)
306     {
307       if (indent <= 4)
308         print_node_brief (file, "type", TREE_TYPE (node), indent + 4);
309     }
310   else
311     {
312       print_node (file, "type", TREE_TYPE (node), indent + 4);
313       if (TREE_TYPE (node))
314         indent_to (file, indent + 3);
315     }
316
317   if (!TYPE_P (node) && TREE_SIDE_EFFECTS (node))
318     fputs (" side-effects", file);
319
320   if (TYPE_P (node) ? TYPE_READONLY (node) : TREE_READONLY (node))
321     fputs (" readonly", file);
322   if (!TYPE_P (node) && TREE_CONSTANT (node))
323     fputs (" constant", file);
324   else if (TYPE_P (node) && TYPE_SIZES_GIMPLIFIED (node))
325     fputs (" sizes-gimplified", file);
326
327   if (TYPE_P (node) && !ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node)))
328     fprintf (file, " address-space-%d", TYPE_ADDR_SPACE (node));
329
330   if (TREE_ADDRESSABLE (node))
331     fputs (" addressable", file);
332   if (TREE_THIS_VOLATILE (node))
333     fputs (" volatile", file);
334   if (TREE_ASM_WRITTEN (node))
335     fputs (" asm_written", file);
336   if (TREE_USED (node))
337     fputs (" used", file);
338   if (TREE_NOTHROW (node))
339     fputs (TYPE_P (node) ? " align-ok" : " nothrow", file);
340   if (TREE_PUBLIC (node))
341     fputs (" public", file);
342   if (TREE_PRIVATE (node))
343     fputs (" private", file);
344   if (TREE_PROTECTED (node))
345     fputs (" protected", file);
346   if (TREE_STATIC (node))
347     fputs (" static", file);
348   if (TREE_DEPRECATED (node))
349     fputs (" deprecated", file);
350   if (TREE_VISITED (node))
351     fputs (" visited", file);
352   if (TREE_LANG_FLAG_0 (node))
353     fputs (" tree_0", file);
354   if (TREE_LANG_FLAG_1 (node))
355     fputs (" tree_1", file);
356   if (TREE_LANG_FLAG_2 (node))
357     fputs (" tree_2", file);
358   if (TREE_LANG_FLAG_3 (node))
359     fputs (" tree_3", file);
360   if (TREE_LANG_FLAG_4 (node))
361     fputs (" tree_4", file);
362   if (TREE_LANG_FLAG_5 (node))
363     fputs (" tree_5", file);
364   if (TREE_LANG_FLAG_6 (node))
365     fputs (" tree_6", file);
366
367   /* DECL_ nodes have additional attributes.  */
368
369   switch (TREE_CODE_CLASS (code))
370     {
371     case tcc_declaration:
372       if (CODE_CONTAINS_STRUCT (code, TS_DECL_COMMON))
373         {
374           if (DECL_UNSIGNED (node))
375             fputs (" unsigned", file);
376           if (DECL_IGNORED_P (node))
377             fputs (" ignored", file);
378           if (DECL_ABSTRACT (node))
379             fputs (" abstract", file);
380           if (DECL_EXTERNAL (node))
381             fputs (" external", file);
382           if (DECL_NONLOCAL (node))
383             fputs (" nonlocal", file);
384         }
385       if (CODE_CONTAINS_STRUCT (code, TS_DECL_WITH_VIS))
386         {
387           if (DECL_WEAK (node))
388             fputs (" weak", file);
389           if (DECL_IN_SYSTEM_HEADER (node))
390             fputs (" in_system_header", file);
391         }
392       if (CODE_CONTAINS_STRUCT (code, TS_DECL_WRTL)
393           && code != LABEL_DECL
394           && code != FUNCTION_DECL
395           && DECL_REGISTER (node))
396         fputs (" regdecl", file);
397
398       if (code == TYPE_DECL && TYPE_DECL_SUPPRESS_DEBUG (node))
399         fputs (" suppress-debug", file);
400
401       if (code == FUNCTION_DECL
402           && DECL_FUNCTION_SPECIFIC_TARGET (node))
403         fputs (" function-specific-target", file);
404       if (code == FUNCTION_DECL
405           && DECL_FUNCTION_SPECIFIC_OPTIMIZATION (node))
406         fputs (" function-specific-opt", file);
407       if (code == FUNCTION_DECL && DECL_DECLARED_INLINE_P (node))
408         fputs (" autoinline", file);
409       if (code == FUNCTION_DECL && DECL_BUILT_IN (node))
410         fputs (" built-in", file);
411       if (code == FUNCTION_DECL && DECL_STATIC_CHAIN (node))
412         fputs (" static-chain", file);
413
414       if (code == FIELD_DECL && DECL_PACKED (node))
415         fputs (" packed", file);
416       if (code == FIELD_DECL && DECL_BIT_FIELD (node))
417         fputs (" bit-field", file);
418       if (code == FIELD_DECL && DECL_NONADDRESSABLE_P (node))
419         fputs (" nonaddressable", file);
420
421       if (code == LABEL_DECL && DECL_ERROR_ISSUED (node))
422         fputs (" error-issued", file);
423       if (code == LABEL_DECL && EH_LANDING_PAD_NR (node))
424         fprintf (file, " landing-pad:%d", EH_LANDING_PAD_NR (node));
425
426       if (code == VAR_DECL && DECL_IN_TEXT_SECTION (node))
427         fputs (" in-text-section", file);
428       if (code == VAR_DECL && DECL_COMMON (node))
429         fputs (" common", file);
430       if (code == VAR_DECL && DECL_THREAD_LOCAL_P (node))
431         {
432           enum tls_model kind = DECL_TLS_MODEL (node);
433           switch (kind)
434             {
435               case TLS_MODEL_GLOBAL_DYNAMIC:
436                 fputs (" tls-global-dynamic", file);
437                 break;
438               case TLS_MODEL_LOCAL_DYNAMIC:
439                 fputs (" tls-local-dynamic", file);
440                 break;
441               case TLS_MODEL_INITIAL_EXEC:
442                 fputs (" tls-initial-exec", file);
443                 break;
444               case TLS_MODEL_LOCAL_EXEC:
445                 fputs (" tls-local-exec", file);
446                 break;
447               default:
448                 gcc_unreachable ();
449             }
450         }
451
452       if (CODE_CONTAINS_STRUCT (code, TS_DECL_COMMON))
453         {
454           if (DECL_VIRTUAL_P (node))
455             fputs (" virtual", file);
456           if (DECL_PRESERVE_P (node))
457             fputs (" preserve", file);
458           if (DECL_LANG_FLAG_0 (node))
459             fputs (" decl_0", file);
460           if (DECL_LANG_FLAG_1 (node))
461             fputs (" decl_1", file);
462           if (DECL_LANG_FLAG_2 (node))
463             fputs (" decl_2", file);
464           if (DECL_LANG_FLAG_3 (node))
465             fputs (" decl_3", file);
466           if (DECL_LANG_FLAG_4 (node))
467             fputs (" decl_4", file);
468           if (DECL_LANG_FLAG_5 (node))
469             fputs (" decl_5", file);
470           if (DECL_LANG_FLAG_6 (node))
471             fputs (" decl_6", file);
472           if (DECL_LANG_FLAG_7 (node))
473             fputs (" decl_7", file);
474
475           mode = DECL_MODE (node);
476           fprintf (file, " %s", GET_MODE_NAME (mode));
477         }
478
479       if ((code == VAR_DECL || code == PARM_DECL || code == RESULT_DECL)
480           && DECL_BY_REFERENCE (node))
481         fputs (" passed-by-reference", file);
482
483       if (CODE_CONTAINS_STRUCT (code, TS_DECL_WITH_VIS)  && DECL_DEFER_OUTPUT (node))
484         fputs (" defer-output", file);
485
486
487       xloc = expand_location (DECL_SOURCE_LOCATION (node));
488       fprintf (file, " file %s line %d col %d", xloc.file, xloc.line,
489                xloc.column);
490
491       if (CODE_CONTAINS_STRUCT (code, TS_DECL_COMMON))
492         {
493           print_node (file, "size", DECL_SIZE (node), indent + 4);
494           print_node (file, "unit size", DECL_SIZE_UNIT (node), indent + 4);
495
496           if (code != FUNCTION_DECL || DECL_BUILT_IN (node))
497             indent_to (file, indent + 3);
498
499           if (DECL_USER_ALIGN (node))
500             fprintf (file, " user");
501
502           fprintf (file, " align %d", DECL_ALIGN (node));
503           if (code == FIELD_DECL)
504             fprintf (file, " offset_align " HOST_WIDE_INT_PRINT_UNSIGNED,
505                      DECL_OFFSET_ALIGN (node));
506
507           if (code == FUNCTION_DECL && DECL_BUILT_IN (node))
508             {
509               if (DECL_BUILT_IN_CLASS (node) == BUILT_IN_MD)
510                 fprintf (file, " built-in BUILT_IN_MD %d", DECL_FUNCTION_CODE (node));
511               else
512                 fprintf (file, " built-in %s:%s",
513                          built_in_class_names[(int) DECL_BUILT_IN_CLASS (node)],
514                          built_in_names[(int) DECL_FUNCTION_CODE (node)]);
515             }
516         }
517       if (code == FIELD_DECL)
518         {
519           print_node (file, "offset", DECL_FIELD_OFFSET (node), indent + 4);
520           print_node (file, "bit offset", DECL_FIELD_BIT_OFFSET (node),
521                       indent + 4);
522           if (DECL_BIT_FIELD_TYPE (node))
523             print_node (file, "bit_field_type", DECL_BIT_FIELD_TYPE (node),
524                         indent + 4);
525         }
526
527       print_node_brief (file, "context", DECL_CONTEXT (node), indent + 4);
528
529       if (CODE_CONTAINS_STRUCT (code, TS_DECL_COMMON))
530         {
531           print_node_brief (file, "attributes",
532                             DECL_ATTRIBUTES (node), indent + 4);
533           if (code != PARM_DECL)
534             print_node_brief (file, "initial", DECL_INITIAL (node),
535                               indent + 4);
536         }
537       if (CODE_CONTAINS_STRUCT (code, TS_DECL_WRTL))
538         {
539           print_node_brief (file, "abstract_origin",
540                             DECL_ABSTRACT_ORIGIN (node), indent + 4);
541         }
542       if (CODE_CONTAINS_STRUCT (code, TS_DECL_NON_COMMON))
543         {
544           print_node (file, "arguments", DECL_ARGUMENT_FLD (node), indent + 4);
545           print_node (file, "result", DECL_RESULT_FLD (node), indent + 4);
546         }
547
548       lang_hooks.print_decl (file, node, indent);
549
550       if (DECL_RTL_SET_P (node))
551         {
552           indent_to (file, indent + 4);
553           print_rtl (file, DECL_RTL (node));
554         }
555
556       if (code == PARM_DECL)
557         {
558           print_node (file, "arg-type", DECL_ARG_TYPE (node), indent + 4);
559
560           if (DECL_INCOMING_RTL (node) != 0)
561             {
562               indent_to (file, indent + 4);
563               fprintf (file, "incoming-rtl ");
564               print_rtl (file, DECL_INCOMING_RTL (node));
565             }
566         }
567       else if (code == FUNCTION_DECL
568                && DECL_STRUCT_FUNCTION (node) != 0)
569         {
570           indent_to (file, indent + 4);
571           dump_addr (file, "struct-function ", DECL_STRUCT_FUNCTION (node));
572         }
573
574       if ((code == VAR_DECL || code == PARM_DECL)
575           && DECL_HAS_VALUE_EXPR_P (node))
576         print_node (file, "value-expr", DECL_VALUE_EXPR (node), indent + 4);
577
578       /* Print the decl chain only if decl is at second level.  */
579       if (indent == 4)
580         print_node (file, "chain", TREE_CHAIN (node), indent + 4);
581       else
582         print_node_brief (file, "chain", TREE_CHAIN (node), indent + 4);
583       break;
584
585     case tcc_type:
586       if (TYPE_UNSIGNED (node))
587         fputs (" unsigned", file);
588
589       /* The no-force-blk flag is used for different things in
590          different types.  */
591       if ((code == RECORD_TYPE
592            || code == UNION_TYPE
593            || code == QUAL_UNION_TYPE)
594           && TYPE_NO_FORCE_BLK (node))
595         fputs (" no-force-blk", file);
596       else if (code == INTEGER_TYPE
597                && TYPE_IS_SIZETYPE (node))
598         fputs (" sizetype", file);
599
600       if (TYPE_STRING_FLAG (node))
601         fputs (" string-flag", file);
602       if (TYPE_NEEDS_CONSTRUCTING (node))
603         fputs (" needs-constructing", file);
604
605       /* The transparent-union flag is used for different things in
606          different nodes.  */
607       if ((code == UNION_TYPE || code == RECORD_TYPE)
608           && TYPE_TRANSPARENT_AGGR (node))
609         fputs (" transparent-aggr", file);
610       else if (code == ARRAY_TYPE
611                && TYPE_NONALIASED_COMPONENT (node))
612         fputs (" nonaliased-component", file);
613
614       if (TYPE_PACKED (node))
615         fputs (" packed", file);
616
617       if (TYPE_RESTRICT (node))
618         fputs (" restrict", file);
619
620       if (TYPE_LANG_FLAG_0 (node))
621         fputs (" type_0", file);
622       if (TYPE_LANG_FLAG_1 (node))
623         fputs (" type_1", file);
624       if (TYPE_LANG_FLAG_2 (node))
625         fputs (" type_2", file);
626       if (TYPE_LANG_FLAG_3 (node))
627         fputs (" type_3", file);
628       if (TYPE_LANG_FLAG_4 (node))
629         fputs (" type_4", file);
630       if (TYPE_LANG_FLAG_5 (node))
631         fputs (" type_5", file);
632       if (TYPE_LANG_FLAG_6 (node))
633         fputs (" type_6", file);
634
635       mode = TYPE_MODE (node);
636       fprintf (file, " %s", GET_MODE_NAME (mode));
637
638       print_node (file, "size", TYPE_SIZE (node), indent + 4);
639       print_node (file, "unit size", TYPE_SIZE_UNIT (node), indent + 4);
640       indent_to (file, indent + 3);
641
642       if (TYPE_USER_ALIGN (node))
643         fprintf (file, " user");
644
645       fprintf (file, " align %d symtab %d alias set " HOST_WIDE_INT_PRINT_DEC,
646                TYPE_ALIGN (node), TYPE_SYMTAB_ADDRESS (node),
647                (HOST_WIDE_INT) TYPE_ALIAS_SET (node));
648
649       if (TYPE_STRUCTURAL_EQUALITY_P (node))
650         fprintf (file, " structural equality");
651       else
652         dump_addr (file, " canonical type ", TYPE_CANONICAL (node));
653
654       print_node (file, "attributes", TYPE_ATTRIBUTES (node), indent + 4);
655
656       if (INTEGRAL_TYPE_P (node) || code == REAL_TYPE
657           || code == FIXED_POINT_TYPE)
658         {
659           fprintf (file, " precision %d", TYPE_PRECISION (node));
660           print_node_brief (file, "min", TYPE_MIN_VALUE (node), indent + 4);
661           print_node_brief (file, "max", TYPE_MAX_VALUE (node), indent + 4);
662         }
663
664       if (code == ENUMERAL_TYPE)
665         print_node (file, "values", TYPE_VALUES (node), indent + 4);
666       else if (code == ARRAY_TYPE)
667         print_node (file, "domain", TYPE_DOMAIN (node), indent + 4);
668       else if (code == VECTOR_TYPE)
669         fprintf (file, " nunits %d", (int) TYPE_VECTOR_SUBPARTS (node));
670       else if (code == RECORD_TYPE
671                || code == UNION_TYPE
672                || code == QUAL_UNION_TYPE)
673         print_node (file, "fields", TYPE_FIELDS (node), indent + 4);
674       else if (code == FUNCTION_TYPE
675                || code == METHOD_TYPE)
676         {
677           if (TYPE_METHOD_BASETYPE (node))
678             print_node_brief (file, "method basetype",
679                               TYPE_METHOD_BASETYPE (node), indent + 4);
680           print_node (file, "arg-types", TYPE_ARG_TYPES (node), indent + 4);
681         }
682       else if (code == OFFSET_TYPE)
683         print_node_brief (file, "basetype", TYPE_OFFSET_BASETYPE (node),
684                           indent + 4);
685
686       if (TYPE_CONTEXT (node))
687         print_node_brief (file, "context", TYPE_CONTEXT (node), indent + 4);
688
689       lang_hooks.print_type (file, node, indent);
690
691       if (TYPE_POINTER_TO (node) || TREE_CHAIN (node))
692         indent_to (file, indent + 3);
693
694       print_node_brief (file, "pointer_to_this", TYPE_POINTER_TO (node),
695                         indent + 4);
696       print_node_brief (file, "reference_to_this", TYPE_REFERENCE_TO (node),
697                         indent + 4);
698       print_node_brief (file, "chain", TREE_CHAIN (node), indent + 4);
699       break;
700
701     case tcc_expression:
702     case tcc_comparison:
703     case tcc_unary:
704     case tcc_binary:
705     case tcc_reference:
706     case tcc_statement:
707     case tcc_vl_exp:
708       if (code == BIND_EXPR)
709         {
710           print_node (file, "vars", TREE_OPERAND (node, 0), indent + 4);
711           print_node (file, "body", TREE_OPERAND (node, 1), indent + 4);
712           print_node (file, "block", TREE_OPERAND (node, 2), indent + 4);
713           break;
714         }
715       if (code == CALL_EXPR)
716         {
717           call_expr_arg_iterator iter;
718           tree arg;
719           print_node (file, "fn", CALL_EXPR_FN (node), indent + 4);
720           print_node (file, "static_chain", CALL_EXPR_STATIC_CHAIN (node),
721                       indent + 4);
722           i = 0;
723           FOR_EACH_CALL_EXPR_ARG (arg, iter, node)
724             {
725               char temp[10];
726               sprintf (temp, "arg %d", i);
727               print_node (file, temp, arg, indent + 4);
728               i++;
729             }
730         }
731       else
732         {
733           len = TREE_OPERAND_LENGTH (node);
734
735           for (i = 0; i < len; i++)
736             {
737               char temp[10];
738
739               sprintf (temp, "arg %d", i);
740               print_node (file, temp, TREE_OPERAND (node, i), indent + 4);
741             }
742         }
743       print_node (file, "chain", TREE_CHAIN (node), indent + 4);
744       break;
745
746     case tcc_constant:
747     case tcc_exceptional:
748       switch (code)
749         {
750         case INTEGER_CST:
751           if (TREE_OVERFLOW (node))
752             fprintf (file, " overflow");
753
754           fprintf (file, " ");
755           if (TREE_INT_CST_HIGH (node) == 0)
756             fprintf (file, HOST_WIDE_INT_PRINT_UNSIGNED,
757                      TREE_INT_CST_LOW (node));
758           else if (TREE_INT_CST_HIGH (node) == -1
759                    && TREE_INT_CST_LOW (node) != 0)
760             fprintf (file, "-" HOST_WIDE_INT_PRINT_UNSIGNED,
761                      -TREE_INT_CST_LOW (node));
762           else
763             fprintf (file, HOST_WIDE_INT_PRINT_DOUBLE_HEX,
764                      (unsigned HOST_WIDE_INT) TREE_INT_CST_HIGH (node),
765                      (unsigned HOST_WIDE_INT) TREE_INT_CST_LOW (node));
766           break;
767
768         case REAL_CST:
769           {
770             REAL_VALUE_TYPE d;
771
772             if (TREE_OVERFLOW (node))
773               fprintf (file, " overflow");
774
775             d = TREE_REAL_CST (node);
776             if (REAL_VALUE_ISINF (d))
777               fprintf (file,  REAL_VALUE_NEGATIVE (d) ? " -Inf" : " Inf");
778             else if (REAL_VALUE_ISNAN (d))
779               fprintf (file, " Nan");
780             else
781               {
782                 char string[64];
783                 real_to_decimal (string, &d, sizeof (string), 0, 1);
784                 fprintf (file, " %s", string);
785               }
786           }
787           break;
788
789         case FIXED_CST:
790           {
791             FIXED_VALUE_TYPE f;
792             char string[64];
793
794             if (TREE_OVERFLOW (node))
795               fprintf (file, " overflow");
796
797             f = TREE_FIXED_CST (node);
798             fixed_to_decimal (string, &f, sizeof (string));
799             fprintf (file, " %s", string);
800           }
801           break;
802
803         case VECTOR_CST:
804           {
805             tree vals = TREE_VECTOR_CST_ELTS (node);
806             char buf[10];
807             tree link;
808             int i;
809
810             i = 0;
811             for (link = vals; link; link = TREE_CHAIN (link), ++i)
812               {
813                 sprintf (buf, "elt%d: ", i);
814                 print_node (file, buf, TREE_VALUE (link), indent + 4);
815               }
816           }
817           break;
818
819         case COMPLEX_CST:
820           print_node (file, "real", TREE_REALPART (node), indent + 4);
821           print_node (file, "imag", TREE_IMAGPART (node), indent + 4);
822           break;
823
824         case STRING_CST:
825           {
826             const char *p = TREE_STRING_POINTER (node);
827             int i = TREE_STRING_LENGTH (node);
828             fputs (" \"", file);
829             while (--i >= 0)
830               {
831                 char ch = *p++;
832                 if (ch >= ' ' && ch < 127)
833                   putc (ch, file);
834                 else
835                   fprintf(file, "\\%03o", ch & 0xFF);
836               }
837             fputc ('\"', file);
838           }
839           /* Print the chain at second level.  */
840           if (indent == 4)
841             print_node (file, "chain", TREE_CHAIN (node), indent + 4);
842           else
843             print_node_brief (file, "chain", TREE_CHAIN (node), indent + 4);
844           break;
845
846         case IDENTIFIER_NODE:
847           lang_hooks.print_identifier (file, node, indent);
848           break;
849
850         case TREE_LIST:
851           print_node (file, "purpose", TREE_PURPOSE (node), indent + 4);
852           print_node (file, "value", TREE_VALUE (node), indent + 4);
853           print_node (file, "chain", TREE_CHAIN (node), indent + 4);
854           break;
855
856         case TREE_VEC:
857           len = TREE_VEC_LENGTH (node);
858           for (i = 0; i < len; i++)
859             if (TREE_VEC_ELT (node, i))
860               {
861                 char temp[10];
862                 sprintf (temp, "elt %d", i);
863                 indent_to (file, indent + 4);
864                 print_node_brief (file, temp, TREE_VEC_ELT (node, i), 0);
865               }
866           break;
867
868         case CONSTRUCTOR:
869           {
870             unsigned HOST_WIDE_INT cnt;
871             tree index, value;
872             len = VEC_length (constructor_elt, CONSTRUCTOR_ELTS (node));
873             fprintf (file, " lngt %d", len);
874             FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (node),
875                                       cnt, index, value)
876               {
877                 print_node (file, "idx", index, indent + 4);
878                 print_node (file, "val", value, indent + 4);
879               }
880           }
881           break;
882
883         case STATEMENT_LIST:
884           dump_addr (file, " head ", node->stmt_list.head);
885           dump_addr (file, " tail ", node->stmt_list.tail);
886           fprintf (file, " stmts");
887           {
888             tree_stmt_iterator i;
889             for (i = tsi_start (node); !tsi_end_p (i); tsi_next (&i))
890               {
891                 /* Not printing the addresses of the (not-a-tree)
892                    'struct tree_stmt_list_node's.  */
893                 dump_addr (file, " ", tsi_stmt (i));
894               }
895             fprintf (file, "\n");
896             for (i = tsi_start (node); !tsi_end_p (i); tsi_next (&i))
897               {
898                 /* Not printing the addresses of the (not-a-tree)
899                    'struct tree_stmt_list_node's.  */
900                 print_node (file, "stmt", tsi_stmt (i), indent + 4);
901               }
902           }
903           print_node (file, "chain", TREE_CHAIN (node), indent + 4);
904           break;
905
906         case BLOCK:
907           print_node (file, "vars", BLOCK_VARS (node), indent + 4);
908           print_node (file, "supercontext", BLOCK_SUPERCONTEXT (node),
909                       indent + 4);
910           print_node (file, "subblocks", BLOCK_SUBBLOCKS (node), indent + 4);
911           print_node (file, "chain", BLOCK_CHAIN (node), indent + 4);
912           print_node (file, "abstract_origin",
913                       BLOCK_ABSTRACT_ORIGIN (node), indent + 4);
914           break;
915
916         case SSA_NAME:
917           print_node_brief (file, "var", SSA_NAME_VAR (node), indent + 4);
918           fprintf (file, "def_stmt ");
919           print_gimple_stmt (file, SSA_NAME_DEF_STMT (node), indent + 4, 0);
920
921           indent_to (file, indent + 4);
922           fprintf (file, "version %u", SSA_NAME_VERSION (node));
923           if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (node))
924             fprintf (file, " in-abnormal-phi");
925           if (SSA_NAME_IN_FREE_LIST (node))
926             fprintf (file, " in-free-list");
927
928           if (SSA_NAME_PTR_INFO (node))
929             {
930               indent_to (file, indent + 3);
931               if (SSA_NAME_PTR_INFO (node))
932                 dump_addr (file, " ptr-info ", SSA_NAME_PTR_INFO (node));
933             }
934           break;
935
936         case OMP_CLAUSE:
937             {
938               int i;
939               fprintf (file, " %s",
940                        omp_clause_code_name[OMP_CLAUSE_CODE (node)]);
941               for (i = 0; i < omp_clause_num_ops[OMP_CLAUSE_CODE (node)]; i++)
942                 {
943                   indent_to (file, indent + 4);
944                   fprintf (file, "op %d:", i);
945                   print_node_brief (file, "", OMP_CLAUSE_OPERAND (node, i), 0);
946                 }
947             }
948           break;
949
950         case OPTIMIZATION_NODE:
951           cl_optimization_print (file, indent + 4, TREE_OPTIMIZATION (node));
952           break;
953
954         case TARGET_OPTION_NODE:
955           cl_target_option_print (file, indent + 4, TREE_TARGET_OPTION (node));
956           break;
957         case IMPORTED_DECL:
958           fprintf (file, " imported declaration");
959           print_node_brief (file, "associated declaration",
960                             IMPORTED_DECL_ASSOCIATED_DECL (node),
961                             indent + 4);
962           break;
963
964         default:
965           if (EXCEPTIONAL_CLASS_P (node))
966             lang_hooks.print_xnode (file, node, indent);
967           break;
968         }
969
970       break;
971     }
972
973   if (EXPR_HAS_LOCATION (node))
974     {
975       expanded_location xloc = expand_location (EXPR_LOCATION (node));
976       indent_to (file, indent+4);
977       fprintf (file, "%s:%d:%d", xloc.file, xloc.line, xloc.column);
978     }
979
980   fprintf (file, ">");
981 }