1 /* Prints out tree in human readable form - GCC
2 Copyright (C) 1990, 1991, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
3 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
4 Free Software Foundation, Inc.
6 This file is part of GCC.
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 3, or (at your option) any later
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING3. If not see
20 <http://www.gnu.org/licenses/>. */
25 #include "coretypes.h"
29 #include "langhooks.h"
30 #include "tree-iterator.h"
31 #include "diagnostic.h"
32 #include "gimple-pretty-print.h" /* FIXME */
33 #include "tree-flow.h"
36 /* Define the hash table of nodes already seen.
37 Such nodes are not repeated; brief cross-references are used. */
47 static struct bucket
**table
;
49 /* Print the node NODE on standard error, for debugging.
50 Most nodes referred to by this one are printed recursively
51 down to a depth of six. */
54 debug_tree (tree node
)
56 table
= XCNEWVEC (struct bucket
*, HASH_SIZE
);
57 print_node (stderr
, "", node
, 0);
63 /* Print the vector of trees VEC on standard error, for debugging.
64 Most nodes referred to by this one are printed recursively
65 down to a depth of six. */
68 debug_vec_tree (VEC(tree
,gc
) *vec
)
70 table
= XCNEWVEC (struct bucket
*, HASH_SIZE
);
71 print_vec_tree (stderr
, "", vec
, 0);
77 /* Print PREFIX and ADDR to FILE. */
79 dump_addr (FILE *file
, const char *prefix
, const void *addr
)
81 if (flag_dump_noaddr
|| flag_dump_unnumbered
)
82 fprintf (file
, "%s#", prefix
);
84 fprintf (file
, "%s" HOST_PTR_PRINTF
, prefix
, addr
);
87 /* Print a node in brief fashion, with just the code, address and name. */
90 print_node_brief (FILE *file
, const char *prefix
, const_tree node
, int indent
)
92 enum tree_code_class tclass
;
97 tclass
= TREE_CODE_CLASS (TREE_CODE (node
));
99 /* Always print the slot this node is in, and its code, address and
103 fprintf (file
, "%s <%s", prefix
, tree_code_name
[(int) TREE_CODE (node
)]);
104 dump_addr (file
, " ", node
);
106 if (tclass
== tcc_declaration
)
108 if (DECL_NAME (node
))
109 fprintf (file
, " %s", IDENTIFIER_POINTER (DECL_NAME (node
)));
110 else if (TREE_CODE (node
) == LABEL_DECL
111 && LABEL_DECL_UID (node
) != -1)
113 if (dump_flags
& TDF_NOUID
)
114 fprintf (file
, " L.xxxx");
116 fprintf (file
, " L.%d", (int) LABEL_DECL_UID (node
));
120 if (dump_flags
& TDF_NOUID
)
121 fprintf (file
, " %c.xxxx",
122 TREE_CODE (node
) == CONST_DECL
? 'C' : 'D');
124 fprintf (file
, " %c.%u",
125 TREE_CODE (node
) == CONST_DECL
? 'C' : 'D',
129 else if (tclass
== tcc_type
)
131 if (TYPE_NAME (node
))
133 if (TREE_CODE (TYPE_NAME (node
)) == IDENTIFIER_NODE
)
134 fprintf (file
, " %s", IDENTIFIER_POINTER (TYPE_NAME (node
)));
135 else if (TREE_CODE (TYPE_NAME (node
)) == TYPE_DECL
136 && DECL_NAME (TYPE_NAME (node
)))
137 fprintf (file
, " %s",
138 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (node
))));
140 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
141 fprintf (file
, " address-space-%d", TYPE_ADDR_SPACE (node
));
143 if (TREE_CODE (node
) == IDENTIFIER_NODE
)
144 fprintf (file
, " %s", IDENTIFIER_POINTER (node
));
146 /* We might as well always print the value of an integer or real. */
147 if (TREE_CODE (node
) == INTEGER_CST
)
149 if (TREE_OVERFLOW (node
))
150 fprintf (file
, " overflow");
153 if (TREE_INT_CST_HIGH (node
) == 0)
154 fprintf (file
, HOST_WIDE_INT_PRINT_UNSIGNED
, TREE_INT_CST_LOW (node
));
155 else if (TREE_INT_CST_HIGH (node
) == -1
156 && TREE_INT_CST_LOW (node
) != 0)
157 fprintf (file
, "-" HOST_WIDE_INT_PRINT_UNSIGNED
,
158 -TREE_INT_CST_LOW (node
));
160 fprintf (file
, HOST_WIDE_INT_PRINT_DOUBLE_HEX
,
161 (unsigned HOST_WIDE_INT
) TREE_INT_CST_HIGH (node
),
162 (unsigned HOST_WIDE_INT
) TREE_INT_CST_LOW (node
));
164 if (TREE_CODE (node
) == REAL_CST
)
168 if (TREE_OVERFLOW (node
))
169 fprintf (file
, " overflow");
171 d
= TREE_REAL_CST (node
);
172 if (REAL_VALUE_ISINF (d
))
173 fprintf (file
, REAL_VALUE_NEGATIVE (d
) ? " -Inf" : " Inf");
174 else if (REAL_VALUE_ISNAN (d
))
175 fprintf (file
, " Nan");
179 real_to_decimal (string
, &d
, sizeof (string
), 0, 1);
180 fprintf (file
, " %s", string
);
183 if (TREE_CODE (node
) == FIXED_CST
)
188 if (TREE_OVERFLOW (node
))
189 fprintf (file
, " overflow");
191 f
= TREE_FIXED_CST (node
);
192 fixed_to_decimal (string
, &f
, sizeof (string
));
193 fprintf (file
, " %s", string
);
200 indent_to (FILE *file
, int column
)
204 /* Since this is the long way, indent to desired column. */
206 fprintf (file
, "\n");
207 for (i
= 0; i
< column
; i
++)
211 /* Print the node NODE in full on file FILE, preceded by PREFIX,
212 starting in column INDENT. */
215 print_node (FILE *file
, const char *prefix
, tree node
, int indent
)
219 enum machine_mode mode
;
220 enum tree_code_class tclass
;
223 expanded_location xloc
;
229 code
= TREE_CODE (node
);
230 tclass
= TREE_CODE_CLASS (code
);
232 /* Don't get too deep in nesting. If the user wants to see deeper,
233 it is easy to use the address of a lowest-level node
234 as an argument in another call to debug_tree. */
238 print_node_brief (file
, prefix
, node
, indent
);
242 if (indent
> 8 && (tclass
== tcc_type
|| tclass
== tcc_declaration
))
244 print_node_brief (file
, prefix
, node
, indent
);
248 /* It is unsafe to look at any other fields of an ERROR_MARK node. */
249 if (code
== ERROR_MARK
)
251 print_node_brief (file
, prefix
, node
, indent
);
255 /* Allow this function to be called if the table is not there. */
258 hash
= ((unsigned long) node
) % HASH_SIZE
;
260 /* If node is in the table, just mention its address. */
261 for (b
= table
[hash
]; b
; b
= b
->next
)
264 print_node_brief (file
, prefix
, node
, indent
);
268 /* Add this node to the table. */
269 b
= XNEW (struct bucket
);
271 b
->next
= table
[hash
];
275 /* Indent to the specified column, since this is the long form. */
276 indent_to (file
, indent
);
278 /* Print the slot this node is in, and its code, and address. */
279 fprintf (file
, "%s <%s", prefix
, tree_code_name
[(int) code
]);
280 dump_addr (file
, " ", node
);
282 /* Print the name, if any. */
283 if (tclass
== tcc_declaration
)
285 if (DECL_NAME (node
))
286 fprintf (file
, " %s", IDENTIFIER_POINTER (DECL_NAME (node
)));
287 else if (code
== LABEL_DECL
288 && LABEL_DECL_UID (node
) != -1)
290 if (dump_flags
& TDF_NOUID
)
291 fprintf (file
, " L.xxxx");
293 fprintf (file
, " L.%d", (int) LABEL_DECL_UID (node
));
297 if (dump_flags
& TDF_NOUID
)
298 fprintf (file
, " %c.xxxx", code
== CONST_DECL
? 'C' : 'D');
300 fprintf (file
, " %c.%u", code
== CONST_DECL
? 'C' : 'D',
304 else if (tclass
== tcc_type
)
306 if (TYPE_NAME (node
))
308 if (TREE_CODE (TYPE_NAME (node
)) == IDENTIFIER_NODE
)
309 fprintf (file
, " %s", IDENTIFIER_POINTER (TYPE_NAME (node
)));
310 else if (TREE_CODE (TYPE_NAME (node
)) == TYPE_DECL
311 && DECL_NAME (TYPE_NAME (node
)))
312 fprintf (file
, " %s",
313 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (node
))));
316 if (code
== IDENTIFIER_NODE
)
317 fprintf (file
, " %s", IDENTIFIER_POINTER (node
));
319 if (code
== INTEGER_CST
)
322 print_node_brief (file
, "type", TREE_TYPE (node
), indent
+ 4);
324 else if (CODE_CONTAINS_STRUCT (code
, TS_TYPED
))
326 print_node (file
, "type", TREE_TYPE (node
), indent
+ 4);
327 if (TREE_TYPE (node
))
328 indent_to (file
, indent
+ 3);
331 if (!TYPE_P (node
) && TREE_SIDE_EFFECTS (node
))
332 fputs (" side-effects", file
);
334 if (TYPE_P (node
) ? TYPE_READONLY (node
) : TREE_READONLY (node
))
335 fputs (" readonly", 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_DEPRECATED (node
))
363 fputs (" deprecated", file
);
364 if (TREE_VISITED (node
))
365 fputs (" visited", file
);
366 if (TREE_LANG_FLAG_0 (node
))
367 fputs (" tree_0", file
);
368 if (TREE_LANG_FLAG_1 (node
))
369 fputs (" tree_1", file
);
370 if (TREE_LANG_FLAG_2 (node
))
371 fputs (" tree_2", file
);
372 if (TREE_LANG_FLAG_3 (node
))
373 fputs (" tree_3", file
);
374 if (TREE_LANG_FLAG_4 (node
))
375 fputs (" tree_4", file
);
376 if (TREE_LANG_FLAG_5 (node
))
377 fputs (" tree_5", file
);
378 if (TREE_LANG_FLAG_6 (node
))
379 fputs (" tree_6", file
);
381 /* DECL_ nodes have additional attributes. */
383 switch (TREE_CODE_CLASS (code
))
385 case tcc_declaration
:
386 if (CODE_CONTAINS_STRUCT (code
, TS_DECL_COMMON
))
388 if (DECL_UNSIGNED (node
))
389 fputs (" unsigned", file
);
390 if (DECL_IGNORED_P (node
))
391 fputs (" ignored", file
);
392 if (DECL_ABSTRACT (node
))
393 fputs (" abstract", file
);
394 if (DECL_EXTERNAL (node
))
395 fputs (" external", file
);
396 if (DECL_NONLOCAL (node
))
397 fputs (" nonlocal", file
);
399 if (CODE_CONTAINS_STRUCT (code
, TS_DECL_WITH_VIS
))
401 if (DECL_WEAK (node
))
402 fputs (" weak", file
);
403 if (DECL_IN_SYSTEM_HEADER (node
))
404 fputs (" in_system_header", file
);
406 if (CODE_CONTAINS_STRUCT (code
, TS_DECL_WRTL
)
407 && code
!= LABEL_DECL
408 && code
!= FUNCTION_DECL
409 && DECL_REGISTER (node
))
410 fputs (" regdecl", file
);
412 if (code
== TYPE_DECL
&& TYPE_DECL_SUPPRESS_DEBUG (node
))
413 fputs (" suppress-debug", file
);
415 if (code
== FUNCTION_DECL
416 && DECL_FUNCTION_SPECIFIC_TARGET (node
))
417 fputs (" function-specific-target", file
);
418 if (code
== FUNCTION_DECL
419 && DECL_FUNCTION_SPECIFIC_OPTIMIZATION (node
))
420 fputs (" function-specific-opt", file
);
421 if (code
== FUNCTION_DECL
&& DECL_DECLARED_INLINE_P (node
))
422 fputs (" autoinline", file
);
423 if (code
== FUNCTION_DECL
&& DECL_BUILT_IN (node
))
424 fputs (" built-in", file
);
425 if (code
== FUNCTION_DECL
&& DECL_STATIC_CHAIN (node
))
426 fputs (" static-chain", file
);
427 if (TREE_CODE (node
) == FUNCTION_DECL
&& decl_is_tm_clone (node
))
428 fputs (" tm-clone", file
);
430 if (code
== FIELD_DECL
&& DECL_PACKED (node
))
431 fputs (" packed", file
);
432 if (code
== FIELD_DECL
&& DECL_BIT_FIELD (node
))
433 fputs (" bit-field", file
);
434 if (code
== FIELD_DECL
&& DECL_NONADDRESSABLE_P (node
))
435 fputs (" nonaddressable", file
);
437 if (code
== LABEL_DECL
&& DECL_ERROR_ISSUED (node
))
438 fputs (" error-issued", file
);
439 if (code
== LABEL_DECL
&& EH_LANDING_PAD_NR (node
))
440 fprintf (file
, " landing-pad:%d", EH_LANDING_PAD_NR (node
));
442 if (code
== VAR_DECL
&& DECL_IN_TEXT_SECTION (node
))
443 fputs (" in-text-section", file
);
444 if (code
== VAR_DECL
&& DECL_IN_CONSTANT_POOL (node
))
445 fputs (" in-constant-pool", file
);
446 if (code
== VAR_DECL
&& DECL_COMMON (node
))
447 fputs (" common", file
);
448 if (code
== VAR_DECL
&& DECL_THREAD_LOCAL_P (node
))
450 enum tls_model kind
= DECL_TLS_MODEL (node
);
453 case TLS_MODEL_GLOBAL_DYNAMIC
:
454 fputs (" tls-global-dynamic", file
);
456 case TLS_MODEL_LOCAL_DYNAMIC
:
457 fputs (" tls-local-dynamic", file
);
459 case TLS_MODEL_INITIAL_EXEC
:
460 fputs (" tls-initial-exec", file
);
462 case TLS_MODEL_LOCAL_EXEC
:
463 fputs (" tls-local-exec", file
);
470 if (CODE_CONTAINS_STRUCT (code
, TS_DECL_COMMON
))
472 if (DECL_VIRTUAL_P (node
))
473 fputs (" virtual", file
);
474 if (DECL_PRESERVE_P (node
))
475 fputs (" preserve", file
);
476 if (DECL_LANG_FLAG_0 (node
))
477 fputs (" decl_0", file
);
478 if (DECL_LANG_FLAG_1 (node
))
479 fputs (" decl_1", file
);
480 if (DECL_LANG_FLAG_2 (node
))
481 fputs (" decl_2", file
);
482 if (DECL_LANG_FLAG_3 (node
))
483 fputs (" decl_3", file
);
484 if (DECL_LANG_FLAG_4 (node
))
485 fputs (" decl_4", file
);
486 if (DECL_LANG_FLAG_5 (node
))
487 fputs (" decl_5", file
);
488 if (DECL_LANG_FLAG_6 (node
))
489 fputs (" decl_6", file
);
490 if (DECL_LANG_FLAG_7 (node
))
491 fputs (" decl_7", file
);
493 mode
= DECL_MODE (node
);
494 fprintf (file
, " %s", GET_MODE_NAME (mode
));
497 if ((code
== VAR_DECL
|| code
== PARM_DECL
|| code
== RESULT_DECL
)
498 && DECL_BY_REFERENCE (node
))
499 fputs (" passed-by-reference", file
);
501 if (CODE_CONTAINS_STRUCT (code
, TS_DECL_WITH_VIS
) && DECL_DEFER_OUTPUT (node
))
502 fputs (" defer-output", file
);
505 xloc
= expand_location (DECL_SOURCE_LOCATION (node
));
506 fprintf (file
, " file %s line %d col %d", xloc
.file
, xloc
.line
,
509 if (CODE_CONTAINS_STRUCT (code
, TS_DECL_COMMON
))
511 print_node (file
, "size", DECL_SIZE (node
), indent
+ 4);
512 print_node (file
, "unit size", DECL_SIZE_UNIT (node
), indent
+ 4);
514 if (code
!= FUNCTION_DECL
|| DECL_BUILT_IN (node
))
515 indent_to (file
, indent
+ 3);
517 if (DECL_USER_ALIGN (node
))
518 fprintf (file
, " user");
520 fprintf (file
, " align %d", DECL_ALIGN (node
));
521 if (code
== FIELD_DECL
)
522 fprintf (file
, " offset_align " HOST_WIDE_INT_PRINT_UNSIGNED
,
523 DECL_OFFSET_ALIGN (node
));
525 if (code
== FUNCTION_DECL
&& DECL_BUILT_IN (node
))
527 if (DECL_BUILT_IN_CLASS (node
) == BUILT_IN_MD
)
528 fprintf (file
, " built-in BUILT_IN_MD %d", DECL_FUNCTION_CODE (node
));
530 fprintf (file
, " built-in %s:%s",
531 built_in_class_names
[(int) DECL_BUILT_IN_CLASS (node
)],
532 built_in_names
[(int) DECL_FUNCTION_CODE (node
)]);
535 if (code
== FIELD_DECL
)
537 print_node (file
, "offset", DECL_FIELD_OFFSET (node
), indent
+ 4);
538 print_node (file
, "bit offset", DECL_FIELD_BIT_OFFSET (node
),
540 if (DECL_BIT_FIELD_TYPE (node
))
541 print_node (file
, "bit_field_type", DECL_BIT_FIELD_TYPE (node
),
545 print_node_brief (file
, "context", DECL_CONTEXT (node
), indent
+ 4);
547 if (CODE_CONTAINS_STRUCT (code
, TS_DECL_COMMON
))
549 print_node_brief (file
, "attributes",
550 DECL_ATTRIBUTES (node
), indent
+ 4);
551 if (code
!= PARM_DECL
)
552 print_node_brief (file
, "initial", DECL_INITIAL (node
),
555 if (CODE_CONTAINS_STRUCT (code
, TS_DECL_WRTL
))
557 print_node_brief (file
, "abstract_origin",
558 DECL_ABSTRACT_ORIGIN (node
), indent
+ 4);
560 if (CODE_CONTAINS_STRUCT (code
, TS_DECL_NON_COMMON
))
562 print_node (file
, "arguments", DECL_ARGUMENT_FLD (node
), indent
+ 4);
563 print_node (file
, "result", DECL_RESULT_FLD (node
), indent
+ 4);
566 lang_hooks
.print_decl (file
, node
, indent
);
568 if (DECL_RTL_SET_P (node
))
570 indent_to (file
, indent
+ 4);
571 print_rtl (file
, DECL_RTL (node
));
574 if (code
== PARM_DECL
)
576 print_node (file
, "arg-type", DECL_ARG_TYPE (node
), indent
+ 4);
578 if (DECL_INCOMING_RTL (node
) != 0)
580 indent_to (file
, indent
+ 4);
581 fprintf (file
, "incoming-rtl ");
582 print_rtl (file
, DECL_INCOMING_RTL (node
));
585 else if (code
== FUNCTION_DECL
586 && DECL_STRUCT_FUNCTION (node
) != 0)
588 indent_to (file
, indent
+ 4);
589 dump_addr (file
, "struct-function ", DECL_STRUCT_FUNCTION (node
));
592 if ((code
== VAR_DECL
|| code
== PARM_DECL
)
593 && DECL_HAS_VALUE_EXPR_P (node
))
594 print_node (file
, "value-expr", DECL_VALUE_EXPR (node
), indent
+ 4);
596 /* Print the decl chain only if decl is at second level. */
598 print_node (file
, "chain", TREE_CHAIN (node
), indent
+ 4);
600 print_node_brief (file
, "chain", TREE_CHAIN (node
), indent
+ 4);
604 if (TYPE_UNSIGNED (node
))
605 fputs (" unsigned", file
);
607 /* The no-force-blk flag is used for different things in
609 if ((code
== RECORD_TYPE
610 || code
== UNION_TYPE
611 || code
== QUAL_UNION_TYPE
)
612 && TYPE_NO_FORCE_BLK (node
))
613 fputs (" no-force-blk", file
);
615 if (TYPE_STRING_FLAG (node
))
616 fputs (" string-flag", file
);
617 if (TYPE_NEEDS_CONSTRUCTING (node
))
618 fputs (" needs-constructing", file
);
620 /* The transparent-union flag is used for different things in
622 if ((code
== UNION_TYPE
|| code
== RECORD_TYPE
)
623 && TYPE_TRANSPARENT_AGGR (node
))
624 fputs (" transparent-aggr", file
);
625 else if (code
== ARRAY_TYPE
626 && TYPE_NONALIASED_COMPONENT (node
))
627 fputs (" nonaliased-component", file
);
629 if (TYPE_PACKED (node
))
630 fputs (" packed", file
);
632 if (TYPE_RESTRICT (node
))
633 fputs (" restrict", file
);
635 if (TYPE_LANG_FLAG_0 (node
))
636 fputs (" type_0", file
);
637 if (TYPE_LANG_FLAG_1 (node
))
638 fputs (" type_1", file
);
639 if (TYPE_LANG_FLAG_2 (node
))
640 fputs (" type_2", file
);
641 if (TYPE_LANG_FLAG_3 (node
))
642 fputs (" type_3", file
);
643 if (TYPE_LANG_FLAG_4 (node
))
644 fputs (" type_4", file
);
645 if (TYPE_LANG_FLAG_5 (node
))
646 fputs (" type_5", file
);
647 if (TYPE_LANG_FLAG_6 (node
))
648 fputs (" type_6", file
);
650 mode
= TYPE_MODE (node
);
651 fprintf (file
, " %s", GET_MODE_NAME (mode
));
653 print_node (file
, "size", TYPE_SIZE (node
), indent
+ 4);
654 print_node (file
, "unit size", TYPE_SIZE_UNIT (node
), indent
+ 4);
655 indent_to (file
, indent
+ 3);
657 if (TYPE_USER_ALIGN (node
))
658 fprintf (file
, " user");
660 fprintf (file
, " align %d symtab %d alias set " HOST_WIDE_INT_PRINT_DEC
,
661 TYPE_ALIGN (node
), TYPE_SYMTAB_ADDRESS (node
),
662 (HOST_WIDE_INT
) TYPE_ALIAS_SET (node
));
664 if (TYPE_STRUCTURAL_EQUALITY_P (node
))
665 fprintf (file
, " structural equality");
667 dump_addr (file
, " canonical type ", TYPE_CANONICAL (node
));
669 print_node (file
, "attributes", TYPE_ATTRIBUTES (node
), indent
+ 4);
671 if (INTEGRAL_TYPE_P (node
) || code
== REAL_TYPE
672 || code
== FIXED_POINT_TYPE
)
674 fprintf (file
, " precision %d", TYPE_PRECISION (node
));
675 print_node_brief (file
, "min", TYPE_MIN_VALUE (node
), indent
+ 4);
676 print_node_brief (file
, "max", TYPE_MAX_VALUE (node
), indent
+ 4);
679 if (code
== ENUMERAL_TYPE
)
680 print_node (file
, "values", TYPE_VALUES (node
), indent
+ 4);
681 else if (code
== ARRAY_TYPE
)
682 print_node (file
, "domain", TYPE_DOMAIN (node
), indent
+ 4);
683 else if (code
== VECTOR_TYPE
)
684 fprintf (file
, " nunits %d", (int) TYPE_VECTOR_SUBPARTS (node
));
685 else if (code
== RECORD_TYPE
686 || code
== UNION_TYPE
687 || code
== QUAL_UNION_TYPE
)
688 print_node (file
, "fields", TYPE_FIELDS (node
), indent
+ 4);
689 else if (code
== FUNCTION_TYPE
690 || code
== METHOD_TYPE
)
692 if (TYPE_METHOD_BASETYPE (node
))
693 print_node_brief (file
, "method basetype",
694 TYPE_METHOD_BASETYPE (node
), indent
+ 4);
695 print_node (file
, "arg-types", TYPE_ARG_TYPES (node
), indent
+ 4);
697 else if (code
== OFFSET_TYPE
)
698 print_node_brief (file
, "basetype", TYPE_OFFSET_BASETYPE (node
),
701 if (TYPE_CONTEXT (node
))
702 print_node_brief (file
, "context", TYPE_CONTEXT (node
), indent
+ 4);
704 lang_hooks
.print_type (file
, node
, indent
);
706 if (TYPE_POINTER_TO (node
) || TREE_CHAIN (node
))
707 indent_to (file
, indent
+ 3);
709 print_node_brief (file
, "pointer_to_this", TYPE_POINTER_TO (node
),
711 print_node_brief (file
, "reference_to_this", TYPE_REFERENCE_TO (node
),
713 print_node_brief (file
, "chain", TREE_CHAIN (node
), indent
+ 4);
723 if (code
== BIND_EXPR
)
725 print_node (file
, "vars", TREE_OPERAND (node
, 0), indent
+ 4);
726 print_node (file
, "body", TREE_OPERAND (node
, 1), indent
+ 4);
727 print_node (file
, "block", TREE_OPERAND (node
, 2), indent
+ 4);
730 if (code
== CALL_EXPR
)
732 call_expr_arg_iterator iter
;
734 print_node (file
, "fn", CALL_EXPR_FN (node
), indent
+ 4);
735 print_node (file
, "static_chain", CALL_EXPR_STATIC_CHAIN (node
),
738 FOR_EACH_CALL_EXPR_ARG (arg
, iter
, node
)
741 sprintf (temp
, "arg %d", i
);
742 print_node (file
, temp
, arg
, indent
+ 4);
748 len
= TREE_OPERAND_LENGTH (node
);
750 for (i
= 0; i
< len
; i
++)
754 sprintf (temp
, "arg %d", i
);
755 print_node (file
, temp
, TREE_OPERAND (node
, i
), indent
+ 4);
758 if (CODE_CONTAINS_STRUCT (code
, TS_COMMON
))
759 print_node (file
, "chain", TREE_CHAIN (node
), indent
+ 4);
763 case tcc_exceptional
:
767 if (TREE_OVERFLOW (node
))
768 fprintf (file
, " overflow");
771 if (TREE_INT_CST_HIGH (node
) == 0)
772 fprintf (file
, HOST_WIDE_INT_PRINT_UNSIGNED
,
773 TREE_INT_CST_LOW (node
));
774 else if (TREE_INT_CST_HIGH (node
) == -1
775 && TREE_INT_CST_LOW (node
) != 0)
776 fprintf (file
, "-" HOST_WIDE_INT_PRINT_UNSIGNED
,
777 -TREE_INT_CST_LOW (node
));
779 fprintf (file
, HOST_WIDE_INT_PRINT_DOUBLE_HEX
,
780 (unsigned HOST_WIDE_INT
) TREE_INT_CST_HIGH (node
),
781 (unsigned HOST_WIDE_INT
) TREE_INT_CST_LOW (node
));
788 if (TREE_OVERFLOW (node
))
789 fprintf (file
, " overflow");
791 d
= TREE_REAL_CST (node
);
792 if (REAL_VALUE_ISINF (d
))
793 fprintf (file
, REAL_VALUE_NEGATIVE (d
) ? " -Inf" : " Inf");
794 else if (REAL_VALUE_ISNAN (d
))
795 fprintf (file
, " Nan");
799 real_to_decimal (string
, &d
, sizeof (string
), 0, 1);
800 fprintf (file
, " %s", string
);
810 if (TREE_OVERFLOW (node
))
811 fprintf (file
, " overflow");
813 f
= TREE_FIXED_CST (node
);
814 fixed_to_decimal (string
, &f
, sizeof (string
));
815 fprintf (file
, " %s", string
);
824 for (i
= 0; i
< VECTOR_CST_NELTS (node
); ++i
)
826 sprintf (buf
, "elt%u: ", i
);
827 print_node (file
, buf
, VECTOR_CST_ELT (node
, i
), indent
+ 4);
833 print_node (file
, "real", TREE_REALPART (node
), indent
+ 4);
834 print_node (file
, "imag", TREE_IMAGPART (node
), indent
+ 4);
839 const char *p
= TREE_STRING_POINTER (node
);
840 int i
= TREE_STRING_LENGTH (node
);
845 if (ch
>= ' ' && ch
< 127)
848 fprintf(file
, "\\%03o", ch
& 0xFF);
854 case IDENTIFIER_NODE
:
855 lang_hooks
.print_identifier (file
, node
, indent
);
859 print_node (file
, "purpose", TREE_PURPOSE (node
), indent
+ 4);
860 print_node (file
, "value", TREE_VALUE (node
), indent
+ 4);
861 print_node (file
, "chain", TREE_CHAIN (node
), indent
+ 4);
865 len
= TREE_VEC_LENGTH (node
);
866 for (i
= 0; i
< len
; i
++)
867 if (TREE_VEC_ELT (node
, i
))
870 sprintf (temp
, "elt %d", i
);
871 print_node (file
, temp
, TREE_VEC_ELT (node
, i
), indent
+ 4);
877 unsigned HOST_WIDE_INT cnt
;
879 len
= VEC_length (constructor_elt
, CONSTRUCTOR_ELTS (node
));
880 fprintf (file
, " lngt %d", len
);
881 FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (node
),
884 print_node (file
, "idx", index
, indent
+ 4);
885 print_node (file
, "val", value
, indent
+ 4);
891 dump_addr (file
, " head ", node
->stmt_list
.head
);
892 dump_addr (file
, " tail ", node
->stmt_list
.tail
);
893 fprintf (file
, " stmts");
895 tree_stmt_iterator i
;
896 for (i
= tsi_start (node
); !tsi_end_p (i
); tsi_next (&i
))
898 /* Not printing the addresses of the (not-a-tree)
899 'struct tree_stmt_list_node's. */
900 dump_addr (file
, " ", tsi_stmt (i
));
902 fprintf (file
, "\n");
903 for (i
= tsi_start (node
); !tsi_end_p (i
); tsi_next (&i
))
905 /* Not printing the addresses of the (not-a-tree)
906 'struct tree_stmt_list_node's. */
907 print_node (file
, "stmt", tsi_stmt (i
), indent
+ 4);
913 print_node (file
, "vars", BLOCK_VARS (node
), indent
+ 4);
914 print_node (file
, "supercontext", BLOCK_SUPERCONTEXT (node
),
916 print_node (file
, "subblocks", BLOCK_SUBBLOCKS (node
), indent
+ 4);
917 print_node (file
, "chain", BLOCK_CHAIN (node
), indent
+ 4);
918 print_node (file
, "abstract_origin",
919 BLOCK_ABSTRACT_ORIGIN (node
), indent
+ 4);
923 print_node_brief (file
, "var", SSA_NAME_VAR (node
), indent
+ 4);
924 fprintf (file
, "def_stmt ");
925 print_gimple_stmt (file
, SSA_NAME_DEF_STMT (node
), indent
+ 4, 0);
927 indent_to (file
, indent
+ 4);
928 fprintf (file
, "version %u", SSA_NAME_VERSION (node
));
929 if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (node
))
930 fprintf (file
, " in-abnormal-phi");
931 if (SSA_NAME_IN_FREE_LIST (node
))
932 fprintf (file
, " in-free-list");
934 if (SSA_NAME_PTR_INFO (node
))
936 indent_to (file
, indent
+ 3);
937 if (SSA_NAME_PTR_INFO (node
))
938 dump_addr (file
, " ptr-info ", SSA_NAME_PTR_INFO (node
));
945 fprintf (file
, " %s",
946 omp_clause_code_name
[OMP_CLAUSE_CODE (node
)]);
947 for (i
= 0; i
< omp_clause_num_ops
[OMP_CLAUSE_CODE (node
)]; i
++)
949 indent_to (file
, indent
+ 4);
950 fprintf (file
, "op %d:", i
);
951 print_node_brief (file
, "", OMP_CLAUSE_OPERAND (node
, i
), 0);
956 case OPTIMIZATION_NODE
:
957 cl_optimization_print (file
, indent
+ 4, TREE_OPTIMIZATION (node
));
960 case TARGET_OPTION_NODE
:
961 cl_target_option_print (file
, indent
+ 4, TREE_TARGET_OPTION (node
));
964 fprintf (file
, " imported declaration");
965 print_node_brief (file
, "associated declaration",
966 IMPORTED_DECL_ASSOCIATED_DECL (node
),
971 if (EXCEPTIONAL_CLASS_P (node
))
972 lang_hooks
.print_xnode (file
, node
, indent
);
979 if (EXPR_HAS_LOCATION (node
))
981 expanded_location xloc
= expand_location (EXPR_LOCATION (node
));
982 indent_to (file
, indent
+4);
983 fprintf (file
, "%s:%d:%d", xloc
.file
, xloc
.line
, xloc
.column
);
989 /* Print the tree vector VEC in full on file FILE, preceded by PREFIX,
990 starting in column INDENT. */
993 print_vec_tree (FILE *file
, const char *prefix
, VEC(tree
,gc
) *vec
, int indent
)
998 /* Indent to the specified column, since this is the long form. */
999 indent_to (file
, indent
);
1001 /* Print the slot this node is in, and its code, and address. */
1002 fprintf (file
, "%s <VEC", prefix
);
1003 dump_addr (file
, " ", vec
);
1005 FOR_EACH_VEC_ELT (tree
, vec
, ix
, elt
)
1008 sprintf (temp
, "elt %d", ix
);
1009 print_node (file
, temp
, elt
, indent
+ 4);