OSDN Git Service

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