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 */
31 #include "tree-flow.h"
34 /* Define the hash table of nodes already seen.
35 Such nodes are not repeated; brief cross-references are used. */
45 static struct bucket
**table
;
47 /* Print the node NODE on standard error, for debugging.
48 Most nodes referred to by this one are printed recursively
49 down to a depth of six. */
52 debug_tree (tree node
)
54 table
= XCNEWVEC (struct bucket
*, HASH_SIZE
);
55 print_node (stderr
, "", node
, 0);
61 /* Print the vector of trees VEC on standard error, for debugging.
62 Most nodes referred to by this one are printed recursively
63 down to a depth of six. */
66 debug_vec_tree (vec
<tree
, va_gc
> *vec
)
68 table
= XCNEWVEC (struct bucket
*, HASH_SIZE
);
69 print_vec_tree (stderr
, "", vec
, 0);
75 /* Print PREFIX and ADDR to FILE. */
77 dump_addr (FILE *file
, const char *prefix
, const void *addr
)
79 if (flag_dump_noaddr
|| flag_dump_unnumbered
)
80 fprintf (file
, "%s#", prefix
);
82 fprintf (file
, "%s" HOST_PTR_PRINTF
, prefix
, addr
);
85 /* Print a node in brief fashion, with just the code, address and name. */
88 print_node_brief (FILE *file
, const char *prefix
, const_tree node
, int indent
)
90 enum tree_code_class tclass
;
95 tclass
= TREE_CODE_CLASS (TREE_CODE (node
));
97 /* Always print the slot this node is in, and its code, address and
101 fprintf (file
, "%s <%s", prefix
, tree_code_name
[(int) TREE_CODE (node
)]);
102 dump_addr (file
, " ", node
);
104 if (tclass
== tcc_declaration
)
106 if (DECL_NAME (node
))
107 fprintf (file
, " %s", IDENTIFIER_POINTER (DECL_NAME (node
)));
108 else if (TREE_CODE (node
) == LABEL_DECL
109 && LABEL_DECL_UID (node
) != -1)
111 if (dump_flags
& TDF_NOUID
)
112 fprintf (file
, " L.xxxx");
114 fprintf (file
, " L.%d", (int) LABEL_DECL_UID (node
));
118 if (dump_flags
& TDF_NOUID
)
119 fprintf (file
, " %c.xxxx",
120 TREE_CODE (node
) == CONST_DECL
? 'C' : 'D');
122 fprintf (file
, " %c.%u",
123 TREE_CODE (node
) == CONST_DECL
? 'C' : 'D',
127 else if (tclass
== tcc_type
)
129 if (TYPE_NAME (node
))
131 if (TREE_CODE (TYPE_NAME (node
)) == IDENTIFIER_NODE
)
132 fprintf (file
, " %s", IDENTIFIER_POINTER (TYPE_NAME (node
)));
133 else if (TREE_CODE (TYPE_NAME (node
)) == TYPE_DECL
134 && DECL_NAME (TYPE_NAME (node
)))
135 fprintf (file
, " %s",
136 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (node
))));
138 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
139 fprintf (file
, " address-space-%d", TYPE_ADDR_SPACE (node
));
141 if (TREE_CODE (node
) == IDENTIFIER_NODE
)
142 fprintf (file
, " %s", IDENTIFIER_POINTER (node
));
144 /* We might as well always print the value of an integer or real. */
145 if (TREE_CODE (node
) == INTEGER_CST
)
147 if (TREE_OVERFLOW (node
))
148 fprintf (file
, " overflow");
151 if (TREE_INT_CST_HIGH (node
) == 0)
152 fprintf (file
, HOST_WIDE_INT_PRINT_UNSIGNED
, TREE_INT_CST_LOW (node
));
153 else if (TREE_INT_CST_HIGH (node
) == -1
154 && TREE_INT_CST_LOW (node
) != 0)
155 fprintf (file
, "-" HOST_WIDE_INT_PRINT_UNSIGNED
,
156 -TREE_INT_CST_LOW (node
));
158 fprintf (file
, HOST_WIDE_INT_PRINT_DOUBLE_HEX
,
159 (unsigned HOST_WIDE_INT
) TREE_INT_CST_HIGH (node
),
160 (unsigned HOST_WIDE_INT
) TREE_INT_CST_LOW (node
));
162 if (TREE_CODE (node
) == REAL_CST
)
166 if (TREE_OVERFLOW (node
))
167 fprintf (file
, " overflow");
169 d
= TREE_REAL_CST (node
);
170 if (REAL_VALUE_ISINF (d
))
171 fprintf (file
, REAL_VALUE_NEGATIVE (d
) ? " -Inf" : " Inf");
172 else if (REAL_VALUE_ISNAN (d
))
173 fprintf (file
, " Nan");
177 real_to_decimal (string
, &d
, sizeof (string
), 0, 1);
178 fprintf (file
, " %s", string
);
181 if (TREE_CODE (node
) == FIXED_CST
)
186 if (TREE_OVERFLOW (node
))
187 fprintf (file
, " overflow");
189 f
= TREE_FIXED_CST (node
);
190 fixed_to_decimal (string
, &f
, sizeof (string
));
191 fprintf (file
, " %s", string
);
198 indent_to (FILE *file
, int column
)
202 /* Since this is the long way, indent to desired column. */
204 fprintf (file
, "\n");
205 for (i
= 0; i
< column
; i
++)
209 /* Print the node NODE in full on file FILE, preceded by PREFIX,
210 starting in column INDENT. */
213 print_node (FILE *file
, const char *prefix
, tree node
, int indent
)
217 enum machine_mode mode
;
218 enum tree_code_class tclass
;
221 expanded_location xloc
;
227 code
= TREE_CODE (node
);
228 tclass
= TREE_CODE_CLASS (code
);
230 /* Don't get too deep in nesting. If the user wants to see deeper,
231 it is easy to use the address of a lowest-level node
232 as an argument in another call to debug_tree. */
236 print_node_brief (file
, prefix
, node
, indent
);
240 if (indent
> 8 && (tclass
== tcc_type
|| tclass
== tcc_declaration
))
242 print_node_brief (file
, prefix
, node
, indent
);
246 /* It is unsafe to look at any other fields of an ERROR_MARK node. */
247 if (code
== ERROR_MARK
)
249 print_node_brief (file
, prefix
, node
, indent
);
253 /* Allow this function to be called if the table is not there. */
256 hash
= ((uintptr_t) node
) % HASH_SIZE
;
258 /* If node is in the table, just mention its address. */
259 for (b
= table
[hash
]; b
; b
= b
->next
)
262 print_node_brief (file
, prefix
, node
, indent
);
266 /* Add this node to the table. */
267 b
= XNEW (struct bucket
);
269 b
->next
= table
[hash
];
273 /* Indent to the specified column, since this is the long form. */
274 indent_to (file
, indent
);
276 /* Print the slot this node is in, and its code, and address. */
277 fprintf (file
, "%s <%s", prefix
, tree_code_name
[(int) code
]);
278 dump_addr (file
, " ", node
);
280 /* Print the name, if any. */
281 if (tclass
== tcc_declaration
)
283 if (DECL_NAME (node
))
284 fprintf (file
, " %s", IDENTIFIER_POINTER (DECL_NAME (node
)));
285 else if (code
== LABEL_DECL
286 && LABEL_DECL_UID (node
) != -1)
288 if (dump_flags
& TDF_NOUID
)
289 fprintf (file
, " L.xxxx");
291 fprintf (file
, " L.%d", (int) LABEL_DECL_UID (node
));
295 if (dump_flags
& TDF_NOUID
)
296 fprintf (file
, " %c.xxxx", code
== CONST_DECL
? 'C' : 'D');
298 fprintf (file
, " %c.%u", code
== CONST_DECL
? 'C' : 'D',
302 else if (tclass
== tcc_type
)
304 if (TYPE_NAME (node
))
306 if (TREE_CODE (TYPE_NAME (node
)) == IDENTIFIER_NODE
)
307 fprintf (file
, " %s", IDENTIFIER_POINTER (TYPE_NAME (node
)));
308 else if (TREE_CODE (TYPE_NAME (node
)) == TYPE_DECL
309 && DECL_NAME (TYPE_NAME (node
)))
310 fprintf (file
, " %s",
311 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (node
))));
314 if (code
== IDENTIFIER_NODE
)
315 fprintf (file
, " %s", IDENTIFIER_POINTER (node
));
317 if (code
== INTEGER_CST
)
320 print_node_brief (file
, "type", TREE_TYPE (node
), indent
+ 4);
322 else if (CODE_CONTAINS_STRUCT (code
, TS_TYPED
))
324 print_node (file
, "type", TREE_TYPE (node
), indent
+ 4);
325 if (TREE_TYPE (node
))
326 indent_to (file
, indent
+ 3);
329 if (!TYPE_P (node
) && TREE_SIDE_EFFECTS (node
))
330 fputs (" side-effects", file
);
332 if (TYPE_P (node
) ? TYPE_READONLY (node
) : TREE_READONLY (node
))
333 fputs (" readonly", file
);
334 if (TREE_SHARED (node
))
335 fputs (" shared", file
);
336 if (!TYPE_P (node
) && TREE_CONSTANT (node
))
337 fputs (" constant", file
);
338 else if (TYPE_P (node
) && TYPE_SIZES_GIMPLIFIED (node
))
339 fputs (" sizes-gimplified", file
);
341 if (TYPE_P (node
) && !ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
342 fprintf (file
, " address-space-%d", TYPE_ADDR_SPACE (node
));
344 if (TREE_ADDRESSABLE (node
))
345 fputs (" addressable", file
);
346 if (TREE_THIS_VOLATILE (node
))
347 fputs (" volatile", file
);
348 if (TREE_ASM_WRITTEN (node
))
349 fputs (" asm_written", file
);
350 if (TREE_USED (node
))
351 fputs (" used", file
);
352 if (TREE_NOTHROW (node
))
353 fputs (TYPE_P (node
) ? " align-ok" : " nothrow", file
);
354 if (TREE_PUBLIC (node
))
355 fputs (" public", file
);
356 if (TREE_PRIVATE (node
))
357 fputs (" private", file
);
358 if (TREE_PROTECTED (node
))
359 fputs (" protected", file
);
360 if (TREE_STATIC (node
))
361 fputs (" static", file
);
362 if (TREE_CODE (node
) == FUNCTION_DECL
&& DECL_STATIC_CONSTRUCTOR (node
))
363 fputs (" constructor", file
);
364 if (TREE_CODE (node
) == FUNCTION_DECL
&& DECL_STATIC_DESTRUCTOR (node
))
365 fputs (" destructor", file
);
366 if (TREE_DEPRECATED (node
))
367 fputs (" deprecated", file
);
368 if (TREE_VISITED (node
))
369 fputs (" visited", file
);
371 if (code
!= TREE_VEC
&& code
!= SSA_NAME
)
373 if (TREE_LANG_FLAG_0 (node
))
374 fputs (" tree_0", file
);
375 if (TREE_LANG_FLAG_1 (node
))
376 fputs (" tree_1", file
);
377 if (TREE_LANG_FLAG_2 (node
))
378 fputs (" tree_2", file
);
379 if (TREE_LANG_FLAG_3 (node
))
380 fputs (" tree_3", file
);
381 if (TREE_LANG_FLAG_4 (node
))
382 fputs (" tree_4", file
);
383 if (TREE_LANG_FLAG_5 (node
))
384 fputs (" tree_5", file
);
385 if (TREE_LANG_FLAG_6 (node
))
386 fputs (" tree_6", file
);
389 /* DECL_ nodes have additional attributes. */
391 switch (TREE_CODE_CLASS (code
))
393 case tcc_declaration
:
394 if (CODE_CONTAINS_STRUCT (code
, TS_DECL_COMMON
))
396 if (DECL_UNSIGNED (node
))
397 fputs (" unsigned", file
);
398 if (DECL_IGNORED_P (node
))
399 fputs (" ignored", file
);
400 if (DECL_ABSTRACT (node
))
401 fputs (" abstract", file
);
402 if (DECL_EXTERNAL (node
))
403 fputs (" external", file
);
404 if (DECL_NONLOCAL (node
))
405 fputs (" nonlocal", file
);
407 if (CODE_CONTAINS_STRUCT (code
, TS_DECL_WITH_VIS
))
409 if (DECL_WEAK (node
))
410 fputs (" weak", file
);
411 if (DECL_IN_SYSTEM_HEADER (node
))
412 fputs (" in_system_header", file
);
414 if (CODE_CONTAINS_STRUCT (code
, TS_DECL_WRTL
)
415 && code
!= LABEL_DECL
416 && code
!= FUNCTION_DECL
417 && DECL_REGISTER (node
))
418 fputs (" regdecl", file
);
420 if (code
== TYPE_DECL
&& TYPE_DECL_SUPPRESS_DEBUG (node
))
421 fputs (" suppress-debug", file
);
423 if (code
== FUNCTION_DECL
424 && DECL_FUNCTION_SPECIFIC_TARGET (node
))
425 fputs (" function-specific-target", file
);
426 if (code
== FUNCTION_DECL
427 && DECL_FUNCTION_SPECIFIC_OPTIMIZATION (node
))
428 fputs (" function-specific-opt", file
);
429 if (code
== FUNCTION_DECL
&& DECL_DECLARED_INLINE_P (node
))
430 fputs (" autoinline", file
);
431 if (code
== FUNCTION_DECL
&& DECL_BUILT_IN (node
))
432 fputs (" built-in", file
);
433 if (code
== FUNCTION_DECL
&& DECL_STATIC_CHAIN (node
))
434 fputs (" static-chain", file
);
435 if (TREE_CODE (node
) == FUNCTION_DECL
&& decl_is_tm_clone (node
))
436 fputs (" tm-clone", file
);
438 if (code
== FIELD_DECL
&& DECL_PACKED (node
))
439 fputs (" packed", file
);
440 if (code
== FIELD_DECL
&& DECL_BIT_FIELD (node
))
441 fputs (" bit-field", file
);
442 if (code
== FIELD_DECL
&& DECL_NONADDRESSABLE_P (node
))
443 fputs (" nonaddressable", file
);
445 if (code
== LABEL_DECL
&& DECL_ERROR_ISSUED (node
))
446 fputs (" error-issued", file
);
447 if (code
== LABEL_DECL
&& EH_LANDING_PAD_NR (node
))
448 fprintf (file
, " landing-pad:%d", EH_LANDING_PAD_NR (node
));
450 if (code
== VAR_DECL
&& DECL_IN_TEXT_SECTION (node
))
451 fputs (" in-text-section", file
);
452 if (code
== VAR_DECL
&& DECL_IN_CONSTANT_POOL (node
))
453 fputs (" in-constant-pool", file
);
454 if (code
== VAR_DECL
&& DECL_COMMON (node
))
455 fputs (" common", file
);
456 if (code
== VAR_DECL
&& DECL_THREAD_LOCAL_P (node
))
458 enum tls_model kind
= DECL_TLS_MODEL (node
);
461 case TLS_MODEL_GLOBAL_DYNAMIC
:
462 fputs (" tls-global-dynamic", file
);
464 case TLS_MODEL_LOCAL_DYNAMIC
:
465 fputs (" tls-local-dynamic", file
);
467 case TLS_MODEL_INITIAL_EXEC
:
468 fputs (" tls-initial-exec", file
);
470 case TLS_MODEL_LOCAL_EXEC
:
471 fputs (" tls-local-exec", file
);
478 if (CODE_CONTAINS_STRUCT (code
, TS_DECL_COMMON
))
480 if (DECL_VIRTUAL_P (node
))
481 fputs (" virtual", file
);
482 if (DECL_PRESERVE_P (node
))
483 fputs (" preserve", file
);
484 if (DECL_LANG_FLAG_0 (node
))
485 fputs (" decl_0", file
);
486 if (DECL_LANG_FLAG_1 (node
))
487 fputs (" decl_1", file
);
488 if (DECL_LANG_FLAG_2 (node
))
489 fputs (" decl_2", file
);
490 if (DECL_LANG_FLAG_3 (node
))
491 fputs (" decl_3", file
);
492 if (DECL_LANG_FLAG_4 (node
))
493 fputs (" decl_4", file
);
494 if (DECL_LANG_FLAG_5 (node
))
495 fputs (" decl_5", file
);
496 if (DECL_LANG_FLAG_6 (node
))
497 fputs (" decl_6", file
);
498 if (DECL_LANG_FLAG_7 (node
))
499 fputs (" decl_7", file
);
501 mode
= DECL_MODE (node
);
502 fprintf (file
, " %s", GET_MODE_NAME (mode
));
505 if ((code
== VAR_DECL
|| code
== PARM_DECL
|| code
== RESULT_DECL
)
506 && DECL_BY_REFERENCE (node
))
507 fputs (" passed-by-reference", file
);
509 if (CODE_CONTAINS_STRUCT (code
, TS_DECL_WITH_VIS
) && DECL_DEFER_OUTPUT (node
))
510 fputs (" defer-output", file
);
513 xloc
= expand_location (DECL_SOURCE_LOCATION (node
));
514 fprintf (file
, " file %s line %d col %d", xloc
.file
, xloc
.line
,
517 if (CODE_CONTAINS_STRUCT (code
, TS_DECL_COMMON
))
519 print_node (file
, "size", DECL_SIZE (node
), indent
+ 4);
520 print_node (file
, "unit size", DECL_SIZE_UNIT (node
), indent
+ 4);
522 if (code
!= FUNCTION_DECL
|| DECL_BUILT_IN (node
))
523 indent_to (file
, indent
+ 3);
525 if (DECL_USER_ALIGN (node
))
526 fprintf (file
, " user");
528 fprintf (file
, " align %d", DECL_ALIGN (node
));
529 if (code
== FIELD_DECL
)
530 fprintf (file
, " offset_align " HOST_WIDE_INT_PRINT_UNSIGNED
,
531 DECL_OFFSET_ALIGN (node
));
533 if (code
== FUNCTION_DECL
&& DECL_BUILT_IN (node
))
535 if (DECL_BUILT_IN_CLASS (node
) == BUILT_IN_MD
)
536 fprintf (file
, " built-in BUILT_IN_MD %d", DECL_FUNCTION_CODE (node
));
538 fprintf (file
, " built-in %s:%s",
539 built_in_class_names
[(int) DECL_BUILT_IN_CLASS (node
)],
540 built_in_names
[(int) DECL_FUNCTION_CODE (node
)]);
543 if (code
== FIELD_DECL
)
545 print_node (file
, "offset", DECL_FIELD_OFFSET (node
), indent
+ 4);
546 print_node (file
, "bit offset", DECL_FIELD_BIT_OFFSET (node
),
548 if (DECL_BIT_FIELD_TYPE (node
))
549 print_node (file
, "bit_field_type", DECL_BIT_FIELD_TYPE (node
),
553 print_node_brief (file
, "context", DECL_CONTEXT (node
), indent
+ 4);
555 if (CODE_CONTAINS_STRUCT (code
, TS_DECL_COMMON
))
557 print_node_brief (file
, "attributes",
558 DECL_ATTRIBUTES (node
), indent
+ 4);
559 if (code
!= PARM_DECL
)
560 print_node_brief (file
, "initial", DECL_INITIAL (node
),
563 if (CODE_CONTAINS_STRUCT (code
, TS_DECL_WRTL
))
565 print_node_brief (file
, "abstract_origin",
566 DECL_ABSTRACT_ORIGIN (node
), indent
+ 4);
568 if (CODE_CONTAINS_STRUCT (code
, TS_DECL_NON_COMMON
))
570 print_node (file
, "arguments", DECL_ARGUMENT_FLD (node
), indent
+ 4);
571 print_node (file
, "result", DECL_RESULT_FLD (node
), indent
+ 4);
574 lang_hooks
.print_decl (file
, node
, indent
);
576 if (DECL_RTL_SET_P (node
))
578 indent_to (file
, indent
+ 4);
579 print_rtl (file
, DECL_RTL (node
));
582 if (code
== PARM_DECL
)
584 print_node (file
, "arg-type", DECL_ARG_TYPE (node
), indent
+ 4);
586 if (DECL_INCOMING_RTL (node
) != 0)
588 indent_to (file
, indent
+ 4);
589 fprintf (file
, "incoming-rtl ");
590 print_rtl (file
, DECL_INCOMING_RTL (node
));
593 else if (code
== FUNCTION_DECL
594 && DECL_STRUCT_FUNCTION (node
) != 0)
596 indent_to (file
, indent
+ 4);
597 dump_addr (file
, "struct-function ", DECL_STRUCT_FUNCTION (node
));
600 if ((code
== VAR_DECL
|| code
== PARM_DECL
)
601 && DECL_HAS_VALUE_EXPR_P (node
))
602 print_node (file
, "value-expr", DECL_VALUE_EXPR (node
), indent
+ 4);
604 /* Print the decl chain only if decl is at second level. */
606 print_node (file
, "chain", TREE_CHAIN (node
), indent
+ 4);
608 print_node_brief (file
, "chain", TREE_CHAIN (node
), indent
+ 4);
612 if (TYPE_UNSIGNED (node
))
613 fputs (" unsigned", file
);
615 /* The no-force-blk flag is used for different things in
617 if ((code
== RECORD_TYPE
618 || code
== UNION_TYPE
619 || code
== QUAL_UNION_TYPE
)
620 && TYPE_NO_FORCE_BLK (node
))
621 fputs (" no-force-blk", file
);
623 if (TYPE_STRING_FLAG (node
))
624 fputs (" string-flag", file
);
625 if (TYPE_NEEDS_CONSTRUCTING (node
))
626 fputs (" needs-constructing", file
);
628 /* The transparent-union flag is used for different things in
630 if ((code
== UNION_TYPE
|| code
== RECORD_TYPE
)
631 && TYPE_TRANSPARENT_AGGR (node
))
632 fputs (" transparent-aggr", file
);
633 else if (code
== ARRAY_TYPE
634 && TYPE_NONALIASED_COMPONENT (node
))
635 fputs (" nonaliased-component", file
);
637 if (TYPE_PACKED (node
))
638 fputs (" packed", file
);
640 if (TYPE_RESTRICT (node
))
641 fputs (" restrict", file
);
643 if (TYPE_LANG_FLAG_0 (node
))
644 fputs (" type_0", file
);
645 if (TYPE_LANG_FLAG_1 (node
))
646 fputs (" type_1", file
);
647 if (TYPE_LANG_FLAG_2 (node
))
648 fputs (" type_2", file
);
649 if (!TYPE_SHARED (node
))
651 if (TYPE_LANG_FLAG_3 (node
))
652 fputs (" type_3", file
);
653 if (TYPE_LANG_FLAG_4 (node
))
654 fputs (" type_4", file
);
655 if (TYPE_LANG_FLAG_5 (node
))
656 fputs (" type_5", file
);
658 if (TYPE_LANG_FLAG_6 (node
))
659 fputs (" type_6", file
);
661 mode
= TYPE_MODE (node
);
662 fprintf (file
, " %s", GET_MODE_NAME (mode
));
664 print_node (file
, "size", TYPE_SIZE (node
), indent
+ 4);
665 print_node (file
, "unit size", TYPE_SIZE_UNIT (node
), indent
+ 4);
666 if (TYPE_SHARED (node
))
668 if (TYPE_HAS_THREADS_FACTOR(node
))
669 fputs (" THREADS factor", file
);
670 if (TYPE_HAS_BLOCK_FACTOR (node
))
671 print_node (file
, "block factor",
672 TYPE_BLOCK_FACTOR (node
), indent
+ 4);
674 indent_to (file
, indent
+ 3);
676 if (TYPE_USER_ALIGN (node
))
677 fprintf (file
, " user");
679 fprintf (file
, " align %d symtab %d alias set " HOST_WIDE_INT_PRINT_DEC
,
680 TYPE_ALIGN (node
), TYPE_SYMTAB_ADDRESS (node
),
681 (HOST_WIDE_INT
) TYPE_ALIAS_SET (node
));
683 if (TYPE_STRUCTURAL_EQUALITY_P (node
))
684 fprintf (file
, " structural equality");
686 dump_addr (file
, " canonical type ", TYPE_CANONICAL (node
));
688 print_node (file
, "attributes", TYPE_ATTRIBUTES (node
), indent
+ 4);
690 if (INTEGRAL_TYPE_P (node
) || code
== REAL_TYPE
691 || code
== FIXED_POINT_TYPE
)
693 fprintf (file
, " precision %d", TYPE_PRECISION (node
));
694 print_node_brief (file
, "min", TYPE_MIN_VALUE (node
), indent
+ 4);
695 print_node_brief (file
, "max", TYPE_MAX_VALUE (node
), indent
+ 4);
698 if (code
== ENUMERAL_TYPE
)
699 print_node (file
, "values", TYPE_VALUES (node
), indent
+ 4);
700 else if (code
== ARRAY_TYPE
)
701 print_node (file
, "domain", TYPE_DOMAIN (node
), indent
+ 4);
702 else if (code
== VECTOR_TYPE
)
703 fprintf (file
, " nunits %d", (int) TYPE_VECTOR_SUBPARTS (node
));
704 else if (code
== RECORD_TYPE
705 || code
== UNION_TYPE
706 || code
== QUAL_UNION_TYPE
)
707 print_node (file
, "fields", TYPE_FIELDS (node
), indent
+ 4);
708 else if (code
== FUNCTION_TYPE
709 || code
== METHOD_TYPE
)
711 if (TYPE_METHOD_BASETYPE (node
))
712 print_node_brief (file
, "method basetype",
713 TYPE_METHOD_BASETYPE (node
), indent
+ 4);
714 print_node (file
, "arg-types", TYPE_ARG_TYPES (node
), indent
+ 4);
716 else if (code
== OFFSET_TYPE
)
717 print_node_brief (file
, "basetype", TYPE_OFFSET_BASETYPE (node
),
720 if (TYPE_CONTEXT (node
))
721 print_node_brief (file
, "context", TYPE_CONTEXT (node
), indent
+ 4);
723 lang_hooks
.print_type (file
, node
, indent
);
725 if (TYPE_POINTER_TO (node
) || TREE_CHAIN (node
))
726 indent_to (file
, indent
+ 3);
728 print_node_brief (file
, "pointer_to_this", TYPE_POINTER_TO (node
),
730 print_node_brief (file
, "reference_to_this", TYPE_REFERENCE_TO (node
),
732 print_node_brief (file
, "chain", TREE_CHAIN (node
), indent
+ 4);
742 if (code
== BIND_EXPR
)
744 print_node (file
, "vars", TREE_OPERAND (node
, 0), indent
+ 4);
745 print_node (file
, "body", TREE_OPERAND (node
, 1), indent
+ 4);
746 print_node (file
, "block", TREE_OPERAND (node
, 2), indent
+ 4);
749 if (code
== CALL_EXPR
)
751 call_expr_arg_iterator iter
;
753 print_node (file
, "fn", CALL_EXPR_FN (node
), indent
+ 4);
754 print_node (file
, "static_chain", CALL_EXPR_STATIC_CHAIN (node
),
757 FOR_EACH_CALL_EXPR_ARG (arg
, iter
, node
)
760 sprintf (temp
, "arg %d", i
);
761 print_node (file
, temp
, arg
, indent
+ 4);
767 len
= TREE_OPERAND_LENGTH (node
);
769 for (i
= 0; i
< len
; i
++)
773 sprintf (temp
, "arg %d", i
);
774 print_node (file
, temp
, TREE_OPERAND (node
, i
), indent
+ 4);
777 if (CODE_CONTAINS_STRUCT (code
, TS_COMMON
))
778 print_node (file
, "chain", TREE_CHAIN (node
), indent
+ 4);
782 case tcc_exceptional
:
786 if (TREE_OVERFLOW (node
))
787 fprintf (file
, " overflow");
790 if (TREE_INT_CST_HIGH (node
) == 0)
791 fprintf (file
, HOST_WIDE_INT_PRINT_UNSIGNED
,
792 TREE_INT_CST_LOW (node
));
793 else if (TREE_INT_CST_HIGH (node
) == -1
794 && TREE_INT_CST_LOW (node
) != 0)
795 fprintf (file
, "-" HOST_WIDE_INT_PRINT_UNSIGNED
,
796 -TREE_INT_CST_LOW (node
));
798 fprintf (file
, HOST_WIDE_INT_PRINT_DOUBLE_HEX
,
799 (unsigned HOST_WIDE_INT
) TREE_INT_CST_HIGH (node
),
800 (unsigned HOST_WIDE_INT
) TREE_INT_CST_LOW (node
));
807 if (TREE_OVERFLOW (node
))
808 fprintf (file
, " overflow");
810 d
= TREE_REAL_CST (node
);
811 if (REAL_VALUE_ISINF (d
))
812 fprintf (file
, REAL_VALUE_NEGATIVE (d
) ? " -Inf" : " Inf");
813 else if (REAL_VALUE_ISNAN (d
))
814 fprintf (file
, " Nan");
818 real_to_decimal (string
, &d
, sizeof (string
), 0, 1);
819 fprintf (file
, " %s", string
);
829 if (TREE_OVERFLOW (node
))
830 fprintf (file
, " overflow");
832 f
= TREE_FIXED_CST (node
);
833 fixed_to_decimal (string
, &f
, sizeof (string
));
834 fprintf (file
, " %s", string
);
843 for (i
= 0; i
< VECTOR_CST_NELTS (node
); ++i
)
845 sprintf (buf
, "elt%u: ", i
);
846 print_node (file
, buf
, VECTOR_CST_ELT (node
, i
), indent
+ 4);
852 print_node (file
, "real", TREE_REALPART (node
), indent
+ 4);
853 print_node (file
, "imag", TREE_IMAGPART (node
), indent
+ 4);
858 const char *p
= TREE_STRING_POINTER (node
);
859 int i
= TREE_STRING_LENGTH (node
);
864 if (ch
>= ' ' && ch
< 127)
867 fprintf(file
, "\\%03o", ch
& 0xFF);
873 case IDENTIFIER_NODE
:
874 lang_hooks
.print_identifier (file
, node
, indent
);
878 print_node (file
, "purpose", TREE_PURPOSE (node
), indent
+ 4);
879 print_node (file
, "value", TREE_VALUE (node
), indent
+ 4);
880 print_node (file
, "chain", TREE_CHAIN (node
), indent
+ 4);
884 len
= TREE_VEC_LENGTH (node
);
885 for (i
= 0; i
< len
; i
++)
886 if (TREE_VEC_ELT (node
, i
))
889 sprintf (temp
, "elt %d", i
);
890 print_node (file
, temp
, TREE_VEC_ELT (node
, i
), indent
+ 4);
896 unsigned HOST_WIDE_INT cnt
;
898 len
= vec_safe_length (CONSTRUCTOR_ELTS (node
));
899 fprintf (file
, " lngt %d", len
);
900 FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (node
),
903 print_node (file
, "idx", index
, indent
+ 4);
904 print_node (file
, "val", value
, indent
+ 4);
910 dump_addr (file
, " head ", node
->stmt_list
.head
);
911 dump_addr (file
, " tail ", node
->stmt_list
.tail
);
912 fprintf (file
, " stmts");
914 tree_stmt_iterator i
;
915 for (i
= tsi_start (node
); !tsi_end_p (i
); tsi_next (&i
))
917 /* Not printing the addresses of the (not-a-tree)
918 'struct tree_stmt_list_node's. */
919 dump_addr (file
, " ", tsi_stmt (i
));
921 fprintf (file
, "\n");
922 for (i
= tsi_start (node
); !tsi_end_p (i
); tsi_next (&i
))
924 /* Not printing the addresses of the (not-a-tree)
925 'struct tree_stmt_list_node's. */
926 print_node (file
, "stmt", tsi_stmt (i
), indent
+ 4);
932 print_node (file
, "vars", BLOCK_VARS (node
), indent
+ 4);
933 print_node (file
, "supercontext", BLOCK_SUPERCONTEXT (node
),
935 print_node (file
, "subblocks", BLOCK_SUBBLOCKS (node
), indent
+ 4);
936 print_node (file
, "chain", BLOCK_CHAIN (node
), indent
+ 4);
937 print_node (file
, "abstract_origin",
938 BLOCK_ABSTRACT_ORIGIN (node
), indent
+ 4);
942 print_node_brief (file
, "var", SSA_NAME_VAR (node
), indent
+ 4);
943 fprintf (file
, "def_stmt ");
944 print_gimple_stmt (file
, SSA_NAME_DEF_STMT (node
), indent
+ 4, 0);
946 indent_to (file
, indent
+ 4);
947 fprintf (file
, "version %u", SSA_NAME_VERSION (node
));
948 if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (node
))
949 fprintf (file
, " in-abnormal-phi");
950 if (SSA_NAME_IN_FREE_LIST (node
))
951 fprintf (file
, " in-free-list");
953 if (SSA_NAME_PTR_INFO (node
))
955 indent_to (file
, indent
+ 3);
956 if (SSA_NAME_PTR_INFO (node
))
957 dump_addr (file
, " ptr-info ", SSA_NAME_PTR_INFO (node
));
964 fprintf (file
, " %s",
965 omp_clause_code_name
[OMP_CLAUSE_CODE (node
)]);
966 for (i
= 0; i
< omp_clause_num_ops
[OMP_CLAUSE_CODE (node
)]; i
++)
968 indent_to (file
, indent
+ 4);
969 fprintf (file
, "op %d:", i
);
970 print_node_brief (file
, "", OMP_CLAUSE_OPERAND (node
, i
), 0);
975 case OPTIMIZATION_NODE
:
976 cl_optimization_print (file
, indent
+ 4, TREE_OPTIMIZATION (node
));
979 case TARGET_OPTION_NODE
:
980 cl_target_option_print (file
, indent
+ 4, TREE_TARGET_OPTION (node
));
983 fprintf (file
, " imported declaration");
984 print_node_brief (file
, "associated declaration",
985 IMPORTED_DECL_ASSOCIATED_DECL (node
),
990 if (EXCEPTIONAL_CLASS_P (node
))
991 lang_hooks
.print_xnode (file
, node
, indent
);
998 if (EXPR_HAS_LOCATION (node
))
1000 expanded_location xloc
= expand_location (EXPR_LOCATION (node
));
1001 indent_to (file
, indent
+4);
1002 fprintf (file
, "%s:%d:%d", xloc
.file
, xloc
.line
, xloc
.column
);
1005 fprintf (file
, ">");
1008 /* Print the tree vector VEC in full on file FILE, preceded by PREFIX,
1009 starting in column INDENT. */
1012 print_vec_tree (FILE *file
, const char *prefix
, vec
<tree
, va_gc
> *vec
, int indent
)
1017 /* Indent to the specified column, since this is the long form. */
1018 indent_to (file
, indent
);
1020 /* Print the slot this node is in, and its code, and address. */
1021 fprintf (file
, "%s <VEC", prefix
);
1022 dump_addr (file
, " ", vec
->address ());
1024 FOR_EACH_VEC_ELT (*vec
, ix
, elt
)
1027 sprintf (temp
, "elt %d", ix
);
1028 print_node (file
, temp
, elt
, indent
+ 4);