1 /* Prints out tree in human readable form - GCC
2 Copyright (C) 1990-2013 Free Software Foundation, Inc.
4 This file is part of GCC.
6 GCC is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free
8 Software Foundation; either version 3, or (at your option) any later
11 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 You should have received a copy of the GNU General Public License
17 along with GCC; see the file COPYING3. If not see
18 <http://www.gnu.org/licenses/>. */
23 #include "coretypes.h"
27 #include "langhooks.h"
28 #include "tree-iterator.h"
29 #include "diagnostic.h"
30 #include "gimple-pretty-print.h" /* FIXME */
33 #include "tree-dump.h"
35 #include "wide-int-print.h"
37 /* Define the hash table of nodes already seen.
38 Such nodes are not repeated; brief cross-references are used. */
48 static struct bucket
**table
;
50 /* Print PREFIX and ADDR to FILE. */
52 dump_addr (FILE *file
, const char *prefix
, const void *addr
)
54 if (flag_dump_noaddr
|| flag_dump_unnumbered
)
55 fprintf (file
, "%s#", prefix
);
57 fprintf (file
, "%s" HOST_PTR_PRINTF
, prefix
, addr
);
60 /* Print a node in brief fashion, with just the code, address and name. */
63 print_node_brief (FILE *file
, const char *prefix
, const_tree node
, int indent
)
65 enum tree_code_class tclass
;
70 tclass
= TREE_CODE_CLASS (TREE_CODE (node
));
72 /* Always print the slot this node is in, and its code, address and
76 fprintf (file
, "%s <%s", prefix
, get_tree_code_name (TREE_CODE (node
)));
77 dump_addr (file
, " ", node
);
79 if (tclass
== tcc_declaration
)
82 fprintf (file
, " %s", IDENTIFIER_POINTER (DECL_NAME (node
)));
83 else if (TREE_CODE (node
) == LABEL_DECL
84 && LABEL_DECL_UID (node
) != -1)
86 if (dump_flags
& TDF_NOUID
)
87 fprintf (file
, " L.xxxx");
89 fprintf (file
, " L.%d", (int) LABEL_DECL_UID (node
));
93 if (dump_flags
& TDF_NOUID
)
94 fprintf (file
, " %c.xxxx",
95 TREE_CODE (node
) == CONST_DECL
? 'C' : 'D');
97 fprintf (file
, " %c.%u",
98 TREE_CODE (node
) == CONST_DECL
? 'C' : 'D',
102 else if (tclass
== tcc_type
)
104 if (TYPE_NAME (node
))
106 if (TREE_CODE (TYPE_NAME (node
)) == IDENTIFIER_NODE
)
107 fprintf (file
, " %s", IDENTIFIER_POINTER (TYPE_NAME (node
)));
108 else if (TREE_CODE (TYPE_NAME (node
)) == TYPE_DECL
109 && DECL_NAME (TYPE_NAME (node
)))
110 fprintf (file
, " %s",
111 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (node
))));
113 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
114 fprintf (file
, " address-space-%d", TYPE_ADDR_SPACE (node
));
116 if (TREE_CODE (node
) == IDENTIFIER_NODE
)
117 fprintf (file
, " %s", IDENTIFIER_POINTER (node
));
119 /* We might as well always print the value of an integer or real. */
120 if (TREE_CODE (node
) == INTEGER_CST
)
122 if (TREE_OVERFLOW (node
))
123 fprintf (file
, " overflow");
126 print_dec (node
, file
, TYPE_SIGN (TREE_TYPE (node
)));
128 if (TREE_CODE (node
) == REAL_CST
)
132 if (TREE_OVERFLOW (node
))
133 fprintf (file
, " overflow");
135 d
= TREE_REAL_CST (node
);
136 if (REAL_VALUE_ISINF (d
))
137 fprintf (file
, REAL_VALUE_NEGATIVE (d
) ? " -Inf" : " Inf");
138 else if (REAL_VALUE_ISNAN (d
))
139 fprintf (file
, " Nan");
143 real_to_decimal (string
, &d
, sizeof (string
), 0, 1);
144 fprintf (file
, " %s", string
);
147 if (TREE_CODE (node
) == FIXED_CST
)
152 if (TREE_OVERFLOW (node
))
153 fprintf (file
, " overflow");
155 f
= TREE_FIXED_CST (node
);
156 fixed_to_decimal (string
, &f
, sizeof (string
));
157 fprintf (file
, " %s", string
);
164 indent_to (FILE *file
, int column
)
168 /* Since this is the long way, indent to desired column. */
170 fprintf (file
, "\n");
171 for (i
= 0; i
< column
; i
++)
175 /* Print the node NODE in full on file FILE, preceded by PREFIX,
176 starting in column INDENT. */
179 print_node (FILE *file
, const char *prefix
, tree node
, int indent
)
183 enum machine_mode mode
;
184 enum tree_code_class tclass
;
187 expanded_location xloc
;
193 code
= TREE_CODE (node
);
194 tclass
= TREE_CODE_CLASS (code
);
196 /* Don't get too deep in nesting. If the user wants to see deeper,
197 it is easy to use the address of a lowest-level node
198 as an argument in another call to debug_tree. */
202 print_node_brief (file
, prefix
, node
, indent
);
206 if (indent
> 8 && (tclass
== tcc_type
|| tclass
== tcc_declaration
))
208 print_node_brief (file
, prefix
, node
, indent
);
212 /* It is unsafe to look at any other fields of an ERROR_MARK node. */
213 if (code
== ERROR_MARK
)
215 print_node_brief (file
, prefix
, node
, indent
);
219 /* Allow this function to be called if the table is not there. */
222 hash
= ((uintptr_t) node
) % HASH_SIZE
;
224 /* If node is in the table, just mention its address. */
225 for (b
= table
[hash
]; b
; b
= b
->next
)
228 print_node_brief (file
, prefix
, node
, indent
);
232 /* Add this node to the table. */
233 b
= XNEW (struct bucket
);
235 b
->next
= table
[hash
];
239 /* Indent to the specified column, since this is the long form. */
240 indent_to (file
, indent
);
242 /* Print the slot this node is in, and its code, and address. */
243 fprintf (file
, "%s <%s", prefix
, get_tree_code_name (code
));
244 dump_addr (file
, " ", node
);
246 /* Print the name, if any. */
247 if (tclass
== tcc_declaration
)
249 if (DECL_NAME (node
))
250 fprintf (file
, " %s", IDENTIFIER_POINTER (DECL_NAME (node
)));
251 else if (code
== LABEL_DECL
252 && LABEL_DECL_UID (node
) != -1)
254 if (dump_flags
& TDF_NOUID
)
255 fprintf (file
, " L.xxxx");
257 fprintf (file
, " L.%d", (int) LABEL_DECL_UID (node
));
261 if (dump_flags
& TDF_NOUID
)
262 fprintf (file
, " %c.xxxx", code
== CONST_DECL
? 'C' : 'D');
264 fprintf (file
, " %c.%u", code
== CONST_DECL
? 'C' : 'D',
268 else if (tclass
== tcc_type
)
270 if (TYPE_NAME (node
))
272 if (TREE_CODE (TYPE_NAME (node
)) == IDENTIFIER_NODE
)
273 fprintf (file
, " %s", IDENTIFIER_POINTER (TYPE_NAME (node
)));
274 else if (TREE_CODE (TYPE_NAME (node
)) == TYPE_DECL
275 && DECL_NAME (TYPE_NAME (node
)))
276 fprintf (file
, " %s",
277 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (node
))));
280 if (code
== IDENTIFIER_NODE
)
281 fprintf (file
, " %s", IDENTIFIER_POINTER (node
));
283 if (code
== INTEGER_CST
)
286 print_node_brief (file
, "type", TREE_TYPE (node
), indent
+ 4);
288 else if (CODE_CONTAINS_STRUCT (code
, TS_TYPED
))
290 print_node (file
, "type", TREE_TYPE (node
), indent
+ 4);
291 if (TREE_TYPE (node
))
292 indent_to (file
, indent
+ 3);
295 if (!TYPE_P (node
) && TREE_SIDE_EFFECTS (node
))
296 fputs (" side-effects", file
);
298 if (TYPE_P (node
) ? TYPE_READONLY (node
) : TREE_READONLY (node
))
299 fputs (" readonly", file
);
300 if (TYPE_P (node
) && TYPE_ATOMIC (node
))
301 fputs (" atomic", file
);
302 if (!TYPE_P (node
) && TREE_CONSTANT (node
))
303 fputs (" constant", file
);
304 else if (TYPE_P (node
) && TYPE_SIZES_GIMPLIFIED (node
))
305 fputs (" sizes-gimplified", file
);
307 if (TYPE_P (node
) && !ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
308 fprintf (file
, " address-space-%d", TYPE_ADDR_SPACE (node
));
310 if (TREE_ADDRESSABLE (node
))
311 fputs (" addressable", file
);
312 if (TREE_THIS_VOLATILE (node
))
313 fputs (" volatile", file
);
314 if (TREE_ASM_WRITTEN (node
))
315 fputs (" asm_written", file
);
316 if (TREE_USED (node
))
317 fputs (" used", file
);
318 if (TREE_NOTHROW (node
))
319 fputs (TYPE_P (node
) ? " align-ok" : " nothrow", file
);
320 if (TREE_PUBLIC (node
))
321 fputs (" public", file
);
322 if (TREE_PRIVATE (node
))
323 fputs (" private", file
);
324 if (TREE_PROTECTED (node
))
325 fputs (" protected", file
);
326 if (TREE_STATIC (node
))
327 fputs (" static", file
);
328 if (TREE_DEPRECATED (node
))
329 fputs (" deprecated", file
);
330 if (TREE_VISITED (node
))
331 fputs (" visited", file
);
333 if (code
!= TREE_VEC
&& code
!= INTEGER_CST
&& code
!= SSA_NAME
)
335 if (TREE_LANG_FLAG_0 (node
))
336 fputs (" tree_0", file
);
337 if (TREE_LANG_FLAG_1 (node
))
338 fputs (" tree_1", file
);
339 if (TREE_LANG_FLAG_2 (node
))
340 fputs (" tree_2", file
);
341 if (TREE_LANG_FLAG_3 (node
))
342 fputs (" tree_3", file
);
343 if (TREE_LANG_FLAG_4 (node
))
344 fputs (" tree_4", file
);
345 if (TREE_LANG_FLAG_5 (node
))
346 fputs (" tree_5", file
);
347 if (TREE_LANG_FLAG_6 (node
))
348 fputs (" tree_6", file
);
351 /* DECL_ nodes have additional attributes. */
353 switch (TREE_CODE_CLASS (code
))
355 case tcc_declaration
:
356 if (CODE_CONTAINS_STRUCT (code
, TS_DECL_COMMON
))
358 if (DECL_UNSIGNED (node
))
359 fputs (" unsigned", file
);
360 if (DECL_IGNORED_P (node
))
361 fputs (" ignored", file
);
362 if (DECL_ABSTRACT (node
))
363 fputs (" abstract", file
);
364 if (DECL_EXTERNAL (node
))
365 fputs (" external", file
);
366 if (DECL_NONLOCAL (node
))
367 fputs (" nonlocal", file
);
369 if (CODE_CONTAINS_STRUCT (code
, TS_DECL_WITH_VIS
))
371 if (DECL_WEAK (node
))
372 fputs (" weak", file
);
373 if (DECL_IN_SYSTEM_HEADER (node
))
374 fputs (" in_system_header", file
);
376 if (CODE_CONTAINS_STRUCT (code
, TS_DECL_WRTL
)
377 && code
!= LABEL_DECL
378 && code
!= FUNCTION_DECL
379 && DECL_REGISTER (node
))
380 fputs (" regdecl", file
);
382 if (code
== TYPE_DECL
&& TYPE_DECL_SUPPRESS_DEBUG (node
))
383 fputs (" suppress-debug", file
);
385 if (code
== FUNCTION_DECL
386 && DECL_FUNCTION_SPECIFIC_TARGET (node
))
387 fputs (" function-specific-target", file
);
388 if (code
== FUNCTION_DECL
389 && DECL_FUNCTION_SPECIFIC_OPTIMIZATION (node
))
390 fputs (" function-specific-opt", file
);
391 if (code
== FUNCTION_DECL
&& DECL_DECLARED_INLINE_P (node
))
392 fputs (" autoinline", file
);
393 if (code
== FUNCTION_DECL
&& DECL_BUILT_IN (node
))
394 fputs (" built-in", file
);
395 if (code
== FUNCTION_DECL
&& DECL_STATIC_CHAIN (node
))
396 fputs (" static-chain", file
);
397 if (TREE_CODE (node
) == FUNCTION_DECL
&& decl_is_tm_clone (node
))
398 fputs (" tm-clone", file
);
400 if (code
== FIELD_DECL
&& DECL_PACKED (node
))
401 fputs (" packed", file
);
402 if (code
== FIELD_DECL
&& DECL_BIT_FIELD (node
))
403 fputs (" bit-field", file
);
404 if (code
== FIELD_DECL
&& DECL_NONADDRESSABLE_P (node
))
405 fputs (" nonaddressable", file
);
407 if (code
== LABEL_DECL
&& EH_LANDING_PAD_NR (node
))
408 fprintf (file
, " landing-pad:%d", EH_LANDING_PAD_NR (node
));
410 if (code
== VAR_DECL
&& DECL_IN_TEXT_SECTION (node
))
411 fputs (" in-text-section", file
);
412 if (code
== VAR_DECL
&& DECL_IN_CONSTANT_POOL (node
))
413 fputs (" in-constant-pool", file
);
414 if (code
== VAR_DECL
&& DECL_COMMON (node
))
415 fputs (" common", file
);
416 if (code
== VAR_DECL
&& DECL_THREAD_LOCAL_P (node
))
418 enum tls_model kind
= DECL_TLS_MODEL (node
);
421 case TLS_MODEL_GLOBAL_DYNAMIC
:
422 fputs (" tls-global-dynamic", file
);
424 case TLS_MODEL_LOCAL_DYNAMIC
:
425 fputs (" tls-local-dynamic", file
);
427 case TLS_MODEL_INITIAL_EXEC
:
428 fputs (" tls-initial-exec", file
);
430 case TLS_MODEL_LOCAL_EXEC
:
431 fputs (" tls-local-exec", file
);
438 if (CODE_CONTAINS_STRUCT (code
, TS_DECL_COMMON
))
440 if (DECL_VIRTUAL_P (node
))
441 fputs (" virtual", file
);
442 if (DECL_PRESERVE_P (node
))
443 fputs (" preserve", file
);
444 if (DECL_LANG_FLAG_0 (node
))
445 fputs (" decl_0", file
);
446 if (DECL_LANG_FLAG_1 (node
))
447 fputs (" decl_1", file
);
448 if (DECL_LANG_FLAG_2 (node
))
449 fputs (" decl_2", file
);
450 if (DECL_LANG_FLAG_3 (node
))
451 fputs (" decl_3", file
);
452 if (DECL_LANG_FLAG_4 (node
))
453 fputs (" decl_4", file
);
454 if (DECL_LANG_FLAG_5 (node
))
455 fputs (" decl_5", file
);
456 if (DECL_LANG_FLAG_6 (node
))
457 fputs (" decl_6", file
);
458 if (DECL_LANG_FLAG_7 (node
))
459 fputs (" decl_7", file
);
461 mode
= DECL_MODE (node
);
462 fprintf (file
, " %s", GET_MODE_NAME (mode
));
465 if ((code
== VAR_DECL
|| code
== PARM_DECL
|| code
== RESULT_DECL
)
466 && DECL_BY_REFERENCE (node
))
467 fputs (" passed-by-reference", file
);
469 if (CODE_CONTAINS_STRUCT (code
, TS_DECL_WITH_VIS
) && DECL_DEFER_OUTPUT (node
))
470 fputs (" defer-output", file
);
473 xloc
= expand_location (DECL_SOURCE_LOCATION (node
));
474 fprintf (file
, " file %s line %d col %d", xloc
.file
, xloc
.line
,
477 if (CODE_CONTAINS_STRUCT (code
, TS_DECL_COMMON
))
479 print_node (file
, "size", DECL_SIZE (node
), indent
+ 4);
480 print_node (file
, "unit size", DECL_SIZE_UNIT (node
), indent
+ 4);
482 if (code
!= FUNCTION_DECL
|| DECL_BUILT_IN (node
))
483 indent_to (file
, indent
+ 3);
485 if (DECL_USER_ALIGN (node
))
486 fprintf (file
, " user");
488 fprintf (file
, " align %d", DECL_ALIGN (node
));
489 if (code
== FIELD_DECL
)
490 fprintf (file
, " offset_align " HOST_WIDE_INT_PRINT_UNSIGNED
,
491 DECL_OFFSET_ALIGN (node
));
493 if (code
== FUNCTION_DECL
&& DECL_BUILT_IN (node
))
495 if (DECL_BUILT_IN_CLASS (node
) == BUILT_IN_MD
)
496 fprintf (file
, " built-in BUILT_IN_MD %d", DECL_FUNCTION_CODE (node
));
498 fprintf (file
, " built-in %s:%s",
499 built_in_class_names
[(int) DECL_BUILT_IN_CLASS (node
)],
500 built_in_names
[(int) DECL_FUNCTION_CODE (node
)]);
503 if (code
== FIELD_DECL
)
505 print_node (file
, "offset", DECL_FIELD_OFFSET (node
), indent
+ 4);
506 print_node (file
, "bit offset", DECL_FIELD_BIT_OFFSET (node
),
508 if (DECL_BIT_FIELD_TYPE (node
))
509 print_node (file
, "bit_field_type", DECL_BIT_FIELD_TYPE (node
),
513 print_node_brief (file
, "context", DECL_CONTEXT (node
), indent
+ 4);
515 if (CODE_CONTAINS_STRUCT (code
, TS_DECL_COMMON
))
517 print_node_brief (file
, "attributes",
518 DECL_ATTRIBUTES (node
), indent
+ 4);
519 if (code
!= PARM_DECL
)
520 print_node_brief (file
, "initial", DECL_INITIAL (node
),
523 if (CODE_CONTAINS_STRUCT (code
, TS_DECL_WRTL
))
525 print_node_brief (file
, "abstract_origin",
526 DECL_ABSTRACT_ORIGIN (node
), indent
+ 4);
528 if (CODE_CONTAINS_STRUCT (code
, TS_DECL_NON_COMMON
))
530 print_node (file
, "arguments", DECL_ARGUMENT_FLD (node
), indent
+ 4);
531 print_node (file
, "result", DECL_RESULT_FLD (node
), indent
+ 4);
534 lang_hooks
.print_decl (file
, node
, indent
);
536 if (DECL_RTL_SET_P (node
))
538 indent_to (file
, indent
+ 4);
539 print_rtl (file
, DECL_RTL (node
));
542 if (code
== PARM_DECL
)
544 print_node (file
, "arg-type", DECL_ARG_TYPE (node
), indent
+ 4);
546 if (DECL_INCOMING_RTL (node
) != 0)
548 indent_to (file
, indent
+ 4);
549 fprintf (file
, "incoming-rtl ");
550 print_rtl (file
, DECL_INCOMING_RTL (node
));
553 else if (code
== FUNCTION_DECL
554 && DECL_STRUCT_FUNCTION (node
) != 0)
556 indent_to (file
, indent
+ 4);
557 dump_addr (file
, "struct-function ", DECL_STRUCT_FUNCTION (node
));
560 if ((code
== VAR_DECL
|| code
== PARM_DECL
)
561 && DECL_HAS_VALUE_EXPR_P (node
))
562 print_node (file
, "value-expr", DECL_VALUE_EXPR (node
), indent
+ 4);
564 /* Print the decl chain only if decl is at second level. */
566 print_node (file
, "chain", TREE_CHAIN (node
), indent
+ 4);
568 print_node_brief (file
, "chain", TREE_CHAIN (node
), indent
+ 4);
572 if (TYPE_UNSIGNED (node
))
573 fputs (" unsigned", file
);
575 /* The no-force-blk flag is used for different things in
577 if ((code
== RECORD_TYPE
578 || code
== UNION_TYPE
579 || code
== QUAL_UNION_TYPE
)
580 && TYPE_NO_FORCE_BLK (node
))
581 fputs (" no-force-blk", file
);
583 if (TYPE_STRING_FLAG (node
))
584 fputs (" string-flag", file
);
585 if (TYPE_NEEDS_CONSTRUCTING (node
))
586 fputs (" needs-constructing", file
);
588 /* The transparent-union flag is used for different things in
590 if ((code
== UNION_TYPE
|| code
== RECORD_TYPE
)
591 && TYPE_TRANSPARENT_AGGR (node
))
592 fputs (" transparent-aggr", file
);
593 else if (code
== ARRAY_TYPE
594 && TYPE_NONALIASED_COMPONENT (node
))
595 fputs (" nonaliased-component", file
);
597 if (TYPE_PACKED (node
))
598 fputs (" packed", file
);
600 if (TYPE_RESTRICT (node
))
601 fputs (" restrict", file
);
603 if (TYPE_LANG_FLAG_0 (node
))
604 fputs (" type_0", file
);
605 if (TYPE_LANG_FLAG_1 (node
))
606 fputs (" type_1", file
);
607 if (TYPE_LANG_FLAG_2 (node
))
608 fputs (" type_2", file
);
609 if (TYPE_LANG_FLAG_3 (node
))
610 fputs (" type_3", file
);
611 if (TYPE_LANG_FLAG_4 (node
))
612 fputs (" type_4", file
);
613 if (TYPE_LANG_FLAG_5 (node
))
614 fputs (" type_5", file
);
615 if (TYPE_LANG_FLAG_6 (node
))
616 fputs (" type_6", file
);
618 mode
= TYPE_MODE (node
);
619 fprintf (file
, " %s", GET_MODE_NAME (mode
));
621 print_node (file
, "size", TYPE_SIZE (node
), indent
+ 4);
622 print_node (file
, "unit size", TYPE_SIZE_UNIT (node
), indent
+ 4);
623 indent_to (file
, indent
+ 3);
625 if (TYPE_USER_ALIGN (node
))
626 fprintf (file
, " user");
628 fprintf (file
, " align %d symtab %d alias set " HOST_WIDE_INT_PRINT_DEC
,
629 TYPE_ALIGN (node
), TYPE_SYMTAB_ADDRESS (node
),
630 (HOST_WIDE_INT
) TYPE_ALIAS_SET (node
));
632 if (TYPE_STRUCTURAL_EQUALITY_P (node
))
633 fprintf (file
, " structural equality");
635 dump_addr (file
, " canonical type ", TYPE_CANONICAL (node
));
637 print_node (file
, "attributes", TYPE_ATTRIBUTES (node
), indent
+ 4);
639 if (INTEGRAL_TYPE_P (node
) || code
== REAL_TYPE
640 || code
== FIXED_POINT_TYPE
)
642 fprintf (file
, " precision %d", TYPE_PRECISION (node
));
643 print_node_brief (file
, "min", TYPE_MIN_VALUE (node
), indent
+ 4);
644 print_node_brief (file
, "max", TYPE_MAX_VALUE (node
), indent
+ 4);
647 if (code
== ENUMERAL_TYPE
)
648 print_node (file
, "values", TYPE_VALUES (node
), indent
+ 4);
649 else if (code
== ARRAY_TYPE
)
650 print_node (file
, "domain", TYPE_DOMAIN (node
), indent
+ 4);
651 else if (code
== VECTOR_TYPE
)
652 fprintf (file
, " nunits %d", (int) TYPE_VECTOR_SUBPARTS (node
));
653 else if (code
== RECORD_TYPE
654 || code
== UNION_TYPE
655 || code
== QUAL_UNION_TYPE
)
656 print_node (file
, "fields", TYPE_FIELDS (node
), indent
+ 4);
657 else if (code
== FUNCTION_TYPE
658 || code
== METHOD_TYPE
)
660 if (TYPE_METHOD_BASETYPE (node
))
661 print_node_brief (file
, "method basetype",
662 TYPE_METHOD_BASETYPE (node
), indent
+ 4);
663 print_node (file
, "arg-types", TYPE_ARG_TYPES (node
), indent
+ 4);
665 else if (code
== OFFSET_TYPE
)
666 print_node_brief (file
, "basetype", TYPE_OFFSET_BASETYPE (node
),
669 if (TYPE_CONTEXT (node
))
670 print_node_brief (file
, "context", TYPE_CONTEXT (node
), indent
+ 4);
672 lang_hooks
.print_type (file
, node
, indent
);
674 if (TYPE_POINTER_TO (node
) || TREE_CHAIN (node
))
675 indent_to (file
, indent
+ 3);
677 print_node_brief (file
, "pointer_to_this", TYPE_POINTER_TO (node
),
679 print_node_brief (file
, "reference_to_this", TYPE_REFERENCE_TO (node
),
681 print_node_brief (file
, "chain", TREE_CHAIN (node
), indent
+ 4);
691 if (code
== BIND_EXPR
)
693 print_node (file
, "vars", TREE_OPERAND (node
, 0), indent
+ 4);
694 print_node (file
, "body", TREE_OPERAND (node
, 1), indent
+ 4);
695 print_node (file
, "block", TREE_OPERAND (node
, 2), indent
+ 4);
698 if (code
== CALL_EXPR
)
700 call_expr_arg_iterator iter
;
702 print_node (file
, "fn", CALL_EXPR_FN (node
), indent
+ 4);
703 print_node (file
, "static_chain", CALL_EXPR_STATIC_CHAIN (node
),
706 FOR_EACH_CALL_EXPR_ARG (arg
, iter
, node
)
709 sprintf (temp
, "arg %d", i
);
710 print_node (file
, temp
, arg
, indent
+ 4);
716 len
= TREE_OPERAND_LENGTH (node
);
718 for (i
= 0; i
< len
; i
++)
722 sprintf (temp
, "arg %d", i
);
723 print_node (file
, temp
, TREE_OPERAND (node
, i
), indent
+ 4);
726 if (CODE_CONTAINS_STRUCT (code
, TS_COMMON
))
727 print_node (file
, "chain", TREE_CHAIN (node
), indent
+ 4);
731 case tcc_exceptional
:
735 if (TREE_OVERFLOW (node
))
736 fprintf (file
, " overflow");
739 print_dec (node
, file
, TYPE_SIGN (TREE_TYPE (node
)));
746 if (TREE_OVERFLOW (node
))
747 fprintf (file
, " overflow");
749 d
= TREE_REAL_CST (node
);
750 if (REAL_VALUE_ISINF (d
))
751 fprintf (file
, REAL_VALUE_NEGATIVE (d
) ? " -Inf" : " Inf");
752 else if (REAL_VALUE_ISNAN (d
))
753 fprintf (file
, " Nan");
757 real_to_decimal (string
, &d
, sizeof (string
), 0, 1);
758 fprintf (file
, " %s", string
);
768 if (TREE_OVERFLOW (node
))
769 fprintf (file
, " overflow");
771 f
= TREE_FIXED_CST (node
);
772 fixed_to_decimal (string
, &f
, sizeof (string
));
773 fprintf (file
, " %s", string
);
782 for (i
= 0; i
< VECTOR_CST_NELTS (node
); ++i
)
784 sprintf (buf
, "elt%u: ", i
);
785 print_node (file
, buf
, VECTOR_CST_ELT (node
, i
), indent
+ 4);
791 print_node (file
, "real", TREE_REALPART (node
), indent
+ 4);
792 print_node (file
, "imag", TREE_IMAGPART (node
), indent
+ 4);
797 const char *p
= TREE_STRING_POINTER (node
);
798 int i
= TREE_STRING_LENGTH (node
);
803 if (ch
>= ' ' && ch
< 127)
806 fprintf (file
, "\\%03o", ch
& 0xFF);
812 case IDENTIFIER_NODE
:
813 lang_hooks
.print_identifier (file
, node
, indent
);
817 print_node (file
, "purpose", TREE_PURPOSE (node
), indent
+ 4);
818 print_node (file
, "value", TREE_VALUE (node
), indent
+ 4);
819 print_node (file
, "chain", TREE_CHAIN (node
), indent
+ 4);
823 len
= TREE_VEC_LENGTH (node
);
824 for (i
= 0; i
< len
; i
++)
825 if (TREE_VEC_ELT (node
, i
))
828 sprintf (temp
, "elt %d", i
);
829 print_node (file
, temp
, TREE_VEC_ELT (node
, i
), indent
+ 4);
835 unsigned HOST_WIDE_INT cnt
;
837 len
= vec_safe_length (CONSTRUCTOR_ELTS (node
));
838 fprintf (file
, " lngt %d", len
);
839 FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (node
),
842 print_node (file
, "idx", index
, indent
+ 4);
843 print_node (file
, "val", value
, indent
+ 4);
849 dump_addr (file
, " head ", node
->stmt_list
.head
);
850 dump_addr (file
, " tail ", node
->stmt_list
.tail
);
851 fprintf (file
, " stmts");
853 tree_stmt_iterator i
;
854 for (i
= tsi_start (node
); !tsi_end_p (i
); tsi_next (&i
))
856 /* Not printing the addresses of the (not-a-tree)
857 'struct tree_stmt_list_node's. */
858 dump_addr (file
, " ", tsi_stmt (i
));
860 fprintf (file
, "\n");
861 for (i
= tsi_start (node
); !tsi_end_p (i
); tsi_next (&i
))
863 /* Not printing the addresses of the (not-a-tree)
864 'struct tree_stmt_list_node's. */
865 print_node (file
, "stmt", tsi_stmt (i
), indent
+ 4);
871 print_node (file
, "vars", BLOCK_VARS (node
), indent
+ 4);
872 print_node (file
, "supercontext", BLOCK_SUPERCONTEXT (node
),
874 print_node (file
, "subblocks", BLOCK_SUBBLOCKS (node
), indent
+ 4);
875 print_node (file
, "chain", BLOCK_CHAIN (node
), indent
+ 4);
876 print_node (file
, "abstract_origin",
877 BLOCK_ABSTRACT_ORIGIN (node
), indent
+ 4);
881 print_node_brief (file
, "var", SSA_NAME_VAR (node
), indent
+ 4);
882 fprintf (file
, "def_stmt ");
883 print_gimple_stmt (file
, SSA_NAME_DEF_STMT (node
), indent
+ 4, 0);
885 indent_to (file
, indent
+ 4);
886 fprintf (file
, "version %u", SSA_NAME_VERSION (node
));
887 if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (node
))
888 fprintf (file
, " in-abnormal-phi");
889 if (SSA_NAME_IN_FREE_LIST (node
))
890 fprintf (file
, " in-free-list");
892 if (SSA_NAME_PTR_INFO (node
))
894 indent_to (file
, indent
+ 3);
895 if (SSA_NAME_PTR_INFO (node
))
896 dump_addr (file
, " ptr-info ", SSA_NAME_PTR_INFO (node
));
903 fprintf (file
, " %s",
904 omp_clause_code_name
[OMP_CLAUSE_CODE (node
)]);
905 for (i
= 0; i
< omp_clause_num_ops
[OMP_CLAUSE_CODE (node
)]; i
++)
907 indent_to (file
, indent
+ 4);
908 fprintf (file
, "op %d:", i
);
909 print_node_brief (file
, "", OMP_CLAUSE_OPERAND (node
, i
), 0);
914 case OPTIMIZATION_NODE
:
915 cl_optimization_print (file
, indent
+ 4, TREE_OPTIMIZATION (node
));
918 case TARGET_OPTION_NODE
:
919 cl_target_option_print (file
, indent
+ 4, TREE_TARGET_OPTION (node
));
922 fprintf (file
, " imported declaration");
923 print_node_brief (file
, "associated declaration",
924 IMPORTED_DECL_ASSOCIATED_DECL (node
),
929 if (EXCEPTIONAL_CLASS_P (node
))
930 lang_hooks
.print_xnode (file
, node
, indent
);
937 if (EXPR_HAS_LOCATION (node
))
939 expanded_location xloc
= expand_location (EXPR_LOCATION (node
));
940 indent_to (file
, indent
+4);
941 fprintf (file
, "%s:%d:%d", xloc
.file
, xloc
.line
, xloc
.column
);
948 /* Print the node NODE on standard error, for debugging.
949 Most nodes referred to by this one are printed recursively
950 down to a depth of six. */
953 debug_tree (tree node
)
955 table
= XCNEWVEC (struct bucket
*, HASH_SIZE
);
956 print_node (stderr
, "", node
, 0);
963 debug_raw (const tree_node
&ref
)
965 debug_tree (const_cast <tree
> (&ref
));
969 debug_raw (const tree_node
*ptr
)
974 fprintf (stderr
, "<nil>\n");
978 dump_tree_via_hooks (const tree_node
*ptr
, int options
)
981 lang_hooks
.print_decl (stderr
, const_cast <tree_node
*> (ptr
), 0);
982 else if (TYPE_P (ptr
))
983 lang_hooks
.print_type (stderr
, const_cast <tree_node
*> (ptr
), 0);
984 else if (TREE_CODE (ptr
) == IDENTIFIER_NODE
)
985 lang_hooks
.print_identifier (stderr
, const_cast <tree_node
*> (ptr
), 0);
987 print_generic_expr (stderr
, const_cast <tree_node
*> (ptr
), options
);
988 fprintf (stderr
, "\n");
992 debug (const tree_node
&ref
)
994 dump_tree_via_hooks (&ref
, 0);
998 debug (const tree_node
*ptr
)
1003 fprintf (stderr
, "<nil>\n");
1007 debug_verbose (const tree_node
&ref
)
1009 dump_tree_via_hooks (&ref
, TDF_VERBOSE
);
1013 debug_verbose (const tree_node
*ptr
)
1016 debug_verbose (*ptr
);
1018 fprintf (stderr
, "<nil>\n");
1022 debug_head (const tree_node
&ref
)
1028 debug_head (const tree_node
*ptr
)
1033 fprintf (stderr
, "<nil>\n");
1037 debug_body (const tree_node
&ref
)
1039 if (TREE_CODE (&ref
) == FUNCTION_DECL
)
1040 dump_function_to_file (const_cast <tree_node
*> (&ref
), stderr
, 0);
1046 debug_body (const tree_node
*ptr
)
1051 fprintf (stderr
, "<nil>\n");
1054 /* Print the vector of trees VEC on standard error, for debugging.
1055 Most nodes referred to by this one are printed recursively
1056 down to a depth of six. */
1059 debug_raw (vec
<tree
, va_gc
> &ref
)
1064 /* Print the slot this node is in, and its code, and address. */
1065 fprintf (stderr
, "<VEC");
1066 dump_addr (stderr
, " ", ref
.address ());
1068 FOR_EACH_VEC_ELT (ref
, ix
, elt
)
1070 fprintf (stderr
, "elt %d ", ix
);
1076 debug (vec
<tree
, va_gc
> &ref
)
1081 /* Print the slot this node is in, and its code, and address. */
1082 fprintf (stderr
, "<VEC");
1083 dump_addr (stderr
, " ", ref
.address ());
1085 FOR_EACH_VEC_ELT (ref
, ix
, elt
)
1087 fprintf (stderr
, "elt %d ", ix
);
1093 debug (vec
<tree
, va_gc
> *ptr
)
1098 fprintf (stderr
, "<nil>\n");
1102 debug_raw (vec
<tree
, va_gc
> *ptr
)
1107 fprintf (stderr
, "<nil>\n");
1111 debug_vec_tree (vec
<tree
, va_gc
> *vec
)