]>
Commit | Line | Data |
---|---|---|
bccafa26 | 1 | /* Prints out tree in human readable form - GCC |
f1717362 | 2 | Copyright (C) 1990-2016 Free Software Foundation, Inc. |
3ff560b7 | 3 | |
f12b58b3 | 4 | This file is part of GCC. |
3ff560b7 | 5 | |
f12b58b3 | 6 | GCC is free software; you can redistribute it and/or modify it under |
7 | the terms of the GNU General Public License as published by the Free | |
8c4c00c1 | 8 | Software Foundation; either version 3, or (at your option) any later |
f12b58b3 | 9 | version. |
3ff560b7 | 10 | |
f12b58b3 | 11 | GCC is distributed in the hope that it will be useful, but WITHOUT ANY |
12 | WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
13 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
14 | for more details. | |
3ff560b7 | 15 | |
16 | You should have received a copy of the GNU General Public License | |
8c4c00c1 | 17 | along with GCC; see the file COPYING3. If not see |
18 | <http://www.gnu.org/licenses/>. */ | |
3ff560b7 | 19 | |
20 | ||
21 | #include "config.h" | |
405711de | 22 | #include "system.h" |
805e22b2 | 23 | #include "coretypes.h" |
24 | #include "tm.h" | |
3ff560b7 | 25 | #include "tree.h" |
7c29e30e | 26 | #include "cgraph.h" |
27 | #include "diagnostic.h" | |
9ed99284 | 28 | #include "varasm.h" |
29 | #include "print-rtl.h" | |
30 | #include "stor-layout.h" | |
b7fced5e | 31 | #include "langhooks.h" |
c54d9523 | 32 | #include "tree-iterator.h" |
b9ed1410 | 33 | #include "gimple-pretty-print.h" /* FIXME */ |
073c1fd5 | 34 | #include "tree-cfg.h" |
c7d89805 | 35 | #include "tree-dump.h" |
3ff560b7 | 36 | |
3ff560b7 | 37 | /* Define the hash table of nodes already seen. |
38 | Such nodes are not repeated; brief cross-references are used. */ | |
39 | ||
40 | #define HASH_SIZE 37 | |
41 | ||
42 | struct bucket | |
43 | { | |
44 | tree node; | |
45 | struct bucket *next; | |
46 | }; | |
47 | ||
48 | static struct bucket **table; | |
49 | ||
969239ad | 50 | /* Print PREFIX and ADDR to FILE. */ |
51 | void | |
5d1b319b | 52 | dump_addr (FILE *file, const char *prefix, const void *addr) |
969239ad | 53 | { |
54 | if (flag_dump_noaddr || flag_dump_unnumbered) | |
55 | fprintf (file, "%s#", prefix); | |
56 | else | |
038ca0d1 | 57 | fprintf (file, "%s" HOST_PTR_PRINTF, prefix, addr); |
969239ad | 58 | } |
59 | ||
3ff560b7 | 60 | /* Print a node in brief fashion, with just the code, address and name. */ |
61 | ||
62 | void | |
5d1b319b | 63 | print_node_brief (FILE *file, const char *prefix, const_tree node, int indent) |
3ff560b7 | 64 | { |
f4e36c33 | 65 | enum tree_code_class tclass; |
3ff560b7 | 66 | |
67 | if (node == 0) | |
68 | return; | |
69 | ||
f4e36c33 | 70 | tclass = TREE_CODE_CLASS (TREE_CODE (node)); |
3ff560b7 | 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, " "); | |
f3d35d4d | 76 | fprintf (file, "%s <%s", prefix, get_tree_code_name (TREE_CODE (node))); |
969239ad | 77 | dump_addr (file, " ", node); |
3ff560b7 | 78 | |
f4e36c33 | 79 | if (tclass == tcc_declaration) |
3ff560b7 | 80 | { |
81 | if (DECL_NAME (node)) | |
82 | fprintf (file, " %s", IDENTIFIER_POINTER (DECL_NAME (node))); | |
7d6139b9 | 83 | else if (TREE_CODE (node) == LABEL_DECL |
84 | && LABEL_DECL_UID (node) != -1) | |
00753696 | 85 | { |
86 | if (dump_flags & TDF_NOUID) | |
87 | fprintf (file, " L.xxxx"); | |
88 | else | |
89 | fprintf (file, " L.%d", (int) LABEL_DECL_UID (node)); | |
90 | } | |
7d6139b9 | 91 | else |
00753696 | 92 | { |
93 | if (dump_flags & TDF_NOUID) | |
94 | fprintf (file, " %c.xxxx", | |
95 | TREE_CODE (node) == CONST_DECL ? 'C' : 'D'); | |
96 | else | |
97 | fprintf (file, " %c.%u", | |
98 | TREE_CODE (node) == CONST_DECL ? 'C' : 'D', | |
99 | DECL_UID (node)); | |
100 | } | |
3ff560b7 | 101 | } |
f4e36c33 | 102 | else if (tclass == tcc_type) |
3ff560b7 | 103 | { |
104 | if (TYPE_NAME (node)) | |
105 | { | |
106 | if (TREE_CODE (TYPE_NAME (node)) == IDENTIFIER_NODE) | |
107 | fprintf (file, " %s", IDENTIFIER_POINTER (TYPE_NAME (node))); | |
108 | else if (TREE_CODE (TYPE_NAME (node)) == TYPE_DECL | |
109 | && DECL_NAME (TYPE_NAME (node))) | |
110 | fprintf (file, " %s", | |
111 | IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (node)))); | |
112 | } | |
bd1a81f7 | 113 | if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node))) |
114 | fprintf (file, " address-space-%d", TYPE_ADDR_SPACE (node)); | |
3ff560b7 | 115 | } |
116 | if (TREE_CODE (node) == IDENTIFIER_NODE) | |
117 | fprintf (file, " %s", IDENTIFIER_POINTER (node)); | |
16de2a82 | 118 | |
119 | /* We might as well always print the value of an integer or real. */ | |
3ff560b7 | 120 | if (TREE_CODE (node) == INTEGER_CST) |
121 | { | |
f96bd2bf | 122 | if (TREE_OVERFLOW (node)) |
5575b8e4 | 123 | fprintf (file, " overflow"); |
124 | ||
9656bfb2 | 125 | fprintf (file, " "); |
ab2c1de8 | 126 | print_dec (node, file, TYPE_SIGN (TREE_TYPE (node))); |
3ff560b7 | 127 | } |
128 | if (TREE_CODE (node) == REAL_CST) | |
129 | { | |
e50f2bd2 | 130 | REAL_VALUE_TYPE d; |
131 | ||
127c4264 | 132 | if (TREE_OVERFLOW (node)) |
133 | fprintf (file, " overflow"); | |
134 | ||
e50f2bd2 | 135 | d = TREE_REAL_CST (node); |
127c4264 | 136 | if (REAL_VALUE_ISINF (d)) |
85a76dc8 | 137 | fprintf (file, REAL_VALUE_NEGATIVE (d) ? " -Inf" : " Inf"); |
127c4264 | 138 | else if (REAL_VALUE_ISNAN (d)) |
139 | fprintf (file, " Nan"); | |
140 | else | |
141 | { | |
c7fbc741 | 142 | char string[60]; |
143 | real_to_decimal (string, &d, sizeof (string), 0, 1); | |
127c4264 | 144 | fprintf (file, " %s", string); |
145 | } | |
3ff560b7 | 146 | } |
06f0b99c | 147 | if (TREE_CODE (node) == FIXED_CST) |
148 | { | |
149 | FIXED_VALUE_TYPE f; | |
150 | char string[60]; | |
151 | ||
152 | if (TREE_OVERFLOW (node)) | |
153 | fprintf (file, " overflow"); | |
154 | ||
155 | f = TREE_FIXED_CST (node); | |
156 | fixed_to_decimal (string, &f, sizeof (string)); | |
157 | fprintf (file, " %s", string); | |
158 | } | |
3ff560b7 | 159 | |
160 | fprintf (file, ">"); | |
161 | } | |
162 | ||
163 | void | |
3ad4992f | 164 | indent_to (FILE *file, int column) |
3ff560b7 | 165 | { |
166 | int i; | |
167 | ||
168 | /* Since this is the long way, indent to desired column. */ | |
169 | if (column > 0) | |
170 | fprintf (file, "\n"); | |
171 | for (i = 0; i < column; i++) | |
172 | fprintf (file, " "); | |
173 | } | |
174 | \f | |
175 | /* Print the node NODE in full on file FILE, preceded by PREFIX, | |
176 | starting in column INDENT. */ | |
177 | ||
178 | void | |
3ad4992f | 179 | print_node (FILE *file, const char *prefix, tree node, int indent) |
3ff560b7 | 180 | { |
181 | int hash; | |
182 | struct bucket *b; | |
3754d046 | 183 | machine_mode mode; |
f4e36c33 | 184 | enum tree_code_class tclass; |
3ff560b7 | 185 | int len; |
3ff560b7 | 186 | int i; |
2ed8b5d0 | 187 | expanded_location xloc; |
5ded8c6f | 188 | enum tree_code code; |
3ff560b7 | 189 | |
190 | if (node == 0) | |
191 | return; | |
48e1416a | 192 | |
5ded8c6f | 193 | code = TREE_CODE (node); |
f4e36c33 | 194 | tclass = TREE_CODE_CLASS (code); |
3ff560b7 | 195 | |
196 | /* Don't get too deep in nesting. If the user wants to see deeper, | |
197 | it is easy to use the address of a lowest-level node | |
198 | as an argument in another call to debug_tree. */ | |
199 | ||
200 | if (indent > 24) | |
201 | { | |
202 | print_node_brief (file, prefix, node, indent); | |
203 | return; | |
204 | } | |
205 | ||
f4e36c33 | 206 | if (indent > 8 && (tclass == tcc_type || tclass == tcc_declaration)) |
3ff560b7 | 207 | { |
208 | print_node_brief (file, prefix, node, indent); | |
209 | return; | |
210 | } | |
211 | ||
41a6f238 | 212 | /* It is unsafe to look at any other fields of an ERROR_MARK node. */ |
e9b9a7d6 | 213 | if (code == ERROR_MARK) |
3ff560b7 | 214 | { |
215 | print_node_brief (file, prefix, node, indent); | |
216 | return; | |
217 | } | |
218 | ||
46412a37 | 219 | /* Allow this function to be called if the table is not there. */ |
220 | if (table) | |
221 | { | |
660200d2 | 222 | hash = ((uintptr_t) node) % HASH_SIZE; |
48e1416a | 223 | |
46412a37 | 224 | /* If node is in the table, just mention its address. */ |
225 | for (b = table[hash]; b; b = b->next) | |
226 | if (b->node == node) | |
227 | { | |
228 | print_node_brief (file, prefix, node, indent); | |
229 | return; | |
230 | } | |
48e1416a | 231 | |
46412a37 | 232 | /* Add this node to the table. */ |
233 | b = XNEW (struct bucket); | |
234 | b->node = node; | |
235 | b->next = table[hash]; | |
236 | table[hash] = b; | |
237 | } | |
3ff560b7 | 238 | |
239 | /* Indent to the specified column, since this is the long form. */ | |
240 | indent_to (file, indent); | |
241 | ||
242 | /* Print the slot this node is in, and its code, and address. */ | |
f3d35d4d | 243 | fprintf (file, "%s <%s", prefix, get_tree_code_name (code)); |
969239ad | 244 | dump_addr (file, " ", node); |
3ff560b7 | 245 | |
246 | /* Print the name, if any. */ | |
f4e36c33 | 247 | if (tclass == tcc_declaration) |
3ff560b7 | 248 | { |
249 | if (DECL_NAME (node)) | |
250 | fprintf (file, " %s", IDENTIFIER_POINTER (DECL_NAME (node))); | |
e9b9a7d6 | 251 | else if (code == LABEL_DECL |
7d6139b9 | 252 | && LABEL_DECL_UID (node) != -1) |
00753696 | 253 | { |
254 | if (dump_flags & TDF_NOUID) | |
255 | fprintf (file, " L.xxxx"); | |
256 | else | |
257 | fprintf (file, " L.%d", (int) LABEL_DECL_UID (node)); | |
258 | } | |
7d6139b9 | 259 | else |
00753696 | 260 | { |
261 | if (dump_flags & TDF_NOUID) | |
262 | fprintf (file, " %c.xxxx", code == CONST_DECL ? 'C' : 'D'); | |
263 | else | |
264 | fprintf (file, " %c.%u", code == CONST_DECL ? 'C' : 'D', | |
265 | DECL_UID (node)); | |
266 | } | |
3ff560b7 | 267 | } |
f4e36c33 | 268 | else if (tclass == tcc_type) |
3ff560b7 | 269 | { |
270 | if (TYPE_NAME (node)) | |
271 | { | |
272 | if (TREE_CODE (TYPE_NAME (node)) == IDENTIFIER_NODE) | |
273 | fprintf (file, " %s", IDENTIFIER_POINTER (TYPE_NAME (node))); | |
274 | else if (TREE_CODE (TYPE_NAME (node)) == TYPE_DECL | |
275 | && DECL_NAME (TYPE_NAME (node))) | |
276 | fprintf (file, " %s", | |
277 | IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (node)))); | |
278 | } | |
279 | } | |
e9b9a7d6 | 280 | if (code == IDENTIFIER_NODE) |
3ff560b7 | 281 | fprintf (file, " %s", IDENTIFIER_POINTER (node)); |
282 | ||
e9b9a7d6 | 283 | if (code == INTEGER_CST) |
3ff560b7 | 284 | { |
285 | if (indent <= 4) | |
286 | print_node_brief (file, "type", TREE_TYPE (node), indent + 4); | |
287 | } | |
58ee5a30 | 288 | else if (CODE_CONTAINS_STRUCT (code, TS_TYPED)) |
3ff560b7 | 289 | { |
290 | print_node (file, "type", TREE_TYPE (node), indent + 4); | |
291 | if (TREE_TYPE (node)) | |
292 | indent_to (file, indent + 3); | |
3ff560b7 | 293 | } |
294 | ||
66d12a6c | 295 | if (!TYPE_P (node) && TREE_SIDE_EFFECTS (node)) |
3ff560b7 | 296 | fputs (" side-effects", file); |
66d12a6c | 297 | |
298 | if (TYPE_P (node) ? TYPE_READONLY (node) : TREE_READONLY (node)) | |
3ff560b7 | 299 | fputs (" readonly", file); |
b560fabd | 300 | if (TYPE_P (node) && TYPE_ATOMIC (node)) |
301 | fputs (" atomic", file); | |
66d12a6c | 302 | if (!TYPE_P (node) && TREE_CONSTANT (node)) |
3ff560b7 | 303 | fputs (" constant", file); |
7d6139b9 | 304 | else if (TYPE_P (node) && TYPE_SIZES_GIMPLIFIED (node)) |
305 | fputs (" sizes-gimplified", file); | |
306 | ||
bd1a81f7 | 307 | if (TYPE_P (node) && !ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node))) |
308 | fprintf (file, " address-space-%d", TYPE_ADDR_SPACE (node)); | |
309 | ||
3ff560b7 | 310 | if (TREE_ADDRESSABLE (node)) |
311 | fputs (" addressable", file); | |
312 | if (TREE_THIS_VOLATILE (node)) | |
313 | fputs (" volatile", file); | |
3ff560b7 | 314 | if (TREE_ASM_WRITTEN (node)) |
315 | fputs (" asm_written", file); | |
316 | if (TREE_USED (node)) | |
317 | fputs (" used", file); | |
00dd2e9e | 318 | if (TREE_NOTHROW (node)) |
9f5f9308 | 319 | fputs (TYPE_P (node) ? " align-ok" : " nothrow", file); |
3ff560b7 | 320 | if (TREE_PUBLIC (node)) |
321 | fputs (" public", file); | |
c5d7050a | 322 | if (TREE_PRIVATE (node)) |
323 | fputs (" private", file); | |
324 | if (TREE_PROTECTED (node)) | |
325 | fputs (" protected", file); | |
3ff560b7 | 326 | if (TREE_STATIC (node)) |
327 | fputs (" static", file); | |
88da234d | 328 | if (TREE_DEPRECATED (node)) |
329 | fputs (" deprecated", file); | |
4ee9c684 | 330 | if (TREE_VISITED (node)) |
331 | fputs (" visited", file); | |
5ea7bc9d | 332 | |
e913b5cd | 333 | if (code != TREE_VEC && code != INTEGER_CST && code != SSA_NAME) |
5ea7bc9d | 334 | { |
335 | if (TREE_LANG_FLAG_0 (node)) | |
336 | fputs (" tree_0", file); | |
337 | if (TREE_LANG_FLAG_1 (node)) | |
338 | fputs (" tree_1", file); | |
339 | if (TREE_LANG_FLAG_2 (node)) | |
340 | fputs (" tree_2", file); | |
341 | if (TREE_LANG_FLAG_3 (node)) | |
342 | fputs (" tree_3", file); | |
343 | if (TREE_LANG_FLAG_4 (node)) | |
344 | fputs (" tree_4", file); | |
345 | if (TREE_LANG_FLAG_5 (node)) | |
346 | fputs (" tree_5", file); | |
347 | if (TREE_LANG_FLAG_6 (node)) | |
348 | fputs (" tree_6", file); | |
349 | } | |
3ff560b7 | 350 | |
351 | /* DECL_ nodes have additional attributes. */ | |
352 | ||
e9b9a7d6 | 353 | switch (TREE_CODE_CLASS (code)) |
3ff560b7 | 354 | { |
ce45a448 | 355 | case tcc_declaration: |
437f5d6b | 356 | if (CODE_CONTAINS_STRUCT (code, TS_DECL_COMMON)) |
357 | { | |
358 | if (DECL_UNSIGNED (node)) | |
359 | fputs (" unsigned", file); | |
360 | if (DECL_IGNORED_P (node)) | |
361 | fputs (" ignored", file); | |
16d41ae2 | 362 | if (DECL_ABSTRACT_P (node)) |
48e1416a | 363 | fputs (" abstract", file); |
437f5d6b | 364 | if (DECL_EXTERNAL (node)) |
365 | fputs (" external", file); | |
366 | if (DECL_NONLOCAL (node)) | |
367 | fputs (" nonlocal", file); | |
368 | } | |
5ded8c6f | 369 | if (CODE_CONTAINS_STRUCT (code, TS_DECL_WITH_VIS)) |
370 | { | |
371 | if (DECL_WEAK (node)) | |
372 | fputs (" weak", file); | |
373 | if (DECL_IN_SYSTEM_HEADER (node)) | |
374 | fputs (" in_system_header", file); | |
375 | } | |
376 | if (CODE_CONTAINS_STRUCT (code, TS_DECL_WRTL) | |
e9b9a7d6 | 377 | && code != LABEL_DECL |
378 | && code != FUNCTION_DECL | |
5ded8c6f | 379 | && DECL_REGISTER (node)) |
380 | fputs (" regdecl", file); | |
5c5a04c6 | 381 | |
e9b9a7d6 | 382 | if (code == TYPE_DECL && TYPE_DECL_SUPPRESS_DEBUG (node)) |
e770cc2d | 383 | fputs (" suppress-debug", file); |
5c5a04c6 | 384 | |
e9b9a7d6 | 385 | if (code == FUNCTION_DECL |
46f8e3b0 | 386 | && DECL_FUNCTION_SPECIFIC_TARGET (node)) |
387 | fputs (" function-specific-target", file); | |
e9b9a7d6 | 388 | if (code == FUNCTION_DECL |
46f8e3b0 | 389 | && DECL_FUNCTION_SPECIFIC_OPTIMIZATION (node)) |
390 | fputs (" function-specific-opt", file); | |
e9b9a7d6 | 391 | if (code == FUNCTION_DECL && DECL_DECLARED_INLINE_P (node)) |
8d8c4c8d | 392 | fputs (" autoinline", file); |
e9b9a7d6 | 393 | if (code == FUNCTION_DECL && DECL_BUILT_IN (node)) |
5c5a04c6 | 394 | fputs (" built-in", file); |
3bb63aeb | 395 | if (code == FUNCTION_DECL && DECL_STATIC_CHAIN (node)) |
396 | fputs (" static-chain", file); | |
4c0315d0 | 397 | if (TREE_CODE (node) == FUNCTION_DECL && decl_is_tm_clone (node)) |
398 | fputs (" tm-clone", file); | |
5c5a04c6 | 399 | |
e9b9a7d6 | 400 | if (code == FIELD_DECL && DECL_PACKED (node)) |
b8e0d419 | 401 | fputs (" packed", file); |
e9b9a7d6 | 402 | if (code == FIELD_DECL && DECL_BIT_FIELD (node)) |
3ff560b7 | 403 | fputs (" bit-field", file); |
e9b9a7d6 | 404 | if (code == FIELD_DECL && DECL_NONADDRESSABLE_P (node)) |
9dd6501e | 405 | fputs (" nonaddressable", file); |
b8e0d419 | 406 | |
e38def9c | 407 | if (code == LABEL_DECL && EH_LANDING_PAD_NR (node)) |
408 | fprintf (file, " landing-pad:%d", EH_LANDING_PAD_NR (node)); | |
b8e0d419 | 409 | |
e9b9a7d6 | 410 | if (code == VAR_DECL && DECL_IN_TEXT_SECTION (node)) |
5c5a04c6 | 411 | fputs (" in-text-section", file); |
ce5b5189 | 412 | if (code == VAR_DECL && DECL_IN_CONSTANT_POOL (node)) |
413 | fputs (" in-constant-pool", file); | |
e9b9a7d6 | 414 | if (code == VAR_DECL && DECL_COMMON (node)) |
5ded8c6f | 415 | fputs (" common", file); |
e9b9a7d6 | 416 | if (code == VAR_DECL && DECL_THREAD_LOCAL_P (node)) |
1b53eb20 | 417 | { |
b7393cee | 418 | fputs (" ", file); |
419 | fputs (tls_model_names[DECL_TLS_MODEL (node)], file); | |
1b53eb20 | 420 | } |
5c5a04c6 | 421 | |
437f5d6b | 422 | if (CODE_CONTAINS_STRUCT (code, TS_DECL_COMMON)) |
48e1416a | 423 | { |
437f5d6b | 424 | if (DECL_VIRTUAL_P (node)) |
425 | fputs (" virtual", file); | |
426 | if (DECL_PRESERVE_P (node)) | |
66723563 | 427 | fputs (" preserve", file); |
437f5d6b | 428 | if (DECL_LANG_FLAG_0 (node)) |
429 | fputs (" decl_0", file); | |
430 | if (DECL_LANG_FLAG_1 (node)) | |
431 | fputs (" decl_1", file); | |
432 | if (DECL_LANG_FLAG_2 (node)) | |
433 | fputs (" decl_2", file); | |
434 | if (DECL_LANG_FLAG_3 (node)) | |
435 | fputs (" decl_3", file); | |
436 | if (DECL_LANG_FLAG_4 (node)) | |
437 | fputs (" decl_4", file); | |
438 | if (DECL_LANG_FLAG_5 (node)) | |
439 | fputs (" decl_5", file); | |
440 | if (DECL_LANG_FLAG_6 (node)) | |
441 | fputs (" decl_6", file); | |
442 | if (DECL_LANG_FLAG_7 (node)) | |
443 | fputs (" decl_7", file); | |
48e1416a | 444 | |
437f5d6b | 445 | mode = DECL_MODE (node); |
446 | fprintf (file, " %s", GET_MODE_NAME (mode)); | |
447 | } | |
448 | ||
7ac958de | 449 | if ((code == VAR_DECL || code == PARM_DECL || code == RESULT_DECL) |
450 | && DECL_BY_REFERENCE (node)) | |
451 | fputs (" passed-by-reference", file); | |
452 | ||
5ded8c6f | 453 | if (CODE_CONTAINS_STRUCT (code, TS_DECL_WITH_VIS) && DECL_DEFER_OUTPUT (node)) |
5c5a04c6 | 454 | fputs (" defer-output", file); |
5c5a04c6 | 455 | |
437f5d6b | 456 | |
2ed8b5d0 | 457 | xloc = expand_location (DECL_SOURCE_LOCATION (node)); |
9c85a98a | 458 | fprintf (file, " file %s line %d col %d", xloc.file, xloc.line, |
459 | xloc.column); | |
3ff560b7 | 460 | |
437f5d6b | 461 | if (CODE_CONTAINS_STRUCT (code, TS_DECL_COMMON)) |
48e1416a | 462 | { |
437f5d6b | 463 | print_node (file, "size", DECL_SIZE (node), indent + 4); |
464 | print_node (file, "unit size", DECL_SIZE_UNIT (node), indent + 4); | |
48e1416a | 465 | |
e9b9a7d6 | 466 | if (code != FUNCTION_DECL || DECL_BUILT_IN (node)) |
437f5d6b | 467 | indent_to (file, indent + 3); |
48e1416a | 468 | |
097b5c8b | 469 | if (DECL_USER_ALIGN (node)) |
470 | fprintf (file, " user"); | |
48e1416a | 471 | |
097b5c8b | 472 | fprintf (file, " align %d", DECL_ALIGN (node)); |
e9b9a7d6 | 473 | if (code == FIELD_DECL) |
097b5c8b | 474 | fprintf (file, " offset_align " HOST_WIDE_INT_PRINT_UNSIGNED, |
475 | DECL_OFFSET_ALIGN (node)); | |
476 | ||
e9b9a7d6 | 477 | if (code == FUNCTION_DECL && DECL_BUILT_IN (node)) |
437f5d6b | 478 | { |
479 | if (DECL_BUILT_IN_CLASS (node) == BUILT_IN_MD) | |
480 | fprintf (file, " built-in BUILT_IN_MD %d", DECL_FUNCTION_CODE (node)); | |
481 | else | |
482 | fprintf (file, " built-in %s:%s", | |
483 | built_in_class_names[(int) DECL_BUILT_IN_CLASS (node)], | |
484 | built_in_names[(int) DECL_FUNCTION_CODE (node)]); | |
485 | } | |
c2ff255e | 486 | } |
e9b9a7d6 | 487 | if (code == FIELD_DECL) |
02e7a332 | 488 | { |
489 | print_node (file, "offset", DECL_FIELD_OFFSET (node), indent + 4); | |
490 | print_node (file, "bit offset", DECL_FIELD_BIT_OFFSET (node), | |
491 | indent + 4); | |
c0e47fd4 | 492 | if (DECL_BIT_FIELD_TYPE (node)) |
493 | print_node (file, "bit_field_type", DECL_BIT_FIELD_TYPE (node), | |
494 | indent + 4); | |
02e7a332 | 495 | } |
ab7943b9 | 496 | |
3ff560b7 | 497 | print_node_brief (file, "context", DECL_CONTEXT (node), indent + 4); |
5ded8c6f | 498 | |
48e1416a | 499 | if (CODE_CONTAINS_STRUCT (code, TS_DECL_COMMON)) |
437f5d6b | 500 | { |
501 | print_node_brief (file, "attributes", | |
502 | DECL_ATTRIBUTES (node), indent + 4); | |
48f76b6b | 503 | if (code != PARM_DECL) |
504 | print_node_brief (file, "initial", DECL_INITIAL (node), | |
505 | indent + 4); | |
437f5d6b | 506 | } |
5ded8c6f | 507 | if (CODE_CONTAINS_STRUCT (code, TS_DECL_WRTL)) |
508 | { | |
509 | print_node_brief (file, "abstract_origin", | |
510 | DECL_ABSTRACT_ORIGIN (node), indent + 4); | |
511 | } | |
512 | if (CODE_CONTAINS_STRUCT (code, TS_DECL_NON_COMMON)) | |
513 | { | |
5ded8c6f | 514 | print_node (file, "result", DECL_RESULT_FLD (node), indent + 4); |
515 | } | |
3ff560b7 | 516 | |
dc24ddbd | 517 | lang_hooks.print_decl (file, node, indent); |
3ff560b7 | 518 | |
0e8e37b2 | 519 | if (DECL_RTL_SET_P (node)) |
3ff560b7 | 520 | { |
521 | indent_to (file, indent + 4); | |
522 | print_rtl (file, DECL_RTL (node)); | |
523 | } | |
524 | ||
e9b9a7d6 | 525 | if (code == PARM_DECL) |
b8e0d419 | 526 | { |
a2ef9391 | 527 | print_node (file, "arg-type", DECL_ARG_TYPE (node), indent + 4); |
a2ef9391 | 528 | |
529 | if (DECL_INCOMING_RTL (node) != 0) | |
530 | { | |
531 | indent_to (file, indent + 4); | |
532 | fprintf (file, "incoming-rtl "); | |
533 | print_rtl (file, DECL_INCOMING_RTL (node)); | |
534 | } | |
b8e0d419 | 535 | } |
e9b9a7d6 | 536 | else if (code == FUNCTION_DECL |
cbc44df5 | 537 | && DECL_STRUCT_FUNCTION (node) != 0) |
3ff560b7 | 538 | { |
83c7dcd8 | 539 | print_node (file, "arguments", DECL_ARGUMENTS (node), indent + 4); |
3ff560b7 | 540 | indent_to (file, indent + 4); |
bf09aad8 | 541 | dump_addr (file, "struct-function ", DECL_STRUCT_FUNCTION (node)); |
3ff560b7 | 542 | } |
543 | ||
e9b9a7d6 | 544 | if ((code == VAR_DECL || code == PARM_DECL) |
1e8e9920 | 545 | && DECL_HAS_VALUE_EXPR_P (node)) |
546 | print_node (file, "value-expr", DECL_VALUE_EXPR (node), indent + 4); | |
547 | ||
3ff560b7 | 548 | /* Print the decl chain only if decl is at second level. */ |
549 | if (indent == 4) | |
550 | print_node (file, "chain", TREE_CHAIN (node), indent + 4); | |
551 | else | |
552 | print_node_brief (file, "chain", TREE_CHAIN (node), indent + 4); | |
553 | break; | |
554 | ||
ce45a448 | 555 | case tcc_type: |
86ae60fd | 556 | if (TYPE_UNSIGNED (node)) |
557 | fputs (" unsigned", file); | |
558 | ||
c51f5ca5 | 559 | if (TYPE_NO_FORCE_BLK (node)) |
5c5a04c6 | 560 | fputs (" no-force-blk", file); |
2973ed28 | 561 | |
5c5a04c6 | 562 | if (TYPE_STRING_FLAG (node)) |
563 | fputs (" string-flag", file); | |
c51f5ca5 | 564 | |
5c5a04c6 | 565 | if (TYPE_NEEDS_CONSTRUCTING (node)) |
566 | fputs (" needs-constructing", file); | |
2973ed28 | 567 | |
292237f3 | 568 | if ((code == RECORD_TYPE |
569 | || code == UNION_TYPE | |
570 | || code == QUAL_UNION_TYPE | |
571 | || code == ARRAY_TYPE) | |
572 | && TYPE_REVERSE_STORAGE_ORDER (node)) | |
573 | fputs (" reverse-storage-order", file); | |
574 | ||
8c202488 | 575 | /* The transparent-union flag is used for different things in |
576 | different nodes. */ | |
8df5a43d | 577 | if ((code == UNION_TYPE || code == RECORD_TYPE) |
578 | && TYPE_TRANSPARENT_AGGR (node)) | |
579 | fputs (" transparent-aggr", file); | |
e9b9a7d6 | 580 | else if (code == ARRAY_TYPE |
2973ed28 | 581 | && TYPE_NONALIASED_COMPONENT (node)) |
582 | fputs (" nonaliased-component", file); | |
2973ed28 | 583 | |
1f1dfbdb | 584 | if (TYPE_PACKED (node)) |
585 | fputs (" packed", file); | |
5c5a04c6 | 586 | |
9063fcc8 | 587 | if (TYPE_RESTRICT (node)) |
588 | fputs (" restrict", file); | |
589 | ||
3ff560b7 | 590 | if (TYPE_LANG_FLAG_0 (node)) |
591 | fputs (" type_0", file); | |
592 | if (TYPE_LANG_FLAG_1 (node)) | |
593 | fputs (" type_1", file); | |
594 | if (TYPE_LANG_FLAG_2 (node)) | |
595 | fputs (" type_2", file); | |
596 | if (TYPE_LANG_FLAG_3 (node)) | |
597 | fputs (" type_3", file); | |
598 | if (TYPE_LANG_FLAG_4 (node)) | |
599 | fputs (" type_4", file); | |
600 | if (TYPE_LANG_FLAG_5 (node)) | |
601 | fputs (" type_5", file); | |
602 | if (TYPE_LANG_FLAG_6 (node)) | |
603 | fputs (" type_6", file); | |
604 | ||
605 | mode = TYPE_MODE (node); | |
47c251e5 | 606 | fprintf (file, " %s", GET_MODE_NAME (mode)); |
3ff560b7 | 607 | |
608 | print_node (file, "size", TYPE_SIZE (node), indent + 4); | |
b278476e | 609 | print_node (file, "unit size", TYPE_SIZE_UNIT (node), indent + 4); |
3ff560b7 | 610 | indent_to (file, indent + 3); |
611 | ||
16de2a82 | 612 | if (TYPE_USER_ALIGN (node)) |
613 | fprintf (file, " user"); | |
614 | ||
85aa12f7 | 615 | fprintf (file, " align %d symtab %d alias set " HOST_WIDE_INT_PRINT_DEC, |
616 | TYPE_ALIGN (node), TYPE_SYMTAB_ADDRESS (node), | |
32c2fdea | 617 | (HOST_WIDE_INT) TYPE_ALIAS_SET (node)); |
3ff560b7 | 618 | |
6753bca0 | 619 | if (TYPE_STRUCTURAL_EQUALITY_P (node)) |
620 | fprintf (file, " structural equality"); | |
621 | else | |
622 | dump_addr (file, " canonical type ", TYPE_CANONICAL (node)); | |
48e1416a | 623 | |
506f531e | 624 | print_node (file, "attributes", TYPE_ATTRIBUTES (node), indent + 4); |
625 | ||
e9b9a7d6 | 626 | if (INTEGRAL_TYPE_P (node) || code == REAL_TYPE |
627 | || code == FIXED_POINT_TYPE) | |
3ff560b7 | 628 | { |
629 | fprintf (file, " precision %d", TYPE_PRECISION (node)); | |
16de2a82 | 630 | print_node_brief (file, "min", TYPE_MIN_VALUE (node), indent + 4); |
631 | print_node_brief (file, "max", TYPE_MAX_VALUE (node), indent + 4); | |
3ff560b7 | 632 | } |
16de2a82 | 633 | |
e9b9a7d6 | 634 | if (code == ENUMERAL_TYPE) |
16de2a82 | 635 | print_node (file, "values", TYPE_VALUES (node), indent + 4); |
e9b9a7d6 | 636 | else if (code == ARRAY_TYPE) |
16de2a82 | 637 | print_node (file, "domain", TYPE_DOMAIN (node), indent + 4); |
e9b9a7d6 | 638 | else if (code == VECTOR_TYPE) |
83e2a11b | 639 | fprintf (file, " nunits %d", (int) TYPE_VECTOR_SUBPARTS (node)); |
e9b9a7d6 | 640 | else if (code == RECORD_TYPE |
641 | || code == UNION_TYPE | |
642 | || code == QUAL_UNION_TYPE) | |
3ff560b7 | 643 | print_node (file, "fields", TYPE_FIELDS (node), indent + 4); |
e9b9a7d6 | 644 | else if (code == FUNCTION_TYPE |
645 | || code == METHOD_TYPE) | |
3ff560b7 | 646 | { |
647 | if (TYPE_METHOD_BASETYPE (node)) | |
2973ed28 | 648 | print_node_brief (file, "method basetype", |
649 | TYPE_METHOD_BASETYPE (node), indent + 4); | |
3ff560b7 | 650 | print_node (file, "arg-types", TYPE_ARG_TYPES (node), indent + 4); |
651 | } | |
e9b9a7d6 | 652 | else if (code == OFFSET_TYPE) |
777ddd59 | 653 | print_node_brief (file, "basetype", TYPE_OFFSET_BASETYPE (node), |
654 | indent + 4); | |
16de2a82 | 655 | |
3ff560b7 | 656 | if (TYPE_CONTEXT (node)) |
657 | print_node_brief (file, "context", TYPE_CONTEXT (node), indent + 4); | |
658 | ||
dc24ddbd | 659 | lang_hooks.print_type (file, node, indent); |
3ff560b7 | 660 | |
661 | if (TYPE_POINTER_TO (node) || TREE_CHAIN (node)) | |
662 | indent_to (file, indent + 3); | |
16de2a82 | 663 | |
664 | print_node_brief (file, "pointer_to_this", TYPE_POINTER_TO (node), | |
665 | indent + 4); | |
666 | print_node_brief (file, "reference_to_this", TYPE_REFERENCE_TO (node), | |
667 | indent + 4); | |
3ff560b7 | 668 | print_node_brief (file, "chain", TREE_CHAIN (node), indent + 4); |
669 | break; | |
670 | ||
ce45a448 | 671 | case tcc_expression: |
672 | case tcc_comparison: | |
673 | case tcc_unary: | |
674 | case tcc_binary: | |
675 | case tcc_reference: | |
676 | case tcc_statement: | |
c2f47e15 | 677 | case tcc_vl_exp: |
e9b9a7d6 | 678 | if (code == BIND_EXPR) |
3ff560b7 | 679 | { |
3ff560b7 | 680 | print_node (file, "vars", TREE_OPERAND (node, 0), indent + 4); |
681 | print_node (file, "body", TREE_OPERAND (node, 1), indent + 4); | |
0f0b4dbc | 682 | print_node (file, "block", TREE_OPERAND (node, 2), indent + 4); |
cfb5f4ad | 683 | break; |
3ff560b7 | 684 | } |
e9b9a7d6 | 685 | if (code == CALL_EXPR) |
3ff560b7 | 686 | { |
c2f47e15 | 687 | call_expr_arg_iterator iter; |
688 | tree arg; | |
689 | print_node (file, "fn", CALL_EXPR_FN (node), indent + 4); | |
690 | print_node (file, "static_chain", CALL_EXPR_STATIC_CHAIN (node), | |
691 | indent + 4); | |
692 | i = 0; | |
693 | FOR_EACH_CALL_EXPR_ARG (arg, iter, node) | |
694 | { | |
695 | char temp[10]; | |
696 | sprintf (temp, "arg %d", i); | |
697 | print_node (file, temp, arg, indent + 4); | |
698 | i++; | |
699 | } | |
3ff560b7 | 700 | } |
c2f47e15 | 701 | else |
702 | { | |
703 | len = TREE_OPERAND_LENGTH (node); | |
dae7d8ad | 704 | |
c2f47e15 | 705 | for (i = 0; i < len; i++) |
706 | { | |
707 | char temp[10]; | |
48e1416a | 708 | |
c2f47e15 | 709 | sprintf (temp, "arg %d", i); |
710 | print_node (file, temp, TREE_OPERAND (node, i), indent + 4); | |
711 | } | |
712 | } | |
9b88d08d | 713 | if (CODE_CONTAINS_STRUCT (code, TS_COMMON)) |
714 | print_node (file, "chain", TREE_CHAIN (node), indent + 4); | |
3ff560b7 | 715 | break; |
716 | ||
ce45a448 | 717 | case tcc_constant: |
718 | case tcc_exceptional: | |
e9b9a7d6 | 719 | switch (code) |
3ff560b7 | 720 | { |
721 | case INTEGER_CST: | |
f96bd2bf | 722 | if (TREE_OVERFLOW (node)) |
5575b8e4 | 723 | fprintf (file, " overflow"); |
724 | ||
9656bfb2 | 725 | fprintf (file, " "); |
ab2c1de8 | 726 | print_dec (node, file, TYPE_SIGN (TREE_TYPE (node))); |
3ff560b7 | 727 | break; |
728 | ||
729 | case REAL_CST: | |
3ff560b7 | 730 | { |
e50f2bd2 | 731 | REAL_VALUE_TYPE d; |
732 | ||
127c4264 | 733 | if (TREE_OVERFLOW (node)) |
734 | fprintf (file, " overflow"); | |
735 | ||
e50f2bd2 | 736 | d = TREE_REAL_CST (node); |
127c4264 | 737 | if (REAL_VALUE_ISINF (d)) |
85a76dc8 | 738 | fprintf (file, REAL_VALUE_NEGATIVE (d) ? " -Inf" : " Inf"); |
127c4264 | 739 | else if (REAL_VALUE_ISNAN (d)) |
740 | fprintf (file, " Nan"); | |
741 | else | |
742 | { | |
c7fbc741 | 743 | char string[64]; |
744 | real_to_decimal (string, &d, sizeof (string), 0, 1); | |
127c4264 | 745 | fprintf (file, " %s", string); |
746 | } | |
3ff560b7 | 747 | } |
3ff560b7 | 748 | break; |
749 | ||
06f0b99c | 750 | case FIXED_CST: |
751 | { | |
752 | FIXED_VALUE_TYPE f; | |
753 | char string[64]; | |
754 | ||
755 | if (TREE_OVERFLOW (node)) | |
756 | fprintf (file, " overflow"); | |
757 | ||
758 | f = TREE_FIXED_CST (node); | |
759 | fixed_to_decimal (string, &f, sizeof (string)); | |
760 | fprintf (file, " %s", string); | |
761 | } | |
762 | break; | |
763 | ||
886cfd4f | 764 | case VECTOR_CST: |
765 | { | |
886cfd4f | 766 | char buf[10]; |
fadf62f4 | 767 | unsigned i; |
886cfd4f | 768 | |
fadf62f4 | 769 | for (i = 0; i < VECTOR_CST_NELTS (node); ++i) |
886cfd4f | 770 | { |
fadf62f4 | 771 | sprintf (buf, "elt%u: ", i); |
772 | print_node (file, buf, VECTOR_CST_ELT (node, i), indent + 4); | |
886cfd4f | 773 | } |
774 | } | |
775 | break; | |
776 | ||
3ff560b7 | 777 | case COMPLEX_CST: |
778 | print_node (file, "real", TREE_REALPART (node), indent + 4); | |
779 | print_node (file, "imag", TREE_IMAGPART (node), indent + 4); | |
780 | break; | |
781 | ||
782 | case STRING_CST: | |
7eb2fa37 | 783 | { |
784 | const char *p = TREE_STRING_POINTER (node); | |
785 | int i = TREE_STRING_LENGTH (node); | |
786 | fputs (" \"", file); | |
787 | while (--i >= 0) | |
788 | { | |
789 | char ch = *p++; | |
790 | if (ch >= ' ' && ch < 127) | |
791 | putc (ch, file); | |
792 | else | |
9af5ce0c | 793 | fprintf (file, "\\%03o", ch & 0xFF); |
7eb2fa37 | 794 | } |
795 | fputc ('\"', file); | |
796 | } | |
3ff560b7 | 797 | break; |
798 | ||
799 | case IDENTIFIER_NODE: | |
dc24ddbd | 800 | lang_hooks.print_identifier (file, node, indent); |
3ff560b7 | 801 | break; |
802 | ||
803 | case TREE_LIST: | |
804 | print_node (file, "purpose", TREE_PURPOSE (node), indent + 4); | |
805 | print_node (file, "value", TREE_VALUE (node), indent + 4); | |
806 | print_node (file, "chain", TREE_CHAIN (node), indent + 4); | |
807 | break; | |
808 | ||
809 | case TREE_VEC: | |
810 | len = TREE_VEC_LENGTH (node); | |
a5cb3e80 | 811 | fprintf (file, " length %d", len); |
3ff560b7 | 812 | for (i = 0; i < len; i++) |
0b68d9e6 | 813 | if (TREE_VEC_ELT (node, i)) |
814 | { | |
815 | char temp[10]; | |
816 | sprintf (temp, "elt %d", i); | |
8ee76a8d | 817 | print_node (file, temp, TREE_VEC_ELT (node, i), indent + 4); |
0b68d9e6 | 818 | } |
3ff560b7 | 819 | break; |
820 | ||
930e8175 | 821 | case CONSTRUCTOR: |
822 | { | |
823 | unsigned HOST_WIDE_INT cnt; | |
824 | tree index, value; | |
f1f41a6c | 825 | len = vec_safe_length (CONSTRUCTOR_ELTS (node)); |
930e8175 | 826 | fprintf (file, " lngt %d", len); |
827 | FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (node), | |
828 | cnt, index, value) | |
829 | { | |
830 | print_node (file, "idx", index, indent + 4); | |
831 | print_node (file, "val", value, indent + 4); | |
832 | } | |
833 | } | |
834 | break; | |
835 | ||
c54d9523 | 836 | case STATEMENT_LIST: |
969239ad | 837 | dump_addr (file, " head ", node->stmt_list.head); |
838 | dump_addr (file, " tail ", node->stmt_list.tail); | |
839 | fprintf (file, " stmts"); | |
c54d9523 | 840 | { |
841 | tree_stmt_iterator i; | |
842 | for (i = tsi_start (node); !tsi_end_p (i); tsi_next (&i)) | |
843 | { | |
844 | /* Not printing the addresses of the (not-a-tree) | |
845 | 'struct tree_stmt_list_node's. */ | |
969239ad | 846 | dump_addr (file, " ", tsi_stmt (i)); |
c54d9523 | 847 | } |
848 | fprintf (file, "\n"); | |
849 | for (i = tsi_start (node); !tsi_end_p (i); tsi_next (&i)) | |
850 | { | |
851 | /* Not printing the addresses of the (not-a-tree) | |
852 | 'struct tree_stmt_list_node's. */ | |
853 | print_node (file, "stmt", tsi_stmt (i), indent + 4); | |
854 | } | |
855 | } | |
c54d9523 | 856 | break; |
857 | ||
1acf0298 | 858 | case BLOCK: |
859 | print_node (file, "vars", BLOCK_VARS (node), indent + 4); | |
860 | print_node (file, "supercontext", BLOCK_SUPERCONTEXT (node), | |
861 | indent + 4); | |
862 | print_node (file, "subblocks", BLOCK_SUBBLOCKS (node), indent + 4); | |
863 | print_node (file, "chain", BLOCK_CHAIN (node), indent + 4); | |
864 | print_node (file, "abstract_origin", | |
865 | BLOCK_ABSTRACT_ORIGIN (node), indent + 4); | |
866 | break; | |
867 | ||
c11ba43c | 868 | case SSA_NAME: |
869 | print_node_brief (file, "var", SSA_NAME_VAR (node), indent + 4); | |
75a70cf9 | 870 | fprintf (file, "def_stmt "); |
871 | print_gimple_stmt (file, SSA_NAME_DEF_STMT (node), indent + 4, 0); | |
c11ba43c | 872 | |
873 | indent_to (file, indent + 4); | |
874 | fprintf (file, "version %u", SSA_NAME_VERSION (node)); | |
875 | if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (node)) | |
876 | fprintf (file, " in-abnormal-phi"); | |
877 | if (SSA_NAME_IN_FREE_LIST (node)) | |
878 | fprintf (file, " in-free-list"); | |
879 | ||
f003f9fd | 880 | if (SSA_NAME_PTR_INFO (node)) |
c11ba43c | 881 | { |
882 | indent_to (file, indent + 3); | |
883 | if (SSA_NAME_PTR_INFO (node)) | |
969239ad | 884 | dump_addr (file, " ptr-info ", SSA_NAME_PTR_INFO (node)); |
c11ba43c | 885 | } |
886 | break; | |
887 | ||
55d6e7cd | 888 | case OMP_CLAUSE: |
889 | { | |
890 | int i; | |
891 | fprintf (file, " %s", | |
892 | omp_clause_code_name[OMP_CLAUSE_CODE (node)]); | |
893 | for (i = 0; i < omp_clause_num_ops[OMP_CLAUSE_CODE (node)]; i++) | |
894 | { | |
895 | indent_to (file, indent + 4); | |
896 | fprintf (file, "op %d:", i); | |
897 | print_node_brief (file, "", OMP_CLAUSE_OPERAND (node, i), 0); | |
898 | } | |
899 | } | |
900 | break; | |
901 | ||
46f8e3b0 | 902 | case OPTIMIZATION_NODE: |
903 | cl_optimization_print (file, indent + 4, TREE_OPTIMIZATION (node)); | |
904 | break; | |
905 | ||
906 | case TARGET_OPTION_NODE: | |
907 | cl_target_option_print (file, indent + 4, TREE_TARGET_OPTION (node)); | |
908 | break; | |
5d8a39b7 | 909 | case IMPORTED_DECL: |
910 | fprintf (file, " imported declaration"); | |
911 | print_node_brief (file, "associated declaration", | |
912 | IMPORTED_DECL_ASSOCIATED_DECL (node), | |
913 | indent + 4); | |
914 | break; | |
46f8e3b0 | 915 | |
650b325e | 916 | case TREE_BINFO: |
917 | fprintf (file, " bases %d", | |
918 | vec_safe_length (BINFO_BASE_BINFOS (node))); | |
919 | print_node_brief (file, "offset", BINFO_OFFSET (node), indent + 4); | |
920 | print_node_brief (file, "virtuals", BINFO_VIRTUALS (node), | |
921 | indent + 4); | |
922 | print_node_brief (file, "inheritance chain", | |
923 | BINFO_INHERITANCE_CHAIN (node), | |
924 | indent + 4); | |
925 | break; | |
926 | ||
b4dae43c | 927 | default: |
ce45a448 | 928 | if (EXCEPTIONAL_CLASS_P (node)) |
dc24ddbd | 929 | lang_hooks.print_xnode (file, node, indent); |
b4dae43c | 930 | break; |
3ff560b7 | 931 | } |
932 | ||
933 | break; | |
934 | } | |
9e718c95 | 935 | |
4ee9c684 | 936 | if (EXPR_HAS_LOCATION (node)) |
937 | { | |
2ed8b5d0 | 938 | expanded_location xloc = expand_location (EXPR_LOCATION (node)); |
4ee9c684 | 939 | indent_to (file, indent+4); |
9c85a98a | 940 | fprintf (file, "%s:%d:%d", xloc.file, xloc.line, xloc.column); |
a96cefb2 | 941 | |
942 | /* Print the range, if any */ | |
943 | source_range r = EXPR_LOCATION_RANGE (node); | |
944 | if (r.m_start) | |
945 | { | |
946 | xloc = expand_location (r.m_start); | |
947 | fprintf (file, " start: %s:%d:%d", xloc.file, xloc.line, xloc.column); | |
948 | } | |
949 | else | |
950 | { | |
951 | fprintf (file, " start: unknown"); | |
952 | } | |
953 | if (r.m_finish) | |
954 | { | |
955 | xloc = expand_location (r.m_finish); | |
956 | fprintf (file, " finish: %s:%d:%d", xloc.file, xloc.line, xloc.column); | |
957 | } | |
958 | else | |
959 | { | |
960 | fprintf (file, " finish: unknown"); | |
961 | } | |
4ee9c684 | 962 | } |
963 | ||
9e718c95 | 964 | fprintf (file, ">"); |
3ff560b7 | 965 | } |
8ee76a8d | 966 | |
c7d89805 | 967 | |
968 | /* Print the node NODE on standard error, for debugging. | |
969 | Most nodes referred to by this one are printed recursively | |
970 | down to a depth of six. */ | |
971 | ||
972 | DEBUG_FUNCTION void | |
973 | debug_tree (tree node) | |
974 | { | |
975 | table = XCNEWVEC (struct bucket *, HASH_SIZE); | |
976 | print_node (stderr, "", node, 0); | |
977 | free (table); | |
978 | table = 0; | |
979 | putc ('\n', stderr); | |
980 | } | |
981 | ||
982 | DEBUG_FUNCTION void | |
983 | debug_raw (const tree_node &ref) | |
984 | { | |
985 | debug_tree (const_cast <tree> (&ref)); | |
986 | } | |
987 | ||
988 | DEBUG_FUNCTION void | |
989 | debug_raw (const tree_node *ptr) | |
990 | { | |
991 | if (ptr) | |
992 | debug_raw (*ptr); | |
993 | else | |
994 | fprintf (stderr, "<nil>\n"); | |
995 | } | |
996 | ||
997 | static void | |
998 | dump_tree_via_hooks (const tree_node *ptr, int options) | |
999 | { | |
1000 | if (DECL_P (ptr)) | |
1001 | lang_hooks.print_decl (stderr, const_cast <tree_node*> (ptr), 0); | |
1002 | else if (TYPE_P (ptr)) | |
1003 | lang_hooks.print_type (stderr, const_cast <tree_node*> (ptr), 0); | |
1004 | else if (TREE_CODE (ptr) == IDENTIFIER_NODE) | |
1005 | lang_hooks.print_identifier (stderr, const_cast <tree_node*> (ptr), 0); | |
1006 | else | |
1007 | print_generic_expr (stderr, const_cast <tree_node*> (ptr), options); | |
1008 | fprintf (stderr, "\n"); | |
1009 | } | |
1010 | ||
1011 | DEBUG_FUNCTION void | |
1012 | debug (const tree_node &ref) | |
1013 | { | |
1014 | dump_tree_via_hooks (&ref, 0); | |
1015 | } | |
1016 | ||
1017 | DEBUG_FUNCTION void | |
1018 | debug (const tree_node *ptr) | |
1019 | { | |
1020 | if (ptr) | |
1021 | debug (*ptr); | |
1022 | else | |
1023 | fprintf (stderr, "<nil>\n"); | |
1024 | } | |
1025 | ||
1026 | DEBUG_FUNCTION void | |
1027 | debug_verbose (const tree_node &ref) | |
1028 | { | |
1029 | dump_tree_via_hooks (&ref, TDF_VERBOSE); | |
1030 | } | |
1031 | ||
1032 | DEBUG_FUNCTION void | |
1033 | debug_verbose (const tree_node *ptr) | |
1034 | { | |
1035 | if (ptr) | |
1036 | debug_verbose (*ptr); | |
1037 | else | |
1038 | fprintf (stderr, "<nil>\n"); | |
1039 | } | |
1040 | ||
1041 | DEBUG_FUNCTION void | |
1042 | debug_head (const tree_node &ref) | |
1043 | { | |
1044 | debug (ref); | |
1045 | } | |
1046 | ||
1047 | DEBUG_FUNCTION void | |
1048 | debug_head (const tree_node *ptr) | |
1049 | { | |
1050 | if (ptr) | |
1051 | debug_head (*ptr); | |
1052 | else | |
1053 | fprintf (stderr, "<nil>\n"); | |
1054 | } | |
1055 | ||
1056 | DEBUG_FUNCTION void | |
1057 | debug_body (const tree_node &ref) | |
1058 | { | |
1059 | if (TREE_CODE (&ref) == FUNCTION_DECL) | |
1060 | dump_function_to_file (const_cast <tree_node*> (&ref), stderr, 0); | |
1061 | else | |
1062 | debug (ref); | |
1063 | } | |
1064 | ||
1065 | DEBUG_FUNCTION void | |
1066 | debug_body (const tree_node *ptr) | |
1067 | { | |
1068 | if (ptr) | |
1069 | debug_body (*ptr); | |
1070 | else | |
1071 | fprintf (stderr, "<nil>\n"); | |
1072 | } | |
1073 | ||
1074 | /* Print the vector of trees VEC on standard error, for debugging. | |
1075 | Most nodes referred to by this one are printed recursively | |
1076 | down to a depth of six. */ | |
1077 | ||
1078 | DEBUG_FUNCTION void | |
84fcb947 | 1079 | debug_raw (vec<tree, va_gc> &ref) |
c7d89805 | 1080 | { |
1081 | tree elt; | |
1082 | unsigned ix; | |
1083 | ||
1084 | /* Print the slot this node is in, and its code, and address. */ | |
1085 | fprintf (stderr, "<VEC"); | |
84fcb947 | 1086 | dump_addr (stderr, " ", ref.address ()); |
c7d89805 | 1087 | |
84fcb947 | 1088 | FOR_EACH_VEC_ELT (ref, ix, elt) |
c7d89805 | 1089 | { |
1090 | fprintf (stderr, "elt %d ", ix); | |
84fcb947 | 1091 | debug_raw (elt); |
c7d89805 | 1092 | } |
1093 | } | |
1094 | ||
1095 | DEBUG_FUNCTION void | |
1096 | debug (vec<tree, va_gc> &ref) | |
1097 | { | |
84fcb947 | 1098 | tree elt; |
1099 | unsigned ix; | |
1100 | ||
1101 | /* Print the slot this node is in, and its code, and address. */ | |
1102 | fprintf (stderr, "<VEC"); | |
1103 | dump_addr (stderr, " ", ref.address ()); | |
1104 | ||
1105 | FOR_EACH_VEC_ELT (ref, ix, elt) | |
1106 | { | |
1107 | fprintf (stderr, "elt %d ", ix); | |
1108 | debug (elt); | |
1109 | } | |
c7d89805 | 1110 | } |
1111 | ||
1112 | DEBUG_FUNCTION void | |
1113 | debug (vec<tree, va_gc> *ptr) | |
1114 | { | |
1115 | if (ptr) | |
1116 | debug (*ptr); | |
1117 | else | |
1118 | fprintf (stderr, "<nil>\n"); | |
1119 | } | |
84fcb947 | 1120 | |
1121 | DEBUG_FUNCTION void | |
1122 | debug_raw (vec<tree, va_gc> *ptr) | |
1123 | { | |
1124 | if (ptr) | |
1125 | debug_raw (*ptr); | |
1126 | else | |
1127 | fprintf (stderr, "<nil>\n"); | |
1128 | } | |
1129 | ||
1130 | DEBUG_FUNCTION void | |
1131 | debug_vec_tree (vec<tree, va_gc> *vec) | |
1132 | { | |
1133 | debug_raw (vec); | |
1134 | } |