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
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
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/>. */
24 #include "coretypes.h"
28 #include "gimple-predict.h"
31 #include "gimple-pretty-print.h"
32 #include "internal-fn.h"
34 #include "gimple-iterator.h"
36 #include "dumpfile.h" /* for dump_flags */
37 #include "value-prof.h"
38 #include "trans-mem.h"
41 #define INDENT(SPACE) \
42 do { int i; for (i = 0; i < SPACE; i++) pp_space (buffer); } while (0)
44 #define GIMPLE_NIY do_niy (buffer,gs)
46 /* Try to print on BUFFER a default message for the unrecognized
47 gimple statement GS. */
50 do_niy (pretty_printer *buffer, gimple *gs)
52 pp_printf (buffer, "<<< Unknown GIMPLE statement: %s >>>\n",
53 gimple_code_name[(int) gimple_code (gs)]);
57 /* Emit a newline and SPC indentation spaces to BUFFER. */
60 newline_and_indent (pretty_printer *buffer, int spc)
67 /* Print the GIMPLE statement GS on stderr. */
70 debug_gimple_stmt (gimple *gs)
72 print_gimple_stmt (stderr, gs, 0, TDF_VOPS|TDF_MEMSYMS);
76 /* Print GIMPLE statement G to FILE using SPC indentation spaces and
77 FLAGS as in pp_gimple_stmt_1. */
80 print_gimple_stmt (FILE *file, gimple *g, int spc, int flags)
82 pretty_printer buffer;
83 pp_needs_newline (&buffer) = true;
84 buffer.buffer->stream = file;
85 pp_gimple_stmt_1 (&buffer, g, spc, flags);
86 pp_newline_and_flush (&buffer);
92 print_gimple_stmt (stderr, &ref, 0, 0);
101 fprintf (stderr, "<nil>\n");
105 /* Print GIMPLE statement G to FILE using SPC indentation spaces and
106 FLAGS as in pp_gimple_stmt_1. Print only the right-hand side
110 print_gimple_expr (FILE *file, gimple *g, int spc, int flags)
112 flags |= TDF_RHS_ONLY;
113 pretty_printer buffer;
114 pp_needs_newline (&buffer) = true;
115 buffer.buffer->stream = file;
116 pp_gimple_stmt_1 (&buffer, g, spc, flags);
121 /* Print the GIMPLE sequence SEQ on BUFFER using SPC indentation
122 spaces and FLAGS as in pp_gimple_stmt_1.
123 The caller is responsible for calling pp_flush on BUFFER to finalize
124 the pretty printer. */
127 dump_gimple_seq (pretty_printer *buffer, gimple_seq seq, int spc, int flags)
129 gimple_stmt_iterator i;
131 for (i = gsi_start (seq); !gsi_end_p (i); gsi_next (&i))
133 gimple *gs = gsi_stmt (i);
135 pp_gimple_stmt_1 (buffer, gs, spc, flags);
136 if (!gsi_one_before_end_p (i))
142 /* Print GIMPLE sequence SEQ to FILE using SPC indentation spaces and
143 FLAGS as in pp_gimple_stmt_1. */
146 print_gimple_seq (FILE *file, gimple_seq seq, int spc, int flags)
148 pretty_printer buffer;
149 pp_needs_newline (&buffer) = true;
150 buffer.buffer->stream = file;
151 dump_gimple_seq (&buffer, seq, spc, flags);
152 pp_newline_and_flush (&buffer);
156 /* Print the GIMPLE sequence SEQ on stderr. */
159 debug_gimple_seq (gimple_seq seq)
161 print_gimple_seq (stderr, seq, 0, TDF_VOPS|TDF_MEMSYMS);
165 /* A simple helper to pretty-print some of the gimple tuples in the printf
166 style. The format modifiers are preceded by '%' and are:
167 'G' - outputs a string corresponding to the code of the given gimple,
168 'S' - outputs a gimple_seq with indent of spc + 2,
169 'T' - outputs the tree t,
170 'd' - outputs an int as a decimal,
171 's' - outputs a string,
172 'n' - outputs a newline,
173 'x' - outputs an int as hexadecimal,
174 '+' - increases indent by 2 then outputs a newline,
175 '-' - decreases indent by 2 then outputs a newline. */
178 dump_gimple_fmt (pretty_printer *buffer, int spc, int flags,
179 const char *fmt, ...)
185 va_start (args, fmt);
186 for (c = fmt; *c; c++)
196 g = va_arg (args, gimple *);
197 tmp = gimple_code_name[gimple_code (g)];
198 pp_string (buffer, tmp);
202 seq = va_arg (args, gimple_seq);
204 dump_gimple_seq (buffer, seq, spc + 2, flags);
205 newline_and_indent (buffer, spc);
209 t = va_arg (args, tree);
211 pp_string (buffer, "NULL");
213 dump_generic_node (buffer, t, spc, flags, false);
217 pp_decimal_int (buffer, va_arg (args, int));
221 pp_string (buffer, va_arg (args, char *));
225 newline_and_indent (buffer, spc);
229 pp_scalar (buffer, "%x", va_arg (args, int));
234 newline_and_indent (buffer, spc);
239 newline_and_indent (buffer, spc);
247 pp_character (buffer, *c);
253 /* Helper for dump_gimple_assign. Print the unary RHS of the
254 assignment GS. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. */
257 dump_unary_rhs (pretty_printer *buffer, gassign *gs, int spc, int flags)
259 enum tree_code rhs_code = gimple_assign_rhs_code (gs);
260 tree lhs = gimple_assign_lhs (gs);
261 tree rhs = gimple_assign_rhs1 (gs);
265 case VIEW_CONVERT_EXPR:
267 dump_generic_node (buffer, rhs, spc, flags, false);
270 case FIXED_CONVERT_EXPR:
271 case ADDR_SPACE_CONVERT_EXPR:
275 pp_left_paren (buffer);
276 dump_generic_node (buffer, TREE_TYPE (lhs), spc, flags, false);
277 pp_string (buffer, ") ");
278 if (op_prio (rhs) < op_code_prio (rhs_code))
280 pp_left_paren (buffer);
281 dump_generic_node (buffer, rhs, spc, flags, false);
282 pp_right_paren (buffer);
285 dump_generic_node (buffer, rhs, spc, flags, false);
289 pp_string (buffer, "((");
290 dump_generic_node (buffer, rhs, spc, flags, false);
291 pp_string (buffer, "))");
295 pp_string (buffer, "ABS_EXPR <");
296 dump_generic_node (buffer, rhs, spc, flags, false);
301 if (TREE_CODE_CLASS (rhs_code) == tcc_declaration
302 || TREE_CODE_CLASS (rhs_code) == tcc_constant
303 || TREE_CODE_CLASS (rhs_code) == tcc_reference
304 || rhs_code == SSA_NAME
305 || rhs_code == ADDR_EXPR
306 || rhs_code == CONSTRUCTOR)
308 dump_generic_node (buffer, rhs, spc, flags, false);
311 else if (rhs_code == BIT_NOT_EXPR)
312 pp_complement (buffer);
313 else if (rhs_code == TRUTH_NOT_EXPR)
314 pp_exclamation (buffer);
315 else if (rhs_code == NEGATE_EXPR)
319 pp_left_bracket (buffer);
320 pp_string (buffer, get_tree_code_name (rhs_code));
321 pp_string (buffer, "] ");
324 if (op_prio (rhs) < op_code_prio (rhs_code))
326 pp_left_paren (buffer);
327 dump_generic_node (buffer, rhs, spc, flags, false);
328 pp_right_paren (buffer);
331 dump_generic_node (buffer, rhs, spc, flags, false);
337 /* Helper for dump_gimple_assign. Print the binary RHS of the
338 assignment GS. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. */
341 dump_binary_rhs (pretty_printer *buffer, gassign *gs, int spc, int flags)
344 enum tree_code code = gimple_assign_rhs_code (gs);
350 case VEC_WIDEN_MULT_HI_EXPR:
351 case VEC_WIDEN_MULT_LO_EXPR:
352 case VEC_WIDEN_MULT_EVEN_EXPR:
353 case VEC_WIDEN_MULT_ODD_EXPR:
354 case VEC_PACK_TRUNC_EXPR:
355 case VEC_PACK_SAT_EXPR:
356 case VEC_PACK_FIX_TRUNC_EXPR:
357 case VEC_WIDEN_LSHIFT_HI_EXPR:
358 case VEC_WIDEN_LSHIFT_LO_EXPR:
359 for (p = get_tree_code_name (code); *p; p++)
360 pp_character (buffer, TOUPPER (*p));
361 pp_string (buffer, " <");
362 dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags, false);
363 pp_string (buffer, ", ");
364 dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags, false);
369 if (op_prio (gimple_assign_rhs1 (gs)) <= op_code_prio (code))
371 pp_left_paren (buffer);
372 dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags,
374 pp_right_paren (buffer);
377 dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags, false);
379 pp_string (buffer, op_symbol_code (gimple_assign_rhs_code (gs)));
381 if (op_prio (gimple_assign_rhs2 (gs)) <= op_code_prio (code))
383 pp_left_paren (buffer);
384 dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags,
386 pp_right_paren (buffer);
389 dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags, false);
393 /* Helper for dump_gimple_assign. Print the ternary RHS of the
394 assignment GS. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. */
397 dump_ternary_rhs (pretty_printer *buffer, gassign *gs, int spc, int flags)
400 enum tree_code code = gimple_assign_rhs_code (gs);
403 case WIDEN_MULT_PLUS_EXPR:
404 case WIDEN_MULT_MINUS_EXPR:
405 for (p = get_tree_code_name (code); *p; p++)
406 pp_character (buffer, TOUPPER (*p));
407 pp_string (buffer, " <");
408 dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags, false);
409 pp_string (buffer, ", ");
410 dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags, false);
411 pp_string (buffer, ", ");
412 dump_generic_node (buffer, gimple_assign_rhs3 (gs), spc, flags, false);
417 dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags, false);
418 pp_string (buffer, " * ");
419 dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags, false);
420 pp_string (buffer, " + ");
421 dump_generic_node (buffer, gimple_assign_rhs3 (gs), spc, flags, false);
425 pp_string (buffer, "DOT_PROD_EXPR <");
426 dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags, false);
427 pp_string (buffer, ", ");
428 dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags, false);
429 pp_string (buffer, ", ");
430 dump_generic_node (buffer, gimple_assign_rhs3 (gs), spc, flags, false);
435 pp_string (buffer, "SAD_EXPR <");
436 dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags, false);
437 pp_string (buffer, ", ");
438 dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags, false);
439 pp_string (buffer, ", ");
440 dump_generic_node (buffer, gimple_assign_rhs3 (gs), spc, flags, false);
445 pp_string (buffer, "VEC_PERM_EXPR <");
446 dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags, false);
447 pp_string (buffer, ", ");
448 dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags, false);
449 pp_string (buffer, ", ");
450 dump_generic_node (buffer, gimple_assign_rhs3 (gs), spc, flags, false);
454 case REALIGN_LOAD_EXPR:
455 pp_string (buffer, "REALIGN_LOAD <");
456 dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags, false);
457 pp_string (buffer, ", ");
458 dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags, false);
459 pp_string (buffer, ", ");
460 dump_generic_node (buffer, gimple_assign_rhs3 (gs), spc, flags, false);
465 dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags, false);
466 pp_string (buffer, " ? ");
467 dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags, false);
468 pp_string (buffer, " : ");
469 dump_generic_node (buffer, gimple_assign_rhs3 (gs), spc, flags, false);
473 pp_string (buffer, "VEC_COND_EXPR <");
474 dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags, false);
475 pp_string (buffer, ", ");
476 dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags, false);
477 pp_string (buffer, ", ");
478 dump_generic_node (buffer, gimple_assign_rhs3 (gs), spc, flags, false);
488 /* Dump the gimple assignment GS. BUFFER, SPC and FLAGS are as in
492 dump_gimple_assign (pretty_printer *buffer, gassign *gs, int spc, int flags)
499 switch (gimple_num_ops (gs))
502 arg3 = gimple_assign_rhs3 (gs);
505 arg2 = gimple_assign_rhs2 (gs);
508 arg1 = gimple_assign_rhs1 (gs);
514 dump_gimple_fmt (buffer, spc, flags, "%G <%s, %T, %T, %T, %T>", gs,
515 get_tree_code_name (gimple_assign_rhs_code (gs)),
516 gimple_assign_lhs (gs), arg1, arg2, arg3);
520 if (!(flags & TDF_RHS_ONLY))
522 dump_generic_node (buffer, gimple_assign_lhs (gs), spc, flags, false);
526 if (gimple_assign_nontemporal_move_p (gs))
527 pp_string (buffer, "{nt}");
529 if (gimple_has_volatile_ops (gs))
530 pp_string (buffer, "{v}");
535 if (gimple_num_ops (gs) == 2)
536 dump_unary_rhs (buffer, gs, spc, flags);
537 else if (gimple_num_ops (gs) == 3)
538 dump_binary_rhs (buffer, gs, spc, flags);
539 else if (gimple_num_ops (gs) == 4)
540 dump_ternary_rhs (buffer, gs, spc, flags);
543 if (!(flags & TDF_RHS_ONLY))
544 pp_semicolon (buffer);
549 /* Dump the return statement GS. BUFFER, SPC and FLAGS are as in
553 dump_gimple_return (pretty_printer *buffer, greturn *gs, int spc, int flags)
557 t = gimple_return_retval (gs);
558 t2 = gimple_return_retbnd (gs);
560 dump_gimple_fmt (buffer, spc, flags, "%G <%T %T>", gs, t, t2);
563 pp_string (buffer, "return");
567 dump_generic_node (buffer, t, spc, flags, false);
571 pp_string (buffer, ", ");
572 dump_generic_node (buffer, t2, spc, flags, false);
574 pp_semicolon (buffer);
579 /* Dump the call arguments for a gimple call. BUFFER, FLAGS are as in
583 dump_gimple_call_args (pretty_printer *buffer, gcall *gs, int flags)
587 /* Pretty print first arg to certain internal fns. */
588 if (gimple_call_internal_p (gs))
590 const char *const *enums = NULL;
593 switch (gimple_call_internal_fn (gs))
597 static const char *const asan_mark_args[] = {IFN_ASAN_MARK_FLAGS};
599 enums = asan_mark_args;
600 limit = ARRAY_SIZE (asan_mark_args);
608 tree arg0 = gimple_call_arg (gs, 0);
611 if (TREE_CODE (arg0) == INTEGER_CST
612 && tree_fits_shwi_p (arg0)
613 && (v = tree_to_shwi (arg0)) >= 0 && v < limit)
616 pp_string (buffer, enums[v]);
622 for (; i < gimple_call_num_args (gs); i++)
625 pp_string (buffer, ", ");
626 dump_generic_node (buffer, gimple_call_arg (gs, i), 0, flags, false);
629 if (gimple_call_va_arg_pack_p (gs))
632 pp_string (buffer, ", ");
634 pp_string (buffer, "__builtin_va_arg_pack ()");
638 /* Dump the points-to solution *PT to BUFFER. */
641 pp_points_to_solution (pretty_printer *buffer, struct pt_solution *pt)
645 pp_string (buffer, "anything ");
649 pp_string (buffer, "nonlocal ");
651 pp_string (buffer, "escaped ");
653 pp_string (buffer, "unit-escaped ");
655 pp_string (buffer, "null ");
657 && !bitmap_empty_p (pt->vars))
661 pp_string (buffer, "{ ");
662 EXECUTE_IF_SET_IN_BITMAP (pt->vars, 0, i, bi)
664 pp_string (buffer, "D.");
665 pp_decimal_int (buffer, i);
668 pp_right_brace (buffer);
669 if (pt->vars_contains_nonlocal
670 && pt->vars_contains_escaped_heap)
671 pp_string (buffer, " (nonlocal, escaped heap)");
672 else if (pt->vars_contains_nonlocal
673 && pt->vars_contains_escaped)
674 pp_string (buffer, " (nonlocal, escaped)");
675 else if (pt->vars_contains_nonlocal)
676 pp_string (buffer, " (nonlocal)");
677 else if (pt->vars_contains_escaped_heap)
678 pp_string (buffer, " (escaped heap)");
679 else if (pt->vars_contains_escaped)
680 pp_string (buffer, " (escaped)");
684 /* Dump the call statement GS. BUFFER, SPC and FLAGS are as in
688 dump_gimple_call (pretty_printer *buffer, gcall *gs, int spc, int flags)
690 tree lhs = gimple_call_lhs (gs);
691 tree fn = gimple_call_fn (gs);
693 if (flags & TDF_ALIAS)
695 struct pt_solution *pt;
696 pt = gimple_call_use_set (gs);
697 if (!pt_solution_empty_p (pt))
699 pp_string (buffer, "# USE = ");
700 pp_points_to_solution (buffer, pt);
701 newline_and_indent (buffer, spc);
703 pt = gimple_call_clobber_set (gs);
704 if (!pt_solution_empty_p (pt))
706 pp_string (buffer, "# CLB = ");
707 pp_points_to_solution (buffer, pt);
708 newline_and_indent (buffer, spc);
714 if (gimple_call_internal_p (gs))
715 dump_gimple_fmt (buffer, spc, flags, "%G <%s, %T", gs,
716 internal_fn_name (gimple_call_internal_fn (gs)), lhs);
718 dump_gimple_fmt (buffer, spc, flags, "%G <%T, %T", gs, fn, lhs);
719 if (gimple_call_num_args (gs) > 0)
721 pp_string (buffer, ", ");
722 dump_gimple_call_args (buffer, gs, flags);
728 if (lhs && !(flags & TDF_RHS_ONLY))
730 dump_generic_node (buffer, lhs, spc, flags, false);
731 pp_string (buffer, " =");
733 if (gimple_has_volatile_ops (gs))
734 pp_string (buffer, "{v}");
738 if (gimple_call_internal_p (gs))
739 pp_string (buffer, internal_fn_name (gimple_call_internal_fn (gs)));
741 print_call_name (buffer, fn, flags);
742 pp_string (buffer, " (");
743 dump_gimple_call_args (buffer, gs, flags);
744 pp_right_paren (buffer);
745 if (!(flags & TDF_RHS_ONLY))
746 pp_semicolon (buffer);
749 if (gimple_call_chain (gs))
751 pp_string (buffer, " [static-chain: ");
752 dump_generic_node (buffer, gimple_call_chain (gs), spc, flags, false);
753 pp_right_bracket (buffer);
756 if (gimple_call_return_slot_opt_p (gs))
757 pp_string (buffer, " [return slot optimization]");
758 if (gimple_call_tail_p (gs))
759 pp_string (buffer, " [tail call]");
764 /* Dump the arguments of _ITM_beginTransaction sanely. */
765 if (TREE_CODE (fn) == ADDR_EXPR)
766 fn = TREE_OPERAND (fn, 0);
767 if (TREE_CODE (fn) == FUNCTION_DECL && decl_is_tm_clone (fn))
768 pp_string (buffer, " [tm-clone]");
769 if (TREE_CODE (fn) == FUNCTION_DECL
770 && DECL_BUILT_IN_CLASS (fn) == BUILT_IN_NORMAL
771 && DECL_FUNCTION_CODE (fn) == BUILT_IN_TM_START
772 && gimple_call_num_args (gs) > 0)
774 tree t = gimple_call_arg (gs, 0);
775 unsigned HOST_WIDE_INT props;
776 gcc_assert (TREE_CODE (t) == INTEGER_CST);
778 pp_string (buffer, " [ ");
780 /* Get the transaction code properties. */
781 props = TREE_INT_CST_LOW (t);
783 if (props & PR_INSTRUMENTEDCODE)
784 pp_string (buffer, "instrumentedCode ");
785 if (props & PR_UNINSTRUMENTEDCODE)
786 pp_string (buffer, "uninstrumentedCode ");
787 if (props & PR_HASNOXMMUPDATE)
788 pp_string (buffer, "hasNoXMMUpdate ");
789 if (props & PR_HASNOABORT)
790 pp_string (buffer, "hasNoAbort ");
791 if (props & PR_HASNOIRREVOCABLE)
792 pp_string (buffer, "hasNoIrrevocable ");
793 if (props & PR_DOESGOIRREVOCABLE)
794 pp_string (buffer, "doesGoIrrevocable ");
795 if (props & PR_HASNOSIMPLEREADS)
796 pp_string (buffer, "hasNoSimpleReads ");
797 if (props & PR_AWBARRIERSOMITTED)
798 pp_string (buffer, "awBarriersOmitted ");
799 if (props & PR_RARBARRIERSOMITTED)
800 pp_string (buffer, "RaRBarriersOmitted ");
801 if (props & PR_UNDOLOGCODE)
802 pp_string (buffer, "undoLogCode ");
803 if (props & PR_PREFERUNINSTRUMENTED)
804 pp_string (buffer, "preferUninstrumented ");
805 if (props & PR_EXCEPTIONBLOCK)
806 pp_string (buffer, "exceptionBlock ");
807 if (props & PR_HASELSE)
808 pp_string (buffer, "hasElse ");
809 if (props & PR_READONLY)
810 pp_string (buffer, "readOnly ");
812 pp_right_bracket (buffer);
817 /* Dump the switch statement GS. BUFFER, SPC and FLAGS are as in
821 dump_gimple_switch (pretty_printer *buffer, gswitch *gs, int spc,
826 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
828 dump_gimple_fmt (buffer, spc, flags, "%G <%T, ", gs,
829 gimple_switch_index (gs));
832 pp_string (buffer, "switch (");
833 dump_generic_node (buffer, gimple_switch_index (gs), spc, flags, true);
834 pp_string (buffer, ") <");
837 for (i = 0; i < gimple_switch_num_labels (gs); i++)
839 tree case_label = gimple_switch_label (gs, i);
840 gcc_checking_assert (case_label != NULL_TREE);
841 dump_generic_node (buffer, case_label, spc, flags, false);
843 dump_generic_node (buffer, CASE_LABEL (case_label), spc, flags, false);
844 if (i < gimple_switch_num_labels (gs) - 1)
845 pp_string (buffer, ", ");
851 /* Dump the gimple conditional GS. BUFFER, SPC and FLAGS are as in
855 dump_gimple_cond (pretty_printer *buffer, gcond *gs, int spc, int flags)
858 dump_gimple_fmt (buffer, spc, flags, "%G <%s, %T, %T, %T, %T>", gs,
859 get_tree_code_name (gimple_cond_code (gs)),
860 gimple_cond_lhs (gs), gimple_cond_rhs (gs),
861 gimple_cond_true_label (gs), gimple_cond_false_label (gs));
864 if (!(flags & TDF_RHS_ONLY))
865 pp_string (buffer, "if (");
866 dump_generic_node (buffer, gimple_cond_lhs (gs), spc, flags, false);
868 pp_string (buffer, op_symbol_code (gimple_cond_code (gs)));
870 dump_generic_node (buffer, gimple_cond_rhs (gs), spc, flags, false);
871 if (!(flags & TDF_RHS_ONLY))
873 pp_right_paren (buffer);
875 if (gimple_cond_true_label (gs))
877 pp_string (buffer, " goto ");
878 dump_generic_node (buffer, gimple_cond_true_label (gs),
880 pp_semicolon (buffer);
882 if (gimple_cond_false_label (gs))
884 pp_string (buffer, " else goto ");
885 dump_generic_node (buffer, gimple_cond_false_label (gs),
887 pp_semicolon (buffer);
894 /* Dump a GIMPLE_LABEL tuple on the pretty_printer BUFFER, SPC
895 spaces of indent. FLAGS specifies details to show in the dump (see
896 TDF_* in dumpfils.h). */
899 dump_gimple_label (pretty_printer *buffer, glabel *gs, int spc, int flags)
901 tree label = gimple_label_label (gs);
903 dump_gimple_fmt (buffer, spc, flags, "%G <%T>", gs, label);
906 dump_generic_node (buffer, label, spc, flags, false);
909 if (DECL_NONLOCAL (label))
910 pp_string (buffer, " [non-local]");
911 if ((flags & TDF_EH) && EH_LANDING_PAD_NR (label))
912 pp_printf (buffer, " [LP %d]", EH_LANDING_PAD_NR (label));
915 /* Dump a GIMPLE_GOTO tuple on the pretty_printer BUFFER, SPC
916 spaces of indent. FLAGS specifies details to show in the dump (see
917 TDF_* in dumpfile.h). */
920 dump_gimple_goto (pretty_printer *buffer, ggoto *gs, int spc, int flags)
922 tree label = gimple_goto_dest (gs);
924 dump_gimple_fmt (buffer, spc, flags, "%G <%T>", gs, label);
926 dump_gimple_fmt (buffer, spc, flags, "goto %T;", label);
930 /* Dump a GIMPLE_BIND tuple on the pretty_printer BUFFER, SPC
931 spaces of indent. FLAGS specifies details to show in the dump (see
932 TDF_* in dumpfile.h). */
935 dump_gimple_bind (pretty_printer *buffer, gbind *gs, int spc, int flags)
938 dump_gimple_fmt (buffer, spc, flags, "%G <", gs);
940 pp_left_brace (buffer);
941 if (!(flags & TDF_SLIM))
945 for (var = gimple_bind_vars (gs); var; var = DECL_CHAIN (var))
947 newline_and_indent (buffer, 2);
948 print_declaration (buffer, var, spc, flags);
950 if (gimple_bind_vars (gs))
954 dump_gimple_seq (buffer, gimple_bind_body (gs), spc + 2, flags);
955 newline_and_indent (buffer, spc);
959 pp_right_brace (buffer);
963 /* Dump a GIMPLE_TRY tuple on the pretty_printer BUFFER, SPC spaces of
964 indent. FLAGS specifies details to show in the dump (see TDF_* in
968 dump_gimple_try (pretty_printer *buffer, gtry *gs, int spc, int flags)
973 if (gimple_try_kind (gs) == GIMPLE_TRY_CATCH)
974 type = "GIMPLE_TRY_CATCH";
975 else if (gimple_try_kind (gs) == GIMPLE_TRY_FINALLY)
976 type = "GIMPLE_TRY_FINALLY";
978 type = "UNKNOWN GIMPLE_TRY";
979 dump_gimple_fmt (buffer, spc, flags,
980 "%G <%s,%+EVAL <%S>%nCLEANUP <%S>%->", gs, type,
981 gimple_try_eval (gs), gimple_try_cleanup (gs));
985 pp_string (buffer, "try");
986 newline_and_indent (buffer, spc + 2);
987 pp_left_brace (buffer);
990 dump_gimple_seq (buffer, gimple_try_eval (gs), spc + 4, flags);
991 newline_and_indent (buffer, spc + 2);
992 pp_right_brace (buffer);
994 if (gimple_try_kind (gs) == GIMPLE_TRY_CATCH)
996 newline_and_indent (buffer, spc);
997 pp_string (buffer, "catch");
998 newline_and_indent (buffer, spc + 2);
999 pp_left_brace (buffer);
1001 else if (gimple_try_kind (gs) == GIMPLE_TRY_FINALLY)
1003 newline_and_indent (buffer, spc);
1004 pp_string (buffer, "finally");
1005 newline_and_indent (buffer, spc + 2);
1006 pp_left_brace (buffer);
1009 pp_string (buffer, " <UNKNOWN GIMPLE_TRY> {");
1011 pp_newline (buffer);
1012 dump_gimple_seq (buffer, gimple_try_cleanup (gs), spc + 4, flags);
1013 newline_and_indent (buffer, spc + 2);
1014 pp_right_brace (buffer);
1019 /* Dump a GIMPLE_CATCH tuple on the pretty_printer BUFFER, SPC spaces of
1020 indent. FLAGS specifies details to show in the dump (see TDF_* in
1024 dump_gimple_catch (pretty_printer *buffer, gcatch *gs, int spc, int flags)
1026 if (flags & TDF_RAW)
1027 dump_gimple_fmt (buffer, spc, flags, "%G <%T, %+CATCH <%S>%->", gs,
1028 gimple_catch_types (gs), gimple_catch_handler (gs));
1030 dump_gimple_fmt (buffer, spc, flags, "catch (%T)%+{%S}",
1031 gimple_catch_types (gs), gimple_catch_handler (gs));
1035 /* Dump a GIMPLE_EH_FILTER tuple on the pretty_printer BUFFER, SPC spaces of
1036 indent. FLAGS specifies details to show in the dump (see TDF_* in
1040 dump_gimple_eh_filter (pretty_printer *buffer, geh_filter *gs, int spc,
1043 if (flags & TDF_RAW)
1044 dump_gimple_fmt (buffer, spc, flags, "%G <%T, %+FAILURE <%S>%->", gs,
1045 gimple_eh_filter_types (gs),
1046 gimple_eh_filter_failure (gs));
1048 dump_gimple_fmt (buffer, spc, flags, "<<<eh_filter (%T)>>>%+{%+%S%-}",
1049 gimple_eh_filter_types (gs),
1050 gimple_eh_filter_failure (gs));
1054 /* Dump a GIMPLE_EH_MUST_NOT_THROW tuple. */
1057 dump_gimple_eh_must_not_throw (pretty_printer *buffer,
1058 geh_mnt *gs, int spc, int flags)
1060 if (flags & TDF_RAW)
1061 dump_gimple_fmt (buffer, spc, flags, "%G <%T>", gs,
1062 gimple_eh_must_not_throw_fndecl (gs));
1064 dump_gimple_fmt (buffer, spc, flags, "<<<eh_must_not_throw (%T)>>>",
1065 gimple_eh_must_not_throw_fndecl (gs));
1069 /* Dump a GIMPLE_EH_ELSE tuple on the pretty_printer BUFFER, SPC spaces of
1070 indent. FLAGS specifies details to show in the dump (see TDF_* in
1074 dump_gimple_eh_else (pretty_printer *buffer, geh_else *gs, int spc,
1077 if (flags & TDF_RAW)
1078 dump_gimple_fmt (buffer, spc, flags,
1079 "%G <%+N_BODY <%S>%nE_BODY <%S>%->", gs,
1080 gimple_eh_else_n_body (gs), gimple_eh_else_e_body (gs));
1082 dump_gimple_fmt (buffer, spc, flags,
1083 "<<<if_normal_exit>>>%+{%S}%-<<<else_eh_exit>>>%+{%S}",
1084 gimple_eh_else_n_body (gs), gimple_eh_else_e_body (gs));
1088 /* Dump a GIMPLE_RESX tuple on the pretty_printer BUFFER, SPC spaces of
1089 indent. FLAGS specifies details to show in the dump (see TDF_* in
1093 dump_gimple_resx (pretty_printer *buffer, gresx *gs, int spc, int flags)
1095 if (flags & TDF_RAW)
1096 dump_gimple_fmt (buffer, spc, flags, "%G <%d>", gs,
1097 gimple_resx_region (gs));
1099 dump_gimple_fmt (buffer, spc, flags, "resx %d", gimple_resx_region (gs));
1102 /* Dump a GIMPLE_EH_DISPATCH tuple on the pretty_printer BUFFER. */
1105 dump_gimple_eh_dispatch (pretty_printer *buffer, geh_dispatch *gs, int spc, int flags)
1107 if (flags & TDF_RAW)
1108 dump_gimple_fmt (buffer, spc, flags, "%G <%d>", gs,
1109 gimple_eh_dispatch_region (gs));
1111 dump_gimple_fmt (buffer, spc, flags, "eh_dispatch %d",
1112 gimple_eh_dispatch_region (gs));
1115 /* Dump a GIMPLE_DEBUG tuple on the pretty_printer BUFFER, SPC spaces
1116 of indent. FLAGS specifies details to show in the dump (see TDF_*
1120 dump_gimple_debug (pretty_printer *buffer, gdebug *gs, int spc, int flags)
1122 switch (gs->subcode)
1124 case GIMPLE_DEBUG_BIND:
1125 if (flags & TDF_RAW)
1126 dump_gimple_fmt (buffer, spc, flags, "%G BIND <%T, %T>", gs,
1127 gimple_debug_bind_get_var (gs),
1128 gimple_debug_bind_get_value (gs));
1130 dump_gimple_fmt (buffer, spc, flags, "# DEBUG %T => %T",
1131 gimple_debug_bind_get_var (gs),
1132 gimple_debug_bind_get_value (gs));
1135 case GIMPLE_DEBUG_SOURCE_BIND:
1136 if (flags & TDF_RAW)
1137 dump_gimple_fmt (buffer, spc, flags, "%G SRCBIND <%T, %T>", gs,
1138 gimple_debug_source_bind_get_var (gs),
1139 gimple_debug_source_bind_get_value (gs));
1141 dump_gimple_fmt (buffer, spc, flags, "# DEBUG %T s=> %T",
1142 gimple_debug_source_bind_get_var (gs),
1143 gimple_debug_source_bind_get_value (gs));
1151 /* Dump a GIMPLE_OMP_FOR tuple on the pretty_printer BUFFER. */
1153 dump_gimple_omp_for (pretty_printer *buffer, gomp_for *gs, int spc, int flags)
1157 if (flags & TDF_RAW)
1160 switch (gimple_omp_for_kind (gs))
1162 case GF_OMP_FOR_KIND_FOR:
1165 case GF_OMP_FOR_KIND_DISTRIBUTE:
1166 kind = " distribute";
1168 case GF_OMP_FOR_KIND_TASKLOOP:
1171 case GF_OMP_FOR_KIND_CILKFOR:
1172 kind = " _Cilk_for";
1174 case GF_OMP_FOR_KIND_OACC_LOOP:
1175 kind = " oacc_loop";
1177 case GF_OMP_FOR_KIND_SIMD:
1180 case GF_OMP_FOR_KIND_CILKSIMD:
1186 dump_gimple_fmt (buffer, spc, flags, "%G%s <%+BODY <%S>%nCLAUSES <", gs,
1187 kind, gimple_omp_body (gs));
1188 dump_omp_clauses (buffer, gimple_omp_for_clauses (gs), spc, flags);
1189 dump_gimple_fmt (buffer, spc, flags, " >,");
1190 for (i = 0; i < gimple_omp_for_collapse (gs); i++)
1191 dump_gimple_fmt (buffer, spc, flags,
1192 "%+%T, %T, %T, %s, %T,%n",
1193 gimple_omp_for_index (gs, i),
1194 gimple_omp_for_initial (gs, i),
1195 gimple_omp_for_final (gs, i),
1196 get_tree_code_name (gimple_omp_for_cond (gs, i)),
1197 gimple_omp_for_incr (gs, i));
1198 dump_gimple_fmt (buffer, spc, flags, "PRE_BODY <%S>%->",
1199 gimple_omp_for_pre_body (gs));
1203 switch (gimple_omp_for_kind (gs))
1205 case GF_OMP_FOR_KIND_FOR:
1206 pp_string (buffer, "#pragma omp for");
1208 case GF_OMP_FOR_KIND_DISTRIBUTE:
1209 pp_string (buffer, "#pragma omp distribute");
1211 case GF_OMP_FOR_KIND_TASKLOOP:
1212 pp_string (buffer, "#pragma omp taskloop");
1214 case GF_OMP_FOR_KIND_CILKFOR:
1216 case GF_OMP_FOR_KIND_OACC_LOOP:
1217 pp_string (buffer, "#pragma acc loop");
1219 case GF_OMP_FOR_KIND_SIMD:
1220 pp_string (buffer, "#pragma omp simd");
1222 case GF_OMP_FOR_KIND_CILKSIMD:
1223 pp_string (buffer, "#pragma simd");
1225 case GF_OMP_FOR_KIND_GRID_LOOP:
1226 pp_string (buffer, "#pragma omp for grid_loop");
1231 if (gimple_omp_for_kind (gs) != GF_OMP_FOR_KIND_CILKFOR)
1232 dump_omp_clauses (buffer, gimple_omp_for_clauses (gs), spc, flags);
1233 for (i = 0; i < gimple_omp_for_collapse (gs); i++)
1237 if (gimple_omp_for_kind (gs) == GF_OMP_FOR_KIND_CILKFOR)
1238 pp_string (buffer, "_Cilk_for (");
1241 newline_and_indent (buffer, spc);
1242 pp_string (buffer, "for (");
1244 dump_generic_node (buffer, gimple_omp_for_index (gs, i), spc,
1246 pp_string (buffer, " = ");
1247 dump_generic_node (buffer, gimple_omp_for_initial (gs, i), spc,
1249 pp_string (buffer, "; ");
1251 dump_generic_node (buffer, gimple_omp_for_index (gs, i), spc,
1254 switch (gimple_omp_for_cond (gs, i))
1260 pp_greater (buffer);
1263 pp_less_equal (buffer);
1266 pp_greater_equal (buffer);
1269 pp_string (buffer, "!=");
1275 dump_generic_node (buffer, gimple_omp_for_final (gs, i), spc,
1277 pp_string (buffer, "; ");
1279 dump_generic_node (buffer, gimple_omp_for_index (gs, i), spc,
1281 pp_string (buffer, " = ");
1282 dump_generic_node (buffer, gimple_omp_for_incr (gs, i), spc,
1284 pp_right_paren (buffer);
1287 if (!gimple_seq_empty_p (gimple_omp_body (gs)))
1289 if (gimple_omp_for_kind (gs) == GF_OMP_FOR_KIND_CILKFOR)
1290 dump_omp_clauses (buffer, gimple_omp_for_clauses (gs), spc, flags);
1291 newline_and_indent (buffer, spc + 2);
1292 pp_left_brace (buffer);
1293 pp_newline (buffer);
1294 dump_gimple_seq (buffer, gimple_omp_body (gs), spc + 4, flags);
1295 newline_and_indent (buffer, spc + 2);
1296 pp_right_brace (buffer);
1301 /* Dump a GIMPLE_OMP_CONTINUE tuple on the pretty_printer BUFFER. */
1304 dump_gimple_omp_continue (pretty_printer *buffer, gomp_continue *gs,
1307 if (flags & TDF_RAW)
1309 dump_gimple_fmt (buffer, spc, flags, "%G <%T, %T>", gs,
1310 gimple_omp_continue_control_def (gs),
1311 gimple_omp_continue_control_use (gs));
1315 pp_string (buffer, "#pragma omp continue (");
1316 dump_generic_node (buffer, gimple_omp_continue_control_def (gs),
1320 dump_generic_node (buffer, gimple_omp_continue_control_use (gs),
1322 pp_right_paren (buffer);
1326 /* Dump a GIMPLE_OMP_SINGLE tuple on the pretty_printer BUFFER. */
1329 dump_gimple_omp_single (pretty_printer *buffer, gomp_single *gs,
1332 if (flags & TDF_RAW)
1334 dump_gimple_fmt (buffer, spc, flags, "%G <%+BODY <%S>%nCLAUSES <", gs,
1335 gimple_omp_body (gs));
1336 dump_omp_clauses (buffer, gimple_omp_single_clauses (gs), spc, flags);
1337 dump_gimple_fmt (buffer, spc, flags, " >");
1341 pp_string (buffer, "#pragma omp single");
1342 dump_omp_clauses (buffer, gimple_omp_single_clauses (gs), spc, flags);
1343 if (!gimple_seq_empty_p (gimple_omp_body (gs)))
1345 newline_and_indent (buffer, spc + 2);
1346 pp_left_brace (buffer);
1347 pp_newline (buffer);
1348 dump_gimple_seq (buffer, gimple_omp_body (gs), spc + 4, flags);
1349 newline_and_indent (buffer, spc + 2);
1350 pp_right_brace (buffer);
1355 /* Dump a GIMPLE_OMP_TARGET tuple on the pretty_printer BUFFER. */
1358 dump_gimple_omp_target (pretty_printer *buffer, gomp_target *gs,
1362 switch (gimple_omp_target_kind (gs))
1364 case GF_OMP_TARGET_KIND_REGION:
1367 case GF_OMP_TARGET_KIND_DATA:
1370 case GF_OMP_TARGET_KIND_UPDATE:
1373 case GF_OMP_TARGET_KIND_ENTER_DATA:
1374 kind = " enter data";
1376 case GF_OMP_TARGET_KIND_EXIT_DATA:
1377 kind = " exit data";
1379 case GF_OMP_TARGET_KIND_OACC_KERNELS:
1380 kind = " oacc_kernels";
1382 case GF_OMP_TARGET_KIND_OACC_PARALLEL:
1383 kind = " oacc_parallel";
1385 case GF_OMP_TARGET_KIND_OACC_DATA:
1386 kind = " oacc_data";
1388 case GF_OMP_TARGET_KIND_OACC_UPDATE:
1389 kind = " oacc_update";
1391 case GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA:
1392 kind = " oacc_enter_exit_data";
1394 case GF_OMP_TARGET_KIND_OACC_DECLARE:
1395 kind = " oacc_declare";
1397 case GF_OMP_TARGET_KIND_OACC_HOST_DATA:
1398 kind = " oacc_host_data";
1403 if (flags & TDF_RAW)
1405 dump_gimple_fmt (buffer, spc, flags, "%G%s <%+BODY <%S>%nCLAUSES <", gs,
1406 kind, gimple_omp_body (gs));
1407 dump_omp_clauses (buffer, gimple_omp_target_clauses (gs), spc, flags);
1408 dump_gimple_fmt (buffer, spc, flags, " >, %T, %T%n>",
1409 gimple_omp_target_child_fn (gs),
1410 gimple_omp_target_data_arg (gs));
1414 pp_string (buffer, "#pragma omp target");
1415 pp_string (buffer, kind);
1416 dump_omp_clauses (buffer, gimple_omp_target_clauses (gs), spc, flags);
1417 if (gimple_omp_target_child_fn (gs))
1419 pp_string (buffer, " [child fn: ");
1420 dump_generic_node (buffer, gimple_omp_target_child_fn (gs),
1422 pp_string (buffer, " (");
1423 if (gimple_omp_target_data_arg (gs))
1424 dump_generic_node (buffer, gimple_omp_target_data_arg (gs),
1427 pp_string (buffer, "???");
1428 pp_string (buffer, ")]");
1430 gimple_seq body = gimple_omp_body (gs);
1431 if (body && gimple_code (gimple_seq_first_stmt (body)) != GIMPLE_BIND)
1433 newline_and_indent (buffer, spc + 2);
1434 pp_left_brace (buffer);
1435 pp_newline (buffer);
1436 dump_gimple_seq (buffer, body, spc + 4, flags);
1437 newline_and_indent (buffer, spc + 2);
1438 pp_right_brace (buffer);
1442 pp_newline (buffer);
1443 dump_gimple_seq (buffer, body, spc + 2, flags);
1448 /* Dump a GIMPLE_OMP_TEAMS tuple on the pretty_printer BUFFER. */
1451 dump_gimple_omp_teams (pretty_printer *buffer, gomp_teams *gs, int spc,
1454 if (flags & TDF_RAW)
1456 dump_gimple_fmt (buffer, spc, flags, "%G <%+BODY <%S>%nCLAUSES <", gs,
1457 gimple_omp_body (gs));
1458 dump_omp_clauses (buffer, gimple_omp_teams_clauses (gs), spc, flags);
1459 dump_gimple_fmt (buffer, spc, flags, " >");
1463 pp_string (buffer, "#pragma omp teams");
1464 dump_omp_clauses (buffer, gimple_omp_teams_clauses (gs), spc, flags);
1465 if (!gimple_seq_empty_p (gimple_omp_body (gs)))
1467 newline_and_indent (buffer, spc + 2);
1468 pp_character (buffer, '{');
1469 pp_newline (buffer);
1470 dump_gimple_seq (buffer, gimple_omp_body (gs), spc + 4, flags);
1471 newline_and_indent (buffer, spc + 2);
1472 pp_character (buffer, '}');
1477 /* Dump a GIMPLE_OMP_SECTIONS tuple on the pretty_printer BUFFER. */
1480 dump_gimple_omp_sections (pretty_printer *buffer, gomp_sections *gs,
1483 if (flags & TDF_RAW)
1485 dump_gimple_fmt (buffer, spc, flags, "%G <%+BODY <%S>%nCLAUSES <", gs,
1486 gimple_omp_body (gs));
1487 dump_omp_clauses (buffer, gimple_omp_sections_clauses (gs), spc, flags);
1488 dump_gimple_fmt (buffer, spc, flags, " >");
1492 pp_string (buffer, "#pragma omp sections");
1493 if (gimple_omp_sections_control (gs))
1495 pp_string (buffer, " <");
1496 dump_generic_node (buffer, gimple_omp_sections_control (gs), spc,
1498 pp_greater (buffer);
1500 dump_omp_clauses (buffer, gimple_omp_sections_clauses (gs), spc, flags);
1501 if (!gimple_seq_empty_p (gimple_omp_body (gs)))
1503 newline_and_indent (buffer, spc + 2);
1504 pp_left_brace (buffer);
1505 pp_newline (buffer);
1506 dump_gimple_seq (buffer, gimple_omp_body (gs), spc + 4, flags);
1507 newline_and_indent (buffer, spc + 2);
1508 pp_right_brace (buffer);
1513 /* Dump a GIMPLE_OMP_{MASTER,TASKGROUP,ORDERED,SECTION} tuple on the
1514 pretty_printer BUFFER. */
1517 dump_gimple_omp_block (pretty_printer *buffer, gimple *gs, int spc, int flags)
1519 if (flags & TDF_RAW)
1520 dump_gimple_fmt (buffer, spc, flags, "%G <%+BODY <%S> >", gs,
1521 gimple_omp_body (gs));
1524 switch (gimple_code (gs))
1526 case GIMPLE_OMP_MASTER:
1527 pp_string (buffer, "#pragma omp master");
1529 case GIMPLE_OMP_TASKGROUP:
1530 pp_string (buffer, "#pragma omp taskgroup");
1532 case GIMPLE_OMP_SECTION:
1533 pp_string (buffer, "#pragma omp section");
1535 case GIMPLE_OMP_GRID_BODY:
1536 pp_string (buffer, "#pragma omp gridified body");
1541 if (!gimple_seq_empty_p (gimple_omp_body (gs)))
1543 newline_and_indent (buffer, spc + 2);
1544 pp_left_brace (buffer);
1545 pp_newline (buffer);
1546 dump_gimple_seq (buffer, gimple_omp_body (gs), spc + 4, flags);
1547 newline_and_indent (buffer, spc + 2);
1548 pp_right_brace (buffer);
1553 /* Dump a GIMPLE_OMP_CRITICAL tuple on the pretty_printer BUFFER. */
1556 dump_gimple_omp_critical (pretty_printer *buffer, gomp_critical *gs,
1559 if (flags & TDF_RAW)
1560 dump_gimple_fmt (buffer, spc, flags, "%G <%+BODY <%S> >", gs,
1561 gimple_omp_body (gs));
1564 pp_string (buffer, "#pragma omp critical");
1565 if (gimple_omp_critical_name (gs))
1567 pp_string (buffer, " (");
1568 dump_generic_node (buffer, gimple_omp_critical_name (gs), spc,
1570 pp_right_paren (buffer);
1572 dump_omp_clauses (buffer, gimple_omp_critical_clauses (gs), spc, flags);
1573 if (!gimple_seq_empty_p (gimple_omp_body (gs)))
1575 newline_and_indent (buffer, spc + 2);
1576 pp_left_brace (buffer);
1577 pp_newline (buffer);
1578 dump_gimple_seq (buffer, gimple_omp_body (gs), spc + 4, flags);
1579 newline_and_indent (buffer, spc + 2);
1580 pp_right_brace (buffer);
1585 /* Dump a GIMPLE_OMP_ORDERED tuple on the pretty_printer BUFFER. */
1588 dump_gimple_omp_ordered (pretty_printer *buffer, gomp_ordered *gs,
1591 if (flags & TDF_RAW)
1592 dump_gimple_fmt (buffer, spc, flags, "%G <%+BODY <%S> >", gs,
1593 gimple_omp_body (gs));
1596 pp_string (buffer, "#pragma omp ordered");
1597 dump_omp_clauses (buffer, gimple_omp_ordered_clauses (gs), spc, flags);
1598 if (!gimple_seq_empty_p (gimple_omp_body (gs)))
1600 newline_and_indent (buffer, spc + 2);
1601 pp_left_brace (buffer);
1602 pp_newline (buffer);
1603 dump_gimple_seq (buffer, gimple_omp_body (gs), spc + 4, flags);
1604 newline_and_indent (buffer, spc + 2);
1605 pp_right_brace (buffer);
1610 /* Dump a GIMPLE_OMP_RETURN tuple on the pretty_printer BUFFER. */
1613 dump_gimple_omp_return (pretty_printer *buffer, gimple *gs, int spc, int flags)
1615 if (flags & TDF_RAW)
1617 dump_gimple_fmt (buffer, spc, flags, "%G <nowait=%d", gs,
1618 (int) gimple_omp_return_nowait_p (gs));
1619 if (gimple_omp_return_lhs (gs))
1620 dump_gimple_fmt (buffer, spc, flags, ", lhs=%T>",
1621 gimple_omp_return_lhs (gs));
1623 dump_gimple_fmt (buffer, spc, flags, ">");
1627 pp_string (buffer, "#pragma omp return");
1628 if (gimple_omp_return_nowait_p (gs))
1629 pp_string (buffer, "(nowait)");
1630 if (gimple_omp_return_lhs (gs))
1632 pp_string (buffer, " (set ");
1633 dump_generic_node (buffer, gimple_omp_return_lhs (gs),
1635 pp_character (buffer, ')');
1640 /* Dump a GIMPLE_TRANSACTION tuple on the pretty_printer BUFFER. */
1643 dump_gimple_transaction (pretty_printer *buffer, gtransaction *gs,
1646 unsigned subcode = gimple_transaction_subcode (gs);
1648 if (flags & TDF_RAW)
1650 dump_gimple_fmt (buffer, spc, flags,
1651 "%G [SUBCODE=%x,NORM=%T,UNINST=%T,OVER=%T] "
1653 gs, subcode, gimple_transaction_label_norm (gs),
1654 gimple_transaction_label_uninst (gs),
1655 gimple_transaction_label_over (gs),
1656 gimple_transaction_body (gs));
1660 if (subcode & GTMA_IS_OUTER)
1661 pp_string (buffer, "__transaction_atomic [[outer]]");
1662 else if (subcode & GTMA_IS_RELAXED)
1663 pp_string (buffer, "__transaction_relaxed");
1665 pp_string (buffer, "__transaction_atomic");
1666 subcode &= ~GTMA_DECLARATION_MASK;
1668 if (gimple_transaction_body (gs))
1670 newline_and_indent (buffer, spc + 2);
1671 pp_left_brace (buffer);
1672 pp_newline (buffer);
1673 dump_gimple_seq (buffer, gimple_transaction_body (gs),
1675 newline_and_indent (buffer, spc + 2);
1676 pp_right_brace (buffer);
1680 pp_string (buffer, " //");
1681 if (gimple_transaction_label_norm (gs))
1683 pp_string (buffer, " NORM=");
1684 dump_generic_node (buffer, gimple_transaction_label_norm (gs),
1687 if (gimple_transaction_label_uninst (gs))
1689 pp_string (buffer, " UNINST=");
1690 dump_generic_node (buffer, gimple_transaction_label_uninst (gs),
1693 if (gimple_transaction_label_over (gs))
1695 pp_string (buffer, " OVER=");
1696 dump_generic_node (buffer, gimple_transaction_label_over (gs),
1701 pp_string (buffer, " SUBCODE=[ ");
1702 if (subcode & GTMA_HAVE_ABORT)
1704 pp_string (buffer, "GTMA_HAVE_ABORT ");
1705 subcode &= ~GTMA_HAVE_ABORT;
1707 if (subcode & GTMA_HAVE_LOAD)
1709 pp_string (buffer, "GTMA_HAVE_LOAD ");
1710 subcode &= ~GTMA_HAVE_LOAD;
1712 if (subcode & GTMA_HAVE_STORE)
1714 pp_string (buffer, "GTMA_HAVE_STORE ");
1715 subcode &= ~GTMA_HAVE_STORE;
1717 if (subcode & GTMA_MAY_ENTER_IRREVOCABLE)
1719 pp_string (buffer, "GTMA_MAY_ENTER_IRREVOCABLE ");
1720 subcode &= ~GTMA_MAY_ENTER_IRREVOCABLE;
1722 if (subcode & GTMA_DOES_GO_IRREVOCABLE)
1724 pp_string (buffer, "GTMA_DOES_GO_IRREVOCABLE ");
1725 subcode &= ~GTMA_DOES_GO_IRREVOCABLE;
1727 if (subcode & GTMA_HAS_NO_INSTRUMENTATION)
1729 pp_string (buffer, "GTMA_HAS_NO_INSTRUMENTATION ");
1730 subcode &= ~GTMA_HAS_NO_INSTRUMENTATION;
1733 pp_printf (buffer, "0x%x ", subcode);
1734 pp_right_bracket (buffer);
1740 /* Dump a GIMPLE_ASM tuple on the pretty_printer BUFFER, SPC spaces of
1741 indent. FLAGS specifies details to show in the dump (see TDF_* in
1745 dump_gimple_asm (pretty_printer *buffer, gasm *gs, int spc, int flags)
1747 unsigned int i, n, f, fields;
1749 if (flags & TDF_RAW)
1751 dump_gimple_fmt (buffer, spc, flags, "%G <%+STRING <%n%s%n>", gs,
1752 gimple_asm_string (gs));
1754 n = gimple_asm_noutputs (gs);
1757 newline_and_indent (buffer, spc + 2);
1758 pp_string (buffer, "OUTPUT: ");
1759 for (i = 0; i < n; i++)
1761 dump_generic_node (buffer, gimple_asm_output_op (gs, i),
1764 pp_string (buffer, ", ");
1768 n = gimple_asm_ninputs (gs);
1771 newline_and_indent (buffer, spc + 2);
1772 pp_string (buffer, "INPUT: ");
1773 for (i = 0; i < n; i++)
1775 dump_generic_node (buffer, gimple_asm_input_op (gs, i),
1778 pp_string (buffer, ", ");
1782 n = gimple_asm_nclobbers (gs);
1785 newline_and_indent (buffer, spc + 2);
1786 pp_string (buffer, "CLOBBER: ");
1787 for (i = 0; i < n; i++)
1789 dump_generic_node (buffer, gimple_asm_clobber_op (gs, i),
1792 pp_string (buffer, ", ");
1796 n = gimple_asm_nlabels (gs);
1799 newline_and_indent (buffer, spc + 2);
1800 pp_string (buffer, "LABEL: ");
1801 for (i = 0; i < n; i++)
1803 dump_generic_node (buffer, gimple_asm_label_op (gs, i),
1806 pp_string (buffer, ", ");
1810 newline_and_indent (buffer, spc);
1811 pp_greater (buffer);
1815 pp_string (buffer, "__asm__");
1816 if (gimple_asm_volatile_p (gs))
1817 pp_string (buffer, " __volatile__");
1818 if (gimple_asm_nlabels (gs))
1819 pp_string (buffer, " goto");
1820 pp_string (buffer, "(\"");
1821 pp_string (buffer, gimple_asm_string (gs));
1822 pp_string (buffer, "\"");
1824 if (gimple_asm_nlabels (gs))
1826 else if (gimple_asm_nclobbers (gs))
1828 else if (gimple_asm_ninputs (gs))
1830 else if (gimple_asm_noutputs (gs))
1835 for (f = 0; f < fields; ++f)
1837 pp_string (buffer, " : ");
1842 n = gimple_asm_noutputs (gs);
1843 for (i = 0; i < n; i++)
1845 dump_generic_node (buffer, gimple_asm_output_op (gs, i),
1848 pp_string (buffer, ", ");
1853 n = gimple_asm_ninputs (gs);
1854 for (i = 0; i < n; i++)
1856 dump_generic_node (buffer, gimple_asm_input_op (gs, i),
1859 pp_string (buffer, ", ");
1864 n = gimple_asm_nclobbers (gs);
1865 for (i = 0; i < n; i++)
1867 dump_generic_node (buffer, gimple_asm_clobber_op (gs, i),
1870 pp_string (buffer, ", ");
1875 n = gimple_asm_nlabels (gs);
1876 for (i = 0; i < n; i++)
1878 dump_generic_node (buffer, gimple_asm_label_op (gs, i),
1881 pp_string (buffer, ", ");
1890 pp_string (buffer, ");");
1894 /* Dump ptr_info and range_info for NODE on pretty_printer BUFFER with
1895 SPC spaces of indent. */
1898 dump_ssaname_info (pretty_printer *buffer, tree node, int spc)
1900 if (TREE_CODE (node) != SSA_NAME)
1903 if (POINTER_TYPE_P (TREE_TYPE (node))
1904 && SSA_NAME_PTR_INFO (node))
1906 unsigned int align, misalign;
1907 struct ptr_info_def *pi = SSA_NAME_PTR_INFO (node);
1908 pp_string (buffer, "# PT = ");
1909 pp_points_to_solution (buffer, &pi->pt);
1910 newline_and_indent (buffer, spc);
1911 if (get_ptr_info_alignment (pi, &align, &misalign))
1913 pp_printf (buffer, "# ALIGN = %u, MISALIGN = %u", align, misalign);
1914 newline_and_indent (buffer, spc);
1918 if (!POINTER_TYPE_P (TREE_TYPE (node))
1919 && SSA_NAME_RANGE_INFO (node))
1921 wide_int min, max, nonzero_bits;
1922 value_range_type range_type = get_range_info (node, &min, &max);
1924 if (range_type == VR_VARYING)
1925 pp_printf (buffer, "# RANGE VR_VARYING");
1926 else if (range_type == VR_RANGE || range_type == VR_ANTI_RANGE)
1928 pp_printf (buffer, "# RANGE ");
1929 pp_printf (buffer, "%s[", range_type == VR_RANGE ? "" : "~");
1930 pp_wide_int (buffer, min, TYPE_SIGN (TREE_TYPE (node)));
1931 pp_printf (buffer, ", ");
1932 pp_wide_int (buffer, max, TYPE_SIGN (TREE_TYPE (node)));
1933 pp_printf (buffer, "]");
1935 nonzero_bits = get_nonzero_bits (node);
1936 if (nonzero_bits != -1)
1938 pp_string (buffer, " NONZERO ");
1939 pp_wide_int (buffer, nonzero_bits, UNSIGNED);
1941 newline_and_indent (buffer, spc);
1945 /* As dump_ssaname_info, but dump to FILE. */
1948 dump_ssaname_info_to_file (FILE *file, tree node, int spc)
1950 pretty_printer buffer;
1951 pp_needs_newline (&buffer) = true;
1952 buffer.buffer->stream = file;
1953 dump_ssaname_info (&buffer, node, spc);
1957 /* Dump a PHI node PHI. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1.
1958 The caller is responsible for calling pp_flush on BUFFER to finalize
1959 pretty printer. If COMMENT is true, print this after #. */
1962 dump_gimple_phi (pretty_printer *buffer, gphi *phi, int spc, bool comment,
1966 tree lhs = gimple_phi_result (phi);
1968 if (flags & TDF_ALIAS)
1969 dump_ssaname_info (buffer, lhs, spc);
1972 pp_string (buffer, "# ");
1974 if (flags & TDF_RAW)
1975 dump_gimple_fmt (buffer, spc, flags, "%G <%T, ", phi,
1976 gimple_phi_result (phi));
1979 dump_generic_node (buffer, lhs, spc, flags, false);
1980 pp_string (buffer, " = PHI <");
1982 for (i = 0; i < gimple_phi_num_args (phi); i++)
1984 if ((flags & TDF_LINENO) && gimple_phi_arg_has_location (phi, i))
1985 dump_location (buffer, gimple_phi_arg_location (phi, i));
1986 dump_generic_node (buffer, gimple_phi_arg_def (phi, i), spc, flags,
1988 pp_left_paren (buffer);
1989 pp_decimal_int (buffer, gimple_phi_arg_edge (phi, i)->src->index);
1990 pp_right_paren (buffer);
1991 if (i < gimple_phi_num_args (phi) - 1)
1992 pp_string (buffer, ", ");
1994 pp_greater (buffer);
1998 /* Dump a GIMPLE_OMP_PARALLEL tuple on the pretty_printer BUFFER, SPC spaces
1999 of indent. FLAGS specifies details to show in the dump (see TDF_* in
2003 dump_gimple_omp_parallel (pretty_printer *buffer, gomp_parallel *gs,
2006 if (flags & TDF_RAW)
2008 dump_gimple_fmt (buffer, spc, flags, "%G <%+BODY <%S>%nCLAUSES <", gs,
2009 gimple_omp_body (gs));
2010 dump_omp_clauses (buffer, gimple_omp_parallel_clauses (gs), spc, flags);
2011 dump_gimple_fmt (buffer, spc, flags, " >, %T, %T%n>",
2012 gimple_omp_parallel_child_fn (gs),
2013 gimple_omp_parallel_data_arg (gs));
2018 pp_string (buffer, "#pragma omp parallel");
2019 dump_omp_clauses (buffer, gimple_omp_parallel_clauses (gs), spc, flags);
2020 if (gimple_omp_parallel_child_fn (gs))
2022 pp_string (buffer, " [child fn: ");
2023 dump_generic_node (buffer, gimple_omp_parallel_child_fn (gs),
2025 pp_string (buffer, " (");
2026 if (gimple_omp_parallel_data_arg (gs))
2027 dump_generic_node (buffer, gimple_omp_parallel_data_arg (gs),
2030 pp_string (buffer, "???");
2031 pp_string (buffer, ")]");
2033 body = gimple_omp_body (gs);
2034 if (body && gimple_code (gimple_seq_first_stmt (body)) != GIMPLE_BIND)
2036 newline_and_indent (buffer, spc + 2);
2037 pp_left_brace (buffer);
2038 pp_newline (buffer);
2039 dump_gimple_seq (buffer, body, spc + 4, flags);
2040 newline_and_indent (buffer, spc + 2);
2041 pp_right_brace (buffer);
2045 pp_newline (buffer);
2046 dump_gimple_seq (buffer, body, spc + 2, flags);
2052 /* Dump a GIMPLE_OMP_TASK tuple on the pretty_printer BUFFER, SPC spaces
2053 of indent. FLAGS specifies details to show in the dump (see TDF_* in
2057 dump_gimple_omp_task (pretty_printer *buffer, gomp_task *gs, int spc,
2060 if (flags & TDF_RAW)
2062 dump_gimple_fmt (buffer, spc, flags, "%G <%+BODY <%S>%nCLAUSES <", gs,
2063 gimple_omp_body (gs));
2064 dump_omp_clauses (buffer, gimple_omp_task_clauses (gs), spc, flags);
2065 dump_gimple_fmt (buffer, spc, flags, " >, %T, %T, %T, %T, %T%n>",
2066 gimple_omp_task_child_fn (gs),
2067 gimple_omp_task_data_arg (gs),
2068 gimple_omp_task_copy_fn (gs),
2069 gimple_omp_task_arg_size (gs),
2070 gimple_omp_task_arg_size (gs));
2075 if (gimple_omp_task_taskloop_p (gs))
2076 pp_string (buffer, "#pragma omp taskloop");
2078 pp_string (buffer, "#pragma omp task");
2079 dump_omp_clauses (buffer, gimple_omp_task_clauses (gs), spc, flags);
2080 if (gimple_omp_task_child_fn (gs))
2082 pp_string (buffer, " [child fn: ");
2083 dump_generic_node (buffer, gimple_omp_task_child_fn (gs),
2085 pp_string (buffer, " (");
2086 if (gimple_omp_task_data_arg (gs))
2087 dump_generic_node (buffer, gimple_omp_task_data_arg (gs),
2090 pp_string (buffer, "???");
2091 pp_string (buffer, ")]");
2093 body = gimple_omp_body (gs);
2094 if (body && gimple_code (gimple_seq_first_stmt (body)) != GIMPLE_BIND)
2096 newline_and_indent (buffer, spc + 2);
2097 pp_left_brace (buffer);
2098 pp_newline (buffer);
2099 dump_gimple_seq (buffer, body, spc + 4, flags);
2100 newline_and_indent (buffer, spc + 2);
2101 pp_right_brace (buffer);
2105 pp_newline (buffer);
2106 dump_gimple_seq (buffer, body, spc + 2, flags);
2112 /* Dump a GIMPLE_OMP_ATOMIC_LOAD tuple on the pretty_printer BUFFER, SPC
2113 spaces of indent. FLAGS specifies details to show in the dump (see TDF_*
2117 dump_gimple_omp_atomic_load (pretty_printer *buffer, gomp_atomic_load *gs,
2120 if (flags & TDF_RAW)
2122 dump_gimple_fmt (buffer, spc, flags, "%G <%T, %T>", gs,
2123 gimple_omp_atomic_load_lhs (gs),
2124 gimple_omp_atomic_load_rhs (gs));
2128 pp_string (buffer, "#pragma omp atomic_load");
2129 if (gimple_omp_atomic_seq_cst_p (gs))
2130 pp_string (buffer, " seq_cst");
2131 if (gimple_omp_atomic_need_value_p (gs))
2132 pp_string (buffer, " [needed]");
2133 newline_and_indent (buffer, spc + 2);
2134 dump_generic_node (buffer, gimple_omp_atomic_load_lhs (gs),
2140 dump_generic_node (buffer, gimple_omp_atomic_load_rhs (gs),
2145 /* Dump a GIMPLE_OMP_ATOMIC_STORE tuple on the pretty_printer BUFFER, SPC
2146 spaces of indent. FLAGS specifies details to show in the dump (see TDF_*
2150 dump_gimple_omp_atomic_store (pretty_printer *buffer,
2151 gomp_atomic_store *gs, int spc, int flags)
2153 if (flags & TDF_RAW)
2155 dump_gimple_fmt (buffer, spc, flags, "%G <%T>", gs,
2156 gimple_omp_atomic_store_val (gs));
2160 pp_string (buffer, "#pragma omp atomic_store ");
2161 if (gimple_omp_atomic_seq_cst_p (gs))
2162 pp_string (buffer, "seq_cst ");
2163 if (gimple_omp_atomic_need_value_p (gs))
2164 pp_string (buffer, "[needed] ");
2165 pp_left_paren (buffer);
2166 dump_generic_node (buffer, gimple_omp_atomic_store_val (gs),
2168 pp_right_paren (buffer);
2173 /* Dump all the memory operands for statement GS. BUFFER, SPC and
2174 FLAGS are as in pp_gimple_stmt_1. */
2177 dump_gimple_mem_ops (pretty_printer *buffer, gimple *gs, int spc, int flags)
2179 tree vdef = gimple_vdef (gs);
2180 tree vuse = gimple_vuse (gs);
2182 if (vdef != NULL_TREE)
2184 pp_string (buffer, "# ");
2185 dump_generic_node (buffer, vdef, spc + 2, flags, false);
2186 pp_string (buffer, " = VDEF <");
2187 dump_generic_node (buffer, vuse, spc + 2, flags, false);
2188 pp_greater (buffer);
2189 newline_and_indent (buffer, spc);
2191 else if (vuse != NULL_TREE)
2193 pp_string (buffer, "# VUSE <");
2194 dump_generic_node (buffer, vuse, spc + 2, flags, false);
2195 pp_greater (buffer);
2196 newline_and_indent (buffer, spc);
2201 /* Print the gimple statement GS on the pretty printer BUFFER, SPC
2202 spaces of indent. FLAGS specifies details to show in the dump (see
2203 TDF_* in dumpfile.h). The caller is responsible for calling
2204 pp_flush on BUFFER to finalize the pretty printer. */
2207 pp_gimple_stmt_1 (pretty_printer *buffer, gimple *gs, int spc, int flags)
2212 if (flags & TDF_STMTADDR)
2213 pp_printf (buffer, "<&%p> ", (void *) gs);
2215 if ((flags & TDF_LINENO) && gimple_has_location (gs))
2216 dump_location (buffer, gimple_location (gs));
2220 int lp_nr = lookup_stmt_eh_lp (gs);
2222 pp_printf (buffer, "[LP %d] ", lp_nr);
2224 pp_printf (buffer, "[MNT %d] ", -lp_nr);
2227 if ((flags & (TDF_VOPS|TDF_MEMSYMS))
2228 && gimple_has_mem_ops (gs))
2229 dump_gimple_mem_ops (buffer, gs, spc, flags);
2231 if (gimple_has_lhs (gs)
2232 && (flags & TDF_ALIAS))
2233 dump_ssaname_info (buffer, gimple_get_lhs (gs), spc);
2235 switch (gimple_code (gs))
2238 dump_gimple_asm (buffer, as_a <gasm *> (gs), spc, flags);
2242 dump_gimple_assign (buffer, as_a <gassign *> (gs), spc, flags);
2246 dump_gimple_bind (buffer, as_a <gbind *> (gs), spc, flags);
2250 dump_gimple_call (buffer, as_a <gcall *> (gs), spc, flags);
2254 dump_gimple_cond (buffer, as_a <gcond *> (gs), spc, flags);
2258 dump_gimple_label (buffer, as_a <glabel *> (gs), spc, flags);
2262 dump_gimple_goto (buffer, as_a <ggoto *> (gs), spc, flags);
2266 pp_string (buffer, "GIMPLE_NOP");
2270 dump_gimple_return (buffer, as_a <greturn *> (gs), spc, flags);
2274 dump_gimple_switch (buffer, as_a <gswitch *> (gs), spc, flags);
2278 dump_gimple_try (buffer, as_a <gtry *> (gs), spc, flags);
2282 dump_gimple_phi (buffer, as_a <gphi *> (gs), spc, false, flags);
2285 case GIMPLE_OMP_PARALLEL:
2286 dump_gimple_omp_parallel (buffer, as_a <gomp_parallel *> (gs), spc,
2290 case GIMPLE_OMP_TASK:
2291 dump_gimple_omp_task (buffer, as_a <gomp_task *> (gs), spc, flags);
2294 case GIMPLE_OMP_ATOMIC_LOAD:
2295 dump_gimple_omp_atomic_load (buffer, as_a <gomp_atomic_load *> (gs),
2299 case GIMPLE_OMP_ATOMIC_STORE:
2300 dump_gimple_omp_atomic_store (buffer,
2301 as_a <gomp_atomic_store *> (gs),
2305 case GIMPLE_OMP_FOR:
2306 dump_gimple_omp_for (buffer, as_a <gomp_for *> (gs), spc, flags);
2309 case GIMPLE_OMP_CONTINUE:
2310 dump_gimple_omp_continue (buffer, as_a <gomp_continue *> (gs), spc,
2314 case GIMPLE_OMP_SINGLE:
2315 dump_gimple_omp_single (buffer, as_a <gomp_single *> (gs), spc,
2319 case GIMPLE_OMP_TARGET:
2320 dump_gimple_omp_target (buffer, as_a <gomp_target *> (gs), spc,
2324 case GIMPLE_OMP_TEAMS:
2325 dump_gimple_omp_teams (buffer, as_a <gomp_teams *> (gs), spc,
2329 case GIMPLE_OMP_RETURN:
2330 dump_gimple_omp_return (buffer, gs, spc, flags);
2333 case GIMPLE_OMP_SECTIONS:
2334 dump_gimple_omp_sections (buffer, as_a <gomp_sections *> (gs),
2338 case GIMPLE_OMP_SECTIONS_SWITCH:
2339 pp_string (buffer, "GIMPLE_SECTIONS_SWITCH");
2342 case GIMPLE_OMP_MASTER:
2343 case GIMPLE_OMP_TASKGROUP:
2344 case GIMPLE_OMP_SECTION:
2345 case GIMPLE_OMP_GRID_BODY:
2346 dump_gimple_omp_block (buffer, gs, spc, flags);
2349 case GIMPLE_OMP_ORDERED:
2350 dump_gimple_omp_ordered (buffer, as_a <gomp_ordered *> (gs), spc,
2354 case GIMPLE_OMP_CRITICAL:
2355 dump_gimple_omp_critical (buffer, as_a <gomp_critical *> (gs), spc,
2360 dump_gimple_catch (buffer, as_a <gcatch *> (gs), spc, flags);
2363 case GIMPLE_EH_FILTER:
2364 dump_gimple_eh_filter (buffer, as_a <geh_filter *> (gs), spc, flags);
2367 case GIMPLE_EH_MUST_NOT_THROW:
2368 dump_gimple_eh_must_not_throw (buffer,
2369 as_a <geh_mnt *> (gs),
2373 case GIMPLE_EH_ELSE:
2374 dump_gimple_eh_else (buffer, as_a <geh_else *> (gs), spc, flags);
2378 dump_gimple_resx (buffer, as_a <gresx *> (gs), spc, flags);
2381 case GIMPLE_EH_DISPATCH:
2382 dump_gimple_eh_dispatch (buffer, as_a <geh_dispatch *> (gs), spc,
2387 dump_gimple_debug (buffer, as_a <gdebug *> (gs), spc, flags);
2390 case GIMPLE_PREDICT:
2391 pp_string (buffer, "// predicted ");
2392 if (gimple_predict_outcome (gs))
2393 pp_string (buffer, "likely by ");
2395 pp_string (buffer, "unlikely by ");
2396 pp_string (buffer, predictor_name (gimple_predict_predictor (gs)));
2397 pp_string (buffer, " predictor.");
2400 case GIMPLE_TRANSACTION:
2401 dump_gimple_transaction (buffer, as_a <gtransaction *> (gs), spc,
2411 /* Dumps header of basic block BB to OUTF indented by INDENT
2412 spaces and details described by flags. */
2415 dump_gimple_bb_header (FILE *outf, basic_block bb, int indent, int flags)
2417 if (flags & TDF_BLOCKS)
2419 if (flags & TDF_LINENO)
2421 gimple_stmt_iterator gsi;
2423 if (flags & TDF_COMMENT)
2424 fputs (";; ", outf);
2426 for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
2427 if (!is_gimple_debug (gsi_stmt (gsi))
2428 && get_lineno (gsi_stmt (gsi)) != UNKNOWN_LOCATION)
2430 fprintf (outf, "%*sstarting at line %d",
2431 indent, "", get_lineno (gsi_stmt (gsi)));
2434 if (bb->discriminator)
2435 fprintf (outf, ", discriminator %i", bb->discriminator);
2441 gimple *stmt = first_stmt (bb);
2442 if (!stmt || gimple_code (stmt) != GIMPLE_LABEL)
2443 fprintf (outf, "%*s<bb %d>:\n", indent, "", bb->index);
2448 /* Dumps end of basic block BB to buffer BUFFER indented by INDENT
2452 dump_gimple_bb_footer (FILE *outf ATTRIBUTE_UNUSED,
2453 basic_block bb ATTRIBUTE_UNUSED,
2454 int indent ATTRIBUTE_UNUSED,
2455 int flags ATTRIBUTE_UNUSED)
2457 /* There is currently no GIMPLE-specific basic block info to dump. */
2462 /* Dump PHI nodes of basic block BB to BUFFER with details described
2463 by FLAGS and indented by INDENT spaces. */
2466 dump_phi_nodes (pretty_printer *buffer, basic_block bb, int indent, int flags)
2470 for (i = gsi_start_phis (bb); !gsi_end_p (i); gsi_next (&i))
2472 gphi *phi = i.phi ();
2473 if (!virtual_operand_p (gimple_phi_result (phi)) || (flags & TDF_VOPS))
2476 dump_gimple_phi (buffer, phi, indent, true, flags);
2477 pp_newline (buffer);
2483 /* Dump jump to basic block BB that is represented implicitly in the cfg
2487 pp_cfg_jump (pretty_printer *buffer, basic_block bb)
2491 stmt = first_stmt (bb);
2493 pp_string (buffer, "goto <bb ");
2494 pp_decimal_int (buffer, bb->index);
2495 pp_greater (buffer);
2496 if (stmt && gimple_code (stmt) == GIMPLE_LABEL)
2498 pp_string (buffer, " (");
2499 dump_generic_node (buffer,
2500 gimple_label_label (as_a <glabel *> (stmt)),
2502 pp_right_paren (buffer);
2503 pp_semicolon (buffer);
2506 pp_semicolon (buffer);
2510 /* Dump edges represented implicitly in basic block BB to BUFFER, indented
2511 by INDENT spaces, with details given by FLAGS. */
2514 dump_implicit_edges (pretty_printer *buffer, basic_block bb, int indent,
2520 stmt = last_stmt (bb);
2522 if (stmt && gimple_code (stmt) == GIMPLE_COND)
2524 edge true_edge, false_edge;
2526 /* When we are emitting the code or changing CFG, it is possible that
2527 the edges are not yet created. When we are using debug_bb in such
2528 a situation, we do not want it to crash. */
2529 if (EDGE_COUNT (bb->succs) != 2)
2531 extract_true_false_edges_from_block (bb, &true_edge, &false_edge);
2533 INDENT (indent + 2);
2534 pp_cfg_jump (buffer, true_edge->dest);
2535 newline_and_indent (buffer, indent);
2536 pp_string (buffer, "else");
2537 newline_and_indent (buffer, indent + 2);
2538 pp_cfg_jump (buffer, false_edge->dest);
2539 pp_newline (buffer);
2543 /* If there is a fallthru edge, we may need to add an artificial
2544 goto to the dump. */
2545 e = find_fallthru_edge (bb->succs);
2547 if (e && e->dest != bb->next_bb)
2551 if ((flags & TDF_LINENO)
2552 && e->goto_locus != UNKNOWN_LOCATION)
2553 dump_location (buffer, e->goto_locus);
2555 pp_cfg_jump (buffer, e->dest);
2556 pp_newline (buffer);
2561 /* Dumps basic block BB to buffer BUFFER with details described by FLAGS and
2562 indented by INDENT spaces. */
2565 gimple_dump_bb_buff (pretty_printer *buffer, basic_block bb, int indent,
2568 gimple_stmt_iterator gsi;
2570 int label_indent = indent - 2;
2572 if (label_indent < 0)
2575 dump_phi_nodes (buffer, bb, indent, flags);
2577 for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
2581 stmt = gsi_stmt (gsi);
2583 curr_indent = gimple_code (stmt) == GIMPLE_LABEL ? label_indent : indent;
2585 INDENT (curr_indent);
2586 pp_gimple_stmt_1 (buffer, stmt, curr_indent, flags);
2587 pp_newline_and_flush (buffer);
2588 gcc_checking_assert (DECL_STRUCT_FUNCTION (current_function_decl));
2589 dump_histograms_for_stmt (DECL_STRUCT_FUNCTION (current_function_decl),
2590 pp_buffer (buffer)->stream, stmt);
2593 dump_implicit_edges (buffer, bb, indent, flags);
2598 /* Dumps basic block BB to FILE with details described by FLAGS and
2599 indented by INDENT spaces. */
2602 gimple_dump_bb (FILE *file, basic_block bb, int indent, int flags)
2604 dump_gimple_bb_header (file, bb, indent, flags);
2605 if (bb->index >= NUM_FIXED_BLOCKS)
2607 pretty_printer buffer;
2608 pp_needs_newline (&buffer) = true;
2609 buffer.buffer->stream = file;
2610 gimple_dump_bb_buff (&buffer, bb, indent, flags);
2612 dump_gimple_bb_footer (file, bb, indent, flags);
2615 /* Dumps basic block BB to pretty-printer PP with default dump flags and
2616 no indentation, for use as a label of a DOT graph record-node.
2617 ??? Should just use gimple_dump_bb_buff here, except that value profiling
2618 histogram dumping doesn't know about pretty-printers. */
2621 gimple_dump_bb_for_graph (pretty_printer *pp, basic_block bb)
2623 pp_printf (pp, "<bb %d>:\n", bb->index);
2624 pp_write_text_as_dot_label_to_stream (pp, /*for_record=*/true);
2626 for (gphi_iterator gsi = gsi_start_phis (bb); !gsi_end_p (gsi);
2629 gphi *phi = gsi.phi ();
2630 if (!virtual_operand_p (gimple_phi_result (phi))
2631 || (dump_flags & TDF_VOPS))
2634 pp_write_text_to_stream (pp);
2635 pp_string (pp, "# ");
2636 pp_gimple_stmt_1 (pp, phi, 0, dump_flags);
2638 pp_write_text_as_dot_label_to_stream (pp, /*for_record=*/true);
2642 for (gimple_stmt_iterator gsi = gsi_start_bb (bb); !gsi_end_p (gsi);
2645 gimple *stmt = gsi_stmt (gsi);
2647 pp_write_text_to_stream (pp);
2648 pp_gimple_stmt_1 (pp, stmt, 0, dump_flags);
2650 pp_write_text_as_dot_label_to_stream (pp, /*for_record=*/true);
2652 dump_implicit_edges (pp, bb, 0, dump_flags);
2653 pp_write_text_as_dot_label_to_stream (pp, /*for_record=*/true);