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