1 /* Pretty formatting of GIMPLE statements and expressions.
2 Copyright (C) 2001-2013 Free Software Foundation, Inc.
3 Contributed by Aldy Hernandez <aldyh@redhat.com> and
4 Diego Novillo <dnovillo@google.com>
6 This file is part of GCC.
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 3, or (at your option) any later
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING3. If not see
20 <http://www.gnu.org/licenses/>. */
24 #include "coretypes.h"
27 #include "diagnostic.h"
28 #include "gimple-pretty-print.h"
32 #include "gimple-ssa.h"
35 #include "tree-ssanames.h"
36 #include "dumpfile.h" /* for dump_flags */
37 #include "value-prof.h"
38 #include "trans-mem.h"
40 #define INDENT(SPACE) \
41 do { int i; for (i = 0; i < SPACE; i++) pp_space (buffer); } while (0)
43 #define GIMPLE_NIY do_niy (buffer,gs)
45 /* Try to print on BUFFER a default message for the unrecognized
46 gimple statement GS. */
49 do_niy (pretty_printer
*buffer
, gimple gs
)
51 pp_printf (buffer
, "<<< Unknown GIMPLE statement: %s >>>\n",
52 gimple_code_name
[(int) gimple_code (gs
)]);
56 /* Emit a newline and SPC indentation spaces to BUFFER. */
59 newline_and_indent (pretty_printer
*buffer
, int spc
)
66 /* Print the GIMPLE statement GS on stderr. */
69 debug_gimple_stmt (gimple gs
)
71 print_gimple_stmt (stderr
, gs
, 0, TDF_VOPS
|TDF_MEMSYMS
);
75 /* Print GIMPLE statement G to FILE using SPC indentation spaces and
76 FLAGS as in pp_gimple_stmt_1. */
79 print_gimple_stmt (FILE *file
, gimple g
, int spc
, int flags
)
81 pretty_printer buffer
;
82 pp_needs_newline (&buffer
) = true;
83 buffer
.buffer
->stream
= file
;
84 pp_gimple_stmt_1 (&buffer
, g
, spc
, flags
);
85 pp_newline_and_flush (&buffer
);
89 debug (gimple_statement_d
&ref
)
91 print_gimple_stmt (stderr
, &ref
, 0, 0);
95 debug (gimple_statement_d
*ptr
)
100 fprintf (stderr
, "<nil>\n");
104 /* Print GIMPLE statement G to FILE using SPC indentation spaces and
105 FLAGS as in pp_gimple_stmt_1. Print only the right-hand side
109 print_gimple_expr (FILE *file
, gimple g
, int spc
, int flags
)
111 flags
|= TDF_RHS_ONLY
;
112 pretty_printer buffer
;
113 pp_needs_newline (&buffer
) = true;
114 buffer
.buffer
->stream
= file
;
115 pp_gimple_stmt_1 (&buffer
, g
, spc
, flags
);
120 /* Print the GIMPLE sequence SEQ on BUFFER using SPC indentation
121 spaces and FLAGS as in pp_gimple_stmt_1.
122 The caller is responsible for calling pp_flush on BUFFER to finalize
123 the pretty printer. */
126 dump_gimple_seq (pretty_printer
*buffer
, gimple_seq seq
, int spc
, int flags
)
128 gimple_stmt_iterator i
;
130 for (i
= gsi_start (seq
); !gsi_end_p (i
); gsi_next (&i
))
132 gimple gs
= gsi_stmt (i
);
134 pp_gimple_stmt_1 (buffer
, gs
, spc
, flags
);
135 if (!gsi_one_before_end_p (i
))
141 /* Print GIMPLE sequence SEQ to FILE using SPC indentation spaces and
142 FLAGS as in pp_gimple_stmt_1. */
145 print_gimple_seq (FILE *file
, gimple_seq seq
, int spc
, int flags
)
147 pretty_printer buffer
;
148 pp_needs_newline (&buffer
) = true;
149 buffer
.buffer
->stream
= file
;
150 dump_gimple_seq (&buffer
, seq
, spc
, flags
);
151 pp_newline_and_flush (&buffer
);
155 /* Print the GIMPLE sequence SEQ on stderr. */
158 debug_gimple_seq (gimple_seq seq
)
160 print_gimple_seq (stderr
, seq
, 0, TDF_VOPS
|TDF_MEMSYMS
);
164 /* A simple helper to pretty-print some of the gimple tuples in the printf
165 style. The format modifiers are preceded by '%' and are:
166 'G' - outputs a string corresponding to the code of the given gimple,
167 'S' - outputs a gimple_seq with indent of spc + 2,
168 'T' - outputs the tree t,
169 'd' - outputs an int as a decimal,
170 's' - outputs a string,
171 'n' - outputs a newline,
172 'x' - outputs an int as hexadecimal,
173 '+' - increases indent by 2 then outputs a newline,
174 '-' - decreases indent by 2 then outputs a newline. */
177 dump_gimple_fmt (pretty_printer
*buffer
, int spc
, int flags
,
178 const char *fmt
, ...)
184 va_start (args
, fmt
);
185 for (c
= fmt
; *c
; c
++)
195 g
= va_arg (args
, gimple
);
196 tmp
= gimple_code_name
[gimple_code (g
)];
197 pp_string (buffer
, tmp
);
201 seq
= va_arg (args
, gimple_seq
);
203 dump_gimple_seq (buffer
, seq
, spc
+ 2, flags
);
204 newline_and_indent (buffer
, spc
);
208 t
= va_arg (args
, tree
);
210 pp_string (buffer
, "NULL");
212 dump_generic_node (buffer
, t
, spc
, flags
, false);
216 pp_decimal_int (buffer
, va_arg (args
, int));
220 pp_string (buffer
, va_arg (args
, char *));
224 newline_and_indent (buffer
, spc
);
228 pp_scalar (buffer
, "%x", va_arg (args
, int));
233 newline_and_indent (buffer
, spc
);
238 newline_and_indent (buffer
, spc
);
246 pp_character (buffer
, *c
);
252 /* Helper for dump_gimple_assign. Print the unary RHS of the
253 assignment GS. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. */
256 dump_unary_rhs (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
258 enum tree_code rhs_code
= gimple_assign_rhs_code (gs
);
259 tree lhs
= gimple_assign_lhs (gs
);
260 tree rhs
= gimple_assign_rhs1 (gs
);
264 case VIEW_CONVERT_EXPR
:
266 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
269 case FIXED_CONVERT_EXPR
:
270 case ADDR_SPACE_CONVERT_EXPR
:
274 pp_left_paren (buffer
);
275 dump_generic_node (buffer
, TREE_TYPE (lhs
), spc
, flags
, false);
276 pp_string (buffer
, ") ");
277 if (op_prio (rhs
) < op_code_prio (rhs_code
))
279 pp_left_paren (buffer
);
280 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
281 pp_right_paren (buffer
);
284 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
288 pp_string (buffer
, "((");
289 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
290 pp_string (buffer
, "))");
294 pp_string (buffer
, "ABS_EXPR <");
295 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
300 if (TREE_CODE_CLASS (rhs_code
) == tcc_declaration
301 || TREE_CODE_CLASS (rhs_code
) == tcc_constant
302 || TREE_CODE_CLASS (rhs_code
) == tcc_reference
303 || rhs_code
== SSA_NAME
304 || rhs_code
== ADDR_EXPR
305 || rhs_code
== CONSTRUCTOR
)
307 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
310 else if (rhs_code
== BIT_NOT_EXPR
)
311 pp_complement (buffer
);
312 else if (rhs_code
== TRUTH_NOT_EXPR
)
313 pp_exclamation (buffer
);
314 else if (rhs_code
== NEGATE_EXPR
)
318 pp_left_bracket (buffer
);
319 pp_string (buffer
, get_tree_code_name (rhs_code
));
320 pp_string (buffer
, "] ");
323 if (op_prio (rhs
) < op_code_prio (rhs_code
))
325 pp_left_paren (buffer
);
326 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
327 pp_right_paren (buffer
);
330 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
336 /* Helper for dump_gimple_assign. Print the binary RHS of the
337 assignment GS. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. */
340 dump_binary_rhs (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
343 enum tree_code code
= gimple_assign_rhs_code (gs
);
349 case VEC_WIDEN_MULT_HI_EXPR
:
350 case VEC_WIDEN_MULT_LO_EXPR
:
351 case VEC_WIDEN_MULT_EVEN_EXPR
:
352 case VEC_WIDEN_MULT_ODD_EXPR
:
353 case VEC_PACK_TRUNC_EXPR
:
354 case VEC_PACK_SAT_EXPR
:
355 case VEC_PACK_FIX_TRUNC_EXPR
:
356 case VEC_WIDEN_LSHIFT_HI_EXPR
:
357 case VEC_WIDEN_LSHIFT_LO_EXPR
:
358 for (p
= get_tree_code_name (code
); *p
; p
++)
359 pp_character (buffer
, TOUPPER (*p
));
360 pp_string (buffer
, " <");
361 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
362 pp_string (buffer
, ", ");
363 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
368 if (op_prio (gimple_assign_rhs1 (gs
)) <= op_code_prio (code
))
370 pp_left_paren (buffer
);
371 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
,
373 pp_right_paren (buffer
);
376 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
378 pp_string (buffer
, op_symbol_code (gimple_assign_rhs_code (gs
)));
380 if (op_prio (gimple_assign_rhs2 (gs
)) <= op_code_prio (code
))
382 pp_left_paren (buffer
);
383 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
,
385 pp_right_paren (buffer
);
388 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
392 /* Helper for dump_gimple_assign. Print the ternary RHS of the
393 assignment GS. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. */
396 dump_ternary_rhs (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
399 enum tree_code code
= gimple_assign_rhs_code (gs
);
402 case WIDEN_MULT_PLUS_EXPR
:
403 case WIDEN_MULT_MINUS_EXPR
:
404 for (p
= get_tree_code_name (code
); *p
; p
++)
405 pp_character (buffer
, TOUPPER (*p
));
406 pp_string (buffer
, " <");
407 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
408 pp_string (buffer
, ", ");
409 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
410 pp_string (buffer
, ", ");
411 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
416 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
417 pp_string (buffer
, " * ");
418 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
419 pp_string (buffer
, " + ");
420 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
424 pp_string (buffer
, "DOT_PROD_EXPR <");
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 pp_string (buffer
, "VEC_PERM_EXPR <");
435 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
436 pp_string (buffer
, ", ");
437 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
438 pp_string (buffer
, ", ");
439 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
443 case REALIGN_LOAD_EXPR
:
444 pp_string (buffer
, "REALIGN_LOAD <");
445 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
446 pp_string (buffer
, ", ");
447 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
448 pp_string (buffer
, ", ");
449 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
454 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
455 pp_string (buffer
, " ? ");
456 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
457 pp_string (buffer
, " : ");
458 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
462 pp_string (buffer
, "VEC_COND_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);
477 /* Dump the gimple assignment GS. BUFFER, SPC and FLAGS are as in
481 dump_gimple_assign (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
488 switch (gimple_num_ops (gs
))
491 arg3
= gimple_assign_rhs3 (gs
);
493 arg2
= gimple_assign_rhs2 (gs
);
495 arg1
= gimple_assign_rhs1 (gs
);
501 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%s, %T, %T, %T, %T>", gs
,
502 get_tree_code_name (gimple_assign_rhs_code (gs
)),
503 gimple_assign_lhs (gs
), arg1
, arg2
, arg3
);
507 if (!(flags
& TDF_RHS_ONLY
))
509 dump_generic_node (buffer
, gimple_assign_lhs (gs
), spc
, flags
, false);
513 if (gimple_assign_nontemporal_move_p (gs
))
514 pp_string (buffer
, "{nt}");
516 if (gimple_has_volatile_ops (gs
))
517 pp_string (buffer
, "{v}");
522 if (gimple_num_ops (gs
) == 2)
523 dump_unary_rhs (buffer
, gs
, spc
, flags
);
524 else if (gimple_num_ops (gs
) == 3)
525 dump_binary_rhs (buffer
, gs
, spc
, flags
);
526 else if (gimple_num_ops (gs
) == 4)
527 dump_ternary_rhs (buffer
, gs
, spc
, flags
);
530 if (!(flags
& TDF_RHS_ONLY
))
531 pp_semicolon (buffer
);
536 /* Dump the return statement GS. BUFFER, SPC and FLAGS are as in
540 dump_gimple_return (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
544 t
= gimple_return_retval (gs
);
545 t2
= gimple_return_retbnd (gs
);
547 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T %T>", gs
, t
, t2
);
550 pp_string (buffer
, "return");
554 dump_generic_node (buffer
, t
, spc
, flags
, false);
558 pp_string (buffer
, ", ");
559 dump_generic_node (buffer
, t2
, spc
, flags
, false);
561 pp_semicolon (buffer
);
566 /* Dump the call arguments for a gimple call. BUFFER, FLAGS are as in
570 dump_gimple_call_args (pretty_printer
*buffer
, gimple gs
, int flags
)
574 for (i
= 0; i
< gimple_call_num_args (gs
); i
++)
576 dump_generic_node (buffer
, gimple_call_arg (gs
, i
), 0, flags
, false);
577 if (i
< gimple_call_num_args (gs
) - 1)
578 pp_string (buffer
, ", ");
581 if (gimple_call_va_arg_pack_p (gs
))
583 if (gimple_call_num_args (gs
) > 0)
589 pp_string (buffer
, "__builtin_va_arg_pack ()");
593 /* Dump the points-to solution *PT to BUFFER. */
596 pp_points_to_solution (pretty_printer
*buffer
, struct pt_solution
*pt
)
600 pp_string (buffer
, "anything ");
604 pp_string (buffer
, "nonlocal ");
606 pp_string (buffer
, "escaped ");
608 pp_string (buffer
, "unit-escaped ");
610 pp_string (buffer
, "null ");
612 && !bitmap_empty_p (pt
->vars
))
616 pp_string (buffer
, "{ ");
617 EXECUTE_IF_SET_IN_BITMAP (pt
->vars
, 0, i
, bi
)
619 pp_string (buffer
, "D.");
620 pp_decimal_int (buffer
, i
);
623 pp_right_brace (buffer
);
624 if (pt
->vars_contains_global
)
625 pp_string (buffer
, " (glob)");
629 /* Dump the call statement GS. BUFFER, SPC and FLAGS are as in
633 dump_gimple_call (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
635 tree lhs
= gimple_call_lhs (gs
);
636 tree fn
= gimple_call_fn (gs
);
638 if (flags
& TDF_ALIAS
)
640 struct pt_solution
*pt
;
641 pt
= gimple_call_use_set (gs
);
642 if (!pt_solution_empty_p (pt
))
644 pp_string (buffer
, "# USE = ");
645 pp_points_to_solution (buffer
, pt
);
646 newline_and_indent (buffer
, spc
);
648 pt
= gimple_call_clobber_set (gs
);
649 if (!pt_solution_empty_p (pt
))
651 pp_string (buffer
, "# CLB = ");
652 pp_points_to_solution (buffer
, pt
);
653 newline_and_indent (buffer
, spc
);
659 if (gimple_call_internal_p (gs
))
660 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%s, %T", gs
,
661 internal_fn_name (gimple_call_internal_fn (gs
)), lhs
);
663 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T", gs
, fn
, lhs
);
664 if (gimple_call_num_args (gs
) > 0)
666 pp_string (buffer
, ", ");
667 dump_gimple_call_args (buffer
, gs
, flags
);
673 if (lhs
&& !(flags
& TDF_RHS_ONLY
))
675 dump_generic_node (buffer
, lhs
, spc
, flags
, false);
676 pp_string (buffer
, " =");
678 if (gimple_has_volatile_ops (gs
))
679 pp_string (buffer
, "{v}");
683 if (gimple_call_internal_p (gs
))
684 pp_string (buffer
, internal_fn_name (gimple_call_internal_fn (gs
)));
686 print_call_name (buffer
, fn
, flags
);
687 pp_string (buffer
, " (");
688 dump_gimple_call_args (buffer
, gs
, flags
);
689 pp_right_paren (buffer
);
690 if (!(flags
& TDF_RHS_ONLY
))
691 pp_semicolon (buffer
);
694 if (gimple_call_chain (gs
))
696 pp_string (buffer
, " [static-chain: ");
697 dump_generic_node (buffer
, gimple_call_chain (gs
), spc
, flags
, false);
698 pp_right_bracket (buffer
);
701 if (gimple_call_return_slot_opt_p (gs
))
702 pp_string (buffer
, " [return slot optimization]");
703 if (gimple_call_tail_p (gs
))
704 pp_string (buffer
, " [tail call]");
709 /* Dump the arguments of _ITM_beginTransaction sanely. */
710 if (TREE_CODE (fn
) == ADDR_EXPR
)
711 fn
= TREE_OPERAND (fn
, 0);
712 if (TREE_CODE (fn
) == FUNCTION_DECL
&& decl_is_tm_clone (fn
))
713 pp_string (buffer
, " [tm-clone]");
714 if (TREE_CODE (fn
) == FUNCTION_DECL
715 && DECL_BUILT_IN_CLASS (fn
) == BUILT_IN_NORMAL
716 && DECL_FUNCTION_CODE (fn
) == BUILT_IN_TM_START
717 && gimple_call_num_args (gs
) > 0)
719 tree t
= gimple_call_arg (gs
, 0);
720 unsigned HOST_WIDE_INT props
;
721 gcc_assert (TREE_CODE (t
) == INTEGER_CST
);
723 pp_string (buffer
, " [ ");
725 /* Get the transaction code properties. */
726 props
= TREE_INT_CST_LOW (t
);
728 if (props
& PR_INSTRUMENTEDCODE
)
729 pp_string (buffer
, "instrumentedCode ");
730 if (props
& PR_UNINSTRUMENTEDCODE
)
731 pp_string (buffer
, "uninstrumentedCode ");
732 if (props
& PR_HASNOXMMUPDATE
)
733 pp_string (buffer
, "hasNoXMMUpdate ");
734 if (props
& PR_HASNOABORT
)
735 pp_string (buffer
, "hasNoAbort ");
736 if (props
& PR_HASNOIRREVOCABLE
)
737 pp_string (buffer
, "hasNoIrrevocable ");
738 if (props
& PR_DOESGOIRREVOCABLE
)
739 pp_string (buffer
, "doesGoIrrevocable ");
740 if (props
& PR_HASNOSIMPLEREADS
)
741 pp_string (buffer
, "hasNoSimpleReads ");
742 if (props
& PR_AWBARRIERSOMITTED
)
743 pp_string (buffer
, "awBarriersOmitted ");
744 if (props
& PR_RARBARRIERSOMITTED
)
745 pp_string (buffer
, "RaRBarriersOmitted ");
746 if (props
& PR_UNDOLOGCODE
)
747 pp_string (buffer
, "undoLogCode ");
748 if (props
& PR_PREFERUNINSTRUMENTED
)
749 pp_string (buffer
, "preferUninstrumented ");
750 if (props
& PR_EXCEPTIONBLOCK
)
751 pp_string (buffer
, "exceptionBlock ");
752 if (props
& PR_HASELSE
)
753 pp_string (buffer
, "hasElse ");
754 if (props
& PR_READONLY
)
755 pp_string (buffer
, "readOnly ");
757 pp_right_bracket (buffer
);
762 /* Dump the switch statement GS. BUFFER, SPC and FLAGS are as in
766 dump_gimple_switch (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
770 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
772 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, ", gs
,
773 gimple_switch_index (gs
));
776 pp_string (buffer
, "switch (");
777 dump_generic_node (buffer
, gimple_switch_index (gs
), spc
, flags
, true);
778 pp_string (buffer
, ") <");
781 for (i
= 0; i
< gimple_switch_num_labels (gs
); i
++)
783 tree case_label
= gimple_switch_label (gs
, i
);
784 gcc_checking_assert (case_label
!= NULL_TREE
);
785 dump_generic_node (buffer
, case_label
, spc
, flags
, false);
787 dump_generic_node (buffer
, CASE_LABEL (case_label
), spc
, flags
, false);
788 if (i
< gimple_switch_num_labels (gs
) - 1)
789 pp_string (buffer
, ", ");
795 /* Dump the gimple conditional GS. BUFFER, SPC and FLAGS are as in
799 dump_gimple_cond (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
802 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%s, %T, %T, %T, %T>", gs
,
803 get_tree_code_name (gimple_cond_code (gs
)),
804 gimple_cond_lhs (gs
), gimple_cond_rhs (gs
),
805 gimple_cond_true_label (gs
), gimple_cond_false_label (gs
));
808 if (!(flags
& TDF_RHS_ONLY
))
809 pp_string (buffer
, "if (");
810 dump_generic_node (buffer
, gimple_cond_lhs (gs
), spc
, flags
, false);
812 pp_string (buffer
, op_symbol_code (gimple_cond_code (gs
)));
814 dump_generic_node (buffer
, gimple_cond_rhs (gs
), spc
, flags
, false);
815 if (!(flags
& TDF_RHS_ONLY
))
817 pp_right_paren (buffer
);
819 if (gimple_cond_true_label (gs
))
821 pp_string (buffer
, " goto ");
822 dump_generic_node (buffer
, gimple_cond_true_label (gs
),
824 pp_semicolon (buffer
);
826 if (gimple_cond_false_label (gs
))
828 pp_string (buffer
, " else goto ");
829 dump_generic_node (buffer
, gimple_cond_false_label (gs
),
831 pp_semicolon (buffer
);
838 /* Dump a GIMPLE_LABEL tuple on the pretty_printer BUFFER, SPC
839 spaces of indent. FLAGS specifies details to show in the dump (see
840 TDF_* in dumpfils.h). */
843 dump_gimple_label (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
845 tree label
= gimple_label_label (gs
);
847 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
, label
);
850 dump_generic_node (buffer
, label
, spc
, flags
, false);
853 if (DECL_NONLOCAL (label
))
854 pp_string (buffer
, " [non-local]");
855 if ((flags
& TDF_EH
) && EH_LANDING_PAD_NR (label
))
856 pp_printf (buffer
, " [LP %d]", EH_LANDING_PAD_NR (label
));
859 /* Dump a GIMPLE_GOTO tuple on the pretty_printer BUFFER, SPC
860 spaces of indent. FLAGS specifies details to show in the dump (see
861 TDF_* in dumpfile.h). */
864 dump_gimple_goto (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
866 tree label
= gimple_goto_dest (gs
);
868 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
, label
);
870 dump_gimple_fmt (buffer
, spc
, flags
, "goto %T;", label
);
874 /* Dump a GIMPLE_BIND tuple on the pretty_printer BUFFER, SPC
875 spaces of indent. FLAGS specifies details to show in the dump (see
876 TDF_* in dumpfile.h). */
879 dump_gimple_bind (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
882 dump_gimple_fmt (buffer
, spc
, flags
, "%G <", gs
);
884 pp_left_brace (buffer
);
885 if (!(flags
& TDF_SLIM
))
889 for (var
= gimple_bind_vars (gs
); var
; var
= DECL_CHAIN (var
))
891 newline_and_indent (buffer
, 2);
892 print_declaration (buffer
, var
, spc
, flags
);
894 if (gimple_bind_vars (gs
))
898 dump_gimple_seq (buffer
, gimple_bind_body (gs
), spc
+ 2, flags
);
899 newline_and_indent (buffer
, spc
);
903 pp_right_brace (buffer
);
907 /* Dump a GIMPLE_TRY tuple on the pretty_printer BUFFER, SPC spaces of
908 indent. FLAGS specifies details to show in the dump (see TDF_* in
912 dump_gimple_try (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
917 if (gimple_try_kind (gs
) == GIMPLE_TRY_CATCH
)
918 type
= "GIMPLE_TRY_CATCH";
919 else if (gimple_try_kind (gs
) == GIMPLE_TRY_FINALLY
)
920 type
= "GIMPLE_TRY_FINALLY";
922 type
= "UNKNOWN GIMPLE_TRY";
923 dump_gimple_fmt (buffer
, spc
, flags
,
924 "%G <%s,%+EVAL <%S>%nCLEANUP <%S>%->", gs
, type
,
925 gimple_try_eval (gs
), gimple_try_cleanup (gs
));
929 pp_string (buffer
, "try");
930 newline_and_indent (buffer
, spc
+ 2);
931 pp_left_brace (buffer
);
934 dump_gimple_seq (buffer
, gimple_try_eval (gs
), spc
+ 4, flags
);
935 newline_and_indent (buffer
, spc
+ 2);
936 pp_right_brace (buffer
);
938 if (gimple_try_kind (gs
) == GIMPLE_TRY_CATCH
)
940 newline_and_indent (buffer
, spc
);
941 pp_string (buffer
, "catch");
942 newline_and_indent (buffer
, spc
+ 2);
943 pp_left_brace (buffer
);
945 else if (gimple_try_kind (gs
) == GIMPLE_TRY_FINALLY
)
947 newline_and_indent (buffer
, spc
);
948 pp_string (buffer
, "finally");
949 newline_and_indent (buffer
, spc
+ 2);
950 pp_left_brace (buffer
);
953 pp_string (buffer
, " <UNKNOWN GIMPLE_TRY> {");
956 dump_gimple_seq (buffer
, gimple_try_cleanup (gs
), spc
+ 4, flags
);
957 newline_and_indent (buffer
, spc
+ 2);
958 pp_right_brace (buffer
);
963 /* Dump a GIMPLE_CATCH tuple on the pretty_printer BUFFER, SPC spaces of
964 indent. FLAGS specifies details to show in the dump (see TDF_* in
968 dump_gimple_catch (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
971 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %+CATCH <%S>%->", gs
,
972 gimple_catch_types (gs
), gimple_catch_handler (gs
));
974 dump_gimple_fmt (buffer
, spc
, flags
, "catch (%T)%+{%S}",
975 gimple_catch_types (gs
), gimple_catch_handler (gs
));
979 /* Dump a GIMPLE_EH_FILTER tuple on the pretty_printer BUFFER, SPC spaces of
980 indent. FLAGS specifies details to show in the dump (see TDF_* in
984 dump_gimple_eh_filter (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
987 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %+FAILURE <%S>%->", gs
,
988 gimple_eh_filter_types (gs
),
989 gimple_eh_filter_failure (gs
));
991 dump_gimple_fmt (buffer
, spc
, flags
, "<<<eh_filter (%T)>>>%+{%+%S%-}",
992 gimple_eh_filter_types (gs
),
993 gimple_eh_filter_failure (gs
));
997 /* Dump a GIMPLE_EH_MUST_NOT_THROW tuple. */
1000 dump_gimple_eh_must_not_throw (pretty_printer
*buffer
, gimple gs
,
1003 if (flags
& TDF_RAW
)
1004 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
,
1005 gimple_eh_must_not_throw_fndecl (gs
));
1007 dump_gimple_fmt (buffer
, spc
, flags
, "<<<eh_must_not_throw (%T)>>>",
1008 gimple_eh_must_not_throw_fndecl (gs
));
1012 /* Dump a GIMPLE_EH_ELSE tuple on the pretty_printer BUFFER, SPC spaces of
1013 indent. FLAGS specifies details to show in the dump (see TDF_* in
1017 dump_gimple_eh_else (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1019 if (flags
& TDF_RAW
)
1020 dump_gimple_fmt (buffer
, spc
, flags
,
1021 "%G <%+N_BODY <%S>%nE_BODY <%S>%->", gs
,
1022 gimple_eh_else_n_body (gs
), gimple_eh_else_e_body (gs
));
1024 dump_gimple_fmt (buffer
, spc
, flags
,
1025 "<<<if_normal_exit>>>%+{%S}%-<<<else_eh_exit>>>%+{%S}",
1026 gimple_eh_else_n_body (gs
), gimple_eh_else_e_body (gs
));
1030 /* Dump a GIMPLE_RESX tuple on the pretty_printer BUFFER, SPC spaces of
1031 indent. FLAGS specifies details to show in the dump (see TDF_* in
1035 dump_gimple_resx (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1037 if (flags
& TDF_RAW
)
1038 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%d>", gs
,
1039 gimple_resx_region (gs
));
1041 dump_gimple_fmt (buffer
, spc
, flags
, "resx %d", gimple_resx_region (gs
));
1044 /* Dump a GIMPLE_EH_DISPATCH tuple on the pretty_printer BUFFER. */
1047 dump_gimple_eh_dispatch (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1049 if (flags
& TDF_RAW
)
1050 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%d>", gs
,
1051 gimple_eh_dispatch_region (gs
));
1053 dump_gimple_fmt (buffer
, spc
, flags
, "eh_dispatch %d",
1054 gimple_eh_dispatch_region (gs
));
1057 /* Dump a GIMPLE_DEBUG tuple on the pretty_printer BUFFER, SPC spaces
1058 of indent. FLAGS specifies details to show in the dump (see TDF_*
1062 dump_gimple_debug (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1064 switch (gs
->gsbase
.subcode
)
1066 case GIMPLE_DEBUG_BIND
:
1067 if (flags
& TDF_RAW
)
1068 dump_gimple_fmt (buffer
, spc
, flags
, "%G BIND <%T, %T>", gs
,
1069 gimple_debug_bind_get_var (gs
),
1070 gimple_debug_bind_get_value (gs
));
1072 dump_gimple_fmt (buffer
, spc
, flags
, "# DEBUG %T => %T",
1073 gimple_debug_bind_get_var (gs
),
1074 gimple_debug_bind_get_value (gs
));
1077 case GIMPLE_DEBUG_SOURCE_BIND
:
1078 if (flags
& TDF_RAW
)
1079 dump_gimple_fmt (buffer
, spc
, flags
, "%G SRCBIND <%T, %T>", gs
,
1080 gimple_debug_source_bind_get_var (gs
),
1081 gimple_debug_source_bind_get_value (gs
));
1083 dump_gimple_fmt (buffer
, spc
, flags
, "# DEBUG %T s=> %T",
1084 gimple_debug_source_bind_get_var (gs
),
1085 gimple_debug_source_bind_get_value (gs
));
1093 /* Dump a GIMPLE_OMP_FOR tuple on the pretty_printer BUFFER. */
1095 dump_gimple_omp_for (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1099 if (flags
& TDF_RAW
)
1102 switch (gimple_omp_for_kind (gs
))
1104 case GF_OMP_FOR_KIND_FOR
:
1107 case GF_OMP_FOR_KIND_SIMD
:
1110 case GF_OMP_FOR_KIND_DISTRIBUTE
:
1111 kind
= " distribute";
1116 dump_gimple_fmt (buffer
, spc
, flags
, "%G%s <%+BODY <%S>%nCLAUSES <", gs
,
1117 kind
, gimple_omp_body (gs
));
1118 dump_omp_clauses (buffer
, gimple_omp_for_clauses (gs
), spc
, flags
);
1119 dump_gimple_fmt (buffer
, spc
, flags
, " >,");
1120 for (i
= 0; i
< gimple_omp_for_collapse (gs
); i
++)
1121 dump_gimple_fmt (buffer
, spc
, flags
,
1122 "%+%T, %T, %T, %s, %T,%n",
1123 gimple_omp_for_index (gs
, i
),
1124 gimple_omp_for_initial (gs
, i
),
1125 gimple_omp_for_final (gs
, i
),
1126 get_tree_code_name (gimple_omp_for_cond (gs
, i
)),
1127 gimple_omp_for_incr (gs
, i
));
1128 dump_gimple_fmt (buffer
, spc
, flags
, "PRE_BODY <%S>%->",
1129 gimple_omp_for_pre_body (gs
));
1133 switch (gimple_omp_for_kind (gs
))
1135 case GF_OMP_FOR_KIND_FOR
:
1136 pp_string (buffer
, "#pragma omp for");
1138 case GF_OMP_FOR_KIND_SIMD
:
1139 pp_string (buffer
, "#pragma omp simd");
1141 case GF_OMP_FOR_KIND_DISTRIBUTE
:
1142 pp_string (buffer
, "#pragma omp distribute");
1147 dump_omp_clauses (buffer
, gimple_omp_for_clauses (gs
), spc
, flags
);
1148 for (i
= 0; i
< gimple_omp_for_collapse (gs
); i
++)
1152 newline_and_indent (buffer
, spc
);
1153 pp_string (buffer
, "for (");
1154 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
1156 pp_string (buffer
, " = ");
1157 dump_generic_node (buffer
, gimple_omp_for_initial (gs
, i
), spc
,
1159 pp_string (buffer
, "; ");
1161 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
1164 switch (gimple_omp_for_cond (gs
, i
))
1170 pp_greater (buffer
);
1173 pp_less_equal (buffer
);
1176 pp_greater_equal (buffer
);
1182 dump_generic_node (buffer
, gimple_omp_for_final (gs
, i
), spc
,
1184 pp_string (buffer
, "; ");
1186 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
1188 pp_string (buffer
, " = ");
1189 dump_generic_node (buffer
, gimple_omp_for_incr (gs
, i
), spc
,
1191 pp_right_paren (buffer
);
1194 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1196 newline_and_indent (buffer
, spc
+ 2);
1197 pp_left_brace (buffer
);
1198 pp_newline (buffer
);
1199 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1200 newline_and_indent (buffer
, spc
+ 2);
1201 pp_right_brace (buffer
);
1206 /* Dump a GIMPLE_OMP_CONTINUE tuple on the pretty_printer BUFFER. */
1209 dump_gimple_omp_continue (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1211 if (flags
& TDF_RAW
)
1213 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T>", gs
,
1214 gimple_omp_continue_control_def (gs
),
1215 gimple_omp_continue_control_use (gs
));
1219 pp_string (buffer
, "#pragma omp continue (");
1220 dump_generic_node (buffer
, gimple_omp_continue_control_def (gs
),
1224 dump_generic_node (buffer
, gimple_omp_continue_control_use (gs
),
1226 pp_right_paren (buffer
);
1230 /* Dump a GIMPLE_OMP_SINGLE tuple on the pretty_printer BUFFER. */
1233 dump_gimple_omp_single (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1235 if (flags
& TDF_RAW
)
1237 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1238 gimple_omp_body (gs
));
1239 dump_omp_clauses (buffer
, gimple_omp_single_clauses (gs
), spc
, flags
);
1240 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1244 pp_string (buffer
, "#pragma omp single");
1245 dump_omp_clauses (buffer
, gimple_omp_single_clauses (gs
), spc
, flags
);
1246 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1248 newline_and_indent (buffer
, spc
+ 2);
1249 pp_left_brace (buffer
);
1250 pp_newline (buffer
);
1251 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1252 newline_and_indent (buffer
, spc
+ 2);
1253 pp_right_brace (buffer
);
1258 /* Dump a GIMPLE_OMP_TARGET tuple on the pretty_printer BUFFER. */
1261 dump_gimple_omp_target (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1264 switch (gimple_omp_target_kind (gs
))
1266 case GF_OMP_TARGET_KIND_REGION
:
1269 case GF_OMP_TARGET_KIND_DATA
:
1272 case GF_OMP_TARGET_KIND_UPDATE
:
1278 if (flags
& TDF_RAW
)
1280 dump_gimple_fmt (buffer
, spc
, flags
, "%G%s <%+BODY <%S>%nCLAUSES <", gs
,
1281 kind
, gimple_omp_body (gs
));
1282 dump_omp_clauses (buffer
, gimple_omp_target_clauses (gs
), spc
, flags
);
1283 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1287 pp_string (buffer
, "#pragma omp target");
1288 pp_string (buffer
, kind
);
1289 dump_omp_clauses (buffer
, gimple_omp_target_clauses (gs
), spc
, flags
);
1290 if (gimple_omp_target_child_fn (gs
))
1292 pp_string (buffer
, " [child fn: ");
1293 dump_generic_node (buffer
, gimple_omp_target_child_fn (gs
),
1295 pp_right_bracket (buffer
);
1297 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1299 newline_and_indent (buffer
, spc
+ 2);
1300 pp_character (buffer
, '{');
1301 pp_newline (buffer
);
1302 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1303 newline_and_indent (buffer
, spc
+ 2);
1304 pp_character (buffer
, '}');
1309 /* Dump a GIMPLE_OMP_TEAMS tuple on the pretty_printer BUFFER. */
1312 dump_gimple_omp_teams (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1314 if (flags
& TDF_RAW
)
1316 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1317 gimple_omp_body (gs
));
1318 dump_omp_clauses (buffer
, gimple_omp_teams_clauses (gs
), spc
, flags
);
1319 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1323 pp_string (buffer
, "#pragma omp teams");
1324 dump_omp_clauses (buffer
, gimple_omp_teams_clauses (gs
), spc
, flags
);
1325 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1327 newline_and_indent (buffer
, spc
+ 2);
1328 pp_character (buffer
, '{');
1329 pp_newline (buffer
);
1330 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1331 newline_and_indent (buffer
, spc
+ 2);
1332 pp_character (buffer
, '}');
1337 /* Dump a GIMPLE_OMP_SECTIONS tuple on the pretty_printer BUFFER. */
1340 dump_gimple_omp_sections (pretty_printer
*buffer
, gimple gs
, int spc
,
1343 if (flags
& TDF_RAW
)
1345 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1346 gimple_omp_body (gs
));
1347 dump_omp_clauses (buffer
, gimple_omp_sections_clauses (gs
), spc
, flags
);
1348 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1352 pp_string (buffer
, "#pragma omp sections");
1353 if (gimple_omp_sections_control (gs
))
1355 pp_string (buffer
, " <");
1356 dump_generic_node (buffer
, gimple_omp_sections_control (gs
), spc
,
1358 pp_greater (buffer
);
1360 dump_omp_clauses (buffer
, gimple_omp_sections_clauses (gs
), spc
, flags
);
1361 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1363 newline_and_indent (buffer
, spc
+ 2);
1364 pp_left_brace (buffer
);
1365 pp_newline (buffer
);
1366 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1367 newline_and_indent (buffer
, spc
+ 2);
1368 pp_right_brace (buffer
);
1373 /* Dump a GIMPLE_OMP_{MASTER,TASKGROUP,ORDERED,SECTION} tuple on the
1374 pretty_printer BUFFER. */
1377 dump_gimple_omp_block (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1379 if (flags
& TDF_RAW
)
1380 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1381 gimple_omp_body (gs
));
1384 switch (gimple_code (gs
))
1386 case GIMPLE_OMP_MASTER
:
1387 pp_string (buffer
, "#pragma omp master");
1389 case GIMPLE_OMP_TASKGROUP
:
1390 pp_string (buffer
, "#pragma omp taskgroup");
1392 case GIMPLE_OMP_ORDERED
:
1393 pp_string (buffer
, "#pragma omp ordered");
1395 case GIMPLE_OMP_SECTION
:
1396 pp_string (buffer
, "#pragma omp section");
1401 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1403 newline_and_indent (buffer
, spc
+ 2);
1404 pp_left_brace (buffer
);
1405 pp_newline (buffer
);
1406 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1407 newline_and_indent (buffer
, spc
+ 2);
1408 pp_right_brace (buffer
);
1413 /* Dump a GIMPLE_OMP_CRITICAL tuple on the pretty_printer BUFFER. */
1416 dump_gimple_omp_critical (pretty_printer
*buffer
, gimple gs
, int spc
,
1419 if (flags
& TDF_RAW
)
1420 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1421 gimple_omp_body (gs
));
1424 pp_string (buffer
, "#pragma omp critical");
1425 if (gimple_omp_critical_name (gs
))
1427 pp_string (buffer
, " (");
1428 dump_generic_node (buffer
, gimple_omp_critical_name (gs
), spc
,
1430 pp_right_paren (buffer
);
1432 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1434 newline_and_indent (buffer
, spc
+ 2);
1435 pp_left_brace (buffer
);
1436 pp_newline (buffer
);
1437 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1438 newline_and_indent (buffer
, spc
+ 2);
1439 pp_right_brace (buffer
);
1444 /* Dump a GIMPLE_OMP_RETURN tuple on the pretty_printer BUFFER. */
1447 dump_gimple_omp_return (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1449 if (flags
& TDF_RAW
)
1451 dump_gimple_fmt (buffer
, spc
, flags
, "%G <nowait=%d", gs
,
1452 (int) gimple_omp_return_nowait_p (gs
));
1453 if (gimple_omp_return_lhs (gs
))
1454 dump_gimple_fmt (buffer
, spc
, flags
, ", lhs=%T>",
1455 gimple_omp_return_lhs (gs
));
1457 dump_gimple_fmt (buffer
, spc
, flags
, ">");
1461 pp_string (buffer
, "#pragma omp return");
1462 if (gimple_omp_return_nowait_p (gs
))
1463 pp_string (buffer
, "(nowait)");
1464 if (gimple_omp_return_lhs (gs
))
1466 pp_string (buffer
, " (set ");
1467 dump_generic_node (buffer
, gimple_omp_return_lhs (gs
),
1469 pp_character (buffer
, ')');
1474 /* Dump a GIMPLE_TRANSACTION tuple on the pretty_printer BUFFER. */
1477 dump_gimple_transaction (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1479 unsigned subcode
= gimple_transaction_subcode (gs
);
1481 if (flags
& TDF_RAW
)
1483 dump_gimple_fmt (buffer
, spc
, flags
,
1484 "%G [SUBCODE=%x,LABEL=%T] <%+BODY <%S> >",
1485 gs
, subcode
, gimple_transaction_label (gs
),
1486 gimple_transaction_body (gs
));
1490 if (subcode
& GTMA_IS_OUTER
)
1491 pp_string (buffer
, "__transaction_atomic [[outer]]");
1492 else if (subcode
& GTMA_IS_RELAXED
)
1493 pp_string (buffer
, "__transaction_relaxed");
1495 pp_string (buffer
, "__transaction_atomic");
1496 subcode
&= ~GTMA_DECLARATION_MASK
;
1498 if (subcode
|| gimple_transaction_label (gs
))
1500 pp_string (buffer
, " //");
1501 if (gimple_transaction_label (gs
))
1503 pp_string (buffer
, " LABEL=");
1504 dump_generic_node (buffer
, gimple_transaction_label (gs
),
1509 pp_string (buffer
, " SUBCODE=[ ");
1510 if (subcode
& GTMA_HAVE_ABORT
)
1512 pp_string (buffer
, "GTMA_HAVE_ABORT ");
1513 subcode
&= ~GTMA_HAVE_ABORT
;
1515 if (subcode
& GTMA_HAVE_LOAD
)
1517 pp_string (buffer
, "GTMA_HAVE_LOAD ");
1518 subcode
&= ~GTMA_HAVE_LOAD
;
1520 if (subcode
& GTMA_HAVE_STORE
)
1522 pp_string (buffer
, "GTMA_HAVE_STORE ");
1523 subcode
&= ~GTMA_HAVE_STORE
;
1525 if (subcode
& GTMA_MAY_ENTER_IRREVOCABLE
)
1527 pp_string (buffer
, "GTMA_MAY_ENTER_IRREVOCABLE ");
1528 subcode
&= ~GTMA_MAY_ENTER_IRREVOCABLE
;
1530 if (subcode
& GTMA_DOES_GO_IRREVOCABLE
)
1532 pp_string (buffer
, "GTMA_DOES_GO_IRREVOCABLE ");
1533 subcode
&= ~GTMA_DOES_GO_IRREVOCABLE
;
1535 if (subcode
& GTMA_HAS_NO_INSTRUMENTATION
)
1537 pp_string (buffer
, "GTMA_HAS_NO_INSTRUMENTATION ");
1538 subcode
&= ~GTMA_HAS_NO_INSTRUMENTATION
;
1541 pp_printf (buffer
, "0x%x ", subcode
);
1542 pp_right_bracket (buffer
);
1546 if (!gimple_seq_empty_p (gimple_transaction_body (gs
)))
1548 newline_and_indent (buffer
, spc
+ 2);
1549 pp_left_brace (buffer
);
1550 pp_newline (buffer
);
1551 dump_gimple_seq (buffer
, gimple_transaction_body (gs
),
1553 newline_and_indent (buffer
, spc
+ 2);
1554 pp_right_brace (buffer
);
1559 /* Dump a GIMPLE_ASM tuple on the pretty_printer BUFFER, SPC spaces of
1560 indent. FLAGS specifies details to show in the dump (see TDF_* in
1564 dump_gimple_asm (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1566 unsigned int i
, n
, f
, fields
;
1568 if (flags
& TDF_RAW
)
1570 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+STRING <%n%s%n>", gs
,
1571 gimple_asm_string (gs
));
1573 n
= gimple_asm_noutputs (gs
);
1576 newline_and_indent (buffer
, spc
+ 2);
1577 pp_string (buffer
, "OUTPUT: ");
1578 for (i
= 0; i
< n
; i
++)
1580 dump_generic_node (buffer
, gimple_asm_output_op (gs
, i
),
1583 pp_string (buffer
, ", ");
1587 n
= gimple_asm_ninputs (gs
);
1590 newline_and_indent (buffer
, spc
+ 2);
1591 pp_string (buffer
, "INPUT: ");
1592 for (i
= 0; i
< n
; i
++)
1594 dump_generic_node (buffer
, gimple_asm_input_op (gs
, i
),
1597 pp_string (buffer
, ", ");
1601 n
= gimple_asm_nclobbers (gs
);
1604 newline_and_indent (buffer
, spc
+ 2);
1605 pp_string (buffer
, "CLOBBER: ");
1606 for (i
= 0; i
< n
; i
++)
1608 dump_generic_node (buffer
, gimple_asm_clobber_op (gs
, i
),
1611 pp_string (buffer
, ", ");
1615 n
= gimple_asm_nlabels (gs
);
1618 newline_and_indent (buffer
, spc
+ 2);
1619 pp_string (buffer
, "LABEL: ");
1620 for (i
= 0; i
< n
; i
++)
1622 dump_generic_node (buffer
, gimple_asm_label_op (gs
, i
),
1625 pp_string (buffer
, ", ");
1629 newline_and_indent (buffer
, spc
);
1630 pp_greater (buffer
);
1634 pp_string (buffer
, "__asm__");
1635 if (gimple_asm_volatile_p (gs
))
1636 pp_string (buffer
, " __volatile__");
1637 if (gimple_asm_nlabels (gs
))
1638 pp_string (buffer
, " goto");
1639 pp_string (buffer
, "(\"");
1640 pp_string (buffer
, gimple_asm_string (gs
));
1641 pp_string (buffer
, "\"");
1643 if (gimple_asm_nlabels (gs
))
1645 else if (gimple_asm_nclobbers (gs
))
1647 else if (gimple_asm_ninputs (gs
))
1649 else if (gimple_asm_noutputs (gs
))
1654 for (f
= 0; f
< fields
; ++f
)
1656 pp_string (buffer
, " : ");
1661 n
= gimple_asm_noutputs (gs
);
1662 for (i
= 0; i
< n
; i
++)
1664 dump_generic_node (buffer
, gimple_asm_output_op (gs
, i
),
1667 pp_string (buffer
, ", ");
1672 n
= gimple_asm_ninputs (gs
);
1673 for (i
= 0; i
< n
; i
++)
1675 dump_generic_node (buffer
, gimple_asm_input_op (gs
, i
),
1678 pp_string (buffer
, ", ");
1683 n
= gimple_asm_nclobbers (gs
);
1684 for (i
= 0; i
< n
; i
++)
1686 dump_generic_node (buffer
, gimple_asm_clobber_op (gs
, i
),
1689 pp_string (buffer
, ", ");
1694 n
= gimple_asm_nlabels (gs
);
1695 for (i
= 0; i
< n
; i
++)
1697 dump_generic_node (buffer
, gimple_asm_label_op (gs
, i
),
1700 pp_string (buffer
, ", ");
1709 pp_string (buffer
, ");");
1713 /* Dump ptr_info and range_info for NODE on pretty_printer BUFFER with
1714 SPC spaces of indent. */
1717 dump_ssaname_info (pretty_printer
*buffer
, tree node
, int spc
)
1719 if (TREE_CODE (node
) != SSA_NAME
)
1722 if (POINTER_TYPE_P (TREE_TYPE (node
))
1723 && SSA_NAME_PTR_INFO (node
))
1725 unsigned int align
, misalign
;
1726 struct ptr_info_def
*pi
= SSA_NAME_PTR_INFO (node
);
1727 pp_string (buffer
, "# PT = ");
1728 pp_points_to_solution (buffer
, &pi
->pt
);
1729 newline_and_indent (buffer
, spc
);
1730 if (get_ptr_info_alignment (pi
, &align
, &misalign
))
1732 pp_printf (buffer
, "# ALIGN = %u, MISALIGN = %u", align
, misalign
);
1733 newline_and_indent (buffer
, spc
);
1737 if (!POINTER_TYPE_P (TREE_TYPE (node
))
1738 && SSA_NAME_RANGE_INFO (node
))
1740 double_int min
, max
, nonzero_bits
;
1741 value_range_type range_type
= get_range_info (node
, &min
, &max
);
1743 if (range_type
== VR_VARYING
)
1744 pp_printf (buffer
, "# RANGE VR_VARYING");
1745 else if (range_type
== VR_RANGE
|| range_type
== VR_ANTI_RANGE
)
1747 pp_printf (buffer
, "# RANGE ");
1748 pp_printf (buffer
, "%s[", range_type
== VR_RANGE
? "" : "~");
1749 pp_double_int (buffer
, min
, TYPE_UNSIGNED (TREE_TYPE (node
)));
1750 pp_printf (buffer
, ", ");
1751 pp_double_int (buffer
, max
, TYPE_UNSIGNED (TREE_TYPE (node
)));
1752 pp_printf (buffer
, "]");
1754 nonzero_bits
= get_nonzero_bits (node
);
1755 if (nonzero_bits
!= double_int_minus_one
1757 != double_int::mask (TYPE_PRECISION (TREE_TYPE (node
)))))
1759 pp_string (buffer
, " NONZERO ");
1760 sprintf (pp_buffer (buffer
)->digit_buffer
,
1761 HOST_WIDE_INT_PRINT_DOUBLE_HEX
,
1762 (unsigned HOST_WIDE_INT
) nonzero_bits
.high
,
1764 pp_string (buffer
, pp_buffer (buffer
)->digit_buffer
);
1766 newline_and_indent (buffer
, spc
);
1771 /* Dump a PHI node PHI. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1.
1772 The caller is responsible for calling pp_flush on BUFFER to finalize
1773 pretty printer. If COMMENT is true, print this after #. */
1776 dump_gimple_phi (pretty_printer
*buffer
, gimple phi
, int spc
, bool comment
,
1780 tree lhs
= gimple_phi_result (phi
);
1782 if (flags
& TDF_ALIAS
)
1783 dump_ssaname_info (buffer
, lhs
, spc
);
1786 pp_string (buffer
, "# ");
1788 if (flags
& TDF_RAW
)
1789 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, ", phi
,
1790 gimple_phi_result (phi
));
1793 dump_generic_node (buffer
, lhs
, spc
, flags
, false);
1794 pp_string (buffer
, " = PHI <");
1796 for (i
= 0; i
< gimple_phi_num_args (phi
); i
++)
1798 if ((flags
& TDF_LINENO
) && gimple_phi_arg_has_location (phi
, i
))
1800 expanded_location xloc
;
1802 xloc
= expand_location (gimple_phi_arg_location (phi
, i
));
1803 pp_left_bracket (buffer
);
1806 pp_string (buffer
, xloc
.file
);
1807 pp_string (buffer
, " : ");
1809 pp_decimal_int (buffer
, xloc
.line
);
1811 pp_decimal_int (buffer
, xloc
.column
);
1812 pp_string (buffer
, "] ");
1814 dump_generic_node (buffer
, gimple_phi_arg_def (phi
, i
), spc
, flags
,
1816 pp_left_paren (buffer
);
1817 pp_decimal_int (buffer
, gimple_phi_arg_edge (phi
, i
)->src
->index
);
1818 pp_right_paren (buffer
);
1819 if (i
< gimple_phi_num_args (phi
) - 1)
1820 pp_string (buffer
, ", ");
1822 pp_greater (buffer
);
1826 /* Dump a GIMPLE_OACC_PARALLEL tuple on the pretty_printer BUFFER, SPC spaces
1827 of indent. FLAGS specifies details to show in the dump (see TDF_* in
1831 dump_gimple_oacc_parallel (pretty_printer
*buffer
, gimple gs
, int spc
,
1834 if (flags
& TDF_RAW
)
1836 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1837 gimple_omp_body (gs
));
1838 dump_omp_clauses (buffer
, gimple_oacc_parallel_clauses (gs
), spc
, flags
);
1839 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T%n>",
1840 gimple_oacc_parallel_child_fn (gs
),
1841 gimple_oacc_parallel_data_arg (gs
));
1846 pp_string (buffer
, "#pragma acc parallel");
1847 dump_omp_clauses (buffer
, gimple_oacc_parallel_clauses (gs
), spc
, flags
);
1848 if (gimple_oacc_parallel_child_fn (gs
))
1850 pp_string (buffer
, " [child fn: ");
1851 dump_generic_node (buffer
, gimple_oacc_parallel_child_fn (gs
),
1853 pp_string (buffer
, " (");
1854 if (gimple_oacc_parallel_data_arg (gs
))
1855 dump_generic_node (buffer
, gimple_oacc_parallel_data_arg (gs
),
1858 pp_string (buffer
, "???");
1859 pp_string (buffer
, ")]");
1861 body
= gimple_omp_body (gs
);
1862 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
1864 newline_and_indent (buffer
, spc
+ 2);
1865 pp_left_brace (buffer
);
1866 pp_newline (buffer
);
1867 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
1868 newline_and_indent (buffer
, spc
+ 2);
1869 pp_right_brace (buffer
);
1873 pp_newline (buffer
);
1874 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
1880 /* Dump a GIMPLE_OMP_PARALLEL tuple on the pretty_printer BUFFER, SPC spaces
1881 of indent. FLAGS specifies details to show in the dump (see TDF_* in
1885 dump_gimple_omp_parallel (pretty_printer
*buffer
, gimple gs
, int spc
,
1888 if (flags
& TDF_RAW
)
1890 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1891 gimple_omp_body (gs
));
1892 dump_omp_clauses (buffer
, gimple_omp_parallel_clauses (gs
), spc
, flags
);
1893 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T%n>",
1894 gimple_omp_parallel_child_fn (gs
),
1895 gimple_omp_parallel_data_arg (gs
));
1900 pp_string (buffer
, "#pragma omp parallel");
1901 dump_omp_clauses (buffer
, gimple_omp_parallel_clauses (gs
), spc
, flags
);
1902 if (gimple_omp_parallel_child_fn (gs
))
1904 pp_string (buffer
, " [child fn: ");
1905 dump_generic_node (buffer
, gimple_omp_parallel_child_fn (gs
),
1907 pp_string (buffer
, " (");
1908 if (gimple_omp_parallel_data_arg (gs
))
1909 dump_generic_node (buffer
, gimple_omp_parallel_data_arg (gs
),
1912 pp_string (buffer
, "???");
1913 pp_string (buffer
, ")]");
1915 body
= gimple_omp_body (gs
);
1916 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
1918 newline_and_indent (buffer
, spc
+ 2);
1919 pp_left_brace (buffer
);
1920 pp_newline (buffer
);
1921 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
1922 newline_and_indent (buffer
, spc
+ 2);
1923 pp_right_brace (buffer
);
1927 pp_newline (buffer
);
1928 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
1934 /* Dump a GIMPLE_OMP_TASK tuple on the pretty_printer BUFFER, SPC spaces
1935 of indent. FLAGS specifies details to show in the dump (see TDF_* in
1939 dump_gimple_omp_task (pretty_printer
*buffer
, gimple gs
, int spc
,
1942 if (flags
& TDF_RAW
)
1944 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1945 gimple_omp_body (gs
));
1946 dump_omp_clauses (buffer
, gimple_omp_task_clauses (gs
), spc
, flags
);
1947 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T, %T, %T, %T%n>",
1948 gimple_omp_task_child_fn (gs
),
1949 gimple_omp_task_data_arg (gs
),
1950 gimple_omp_task_copy_fn (gs
),
1951 gimple_omp_task_arg_size (gs
),
1952 gimple_omp_task_arg_size (gs
));
1957 pp_string (buffer
, "#pragma omp task");
1958 dump_omp_clauses (buffer
, gimple_omp_task_clauses (gs
), spc
, flags
);
1959 if (gimple_omp_task_child_fn (gs
))
1961 pp_string (buffer
, " [child fn: ");
1962 dump_generic_node (buffer
, gimple_omp_task_child_fn (gs
),
1964 pp_string (buffer
, " (");
1965 if (gimple_omp_task_data_arg (gs
))
1966 dump_generic_node (buffer
, gimple_omp_task_data_arg (gs
),
1969 pp_string (buffer
, "???");
1970 pp_string (buffer
, ")]");
1972 body
= gimple_omp_body (gs
);
1973 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
1975 newline_and_indent (buffer
, spc
+ 2);
1976 pp_left_brace (buffer
);
1977 pp_newline (buffer
);
1978 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
1979 newline_and_indent (buffer
, spc
+ 2);
1980 pp_right_brace (buffer
);
1984 pp_newline (buffer
);
1985 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
1991 /* Dump a GIMPLE_OMP_ATOMIC_LOAD tuple on the pretty_printer BUFFER, SPC
1992 spaces of indent. FLAGS specifies details to show in the dump (see TDF_*
1996 dump_gimple_omp_atomic_load (pretty_printer
*buffer
, gimple gs
, int spc
,
1999 if (flags
& TDF_RAW
)
2001 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T>", gs
,
2002 gimple_omp_atomic_load_lhs (gs
),
2003 gimple_omp_atomic_load_rhs (gs
));
2007 pp_string (buffer
, "#pragma omp atomic_load");
2008 if (gimple_omp_atomic_seq_cst_p (gs
))
2009 pp_string (buffer
, " seq_cst");
2010 if (gimple_omp_atomic_need_value_p (gs
))
2011 pp_string (buffer
, " [needed]");
2012 newline_and_indent (buffer
, spc
+ 2);
2013 dump_generic_node (buffer
, gimple_omp_atomic_load_lhs (gs
),
2019 dump_generic_node (buffer
, gimple_omp_atomic_load_rhs (gs
),
2024 /* Dump a GIMPLE_OMP_ATOMIC_STORE tuple on the pretty_printer BUFFER, SPC
2025 spaces of indent. FLAGS specifies details to show in the dump (see TDF_*
2029 dump_gimple_omp_atomic_store (pretty_printer
*buffer
, gimple gs
, int spc
,
2032 if (flags
& TDF_RAW
)
2034 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
,
2035 gimple_omp_atomic_store_val (gs
));
2039 pp_string (buffer
, "#pragma omp atomic_store ");
2040 if (gimple_omp_atomic_seq_cst_p (gs
))
2041 pp_string (buffer
, "seq_cst ");
2042 if (gimple_omp_atomic_need_value_p (gs
))
2043 pp_string (buffer
, "[needed] ");
2044 pp_left_paren (buffer
);
2045 dump_generic_node (buffer
, gimple_omp_atomic_store_val (gs
),
2047 pp_right_paren (buffer
);
2052 /* Dump all the memory operands for statement GS. BUFFER, SPC and
2053 FLAGS are as in pp_gimple_stmt_1. */
2056 dump_gimple_mem_ops (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
2058 tree vdef
= gimple_vdef (gs
);
2059 tree vuse
= gimple_vuse (gs
);
2061 if (!ssa_operands_active (DECL_STRUCT_FUNCTION (current_function_decl
))
2062 || !gimple_references_memory_p (gs
))
2065 if (vdef
!= NULL_TREE
)
2067 pp_string (buffer
, "# ");
2068 dump_generic_node (buffer
, vdef
, spc
+ 2, flags
, false);
2069 pp_string (buffer
, " = VDEF <");
2070 dump_generic_node (buffer
, vuse
, spc
+ 2, flags
, false);
2071 pp_greater (buffer
);
2072 newline_and_indent (buffer
, spc
);
2074 else if (vuse
!= NULL_TREE
)
2076 pp_string (buffer
, "# VUSE <");
2077 dump_generic_node (buffer
, vuse
, spc
+ 2, flags
, false);
2078 pp_greater (buffer
);
2079 newline_and_indent (buffer
, spc
);
2084 /* Print the gimple statement GS on the pretty printer BUFFER, SPC
2085 spaces of indent. FLAGS specifies details to show in the dump (see
2086 TDF_* in dumpfile.h). The caller is responsible for calling
2087 pp_flush on BUFFER to finalize the pretty printer. */
2090 pp_gimple_stmt_1 (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
2095 if (flags
& TDF_STMTADDR
)
2096 pp_printf (buffer
, "<&%p> ", (void *) gs
);
2098 if ((flags
& TDF_LINENO
) && gimple_has_location (gs
))
2100 expanded_location xloc
= expand_location (gimple_location (gs
));
2101 pp_left_bracket (buffer
);
2104 pp_string (buffer
, xloc
.file
);
2105 pp_string (buffer
, " : ");
2107 pp_decimal_int (buffer
, xloc
.line
);
2109 pp_decimal_int (buffer
, xloc
.column
);
2110 pp_string (buffer
, "] ");
2115 int lp_nr
= lookup_stmt_eh_lp (gs
);
2117 pp_printf (buffer
, "[LP %d] ", lp_nr
);
2119 pp_printf (buffer
, "[MNT %d] ", -lp_nr
);
2122 if ((flags
& (TDF_VOPS
|TDF_MEMSYMS
))
2123 && gimple_has_mem_ops (gs
))
2124 dump_gimple_mem_ops (buffer
, gs
, spc
, flags
);
2126 if (gimple_has_lhs (gs
)
2127 && (flags
& TDF_ALIAS
))
2128 dump_ssaname_info (buffer
, gimple_get_lhs (gs
), spc
);
2130 switch (gimple_code (gs
))
2133 dump_gimple_asm (buffer
, gs
, spc
, flags
);
2137 dump_gimple_assign (buffer
, gs
, spc
, flags
);
2141 dump_gimple_bind (buffer
, gs
, spc
, flags
);
2145 dump_gimple_call (buffer
, gs
, spc
, flags
);
2149 dump_gimple_cond (buffer
, gs
, spc
, flags
);
2153 dump_gimple_label (buffer
, gs
, spc
, flags
);
2157 dump_gimple_goto (buffer
, gs
, spc
, flags
);
2161 pp_string (buffer
, "GIMPLE_NOP");
2165 dump_gimple_return (buffer
, gs
, spc
, flags
);
2169 dump_gimple_switch (buffer
, gs
, spc
, flags
);
2173 dump_gimple_try (buffer
, gs
, spc
, flags
);
2177 dump_gimple_phi (buffer
, gs
, spc
, false, flags
);
2180 case GIMPLE_OACC_PARALLEL
:
2181 dump_gimple_oacc_parallel (buffer
, gs
, spc
, flags
);
2184 case GIMPLE_OMP_PARALLEL
:
2185 dump_gimple_omp_parallel (buffer
, gs
, spc
, flags
);
2188 case GIMPLE_OMP_TASK
:
2189 dump_gimple_omp_task (buffer
, gs
, spc
, flags
);
2192 case GIMPLE_OMP_ATOMIC_LOAD
:
2193 dump_gimple_omp_atomic_load (buffer
, gs
, spc
, flags
);
2197 case GIMPLE_OMP_ATOMIC_STORE
:
2198 dump_gimple_omp_atomic_store (buffer
, gs
, spc
, flags
);
2201 case GIMPLE_OMP_FOR
:
2202 dump_gimple_omp_for (buffer
, gs
, spc
, flags
);
2205 case GIMPLE_OMP_CONTINUE
:
2206 dump_gimple_omp_continue (buffer
, gs
, spc
, flags
);
2209 case GIMPLE_OMP_SINGLE
:
2210 dump_gimple_omp_single (buffer
, gs
, spc
, flags
);
2213 case GIMPLE_OMP_TARGET
:
2214 dump_gimple_omp_target (buffer
, gs
, spc
, flags
);
2217 case GIMPLE_OMP_TEAMS
:
2218 dump_gimple_omp_teams (buffer
, gs
, spc
, flags
);
2221 case GIMPLE_OMP_RETURN
:
2222 dump_gimple_omp_return (buffer
, gs
, spc
, flags
);
2225 case GIMPLE_OMP_SECTIONS
:
2226 dump_gimple_omp_sections (buffer
, gs
, spc
, flags
);
2229 case GIMPLE_OMP_SECTIONS_SWITCH
:
2230 pp_string (buffer
, "GIMPLE_SECTIONS_SWITCH");
2233 case GIMPLE_OMP_MASTER
:
2234 case GIMPLE_OMP_TASKGROUP
:
2235 case GIMPLE_OMP_ORDERED
:
2236 case GIMPLE_OMP_SECTION
:
2237 dump_gimple_omp_block (buffer
, gs
, spc
, flags
);
2240 case GIMPLE_OMP_CRITICAL
:
2241 dump_gimple_omp_critical (buffer
, gs
, spc
, flags
);
2245 dump_gimple_catch (buffer
, gs
, spc
, flags
);
2248 case GIMPLE_EH_FILTER
:
2249 dump_gimple_eh_filter (buffer
, gs
, spc
, flags
);
2252 case GIMPLE_EH_MUST_NOT_THROW
:
2253 dump_gimple_eh_must_not_throw (buffer
, gs
, spc
, flags
);
2256 case GIMPLE_EH_ELSE
:
2257 dump_gimple_eh_else (buffer
, gs
, spc
, flags
);
2261 dump_gimple_resx (buffer
, gs
, spc
, flags
);
2264 case GIMPLE_EH_DISPATCH
:
2265 dump_gimple_eh_dispatch (buffer
, gs
, spc
, flags
);
2269 dump_gimple_debug (buffer
, gs
, spc
, flags
);
2272 case GIMPLE_PREDICT
:
2273 pp_string (buffer
, "// predicted ");
2274 if (gimple_predict_outcome (gs
))
2275 pp_string (buffer
, "likely by ");
2277 pp_string (buffer
, "unlikely by ");
2278 pp_string (buffer
, predictor_name (gimple_predict_predictor (gs
)));
2279 pp_string (buffer
, " predictor.");
2282 case GIMPLE_TRANSACTION
:
2283 dump_gimple_transaction (buffer
, gs
, spc
, flags
);
2292 /* Dumps header of basic block BB to OUTF indented by INDENT
2293 spaces and details described by flags. */
2296 dump_gimple_bb_header (FILE *outf
, basic_block bb
, int indent
, int flags
)
2298 if (flags
& TDF_BLOCKS
)
2300 if (flags
& TDF_LINENO
)
2302 gimple_stmt_iterator gsi
;
2304 if (flags
& TDF_COMMENT
)
2305 fputs (";; ", outf
);
2307 for (gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
); gsi_next (&gsi
))
2308 if (!is_gimple_debug (gsi_stmt (gsi
))
2309 && get_lineno (gsi_stmt (gsi
)) != UNKNOWN_LOCATION
)
2311 fprintf (outf
, "%*sstarting at line %d",
2312 indent
, "", get_lineno (gsi_stmt (gsi
)));
2315 if (bb
->discriminator
)
2316 fprintf (outf
, ", discriminator %i", bb
->discriminator
);
2322 gimple stmt
= first_stmt (bb
);
2323 if (!stmt
|| gimple_code (stmt
) != GIMPLE_LABEL
)
2324 fprintf (outf
, "%*s<bb %d>:\n", indent
, "", bb
->index
);
2329 /* Dumps end of basic block BB to buffer BUFFER indented by INDENT
2333 dump_gimple_bb_footer (FILE *outf ATTRIBUTE_UNUSED
,
2334 basic_block bb ATTRIBUTE_UNUSED
,
2335 int indent ATTRIBUTE_UNUSED
,
2336 int flags ATTRIBUTE_UNUSED
)
2338 /* There is currently no GIMPLE-specific basic block info to dump. */
2343 /* Dump PHI nodes of basic block BB to BUFFER with details described
2344 by FLAGS and indented by INDENT spaces. */
2347 dump_phi_nodes (pretty_printer
*buffer
, basic_block bb
, int indent
, int flags
)
2349 gimple_stmt_iterator i
;
2351 for (i
= gsi_start_phis (bb
); !gsi_end_p (i
); gsi_next (&i
))
2353 gimple phi
= gsi_stmt (i
);
2354 if (!virtual_operand_p (gimple_phi_result (phi
)) || (flags
& TDF_VOPS
))
2357 dump_gimple_phi (buffer
, phi
, indent
, true, flags
);
2358 pp_newline (buffer
);
2364 /* Dump jump to basic block BB that is represented implicitly in the cfg
2368 pp_cfg_jump (pretty_printer
*buffer
, basic_block bb
)
2372 stmt
= first_stmt (bb
);
2374 pp_string (buffer
, "goto <bb ");
2375 pp_decimal_int (buffer
, bb
->index
);
2376 pp_greater (buffer
);
2377 if (stmt
&& gimple_code (stmt
) == GIMPLE_LABEL
)
2379 pp_string (buffer
, " (");
2380 dump_generic_node (buffer
, gimple_label_label (stmt
), 0, 0, false);
2381 pp_right_paren (buffer
);
2382 pp_semicolon (buffer
);
2385 pp_semicolon (buffer
);
2389 /* Dump edges represented implicitly in basic block BB to BUFFER, indented
2390 by INDENT spaces, with details given by FLAGS. */
2393 dump_implicit_edges (pretty_printer
*buffer
, basic_block bb
, int indent
,
2399 stmt
= last_stmt (bb
);
2401 if (stmt
&& gimple_code (stmt
) == GIMPLE_COND
)
2403 edge true_edge
, false_edge
;
2405 /* When we are emitting the code or changing CFG, it is possible that
2406 the edges are not yet created. When we are using debug_bb in such
2407 a situation, we do not want it to crash. */
2408 if (EDGE_COUNT (bb
->succs
) != 2)
2410 extract_true_false_edges_from_block (bb
, &true_edge
, &false_edge
);
2412 INDENT (indent
+ 2);
2413 pp_cfg_jump (buffer
, true_edge
->dest
);
2414 newline_and_indent (buffer
, indent
);
2415 pp_string (buffer
, "else");
2416 newline_and_indent (buffer
, indent
+ 2);
2417 pp_cfg_jump (buffer
, false_edge
->dest
);
2418 pp_newline (buffer
);
2422 /* If there is a fallthru edge, we may need to add an artificial
2423 goto to the dump. */
2424 e
= find_fallthru_edge (bb
->succs
);
2426 if (e
&& e
->dest
!= bb
->next_bb
)
2430 if ((flags
& TDF_LINENO
)
2431 && e
->goto_locus
!= UNKNOWN_LOCATION
2434 expanded_location goto_xloc
;
2435 goto_xloc
= expand_location (e
->goto_locus
);
2436 pp_left_bracket (buffer
);
2439 pp_string (buffer
, goto_xloc
.file
);
2440 pp_string (buffer
, " : ");
2442 pp_decimal_int (buffer
, goto_xloc
.line
);
2443 pp_string (buffer
, " : ");
2444 pp_decimal_int (buffer
, goto_xloc
.column
);
2445 pp_string (buffer
, "] ");
2448 pp_cfg_jump (buffer
, e
->dest
);
2449 pp_newline (buffer
);
2454 /* Dumps basic block BB to buffer BUFFER with details described by FLAGS and
2455 indented by INDENT spaces. */
2458 gimple_dump_bb_buff (pretty_printer
*buffer
, basic_block bb
, int indent
,
2461 gimple_stmt_iterator gsi
;
2463 int label_indent
= indent
- 2;
2465 if (label_indent
< 0)
2468 dump_phi_nodes (buffer
, bb
, indent
, flags
);
2470 for (gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
); gsi_next (&gsi
))
2474 stmt
= gsi_stmt (gsi
);
2476 curr_indent
= gimple_code (stmt
) == GIMPLE_LABEL
? label_indent
: indent
;
2478 INDENT (curr_indent
);
2479 pp_gimple_stmt_1 (buffer
, stmt
, curr_indent
, flags
);
2480 pp_newline_and_flush (buffer
);
2481 gcc_checking_assert (DECL_STRUCT_FUNCTION (current_function_decl
));
2482 dump_histograms_for_stmt (DECL_STRUCT_FUNCTION (current_function_decl
),
2483 pp_buffer (buffer
)->stream
, stmt
);
2486 dump_implicit_edges (buffer
, bb
, indent
, flags
);
2491 /* Dumps basic block BB to FILE with details described by FLAGS and
2492 indented by INDENT spaces. */
2495 gimple_dump_bb (FILE *file
, basic_block bb
, int indent
, int flags
)
2497 dump_gimple_bb_header (file
, bb
, indent
, flags
);
2498 if (bb
->index
>= NUM_FIXED_BLOCKS
)
2500 pretty_printer buffer
;
2501 pp_needs_newline (&buffer
) = true;
2502 buffer
.buffer
->stream
= file
;
2503 gimple_dump_bb_buff (&buffer
, bb
, indent
, flags
);
2505 dump_gimple_bb_footer (file
, bb
, indent
, flags
);
2508 /* Dumps basic block BB to pretty-printer PP with default dump flags and
2509 no indentation, for use as a label of a DOT graph record-node.
2510 ??? Should just use gimple_dump_bb_buff here, except that value profiling
2511 histogram dumping doesn't know about pretty-printers. */
2514 gimple_dump_bb_for_graph (pretty_printer
*pp
, basic_block bb
)
2516 gimple_stmt_iterator gsi
;
2518 pp_printf (pp
, "<bb %d>:\n", bb
->index
);
2519 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
2521 for (gsi
= gsi_start_phis (bb
); !gsi_end_p (gsi
); gsi_next (&gsi
))
2523 gimple phi
= gsi_stmt (gsi
);
2524 if (!virtual_operand_p (gimple_phi_result (phi
))
2525 || (dump_flags
& TDF_VOPS
))
2528 pp_write_text_to_stream (pp
);
2529 pp_string (pp
, "# ");
2530 pp_gimple_stmt_1 (pp
, phi
, 0, dump_flags
);
2532 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
2536 for (gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
); gsi_next (&gsi
))
2538 gimple stmt
= gsi_stmt (gsi
);
2540 pp_write_text_to_stream (pp
);
2541 pp_gimple_stmt_1 (pp
, stmt
, 0, dump_flags
);
2543 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
2545 dump_implicit_edges (pp
, bb
, 0, dump_flags
);
2546 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);