1 /* Pretty formatting of GIMPLE statements and expressions.
2 Copyright (C) 2001-2017 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, 0);
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
, "))");
361 if (flags
& TDF_GIMPLE
)
363 pp_string (buffer
, "__ABS ");
364 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
368 pp_string (buffer
, "ABS_EXPR <");
369 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
375 if (TREE_CODE_CLASS (rhs_code
) == tcc_declaration
376 || TREE_CODE_CLASS (rhs_code
) == tcc_constant
377 || TREE_CODE_CLASS (rhs_code
) == tcc_reference
378 || rhs_code
== SSA_NAME
379 || rhs_code
== ADDR_EXPR
380 || rhs_code
== CONSTRUCTOR
)
382 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
385 else if (rhs_code
== BIT_NOT_EXPR
)
386 pp_complement (buffer
);
387 else if (rhs_code
== TRUTH_NOT_EXPR
)
388 pp_exclamation (buffer
);
389 else if (rhs_code
== NEGATE_EXPR
)
393 pp_left_bracket (buffer
);
394 pp_string (buffer
, get_tree_code_name (rhs_code
));
395 pp_string (buffer
, "] ");
398 if (op_prio (rhs
) < op_code_prio (rhs_code
))
400 pp_left_paren (buffer
);
401 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
402 pp_right_paren (buffer
);
405 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
411 /* Helper for dump_gimple_assign. Print the binary RHS of the
412 assignment GS. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. */
415 dump_binary_rhs (pretty_printer
*buffer
, gassign
*gs
, int spc
,
419 enum tree_code code
= gimple_assign_rhs_code (gs
);
425 case VEC_WIDEN_MULT_HI_EXPR
:
426 case VEC_WIDEN_MULT_LO_EXPR
:
427 case VEC_WIDEN_MULT_EVEN_EXPR
:
428 case VEC_WIDEN_MULT_ODD_EXPR
:
429 case VEC_PACK_TRUNC_EXPR
:
430 case VEC_PACK_SAT_EXPR
:
431 case VEC_PACK_FIX_TRUNC_EXPR
:
432 case VEC_WIDEN_LSHIFT_HI_EXPR
:
433 case VEC_WIDEN_LSHIFT_LO_EXPR
:
434 case VEC_SERIES_EXPR
:
435 for (p
= get_tree_code_name (code
); *p
; p
++)
436 pp_character (buffer
, TOUPPER (*p
));
437 pp_string (buffer
, " <");
438 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
439 pp_string (buffer
, ", ");
440 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
445 if (op_prio (gimple_assign_rhs1 (gs
)) <= op_code_prio (code
))
447 pp_left_paren (buffer
);
448 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
,
450 pp_right_paren (buffer
);
453 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
455 pp_string (buffer
, op_symbol_code (gimple_assign_rhs_code (gs
)));
457 if (op_prio (gimple_assign_rhs2 (gs
)) <= op_code_prio (code
))
459 pp_left_paren (buffer
);
460 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
,
462 pp_right_paren (buffer
);
465 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
469 /* Helper for dump_gimple_assign. Print the ternary RHS of the
470 assignment GS. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. */
473 dump_ternary_rhs (pretty_printer
*buffer
, gassign
*gs
, int spc
,
477 enum tree_code code
= gimple_assign_rhs_code (gs
);
480 case WIDEN_MULT_PLUS_EXPR
:
481 case WIDEN_MULT_MINUS_EXPR
:
482 for (p
= get_tree_code_name (code
); *p
; p
++)
483 pp_character (buffer
, TOUPPER (*p
));
484 pp_string (buffer
, " <");
485 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
486 pp_string (buffer
, ", ");
487 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
488 pp_string (buffer
, ", ");
489 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
494 if (flags
& TDF_GIMPLE
)
496 pp_string (buffer
, "__FMA (");
497 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
499 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
501 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
502 pp_right_paren (buffer
);
506 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
507 pp_string (buffer
, " * ");
508 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
509 pp_string (buffer
, " + ");
510 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
515 pp_string (buffer
, "DOT_PROD_EXPR <");
516 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
517 pp_string (buffer
, ", ");
518 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
519 pp_string (buffer
, ", ");
520 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
525 pp_string (buffer
, "SAD_EXPR <");
526 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
527 pp_string (buffer
, ", ");
528 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
529 pp_string (buffer
, ", ");
530 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
535 pp_string (buffer
, "VEC_PERM_EXPR <");
536 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
537 pp_string (buffer
, ", ");
538 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
539 pp_string (buffer
, ", ");
540 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
544 case REALIGN_LOAD_EXPR
:
545 pp_string (buffer
, "REALIGN_LOAD <");
546 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
547 pp_string (buffer
, ", ");
548 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
549 pp_string (buffer
, ", ");
550 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
555 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
556 pp_string (buffer
, " ? ");
557 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
558 pp_string (buffer
, " : ");
559 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
563 pp_string (buffer
, "VEC_COND_EXPR <");
564 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
565 pp_string (buffer
, ", ");
566 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
567 pp_string (buffer
, ", ");
568 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
572 case BIT_INSERT_EXPR
:
573 pp_string (buffer
, "BIT_INSERT_EXPR <");
574 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
575 pp_string (buffer
, ", ");
576 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
577 pp_string (buffer
, ", ");
578 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
579 pp_string (buffer
, " (");
580 if (INTEGRAL_TYPE_P (TREE_TYPE (gimple_assign_rhs2 (gs
))))
581 pp_decimal_int (buffer
,
582 TYPE_PRECISION (TREE_TYPE (gimple_assign_rhs2 (gs
))));
584 dump_generic_node (buffer
,
585 TYPE_SIZE (TREE_TYPE (gimple_assign_rhs2 (gs
))),
587 pp_string (buffer
, " bits)>");
596 /* Dump the gimple assignment GS. BUFFER, SPC and FLAGS are as in
600 dump_gimple_assign (pretty_printer
*buffer
, gassign
*gs
, int spc
,
608 switch (gimple_num_ops (gs
))
611 arg3
= gimple_assign_rhs3 (gs
);
614 arg2
= gimple_assign_rhs2 (gs
);
617 arg1
= gimple_assign_rhs1 (gs
);
623 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%s, %T, %T, %T, %T>", gs
,
624 get_tree_code_name (gimple_assign_rhs_code (gs
)),
625 gimple_assign_lhs (gs
), arg1
, arg2
, arg3
);
629 if (!(flags
& TDF_RHS_ONLY
))
631 dump_generic_node (buffer
, gimple_assign_lhs (gs
), spc
, flags
, false);
635 if (gimple_assign_nontemporal_move_p (gs
))
636 pp_string (buffer
, "{nt}");
638 if (gimple_has_volatile_ops (gs
))
639 pp_string (buffer
, "{v}");
644 if (gimple_num_ops (gs
) == 2)
645 dump_unary_rhs (buffer
, gs
, spc
, flags
);
646 else if (gimple_num_ops (gs
) == 3)
647 dump_binary_rhs (buffer
, gs
, spc
, flags
);
648 else if (gimple_num_ops (gs
) == 4)
649 dump_ternary_rhs (buffer
, gs
, spc
, flags
);
652 if (!(flags
& TDF_RHS_ONLY
))
653 pp_semicolon (buffer
);
658 /* Dump the return statement GS. BUFFER, SPC and FLAGS are as in
662 dump_gimple_return (pretty_printer
*buffer
, greturn
*gs
, int spc
,
667 t
= gimple_return_retval (gs
);
668 t2
= gimple_return_retbnd (gs
);
670 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T %T>", gs
, t
, t2
);
673 pp_string (buffer
, "return");
677 dump_generic_node (buffer
, t
, spc
, flags
, false);
681 pp_string (buffer
, ", ");
682 dump_generic_node (buffer
, t2
, spc
, flags
, false);
684 pp_semicolon (buffer
);
689 /* Dump the call arguments for a gimple call. BUFFER, FLAGS are as in
693 dump_gimple_call_args (pretty_printer
*buffer
, gcall
*gs
, dump_flags_t flags
)
697 /* Pretty print first arg to certain internal fns. */
698 if (gimple_call_internal_p (gs
))
700 const char *const *enums
= NULL
;
703 switch (gimple_call_internal_fn (gs
))
707 static const char *const unique_args
[] = {IFN_UNIQUE_CODES
};
711 limit
= ARRAY_SIZE (unique_args
);
716 static const char *const loop_args
[] = {IFN_GOACC_LOOP_CODES
};
719 limit
= ARRAY_SIZE (loop_args
);
722 case IFN_GOACC_REDUCTION
:
724 static const char *const reduction_args
[]
725 = {IFN_GOACC_REDUCTION_CODES
};
727 enums
= reduction_args
;
728 limit
= ARRAY_SIZE (reduction_args
);
733 static const char *const asan_mark_args
[] = {IFN_ASAN_MARK_FLAGS
};
735 enums
= asan_mark_args
;
736 limit
= ARRAY_SIZE (asan_mark_args
);
744 tree arg0
= gimple_call_arg (gs
, 0);
747 if (TREE_CODE (arg0
) == INTEGER_CST
748 && tree_fits_shwi_p (arg0
)
749 && (v
= tree_to_shwi (arg0
)) >= 0 && v
< limit
)
752 pp_string (buffer
, enums
[v
]);
757 for (; i
< gimple_call_num_args (gs
); i
++)
760 pp_string (buffer
, ", ");
761 dump_generic_node (buffer
, gimple_call_arg (gs
, i
), 0, flags
, false);
764 if (gimple_call_va_arg_pack_p (gs
))
767 pp_string (buffer
, ", ");
769 pp_string (buffer
, "__builtin_va_arg_pack ()");
773 /* Dump the points-to solution *PT to BUFFER. */
776 pp_points_to_solution (pretty_printer
*buffer
, struct pt_solution
*pt
)
780 pp_string (buffer
, "anything ");
784 pp_string (buffer
, "nonlocal ");
786 pp_string (buffer
, "escaped ");
788 pp_string (buffer
, "unit-escaped ");
790 pp_string (buffer
, "null ");
792 && !bitmap_empty_p (pt
->vars
))
796 pp_string (buffer
, "{ ");
797 EXECUTE_IF_SET_IN_BITMAP (pt
->vars
, 0, i
, bi
)
799 pp_string (buffer
, "D.");
800 pp_decimal_int (buffer
, i
);
803 pp_right_brace (buffer
);
804 if (pt
->vars_contains_nonlocal
805 || pt
->vars_contains_escaped
806 || pt
->vars_contains_escaped_heap
807 || pt
->vars_contains_restrict
)
809 const char *comma
= "";
810 pp_string (buffer
, " (");
811 if (pt
->vars_contains_nonlocal
)
813 pp_string (buffer
, "nonlocal");
816 if (pt
->vars_contains_escaped
)
818 pp_string (buffer
, comma
);
819 pp_string (buffer
, "escaped");
822 if (pt
->vars_contains_escaped_heap
)
824 pp_string (buffer
, comma
);
825 pp_string (buffer
, "escaped heap");
828 if (pt
->vars_contains_restrict
)
830 pp_string (buffer
, comma
);
831 pp_string (buffer
, "restrict");
834 if (pt
->vars_contains_interposable
)
836 pp_string (buffer
, comma
);
837 pp_string (buffer
, "interposable");
839 pp_string (buffer
, ")");
845 /* Dump the call statement GS. BUFFER, SPC and FLAGS are as in
849 dump_gimple_call (pretty_printer
*buffer
, gcall
*gs
, int spc
,
852 tree lhs
= gimple_call_lhs (gs
);
853 tree fn
= gimple_call_fn (gs
);
855 if (flags
& TDF_ALIAS
)
857 struct pt_solution
*pt
;
858 pt
= gimple_call_use_set (gs
);
859 if (!pt_solution_empty_p (pt
))
861 pp_string (buffer
, "# USE = ");
862 pp_points_to_solution (buffer
, pt
);
863 newline_and_indent (buffer
, spc
);
865 pt
= gimple_call_clobber_set (gs
);
866 if (!pt_solution_empty_p (pt
))
868 pp_string (buffer
, "# CLB = ");
869 pp_points_to_solution (buffer
, pt
);
870 newline_and_indent (buffer
, spc
);
876 if (gimple_call_internal_p (gs
))
877 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%s, %T", gs
,
878 internal_fn_name (gimple_call_internal_fn (gs
)), lhs
);
880 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T", gs
, fn
, lhs
);
881 if (gimple_call_num_args (gs
) > 0)
883 pp_string (buffer
, ", ");
884 dump_gimple_call_args (buffer
, gs
, flags
);
890 if (lhs
&& !(flags
& TDF_RHS_ONLY
))
892 dump_generic_node (buffer
, lhs
, spc
, flags
, false);
893 pp_string (buffer
, " =");
895 if (gimple_has_volatile_ops (gs
))
896 pp_string (buffer
, "{v}");
900 if (gimple_call_internal_p (gs
))
901 pp_string (buffer
, internal_fn_name (gimple_call_internal_fn (gs
)));
903 print_call_name (buffer
, fn
, flags
);
904 pp_string (buffer
, " (");
905 dump_gimple_call_args (buffer
, gs
, flags
);
906 pp_right_paren (buffer
);
907 if (!(flags
& TDF_RHS_ONLY
))
908 pp_semicolon (buffer
);
911 if (gimple_call_chain (gs
))
913 pp_string (buffer
, " [static-chain: ");
914 dump_generic_node (buffer
, gimple_call_chain (gs
), spc
, flags
, false);
915 pp_right_bracket (buffer
);
918 if (gimple_call_return_slot_opt_p (gs
))
919 pp_string (buffer
, " [return slot optimization]");
920 if (gimple_call_tail_p (gs
))
921 pp_string (buffer
, " [tail call]");
922 if (gimple_call_must_tail_p (gs
))
923 pp_string (buffer
, " [must tail call]");
928 /* Dump the arguments of _ITM_beginTransaction sanely. */
929 if (TREE_CODE (fn
) == ADDR_EXPR
)
930 fn
= TREE_OPERAND (fn
, 0);
931 if (TREE_CODE (fn
) == FUNCTION_DECL
&& decl_is_tm_clone (fn
))
932 pp_string (buffer
, " [tm-clone]");
933 if (TREE_CODE (fn
) == FUNCTION_DECL
934 && DECL_BUILT_IN_CLASS (fn
) == BUILT_IN_NORMAL
935 && DECL_FUNCTION_CODE (fn
) == BUILT_IN_TM_START
936 && gimple_call_num_args (gs
) > 0)
938 tree t
= gimple_call_arg (gs
, 0);
939 unsigned HOST_WIDE_INT props
;
940 gcc_assert (TREE_CODE (t
) == INTEGER_CST
);
942 pp_string (buffer
, " [ ");
944 /* Get the transaction code properties. */
945 props
= TREE_INT_CST_LOW (t
);
947 if (props
& PR_INSTRUMENTEDCODE
)
948 pp_string (buffer
, "instrumentedCode ");
949 if (props
& PR_UNINSTRUMENTEDCODE
)
950 pp_string (buffer
, "uninstrumentedCode ");
951 if (props
& PR_HASNOXMMUPDATE
)
952 pp_string (buffer
, "hasNoXMMUpdate ");
953 if (props
& PR_HASNOABORT
)
954 pp_string (buffer
, "hasNoAbort ");
955 if (props
& PR_HASNOIRREVOCABLE
)
956 pp_string (buffer
, "hasNoIrrevocable ");
957 if (props
& PR_DOESGOIRREVOCABLE
)
958 pp_string (buffer
, "doesGoIrrevocable ");
959 if (props
& PR_HASNOSIMPLEREADS
)
960 pp_string (buffer
, "hasNoSimpleReads ");
961 if (props
& PR_AWBARRIERSOMITTED
)
962 pp_string (buffer
, "awBarriersOmitted ");
963 if (props
& PR_RARBARRIERSOMITTED
)
964 pp_string (buffer
, "RaRBarriersOmitted ");
965 if (props
& PR_UNDOLOGCODE
)
966 pp_string (buffer
, "undoLogCode ");
967 if (props
& PR_PREFERUNINSTRUMENTED
)
968 pp_string (buffer
, "preferUninstrumented ");
969 if (props
& PR_EXCEPTIONBLOCK
)
970 pp_string (buffer
, "exceptionBlock ");
971 if (props
& PR_HASELSE
)
972 pp_string (buffer
, "hasElse ");
973 if (props
& PR_READONLY
)
974 pp_string (buffer
, "readOnly ");
976 pp_right_bracket (buffer
);
981 /* Dump the switch statement GS. BUFFER, SPC and FLAGS are as in
985 dump_gimple_switch (pretty_printer
*buffer
, gswitch
*gs
, int spc
,
990 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
992 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, ", gs
,
993 gimple_switch_index (gs
));
996 pp_string (buffer
, "switch (");
997 dump_generic_node (buffer
, gimple_switch_index (gs
), spc
, flags
, true);
998 if (flags
& TDF_GIMPLE
)
999 pp_string (buffer
, ") {");
1001 pp_string (buffer
, ") <");
1004 for (i
= 0; i
< gimple_switch_num_labels (gs
); i
++)
1006 tree case_label
= gimple_switch_label (gs
, i
);
1007 gcc_checking_assert (case_label
!= NULL_TREE
);
1008 dump_generic_node (buffer
, case_label
, spc
, flags
, false);
1010 tree label
= CASE_LABEL (case_label
);
1011 dump_generic_node (buffer
, label
, spc
, flags
, false);
1013 if (cfun
&& cfun
->cfg
)
1015 basic_block dest
= label_to_block (label
);
1018 edge label_edge
= find_edge (gimple_bb (gs
), dest
);
1019 if (label_edge
&& !(flags
& TDF_GIMPLE
))
1020 dump_edge_probability (buffer
, label_edge
);
1024 if (i
< gimple_switch_num_labels (gs
) - 1)
1026 if (flags
& TDF_GIMPLE
)
1027 pp_string (buffer
, "; ");
1029 pp_string (buffer
, ", ");
1032 if (flags
& TDF_GIMPLE
)
1033 pp_string (buffer
, "; }");
1035 pp_greater (buffer
);
1039 /* Dump the gimple conditional GS. BUFFER, SPC and FLAGS are as in
1040 pp_gimple_stmt_1. */
1043 dump_gimple_cond (pretty_printer
*buffer
, gcond
*gs
, int spc
,
1046 if (flags
& TDF_RAW
)
1047 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%s, %T, %T, %T, %T>", gs
,
1048 get_tree_code_name (gimple_cond_code (gs
)),
1049 gimple_cond_lhs (gs
), gimple_cond_rhs (gs
),
1050 gimple_cond_true_label (gs
), gimple_cond_false_label (gs
));
1053 if (!(flags
& TDF_RHS_ONLY
))
1054 pp_string (buffer
, "if (");
1055 dump_generic_node (buffer
, gimple_cond_lhs (gs
), spc
, flags
, false);
1057 pp_string (buffer
, op_symbol_code (gimple_cond_code (gs
)));
1059 dump_generic_node (buffer
, gimple_cond_rhs (gs
), spc
, flags
, false);
1060 if (!(flags
& TDF_RHS_ONLY
))
1063 edge e
, true_edge
= NULL
, false_edge
= NULL
;
1064 basic_block bb
= gimple_bb (gs
);
1068 FOR_EACH_EDGE (e
, ei
, bb
->succs
)
1070 if (e
->flags
& EDGE_TRUE_VALUE
)
1072 else if (e
->flags
& EDGE_FALSE_VALUE
)
1077 bool has_edge_info
= true_edge
!= NULL
&& false_edge
!= NULL
;
1079 pp_right_paren (buffer
);
1081 if (gimple_cond_true_label (gs
))
1083 pp_string (buffer
, " goto ");
1084 dump_generic_node (buffer
, gimple_cond_true_label (gs
),
1086 if (has_edge_info
&& !(flags
& TDF_GIMPLE
))
1087 dump_edge_probability (buffer
, true_edge
);
1088 pp_semicolon (buffer
);
1090 if (gimple_cond_false_label (gs
))
1092 pp_string (buffer
, " else goto ");
1093 dump_generic_node (buffer
, gimple_cond_false_label (gs
),
1095 if (has_edge_info
&& !(flags
& TDF_GIMPLE
))
1096 dump_edge_probability (buffer
, false_edge
);
1098 pp_semicolon (buffer
);
1105 /* Dump a GIMPLE_LABEL tuple on the pretty_printer BUFFER, SPC
1106 spaces of indent. FLAGS specifies details to show in the dump (see
1107 TDF_* in dumpfils.h). */
1110 dump_gimple_label (pretty_printer
*buffer
, glabel
*gs
, int spc
,
1113 tree label
= gimple_label_label (gs
);
1114 if (flags
& TDF_RAW
)
1115 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
, label
);
1118 dump_generic_node (buffer
, label
, spc
, flags
, false);
1121 if (flags
& TDF_GIMPLE
)
1123 if (DECL_NONLOCAL (label
))
1124 pp_string (buffer
, " [non-local]");
1125 if ((flags
& TDF_EH
) && EH_LANDING_PAD_NR (label
))
1126 pp_printf (buffer
, " [LP %d]", EH_LANDING_PAD_NR (label
));
1129 /* Dump a GIMPLE_GOTO tuple on the pretty_printer BUFFER, SPC
1130 spaces of indent. FLAGS specifies details to show in the dump (see
1131 TDF_* in dumpfile.h). */
1134 dump_gimple_goto (pretty_printer
*buffer
, ggoto
*gs
, int spc
,
1137 tree label
= gimple_goto_dest (gs
);
1138 if (flags
& TDF_RAW
)
1139 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
, label
);
1141 dump_gimple_fmt (buffer
, spc
, flags
, "goto %T;", label
);
1145 /* Dump a GIMPLE_BIND tuple on the pretty_printer BUFFER, SPC
1146 spaces of indent. FLAGS specifies details to show in the dump (see
1147 TDF_* in dumpfile.h). */
1150 dump_gimple_bind (pretty_printer
*buffer
, gbind
*gs
, int spc
,
1153 if (flags
& TDF_RAW
)
1154 dump_gimple_fmt (buffer
, spc
, flags
, "%G <", gs
);
1156 pp_left_brace (buffer
);
1157 if (!(flags
& TDF_SLIM
))
1161 for (var
= gimple_bind_vars (gs
); var
; var
= DECL_CHAIN (var
))
1163 newline_and_indent (buffer
, 2);
1164 print_declaration (buffer
, var
, spc
, flags
);
1166 if (gimple_bind_vars (gs
))
1167 pp_newline (buffer
);
1169 pp_newline (buffer
);
1170 dump_gimple_seq (buffer
, gimple_bind_body (gs
), spc
+ 2, flags
);
1171 newline_and_indent (buffer
, spc
);
1172 if (flags
& TDF_RAW
)
1173 pp_greater (buffer
);
1175 pp_right_brace (buffer
);
1179 /* Dump a GIMPLE_TRY tuple on the pretty_printer BUFFER, SPC spaces of
1180 indent. FLAGS specifies details to show in the dump (see TDF_* in
1184 dump_gimple_try (pretty_printer
*buffer
, gtry
*gs
, int spc
,
1187 if (flags
& TDF_RAW
)
1190 if (gimple_try_kind (gs
) == GIMPLE_TRY_CATCH
)
1191 type
= "GIMPLE_TRY_CATCH";
1192 else if (gimple_try_kind (gs
) == GIMPLE_TRY_FINALLY
)
1193 type
= "GIMPLE_TRY_FINALLY";
1195 type
= "UNKNOWN GIMPLE_TRY";
1196 dump_gimple_fmt (buffer
, spc
, flags
,
1197 "%G <%s,%+EVAL <%S>%nCLEANUP <%S>%->", gs
, type
,
1198 gimple_try_eval (gs
), gimple_try_cleanup (gs
));
1202 pp_string (buffer
, "try");
1203 newline_and_indent (buffer
, spc
+ 2);
1204 pp_left_brace (buffer
);
1205 pp_newline (buffer
);
1207 dump_gimple_seq (buffer
, gimple_try_eval (gs
), spc
+ 4, flags
);
1208 newline_and_indent (buffer
, spc
+ 2);
1209 pp_right_brace (buffer
);
1211 if (gimple_try_kind (gs
) == GIMPLE_TRY_CATCH
)
1213 newline_and_indent (buffer
, spc
);
1214 pp_string (buffer
, "catch");
1215 newline_and_indent (buffer
, spc
+ 2);
1216 pp_left_brace (buffer
);
1218 else if (gimple_try_kind (gs
) == GIMPLE_TRY_FINALLY
)
1220 newline_and_indent (buffer
, spc
);
1221 pp_string (buffer
, "finally");
1222 newline_and_indent (buffer
, spc
+ 2);
1223 pp_left_brace (buffer
);
1226 pp_string (buffer
, " <UNKNOWN GIMPLE_TRY> {");
1228 pp_newline (buffer
);
1229 dump_gimple_seq (buffer
, gimple_try_cleanup (gs
), spc
+ 4, flags
);
1230 newline_and_indent (buffer
, spc
+ 2);
1231 pp_right_brace (buffer
);
1236 /* Dump a GIMPLE_CATCH tuple on the pretty_printer BUFFER, SPC spaces of
1237 indent. FLAGS specifies details to show in the dump (see TDF_* in
1241 dump_gimple_catch (pretty_printer
*buffer
, gcatch
*gs
, int spc
,
1244 if (flags
& TDF_RAW
)
1245 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %+CATCH <%S>%->", gs
,
1246 gimple_catch_types (gs
), gimple_catch_handler (gs
));
1248 dump_gimple_fmt (buffer
, spc
, flags
, "catch (%T)%+{%S}",
1249 gimple_catch_types (gs
), gimple_catch_handler (gs
));
1253 /* Dump a GIMPLE_EH_FILTER tuple on the pretty_printer BUFFER, SPC spaces of
1254 indent. FLAGS specifies details to show in the dump (see TDF_* in
1258 dump_gimple_eh_filter (pretty_printer
*buffer
, geh_filter
*gs
, int spc
,
1261 if (flags
& TDF_RAW
)
1262 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %+FAILURE <%S>%->", gs
,
1263 gimple_eh_filter_types (gs
),
1264 gimple_eh_filter_failure (gs
));
1266 dump_gimple_fmt (buffer
, spc
, flags
, "<<<eh_filter (%T)>>>%+{%+%S%-}",
1267 gimple_eh_filter_types (gs
),
1268 gimple_eh_filter_failure (gs
));
1272 /* Dump a GIMPLE_EH_MUST_NOT_THROW tuple. */
1275 dump_gimple_eh_must_not_throw (pretty_printer
*buffer
,
1276 geh_mnt
*gs
, int spc
, dump_flags_t flags
)
1278 if (flags
& TDF_RAW
)
1279 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
,
1280 gimple_eh_must_not_throw_fndecl (gs
));
1282 dump_gimple_fmt (buffer
, spc
, flags
, "<<<eh_must_not_throw (%T)>>>",
1283 gimple_eh_must_not_throw_fndecl (gs
));
1287 /* Dump a GIMPLE_EH_ELSE tuple on the pretty_printer BUFFER, SPC spaces of
1288 indent. FLAGS specifies details to show in the dump (see TDF_* in
1292 dump_gimple_eh_else (pretty_printer
*buffer
, geh_else
*gs
, int spc
,
1295 if (flags
& TDF_RAW
)
1296 dump_gimple_fmt (buffer
, spc
, flags
,
1297 "%G <%+N_BODY <%S>%nE_BODY <%S>%->", gs
,
1298 gimple_eh_else_n_body (gs
), gimple_eh_else_e_body (gs
));
1300 dump_gimple_fmt (buffer
, spc
, flags
,
1301 "<<<if_normal_exit>>>%+{%S}%-<<<else_eh_exit>>>%+{%S}",
1302 gimple_eh_else_n_body (gs
), gimple_eh_else_e_body (gs
));
1306 /* Dump a GIMPLE_RESX tuple on the pretty_printer BUFFER, SPC spaces of
1307 indent. FLAGS specifies details to show in the dump (see TDF_* in
1311 dump_gimple_resx (pretty_printer
*buffer
, gresx
*gs
, int spc
,
1314 if (flags
& TDF_RAW
)
1315 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%d>", gs
,
1316 gimple_resx_region (gs
));
1318 dump_gimple_fmt (buffer
, spc
, flags
, "resx %d", gimple_resx_region (gs
));
1321 /* Dump a GIMPLE_EH_DISPATCH tuple on the pretty_printer BUFFER. */
1324 dump_gimple_eh_dispatch (pretty_printer
*buffer
, geh_dispatch
*gs
, int spc
,
1327 if (flags
& TDF_RAW
)
1328 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%d>", gs
,
1329 gimple_eh_dispatch_region (gs
));
1331 dump_gimple_fmt (buffer
, spc
, flags
, "eh_dispatch %d",
1332 gimple_eh_dispatch_region (gs
));
1335 /* Dump a GIMPLE_DEBUG tuple on the pretty_printer BUFFER, SPC spaces
1336 of indent. FLAGS specifies details to show in the dump (see TDF_*
1340 dump_gimple_debug (pretty_printer
*buffer
, gdebug
*gs
, int spc
,
1343 switch (gs
->subcode
)
1345 case GIMPLE_DEBUG_BIND
:
1346 if (flags
& TDF_RAW
)
1347 dump_gimple_fmt (buffer
, spc
, flags
, "%G BIND <%T, %T>", gs
,
1348 gimple_debug_bind_get_var (gs
),
1349 gimple_debug_bind_get_value (gs
));
1351 dump_gimple_fmt (buffer
, spc
, flags
, "# DEBUG %T => %T",
1352 gimple_debug_bind_get_var (gs
),
1353 gimple_debug_bind_get_value (gs
));
1356 case GIMPLE_DEBUG_SOURCE_BIND
:
1357 if (flags
& TDF_RAW
)
1358 dump_gimple_fmt (buffer
, spc
, flags
, "%G SRCBIND <%T, %T>", gs
,
1359 gimple_debug_source_bind_get_var (gs
),
1360 gimple_debug_source_bind_get_value (gs
));
1362 dump_gimple_fmt (buffer
, spc
, flags
, "# DEBUG %T s=> %T",
1363 gimple_debug_source_bind_get_var (gs
),
1364 gimple_debug_source_bind_get_value (gs
));
1367 case GIMPLE_DEBUG_BEGIN_STMT
:
1368 if (flags
& TDF_RAW
)
1369 dump_gimple_fmt (buffer
, spc
, flags
, "%G BEGIN_STMT", gs
);
1371 dump_gimple_fmt (buffer
, spc
, flags
, "# DEBUG BEGIN_STMT");
1379 /* Dump a GIMPLE_OMP_FOR tuple on the pretty_printer BUFFER. */
1381 dump_gimple_omp_for (pretty_printer
*buffer
, gomp_for
*gs
, int spc
,
1386 if (flags
& TDF_RAW
)
1389 switch (gimple_omp_for_kind (gs
))
1391 case GF_OMP_FOR_KIND_FOR
:
1394 case GF_OMP_FOR_KIND_DISTRIBUTE
:
1395 kind
= " distribute";
1397 case GF_OMP_FOR_KIND_TASKLOOP
:
1400 case GF_OMP_FOR_KIND_OACC_LOOP
:
1401 kind
= " oacc_loop";
1403 case GF_OMP_FOR_KIND_SIMD
:
1409 dump_gimple_fmt (buffer
, spc
, flags
, "%G%s <%+BODY <%S>%nCLAUSES <", gs
,
1410 kind
, gimple_omp_body (gs
));
1411 dump_omp_clauses (buffer
, gimple_omp_for_clauses (gs
), spc
, flags
);
1412 dump_gimple_fmt (buffer
, spc
, flags
, " >,");
1413 for (i
= 0; i
< gimple_omp_for_collapse (gs
); i
++)
1414 dump_gimple_fmt (buffer
, spc
, flags
,
1415 "%+%T, %T, %T, %s, %T,%n",
1416 gimple_omp_for_index (gs
, i
),
1417 gimple_omp_for_initial (gs
, i
),
1418 gimple_omp_for_final (gs
, i
),
1419 get_tree_code_name (gimple_omp_for_cond (gs
, i
)),
1420 gimple_omp_for_incr (gs
, i
));
1421 dump_gimple_fmt (buffer
, spc
, flags
, "PRE_BODY <%S>%->",
1422 gimple_omp_for_pre_body (gs
));
1426 switch (gimple_omp_for_kind (gs
))
1428 case GF_OMP_FOR_KIND_FOR
:
1429 pp_string (buffer
, "#pragma omp for");
1431 case GF_OMP_FOR_KIND_DISTRIBUTE
:
1432 pp_string (buffer
, "#pragma omp distribute");
1434 case GF_OMP_FOR_KIND_TASKLOOP
:
1435 pp_string (buffer
, "#pragma omp taskloop");
1437 case GF_OMP_FOR_KIND_OACC_LOOP
:
1438 pp_string (buffer
, "#pragma acc loop");
1440 case GF_OMP_FOR_KIND_SIMD
:
1441 pp_string (buffer
, "#pragma omp simd");
1443 case GF_OMP_FOR_KIND_GRID_LOOP
:
1444 pp_string (buffer
, "#pragma omp for grid_loop");
1449 dump_omp_clauses (buffer
, gimple_omp_for_clauses (gs
), spc
, flags
);
1450 for (i
= 0; i
< gimple_omp_for_collapse (gs
); i
++)
1454 newline_and_indent (buffer
, spc
);
1455 pp_string (buffer
, "for (");
1456 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
1458 pp_string (buffer
, " = ");
1459 dump_generic_node (buffer
, gimple_omp_for_initial (gs
, i
), spc
,
1461 pp_string (buffer
, "; ");
1463 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
1466 switch (gimple_omp_for_cond (gs
, i
))
1472 pp_greater (buffer
);
1475 pp_less_equal (buffer
);
1478 pp_greater_equal (buffer
);
1481 pp_string (buffer
, "!=");
1487 dump_generic_node (buffer
, gimple_omp_for_final (gs
, i
), spc
,
1489 pp_string (buffer
, "; ");
1491 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
1493 pp_string (buffer
, " = ");
1494 dump_generic_node (buffer
, gimple_omp_for_incr (gs
, i
), spc
,
1496 pp_right_paren (buffer
);
1499 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1501 newline_and_indent (buffer
, spc
+ 2);
1502 pp_left_brace (buffer
);
1503 pp_newline (buffer
);
1504 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1505 newline_and_indent (buffer
, spc
+ 2);
1506 pp_right_brace (buffer
);
1511 /* Dump a GIMPLE_OMP_CONTINUE tuple on the pretty_printer BUFFER. */
1514 dump_gimple_omp_continue (pretty_printer
*buffer
, gomp_continue
*gs
,
1515 int spc
, dump_flags_t flags
)
1517 if (flags
& TDF_RAW
)
1519 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T>", gs
,
1520 gimple_omp_continue_control_def (gs
),
1521 gimple_omp_continue_control_use (gs
));
1525 pp_string (buffer
, "#pragma omp continue (");
1526 dump_generic_node (buffer
, gimple_omp_continue_control_def (gs
),
1530 dump_generic_node (buffer
, gimple_omp_continue_control_use (gs
),
1532 pp_right_paren (buffer
);
1536 /* Dump a GIMPLE_OMP_SINGLE tuple on the pretty_printer BUFFER. */
1539 dump_gimple_omp_single (pretty_printer
*buffer
, gomp_single
*gs
,
1540 int spc
, dump_flags_t flags
)
1542 if (flags
& TDF_RAW
)
1544 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1545 gimple_omp_body (gs
));
1546 dump_omp_clauses (buffer
, gimple_omp_single_clauses (gs
), spc
, flags
);
1547 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1551 pp_string (buffer
, "#pragma omp single");
1552 dump_omp_clauses (buffer
, gimple_omp_single_clauses (gs
), spc
, flags
);
1553 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1555 newline_and_indent (buffer
, spc
+ 2);
1556 pp_left_brace (buffer
);
1557 pp_newline (buffer
);
1558 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1559 newline_and_indent (buffer
, spc
+ 2);
1560 pp_right_brace (buffer
);
1565 /* Dump a GIMPLE_OMP_TARGET tuple on the pretty_printer BUFFER. */
1568 dump_gimple_omp_target (pretty_printer
*buffer
, gomp_target
*gs
,
1569 int spc
, dump_flags_t flags
)
1572 switch (gimple_omp_target_kind (gs
))
1574 case GF_OMP_TARGET_KIND_REGION
:
1577 case GF_OMP_TARGET_KIND_DATA
:
1580 case GF_OMP_TARGET_KIND_UPDATE
:
1583 case GF_OMP_TARGET_KIND_ENTER_DATA
:
1584 kind
= " enter data";
1586 case GF_OMP_TARGET_KIND_EXIT_DATA
:
1587 kind
= " exit data";
1589 case GF_OMP_TARGET_KIND_OACC_KERNELS
:
1590 kind
= " oacc_kernels";
1592 case GF_OMP_TARGET_KIND_OACC_PARALLEL
:
1593 kind
= " oacc_parallel";
1595 case GF_OMP_TARGET_KIND_OACC_DATA
:
1596 kind
= " oacc_data";
1598 case GF_OMP_TARGET_KIND_OACC_UPDATE
:
1599 kind
= " oacc_update";
1601 case GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA
:
1602 kind
= " oacc_enter_exit_data";
1604 case GF_OMP_TARGET_KIND_OACC_DECLARE
:
1605 kind
= " oacc_declare";
1607 case GF_OMP_TARGET_KIND_OACC_HOST_DATA
:
1608 kind
= " oacc_host_data";
1613 if (flags
& TDF_RAW
)
1615 dump_gimple_fmt (buffer
, spc
, flags
, "%G%s <%+BODY <%S>%nCLAUSES <", gs
,
1616 kind
, gimple_omp_body (gs
));
1617 dump_omp_clauses (buffer
, gimple_omp_target_clauses (gs
), spc
, flags
);
1618 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T%n>",
1619 gimple_omp_target_child_fn (gs
),
1620 gimple_omp_target_data_arg (gs
));
1624 pp_string (buffer
, "#pragma omp target");
1625 pp_string (buffer
, kind
);
1626 dump_omp_clauses (buffer
, gimple_omp_target_clauses (gs
), spc
, flags
);
1627 if (gimple_omp_target_child_fn (gs
))
1629 pp_string (buffer
, " [child fn: ");
1630 dump_generic_node (buffer
, gimple_omp_target_child_fn (gs
),
1632 pp_string (buffer
, " (");
1633 if (gimple_omp_target_data_arg (gs
))
1634 dump_generic_node (buffer
, gimple_omp_target_data_arg (gs
),
1637 pp_string (buffer
, "???");
1638 pp_string (buffer
, ")]");
1640 gimple_seq body
= gimple_omp_body (gs
);
1641 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
1643 newline_and_indent (buffer
, spc
+ 2);
1644 pp_left_brace (buffer
);
1645 pp_newline (buffer
);
1646 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
1647 newline_and_indent (buffer
, spc
+ 2);
1648 pp_right_brace (buffer
);
1652 pp_newline (buffer
);
1653 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
1658 /* Dump a GIMPLE_OMP_TEAMS tuple on the pretty_printer BUFFER. */
1661 dump_gimple_omp_teams (pretty_printer
*buffer
, gomp_teams
*gs
, int spc
,
1664 if (flags
& TDF_RAW
)
1666 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1667 gimple_omp_body (gs
));
1668 dump_omp_clauses (buffer
, gimple_omp_teams_clauses (gs
), spc
, flags
);
1669 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1673 pp_string (buffer
, "#pragma omp teams");
1674 dump_omp_clauses (buffer
, gimple_omp_teams_clauses (gs
), spc
, flags
);
1675 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1677 newline_and_indent (buffer
, spc
+ 2);
1678 pp_character (buffer
, '{');
1679 pp_newline (buffer
);
1680 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1681 newline_and_indent (buffer
, spc
+ 2);
1682 pp_character (buffer
, '}');
1687 /* Dump a GIMPLE_OMP_SECTIONS tuple on the pretty_printer BUFFER. */
1690 dump_gimple_omp_sections (pretty_printer
*buffer
, gomp_sections
*gs
,
1691 int spc
, dump_flags_t flags
)
1693 if (flags
& TDF_RAW
)
1695 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1696 gimple_omp_body (gs
));
1697 dump_omp_clauses (buffer
, gimple_omp_sections_clauses (gs
), spc
, flags
);
1698 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1702 pp_string (buffer
, "#pragma omp sections");
1703 if (gimple_omp_sections_control (gs
))
1705 pp_string (buffer
, " <");
1706 dump_generic_node (buffer
, gimple_omp_sections_control (gs
), spc
,
1708 pp_greater (buffer
);
1710 dump_omp_clauses (buffer
, gimple_omp_sections_clauses (gs
), spc
, flags
);
1711 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1713 newline_and_indent (buffer
, spc
+ 2);
1714 pp_left_brace (buffer
);
1715 pp_newline (buffer
);
1716 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1717 newline_and_indent (buffer
, spc
+ 2);
1718 pp_right_brace (buffer
);
1723 /* Dump a GIMPLE_OMP_{MASTER,TASKGROUP,ORDERED,SECTION} tuple on the
1724 pretty_printer BUFFER. */
1727 dump_gimple_omp_block (pretty_printer
*buffer
, gimple
*gs
, int spc
,
1730 if (flags
& TDF_RAW
)
1731 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1732 gimple_omp_body (gs
));
1735 switch (gimple_code (gs
))
1737 case GIMPLE_OMP_MASTER
:
1738 pp_string (buffer
, "#pragma omp master");
1740 case GIMPLE_OMP_TASKGROUP
:
1741 pp_string (buffer
, "#pragma omp taskgroup");
1743 case GIMPLE_OMP_SECTION
:
1744 pp_string (buffer
, "#pragma omp section");
1746 case GIMPLE_OMP_GRID_BODY
:
1747 pp_string (buffer
, "#pragma omp gridified body");
1752 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1754 newline_and_indent (buffer
, spc
+ 2);
1755 pp_left_brace (buffer
);
1756 pp_newline (buffer
);
1757 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1758 newline_and_indent (buffer
, spc
+ 2);
1759 pp_right_brace (buffer
);
1764 /* Dump a GIMPLE_OMP_CRITICAL tuple on the pretty_printer BUFFER. */
1767 dump_gimple_omp_critical (pretty_printer
*buffer
, gomp_critical
*gs
,
1768 int spc
, dump_flags_t flags
)
1770 if (flags
& TDF_RAW
)
1771 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1772 gimple_omp_body (gs
));
1775 pp_string (buffer
, "#pragma omp critical");
1776 if (gimple_omp_critical_name (gs
))
1778 pp_string (buffer
, " (");
1779 dump_generic_node (buffer
, gimple_omp_critical_name (gs
), spc
,
1781 pp_right_paren (buffer
);
1783 dump_omp_clauses (buffer
, gimple_omp_critical_clauses (gs
), spc
, flags
);
1784 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1786 newline_and_indent (buffer
, spc
+ 2);
1787 pp_left_brace (buffer
);
1788 pp_newline (buffer
);
1789 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1790 newline_and_indent (buffer
, spc
+ 2);
1791 pp_right_brace (buffer
);
1796 /* Dump a GIMPLE_OMP_ORDERED tuple on the pretty_printer BUFFER. */
1799 dump_gimple_omp_ordered (pretty_printer
*buffer
, gomp_ordered
*gs
,
1800 int spc
, dump_flags_t flags
)
1802 if (flags
& TDF_RAW
)
1803 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1804 gimple_omp_body (gs
));
1807 pp_string (buffer
, "#pragma omp ordered");
1808 dump_omp_clauses (buffer
, gimple_omp_ordered_clauses (gs
), spc
, flags
);
1809 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1811 newline_and_indent (buffer
, spc
+ 2);
1812 pp_left_brace (buffer
);
1813 pp_newline (buffer
);
1814 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1815 newline_and_indent (buffer
, spc
+ 2);
1816 pp_right_brace (buffer
);
1821 /* Dump a GIMPLE_OMP_RETURN tuple on the pretty_printer BUFFER. */
1824 dump_gimple_omp_return (pretty_printer
*buffer
, gimple
*gs
, int spc
,
1827 if (flags
& TDF_RAW
)
1829 dump_gimple_fmt (buffer
, spc
, flags
, "%G <nowait=%d", gs
,
1830 (int) gimple_omp_return_nowait_p (gs
));
1831 if (gimple_omp_return_lhs (gs
))
1832 dump_gimple_fmt (buffer
, spc
, flags
, ", lhs=%T>",
1833 gimple_omp_return_lhs (gs
));
1835 dump_gimple_fmt (buffer
, spc
, flags
, ">");
1839 pp_string (buffer
, "#pragma omp return");
1840 if (gimple_omp_return_nowait_p (gs
))
1841 pp_string (buffer
, "(nowait)");
1842 if (gimple_omp_return_lhs (gs
))
1844 pp_string (buffer
, " (set ");
1845 dump_generic_node (buffer
, gimple_omp_return_lhs (gs
),
1847 pp_character (buffer
, ')');
1852 /* Dump a GIMPLE_TRANSACTION tuple on the pretty_printer BUFFER. */
1855 dump_gimple_transaction (pretty_printer
*buffer
, gtransaction
*gs
,
1856 int spc
, dump_flags_t flags
)
1858 unsigned subcode
= gimple_transaction_subcode (gs
);
1860 if (flags
& TDF_RAW
)
1862 dump_gimple_fmt (buffer
, spc
, flags
,
1863 "%G [SUBCODE=%x,NORM=%T,UNINST=%T,OVER=%T] "
1865 gs
, subcode
, gimple_transaction_label_norm (gs
),
1866 gimple_transaction_label_uninst (gs
),
1867 gimple_transaction_label_over (gs
),
1868 gimple_transaction_body (gs
));
1872 if (subcode
& GTMA_IS_OUTER
)
1873 pp_string (buffer
, "__transaction_atomic [[outer]]");
1874 else if (subcode
& GTMA_IS_RELAXED
)
1875 pp_string (buffer
, "__transaction_relaxed");
1877 pp_string (buffer
, "__transaction_atomic");
1878 subcode
&= ~GTMA_DECLARATION_MASK
;
1880 if (gimple_transaction_body (gs
))
1882 newline_and_indent (buffer
, spc
+ 2);
1883 pp_left_brace (buffer
);
1884 pp_newline (buffer
);
1885 dump_gimple_seq (buffer
, gimple_transaction_body (gs
),
1887 newline_and_indent (buffer
, spc
+ 2);
1888 pp_right_brace (buffer
);
1892 pp_string (buffer
, " //");
1893 if (gimple_transaction_label_norm (gs
))
1895 pp_string (buffer
, " NORM=");
1896 dump_generic_node (buffer
, gimple_transaction_label_norm (gs
),
1899 if (gimple_transaction_label_uninst (gs
))
1901 pp_string (buffer
, " UNINST=");
1902 dump_generic_node (buffer
, gimple_transaction_label_uninst (gs
),
1905 if (gimple_transaction_label_over (gs
))
1907 pp_string (buffer
, " OVER=");
1908 dump_generic_node (buffer
, gimple_transaction_label_over (gs
),
1913 pp_string (buffer
, " SUBCODE=[ ");
1914 if (subcode
& GTMA_HAVE_ABORT
)
1916 pp_string (buffer
, "GTMA_HAVE_ABORT ");
1917 subcode
&= ~GTMA_HAVE_ABORT
;
1919 if (subcode
& GTMA_HAVE_LOAD
)
1921 pp_string (buffer
, "GTMA_HAVE_LOAD ");
1922 subcode
&= ~GTMA_HAVE_LOAD
;
1924 if (subcode
& GTMA_HAVE_STORE
)
1926 pp_string (buffer
, "GTMA_HAVE_STORE ");
1927 subcode
&= ~GTMA_HAVE_STORE
;
1929 if (subcode
& GTMA_MAY_ENTER_IRREVOCABLE
)
1931 pp_string (buffer
, "GTMA_MAY_ENTER_IRREVOCABLE ");
1932 subcode
&= ~GTMA_MAY_ENTER_IRREVOCABLE
;
1934 if (subcode
& GTMA_DOES_GO_IRREVOCABLE
)
1936 pp_string (buffer
, "GTMA_DOES_GO_IRREVOCABLE ");
1937 subcode
&= ~GTMA_DOES_GO_IRREVOCABLE
;
1939 if (subcode
& GTMA_HAS_NO_INSTRUMENTATION
)
1941 pp_string (buffer
, "GTMA_HAS_NO_INSTRUMENTATION ");
1942 subcode
&= ~GTMA_HAS_NO_INSTRUMENTATION
;
1945 pp_printf (buffer
, "0x%x ", subcode
);
1946 pp_right_bracket (buffer
);
1952 /* Dump a GIMPLE_ASM tuple on the pretty_printer BUFFER, SPC spaces of
1953 indent. FLAGS specifies details to show in the dump (see TDF_* in
1957 dump_gimple_asm (pretty_printer
*buffer
, gasm
*gs
, int spc
, dump_flags_t flags
)
1959 unsigned int i
, n
, f
, fields
;
1961 if (flags
& TDF_RAW
)
1963 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+STRING <%n%s%n>", gs
,
1964 gimple_asm_string (gs
));
1966 n
= gimple_asm_noutputs (gs
);
1969 newline_and_indent (buffer
, spc
+ 2);
1970 pp_string (buffer
, "OUTPUT: ");
1971 for (i
= 0; i
< n
; i
++)
1973 dump_generic_node (buffer
, gimple_asm_output_op (gs
, i
),
1976 pp_string (buffer
, ", ");
1980 n
= gimple_asm_ninputs (gs
);
1983 newline_and_indent (buffer
, spc
+ 2);
1984 pp_string (buffer
, "INPUT: ");
1985 for (i
= 0; i
< n
; i
++)
1987 dump_generic_node (buffer
, gimple_asm_input_op (gs
, i
),
1990 pp_string (buffer
, ", ");
1994 n
= gimple_asm_nclobbers (gs
);
1997 newline_and_indent (buffer
, spc
+ 2);
1998 pp_string (buffer
, "CLOBBER: ");
1999 for (i
= 0; i
< n
; i
++)
2001 dump_generic_node (buffer
, gimple_asm_clobber_op (gs
, i
),
2004 pp_string (buffer
, ", ");
2008 n
= gimple_asm_nlabels (gs
);
2011 newline_and_indent (buffer
, spc
+ 2);
2012 pp_string (buffer
, "LABEL: ");
2013 for (i
= 0; i
< n
; i
++)
2015 dump_generic_node (buffer
, gimple_asm_label_op (gs
, i
),
2018 pp_string (buffer
, ", ");
2022 newline_and_indent (buffer
, spc
);
2023 pp_greater (buffer
);
2027 pp_string (buffer
, "__asm__");
2028 if (gimple_asm_volatile_p (gs
))
2029 pp_string (buffer
, " __volatile__");
2030 if (gimple_asm_nlabels (gs
))
2031 pp_string (buffer
, " goto");
2032 pp_string (buffer
, "(\"");
2033 pp_string (buffer
, gimple_asm_string (gs
));
2034 pp_string (buffer
, "\"");
2036 if (gimple_asm_nlabels (gs
))
2038 else if (gimple_asm_nclobbers (gs
))
2040 else if (gimple_asm_ninputs (gs
))
2042 else if (gimple_asm_noutputs (gs
))
2047 for (f
= 0; f
< fields
; ++f
)
2049 pp_string (buffer
, " : ");
2054 n
= gimple_asm_noutputs (gs
);
2055 for (i
= 0; i
< n
; i
++)
2057 dump_generic_node (buffer
, gimple_asm_output_op (gs
, i
),
2060 pp_string (buffer
, ", ");
2065 n
= gimple_asm_ninputs (gs
);
2066 for (i
= 0; i
< n
; i
++)
2068 dump_generic_node (buffer
, gimple_asm_input_op (gs
, i
),
2071 pp_string (buffer
, ", ");
2076 n
= gimple_asm_nclobbers (gs
);
2077 for (i
= 0; i
< n
; i
++)
2079 dump_generic_node (buffer
, gimple_asm_clobber_op (gs
, i
),
2082 pp_string (buffer
, ", ");
2087 n
= gimple_asm_nlabels (gs
);
2088 for (i
= 0; i
< n
; i
++)
2090 dump_generic_node (buffer
, gimple_asm_label_op (gs
, i
),
2093 pp_string (buffer
, ", ");
2102 pp_string (buffer
, ");");
2106 /* Dump ptr_info and range_info for NODE on pretty_printer BUFFER with
2107 SPC spaces of indent. */
2110 dump_ssaname_info (pretty_printer
*buffer
, tree node
, int spc
)
2112 if (TREE_CODE (node
) != SSA_NAME
)
2115 if (POINTER_TYPE_P (TREE_TYPE (node
))
2116 && SSA_NAME_PTR_INFO (node
))
2118 unsigned int align
, misalign
;
2119 struct ptr_info_def
*pi
= SSA_NAME_PTR_INFO (node
);
2120 pp_string (buffer
, "# PT = ");
2121 pp_points_to_solution (buffer
, &pi
->pt
);
2122 newline_and_indent (buffer
, spc
);
2123 if (get_ptr_info_alignment (pi
, &align
, &misalign
))
2125 pp_printf (buffer
, "# ALIGN = %u, MISALIGN = %u", align
, misalign
);
2126 newline_and_indent (buffer
, spc
);
2130 if (!POINTER_TYPE_P (TREE_TYPE (node
))
2131 && SSA_NAME_RANGE_INFO (node
))
2133 wide_int min
, max
, nonzero_bits
;
2134 value_range_type range_type
= get_range_info (node
, &min
, &max
);
2136 if (range_type
== VR_VARYING
)
2137 pp_printf (buffer
, "# RANGE VR_VARYING");
2138 else if (range_type
== VR_RANGE
|| range_type
== VR_ANTI_RANGE
)
2140 pp_printf (buffer
, "# RANGE ");
2141 pp_printf (buffer
, "%s[", range_type
== VR_RANGE
? "" : "~");
2142 pp_wide_int (buffer
, min
, TYPE_SIGN (TREE_TYPE (node
)));
2143 pp_printf (buffer
, ", ");
2144 pp_wide_int (buffer
, max
, TYPE_SIGN (TREE_TYPE (node
)));
2145 pp_printf (buffer
, "]");
2147 nonzero_bits
= get_nonzero_bits (node
);
2148 if (nonzero_bits
!= -1)
2150 pp_string (buffer
, " NONZERO ");
2151 pp_wide_int (buffer
, nonzero_bits
, UNSIGNED
);
2153 newline_and_indent (buffer
, spc
);
2157 /* As dump_ssaname_info, but dump to FILE. */
2160 dump_ssaname_info_to_file (FILE *file
, tree node
, int spc
)
2162 pretty_printer buffer
;
2163 pp_needs_newline (&buffer
) = true;
2164 buffer
.buffer
->stream
= file
;
2165 dump_ssaname_info (&buffer
, node
, spc
);
2169 /* Dump a PHI node PHI. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1.
2170 The caller is responsible for calling pp_flush on BUFFER to finalize
2171 pretty printer. If COMMENT is true, print this after #. */
2174 dump_gimple_phi (pretty_printer
*buffer
, gphi
*phi
, int spc
, bool comment
,
2178 tree lhs
= gimple_phi_result (phi
);
2180 if (flags
& TDF_ALIAS
)
2181 dump_ssaname_info (buffer
, lhs
, spc
);
2184 pp_string (buffer
, "# ");
2186 if (flags
& TDF_RAW
)
2187 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, ", phi
,
2188 gimple_phi_result (phi
));
2191 dump_generic_node (buffer
, lhs
, spc
, flags
, false);
2192 if (flags
& TDF_GIMPLE
)
2193 pp_string (buffer
, " = __PHI (");
2195 pp_string (buffer
, " = PHI <");
2197 for (i
= 0; i
< gimple_phi_num_args (phi
); i
++)
2199 if ((flags
& TDF_LINENO
) && gimple_phi_arg_has_location (phi
, i
))
2200 dump_location (buffer
, gimple_phi_arg_location (phi
, i
));
2201 if (flags
& TDF_GIMPLE
)
2203 basic_block src
= gimple_phi_arg_edge (phi
, i
)->src
;
2204 gimple
*stmt
= first_stmt (src
);
2205 if (!stmt
|| gimple_code (stmt
) != GIMPLE_LABEL
)
2207 pp_string (buffer
, "bb_");
2208 pp_decimal_int (buffer
, src
->index
);
2211 dump_generic_node (buffer
, gimple_label_label (as_a
<glabel
*> (stmt
)), 0, flags
,
2213 pp_string (buffer
, ": ");
2215 dump_generic_node (buffer
, gimple_phi_arg_def (phi
, i
), spc
, flags
,
2217 if (! (flags
& TDF_GIMPLE
))
2219 pp_left_paren (buffer
);
2220 pp_decimal_int (buffer
, gimple_phi_arg_edge (phi
, i
)->src
->index
);
2221 pp_right_paren (buffer
);
2223 if (i
< gimple_phi_num_args (phi
) - 1)
2224 pp_string (buffer
, ", ");
2226 if (flags
& TDF_GIMPLE
)
2227 pp_string (buffer
, ");");
2229 pp_greater (buffer
);
2233 /* Dump a GIMPLE_OMP_PARALLEL tuple on the pretty_printer BUFFER, SPC spaces
2234 of indent. FLAGS specifies details to show in the dump (see TDF_* in
2238 dump_gimple_omp_parallel (pretty_printer
*buffer
, gomp_parallel
*gs
,
2239 int spc
, dump_flags_t flags
)
2241 if (flags
& TDF_RAW
)
2243 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
2244 gimple_omp_body (gs
));
2245 dump_omp_clauses (buffer
, gimple_omp_parallel_clauses (gs
), spc
, flags
);
2246 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T%n>",
2247 gimple_omp_parallel_child_fn (gs
),
2248 gimple_omp_parallel_data_arg (gs
));
2253 pp_string (buffer
, "#pragma omp parallel");
2254 dump_omp_clauses (buffer
, gimple_omp_parallel_clauses (gs
), spc
, flags
);
2255 if (gimple_omp_parallel_child_fn (gs
))
2257 pp_string (buffer
, " [child fn: ");
2258 dump_generic_node (buffer
, gimple_omp_parallel_child_fn (gs
),
2260 pp_string (buffer
, " (");
2261 if (gimple_omp_parallel_data_arg (gs
))
2262 dump_generic_node (buffer
, gimple_omp_parallel_data_arg (gs
),
2265 pp_string (buffer
, "???");
2266 pp_string (buffer
, ")]");
2268 body
= gimple_omp_body (gs
);
2269 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
2271 newline_and_indent (buffer
, spc
+ 2);
2272 pp_left_brace (buffer
);
2273 pp_newline (buffer
);
2274 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
2275 newline_and_indent (buffer
, spc
+ 2);
2276 pp_right_brace (buffer
);
2280 pp_newline (buffer
);
2281 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
2287 /* Dump a GIMPLE_OMP_TASK tuple on the pretty_printer BUFFER, SPC spaces
2288 of indent. FLAGS specifies details to show in the dump (see TDF_* in
2292 dump_gimple_omp_task (pretty_printer
*buffer
, gomp_task
*gs
, int spc
,
2295 if (flags
& TDF_RAW
)
2297 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
2298 gimple_omp_body (gs
));
2299 dump_omp_clauses (buffer
, gimple_omp_task_clauses (gs
), spc
, flags
);
2300 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T, %T, %T, %T%n>",
2301 gimple_omp_task_child_fn (gs
),
2302 gimple_omp_task_data_arg (gs
),
2303 gimple_omp_task_copy_fn (gs
),
2304 gimple_omp_task_arg_size (gs
),
2305 gimple_omp_task_arg_size (gs
));
2310 if (gimple_omp_task_taskloop_p (gs
))
2311 pp_string (buffer
, "#pragma omp taskloop");
2313 pp_string (buffer
, "#pragma omp task");
2314 dump_omp_clauses (buffer
, gimple_omp_task_clauses (gs
), spc
, flags
);
2315 if (gimple_omp_task_child_fn (gs
))
2317 pp_string (buffer
, " [child fn: ");
2318 dump_generic_node (buffer
, gimple_omp_task_child_fn (gs
),
2320 pp_string (buffer
, " (");
2321 if (gimple_omp_task_data_arg (gs
))
2322 dump_generic_node (buffer
, gimple_omp_task_data_arg (gs
),
2325 pp_string (buffer
, "???");
2326 pp_string (buffer
, ")]");
2328 body
= gimple_omp_body (gs
);
2329 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
2331 newline_and_indent (buffer
, spc
+ 2);
2332 pp_left_brace (buffer
);
2333 pp_newline (buffer
);
2334 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
2335 newline_and_indent (buffer
, spc
+ 2);
2336 pp_right_brace (buffer
);
2340 pp_newline (buffer
);
2341 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
2347 /* Dump a GIMPLE_OMP_ATOMIC_LOAD tuple on the pretty_printer BUFFER, SPC
2348 spaces of indent. FLAGS specifies details to show in the dump (see TDF_*
2352 dump_gimple_omp_atomic_load (pretty_printer
*buffer
, gomp_atomic_load
*gs
,
2353 int spc
, dump_flags_t flags
)
2355 if (flags
& TDF_RAW
)
2357 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T>", gs
,
2358 gimple_omp_atomic_load_lhs (gs
),
2359 gimple_omp_atomic_load_rhs (gs
));
2363 pp_string (buffer
, "#pragma omp atomic_load");
2364 if (gimple_omp_atomic_seq_cst_p (gs
))
2365 pp_string (buffer
, " seq_cst");
2366 if (gimple_omp_atomic_need_value_p (gs
))
2367 pp_string (buffer
, " [needed]");
2368 newline_and_indent (buffer
, spc
+ 2);
2369 dump_generic_node (buffer
, gimple_omp_atomic_load_lhs (gs
),
2375 dump_generic_node (buffer
, gimple_omp_atomic_load_rhs (gs
),
2380 /* Dump a GIMPLE_OMP_ATOMIC_STORE tuple on the pretty_printer BUFFER, SPC
2381 spaces of indent. FLAGS specifies details to show in the dump (see TDF_*
2385 dump_gimple_omp_atomic_store (pretty_printer
*buffer
,
2386 gomp_atomic_store
*gs
, int spc
,
2389 if (flags
& TDF_RAW
)
2391 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
,
2392 gimple_omp_atomic_store_val (gs
));
2396 pp_string (buffer
, "#pragma omp atomic_store ");
2397 if (gimple_omp_atomic_seq_cst_p (gs
))
2398 pp_string (buffer
, "seq_cst ");
2399 if (gimple_omp_atomic_need_value_p (gs
))
2400 pp_string (buffer
, "[needed] ");
2401 pp_left_paren (buffer
);
2402 dump_generic_node (buffer
, gimple_omp_atomic_store_val (gs
),
2404 pp_right_paren (buffer
);
2409 /* Dump all the memory operands for statement GS. BUFFER, SPC and
2410 FLAGS are as in pp_gimple_stmt_1. */
2413 dump_gimple_mem_ops (pretty_printer
*buffer
, gimple
*gs
, int spc
,
2416 tree vdef
= gimple_vdef (gs
);
2417 tree vuse
= gimple_vuse (gs
);
2419 if (vdef
!= NULL_TREE
)
2421 pp_string (buffer
, "# ");
2422 dump_generic_node (buffer
, vdef
, spc
+ 2, flags
, false);
2423 pp_string (buffer
, " = VDEF <");
2424 dump_generic_node (buffer
, vuse
, spc
+ 2, flags
, false);
2425 pp_greater (buffer
);
2426 newline_and_indent (buffer
, spc
);
2428 else if (vuse
!= NULL_TREE
)
2430 pp_string (buffer
, "# VUSE <");
2431 dump_generic_node (buffer
, vuse
, spc
+ 2, flags
, false);
2432 pp_greater (buffer
);
2433 newline_and_indent (buffer
, spc
);
2438 /* Print the gimple statement GS on the pretty printer BUFFER, SPC
2439 spaces of indent. FLAGS specifies details to show in the dump (see
2440 TDF_* in dumpfile.h). The caller is responsible for calling
2441 pp_flush on BUFFER to finalize the pretty printer. */
2444 pp_gimple_stmt_1 (pretty_printer
*buffer
, gimple
*gs
, int spc
,
2450 if (flags
& TDF_STMTADDR
)
2451 pp_printf (buffer
, "<&%p> ", (void *) gs
);
2453 if ((flags
& TDF_LINENO
) && gimple_has_location (gs
))
2454 dump_location (buffer
, gimple_location (gs
));
2458 int lp_nr
= lookup_stmt_eh_lp (gs
);
2460 pp_printf (buffer
, "[LP %d] ", lp_nr
);
2462 pp_printf (buffer
, "[MNT %d] ", -lp_nr
);
2465 if ((flags
& (TDF_VOPS
|TDF_MEMSYMS
))
2466 && gimple_has_mem_ops (gs
))
2467 dump_gimple_mem_ops (buffer
, gs
, spc
, flags
);
2469 if (gimple_has_lhs (gs
)
2470 && (flags
& TDF_ALIAS
))
2471 dump_ssaname_info (buffer
, gimple_get_lhs (gs
), spc
);
2473 switch (gimple_code (gs
))
2476 dump_gimple_asm (buffer
, as_a
<gasm
*> (gs
), spc
, flags
);
2480 dump_gimple_assign (buffer
, as_a
<gassign
*> (gs
), spc
, flags
);
2484 dump_gimple_bind (buffer
, as_a
<gbind
*> (gs
), spc
, flags
);
2488 dump_gimple_call (buffer
, as_a
<gcall
*> (gs
), spc
, flags
);
2492 dump_gimple_cond (buffer
, as_a
<gcond
*> (gs
), spc
, flags
);
2496 dump_gimple_label (buffer
, as_a
<glabel
*> (gs
), spc
, flags
);
2500 dump_gimple_goto (buffer
, as_a
<ggoto
*> (gs
), spc
, flags
);
2504 pp_string (buffer
, "GIMPLE_NOP");
2508 dump_gimple_return (buffer
, as_a
<greturn
*> (gs
), spc
, flags
);
2512 dump_gimple_switch (buffer
, as_a
<gswitch
*> (gs
), spc
, flags
);
2516 dump_gimple_try (buffer
, as_a
<gtry
*> (gs
), spc
, flags
);
2520 dump_gimple_phi (buffer
, as_a
<gphi
*> (gs
), spc
, false, flags
);
2523 case GIMPLE_OMP_PARALLEL
:
2524 dump_gimple_omp_parallel (buffer
, as_a
<gomp_parallel
*> (gs
), spc
,
2528 case GIMPLE_OMP_TASK
:
2529 dump_gimple_omp_task (buffer
, as_a
<gomp_task
*> (gs
), spc
, flags
);
2532 case GIMPLE_OMP_ATOMIC_LOAD
:
2533 dump_gimple_omp_atomic_load (buffer
, as_a
<gomp_atomic_load
*> (gs
),
2537 case GIMPLE_OMP_ATOMIC_STORE
:
2538 dump_gimple_omp_atomic_store (buffer
,
2539 as_a
<gomp_atomic_store
*> (gs
),
2543 case GIMPLE_OMP_FOR
:
2544 dump_gimple_omp_for (buffer
, as_a
<gomp_for
*> (gs
), spc
, flags
);
2547 case GIMPLE_OMP_CONTINUE
:
2548 dump_gimple_omp_continue (buffer
, as_a
<gomp_continue
*> (gs
), spc
,
2552 case GIMPLE_OMP_SINGLE
:
2553 dump_gimple_omp_single (buffer
, as_a
<gomp_single
*> (gs
), spc
,
2557 case GIMPLE_OMP_TARGET
:
2558 dump_gimple_omp_target (buffer
, as_a
<gomp_target
*> (gs
), spc
,
2562 case GIMPLE_OMP_TEAMS
:
2563 dump_gimple_omp_teams (buffer
, as_a
<gomp_teams
*> (gs
), spc
,
2567 case GIMPLE_OMP_RETURN
:
2568 dump_gimple_omp_return (buffer
, gs
, spc
, flags
);
2571 case GIMPLE_OMP_SECTIONS
:
2572 dump_gimple_omp_sections (buffer
, as_a
<gomp_sections
*> (gs
),
2576 case GIMPLE_OMP_SECTIONS_SWITCH
:
2577 pp_string (buffer
, "GIMPLE_SECTIONS_SWITCH");
2580 case GIMPLE_OMP_MASTER
:
2581 case GIMPLE_OMP_TASKGROUP
:
2582 case GIMPLE_OMP_SECTION
:
2583 case GIMPLE_OMP_GRID_BODY
:
2584 dump_gimple_omp_block (buffer
, gs
, spc
, flags
);
2587 case GIMPLE_OMP_ORDERED
:
2588 dump_gimple_omp_ordered (buffer
, as_a
<gomp_ordered
*> (gs
), spc
,
2592 case GIMPLE_OMP_CRITICAL
:
2593 dump_gimple_omp_critical (buffer
, as_a
<gomp_critical
*> (gs
), spc
,
2598 dump_gimple_catch (buffer
, as_a
<gcatch
*> (gs
), spc
, flags
);
2601 case GIMPLE_EH_FILTER
:
2602 dump_gimple_eh_filter (buffer
, as_a
<geh_filter
*> (gs
), spc
, flags
);
2605 case GIMPLE_EH_MUST_NOT_THROW
:
2606 dump_gimple_eh_must_not_throw (buffer
,
2607 as_a
<geh_mnt
*> (gs
),
2611 case GIMPLE_EH_ELSE
:
2612 dump_gimple_eh_else (buffer
, as_a
<geh_else
*> (gs
), spc
, flags
);
2616 dump_gimple_resx (buffer
, as_a
<gresx
*> (gs
), spc
, flags
);
2619 case GIMPLE_EH_DISPATCH
:
2620 dump_gimple_eh_dispatch (buffer
, as_a
<geh_dispatch
*> (gs
), spc
,
2625 dump_gimple_debug (buffer
, as_a
<gdebug
*> (gs
), spc
, flags
);
2628 case GIMPLE_PREDICT
:
2629 pp_string (buffer
, "// predicted ");
2630 if (gimple_predict_outcome (gs
))
2631 pp_string (buffer
, "likely by ");
2633 pp_string (buffer
, "unlikely by ");
2634 pp_string (buffer
, predictor_name (gimple_predict_predictor (gs
)));
2635 pp_string (buffer
, " predictor.");
2638 case GIMPLE_TRANSACTION
:
2639 dump_gimple_transaction (buffer
, as_a
<gtransaction
*> (gs
), spc
,
2649 /* Dumps header of basic block BB to OUTF indented by INDENT
2650 spaces and details described by flags. */
2653 dump_gimple_bb_header (FILE *outf
, basic_block bb
, int indent
,
2656 if (flags
& TDF_BLOCKS
)
2658 if (flags
& TDF_LINENO
)
2660 gimple_stmt_iterator gsi
;
2662 fputs (";; ", outf
);
2664 for (gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
); gsi_next (&gsi
))
2665 if (!is_gimple_debug (gsi_stmt (gsi
))
2666 && get_lineno (gsi_stmt (gsi
)) != UNKNOWN_LOCATION
)
2668 fprintf (outf
, "%*sstarting at line %d",
2669 indent
, "", get_lineno (gsi_stmt (gsi
)));
2672 if (bb
->discriminator
)
2673 fprintf (outf
, ", discriminator %i", bb
->discriminator
);
2679 if (flags
& TDF_GIMPLE
)
2680 fprintf (outf
, "%*sbb_%d:\n", indent
, "", bb
->index
);
2682 fprintf (outf
, "%*s<bb %d> %s:\n",
2683 indent
, "", bb
->index
, dump_profile (bb
->count
));
2688 /* Dumps end of basic block BB to buffer BUFFER indented by INDENT
2692 dump_gimple_bb_footer (FILE *outf ATTRIBUTE_UNUSED
,
2693 basic_block bb ATTRIBUTE_UNUSED
,
2694 int indent ATTRIBUTE_UNUSED
,
2695 dump_flags_t flags ATTRIBUTE_UNUSED
)
2697 /* There is currently no GIMPLE-specific basic block info to dump. */
2702 /* Dump PHI nodes of basic block BB to BUFFER with details described
2703 by FLAGS and indented by INDENT spaces. */
2706 dump_phi_nodes (pretty_printer
*buffer
, basic_block bb
, int indent
,
2711 for (i
= gsi_start_phis (bb
); !gsi_end_p (i
); gsi_next (&i
))
2713 gphi
*phi
= i
.phi ();
2714 if (!virtual_operand_p (gimple_phi_result (phi
)) || (flags
& TDF_VOPS
))
2717 dump_gimple_phi (buffer
, phi
, indent
,
2718 (flags
& TDF_GIMPLE
) ? false : true, flags
);
2719 pp_newline (buffer
);
2725 /* Dump jump to basic block BB that is represented implicitly in the cfg
2729 pp_cfg_jump (pretty_printer
*buffer
, edge e
, dump_flags_t flags
)
2731 if (flags
& TDF_GIMPLE
)
2733 pp_string (buffer
, "goto bb_");
2734 pp_decimal_int (buffer
, e
->dest
->index
);
2735 pp_semicolon (buffer
);
2739 pp_string (buffer
, "goto <bb ");
2740 pp_decimal_int (buffer
, e
->dest
->index
);
2741 pp_greater (buffer
);
2742 pp_semicolon (buffer
);
2744 dump_edge_probability (buffer
, e
);
2749 /* Dump edges represented implicitly in basic block BB to BUFFER, indented
2750 by INDENT spaces, with details given by FLAGS. */
2753 dump_implicit_edges (pretty_printer
*buffer
, basic_block bb
, int indent
,
2759 stmt
= last_stmt (bb
);
2761 if (stmt
&& gimple_code (stmt
) == GIMPLE_COND
)
2763 edge true_edge
, false_edge
;
2765 /* When we are emitting the code or changing CFG, it is possible that
2766 the edges are not yet created. When we are using debug_bb in such
2767 a situation, we do not want it to crash. */
2768 if (EDGE_COUNT (bb
->succs
) != 2)
2770 extract_true_false_edges_from_block (bb
, &true_edge
, &false_edge
);
2772 INDENT (indent
+ 2);
2773 pp_cfg_jump (buffer
, true_edge
, flags
);
2774 newline_and_indent (buffer
, indent
);
2775 pp_string (buffer
, "else");
2776 newline_and_indent (buffer
, indent
+ 2);
2777 pp_cfg_jump (buffer
, false_edge
, flags
);
2778 pp_newline (buffer
);
2782 /* If there is a fallthru edge, we may need to add an artificial
2783 goto to the dump. */
2784 e
= find_fallthru_edge (bb
->succs
);
2786 if (e
&& e
->dest
!= bb
->next_bb
)
2790 if ((flags
& TDF_LINENO
)
2791 && e
->goto_locus
!= UNKNOWN_LOCATION
)
2792 dump_location (buffer
, e
->goto_locus
);
2794 pp_cfg_jump (buffer
, e
, flags
);
2795 pp_newline (buffer
);
2800 /* Dumps basic block BB to buffer BUFFER with details described by FLAGS and
2801 indented by INDENT spaces. */
2804 gimple_dump_bb_buff (pretty_printer
*buffer
, basic_block bb
, int indent
,
2807 gimple_stmt_iterator gsi
;
2809 int label_indent
= indent
- 2;
2811 if (label_indent
< 0)
2814 dump_phi_nodes (buffer
, bb
, indent
, flags
);
2816 for (gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
); gsi_next (&gsi
))
2820 stmt
= gsi_stmt (gsi
);
2822 curr_indent
= gimple_code (stmt
) == GIMPLE_LABEL
? label_indent
: indent
;
2824 INDENT (curr_indent
);
2825 pp_gimple_stmt_1 (buffer
, stmt
, curr_indent
, flags
);
2826 pp_newline_and_flush (buffer
);
2827 gcc_checking_assert (DECL_STRUCT_FUNCTION (current_function_decl
));
2828 dump_histograms_for_stmt (DECL_STRUCT_FUNCTION (current_function_decl
),
2829 pp_buffer (buffer
)->stream
, stmt
);
2832 dump_implicit_edges (buffer
, bb
, indent
, flags
);
2837 /* Dumps basic block BB to FILE with details described by FLAGS and
2838 indented by INDENT spaces. */
2841 gimple_dump_bb (FILE *file
, basic_block bb
, int indent
, dump_flags_t flags
)
2843 dump_gimple_bb_header (file
, bb
, indent
, flags
);
2844 if (bb
->index
>= NUM_FIXED_BLOCKS
)
2846 pretty_printer buffer
;
2847 pp_needs_newline (&buffer
) = true;
2848 buffer
.buffer
->stream
= file
;
2849 gimple_dump_bb_buff (&buffer
, bb
, indent
, flags
);
2851 dump_gimple_bb_footer (file
, bb
, indent
, flags
);
2854 /* Dumps basic block BB to pretty-printer PP with default dump flags and
2855 no indentation, for use as a label of a DOT graph record-node.
2856 ??? Should just use gimple_dump_bb_buff here, except that value profiling
2857 histogram dumping doesn't know about pretty-printers. */
2860 gimple_dump_bb_for_graph (pretty_printer
*pp
, basic_block bb
)
2862 pp_printf (pp
, "<bb %d>:\n", bb
->index
);
2863 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
2865 for (gphi_iterator gsi
= gsi_start_phis (bb
); !gsi_end_p (gsi
);
2868 gphi
*phi
= gsi
.phi ();
2869 if (!virtual_operand_p (gimple_phi_result (phi
))
2870 || (dump_flags
& TDF_VOPS
))
2873 pp_write_text_to_stream (pp
);
2874 pp_string (pp
, "# ");
2875 pp_gimple_stmt_1 (pp
, phi
, 0, dump_flags
);
2877 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
2881 for (gimple_stmt_iterator gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
);
2884 gimple
*stmt
= gsi_stmt (gsi
);
2886 pp_write_text_to_stream (pp
);
2887 pp_gimple_stmt_1 (pp
, stmt
, 0, dump_flags
);
2889 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
2891 dump_implicit_edges (pp
, bb
, 0, dump_flags
);
2892 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
2896 /* Handle the %G format for TEXT. Same as %K in handle_K_format in
2897 tree-pretty-print.c but with a Gimple call statement as an argument. */
2900 percent_G_format (text_info
*text
)
2902 gcall
*stmt
= va_arg (*text
->args_ptr
, gcall
*);
2904 /* Build a call expression from the Gimple call statement and
2905 pass it to the K formatter that knows how to format it. */
2906 tree exp
= build_vl_exp (CALL_EXPR
, gimple_call_num_args (stmt
) + 3);
2907 CALL_EXPR_FN (exp
) = gimple_call_fn (stmt
);
2908 TREE_TYPE (exp
) = gimple_call_return_type (stmt
);
2909 CALL_EXPR_STATIC_CHAIN (exp
) = gimple_call_chain (stmt
);
2910 SET_EXPR_LOCATION (exp
, gimple_location (stmt
));
2912 percent_K_format (text
, exp
);