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