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
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 "fixed-value.h"
31 #include "langhooks.h"
32 #include "tree-iterator.h"
33 #include "diagnostic.h"
34 #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 PREFIX and ADDR to FILE. */
65 dump_addr (FILE *file
, const char *prefix
, const void *addr
)
67 if (flag_dump_noaddr
|| flag_dump_unnumbered
)
68 fprintf (file
, "%s#", prefix
);
70 fprintf (file
, "%s" HOST_PTR_PRINTF
, prefix
, addr
);
73 /* Print a node in brief fashion, with just the code, address and name. */
76 print_node_brief (FILE *file
, const char *prefix
, const_tree node
, int indent
)
78 enum tree_code_class tclass
;
83 tclass
= TREE_CODE_CLASS (TREE_CODE (node
));
85 /* Always print the slot this node is in, and its code, address and
89 fprintf (file
, "%s <%s", prefix
, tree_code_name
[(int) TREE_CODE (node
)]);
90 dump_addr (file
, " ", node
);
92 if (tclass
== tcc_declaration
)
95 fprintf (file
, " %s", IDENTIFIER_POINTER (DECL_NAME (node
)));
96 else if (TREE_CODE (node
) == LABEL_DECL
97 && LABEL_DECL_UID (node
) != -1)
98 fprintf (file
, " L.%d", (int) LABEL_DECL_UID (node
));
100 fprintf (file
, " %c.%u", TREE_CODE (node
) == CONST_DECL
? 'C' : 'D',
103 else if (tclass
== tcc_type
)
105 if (TYPE_NAME (node
))
107 if (TREE_CODE (TYPE_NAME (node
)) == IDENTIFIER_NODE
)
108 fprintf (file
, " %s", IDENTIFIER_POINTER (TYPE_NAME (node
)));
109 else if (TREE_CODE (TYPE_NAME (node
)) == TYPE_DECL
110 && DECL_NAME (TYPE_NAME (node
)))
111 fprintf (file
, " %s",
112 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (node
))));
114 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
115 fprintf (file
, " address-space-%d", TYPE_ADDR_SPACE (node
));
117 if (TREE_CODE (node
) == IDENTIFIER_NODE
)
118 fprintf (file
, " %s", IDENTIFIER_POINTER (node
));
120 /* We might as well always print the value of an integer or real. */
121 if (TREE_CODE (node
) == INTEGER_CST
)
123 if (TREE_OVERFLOW (node
))
124 fprintf (file
, " overflow");
127 if (TREE_INT_CST_HIGH (node
) == 0)
128 fprintf (file
, HOST_WIDE_INT_PRINT_UNSIGNED
, TREE_INT_CST_LOW (node
));
129 else if (TREE_INT_CST_HIGH (node
) == -1
130 && TREE_INT_CST_LOW (node
) != 0)
131 fprintf (file
, "-" HOST_WIDE_INT_PRINT_UNSIGNED
,
132 -TREE_INT_CST_LOW (node
));
134 fprintf (file
, HOST_WIDE_INT_PRINT_DOUBLE_HEX
,
135 (unsigned HOST_WIDE_INT
) TREE_INT_CST_HIGH (node
),
136 (unsigned HOST_WIDE_INT
) TREE_INT_CST_LOW (node
));
138 if (TREE_CODE (node
) == REAL_CST
)
142 if (TREE_OVERFLOW (node
))
143 fprintf (file
, " overflow");
145 d
= TREE_REAL_CST (node
);
146 if (REAL_VALUE_ISINF (d
))
147 fprintf (file
, REAL_VALUE_NEGATIVE (d
) ? " -Inf" : " Inf");
148 else if (REAL_VALUE_ISNAN (d
))
149 fprintf (file
, " Nan");
153 real_to_decimal (string
, &d
, sizeof (string
), 0, 1);
154 fprintf (file
, " %s", string
);
157 if (TREE_CODE (node
) == FIXED_CST
)
162 if (TREE_OVERFLOW (node
))
163 fprintf (file
, " overflow");
165 f
= TREE_FIXED_CST (node
);
166 fixed_to_decimal (string
, &f
, sizeof (string
));
167 fprintf (file
, " %s", string
);
174 indent_to (FILE *file
, int column
)
178 /* Since this is the long way, indent to desired column. */
180 fprintf (file
, "\n");
181 for (i
= 0; i
< column
; i
++)
185 /* Print the node NODE in full on file FILE, preceded by PREFIX,
186 starting in column INDENT. */
189 print_node (FILE *file
, const char *prefix
, tree node
, int indent
)
193 enum machine_mode mode
;
194 enum tree_code_class tclass
;
197 expanded_location xloc
;
203 code
= TREE_CODE (node
);
204 tclass
= TREE_CODE_CLASS (code
);
206 /* Don't get too deep in nesting. If the user wants to see deeper,
207 it is easy to use the address of a lowest-level node
208 as an argument in another call to debug_tree. */
212 print_node_brief (file
, prefix
, node
, indent
);
216 if (indent
> 8 && (tclass
== tcc_type
|| tclass
== tcc_declaration
))
218 print_node_brief (file
, prefix
, node
, indent
);
222 /* It is unsafe to look at any other fields of an ERROR_MARK node. */
223 if (code
== ERROR_MARK
)
225 print_node_brief (file
, prefix
, node
, indent
);
229 /* Allow this function to be called if the table is not there. */
232 hash
= ((unsigned long) node
) % HASH_SIZE
;
234 /* If node is in the table, just mention its address. */
235 for (b
= table
[hash
]; b
; b
= b
->next
)
238 print_node_brief (file
, prefix
, node
, indent
);
242 /* Add this node to the table. */
243 b
= XNEW (struct bucket
);
245 b
->next
= table
[hash
];
249 /* Indent to the specified column, since this is the long form. */
250 indent_to (file
, indent
);
252 /* Print the slot this node is in, and its code, and address. */
253 fprintf (file
, "%s <%s", prefix
, tree_code_name
[(int) code
]);
254 dump_addr (file
, " ", node
);
256 /* Print the name, if any. */
257 if (tclass
== tcc_declaration
)
259 if (DECL_NAME (node
))
260 fprintf (file
, " %s", IDENTIFIER_POINTER (DECL_NAME (node
)));
261 else if (code
== LABEL_DECL
262 && LABEL_DECL_UID (node
) != -1)
263 fprintf (file
, " L.%d", (int) LABEL_DECL_UID (node
));
265 fprintf (file
, " %c.%u", code
== CONST_DECL
? 'C' : 'D',
268 else if (tclass
== tcc_type
)
270 if (TYPE_NAME (node
))
272 if (TREE_CODE (TYPE_NAME (node
)) == IDENTIFIER_NODE
)
273 fprintf (file
, " %s", IDENTIFIER_POINTER (TYPE_NAME (node
)));
274 else if (TREE_CODE (TYPE_NAME (node
)) == TYPE_DECL
275 && DECL_NAME (TYPE_NAME (node
)))
276 fprintf (file
, " %s",
277 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (node
))));
280 if (code
== IDENTIFIER_NODE
)
281 fprintf (file
, " %s", IDENTIFIER_POINTER (node
));
283 if (code
== INTEGER_CST
)
286 print_node_brief (file
, "type", TREE_TYPE (node
), indent
+ 4);
290 print_node (file
, "type", TREE_TYPE (node
), indent
+ 4);
291 if (TREE_TYPE (node
))
292 indent_to (file
, indent
+ 3);
295 if (!TYPE_P (node
) && TREE_SIDE_EFFECTS (node
))
296 fputs (" side-effects", file
);
298 if (TYPE_P (node
) ? TYPE_READONLY (node
) : TREE_READONLY (node
))
299 fputs (" readonly", file
);
300 if (!TYPE_P (node
) && TREE_CONSTANT (node
))
301 fputs (" constant", file
);
302 else if (TYPE_P (node
) && TYPE_SIZES_GIMPLIFIED (node
))
303 fputs (" sizes-gimplified", file
);
305 if (TYPE_P (node
) && !ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
306 fprintf (file
, " address-space-%d", TYPE_ADDR_SPACE (node
));
308 if (TREE_ADDRESSABLE (node
))
309 fputs (" addressable", file
);
310 if (TREE_THIS_VOLATILE (node
))
311 fputs (" volatile", file
);
312 if (TREE_ASM_WRITTEN (node
))
313 fputs (" asm_written", file
);
314 if (TREE_USED (node
))
315 fputs (" used", file
);
316 if (TREE_NOTHROW (node
))
317 fputs (TYPE_P (node
) ? " align-ok" : " nothrow", file
);
318 if (TREE_PUBLIC (node
))
319 fputs (" public", file
);
320 if (TREE_PRIVATE (node
))
321 fputs (" private", file
);
322 if (TREE_PROTECTED (node
))
323 fputs (" protected", file
);
324 if (TREE_STATIC (node
))
325 fputs (" static", file
);
326 if (TREE_DEPRECATED (node
))
327 fputs (" deprecated", file
);
328 if (TREE_VISITED (node
))
329 fputs (" visited", file
);
330 if (TREE_LANG_FLAG_0 (node
))
331 fputs (" tree_0", file
);
332 if (TREE_LANG_FLAG_1 (node
))
333 fputs (" tree_1", file
);
334 if (TREE_LANG_FLAG_2 (node
))
335 fputs (" tree_2", file
);
336 if (TREE_LANG_FLAG_3 (node
))
337 fputs (" tree_3", file
);
338 if (TREE_LANG_FLAG_4 (node
))
339 fputs (" tree_4", file
);
340 if (TREE_LANG_FLAG_5 (node
))
341 fputs (" tree_5", file
);
342 if (TREE_LANG_FLAG_6 (node
))
343 fputs (" tree_6", file
);
345 /* DECL_ nodes have additional attributes. */
347 switch (TREE_CODE_CLASS (code
))
349 case tcc_declaration
:
350 if (CODE_CONTAINS_STRUCT (code
, TS_DECL_COMMON
))
352 if (DECL_UNSIGNED (node
))
353 fputs (" unsigned", file
);
354 if (DECL_IGNORED_P (node
))
355 fputs (" ignored", file
);
356 if (DECL_ABSTRACT (node
))
357 fputs (" abstract", file
);
358 if (DECL_EXTERNAL (node
))
359 fputs (" external", file
);
360 if (DECL_NONLOCAL (node
))
361 fputs (" nonlocal", file
);
363 if (CODE_CONTAINS_STRUCT (code
, TS_DECL_WITH_VIS
))
365 if (DECL_WEAK (node
))
366 fputs (" weak", file
);
367 if (DECL_IN_SYSTEM_HEADER (node
))
368 fputs (" in_system_header", file
);
370 if (CODE_CONTAINS_STRUCT (code
, TS_DECL_WRTL
)
371 && code
!= LABEL_DECL
372 && code
!= FUNCTION_DECL
373 && DECL_REGISTER (node
))
374 fputs (" regdecl", file
);
376 if (code
== TYPE_DECL
&& TYPE_DECL_SUPPRESS_DEBUG (node
))
377 fputs (" suppress-debug", file
);
379 if (code
== FUNCTION_DECL
380 && DECL_FUNCTION_SPECIFIC_TARGET (node
))
381 fputs (" function-specific-target", file
);
382 if (code
== FUNCTION_DECL
383 && DECL_FUNCTION_SPECIFIC_OPTIMIZATION (node
))
384 fputs (" function-specific-opt", file
);
385 if (code
== FUNCTION_DECL
&& DECL_DECLARED_INLINE_P (node
))
386 fputs (" autoinline", file
);
387 if (code
== FUNCTION_DECL
&& DECL_BUILT_IN (node
))
388 fputs (" built-in", file
);
389 if (code
== FUNCTION_DECL
&& DECL_STATIC_CHAIN (node
))
390 fputs (" static-chain", file
);
392 if (code
== FIELD_DECL
&& DECL_PACKED (node
))
393 fputs (" packed", file
);
394 if (code
== FIELD_DECL
&& DECL_BIT_FIELD (node
))
395 fputs (" bit-field", file
);
396 if (code
== FIELD_DECL
&& DECL_NONADDRESSABLE_P (node
))
397 fputs (" nonaddressable", file
);
399 if (code
== LABEL_DECL
&& DECL_ERROR_ISSUED (node
))
400 fputs (" error-issued", file
);
401 if (code
== LABEL_DECL
&& EH_LANDING_PAD_NR (node
))
402 fprintf (file
, " landing-pad:%d", EH_LANDING_PAD_NR (node
));
404 if (code
== VAR_DECL
&& DECL_IN_TEXT_SECTION (node
))
405 fputs (" in-text-section", file
);
406 if (code
== VAR_DECL
&& DECL_COMMON (node
))
407 fputs (" common", file
);
408 if (code
== VAR_DECL
&& DECL_THREAD_LOCAL_P (node
))
410 enum tls_model kind
= DECL_TLS_MODEL (node
);
413 case TLS_MODEL_GLOBAL_DYNAMIC
:
414 fputs (" tls-global-dynamic", file
);
416 case TLS_MODEL_LOCAL_DYNAMIC
:
417 fputs (" tls-local-dynamic", file
);
419 case TLS_MODEL_INITIAL_EXEC
:
420 fputs (" tls-initial-exec", file
);
422 case TLS_MODEL_LOCAL_EXEC
:
423 fputs (" tls-local-exec", file
);
430 if (CODE_CONTAINS_STRUCT (code
, TS_DECL_COMMON
))
432 if (DECL_VIRTUAL_P (node
))
433 fputs (" virtual", file
);
434 if (DECL_PRESERVE_P (node
))
435 fputs (" preserve", file
);
436 if (DECL_LANG_FLAG_0 (node
))
437 fputs (" decl_0", file
);
438 if (DECL_LANG_FLAG_1 (node
))
439 fputs (" decl_1", file
);
440 if (DECL_LANG_FLAG_2 (node
))
441 fputs (" decl_2", file
);
442 if (DECL_LANG_FLAG_3 (node
))
443 fputs (" decl_3", file
);
444 if (DECL_LANG_FLAG_4 (node
))
445 fputs (" decl_4", file
);
446 if (DECL_LANG_FLAG_5 (node
))
447 fputs (" decl_5", file
);
448 if (DECL_LANG_FLAG_6 (node
))
449 fputs (" decl_6", file
);
450 if (DECL_LANG_FLAG_7 (node
))
451 fputs (" decl_7", file
);
453 mode
= DECL_MODE (node
);
454 fprintf (file
, " %s", GET_MODE_NAME (mode
));
457 if ((code
== VAR_DECL
|| code
== PARM_DECL
|| code
== RESULT_DECL
)
458 && DECL_BY_REFERENCE (node
))
459 fputs (" passed-by-reference", file
);
461 if (CODE_CONTAINS_STRUCT (code
, TS_DECL_WITH_VIS
) && DECL_DEFER_OUTPUT (node
))
462 fputs (" defer-output", file
);
465 xloc
= expand_location (DECL_SOURCE_LOCATION (node
));
466 fprintf (file
, " file %s line %d col %d", xloc
.file
, xloc
.line
,
469 if (CODE_CONTAINS_STRUCT (code
, TS_DECL_COMMON
))
471 print_node (file
, "size", DECL_SIZE (node
), indent
+ 4);
472 print_node (file
, "unit size", DECL_SIZE_UNIT (node
), indent
+ 4);
474 if (code
!= FUNCTION_DECL
|| DECL_BUILT_IN (node
))
475 indent_to (file
, indent
+ 3);
477 if (DECL_USER_ALIGN (node
))
478 fprintf (file
, " user");
480 fprintf (file
, " align %d", DECL_ALIGN (node
));
481 if (code
== FIELD_DECL
)
482 fprintf (file
, " offset_align " HOST_WIDE_INT_PRINT_UNSIGNED
,
483 DECL_OFFSET_ALIGN (node
));
485 if (code
== FUNCTION_DECL
&& DECL_BUILT_IN (node
))
487 if (DECL_BUILT_IN_CLASS (node
) == BUILT_IN_MD
)
488 fprintf (file
, " built-in BUILT_IN_MD %d", DECL_FUNCTION_CODE (node
));
490 fprintf (file
, " built-in %s:%s",
491 built_in_class_names
[(int) DECL_BUILT_IN_CLASS (node
)],
492 built_in_names
[(int) DECL_FUNCTION_CODE (node
)]);
495 if (code
== FIELD_DECL
)
497 print_node (file
, "offset", DECL_FIELD_OFFSET (node
), indent
+ 4);
498 print_node (file
, "bit offset", DECL_FIELD_BIT_OFFSET (node
),
500 if (DECL_BIT_FIELD_TYPE (node
))
501 print_node (file
, "bit_field_type", DECL_BIT_FIELD_TYPE (node
),
505 print_node_brief (file
, "context", DECL_CONTEXT (node
), indent
+ 4);
507 if (CODE_CONTAINS_STRUCT (code
, TS_DECL_COMMON
))
509 print_node_brief (file
, "attributes",
510 DECL_ATTRIBUTES (node
), indent
+ 4);
511 if (code
!= PARM_DECL
)
512 print_node_brief (file
, "initial", DECL_INITIAL (node
),
515 if (CODE_CONTAINS_STRUCT (code
, TS_DECL_WRTL
))
517 print_node_brief (file
, "abstract_origin",
518 DECL_ABSTRACT_ORIGIN (node
), indent
+ 4);
520 if (CODE_CONTAINS_STRUCT (code
, TS_DECL_NON_COMMON
))
522 print_node (file
, "arguments", DECL_ARGUMENT_FLD (node
), indent
+ 4);
523 print_node (file
, "result", DECL_RESULT_FLD (node
), indent
+ 4);
526 lang_hooks
.print_decl (file
, node
, indent
);
528 if (DECL_RTL_SET_P (node
))
530 indent_to (file
, indent
+ 4);
531 print_rtl (file
, DECL_RTL (node
));
534 if (code
== PARM_DECL
)
536 print_node (file
, "arg-type", DECL_ARG_TYPE (node
), indent
+ 4);
538 if (DECL_INCOMING_RTL (node
) != 0)
540 indent_to (file
, indent
+ 4);
541 fprintf (file
, "incoming-rtl ");
542 print_rtl (file
, DECL_INCOMING_RTL (node
));
545 else if (code
== FUNCTION_DECL
546 && DECL_STRUCT_FUNCTION (node
) != 0)
548 indent_to (file
, indent
+ 4);
549 dump_addr (file
, "struct-function ", DECL_STRUCT_FUNCTION (node
));
552 if ((code
== VAR_DECL
|| code
== PARM_DECL
)
553 && DECL_HAS_VALUE_EXPR_P (node
))
554 print_node (file
, "value-expr", DECL_VALUE_EXPR (node
), indent
+ 4);
556 /* Print the decl chain only if decl is at second level. */
558 print_node (file
, "chain", TREE_CHAIN (node
), indent
+ 4);
560 print_node_brief (file
, "chain", TREE_CHAIN (node
), indent
+ 4);
564 if (TYPE_UNSIGNED (node
))
565 fputs (" unsigned", file
);
567 /* The no-force-blk flag is used for different things in
569 if ((code
== RECORD_TYPE
570 || code
== UNION_TYPE
571 || code
== QUAL_UNION_TYPE
)
572 && TYPE_NO_FORCE_BLK (node
))
573 fputs (" no-force-blk", file
);
574 else if (code
== INTEGER_TYPE
575 && TYPE_IS_SIZETYPE (node
))
576 fputs (" sizetype", file
);
578 if (TYPE_STRING_FLAG (node
))
579 fputs (" string-flag", file
);
580 if (TYPE_NEEDS_CONSTRUCTING (node
))
581 fputs (" needs-constructing", file
);
583 /* The transparent-union flag is used for different things in
585 if (code
== UNION_TYPE
&& TYPE_TRANSPARENT_UNION (node
))
586 fputs (" transparent-union", file
);
587 else if (code
== ARRAY_TYPE
588 && TYPE_NONALIASED_COMPONENT (node
))
589 fputs (" nonaliased-component", file
);
591 if (TYPE_PACKED (node
))
592 fputs (" packed", file
);
594 if (TYPE_RESTRICT (node
))
595 fputs (" restrict", file
);
597 if (TYPE_LANG_FLAG_0 (node
))
598 fputs (" type_0", file
);
599 if (TYPE_LANG_FLAG_1 (node
))
600 fputs (" type_1", file
);
601 if (TYPE_LANG_FLAG_2 (node
))
602 fputs (" type_2", file
);
603 if (TYPE_LANG_FLAG_3 (node
))
604 fputs (" type_3", file
);
605 if (TYPE_LANG_FLAG_4 (node
))
606 fputs (" type_4", file
);
607 if (TYPE_LANG_FLAG_5 (node
))
608 fputs (" type_5", file
);
609 if (TYPE_LANG_FLAG_6 (node
))
610 fputs (" type_6", file
);
612 mode
= TYPE_MODE (node
);
613 fprintf (file
, " %s", GET_MODE_NAME (mode
));
615 print_node (file
, "size", TYPE_SIZE (node
), indent
+ 4);
616 print_node (file
, "unit size", TYPE_SIZE_UNIT (node
), indent
+ 4);
617 indent_to (file
, indent
+ 3);
619 if (TYPE_USER_ALIGN (node
))
620 fprintf (file
, " user");
622 fprintf (file
, " align %d symtab %d alias set " HOST_WIDE_INT_PRINT_DEC
,
623 TYPE_ALIGN (node
), TYPE_SYMTAB_ADDRESS (node
),
624 (HOST_WIDE_INT
) TYPE_ALIAS_SET (node
));
626 if (TYPE_STRUCTURAL_EQUALITY_P (node
))
627 fprintf (file
, " structural equality");
629 dump_addr (file
, " canonical type ", TYPE_CANONICAL (node
));
631 print_node (file
, "attributes", TYPE_ATTRIBUTES (node
), indent
+ 4);
633 if (INTEGRAL_TYPE_P (node
) || code
== REAL_TYPE
634 || code
== FIXED_POINT_TYPE
)
636 fprintf (file
, " precision %d", TYPE_PRECISION (node
));
637 print_node_brief (file
, "min", TYPE_MIN_VALUE (node
), indent
+ 4);
638 print_node_brief (file
, "max", TYPE_MAX_VALUE (node
), indent
+ 4);
641 if (code
== ENUMERAL_TYPE
)
642 print_node (file
, "values", TYPE_VALUES (node
), indent
+ 4);
643 else if (code
== ARRAY_TYPE
)
644 print_node (file
, "domain", TYPE_DOMAIN (node
), indent
+ 4);
645 else if (code
== VECTOR_TYPE
)
646 fprintf (file
, " nunits %d", (int) TYPE_VECTOR_SUBPARTS (node
));
647 else if (code
== RECORD_TYPE
648 || code
== UNION_TYPE
649 || code
== QUAL_UNION_TYPE
)
650 print_node (file
, "fields", TYPE_FIELDS (node
), indent
+ 4);
651 else if (code
== FUNCTION_TYPE
652 || code
== METHOD_TYPE
)
654 if (TYPE_METHOD_BASETYPE (node
))
655 print_node_brief (file
, "method basetype",
656 TYPE_METHOD_BASETYPE (node
), indent
+ 4);
657 print_node (file
, "arg-types", TYPE_ARG_TYPES (node
), indent
+ 4);
659 else if (code
== OFFSET_TYPE
)
660 print_node_brief (file
, "basetype", TYPE_OFFSET_BASETYPE (node
),
663 if (TYPE_CONTEXT (node
))
664 print_node_brief (file
, "context", TYPE_CONTEXT (node
), indent
+ 4);
666 lang_hooks
.print_type (file
, node
, indent
);
668 if (TYPE_POINTER_TO (node
) || TREE_CHAIN (node
))
669 indent_to (file
, indent
+ 3);
671 print_node_brief (file
, "pointer_to_this", TYPE_POINTER_TO (node
),
673 print_node_brief (file
, "reference_to_this", TYPE_REFERENCE_TO (node
),
675 print_node_brief (file
, "chain", TREE_CHAIN (node
), indent
+ 4);
685 if (code
== BIND_EXPR
)
687 print_node (file
, "vars", TREE_OPERAND (node
, 0), indent
+ 4);
688 print_node (file
, "body", TREE_OPERAND (node
, 1), indent
+ 4);
689 print_node (file
, "block", TREE_OPERAND (node
, 2), indent
+ 4);
692 if (code
== CALL_EXPR
)
694 call_expr_arg_iterator iter
;
696 print_node (file
, "fn", CALL_EXPR_FN (node
), indent
+ 4);
697 print_node (file
, "static_chain", CALL_EXPR_STATIC_CHAIN (node
),
700 FOR_EACH_CALL_EXPR_ARG (arg
, iter
, node
)
703 sprintf (temp
, "arg %d", i
);
704 print_node (file
, temp
, arg
, indent
+ 4);
710 len
= TREE_OPERAND_LENGTH (node
);
712 for (i
= 0; i
< len
; i
++)
716 sprintf (temp
, "arg %d", i
);
717 print_node (file
, temp
, TREE_OPERAND (node
, i
), indent
+ 4);
720 print_node (file
, "chain", TREE_CHAIN (node
), indent
+ 4);
724 case tcc_exceptional
:
728 if (TREE_OVERFLOW (node
))
729 fprintf (file
, " overflow");
732 if (TREE_INT_CST_HIGH (node
) == 0)
733 fprintf (file
, HOST_WIDE_INT_PRINT_UNSIGNED
,
734 TREE_INT_CST_LOW (node
));
735 else if (TREE_INT_CST_HIGH (node
) == -1
736 && TREE_INT_CST_LOW (node
) != 0)
737 fprintf (file
, "-" HOST_WIDE_INT_PRINT_UNSIGNED
,
738 -TREE_INT_CST_LOW (node
));
740 fprintf (file
, HOST_WIDE_INT_PRINT_DOUBLE_HEX
,
741 (unsigned HOST_WIDE_INT
) TREE_INT_CST_HIGH (node
),
742 (unsigned HOST_WIDE_INT
) TREE_INT_CST_LOW (node
));
749 if (TREE_OVERFLOW (node
))
750 fprintf (file
, " overflow");
752 d
= TREE_REAL_CST (node
);
753 if (REAL_VALUE_ISINF (d
))
754 fprintf (file
, REAL_VALUE_NEGATIVE (d
) ? " -Inf" : " Inf");
755 else if (REAL_VALUE_ISNAN (d
))
756 fprintf (file
, " Nan");
760 real_to_decimal (string
, &d
, sizeof (string
), 0, 1);
761 fprintf (file
, " %s", string
);
771 if (TREE_OVERFLOW (node
))
772 fprintf (file
, " overflow");
774 f
= TREE_FIXED_CST (node
);
775 fixed_to_decimal (string
, &f
, sizeof (string
));
776 fprintf (file
, " %s", string
);
782 tree vals
= TREE_VECTOR_CST_ELTS (node
);
788 for (link
= vals
; link
; link
= TREE_CHAIN (link
), ++i
)
790 sprintf (buf
, "elt%d: ", i
);
791 print_node (file
, buf
, TREE_VALUE (link
), indent
+ 4);
797 print_node (file
, "real", TREE_REALPART (node
), indent
+ 4);
798 print_node (file
, "imag", TREE_IMAGPART (node
), indent
+ 4);
803 const char *p
= TREE_STRING_POINTER (node
);
804 int i
= TREE_STRING_LENGTH (node
);
809 if (ch
>= ' ' && ch
< 127)
812 fprintf(file
, "\\%03o", ch
& 0xFF);
816 /* Print the chain at second level. */
818 print_node (file
, "chain", TREE_CHAIN (node
), indent
+ 4);
820 print_node_brief (file
, "chain", TREE_CHAIN (node
), indent
+ 4);
823 case IDENTIFIER_NODE
:
824 lang_hooks
.print_identifier (file
, node
, indent
);
828 print_node (file
, "purpose", TREE_PURPOSE (node
), indent
+ 4);
829 print_node (file
, "value", TREE_VALUE (node
), indent
+ 4);
830 print_node (file
, "chain", TREE_CHAIN (node
), indent
+ 4);
834 len
= TREE_VEC_LENGTH (node
);
835 for (i
= 0; i
< len
; i
++)
836 if (TREE_VEC_ELT (node
, i
))
839 sprintf (temp
, "elt %d", i
);
840 indent_to (file
, indent
+ 4);
841 print_node_brief (file
, temp
, TREE_VEC_ELT (node
, i
), 0);
847 unsigned HOST_WIDE_INT cnt
;
849 len
= VEC_length (constructor_elt
, CONSTRUCTOR_ELTS (node
));
850 fprintf (file
, " lngt %d", len
);
851 FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (node
),
854 print_node (file
, "idx", index
, indent
+ 4);
855 print_node (file
, "val", value
, indent
+ 4);
861 dump_addr (file
, " head ", node
->stmt_list
.head
);
862 dump_addr (file
, " tail ", node
->stmt_list
.tail
);
863 fprintf (file
, " stmts");
865 tree_stmt_iterator i
;
866 for (i
= tsi_start (node
); !tsi_end_p (i
); tsi_next (&i
))
868 /* Not printing the addresses of the (not-a-tree)
869 'struct tree_stmt_list_node's. */
870 dump_addr (file
, " ", tsi_stmt (i
));
872 fprintf (file
, "\n");
873 for (i
= tsi_start (node
); !tsi_end_p (i
); tsi_next (&i
))
875 /* Not printing the addresses of the (not-a-tree)
876 'struct tree_stmt_list_node's. */
877 print_node (file
, "stmt", tsi_stmt (i
), indent
+ 4);
880 print_node (file
, "chain", TREE_CHAIN (node
), indent
+ 4);
884 print_node (file
, "vars", BLOCK_VARS (node
), indent
+ 4);
885 print_node (file
, "supercontext", BLOCK_SUPERCONTEXT (node
),
887 print_node (file
, "subblocks", BLOCK_SUBBLOCKS (node
), indent
+ 4);
888 print_node (file
, "chain", BLOCK_CHAIN (node
), indent
+ 4);
889 print_node (file
, "abstract_origin",
890 BLOCK_ABSTRACT_ORIGIN (node
), indent
+ 4);
894 print_node_brief (file
, "var", SSA_NAME_VAR (node
), indent
+ 4);
895 fprintf (file
, "def_stmt ");
896 print_gimple_stmt (file
, SSA_NAME_DEF_STMT (node
), indent
+ 4, 0);
898 indent_to (file
, indent
+ 4);
899 fprintf (file
, "version %u", SSA_NAME_VERSION (node
));
900 if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (node
))
901 fprintf (file
, " in-abnormal-phi");
902 if (SSA_NAME_IN_FREE_LIST (node
))
903 fprintf (file
, " in-free-list");
905 if (SSA_NAME_PTR_INFO (node
))
907 indent_to (file
, indent
+ 3);
908 if (SSA_NAME_PTR_INFO (node
))
909 dump_addr (file
, " ptr-info ", SSA_NAME_PTR_INFO (node
));
916 fprintf (file
, " %s",
917 omp_clause_code_name
[OMP_CLAUSE_CODE (node
)]);
918 for (i
= 0; i
< omp_clause_num_ops
[OMP_CLAUSE_CODE (node
)]; i
++)
920 indent_to (file
, indent
+ 4);
921 fprintf (file
, "op %d:", i
);
922 print_node_brief (file
, "", OMP_CLAUSE_OPERAND (node
, i
), 0);
927 case OPTIMIZATION_NODE
:
928 cl_optimization_print (file
, indent
+ 4, TREE_OPTIMIZATION (node
));
931 case TARGET_OPTION_NODE
:
932 cl_target_option_print (file
, indent
+ 4, TREE_TARGET_OPTION (node
));
935 fprintf (file
, " imported declaration");
936 print_node_brief (file
, "associated declaration",
937 IMPORTED_DECL_ASSOCIATED_DECL (node
),
942 if (EXCEPTIONAL_CLASS_P (node
))
943 lang_hooks
.print_xnode (file
, node
, indent
);
950 if (EXPR_HAS_LOCATION (node
))
952 expanded_location xloc
= expand_location (EXPR_LOCATION (node
));
953 indent_to (file
, indent
+4);
954 fprintf (file
, "%s:%d:%d", xloc
.file
, xloc
.line
, xloc
.column
);