00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include "config.h"
00024 #include "system.h"
00025 #include "coretypes.h"
00026 #include "tm.h"
00027 #include "tree.h"
00028 #include "real.h"
00029 #include "ggc.h"
00030 #include "langhooks.h"
00031 #include "tree-iterator.h"
00032
00033
00034
00035
00036 #define HASH_SIZE 37
00037
00038 struct bucket
00039 {
00040 tree node;
00041 struct bucket *next;
00042 };
00043
00044 static struct bucket **table;
00045
00046
00047
00048
00049
00050 void
00051 debug_tree (tree node)
00052 {
00053 table = XCNEWVEC (struct bucket *, HASH_SIZE);
00054 print_node (stderr, "", node, 0);
00055 free (table);
00056 table = 0;
00057 putc ('\n', stderr);
00058 }
00059
00060
00061 void
00062 dump_addr (FILE *file, const char *prefix, void *addr)
00063 {
00064 if (flag_dump_noaddr || flag_dump_unnumbered)
00065 fprintf (file, "%s#", prefix);
00066 else
00067 fprintf (file, "%s%p", prefix, addr);
00068 }
00069
00070
00071
00072 void
00073 print_node_brief (FILE *file, const char *prefix, tree node, int indent)
00074 {
00075 enum tree_code_class class;
00076
00077 if (node == 0)
00078 return;
00079
00080 class = TREE_CODE_CLASS (TREE_CODE (node));
00081
00082
00083
00084 if (indent > 0)
00085 fprintf (file, " ");
00086 fprintf (file, "%s <%s", prefix, tree_code_name[(int) TREE_CODE (node)]);
00087 dump_addr (file, " ", node);
00088
00089 if (class == tcc_declaration)
00090 {
00091 if (DECL_NAME (node))
00092 fprintf (file, " %s", IDENTIFIER_POINTER (DECL_NAME (node)));
00093 else if (TREE_CODE (node) == LABEL_DECL
00094 && LABEL_DECL_UID (node) != -1)
00095 fprintf (file, " L." HOST_WIDE_INT_PRINT_DEC, LABEL_DECL_UID (node));
00096 else
00097 fprintf (file, " %c.%u", TREE_CODE (node) == CONST_DECL ? 'C' : 'D',
00098 DECL_UID (node));
00099 }
00100 else if (class == tcc_type)
00101 {
00102 if (TYPE_NAME (node))
00103 {
00104 if (TREE_CODE (TYPE_NAME (node)) == IDENTIFIER_NODE)
00105 fprintf (file, " %s", IDENTIFIER_POINTER (TYPE_NAME (node)));
00106 else if (TREE_CODE (TYPE_NAME (node)) == TYPE_DECL
00107 && DECL_NAME (TYPE_NAME (node)))
00108 fprintf (file, " %s",
00109 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (node))));
00110 }
00111 }
00112 if (TREE_CODE (node) == IDENTIFIER_NODE)
00113 fprintf (file, " %s", IDENTIFIER_POINTER (node));
00114
00115
00116 if (TREE_CODE (node) == INTEGER_CST)
00117 {
00118 if (TREE_CONSTANT_OVERFLOW (node))
00119 fprintf (file, " overflow");
00120
00121 fprintf (file, " ");
00122 if (TREE_INT_CST_HIGH (node) == 0)
00123 fprintf (file, HOST_WIDE_INT_PRINT_UNSIGNED, TREE_INT_CST_LOW (node));
00124 else if (TREE_INT_CST_HIGH (node) == -1
00125 && TREE_INT_CST_LOW (node) != 0)
00126 fprintf (file, "-" HOST_WIDE_INT_PRINT_UNSIGNED,
00127 -TREE_INT_CST_LOW (node));
00128 else
00129 fprintf (file, HOST_WIDE_INT_PRINT_DOUBLE_HEX,
00130 TREE_INT_CST_HIGH (node), TREE_INT_CST_LOW (node));
00131 }
00132 if (TREE_CODE (node) == REAL_CST)
00133 {
00134 REAL_VALUE_TYPE d;
00135
00136 if (TREE_OVERFLOW (node))
00137 fprintf (file, " overflow");
00138
00139 d = TREE_REAL_CST (node);
00140 if (REAL_VALUE_ISINF (d))
00141 fprintf (file, REAL_VALUE_NEGATIVE (d) ? " -Inf" : " Inf");
00142 else if (REAL_VALUE_ISNAN (d))
00143 fprintf (file, " Nan");
00144 else
00145 {
00146 char string[60];
00147 real_to_decimal (string, &d, sizeof (string), 0, 1);
00148 fprintf (file, " %s", string);
00149 }
00150 }
00151
00152 fprintf (file, ">");
00153 }
00154
00155 void
00156 indent_to (FILE *file, int column)
00157 {
00158 int i;
00159
00160
00161 if (column > 0)
00162 fprintf (file, "\n");
00163 for (i = 0; i < column; i++)
00164 fprintf (file, " ");
00165 }
00166
00167
00168
00169
00170 void
00171 print_node (FILE *file, const char *prefix, tree node, int indent)
00172 {
00173 int hash;
00174 struct bucket *b;
00175 enum machine_mode mode;
00176 enum tree_code_class class;
00177 int len;
00178 int i;
00179 expanded_location xloc;
00180 enum tree_code code;
00181
00182 if (node == 0)
00183 return;
00184
00185 code = TREE_CODE (node);
00186 class = TREE_CODE_CLASS (code);
00187
00188
00189
00190
00191
00192 if (indent > 24)
00193 {
00194 print_node_brief (file, prefix, node, indent);
00195 return;
00196 }
00197
00198 if (indent > 8 && (class == tcc_type || class == tcc_declaration))
00199 {
00200 print_node_brief (file, prefix, node, indent);
00201 return;
00202 }
00203
00204
00205 if (TREE_CODE (node) == ERROR_MARK)
00206 {
00207 print_node_brief (file, prefix, node, indent);
00208 return;
00209 }
00210
00211 hash = ((unsigned long) node) % HASH_SIZE;
00212
00213
00214 for (b = table[hash]; b; b = b->next)
00215 if (b->node == node)
00216 {
00217 print_node_brief (file, prefix, node, indent);
00218 return;
00219 }
00220
00221
00222 b = XNEW (struct bucket);
00223 b->node = node;
00224 b->next = table[hash];
00225 table[hash] = b;
00226
00227
00228 indent_to (file, indent);
00229
00230
00231 fprintf (file, "%s <%s", prefix, tree_code_name[(int) TREE_CODE (node)]);
00232 dump_addr (file, " ", node);
00233
00234
00235 if (class == tcc_declaration)
00236 {
00237 if (DECL_NAME (node))
00238 fprintf (file, " %s", IDENTIFIER_POINTER (DECL_NAME (node)));
00239 else if (TREE_CODE (node) == LABEL_DECL
00240 && LABEL_DECL_UID (node) != -1)
00241 fprintf (file, " L." HOST_WIDE_INT_PRINT_DEC, LABEL_DECL_UID (node));
00242 else
00243 fprintf (file, " %c.%u", TREE_CODE (node) == CONST_DECL ? 'C' : 'D',
00244 DECL_UID (node));
00245 }
00246 else if (class == tcc_type)
00247 {
00248 if (TYPE_NAME (node))
00249 {
00250 if (TREE_CODE (TYPE_NAME (node)) == IDENTIFIER_NODE)
00251 fprintf (file, " %s", IDENTIFIER_POINTER (TYPE_NAME (node)));
00252 else if (TREE_CODE (TYPE_NAME (node)) == TYPE_DECL
00253 && DECL_NAME (TYPE_NAME (node)))
00254 fprintf (file, " %s",
00255 IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (node))));
00256 }
00257 }
00258 if (TREE_CODE (node) == IDENTIFIER_NODE)
00259 fprintf (file, " %s", IDENTIFIER_POINTER (node));
00260
00261 if (TREE_CODE (node) == INTEGER_CST)
00262 {
00263 if (indent <= 4)
00264 print_node_brief (file, "type", TREE_TYPE (node), indent + 4);
00265 }
00266 else
00267 {
00268 print_node (file, "type", TREE_TYPE (node), indent + 4);
00269 if (TREE_TYPE (node))
00270 indent_to (file, indent + 3);
00271 }
00272
00273 if (!TYPE_P (node) && TREE_SIDE_EFFECTS (node))
00274 fputs (" side-effects", file);
00275
00276 if (TYPE_P (node) ? TYPE_READONLY (node) : TREE_READONLY (node))
00277 fputs (" readonly", file);
00278 if (!TYPE_P (node) && TREE_CONSTANT (node))
00279 fputs (" constant", file);
00280 else if (TYPE_P (node) && TYPE_SIZES_GIMPLIFIED (node))
00281 fputs (" sizes-gimplified", file);
00282
00283 if (TREE_INVARIANT (node))
00284 fputs (" invariant", file);
00285 if (TREE_ADDRESSABLE (node))
00286 fputs (" addressable", file);
00287 if (TREE_THIS_VOLATILE (node))
00288 fputs (" volatile", file);
00289 if (TREE_ASM_WRITTEN (node))
00290 fputs (" asm_written", file);
00291 if (TREE_USED (node))
00292 fputs (" used", file);
00293 if (TREE_NOTHROW (node))
00294 fputs (TYPE_P (node) ? " align-ok" : " nothrow", file);
00295 if (TREE_PUBLIC (node))
00296 fputs (" public", file);
00297 if (TREE_PRIVATE (node))
00298 fputs (" private", file);
00299 if (TREE_PROTECTED (node))
00300 fputs (" protected", file);
00301 if (TREE_STATIC (node))
00302 fputs (" static", file);
00303 if (TREE_DEPRECATED (node))
00304 fputs (" deprecated", file);
00305 if (TREE_VISITED (node))
00306 fputs (" visited", file);
00307 if (TREE_LANG_FLAG_0 (node))
00308 fputs (" tree_0", file);
00309 if (TREE_LANG_FLAG_1 (node))
00310 fputs (" tree_1", file);
00311 if (TREE_LANG_FLAG_2 (node))
00312 fputs (" tree_2", file);
00313 if (TREE_LANG_FLAG_3 (node))
00314 fputs (" tree_3", file);
00315 if (TREE_LANG_FLAG_4 (node))
00316 fputs (" tree_4", file);
00317 if (TREE_LANG_FLAG_5 (node))
00318 fputs (" tree_5", file);
00319 if (TREE_LANG_FLAG_6 (node))
00320 fputs (" tree_6", file);
00321
00322
00323
00324 switch (TREE_CODE_CLASS (TREE_CODE (node)))
00325 {
00326 case tcc_declaration:
00327 if (CODE_CONTAINS_STRUCT (code, TS_DECL_COMMON))
00328 {
00329 if (DECL_UNSIGNED (node))
00330 fputs (" unsigned", file);
00331 if (DECL_IGNORED_P (node))
00332 fputs (" ignored", file);
00333 if (DECL_ABSTRACT (node))
00334 fputs (" abstract", file);
00335 if (DECL_EXTERNAL (node))
00336 fputs (" external", file);
00337 if (DECL_NONLOCAL (node))
00338 fputs (" nonlocal", file);
00339 }
00340 if (CODE_CONTAINS_STRUCT (code, TS_DECL_WITH_VIS))
00341 {
00342 if (DECL_WEAK (node))
00343 fputs (" weak", file);
00344 if (DECL_IN_SYSTEM_HEADER (node))
00345 fputs (" in_system_header", file);
00346 }
00347 if (CODE_CONTAINS_STRUCT (code, TS_DECL_WRTL)
00348 && TREE_CODE (node) != LABEL_DECL
00349 && TREE_CODE (node) != FUNCTION_DECL
00350 && DECL_REGISTER (node))
00351 fputs (" regdecl", file);
00352
00353 if (TREE_CODE (node) == TYPE_DECL && TYPE_DECL_SUPPRESS_DEBUG (node))
00354 fputs (" suppress-debug", file);
00355
00356 if (TREE_CODE (node) == FUNCTION_DECL && DECL_INLINE (node))
00357 fputs (DECL_DECLARED_INLINE_P (node) ? " inline" : " autoinline", file);
00358 if (TREE_CODE (node) == FUNCTION_DECL && DECL_BUILT_IN (node))
00359 fputs (" built-in", file);
00360 if (TREE_CODE (node) == FUNCTION_DECL && DECL_NO_STATIC_CHAIN (node))
00361 fputs (" no-static-chain", file);
00362
00363 if (TREE_CODE (node) == FIELD_DECL && DECL_PACKED (node))
00364 fputs (" packed", file);
00365 if (TREE_CODE (node) == FIELD_DECL && DECL_BIT_FIELD (node))
00366 fputs (" bit-field", file);
00367 if (TREE_CODE (node) == FIELD_DECL && DECL_NONADDRESSABLE_P (node))
00368 fputs (" nonaddressable", file);
00369
00370 if (TREE_CODE (node) == LABEL_DECL && DECL_ERROR_ISSUED (node))
00371 fputs (" error-issued", file);
00372
00373 if (TREE_CODE (node) == VAR_DECL && DECL_IN_TEXT_SECTION (node))
00374 fputs (" in-text-section", file);
00375 if (TREE_CODE (node) == VAR_DECL && DECL_COMMON (node))
00376 fputs (" common", file);
00377 if (TREE_CODE (node) == VAR_DECL && DECL_THREAD_LOCAL_P (node))
00378 {
00379 enum tls_model kind = DECL_TLS_MODEL (node);
00380 switch (kind)
00381 {
00382 case TLS_MODEL_GLOBAL_DYNAMIC:
00383 fputs (" tls-global-dynamic", file);
00384 break;
00385 case TLS_MODEL_LOCAL_DYNAMIC:
00386 fputs (" tls-local-dynamic", file);
00387 break;
00388 case TLS_MODEL_INITIAL_EXEC:
00389 fputs (" tls-initial-exec", file);
00390 break;
00391 case TLS_MODEL_LOCAL_EXEC:
00392 fputs (" tls-local-exec", file);
00393 break;
00394 default:
00395 gcc_unreachable ();
00396 }
00397 }
00398
00399 if (CODE_CONTAINS_STRUCT (code, TS_DECL_COMMON))
00400 {
00401 if (DECL_VIRTUAL_P (node))
00402 fputs (" virtual", file);
00403 if (DECL_PRESERVE_P (node))
00404 fputs (" preserve", file);
00405 if (DECL_LANG_FLAG_0 (node))
00406 fputs (" decl_0", file);
00407 if (DECL_LANG_FLAG_1 (node))
00408 fputs (" decl_1", file);
00409 if (DECL_LANG_FLAG_2 (node))
00410 fputs (" decl_2", file);
00411 if (DECL_LANG_FLAG_3 (node))
00412 fputs (" decl_3", file);
00413 if (DECL_LANG_FLAG_4 (node))
00414 fputs (" decl_4", file);
00415 if (DECL_LANG_FLAG_5 (node))
00416 fputs (" decl_5", file);
00417 if (DECL_LANG_FLAG_6 (node))
00418 fputs (" decl_6", file);
00419 if (DECL_LANG_FLAG_7 (node))
00420 fputs (" decl_7", file);
00421
00422 mode = DECL_MODE (node);
00423 fprintf (file, " %s", GET_MODE_NAME (mode));
00424 }
00425
00426 if (CODE_CONTAINS_STRUCT (code, TS_DECL_WITH_VIS) && DECL_DEFER_OUTPUT (node))
00427 fputs (" defer-output", file);
00428
00429
00430 xloc = expand_location (DECL_SOURCE_LOCATION (node));
00431 fprintf (file, " file %s line %d", xloc.file, xloc.line);
00432
00433 if (CODE_CONTAINS_STRUCT (code, TS_DECL_COMMON))
00434 {
00435 print_node (file, "size", DECL_SIZE (node), indent + 4);
00436 print_node (file, "unit size", DECL_SIZE_UNIT (node), indent + 4);
00437
00438 if (TREE_CODE (node) != FUNCTION_DECL
00439 || DECL_INLINE (node) || DECL_BUILT_IN (node))
00440 indent_to (file, indent + 3);
00441
00442 if (TREE_CODE (node) != FUNCTION_DECL)
00443 {
00444 if (DECL_USER_ALIGN (node))
00445 fprintf (file, " user");
00446
00447 fprintf (file, " align %d", DECL_ALIGN (node));
00448 if (TREE_CODE (node) == FIELD_DECL)
00449 fprintf (file, " offset_align " HOST_WIDE_INT_PRINT_UNSIGNED,
00450 DECL_OFFSET_ALIGN (node));
00451 }
00452 else if (DECL_BUILT_IN (node))
00453 {
00454 if (DECL_BUILT_IN_CLASS (node) == BUILT_IN_MD)
00455 fprintf (file, " built-in BUILT_IN_MD %d", DECL_FUNCTION_CODE (node));
00456 else
00457 fprintf (file, " built-in %s:%s",
00458 built_in_class_names[(int) DECL_BUILT_IN_CLASS (node)],
00459 built_in_names[(int) DECL_FUNCTION_CODE (node)]);
00460 }
00461
00462 if (DECL_POINTER_ALIAS_SET_KNOWN_P (node))
00463 fprintf (file, " alias set " HOST_WIDE_INT_PRINT_DEC,
00464 DECL_POINTER_ALIAS_SET (node));
00465 }
00466 if (TREE_CODE (node) == FIELD_DECL)
00467 {
00468 print_node (file, "offset", DECL_FIELD_OFFSET (node), indent + 4);
00469 print_node (file, "bit offset", DECL_FIELD_BIT_OFFSET (node),
00470 indent + 4);
00471 if (DECL_BIT_FIELD_TYPE (node))
00472 print_node (file, "bit_field_type", DECL_BIT_FIELD_TYPE (node),
00473 indent + 4);
00474 }
00475
00476 print_node_brief (file, "context", DECL_CONTEXT (node), indent + 4);
00477
00478 if (CODE_CONTAINS_STRUCT (code, TS_DECL_COMMON))
00479 {
00480 print_node_brief (file, "attributes",
00481 DECL_ATTRIBUTES (node), indent + 4);
00482 print_node_brief (file, "initial", DECL_INITIAL (node), indent + 4);
00483 }
00484 if (CODE_CONTAINS_STRUCT (code, TS_DECL_WRTL))
00485 {
00486 print_node_brief (file, "abstract_origin",
00487 DECL_ABSTRACT_ORIGIN (node), indent + 4);
00488 }
00489 if (CODE_CONTAINS_STRUCT (code, TS_DECL_NON_COMMON))
00490 {
00491 print_node (file, "arguments", DECL_ARGUMENT_FLD (node), indent + 4);
00492 print_node (file, "result", DECL_RESULT_FLD (node), indent + 4);
00493 }
00494
00495 lang_hooks.print_decl (file, node, indent);
00496
00497 if (DECL_RTL_SET_P (node))
00498 {
00499 indent_to (file, indent + 4);
00500 print_rtl (file, DECL_RTL (node));
00501 }
00502
00503 if (TREE_CODE (node) == PARM_DECL)
00504 {
00505 print_node (file, "arg-type", DECL_ARG_TYPE (node), indent + 4);
00506
00507 if (DECL_INCOMING_RTL (node) != 0)
00508 {
00509 indent_to (file, indent + 4);
00510 fprintf (file, "incoming-rtl ");
00511 print_rtl (file, DECL_INCOMING_RTL (node));
00512 }
00513 }
00514 else if (TREE_CODE (node) == FUNCTION_DECL
00515 && DECL_STRUCT_FUNCTION (node) != 0)
00516 {
00517 indent_to (file, indent + 4);
00518 dump_addr (file, "saved-insns ", DECL_STRUCT_FUNCTION (node));
00519 }
00520
00521 if ((TREE_CODE (node) == VAR_DECL || TREE_CODE (node) == PARM_DECL)
00522 && DECL_HAS_VALUE_EXPR_P (node))
00523 print_node (file, "value-expr", DECL_VALUE_EXPR (node), indent + 4);
00524
00525 if (TREE_CODE (node) == STRUCT_FIELD_TAG)
00526 {
00527 fprintf (file, " sft size " HOST_WIDE_INT_PRINT_DEC,
00528 SFT_SIZE (node));
00529 fprintf (file, " sft offset " HOST_WIDE_INT_PRINT_DEC,
00530 SFT_OFFSET (node));
00531 print_node_brief (file, "parent var", SFT_PARENT_VAR (node),
00532 indent + 4);
00533 }
00534
00535 if (indent == 4)
00536 print_node (file, "chain", TREE_CHAIN (node), indent + 4);
00537 else
00538 print_node_brief (file, "chain", TREE_CHAIN (node), indent + 4);
00539 break;
00540
00541 case tcc_type:
00542 if (TYPE_UNSIGNED (node))
00543 fputs (" unsigned", file);
00544
00545
00546
00547 if ((TREE_CODE (node) == RECORD_TYPE
00548 || TREE_CODE (node) == UNION_TYPE
00549 || TREE_CODE (node) == QUAL_UNION_TYPE)
00550 && TYPE_NO_FORCE_BLK (node))
00551 fputs (" no-force-blk", file);
00552 else if (TREE_CODE (node) == INTEGER_TYPE
00553 && TYPE_IS_SIZETYPE (node))
00554 fputs (" sizetype", file);
00555 else if (TREE_CODE (node) == FUNCTION_TYPE
00556 && TYPE_RETURNS_STACK_DEPRESSED (node))
00557 fputs (" returns-stack-depressed", file);
00558
00559 if (TYPE_STRING_FLAG (node))
00560 fputs (" string-flag", file);
00561 if (TYPE_NEEDS_CONSTRUCTING (node))
00562 fputs (" needs-constructing", file);
00563
00564
00565
00566 if (TREE_CODE (node) == UNION_TYPE && TYPE_TRANSPARENT_UNION (node))
00567 fputs (" transparent-union", file);
00568 else if (TREE_CODE (node) == ARRAY_TYPE
00569 && TYPE_NONALIASED_COMPONENT (node))
00570 fputs (" nonaliased-component", file);
00571
00572 if (TYPE_PACKED (node))
00573 fputs (" packed", file);
00574
00575 if (TYPE_RESTRICT (node))
00576 fputs (" restrict", file);
00577
00578 if (TYPE_LANG_FLAG_0 (node))
00579 fputs (" type_0", file);
00580 if (TYPE_LANG_FLAG_1 (node))
00581 fputs (" type_1", file);
00582 if (TYPE_LANG_FLAG_2 (node))
00583 fputs (" type_2", file);
00584 if (TYPE_LANG_FLAG_3 (node))
00585 fputs (" type_3", file);
00586 if (TYPE_LANG_FLAG_4 (node))
00587 fputs (" type_4", file);
00588 if (TYPE_LANG_FLAG_5 (node))
00589 fputs (" type_5", file);
00590 if (TYPE_LANG_FLAG_6 (node))
00591 fputs (" type_6", file);
00592
00593 mode = TYPE_MODE (node);
00594 fprintf (file, " %s", GET_MODE_NAME (mode));
00595
00596 print_node (file, "size", TYPE_SIZE (node), indent + 4);
00597 print_node (file, "unit size", TYPE_SIZE_UNIT (node), indent + 4);
00598 indent_to (file, indent + 3);
00599
00600 if (TYPE_USER_ALIGN (node))
00601 fprintf (file, " user");
00602
00603 fprintf (file, " align %d symtab %d alias set " HOST_WIDE_INT_PRINT_DEC,
00604 TYPE_ALIGN (node), TYPE_SYMTAB_ADDRESS (node),
00605 TYPE_ALIAS_SET (node));
00606
00607 print_node (file, "attributes", TYPE_ATTRIBUTES (node), indent + 4);
00608
00609 if (INTEGRAL_TYPE_P (node) || TREE_CODE (node) == REAL_TYPE)
00610 {
00611 fprintf (file, " precision %d", TYPE_PRECISION (node));
00612 print_node_brief (file, "min", TYPE_MIN_VALUE (node), indent + 4);
00613 print_node_brief (file, "max", TYPE_MAX_VALUE (node), indent + 4);
00614 }
00615
00616 if (TREE_CODE (node) == ENUMERAL_TYPE)
00617 print_node (file, "values", TYPE_VALUES (node), indent + 4);
00618 else if (TREE_CODE (node) == ARRAY_TYPE)
00619 print_node (file, "domain", TYPE_DOMAIN (node), indent + 4);
00620 else if (TREE_CODE (node) == VECTOR_TYPE)
00621 fprintf (file, " nunits %d", (int) TYPE_VECTOR_SUBPARTS (node));
00622 else if (TREE_CODE (node) == RECORD_TYPE
00623 || TREE_CODE (node) == UNION_TYPE
00624 || TREE_CODE (node) == QUAL_UNION_TYPE)
00625 print_node (file, "fields", TYPE_FIELDS (node), indent + 4);
00626 else if (TREE_CODE (node) == FUNCTION_TYPE
00627 || TREE_CODE (node) == METHOD_TYPE)
00628 {
00629 if (TYPE_METHOD_BASETYPE (node))
00630 print_node_brief (file, "method basetype",
00631 TYPE_METHOD_BASETYPE (node), indent + 4);
00632 print_node (file, "arg-types", TYPE_ARG_TYPES (node), indent + 4);
00633 }
00634 else if (TREE_CODE (node) == OFFSET_TYPE)
00635 print_node_brief (file, "basetype", TYPE_OFFSET_BASETYPE (node),
00636 indent + 4);
00637
00638 if (TYPE_CONTEXT (node))
00639 print_node_brief (file, "context", TYPE_CONTEXT (node), indent + 4);
00640
00641 lang_hooks.print_type (file, node, indent);
00642
00643 if (TYPE_POINTER_TO (node) || TREE_CHAIN (node))
00644 indent_to (file, indent + 3);
00645
00646 print_node_brief (file, "pointer_to_this", TYPE_POINTER_TO (node),
00647 indent + 4);
00648 print_node_brief (file, "reference_to_this", TYPE_REFERENCE_TO (node),
00649 indent + 4);
00650 print_node_brief (file, "chain", TREE_CHAIN (node), indent + 4);
00651 break;
00652
00653 case tcc_expression:
00654 case tcc_comparison:
00655 case tcc_unary:
00656 case tcc_binary:
00657 case tcc_reference:
00658 case tcc_statement:
00659 if (TREE_CODE (node) == BIT_FIELD_REF && BIT_FIELD_REF_UNSIGNED (node))
00660 fputs (" unsigned", file);
00661 if (TREE_CODE (node) == BIND_EXPR)
00662 {
00663 print_node (file, "vars", TREE_OPERAND (node, 0), indent + 4);
00664 print_node (file, "body", TREE_OPERAND (node, 1), indent + 4);
00665 print_node (file, "block", TREE_OPERAND (node, 2), indent + 4);
00666 break;
00667 }
00668
00669 len = TREE_CODE_LENGTH (TREE_CODE (node));
00670
00671 for (i = 0; i < len; i++)
00672 {
00673 char temp[10];
00674
00675 sprintf (temp, "arg %d", i);
00676 print_node (file, temp, TREE_OPERAND (node, i), indent + 4);
00677 }
00678
00679 print_node (file, "chain", TREE_CHAIN (node), indent + 4);
00680 break;
00681
00682 case tcc_constant:
00683 case tcc_exceptional:
00684 switch (TREE_CODE (node))
00685 {
00686 case INTEGER_CST:
00687 if (TREE_CONSTANT_OVERFLOW (node))
00688 fprintf (file, " overflow");
00689
00690 fprintf (file, " ");
00691 if (TREE_INT_CST_HIGH (node) == 0)
00692 fprintf (file, HOST_WIDE_INT_PRINT_UNSIGNED,
00693 TREE_INT_CST_LOW (node));
00694 else if (TREE_INT_CST_HIGH (node) == -1
00695 && TREE_INT_CST_LOW (node) != 0)
00696 fprintf (file, "-" HOST_WIDE_INT_PRINT_UNSIGNED,
00697 -TREE_INT_CST_LOW (node));
00698 else
00699 fprintf (file, HOST_WIDE_INT_PRINT_DOUBLE_HEX,
00700 TREE_INT_CST_HIGH (node), TREE_INT_CST_LOW (node));
00701 break;
00702
00703 case REAL_CST:
00704 {
00705 REAL_VALUE_TYPE d;
00706
00707 if (TREE_OVERFLOW (node))
00708 fprintf (file, " overflow");
00709
00710 d = TREE_REAL_CST (node);
00711 if (REAL_VALUE_ISINF (d))
00712 fprintf (file, REAL_VALUE_NEGATIVE (d) ? " -Inf" : " Inf");
00713 else if (REAL_VALUE_ISNAN (d))
00714 fprintf (file, " Nan");
00715 else
00716 {
00717 char string[64];
00718 real_to_decimal (string, &d, sizeof (string), 0, 1);
00719 fprintf (file, " %s", string);
00720 }
00721 }
00722 break;
00723
00724 case VECTOR_CST:
00725 {
00726 tree vals = TREE_VECTOR_CST_ELTS (node);
00727 char buf[10];
00728 tree link;
00729 int i;
00730
00731 i = 0;
00732 for (link = vals; link; link = TREE_CHAIN (link), ++i)
00733 {
00734 sprintf (buf, "elt%d: ", i);
00735 print_node (file, buf, TREE_VALUE (link), indent + 4);
00736 }
00737 }
00738 break;
00739
00740 case COMPLEX_CST:
00741 print_node (file, "real", TREE_REALPART (node), indent + 4);
00742 print_node (file, "imag", TREE_IMAGPART (node), indent + 4);
00743 break;
00744
00745 case STRING_CST:
00746 {
00747 const char *p = TREE_STRING_POINTER (node);
00748 int i = TREE_STRING_LENGTH (node);
00749 fputs (" \"", file);
00750 while (--i >= 0)
00751 {
00752 char ch = *p++;
00753 if (ch >= ' ' && ch < 127)
00754 putc (ch, file);
00755 else
00756 fprintf(file, "\\%03o", ch & 0xFF);
00757 }
00758 fputc ('\"', file);
00759 }
00760
00761 if (indent == 4)
00762 print_node (file, "chain", TREE_CHAIN (node), indent + 4);
00763 else
00764 print_node_brief (file, "chain", TREE_CHAIN (node), indent + 4);
00765 break;
00766
00767 case IDENTIFIER_NODE:
00768 lang_hooks.print_identifier (file, node, indent);
00769 break;
00770
00771 case TREE_LIST:
00772 print_node (file, "purpose", TREE_PURPOSE (node), indent + 4);
00773 print_node (file, "value", TREE_VALUE (node), indent + 4);
00774 print_node (file, "chain", TREE_CHAIN (node), indent + 4);
00775 break;
00776
00777 case TREE_VEC:
00778 len = TREE_VEC_LENGTH (node);
00779 for (i = 0; i < len; i++)
00780 if (TREE_VEC_ELT (node, i))
00781 {
00782 char temp[10];
00783 sprintf (temp, "elt %d", i);
00784 indent_to (file, indent + 4);
00785 print_node_brief (file, temp, TREE_VEC_ELT (node, i), 0);
00786 }
00787 break;
00788
00789 case STATEMENT_LIST:
00790 dump_addr (file, " head ", node->stmt_list.head);
00791 dump_addr (file, " tail ", node->stmt_list.tail);
00792 fprintf (file, " stmts");
00793 {
00794 tree_stmt_iterator i;
00795 for (i = tsi_start (node); !tsi_end_p (i); tsi_next (&i))
00796 {
00797
00798
00799 dump_addr (file, " ", tsi_stmt (i));
00800 }
00801 fprintf (file, "\n");
00802 for (i = tsi_start (node); !tsi_end_p (i); tsi_next (&i))
00803 {
00804
00805
00806 print_node (file, "stmt", tsi_stmt (i), indent + 4);
00807 }
00808 }
00809 print_node (file, "chain", TREE_CHAIN (node), indent + 4);
00810 break;
00811
00812 case BLOCK:
00813 print_node (file, "vars", BLOCK_VARS (node), indent + 4);
00814 print_node (file, "supercontext", BLOCK_SUPERCONTEXT (node),
00815 indent + 4);
00816 print_node (file, "subblocks", BLOCK_SUBBLOCKS (node), indent + 4);
00817 print_node (file, "chain", BLOCK_CHAIN (node), indent + 4);
00818 print_node (file, "abstract_origin",
00819 BLOCK_ABSTRACT_ORIGIN (node), indent + 4);
00820 break;
00821
00822 case SSA_NAME:
00823 print_node_brief (file, "var", SSA_NAME_VAR (node), indent + 4);
00824 print_node_brief (file, "def_stmt",
00825 SSA_NAME_DEF_STMT (node), indent + 4);
00826
00827 indent_to (file, indent + 4);
00828 fprintf (file, "version %u", SSA_NAME_VERSION (node));
00829 if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (node))
00830 fprintf (file, " in-abnormal-phi");
00831 if (SSA_NAME_IN_FREE_LIST (node))
00832 fprintf (file, " in-free-list");
00833
00834 if (SSA_NAME_PTR_INFO (node)
00835 || SSA_NAME_VALUE (node))
00836 {
00837 indent_to (file, indent + 3);
00838 if (SSA_NAME_PTR_INFO (node))
00839 dump_addr (file, " ptr-info ", SSA_NAME_PTR_INFO (node));
00840 if (SSA_NAME_VALUE (node))
00841 dump_addr (file, " value ", SSA_NAME_VALUE (node));
00842 }
00843 break;
00844
00845 case OMP_CLAUSE:
00846 {
00847 int i;
00848 fprintf (file, " %s",
00849 omp_clause_code_name[OMP_CLAUSE_CODE (node)]);
00850 for (i = 0; i < omp_clause_num_ops[OMP_CLAUSE_CODE (node)]; i++)
00851 {
00852 indent_to (file, indent + 4);
00853 fprintf (file, "op %d:", i);
00854 print_node_brief (file, "", OMP_CLAUSE_OPERAND (node, i), 0);
00855 }
00856 }
00857 break;
00858
00859 default:
00860 if (EXCEPTIONAL_CLASS_P (node))
00861 lang_hooks.print_xnode (file, node, indent);
00862 break;
00863 }
00864
00865 break;
00866 }
00867
00868 if (EXPR_HAS_LOCATION (node))
00869 {
00870 expanded_location xloc = expand_location (EXPR_LOCATION (node));
00871 indent_to (file, indent+4);
00872 fprintf (file, "%s:%d", xloc.file, xloc.line);
00873 }
00874
00875 fprintf (file, ">");
00876 }