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