1 /* Pretty formatting of GIMPLE statements and expressions.
2 Copyright (C) 2001-2015 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"
29 #include "double-int.h"
36 #include "fold-const.h"
37 #include "stringpool.h"
38 #include "diagnostic.h"
39 #include "gimple-pretty-print.h"
42 #include "hard-reg-set.h"
45 #include "basic-block.h"
46 #include "tree-ssa-alias.h"
47 #include "internal-fn.h"
49 #include "gimple-expr.h"
52 #include "gimple-iterator.h"
53 #include "gimple-ssa.h"
55 #include "plugin-api.h"
59 #include "tree-ssanames.h"
60 #include "dumpfile.h" /* for dump_flags */
61 #include "value-prof.h"
62 #include "trans-mem.h"
64 #define INDENT(SPACE) \
65 do { int i; for (i = 0; i < SPACE; i++) pp_space (buffer); } while (0)
67 #define GIMPLE_NIY do_niy (buffer,gs)
69 /* Try to print on BUFFER a default message for the unrecognized
70 gimple statement GS. */
73 do_niy (pretty_printer
*buffer
, gimple gs
)
75 pp_printf (buffer
, "<<< Unknown GIMPLE statement: %s >>>\n",
76 gimple_code_name
[(int) gimple_code (gs
)]);
80 /* Emit a newline and SPC indentation spaces to BUFFER. */
83 newline_and_indent (pretty_printer
*buffer
, int spc
)
90 /* Print the GIMPLE statement GS on stderr. */
93 debug_gimple_stmt (gimple gs
)
95 print_gimple_stmt (stderr
, gs
, 0, TDF_VOPS
|TDF_MEMSYMS
);
99 /* Print GIMPLE statement G to FILE using SPC indentation spaces and
100 FLAGS as in pp_gimple_stmt_1. */
103 print_gimple_stmt (FILE *file
, gimple g
, int spc
, int flags
)
105 pretty_printer buffer
;
106 pp_needs_newline (&buffer
) = true;
107 buffer
.buffer
->stream
= file
;
108 pp_gimple_stmt_1 (&buffer
, g
, spc
, flags
);
109 pp_newline_and_flush (&buffer
);
113 debug (gimple_statement_base
&ref
)
115 print_gimple_stmt (stderr
, &ref
, 0, 0);
119 debug (gimple_statement_base
*ptr
)
124 fprintf (stderr
, "<nil>\n");
128 /* Print GIMPLE statement G to FILE using SPC indentation spaces and
129 FLAGS as in pp_gimple_stmt_1. Print only the right-hand side
133 print_gimple_expr (FILE *file
, gimple g
, int spc
, int flags
)
135 flags
|= TDF_RHS_ONLY
;
136 pretty_printer buffer
;
137 pp_needs_newline (&buffer
) = true;
138 buffer
.buffer
->stream
= file
;
139 pp_gimple_stmt_1 (&buffer
, g
, spc
, flags
);
144 /* Print the GIMPLE sequence SEQ on BUFFER using SPC indentation
145 spaces and FLAGS as in pp_gimple_stmt_1.
146 The caller is responsible for calling pp_flush on BUFFER to finalize
147 the pretty printer. */
150 dump_gimple_seq (pretty_printer
*buffer
, gimple_seq seq
, int spc
, int flags
)
152 gimple_stmt_iterator i
;
154 for (i
= gsi_start (seq
); !gsi_end_p (i
); gsi_next (&i
))
156 gimple gs
= gsi_stmt (i
);
158 pp_gimple_stmt_1 (buffer
, gs
, spc
, flags
);
159 if (!gsi_one_before_end_p (i
))
165 /* Print GIMPLE sequence SEQ to FILE using SPC indentation spaces and
166 FLAGS as in pp_gimple_stmt_1. */
169 print_gimple_seq (FILE *file
, gimple_seq seq
, int spc
, int flags
)
171 pretty_printer buffer
;
172 pp_needs_newline (&buffer
) = true;
173 buffer
.buffer
->stream
= file
;
174 dump_gimple_seq (&buffer
, seq
, spc
, flags
);
175 pp_newline_and_flush (&buffer
);
179 /* Print the GIMPLE sequence SEQ on stderr. */
182 debug_gimple_seq (gimple_seq seq
)
184 print_gimple_seq (stderr
, seq
, 0, TDF_VOPS
|TDF_MEMSYMS
);
188 /* A simple helper to pretty-print some of the gimple tuples in the printf
189 style. The format modifiers are preceded by '%' and are:
190 'G' - outputs a string corresponding to the code of the given gimple,
191 'S' - outputs a gimple_seq with indent of spc + 2,
192 'T' - outputs the tree t,
193 'd' - outputs an int as a decimal,
194 's' - outputs a string,
195 'n' - outputs a newline,
196 'x' - outputs an int as hexadecimal,
197 '+' - increases indent by 2 then outputs a newline,
198 '-' - decreases indent by 2 then outputs a newline. */
201 dump_gimple_fmt (pretty_printer
*buffer
, int spc
, int flags
,
202 const char *fmt
, ...)
208 va_start (args
, fmt
);
209 for (c
= fmt
; *c
; c
++)
219 g
= va_arg (args
, gimple
);
220 tmp
= gimple_code_name
[gimple_code (g
)];
221 pp_string (buffer
, tmp
);
225 seq
= va_arg (args
, gimple_seq
);
227 dump_gimple_seq (buffer
, seq
, spc
+ 2, flags
);
228 newline_and_indent (buffer
, spc
);
232 t
= va_arg (args
, tree
);
234 pp_string (buffer
, "NULL");
236 dump_generic_node (buffer
, t
, spc
, flags
, false);
240 pp_decimal_int (buffer
, va_arg (args
, int));
244 pp_string (buffer
, va_arg (args
, char *));
248 newline_and_indent (buffer
, spc
);
252 pp_scalar (buffer
, "%x", va_arg (args
, int));
257 newline_and_indent (buffer
, spc
);
262 newline_and_indent (buffer
, spc
);
270 pp_character (buffer
, *c
);
276 /* Helper for dump_gimple_assign. Print the unary RHS of the
277 assignment GS. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. */
280 dump_unary_rhs (pretty_printer
*buffer
, gassign
*gs
, int spc
, int flags
)
282 enum tree_code rhs_code
= gimple_assign_rhs_code (gs
);
283 tree lhs
= gimple_assign_lhs (gs
);
284 tree rhs
= gimple_assign_rhs1 (gs
);
288 case VIEW_CONVERT_EXPR
:
290 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
293 case FIXED_CONVERT_EXPR
:
294 case ADDR_SPACE_CONVERT_EXPR
:
298 pp_left_paren (buffer
);
299 dump_generic_node (buffer
, TREE_TYPE (lhs
), spc
, flags
, false);
300 pp_string (buffer
, ") ");
301 if (op_prio (rhs
) < op_code_prio (rhs_code
))
303 pp_left_paren (buffer
);
304 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
305 pp_right_paren (buffer
);
308 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
312 pp_string (buffer
, "((");
313 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
314 pp_string (buffer
, "))");
318 pp_string (buffer
, "ABS_EXPR <");
319 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
324 if (TREE_CODE_CLASS (rhs_code
) == tcc_declaration
325 || TREE_CODE_CLASS (rhs_code
) == tcc_constant
326 || TREE_CODE_CLASS (rhs_code
) == tcc_reference
327 || rhs_code
== SSA_NAME
328 || rhs_code
== ADDR_EXPR
329 || rhs_code
== CONSTRUCTOR
)
331 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
334 else if (rhs_code
== BIT_NOT_EXPR
)
335 pp_complement (buffer
);
336 else if (rhs_code
== TRUTH_NOT_EXPR
)
337 pp_exclamation (buffer
);
338 else if (rhs_code
== NEGATE_EXPR
)
342 pp_left_bracket (buffer
);
343 pp_string (buffer
, get_tree_code_name (rhs_code
));
344 pp_string (buffer
, "] ");
347 if (op_prio (rhs
) < op_code_prio (rhs_code
))
349 pp_left_paren (buffer
);
350 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
351 pp_right_paren (buffer
);
354 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
360 /* Helper for dump_gimple_assign. Print the binary RHS of the
361 assignment GS. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. */
364 dump_binary_rhs (pretty_printer
*buffer
, gassign
*gs
, int spc
, int flags
)
367 enum tree_code code
= gimple_assign_rhs_code (gs
);
373 case VEC_WIDEN_MULT_HI_EXPR
:
374 case VEC_WIDEN_MULT_LO_EXPR
:
375 case VEC_WIDEN_MULT_EVEN_EXPR
:
376 case VEC_WIDEN_MULT_ODD_EXPR
:
377 case VEC_PACK_TRUNC_EXPR
:
378 case VEC_PACK_SAT_EXPR
:
379 case VEC_PACK_FIX_TRUNC_EXPR
:
380 case VEC_WIDEN_LSHIFT_HI_EXPR
:
381 case VEC_WIDEN_LSHIFT_LO_EXPR
:
382 for (p
= get_tree_code_name (code
); *p
; p
++)
383 pp_character (buffer
, TOUPPER (*p
));
384 pp_string (buffer
, " <");
385 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
386 pp_string (buffer
, ", ");
387 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
392 if (op_prio (gimple_assign_rhs1 (gs
)) <= op_code_prio (code
))
394 pp_left_paren (buffer
);
395 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
,
397 pp_right_paren (buffer
);
400 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
402 pp_string (buffer
, op_symbol_code (gimple_assign_rhs_code (gs
)));
404 if (op_prio (gimple_assign_rhs2 (gs
)) <= op_code_prio (code
))
406 pp_left_paren (buffer
);
407 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
,
409 pp_right_paren (buffer
);
412 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
416 /* Helper for dump_gimple_assign. Print the ternary RHS of the
417 assignment GS. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. */
420 dump_ternary_rhs (pretty_printer
*buffer
, gassign
*gs
, int spc
, int flags
)
423 enum tree_code code
= gimple_assign_rhs_code (gs
);
426 case WIDEN_MULT_PLUS_EXPR
:
427 case WIDEN_MULT_MINUS_EXPR
:
428 for (p
= get_tree_code_name (code
); *p
; p
++)
429 pp_character (buffer
, TOUPPER (*p
));
430 pp_string (buffer
, " <");
431 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
432 pp_string (buffer
, ", ");
433 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
434 pp_string (buffer
, ", ");
435 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
440 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
441 pp_string (buffer
, " * ");
442 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
443 pp_string (buffer
, " + ");
444 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
448 pp_string (buffer
, "DOT_PROD_EXPR <");
449 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
450 pp_string (buffer
, ", ");
451 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
452 pp_string (buffer
, ", ");
453 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
458 pp_string (buffer
, "SAD_EXPR <");
459 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
460 pp_string (buffer
, ", ");
461 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
462 pp_string (buffer
, ", ");
463 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
468 pp_string (buffer
, "VEC_PERM_EXPR <");
469 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
470 pp_string (buffer
, ", ");
471 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
472 pp_string (buffer
, ", ");
473 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
477 case REALIGN_LOAD_EXPR
:
478 pp_string (buffer
, "REALIGN_LOAD <");
479 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
480 pp_string (buffer
, ", ");
481 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
482 pp_string (buffer
, ", ");
483 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
488 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
489 pp_string (buffer
, " ? ");
490 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
491 pp_string (buffer
, " : ");
492 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
496 pp_string (buffer
, "VEC_COND_EXPR <");
497 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
498 pp_string (buffer
, ", ");
499 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
500 pp_string (buffer
, ", ");
501 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
511 /* Dump the gimple assignment GS. BUFFER, SPC and FLAGS are as in
515 dump_gimple_assign (pretty_printer
*buffer
, gassign
*gs
, int spc
, int flags
)
522 switch (gimple_num_ops (gs
))
525 arg3
= gimple_assign_rhs3 (gs
);
527 arg2
= gimple_assign_rhs2 (gs
);
529 arg1
= gimple_assign_rhs1 (gs
);
535 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%s, %T, %T, %T, %T>", gs
,
536 get_tree_code_name (gimple_assign_rhs_code (gs
)),
537 gimple_assign_lhs (gs
), arg1
, arg2
, arg3
);
541 if (!(flags
& TDF_RHS_ONLY
))
543 dump_generic_node (buffer
, gimple_assign_lhs (gs
), spc
, flags
, false);
547 if (gimple_assign_nontemporal_move_p (gs
))
548 pp_string (buffer
, "{nt}");
550 if (gimple_has_volatile_ops (gs
))
551 pp_string (buffer
, "{v}");
556 if (gimple_num_ops (gs
) == 2)
557 dump_unary_rhs (buffer
, gs
, spc
, flags
);
558 else if (gimple_num_ops (gs
) == 3)
559 dump_binary_rhs (buffer
, gs
, spc
, flags
);
560 else if (gimple_num_ops (gs
) == 4)
561 dump_ternary_rhs (buffer
, gs
, spc
, flags
);
564 if (!(flags
& TDF_RHS_ONLY
))
565 pp_semicolon (buffer
);
570 /* Dump the return statement GS. BUFFER, SPC and FLAGS are as in
574 dump_gimple_return (pretty_printer
*buffer
, greturn
*gs
, int spc
, int flags
)
578 t
= gimple_return_retval (gs
);
579 t2
= gimple_return_retbnd (gs
);
581 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T %T>", gs
, t
, t2
);
584 pp_string (buffer
, "return");
588 dump_generic_node (buffer
, t
, spc
, flags
, false);
592 pp_string (buffer
, ", ");
593 dump_generic_node (buffer
, t2
, spc
, flags
, false);
595 pp_semicolon (buffer
);
600 /* Dump the call arguments for a gimple call. BUFFER, FLAGS are as in
604 dump_gimple_call_args (pretty_printer
*buffer
, gcall
*gs
, int flags
)
608 for (i
= 0; i
< gimple_call_num_args (gs
); i
++)
610 dump_generic_node (buffer
, gimple_call_arg (gs
, i
), 0, flags
, false);
611 if (i
< gimple_call_num_args (gs
) - 1)
612 pp_string (buffer
, ", ");
615 if (gimple_call_va_arg_pack_p (gs
))
617 if (gimple_call_num_args (gs
) > 0)
623 pp_string (buffer
, "__builtin_va_arg_pack ()");
627 /* Dump the points-to solution *PT to BUFFER. */
630 pp_points_to_solution (pretty_printer
*buffer
, struct pt_solution
*pt
)
634 pp_string (buffer
, "anything ");
638 pp_string (buffer
, "nonlocal ");
640 pp_string (buffer
, "escaped ");
642 pp_string (buffer
, "unit-escaped ");
644 pp_string (buffer
, "null ");
646 && !bitmap_empty_p (pt
->vars
))
650 pp_string (buffer
, "{ ");
651 EXECUTE_IF_SET_IN_BITMAP (pt
->vars
, 0, i
, bi
)
653 pp_string (buffer
, "D.");
654 pp_decimal_int (buffer
, i
);
657 pp_right_brace (buffer
);
658 if (pt
->vars_contains_nonlocal
659 && pt
->vars_contains_escaped_heap
)
660 pp_string (buffer
, " (nonlocal, escaped heap)");
661 else if (pt
->vars_contains_nonlocal
662 && pt
->vars_contains_escaped
)
663 pp_string (buffer
, " (nonlocal, escaped)");
664 else if (pt
->vars_contains_nonlocal
)
665 pp_string (buffer
, " (nonlocal)");
666 else if (pt
->vars_contains_escaped_heap
)
667 pp_string (buffer
, " (escaped heap)");
668 else if (pt
->vars_contains_escaped
)
669 pp_string (buffer
, " (escaped)");
673 /* Dump the call statement GS. BUFFER, SPC and FLAGS are as in
677 dump_gimple_call (pretty_printer
*buffer
, gcall
*gs
, int spc
, int flags
)
679 tree lhs
= gimple_call_lhs (gs
);
680 tree fn
= gimple_call_fn (gs
);
682 if (flags
& TDF_ALIAS
)
684 struct pt_solution
*pt
;
685 pt
= gimple_call_use_set (gs
);
686 if (!pt_solution_empty_p (pt
))
688 pp_string (buffer
, "# USE = ");
689 pp_points_to_solution (buffer
, pt
);
690 newline_and_indent (buffer
, spc
);
692 pt
= gimple_call_clobber_set (gs
);
693 if (!pt_solution_empty_p (pt
))
695 pp_string (buffer
, "# CLB = ");
696 pp_points_to_solution (buffer
, pt
);
697 newline_and_indent (buffer
, spc
);
703 if (gimple_call_internal_p (gs
))
704 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%s, %T", gs
,
705 internal_fn_name (gimple_call_internal_fn (gs
)), lhs
);
707 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T", gs
, fn
, lhs
);
708 if (gimple_call_num_args (gs
) > 0)
710 pp_string (buffer
, ", ");
711 dump_gimple_call_args (buffer
, gs
, flags
);
717 if (lhs
&& !(flags
& TDF_RHS_ONLY
))
719 dump_generic_node (buffer
, lhs
, spc
, flags
, false);
720 pp_string (buffer
, " =");
722 if (gimple_has_volatile_ops (gs
))
723 pp_string (buffer
, "{v}");
727 if (gimple_call_internal_p (gs
))
728 pp_string (buffer
, internal_fn_name (gimple_call_internal_fn (gs
)));
730 print_call_name (buffer
, fn
, flags
);
731 pp_string (buffer
, " (");
732 dump_gimple_call_args (buffer
, gs
, flags
);
733 pp_right_paren (buffer
);
734 if (!(flags
& TDF_RHS_ONLY
))
735 pp_semicolon (buffer
);
738 if (gimple_call_chain (gs
))
740 pp_string (buffer
, " [static-chain: ");
741 dump_generic_node (buffer
, gimple_call_chain (gs
), spc
, flags
, false);
742 pp_right_bracket (buffer
);
745 if (gimple_call_return_slot_opt_p (gs
))
746 pp_string (buffer
, " [return slot optimization]");
747 if (gimple_call_tail_p (gs
))
748 pp_string (buffer
, " [tail call]");
753 /* Dump the arguments of _ITM_beginTransaction sanely. */
754 if (TREE_CODE (fn
) == ADDR_EXPR
)
755 fn
= TREE_OPERAND (fn
, 0);
756 if (TREE_CODE (fn
) == FUNCTION_DECL
&& decl_is_tm_clone (fn
))
757 pp_string (buffer
, " [tm-clone]");
758 if (TREE_CODE (fn
) == FUNCTION_DECL
759 && DECL_BUILT_IN_CLASS (fn
) == BUILT_IN_NORMAL
760 && DECL_FUNCTION_CODE (fn
) == BUILT_IN_TM_START
761 && gimple_call_num_args (gs
) > 0)
763 tree t
= gimple_call_arg (gs
, 0);
764 unsigned HOST_WIDE_INT props
;
765 gcc_assert (TREE_CODE (t
) == INTEGER_CST
);
767 pp_string (buffer
, " [ ");
769 /* Get the transaction code properties. */
770 props
= TREE_INT_CST_LOW (t
);
772 if (props
& PR_INSTRUMENTEDCODE
)
773 pp_string (buffer
, "instrumentedCode ");
774 if (props
& PR_UNINSTRUMENTEDCODE
)
775 pp_string (buffer
, "uninstrumentedCode ");
776 if (props
& PR_HASNOXMMUPDATE
)
777 pp_string (buffer
, "hasNoXMMUpdate ");
778 if (props
& PR_HASNOABORT
)
779 pp_string (buffer
, "hasNoAbort ");
780 if (props
& PR_HASNOIRREVOCABLE
)
781 pp_string (buffer
, "hasNoIrrevocable ");
782 if (props
& PR_DOESGOIRREVOCABLE
)
783 pp_string (buffer
, "doesGoIrrevocable ");
784 if (props
& PR_HASNOSIMPLEREADS
)
785 pp_string (buffer
, "hasNoSimpleReads ");
786 if (props
& PR_AWBARRIERSOMITTED
)
787 pp_string (buffer
, "awBarriersOmitted ");
788 if (props
& PR_RARBARRIERSOMITTED
)
789 pp_string (buffer
, "RaRBarriersOmitted ");
790 if (props
& PR_UNDOLOGCODE
)
791 pp_string (buffer
, "undoLogCode ");
792 if (props
& PR_PREFERUNINSTRUMENTED
)
793 pp_string (buffer
, "preferUninstrumented ");
794 if (props
& PR_EXCEPTIONBLOCK
)
795 pp_string (buffer
, "exceptionBlock ");
796 if (props
& PR_HASELSE
)
797 pp_string (buffer
, "hasElse ");
798 if (props
& PR_READONLY
)
799 pp_string (buffer
, "readOnly ");
801 pp_right_bracket (buffer
);
806 /* Dump the switch statement GS. BUFFER, SPC and FLAGS are as in
810 dump_gimple_switch (pretty_printer
*buffer
, gswitch
*gs
, int spc
,
815 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
817 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, ", gs
,
818 gimple_switch_index (gs
));
821 pp_string (buffer
, "switch (");
822 dump_generic_node (buffer
, gimple_switch_index (gs
), spc
, flags
, true);
823 pp_string (buffer
, ") <");
826 for (i
= 0; i
< gimple_switch_num_labels (gs
); i
++)
828 tree case_label
= gimple_switch_label (gs
, i
);
829 gcc_checking_assert (case_label
!= NULL_TREE
);
830 dump_generic_node (buffer
, case_label
, spc
, flags
, false);
832 dump_generic_node (buffer
, CASE_LABEL (case_label
), spc
, flags
, false);
833 if (i
< gimple_switch_num_labels (gs
) - 1)
834 pp_string (buffer
, ", ");
840 /* Dump the gimple conditional GS. BUFFER, SPC and FLAGS are as in
844 dump_gimple_cond (pretty_printer
*buffer
, gcond
*gs
, int spc
, int flags
)
847 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%s, %T, %T, %T, %T>", gs
,
848 get_tree_code_name (gimple_cond_code (gs
)),
849 gimple_cond_lhs (gs
), gimple_cond_rhs (gs
),
850 gimple_cond_true_label (gs
), gimple_cond_false_label (gs
));
853 if (!(flags
& TDF_RHS_ONLY
))
854 pp_string (buffer
, "if (");
855 dump_generic_node (buffer
, gimple_cond_lhs (gs
), spc
, flags
, false);
857 pp_string (buffer
, op_symbol_code (gimple_cond_code (gs
)));
859 dump_generic_node (buffer
, gimple_cond_rhs (gs
), spc
, flags
, false);
860 if (!(flags
& TDF_RHS_ONLY
))
862 pp_right_paren (buffer
);
864 if (gimple_cond_true_label (gs
))
866 pp_string (buffer
, " goto ");
867 dump_generic_node (buffer
, gimple_cond_true_label (gs
),
869 pp_semicolon (buffer
);
871 if (gimple_cond_false_label (gs
))
873 pp_string (buffer
, " else goto ");
874 dump_generic_node (buffer
, gimple_cond_false_label (gs
),
876 pp_semicolon (buffer
);
883 /* Dump a GIMPLE_LABEL tuple on the pretty_printer BUFFER, SPC
884 spaces of indent. FLAGS specifies details to show in the dump (see
885 TDF_* in dumpfils.h). */
888 dump_gimple_label (pretty_printer
*buffer
, glabel
*gs
, int spc
, int flags
)
890 tree label
= gimple_label_label (gs
);
892 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
, label
);
895 dump_generic_node (buffer
, label
, spc
, flags
, false);
898 if (DECL_NONLOCAL (label
))
899 pp_string (buffer
, " [non-local]");
900 if ((flags
& TDF_EH
) && EH_LANDING_PAD_NR (label
))
901 pp_printf (buffer
, " [LP %d]", EH_LANDING_PAD_NR (label
));
904 /* Dump a GIMPLE_GOTO tuple on the pretty_printer BUFFER, SPC
905 spaces of indent. FLAGS specifies details to show in the dump (see
906 TDF_* in dumpfile.h). */
909 dump_gimple_goto (pretty_printer
*buffer
, ggoto
*gs
, int spc
, int flags
)
911 tree label
= gimple_goto_dest (gs
);
913 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
, label
);
915 dump_gimple_fmt (buffer
, spc
, flags
, "goto %T;", label
);
919 /* Dump a GIMPLE_BIND tuple on the pretty_printer BUFFER, SPC
920 spaces of indent. FLAGS specifies details to show in the dump (see
921 TDF_* in dumpfile.h). */
924 dump_gimple_bind (pretty_printer
*buffer
, gbind
*gs
, int spc
, int flags
)
927 dump_gimple_fmt (buffer
, spc
, flags
, "%G <", gs
);
929 pp_left_brace (buffer
);
930 if (!(flags
& TDF_SLIM
))
934 for (var
= gimple_bind_vars (gs
); var
; var
= DECL_CHAIN (var
))
936 newline_and_indent (buffer
, 2);
937 print_declaration (buffer
, var
, spc
, flags
);
939 if (gimple_bind_vars (gs
))
943 dump_gimple_seq (buffer
, gimple_bind_body (gs
), spc
+ 2, flags
);
944 newline_and_indent (buffer
, spc
);
948 pp_right_brace (buffer
);
952 /* Dump a GIMPLE_TRY tuple on the pretty_printer BUFFER, SPC spaces of
953 indent. FLAGS specifies details to show in the dump (see TDF_* in
957 dump_gimple_try (pretty_printer
*buffer
, gtry
*gs
, int spc
, int flags
)
962 if (gimple_try_kind (gs
) == GIMPLE_TRY_CATCH
)
963 type
= "GIMPLE_TRY_CATCH";
964 else if (gimple_try_kind (gs
) == GIMPLE_TRY_FINALLY
)
965 type
= "GIMPLE_TRY_FINALLY";
967 type
= "UNKNOWN GIMPLE_TRY";
968 dump_gimple_fmt (buffer
, spc
, flags
,
969 "%G <%s,%+EVAL <%S>%nCLEANUP <%S>%->", gs
, type
,
970 gimple_try_eval (gs
), gimple_try_cleanup (gs
));
974 pp_string (buffer
, "try");
975 newline_and_indent (buffer
, spc
+ 2);
976 pp_left_brace (buffer
);
979 dump_gimple_seq (buffer
, gimple_try_eval (gs
), spc
+ 4, flags
);
980 newline_and_indent (buffer
, spc
+ 2);
981 pp_right_brace (buffer
);
983 if (gimple_try_kind (gs
) == GIMPLE_TRY_CATCH
)
985 newline_and_indent (buffer
, spc
);
986 pp_string (buffer
, "catch");
987 newline_and_indent (buffer
, spc
+ 2);
988 pp_left_brace (buffer
);
990 else if (gimple_try_kind (gs
) == GIMPLE_TRY_FINALLY
)
992 newline_and_indent (buffer
, spc
);
993 pp_string (buffer
, "finally");
994 newline_and_indent (buffer
, spc
+ 2);
995 pp_left_brace (buffer
);
998 pp_string (buffer
, " <UNKNOWN GIMPLE_TRY> {");
1000 pp_newline (buffer
);
1001 dump_gimple_seq (buffer
, gimple_try_cleanup (gs
), spc
+ 4, flags
);
1002 newline_and_indent (buffer
, spc
+ 2);
1003 pp_right_brace (buffer
);
1008 /* Dump a GIMPLE_CATCH tuple on the pretty_printer BUFFER, SPC spaces of
1009 indent. FLAGS specifies details to show in the dump (see TDF_* in
1013 dump_gimple_catch (pretty_printer
*buffer
, gcatch
*gs
, int spc
, int flags
)
1015 if (flags
& TDF_RAW
)
1016 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %+CATCH <%S>%->", gs
,
1017 gimple_catch_types (gs
), gimple_catch_handler (gs
));
1019 dump_gimple_fmt (buffer
, spc
, flags
, "catch (%T)%+{%S}",
1020 gimple_catch_types (gs
), gimple_catch_handler (gs
));
1024 /* Dump a GIMPLE_EH_FILTER tuple on the pretty_printer BUFFER, SPC spaces of
1025 indent. FLAGS specifies details to show in the dump (see TDF_* in
1029 dump_gimple_eh_filter (pretty_printer
*buffer
, geh_filter
*gs
, int spc
,
1032 if (flags
& TDF_RAW
)
1033 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %+FAILURE <%S>%->", gs
,
1034 gimple_eh_filter_types (gs
),
1035 gimple_eh_filter_failure (gs
));
1037 dump_gimple_fmt (buffer
, spc
, flags
, "<<<eh_filter (%T)>>>%+{%+%S%-}",
1038 gimple_eh_filter_types (gs
),
1039 gimple_eh_filter_failure (gs
));
1043 /* Dump a GIMPLE_EH_MUST_NOT_THROW tuple. */
1046 dump_gimple_eh_must_not_throw (pretty_printer
*buffer
,
1047 geh_mnt
*gs
, int spc
, int flags
)
1049 if (flags
& TDF_RAW
)
1050 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
,
1051 gimple_eh_must_not_throw_fndecl (gs
));
1053 dump_gimple_fmt (buffer
, spc
, flags
, "<<<eh_must_not_throw (%T)>>>",
1054 gimple_eh_must_not_throw_fndecl (gs
));
1058 /* Dump a GIMPLE_EH_ELSE tuple on the pretty_printer BUFFER, SPC spaces of
1059 indent. FLAGS specifies details to show in the dump (see TDF_* in
1063 dump_gimple_eh_else (pretty_printer
*buffer
, geh_else
*gs
, int spc
,
1066 if (flags
& TDF_RAW
)
1067 dump_gimple_fmt (buffer
, spc
, flags
,
1068 "%G <%+N_BODY <%S>%nE_BODY <%S>%->", gs
,
1069 gimple_eh_else_n_body (gs
), gimple_eh_else_e_body (gs
));
1071 dump_gimple_fmt (buffer
, spc
, flags
,
1072 "<<<if_normal_exit>>>%+{%S}%-<<<else_eh_exit>>>%+{%S}",
1073 gimple_eh_else_n_body (gs
), gimple_eh_else_e_body (gs
));
1077 /* Dump a GIMPLE_RESX tuple on the pretty_printer BUFFER, SPC spaces of
1078 indent. FLAGS specifies details to show in the dump (see TDF_* in
1082 dump_gimple_resx (pretty_printer
*buffer
, gresx
*gs
, int spc
, int flags
)
1084 if (flags
& TDF_RAW
)
1085 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%d>", gs
,
1086 gimple_resx_region (gs
));
1088 dump_gimple_fmt (buffer
, spc
, flags
, "resx %d", gimple_resx_region (gs
));
1091 /* Dump a GIMPLE_EH_DISPATCH tuple on the pretty_printer BUFFER. */
1094 dump_gimple_eh_dispatch (pretty_printer
*buffer
, geh_dispatch
*gs
, int spc
, int flags
)
1096 if (flags
& TDF_RAW
)
1097 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%d>", gs
,
1098 gimple_eh_dispatch_region (gs
));
1100 dump_gimple_fmt (buffer
, spc
, flags
, "eh_dispatch %d",
1101 gimple_eh_dispatch_region (gs
));
1104 /* Dump a GIMPLE_DEBUG tuple on the pretty_printer BUFFER, SPC spaces
1105 of indent. FLAGS specifies details to show in the dump (see TDF_*
1109 dump_gimple_debug (pretty_printer
*buffer
, gdebug
*gs
, int spc
, int flags
)
1111 switch (gs
->subcode
)
1113 case GIMPLE_DEBUG_BIND
:
1114 if (flags
& TDF_RAW
)
1115 dump_gimple_fmt (buffer
, spc
, flags
, "%G BIND <%T, %T>", gs
,
1116 gimple_debug_bind_get_var (gs
),
1117 gimple_debug_bind_get_value (gs
));
1119 dump_gimple_fmt (buffer
, spc
, flags
, "# DEBUG %T => %T",
1120 gimple_debug_bind_get_var (gs
),
1121 gimple_debug_bind_get_value (gs
));
1124 case GIMPLE_DEBUG_SOURCE_BIND
:
1125 if (flags
& TDF_RAW
)
1126 dump_gimple_fmt (buffer
, spc
, flags
, "%G SRCBIND <%T, %T>", gs
,
1127 gimple_debug_source_bind_get_var (gs
),
1128 gimple_debug_source_bind_get_value (gs
));
1130 dump_gimple_fmt (buffer
, spc
, flags
, "# DEBUG %T s=> %T",
1131 gimple_debug_source_bind_get_var (gs
),
1132 gimple_debug_source_bind_get_value (gs
));
1140 /* Dump a GIMPLE_OMP_FOR tuple on the pretty_printer BUFFER. */
1142 dump_gimple_omp_for (pretty_printer
*buffer
, gomp_for
*gs
, int spc
, int flags
)
1146 if (flags
& TDF_RAW
)
1149 switch (gimple_omp_for_kind (gs
))
1151 case GF_OMP_FOR_KIND_FOR
:
1154 case GF_OMP_FOR_KIND_DISTRIBUTE
:
1155 kind
= " distribute";
1157 case GF_OMP_FOR_KIND_CILKFOR
:
1158 kind
= " _Cilk_for";
1160 case GF_OMP_FOR_KIND_OACC_LOOP
:
1161 kind
= " oacc_loop";
1163 case GF_OMP_FOR_KIND_SIMD
:
1166 case GF_OMP_FOR_KIND_CILKSIMD
:
1172 dump_gimple_fmt (buffer
, spc
, flags
, "%G%s <%+BODY <%S>%nCLAUSES <", gs
,
1173 kind
, gimple_omp_body (gs
));
1174 dump_omp_clauses (buffer
, gimple_omp_for_clauses (gs
), spc
, flags
);
1175 dump_gimple_fmt (buffer
, spc
, flags
, " >,");
1176 for (i
= 0; i
< gimple_omp_for_collapse (gs
); i
++)
1177 dump_gimple_fmt (buffer
, spc
, flags
,
1178 "%+%T, %T, %T, %s, %T,%n",
1179 gimple_omp_for_index (gs
, i
),
1180 gimple_omp_for_initial (gs
, i
),
1181 gimple_omp_for_final (gs
, i
),
1182 get_tree_code_name (gimple_omp_for_cond (gs
, i
)),
1183 gimple_omp_for_incr (gs
, i
));
1184 dump_gimple_fmt (buffer
, spc
, flags
, "PRE_BODY <%S>%->",
1185 gimple_omp_for_pre_body (gs
));
1189 switch (gimple_omp_for_kind (gs
))
1191 case GF_OMP_FOR_KIND_FOR
:
1192 pp_string (buffer
, "#pragma omp for");
1194 case GF_OMP_FOR_KIND_DISTRIBUTE
:
1195 pp_string (buffer
, "#pragma omp distribute");
1197 case GF_OMP_FOR_KIND_CILKFOR
:
1199 case GF_OMP_FOR_KIND_OACC_LOOP
:
1200 pp_string (buffer
, "#pragma acc loop");
1202 case GF_OMP_FOR_KIND_SIMD
:
1203 pp_string (buffer
, "#pragma omp simd");
1205 case GF_OMP_FOR_KIND_CILKSIMD
:
1206 pp_string (buffer
, "#pragma simd");
1211 if (gimple_omp_for_kind (gs
) != GF_OMP_FOR_KIND_CILKFOR
)
1212 dump_omp_clauses (buffer
, gimple_omp_for_clauses (gs
), spc
, flags
);
1213 for (i
= 0; i
< gimple_omp_for_collapse (gs
); i
++)
1217 if (gimple_omp_for_kind (gs
) == GF_OMP_FOR_KIND_CILKFOR
)
1218 pp_string (buffer
, "_Cilk_for (");
1221 newline_and_indent (buffer
, spc
);
1222 pp_string (buffer
, "for (");
1224 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
1226 pp_string (buffer
, " = ");
1227 dump_generic_node (buffer
, gimple_omp_for_initial (gs
, i
), spc
,
1229 pp_string (buffer
, "; ");
1231 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
1234 switch (gimple_omp_for_cond (gs
, i
))
1240 pp_greater (buffer
);
1243 pp_less_equal (buffer
);
1246 pp_greater_equal (buffer
);
1249 pp_string (buffer
, "!=");
1255 dump_generic_node (buffer
, gimple_omp_for_final (gs
, i
), spc
,
1257 pp_string (buffer
, "; ");
1259 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
1261 pp_string (buffer
, " = ");
1262 dump_generic_node (buffer
, gimple_omp_for_incr (gs
, i
), spc
,
1264 pp_right_paren (buffer
);
1267 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1269 if (gimple_omp_for_kind (gs
) == GF_OMP_FOR_KIND_CILKFOR
)
1270 dump_omp_clauses (buffer
, gimple_omp_for_clauses (gs
), spc
, flags
);
1271 newline_and_indent (buffer
, spc
+ 2);
1272 pp_left_brace (buffer
);
1273 pp_newline (buffer
);
1274 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1275 newline_and_indent (buffer
, spc
+ 2);
1276 pp_right_brace (buffer
);
1281 /* Dump a GIMPLE_OMP_CONTINUE tuple on the pretty_printer BUFFER. */
1284 dump_gimple_omp_continue (pretty_printer
*buffer
, gomp_continue
*gs
,
1287 if (flags
& TDF_RAW
)
1289 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T>", gs
,
1290 gimple_omp_continue_control_def (gs
),
1291 gimple_omp_continue_control_use (gs
));
1295 pp_string (buffer
, "#pragma omp continue (");
1296 dump_generic_node (buffer
, gimple_omp_continue_control_def (gs
),
1300 dump_generic_node (buffer
, gimple_omp_continue_control_use (gs
),
1302 pp_right_paren (buffer
);
1306 /* Dump a GIMPLE_OMP_SINGLE tuple on the pretty_printer BUFFER. */
1309 dump_gimple_omp_single (pretty_printer
*buffer
, gomp_single
*gs
,
1312 if (flags
& TDF_RAW
)
1314 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1315 gimple_omp_body (gs
));
1316 dump_omp_clauses (buffer
, gimple_omp_single_clauses (gs
), spc
, flags
);
1317 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1321 pp_string (buffer
, "#pragma omp single");
1322 dump_omp_clauses (buffer
, gimple_omp_single_clauses (gs
), spc
, flags
);
1323 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1325 newline_and_indent (buffer
, spc
+ 2);
1326 pp_left_brace (buffer
);
1327 pp_newline (buffer
);
1328 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1329 newline_and_indent (buffer
, spc
+ 2);
1330 pp_right_brace (buffer
);
1335 /* Dump a GIMPLE_OMP_TARGET tuple on the pretty_printer BUFFER. */
1338 dump_gimple_omp_target (pretty_printer
*buffer
, gomp_target
*gs
,
1342 switch (gimple_omp_target_kind (gs
))
1344 case GF_OMP_TARGET_KIND_REGION
:
1347 case GF_OMP_TARGET_KIND_DATA
:
1350 case GF_OMP_TARGET_KIND_UPDATE
:
1353 case GF_OMP_TARGET_KIND_OACC_KERNELS
:
1354 kind
= " oacc_kernels";
1356 case GF_OMP_TARGET_KIND_OACC_PARALLEL
:
1357 kind
= " oacc_parallel";
1359 case GF_OMP_TARGET_KIND_OACC_DATA
:
1360 kind
= " oacc_data";
1362 case GF_OMP_TARGET_KIND_OACC_UPDATE
:
1363 kind
= " oacc_update";
1365 case GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA
:
1366 kind
= " oacc_enter_exit_data";
1371 if (flags
& TDF_RAW
)
1373 dump_gimple_fmt (buffer
, spc
, flags
, "%G%s <%+BODY <%S>%nCLAUSES <", gs
,
1374 kind
, gimple_omp_body (gs
));
1375 dump_omp_clauses (buffer
, gimple_omp_target_clauses (gs
), spc
, flags
);
1376 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T%n>",
1377 gimple_omp_target_child_fn (gs
),
1378 gimple_omp_target_data_arg (gs
));
1382 pp_string (buffer
, "#pragma omp target");
1383 pp_string (buffer
, kind
);
1384 dump_omp_clauses (buffer
, gimple_omp_target_clauses (gs
), spc
, flags
);
1385 if (gimple_omp_target_child_fn (gs
))
1387 pp_string (buffer
, " [child fn: ");
1388 dump_generic_node (buffer
, gimple_omp_target_child_fn (gs
),
1390 pp_string (buffer
, " (");
1391 if (gimple_omp_target_data_arg (gs
))
1392 dump_generic_node (buffer
, gimple_omp_target_data_arg (gs
),
1395 pp_string (buffer
, "???");
1396 pp_string (buffer
, ")]");
1398 gimple_seq body
= gimple_omp_body (gs
);
1399 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
1401 newline_and_indent (buffer
, spc
+ 2);
1402 pp_left_brace (buffer
);
1403 pp_newline (buffer
);
1404 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
1405 newline_and_indent (buffer
, spc
+ 2);
1406 pp_right_brace (buffer
);
1410 pp_newline (buffer
);
1411 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
1416 /* Dump a GIMPLE_OMP_TEAMS tuple on the pretty_printer BUFFER. */
1419 dump_gimple_omp_teams (pretty_printer
*buffer
, gomp_teams
*gs
, int spc
,
1422 if (flags
& TDF_RAW
)
1424 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1425 gimple_omp_body (gs
));
1426 dump_omp_clauses (buffer
, gimple_omp_teams_clauses (gs
), spc
, flags
);
1427 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1431 pp_string (buffer
, "#pragma omp teams");
1432 dump_omp_clauses (buffer
, gimple_omp_teams_clauses (gs
), spc
, flags
);
1433 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1435 newline_and_indent (buffer
, spc
+ 2);
1436 pp_character (buffer
, '{');
1437 pp_newline (buffer
);
1438 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1439 newline_and_indent (buffer
, spc
+ 2);
1440 pp_character (buffer
, '}');
1445 /* Dump a GIMPLE_OMP_SECTIONS tuple on the pretty_printer BUFFER. */
1448 dump_gimple_omp_sections (pretty_printer
*buffer
, gomp_sections
*gs
,
1451 if (flags
& TDF_RAW
)
1453 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1454 gimple_omp_body (gs
));
1455 dump_omp_clauses (buffer
, gimple_omp_sections_clauses (gs
), spc
, flags
);
1456 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1460 pp_string (buffer
, "#pragma omp sections");
1461 if (gimple_omp_sections_control (gs
))
1463 pp_string (buffer
, " <");
1464 dump_generic_node (buffer
, gimple_omp_sections_control (gs
), spc
,
1466 pp_greater (buffer
);
1468 dump_omp_clauses (buffer
, gimple_omp_sections_clauses (gs
), spc
, flags
);
1469 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1471 newline_and_indent (buffer
, spc
+ 2);
1472 pp_left_brace (buffer
);
1473 pp_newline (buffer
);
1474 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1475 newline_and_indent (buffer
, spc
+ 2);
1476 pp_right_brace (buffer
);
1481 /* Dump a GIMPLE_OMP_{MASTER,TASKGROUP,ORDERED,SECTION} tuple on the
1482 pretty_printer BUFFER. */
1485 dump_gimple_omp_block (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1487 if (flags
& TDF_RAW
)
1488 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1489 gimple_omp_body (gs
));
1492 switch (gimple_code (gs
))
1494 case GIMPLE_OMP_MASTER
:
1495 pp_string (buffer
, "#pragma omp master");
1497 case GIMPLE_OMP_TASKGROUP
:
1498 pp_string (buffer
, "#pragma omp taskgroup");
1500 case GIMPLE_OMP_ORDERED
:
1501 pp_string (buffer
, "#pragma omp ordered");
1503 case GIMPLE_OMP_SECTION
:
1504 pp_string (buffer
, "#pragma omp section");
1509 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1511 newline_and_indent (buffer
, spc
+ 2);
1512 pp_left_brace (buffer
);
1513 pp_newline (buffer
);
1514 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1515 newline_and_indent (buffer
, spc
+ 2);
1516 pp_right_brace (buffer
);
1521 /* Dump a GIMPLE_OMP_CRITICAL tuple on the pretty_printer BUFFER. */
1524 dump_gimple_omp_critical (pretty_printer
*buffer
, gomp_critical
*gs
,
1527 if (flags
& TDF_RAW
)
1528 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1529 gimple_omp_body (gs
));
1532 pp_string (buffer
, "#pragma omp critical");
1533 if (gimple_omp_critical_name (gs
))
1535 pp_string (buffer
, " (");
1536 dump_generic_node (buffer
, gimple_omp_critical_name (gs
), spc
,
1538 pp_right_paren (buffer
);
1540 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1542 newline_and_indent (buffer
, spc
+ 2);
1543 pp_left_brace (buffer
);
1544 pp_newline (buffer
);
1545 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1546 newline_and_indent (buffer
, spc
+ 2);
1547 pp_right_brace (buffer
);
1552 /* Dump a GIMPLE_OMP_RETURN tuple on the pretty_printer BUFFER. */
1555 dump_gimple_omp_return (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1557 if (flags
& TDF_RAW
)
1559 dump_gimple_fmt (buffer
, spc
, flags
, "%G <nowait=%d", gs
,
1560 (int) gimple_omp_return_nowait_p (gs
));
1561 if (gimple_omp_return_lhs (gs
))
1562 dump_gimple_fmt (buffer
, spc
, flags
, ", lhs=%T>",
1563 gimple_omp_return_lhs (gs
));
1565 dump_gimple_fmt (buffer
, spc
, flags
, ">");
1569 pp_string (buffer
, "#pragma omp return");
1570 if (gimple_omp_return_nowait_p (gs
))
1571 pp_string (buffer
, "(nowait)");
1572 if (gimple_omp_return_lhs (gs
))
1574 pp_string (buffer
, " (set ");
1575 dump_generic_node (buffer
, gimple_omp_return_lhs (gs
),
1577 pp_character (buffer
, ')');
1582 /* Dump a GIMPLE_TRANSACTION tuple on the pretty_printer BUFFER. */
1585 dump_gimple_transaction (pretty_printer
*buffer
, gtransaction
*gs
,
1588 unsigned subcode
= gimple_transaction_subcode (gs
);
1590 if (flags
& TDF_RAW
)
1592 dump_gimple_fmt (buffer
, spc
, flags
,
1593 "%G [SUBCODE=%x,LABEL=%T] <%+BODY <%S> >",
1594 gs
, subcode
, gimple_transaction_label (gs
),
1595 gimple_transaction_body (gs
));
1599 if (subcode
& GTMA_IS_OUTER
)
1600 pp_string (buffer
, "__transaction_atomic [[outer]]");
1601 else if (subcode
& GTMA_IS_RELAXED
)
1602 pp_string (buffer
, "__transaction_relaxed");
1604 pp_string (buffer
, "__transaction_atomic");
1605 subcode
&= ~GTMA_DECLARATION_MASK
;
1607 if (subcode
|| gimple_transaction_label (gs
))
1609 pp_string (buffer
, " //");
1610 if (gimple_transaction_label (gs
))
1612 pp_string (buffer
, " LABEL=");
1613 dump_generic_node (buffer
, gimple_transaction_label (gs
),
1618 pp_string (buffer
, " SUBCODE=[ ");
1619 if (subcode
& GTMA_HAVE_ABORT
)
1621 pp_string (buffer
, "GTMA_HAVE_ABORT ");
1622 subcode
&= ~GTMA_HAVE_ABORT
;
1624 if (subcode
& GTMA_HAVE_LOAD
)
1626 pp_string (buffer
, "GTMA_HAVE_LOAD ");
1627 subcode
&= ~GTMA_HAVE_LOAD
;
1629 if (subcode
& GTMA_HAVE_STORE
)
1631 pp_string (buffer
, "GTMA_HAVE_STORE ");
1632 subcode
&= ~GTMA_HAVE_STORE
;
1634 if (subcode
& GTMA_MAY_ENTER_IRREVOCABLE
)
1636 pp_string (buffer
, "GTMA_MAY_ENTER_IRREVOCABLE ");
1637 subcode
&= ~GTMA_MAY_ENTER_IRREVOCABLE
;
1639 if (subcode
& GTMA_DOES_GO_IRREVOCABLE
)
1641 pp_string (buffer
, "GTMA_DOES_GO_IRREVOCABLE ");
1642 subcode
&= ~GTMA_DOES_GO_IRREVOCABLE
;
1644 if (subcode
& GTMA_HAS_NO_INSTRUMENTATION
)
1646 pp_string (buffer
, "GTMA_HAS_NO_INSTRUMENTATION ");
1647 subcode
&= ~GTMA_HAS_NO_INSTRUMENTATION
;
1650 pp_printf (buffer
, "0x%x ", subcode
);
1651 pp_right_bracket (buffer
);
1655 if (!gimple_seq_empty_p (gimple_transaction_body (gs
)))
1657 newline_and_indent (buffer
, spc
+ 2);
1658 pp_left_brace (buffer
);
1659 pp_newline (buffer
);
1660 dump_gimple_seq (buffer
, gimple_transaction_body (gs
),
1662 newline_and_indent (buffer
, spc
+ 2);
1663 pp_right_brace (buffer
);
1668 /* Dump a GIMPLE_ASM tuple on the pretty_printer BUFFER, SPC spaces of
1669 indent. FLAGS specifies details to show in the dump (see TDF_* in
1673 dump_gimple_asm (pretty_printer
*buffer
, gasm
*gs
, int spc
, int flags
)
1675 unsigned int i
, n
, f
, fields
;
1677 if (flags
& TDF_RAW
)
1679 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+STRING <%n%s%n>", gs
,
1680 gimple_asm_string (gs
));
1682 n
= gimple_asm_noutputs (gs
);
1685 newline_and_indent (buffer
, spc
+ 2);
1686 pp_string (buffer
, "OUTPUT: ");
1687 for (i
= 0; i
< n
; i
++)
1689 dump_generic_node (buffer
, gimple_asm_output_op (gs
, i
),
1692 pp_string (buffer
, ", ");
1696 n
= gimple_asm_ninputs (gs
);
1699 newline_and_indent (buffer
, spc
+ 2);
1700 pp_string (buffer
, "INPUT: ");
1701 for (i
= 0; i
< n
; i
++)
1703 dump_generic_node (buffer
, gimple_asm_input_op (gs
, i
),
1706 pp_string (buffer
, ", ");
1710 n
= gimple_asm_nclobbers (gs
);
1713 newline_and_indent (buffer
, spc
+ 2);
1714 pp_string (buffer
, "CLOBBER: ");
1715 for (i
= 0; i
< n
; i
++)
1717 dump_generic_node (buffer
, gimple_asm_clobber_op (gs
, i
),
1720 pp_string (buffer
, ", ");
1724 n
= gimple_asm_nlabels (gs
);
1727 newline_and_indent (buffer
, spc
+ 2);
1728 pp_string (buffer
, "LABEL: ");
1729 for (i
= 0; i
< n
; i
++)
1731 dump_generic_node (buffer
, gimple_asm_label_op (gs
, i
),
1734 pp_string (buffer
, ", ");
1738 newline_and_indent (buffer
, spc
);
1739 pp_greater (buffer
);
1743 pp_string (buffer
, "__asm__");
1744 if (gimple_asm_volatile_p (gs
))
1745 pp_string (buffer
, " __volatile__");
1746 if (gimple_asm_nlabels (gs
))
1747 pp_string (buffer
, " goto");
1748 pp_string (buffer
, "(\"");
1749 pp_string (buffer
, gimple_asm_string (gs
));
1750 pp_string (buffer
, "\"");
1752 if (gimple_asm_nlabels (gs
))
1754 else if (gimple_asm_nclobbers (gs
))
1756 else if (gimple_asm_ninputs (gs
))
1758 else if (gimple_asm_noutputs (gs
))
1763 for (f
= 0; f
< fields
; ++f
)
1765 pp_string (buffer
, " : ");
1770 n
= gimple_asm_noutputs (gs
);
1771 for (i
= 0; i
< n
; i
++)
1773 dump_generic_node (buffer
, gimple_asm_output_op (gs
, i
),
1776 pp_string (buffer
, ", ");
1781 n
= gimple_asm_ninputs (gs
);
1782 for (i
= 0; i
< n
; i
++)
1784 dump_generic_node (buffer
, gimple_asm_input_op (gs
, i
),
1787 pp_string (buffer
, ", ");
1792 n
= gimple_asm_nclobbers (gs
);
1793 for (i
= 0; i
< n
; i
++)
1795 dump_generic_node (buffer
, gimple_asm_clobber_op (gs
, i
),
1798 pp_string (buffer
, ", ");
1803 n
= gimple_asm_nlabels (gs
);
1804 for (i
= 0; i
< n
; i
++)
1806 dump_generic_node (buffer
, gimple_asm_label_op (gs
, i
),
1809 pp_string (buffer
, ", ");
1818 pp_string (buffer
, ");");
1822 /* Dump ptr_info and range_info for NODE on pretty_printer BUFFER with
1823 SPC spaces of indent. */
1826 dump_ssaname_info (pretty_printer
*buffer
, tree node
, int spc
)
1828 if (TREE_CODE (node
) != SSA_NAME
)
1831 if (POINTER_TYPE_P (TREE_TYPE (node
))
1832 && SSA_NAME_PTR_INFO (node
))
1834 unsigned int align
, misalign
;
1835 struct ptr_info_def
*pi
= SSA_NAME_PTR_INFO (node
);
1836 pp_string (buffer
, "# PT = ");
1837 pp_points_to_solution (buffer
, &pi
->pt
);
1838 newline_and_indent (buffer
, spc
);
1839 if (get_ptr_info_alignment (pi
, &align
, &misalign
))
1841 pp_printf (buffer
, "# ALIGN = %u, MISALIGN = %u", align
, misalign
);
1842 newline_and_indent (buffer
, spc
);
1846 if (!POINTER_TYPE_P (TREE_TYPE (node
))
1847 && SSA_NAME_RANGE_INFO (node
))
1849 wide_int min
, max
, nonzero_bits
;
1850 value_range_type range_type
= get_range_info (node
, &min
, &max
);
1852 if (range_type
== VR_VARYING
)
1853 pp_printf (buffer
, "# RANGE VR_VARYING");
1854 else if (range_type
== VR_RANGE
|| range_type
== VR_ANTI_RANGE
)
1856 pp_printf (buffer
, "# RANGE ");
1857 pp_printf (buffer
, "%s[", range_type
== VR_RANGE
? "" : "~");
1858 pp_wide_int (buffer
, min
, TYPE_SIGN (TREE_TYPE (node
)));
1859 pp_printf (buffer
, ", ");
1860 pp_wide_int (buffer
, max
, TYPE_SIGN (TREE_TYPE (node
)));
1861 pp_printf (buffer
, "]");
1863 nonzero_bits
= get_nonzero_bits (node
);
1864 if (nonzero_bits
!= -1)
1866 pp_string (buffer
, " NONZERO ");
1867 pp_wide_int (buffer
, nonzero_bits
, UNSIGNED
);
1869 newline_and_indent (buffer
, spc
);
1874 /* Dump a PHI node PHI. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1.
1875 The caller is responsible for calling pp_flush on BUFFER to finalize
1876 pretty printer. If COMMENT is true, print this after #. */
1879 dump_gimple_phi (pretty_printer
*buffer
, gphi
*phi
, int spc
, bool comment
,
1883 tree lhs
= gimple_phi_result (phi
);
1885 if (flags
& TDF_ALIAS
)
1886 dump_ssaname_info (buffer
, lhs
, spc
);
1889 pp_string (buffer
, "# ");
1891 if (flags
& TDF_RAW
)
1892 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, ", phi
,
1893 gimple_phi_result (phi
));
1896 dump_generic_node (buffer
, lhs
, spc
, flags
, false);
1897 pp_string (buffer
, " = PHI <");
1899 for (i
= 0; i
< gimple_phi_num_args (phi
); i
++)
1901 if ((flags
& TDF_LINENO
) && gimple_phi_arg_has_location (phi
, i
))
1902 dump_location (buffer
, gimple_phi_arg_location (phi
, i
));
1903 dump_generic_node (buffer
, gimple_phi_arg_def (phi
, i
), spc
, flags
,
1905 pp_left_paren (buffer
);
1906 pp_decimal_int (buffer
, gimple_phi_arg_edge (phi
, i
)->src
->index
);
1907 pp_right_paren (buffer
);
1908 if (i
< gimple_phi_num_args (phi
) - 1)
1909 pp_string (buffer
, ", ");
1911 pp_greater (buffer
);
1915 /* Dump a GIMPLE_OMP_PARALLEL tuple on the pretty_printer BUFFER, SPC spaces
1916 of indent. FLAGS specifies details to show in the dump (see TDF_* in
1920 dump_gimple_omp_parallel (pretty_printer
*buffer
, gomp_parallel
*gs
,
1923 if (flags
& TDF_RAW
)
1925 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1926 gimple_omp_body (gs
));
1927 dump_omp_clauses (buffer
, gimple_omp_parallel_clauses (gs
), spc
, flags
);
1928 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T%n>",
1929 gimple_omp_parallel_child_fn (gs
),
1930 gimple_omp_parallel_data_arg (gs
));
1935 pp_string (buffer
, "#pragma omp parallel");
1936 dump_omp_clauses (buffer
, gimple_omp_parallel_clauses (gs
), spc
, flags
);
1937 if (gimple_omp_parallel_child_fn (gs
))
1939 pp_string (buffer
, " [child fn: ");
1940 dump_generic_node (buffer
, gimple_omp_parallel_child_fn (gs
),
1942 pp_string (buffer
, " (");
1943 if (gimple_omp_parallel_data_arg (gs
))
1944 dump_generic_node (buffer
, gimple_omp_parallel_data_arg (gs
),
1947 pp_string (buffer
, "???");
1948 pp_string (buffer
, ")]");
1950 body
= gimple_omp_body (gs
);
1951 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
1953 newline_and_indent (buffer
, spc
+ 2);
1954 pp_left_brace (buffer
);
1955 pp_newline (buffer
);
1956 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
1957 newline_and_indent (buffer
, spc
+ 2);
1958 pp_right_brace (buffer
);
1962 pp_newline (buffer
);
1963 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
1969 /* Dump a GIMPLE_OMP_TASK tuple on the pretty_printer BUFFER, SPC spaces
1970 of indent. FLAGS specifies details to show in the dump (see TDF_* in
1974 dump_gimple_omp_task (pretty_printer
*buffer
, gomp_task
*gs
, int spc
,
1977 if (flags
& TDF_RAW
)
1979 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1980 gimple_omp_body (gs
));
1981 dump_omp_clauses (buffer
, gimple_omp_task_clauses (gs
), spc
, flags
);
1982 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T, %T, %T, %T%n>",
1983 gimple_omp_task_child_fn (gs
),
1984 gimple_omp_task_data_arg (gs
),
1985 gimple_omp_task_copy_fn (gs
),
1986 gimple_omp_task_arg_size (gs
),
1987 gimple_omp_task_arg_size (gs
));
1992 pp_string (buffer
, "#pragma omp task");
1993 dump_omp_clauses (buffer
, gimple_omp_task_clauses (gs
), spc
, flags
);
1994 if (gimple_omp_task_child_fn (gs
))
1996 pp_string (buffer
, " [child fn: ");
1997 dump_generic_node (buffer
, gimple_omp_task_child_fn (gs
),
1999 pp_string (buffer
, " (");
2000 if (gimple_omp_task_data_arg (gs
))
2001 dump_generic_node (buffer
, gimple_omp_task_data_arg (gs
),
2004 pp_string (buffer
, "???");
2005 pp_string (buffer
, ")]");
2007 body
= gimple_omp_body (gs
);
2008 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
2010 newline_and_indent (buffer
, spc
+ 2);
2011 pp_left_brace (buffer
);
2012 pp_newline (buffer
);
2013 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
2014 newline_and_indent (buffer
, spc
+ 2);
2015 pp_right_brace (buffer
);
2019 pp_newline (buffer
);
2020 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
2026 /* Dump a GIMPLE_OMP_ATOMIC_LOAD tuple on the pretty_printer BUFFER, SPC
2027 spaces of indent. FLAGS specifies details to show in the dump (see TDF_*
2031 dump_gimple_omp_atomic_load (pretty_printer
*buffer
, gomp_atomic_load
*gs
,
2034 if (flags
& TDF_RAW
)
2036 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T>", gs
,
2037 gimple_omp_atomic_load_lhs (gs
),
2038 gimple_omp_atomic_load_rhs (gs
));
2042 pp_string (buffer
, "#pragma omp atomic_load");
2043 if (gimple_omp_atomic_seq_cst_p (gs
))
2044 pp_string (buffer
, " seq_cst");
2045 if (gimple_omp_atomic_need_value_p (gs
))
2046 pp_string (buffer
, " [needed]");
2047 newline_and_indent (buffer
, spc
+ 2);
2048 dump_generic_node (buffer
, gimple_omp_atomic_load_lhs (gs
),
2054 dump_generic_node (buffer
, gimple_omp_atomic_load_rhs (gs
),
2059 /* Dump a GIMPLE_OMP_ATOMIC_STORE tuple on the pretty_printer BUFFER, SPC
2060 spaces of indent. FLAGS specifies details to show in the dump (see TDF_*
2064 dump_gimple_omp_atomic_store (pretty_printer
*buffer
,
2065 gomp_atomic_store
*gs
, int spc
, int flags
)
2067 if (flags
& TDF_RAW
)
2069 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
,
2070 gimple_omp_atomic_store_val (gs
));
2074 pp_string (buffer
, "#pragma omp atomic_store ");
2075 if (gimple_omp_atomic_seq_cst_p (gs
))
2076 pp_string (buffer
, "seq_cst ");
2077 if (gimple_omp_atomic_need_value_p (gs
))
2078 pp_string (buffer
, "[needed] ");
2079 pp_left_paren (buffer
);
2080 dump_generic_node (buffer
, gimple_omp_atomic_store_val (gs
),
2082 pp_right_paren (buffer
);
2087 /* Dump all the memory operands for statement GS. BUFFER, SPC and
2088 FLAGS are as in pp_gimple_stmt_1. */
2091 dump_gimple_mem_ops (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
2093 tree vdef
= gimple_vdef (gs
);
2094 tree vuse
= gimple_vuse (gs
);
2096 if (vdef
!= NULL_TREE
)
2098 pp_string (buffer
, "# ");
2099 dump_generic_node (buffer
, vdef
, spc
+ 2, flags
, false);
2100 pp_string (buffer
, " = VDEF <");
2101 dump_generic_node (buffer
, vuse
, spc
+ 2, flags
, false);
2102 pp_greater (buffer
);
2103 newline_and_indent (buffer
, spc
);
2105 else if (vuse
!= NULL_TREE
)
2107 pp_string (buffer
, "# VUSE <");
2108 dump_generic_node (buffer
, vuse
, spc
+ 2, flags
, false);
2109 pp_greater (buffer
);
2110 newline_and_indent (buffer
, spc
);
2115 /* Print the gimple statement GS on the pretty printer BUFFER, SPC
2116 spaces of indent. FLAGS specifies details to show in the dump (see
2117 TDF_* in dumpfile.h). The caller is responsible for calling
2118 pp_flush on BUFFER to finalize the pretty printer. */
2121 pp_gimple_stmt_1 (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
2126 if (flags
& TDF_STMTADDR
)
2127 pp_printf (buffer
, "<&%p> ", (void *) gs
);
2129 if ((flags
& TDF_LINENO
) && gimple_has_location (gs
))
2130 dump_location (buffer
, gimple_location (gs
));
2134 int lp_nr
= lookup_stmt_eh_lp (gs
);
2136 pp_printf (buffer
, "[LP %d] ", lp_nr
);
2138 pp_printf (buffer
, "[MNT %d] ", -lp_nr
);
2141 if ((flags
& (TDF_VOPS
|TDF_MEMSYMS
))
2142 && gimple_has_mem_ops (gs
))
2143 dump_gimple_mem_ops (buffer
, gs
, spc
, flags
);
2145 if (gimple_has_lhs (gs
)
2146 && (flags
& TDF_ALIAS
))
2147 dump_ssaname_info (buffer
, gimple_get_lhs (gs
), spc
);
2149 switch (gimple_code (gs
))
2152 dump_gimple_asm (buffer
, as_a
<gasm
*> (gs
), spc
, flags
);
2156 dump_gimple_assign (buffer
, as_a
<gassign
*> (gs
), spc
, flags
);
2160 dump_gimple_bind (buffer
, as_a
<gbind
*> (gs
), spc
, flags
);
2164 dump_gimple_call (buffer
, as_a
<gcall
*> (gs
), spc
, flags
);
2168 dump_gimple_cond (buffer
, as_a
<gcond
*> (gs
), spc
, flags
);
2172 dump_gimple_label (buffer
, as_a
<glabel
*> (gs
), spc
, flags
);
2176 dump_gimple_goto (buffer
, as_a
<ggoto
*> (gs
), spc
, flags
);
2180 pp_string (buffer
, "GIMPLE_NOP");
2184 dump_gimple_return (buffer
, as_a
<greturn
*> (gs
), spc
, flags
);
2188 dump_gimple_switch (buffer
, as_a
<gswitch
*> (gs
), spc
, flags
);
2192 dump_gimple_try (buffer
, as_a
<gtry
*> (gs
), spc
, flags
);
2196 dump_gimple_phi (buffer
, as_a
<gphi
*> (gs
), spc
, false, flags
);
2199 case GIMPLE_OMP_PARALLEL
:
2200 dump_gimple_omp_parallel (buffer
, as_a
<gomp_parallel
*> (gs
), spc
,
2204 case GIMPLE_OMP_TASK
:
2205 dump_gimple_omp_task (buffer
, as_a
<gomp_task
*> (gs
), spc
, flags
);
2208 case GIMPLE_OMP_ATOMIC_LOAD
:
2209 dump_gimple_omp_atomic_load (buffer
, as_a
<gomp_atomic_load
*> (gs
),
2213 case GIMPLE_OMP_ATOMIC_STORE
:
2214 dump_gimple_omp_atomic_store (buffer
,
2215 as_a
<gomp_atomic_store
*> (gs
),
2219 case GIMPLE_OMP_FOR
:
2220 dump_gimple_omp_for (buffer
, as_a
<gomp_for
*> (gs
), spc
, flags
);
2223 case GIMPLE_OMP_CONTINUE
:
2224 dump_gimple_omp_continue (buffer
, as_a
<gomp_continue
*> (gs
), spc
,
2228 case GIMPLE_OMP_SINGLE
:
2229 dump_gimple_omp_single (buffer
, as_a
<gomp_single
*> (gs
), spc
,
2233 case GIMPLE_OMP_TARGET
:
2234 dump_gimple_omp_target (buffer
, as_a
<gomp_target
*> (gs
), spc
,
2238 case GIMPLE_OMP_TEAMS
:
2239 dump_gimple_omp_teams (buffer
, as_a
<gomp_teams
*> (gs
), spc
,
2243 case GIMPLE_OMP_RETURN
:
2244 dump_gimple_omp_return (buffer
, gs
, spc
, flags
);
2247 case GIMPLE_OMP_SECTIONS
:
2248 dump_gimple_omp_sections (buffer
, as_a
<gomp_sections
*> (gs
),
2252 case GIMPLE_OMP_SECTIONS_SWITCH
:
2253 pp_string (buffer
, "GIMPLE_SECTIONS_SWITCH");
2256 case GIMPLE_OMP_MASTER
:
2257 case GIMPLE_OMP_TASKGROUP
:
2258 case GIMPLE_OMP_ORDERED
:
2259 case GIMPLE_OMP_SECTION
:
2260 dump_gimple_omp_block (buffer
, gs
, spc
, flags
);
2263 case GIMPLE_OMP_CRITICAL
:
2264 dump_gimple_omp_critical (buffer
, as_a
<gomp_critical
*> (gs
), spc
,
2269 dump_gimple_catch (buffer
, as_a
<gcatch
*> (gs
), spc
, flags
);
2272 case GIMPLE_EH_FILTER
:
2273 dump_gimple_eh_filter (buffer
, as_a
<geh_filter
*> (gs
), spc
, flags
);
2276 case GIMPLE_EH_MUST_NOT_THROW
:
2277 dump_gimple_eh_must_not_throw (buffer
,
2278 as_a
<geh_mnt
*> (gs
),
2282 case GIMPLE_EH_ELSE
:
2283 dump_gimple_eh_else (buffer
, as_a
<geh_else
*> (gs
), spc
, flags
);
2287 dump_gimple_resx (buffer
, as_a
<gresx
*> (gs
), spc
, flags
);
2290 case GIMPLE_EH_DISPATCH
:
2291 dump_gimple_eh_dispatch (buffer
, as_a
<geh_dispatch
*> (gs
), spc
,
2296 dump_gimple_debug (buffer
, as_a
<gdebug
*> (gs
), spc
, flags
);
2299 case GIMPLE_PREDICT
:
2300 pp_string (buffer
, "// predicted ");
2301 if (gimple_predict_outcome (gs
))
2302 pp_string (buffer
, "likely by ");
2304 pp_string (buffer
, "unlikely by ");
2305 pp_string (buffer
, predictor_name (gimple_predict_predictor (gs
)));
2306 pp_string (buffer
, " predictor.");
2309 case GIMPLE_TRANSACTION
:
2310 dump_gimple_transaction (buffer
, as_a
<gtransaction
*> (gs
), spc
,
2320 /* Dumps header of basic block BB to OUTF indented by INDENT
2321 spaces and details described by flags. */
2324 dump_gimple_bb_header (FILE *outf
, basic_block bb
, int indent
, int flags
)
2326 if (flags
& TDF_BLOCKS
)
2328 if (flags
& TDF_LINENO
)
2330 gimple_stmt_iterator gsi
;
2332 if (flags
& TDF_COMMENT
)
2333 fputs (";; ", outf
);
2335 for (gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
); gsi_next (&gsi
))
2336 if (!is_gimple_debug (gsi_stmt (gsi
))
2337 && get_lineno (gsi_stmt (gsi
)) != UNKNOWN_LOCATION
)
2339 fprintf (outf
, "%*sstarting at line %d",
2340 indent
, "", get_lineno (gsi_stmt (gsi
)));
2343 if (bb
->discriminator
)
2344 fprintf (outf
, ", discriminator %i", bb
->discriminator
);
2350 gimple stmt
= first_stmt (bb
);
2351 if (!stmt
|| gimple_code (stmt
) != GIMPLE_LABEL
)
2352 fprintf (outf
, "%*s<bb %d>:\n", indent
, "", bb
->index
);
2357 /* Dumps end of basic block BB to buffer BUFFER indented by INDENT
2361 dump_gimple_bb_footer (FILE *outf ATTRIBUTE_UNUSED
,
2362 basic_block bb ATTRIBUTE_UNUSED
,
2363 int indent ATTRIBUTE_UNUSED
,
2364 int flags ATTRIBUTE_UNUSED
)
2366 /* There is currently no GIMPLE-specific basic block info to dump. */
2371 /* Dump PHI nodes of basic block BB to BUFFER with details described
2372 by FLAGS and indented by INDENT spaces. */
2375 dump_phi_nodes (pretty_printer
*buffer
, basic_block bb
, int indent
, int flags
)
2379 for (i
= gsi_start_phis (bb
); !gsi_end_p (i
); gsi_next (&i
))
2381 gphi
*phi
= i
.phi ();
2382 if (!virtual_operand_p (gimple_phi_result (phi
)) || (flags
& TDF_VOPS
))
2385 dump_gimple_phi (buffer
, phi
, indent
, true, flags
);
2386 pp_newline (buffer
);
2392 /* Dump jump to basic block BB that is represented implicitly in the cfg
2396 pp_cfg_jump (pretty_printer
*buffer
, basic_block bb
)
2400 stmt
= first_stmt (bb
);
2402 pp_string (buffer
, "goto <bb ");
2403 pp_decimal_int (buffer
, bb
->index
);
2404 pp_greater (buffer
);
2405 if (stmt
&& gimple_code (stmt
) == GIMPLE_LABEL
)
2407 pp_string (buffer
, " (");
2408 dump_generic_node (buffer
,
2409 gimple_label_label (as_a
<glabel
*> (stmt
)),
2411 pp_right_paren (buffer
);
2412 pp_semicolon (buffer
);
2415 pp_semicolon (buffer
);
2419 /* Dump edges represented implicitly in basic block BB to BUFFER, indented
2420 by INDENT spaces, with details given by FLAGS. */
2423 dump_implicit_edges (pretty_printer
*buffer
, basic_block bb
, int indent
,
2429 stmt
= last_stmt (bb
);
2431 if (stmt
&& gimple_code (stmt
) == GIMPLE_COND
)
2433 edge true_edge
, false_edge
;
2435 /* When we are emitting the code or changing CFG, it is possible that
2436 the edges are not yet created. When we are using debug_bb in such
2437 a situation, we do not want it to crash. */
2438 if (EDGE_COUNT (bb
->succs
) != 2)
2440 extract_true_false_edges_from_block (bb
, &true_edge
, &false_edge
);
2442 INDENT (indent
+ 2);
2443 pp_cfg_jump (buffer
, true_edge
->dest
);
2444 newline_and_indent (buffer
, indent
);
2445 pp_string (buffer
, "else");
2446 newline_and_indent (buffer
, indent
+ 2);
2447 pp_cfg_jump (buffer
, false_edge
->dest
);
2448 pp_newline (buffer
);
2452 /* If there is a fallthru edge, we may need to add an artificial
2453 goto to the dump. */
2454 e
= find_fallthru_edge (bb
->succs
);
2456 if (e
&& e
->dest
!= bb
->next_bb
)
2460 if ((flags
& TDF_LINENO
)
2461 && e
->goto_locus
!= UNKNOWN_LOCATION
)
2462 dump_location (buffer
, e
->goto_locus
);
2464 pp_cfg_jump (buffer
, e
->dest
);
2465 pp_newline (buffer
);
2470 /* Dumps basic block BB to buffer BUFFER with details described by FLAGS and
2471 indented by INDENT spaces. */
2474 gimple_dump_bb_buff (pretty_printer
*buffer
, basic_block bb
, int indent
,
2477 gimple_stmt_iterator gsi
;
2479 int label_indent
= indent
- 2;
2481 if (label_indent
< 0)
2484 dump_phi_nodes (buffer
, bb
, indent
, flags
);
2486 for (gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
); gsi_next (&gsi
))
2490 stmt
= gsi_stmt (gsi
);
2492 curr_indent
= gimple_code (stmt
) == GIMPLE_LABEL
? label_indent
: indent
;
2494 INDENT (curr_indent
);
2495 pp_gimple_stmt_1 (buffer
, stmt
, curr_indent
, flags
);
2496 pp_newline_and_flush (buffer
);
2497 gcc_checking_assert (DECL_STRUCT_FUNCTION (current_function_decl
));
2498 dump_histograms_for_stmt (DECL_STRUCT_FUNCTION (current_function_decl
),
2499 pp_buffer (buffer
)->stream
, stmt
);
2502 dump_implicit_edges (buffer
, bb
, indent
, flags
);
2507 /* Dumps basic block BB to FILE with details described by FLAGS and
2508 indented by INDENT spaces. */
2511 gimple_dump_bb (FILE *file
, basic_block bb
, int indent
, int flags
)
2513 dump_gimple_bb_header (file
, bb
, indent
, flags
);
2514 if (bb
->index
>= NUM_FIXED_BLOCKS
)
2516 pretty_printer buffer
;
2517 pp_needs_newline (&buffer
) = true;
2518 buffer
.buffer
->stream
= file
;
2519 gimple_dump_bb_buff (&buffer
, bb
, indent
, flags
);
2521 dump_gimple_bb_footer (file
, bb
, indent
, flags
);
2524 /* Dumps basic block BB to pretty-printer PP with default dump flags and
2525 no indentation, for use as a label of a DOT graph record-node.
2526 ??? Should just use gimple_dump_bb_buff here, except that value profiling
2527 histogram dumping doesn't know about pretty-printers. */
2530 gimple_dump_bb_for_graph (pretty_printer
*pp
, basic_block bb
)
2532 pp_printf (pp
, "<bb %d>:\n", bb
->index
);
2533 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
2535 for (gphi_iterator gsi
= gsi_start_phis (bb
); !gsi_end_p (gsi
);
2538 gphi
*phi
= gsi
.phi ();
2539 if (!virtual_operand_p (gimple_phi_result (phi
))
2540 || (dump_flags
& TDF_VOPS
))
2543 pp_write_text_to_stream (pp
);
2544 pp_string (pp
, "# ");
2545 pp_gimple_stmt_1 (pp
, phi
, 0, dump_flags
);
2547 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
2551 for (gimple_stmt_iterator gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
);
2554 gimple stmt
= gsi_stmt (gsi
);
2556 pp_write_text_to_stream (pp
);
2557 pp_gimple_stmt_1 (pp
, stmt
, 0, dump_flags
);
2559 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
2561 dump_implicit_edges (pp
, bb
, 0, dump_flags
);
2562 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);