1 /* Pretty formatting of GIMPLE statements and expressions.
2 Copyright (C) 2001-2014 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"
27 #include "stringpool.h"
28 #include "diagnostic.h"
29 #include "gimple-pretty-print.h"
32 #include "basic-block.h"
33 #include "tree-ssa-alias.h"
34 #include "internal-fn.h"
36 #include "gimple-expr.h"
39 #include "gimple-iterator.h"
40 #include "gimple-ssa.h"
43 #include "tree-ssanames.h"
44 #include "dumpfile.h" /* for dump_flags */
45 #include "value-prof.h"
46 #include "trans-mem.h"
48 #define INDENT(SPACE) \
49 do { int i; for (i = 0; i < SPACE; i++) pp_space (buffer); } while (0)
51 #define GIMPLE_NIY do_niy (buffer,gs)
53 /* Try to print on BUFFER a default message for the unrecognized
54 gimple statement GS. */
57 do_niy (pretty_printer
*buffer
, gimple gs
)
59 pp_printf (buffer
, "<<< Unknown GIMPLE statement: %s >>>\n",
60 gimple_code_name
[(int) gimple_code (gs
)]);
64 /* Emit a newline and SPC indentation spaces to BUFFER. */
67 newline_and_indent (pretty_printer
*buffer
, int spc
)
74 /* Print the GIMPLE statement GS on stderr. */
77 debug_gimple_stmt (gimple gs
)
79 print_gimple_stmt (stderr
, gs
, 0, TDF_VOPS
|TDF_MEMSYMS
);
83 /* Print GIMPLE statement G to FILE using SPC indentation spaces and
84 FLAGS as in pp_gimple_stmt_1. */
87 print_gimple_stmt (FILE *file
, gimple g
, int spc
, int flags
)
89 pretty_printer buffer
;
90 pp_needs_newline (&buffer
) = true;
91 buffer
.buffer
->stream
= file
;
92 pp_gimple_stmt_1 (&buffer
, g
, spc
, flags
);
93 pp_newline_and_flush (&buffer
);
97 debug (gimple_statement_base
&ref
)
99 print_gimple_stmt (stderr
, &ref
, 0, 0);
103 debug (gimple_statement_base
*ptr
)
108 fprintf (stderr
, "<nil>\n");
112 /* Print GIMPLE statement G to FILE using SPC indentation spaces and
113 FLAGS as in pp_gimple_stmt_1. Print only the right-hand side
117 print_gimple_expr (FILE *file
, gimple g
, int spc
, int flags
)
119 flags
|= TDF_RHS_ONLY
;
120 pretty_printer buffer
;
121 pp_needs_newline (&buffer
) = true;
122 buffer
.buffer
->stream
= file
;
123 pp_gimple_stmt_1 (&buffer
, g
, spc
, flags
);
128 /* Print the GIMPLE sequence SEQ on BUFFER using SPC indentation
129 spaces and FLAGS as in pp_gimple_stmt_1.
130 The caller is responsible for calling pp_flush on BUFFER to finalize
131 the pretty printer. */
134 dump_gimple_seq (pretty_printer
*buffer
, gimple_seq seq
, int spc
, int flags
)
136 gimple_stmt_iterator i
;
138 for (i
= gsi_start (seq
); !gsi_end_p (i
); gsi_next (&i
))
140 gimple gs
= gsi_stmt (i
);
142 pp_gimple_stmt_1 (buffer
, gs
, spc
, flags
);
143 if (!gsi_one_before_end_p (i
))
149 /* Print GIMPLE sequence SEQ to FILE using SPC indentation spaces and
150 FLAGS as in pp_gimple_stmt_1. */
153 print_gimple_seq (FILE *file
, gimple_seq seq
, int spc
, int flags
)
155 pretty_printer buffer
;
156 pp_needs_newline (&buffer
) = true;
157 buffer
.buffer
->stream
= file
;
158 dump_gimple_seq (&buffer
, seq
, spc
, flags
);
159 pp_newline_and_flush (&buffer
);
163 /* Print the GIMPLE sequence SEQ on stderr. */
166 debug_gimple_seq (gimple_seq seq
)
168 print_gimple_seq (stderr
, seq
, 0, TDF_VOPS
|TDF_MEMSYMS
);
172 /* A simple helper to pretty-print some of the gimple tuples in the printf
173 style. The format modifiers are preceded by '%' and are:
174 'G' - outputs a string corresponding to the code of the given gimple,
175 'S' - outputs a gimple_seq with indent of spc + 2,
176 'T' - outputs the tree t,
177 'd' - outputs an int as a decimal,
178 's' - outputs a string,
179 'n' - outputs a newline,
180 'x' - outputs an int as hexadecimal,
181 '+' - increases indent by 2 then outputs a newline,
182 '-' - decreases indent by 2 then outputs a newline. */
185 dump_gimple_fmt (pretty_printer
*buffer
, int spc
, int flags
,
186 const char *fmt
, ...)
192 va_start (args
, fmt
);
193 for (c
= fmt
; *c
; c
++)
203 g
= va_arg (args
, gimple
);
204 tmp
= gimple_code_name
[gimple_code (g
)];
205 pp_string (buffer
, tmp
);
209 seq
= va_arg (args
, gimple_seq
);
211 dump_gimple_seq (buffer
, seq
, spc
+ 2, flags
);
212 newline_and_indent (buffer
, spc
);
216 t
= va_arg (args
, tree
);
218 pp_string (buffer
, "NULL");
220 dump_generic_node (buffer
, t
, spc
, flags
, false);
224 pp_decimal_int (buffer
, va_arg (args
, int));
228 pp_string (buffer
, va_arg (args
, char *));
232 newline_and_indent (buffer
, spc
);
236 pp_scalar (buffer
, "%x", va_arg (args
, int));
241 newline_and_indent (buffer
, spc
);
246 newline_and_indent (buffer
, spc
);
254 pp_character (buffer
, *c
);
260 /* Helper for dump_gimple_assign. Print the unary RHS of the
261 assignment GS. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. */
264 dump_unary_rhs (pretty_printer
*buffer
, gimple_assign gs
, int spc
, int flags
)
266 enum tree_code rhs_code
= gimple_assign_rhs_code (gs
);
267 tree lhs
= gimple_assign_lhs (gs
);
268 tree rhs
= gimple_assign_rhs1 (gs
);
272 case VIEW_CONVERT_EXPR
:
274 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
277 case FIXED_CONVERT_EXPR
:
278 case ADDR_SPACE_CONVERT_EXPR
:
282 pp_left_paren (buffer
);
283 dump_generic_node (buffer
, TREE_TYPE (lhs
), spc
, flags
, false);
284 pp_string (buffer
, ") ");
285 if (op_prio (rhs
) < op_code_prio (rhs_code
))
287 pp_left_paren (buffer
);
288 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
289 pp_right_paren (buffer
);
292 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
296 pp_string (buffer
, "((");
297 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
298 pp_string (buffer
, "))");
302 pp_string (buffer
, "ABS_EXPR <");
303 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
308 if (TREE_CODE_CLASS (rhs_code
) == tcc_declaration
309 || TREE_CODE_CLASS (rhs_code
) == tcc_constant
310 || TREE_CODE_CLASS (rhs_code
) == tcc_reference
311 || rhs_code
== SSA_NAME
312 || rhs_code
== ADDR_EXPR
313 || rhs_code
== CONSTRUCTOR
)
315 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
318 else if (rhs_code
== BIT_NOT_EXPR
)
319 pp_complement (buffer
);
320 else if (rhs_code
== TRUTH_NOT_EXPR
)
321 pp_exclamation (buffer
);
322 else if (rhs_code
== NEGATE_EXPR
)
326 pp_left_bracket (buffer
);
327 pp_string (buffer
, get_tree_code_name (rhs_code
));
328 pp_string (buffer
, "] ");
331 if (op_prio (rhs
) < op_code_prio (rhs_code
))
333 pp_left_paren (buffer
);
334 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
335 pp_right_paren (buffer
);
338 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
344 /* Helper for dump_gimple_assign. Print the binary RHS of the
345 assignment GS. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. */
348 dump_binary_rhs (pretty_printer
*buffer
, gimple_assign gs
, int spc
, int flags
)
351 enum tree_code code
= gimple_assign_rhs_code (gs
);
357 case VEC_WIDEN_MULT_HI_EXPR
:
358 case VEC_WIDEN_MULT_LO_EXPR
:
359 case VEC_WIDEN_MULT_EVEN_EXPR
:
360 case VEC_WIDEN_MULT_ODD_EXPR
:
361 case VEC_PACK_TRUNC_EXPR
:
362 case VEC_PACK_SAT_EXPR
:
363 case VEC_PACK_FIX_TRUNC_EXPR
:
364 case VEC_WIDEN_LSHIFT_HI_EXPR
:
365 case VEC_WIDEN_LSHIFT_LO_EXPR
:
366 for (p
= get_tree_code_name (code
); *p
; p
++)
367 pp_character (buffer
, TOUPPER (*p
));
368 pp_string (buffer
, " <");
369 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
370 pp_string (buffer
, ", ");
371 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
376 if (op_prio (gimple_assign_rhs1 (gs
)) <= op_code_prio (code
))
378 pp_left_paren (buffer
);
379 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
,
381 pp_right_paren (buffer
);
384 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
386 pp_string (buffer
, op_symbol_code (gimple_assign_rhs_code (gs
)));
388 if (op_prio (gimple_assign_rhs2 (gs
)) <= op_code_prio (code
))
390 pp_left_paren (buffer
);
391 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
,
393 pp_right_paren (buffer
);
396 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
400 /* Helper for dump_gimple_assign. Print the ternary RHS of the
401 assignment GS. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. */
404 dump_ternary_rhs (pretty_printer
*buffer
, gimple_assign gs
, int spc
, int flags
)
407 enum tree_code code
= gimple_assign_rhs_code (gs
);
410 case WIDEN_MULT_PLUS_EXPR
:
411 case WIDEN_MULT_MINUS_EXPR
:
412 for (p
= get_tree_code_name (code
); *p
; p
++)
413 pp_character (buffer
, TOUPPER (*p
));
414 pp_string (buffer
, " <");
415 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
416 pp_string (buffer
, ", ");
417 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
418 pp_string (buffer
, ", ");
419 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
424 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
425 pp_string (buffer
, " * ");
426 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
427 pp_string (buffer
, " + ");
428 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
432 pp_string (buffer
, "DOT_PROD_EXPR <");
433 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
434 pp_string (buffer
, ", ");
435 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
436 pp_string (buffer
, ", ");
437 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
442 pp_string (buffer
, "SAD_EXPR <");
443 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
444 pp_string (buffer
, ", ");
445 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
446 pp_string (buffer
, ", ");
447 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
452 pp_string (buffer
, "VEC_PERM_EXPR <");
453 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
454 pp_string (buffer
, ", ");
455 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
456 pp_string (buffer
, ", ");
457 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
461 case REALIGN_LOAD_EXPR
:
462 pp_string (buffer
, "REALIGN_LOAD <");
463 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
464 pp_string (buffer
, ", ");
465 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
466 pp_string (buffer
, ", ");
467 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
472 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
473 pp_string (buffer
, " ? ");
474 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
475 pp_string (buffer
, " : ");
476 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
480 pp_string (buffer
, "VEC_COND_EXPR <");
481 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
482 pp_string (buffer
, ", ");
483 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
484 pp_string (buffer
, ", ");
485 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
495 /* Dump the gimple assignment GS. BUFFER, SPC and FLAGS are as in
499 dump_gimple_assign (pretty_printer
*buffer
, gimple_assign gs
, int spc
, int flags
)
506 switch (gimple_num_ops (gs
))
509 arg3
= gimple_assign_rhs3 (gs
);
511 arg2
= gimple_assign_rhs2 (gs
);
513 arg1
= gimple_assign_rhs1 (gs
);
519 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%s, %T, %T, %T, %T>", gs
,
520 get_tree_code_name (gimple_assign_rhs_code (gs
)),
521 gimple_assign_lhs (gs
), arg1
, arg2
, arg3
);
525 if (!(flags
& TDF_RHS_ONLY
))
527 dump_generic_node (buffer
, gimple_assign_lhs (gs
), spc
, flags
, false);
531 if (gimple_assign_nontemporal_move_p (gs
))
532 pp_string (buffer
, "{nt}");
534 if (gimple_has_volatile_ops (gs
))
535 pp_string (buffer
, "{v}");
540 if (gimple_num_ops (gs
) == 2)
541 dump_unary_rhs (buffer
, gs
, spc
, flags
);
542 else if (gimple_num_ops (gs
) == 3)
543 dump_binary_rhs (buffer
, gs
, spc
, flags
);
544 else if (gimple_num_ops (gs
) == 4)
545 dump_ternary_rhs (buffer
, gs
, spc
, flags
);
548 if (!(flags
& TDF_RHS_ONLY
))
549 pp_semicolon (buffer
);
554 /* Dump the return statement GS. BUFFER, SPC and FLAGS are as in
558 dump_gimple_return (pretty_printer
*buffer
, gimple_return gs
, int spc
, int flags
)
562 t
= gimple_return_retval (gs
);
564 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
, t
);
567 pp_string (buffer
, "return");
571 dump_generic_node (buffer
, t
, spc
, flags
, false);
573 pp_semicolon (buffer
);
578 /* Dump the call arguments for a gimple call. BUFFER, FLAGS are as in
582 dump_gimple_call_args (pretty_printer
*buffer
, gimple_call gs
, int flags
)
586 for (i
= 0; i
< gimple_call_num_args (gs
); i
++)
588 dump_generic_node (buffer
, gimple_call_arg (gs
, i
), 0, flags
, false);
589 if (i
< gimple_call_num_args (gs
) - 1)
590 pp_string (buffer
, ", ");
593 if (gimple_call_va_arg_pack_p (gs
))
595 if (gimple_call_num_args (gs
) > 0)
601 pp_string (buffer
, "__builtin_va_arg_pack ()");
605 /* Dump the points-to solution *PT to BUFFER. */
608 pp_points_to_solution (pretty_printer
*buffer
, struct pt_solution
*pt
)
612 pp_string (buffer
, "anything ");
616 pp_string (buffer
, "nonlocal ");
618 pp_string (buffer
, "escaped ");
620 pp_string (buffer
, "unit-escaped ");
622 pp_string (buffer
, "null ");
624 && !bitmap_empty_p (pt
->vars
))
628 pp_string (buffer
, "{ ");
629 EXECUTE_IF_SET_IN_BITMAP (pt
->vars
, 0, i
, bi
)
631 pp_string (buffer
, "D.");
632 pp_decimal_int (buffer
, i
);
635 pp_right_brace (buffer
);
636 if (pt
->vars_contains_nonlocal
637 && pt
->vars_contains_escaped_heap
)
638 pp_string (buffer
, " (nonlocal, escaped heap)");
639 else if (pt
->vars_contains_nonlocal
640 && pt
->vars_contains_escaped
)
641 pp_string (buffer
, " (nonlocal, escaped)");
642 else if (pt
->vars_contains_nonlocal
)
643 pp_string (buffer
, " (nonlocal)");
644 else if (pt
->vars_contains_escaped_heap
)
645 pp_string (buffer
, " (escaped heap)");
646 else if (pt
->vars_contains_escaped
)
647 pp_string (buffer
, " (escaped)");
651 /* Dump the call statement GS. BUFFER, SPC and FLAGS are as in
655 dump_gimple_call (pretty_printer
*buffer
, gimple_call gs
, int spc
, int flags
)
657 tree lhs
= gimple_call_lhs (gs
);
658 tree fn
= gimple_call_fn (gs
);
660 if (flags
& TDF_ALIAS
)
662 struct pt_solution
*pt
;
663 pt
= gimple_call_use_set (gs
);
664 if (!pt_solution_empty_p (pt
))
666 pp_string (buffer
, "# USE = ");
667 pp_points_to_solution (buffer
, pt
);
668 newline_and_indent (buffer
, spc
);
670 pt
= gimple_call_clobber_set (gs
);
671 if (!pt_solution_empty_p (pt
))
673 pp_string (buffer
, "# CLB = ");
674 pp_points_to_solution (buffer
, pt
);
675 newline_and_indent (buffer
, spc
);
681 if (gimple_call_internal_p (gs
))
682 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%s, %T", gs
,
683 internal_fn_name (gimple_call_internal_fn (gs
)), lhs
);
685 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T", gs
, fn
, lhs
);
686 if (gimple_call_num_args (gs
) > 0)
688 pp_string (buffer
, ", ");
689 dump_gimple_call_args (buffer
, gs
, flags
);
695 if (lhs
&& !(flags
& TDF_RHS_ONLY
))
697 dump_generic_node (buffer
, lhs
, spc
, flags
, false);
698 pp_string (buffer
, " =");
700 if (gimple_has_volatile_ops (gs
))
701 pp_string (buffer
, "{v}");
705 if (gimple_call_internal_p (gs
))
706 pp_string (buffer
, internal_fn_name (gimple_call_internal_fn (gs
)));
708 print_call_name (buffer
, fn
, flags
);
709 pp_string (buffer
, " (");
710 dump_gimple_call_args (buffer
, gs
, flags
);
711 pp_right_paren (buffer
);
712 if (!(flags
& TDF_RHS_ONLY
))
713 pp_semicolon (buffer
);
716 if (gimple_call_chain (gs
))
718 pp_string (buffer
, " [static-chain: ");
719 dump_generic_node (buffer
, gimple_call_chain (gs
), spc
, flags
, false);
720 pp_right_bracket (buffer
);
723 if (gimple_call_return_slot_opt_p (gs
))
724 pp_string (buffer
, " [return slot optimization]");
725 if (gimple_call_tail_p (gs
))
726 pp_string (buffer
, " [tail call]");
731 /* Dump the arguments of _ITM_beginTransaction sanely. */
732 if (TREE_CODE (fn
) == ADDR_EXPR
)
733 fn
= TREE_OPERAND (fn
, 0);
734 if (TREE_CODE (fn
) == FUNCTION_DECL
&& decl_is_tm_clone (fn
))
735 pp_string (buffer
, " [tm-clone]");
736 if (TREE_CODE (fn
) == FUNCTION_DECL
737 && DECL_BUILT_IN_CLASS (fn
) == BUILT_IN_NORMAL
738 && DECL_FUNCTION_CODE (fn
) == BUILT_IN_TM_START
739 && gimple_call_num_args (gs
) > 0)
741 tree t
= gimple_call_arg (gs
, 0);
742 unsigned HOST_WIDE_INT props
;
743 gcc_assert (TREE_CODE (t
) == INTEGER_CST
);
745 pp_string (buffer
, " [ ");
747 /* Get the transaction code properties. */
748 props
= TREE_INT_CST_LOW (t
);
750 if (props
& PR_INSTRUMENTEDCODE
)
751 pp_string (buffer
, "instrumentedCode ");
752 if (props
& PR_UNINSTRUMENTEDCODE
)
753 pp_string (buffer
, "uninstrumentedCode ");
754 if (props
& PR_HASNOXMMUPDATE
)
755 pp_string (buffer
, "hasNoXMMUpdate ");
756 if (props
& PR_HASNOABORT
)
757 pp_string (buffer
, "hasNoAbort ");
758 if (props
& PR_HASNOIRREVOCABLE
)
759 pp_string (buffer
, "hasNoIrrevocable ");
760 if (props
& PR_DOESGOIRREVOCABLE
)
761 pp_string (buffer
, "doesGoIrrevocable ");
762 if (props
& PR_HASNOSIMPLEREADS
)
763 pp_string (buffer
, "hasNoSimpleReads ");
764 if (props
& PR_AWBARRIERSOMITTED
)
765 pp_string (buffer
, "awBarriersOmitted ");
766 if (props
& PR_RARBARRIERSOMITTED
)
767 pp_string (buffer
, "RaRBarriersOmitted ");
768 if (props
& PR_UNDOLOGCODE
)
769 pp_string (buffer
, "undoLogCode ");
770 if (props
& PR_PREFERUNINSTRUMENTED
)
771 pp_string (buffer
, "preferUninstrumented ");
772 if (props
& PR_EXCEPTIONBLOCK
)
773 pp_string (buffer
, "exceptionBlock ");
774 if (props
& PR_HASELSE
)
775 pp_string (buffer
, "hasElse ");
776 if (props
& PR_READONLY
)
777 pp_string (buffer
, "readOnly ");
779 pp_right_bracket (buffer
);
784 /* Dump the switch statement GS. BUFFER, SPC and FLAGS are as in
788 dump_gimple_switch (pretty_printer
*buffer
, gimple_switch gs
, int spc
,
793 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
795 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, ", gs
,
796 gimple_switch_index (gs
));
799 pp_string (buffer
, "switch (");
800 dump_generic_node (buffer
, gimple_switch_index (gs
), spc
, flags
, true);
801 pp_string (buffer
, ") <");
804 for (i
= 0; i
< gimple_switch_num_labels (gs
); i
++)
806 tree case_label
= gimple_switch_label (gs
, i
);
807 gcc_checking_assert (case_label
!= NULL_TREE
);
808 dump_generic_node (buffer
, case_label
, spc
, flags
, false);
810 dump_generic_node (buffer
, CASE_LABEL (case_label
), spc
, flags
, false);
811 if (i
< gimple_switch_num_labels (gs
) - 1)
812 pp_string (buffer
, ", ");
818 /* Dump the gimple conditional GS. BUFFER, SPC and FLAGS are as in
822 dump_gimple_cond (pretty_printer
*buffer
, gimple_cond gs
, int spc
, int flags
)
825 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%s, %T, %T, %T, %T>", gs
,
826 get_tree_code_name (gimple_cond_code (gs
)),
827 gimple_cond_lhs (gs
), gimple_cond_rhs (gs
),
828 gimple_cond_true_label (gs
), gimple_cond_false_label (gs
));
831 if (!(flags
& TDF_RHS_ONLY
))
832 pp_string (buffer
, "if (");
833 dump_generic_node (buffer
, gimple_cond_lhs (gs
), spc
, flags
, false);
835 pp_string (buffer
, op_symbol_code (gimple_cond_code (gs
)));
837 dump_generic_node (buffer
, gimple_cond_rhs (gs
), spc
, flags
, false);
838 if (!(flags
& TDF_RHS_ONLY
))
840 pp_right_paren (buffer
);
842 if (gimple_cond_true_label (gs
))
844 pp_string (buffer
, " goto ");
845 dump_generic_node (buffer
, gimple_cond_true_label (gs
),
847 pp_semicolon (buffer
);
849 if (gimple_cond_false_label (gs
))
851 pp_string (buffer
, " else goto ");
852 dump_generic_node (buffer
, gimple_cond_false_label (gs
),
854 pp_semicolon (buffer
);
861 /* Dump a GIMPLE_LABEL tuple on the pretty_printer BUFFER, SPC
862 spaces of indent. FLAGS specifies details to show in the dump (see
863 TDF_* in dumpfils.h). */
866 dump_gimple_label (pretty_printer
*buffer
, gimple_label gs
, int spc
, int flags
)
868 tree label
= gimple_label_label (gs
);
870 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
, label
);
873 dump_generic_node (buffer
, label
, spc
, flags
, false);
876 if (DECL_NONLOCAL (label
))
877 pp_string (buffer
, " [non-local]");
878 if ((flags
& TDF_EH
) && EH_LANDING_PAD_NR (label
))
879 pp_printf (buffer
, " [LP %d]", EH_LANDING_PAD_NR (label
));
882 /* Dump a GIMPLE_GOTO tuple on the pretty_printer BUFFER, SPC
883 spaces of indent. FLAGS specifies details to show in the dump (see
884 TDF_* in dumpfile.h). */
887 dump_gimple_goto (pretty_printer
*buffer
, gimple_goto gs
, int spc
, int flags
)
889 tree label
= gimple_goto_dest (gs
);
891 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
, label
);
893 dump_gimple_fmt (buffer
, spc
, flags
, "goto %T;", label
);
897 /* Dump a GIMPLE_BIND tuple on the pretty_printer BUFFER, SPC
898 spaces of indent. FLAGS specifies details to show in the dump (see
899 TDF_* in dumpfile.h). */
902 dump_gimple_bind (pretty_printer
*buffer
, gimple_bind gs
, int spc
, int flags
)
905 dump_gimple_fmt (buffer
, spc
, flags
, "%G <", gs
);
907 pp_left_brace (buffer
);
908 if (!(flags
& TDF_SLIM
))
912 for (var
= gimple_bind_vars (gs
); var
; var
= DECL_CHAIN (var
))
914 newline_and_indent (buffer
, 2);
915 print_declaration (buffer
, var
, spc
, flags
);
917 if (gimple_bind_vars (gs
))
921 dump_gimple_seq (buffer
, gimple_bind_body (gs
), spc
+ 2, flags
);
922 newline_and_indent (buffer
, spc
);
926 pp_right_brace (buffer
);
930 /* Dump a GIMPLE_TRY tuple on the pretty_printer BUFFER, SPC spaces of
931 indent. FLAGS specifies details to show in the dump (see TDF_* in
935 dump_gimple_try (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
940 if (gimple_try_kind (gs
) == GIMPLE_TRY_CATCH
)
941 type
= "GIMPLE_TRY_CATCH";
942 else if (gimple_try_kind (gs
) == GIMPLE_TRY_FINALLY
)
943 type
= "GIMPLE_TRY_FINALLY";
945 type
= "UNKNOWN GIMPLE_TRY";
946 dump_gimple_fmt (buffer
, spc
, flags
,
947 "%G <%s,%+EVAL <%S>%nCLEANUP <%S>%->", gs
, type
,
948 gimple_try_eval (gs
), gimple_try_cleanup (gs
));
952 pp_string (buffer
, "try");
953 newline_and_indent (buffer
, spc
+ 2);
954 pp_left_brace (buffer
);
957 dump_gimple_seq (buffer
, gimple_try_eval (gs
), spc
+ 4, flags
);
958 newline_and_indent (buffer
, spc
+ 2);
959 pp_right_brace (buffer
);
961 if (gimple_try_kind (gs
) == GIMPLE_TRY_CATCH
)
963 newline_and_indent (buffer
, spc
);
964 pp_string (buffer
, "catch");
965 newline_and_indent (buffer
, spc
+ 2);
966 pp_left_brace (buffer
);
968 else if (gimple_try_kind (gs
) == GIMPLE_TRY_FINALLY
)
970 newline_and_indent (buffer
, spc
);
971 pp_string (buffer
, "finally");
972 newline_and_indent (buffer
, spc
+ 2);
973 pp_left_brace (buffer
);
976 pp_string (buffer
, " <UNKNOWN GIMPLE_TRY> {");
979 dump_gimple_seq (buffer
, gimple_try_cleanup (gs
), spc
+ 4, flags
);
980 newline_and_indent (buffer
, spc
+ 2);
981 pp_right_brace (buffer
);
986 /* Dump a GIMPLE_CATCH tuple on the pretty_printer BUFFER, SPC spaces of
987 indent. FLAGS specifies details to show in the dump (see TDF_* in
991 dump_gimple_catch (pretty_printer
*buffer
, gimple_catch gs
, int spc
, int flags
)
994 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %+CATCH <%S>%->", gs
,
995 gimple_catch_types (gs
), gimple_catch_handler (gs
));
997 dump_gimple_fmt (buffer
, spc
, flags
, "catch (%T)%+{%S}",
998 gimple_catch_types (gs
), gimple_catch_handler (gs
));
1002 /* Dump a GIMPLE_EH_FILTER tuple on the pretty_printer BUFFER, SPC spaces of
1003 indent. FLAGS specifies details to show in the dump (see TDF_* in
1007 dump_gimple_eh_filter (pretty_printer
*buffer
, gimple_eh_filter gs
, int spc
,
1010 if (flags
& TDF_RAW
)
1011 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %+FAILURE <%S>%->", gs
,
1012 gimple_eh_filter_types (gs
),
1013 gimple_eh_filter_failure (gs
));
1015 dump_gimple_fmt (buffer
, spc
, flags
, "<<<eh_filter (%T)>>>%+{%+%S%-}",
1016 gimple_eh_filter_types (gs
),
1017 gimple_eh_filter_failure (gs
));
1021 /* Dump a GIMPLE_EH_MUST_NOT_THROW tuple. */
1024 dump_gimple_eh_must_not_throw (pretty_printer
*buffer
,
1025 gimple_eh_must_not_throw gs
, int spc
, int flags
)
1027 if (flags
& TDF_RAW
)
1028 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
,
1029 gimple_eh_must_not_throw_fndecl (gs
));
1031 dump_gimple_fmt (buffer
, spc
, flags
, "<<<eh_must_not_throw (%T)>>>",
1032 gimple_eh_must_not_throw_fndecl (gs
));
1036 /* Dump a GIMPLE_EH_ELSE tuple on the pretty_printer BUFFER, SPC spaces of
1037 indent. FLAGS specifies details to show in the dump (see TDF_* in
1041 dump_gimple_eh_else (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1043 if (flags
& TDF_RAW
)
1044 dump_gimple_fmt (buffer
, spc
, flags
,
1045 "%G <%+N_BODY <%S>%nE_BODY <%S>%->", gs
,
1046 gimple_eh_else_n_body (gs
), gimple_eh_else_e_body (gs
));
1048 dump_gimple_fmt (buffer
, spc
, flags
,
1049 "<<<if_normal_exit>>>%+{%S}%-<<<else_eh_exit>>>%+{%S}",
1050 gimple_eh_else_n_body (gs
), gimple_eh_else_e_body (gs
));
1054 /* Dump a GIMPLE_RESX tuple on the pretty_printer BUFFER, SPC spaces of
1055 indent. FLAGS specifies details to show in the dump (see TDF_* in
1059 dump_gimple_resx (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1061 if (flags
& TDF_RAW
)
1062 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%d>", gs
,
1063 gimple_resx_region (gs
));
1065 dump_gimple_fmt (buffer
, spc
, flags
, "resx %d", gimple_resx_region (gs
));
1068 /* Dump a GIMPLE_EH_DISPATCH tuple on the pretty_printer BUFFER. */
1071 dump_gimple_eh_dispatch (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1073 if (flags
& TDF_RAW
)
1074 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%d>", gs
,
1075 gimple_eh_dispatch_region (gs
));
1077 dump_gimple_fmt (buffer
, spc
, flags
, "eh_dispatch %d",
1078 gimple_eh_dispatch_region (gs
));
1081 /* Dump a GIMPLE_DEBUG tuple on the pretty_printer BUFFER, SPC spaces
1082 of indent. FLAGS specifies details to show in the dump (see TDF_*
1086 dump_gimple_debug (pretty_printer
*buffer
, gimple_debug gs
, int spc
, int flags
)
1088 switch (gs
->subcode
)
1090 case GIMPLE_DEBUG_BIND
:
1091 if (flags
& TDF_RAW
)
1092 dump_gimple_fmt (buffer
, spc
, flags
, "%G BIND <%T, %T>", gs
,
1093 gimple_debug_bind_get_var (gs
),
1094 gimple_debug_bind_get_value (gs
));
1096 dump_gimple_fmt (buffer
, spc
, flags
, "# DEBUG %T => %T",
1097 gimple_debug_bind_get_var (gs
),
1098 gimple_debug_bind_get_value (gs
));
1101 case GIMPLE_DEBUG_SOURCE_BIND
:
1102 if (flags
& TDF_RAW
)
1103 dump_gimple_fmt (buffer
, spc
, flags
, "%G SRCBIND <%T, %T>", gs
,
1104 gimple_debug_source_bind_get_var (gs
),
1105 gimple_debug_source_bind_get_value (gs
));
1107 dump_gimple_fmt (buffer
, spc
, flags
, "# DEBUG %T s=> %T",
1108 gimple_debug_source_bind_get_var (gs
),
1109 gimple_debug_source_bind_get_value (gs
));
1117 /* Dump a GIMPLE_OMP_FOR tuple on the pretty_printer BUFFER. */
1119 dump_gimple_omp_for (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1123 if (flags
& TDF_RAW
)
1126 switch (gimple_omp_for_kind (gs
))
1128 case GF_OMP_FOR_KIND_FOR
:
1131 case GF_OMP_FOR_KIND_SIMD
:
1134 case GF_OMP_FOR_KIND_CILKSIMD
:
1137 case GF_OMP_FOR_KIND_DISTRIBUTE
:
1138 kind
= " distribute";
1140 case GF_OMP_FOR_KIND_CILKFOR
:
1141 kind
= " _Cilk_for";
1146 dump_gimple_fmt (buffer
, spc
, flags
, "%G%s <%+BODY <%S>%nCLAUSES <", gs
,
1147 kind
, gimple_omp_body (gs
));
1148 dump_omp_clauses (buffer
, gimple_omp_for_clauses (gs
), spc
, flags
);
1149 dump_gimple_fmt (buffer
, spc
, flags
, " >,");
1150 for (i
= 0; i
< gimple_omp_for_collapse (gs
); i
++)
1151 dump_gimple_fmt (buffer
, spc
, flags
,
1152 "%+%T, %T, %T, %s, %T,%n",
1153 gimple_omp_for_index (gs
, i
),
1154 gimple_omp_for_initial (gs
, i
),
1155 gimple_omp_for_final (gs
, i
),
1156 get_tree_code_name (gimple_omp_for_cond (gs
, i
)),
1157 gimple_omp_for_incr (gs
, i
));
1158 dump_gimple_fmt (buffer
, spc
, flags
, "PRE_BODY <%S>%->",
1159 gimple_omp_for_pre_body (gs
));
1163 switch (gimple_omp_for_kind (gs
))
1165 case GF_OMP_FOR_KIND_FOR
:
1166 pp_string (buffer
, "#pragma omp for");
1168 case GF_OMP_FOR_KIND_SIMD
:
1169 pp_string (buffer
, "#pragma omp simd");
1171 case GF_OMP_FOR_KIND_CILKSIMD
:
1172 pp_string (buffer
, "#pragma simd");
1174 case GF_OMP_FOR_KIND_DISTRIBUTE
:
1175 pp_string (buffer
, "#pragma omp distribute");
1177 case GF_OMP_FOR_KIND_CILKFOR
:
1182 if (gimple_omp_for_kind (gs
) != GF_OMP_FOR_KIND_CILKFOR
)
1183 dump_omp_clauses (buffer
, gimple_omp_for_clauses (gs
), spc
, flags
);
1184 for (i
= 0; i
< gimple_omp_for_collapse (gs
); i
++)
1188 if (gimple_omp_for_kind (gs
) == GF_OMP_FOR_KIND_CILKFOR
)
1189 pp_string (buffer
, "_Cilk_for (");
1192 newline_and_indent (buffer
, spc
);
1193 pp_string (buffer
, "for (");
1195 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
1197 pp_string (buffer
, " = ");
1198 dump_generic_node (buffer
, gimple_omp_for_initial (gs
, i
), spc
,
1200 pp_string (buffer
, "; ");
1202 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
1205 switch (gimple_omp_for_cond (gs
, i
))
1211 pp_greater (buffer
);
1214 pp_less_equal (buffer
);
1217 pp_greater_equal (buffer
);
1220 pp_string (buffer
, "!=");
1226 dump_generic_node (buffer
, gimple_omp_for_final (gs
, i
), spc
,
1228 pp_string (buffer
, "; ");
1230 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
1232 pp_string (buffer
, " = ");
1233 dump_generic_node (buffer
, gimple_omp_for_incr (gs
, i
), spc
,
1235 pp_right_paren (buffer
);
1238 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1240 if (gimple_omp_for_kind (gs
) == GF_OMP_FOR_KIND_CILKFOR
)
1241 dump_omp_clauses (buffer
, gimple_omp_for_clauses (gs
), spc
, flags
);
1242 newline_and_indent (buffer
, spc
+ 2);
1243 pp_left_brace (buffer
);
1244 pp_newline (buffer
);
1245 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1246 newline_and_indent (buffer
, spc
+ 2);
1247 pp_right_brace (buffer
);
1252 /* Dump a GIMPLE_OMP_CONTINUE tuple on the pretty_printer BUFFER. */
1255 dump_gimple_omp_continue (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1257 if (flags
& TDF_RAW
)
1259 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T>", gs
,
1260 gimple_omp_continue_control_def (gs
),
1261 gimple_omp_continue_control_use (gs
));
1265 pp_string (buffer
, "#pragma omp continue (");
1266 dump_generic_node (buffer
, gimple_omp_continue_control_def (gs
),
1270 dump_generic_node (buffer
, gimple_omp_continue_control_use (gs
),
1272 pp_right_paren (buffer
);
1276 /* Dump a GIMPLE_OMP_SINGLE tuple on the pretty_printer BUFFER. */
1279 dump_gimple_omp_single (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1281 if (flags
& TDF_RAW
)
1283 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1284 gimple_omp_body (gs
));
1285 dump_omp_clauses (buffer
, gimple_omp_single_clauses (gs
), spc
, flags
);
1286 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1290 pp_string (buffer
, "#pragma omp single");
1291 dump_omp_clauses (buffer
, gimple_omp_single_clauses (gs
), spc
, flags
);
1292 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1294 newline_and_indent (buffer
, spc
+ 2);
1295 pp_left_brace (buffer
);
1296 pp_newline (buffer
);
1297 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1298 newline_and_indent (buffer
, spc
+ 2);
1299 pp_right_brace (buffer
);
1304 /* Dump a GIMPLE_OMP_TARGET tuple on the pretty_printer BUFFER. */
1307 dump_gimple_omp_target (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1310 switch (gimple_omp_target_kind (gs
))
1312 case GF_OMP_TARGET_KIND_REGION
:
1315 case GF_OMP_TARGET_KIND_DATA
:
1318 case GF_OMP_TARGET_KIND_UPDATE
:
1324 if (flags
& TDF_RAW
)
1326 dump_gimple_fmt (buffer
, spc
, flags
, "%G%s <%+BODY <%S>%nCLAUSES <", gs
,
1327 kind
, gimple_omp_body (gs
));
1328 dump_omp_clauses (buffer
, gimple_omp_target_clauses (gs
), spc
, flags
);
1329 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1333 pp_string (buffer
, "#pragma omp target");
1334 pp_string (buffer
, kind
);
1335 dump_omp_clauses (buffer
, gimple_omp_target_clauses (gs
), spc
, flags
);
1336 if (gimple_omp_target_child_fn (gs
))
1338 pp_string (buffer
, " [child fn: ");
1339 dump_generic_node (buffer
, gimple_omp_target_child_fn (gs
),
1341 pp_right_bracket (buffer
);
1343 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1345 newline_and_indent (buffer
, spc
+ 2);
1346 pp_character (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_character (buffer
, '}');
1355 /* Dump a GIMPLE_OMP_TEAMS tuple on the pretty_printer BUFFER. */
1358 dump_gimple_omp_teams (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1360 if (flags
& TDF_RAW
)
1362 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1363 gimple_omp_body (gs
));
1364 dump_omp_clauses (buffer
, gimple_omp_teams_clauses (gs
), spc
, flags
);
1365 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1369 pp_string (buffer
, "#pragma omp teams");
1370 dump_omp_clauses (buffer
, gimple_omp_teams_clauses (gs
), spc
, flags
);
1371 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1373 newline_and_indent (buffer
, spc
+ 2);
1374 pp_character (buffer
, '{');
1375 pp_newline (buffer
);
1376 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1377 newline_and_indent (buffer
, spc
+ 2);
1378 pp_character (buffer
, '}');
1383 /* Dump a GIMPLE_OMP_SECTIONS tuple on the pretty_printer BUFFER. */
1386 dump_gimple_omp_sections (pretty_printer
*buffer
, gimple gs
, int spc
,
1389 if (flags
& TDF_RAW
)
1391 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1392 gimple_omp_body (gs
));
1393 dump_omp_clauses (buffer
, gimple_omp_sections_clauses (gs
), spc
, flags
);
1394 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1398 pp_string (buffer
, "#pragma omp sections");
1399 if (gimple_omp_sections_control (gs
))
1401 pp_string (buffer
, " <");
1402 dump_generic_node (buffer
, gimple_omp_sections_control (gs
), spc
,
1404 pp_greater (buffer
);
1406 dump_omp_clauses (buffer
, gimple_omp_sections_clauses (gs
), spc
, flags
);
1407 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1409 newline_and_indent (buffer
, spc
+ 2);
1410 pp_left_brace (buffer
);
1411 pp_newline (buffer
);
1412 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1413 newline_and_indent (buffer
, spc
+ 2);
1414 pp_right_brace (buffer
);
1419 /* Dump a GIMPLE_OMP_{MASTER,TASKGROUP,ORDERED,SECTION} tuple on the
1420 pretty_printer BUFFER. */
1423 dump_gimple_omp_block (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1425 if (flags
& TDF_RAW
)
1426 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1427 gimple_omp_body (gs
));
1430 switch (gimple_code (gs
))
1432 case GIMPLE_OMP_MASTER
:
1433 pp_string (buffer
, "#pragma omp master");
1435 case GIMPLE_OMP_TASKGROUP
:
1436 pp_string (buffer
, "#pragma omp taskgroup");
1438 case GIMPLE_OMP_ORDERED
:
1439 pp_string (buffer
, "#pragma omp ordered");
1441 case GIMPLE_OMP_SECTION
:
1442 pp_string (buffer
, "#pragma omp section");
1447 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1449 newline_and_indent (buffer
, spc
+ 2);
1450 pp_left_brace (buffer
);
1451 pp_newline (buffer
);
1452 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1453 newline_and_indent (buffer
, spc
+ 2);
1454 pp_right_brace (buffer
);
1459 /* Dump a GIMPLE_OMP_CRITICAL tuple on the pretty_printer BUFFER. */
1462 dump_gimple_omp_critical (pretty_printer
*buffer
, gimple gs
, int spc
,
1465 if (flags
& TDF_RAW
)
1466 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1467 gimple_omp_body (gs
));
1470 pp_string (buffer
, "#pragma omp critical");
1471 if (gimple_omp_critical_name (gs
))
1473 pp_string (buffer
, " (");
1474 dump_generic_node (buffer
, gimple_omp_critical_name (gs
), spc
,
1476 pp_right_paren (buffer
);
1478 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1480 newline_and_indent (buffer
, spc
+ 2);
1481 pp_left_brace (buffer
);
1482 pp_newline (buffer
);
1483 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1484 newline_and_indent (buffer
, spc
+ 2);
1485 pp_right_brace (buffer
);
1490 /* Dump a GIMPLE_OMP_RETURN tuple on the pretty_printer BUFFER. */
1493 dump_gimple_omp_return (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1495 if (flags
& TDF_RAW
)
1497 dump_gimple_fmt (buffer
, spc
, flags
, "%G <nowait=%d", gs
,
1498 (int) gimple_omp_return_nowait_p (gs
));
1499 if (gimple_omp_return_lhs (gs
))
1500 dump_gimple_fmt (buffer
, spc
, flags
, ", lhs=%T>",
1501 gimple_omp_return_lhs (gs
));
1503 dump_gimple_fmt (buffer
, spc
, flags
, ">");
1507 pp_string (buffer
, "#pragma omp return");
1508 if (gimple_omp_return_nowait_p (gs
))
1509 pp_string (buffer
, "(nowait)");
1510 if (gimple_omp_return_lhs (gs
))
1512 pp_string (buffer
, " (set ");
1513 dump_generic_node (buffer
, gimple_omp_return_lhs (gs
),
1515 pp_character (buffer
, ')');
1520 /* Dump a GIMPLE_TRANSACTION tuple on the pretty_printer BUFFER. */
1523 dump_gimple_transaction (pretty_printer
*buffer
, gimple_transaction gs
,
1526 unsigned subcode
= gimple_transaction_subcode (gs
);
1528 if (flags
& TDF_RAW
)
1530 dump_gimple_fmt (buffer
, spc
, flags
,
1531 "%G [SUBCODE=%x,LABEL=%T] <%+BODY <%S> >",
1532 gs
, subcode
, gimple_transaction_label (gs
),
1533 gimple_transaction_body (gs
));
1537 if (subcode
& GTMA_IS_OUTER
)
1538 pp_string (buffer
, "__transaction_atomic [[outer]]");
1539 else if (subcode
& GTMA_IS_RELAXED
)
1540 pp_string (buffer
, "__transaction_relaxed");
1542 pp_string (buffer
, "__transaction_atomic");
1543 subcode
&= ~GTMA_DECLARATION_MASK
;
1545 if (subcode
|| gimple_transaction_label (gs
))
1547 pp_string (buffer
, " //");
1548 if (gimple_transaction_label (gs
))
1550 pp_string (buffer
, " LABEL=");
1551 dump_generic_node (buffer
, gimple_transaction_label (gs
),
1556 pp_string (buffer
, " SUBCODE=[ ");
1557 if (subcode
& GTMA_HAVE_ABORT
)
1559 pp_string (buffer
, "GTMA_HAVE_ABORT ");
1560 subcode
&= ~GTMA_HAVE_ABORT
;
1562 if (subcode
& GTMA_HAVE_LOAD
)
1564 pp_string (buffer
, "GTMA_HAVE_LOAD ");
1565 subcode
&= ~GTMA_HAVE_LOAD
;
1567 if (subcode
& GTMA_HAVE_STORE
)
1569 pp_string (buffer
, "GTMA_HAVE_STORE ");
1570 subcode
&= ~GTMA_HAVE_STORE
;
1572 if (subcode
& GTMA_MAY_ENTER_IRREVOCABLE
)
1574 pp_string (buffer
, "GTMA_MAY_ENTER_IRREVOCABLE ");
1575 subcode
&= ~GTMA_MAY_ENTER_IRREVOCABLE
;
1577 if (subcode
& GTMA_DOES_GO_IRREVOCABLE
)
1579 pp_string (buffer
, "GTMA_DOES_GO_IRREVOCABLE ");
1580 subcode
&= ~GTMA_DOES_GO_IRREVOCABLE
;
1582 if (subcode
& GTMA_HAS_NO_INSTRUMENTATION
)
1584 pp_string (buffer
, "GTMA_HAS_NO_INSTRUMENTATION ");
1585 subcode
&= ~GTMA_HAS_NO_INSTRUMENTATION
;
1588 pp_printf (buffer
, "0x%x ", subcode
);
1589 pp_right_bracket (buffer
);
1593 if (!gimple_seq_empty_p (gimple_transaction_body (gs
)))
1595 newline_and_indent (buffer
, spc
+ 2);
1596 pp_left_brace (buffer
);
1597 pp_newline (buffer
);
1598 dump_gimple_seq (buffer
, gimple_transaction_body (gs
),
1600 newline_and_indent (buffer
, spc
+ 2);
1601 pp_right_brace (buffer
);
1606 /* Dump a GIMPLE_ASM tuple on the pretty_printer BUFFER, SPC spaces of
1607 indent. FLAGS specifies details to show in the dump (see TDF_* in
1611 dump_gimple_asm (pretty_printer
*buffer
, gimple_asm gs
, int spc
, int flags
)
1613 unsigned int i
, n
, f
, fields
;
1615 if (flags
& TDF_RAW
)
1617 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+STRING <%n%s%n>", gs
,
1618 gimple_asm_string (gs
));
1620 n
= gimple_asm_noutputs (gs
);
1623 newline_and_indent (buffer
, spc
+ 2);
1624 pp_string (buffer
, "OUTPUT: ");
1625 for (i
= 0; i
< n
; i
++)
1627 dump_generic_node (buffer
, gimple_asm_output_op (gs
, i
),
1630 pp_string (buffer
, ", ");
1634 n
= gimple_asm_ninputs (gs
);
1637 newline_and_indent (buffer
, spc
+ 2);
1638 pp_string (buffer
, "INPUT: ");
1639 for (i
= 0; i
< n
; i
++)
1641 dump_generic_node (buffer
, gimple_asm_input_op (gs
, i
),
1644 pp_string (buffer
, ", ");
1648 n
= gimple_asm_nclobbers (gs
);
1651 newline_and_indent (buffer
, spc
+ 2);
1652 pp_string (buffer
, "CLOBBER: ");
1653 for (i
= 0; i
< n
; i
++)
1655 dump_generic_node (buffer
, gimple_asm_clobber_op (gs
, i
),
1658 pp_string (buffer
, ", ");
1662 n
= gimple_asm_nlabels (gs
);
1665 newline_and_indent (buffer
, spc
+ 2);
1666 pp_string (buffer
, "LABEL: ");
1667 for (i
= 0; i
< n
; i
++)
1669 dump_generic_node (buffer
, gimple_asm_label_op (gs
, i
),
1672 pp_string (buffer
, ", ");
1676 newline_and_indent (buffer
, spc
);
1677 pp_greater (buffer
);
1681 pp_string (buffer
, "__asm__");
1682 if (gimple_asm_volatile_p (gs
))
1683 pp_string (buffer
, " __volatile__");
1684 if (gimple_asm_nlabels (gs
))
1685 pp_string (buffer
, " goto");
1686 pp_string (buffer
, "(\"");
1687 pp_string (buffer
, gimple_asm_string (gs
));
1688 pp_string (buffer
, "\"");
1690 if (gimple_asm_nlabels (gs
))
1692 else if (gimple_asm_nclobbers (gs
))
1694 else if (gimple_asm_ninputs (gs
))
1696 else if (gimple_asm_noutputs (gs
))
1701 for (f
= 0; f
< fields
; ++f
)
1703 pp_string (buffer
, " : ");
1708 n
= gimple_asm_noutputs (gs
);
1709 for (i
= 0; i
< n
; i
++)
1711 dump_generic_node (buffer
, gimple_asm_output_op (gs
, i
),
1714 pp_string (buffer
, ", ");
1719 n
= gimple_asm_ninputs (gs
);
1720 for (i
= 0; i
< n
; i
++)
1722 dump_generic_node (buffer
, gimple_asm_input_op (gs
, i
),
1725 pp_string (buffer
, ", ");
1730 n
= gimple_asm_nclobbers (gs
);
1731 for (i
= 0; i
< n
; i
++)
1733 dump_generic_node (buffer
, gimple_asm_clobber_op (gs
, i
),
1736 pp_string (buffer
, ", ");
1741 n
= gimple_asm_nlabels (gs
);
1742 for (i
= 0; i
< n
; i
++)
1744 dump_generic_node (buffer
, gimple_asm_label_op (gs
, i
),
1747 pp_string (buffer
, ", ");
1756 pp_string (buffer
, ");");
1760 /* Dump ptr_info and range_info for NODE on pretty_printer BUFFER with
1761 SPC spaces of indent. */
1764 dump_ssaname_info (pretty_printer
*buffer
, tree node
, int spc
)
1766 if (TREE_CODE (node
) != SSA_NAME
)
1769 if (POINTER_TYPE_P (TREE_TYPE (node
))
1770 && SSA_NAME_PTR_INFO (node
))
1772 unsigned int align
, misalign
;
1773 struct ptr_info_def
*pi
= SSA_NAME_PTR_INFO (node
);
1774 pp_string (buffer
, "# PT = ");
1775 pp_points_to_solution (buffer
, &pi
->pt
);
1776 newline_and_indent (buffer
, spc
);
1777 if (get_ptr_info_alignment (pi
, &align
, &misalign
))
1779 pp_printf (buffer
, "# ALIGN = %u, MISALIGN = %u", align
, misalign
);
1780 newline_and_indent (buffer
, spc
);
1784 if (!POINTER_TYPE_P (TREE_TYPE (node
))
1785 && SSA_NAME_RANGE_INFO (node
))
1787 wide_int min
, max
, nonzero_bits
;
1788 value_range_type range_type
= get_range_info (node
, &min
, &max
);
1790 if (range_type
== VR_VARYING
)
1791 pp_printf (buffer
, "# RANGE VR_VARYING");
1792 else if (range_type
== VR_RANGE
|| range_type
== VR_ANTI_RANGE
)
1794 pp_printf (buffer
, "# RANGE ");
1795 pp_printf (buffer
, "%s[", range_type
== VR_RANGE
? "" : "~");
1796 pp_wide_int (buffer
, min
, TYPE_SIGN (TREE_TYPE (node
)));
1797 pp_printf (buffer
, ", ");
1798 pp_wide_int (buffer
, max
, TYPE_SIGN (TREE_TYPE (node
)));
1799 pp_printf (buffer
, "]");
1801 nonzero_bits
= get_nonzero_bits (node
);
1802 if (nonzero_bits
!= -1)
1804 pp_string (buffer
, " NONZERO ");
1805 pp_wide_int (buffer
, nonzero_bits
, UNSIGNED
);
1807 newline_and_indent (buffer
, spc
);
1812 /* Dump a PHI node PHI. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1.
1813 The caller is responsible for calling pp_flush on BUFFER to finalize
1814 pretty printer. If COMMENT is true, print this after #. */
1817 dump_gimple_phi (pretty_printer
*buffer
, gimple_phi phi
, int spc
, bool comment
,
1821 tree lhs
= gimple_phi_result (phi
);
1823 if (flags
& TDF_ALIAS
)
1824 dump_ssaname_info (buffer
, lhs
, spc
);
1827 pp_string (buffer
, "# ");
1829 if (flags
& TDF_RAW
)
1830 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, ", phi
,
1831 gimple_phi_result (phi
));
1834 dump_generic_node (buffer
, lhs
, spc
, flags
, false);
1835 pp_string (buffer
, " = PHI <");
1837 for (i
= 0; i
< gimple_phi_num_args (phi
); i
++)
1839 if ((flags
& TDF_LINENO
) && gimple_phi_arg_has_location (phi
, i
))
1840 dump_location (buffer
, gimple_phi_arg_location (phi
, i
));
1841 dump_generic_node (buffer
, gimple_phi_arg_def (phi
, i
), spc
, flags
,
1843 pp_left_paren (buffer
);
1844 pp_decimal_int (buffer
, gimple_phi_arg_edge (phi
, i
)->src
->index
);
1845 pp_right_paren (buffer
);
1846 if (i
< gimple_phi_num_args (phi
) - 1)
1847 pp_string (buffer
, ", ");
1849 pp_greater (buffer
);
1853 /* Dump a GIMPLE_OMP_PARALLEL tuple on the pretty_printer BUFFER, SPC spaces
1854 of indent. FLAGS specifies details to show in the dump (see TDF_* in
1858 dump_gimple_omp_parallel (pretty_printer
*buffer
, gimple gs
, int spc
,
1861 if (flags
& TDF_RAW
)
1863 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1864 gimple_omp_body (gs
));
1865 dump_omp_clauses (buffer
, gimple_omp_parallel_clauses (gs
), spc
, flags
);
1866 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T%n>",
1867 gimple_omp_parallel_child_fn (gs
),
1868 gimple_omp_parallel_data_arg (gs
));
1873 pp_string (buffer
, "#pragma omp parallel");
1874 dump_omp_clauses (buffer
, gimple_omp_parallel_clauses (gs
), spc
, flags
);
1875 if (gimple_omp_parallel_child_fn (gs
))
1877 pp_string (buffer
, " [child fn: ");
1878 dump_generic_node (buffer
, gimple_omp_parallel_child_fn (gs
),
1880 pp_string (buffer
, " (");
1881 if (gimple_omp_parallel_data_arg (gs
))
1882 dump_generic_node (buffer
, gimple_omp_parallel_data_arg (gs
),
1885 pp_string (buffer
, "???");
1886 pp_string (buffer
, ")]");
1888 body
= gimple_omp_body (gs
);
1889 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
1891 newline_and_indent (buffer
, spc
+ 2);
1892 pp_left_brace (buffer
);
1893 pp_newline (buffer
);
1894 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
1895 newline_and_indent (buffer
, spc
+ 2);
1896 pp_right_brace (buffer
);
1900 pp_newline (buffer
);
1901 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
1907 /* Dump a GIMPLE_OMP_TASK tuple on the pretty_printer BUFFER, SPC spaces
1908 of indent. FLAGS specifies details to show in the dump (see TDF_* in
1912 dump_gimple_omp_task (pretty_printer
*buffer
, gimple gs
, int spc
,
1915 if (flags
& TDF_RAW
)
1917 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1918 gimple_omp_body (gs
));
1919 dump_omp_clauses (buffer
, gimple_omp_task_clauses (gs
), spc
, flags
);
1920 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T, %T, %T, %T%n>",
1921 gimple_omp_task_child_fn (gs
),
1922 gimple_omp_task_data_arg (gs
),
1923 gimple_omp_task_copy_fn (gs
),
1924 gimple_omp_task_arg_size (gs
),
1925 gimple_omp_task_arg_size (gs
));
1930 pp_string (buffer
, "#pragma omp task");
1931 dump_omp_clauses (buffer
, gimple_omp_task_clauses (gs
), spc
, flags
);
1932 if (gimple_omp_task_child_fn (gs
))
1934 pp_string (buffer
, " [child fn: ");
1935 dump_generic_node (buffer
, gimple_omp_task_child_fn (gs
),
1937 pp_string (buffer
, " (");
1938 if (gimple_omp_task_data_arg (gs
))
1939 dump_generic_node (buffer
, gimple_omp_task_data_arg (gs
),
1942 pp_string (buffer
, "???");
1943 pp_string (buffer
, ")]");
1945 body
= gimple_omp_body (gs
);
1946 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
1948 newline_and_indent (buffer
, spc
+ 2);
1949 pp_left_brace (buffer
);
1950 pp_newline (buffer
);
1951 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
1952 newline_and_indent (buffer
, spc
+ 2);
1953 pp_right_brace (buffer
);
1957 pp_newline (buffer
);
1958 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
1964 /* Dump a GIMPLE_OMP_ATOMIC_LOAD tuple on the pretty_printer BUFFER, SPC
1965 spaces of indent. FLAGS specifies details to show in the dump (see TDF_*
1969 dump_gimple_omp_atomic_load (pretty_printer
*buffer
, gimple gs
, int spc
,
1972 if (flags
& TDF_RAW
)
1974 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T>", gs
,
1975 gimple_omp_atomic_load_lhs (gs
),
1976 gimple_omp_atomic_load_rhs (gs
));
1980 pp_string (buffer
, "#pragma omp atomic_load");
1981 if (gimple_omp_atomic_seq_cst_p (gs
))
1982 pp_string (buffer
, " seq_cst");
1983 if (gimple_omp_atomic_need_value_p (gs
))
1984 pp_string (buffer
, " [needed]");
1985 newline_and_indent (buffer
, spc
+ 2);
1986 dump_generic_node (buffer
, gimple_omp_atomic_load_lhs (gs
),
1992 dump_generic_node (buffer
, gimple_omp_atomic_load_rhs (gs
),
1997 /* Dump a GIMPLE_OMP_ATOMIC_STORE tuple on the pretty_printer BUFFER, SPC
1998 spaces of indent. FLAGS specifies details to show in the dump (see TDF_*
2002 dump_gimple_omp_atomic_store (pretty_printer
*buffer
, gimple gs
, int spc
,
2005 if (flags
& TDF_RAW
)
2007 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
,
2008 gimple_omp_atomic_store_val (gs
));
2012 pp_string (buffer
, "#pragma omp atomic_store ");
2013 if (gimple_omp_atomic_seq_cst_p (gs
))
2014 pp_string (buffer
, "seq_cst ");
2015 if (gimple_omp_atomic_need_value_p (gs
))
2016 pp_string (buffer
, "[needed] ");
2017 pp_left_paren (buffer
);
2018 dump_generic_node (buffer
, gimple_omp_atomic_store_val (gs
),
2020 pp_right_paren (buffer
);
2025 /* Dump all the memory operands for statement GS. BUFFER, SPC and
2026 FLAGS are as in pp_gimple_stmt_1. */
2029 dump_gimple_mem_ops (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
2031 tree vdef
= gimple_vdef (gs
);
2032 tree vuse
= gimple_vuse (gs
);
2034 if (vdef
!= NULL_TREE
)
2036 pp_string (buffer
, "# ");
2037 dump_generic_node (buffer
, vdef
, spc
+ 2, flags
, false);
2038 pp_string (buffer
, " = VDEF <");
2039 dump_generic_node (buffer
, vuse
, spc
+ 2, flags
, false);
2040 pp_greater (buffer
);
2041 newline_and_indent (buffer
, spc
);
2043 else if (vuse
!= NULL_TREE
)
2045 pp_string (buffer
, "# VUSE <");
2046 dump_generic_node (buffer
, vuse
, spc
+ 2, flags
, false);
2047 pp_greater (buffer
);
2048 newline_and_indent (buffer
, spc
);
2053 /* Print the gimple statement GS on the pretty printer BUFFER, SPC
2054 spaces of indent. FLAGS specifies details to show in the dump (see
2055 TDF_* in dumpfile.h). The caller is responsible for calling
2056 pp_flush on BUFFER to finalize the pretty printer. */
2059 pp_gimple_stmt_1 (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
2064 if (flags
& TDF_STMTADDR
)
2065 pp_printf (buffer
, "<&%p> ", (void *) gs
);
2067 if ((flags
& TDF_LINENO
) && gimple_has_location (gs
))
2068 dump_location (buffer
, gimple_location (gs
));
2072 int lp_nr
= lookup_stmt_eh_lp (gs
);
2074 pp_printf (buffer
, "[LP %d] ", lp_nr
);
2076 pp_printf (buffer
, "[MNT %d] ", -lp_nr
);
2079 if ((flags
& (TDF_VOPS
|TDF_MEMSYMS
))
2080 && gimple_has_mem_ops (gs
))
2081 dump_gimple_mem_ops (buffer
, gs
, spc
, flags
);
2083 if (gimple_has_lhs (gs
)
2084 && (flags
& TDF_ALIAS
))
2085 dump_ssaname_info (buffer
, gimple_get_lhs (gs
), spc
);
2087 switch (gimple_code (gs
))
2090 dump_gimple_asm (buffer
, as_a
<gimple_asm
> (gs
), spc
, flags
);
2094 dump_gimple_assign (buffer
, as_a
<gimple_assign
> (gs
), spc
, flags
);
2098 dump_gimple_bind (buffer
, as_a
<gimple_bind
> (gs
), spc
, flags
);
2102 dump_gimple_call (buffer
, as_a
<gimple_call
> (gs
), spc
, flags
);
2106 dump_gimple_cond (buffer
, as_a
<gimple_cond
> (gs
), spc
, flags
);
2110 dump_gimple_label (buffer
, as_a
<gimple_label
> (gs
), spc
, flags
);
2114 dump_gimple_goto (buffer
, as_a
<gimple_goto
> (gs
), spc
, flags
);
2118 pp_string (buffer
, "GIMPLE_NOP");
2122 dump_gimple_return (buffer
, as_a
<gimple_return
> (gs
), spc
, flags
);
2126 dump_gimple_switch (buffer
, as_a
<gimple_switch
> (gs
), spc
, flags
);
2130 dump_gimple_try (buffer
, gs
, spc
, flags
);
2134 dump_gimple_phi (buffer
, as_a
<gimple_phi
> (gs
), spc
, false, flags
);
2137 case GIMPLE_OMP_PARALLEL
:
2138 dump_gimple_omp_parallel (buffer
, gs
, spc
, flags
);
2141 case GIMPLE_OMP_TASK
:
2142 dump_gimple_omp_task (buffer
, gs
, spc
, flags
);
2145 case GIMPLE_OMP_ATOMIC_LOAD
:
2146 dump_gimple_omp_atomic_load (buffer
, gs
, spc
, flags
);
2150 case GIMPLE_OMP_ATOMIC_STORE
:
2151 dump_gimple_omp_atomic_store (buffer
, gs
, spc
, flags
);
2154 case GIMPLE_OMP_FOR
:
2155 dump_gimple_omp_for (buffer
, gs
, spc
, flags
);
2158 case GIMPLE_OMP_CONTINUE
:
2159 dump_gimple_omp_continue (buffer
, gs
, spc
, flags
);
2162 case GIMPLE_OMP_SINGLE
:
2163 dump_gimple_omp_single (buffer
, gs
, spc
, flags
);
2166 case GIMPLE_OMP_TARGET
:
2167 dump_gimple_omp_target (buffer
, gs
, spc
, flags
);
2170 case GIMPLE_OMP_TEAMS
:
2171 dump_gimple_omp_teams (buffer
, gs
, spc
, flags
);
2174 case GIMPLE_OMP_RETURN
:
2175 dump_gimple_omp_return (buffer
, gs
, spc
, flags
);
2178 case GIMPLE_OMP_SECTIONS
:
2179 dump_gimple_omp_sections (buffer
, gs
, spc
, flags
);
2182 case GIMPLE_OMP_SECTIONS_SWITCH
:
2183 pp_string (buffer
, "GIMPLE_SECTIONS_SWITCH");
2186 case GIMPLE_OMP_MASTER
:
2187 case GIMPLE_OMP_TASKGROUP
:
2188 case GIMPLE_OMP_ORDERED
:
2189 case GIMPLE_OMP_SECTION
:
2190 dump_gimple_omp_block (buffer
, gs
, spc
, flags
);
2193 case GIMPLE_OMP_CRITICAL
:
2194 dump_gimple_omp_critical (buffer
, gs
, spc
, flags
);
2198 dump_gimple_catch (buffer
, as_a
<gimple_catch
> (gs
), spc
, flags
);
2201 case GIMPLE_EH_FILTER
:
2202 dump_gimple_eh_filter (buffer
, as_a
<gimple_eh_filter
> (gs
), spc
, flags
);
2205 case GIMPLE_EH_MUST_NOT_THROW
:
2206 dump_gimple_eh_must_not_throw (buffer
,
2207 as_a
<gimple_eh_must_not_throw
> (gs
),
2211 case GIMPLE_EH_ELSE
:
2212 dump_gimple_eh_else (buffer
, gs
, spc
, flags
);
2216 dump_gimple_resx (buffer
, gs
, spc
, flags
);
2219 case GIMPLE_EH_DISPATCH
:
2220 dump_gimple_eh_dispatch (buffer
, gs
, spc
, flags
);
2224 dump_gimple_debug (buffer
, as_a
<gimple_debug
> (gs
), spc
, flags
);
2227 case GIMPLE_PREDICT
:
2228 pp_string (buffer
, "// predicted ");
2229 if (gimple_predict_outcome (gs
))
2230 pp_string (buffer
, "likely by ");
2232 pp_string (buffer
, "unlikely by ");
2233 pp_string (buffer
, predictor_name (gimple_predict_predictor (gs
)));
2234 pp_string (buffer
, " predictor.");
2237 case GIMPLE_TRANSACTION
:
2238 dump_gimple_transaction (buffer
, as_a
<gimple_transaction
> (gs
), spc
,
2248 /* Dumps header of basic block BB to OUTF indented by INDENT
2249 spaces and details described by flags. */
2252 dump_gimple_bb_header (FILE *outf
, basic_block bb
, int indent
, int flags
)
2254 if (flags
& TDF_BLOCKS
)
2256 if (flags
& TDF_LINENO
)
2258 gimple_stmt_iterator gsi
;
2260 if (flags
& TDF_COMMENT
)
2261 fputs (";; ", outf
);
2263 for (gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
); gsi_next (&gsi
))
2264 if (!is_gimple_debug (gsi_stmt (gsi
))
2265 && get_lineno (gsi_stmt (gsi
)) != UNKNOWN_LOCATION
)
2267 fprintf (outf
, "%*sstarting at line %d",
2268 indent
, "", get_lineno (gsi_stmt (gsi
)));
2271 if (bb
->discriminator
)
2272 fprintf (outf
, ", discriminator %i", bb
->discriminator
);
2278 gimple stmt
= first_stmt (bb
);
2279 if (!stmt
|| gimple_code (stmt
) != GIMPLE_LABEL
)
2280 fprintf (outf
, "%*s<bb %d>:\n", indent
, "", bb
->index
);
2285 /* Dumps end of basic block BB to buffer BUFFER indented by INDENT
2289 dump_gimple_bb_footer (FILE *outf ATTRIBUTE_UNUSED
,
2290 basic_block bb ATTRIBUTE_UNUSED
,
2291 int indent ATTRIBUTE_UNUSED
,
2292 int flags ATTRIBUTE_UNUSED
)
2294 /* There is currently no GIMPLE-specific basic block info to dump. */
2299 /* Dump PHI nodes of basic block BB to BUFFER with details described
2300 by FLAGS and indented by INDENT spaces. */
2303 dump_phi_nodes (pretty_printer
*buffer
, basic_block bb
, int indent
, int flags
)
2305 gimple_phi_iterator i
;
2307 for (i
= gsi_start_phis (bb
); !gsi_end_p (i
); gsi_next (&i
))
2309 gimple_phi phi
= i
.phi ();
2310 if (!virtual_operand_p (gimple_phi_result (phi
)) || (flags
& TDF_VOPS
))
2313 dump_gimple_phi (buffer
, phi
, indent
, true, flags
);
2314 pp_newline (buffer
);
2320 /* Dump jump to basic block BB that is represented implicitly in the cfg
2324 pp_cfg_jump (pretty_printer
*buffer
, basic_block bb
)
2328 stmt
= first_stmt (bb
);
2330 pp_string (buffer
, "goto <bb ");
2331 pp_decimal_int (buffer
, bb
->index
);
2332 pp_greater (buffer
);
2333 if (stmt
&& gimple_code (stmt
) == GIMPLE_LABEL
)
2335 pp_string (buffer
, " (");
2336 dump_generic_node (buffer
, gimple_label_label (stmt
), 0, 0, false);
2337 pp_right_paren (buffer
);
2338 pp_semicolon (buffer
);
2341 pp_semicolon (buffer
);
2345 /* Dump edges represented implicitly in basic block BB to BUFFER, indented
2346 by INDENT spaces, with details given by FLAGS. */
2349 dump_implicit_edges (pretty_printer
*buffer
, basic_block bb
, int indent
,
2355 stmt
= last_stmt (bb
);
2357 if (stmt
&& gimple_code (stmt
) == GIMPLE_COND
)
2359 edge true_edge
, false_edge
;
2361 /* When we are emitting the code or changing CFG, it is possible that
2362 the edges are not yet created. When we are using debug_bb in such
2363 a situation, we do not want it to crash. */
2364 if (EDGE_COUNT (bb
->succs
) != 2)
2366 extract_true_false_edges_from_block (bb
, &true_edge
, &false_edge
);
2368 INDENT (indent
+ 2);
2369 pp_cfg_jump (buffer
, true_edge
->dest
);
2370 newline_and_indent (buffer
, indent
);
2371 pp_string (buffer
, "else");
2372 newline_and_indent (buffer
, indent
+ 2);
2373 pp_cfg_jump (buffer
, false_edge
->dest
);
2374 pp_newline (buffer
);
2378 /* If there is a fallthru edge, we may need to add an artificial
2379 goto to the dump. */
2380 e
= find_fallthru_edge (bb
->succs
);
2382 if (e
&& e
->dest
!= bb
->next_bb
)
2386 if ((flags
& TDF_LINENO
)
2387 && e
->goto_locus
!= UNKNOWN_LOCATION
)
2388 dump_location (buffer
, e
->goto_locus
);
2390 pp_cfg_jump (buffer
, e
->dest
);
2391 pp_newline (buffer
);
2396 /* Dumps basic block BB to buffer BUFFER with details described by FLAGS and
2397 indented by INDENT spaces. */
2400 gimple_dump_bb_buff (pretty_printer
*buffer
, basic_block bb
, int indent
,
2403 gimple_stmt_iterator gsi
;
2405 int label_indent
= indent
- 2;
2407 if (label_indent
< 0)
2410 dump_phi_nodes (buffer
, bb
, indent
, flags
);
2412 for (gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
); gsi_next (&gsi
))
2416 stmt
= gsi_stmt (gsi
);
2418 curr_indent
= gimple_code (stmt
) == GIMPLE_LABEL
? label_indent
: indent
;
2420 INDENT (curr_indent
);
2421 pp_gimple_stmt_1 (buffer
, stmt
, curr_indent
, flags
);
2422 pp_newline_and_flush (buffer
);
2423 gcc_checking_assert (DECL_STRUCT_FUNCTION (current_function_decl
));
2424 dump_histograms_for_stmt (DECL_STRUCT_FUNCTION (current_function_decl
),
2425 pp_buffer (buffer
)->stream
, stmt
);
2428 dump_implicit_edges (buffer
, bb
, indent
, flags
);
2433 /* Dumps basic block BB to FILE with details described by FLAGS and
2434 indented by INDENT spaces. */
2437 gimple_dump_bb (FILE *file
, basic_block bb
, int indent
, int flags
)
2439 dump_gimple_bb_header (file
, bb
, indent
, flags
);
2440 if (bb
->index
>= NUM_FIXED_BLOCKS
)
2442 pretty_printer buffer
;
2443 pp_needs_newline (&buffer
) = true;
2444 buffer
.buffer
->stream
= file
;
2445 gimple_dump_bb_buff (&buffer
, bb
, indent
, flags
);
2447 dump_gimple_bb_footer (file
, bb
, indent
, flags
);
2450 /* Dumps basic block BB to pretty-printer PP with default dump flags and
2451 no indentation, for use as a label of a DOT graph record-node.
2452 ??? Should just use gimple_dump_bb_buff here, except that value profiling
2453 histogram dumping doesn't know about pretty-printers. */
2456 gimple_dump_bb_for_graph (pretty_printer
*pp
, basic_block bb
)
2458 gimple_stmt_iterator gsi
;
2460 pp_printf (pp
, "<bb %d>:\n", bb
->index
);
2461 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
2463 for (gsi
= gsi_start_phis (bb
); !gsi_end_p (gsi
); gsi_next (&gsi
))
2465 gimple phi
= gsi_stmt (gsi
);
2466 if (!virtual_operand_p (gimple_phi_result (phi
))
2467 || (dump_flags
& TDF_VOPS
))
2470 pp_write_text_to_stream (pp
);
2471 pp_string (pp
, "# ");
2472 pp_gimple_stmt_1 (pp
, phi
, 0, dump_flags
);
2474 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
2478 for (gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
); gsi_next (&gsi
))
2480 gimple stmt
= gsi_stmt (gsi
);
2482 pp_write_text_to_stream (pp
);
2483 pp_gimple_stmt_1 (pp
, stmt
, 0, dump_flags
);
2485 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
2487 dump_implicit_edges (pp
, bb
, 0, dump_flags
);
2488 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);