]>
Commit | Line | Data |
---|---|---|
726a989a | 1 | /* Pretty formatting of GIMPLE statements and expressions. |
d1e082c2 | 2 | Copyright (C) 2001-2013 Free Software Foundation, Inc. |
726a989a RB |
3 | Contributed by Aldy Hernandez <aldyh@redhat.com> and |
4 | Diego Novillo <dnovillo@google.com> | |
5 | ||
6 | This file is part of GCC. | |
7 | ||
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 | |
10 | Software Foundation; either version 3, or (at your option) any later | |
11 | version. | |
12 | ||
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. | |
17 | ||
18 | You should have received a copy of the GNU General Public License | |
19 | along with GCC; see the file COPYING3. If not see | |
20 | <http://www.gnu.org/licenses/>. */ | |
21 | ||
22 | #include "config.h" | |
23 | #include "system.h" | |
24 | #include "coretypes.h" | |
25 | #include "tm.h" | |
26 | #include "tree.h" | |
27 | #include "diagnostic.h" | |
cf835838 | 28 | #include "gimple-pretty-print.h" |
726a989a | 29 | #include "hashtab.h" |
442b4905 | 30 | #include "bitmap.h" |
726a989a | 31 | #include "gimple.h" |
5be5c238 | 32 | #include "gimple-iterator.h" |
442b4905 AM |
33 | #include "gimple-ssa.h" |
34 | #include "cgraph.h" | |
35 | #include "tree-cfg.h" | |
36 | #include "tree-ssanames.h" | |
37 | #include "dumpfile.h" /* for dump_flags */ | |
726a989a | 38 | #include "value-prof.h" |
0a35513e | 39 | #include "trans-mem.h" |
726a989a RB |
40 | |
41 | #define INDENT(SPACE) \ | |
42 | do { int i; for (i = 0; i < SPACE; i++) pp_space (buffer); } while (0) | |
43 | ||
726a989a RB |
44 | #define GIMPLE_NIY do_niy (buffer,gs) |
45 | ||
46 | /* Try to print on BUFFER a default message for the unrecognized | |
47 | gimple statement GS. */ | |
48 | ||
49 | static void | |
50 | do_niy (pretty_printer *buffer, gimple gs) | |
51 | { | |
52 | pp_printf (buffer, "<<< Unknown GIMPLE statement: %s >>>\n", | |
53 | gimple_code_name[(int) gimple_code (gs)]); | |
54 | } | |
55 | ||
56 | ||
b5f47924 | 57 | /* Emit a newline and SPC indentation spaces to BUFFER. */ |
726a989a RB |
58 | |
59 | static void | |
60 | newline_and_indent (pretty_printer *buffer, int spc) | |
61 | { | |
62 | pp_newline (buffer); | |
63 | INDENT (spc); | |
64 | } | |
65 | ||
66 | ||
67 | /* Print the GIMPLE statement GS on stderr. */ | |
68 | ||
24e47c76 | 69 | DEBUG_FUNCTION void |
726a989a RB |
70 | debug_gimple_stmt (gimple gs) |
71 | { | |
72 | print_gimple_stmt (stderr, gs, 0, TDF_VOPS|TDF_MEMSYMS); | |
726a989a RB |
73 | } |
74 | ||
75 | ||
b5f47924 SS |
76 | /* Print GIMPLE statement G to FILE using SPC indentation spaces and |
77 | FLAGS as in pp_gimple_stmt_1. */ | |
726a989a RB |
78 | |
79 | void | |
80 | print_gimple_stmt (FILE *file, gimple g, int spc, int flags) | |
81 | { | |
b3f80694 | 82 | pretty_printer buffer; |
b3f80694 GDR |
83 | pp_needs_newline (&buffer) = true; |
84 | buffer.buffer->stream = file; | |
b5f47924 | 85 | pp_gimple_stmt_1 (&buffer, g, spc, flags); |
f8923f7e | 86 | pp_newline_and_flush (&buffer); |
726a989a RB |
87 | } |
88 | ||
7b3b6ae4 LC |
89 | DEBUG_FUNCTION void |
90 | debug (gimple_statement_d &ref) | |
91 | { | |
92 | print_gimple_stmt (stderr, &ref, 0, 0); | |
93 | } | |
94 | ||
95 | DEBUG_FUNCTION void | |
96 | debug (gimple_statement_d *ptr) | |
97 | { | |
98 | if (ptr) | |
99 | debug (*ptr); | |
100 | else | |
101 | fprintf (stderr, "<nil>\n"); | |
102 | } | |
103 | ||
726a989a | 104 | |
b5f47924 SS |
105 | /* Print GIMPLE statement G to FILE using SPC indentation spaces and |
106 | FLAGS as in pp_gimple_stmt_1. Print only the right-hand side | |
726a989a RB |
107 | of the statement. */ |
108 | ||
109 | void | |
110 | print_gimple_expr (FILE *file, gimple g, int spc, int flags) | |
111 | { | |
112 | flags |= TDF_RHS_ONLY; | |
b3f80694 | 113 | pretty_printer buffer; |
b3f80694 GDR |
114 | pp_needs_newline (&buffer) = true; |
115 | buffer.buffer->stream = file; | |
b5f47924 | 116 | pp_gimple_stmt_1 (&buffer, g, spc, flags); |
41222ddf | 117 | pp_flush (&buffer); |
726a989a RB |
118 | } |
119 | ||
120 | ||
b5f47924 SS |
121 | /* Print the GIMPLE sequence SEQ on BUFFER using SPC indentation |
122 | spaces and FLAGS as in pp_gimple_stmt_1. | |
c4669594 SB |
123 | The caller is responsible for calling pp_flush on BUFFER to finalize |
124 | the pretty printer. */ | |
726a989a RB |
125 | |
126 | static void | |
127 | dump_gimple_seq (pretty_printer *buffer, gimple_seq seq, int spc, int flags) | |
128 | { | |
129 | gimple_stmt_iterator i; | |
130 | ||
131 | for (i = gsi_start (seq); !gsi_end_p (i); gsi_next (&i)) | |
132 | { | |
133 | gimple gs = gsi_stmt (i); | |
134 | INDENT (spc); | |
b5f47924 | 135 | pp_gimple_stmt_1 (buffer, gs, spc, flags); |
726a989a RB |
136 | if (!gsi_one_before_end_p (i)) |
137 | pp_newline (buffer); | |
138 | } | |
139 | } | |
140 | ||
141 | ||
b5f47924 SS |
142 | /* Print GIMPLE sequence SEQ to FILE using SPC indentation spaces and |
143 | FLAGS as in pp_gimple_stmt_1. */ | |
726a989a RB |
144 | |
145 | void | |
146 | print_gimple_seq (FILE *file, gimple_seq seq, int spc, int flags) | |
147 | { | |
b3f80694 | 148 | pretty_printer buffer; |
b3f80694 GDR |
149 | pp_needs_newline (&buffer) = true; |
150 | buffer.buffer->stream = file; | |
726a989a | 151 | dump_gimple_seq (&buffer, seq, spc, flags); |
f8923f7e | 152 | pp_newline_and_flush (&buffer); |
726a989a RB |
153 | } |
154 | ||
155 | ||
156 | /* Print the GIMPLE sequence SEQ on stderr. */ | |
157 | ||
24e47c76 | 158 | DEBUG_FUNCTION void |
726a989a RB |
159 | debug_gimple_seq (gimple_seq seq) |
160 | { | |
161 | print_gimple_seq (stderr, seq, 0, TDF_VOPS|TDF_MEMSYMS); | |
162 | } | |
163 | ||
164 | ||
165 | /* A simple helper to pretty-print some of the gimple tuples in the printf | |
073a8998 | 166 | style. The format modifiers are preceded by '%' and are: |
726a989a RB |
167 | 'G' - outputs a string corresponding to the code of the given gimple, |
168 | 'S' - outputs a gimple_seq with indent of spc + 2, | |
169 | 'T' - outputs the tree t, | |
170 | 'd' - outputs an int as a decimal, | |
171 | 's' - outputs a string, | |
172 | 'n' - outputs a newline, | |
0a35513e | 173 | 'x' - outputs an int as hexadecimal, |
726a989a RB |
174 | '+' - increases indent by 2 then outputs a newline, |
175 | '-' - decreases indent by 2 then outputs a newline. */ | |
176 | ||
177 | static void | |
178 | dump_gimple_fmt (pretty_printer *buffer, int spc, int flags, | |
179 | const char *fmt, ...) | |
180 | { | |
181 | va_list args; | |
182 | const char *c; | |
183 | const char *tmp; | |
184 | ||
185 | va_start (args, fmt); | |
186 | for (c = fmt; *c; c++) | |
187 | { | |
188 | if (*c == '%') | |
189 | { | |
190 | gimple_seq seq; | |
191 | tree t; | |
192 | gimple g; | |
193 | switch (*++c) | |
194 | { | |
195 | case 'G': | |
196 | g = va_arg (args, gimple); | |
197 | tmp = gimple_code_name[gimple_code (g)]; | |
198 | pp_string (buffer, tmp); | |
199 | break; | |
200 | ||
201 | case 'S': | |
202 | seq = va_arg (args, gimple_seq); | |
203 | pp_newline (buffer); | |
204 | dump_gimple_seq (buffer, seq, spc + 2, flags); | |
205 | newline_and_indent (buffer, spc); | |
206 | break; | |
207 | ||
208 | case 'T': | |
209 | t = va_arg (args, tree); | |
210 | if (t == NULL_TREE) | |
211 | pp_string (buffer, "NULL"); | |
212 | else | |
213 | dump_generic_node (buffer, t, spc, flags, false); | |
214 | break; | |
215 | ||
216 | case 'd': | |
217 | pp_decimal_int (buffer, va_arg (args, int)); | |
218 | break; | |
219 | ||
220 | case 's': | |
221 | pp_string (buffer, va_arg (args, char *)); | |
222 | break; | |
223 | ||
224 | case 'n': | |
225 | newline_and_indent (buffer, spc); | |
226 | break; | |
227 | ||
0a35513e AH |
228 | case 'x': |
229 | pp_scalar (buffer, "%x", va_arg (args, int)); | |
230 | break; | |
231 | ||
726a989a RB |
232 | case '+': |
233 | spc += 2; | |
234 | newline_and_indent (buffer, spc); | |
235 | break; | |
236 | ||
237 | case '-': | |
238 | spc -= 2; | |
239 | newline_and_indent (buffer, spc); | |
240 | break; | |
241 | ||
242 | default: | |
243 | gcc_unreachable (); | |
244 | } | |
b8698a0f | 245 | } |
726a989a RB |
246 | else |
247 | pp_character (buffer, *c); | |
248 | } | |
249 | va_end (args); | |
250 | } | |
251 | ||
252 | ||
253 | /* Helper for dump_gimple_assign. Print the unary RHS of the | |
b5f47924 | 254 | assignment GS. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. */ |
726a989a RB |
255 | |
256 | static void | |
257 | dump_unary_rhs (pretty_printer *buffer, gimple gs, int spc, int flags) | |
258 | { | |
259 | enum tree_code rhs_code = gimple_assign_rhs_code (gs); | |
260 | tree lhs = gimple_assign_lhs (gs); | |
261 | tree rhs = gimple_assign_rhs1 (gs); | |
262 | ||
263 | switch (rhs_code) | |
264 | { | |
265 | case VIEW_CONVERT_EXPR: | |
266 | case ASSERT_EXPR: | |
267 | dump_generic_node (buffer, rhs, spc, flags, false); | |
268 | break; | |
269 | ||
270 | case FIXED_CONVERT_EXPR: | |
09e881c9 | 271 | case ADDR_SPACE_CONVERT_EXPR: |
726a989a RB |
272 | case FIX_TRUNC_EXPR: |
273 | case FLOAT_EXPR: | |
274 | CASE_CONVERT: | |
07838b13 | 275 | pp_left_paren (buffer); |
726a989a RB |
276 | dump_generic_node (buffer, TREE_TYPE (lhs), spc, flags, false); |
277 | pp_string (buffer, ") "); | |
0cf0d02b JJ |
278 | if (op_prio (rhs) < op_code_prio (rhs_code)) |
279 | { | |
07838b13 | 280 | pp_left_paren (buffer); |
0cf0d02b | 281 | dump_generic_node (buffer, rhs, spc, flags, false); |
07838b13 | 282 | pp_right_paren (buffer); |
0cf0d02b JJ |
283 | } |
284 | else | |
285 | dump_generic_node (buffer, rhs, spc, flags, false); | |
726a989a | 286 | break; |
b8698a0f | 287 | |
726a989a RB |
288 | case PAREN_EXPR: |
289 | pp_string (buffer, "(("); | |
290 | dump_generic_node (buffer, rhs, spc, flags, false); | |
291 | pp_string (buffer, "))"); | |
292 | break; | |
b8698a0f | 293 | |
726a989a RB |
294 | case ABS_EXPR: |
295 | pp_string (buffer, "ABS_EXPR <"); | |
296 | dump_generic_node (buffer, rhs, spc, flags, false); | |
07838b13 | 297 | pp_greater (buffer); |
726a989a RB |
298 | break; |
299 | ||
300 | default: | |
301 | if (TREE_CODE_CLASS (rhs_code) == tcc_declaration | |
302 | || TREE_CODE_CLASS (rhs_code) == tcc_constant | |
303 | || TREE_CODE_CLASS (rhs_code) == tcc_reference | |
304 | || rhs_code == SSA_NAME | |
305 | || rhs_code == ADDR_EXPR | |
306 | || rhs_code == CONSTRUCTOR) | |
0cf0d02b JJ |
307 | { |
308 | dump_generic_node (buffer, rhs, spc, flags, false); | |
309 | break; | |
310 | } | |
726a989a | 311 | else if (rhs_code == BIT_NOT_EXPR) |
07838b13 | 312 | pp_complement (buffer); |
726a989a | 313 | else if (rhs_code == TRUTH_NOT_EXPR) |
07838b13 | 314 | pp_exclamation (buffer); |
726a989a | 315 | else if (rhs_code == NEGATE_EXPR) |
07838b13 | 316 | pp_minus (buffer); |
726a989a RB |
317 | else |
318 | { | |
07838b13 | 319 | pp_left_bracket (buffer); |
5806f481 | 320 | pp_string (buffer, get_tree_code_name (rhs_code)); |
726a989a RB |
321 | pp_string (buffer, "] "); |
322 | } | |
323 | ||
0cf0d02b JJ |
324 | if (op_prio (rhs) < op_code_prio (rhs_code)) |
325 | { | |
07838b13 | 326 | pp_left_paren (buffer); |
0cf0d02b | 327 | dump_generic_node (buffer, rhs, spc, flags, false); |
07838b13 | 328 | pp_right_paren (buffer); |
0cf0d02b JJ |
329 | } |
330 | else | |
331 | dump_generic_node (buffer, rhs, spc, flags, false); | |
726a989a RB |
332 | break; |
333 | } | |
334 | } | |
335 | ||
336 | ||
337 | /* Helper for dump_gimple_assign. Print the binary RHS of the | |
b5f47924 | 338 | assignment GS. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. */ |
726a989a RB |
339 | |
340 | static void | |
341 | dump_binary_rhs (pretty_printer *buffer, gimple gs, int spc, int flags) | |
342 | { | |
2603276e JJ |
343 | const char *p; |
344 | enum tree_code code = gimple_assign_rhs_code (gs); | |
345 | switch (code) | |
726a989a RB |
346 | { |
347 | case COMPLEX_EXPR: | |
726a989a | 348 | case MIN_EXPR: |
726a989a | 349 | case MAX_EXPR: |
2603276e JJ |
350 | case VEC_WIDEN_MULT_HI_EXPR: |
351 | case VEC_WIDEN_MULT_LO_EXPR: | |
3f30a9a6 RH |
352 | case VEC_WIDEN_MULT_EVEN_EXPR: |
353 | case VEC_WIDEN_MULT_ODD_EXPR: | |
2603276e JJ |
354 | case VEC_PACK_TRUNC_EXPR: |
355 | case VEC_PACK_SAT_EXPR: | |
356 | case VEC_PACK_FIX_TRUNC_EXPR: | |
36ba4aae IR |
357 | case VEC_WIDEN_LSHIFT_HI_EXPR: |
358 | case VEC_WIDEN_LSHIFT_LO_EXPR: | |
5806f481 | 359 | for (p = get_tree_code_name (code); *p; p++) |
2603276e JJ |
360 | pp_character (buffer, TOUPPER (*p)); |
361 | pp_string (buffer, " <"); | |
726a989a RB |
362 | dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags, false); |
363 | pp_string (buffer, ", "); | |
364 | dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags, false); | |
07838b13 | 365 | pp_greater (buffer); |
726a989a RB |
366 | break; |
367 | ||
368 | default: | |
0cf0d02b JJ |
369 | if (op_prio (gimple_assign_rhs1 (gs)) <= op_code_prio (code)) |
370 | { | |
07838b13 | 371 | pp_left_paren (buffer); |
0cf0d02b JJ |
372 | dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags, |
373 | false); | |
07838b13 | 374 | pp_right_paren (buffer); |
0cf0d02b JJ |
375 | } |
376 | else | |
377 | dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags, false); | |
726a989a RB |
378 | pp_space (buffer); |
379 | pp_string (buffer, op_symbol_code (gimple_assign_rhs_code (gs))); | |
380 | pp_space (buffer); | |
0cf0d02b JJ |
381 | if (op_prio (gimple_assign_rhs2 (gs)) <= op_code_prio (code)) |
382 | { | |
07838b13 | 383 | pp_left_paren (buffer); |
0cf0d02b JJ |
384 | dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags, |
385 | false); | |
07838b13 | 386 | pp_right_paren (buffer); |
0cf0d02b JJ |
387 | } |
388 | else | |
389 | dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags, false); | |
726a989a RB |
390 | } |
391 | } | |
392 | ||
0354c0c7 | 393 | /* Helper for dump_gimple_assign. Print the ternary RHS of the |
b5f47924 | 394 | assignment GS. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. */ |
0354c0c7 BS |
395 | |
396 | static void | |
397 | dump_ternary_rhs (pretty_printer *buffer, gimple gs, int spc, int flags) | |
398 | { | |
399 | const char *p; | |
400 | enum tree_code code = gimple_assign_rhs_code (gs); | |
401 | switch (code) | |
402 | { | |
403 | case WIDEN_MULT_PLUS_EXPR: | |
404 | case WIDEN_MULT_MINUS_EXPR: | |
5806f481 | 405 | for (p = get_tree_code_name (code); *p; p++) |
0354c0c7 BS |
406 | pp_character (buffer, TOUPPER (*p)); |
407 | pp_string (buffer, " <"); | |
408 | dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags, false); | |
409 | pp_string (buffer, ", "); | |
410 | dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags, false); | |
411 | pp_string (buffer, ", "); | |
412 | dump_generic_node (buffer, gimple_assign_rhs3 (gs), spc, flags, false); | |
07838b13 | 413 | pp_greater (buffer); |
0354c0c7 BS |
414 | break; |
415 | ||
16949072 RG |
416 | case FMA_EXPR: |
417 | dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags, false); | |
418 | pp_string (buffer, " * "); | |
419 | dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags, false); | |
420 | pp_string (buffer, " + "); | |
421 | dump_generic_node (buffer, gimple_assign_rhs3 (gs), spc, flags, false); | |
422 | break; | |
423 | ||
f471fe72 RG |
424 | case DOT_PROD_EXPR: |
425 | pp_string (buffer, "DOT_PROD_EXPR <"); | |
426 | dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags, false); | |
427 | pp_string (buffer, ", "); | |
428 | dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags, false); | |
429 | pp_string (buffer, ", "); | |
430 | dump_generic_node (buffer, gimple_assign_rhs3 (gs), spc, flags, false); | |
137a1a27 | 431 | pp_greater (buffer); |
f471fe72 | 432 | break; |
f90e8e2e | 433 | |
2205ed25 RH |
434 | case VEC_PERM_EXPR: |
435 | pp_string (buffer, "VEC_PERM_EXPR <"); | |
f90e8e2e AS |
436 | dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags, false); |
437 | pp_string (buffer, ", "); | |
438 | dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags, false); | |
439 | pp_string (buffer, ", "); | |
440 | dump_generic_node (buffer, gimple_assign_rhs3 (gs), spc, flags, false); | |
137a1a27 | 441 | pp_greater (buffer); |
f90e8e2e | 442 | break; |
f471fe72 RG |
443 | |
444 | case REALIGN_LOAD_EXPR: | |
445 | pp_string (buffer, "REALIGN_LOAD <"); | |
446 | dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags, false); | |
447 | pp_string (buffer, ", "); | |
448 | dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags, false); | |
449 | pp_string (buffer, ", "); | |
450 | dump_generic_node (buffer, gimple_assign_rhs3 (gs), spc, flags, false); | |
137a1a27 | 451 | pp_greater (buffer); |
4e71066d RG |
452 | break; |
453 | ||
454 | case COND_EXPR: | |
455 | dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags, false); | |
456 | pp_string (buffer, " ? "); | |
457 | dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags, false); | |
458 | pp_string (buffer, " : "); | |
459 | dump_generic_node (buffer, gimple_assign_rhs3 (gs), spc, flags, false); | |
460 | break; | |
461 | ||
462 | case VEC_COND_EXPR: | |
463 | pp_string (buffer, "VEC_COND_EXPR <"); | |
464 | dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags, false); | |
465 | pp_string (buffer, ", "); | |
466 | dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags, false); | |
467 | pp_string (buffer, ", "); | |
468 | dump_generic_node (buffer, gimple_assign_rhs3 (gs), spc, flags, false); | |
137a1a27 | 469 | pp_greater (buffer); |
f471fe72 RG |
470 | break; |
471 | ||
0354c0c7 BS |
472 | default: |
473 | gcc_unreachable (); | |
474 | } | |
475 | } | |
476 | ||
726a989a RB |
477 | |
478 | /* Dump the gimple assignment GS. BUFFER, SPC and FLAGS are as in | |
b5f47924 | 479 | pp_gimple_stmt_1. */ |
726a989a RB |
480 | |
481 | static void | |
482 | dump_gimple_assign (pretty_printer *buffer, gimple gs, int spc, int flags) | |
483 | { | |
484 | if (flags & TDF_RAW) | |
485 | { | |
874a3756 MG |
486 | tree arg1 = NULL; |
487 | tree arg2 = NULL; | |
488 | tree arg3 = NULL; | |
489 | switch (gimple_num_ops (gs)) | |
490 | { | |
491 | case 4: | |
492 | arg3 = gimple_assign_rhs3 (gs); | |
493 | case 3: | |
494 | arg2 = gimple_assign_rhs2 (gs); | |
495 | case 2: | |
496 | arg1 = gimple_assign_rhs1 (gs); | |
497 | break; | |
498 | default: | |
499 | gcc_unreachable (); | |
500 | } | |
726a989a | 501 | |
874a3756 | 502 | dump_gimple_fmt (buffer, spc, flags, "%G <%s, %T, %T, %T, %T>", gs, |
5806f481 | 503 | get_tree_code_name (gimple_assign_rhs_code (gs)), |
874a3756 | 504 | gimple_assign_lhs (gs), arg1, arg2, arg3); |
726a989a RB |
505 | } |
506 | else | |
507 | { | |
508 | if (!(flags & TDF_RHS_ONLY)) | |
509 | { | |
510 | dump_generic_node (buffer, gimple_assign_lhs (gs), spc, flags, false); | |
511 | pp_space (buffer); | |
07838b13 | 512 | pp_equal (buffer); |
726a989a RB |
513 | |
514 | if (gimple_assign_nontemporal_move_p (gs)) | |
515 | pp_string (buffer, "{nt}"); | |
516 | ||
517 | if (gimple_has_volatile_ops (gs)) | |
518 | pp_string (buffer, "{v}"); | |
519 | ||
520 | pp_space (buffer); | |
521 | } | |
522 | ||
523 | if (gimple_num_ops (gs) == 2) | |
524 | dump_unary_rhs (buffer, gs, spc, flags); | |
525 | else if (gimple_num_ops (gs) == 3) | |
526 | dump_binary_rhs (buffer, gs, spc, flags); | |
0354c0c7 BS |
527 | else if (gimple_num_ops (gs) == 4) |
528 | dump_ternary_rhs (buffer, gs, spc, flags); | |
726a989a RB |
529 | else |
530 | gcc_unreachable (); | |
531 | if (!(flags & TDF_RHS_ONLY)) | |
c3284718 | 532 | pp_semicolon (buffer); |
726a989a RB |
533 | } |
534 | } | |
535 | ||
536 | ||
537 | /* Dump the return statement GS. BUFFER, SPC and FLAGS are as in | |
b5f47924 | 538 | pp_gimple_stmt_1. */ |
726a989a RB |
539 | |
540 | static void | |
541 | dump_gimple_return (pretty_printer *buffer, gimple gs, int spc, int flags) | |
542 | { | |
ea9637cd | 543 | tree t, t2; |
726a989a RB |
544 | |
545 | t = gimple_return_retval (gs); | |
ea9637cd | 546 | t2 = gimple_return_retbnd (gs); |
726a989a | 547 | if (flags & TDF_RAW) |
ea9637cd | 548 | dump_gimple_fmt (buffer, spc, flags, "%G <%T %T>", gs, t, t2); |
726a989a RB |
549 | else |
550 | { | |
551 | pp_string (buffer, "return"); | |
552 | if (t) | |
553 | { | |
554 | pp_space (buffer); | |
555 | dump_generic_node (buffer, t, spc, flags, false); | |
556 | } | |
ea9637cd IE |
557 | if (t2) |
558 | { | |
559 | pp_string (buffer, ", "); | |
560 | dump_generic_node (buffer, t2, spc, flags, false); | |
561 | } | |
726a989a RB |
562 | pp_semicolon (buffer); |
563 | } | |
564 | } | |
565 | ||
566 | ||
567 | /* Dump the call arguments for a gimple call. BUFFER, FLAGS are as in | |
568 | dump_gimple_call. */ | |
569 | ||
570 | static void | |
571 | dump_gimple_call_args (pretty_printer *buffer, gimple gs, int flags) | |
572 | { | |
573 | size_t i; | |
574 | ||
575 | for (i = 0; i < gimple_call_num_args (gs); i++) | |
576 | { | |
577 | dump_generic_node (buffer, gimple_call_arg (gs, i), 0, flags, false); | |
578 | if (i < gimple_call_num_args (gs) - 1) | |
579 | pp_string (buffer, ", "); | |
580 | } | |
581 | ||
582 | if (gimple_call_va_arg_pack_p (gs)) | |
583 | { | |
584 | if (gimple_call_num_args (gs) > 0) | |
585 | { | |
07838b13 | 586 | pp_comma (buffer); |
726a989a RB |
587 | pp_space (buffer); |
588 | } | |
589 | ||
590 | pp_string (buffer, "__builtin_va_arg_pack ()"); | |
591 | } | |
592 | } | |
593 | ||
25a6a873 RG |
594 | /* Dump the points-to solution *PT to BUFFER. */ |
595 | ||
596 | static void | |
597 | pp_points_to_solution (pretty_printer *buffer, struct pt_solution *pt) | |
598 | { | |
599 | if (pt->anything) | |
600 | { | |
601 | pp_string (buffer, "anything "); | |
602 | return; | |
603 | } | |
604 | if (pt->nonlocal) | |
605 | pp_string (buffer, "nonlocal "); | |
606 | if (pt->escaped) | |
607 | pp_string (buffer, "escaped "); | |
608 | if (pt->ipa_escaped) | |
609 | pp_string (buffer, "unit-escaped "); | |
610 | if (pt->null) | |
611 | pp_string (buffer, "null "); | |
612 | if (pt->vars | |
613 | && !bitmap_empty_p (pt->vars)) | |
614 | { | |
615 | bitmap_iterator bi; | |
616 | unsigned i; | |
617 | pp_string (buffer, "{ "); | |
618 | EXECUTE_IF_SET_IN_BITMAP (pt->vars, 0, i, bi) | |
619 | { | |
46eb666a RG |
620 | pp_string (buffer, "D."); |
621 | pp_decimal_int (buffer, i); | |
07838b13 | 622 | pp_space (buffer); |
25a6a873 | 623 | } |
07838b13 | 624 | pp_right_brace (buffer); |
11924f8b RB |
625 | if (pt->vars_contains_nonlocal |
626 | && pt->vars_contains_escaped_heap) | |
627 | pp_string (buffer, " (nonlocal, escaped heap)"); | |
628 | else if (pt->vars_contains_nonlocal | |
629 | && pt->vars_contains_escaped) | |
630 | pp_string (buffer, " (nonlocal, escaped)"); | |
631 | else if (pt->vars_contains_nonlocal) | |
632 | pp_string (buffer, " (nonlocal)"); | |
633 | else if (pt->vars_contains_escaped_heap) | |
634 | pp_string (buffer, " (escaped heap)"); | |
635 | else if (pt->vars_contains_escaped) | |
636 | pp_string (buffer, " (escaped)"); | |
25a6a873 RG |
637 | } |
638 | } | |
726a989a RB |
639 | |
640 | /* Dump the call statement GS. BUFFER, SPC and FLAGS are as in | |
b5f47924 | 641 | pp_gimple_stmt_1. */ |
726a989a RB |
642 | |
643 | static void | |
644 | dump_gimple_call (pretty_printer *buffer, gimple gs, int spc, int flags) | |
645 | { | |
646 | tree lhs = gimple_call_lhs (gs); | |
0a35513e | 647 | tree fn = gimple_call_fn (gs); |
726a989a | 648 | |
25a6a873 RG |
649 | if (flags & TDF_ALIAS) |
650 | { | |
651 | struct pt_solution *pt; | |
652 | pt = gimple_call_use_set (gs); | |
653 | if (!pt_solution_empty_p (pt)) | |
654 | { | |
655 | pp_string (buffer, "# USE = "); | |
656 | pp_points_to_solution (buffer, pt); | |
657 | newline_and_indent (buffer, spc); | |
658 | } | |
659 | pt = gimple_call_clobber_set (gs); | |
660 | if (!pt_solution_empty_p (pt)) | |
661 | { | |
662 | pp_string (buffer, "# CLB = "); | |
663 | pp_points_to_solution (buffer, pt); | |
664 | newline_and_indent (buffer, spc); | |
665 | } | |
666 | } | |
667 | ||
726a989a RB |
668 | if (flags & TDF_RAW) |
669 | { | |
25583c4f RS |
670 | if (gimple_call_internal_p (gs)) |
671 | dump_gimple_fmt (buffer, spc, flags, "%G <%s, %T", gs, | |
672 | internal_fn_name (gimple_call_internal_fn (gs)), lhs); | |
673 | else | |
0a35513e | 674 | dump_gimple_fmt (buffer, spc, flags, "%G <%T, %T", gs, fn, lhs); |
726a989a RB |
675 | if (gimple_call_num_args (gs) > 0) |
676 | { | |
677 | pp_string (buffer, ", "); | |
678 | dump_gimple_call_args (buffer, gs, flags); | |
679 | } | |
07838b13 | 680 | pp_greater (buffer); |
726a989a RB |
681 | } |
682 | else | |
683 | { | |
684 | if (lhs && !(flags & TDF_RHS_ONLY)) | |
685 | { | |
686 | dump_generic_node (buffer, lhs, spc, flags, false); | |
687 | pp_string (buffer, " ="); | |
688 | ||
689 | if (gimple_has_volatile_ops (gs)) | |
690 | pp_string (buffer, "{v}"); | |
691 | ||
692 | pp_space (buffer); | |
693 | } | |
25583c4f RS |
694 | if (gimple_call_internal_p (gs)) |
695 | pp_string (buffer, internal_fn_name (gimple_call_internal_fn (gs))); | |
696 | else | |
0a35513e | 697 | print_call_name (buffer, fn, flags); |
726a989a RB |
698 | pp_string (buffer, " ("); |
699 | dump_gimple_call_args (buffer, gs, flags); | |
07838b13 | 700 | pp_right_paren (buffer); |
726a989a RB |
701 | if (!(flags & TDF_RHS_ONLY)) |
702 | pp_semicolon (buffer); | |
703 | } | |
704 | ||
705 | if (gimple_call_chain (gs)) | |
706 | { | |
707 | pp_string (buffer, " [static-chain: "); | |
708 | dump_generic_node (buffer, gimple_call_chain (gs), spc, flags, false); | |
07838b13 | 709 | pp_right_bracket (buffer); |
726a989a RB |
710 | } |
711 | ||
712 | if (gimple_call_return_slot_opt_p (gs)) | |
713 | pp_string (buffer, " [return slot optimization]"); | |
726a989a RB |
714 | if (gimple_call_tail_p (gs)) |
715 | pp_string (buffer, " [tail call]"); | |
0a35513e | 716 | |
cbe9d630 SD |
717 | if (fn == NULL) |
718 | return; | |
719 | ||
0a35513e AH |
720 | /* Dump the arguments of _ITM_beginTransaction sanely. */ |
721 | if (TREE_CODE (fn) == ADDR_EXPR) | |
722 | fn = TREE_OPERAND (fn, 0); | |
723 | if (TREE_CODE (fn) == FUNCTION_DECL && decl_is_tm_clone (fn)) | |
724 | pp_string (buffer, " [tm-clone]"); | |
725 | if (TREE_CODE (fn) == FUNCTION_DECL | |
726 | && DECL_BUILT_IN_CLASS (fn) == BUILT_IN_NORMAL | |
727 | && DECL_FUNCTION_CODE (fn) == BUILT_IN_TM_START | |
728 | && gimple_call_num_args (gs) > 0) | |
729 | { | |
730 | tree t = gimple_call_arg (gs, 0); | |
731 | unsigned HOST_WIDE_INT props; | |
732 | gcc_assert (TREE_CODE (t) == INTEGER_CST); | |
733 | ||
734 | pp_string (buffer, " [ "); | |
735 | ||
736 | /* Get the transaction code properties. */ | |
737 | props = TREE_INT_CST_LOW (t); | |
738 | ||
739 | if (props & PR_INSTRUMENTEDCODE) | |
740 | pp_string (buffer, "instrumentedCode "); | |
741 | if (props & PR_UNINSTRUMENTEDCODE) | |
742 | pp_string (buffer, "uninstrumentedCode "); | |
743 | if (props & PR_HASNOXMMUPDATE) | |
744 | pp_string (buffer, "hasNoXMMUpdate "); | |
745 | if (props & PR_HASNOABORT) | |
746 | pp_string (buffer, "hasNoAbort "); | |
747 | if (props & PR_HASNOIRREVOCABLE) | |
748 | pp_string (buffer, "hasNoIrrevocable "); | |
749 | if (props & PR_DOESGOIRREVOCABLE) | |
750 | pp_string (buffer, "doesGoIrrevocable "); | |
751 | if (props & PR_HASNOSIMPLEREADS) | |
752 | pp_string (buffer, "hasNoSimpleReads "); | |
753 | if (props & PR_AWBARRIERSOMITTED) | |
754 | pp_string (buffer, "awBarriersOmitted "); | |
755 | if (props & PR_RARBARRIERSOMITTED) | |
756 | pp_string (buffer, "RaRBarriersOmitted "); | |
757 | if (props & PR_UNDOLOGCODE) | |
758 | pp_string (buffer, "undoLogCode "); | |
759 | if (props & PR_PREFERUNINSTRUMENTED) | |
760 | pp_string (buffer, "preferUninstrumented "); | |
761 | if (props & PR_EXCEPTIONBLOCK) | |
762 | pp_string (buffer, "exceptionBlock "); | |
763 | if (props & PR_HASELSE) | |
764 | pp_string (buffer, "hasElse "); | |
765 | if (props & PR_READONLY) | |
766 | pp_string (buffer, "readOnly "); | |
767 | ||
137a1a27 | 768 | pp_right_bracket (buffer); |
0a35513e | 769 | } |
726a989a RB |
770 | } |
771 | ||
772 | ||
773 | /* Dump the switch statement GS. BUFFER, SPC and FLAGS are as in | |
b5f47924 | 774 | pp_gimple_stmt_1. */ |
726a989a RB |
775 | |
776 | static void | |
777 | dump_gimple_switch (pretty_printer *buffer, gimple gs, int spc, int flags) | |
778 | { | |
779 | unsigned int i; | |
780 | ||
781 | GIMPLE_CHECK (gs, GIMPLE_SWITCH); | |
782 | if (flags & TDF_RAW) | |
783 | dump_gimple_fmt (buffer, spc, flags, "%G <%T, ", gs, | |
784 | gimple_switch_index (gs)); | |
785 | else | |
786 | { | |
787 | pp_string (buffer, "switch ("); | |
788 | dump_generic_node (buffer, gimple_switch_index (gs), spc, flags, true); | |
789 | pp_string (buffer, ") <"); | |
790 | } | |
791 | ||
792 | for (i = 0; i < gimple_switch_num_labels (gs); i++) | |
793 | { | |
794 | tree case_label = gimple_switch_label (gs, i); | |
fd8d363e | 795 | gcc_checking_assert (case_label != NULL_TREE); |
726a989a | 796 | dump_generic_node (buffer, case_label, spc, flags, false); |
07838b13 | 797 | pp_space (buffer); |
726a989a RB |
798 | dump_generic_node (buffer, CASE_LABEL (case_label), spc, flags, false); |
799 | if (i < gimple_switch_num_labels (gs) - 1) | |
800 | pp_string (buffer, ", "); | |
801 | } | |
07838b13 | 802 | pp_greater (buffer); |
726a989a RB |
803 | } |
804 | ||
805 | ||
806 | /* Dump the gimple conditional GS. BUFFER, SPC and FLAGS are as in | |
b5f47924 | 807 | pp_gimple_stmt_1. */ |
726a989a RB |
808 | |
809 | static void | |
810 | dump_gimple_cond (pretty_printer *buffer, gimple gs, int spc, int flags) | |
811 | { | |
812 | if (flags & TDF_RAW) | |
813 | dump_gimple_fmt (buffer, spc, flags, "%G <%s, %T, %T, %T, %T>", gs, | |
5806f481 PM |
814 | get_tree_code_name (gimple_cond_code (gs)), |
815 | gimple_cond_lhs (gs), gimple_cond_rhs (gs), | |
816 | gimple_cond_true_label (gs), gimple_cond_false_label (gs)); | |
726a989a RB |
817 | else |
818 | { | |
819 | if (!(flags & TDF_RHS_ONLY)) | |
820 | pp_string (buffer, "if ("); | |
821 | dump_generic_node (buffer, gimple_cond_lhs (gs), spc, flags, false); | |
822 | pp_space (buffer); | |
823 | pp_string (buffer, op_symbol_code (gimple_cond_code (gs))); | |
824 | pp_space (buffer); | |
825 | dump_generic_node (buffer, gimple_cond_rhs (gs), spc, flags, false); | |
826 | if (!(flags & TDF_RHS_ONLY)) | |
827 | { | |
07838b13 | 828 | pp_right_paren (buffer); |
726a989a RB |
829 | |
830 | if (gimple_cond_true_label (gs)) | |
831 | { | |
832 | pp_string (buffer, " goto "); | |
833 | dump_generic_node (buffer, gimple_cond_true_label (gs), | |
834 | spc, flags, false); | |
835 | pp_semicolon (buffer); | |
836 | } | |
837 | if (gimple_cond_false_label (gs)) | |
838 | { | |
839 | pp_string (buffer, " else goto "); | |
840 | dump_generic_node (buffer, gimple_cond_false_label (gs), | |
841 | spc, flags, false); | |
842 | pp_semicolon (buffer); | |
843 | } | |
844 | } | |
845 | } | |
846 | } | |
847 | ||
848 | ||
849 | /* Dump a GIMPLE_LABEL tuple on the pretty_printer BUFFER, SPC | |
850 | spaces of indent. FLAGS specifies details to show in the dump (see | |
7ee2468b | 851 | TDF_* in dumpfils.h). */ |
726a989a RB |
852 | |
853 | static void | |
854 | dump_gimple_label (pretty_printer *buffer, gimple gs, int spc, int flags) | |
855 | { | |
856 | tree label = gimple_label_label (gs); | |
857 | if (flags & TDF_RAW) | |
858 | dump_gimple_fmt (buffer, spc, flags, "%G <%T>", gs, label); | |
859 | else | |
860 | { | |
861 | dump_generic_node (buffer, label, spc, flags, false); | |
07838b13 | 862 | pp_colon (buffer); |
726a989a RB |
863 | } |
864 | if (DECL_NONLOCAL (label)) | |
865 | pp_string (buffer, " [non-local]"); | |
1d65f45c RH |
866 | if ((flags & TDF_EH) && EH_LANDING_PAD_NR (label)) |
867 | pp_printf (buffer, " [LP %d]", EH_LANDING_PAD_NR (label)); | |
726a989a RB |
868 | } |
869 | ||
870 | /* Dump a GIMPLE_GOTO tuple on the pretty_printer BUFFER, SPC | |
871 | spaces of indent. FLAGS specifies details to show in the dump (see | |
7ee2468b | 872 | TDF_* in dumpfile.h). */ |
726a989a RB |
873 | |
874 | static void | |
875 | dump_gimple_goto (pretty_printer *buffer, gimple gs, int spc, int flags) | |
876 | { | |
877 | tree label = gimple_goto_dest (gs); | |
878 | if (flags & TDF_RAW) | |
879 | dump_gimple_fmt (buffer, spc, flags, "%G <%T>", gs, label); | |
880 | else | |
881 | dump_gimple_fmt (buffer, spc, flags, "goto %T;", label); | |
882 | } | |
883 | ||
884 | ||
885 | /* Dump a GIMPLE_BIND tuple on the pretty_printer BUFFER, SPC | |
886 | spaces of indent. FLAGS specifies details to show in the dump (see | |
7ee2468b | 887 | TDF_* in dumpfile.h). */ |
726a989a RB |
888 | |
889 | static void | |
890 | dump_gimple_bind (pretty_printer *buffer, gimple gs, int spc, int flags) | |
891 | { | |
892 | if (flags & TDF_RAW) | |
893 | dump_gimple_fmt (buffer, spc, flags, "%G <", gs); | |
894 | else | |
07838b13 | 895 | pp_left_brace (buffer); |
726a989a RB |
896 | if (!(flags & TDF_SLIM)) |
897 | { | |
898 | tree var; | |
899 | ||
910ad8de | 900 | for (var = gimple_bind_vars (gs); var; var = DECL_CHAIN (var)) |
726a989a RB |
901 | { |
902 | newline_and_indent (buffer, 2); | |
903 | print_declaration (buffer, var, spc, flags); | |
904 | } | |
905 | if (gimple_bind_vars (gs)) | |
906 | pp_newline (buffer); | |
907 | } | |
908 | pp_newline (buffer); | |
909 | dump_gimple_seq (buffer, gimple_bind_body (gs), spc + 2, flags); | |
910 | newline_and_indent (buffer, spc); | |
911 | if (flags & TDF_RAW) | |
07838b13 | 912 | pp_greater (buffer); |
726a989a | 913 | else |
07838b13 | 914 | pp_right_brace (buffer); |
726a989a RB |
915 | } |
916 | ||
917 | ||
918 | /* Dump a GIMPLE_TRY tuple on the pretty_printer BUFFER, SPC spaces of | |
919 | indent. FLAGS specifies details to show in the dump (see TDF_* in | |
7ee2468b | 920 | dumpfile.h). */ |
726a989a RB |
921 | |
922 | static void | |
923 | dump_gimple_try (pretty_printer *buffer, gimple gs, int spc, int flags) | |
924 | { | |
925 | if (flags & TDF_RAW) | |
926 | { | |
927 | const char *type; | |
928 | if (gimple_try_kind (gs) == GIMPLE_TRY_CATCH) | |
929 | type = "GIMPLE_TRY_CATCH"; | |
930 | else if (gimple_try_kind (gs) == GIMPLE_TRY_FINALLY) | |
931 | type = "GIMPLE_TRY_FINALLY"; | |
932 | else | |
933 | type = "UNKNOWN GIMPLE_TRY"; | |
934 | dump_gimple_fmt (buffer, spc, flags, | |
935 | "%G <%s,%+EVAL <%S>%nCLEANUP <%S>%->", gs, type, | |
936 | gimple_try_eval (gs), gimple_try_cleanup (gs)); | |
937 | } | |
938 | else | |
939 | { | |
940 | pp_string (buffer, "try"); | |
941 | newline_and_indent (buffer, spc + 2); | |
07838b13 | 942 | pp_left_brace (buffer); |
726a989a RB |
943 | pp_newline (buffer); |
944 | ||
945 | dump_gimple_seq (buffer, gimple_try_eval (gs), spc + 4, flags); | |
946 | newline_and_indent (buffer, spc + 2); | |
07838b13 | 947 | pp_right_brace (buffer); |
726a989a RB |
948 | |
949 | if (gimple_try_kind (gs) == GIMPLE_TRY_CATCH) | |
950 | { | |
951 | newline_and_indent (buffer, spc); | |
952 | pp_string (buffer, "catch"); | |
953 | newline_and_indent (buffer, spc + 2); | |
07838b13 | 954 | pp_left_brace (buffer); |
726a989a RB |
955 | } |
956 | else if (gimple_try_kind (gs) == GIMPLE_TRY_FINALLY) | |
957 | { | |
958 | newline_and_indent (buffer, spc); | |
959 | pp_string (buffer, "finally"); | |
960 | newline_and_indent (buffer, spc + 2); | |
07838b13 | 961 | pp_left_brace (buffer); |
726a989a RB |
962 | } |
963 | else | |
964 | pp_string (buffer, " <UNKNOWN GIMPLE_TRY> {"); | |
965 | ||
966 | pp_newline (buffer); | |
967 | dump_gimple_seq (buffer, gimple_try_cleanup (gs), spc + 4, flags); | |
968 | newline_and_indent (buffer, spc + 2); | |
07838b13 | 969 | pp_right_brace (buffer); |
726a989a RB |
970 | } |
971 | } | |
972 | ||
973 | ||
974 | /* Dump a GIMPLE_CATCH tuple on the pretty_printer BUFFER, SPC spaces of | |
975 | indent. FLAGS specifies details to show in the dump (see TDF_* in | |
7ee2468b | 976 | dumpfile.h). */ |
726a989a RB |
977 | |
978 | static void | |
979 | dump_gimple_catch (pretty_printer *buffer, gimple gs, int spc, int flags) | |
980 | { | |
981 | if (flags & TDF_RAW) | |
982 | dump_gimple_fmt (buffer, spc, flags, "%G <%T, %+CATCH <%S>%->", gs, | |
983 | gimple_catch_types (gs), gimple_catch_handler (gs)); | |
984 | else | |
985 | dump_gimple_fmt (buffer, spc, flags, "catch (%T)%+{%S}", | |
986 | gimple_catch_types (gs), gimple_catch_handler (gs)); | |
987 | } | |
988 | ||
989 | ||
990 | /* Dump a GIMPLE_EH_FILTER tuple on the pretty_printer BUFFER, SPC spaces of | |
991 | indent. FLAGS specifies details to show in the dump (see TDF_* in | |
7ee2468b | 992 | dumpfile.h). */ |
726a989a RB |
993 | |
994 | static void | |
995 | dump_gimple_eh_filter (pretty_printer *buffer, gimple gs, int spc, int flags) | |
996 | { | |
997 | if (flags & TDF_RAW) | |
998 | dump_gimple_fmt (buffer, spc, flags, "%G <%T, %+FAILURE <%S>%->", gs, | |
999 | gimple_eh_filter_types (gs), | |
1000 | gimple_eh_filter_failure (gs)); | |
1001 | else | |
1002 | dump_gimple_fmt (buffer, spc, flags, "<<<eh_filter (%T)>>>%+{%+%S%-}", | |
1003 | gimple_eh_filter_types (gs), | |
1004 | gimple_eh_filter_failure (gs)); | |
1005 | } | |
1006 | ||
1007 | ||
1d65f45c RH |
1008 | /* Dump a GIMPLE_EH_MUST_NOT_THROW tuple. */ |
1009 | ||
1010 | static void | |
1011 | dump_gimple_eh_must_not_throw (pretty_printer *buffer, gimple gs, | |
1012 | int spc, int flags) | |
1013 | { | |
1014 | if (flags & TDF_RAW) | |
1015 | dump_gimple_fmt (buffer, spc, flags, "%G <%T>", gs, | |
1016 | gimple_eh_must_not_throw_fndecl (gs)); | |
1017 | else | |
1018 | dump_gimple_fmt (buffer, spc, flags, "<<<eh_must_not_throw (%T)>>>", | |
1019 | gimple_eh_must_not_throw_fndecl (gs)); | |
1020 | } | |
1021 | ||
1022 | ||
0a35513e AH |
1023 | /* Dump a GIMPLE_EH_ELSE tuple on the pretty_printer BUFFER, SPC spaces of |
1024 | indent. FLAGS specifies details to show in the dump (see TDF_* in | |
7ee2468b | 1025 | dumpfile.h). */ |
0a35513e AH |
1026 | |
1027 | static void | |
1028 | dump_gimple_eh_else (pretty_printer *buffer, gimple gs, int spc, int flags) | |
1029 | { | |
1030 | if (flags & TDF_RAW) | |
1031 | dump_gimple_fmt (buffer, spc, flags, | |
1032 | "%G <%+N_BODY <%S>%nE_BODY <%S>%->", gs, | |
1033 | gimple_eh_else_n_body (gs), gimple_eh_else_e_body (gs)); | |
1034 | else | |
1035 | dump_gimple_fmt (buffer, spc, flags, | |
1036 | "<<<if_normal_exit>>>%+{%S}%-<<<else_eh_exit>>>%+{%S}", | |
1037 | gimple_eh_else_n_body (gs), gimple_eh_else_e_body (gs)); | |
1038 | } | |
1039 | ||
1040 | ||
726a989a RB |
1041 | /* Dump a GIMPLE_RESX tuple on the pretty_printer BUFFER, SPC spaces of |
1042 | indent. FLAGS specifies details to show in the dump (see TDF_* in | |
7ee2468b | 1043 | dumpfile.h). */ |
726a989a RB |
1044 | |
1045 | static void | |
1046 | dump_gimple_resx (pretty_printer *buffer, gimple gs, int spc, int flags) | |
1047 | { | |
1048 | if (flags & TDF_RAW) | |
1049 | dump_gimple_fmt (buffer, spc, flags, "%G <%d>", gs, | |
1d65f45c | 1050 | gimple_resx_region (gs)); |
726a989a RB |
1051 | else |
1052 | dump_gimple_fmt (buffer, spc, flags, "resx %d", gimple_resx_region (gs)); | |
1053 | } | |
1054 | ||
1d65f45c RH |
1055 | /* Dump a GIMPLE_EH_DISPATCH tuple on the pretty_printer BUFFER. */ |
1056 | ||
1057 | static void | |
1058 | dump_gimple_eh_dispatch (pretty_printer *buffer, gimple gs, int spc, int flags) | |
1059 | { | |
1060 | if (flags & TDF_RAW) | |
1061 | dump_gimple_fmt (buffer, spc, flags, "%G <%d>", gs, | |
1062 | gimple_eh_dispatch_region (gs)); | |
1063 | else | |
1064 | dump_gimple_fmt (buffer, spc, flags, "eh_dispatch %d", | |
1065 | gimple_eh_dispatch_region (gs)); | |
1066 | } | |
1067 | ||
b5b8b0ac AO |
1068 | /* Dump a GIMPLE_DEBUG tuple on the pretty_printer BUFFER, SPC spaces |
1069 | of indent. FLAGS specifies details to show in the dump (see TDF_* | |
7ee2468b | 1070 | in dumpfile.h). */ |
b5b8b0ac AO |
1071 | |
1072 | static void | |
1073 | dump_gimple_debug (pretty_printer *buffer, gimple gs, int spc, int flags) | |
1074 | { | |
1075 | switch (gs->gsbase.subcode) | |
1076 | { | |
1077 | case GIMPLE_DEBUG_BIND: | |
1078 | if (flags & TDF_RAW) | |
1079 | dump_gimple_fmt (buffer, spc, flags, "%G BIND <%T, %T>", gs, | |
1080 | gimple_debug_bind_get_var (gs), | |
1081 | gimple_debug_bind_get_value (gs)); | |
1082 | else | |
1083 | dump_gimple_fmt (buffer, spc, flags, "# DEBUG %T => %T", | |
1084 | gimple_debug_bind_get_var (gs), | |
1085 | gimple_debug_bind_get_value (gs)); | |
1086 | break; | |
1087 | ||
ddb555ed JJ |
1088 | case GIMPLE_DEBUG_SOURCE_BIND: |
1089 | if (flags & TDF_RAW) | |
1090 | dump_gimple_fmt (buffer, spc, flags, "%G SRCBIND <%T, %T>", gs, | |
1091 | gimple_debug_source_bind_get_var (gs), | |
1092 | gimple_debug_source_bind_get_value (gs)); | |
1093 | else | |
1094 | dump_gimple_fmt (buffer, spc, flags, "# DEBUG %T s=> %T", | |
1095 | gimple_debug_source_bind_get_var (gs), | |
1096 | gimple_debug_source_bind_get_value (gs)); | |
1097 | break; | |
1098 | ||
b5b8b0ac AO |
1099 | default: |
1100 | gcc_unreachable (); | |
1101 | } | |
1102 | } | |
1103 | ||
726a989a RB |
1104 | /* Dump a GIMPLE_OMP_FOR tuple on the pretty_printer BUFFER. */ |
1105 | static void | |
1106 | dump_gimple_omp_for (pretty_printer *buffer, gimple gs, int spc, int flags) | |
1107 | { | |
1108 | size_t i; | |
1109 | ||
1110 | if (flags & TDF_RAW) | |
1111 | { | |
74bf76ed JJ |
1112 | const char *kind; |
1113 | switch (gimple_omp_for_kind (gs)) | |
1114 | { | |
1115 | case GF_OMP_FOR_KIND_FOR: | |
1116 | kind = ""; | |
1117 | break; | |
1118 | case GF_OMP_FOR_KIND_SIMD: | |
1119 | kind = " simd"; | |
1120 | break; | |
acf0174b JJ |
1121 | case GF_OMP_FOR_KIND_DISTRIBUTE: |
1122 | kind = " distribute"; | |
1123 | break; | |
74bf76ed JJ |
1124 | default: |
1125 | gcc_unreachable (); | |
1126 | } | |
1127 | dump_gimple_fmt (buffer, spc, flags, "%G%s <%+BODY <%S>%nCLAUSES <", gs, | |
1128 | kind, gimple_omp_body (gs)); | |
726a989a RB |
1129 | dump_omp_clauses (buffer, gimple_omp_for_clauses (gs), spc, flags); |
1130 | dump_gimple_fmt (buffer, spc, flags, " >,"); | |
1131 | for (i = 0; i < gimple_omp_for_collapse (gs); i++) | |
1132 | dump_gimple_fmt (buffer, spc, flags, | |
1133 | "%+%T, %T, %T, %s, %T,%n", | |
1134 | gimple_omp_for_index (gs, i), | |
1135 | gimple_omp_for_initial (gs, i), | |
1136 | gimple_omp_for_final (gs, i), | |
5806f481 | 1137 | get_tree_code_name (gimple_omp_for_cond (gs, i)), |
726a989a RB |
1138 | gimple_omp_for_incr (gs, i)); |
1139 | dump_gimple_fmt (buffer, spc, flags, "PRE_BODY <%S>%->", | |
1140 | gimple_omp_for_pre_body (gs)); | |
1141 | } | |
1142 | else | |
1143 | { | |
74bf76ed JJ |
1144 | switch (gimple_omp_for_kind (gs)) |
1145 | { | |
1146 | case GF_OMP_FOR_KIND_FOR: | |
1147 | pp_string (buffer, "#pragma omp for"); | |
1148 | break; | |
1149 | case GF_OMP_FOR_KIND_SIMD: | |
1150 | pp_string (buffer, "#pragma omp simd"); | |
1151 | break; | |
acf0174b JJ |
1152 | case GF_OMP_FOR_KIND_DISTRIBUTE: |
1153 | pp_string (buffer, "#pragma omp distribute"); | |
1154 | break; | |
74bf76ed JJ |
1155 | default: |
1156 | gcc_unreachable (); | |
1157 | } | |
726a989a RB |
1158 | dump_omp_clauses (buffer, gimple_omp_for_clauses (gs), spc, flags); |
1159 | for (i = 0; i < gimple_omp_for_collapse (gs); i++) | |
1160 | { | |
1161 | if (i) | |
1162 | spc += 2; | |
1163 | newline_and_indent (buffer, spc); | |
1164 | pp_string (buffer, "for ("); | |
1165 | dump_generic_node (buffer, gimple_omp_for_index (gs, i), spc, | |
1166 | flags, false); | |
1167 | pp_string (buffer, " = "); | |
1168 | dump_generic_node (buffer, gimple_omp_for_initial (gs, i), spc, | |
1169 | flags, false); | |
1170 | pp_string (buffer, "; "); | |
1171 | ||
1172 | dump_generic_node (buffer, gimple_omp_for_index (gs, i), spc, | |
1173 | flags, false); | |
1174 | pp_space (buffer); | |
1175 | switch (gimple_omp_for_cond (gs, i)) | |
1176 | { | |
1177 | case LT_EXPR: | |
07838b13 | 1178 | pp_less (buffer); |
726a989a RB |
1179 | break; |
1180 | case GT_EXPR: | |
07838b13 | 1181 | pp_greater (buffer); |
726a989a RB |
1182 | break; |
1183 | case LE_EXPR: | |
137a1a27 | 1184 | pp_less_equal (buffer); |
726a989a RB |
1185 | break; |
1186 | case GE_EXPR: | |
137a1a27 | 1187 | pp_greater_equal (buffer); |
726a989a RB |
1188 | break; |
1189 | default: | |
1190 | gcc_unreachable (); | |
1191 | } | |
1192 | pp_space (buffer); | |
1193 | dump_generic_node (buffer, gimple_omp_for_final (gs, i), spc, | |
1194 | flags, false); | |
1195 | pp_string (buffer, "; "); | |
1196 | ||
1197 | dump_generic_node (buffer, gimple_omp_for_index (gs, i), spc, | |
1198 | flags, false); | |
1199 | pp_string (buffer, " = "); | |
1200 | dump_generic_node (buffer, gimple_omp_for_incr (gs, i), spc, | |
1201 | flags, false); | |
07838b13 | 1202 | pp_right_paren (buffer); |
726a989a RB |
1203 | } |
1204 | ||
1205 | if (!gimple_seq_empty_p (gimple_omp_body (gs))) | |
1206 | { | |
1207 | newline_and_indent (buffer, spc + 2); | |
07838b13 | 1208 | pp_left_brace (buffer); |
726a989a RB |
1209 | pp_newline (buffer); |
1210 | dump_gimple_seq (buffer, gimple_omp_body (gs), spc + 4, flags); | |
1211 | newline_and_indent (buffer, spc + 2); | |
07838b13 | 1212 | pp_right_brace (buffer); |
726a989a RB |
1213 | } |
1214 | } | |
1215 | } | |
1216 | ||
1217 | /* Dump a GIMPLE_OMP_CONTINUE tuple on the pretty_printer BUFFER. */ | |
1218 | ||
1219 | static void | |
1220 | dump_gimple_omp_continue (pretty_printer *buffer, gimple gs, int spc, int flags) | |
1221 | { | |
1222 | if (flags & TDF_RAW) | |
1223 | { | |
1224 | dump_gimple_fmt (buffer, spc, flags, "%G <%T, %T>", gs, | |
1225 | gimple_omp_continue_control_def (gs), | |
1226 | gimple_omp_continue_control_use (gs)); | |
1227 | } | |
1228 | else | |
1229 | { | |
1230 | pp_string (buffer, "#pragma omp continue ("); | |
1231 | dump_generic_node (buffer, gimple_omp_continue_control_def (gs), | |
1232 | spc, flags, false); | |
07838b13 | 1233 | pp_comma (buffer); |
726a989a RB |
1234 | pp_space (buffer); |
1235 | dump_generic_node (buffer, gimple_omp_continue_control_use (gs), | |
1236 | spc, flags, false); | |
07838b13 | 1237 | pp_right_paren (buffer); |
726a989a RB |
1238 | } |
1239 | } | |
1240 | ||
1241 | /* Dump a GIMPLE_OMP_SINGLE tuple on the pretty_printer BUFFER. */ | |
1242 | ||
1243 | static void | |
1244 | dump_gimple_omp_single (pretty_printer *buffer, gimple gs, int spc, int flags) | |
1245 | { | |
1246 | if (flags & TDF_RAW) | |
1247 | { | |
1248 | dump_gimple_fmt (buffer, spc, flags, "%G <%+BODY <%S>%nCLAUSES <", gs, | |
1249 | gimple_omp_body (gs)); | |
1250 | dump_omp_clauses (buffer, gimple_omp_single_clauses (gs), spc, flags); | |
1251 | dump_gimple_fmt (buffer, spc, flags, " >"); | |
1252 | } | |
1253 | else | |
1254 | { | |
1255 | pp_string (buffer, "#pragma omp single"); | |
1256 | dump_omp_clauses (buffer, gimple_omp_single_clauses (gs), spc, flags); | |
1257 | if (!gimple_seq_empty_p (gimple_omp_body (gs))) | |
1258 | { | |
1259 | newline_and_indent (buffer, spc + 2); | |
07838b13 | 1260 | pp_left_brace (buffer); |
726a989a RB |
1261 | pp_newline (buffer); |
1262 | dump_gimple_seq (buffer, gimple_omp_body (gs), spc + 4, flags); | |
1263 | newline_and_indent (buffer, spc + 2); | |
07838b13 | 1264 | pp_right_brace (buffer); |
726a989a RB |
1265 | } |
1266 | } | |
1267 | } | |
1268 | ||
acf0174b JJ |
1269 | /* Dump a GIMPLE_OMP_TARGET tuple on the pretty_printer BUFFER. */ |
1270 | ||
1271 | static void | |
1272 | dump_gimple_omp_target (pretty_printer *buffer, gimple gs, int spc, int flags) | |
1273 | { | |
1274 | const char *kind; | |
1275 | switch (gimple_omp_target_kind (gs)) | |
1276 | { | |
1277 | case GF_OMP_TARGET_KIND_REGION: | |
1278 | kind = ""; | |
1279 | break; | |
1280 | case GF_OMP_TARGET_KIND_DATA: | |
1281 | kind = " data"; | |
1282 | break; | |
1283 | case GF_OMP_TARGET_KIND_UPDATE: | |
1284 | kind = " update"; | |
1285 | break; | |
1286 | default: | |
1287 | gcc_unreachable (); | |
1288 | } | |
1289 | if (flags & TDF_RAW) | |
1290 | { | |
1291 | dump_gimple_fmt (buffer, spc, flags, "%G%s <%+BODY <%S>%nCLAUSES <", gs, | |
1292 | kind, gimple_omp_body (gs)); | |
1293 | dump_omp_clauses (buffer, gimple_omp_target_clauses (gs), spc, flags); | |
1294 | dump_gimple_fmt (buffer, spc, flags, " >"); | |
1295 | } | |
1296 | else | |
1297 | { | |
1298 | pp_string (buffer, "#pragma omp target"); | |
1299 | pp_string (buffer, kind); | |
1300 | dump_omp_clauses (buffer, gimple_omp_target_clauses (gs), spc, flags); | |
1301 | if (gimple_omp_target_child_fn (gs)) | |
1302 | { | |
1303 | pp_string (buffer, " [child fn: "); | |
1304 | dump_generic_node (buffer, gimple_omp_target_child_fn (gs), | |
1305 | spc, flags, false); | |
1306 | pp_right_bracket (buffer); | |
1307 | } | |
1308 | if (!gimple_seq_empty_p (gimple_omp_body (gs))) | |
1309 | { | |
1310 | newline_and_indent (buffer, spc + 2); | |
1311 | pp_character (buffer, '{'); | |
1312 | pp_newline (buffer); | |
1313 | dump_gimple_seq (buffer, gimple_omp_body (gs), spc + 4, flags); | |
1314 | newline_and_indent (buffer, spc + 2); | |
1315 | pp_character (buffer, '}'); | |
1316 | } | |
1317 | } | |
1318 | } | |
1319 | ||
1320 | /* Dump a GIMPLE_OMP_TEAMS tuple on the pretty_printer BUFFER. */ | |
1321 | ||
1322 | static void | |
1323 | dump_gimple_omp_teams (pretty_printer *buffer, gimple gs, int spc, int flags) | |
1324 | { | |
1325 | if (flags & TDF_RAW) | |
1326 | { | |
1327 | dump_gimple_fmt (buffer, spc, flags, "%G <%+BODY <%S>%nCLAUSES <", gs, | |
1328 | gimple_omp_body (gs)); | |
1329 | dump_omp_clauses (buffer, gimple_omp_teams_clauses (gs), spc, flags); | |
1330 | dump_gimple_fmt (buffer, spc, flags, " >"); | |
1331 | } | |
1332 | else | |
1333 | { | |
1334 | pp_string (buffer, "#pragma omp teams"); | |
1335 | dump_omp_clauses (buffer, gimple_omp_teams_clauses (gs), spc, flags); | |
1336 | if (!gimple_seq_empty_p (gimple_omp_body (gs))) | |
1337 | { | |
1338 | newline_and_indent (buffer, spc + 2); | |
1339 | pp_character (buffer, '{'); | |
1340 | pp_newline (buffer); | |
1341 | dump_gimple_seq (buffer, gimple_omp_body (gs), spc + 4, flags); | |
1342 | newline_and_indent (buffer, spc + 2); | |
1343 | pp_character (buffer, '}'); | |
1344 | } | |
1345 | } | |
1346 | } | |
1347 | ||
726a989a RB |
1348 | /* Dump a GIMPLE_OMP_SECTIONS tuple on the pretty_printer BUFFER. */ |
1349 | ||
1350 | static void | |
1351 | dump_gimple_omp_sections (pretty_printer *buffer, gimple gs, int spc, | |
1352 | int flags) | |
1353 | { | |
1354 | if (flags & TDF_RAW) | |
1355 | { | |
1356 | dump_gimple_fmt (buffer, spc, flags, "%G <%+BODY <%S>%nCLAUSES <", gs, | |
1357 | gimple_omp_body (gs)); | |
1358 | dump_omp_clauses (buffer, gimple_omp_sections_clauses (gs), spc, flags); | |
1359 | dump_gimple_fmt (buffer, spc, flags, " >"); | |
1360 | } | |
1361 | else | |
1362 | { | |
1363 | pp_string (buffer, "#pragma omp sections"); | |
1364 | if (gimple_omp_sections_control (gs)) | |
1365 | { | |
1366 | pp_string (buffer, " <"); | |
1367 | dump_generic_node (buffer, gimple_omp_sections_control (gs), spc, | |
1368 | flags, false); | |
07838b13 | 1369 | pp_greater (buffer); |
726a989a RB |
1370 | } |
1371 | dump_omp_clauses (buffer, gimple_omp_sections_clauses (gs), spc, flags); | |
1372 | if (!gimple_seq_empty_p (gimple_omp_body (gs))) | |
1373 | { | |
1374 | newline_and_indent (buffer, spc + 2); | |
07838b13 | 1375 | pp_left_brace (buffer); |
726a989a RB |
1376 | pp_newline (buffer); |
1377 | dump_gimple_seq (buffer, gimple_omp_body (gs), spc + 4, flags); | |
1378 | newline_and_indent (buffer, spc + 2); | |
07838b13 | 1379 | pp_right_brace (buffer); |
726a989a RB |
1380 | } |
1381 | } | |
1382 | } | |
1383 | ||
acf0174b JJ |
1384 | /* Dump a GIMPLE_OMP_{MASTER,TASKGROUP,ORDERED,SECTION} tuple on the |
1385 | pretty_printer BUFFER. */ | |
726a989a RB |
1386 | |
1387 | static void | |
1388 | dump_gimple_omp_block (pretty_printer *buffer, gimple gs, int spc, int flags) | |
1389 | { | |
1390 | if (flags & TDF_RAW) | |
1391 | dump_gimple_fmt (buffer, spc, flags, "%G <%+BODY <%S> >", gs, | |
1392 | gimple_omp_body (gs)); | |
1393 | else | |
1394 | { | |
1395 | switch (gimple_code (gs)) | |
1396 | { | |
1397 | case GIMPLE_OMP_MASTER: | |
1398 | pp_string (buffer, "#pragma omp master"); | |
1399 | break; | |
acf0174b JJ |
1400 | case GIMPLE_OMP_TASKGROUP: |
1401 | pp_string (buffer, "#pragma omp taskgroup"); | |
1402 | break; | |
726a989a RB |
1403 | case GIMPLE_OMP_ORDERED: |
1404 | pp_string (buffer, "#pragma omp ordered"); | |
1405 | break; | |
1406 | case GIMPLE_OMP_SECTION: | |
1407 | pp_string (buffer, "#pragma omp section"); | |
1408 | break; | |
1409 | default: | |
1410 | gcc_unreachable (); | |
1411 | } | |
1412 | if (!gimple_seq_empty_p (gimple_omp_body (gs))) | |
1413 | { | |
1414 | newline_and_indent (buffer, spc + 2); | |
07838b13 | 1415 | pp_left_brace (buffer); |
726a989a RB |
1416 | pp_newline (buffer); |
1417 | dump_gimple_seq (buffer, gimple_omp_body (gs), spc + 4, flags); | |
1418 | newline_and_indent (buffer, spc + 2); | |
07838b13 | 1419 | pp_right_brace (buffer); |
726a989a RB |
1420 | } |
1421 | } | |
1422 | } | |
1423 | ||
1424 | /* Dump a GIMPLE_OMP_CRITICAL tuple on the pretty_printer BUFFER. */ | |
1425 | ||
1426 | static void | |
1427 | dump_gimple_omp_critical (pretty_printer *buffer, gimple gs, int spc, | |
1428 | int flags) | |
1429 | { | |
1430 | if (flags & TDF_RAW) | |
1431 | dump_gimple_fmt (buffer, spc, flags, "%G <%+BODY <%S> >", gs, | |
1432 | gimple_omp_body (gs)); | |
1433 | else | |
1434 | { | |
1435 | pp_string (buffer, "#pragma omp critical"); | |
1436 | if (gimple_omp_critical_name (gs)) | |
1437 | { | |
1438 | pp_string (buffer, " ("); | |
1439 | dump_generic_node (buffer, gimple_omp_critical_name (gs), spc, | |
1440 | flags, false); | |
07838b13 | 1441 | pp_right_paren (buffer); |
726a989a RB |
1442 | } |
1443 | if (!gimple_seq_empty_p (gimple_omp_body (gs))) | |
1444 | { | |
1445 | newline_and_indent (buffer, spc + 2); | |
07838b13 | 1446 | pp_left_brace (buffer); |
726a989a RB |
1447 | pp_newline (buffer); |
1448 | dump_gimple_seq (buffer, gimple_omp_body (gs), spc + 4, flags); | |
1449 | newline_and_indent (buffer, spc + 2); | |
07838b13 | 1450 | pp_right_brace (buffer); |
726a989a RB |
1451 | } |
1452 | } | |
1453 | } | |
1454 | ||
1455 | /* Dump a GIMPLE_OMP_RETURN tuple on the pretty_printer BUFFER. */ | |
1456 | ||
1457 | static void | |
1458 | dump_gimple_omp_return (pretty_printer *buffer, gimple gs, int spc, int flags) | |
1459 | { | |
1460 | if (flags & TDF_RAW) | |
1461 | { | |
acf0174b | 1462 | dump_gimple_fmt (buffer, spc, flags, "%G <nowait=%d", gs, |
726a989a | 1463 | (int) gimple_omp_return_nowait_p (gs)); |
acf0174b JJ |
1464 | if (gimple_omp_return_lhs (gs)) |
1465 | dump_gimple_fmt (buffer, spc, flags, ", lhs=%T>", | |
1466 | gimple_omp_return_lhs (gs)); | |
1467 | else | |
1468 | dump_gimple_fmt (buffer, spc, flags, ">"); | |
726a989a RB |
1469 | } |
1470 | else | |
1471 | { | |
1472 | pp_string (buffer, "#pragma omp return"); | |
1473 | if (gimple_omp_return_nowait_p (gs)) | |
1474 | pp_string (buffer, "(nowait)"); | |
acf0174b JJ |
1475 | if (gimple_omp_return_lhs (gs)) |
1476 | { | |
1477 | pp_string (buffer, " (set "); | |
1478 | dump_generic_node (buffer, gimple_omp_return_lhs (gs), | |
1479 | spc, flags, false); | |
1480 | pp_character (buffer, ')'); | |
1481 | } | |
726a989a RB |
1482 | } |
1483 | } | |
1484 | ||
0a35513e AH |
1485 | /* Dump a GIMPLE_TRANSACTION tuple on the pretty_printer BUFFER. */ |
1486 | ||
1487 | static void | |
1488 | dump_gimple_transaction (pretty_printer *buffer, gimple gs, int spc, int flags) | |
1489 | { | |
1490 | unsigned subcode = gimple_transaction_subcode (gs); | |
1491 | ||
1492 | if (flags & TDF_RAW) | |
1493 | { | |
1494 | dump_gimple_fmt (buffer, spc, flags, | |
1495 | "%G [SUBCODE=%x,LABEL=%T] <%+BODY <%S> >", | |
1496 | gs, subcode, gimple_transaction_label (gs), | |
1497 | gimple_transaction_body (gs)); | |
1498 | } | |
1499 | else | |
1500 | { | |
1501 | if (subcode & GTMA_IS_OUTER) | |
1502 | pp_string (buffer, "__transaction_atomic [[outer]]"); | |
1503 | else if (subcode & GTMA_IS_RELAXED) | |
1504 | pp_string (buffer, "__transaction_relaxed"); | |
1505 | else | |
1506 | pp_string (buffer, "__transaction_atomic"); | |
1507 | subcode &= ~GTMA_DECLARATION_MASK; | |
1508 | ||
1509 | if (subcode || gimple_transaction_label (gs)) | |
1510 | { | |
1511 | pp_string (buffer, " //"); | |
1512 | if (gimple_transaction_label (gs)) | |
1513 | { | |
1514 | pp_string (buffer, " LABEL="); | |
1515 | dump_generic_node (buffer, gimple_transaction_label (gs), | |
1516 | spc, flags, false); | |
1517 | } | |
1518 | if (subcode) | |
1519 | { | |
1520 | pp_string (buffer, " SUBCODE=[ "); | |
1521 | if (subcode & GTMA_HAVE_ABORT) | |
1522 | { | |
1523 | pp_string (buffer, "GTMA_HAVE_ABORT "); | |
1524 | subcode &= ~GTMA_HAVE_ABORT; | |
1525 | } | |
1526 | if (subcode & GTMA_HAVE_LOAD) | |
1527 | { | |
1528 | pp_string (buffer, "GTMA_HAVE_LOAD "); | |
1529 | subcode &= ~GTMA_HAVE_LOAD; | |
1530 | } | |
1531 | if (subcode & GTMA_HAVE_STORE) | |
1532 | { | |
1533 | pp_string (buffer, "GTMA_HAVE_STORE "); | |
1534 | subcode &= ~GTMA_HAVE_STORE; | |
1535 | } | |
1536 | if (subcode & GTMA_MAY_ENTER_IRREVOCABLE) | |
1537 | { | |
1538 | pp_string (buffer, "GTMA_MAY_ENTER_IRREVOCABLE "); | |
1539 | subcode &= ~GTMA_MAY_ENTER_IRREVOCABLE; | |
1540 | } | |
1541 | if (subcode & GTMA_DOES_GO_IRREVOCABLE) | |
1542 | { | |
1543 | pp_string (buffer, "GTMA_DOES_GO_IRREVOCABLE "); | |
1544 | subcode &= ~GTMA_DOES_GO_IRREVOCABLE; | |
1545 | } | |
b7a78683 AH |
1546 | if (subcode & GTMA_HAS_NO_INSTRUMENTATION) |
1547 | { | |
1548 | pp_string (buffer, "GTMA_HAS_NO_INSTRUMENTATION "); | |
1549 | subcode &= ~GTMA_HAS_NO_INSTRUMENTATION; | |
1550 | } | |
0a35513e AH |
1551 | if (subcode) |
1552 | pp_printf (buffer, "0x%x ", subcode); | |
137a1a27 | 1553 | pp_right_bracket (buffer); |
0a35513e AH |
1554 | } |
1555 | } | |
1556 | ||
1557 | if (!gimple_seq_empty_p (gimple_transaction_body (gs))) | |
1558 | { | |
1559 | newline_and_indent (buffer, spc + 2); | |
07838b13 | 1560 | pp_left_brace (buffer); |
0a35513e AH |
1561 | pp_newline (buffer); |
1562 | dump_gimple_seq (buffer, gimple_transaction_body (gs), | |
1563 | spc + 4, flags); | |
1564 | newline_and_indent (buffer, spc + 2); | |
07838b13 | 1565 | pp_right_brace (buffer); |
0a35513e AH |
1566 | } |
1567 | } | |
1568 | } | |
1569 | ||
726a989a RB |
1570 | /* Dump a GIMPLE_ASM tuple on the pretty_printer BUFFER, SPC spaces of |
1571 | indent. FLAGS specifies details to show in the dump (see TDF_* in | |
7ee2468b | 1572 | dumpfile.h). */ |
726a989a RB |
1573 | |
1574 | static void | |
1575 | dump_gimple_asm (pretty_printer *buffer, gimple gs, int spc, int flags) | |
1576 | { | |
1c384bf1 | 1577 | unsigned int i, n, f, fields; |
726a989a RB |
1578 | |
1579 | if (flags & TDF_RAW) | |
1c384bf1 RH |
1580 | { |
1581 | dump_gimple_fmt (buffer, spc, flags, "%G <%+STRING <%n%s%n>", gs, | |
1582 | gimple_asm_string (gs)); | |
1583 | ||
1584 | n = gimple_asm_noutputs (gs); | |
1585 | if (n) | |
1586 | { | |
1587 | newline_and_indent (buffer, spc + 2); | |
1588 | pp_string (buffer, "OUTPUT: "); | |
1589 | for (i = 0; i < n; i++) | |
1590 | { | |
1591 | dump_generic_node (buffer, gimple_asm_output_op (gs, i), | |
1592 | spc, flags, false); | |
1593 | if (i < n - 1) | |
1594 | pp_string (buffer, ", "); | |
1595 | } | |
1596 | } | |
1597 | ||
1598 | n = gimple_asm_ninputs (gs); | |
1599 | if (n) | |
1600 | { | |
1601 | newline_and_indent (buffer, spc + 2); | |
1602 | pp_string (buffer, "INPUT: "); | |
1603 | for (i = 0; i < n; i++) | |
1604 | { | |
1605 | dump_generic_node (buffer, gimple_asm_input_op (gs, i), | |
1606 | spc, flags, false); | |
1607 | if (i < n - 1) | |
1608 | pp_string (buffer, ", "); | |
1609 | } | |
1610 | } | |
1611 | ||
1612 | n = gimple_asm_nclobbers (gs); | |
1613 | if (n) | |
1614 | { | |
1615 | newline_and_indent (buffer, spc + 2); | |
1616 | pp_string (buffer, "CLOBBER: "); | |
1617 | for (i = 0; i < n; i++) | |
1618 | { | |
1619 | dump_generic_node (buffer, gimple_asm_clobber_op (gs, i), | |
1620 | spc, flags, false); | |
1621 | if (i < n - 1) | |
1622 | pp_string (buffer, ", "); | |
1623 | } | |
1624 | } | |
1625 | ||
1626 | n = gimple_asm_nlabels (gs); | |
1627 | if (n) | |
1628 | { | |
1629 | newline_and_indent (buffer, spc + 2); | |
1630 | pp_string (buffer, "LABEL: "); | |
1631 | for (i = 0; i < n; i++) | |
1632 | { | |
1633 | dump_generic_node (buffer, gimple_asm_label_op (gs, i), | |
1634 | spc, flags, false); | |
1635 | if (i < n - 1) | |
1636 | pp_string (buffer, ", "); | |
1637 | } | |
1638 | } | |
1639 | ||
1640 | newline_and_indent (buffer, spc); | |
07838b13 | 1641 | pp_greater (buffer); |
1c384bf1 | 1642 | } |
726a989a RB |
1643 | else |
1644 | { | |
1645 | pp_string (buffer, "__asm__"); | |
1646 | if (gimple_asm_volatile_p (gs)) | |
1647 | pp_string (buffer, " __volatile__"); | |
1c384bf1 RH |
1648 | if (gimple_asm_nlabels (gs)) |
1649 | pp_string (buffer, " goto"); | |
726a989a RB |
1650 | pp_string (buffer, "(\""); |
1651 | pp_string (buffer, gimple_asm_string (gs)); | |
1652 | pp_string (buffer, "\""); | |
726a989a | 1653 | |
1c384bf1 RH |
1654 | if (gimple_asm_nlabels (gs)) |
1655 | fields = 4; | |
1656 | else if (gimple_asm_nclobbers (gs)) | |
1657 | fields = 3; | |
1658 | else if (gimple_asm_ninputs (gs)) | |
1659 | fields = 2; | |
1660 | else if (gimple_asm_noutputs (gs)) | |
1661 | fields = 1; | |
1662 | else | |
1663 | fields = 0; | |
726a989a | 1664 | |
1c384bf1 RH |
1665 | for (f = 0; f < fields; ++f) |
1666 | { | |
1667 | pp_string (buffer, " : "); | |
726a989a | 1668 | |
1c384bf1 RH |
1669 | switch (f) |
1670 | { | |
1671 | case 0: | |
1672 | n = gimple_asm_noutputs (gs); | |
1673 | for (i = 0; i < n; i++) | |
1674 | { | |
1675 | dump_generic_node (buffer, gimple_asm_output_op (gs, i), | |
1676 | spc, flags, false); | |
1677 | if (i < n - 1) | |
1678 | pp_string (buffer, ", "); | |
1679 | } | |
1680 | break; | |
726a989a | 1681 | |
1c384bf1 RH |
1682 | case 1: |
1683 | n = gimple_asm_ninputs (gs); | |
1684 | for (i = 0; i < n; i++) | |
1685 | { | |
1686 | dump_generic_node (buffer, gimple_asm_input_op (gs, i), | |
1687 | spc, flags, false); | |
1688 | if (i < n - 1) | |
1689 | pp_string (buffer, ", "); | |
1690 | } | |
1691 | break; | |
726a989a | 1692 | |
1c384bf1 RH |
1693 | case 2: |
1694 | n = gimple_asm_nclobbers (gs); | |
1695 | for (i = 0; i < n; i++) | |
1696 | { | |
1697 | dump_generic_node (buffer, gimple_asm_clobber_op (gs, i), | |
1698 | spc, flags, false); | |
1699 | if (i < n - 1) | |
1700 | pp_string (buffer, ", "); | |
1701 | } | |
1702 | break; | |
726a989a | 1703 | |
1c384bf1 RH |
1704 | case 3: |
1705 | n = gimple_asm_nlabels (gs); | |
1706 | for (i = 0; i < n; i++) | |
1707 | { | |
1708 | dump_generic_node (buffer, gimple_asm_label_op (gs, i), | |
1709 | spc, flags, false); | |
1710 | if (i < n - 1) | |
1711 | pp_string (buffer, ", "); | |
1712 | } | |
1713 | break; | |
1714 | ||
1715 | default: | |
1716 | gcc_unreachable (); | |
1717 | } | |
1718 | } | |
1719 | ||
1720 | pp_string (buffer, ");"); | |
726a989a | 1721 | } |
726a989a RB |
1722 | } |
1723 | ||
a895a2b8 KV |
1724 | /* Dump ptr_info and range_info for NODE on pretty_printer BUFFER with |
1725 | SPC spaces of indent. */ | |
726a989a RB |
1726 | |
1727 | static void | |
a895a2b8 | 1728 | dump_ssaname_info (pretty_printer *buffer, tree node, int spc) |
726a989a | 1729 | { |
a895a2b8 KV |
1730 | if (TREE_CODE (node) != SSA_NAME) |
1731 | return; | |
f0107145 | 1732 | |
a895a2b8 KV |
1733 | if (POINTER_TYPE_P (TREE_TYPE (node)) |
1734 | && SSA_NAME_PTR_INFO (node)) | |
f0107145 | 1735 | { |
644ffefd | 1736 | unsigned int align, misalign; |
a895a2b8 | 1737 | struct ptr_info_def *pi = SSA_NAME_PTR_INFO (node); |
d09c0e9b | 1738 | pp_string (buffer, "# PT = "); |
1be38ccb RG |
1739 | pp_points_to_solution (buffer, &pi->pt); |
1740 | newline_and_indent (buffer, spc); | |
644ffefd | 1741 | if (get_ptr_info_alignment (pi, &align, &misalign)) |
b1edf2bc | 1742 | { |
644ffefd | 1743 | pp_printf (buffer, "# ALIGN = %u, MISALIGN = %u", align, misalign); |
b1edf2bc RG |
1744 | newline_and_indent (buffer, spc); |
1745 | } | |
f0107145 | 1746 | } |
726a989a | 1747 | |
a895a2b8 KV |
1748 | if (!POINTER_TYPE_P (TREE_TYPE (node)) |
1749 | && SSA_NAME_RANGE_INFO (node)) | |
1750 | { | |
c853f62a | 1751 | double_int min, max, nonzero_bits; |
a895a2b8 KV |
1752 | value_range_type range_type = get_range_info (node, &min, &max); |
1753 | ||
1754 | if (range_type == VR_VARYING) | |
d09c0e9b | 1755 | pp_printf (buffer, "# RANGE VR_VARYING"); |
a895a2b8 | 1756 | else if (range_type == VR_RANGE || range_type == VR_ANTI_RANGE) |
0498471b CL |
1757 | { |
1758 | pp_printf (buffer, "# RANGE "); | |
1759 | pp_printf (buffer, "%s[", range_type == VR_RANGE ? "" : "~"); | |
1760 | pp_double_int (buffer, min, TYPE_UNSIGNED (TREE_TYPE (node))); | |
1761 | pp_printf (buffer, ", "); | |
1762 | pp_double_int (buffer, max, TYPE_UNSIGNED (TREE_TYPE (node))); | |
1763 | pp_printf (buffer, "]"); | |
0498471b | 1764 | } |
c853f62a JJ |
1765 | nonzero_bits = get_nonzero_bits (node); |
1766 | if (nonzero_bits != double_int_minus_one | |
1767 | && (nonzero_bits | |
1768 | != double_int::mask (TYPE_PRECISION (TREE_TYPE (node))))) | |
1769 | { | |
1770 | pp_string (buffer, " NONZERO "); | |
1771 | sprintf (pp_buffer (buffer)->digit_buffer, | |
1772 | HOST_WIDE_INT_PRINT_DOUBLE_HEX, | |
1773 | (unsigned HOST_WIDE_INT) nonzero_bits.high, | |
1774 | nonzero_bits.low); | |
1775 | pp_string (buffer, pp_buffer (buffer)->digit_buffer); | |
1776 | } | |
1777 | newline_and_indent (buffer, spc); | |
a895a2b8 KV |
1778 | } |
1779 | } | |
1780 | ||
1781 | ||
1782 | /* Dump a PHI node PHI. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. | |
1783 | The caller is responsible for calling pp_flush on BUFFER to finalize | |
d09c0e9b | 1784 | pretty printer. If COMMENT is true, print this after #. */ |
a895a2b8 KV |
1785 | |
1786 | static void | |
d09c0e9b JJ |
1787 | dump_gimple_phi (pretty_printer *buffer, gimple phi, int spc, bool comment, |
1788 | int flags) | |
a895a2b8 KV |
1789 | { |
1790 | size_t i; | |
1791 | tree lhs = gimple_phi_result (phi); | |
1792 | ||
1793 | if (flags & TDF_ALIAS) | |
1794 | dump_ssaname_info (buffer, lhs, spc); | |
1795 | ||
d09c0e9b JJ |
1796 | if (comment) |
1797 | pp_string (buffer, "# "); | |
1798 | ||
726a989a | 1799 | if (flags & TDF_RAW) |
0498471b CL |
1800 | dump_gimple_fmt (buffer, spc, flags, "%G <%T, ", phi, |
1801 | gimple_phi_result (phi)); | |
726a989a RB |
1802 | else |
1803 | { | |
f0107145 | 1804 | dump_generic_node (buffer, lhs, spc, flags, false); |
726a989a RB |
1805 | pp_string (buffer, " = PHI <"); |
1806 | } | |
1807 | for (i = 0; i < gimple_phi_num_args (phi); i++) | |
1808 | { | |
f5045c96 AM |
1809 | if ((flags & TDF_LINENO) && gimple_phi_arg_has_location (phi, i)) |
1810 | { | |
1811 | expanded_location xloc; | |
1812 | ||
1813 | xloc = expand_location (gimple_phi_arg_location (phi, i)); | |
07838b13 | 1814 | pp_left_bracket (buffer); |
f5045c96 AM |
1815 | if (xloc.file) |
1816 | { | |
1817 | pp_string (buffer, xloc.file); | |
1818 | pp_string (buffer, " : "); | |
1819 | } | |
1820 | pp_decimal_int (buffer, xloc.line); | |
137a1a27 | 1821 | pp_colon (buffer); |
f5045c96 AM |
1822 | pp_decimal_int (buffer, xloc.column); |
1823 | pp_string (buffer, "] "); | |
1824 | } | |
726a989a RB |
1825 | dump_generic_node (buffer, gimple_phi_arg_def (phi, i), spc, flags, |
1826 | false); | |
07838b13 | 1827 | pp_left_paren (buffer); |
726a989a | 1828 | pp_decimal_int (buffer, gimple_phi_arg_edge (phi, i)->src->index); |
07838b13 | 1829 | pp_right_paren (buffer); |
726a989a RB |
1830 | if (i < gimple_phi_num_args (phi) - 1) |
1831 | pp_string (buffer, ", "); | |
1832 | } | |
07838b13 | 1833 | pp_greater (buffer); |
726a989a RB |
1834 | } |
1835 | ||
1836 | ||
1837 | /* Dump a GIMPLE_OMP_PARALLEL tuple on the pretty_printer BUFFER, SPC spaces | |
1838 | of indent. FLAGS specifies details to show in the dump (see TDF_* in | |
7ee2468b | 1839 | dumpfile.h). */ |
726a989a RB |
1840 | |
1841 | static void | |
1842 | dump_gimple_omp_parallel (pretty_printer *buffer, gimple gs, int spc, | |
1843 | int flags) | |
1844 | { | |
1845 | if (flags & TDF_RAW) | |
1846 | { | |
1847 | dump_gimple_fmt (buffer, spc, flags, "%G <%+BODY <%S>%nCLAUSES <", gs, | |
1848 | gimple_omp_body (gs)); | |
1849 | dump_omp_clauses (buffer, gimple_omp_parallel_clauses (gs), spc, flags); | |
1850 | dump_gimple_fmt (buffer, spc, flags, " >, %T, %T%n>", | |
1851 | gimple_omp_parallel_child_fn (gs), | |
1852 | gimple_omp_parallel_data_arg (gs)); | |
1853 | } | |
1854 | else | |
1855 | { | |
1856 | gimple_seq body; | |
1857 | pp_string (buffer, "#pragma omp parallel"); | |
1858 | dump_omp_clauses (buffer, gimple_omp_parallel_clauses (gs), spc, flags); | |
1859 | if (gimple_omp_parallel_child_fn (gs)) | |
1860 | { | |
1861 | pp_string (buffer, " [child fn: "); | |
1862 | dump_generic_node (buffer, gimple_omp_parallel_child_fn (gs), | |
1863 | spc, flags, false); | |
1864 | pp_string (buffer, " ("); | |
1865 | if (gimple_omp_parallel_data_arg (gs)) | |
1866 | dump_generic_node (buffer, gimple_omp_parallel_data_arg (gs), | |
1867 | spc, flags, false); | |
1868 | else | |
1869 | pp_string (buffer, "???"); | |
1870 | pp_string (buffer, ")]"); | |
1871 | } | |
1872 | body = gimple_omp_body (gs); | |
1873 | if (body && gimple_code (gimple_seq_first_stmt (body)) != GIMPLE_BIND) | |
1874 | { | |
1875 | newline_and_indent (buffer, spc + 2); | |
07838b13 | 1876 | pp_left_brace (buffer); |
726a989a RB |
1877 | pp_newline (buffer); |
1878 | dump_gimple_seq (buffer, body, spc + 4, flags); | |
1879 | newline_and_indent (buffer, spc + 2); | |
07838b13 | 1880 | pp_right_brace (buffer); |
726a989a RB |
1881 | } |
1882 | else if (body) | |
1883 | { | |
1884 | pp_newline (buffer); | |
1885 | dump_gimple_seq (buffer, body, spc + 2, flags); | |
1886 | } | |
1887 | } | |
1888 | } | |
1889 | ||
1890 | ||
1891 | /* Dump a GIMPLE_OMP_TASK tuple on the pretty_printer BUFFER, SPC spaces | |
1892 | of indent. FLAGS specifies details to show in the dump (see TDF_* in | |
7ee2468b | 1893 | dumpfile.h). */ |
726a989a RB |
1894 | |
1895 | static void | |
1896 | dump_gimple_omp_task (pretty_printer *buffer, gimple gs, int spc, | |
1897 | int flags) | |
1898 | { | |
1899 | if (flags & TDF_RAW) | |
1900 | { | |
1901 | dump_gimple_fmt (buffer, spc, flags, "%G <%+BODY <%S>%nCLAUSES <", gs, | |
1902 | gimple_omp_body (gs)); | |
1903 | dump_omp_clauses (buffer, gimple_omp_task_clauses (gs), spc, flags); | |
1904 | dump_gimple_fmt (buffer, spc, flags, " >, %T, %T, %T, %T, %T%n>", | |
1905 | gimple_omp_task_child_fn (gs), | |
1906 | gimple_omp_task_data_arg (gs), | |
1907 | gimple_omp_task_copy_fn (gs), | |
1908 | gimple_omp_task_arg_size (gs), | |
1909 | gimple_omp_task_arg_size (gs)); | |
1910 | } | |
1911 | else | |
1912 | { | |
1913 | gimple_seq body; | |
1914 | pp_string (buffer, "#pragma omp task"); | |
1915 | dump_omp_clauses (buffer, gimple_omp_task_clauses (gs), spc, flags); | |
1916 | if (gimple_omp_task_child_fn (gs)) | |
1917 | { | |
1918 | pp_string (buffer, " [child fn: "); | |
1919 | dump_generic_node (buffer, gimple_omp_task_child_fn (gs), | |
1920 | spc, flags, false); | |
1921 | pp_string (buffer, " ("); | |
1922 | if (gimple_omp_task_data_arg (gs)) | |
1923 | dump_generic_node (buffer, gimple_omp_task_data_arg (gs), | |
1924 | spc, flags, false); | |
1925 | else | |
1926 | pp_string (buffer, "???"); | |
1927 | pp_string (buffer, ")]"); | |
1928 | } | |
1929 | body = gimple_omp_body (gs); | |
1930 | if (body && gimple_code (gimple_seq_first_stmt (body)) != GIMPLE_BIND) | |
1931 | { | |
1932 | newline_and_indent (buffer, spc + 2); | |
07838b13 | 1933 | pp_left_brace (buffer); |
726a989a RB |
1934 | pp_newline (buffer); |
1935 | dump_gimple_seq (buffer, body, spc + 4, flags); | |
1936 | newline_and_indent (buffer, spc + 2); | |
07838b13 | 1937 | pp_right_brace (buffer); |
726a989a RB |
1938 | } |
1939 | else if (body) | |
1940 | { | |
1941 | pp_newline (buffer); | |
1942 | dump_gimple_seq (buffer, body, spc + 2, flags); | |
1943 | } | |
1944 | } | |
1945 | } | |
1946 | ||
1947 | ||
1948 | /* Dump a GIMPLE_OMP_ATOMIC_LOAD tuple on the pretty_printer BUFFER, SPC | |
1949 | spaces of indent. FLAGS specifies details to show in the dump (see TDF_* | |
7ee2468b | 1950 | in dumpfile.h). */ |
726a989a RB |
1951 | |
1952 | static void | |
1953 | dump_gimple_omp_atomic_load (pretty_printer *buffer, gimple gs, int spc, | |
1954 | int flags) | |
1955 | { | |
1956 | if (flags & TDF_RAW) | |
1957 | { | |
1958 | dump_gimple_fmt (buffer, spc, flags, "%G <%T, %T>", gs, | |
1959 | gimple_omp_atomic_load_lhs (gs), | |
1960 | gimple_omp_atomic_load_rhs (gs)); | |
1961 | } | |
1962 | else | |
1963 | { | |
1964 | pp_string (buffer, "#pragma omp atomic_load"); | |
acf0174b JJ |
1965 | if (gimple_omp_atomic_seq_cst_p (gs)) |
1966 | pp_string (buffer, " seq_cst"); | |
05409788 RH |
1967 | if (gimple_omp_atomic_need_value_p (gs)) |
1968 | pp_string (buffer, " [needed]"); | |
726a989a RB |
1969 | newline_and_indent (buffer, spc + 2); |
1970 | dump_generic_node (buffer, gimple_omp_atomic_load_lhs (gs), | |
1971 | spc, flags, false); | |
1972 | pp_space (buffer); | |
07838b13 | 1973 | pp_equal (buffer); |
726a989a | 1974 | pp_space (buffer); |
07838b13 | 1975 | pp_star (buffer); |
726a989a RB |
1976 | dump_generic_node (buffer, gimple_omp_atomic_load_rhs (gs), |
1977 | spc, flags, false); | |
1978 | } | |
1979 | } | |
1980 | ||
1981 | /* Dump a GIMPLE_OMP_ATOMIC_STORE tuple on the pretty_printer BUFFER, SPC | |
1982 | spaces of indent. FLAGS specifies details to show in the dump (see TDF_* | |
7ee2468b | 1983 | in dumpfile.h). */ |
726a989a RB |
1984 | |
1985 | static void | |
1986 | dump_gimple_omp_atomic_store (pretty_printer *buffer, gimple gs, int spc, | |
1987 | int flags) | |
1988 | { | |
1989 | if (flags & TDF_RAW) | |
1990 | { | |
1991 | dump_gimple_fmt (buffer, spc, flags, "%G <%T>", gs, | |
1992 | gimple_omp_atomic_store_val (gs)); | |
1993 | } | |
1994 | else | |
1995 | { | |
05409788 | 1996 | pp_string (buffer, "#pragma omp atomic_store "); |
acf0174b JJ |
1997 | if (gimple_omp_atomic_seq_cst_p (gs)) |
1998 | pp_string (buffer, "seq_cst "); | |
05409788 RH |
1999 | if (gimple_omp_atomic_need_value_p (gs)) |
2000 | pp_string (buffer, "[needed] "); | |
07838b13 | 2001 | pp_left_paren (buffer); |
726a989a RB |
2002 | dump_generic_node (buffer, gimple_omp_atomic_store_val (gs), |
2003 | spc, flags, false); | |
07838b13 | 2004 | pp_right_paren (buffer); |
726a989a RB |
2005 | } |
2006 | } | |
2007 | ||
726a989a RB |
2008 | |
2009 | /* Dump all the memory operands for statement GS. BUFFER, SPC and | |
b5f47924 | 2010 | FLAGS are as in pp_gimple_stmt_1. */ |
726a989a RB |
2011 | |
2012 | static void | |
2013 | dump_gimple_mem_ops (pretty_printer *buffer, gimple gs, int spc, int flags) | |
2014 | { | |
5006671f RG |
2015 | tree vdef = gimple_vdef (gs); |
2016 | tree vuse = gimple_vuse (gs); | |
726a989a | 2017 | |
2eb712b4 MJ |
2018 | if (!ssa_operands_active (DECL_STRUCT_FUNCTION (current_function_decl)) |
2019 | || !gimple_references_memory_p (gs)) | |
726a989a RB |
2020 | return; |
2021 | ||
5006671f | 2022 | if (vdef != NULL_TREE) |
726a989a | 2023 | { |
5006671f RG |
2024 | pp_string (buffer, "# "); |
2025 | dump_generic_node (buffer, vdef, spc + 2, flags, false); | |
2026 | pp_string (buffer, " = VDEF <"); | |
2027 | dump_generic_node (buffer, vuse, spc + 2, flags, false); | |
07838b13 | 2028 | pp_greater (buffer); |
726a989a | 2029 | newline_and_indent (buffer, spc); |
726a989a | 2030 | } |
5006671f | 2031 | else if (vuse != NULL_TREE) |
726a989a | 2032 | { |
5006671f RG |
2033 | pp_string (buffer, "# VUSE <"); |
2034 | dump_generic_node (buffer, vuse, spc + 2, flags, false); | |
07838b13 | 2035 | pp_greater (buffer); |
726a989a | 2036 | newline_and_indent (buffer, spc); |
726a989a RB |
2037 | } |
2038 | } | |
2039 | ||
2040 | ||
b5f47924 | 2041 | /* Print the gimple statement GS on the pretty printer BUFFER, SPC |
726a989a | 2042 | spaces of indent. FLAGS specifies details to show in the dump (see |
c4669594 SB |
2043 | TDF_* in dumpfile.h). The caller is responsible for calling |
2044 | pp_flush on BUFFER to finalize the pretty printer. */ | |
726a989a RB |
2045 | |
2046 | void | |
b5f47924 | 2047 | pp_gimple_stmt_1 (pretty_printer *buffer, gimple gs, int spc, int flags) |
726a989a RB |
2048 | { |
2049 | if (!gs) | |
2050 | return; | |
2051 | ||
2052 | if (flags & TDF_STMTADDR) | |
2053 | pp_printf (buffer, "<&%p> ", (void *) gs); | |
2054 | ||
2055 | if ((flags & TDF_LINENO) && gimple_has_location (gs)) | |
2056 | { | |
2057 | expanded_location xloc = expand_location (gimple_location (gs)); | |
07838b13 | 2058 | pp_left_bracket (buffer); |
726a989a RB |
2059 | if (xloc.file) |
2060 | { | |
2061 | pp_string (buffer, xloc.file); | |
2062 | pp_string (buffer, " : "); | |
2063 | } | |
2064 | pp_decimal_int (buffer, xloc.line); | |
137a1a27 | 2065 | pp_colon (buffer); |
c2255bc4 | 2066 | pp_decimal_int (buffer, xloc.column); |
726a989a RB |
2067 | pp_string (buffer, "] "); |
2068 | } | |
2069 | ||
cae63f88 DN |
2070 | if (flags & TDF_EH) |
2071 | { | |
1d65f45c RH |
2072 | int lp_nr = lookup_stmt_eh_lp (gs); |
2073 | if (lp_nr > 0) | |
2074 | pp_printf (buffer, "[LP %d] ", lp_nr); | |
2075 | else if (lp_nr < 0) | |
2076 | pp_printf (buffer, "[MNT %d] ", -lp_nr); | |
cae63f88 DN |
2077 | } |
2078 | ||
726a989a RB |
2079 | if ((flags & (TDF_VOPS|TDF_MEMSYMS)) |
2080 | && gimple_has_mem_ops (gs)) | |
2081 | dump_gimple_mem_ops (buffer, gs, spc, flags); | |
2082 | ||
a895a2b8 KV |
2083 | if (gimple_has_lhs (gs) |
2084 | && (flags & TDF_ALIAS)) | |
2085 | dump_ssaname_info (buffer, gimple_get_lhs (gs), spc); | |
f0107145 | 2086 | |
726a989a RB |
2087 | switch (gimple_code (gs)) |
2088 | { | |
2089 | case GIMPLE_ASM: | |
2090 | dump_gimple_asm (buffer, gs, spc, flags); | |
2091 | break; | |
2092 | ||
2093 | case GIMPLE_ASSIGN: | |
2094 | dump_gimple_assign (buffer, gs, spc, flags); | |
2095 | break; | |
2096 | ||
2097 | case GIMPLE_BIND: | |
2098 | dump_gimple_bind (buffer, gs, spc, flags); | |
2099 | break; | |
2100 | ||
2101 | case GIMPLE_CALL: | |
2102 | dump_gimple_call (buffer, gs, spc, flags); | |
2103 | break; | |
2104 | ||
2105 | case GIMPLE_COND: | |
2106 | dump_gimple_cond (buffer, gs, spc, flags); | |
2107 | break; | |
2108 | ||
2109 | case GIMPLE_LABEL: | |
2110 | dump_gimple_label (buffer, gs, spc, flags); | |
2111 | break; | |
2112 | ||
2113 | case GIMPLE_GOTO: | |
2114 | dump_gimple_goto (buffer, gs, spc, flags); | |
2115 | break; | |
2116 | ||
2117 | case GIMPLE_NOP: | |
2118 | pp_string (buffer, "GIMPLE_NOP"); | |
2119 | break; | |
2120 | ||
2121 | case GIMPLE_RETURN: | |
2122 | dump_gimple_return (buffer, gs, spc, flags); | |
2123 | break; | |
2124 | ||
2125 | case GIMPLE_SWITCH: | |
2126 | dump_gimple_switch (buffer, gs, spc, flags); | |
2127 | break; | |
2128 | ||
2129 | case GIMPLE_TRY: | |
2130 | dump_gimple_try (buffer, gs, spc, flags); | |
2131 | break; | |
2132 | ||
2133 | case GIMPLE_PHI: | |
d09c0e9b | 2134 | dump_gimple_phi (buffer, gs, spc, false, flags); |
726a989a RB |
2135 | break; |
2136 | ||
2137 | case GIMPLE_OMP_PARALLEL: | |
2138 | dump_gimple_omp_parallel (buffer, gs, spc, flags); | |
2139 | break; | |
2140 | ||
2141 | case GIMPLE_OMP_TASK: | |
2142 | dump_gimple_omp_task (buffer, gs, spc, flags); | |
2143 | break; | |
2144 | ||
2145 | case GIMPLE_OMP_ATOMIC_LOAD: | |
2146 | dump_gimple_omp_atomic_load (buffer, gs, spc, flags); | |
2147 | ||
2148 | break; | |
2149 | ||
2150 | case GIMPLE_OMP_ATOMIC_STORE: | |
2151 | dump_gimple_omp_atomic_store (buffer, gs, spc, flags); | |
2152 | break; | |
2153 | ||
2154 | case GIMPLE_OMP_FOR: | |
2155 | dump_gimple_omp_for (buffer, gs, spc, flags); | |
2156 | break; | |
2157 | ||
2158 | case GIMPLE_OMP_CONTINUE: | |
2159 | dump_gimple_omp_continue (buffer, gs, spc, flags); | |
2160 | break; | |
2161 | ||
2162 | case GIMPLE_OMP_SINGLE: | |
2163 | dump_gimple_omp_single (buffer, gs, spc, flags); | |
2164 | break; | |
2165 | ||
acf0174b JJ |
2166 | case GIMPLE_OMP_TARGET: |
2167 | dump_gimple_omp_target (buffer, gs, spc, flags); | |
2168 | break; | |
2169 | ||
2170 | case GIMPLE_OMP_TEAMS: | |
2171 | dump_gimple_omp_teams (buffer, gs, spc, flags); | |
2172 | break; | |
2173 | ||
726a989a RB |
2174 | case GIMPLE_OMP_RETURN: |
2175 | dump_gimple_omp_return (buffer, gs, spc, flags); | |
2176 | break; | |
2177 | ||
2178 | case GIMPLE_OMP_SECTIONS: | |
2179 | dump_gimple_omp_sections (buffer, gs, spc, flags); | |
2180 | break; | |
2181 | ||
2182 | case GIMPLE_OMP_SECTIONS_SWITCH: | |
2183 | pp_string (buffer, "GIMPLE_SECTIONS_SWITCH"); | |
2184 | break; | |
2185 | ||
2186 | case GIMPLE_OMP_MASTER: | |
acf0174b | 2187 | case GIMPLE_OMP_TASKGROUP: |
726a989a RB |
2188 | case GIMPLE_OMP_ORDERED: |
2189 | case GIMPLE_OMP_SECTION: | |
2190 | dump_gimple_omp_block (buffer, gs, spc, flags); | |
2191 | break; | |
2192 | ||
2193 | case GIMPLE_OMP_CRITICAL: | |
2194 | dump_gimple_omp_critical (buffer, gs, spc, flags); | |
2195 | break; | |
2196 | ||
726a989a RB |
2197 | case GIMPLE_CATCH: |
2198 | dump_gimple_catch (buffer, gs, spc, flags); | |
2199 | break; | |
2200 | ||
2201 | case GIMPLE_EH_FILTER: | |
2202 | dump_gimple_eh_filter (buffer, gs, spc, flags); | |
2203 | break; | |
2204 | ||
1d65f45c RH |
2205 | case GIMPLE_EH_MUST_NOT_THROW: |
2206 | dump_gimple_eh_must_not_throw (buffer, gs, spc, flags); | |
2207 | break; | |
2208 | ||
0a35513e AH |
2209 | case GIMPLE_EH_ELSE: |
2210 | dump_gimple_eh_else (buffer, gs, spc, flags); | |
2211 | break; | |
2212 | ||
726a989a RB |
2213 | case GIMPLE_RESX: |
2214 | dump_gimple_resx (buffer, gs, spc, flags); | |
2215 | break; | |
2216 | ||
1d65f45c RH |
2217 | case GIMPLE_EH_DISPATCH: |
2218 | dump_gimple_eh_dispatch (buffer, gs, spc, flags); | |
2219 | break; | |
2220 | ||
b5b8b0ac AO |
2221 | case GIMPLE_DEBUG: |
2222 | dump_gimple_debug (buffer, gs, spc, flags); | |
2223 | break; | |
2224 | ||
726a989a RB |
2225 | case GIMPLE_PREDICT: |
2226 | pp_string (buffer, "// predicted "); | |
2227 | if (gimple_predict_outcome (gs)) | |
2228 | pp_string (buffer, "likely by "); | |
2229 | else | |
2230 | pp_string (buffer, "unlikely by "); | |
2231 | pp_string (buffer, predictor_name (gimple_predict_predictor (gs))); | |
2232 | pp_string (buffer, " predictor."); | |
2233 | break; | |
2234 | ||
0a35513e AH |
2235 | case GIMPLE_TRANSACTION: |
2236 | dump_gimple_transaction (buffer, gs, spc, flags); | |
2237 | break; | |
2238 | ||
726a989a RB |
2239 | default: |
2240 | GIMPLE_NIY; | |
2241 | } | |
726a989a RB |
2242 | } |
2243 | ||
2244 | ||
a315c44c | 2245 | /* Dumps header of basic block BB to OUTF indented by INDENT |
726a989a RB |
2246 | spaces and details described by flags. */ |
2247 | ||
2248 | static void | |
a315c44c | 2249 | dump_gimple_bb_header (FILE *outf, basic_block bb, int indent, int flags) |
726a989a | 2250 | { |
726a989a RB |
2251 | if (flags & TDF_BLOCKS) |
2252 | { | |
726a989a RB |
2253 | if (flags & TDF_LINENO) |
2254 | { | |
2255 | gimple_stmt_iterator gsi; | |
a315c44c SB |
2256 | |
2257 | if (flags & TDF_COMMENT) | |
2258 | fputs (";; ", outf); | |
726a989a RB |
2259 | |
2260 | for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) | |
b5b8b0ac AO |
2261 | if (!is_gimple_debug (gsi_stmt (gsi)) |
2262 | && get_lineno (gsi_stmt (gsi)) != UNKNOWN_LOCATION) | |
726a989a | 2263 | { |
3a8ebb92 L |
2264 | fprintf (outf, "%*sstarting at line %d", |
2265 | indent, "", get_lineno (gsi_stmt (gsi))); | |
726a989a RB |
2266 | break; |
2267 | } | |
a315c44c SB |
2268 | if (bb->discriminator) |
2269 | fprintf (outf, ", discriminator %i", bb->discriminator); | |
2270 | fputc ('\n', outf); | |
726a989a | 2271 | } |
726a989a RB |
2272 | } |
2273 | else | |
2274 | { | |
a315c44c | 2275 | gimple stmt = first_stmt (bb); |
726a989a | 2276 | if (!stmt || gimple_code (stmt) != GIMPLE_LABEL) |
3a8ebb92 | 2277 | fprintf (outf, "%*s<bb %d>:\n", indent, "", bb->index); |
726a989a | 2278 | } |
726a989a RB |
2279 | } |
2280 | ||
2281 | ||
2282 | /* Dumps end of basic block BB to buffer BUFFER indented by INDENT | |
2283 | spaces. */ | |
2284 | ||
2285 | static void | |
c4669594 SB |
2286 | dump_gimple_bb_footer (FILE *outf ATTRIBUTE_UNUSED, |
2287 | basic_block bb ATTRIBUTE_UNUSED, | |
2288 | int indent ATTRIBUTE_UNUSED, | |
2289 | int flags ATTRIBUTE_UNUSED) | |
726a989a | 2290 | { |
c4669594 SB |
2291 | /* There is currently no GIMPLE-specific basic block info to dump. */ |
2292 | return; | |
726a989a RB |
2293 | } |
2294 | ||
2295 | ||
2296 | /* Dump PHI nodes of basic block BB to BUFFER with details described | |
2297 | by FLAGS and indented by INDENT spaces. */ | |
2298 | ||
2299 | static void | |
2300 | dump_phi_nodes (pretty_printer *buffer, basic_block bb, int indent, int flags) | |
2301 | { | |
2302 | gimple_stmt_iterator i; | |
2303 | ||
2304 | for (i = gsi_start_phis (bb); !gsi_end_p (i); gsi_next (&i)) | |
2305 | { | |
2306 | gimple phi = gsi_stmt (i); | |
ea057359 | 2307 | if (!virtual_operand_p (gimple_phi_result (phi)) || (flags & TDF_VOPS)) |
726a989a RB |
2308 | { |
2309 | INDENT (indent); | |
d09c0e9b | 2310 | dump_gimple_phi (buffer, phi, indent, true, flags); |
726a989a RB |
2311 | pp_newline (buffer); |
2312 | } | |
2313 | } | |
2314 | } | |
2315 | ||
2316 | ||
2317 | /* Dump jump to basic block BB that is represented implicitly in the cfg | |
2318 | to BUFFER. */ | |
2319 | ||
2320 | static void | |
2321 | pp_cfg_jump (pretty_printer *buffer, basic_block bb) | |
2322 | { | |
2323 | gimple stmt; | |
2324 | ||
2325 | stmt = first_stmt (bb); | |
2326 | ||
2327 | pp_string (buffer, "goto <bb "); | |
2328 | pp_decimal_int (buffer, bb->index); | |
07838b13 | 2329 | pp_greater (buffer); |
726a989a RB |
2330 | if (stmt && gimple_code (stmt) == GIMPLE_LABEL) |
2331 | { | |
2332 | pp_string (buffer, " ("); | |
2333 | dump_generic_node (buffer, gimple_label_label (stmt), 0, 0, false); | |
07838b13 | 2334 | pp_right_paren (buffer); |
726a989a RB |
2335 | pp_semicolon (buffer); |
2336 | } | |
2337 | else | |
2338 | pp_semicolon (buffer); | |
2339 | } | |
2340 | ||
2341 | ||
2342 | /* Dump edges represented implicitly in basic block BB to BUFFER, indented | |
2343 | by INDENT spaces, with details given by FLAGS. */ | |
2344 | ||
2345 | static void | |
2346 | dump_implicit_edges (pretty_printer *buffer, basic_block bb, int indent, | |
2347 | int flags) | |
2348 | { | |
2349 | edge e; | |
726a989a RB |
2350 | gimple stmt; |
2351 | ||
2352 | stmt = last_stmt (bb); | |
2353 | ||
2354 | if (stmt && gimple_code (stmt) == GIMPLE_COND) | |
2355 | { | |
2356 | edge true_edge, false_edge; | |
2357 | ||
2358 | /* When we are emitting the code or changing CFG, it is possible that | |
2359 | the edges are not yet created. When we are using debug_bb in such | |
2360 | a situation, we do not want it to crash. */ | |
2361 | if (EDGE_COUNT (bb->succs) != 2) | |
2362 | return; | |
2363 | extract_true_false_edges_from_block (bb, &true_edge, &false_edge); | |
2364 | ||
2365 | INDENT (indent + 2); | |
2366 | pp_cfg_jump (buffer, true_edge->dest); | |
2367 | newline_and_indent (buffer, indent); | |
2368 | pp_string (buffer, "else"); | |
2369 | newline_and_indent (buffer, indent + 2); | |
2370 | pp_cfg_jump (buffer, false_edge->dest); | |
2371 | pp_newline (buffer); | |
2372 | return; | |
2373 | } | |
2374 | ||
2375 | /* If there is a fallthru edge, we may need to add an artificial | |
2376 | goto to the dump. */ | |
0fd4b31d | 2377 | e = find_fallthru_edge (bb->succs); |
726a989a RB |
2378 | |
2379 | if (e && e->dest != bb->next_bb) | |
2380 | { | |
2381 | INDENT (indent); | |
2382 | ||
2383 | if ((flags & TDF_LINENO) | |
2384 | && e->goto_locus != UNKNOWN_LOCATION | |
2385 | ) | |
2386 | { | |
2387 | expanded_location goto_xloc; | |
2388 | goto_xloc = expand_location (e->goto_locus); | |
07838b13 | 2389 | pp_left_bracket (buffer); |
726a989a RB |
2390 | if (goto_xloc.file) |
2391 | { | |
2392 | pp_string (buffer, goto_xloc.file); | |
2393 | pp_string (buffer, " : "); | |
2394 | } | |
2395 | pp_decimal_int (buffer, goto_xloc.line); | |
c2255bc4 AH |
2396 | pp_string (buffer, " : "); |
2397 | pp_decimal_int (buffer, goto_xloc.column); | |
726a989a RB |
2398 | pp_string (buffer, "] "); |
2399 | } | |
2400 | ||
2401 | pp_cfg_jump (buffer, e->dest); | |
2402 | pp_newline (buffer); | |
2403 | } | |
2404 | } | |
2405 | ||
2406 | ||
2407 | /* Dumps basic block BB to buffer BUFFER with details described by FLAGS and | |
2408 | indented by INDENT spaces. */ | |
2409 | ||
2410 | static void | |
2411 | gimple_dump_bb_buff (pretty_printer *buffer, basic_block bb, int indent, | |
2412 | int flags) | |
2413 | { | |
2414 | gimple_stmt_iterator gsi; | |
2415 | gimple stmt; | |
2416 | int label_indent = indent - 2; | |
2417 | ||
2418 | if (label_indent < 0) | |
2419 | label_indent = 0; | |
2420 | ||
726a989a RB |
2421 | dump_phi_nodes (buffer, bb, indent, flags); |
2422 | ||
2423 | for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) | |
2424 | { | |
2425 | int curr_indent; | |
2426 | ||
2427 | stmt = gsi_stmt (gsi); | |
2428 | ||
2429 | curr_indent = gimple_code (stmt) == GIMPLE_LABEL ? label_indent : indent; | |
2430 | ||
2431 | INDENT (curr_indent); | |
b5f47924 | 2432 | pp_gimple_stmt_1 (buffer, stmt, curr_indent, flags); |
f8923f7e | 2433 | pp_newline_and_flush (buffer); |
2eb712b4 MJ |
2434 | gcc_checking_assert (DECL_STRUCT_FUNCTION (current_function_decl)); |
2435 | dump_histograms_for_stmt (DECL_STRUCT_FUNCTION (current_function_decl), | |
c3284718 | 2436 | pp_buffer (buffer)->stream, stmt); |
726a989a RB |
2437 | } |
2438 | ||
2439 | dump_implicit_edges (buffer, bb, indent, flags); | |
3e31cf28 | 2440 | pp_flush (buffer); |
726a989a RB |
2441 | } |
2442 | ||
2443 | ||
2444 | /* Dumps basic block BB to FILE with details described by FLAGS and | |
2445 | indented by INDENT spaces. */ | |
2446 | ||
2447 | void | |
a315c44c | 2448 | gimple_dump_bb (FILE *file, basic_block bb, int indent, int flags) |
726a989a | 2449 | { |
a315c44c | 2450 | dump_gimple_bb_header (file, bb, indent, flags); |
c4669594 SB |
2451 | if (bb->index >= NUM_FIXED_BLOCKS) |
2452 | { | |
b3f80694 | 2453 | pretty_printer buffer; |
b3f80694 GDR |
2454 | pp_needs_newline (&buffer) = true; |
2455 | buffer.buffer->stream = file; | |
c4669594 SB |
2456 | gimple_dump_bb_buff (&buffer, bb, indent, flags); |
2457 | } | |
a315c44c | 2458 | dump_gimple_bb_footer (file, bb, indent, flags); |
726a989a | 2459 | } |
41222ddf SB |
2460 | |
2461 | /* Dumps basic block BB to pretty-printer PP with default dump flags and | |
2462 | no indentation, for use as a label of a DOT graph record-node. | |
2463 | ??? Should just use gimple_dump_bb_buff here, except that value profiling | |
2464 | histogram dumping doesn't know about pretty-printers. */ | |
2465 | ||
2466 | void | |
2467 | gimple_dump_bb_for_graph (pretty_printer *pp, basic_block bb) | |
2468 | { | |
2469 | gimple_stmt_iterator gsi; | |
2470 | ||
2471 | pp_printf (pp, "<bb %d>:\n", bb->index); | |
2472 | pp_write_text_as_dot_label_to_stream (pp, /*for_record=*/true); | |
2473 | ||
2474 | for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi)) | |
2475 | { | |
2476 | gimple phi = gsi_stmt (gsi); | |
2477 | if (!virtual_operand_p (gimple_phi_result (phi)) | |
2478 | || (dump_flags & TDF_VOPS)) | |
2479 | { | |
07838b13 | 2480 | pp_bar (pp); |
41222ddf SB |
2481 | pp_write_text_to_stream (pp); |
2482 | pp_string (pp, "# "); | |
2483 | pp_gimple_stmt_1 (pp, phi, 0, dump_flags); | |
2484 | pp_newline (pp); | |
2485 | pp_write_text_as_dot_label_to_stream (pp, /*for_record=*/true); | |
2486 | } | |
2487 | } | |
2488 | ||
2489 | for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) | |
2490 | { | |
2491 | gimple stmt = gsi_stmt (gsi); | |
07838b13 | 2492 | pp_bar (pp); |
41222ddf SB |
2493 | pp_write_text_to_stream (pp); |
2494 | pp_gimple_stmt_1 (pp, stmt, 0, dump_flags); | |
2495 | pp_newline (pp); | |
2496 | pp_write_text_as_dot_label_to_stream (pp, /*for_record=*/true); | |
2497 | } | |
2498 | dump_implicit_edges (pp, bb, 0, dump_flags); | |
2499 | pp_write_text_as_dot_label_to_stream (pp, /*for_record=*/true); | |
2500 | } | |
2501 |