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