OSDN Git Service

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