OSDN Git Service

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