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