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