1 /* Pretty formatting of GIMPLE statements and expressions.
2 Copyright (C) 2001-2014 Free Software Foundation, Inc.
3 Contributed by Aldy Hernandez <aldyh@redhat.com> and
4 Diego Novillo <dnovillo@google.com>
6 This file is part of GCC.
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 3, or (at your option) any later
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING3. If not see
20 <http://www.gnu.org/licenses/>. */
24 #include "coretypes.h"
27 #include "stringpool.h"
28 #include "diagnostic.h"
29 #include "gimple-pretty-print.h"
36 #include "hard-reg-set.h"
39 #include "basic-block.h"
40 #include "tree-ssa-alias.h"
41 #include "internal-fn.h"
43 #include "gimple-expr.h"
46 #include "gimple-iterator.h"
47 #include "gimple-ssa.h"
49 #include "plugin-api.h"
53 #include "tree-ssanames.h"
54 #include "dumpfile.h" /* for dump_flags */
55 #include "value-prof.h"
56 #include "trans-mem.h"
58 #define INDENT(SPACE) \
59 do { int i; for (i = 0; i < SPACE; i++) pp_space (buffer); } while (0)
61 #define GIMPLE_NIY do_niy (buffer,gs)
63 /* Try to print on BUFFER a default message for the unrecognized
64 gimple statement GS. */
67 do_niy (pretty_printer
*buffer
, gimple gs
)
69 pp_printf (buffer
, "<<< Unknown GIMPLE statement: %s >>>\n",
70 gimple_code_name
[(int) gimple_code (gs
)]);
74 /* Emit a newline and SPC indentation spaces to BUFFER. */
77 newline_and_indent (pretty_printer
*buffer
, int spc
)
84 /* Print the GIMPLE statement GS on stderr. */
87 debug_gimple_stmt (gimple gs
)
89 print_gimple_stmt (stderr
, gs
, 0, TDF_VOPS
|TDF_MEMSYMS
);
93 /* Print GIMPLE statement G to FILE using SPC indentation spaces and
94 FLAGS as in pp_gimple_stmt_1. */
97 print_gimple_stmt (FILE *file
, gimple g
, int spc
, int flags
)
99 pretty_printer buffer
;
100 pp_needs_newline (&buffer
) = true;
101 buffer
.buffer
->stream
= file
;
102 pp_gimple_stmt_1 (&buffer
, g
, spc
, flags
);
103 pp_newline_and_flush (&buffer
);
107 debug (gimple_statement_base
&ref
)
109 print_gimple_stmt (stderr
, &ref
, 0, 0);
113 debug (gimple_statement_base
*ptr
)
118 fprintf (stderr
, "<nil>\n");
122 /* Print GIMPLE statement G to FILE using SPC indentation spaces and
123 FLAGS as in pp_gimple_stmt_1. Print only the right-hand side
127 print_gimple_expr (FILE *file
, gimple g
, int spc
, int flags
)
129 flags
|= TDF_RHS_ONLY
;
130 pretty_printer buffer
;
131 pp_needs_newline (&buffer
) = true;
132 buffer
.buffer
->stream
= file
;
133 pp_gimple_stmt_1 (&buffer
, g
, spc
, flags
);
138 /* Print the GIMPLE sequence SEQ on BUFFER using SPC indentation
139 spaces and FLAGS as in pp_gimple_stmt_1.
140 The caller is responsible for calling pp_flush on BUFFER to finalize
141 the pretty printer. */
144 dump_gimple_seq (pretty_printer
*buffer
, gimple_seq seq
, int spc
, int flags
)
146 gimple_stmt_iterator i
;
148 for (i
= gsi_start (seq
); !gsi_end_p (i
); gsi_next (&i
))
150 gimple gs
= gsi_stmt (i
);
152 pp_gimple_stmt_1 (buffer
, gs
, spc
, flags
);
153 if (!gsi_one_before_end_p (i
))
159 /* Print GIMPLE sequence SEQ to FILE using SPC indentation spaces and
160 FLAGS as in pp_gimple_stmt_1. */
163 print_gimple_seq (FILE *file
, gimple_seq seq
, int spc
, int flags
)
165 pretty_printer buffer
;
166 pp_needs_newline (&buffer
) = true;
167 buffer
.buffer
->stream
= file
;
168 dump_gimple_seq (&buffer
, seq
, spc
, flags
);
169 pp_newline_and_flush (&buffer
);
173 /* Print the GIMPLE sequence SEQ on stderr. */
176 debug_gimple_seq (gimple_seq seq
)
178 print_gimple_seq (stderr
, seq
, 0, TDF_VOPS
|TDF_MEMSYMS
);
182 /* A simple helper to pretty-print some of the gimple tuples in the printf
183 style. The format modifiers are preceded by '%' and are:
184 'G' - outputs a string corresponding to the code of the given gimple,
185 'S' - outputs a gimple_seq with indent of spc + 2,
186 'T' - outputs the tree t,
187 'd' - outputs an int as a decimal,
188 's' - outputs a string,
189 'n' - outputs a newline,
190 'x' - outputs an int as hexadecimal,
191 '+' - increases indent by 2 then outputs a newline,
192 '-' - decreases indent by 2 then outputs a newline. */
195 dump_gimple_fmt (pretty_printer
*buffer
, int spc
, int flags
,
196 const char *fmt
, ...)
202 va_start (args
, fmt
);
203 for (c
= fmt
; *c
; c
++)
213 g
= va_arg (args
, gimple
);
214 tmp
= gimple_code_name
[gimple_code (g
)];
215 pp_string (buffer
, tmp
);
219 seq
= va_arg (args
, gimple_seq
);
221 dump_gimple_seq (buffer
, seq
, spc
+ 2, flags
);
222 newline_and_indent (buffer
, spc
);
226 t
= va_arg (args
, tree
);
228 pp_string (buffer
, "NULL");
230 dump_generic_node (buffer
, t
, spc
, flags
, false);
234 pp_decimal_int (buffer
, va_arg (args
, int));
238 pp_string (buffer
, va_arg (args
, char *));
242 newline_and_indent (buffer
, spc
);
246 pp_scalar (buffer
, "%x", va_arg (args
, int));
251 newline_and_indent (buffer
, spc
);
256 newline_and_indent (buffer
, spc
);
264 pp_character (buffer
, *c
);
270 /* Helper for dump_gimple_assign. Print the unary RHS of the
271 assignment GS. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. */
274 dump_unary_rhs (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
276 enum tree_code rhs_code
= gimple_assign_rhs_code (gs
);
277 tree lhs
= gimple_assign_lhs (gs
);
278 tree rhs
= gimple_assign_rhs1 (gs
);
282 case VIEW_CONVERT_EXPR
:
284 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
287 case FIXED_CONVERT_EXPR
:
288 case ADDR_SPACE_CONVERT_EXPR
:
292 pp_left_paren (buffer
);
293 dump_generic_node (buffer
, TREE_TYPE (lhs
), spc
, flags
, false);
294 pp_string (buffer
, ") ");
295 if (op_prio (rhs
) < op_code_prio (rhs_code
))
297 pp_left_paren (buffer
);
298 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
299 pp_right_paren (buffer
);
302 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
306 pp_string (buffer
, "((");
307 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
308 pp_string (buffer
, "))");
312 pp_string (buffer
, "ABS_EXPR <");
313 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
318 if (TREE_CODE_CLASS (rhs_code
) == tcc_declaration
319 || TREE_CODE_CLASS (rhs_code
) == tcc_constant
320 || TREE_CODE_CLASS (rhs_code
) == tcc_reference
321 || rhs_code
== SSA_NAME
322 || rhs_code
== ADDR_EXPR
323 || rhs_code
== CONSTRUCTOR
)
325 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
328 else if (rhs_code
== BIT_NOT_EXPR
)
329 pp_complement (buffer
);
330 else if (rhs_code
== TRUTH_NOT_EXPR
)
331 pp_exclamation (buffer
);
332 else if (rhs_code
== NEGATE_EXPR
)
336 pp_left_bracket (buffer
);
337 pp_string (buffer
, get_tree_code_name (rhs_code
));
338 pp_string (buffer
, "] ");
341 if (op_prio (rhs
) < op_code_prio (rhs_code
))
343 pp_left_paren (buffer
);
344 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
345 pp_right_paren (buffer
);
348 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
354 /* Helper for dump_gimple_assign. Print the binary RHS of the
355 assignment GS. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. */
358 dump_binary_rhs (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
361 enum tree_code code
= gimple_assign_rhs_code (gs
);
367 case VEC_WIDEN_MULT_HI_EXPR
:
368 case VEC_WIDEN_MULT_LO_EXPR
:
369 case VEC_WIDEN_MULT_EVEN_EXPR
:
370 case VEC_WIDEN_MULT_ODD_EXPR
:
371 case VEC_PACK_TRUNC_EXPR
:
372 case VEC_PACK_SAT_EXPR
:
373 case VEC_PACK_FIX_TRUNC_EXPR
:
374 case VEC_WIDEN_LSHIFT_HI_EXPR
:
375 case VEC_WIDEN_LSHIFT_LO_EXPR
:
376 for (p
= get_tree_code_name (code
); *p
; p
++)
377 pp_character (buffer
, TOUPPER (*p
));
378 pp_string (buffer
, " <");
379 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
380 pp_string (buffer
, ", ");
381 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
386 if (op_prio (gimple_assign_rhs1 (gs
)) <= op_code_prio (code
))
388 pp_left_paren (buffer
);
389 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
,
391 pp_right_paren (buffer
);
394 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
396 pp_string (buffer
, op_symbol_code (gimple_assign_rhs_code (gs
)));
398 if (op_prio (gimple_assign_rhs2 (gs
)) <= op_code_prio (code
))
400 pp_left_paren (buffer
);
401 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
,
403 pp_right_paren (buffer
);
406 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
410 /* Helper for dump_gimple_assign. Print the ternary RHS of the
411 assignment GS. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. */
414 dump_ternary_rhs (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
417 enum tree_code code
= gimple_assign_rhs_code (gs
);
420 case WIDEN_MULT_PLUS_EXPR
:
421 case WIDEN_MULT_MINUS_EXPR
:
422 for (p
= get_tree_code_name (code
); *p
; p
++)
423 pp_character (buffer
, TOUPPER (*p
));
424 pp_string (buffer
, " <");
425 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
426 pp_string (buffer
, ", ");
427 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
428 pp_string (buffer
, ", ");
429 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
434 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
435 pp_string (buffer
, " * ");
436 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
437 pp_string (buffer
, " + ");
438 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
442 pp_string (buffer
, "DOT_PROD_EXPR <");
443 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
444 pp_string (buffer
, ", ");
445 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
446 pp_string (buffer
, ", ");
447 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
452 pp_string (buffer
, "SAD_EXPR <");
453 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
454 pp_string (buffer
, ", ");
455 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
456 pp_string (buffer
, ", ");
457 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
462 pp_string (buffer
, "VEC_PERM_EXPR <");
463 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
464 pp_string (buffer
, ", ");
465 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
466 pp_string (buffer
, ", ");
467 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
471 case REALIGN_LOAD_EXPR
:
472 pp_string (buffer
, "REALIGN_LOAD <");
473 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
474 pp_string (buffer
, ", ");
475 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
476 pp_string (buffer
, ", ");
477 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
482 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
483 pp_string (buffer
, " ? ");
484 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
485 pp_string (buffer
, " : ");
486 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
490 pp_string (buffer
, "VEC_COND_EXPR <");
491 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
492 pp_string (buffer
, ", ");
493 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
494 pp_string (buffer
, ", ");
495 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
505 /* Dump the gimple assignment GS. BUFFER, SPC and FLAGS are as in
509 dump_gimple_assign (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
516 switch (gimple_num_ops (gs
))
519 arg3
= gimple_assign_rhs3 (gs
);
521 arg2
= gimple_assign_rhs2 (gs
);
523 arg1
= gimple_assign_rhs1 (gs
);
529 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%s, %T, %T, %T, %T>", gs
,
530 get_tree_code_name (gimple_assign_rhs_code (gs
)),
531 gimple_assign_lhs (gs
), arg1
, arg2
, arg3
);
535 if (!(flags
& TDF_RHS_ONLY
))
537 dump_generic_node (buffer
, gimple_assign_lhs (gs
), spc
, flags
, false);
541 if (gimple_assign_nontemporal_move_p (gs
))
542 pp_string (buffer
, "{nt}");
544 if (gimple_has_volatile_ops (gs
))
545 pp_string (buffer
, "{v}");
550 if (gimple_num_ops (gs
) == 2)
551 dump_unary_rhs (buffer
, gs
, spc
, flags
);
552 else if (gimple_num_ops (gs
) == 3)
553 dump_binary_rhs (buffer
, gs
, spc
, flags
);
554 else if (gimple_num_ops (gs
) == 4)
555 dump_ternary_rhs (buffer
, gs
, spc
, flags
);
558 if (!(flags
& TDF_RHS_ONLY
))
559 pp_semicolon (buffer
);
564 /* Dump the return statement GS. BUFFER, SPC and FLAGS are as in
568 dump_gimple_return (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
572 t
= gimple_return_retval (gs
);
574 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
, t
);
577 pp_string (buffer
, "return");
581 dump_generic_node (buffer
, t
, spc
, flags
, false);
583 pp_semicolon (buffer
);
588 /* Dump the call arguments for a gimple call. BUFFER, FLAGS are as in
592 dump_gimple_call_args (pretty_printer
*buffer
, gimple gs
, int flags
)
596 for (i
= 0; i
< gimple_call_num_args (gs
); i
++)
598 dump_generic_node (buffer
, gimple_call_arg (gs
, i
), 0, flags
, false);
599 if (i
< gimple_call_num_args (gs
) - 1)
600 pp_string (buffer
, ", ");
603 if (gimple_call_va_arg_pack_p (gs
))
605 if (gimple_call_num_args (gs
) > 0)
611 pp_string (buffer
, "__builtin_va_arg_pack ()");
615 /* Dump the points-to solution *PT to BUFFER. */
618 pp_points_to_solution (pretty_printer
*buffer
, struct pt_solution
*pt
)
622 pp_string (buffer
, "anything ");
626 pp_string (buffer
, "nonlocal ");
628 pp_string (buffer
, "escaped ");
630 pp_string (buffer
, "unit-escaped ");
632 pp_string (buffer
, "null ");
634 && !bitmap_empty_p (pt
->vars
))
638 pp_string (buffer
, "{ ");
639 EXECUTE_IF_SET_IN_BITMAP (pt
->vars
, 0, i
, bi
)
641 pp_string (buffer
, "D.");
642 pp_decimal_int (buffer
, i
);
645 pp_right_brace (buffer
);
646 if (pt
->vars_contains_nonlocal
647 && pt
->vars_contains_escaped_heap
)
648 pp_string (buffer
, " (nonlocal, escaped heap)");
649 else if (pt
->vars_contains_nonlocal
650 && pt
->vars_contains_escaped
)
651 pp_string (buffer
, " (nonlocal, escaped)");
652 else if (pt
->vars_contains_nonlocal
)
653 pp_string (buffer
, " (nonlocal)");
654 else if (pt
->vars_contains_escaped_heap
)
655 pp_string (buffer
, " (escaped heap)");
656 else if (pt
->vars_contains_escaped
)
657 pp_string (buffer
, " (escaped)");
661 /* Dump the call statement GS. BUFFER, SPC and FLAGS are as in
665 dump_gimple_call (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
667 tree lhs
= gimple_call_lhs (gs
);
668 tree fn
= gimple_call_fn (gs
);
670 if (flags
& TDF_ALIAS
)
672 struct pt_solution
*pt
;
673 pt
= gimple_call_use_set (gs
);
674 if (!pt_solution_empty_p (pt
))
676 pp_string (buffer
, "# USE = ");
677 pp_points_to_solution (buffer
, pt
);
678 newline_and_indent (buffer
, spc
);
680 pt
= gimple_call_clobber_set (gs
);
681 if (!pt_solution_empty_p (pt
))
683 pp_string (buffer
, "# CLB = ");
684 pp_points_to_solution (buffer
, pt
);
685 newline_and_indent (buffer
, spc
);
691 if (gimple_call_internal_p (gs
))
692 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%s, %T", gs
,
693 internal_fn_name (gimple_call_internal_fn (gs
)), lhs
);
695 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T", gs
, fn
, lhs
);
696 if (gimple_call_num_args (gs
) > 0)
698 pp_string (buffer
, ", ");
699 dump_gimple_call_args (buffer
, gs
, flags
);
705 if (lhs
&& !(flags
& TDF_RHS_ONLY
))
707 dump_generic_node (buffer
, lhs
, spc
, flags
, false);
708 pp_string (buffer
, " =");
710 if (gimple_has_volatile_ops (gs
))
711 pp_string (buffer
, "{v}");
715 if (gimple_call_internal_p (gs
))
716 pp_string (buffer
, internal_fn_name (gimple_call_internal_fn (gs
)));
718 print_call_name (buffer
, fn
, flags
);
719 pp_string (buffer
, " (");
720 dump_gimple_call_args (buffer
, gs
, flags
);
721 pp_right_paren (buffer
);
722 if (!(flags
& TDF_RHS_ONLY
))
723 pp_semicolon (buffer
);
726 if (gimple_call_chain (gs
))
728 pp_string (buffer
, " [static-chain: ");
729 dump_generic_node (buffer
, gimple_call_chain (gs
), spc
, flags
, false);
730 pp_right_bracket (buffer
);
733 if (gimple_call_return_slot_opt_p (gs
))
734 pp_string (buffer
, " [return slot optimization]");
735 if (gimple_call_tail_p (gs
))
736 pp_string (buffer
, " [tail call]");
741 /* Dump the arguments of _ITM_beginTransaction sanely. */
742 if (TREE_CODE (fn
) == ADDR_EXPR
)
743 fn
= TREE_OPERAND (fn
, 0);
744 if (TREE_CODE (fn
) == FUNCTION_DECL
&& decl_is_tm_clone (fn
))
745 pp_string (buffer
, " [tm-clone]");
746 if (TREE_CODE (fn
) == FUNCTION_DECL
747 && DECL_BUILT_IN_CLASS (fn
) == BUILT_IN_NORMAL
748 && DECL_FUNCTION_CODE (fn
) == BUILT_IN_TM_START
749 && gimple_call_num_args (gs
) > 0)
751 tree t
= gimple_call_arg (gs
, 0);
752 unsigned HOST_WIDE_INT props
;
753 gcc_assert (TREE_CODE (t
) == INTEGER_CST
);
755 pp_string (buffer
, " [ ");
757 /* Get the transaction code properties. */
758 props
= TREE_INT_CST_LOW (t
);
760 if (props
& PR_INSTRUMENTEDCODE
)
761 pp_string (buffer
, "instrumentedCode ");
762 if (props
& PR_UNINSTRUMENTEDCODE
)
763 pp_string (buffer
, "uninstrumentedCode ");
764 if (props
& PR_HASNOXMMUPDATE
)
765 pp_string (buffer
, "hasNoXMMUpdate ");
766 if (props
& PR_HASNOABORT
)
767 pp_string (buffer
, "hasNoAbort ");
768 if (props
& PR_HASNOIRREVOCABLE
)
769 pp_string (buffer
, "hasNoIrrevocable ");
770 if (props
& PR_DOESGOIRREVOCABLE
)
771 pp_string (buffer
, "doesGoIrrevocable ");
772 if (props
& PR_HASNOSIMPLEREADS
)
773 pp_string (buffer
, "hasNoSimpleReads ");
774 if (props
& PR_AWBARRIERSOMITTED
)
775 pp_string (buffer
, "awBarriersOmitted ");
776 if (props
& PR_RARBARRIERSOMITTED
)
777 pp_string (buffer
, "RaRBarriersOmitted ");
778 if (props
& PR_UNDOLOGCODE
)
779 pp_string (buffer
, "undoLogCode ");
780 if (props
& PR_PREFERUNINSTRUMENTED
)
781 pp_string (buffer
, "preferUninstrumented ");
782 if (props
& PR_EXCEPTIONBLOCK
)
783 pp_string (buffer
, "exceptionBlock ");
784 if (props
& PR_HASELSE
)
785 pp_string (buffer
, "hasElse ");
786 if (props
& PR_READONLY
)
787 pp_string (buffer
, "readOnly ");
789 pp_right_bracket (buffer
);
794 /* Dump the switch statement GS. BUFFER, SPC and FLAGS are as in
798 dump_gimple_switch (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
802 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
804 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, ", gs
,
805 gimple_switch_index (gs
));
808 pp_string (buffer
, "switch (");
809 dump_generic_node (buffer
, gimple_switch_index (gs
), spc
, flags
, true);
810 pp_string (buffer
, ") <");
813 for (i
= 0; i
< gimple_switch_num_labels (gs
); i
++)
815 tree case_label
= gimple_switch_label (gs
, i
);
816 gcc_checking_assert (case_label
!= NULL_TREE
);
817 dump_generic_node (buffer
, case_label
, spc
, flags
, false);
819 dump_generic_node (buffer
, CASE_LABEL (case_label
), spc
, flags
, false);
820 if (i
< gimple_switch_num_labels (gs
) - 1)
821 pp_string (buffer
, ", ");
827 /* Dump the gimple conditional GS. BUFFER, SPC and FLAGS are as in
831 dump_gimple_cond (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
834 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%s, %T, %T, %T, %T>", gs
,
835 get_tree_code_name (gimple_cond_code (gs
)),
836 gimple_cond_lhs (gs
), gimple_cond_rhs (gs
),
837 gimple_cond_true_label (gs
), gimple_cond_false_label (gs
));
840 if (!(flags
& TDF_RHS_ONLY
))
841 pp_string (buffer
, "if (");
842 dump_generic_node (buffer
, gimple_cond_lhs (gs
), spc
, flags
, false);
844 pp_string (buffer
, op_symbol_code (gimple_cond_code (gs
)));
846 dump_generic_node (buffer
, gimple_cond_rhs (gs
), spc
, flags
, false);
847 if (!(flags
& TDF_RHS_ONLY
))
849 pp_right_paren (buffer
);
851 if (gimple_cond_true_label (gs
))
853 pp_string (buffer
, " goto ");
854 dump_generic_node (buffer
, gimple_cond_true_label (gs
),
856 pp_semicolon (buffer
);
858 if (gimple_cond_false_label (gs
))
860 pp_string (buffer
, " else goto ");
861 dump_generic_node (buffer
, gimple_cond_false_label (gs
),
863 pp_semicolon (buffer
);
870 /* Dump a GIMPLE_LABEL tuple on the pretty_printer BUFFER, SPC
871 spaces of indent. FLAGS specifies details to show in the dump (see
872 TDF_* in dumpfils.h). */
875 dump_gimple_label (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
877 tree label
= gimple_label_label (gs
);
879 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
, label
);
882 dump_generic_node (buffer
, label
, spc
, flags
, false);
885 if (DECL_NONLOCAL (label
))
886 pp_string (buffer
, " [non-local]");
887 if ((flags
& TDF_EH
) && EH_LANDING_PAD_NR (label
))
888 pp_printf (buffer
, " [LP %d]", EH_LANDING_PAD_NR (label
));
891 /* Dump a GIMPLE_GOTO tuple on the pretty_printer BUFFER, SPC
892 spaces of indent. FLAGS specifies details to show in the dump (see
893 TDF_* in dumpfile.h). */
896 dump_gimple_goto (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
898 tree label
= gimple_goto_dest (gs
);
900 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
, label
);
902 dump_gimple_fmt (buffer
, spc
, flags
, "goto %T;", label
);
906 /* Dump a GIMPLE_BIND tuple on the pretty_printer BUFFER, SPC
907 spaces of indent. FLAGS specifies details to show in the dump (see
908 TDF_* in dumpfile.h). */
911 dump_gimple_bind (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
914 dump_gimple_fmt (buffer
, spc
, flags
, "%G <", gs
);
916 pp_left_brace (buffer
);
917 if (!(flags
& TDF_SLIM
))
921 for (var
= gimple_bind_vars (gs
); var
; var
= DECL_CHAIN (var
))
923 newline_and_indent (buffer
, 2);
924 print_declaration (buffer
, var
, spc
, flags
);
926 if (gimple_bind_vars (gs
))
930 dump_gimple_seq (buffer
, gimple_bind_body (gs
), spc
+ 2, flags
);
931 newline_and_indent (buffer
, spc
);
935 pp_right_brace (buffer
);
939 /* Dump a GIMPLE_TRY tuple on the pretty_printer BUFFER, SPC spaces of
940 indent. FLAGS specifies details to show in the dump (see TDF_* in
944 dump_gimple_try (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
949 if (gimple_try_kind (gs
) == GIMPLE_TRY_CATCH
)
950 type
= "GIMPLE_TRY_CATCH";
951 else if (gimple_try_kind (gs
) == GIMPLE_TRY_FINALLY
)
952 type
= "GIMPLE_TRY_FINALLY";
954 type
= "UNKNOWN GIMPLE_TRY";
955 dump_gimple_fmt (buffer
, spc
, flags
,
956 "%G <%s,%+EVAL <%S>%nCLEANUP <%S>%->", gs
, type
,
957 gimple_try_eval (gs
), gimple_try_cleanup (gs
));
961 pp_string (buffer
, "try");
962 newline_and_indent (buffer
, spc
+ 2);
963 pp_left_brace (buffer
);
966 dump_gimple_seq (buffer
, gimple_try_eval (gs
), spc
+ 4, flags
);
967 newline_and_indent (buffer
, spc
+ 2);
968 pp_right_brace (buffer
);
970 if (gimple_try_kind (gs
) == GIMPLE_TRY_CATCH
)
972 newline_and_indent (buffer
, spc
);
973 pp_string (buffer
, "catch");
974 newline_and_indent (buffer
, spc
+ 2);
975 pp_left_brace (buffer
);
977 else if (gimple_try_kind (gs
) == GIMPLE_TRY_FINALLY
)
979 newline_and_indent (buffer
, spc
);
980 pp_string (buffer
, "finally");
981 newline_and_indent (buffer
, spc
+ 2);
982 pp_left_brace (buffer
);
985 pp_string (buffer
, " <UNKNOWN GIMPLE_TRY> {");
988 dump_gimple_seq (buffer
, gimple_try_cleanup (gs
), spc
+ 4, flags
);
989 newline_and_indent (buffer
, spc
+ 2);
990 pp_right_brace (buffer
);
995 /* Dump a GIMPLE_CATCH tuple on the pretty_printer BUFFER, SPC spaces of
996 indent. FLAGS specifies details to show in the dump (see TDF_* in
1000 dump_gimple_catch (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1002 if (flags
& TDF_RAW
)
1003 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %+CATCH <%S>%->", gs
,
1004 gimple_catch_types (gs
), gimple_catch_handler (gs
));
1006 dump_gimple_fmt (buffer
, spc
, flags
, "catch (%T)%+{%S}",
1007 gimple_catch_types (gs
), gimple_catch_handler (gs
));
1011 /* Dump a GIMPLE_EH_FILTER tuple on the pretty_printer BUFFER, SPC spaces of
1012 indent. FLAGS specifies details to show in the dump (see TDF_* in
1016 dump_gimple_eh_filter (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1018 if (flags
& TDF_RAW
)
1019 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %+FAILURE <%S>%->", gs
,
1020 gimple_eh_filter_types (gs
),
1021 gimple_eh_filter_failure (gs
));
1023 dump_gimple_fmt (buffer
, spc
, flags
, "<<<eh_filter (%T)>>>%+{%+%S%-}",
1024 gimple_eh_filter_types (gs
),
1025 gimple_eh_filter_failure (gs
));
1029 /* Dump a GIMPLE_EH_MUST_NOT_THROW tuple. */
1032 dump_gimple_eh_must_not_throw (pretty_printer
*buffer
, gimple gs
,
1035 if (flags
& TDF_RAW
)
1036 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
,
1037 gimple_eh_must_not_throw_fndecl (gs
));
1039 dump_gimple_fmt (buffer
, spc
, flags
, "<<<eh_must_not_throw (%T)>>>",
1040 gimple_eh_must_not_throw_fndecl (gs
));
1044 /* Dump a GIMPLE_EH_ELSE tuple on the pretty_printer BUFFER, SPC spaces of
1045 indent. FLAGS specifies details to show in the dump (see TDF_* in
1049 dump_gimple_eh_else (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1051 if (flags
& TDF_RAW
)
1052 dump_gimple_fmt (buffer
, spc
, flags
,
1053 "%G <%+N_BODY <%S>%nE_BODY <%S>%->", gs
,
1054 gimple_eh_else_n_body (gs
), gimple_eh_else_e_body (gs
));
1056 dump_gimple_fmt (buffer
, spc
, flags
,
1057 "<<<if_normal_exit>>>%+{%S}%-<<<else_eh_exit>>>%+{%S}",
1058 gimple_eh_else_n_body (gs
), gimple_eh_else_e_body (gs
));
1062 /* Dump a GIMPLE_RESX tuple on the pretty_printer BUFFER, SPC spaces of
1063 indent. FLAGS specifies details to show in the dump (see TDF_* in
1067 dump_gimple_resx (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1069 if (flags
& TDF_RAW
)
1070 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%d>", gs
,
1071 gimple_resx_region (gs
));
1073 dump_gimple_fmt (buffer
, spc
, flags
, "resx %d", gimple_resx_region (gs
));
1076 /* Dump a GIMPLE_EH_DISPATCH tuple on the pretty_printer BUFFER. */
1079 dump_gimple_eh_dispatch (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1081 if (flags
& TDF_RAW
)
1082 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%d>", gs
,
1083 gimple_eh_dispatch_region (gs
));
1085 dump_gimple_fmt (buffer
, spc
, flags
, "eh_dispatch %d",
1086 gimple_eh_dispatch_region (gs
));
1089 /* Dump a GIMPLE_DEBUG tuple on the pretty_printer BUFFER, SPC spaces
1090 of indent. FLAGS specifies details to show in the dump (see TDF_*
1094 dump_gimple_debug (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1096 switch (gs
->subcode
)
1098 case GIMPLE_DEBUG_BIND
:
1099 if (flags
& TDF_RAW
)
1100 dump_gimple_fmt (buffer
, spc
, flags
, "%G BIND <%T, %T>", gs
,
1101 gimple_debug_bind_get_var (gs
),
1102 gimple_debug_bind_get_value (gs
));
1104 dump_gimple_fmt (buffer
, spc
, flags
, "# DEBUG %T => %T",
1105 gimple_debug_bind_get_var (gs
),
1106 gimple_debug_bind_get_value (gs
));
1109 case GIMPLE_DEBUG_SOURCE_BIND
:
1110 if (flags
& TDF_RAW
)
1111 dump_gimple_fmt (buffer
, spc
, flags
, "%G SRCBIND <%T, %T>", gs
,
1112 gimple_debug_source_bind_get_var (gs
),
1113 gimple_debug_source_bind_get_value (gs
));
1115 dump_gimple_fmt (buffer
, spc
, flags
, "# DEBUG %T s=> %T",
1116 gimple_debug_source_bind_get_var (gs
),
1117 gimple_debug_source_bind_get_value (gs
));
1125 /* Dump a GIMPLE_OMP_FOR tuple on the pretty_printer BUFFER. */
1127 dump_gimple_omp_for (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1131 if (flags
& TDF_RAW
)
1134 switch (gimple_omp_for_kind (gs
))
1136 case GF_OMP_FOR_KIND_FOR
:
1139 case GF_OMP_FOR_KIND_SIMD
:
1142 case GF_OMP_FOR_KIND_CILKSIMD
:
1145 case GF_OMP_FOR_KIND_DISTRIBUTE
:
1146 kind
= " distribute";
1148 case GF_OMP_FOR_KIND_CILKFOR
:
1149 kind
= " _Cilk_for";
1154 dump_gimple_fmt (buffer
, spc
, flags
, "%G%s <%+BODY <%S>%nCLAUSES <", gs
,
1155 kind
, gimple_omp_body (gs
));
1156 dump_omp_clauses (buffer
, gimple_omp_for_clauses (gs
), spc
, flags
);
1157 dump_gimple_fmt (buffer
, spc
, flags
, " >,");
1158 for (i
= 0; i
< gimple_omp_for_collapse (gs
); i
++)
1159 dump_gimple_fmt (buffer
, spc
, flags
,
1160 "%+%T, %T, %T, %s, %T,%n",
1161 gimple_omp_for_index (gs
, i
),
1162 gimple_omp_for_initial (gs
, i
),
1163 gimple_omp_for_final (gs
, i
),
1164 get_tree_code_name (gimple_omp_for_cond (gs
, i
)),
1165 gimple_omp_for_incr (gs
, i
));
1166 dump_gimple_fmt (buffer
, spc
, flags
, "PRE_BODY <%S>%->",
1167 gimple_omp_for_pre_body (gs
));
1171 switch (gimple_omp_for_kind (gs
))
1173 case GF_OMP_FOR_KIND_FOR
:
1174 pp_string (buffer
, "#pragma omp for");
1176 case GF_OMP_FOR_KIND_SIMD
:
1177 pp_string (buffer
, "#pragma omp simd");
1179 case GF_OMP_FOR_KIND_CILKSIMD
:
1180 pp_string (buffer
, "#pragma simd");
1182 case GF_OMP_FOR_KIND_DISTRIBUTE
:
1183 pp_string (buffer
, "#pragma omp distribute");
1185 case GF_OMP_FOR_KIND_CILKFOR
:
1190 if (gimple_omp_for_kind (gs
) != GF_OMP_FOR_KIND_CILKFOR
)
1191 dump_omp_clauses (buffer
, gimple_omp_for_clauses (gs
), spc
, flags
);
1192 for (i
= 0; i
< gimple_omp_for_collapse (gs
); i
++)
1196 if (gimple_omp_for_kind (gs
) == GF_OMP_FOR_KIND_CILKFOR
)
1197 pp_string (buffer
, "_Cilk_for (");
1200 newline_and_indent (buffer
, spc
);
1201 pp_string (buffer
, "for (");
1203 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
1205 pp_string (buffer
, " = ");
1206 dump_generic_node (buffer
, gimple_omp_for_initial (gs
, i
), spc
,
1208 pp_string (buffer
, "; ");
1210 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
1213 switch (gimple_omp_for_cond (gs
, i
))
1219 pp_greater (buffer
);
1222 pp_less_equal (buffer
);
1225 pp_greater_equal (buffer
);
1228 pp_string (buffer
, "!=");
1234 dump_generic_node (buffer
, gimple_omp_for_final (gs
, i
), spc
,
1236 pp_string (buffer
, "; ");
1238 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
1240 pp_string (buffer
, " = ");
1241 dump_generic_node (buffer
, gimple_omp_for_incr (gs
, i
), spc
,
1243 pp_right_paren (buffer
);
1246 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1248 if (gimple_omp_for_kind (gs
) == GF_OMP_FOR_KIND_CILKFOR
)
1249 dump_omp_clauses (buffer
, gimple_omp_for_clauses (gs
), spc
, flags
);
1250 newline_and_indent (buffer
, spc
+ 2);
1251 pp_left_brace (buffer
);
1252 pp_newline (buffer
);
1253 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1254 newline_and_indent (buffer
, spc
+ 2);
1255 pp_right_brace (buffer
);
1260 /* Dump a GIMPLE_OMP_CONTINUE tuple on the pretty_printer BUFFER. */
1263 dump_gimple_omp_continue (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1265 if (flags
& TDF_RAW
)
1267 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T>", gs
,
1268 gimple_omp_continue_control_def (gs
),
1269 gimple_omp_continue_control_use (gs
));
1273 pp_string (buffer
, "#pragma omp continue (");
1274 dump_generic_node (buffer
, gimple_omp_continue_control_def (gs
),
1278 dump_generic_node (buffer
, gimple_omp_continue_control_use (gs
),
1280 pp_right_paren (buffer
);
1284 /* Dump a GIMPLE_OMP_SINGLE tuple on the pretty_printer BUFFER. */
1287 dump_gimple_omp_single (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1289 if (flags
& TDF_RAW
)
1291 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1292 gimple_omp_body (gs
));
1293 dump_omp_clauses (buffer
, gimple_omp_single_clauses (gs
), spc
, flags
);
1294 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1298 pp_string (buffer
, "#pragma omp single");
1299 dump_omp_clauses (buffer
, gimple_omp_single_clauses (gs
), spc
, flags
);
1300 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1302 newline_and_indent (buffer
, spc
+ 2);
1303 pp_left_brace (buffer
);
1304 pp_newline (buffer
);
1305 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1306 newline_and_indent (buffer
, spc
+ 2);
1307 pp_right_brace (buffer
);
1312 /* Dump a GIMPLE_OMP_TARGET tuple on the pretty_printer BUFFER. */
1315 dump_gimple_omp_target (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1318 switch (gimple_omp_target_kind (gs
))
1320 case GF_OMP_TARGET_KIND_REGION
:
1323 case GF_OMP_TARGET_KIND_DATA
:
1326 case GF_OMP_TARGET_KIND_UPDATE
:
1332 if (flags
& TDF_RAW
)
1334 dump_gimple_fmt (buffer
, spc
, flags
, "%G%s <%+BODY <%S>%nCLAUSES <", gs
,
1335 kind
, gimple_omp_body (gs
));
1336 dump_omp_clauses (buffer
, gimple_omp_target_clauses (gs
), spc
, flags
);
1337 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1341 pp_string (buffer
, "#pragma omp target");
1342 pp_string (buffer
, kind
);
1343 dump_omp_clauses (buffer
, gimple_omp_target_clauses (gs
), spc
, flags
);
1344 if (gimple_omp_target_child_fn (gs
))
1346 pp_string (buffer
, " [child fn: ");
1347 dump_generic_node (buffer
, gimple_omp_target_child_fn (gs
),
1349 pp_right_bracket (buffer
);
1351 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1353 newline_and_indent (buffer
, spc
+ 2);
1354 pp_character (buffer
, '{');
1355 pp_newline (buffer
);
1356 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1357 newline_and_indent (buffer
, spc
+ 2);
1358 pp_character (buffer
, '}');
1363 /* Dump a GIMPLE_OMP_TEAMS tuple on the pretty_printer BUFFER. */
1366 dump_gimple_omp_teams (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1368 if (flags
& TDF_RAW
)
1370 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1371 gimple_omp_body (gs
));
1372 dump_omp_clauses (buffer
, gimple_omp_teams_clauses (gs
), spc
, flags
);
1373 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1377 pp_string (buffer
, "#pragma omp teams");
1378 dump_omp_clauses (buffer
, gimple_omp_teams_clauses (gs
), spc
, flags
);
1379 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1381 newline_and_indent (buffer
, spc
+ 2);
1382 pp_character (buffer
, '{');
1383 pp_newline (buffer
);
1384 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1385 newline_and_indent (buffer
, spc
+ 2);
1386 pp_character (buffer
, '}');
1391 /* Dump a GIMPLE_OMP_SECTIONS tuple on the pretty_printer BUFFER. */
1394 dump_gimple_omp_sections (pretty_printer
*buffer
, gimple gs
, int spc
,
1397 if (flags
& TDF_RAW
)
1399 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1400 gimple_omp_body (gs
));
1401 dump_omp_clauses (buffer
, gimple_omp_sections_clauses (gs
), spc
, flags
);
1402 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1406 pp_string (buffer
, "#pragma omp sections");
1407 if (gimple_omp_sections_control (gs
))
1409 pp_string (buffer
, " <");
1410 dump_generic_node (buffer
, gimple_omp_sections_control (gs
), spc
,
1412 pp_greater (buffer
);
1414 dump_omp_clauses (buffer
, gimple_omp_sections_clauses (gs
), spc
, flags
);
1415 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1417 newline_and_indent (buffer
, spc
+ 2);
1418 pp_left_brace (buffer
);
1419 pp_newline (buffer
);
1420 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1421 newline_and_indent (buffer
, spc
+ 2);
1422 pp_right_brace (buffer
);
1427 /* Dump a GIMPLE_OMP_{MASTER,TASKGROUP,ORDERED,SECTION} tuple on the
1428 pretty_printer BUFFER. */
1431 dump_gimple_omp_block (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1433 if (flags
& TDF_RAW
)
1434 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1435 gimple_omp_body (gs
));
1438 switch (gimple_code (gs
))
1440 case GIMPLE_OMP_MASTER
:
1441 pp_string (buffer
, "#pragma omp master");
1443 case GIMPLE_OMP_TASKGROUP
:
1444 pp_string (buffer
, "#pragma omp taskgroup");
1446 case GIMPLE_OMP_ORDERED
:
1447 pp_string (buffer
, "#pragma omp ordered");
1449 case GIMPLE_OMP_SECTION
:
1450 pp_string (buffer
, "#pragma omp section");
1455 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1457 newline_and_indent (buffer
, spc
+ 2);
1458 pp_left_brace (buffer
);
1459 pp_newline (buffer
);
1460 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1461 newline_and_indent (buffer
, spc
+ 2);
1462 pp_right_brace (buffer
);
1467 /* Dump a GIMPLE_OMP_CRITICAL tuple on the pretty_printer BUFFER. */
1470 dump_gimple_omp_critical (pretty_printer
*buffer
, gimple gs
, int spc
,
1473 if (flags
& TDF_RAW
)
1474 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1475 gimple_omp_body (gs
));
1478 pp_string (buffer
, "#pragma omp critical");
1479 if (gimple_omp_critical_name (gs
))
1481 pp_string (buffer
, " (");
1482 dump_generic_node (buffer
, gimple_omp_critical_name (gs
), spc
,
1484 pp_right_paren (buffer
);
1486 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1488 newline_and_indent (buffer
, spc
+ 2);
1489 pp_left_brace (buffer
);
1490 pp_newline (buffer
);
1491 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1492 newline_and_indent (buffer
, spc
+ 2);
1493 pp_right_brace (buffer
);
1498 /* Dump a GIMPLE_OMP_RETURN tuple on the pretty_printer BUFFER. */
1501 dump_gimple_omp_return (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1503 if (flags
& TDF_RAW
)
1505 dump_gimple_fmt (buffer
, spc
, flags
, "%G <nowait=%d", gs
,
1506 (int) gimple_omp_return_nowait_p (gs
));
1507 if (gimple_omp_return_lhs (gs
))
1508 dump_gimple_fmt (buffer
, spc
, flags
, ", lhs=%T>",
1509 gimple_omp_return_lhs (gs
));
1511 dump_gimple_fmt (buffer
, spc
, flags
, ">");
1515 pp_string (buffer
, "#pragma omp return");
1516 if (gimple_omp_return_nowait_p (gs
))
1517 pp_string (buffer
, "(nowait)");
1518 if (gimple_omp_return_lhs (gs
))
1520 pp_string (buffer
, " (set ");
1521 dump_generic_node (buffer
, gimple_omp_return_lhs (gs
),
1523 pp_character (buffer
, ')');
1528 /* Dump a GIMPLE_TRANSACTION tuple on the pretty_printer BUFFER. */
1531 dump_gimple_transaction (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1533 unsigned subcode
= gimple_transaction_subcode (gs
);
1535 if (flags
& TDF_RAW
)
1537 dump_gimple_fmt (buffer
, spc
, flags
,
1538 "%G [SUBCODE=%x,LABEL=%T] <%+BODY <%S> >",
1539 gs
, subcode
, gimple_transaction_label (gs
),
1540 gimple_transaction_body (gs
));
1544 if (subcode
& GTMA_IS_OUTER
)
1545 pp_string (buffer
, "__transaction_atomic [[outer]]");
1546 else if (subcode
& GTMA_IS_RELAXED
)
1547 pp_string (buffer
, "__transaction_relaxed");
1549 pp_string (buffer
, "__transaction_atomic");
1550 subcode
&= ~GTMA_DECLARATION_MASK
;
1552 if (subcode
|| gimple_transaction_label (gs
))
1554 pp_string (buffer
, " //");
1555 if (gimple_transaction_label (gs
))
1557 pp_string (buffer
, " LABEL=");
1558 dump_generic_node (buffer
, gimple_transaction_label (gs
),
1563 pp_string (buffer
, " SUBCODE=[ ");
1564 if (subcode
& GTMA_HAVE_ABORT
)
1566 pp_string (buffer
, "GTMA_HAVE_ABORT ");
1567 subcode
&= ~GTMA_HAVE_ABORT
;
1569 if (subcode
& GTMA_HAVE_LOAD
)
1571 pp_string (buffer
, "GTMA_HAVE_LOAD ");
1572 subcode
&= ~GTMA_HAVE_LOAD
;
1574 if (subcode
& GTMA_HAVE_STORE
)
1576 pp_string (buffer
, "GTMA_HAVE_STORE ");
1577 subcode
&= ~GTMA_HAVE_STORE
;
1579 if (subcode
& GTMA_MAY_ENTER_IRREVOCABLE
)
1581 pp_string (buffer
, "GTMA_MAY_ENTER_IRREVOCABLE ");
1582 subcode
&= ~GTMA_MAY_ENTER_IRREVOCABLE
;
1584 if (subcode
& GTMA_DOES_GO_IRREVOCABLE
)
1586 pp_string (buffer
, "GTMA_DOES_GO_IRREVOCABLE ");
1587 subcode
&= ~GTMA_DOES_GO_IRREVOCABLE
;
1589 if (subcode
& GTMA_HAS_NO_INSTRUMENTATION
)
1591 pp_string (buffer
, "GTMA_HAS_NO_INSTRUMENTATION ");
1592 subcode
&= ~GTMA_HAS_NO_INSTRUMENTATION
;
1595 pp_printf (buffer
, "0x%x ", subcode
);
1596 pp_right_bracket (buffer
);
1600 if (!gimple_seq_empty_p (gimple_transaction_body (gs
)))
1602 newline_and_indent (buffer
, spc
+ 2);
1603 pp_left_brace (buffer
);
1604 pp_newline (buffer
);
1605 dump_gimple_seq (buffer
, gimple_transaction_body (gs
),
1607 newline_and_indent (buffer
, spc
+ 2);
1608 pp_right_brace (buffer
);
1613 /* Dump a GIMPLE_ASM tuple on the pretty_printer BUFFER, SPC spaces of
1614 indent. FLAGS specifies details to show in the dump (see TDF_* in
1618 dump_gimple_asm (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1620 unsigned int i
, n
, f
, fields
;
1622 if (flags
& TDF_RAW
)
1624 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+STRING <%n%s%n>", gs
,
1625 gimple_asm_string (gs
));
1627 n
= gimple_asm_noutputs (gs
);
1630 newline_and_indent (buffer
, spc
+ 2);
1631 pp_string (buffer
, "OUTPUT: ");
1632 for (i
= 0; i
< n
; i
++)
1634 dump_generic_node (buffer
, gimple_asm_output_op (gs
, i
),
1637 pp_string (buffer
, ", ");
1641 n
= gimple_asm_ninputs (gs
);
1644 newline_and_indent (buffer
, spc
+ 2);
1645 pp_string (buffer
, "INPUT: ");
1646 for (i
= 0; i
< n
; i
++)
1648 dump_generic_node (buffer
, gimple_asm_input_op (gs
, i
),
1651 pp_string (buffer
, ", ");
1655 n
= gimple_asm_nclobbers (gs
);
1658 newline_and_indent (buffer
, spc
+ 2);
1659 pp_string (buffer
, "CLOBBER: ");
1660 for (i
= 0; i
< n
; i
++)
1662 dump_generic_node (buffer
, gimple_asm_clobber_op (gs
, i
),
1665 pp_string (buffer
, ", ");
1669 n
= gimple_asm_nlabels (gs
);
1672 newline_and_indent (buffer
, spc
+ 2);
1673 pp_string (buffer
, "LABEL: ");
1674 for (i
= 0; i
< n
; i
++)
1676 dump_generic_node (buffer
, gimple_asm_label_op (gs
, i
),
1679 pp_string (buffer
, ", ");
1683 newline_and_indent (buffer
, spc
);
1684 pp_greater (buffer
);
1688 pp_string (buffer
, "__asm__");
1689 if (gimple_asm_volatile_p (gs
))
1690 pp_string (buffer
, " __volatile__");
1691 if (gimple_asm_nlabels (gs
))
1692 pp_string (buffer
, " goto");
1693 pp_string (buffer
, "(\"");
1694 pp_string (buffer
, gimple_asm_string (gs
));
1695 pp_string (buffer
, "\"");
1697 if (gimple_asm_nlabels (gs
))
1699 else if (gimple_asm_nclobbers (gs
))
1701 else if (gimple_asm_ninputs (gs
))
1703 else if (gimple_asm_noutputs (gs
))
1708 for (f
= 0; f
< fields
; ++f
)
1710 pp_string (buffer
, " : ");
1715 n
= gimple_asm_noutputs (gs
);
1716 for (i
= 0; i
< n
; i
++)
1718 dump_generic_node (buffer
, gimple_asm_output_op (gs
, i
),
1721 pp_string (buffer
, ", ");
1726 n
= gimple_asm_ninputs (gs
);
1727 for (i
= 0; i
< n
; i
++)
1729 dump_generic_node (buffer
, gimple_asm_input_op (gs
, i
),
1732 pp_string (buffer
, ", ");
1737 n
= gimple_asm_nclobbers (gs
);
1738 for (i
= 0; i
< n
; i
++)
1740 dump_generic_node (buffer
, gimple_asm_clobber_op (gs
, i
),
1743 pp_string (buffer
, ", ");
1748 n
= gimple_asm_nlabels (gs
);
1749 for (i
= 0; i
< n
; i
++)
1751 dump_generic_node (buffer
, gimple_asm_label_op (gs
, i
),
1754 pp_string (buffer
, ", ");
1763 pp_string (buffer
, ");");
1767 /* Dump ptr_info and range_info for NODE on pretty_printer BUFFER with
1768 SPC spaces of indent. */
1771 dump_ssaname_info (pretty_printer
*buffer
, tree node
, int spc
)
1773 if (TREE_CODE (node
) != SSA_NAME
)
1776 if (POINTER_TYPE_P (TREE_TYPE (node
))
1777 && SSA_NAME_PTR_INFO (node
))
1779 unsigned int align
, misalign
;
1780 struct ptr_info_def
*pi
= SSA_NAME_PTR_INFO (node
);
1781 pp_string (buffer
, "# PT = ");
1782 pp_points_to_solution (buffer
, &pi
->pt
);
1783 newline_and_indent (buffer
, spc
);
1784 if (get_ptr_info_alignment (pi
, &align
, &misalign
))
1786 pp_printf (buffer
, "# ALIGN = %u, MISALIGN = %u", align
, misalign
);
1787 newline_and_indent (buffer
, spc
);
1791 if (!POINTER_TYPE_P (TREE_TYPE (node
))
1792 && SSA_NAME_RANGE_INFO (node
))
1794 wide_int min
, max
, nonzero_bits
;
1795 value_range_type range_type
= get_range_info (node
, &min
, &max
);
1797 if (range_type
== VR_VARYING
)
1798 pp_printf (buffer
, "# RANGE VR_VARYING");
1799 else if (range_type
== VR_RANGE
|| range_type
== VR_ANTI_RANGE
)
1801 pp_printf (buffer
, "# RANGE ");
1802 pp_printf (buffer
, "%s[", range_type
== VR_RANGE
? "" : "~");
1803 pp_wide_int (buffer
, min
, TYPE_SIGN (TREE_TYPE (node
)));
1804 pp_printf (buffer
, ", ");
1805 pp_wide_int (buffer
, max
, TYPE_SIGN (TREE_TYPE (node
)));
1806 pp_printf (buffer
, "]");
1808 nonzero_bits
= get_nonzero_bits (node
);
1809 if (nonzero_bits
!= -1)
1811 pp_string (buffer
, " NONZERO ");
1812 pp_wide_int (buffer
, nonzero_bits
, UNSIGNED
);
1814 newline_and_indent (buffer
, spc
);
1819 /* Dump a PHI node PHI. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1.
1820 The caller is responsible for calling pp_flush on BUFFER to finalize
1821 pretty printer. If COMMENT is true, print this after #. */
1824 dump_gimple_phi (pretty_printer
*buffer
, gimple phi
, int spc
, bool comment
,
1828 tree lhs
= gimple_phi_result (phi
);
1830 if (flags
& TDF_ALIAS
)
1831 dump_ssaname_info (buffer
, lhs
, spc
);
1834 pp_string (buffer
, "# ");
1836 if (flags
& TDF_RAW
)
1837 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, ", phi
,
1838 gimple_phi_result (phi
));
1841 dump_generic_node (buffer
, lhs
, spc
, flags
, false);
1842 pp_string (buffer
, " = PHI <");
1844 for (i
= 0; i
< gimple_phi_num_args (phi
); i
++)
1846 if ((flags
& TDF_LINENO
) && gimple_phi_arg_has_location (phi
, i
))
1847 dump_location (buffer
, gimple_phi_arg_location (phi
, i
));
1848 dump_generic_node (buffer
, gimple_phi_arg_def (phi
, i
), spc
, flags
,
1850 pp_left_paren (buffer
);
1851 pp_decimal_int (buffer
, gimple_phi_arg_edge (phi
, i
)->src
->index
);
1852 pp_right_paren (buffer
);
1853 if (i
< gimple_phi_num_args (phi
) - 1)
1854 pp_string (buffer
, ", ");
1856 pp_greater (buffer
);
1860 /* Dump a GIMPLE_OMP_PARALLEL tuple on the pretty_printer BUFFER, SPC spaces
1861 of indent. FLAGS specifies details to show in the dump (see TDF_* in
1865 dump_gimple_omp_parallel (pretty_printer
*buffer
, gimple gs
, int spc
,
1868 if (flags
& TDF_RAW
)
1870 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1871 gimple_omp_body (gs
));
1872 dump_omp_clauses (buffer
, gimple_omp_parallel_clauses (gs
), spc
, flags
);
1873 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T%n>",
1874 gimple_omp_parallel_child_fn (gs
),
1875 gimple_omp_parallel_data_arg (gs
));
1880 pp_string (buffer
, "#pragma omp parallel");
1881 dump_omp_clauses (buffer
, gimple_omp_parallel_clauses (gs
), spc
, flags
);
1882 if (gimple_omp_parallel_child_fn (gs
))
1884 pp_string (buffer
, " [child fn: ");
1885 dump_generic_node (buffer
, gimple_omp_parallel_child_fn (gs
),
1887 pp_string (buffer
, " (");
1888 if (gimple_omp_parallel_data_arg (gs
))
1889 dump_generic_node (buffer
, gimple_omp_parallel_data_arg (gs
),
1892 pp_string (buffer
, "???");
1893 pp_string (buffer
, ")]");
1895 body
= gimple_omp_body (gs
);
1896 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
1898 newline_and_indent (buffer
, spc
+ 2);
1899 pp_left_brace (buffer
);
1900 pp_newline (buffer
);
1901 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
1902 newline_and_indent (buffer
, spc
+ 2);
1903 pp_right_brace (buffer
);
1907 pp_newline (buffer
);
1908 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
1914 /* Dump a GIMPLE_OMP_TASK tuple on the pretty_printer BUFFER, SPC spaces
1915 of indent. FLAGS specifies details to show in the dump (see TDF_* in
1919 dump_gimple_omp_task (pretty_printer
*buffer
, gimple gs
, int spc
,
1922 if (flags
& TDF_RAW
)
1924 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1925 gimple_omp_body (gs
));
1926 dump_omp_clauses (buffer
, gimple_omp_task_clauses (gs
), spc
, flags
);
1927 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T, %T, %T, %T%n>",
1928 gimple_omp_task_child_fn (gs
),
1929 gimple_omp_task_data_arg (gs
),
1930 gimple_omp_task_copy_fn (gs
),
1931 gimple_omp_task_arg_size (gs
),
1932 gimple_omp_task_arg_size (gs
));
1937 pp_string (buffer
, "#pragma omp task");
1938 dump_omp_clauses (buffer
, gimple_omp_task_clauses (gs
), spc
, flags
);
1939 if (gimple_omp_task_child_fn (gs
))
1941 pp_string (buffer
, " [child fn: ");
1942 dump_generic_node (buffer
, gimple_omp_task_child_fn (gs
),
1944 pp_string (buffer
, " (");
1945 if (gimple_omp_task_data_arg (gs
))
1946 dump_generic_node (buffer
, gimple_omp_task_data_arg (gs
),
1949 pp_string (buffer
, "???");
1950 pp_string (buffer
, ")]");
1952 body
= gimple_omp_body (gs
);
1953 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
1955 newline_and_indent (buffer
, spc
+ 2);
1956 pp_left_brace (buffer
);
1957 pp_newline (buffer
);
1958 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
1959 newline_and_indent (buffer
, spc
+ 2);
1960 pp_right_brace (buffer
);
1964 pp_newline (buffer
);
1965 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
1971 /* Dump a GIMPLE_OMP_ATOMIC_LOAD tuple on the pretty_printer BUFFER, SPC
1972 spaces of indent. FLAGS specifies details to show in the dump (see TDF_*
1976 dump_gimple_omp_atomic_load (pretty_printer
*buffer
, gimple gs
, int spc
,
1979 if (flags
& TDF_RAW
)
1981 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T>", gs
,
1982 gimple_omp_atomic_load_lhs (gs
),
1983 gimple_omp_atomic_load_rhs (gs
));
1987 pp_string (buffer
, "#pragma omp atomic_load");
1988 if (gimple_omp_atomic_seq_cst_p (gs
))
1989 pp_string (buffer
, " seq_cst");
1990 if (gimple_omp_atomic_need_value_p (gs
))
1991 pp_string (buffer
, " [needed]");
1992 newline_and_indent (buffer
, spc
+ 2);
1993 dump_generic_node (buffer
, gimple_omp_atomic_load_lhs (gs
),
1999 dump_generic_node (buffer
, gimple_omp_atomic_load_rhs (gs
),
2004 /* Dump a GIMPLE_OMP_ATOMIC_STORE tuple on the pretty_printer BUFFER, SPC
2005 spaces of indent. FLAGS specifies details to show in the dump (see TDF_*
2009 dump_gimple_omp_atomic_store (pretty_printer
*buffer
, gimple gs
, int spc
,
2012 if (flags
& TDF_RAW
)
2014 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
,
2015 gimple_omp_atomic_store_val (gs
));
2019 pp_string (buffer
, "#pragma omp atomic_store ");
2020 if (gimple_omp_atomic_seq_cst_p (gs
))
2021 pp_string (buffer
, "seq_cst ");
2022 if (gimple_omp_atomic_need_value_p (gs
))
2023 pp_string (buffer
, "[needed] ");
2024 pp_left_paren (buffer
);
2025 dump_generic_node (buffer
, gimple_omp_atomic_store_val (gs
),
2027 pp_right_paren (buffer
);
2032 /* Dump all the memory operands for statement GS. BUFFER, SPC and
2033 FLAGS are as in pp_gimple_stmt_1. */
2036 dump_gimple_mem_ops (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
2038 tree vdef
= gimple_vdef (gs
);
2039 tree vuse
= gimple_vuse (gs
);
2041 if (vdef
!= NULL_TREE
)
2043 pp_string (buffer
, "# ");
2044 dump_generic_node (buffer
, vdef
, spc
+ 2, flags
, false);
2045 pp_string (buffer
, " = VDEF <");
2046 dump_generic_node (buffer
, vuse
, spc
+ 2, flags
, false);
2047 pp_greater (buffer
);
2048 newline_and_indent (buffer
, spc
);
2050 else if (vuse
!= NULL_TREE
)
2052 pp_string (buffer
, "# VUSE <");
2053 dump_generic_node (buffer
, vuse
, spc
+ 2, flags
, false);
2054 pp_greater (buffer
);
2055 newline_and_indent (buffer
, spc
);
2060 /* Print the gimple statement GS on the pretty printer BUFFER, SPC
2061 spaces of indent. FLAGS specifies details to show in the dump (see
2062 TDF_* in dumpfile.h). The caller is responsible for calling
2063 pp_flush on BUFFER to finalize the pretty printer. */
2066 pp_gimple_stmt_1 (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
2071 if (flags
& TDF_STMTADDR
)
2072 pp_printf (buffer
, "<&%p> ", (void *) gs
);
2074 if ((flags
& TDF_LINENO
) && gimple_has_location (gs
))
2075 dump_location (buffer
, gimple_location (gs
));
2079 int lp_nr
= lookup_stmt_eh_lp (gs
);
2081 pp_printf (buffer
, "[LP %d] ", lp_nr
);
2083 pp_printf (buffer
, "[MNT %d] ", -lp_nr
);
2086 if ((flags
& (TDF_VOPS
|TDF_MEMSYMS
))
2087 && gimple_has_mem_ops (gs
))
2088 dump_gimple_mem_ops (buffer
, gs
, spc
, flags
);
2090 if (gimple_has_lhs (gs
)
2091 && (flags
& TDF_ALIAS
))
2092 dump_ssaname_info (buffer
, gimple_get_lhs (gs
), spc
);
2094 switch (gimple_code (gs
))
2097 dump_gimple_asm (buffer
, gs
, spc
, flags
);
2101 dump_gimple_assign (buffer
, gs
, spc
, flags
);
2105 dump_gimple_bind (buffer
, gs
, spc
, flags
);
2109 dump_gimple_call (buffer
, gs
, spc
, flags
);
2113 dump_gimple_cond (buffer
, gs
, spc
, flags
);
2117 dump_gimple_label (buffer
, gs
, spc
, flags
);
2121 dump_gimple_goto (buffer
, gs
, spc
, flags
);
2125 pp_string (buffer
, "GIMPLE_NOP");
2129 dump_gimple_return (buffer
, gs
, spc
, flags
);
2133 dump_gimple_switch (buffer
, gs
, spc
, flags
);
2137 dump_gimple_try (buffer
, gs
, spc
, flags
);
2141 dump_gimple_phi (buffer
, gs
, spc
, false, flags
);
2144 case GIMPLE_OMP_PARALLEL
:
2145 dump_gimple_omp_parallel (buffer
, gs
, spc
, flags
);
2148 case GIMPLE_OMP_TASK
:
2149 dump_gimple_omp_task (buffer
, gs
, spc
, flags
);
2152 case GIMPLE_OMP_ATOMIC_LOAD
:
2153 dump_gimple_omp_atomic_load (buffer
, gs
, spc
, flags
);
2157 case GIMPLE_OMP_ATOMIC_STORE
:
2158 dump_gimple_omp_atomic_store (buffer
, gs
, spc
, flags
);
2161 case GIMPLE_OMP_FOR
:
2162 dump_gimple_omp_for (buffer
, gs
, spc
, flags
);
2165 case GIMPLE_OMP_CONTINUE
:
2166 dump_gimple_omp_continue (buffer
, gs
, spc
, flags
);
2169 case GIMPLE_OMP_SINGLE
:
2170 dump_gimple_omp_single (buffer
, gs
, spc
, flags
);
2173 case GIMPLE_OMP_TARGET
:
2174 dump_gimple_omp_target (buffer
, gs
, spc
, flags
);
2177 case GIMPLE_OMP_TEAMS
:
2178 dump_gimple_omp_teams (buffer
, gs
, spc
, flags
);
2181 case GIMPLE_OMP_RETURN
:
2182 dump_gimple_omp_return (buffer
, gs
, spc
, flags
);
2185 case GIMPLE_OMP_SECTIONS
:
2186 dump_gimple_omp_sections (buffer
, gs
, spc
, flags
);
2189 case GIMPLE_OMP_SECTIONS_SWITCH
:
2190 pp_string (buffer
, "GIMPLE_SECTIONS_SWITCH");
2193 case GIMPLE_OMP_MASTER
:
2194 case GIMPLE_OMP_TASKGROUP
:
2195 case GIMPLE_OMP_ORDERED
:
2196 case GIMPLE_OMP_SECTION
:
2197 dump_gimple_omp_block (buffer
, gs
, spc
, flags
);
2200 case GIMPLE_OMP_CRITICAL
:
2201 dump_gimple_omp_critical (buffer
, gs
, spc
, flags
);
2205 dump_gimple_catch (buffer
, gs
, spc
, flags
);
2208 case GIMPLE_EH_FILTER
:
2209 dump_gimple_eh_filter (buffer
, gs
, spc
, flags
);
2212 case GIMPLE_EH_MUST_NOT_THROW
:
2213 dump_gimple_eh_must_not_throw (buffer
, gs
, spc
, flags
);
2216 case GIMPLE_EH_ELSE
:
2217 dump_gimple_eh_else (buffer
, gs
, spc
, flags
);
2221 dump_gimple_resx (buffer
, gs
, spc
, flags
);
2224 case GIMPLE_EH_DISPATCH
:
2225 dump_gimple_eh_dispatch (buffer
, gs
, spc
, flags
);
2229 dump_gimple_debug (buffer
, gs
, spc
, flags
);
2232 case GIMPLE_PREDICT
:
2233 pp_string (buffer
, "// predicted ");
2234 if (gimple_predict_outcome (gs
))
2235 pp_string (buffer
, "likely by ");
2237 pp_string (buffer
, "unlikely by ");
2238 pp_string (buffer
, predictor_name (gimple_predict_predictor (gs
)));
2239 pp_string (buffer
, " predictor.");
2242 case GIMPLE_TRANSACTION
:
2243 dump_gimple_transaction (buffer
, gs
, spc
, flags
);
2252 /* Dumps header of basic block BB to OUTF indented by INDENT
2253 spaces and details described by flags. */
2256 dump_gimple_bb_header (FILE *outf
, basic_block bb
, int indent
, int flags
)
2258 if (flags
& TDF_BLOCKS
)
2260 if (flags
& TDF_LINENO
)
2262 gimple_stmt_iterator gsi
;
2264 if (flags
& TDF_COMMENT
)
2265 fputs (";; ", outf
);
2267 for (gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
); gsi_next (&gsi
))
2268 if (!is_gimple_debug (gsi_stmt (gsi
))
2269 && get_lineno (gsi_stmt (gsi
)) != UNKNOWN_LOCATION
)
2271 fprintf (outf
, "%*sstarting at line %d",
2272 indent
, "", get_lineno (gsi_stmt (gsi
)));
2275 if (bb
->discriminator
)
2276 fprintf (outf
, ", discriminator %i", bb
->discriminator
);
2282 gimple stmt
= first_stmt (bb
);
2283 if (!stmt
|| gimple_code (stmt
) != GIMPLE_LABEL
)
2284 fprintf (outf
, "%*s<bb %d>:\n", indent
, "", bb
->index
);
2289 /* Dumps end of basic block BB to buffer BUFFER indented by INDENT
2293 dump_gimple_bb_footer (FILE *outf ATTRIBUTE_UNUSED
,
2294 basic_block bb ATTRIBUTE_UNUSED
,
2295 int indent ATTRIBUTE_UNUSED
,
2296 int flags ATTRIBUTE_UNUSED
)
2298 /* There is currently no GIMPLE-specific basic block info to dump. */
2303 /* Dump PHI nodes of basic block BB to BUFFER with details described
2304 by FLAGS and indented by INDENT spaces. */
2307 dump_phi_nodes (pretty_printer
*buffer
, basic_block bb
, int indent
, int flags
)
2309 gimple_stmt_iterator i
;
2311 for (i
= gsi_start_phis (bb
); !gsi_end_p (i
); gsi_next (&i
))
2313 gimple phi
= gsi_stmt (i
);
2314 if (!virtual_operand_p (gimple_phi_result (phi
)) || (flags
& TDF_VOPS
))
2317 dump_gimple_phi (buffer
, phi
, indent
, true, flags
);
2318 pp_newline (buffer
);
2324 /* Dump jump to basic block BB that is represented implicitly in the cfg
2328 pp_cfg_jump (pretty_printer
*buffer
, basic_block bb
)
2332 stmt
= first_stmt (bb
);
2334 pp_string (buffer
, "goto <bb ");
2335 pp_decimal_int (buffer
, bb
->index
);
2336 pp_greater (buffer
);
2337 if (stmt
&& gimple_code (stmt
) == GIMPLE_LABEL
)
2339 pp_string (buffer
, " (");
2340 dump_generic_node (buffer
, gimple_label_label (stmt
), 0, 0, false);
2341 pp_right_paren (buffer
);
2342 pp_semicolon (buffer
);
2345 pp_semicolon (buffer
);
2349 /* Dump edges represented implicitly in basic block BB to BUFFER, indented
2350 by INDENT spaces, with details given by FLAGS. */
2353 dump_implicit_edges (pretty_printer
*buffer
, basic_block bb
, int indent
,
2359 stmt
= last_stmt (bb
);
2361 if (stmt
&& gimple_code (stmt
) == GIMPLE_COND
)
2363 edge true_edge
, false_edge
;
2365 /* When we are emitting the code or changing CFG, it is possible that
2366 the edges are not yet created. When we are using debug_bb in such
2367 a situation, we do not want it to crash. */
2368 if (EDGE_COUNT (bb
->succs
) != 2)
2370 extract_true_false_edges_from_block (bb
, &true_edge
, &false_edge
);
2372 INDENT (indent
+ 2);
2373 pp_cfg_jump (buffer
, true_edge
->dest
);
2374 newline_and_indent (buffer
, indent
);
2375 pp_string (buffer
, "else");
2376 newline_and_indent (buffer
, indent
+ 2);
2377 pp_cfg_jump (buffer
, false_edge
->dest
);
2378 pp_newline (buffer
);
2382 /* If there is a fallthru edge, we may need to add an artificial
2383 goto to the dump. */
2384 e
= find_fallthru_edge (bb
->succs
);
2386 if (e
&& e
->dest
!= bb
->next_bb
)
2390 if ((flags
& TDF_LINENO
)
2391 && e
->goto_locus
!= UNKNOWN_LOCATION
)
2392 dump_location (buffer
, e
->goto_locus
);
2394 pp_cfg_jump (buffer
, e
->dest
);
2395 pp_newline (buffer
);
2400 /* Dumps basic block BB to buffer BUFFER with details described by FLAGS and
2401 indented by INDENT spaces. */
2404 gimple_dump_bb_buff (pretty_printer
*buffer
, basic_block bb
, int indent
,
2407 gimple_stmt_iterator gsi
;
2409 int label_indent
= indent
- 2;
2411 if (label_indent
< 0)
2414 dump_phi_nodes (buffer
, bb
, indent
, flags
);
2416 for (gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
); gsi_next (&gsi
))
2420 stmt
= gsi_stmt (gsi
);
2422 curr_indent
= gimple_code (stmt
) == GIMPLE_LABEL
? label_indent
: indent
;
2424 INDENT (curr_indent
);
2425 pp_gimple_stmt_1 (buffer
, stmt
, curr_indent
, flags
);
2426 pp_newline_and_flush (buffer
);
2427 gcc_checking_assert (DECL_STRUCT_FUNCTION (current_function_decl
));
2428 dump_histograms_for_stmt (DECL_STRUCT_FUNCTION (current_function_decl
),
2429 pp_buffer (buffer
)->stream
, stmt
);
2432 dump_implicit_edges (buffer
, bb
, indent
, flags
);
2437 /* Dumps basic block BB to FILE with details described by FLAGS and
2438 indented by INDENT spaces. */
2441 gimple_dump_bb (FILE *file
, basic_block bb
, int indent
, int flags
)
2443 dump_gimple_bb_header (file
, bb
, indent
, flags
);
2444 if (bb
->index
>= NUM_FIXED_BLOCKS
)
2446 pretty_printer buffer
;
2447 pp_needs_newline (&buffer
) = true;
2448 buffer
.buffer
->stream
= file
;
2449 gimple_dump_bb_buff (&buffer
, bb
, indent
, flags
);
2451 dump_gimple_bb_footer (file
, bb
, indent
, flags
);
2454 /* Dumps basic block BB to pretty-printer PP with default dump flags and
2455 no indentation, for use as a label of a DOT graph record-node.
2456 ??? Should just use gimple_dump_bb_buff here, except that value profiling
2457 histogram dumping doesn't know about pretty-printers. */
2460 gimple_dump_bb_for_graph (pretty_printer
*pp
, basic_block bb
)
2462 gimple_stmt_iterator gsi
;
2464 pp_printf (pp
, "<bb %d>:\n", bb
->index
);
2465 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
2467 for (gsi
= gsi_start_phis (bb
); !gsi_end_p (gsi
); gsi_next (&gsi
))
2469 gimple phi
= gsi_stmt (gsi
);
2470 if (!virtual_operand_p (gimple_phi_result (phi
))
2471 || (dump_flags
& TDF_VOPS
))
2474 pp_write_text_to_stream (pp
);
2475 pp_string (pp
, "# ");
2476 pp_gimple_stmt_1 (pp
, phi
, 0, dump_flags
);
2478 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
2482 for (gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
); gsi_next (&gsi
))
2484 gimple stmt
= gsi_stmt (gsi
);
2486 pp_write_text_to_stream (pp
);
2487 pp_gimple_stmt_1 (pp
, stmt
, 0, dump_flags
);
2489 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
2491 dump_implicit_edges (pp
, bb
, 0, dump_flags
);
2492 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);