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