OSDN Git Service

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