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
);
651 t2
= gimple_return_retbnd (gs
);
653 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T %T>", gs
, t
, t2
);
656 pp_string (buffer
, "return");
660 dump_generic_node (buffer
, t
, spc
, flags
, false);
664 pp_string (buffer
, ", ");
665 dump_generic_node (buffer
, t2
, spc
, flags
, false);
667 pp_semicolon (buffer
);
672 /* Dump the call arguments for a gimple call. BUFFER, FLAGS are as in
676 dump_gimple_call_args (pretty_printer
*buffer
, gcall
*gs
, dump_flags_t flags
)
680 /* Pretty print first arg to certain internal fns. */
681 if (gimple_call_internal_p (gs
))
683 const char *const *enums
= NULL
;
686 switch (gimple_call_internal_fn (gs
))
690 static const char *const unique_args
[] = {IFN_UNIQUE_CODES
};
694 limit
= ARRAY_SIZE (unique_args
);
699 static const char *const loop_args
[] = {IFN_GOACC_LOOP_CODES
};
702 limit
= ARRAY_SIZE (loop_args
);
705 case IFN_GOACC_REDUCTION
:
707 static const char *const reduction_args
[]
708 = {IFN_GOACC_REDUCTION_CODES
};
710 enums
= reduction_args
;
711 limit
= ARRAY_SIZE (reduction_args
);
716 static const char *const asan_mark_args
[] = {IFN_ASAN_MARK_FLAGS
};
718 enums
= asan_mark_args
;
719 limit
= ARRAY_SIZE (asan_mark_args
);
727 tree arg0
= gimple_call_arg (gs
, 0);
730 if (TREE_CODE (arg0
) == INTEGER_CST
731 && tree_fits_shwi_p (arg0
)
732 && (v
= tree_to_shwi (arg0
)) >= 0 && v
< limit
)
735 pp_string (buffer
, enums
[v
]);
740 for (; i
< gimple_call_num_args (gs
); i
++)
743 pp_string (buffer
, ", ");
744 dump_generic_node (buffer
, gimple_call_arg (gs
, i
), 0, flags
, false);
747 if (gimple_call_va_arg_pack_p (gs
))
750 pp_string (buffer
, ", ");
752 pp_string (buffer
, "__builtin_va_arg_pack ()");
756 /* Dump the points-to solution *PT to BUFFER. */
759 pp_points_to_solution (pretty_printer
*buffer
, struct pt_solution
*pt
)
763 pp_string (buffer
, "anything ");
767 pp_string (buffer
, "nonlocal ");
769 pp_string (buffer
, "escaped ");
771 pp_string (buffer
, "unit-escaped ");
773 pp_string (buffer
, "null ");
775 && !bitmap_empty_p (pt
->vars
))
779 pp_string (buffer
, "{ ");
780 EXECUTE_IF_SET_IN_BITMAP (pt
->vars
, 0, i
, bi
)
782 pp_string (buffer
, "D.");
783 pp_decimal_int (buffer
, i
);
786 pp_right_brace (buffer
);
787 if (pt
->vars_contains_nonlocal
788 || pt
->vars_contains_escaped
789 || pt
->vars_contains_escaped_heap
790 || pt
->vars_contains_restrict
)
792 const char *comma
= "";
793 pp_string (buffer
, " (");
794 if (pt
->vars_contains_nonlocal
)
796 pp_string (buffer
, "nonlocal");
799 if (pt
->vars_contains_escaped
)
801 pp_string (buffer
, comma
);
802 pp_string (buffer
, "escaped");
805 if (pt
->vars_contains_escaped_heap
)
807 pp_string (buffer
, comma
);
808 pp_string (buffer
, "escaped heap");
811 if (pt
->vars_contains_restrict
)
813 pp_string (buffer
, comma
);
814 pp_string (buffer
, "restrict");
817 if (pt
->vars_contains_interposable
)
819 pp_string (buffer
, comma
);
820 pp_string (buffer
, "interposable");
822 pp_string (buffer
, ")");
828 /* Dump the call statement GS. BUFFER, SPC and FLAGS are as in
832 dump_gimple_call (pretty_printer
*buffer
, gcall
*gs
, int spc
,
835 tree lhs
= gimple_call_lhs (gs
);
836 tree fn
= gimple_call_fn (gs
);
838 if (flags
& TDF_ALIAS
)
840 struct pt_solution
*pt
;
841 pt
= gimple_call_use_set (gs
);
842 if (!pt_solution_empty_p (pt
))
844 pp_string (buffer
, "# USE = ");
845 pp_points_to_solution (buffer
, pt
);
846 newline_and_indent (buffer
, spc
);
848 pt
= gimple_call_clobber_set (gs
);
849 if (!pt_solution_empty_p (pt
))
851 pp_string (buffer
, "# CLB = ");
852 pp_points_to_solution (buffer
, pt
);
853 newline_and_indent (buffer
, spc
);
859 if (gimple_call_internal_p (gs
))
860 dump_gimple_fmt (buffer
, spc
, flags
, "%G <.%s, %T", gs
,
861 internal_fn_name (gimple_call_internal_fn (gs
)), lhs
);
863 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T", gs
, fn
, lhs
);
864 if (gimple_call_num_args (gs
) > 0)
866 pp_string (buffer
, ", ");
867 dump_gimple_call_args (buffer
, gs
, flags
);
873 if (lhs
&& !(flags
& TDF_RHS_ONLY
))
875 dump_generic_node (buffer
, lhs
, spc
, flags
, false);
876 pp_string (buffer
, " =");
878 if (gimple_has_volatile_ops (gs
))
879 pp_string (buffer
, "{v}");
883 if (gimple_call_internal_p (gs
))
886 pp_string (buffer
, internal_fn_name (gimple_call_internal_fn (gs
)));
889 print_call_name (buffer
, fn
, flags
);
890 pp_string (buffer
, " (");
891 dump_gimple_call_args (buffer
, gs
, flags
);
892 pp_right_paren (buffer
);
893 if (!(flags
& TDF_RHS_ONLY
))
894 pp_semicolon (buffer
);
897 if (gimple_call_chain (gs
))
899 pp_string (buffer
, " [static-chain: ");
900 dump_generic_node (buffer
, gimple_call_chain (gs
), spc
, flags
, false);
901 pp_right_bracket (buffer
);
904 if (gimple_call_return_slot_opt_p (gs
))
905 pp_string (buffer
, " [return slot optimization]");
906 if (gimple_call_tail_p (gs
))
907 pp_string (buffer
, " [tail call]");
908 if (gimple_call_must_tail_p (gs
))
909 pp_string (buffer
, " [must tail call]");
914 /* Dump the arguments of _ITM_beginTransaction sanely. */
915 if (TREE_CODE (fn
) == ADDR_EXPR
)
916 fn
= TREE_OPERAND (fn
, 0);
917 if (TREE_CODE (fn
) == FUNCTION_DECL
&& decl_is_tm_clone (fn
))
918 pp_string (buffer
, " [tm-clone]");
919 if (TREE_CODE (fn
) == FUNCTION_DECL
920 && DECL_BUILT_IN_CLASS (fn
) == BUILT_IN_NORMAL
921 && DECL_FUNCTION_CODE (fn
) == BUILT_IN_TM_START
922 && gimple_call_num_args (gs
) > 0)
924 tree t
= gimple_call_arg (gs
, 0);
925 unsigned HOST_WIDE_INT props
;
926 gcc_assert (TREE_CODE (t
) == INTEGER_CST
);
928 pp_string (buffer
, " [ ");
930 /* Get the transaction code properties. */
931 props
= TREE_INT_CST_LOW (t
);
933 if (props
& PR_INSTRUMENTEDCODE
)
934 pp_string (buffer
, "instrumentedCode ");
935 if (props
& PR_UNINSTRUMENTEDCODE
)
936 pp_string (buffer
, "uninstrumentedCode ");
937 if (props
& PR_HASNOXMMUPDATE
)
938 pp_string (buffer
, "hasNoXMMUpdate ");
939 if (props
& PR_HASNOABORT
)
940 pp_string (buffer
, "hasNoAbort ");
941 if (props
& PR_HASNOIRREVOCABLE
)
942 pp_string (buffer
, "hasNoIrrevocable ");
943 if (props
& PR_DOESGOIRREVOCABLE
)
944 pp_string (buffer
, "doesGoIrrevocable ");
945 if (props
& PR_HASNOSIMPLEREADS
)
946 pp_string (buffer
, "hasNoSimpleReads ");
947 if (props
& PR_AWBARRIERSOMITTED
)
948 pp_string (buffer
, "awBarriersOmitted ");
949 if (props
& PR_RARBARRIERSOMITTED
)
950 pp_string (buffer
, "RaRBarriersOmitted ");
951 if (props
& PR_UNDOLOGCODE
)
952 pp_string (buffer
, "undoLogCode ");
953 if (props
& PR_PREFERUNINSTRUMENTED
)
954 pp_string (buffer
, "preferUninstrumented ");
955 if (props
& PR_EXCEPTIONBLOCK
)
956 pp_string (buffer
, "exceptionBlock ");
957 if (props
& PR_HASELSE
)
958 pp_string (buffer
, "hasElse ");
959 if (props
& PR_READONLY
)
960 pp_string (buffer
, "readOnly ");
962 pp_right_bracket (buffer
);
967 /* Dump the switch statement GS. BUFFER, SPC and FLAGS are as in
971 dump_gimple_switch (pretty_printer
*buffer
, gswitch
*gs
, int spc
,
976 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
978 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, ", gs
,
979 gimple_switch_index (gs
));
982 pp_string (buffer
, "switch (");
983 dump_generic_node (buffer
, gimple_switch_index (gs
), spc
, flags
, true);
984 if (flags
& TDF_GIMPLE
)
985 pp_string (buffer
, ") {");
987 pp_string (buffer
, ") <");
990 for (i
= 0; i
< gimple_switch_num_labels (gs
); i
++)
992 tree case_label
= gimple_switch_label (gs
, i
);
993 gcc_checking_assert (case_label
!= NULL_TREE
);
994 dump_generic_node (buffer
, case_label
, spc
, flags
, false);
996 tree label
= CASE_LABEL (case_label
);
997 dump_generic_node (buffer
, label
, spc
, flags
, false);
999 if (cfun
&& cfun
->cfg
)
1001 basic_block dest
= label_to_block (label
);
1004 edge label_edge
= find_edge (gimple_bb (gs
), dest
);
1005 if (label_edge
&& !(flags
& TDF_GIMPLE
))
1006 dump_edge_probability (buffer
, label_edge
);
1010 if (i
< gimple_switch_num_labels (gs
) - 1)
1012 if (flags
& TDF_GIMPLE
)
1013 pp_string (buffer
, "; ");
1015 pp_string (buffer
, ", ");
1018 if (flags
& TDF_GIMPLE
)
1019 pp_string (buffer
, "; }");
1021 pp_greater (buffer
);
1025 /* Dump the gimple conditional GS. BUFFER, SPC and FLAGS are as in
1026 pp_gimple_stmt_1. */
1029 dump_gimple_cond (pretty_printer
*buffer
, gcond
*gs
, int spc
,
1032 if (flags
& TDF_RAW
)
1033 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%s, %T, %T, %T, %T>", gs
,
1034 get_tree_code_name (gimple_cond_code (gs
)),
1035 gimple_cond_lhs (gs
), gimple_cond_rhs (gs
),
1036 gimple_cond_true_label (gs
), gimple_cond_false_label (gs
));
1039 if (!(flags
& TDF_RHS_ONLY
))
1040 pp_string (buffer
, "if (");
1041 dump_generic_node (buffer
, gimple_cond_lhs (gs
), spc
, flags
, false);
1043 pp_string (buffer
, op_symbol_code (gimple_cond_code (gs
)));
1045 dump_generic_node (buffer
, gimple_cond_rhs (gs
), spc
, flags
, false);
1046 if (!(flags
& TDF_RHS_ONLY
))
1049 edge e
, true_edge
= NULL
, false_edge
= NULL
;
1050 basic_block bb
= gimple_bb (gs
);
1054 FOR_EACH_EDGE (e
, ei
, bb
->succs
)
1056 if (e
->flags
& EDGE_TRUE_VALUE
)
1058 else if (e
->flags
& EDGE_FALSE_VALUE
)
1063 bool has_edge_info
= true_edge
!= NULL
&& false_edge
!= NULL
;
1065 pp_right_paren (buffer
);
1067 if (gimple_cond_true_label (gs
))
1069 pp_string (buffer
, " goto ");
1070 dump_generic_node (buffer
, gimple_cond_true_label (gs
),
1072 if (has_edge_info
&& !(flags
& TDF_GIMPLE
))
1073 dump_edge_probability (buffer
, true_edge
);
1074 pp_semicolon (buffer
);
1076 if (gimple_cond_false_label (gs
))
1078 pp_string (buffer
, " else goto ");
1079 dump_generic_node (buffer
, gimple_cond_false_label (gs
),
1081 if (has_edge_info
&& !(flags
& TDF_GIMPLE
))
1082 dump_edge_probability (buffer
, false_edge
);
1084 pp_semicolon (buffer
);
1091 /* Dump a GIMPLE_LABEL tuple on the pretty_printer BUFFER, SPC
1092 spaces of indent. FLAGS specifies details to show in the dump (see
1093 TDF_* in dumpfils.h). */
1096 dump_gimple_label (pretty_printer
*buffer
, glabel
*gs
, int spc
,
1099 tree label
= gimple_label_label (gs
);
1100 if (flags
& TDF_RAW
)
1101 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
, label
);
1104 dump_generic_node (buffer
, label
, spc
, flags
, false);
1107 if (flags
& TDF_GIMPLE
)
1109 if (DECL_NONLOCAL (label
))
1110 pp_string (buffer
, " [non-local]");
1111 if ((flags
& TDF_EH
) && EH_LANDING_PAD_NR (label
))
1112 pp_printf (buffer
, " [LP %d]", EH_LANDING_PAD_NR (label
));
1115 /* Dump a GIMPLE_GOTO tuple on the pretty_printer BUFFER, SPC
1116 spaces of indent. FLAGS specifies details to show in the dump (see
1117 TDF_* in dumpfile.h). */
1120 dump_gimple_goto (pretty_printer
*buffer
, ggoto
*gs
, int spc
,
1123 tree label
= gimple_goto_dest (gs
);
1124 if (flags
& TDF_RAW
)
1125 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
, label
);
1127 dump_gimple_fmt (buffer
, spc
, flags
, "goto %T;", label
);
1131 /* Dump a GIMPLE_BIND tuple on the pretty_printer BUFFER, SPC
1132 spaces of indent. FLAGS specifies details to show in the dump (see
1133 TDF_* in dumpfile.h). */
1136 dump_gimple_bind (pretty_printer
*buffer
, gbind
*gs
, int spc
,
1139 if (flags
& TDF_RAW
)
1140 dump_gimple_fmt (buffer
, spc
, flags
, "%G <", gs
);
1142 pp_left_brace (buffer
);
1143 if (!(flags
& TDF_SLIM
))
1147 for (var
= gimple_bind_vars (gs
); var
; var
= DECL_CHAIN (var
))
1149 newline_and_indent (buffer
, 2);
1150 print_declaration (buffer
, var
, spc
, flags
);
1152 if (gimple_bind_vars (gs
))
1153 pp_newline (buffer
);
1155 pp_newline (buffer
);
1156 dump_gimple_seq (buffer
, gimple_bind_body (gs
), spc
+ 2, flags
);
1157 newline_and_indent (buffer
, spc
);
1158 if (flags
& TDF_RAW
)
1159 pp_greater (buffer
);
1161 pp_right_brace (buffer
);
1165 /* Dump a GIMPLE_TRY tuple on the pretty_printer BUFFER, SPC spaces of
1166 indent. FLAGS specifies details to show in the dump (see TDF_* in
1170 dump_gimple_try (pretty_printer
*buffer
, gtry
*gs
, int spc
,
1173 if (flags
& TDF_RAW
)
1176 if (gimple_try_kind (gs
) == GIMPLE_TRY_CATCH
)
1177 type
= "GIMPLE_TRY_CATCH";
1178 else if (gimple_try_kind (gs
) == GIMPLE_TRY_FINALLY
)
1179 type
= "GIMPLE_TRY_FINALLY";
1181 type
= "UNKNOWN GIMPLE_TRY";
1182 dump_gimple_fmt (buffer
, spc
, flags
,
1183 "%G <%s,%+EVAL <%S>%nCLEANUP <%S>%->", gs
, type
,
1184 gimple_try_eval (gs
), gimple_try_cleanup (gs
));
1188 pp_string (buffer
, "try");
1189 newline_and_indent (buffer
, spc
+ 2);
1190 pp_left_brace (buffer
);
1191 pp_newline (buffer
);
1193 dump_gimple_seq (buffer
, gimple_try_eval (gs
), spc
+ 4, flags
);
1194 newline_and_indent (buffer
, spc
+ 2);
1195 pp_right_brace (buffer
);
1197 if (gimple_try_kind (gs
) == GIMPLE_TRY_CATCH
)
1199 newline_and_indent (buffer
, spc
);
1200 pp_string (buffer
, "catch");
1201 newline_and_indent (buffer
, spc
+ 2);
1202 pp_left_brace (buffer
);
1204 else if (gimple_try_kind (gs
) == GIMPLE_TRY_FINALLY
)
1206 newline_and_indent (buffer
, spc
);
1207 pp_string (buffer
, "finally");
1208 newline_and_indent (buffer
, spc
+ 2);
1209 pp_left_brace (buffer
);
1212 pp_string (buffer
, " <UNKNOWN GIMPLE_TRY> {");
1214 pp_newline (buffer
);
1215 dump_gimple_seq (buffer
, gimple_try_cleanup (gs
), spc
+ 4, flags
);
1216 newline_and_indent (buffer
, spc
+ 2);
1217 pp_right_brace (buffer
);
1222 /* Dump a GIMPLE_CATCH tuple on the pretty_printer BUFFER, SPC spaces of
1223 indent. FLAGS specifies details to show in the dump (see TDF_* in
1227 dump_gimple_catch (pretty_printer
*buffer
, gcatch
*gs
, int spc
,
1230 if (flags
& TDF_RAW
)
1231 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %+CATCH <%S>%->", gs
,
1232 gimple_catch_types (gs
), gimple_catch_handler (gs
));
1234 dump_gimple_fmt (buffer
, spc
, flags
, "catch (%T)%+{%S}",
1235 gimple_catch_types (gs
), gimple_catch_handler (gs
));
1239 /* Dump a GIMPLE_EH_FILTER tuple on the pretty_printer BUFFER, SPC spaces of
1240 indent. FLAGS specifies details to show in the dump (see TDF_* in
1244 dump_gimple_eh_filter (pretty_printer
*buffer
, geh_filter
*gs
, int spc
,
1247 if (flags
& TDF_RAW
)
1248 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %+FAILURE <%S>%->", gs
,
1249 gimple_eh_filter_types (gs
),
1250 gimple_eh_filter_failure (gs
));
1252 dump_gimple_fmt (buffer
, spc
, flags
, "<<<eh_filter (%T)>>>%+{%+%S%-}",
1253 gimple_eh_filter_types (gs
),
1254 gimple_eh_filter_failure (gs
));
1258 /* Dump a GIMPLE_EH_MUST_NOT_THROW tuple. */
1261 dump_gimple_eh_must_not_throw (pretty_printer
*buffer
,
1262 geh_mnt
*gs
, int spc
, dump_flags_t flags
)
1264 if (flags
& TDF_RAW
)
1265 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
,
1266 gimple_eh_must_not_throw_fndecl (gs
));
1268 dump_gimple_fmt (buffer
, spc
, flags
, "<<<eh_must_not_throw (%T)>>>",
1269 gimple_eh_must_not_throw_fndecl (gs
));
1273 /* Dump a GIMPLE_EH_ELSE tuple on the pretty_printer BUFFER, SPC spaces of
1274 indent. FLAGS specifies details to show in the dump (see TDF_* in
1278 dump_gimple_eh_else (pretty_printer
*buffer
, geh_else
*gs
, int spc
,
1281 if (flags
& TDF_RAW
)
1282 dump_gimple_fmt (buffer
, spc
, flags
,
1283 "%G <%+N_BODY <%S>%nE_BODY <%S>%->", gs
,
1284 gimple_eh_else_n_body (gs
), gimple_eh_else_e_body (gs
));
1286 dump_gimple_fmt (buffer
, spc
, flags
,
1287 "<<<if_normal_exit>>>%+{%S}%-<<<else_eh_exit>>>%+{%S}",
1288 gimple_eh_else_n_body (gs
), gimple_eh_else_e_body (gs
));
1292 /* Dump a GIMPLE_RESX tuple on the pretty_printer BUFFER, SPC spaces of
1293 indent. FLAGS specifies details to show in the dump (see TDF_* in
1297 dump_gimple_resx (pretty_printer
*buffer
, gresx
*gs
, int spc
,
1300 if (flags
& TDF_RAW
)
1301 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%d>", gs
,
1302 gimple_resx_region (gs
));
1304 dump_gimple_fmt (buffer
, spc
, flags
, "resx %d", gimple_resx_region (gs
));
1307 /* Dump a GIMPLE_EH_DISPATCH tuple on the pretty_printer BUFFER. */
1310 dump_gimple_eh_dispatch (pretty_printer
*buffer
, geh_dispatch
*gs
, int spc
,
1313 if (flags
& TDF_RAW
)
1314 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%d>", gs
,
1315 gimple_eh_dispatch_region (gs
));
1317 dump_gimple_fmt (buffer
, spc
, flags
, "eh_dispatch %d",
1318 gimple_eh_dispatch_region (gs
));
1321 /* Dump a GIMPLE_DEBUG tuple on the pretty_printer BUFFER, SPC spaces
1322 of indent. FLAGS specifies details to show in the dump (see TDF_*
1326 dump_gimple_debug (pretty_printer
*buffer
, gdebug
*gs
, int spc
,
1329 switch (gs
->subcode
)
1331 case GIMPLE_DEBUG_BIND
:
1332 if (flags
& TDF_RAW
)
1333 dump_gimple_fmt (buffer
, spc
, flags
, "%G BIND <%T, %T>", gs
,
1334 gimple_debug_bind_get_var (gs
),
1335 gimple_debug_bind_get_value (gs
));
1337 dump_gimple_fmt (buffer
, spc
, flags
, "# DEBUG %T => %T",
1338 gimple_debug_bind_get_var (gs
),
1339 gimple_debug_bind_get_value (gs
));
1342 case GIMPLE_DEBUG_SOURCE_BIND
:
1343 if (flags
& TDF_RAW
)
1344 dump_gimple_fmt (buffer
, spc
, flags
, "%G SRCBIND <%T, %T>", gs
,
1345 gimple_debug_source_bind_get_var (gs
),
1346 gimple_debug_source_bind_get_value (gs
));
1348 dump_gimple_fmt (buffer
, spc
, flags
, "# DEBUG %T s=> %T",
1349 gimple_debug_source_bind_get_var (gs
),
1350 gimple_debug_source_bind_get_value (gs
));
1353 case GIMPLE_DEBUG_BEGIN_STMT
:
1354 if (flags
& TDF_RAW
)
1355 dump_gimple_fmt (buffer
, spc
, flags
, "%G BEGIN_STMT", gs
);
1357 dump_gimple_fmt (buffer
, spc
, flags
, "# DEBUG BEGIN_STMT");
1360 case GIMPLE_DEBUG_INLINE_ENTRY
:
1361 if (flags
& TDF_RAW
)
1362 dump_gimple_fmt (buffer
, spc
, flags
, "%G INLINE_ENTRY %T", gs
,
1364 ? block_ultimate_origin (gimple_block (gs
))
1367 dump_gimple_fmt (buffer
, spc
, flags
, "# DEBUG INLINE_ENTRY %T",
1369 ? block_ultimate_origin (gimple_block (gs
))
1378 /* Dump a GIMPLE_OMP_FOR tuple on the pretty_printer BUFFER. */
1380 dump_gimple_omp_for (pretty_printer
*buffer
, gomp_for
*gs
, int spc
,
1385 if (flags
& TDF_RAW
)
1388 switch (gimple_omp_for_kind (gs
))
1390 case GF_OMP_FOR_KIND_FOR
:
1393 case GF_OMP_FOR_KIND_DISTRIBUTE
:
1394 kind
= " distribute";
1396 case GF_OMP_FOR_KIND_TASKLOOP
:
1399 case GF_OMP_FOR_KIND_OACC_LOOP
:
1400 kind
= " oacc_loop";
1402 case GF_OMP_FOR_KIND_SIMD
:
1408 dump_gimple_fmt (buffer
, spc
, flags
, "%G%s <%+BODY <%S>%nCLAUSES <", gs
,
1409 kind
, gimple_omp_body (gs
));
1410 dump_omp_clauses (buffer
, gimple_omp_for_clauses (gs
), spc
, flags
);
1411 dump_gimple_fmt (buffer
, spc
, flags
, " >,");
1412 for (i
= 0; i
< gimple_omp_for_collapse (gs
); i
++)
1413 dump_gimple_fmt (buffer
, spc
, flags
,
1414 "%+%T, %T, %T, %s, %T,%n",
1415 gimple_omp_for_index (gs
, i
),
1416 gimple_omp_for_initial (gs
, i
),
1417 gimple_omp_for_final (gs
, i
),
1418 get_tree_code_name (gimple_omp_for_cond (gs
, i
)),
1419 gimple_omp_for_incr (gs
, i
));
1420 dump_gimple_fmt (buffer
, spc
, flags
, "PRE_BODY <%S>%->",
1421 gimple_omp_for_pre_body (gs
));
1425 switch (gimple_omp_for_kind (gs
))
1427 case GF_OMP_FOR_KIND_FOR
:
1428 pp_string (buffer
, "#pragma omp for");
1430 case GF_OMP_FOR_KIND_DISTRIBUTE
:
1431 pp_string (buffer
, "#pragma omp distribute");
1433 case GF_OMP_FOR_KIND_TASKLOOP
:
1434 pp_string (buffer
, "#pragma omp taskloop");
1436 case GF_OMP_FOR_KIND_OACC_LOOP
:
1437 pp_string (buffer
, "#pragma acc loop");
1439 case GF_OMP_FOR_KIND_SIMD
:
1440 pp_string (buffer
, "#pragma omp simd");
1442 case GF_OMP_FOR_KIND_GRID_LOOP
:
1443 pp_string (buffer
, "#pragma omp for grid_loop");
1448 dump_omp_clauses (buffer
, gimple_omp_for_clauses (gs
), spc
, flags
);
1449 for (i
= 0; i
< gimple_omp_for_collapse (gs
); i
++)
1453 newline_and_indent (buffer
, spc
);
1454 pp_string (buffer
, "for (");
1455 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
1457 pp_string (buffer
, " = ");
1458 dump_generic_node (buffer
, gimple_omp_for_initial (gs
, i
), spc
,
1460 pp_string (buffer
, "; ");
1462 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
1465 switch (gimple_omp_for_cond (gs
, i
))
1471 pp_greater (buffer
);
1474 pp_less_equal (buffer
);
1477 pp_greater_equal (buffer
);
1480 pp_string (buffer
, "!=");
1486 dump_generic_node (buffer
, gimple_omp_for_final (gs
, i
), spc
,
1488 pp_string (buffer
, "; ");
1490 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
1492 pp_string (buffer
, " = ");
1493 dump_generic_node (buffer
, gimple_omp_for_incr (gs
, i
), spc
,
1495 pp_right_paren (buffer
);
1498 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1500 newline_and_indent (buffer
, spc
+ 2);
1501 pp_left_brace (buffer
);
1502 pp_newline (buffer
);
1503 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1504 newline_and_indent (buffer
, spc
+ 2);
1505 pp_right_brace (buffer
);
1510 /* Dump a GIMPLE_OMP_CONTINUE tuple on the pretty_printer BUFFER. */
1513 dump_gimple_omp_continue (pretty_printer
*buffer
, gomp_continue
*gs
,
1514 int spc
, dump_flags_t flags
)
1516 if (flags
& TDF_RAW
)
1518 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T>", gs
,
1519 gimple_omp_continue_control_def (gs
),
1520 gimple_omp_continue_control_use (gs
));
1524 pp_string (buffer
, "#pragma omp continue (");
1525 dump_generic_node (buffer
, gimple_omp_continue_control_def (gs
),
1529 dump_generic_node (buffer
, gimple_omp_continue_control_use (gs
),
1531 pp_right_paren (buffer
);
1535 /* Dump a GIMPLE_OMP_SINGLE tuple on the pretty_printer BUFFER. */
1538 dump_gimple_omp_single (pretty_printer
*buffer
, gomp_single
*gs
,
1539 int spc
, dump_flags_t flags
)
1541 if (flags
& TDF_RAW
)
1543 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1544 gimple_omp_body (gs
));
1545 dump_omp_clauses (buffer
, gimple_omp_single_clauses (gs
), spc
, flags
);
1546 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1550 pp_string (buffer
, "#pragma omp single");
1551 dump_omp_clauses (buffer
, gimple_omp_single_clauses (gs
), spc
, flags
);
1552 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1554 newline_and_indent (buffer
, spc
+ 2);
1555 pp_left_brace (buffer
);
1556 pp_newline (buffer
);
1557 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1558 newline_and_indent (buffer
, spc
+ 2);
1559 pp_right_brace (buffer
);
1564 /* Dump a GIMPLE_OMP_TARGET tuple on the pretty_printer BUFFER. */
1567 dump_gimple_omp_target (pretty_printer
*buffer
, gomp_target
*gs
,
1568 int spc
, dump_flags_t flags
)
1571 switch (gimple_omp_target_kind (gs
))
1573 case GF_OMP_TARGET_KIND_REGION
:
1576 case GF_OMP_TARGET_KIND_DATA
:
1579 case GF_OMP_TARGET_KIND_UPDATE
:
1582 case GF_OMP_TARGET_KIND_ENTER_DATA
:
1583 kind
= " enter data";
1585 case GF_OMP_TARGET_KIND_EXIT_DATA
:
1586 kind
= " exit data";
1588 case GF_OMP_TARGET_KIND_OACC_KERNELS
:
1589 kind
= " oacc_kernels";
1591 case GF_OMP_TARGET_KIND_OACC_PARALLEL
:
1592 kind
= " oacc_parallel";
1594 case GF_OMP_TARGET_KIND_OACC_DATA
:
1595 kind
= " oacc_data";
1597 case GF_OMP_TARGET_KIND_OACC_UPDATE
:
1598 kind
= " oacc_update";
1600 case GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA
:
1601 kind
= " oacc_enter_exit_data";
1603 case GF_OMP_TARGET_KIND_OACC_DECLARE
:
1604 kind
= " oacc_declare";
1606 case GF_OMP_TARGET_KIND_OACC_HOST_DATA
:
1607 kind
= " oacc_host_data";
1612 if (flags
& TDF_RAW
)
1614 dump_gimple_fmt (buffer
, spc
, flags
, "%G%s <%+BODY <%S>%nCLAUSES <", gs
,
1615 kind
, gimple_omp_body (gs
));
1616 dump_omp_clauses (buffer
, gimple_omp_target_clauses (gs
), spc
, flags
);
1617 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T%n>",
1618 gimple_omp_target_child_fn (gs
),
1619 gimple_omp_target_data_arg (gs
));
1623 pp_string (buffer
, "#pragma omp target");
1624 pp_string (buffer
, kind
);
1625 dump_omp_clauses (buffer
, gimple_omp_target_clauses (gs
), spc
, flags
);
1626 if (gimple_omp_target_child_fn (gs
))
1628 pp_string (buffer
, " [child fn: ");
1629 dump_generic_node (buffer
, gimple_omp_target_child_fn (gs
),
1631 pp_string (buffer
, " (");
1632 if (gimple_omp_target_data_arg (gs
))
1633 dump_generic_node (buffer
, gimple_omp_target_data_arg (gs
),
1636 pp_string (buffer
, "???");
1637 pp_string (buffer
, ")]");
1639 gimple_seq body
= gimple_omp_body (gs
);
1640 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
1642 newline_and_indent (buffer
, spc
+ 2);
1643 pp_left_brace (buffer
);
1644 pp_newline (buffer
);
1645 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
1646 newline_and_indent (buffer
, spc
+ 2);
1647 pp_right_brace (buffer
);
1651 pp_newline (buffer
);
1652 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
1657 /* Dump a GIMPLE_OMP_TEAMS tuple on the pretty_printer BUFFER. */
1660 dump_gimple_omp_teams (pretty_printer
*buffer
, gomp_teams
*gs
, int spc
,
1663 if (flags
& TDF_RAW
)
1665 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1666 gimple_omp_body (gs
));
1667 dump_omp_clauses (buffer
, gimple_omp_teams_clauses (gs
), spc
, flags
);
1668 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1672 pp_string (buffer
, "#pragma omp teams");
1673 dump_omp_clauses (buffer
, gimple_omp_teams_clauses (gs
), spc
, flags
);
1674 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1676 newline_and_indent (buffer
, spc
+ 2);
1677 pp_character (buffer
, '{');
1678 pp_newline (buffer
);
1679 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1680 newline_and_indent (buffer
, spc
+ 2);
1681 pp_character (buffer
, '}');
1686 /* Dump a GIMPLE_OMP_SECTIONS tuple on the pretty_printer BUFFER. */
1689 dump_gimple_omp_sections (pretty_printer
*buffer
, gomp_sections
*gs
,
1690 int spc
, dump_flags_t flags
)
1692 if (flags
& TDF_RAW
)
1694 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1695 gimple_omp_body (gs
));
1696 dump_omp_clauses (buffer
, gimple_omp_sections_clauses (gs
), spc
, flags
);
1697 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1701 pp_string (buffer
, "#pragma omp sections");
1702 if (gimple_omp_sections_control (gs
))
1704 pp_string (buffer
, " <");
1705 dump_generic_node (buffer
, gimple_omp_sections_control (gs
), spc
,
1707 pp_greater (buffer
);
1709 dump_omp_clauses (buffer
, gimple_omp_sections_clauses (gs
), spc
, flags
);
1710 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1712 newline_and_indent (buffer
, spc
+ 2);
1713 pp_left_brace (buffer
);
1714 pp_newline (buffer
);
1715 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1716 newline_and_indent (buffer
, spc
+ 2);
1717 pp_right_brace (buffer
);
1722 /* Dump a GIMPLE_OMP_{MASTER,TASKGROUP,ORDERED,SECTION} tuple on the
1723 pretty_printer BUFFER. */
1726 dump_gimple_omp_block (pretty_printer
*buffer
, gimple
*gs
, int spc
,
1729 if (flags
& TDF_RAW
)
1730 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1731 gimple_omp_body (gs
));
1734 switch (gimple_code (gs
))
1736 case GIMPLE_OMP_MASTER
:
1737 pp_string (buffer
, "#pragma omp master");
1739 case GIMPLE_OMP_TASKGROUP
:
1740 pp_string (buffer
, "#pragma omp taskgroup");
1742 case GIMPLE_OMP_SECTION
:
1743 pp_string (buffer
, "#pragma omp section");
1745 case GIMPLE_OMP_GRID_BODY
:
1746 pp_string (buffer
, "#pragma omp gridified body");
1751 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1753 newline_and_indent (buffer
, spc
+ 2);
1754 pp_left_brace (buffer
);
1755 pp_newline (buffer
);
1756 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1757 newline_and_indent (buffer
, spc
+ 2);
1758 pp_right_brace (buffer
);
1763 /* Dump a GIMPLE_OMP_CRITICAL tuple on the pretty_printer BUFFER. */
1766 dump_gimple_omp_critical (pretty_printer
*buffer
, gomp_critical
*gs
,
1767 int spc
, dump_flags_t flags
)
1769 if (flags
& TDF_RAW
)
1770 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1771 gimple_omp_body (gs
));
1774 pp_string (buffer
, "#pragma omp critical");
1775 if (gimple_omp_critical_name (gs
))
1777 pp_string (buffer
, " (");
1778 dump_generic_node (buffer
, gimple_omp_critical_name (gs
), spc
,
1780 pp_right_paren (buffer
);
1782 dump_omp_clauses (buffer
, gimple_omp_critical_clauses (gs
), spc
, flags
);
1783 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1785 newline_and_indent (buffer
, spc
+ 2);
1786 pp_left_brace (buffer
);
1787 pp_newline (buffer
);
1788 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1789 newline_and_indent (buffer
, spc
+ 2);
1790 pp_right_brace (buffer
);
1795 /* Dump a GIMPLE_OMP_ORDERED tuple on the pretty_printer BUFFER. */
1798 dump_gimple_omp_ordered (pretty_printer
*buffer
, gomp_ordered
*gs
,
1799 int spc
, dump_flags_t flags
)
1801 if (flags
& TDF_RAW
)
1802 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1803 gimple_omp_body (gs
));
1806 pp_string (buffer
, "#pragma omp ordered");
1807 dump_omp_clauses (buffer
, gimple_omp_ordered_clauses (gs
), spc
, flags
);
1808 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1810 newline_and_indent (buffer
, spc
+ 2);
1811 pp_left_brace (buffer
);
1812 pp_newline (buffer
);
1813 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1814 newline_and_indent (buffer
, spc
+ 2);
1815 pp_right_brace (buffer
);
1820 /* Dump a GIMPLE_OMP_RETURN tuple on the pretty_printer BUFFER. */
1823 dump_gimple_omp_return (pretty_printer
*buffer
, gimple
*gs
, int spc
,
1826 if (flags
& TDF_RAW
)
1828 dump_gimple_fmt (buffer
, spc
, flags
, "%G <nowait=%d", gs
,
1829 (int) gimple_omp_return_nowait_p (gs
));
1830 if (gimple_omp_return_lhs (gs
))
1831 dump_gimple_fmt (buffer
, spc
, flags
, ", lhs=%T>",
1832 gimple_omp_return_lhs (gs
));
1834 dump_gimple_fmt (buffer
, spc
, flags
, ">");
1838 pp_string (buffer
, "#pragma omp return");
1839 if (gimple_omp_return_nowait_p (gs
))
1840 pp_string (buffer
, "(nowait)");
1841 if (gimple_omp_return_lhs (gs
))
1843 pp_string (buffer
, " (set ");
1844 dump_generic_node (buffer
, gimple_omp_return_lhs (gs
),
1846 pp_character (buffer
, ')');
1851 /* Dump a GIMPLE_TRANSACTION tuple on the pretty_printer BUFFER. */
1854 dump_gimple_transaction (pretty_printer
*buffer
, gtransaction
*gs
,
1855 int spc
, dump_flags_t flags
)
1857 unsigned subcode
= gimple_transaction_subcode (gs
);
1859 if (flags
& TDF_RAW
)
1861 dump_gimple_fmt (buffer
, spc
, flags
,
1862 "%G [SUBCODE=%x,NORM=%T,UNINST=%T,OVER=%T] "
1864 gs
, subcode
, gimple_transaction_label_norm (gs
),
1865 gimple_transaction_label_uninst (gs
),
1866 gimple_transaction_label_over (gs
),
1867 gimple_transaction_body (gs
));
1871 if (subcode
& GTMA_IS_OUTER
)
1872 pp_string (buffer
, "__transaction_atomic [[outer]]");
1873 else if (subcode
& GTMA_IS_RELAXED
)
1874 pp_string (buffer
, "__transaction_relaxed");
1876 pp_string (buffer
, "__transaction_atomic");
1877 subcode
&= ~GTMA_DECLARATION_MASK
;
1879 if (gimple_transaction_body (gs
))
1881 newline_and_indent (buffer
, spc
+ 2);
1882 pp_left_brace (buffer
);
1883 pp_newline (buffer
);
1884 dump_gimple_seq (buffer
, gimple_transaction_body (gs
),
1886 newline_and_indent (buffer
, spc
+ 2);
1887 pp_right_brace (buffer
);
1891 pp_string (buffer
, " //");
1892 if (gimple_transaction_label_norm (gs
))
1894 pp_string (buffer
, " NORM=");
1895 dump_generic_node (buffer
, gimple_transaction_label_norm (gs
),
1898 if (gimple_transaction_label_uninst (gs
))
1900 pp_string (buffer
, " UNINST=");
1901 dump_generic_node (buffer
, gimple_transaction_label_uninst (gs
),
1904 if (gimple_transaction_label_over (gs
))
1906 pp_string (buffer
, " OVER=");
1907 dump_generic_node (buffer
, gimple_transaction_label_over (gs
),
1912 pp_string (buffer
, " SUBCODE=[ ");
1913 if (subcode
& GTMA_HAVE_ABORT
)
1915 pp_string (buffer
, "GTMA_HAVE_ABORT ");
1916 subcode
&= ~GTMA_HAVE_ABORT
;
1918 if (subcode
& GTMA_HAVE_LOAD
)
1920 pp_string (buffer
, "GTMA_HAVE_LOAD ");
1921 subcode
&= ~GTMA_HAVE_LOAD
;
1923 if (subcode
& GTMA_HAVE_STORE
)
1925 pp_string (buffer
, "GTMA_HAVE_STORE ");
1926 subcode
&= ~GTMA_HAVE_STORE
;
1928 if (subcode
& GTMA_MAY_ENTER_IRREVOCABLE
)
1930 pp_string (buffer
, "GTMA_MAY_ENTER_IRREVOCABLE ");
1931 subcode
&= ~GTMA_MAY_ENTER_IRREVOCABLE
;
1933 if (subcode
& GTMA_DOES_GO_IRREVOCABLE
)
1935 pp_string (buffer
, "GTMA_DOES_GO_IRREVOCABLE ");
1936 subcode
&= ~GTMA_DOES_GO_IRREVOCABLE
;
1938 if (subcode
& GTMA_HAS_NO_INSTRUMENTATION
)
1940 pp_string (buffer
, "GTMA_HAS_NO_INSTRUMENTATION ");
1941 subcode
&= ~GTMA_HAS_NO_INSTRUMENTATION
;
1944 pp_printf (buffer
, "0x%x ", subcode
);
1945 pp_right_bracket (buffer
);
1951 /* Dump a GIMPLE_ASM tuple on the pretty_printer BUFFER, SPC spaces of
1952 indent. FLAGS specifies details to show in the dump (see TDF_* in
1956 dump_gimple_asm (pretty_printer
*buffer
, gasm
*gs
, int spc
, dump_flags_t flags
)
1958 unsigned int i
, n
, f
, fields
;
1960 if (flags
& TDF_RAW
)
1962 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+STRING <%n%s%n>", gs
,
1963 gimple_asm_string (gs
));
1965 n
= gimple_asm_noutputs (gs
);
1968 newline_and_indent (buffer
, spc
+ 2);
1969 pp_string (buffer
, "OUTPUT: ");
1970 for (i
= 0; i
< n
; i
++)
1972 dump_generic_node (buffer
, gimple_asm_output_op (gs
, i
),
1975 pp_string (buffer
, ", ");
1979 n
= gimple_asm_ninputs (gs
);
1982 newline_and_indent (buffer
, spc
+ 2);
1983 pp_string (buffer
, "INPUT: ");
1984 for (i
= 0; i
< n
; i
++)
1986 dump_generic_node (buffer
, gimple_asm_input_op (gs
, i
),
1989 pp_string (buffer
, ", ");
1993 n
= gimple_asm_nclobbers (gs
);
1996 newline_and_indent (buffer
, spc
+ 2);
1997 pp_string (buffer
, "CLOBBER: ");
1998 for (i
= 0; i
< n
; i
++)
2000 dump_generic_node (buffer
, gimple_asm_clobber_op (gs
, i
),
2003 pp_string (buffer
, ", ");
2007 n
= gimple_asm_nlabels (gs
);
2010 newline_and_indent (buffer
, spc
+ 2);
2011 pp_string (buffer
, "LABEL: ");
2012 for (i
= 0; i
< n
; i
++)
2014 dump_generic_node (buffer
, gimple_asm_label_op (gs
, i
),
2017 pp_string (buffer
, ", ");
2021 newline_and_indent (buffer
, spc
);
2022 pp_greater (buffer
);
2026 pp_string (buffer
, "__asm__");
2027 if (gimple_asm_volatile_p (gs
))
2028 pp_string (buffer
, " __volatile__");
2029 if (gimple_asm_nlabels (gs
))
2030 pp_string (buffer
, " goto");
2031 pp_string (buffer
, "(\"");
2032 pp_string (buffer
, gimple_asm_string (gs
));
2033 pp_string (buffer
, "\"");
2035 if (gimple_asm_nlabels (gs
))
2037 else if (gimple_asm_nclobbers (gs
))
2039 else if (gimple_asm_ninputs (gs
))
2041 else if (gimple_asm_noutputs (gs
))
2046 for (f
= 0; f
< fields
; ++f
)
2048 pp_string (buffer
, " : ");
2053 n
= gimple_asm_noutputs (gs
);
2054 for (i
= 0; i
< n
; i
++)
2056 dump_generic_node (buffer
, gimple_asm_output_op (gs
, i
),
2059 pp_string (buffer
, ", ");
2064 n
= gimple_asm_ninputs (gs
);
2065 for (i
= 0; i
< n
; i
++)
2067 dump_generic_node (buffer
, gimple_asm_input_op (gs
, i
),
2070 pp_string (buffer
, ", ");
2075 n
= gimple_asm_nclobbers (gs
);
2076 for (i
= 0; i
< n
; i
++)
2078 dump_generic_node (buffer
, gimple_asm_clobber_op (gs
, i
),
2081 pp_string (buffer
, ", ");
2086 n
= gimple_asm_nlabels (gs
);
2087 for (i
= 0; i
< n
; i
++)
2089 dump_generic_node (buffer
, gimple_asm_label_op (gs
, i
),
2092 pp_string (buffer
, ", ");
2101 pp_string (buffer
, ");");
2105 /* Dump ptr_info and range_info for NODE on pretty_printer BUFFER with
2106 SPC spaces of indent. */
2109 dump_ssaname_info (pretty_printer
*buffer
, tree node
, int spc
)
2111 if (TREE_CODE (node
) != SSA_NAME
)
2114 if (POINTER_TYPE_P (TREE_TYPE (node
))
2115 && SSA_NAME_PTR_INFO (node
))
2117 unsigned int align
, misalign
;
2118 struct ptr_info_def
*pi
= SSA_NAME_PTR_INFO (node
);
2119 pp_string (buffer
, "# PT = ");
2120 pp_points_to_solution (buffer
, &pi
->pt
);
2121 newline_and_indent (buffer
, spc
);
2122 if (get_ptr_info_alignment (pi
, &align
, &misalign
))
2124 pp_printf (buffer
, "# ALIGN = %u, MISALIGN = %u", align
, misalign
);
2125 newline_and_indent (buffer
, spc
);
2129 if (!POINTER_TYPE_P (TREE_TYPE (node
))
2130 && SSA_NAME_RANGE_INFO (node
))
2132 wide_int min
, max
, nonzero_bits
;
2133 value_range_type range_type
= get_range_info (node
, &min
, &max
);
2135 if (range_type
== VR_VARYING
)
2136 pp_printf (buffer
, "# RANGE VR_VARYING");
2137 else if (range_type
== VR_RANGE
|| range_type
== VR_ANTI_RANGE
)
2139 pp_printf (buffer
, "# RANGE ");
2140 pp_printf (buffer
, "%s[", range_type
== VR_RANGE
? "" : "~");
2141 pp_wide_int (buffer
, min
, TYPE_SIGN (TREE_TYPE (node
)));
2142 pp_printf (buffer
, ", ");
2143 pp_wide_int (buffer
, max
, TYPE_SIGN (TREE_TYPE (node
)));
2144 pp_printf (buffer
, "]");
2146 nonzero_bits
= get_nonzero_bits (node
);
2147 if (nonzero_bits
!= -1)
2149 pp_string (buffer
, " NONZERO ");
2150 pp_wide_int (buffer
, nonzero_bits
, UNSIGNED
);
2152 newline_and_indent (buffer
, spc
);
2156 /* As dump_ssaname_info, but dump to FILE. */
2159 dump_ssaname_info_to_file (FILE *file
, tree node
, int spc
)
2161 pretty_printer buffer
;
2162 pp_needs_newline (&buffer
) = true;
2163 buffer
.buffer
->stream
= file
;
2164 dump_ssaname_info (&buffer
, node
, spc
);
2168 /* Dump a PHI node PHI. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1.
2169 The caller is responsible for calling pp_flush on BUFFER to finalize
2170 pretty printer. If COMMENT is true, print this after #. */
2173 dump_gimple_phi (pretty_printer
*buffer
, gphi
*phi
, int spc
, bool comment
,
2177 tree lhs
= gimple_phi_result (phi
);
2179 if (flags
& TDF_ALIAS
)
2180 dump_ssaname_info (buffer
, lhs
, spc
);
2183 pp_string (buffer
, "# ");
2185 if (flags
& TDF_RAW
)
2186 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, ", phi
,
2187 gimple_phi_result (phi
));
2190 dump_generic_node (buffer
, lhs
, spc
, flags
, false);
2191 if (flags
& TDF_GIMPLE
)
2192 pp_string (buffer
, " = __PHI (");
2194 pp_string (buffer
, " = PHI <");
2196 for (i
= 0; i
< gimple_phi_num_args (phi
); i
++)
2198 if ((flags
& TDF_LINENO
) && gimple_phi_arg_has_location (phi
, i
))
2199 dump_location (buffer
, gimple_phi_arg_location (phi
, i
));
2200 if (flags
& TDF_GIMPLE
)
2202 basic_block src
= gimple_phi_arg_edge (phi
, i
)->src
;
2203 gimple
*stmt
= first_stmt (src
);
2204 if (!stmt
|| gimple_code (stmt
) != GIMPLE_LABEL
)
2206 pp_string (buffer
, "bb_");
2207 pp_decimal_int (buffer
, src
->index
);
2210 dump_generic_node (buffer
, gimple_label_label (as_a
<glabel
*> (stmt
)), 0, flags
,
2212 pp_string (buffer
, ": ");
2214 dump_generic_node (buffer
, gimple_phi_arg_def (phi
, i
), spc
, flags
,
2216 if (! (flags
& TDF_GIMPLE
))
2218 pp_left_paren (buffer
);
2219 pp_decimal_int (buffer
, gimple_phi_arg_edge (phi
, i
)->src
->index
);
2220 pp_right_paren (buffer
);
2222 if (i
< gimple_phi_num_args (phi
) - 1)
2223 pp_string (buffer
, ", ");
2225 if (flags
& TDF_GIMPLE
)
2226 pp_string (buffer
, ");");
2228 pp_greater (buffer
);
2232 /* Dump a GIMPLE_OMP_PARALLEL tuple on the pretty_printer BUFFER, SPC spaces
2233 of indent. FLAGS specifies details to show in the dump (see TDF_* in
2237 dump_gimple_omp_parallel (pretty_printer
*buffer
, gomp_parallel
*gs
,
2238 int spc
, dump_flags_t flags
)
2240 if (flags
& TDF_RAW
)
2242 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
2243 gimple_omp_body (gs
));
2244 dump_omp_clauses (buffer
, gimple_omp_parallel_clauses (gs
), spc
, flags
);
2245 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T%n>",
2246 gimple_omp_parallel_child_fn (gs
),
2247 gimple_omp_parallel_data_arg (gs
));
2252 pp_string (buffer
, "#pragma omp parallel");
2253 dump_omp_clauses (buffer
, gimple_omp_parallel_clauses (gs
), spc
, flags
);
2254 if (gimple_omp_parallel_child_fn (gs
))
2256 pp_string (buffer
, " [child fn: ");
2257 dump_generic_node (buffer
, gimple_omp_parallel_child_fn (gs
),
2259 pp_string (buffer
, " (");
2260 if (gimple_omp_parallel_data_arg (gs
))
2261 dump_generic_node (buffer
, gimple_omp_parallel_data_arg (gs
),
2264 pp_string (buffer
, "???");
2265 pp_string (buffer
, ")]");
2267 body
= gimple_omp_body (gs
);
2268 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
2270 newline_and_indent (buffer
, spc
+ 2);
2271 pp_left_brace (buffer
);
2272 pp_newline (buffer
);
2273 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
2274 newline_and_indent (buffer
, spc
+ 2);
2275 pp_right_brace (buffer
);
2279 pp_newline (buffer
);
2280 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
2286 /* Dump a GIMPLE_OMP_TASK tuple on the pretty_printer BUFFER, SPC spaces
2287 of indent. FLAGS specifies details to show in the dump (see TDF_* in
2291 dump_gimple_omp_task (pretty_printer
*buffer
, gomp_task
*gs
, int spc
,
2294 if (flags
& TDF_RAW
)
2296 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
2297 gimple_omp_body (gs
));
2298 dump_omp_clauses (buffer
, gimple_omp_task_clauses (gs
), spc
, flags
);
2299 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T, %T, %T, %T%n>",
2300 gimple_omp_task_child_fn (gs
),
2301 gimple_omp_task_data_arg (gs
),
2302 gimple_omp_task_copy_fn (gs
),
2303 gimple_omp_task_arg_size (gs
),
2304 gimple_omp_task_arg_size (gs
));
2309 if (gimple_omp_task_taskloop_p (gs
))
2310 pp_string (buffer
, "#pragma omp taskloop");
2312 pp_string (buffer
, "#pragma omp task");
2313 dump_omp_clauses (buffer
, gimple_omp_task_clauses (gs
), spc
, flags
);
2314 if (gimple_omp_task_child_fn (gs
))
2316 pp_string (buffer
, " [child fn: ");
2317 dump_generic_node (buffer
, gimple_omp_task_child_fn (gs
),
2319 pp_string (buffer
, " (");
2320 if (gimple_omp_task_data_arg (gs
))
2321 dump_generic_node (buffer
, gimple_omp_task_data_arg (gs
),
2324 pp_string (buffer
, "???");
2325 pp_string (buffer
, ")]");
2327 body
= gimple_omp_body (gs
);
2328 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
2330 newline_and_indent (buffer
, spc
+ 2);
2331 pp_left_brace (buffer
);
2332 pp_newline (buffer
);
2333 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
2334 newline_and_indent (buffer
, spc
+ 2);
2335 pp_right_brace (buffer
);
2339 pp_newline (buffer
);
2340 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
2346 /* Dump a GIMPLE_OMP_ATOMIC_LOAD tuple on the pretty_printer BUFFER, SPC
2347 spaces of indent. FLAGS specifies details to show in the dump (see TDF_*
2351 dump_gimple_omp_atomic_load (pretty_printer
*buffer
, gomp_atomic_load
*gs
,
2352 int spc
, dump_flags_t flags
)
2354 if (flags
& TDF_RAW
)
2356 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T>", gs
,
2357 gimple_omp_atomic_load_lhs (gs
),
2358 gimple_omp_atomic_load_rhs (gs
));
2362 pp_string (buffer
, "#pragma omp atomic_load");
2363 if (gimple_omp_atomic_seq_cst_p (gs
))
2364 pp_string (buffer
, " seq_cst");
2365 if (gimple_omp_atomic_need_value_p (gs
))
2366 pp_string (buffer
, " [needed]");
2367 newline_and_indent (buffer
, spc
+ 2);
2368 dump_generic_node (buffer
, gimple_omp_atomic_load_lhs (gs
),
2374 dump_generic_node (buffer
, gimple_omp_atomic_load_rhs (gs
),
2379 /* Dump a GIMPLE_OMP_ATOMIC_STORE tuple on the pretty_printer BUFFER, SPC
2380 spaces of indent. FLAGS specifies details to show in the dump (see TDF_*
2384 dump_gimple_omp_atomic_store (pretty_printer
*buffer
,
2385 gomp_atomic_store
*gs
, int spc
,
2388 if (flags
& TDF_RAW
)
2390 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
,
2391 gimple_omp_atomic_store_val (gs
));
2395 pp_string (buffer
, "#pragma omp atomic_store ");
2396 if (gimple_omp_atomic_seq_cst_p (gs
))
2397 pp_string (buffer
, "seq_cst ");
2398 if (gimple_omp_atomic_need_value_p (gs
))
2399 pp_string (buffer
, "[needed] ");
2400 pp_left_paren (buffer
);
2401 dump_generic_node (buffer
, gimple_omp_atomic_store_val (gs
),
2403 pp_right_paren (buffer
);
2408 /* Dump all the memory operands for statement GS. BUFFER, SPC and
2409 FLAGS are as in pp_gimple_stmt_1. */
2412 dump_gimple_mem_ops (pretty_printer
*buffer
, gimple
*gs
, int spc
,
2415 tree vdef
= gimple_vdef (gs
);
2416 tree vuse
= gimple_vuse (gs
);
2418 if (vdef
!= NULL_TREE
)
2420 pp_string (buffer
, "# ");
2421 dump_generic_node (buffer
, vdef
, spc
+ 2, flags
, false);
2422 pp_string (buffer
, " = VDEF <");
2423 dump_generic_node (buffer
, vuse
, spc
+ 2, flags
, false);
2424 pp_greater (buffer
);
2425 newline_and_indent (buffer
, spc
);
2427 else if (vuse
!= NULL_TREE
)
2429 pp_string (buffer
, "# VUSE <");
2430 dump_generic_node (buffer
, vuse
, spc
+ 2, flags
, false);
2431 pp_greater (buffer
);
2432 newline_and_indent (buffer
, spc
);
2437 /* Print the gimple statement GS on the pretty printer BUFFER, SPC
2438 spaces of indent. FLAGS specifies details to show in the dump (see
2439 TDF_* in dumpfile.h). The caller is responsible for calling
2440 pp_flush on BUFFER to finalize the pretty printer. */
2443 pp_gimple_stmt_1 (pretty_printer
*buffer
, gimple
*gs
, int spc
,
2449 if (flags
& TDF_STMTADDR
)
2450 pp_printf (buffer
, "<&%p> ", (void *) gs
);
2452 if ((flags
& TDF_LINENO
) && gimple_has_location (gs
))
2453 dump_location (buffer
, gimple_location (gs
));
2457 int lp_nr
= lookup_stmt_eh_lp (gs
);
2459 pp_printf (buffer
, "[LP %d] ", lp_nr
);
2461 pp_printf (buffer
, "[MNT %d] ", -lp_nr
);
2464 if ((flags
& (TDF_VOPS
|TDF_MEMSYMS
))
2465 && gimple_has_mem_ops (gs
))
2466 dump_gimple_mem_ops (buffer
, gs
, spc
, flags
);
2468 if (gimple_has_lhs (gs
)
2469 && (flags
& TDF_ALIAS
))
2470 dump_ssaname_info (buffer
, gimple_get_lhs (gs
), spc
);
2472 switch (gimple_code (gs
))
2475 dump_gimple_asm (buffer
, as_a
<gasm
*> (gs
), spc
, flags
);
2479 dump_gimple_assign (buffer
, as_a
<gassign
*> (gs
), spc
, flags
);
2483 dump_gimple_bind (buffer
, as_a
<gbind
*> (gs
), spc
, flags
);
2487 dump_gimple_call (buffer
, as_a
<gcall
*> (gs
), spc
, flags
);
2491 dump_gimple_cond (buffer
, as_a
<gcond
*> (gs
), spc
, flags
);
2495 dump_gimple_label (buffer
, as_a
<glabel
*> (gs
), spc
, flags
);
2499 dump_gimple_goto (buffer
, as_a
<ggoto
*> (gs
), spc
, flags
);
2503 pp_string (buffer
, "GIMPLE_NOP");
2507 dump_gimple_return (buffer
, as_a
<greturn
*> (gs
), spc
, flags
);
2511 dump_gimple_switch (buffer
, as_a
<gswitch
*> (gs
), spc
, flags
);
2515 dump_gimple_try (buffer
, as_a
<gtry
*> (gs
), spc
, flags
);
2519 dump_gimple_phi (buffer
, as_a
<gphi
*> (gs
), spc
, false, flags
);
2522 case GIMPLE_OMP_PARALLEL
:
2523 dump_gimple_omp_parallel (buffer
, as_a
<gomp_parallel
*> (gs
), spc
,
2527 case GIMPLE_OMP_TASK
:
2528 dump_gimple_omp_task (buffer
, as_a
<gomp_task
*> (gs
), spc
, flags
);
2531 case GIMPLE_OMP_ATOMIC_LOAD
:
2532 dump_gimple_omp_atomic_load (buffer
, as_a
<gomp_atomic_load
*> (gs
),
2536 case GIMPLE_OMP_ATOMIC_STORE
:
2537 dump_gimple_omp_atomic_store (buffer
,
2538 as_a
<gomp_atomic_store
*> (gs
),
2542 case GIMPLE_OMP_FOR
:
2543 dump_gimple_omp_for (buffer
, as_a
<gomp_for
*> (gs
), spc
, flags
);
2546 case GIMPLE_OMP_CONTINUE
:
2547 dump_gimple_omp_continue (buffer
, as_a
<gomp_continue
*> (gs
), spc
,
2551 case GIMPLE_OMP_SINGLE
:
2552 dump_gimple_omp_single (buffer
, as_a
<gomp_single
*> (gs
), spc
,
2556 case GIMPLE_OMP_TARGET
:
2557 dump_gimple_omp_target (buffer
, as_a
<gomp_target
*> (gs
), spc
,
2561 case GIMPLE_OMP_TEAMS
:
2562 dump_gimple_omp_teams (buffer
, as_a
<gomp_teams
*> (gs
), spc
,
2566 case GIMPLE_OMP_RETURN
:
2567 dump_gimple_omp_return (buffer
, gs
, spc
, flags
);
2570 case GIMPLE_OMP_SECTIONS
:
2571 dump_gimple_omp_sections (buffer
, as_a
<gomp_sections
*> (gs
),
2575 case GIMPLE_OMP_SECTIONS_SWITCH
:
2576 pp_string (buffer
, "GIMPLE_SECTIONS_SWITCH");
2579 case GIMPLE_OMP_MASTER
:
2580 case GIMPLE_OMP_TASKGROUP
:
2581 case GIMPLE_OMP_SECTION
:
2582 case GIMPLE_OMP_GRID_BODY
:
2583 dump_gimple_omp_block (buffer
, gs
, spc
, flags
);
2586 case GIMPLE_OMP_ORDERED
:
2587 dump_gimple_omp_ordered (buffer
, as_a
<gomp_ordered
*> (gs
), spc
,
2591 case GIMPLE_OMP_CRITICAL
:
2592 dump_gimple_omp_critical (buffer
, as_a
<gomp_critical
*> (gs
), spc
,
2597 dump_gimple_catch (buffer
, as_a
<gcatch
*> (gs
), spc
, flags
);
2600 case GIMPLE_EH_FILTER
:
2601 dump_gimple_eh_filter (buffer
, as_a
<geh_filter
*> (gs
), spc
, flags
);
2604 case GIMPLE_EH_MUST_NOT_THROW
:
2605 dump_gimple_eh_must_not_throw (buffer
,
2606 as_a
<geh_mnt
*> (gs
),
2610 case GIMPLE_EH_ELSE
:
2611 dump_gimple_eh_else (buffer
, as_a
<geh_else
*> (gs
), spc
, flags
);
2615 dump_gimple_resx (buffer
, as_a
<gresx
*> (gs
), spc
, flags
);
2618 case GIMPLE_EH_DISPATCH
:
2619 dump_gimple_eh_dispatch (buffer
, as_a
<geh_dispatch
*> (gs
), spc
,
2624 dump_gimple_debug (buffer
, as_a
<gdebug
*> (gs
), spc
, flags
);
2627 case GIMPLE_PREDICT
:
2628 pp_string (buffer
, "// predicted ");
2629 if (gimple_predict_outcome (gs
))
2630 pp_string (buffer
, "likely by ");
2632 pp_string (buffer
, "unlikely by ");
2633 pp_string (buffer
, predictor_name (gimple_predict_predictor (gs
)));
2634 pp_string (buffer
, " predictor.");
2637 case GIMPLE_TRANSACTION
:
2638 dump_gimple_transaction (buffer
, as_a
<gtransaction
*> (gs
), spc
,
2648 /* Dumps header of basic block BB to OUTF indented by INDENT
2649 spaces and details described by flags. */
2652 dump_gimple_bb_header (FILE *outf
, basic_block bb
, int indent
,
2655 if (flags
& TDF_BLOCKS
)
2657 if (flags
& TDF_LINENO
)
2659 gimple_stmt_iterator gsi
;
2661 fputs (";; ", outf
);
2663 for (gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
); gsi_next (&gsi
))
2664 if (!is_gimple_debug (gsi_stmt (gsi
))
2665 && get_lineno (gsi_stmt (gsi
)) != UNKNOWN_LOCATION
)
2667 fprintf (outf
, "%*sstarting at line %d",
2668 indent
, "", get_lineno (gsi_stmt (gsi
)));
2671 if (bb
->discriminator
)
2672 fprintf (outf
, ", discriminator %i", bb
->discriminator
);
2678 if (flags
& TDF_GIMPLE
)
2679 fprintf (outf
, "%*sbb_%d:\n", indent
, "", bb
->index
);
2681 fprintf (outf
, "%*s<bb %d> %s:\n",
2682 indent
, "", bb
->index
, dump_profile (bb
->count
));
2687 /* Dumps end of basic block BB to buffer BUFFER indented by INDENT
2691 dump_gimple_bb_footer (FILE *outf ATTRIBUTE_UNUSED
,
2692 basic_block bb ATTRIBUTE_UNUSED
,
2693 int indent ATTRIBUTE_UNUSED
,
2694 dump_flags_t flags ATTRIBUTE_UNUSED
)
2696 /* There is currently no GIMPLE-specific basic block info to dump. */
2701 /* Dump PHI nodes of basic block BB to BUFFER with details described
2702 by FLAGS and indented by INDENT spaces. */
2705 dump_phi_nodes (pretty_printer
*buffer
, basic_block bb
, int indent
,
2710 for (i
= gsi_start_phis (bb
); !gsi_end_p (i
); gsi_next (&i
))
2712 gphi
*phi
= i
.phi ();
2713 if (!virtual_operand_p (gimple_phi_result (phi
)) || (flags
& TDF_VOPS
))
2716 dump_gimple_phi (buffer
, phi
, indent
,
2717 (flags
& TDF_GIMPLE
) ? false : true, flags
);
2718 pp_newline (buffer
);
2724 /* Dump jump to basic block BB that is represented implicitly in the cfg
2728 pp_cfg_jump (pretty_printer
*buffer
, edge e
, dump_flags_t flags
)
2730 if (flags
& TDF_GIMPLE
)
2732 pp_string (buffer
, "goto bb_");
2733 pp_decimal_int (buffer
, e
->dest
->index
);
2734 pp_semicolon (buffer
);
2738 pp_string (buffer
, "goto <bb ");
2739 pp_decimal_int (buffer
, e
->dest
->index
);
2740 pp_greater (buffer
);
2741 pp_semicolon (buffer
);
2743 dump_edge_probability (buffer
, e
);
2748 /* Dump edges represented implicitly in basic block BB to BUFFER, indented
2749 by INDENT spaces, with details given by FLAGS. */
2752 dump_implicit_edges (pretty_printer
*buffer
, basic_block bb
, int indent
,
2758 stmt
= last_stmt (bb
);
2760 if (stmt
&& gimple_code (stmt
) == GIMPLE_COND
)
2762 edge true_edge
, false_edge
;
2764 /* When we are emitting the code or changing CFG, it is possible that
2765 the edges are not yet created. When we are using debug_bb in such
2766 a situation, we do not want it to crash. */
2767 if (EDGE_COUNT (bb
->succs
) != 2)
2769 extract_true_false_edges_from_block (bb
, &true_edge
, &false_edge
);
2771 INDENT (indent
+ 2);
2772 pp_cfg_jump (buffer
, true_edge
, flags
);
2773 newline_and_indent (buffer
, indent
);
2774 pp_string (buffer
, "else");
2775 newline_and_indent (buffer
, indent
+ 2);
2776 pp_cfg_jump (buffer
, false_edge
, flags
);
2777 pp_newline (buffer
);
2781 /* If there is a fallthru edge, we may need to add an artificial
2782 goto to the dump. */
2783 e
= find_fallthru_edge (bb
->succs
);
2785 if (e
&& e
->dest
!= bb
->next_bb
)
2789 if ((flags
& TDF_LINENO
)
2790 && e
->goto_locus
!= UNKNOWN_LOCATION
)
2791 dump_location (buffer
, e
->goto_locus
);
2793 pp_cfg_jump (buffer
, e
, flags
);
2794 pp_newline (buffer
);
2799 /* Dumps basic block BB to buffer BUFFER with details described by FLAGS and
2800 indented by INDENT spaces. */
2803 gimple_dump_bb_buff (pretty_printer
*buffer
, basic_block bb
, int indent
,
2806 gimple_stmt_iterator gsi
;
2808 int label_indent
= indent
- 2;
2810 if (label_indent
< 0)
2813 dump_phi_nodes (buffer
, bb
, indent
, flags
);
2815 for (gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
); gsi_next (&gsi
))
2819 stmt
= gsi_stmt (gsi
);
2821 curr_indent
= gimple_code (stmt
) == GIMPLE_LABEL
? label_indent
: indent
;
2823 INDENT (curr_indent
);
2824 pp_gimple_stmt_1 (buffer
, stmt
, curr_indent
, flags
);
2825 pp_newline_and_flush (buffer
);
2826 gcc_checking_assert (DECL_STRUCT_FUNCTION (current_function_decl
));
2827 dump_histograms_for_stmt (DECL_STRUCT_FUNCTION (current_function_decl
),
2828 pp_buffer (buffer
)->stream
, stmt
);
2831 dump_implicit_edges (buffer
, bb
, indent
, flags
);
2836 /* Dumps basic block BB to FILE with details described by FLAGS and
2837 indented by INDENT spaces. */
2840 gimple_dump_bb (FILE *file
, basic_block bb
, int indent
, dump_flags_t flags
)
2842 dump_gimple_bb_header (file
, bb
, indent
, flags
);
2843 if (bb
->index
>= NUM_FIXED_BLOCKS
)
2845 pretty_printer buffer
;
2846 pp_needs_newline (&buffer
) = true;
2847 buffer
.buffer
->stream
= file
;
2848 gimple_dump_bb_buff (&buffer
, bb
, indent
, flags
);
2850 dump_gimple_bb_footer (file
, bb
, indent
, flags
);
2853 /* Dumps basic block BB to pretty-printer PP with default dump flags and
2854 no indentation, for use as a label of a DOT graph record-node.
2855 ??? Should just use gimple_dump_bb_buff here, except that value profiling
2856 histogram dumping doesn't know about pretty-printers. */
2859 gimple_dump_bb_for_graph (pretty_printer
*pp
, basic_block bb
)
2861 pp_printf (pp
, "<bb %d>:\n", bb
->index
);
2862 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
2864 for (gphi_iterator gsi
= gsi_start_phis (bb
); !gsi_end_p (gsi
);
2867 gphi
*phi
= gsi
.phi ();
2868 if (!virtual_operand_p (gimple_phi_result (phi
))
2869 || (dump_flags
& TDF_VOPS
))
2872 pp_write_text_to_stream (pp
);
2873 pp_string (pp
, "# ");
2874 pp_gimple_stmt_1 (pp
, phi
, 0, dump_flags
);
2876 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
2880 for (gimple_stmt_iterator gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
);
2883 gimple
*stmt
= gsi_stmt (gsi
);
2885 pp_write_text_to_stream (pp
);
2886 pp_gimple_stmt_1 (pp
, stmt
, 0, dump_flags
);
2888 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
2890 dump_implicit_edges (pp
, bb
, 0, dump_flags
);
2891 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
2895 /* Handle the %G format for TEXT. Same as %K in handle_K_format in
2896 tree-pretty-print.c but with a Gimple call statement as an argument. */
2899 percent_G_format (text_info
*text
)
2901 gcall
*stmt
= va_arg (*text
->args_ptr
, gcall
*);
2903 /* Build a call expression from the Gimple call statement and
2904 pass it to the K formatter that knows how to format it. */
2905 tree exp
= build_vl_exp (CALL_EXPR
, gimple_call_num_args (stmt
) + 3);
2906 CALL_EXPR_FN (exp
) = gimple_call_fn (stmt
);
2907 TREE_TYPE (exp
) = gimple_call_return_type (stmt
);
2908 CALL_EXPR_STATIC_CHAIN (exp
) = gimple_call_chain (stmt
);
2909 SET_EXPR_LOCATION (exp
, gimple_location (stmt
));
2911 percent_K_format (text
, exp
);