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"
29 #include "print-rtl.h"
30 #include "stor-layout.h"
31 #include "langhooks.h"
32 #include "tree-iterator.h"
33 #include "diagnostic.h"
34 #include "gimple-pretty-print.h" /* FIXME */
35 #include "hard-reg-set.h"
39 #include "tree-dump.h"
41 #include "wide-int-print.h"
43 /* Define the hash table of nodes already seen.
44 Such nodes are not repeated; brief cross-references are used. */
54 static struct bucket
**table
;
56 /* Print PREFIX and ADDR to FILE. */
58 dump_addr (FILE *file
, const char *prefix
, const void *addr
)
60 if (flag_dump_noaddr
|| flag_dump_unnumbered
)
61 fprintf (file
, "%s#", prefix
);
63 fprintf (file
, "%s" HOST_PTR_PRINTF
, prefix
, addr
);
66 /* Print a node in brief fashion, with just the code, address and name. */
69 print_node_brief (FILE *file
, const char *prefix
, const_tree node
, int indent
)
71 enum tree_code_class tclass
;
76 tclass
= TREE_CODE_CLASS (TREE_CODE (node
));
78 /* Always print the slot this node is in, and its code, address and
82 fprintf (file
, "%s <%s", prefix
, get_tree_code_name (TREE_CODE (node
)));
83 dump_addr (file
, " ", node
);
85 if (tclass
== tcc_declaration
)
88 fprintf (file
, " %s", IDENTIFIER_POINTER (DECL_NAME (node
)));
89 else if (TREE_CODE (node
) == LABEL_DECL
90 && LABEL_DECL_UID (node
) != -1)
92 if (dump_flags
& TDF_NOUID
)
93 fprintf (file
, " L.xxxx");
95 fprintf (file
, " L.%d", (int) LABEL_DECL_UID (node
));
99 if (dump_flags
& TDF_NOUID
)
100 fprintf (file
, " %c.xxxx",
101 TREE_CODE (node
) == CONST_DECL
? 'C' : 'D');
103 fprintf (file
, " %c.%u",
104 TREE_CODE (node
) == CONST_DECL
? 'C' : 'D',
108 else if (tclass
== tcc_type
)
110 if (TYPE_NAME (node
))
112 if (TREE_CODE (TYPE_NAME (node
)) == IDENTIFIER_NODE
)
113 fprintf (file
, " %s", IDENTIFIER_POINTER (TYPE_NAME (node
)));
114 else if (TREE_CODE (TYPE_NAME (node
)) == TYPE_DECL
115 && DECL_NAME (TYPE_NAME (node
)))
116 fprintf (file
, " %s",
117 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (node
))));
119 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
120 fprintf (file
, " address-space-%d", TYPE_ADDR_SPACE (node
));
122 if (TREE_CODE (node
) == IDENTIFIER_NODE
)
123 fprintf (file
, " %s", IDENTIFIER_POINTER (node
));
125 /* We might as well always print the value of an integer or real. */
126 if (TREE_CODE (node
) == INTEGER_CST
)
128 if (TREE_OVERFLOW (node
))
129 fprintf (file
, " overflow");
132 print_dec (node
, file
, TYPE_SIGN (TREE_TYPE (node
)));
134 if (TREE_CODE (node
) == REAL_CST
)
138 if (TREE_OVERFLOW (node
))
139 fprintf (file
, " overflow");
141 d
= TREE_REAL_CST (node
);
142 if (REAL_VALUE_ISINF (d
))
143 fprintf (file
, REAL_VALUE_NEGATIVE (d
) ? " -Inf" : " Inf");
144 else if (REAL_VALUE_ISNAN (d
))
145 fprintf (file
, " Nan");
149 real_to_decimal (string
, &d
, sizeof (string
), 0, 1);
150 fprintf (file
, " %s", string
);
153 if (TREE_CODE (node
) == FIXED_CST
)
158 if (TREE_OVERFLOW (node
))
159 fprintf (file
, " overflow");
161 f
= TREE_FIXED_CST (node
);
162 fixed_to_decimal (string
, &f
, sizeof (string
));
163 fprintf (file
, " %s", string
);
170 indent_to (FILE *file
, int column
)
174 /* Since this is the long way, indent to desired column. */
176 fprintf (file
, "\n");
177 for (i
= 0; i
< column
; i
++)
181 /* Print the node NODE in full on file FILE, preceded by PREFIX,
182 starting in column INDENT. */
185 print_node (FILE *file
, const char *prefix
, tree node
, int indent
)
190 enum tree_code_class tclass
;
193 expanded_location xloc
;
199 code
= TREE_CODE (node
);
200 tclass
= TREE_CODE_CLASS (code
);
202 /* Don't get too deep in nesting. If the user wants to see deeper,
203 it is easy to use the address of a lowest-level node
204 as an argument in another call to debug_tree. */
208 print_node_brief (file
, prefix
, node
, indent
);
212 if (indent
> 8 && (tclass
== tcc_type
|| tclass
== tcc_declaration
))
214 print_node_brief (file
, prefix
, node
, indent
);
218 /* It is unsafe to look at any other fields of an ERROR_MARK node. */
219 if (code
== ERROR_MARK
)
221 print_node_brief (file
, prefix
, node
, indent
);
225 /* Allow this function to be called if the table is not there. */
228 hash
= ((uintptr_t) node
) % HASH_SIZE
;
230 /* If node is in the table, just mention its address. */
231 for (b
= table
[hash
]; b
; b
= b
->next
)
234 print_node_brief (file
, prefix
, node
, indent
);
238 /* Add this node to the table. */
239 b
= XNEW (struct bucket
);
241 b
->next
= table
[hash
];
245 /* Indent to the specified column, since this is the long form. */
246 indent_to (file
, indent
);
248 /* Print the slot this node is in, and its code, and address. */
249 fprintf (file
, "%s <%s", prefix
, get_tree_code_name (code
));
250 dump_addr (file
, " ", node
);
252 /* Print the name, if any. */
253 if (tclass
== tcc_declaration
)
255 if (DECL_NAME (node
))
256 fprintf (file
, " %s", IDENTIFIER_POINTER (DECL_NAME (node
)));
257 else if (code
== LABEL_DECL
258 && LABEL_DECL_UID (node
) != -1)
260 if (dump_flags
& TDF_NOUID
)
261 fprintf (file
, " L.xxxx");
263 fprintf (file
, " L.%d", (int) LABEL_DECL_UID (node
));
267 if (dump_flags
& TDF_NOUID
)
268 fprintf (file
, " %c.xxxx", code
== CONST_DECL
? 'C' : 'D');
270 fprintf (file
, " %c.%u", code
== CONST_DECL
? 'C' : 'D',
274 else if (tclass
== tcc_type
)
276 if (TYPE_NAME (node
))
278 if (TREE_CODE (TYPE_NAME (node
)) == IDENTIFIER_NODE
)
279 fprintf (file
, " %s", IDENTIFIER_POINTER (TYPE_NAME (node
)));
280 else if (TREE_CODE (TYPE_NAME (node
)) == TYPE_DECL
281 && DECL_NAME (TYPE_NAME (node
)))
282 fprintf (file
, " %s",
283 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (node
))));
286 if (code
== IDENTIFIER_NODE
)
287 fprintf (file
, " %s", IDENTIFIER_POINTER (node
));
289 if (code
== INTEGER_CST
)
292 print_node_brief (file
, "type", TREE_TYPE (node
), indent
+ 4);
294 else if (CODE_CONTAINS_STRUCT (code
, TS_TYPED
))
296 print_node (file
, "type", TREE_TYPE (node
), indent
+ 4);
297 if (TREE_TYPE (node
))
298 indent_to (file
, indent
+ 3);
301 if (!TYPE_P (node
) && TREE_SIDE_EFFECTS (node
))
302 fputs (" side-effects", file
);
304 if (TYPE_P (node
) ? TYPE_READONLY (node
) : TREE_READONLY (node
))
305 fputs (" readonly", file
);
306 if (TYPE_P (node
) && TYPE_ATOMIC (node
))
307 fputs (" atomic", file
);
308 if (!TYPE_P (node
) && TREE_CONSTANT (node
))
309 fputs (" constant", file
);
310 else if (TYPE_P (node
) && TYPE_SIZES_GIMPLIFIED (node
))
311 fputs (" sizes-gimplified", file
);
313 if (TYPE_P (node
) && !ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
314 fprintf (file
, " address-space-%d", TYPE_ADDR_SPACE (node
));
316 if (TREE_ADDRESSABLE (node
))
317 fputs (" addressable", file
);
318 if (TREE_THIS_VOLATILE (node
))
319 fputs (" volatile", file
);
320 if (TREE_ASM_WRITTEN (node
))
321 fputs (" asm_written", file
);
322 if (TREE_USED (node
))
323 fputs (" used", file
);
324 if (TREE_NOTHROW (node
))
325 fputs (TYPE_P (node
) ? " align-ok" : " nothrow", file
);
326 if (TREE_PUBLIC (node
))
327 fputs (" public", file
);
328 if (TREE_PRIVATE (node
))
329 fputs (" private", file
);
330 if (TREE_PROTECTED (node
))
331 fputs (" protected", file
);
332 if (TREE_STATIC (node
))
333 fputs (" static", file
);
334 if (TREE_DEPRECATED (node
))
335 fputs (" deprecated", file
);
336 if (TREE_VISITED (node
))
337 fputs (" visited", file
);
339 if (code
!= TREE_VEC
&& code
!= INTEGER_CST
&& code
!= SSA_NAME
)
341 if (TREE_LANG_FLAG_0 (node
))
342 fputs (" tree_0", file
);
343 if (TREE_LANG_FLAG_1 (node
))
344 fputs (" tree_1", file
);
345 if (TREE_LANG_FLAG_2 (node
))
346 fputs (" tree_2", file
);
347 if (TREE_LANG_FLAG_3 (node
))
348 fputs (" tree_3", file
);
349 if (TREE_LANG_FLAG_4 (node
))
350 fputs (" tree_4", file
);
351 if (TREE_LANG_FLAG_5 (node
))
352 fputs (" tree_5", file
);
353 if (TREE_LANG_FLAG_6 (node
))
354 fputs (" tree_6", file
);
357 /* DECL_ nodes have additional attributes. */
359 switch (TREE_CODE_CLASS (code
))
361 case tcc_declaration
:
362 if (CODE_CONTAINS_STRUCT (code
, TS_DECL_COMMON
))
364 if (DECL_UNSIGNED (node
))
365 fputs (" unsigned", file
);
366 if (DECL_IGNORED_P (node
))
367 fputs (" ignored", file
);
368 if (DECL_ABSTRACT_P (node
))
369 fputs (" abstract", file
);
370 if (DECL_EXTERNAL (node
))
371 fputs (" external", file
);
372 if (DECL_NONLOCAL (node
))
373 fputs (" nonlocal", file
);
375 if (CODE_CONTAINS_STRUCT (code
, TS_DECL_WITH_VIS
))
377 if (DECL_WEAK (node
))
378 fputs (" weak", file
);
379 if (DECL_IN_SYSTEM_HEADER (node
))
380 fputs (" in_system_header", file
);
382 if (CODE_CONTAINS_STRUCT (code
, TS_DECL_WRTL
)
383 && code
!= LABEL_DECL
384 && code
!= FUNCTION_DECL
385 && DECL_REGISTER (node
))
386 fputs (" regdecl", file
);
388 if (code
== TYPE_DECL
&& TYPE_DECL_SUPPRESS_DEBUG (node
))
389 fputs (" suppress-debug", file
);
391 if (code
== FUNCTION_DECL
392 && DECL_FUNCTION_SPECIFIC_TARGET (node
))
393 fputs (" function-specific-target", file
);
394 if (code
== FUNCTION_DECL
395 && DECL_FUNCTION_SPECIFIC_OPTIMIZATION (node
))
396 fputs (" function-specific-opt", file
);
397 if (code
== FUNCTION_DECL
&& DECL_DECLARED_INLINE_P (node
))
398 fputs (" autoinline", file
);
399 if (code
== FUNCTION_DECL
&& DECL_BUILT_IN (node
))
400 fputs (" built-in", file
);
401 if (code
== FUNCTION_DECL
&& DECL_STATIC_CHAIN (node
))
402 fputs (" static-chain", file
);
403 if (TREE_CODE (node
) == FUNCTION_DECL
&& decl_is_tm_clone (node
))
404 fputs (" tm-clone", file
);
406 if (code
== FIELD_DECL
&& DECL_PACKED (node
))
407 fputs (" packed", file
);
408 if (code
== FIELD_DECL
&& DECL_BIT_FIELD (node
))
409 fputs (" bit-field", file
);
410 if (code
== FIELD_DECL
&& DECL_NONADDRESSABLE_P (node
))
411 fputs (" nonaddressable", file
);
413 if (code
== LABEL_DECL
&& EH_LANDING_PAD_NR (node
))
414 fprintf (file
, " landing-pad:%d", EH_LANDING_PAD_NR (node
));
416 if (code
== VAR_DECL
&& DECL_IN_TEXT_SECTION (node
))
417 fputs (" in-text-section", file
);
418 if (code
== VAR_DECL
&& DECL_IN_CONSTANT_POOL (node
))
419 fputs (" in-constant-pool", file
);
420 if (code
== VAR_DECL
&& DECL_COMMON (node
))
421 fputs (" common", file
);
422 if (code
== VAR_DECL
&& DECL_THREAD_LOCAL_P (node
))
425 fputs (tls_model_names
[DECL_TLS_MODEL (node
)], file
);
428 if (CODE_CONTAINS_STRUCT (code
, TS_DECL_COMMON
))
430 if (DECL_VIRTUAL_P (node
))
431 fputs (" virtual", file
);
432 if (DECL_PRESERVE_P (node
))
433 fputs (" preserve", file
);
434 if (DECL_LANG_FLAG_0 (node
))
435 fputs (" decl_0", file
);
436 if (DECL_LANG_FLAG_1 (node
))
437 fputs (" decl_1", file
);
438 if (DECL_LANG_FLAG_2 (node
))
439 fputs (" decl_2", file
);
440 if (DECL_LANG_FLAG_3 (node
))
441 fputs (" decl_3", file
);
442 if (DECL_LANG_FLAG_4 (node
))
443 fputs (" decl_4", file
);
444 if (DECL_LANG_FLAG_5 (node
))
445 fputs (" decl_5", file
);
446 if (DECL_LANG_FLAG_6 (node
))
447 fputs (" decl_6", file
);
448 if (DECL_LANG_FLAG_7 (node
))
449 fputs (" decl_7", file
);
451 mode
= DECL_MODE (node
);
452 fprintf (file
, " %s", GET_MODE_NAME (mode
));
455 if ((code
== VAR_DECL
|| code
== PARM_DECL
|| code
== RESULT_DECL
)
456 && DECL_BY_REFERENCE (node
))
457 fputs (" passed-by-reference", file
);
459 if (CODE_CONTAINS_STRUCT (code
, TS_DECL_WITH_VIS
) && DECL_DEFER_OUTPUT (node
))
460 fputs (" defer-output", file
);
463 xloc
= expand_location (DECL_SOURCE_LOCATION (node
));
464 fprintf (file
, " file %s line %d col %d", xloc
.file
, xloc
.line
,
467 if (CODE_CONTAINS_STRUCT (code
, TS_DECL_COMMON
))
469 print_node (file
, "size", DECL_SIZE (node
), indent
+ 4);
470 print_node (file
, "unit size", DECL_SIZE_UNIT (node
), indent
+ 4);
472 if (code
!= FUNCTION_DECL
|| DECL_BUILT_IN (node
))
473 indent_to (file
, indent
+ 3);
475 if (DECL_USER_ALIGN (node
))
476 fprintf (file
, " user");
478 fprintf (file
, " align %d", DECL_ALIGN (node
));
479 if (code
== FIELD_DECL
)
480 fprintf (file
, " offset_align " HOST_WIDE_INT_PRINT_UNSIGNED
,
481 DECL_OFFSET_ALIGN (node
));
483 if (code
== FUNCTION_DECL
&& DECL_BUILT_IN (node
))
485 if (DECL_BUILT_IN_CLASS (node
) == BUILT_IN_MD
)
486 fprintf (file
, " built-in BUILT_IN_MD %d", DECL_FUNCTION_CODE (node
));
488 fprintf (file
, " built-in %s:%s",
489 built_in_class_names
[(int) DECL_BUILT_IN_CLASS (node
)],
490 built_in_names
[(int) DECL_FUNCTION_CODE (node
)]);
493 if (code
== FIELD_DECL
)
495 print_node (file
, "offset", DECL_FIELD_OFFSET (node
), indent
+ 4);
496 print_node (file
, "bit offset", DECL_FIELD_BIT_OFFSET (node
),
498 if (DECL_BIT_FIELD_TYPE (node
))
499 print_node (file
, "bit_field_type", DECL_BIT_FIELD_TYPE (node
),
503 print_node_brief (file
, "context", DECL_CONTEXT (node
), indent
+ 4);
505 if (CODE_CONTAINS_STRUCT (code
, TS_DECL_COMMON
))
507 print_node_brief (file
, "attributes",
508 DECL_ATTRIBUTES (node
), indent
+ 4);
509 if (code
!= PARM_DECL
)
510 print_node_brief (file
, "initial", DECL_INITIAL (node
),
513 if (CODE_CONTAINS_STRUCT (code
, TS_DECL_WRTL
))
515 print_node_brief (file
, "abstract_origin",
516 DECL_ABSTRACT_ORIGIN (node
), indent
+ 4);
518 if (CODE_CONTAINS_STRUCT (code
, TS_DECL_NON_COMMON
))
520 print_node (file
, "result", DECL_RESULT_FLD (node
), indent
+ 4);
523 lang_hooks
.print_decl (file
, node
, indent
);
525 if (DECL_RTL_SET_P (node
))
527 indent_to (file
, indent
+ 4);
528 print_rtl (file
, DECL_RTL (node
));
531 if (code
== PARM_DECL
)
533 print_node (file
, "arg-type", DECL_ARG_TYPE (node
), indent
+ 4);
535 if (DECL_INCOMING_RTL (node
) != 0)
537 indent_to (file
, indent
+ 4);
538 fprintf (file
, "incoming-rtl ");
539 print_rtl (file
, DECL_INCOMING_RTL (node
));
542 else if (code
== FUNCTION_DECL
543 && DECL_STRUCT_FUNCTION (node
) != 0)
545 print_node (file
, "arguments", DECL_ARGUMENTS (node
), indent
+ 4);
546 indent_to (file
, indent
+ 4);
547 dump_addr (file
, "struct-function ", DECL_STRUCT_FUNCTION (node
));
550 if ((code
== VAR_DECL
|| code
== PARM_DECL
)
551 && DECL_HAS_VALUE_EXPR_P (node
))
552 print_node (file
, "value-expr", DECL_VALUE_EXPR (node
), indent
+ 4);
554 /* Print the decl chain only if decl is at second level. */
556 print_node (file
, "chain", TREE_CHAIN (node
), indent
+ 4);
558 print_node_brief (file
, "chain", TREE_CHAIN (node
), indent
+ 4);
562 if (TYPE_UNSIGNED (node
))
563 fputs (" unsigned", file
);
565 if (TYPE_NO_FORCE_BLK (node
))
566 fputs (" no-force-blk", file
);
568 if (TYPE_STRING_FLAG (node
))
569 fputs (" string-flag", file
);
571 if (TYPE_NEEDS_CONSTRUCTING (node
))
572 fputs (" needs-constructing", file
);
574 /* The transparent-union flag is used for different things in
576 if ((code
== UNION_TYPE
|| code
== RECORD_TYPE
)
577 && TYPE_TRANSPARENT_AGGR (node
))
578 fputs (" transparent-aggr", file
);
579 else if (code
== ARRAY_TYPE
580 && TYPE_NONALIASED_COMPONENT (node
))
581 fputs (" nonaliased-component", file
);
583 if (TYPE_PACKED (node
))
584 fputs (" packed", file
);
586 if (TYPE_RESTRICT (node
))
587 fputs (" restrict", file
);
589 if (TYPE_LANG_FLAG_0 (node
))
590 fputs (" type_0", file
);
591 if (TYPE_LANG_FLAG_1 (node
))
592 fputs (" type_1", file
);
593 if (TYPE_LANG_FLAG_2 (node
))
594 fputs (" type_2", file
);
595 if (TYPE_LANG_FLAG_3 (node
))
596 fputs (" type_3", file
);
597 if (TYPE_LANG_FLAG_4 (node
))
598 fputs (" type_4", file
);
599 if (TYPE_LANG_FLAG_5 (node
))
600 fputs (" type_5", file
);
601 if (TYPE_LANG_FLAG_6 (node
))
602 fputs (" type_6", file
);
604 mode
= TYPE_MODE (node
);
605 fprintf (file
, " %s", GET_MODE_NAME (mode
));
607 print_node (file
, "size", TYPE_SIZE (node
), indent
+ 4);
608 print_node (file
, "unit size", TYPE_SIZE_UNIT (node
), indent
+ 4);
609 indent_to (file
, indent
+ 3);
611 if (TYPE_USER_ALIGN (node
))
612 fprintf (file
, " user");
614 fprintf (file
, " align %d symtab %d alias set " HOST_WIDE_INT_PRINT_DEC
,
615 TYPE_ALIGN (node
), TYPE_SYMTAB_ADDRESS (node
),
616 (HOST_WIDE_INT
) TYPE_ALIAS_SET (node
));
618 if (TYPE_STRUCTURAL_EQUALITY_P (node
))
619 fprintf (file
, " structural equality");
621 dump_addr (file
, " canonical type ", TYPE_CANONICAL (node
));
623 print_node (file
, "attributes", TYPE_ATTRIBUTES (node
), indent
+ 4);
625 if (INTEGRAL_TYPE_P (node
) || code
== REAL_TYPE
626 || code
== FIXED_POINT_TYPE
)
628 fprintf (file
, " precision %d", TYPE_PRECISION (node
));
629 print_node_brief (file
, "min", TYPE_MIN_VALUE (node
), indent
+ 4);
630 print_node_brief (file
, "max", TYPE_MAX_VALUE (node
), indent
+ 4);
633 if (code
== ENUMERAL_TYPE
)
634 print_node (file
, "values", TYPE_VALUES (node
), indent
+ 4);
635 else if (code
== ARRAY_TYPE
)
636 print_node (file
, "domain", TYPE_DOMAIN (node
), indent
+ 4);
637 else if (code
== VECTOR_TYPE
)
638 fprintf (file
, " nunits %d", (int) TYPE_VECTOR_SUBPARTS (node
));
639 else if (code
== RECORD_TYPE
640 || code
== UNION_TYPE
641 || code
== QUAL_UNION_TYPE
)
642 print_node (file
, "fields", TYPE_FIELDS (node
), indent
+ 4);
643 else if (code
== FUNCTION_TYPE
644 || code
== METHOD_TYPE
)
646 if (TYPE_METHOD_BASETYPE (node
))
647 print_node_brief (file
, "method basetype",
648 TYPE_METHOD_BASETYPE (node
), indent
+ 4);
649 print_node (file
, "arg-types", TYPE_ARG_TYPES (node
), indent
+ 4);
651 else if (code
== OFFSET_TYPE
)
652 print_node_brief (file
, "basetype", TYPE_OFFSET_BASETYPE (node
),
655 if (TYPE_CONTEXT (node
))
656 print_node_brief (file
, "context", TYPE_CONTEXT (node
), indent
+ 4);
658 lang_hooks
.print_type (file
, node
, indent
);
660 if (TYPE_POINTER_TO (node
) || TREE_CHAIN (node
))
661 indent_to (file
, indent
+ 3);
663 print_node_brief (file
, "pointer_to_this", TYPE_POINTER_TO (node
),
665 print_node_brief (file
, "reference_to_this", TYPE_REFERENCE_TO (node
),
667 print_node_brief (file
, "chain", TREE_CHAIN (node
), indent
+ 4);
677 if (code
== BIND_EXPR
)
679 print_node (file
, "vars", TREE_OPERAND (node
, 0), indent
+ 4);
680 print_node (file
, "body", TREE_OPERAND (node
, 1), indent
+ 4);
681 print_node (file
, "block", TREE_OPERAND (node
, 2), indent
+ 4);
684 if (code
== CALL_EXPR
)
686 call_expr_arg_iterator iter
;
688 print_node (file
, "fn", CALL_EXPR_FN (node
), indent
+ 4);
689 print_node (file
, "static_chain", CALL_EXPR_STATIC_CHAIN (node
),
692 FOR_EACH_CALL_EXPR_ARG (arg
, iter
, node
)
695 sprintf (temp
, "arg %d", i
);
696 print_node (file
, temp
, arg
, indent
+ 4);
702 len
= TREE_OPERAND_LENGTH (node
);
704 for (i
= 0; i
< len
; i
++)
708 sprintf (temp
, "arg %d", i
);
709 print_node (file
, temp
, TREE_OPERAND (node
, i
), indent
+ 4);
712 if (CODE_CONTAINS_STRUCT (code
, TS_COMMON
))
713 print_node (file
, "chain", TREE_CHAIN (node
), indent
+ 4);
717 case tcc_exceptional
:
721 if (TREE_OVERFLOW (node
))
722 fprintf (file
, " overflow");
725 print_dec (node
, file
, TYPE_SIGN (TREE_TYPE (node
)));
732 if (TREE_OVERFLOW (node
))
733 fprintf (file
, " overflow");
735 d
= TREE_REAL_CST (node
);
736 if (REAL_VALUE_ISINF (d
))
737 fprintf (file
, REAL_VALUE_NEGATIVE (d
) ? " -Inf" : " Inf");
738 else if (REAL_VALUE_ISNAN (d
))
739 fprintf (file
, " Nan");
743 real_to_decimal (string
, &d
, sizeof (string
), 0, 1);
744 fprintf (file
, " %s", string
);
754 if (TREE_OVERFLOW (node
))
755 fprintf (file
, " overflow");
757 f
= TREE_FIXED_CST (node
);
758 fixed_to_decimal (string
, &f
, sizeof (string
));
759 fprintf (file
, " %s", string
);
768 for (i
= 0; i
< VECTOR_CST_NELTS (node
); ++i
)
770 sprintf (buf
, "elt%u: ", i
);
771 print_node (file
, buf
, VECTOR_CST_ELT (node
, i
), indent
+ 4);
777 print_node (file
, "real", TREE_REALPART (node
), indent
+ 4);
778 print_node (file
, "imag", TREE_IMAGPART (node
), indent
+ 4);
783 const char *p
= TREE_STRING_POINTER (node
);
784 int i
= TREE_STRING_LENGTH (node
);
789 if (ch
>= ' ' && ch
< 127)
792 fprintf (file
, "\\%03o", ch
& 0xFF);
798 case IDENTIFIER_NODE
:
799 lang_hooks
.print_identifier (file
, node
, indent
);
803 print_node (file
, "purpose", TREE_PURPOSE (node
), indent
+ 4);
804 print_node (file
, "value", TREE_VALUE (node
), indent
+ 4);
805 print_node (file
, "chain", TREE_CHAIN (node
), indent
+ 4);
809 len
= TREE_VEC_LENGTH (node
);
810 for (i
= 0; i
< len
; i
++)
811 if (TREE_VEC_ELT (node
, i
))
814 sprintf (temp
, "elt %d", i
);
815 print_node (file
, temp
, TREE_VEC_ELT (node
, i
), indent
+ 4);
821 unsigned HOST_WIDE_INT cnt
;
823 len
= vec_safe_length (CONSTRUCTOR_ELTS (node
));
824 fprintf (file
, " lngt %d", len
);
825 FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (node
),
828 print_node (file
, "idx", index
, indent
+ 4);
829 print_node (file
, "val", value
, indent
+ 4);
835 dump_addr (file
, " head ", node
->stmt_list
.head
);
836 dump_addr (file
, " tail ", node
->stmt_list
.tail
);
837 fprintf (file
, " stmts");
839 tree_stmt_iterator i
;
840 for (i
= tsi_start (node
); !tsi_end_p (i
); tsi_next (&i
))
842 /* Not printing the addresses of the (not-a-tree)
843 'struct tree_stmt_list_node's. */
844 dump_addr (file
, " ", tsi_stmt (i
));
846 fprintf (file
, "\n");
847 for (i
= tsi_start (node
); !tsi_end_p (i
); tsi_next (&i
))
849 /* Not printing the addresses of the (not-a-tree)
850 'struct tree_stmt_list_node's. */
851 print_node (file
, "stmt", tsi_stmt (i
), indent
+ 4);
857 print_node (file
, "vars", BLOCK_VARS (node
), indent
+ 4);
858 print_node (file
, "supercontext", BLOCK_SUPERCONTEXT (node
),
860 print_node (file
, "subblocks", BLOCK_SUBBLOCKS (node
), indent
+ 4);
861 print_node (file
, "chain", BLOCK_CHAIN (node
), indent
+ 4);
862 print_node (file
, "abstract_origin",
863 BLOCK_ABSTRACT_ORIGIN (node
), indent
+ 4);
867 print_node_brief (file
, "var", SSA_NAME_VAR (node
), indent
+ 4);
868 fprintf (file
, "def_stmt ");
869 print_gimple_stmt (file
, SSA_NAME_DEF_STMT (node
), indent
+ 4, 0);
871 indent_to (file
, indent
+ 4);
872 fprintf (file
, "version %u", SSA_NAME_VERSION (node
));
873 if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (node
))
874 fprintf (file
, " in-abnormal-phi");
875 if (SSA_NAME_IN_FREE_LIST (node
))
876 fprintf (file
, " in-free-list");
878 if (SSA_NAME_PTR_INFO (node
))
880 indent_to (file
, indent
+ 3);
881 if (SSA_NAME_PTR_INFO (node
))
882 dump_addr (file
, " ptr-info ", SSA_NAME_PTR_INFO (node
));
889 fprintf (file
, " %s",
890 omp_clause_code_name
[OMP_CLAUSE_CODE (node
)]);
891 for (i
= 0; i
< omp_clause_num_ops
[OMP_CLAUSE_CODE (node
)]; i
++)
893 indent_to (file
, indent
+ 4);
894 fprintf (file
, "op %d:", i
);
895 print_node_brief (file
, "", OMP_CLAUSE_OPERAND (node
, i
), 0);
900 case OPTIMIZATION_NODE
:
901 cl_optimization_print (file
, indent
+ 4, TREE_OPTIMIZATION (node
));
904 case TARGET_OPTION_NODE
:
905 cl_target_option_print (file
, indent
+ 4, TREE_TARGET_OPTION (node
));
908 fprintf (file
, " imported declaration");
909 print_node_brief (file
, "associated declaration",
910 IMPORTED_DECL_ASSOCIATED_DECL (node
),
915 if (EXCEPTIONAL_CLASS_P (node
))
916 lang_hooks
.print_xnode (file
, node
, indent
);
923 if (EXPR_HAS_LOCATION (node
))
925 expanded_location xloc
= expand_location (EXPR_LOCATION (node
));
926 indent_to (file
, indent
+4);
927 fprintf (file
, "%s:%d:%d", xloc
.file
, xloc
.line
, xloc
.column
);
934 /* Print the node NODE on standard error, for debugging.
935 Most nodes referred to by this one are printed recursively
936 down to a depth of six. */
939 debug_tree (tree node
)
941 table
= XCNEWVEC (struct bucket
*, HASH_SIZE
);
942 print_node (stderr
, "", node
, 0);
949 debug_raw (const tree_node
&ref
)
951 debug_tree (const_cast <tree
> (&ref
));
955 debug_raw (const tree_node
*ptr
)
960 fprintf (stderr
, "<nil>\n");
964 dump_tree_via_hooks (const tree_node
*ptr
, int options
)
967 lang_hooks
.print_decl (stderr
, const_cast <tree_node
*> (ptr
), 0);
968 else if (TYPE_P (ptr
))
969 lang_hooks
.print_type (stderr
, const_cast <tree_node
*> (ptr
), 0);
970 else if (TREE_CODE (ptr
) == IDENTIFIER_NODE
)
971 lang_hooks
.print_identifier (stderr
, const_cast <tree_node
*> (ptr
), 0);
973 print_generic_expr (stderr
, const_cast <tree_node
*> (ptr
), options
);
974 fprintf (stderr
, "\n");
978 debug (const tree_node
&ref
)
980 dump_tree_via_hooks (&ref
, 0);
984 debug (const tree_node
*ptr
)
989 fprintf (stderr
, "<nil>\n");
993 debug_verbose (const tree_node
&ref
)
995 dump_tree_via_hooks (&ref
, TDF_VERBOSE
);
999 debug_verbose (const tree_node
*ptr
)
1002 debug_verbose (*ptr
);
1004 fprintf (stderr
, "<nil>\n");
1008 debug_head (const tree_node
&ref
)
1014 debug_head (const tree_node
*ptr
)
1019 fprintf (stderr
, "<nil>\n");
1023 debug_body (const tree_node
&ref
)
1025 if (TREE_CODE (&ref
) == FUNCTION_DECL
)
1026 dump_function_to_file (const_cast <tree_node
*> (&ref
), stderr
, 0);
1032 debug_body (const tree_node
*ptr
)
1037 fprintf (stderr
, "<nil>\n");
1040 /* Print the vector of trees VEC on standard error, for debugging.
1041 Most nodes referred to by this one are printed recursively
1042 down to a depth of six. */
1045 debug_raw (vec
<tree
, va_gc
> &ref
)
1050 /* Print the slot this node is in, and its code, and address. */
1051 fprintf (stderr
, "<VEC");
1052 dump_addr (stderr
, " ", ref
.address ());
1054 FOR_EACH_VEC_ELT (ref
, ix
, elt
)
1056 fprintf (stderr
, "elt %d ", ix
);
1062 debug (vec
<tree
, va_gc
> &ref
)
1067 /* Print the slot this node is in, and its code, and address. */
1068 fprintf (stderr
, "<VEC");
1069 dump_addr (stderr
, " ", ref
.address ());
1071 FOR_EACH_VEC_ELT (ref
, ix
, elt
)
1073 fprintf (stderr
, "elt %d ", ix
);
1079 debug (vec
<tree
, va_gc
> *ptr
)
1084 fprintf (stderr
, "<nil>\n");
1088 debug_raw (vec
<tree
, va_gc
> *ptr
)
1093 fprintf (stderr
, "<nil>\n");
1097 debug_vec_tree (vec
<tree
, va_gc
> *vec
)