* config/spu/spu.md (floatunsdidf2): Remove unused local variable.
[official-gcc.git] / gcc / gimple-pretty-print.c
blob82863260ac3afa53903453b535c26eb63a678943
1 /* Pretty formatting of GIMPLE statements and expressions.
2 Copyright (C) 2001-2016 Free Software Foundation, Inc.
3 Contributed by Aldy Hernandez <aldyh@redhat.com> and
4 Diego Novillo <dnovillo@google.com>
6 This file is part of GCC.
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.
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.
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/>. */
22 #include "config.h"
23 #include "system.h"
24 #include "coretypes.h"
25 #include "backend.h"
26 #include "tree.h"
27 #include "gimple.h"
28 #include "gimple-predict.h"
29 #include "ssa.h"
30 #include "cgraph.h"
31 #include "gimple-pretty-print.h"
32 #include "internal-fn.h"
33 #include "tree-eh.h"
34 #include "gimple-iterator.h"
35 #include "tree-cfg.h"
36 #include "dumpfile.h" /* for dump_flags */
37 #include "value-prof.h"
38 #include "trans-mem.h"
40 #define INDENT(SPACE) \
41 do { int i; for (i = 0; i < SPACE; i++) pp_space (buffer); } while (0)
43 #define GIMPLE_NIY do_niy (buffer,gs)
45 /* Try to print on BUFFER a default message for the unrecognized
46 gimple statement GS. */
48 static void
49 do_niy (pretty_printer *buffer, gimple *gs)
51 pp_printf (buffer, "<<< Unknown GIMPLE statement: %s >>>\n",
52 gimple_code_name[(int) gimple_code (gs)]);
56 /* Emit a newline and SPC indentation spaces to BUFFER. */
58 static void
59 newline_and_indent (pretty_printer *buffer, int spc)
61 pp_newline (buffer);
62 INDENT (spc);
66 /* Print the GIMPLE statement GS on stderr. */
68 DEBUG_FUNCTION void
69 debug_gimple_stmt (gimple *gs)
71 print_gimple_stmt (stderr, gs, 0, TDF_VOPS|TDF_MEMSYMS);
75 /* Print GIMPLE statement G to FILE using SPC indentation spaces and
76 FLAGS as in pp_gimple_stmt_1. */
78 void
79 print_gimple_stmt (FILE *file, gimple *g, int spc, int flags)
81 pretty_printer buffer;
82 pp_needs_newline (&buffer) = true;
83 buffer.buffer->stream = file;
84 pp_gimple_stmt_1 (&buffer, g, spc, flags);
85 pp_newline_and_flush (&buffer);
88 DEBUG_FUNCTION void
89 debug (gimple &ref)
91 print_gimple_stmt (stderr, &ref, 0, 0);
94 DEBUG_FUNCTION void
95 debug (gimple *ptr)
97 if (ptr)
98 debug (*ptr);
99 else
100 fprintf (stderr, "<nil>\n");
104 /* Print GIMPLE statement G to FILE using SPC indentation spaces and
105 FLAGS as in pp_gimple_stmt_1. Print only the right-hand side
106 of the statement. */
108 void
109 print_gimple_expr (FILE *file, gimple *g, int spc, int flags)
111 flags |= TDF_RHS_ONLY;
112 pretty_printer buffer;
113 pp_needs_newline (&buffer) = true;
114 buffer.buffer->stream = file;
115 pp_gimple_stmt_1 (&buffer, g, spc, flags);
116 pp_flush (&buffer);
120 /* Print the GIMPLE sequence SEQ on BUFFER using SPC indentation
121 spaces and FLAGS as in pp_gimple_stmt_1.
122 The caller is responsible for calling pp_flush on BUFFER to finalize
123 the pretty printer. */
125 static void
126 dump_gimple_seq (pretty_printer *buffer, gimple_seq seq, int spc, int flags)
128 gimple_stmt_iterator i;
130 for (i = gsi_start (seq); !gsi_end_p (i); gsi_next (&i))
132 gimple *gs = gsi_stmt (i);
133 INDENT (spc);
134 pp_gimple_stmt_1 (buffer, gs, spc, flags);
135 if (!gsi_one_before_end_p (i))
136 pp_newline (buffer);
141 /* Print GIMPLE sequence SEQ to FILE using SPC indentation spaces and
142 FLAGS as in pp_gimple_stmt_1. */
144 void
145 print_gimple_seq (FILE *file, gimple_seq seq, int spc, int flags)
147 pretty_printer buffer;
148 pp_needs_newline (&buffer) = true;
149 buffer.buffer->stream = file;
150 dump_gimple_seq (&buffer, seq, spc, flags);
151 pp_newline_and_flush (&buffer);
155 /* Print the GIMPLE sequence SEQ on stderr. */
157 DEBUG_FUNCTION void
158 debug_gimple_seq (gimple_seq seq)
160 print_gimple_seq (stderr, seq, 0, TDF_VOPS|TDF_MEMSYMS);
164 /* A simple helper to pretty-print some of the gimple tuples in the printf
165 style. The format modifiers are preceded by '%' and are:
166 'G' - outputs a string corresponding to the code of the given gimple,
167 'S' - outputs a gimple_seq with indent of spc + 2,
168 'T' - outputs the tree t,
169 'd' - outputs an int as a decimal,
170 's' - outputs a string,
171 'n' - outputs a newline,
172 'x' - outputs an int as hexadecimal,
173 '+' - increases indent by 2 then outputs a newline,
174 '-' - decreases indent by 2 then outputs a newline. */
176 static void
177 dump_gimple_fmt (pretty_printer *buffer, int spc, int flags,
178 const char *fmt, ...)
180 va_list args;
181 const char *c;
182 const char *tmp;
184 va_start (args, fmt);
185 for (c = fmt; *c; c++)
187 if (*c == '%')
189 gimple_seq seq;
190 tree t;
191 gimple *g;
192 switch (*++c)
194 case 'G':
195 g = va_arg (args, gimple *);
196 tmp = gimple_code_name[gimple_code (g)];
197 pp_string (buffer, tmp);
198 break;
200 case 'S':
201 seq = va_arg (args, gimple_seq);
202 pp_newline (buffer);
203 dump_gimple_seq (buffer, seq, spc + 2, flags);
204 newline_and_indent (buffer, spc);
205 break;
207 case 'T':
208 t = va_arg (args, tree);
209 if (t == NULL_TREE)
210 pp_string (buffer, "NULL");
211 else
212 dump_generic_node (buffer, t, spc, flags, false);
213 break;
215 case 'd':
216 pp_decimal_int (buffer, va_arg (args, int));
217 break;
219 case 's':
220 pp_string (buffer, va_arg (args, char *));
221 break;
223 case 'n':
224 newline_and_indent (buffer, spc);
225 break;
227 case 'x':
228 pp_scalar (buffer, "%x", va_arg (args, int));
229 break;
231 case '+':
232 spc += 2;
233 newline_and_indent (buffer, spc);
234 break;
236 case '-':
237 spc -= 2;
238 newline_and_indent (buffer, spc);
239 break;
241 default:
242 gcc_unreachable ();
245 else
246 pp_character (buffer, *c);
248 va_end (args);
252 /* Helper for dump_gimple_assign. Print the unary RHS of the
253 assignment GS. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. */
255 static void
256 dump_unary_rhs (pretty_printer *buffer, gassign *gs, int spc, int flags)
258 enum tree_code rhs_code = gimple_assign_rhs_code (gs);
259 tree lhs = gimple_assign_lhs (gs);
260 tree rhs = gimple_assign_rhs1 (gs);
262 switch (rhs_code)
264 case VIEW_CONVERT_EXPR:
265 case ASSERT_EXPR:
266 dump_generic_node (buffer, rhs, spc, flags, false);
267 break;
269 case FIXED_CONVERT_EXPR:
270 case ADDR_SPACE_CONVERT_EXPR:
271 case FIX_TRUNC_EXPR:
272 case FLOAT_EXPR:
273 CASE_CONVERT:
274 pp_left_paren (buffer);
275 dump_generic_node (buffer, TREE_TYPE (lhs), spc, flags, false);
276 pp_string (buffer, ") ");
277 if (op_prio (rhs) < op_code_prio (rhs_code))
279 pp_left_paren (buffer);
280 dump_generic_node (buffer, rhs, spc, flags, false);
281 pp_right_paren (buffer);
283 else
284 dump_generic_node (buffer, rhs, spc, flags, false);
285 break;
287 case PAREN_EXPR:
288 pp_string (buffer, "((");
289 dump_generic_node (buffer, rhs, spc, flags, false);
290 pp_string (buffer, "))");
291 break;
293 case ABS_EXPR:
294 pp_string (buffer, "ABS_EXPR <");
295 dump_generic_node (buffer, rhs, spc, flags, false);
296 pp_greater (buffer);
297 break;
299 default:
300 if (TREE_CODE_CLASS (rhs_code) == tcc_declaration
301 || TREE_CODE_CLASS (rhs_code) == tcc_constant
302 || TREE_CODE_CLASS (rhs_code) == tcc_reference
303 || rhs_code == SSA_NAME
304 || rhs_code == ADDR_EXPR
305 || rhs_code == CONSTRUCTOR)
307 dump_generic_node (buffer, rhs, spc, flags, false);
308 break;
310 else if (rhs_code == BIT_NOT_EXPR)
311 pp_complement (buffer);
312 else if (rhs_code == TRUTH_NOT_EXPR)
313 pp_exclamation (buffer);
314 else if (rhs_code == NEGATE_EXPR)
315 pp_minus (buffer);
316 else
318 pp_left_bracket (buffer);
319 pp_string (buffer, get_tree_code_name (rhs_code));
320 pp_string (buffer, "] ");
323 if (op_prio (rhs) < op_code_prio (rhs_code))
325 pp_left_paren (buffer);
326 dump_generic_node (buffer, rhs, spc, flags, false);
327 pp_right_paren (buffer);
329 else
330 dump_generic_node (buffer, rhs, spc, flags, false);
331 break;
336 /* Helper for dump_gimple_assign. Print the binary RHS of the
337 assignment GS. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. */
339 static void
340 dump_binary_rhs (pretty_printer *buffer, gassign *gs, int spc, int flags)
342 const char *p;
343 enum tree_code code = gimple_assign_rhs_code (gs);
344 switch (code)
346 case COMPLEX_EXPR:
347 case MIN_EXPR:
348 case MAX_EXPR:
349 case VEC_WIDEN_MULT_HI_EXPR:
350 case VEC_WIDEN_MULT_LO_EXPR:
351 case VEC_WIDEN_MULT_EVEN_EXPR:
352 case VEC_WIDEN_MULT_ODD_EXPR:
353 case VEC_PACK_TRUNC_EXPR:
354 case VEC_PACK_SAT_EXPR:
355 case VEC_PACK_FIX_TRUNC_EXPR:
356 case VEC_WIDEN_LSHIFT_HI_EXPR:
357 case VEC_WIDEN_LSHIFT_LO_EXPR:
358 for (p = get_tree_code_name (code); *p; p++)
359 pp_character (buffer, TOUPPER (*p));
360 pp_string (buffer, " <");
361 dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags, false);
362 pp_string (buffer, ", ");
363 dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags, false);
364 pp_greater (buffer);
365 break;
367 default:
368 if (op_prio (gimple_assign_rhs1 (gs)) <= op_code_prio (code))
370 pp_left_paren (buffer);
371 dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags,
372 false);
373 pp_right_paren (buffer);
375 else
376 dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags, false);
377 pp_space (buffer);
378 pp_string (buffer, op_symbol_code (gimple_assign_rhs_code (gs)));
379 pp_space (buffer);
380 if (op_prio (gimple_assign_rhs2 (gs)) <= op_code_prio (code))
382 pp_left_paren (buffer);
383 dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags,
384 false);
385 pp_right_paren (buffer);
387 else
388 dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags, false);
392 /* Helper for dump_gimple_assign. Print the ternary RHS of the
393 assignment GS. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. */
395 static void
396 dump_ternary_rhs (pretty_printer *buffer, gassign *gs, int spc, int flags)
398 const char *p;
399 enum tree_code code = gimple_assign_rhs_code (gs);
400 switch (code)
402 case WIDEN_MULT_PLUS_EXPR:
403 case WIDEN_MULT_MINUS_EXPR:
404 for (p = get_tree_code_name (code); *p; p++)
405 pp_character (buffer, TOUPPER (*p));
406 pp_string (buffer, " <");
407 dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags, false);
408 pp_string (buffer, ", ");
409 dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags, false);
410 pp_string (buffer, ", ");
411 dump_generic_node (buffer, gimple_assign_rhs3 (gs), spc, flags, false);
412 pp_greater (buffer);
413 break;
415 case FMA_EXPR:
416 dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags, false);
417 pp_string (buffer, " * ");
418 dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags, false);
419 pp_string (buffer, " + ");
420 dump_generic_node (buffer, gimple_assign_rhs3 (gs), spc, flags, false);
421 break;
423 case DOT_PROD_EXPR:
424 pp_string (buffer, "DOT_PROD_EXPR <");
425 dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags, false);
426 pp_string (buffer, ", ");
427 dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags, false);
428 pp_string (buffer, ", ");
429 dump_generic_node (buffer, gimple_assign_rhs3 (gs), spc, flags, false);
430 pp_greater (buffer);
431 break;
433 case SAD_EXPR:
434 pp_string (buffer, "SAD_EXPR <");
435 dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags, false);
436 pp_string (buffer, ", ");
437 dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags, false);
438 pp_string (buffer, ", ");
439 dump_generic_node (buffer, gimple_assign_rhs3 (gs), spc, flags, false);
440 pp_greater (buffer);
441 break;
443 case VEC_PERM_EXPR:
444 pp_string (buffer, "VEC_PERM_EXPR <");
445 dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags, false);
446 pp_string (buffer, ", ");
447 dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags, false);
448 pp_string (buffer, ", ");
449 dump_generic_node (buffer, gimple_assign_rhs3 (gs), spc, flags, false);
450 pp_greater (buffer);
451 break;
453 case REALIGN_LOAD_EXPR:
454 pp_string (buffer, "REALIGN_LOAD <");
455 dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags, false);
456 pp_string (buffer, ", ");
457 dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags, false);
458 pp_string (buffer, ", ");
459 dump_generic_node (buffer, gimple_assign_rhs3 (gs), spc, flags, false);
460 pp_greater (buffer);
461 break;
463 case COND_EXPR:
464 dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags, false);
465 pp_string (buffer, " ? ");
466 dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags, false);
467 pp_string (buffer, " : ");
468 dump_generic_node (buffer, gimple_assign_rhs3 (gs), spc, flags, false);
469 break;
471 case VEC_COND_EXPR:
472 pp_string (buffer, "VEC_COND_EXPR <");
473 dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags, false);
474 pp_string (buffer, ", ");
475 dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags, false);
476 pp_string (buffer, ", ");
477 dump_generic_node (buffer, gimple_assign_rhs3 (gs), spc, flags, false);
478 pp_greater (buffer);
479 break;
481 case BIT_INSERT_EXPR:
482 pp_string (buffer, "BIT_INSERT_EXPR <");
483 dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags, false);
484 pp_string (buffer, ", ");
485 dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags, false);
486 pp_string (buffer, ", ");
487 dump_generic_node (buffer, gimple_assign_rhs3 (gs), spc, flags, false);
488 pp_string (buffer, " (");
489 if (INTEGRAL_TYPE_P (TREE_TYPE (gimple_assign_rhs2 (gs))))
490 pp_decimal_int (buffer,
491 TYPE_PRECISION (TREE_TYPE (gimple_assign_rhs2 (gs))));
492 else
493 dump_generic_node (buffer,
494 TYPE_SIZE (TREE_TYPE (gimple_assign_rhs2 (gs))),
495 spc, flags, false);
496 pp_string (buffer, " bits)>");
497 break;
499 default:
500 gcc_unreachable ();
505 /* Dump the gimple assignment GS. BUFFER, SPC and FLAGS are as in
506 pp_gimple_stmt_1. */
508 static void
509 dump_gimple_assign (pretty_printer *buffer, gassign *gs, int spc, int flags)
511 if (flags & TDF_RAW)
513 tree arg1 = NULL;
514 tree arg2 = NULL;
515 tree arg3 = NULL;
516 switch (gimple_num_ops (gs))
518 case 4:
519 arg3 = gimple_assign_rhs3 (gs);
520 /* FALLTHRU */
521 case 3:
522 arg2 = gimple_assign_rhs2 (gs);
523 /* FALLTHRU */
524 case 2:
525 arg1 = gimple_assign_rhs1 (gs);
526 break;
527 default:
528 gcc_unreachable ();
531 dump_gimple_fmt (buffer, spc, flags, "%G <%s, %T, %T, %T, %T>", gs,
532 get_tree_code_name (gimple_assign_rhs_code (gs)),
533 gimple_assign_lhs (gs), arg1, arg2, arg3);
535 else
537 if (!(flags & TDF_RHS_ONLY))
539 dump_generic_node (buffer, gimple_assign_lhs (gs), spc, flags, false);
540 pp_space (buffer);
541 pp_equal (buffer);
543 if (gimple_assign_nontemporal_move_p (gs))
544 pp_string (buffer, "{nt}");
546 if (gimple_has_volatile_ops (gs))
547 pp_string (buffer, "{v}");
549 pp_space (buffer);
552 if (gimple_num_ops (gs) == 2)
553 dump_unary_rhs (buffer, gs, spc, flags);
554 else if (gimple_num_ops (gs) == 3)
555 dump_binary_rhs (buffer, gs, spc, flags);
556 else if (gimple_num_ops (gs) == 4)
557 dump_ternary_rhs (buffer, gs, spc, flags);
558 else
559 gcc_unreachable ();
560 if (!(flags & TDF_RHS_ONLY))
561 pp_semicolon (buffer);
566 /* Dump the return statement GS. BUFFER, SPC and FLAGS are as in
567 pp_gimple_stmt_1. */
569 static void
570 dump_gimple_return (pretty_printer *buffer, greturn *gs, int spc, int flags)
572 tree t, t2;
574 t = gimple_return_retval (gs);
575 t2 = gimple_return_retbnd (gs);
576 if (flags & TDF_RAW)
577 dump_gimple_fmt (buffer, spc, flags, "%G <%T %T>", gs, t, t2);
578 else
580 pp_string (buffer, "return");
581 if (t)
583 pp_space (buffer);
584 dump_generic_node (buffer, t, spc, flags, false);
586 if (t2)
588 pp_string (buffer, ", ");
589 dump_generic_node (buffer, t2, spc, flags, false);
591 pp_semicolon (buffer);
596 /* Dump the call arguments for a gimple call. BUFFER, FLAGS are as in
597 dump_gimple_call. */
599 static void
600 dump_gimple_call_args (pretty_printer *buffer, gcall *gs, int flags)
602 size_t i = 0;
604 /* Pretty print first arg to certain internal fns. */
605 if (gimple_call_internal_p (gs))
607 const char *const *enums = NULL;
608 unsigned limit = 0;
610 switch (gimple_call_internal_fn (gs))
612 case IFN_UNIQUE:
613 #define DEF(X) #X
614 static const char *const unique_args[] = {IFN_UNIQUE_CODES};
615 #undef DEF
616 enums = unique_args;
618 limit = ARRAY_SIZE (unique_args);
619 break;
621 case IFN_GOACC_LOOP:
622 #define DEF(X) #X
623 static const char *const loop_args[] = {IFN_GOACC_LOOP_CODES};
624 #undef DEF
625 enums = loop_args;
626 limit = ARRAY_SIZE (loop_args);
627 break;
629 case IFN_GOACC_REDUCTION:
630 #define DEF(X) #X
631 static const char *const reduction_args[]
632 = {IFN_GOACC_REDUCTION_CODES};
633 #undef DEF
634 enums = reduction_args;
635 limit = ARRAY_SIZE (reduction_args);
636 break;
638 default:
639 break;
641 if (limit)
643 tree arg0 = gimple_call_arg (gs, 0);
644 HOST_WIDE_INT v;
646 if (TREE_CODE (arg0) == INTEGER_CST
647 && tree_fits_shwi_p (arg0)
648 && (v = tree_to_shwi (arg0)) >= 0 && v < limit)
650 i++;
651 pp_string (buffer, enums[v]);
656 for (; i < gimple_call_num_args (gs); i++)
658 if (i)
659 pp_string (buffer, ", ");
660 dump_generic_node (buffer, gimple_call_arg (gs, i), 0, flags, false);
663 if (gimple_call_va_arg_pack_p (gs))
665 if (i)
666 pp_string (buffer, ", ");
668 pp_string (buffer, "__builtin_va_arg_pack ()");
672 /* Dump the points-to solution *PT to BUFFER. */
674 static void
675 pp_points_to_solution (pretty_printer *buffer, struct pt_solution *pt)
677 if (pt->anything)
679 pp_string (buffer, "anything ");
680 return;
682 if (pt->nonlocal)
683 pp_string (buffer, "nonlocal ");
684 if (pt->escaped)
685 pp_string (buffer, "escaped ");
686 if (pt->ipa_escaped)
687 pp_string (buffer, "unit-escaped ");
688 if (pt->null)
689 pp_string (buffer, "null ");
690 if (pt->vars
691 && !bitmap_empty_p (pt->vars))
693 bitmap_iterator bi;
694 unsigned i;
695 pp_string (buffer, "{ ");
696 EXECUTE_IF_SET_IN_BITMAP (pt->vars, 0, i, bi)
698 pp_string (buffer, "D.");
699 pp_decimal_int (buffer, i);
700 pp_space (buffer);
702 pp_right_brace (buffer);
703 if (pt->vars_contains_nonlocal
704 || pt->vars_contains_escaped
705 || pt->vars_contains_escaped_heap
706 || pt->vars_contains_restrict)
708 const char *comma = "";
709 pp_string (buffer, " (");
710 if (pt->vars_contains_nonlocal)
712 pp_string (buffer, "nonlocal");
713 comma = ", ";
715 if (pt->vars_contains_escaped)
717 pp_string (buffer, comma);
718 pp_string (buffer, "escaped");
719 comma = ", ";
721 if (pt->vars_contains_escaped_heap)
723 pp_string (buffer, comma);
724 pp_string (buffer, "escaped heap");
725 comma = ", ";
727 if (pt->vars_contains_restrict)
729 pp_string (buffer, comma);
730 pp_string (buffer, "restrict");
731 comma = ", ";
733 if (pt->vars_contains_interposable)
735 pp_string (buffer, comma);
736 pp_string (buffer, "interposable");
738 pp_string (buffer, ")");
744 /* Dump the call statement GS. BUFFER, SPC and FLAGS are as in
745 pp_gimple_stmt_1. */
747 static void
748 dump_gimple_call (pretty_printer *buffer, gcall *gs, int spc, int flags)
750 tree lhs = gimple_call_lhs (gs);
751 tree fn = gimple_call_fn (gs);
753 if (flags & TDF_ALIAS)
755 struct pt_solution *pt;
756 pt = gimple_call_use_set (gs);
757 if (!pt_solution_empty_p (pt))
759 pp_string (buffer, "# USE = ");
760 pp_points_to_solution (buffer, pt);
761 newline_and_indent (buffer, spc);
763 pt = gimple_call_clobber_set (gs);
764 if (!pt_solution_empty_p (pt))
766 pp_string (buffer, "# CLB = ");
767 pp_points_to_solution (buffer, pt);
768 newline_and_indent (buffer, spc);
772 if (flags & TDF_RAW)
774 if (gimple_call_internal_p (gs))
775 dump_gimple_fmt (buffer, spc, flags, "%G <%s, %T", gs,
776 internal_fn_name (gimple_call_internal_fn (gs)), lhs);
777 else
778 dump_gimple_fmt (buffer, spc, flags, "%G <%T, %T", gs, fn, lhs);
779 if (gimple_call_num_args (gs) > 0)
781 pp_string (buffer, ", ");
782 dump_gimple_call_args (buffer, gs, flags);
784 pp_greater (buffer);
786 else
788 if (lhs && !(flags & TDF_RHS_ONLY))
790 dump_generic_node (buffer, lhs, spc, flags, false);
791 pp_string (buffer, " =");
793 if (gimple_has_volatile_ops (gs))
794 pp_string (buffer, "{v}");
796 pp_space (buffer);
798 if (gimple_call_internal_p (gs))
799 pp_string (buffer, internal_fn_name (gimple_call_internal_fn (gs)));
800 else
801 print_call_name (buffer, fn, flags);
802 pp_string (buffer, " (");
803 dump_gimple_call_args (buffer, gs, flags);
804 pp_right_paren (buffer);
805 if (!(flags & TDF_RHS_ONLY))
806 pp_semicolon (buffer);
809 if (gimple_call_chain (gs))
811 pp_string (buffer, " [static-chain: ");
812 dump_generic_node (buffer, gimple_call_chain (gs), spc, flags, false);
813 pp_right_bracket (buffer);
816 if (gimple_call_return_slot_opt_p (gs))
817 pp_string (buffer, " [return slot optimization]");
818 if (gimple_call_tail_p (gs))
819 pp_string (buffer, " [tail call]");
820 if (gimple_call_must_tail_p (gs))
821 pp_string (buffer, " [must tail call]");
823 if (fn == NULL)
824 return;
826 /* Dump the arguments of _ITM_beginTransaction sanely. */
827 if (TREE_CODE (fn) == ADDR_EXPR)
828 fn = TREE_OPERAND (fn, 0);
829 if (TREE_CODE (fn) == FUNCTION_DECL && decl_is_tm_clone (fn))
830 pp_string (buffer, " [tm-clone]");
831 if (TREE_CODE (fn) == FUNCTION_DECL
832 && DECL_BUILT_IN_CLASS (fn) == BUILT_IN_NORMAL
833 && DECL_FUNCTION_CODE (fn) == BUILT_IN_TM_START
834 && gimple_call_num_args (gs) > 0)
836 tree t = gimple_call_arg (gs, 0);
837 unsigned HOST_WIDE_INT props;
838 gcc_assert (TREE_CODE (t) == INTEGER_CST);
840 pp_string (buffer, " [ ");
842 /* Get the transaction code properties. */
843 props = TREE_INT_CST_LOW (t);
845 if (props & PR_INSTRUMENTEDCODE)
846 pp_string (buffer, "instrumentedCode ");
847 if (props & PR_UNINSTRUMENTEDCODE)
848 pp_string (buffer, "uninstrumentedCode ");
849 if (props & PR_HASNOXMMUPDATE)
850 pp_string (buffer, "hasNoXMMUpdate ");
851 if (props & PR_HASNOABORT)
852 pp_string (buffer, "hasNoAbort ");
853 if (props & PR_HASNOIRREVOCABLE)
854 pp_string (buffer, "hasNoIrrevocable ");
855 if (props & PR_DOESGOIRREVOCABLE)
856 pp_string (buffer, "doesGoIrrevocable ");
857 if (props & PR_HASNOSIMPLEREADS)
858 pp_string (buffer, "hasNoSimpleReads ");
859 if (props & PR_AWBARRIERSOMITTED)
860 pp_string (buffer, "awBarriersOmitted ");
861 if (props & PR_RARBARRIERSOMITTED)
862 pp_string (buffer, "RaRBarriersOmitted ");
863 if (props & PR_UNDOLOGCODE)
864 pp_string (buffer, "undoLogCode ");
865 if (props & PR_PREFERUNINSTRUMENTED)
866 pp_string (buffer, "preferUninstrumented ");
867 if (props & PR_EXCEPTIONBLOCK)
868 pp_string (buffer, "exceptionBlock ");
869 if (props & PR_HASELSE)
870 pp_string (buffer, "hasElse ");
871 if (props & PR_READONLY)
872 pp_string (buffer, "readOnly ");
874 pp_right_bracket (buffer);
879 /* Dump the switch statement GS. BUFFER, SPC and FLAGS are as in
880 pp_gimple_stmt_1. */
882 static void
883 dump_gimple_switch (pretty_printer *buffer, gswitch *gs, int spc,
884 int flags)
886 unsigned int i;
888 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
889 if (flags & TDF_RAW)
890 dump_gimple_fmt (buffer, spc, flags, "%G <%T, ", gs,
891 gimple_switch_index (gs));
892 else
894 pp_string (buffer, "switch (");
895 dump_generic_node (buffer, gimple_switch_index (gs), spc, flags, true);
896 if (flags & TDF_GIMPLE)
897 pp_string (buffer, ") {");
898 else
899 pp_string (buffer, ") <");
902 for (i = 0; i < gimple_switch_num_labels (gs); i++)
904 tree case_label = gimple_switch_label (gs, i);
905 gcc_checking_assert (case_label != NULL_TREE);
906 dump_generic_node (buffer, case_label, spc, flags, false);
907 pp_space (buffer);
908 dump_generic_node (buffer, CASE_LABEL (case_label), spc, flags, false);
909 if (i < gimple_switch_num_labels (gs) - 1)
911 if (flags & TDF_GIMPLE)
912 pp_string (buffer, "; ");
913 else
914 pp_string (buffer, ", ");
917 if (flags & TDF_GIMPLE)
918 pp_string (buffer, "; }");
919 else
920 pp_greater (buffer);
924 /* Dump the gimple conditional GS. BUFFER, SPC and FLAGS are as in
925 pp_gimple_stmt_1. */
927 static void
928 dump_gimple_cond (pretty_printer *buffer, gcond *gs, int spc, int flags)
930 if (flags & TDF_RAW)
931 dump_gimple_fmt (buffer, spc, flags, "%G <%s, %T, %T, %T, %T>", gs,
932 get_tree_code_name (gimple_cond_code (gs)),
933 gimple_cond_lhs (gs), gimple_cond_rhs (gs),
934 gimple_cond_true_label (gs), gimple_cond_false_label (gs));
935 else
937 if (!(flags & TDF_RHS_ONLY))
938 pp_string (buffer, "if (");
939 dump_generic_node (buffer, gimple_cond_lhs (gs), spc, flags, false);
940 pp_space (buffer);
941 pp_string (buffer, op_symbol_code (gimple_cond_code (gs)));
942 pp_space (buffer);
943 dump_generic_node (buffer, gimple_cond_rhs (gs), spc, flags, false);
944 if (!(flags & TDF_RHS_ONLY))
946 pp_right_paren (buffer);
948 if (gimple_cond_true_label (gs))
950 pp_string (buffer, " goto ");
951 dump_generic_node (buffer, gimple_cond_true_label (gs),
952 spc, flags, false);
953 pp_semicolon (buffer);
955 if (gimple_cond_false_label (gs))
957 pp_string (buffer, " else goto ");
958 dump_generic_node (buffer, gimple_cond_false_label (gs),
959 spc, flags, false);
960 pp_semicolon (buffer);
967 /* Dump a GIMPLE_LABEL tuple on the pretty_printer BUFFER, SPC
968 spaces of indent. FLAGS specifies details to show in the dump (see
969 TDF_* in dumpfils.h). */
971 static void
972 dump_gimple_label (pretty_printer *buffer, glabel *gs, int spc, int flags)
974 tree label = gimple_label_label (gs);
975 if (flags & TDF_RAW)
976 dump_gimple_fmt (buffer, spc, flags, "%G <%T>", gs, label);
977 else
979 dump_generic_node (buffer, label, spc, flags, false);
980 pp_colon (buffer);
982 if (flags & TDF_GIMPLE)
983 return;
984 if (DECL_NONLOCAL (label))
985 pp_string (buffer, " [non-local]");
986 if ((flags & TDF_EH) && EH_LANDING_PAD_NR (label))
987 pp_printf (buffer, " [LP %d]", EH_LANDING_PAD_NR (label));
990 /* Dump a GIMPLE_GOTO tuple on the pretty_printer BUFFER, SPC
991 spaces of indent. FLAGS specifies details to show in the dump (see
992 TDF_* in dumpfile.h). */
994 static void
995 dump_gimple_goto (pretty_printer *buffer, ggoto *gs, int spc, int flags)
997 tree label = gimple_goto_dest (gs);
998 if (flags & TDF_RAW)
999 dump_gimple_fmt (buffer, spc, flags, "%G <%T>", gs, label);
1000 else
1001 dump_gimple_fmt (buffer, spc, flags, "goto %T;", label);
1005 /* Dump a GIMPLE_BIND tuple on the pretty_printer BUFFER, SPC
1006 spaces of indent. FLAGS specifies details to show in the dump (see
1007 TDF_* in dumpfile.h). */
1009 static void
1010 dump_gimple_bind (pretty_printer *buffer, gbind *gs, int spc, int flags)
1012 if (flags & TDF_RAW)
1013 dump_gimple_fmt (buffer, spc, flags, "%G <", gs);
1014 else
1015 pp_left_brace (buffer);
1016 if (!(flags & TDF_SLIM))
1018 tree var;
1020 for (var = gimple_bind_vars (gs); var; var = DECL_CHAIN (var))
1022 newline_and_indent (buffer, 2);
1023 print_declaration (buffer, var, spc, flags);
1025 if (gimple_bind_vars (gs))
1026 pp_newline (buffer);
1028 pp_newline (buffer);
1029 dump_gimple_seq (buffer, gimple_bind_body (gs), spc + 2, flags);
1030 newline_and_indent (buffer, spc);
1031 if (flags & TDF_RAW)
1032 pp_greater (buffer);
1033 else
1034 pp_right_brace (buffer);
1038 /* Dump a GIMPLE_TRY tuple on the pretty_printer BUFFER, SPC spaces of
1039 indent. FLAGS specifies details to show in the dump (see TDF_* in
1040 dumpfile.h). */
1042 static void
1043 dump_gimple_try (pretty_printer *buffer, gtry *gs, int spc, int flags)
1045 if (flags & TDF_RAW)
1047 const char *type;
1048 if (gimple_try_kind (gs) == GIMPLE_TRY_CATCH)
1049 type = "GIMPLE_TRY_CATCH";
1050 else if (gimple_try_kind (gs) == GIMPLE_TRY_FINALLY)
1051 type = "GIMPLE_TRY_FINALLY";
1052 else
1053 type = "UNKNOWN GIMPLE_TRY";
1054 dump_gimple_fmt (buffer, spc, flags,
1055 "%G <%s,%+EVAL <%S>%nCLEANUP <%S>%->", gs, type,
1056 gimple_try_eval (gs), gimple_try_cleanup (gs));
1058 else
1060 pp_string (buffer, "try");
1061 newline_and_indent (buffer, spc + 2);
1062 pp_left_brace (buffer);
1063 pp_newline (buffer);
1065 dump_gimple_seq (buffer, gimple_try_eval (gs), spc + 4, flags);
1066 newline_and_indent (buffer, spc + 2);
1067 pp_right_brace (buffer);
1069 if (gimple_try_kind (gs) == GIMPLE_TRY_CATCH)
1071 newline_and_indent (buffer, spc);
1072 pp_string (buffer, "catch");
1073 newline_and_indent (buffer, spc + 2);
1074 pp_left_brace (buffer);
1076 else if (gimple_try_kind (gs) == GIMPLE_TRY_FINALLY)
1078 newline_and_indent (buffer, spc);
1079 pp_string (buffer, "finally");
1080 newline_and_indent (buffer, spc + 2);
1081 pp_left_brace (buffer);
1083 else
1084 pp_string (buffer, " <UNKNOWN GIMPLE_TRY> {");
1086 pp_newline (buffer);
1087 dump_gimple_seq (buffer, gimple_try_cleanup (gs), spc + 4, flags);
1088 newline_and_indent (buffer, spc + 2);
1089 pp_right_brace (buffer);
1094 /* Dump a GIMPLE_CATCH tuple on the pretty_printer BUFFER, SPC spaces of
1095 indent. FLAGS specifies details to show in the dump (see TDF_* in
1096 dumpfile.h). */
1098 static void
1099 dump_gimple_catch (pretty_printer *buffer, gcatch *gs, int spc, int flags)
1101 if (flags & TDF_RAW)
1102 dump_gimple_fmt (buffer, spc, flags, "%G <%T, %+CATCH <%S>%->", gs,
1103 gimple_catch_types (gs), gimple_catch_handler (gs));
1104 else
1105 dump_gimple_fmt (buffer, spc, flags, "catch (%T)%+{%S}",
1106 gimple_catch_types (gs), gimple_catch_handler (gs));
1110 /* Dump a GIMPLE_EH_FILTER tuple on the pretty_printer BUFFER, SPC spaces of
1111 indent. FLAGS specifies details to show in the dump (see TDF_* in
1112 dumpfile.h). */
1114 static void
1115 dump_gimple_eh_filter (pretty_printer *buffer, geh_filter *gs, int spc,
1116 int flags)
1118 if (flags & TDF_RAW)
1119 dump_gimple_fmt (buffer, spc, flags, "%G <%T, %+FAILURE <%S>%->", gs,
1120 gimple_eh_filter_types (gs),
1121 gimple_eh_filter_failure (gs));
1122 else
1123 dump_gimple_fmt (buffer, spc, flags, "<<<eh_filter (%T)>>>%+{%+%S%-}",
1124 gimple_eh_filter_types (gs),
1125 gimple_eh_filter_failure (gs));
1129 /* Dump a GIMPLE_EH_MUST_NOT_THROW tuple. */
1131 static void
1132 dump_gimple_eh_must_not_throw (pretty_printer *buffer,
1133 geh_mnt *gs, int spc, int flags)
1135 if (flags & TDF_RAW)
1136 dump_gimple_fmt (buffer, spc, flags, "%G <%T>", gs,
1137 gimple_eh_must_not_throw_fndecl (gs));
1138 else
1139 dump_gimple_fmt (buffer, spc, flags, "<<<eh_must_not_throw (%T)>>>",
1140 gimple_eh_must_not_throw_fndecl (gs));
1144 /* Dump a GIMPLE_EH_ELSE tuple on the pretty_printer BUFFER, SPC spaces of
1145 indent. FLAGS specifies details to show in the dump (see TDF_* in
1146 dumpfile.h). */
1148 static void
1149 dump_gimple_eh_else (pretty_printer *buffer, geh_else *gs, int spc,
1150 int flags)
1152 if (flags & TDF_RAW)
1153 dump_gimple_fmt (buffer, spc, flags,
1154 "%G <%+N_BODY <%S>%nE_BODY <%S>%->", gs,
1155 gimple_eh_else_n_body (gs), gimple_eh_else_e_body (gs));
1156 else
1157 dump_gimple_fmt (buffer, spc, flags,
1158 "<<<if_normal_exit>>>%+{%S}%-<<<else_eh_exit>>>%+{%S}",
1159 gimple_eh_else_n_body (gs), gimple_eh_else_e_body (gs));
1163 /* Dump a GIMPLE_RESX tuple on the pretty_printer BUFFER, SPC spaces of
1164 indent. FLAGS specifies details to show in the dump (see TDF_* in
1165 dumpfile.h). */
1167 static void
1168 dump_gimple_resx (pretty_printer *buffer, gresx *gs, int spc, int flags)
1170 if (flags & TDF_RAW)
1171 dump_gimple_fmt (buffer, spc, flags, "%G <%d>", gs,
1172 gimple_resx_region (gs));
1173 else
1174 dump_gimple_fmt (buffer, spc, flags, "resx %d", gimple_resx_region (gs));
1177 /* Dump a GIMPLE_EH_DISPATCH tuple on the pretty_printer BUFFER. */
1179 static void
1180 dump_gimple_eh_dispatch (pretty_printer *buffer, geh_dispatch *gs, int spc, int flags)
1182 if (flags & TDF_RAW)
1183 dump_gimple_fmt (buffer, spc, flags, "%G <%d>", gs,
1184 gimple_eh_dispatch_region (gs));
1185 else
1186 dump_gimple_fmt (buffer, spc, flags, "eh_dispatch %d",
1187 gimple_eh_dispatch_region (gs));
1190 /* Dump a GIMPLE_DEBUG tuple on the pretty_printer BUFFER, SPC spaces
1191 of indent. FLAGS specifies details to show in the dump (see TDF_*
1192 in dumpfile.h). */
1194 static void
1195 dump_gimple_debug (pretty_printer *buffer, gdebug *gs, int spc, int flags)
1197 switch (gs->subcode)
1199 case GIMPLE_DEBUG_BIND:
1200 if (flags & TDF_RAW)
1201 dump_gimple_fmt (buffer, spc, flags, "%G BIND <%T, %T>", gs,
1202 gimple_debug_bind_get_var (gs),
1203 gimple_debug_bind_get_value (gs));
1204 else
1205 dump_gimple_fmt (buffer, spc, flags, "# DEBUG %T => %T",
1206 gimple_debug_bind_get_var (gs),
1207 gimple_debug_bind_get_value (gs));
1208 break;
1210 case GIMPLE_DEBUG_SOURCE_BIND:
1211 if (flags & TDF_RAW)
1212 dump_gimple_fmt (buffer, spc, flags, "%G SRCBIND <%T, %T>", gs,
1213 gimple_debug_source_bind_get_var (gs),
1214 gimple_debug_source_bind_get_value (gs));
1215 else
1216 dump_gimple_fmt (buffer, spc, flags, "# DEBUG %T s=> %T",
1217 gimple_debug_source_bind_get_var (gs),
1218 gimple_debug_source_bind_get_value (gs));
1219 break;
1221 default:
1222 gcc_unreachable ();
1226 /* Dump a GIMPLE_OMP_FOR tuple on the pretty_printer BUFFER. */
1227 static void
1228 dump_gimple_omp_for (pretty_printer *buffer, gomp_for *gs, int spc, int flags)
1230 size_t i;
1232 if (flags & TDF_RAW)
1234 const char *kind;
1235 switch (gimple_omp_for_kind (gs))
1237 case GF_OMP_FOR_KIND_FOR:
1238 kind = "";
1239 break;
1240 case GF_OMP_FOR_KIND_DISTRIBUTE:
1241 kind = " distribute";
1242 break;
1243 case GF_OMP_FOR_KIND_TASKLOOP:
1244 kind = " taskloop";
1245 break;
1246 case GF_OMP_FOR_KIND_CILKFOR:
1247 kind = " _Cilk_for";
1248 break;
1249 case GF_OMP_FOR_KIND_OACC_LOOP:
1250 kind = " oacc_loop";
1251 break;
1252 case GF_OMP_FOR_KIND_SIMD:
1253 kind = " simd";
1254 break;
1255 case GF_OMP_FOR_KIND_CILKSIMD:
1256 kind = " cilksimd";
1257 break;
1258 default:
1259 gcc_unreachable ();
1261 dump_gimple_fmt (buffer, spc, flags, "%G%s <%+BODY <%S>%nCLAUSES <", gs,
1262 kind, gimple_omp_body (gs));
1263 dump_omp_clauses (buffer, gimple_omp_for_clauses (gs), spc, flags);
1264 dump_gimple_fmt (buffer, spc, flags, " >,");
1265 for (i = 0; i < gimple_omp_for_collapse (gs); i++)
1266 dump_gimple_fmt (buffer, spc, flags,
1267 "%+%T, %T, %T, %s, %T,%n",
1268 gimple_omp_for_index (gs, i),
1269 gimple_omp_for_initial (gs, i),
1270 gimple_omp_for_final (gs, i),
1271 get_tree_code_name (gimple_omp_for_cond (gs, i)),
1272 gimple_omp_for_incr (gs, i));
1273 dump_gimple_fmt (buffer, spc, flags, "PRE_BODY <%S>%->",
1274 gimple_omp_for_pre_body (gs));
1276 else
1278 switch (gimple_omp_for_kind (gs))
1280 case GF_OMP_FOR_KIND_FOR:
1281 pp_string (buffer, "#pragma omp for");
1282 break;
1283 case GF_OMP_FOR_KIND_DISTRIBUTE:
1284 pp_string (buffer, "#pragma omp distribute");
1285 break;
1286 case GF_OMP_FOR_KIND_TASKLOOP:
1287 pp_string (buffer, "#pragma omp taskloop");
1288 break;
1289 case GF_OMP_FOR_KIND_CILKFOR:
1290 break;
1291 case GF_OMP_FOR_KIND_OACC_LOOP:
1292 pp_string (buffer, "#pragma acc loop");
1293 break;
1294 case GF_OMP_FOR_KIND_SIMD:
1295 pp_string (buffer, "#pragma omp simd");
1296 break;
1297 case GF_OMP_FOR_KIND_CILKSIMD:
1298 pp_string (buffer, "#pragma simd");
1299 break;
1300 case GF_OMP_FOR_KIND_GRID_LOOP:
1301 pp_string (buffer, "#pragma omp for grid_loop");
1302 break;
1303 default:
1304 gcc_unreachable ();
1306 if (gimple_omp_for_kind (gs) != GF_OMP_FOR_KIND_CILKFOR)
1307 dump_omp_clauses (buffer, gimple_omp_for_clauses (gs), spc, flags);
1308 for (i = 0; i < gimple_omp_for_collapse (gs); i++)
1310 if (i)
1311 spc += 2;
1312 if (gimple_omp_for_kind (gs) == GF_OMP_FOR_KIND_CILKFOR)
1313 pp_string (buffer, "_Cilk_for (");
1314 else
1316 newline_and_indent (buffer, spc);
1317 pp_string (buffer, "for (");
1319 dump_generic_node (buffer, gimple_omp_for_index (gs, i), spc,
1320 flags, false);
1321 pp_string (buffer, " = ");
1322 dump_generic_node (buffer, gimple_omp_for_initial (gs, i), spc,
1323 flags, false);
1324 pp_string (buffer, "; ");
1326 dump_generic_node (buffer, gimple_omp_for_index (gs, i), spc,
1327 flags, false);
1328 pp_space (buffer);
1329 switch (gimple_omp_for_cond (gs, i))
1331 case LT_EXPR:
1332 pp_less (buffer);
1333 break;
1334 case GT_EXPR:
1335 pp_greater (buffer);
1336 break;
1337 case LE_EXPR:
1338 pp_less_equal (buffer);
1339 break;
1340 case GE_EXPR:
1341 pp_greater_equal (buffer);
1342 break;
1343 case NE_EXPR:
1344 pp_string (buffer, "!=");
1345 break;
1346 default:
1347 gcc_unreachable ();
1349 pp_space (buffer);
1350 dump_generic_node (buffer, gimple_omp_for_final (gs, i), spc,
1351 flags, false);
1352 pp_string (buffer, "; ");
1354 dump_generic_node (buffer, gimple_omp_for_index (gs, i), spc,
1355 flags, false);
1356 pp_string (buffer, " = ");
1357 dump_generic_node (buffer, gimple_omp_for_incr (gs, i), spc,
1358 flags, false);
1359 pp_right_paren (buffer);
1362 if (!gimple_seq_empty_p (gimple_omp_body (gs)))
1364 if (gimple_omp_for_kind (gs) == GF_OMP_FOR_KIND_CILKFOR)
1365 dump_omp_clauses (buffer, gimple_omp_for_clauses (gs), spc, flags);
1366 newline_and_indent (buffer, spc + 2);
1367 pp_left_brace (buffer);
1368 pp_newline (buffer);
1369 dump_gimple_seq (buffer, gimple_omp_body (gs), spc + 4, flags);
1370 newline_and_indent (buffer, spc + 2);
1371 pp_right_brace (buffer);
1376 /* Dump a GIMPLE_OMP_CONTINUE tuple on the pretty_printer BUFFER. */
1378 static void
1379 dump_gimple_omp_continue (pretty_printer *buffer, gomp_continue *gs,
1380 int spc, int flags)
1382 if (flags & TDF_RAW)
1384 dump_gimple_fmt (buffer, spc, flags, "%G <%T, %T>", gs,
1385 gimple_omp_continue_control_def (gs),
1386 gimple_omp_continue_control_use (gs));
1388 else
1390 pp_string (buffer, "#pragma omp continue (");
1391 dump_generic_node (buffer, gimple_omp_continue_control_def (gs),
1392 spc, flags, false);
1393 pp_comma (buffer);
1394 pp_space (buffer);
1395 dump_generic_node (buffer, gimple_omp_continue_control_use (gs),
1396 spc, flags, false);
1397 pp_right_paren (buffer);
1401 /* Dump a GIMPLE_OMP_SINGLE tuple on the pretty_printer BUFFER. */
1403 static void
1404 dump_gimple_omp_single (pretty_printer *buffer, gomp_single *gs,
1405 int spc, int flags)
1407 if (flags & TDF_RAW)
1409 dump_gimple_fmt (buffer, spc, flags, "%G <%+BODY <%S>%nCLAUSES <", gs,
1410 gimple_omp_body (gs));
1411 dump_omp_clauses (buffer, gimple_omp_single_clauses (gs), spc, flags);
1412 dump_gimple_fmt (buffer, spc, flags, " >");
1414 else
1416 pp_string (buffer, "#pragma omp single");
1417 dump_omp_clauses (buffer, gimple_omp_single_clauses (gs), spc, flags);
1418 if (!gimple_seq_empty_p (gimple_omp_body (gs)))
1420 newline_and_indent (buffer, spc + 2);
1421 pp_left_brace (buffer);
1422 pp_newline (buffer);
1423 dump_gimple_seq (buffer, gimple_omp_body (gs), spc + 4, flags);
1424 newline_and_indent (buffer, spc + 2);
1425 pp_right_brace (buffer);
1430 /* Dump a GIMPLE_OMP_TARGET tuple on the pretty_printer BUFFER. */
1432 static void
1433 dump_gimple_omp_target (pretty_printer *buffer, gomp_target *gs,
1434 int spc, int flags)
1436 const char *kind;
1437 switch (gimple_omp_target_kind (gs))
1439 case GF_OMP_TARGET_KIND_REGION:
1440 kind = "";
1441 break;
1442 case GF_OMP_TARGET_KIND_DATA:
1443 kind = " data";
1444 break;
1445 case GF_OMP_TARGET_KIND_UPDATE:
1446 kind = " update";
1447 break;
1448 case GF_OMP_TARGET_KIND_ENTER_DATA:
1449 kind = " enter data";
1450 break;
1451 case GF_OMP_TARGET_KIND_EXIT_DATA:
1452 kind = " exit data";
1453 break;
1454 case GF_OMP_TARGET_KIND_OACC_KERNELS:
1455 kind = " oacc_kernels";
1456 break;
1457 case GF_OMP_TARGET_KIND_OACC_PARALLEL:
1458 kind = " oacc_parallel";
1459 break;
1460 case GF_OMP_TARGET_KIND_OACC_DATA:
1461 kind = " oacc_data";
1462 break;
1463 case GF_OMP_TARGET_KIND_OACC_UPDATE:
1464 kind = " oacc_update";
1465 break;
1466 case GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA:
1467 kind = " oacc_enter_exit_data";
1468 break;
1469 case GF_OMP_TARGET_KIND_OACC_DECLARE:
1470 kind = " oacc_declare";
1471 break;
1472 case GF_OMP_TARGET_KIND_OACC_HOST_DATA:
1473 kind = " oacc_host_data";
1474 break;
1475 default:
1476 gcc_unreachable ();
1478 if (flags & TDF_RAW)
1480 dump_gimple_fmt (buffer, spc, flags, "%G%s <%+BODY <%S>%nCLAUSES <", gs,
1481 kind, gimple_omp_body (gs));
1482 dump_omp_clauses (buffer, gimple_omp_target_clauses (gs), spc, flags);
1483 dump_gimple_fmt (buffer, spc, flags, " >, %T, %T%n>",
1484 gimple_omp_target_child_fn (gs),
1485 gimple_omp_target_data_arg (gs));
1487 else
1489 pp_string (buffer, "#pragma omp target");
1490 pp_string (buffer, kind);
1491 dump_omp_clauses (buffer, gimple_omp_target_clauses (gs), spc, flags);
1492 if (gimple_omp_target_child_fn (gs))
1494 pp_string (buffer, " [child fn: ");
1495 dump_generic_node (buffer, gimple_omp_target_child_fn (gs),
1496 spc, flags, false);
1497 pp_string (buffer, " (");
1498 if (gimple_omp_target_data_arg (gs))
1499 dump_generic_node (buffer, gimple_omp_target_data_arg (gs),
1500 spc, flags, false);
1501 else
1502 pp_string (buffer, "???");
1503 pp_string (buffer, ")]");
1505 gimple_seq body = gimple_omp_body (gs);
1506 if (body && gimple_code (gimple_seq_first_stmt (body)) != GIMPLE_BIND)
1508 newline_and_indent (buffer, spc + 2);
1509 pp_left_brace (buffer);
1510 pp_newline (buffer);
1511 dump_gimple_seq (buffer, body, spc + 4, flags);
1512 newline_and_indent (buffer, spc + 2);
1513 pp_right_brace (buffer);
1515 else if (body)
1517 pp_newline (buffer);
1518 dump_gimple_seq (buffer, body, spc + 2, flags);
1523 /* Dump a GIMPLE_OMP_TEAMS tuple on the pretty_printer BUFFER. */
1525 static void
1526 dump_gimple_omp_teams (pretty_printer *buffer, gomp_teams *gs, int spc,
1527 int flags)
1529 if (flags & TDF_RAW)
1531 dump_gimple_fmt (buffer, spc, flags, "%G <%+BODY <%S>%nCLAUSES <", gs,
1532 gimple_omp_body (gs));
1533 dump_omp_clauses (buffer, gimple_omp_teams_clauses (gs), spc, flags);
1534 dump_gimple_fmt (buffer, spc, flags, " >");
1536 else
1538 pp_string (buffer, "#pragma omp teams");
1539 dump_omp_clauses (buffer, gimple_omp_teams_clauses (gs), spc, flags);
1540 if (!gimple_seq_empty_p (gimple_omp_body (gs)))
1542 newline_and_indent (buffer, spc + 2);
1543 pp_character (buffer, '{');
1544 pp_newline (buffer);
1545 dump_gimple_seq (buffer, gimple_omp_body (gs), spc + 4, flags);
1546 newline_and_indent (buffer, spc + 2);
1547 pp_character (buffer, '}');
1552 /* Dump a GIMPLE_OMP_SECTIONS tuple on the pretty_printer BUFFER. */
1554 static void
1555 dump_gimple_omp_sections (pretty_printer *buffer, gomp_sections *gs,
1556 int spc, int flags)
1558 if (flags & TDF_RAW)
1560 dump_gimple_fmt (buffer, spc, flags, "%G <%+BODY <%S>%nCLAUSES <", gs,
1561 gimple_omp_body (gs));
1562 dump_omp_clauses (buffer, gimple_omp_sections_clauses (gs), spc, flags);
1563 dump_gimple_fmt (buffer, spc, flags, " >");
1565 else
1567 pp_string (buffer, "#pragma omp sections");
1568 if (gimple_omp_sections_control (gs))
1570 pp_string (buffer, " <");
1571 dump_generic_node (buffer, gimple_omp_sections_control (gs), spc,
1572 flags, false);
1573 pp_greater (buffer);
1575 dump_omp_clauses (buffer, gimple_omp_sections_clauses (gs), spc, flags);
1576 if (!gimple_seq_empty_p (gimple_omp_body (gs)))
1578 newline_and_indent (buffer, spc + 2);
1579 pp_left_brace (buffer);
1580 pp_newline (buffer);
1581 dump_gimple_seq (buffer, gimple_omp_body (gs), spc + 4, flags);
1582 newline_and_indent (buffer, spc + 2);
1583 pp_right_brace (buffer);
1588 /* Dump a GIMPLE_OMP_{MASTER,TASKGROUP,ORDERED,SECTION} tuple on the
1589 pretty_printer BUFFER. */
1591 static void
1592 dump_gimple_omp_block (pretty_printer *buffer, gimple *gs, int spc, int flags)
1594 if (flags & TDF_RAW)
1595 dump_gimple_fmt (buffer, spc, flags, "%G <%+BODY <%S> >", gs,
1596 gimple_omp_body (gs));
1597 else
1599 switch (gimple_code (gs))
1601 case GIMPLE_OMP_MASTER:
1602 pp_string (buffer, "#pragma omp master");
1603 break;
1604 case GIMPLE_OMP_TASKGROUP:
1605 pp_string (buffer, "#pragma omp taskgroup");
1606 break;
1607 case GIMPLE_OMP_SECTION:
1608 pp_string (buffer, "#pragma omp section");
1609 break;
1610 case GIMPLE_OMP_GRID_BODY:
1611 pp_string (buffer, "#pragma omp gridified body");
1612 break;
1613 default:
1614 gcc_unreachable ();
1616 if (!gimple_seq_empty_p (gimple_omp_body (gs)))
1618 newline_and_indent (buffer, spc + 2);
1619 pp_left_brace (buffer);
1620 pp_newline (buffer);
1621 dump_gimple_seq (buffer, gimple_omp_body (gs), spc + 4, flags);
1622 newline_and_indent (buffer, spc + 2);
1623 pp_right_brace (buffer);
1628 /* Dump a GIMPLE_OMP_CRITICAL tuple on the pretty_printer BUFFER. */
1630 static void
1631 dump_gimple_omp_critical (pretty_printer *buffer, gomp_critical *gs,
1632 int spc, int flags)
1634 if (flags & TDF_RAW)
1635 dump_gimple_fmt (buffer, spc, flags, "%G <%+BODY <%S> >", gs,
1636 gimple_omp_body (gs));
1637 else
1639 pp_string (buffer, "#pragma omp critical");
1640 if (gimple_omp_critical_name (gs))
1642 pp_string (buffer, " (");
1643 dump_generic_node (buffer, gimple_omp_critical_name (gs), spc,
1644 flags, false);
1645 pp_right_paren (buffer);
1647 dump_omp_clauses (buffer, gimple_omp_critical_clauses (gs), spc, flags);
1648 if (!gimple_seq_empty_p (gimple_omp_body (gs)))
1650 newline_and_indent (buffer, spc + 2);
1651 pp_left_brace (buffer);
1652 pp_newline (buffer);
1653 dump_gimple_seq (buffer, gimple_omp_body (gs), spc + 4, flags);
1654 newline_and_indent (buffer, spc + 2);
1655 pp_right_brace (buffer);
1660 /* Dump a GIMPLE_OMP_ORDERED tuple on the pretty_printer BUFFER. */
1662 static void
1663 dump_gimple_omp_ordered (pretty_printer *buffer, gomp_ordered *gs,
1664 int spc, int flags)
1666 if (flags & TDF_RAW)
1667 dump_gimple_fmt (buffer, spc, flags, "%G <%+BODY <%S> >", gs,
1668 gimple_omp_body (gs));
1669 else
1671 pp_string (buffer, "#pragma omp ordered");
1672 dump_omp_clauses (buffer, gimple_omp_ordered_clauses (gs), spc, flags);
1673 if (!gimple_seq_empty_p (gimple_omp_body (gs)))
1675 newline_and_indent (buffer, spc + 2);
1676 pp_left_brace (buffer);
1677 pp_newline (buffer);
1678 dump_gimple_seq (buffer, gimple_omp_body (gs), spc + 4, flags);
1679 newline_and_indent (buffer, spc + 2);
1680 pp_right_brace (buffer);
1685 /* Dump a GIMPLE_OMP_RETURN tuple on the pretty_printer BUFFER. */
1687 static void
1688 dump_gimple_omp_return (pretty_printer *buffer, gimple *gs, int spc, int flags)
1690 if (flags & TDF_RAW)
1692 dump_gimple_fmt (buffer, spc, flags, "%G <nowait=%d", gs,
1693 (int) gimple_omp_return_nowait_p (gs));
1694 if (gimple_omp_return_lhs (gs))
1695 dump_gimple_fmt (buffer, spc, flags, ", lhs=%T>",
1696 gimple_omp_return_lhs (gs));
1697 else
1698 dump_gimple_fmt (buffer, spc, flags, ">");
1700 else
1702 pp_string (buffer, "#pragma omp return");
1703 if (gimple_omp_return_nowait_p (gs))
1704 pp_string (buffer, "(nowait)");
1705 if (gimple_omp_return_lhs (gs))
1707 pp_string (buffer, " (set ");
1708 dump_generic_node (buffer, gimple_omp_return_lhs (gs),
1709 spc, flags, false);
1710 pp_character (buffer, ')');
1715 /* Dump a GIMPLE_TRANSACTION tuple on the pretty_printer BUFFER. */
1717 static void
1718 dump_gimple_transaction (pretty_printer *buffer, gtransaction *gs,
1719 int spc, int flags)
1721 unsigned subcode = gimple_transaction_subcode (gs);
1723 if (flags & TDF_RAW)
1725 dump_gimple_fmt (buffer, spc, flags,
1726 "%G [SUBCODE=%x,NORM=%T,UNINST=%T,OVER=%T] "
1727 "<%+BODY <%S> >",
1728 gs, subcode, gimple_transaction_label_norm (gs),
1729 gimple_transaction_label_uninst (gs),
1730 gimple_transaction_label_over (gs),
1731 gimple_transaction_body (gs));
1733 else
1735 if (subcode & GTMA_IS_OUTER)
1736 pp_string (buffer, "__transaction_atomic [[outer]]");
1737 else if (subcode & GTMA_IS_RELAXED)
1738 pp_string (buffer, "__transaction_relaxed");
1739 else
1740 pp_string (buffer, "__transaction_atomic");
1741 subcode &= ~GTMA_DECLARATION_MASK;
1743 if (gimple_transaction_body (gs))
1745 newline_and_indent (buffer, spc + 2);
1746 pp_left_brace (buffer);
1747 pp_newline (buffer);
1748 dump_gimple_seq (buffer, gimple_transaction_body (gs),
1749 spc + 4, flags);
1750 newline_and_indent (buffer, spc + 2);
1751 pp_right_brace (buffer);
1753 else
1755 pp_string (buffer, " //");
1756 if (gimple_transaction_label_norm (gs))
1758 pp_string (buffer, " NORM=");
1759 dump_generic_node (buffer, gimple_transaction_label_norm (gs),
1760 spc, flags, false);
1762 if (gimple_transaction_label_uninst (gs))
1764 pp_string (buffer, " UNINST=");
1765 dump_generic_node (buffer, gimple_transaction_label_uninst (gs),
1766 spc, flags, false);
1768 if (gimple_transaction_label_over (gs))
1770 pp_string (buffer, " OVER=");
1771 dump_generic_node (buffer, gimple_transaction_label_over (gs),
1772 spc, flags, false);
1774 if (subcode)
1776 pp_string (buffer, " SUBCODE=[ ");
1777 if (subcode & GTMA_HAVE_ABORT)
1779 pp_string (buffer, "GTMA_HAVE_ABORT ");
1780 subcode &= ~GTMA_HAVE_ABORT;
1782 if (subcode & GTMA_HAVE_LOAD)
1784 pp_string (buffer, "GTMA_HAVE_LOAD ");
1785 subcode &= ~GTMA_HAVE_LOAD;
1787 if (subcode & GTMA_HAVE_STORE)
1789 pp_string (buffer, "GTMA_HAVE_STORE ");
1790 subcode &= ~GTMA_HAVE_STORE;
1792 if (subcode & GTMA_MAY_ENTER_IRREVOCABLE)
1794 pp_string (buffer, "GTMA_MAY_ENTER_IRREVOCABLE ");
1795 subcode &= ~GTMA_MAY_ENTER_IRREVOCABLE;
1797 if (subcode & GTMA_DOES_GO_IRREVOCABLE)
1799 pp_string (buffer, "GTMA_DOES_GO_IRREVOCABLE ");
1800 subcode &= ~GTMA_DOES_GO_IRREVOCABLE;
1802 if (subcode & GTMA_HAS_NO_INSTRUMENTATION)
1804 pp_string (buffer, "GTMA_HAS_NO_INSTRUMENTATION ");
1805 subcode &= ~GTMA_HAS_NO_INSTRUMENTATION;
1807 if (subcode)
1808 pp_printf (buffer, "0x%x ", subcode);
1809 pp_right_bracket (buffer);
1815 /* Dump a GIMPLE_ASM tuple on the pretty_printer BUFFER, SPC spaces of
1816 indent. FLAGS specifies details to show in the dump (see TDF_* in
1817 dumpfile.h). */
1819 static void
1820 dump_gimple_asm (pretty_printer *buffer, gasm *gs, int spc, int flags)
1822 unsigned int i, n, f, fields;
1824 if (flags & TDF_RAW)
1826 dump_gimple_fmt (buffer, spc, flags, "%G <%+STRING <%n%s%n>", gs,
1827 gimple_asm_string (gs));
1829 n = gimple_asm_noutputs (gs);
1830 if (n)
1832 newline_and_indent (buffer, spc + 2);
1833 pp_string (buffer, "OUTPUT: ");
1834 for (i = 0; i < n; i++)
1836 dump_generic_node (buffer, gimple_asm_output_op (gs, i),
1837 spc, flags, false);
1838 if (i < n - 1)
1839 pp_string (buffer, ", ");
1843 n = gimple_asm_ninputs (gs);
1844 if (n)
1846 newline_and_indent (buffer, spc + 2);
1847 pp_string (buffer, "INPUT: ");
1848 for (i = 0; i < n; i++)
1850 dump_generic_node (buffer, gimple_asm_input_op (gs, i),
1851 spc, flags, false);
1852 if (i < n - 1)
1853 pp_string (buffer, ", ");
1857 n = gimple_asm_nclobbers (gs);
1858 if (n)
1860 newline_and_indent (buffer, spc + 2);
1861 pp_string (buffer, "CLOBBER: ");
1862 for (i = 0; i < n; i++)
1864 dump_generic_node (buffer, gimple_asm_clobber_op (gs, i),
1865 spc, flags, false);
1866 if (i < n - 1)
1867 pp_string (buffer, ", ");
1871 n = gimple_asm_nlabels (gs);
1872 if (n)
1874 newline_and_indent (buffer, spc + 2);
1875 pp_string (buffer, "LABEL: ");
1876 for (i = 0; i < n; i++)
1878 dump_generic_node (buffer, gimple_asm_label_op (gs, i),
1879 spc, flags, false);
1880 if (i < n - 1)
1881 pp_string (buffer, ", ");
1885 newline_and_indent (buffer, spc);
1886 pp_greater (buffer);
1888 else
1890 pp_string (buffer, "__asm__");
1891 if (gimple_asm_volatile_p (gs))
1892 pp_string (buffer, " __volatile__");
1893 if (gimple_asm_nlabels (gs))
1894 pp_string (buffer, " goto");
1895 pp_string (buffer, "(\"");
1896 pp_string (buffer, gimple_asm_string (gs));
1897 pp_string (buffer, "\"");
1899 if (gimple_asm_nlabels (gs))
1900 fields = 4;
1901 else if (gimple_asm_nclobbers (gs))
1902 fields = 3;
1903 else if (gimple_asm_ninputs (gs))
1904 fields = 2;
1905 else if (gimple_asm_noutputs (gs))
1906 fields = 1;
1907 else
1908 fields = 0;
1910 for (f = 0; f < fields; ++f)
1912 pp_string (buffer, " : ");
1914 switch (f)
1916 case 0:
1917 n = gimple_asm_noutputs (gs);
1918 for (i = 0; i < n; i++)
1920 dump_generic_node (buffer, gimple_asm_output_op (gs, i),
1921 spc, flags, false);
1922 if (i < n - 1)
1923 pp_string (buffer, ", ");
1925 break;
1927 case 1:
1928 n = gimple_asm_ninputs (gs);
1929 for (i = 0; i < n; i++)
1931 dump_generic_node (buffer, gimple_asm_input_op (gs, i),
1932 spc, flags, false);
1933 if (i < n - 1)
1934 pp_string (buffer, ", ");
1936 break;
1938 case 2:
1939 n = gimple_asm_nclobbers (gs);
1940 for (i = 0; i < n; i++)
1942 dump_generic_node (buffer, gimple_asm_clobber_op (gs, i),
1943 spc, flags, false);
1944 if (i < n - 1)
1945 pp_string (buffer, ", ");
1947 break;
1949 case 3:
1950 n = gimple_asm_nlabels (gs);
1951 for (i = 0; i < n; i++)
1953 dump_generic_node (buffer, gimple_asm_label_op (gs, i),
1954 spc, flags, false);
1955 if (i < n - 1)
1956 pp_string (buffer, ", ");
1958 break;
1960 default:
1961 gcc_unreachable ();
1965 pp_string (buffer, ");");
1969 /* Dump ptr_info and range_info for NODE on pretty_printer BUFFER with
1970 SPC spaces of indent. */
1972 static void
1973 dump_ssaname_info (pretty_printer *buffer, tree node, int spc)
1975 if (TREE_CODE (node) != SSA_NAME)
1976 return;
1978 if (POINTER_TYPE_P (TREE_TYPE (node))
1979 && SSA_NAME_PTR_INFO (node))
1981 unsigned int align, misalign;
1982 struct ptr_info_def *pi = SSA_NAME_PTR_INFO (node);
1983 pp_string (buffer, "# PT = ");
1984 pp_points_to_solution (buffer, &pi->pt);
1985 newline_and_indent (buffer, spc);
1986 if (get_ptr_info_alignment (pi, &align, &misalign))
1988 pp_printf (buffer, "# ALIGN = %u, MISALIGN = %u", align, misalign);
1989 newline_and_indent (buffer, spc);
1993 if (!POINTER_TYPE_P (TREE_TYPE (node))
1994 && SSA_NAME_RANGE_INFO (node))
1996 wide_int min, max, nonzero_bits;
1997 value_range_type range_type = get_range_info (node, &min, &max);
1999 if (range_type == VR_VARYING)
2000 pp_printf (buffer, "# RANGE VR_VARYING");
2001 else if (range_type == VR_RANGE || range_type == VR_ANTI_RANGE)
2003 pp_printf (buffer, "# RANGE ");
2004 pp_printf (buffer, "%s[", range_type == VR_RANGE ? "" : "~");
2005 pp_wide_int (buffer, min, TYPE_SIGN (TREE_TYPE (node)));
2006 pp_printf (buffer, ", ");
2007 pp_wide_int (buffer, max, TYPE_SIGN (TREE_TYPE (node)));
2008 pp_printf (buffer, "]");
2010 nonzero_bits = get_nonzero_bits (node);
2011 if (nonzero_bits != -1)
2013 pp_string (buffer, " NONZERO ");
2014 pp_wide_int (buffer, nonzero_bits, UNSIGNED);
2016 newline_and_indent (buffer, spc);
2020 /* As dump_ssaname_info, but dump to FILE. */
2022 void
2023 dump_ssaname_info_to_file (FILE *file, tree node, int spc)
2025 pretty_printer buffer;
2026 pp_needs_newline (&buffer) = true;
2027 buffer.buffer->stream = file;
2028 dump_ssaname_info (&buffer, node, spc);
2029 pp_flush (&buffer);
2032 /* Dump a PHI node PHI. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1.
2033 The caller is responsible for calling pp_flush on BUFFER to finalize
2034 pretty printer. If COMMENT is true, print this after #. */
2036 static void
2037 dump_gimple_phi (pretty_printer *buffer, gphi *phi, int spc, bool comment,
2038 int flags)
2040 size_t i;
2041 tree lhs = gimple_phi_result (phi);
2043 if (flags & TDF_ALIAS)
2044 dump_ssaname_info (buffer, lhs, spc);
2046 if (comment)
2047 pp_string (buffer, "# ");
2049 if (flags & TDF_RAW)
2050 dump_gimple_fmt (buffer, spc, flags, "%G <%T, ", phi,
2051 gimple_phi_result (phi));
2052 else
2054 dump_generic_node (buffer, lhs, spc, flags, false);
2055 if (flags & TDF_GIMPLE)
2056 pp_string (buffer, " = __PHI (");
2057 else
2058 pp_string (buffer, " = PHI <");
2060 for (i = 0; i < gimple_phi_num_args (phi); i++)
2062 if ((flags & TDF_LINENO) && gimple_phi_arg_has_location (phi, i))
2063 dump_location (buffer, gimple_phi_arg_location (phi, i));
2064 if (flags & TDF_GIMPLE)
2066 basic_block src = gimple_phi_arg_edge (phi, i)->src;
2067 gimple *stmt = first_stmt (src);
2068 if (!stmt || gimple_code (stmt) != GIMPLE_LABEL)
2070 pp_string (buffer, "bb_");
2071 pp_decimal_int (buffer, src->index);
2073 else
2074 dump_generic_node (buffer, gimple_label_label (as_a <glabel *> (stmt)), 0, flags,
2075 false);
2076 pp_string (buffer, ": ");
2078 dump_generic_node (buffer, gimple_phi_arg_def (phi, i), spc, flags,
2079 false);
2080 if (! (flags & TDF_GIMPLE))
2082 pp_left_paren (buffer);
2083 pp_decimal_int (buffer, gimple_phi_arg_edge (phi, i)->src->index);
2084 pp_right_paren (buffer);
2086 if (i < gimple_phi_num_args (phi) - 1)
2087 pp_string (buffer, ", ");
2089 if (flags & TDF_GIMPLE)
2090 pp_string (buffer, ");");
2091 else
2092 pp_greater (buffer);
2096 /* Dump a GIMPLE_OMP_PARALLEL tuple on the pretty_printer BUFFER, SPC spaces
2097 of indent. FLAGS specifies details to show in the dump (see TDF_* in
2098 dumpfile.h). */
2100 static void
2101 dump_gimple_omp_parallel (pretty_printer *buffer, gomp_parallel *gs,
2102 int spc, int flags)
2104 if (flags & TDF_RAW)
2106 dump_gimple_fmt (buffer, spc, flags, "%G <%+BODY <%S>%nCLAUSES <", gs,
2107 gimple_omp_body (gs));
2108 dump_omp_clauses (buffer, gimple_omp_parallel_clauses (gs), spc, flags);
2109 dump_gimple_fmt (buffer, spc, flags, " >, %T, %T%n>",
2110 gimple_omp_parallel_child_fn (gs),
2111 gimple_omp_parallel_data_arg (gs));
2113 else
2115 gimple_seq body;
2116 pp_string (buffer, "#pragma omp parallel");
2117 dump_omp_clauses (buffer, gimple_omp_parallel_clauses (gs), spc, flags);
2118 if (gimple_omp_parallel_child_fn (gs))
2120 pp_string (buffer, " [child fn: ");
2121 dump_generic_node (buffer, gimple_omp_parallel_child_fn (gs),
2122 spc, flags, false);
2123 pp_string (buffer, " (");
2124 if (gimple_omp_parallel_data_arg (gs))
2125 dump_generic_node (buffer, gimple_omp_parallel_data_arg (gs),
2126 spc, flags, false);
2127 else
2128 pp_string (buffer, "???");
2129 pp_string (buffer, ")]");
2131 body = gimple_omp_body (gs);
2132 if (body && gimple_code (gimple_seq_first_stmt (body)) != GIMPLE_BIND)
2134 newline_and_indent (buffer, spc + 2);
2135 pp_left_brace (buffer);
2136 pp_newline (buffer);
2137 dump_gimple_seq (buffer, body, spc + 4, flags);
2138 newline_and_indent (buffer, spc + 2);
2139 pp_right_brace (buffer);
2141 else if (body)
2143 pp_newline (buffer);
2144 dump_gimple_seq (buffer, body, spc + 2, flags);
2150 /* Dump a GIMPLE_OMP_TASK tuple on the pretty_printer BUFFER, SPC spaces
2151 of indent. FLAGS specifies details to show in the dump (see TDF_* in
2152 dumpfile.h). */
2154 static void
2155 dump_gimple_omp_task (pretty_printer *buffer, gomp_task *gs, int spc,
2156 int flags)
2158 if (flags & TDF_RAW)
2160 dump_gimple_fmt (buffer, spc, flags, "%G <%+BODY <%S>%nCLAUSES <", gs,
2161 gimple_omp_body (gs));
2162 dump_omp_clauses (buffer, gimple_omp_task_clauses (gs), spc, flags);
2163 dump_gimple_fmt (buffer, spc, flags, " >, %T, %T, %T, %T, %T%n>",
2164 gimple_omp_task_child_fn (gs),
2165 gimple_omp_task_data_arg (gs),
2166 gimple_omp_task_copy_fn (gs),
2167 gimple_omp_task_arg_size (gs),
2168 gimple_omp_task_arg_size (gs));
2170 else
2172 gimple_seq body;
2173 if (gimple_omp_task_taskloop_p (gs))
2174 pp_string (buffer, "#pragma omp taskloop");
2175 else
2176 pp_string (buffer, "#pragma omp task");
2177 dump_omp_clauses (buffer, gimple_omp_task_clauses (gs), spc, flags);
2178 if (gimple_omp_task_child_fn (gs))
2180 pp_string (buffer, " [child fn: ");
2181 dump_generic_node (buffer, gimple_omp_task_child_fn (gs),
2182 spc, flags, false);
2183 pp_string (buffer, " (");
2184 if (gimple_omp_task_data_arg (gs))
2185 dump_generic_node (buffer, gimple_omp_task_data_arg (gs),
2186 spc, flags, false);
2187 else
2188 pp_string (buffer, "???");
2189 pp_string (buffer, ")]");
2191 body = gimple_omp_body (gs);
2192 if (body && gimple_code (gimple_seq_first_stmt (body)) != GIMPLE_BIND)
2194 newline_and_indent (buffer, spc + 2);
2195 pp_left_brace (buffer);
2196 pp_newline (buffer);
2197 dump_gimple_seq (buffer, body, spc + 4, flags);
2198 newline_and_indent (buffer, spc + 2);
2199 pp_right_brace (buffer);
2201 else if (body)
2203 pp_newline (buffer);
2204 dump_gimple_seq (buffer, body, spc + 2, flags);
2210 /* Dump a GIMPLE_OMP_ATOMIC_LOAD tuple on the pretty_printer BUFFER, SPC
2211 spaces of indent. FLAGS specifies details to show in the dump (see TDF_*
2212 in dumpfile.h). */
2214 static void
2215 dump_gimple_omp_atomic_load (pretty_printer *buffer, gomp_atomic_load *gs,
2216 int spc, int flags)
2218 if (flags & TDF_RAW)
2220 dump_gimple_fmt (buffer, spc, flags, "%G <%T, %T>", gs,
2221 gimple_omp_atomic_load_lhs (gs),
2222 gimple_omp_atomic_load_rhs (gs));
2224 else
2226 pp_string (buffer, "#pragma omp atomic_load");
2227 if (gimple_omp_atomic_seq_cst_p (gs))
2228 pp_string (buffer, " seq_cst");
2229 if (gimple_omp_atomic_need_value_p (gs))
2230 pp_string (buffer, " [needed]");
2231 newline_and_indent (buffer, spc + 2);
2232 dump_generic_node (buffer, gimple_omp_atomic_load_lhs (gs),
2233 spc, flags, false);
2234 pp_space (buffer);
2235 pp_equal (buffer);
2236 pp_space (buffer);
2237 pp_star (buffer);
2238 dump_generic_node (buffer, gimple_omp_atomic_load_rhs (gs),
2239 spc, flags, false);
2243 /* Dump a GIMPLE_OMP_ATOMIC_STORE tuple on the pretty_printer BUFFER, SPC
2244 spaces of indent. FLAGS specifies details to show in the dump (see TDF_*
2245 in dumpfile.h). */
2247 static void
2248 dump_gimple_omp_atomic_store (pretty_printer *buffer,
2249 gomp_atomic_store *gs, int spc, int flags)
2251 if (flags & TDF_RAW)
2253 dump_gimple_fmt (buffer, spc, flags, "%G <%T>", gs,
2254 gimple_omp_atomic_store_val (gs));
2256 else
2258 pp_string (buffer, "#pragma omp atomic_store ");
2259 if (gimple_omp_atomic_seq_cst_p (gs))
2260 pp_string (buffer, "seq_cst ");
2261 if (gimple_omp_atomic_need_value_p (gs))
2262 pp_string (buffer, "[needed] ");
2263 pp_left_paren (buffer);
2264 dump_generic_node (buffer, gimple_omp_atomic_store_val (gs),
2265 spc, flags, false);
2266 pp_right_paren (buffer);
2271 /* Dump all the memory operands for statement GS. BUFFER, SPC and
2272 FLAGS are as in pp_gimple_stmt_1. */
2274 static void
2275 dump_gimple_mem_ops (pretty_printer *buffer, gimple *gs, int spc, int flags)
2277 tree vdef = gimple_vdef (gs);
2278 tree vuse = gimple_vuse (gs);
2280 if (vdef != NULL_TREE)
2282 pp_string (buffer, "# ");
2283 dump_generic_node (buffer, vdef, spc + 2, flags, false);
2284 pp_string (buffer, " = VDEF <");
2285 dump_generic_node (buffer, vuse, spc + 2, flags, false);
2286 pp_greater (buffer);
2287 newline_and_indent (buffer, spc);
2289 else if (vuse != NULL_TREE)
2291 pp_string (buffer, "# VUSE <");
2292 dump_generic_node (buffer, vuse, spc + 2, flags, false);
2293 pp_greater (buffer);
2294 newline_and_indent (buffer, spc);
2299 /* Print the gimple statement GS on the pretty printer BUFFER, SPC
2300 spaces of indent. FLAGS specifies details to show in the dump (see
2301 TDF_* in dumpfile.h). The caller is responsible for calling
2302 pp_flush on BUFFER to finalize the pretty printer. */
2304 void
2305 pp_gimple_stmt_1 (pretty_printer *buffer, gimple *gs, int spc, int flags)
2307 if (!gs)
2308 return;
2310 if (flags & TDF_STMTADDR)
2311 pp_printf (buffer, "<&%p> ", (void *) gs);
2313 if ((flags & TDF_LINENO) && gimple_has_location (gs))
2314 dump_location (buffer, gimple_location (gs));
2316 if (flags & TDF_EH)
2318 int lp_nr = lookup_stmt_eh_lp (gs);
2319 if (lp_nr > 0)
2320 pp_printf (buffer, "[LP %d] ", lp_nr);
2321 else if (lp_nr < 0)
2322 pp_printf (buffer, "[MNT %d] ", -lp_nr);
2325 if ((flags & (TDF_VOPS|TDF_MEMSYMS))
2326 && gimple_has_mem_ops (gs))
2327 dump_gimple_mem_ops (buffer, gs, spc, flags);
2329 if (gimple_has_lhs (gs)
2330 && (flags & TDF_ALIAS))
2331 dump_ssaname_info (buffer, gimple_get_lhs (gs), spc);
2333 switch (gimple_code (gs))
2335 case GIMPLE_ASM:
2336 dump_gimple_asm (buffer, as_a <gasm *> (gs), spc, flags);
2337 break;
2339 case GIMPLE_ASSIGN:
2340 dump_gimple_assign (buffer, as_a <gassign *> (gs), spc, flags);
2341 break;
2343 case GIMPLE_BIND:
2344 dump_gimple_bind (buffer, as_a <gbind *> (gs), spc, flags);
2345 break;
2347 case GIMPLE_CALL:
2348 dump_gimple_call (buffer, as_a <gcall *> (gs), spc, flags);
2349 break;
2351 case GIMPLE_COND:
2352 dump_gimple_cond (buffer, as_a <gcond *> (gs), spc, flags);
2353 break;
2355 case GIMPLE_LABEL:
2356 dump_gimple_label (buffer, as_a <glabel *> (gs), spc, flags);
2357 break;
2359 case GIMPLE_GOTO:
2360 dump_gimple_goto (buffer, as_a <ggoto *> (gs), spc, flags);
2361 break;
2363 case GIMPLE_NOP:
2364 pp_string (buffer, "GIMPLE_NOP");
2365 break;
2367 case GIMPLE_RETURN:
2368 dump_gimple_return (buffer, as_a <greturn *> (gs), spc, flags);
2369 break;
2371 case GIMPLE_SWITCH:
2372 dump_gimple_switch (buffer, as_a <gswitch *> (gs), spc, flags);
2373 break;
2375 case GIMPLE_TRY:
2376 dump_gimple_try (buffer, as_a <gtry *> (gs), spc, flags);
2377 break;
2379 case GIMPLE_PHI:
2380 dump_gimple_phi (buffer, as_a <gphi *> (gs), spc, false, flags);
2381 break;
2383 case GIMPLE_OMP_PARALLEL:
2384 dump_gimple_omp_parallel (buffer, as_a <gomp_parallel *> (gs), spc,
2385 flags);
2386 break;
2388 case GIMPLE_OMP_TASK:
2389 dump_gimple_omp_task (buffer, as_a <gomp_task *> (gs), spc, flags);
2390 break;
2392 case GIMPLE_OMP_ATOMIC_LOAD:
2393 dump_gimple_omp_atomic_load (buffer, as_a <gomp_atomic_load *> (gs),
2394 spc, flags);
2395 break;
2397 case GIMPLE_OMP_ATOMIC_STORE:
2398 dump_gimple_omp_atomic_store (buffer,
2399 as_a <gomp_atomic_store *> (gs),
2400 spc, flags);
2401 break;
2403 case GIMPLE_OMP_FOR:
2404 dump_gimple_omp_for (buffer, as_a <gomp_for *> (gs), spc, flags);
2405 break;
2407 case GIMPLE_OMP_CONTINUE:
2408 dump_gimple_omp_continue (buffer, as_a <gomp_continue *> (gs), spc,
2409 flags);
2410 break;
2412 case GIMPLE_OMP_SINGLE:
2413 dump_gimple_omp_single (buffer, as_a <gomp_single *> (gs), spc,
2414 flags);
2415 break;
2417 case GIMPLE_OMP_TARGET:
2418 dump_gimple_omp_target (buffer, as_a <gomp_target *> (gs), spc,
2419 flags);
2420 break;
2422 case GIMPLE_OMP_TEAMS:
2423 dump_gimple_omp_teams (buffer, as_a <gomp_teams *> (gs), spc,
2424 flags);
2425 break;
2427 case GIMPLE_OMP_RETURN:
2428 dump_gimple_omp_return (buffer, gs, spc, flags);
2429 break;
2431 case GIMPLE_OMP_SECTIONS:
2432 dump_gimple_omp_sections (buffer, as_a <gomp_sections *> (gs),
2433 spc, flags);
2434 break;
2436 case GIMPLE_OMP_SECTIONS_SWITCH:
2437 pp_string (buffer, "GIMPLE_SECTIONS_SWITCH");
2438 break;
2440 case GIMPLE_OMP_MASTER:
2441 case GIMPLE_OMP_TASKGROUP:
2442 case GIMPLE_OMP_SECTION:
2443 case GIMPLE_OMP_GRID_BODY:
2444 dump_gimple_omp_block (buffer, gs, spc, flags);
2445 break;
2447 case GIMPLE_OMP_ORDERED:
2448 dump_gimple_omp_ordered (buffer, as_a <gomp_ordered *> (gs), spc,
2449 flags);
2450 break;
2452 case GIMPLE_OMP_CRITICAL:
2453 dump_gimple_omp_critical (buffer, as_a <gomp_critical *> (gs), spc,
2454 flags);
2455 break;
2457 case GIMPLE_CATCH:
2458 dump_gimple_catch (buffer, as_a <gcatch *> (gs), spc, flags);
2459 break;
2461 case GIMPLE_EH_FILTER:
2462 dump_gimple_eh_filter (buffer, as_a <geh_filter *> (gs), spc, flags);
2463 break;
2465 case GIMPLE_EH_MUST_NOT_THROW:
2466 dump_gimple_eh_must_not_throw (buffer,
2467 as_a <geh_mnt *> (gs),
2468 spc, flags);
2469 break;
2471 case GIMPLE_EH_ELSE:
2472 dump_gimple_eh_else (buffer, as_a <geh_else *> (gs), spc, flags);
2473 break;
2475 case GIMPLE_RESX:
2476 dump_gimple_resx (buffer, as_a <gresx *> (gs), spc, flags);
2477 break;
2479 case GIMPLE_EH_DISPATCH:
2480 dump_gimple_eh_dispatch (buffer, as_a <geh_dispatch *> (gs), spc,
2481 flags);
2482 break;
2484 case GIMPLE_DEBUG:
2485 dump_gimple_debug (buffer, as_a <gdebug *> (gs), spc, flags);
2486 break;
2488 case GIMPLE_PREDICT:
2489 pp_string (buffer, "// predicted ");
2490 if (gimple_predict_outcome (gs))
2491 pp_string (buffer, "likely by ");
2492 else
2493 pp_string (buffer, "unlikely by ");
2494 pp_string (buffer, predictor_name (gimple_predict_predictor (gs)));
2495 pp_string (buffer, " predictor.");
2496 break;
2498 case GIMPLE_TRANSACTION:
2499 dump_gimple_transaction (buffer, as_a <gtransaction *> (gs), spc,
2500 flags);
2501 break;
2503 default:
2504 GIMPLE_NIY;
2509 /* Dumps header of basic block BB to OUTF indented by INDENT
2510 spaces and details described by flags. */
2512 static void
2513 dump_gimple_bb_header (FILE *outf, basic_block bb, int indent, int flags)
2515 if (flags & TDF_BLOCKS)
2517 if (flags & TDF_LINENO)
2519 gimple_stmt_iterator gsi;
2521 if (flags & TDF_COMMENT)
2522 fputs (";; ", outf);
2524 for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
2525 if (!is_gimple_debug (gsi_stmt (gsi))
2526 && get_lineno (gsi_stmt (gsi)) != UNKNOWN_LOCATION)
2528 fprintf (outf, "%*sstarting at line %d",
2529 indent, "", get_lineno (gsi_stmt (gsi)));
2530 break;
2532 if (bb->discriminator)
2533 fprintf (outf, ", discriminator %i", bb->discriminator);
2534 fputc ('\n', outf);
2537 else
2539 gimple *stmt = first_stmt (bb);
2540 if (!stmt || gimple_code (stmt) != GIMPLE_LABEL)
2542 if (flags & TDF_GIMPLE)
2543 fprintf (outf, "%*sbb_%d:\n", indent, "", bb->index);
2544 else
2545 fprintf (outf, "%*s<bb %d>:\n", indent, "", bb->index);
2551 /* Dumps end of basic block BB to buffer BUFFER indented by INDENT
2552 spaces. */
2554 static void
2555 dump_gimple_bb_footer (FILE *outf ATTRIBUTE_UNUSED,
2556 basic_block bb ATTRIBUTE_UNUSED,
2557 int indent ATTRIBUTE_UNUSED,
2558 int flags ATTRIBUTE_UNUSED)
2560 /* There is currently no GIMPLE-specific basic block info to dump. */
2561 return;
2565 /* Dump PHI nodes of basic block BB to BUFFER with details described
2566 by FLAGS and indented by INDENT spaces. */
2568 static void
2569 dump_phi_nodes (pretty_printer *buffer, basic_block bb, int indent, int flags)
2571 gphi_iterator i;
2573 for (i = gsi_start_phis (bb); !gsi_end_p (i); gsi_next (&i))
2575 gphi *phi = i.phi ();
2576 if (!virtual_operand_p (gimple_phi_result (phi)) || (flags & TDF_VOPS))
2578 INDENT (indent);
2579 dump_gimple_phi (buffer, phi, indent,
2580 (flags & TDF_GIMPLE) ? false : true, flags);
2581 pp_newline (buffer);
2587 /* Dump jump to basic block BB that is represented implicitly in the cfg
2588 to BUFFER. */
2590 static void
2591 pp_cfg_jump (pretty_printer *buffer, basic_block bb, int flags)
2593 if (flags & TDF_GIMPLE)
2595 pp_string (buffer, "goto bb_");
2596 pp_decimal_int (buffer, bb->index);
2597 pp_semicolon (buffer);
2599 else
2601 gimple *stmt = first_stmt (bb);
2602 pp_string (buffer, "goto <bb ");
2603 pp_decimal_int (buffer, bb->index);
2604 pp_greater (buffer);
2605 if (stmt && gimple_code (stmt) == GIMPLE_LABEL)
2607 pp_string (buffer, " (");
2608 dump_generic_node (buffer,
2609 gimple_label_label (as_a <glabel *> (stmt)),
2610 0, 0, false);
2611 pp_right_paren (buffer);
2612 pp_semicolon (buffer);
2614 else
2615 pp_semicolon (buffer);
2620 /* Dump edges represented implicitly in basic block BB to BUFFER, indented
2621 by INDENT spaces, with details given by FLAGS. */
2623 static void
2624 dump_implicit_edges (pretty_printer *buffer, basic_block bb, int indent,
2625 int flags)
2627 edge e;
2628 gimple *stmt;
2630 stmt = last_stmt (bb);
2632 if (stmt && gimple_code (stmt) == GIMPLE_COND)
2634 edge true_edge, false_edge;
2636 /* When we are emitting the code or changing CFG, it is possible that
2637 the edges are not yet created. When we are using debug_bb in such
2638 a situation, we do not want it to crash. */
2639 if (EDGE_COUNT (bb->succs) != 2)
2640 return;
2641 extract_true_false_edges_from_block (bb, &true_edge, &false_edge);
2643 INDENT (indent + 2);
2644 pp_cfg_jump (buffer, true_edge->dest, flags);
2645 newline_and_indent (buffer, indent);
2646 pp_string (buffer, "else");
2647 newline_and_indent (buffer, indent + 2);
2648 pp_cfg_jump (buffer, false_edge->dest, flags);
2649 pp_newline (buffer);
2650 return;
2653 /* If there is a fallthru edge, we may need to add an artificial
2654 goto to the dump. */
2655 e = find_fallthru_edge (bb->succs);
2657 if (e && e->dest != bb->next_bb)
2659 INDENT (indent);
2661 if ((flags & TDF_LINENO)
2662 && e->goto_locus != UNKNOWN_LOCATION)
2663 dump_location (buffer, e->goto_locus);
2665 pp_cfg_jump (buffer, e->dest, flags);
2666 pp_newline (buffer);
2671 /* Dumps basic block BB to buffer BUFFER with details described by FLAGS and
2672 indented by INDENT spaces. */
2674 static void
2675 gimple_dump_bb_buff (pretty_printer *buffer, basic_block bb, int indent,
2676 int flags)
2678 gimple_stmt_iterator gsi;
2679 gimple *stmt;
2680 int label_indent = indent - 2;
2682 if (label_indent < 0)
2683 label_indent = 0;
2685 dump_phi_nodes (buffer, bb, indent, flags);
2687 for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
2689 int curr_indent;
2691 stmt = gsi_stmt (gsi);
2693 curr_indent = gimple_code (stmt) == GIMPLE_LABEL ? label_indent : indent;
2695 INDENT (curr_indent);
2696 pp_gimple_stmt_1 (buffer, stmt, curr_indent, flags);
2697 pp_newline_and_flush (buffer);
2698 gcc_checking_assert (DECL_STRUCT_FUNCTION (current_function_decl));
2699 dump_histograms_for_stmt (DECL_STRUCT_FUNCTION (current_function_decl),
2700 pp_buffer (buffer)->stream, stmt);
2703 dump_implicit_edges (buffer, bb, indent, flags);
2704 pp_flush (buffer);
2708 /* Dumps basic block BB to FILE with details described by FLAGS and
2709 indented by INDENT spaces. */
2711 void
2712 gimple_dump_bb (FILE *file, basic_block bb, int indent, int flags)
2714 dump_gimple_bb_header (file, bb, indent, flags);
2715 if (bb->index >= NUM_FIXED_BLOCKS)
2717 pretty_printer buffer;
2718 pp_needs_newline (&buffer) = true;
2719 buffer.buffer->stream = file;
2720 gimple_dump_bb_buff (&buffer, bb, indent, flags);
2722 dump_gimple_bb_footer (file, bb, indent, flags);
2725 /* Dumps basic block BB to pretty-printer PP with default dump flags and
2726 no indentation, for use as a label of a DOT graph record-node.
2727 ??? Should just use gimple_dump_bb_buff here, except that value profiling
2728 histogram dumping doesn't know about pretty-printers. */
2730 void
2731 gimple_dump_bb_for_graph (pretty_printer *pp, basic_block bb)
2733 pp_printf (pp, "<bb %d>:\n", bb->index);
2734 pp_write_text_as_dot_label_to_stream (pp, /*for_record=*/true);
2736 for (gphi_iterator gsi = gsi_start_phis (bb); !gsi_end_p (gsi);
2737 gsi_next (&gsi))
2739 gphi *phi = gsi.phi ();
2740 if (!virtual_operand_p (gimple_phi_result (phi))
2741 || (dump_flags & TDF_VOPS))
2743 pp_bar (pp);
2744 pp_write_text_to_stream (pp);
2745 pp_string (pp, "# ");
2746 pp_gimple_stmt_1 (pp, phi, 0, dump_flags);
2747 pp_newline (pp);
2748 pp_write_text_as_dot_label_to_stream (pp, /*for_record=*/true);
2752 for (gimple_stmt_iterator gsi = gsi_start_bb (bb); !gsi_end_p (gsi);
2753 gsi_next (&gsi))
2755 gimple *stmt = gsi_stmt (gsi);
2756 pp_bar (pp);
2757 pp_write_text_to_stream (pp);
2758 pp_gimple_stmt_1 (pp, stmt, 0, dump_flags);
2759 pp_newline (pp);
2760 pp_write_text_as_dot_label_to_stream (pp, /*for_record=*/true);
2762 dump_implicit_edges (pp, bb, 0, dump_flags);
2763 pp_write_text_as_dot_label_to_stream (pp, /*for_record=*/true);