1 /* Prints out tree in human readable form - GCC
2 Copyright (C) 1990-2015 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"
30 #include "print-rtl.h"
31 #include "stor-layout.h"
32 #include "langhooks.h"
33 #include "tree-iterator.h"
34 #include "diagnostic.h"
35 #include "gimple-pretty-print.h" /* FIXME */
37 #include "plugin-api.h"
38 #include "hard-reg-set.h"
44 #include "tree-dump.h"
46 #include "wide-int-print.h"
48 /* Define the hash table of nodes already seen.
49 Such nodes are not repeated; brief cross-references are used. */
59 static struct bucket
**table
;
61 /* Print PREFIX and ADDR to FILE. */
63 dump_addr (FILE *file
, const char *prefix
, const void *addr
)
65 if (flag_dump_noaddr
|| flag_dump_unnumbered
)
66 fprintf (file
, "%s#", prefix
);
68 fprintf (file
, "%s" HOST_PTR_PRINTF
, prefix
, addr
);
71 /* Print a node in brief fashion, with just the code, address and name. */
74 print_node_brief (FILE *file
, const char *prefix
, const_tree node
, int indent
)
76 enum tree_code_class tclass
;
81 tclass
= TREE_CODE_CLASS (TREE_CODE (node
));
83 /* Always print the slot this node is in, and its code, address and
87 fprintf (file
, "%s <%s", prefix
, get_tree_code_name (TREE_CODE (node
)));
88 dump_addr (file
, " ", node
);
90 if (tclass
== tcc_declaration
)
93 fprintf (file
, " %s", IDENTIFIER_POINTER (DECL_NAME (node
)));
94 else if (TREE_CODE (node
) == LABEL_DECL
95 && LABEL_DECL_UID (node
) != -1)
97 if (dump_flags
& TDF_NOUID
)
98 fprintf (file
, " L.xxxx");
100 fprintf (file
, " L.%d", (int) LABEL_DECL_UID (node
));
104 if (dump_flags
& TDF_NOUID
)
105 fprintf (file
, " %c.xxxx",
106 TREE_CODE (node
) == CONST_DECL
? 'C' : 'D');
108 fprintf (file
, " %c.%u",
109 TREE_CODE (node
) == CONST_DECL
? 'C' : 'D',
113 else if (tclass
== tcc_type
)
115 if (TYPE_NAME (node
))
117 if (TREE_CODE (TYPE_NAME (node
)) == IDENTIFIER_NODE
)
118 fprintf (file
, " %s", IDENTIFIER_POINTER (TYPE_NAME (node
)));
119 else if (TREE_CODE (TYPE_NAME (node
)) == TYPE_DECL
120 && DECL_NAME (TYPE_NAME (node
)))
121 fprintf (file
, " %s",
122 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (node
))));
124 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
125 fprintf (file
, " address-space-%d", TYPE_ADDR_SPACE (node
));
127 if (TREE_CODE (node
) == IDENTIFIER_NODE
)
128 fprintf (file
, " %s", IDENTIFIER_POINTER (node
));
130 /* We might as well always print the value of an integer or real. */
131 if (TREE_CODE (node
) == INTEGER_CST
)
133 if (TREE_OVERFLOW (node
))
134 fprintf (file
, " overflow");
137 print_dec (node
, file
, TYPE_SIGN (TREE_TYPE (node
)));
139 if (TREE_CODE (node
) == REAL_CST
)
143 if (TREE_OVERFLOW (node
))
144 fprintf (file
, " overflow");
146 d
= TREE_REAL_CST (node
);
147 if (REAL_VALUE_ISINF (d
))
148 fprintf (file
, REAL_VALUE_NEGATIVE (d
) ? " -Inf" : " Inf");
149 else if (REAL_VALUE_ISNAN (d
))
150 fprintf (file
, " Nan");
154 real_to_decimal (string
, &d
, sizeof (string
), 0, 1);
155 fprintf (file
, " %s", string
);
158 if (TREE_CODE (node
) == FIXED_CST
)
163 if (TREE_OVERFLOW (node
))
164 fprintf (file
, " overflow");
166 f
= TREE_FIXED_CST (node
);
167 fixed_to_decimal (string
, &f
, sizeof (string
));
168 fprintf (file
, " %s", string
);
175 indent_to (FILE *file
, int column
)
179 /* Since this is the long way, indent to desired column. */
181 fprintf (file
, "\n");
182 for (i
= 0; i
< column
; i
++)
186 /* Print the node NODE in full on file FILE, preceded by PREFIX,
187 starting in column INDENT. */
190 print_node (FILE *file
, const char *prefix
, tree node
, int indent
)
195 enum tree_code_class tclass
;
198 expanded_location xloc
;
204 code
= TREE_CODE (node
);
205 tclass
= TREE_CODE_CLASS (code
);
207 /* Don't get too deep in nesting. If the user wants to see deeper,
208 it is easy to use the address of a lowest-level node
209 as an argument in another call to debug_tree. */
213 print_node_brief (file
, prefix
, node
, indent
);
217 if (indent
> 8 && (tclass
== tcc_type
|| tclass
== tcc_declaration
))
219 print_node_brief (file
, prefix
, node
, indent
);
223 /* It is unsafe to look at any other fields of an ERROR_MARK node. */
224 if (code
== ERROR_MARK
)
226 print_node_brief (file
, prefix
, node
, indent
);
230 /* Allow this function to be called if the table is not there. */
233 hash
= ((uintptr_t) node
) % HASH_SIZE
;
235 /* If node is in the table, just mention its address. */
236 for (b
= table
[hash
]; b
; b
= b
->next
)
239 print_node_brief (file
, prefix
, node
, indent
);
243 /* Add this node to the table. */
244 b
= XNEW (struct bucket
);
246 b
->next
= table
[hash
];
250 /* Indent to the specified column, since this is the long form. */
251 indent_to (file
, indent
);
253 /* Print the slot this node is in, and its code, and address. */
254 fprintf (file
, "%s <%s", prefix
, get_tree_code_name (code
));
255 dump_addr (file
, " ", node
);
257 /* Print the name, if any. */
258 if (tclass
== tcc_declaration
)
260 if (DECL_NAME (node
))
261 fprintf (file
, " %s", IDENTIFIER_POINTER (DECL_NAME (node
)));
262 else if (code
== LABEL_DECL
263 && LABEL_DECL_UID (node
) != -1)
265 if (dump_flags
& TDF_NOUID
)
266 fprintf (file
, " L.xxxx");
268 fprintf (file
, " L.%d", (int) LABEL_DECL_UID (node
));
272 if (dump_flags
& TDF_NOUID
)
273 fprintf (file
, " %c.xxxx", code
== CONST_DECL
? 'C' : 'D');
275 fprintf (file
, " %c.%u", code
== CONST_DECL
? 'C' : 'D',
279 else if (tclass
== tcc_type
)
281 if (TYPE_NAME (node
))
283 if (TREE_CODE (TYPE_NAME (node
)) == IDENTIFIER_NODE
)
284 fprintf (file
, " %s", IDENTIFIER_POINTER (TYPE_NAME (node
)));
285 else if (TREE_CODE (TYPE_NAME (node
)) == TYPE_DECL
286 && DECL_NAME (TYPE_NAME (node
)))
287 fprintf (file
, " %s",
288 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (node
))));
291 if (code
== IDENTIFIER_NODE
)
292 fprintf (file
, " %s", IDENTIFIER_POINTER (node
));
294 if (code
== INTEGER_CST
)
297 print_node_brief (file
, "type", TREE_TYPE (node
), indent
+ 4);
299 else if (CODE_CONTAINS_STRUCT (code
, TS_TYPED
))
301 print_node (file
, "type", TREE_TYPE (node
), indent
+ 4);
302 if (TREE_TYPE (node
))
303 indent_to (file
, indent
+ 3);
306 if (!TYPE_P (node
) && TREE_SIDE_EFFECTS (node
))
307 fputs (" side-effects", file
);
309 if (TYPE_P (node
) ? TYPE_READONLY (node
) : TREE_READONLY (node
))
310 fputs (" readonly", file
);
311 if (TYPE_P (node
) && TYPE_ATOMIC (node
))
312 fputs (" atomic", file
);
313 if (!TYPE_P (node
) && TREE_CONSTANT (node
))
314 fputs (" constant", file
);
315 else if (TYPE_P (node
) && TYPE_SIZES_GIMPLIFIED (node
))
316 fputs (" sizes-gimplified", file
);
318 if (TYPE_P (node
) && !ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
319 fprintf (file
, " address-space-%d", TYPE_ADDR_SPACE (node
));
321 if (TREE_ADDRESSABLE (node
))
322 fputs (" addressable", file
);
323 if (TREE_THIS_VOLATILE (node
))
324 fputs (" volatile", file
);
325 if (TREE_ASM_WRITTEN (node
))
326 fputs (" asm_written", file
);
327 if (TREE_USED (node
))
328 fputs (" used", file
);
329 if (TREE_NOTHROW (node
))
330 fputs (TYPE_P (node
) ? " align-ok" : " nothrow", file
);
331 if (TREE_PUBLIC (node
))
332 fputs (" public", file
);
333 if (TREE_PRIVATE (node
))
334 fputs (" private", file
);
335 if (TREE_PROTECTED (node
))
336 fputs (" protected", file
);
337 if (TREE_STATIC (node
))
338 fputs (" static", file
);
339 if (TREE_DEPRECATED (node
))
340 fputs (" deprecated", file
);
341 if (TREE_VISITED (node
))
342 fputs (" visited", file
);
344 if (code
!= TREE_VEC
&& code
!= INTEGER_CST
&& code
!= SSA_NAME
)
346 if (TREE_LANG_FLAG_0 (node
))
347 fputs (" tree_0", file
);
348 if (TREE_LANG_FLAG_1 (node
))
349 fputs (" tree_1", file
);
350 if (TREE_LANG_FLAG_2 (node
))
351 fputs (" tree_2", file
);
352 if (TREE_LANG_FLAG_3 (node
))
353 fputs (" tree_3", file
);
354 if (TREE_LANG_FLAG_4 (node
))
355 fputs (" tree_4", file
);
356 if (TREE_LANG_FLAG_5 (node
))
357 fputs (" tree_5", file
);
358 if (TREE_LANG_FLAG_6 (node
))
359 fputs (" tree_6", file
);
362 /* DECL_ nodes have additional attributes. */
364 switch (TREE_CODE_CLASS (code
))
366 case tcc_declaration
:
367 if (CODE_CONTAINS_STRUCT (code
, TS_DECL_COMMON
))
369 if (DECL_UNSIGNED (node
))
370 fputs (" unsigned", file
);
371 if (DECL_IGNORED_P (node
))
372 fputs (" ignored", file
);
373 if (DECL_ABSTRACT_P (node
))
374 fputs (" abstract", file
);
375 if (DECL_EXTERNAL (node
))
376 fputs (" external", file
);
377 if (DECL_NONLOCAL (node
))
378 fputs (" nonlocal", file
);
380 if (CODE_CONTAINS_STRUCT (code
, TS_DECL_WITH_VIS
))
382 if (DECL_WEAK (node
))
383 fputs (" weak", file
);
384 if (DECL_IN_SYSTEM_HEADER (node
))
385 fputs (" in_system_header", file
);
387 if (CODE_CONTAINS_STRUCT (code
, TS_DECL_WRTL
)
388 && code
!= LABEL_DECL
389 && code
!= FUNCTION_DECL
390 && DECL_REGISTER (node
))
391 fputs (" regdecl", file
);
393 if (code
== TYPE_DECL
&& TYPE_DECL_SUPPRESS_DEBUG (node
))
394 fputs (" suppress-debug", file
);
396 if (code
== FUNCTION_DECL
397 && DECL_FUNCTION_SPECIFIC_TARGET (node
))
398 fputs (" function-specific-target", file
);
399 if (code
== FUNCTION_DECL
400 && DECL_FUNCTION_SPECIFIC_OPTIMIZATION (node
))
401 fputs (" function-specific-opt", file
);
402 if (code
== FUNCTION_DECL
&& DECL_DECLARED_INLINE_P (node
))
403 fputs (" autoinline", file
);
404 if (code
== FUNCTION_DECL
&& DECL_BUILT_IN (node
))
405 fputs (" built-in", file
);
406 if (code
== FUNCTION_DECL
&& DECL_STATIC_CHAIN (node
))
407 fputs (" static-chain", file
);
408 if (TREE_CODE (node
) == FUNCTION_DECL
&& decl_is_tm_clone (node
))
409 fputs (" tm-clone", file
);
411 if (code
== FIELD_DECL
&& DECL_PACKED (node
))
412 fputs (" packed", file
);
413 if (code
== FIELD_DECL
&& DECL_BIT_FIELD (node
))
414 fputs (" bit-field", file
);
415 if (code
== FIELD_DECL
&& DECL_NONADDRESSABLE_P (node
))
416 fputs (" nonaddressable", file
);
418 if (code
== LABEL_DECL
&& EH_LANDING_PAD_NR (node
))
419 fprintf (file
, " landing-pad:%d", EH_LANDING_PAD_NR (node
));
421 if (code
== VAR_DECL
&& DECL_IN_TEXT_SECTION (node
))
422 fputs (" in-text-section", file
);
423 if (code
== VAR_DECL
&& DECL_IN_CONSTANT_POOL (node
))
424 fputs (" in-constant-pool", file
);
425 if (code
== VAR_DECL
&& DECL_COMMON (node
))
426 fputs (" common", file
);
427 if (code
== VAR_DECL
&& DECL_THREAD_LOCAL_P (node
))
430 fputs (tls_model_names
[DECL_TLS_MODEL (node
)], file
);
433 if (CODE_CONTAINS_STRUCT (code
, TS_DECL_COMMON
))
435 if (DECL_VIRTUAL_P (node
))
436 fputs (" virtual", file
);
437 if (DECL_PRESERVE_P (node
))
438 fputs (" preserve", file
);
439 if (DECL_LANG_FLAG_0 (node
))
440 fputs (" decl_0", file
);
441 if (DECL_LANG_FLAG_1 (node
))
442 fputs (" decl_1", file
);
443 if (DECL_LANG_FLAG_2 (node
))
444 fputs (" decl_2", file
);
445 if (DECL_LANG_FLAG_3 (node
))
446 fputs (" decl_3", file
);
447 if (DECL_LANG_FLAG_4 (node
))
448 fputs (" decl_4", file
);
449 if (DECL_LANG_FLAG_5 (node
))
450 fputs (" decl_5", file
);
451 if (DECL_LANG_FLAG_6 (node
))
452 fputs (" decl_6", file
);
453 if (DECL_LANG_FLAG_7 (node
))
454 fputs (" decl_7", file
);
456 mode
= DECL_MODE (node
);
457 fprintf (file
, " %s", GET_MODE_NAME (mode
));
460 if ((code
== VAR_DECL
|| code
== PARM_DECL
|| code
== RESULT_DECL
)
461 && DECL_BY_REFERENCE (node
))
462 fputs (" passed-by-reference", file
);
464 if (CODE_CONTAINS_STRUCT (code
, TS_DECL_WITH_VIS
) && DECL_DEFER_OUTPUT (node
))
465 fputs (" defer-output", file
);
468 xloc
= expand_location (DECL_SOURCE_LOCATION (node
));
469 fprintf (file
, " file %s line %d col %d", xloc
.file
, xloc
.line
,
472 if (CODE_CONTAINS_STRUCT (code
, TS_DECL_COMMON
))
474 print_node (file
, "size", DECL_SIZE (node
), indent
+ 4);
475 print_node (file
, "unit size", DECL_SIZE_UNIT (node
), indent
+ 4);
477 if (code
!= FUNCTION_DECL
|| DECL_BUILT_IN (node
))
478 indent_to (file
, indent
+ 3);
480 if (DECL_USER_ALIGN (node
))
481 fprintf (file
, " user");
483 fprintf (file
, " align %d", DECL_ALIGN (node
));
484 if (code
== FIELD_DECL
)
485 fprintf (file
, " offset_align " HOST_WIDE_INT_PRINT_UNSIGNED
,
486 DECL_OFFSET_ALIGN (node
));
488 if (code
== FUNCTION_DECL
&& DECL_BUILT_IN (node
))
490 if (DECL_BUILT_IN_CLASS (node
) == BUILT_IN_MD
)
491 fprintf (file
, " built-in BUILT_IN_MD %d", DECL_FUNCTION_CODE (node
));
493 fprintf (file
, " built-in %s:%s",
494 built_in_class_names
[(int) DECL_BUILT_IN_CLASS (node
)],
495 built_in_names
[(int) DECL_FUNCTION_CODE (node
)]);
498 if (code
== FIELD_DECL
)
500 print_node (file
, "offset", DECL_FIELD_OFFSET (node
), indent
+ 4);
501 print_node (file
, "bit offset", DECL_FIELD_BIT_OFFSET (node
),
503 if (DECL_BIT_FIELD_TYPE (node
))
504 print_node (file
, "bit_field_type", DECL_BIT_FIELD_TYPE (node
),
508 print_node_brief (file
, "context", DECL_CONTEXT (node
), indent
+ 4);
510 if (CODE_CONTAINS_STRUCT (code
, TS_DECL_COMMON
))
512 print_node_brief (file
, "attributes",
513 DECL_ATTRIBUTES (node
), indent
+ 4);
514 if (code
!= PARM_DECL
)
515 print_node_brief (file
, "initial", DECL_INITIAL (node
),
518 if (CODE_CONTAINS_STRUCT (code
, TS_DECL_WRTL
))
520 print_node_brief (file
, "abstract_origin",
521 DECL_ABSTRACT_ORIGIN (node
), indent
+ 4);
523 if (CODE_CONTAINS_STRUCT (code
, TS_DECL_NON_COMMON
))
525 print_node (file
, "result", DECL_RESULT_FLD (node
), indent
+ 4);
528 lang_hooks
.print_decl (file
, node
, indent
);
530 if (DECL_RTL_SET_P (node
))
532 indent_to (file
, indent
+ 4);
533 print_rtl (file
, DECL_RTL (node
));
536 if (code
== PARM_DECL
)
538 print_node (file
, "arg-type", DECL_ARG_TYPE (node
), indent
+ 4);
540 if (DECL_INCOMING_RTL (node
) != 0)
542 indent_to (file
, indent
+ 4);
543 fprintf (file
, "incoming-rtl ");
544 print_rtl (file
, DECL_INCOMING_RTL (node
));
547 else if (code
== FUNCTION_DECL
548 && DECL_STRUCT_FUNCTION (node
) != 0)
550 print_node (file
, "arguments", DECL_ARGUMENTS (node
), indent
+ 4);
551 indent_to (file
, indent
+ 4);
552 dump_addr (file
, "struct-function ", DECL_STRUCT_FUNCTION (node
));
555 if ((code
== VAR_DECL
|| code
== PARM_DECL
)
556 && DECL_HAS_VALUE_EXPR_P (node
))
557 print_node (file
, "value-expr", DECL_VALUE_EXPR (node
), indent
+ 4);
559 /* Print the decl chain only if decl is at second level. */
561 print_node (file
, "chain", TREE_CHAIN (node
), indent
+ 4);
563 print_node_brief (file
, "chain", TREE_CHAIN (node
), indent
+ 4);
567 if (TYPE_UNSIGNED (node
))
568 fputs (" unsigned", file
);
570 if (TYPE_NO_FORCE_BLK (node
))
571 fputs (" no-force-blk", file
);
573 if (TYPE_STRING_FLAG (node
))
574 fputs (" string-flag", file
);
576 if (TYPE_NEEDS_CONSTRUCTING (node
))
577 fputs (" needs-constructing", file
);
579 /* The transparent-union flag is used for different things in
581 if ((code
== UNION_TYPE
|| code
== RECORD_TYPE
)
582 && TYPE_TRANSPARENT_AGGR (node
))
583 fputs (" transparent-aggr", file
);
584 else if (code
== ARRAY_TYPE
585 && TYPE_NONALIASED_COMPONENT (node
))
586 fputs (" nonaliased-component", file
);
588 if (TYPE_PACKED (node
))
589 fputs (" packed", file
);
591 if (TYPE_RESTRICT (node
))
592 fputs (" restrict", file
);
594 if (TYPE_LANG_FLAG_0 (node
))
595 fputs (" type_0", file
);
596 if (TYPE_LANG_FLAG_1 (node
))
597 fputs (" type_1", file
);
598 if (TYPE_LANG_FLAG_2 (node
))
599 fputs (" type_2", file
);
600 if (TYPE_LANG_FLAG_3 (node
))
601 fputs (" type_3", file
);
602 if (TYPE_LANG_FLAG_4 (node
))
603 fputs (" type_4", file
);
604 if (TYPE_LANG_FLAG_5 (node
))
605 fputs (" type_5", file
);
606 if (TYPE_LANG_FLAG_6 (node
))
607 fputs (" type_6", file
);
609 mode
= TYPE_MODE (node
);
610 fprintf (file
, " %s", GET_MODE_NAME (mode
));
612 print_node (file
, "size", TYPE_SIZE (node
), indent
+ 4);
613 print_node (file
, "unit size", TYPE_SIZE_UNIT (node
), indent
+ 4);
614 indent_to (file
, indent
+ 3);
616 if (TYPE_USER_ALIGN (node
))
617 fprintf (file
, " user");
619 fprintf (file
, " align %d symtab %d alias set " HOST_WIDE_INT_PRINT_DEC
,
620 TYPE_ALIGN (node
), TYPE_SYMTAB_ADDRESS (node
),
621 (HOST_WIDE_INT
) TYPE_ALIAS_SET (node
));
623 if (TYPE_STRUCTURAL_EQUALITY_P (node
))
624 fprintf (file
, " structural equality");
626 dump_addr (file
, " canonical type ", TYPE_CANONICAL (node
));
628 print_node (file
, "attributes", TYPE_ATTRIBUTES (node
), indent
+ 4);
630 if (INTEGRAL_TYPE_P (node
) || code
== REAL_TYPE
631 || code
== FIXED_POINT_TYPE
)
633 fprintf (file
, " precision %d", TYPE_PRECISION (node
));
634 print_node_brief (file
, "min", TYPE_MIN_VALUE (node
), indent
+ 4);
635 print_node_brief (file
, "max", TYPE_MAX_VALUE (node
), indent
+ 4);
638 if (code
== ENUMERAL_TYPE
)
639 print_node (file
, "values", TYPE_VALUES (node
), indent
+ 4);
640 else if (code
== ARRAY_TYPE
)
641 print_node (file
, "domain", TYPE_DOMAIN (node
), indent
+ 4);
642 else if (code
== VECTOR_TYPE
)
643 fprintf (file
, " nunits %d", (int) TYPE_VECTOR_SUBPARTS (node
));
644 else if (code
== RECORD_TYPE
645 || code
== UNION_TYPE
646 || code
== QUAL_UNION_TYPE
)
647 print_node (file
, "fields", TYPE_FIELDS (node
), indent
+ 4);
648 else if (code
== FUNCTION_TYPE
649 || code
== METHOD_TYPE
)
651 if (TYPE_METHOD_BASETYPE (node
))
652 print_node_brief (file
, "method basetype",
653 TYPE_METHOD_BASETYPE (node
), indent
+ 4);
654 print_node (file
, "arg-types", TYPE_ARG_TYPES (node
), indent
+ 4);
656 else if (code
== OFFSET_TYPE
)
657 print_node_brief (file
, "basetype", TYPE_OFFSET_BASETYPE (node
),
660 if (TYPE_CONTEXT (node
))
661 print_node_brief (file
, "context", TYPE_CONTEXT (node
), indent
+ 4);
663 lang_hooks
.print_type (file
, node
, indent
);
665 if (TYPE_POINTER_TO (node
) || TREE_CHAIN (node
))
666 indent_to (file
, indent
+ 3);
668 print_node_brief (file
, "pointer_to_this", TYPE_POINTER_TO (node
),
670 print_node_brief (file
, "reference_to_this", TYPE_REFERENCE_TO (node
),
672 print_node_brief (file
, "chain", TREE_CHAIN (node
), indent
+ 4);
682 if (code
== BIND_EXPR
)
684 print_node (file
, "vars", TREE_OPERAND (node
, 0), indent
+ 4);
685 print_node (file
, "body", TREE_OPERAND (node
, 1), indent
+ 4);
686 print_node (file
, "block", TREE_OPERAND (node
, 2), indent
+ 4);
689 if (code
== CALL_EXPR
)
691 call_expr_arg_iterator iter
;
693 print_node (file
, "fn", CALL_EXPR_FN (node
), indent
+ 4);
694 print_node (file
, "static_chain", CALL_EXPR_STATIC_CHAIN (node
),
697 FOR_EACH_CALL_EXPR_ARG (arg
, iter
, node
)
700 sprintf (temp
, "arg %d", i
);
701 print_node (file
, temp
, arg
, indent
+ 4);
707 len
= TREE_OPERAND_LENGTH (node
);
709 for (i
= 0; i
< len
; i
++)
713 sprintf (temp
, "arg %d", i
);
714 print_node (file
, temp
, TREE_OPERAND (node
, i
), indent
+ 4);
717 if (CODE_CONTAINS_STRUCT (code
, TS_COMMON
))
718 print_node (file
, "chain", TREE_CHAIN (node
), indent
+ 4);
722 case tcc_exceptional
:
726 if (TREE_OVERFLOW (node
))
727 fprintf (file
, " overflow");
730 print_dec (node
, file
, TYPE_SIGN (TREE_TYPE (node
)));
737 if (TREE_OVERFLOW (node
))
738 fprintf (file
, " overflow");
740 d
= TREE_REAL_CST (node
);
741 if (REAL_VALUE_ISINF (d
))
742 fprintf (file
, REAL_VALUE_NEGATIVE (d
) ? " -Inf" : " Inf");
743 else if (REAL_VALUE_ISNAN (d
))
744 fprintf (file
, " Nan");
748 real_to_decimal (string
, &d
, sizeof (string
), 0, 1);
749 fprintf (file
, " %s", string
);
759 if (TREE_OVERFLOW (node
))
760 fprintf (file
, " overflow");
762 f
= TREE_FIXED_CST (node
);
763 fixed_to_decimal (string
, &f
, sizeof (string
));
764 fprintf (file
, " %s", string
);
773 for (i
= 0; i
< VECTOR_CST_NELTS (node
); ++i
)
775 sprintf (buf
, "elt%u: ", i
);
776 print_node (file
, buf
, VECTOR_CST_ELT (node
, i
), indent
+ 4);
782 print_node (file
, "real", TREE_REALPART (node
), indent
+ 4);
783 print_node (file
, "imag", TREE_IMAGPART (node
), indent
+ 4);
788 const char *p
= TREE_STRING_POINTER (node
);
789 int i
= TREE_STRING_LENGTH (node
);
794 if (ch
>= ' ' && ch
< 127)
797 fprintf (file
, "\\%03o", ch
& 0xFF);
803 case IDENTIFIER_NODE
:
804 lang_hooks
.print_identifier (file
, node
, indent
);
808 print_node (file
, "purpose", TREE_PURPOSE (node
), indent
+ 4);
809 print_node (file
, "value", TREE_VALUE (node
), indent
+ 4);
810 print_node (file
, "chain", TREE_CHAIN (node
), indent
+ 4);
814 len
= TREE_VEC_LENGTH (node
);
815 for (i
= 0; i
< len
; i
++)
816 if (TREE_VEC_ELT (node
, i
))
819 sprintf (temp
, "elt %d", i
);
820 print_node (file
, temp
, TREE_VEC_ELT (node
, i
), indent
+ 4);
826 unsigned HOST_WIDE_INT cnt
;
828 len
= vec_safe_length (CONSTRUCTOR_ELTS (node
));
829 fprintf (file
, " lngt %d", len
);
830 FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (node
),
833 print_node (file
, "idx", index
, indent
+ 4);
834 print_node (file
, "val", value
, indent
+ 4);
840 dump_addr (file
, " head ", node
->stmt_list
.head
);
841 dump_addr (file
, " tail ", node
->stmt_list
.tail
);
842 fprintf (file
, " stmts");
844 tree_stmt_iterator i
;
845 for (i
= tsi_start (node
); !tsi_end_p (i
); tsi_next (&i
))
847 /* Not printing the addresses of the (not-a-tree)
848 'struct tree_stmt_list_node's. */
849 dump_addr (file
, " ", tsi_stmt (i
));
851 fprintf (file
, "\n");
852 for (i
= tsi_start (node
); !tsi_end_p (i
); tsi_next (&i
))
854 /* Not printing the addresses of the (not-a-tree)
855 'struct tree_stmt_list_node's. */
856 print_node (file
, "stmt", tsi_stmt (i
), indent
+ 4);
862 print_node (file
, "vars", BLOCK_VARS (node
), indent
+ 4);
863 print_node (file
, "supercontext", BLOCK_SUPERCONTEXT (node
),
865 print_node (file
, "subblocks", BLOCK_SUBBLOCKS (node
), indent
+ 4);
866 print_node (file
, "chain", BLOCK_CHAIN (node
), indent
+ 4);
867 print_node (file
, "abstract_origin",
868 BLOCK_ABSTRACT_ORIGIN (node
), indent
+ 4);
872 print_node_brief (file
, "var", SSA_NAME_VAR (node
), indent
+ 4);
873 fprintf (file
, "def_stmt ");
874 print_gimple_stmt (file
, SSA_NAME_DEF_STMT (node
), indent
+ 4, 0);
876 indent_to (file
, indent
+ 4);
877 fprintf (file
, "version %u", SSA_NAME_VERSION (node
));
878 if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (node
))
879 fprintf (file
, " in-abnormal-phi");
880 if (SSA_NAME_IN_FREE_LIST (node
))
881 fprintf (file
, " in-free-list");
883 if (SSA_NAME_PTR_INFO (node
))
885 indent_to (file
, indent
+ 3);
886 if (SSA_NAME_PTR_INFO (node
))
887 dump_addr (file
, " ptr-info ", SSA_NAME_PTR_INFO (node
));
894 fprintf (file
, " %s",
895 omp_clause_code_name
[OMP_CLAUSE_CODE (node
)]);
896 for (i
= 0; i
< omp_clause_num_ops
[OMP_CLAUSE_CODE (node
)]; i
++)
898 indent_to (file
, indent
+ 4);
899 fprintf (file
, "op %d:", i
);
900 print_node_brief (file
, "", OMP_CLAUSE_OPERAND (node
, i
), 0);
905 case OPTIMIZATION_NODE
:
906 cl_optimization_print (file
, indent
+ 4, TREE_OPTIMIZATION (node
));
909 case TARGET_OPTION_NODE
:
910 cl_target_option_print (file
, indent
+ 4, TREE_TARGET_OPTION (node
));
913 fprintf (file
, " imported declaration");
914 print_node_brief (file
, "associated declaration",
915 IMPORTED_DECL_ASSOCIATED_DECL (node
),
920 if (EXCEPTIONAL_CLASS_P (node
))
921 lang_hooks
.print_xnode (file
, node
, indent
);
928 if (EXPR_HAS_LOCATION (node
))
930 expanded_location xloc
= expand_location (EXPR_LOCATION (node
));
931 indent_to (file
, indent
+4);
932 fprintf (file
, "%s:%d:%d", xloc
.file
, xloc
.line
, xloc
.column
);
939 /* Print the node NODE on standard error, for debugging.
940 Most nodes referred to by this one are printed recursively
941 down to a depth of six. */
944 debug_tree (tree node
)
946 table
= XCNEWVEC (struct bucket
*, HASH_SIZE
);
947 print_node (stderr
, "", node
, 0);
954 debug_raw (const tree_node
&ref
)
956 debug_tree (const_cast <tree
> (&ref
));
960 debug_raw (const tree_node
*ptr
)
965 fprintf (stderr
, "<nil>\n");
969 dump_tree_via_hooks (const tree_node
*ptr
, int options
)
972 lang_hooks
.print_decl (stderr
, const_cast <tree_node
*> (ptr
), 0);
973 else if (TYPE_P (ptr
))
974 lang_hooks
.print_type (stderr
, const_cast <tree_node
*> (ptr
), 0);
975 else if (TREE_CODE (ptr
) == IDENTIFIER_NODE
)
976 lang_hooks
.print_identifier (stderr
, const_cast <tree_node
*> (ptr
), 0);
978 print_generic_expr (stderr
, const_cast <tree_node
*> (ptr
), options
);
979 fprintf (stderr
, "\n");
983 debug (const tree_node
&ref
)
985 dump_tree_via_hooks (&ref
, 0);
989 debug (const tree_node
*ptr
)
994 fprintf (stderr
, "<nil>\n");
998 debug_verbose (const tree_node
&ref
)
1000 dump_tree_via_hooks (&ref
, TDF_VERBOSE
);
1004 debug_verbose (const tree_node
*ptr
)
1007 debug_verbose (*ptr
);
1009 fprintf (stderr
, "<nil>\n");
1013 debug_head (const tree_node
&ref
)
1019 debug_head (const tree_node
*ptr
)
1024 fprintf (stderr
, "<nil>\n");
1028 debug_body (const tree_node
&ref
)
1030 if (TREE_CODE (&ref
) == FUNCTION_DECL
)
1031 dump_function_to_file (const_cast <tree_node
*> (&ref
), stderr
, 0);
1037 debug_body (const tree_node
*ptr
)
1042 fprintf (stderr
, "<nil>\n");
1045 /* Print the vector of trees VEC on standard error, for debugging.
1046 Most nodes referred to by this one are printed recursively
1047 down to a depth of six. */
1050 debug_raw (vec
<tree
, va_gc
> &ref
)
1055 /* Print the slot this node is in, and its code, and address. */
1056 fprintf (stderr
, "<VEC");
1057 dump_addr (stderr
, " ", ref
.address ());
1059 FOR_EACH_VEC_ELT (ref
, ix
, elt
)
1061 fprintf (stderr
, "elt %d ", ix
);
1067 debug (vec
<tree
, va_gc
> &ref
)
1072 /* Print the slot this node is in, and its code, and address. */
1073 fprintf (stderr
, "<VEC");
1074 dump_addr (stderr
, " ", ref
.address ());
1076 FOR_EACH_VEC_ELT (ref
, ix
, elt
)
1078 fprintf (stderr
, "elt %d ", ix
);
1084 debug (vec
<tree
, va_gc
> *ptr
)
1089 fprintf (stderr
, "<nil>\n");
1093 debug_raw (vec
<tree
, va_gc
> *ptr
)
1098 fprintf (stderr
, "<nil>\n");
1102 debug_vec_tree (vec
<tree
, va_gc
> *vec
)