1 /* Pretty formatting of GIMPLE statements and expressions.
2 Copyright (C) 2001-2013 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 "diagnostic.h"
28 #include "gimple-pretty-print.h"
32 #include "gimple-iterator.h"
33 #include "gimple-ssa.h"
36 #include "tree-ssanames.h"
37 #include "dumpfile.h" /* for dump_flags */
38 #include "value-prof.h"
39 #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
);
90 debug (gimple_statement_d
&ref
)
92 print_gimple_stmt (stderr
, &ref
, 0, 0);
96 debug (gimple_statement_d
*ptr
)
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
, gimple 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
, gimple 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
, gimple 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
, "VEC_PERM_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);
444 case REALIGN_LOAD_EXPR
:
445 pp_string (buffer
, "REALIGN_LOAD <");
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);
455 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
456 pp_string (buffer
, " ? ");
457 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
458 pp_string (buffer
, " : ");
459 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
463 pp_string (buffer
, "VEC_COND_EXPR <");
464 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
465 pp_string (buffer
, ", ");
466 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
467 pp_string (buffer
, ", ");
468 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
478 /* Dump the gimple assignment GS. BUFFER, SPC and FLAGS are as in
482 dump_gimple_assign (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
489 switch (gimple_num_ops (gs
))
492 arg3
= gimple_assign_rhs3 (gs
);
494 arg2
= gimple_assign_rhs2 (gs
);
496 arg1
= gimple_assign_rhs1 (gs
);
502 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%s, %T, %T, %T, %T>", gs
,
503 get_tree_code_name (gimple_assign_rhs_code (gs
)),
504 gimple_assign_lhs (gs
), arg1
, arg2
, arg3
);
508 if (!(flags
& TDF_RHS_ONLY
))
510 dump_generic_node (buffer
, gimple_assign_lhs (gs
), spc
, flags
, false);
514 if (gimple_assign_nontemporal_move_p (gs
))
515 pp_string (buffer
, "{nt}");
517 if (gimple_has_volatile_ops (gs
))
518 pp_string (buffer
, "{v}");
523 if (gimple_num_ops (gs
) == 2)
524 dump_unary_rhs (buffer
, gs
, spc
, flags
);
525 else if (gimple_num_ops (gs
) == 3)
526 dump_binary_rhs (buffer
, gs
, spc
, flags
);
527 else if (gimple_num_ops (gs
) == 4)
528 dump_ternary_rhs (buffer
, gs
, spc
, flags
);
531 if (!(flags
& TDF_RHS_ONLY
))
532 pp_semicolon (buffer
);
537 /* Dump the return statement GS. BUFFER, SPC and FLAGS are as in
541 dump_gimple_return (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
545 t
= gimple_return_retval (gs
);
546 t2
= gimple_return_retbnd (gs
);
548 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T %T>", gs
, t
, t2
);
551 pp_string (buffer
, "return");
555 dump_generic_node (buffer
, t
, spc
, flags
, false);
559 pp_string (buffer
, ", ");
560 dump_generic_node (buffer
, t2
, spc
, flags
, false);
562 pp_semicolon (buffer
);
567 /* Dump the call arguments for a gimple call. BUFFER, FLAGS are as in
571 dump_gimple_call_args (pretty_printer
*buffer
, gimple gs
, int flags
)
575 for (i
= 0; i
< gimple_call_num_args (gs
); i
++)
577 dump_generic_node (buffer
, gimple_call_arg (gs
, i
), 0, flags
, false);
578 if (i
< gimple_call_num_args (gs
) - 1)
579 pp_string (buffer
, ", ");
582 if (gimple_call_va_arg_pack_p (gs
))
584 if (gimple_call_num_args (gs
) > 0)
590 pp_string (buffer
, "__builtin_va_arg_pack ()");
594 /* Dump the points-to solution *PT to BUFFER. */
597 pp_points_to_solution (pretty_printer
*buffer
, struct pt_solution
*pt
)
601 pp_string (buffer
, "anything ");
605 pp_string (buffer
, "nonlocal ");
607 pp_string (buffer
, "escaped ");
609 pp_string (buffer
, "unit-escaped ");
611 pp_string (buffer
, "null ");
613 && !bitmap_empty_p (pt
->vars
))
617 pp_string (buffer
, "{ ");
618 EXECUTE_IF_SET_IN_BITMAP (pt
->vars
, 0, i
, bi
)
620 pp_string (buffer
, "D.");
621 pp_decimal_int (buffer
, i
);
624 pp_right_brace (buffer
);
625 if (pt
->vars_contains_nonlocal
626 && pt
->vars_contains_escaped_heap
)
627 pp_string (buffer
, " (nonlocal, escaped heap)");
628 else if (pt
->vars_contains_nonlocal
629 && pt
->vars_contains_escaped
)
630 pp_string (buffer
, " (nonlocal, escaped)");
631 else if (pt
->vars_contains_nonlocal
)
632 pp_string (buffer
, " (nonlocal)");
633 else if (pt
->vars_contains_escaped_heap
)
634 pp_string (buffer
, " (escaped heap)");
635 else if (pt
->vars_contains_escaped
)
636 pp_string (buffer
, " (escaped)");
640 /* Dump the call statement GS. BUFFER, SPC and FLAGS are as in
644 dump_gimple_call (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
646 tree lhs
= gimple_call_lhs (gs
);
647 tree fn
= gimple_call_fn (gs
);
649 if (flags
& TDF_ALIAS
)
651 struct pt_solution
*pt
;
652 pt
= gimple_call_use_set (gs
);
653 if (!pt_solution_empty_p (pt
))
655 pp_string (buffer
, "# USE = ");
656 pp_points_to_solution (buffer
, pt
);
657 newline_and_indent (buffer
, spc
);
659 pt
= gimple_call_clobber_set (gs
);
660 if (!pt_solution_empty_p (pt
))
662 pp_string (buffer
, "# CLB = ");
663 pp_points_to_solution (buffer
, pt
);
664 newline_and_indent (buffer
, spc
);
670 if (gimple_call_internal_p (gs
))
671 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%s, %T", gs
,
672 internal_fn_name (gimple_call_internal_fn (gs
)), lhs
);
674 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T", gs
, fn
, lhs
);
675 if (gimple_call_num_args (gs
) > 0)
677 pp_string (buffer
, ", ");
678 dump_gimple_call_args (buffer
, gs
, flags
);
684 if (lhs
&& !(flags
& TDF_RHS_ONLY
))
686 dump_generic_node (buffer
, lhs
, spc
, flags
, false);
687 pp_string (buffer
, " =");
689 if (gimple_has_volatile_ops (gs
))
690 pp_string (buffer
, "{v}");
694 if (gimple_call_internal_p (gs
))
695 pp_string (buffer
, internal_fn_name (gimple_call_internal_fn (gs
)));
697 print_call_name (buffer
, fn
, flags
);
698 pp_string (buffer
, " (");
699 dump_gimple_call_args (buffer
, gs
, flags
);
700 pp_right_paren (buffer
);
701 if (!(flags
& TDF_RHS_ONLY
))
702 pp_semicolon (buffer
);
705 if (gimple_call_chain (gs
))
707 pp_string (buffer
, " [static-chain: ");
708 dump_generic_node (buffer
, gimple_call_chain (gs
), spc
, flags
, false);
709 pp_right_bracket (buffer
);
712 if (gimple_call_return_slot_opt_p (gs
))
713 pp_string (buffer
, " [return slot optimization]");
714 if (gimple_call_tail_p (gs
))
715 pp_string (buffer
, " [tail call]");
720 /* Dump the arguments of _ITM_beginTransaction sanely. */
721 if (TREE_CODE (fn
) == ADDR_EXPR
)
722 fn
= TREE_OPERAND (fn
, 0);
723 if (TREE_CODE (fn
) == FUNCTION_DECL
&& decl_is_tm_clone (fn
))
724 pp_string (buffer
, " [tm-clone]");
725 if (TREE_CODE (fn
) == FUNCTION_DECL
726 && DECL_BUILT_IN_CLASS (fn
) == BUILT_IN_NORMAL
727 && DECL_FUNCTION_CODE (fn
) == BUILT_IN_TM_START
728 && gimple_call_num_args (gs
) > 0)
730 tree t
= gimple_call_arg (gs
, 0);
731 unsigned HOST_WIDE_INT props
;
732 gcc_assert (TREE_CODE (t
) == INTEGER_CST
);
734 pp_string (buffer
, " [ ");
736 /* Get the transaction code properties. */
737 props
= TREE_INT_CST_LOW (t
);
739 if (props
& PR_INSTRUMENTEDCODE
)
740 pp_string (buffer
, "instrumentedCode ");
741 if (props
& PR_UNINSTRUMENTEDCODE
)
742 pp_string (buffer
, "uninstrumentedCode ");
743 if (props
& PR_HASNOXMMUPDATE
)
744 pp_string (buffer
, "hasNoXMMUpdate ");
745 if (props
& PR_HASNOABORT
)
746 pp_string (buffer
, "hasNoAbort ");
747 if (props
& PR_HASNOIRREVOCABLE
)
748 pp_string (buffer
, "hasNoIrrevocable ");
749 if (props
& PR_DOESGOIRREVOCABLE
)
750 pp_string (buffer
, "doesGoIrrevocable ");
751 if (props
& PR_HASNOSIMPLEREADS
)
752 pp_string (buffer
, "hasNoSimpleReads ");
753 if (props
& PR_AWBARRIERSOMITTED
)
754 pp_string (buffer
, "awBarriersOmitted ");
755 if (props
& PR_RARBARRIERSOMITTED
)
756 pp_string (buffer
, "RaRBarriersOmitted ");
757 if (props
& PR_UNDOLOGCODE
)
758 pp_string (buffer
, "undoLogCode ");
759 if (props
& PR_PREFERUNINSTRUMENTED
)
760 pp_string (buffer
, "preferUninstrumented ");
761 if (props
& PR_EXCEPTIONBLOCK
)
762 pp_string (buffer
, "exceptionBlock ");
763 if (props
& PR_HASELSE
)
764 pp_string (buffer
, "hasElse ");
765 if (props
& PR_READONLY
)
766 pp_string (buffer
, "readOnly ");
768 pp_right_bracket (buffer
);
773 /* Dump the switch statement GS. BUFFER, SPC and FLAGS are as in
777 dump_gimple_switch (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
781 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
783 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, ", gs
,
784 gimple_switch_index (gs
));
787 pp_string (buffer
, "switch (");
788 dump_generic_node (buffer
, gimple_switch_index (gs
), spc
, flags
, true);
789 pp_string (buffer
, ") <");
792 for (i
= 0; i
< gimple_switch_num_labels (gs
); i
++)
794 tree case_label
= gimple_switch_label (gs
, i
);
795 gcc_checking_assert (case_label
!= NULL_TREE
);
796 dump_generic_node (buffer
, case_label
, spc
, flags
, false);
798 dump_generic_node (buffer
, CASE_LABEL (case_label
), spc
, flags
, false);
799 if (i
< gimple_switch_num_labels (gs
) - 1)
800 pp_string (buffer
, ", ");
806 /* Dump the gimple conditional GS. BUFFER, SPC and FLAGS are as in
810 dump_gimple_cond (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
813 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%s, %T, %T, %T, %T>", gs
,
814 get_tree_code_name (gimple_cond_code (gs
)),
815 gimple_cond_lhs (gs
), gimple_cond_rhs (gs
),
816 gimple_cond_true_label (gs
), gimple_cond_false_label (gs
));
819 if (!(flags
& TDF_RHS_ONLY
))
820 pp_string (buffer
, "if (");
821 dump_generic_node (buffer
, gimple_cond_lhs (gs
), spc
, flags
, false);
823 pp_string (buffer
, op_symbol_code (gimple_cond_code (gs
)));
825 dump_generic_node (buffer
, gimple_cond_rhs (gs
), spc
, flags
, false);
826 if (!(flags
& TDF_RHS_ONLY
))
828 pp_right_paren (buffer
);
830 if (gimple_cond_true_label (gs
))
832 pp_string (buffer
, " goto ");
833 dump_generic_node (buffer
, gimple_cond_true_label (gs
),
835 pp_semicolon (buffer
);
837 if (gimple_cond_false_label (gs
))
839 pp_string (buffer
, " else goto ");
840 dump_generic_node (buffer
, gimple_cond_false_label (gs
),
842 pp_semicolon (buffer
);
849 /* Dump a GIMPLE_LABEL tuple on the pretty_printer BUFFER, SPC
850 spaces of indent. FLAGS specifies details to show in the dump (see
851 TDF_* in dumpfils.h). */
854 dump_gimple_label (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
856 tree label
= gimple_label_label (gs
);
858 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
, label
);
861 dump_generic_node (buffer
, label
, spc
, flags
, false);
864 if (DECL_NONLOCAL (label
))
865 pp_string (buffer
, " [non-local]");
866 if ((flags
& TDF_EH
) && EH_LANDING_PAD_NR (label
))
867 pp_printf (buffer
, " [LP %d]", EH_LANDING_PAD_NR (label
));
870 /* Dump a GIMPLE_GOTO tuple on the pretty_printer BUFFER, SPC
871 spaces of indent. FLAGS specifies details to show in the dump (see
872 TDF_* in dumpfile.h). */
875 dump_gimple_goto (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
877 tree label
= gimple_goto_dest (gs
);
879 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
, label
);
881 dump_gimple_fmt (buffer
, spc
, flags
, "goto %T;", label
);
885 /* Dump a GIMPLE_BIND tuple on the pretty_printer BUFFER, SPC
886 spaces of indent. FLAGS specifies details to show in the dump (see
887 TDF_* in dumpfile.h). */
890 dump_gimple_bind (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
893 dump_gimple_fmt (buffer
, spc
, flags
, "%G <", gs
);
895 pp_left_brace (buffer
);
896 if (!(flags
& TDF_SLIM
))
900 for (var
= gimple_bind_vars (gs
); var
; var
= DECL_CHAIN (var
))
902 newline_and_indent (buffer
, 2);
903 print_declaration (buffer
, var
, spc
, flags
);
905 if (gimple_bind_vars (gs
))
909 dump_gimple_seq (buffer
, gimple_bind_body (gs
), spc
+ 2, flags
);
910 newline_and_indent (buffer
, spc
);
914 pp_right_brace (buffer
);
918 /* Dump a GIMPLE_TRY tuple on the pretty_printer BUFFER, SPC spaces of
919 indent. FLAGS specifies details to show in the dump (see TDF_* in
923 dump_gimple_try (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
928 if (gimple_try_kind (gs
) == GIMPLE_TRY_CATCH
)
929 type
= "GIMPLE_TRY_CATCH";
930 else if (gimple_try_kind (gs
) == GIMPLE_TRY_FINALLY
)
931 type
= "GIMPLE_TRY_FINALLY";
933 type
= "UNKNOWN GIMPLE_TRY";
934 dump_gimple_fmt (buffer
, spc
, flags
,
935 "%G <%s,%+EVAL <%S>%nCLEANUP <%S>%->", gs
, type
,
936 gimple_try_eval (gs
), gimple_try_cleanup (gs
));
940 pp_string (buffer
, "try");
941 newline_and_indent (buffer
, spc
+ 2);
942 pp_left_brace (buffer
);
945 dump_gimple_seq (buffer
, gimple_try_eval (gs
), spc
+ 4, flags
);
946 newline_and_indent (buffer
, spc
+ 2);
947 pp_right_brace (buffer
);
949 if (gimple_try_kind (gs
) == GIMPLE_TRY_CATCH
)
951 newline_and_indent (buffer
, spc
);
952 pp_string (buffer
, "catch");
953 newline_and_indent (buffer
, spc
+ 2);
954 pp_left_brace (buffer
);
956 else if (gimple_try_kind (gs
) == GIMPLE_TRY_FINALLY
)
958 newline_and_indent (buffer
, spc
);
959 pp_string (buffer
, "finally");
960 newline_and_indent (buffer
, spc
+ 2);
961 pp_left_brace (buffer
);
964 pp_string (buffer
, " <UNKNOWN GIMPLE_TRY> {");
967 dump_gimple_seq (buffer
, gimple_try_cleanup (gs
), spc
+ 4, flags
);
968 newline_and_indent (buffer
, spc
+ 2);
969 pp_right_brace (buffer
);
974 /* Dump a GIMPLE_CATCH tuple on the pretty_printer BUFFER, SPC spaces of
975 indent. FLAGS specifies details to show in the dump (see TDF_* in
979 dump_gimple_catch (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
982 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %+CATCH <%S>%->", gs
,
983 gimple_catch_types (gs
), gimple_catch_handler (gs
));
985 dump_gimple_fmt (buffer
, spc
, flags
, "catch (%T)%+{%S}",
986 gimple_catch_types (gs
), gimple_catch_handler (gs
));
990 /* Dump a GIMPLE_EH_FILTER tuple on the pretty_printer BUFFER, SPC spaces of
991 indent. FLAGS specifies details to show in the dump (see TDF_* in
995 dump_gimple_eh_filter (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
998 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %+FAILURE <%S>%->", gs
,
999 gimple_eh_filter_types (gs
),
1000 gimple_eh_filter_failure (gs
));
1002 dump_gimple_fmt (buffer
, spc
, flags
, "<<<eh_filter (%T)>>>%+{%+%S%-}",
1003 gimple_eh_filter_types (gs
),
1004 gimple_eh_filter_failure (gs
));
1008 /* Dump a GIMPLE_EH_MUST_NOT_THROW tuple. */
1011 dump_gimple_eh_must_not_throw (pretty_printer
*buffer
, gimple gs
,
1014 if (flags
& TDF_RAW
)
1015 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
,
1016 gimple_eh_must_not_throw_fndecl (gs
));
1018 dump_gimple_fmt (buffer
, spc
, flags
, "<<<eh_must_not_throw (%T)>>>",
1019 gimple_eh_must_not_throw_fndecl (gs
));
1023 /* Dump a GIMPLE_EH_ELSE tuple on the pretty_printer BUFFER, SPC spaces of
1024 indent. FLAGS specifies details to show in the dump (see TDF_* in
1028 dump_gimple_eh_else (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1030 if (flags
& TDF_RAW
)
1031 dump_gimple_fmt (buffer
, spc
, flags
,
1032 "%G <%+N_BODY <%S>%nE_BODY <%S>%->", gs
,
1033 gimple_eh_else_n_body (gs
), gimple_eh_else_e_body (gs
));
1035 dump_gimple_fmt (buffer
, spc
, flags
,
1036 "<<<if_normal_exit>>>%+{%S}%-<<<else_eh_exit>>>%+{%S}",
1037 gimple_eh_else_n_body (gs
), gimple_eh_else_e_body (gs
));
1041 /* Dump a GIMPLE_RESX tuple on the pretty_printer BUFFER, SPC spaces of
1042 indent. FLAGS specifies details to show in the dump (see TDF_* in
1046 dump_gimple_resx (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1048 if (flags
& TDF_RAW
)
1049 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%d>", gs
,
1050 gimple_resx_region (gs
));
1052 dump_gimple_fmt (buffer
, spc
, flags
, "resx %d", gimple_resx_region (gs
));
1055 /* Dump a GIMPLE_EH_DISPATCH tuple on the pretty_printer BUFFER. */
1058 dump_gimple_eh_dispatch (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1060 if (flags
& TDF_RAW
)
1061 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%d>", gs
,
1062 gimple_eh_dispatch_region (gs
));
1064 dump_gimple_fmt (buffer
, spc
, flags
, "eh_dispatch %d",
1065 gimple_eh_dispatch_region (gs
));
1068 /* Dump a GIMPLE_DEBUG tuple on the pretty_printer BUFFER, SPC spaces
1069 of indent. FLAGS specifies details to show in the dump (see TDF_*
1073 dump_gimple_debug (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1075 switch (gs
->gsbase
.subcode
)
1077 case GIMPLE_DEBUG_BIND
:
1078 if (flags
& TDF_RAW
)
1079 dump_gimple_fmt (buffer
, spc
, flags
, "%G BIND <%T, %T>", gs
,
1080 gimple_debug_bind_get_var (gs
),
1081 gimple_debug_bind_get_value (gs
));
1083 dump_gimple_fmt (buffer
, spc
, flags
, "# DEBUG %T => %T",
1084 gimple_debug_bind_get_var (gs
),
1085 gimple_debug_bind_get_value (gs
));
1088 case GIMPLE_DEBUG_SOURCE_BIND
:
1089 if (flags
& TDF_RAW
)
1090 dump_gimple_fmt (buffer
, spc
, flags
, "%G SRCBIND <%T, %T>", gs
,
1091 gimple_debug_source_bind_get_var (gs
),
1092 gimple_debug_source_bind_get_value (gs
));
1094 dump_gimple_fmt (buffer
, spc
, flags
, "# DEBUG %T s=> %T",
1095 gimple_debug_source_bind_get_var (gs
),
1096 gimple_debug_source_bind_get_value (gs
));
1104 /* Dump a GIMPLE_OMP_FOR tuple on the pretty_printer BUFFER. */
1106 dump_gimple_omp_for (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1110 if (flags
& TDF_RAW
)
1113 switch (gimple_omp_for_kind (gs
))
1115 case GF_OMP_FOR_KIND_FOR
:
1118 case GF_OMP_FOR_KIND_SIMD
:
1121 case GF_OMP_FOR_KIND_CILKSIMD
:
1123 case GF_OMP_FOR_KIND_DISTRIBUTE
:
1124 kind
= " distribute";
1129 dump_gimple_fmt (buffer
, spc
, flags
, "%G%s <%+BODY <%S>%nCLAUSES <", gs
,
1130 kind
, gimple_omp_body (gs
));
1131 dump_omp_clauses (buffer
, gimple_omp_for_clauses (gs
), spc
, flags
);
1132 dump_gimple_fmt (buffer
, spc
, flags
, " >,");
1133 for (i
= 0; i
< gimple_omp_for_collapse (gs
); i
++)
1134 dump_gimple_fmt (buffer
, spc
, flags
,
1135 "%+%T, %T, %T, %s, %T,%n",
1136 gimple_omp_for_index (gs
, i
),
1137 gimple_omp_for_initial (gs
, i
),
1138 gimple_omp_for_final (gs
, i
),
1139 get_tree_code_name (gimple_omp_for_cond (gs
, i
)),
1140 gimple_omp_for_incr (gs
, i
));
1141 dump_gimple_fmt (buffer
, spc
, flags
, "PRE_BODY <%S>%->",
1142 gimple_omp_for_pre_body (gs
));
1146 switch (gimple_omp_for_kind (gs
))
1148 case GF_OMP_FOR_KIND_FOR
:
1149 pp_string (buffer
, "#pragma omp for");
1151 case GF_OMP_FOR_KIND_SIMD
:
1152 pp_string (buffer
, "#pragma omp simd");
1154 case GF_OMP_FOR_KIND_CILKSIMD
:
1155 pp_string (buffer
, "#pragma simd");
1157 case GF_OMP_FOR_KIND_DISTRIBUTE
:
1158 pp_string (buffer
, "#pragma omp distribute");
1163 dump_omp_clauses (buffer
, gimple_omp_for_clauses (gs
), spc
, flags
);
1164 for (i
= 0; i
< gimple_omp_for_collapse (gs
); i
++)
1168 newline_and_indent (buffer
, spc
);
1169 pp_string (buffer
, "for (");
1170 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
1172 pp_string (buffer
, " = ");
1173 dump_generic_node (buffer
, gimple_omp_for_initial (gs
, i
), spc
,
1175 pp_string (buffer
, "; ");
1177 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
1180 switch (gimple_omp_for_cond (gs
, i
))
1186 pp_greater (buffer
);
1189 pp_less_equal (buffer
);
1192 pp_greater_equal (buffer
);
1198 dump_generic_node (buffer
, gimple_omp_for_final (gs
, i
), spc
,
1200 pp_string (buffer
, "; ");
1202 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
1204 pp_string (buffer
, " = ");
1205 dump_generic_node (buffer
, gimple_omp_for_incr (gs
, i
), spc
,
1207 pp_right_paren (buffer
);
1210 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1212 newline_and_indent (buffer
, spc
+ 2);
1213 pp_left_brace (buffer
);
1214 pp_newline (buffer
);
1215 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1216 newline_and_indent (buffer
, spc
+ 2);
1217 pp_right_brace (buffer
);
1222 /* Dump a GIMPLE_OMP_CONTINUE tuple on the pretty_printer BUFFER. */
1225 dump_gimple_omp_continue (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1227 if (flags
& TDF_RAW
)
1229 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T>", gs
,
1230 gimple_omp_continue_control_def (gs
),
1231 gimple_omp_continue_control_use (gs
));
1235 pp_string (buffer
, "#pragma omp continue (");
1236 dump_generic_node (buffer
, gimple_omp_continue_control_def (gs
),
1240 dump_generic_node (buffer
, gimple_omp_continue_control_use (gs
),
1242 pp_right_paren (buffer
);
1246 /* Dump a GIMPLE_OMP_SINGLE tuple on the pretty_printer BUFFER. */
1249 dump_gimple_omp_single (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1251 if (flags
& TDF_RAW
)
1253 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1254 gimple_omp_body (gs
));
1255 dump_omp_clauses (buffer
, gimple_omp_single_clauses (gs
), spc
, flags
);
1256 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1260 pp_string (buffer
, "#pragma omp single");
1261 dump_omp_clauses (buffer
, gimple_omp_single_clauses (gs
), spc
, flags
);
1262 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1264 newline_and_indent (buffer
, spc
+ 2);
1265 pp_left_brace (buffer
);
1266 pp_newline (buffer
);
1267 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1268 newline_and_indent (buffer
, spc
+ 2);
1269 pp_right_brace (buffer
);
1274 /* Dump a GIMPLE_OMP_TARGET tuple on the pretty_printer BUFFER. */
1277 dump_gimple_omp_target (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1280 switch (gimple_omp_target_kind (gs
))
1282 case GF_OMP_TARGET_KIND_REGION
:
1285 case GF_OMP_TARGET_KIND_DATA
:
1288 case GF_OMP_TARGET_KIND_UPDATE
:
1294 if (flags
& TDF_RAW
)
1296 dump_gimple_fmt (buffer
, spc
, flags
, "%G%s <%+BODY <%S>%nCLAUSES <", gs
,
1297 kind
, gimple_omp_body (gs
));
1298 dump_omp_clauses (buffer
, gimple_omp_target_clauses (gs
), spc
, flags
);
1299 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1303 pp_string (buffer
, "#pragma omp target");
1304 pp_string (buffer
, kind
);
1305 dump_omp_clauses (buffer
, gimple_omp_target_clauses (gs
), spc
, flags
);
1306 if (gimple_omp_target_child_fn (gs
))
1308 pp_string (buffer
, " [child fn: ");
1309 dump_generic_node (buffer
, gimple_omp_target_child_fn (gs
),
1311 pp_right_bracket (buffer
);
1313 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1315 newline_and_indent (buffer
, spc
+ 2);
1316 pp_character (buffer
, '{');
1317 pp_newline (buffer
);
1318 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1319 newline_and_indent (buffer
, spc
+ 2);
1320 pp_character (buffer
, '}');
1325 /* Dump a GIMPLE_OMP_TEAMS tuple on the pretty_printer BUFFER. */
1328 dump_gimple_omp_teams (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1330 if (flags
& TDF_RAW
)
1332 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1333 gimple_omp_body (gs
));
1334 dump_omp_clauses (buffer
, gimple_omp_teams_clauses (gs
), spc
, flags
);
1335 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1339 pp_string (buffer
, "#pragma omp teams");
1340 dump_omp_clauses (buffer
, gimple_omp_teams_clauses (gs
), spc
, flags
);
1341 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1343 newline_and_indent (buffer
, spc
+ 2);
1344 pp_character (buffer
, '{');
1345 pp_newline (buffer
);
1346 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1347 newline_and_indent (buffer
, spc
+ 2);
1348 pp_character (buffer
, '}');
1353 /* Dump a GIMPLE_OMP_SECTIONS tuple on the pretty_printer BUFFER. */
1356 dump_gimple_omp_sections (pretty_printer
*buffer
, gimple gs
, int spc
,
1359 if (flags
& TDF_RAW
)
1361 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1362 gimple_omp_body (gs
));
1363 dump_omp_clauses (buffer
, gimple_omp_sections_clauses (gs
), spc
, flags
);
1364 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1368 pp_string (buffer
, "#pragma omp sections");
1369 if (gimple_omp_sections_control (gs
))
1371 pp_string (buffer
, " <");
1372 dump_generic_node (buffer
, gimple_omp_sections_control (gs
), spc
,
1374 pp_greater (buffer
);
1376 dump_omp_clauses (buffer
, gimple_omp_sections_clauses (gs
), spc
, flags
);
1377 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1379 newline_and_indent (buffer
, spc
+ 2);
1380 pp_left_brace (buffer
);
1381 pp_newline (buffer
);
1382 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1383 newline_and_indent (buffer
, spc
+ 2);
1384 pp_right_brace (buffer
);
1389 /* Dump a GIMPLE_OMP_{MASTER,TASKGROUP,ORDERED,SECTION} tuple on the
1390 pretty_printer BUFFER. */
1393 dump_gimple_omp_block (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1395 if (flags
& TDF_RAW
)
1396 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1397 gimple_omp_body (gs
));
1400 switch (gimple_code (gs
))
1402 case GIMPLE_OMP_MASTER
:
1403 pp_string (buffer
, "#pragma omp master");
1405 case GIMPLE_OMP_TASKGROUP
:
1406 pp_string (buffer
, "#pragma omp taskgroup");
1408 case GIMPLE_OMP_ORDERED
:
1409 pp_string (buffer
, "#pragma omp ordered");
1411 case GIMPLE_OMP_SECTION
:
1412 pp_string (buffer
, "#pragma omp section");
1417 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1419 newline_and_indent (buffer
, spc
+ 2);
1420 pp_left_brace (buffer
);
1421 pp_newline (buffer
);
1422 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1423 newline_and_indent (buffer
, spc
+ 2);
1424 pp_right_brace (buffer
);
1429 /* Dump a GIMPLE_OMP_CRITICAL tuple on the pretty_printer BUFFER. */
1432 dump_gimple_omp_critical (pretty_printer
*buffer
, gimple gs
, int spc
,
1435 if (flags
& TDF_RAW
)
1436 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1437 gimple_omp_body (gs
));
1440 pp_string (buffer
, "#pragma omp critical");
1441 if (gimple_omp_critical_name (gs
))
1443 pp_string (buffer
, " (");
1444 dump_generic_node (buffer
, gimple_omp_critical_name (gs
), spc
,
1446 pp_right_paren (buffer
);
1448 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1450 newline_and_indent (buffer
, spc
+ 2);
1451 pp_left_brace (buffer
);
1452 pp_newline (buffer
);
1453 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1454 newline_and_indent (buffer
, spc
+ 2);
1455 pp_right_brace (buffer
);
1460 /* Dump a GIMPLE_OMP_RETURN tuple on the pretty_printer BUFFER. */
1463 dump_gimple_omp_return (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1465 if (flags
& TDF_RAW
)
1467 dump_gimple_fmt (buffer
, spc
, flags
, "%G <nowait=%d", gs
,
1468 (int) gimple_omp_return_nowait_p (gs
));
1469 if (gimple_omp_return_lhs (gs
))
1470 dump_gimple_fmt (buffer
, spc
, flags
, ", lhs=%T>",
1471 gimple_omp_return_lhs (gs
));
1473 dump_gimple_fmt (buffer
, spc
, flags
, ">");
1477 pp_string (buffer
, "#pragma omp return");
1478 if (gimple_omp_return_nowait_p (gs
))
1479 pp_string (buffer
, "(nowait)");
1480 if (gimple_omp_return_lhs (gs
))
1482 pp_string (buffer
, " (set ");
1483 dump_generic_node (buffer
, gimple_omp_return_lhs (gs
),
1485 pp_character (buffer
, ')');
1490 /* Dump a GIMPLE_TRANSACTION tuple on the pretty_printer BUFFER. */
1493 dump_gimple_transaction (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1495 unsigned subcode
= gimple_transaction_subcode (gs
);
1497 if (flags
& TDF_RAW
)
1499 dump_gimple_fmt (buffer
, spc
, flags
,
1500 "%G [SUBCODE=%x,LABEL=%T] <%+BODY <%S> >",
1501 gs
, subcode
, gimple_transaction_label (gs
),
1502 gimple_transaction_body (gs
));
1506 if (subcode
& GTMA_IS_OUTER
)
1507 pp_string (buffer
, "__transaction_atomic [[outer]]");
1508 else if (subcode
& GTMA_IS_RELAXED
)
1509 pp_string (buffer
, "__transaction_relaxed");
1511 pp_string (buffer
, "__transaction_atomic");
1512 subcode
&= ~GTMA_DECLARATION_MASK
;
1514 if (subcode
|| gimple_transaction_label (gs
))
1516 pp_string (buffer
, " //");
1517 if (gimple_transaction_label (gs
))
1519 pp_string (buffer
, " LABEL=");
1520 dump_generic_node (buffer
, gimple_transaction_label (gs
),
1525 pp_string (buffer
, " SUBCODE=[ ");
1526 if (subcode
& GTMA_HAVE_ABORT
)
1528 pp_string (buffer
, "GTMA_HAVE_ABORT ");
1529 subcode
&= ~GTMA_HAVE_ABORT
;
1531 if (subcode
& GTMA_HAVE_LOAD
)
1533 pp_string (buffer
, "GTMA_HAVE_LOAD ");
1534 subcode
&= ~GTMA_HAVE_LOAD
;
1536 if (subcode
& GTMA_HAVE_STORE
)
1538 pp_string (buffer
, "GTMA_HAVE_STORE ");
1539 subcode
&= ~GTMA_HAVE_STORE
;
1541 if (subcode
& GTMA_MAY_ENTER_IRREVOCABLE
)
1543 pp_string (buffer
, "GTMA_MAY_ENTER_IRREVOCABLE ");
1544 subcode
&= ~GTMA_MAY_ENTER_IRREVOCABLE
;
1546 if (subcode
& GTMA_DOES_GO_IRREVOCABLE
)
1548 pp_string (buffer
, "GTMA_DOES_GO_IRREVOCABLE ");
1549 subcode
&= ~GTMA_DOES_GO_IRREVOCABLE
;
1551 if (subcode
& GTMA_HAS_NO_INSTRUMENTATION
)
1553 pp_string (buffer
, "GTMA_HAS_NO_INSTRUMENTATION ");
1554 subcode
&= ~GTMA_HAS_NO_INSTRUMENTATION
;
1557 pp_printf (buffer
, "0x%x ", subcode
);
1558 pp_right_bracket (buffer
);
1562 if (!gimple_seq_empty_p (gimple_transaction_body (gs
)))
1564 newline_and_indent (buffer
, spc
+ 2);
1565 pp_left_brace (buffer
);
1566 pp_newline (buffer
);
1567 dump_gimple_seq (buffer
, gimple_transaction_body (gs
),
1569 newline_and_indent (buffer
, spc
+ 2);
1570 pp_right_brace (buffer
);
1575 /* Dump a GIMPLE_ASM tuple on the pretty_printer BUFFER, SPC spaces of
1576 indent. FLAGS specifies details to show in the dump (see TDF_* in
1580 dump_gimple_asm (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1582 unsigned int i
, n
, f
, fields
;
1584 if (flags
& TDF_RAW
)
1586 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+STRING <%n%s%n>", gs
,
1587 gimple_asm_string (gs
));
1589 n
= gimple_asm_noutputs (gs
);
1592 newline_and_indent (buffer
, spc
+ 2);
1593 pp_string (buffer
, "OUTPUT: ");
1594 for (i
= 0; i
< n
; i
++)
1596 dump_generic_node (buffer
, gimple_asm_output_op (gs
, i
),
1599 pp_string (buffer
, ", ");
1603 n
= gimple_asm_ninputs (gs
);
1606 newline_and_indent (buffer
, spc
+ 2);
1607 pp_string (buffer
, "INPUT: ");
1608 for (i
= 0; i
< n
; i
++)
1610 dump_generic_node (buffer
, gimple_asm_input_op (gs
, i
),
1613 pp_string (buffer
, ", ");
1617 n
= gimple_asm_nclobbers (gs
);
1620 newline_and_indent (buffer
, spc
+ 2);
1621 pp_string (buffer
, "CLOBBER: ");
1622 for (i
= 0; i
< n
; i
++)
1624 dump_generic_node (buffer
, gimple_asm_clobber_op (gs
, i
),
1627 pp_string (buffer
, ", ");
1631 n
= gimple_asm_nlabels (gs
);
1634 newline_and_indent (buffer
, spc
+ 2);
1635 pp_string (buffer
, "LABEL: ");
1636 for (i
= 0; i
< n
; i
++)
1638 dump_generic_node (buffer
, gimple_asm_label_op (gs
, i
),
1641 pp_string (buffer
, ", ");
1645 newline_and_indent (buffer
, spc
);
1646 pp_greater (buffer
);
1650 pp_string (buffer
, "__asm__");
1651 if (gimple_asm_volatile_p (gs
))
1652 pp_string (buffer
, " __volatile__");
1653 if (gimple_asm_nlabels (gs
))
1654 pp_string (buffer
, " goto");
1655 pp_string (buffer
, "(\"");
1656 pp_string (buffer
, gimple_asm_string (gs
));
1657 pp_string (buffer
, "\"");
1659 if (gimple_asm_nlabels (gs
))
1661 else if (gimple_asm_nclobbers (gs
))
1663 else if (gimple_asm_ninputs (gs
))
1665 else if (gimple_asm_noutputs (gs
))
1670 for (f
= 0; f
< fields
; ++f
)
1672 pp_string (buffer
, " : ");
1677 n
= gimple_asm_noutputs (gs
);
1678 for (i
= 0; i
< n
; i
++)
1680 dump_generic_node (buffer
, gimple_asm_output_op (gs
, i
),
1683 pp_string (buffer
, ", ");
1688 n
= gimple_asm_ninputs (gs
);
1689 for (i
= 0; i
< n
; i
++)
1691 dump_generic_node (buffer
, gimple_asm_input_op (gs
, i
),
1694 pp_string (buffer
, ", ");
1699 n
= gimple_asm_nclobbers (gs
);
1700 for (i
= 0; i
< n
; i
++)
1702 dump_generic_node (buffer
, gimple_asm_clobber_op (gs
, i
),
1705 pp_string (buffer
, ", ");
1710 n
= gimple_asm_nlabels (gs
);
1711 for (i
= 0; i
< n
; i
++)
1713 dump_generic_node (buffer
, gimple_asm_label_op (gs
, i
),
1716 pp_string (buffer
, ", ");
1725 pp_string (buffer
, ");");
1729 /* Dump ptr_info and range_info for NODE on pretty_printer BUFFER with
1730 SPC spaces of indent. */
1733 dump_ssaname_info (pretty_printer
*buffer
, tree node
, int spc
)
1735 if (TREE_CODE (node
) != SSA_NAME
)
1738 if (POINTER_TYPE_P (TREE_TYPE (node
))
1739 && SSA_NAME_PTR_INFO (node
))
1741 unsigned int align
, misalign
;
1742 struct ptr_info_def
*pi
= SSA_NAME_PTR_INFO (node
);
1743 pp_string (buffer
, "# PT = ");
1744 pp_points_to_solution (buffer
, &pi
->pt
);
1745 newline_and_indent (buffer
, spc
);
1746 if (get_ptr_info_alignment (pi
, &align
, &misalign
))
1748 pp_printf (buffer
, "# ALIGN = %u, MISALIGN = %u", align
, misalign
);
1749 newline_and_indent (buffer
, spc
);
1753 if (!POINTER_TYPE_P (TREE_TYPE (node
))
1754 && SSA_NAME_RANGE_INFO (node
))
1756 double_int min
, max
, nonzero_bits
;
1757 value_range_type range_type
= get_range_info (node
, &min
, &max
);
1759 if (range_type
== VR_VARYING
)
1760 pp_printf (buffer
, "# RANGE VR_VARYING");
1761 else if (range_type
== VR_RANGE
|| range_type
== VR_ANTI_RANGE
)
1763 pp_printf (buffer
, "# RANGE ");
1764 pp_printf (buffer
, "%s[", range_type
== VR_RANGE
? "" : "~");
1765 pp_double_int (buffer
, min
, TYPE_UNSIGNED (TREE_TYPE (node
)));
1766 pp_printf (buffer
, ", ");
1767 pp_double_int (buffer
, max
, TYPE_UNSIGNED (TREE_TYPE (node
)));
1768 pp_printf (buffer
, "]");
1770 nonzero_bits
= get_nonzero_bits (node
);
1771 if (nonzero_bits
!= double_int_minus_one
1773 != double_int::mask (TYPE_PRECISION (TREE_TYPE (node
)))))
1775 pp_string (buffer
, " NONZERO ");
1776 sprintf (pp_buffer (buffer
)->digit_buffer
,
1777 HOST_WIDE_INT_PRINT_DOUBLE_HEX
,
1778 (unsigned HOST_WIDE_INT
) nonzero_bits
.high
,
1780 pp_string (buffer
, pp_buffer (buffer
)->digit_buffer
);
1782 newline_and_indent (buffer
, spc
);
1787 /* Dump a PHI node PHI. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1.
1788 The caller is responsible for calling pp_flush on BUFFER to finalize
1789 pretty printer. If COMMENT is true, print this after #. */
1792 dump_gimple_phi (pretty_printer
*buffer
, gimple phi
, int spc
, bool comment
,
1796 tree lhs
= gimple_phi_result (phi
);
1798 if (flags
& TDF_ALIAS
)
1799 dump_ssaname_info (buffer
, lhs
, spc
);
1802 pp_string (buffer
, "# ");
1804 if (flags
& TDF_RAW
)
1805 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, ", phi
,
1806 gimple_phi_result (phi
));
1809 dump_generic_node (buffer
, lhs
, spc
, flags
, false);
1810 pp_string (buffer
, " = PHI <");
1812 for (i
= 0; i
< gimple_phi_num_args (phi
); i
++)
1814 if ((flags
& TDF_LINENO
) && gimple_phi_arg_has_location (phi
, i
))
1816 expanded_location xloc
;
1818 xloc
= expand_location (gimple_phi_arg_location (phi
, i
));
1819 pp_left_bracket (buffer
);
1822 pp_string (buffer
, xloc
.file
);
1823 pp_string (buffer
, " : ");
1825 pp_decimal_int (buffer
, xloc
.line
);
1827 pp_decimal_int (buffer
, xloc
.column
);
1828 pp_string (buffer
, "] ");
1830 dump_generic_node (buffer
, gimple_phi_arg_def (phi
, i
), spc
, flags
,
1832 pp_left_paren (buffer
);
1833 pp_decimal_int (buffer
, gimple_phi_arg_edge (phi
, i
)->src
->index
);
1834 pp_right_paren (buffer
);
1835 if (i
< gimple_phi_num_args (phi
) - 1)
1836 pp_string (buffer
, ", ");
1838 pp_greater (buffer
);
1842 /* Dump a GIMPLE_OMP_PARALLEL tuple on the pretty_printer BUFFER, SPC spaces
1843 of indent. FLAGS specifies details to show in the dump (see TDF_* in
1847 dump_gimple_omp_parallel (pretty_printer
*buffer
, gimple gs
, int spc
,
1850 if (flags
& TDF_RAW
)
1852 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1853 gimple_omp_body (gs
));
1854 dump_omp_clauses (buffer
, gimple_omp_parallel_clauses (gs
), spc
, flags
);
1855 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T%n>",
1856 gimple_omp_parallel_child_fn (gs
),
1857 gimple_omp_parallel_data_arg (gs
));
1862 pp_string (buffer
, "#pragma omp parallel");
1863 dump_omp_clauses (buffer
, gimple_omp_parallel_clauses (gs
), spc
, flags
);
1864 if (gimple_omp_parallel_child_fn (gs
))
1866 pp_string (buffer
, " [child fn: ");
1867 dump_generic_node (buffer
, gimple_omp_parallel_child_fn (gs
),
1869 pp_string (buffer
, " (");
1870 if (gimple_omp_parallel_data_arg (gs
))
1871 dump_generic_node (buffer
, gimple_omp_parallel_data_arg (gs
),
1874 pp_string (buffer
, "???");
1875 pp_string (buffer
, ")]");
1877 body
= gimple_omp_body (gs
);
1878 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
1880 newline_and_indent (buffer
, spc
+ 2);
1881 pp_left_brace (buffer
);
1882 pp_newline (buffer
);
1883 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
1884 newline_and_indent (buffer
, spc
+ 2);
1885 pp_right_brace (buffer
);
1889 pp_newline (buffer
);
1890 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
1896 /* Dump a GIMPLE_OMP_TASK tuple on the pretty_printer BUFFER, SPC spaces
1897 of indent. FLAGS specifies details to show in the dump (see TDF_* in
1901 dump_gimple_omp_task (pretty_printer
*buffer
, gimple gs
, int spc
,
1904 if (flags
& TDF_RAW
)
1906 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1907 gimple_omp_body (gs
));
1908 dump_omp_clauses (buffer
, gimple_omp_task_clauses (gs
), spc
, flags
);
1909 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T, %T, %T, %T%n>",
1910 gimple_omp_task_child_fn (gs
),
1911 gimple_omp_task_data_arg (gs
),
1912 gimple_omp_task_copy_fn (gs
),
1913 gimple_omp_task_arg_size (gs
),
1914 gimple_omp_task_arg_size (gs
));
1919 pp_string (buffer
, "#pragma omp task");
1920 dump_omp_clauses (buffer
, gimple_omp_task_clauses (gs
), spc
, flags
);
1921 if (gimple_omp_task_child_fn (gs
))
1923 pp_string (buffer
, " [child fn: ");
1924 dump_generic_node (buffer
, gimple_omp_task_child_fn (gs
),
1926 pp_string (buffer
, " (");
1927 if (gimple_omp_task_data_arg (gs
))
1928 dump_generic_node (buffer
, gimple_omp_task_data_arg (gs
),
1931 pp_string (buffer
, "???");
1932 pp_string (buffer
, ")]");
1934 body
= gimple_omp_body (gs
);
1935 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
1937 newline_and_indent (buffer
, spc
+ 2);
1938 pp_left_brace (buffer
);
1939 pp_newline (buffer
);
1940 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
1941 newline_and_indent (buffer
, spc
+ 2);
1942 pp_right_brace (buffer
);
1946 pp_newline (buffer
);
1947 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
1953 /* Dump a GIMPLE_OMP_ATOMIC_LOAD tuple on the pretty_printer BUFFER, SPC
1954 spaces of indent. FLAGS specifies details to show in the dump (see TDF_*
1958 dump_gimple_omp_atomic_load (pretty_printer
*buffer
, gimple gs
, int spc
,
1961 if (flags
& TDF_RAW
)
1963 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T>", gs
,
1964 gimple_omp_atomic_load_lhs (gs
),
1965 gimple_omp_atomic_load_rhs (gs
));
1969 pp_string (buffer
, "#pragma omp atomic_load");
1970 if (gimple_omp_atomic_seq_cst_p (gs
))
1971 pp_string (buffer
, " seq_cst");
1972 if (gimple_omp_atomic_need_value_p (gs
))
1973 pp_string (buffer
, " [needed]");
1974 newline_and_indent (buffer
, spc
+ 2);
1975 dump_generic_node (buffer
, gimple_omp_atomic_load_lhs (gs
),
1981 dump_generic_node (buffer
, gimple_omp_atomic_load_rhs (gs
),
1986 /* Dump a GIMPLE_OMP_ATOMIC_STORE tuple on the pretty_printer BUFFER, SPC
1987 spaces of indent. FLAGS specifies details to show in the dump (see TDF_*
1991 dump_gimple_omp_atomic_store (pretty_printer
*buffer
, gimple gs
, int spc
,
1994 if (flags
& TDF_RAW
)
1996 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
,
1997 gimple_omp_atomic_store_val (gs
));
2001 pp_string (buffer
, "#pragma omp atomic_store ");
2002 if (gimple_omp_atomic_seq_cst_p (gs
))
2003 pp_string (buffer
, "seq_cst ");
2004 if (gimple_omp_atomic_need_value_p (gs
))
2005 pp_string (buffer
, "[needed] ");
2006 pp_left_paren (buffer
);
2007 dump_generic_node (buffer
, gimple_omp_atomic_store_val (gs
),
2009 pp_right_paren (buffer
);
2014 /* Dump all the memory operands for statement GS. BUFFER, SPC and
2015 FLAGS are as in pp_gimple_stmt_1. */
2018 dump_gimple_mem_ops (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
2020 tree vdef
= gimple_vdef (gs
);
2021 tree vuse
= gimple_vuse (gs
);
2023 if (!ssa_operands_active (DECL_STRUCT_FUNCTION (current_function_decl
))
2024 || !gimple_references_memory_p (gs
))
2027 if (vdef
!= NULL_TREE
)
2029 pp_string (buffer
, "# ");
2030 dump_generic_node (buffer
, vdef
, spc
+ 2, flags
, false);
2031 pp_string (buffer
, " = VDEF <");
2032 dump_generic_node (buffer
, vuse
, spc
+ 2, flags
, false);
2033 pp_greater (buffer
);
2034 newline_and_indent (buffer
, spc
);
2036 else if (vuse
!= NULL_TREE
)
2038 pp_string (buffer
, "# VUSE <");
2039 dump_generic_node (buffer
, vuse
, spc
+ 2, flags
, false);
2040 pp_greater (buffer
);
2041 newline_and_indent (buffer
, spc
);
2046 /* Print the gimple statement GS on the pretty printer BUFFER, SPC
2047 spaces of indent. FLAGS specifies details to show in the dump (see
2048 TDF_* in dumpfile.h). The caller is responsible for calling
2049 pp_flush on BUFFER to finalize the pretty printer. */
2052 pp_gimple_stmt_1 (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
2057 if (flags
& TDF_STMTADDR
)
2058 pp_printf (buffer
, "<&%p> ", (void *) gs
);
2060 if ((flags
& TDF_LINENO
) && gimple_has_location (gs
))
2062 expanded_location xloc
= expand_location (gimple_location (gs
));
2063 pp_left_bracket (buffer
);
2066 pp_string (buffer
, xloc
.file
);
2067 pp_string (buffer
, " : ");
2069 pp_decimal_int (buffer
, xloc
.line
);
2071 pp_decimal_int (buffer
, xloc
.column
);
2072 pp_string (buffer
, "] ");
2077 int lp_nr
= lookup_stmt_eh_lp (gs
);
2079 pp_printf (buffer
, "[LP %d] ", lp_nr
);
2081 pp_printf (buffer
, "[MNT %d] ", -lp_nr
);
2084 if ((flags
& (TDF_VOPS
|TDF_MEMSYMS
))
2085 && gimple_has_mem_ops (gs
))
2086 dump_gimple_mem_ops (buffer
, gs
, spc
, flags
);
2088 if (gimple_has_lhs (gs
)
2089 && (flags
& TDF_ALIAS
))
2090 dump_ssaname_info (buffer
, gimple_get_lhs (gs
), spc
);
2092 switch (gimple_code (gs
))
2095 dump_gimple_asm (buffer
, gs
, spc
, flags
);
2099 dump_gimple_assign (buffer
, gs
, spc
, flags
);
2103 dump_gimple_bind (buffer
, gs
, spc
, flags
);
2107 dump_gimple_call (buffer
, gs
, spc
, flags
);
2111 dump_gimple_cond (buffer
, gs
, spc
, flags
);
2115 dump_gimple_label (buffer
, gs
, spc
, flags
);
2119 dump_gimple_goto (buffer
, gs
, spc
, flags
);
2123 pp_string (buffer
, "GIMPLE_NOP");
2127 dump_gimple_return (buffer
, gs
, spc
, flags
);
2131 dump_gimple_switch (buffer
, gs
, spc
, flags
);
2135 dump_gimple_try (buffer
, gs
, spc
, flags
);
2139 dump_gimple_phi (buffer
, gs
, spc
, false, flags
);
2142 case GIMPLE_OMP_PARALLEL
:
2143 dump_gimple_omp_parallel (buffer
, gs
, spc
, flags
);
2146 case GIMPLE_OMP_TASK
:
2147 dump_gimple_omp_task (buffer
, gs
, spc
, flags
);
2150 case GIMPLE_OMP_ATOMIC_LOAD
:
2151 dump_gimple_omp_atomic_load (buffer
, gs
, spc
, flags
);
2155 case GIMPLE_OMP_ATOMIC_STORE
:
2156 dump_gimple_omp_atomic_store (buffer
, gs
, spc
, flags
);
2159 case GIMPLE_OMP_FOR
:
2160 dump_gimple_omp_for (buffer
, gs
, spc
, flags
);
2163 case GIMPLE_OMP_CONTINUE
:
2164 dump_gimple_omp_continue (buffer
, gs
, spc
, flags
);
2167 case GIMPLE_OMP_SINGLE
:
2168 dump_gimple_omp_single (buffer
, gs
, spc
, flags
);
2171 case GIMPLE_OMP_TARGET
:
2172 dump_gimple_omp_target (buffer
, gs
, spc
, flags
);
2175 case GIMPLE_OMP_TEAMS
:
2176 dump_gimple_omp_teams (buffer
, gs
, spc
, flags
);
2179 case GIMPLE_OMP_RETURN
:
2180 dump_gimple_omp_return (buffer
, gs
, spc
, flags
);
2183 case GIMPLE_OMP_SECTIONS
:
2184 dump_gimple_omp_sections (buffer
, gs
, spc
, flags
);
2187 case GIMPLE_OMP_SECTIONS_SWITCH
:
2188 pp_string (buffer
, "GIMPLE_SECTIONS_SWITCH");
2191 case GIMPLE_OMP_MASTER
:
2192 case GIMPLE_OMP_TASKGROUP
:
2193 case GIMPLE_OMP_ORDERED
:
2194 case GIMPLE_OMP_SECTION
:
2195 dump_gimple_omp_block (buffer
, gs
, spc
, flags
);
2198 case GIMPLE_OMP_CRITICAL
:
2199 dump_gimple_omp_critical (buffer
, gs
, spc
, flags
);
2203 dump_gimple_catch (buffer
, gs
, spc
, flags
);
2206 case GIMPLE_EH_FILTER
:
2207 dump_gimple_eh_filter (buffer
, gs
, spc
, flags
);
2210 case GIMPLE_EH_MUST_NOT_THROW
:
2211 dump_gimple_eh_must_not_throw (buffer
, gs
, spc
, flags
);
2214 case GIMPLE_EH_ELSE
:
2215 dump_gimple_eh_else (buffer
, gs
, spc
, flags
);
2219 dump_gimple_resx (buffer
, gs
, spc
, flags
);
2222 case GIMPLE_EH_DISPATCH
:
2223 dump_gimple_eh_dispatch (buffer
, gs
, spc
, flags
);
2227 dump_gimple_debug (buffer
, gs
, spc
, flags
);
2230 case GIMPLE_PREDICT
:
2231 pp_string (buffer
, "// predicted ");
2232 if (gimple_predict_outcome (gs
))
2233 pp_string (buffer
, "likely by ");
2235 pp_string (buffer
, "unlikely by ");
2236 pp_string (buffer
, predictor_name (gimple_predict_predictor (gs
)));
2237 pp_string (buffer
, " predictor.");
2240 case GIMPLE_TRANSACTION
:
2241 dump_gimple_transaction (buffer
, gs
, spc
, flags
);
2250 /* Dumps header of basic block BB to OUTF indented by INDENT
2251 spaces and details described by flags. */
2254 dump_gimple_bb_header (FILE *outf
, basic_block bb
, int indent
, int flags
)
2256 if (flags
& TDF_BLOCKS
)
2258 if (flags
& TDF_LINENO
)
2260 gimple_stmt_iterator gsi
;
2262 if (flags
& TDF_COMMENT
)
2263 fputs (";; ", outf
);
2265 for (gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
); gsi_next (&gsi
))
2266 if (!is_gimple_debug (gsi_stmt (gsi
))
2267 && get_lineno (gsi_stmt (gsi
)) != UNKNOWN_LOCATION
)
2269 fprintf (outf
, "%*sstarting at line %d",
2270 indent
, "", get_lineno (gsi_stmt (gsi
)));
2273 if (bb
->discriminator
)
2274 fprintf (outf
, ", discriminator %i", bb
->discriminator
);
2280 gimple stmt
= first_stmt (bb
);
2281 if (!stmt
|| gimple_code (stmt
) != GIMPLE_LABEL
)
2282 fprintf (outf
, "%*s<bb %d>:\n", indent
, "", bb
->index
);
2287 /* Dumps end of basic block BB to buffer BUFFER indented by INDENT
2291 dump_gimple_bb_footer (FILE *outf ATTRIBUTE_UNUSED
,
2292 basic_block bb ATTRIBUTE_UNUSED
,
2293 int indent ATTRIBUTE_UNUSED
,
2294 int flags ATTRIBUTE_UNUSED
)
2296 /* There is currently no GIMPLE-specific basic block info to dump. */
2301 /* Dump PHI nodes of basic block BB to BUFFER with details described
2302 by FLAGS and indented by INDENT spaces. */
2305 dump_phi_nodes (pretty_printer
*buffer
, basic_block bb
, int indent
, int flags
)
2307 gimple_stmt_iterator i
;
2309 for (i
= gsi_start_phis (bb
); !gsi_end_p (i
); gsi_next (&i
))
2311 gimple phi
= gsi_stmt (i
);
2312 if (!virtual_operand_p (gimple_phi_result (phi
)) || (flags
& TDF_VOPS
))
2315 dump_gimple_phi (buffer
, phi
, indent
, true, flags
);
2316 pp_newline (buffer
);
2322 /* Dump jump to basic block BB that is represented implicitly in the cfg
2326 pp_cfg_jump (pretty_printer
*buffer
, basic_block bb
)
2330 stmt
= first_stmt (bb
);
2332 pp_string (buffer
, "goto <bb ");
2333 pp_decimal_int (buffer
, bb
->index
);
2334 pp_greater (buffer
);
2335 if (stmt
&& gimple_code (stmt
) == GIMPLE_LABEL
)
2337 pp_string (buffer
, " (");
2338 dump_generic_node (buffer
, gimple_label_label (stmt
), 0, 0, false);
2339 pp_right_paren (buffer
);
2340 pp_semicolon (buffer
);
2343 pp_semicolon (buffer
);
2347 /* Dump edges represented implicitly in basic block BB to BUFFER, indented
2348 by INDENT spaces, with details given by FLAGS. */
2351 dump_implicit_edges (pretty_printer
*buffer
, basic_block bb
, int indent
,
2357 stmt
= last_stmt (bb
);
2359 if (stmt
&& gimple_code (stmt
) == GIMPLE_COND
)
2361 edge true_edge
, false_edge
;
2363 /* When we are emitting the code or changing CFG, it is possible that
2364 the edges are not yet created. When we are using debug_bb in such
2365 a situation, we do not want it to crash. */
2366 if (EDGE_COUNT (bb
->succs
) != 2)
2368 extract_true_false_edges_from_block (bb
, &true_edge
, &false_edge
);
2370 INDENT (indent
+ 2);
2371 pp_cfg_jump (buffer
, true_edge
->dest
);
2372 newline_and_indent (buffer
, indent
);
2373 pp_string (buffer
, "else");
2374 newline_and_indent (buffer
, indent
+ 2);
2375 pp_cfg_jump (buffer
, false_edge
->dest
);
2376 pp_newline (buffer
);
2380 /* If there is a fallthru edge, we may need to add an artificial
2381 goto to the dump. */
2382 e
= find_fallthru_edge (bb
->succs
);
2384 if (e
&& e
->dest
!= bb
->next_bb
)
2388 if ((flags
& TDF_LINENO
)
2389 && e
->goto_locus
!= UNKNOWN_LOCATION
2392 expanded_location goto_xloc
;
2393 goto_xloc
= expand_location (e
->goto_locus
);
2394 pp_left_bracket (buffer
);
2397 pp_string (buffer
, goto_xloc
.file
);
2398 pp_string (buffer
, " : ");
2400 pp_decimal_int (buffer
, goto_xloc
.line
);
2401 pp_string (buffer
, " : ");
2402 pp_decimal_int (buffer
, goto_xloc
.column
);
2403 pp_string (buffer
, "] ");
2406 pp_cfg_jump (buffer
, e
->dest
);
2407 pp_newline (buffer
);
2412 /* Dumps basic block BB to buffer BUFFER with details described by FLAGS and
2413 indented by INDENT spaces. */
2416 gimple_dump_bb_buff (pretty_printer
*buffer
, basic_block bb
, int indent
,
2419 gimple_stmt_iterator gsi
;
2421 int label_indent
= indent
- 2;
2423 if (label_indent
< 0)
2426 dump_phi_nodes (buffer
, bb
, indent
, flags
);
2428 for (gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
); gsi_next (&gsi
))
2432 stmt
= gsi_stmt (gsi
);
2434 curr_indent
= gimple_code (stmt
) == GIMPLE_LABEL
? label_indent
: indent
;
2436 INDENT (curr_indent
);
2437 pp_gimple_stmt_1 (buffer
, stmt
, curr_indent
, flags
);
2438 pp_newline_and_flush (buffer
);
2439 gcc_checking_assert (DECL_STRUCT_FUNCTION (current_function_decl
));
2440 dump_histograms_for_stmt (DECL_STRUCT_FUNCTION (current_function_decl
),
2441 pp_buffer (buffer
)->stream
, stmt
);
2444 dump_implicit_edges (buffer
, bb
, indent
, flags
);
2449 /* Dumps basic block BB to FILE with details described by FLAGS and
2450 indented by INDENT spaces. */
2453 gimple_dump_bb (FILE *file
, basic_block bb
, int indent
, int flags
)
2455 dump_gimple_bb_header (file
, bb
, indent
, flags
);
2456 if (bb
->index
>= NUM_FIXED_BLOCKS
)
2458 pretty_printer buffer
;
2459 pp_needs_newline (&buffer
) = true;
2460 buffer
.buffer
->stream
= file
;
2461 gimple_dump_bb_buff (&buffer
, bb
, indent
, flags
);
2463 dump_gimple_bb_footer (file
, bb
, indent
, flags
);
2466 /* Dumps basic block BB to pretty-printer PP with default dump flags and
2467 no indentation, for use as a label of a DOT graph record-node.
2468 ??? Should just use gimple_dump_bb_buff here, except that value profiling
2469 histogram dumping doesn't know about pretty-printers. */
2472 gimple_dump_bb_for_graph (pretty_printer
*pp
, basic_block bb
)
2474 gimple_stmt_iterator gsi
;
2476 pp_printf (pp
, "<bb %d>:\n", bb
->index
);
2477 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
2479 for (gsi
= gsi_start_phis (bb
); !gsi_end_p (gsi
); gsi_next (&gsi
))
2481 gimple phi
= gsi_stmt (gsi
);
2482 if (!virtual_operand_p (gimple_phi_result (phi
))
2483 || (dump_flags
& TDF_VOPS
))
2486 pp_write_text_to_stream (pp
);
2487 pp_string (pp
, "# ");
2488 pp_gimple_stmt_1 (pp
, phi
, 0, dump_flags
);
2490 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
2494 for (gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
); gsi_next (&gsi
))
2496 gimple stmt
= gsi_stmt (gsi
);
2498 pp_write_text_to_stream (pp
);
2499 pp_gimple_stmt_1 (pp
, stmt
, 0, dump_flags
);
2501 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
2503 dump_implicit_edges (pp
, bb
, 0, dump_flags
);
2504 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);