OSDN Git Service

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