Mercurial > hg > CbC > CbC_gcc
comparison gcc/print-tree.c @ 111:04ced10e8804
gcc 7
author | kono |
---|---|
date | Fri, 27 Oct 2017 22:46:09 +0900 |
parents | f6334be47118 |
children | 84e7813d76e9 |
comparison
equal
deleted
inserted
replaced
68:561a7518be6b | 111:04ced10e8804 |
---|---|
1 /* Prints out tree in human readable form - GCC | 1 /* Prints out tree in human readable form - GCC |
2 Copyright (C) 1990, 1991, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, | 2 Copyright (C) 1990-2017 Free Software Foundation, Inc. |
3 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 | |
4 Free Software Foundation, Inc. | |
5 | 3 |
6 This file is part of GCC. | 4 This file is part of GCC. |
7 | 5 |
8 GCC is free software; you can redistribute it and/or modify it under | 6 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 | 7 the terms of the GNU General Public License as published by the Free |
23 #include "config.h" | 21 #include "config.h" |
24 #include "system.h" | 22 #include "system.h" |
25 #include "coretypes.h" | 23 #include "coretypes.h" |
26 #include "tm.h" | 24 #include "tm.h" |
27 #include "tree.h" | 25 #include "tree.h" |
28 #include "ggc.h" | 26 #include "cgraph.h" |
27 #include "diagnostic.h" | |
28 #include "varasm.h" | |
29 #include "print-rtl.h" | |
30 #include "stor-layout.h" | |
29 #include "langhooks.h" | 31 #include "langhooks.h" |
30 #include "tree-iterator.h" | 32 #include "tree-iterator.h" |
31 #include "diagnostic.h" | 33 #include "gimple-pretty-print.h" /* FIXME */ |
32 #include "gimple-pretty-print.h" | 34 #include "tree-cfg.h" |
33 #include "tree-flow.h" | 35 #include "dumpfile.h" |
34 #include "tree-pass.h" | 36 #include "print-tree.h" |
35 | 37 |
36 /* Define the hash table of nodes already seen. | 38 /* Define the hash table of nodes already seen. |
37 Such nodes are not repeated; brief cross-references are used. */ | 39 Such nodes are not repeated; brief cross-references are used. */ |
38 | 40 |
39 #define HASH_SIZE 37 | 41 #define HASH_SIZE 37 |
40 | 42 |
41 struct bucket | 43 static hash_set<tree> *table = NULL; |
42 { | |
43 tree node; | |
44 struct bucket *next; | |
45 }; | |
46 | |
47 static struct bucket **table; | |
48 | |
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. */ | |
52 | |
53 DEBUG_FUNCTION void | |
54 debug_tree (tree node) | |
55 { | |
56 table = XCNEWVEC (struct bucket *, HASH_SIZE); | |
57 print_node (stderr, "", node, 0); | |
58 free (table); | |
59 table = 0; | |
60 putc ('\n', stderr); | |
61 } | |
62 | |
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. */ | |
66 | |
67 DEBUG_FUNCTION void | |
68 debug_vec_tree (VEC(tree,gc) *vec) | |
69 { | |
70 table = XCNEWVEC (struct bucket *, HASH_SIZE); | |
71 print_vec_tree (stderr, "", vec, 0); | |
72 free (table); | |
73 table = 0; | |
74 putc ('\n', stderr); | |
75 } | |
76 | 44 |
77 /* Print PREFIX and ADDR to FILE. */ | 45 /* Print PREFIX and ADDR to FILE. */ |
78 void | 46 void |
79 dump_addr (FILE *file, const char *prefix, const void *addr) | 47 dump_addr (FILE *file, const char *prefix, const void *addr) |
80 { | 48 { |
98 | 66 |
99 /* Always print the slot this node is in, and its code, address and | 67 /* Always print the slot this node is in, and its code, address and |
100 name if any. */ | 68 name if any. */ |
101 if (indent > 0) | 69 if (indent > 0) |
102 fprintf (file, " "); | 70 fprintf (file, " "); |
103 fprintf (file, "%s <%s", prefix, tree_code_name[(int) TREE_CODE (node)]); | 71 fprintf (file, "%s <%s", prefix, get_tree_code_name (TREE_CODE (node))); |
104 dump_addr (file, " ", node); | 72 dump_addr (file, " ", node); |
105 | 73 |
106 if (tclass == tcc_declaration) | 74 if (tclass == tcc_declaration) |
107 { | 75 { |
108 if (DECL_NAME (node)) | 76 if (DECL_NAME (node)) |
148 { | 116 { |
149 if (TREE_OVERFLOW (node)) | 117 if (TREE_OVERFLOW (node)) |
150 fprintf (file, " overflow"); | 118 fprintf (file, " overflow"); |
151 | 119 |
152 fprintf (file, " "); | 120 fprintf (file, " "); |
153 if (TREE_INT_CST_HIGH (node) == 0) | 121 print_dec (wi::to_wide (node), file, TYPE_SIGN (TREE_TYPE (node))); |
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)); | |
159 else | |
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)); | |
163 } | 122 } |
164 if (TREE_CODE (node) == REAL_CST) | 123 if (TREE_CODE (node) == REAL_CST) |
165 { | 124 { |
166 REAL_VALUE_TYPE d; | 125 REAL_VALUE_TYPE d; |
167 | 126 |
210 | 169 |
211 /* Print the node NODE in full on file FILE, preceded by PREFIX, | 170 /* Print the node NODE in full on file FILE, preceded by PREFIX, |
212 starting in column INDENT. */ | 171 starting in column INDENT. */ |
213 | 172 |
214 void | 173 void |
215 print_node (FILE *file, const char *prefix, tree node, int indent) | 174 print_node (FILE *file, const char *prefix, tree node, int indent, |
216 { | 175 bool brief_for_visited) |
217 int hash; | 176 { |
218 struct bucket *b; | 177 machine_mode mode; |
219 enum machine_mode mode; | |
220 enum tree_code_class tclass; | 178 enum tree_code_class tclass; |
221 int len; | 179 int len; |
222 int i; | 180 int i; |
223 expanded_location xloc; | 181 expanded_location xloc; |
224 enum tree_code code; | 182 enum tree_code code; |
253 } | 211 } |
254 | 212 |
255 /* Allow this function to be called if the table is not there. */ | 213 /* Allow this function to be called if the table is not there. */ |
256 if (table) | 214 if (table) |
257 { | 215 { |
258 hash = ((unsigned long) node) % HASH_SIZE; | |
259 | |
260 /* If node is in the table, just mention its address. */ | 216 /* If node is in the table, just mention its address. */ |
261 for (b = table[hash]; b; b = b->next) | 217 if (table->contains (node) && brief_for_visited) |
262 if (b->node == node) | 218 { |
263 { | 219 print_node_brief (file, prefix, node, indent); |
264 print_node_brief (file, prefix, node, indent); | 220 return; |
265 return; | 221 } |
266 } | 222 |
267 | 223 table->add (node); |
268 /* Add this node to the table. */ | |
269 b = XNEW (struct bucket); | |
270 b->node = node; | |
271 b->next = table[hash]; | |
272 table[hash] = b; | |
273 } | 224 } |
274 | 225 |
275 /* Indent to the specified column, since this is the long form. */ | 226 /* Indent to the specified column, since this is the long form. */ |
276 indent_to (file, indent); | 227 indent_to (file, indent); |
277 | 228 |
278 /* Print the slot this node is in, and its code, and address. */ | 229 /* Print the slot this node is in, and its code, and address. */ |
279 fprintf (file, "%s <%s", prefix, tree_code_name[(int) code]); | 230 fprintf (file, "%s <%s", prefix, get_tree_code_name (code)); |
280 dump_addr (file, " ", node); | 231 dump_addr (file, " ", node); |
281 | 232 |
282 /* Print the name, if any. */ | 233 /* Print the name, if any. */ |
283 if (tclass == tcc_declaration) | 234 if (tclass == tcc_declaration) |
284 { | 235 { |
319 if (code == INTEGER_CST) | 270 if (code == INTEGER_CST) |
320 { | 271 { |
321 if (indent <= 4) | 272 if (indent <= 4) |
322 print_node_brief (file, "type", TREE_TYPE (node), indent + 4); | 273 print_node_brief (file, "type", TREE_TYPE (node), indent + 4); |
323 } | 274 } |
324 else | 275 else if (CODE_CONTAINS_STRUCT (code, TS_TYPED)) |
325 { | 276 { |
326 print_node (file, "type", TREE_TYPE (node), indent + 4); | 277 print_node (file, "type", TREE_TYPE (node), indent + 4); |
327 if (TREE_TYPE (node)) | 278 if (TREE_TYPE (node)) |
328 indent_to (file, indent + 3); | 279 indent_to (file, indent + 3); |
329 } | 280 } |
331 if (!TYPE_P (node) && TREE_SIDE_EFFECTS (node)) | 282 if (!TYPE_P (node) && TREE_SIDE_EFFECTS (node)) |
332 fputs (" side-effects", file); | 283 fputs (" side-effects", file); |
333 | 284 |
334 if (TYPE_P (node) ? TYPE_READONLY (node) : TREE_READONLY (node)) | 285 if (TYPE_P (node) ? TYPE_READONLY (node) : TREE_READONLY (node)) |
335 fputs (" readonly", file); | 286 fputs (" readonly", file); |
287 if (TYPE_P (node) && TYPE_ATOMIC (node)) | |
288 fputs (" atomic", file); | |
336 if (!TYPE_P (node) && TREE_CONSTANT (node)) | 289 if (!TYPE_P (node) && TREE_CONSTANT (node)) |
337 fputs (" constant", file); | 290 fputs (" constant", file); |
338 else if (TYPE_P (node) && TYPE_SIZES_GIMPLIFIED (node)) | 291 else if (TYPE_P (node) && TYPE_SIZES_GIMPLIFIED (node)) |
339 fputs (" sizes-gimplified", file); | 292 fputs (" sizes-gimplified", file); |
340 | 293 |
348 if (TREE_ASM_WRITTEN (node)) | 301 if (TREE_ASM_WRITTEN (node)) |
349 fputs (" asm_written", file); | 302 fputs (" asm_written", file); |
350 if (TREE_USED (node)) | 303 if (TREE_USED (node)) |
351 fputs (" used", file); | 304 fputs (" used", file); |
352 if (TREE_NOTHROW (node)) | 305 if (TREE_NOTHROW (node)) |
353 fputs (TYPE_P (node) ? " align-ok" : " nothrow", file); | 306 fputs (" nothrow", file); |
354 if (TREE_PUBLIC (node)) | 307 if (TREE_PUBLIC (node)) |
355 fputs (" public", file); | 308 fputs (" public", file); |
356 if (TREE_PRIVATE (node)) | 309 if (TREE_PRIVATE (node)) |
357 fputs (" private", file); | 310 fputs (" private", file); |
358 if (TREE_PROTECTED (node)) | 311 if (TREE_PROTECTED (node)) |
359 fputs (" protected", file); | 312 fputs (" protected", file); |
360 if (TREE_STATIC (node)) | 313 if (TREE_STATIC (node)) |
361 fputs (" static", file); | 314 fputs (code == CALL_EXPR ? " must-tail-call" : " static", file); |
362 if (TREE_DEPRECATED (node)) | 315 if (TREE_DEPRECATED (node)) |
363 fputs (" deprecated", file); | 316 fputs (" deprecated", file); |
364 if (TREE_VISITED (node)) | 317 if (TREE_VISITED (node)) |
365 fputs (" visited", file); | 318 fputs (" visited", file); |
366 if (TREE_LANG_FLAG_0 (node)) | 319 |
367 fputs (" tree_0", file); | 320 if (code != TREE_VEC && code != INTEGER_CST && code != SSA_NAME) |
368 if (TREE_LANG_FLAG_1 (node)) | 321 { |
369 fputs (" tree_1", file); | 322 if (TREE_LANG_FLAG_0 (node)) |
370 if (TREE_LANG_FLAG_2 (node)) | 323 fputs (" tree_0", file); |
371 fputs (" tree_2", file); | 324 if (TREE_LANG_FLAG_1 (node)) |
372 if (TREE_LANG_FLAG_3 (node)) | 325 fputs (" tree_1", file); |
373 fputs (" tree_3", file); | 326 if (TREE_LANG_FLAG_2 (node)) |
374 if (TREE_LANG_FLAG_4 (node)) | 327 fputs (" tree_2", file); |
375 fputs (" tree_4", file); | 328 if (TREE_LANG_FLAG_3 (node)) |
376 if (TREE_LANG_FLAG_5 (node)) | 329 fputs (" tree_3", file); |
377 fputs (" tree_5", file); | 330 if (TREE_LANG_FLAG_4 (node)) |
378 if (TREE_LANG_FLAG_6 (node)) | 331 fputs (" tree_4", file); |
379 fputs (" tree_6", file); | 332 if (TREE_LANG_FLAG_5 (node)) |
333 fputs (" tree_5", file); | |
334 if (TREE_LANG_FLAG_6 (node)) | |
335 fputs (" tree_6", file); | |
336 } | |
380 | 337 |
381 /* DECL_ nodes have additional attributes. */ | 338 /* DECL_ nodes have additional attributes. */ |
382 | 339 |
383 switch (TREE_CODE_CLASS (code)) | 340 switch (TREE_CODE_CLASS (code)) |
384 { | 341 { |
387 { | 344 { |
388 if (DECL_UNSIGNED (node)) | 345 if (DECL_UNSIGNED (node)) |
389 fputs (" unsigned", file); | 346 fputs (" unsigned", file); |
390 if (DECL_IGNORED_P (node)) | 347 if (DECL_IGNORED_P (node)) |
391 fputs (" ignored", file); | 348 fputs (" ignored", file); |
392 if (DECL_ABSTRACT (node)) | 349 if (DECL_ABSTRACT_P (node)) |
393 fputs (" abstract", file); | 350 fputs (" abstract", file); |
394 if (DECL_EXTERNAL (node)) | 351 if (DECL_EXTERNAL (node)) |
395 fputs (" external", file); | 352 fputs (" external", file); |
396 if (DECL_NONLOCAL (node)) | 353 if (DECL_NONLOCAL (node)) |
397 fputs (" nonlocal", file); | 354 fputs (" nonlocal", file); |
422 fputs (" autoinline", file); | 379 fputs (" autoinline", file); |
423 if (code == FUNCTION_DECL && DECL_BUILT_IN (node)) | 380 if (code == FUNCTION_DECL && DECL_BUILT_IN (node)) |
424 fputs (" built-in", file); | 381 fputs (" built-in", file); |
425 if (code == FUNCTION_DECL && DECL_STATIC_CHAIN (node)) | 382 if (code == FUNCTION_DECL && DECL_STATIC_CHAIN (node)) |
426 fputs (" static-chain", file); | 383 fputs (" static-chain", file); |
384 if (TREE_CODE (node) == FUNCTION_DECL && decl_is_tm_clone (node)) | |
385 fputs (" tm-clone", file); | |
427 | 386 |
428 if (code == FIELD_DECL && DECL_PACKED (node)) | 387 if (code == FIELD_DECL && DECL_PACKED (node)) |
429 fputs (" packed", file); | 388 fputs (" packed", file); |
430 if (code == FIELD_DECL && DECL_BIT_FIELD (node)) | 389 if (code == FIELD_DECL && DECL_BIT_FIELD (node)) |
431 fputs (" bit-field", file); | 390 fputs (" bit-field", file); |
432 if (code == FIELD_DECL && DECL_NONADDRESSABLE_P (node)) | 391 if (code == FIELD_DECL && DECL_NONADDRESSABLE_P (node)) |
433 fputs (" nonaddressable", file); | 392 fputs (" nonaddressable", file); |
434 | 393 |
435 if (code == LABEL_DECL && DECL_ERROR_ISSUED (node)) | |
436 fputs (" error-issued", file); | |
437 if (code == LABEL_DECL && EH_LANDING_PAD_NR (node)) | 394 if (code == LABEL_DECL && EH_LANDING_PAD_NR (node)) |
438 fprintf (file, " landing-pad:%d", EH_LANDING_PAD_NR (node)); | 395 fprintf (file, " landing-pad:%d", EH_LANDING_PAD_NR (node)); |
439 | 396 |
440 if (code == VAR_DECL && DECL_IN_TEXT_SECTION (node)) | 397 if (code == VAR_DECL && DECL_IN_TEXT_SECTION (node)) |
441 fputs (" in-text-section", file); | 398 fputs (" in-text-section", file); |
442 if (code == VAR_DECL && DECL_IN_CONSTANT_POOL (node)) | 399 if (code == VAR_DECL && DECL_IN_CONSTANT_POOL (node)) |
443 fputs (" in-constant-pool", file); | 400 fputs (" in-constant-pool", file); |
444 if (code == VAR_DECL && DECL_COMMON (node)) | 401 if (code == VAR_DECL && DECL_COMMON (node)) |
445 fputs (" common", file); | 402 fputs (" common", file); |
403 if ((code == VAR_DECL || code == PARM_DECL) && DECL_READ_P (node)) | |
404 fputs (" read", file); | |
446 if (code == VAR_DECL && DECL_THREAD_LOCAL_P (node)) | 405 if (code == VAR_DECL && DECL_THREAD_LOCAL_P (node)) |
447 { | 406 { |
448 enum tls_model kind = DECL_TLS_MODEL (node); | 407 fputs (" ", file); |
449 switch (kind) | 408 fputs (tls_model_names[DECL_TLS_MODEL (node)], file); |
450 { | |
451 case TLS_MODEL_GLOBAL_DYNAMIC: | |
452 fputs (" tls-global-dynamic", file); | |
453 break; | |
454 case TLS_MODEL_LOCAL_DYNAMIC: | |
455 fputs (" tls-local-dynamic", file); | |
456 break; | |
457 case TLS_MODEL_INITIAL_EXEC: | |
458 fputs (" tls-initial-exec", file); | |
459 break; | |
460 case TLS_MODEL_LOCAL_EXEC: | |
461 fputs (" tls-local-exec", file); | |
462 break; | |
463 default: | |
464 gcc_unreachable (); | |
465 } | |
466 } | 409 } |
467 | 410 |
468 if (CODE_CONTAINS_STRUCT (code, TS_DECL_COMMON)) | 411 if (CODE_CONTAINS_STRUCT (code, TS_DECL_COMMON)) |
469 { | 412 { |
470 if (DECL_VIRTUAL_P (node)) | 413 if (DECL_VIRTUAL_P (node)) |
499 if (CODE_CONTAINS_STRUCT (code, TS_DECL_WITH_VIS) && DECL_DEFER_OUTPUT (node)) | 442 if (CODE_CONTAINS_STRUCT (code, TS_DECL_WITH_VIS) && DECL_DEFER_OUTPUT (node)) |
500 fputs (" defer-output", file); | 443 fputs (" defer-output", file); |
501 | 444 |
502 | 445 |
503 xloc = expand_location (DECL_SOURCE_LOCATION (node)); | 446 xloc = expand_location (DECL_SOURCE_LOCATION (node)); |
504 fprintf (file, " file %s line %d col %d", xloc.file, xloc.line, | 447 fprintf (file, " %s:%d:%d", xloc.file, xloc.line, |
505 xloc.column); | 448 xloc.column); |
506 | 449 |
507 if (CODE_CONTAINS_STRUCT (code, TS_DECL_COMMON)) | 450 if (CODE_CONTAINS_STRUCT (code, TS_DECL_COMMON)) |
508 { | 451 { |
509 print_node (file, "size", DECL_SIZE (node), indent + 4); | 452 print_node (file, "size", DECL_SIZE (node), indent + 4); |
510 print_node (file, "unit size", DECL_SIZE_UNIT (node), indent + 4); | 453 print_node (file, "unit-size", DECL_SIZE_UNIT (node), indent + 4); |
511 | 454 |
512 if (code != FUNCTION_DECL || DECL_BUILT_IN (node)) | 455 if (code != FUNCTION_DECL || DECL_BUILT_IN (node)) |
513 indent_to (file, indent + 3); | 456 indent_to (file, indent + 3); |
514 | 457 |
515 if (DECL_USER_ALIGN (node)) | 458 if (DECL_USER_ALIGN (node)) |
516 fprintf (file, " user"); | 459 fprintf (file, " user"); |
517 | 460 |
518 fprintf (file, " align %d", DECL_ALIGN (node)); | 461 fprintf (file, " align:%d warn_if_not_align:%d", |
462 DECL_ALIGN (node), DECL_WARN_IF_NOT_ALIGN (node)); | |
519 if (code == FIELD_DECL) | 463 if (code == FIELD_DECL) |
520 fprintf (file, " offset_align " HOST_WIDE_INT_PRINT_UNSIGNED, | 464 fprintf (file, " offset_align " HOST_WIDE_INT_PRINT_UNSIGNED, |
521 DECL_OFFSET_ALIGN (node)); | 465 DECL_OFFSET_ALIGN (node)); |
522 | 466 |
523 if (code == FUNCTION_DECL && DECL_BUILT_IN (node)) | 467 if (code == FUNCTION_DECL && DECL_BUILT_IN (node)) |
524 { | 468 { |
525 if (DECL_BUILT_IN_CLASS (node) == BUILT_IN_MD) | 469 if (DECL_BUILT_IN_CLASS (node) == BUILT_IN_MD) |
526 fprintf (file, " built-in BUILT_IN_MD %d", DECL_FUNCTION_CODE (node)); | 470 fprintf (file, " built-in: BUILT_IN_MD:%d", DECL_FUNCTION_CODE (node)); |
527 else | 471 else |
528 fprintf (file, " built-in %s:%s", | 472 fprintf (file, " built-in: %s:%s", |
529 built_in_class_names[(int) DECL_BUILT_IN_CLASS (node)], | 473 built_in_class_names[(int) DECL_BUILT_IN_CLASS (node)], |
530 built_in_names[(int) DECL_FUNCTION_CODE (node)]); | 474 built_in_names[(int) DECL_FUNCTION_CODE (node)]); |
531 } | 475 } |
532 } | 476 } |
533 if (code == FIELD_DECL) | 477 if (code == FIELD_DECL) |
534 { | 478 { |
535 print_node (file, "offset", DECL_FIELD_OFFSET (node), indent + 4); | 479 print_node (file, "offset", DECL_FIELD_OFFSET (node), indent + 4); |
536 print_node (file, "bit offset", DECL_FIELD_BIT_OFFSET (node), | 480 print_node (file, "bit-offset", DECL_FIELD_BIT_OFFSET (node), |
537 indent + 4); | 481 indent + 4); |
538 if (DECL_BIT_FIELD_TYPE (node)) | 482 if (DECL_BIT_FIELD_TYPE (node)) |
539 print_node (file, "bit_field_type", DECL_BIT_FIELD_TYPE (node), | 483 print_node (file, "bit_field_type", DECL_BIT_FIELD_TYPE (node), |
540 indent + 4); | 484 indent + 4); |
541 } | 485 } |
542 | 486 |
543 print_node_brief (file, "context", DECL_CONTEXT (node), indent + 4); | 487 print_node_brief (file, "context", DECL_CONTEXT (node), indent + 4); |
544 | 488 |
545 if (CODE_CONTAINS_STRUCT (code, TS_DECL_COMMON)) | 489 if (CODE_CONTAINS_STRUCT (code, TS_DECL_COMMON)) |
546 { | 490 { |
547 print_node_brief (file, "attributes", | 491 print_node (file, "attributes", |
548 DECL_ATTRIBUTES (node), indent + 4); | 492 DECL_ATTRIBUTES (node), indent + 4); |
549 if (code != PARM_DECL) | 493 if (code != PARM_DECL) |
550 print_node_brief (file, "initial", DECL_INITIAL (node), | 494 print_node_brief (file, "initial", DECL_INITIAL (node), |
551 indent + 4); | 495 indent + 4); |
552 } | 496 } |
555 print_node_brief (file, "abstract_origin", | 499 print_node_brief (file, "abstract_origin", |
556 DECL_ABSTRACT_ORIGIN (node), indent + 4); | 500 DECL_ABSTRACT_ORIGIN (node), indent + 4); |
557 } | 501 } |
558 if (CODE_CONTAINS_STRUCT (code, TS_DECL_NON_COMMON)) | 502 if (CODE_CONTAINS_STRUCT (code, TS_DECL_NON_COMMON)) |
559 { | 503 { |
560 print_node (file, "arguments", DECL_ARGUMENT_FLD (node), indent + 4); | |
561 print_node (file, "result", DECL_RESULT_FLD (node), indent + 4); | 504 print_node (file, "result", DECL_RESULT_FLD (node), indent + 4); |
562 } | 505 } |
563 | 506 |
564 lang_hooks.print_decl (file, node, indent); | 507 lang_hooks.print_decl (file, node, indent); |
565 | 508 |
581 } | 524 } |
582 } | 525 } |
583 else if (code == FUNCTION_DECL | 526 else if (code == FUNCTION_DECL |
584 && DECL_STRUCT_FUNCTION (node) != 0) | 527 && DECL_STRUCT_FUNCTION (node) != 0) |
585 { | 528 { |
529 print_node (file, "arguments", DECL_ARGUMENTS (node), indent + 4); | |
586 indent_to (file, indent + 4); | 530 indent_to (file, indent + 4); |
587 dump_addr (file, "struct-function ", DECL_STRUCT_FUNCTION (node)); | 531 dump_addr (file, "struct-function ", DECL_STRUCT_FUNCTION (node)); |
588 } | 532 } |
589 | 533 |
590 if ((code == VAR_DECL || code == PARM_DECL) | 534 if ((code == VAR_DECL || code == PARM_DECL) |
600 | 544 |
601 case tcc_type: | 545 case tcc_type: |
602 if (TYPE_UNSIGNED (node)) | 546 if (TYPE_UNSIGNED (node)) |
603 fputs (" unsigned", file); | 547 fputs (" unsigned", file); |
604 | 548 |
605 /* The no-force-blk flag is used for different things in | 549 if (TYPE_NO_FORCE_BLK (node)) |
606 different types. */ | 550 fputs (" no-force-blk", file); |
551 | |
552 if (TYPE_STRING_FLAG (node)) | |
553 fputs (" string-flag", file); | |
554 | |
555 if (TYPE_NEEDS_CONSTRUCTING (node)) | |
556 fputs (" needs-constructing", file); | |
557 | |
607 if ((code == RECORD_TYPE | 558 if ((code == RECORD_TYPE |
608 || code == UNION_TYPE | 559 || code == UNION_TYPE |
609 || code == QUAL_UNION_TYPE) | 560 || code == QUAL_UNION_TYPE |
610 && TYPE_NO_FORCE_BLK (node)) | 561 || code == ARRAY_TYPE) |
611 fputs (" no-force-blk", file); | 562 && TYPE_REVERSE_STORAGE_ORDER (node)) |
612 else if (code == INTEGER_TYPE | 563 fputs (" reverse-storage-order", file); |
613 && TYPE_IS_SIZETYPE (node)) | |
614 fputs (" sizetype", file); | |
615 | |
616 if (TYPE_STRING_FLAG (node)) | |
617 fputs (" string-flag", file); | |
618 if (TYPE_NEEDS_CONSTRUCTING (node)) | |
619 fputs (" needs-constructing", file); | |
620 | 564 |
621 /* The transparent-union flag is used for different things in | 565 /* The transparent-union flag is used for different things in |
622 different nodes. */ | 566 different nodes. */ |
623 if ((code == UNION_TYPE || code == RECORD_TYPE) | 567 if ((code == UNION_TYPE || code == RECORD_TYPE) |
624 && TYPE_TRANSPARENT_AGGR (node)) | 568 && TYPE_TRANSPARENT_AGGR (node)) |
645 fputs (" type_4", file); | 589 fputs (" type_4", file); |
646 if (TYPE_LANG_FLAG_5 (node)) | 590 if (TYPE_LANG_FLAG_5 (node)) |
647 fputs (" type_5", file); | 591 fputs (" type_5", file); |
648 if (TYPE_LANG_FLAG_6 (node)) | 592 if (TYPE_LANG_FLAG_6 (node)) |
649 fputs (" type_6", file); | 593 fputs (" type_6", file); |
594 if (TYPE_LANG_FLAG_7 (node)) | |
595 fputs (" type_7", file); | |
650 | 596 |
651 mode = TYPE_MODE (node); | 597 mode = TYPE_MODE (node); |
652 fprintf (file, " %s", GET_MODE_NAME (mode)); | 598 fprintf (file, " %s", GET_MODE_NAME (mode)); |
653 | 599 |
654 print_node (file, "size", TYPE_SIZE (node), indent + 4); | 600 print_node (file, "size", TYPE_SIZE (node), indent + 4); |
655 print_node (file, "unit size", TYPE_SIZE_UNIT (node), indent + 4); | 601 print_node (file, "unit-size", TYPE_SIZE_UNIT (node), indent + 4); |
656 indent_to (file, indent + 3); | 602 indent_to (file, indent + 3); |
657 | 603 |
658 if (TYPE_USER_ALIGN (node)) | 604 if (TYPE_USER_ALIGN (node)) |
659 fprintf (file, " user"); | 605 fprintf (file, " user"); |
660 | 606 |
661 fprintf (file, " align %d symtab %d alias set " HOST_WIDE_INT_PRINT_DEC, | 607 fprintf (file, " align:%d warn_if_not_align:%d symtab:%d alias-set " |
662 TYPE_ALIGN (node), TYPE_SYMTAB_ADDRESS (node), | 608 HOST_WIDE_INT_PRINT_DEC, |
609 TYPE_ALIGN (node), TYPE_WARN_IF_NOT_ALIGN (node), | |
610 TYPE_SYMTAB_ADDRESS (node), | |
663 (HOST_WIDE_INT) TYPE_ALIAS_SET (node)); | 611 (HOST_WIDE_INT) TYPE_ALIAS_SET (node)); |
664 | 612 |
665 if (TYPE_STRUCTURAL_EQUALITY_P (node)) | 613 if (TYPE_STRUCTURAL_EQUALITY_P (node)) |
666 fprintf (file, " structural equality"); | 614 fprintf (file, " structural-equality"); |
667 else | 615 else |
668 dump_addr (file, " canonical type ", TYPE_CANONICAL (node)); | 616 dump_addr (file, " canonical-type ", TYPE_CANONICAL (node)); |
669 | 617 |
670 print_node (file, "attributes", TYPE_ATTRIBUTES (node), indent + 4); | 618 print_node (file, "attributes", TYPE_ATTRIBUTES (node), indent + 4); |
671 | 619 |
672 if (INTEGRAL_TYPE_P (node) || code == REAL_TYPE | 620 if (INTEGRAL_TYPE_P (node) || code == REAL_TYPE |
673 || code == FIXED_POINT_TYPE) | 621 || code == FIXED_POINT_TYPE) |
674 { | 622 { |
675 fprintf (file, " precision %d", TYPE_PRECISION (node)); | 623 fprintf (file, " precision:%d", TYPE_PRECISION (node)); |
676 print_node_brief (file, "min", TYPE_MIN_VALUE (node), indent + 4); | 624 print_node_brief (file, "min", TYPE_MIN_VALUE (node), indent + 4); |
677 print_node_brief (file, "max", TYPE_MAX_VALUE (node), indent + 4); | 625 print_node_brief (file, "max", TYPE_MAX_VALUE (node), indent + 4); |
678 } | 626 } |
679 | 627 |
680 if (code == ENUMERAL_TYPE) | 628 if (code == ENUMERAL_TYPE) |
681 print_node (file, "values", TYPE_VALUES (node), indent + 4); | 629 print_node (file, "values", TYPE_VALUES (node), indent + 4); |
682 else if (code == ARRAY_TYPE) | 630 else if (code == ARRAY_TYPE) |
683 print_node (file, "domain", TYPE_DOMAIN (node), indent + 4); | 631 print_node (file, "domain", TYPE_DOMAIN (node), indent + 4); |
684 else if (code == VECTOR_TYPE) | 632 else if (code == VECTOR_TYPE) |
685 fprintf (file, " nunits %d", (int) TYPE_VECTOR_SUBPARTS (node)); | 633 fprintf (file, " nunits:%d", (int) TYPE_VECTOR_SUBPARTS (node)); |
686 else if (code == RECORD_TYPE | 634 else if (code == RECORD_TYPE |
687 || code == UNION_TYPE | 635 || code == UNION_TYPE |
688 || code == QUAL_UNION_TYPE) | 636 || code == QUAL_UNION_TYPE) |
689 print_node (file, "fields", TYPE_FIELDS (node), indent + 4); | 637 print_node (file, "fields", TYPE_FIELDS (node), indent + 4); |
690 else if (code == FUNCTION_TYPE | 638 else if (code == FUNCTION_TYPE |
736 print_node (file, "static_chain", CALL_EXPR_STATIC_CHAIN (node), | 684 print_node (file, "static_chain", CALL_EXPR_STATIC_CHAIN (node), |
737 indent + 4); | 685 indent + 4); |
738 i = 0; | 686 i = 0; |
739 FOR_EACH_CALL_EXPR_ARG (arg, iter, node) | 687 FOR_EACH_CALL_EXPR_ARG (arg, iter, node) |
740 { | 688 { |
741 char temp[10]; | 689 /* Buffer big enough to format a 32-bit UINT_MAX into, plus |
742 sprintf (temp, "arg %d", i); | 690 the text. */ |
691 char temp[15]; | |
692 sprintf (temp, "arg:%u", i); | |
743 print_node (file, temp, arg, indent + 4); | 693 print_node (file, temp, arg, indent + 4); |
744 i++; | 694 i++; |
745 } | 695 } |
746 } | 696 } |
747 else | 697 else |
748 { | 698 { |
749 len = TREE_OPERAND_LENGTH (node); | 699 len = TREE_OPERAND_LENGTH (node); |
750 | 700 |
751 for (i = 0; i < len; i++) | 701 for (i = 0; i < len; i++) |
752 { | 702 { |
753 char temp[10]; | 703 /* Buffer big enough to format a 32-bit UINT_MAX into, plus |
754 | 704 the text. */ |
755 sprintf (temp, "arg %d", i); | 705 char temp[15]; |
706 | |
707 sprintf (temp, "arg:%d", i); | |
756 print_node (file, temp, TREE_OPERAND (node, i), indent + 4); | 708 print_node (file, temp, TREE_OPERAND (node, i), indent + 4); |
757 } | 709 } |
758 } | 710 } |
759 print_node (file, "chain", TREE_CHAIN (node), indent + 4); | 711 if (CODE_CONTAINS_STRUCT (code, TS_COMMON)) |
712 print_node (file, "chain", TREE_CHAIN (node), indent + 4); | |
760 break; | 713 break; |
761 | 714 |
762 case tcc_constant: | 715 case tcc_constant: |
763 case tcc_exceptional: | 716 case tcc_exceptional: |
764 switch (code) | 717 switch (code) |
766 case INTEGER_CST: | 719 case INTEGER_CST: |
767 if (TREE_OVERFLOW (node)) | 720 if (TREE_OVERFLOW (node)) |
768 fprintf (file, " overflow"); | 721 fprintf (file, " overflow"); |
769 | 722 |
770 fprintf (file, " "); | 723 fprintf (file, " "); |
771 if (TREE_INT_CST_HIGH (node) == 0) | 724 print_dec (wi::to_wide (node), file, TYPE_SIGN (TREE_TYPE (node))); |
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)); | |
778 else | |
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)); | |
782 break; | 725 break; |
783 | 726 |
784 case REAL_CST: | 727 case REAL_CST: |
785 { | 728 { |
786 REAL_VALUE_TYPE d; | 729 REAL_VALUE_TYPE d; |
816 } | 759 } |
817 break; | 760 break; |
818 | 761 |
819 case VECTOR_CST: | 762 case VECTOR_CST: |
820 { | 763 { |
821 tree vals = TREE_VECTOR_CST_ELTS (node); | 764 /* Big enough for 2 UINT_MAX plus the string below. */ |
822 char buf[10]; | 765 char buf[32]; |
823 tree link; | 766 unsigned i; |
824 int i; | 767 |
825 | 768 for (i = 0; i < VECTOR_CST_NELTS (node); ++i) |
826 i = 0; | |
827 for (link = vals; link; link = TREE_CHAIN (link), ++i) | |
828 { | 769 { |
829 sprintf (buf, "elt%d: ", i); | 770 unsigned j; |
830 print_node (file, buf, TREE_VALUE (link), indent + 4); | 771 /* Coalesce the output of identical consecutive elements. */ |
772 for (j = i + 1; j < VECTOR_CST_NELTS (node); j++) | |
773 if (VECTOR_CST_ELT (node, j) != VECTOR_CST_ELT (node, i)) | |
774 break; | |
775 j--; | |
776 if (i == j) | |
777 sprintf (buf, "elt:%u: ", i); | |
778 else | |
779 sprintf (buf, "elt:%u...%u: ", i, j); | |
780 print_node (file, buf, VECTOR_CST_ELT (node, i), indent + 4); | |
781 i = j; | |
831 } | 782 } |
832 } | 783 } |
833 break; | 784 break; |
834 | 785 |
835 case COMPLEX_CST: | 786 case COMPLEX_CST: |
846 { | 797 { |
847 char ch = *p++; | 798 char ch = *p++; |
848 if (ch >= ' ' && ch < 127) | 799 if (ch >= ' ' && ch < 127) |
849 putc (ch, file); | 800 putc (ch, file); |
850 else | 801 else |
851 fprintf(file, "\\%03o", ch & 0xFF); | 802 fprintf (file, "\\%03o", ch & 0xFF); |
852 } | 803 } |
853 fputc ('\"', file); | 804 fputc ('\"', file); |
854 } | 805 } |
855 /* Print the chain at second level. */ | |
856 if (indent == 4) | |
857 print_node (file, "chain", TREE_CHAIN (node), indent + 4); | |
858 else | |
859 print_node_brief (file, "chain", TREE_CHAIN (node), indent + 4); | |
860 break; | 806 break; |
861 | 807 |
862 case IDENTIFIER_NODE: | 808 case IDENTIFIER_NODE: |
863 lang_hooks.print_identifier (file, node, indent); | 809 lang_hooks.print_identifier (file, node, indent); |
864 break; | 810 break; |
869 print_node (file, "chain", TREE_CHAIN (node), indent + 4); | 815 print_node (file, "chain", TREE_CHAIN (node), indent + 4); |
870 break; | 816 break; |
871 | 817 |
872 case TREE_VEC: | 818 case TREE_VEC: |
873 len = TREE_VEC_LENGTH (node); | 819 len = TREE_VEC_LENGTH (node); |
820 fprintf (file, " length:%d", len); | |
874 for (i = 0; i < len; i++) | 821 for (i = 0; i < len; i++) |
875 if (TREE_VEC_ELT (node, i)) | 822 if (TREE_VEC_ELT (node, i)) |
876 { | 823 { |
877 char temp[10]; | 824 /* Buffer big enough to format a 32-bit UINT_MAX into, plus |
878 sprintf (temp, "elt %d", i); | 825 the text. */ |
826 char temp[15]; | |
827 sprintf (temp, "elt:%d", i); | |
879 print_node (file, temp, TREE_VEC_ELT (node, i), indent + 4); | 828 print_node (file, temp, TREE_VEC_ELT (node, i), indent + 4); |
880 } | 829 } |
881 break; | 830 break; |
882 | 831 |
883 case CONSTRUCTOR: | 832 case CONSTRUCTOR: |
884 { | 833 { |
885 unsigned HOST_WIDE_INT cnt; | 834 unsigned HOST_WIDE_INT cnt; |
886 tree index, value; | 835 tree index, value; |
887 len = VEC_length (constructor_elt, CONSTRUCTOR_ELTS (node)); | 836 len = CONSTRUCTOR_NELTS (node); |
888 fprintf (file, " lngt %d", len); | 837 fprintf (file, " length:%d", len); |
889 FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (node), | 838 FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (node), |
890 cnt, index, value) | 839 cnt, index, value) |
891 { | 840 { |
892 print_node (file, "idx", index, indent + 4); | 841 print_node (file, "idx", index, indent + 4, false); |
893 print_node (file, "val", value, indent + 4); | 842 print_node (file, "val", value, indent + 4, false); |
894 } | 843 } |
895 } | 844 } |
896 break; | 845 break; |
897 | 846 |
898 case STATEMENT_LIST: | 847 case STATEMENT_LIST: |
913 /* Not printing the addresses of the (not-a-tree) | 862 /* Not printing the addresses of the (not-a-tree) |
914 'struct tree_stmt_list_node's. */ | 863 'struct tree_stmt_list_node's. */ |
915 print_node (file, "stmt", tsi_stmt (i), indent + 4); | 864 print_node (file, "stmt", tsi_stmt (i), indent + 4); |
916 } | 865 } |
917 } | 866 } |
918 print_node (file, "chain", TREE_CHAIN (node), indent + 4); | |
919 break; | 867 break; |
920 | 868 |
921 case BLOCK: | 869 case BLOCK: |
922 print_node (file, "vars", BLOCK_VARS (node), indent + 4); | 870 print_node (file, "vars", BLOCK_VARS (node), indent + 4); |
923 print_node (file, "supercontext", BLOCK_SUPERCONTEXT (node), | 871 print_node (file, "supercontext", BLOCK_SUPERCONTEXT (node), |
928 BLOCK_ABSTRACT_ORIGIN (node), indent + 4); | 876 BLOCK_ABSTRACT_ORIGIN (node), indent + 4); |
929 break; | 877 break; |
930 | 878 |
931 case SSA_NAME: | 879 case SSA_NAME: |
932 print_node_brief (file, "var", SSA_NAME_VAR (node), indent + 4); | 880 print_node_brief (file, "var", SSA_NAME_VAR (node), indent + 4); |
881 indent_to (file, indent + 4); | |
933 fprintf (file, "def_stmt "); | 882 fprintf (file, "def_stmt "); |
934 print_gimple_stmt (file, SSA_NAME_DEF_STMT (node), indent + 4, 0); | 883 { |
884 pretty_printer buffer; | |
885 buffer.buffer->stream = file; | |
886 pp_gimple_stmt_1 (&buffer, SSA_NAME_DEF_STMT (node), indent + 4, 0); | |
887 pp_flush (&buffer); | |
888 } | |
935 | 889 |
936 indent_to (file, indent + 4); | 890 indent_to (file, indent + 4); |
937 fprintf (file, "version %u", SSA_NAME_VERSION (node)); | 891 fprintf (file, "version:%u", SSA_NAME_VERSION (node)); |
938 if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (node)) | 892 if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (node)) |
939 fprintf (file, " in-abnormal-phi"); | 893 fprintf (file, " in-abnormal-phi"); |
940 if (SSA_NAME_IN_FREE_LIST (node)) | 894 if (SSA_NAME_IN_FREE_LIST (node)) |
941 fprintf (file, " in-free-list"); | 895 fprintf (file, " in-free-list"); |
942 | 896 |
954 fprintf (file, " %s", | 908 fprintf (file, " %s", |
955 omp_clause_code_name[OMP_CLAUSE_CODE (node)]); | 909 omp_clause_code_name[OMP_CLAUSE_CODE (node)]); |
956 for (i = 0; i < omp_clause_num_ops[OMP_CLAUSE_CODE (node)]; i++) | 910 for (i = 0; i < omp_clause_num_ops[OMP_CLAUSE_CODE (node)]; i++) |
957 { | 911 { |
958 indent_to (file, indent + 4); | 912 indent_to (file, indent + 4); |
959 fprintf (file, "op %d:", i); | 913 fprintf (file, "op-%d:", i); |
960 print_node_brief (file, "", OMP_CLAUSE_OPERAND (node, i), 0); | 914 print_node_brief (file, "", OMP_CLAUSE_OPERAND (node, i), 0); |
961 } | 915 } |
962 } | 916 } |
963 break; | 917 break; |
964 | 918 |
968 | 922 |
969 case TARGET_OPTION_NODE: | 923 case TARGET_OPTION_NODE: |
970 cl_target_option_print (file, indent + 4, TREE_TARGET_OPTION (node)); | 924 cl_target_option_print (file, indent + 4, TREE_TARGET_OPTION (node)); |
971 break; | 925 break; |
972 case IMPORTED_DECL: | 926 case IMPORTED_DECL: |
973 fprintf (file, " imported declaration"); | 927 fprintf (file, " imported-declaration"); |
974 print_node_brief (file, "associated declaration", | 928 print_node_brief (file, "associated-declaration", |
975 IMPORTED_DECL_ASSOCIATED_DECL (node), | 929 IMPORTED_DECL_ASSOCIATED_DECL (node), |
930 indent + 4); | |
931 break; | |
932 | |
933 case TREE_BINFO: | |
934 fprintf (file, " bases:%d", | |
935 vec_safe_length (BINFO_BASE_BINFOS (node))); | |
936 print_node_brief (file, "offset", BINFO_OFFSET (node), indent + 4); | |
937 print_node_brief (file, "virtuals", BINFO_VIRTUALS (node), | |
938 indent + 4); | |
939 print_node_brief (file, "inheritance-chain", | |
940 BINFO_INHERITANCE_CHAIN (node), | |
976 indent + 4); | 941 indent + 4); |
977 break; | 942 break; |
978 | 943 |
979 default: | 944 default: |
980 if (EXCEPTIONAL_CLASS_P (node)) | 945 if (EXCEPTIONAL_CLASS_P (node)) |
988 if (EXPR_HAS_LOCATION (node)) | 953 if (EXPR_HAS_LOCATION (node)) |
989 { | 954 { |
990 expanded_location xloc = expand_location (EXPR_LOCATION (node)); | 955 expanded_location xloc = expand_location (EXPR_LOCATION (node)); |
991 indent_to (file, indent+4); | 956 indent_to (file, indent+4); |
992 fprintf (file, "%s:%d:%d", xloc.file, xloc.line, xloc.column); | 957 fprintf (file, "%s:%d:%d", xloc.file, xloc.line, xloc.column); |
958 | |
959 /* Print the range, if any */ | |
960 source_range r = EXPR_LOCATION_RANGE (node); | |
961 if (r.m_start) | |
962 { | |
963 xloc = expand_location (r.m_start); | |
964 fprintf (file, " start: %s:%d:%d", xloc.file, xloc.line, xloc.column); | |
965 } | |
966 else | |
967 { | |
968 fprintf (file, " start: unknown"); | |
969 } | |
970 if (r.m_finish) | |
971 { | |
972 xloc = expand_location (r.m_finish); | |
973 fprintf (file, " finish: %s:%d:%d", xloc.file, xloc.line, xloc.column); | |
974 } | |
975 else | |
976 { | |
977 fprintf (file, " finish: unknown"); | |
978 } | |
993 } | 979 } |
994 | 980 |
995 fprintf (file, ">"); | 981 fprintf (file, ">"); |
996 } | 982 } |
997 | 983 |
998 /* Print the tree vector VEC in full on file FILE, preceded by PREFIX, | 984 |
999 starting in column INDENT. */ | 985 /* Print the node NODE on standard error, for debugging. |
1000 | 986 Most nodes referred to by this one are printed recursively |
1001 void | 987 down to a depth of six. */ |
1002 print_vec_tree (FILE *file, const char *prefix, VEC(tree,gc) *vec, int indent) | 988 |
989 DEBUG_FUNCTION void | |
990 debug_tree (tree node) | |
991 { | |
992 table = new hash_set<tree> (HASH_SIZE); | |
993 print_node (stderr, "", node, 0); | |
994 delete table; | |
995 table = NULL; | |
996 putc ('\n', stderr); | |
997 } | |
998 | |
999 DEBUG_FUNCTION void | |
1000 debug_raw (const tree_node &ref) | |
1001 { | |
1002 debug_tree (const_cast <tree> (&ref)); | |
1003 } | |
1004 | |
1005 DEBUG_FUNCTION void | |
1006 debug_raw (const tree_node *ptr) | |
1007 { | |
1008 if (ptr) | |
1009 debug_raw (*ptr); | |
1010 else | |
1011 fprintf (stderr, "<nil>\n"); | |
1012 } | |
1013 | |
1014 static void | |
1015 dump_tree_via_hooks (const tree_node *ptr, dump_flags_t options) | |
1016 { | |
1017 if (DECL_P (ptr)) | |
1018 lang_hooks.print_decl (stderr, const_cast <tree_node*> (ptr), 0); | |
1019 else if (TYPE_P (ptr)) | |
1020 lang_hooks.print_type (stderr, const_cast <tree_node*> (ptr), 0); | |
1021 else if (TREE_CODE (ptr) == IDENTIFIER_NODE) | |
1022 lang_hooks.print_identifier (stderr, const_cast <tree_node*> (ptr), 0); | |
1023 else | |
1024 print_generic_expr (stderr, const_cast <tree_node*> (ptr), options); | |
1025 fprintf (stderr, "\n"); | |
1026 } | |
1027 | |
1028 DEBUG_FUNCTION void | |
1029 debug (const tree_node &ref) | |
1030 { | |
1031 dump_tree_via_hooks (&ref, 0); | |
1032 } | |
1033 | |
1034 DEBUG_FUNCTION void | |
1035 debug (const tree_node *ptr) | |
1036 { | |
1037 if (ptr) | |
1038 debug (*ptr); | |
1039 else | |
1040 fprintf (stderr, "<nil>\n"); | |
1041 } | |
1042 | |
1043 DEBUG_FUNCTION void | |
1044 debug_head (const tree_node &ref) | |
1045 { | |
1046 debug (ref); | |
1047 } | |
1048 | |
1049 DEBUG_FUNCTION void | |
1050 debug_head (const tree_node *ptr) | |
1051 { | |
1052 if (ptr) | |
1053 debug_head (*ptr); | |
1054 else | |
1055 fprintf (stderr, "<nil>\n"); | |
1056 } | |
1057 | |
1058 DEBUG_FUNCTION void | |
1059 debug_body (const tree_node &ref) | |
1060 { | |
1061 if (TREE_CODE (&ref) == FUNCTION_DECL) | |
1062 dump_function_to_file (const_cast <tree_node*> (&ref), stderr, 0); | |
1063 else | |
1064 debug (ref); | |
1065 } | |
1066 | |
1067 DEBUG_FUNCTION void | |
1068 debug_body (const tree_node *ptr) | |
1069 { | |
1070 if (ptr) | |
1071 debug_body (*ptr); | |
1072 else | |
1073 fprintf (stderr, "<nil>\n"); | |
1074 } | |
1075 | |
1076 /* Print the vector of trees VEC on standard error, for debugging. | |
1077 Most nodes referred to by this one are printed recursively | |
1078 down to a depth of six. */ | |
1079 | |
1080 DEBUG_FUNCTION void | |
1081 debug_raw (vec<tree, va_gc> &ref) | |
1003 { | 1082 { |
1004 tree elt; | 1083 tree elt; |
1005 unsigned ix; | 1084 unsigned ix; |
1006 | 1085 |
1007 /* Indent to the specified column, since this is the long form. */ | |
1008 indent_to (file, indent); | |
1009 | |
1010 /* Print the slot this node is in, and its code, and address. */ | 1086 /* Print the slot this node is in, and its code, and address. */ |
1011 fprintf (file, "%s <VEC", prefix); | 1087 fprintf (stderr, "<VEC"); |
1012 dump_addr (file, " ", vec); | 1088 dump_addr (stderr, " ", ref.address ()); |
1013 | 1089 |
1014 FOR_EACH_VEC_ELT (tree, vec, ix, elt) | 1090 FOR_EACH_VEC_ELT (ref, ix, elt) |
1015 { | 1091 { |
1016 char temp[10]; | 1092 fprintf (stderr, "elt:%d ", ix); |
1017 sprintf (temp, "elt %d", ix); | 1093 debug_raw (elt); |
1018 print_node (file, temp, elt, indent + 4); | 1094 } |
1019 } | 1095 } |
1020 } | 1096 |
1097 DEBUG_FUNCTION void | |
1098 debug (vec<tree, va_gc> &ref) | |
1099 { | |
1100 tree elt; | |
1101 unsigned ix; | |
1102 | |
1103 /* Print the slot this node is in, and its code, and address. */ | |
1104 fprintf (stderr, "<VEC"); | |
1105 dump_addr (stderr, " ", ref.address ()); | |
1106 | |
1107 FOR_EACH_VEC_ELT (ref, ix, elt) | |
1108 { | |
1109 fprintf (stderr, "elt:%d ", ix); | |
1110 debug (elt); | |
1111 } | |
1112 } | |
1113 | |
1114 DEBUG_FUNCTION void | |
1115 debug (vec<tree, va_gc> *ptr) | |
1116 { | |
1117 if (ptr) | |
1118 debug (*ptr); | |
1119 else | |
1120 fprintf (stderr, "<nil>\n"); | |
1121 } | |
1122 | |
1123 DEBUG_FUNCTION void | |
1124 debug_raw (vec<tree, va_gc> *ptr) | |
1125 { | |
1126 if (ptr) | |
1127 debug_raw (*ptr); | |
1128 else | |
1129 fprintf (stderr, "<nil>\n"); | |
1130 } | |
1131 | |
1132 DEBUG_FUNCTION void | |
1133 debug_vec_tree (vec<tree, va_gc> *vec) | |
1134 { | |
1135 debug_raw (vec); | |
1136 } |