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 : 265579 : newline_and_indent (pretty_printer *pp, int spc)
75 : : {
76 : 265579 : pp_newline (pp);
77 : 1609026 : INDENT (spc);
78 : 265579 : }
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 : 245161 : dump_profile (profile_count &count)
96 : : {
97 : 245161 : char *buf = NULL;
98 : 245161 : if (!count.initialized_p ())
99 : : return "";
100 : 221563 : if (count.ipa_p ())
101 : 12890 : buf = xasprintf ("[count: %" PRId64 "]",
102 : : count.to_gcov_type ());
103 : 208673 : else if (count.initialized_p ())
104 : 208673 : buf = xasprintf ("[local count: %" PRId64 "]",
105 : : count.to_gcov_type ());
106 : :
107 : 221563 : const char *ret = xstrdup_for_dump (buf);
108 : 221563 : free (buf);
109 : :
110 : 221563 : 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 : 246783 : dump_probability (profile_probability probability)
119 : : {
120 : 246783 : float minimum = 0.01f;
121 : 246783 : float fvalue = -1;
122 : :
123 : 246783 : if (probability.initialized_p ())
124 : : {
125 : 232175 : fvalue = probability.to_reg_br_prob_base () * 100.0f / REG_BR_PROB_BASE;
126 : 232175 : if (fvalue < minimum && probability.to_reg_br_prob_base ())
127 : : fvalue = minimum;
128 : : }
129 : :
130 : 246783 : char *buf;
131 : 246783 : if (probability.initialized_p ())
132 : 232175 : buf = xasprintf ("[%.2f%%]", fvalue);
133 : : else
134 : 14608 : buf = xasprintf ("[INV]");
135 : :
136 : 246783 : const char *ret = xstrdup_for_dump (buf);
137 : 246783 : free (buf);
138 : :
139 : 246783 : return ret;
140 : : }
141 : :
142 : : /* Dump E probability to PP. */
143 : :
144 : : static void
145 : 246783 : dump_edge_probability (pretty_printer *pp, edge e)
146 : : {
147 : 246783 : pp_scalar (pp, " %s", dump_probability (e->probability));
148 : 246783 : }
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 : 929575 : print_gimple_stmt (FILE *file, gimple *g, int spc, dump_flags_t flags)
155 : : {
156 : 929575 : pretty_printer pp;
157 : 929575 : pp_needs_newline (&pp) = true;
158 : 929575 : pp.set_output_stream (file);
159 : 929575 : pp_gimple_stmt_1 (&pp, g, spc, flags);
160 : 929575 : pp_newline_and_flush (&pp);
161 : 929575 : }
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 : 231658 : print_gimple_expr (FILE *file, gimple *g, int spc, dump_flags_t flags)
185 : : {
186 : 231658 : flags |= TDF_RHS_ONLY;
187 : 231658 : pretty_printer pp;
188 : 231658 : pp_needs_newline (&pp) = true;
189 : 231658 : pp.set_output_stream (file);
190 : 231658 : pp_gimple_stmt_1 (&pp, g, spc, flags);
191 : 231658 : pp_flush (&pp);
192 : 231658 : }
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 : 36347 : dump_gimple_seq (pretty_printer *pp, gimple_seq seq, int spc,
202 : : dump_flags_t flags)
203 : : {
204 : 36347 : gimple_stmt_iterator i;
205 : :
206 : 162222 : for (i = gsi_start (seq); !gsi_end_p (i); gsi_next (&i))
207 : : {
208 : : gimple *gs = gsi_stmt (i);
209 : 1279385 : INDENT (spc);
210 : 125875 : pp_gimple_stmt_1 (pp, gs, spc, flags);
211 : 215941 : if (!gsi_one_before_end_p (i))
212 : 90066 : pp_newline (pp);
213 : : }
214 : 36347 : }
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 : 4654 : print_gimple_seq (FILE *file, gimple_seq seq, int spc, dump_flags_t flags)
222 : : {
223 : 4654 : pretty_printer pp;
224 : 4654 : pp_needs_newline (&pp) = true;
225 : 4654 : pp.set_output_stream (file);
226 : 4654 : dump_gimple_seq (&pp, seq, spc, flags);
227 : 4654 : pp_newline_and_flush (&pp);
228 : 4654 : }
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 : 43249 : dump_gimple_fmt (pretty_printer *pp, int spc, dump_flags_t flags,
254 : : const char *fmt, ...)
255 : : {
256 : 43249 : va_list args;
257 : 43249 : const char *c;
258 : 43249 : const char *tmp;
259 : :
260 : 43249 : va_start (args, fmt);
261 : 682653 : for (c = fmt; *c; c++)
262 : : {
263 : 639404 : if (*c == '%')
264 : : {
265 : 54581 : gimple_seq seq;
266 : 54581 : tree t;
267 : 54581 : gimple *g;
268 : 54581 : switch (*++c)
269 : : {
270 : 2554 : case 'G':
271 : 2554 : g = va_arg (args, gimple *);
272 : 2554 : tmp = gimple_code_name[gimple_code (g)];
273 : 2554 : pp_string (pp, tmp);
274 : 2554 : 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 : 48560 : case 'T':
284 : 48560 : t = va_arg (args, tree);
285 : 48560 : if (t == NULL_TREE)
286 : 5946 : pp_string (pp, "NULL");
287 : : else
288 : 42614 : dump_generic_node (pp, t, spc, flags, false);
289 : : break;
290 : :
291 : 1698 : case 'd':
292 : 1698 : pp_decimal_int (pp, va_arg (args, int));
293 : 1698 : break;
294 : :
295 : 1709 : case 's':
296 : 1709 : pp_string (pp, va_arg (args, char *));
297 : 1709 : break;
298 : :
299 : 8 : case 'n':
300 : 8 : newline_and_indent (pp, spc);
301 : 8 : break;
302 : :
303 : 0 : case 'x':
304 : 0 : pp_scalar (pp, "%x", va_arg (args, int));
305 : 0 : break;
306 : :
307 : 28 : case '+':
308 : 28 : spc += 2;
309 : 28 : newline_and_indent (pp, spc);
310 : 28 : 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 : 584823 : pp_character (pp, *c);
323 : : }
324 : 43249 : va_end (args);
325 : 43249 : }
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 : 2544900 : dump_unary_rhs (pretty_printer *pp, const gassign *gs, int spc,
333 : : dump_flags_t flags)
334 : : {
335 : 2544900 : enum tree_code rhs_code = gimple_assign_rhs_code (gs);
336 : 2544900 : tree lhs = gimple_assign_lhs (gs);
337 : 2544900 : tree rhs = gimple_assign_rhs1 (gs);
338 : :
339 : 2544900 : switch (rhs_code)
340 : : {
341 : 30567 : case VIEW_CONVERT_EXPR:
342 : 30567 : dump_generic_node (pp, rhs, spc, flags, false);
343 : 30567 : break;
344 : :
345 : 497977 : case FIXED_CONVERT_EXPR:
346 : 497977 : case ADDR_SPACE_CONVERT_EXPR:
347 : 497977 : case FIX_TRUNC_EXPR:
348 : 497977 : case FLOAT_EXPR:
349 : 497977 : CASE_CONVERT:
350 : 497977 : pp_left_paren (pp);
351 : 497977 : dump_generic_node (pp, TREE_TYPE (lhs), spc, flags, false);
352 : 497977 : pp_string (pp, ") ");
353 : 497977 : 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 : 497977 : dump_generic_node (pp, rhs, spc, flags, false);
361 : : break;
362 : :
363 : 3137 : case PAREN_EXPR:
364 : 3137 : pp_string (pp, "((");
365 : 3137 : dump_generic_node (pp, rhs, spc, flags, false);
366 : 3137 : pp_string (pp, "))");
367 : 3137 : break;
368 : :
369 : 6615 : case ABS_EXPR:
370 : 6615 : case ABSU_EXPR:
371 : 6615 : 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 : 7960 : pp_string (pp,
380 : : rhs_code == ABS_EXPR ? "ABS_EXPR <" : "ABSU_EXPR <");
381 : 6613 : dump_generic_node (pp, rhs, spc, flags, false);
382 : 6613 : pp_greater (pp);
383 : : }
384 : : break;
385 : :
386 : 2006604 : default:
387 : 2006604 : if (TREE_CODE_CLASS (rhs_code) == tcc_declaration
388 : 1980783 : || TREE_CODE_CLASS (rhs_code) == tcc_constant
389 : 1875893 : || TREE_CODE_CLASS (rhs_code) == tcc_reference
390 : 771364 : || rhs_code == SSA_NAME
391 : 771364 : || rhs_code == ADDR_EXPR
392 : : || rhs_code == CONSTRUCTOR)
393 : : {
394 : 1972756 : dump_generic_node (pp, rhs, spc, flags, false);
395 : 1972756 : break;
396 : : }
397 : : else if (rhs_code == BIT_NOT_EXPR)
398 : 7554 : pp_complement (pp);
399 : : else if (rhs_code == TRUTH_NOT_EXPR)
400 : 0 : pp_exclamation (pp);
401 : : else if (rhs_code == NEGATE_EXPR)
402 : 6917 : pp_minus (pp);
403 : : else
404 : : {
405 : 19377 : pp_left_bracket (pp);
406 : 19377 : pp_string (pp, get_tree_code_name (rhs_code));
407 : 19377 : pp_string (pp, "] ");
408 : : }
409 : :
410 : 33848 : 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 : 33848 : dump_generic_node (pp, rhs, spc, flags, false);
418 : : break;
419 : : }
420 : 2544900 : }
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 : 1752708 : dump_binary_rhs (pretty_printer *pp, const gassign *gs, int spc,
428 : : dump_flags_t flags)
429 : : {
430 : 1752708 : const char *p;
431 : 1752708 : enum tree_code code = gimple_assign_rhs_code (gs);
432 : 1752708 : switch (code)
433 : : {
434 : 12448 : case MIN_EXPR:
435 : 12448 : case MAX_EXPR:
436 : 12448 : 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 : 23892 : gcc_fallthrough ();
450 : : }
451 : 23892 : case COMPLEX_EXPR:
452 : 23892 : case VEC_WIDEN_MULT_HI_EXPR:
453 : 23892 : case VEC_WIDEN_MULT_LO_EXPR:
454 : 23892 : case VEC_WIDEN_MULT_EVEN_EXPR:
455 : 23892 : case VEC_WIDEN_MULT_ODD_EXPR:
456 : 23892 : case VEC_PACK_TRUNC_EXPR:
457 : 23892 : case VEC_PACK_SAT_EXPR:
458 : 23892 : case VEC_PACK_FIX_TRUNC_EXPR:
459 : 23892 : case VEC_PACK_FLOAT_EXPR:
460 : 23892 : case VEC_WIDEN_LSHIFT_HI_EXPR:
461 : 23892 : case VEC_WIDEN_LSHIFT_LO_EXPR:
462 : 23892 : case VEC_SERIES_EXPR:
463 : 338284 : for (p = get_tree_code_name (code); *p; p++)
464 : 314392 : pp_character (pp, TOUPPER (*p));
465 : 23892 : pp_string (pp, " <");
466 : 23892 : dump_generic_node (pp, gimple_assign_rhs1 (gs), spc, flags, false);
467 : 23892 : pp_string (pp, ", ");
468 : 47784 : dump_generic_node (pp, gimple_assign_rhs2 (gs), spc, flags, false);
469 : 23892 : pp_greater (pp);
470 : 23892 : break;
471 : :
472 : 1728816 : default:
473 : 1728816 : 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 : 1728816 : dump_generic_node (pp, gimple_assign_rhs1 (gs), spc, flags, false);
482 : 1728816 : pp_space (pp);
483 : 1728816 : pp_string (pp, op_symbol_code (gimple_assign_rhs_code (gs), flags));
484 : 1728816 : pp_space (pp);
485 : 3457632 : 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 : 3457632 : dump_generic_node (pp, gimple_assign_rhs2 (gs), spc, flags, false);
494 : : }
495 : 1752708 : }
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 : 119586 : dump_ternary_rhs (pretty_printer *pp, const gassign *gs, int spc,
502 : : dump_flags_t flags)
503 : : {
504 : 119586 : const char *p;
505 : 119586 : enum tree_code code = gimple_assign_rhs_code (gs);
506 : 119586 : 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 : 3398 : case DOT_PROD_EXPR:
522 : 3398 : pp_string (pp, "DOT_PROD_EXPR <");
523 : 3398 : dump_generic_node (pp, gimple_assign_rhs1 (gs), spc, flags, false);
524 : 3398 : pp_string (pp, ", ");
525 : 6796 : dump_generic_node (pp, gimple_assign_rhs2 (gs), spc, flags, false);
526 : 3398 : pp_string (pp, ", ");
527 : 6796 : dump_generic_node (pp, gimple_assign_rhs3 (gs), spc, flags, false);
528 : 3398 : pp_greater (pp);
529 : 3398 : break;
530 : :
531 : 1261 : case SAD_EXPR:
532 : 1261 : pp_string (pp, "SAD_EXPR <");
533 : 1261 : dump_generic_node (pp, gimple_assign_rhs1 (gs), spc, flags, false);
534 : 1261 : pp_string (pp, ", ");
535 : 2522 : dump_generic_node (pp, gimple_assign_rhs2 (gs), spc, flags, false);
536 : 1261 : pp_string (pp, ", ");
537 : 2522 : dump_generic_node (pp, gimple_assign_rhs3 (gs), spc, flags, false);
538 : 1261 : pp_greater (pp);
539 : 1261 : break;
540 : :
541 : 45822 : case VEC_PERM_EXPR:
542 : 45822 : if (flags & TDF_GIMPLE)
543 : 0 : pp_string (pp, "__VEC_PERM (");
544 : : else
545 : 45822 : pp_string (pp, "VEC_PERM_EXPR <");
546 : 45822 : dump_generic_node (pp, gimple_assign_rhs1 (gs), spc, flags, false);
547 : 45822 : pp_string (pp, ", ");
548 : 91644 : dump_generic_node (pp, gimple_assign_rhs2 (gs), spc, flags, false);
549 : 45822 : pp_string (pp, ", ");
550 : 91644 : dump_generic_node (pp, gimple_assign_rhs3 (gs), spc, flags, false);
551 : 45822 : if (flags & TDF_GIMPLE)
552 : 0 : pp_right_paren (pp);
553 : : else
554 : 45822 : 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 : 59992 : case COND_EXPR:
568 : 59992 : dump_generic_node (pp, gimple_assign_rhs1 (gs), spc, flags, false);
569 : 59992 : pp_string (pp, " ? ");
570 : 119984 : dump_generic_node (pp, gimple_assign_rhs2 (gs), spc, flags, false);
571 : 59992 : pp_string (pp, " : ");
572 : 59992 : dump_generic_node (pp, gimple_assign_rhs3 (gs), spc, flags, false);
573 : 59992 : break;
574 : :
575 : 8499 : case VEC_COND_EXPR:
576 : 8499 : pp_string (pp, "VEC_COND_EXPR <");
577 : 8499 : dump_generic_node (pp, gimple_assign_rhs1 (gs), spc, flags, false);
578 : 8499 : pp_string (pp, ", ");
579 : 16998 : dump_generic_node (pp, gimple_assign_rhs2 (gs), spc, flags, false);
580 : 8499 : pp_string (pp, ", ");
581 : 16998 : dump_generic_node (pp, gimple_assign_rhs3 (gs), spc, flags, false);
582 : 8499 : pp_greater (pp);
583 : 8499 : break;
584 : :
585 : 614 : case BIT_INSERT_EXPR:
586 : 614 : 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 : 614 : pp_string (pp, "BIT_INSERT_EXPR <");
602 : 614 : dump_generic_node (pp, gimple_assign_rhs1 (gs),
603 : : spc, flags, false);
604 : 614 : pp_string (pp, ", ");
605 : 1228 : dump_generic_node (pp, gimple_assign_rhs2 (gs),
606 : : spc, flags, false);
607 : 614 : pp_string (pp, ", ");
608 : 1228 : dump_generic_node (pp, gimple_assign_rhs3 (gs),
609 : : spc, flags, false);
610 : 1228 : if (INTEGRAL_TYPE_P (TREE_TYPE (gimple_assign_rhs2 (gs))))
611 : : {
612 : 560 : pp_string (pp, " (");
613 : 1120 : pp_decimal_int (pp, TYPE_PRECISION
614 : : (TREE_TYPE (gimple_assign_rhs2 (gs))));
615 : 560 : pp_string (pp, " bits)");
616 : : }
617 : 614 : pp_greater (pp);
618 : : }
619 : : break;
620 : :
621 : 0 : default:
622 : 0 : gcc_unreachable ();
623 : : }
624 : 119586 : }
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 : 4418738 : dump_gimple_assign (pretty_printer *pp, const gassign *gs, int spc,
632 : : dump_flags_t flags)
633 : : {
634 : 4418738 : if (flags & TDF_RAW)
635 : : {
636 : 1544 : tree arg1 = NULL;
637 : 1544 : tree arg2 = NULL;
638 : 1544 : tree arg3 = NULL;
639 : 1544 : switch (gimple_num_ops (gs))
640 : : {
641 : 67 : case 4:
642 : 67 : arg3 = gimple_assign_rhs3 (gs);
643 : : /* FALLTHRU */
644 : 839 : case 3:
645 : 839 : arg2 = gimple_assign_rhs2 (gs);
646 : : /* FALLTHRU */
647 : 1544 : case 2:
648 : 1544 : arg1 = gimple_assign_rhs1 (gs);
649 : 1544 : break;
650 : 0 : default:
651 : 0 : gcc_unreachable ();
652 : : }
653 : :
654 : 2038 : 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 : 4417194 : if (!(flags & TDF_RHS_ONLY))
661 : : {
662 : 3674282 : dump_generic_node (pp, gimple_assign_lhs (gs), spc, flags, false);
663 : 3674282 : pp_space (pp);
664 : 3674282 : pp_equal (pp);
665 : :
666 : 3674282 : if (gimple_assign_nontemporal_move_p (gs))
667 : 51 : pp_string (pp, "{nt}");
668 : :
669 : 7348564 : if (gimple_has_volatile_ops (gs))
670 : 22908 : pp_string (pp, "{v}");
671 : :
672 : 3674282 : pp_space (pp);
673 : : }
674 : :
675 : 4417194 : if (gimple_num_ops (gs) == 2)
676 : 2544947 : dump_unary_rhs (pp, gs, spc,
677 : 2544900 : ((flags & TDF_GIMPLE)
678 : 47 : && gimple_assign_rhs_class (gs) != GIMPLE_SINGLE_RHS)
679 : 2 : ? (flags | TDF_GIMPLE_VAL) : flags);
680 : 1872294 : else if (gimple_num_ops (gs) == 3)
681 : 1752709 : dump_binary_rhs (pp, gs, spc,
682 : 1752708 : (flags & TDF_GIMPLE)
683 : 1 : ? (flags | TDF_GIMPLE_VAL) : flags);
684 : 119586 : else if (gimple_num_ops (gs) == 4)
685 : 119586 : dump_ternary_rhs (pp, gs, spc,
686 : 119586 : (flags & TDF_GIMPLE)
687 : 0 : ? (flags | TDF_GIMPLE_VAL) : flags);
688 : : else
689 : 0 : gcc_unreachable ();
690 : 4417194 : if (!(flags & TDF_RHS_ONLY))
691 : 3674282 : pp_semicolon (pp);
692 : : }
693 : 4418738 : }
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 : 54107 : dump_gimple_return (pretty_printer *pp, const greturn *gs, int spc,
701 : : dump_flags_t flags)
702 : : {
703 : 54107 : tree t;
704 : :
705 : 54107 : t = gimple_return_retval (gs);
706 : 54107 : if (flags & TDF_RAW)
707 : 465 : dump_gimple_fmt (pp, spc, flags, "%G <%T>", gs, t);
708 : : else
709 : : {
710 : 53642 : pp_string (pp, "return");
711 : 53642 : if (t)
712 : : {
713 : 34164 : pp_space (pp);
714 : 34164 : dump_generic_node (pp, t, spc, flags, false);
715 : : }
716 : 53642 : pp_semicolon (pp);
717 : : }
718 : 54107 : }
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 : 159723 : dump_gimple_call_args (pretty_printer *pp, const gcall *gs,
726 : : dump_flags_t flags)
727 : : {
728 : 159723 : size_t i = 0;
729 : :
730 : : /* Pretty print first arg to certain internal fns. */
731 : 159723 : if (gimple_call_internal_p (gs))
732 : : {
733 : 42934 : const char *const *enums = NULL;
734 : 42934 : unsigned limit = 0;
735 : :
736 : 42934 : 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 : 2300 : tree arg0 = gimple_call_arg (gs, 0);
779 : 2300 : HOST_WIDE_INT v;
780 : :
781 : 2300 : if (TREE_CODE (arg0) == INTEGER_CST
782 : 2300 : && tree_fits_shwi_p (arg0)
783 : 4600 : && (v = tree_to_shwi (arg0)) >= 0 && v < limit)
784 : : {
785 : 2300 : i++;
786 : 2300 : pp_string (pp, enums[v]);
787 : : }
788 : : }
789 : : }
790 : :
791 : 457860 : for (; i < gimple_call_num_args (gs); i++)
792 : : {
793 : 298137 : if (i)
794 : 179682 : pp_string (pp, ", ");
795 : 298137 : dump_generic_node (pp, gimple_call_arg (gs, i), 0, flags, false);
796 : : }
797 : :
798 : 159723 : 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 : 159723 : }
806 : :
807 : : /* Dump the points-to solution *PT to PP. */
808 : :
809 : : static void
810 : 2490 : pp_points_to_solution (pretty_printer *pp, const pt_solution *pt)
811 : : {
812 : 2490 : if (pt->anything)
813 : : {
814 : 200 : pp_string (pp, "anything ");
815 : 200 : return;
816 : : }
817 : 2290 : if (pt->nonlocal)
818 : 1185 : pp_string (pp, "nonlocal ");
819 : 2290 : if (pt->escaped)
820 : 686 : pp_string (pp, "escaped ");
821 : 2290 : if (pt->ipa_escaped)
822 : 92 : pp_string (pp, "unit-escaped ");
823 : 2290 : if (pt->null)
824 : 1591 : pp_string (pp, "null ");
825 : 2290 : if (pt->const_pool)
826 : 37 : pp_string (pp, "const-pool ");
827 : 2290 : if (pt->vars
828 : 2290 : && !bitmap_empty_p (pt->vars))
829 : : {
830 : 1366 : bitmap_iterator bi;
831 : 1366 : unsigned i;
832 : 1366 : pp_string (pp, "{ ");
833 : 3399 : EXECUTE_IF_SET_IN_BITMAP (pt->vars, 0, i, bi)
834 : : {
835 : 2033 : pp_string (pp, "D.");
836 : 2033 : pp_decimal_int (pp, i);
837 : 2033 : pp_space (pp);
838 : : }
839 : 1366 : pp_right_brace (pp);
840 : 1366 : if (pt->vars_contains_nonlocal
841 : 131 : || pt->vars_contains_escaped
842 : 42 : || pt->vars_contains_escaped_heap
843 : 36 : || pt->vars_contains_restrict
844 : 36 : || pt->vars_contains_interposable)
845 : : {
846 : 1330 : const char *comma = "";
847 : 1330 : pp_string (pp, " (");
848 : 1330 : if (pt->vars_contains_nonlocal)
849 : : {
850 : 1235 : pp_string (pp, "nonlocal");
851 : 1235 : comma = ", ";
852 : : }
853 : 1330 : if (pt->vars_contains_escaped)
854 : : {
855 : 572 : pp_string (pp, comma);
856 : 572 : pp_string (pp, "escaped");
857 : 572 : comma = ", ";
858 : : }
859 : 1330 : 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 : 1330 : if (pt->vars_contains_restrict)
866 : : {
867 : 197 : pp_string (pp, comma);
868 : 197 : pp_string (pp, "restrict");
869 : 197 : comma = ", ";
870 : : }
871 : 1330 : if (pt->vars_contains_interposable)
872 : : {
873 : 11 : pp_string (pp, comma);
874 : 11 : pp_string (pp, "interposable");
875 : : }
876 : 1330 : 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 : 159764 : dump_gimple_call (pretty_printer *pp, const gcall *gs, int spc,
887 : : dump_flags_t flags)
888 : : {
889 : 159764 : tree lhs = gimple_call_lhs (gs);
890 : 159764 : tree fn = gimple_call_fn (gs);
891 : :
892 : 159764 : if (flags & TDF_ALIAS)
893 : : {
894 : 510 : const pt_solution *pt;
895 : 510 : pt = gimple_call_use_set (gs);
896 : 510 : if (!pt_solution_empty_p (pt))
897 : : {
898 : 415 : pp_string (pp, "# USE = ");
899 : 415 : pp_points_to_solution (pp, pt);
900 : 415 : newline_and_indent (pp, spc);
901 : : }
902 : 510 : pt = gimple_call_clobber_set (gs);
903 : 510 : if (!pt_solution_empty_p (pt))
904 : : {
905 : 351 : pp_string (pp, "# CLB = ");
906 : 351 : pp_points_to_solution (pp, pt);
907 : 351 : newline_and_indent (pp, spc);
908 : : }
909 : : }
910 : :
911 : 159764 : if (flags & TDF_RAW)
912 : : {
913 : 255 : 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 : 237 : dump_gimple_fmt (pp, spc, flags, "%G <%T, %T", gs, fn, lhs);
918 : 255 : if (gimple_call_num_args (gs) > 0)
919 : : {
920 : 214 : pp_string (pp, ", ");
921 : 214 : dump_gimple_call_args (pp, gs, flags);
922 : : }
923 : 255 : pp_greater (pp);
924 : : }
925 : : else
926 : : {
927 : 159509 : if (lhs && !(flags & TDF_RHS_ONLY))
928 : : {
929 : 65171 : dump_generic_node (pp, lhs, spc, flags, false);
930 : 65171 : pp_string (pp, " =");
931 : :
932 : 130342 : if (gimple_has_volatile_ops (gs))
933 : 0 : pp_string (pp, "{v}");
934 : :
935 : 65171 : pp_space (pp);
936 : : }
937 : 159509 : if (gimple_call_internal_p (gs))
938 : : {
939 : 42916 : pp_dot (pp);
940 : 42916 : pp_string (pp, internal_fn_name (gimple_call_internal_fn (gs)));
941 : : }
942 : : else
943 : 116593 : print_call_name (pp, fn, flags);
944 : 159509 : pp_string (pp, " (");
945 : 159509 : dump_gimple_call_args (pp, gs, flags);
946 : 159509 : pp_right_paren (pp);
947 : 159509 : if (!(flags & TDF_RHS_ONLY))
948 : 149365 : pp_semicolon (pp);
949 : : }
950 : :
951 : 159764 : if (gimple_call_chain (gs))
952 : : {
953 : 34 : pp_string (pp, " [static-chain: ");
954 : 34 : dump_generic_node (pp, gimple_call_chain (gs), spc, flags, false);
955 : 34 : pp_right_bracket (pp);
956 : : }
957 : :
958 : 159764 : if (gimple_call_return_slot_opt_p (gs))
959 : 103 : pp_string (pp, " [return slot optimization]");
960 : 159764 : if (gimple_call_tail_p (gs))
961 : 3083 : pp_string (pp, " [tail call]");
962 : 159764 : if (gimple_call_must_tail_p (gs))
963 : 167 : pp_string (pp, " [must tail call]");
964 : :
965 : 159764 : if (fn == NULL)
966 : : return;
967 : :
968 : : /* Dump the arguments of _ITM_beginTransaction sanely. */
969 : 116830 : if (TREE_CODE (fn) == ADDR_EXPR)
970 : 112245 : fn = TREE_OPERAND (fn, 0);
971 : 213981 : if (TREE_CODE (fn) == FUNCTION_DECL && decl_is_tm_clone (fn))
972 : 29 : pp_string (pp, " [tm-clone]");
973 : 116830 : if (TREE_CODE (fn) == FUNCTION_DECL
974 : 112245 : && fndecl_built_in_p (fn, BUILT_IN_TM_START)
975 : 116970 : && 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 : 1423 : dump_gimple_switch (pretty_printer *pp, const gswitch *gs, int spc,
1025 : : dump_flags_t flags)
1026 : : {
1027 : 1423 : unsigned int i;
1028 : :
1029 : 1423 : GIMPLE_CHECK (gs, GIMPLE_SWITCH);
1030 : 1423 : if (flags & TDF_RAW)
1031 : 0 : dump_gimple_fmt (pp, spc, flags, "%G <%T, ", gs,
1032 : : gimple_switch_index (gs));
1033 : : else
1034 : : {
1035 : 1423 : pp_string (pp, "switch (");
1036 : 1423 : dump_generic_node (pp, gimple_switch_index (gs), spc, flags, true);
1037 : 1423 : if (flags & TDF_GIMPLE)
1038 : 0 : pp_string (pp, ") {");
1039 : : else
1040 : 1423 : pp_string (pp, ") <");
1041 : : }
1042 : :
1043 : 9704 : for (i = 0; i < gimple_switch_num_labels (gs); i++)
1044 : : {
1045 : 8281 : tree case_label = gimple_switch_label (gs, i);
1046 : 8281 : gcc_checking_assert (case_label != NULL_TREE);
1047 : 8281 : dump_generic_node (pp, case_label, spc, flags, false);
1048 : 8281 : pp_space (pp);
1049 : 8281 : tree label = CASE_LABEL (case_label);
1050 : 8281 : dump_generic_node (pp, label, spc, flags, false);
1051 : :
1052 : 8281 : if (cfun && cfun->cfg)
1053 : : {
1054 : 7442 : basic_block dest = label_to_block (cfun, label);
1055 : 7442 : if (dest)
1056 : : {
1057 : 7430 : edge label_edge = find_edge (gimple_bb (gs), dest);
1058 : 7430 : if (label_edge && !(flags & TDF_GIMPLE))
1059 : 7430 : dump_edge_probability (pp, label_edge);
1060 : : }
1061 : : }
1062 : :
1063 : 8281 : if (i < gimple_switch_num_labels (gs) - 1)
1064 : : {
1065 : 6858 : if (flags & TDF_GIMPLE)
1066 : 0 : pp_string (pp, "; ");
1067 : : else
1068 : 6858 : pp_string (pp, ", ");
1069 : : }
1070 : : }
1071 : 1423 : if (flags & TDF_GIMPLE)
1072 : 0 : pp_string (pp, "; }");
1073 : : else
1074 : 1423 : pp_greater (pp);
1075 : 1423 : }
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 : 179874 : dump_gimple_cond (pretty_printer *pp, const gcond *gs, int spc,
1083 : : dump_flags_t flags)
1084 : : {
1085 : 179874 : if (flags & TDF_RAW)
1086 : 143 : 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 : 179731 : if (!(flags & TDF_RHS_ONLY))
1093 : 177837 : pp_string (pp, "if (");
1094 : 359462 : dump_generic_node (pp, gimple_cond_lhs (gs), spc,
1095 : 179731 : flags | ((flags & TDF_GIMPLE) ? TDF_GIMPLE_VAL : TDF_NONE),
1096 : : false);
1097 : 179731 : pp_space (pp);
1098 : 179731 : pp_string (pp, op_symbol_code (gimple_cond_code (gs), flags));
1099 : 179731 : pp_space (pp);
1100 : 179731 : dump_generic_node (pp, gimple_cond_rhs (gs), spc,
1101 : 179731 : flags | ((flags & TDF_GIMPLE) ? TDF_GIMPLE_VAL : TDF_NONE),
1102 : : false);
1103 : 179731 : if (!(flags & TDF_RHS_ONLY))
1104 : : {
1105 : 177837 : edge_iterator ei;
1106 : 177837 : edge e, true_edge = NULL, false_edge = NULL;
1107 : 177837 : basic_block bb = gimple_bb (gs);
1108 : :
1109 : 177837 : if (bb)
1110 : : {
1111 : 505823 : FOR_EACH_EDGE (e, ei, bb->succs)
1112 : : {
1113 : 337125 : if (e->flags & EDGE_TRUE_VALUE)
1114 : : true_edge = e;
1115 : 168554 : else if (e->flags & EDGE_FALSE_VALUE)
1116 : 168554 : false_edge = e;
1117 : : }
1118 : : }
1119 : :
1120 : 177837 : bool has_edge_info = true_edge != NULL && false_edge != NULL;
1121 : :
1122 : 177837 : pp_right_paren (pp);
1123 : :
1124 : 177837 : if (gimple_cond_true_label (gs))
1125 : : {
1126 : 5958 : pp_string (pp, " goto ");
1127 : 5958 : dump_generic_node (pp, gimple_cond_true_label (gs),
1128 : : spc, flags, false);
1129 : 5958 : if (has_edge_info && !(flags & TDF_GIMPLE))
1130 : 0 : dump_edge_probability (pp, true_edge);
1131 : 5958 : pp_semicolon (pp);
1132 : : }
1133 : 177837 : if (gimple_cond_false_label (gs))
1134 : : {
1135 : 5958 : pp_string (pp, " else goto ");
1136 : 5958 : dump_generic_node (pp, gimple_cond_false_label (gs),
1137 : : spc, flags, false);
1138 : 5958 : if (has_edge_info && !(flags & TDF_GIMPLE))
1139 : 0 : dump_edge_probability (pp, false_edge);
1140 : :
1141 : 5958 : pp_semicolon (pp);
1142 : : }
1143 : : }
1144 : : }
1145 : 179874 : }
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 : 35153 : dump_gimple_label (pretty_printer *pp, const glabel *gs, int spc,
1154 : : dump_flags_t flags)
1155 : : {
1156 : 35153 : tree label = gimple_label_label (gs);
1157 : 35153 : if (flags & TDF_RAW)
1158 : 47 : dump_gimple_fmt (pp, spc, flags, "%G <%T>", gs, label);
1159 : : else
1160 : : {
1161 : 35106 : dump_generic_node (pp, label, spc, flags, false);
1162 : 35106 : pp_colon (pp);
1163 : : }
1164 : 35153 : if (flags & TDF_GIMPLE)
1165 : : return;
1166 : 35115 : if (DECL_NONLOCAL (label))
1167 : 3 : pp_string (pp, " [non-local]");
1168 : 35382 : if ((flags & TDF_EH) && EH_LANDING_PAD_NR (label))
1169 : 25 : 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 : 3867 : dump_gimple_goto (pretty_printer *pp, const ggoto *gs, int spc,
1178 : : dump_flags_t flags)
1179 : : {
1180 : 3867 : tree label = gimple_goto_dest (gs);
1181 : 3867 : if (flags & TDF_RAW)
1182 : 4 : dump_gimple_fmt (pp, spc, flags, "%G <%T>", gs, label);
1183 : : else
1184 : 3863 : dump_gimple_fmt (pp, spc, flags, "goto %T;", label);
1185 : 3867 : }
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 : 16861 : dump_gimple_bind (pretty_printer *pp, const gbind *gs, int spc,
1194 : : dump_flags_t flags)
1195 : : {
1196 : 16861 : if (flags & TDF_RAW)
1197 : 7 : dump_gimple_fmt (pp, spc, flags, "%G <", gs);
1198 : : else
1199 : 16854 : pp_left_brace (pp);
1200 : 16861 : if (!(flags & TDF_SLIM))
1201 : : {
1202 : 16857 : tree var;
1203 : :
1204 : 41089 : for (var = gimple_bind_vars (gs); var; var = DECL_CHAIN (var))
1205 : : {
1206 : 24232 : newline_and_indent (pp, 2);
1207 : 24232 : print_declaration (pp, var, spc, flags);
1208 : : }
1209 : 16857 : if (gimple_bind_vars (gs))
1210 : 9429 : pp_newline (pp);
1211 : : }
1212 : 16861 : pp_newline (pp);
1213 : 16861 : dump_gimple_seq (pp, gimple_bind_body (gs), spc + 2, flags);
1214 : 16861 : newline_and_indent (pp, spc);
1215 : 16861 : if (flags & TDF_RAW)
1216 : 7 : pp_greater (pp);
1217 : : else
1218 : 16854 : pp_right_brace (pp);
1219 : 16861 : }
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 : 3666 : dump_gimple_try (pretty_printer *pp, const gtry *gs, int spc,
1228 : : dump_flags_t flags)
1229 : : {
1230 : 3666 : 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 : 3666 : pp_string (pp, "try");
1246 : 3666 : newline_and_indent (pp, spc + 2);
1247 : 3666 : pp_left_brace (pp);
1248 : 3666 : pp_newline (pp);
1249 : :
1250 : 3666 : dump_gimple_seq (pp, gimple_try_eval (gs), spc + 4, flags);
1251 : 3666 : newline_and_indent (pp, spc + 2);
1252 : 3666 : pp_right_brace (pp);
1253 : :
1254 : 3666 : gimple_seq seq = gimple_try_cleanup (gs);
1255 : :
1256 : 3666 : if (gimple_try_kind (gs) == GIMPLE_TRY_CATCH)
1257 : : {
1258 : 838 : newline_and_indent (pp, spc);
1259 : 838 : pp_string (pp, "catch");
1260 : 838 : newline_and_indent (pp, spc + 2);
1261 : 838 : pp_left_brace (pp);
1262 : : }
1263 : 2828 : else if (gimple_try_kind (gs) == GIMPLE_TRY_FINALLY)
1264 : : {
1265 : 2828 : newline_and_indent (pp, spc);
1266 : 2828 : pp_string (pp, "finally");
1267 : 2828 : newline_and_indent (pp, spc + 2);
1268 : 2828 : pp_left_brace (pp);
1269 : :
1270 : 2828 : if (seq && is_a <geh_else *> (gimple_seq_first_stmt (seq))
1271 : 2942 : && 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 : 3666 : pp_newline (pp);
1290 : 3666 : dump_gimple_seq (pp, seq, spc + 4, flags);
1291 : 3666 : newline_and_indent (pp, spc + 2);
1292 : 3666 : pp_right_brace (pp);
1293 : : }
1294 : 3666 : }
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 : 728 : dump_gimple_eh_must_not_throw (pretty_printer *pp,
1337 : : const geh_mnt *gs, int spc, dump_flags_t flags)
1338 : : {
1339 : 728 : 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 : 728 : dump_gimple_fmt (pp, spc, flags, "<<<eh_must_not_throw (%T)>>>",
1344 : : gimple_eh_must_not_throw_fndecl (gs));
1345 : 728 : }
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 : 1668 : dump_gimple_resx (pretty_printer *pp, const gresx *gs, int spc,
1373 : : dump_flags_t flags)
1374 : : {
1375 : 1668 : if (flags & TDF_RAW)
1376 : 0 : dump_gimple_fmt (pp, spc, flags, "%G <%d>", gs,
1377 : : gimple_resx_region (gs));
1378 : : else
1379 : 1668 : dump_gimple_fmt (pp, spc, flags, "resx %d", gimple_resx_region (gs));
1380 : 1668 : }
1381 : :
1382 : : /* Dump a GIMPLE_EH_DISPATCH tuple on the pretty_printer PP. */
1383 : :
1384 : : static void
1385 : 30 : dump_gimple_eh_dispatch (pretty_printer *pp, const geh_dispatch *gs,
1386 : : int spc, dump_flags_t flags)
1387 : : {
1388 : 30 : if (flags & TDF_RAW)
1389 : 0 : dump_gimple_fmt (pp, spc, flags, "%G <%d>", gs,
1390 : : gimple_eh_dispatch_region (gs));
1391 : : else
1392 : 30 : dump_gimple_fmt (pp, spc, flags, "eh_dispatch %d",
1393 : : gimple_eh_dispatch_region (gs));
1394 : 30 : }
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 : 34394 : dump_gimple_debug (pretty_printer *pp, const gdebug *gs, int spc,
1402 : : dump_flags_t flags)
1403 : : {
1404 : 34394 : switch (gs->subcode)
1405 : : {
1406 : 17930 : case GIMPLE_DEBUG_BIND:
1407 : 17930 : 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 : 17930 : 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 : 4 : case GIMPLE_DEBUG_SOURCE_BIND:
1418 : 4 : 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 : 4 : 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 : 16212 : case GIMPLE_DEBUG_BEGIN_STMT:
1429 : 16212 : if (flags & TDF_RAW)
1430 : 0 : dump_gimple_fmt (pp, spc, flags, "%G BEGIN_STMT", gs);
1431 : : else
1432 : 16212 : dump_gimple_fmt (pp, spc, flags, "# DEBUG BEGIN_STMT");
1433 : : break;
1434 : :
1435 : 248 : case GIMPLE_DEBUG_INLINE_ENTRY:
1436 : 248 : 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 : 496 : dump_gimple_fmt (pp, spc, flags, "# DEBUG INLINE_ENTRY %T",
1443 : 248 : gimple_block (gs)
1444 : 248 : ? block_ultimate_origin (gimple_block (gs))
1445 : : : NULL_TREE);
1446 : : break;
1447 : :
1448 : 0 : default:
1449 : 0 : gcc_unreachable ();
1450 : : }
1451 : 34394 : }
1452 : :
1453 : : /* Dump a GIMPLE_OMP_FOR tuple on the pretty_printer PP. */
1454 : : static void
1455 : 3355 : dump_gimple_omp_for (pretty_printer *pp, const gomp_for *gs, int spc,
1456 : : dump_flags_t flags)
1457 : : {
1458 : 3355 : size_t i;
1459 : :
1460 : 3355 : 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 : 3355 : switch (gimple_omp_for_kind (gs))
1501 : : {
1502 : 808 : case GF_OMP_FOR_KIND_FOR:
1503 : 808 : pp_string (pp, "#pragma omp for");
1504 : 808 : 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 : 744 : case GF_OMP_FOR_KIND_OACC_LOOP:
1512 : 744 : pp_string (pp, "#pragma acc loop");
1513 : 744 : break;
1514 : 870 : case GF_OMP_FOR_KIND_SIMD:
1515 : 870 : pp_string (pp, "#pragma omp simd");
1516 : 870 : break;
1517 : 0 : default:
1518 : 0 : gcc_unreachable ();
1519 : : }
1520 : 3355 : dump_omp_clauses (pp, gimple_omp_for_clauses (gs), spc, flags);
1521 : 6997 : for (i = 0; i < gimple_omp_for_collapse (gs); i++)
1522 : : {
1523 : 3642 : if (i)
1524 : 287 : spc += 2;
1525 : 3642 : newline_and_indent (pp, spc);
1526 : 3642 : pp_string (pp, "for (");
1527 : 3642 : dump_generic_node (pp, gimple_omp_for_index (gs, i), spc,
1528 : : flags, false);
1529 : 3642 : pp_string (pp, " = ");
1530 : 3642 : tree init = gimple_omp_for_initial (gs, i);
1531 : 3642 : if (TREE_CODE (init) != TREE_VEC)
1532 : 3642 : dump_generic_node (pp, init, spc, flags, false);
1533 : : else
1534 : 0 : dump_omp_loop_non_rect_expr (pp, init, spc, flags);
1535 : 3642 : pp_string (pp, "; ");
1536 : :
1537 : 3642 : dump_generic_node (pp, gimple_omp_for_index (gs, i), spc,
1538 : : flags, false);
1539 : 3642 : pp_space (pp);
1540 : 3642 : switch (gimple_omp_for_cond (gs, i))
1541 : : {
1542 : 3001 : case LT_EXPR:
1543 : 3001 : pp_less (pp);
1544 : 3001 : break;
1545 : 8 : case GT_EXPR:
1546 : 8 : pp_greater (pp);
1547 : 8 : break;
1548 : 633 : case LE_EXPR:
1549 : 633 : pp_less_equal (pp);
1550 : 633 : 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 : 3642 : pp_space (pp);
1561 : 3642 : tree cond = gimple_omp_for_final (gs, i);
1562 : 3642 : if (TREE_CODE (cond) != TREE_VEC)
1563 : 3642 : dump_generic_node (pp, cond, spc, flags, false);
1564 : : else
1565 : 0 : dump_omp_loop_non_rect_expr (pp, cond, spc, flags);
1566 : 3642 : pp_string (pp, "; ");
1567 : :
1568 : 3642 : dump_generic_node (pp, gimple_omp_for_index (gs, i), spc,
1569 : : flags, false);
1570 : 3642 : pp_string (pp, " = ");
1571 : 3642 : dump_generic_node (pp, gimple_omp_for_incr (gs, i), spc,
1572 : : flags, false);
1573 : 3642 : pp_right_paren (pp);
1574 : : }
1575 : :
1576 : 3355 : if (!gimple_seq_empty_p (gimple_omp_body (gs)))
1577 : : {
1578 : 2920 : newline_and_indent (pp, spc + 2);
1579 : 2920 : pp_left_brace (pp);
1580 : 2920 : pp_newline (pp);
1581 : 2920 : dump_gimple_seq (pp, gimple_omp_body (gs), spc + 4, flags);
1582 : 2920 : newline_and_indent (pp, spc + 2);
1583 : 2920 : pp_right_brace (pp);
1584 : : }
1585 : : }
1586 : 3355 : }
1587 : :
1588 : : /* Dump a GIMPLE_OMP_CONTINUE tuple on the pretty_printer PP. */
1589 : :
1590 : : static void
1591 : 294 : dump_gimple_omp_continue (pretty_printer *pp, const gomp_continue *gs,
1592 : : int spc, dump_flags_t flags)
1593 : : {
1594 : 294 : 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 : 294 : pp_string (pp, "#pragma omp continue (");
1603 : 294 : dump_generic_node (pp, gimple_omp_continue_control_def (gs),
1604 : : spc, flags, false);
1605 : 294 : pp_comma (pp);
1606 : 294 : pp_space (pp);
1607 : 294 : dump_generic_node (pp, gimple_omp_continue_control_use (gs),
1608 : : spc, flags, false);
1609 : 294 : pp_right_paren (pp);
1610 : : }
1611 : 294 : }
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 : 401 : dump_gimple_omp_dispatch (pretty_printer *buffer, const gimple *gs, int spc,
1733 : : dump_flags_t flags)
1734 : : {
1735 : 401 : 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 : 401 : pp_string (buffer, "#pragma omp dispatch");
1745 : 401 : dump_omp_clauses (buffer, gimple_omp_dispatch_clauses (gs), spc, flags);
1746 : 401 : if (!gimple_seq_empty_p (gimple_omp_body (gs)))
1747 : : {
1748 : 401 : newline_and_indent (buffer, spc + 2);
1749 : 401 : pp_left_brace (buffer);
1750 : 401 : pp_newline (buffer);
1751 : 401 : dump_gimple_seq (buffer, gimple_omp_body (gs), spc + 4, flags);
1752 : 401 : newline_and_indent (buffer, spc + 2);
1753 : 401 : pp_right_brace (buffer);
1754 : : }
1755 : : }
1756 : 401 : }
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 : 2289 : dump_gimple_omp_target (pretty_printer *pp, const gomp_target *gs,
1781 : : int spc, dump_flags_t flags)
1782 : : {
1783 : 2289 : const char *kind;
1784 : 2289 : 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 : 35 : case GF_OMP_TARGET_KIND_UPDATE:
1793 : 35 : kind = " update";
1794 : 35 : 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 : 403 : case GF_OMP_TARGET_KIND_OACC_PARALLEL:
1805 : 403 : kind = " oacc_parallel";
1806 : 403 : break;
1807 : 234 : case GF_OMP_TARGET_KIND_OACC_SERIAL:
1808 : 234 : kind = " oacc_serial";
1809 : 234 : break;
1810 : 88 : case GF_OMP_TARGET_KIND_OACC_DATA:
1811 : 88 : kind = " oacc_data";
1812 : 88 : break;
1813 : 48 : case GF_OMP_TARGET_KIND_OACC_UPDATE:
1814 : 48 : kind = " oacc_update";
1815 : 48 : break;
1816 : 37 : case GF_OMP_TARGET_KIND_OACC_ENTER_DATA:
1817 : 37 : kind = " oacc_enter_data";
1818 : 37 : break;
1819 : 51 : case GF_OMP_TARGET_KIND_OACC_EXIT_DATA:
1820 : 51 : kind = " oacc_exit_data";
1821 : 51 : 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 : 2289 : if (gimple_omp_target_iterator_loops (gs))
1841 : : {
1842 : 42 : pp_string (pp, "// Expanded iterator loops for #pragma omp target\n");
1843 : 42 : dump_gimple_seq (pp, gimple_omp_target_iterator_loops (gs), spc, flags);
1844 : 42 : pp_newline (pp);
1845 : : }
1846 : 2289 : if (flags & TDF_RAW)
1847 : : {
1848 : 0 : dump_gimple_fmt (pp, spc, flags, "%G%s <%+BODY <%S>%nCLAUSES <", gs,
1849 : : kind, gimple_omp_body (gs));
1850 : 0 : dump_omp_clauses (pp, gimple_omp_target_clauses (gs), spc, flags);
1851 : 0 : dump_gimple_fmt (pp, spc, flags, " >, %T, %T%n>",
1852 : : gimple_omp_target_child_fn (gs),
1853 : : gimple_omp_target_data_arg (gs));
1854 : : }
1855 : : else
1856 : : {
1857 : 2289 : pp_string (pp, "#pragma omp target");
1858 : 2289 : pp_string (pp, kind);
1859 : 2289 : dump_omp_clauses (pp, gimple_omp_target_clauses (gs), spc, flags);
1860 : 2289 : if (gimple_omp_target_child_fn (gs))
1861 : : {
1862 : 145 : pp_string (pp, " [child fn: ");
1863 : 145 : dump_generic_node (pp, gimple_omp_target_child_fn (gs),
1864 : : spc, flags, false);
1865 : 145 : pp_string (pp, " (");
1866 : 145 : if (gimple_omp_target_data_arg (gs))
1867 : 125 : dump_generic_node (pp, gimple_omp_target_data_arg (gs),
1868 : : spc, flags, false);
1869 : : else
1870 : 20 : pp_string (pp, "???");
1871 : 145 : pp_string (pp, ")]");
1872 : : }
1873 : 2289 : gimple_seq body = gimple_omp_body (gs);
1874 : 2289 : if (body && gimple_code (gimple_seq_first_stmt (body)) != GIMPLE_BIND)
1875 : : {
1876 : 334 : newline_and_indent (pp, spc + 2);
1877 : 334 : pp_left_brace (pp);
1878 : 334 : pp_newline (pp);
1879 : 334 : dump_gimple_seq (pp, body, spc + 4, flags);
1880 : 334 : newline_and_indent (pp, spc + 2);
1881 : 334 : pp_right_brace (pp);
1882 : : }
1883 : 1955 : else if (body)
1884 : : {
1885 : 1626 : pp_newline (pp);
1886 : 1626 : dump_gimple_seq (pp, body, spc + 2, flags);
1887 : : }
1888 : : }
1889 : 2289 : }
1890 : :
1891 : : /* Dump a GIMPLE_OMP_TEAMS tuple on the pretty_printer PP. */
1892 : :
1893 : : static void
1894 : 502 : dump_gimple_omp_teams (pretty_printer *pp, const gomp_teams *gs, int spc,
1895 : : dump_flags_t flags)
1896 : : {
1897 : 502 : if (flags & TDF_RAW)
1898 : : {
1899 : 0 : dump_gimple_fmt (pp, spc, flags, "%G <%+BODY <%S>%nCLAUSES <", gs,
1900 : : gimple_omp_body (gs));
1901 : 0 : dump_omp_clauses (pp, gimple_omp_teams_clauses (gs), spc, flags);
1902 : 0 : dump_gimple_fmt (pp, spc, flags, " >");
1903 : : }
1904 : : else
1905 : : {
1906 : 502 : pp_string (pp, "#pragma omp teams");
1907 : 502 : dump_omp_clauses (pp, gimple_omp_teams_clauses (gs), spc, flags);
1908 : 502 : if (!gimple_seq_empty_p (gimple_omp_body (gs)))
1909 : : {
1910 : 496 : newline_and_indent (pp, spc + 2);
1911 : 496 : pp_character (pp, '{');
1912 : 496 : pp_newline (pp);
1913 : 496 : dump_gimple_seq (pp, gimple_omp_body (gs), spc + 4, flags);
1914 : 496 : newline_and_indent (pp, spc + 2);
1915 : 496 : pp_character (pp, '}');
1916 : : }
1917 : : }
1918 : 502 : }
1919 : :
1920 : : /* Dump a GIMPLE_OMP_SECTIONS tuple on the pretty_printer PP. */
1921 : :
1922 : : static void
1923 : 35 : dump_gimple_omp_sections (pretty_printer *pp, const gomp_sections *gs,
1924 : : int spc, dump_flags_t flags)
1925 : : {
1926 : 35 : if (flags & TDF_RAW)
1927 : : {
1928 : 0 : dump_gimple_fmt (pp, spc, flags, "%G <%+BODY <%S>%nCLAUSES <", gs,
1929 : : gimple_omp_body (gs));
1930 : 0 : dump_omp_clauses (pp, gimple_omp_sections_clauses (gs), spc, flags);
1931 : 0 : dump_gimple_fmt (pp, spc, flags, " >");
1932 : : }
1933 : : else
1934 : : {
1935 : 35 : pp_string (pp, "#pragma omp sections");
1936 : 35 : if (gimple_omp_sections_control (gs))
1937 : : {
1938 : 7 : pp_string (pp, " <");
1939 : 7 : dump_generic_node (pp, gimple_omp_sections_control (gs), spc,
1940 : : flags, false);
1941 : 7 : pp_greater (pp);
1942 : : }
1943 : 35 : dump_omp_clauses (pp, gimple_omp_sections_clauses (gs), spc, flags);
1944 : 35 : if (!gimple_seq_empty_p (gimple_omp_body (gs)))
1945 : : {
1946 : 28 : newline_and_indent (pp, spc + 2);
1947 : 28 : pp_left_brace (pp);
1948 : 28 : pp_newline (pp);
1949 : 28 : dump_gimple_seq (pp, gimple_omp_body (gs), spc + 4, flags);
1950 : 28 : newline_and_indent (pp, spc + 2);
1951 : 28 : pp_right_brace (pp);
1952 : : }
1953 : : }
1954 : 35 : }
1955 : :
1956 : : /* Dump a GIMPLE_OMP_{MASTER,ORDERED,SECTION,STRUCTURED_BLOCK} tuple on the
1957 : : pretty_printer PP. */
1958 : :
1959 : : static void
1960 : 270 : dump_gimple_omp_block (pretty_printer *pp, const gimple *gs, int spc,
1961 : : dump_flags_t flags)
1962 : : {
1963 : 270 : if (flags & TDF_RAW)
1964 : 0 : dump_gimple_fmt (pp, spc, flags, "%G <%+BODY <%S> >", gs,
1965 : : gimple_omp_body (gs));
1966 : : else
1967 : : {
1968 : 270 : switch (gimple_code (gs))
1969 : : {
1970 : 203 : case GIMPLE_OMP_MASTER:
1971 : 203 : pp_string (pp, "#pragma omp master");
1972 : 203 : break;
1973 : 67 : case GIMPLE_OMP_SECTION:
1974 : 67 : pp_string (pp, "#pragma omp section");
1975 : 67 : break;
1976 : 0 : case GIMPLE_OMP_STRUCTURED_BLOCK:
1977 : 0 : pp_string (pp, "#pragma omp __structured_block");
1978 : 0 : break;
1979 : 0 : default:
1980 : 0 : gcc_unreachable ();
1981 : : }
1982 : 270 : if (!gimple_seq_empty_p (gimple_omp_body (gs)))
1983 : : {
1984 : 253 : newline_and_indent (pp, spc + 2);
1985 : 253 : pp_left_brace (pp);
1986 : 253 : pp_newline (pp);
1987 : 253 : dump_gimple_seq (pp, gimple_omp_body (gs), spc + 4, flags);
1988 : 253 : newline_and_indent (pp, spc + 2);
1989 : 253 : pp_right_brace (pp);
1990 : : }
1991 : : }
1992 : 270 : }
1993 : :
1994 : : /* Dump a GIMPLE_OMP_CRITICAL tuple on the pretty_printer PP. */
1995 : :
1996 : : static void
1997 : 16 : dump_gimple_omp_critical (pretty_printer *pp, const gomp_critical *gs,
1998 : : int spc, dump_flags_t flags)
1999 : : {
2000 : 16 : if (flags & TDF_RAW)
2001 : 0 : dump_gimple_fmt (pp, spc, flags, "%G <%+BODY <%S> >", gs,
2002 : : gimple_omp_body (gs));
2003 : : else
2004 : : {
2005 : 16 : pp_string (pp, "#pragma omp critical");
2006 : 16 : if (gimple_omp_critical_name (gs))
2007 : : {
2008 : 6 : pp_string (pp, " (");
2009 : 6 : dump_generic_node (pp, gimple_omp_critical_name (gs), spc,
2010 : : flags, false);
2011 : 6 : pp_right_paren (pp);
2012 : : }
2013 : 16 : dump_omp_clauses (pp, gimple_omp_critical_clauses (gs), spc, flags);
2014 : 16 : if (!gimple_seq_empty_p (gimple_omp_body (gs)))
2015 : : {
2016 : 0 : newline_and_indent (pp, spc + 2);
2017 : 0 : pp_left_brace (pp);
2018 : 0 : pp_newline (pp);
2019 : 0 : dump_gimple_seq (pp, gimple_omp_body (gs), spc + 4, flags);
2020 : 0 : newline_and_indent (pp, spc + 2);
2021 : 0 : pp_right_brace (pp);
2022 : : }
2023 : : }
2024 : 16 : }
2025 : :
2026 : : /* Dump a GIMPLE_OMP_ORDERED tuple on the pretty_printer PP. */
2027 : :
2028 : : static void
2029 : 37 : dump_gimple_omp_ordered (pretty_printer *pp, const gomp_ordered *gs,
2030 : : int spc, dump_flags_t flags)
2031 : : {
2032 : 37 : if (flags & TDF_RAW)
2033 : 0 : dump_gimple_fmt (pp, spc, flags, "%G <%+BODY <%S> >", gs,
2034 : : gimple_omp_body (gs));
2035 : : else
2036 : : {
2037 : 37 : pp_string (pp, "#pragma omp ordered");
2038 : 37 : dump_omp_clauses (pp, gimple_omp_ordered_clauses (gs), spc, flags);
2039 : 37 : if (!gimple_seq_empty_p (gimple_omp_body (gs)))
2040 : : {
2041 : 13 : newline_and_indent (pp, spc + 2);
2042 : 13 : pp_left_brace (pp);
2043 : 13 : pp_newline (pp);
2044 : 13 : dump_gimple_seq (pp, gimple_omp_body (gs), spc + 4, flags);
2045 : 13 : newline_and_indent (pp, spc + 2);
2046 : 13 : pp_right_brace (pp);
2047 : : }
2048 : : }
2049 : 37 : }
2050 : :
2051 : : /* Dump a GIMPLE_OMP_SCAN tuple on the pretty_printer PP. */
2052 : :
2053 : : static void
2054 : 0 : dump_gimple_omp_scan (pretty_printer *pp, const gomp_scan *gs,
2055 : : int spc, dump_flags_t flags)
2056 : : {
2057 : 0 : if (flags & TDF_RAW)
2058 : 0 : dump_gimple_fmt (pp, spc, flags, "%G <%+BODY <%S> >", gs,
2059 : : gimple_omp_body (gs));
2060 : : else
2061 : : {
2062 : 0 : if (gimple_omp_scan_clauses (gs))
2063 : : {
2064 : 0 : pp_string (pp, "#pragma omp scan");
2065 : 0 : dump_omp_clauses (pp, gimple_omp_scan_clauses (gs), spc, flags);
2066 : : }
2067 : 0 : if (!gimple_seq_empty_p (gimple_omp_body (gs)))
2068 : : {
2069 : 0 : newline_and_indent (pp, spc + 2);
2070 : 0 : pp_left_brace (pp);
2071 : 0 : pp_newline (pp);
2072 : 0 : dump_gimple_seq (pp, gimple_omp_body (gs), spc + 4, flags);
2073 : 0 : newline_and_indent (pp, spc + 2);
2074 : 0 : pp_right_brace (pp);
2075 : : }
2076 : : }
2077 : 0 : }
2078 : :
2079 : : /* Dump a GIMPLE_OMP_RETURN tuple on the pretty_printer PP. */
2080 : :
2081 : : static void
2082 : 630 : dump_gimple_omp_return (pretty_printer *pp, const gimple *gs, int spc,
2083 : : dump_flags_t flags)
2084 : : {
2085 : 630 : if (flags & TDF_RAW)
2086 : : {
2087 : 0 : dump_gimple_fmt (pp, spc, flags, "%G <nowait=%d", gs,
2088 : 0 : (int) gimple_omp_return_nowait_p (gs));
2089 : 0 : if (gimple_omp_return_lhs (gs))
2090 : 0 : dump_gimple_fmt (pp, spc, flags, ", lhs=%T>",
2091 : : gimple_omp_return_lhs (gs));
2092 : : else
2093 : 0 : dump_gimple_fmt (pp, spc, flags, ">");
2094 : : }
2095 : : else
2096 : : {
2097 : 630 : pp_string (pp, "#pragma omp return");
2098 : 630 : if (gimple_omp_return_nowait_p (gs))
2099 : 296 : pp_string (pp, "(nowait)");
2100 : 630 : if (gimple_omp_return_lhs (gs))
2101 : : {
2102 : 0 : pp_string (pp, " (set ");
2103 : 0 : dump_generic_node (pp, gimple_omp_return_lhs (gs),
2104 : : spc, flags, false);
2105 : 0 : pp_character (pp, ')');
2106 : : }
2107 : : }
2108 : 630 : }
2109 : :
2110 : : /* Dump a GIMPLE_ASSUME tuple on the pretty_printer PP. */
2111 : :
2112 : : static void
2113 : 0 : dump_gimple_assume (pretty_printer *pp, const gimple *gs,
2114 : : int spc, dump_flags_t flags)
2115 : : {
2116 : 0 : if (flags & TDF_RAW)
2117 : 0 : dump_gimple_fmt (pp, spc, flags,
2118 : : "%G [GUARD=%T] <%+BODY <%S> >",
2119 : : gs, gimple_assume_guard (gs),
2120 : : gimple_assume_body (gs));
2121 : : else
2122 : : {
2123 : 0 : pp_string (pp, "[[assume (");
2124 : 0 : dump_generic_node (pp, gimple_assume_guard (gs), spc, flags, false);
2125 : 0 : pp_string (pp, ")]]");
2126 : 0 : newline_and_indent (pp, spc + 2);
2127 : 0 : pp_left_brace (pp);
2128 : 0 : pp_newline (pp);
2129 : 0 : dump_gimple_seq (pp, gimple_assume_body (gs), spc + 4, flags);
2130 : 0 : newline_and_indent (pp, spc + 2);
2131 : 0 : pp_right_brace (pp);
2132 : : }
2133 : 0 : }
2134 : :
2135 : : /* Dump a GIMPLE_TRANSACTION tuple on the pretty_printer PP. */
2136 : :
2137 : : static void
2138 : 77 : dump_gimple_transaction (pretty_printer *pp, const gtransaction *gs,
2139 : : int spc, dump_flags_t flags)
2140 : : {
2141 : 77 : unsigned subcode = gimple_transaction_subcode (gs);
2142 : :
2143 : 77 : if (flags & TDF_RAW)
2144 : : {
2145 : 0 : dump_gimple_fmt (pp, spc, flags,
2146 : : "%G [SUBCODE=%x,NORM=%T,UNINST=%T,OVER=%T] "
2147 : : "<%+BODY <%S> >",
2148 : : gs, subcode, gimple_transaction_label_norm (gs),
2149 : : gimple_transaction_label_uninst (gs),
2150 : : gimple_transaction_label_over (gs),
2151 : : gimple_transaction_body (gs));
2152 : : }
2153 : : else
2154 : : {
2155 : 77 : if (subcode & GTMA_IS_OUTER)
2156 : 0 : pp_string (pp, "__transaction_atomic [[outer]]");
2157 : 77 : else if (subcode & GTMA_IS_RELAXED)
2158 : 8 : pp_string (pp, "__transaction_relaxed");
2159 : : else
2160 : 69 : pp_string (pp, "__transaction_atomic");
2161 : 77 : subcode &= ~GTMA_DECLARATION_MASK;
2162 : :
2163 : 77 : if (gimple_transaction_body (gs))
2164 : : {
2165 : 0 : newline_and_indent (pp, spc + 2);
2166 : 0 : pp_left_brace (pp);
2167 : 0 : pp_newline (pp);
2168 : 0 : dump_gimple_seq (pp, gimple_transaction_body (gs),
2169 : : spc + 4, flags);
2170 : 0 : newline_and_indent (pp, spc + 2);
2171 : 0 : pp_right_brace (pp);
2172 : : }
2173 : : else
2174 : : {
2175 : 77 : pp_string (pp, " //");
2176 : 77 : if (gimple_transaction_label_norm (gs))
2177 : : {
2178 : 77 : pp_string (pp, " NORM=");
2179 : 77 : dump_generic_node (pp, gimple_transaction_label_norm (gs),
2180 : : spc, flags, false);
2181 : : }
2182 : 77 : if (gimple_transaction_label_uninst (gs))
2183 : : {
2184 : 77 : pp_string (pp, " UNINST=");
2185 : 77 : dump_generic_node (pp, gimple_transaction_label_uninst (gs),
2186 : : spc, flags, false);
2187 : : }
2188 : 77 : if (gimple_transaction_label_over (gs))
2189 : : {
2190 : 77 : pp_string (pp, " OVER=");
2191 : 77 : dump_generic_node (pp, gimple_transaction_label_over (gs),
2192 : : spc, flags, false);
2193 : : }
2194 : 77 : if (subcode)
2195 : : {
2196 : 77 : pp_string (pp, " SUBCODE=[ ");
2197 : 77 : if (subcode & GTMA_HAVE_ABORT)
2198 : : {
2199 : 1 : pp_string (pp, "GTMA_HAVE_ABORT ");
2200 : 1 : subcode &= ~GTMA_HAVE_ABORT;
2201 : : }
2202 : 77 : if (subcode & GTMA_HAVE_LOAD)
2203 : : {
2204 : 77 : pp_string (pp, "GTMA_HAVE_LOAD ");
2205 : 77 : subcode &= ~GTMA_HAVE_LOAD;
2206 : : }
2207 : 77 : if (subcode & GTMA_HAVE_STORE)
2208 : : {
2209 : 40 : pp_string (pp, "GTMA_HAVE_STORE ");
2210 : 40 : subcode &= ~GTMA_HAVE_STORE;
2211 : : }
2212 : 77 : if (subcode & GTMA_MAY_ENTER_IRREVOCABLE)
2213 : : {
2214 : 8 : pp_string (pp, "GTMA_MAY_ENTER_IRREVOCABLE ");
2215 : 8 : subcode &= ~GTMA_MAY_ENTER_IRREVOCABLE;
2216 : : }
2217 : 77 : if (subcode & GTMA_DOES_GO_IRREVOCABLE)
2218 : : {
2219 : 7 : pp_string (pp, "GTMA_DOES_GO_IRREVOCABLE ");
2220 : 7 : subcode &= ~GTMA_DOES_GO_IRREVOCABLE;
2221 : : }
2222 : 77 : if (subcode & GTMA_HAS_NO_INSTRUMENTATION)
2223 : : {
2224 : 7 : pp_string (pp, "GTMA_HAS_NO_INSTRUMENTATION ");
2225 : 7 : subcode &= ~GTMA_HAS_NO_INSTRUMENTATION;
2226 : : }
2227 : 77 : if (subcode)
2228 : 0 : pp_printf (pp, "0x%x ", subcode);
2229 : 77 : pp_right_bracket (pp);
2230 : : }
2231 : : }
2232 : : }
2233 : 77 : }
2234 : :
2235 : : /* Dump a GIMPLE_ASM tuple on the pretty_printer PP, SPC spaces of
2236 : : indent. FLAGS specifies details to show in the dump (see TDF_* in
2237 : : dumpfile.h). */
2238 : :
2239 : : static void
2240 : 10276 : dump_gimple_asm (pretty_printer *pp, const gasm *gs, int spc,
2241 : : dump_flags_t flags)
2242 : : {
2243 : 10276 : unsigned int i, n, f, fields;
2244 : :
2245 : 10276 : if (flags & TDF_RAW)
2246 : : {
2247 : 4 : dump_gimple_fmt (pp, spc, flags, "%G <%+STRING <%n%s%n>", gs,
2248 : : gimple_asm_string (gs));
2249 : :
2250 : 4 : n = gimple_asm_noutputs (gs);
2251 : 4 : if (n)
2252 : : {
2253 : 0 : newline_and_indent (pp, spc + 2);
2254 : 0 : pp_string (pp, "OUTPUT: ");
2255 : 0 : for (i = 0; i < n; i++)
2256 : : {
2257 : 0 : dump_generic_node (pp, gimple_asm_output_op (gs, i),
2258 : : spc, flags, false);
2259 : 0 : if (i < n - 1)
2260 : 0 : pp_string (pp, ", ");
2261 : : }
2262 : : }
2263 : :
2264 : 4 : n = gimple_asm_ninputs (gs);
2265 : 4 : if (n)
2266 : : {
2267 : 4 : newline_and_indent (pp, spc + 2);
2268 : 4 : pp_string (pp, "INPUT: ");
2269 : 12 : for (i = 0; i < n; i++)
2270 : : {
2271 : 4 : dump_generic_node (pp, gimple_asm_input_op (gs, i),
2272 : : spc, flags, false);
2273 : 4 : if (i < n - 1)
2274 : 0 : pp_string (pp, ", ");
2275 : : }
2276 : : }
2277 : :
2278 : 4 : n = gimple_asm_nclobbers (gs);
2279 : 4 : if (n)
2280 : : {
2281 : 4 : newline_and_indent (pp, spc + 2);
2282 : 4 : pp_string (pp, "CLOBBER: ");
2283 : 12 : for (i = 0; i < n; i++)
2284 : : {
2285 : 4 : dump_generic_node (pp, gimple_asm_clobber_op (gs, i),
2286 : : spc, flags, false);
2287 : 4 : if (i < n - 1)
2288 : 0 : pp_string (pp, ", ");
2289 : : }
2290 : : }
2291 : :
2292 : 4 : n = gimple_asm_nlabels (gs);
2293 : 4 : if (n)
2294 : : {
2295 : 0 : newline_and_indent (pp, spc + 2);
2296 : 0 : pp_string (pp, "LABEL: ");
2297 : 0 : for (i = 0; i < n; i++)
2298 : : {
2299 : 0 : dump_generic_node (pp, gimple_asm_label_op (gs, i),
2300 : : spc, flags, false);
2301 : 0 : if (i < n - 1)
2302 : 0 : pp_string (pp, ", ");
2303 : : }
2304 : : }
2305 : :
2306 : 4 : newline_and_indent (pp, spc);
2307 : 4 : pp_greater (pp);
2308 : : }
2309 : : else
2310 : : {
2311 : 10272 : pp_string (pp, "__asm__");
2312 : 10272 : if (gimple_asm_volatile_p (gs))
2313 : 5274 : pp_string (pp, " __volatile__");
2314 : 10272 : if (gimple_asm_inline_p (gs))
2315 : 0 : pp_string (pp, " __inline__");
2316 : 10272 : if (gimple_asm_nlabels (gs))
2317 : 1 : pp_string (pp, " goto");
2318 : 10272 : pp_string (pp, "(\"");
2319 : 10272 : pp_string (pp, gimple_asm_string (gs));
2320 : 10272 : pp_string (pp, "\"");
2321 : :
2322 : 10272 : if (gimple_asm_nlabels (gs))
2323 : : fields = 4;
2324 : 10271 : else if (gimple_asm_nclobbers (gs))
2325 : : fields = 3;
2326 : 8292 : else if (gimple_asm_ninputs (gs))
2327 : : fields = 2;
2328 : 1117 : else if (gimple_asm_noutputs (gs))
2329 : : fields = 1;
2330 : : else
2331 : 1106 : fields = 0;
2332 : :
2333 : 30574 : for (f = 0; f < fields; ++f)
2334 : : {
2335 : 20302 : pp_string (pp, " : ");
2336 : :
2337 : 20302 : switch (f)
2338 : : {
2339 : 9166 : case 0:
2340 : 9166 : n = gimple_asm_noutputs (gs);
2341 : 21643 : for (i = 0; i < n; i++)
2342 : : {
2343 : 12477 : dump_generic_node (pp, gimple_asm_output_op (gs, i),
2344 : : spc, flags, false);
2345 : 12477 : if (i < n - 1)
2346 : 5372 : pp_string (pp, ", ");
2347 : : }
2348 : : break;
2349 : :
2350 : 9155 : case 1:
2351 : 9155 : n = gimple_asm_ninputs (gs);
2352 : 17303 : for (i = 0; i < n; i++)
2353 : : {
2354 : 8148 : dump_generic_node (pp, gimple_asm_input_op (gs, i),
2355 : : spc, flags, false);
2356 : 8148 : if (i < n - 1)
2357 : 930 : pp_string (pp, ", ");
2358 : : }
2359 : : break;
2360 : :
2361 : 1980 : case 2:
2362 : 1980 : n = gimple_asm_nclobbers (gs);
2363 : 3959 : for (i = 0; i < n; i++)
2364 : : {
2365 : 1979 : dump_generic_node (pp, gimple_asm_clobber_op (gs, i),
2366 : : spc, flags, false);
2367 : 1979 : if (i < n - 1)
2368 : 0 : pp_string (pp, ", ");
2369 : : }
2370 : : break;
2371 : :
2372 : 1 : case 3:
2373 : 1 : n = gimple_asm_nlabels (gs);
2374 : 2 : for (i = 0; i < n; i++)
2375 : : {
2376 : 1 : dump_generic_node (pp, gimple_asm_label_op (gs, i),
2377 : : spc, flags, false);
2378 : 1 : if (i < n - 1)
2379 : 0 : pp_string (pp, ", ");
2380 : : }
2381 : : break;
2382 : :
2383 : : default:
2384 : : gcc_unreachable ();
2385 : : }
2386 : : }
2387 : :
2388 : 10272 : pp_string (pp, ");");
2389 : : }
2390 : 10276 : }
2391 : :
2392 : : /* Dump ptr_info and range_info for NODE on pretty_printer PP with
2393 : : SPC spaces of indent. */
2394 : :
2395 : : static void
2396 : 19251 : dump_ssaname_info (pretty_printer *pp, tree node, int spc)
2397 : : {
2398 : 19251 : if (TREE_CODE (node) != SSA_NAME)
2399 : : return;
2400 : :
2401 : 33881 : if (POINTER_TYPE_P (TREE_TYPE (node))
2402 : 18036 : && SSA_NAME_PTR_INFO (node))
2403 : : {
2404 : 1724 : unsigned int align, misalign;
2405 : 1724 : struct ptr_info_def *pi = SSA_NAME_PTR_INFO (node);
2406 : 1724 : pp_string (pp, "# PT = ");
2407 : 1724 : pp_points_to_solution (pp, &pi->pt);
2408 : 1724 : newline_and_indent (pp, spc);
2409 : 1724 : if (get_ptr_info_alignment (pi, &align, &misalign))
2410 : : {
2411 : 85 : pp_printf (pp, "# ALIGN = %u, MISALIGN = %u", align, misalign);
2412 : 85 : newline_and_indent (pp, spc);
2413 : : }
2414 : : }
2415 : :
2416 : 33881 : if (!POINTER_TYPE_P (TREE_TYPE (node))
2417 : 33582 : && SSA_NAME_RANGE_INFO (node))
2418 : : {
2419 : 3122 : value_range r (TREE_TYPE (node));
2420 : 3122 : get_global_range_query ()->range_of_expr (r, node);
2421 : 3122 : pp_string (pp, "# RANGE ");
2422 : 3122 : pp_vrange (pp, &r);
2423 : 3122 : newline_and_indent (pp, spc);
2424 : 3122 : }
2425 : : }
2426 : :
2427 : : /* As dump_ssaname_info, but dump to FILE. */
2428 : :
2429 : : void
2430 : 552 : dump_ssaname_info_to_file (FILE *file, tree node, int spc)
2431 : : {
2432 : 552 : pretty_printer pp;
2433 : 552 : pp_needs_newline (&pp) = true;
2434 : 552 : pp.set_output_stream (file);
2435 : 552 : dump_ssaname_info (&pp, node, spc);
2436 : 552 : pp_flush (&pp);
2437 : 552 : }
2438 : :
2439 : : /* Dump a PHI node PHI. PP, SPC and FLAGS are as in pp_gimple_stmt_1.
2440 : : The caller is responsible for calling pp_flush on PP to finalize
2441 : : pretty printer. If COMMENT is true, print this after #. */
2442 : :
2443 : : static void
2444 : 659329 : dump_gimple_phi (pretty_printer *pp, const gphi *phi, int spc, bool comment,
2445 : : dump_flags_t flags)
2446 : : {
2447 : 659329 : size_t i;
2448 : 659329 : tree lhs = gimple_phi_result (phi);
2449 : :
2450 : 659329 : if (flags & TDF_ALIAS)
2451 : 4024 : dump_ssaname_info (pp, lhs, spc);
2452 : :
2453 : 659329 : if (comment)
2454 : 157345 : pp_string (pp, "# ");
2455 : :
2456 : 659329 : if (flags & TDF_RAW)
2457 : 85 : dump_gimple_fmt (pp, spc, flags, "%G <%T, ", phi,
2458 : : gimple_phi_result (phi));
2459 : : else
2460 : : {
2461 : 659244 : dump_generic_node (pp, lhs, spc, flags, false);
2462 : 659244 : if (flags & TDF_GIMPLE)
2463 : 0 : pp_string (pp, " = __PHI (");
2464 : : else
2465 : 659244 : pp_string (pp, " = PHI <");
2466 : : }
2467 : 1948058 : for (i = 0; i < gimple_phi_num_args (phi); i++)
2468 : : {
2469 : 1288733 : if ((flags & TDF_LINENO) && gimple_phi_arg_has_location (phi, i))
2470 : 0 : dump_location (pp, gimple_phi_arg_location (phi, i));
2471 : 1288729 : basic_block src = gimple_phi_arg_edge (phi, i)->src;
2472 : 1288729 : if (flags & TDF_GIMPLE)
2473 : : {
2474 : 0 : pp_string (pp, "__BB");
2475 : 0 : pp_decimal_int (pp, src->index);
2476 : 0 : pp_string (pp, ": ");
2477 : : }
2478 : 1288729 : dump_generic_node (pp, gimple_phi_arg_def (phi, i), spc, flags,
2479 : : false);
2480 : 1288729 : if (! (flags & TDF_GIMPLE))
2481 : : {
2482 : 1288729 : pp_left_paren (pp);
2483 : 1288729 : pp_decimal_int (pp, src->index);
2484 : 1288729 : pp_right_paren (pp);
2485 : : }
2486 : 1288729 : if (i < gimple_phi_num_args (phi) - 1)
2487 : 630706 : pp_string (pp, ", ");
2488 : : }
2489 : 659329 : if (flags & TDF_GIMPLE)
2490 : 0 : pp_string (pp, ");");
2491 : : else
2492 : 659329 : pp_greater (pp);
2493 : 659329 : }
2494 : :
2495 : :
2496 : : /* Dump a GIMPLE_OMP_PARALLEL tuple on the pretty_printer PP, SPC spaces
2497 : : of indent. FLAGS specifies details to show in the dump (see TDF_* in
2498 : : dumpfile.h). */
2499 : :
2500 : : static void
2501 : 972 : dump_gimple_omp_parallel (pretty_printer *pp, const gomp_parallel *gs,
2502 : : int spc, dump_flags_t flags)
2503 : : {
2504 : 972 : if (flags & TDF_RAW)
2505 : : {
2506 : 0 : dump_gimple_fmt (pp, spc, flags, "%G <%+BODY <%S>%nCLAUSES <", gs,
2507 : : gimple_omp_body (gs));
2508 : 0 : dump_omp_clauses (pp, gimple_omp_parallel_clauses (gs), spc, flags);
2509 : 0 : dump_gimple_fmt (pp, spc, flags, " >, %T, %T%n>",
2510 : : gimple_omp_parallel_child_fn (gs),
2511 : : gimple_omp_parallel_data_arg (gs));
2512 : : }
2513 : : else
2514 : : {
2515 : 972 : gimple_seq body;
2516 : 972 : pp_string (pp, "#pragma omp parallel");
2517 : 972 : dump_omp_clauses (pp, gimple_omp_parallel_clauses (gs), spc, flags);
2518 : 972 : if (gimple_omp_parallel_child_fn (gs))
2519 : : {
2520 : 142 : pp_string (pp, " [child fn: ");
2521 : 142 : dump_generic_node (pp, gimple_omp_parallel_child_fn (gs),
2522 : : spc, flags, false);
2523 : 142 : pp_string (pp, " (");
2524 : 142 : if (gimple_omp_parallel_data_arg (gs))
2525 : 104 : dump_generic_node (pp, gimple_omp_parallel_data_arg (gs),
2526 : : spc, flags, false);
2527 : : else
2528 : 38 : pp_string (pp, "???");
2529 : 142 : pp_string (pp, ")]");
2530 : : }
2531 : 972 : body = gimple_omp_body (gs);
2532 : 972 : if (body && gimple_code (gimple_seq_first_stmt (body)) != GIMPLE_BIND)
2533 : : {
2534 : 55 : newline_and_indent (pp, spc + 2);
2535 : 55 : pp_left_brace (pp);
2536 : 55 : pp_newline (pp);
2537 : 55 : dump_gimple_seq (pp, body, spc + 4, flags);
2538 : 55 : newline_and_indent (pp, spc + 2);
2539 : 55 : pp_right_brace (pp);
2540 : : }
2541 : 917 : else if (body)
2542 : : {
2543 : 838 : pp_newline (pp);
2544 : 838 : dump_gimple_seq (pp, body, spc + 2, flags);
2545 : : }
2546 : : }
2547 : 972 : }
2548 : :
2549 : :
2550 : : /* Dump a GIMPLE_OMP_TASK tuple on the pretty_printer PP, SPC spaces
2551 : : of indent. FLAGS specifies details to show in the dump (see TDF_* in
2552 : : dumpfile.h). */
2553 : :
2554 : : static void
2555 : 339 : dump_gimple_omp_task (pretty_printer *pp, const gomp_task *gs, int spc,
2556 : : dump_flags_t flags)
2557 : : {
2558 : 339 : if (flags & TDF_RAW)
2559 : : {
2560 : 0 : dump_gimple_fmt (pp, spc, flags, "%G <%+BODY <%S>%nCLAUSES <", gs,
2561 : : gimple_omp_body (gs));
2562 : 0 : dump_omp_clauses (pp, gimple_omp_task_clauses (gs), spc, flags);
2563 : 0 : dump_gimple_fmt (pp, spc, flags, " >, %T, %T, %T, %T, %T%n>",
2564 : : gimple_omp_task_child_fn (gs),
2565 : : gimple_omp_task_data_arg (gs),
2566 : : gimple_omp_task_copy_fn (gs),
2567 : : gimple_omp_task_arg_size (gs),
2568 : : gimple_omp_task_arg_size (gs));
2569 : : }
2570 : : else
2571 : : {
2572 : 339 : gimple_seq body;
2573 : 339 : if (gimple_omp_task_taskloop_p (gs))
2574 : 240 : pp_string (pp, "#pragma omp taskloop");
2575 : 99 : else if (gimple_omp_task_taskwait_p (gs))
2576 : 2 : pp_string (pp, "#pragma omp taskwait");
2577 : : else
2578 : 97 : pp_string (pp, "#pragma omp task");
2579 : 339 : dump_omp_clauses (pp, gimple_omp_task_clauses (gs), spc, flags);
2580 : 339 : if (gimple_omp_task_child_fn (gs))
2581 : : {
2582 : 4 : pp_string (pp, " [child fn: ");
2583 : 4 : dump_generic_node (pp, gimple_omp_task_child_fn (gs),
2584 : : spc, flags, false);
2585 : 4 : pp_string (pp, " (");
2586 : 4 : if (gimple_omp_task_data_arg (gs))
2587 : 4 : dump_generic_node (pp, gimple_omp_task_data_arg (gs),
2588 : : spc, flags, false);
2589 : : else
2590 : 0 : pp_string (pp, "???");
2591 : 4 : pp_string (pp, ")]");
2592 : : }
2593 : 339 : body = gimple_omp_body (gs);
2594 : 339 : if (body && gimple_code (gimple_seq_first_stmt (body)) != GIMPLE_BIND)
2595 : : {
2596 : 4 : newline_and_indent (pp, spc + 2);
2597 : 4 : pp_left_brace (pp);
2598 : 4 : pp_newline (pp);
2599 : 4 : dump_gimple_seq (pp, body, spc + 4, flags);
2600 : 4 : newline_and_indent (pp, spc + 2);
2601 : 4 : pp_right_brace (pp);
2602 : : }
2603 : 335 : else if (body)
2604 : : {
2605 : 333 : pp_newline (pp);
2606 : 333 : dump_gimple_seq (pp, body, spc + 2, flags);
2607 : : }
2608 : : }
2609 : 339 : }
2610 : :
2611 : :
2612 : : /* Dump a GIMPLE_OMP_ATOMIC_LOAD tuple on the pretty_printer PP, SPC
2613 : : spaces of indent. FLAGS specifies details to show in the dump (see TDF_*
2614 : : in dumpfile.h). */
2615 : :
2616 : : static void
2617 : 526 : dump_gimple_omp_atomic_load (pretty_printer *pp, const gomp_atomic_load *gs,
2618 : : int spc, dump_flags_t flags)
2619 : : {
2620 : 526 : if (flags & TDF_RAW)
2621 : : {
2622 : 0 : dump_gimple_fmt (pp, spc, flags, "%G <%T, %T>", gs,
2623 : : gimple_omp_atomic_load_lhs (gs),
2624 : : gimple_omp_atomic_load_rhs (gs));
2625 : : }
2626 : : else
2627 : : {
2628 : 526 : pp_string (pp, "#pragma omp atomic_load");
2629 : 526 : dump_omp_atomic_memory_order (pp,
2630 : : gimple_omp_atomic_memory_order (gs));
2631 : 526 : if (gimple_omp_atomic_need_value_p (gs))
2632 : 0 : pp_string (pp, " [needed]");
2633 : 526 : if (gimple_omp_atomic_weak_p (gs))
2634 : 0 : pp_string (pp, " [weak]");
2635 : 526 : newline_and_indent (pp, spc + 2);
2636 : 526 : dump_generic_node (pp, gimple_omp_atomic_load_lhs (gs),
2637 : : spc, flags, false);
2638 : 526 : pp_space (pp);
2639 : 526 : pp_equal (pp);
2640 : 526 : pp_space (pp);
2641 : 526 : pp_star (pp);
2642 : 526 : dump_generic_node (pp, gimple_omp_atomic_load_rhs (gs),
2643 : : spc, flags, false);
2644 : : }
2645 : 526 : }
2646 : :
2647 : : /* Dump a GIMPLE_OMP_ATOMIC_STORE tuple on the pretty_printer PP, SPC
2648 : : spaces of indent. FLAGS specifies details to show in the dump (see TDF_*
2649 : : in dumpfile.h). */
2650 : :
2651 : : static void
2652 : 526 : dump_gimple_omp_atomic_store (pretty_printer *pp,
2653 : : const gomp_atomic_store *gs, int spc,
2654 : : dump_flags_t flags)
2655 : : {
2656 : 526 : if (flags & TDF_RAW)
2657 : : {
2658 : 0 : dump_gimple_fmt (pp, spc, flags, "%G <%T>", gs,
2659 : : gimple_omp_atomic_store_val (gs));
2660 : : }
2661 : : else
2662 : : {
2663 : 526 : pp_string (pp, "#pragma omp atomic_store");
2664 : 526 : dump_omp_atomic_memory_order (pp,
2665 : : gimple_omp_atomic_memory_order (gs));
2666 : 526 : pp_space (pp);
2667 : 526 : if (gimple_omp_atomic_need_value_p (gs))
2668 : 0 : pp_string (pp, "[needed] ");
2669 : 526 : if (gimple_omp_atomic_weak_p (gs))
2670 : 0 : pp_string (pp, "[weak] ");
2671 : 526 : pp_left_paren (pp);
2672 : 526 : dump_generic_node (pp, gimple_omp_atomic_store_val (gs),
2673 : : spc, flags, false);
2674 : 526 : pp_right_paren (pp);
2675 : : }
2676 : 526 : }
2677 : :
2678 : :
2679 : : /* Dump all the memory operands for statement GS. PP, SPC and
2680 : : FLAGS are as in pp_gimple_stmt_1. */
2681 : :
2682 : : static void
2683 : 22561 : dump_gimple_mem_ops (pretty_printer *pp, const gimple *gs, int spc,
2684 : : dump_flags_t flags)
2685 : : {
2686 : 22561 : tree vdef = gimple_vdef (gs);
2687 : 22561 : tree vuse = gimple_vuse (gs);
2688 : :
2689 : 22561 : if (vdef != NULL_TREE)
2690 : : {
2691 : 2988 : pp_string (pp, "# ");
2692 : 2988 : dump_generic_node (pp, vdef, spc + 2, flags, false);
2693 : 2988 : pp_string (pp, " = VDEF <");
2694 : 2988 : dump_generic_node (pp, vuse, spc + 2, flags, false);
2695 : 2988 : pp_greater (pp);
2696 : 2988 : newline_and_indent (pp, spc);
2697 : : }
2698 : 19573 : else if (vuse != NULL_TREE)
2699 : : {
2700 : 4307 : pp_string (pp, "# VUSE <");
2701 : 4307 : dump_generic_node (pp, vuse, spc + 2, flags, false);
2702 : 4307 : pp_greater (pp);
2703 : 4307 : newline_and_indent (pp, spc);
2704 : : }
2705 : 22561 : }
2706 : :
2707 : :
2708 : : /* Print the gimple statement GS on the pretty printer PP, SPC
2709 : : spaces of indent. FLAGS specifies details to show in the dump (see
2710 : : TDF_* in dumpfile.h). The caller is responsible for calling
2711 : : pp_flush on PP to finalize the pretty printer. */
2712 : :
2713 : : void
2714 : 5434004 : pp_gimple_stmt_1 (pretty_printer *pp, const gimple *gs, int spc,
2715 : : dump_flags_t flags)
2716 : : {
2717 : 5434004 : if (!gs)
2718 : : return;
2719 : :
2720 : 5433890 : if (flags & TDF_STMTADDR)
2721 : 129 : pp_printf (pp, "<&%p> ", (const void *) gs);
2722 : :
2723 : 5433890 : if ((flags & TDF_LINENO) && gimple_has_location (gs))
2724 : 1395 : dump_location (pp, gimple_location (gs));
2725 : :
2726 : 5433890 : if (flags & TDF_EH)
2727 : : {
2728 : 18227 : int lp_nr = lookup_stmt_eh_lp (gs);
2729 : 18227 : if (lp_nr > 0)
2730 : 27 : pp_printf (pp, "[LP %d] ", lp_nr);
2731 : 18200 : else if (lp_nr < 0)
2732 : 12 : pp_printf (pp, "[MNT %d] ", -lp_nr);
2733 : : }
2734 : :
2735 : 5433890 : if ((flags & (TDF_VOPS|TDF_MEMSYMS))
2736 : 5433890 : && gimple_has_mem_ops (gs))
2737 : 22561 : dump_gimple_mem_ops (pp, gs, spc, flags);
2738 : :
2739 : 5508591 : if (gimple_has_lhs (gs)
2740 : 4578502 : && (flags & TDF_ALIAS))
2741 : 14675 : dump_ssaname_info (pp, gimple_get_lhs (gs), spc);
2742 : :
2743 : 5433890 : switch (gimple_code (gs))
2744 : : {
2745 : 10276 : case GIMPLE_ASM:
2746 : 10276 : dump_gimple_asm (pp, as_a <const gasm *> (gs), spc, flags);
2747 : 10276 : break;
2748 : :
2749 : 4418738 : case GIMPLE_ASSIGN:
2750 : 4418738 : dump_gimple_assign (pp, as_a <const gassign *> (gs), spc, flags);
2751 : 4418738 : break;
2752 : :
2753 : 16861 : case GIMPLE_BIND:
2754 : 16861 : dump_gimple_bind (pp, as_a <const gbind *> (gs), spc, flags);
2755 : 16861 : break;
2756 : :
2757 : 159764 : case GIMPLE_CALL:
2758 : 159764 : dump_gimple_call (pp, as_a <const gcall *> (gs), spc, flags);
2759 : 159764 : break;
2760 : :
2761 : 179874 : case GIMPLE_COND:
2762 : 179874 : dump_gimple_cond (pp, as_a <const gcond *> (gs), spc, flags);
2763 : 179874 : break;
2764 : :
2765 : 35153 : case GIMPLE_LABEL:
2766 : 35153 : dump_gimple_label (pp, as_a <const glabel *> (gs), spc, flags);
2767 : 35153 : break;
2768 : :
2769 : 3867 : case GIMPLE_GOTO:
2770 : 3867 : dump_gimple_goto (pp, as_a <const ggoto *> (gs), spc, flags);
2771 : 3867 : break;
2772 : :
2773 : 297 : case GIMPLE_NOP:
2774 : 297 : pp_string (pp, "GIMPLE_NOP");
2775 : 297 : break;
2776 : :
2777 : 54107 : case GIMPLE_RETURN:
2778 : 54107 : dump_gimple_return (pp, as_a <const greturn *> (gs), spc, flags);
2779 : 54107 : break;
2780 : :
2781 : 1423 : case GIMPLE_SWITCH:
2782 : 1423 : dump_gimple_switch (pp, as_a <const gswitch *> (gs), spc, flags);
2783 : 1423 : break;
2784 : :
2785 : 3666 : case GIMPLE_TRY:
2786 : 3666 : dump_gimple_try (pp, as_a <const gtry *> (gs), spc, flags);
2787 : 3666 : break;
2788 : :
2789 : 501984 : case GIMPLE_PHI:
2790 : 501984 : dump_gimple_phi (pp, as_a <const gphi *> (gs), spc, false, flags);
2791 : 501984 : break;
2792 : :
2793 : 972 : case GIMPLE_OMP_PARALLEL:
2794 : 972 : dump_gimple_omp_parallel (pp, as_a <const gomp_parallel *> (gs), spc,
2795 : : flags);
2796 : 972 : break;
2797 : :
2798 : 339 : case GIMPLE_OMP_TASK:
2799 : 339 : dump_gimple_omp_task (pp, as_a <const gomp_task *> (gs), spc, flags);
2800 : 339 : break;
2801 : :
2802 : 526 : case GIMPLE_OMP_ATOMIC_LOAD:
2803 : 526 : dump_gimple_omp_atomic_load (pp, as_a <const gomp_atomic_load *> (gs),
2804 : : spc, flags);
2805 : 526 : break;
2806 : :
2807 : 526 : case GIMPLE_OMP_ATOMIC_STORE:
2808 : 526 : dump_gimple_omp_atomic_store (pp,
2809 : : as_a <const gomp_atomic_store *> (gs),
2810 : : spc, flags);
2811 : 526 : break;
2812 : :
2813 : 3355 : case GIMPLE_OMP_FOR:
2814 : 3355 : dump_gimple_omp_for (pp, as_a <const gomp_for *> (gs), spc, flags);
2815 : 3355 : break;
2816 : :
2817 : 294 : case GIMPLE_OMP_CONTINUE:
2818 : 294 : dump_gimple_omp_continue (pp, as_a <const gomp_continue *> (gs), spc,
2819 : : flags);
2820 : 294 : break;
2821 : :
2822 : 29 : case GIMPLE_OMP_SINGLE:
2823 : 29 : dump_gimple_omp_single (pp, as_a <const gomp_single *> (gs), spc,
2824 : : flags);
2825 : 29 : break;
2826 : :
2827 : 2289 : case GIMPLE_OMP_TARGET:
2828 : 2289 : dump_gimple_omp_target (pp, as_a <const gomp_target *> (gs), spc,
2829 : : flags);
2830 : 2289 : break;
2831 : :
2832 : 502 : case GIMPLE_OMP_TEAMS:
2833 : 502 : dump_gimple_omp_teams (pp, as_a <const gomp_teams *> (gs), spc,
2834 : : flags);
2835 : 502 : break;
2836 : :
2837 : 630 : case GIMPLE_OMP_RETURN:
2838 : 630 : dump_gimple_omp_return (pp, gs, spc, flags);
2839 : 630 : break;
2840 : :
2841 : 35 : case GIMPLE_OMP_SECTIONS:
2842 : 35 : dump_gimple_omp_sections (pp, as_a <const gomp_sections *> (gs),
2843 : : spc, flags);
2844 : 35 : break;
2845 : :
2846 : 7 : case GIMPLE_OMP_SECTIONS_SWITCH:
2847 : 7 : pp_string (pp, "GIMPLE_SECTIONS_SWITCH");
2848 : 7 : break;
2849 : :
2850 : 0 : case GIMPLE_OMP_TASKGROUP:
2851 : 0 : dump_gimple_omp_taskgroup (pp, gs, spc, flags);
2852 : 0 : break;
2853 : :
2854 : 6 : case GIMPLE_OMP_MASKED:
2855 : 6 : dump_gimple_omp_masked (pp, gs, spc, flags);
2856 : 6 : break;
2857 : :
2858 : 0 : case GIMPLE_OMP_SCOPE:
2859 : 0 : dump_gimple_omp_scope (pp, gs, spc, flags);
2860 : 0 : break;
2861 : :
2862 : 401 : case GIMPLE_OMP_DISPATCH:
2863 : 401 : dump_gimple_omp_dispatch(pp, gs, spc, flags);
2864 : 401 : break;
2865 : :
2866 : 0 : case GIMPLE_OMP_INTEROP:
2867 : 0 : dump_gimple_omp_interop (pp, gs, spc, flags);
2868 : 0 : break;
2869 : :
2870 : 270 : case GIMPLE_OMP_MASTER:
2871 : 270 : case GIMPLE_OMP_SECTION:
2872 : 270 : case GIMPLE_OMP_STRUCTURED_BLOCK:
2873 : 270 : dump_gimple_omp_block (pp, gs, spc, flags);
2874 : 270 : break;
2875 : :
2876 : 37 : case GIMPLE_OMP_ORDERED:
2877 : 37 : dump_gimple_omp_ordered (pp, as_a <const gomp_ordered *> (gs), spc,
2878 : : flags);
2879 : 37 : break;
2880 : :
2881 : 0 : case GIMPLE_OMP_SCAN:
2882 : 0 : dump_gimple_omp_scan (pp, as_a <const gomp_scan *> (gs), spc,
2883 : : flags);
2884 : 0 : break;
2885 : :
2886 : 16 : case GIMPLE_OMP_CRITICAL:
2887 : 16 : dump_gimple_omp_critical (pp, as_a <const gomp_critical *> (gs), spc,
2888 : : flags);
2889 : 16 : break;
2890 : :
2891 : 0 : case GIMPLE_CATCH:
2892 : 0 : dump_gimple_catch (pp, as_a <const gcatch *> (gs), spc, flags);
2893 : 0 : break;
2894 : :
2895 : 12 : case GIMPLE_EH_FILTER:
2896 : 12 : dump_gimple_eh_filter (pp, as_a <const geh_filter *> (gs), spc,
2897 : : flags);
2898 : 12 : break;
2899 : :
2900 : 728 : case GIMPLE_EH_MUST_NOT_THROW:
2901 : 728 : dump_gimple_eh_must_not_throw (pp,
2902 : : as_a <const geh_mnt *> (gs),
2903 : : spc, flags);
2904 : 728 : break;
2905 : :
2906 : 0 : case GIMPLE_EH_ELSE:
2907 : 0 : dump_gimple_eh_else (pp, as_a <const geh_else *> (gs), spc, flags);
2908 : 0 : break;
2909 : :
2910 : 1668 : case GIMPLE_RESX:
2911 : 1668 : dump_gimple_resx (pp, as_a <const gresx *> (gs), spc, flags);
2912 : 1668 : break;
2913 : :
2914 : 30 : case GIMPLE_EH_DISPATCH:
2915 : 30 : dump_gimple_eh_dispatch (pp, as_a <const geh_dispatch *> (gs), spc,
2916 : : flags);
2917 : 30 : break;
2918 : :
2919 : 34394 : case GIMPLE_DEBUG:
2920 : 34394 : dump_gimple_debug (pp, as_a <const gdebug *> (gs), spc, flags);
2921 : 34394 : break;
2922 : :
2923 : 737 : case GIMPLE_PREDICT:
2924 : 737 : pp_string (pp, "// predicted ");
2925 : 737 : if (gimple_predict_outcome (gs))
2926 : 44 : pp_string (pp, "likely by ");
2927 : : else
2928 : 693 : pp_string (pp, "unlikely by ");
2929 : 737 : pp_string (pp, predictor_name (gimple_predict_predictor (gs)));
2930 : 737 : pp_string (pp, " predictor.");
2931 : 737 : break;
2932 : :
2933 : 0 : case GIMPLE_ASSUME:
2934 : 0 : dump_gimple_assume (pp, gs, spc, flags);
2935 : 0 : break;
2936 : :
2937 : 77 : case GIMPLE_TRANSACTION:
2938 : 77 : dump_gimple_transaction (pp, as_a <const gtransaction *> (gs), spc,
2939 : : flags);
2940 : 77 : break;
2941 : :
2942 : 0 : default:
2943 : 0 : GIMPLE_NIY;
2944 : : }
2945 : : }
2946 : :
2947 : :
2948 : : /* Dumps header of basic block BB to OUTF indented by INDENT
2949 : : spaces and details described by flags. */
2950 : :
2951 : : static void
2952 : 287146 : dump_gimple_bb_header (FILE *outf, basic_block bb, int indent,
2953 : : dump_flags_t flags)
2954 : : {
2955 : 287146 : if (flags & TDF_BLOCKS)
2956 : : {
2957 : 41912 : if (flags & TDF_LINENO)
2958 : : {
2959 : 0 : gimple_stmt_iterator gsi;
2960 : :
2961 : 0 : fputs (";; ", outf);
2962 : :
2963 : 0 : for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
2964 : 0 : if (!is_gimple_debug (gsi_stmt (gsi))
2965 : 0 : && get_lineno (gsi_stmt (gsi)) != UNKNOWN_LOCATION)
2966 : : {
2967 : 0 : fprintf (outf, "%*sstarting at line %d",
2968 : 0 : indent, "", get_lineno (gsi_stmt (gsi)));
2969 : 0 : break;
2970 : : }
2971 : 0 : fputc ('\n', outf);
2972 : : }
2973 : : }
2974 : : else
2975 : : {
2976 : 245234 : if (flags & TDF_GIMPLE)
2977 : : {
2978 : 73 : fprintf (outf, "%*s__BB(%d", indent, "", bb->index);
2979 : 73 : if (bb->loop_father->header == bb)
2980 : 0 : fprintf (outf, ",loop_header(%d)", bb->loop_father->num);
2981 : 73 : if (bb->count.initialized_p ())
2982 : 0 : fprintf (outf, ",%s(%" PRIu64 ")",
2983 : : profile_quality_as_string (bb->count.quality ()),
2984 : : bb->count.value ());
2985 : 73 : fprintf (outf, "):\n");
2986 : : }
2987 : : else
2988 : 245161 : fprintf (outf, "%*s<bb %d> %s:\n",
2989 : 245161 : indent, "", bb->index, dump_profile (bb->count));
2990 : : }
2991 : 287146 : }
2992 : :
2993 : :
2994 : : /* Dumps end of basic block BB to PP indented by INDENT
2995 : : spaces. */
2996 : :
2997 : : static void
2998 : 0 : dump_gimple_bb_footer (FILE *outf ATTRIBUTE_UNUSED,
2999 : : basic_block bb ATTRIBUTE_UNUSED,
3000 : : int indent ATTRIBUTE_UNUSED,
3001 : : dump_flags_t flags ATTRIBUTE_UNUSED)
3002 : : {
3003 : : /* There is currently no GIMPLE-specific basic block info to dump. */
3004 : 0 : return;
3005 : : }
3006 : :
3007 : :
3008 : : /* Dump PHI nodes of basic block BB to PP with details described
3009 : : by FLAGS and indented by INDENT spaces. */
3010 : :
3011 : : static void
3012 : 287146 : dump_phi_nodes (pretty_printer *pp, basic_block bb, int indent,
3013 : : dump_flags_t flags)
3014 : : {
3015 : 287146 : gphi_iterator i;
3016 : :
3017 : 510064 : for (i = gsi_start_phis (bb); !gsi_end_p (i); gsi_next (&i))
3018 : : {
3019 : 222918 : gphi *phi = i.phi ();
3020 : 445836 : if (!virtual_operand_p (gimple_phi_result (phi)) || (flags & TDF_VOPS))
3021 : : {
3022 : 471265 : INDENT (indent);
3023 : 157345 : dump_gimple_phi (pp, phi, indent,
3024 : 157345 : (flags & TDF_GIMPLE) ? false : true, flags);
3025 : 157345 : pp_newline (pp);
3026 : : }
3027 : : }
3028 : 287146 : }
3029 : :
3030 : :
3031 : : /* Dump jump to basic block BB that is represented implicitly in the cfg
3032 : : to PP. */
3033 : :
3034 : : static void
3035 : 239388 : pp_cfg_jump (pretty_printer *pp, edge e, dump_flags_t flags)
3036 : : {
3037 : 239388 : if (flags & TDF_GIMPLE)
3038 : : {
3039 : 35 : pp_string (pp, "goto __BB");
3040 : 35 : pp_decimal_int (pp, e->dest->index);
3041 : 35 : if (e->probability.initialized_p ())
3042 : : {
3043 : 0 : pp_string (pp, "(");
3044 : 0 : pp_string (pp,
3045 : : profile_quality_as_string (e->probability.quality ()));
3046 : 0 : pp_string (pp, "(");
3047 : 0 : pp_decimal_int (pp, e->probability.value ());
3048 : 0 : pp_string (pp, "))");
3049 : : }
3050 : 35 : pp_semicolon (pp);
3051 : : }
3052 : : else
3053 : : {
3054 : 239353 : pp_string (pp, "goto <bb ");
3055 : 239353 : pp_decimal_int (pp, e->dest->index);
3056 : 239353 : pp_greater (pp);
3057 : 239353 : pp_semicolon (pp);
3058 : :
3059 : 239353 : dump_edge_probability (pp, e);
3060 : : }
3061 : 239388 : }
3062 : :
3063 : :
3064 : : /* Dump edges represented implicitly in basic block BB to PP, indented
3065 : : by INDENT spaces, with details given by FLAGS. */
3066 : :
3067 : : static void
3068 : 287290 : dump_implicit_edges (pretty_printer *pp, basic_block bb, int indent,
3069 : : dump_flags_t flags)
3070 : : {
3071 : 287290 : edge e;
3072 : :
3073 : 574580 : if (safe_is_a <gcond *> (*gsi_last_bb (bb)))
3074 : : {
3075 : 89901 : edge true_edge, false_edge;
3076 : :
3077 : : /* When we are emitting the code or changing CFG, it is possible that
3078 : : the edges are not yet created. When we are using debug_bb in such
3079 : : a situation, we do not want it to crash. */
3080 : 179657 : if (EDGE_COUNT (bb->succs) != 2)
3081 : : return;
3082 : 89756 : extract_true_false_edges_from_block (bb, &true_edge, &false_edge);
3083 : :
3084 : 536588 : INDENT (indent + 2);
3085 : 89756 : pp_cfg_jump (pp, true_edge, flags);
3086 : 89756 : newline_and_indent (pp, indent);
3087 : 89756 : pp_string (pp, "else");
3088 : 89756 : newline_and_indent (pp, indent + 2);
3089 : 89756 : pp_cfg_jump (pp, false_edge, flags);
3090 : 89756 : pp_newline (pp);
3091 : 89756 : return;
3092 : : }
3093 : :
3094 : : /* If there is a fallthru edge, we may need to add an artificial
3095 : : goto to the dump. */
3096 : 197389 : e = find_fallthru_edge (bb->succs);
3097 : :
3098 : 197389 : if (e && (e->dest != bb->next_bb || (flags & TDF_GIMPLE)))
3099 : : {
3100 : 165474 : INDENT (indent);
3101 : :
3102 : 59876 : if ((flags & TDF_LINENO)
3103 : 59876 : && e->goto_locus != UNKNOWN_LOCATION)
3104 : 0 : dump_location (pp, e->goto_locus);
3105 : :
3106 : 59876 : pp_cfg_jump (pp, e, flags);
3107 : 59876 : pp_newline (pp);
3108 : : }
3109 : : }
3110 : :
3111 : :
3112 : : /* Dumps basic block BB to PP with details described by FLAGS and
3113 : : indented by INDENT spaces. */
3114 : :
3115 : : static void
3116 : 287146 : gimple_dump_bb_buff (pretty_printer *pp, basic_block bb, int indent,
3117 : : dump_flags_t flags)
3118 : : {
3119 : 287146 : gimple_stmt_iterator gsi;
3120 : 287146 : gimple *stmt;
3121 : 287146 : int label_indent = indent - 2;
3122 : :
3123 : 287146 : if (label_indent < 0)
3124 : : label_indent = 0;
3125 : :
3126 : 287146 : dump_phi_nodes (pp, bb, indent, flags);
3127 : :
3128 : 1667488 : for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
3129 : : {
3130 : 1093196 : int curr_indent;
3131 : :
3132 : 1093196 : stmt = gsi_stmt (gsi);
3133 : :
3134 : 1093196 : curr_indent = gimple_code (stmt) == GIMPLE_LABEL ? label_indent : indent;
3135 : :
3136 : 3228442 : INDENT (curr_indent);
3137 : 1093196 : pp_gimple_stmt_1 (pp, stmt, curr_indent, flags);
3138 : 1093196 : pp_newline_and_flush (pp);
3139 : 1093196 : gcc_checking_assert (DECL_STRUCT_FUNCTION (current_function_decl));
3140 : 1093196 : dump_histograms_for_stmt (DECL_STRUCT_FUNCTION (current_function_decl),
3141 : 1093196 : pp_buffer (pp)->m_stream, stmt);
3142 : : }
3143 : :
3144 : 287146 : dump_implicit_edges (pp, bb, indent, flags);
3145 : 287146 : pp_flush (pp);
3146 : 287146 : }
3147 : :
3148 : :
3149 : : /* Dumps basic block BB to FILE with details described by FLAGS and
3150 : : indented by INDENT spaces. */
3151 : :
3152 : : void
3153 : 287146 : gimple_dump_bb (FILE *file, basic_block bb, int indent, dump_flags_t flags)
3154 : : {
3155 : 287146 : dump_gimple_bb_header (file, bb, indent, flags);
3156 : 287146 : if (bb->index >= NUM_FIXED_BLOCKS)
3157 : : {
3158 : 287146 : pretty_printer pp;
3159 : 287146 : pp_needs_newline (&pp) = true;
3160 : 287146 : pp.set_output_stream (file);
3161 : 287146 : gimple_dump_bb_buff (&pp, bb, indent, flags);
3162 : 287146 : }
3163 : 287146 : dump_gimple_bb_footer (file, bb, indent, flags);
3164 : 287146 : }
3165 : :
3166 : : /* Dumps basic block BB to pretty-printer PP with default dump flags and
3167 : : no indentation, for use as a label of a DOT graph record-node.
3168 : : ??? Should just use gimple_dump_bb_buff here, except that value profiling
3169 : : histogram dumping doesn't know about pretty-printers. */
3170 : :
3171 : : void
3172 : 144 : gimple_dump_bb_for_graph (pretty_printer *pp, basic_block bb)
3173 : : {
3174 : 144 : pp_printf (pp, "<bb %d>:\n", bb->index);
3175 : 144 : pp_write_text_as_dot_label_to_stream (pp, /*for_record=*/true);
3176 : :
3177 : 159 : for (gphi_iterator gsi = gsi_start_phis (bb); !gsi_end_p (gsi);
3178 : 15 : gsi_next (&gsi))
3179 : : {
3180 : 15 : gphi *phi = gsi.phi ();
3181 : 15 : if (!virtual_operand_p (gimple_phi_result (phi))
3182 : 15 : || (dump_flags & TDF_VOPS))
3183 : : {
3184 : 6 : pp_bar (pp);
3185 : 6 : pp_write_text_to_stream (pp);
3186 : 6 : pp_string (pp, "# ");
3187 : 6 : pp_gimple_stmt_1 (pp, phi, 0, dump_flags);
3188 : 6 : pp_newline (pp);
3189 : 6 : pp_write_text_as_dot_label_to_stream (pp, /*for_record=*/true);
3190 : : }
3191 : : }
3192 : :
3193 : 487 : for (gimple_stmt_iterator gsi = gsi_start_bb (bb); !gsi_end_p (gsi);
3194 : 199 : gsi_next (&gsi))
3195 : : {
3196 : 199 : gimple *stmt = gsi_stmt (gsi);
3197 : 199 : pp_bar (pp);
3198 : 199 : pp_write_text_to_stream (pp);
3199 : 199 : pp_gimple_stmt_1 (pp, stmt, 0, dump_flags);
3200 : 199 : pp_newline (pp);
3201 : 199 : pp_write_text_as_dot_label_to_stream (pp, /*for_record=*/true);
3202 : : }
3203 : 144 : dump_implicit_edges (pp, bb, 0, dump_flags);
3204 : 144 : pp_write_text_as_dot_label_to_stream (pp, /*for_record=*/true);
3205 : 144 : }
3206 : :
3207 : : #if __GNUC__ >= 10
3208 : : # pragma GCC diagnostic pop
3209 : : #endif
|