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