1 /* Pretty formatting of GIMPLE statements and expressions.
2 Copyright (C) 2001-2018 Free Software Foundation, Inc.
3 Contributed by Aldy Hernandez <aldyh@redhat.com> and
4 Diego Novillo <dnovillo@google.com>
6 This file is part of GCC.
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 3, or (at your option) any later
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING3. If not see
20 <http://www.gnu.org/licenses/>. */
24 #include "coretypes.h"
29 #include "gimple-predict.h"
32 #include "gimple-pretty-print.h"
33 #include "internal-fn.h"
35 #include "gimple-iterator.h"
37 #include "dumpfile.h" /* for dump_flags */
38 #include "value-prof.h"
39 #include "trans-mem.h"
41 #include "stringpool.h"
45 #define INDENT(SPACE) \
46 do { int i; for (i = 0; i < SPACE; i++) pp_space (buffer); } while (0)
48 #define GIMPLE_NIY do_niy (buffer,gs)
50 /* Try to print on BUFFER a default message for the unrecognized
51 gimple statement GS. */
54 do_niy (pretty_printer
*buffer
, gimple
*gs
)
56 pp_printf (buffer
, "<<< Unknown GIMPLE statement: %s >>>\n",
57 gimple_code_name
[(int) gimple_code (gs
)]);
61 /* Emit a newline and SPC indentation spaces to BUFFER. */
64 newline_and_indent (pretty_printer
*buffer
, int spc
)
71 /* Print the GIMPLE statement GS on stderr. */
74 debug_gimple_stmt (gimple
*gs
)
76 print_gimple_stmt (stderr
, gs
, 0, TDF_VOPS
|TDF_MEMSYMS
);
80 /* Return formatted string of a VALUE probability
81 (biased by REG_BR_PROB_BASE). Returned string is allocated
82 by xstrdup_for_dump. */
85 dump_profile (profile_count
&count
)
88 if (!count
.initialized_p ())
91 buf
= xasprintf ("[count: %" PRId64
"]",
92 count
.to_gcov_type ());
93 else if (count
.initialized_p ())
94 buf
= xasprintf ("[local count: %" PRId64
"]",
95 count
.to_gcov_type ());
97 const char *ret
= xstrdup_for_dump (buf
);
103 /* Return formatted string of a VALUE probability
104 (biased by REG_BR_PROB_BASE). Returned string is allocated
105 by xstrdup_for_dump. */
108 dump_probability (profile_probability probability
)
110 float minimum
= 0.01f
;
113 if (probability
.initialized_p ())
115 fvalue
= probability
.to_reg_br_prob_base () * 100.0f
/ REG_BR_PROB_BASE
;
116 if (fvalue
< minimum
&& probability
.to_reg_br_prob_base ())
121 if (probability
.initialized_p ())
122 buf
= xasprintf ("[%.2f%%]", fvalue
);
124 buf
= xasprintf ("[INV]");
126 const char *ret
= xstrdup_for_dump (buf
);
132 /* Dump E probability to BUFFER. */
135 dump_edge_probability (pretty_printer
*buffer
, edge e
)
137 pp_scalar (buffer
, " %s", dump_probability (e
->probability
));
140 /* Print GIMPLE statement G to FILE using SPC indentation spaces and
141 FLAGS as in pp_gimple_stmt_1. */
144 print_gimple_stmt (FILE *file
, gimple
*g
, int spc
, dump_flags_t flags
)
146 pretty_printer buffer
;
147 pp_needs_newline (&buffer
) = true;
148 buffer
.buffer
->stream
= file
;
149 pp_gimple_stmt_1 (&buffer
, g
, spc
, flags
);
150 pp_newline_and_flush (&buffer
);
156 print_gimple_stmt (stderr
, &ref
, 0, TDF_NONE
);
165 fprintf (stderr
, "<nil>\n");
169 /* Print GIMPLE statement G to FILE using SPC indentation spaces and
170 FLAGS as in pp_gimple_stmt_1. Print only the right-hand side
174 print_gimple_expr (FILE *file
, gimple
*g
, int spc
, dump_flags_t flags
)
176 flags
|= TDF_RHS_ONLY
;
177 pretty_printer buffer
;
178 pp_needs_newline (&buffer
) = true;
179 buffer
.buffer
->stream
= file
;
180 pp_gimple_stmt_1 (&buffer
, g
, spc
, flags
);
185 /* Print the GIMPLE sequence SEQ on BUFFER using SPC indentation
186 spaces and FLAGS as in pp_gimple_stmt_1.
187 The caller is responsible for calling pp_flush on BUFFER to finalize
188 the pretty printer. */
191 dump_gimple_seq (pretty_printer
*buffer
, gimple_seq seq
, int spc
,
194 gimple_stmt_iterator i
;
196 for (i
= gsi_start (seq
); !gsi_end_p (i
); gsi_next (&i
))
198 gimple
*gs
= gsi_stmt (i
);
200 pp_gimple_stmt_1 (buffer
, gs
, spc
, flags
);
201 if (!gsi_one_before_end_p (i
))
207 /* Print GIMPLE sequence SEQ to FILE using SPC indentation spaces and
208 FLAGS as in pp_gimple_stmt_1. */
211 print_gimple_seq (FILE *file
, gimple_seq seq
, int spc
, dump_flags_t flags
)
213 pretty_printer buffer
;
214 pp_needs_newline (&buffer
) = true;
215 buffer
.buffer
->stream
= file
;
216 dump_gimple_seq (&buffer
, seq
, spc
, flags
);
217 pp_newline_and_flush (&buffer
);
221 /* Print the GIMPLE sequence SEQ on stderr. */
224 debug_gimple_seq (gimple_seq seq
)
226 print_gimple_seq (stderr
, seq
, 0, TDF_VOPS
|TDF_MEMSYMS
);
230 /* A simple helper to pretty-print some of the gimple tuples in the printf
231 style. The format modifiers are preceded by '%' and are:
232 'G' - outputs a string corresponding to the code of the given gimple,
233 'S' - outputs a gimple_seq with indent of spc + 2,
234 'T' - outputs the tree t,
235 'd' - outputs an int as a decimal,
236 's' - outputs a string,
237 'n' - outputs a newline,
238 'x' - outputs an int as hexadecimal,
239 '+' - increases indent by 2 then outputs a newline,
240 '-' - decreases indent by 2 then outputs a newline. */
243 dump_gimple_fmt (pretty_printer
*buffer
, int spc
, dump_flags_t flags
,
244 const char *fmt
, ...)
250 va_start (args
, fmt
);
251 for (c
= fmt
; *c
; c
++)
261 g
= va_arg (args
, gimple
*);
262 tmp
= gimple_code_name
[gimple_code (g
)];
263 pp_string (buffer
, tmp
);
267 seq
= va_arg (args
, gimple_seq
);
269 dump_gimple_seq (buffer
, seq
, spc
+ 2, flags
);
270 newline_and_indent (buffer
, spc
);
274 t
= va_arg (args
, tree
);
276 pp_string (buffer
, "NULL");
278 dump_generic_node (buffer
, t
, spc
, flags
, false);
282 pp_decimal_int (buffer
, va_arg (args
, int));
286 pp_string (buffer
, va_arg (args
, char *));
290 newline_and_indent (buffer
, spc
);
294 pp_scalar (buffer
, "%x", va_arg (args
, int));
299 newline_and_indent (buffer
, spc
);
304 newline_and_indent (buffer
, spc
);
312 pp_character (buffer
, *c
);
318 /* Helper for dump_gimple_assign. Print the unary RHS of the
319 assignment GS. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. */
322 dump_unary_rhs (pretty_printer
*buffer
, gassign
*gs
, int spc
,
325 enum tree_code rhs_code
= gimple_assign_rhs_code (gs
);
326 tree lhs
= gimple_assign_lhs (gs
);
327 tree rhs
= gimple_assign_rhs1 (gs
);
331 case VIEW_CONVERT_EXPR
:
333 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
336 case FIXED_CONVERT_EXPR
:
337 case ADDR_SPACE_CONVERT_EXPR
:
341 pp_left_paren (buffer
);
342 dump_generic_node (buffer
, TREE_TYPE (lhs
), spc
, flags
, false);
343 pp_string (buffer
, ") ");
344 if (op_prio (rhs
) < op_code_prio (rhs_code
))
346 pp_left_paren (buffer
);
347 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
348 pp_right_paren (buffer
);
351 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
355 pp_string (buffer
, "((");
356 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
357 pp_string (buffer
, "))");
362 if (flags
& TDF_GIMPLE
)
365 rhs_code
== ABS_EXPR
? "__ABS " : "__ABSU ");
366 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
371 rhs_code
== ABS_EXPR
? "ABS_EXPR <" : "ABSU_EXPR <");
372 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
378 if (TREE_CODE_CLASS (rhs_code
) == tcc_declaration
379 || TREE_CODE_CLASS (rhs_code
) == tcc_constant
380 || TREE_CODE_CLASS (rhs_code
) == tcc_reference
381 || rhs_code
== SSA_NAME
382 || rhs_code
== ADDR_EXPR
383 || rhs_code
== CONSTRUCTOR
)
385 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
388 else if (rhs_code
== BIT_NOT_EXPR
)
389 pp_complement (buffer
);
390 else if (rhs_code
== TRUTH_NOT_EXPR
)
391 pp_exclamation (buffer
);
392 else if (rhs_code
== NEGATE_EXPR
)
396 pp_left_bracket (buffer
);
397 pp_string (buffer
, get_tree_code_name (rhs_code
));
398 pp_string (buffer
, "] ");
401 if (op_prio (rhs
) < op_code_prio (rhs_code
))
403 pp_left_paren (buffer
);
404 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
405 pp_right_paren (buffer
);
408 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
414 /* Helper for dump_gimple_assign. Print the binary RHS of the
415 assignment GS. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. */
418 dump_binary_rhs (pretty_printer
*buffer
, gassign
*gs
, int spc
,
422 enum tree_code code
= gimple_assign_rhs_code (gs
);
428 case VEC_WIDEN_MULT_HI_EXPR
:
429 case VEC_WIDEN_MULT_LO_EXPR
:
430 case VEC_WIDEN_MULT_EVEN_EXPR
:
431 case VEC_WIDEN_MULT_ODD_EXPR
:
432 case VEC_PACK_TRUNC_EXPR
:
433 case VEC_PACK_SAT_EXPR
:
434 case VEC_PACK_FIX_TRUNC_EXPR
:
435 case VEC_PACK_FLOAT_EXPR
:
436 case VEC_WIDEN_LSHIFT_HI_EXPR
:
437 case VEC_WIDEN_LSHIFT_LO_EXPR
:
438 case VEC_SERIES_EXPR
:
439 for (p
= get_tree_code_name (code
); *p
; p
++)
440 pp_character (buffer
, TOUPPER (*p
));
441 pp_string (buffer
, " <");
442 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
443 pp_string (buffer
, ", ");
444 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
449 if (op_prio (gimple_assign_rhs1 (gs
)) <= op_code_prio (code
))
451 pp_left_paren (buffer
);
452 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
,
454 pp_right_paren (buffer
);
457 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
459 pp_string (buffer
, op_symbol_code (gimple_assign_rhs_code (gs
)));
461 if (op_prio (gimple_assign_rhs2 (gs
)) <= op_code_prio (code
))
463 pp_left_paren (buffer
);
464 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
,
466 pp_right_paren (buffer
);
469 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
473 /* Helper for dump_gimple_assign. Print the ternary RHS of the
474 assignment GS. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. */
477 dump_ternary_rhs (pretty_printer
*buffer
, gassign
*gs
, int spc
,
481 enum tree_code code
= gimple_assign_rhs_code (gs
);
484 case WIDEN_MULT_PLUS_EXPR
:
485 case WIDEN_MULT_MINUS_EXPR
:
486 for (p
= get_tree_code_name (code
); *p
; p
++)
487 pp_character (buffer
, TOUPPER (*p
));
488 pp_string (buffer
, " <");
489 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
490 pp_string (buffer
, ", ");
491 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
492 pp_string (buffer
, ", ");
493 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
498 pp_string (buffer
, "DOT_PROD_EXPR <");
499 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
500 pp_string (buffer
, ", ");
501 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
502 pp_string (buffer
, ", ");
503 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
508 pp_string (buffer
, "SAD_EXPR <");
509 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
510 pp_string (buffer
, ", ");
511 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
512 pp_string (buffer
, ", ");
513 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
518 pp_string (buffer
, "VEC_PERM_EXPR <");
519 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
520 pp_string (buffer
, ", ");
521 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
522 pp_string (buffer
, ", ");
523 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
527 case REALIGN_LOAD_EXPR
:
528 pp_string (buffer
, "REALIGN_LOAD <");
529 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
530 pp_string (buffer
, ", ");
531 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
532 pp_string (buffer
, ", ");
533 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
538 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
539 pp_string (buffer
, " ? ");
540 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
541 pp_string (buffer
, " : ");
542 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
546 pp_string (buffer
, "VEC_COND_EXPR <");
547 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
548 pp_string (buffer
, ", ");
549 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
550 pp_string (buffer
, ", ");
551 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
555 case BIT_INSERT_EXPR
:
556 pp_string (buffer
, "BIT_INSERT_EXPR <");
557 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
558 pp_string (buffer
, ", ");
559 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
560 pp_string (buffer
, ", ");
561 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
562 pp_string (buffer
, " (");
563 if (INTEGRAL_TYPE_P (TREE_TYPE (gimple_assign_rhs2 (gs
))))
564 pp_decimal_int (buffer
,
565 TYPE_PRECISION (TREE_TYPE (gimple_assign_rhs2 (gs
))));
567 dump_generic_node (buffer
,
568 TYPE_SIZE (TREE_TYPE (gimple_assign_rhs2 (gs
))),
570 pp_string (buffer
, " bits)>");
579 /* Dump the gimple assignment GS. BUFFER, SPC and FLAGS are as in
583 dump_gimple_assign (pretty_printer
*buffer
, gassign
*gs
, int spc
,
591 switch (gimple_num_ops (gs
))
594 arg3
= gimple_assign_rhs3 (gs
);
597 arg2
= gimple_assign_rhs2 (gs
);
600 arg1
= gimple_assign_rhs1 (gs
);
606 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%s, %T, %T, %T, %T>", gs
,
607 get_tree_code_name (gimple_assign_rhs_code (gs
)),
608 gimple_assign_lhs (gs
), arg1
, arg2
, arg3
);
612 if (!(flags
& TDF_RHS_ONLY
))
614 dump_generic_node (buffer
, gimple_assign_lhs (gs
), spc
, flags
, false);
618 if (gimple_assign_nontemporal_move_p (gs
))
619 pp_string (buffer
, "{nt}");
621 if (gimple_has_volatile_ops (gs
))
622 pp_string (buffer
, "{v}");
627 if (gimple_num_ops (gs
) == 2)
628 dump_unary_rhs (buffer
, gs
, spc
, flags
);
629 else if (gimple_num_ops (gs
) == 3)
630 dump_binary_rhs (buffer
, gs
, spc
, flags
);
631 else if (gimple_num_ops (gs
) == 4)
632 dump_ternary_rhs (buffer
, gs
, spc
, flags
);
635 if (!(flags
& TDF_RHS_ONLY
))
636 pp_semicolon (buffer
);
641 /* Dump the return statement GS. BUFFER, SPC and FLAGS are as in
645 dump_gimple_return (pretty_printer
*buffer
, greturn
*gs
, int spc
,
650 t
= gimple_return_retval (gs
);
652 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
, t
);
655 pp_string (buffer
, "return");
659 dump_generic_node (buffer
, t
, spc
, flags
, false);
661 pp_semicolon (buffer
);
666 /* Dump the call arguments for a gimple call. BUFFER, FLAGS are as in
670 dump_gimple_call_args (pretty_printer
*buffer
, gcall
*gs
, dump_flags_t flags
)
674 /* Pretty print first arg to certain internal fns. */
675 if (gimple_call_internal_p (gs
))
677 const char *const *enums
= NULL
;
680 switch (gimple_call_internal_fn (gs
))
684 static const char *const unique_args
[] = {IFN_UNIQUE_CODES
};
688 limit
= ARRAY_SIZE (unique_args
);
693 static const char *const loop_args
[] = {IFN_GOACC_LOOP_CODES
};
696 limit
= ARRAY_SIZE (loop_args
);
699 case IFN_GOACC_REDUCTION
:
701 static const char *const reduction_args
[]
702 = {IFN_GOACC_REDUCTION_CODES
};
704 enums
= reduction_args
;
705 limit
= ARRAY_SIZE (reduction_args
);
710 static const char *const asan_mark_args
[] = {IFN_ASAN_MARK_FLAGS
};
712 enums
= asan_mark_args
;
713 limit
= ARRAY_SIZE (asan_mark_args
);
721 tree arg0
= gimple_call_arg (gs
, 0);
724 if (TREE_CODE (arg0
) == INTEGER_CST
725 && tree_fits_shwi_p (arg0
)
726 && (v
= tree_to_shwi (arg0
)) >= 0 && v
< limit
)
729 pp_string (buffer
, enums
[v
]);
734 for (; i
< gimple_call_num_args (gs
); i
++)
737 pp_string (buffer
, ", ");
738 dump_generic_node (buffer
, gimple_call_arg (gs
, i
), 0, flags
, false);
741 if (gimple_call_va_arg_pack_p (gs
))
744 pp_string (buffer
, ", ");
746 pp_string (buffer
, "__builtin_va_arg_pack ()");
750 /* Dump the points-to solution *PT to BUFFER. */
753 pp_points_to_solution (pretty_printer
*buffer
, struct pt_solution
*pt
)
757 pp_string (buffer
, "anything ");
761 pp_string (buffer
, "nonlocal ");
763 pp_string (buffer
, "escaped ");
765 pp_string (buffer
, "unit-escaped ");
767 pp_string (buffer
, "null ");
769 && !bitmap_empty_p (pt
->vars
))
773 pp_string (buffer
, "{ ");
774 EXECUTE_IF_SET_IN_BITMAP (pt
->vars
, 0, i
, bi
)
776 pp_string (buffer
, "D.");
777 pp_decimal_int (buffer
, i
);
780 pp_right_brace (buffer
);
781 if (pt
->vars_contains_nonlocal
782 || pt
->vars_contains_escaped
783 || pt
->vars_contains_escaped_heap
784 || pt
->vars_contains_restrict
)
786 const char *comma
= "";
787 pp_string (buffer
, " (");
788 if (pt
->vars_contains_nonlocal
)
790 pp_string (buffer
, "nonlocal");
793 if (pt
->vars_contains_escaped
)
795 pp_string (buffer
, comma
);
796 pp_string (buffer
, "escaped");
799 if (pt
->vars_contains_escaped_heap
)
801 pp_string (buffer
, comma
);
802 pp_string (buffer
, "escaped heap");
805 if (pt
->vars_contains_restrict
)
807 pp_string (buffer
, comma
);
808 pp_string (buffer
, "restrict");
811 if (pt
->vars_contains_interposable
)
813 pp_string (buffer
, comma
);
814 pp_string (buffer
, "interposable");
816 pp_string (buffer
, ")");
822 /* Dump the call statement GS. BUFFER, SPC and FLAGS are as in
826 dump_gimple_call (pretty_printer
*buffer
, gcall
*gs
, int spc
,
829 tree lhs
= gimple_call_lhs (gs
);
830 tree fn
= gimple_call_fn (gs
);
832 if (flags
& TDF_ALIAS
)
834 struct pt_solution
*pt
;
835 pt
= gimple_call_use_set (gs
);
836 if (!pt_solution_empty_p (pt
))
838 pp_string (buffer
, "# USE = ");
839 pp_points_to_solution (buffer
, pt
);
840 newline_and_indent (buffer
, spc
);
842 pt
= gimple_call_clobber_set (gs
);
843 if (!pt_solution_empty_p (pt
))
845 pp_string (buffer
, "# CLB = ");
846 pp_points_to_solution (buffer
, pt
);
847 newline_and_indent (buffer
, spc
);
853 if (gimple_call_internal_p (gs
))
854 dump_gimple_fmt (buffer
, spc
, flags
, "%G <.%s, %T", gs
,
855 internal_fn_name (gimple_call_internal_fn (gs
)), lhs
);
857 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T", gs
, fn
, lhs
);
858 if (gimple_call_num_args (gs
) > 0)
860 pp_string (buffer
, ", ");
861 dump_gimple_call_args (buffer
, gs
, flags
);
867 if (lhs
&& !(flags
& TDF_RHS_ONLY
))
869 dump_generic_node (buffer
, lhs
, spc
, flags
, false);
870 pp_string (buffer
, " =");
872 if (gimple_has_volatile_ops (gs
))
873 pp_string (buffer
, "{v}");
877 if (gimple_call_internal_p (gs
))
880 pp_string (buffer
, internal_fn_name (gimple_call_internal_fn (gs
)));
883 print_call_name (buffer
, fn
, flags
);
884 pp_string (buffer
, " (");
885 dump_gimple_call_args (buffer
, gs
, flags
);
886 pp_right_paren (buffer
);
887 if (!(flags
& TDF_RHS_ONLY
))
888 pp_semicolon (buffer
);
891 if (gimple_call_chain (gs
))
893 pp_string (buffer
, " [static-chain: ");
894 dump_generic_node (buffer
, gimple_call_chain (gs
), spc
, flags
, false);
895 pp_right_bracket (buffer
);
898 if (gimple_call_return_slot_opt_p (gs
))
899 pp_string (buffer
, " [return slot optimization]");
900 if (gimple_call_tail_p (gs
))
901 pp_string (buffer
, " [tail call]");
902 if (gimple_call_must_tail_p (gs
))
903 pp_string (buffer
, " [must tail call]");
908 /* Dump the arguments of _ITM_beginTransaction sanely. */
909 if (TREE_CODE (fn
) == ADDR_EXPR
)
910 fn
= TREE_OPERAND (fn
, 0);
911 if (TREE_CODE (fn
) == FUNCTION_DECL
&& decl_is_tm_clone (fn
))
912 pp_string (buffer
, " [tm-clone]");
913 if (TREE_CODE (fn
) == FUNCTION_DECL
914 && fndecl_built_in_p (fn
, BUILT_IN_TM_START
)
915 && gimple_call_num_args (gs
) > 0)
917 tree t
= gimple_call_arg (gs
, 0);
918 unsigned HOST_WIDE_INT props
;
919 gcc_assert (TREE_CODE (t
) == INTEGER_CST
);
921 pp_string (buffer
, " [ ");
923 /* Get the transaction code properties. */
924 props
= TREE_INT_CST_LOW (t
);
926 if (props
& PR_INSTRUMENTEDCODE
)
927 pp_string (buffer
, "instrumentedCode ");
928 if (props
& PR_UNINSTRUMENTEDCODE
)
929 pp_string (buffer
, "uninstrumentedCode ");
930 if (props
& PR_HASNOXMMUPDATE
)
931 pp_string (buffer
, "hasNoXMMUpdate ");
932 if (props
& PR_HASNOABORT
)
933 pp_string (buffer
, "hasNoAbort ");
934 if (props
& PR_HASNOIRREVOCABLE
)
935 pp_string (buffer
, "hasNoIrrevocable ");
936 if (props
& PR_DOESGOIRREVOCABLE
)
937 pp_string (buffer
, "doesGoIrrevocable ");
938 if (props
& PR_HASNOSIMPLEREADS
)
939 pp_string (buffer
, "hasNoSimpleReads ");
940 if (props
& PR_AWBARRIERSOMITTED
)
941 pp_string (buffer
, "awBarriersOmitted ");
942 if (props
& PR_RARBARRIERSOMITTED
)
943 pp_string (buffer
, "RaRBarriersOmitted ");
944 if (props
& PR_UNDOLOGCODE
)
945 pp_string (buffer
, "undoLogCode ");
946 if (props
& PR_PREFERUNINSTRUMENTED
)
947 pp_string (buffer
, "preferUninstrumented ");
948 if (props
& PR_EXCEPTIONBLOCK
)
949 pp_string (buffer
, "exceptionBlock ");
950 if (props
& PR_HASELSE
)
951 pp_string (buffer
, "hasElse ");
952 if (props
& PR_READONLY
)
953 pp_string (buffer
, "readOnly ");
955 pp_right_bracket (buffer
);
960 /* Dump the switch statement GS. BUFFER, SPC and FLAGS are as in
964 dump_gimple_switch (pretty_printer
*buffer
, gswitch
*gs
, int spc
,
969 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
971 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, ", gs
,
972 gimple_switch_index (gs
));
975 pp_string (buffer
, "switch (");
976 dump_generic_node (buffer
, gimple_switch_index (gs
), spc
, flags
, true);
977 if (flags
& TDF_GIMPLE
)
978 pp_string (buffer
, ") {");
980 pp_string (buffer
, ") <");
983 for (i
= 0; i
< gimple_switch_num_labels (gs
); i
++)
985 tree case_label
= gimple_switch_label (gs
, i
);
986 gcc_checking_assert (case_label
!= NULL_TREE
);
987 dump_generic_node (buffer
, case_label
, spc
, flags
, false);
989 tree label
= CASE_LABEL (case_label
);
990 dump_generic_node (buffer
, label
, spc
, flags
, false);
992 if (cfun
&& cfun
->cfg
)
994 basic_block dest
= label_to_block (cfun
, label
);
997 edge label_edge
= find_edge (gimple_bb (gs
), dest
);
998 if (label_edge
&& !(flags
& TDF_GIMPLE
))
999 dump_edge_probability (buffer
, label_edge
);
1003 if (i
< gimple_switch_num_labels (gs
) - 1)
1005 if (flags
& TDF_GIMPLE
)
1006 pp_string (buffer
, "; ");
1008 pp_string (buffer
, ", ");
1011 if (flags
& TDF_GIMPLE
)
1012 pp_string (buffer
, "; }");
1014 pp_greater (buffer
);
1018 /* Dump the gimple conditional GS. BUFFER, SPC and FLAGS are as in
1019 pp_gimple_stmt_1. */
1022 dump_gimple_cond (pretty_printer
*buffer
, gcond
*gs
, int spc
,
1025 if (flags
& TDF_RAW
)
1026 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%s, %T, %T, %T, %T>", gs
,
1027 get_tree_code_name (gimple_cond_code (gs
)),
1028 gimple_cond_lhs (gs
), gimple_cond_rhs (gs
),
1029 gimple_cond_true_label (gs
), gimple_cond_false_label (gs
));
1032 if (!(flags
& TDF_RHS_ONLY
))
1033 pp_string (buffer
, "if (");
1034 dump_generic_node (buffer
, gimple_cond_lhs (gs
), spc
, flags
, false);
1036 pp_string (buffer
, op_symbol_code (gimple_cond_code (gs
)));
1038 dump_generic_node (buffer
, gimple_cond_rhs (gs
), spc
, flags
, false);
1039 if (!(flags
& TDF_RHS_ONLY
))
1042 edge e
, true_edge
= NULL
, false_edge
= NULL
;
1043 basic_block bb
= gimple_bb (gs
);
1047 FOR_EACH_EDGE (e
, ei
, bb
->succs
)
1049 if (e
->flags
& EDGE_TRUE_VALUE
)
1051 else if (e
->flags
& EDGE_FALSE_VALUE
)
1056 bool has_edge_info
= true_edge
!= NULL
&& false_edge
!= NULL
;
1058 pp_right_paren (buffer
);
1060 if (gimple_cond_true_label (gs
))
1062 pp_string (buffer
, " goto ");
1063 dump_generic_node (buffer
, gimple_cond_true_label (gs
),
1065 if (has_edge_info
&& !(flags
& TDF_GIMPLE
))
1066 dump_edge_probability (buffer
, true_edge
);
1067 pp_semicolon (buffer
);
1069 if (gimple_cond_false_label (gs
))
1071 pp_string (buffer
, " else goto ");
1072 dump_generic_node (buffer
, gimple_cond_false_label (gs
),
1074 if (has_edge_info
&& !(flags
& TDF_GIMPLE
))
1075 dump_edge_probability (buffer
, false_edge
);
1077 pp_semicolon (buffer
);
1084 /* Dump a GIMPLE_LABEL tuple on the pretty_printer BUFFER, SPC
1085 spaces of indent. FLAGS specifies details to show in the dump (see
1086 TDF_* in dumpfils.h). */
1089 dump_gimple_label (pretty_printer
*buffer
, glabel
*gs
, int spc
,
1092 tree label
= gimple_label_label (gs
);
1093 if (flags
& TDF_RAW
)
1094 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
, label
);
1097 dump_generic_node (buffer
, label
, spc
, flags
, false);
1100 if (flags
& TDF_GIMPLE
)
1102 if (DECL_NONLOCAL (label
))
1103 pp_string (buffer
, " [non-local]");
1104 if ((flags
& TDF_EH
) && EH_LANDING_PAD_NR (label
))
1105 pp_printf (buffer
, " [LP %d]", EH_LANDING_PAD_NR (label
));
1108 /* Dump a GIMPLE_GOTO tuple on the pretty_printer BUFFER, SPC
1109 spaces of indent. FLAGS specifies details to show in the dump (see
1110 TDF_* in dumpfile.h). */
1113 dump_gimple_goto (pretty_printer
*buffer
, ggoto
*gs
, int spc
,
1116 tree label
= gimple_goto_dest (gs
);
1117 if (flags
& TDF_RAW
)
1118 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
, label
);
1120 dump_gimple_fmt (buffer
, spc
, flags
, "goto %T;", label
);
1124 /* Dump a GIMPLE_BIND tuple on the pretty_printer BUFFER, SPC
1125 spaces of indent. FLAGS specifies details to show in the dump (see
1126 TDF_* in dumpfile.h). */
1129 dump_gimple_bind (pretty_printer
*buffer
, gbind
*gs
, int spc
,
1132 if (flags
& TDF_RAW
)
1133 dump_gimple_fmt (buffer
, spc
, flags
, "%G <", gs
);
1135 pp_left_brace (buffer
);
1136 if (!(flags
& TDF_SLIM
))
1140 for (var
= gimple_bind_vars (gs
); var
; var
= DECL_CHAIN (var
))
1142 newline_and_indent (buffer
, 2);
1143 print_declaration (buffer
, var
, spc
, flags
);
1145 if (gimple_bind_vars (gs
))
1146 pp_newline (buffer
);
1148 pp_newline (buffer
);
1149 dump_gimple_seq (buffer
, gimple_bind_body (gs
), spc
+ 2, flags
);
1150 newline_and_indent (buffer
, spc
);
1151 if (flags
& TDF_RAW
)
1152 pp_greater (buffer
);
1154 pp_right_brace (buffer
);
1158 /* Dump a GIMPLE_TRY tuple on the pretty_printer BUFFER, SPC spaces of
1159 indent. FLAGS specifies details to show in the dump (see TDF_* in
1163 dump_gimple_try (pretty_printer
*buffer
, gtry
*gs
, int spc
,
1166 if (flags
& TDF_RAW
)
1169 if (gimple_try_kind (gs
) == GIMPLE_TRY_CATCH
)
1170 type
= "GIMPLE_TRY_CATCH";
1171 else if (gimple_try_kind (gs
) == GIMPLE_TRY_FINALLY
)
1172 type
= "GIMPLE_TRY_FINALLY";
1174 type
= "UNKNOWN GIMPLE_TRY";
1175 dump_gimple_fmt (buffer
, spc
, flags
,
1176 "%G <%s,%+EVAL <%S>%nCLEANUP <%S>%->", gs
, type
,
1177 gimple_try_eval (gs
), gimple_try_cleanup (gs
));
1181 pp_string (buffer
, "try");
1182 newline_and_indent (buffer
, spc
+ 2);
1183 pp_left_brace (buffer
);
1184 pp_newline (buffer
);
1186 dump_gimple_seq (buffer
, gimple_try_eval (gs
), spc
+ 4, flags
);
1187 newline_and_indent (buffer
, spc
+ 2);
1188 pp_right_brace (buffer
);
1190 if (gimple_try_kind (gs
) == GIMPLE_TRY_CATCH
)
1192 newline_and_indent (buffer
, spc
);
1193 pp_string (buffer
, "catch");
1194 newline_and_indent (buffer
, spc
+ 2);
1195 pp_left_brace (buffer
);
1197 else if (gimple_try_kind (gs
) == GIMPLE_TRY_FINALLY
)
1199 newline_and_indent (buffer
, spc
);
1200 pp_string (buffer
, "finally");
1201 newline_and_indent (buffer
, spc
+ 2);
1202 pp_left_brace (buffer
);
1205 pp_string (buffer
, " <UNKNOWN GIMPLE_TRY> {");
1207 pp_newline (buffer
);
1208 dump_gimple_seq (buffer
, gimple_try_cleanup (gs
), spc
+ 4, flags
);
1209 newline_and_indent (buffer
, spc
+ 2);
1210 pp_right_brace (buffer
);
1215 /* Dump a GIMPLE_CATCH tuple on the pretty_printer BUFFER, SPC spaces of
1216 indent. FLAGS specifies details to show in the dump (see TDF_* in
1220 dump_gimple_catch (pretty_printer
*buffer
, gcatch
*gs
, int spc
,
1223 if (flags
& TDF_RAW
)
1224 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %+CATCH <%S>%->", gs
,
1225 gimple_catch_types (gs
), gimple_catch_handler (gs
));
1227 dump_gimple_fmt (buffer
, spc
, flags
, "catch (%T)%+{%S}",
1228 gimple_catch_types (gs
), gimple_catch_handler (gs
));
1232 /* Dump a GIMPLE_EH_FILTER tuple on the pretty_printer BUFFER, SPC spaces of
1233 indent. FLAGS specifies details to show in the dump (see TDF_* in
1237 dump_gimple_eh_filter (pretty_printer
*buffer
, geh_filter
*gs
, int spc
,
1240 if (flags
& TDF_RAW
)
1241 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %+FAILURE <%S>%->", gs
,
1242 gimple_eh_filter_types (gs
),
1243 gimple_eh_filter_failure (gs
));
1245 dump_gimple_fmt (buffer
, spc
, flags
, "<<<eh_filter (%T)>>>%+{%+%S%-}",
1246 gimple_eh_filter_types (gs
),
1247 gimple_eh_filter_failure (gs
));
1251 /* Dump a GIMPLE_EH_MUST_NOT_THROW tuple. */
1254 dump_gimple_eh_must_not_throw (pretty_printer
*buffer
,
1255 geh_mnt
*gs
, int spc
, dump_flags_t flags
)
1257 if (flags
& TDF_RAW
)
1258 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
,
1259 gimple_eh_must_not_throw_fndecl (gs
));
1261 dump_gimple_fmt (buffer
, spc
, flags
, "<<<eh_must_not_throw (%T)>>>",
1262 gimple_eh_must_not_throw_fndecl (gs
));
1266 /* Dump a GIMPLE_EH_ELSE tuple on the pretty_printer BUFFER, SPC spaces of
1267 indent. FLAGS specifies details to show in the dump (see TDF_* in
1271 dump_gimple_eh_else (pretty_printer
*buffer
, geh_else
*gs
, int spc
,
1274 if (flags
& TDF_RAW
)
1275 dump_gimple_fmt (buffer
, spc
, flags
,
1276 "%G <%+N_BODY <%S>%nE_BODY <%S>%->", gs
,
1277 gimple_eh_else_n_body (gs
), gimple_eh_else_e_body (gs
));
1279 dump_gimple_fmt (buffer
, spc
, flags
,
1280 "<<<if_normal_exit>>>%+{%S}%-<<<else_eh_exit>>>%+{%S}",
1281 gimple_eh_else_n_body (gs
), gimple_eh_else_e_body (gs
));
1285 /* Dump a GIMPLE_RESX tuple on the pretty_printer BUFFER, SPC spaces of
1286 indent. FLAGS specifies details to show in the dump (see TDF_* in
1290 dump_gimple_resx (pretty_printer
*buffer
, gresx
*gs
, int spc
,
1293 if (flags
& TDF_RAW
)
1294 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%d>", gs
,
1295 gimple_resx_region (gs
));
1297 dump_gimple_fmt (buffer
, spc
, flags
, "resx %d", gimple_resx_region (gs
));
1300 /* Dump a GIMPLE_EH_DISPATCH tuple on the pretty_printer BUFFER. */
1303 dump_gimple_eh_dispatch (pretty_printer
*buffer
, geh_dispatch
*gs
, int spc
,
1306 if (flags
& TDF_RAW
)
1307 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%d>", gs
,
1308 gimple_eh_dispatch_region (gs
));
1310 dump_gimple_fmt (buffer
, spc
, flags
, "eh_dispatch %d",
1311 gimple_eh_dispatch_region (gs
));
1314 /* Dump a GIMPLE_DEBUG tuple on the pretty_printer BUFFER, SPC spaces
1315 of indent. FLAGS specifies details to show in the dump (see TDF_*
1319 dump_gimple_debug (pretty_printer
*buffer
, gdebug
*gs
, int spc
,
1322 switch (gs
->subcode
)
1324 case GIMPLE_DEBUG_BIND
:
1325 if (flags
& TDF_RAW
)
1326 dump_gimple_fmt (buffer
, spc
, flags
, "%G BIND <%T, %T>", gs
,
1327 gimple_debug_bind_get_var (gs
),
1328 gimple_debug_bind_get_value (gs
));
1330 dump_gimple_fmt (buffer
, spc
, flags
, "# DEBUG %T => %T",
1331 gimple_debug_bind_get_var (gs
),
1332 gimple_debug_bind_get_value (gs
));
1335 case GIMPLE_DEBUG_SOURCE_BIND
:
1336 if (flags
& TDF_RAW
)
1337 dump_gimple_fmt (buffer
, spc
, flags
, "%G SRCBIND <%T, %T>", gs
,
1338 gimple_debug_source_bind_get_var (gs
),
1339 gimple_debug_source_bind_get_value (gs
));
1341 dump_gimple_fmt (buffer
, spc
, flags
, "# DEBUG %T s=> %T",
1342 gimple_debug_source_bind_get_var (gs
),
1343 gimple_debug_source_bind_get_value (gs
));
1346 case GIMPLE_DEBUG_BEGIN_STMT
:
1347 if (flags
& TDF_RAW
)
1348 dump_gimple_fmt (buffer
, spc
, flags
, "%G BEGIN_STMT", gs
);
1350 dump_gimple_fmt (buffer
, spc
, flags
, "# DEBUG BEGIN_STMT");
1353 case GIMPLE_DEBUG_INLINE_ENTRY
:
1354 if (flags
& TDF_RAW
)
1355 dump_gimple_fmt (buffer
, spc
, flags
, "%G INLINE_ENTRY %T", gs
,
1357 ? block_ultimate_origin (gimple_block (gs
))
1360 dump_gimple_fmt (buffer
, spc
, flags
, "# DEBUG INLINE_ENTRY %T",
1362 ? block_ultimate_origin (gimple_block (gs
))
1371 /* Dump a GIMPLE_OMP_FOR tuple on the pretty_printer BUFFER. */
1373 dump_gimple_omp_for (pretty_printer
*buffer
, gomp_for
*gs
, int spc
,
1378 if (flags
& TDF_RAW
)
1381 switch (gimple_omp_for_kind (gs
))
1383 case GF_OMP_FOR_KIND_FOR
:
1386 case GF_OMP_FOR_KIND_DISTRIBUTE
:
1387 kind
= " distribute";
1389 case GF_OMP_FOR_KIND_TASKLOOP
:
1392 case GF_OMP_FOR_KIND_OACC_LOOP
:
1393 kind
= " oacc_loop";
1395 case GF_OMP_FOR_KIND_SIMD
:
1401 dump_gimple_fmt (buffer
, spc
, flags
, "%G%s <%+BODY <%S>%nCLAUSES <", gs
,
1402 kind
, gimple_omp_body (gs
));
1403 dump_omp_clauses (buffer
, gimple_omp_for_clauses (gs
), spc
, flags
);
1404 dump_gimple_fmt (buffer
, spc
, flags
, " >,");
1405 for (i
= 0; i
< gimple_omp_for_collapse (gs
); i
++)
1406 dump_gimple_fmt (buffer
, spc
, flags
,
1407 "%+%T, %T, %T, %s, %T,%n",
1408 gimple_omp_for_index (gs
, i
),
1409 gimple_omp_for_initial (gs
, i
),
1410 gimple_omp_for_final (gs
, i
),
1411 get_tree_code_name (gimple_omp_for_cond (gs
, i
)),
1412 gimple_omp_for_incr (gs
, i
));
1413 dump_gimple_fmt (buffer
, spc
, flags
, "PRE_BODY <%S>%->",
1414 gimple_omp_for_pre_body (gs
));
1418 switch (gimple_omp_for_kind (gs
))
1420 case GF_OMP_FOR_KIND_FOR
:
1421 pp_string (buffer
, "#pragma omp for");
1423 case GF_OMP_FOR_KIND_DISTRIBUTE
:
1424 pp_string (buffer
, "#pragma omp distribute");
1426 case GF_OMP_FOR_KIND_TASKLOOP
:
1427 pp_string (buffer
, "#pragma omp taskloop");
1429 case GF_OMP_FOR_KIND_OACC_LOOP
:
1430 pp_string (buffer
, "#pragma acc loop");
1432 case GF_OMP_FOR_KIND_SIMD
:
1433 pp_string (buffer
, "#pragma omp simd");
1435 case GF_OMP_FOR_KIND_GRID_LOOP
:
1436 pp_string (buffer
, "#pragma omp for grid_loop");
1441 dump_omp_clauses (buffer
, gimple_omp_for_clauses (gs
), spc
, flags
);
1442 for (i
= 0; i
< gimple_omp_for_collapse (gs
); i
++)
1446 newline_and_indent (buffer
, spc
);
1447 pp_string (buffer
, "for (");
1448 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
1450 pp_string (buffer
, " = ");
1451 dump_generic_node (buffer
, gimple_omp_for_initial (gs
, i
), spc
,
1453 pp_string (buffer
, "; ");
1455 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
1458 switch (gimple_omp_for_cond (gs
, i
))
1464 pp_greater (buffer
);
1467 pp_less_equal (buffer
);
1470 pp_greater_equal (buffer
);
1473 pp_string (buffer
, "!=");
1479 dump_generic_node (buffer
, gimple_omp_for_final (gs
, i
), spc
,
1481 pp_string (buffer
, "; ");
1483 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
1485 pp_string (buffer
, " = ");
1486 dump_generic_node (buffer
, gimple_omp_for_incr (gs
, i
), spc
,
1488 pp_right_paren (buffer
);
1491 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1493 newline_and_indent (buffer
, spc
+ 2);
1494 pp_left_brace (buffer
);
1495 pp_newline (buffer
);
1496 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1497 newline_and_indent (buffer
, spc
+ 2);
1498 pp_right_brace (buffer
);
1503 /* Dump a GIMPLE_OMP_CONTINUE tuple on the pretty_printer BUFFER. */
1506 dump_gimple_omp_continue (pretty_printer
*buffer
, gomp_continue
*gs
,
1507 int spc
, dump_flags_t flags
)
1509 if (flags
& TDF_RAW
)
1511 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T>", gs
,
1512 gimple_omp_continue_control_def (gs
),
1513 gimple_omp_continue_control_use (gs
));
1517 pp_string (buffer
, "#pragma omp continue (");
1518 dump_generic_node (buffer
, gimple_omp_continue_control_def (gs
),
1522 dump_generic_node (buffer
, gimple_omp_continue_control_use (gs
),
1524 pp_right_paren (buffer
);
1528 /* Dump a GIMPLE_OMP_SINGLE tuple on the pretty_printer BUFFER. */
1531 dump_gimple_omp_single (pretty_printer
*buffer
, gomp_single
*gs
,
1532 int spc
, dump_flags_t flags
)
1534 if (flags
& TDF_RAW
)
1536 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1537 gimple_omp_body (gs
));
1538 dump_omp_clauses (buffer
, gimple_omp_single_clauses (gs
), spc
, flags
);
1539 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1543 pp_string (buffer
, "#pragma omp single");
1544 dump_omp_clauses (buffer
, gimple_omp_single_clauses (gs
), spc
, flags
);
1545 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1547 newline_and_indent (buffer
, spc
+ 2);
1548 pp_left_brace (buffer
);
1549 pp_newline (buffer
);
1550 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1551 newline_and_indent (buffer
, spc
+ 2);
1552 pp_right_brace (buffer
);
1557 /* Dump a GIMPLE_OMP_TASKGROUP tuple on the pretty_printer BUFFER. */
1560 dump_gimple_omp_taskgroup (pretty_printer
*buffer
, gimple
*gs
,
1561 int spc
, dump_flags_t flags
)
1563 if (flags
& TDF_RAW
)
1565 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1566 gimple_omp_body (gs
));
1567 dump_omp_clauses (buffer
, gimple_omp_taskgroup_clauses (gs
), spc
, flags
);
1568 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1572 pp_string (buffer
, "#pragma omp taskgroup");
1573 dump_omp_clauses (buffer
, gimple_omp_taskgroup_clauses (gs
), spc
, flags
);
1574 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1576 newline_and_indent (buffer
, spc
+ 2);
1577 pp_left_brace (buffer
);
1578 pp_newline (buffer
);
1579 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1580 newline_and_indent (buffer
, spc
+ 2);
1581 pp_right_brace (buffer
);
1586 /* Dump a GIMPLE_OMP_TARGET tuple on the pretty_printer BUFFER. */
1589 dump_gimple_omp_target (pretty_printer
*buffer
, gomp_target
*gs
,
1590 int spc
, dump_flags_t flags
)
1593 switch (gimple_omp_target_kind (gs
))
1595 case GF_OMP_TARGET_KIND_REGION
:
1598 case GF_OMP_TARGET_KIND_DATA
:
1601 case GF_OMP_TARGET_KIND_UPDATE
:
1604 case GF_OMP_TARGET_KIND_ENTER_DATA
:
1605 kind
= " enter data";
1607 case GF_OMP_TARGET_KIND_EXIT_DATA
:
1608 kind
= " exit data";
1610 case GF_OMP_TARGET_KIND_OACC_KERNELS
:
1611 kind
= " oacc_kernels";
1613 case GF_OMP_TARGET_KIND_OACC_PARALLEL
:
1614 kind
= " oacc_parallel";
1616 case GF_OMP_TARGET_KIND_OACC_DATA
:
1617 kind
= " oacc_data";
1619 case GF_OMP_TARGET_KIND_OACC_UPDATE
:
1620 kind
= " oacc_update";
1622 case GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA
:
1623 kind
= " oacc_enter_exit_data";
1625 case GF_OMP_TARGET_KIND_OACC_DECLARE
:
1626 kind
= " oacc_declare";
1628 case GF_OMP_TARGET_KIND_OACC_HOST_DATA
:
1629 kind
= " oacc_host_data";
1634 if (flags
& TDF_RAW
)
1636 dump_gimple_fmt (buffer
, spc
, flags
, "%G%s <%+BODY <%S>%nCLAUSES <", gs
,
1637 kind
, gimple_omp_body (gs
));
1638 dump_omp_clauses (buffer
, gimple_omp_target_clauses (gs
), spc
, flags
);
1639 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T%n>",
1640 gimple_omp_target_child_fn (gs
),
1641 gimple_omp_target_data_arg (gs
));
1645 pp_string (buffer
, "#pragma omp target");
1646 pp_string (buffer
, kind
);
1647 dump_omp_clauses (buffer
, gimple_omp_target_clauses (gs
), spc
, flags
);
1648 if (gimple_omp_target_child_fn (gs
))
1650 pp_string (buffer
, " [child fn: ");
1651 dump_generic_node (buffer
, gimple_omp_target_child_fn (gs
),
1653 pp_string (buffer
, " (");
1654 if (gimple_omp_target_data_arg (gs
))
1655 dump_generic_node (buffer
, gimple_omp_target_data_arg (gs
),
1658 pp_string (buffer
, "???");
1659 pp_string (buffer
, ")]");
1661 gimple_seq body
= gimple_omp_body (gs
);
1662 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
1664 newline_and_indent (buffer
, spc
+ 2);
1665 pp_left_brace (buffer
);
1666 pp_newline (buffer
);
1667 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
1668 newline_and_indent (buffer
, spc
+ 2);
1669 pp_right_brace (buffer
);
1673 pp_newline (buffer
);
1674 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
1679 /* Dump a GIMPLE_OMP_TEAMS tuple on the pretty_printer BUFFER. */
1682 dump_gimple_omp_teams (pretty_printer
*buffer
, gomp_teams
*gs
, int spc
,
1685 if (flags
& TDF_RAW
)
1687 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1688 gimple_omp_body (gs
));
1689 dump_omp_clauses (buffer
, gimple_omp_teams_clauses (gs
), spc
, flags
);
1690 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1694 pp_string (buffer
, "#pragma omp teams");
1695 dump_omp_clauses (buffer
, gimple_omp_teams_clauses (gs
), spc
, flags
);
1696 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1698 newline_and_indent (buffer
, spc
+ 2);
1699 pp_character (buffer
, '{');
1700 pp_newline (buffer
);
1701 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1702 newline_and_indent (buffer
, spc
+ 2);
1703 pp_character (buffer
, '}');
1708 /* Dump a GIMPLE_OMP_SECTIONS tuple on the pretty_printer BUFFER. */
1711 dump_gimple_omp_sections (pretty_printer
*buffer
, gomp_sections
*gs
,
1712 int spc
, dump_flags_t flags
)
1714 if (flags
& TDF_RAW
)
1716 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1717 gimple_omp_body (gs
));
1718 dump_omp_clauses (buffer
, gimple_omp_sections_clauses (gs
), spc
, flags
);
1719 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1723 pp_string (buffer
, "#pragma omp sections");
1724 if (gimple_omp_sections_control (gs
))
1726 pp_string (buffer
, " <");
1727 dump_generic_node (buffer
, gimple_omp_sections_control (gs
), spc
,
1729 pp_greater (buffer
);
1731 dump_omp_clauses (buffer
, gimple_omp_sections_clauses (gs
), spc
, flags
);
1732 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1734 newline_and_indent (buffer
, spc
+ 2);
1735 pp_left_brace (buffer
);
1736 pp_newline (buffer
);
1737 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1738 newline_and_indent (buffer
, spc
+ 2);
1739 pp_right_brace (buffer
);
1744 /* Dump a GIMPLE_OMP_{MASTER,ORDERED,SECTION} tuple on the
1745 pretty_printer BUFFER. */
1748 dump_gimple_omp_block (pretty_printer
*buffer
, gimple
*gs
, int spc
,
1751 if (flags
& TDF_RAW
)
1752 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1753 gimple_omp_body (gs
));
1756 switch (gimple_code (gs
))
1758 case GIMPLE_OMP_MASTER
:
1759 pp_string (buffer
, "#pragma omp master");
1761 case GIMPLE_OMP_TASKGROUP
:
1762 pp_string (buffer
, "#pragma omp taskgroup");
1764 case GIMPLE_OMP_SECTION
:
1765 pp_string (buffer
, "#pragma omp section");
1767 case GIMPLE_OMP_GRID_BODY
:
1768 pp_string (buffer
, "#pragma omp gridified body");
1773 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1775 newline_and_indent (buffer
, spc
+ 2);
1776 pp_left_brace (buffer
);
1777 pp_newline (buffer
);
1778 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1779 newline_and_indent (buffer
, spc
+ 2);
1780 pp_right_brace (buffer
);
1785 /* Dump a GIMPLE_OMP_CRITICAL tuple on the pretty_printer BUFFER. */
1788 dump_gimple_omp_critical (pretty_printer
*buffer
, gomp_critical
*gs
,
1789 int spc
, dump_flags_t flags
)
1791 if (flags
& TDF_RAW
)
1792 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1793 gimple_omp_body (gs
));
1796 pp_string (buffer
, "#pragma omp critical");
1797 if (gimple_omp_critical_name (gs
))
1799 pp_string (buffer
, " (");
1800 dump_generic_node (buffer
, gimple_omp_critical_name (gs
), spc
,
1802 pp_right_paren (buffer
);
1804 dump_omp_clauses (buffer
, gimple_omp_critical_clauses (gs
), spc
, flags
);
1805 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1807 newline_and_indent (buffer
, spc
+ 2);
1808 pp_left_brace (buffer
);
1809 pp_newline (buffer
);
1810 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1811 newline_and_indent (buffer
, spc
+ 2);
1812 pp_right_brace (buffer
);
1817 /* Dump a GIMPLE_OMP_ORDERED tuple on the pretty_printer BUFFER. */
1820 dump_gimple_omp_ordered (pretty_printer
*buffer
, gomp_ordered
*gs
,
1821 int spc
, dump_flags_t flags
)
1823 if (flags
& TDF_RAW
)
1824 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1825 gimple_omp_body (gs
));
1828 pp_string (buffer
, "#pragma omp ordered");
1829 dump_omp_clauses (buffer
, gimple_omp_ordered_clauses (gs
), spc
, flags
);
1830 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1832 newline_and_indent (buffer
, spc
+ 2);
1833 pp_left_brace (buffer
);
1834 pp_newline (buffer
);
1835 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1836 newline_and_indent (buffer
, spc
+ 2);
1837 pp_right_brace (buffer
);
1842 /* Dump a GIMPLE_OMP_RETURN tuple on the pretty_printer BUFFER. */
1845 dump_gimple_omp_return (pretty_printer
*buffer
, gimple
*gs
, int spc
,
1848 if (flags
& TDF_RAW
)
1850 dump_gimple_fmt (buffer
, spc
, flags
, "%G <nowait=%d", gs
,
1851 (int) gimple_omp_return_nowait_p (gs
));
1852 if (gimple_omp_return_lhs (gs
))
1853 dump_gimple_fmt (buffer
, spc
, flags
, ", lhs=%T>",
1854 gimple_omp_return_lhs (gs
));
1856 dump_gimple_fmt (buffer
, spc
, flags
, ">");
1860 pp_string (buffer
, "#pragma omp return");
1861 if (gimple_omp_return_nowait_p (gs
))
1862 pp_string (buffer
, "(nowait)");
1863 if (gimple_omp_return_lhs (gs
))
1865 pp_string (buffer
, " (set ");
1866 dump_generic_node (buffer
, gimple_omp_return_lhs (gs
),
1868 pp_character (buffer
, ')');
1873 /* Dump a GIMPLE_TRANSACTION tuple on the pretty_printer BUFFER. */
1876 dump_gimple_transaction (pretty_printer
*buffer
, gtransaction
*gs
,
1877 int spc
, dump_flags_t flags
)
1879 unsigned subcode
= gimple_transaction_subcode (gs
);
1881 if (flags
& TDF_RAW
)
1883 dump_gimple_fmt (buffer
, spc
, flags
,
1884 "%G [SUBCODE=%x,NORM=%T,UNINST=%T,OVER=%T] "
1886 gs
, subcode
, gimple_transaction_label_norm (gs
),
1887 gimple_transaction_label_uninst (gs
),
1888 gimple_transaction_label_over (gs
),
1889 gimple_transaction_body (gs
));
1893 if (subcode
& GTMA_IS_OUTER
)
1894 pp_string (buffer
, "__transaction_atomic [[outer]]");
1895 else if (subcode
& GTMA_IS_RELAXED
)
1896 pp_string (buffer
, "__transaction_relaxed");
1898 pp_string (buffer
, "__transaction_atomic");
1899 subcode
&= ~GTMA_DECLARATION_MASK
;
1901 if (gimple_transaction_body (gs
))
1903 newline_and_indent (buffer
, spc
+ 2);
1904 pp_left_brace (buffer
);
1905 pp_newline (buffer
);
1906 dump_gimple_seq (buffer
, gimple_transaction_body (gs
),
1908 newline_and_indent (buffer
, spc
+ 2);
1909 pp_right_brace (buffer
);
1913 pp_string (buffer
, " //");
1914 if (gimple_transaction_label_norm (gs
))
1916 pp_string (buffer
, " NORM=");
1917 dump_generic_node (buffer
, gimple_transaction_label_norm (gs
),
1920 if (gimple_transaction_label_uninst (gs
))
1922 pp_string (buffer
, " UNINST=");
1923 dump_generic_node (buffer
, gimple_transaction_label_uninst (gs
),
1926 if (gimple_transaction_label_over (gs
))
1928 pp_string (buffer
, " OVER=");
1929 dump_generic_node (buffer
, gimple_transaction_label_over (gs
),
1934 pp_string (buffer
, " SUBCODE=[ ");
1935 if (subcode
& GTMA_HAVE_ABORT
)
1937 pp_string (buffer
, "GTMA_HAVE_ABORT ");
1938 subcode
&= ~GTMA_HAVE_ABORT
;
1940 if (subcode
& GTMA_HAVE_LOAD
)
1942 pp_string (buffer
, "GTMA_HAVE_LOAD ");
1943 subcode
&= ~GTMA_HAVE_LOAD
;
1945 if (subcode
& GTMA_HAVE_STORE
)
1947 pp_string (buffer
, "GTMA_HAVE_STORE ");
1948 subcode
&= ~GTMA_HAVE_STORE
;
1950 if (subcode
& GTMA_MAY_ENTER_IRREVOCABLE
)
1952 pp_string (buffer
, "GTMA_MAY_ENTER_IRREVOCABLE ");
1953 subcode
&= ~GTMA_MAY_ENTER_IRREVOCABLE
;
1955 if (subcode
& GTMA_DOES_GO_IRREVOCABLE
)
1957 pp_string (buffer
, "GTMA_DOES_GO_IRREVOCABLE ");
1958 subcode
&= ~GTMA_DOES_GO_IRREVOCABLE
;
1960 if (subcode
& GTMA_HAS_NO_INSTRUMENTATION
)
1962 pp_string (buffer
, "GTMA_HAS_NO_INSTRUMENTATION ");
1963 subcode
&= ~GTMA_HAS_NO_INSTRUMENTATION
;
1966 pp_printf (buffer
, "0x%x ", subcode
);
1967 pp_right_bracket (buffer
);
1973 /* Dump a GIMPLE_ASM tuple on the pretty_printer BUFFER, SPC spaces of
1974 indent. FLAGS specifies details to show in the dump (see TDF_* in
1978 dump_gimple_asm (pretty_printer
*buffer
, gasm
*gs
, int spc
, dump_flags_t flags
)
1980 unsigned int i
, n
, f
, fields
;
1982 if (flags
& TDF_RAW
)
1984 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+STRING <%n%s%n>", gs
,
1985 gimple_asm_string (gs
));
1987 n
= gimple_asm_noutputs (gs
);
1990 newline_and_indent (buffer
, spc
+ 2);
1991 pp_string (buffer
, "OUTPUT: ");
1992 for (i
= 0; i
< n
; i
++)
1994 dump_generic_node (buffer
, gimple_asm_output_op (gs
, i
),
1997 pp_string (buffer
, ", ");
2001 n
= gimple_asm_ninputs (gs
);
2004 newline_and_indent (buffer
, spc
+ 2);
2005 pp_string (buffer
, "INPUT: ");
2006 for (i
= 0; i
< n
; i
++)
2008 dump_generic_node (buffer
, gimple_asm_input_op (gs
, i
),
2011 pp_string (buffer
, ", ");
2015 n
= gimple_asm_nclobbers (gs
);
2018 newline_and_indent (buffer
, spc
+ 2);
2019 pp_string (buffer
, "CLOBBER: ");
2020 for (i
= 0; i
< n
; i
++)
2022 dump_generic_node (buffer
, gimple_asm_clobber_op (gs
, i
),
2025 pp_string (buffer
, ", ");
2029 n
= gimple_asm_nlabels (gs
);
2032 newline_and_indent (buffer
, spc
+ 2);
2033 pp_string (buffer
, "LABEL: ");
2034 for (i
= 0; i
< n
; i
++)
2036 dump_generic_node (buffer
, gimple_asm_label_op (gs
, i
),
2039 pp_string (buffer
, ", ");
2043 newline_and_indent (buffer
, spc
);
2044 pp_greater (buffer
);
2048 pp_string (buffer
, "__asm__");
2049 if (gimple_asm_volatile_p (gs
))
2050 pp_string (buffer
, " __volatile__");
2051 if (gimple_asm_inline_p (gs
))
2052 pp_string (buffer
, " __inline__");
2053 if (gimple_asm_nlabels (gs
))
2054 pp_string (buffer
, " goto");
2055 pp_string (buffer
, "(\"");
2056 pp_string (buffer
, gimple_asm_string (gs
));
2057 pp_string (buffer
, "\"");
2059 if (gimple_asm_nlabels (gs
))
2061 else if (gimple_asm_nclobbers (gs
))
2063 else if (gimple_asm_ninputs (gs
))
2065 else if (gimple_asm_noutputs (gs
))
2070 for (f
= 0; f
< fields
; ++f
)
2072 pp_string (buffer
, " : ");
2077 n
= gimple_asm_noutputs (gs
);
2078 for (i
= 0; i
< n
; i
++)
2080 dump_generic_node (buffer
, gimple_asm_output_op (gs
, i
),
2083 pp_string (buffer
, ", ");
2088 n
= gimple_asm_ninputs (gs
);
2089 for (i
= 0; i
< n
; i
++)
2091 dump_generic_node (buffer
, gimple_asm_input_op (gs
, i
),
2094 pp_string (buffer
, ", ");
2099 n
= gimple_asm_nclobbers (gs
);
2100 for (i
= 0; i
< n
; i
++)
2102 dump_generic_node (buffer
, gimple_asm_clobber_op (gs
, i
),
2105 pp_string (buffer
, ", ");
2110 n
= gimple_asm_nlabels (gs
);
2111 for (i
= 0; i
< n
; i
++)
2113 dump_generic_node (buffer
, gimple_asm_label_op (gs
, i
),
2116 pp_string (buffer
, ", ");
2125 pp_string (buffer
, ");");
2129 /* Dump ptr_info and range_info for NODE on pretty_printer BUFFER with
2130 SPC spaces of indent. */
2133 dump_ssaname_info (pretty_printer
*buffer
, tree node
, int spc
)
2135 if (TREE_CODE (node
) != SSA_NAME
)
2138 if (POINTER_TYPE_P (TREE_TYPE (node
))
2139 && SSA_NAME_PTR_INFO (node
))
2141 unsigned int align
, misalign
;
2142 struct ptr_info_def
*pi
= SSA_NAME_PTR_INFO (node
);
2143 pp_string (buffer
, "# PT = ");
2144 pp_points_to_solution (buffer
, &pi
->pt
);
2145 newline_and_indent (buffer
, spc
);
2146 if (get_ptr_info_alignment (pi
, &align
, &misalign
))
2148 pp_printf (buffer
, "# ALIGN = %u, MISALIGN = %u", align
, misalign
);
2149 newline_and_indent (buffer
, spc
);
2153 if (!POINTER_TYPE_P (TREE_TYPE (node
))
2154 && SSA_NAME_RANGE_INFO (node
))
2156 wide_int min
, max
, nonzero_bits
;
2157 value_range_kind range_type
= get_range_info (node
, &min
, &max
);
2159 if (range_type
== VR_VARYING
)
2160 pp_printf (buffer
, "# RANGE VR_VARYING");
2161 else if (range_type
== VR_RANGE
|| range_type
== VR_ANTI_RANGE
)
2163 pp_printf (buffer
, "# RANGE ");
2164 pp_printf (buffer
, "%s[", range_type
== VR_RANGE
? "" : "~");
2165 pp_wide_int (buffer
, min
, TYPE_SIGN (TREE_TYPE (node
)));
2166 pp_printf (buffer
, ", ");
2167 pp_wide_int (buffer
, max
, TYPE_SIGN (TREE_TYPE (node
)));
2168 pp_printf (buffer
, "]");
2170 nonzero_bits
= get_nonzero_bits (node
);
2171 if (nonzero_bits
!= -1)
2173 pp_string (buffer
, " NONZERO ");
2174 pp_wide_int (buffer
, nonzero_bits
, UNSIGNED
);
2176 newline_and_indent (buffer
, spc
);
2180 /* As dump_ssaname_info, but dump to FILE. */
2183 dump_ssaname_info_to_file (FILE *file
, tree node
, int spc
)
2185 pretty_printer buffer
;
2186 pp_needs_newline (&buffer
) = true;
2187 buffer
.buffer
->stream
= file
;
2188 dump_ssaname_info (&buffer
, node
, spc
);
2192 /* Dump a PHI node PHI. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1.
2193 The caller is responsible for calling pp_flush on BUFFER to finalize
2194 pretty printer. If COMMENT is true, print this after #. */
2197 dump_gimple_phi (pretty_printer
*buffer
, gphi
*phi
, int spc
, bool comment
,
2201 tree lhs
= gimple_phi_result (phi
);
2203 if (flags
& TDF_ALIAS
)
2204 dump_ssaname_info (buffer
, lhs
, spc
);
2207 pp_string (buffer
, "# ");
2209 if (flags
& TDF_RAW
)
2210 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, ", phi
,
2211 gimple_phi_result (phi
));
2214 dump_generic_node (buffer
, lhs
, spc
, flags
, false);
2215 if (flags
& TDF_GIMPLE
)
2216 pp_string (buffer
, " = __PHI (");
2218 pp_string (buffer
, " = PHI <");
2220 for (i
= 0; i
< gimple_phi_num_args (phi
); i
++)
2222 if ((flags
& TDF_LINENO
) && gimple_phi_arg_has_location (phi
, i
))
2223 dump_location (buffer
, gimple_phi_arg_location (phi
, i
));
2224 if (flags
& TDF_GIMPLE
)
2226 basic_block src
= gimple_phi_arg_edge (phi
, i
)->src
;
2227 gimple
*stmt
= first_stmt (src
);
2228 if (!stmt
|| gimple_code (stmt
) != GIMPLE_LABEL
)
2230 pp_string (buffer
, "bb_");
2231 pp_decimal_int (buffer
, src
->index
);
2234 dump_generic_node (buffer
, gimple_label_label (as_a
<glabel
*> (stmt
)), 0, flags
,
2236 pp_string (buffer
, ": ");
2238 dump_generic_node (buffer
, gimple_phi_arg_def (phi
, i
), spc
, flags
,
2240 if (! (flags
& TDF_GIMPLE
))
2242 pp_left_paren (buffer
);
2243 pp_decimal_int (buffer
, gimple_phi_arg_edge (phi
, i
)->src
->index
);
2244 pp_right_paren (buffer
);
2246 if (i
< gimple_phi_num_args (phi
) - 1)
2247 pp_string (buffer
, ", ");
2249 if (flags
& TDF_GIMPLE
)
2250 pp_string (buffer
, ");");
2252 pp_greater (buffer
);
2256 /* Dump a GIMPLE_OMP_PARALLEL tuple on the pretty_printer BUFFER, SPC spaces
2257 of indent. FLAGS specifies details to show in the dump (see TDF_* in
2261 dump_gimple_omp_parallel (pretty_printer
*buffer
, gomp_parallel
*gs
,
2262 int spc
, dump_flags_t flags
)
2264 if (flags
& TDF_RAW
)
2266 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
2267 gimple_omp_body (gs
));
2268 dump_omp_clauses (buffer
, gimple_omp_parallel_clauses (gs
), spc
, flags
);
2269 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T%n>",
2270 gimple_omp_parallel_child_fn (gs
),
2271 gimple_omp_parallel_data_arg (gs
));
2276 pp_string (buffer
, "#pragma omp parallel");
2277 dump_omp_clauses (buffer
, gimple_omp_parallel_clauses (gs
), spc
, flags
);
2278 if (gimple_omp_parallel_child_fn (gs
))
2280 pp_string (buffer
, " [child fn: ");
2281 dump_generic_node (buffer
, gimple_omp_parallel_child_fn (gs
),
2283 pp_string (buffer
, " (");
2284 if (gimple_omp_parallel_data_arg (gs
))
2285 dump_generic_node (buffer
, gimple_omp_parallel_data_arg (gs
),
2288 pp_string (buffer
, "???");
2289 pp_string (buffer
, ")]");
2291 body
= gimple_omp_body (gs
);
2292 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
2294 newline_and_indent (buffer
, spc
+ 2);
2295 pp_left_brace (buffer
);
2296 pp_newline (buffer
);
2297 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
2298 newline_and_indent (buffer
, spc
+ 2);
2299 pp_right_brace (buffer
);
2303 pp_newline (buffer
);
2304 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
2310 /* Dump a GIMPLE_OMP_TASK tuple on the pretty_printer BUFFER, SPC spaces
2311 of indent. FLAGS specifies details to show in the dump (see TDF_* in
2315 dump_gimple_omp_task (pretty_printer
*buffer
, gomp_task
*gs
, int spc
,
2318 if (flags
& TDF_RAW
)
2320 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
2321 gimple_omp_body (gs
));
2322 dump_omp_clauses (buffer
, gimple_omp_task_clauses (gs
), spc
, flags
);
2323 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T, %T, %T, %T%n>",
2324 gimple_omp_task_child_fn (gs
),
2325 gimple_omp_task_data_arg (gs
),
2326 gimple_omp_task_copy_fn (gs
),
2327 gimple_omp_task_arg_size (gs
),
2328 gimple_omp_task_arg_size (gs
));
2333 if (gimple_omp_task_taskloop_p (gs
))
2334 pp_string (buffer
, "#pragma omp taskloop");
2335 else if (gimple_omp_task_taskwait_p (gs
))
2336 pp_string (buffer
, "#pragma omp taskwait");
2338 pp_string (buffer
, "#pragma omp task");
2339 dump_omp_clauses (buffer
, gimple_omp_task_clauses (gs
), spc
, flags
);
2340 if (gimple_omp_task_child_fn (gs
))
2342 pp_string (buffer
, " [child fn: ");
2343 dump_generic_node (buffer
, gimple_omp_task_child_fn (gs
),
2345 pp_string (buffer
, " (");
2346 if (gimple_omp_task_data_arg (gs
))
2347 dump_generic_node (buffer
, gimple_omp_task_data_arg (gs
),
2350 pp_string (buffer
, "???");
2351 pp_string (buffer
, ")]");
2353 body
= gimple_omp_body (gs
);
2354 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
2356 newline_and_indent (buffer
, spc
+ 2);
2357 pp_left_brace (buffer
);
2358 pp_newline (buffer
);
2359 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
2360 newline_and_indent (buffer
, spc
+ 2);
2361 pp_right_brace (buffer
);
2365 pp_newline (buffer
);
2366 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
2372 /* Dump a GIMPLE_OMP_ATOMIC_LOAD tuple on the pretty_printer BUFFER, SPC
2373 spaces of indent. FLAGS specifies details to show in the dump (see TDF_*
2377 dump_gimple_omp_atomic_load (pretty_printer
*buffer
, gomp_atomic_load
*gs
,
2378 int spc
, dump_flags_t flags
)
2380 if (flags
& TDF_RAW
)
2382 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T>", gs
,
2383 gimple_omp_atomic_load_lhs (gs
),
2384 gimple_omp_atomic_load_rhs (gs
));
2388 pp_string (buffer
, "#pragma omp atomic_load");
2389 dump_omp_atomic_memory_order (buffer
,
2390 gimple_omp_atomic_memory_order (gs
));
2391 if (gimple_omp_atomic_need_value_p (gs
))
2392 pp_string (buffer
, " [needed]");
2393 newline_and_indent (buffer
, spc
+ 2);
2394 dump_generic_node (buffer
, gimple_omp_atomic_load_lhs (gs
),
2400 dump_generic_node (buffer
, gimple_omp_atomic_load_rhs (gs
),
2405 /* Dump a GIMPLE_OMP_ATOMIC_STORE tuple on the pretty_printer BUFFER, SPC
2406 spaces of indent. FLAGS specifies details to show in the dump (see TDF_*
2410 dump_gimple_omp_atomic_store (pretty_printer
*buffer
,
2411 gomp_atomic_store
*gs
, int spc
,
2414 if (flags
& TDF_RAW
)
2416 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
,
2417 gimple_omp_atomic_store_val (gs
));
2421 pp_string (buffer
, "#pragma omp atomic_store");
2422 dump_omp_atomic_memory_order (buffer
,
2423 gimple_omp_atomic_memory_order (gs
));
2425 if (gimple_omp_atomic_need_value_p (gs
))
2426 pp_string (buffer
, "[needed] ");
2427 pp_left_paren (buffer
);
2428 dump_generic_node (buffer
, gimple_omp_atomic_store_val (gs
),
2430 pp_right_paren (buffer
);
2435 /* Dump all the memory operands for statement GS. BUFFER, SPC and
2436 FLAGS are as in pp_gimple_stmt_1. */
2439 dump_gimple_mem_ops (pretty_printer
*buffer
, gimple
*gs
, int spc
,
2442 tree vdef
= gimple_vdef (gs
);
2443 tree vuse
= gimple_vuse (gs
);
2445 if (vdef
!= NULL_TREE
)
2447 pp_string (buffer
, "# ");
2448 dump_generic_node (buffer
, vdef
, spc
+ 2, flags
, false);
2449 pp_string (buffer
, " = VDEF <");
2450 dump_generic_node (buffer
, vuse
, spc
+ 2, flags
, false);
2451 pp_greater (buffer
);
2452 newline_and_indent (buffer
, spc
);
2454 else if (vuse
!= NULL_TREE
)
2456 pp_string (buffer
, "# VUSE <");
2457 dump_generic_node (buffer
, vuse
, spc
+ 2, flags
, false);
2458 pp_greater (buffer
);
2459 newline_and_indent (buffer
, spc
);
2464 /* Print the gimple statement GS on the pretty printer BUFFER, SPC
2465 spaces of indent. FLAGS specifies details to show in the dump (see
2466 TDF_* in dumpfile.h). The caller is responsible for calling
2467 pp_flush on BUFFER to finalize the pretty printer. */
2470 pp_gimple_stmt_1 (pretty_printer
*buffer
, gimple
*gs
, int spc
,
2476 if (flags
& TDF_STMTADDR
)
2477 pp_printf (buffer
, "<&%p> ", (void *) gs
);
2479 if ((flags
& TDF_LINENO
) && gimple_has_location (gs
))
2480 dump_location (buffer
, gimple_location (gs
));
2484 int lp_nr
= lookup_stmt_eh_lp (gs
);
2486 pp_printf (buffer
, "[LP %d] ", lp_nr
);
2488 pp_printf (buffer
, "[MNT %d] ", -lp_nr
);
2491 if ((flags
& (TDF_VOPS
|TDF_MEMSYMS
))
2492 && gimple_has_mem_ops (gs
))
2493 dump_gimple_mem_ops (buffer
, gs
, spc
, flags
);
2495 if (gimple_has_lhs (gs
)
2496 && (flags
& TDF_ALIAS
))
2497 dump_ssaname_info (buffer
, gimple_get_lhs (gs
), spc
);
2499 switch (gimple_code (gs
))
2502 dump_gimple_asm (buffer
, as_a
<gasm
*> (gs
), spc
, flags
);
2506 dump_gimple_assign (buffer
, as_a
<gassign
*> (gs
), spc
, flags
);
2510 dump_gimple_bind (buffer
, as_a
<gbind
*> (gs
), spc
, flags
);
2514 dump_gimple_call (buffer
, as_a
<gcall
*> (gs
), spc
, flags
);
2518 dump_gimple_cond (buffer
, as_a
<gcond
*> (gs
), spc
, flags
);
2522 dump_gimple_label (buffer
, as_a
<glabel
*> (gs
), spc
, flags
);
2526 dump_gimple_goto (buffer
, as_a
<ggoto
*> (gs
), spc
, flags
);
2530 pp_string (buffer
, "GIMPLE_NOP");
2534 dump_gimple_return (buffer
, as_a
<greturn
*> (gs
), spc
, flags
);
2538 dump_gimple_switch (buffer
, as_a
<gswitch
*> (gs
), spc
, flags
);
2542 dump_gimple_try (buffer
, as_a
<gtry
*> (gs
), spc
, flags
);
2546 dump_gimple_phi (buffer
, as_a
<gphi
*> (gs
), spc
, false, flags
);
2549 case GIMPLE_OMP_PARALLEL
:
2550 dump_gimple_omp_parallel (buffer
, as_a
<gomp_parallel
*> (gs
), spc
,
2554 case GIMPLE_OMP_TASK
:
2555 dump_gimple_omp_task (buffer
, as_a
<gomp_task
*> (gs
), spc
, flags
);
2558 case GIMPLE_OMP_ATOMIC_LOAD
:
2559 dump_gimple_omp_atomic_load (buffer
, as_a
<gomp_atomic_load
*> (gs
),
2563 case GIMPLE_OMP_ATOMIC_STORE
:
2564 dump_gimple_omp_atomic_store (buffer
,
2565 as_a
<gomp_atomic_store
*> (gs
),
2569 case GIMPLE_OMP_FOR
:
2570 dump_gimple_omp_for (buffer
, as_a
<gomp_for
*> (gs
), spc
, flags
);
2573 case GIMPLE_OMP_CONTINUE
:
2574 dump_gimple_omp_continue (buffer
, as_a
<gomp_continue
*> (gs
), spc
,
2578 case GIMPLE_OMP_SINGLE
:
2579 dump_gimple_omp_single (buffer
, as_a
<gomp_single
*> (gs
), spc
,
2583 case GIMPLE_OMP_TARGET
:
2584 dump_gimple_omp_target (buffer
, as_a
<gomp_target
*> (gs
), spc
,
2588 case GIMPLE_OMP_TEAMS
:
2589 dump_gimple_omp_teams (buffer
, as_a
<gomp_teams
*> (gs
), spc
,
2593 case GIMPLE_OMP_RETURN
:
2594 dump_gimple_omp_return (buffer
, gs
, spc
, flags
);
2597 case GIMPLE_OMP_SECTIONS
:
2598 dump_gimple_omp_sections (buffer
, as_a
<gomp_sections
*> (gs
),
2602 case GIMPLE_OMP_SECTIONS_SWITCH
:
2603 pp_string (buffer
, "GIMPLE_SECTIONS_SWITCH");
2606 case GIMPLE_OMP_TASKGROUP
:
2607 dump_gimple_omp_taskgroup (buffer
, gs
, spc
, flags
);
2610 case GIMPLE_OMP_MASTER
:
2611 case GIMPLE_OMP_SECTION
:
2612 case GIMPLE_OMP_GRID_BODY
:
2613 dump_gimple_omp_block (buffer
, gs
, spc
, flags
);
2616 case GIMPLE_OMP_ORDERED
:
2617 dump_gimple_omp_ordered (buffer
, as_a
<gomp_ordered
*> (gs
), spc
,
2621 case GIMPLE_OMP_CRITICAL
:
2622 dump_gimple_omp_critical (buffer
, as_a
<gomp_critical
*> (gs
), spc
,
2627 dump_gimple_catch (buffer
, as_a
<gcatch
*> (gs
), spc
, flags
);
2630 case GIMPLE_EH_FILTER
:
2631 dump_gimple_eh_filter (buffer
, as_a
<geh_filter
*> (gs
), spc
, flags
);
2634 case GIMPLE_EH_MUST_NOT_THROW
:
2635 dump_gimple_eh_must_not_throw (buffer
,
2636 as_a
<geh_mnt
*> (gs
),
2640 case GIMPLE_EH_ELSE
:
2641 dump_gimple_eh_else (buffer
, as_a
<geh_else
*> (gs
), spc
, flags
);
2645 dump_gimple_resx (buffer
, as_a
<gresx
*> (gs
), spc
, flags
);
2648 case GIMPLE_EH_DISPATCH
:
2649 dump_gimple_eh_dispatch (buffer
, as_a
<geh_dispatch
*> (gs
), spc
,
2654 dump_gimple_debug (buffer
, as_a
<gdebug
*> (gs
), spc
, flags
);
2657 case GIMPLE_PREDICT
:
2658 pp_string (buffer
, "// predicted ");
2659 if (gimple_predict_outcome (gs
))
2660 pp_string (buffer
, "likely by ");
2662 pp_string (buffer
, "unlikely by ");
2663 pp_string (buffer
, predictor_name (gimple_predict_predictor (gs
)));
2664 pp_string (buffer
, " predictor.");
2667 case GIMPLE_TRANSACTION
:
2668 dump_gimple_transaction (buffer
, as_a
<gtransaction
*> (gs
), spc
,
2678 /* Dumps header of basic block BB to OUTF indented by INDENT
2679 spaces and details described by flags. */
2682 dump_gimple_bb_header (FILE *outf
, basic_block bb
, int indent
,
2685 if (flags
& TDF_BLOCKS
)
2687 if (flags
& TDF_LINENO
)
2689 gimple_stmt_iterator gsi
;
2691 fputs (";; ", outf
);
2693 for (gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
); gsi_next (&gsi
))
2694 if (!is_gimple_debug (gsi_stmt (gsi
))
2695 && get_lineno (gsi_stmt (gsi
)) != UNKNOWN_LOCATION
)
2697 fprintf (outf
, "%*sstarting at line %d",
2698 indent
, "", get_lineno (gsi_stmt (gsi
)));
2701 if (bb
->discriminator
)
2702 fprintf (outf
, ", discriminator %i", bb
->discriminator
);
2708 if (flags
& TDF_GIMPLE
)
2709 fprintf (outf
, "%*sbb_%d:\n", indent
, "", bb
->index
);
2711 fprintf (outf
, "%*s<bb %d> %s:\n",
2712 indent
, "", bb
->index
, dump_profile (bb
->count
));
2717 /* Dumps end of basic block BB to buffer BUFFER indented by INDENT
2721 dump_gimple_bb_footer (FILE *outf ATTRIBUTE_UNUSED
,
2722 basic_block bb ATTRIBUTE_UNUSED
,
2723 int indent ATTRIBUTE_UNUSED
,
2724 dump_flags_t flags ATTRIBUTE_UNUSED
)
2726 /* There is currently no GIMPLE-specific basic block info to dump. */
2731 /* Dump PHI nodes of basic block BB to BUFFER with details described
2732 by FLAGS and indented by INDENT spaces. */
2735 dump_phi_nodes (pretty_printer
*buffer
, basic_block bb
, int indent
,
2740 for (i
= gsi_start_phis (bb
); !gsi_end_p (i
); gsi_next (&i
))
2742 gphi
*phi
= i
.phi ();
2743 if (!virtual_operand_p (gimple_phi_result (phi
)) || (flags
& TDF_VOPS
))
2746 dump_gimple_phi (buffer
, phi
, indent
,
2747 (flags
& TDF_GIMPLE
) ? false : true, flags
);
2748 pp_newline (buffer
);
2754 /* Dump jump to basic block BB that is represented implicitly in the cfg
2758 pp_cfg_jump (pretty_printer
*buffer
, edge e
, dump_flags_t flags
)
2760 if (flags
& TDF_GIMPLE
)
2762 pp_string (buffer
, "goto bb_");
2763 pp_decimal_int (buffer
, e
->dest
->index
);
2764 pp_semicolon (buffer
);
2768 pp_string (buffer
, "goto <bb ");
2769 pp_decimal_int (buffer
, e
->dest
->index
);
2770 pp_greater (buffer
);
2771 pp_semicolon (buffer
);
2773 dump_edge_probability (buffer
, e
);
2778 /* Dump edges represented implicitly in basic block BB to BUFFER, indented
2779 by INDENT spaces, with details given by FLAGS. */
2782 dump_implicit_edges (pretty_printer
*buffer
, basic_block bb
, int indent
,
2788 stmt
= last_stmt (bb
);
2790 if (stmt
&& gimple_code (stmt
) == GIMPLE_COND
)
2792 edge true_edge
, false_edge
;
2794 /* When we are emitting the code or changing CFG, it is possible that
2795 the edges are not yet created. When we are using debug_bb in such
2796 a situation, we do not want it to crash. */
2797 if (EDGE_COUNT (bb
->succs
) != 2)
2799 extract_true_false_edges_from_block (bb
, &true_edge
, &false_edge
);
2801 INDENT (indent
+ 2);
2802 pp_cfg_jump (buffer
, true_edge
, flags
);
2803 newline_and_indent (buffer
, indent
);
2804 pp_string (buffer
, "else");
2805 newline_and_indent (buffer
, indent
+ 2);
2806 pp_cfg_jump (buffer
, false_edge
, flags
);
2807 pp_newline (buffer
);
2811 /* If there is a fallthru edge, we may need to add an artificial
2812 goto to the dump. */
2813 e
= find_fallthru_edge (bb
->succs
);
2815 if (e
&& e
->dest
!= bb
->next_bb
)
2819 if ((flags
& TDF_LINENO
)
2820 && e
->goto_locus
!= UNKNOWN_LOCATION
)
2821 dump_location (buffer
, e
->goto_locus
);
2823 pp_cfg_jump (buffer
, e
, flags
);
2824 pp_newline (buffer
);
2829 /* Dumps basic block BB to buffer BUFFER with details described by FLAGS and
2830 indented by INDENT spaces. */
2833 gimple_dump_bb_buff (pretty_printer
*buffer
, basic_block bb
, int indent
,
2836 gimple_stmt_iterator gsi
;
2838 int label_indent
= indent
- 2;
2840 if (label_indent
< 0)
2843 dump_phi_nodes (buffer
, bb
, indent
, flags
);
2845 for (gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
); gsi_next (&gsi
))
2849 stmt
= gsi_stmt (gsi
);
2851 curr_indent
= gimple_code (stmt
) == GIMPLE_LABEL
? label_indent
: indent
;
2853 INDENT (curr_indent
);
2854 pp_gimple_stmt_1 (buffer
, stmt
, curr_indent
, flags
);
2855 pp_newline_and_flush (buffer
);
2856 gcc_checking_assert (DECL_STRUCT_FUNCTION (current_function_decl
));
2857 dump_histograms_for_stmt (DECL_STRUCT_FUNCTION (current_function_decl
),
2858 pp_buffer (buffer
)->stream
, stmt
);
2861 dump_implicit_edges (buffer
, bb
, indent
, flags
);
2866 /* Dumps basic block BB to FILE with details described by FLAGS and
2867 indented by INDENT spaces. */
2870 gimple_dump_bb (FILE *file
, basic_block bb
, int indent
, dump_flags_t flags
)
2872 dump_gimple_bb_header (file
, bb
, indent
, flags
);
2873 if (bb
->index
>= NUM_FIXED_BLOCKS
)
2875 pretty_printer buffer
;
2876 pp_needs_newline (&buffer
) = true;
2877 buffer
.buffer
->stream
= file
;
2878 gimple_dump_bb_buff (&buffer
, bb
, indent
, flags
);
2880 dump_gimple_bb_footer (file
, bb
, indent
, flags
);
2883 /* Dumps basic block BB to pretty-printer PP with default dump flags and
2884 no indentation, for use as a label of a DOT graph record-node.
2885 ??? Should just use gimple_dump_bb_buff here, except that value profiling
2886 histogram dumping doesn't know about pretty-printers. */
2889 gimple_dump_bb_for_graph (pretty_printer
*pp
, basic_block bb
)
2891 pp_printf (pp
, "<bb %d>:\n", bb
->index
);
2892 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
2894 for (gphi_iterator gsi
= gsi_start_phis (bb
); !gsi_end_p (gsi
);
2897 gphi
*phi
= gsi
.phi ();
2898 if (!virtual_operand_p (gimple_phi_result (phi
))
2899 || (dump_flags
& TDF_VOPS
))
2902 pp_write_text_to_stream (pp
);
2903 pp_string (pp
, "# ");
2904 pp_gimple_stmt_1 (pp
, phi
, 0, dump_flags
);
2906 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
2910 for (gimple_stmt_iterator gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
);
2913 gimple
*stmt
= gsi_stmt (gsi
);
2915 pp_write_text_to_stream (pp
);
2916 pp_gimple_stmt_1 (pp
, stmt
, 0, dump_flags
);
2918 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
2920 dump_implicit_edges (pp
, bb
, 0, dump_flags
);
2921 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
2925 /* Handle the %G format for TEXT. Same as %K in handle_K_format in
2926 tree-pretty-print.c but with a Gimple statement as an argument. */
2929 percent_G_format (text_info
*text
)
2931 gimple
*stmt
= va_arg (*text
->args_ptr
, gimple
*);
2933 tree block
= gimple_block (stmt
);
2934 percent_K_format (text
, gimple_location (stmt
), block
);