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 Free Software Foundation, Inc.
5 This file is part of GCC.
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
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
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/>. */
24 #include "coretypes.h"
29 #include "langhooks.h"
30 #include "tree-iterator.h"
32 /* Define the hash table of nodes already seen.
33 Such nodes are not repeated; brief cross-references are used. */
43 static struct bucket **table;
45 /* Print the node NODE on standard error, for debugging.
46 Most nodes referred to by this one are printed recursively
47 down to a depth of six. */
50 debug_tree (tree node)
52 table = XCNEWVEC (struct bucket *, HASH_SIZE);
53 print_node (stderr, "", node, 0);
59 /* Print PREFIX and ADDR to FILE. */
61 dump_addr (FILE *file, const char *prefix, const void *addr)
63 if (flag_dump_noaddr || flag_dump_unnumbered)
64 fprintf (file, "%s#", prefix);
66 fprintf (file, "%s%p", prefix, addr);
69 /* Print a node in brief fashion, with just the code, address and name. */
72 print_node_brief (FILE *file, const char *prefix, const_tree node, int indent)
74 enum tree_code_class class;
79 class = TREE_CODE_CLASS (TREE_CODE (node));
81 /* Always print the slot this node is in, and its code, address and
85 fprintf (file, "%s <%s", prefix, tree_code_name[(int) TREE_CODE (node)]);
86 dump_addr (file, " ", node);
88 if (class == tcc_declaration)
91 fprintf (file, " %s", IDENTIFIER_POINTER (DECL_NAME (node)));
92 else if (TREE_CODE (node) == LABEL_DECL
93 && LABEL_DECL_UID (node) != -1)
94 fprintf (file, " L." HOST_WIDE_INT_PRINT_DEC, LABEL_DECL_UID (node));
96 fprintf (file, " %c.%u", TREE_CODE (node) == CONST_DECL ? 'C' : 'D',
99 else if (class == tcc_type)
101 if (TYPE_NAME (node))
103 if (TREE_CODE (TYPE_NAME (node)) == IDENTIFIER_NODE)
104 fprintf (file, " %s", IDENTIFIER_POINTER (TYPE_NAME (node)));
105 else if (TREE_CODE (TYPE_NAME (node)) == TYPE_DECL
106 && DECL_NAME (TYPE_NAME (node)))
107 fprintf (file, " %s",
108 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (node))));
111 if (TREE_CODE (node) == IDENTIFIER_NODE)
112 fprintf (file, " %s", IDENTIFIER_POINTER (node));
114 /* We might as well always print the value of an integer or real. */
115 if (TREE_CODE (node) == INTEGER_CST)
117 if (TREE_OVERFLOW (node))
118 fprintf (file, " overflow");
121 if (TREE_INT_CST_HIGH (node) == 0)
122 fprintf (file, HOST_WIDE_INT_PRINT_UNSIGNED, TREE_INT_CST_LOW (node));
123 else if (TREE_INT_CST_HIGH (node) == -1
124 && TREE_INT_CST_LOW (node) != 0)
125 fprintf (file, "-" HOST_WIDE_INT_PRINT_UNSIGNED,
126 -TREE_INT_CST_LOW (node));
128 fprintf (file, HOST_WIDE_INT_PRINT_DOUBLE_HEX,
129 TREE_INT_CST_HIGH (node), TREE_INT_CST_LOW (node));
131 if (TREE_CODE (node) == REAL_CST)
135 if (TREE_OVERFLOW (node))
136 fprintf (file, " overflow");
138 d = TREE_REAL_CST (node);
139 if (REAL_VALUE_ISINF (d))
140 fprintf (file, REAL_VALUE_NEGATIVE (d) ? " -Inf" : " Inf");
141 else if (REAL_VALUE_ISNAN (d))
142 fprintf (file, " Nan");
146 real_to_decimal (string, &d, sizeof (string), 0, 1);
147 fprintf (file, " %s", string);
155 indent_to (FILE *file, int column)
159 /* Since this is the long way, indent to desired column. */
161 fprintf (file, "\n");
162 for (i = 0; i < column; i++)
166 /* Print the node NODE in full on file FILE, preceded by PREFIX,
167 starting in column INDENT. */
170 print_node (FILE *file, const char *prefix, tree node, int indent)
174 enum machine_mode mode;
175 enum tree_code_class class;
178 expanded_location xloc;
184 code = TREE_CODE (node);
185 class = TREE_CODE_CLASS (code);
187 /* Don't get too deep in nesting. If the user wants to see deeper,
188 it is easy to use the address of a lowest-level node
189 as an argument in another call to debug_tree. */
193 print_node_brief (file, prefix, node, indent);
197 if (indent > 8 && (class == tcc_type || class == tcc_declaration))
199 print_node_brief (file, prefix, node, indent);
203 /* It is unsafe to look at any other fields of an ERROR_MARK node. */
204 if (TREE_CODE (node) == ERROR_MARK)
206 print_node_brief (file, prefix, node, indent);
210 hash = ((unsigned long) node) % HASH_SIZE;
212 /* If node is in the table, just mention its address. */
213 for (b = table[hash]; b; b = b->next)
216 print_node_brief (file, prefix, node, indent);
220 /* Add this node to the table. */
221 b = XNEW (struct bucket);
223 b->next = table[hash];
226 /* Indent to the specified column, since this is the long form. */
227 indent_to (file, indent);
229 /* Print the slot this node is in, and its code, and address. */
230 fprintf (file, "%s <%s", prefix, tree_code_name[(int) TREE_CODE (node)]);
231 dump_addr (file, " ", node);
233 /* Print the name, if any. */
234 if (class == tcc_declaration)
236 if (DECL_NAME (node))
237 fprintf (file, " %s", IDENTIFIER_POINTER (DECL_NAME (node)));
238 else if (TREE_CODE (node) == LABEL_DECL
239 && LABEL_DECL_UID (node) != -1)
240 fprintf (file, " L." HOST_WIDE_INT_PRINT_DEC, LABEL_DECL_UID (node));
242 fprintf (file, " %c.%u", TREE_CODE (node) == CONST_DECL ? 'C' : 'D',
245 else if (class == tcc_type)
247 if (TYPE_NAME (node))
249 if (TREE_CODE (TYPE_NAME (node)) == IDENTIFIER_NODE)
250 fprintf (file, " %s", IDENTIFIER_POINTER (TYPE_NAME (node)));
251 else if (TREE_CODE (TYPE_NAME (node)) == TYPE_DECL
252 && DECL_NAME (TYPE_NAME (node)))
253 fprintf (file, " %s",
254 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (node))));
257 if (TREE_CODE (node) == IDENTIFIER_NODE)
258 fprintf (file, " %s", IDENTIFIER_POINTER (node));
260 if (TREE_CODE (node) == INTEGER_CST)
263 print_node_brief (file, "type", TREE_TYPE (node), indent + 4);
265 else if (!GIMPLE_TUPLE_P (node))
267 print_node (file, "type", TREE_TYPE (node), indent + 4);
268 if (TREE_TYPE (node))
269 indent_to (file, indent + 3);
272 if (!TYPE_P (node) && TREE_SIDE_EFFECTS (node))
273 fputs (" side-effects", file);
275 if (TYPE_P (node) ? TYPE_READONLY (node) : TREE_READONLY (node))
276 fputs (" readonly", file);
277 if (!TYPE_P (node) && TREE_CONSTANT (node))
278 fputs (" constant", file);
279 else if (TYPE_P (node) && TYPE_SIZES_GIMPLIFIED (node))
280 fputs (" sizes-gimplified", file);
282 if (TREE_INVARIANT (node))
283 fputs (" invariant", file);
284 if (TREE_ADDRESSABLE (node))
285 fputs (" addressable", file);
286 if (TREE_THIS_VOLATILE (node))
287 fputs (" volatile", file);
288 if (TREE_ASM_WRITTEN (node))
289 fputs (" asm_written", file);
290 if (TREE_USED (node))
291 fputs (" used", file);
292 if (TREE_NOTHROW (node))
293 fputs (TYPE_P (node) ? " align-ok" : " nothrow", file);
294 if (TREE_PUBLIC (node))
295 fputs (" public", file);
296 if (TREE_PRIVATE (node))
297 fputs (" private", file);
298 if (TREE_PROTECTED (node))
299 fputs (" protected", file);
300 if (TREE_STATIC (node))
301 fputs (" static", file);
302 if (TREE_DEPRECATED (node))
303 fputs (" deprecated", file);
304 if (TREE_VISITED (node))
305 fputs (" visited", file);
306 if (TREE_LANG_FLAG_0 (node))
307 fputs (" tree_0", file);
308 if (TREE_LANG_FLAG_1 (node))
309 fputs (" tree_1", file);
310 if (TREE_LANG_FLAG_2 (node))
311 fputs (" tree_2", file);
312 if (TREE_LANG_FLAG_3 (node))
313 fputs (" tree_3", file);
314 if (TREE_LANG_FLAG_4 (node))
315 fputs (" tree_4", file);
316 if (TREE_LANG_FLAG_5 (node))
317 fputs (" tree_5", file);
318 if (TREE_LANG_FLAG_6 (node))
319 fputs (" tree_6", file);
321 /* DECL_ nodes have additional attributes. */
323 switch (TREE_CODE_CLASS (TREE_CODE (node)))
325 case tcc_declaration:
326 if (CODE_CONTAINS_STRUCT (code, TS_DECL_COMMON))
328 if (DECL_UNSIGNED (node))
329 fputs (" unsigned", file);
330 if (DECL_IGNORED_P (node))
331 fputs (" ignored", file);
332 if (DECL_ABSTRACT (node))
333 fputs (" abstract", file);
334 if (DECL_EXTERNAL (node))
335 fputs (" external", file);
336 if (DECL_NONLOCAL (node))
337 fputs (" nonlocal", file);
339 if (CODE_CONTAINS_STRUCT (code, TS_DECL_WITH_VIS))
341 if (DECL_WEAK (node))
342 fputs (" weak", file);
343 if (DECL_IN_SYSTEM_HEADER (node))
344 fputs (" in_system_header", file);
346 if (CODE_CONTAINS_STRUCT (code, TS_DECL_WRTL)
347 && TREE_CODE (node) != LABEL_DECL
348 && TREE_CODE (node) != FUNCTION_DECL
349 && DECL_REGISTER (node))
350 fputs (" regdecl", file);
352 if (TREE_CODE (node) == TYPE_DECL && TYPE_DECL_SUPPRESS_DEBUG (node))
353 fputs (" suppress-debug", file);
355 if (TREE_CODE (node) == FUNCTION_DECL && DECL_INLINE (node))
356 fputs (DECL_DECLARED_INLINE_P (node) ? " inline" : " autoinline", file);
357 if (TREE_CODE (node) == FUNCTION_DECL && DECL_BUILT_IN (node))
358 fputs (" built-in", file);
359 if (TREE_CODE (node) == FUNCTION_DECL && DECL_NO_STATIC_CHAIN (node))
360 fputs (" no-static-chain", file);
362 if (TREE_CODE (node) == FIELD_DECL && DECL_PACKED (node))
363 fputs (" packed", file);
364 if (TREE_CODE (node) == FIELD_DECL && DECL_BIT_FIELD (node))
365 fputs (" bit-field", file);
366 if (TREE_CODE (node) == FIELD_DECL && DECL_NONADDRESSABLE_P (node))
367 fputs (" nonaddressable", file);
369 if (TREE_CODE (node) == LABEL_DECL && DECL_ERROR_ISSUED (node))
370 fputs (" error-issued", file);
372 if (TREE_CODE (node) == VAR_DECL && DECL_IN_TEXT_SECTION (node))
373 fputs (" in-text-section", file);
374 if (TREE_CODE (node) == VAR_DECL && DECL_COMMON (node))
375 fputs (" common", file);
376 if (TREE_CODE (node) == VAR_DECL && DECL_THREAD_LOCAL_P (node))
378 enum tls_model kind = DECL_TLS_MODEL (node);
381 case TLS_MODEL_GLOBAL_DYNAMIC:
382 fputs (" tls-global-dynamic", file);
384 case TLS_MODEL_LOCAL_DYNAMIC:
385 fputs (" tls-local-dynamic", file);
387 case TLS_MODEL_INITIAL_EXEC:
388 fputs (" tls-initial-exec", file);
390 case TLS_MODEL_LOCAL_EXEC:
391 fputs (" tls-local-exec", file);
398 if (CODE_CONTAINS_STRUCT (code, TS_DECL_COMMON))
400 if (DECL_VIRTUAL_P (node))
401 fputs (" virtual", file);
402 if (DECL_PRESERVE_P (node))
403 fputs (" preserve", file);
404 if (DECL_NO_TBAA_P (node))
405 fputs (" no-tbaa", file);
406 if (DECL_LANG_FLAG_0 (node))
407 fputs (" decl_0", file);
408 if (DECL_LANG_FLAG_1 (node))
409 fputs (" decl_1", file);
410 if (DECL_LANG_FLAG_2 (node))
411 fputs (" decl_2", file);
412 if (DECL_LANG_FLAG_3 (node))
413 fputs (" decl_3", file);
414 if (DECL_LANG_FLAG_4 (node))
415 fputs (" decl_4", file);
416 if (DECL_LANG_FLAG_5 (node))
417 fputs (" decl_5", file);
418 if (DECL_LANG_FLAG_6 (node))
419 fputs (" decl_6", file);
420 if (DECL_LANG_FLAG_7 (node))
421 fputs (" decl_7", file);
423 mode = DECL_MODE (node);
424 fprintf (file, " %s", GET_MODE_NAME (mode));
427 if (CODE_CONTAINS_STRUCT (code, TS_DECL_WITH_VIS) && DECL_DEFER_OUTPUT (node))
428 fputs (" defer-output", file);
431 xloc = expand_location (DECL_SOURCE_LOCATION (node));
432 fprintf (file, " file %s line %d", xloc.file, xloc.line);
434 if (CODE_CONTAINS_STRUCT (code, TS_DECL_COMMON))
436 print_node (file, "size", DECL_SIZE (node), indent + 4);
437 print_node (file, "unit size", DECL_SIZE_UNIT (node), indent + 4);
439 if (TREE_CODE (node) != FUNCTION_DECL
440 || DECL_INLINE (node) || DECL_BUILT_IN (node))
441 indent_to (file, indent + 3);
443 if (DECL_USER_ALIGN (node))
444 fprintf (file, " user");
446 fprintf (file, " align %d", DECL_ALIGN (node));
447 if (TREE_CODE (node) == FIELD_DECL)
448 fprintf (file, " offset_align " HOST_WIDE_INT_PRINT_UNSIGNED,
449 DECL_OFFSET_ALIGN (node));
451 if (TREE_CODE (node) == FUNCTION_DECL && DECL_BUILT_IN (node))
453 if (DECL_BUILT_IN_CLASS (node) == BUILT_IN_MD)
454 fprintf (file, " built-in BUILT_IN_MD %d", DECL_FUNCTION_CODE (node));
456 fprintf (file, " built-in %s:%s",
457 built_in_class_names[(int) DECL_BUILT_IN_CLASS (node)],
458 built_in_names[(int) DECL_FUNCTION_CODE (node)]);
461 if (DECL_POINTER_ALIAS_SET_KNOWN_P (node))
462 fprintf (file, " alias set " HOST_WIDE_INT_PRINT_DEC,
463 DECL_POINTER_ALIAS_SET (node));
465 if (TREE_CODE (node) == FIELD_DECL)
467 print_node (file, "offset", DECL_FIELD_OFFSET (node), indent + 4);
468 print_node (file, "bit offset", DECL_FIELD_BIT_OFFSET (node),
470 if (DECL_BIT_FIELD_TYPE (node))
471 print_node (file, "bit_field_type", DECL_BIT_FIELD_TYPE (node),
475 print_node_brief (file, "context", DECL_CONTEXT (node), indent + 4);
477 if (CODE_CONTAINS_STRUCT (code, TS_DECL_COMMON))
479 print_node_brief (file, "attributes",
480 DECL_ATTRIBUTES (node), indent + 4);
481 print_node_brief (file, "initial", DECL_INITIAL (node), indent + 4);
483 if (CODE_CONTAINS_STRUCT (code, TS_DECL_WRTL))
485 print_node_brief (file, "abstract_origin",
486 DECL_ABSTRACT_ORIGIN (node), indent + 4);
488 if (CODE_CONTAINS_STRUCT (code, TS_DECL_NON_COMMON))
490 print_node (file, "arguments", DECL_ARGUMENT_FLD (node), indent + 4);
491 print_node (file, "result", DECL_RESULT_FLD (node), indent + 4);
494 lang_hooks.print_decl (file, node, indent);
496 if (DECL_RTL_SET_P (node))
498 indent_to (file, indent + 4);
499 print_rtl (file, DECL_RTL (node));
502 if (TREE_CODE (node) == PARM_DECL)
504 print_node (file, "arg-type", DECL_ARG_TYPE (node), indent + 4);
506 if (DECL_INCOMING_RTL (node) != 0)
508 indent_to (file, indent + 4);
509 fprintf (file, "incoming-rtl ");
510 print_rtl (file, DECL_INCOMING_RTL (node));
513 else if (TREE_CODE (node) == FUNCTION_DECL
514 && DECL_STRUCT_FUNCTION (node) != 0)
516 indent_to (file, indent + 4);
517 dump_addr (file, "saved-insns ", DECL_STRUCT_FUNCTION (node));
520 if ((TREE_CODE (node) == VAR_DECL || TREE_CODE (node) == PARM_DECL)
521 && DECL_HAS_VALUE_EXPR_P (node))
522 print_node (file, "value-expr", DECL_VALUE_EXPR (node), indent + 4);
524 if (TREE_CODE (node) == STRUCT_FIELD_TAG)
526 fprintf (file, " sft size " HOST_WIDE_INT_PRINT_DEC,
528 fprintf (file, " sft offset " HOST_WIDE_INT_PRINT_DEC,
530 print_node_brief (file, "parent var", SFT_PARENT_VAR (node),
533 /* Print the decl chain only if decl is at second level. */
535 print_node (file, "chain", TREE_CHAIN (node), indent + 4);
537 print_node_brief (file, "chain", TREE_CHAIN (node), indent + 4);
541 if (TYPE_UNSIGNED (node))
542 fputs (" unsigned", file);
544 /* The no-force-blk flag is used for different things in
546 if ((TREE_CODE (node) == RECORD_TYPE
547 || TREE_CODE (node) == UNION_TYPE
548 || TREE_CODE (node) == QUAL_UNION_TYPE)
549 && TYPE_NO_FORCE_BLK (node))
550 fputs (" no-force-blk", file);
551 else if (TREE_CODE (node) == INTEGER_TYPE
552 && TYPE_IS_SIZETYPE (node))
553 fputs (" sizetype", file);
554 else if (TREE_CODE (node) == FUNCTION_TYPE
555 && TYPE_RETURNS_STACK_DEPRESSED (node))
556 fputs (" returns-stack-depressed", file);
558 if (TYPE_STRING_FLAG (node))
559 fputs (" string-flag", file);
560 if (TYPE_NEEDS_CONSTRUCTING (node))
561 fputs (" needs-constructing", file);
563 /* The transparent-union flag is used for different things in
565 if (TREE_CODE (node) == UNION_TYPE && TYPE_TRANSPARENT_UNION (node))
566 fputs (" transparent-union", file);
567 else if (TREE_CODE (node) == ARRAY_TYPE
568 && TYPE_NONALIASED_COMPONENT (node))
569 fputs (" nonaliased-component", file);
571 if (TYPE_PACKED (node))
572 fputs (" packed", file);
574 if (TYPE_RESTRICT (node))
575 fputs (" restrict", file);
577 if (TYPE_LANG_FLAG_0 (node))
578 fputs (" type_0", file);
579 if (TYPE_LANG_FLAG_1 (node))
580 fputs (" type_1", file);
581 if (TYPE_LANG_FLAG_2 (node))
582 fputs (" type_2", file);
583 if (TYPE_LANG_FLAG_3 (node))
584 fputs (" type_3", file);
585 if (TYPE_LANG_FLAG_4 (node))
586 fputs (" type_4", file);
587 if (TYPE_LANG_FLAG_5 (node))
588 fputs (" type_5", file);
589 if (TYPE_LANG_FLAG_6 (node))
590 fputs (" type_6", file);
592 mode = TYPE_MODE (node);
593 fprintf (file, " %s", GET_MODE_NAME (mode));
595 print_node (file, "size", TYPE_SIZE (node), indent + 4);
596 print_node (file, "unit size", TYPE_SIZE_UNIT (node), indent + 4);
597 indent_to (file, indent + 3);
599 if (TYPE_USER_ALIGN (node))
600 fprintf (file, " user");
602 fprintf (file, " align %d symtab %d alias set " HOST_WIDE_INT_PRINT_DEC,
603 TYPE_ALIGN (node), TYPE_SYMTAB_ADDRESS (node),
604 TYPE_ALIAS_SET (node));
606 if (TYPE_STRUCTURAL_EQUALITY_P (node))
607 fprintf (file, " structural equality");
609 dump_addr (file, " canonical type ", TYPE_CANONICAL (node));
611 print_node (file, "attributes", TYPE_ATTRIBUTES (node), indent + 4);
613 if (INTEGRAL_TYPE_P (node) || TREE_CODE (node) == REAL_TYPE)
615 fprintf (file, " precision %d", TYPE_PRECISION (node));
616 print_node_brief (file, "min", TYPE_MIN_VALUE (node), indent + 4);
617 print_node_brief (file, "max", TYPE_MAX_VALUE (node), indent + 4);
620 if (TREE_CODE (node) == ENUMERAL_TYPE)
621 print_node (file, "values", TYPE_VALUES (node), indent + 4);
622 else if (TREE_CODE (node) == ARRAY_TYPE)
623 print_node (file, "domain", TYPE_DOMAIN (node), indent + 4);
624 else if (TREE_CODE (node) == VECTOR_TYPE)
625 fprintf (file, " nunits %d", (int) TYPE_VECTOR_SUBPARTS (node));
626 else if (TREE_CODE (node) == RECORD_TYPE
627 || TREE_CODE (node) == UNION_TYPE
628 || TREE_CODE (node) == QUAL_UNION_TYPE)
629 print_node (file, "fields", TYPE_FIELDS (node), indent + 4);
630 else if (TREE_CODE (node) == FUNCTION_TYPE
631 || TREE_CODE (node) == METHOD_TYPE)
633 if (TYPE_METHOD_BASETYPE (node))
634 print_node_brief (file, "method basetype",
635 TYPE_METHOD_BASETYPE (node), indent + 4);
636 print_node (file, "arg-types", TYPE_ARG_TYPES (node), indent + 4);
638 else if (TREE_CODE (node) == OFFSET_TYPE)
639 print_node_brief (file, "basetype", TYPE_OFFSET_BASETYPE (node),
642 if (TYPE_CONTEXT (node))
643 print_node_brief (file, "context", TYPE_CONTEXT (node), indent + 4);
645 lang_hooks.print_type (file, node, indent);
647 if (TYPE_POINTER_TO (node) || TREE_CHAIN (node))
648 indent_to (file, indent + 3);
650 print_node_brief (file, "pointer_to_this", TYPE_POINTER_TO (node),
652 print_node_brief (file, "reference_to_this", TYPE_REFERENCE_TO (node),
654 print_node_brief (file, "chain", TREE_CHAIN (node), indent + 4);
664 if (TREE_CODE (node) == BIT_FIELD_REF && BIT_FIELD_REF_UNSIGNED (node))
665 fputs (" unsigned", file);
666 if (TREE_CODE (node) == BIND_EXPR)
668 print_node (file, "vars", TREE_OPERAND (node, 0), indent + 4);
669 print_node (file, "body", TREE_OPERAND (node, 1), indent + 4);
670 print_node (file, "block", TREE_OPERAND (node, 2), indent + 4);
673 if (TREE_CODE (node) == CALL_EXPR)
675 call_expr_arg_iterator iter;
677 print_node (file, "fn", CALL_EXPR_FN (node), indent + 4);
678 print_node (file, "static_chain", CALL_EXPR_STATIC_CHAIN (node),
681 FOR_EACH_CALL_EXPR_ARG (arg, iter, node)
684 sprintf (temp, "arg %d", i);
685 print_node (file, temp, arg, indent + 4);
691 len = TREE_OPERAND_LENGTH (node);
693 for (i = 0; i < len; i++)
697 sprintf (temp, "arg %d", i);
698 print_node (file, temp, TREE_OPERAND (node, i), indent + 4);
701 print_node (file, "chain", TREE_CHAIN (node), indent + 4);
704 case tcc_gimple_stmt:
705 len = TREE_CODE_LENGTH (TREE_CODE (node));
707 for (i = 0; i < len; i++)
711 sprintf (temp, "arg %d", i);
712 print_node (file, temp, GIMPLE_STMT_OPERAND (node, i), indent + 4);
717 case tcc_exceptional:
718 switch (TREE_CODE (node))
721 if (TREE_OVERFLOW (node))
722 fprintf (file, " overflow");
725 if (TREE_INT_CST_HIGH (node) == 0)
726 fprintf (file, HOST_WIDE_INT_PRINT_UNSIGNED,
727 TREE_INT_CST_LOW (node));
728 else if (TREE_INT_CST_HIGH (node) == -1
729 && TREE_INT_CST_LOW (node) != 0)
730 fprintf (file, "-" HOST_WIDE_INT_PRINT_UNSIGNED,
731 -TREE_INT_CST_LOW (node));
733 fprintf (file, HOST_WIDE_INT_PRINT_DOUBLE_HEX,
734 TREE_INT_CST_HIGH (node), TREE_INT_CST_LOW (node));
741 if (TREE_OVERFLOW (node))
742 fprintf (file, " overflow");
744 d = TREE_REAL_CST (node);
745 if (REAL_VALUE_ISINF (d))
746 fprintf (file, REAL_VALUE_NEGATIVE (d) ? " -Inf" : " Inf");
747 else if (REAL_VALUE_ISNAN (d))
748 fprintf (file, " Nan");
752 real_to_decimal (string, &d, sizeof (string), 0, 1);
753 fprintf (file, " %s", string);
760 tree vals = TREE_VECTOR_CST_ELTS (node);
766 for (link = vals; link; link = TREE_CHAIN (link), ++i)
768 sprintf (buf, "elt%d: ", i);
769 print_node (file, buf, TREE_VALUE (link), indent + 4);
775 print_node (file, "real", TREE_REALPART (node), indent + 4);
776 print_node (file, "imag", TREE_IMAGPART (node), indent + 4);
781 const char *p = TREE_STRING_POINTER (node);
782 int i = TREE_STRING_LENGTH (node);
787 if (ch >= ' ' && ch < 127)
790 fprintf(file, "\\%03o", ch & 0xFF);
794 /* Print the chain at second level. */
796 print_node (file, "chain", TREE_CHAIN (node), indent + 4);
798 print_node_brief (file, "chain", TREE_CHAIN (node), indent + 4);
801 case IDENTIFIER_NODE:
802 lang_hooks.print_identifier (file, node, indent);
806 print_node (file, "purpose", TREE_PURPOSE (node), indent + 4);
807 print_node (file, "value", TREE_VALUE (node), indent + 4);
808 print_node (file, "chain", TREE_CHAIN (node), indent + 4);
812 len = TREE_VEC_LENGTH (node);
813 for (i = 0; i < len; i++)
814 if (TREE_VEC_ELT (node, i))
817 sprintf (temp, "elt %d", i);
818 indent_to (file, indent + 4);
819 print_node_brief (file, temp, TREE_VEC_ELT (node, i), 0);
824 dump_addr (file, " head ", node->stmt_list.head);
825 dump_addr (file, " tail ", node->stmt_list.tail);
826 fprintf (file, " stmts");
828 tree_stmt_iterator i;
829 for (i = tsi_start (node); !tsi_end_p (i); tsi_next (&i))
831 /* Not printing the addresses of the (not-a-tree)
832 'struct tree_stmt_list_node's. */
833 dump_addr (file, " ", tsi_stmt (i));
835 fprintf (file, "\n");
836 for (i = tsi_start (node); !tsi_end_p (i); tsi_next (&i))
838 /* Not printing the addresses of the (not-a-tree)
839 'struct tree_stmt_list_node's. */
840 print_node (file, "stmt", tsi_stmt (i), indent + 4);
843 print_node (file, "chain", TREE_CHAIN (node), indent + 4);
847 print_node (file, "vars", BLOCK_VARS (node), indent + 4);
848 print_node (file, "supercontext", BLOCK_SUPERCONTEXT (node),
850 print_node (file, "subblocks", BLOCK_SUBBLOCKS (node), indent + 4);
851 print_node (file, "chain", BLOCK_CHAIN (node), indent + 4);
852 print_node (file, "abstract_origin",
853 BLOCK_ABSTRACT_ORIGIN (node), indent + 4);
857 print_node_brief (file, "var", SSA_NAME_VAR (node), indent + 4);
858 print_node_brief (file, "def_stmt",
859 SSA_NAME_DEF_STMT (node), indent + 4);
861 indent_to (file, indent + 4);
862 fprintf (file, "version %u", SSA_NAME_VERSION (node));
863 if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (node))
864 fprintf (file, " in-abnormal-phi");
865 if (SSA_NAME_IN_FREE_LIST (node))
866 fprintf (file, " in-free-list");
868 if (SSA_NAME_PTR_INFO (node)
869 || SSA_NAME_VALUE (node))
871 indent_to (file, indent + 3);
872 if (SSA_NAME_PTR_INFO (node))
873 dump_addr (file, " ptr-info ", SSA_NAME_PTR_INFO (node));
874 if (SSA_NAME_VALUE (node))
875 dump_addr (file, " value ", SSA_NAME_VALUE (node));
882 fprintf (file, " %s",
883 omp_clause_code_name[OMP_CLAUSE_CODE (node)]);
884 for (i = 0; i < omp_clause_num_ops[OMP_CLAUSE_CODE (node)]; i++)
886 indent_to (file, indent + 4);
887 fprintf (file, "op %d:", i);
888 print_node_brief (file, "", OMP_CLAUSE_OPERAND (node, i), 0);
894 if (EXCEPTIONAL_CLASS_P (node))
895 lang_hooks.print_xnode (file, node, indent);
902 if (EXPR_HAS_LOCATION (node))
904 expanded_location xloc = expand_location (EXPR_LOCATION (node));
905 indent_to (file, indent+4);
906 fprintf (file, "%s:%d", xloc.file, xloc.line);