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