]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/print-tree.c
Remove obstacks.
[thirdparty/gcc.git] / gcc / print-tree.c
CommitLineData
52eeef3a 1/* Prints out tree in human readable form - GNU C-compiler
06ceef4e
RK
2 Copyright (C) 1990, 1991, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000
3 Free Software Foundation, Inc.
52eeef3a
RS
4
5This file is part of GNU CC.
6
7GNU CC is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 2, or (at your option)
10any later version.
11
12GNU CC is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with GNU CC; see the file COPYING. If not, write to
e99215a3
RK
19the Free Software Foundation, 59 Temple Place - Suite 330,
20Boston, MA 02111-1307, USA. */
52eeef3a
RS
21
22
23#include "config.h"
670ee920 24#include "system.h"
52eeef3a 25#include "tree.h"
a3770a81 26#include "ggc.h"
52eeef3a 27
52eeef3a
RS
28/* Define the hash table of nodes already seen.
29 Such nodes are not repeated; brief cross-references are used. */
30
31#define HASH_SIZE 37
32
33struct bucket
34{
35 tree node;
36 struct bucket *next;
37};
38
39static struct bucket **table;
40
41/* Print the node NODE on standard error, for debugging.
42 Most nodes referred to by this one are printed recursively
43 down to a depth of six. */
44
45void
46debug_tree (node)
47 tree node;
48{
1f8f4a0b 49 table = (struct bucket **) permalloc (HASH_SIZE * sizeof (struct bucket *));
4c9a05bc 50 bzero ((char *) table, HASH_SIZE * sizeof (struct bucket *));
52eeef3a
RS
51 print_node (stderr, "", node, 0);
52 table = 0;
52eeef3a
RS
53 fprintf (stderr, "\n");
54}
55
56/* Print a node in brief fashion, with just the code, address and name. */
57
58void
59print_node_brief (file, prefix, node, indent)
60 FILE *file;
5d5993dd 61 const char *prefix;
52eeef3a
RS
62 tree node;
63 int indent;
64{
65 char class;
66
67 if (node == 0)
68 return;
69
70 class = TREE_CODE_CLASS (TREE_CODE (node));
71
72 /* Always print the slot this node is in, and its code, address and
73 name if any. */
74 if (indent > 0)
75 fprintf (file, " ");
906c4e36 76 fprintf (file, "%s <%s ", prefix, tree_code_name[(int) TREE_CODE (node)]);
7bcac048 77 fprintf (file, HOST_PTR_PRINTF, (char *) node);
52eeef3a
RS
78
79 if (class == 'd')
80 {
81 if (DECL_NAME (node))
82 fprintf (file, " %s", IDENTIFIER_POINTER (DECL_NAME (node)));
83 }
84 else if (class == 't')
85 {
86 if (TYPE_NAME (node))
87 {
88 if (TREE_CODE (TYPE_NAME (node)) == IDENTIFIER_NODE)
89 fprintf (file, " %s", IDENTIFIER_POINTER (TYPE_NAME (node)));
90 else if (TREE_CODE (TYPE_NAME (node)) == TYPE_DECL
91 && DECL_NAME (TYPE_NAME (node)))
92 fprintf (file, " %s",
93 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (node))));
94 }
95 }
96 if (TREE_CODE (node) == IDENTIFIER_NODE)
97 fprintf (file, " %s", IDENTIFIER_POINTER (node));
98 /* We might as well always print the value of an integer. */
99 if (TREE_CODE (node) == INTEGER_CST)
100 {
3e5f8018
RK
101 if (TREE_CONSTANT_OVERFLOW (node))
102 fprintf (file, " overflow");
103
1e66ce77 104 fprintf (file, " ");
52eeef3a 105 if (TREE_INT_CST_HIGH (node) == 0)
1e66ce77 106 fprintf (file, HOST_WIDE_INT_PRINT_UNSIGNED, TREE_INT_CST_LOW (node));
52eeef3a
RS
107 else if (TREE_INT_CST_HIGH (node) == -1
108 && TREE_INT_CST_LOW (node) != 0)
1e66ce77
RK
109 {
110 fprintf (file, "-");
111 fprintf (file, HOST_WIDE_INT_PRINT_UNSIGNED,
05bccae2 112 -TREE_INT_CST_LOW (node));
1e66ce77 113 }
52eeef3a 114 else
1e66ce77 115 fprintf (file, HOST_WIDE_INT_PRINT_DOUBLE_HEX,
906c4e36 116 TREE_INT_CST_HIGH (node), TREE_INT_CST_LOW (node));
52eeef3a
RS
117 }
118 if (TREE_CODE (node) == REAL_CST)
119 {
7063dcbe
RK
120 REAL_VALUE_TYPE d;
121
86b38416
RK
122 if (TREE_OVERFLOW (node))
123 fprintf (file, " overflow");
124
125#if !defined(REAL_IS_NOT_DOUBLE) || defined(REAL_ARITHMETIC)
7063dcbe 126 d = TREE_REAL_CST (node);
86b38416
RK
127 if (REAL_VALUE_ISINF (d))
128 fprintf (file, " Inf");
129 else if (REAL_VALUE_ISNAN (d))
130 fprintf (file, " Nan");
131 else
132 {
133 char string[100];
134
135 REAL_VALUE_TO_DECIMAL (d, "%e", string);
136 fprintf (file, " %s", string);
137 }
52eeef3a
RS
138#else
139 {
140 int i;
48daf828 141 unsigned char *p = (unsigned char *) &TREE_REAL_CST (node);
52eeef3a
RS
142 fprintf (file, " 0x");
143 for (i = 0; i < sizeof TREE_REAL_CST (node); i++)
144 fprintf (file, "%02x", *p++);
145 fprintf (file, "");
146 }
86b38416 147#endif
52eeef3a
RS
148 }
149
150 fprintf (file, ">");
151}
152
153void
154indent_to (file, column)
155 FILE *file;
156 int column;
157{
158 int i;
159
160 /* Since this is the long way, indent to desired column. */
161 if (column > 0)
162 fprintf (file, "\n");
163 for (i = 0; i < column; i++)
164 fprintf (file, " ");
165}
166\f
167/* Print the node NODE in full on file FILE, preceded by PREFIX,
168 starting in column INDENT. */
169
170void
171print_node (file, prefix, node, indent)
172 FILE *file;
5d5993dd 173 const char *prefix;
52eeef3a
RS
174 tree node;
175 int indent;
176{
177 int hash;
178 struct bucket *b;
179 enum machine_mode mode;
180 char class;
181 int len;
182 int first_rtl;
183 int i;
184
185 if (node == 0)
186 return;
187
188 class = TREE_CODE_CLASS (TREE_CODE (node));
189
190 /* Don't get too deep in nesting. If the user wants to see deeper,
191 it is easy to use the address of a lowest-level node
192 as an argument in another call to debug_tree. */
193
194 if (indent > 24)
195 {
196 print_node_brief (file, prefix, node, indent);
197 return;
198 }
199
200 if (indent > 8 && (class == 't' || class == 'd'))
201 {
202 print_node_brief (file, prefix, node, indent);
203 return;
204 }
205
0f41302f 206 /* It is unsafe to look at any other filds of an ERROR_MARK node. */
52eeef3a
RS
207 if (TREE_CODE (node) == ERROR_MARK)
208 {
209 print_node_brief (file, prefix, node, indent);
210 return;
211 }
212
7bcac048 213 hash = ((unsigned long) node) % HASH_SIZE;
52eeef3a
RS
214
215 /* If node is in the table, just mention its address. */
216 for (b = table[hash]; b; b = b->next)
217 if (b->node == node)
218 {
219 print_node_brief (file, prefix, node, indent);
220 return;
221 }
222
223 /* Add this node to the table. */
1f8f4a0b 224 b = (struct bucket *) permalloc (sizeof (struct bucket));
52eeef3a
RS
225 b->node = node;
226 b->next = table[hash];
227 table[hash] = b;
228
229 /* Indent to the specified column, since this is the long form. */
230 indent_to (file, indent);
231
232 /* Print the slot this node is in, and its code, and address. */
906c4e36 233 fprintf (file, "%s <%s ", prefix, tree_code_name[(int) TREE_CODE (node)]);
7bcac048 234 fprintf (file, HOST_PTR_PRINTF, (char *) node);
52eeef3a
RS
235
236 /* Print the name, if any. */
237 if (class == 'd')
238 {
239 if (DECL_NAME (node))
240 fprintf (file, " %s", IDENTIFIER_POINTER (DECL_NAME (node)));
241 }
242 else if (class == 't')
243 {
244 if (TYPE_NAME (node))
245 {
246 if (TREE_CODE (TYPE_NAME (node)) == IDENTIFIER_NODE)
247 fprintf (file, " %s", IDENTIFIER_POINTER (TYPE_NAME (node)));
248 else if (TREE_CODE (TYPE_NAME (node)) == TYPE_DECL
249 && DECL_NAME (TYPE_NAME (node)))
250 fprintf (file, " %s",
251 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (node))));
252 }
253 }
254 if (TREE_CODE (node) == IDENTIFIER_NODE)
255 fprintf (file, " %s", IDENTIFIER_POINTER (node));
256
257 if (TREE_CODE (node) == INTEGER_CST)
258 {
259 if (indent <= 4)
260 print_node_brief (file, "type", TREE_TYPE (node), indent + 4);
261 }
262 else
263 {
264 print_node (file, "type", TREE_TYPE (node), indent + 4);
265 if (TREE_TYPE (node))
266 indent_to (file, indent + 3);
52eeef3a
RS
267 }
268
269 if (TREE_SIDE_EFFECTS (node))
270 fputs (" side-effects", file);
271 if (TREE_READONLY (node))
272 fputs (" readonly", file);
273 if (TREE_CONSTANT (node))
274 fputs (" constant", file);
275 if (TREE_ADDRESSABLE (node))
276 fputs (" addressable", file);
277 if (TREE_THIS_VOLATILE (node))
278 fputs (" volatile", file);
279 if (TREE_UNSIGNED (node))
280 fputs (" unsigned", file);
281 if (TREE_ASM_WRITTEN (node))
282 fputs (" asm_written", file);
283 if (TREE_USED (node))
284 fputs (" used", file);
12a22e76
JM
285 if (TREE_NOTHROW (node))
286 fputs (" nothrow", file);
52eeef3a
RS
287 if (TREE_PUBLIC (node))
288 fputs (" public", file);
86fff623
MM
289 if (TREE_PRIVATE (node))
290 fputs (" private", file);
291 if (TREE_PROTECTED (node))
292 fputs (" protected", file);
52eeef3a
RS
293 if (TREE_STATIC (node))
294 fputs (" static", file);
295 if (TREE_LANG_FLAG_0 (node))
296 fputs (" tree_0", file);
297 if (TREE_LANG_FLAG_1 (node))
298 fputs (" tree_1", file);
299 if (TREE_LANG_FLAG_2 (node))
300 fputs (" tree_2", file);
301 if (TREE_LANG_FLAG_3 (node))
302 fputs (" tree_3", file);
303 if (TREE_LANG_FLAG_4 (node))
304 fputs (" tree_4", file);
305 if (TREE_LANG_FLAG_5 (node))
306 fputs (" tree_5", file);
307 if (TREE_LANG_FLAG_6 (node))
308 fputs (" tree_6", file);
309
310 /* DECL_ nodes have additional attributes. */
311
312 switch (TREE_CODE_CLASS (TREE_CODE (node)))
313 {
314 case 'd':
315 mode = DECL_MODE (node);
316
96a31ab8
RK
317 if (DECL_IGNORED_P (node))
318 fputs (" ignored", file);
319 if (DECL_ABSTRACT (node))
320 fputs (" abstract", file);
321 if (DECL_IN_SYSTEM_HEADER (node))
322 fputs (" in_system_header", file);
323 if (DECL_COMMON (node))
324 fputs (" common", file);
216d5cdd 325 if (DECL_EXTERNAL (node))
52eeef3a 326 fputs (" external", file);
216d5cdd 327 if (DECL_REGISTER (node))
52eeef3a 328 fputs (" regdecl", file);
96a31ab8
RK
329 if (DECL_NONLOCAL (node))
330 fputs (" nonlocal", file);
96a31ab8
RK
331
332 if (TREE_CODE (node) == TYPE_DECL && TYPE_DECL_SUPPRESS_DEBUG (node))
788d4ba0 333 fputs (" suppress-debug", file);
96a31ab8 334
17aec3eb
RK
335 if (TREE_CODE (node) == FUNCTION_DECL && DECL_INLINE (node))
336 fputs (" inline", file);
96a31ab8
RK
337 if (TREE_CODE (node) == FUNCTION_DECL && DECL_BUILT_IN (node))
338 fputs (" built-in", file);
339 if (TREE_CODE (node) == FUNCTION_DECL && DECL_BUILT_IN_NONANSI (node))
340 fputs (" built-in-nonansi", file);
341
17aec3eb
RK
342 if (TREE_CODE (node) == FIELD_DECL && DECL_PACKED (node))
343 fputs (" packed", file);
96a31ab8 344 if (TREE_CODE (node) == FIELD_DECL && DECL_BIT_FIELD (node))
52eeef3a 345 fputs (" bit-field", file);
17aec3eb 346
96a31ab8
RK
347 if (TREE_CODE (node) == LABEL_DECL && DECL_TOO_LATE (node))
348 fputs (" too-late", file);
17aec3eb 349
96a31ab8
RK
350 if (TREE_CODE (node) == VAR_DECL && DECL_IN_TEXT_SECTION (node))
351 fputs (" in-text-section", file);
352
17aec3eb
RK
353 if (TREE_CODE (node) == PARM_DECL && DECL_TRANSPARENT_UNION (node))
354 fputs (" transparent-union", file);
355
52eeef3a
RS
356 if (DECL_VIRTUAL_P (node))
357 fputs (" virtual", file);
96a31ab8
RK
358 if (DECL_DEFER_OUTPUT (node))
359 fputs (" defer-output", file);
96a31ab8 360
52eeef3a
RS
361 if (DECL_LANG_FLAG_0 (node))
362 fputs (" decl_0", file);
363 if (DECL_LANG_FLAG_1 (node))
364 fputs (" decl_1", file);
365 if (DECL_LANG_FLAG_2 (node))
366 fputs (" decl_2", file);
367 if (DECL_LANG_FLAG_3 (node))
368 fputs (" decl_3", file);
369 if (DECL_LANG_FLAG_4 (node))
370 fputs (" decl_4", file);
371 if (DECL_LANG_FLAG_5 (node))
372 fputs (" decl_5", file);
373 if (DECL_LANG_FLAG_6 (node))
374 fputs (" decl_6", file);
375 if (DECL_LANG_FLAG_7 (node))
376 fputs (" decl_7", file);
377
a4ec8d12 378 fprintf (file, " %s", GET_MODE_NAME(mode));
52eeef3a
RS
379
380 fprintf (file, " file %s line %d",
381 DECL_SOURCE_FILE (node), DECL_SOURCE_LINE (node));
382
383 print_node (file, "size", DECL_SIZE (node), indent + 4);
06ceef4e
RK
384 print_node (file, "unit size", DECL_SIZE_UNIT (node), indent + 4);
385
9df2c88c
RK
386 if (TREE_CODE (node) != FUNCTION_DECL
387 || DECL_INLINE (node) || DECL_BUILT_IN (node))
388 indent_to (file, indent + 3);
389
c0920bf9 390 if (TREE_CODE (node) != FUNCTION_DECL)
aa4661f8
RK
391 {
392 fprintf (file, " align %d", DECL_ALIGN (node));
393 if (TREE_CODE (node) == FIELD_DECL)
0cba764e
RK
394 {
395 fprintf (file, " offset_align ");
396 fprintf (file, HOST_WIDE_INT_PRINT_UNSIGNED,
397 DECL_OFFSET_ALIGN (node));
398 }
aa4661f8 399 }
216d5cdd 400 else if (DECL_INLINE (node))
9df2c88c
RK
401 {
402 fprintf (file, " frame_size ");
403 fprintf (file, HOST_WIDE_INT_PRINT_DEC, DECL_FRAME_SIZE (node));
404 }
c0920bf9 405 else if (DECL_BUILT_IN (node))
9df2c88c
RK
406 fprintf (file, " built-in %s:%s",
407 built_in_class_names[(int) DECL_BUILT_IN_CLASS (node)],
408 built_in_names[(int) DECL_FUNCTION_CODE (node)]);
409
3932261a 410 if (DECL_POINTER_ALIAS_SET_KNOWN_P (node))
c5588504
JL
411 {
412 fprintf (file, " alias set ");
413 fprintf (file, HOST_WIDE_INT_PRINT_DEC,
414 DECL_POINTER_ALIAS_SET (node));
415 }
9df2c88c
RK
416
417 if (TREE_CODE (node) == FIELD_DECL)
770ae6cc
RK
418 {
419 print_node (file, "offset", DECL_FIELD_OFFSET (node), indent + 4);
420 print_node (file, "bit offset", DECL_FIELD_BIT_OFFSET (node),
421 indent + 4);
422 }
9df2c88c 423
52eeef3a 424 print_node_brief (file, "context", DECL_CONTEXT (node), indent + 4);
9df2c88c
RK
425 print_node_brief (file, "machine_attributes",
426 DECL_MACHINE_ATTRIBUTES (node), indent + 4);
c5caa350
CH
427 print_node_brief (file, "abstract_origin",
428 DECL_ABSTRACT_ORIGIN (node), indent + 4);
52eeef3a
RS
429
430 print_node (file, "arguments", DECL_ARGUMENTS (node), indent + 4);
17aec3eb 431 print_node (file, "result", DECL_RESULT_FLD (node), indent + 4);
52eeef3a
RS
432 print_node_brief (file, "initial", DECL_INITIAL (node), indent + 4);
433
434 print_lang_decl (file, node, indent);
435
436 if (DECL_RTL (node) != 0)
437 {
438 indent_to (file, indent + 4);
439 print_rtl (file, DECL_RTL (node));
440 }
441
17aec3eb
RK
442 if (TREE_CODE (node) == PARM_DECL && DECL_INCOMING_RTL (node) != 0)
443 {
444 indent_to (file, indent + 4);
445 fprintf (file, "incoming-rtl ");
446 print_rtl (file, DECL_INCOMING_RTL (node));
447 }
448 else if (TREE_CODE (node) == FUNCTION_DECL
449 && DECL_SAVED_INSNS (node) != 0)
52eeef3a
RS
450 {
451 indent_to (file, indent + 4);
17aec3eb
RK
452 fprintf (file, "saved-insns ");
453 fprintf (file, HOST_PTR_PRINTF, (char *) DECL_SAVED_INSNS (node));
52eeef3a
RS
454 }
455
456 /* Print the decl chain only if decl is at second level. */
457 if (indent == 4)
458 print_node (file, "chain", TREE_CHAIN (node), indent + 4);
459 else
460 print_node_brief (file, "chain", TREE_CHAIN (node), indent + 4);
461 break;
462
463 case 't':
0cba764e
RK
464 /* The no-force-blk flag is used for different things in
465 different types. */
466 if ((TREE_CODE (node) == RECORD_TYPE
467 || TREE_CODE (node) == UNION_TYPE
468 || TREE_CODE (node) == QUAL_UNION_TYPE)
469 && TYPE_NO_FORCE_BLK (node))
96a31ab8 470 fputs (" no-force-blk", file);
0cba764e
RK
471 else if (TREE_CODE (node) == INTEGER_TYPE
472 && TYPE_IS_SIZETYPE (node))
473 fputs (" sizetype", file);
474 else if (TREE_CODE (node) == FUNCTION_TYPE
475 && TYPE_RETURNS_STACK_DEPRESSED (node))
476 fputs (" returns-stack-depressed", file);
477
96a31ab8
RK
478 if (TYPE_STRING_FLAG (node))
479 fputs (" string-flag", file);
480 if (TYPE_NEEDS_CONSTRUCTING (node))
481 fputs (" needs-constructing", file);
0cba764e 482
5667abce
ZW
483 /* The transparent-union flag is used for different things in
484 different nodes. */
0cba764e
RK
485 if (TREE_CODE (node) == UNION_TYPE && TYPE_TRANSPARENT_UNION (node))
486 fputs (" transparent-union", file);
487 else if (TREE_CODE (node) == ARRAY_TYPE
488 && TYPE_NONALIASED_COMPONENT (node))
489 fputs (" nonaliased-component", file);
490 else if (TREE_CODE (node) == FUNCTION_TYPE
491 && TYPE_AMBIENT_BOUNDEDNESS (node))
492 fputs (" ambient-boundedness", file);
493
3fc341ac
RK
494 if (TYPE_PACKED (node))
495 fputs (" packed", file);
96a31ab8 496
52eeef3a
RS
497 if (TYPE_LANG_FLAG_0 (node))
498 fputs (" type_0", file);
499 if (TYPE_LANG_FLAG_1 (node))
500 fputs (" type_1", file);
501 if (TYPE_LANG_FLAG_2 (node))
502 fputs (" type_2", file);
503 if (TYPE_LANG_FLAG_3 (node))
504 fputs (" type_3", file);
505 if (TYPE_LANG_FLAG_4 (node))
506 fputs (" type_4", file);
507 if (TYPE_LANG_FLAG_5 (node))
508 fputs (" type_5", file);
509 if (TYPE_LANG_FLAG_6 (node))
510 fputs (" type_6", file);
511
512 mode = TYPE_MODE (node);
a4ec8d12 513 fprintf (file, " %s", GET_MODE_NAME(mode));
52eeef3a
RS
514
515 print_node (file, "size", TYPE_SIZE (node), indent + 4);
06ceef4e 516 print_node (file, "unit size", TYPE_SIZE_UNIT (node), indent + 4);
52eeef3a
RS
517 indent_to (file, indent + 3);
518
519 fprintf (file, " align %d", TYPE_ALIGN (node));
520 fprintf (file, " symtab %d", TYPE_SYMTAB_ADDRESS (node));
c5588504
JL
521 fprintf (file, " alias set ");
522 fprintf (file, HOST_WIDE_INT_PRINT_DEC, TYPE_ALIAS_SET (node));
52eeef3a 523
0c7f6f66
RK
524 print_node (file, "attributes", TYPE_ATTRIBUTES (node), indent + 4);
525
52eeef3a
RS
526 if (TREE_CODE (node) == ARRAY_TYPE || TREE_CODE (node) == SET_TYPE)
527 print_node (file, "domain", TYPE_DOMAIN (node), indent + 4);
89b48889
RS
528 else if (TREE_CODE (node) == INTEGER_TYPE
529 || TREE_CODE (node) == BOOLEAN_TYPE
530 || TREE_CODE (node) == CHAR_TYPE)
52eeef3a
RS
531 {
532 fprintf (file, " precision %d", TYPE_PRECISION (node));
533 print_node (file, "min", TYPE_MIN_VALUE (node), indent + 4);
534 print_node (file, "max", TYPE_MAX_VALUE (node), indent + 4);
535 }
536 else if (TREE_CODE (node) == ENUMERAL_TYPE)
537 {
538 fprintf (file, " precision %d", TYPE_PRECISION (node));
539 print_node (file, "min", TYPE_MIN_VALUE (node), indent + 4);
540 print_node (file, "max", TYPE_MAX_VALUE (node), indent + 4);
541 print_node (file, "values", TYPE_VALUES (node), indent + 4);
542 }
543 else if (TREE_CODE (node) == REAL_TYPE)
544 fprintf (file, " precision %d", TYPE_PRECISION (node));
c1b98a95
RK
545 else if (TREE_CODE (node) == RECORD_TYPE
546 || TREE_CODE (node) == UNION_TYPE
547 || TREE_CODE (node) == QUAL_UNION_TYPE)
52eeef3a 548 print_node (file, "fields", TYPE_FIELDS (node), indent + 4);
0cba764e
RK
549 else if (TREE_CODE (node) == FUNCTION_TYPE
550 || TREE_CODE (node) == METHOD_TYPE)
52eeef3a
RS
551 {
552 if (TYPE_METHOD_BASETYPE (node))
0cba764e
RK
553 print_node_brief (file, "method basetype",
554 TYPE_METHOD_BASETYPE (node), indent + 4);
52eeef3a
RS
555 print_node (file, "arg-types", TYPE_ARG_TYPES (node), indent + 4);
556 }
e7b9b18e
JM
557 else if (TREE_CODE (node) == OFFSET_TYPE)
558 print_node_brief (file, "basetype", TYPE_OFFSET_BASETYPE (node),
559 indent + 4);
52eeef3a
RS
560 if (TYPE_CONTEXT (node))
561 print_node_brief (file, "context", TYPE_CONTEXT (node), indent + 4);
562
563 print_lang_type (file, node, indent);
564
565 if (TYPE_POINTER_TO (node) || TREE_CHAIN (node))
566 indent_to (file, indent + 3);
567 print_node_brief (file, "pointer_to_this", TYPE_POINTER_TO (node), indent + 4);
568 print_node_brief (file, "reference_to_this", TYPE_REFERENCE_TO (node), indent + 4);
569 print_node_brief (file, "chain", TREE_CHAIN (node), indent + 4);
570 break;
571
3b59a331
RS
572 case 'b':
573 print_node (file, "vars", BLOCK_VARS (node), indent + 4);
3b59a331
RS
574 print_node (file, "supercontext", BLOCK_SUPERCONTEXT (node), indent + 4);
575 print_node (file, "subblocks", BLOCK_SUBBLOCKS (node), indent + 4);
576 print_node (file, "chain", BLOCK_CHAIN (node), indent + 4);
577 print_node (file, "abstract_origin",
578 BLOCK_ABSTRACT_ORIGIN (node), indent + 4);
e643155b 579 break;
3b59a331 580
52eeef3a
RS
581 case 'e':
582 case '<':
583 case '1':
584 case '2':
585 case 'r':
586 case 's':
0a6969ad 587 if (TREE_CODE (node) == BIND_EXPR)
52eeef3a 588 {
52eeef3a
RS
589 print_node (file, "vars", TREE_OPERAND (node, 0), indent + 4);
590 print_node (file, "body", TREE_OPERAND (node, 1), indent + 4);
bf1c6940 591 print_node (file, "block", TREE_OPERAND (node, 2), indent + 4);
e643155b 592 break;
52eeef3a
RS
593 }
594
8d5e6e25
RK
595 len = TREE_CODE_LENGTH (TREE_CODE (node));
596
b7f6588d 597 /* Some nodes contain rtx's, not trees,
52eeef3a 598 after a certain point. Print the rtx's as rtx's. */
b7f6588d 599 first_rtl = first_rtl_op (TREE_CODE (node));
8d5e6e25 600
52eeef3a
RS
601 for (i = 0; i < len; i++)
602 {
603 if (i >= first_rtl)
604 {
605 indent_to (file, indent + 4);
606 fprintf (file, "rtl %d ", i);
607 if (TREE_OPERAND (node, i))
024b05a7 608 print_rtl (file, (struct rtx_def *) TREE_OPERAND (node, i));
52eeef3a
RS
609 else
610 fprintf (file, "(nil)");
611 fprintf (file, "\n");
612 }
613 else
614 {
615 char temp[10];
616
617 sprintf (temp, "arg %d", i);
618 print_node (file, temp, TREE_OPERAND (node, i), indent + 4);
619 }
620 }
bf1e5319
APB
621
622 if (TREE_CODE (node) == EXPR_WITH_FILE_LOCATION)
623 {
624 indent_to (file, indent+4);
625 fprintf (file, "%s:%d:%d",
626 (EXPR_WFL_FILENAME_NODE (node ) ?
627 EXPR_WFL_FILENAME (node) : "(no file info)"),
628 EXPR_WFL_LINENO (node), EXPR_WFL_COLNO (node));
629 }
39b0dce7 630 print_node (file, "chain", BLOCK_CHAIN (node), indent + 4);
52eeef3a
RS
631 break;
632
633 case 'c':
634 case 'x':
635 switch (TREE_CODE (node))
636 {
637 case INTEGER_CST:
3e5f8018
RK
638 if (TREE_CONSTANT_OVERFLOW (node))
639 fprintf (file, " overflow");
640
1e66ce77 641 fprintf (file, " ");
52eeef3a 642 if (TREE_INT_CST_HIGH (node) == 0)
1e66ce77 643 fprintf (file, HOST_WIDE_INT_PRINT_UNSIGNED,
910d1693 644 TREE_INT_CST_LOW (node));
52eeef3a
RS
645 else if (TREE_INT_CST_HIGH (node) == -1
646 && TREE_INT_CST_LOW (node) != 0)
1e66ce77
RK
647 {
648 fprintf (file, "-");
649 fprintf (file, HOST_WIDE_INT_PRINT_UNSIGNED,
650 -TREE_INT_CST_LOW (node));
651 }
52eeef3a 652 else
1e66ce77 653 fprintf (file, HOST_WIDE_INT_PRINT_DOUBLE_HEX,
906c4e36 654 TREE_INT_CST_HIGH (node), TREE_INT_CST_LOW (node));
52eeef3a
RS
655 break;
656
657 case REAL_CST:
52eeef3a 658 {
7063dcbe
RK
659 REAL_VALUE_TYPE d;
660
86b38416
RK
661 if (TREE_OVERFLOW (node))
662 fprintf (file, " overflow");
663
664#if !defined(REAL_IS_NOT_DOUBLE) || defined(REAL_ARITHMETIC)
7063dcbe 665 d = TREE_REAL_CST (node);
86b38416
RK
666 if (REAL_VALUE_ISINF (d))
667 fprintf (file, " Inf");
668 else if (REAL_VALUE_ISNAN (d))
669 fprintf (file, " Nan");
670 else
671 {
672 char string[100];
673
674 REAL_VALUE_TO_DECIMAL (d, "%e", string);
675 fprintf (file, " %s", string);
676 }
677#else
678 {
679 int i;
680 unsigned char *p = (unsigned char *) &TREE_REAL_CST (node);
681 fprintf (file, " 0x");
682 for (i = 0; i < sizeof TREE_REAL_CST (node); i++)
683 fprintf (file, "%02x", *p++);
684 fprintf (file, "");
685 }
686#endif
52eeef3a 687 }
52eeef3a
RS
688 break;
689
690 case COMPLEX_CST:
691 print_node (file, "real", TREE_REALPART (node), indent + 4);
692 print_node (file, "imag", TREE_IMAGPART (node), indent + 4);
693 break;
694
695 case STRING_CST:
696 fprintf (file, " \"%s\"", TREE_STRING_POINTER (node));
28d10cea
RS
697 /* Print the chain at second level. */
698 if (indent == 4)
699 print_node (file, "chain", TREE_CHAIN (node), indent + 4);
700 else
701 print_node_brief (file, "chain", TREE_CHAIN (node), indent + 4);
52eeef3a
RS
702 break;
703
704 case IDENTIFIER_NODE:
705 print_lang_identifier (file, node, indent);
706 break;
707
708 case TREE_LIST:
709 print_node (file, "purpose", TREE_PURPOSE (node), indent + 4);
710 print_node (file, "value", TREE_VALUE (node), indent + 4);
711 print_node (file, "chain", TREE_CHAIN (node), indent + 4);
712 break;
713
714 case TREE_VEC:
715 len = TREE_VEC_LENGTH (node);
716 for (i = 0; i < len; i++)
3629f741
JW
717 if (TREE_VEC_ELT (node, i))
718 {
719 char temp[10];
720 sprintf (temp, "elt %d", i);
721 indent_to (file, indent + 4);
722 print_node_brief (file, temp, TREE_VEC_ELT (node, i), 0);
723 }
52eeef3a
RS
724 break;
725
726 case OP_IDENTIFIER:
727 print_node (file, "op1", TREE_PURPOSE (node), indent + 4);
728 print_node (file, "op2", TREE_VALUE (node), indent + 4);
0a6969ad
JC
729 break;
730
731 default:
bc289659
ML
732 if (TREE_CODE_CLASS (TREE_CODE (node)) == 'x')
733 lang_print_xnode (file, node, indent);
0a6969ad 734 break;
52eeef3a
RS
735 }
736
737 break;
738 }
f6adcfdc
RS
739
740 fprintf (file, ">");
52eeef3a 741}