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