]> gcc.gnu.org Git - gcc.git/blame - gcc/print-tree.c
Update FSF address.
[gcc.git] / gcc / print-tree.c
CommitLineData
5e6908ea 1/* Prints out tree in human readable form - GCC
4e3f4812 2 Copyright (C) 1990, 1991, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
613c5cd0 3 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
52eeef3a 4
1322177d 5This file is part of GCC.
52eeef3a 6
1322177d
LB
7GCC is free software; you can redistribute it and/or modify it under
8the terms of the GNU General Public License as published by the Free
9Software Foundation; either version 2, or (at your option) any later
10version.
52eeef3a 11
1322177d
LB
12GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13WARRANTY; without even the implied warranty of MERCHANTABILITY or
14FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15for more details.
52eeef3a
RS
16
17You should have received a copy of the GNU General Public License
1322177d
LB
18along with GCC; see the file COPYING. If not, write to the Free
19Software Foundation, 59 Temple Place - Suite 330, Boston, MA
2002111-1307, USA. */
52eeef3a
RS
21
22
23#include "config.h"
670ee920 24#include "system.h"
4977bab6
ZW
25#include "coretypes.h"
26#include "tm.h"
52eeef3a 27#include "tree.h"
11ad4784 28#include "real.h"
a3770a81 29#include "ggc.h"
5d69f816 30#include "langhooks.h"
8df673d7 31#include "tree-iterator.h"
52eeef3a 32
52eeef3a
RS
33/* Define the hash table of nodes already seen.
34 Such nodes are not repeated; brief cross-references are used. */
35
36#define HASH_SIZE 37
37
38struct bucket
39{
40 tree node;
41 struct bucket *next;
42};
43
44static struct bucket **table;
45
46/* Print the node NODE on standard error, for debugging.
47 Most nodes referred to by this one are printed recursively
48 down to a depth of six. */
49
50void
0c20a65f 51debug_tree (tree node)
52eeef3a 52{
703ad42b 53 table = xcalloc (HASH_SIZE, sizeof (struct bucket *));
52eeef3a 54 print_node (stderr, "", node, 0);
046e4e36 55 free (table);
52eeef3a 56 table = 0;
046e4e36 57 putc ('\n', stderr);
52eeef3a
RS
58}
59
60/* Print a node in brief fashion, with just the code, address and name. */
61
62void
0c20a65f 63print_node_brief (FILE *file, const char *prefix, tree node, int indent)
52eeef3a 64{
6615c446 65 enum tree_code_class class;
52eeef3a
RS
66
67 if (node == 0)
68 return;
69
70 class = TREE_CODE_CLASS (TREE_CODE (node));
71
72 /* Always print the slot this node is in, and its code, address and
73 name if any. */
74 if (indent > 0)
75 fprintf (file, " ");
75b6f3fd
KG
76 fprintf (file, "%s <%s " HOST_PTR_PRINTF,
77 prefix, tree_code_name[(int) TREE_CODE (node)], (char *) node);
52eeef3a 78
6615c446 79 if (class == tcc_declaration)
52eeef3a
RS
80 {
81 if (DECL_NAME (node))
82 fprintf (file, " %s", IDENTIFIER_POINTER (DECL_NAME (node)));
4961152d
RK
83 else if (TREE_CODE (node) == LABEL_DECL
84 && LABEL_DECL_UID (node) != -1)
85 fprintf (file, " L." HOST_WIDE_INT_PRINT_DEC, LABEL_DECL_UID (node));
86 else
87 fprintf (file, " %c.%u", TREE_CODE (node) == CONST_DECL ? 'C' : 'D',
88 DECL_UID (node));
52eeef3a 89 }
6615c446 90 else if (class == tcc_type)
52eeef3a
RS
91 {
92 if (TYPE_NAME (node))
93 {
94 if (TREE_CODE (TYPE_NAME (node)) == IDENTIFIER_NODE)
95 fprintf (file, " %s", IDENTIFIER_POINTER (TYPE_NAME (node)));
96 else if (TREE_CODE (TYPE_NAME (node)) == TYPE_DECL
97 && DECL_NAME (TYPE_NAME (node)))
98 fprintf (file, " %s",
99 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (node))));
100 }
101 }
102 if (TREE_CODE (node) == IDENTIFIER_NODE)
103 fprintf (file, " %s", IDENTIFIER_POINTER (node));
f2aca197
RK
104
105 /* We might as well always print the value of an integer or real. */
52eeef3a
RS
106 if (TREE_CODE (node) == INTEGER_CST)
107 {
3e5f8018
RK
108 if (TREE_CONSTANT_OVERFLOW (node))
109 fprintf (file, " overflow");
110
1e66ce77 111 fprintf (file, " ");
52eeef3a 112 if (TREE_INT_CST_HIGH (node) == 0)
1e66ce77 113 fprintf (file, HOST_WIDE_INT_PRINT_UNSIGNED, TREE_INT_CST_LOW (node));
52eeef3a
RS
114 else if (TREE_INT_CST_HIGH (node) == -1
115 && TREE_INT_CST_LOW (node) != 0)
90ff44cf
KG
116 fprintf (file, "-" HOST_WIDE_INT_PRINT_UNSIGNED,
117 -TREE_INT_CST_LOW (node));
52eeef3a 118 else
1e66ce77 119 fprintf (file, HOST_WIDE_INT_PRINT_DOUBLE_HEX,
906c4e36 120 TREE_INT_CST_HIGH (node), TREE_INT_CST_LOW (node));
52eeef3a
RS
121 }
122 if (TREE_CODE (node) == REAL_CST)
123 {
7063dcbe
RK
124 REAL_VALUE_TYPE d;
125
86b38416
RK
126 if (TREE_OVERFLOW (node))
127 fprintf (file, " overflow");
128
7063dcbe 129 d = TREE_REAL_CST (node);
86b38416
RK
130 if (REAL_VALUE_ISINF (d))
131 fprintf (file, " Inf");
132 else if (REAL_VALUE_ISNAN (d))
133 fprintf (file, " Nan");
134 else
135 {
da6eec72
RH
136 char string[60];
137 real_to_decimal (string, &d, sizeof (string), 0, 1);
86b38416
RK
138 fprintf (file, " %s", string);
139 }
52eeef3a
RS
140 }
141
142 fprintf (file, ">");
143}
144
145void
0c20a65f 146indent_to (FILE *file, int column)
52eeef3a
RS
147{
148 int i;
149
150 /* Since this is the long way, indent to desired column. */
151 if (column > 0)
152 fprintf (file, "\n");
153 for (i = 0; i < column; i++)
154 fprintf (file, " ");
155}
156\f
157/* Print the node NODE in full on file FILE, preceded by PREFIX,
158 starting in column INDENT. */
159
160void
0c20a65f 161print_node (FILE *file, const char *prefix, tree node, int indent)
52eeef3a
RS
162{
163 int hash;
164 struct bucket *b;
165 enum machine_mode mode;
6615c446 166 enum tree_code_class class;
52eeef3a 167 int len;
52eeef3a 168 int i;
a281759f 169 expanded_location xloc;
52eeef3a
RS
170
171 if (node == 0)
172 return;
173
174 class = TREE_CODE_CLASS (TREE_CODE (node));
175
176 /* Don't get too deep in nesting. If the user wants to see deeper,
177 it is easy to use the address of a lowest-level node
178 as an argument in another call to debug_tree. */
179
180 if (indent > 24)
181 {
182 print_node_brief (file, prefix, node, indent);
183 return;
184 }
185
6615c446 186 if (indent > 8 && (class == tcc_type || class == tcc_declaration))
52eeef3a
RS
187 {
188 print_node_brief (file, prefix, node, indent);
189 return;
190 }
191
d55d8fc7 192 /* It is unsafe to look at any other fields of an ERROR_MARK node. */
52eeef3a
RS
193 if (TREE_CODE (node) == ERROR_MARK)
194 {
195 print_node_brief (file, prefix, node, indent);
196 return;
197 }
198
7bcac048 199 hash = ((unsigned long) node) % HASH_SIZE;
52eeef3a
RS
200
201 /* If node is in the table, just mention its address. */
202 for (b = table[hash]; b; b = b->next)
203 if (b->node == node)
204 {
205 print_node_brief (file, prefix, node, indent);
206 return;
207 }
208
209 /* Add this node to the table. */
703ad42b 210 b = xmalloc (sizeof (struct bucket));
52eeef3a
RS
211 b->node = node;
212 b->next = table[hash];
213 table[hash] = b;
214
215 /* Indent to the specified column, since this is the long form. */
216 indent_to (file, indent);
217
218 /* Print the slot this node is in, and its code, and address. */
75b6f3fd
KG
219 fprintf (file, "%s <%s " HOST_PTR_PRINTF,
220 prefix, tree_code_name[(int) TREE_CODE (node)], (void *) node);
52eeef3a
RS
221
222 /* Print the name, if any. */
6615c446 223 if (class == tcc_declaration)
52eeef3a
RS
224 {
225 if (DECL_NAME (node))
226 fprintf (file, " %s", IDENTIFIER_POINTER (DECL_NAME (node)));
4961152d
RK
227 else if (TREE_CODE (node) == LABEL_DECL
228 && LABEL_DECL_UID (node) != -1)
229 fprintf (file, " L." HOST_WIDE_INT_PRINT_DEC, LABEL_DECL_UID (node));
230 else
231 fprintf (file, " %c.%u", TREE_CODE (node) == CONST_DECL ? 'C' : 'D',
232 DECL_UID (node));
52eeef3a 233 }
6615c446 234 else if (class == tcc_type)
52eeef3a
RS
235 {
236 if (TYPE_NAME (node))
237 {
238 if (TREE_CODE (TYPE_NAME (node)) == IDENTIFIER_NODE)
239 fprintf (file, " %s", IDENTIFIER_POINTER (TYPE_NAME (node)));
240 else if (TREE_CODE (TYPE_NAME (node)) == TYPE_DECL
241 && DECL_NAME (TYPE_NAME (node)))
242 fprintf (file, " %s",
243 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (node))));
244 }
245 }
246 if (TREE_CODE (node) == IDENTIFIER_NODE)
247 fprintf (file, " %s", IDENTIFIER_POINTER (node));
248
249 if (TREE_CODE (node) == INTEGER_CST)
250 {
251 if (indent <= 4)
252 print_node_brief (file, "type", TREE_TYPE (node), indent + 4);
253 }
254 else
255 {
256 print_node (file, "type", TREE_TYPE (node), indent + 4);
257 if (TREE_TYPE (node))
258 indent_to (file, indent + 3);
52eeef3a
RS
259 }
260
4f976745 261 if (!TYPE_P (node) && TREE_SIDE_EFFECTS (node))
52eeef3a 262 fputs (" side-effects", file);
4f976745
RK
263
264 if (TYPE_P (node) ? TYPE_READONLY (node) : TREE_READONLY (node))
52eeef3a 265 fputs (" readonly", file);
4f976745 266 if (!TYPE_P (node) && TREE_CONSTANT (node))
52eeef3a 267 fputs (" constant", file);
4961152d
RK
268 else if (TYPE_P (node) && TYPE_SIZES_GIMPLIFIED (node))
269 fputs (" sizes-gimplified", file);
270
6de9cd9a
DN
271 if (TREE_INVARIANT (node))
272 fputs (" invariant", file);
52eeef3a
RS
273 if (TREE_ADDRESSABLE (node))
274 fputs (" addressable", file);
275 if (TREE_THIS_VOLATILE (node))
276 fputs (" volatile", file);
52eeef3a
RS
277 if (TREE_ASM_WRITTEN (node))
278 fputs (" asm_written", file);
279 if (TREE_USED (node))
280 fputs (" used", file);
12a22e76 281 if (TREE_NOTHROW (node))
1e2d4dc1 282 fputs (TYPE_P (node) ? " align-ok" : " nothrow", file);
52eeef3a
RS
283 if (TREE_PUBLIC (node))
284 fputs (" public", file);
86fff623
MM
285 if (TREE_PRIVATE (node))
286 fputs (" private", file);
287 if (TREE_PROTECTED (node))
288 fputs (" protected", file);
52eeef3a
RS
289 if (TREE_STATIC (node))
290 fputs (" static", file);
e23bd218
IR
291 if (TREE_DEPRECATED (node))
292 fputs (" deprecated", file);
6de9cd9a
DN
293 if (TREE_VISITED (node))
294 fputs (" visited", file);
52eeef3a
RS
295 if (TREE_LANG_FLAG_0 (node))
296 fputs (" tree_0", file);
297 if (TREE_LANG_FLAG_1 (node))
298 fputs (" tree_1", file);
299 if (TREE_LANG_FLAG_2 (node))
300 fputs (" tree_2", file);
301 if (TREE_LANG_FLAG_3 (node))
302 fputs (" tree_3", file);
303 if (TREE_LANG_FLAG_4 (node))
304 fputs (" tree_4", file);
305 if (TREE_LANG_FLAG_5 (node))
306 fputs (" tree_5", file);
307 if (TREE_LANG_FLAG_6 (node))
308 fputs (" tree_6", file);
309
310 /* DECL_ nodes have additional attributes. */
311
312 switch (TREE_CODE_CLASS (TREE_CODE (node)))
313 {
6615c446 314 case tcc_declaration:
52eeef3a
RS
315 mode = DECL_MODE (node);
316
a150de29
RK
317 if (DECL_UNSIGNED (node))
318 fputs (" unsigned", file);
96a31ab8
RK
319 if (DECL_IGNORED_P (node))
320 fputs (" ignored", file);
321 if (DECL_ABSTRACT (node))
322 fputs (" abstract", file);
323 if (DECL_IN_SYSTEM_HEADER (node))
324 fputs (" in_system_header", file);
325 if (DECL_COMMON (node))
326 fputs (" common", file);
216d5cdd 327 if (DECL_EXTERNAL (node))
52eeef3a 328 fputs (" external", file);
ecb0eece
RH
329 if (DECL_WEAK (node))
330 fputs (" weak", file);
3af78b06
RK
331 if (DECL_REGISTER (node) && TREE_CODE (node) != FIELD_DECL
332 && TREE_CODE (node) != FUNCTION_DECL
333 && TREE_CODE (node) != LABEL_DECL)
52eeef3a 334 fputs (" regdecl", file);
96a31ab8
RK
335 if (DECL_NONLOCAL (node))
336 fputs (" nonlocal", file);
96a31ab8
RK
337
338 if (TREE_CODE (node) == TYPE_DECL && TYPE_DECL_SUPPRESS_DEBUG (node))
788d4ba0 339 fputs (" suppress-debug", file);
96a31ab8 340
b3c3af2f
SB
341 if (TREE_CODE (node) == FUNCTION_DECL && DECL_INLINE (node))
342 fputs (DECL_DECLARED_INLINE_P (node) ? " inline" : " autoinline", file);
96a31ab8
RK
343 if (TREE_CODE (node) == FUNCTION_DECL && DECL_BUILT_IN (node))
344 fputs (" built-in", file);
3af78b06
RK
345 if (TREE_CODE (node) == FUNCTION_DECL && DECL_NO_STATIC_CHAIN (node))
346 fputs (" no-static-chain", file);
96a31ab8 347
17aec3eb
RK
348 if (TREE_CODE (node) == FIELD_DECL && DECL_PACKED (node))
349 fputs (" packed", file);
96a31ab8 350 if (TREE_CODE (node) == FIELD_DECL && DECL_BIT_FIELD (node))
52eeef3a 351 fputs (" bit-field", file);
6732576c
RK
352 if (TREE_CODE (node) == FIELD_DECL && DECL_NONADDRESSABLE_P (node))
353 fputs (" nonaddressable", file);
17aec3eb 354
3af78b06
RK
355 if (TREE_CODE (node) == LABEL_DECL && DECL_ERROR_ISSUED (node))
356 fputs (" error-issued", file);
17aec3eb 357
96a31ab8
RK
358 if (TREE_CODE (node) == VAR_DECL && DECL_IN_TEXT_SECTION (node))
359 fputs (" in-text-section", file);
3d78f2e9
RH
360 if (TREE_CODE (node) == VAR_DECL && DECL_THREAD_LOCAL (node))
361 fputs (" thread-local", file);
96a31ab8 362
17aec3eb
RK
363 if (TREE_CODE (node) == PARM_DECL && DECL_TRANSPARENT_UNION (node))
364 fputs (" transparent-union", file);
365
52eeef3a
RS
366 if (DECL_VIRTUAL_P (node))
367 fputs (" virtual", file);
96a31ab8
RK
368 if (DECL_DEFER_OUTPUT (node))
369 fputs (" defer-output", file);
96a31ab8 370
8e3e233b
DP
371 if (DECL_PRESERVE_P (node))
372 fputs (" preserve", file);
373
52eeef3a
RS
374 if (DECL_LANG_FLAG_0 (node))
375 fputs (" decl_0", file);
376 if (DECL_LANG_FLAG_1 (node))
377 fputs (" decl_1", file);
378 if (DECL_LANG_FLAG_2 (node))
379 fputs (" decl_2", file);
380 if (DECL_LANG_FLAG_3 (node))
381 fputs (" decl_3", file);
382 if (DECL_LANG_FLAG_4 (node))
383 fputs (" decl_4", file);
384 if (DECL_LANG_FLAG_5 (node))
385 fputs (" decl_5", file);
386 if (DECL_LANG_FLAG_6 (node))
387 fputs (" decl_6", file);
388 if (DECL_LANG_FLAG_7 (node))
389 fputs (" decl_7", file);
390
cf403648 391 fprintf (file, " %s", GET_MODE_NAME (mode));
a281759f
PB
392 xloc = expand_location (DECL_SOURCE_LOCATION (node));
393 fprintf (file, " file %s line %d", xloc.file, xloc.line);
52eeef3a
RS
394
395 print_node (file, "size", DECL_SIZE (node), indent + 4);
06ceef4e 396 print_node (file, "unit size", DECL_SIZE_UNIT (node), indent + 4);
6a4d6760 397
9df2c88c
RK
398 if (TREE_CODE (node) != FUNCTION_DECL
399 || DECL_INLINE (node) || DECL_BUILT_IN (node))
400 indent_to (file, indent + 3);
401
c0920bf9 402 if (TREE_CODE (node) != FUNCTION_DECL)
aa4661f8 403 {
f2aca197
RK
404 if (DECL_USER_ALIGN (node))
405 fprintf (file, " user");
406
aa4661f8
RK
407 fprintf (file, " align %d", DECL_ALIGN (node));
408 if (TREE_CODE (node) == FIELD_DECL)
90ff44cf
KG
409 fprintf (file, " offset_align " HOST_WIDE_INT_PRINT_UNSIGNED,
410 DECL_OFFSET_ALIGN (node));
aa4661f8 411 }
c0920bf9 412 else if (DECL_BUILT_IN (node))
7d492372
DD
413 {
414 if (DECL_BUILT_IN_CLASS (node) == BUILT_IN_MD)
415 fprintf (file, " built-in BUILT_IN_MD %d", DECL_FUNCTION_CODE (node));
416 else
417 fprintf (file, " built-in %s:%s",
418 built_in_class_names[(int) DECL_BUILT_IN_CLASS (node)],
419 built_in_names[(int) DECL_FUNCTION_CODE (node)]);
420 }
9df2c88c 421
3932261a 422 if (DECL_POINTER_ALIAS_SET_KNOWN_P (node))
90ff44cf
KG
423 fprintf (file, " alias set " HOST_WIDE_INT_PRINT_DEC,
424 DECL_POINTER_ALIAS_SET (node));
9df2c88c
RK
425
426 if (TREE_CODE (node) == FIELD_DECL)
770ae6cc
RK
427 {
428 print_node (file, "offset", DECL_FIELD_OFFSET (node), indent + 4);
429 print_node (file, "bit offset", DECL_FIELD_BIT_OFFSET (node),
430 indent + 4);
431 }
9df2c88c 432
52eeef3a 433 print_node_brief (file, "context", DECL_CONTEXT (node), indent + 4);
91d231cb
JM
434 print_node_brief (file, "attributes",
435 DECL_ATTRIBUTES (node), indent + 4);
c5caa350
CH
436 print_node_brief (file, "abstract_origin",
437 DECL_ABSTRACT_ORIGIN (node), indent + 4);
52eeef3a
RS
438
439 print_node (file, "arguments", DECL_ARGUMENTS (node), indent + 4);
17aec3eb 440 print_node (file, "result", DECL_RESULT_FLD (node), indent + 4);
52eeef3a
RS
441 print_node_brief (file, "initial", DECL_INITIAL (node), indent + 4);
442
ae2bcd98 443 lang_hooks.print_decl (file, node, indent);
52eeef3a 444
19e7881c 445 if (DECL_RTL_SET_P (node))
52eeef3a
RS
446 {
447 indent_to (file, indent + 4);
448 print_rtl (file, DECL_RTL (node));
449 }
450
df10e9ec 451 if (TREE_CODE (node) == PARM_DECL)
17aec3eb 452 {
df10e9ec
RK
453 print_node (file, "arg-type", DECL_ARG_TYPE (node), indent + 4);
454 print_node (file, "arg-type-as-written",
455 DECL_ARG_TYPE_AS_WRITTEN (node), indent + 4);
456
457 if (DECL_INCOMING_RTL (node) != 0)
458 {
459 indent_to (file, indent + 4);
460 fprintf (file, "incoming-rtl ");
461 print_rtl (file, DECL_INCOMING_RTL (node));
462 }
17aec3eb
RK
463 }
464 else if (TREE_CODE (node) == FUNCTION_DECL
1da326c3 465 && DECL_STRUCT_FUNCTION (node) != 0)
52eeef3a
RS
466 {
467 indent_to (file, indent + 4);
75b6f3fd 468 fprintf (file, "saved-insns " HOST_PTR_PRINTF,
1da326c3 469 (void *) DECL_STRUCT_FUNCTION (node));
52eeef3a
RS
470 }
471
472 /* Print the decl chain only if decl is at second level. */
473 if (indent == 4)
474 print_node (file, "chain", TREE_CHAIN (node), indent + 4);
475 else
476 print_node_brief (file, "chain", TREE_CHAIN (node), indent + 4);
477 break;
478
6615c446 479 case tcc_type:
a150de29
RK
480 if (TYPE_UNSIGNED (node))
481 fputs (" unsigned", file);
482
0cba764e
RK
483 /* The no-force-blk flag is used for different things in
484 different types. */
485 if ((TREE_CODE (node) == RECORD_TYPE
486 || TREE_CODE (node) == UNION_TYPE
487 || TREE_CODE (node) == QUAL_UNION_TYPE)
488 && TYPE_NO_FORCE_BLK (node))
96a31ab8 489 fputs (" no-force-blk", file);
0cba764e
RK
490 else if (TREE_CODE (node) == INTEGER_TYPE
491 && TYPE_IS_SIZETYPE (node))
492 fputs (" sizetype", file);
493 else if (TREE_CODE (node) == FUNCTION_TYPE
494 && TYPE_RETURNS_STACK_DEPRESSED (node))
495 fputs (" returns-stack-depressed", file);
496
96a31ab8
RK
497 if (TYPE_STRING_FLAG (node))
498 fputs (" string-flag", file);
499 if (TYPE_NEEDS_CONSTRUCTING (node))
500 fputs (" needs-constructing", file);
0cba764e 501
5667abce
ZW
502 /* The transparent-union flag is used for different things in
503 different nodes. */
0cba764e
RK
504 if (TREE_CODE (node) == UNION_TYPE && TYPE_TRANSPARENT_UNION (node))
505 fputs (" transparent-union", file);
506 else if (TREE_CODE (node) == ARRAY_TYPE
507 && TYPE_NONALIASED_COMPONENT (node))
508 fputs (" nonaliased-component", file);
0cba764e 509
3fc341ac
RK
510 if (TYPE_PACKED (node))
511 fputs (" packed", file);
96a31ab8 512
d1df930b
DN
513 if (TYPE_RESTRICT (node))
514 fputs (" restrict", file);
515
52eeef3a
RS
516 if (TYPE_LANG_FLAG_0 (node))
517 fputs (" type_0", file);
518 if (TYPE_LANG_FLAG_1 (node))
519 fputs (" type_1", file);
520 if (TYPE_LANG_FLAG_2 (node))
521 fputs (" type_2", file);
522 if (TYPE_LANG_FLAG_3 (node))
523 fputs (" type_3", file);
524 if (TYPE_LANG_FLAG_4 (node))
525 fputs (" type_4", file);
526 if (TYPE_LANG_FLAG_5 (node))
527 fputs (" type_5", file);
528 if (TYPE_LANG_FLAG_6 (node))
529 fputs (" type_6", file);
530
531 mode = TYPE_MODE (node);
cf403648 532 fprintf (file, " %s", GET_MODE_NAME (mode));
52eeef3a
RS
533
534 print_node (file, "size", TYPE_SIZE (node), indent + 4);
06ceef4e 535 print_node (file, "unit size", TYPE_SIZE_UNIT (node), indent + 4);
52eeef3a
RS
536 indent_to (file, indent + 3);
537
f2aca197
RK
538 if (TYPE_USER_ALIGN (node))
539 fprintf (file, " user");
540
90ff44cf
KG
541 fprintf (file, " align %d symtab %d alias set " HOST_WIDE_INT_PRINT_DEC,
542 TYPE_ALIGN (node), TYPE_SYMTAB_ADDRESS (node),
543 TYPE_ALIAS_SET (node));
52eeef3a 544
0c7f6f66
RK
545 print_node (file, "attributes", TYPE_ATTRIBUTES (node), indent + 4);
546
f2aca197 547 if (INTEGRAL_TYPE_P (node) || TREE_CODE (node) == REAL_TYPE)
52eeef3a
RS
548 {
549 fprintf (file, " precision %d", TYPE_PRECISION (node));
f2aca197
RK
550 print_node_brief (file, "min", TYPE_MIN_VALUE (node), indent + 4);
551 print_node_brief (file, "max", TYPE_MAX_VALUE (node), indent + 4);
52eeef3a 552 }
f2aca197
RK
553
554 if (TREE_CODE (node) == ENUMERAL_TYPE)
555 print_node (file, "values", TYPE_VALUES (node), indent + 4);
08f2586c 556 else if (TREE_CODE (node) == ARRAY_TYPE)
f2aca197 557 print_node (file, "domain", TYPE_DOMAIN (node), indent + 4);
26277d41
PB
558 else if (TREE_CODE (node) == VECTOR_TYPE)
559 fprintf (file, " nunits %d", (int) TYPE_VECTOR_SUBPARTS (node));
c1b98a95
RK
560 else if (TREE_CODE (node) == RECORD_TYPE
561 || TREE_CODE (node) == UNION_TYPE
562 || TREE_CODE (node) == QUAL_UNION_TYPE)
52eeef3a 563 print_node (file, "fields", TYPE_FIELDS (node), indent + 4);
0cba764e
RK
564 else if (TREE_CODE (node) == FUNCTION_TYPE
565 || TREE_CODE (node) == METHOD_TYPE)
52eeef3a
RS
566 {
567 if (TYPE_METHOD_BASETYPE (node))
0cba764e
RK
568 print_node_brief (file, "method basetype",
569 TYPE_METHOD_BASETYPE (node), indent + 4);
52eeef3a
RS
570 print_node (file, "arg-types", TYPE_ARG_TYPES (node), indent + 4);
571 }
e7b9b18e
JM
572 else if (TREE_CODE (node) == OFFSET_TYPE)
573 print_node_brief (file, "basetype", TYPE_OFFSET_BASETYPE (node),
574 indent + 4);
f2aca197 575
52eeef3a
RS
576 if (TYPE_CONTEXT (node))
577 print_node_brief (file, "context", TYPE_CONTEXT (node), indent + 4);
578
ae2bcd98 579 lang_hooks.print_type (file, node, indent);
52eeef3a
RS
580
581 if (TYPE_POINTER_TO (node) || TREE_CHAIN (node))
582 indent_to (file, indent + 3);
f2aca197
RK
583
584 print_node_brief (file, "pointer_to_this", TYPE_POINTER_TO (node),
585 indent + 4);
586 print_node_brief (file, "reference_to_this", TYPE_REFERENCE_TO (node),
587 indent + 4);
52eeef3a
RS
588 print_node_brief (file, "chain", TREE_CHAIN (node), indent + 4);
589 break;
590
6615c446
JO
591 case tcc_expression:
592 case tcc_comparison:
593 case tcc_unary:
594 case tcc_binary:
595 case tcc_reference:
596 case tcc_statement:
a150de29
RK
597 if (TREE_CODE (node) == BIT_FIELD_REF && BIT_FIELD_REF_UNSIGNED (node))
598 fputs (" unsigned", file);
0a6969ad 599 if (TREE_CODE (node) == BIND_EXPR)
52eeef3a 600 {
52eeef3a
RS
601 print_node (file, "vars", TREE_OPERAND (node, 0), indent + 4);
602 print_node (file, "body", TREE_OPERAND (node, 1), indent + 4);
bf1c6940 603 print_node (file, "block", TREE_OPERAND (node, 2), indent + 4);
e643155b 604 break;
52eeef3a
RS
605 }
606
8d5e6e25
RK
607 len = TREE_CODE_LENGTH (TREE_CODE (node));
608
52eeef3a
RS
609 for (i = 0; i < len; i++)
610 {
ac1b13f4 611 char temp[10];
52eeef3a 612
ac1b13f4
KH
613 sprintf (temp, "arg %d", i);
614 print_node (file, temp, TREE_OPERAND (node, i), indent + 4);
52eeef3a 615 }
bf1e5319 616
9c2c54dc 617 print_node (file, "chain", TREE_CHAIN (node), indent + 4);
52eeef3a
RS
618 break;
619
6615c446
JO
620 case tcc_constant:
621 case tcc_exceptional:
52eeef3a
RS
622 switch (TREE_CODE (node))
623 {
624 case INTEGER_CST:
3e5f8018
RK
625 if (TREE_CONSTANT_OVERFLOW (node))
626 fprintf (file, " overflow");
627
1e66ce77 628 fprintf (file, " ");
52eeef3a 629 if (TREE_INT_CST_HIGH (node) == 0)
1e66ce77 630 fprintf (file, HOST_WIDE_INT_PRINT_UNSIGNED,
910d1693 631 TREE_INT_CST_LOW (node));
52eeef3a
RS
632 else if (TREE_INT_CST_HIGH (node) == -1
633 && TREE_INT_CST_LOW (node) != 0)
90ff44cf
KG
634 fprintf (file, "-" HOST_WIDE_INT_PRINT_UNSIGNED,
635 -TREE_INT_CST_LOW (node));
52eeef3a 636 else
1e66ce77 637 fprintf (file, HOST_WIDE_INT_PRINT_DOUBLE_HEX,
906c4e36 638 TREE_INT_CST_HIGH (node), TREE_INT_CST_LOW (node));
52eeef3a
RS
639 break;
640
641 case REAL_CST:
52eeef3a 642 {
7063dcbe
RK
643 REAL_VALUE_TYPE d;
644
86b38416
RK
645 if (TREE_OVERFLOW (node))
646 fprintf (file, " overflow");
647
7063dcbe 648 d = TREE_REAL_CST (node);
86b38416
RK
649 if (REAL_VALUE_ISINF (d))
650 fprintf (file, " Inf");
651 else if (REAL_VALUE_ISNAN (d))
652 fprintf (file, " Nan");
653 else
654 {
da6eec72
RH
655 char string[64];
656 real_to_decimal (string, &d, sizeof (string), 0, 1);
86b38416
RK
657 fprintf (file, " %s", string);
658 }
52eeef3a 659 }
52eeef3a
RS
660 break;
661
69ef87e2
AH
662 case VECTOR_CST:
663 {
664 tree vals = TREE_VECTOR_CST_ELTS (node);
665 char buf[10];
666 tree link;
667 int i;
668
669 i = 0;
670 for (link = vals; link; link = TREE_CHAIN (link), ++i)
671 {
672 sprintf (buf, "elt%d: ", i);
673 print_node (file, buf, TREE_VALUE (link), indent + 4);
674 }
675 }
676 break;
677
52eeef3a
RS
678 case COMPLEX_CST:
679 print_node (file, "real", TREE_REALPART (node), indent + 4);
680 print_node (file, "imag", TREE_IMAGPART (node), indent + 4);
681 break;
682
683 case STRING_CST:
90389422
PB
684 {
685 const char *p = TREE_STRING_POINTER (node);
686 int i = TREE_STRING_LENGTH (node);
687 fputs (" \"", file);
688 while (--i >= 0)
689 {
690 char ch = *p++;
691 if (ch >= ' ' && ch < 127)
692 putc (ch, file);
693 else
694 fprintf(file, "\\%03o", ch & 0xFF);
695 }
696 fputc ('\"', file);
697 }
28d10cea
RS
698 /* Print the chain at second level. */
699 if (indent == 4)
700 print_node (file, "chain", TREE_CHAIN (node), indent + 4);
701 else
702 print_node_brief (file, "chain", TREE_CHAIN (node), indent + 4);
52eeef3a
RS
703 break;
704
705 case IDENTIFIER_NODE:
ae2bcd98 706 lang_hooks.print_identifier (file, node, indent);
52eeef3a
RS
707 break;
708
709 case TREE_LIST:
710 print_node (file, "purpose", TREE_PURPOSE (node), indent + 4);
711 print_node (file, "value", TREE_VALUE (node), indent + 4);
712 print_node (file, "chain", TREE_CHAIN (node), indent + 4);
713 break;
714
715 case TREE_VEC:
716 len = TREE_VEC_LENGTH (node);
717 for (i = 0; i < len; i++)
3629f741
JW
718 if (TREE_VEC_ELT (node, i))
719 {
720 char temp[10];
721 sprintf (temp, "elt %d", i);
722 indent_to (file, indent + 4);
723 print_node_brief (file, temp, TREE_VEC_ELT (node, i), 0);
724 }
52eeef3a
RS
725 break;
726
8df673d7
SH
727 case STATEMENT_LIST:
728 fprintf (file, " head " HOST_PTR_PRINTF " tail " HOST_PTR_PRINTF " stmts",
729 (void *) node->stmt_list.head, (void *) node->stmt_list.tail);
730 {
731 tree_stmt_iterator i;
732 for (i = tsi_start (node); !tsi_end_p (i); tsi_next (&i))
733 {
734 /* Not printing the addresses of the (not-a-tree)
735 'struct tree_stmt_list_node's. */
736 fprintf (file, " " HOST_PTR_PRINTF, (void *)tsi_stmt (i));
737 }
738 fprintf (file, "\n");
739 for (i = tsi_start (node); !tsi_end_p (i); tsi_next (&i))
740 {
741 /* Not printing the addresses of the (not-a-tree)
742 'struct tree_stmt_list_node's. */
743 print_node (file, "stmt", tsi_stmt (i), indent + 4);
744 }
745 }
746 print_node (file, "chain", TREE_CHAIN (node), indent + 4);
747 break;
748
90afe2c9
ZW
749 case BLOCK:
750 print_node (file, "vars", BLOCK_VARS (node), indent + 4);
751 print_node (file, "supercontext", BLOCK_SUPERCONTEXT (node),
752 indent + 4);
753 print_node (file, "subblocks", BLOCK_SUBBLOCKS (node), indent + 4);
754 print_node (file, "chain", BLOCK_CHAIN (node), indent + 4);
755 print_node (file, "abstract_origin",
756 BLOCK_ABSTRACT_ORIGIN (node), indent + 4);
757 break;
758
018479fb
RH
759 case SSA_NAME:
760 print_node_brief (file, "var", SSA_NAME_VAR (node), indent + 4);
761 print_node_brief (file, "def_stmt",
762 SSA_NAME_DEF_STMT (node), indent + 4);
763
764 indent_to (file, indent + 4);
765 fprintf (file, "version %u", SSA_NAME_VERSION (node));
766 if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (node))
767 fprintf (file, " in-abnormal-phi");
768 if (SSA_NAME_IN_FREE_LIST (node))
769 fprintf (file, " in-free-list");
770
771 if (SSA_NAME_PTR_INFO (node)
772 || SSA_NAME_VALUE (node)
773 || SSA_NAME_AUX (node))
774 {
775 indent_to (file, indent + 3);
776 if (SSA_NAME_PTR_INFO (node))
ad5dc4b3
RH
777 fprintf (file, " ptr-info %p",
778 (void *) SSA_NAME_PTR_INFO (node));
018479fb 779 if (SSA_NAME_VALUE (node))
ad5dc4b3
RH
780 fprintf (file, " value %p",
781 (void *) SSA_NAME_VALUE (node));
018479fb
RH
782 if (SSA_NAME_AUX (node))
783 fprintf (file, " aux %p", SSA_NAME_AUX (node));
784 }
785 break;
786
0a6969ad 787 default:
6615c446 788 if (EXCEPTIONAL_CLASS_P (node))
ae2bcd98 789 lang_hooks.print_xnode (file, node, indent);
0a6969ad 790 break;
52eeef3a
RS
791 }
792
793 break;
794 }
f6adcfdc 795
6de9cd9a
DN
796 if (EXPR_HAS_LOCATION (node))
797 {
a281759f 798 expanded_location xloc = expand_location (EXPR_LOCATION (node));
6de9cd9a 799 indent_to (file, indent+4);
a281759f 800 fprintf (file, "%s:%d", xloc.file, xloc.line);
6de9cd9a
DN
801 }
802
f6adcfdc 803 fprintf (file, ">");
52eeef3a 804}
This page took 3.024396 seconds and 5 git commands to generate.