1 /* Pretty formatting of GIMPLE statements and expressions.
2 Copyright (C) 2001-2023 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 "value-range-pretty-print.h"
34 #include "internal-fn.h"
36 #include "gimple-iterator.h"
38 #include "dumpfile.h" /* for dump_flags */
39 #include "value-prof.h"
40 #include "trans-mem.h"
42 #include "stringpool.h"
46 #include "gimple-range.h"
48 /* Disable warnings about quoting issues in the pp_xxx calls below
49 that (intentionally) don't follow GCC diagnostic conventions. */
51 # pragma GCC diagnostic push
52 # pragma GCC diagnostic ignored "-Wformat-diag"
55 #define INDENT(SPACE) \
56 do { int i; for (i = 0; i < SPACE; i++) pp_space (buffer); } while (0)
58 #define GIMPLE_NIY do_niy (buffer,gs)
60 /* Try to print on BUFFER a default message for the unrecognized
61 gimple statement GS. */
64 do_niy (pretty_printer
*buffer
, const gimple
*gs
)
66 pp_printf (buffer
, "<<< Unknown GIMPLE statement: %s >>>\n",
67 gimple_code_name
[(int) gimple_code (gs
)]);
71 /* Emit a newline and SPC indentation spaces to BUFFER. */
74 newline_and_indent (pretty_printer
*buffer
, int spc
)
81 /* Print the GIMPLE statement GS on stderr. */
84 debug_gimple_stmt (gimple
*gs
)
86 print_gimple_stmt (stderr
, gs
, 0, TDF_VOPS
|TDF_MEMSYMS
);
90 /* Return formatted string of a VALUE probability
91 (biased by REG_BR_PROB_BASE). Returned string is allocated
92 by xstrdup_for_dump. */
95 dump_profile (profile_count
&count
)
98 if (!count
.initialized_p ())
101 buf
= xasprintf ("[count: %" PRId64
"]",
102 count
.to_gcov_type ());
103 else if (count
.initialized_p ())
104 buf
= xasprintf ("[local count: %" PRId64
"]",
105 count
.to_gcov_type ());
107 const char *ret
= xstrdup_for_dump (buf
);
113 /* Return formatted string of a VALUE probability
114 (biased by REG_BR_PROB_BASE). Returned string is allocated
115 by xstrdup_for_dump. */
118 dump_probability (profile_probability probability
)
120 float minimum
= 0.01f
;
123 if (probability
.initialized_p ())
125 fvalue
= probability
.to_reg_br_prob_base () * 100.0f
/ REG_BR_PROB_BASE
;
126 if (fvalue
< minimum
&& probability
.to_reg_br_prob_base ())
131 if (probability
.initialized_p ())
132 buf
= xasprintf ("[%.2f%%]", fvalue
);
134 buf
= xasprintf ("[INV]");
136 const char *ret
= xstrdup_for_dump (buf
);
142 /* Dump E probability to BUFFER. */
145 dump_edge_probability (pretty_printer
*buffer
, edge e
)
147 pp_scalar (buffer
, " %s", dump_probability (e
->probability
));
150 /* Print GIMPLE statement G to FILE using SPC indentation spaces and
151 FLAGS as in pp_gimple_stmt_1. */
154 print_gimple_stmt (FILE *file
, gimple
*g
, int spc
, dump_flags_t flags
)
156 pretty_printer buffer
;
157 pp_needs_newline (&buffer
) = true;
158 buffer
.buffer
->stream
= file
;
159 pp_gimple_stmt_1 (&buffer
, g
, spc
, flags
);
160 pp_newline_and_flush (&buffer
);
166 print_gimple_stmt (stderr
, &ref
, 0, TDF_NONE
);
175 fprintf (stderr
, "<nil>\n");
179 /* Print GIMPLE statement G to FILE using SPC indentation spaces and
180 FLAGS as in pp_gimple_stmt_1. Print only the right-hand side
184 print_gimple_expr (FILE *file
, gimple
*g
, int spc
, dump_flags_t flags
)
186 flags
|= TDF_RHS_ONLY
;
187 pretty_printer buffer
;
188 pp_needs_newline (&buffer
) = true;
189 buffer
.buffer
->stream
= file
;
190 pp_gimple_stmt_1 (&buffer
, g
, spc
, flags
);
195 /* Print the GIMPLE sequence SEQ on BUFFER using SPC indentation
196 spaces and FLAGS as in pp_gimple_stmt_1.
197 The caller is responsible for calling pp_flush on BUFFER to finalize
198 the pretty printer. */
201 dump_gimple_seq (pretty_printer
*buffer
, gimple_seq seq
, int spc
,
204 gimple_stmt_iterator i
;
206 for (i
= gsi_start (seq
); !gsi_end_p (i
); gsi_next (&i
))
208 gimple
*gs
= gsi_stmt (i
);
210 pp_gimple_stmt_1 (buffer
, gs
, spc
, flags
);
211 if (!gsi_one_before_end_p (i
))
217 /* Print GIMPLE sequence SEQ to FILE using SPC indentation spaces and
218 FLAGS as in pp_gimple_stmt_1. */
221 print_gimple_seq (FILE *file
, gimple_seq seq
, int spc
, dump_flags_t flags
)
223 pretty_printer buffer
;
224 pp_needs_newline (&buffer
) = true;
225 buffer
.buffer
->stream
= file
;
226 dump_gimple_seq (&buffer
, seq
, spc
, flags
);
227 pp_newline_and_flush (&buffer
);
231 /* Print the GIMPLE sequence SEQ on stderr. */
234 debug_gimple_seq (gimple_seq seq
)
236 print_gimple_seq (stderr
, seq
, 0, TDF_VOPS
|TDF_MEMSYMS
);
240 /* A simple helper to pretty-print some of the gimple tuples in the printf
241 style. The format modifiers are preceded by '%' and are:
242 'G' - outputs a string corresponding to the code of the given gimple,
243 'S' - outputs a gimple_seq with indent of spc + 2,
244 'T' - outputs the tree t,
245 'd' - outputs an int as a decimal,
246 's' - outputs a string,
247 'n' - outputs a newline,
248 'x' - outputs an int as hexadecimal,
249 '+' - increases indent by 2 then outputs a newline,
250 '-' - decreases indent by 2 then outputs a newline. */
253 dump_gimple_fmt (pretty_printer
*buffer
, int spc
, dump_flags_t flags
,
254 const char *fmt
, ...)
260 va_start (args
, fmt
);
261 for (c
= fmt
; *c
; c
++)
271 g
= va_arg (args
, gimple
*);
272 tmp
= gimple_code_name
[gimple_code (g
)];
273 pp_string (buffer
, tmp
);
277 seq
= va_arg (args
, gimple_seq
);
279 dump_gimple_seq (buffer
, seq
, spc
+ 2, flags
);
280 newline_and_indent (buffer
, spc
);
284 t
= va_arg (args
, tree
);
286 pp_string (buffer
, "NULL");
288 dump_generic_node (buffer
, t
, spc
, flags
, false);
292 pp_decimal_int (buffer
, va_arg (args
, int));
296 pp_string (buffer
, va_arg (args
, char *));
300 newline_and_indent (buffer
, spc
);
304 pp_scalar (buffer
, "%x", va_arg (args
, int));
309 newline_and_indent (buffer
, spc
);
314 newline_and_indent (buffer
, spc
);
322 pp_character (buffer
, *c
);
328 /* Helper for dump_gimple_assign. Print the unary RHS of the
329 assignment GS. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. */
332 dump_unary_rhs (pretty_printer
*buffer
, const gassign
*gs
, int spc
,
335 enum tree_code rhs_code
= gimple_assign_rhs_code (gs
);
336 tree lhs
= gimple_assign_lhs (gs
);
337 tree rhs
= gimple_assign_rhs1 (gs
);
341 case VIEW_CONVERT_EXPR
:
342 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
345 case FIXED_CONVERT_EXPR
:
346 case ADDR_SPACE_CONVERT_EXPR
:
350 pp_left_paren (buffer
);
351 dump_generic_node (buffer
, TREE_TYPE (lhs
), spc
, flags
, false);
352 pp_string (buffer
, ") ");
353 if (op_prio (rhs
) < op_code_prio (rhs_code
))
355 pp_left_paren (buffer
);
356 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
357 pp_right_paren (buffer
);
360 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
364 pp_string (buffer
, "((");
365 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
366 pp_string (buffer
, "))");
371 if (flags
& TDF_GIMPLE
)
374 rhs_code
== ABS_EXPR
? "__ABS " : "__ABSU ");
375 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
380 rhs_code
== ABS_EXPR
? "ABS_EXPR <" : "ABSU_EXPR <");
381 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
387 if (TREE_CODE_CLASS (rhs_code
) == tcc_declaration
388 || TREE_CODE_CLASS (rhs_code
) == tcc_constant
389 || TREE_CODE_CLASS (rhs_code
) == tcc_reference
390 || rhs_code
== SSA_NAME
391 || rhs_code
== ADDR_EXPR
392 || rhs_code
== CONSTRUCTOR
)
394 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
397 else if (rhs_code
== BIT_NOT_EXPR
)
398 pp_complement (buffer
);
399 else if (rhs_code
== TRUTH_NOT_EXPR
)
400 pp_exclamation (buffer
);
401 else if (rhs_code
== NEGATE_EXPR
)
405 pp_left_bracket (buffer
);
406 pp_string (buffer
, get_tree_code_name (rhs_code
));
407 pp_string (buffer
, "] ");
410 if (op_prio (rhs
) < op_code_prio (rhs_code
))
412 pp_left_paren (buffer
);
413 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
414 pp_right_paren (buffer
);
417 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
423 /* Helper for dump_gimple_assign. Print the binary RHS of the
424 assignment GS. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. */
427 dump_binary_rhs (pretty_printer
*buffer
, const gassign
*gs
, int spc
,
431 enum tree_code code
= gimple_assign_rhs_code (gs
);
436 if (flags
& TDF_GIMPLE
)
438 pp_string (buffer
, code
== MIN_EXPR
? "__MIN (" : "__MAX (");
439 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
,
441 pp_string (buffer
, ", ");
442 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
,
444 pp_string (buffer
, ")");
452 case VEC_WIDEN_MULT_HI_EXPR
:
453 case VEC_WIDEN_MULT_LO_EXPR
:
454 case VEC_WIDEN_MULT_EVEN_EXPR
:
455 case VEC_WIDEN_MULT_ODD_EXPR
:
456 case VEC_PACK_TRUNC_EXPR
:
457 case VEC_PACK_SAT_EXPR
:
458 case VEC_PACK_FIX_TRUNC_EXPR
:
459 case VEC_PACK_FLOAT_EXPR
:
460 case VEC_WIDEN_LSHIFT_HI_EXPR
:
461 case VEC_WIDEN_LSHIFT_LO_EXPR
:
462 case VEC_WIDEN_PLUS_HI_EXPR
:
463 case VEC_WIDEN_PLUS_LO_EXPR
:
464 case VEC_WIDEN_MINUS_HI_EXPR
:
465 case VEC_WIDEN_MINUS_LO_EXPR
:
466 case VEC_SERIES_EXPR
:
467 for (p
= get_tree_code_name (code
); *p
; p
++)
468 pp_character (buffer
, TOUPPER (*p
));
469 pp_string (buffer
, " <");
470 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
471 pp_string (buffer
, ", ");
472 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
477 if (op_prio (gimple_assign_rhs1 (gs
)) <= op_code_prio (code
))
479 pp_left_paren (buffer
);
480 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
,
482 pp_right_paren (buffer
);
485 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
487 pp_string (buffer
, op_symbol_code (gimple_assign_rhs_code (gs
)));
489 if (op_prio (gimple_assign_rhs2 (gs
)) <= op_code_prio (code
))
491 pp_left_paren (buffer
);
492 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
,
494 pp_right_paren (buffer
);
497 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
501 /* Helper for dump_gimple_assign. Print the ternary RHS of the
502 assignment GS. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. */
505 dump_ternary_rhs (pretty_printer
*buffer
, const gassign
*gs
, int spc
,
509 enum tree_code code
= gimple_assign_rhs_code (gs
);
512 case WIDEN_MULT_PLUS_EXPR
:
513 case WIDEN_MULT_MINUS_EXPR
:
514 for (p
= get_tree_code_name (code
); *p
; p
++)
515 pp_character (buffer
, TOUPPER (*p
));
516 pp_string (buffer
, " <");
517 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
518 pp_string (buffer
, ", ");
519 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
520 pp_string (buffer
, ", ");
521 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
526 pp_string (buffer
, "DOT_PROD_EXPR <");
527 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
528 pp_string (buffer
, ", ");
529 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
530 pp_string (buffer
, ", ");
531 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
536 pp_string (buffer
, "SAD_EXPR <");
537 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
538 pp_string (buffer
, ", ");
539 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
540 pp_string (buffer
, ", ");
541 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
546 if (flags
& TDF_GIMPLE
)
547 pp_string (buffer
, "__VEC_PERM (");
549 pp_string (buffer
, "VEC_PERM_EXPR <");
550 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
551 pp_string (buffer
, ", ");
552 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
553 pp_string (buffer
, ", ");
554 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
555 if (flags
& TDF_GIMPLE
)
556 pp_right_paren (buffer
);
561 case REALIGN_LOAD_EXPR
:
562 pp_string (buffer
, "REALIGN_LOAD <");
563 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
564 pp_string (buffer
, ", ");
565 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
566 pp_string (buffer
, ", ");
567 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
572 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
573 pp_string (buffer
, " ? ");
574 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
575 pp_string (buffer
, " : ");
576 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
580 pp_string (buffer
, "VEC_COND_EXPR <");
581 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
582 pp_string (buffer
, ", ");
583 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
584 pp_string (buffer
, ", ");
585 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
589 case BIT_INSERT_EXPR
:
590 if (flags
& TDF_GIMPLE
)
592 pp_string (buffer
, "__BIT_INSERT (");
593 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
,
594 flags
| TDF_SLIM
, false);
595 pp_string (buffer
, ", ");
596 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
,
597 flags
| TDF_SLIM
, false);
598 pp_string (buffer
, ", ");
599 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
,
600 flags
| TDF_SLIM
, false);
601 pp_right_paren (buffer
);
605 pp_string (buffer
, "BIT_INSERT_EXPR <");
606 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
),
608 pp_string (buffer
, ", ");
609 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
),
611 pp_string (buffer
, ", ");
612 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
),
614 if (INTEGRAL_TYPE_P (TREE_TYPE (gimple_assign_rhs2 (gs
))))
616 pp_string (buffer
, " (");
617 pp_decimal_int (buffer
, TYPE_PRECISION
618 (TREE_TYPE (gimple_assign_rhs2 (gs
))));
619 pp_string (buffer
, " bits)");
631 /* Dump the gimple assignment GS. BUFFER, SPC and FLAGS are as in
635 dump_gimple_assign (pretty_printer
*buffer
, const gassign
*gs
, int spc
,
643 switch (gimple_num_ops (gs
))
646 arg3
= gimple_assign_rhs3 (gs
);
649 arg2
= gimple_assign_rhs2 (gs
);
652 arg1
= gimple_assign_rhs1 (gs
);
658 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%s, %T, %T, %T, %T>", gs
,
659 get_tree_code_name (gimple_assign_rhs_code (gs
)),
660 gimple_assign_lhs (gs
), arg1
, arg2
, arg3
);
664 if (!(flags
& TDF_RHS_ONLY
))
666 dump_generic_node (buffer
, gimple_assign_lhs (gs
), spc
, flags
, false);
670 if (gimple_assign_nontemporal_move_p (gs
))
671 pp_string (buffer
, "{nt}");
673 if (gimple_has_volatile_ops (gs
))
674 pp_string (buffer
, "{v}");
679 if (gimple_num_ops (gs
) == 2)
680 dump_unary_rhs (buffer
, gs
, spc
,
681 ((flags
& TDF_GIMPLE
)
682 && gimple_assign_rhs_class (gs
) != GIMPLE_SINGLE_RHS
)
683 ? (flags
| TDF_GIMPLE_VAL
) : flags
);
684 else if (gimple_num_ops (gs
) == 3)
685 dump_binary_rhs (buffer
, gs
, spc
,
687 ? (flags
| TDF_GIMPLE_VAL
) : flags
);
688 else if (gimple_num_ops (gs
) == 4)
689 dump_ternary_rhs (buffer
, gs
, spc
,
691 ? (flags
| TDF_GIMPLE_VAL
) : flags
);
694 if (!(flags
& TDF_RHS_ONLY
))
695 pp_semicolon (buffer
);
700 /* Dump the return statement GS. BUFFER, SPC and FLAGS are as in
704 dump_gimple_return (pretty_printer
*buffer
, const greturn
*gs
, int spc
,
709 t
= gimple_return_retval (gs
);
711 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
, t
);
714 pp_string (buffer
, "return");
718 dump_generic_node (buffer
, t
, spc
, flags
, false);
720 pp_semicolon (buffer
);
725 /* Dump the call arguments for a gimple call. BUFFER, FLAGS are as in
729 dump_gimple_call_args (pretty_printer
*buffer
, const gcall
*gs
,
734 /* Pretty print first arg to certain internal fns. */
735 if (gimple_call_internal_p (gs
))
737 const char *const *enums
= NULL
;
740 switch (gimple_call_internal_fn (gs
))
744 static const char *const unique_args
[] = {IFN_UNIQUE_CODES
};
748 limit
= ARRAY_SIZE (unique_args
);
753 static const char *const loop_args
[] = {IFN_GOACC_LOOP_CODES
};
756 limit
= ARRAY_SIZE (loop_args
);
759 case IFN_GOACC_REDUCTION
:
761 static const char *const reduction_args
[]
762 = {IFN_GOACC_REDUCTION_CODES
};
764 enums
= reduction_args
;
765 limit
= ARRAY_SIZE (reduction_args
);
768 case IFN_HWASAN_MARK
:
771 static const char *const asan_mark_args
[] = {IFN_ASAN_MARK_FLAGS
};
773 enums
= asan_mark_args
;
774 limit
= ARRAY_SIZE (asan_mark_args
);
782 tree arg0
= gimple_call_arg (gs
, 0);
785 if (TREE_CODE (arg0
) == INTEGER_CST
786 && tree_fits_shwi_p (arg0
)
787 && (v
= tree_to_shwi (arg0
)) >= 0 && v
< limit
)
790 pp_string (buffer
, enums
[v
]);
795 for (; i
< gimple_call_num_args (gs
); i
++)
798 pp_string (buffer
, ", ");
799 dump_generic_node (buffer
, gimple_call_arg (gs
, i
), 0, flags
, false);
802 if (gimple_call_va_arg_pack_p (gs
))
805 pp_string (buffer
, ", ");
807 pp_string (buffer
, "__builtin_va_arg_pack ()");
811 /* Dump the points-to solution *PT to BUFFER. */
814 pp_points_to_solution (pretty_printer
*buffer
, const pt_solution
*pt
)
818 pp_string (buffer
, "anything ");
822 pp_string (buffer
, "nonlocal ");
824 pp_string (buffer
, "escaped ");
826 pp_string (buffer
, "unit-escaped ");
828 pp_string (buffer
, "null ");
830 && !bitmap_empty_p (pt
->vars
))
834 pp_string (buffer
, "{ ");
835 EXECUTE_IF_SET_IN_BITMAP (pt
->vars
, 0, i
, bi
)
837 pp_string (buffer
, "D.");
838 pp_decimal_int (buffer
, i
);
841 pp_right_brace (buffer
);
842 if (pt
->vars_contains_nonlocal
843 || pt
->vars_contains_escaped
844 || pt
->vars_contains_escaped_heap
845 || pt
->vars_contains_restrict
)
847 const char *comma
= "";
848 pp_string (buffer
, " (");
849 if (pt
->vars_contains_nonlocal
)
851 pp_string (buffer
, "nonlocal");
854 if (pt
->vars_contains_escaped
)
856 pp_string (buffer
, comma
);
857 pp_string (buffer
, "escaped");
860 if (pt
->vars_contains_escaped_heap
)
862 pp_string (buffer
, comma
);
863 pp_string (buffer
, "escaped heap");
866 if (pt
->vars_contains_restrict
)
868 pp_string (buffer
, comma
);
869 pp_string (buffer
, "restrict");
872 if (pt
->vars_contains_interposable
)
874 pp_string (buffer
, comma
);
875 pp_string (buffer
, "interposable");
877 pp_string (buffer
, ")");
883 /* Dump the call statement GS. BUFFER, SPC and FLAGS are as in
887 dump_gimple_call (pretty_printer
*buffer
, const gcall
*gs
, int spc
,
890 tree lhs
= gimple_call_lhs (gs
);
891 tree fn
= gimple_call_fn (gs
);
893 if (flags
& TDF_ALIAS
)
895 const pt_solution
*pt
;
896 pt
= gimple_call_use_set (gs
);
897 if (!pt_solution_empty_p (pt
))
899 pp_string (buffer
, "# USE = ");
900 pp_points_to_solution (buffer
, pt
);
901 newline_and_indent (buffer
, spc
);
903 pt
= gimple_call_clobber_set (gs
);
904 if (!pt_solution_empty_p (pt
))
906 pp_string (buffer
, "# CLB = ");
907 pp_points_to_solution (buffer
, pt
);
908 newline_and_indent (buffer
, spc
);
914 if (gimple_call_internal_p (gs
))
915 dump_gimple_fmt (buffer
, spc
, flags
, "%G <.%s, %T", gs
,
916 internal_fn_name (gimple_call_internal_fn (gs
)), lhs
);
918 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T", gs
, fn
, lhs
);
919 if (gimple_call_num_args (gs
) > 0)
921 pp_string (buffer
, ", ");
922 dump_gimple_call_args (buffer
, gs
, flags
);
928 if (lhs
&& !(flags
& TDF_RHS_ONLY
))
930 dump_generic_node (buffer
, lhs
, spc
, flags
, false);
931 pp_string (buffer
, " =");
933 if (gimple_has_volatile_ops (gs
))
934 pp_string (buffer
, "{v}");
938 if (gimple_call_internal_p (gs
))
941 pp_string (buffer
, internal_fn_name (gimple_call_internal_fn (gs
)));
944 print_call_name (buffer
, fn
, flags
);
945 pp_string (buffer
, " (");
946 dump_gimple_call_args (buffer
, gs
, flags
);
947 pp_right_paren (buffer
);
948 if (!(flags
& TDF_RHS_ONLY
))
949 pp_semicolon (buffer
);
952 if (gimple_call_chain (gs
))
954 pp_string (buffer
, " [static-chain: ");
955 dump_generic_node (buffer
, gimple_call_chain (gs
), spc
, flags
, false);
956 pp_right_bracket (buffer
);
959 if (gimple_call_return_slot_opt_p (gs
))
960 pp_string (buffer
, " [return slot optimization]");
961 if (gimple_call_tail_p (gs
))
962 pp_string (buffer
, " [tail call]");
963 if (gimple_call_must_tail_p (gs
))
964 pp_string (buffer
, " [must tail call]");
969 /* Dump the arguments of _ITM_beginTransaction sanely. */
970 if (TREE_CODE (fn
) == ADDR_EXPR
)
971 fn
= TREE_OPERAND (fn
, 0);
972 if (TREE_CODE (fn
) == FUNCTION_DECL
&& decl_is_tm_clone (fn
))
973 pp_string (buffer
, " [tm-clone]");
974 if (TREE_CODE (fn
) == FUNCTION_DECL
975 && fndecl_built_in_p (fn
, BUILT_IN_TM_START
)
976 && gimple_call_num_args (gs
) > 0)
978 tree t
= gimple_call_arg (gs
, 0);
979 unsigned HOST_WIDE_INT props
;
980 gcc_assert (TREE_CODE (t
) == INTEGER_CST
);
982 pp_string (buffer
, " [ ");
984 /* Get the transaction code properties. */
985 props
= TREE_INT_CST_LOW (t
);
987 if (props
& PR_INSTRUMENTEDCODE
)
988 pp_string (buffer
, "instrumentedCode ");
989 if (props
& PR_UNINSTRUMENTEDCODE
)
990 pp_string (buffer
, "uninstrumentedCode ");
991 if (props
& PR_HASNOXMMUPDATE
)
992 pp_string (buffer
, "hasNoXMMUpdate ");
993 if (props
& PR_HASNOABORT
)
994 pp_string (buffer
, "hasNoAbort ");
995 if (props
& PR_HASNOIRREVOCABLE
)
996 pp_string (buffer
, "hasNoIrrevocable ");
997 if (props
& PR_DOESGOIRREVOCABLE
)
998 pp_string (buffer
, "doesGoIrrevocable ");
999 if (props
& PR_HASNOSIMPLEREADS
)
1000 pp_string (buffer
, "hasNoSimpleReads ");
1001 if (props
& PR_AWBARRIERSOMITTED
)
1002 pp_string (buffer
, "awBarriersOmitted ");
1003 if (props
& PR_RARBARRIERSOMITTED
)
1004 pp_string (buffer
, "RaRBarriersOmitted ");
1005 if (props
& PR_UNDOLOGCODE
)
1006 pp_string (buffer
, "undoLogCode ");
1007 if (props
& PR_PREFERUNINSTRUMENTED
)
1008 pp_string (buffer
, "preferUninstrumented ");
1009 if (props
& PR_EXCEPTIONBLOCK
)
1010 pp_string (buffer
, "exceptionBlock ");
1011 if (props
& PR_HASELSE
)
1012 pp_string (buffer
, "hasElse ");
1013 if (props
& PR_READONLY
)
1014 pp_string (buffer
, "readOnly ");
1016 pp_right_bracket (buffer
);
1021 /* Dump the switch statement GS. BUFFER, SPC and FLAGS are as in
1022 pp_gimple_stmt_1. */
1025 dump_gimple_switch (pretty_printer
*buffer
, const gswitch
*gs
, int spc
,
1030 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
1031 if (flags
& TDF_RAW
)
1032 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, ", gs
,
1033 gimple_switch_index (gs
));
1036 pp_string (buffer
, "switch (");
1037 dump_generic_node (buffer
, gimple_switch_index (gs
), spc
, flags
, true);
1038 if (flags
& TDF_GIMPLE
)
1039 pp_string (buffer
, ") {");
1041 pp_string (buffer
, ") <");
1044 for (i
= 0; i
< gimple_switch_num_labels (gs
); i
++)
1046 tree case_label
= gimple_switch_label (gs
, i
);
1047 gcc_checking_assert (case_label
!= NULL_TREE
);
1048 dump_generic_node (buffer
, case_label
, spc
, flags
, false);
1050 tree label
= CASE_LABEL (case_label
);
1051 dump_generic_node (buffer
, label
, spc
, flags
, false);
1053 if (cfun
&& cfun
->cfg
)
1055 basic_block dest
= label_to_block (cfun
, label
);
1058 edge label_edge
= find_edge (gimple_bb (gs
), dest
);
1059 if (label_edge
&& !(flags
& TDF_GIMPLE
))
1060 dump_edge_probability (buffer
, label_edge
);
1064 if (i
< gimple_switch_num_labels (gs
) - 1)
1066 if (flags
& TDF_GIMPLE
)
1067 pp_string (buffer
, "; ");
1069 pp_string (buffer
, ", ");
1072 if (flags
& TDF_GIMPLE
)
1073 pp_string (buffer
, "; }");
1075 pp_greater (buffer
);
1079 /* Dump the gimple conditional GS. BUFFER, SPC and FLAGS are as in
1080 pp_gimple_stmt_1. */
1083 dump_gimple_cond (pretty_printer
*buffer
, const gcond
*gs
, int spc
,
1086 if (flags
& TDF_RAW
)
1087 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%s, %T, %T, %T, %T>", gs
,
1088 get_tree_code_name (gimple_cond_code (gs
)),
1089 gimple_cond_lhs (gs
), gimple_cond_rhs (gs
),
1090 gimple_cond_true_label (gs
), gimple_cond_false_label (gs
));
1093 if (!(flags
& TDF_RHS_ONLY
))
1094 pp_string (buffer
, "if (");
1095 dump_generic_node (buffer
, gimple_cond_lhs (gs
), spc
,
1096 flags
| ((flags
& TDF_GIMPLE
) ? TDF_GIMPLE_VAL
: TDF_NONE
),
1099 pp_string (buffer
, op_symbol_code (gimple_cond_code (gs
)));
1101 dump_generic_node (buffer
, gimple_cond_rhs (gs
), spc
,
1102 flags
| ((flags
& TDF_GIMPLE
) ? TDF_GIMPLE_VAL
: TDF_NONE
),
1104 if (!(flags
& TDF_RHS_ONLY
))
1107 edge e
, true_edge
= NULL
, false_edge
= NULL
;
1108 basic_block bb
= gimple_bb (gs
);
1112 FOR_EACH_EDGE (e
, ei
, bb
->succs
)
1114 if (e
->flags
& EDGE_TRUE_VALUE
)
1116 else if (e
->flags
& EDGE_FALSE_VALUE
)
1121 bool has_edge_info
= true_edge
!= NULL
&& false_edge
!= NULL
;
1123 pp_right_paren (buffer
);
1125 if (gimple_cond_true_label (gs
))
1127 pp_string (buffer
, " goto ");
1128 dump_generic_node (buffer
, gimple_cond_true_label (gs
),
1130 if (has_edge_info
&& !(flags
& TDF_GIMPLE
))
1131 dump_edge_probability (buffer
, true_edge
);
1132 pp_semicolon (buffer
);
1134 if (gimple_cond_false_label (gs
))
1136 pp_string (buffer
, " else goto ");
1137 dump_generic_node (buffer
, gimple_cond_false_label (gs
),
1139 if (has_edge_info
&& !(flags
& TDF_GIMPLE
))
1140 dump_edge_probability (buffer
, false_edge
);
1142 pp_semicolon (buffer
);
1149 /* Dump a GIMPLE_LABEL tuple on the pretty_printer BUFFER, SPC
1150 spaces of indent. FLAGS specifies details to show in the dump (see
1151 TDF_* in dumpfils.h). */
1154 dump_gimple_label (pretty_printer
*buffer
, const glabel
*gs
, int spc
,
1157 tree label
= gimple_label_label (gs
);
1158 if (flags
& TDF_RAW
)
1159 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
, label
);
1162 dump_generic_node (buffer
, label
, spc
, flags
, false);
1165 if (flags
& TDF_GIMPLE
)
1167 if (DECL_NONLOCAL (label
))
1168 pp_string (buffer
, " [non-local]");
1169 if ((flags
& TDF_EH
) && EH_LANDING_PAD_NR (label
))
1170 pp_printf (buffer
, " [LP %d]", EH_LANDING_PAD_NR (label
));
1173 /* Dump a GIMPLE_GOTO tuple on the pretty_printer BUFFER, SPC
1174 spaces of indent. FLAGS specifies details to show in the dump (see
1175 TDF_* in dumpfile.h). */
1178 dump_gimple_goto (pretty_printer
*buffer
, const ggoto
*gs
, int spc
,
1181 tree label
= gimple_goto_dest (gs
);
1182 if (flags
& TDF_RAW
)
1183 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
, label
);
1185 dump_gimple_fmt (buffer
, spc
, flags
, "goto %T;", label
);
1189 /* Dump a GIMPLE_BIND tuple on the pretty_printer BUFFER, SPC
1190 spaces of indent. FLAGS specifies details to show in the dump (see
1191 TDF_* in dumpfile.h). */
1194 dump_gimple_bind (pretty_printer
*buffer
, const gbind
*gs
, int spc
,
1197 if (flags
& TDF_RAW
)
1198 dump_gimple_fmt (buffer
, spc
, flags
, "%G <", gs
);
1200 pp_left_brace (buffer
);
1201 if (!(flags
& TDF_SLIM
))
1205 for (var
= gimple_bind_vars (gs
); var
; var
= DECL_CHAIN (var
))
1207 newline_and_indent (buffer
, 2);
1208 print_declaration (buffer
, var
, spc
, flags
);
1210 if (gimple_bind_vars (gs
))
1211 pp_newline (buffer
);
1213 pp_newline (buffer
);
1214 dump_gimple_seq (buffer
, gimple_bind_body (gs
), spc
+ 2, flags
);
1215 newline_and_indent (buffer
, spc
);
1216 if (flags
& TDF_RAW
)
1217 pp_greater (buffer
);
1219 pp_right_brace (buffer
);
1223 /* Dump a GIMPLE_TRY tuple on the pretty_printer BUFFER, SPC spaces of
1224 indent. FLAGS specifies details to show in the dump (see TDF_* in
1228 dump_gimple_try (pretty_printer
*buffer
, const gtry
*gs
, int spc
,
1231 if (flags
& TDF_RAW
)
1234 if (gimple_try_kind (gs
) == GIMPLE_TRY_CATCH
)
1235 type
= "GIMPLE_TRY_CATCH";
1236 else if (gimple_try_kind (gs
) == GIMPLE_TRY_FINALLY
)
1237 type
= "GIMPLE_TRY_FINALLY";
1239 type
= "UNKNOWN GIMPLE_TRY";
1240 dump_gimple_fmt (buffer
, spc
, flags
,
1241 "%G <%s,%+EVAL <%S>%nCLEANUP <%S>%->", gs
, type
,
1242 gimple_try_eval (gs
), gimple_try_cleanup (gs
));
1246 pp_string (buffer
, "try");
1247 newline_and_indent (buffer
, spc
+ 2);
1248 pp_left_brace (buffer
);
1249 pp_newline (buffer
);
1251 dump_gimple_seq (buffer
, gimple_try_eval (gs
), spc
+ 4, flags
);
1252 newline_and_indent (buffer
, spc
+ 2);
1253 pp_right_brace (buffer
);
1255 gimple_seq seq
= gimple_try_cleanup (gs
);
1257 if (gimple_try_kind (gs
) == GIMPLE_TRY_CATCH
)
1259 newline_and_indent (buffer
, spc
);
1260 pp_string (buffer
, "catch");
1261 newline_and_indent (buffer
, spc
+ 2);
1262 pp_left_brace (buffer
);
1264 else if (gimple_try_kind (gs
) == GIMPLE_TRY_FINALLY
)
1266 newline_and_indent (buffer
, spc
);
1267 pp_string (buffer
, "finally");
1268 newline_and_indent (buffer
, spc
+ 2);
1269 pp_left_brace (buffer
);
1271 if (seq
&& is_a
<geh_else
*> (gimple_seq_first_stmt (seq
))
1272 && gimple_seq_nondebug_singleton_p (seq
))
1274 geh_else
*stmt
= as_a
<geh_else
*> (gimple_seq_first_stmt (seq
));
1275 seq
= gimple_eh_else_n_body (stmt
);
1276 pp_newline (buffer
);
1277 dump_gimple_seq (buffer
, seq
, spc
+ 4, flags
);
1278 newline_and_indent (buffer
, spc
+ 2);
1279 pp_right_brace (buffer
);
1280 seq
= gimple_eh_else_e_body (stmt
);
1281 newline_and_indent (buffer
, spc
);
1282 pp_string (buffer
, "else");
1283 newline_and_indent (buffer
, spc
+ 2);
1284 pp_left_brace (buffer
);
1288 pp_string (buffer
, " <UNKNOWN GIMPLE_TRY> {");
1290 pp_newline (buffer
);
1291 dump_gimple_seq (buffer
, seq
, spc
+ 4, flags
);
1292 newline_and_indent (buffer
, spc
+ 2);
1293 pp_right_brace (buffer
);
1298 /* Dump a GIMPLE_CATCH tuple on the pretty_printer BUFFER, SPC spaces of
1299 indent. FLAGS specifies details to show in the dump (see TDF_* in
1303 dump_gimple_catch (pretty_printer
*buffer
, const gcatch
*gs
, int spc
,
1306 if (flags
& TDF_RAW
)
1307 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %+CATCH <%S>%->", gs
,
1308 gimple_catch_types (gs
), gimple_catch_handler (gs
));
1310 dump_gimple_fmt (buffer
, spc
, flags
, "catch (%T)%+{%S}",
1311 gimple_catch_types (gs
), gimple_catch_handler (gs
));
1315 /* Dump a GIMPLE_EH_FILTER tuple on the pretty_printer BUFFER, SPC spaces of
1316 indent. FLAGS specifies details to show in the dump (see TDF_* in
1320 dump_gimple_eh_filter (pretty_printer
*buffer
, const geh_filter
*gs
, int spc
,
1323 if (flags
& TDF_RAW
)
1324 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %+FAILURE <%S>%->", gs
,
1325 gimple_eh_filter_types (gs
),
1326 gimple_eh_filter_failure (gs
));
1328 dump_gimple_fmt (buffer
, spc
, flags
, "<<<eh_filter (%T)>>>%+{%+%S%-}",
1329 gimple_eh_filter_types (gs
),
1330 gimple_eh_filter_failure (gs
));
1334 /* Dump a GIMPLE_EH_MUST_NOT_THROW tuple. */
1337 dump_gimple_eh_must_not_throw (pretty_printer
*buffer
,
1338 const geh_mnt
*gs
, int spc
, dump_flags_t flags
)
1340 if (flags
& TDF_RAW
)
1341 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
,
1342 gimple_eh_must_not_throw_fndecl (gs
));
1344 dump_gimple_fmt (buffer
, spc
, flags
, "<<<eh_must_not_throw (%T)>>>",
1345 gimple_eh_must_not_throw_fndecl (gs
));
1349 /* Dump a GIMPLE_EH_ELSE tuple on the pretty_printer BUFFER, SPC spaces of
1350 indent. FLAGS specifies details to show in the dump (see TDF_* in
1354 dump_gimple_eh_else (pretty_printer
*buffer
, const geh_else
*gs
, int spc
,
1357 if (flags
& TDF_RAW
)
1358 dump_gimple_fmt (buffer
, spc
, flags
,
1359 "%G <%+N_BODY <%S>%nE_BODY <%S>%->", gs
,
1360 gimple_eh_else_n_body (gs
), gimple_eh_else_e_body (gs
));
1362 dump_gimple_fmt (buffer
, spc
, flags
,
1363 "<<<if_normal_exit>>>%+{%S}%-<<<else_eh_exit>>>%+{%S}",
1364 gimple_eh_else_n_body (gs
), gimple_eh_else_e_body (gs
));
1368 /* Dump a GIMPLE_RESX tuple on the pretty_printer BUFFER, SPC spaces of
1369 indent. FLAGS specifies details to show in the dump (see TDF_* in
1373 dump_gimple_resx (pretty_printer
*buffer
, const gresx
*gs
, int spc
,
1376 if (flags
& TDF_RAW
)
1377 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%d>", gs
,
1378 gimple_resx_region (gs
));
1380 dump_gimple_fmt (buffer
, spc
, flags
, "resx %d", gimple_resx_region (gs
));
1383 /* Dump a GIMPLE_EH_DISPATCH tuple on the pretty_printer BUFFER. */
1386 dump_gimple_eh_dispatch (pretty_printer
*buffer
, const geh_dispatch
*gs
,
1387 int spc
, dump_flags_t flags
)
1389 if (flags
& TDF_RAW
)
1390 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%d>", gs
,
1391 gimple_eh_dispatch_region (gs
));
1393 dump_gimple_fmt (buffer
, spc
, flags
, "eh_dispatch %d",
1394 gimple_eh_dispatch_region (gs
));
1397 /* Dump a GIMPLE_DEBUG tuple on the pretty_printer BUFFER, SPC spaces
1398 of indent. FLAGS specifies details to show in the dump (see TDF_*
1402 dump_gimple_debug (pretty_printer
*buffer
, const gdebug
*gs
, int spc
,
1405 switch (gs
->subcode
)
1407 case GIMPLE_DEBUG_BIND
:
1408 if (flags
& TDF_RAW
)
1409 dump_gimple_fmt (buffer
, spc
, flags
, "%G BIND <%T, %T>", gs
,
1410 gimple_debug_bind_get_var (gs
),
1411 gimple_debug_bind_get_value (gs
));
1413 dump_gimple_fmt (buffer
, spc
, flags
, "# DEBUG %T => %T",
1414 gimple_debug_bind_get_var (gs
),
1415 gimple_debug_bind_get_value (gs
));
1418 case GIMPLE_DEBUG_SOURCE_BIND
:
1419 if (flags
& TDF_RAW
)
1420 dump_gimple_fmt (buffer
, spc
, flags
, "%G SRCBIND <%T, %T>", gs
,
1421 gimple_debug_source_bind_get_var (gs
),
1422 gimple_debug_source_bind_get_value (gs
));
1424 dump_gimple_fmt (buffer
, spc
, flags
, "# DEBUG %T s=> %T",
1425 gimple_debug_source_bind_get_var (gs
),
1426 gimple_debug_source_bind_get_value (gs
));
1429 case GIMPLE_DEBUG_BEGIN_STMT
:
1430 if (flags
& TDF_RAW
)
1431 dump_gimple_fmt (buffer
, spc
, flags
, "%G BEGIN_STMT", gs
);
1433 dump_gimple_fmt (buffer
, spc
, flags
, "# DEBUG BEGIN_STMT");
1436 case GIMPLE_DEBUG_INLINE_ENTRY
:
1437 if (flags
& TDF_RAW
)
1438 dump_gimple_fmt (buffer
, spc
, flags
, "%G INLINE_ENTRY %T", gs
,
1440 ? block_ultimate_origin (gimple_block (gs
))
1443 dump_gimple_fmt (buffer
, spc
, flags
, "# DEBUG INLINE_ENTRY %T",
1445 ? block_ultimate_origin (gimple_block (gs
))
1454 /* Dump a GIMPLE_OMP_FOR tuple on the pretty_printer BUFFER. */
1456 dump_gimple_omp_for (pretty_printer
*buffer
, const gomp_for
*gs
, int spc
,
1461 if (flags
& TDF_RAW
)
1464 switch (gimple_omp_for_kind (gs
))
1466 case GF_OMP_FOR_KIND_FOR
:
1469 case GF_OMP_FOR_KIND_DISTRIBUTE
:
1470 kind
= " distribute";
1472 case GF_OMP_FOR_KIND_TASKLOOP
:
1475 case GF_OMP_FOR_KIND_OACC_LOOP
:
1476 kind
= " oacc_loop";
1478 case GF_OMP_FOR_KIND_SIMD
:
1484 dump_gimple_fmt (buffer
, spc
, flags
, "%G%s <%+BODY <%S>%nCLAUSES <", gs
,
1485 kind
, gimple_omp_body (gs
));
1486 dump_omp_clauses (buffer
, gimple_omp_for_clauses (gs
), spc
, flags
);
1487 dump_gimple_fmt (buffer
, spc
, flags
, " >,");
1488 for (i
= 0; i
< gimple_omp_for_collapse (gs
); i
++)
1489 dump_gimple_fmt (buffer
, spc
, flags
,
1490 "%+%T, %T, %T, %s, %T,%n",
1491 gimple_omp_for_index (gs
, i
),
1492 gimple_omp_for_initial (gs
, i
),
1493 gimple_omp_for_final (gs
, i
),
1494 get_tree_code_name (gimple_omp_for_cond (gs
, i
)),
1495 gimple_omp_for_incr (gs
, i
));
1496 dump_gimple_fmt (buffer
, spc
, flags
, "PRE_BODY <%S>%->",
1497 gimple_omp_for_pre_body (gs
));
1501 switch (gimple_omp_for_kind (gs
))
1503 case GF_OMP_FOR_KIND_FOR
:
1504 pp_string (buffer
, "#pragma omp for");
1506 case GF_OMP_FOR_KIND_DISTRIBUTE
:
1507 pp_string (buffer
, "#pragma omp distribute");
1509 case GF_OMP_FOR_KIND_TASKLOOP
:
1510 pp_string (buffer
, "#pragma omp taskloop");
1512 case GF_OMP_FOR_KIND_OACC_LOOP
:
1513 pp_string (buffer
, "#pragma acc loop");
1515 case GF_OMP_FOR_KIND_SIMD
:
1516 pp_string (buffer
, "#pragma omp simd");
1521 dump_omp_clauses (buffer
, gimple_omp_for_clauses (gs
), spc
, flags
);
1522 for (i
= 0; i
< gimple_omp_for_collapse (gs
); i
++)
1526 newline_and_indent (buffer
, spc
);
1527 pp_string (buffer
, "for (");
1528 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
1530 pp_string (buffer
, " = ");
1531 tree init
= gimple_omp_for_initial (gs
, i
);
1532 if (TREE_CODE (init
) != TREE_VEC
)
1533 dump_generic_node (buffer
, init
, spc
, flags
, false);
1535 dump_omp_loop_non_rect_expr (buffer
, init
, spc
, flags
);
1536 pp_string (buffer
, "; ");
1538 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
1541 switch (gimple_omp_for_cond (gs
, i
))
1547 pp_greater (buffer
);
1550 pp_less_equal (buffer
);
1553 pp_greater_equal (buffer
);
1556 pp_string (buffer
, "!=");
1562 tree cond
= gimple_omp_for_final (gs
, i
);
1563 if (TREE_CODE (cond
) != TREE_VEC
)
1564 dump_generic_node (buffer
, cond
, spc
, flags
, false);
1566 dump_omp_loop_non_rect_expr (buffer
, cond
, spc
, flags
);
1567 pp_string (buffer
, "; ");
1569 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
1571 pp_string (buffer
, " = ");
1572 dump_generic_node (buffer
, gimple_omp_for_incr (gs
, i
), spc
,
1574 pp_right_paren (buffer
);
1577 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1579 newline_and_indent (buffer
, spc
+ 2);
1580 pp_left_brace (buffer
);
1581 pp_newline (buffer
);
1582 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1583 newline_and_indent (buffer
, spc
+ 2);
1584 pp_right_brace (buffer
);
1589 /* Dump a GIMPLE_OMP_CONTINUE tuple on the pretty_printer BUFFER. */
1592 dump_gimple_omp_continue (pretty_printer
*buffer
, const gomp_continue
*gs
,
1593 int spc
, dump_flags_t flags
)
1595 if (flags
& TDF_RAW
)
1597 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T>", gs
,
1598 gimple_omp_continue_control_def (gs
),
1599 gimple_omp_continue_control_use (gs
));
1603 pp_string (buffer
, "#pragma omp continue (");
1604 dump_generic_node (buffer
, gimple_omp_continue_control_def (gs
),
1608 dump_generic_node (buffer
, gimple_omp_continue_control_use (gs
),
1610 pp_right_paren (buffer
);
1614 /* Dump a GIMPLE_OMP_SINGLE tuple on the pretty_printer BUFFER. */
1617 dump_gimple_omp_single (pretty_printer
*buffer
, const gomp_single
*gs
,
1618 int spc
, dump_flags_t flags
)
1620 if (flags
& TDF_RAW
)
1622 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1623 gimple_omp_body (gs
));
1624 dump_omp_clauses (buffer
, gimple_omp_single_clauses (gs
), spc
, flags
);
1625 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1629 pp_string (buffer
, "#pragma omp single");
1630 dump_omp_clauses (buffer
, gimple_omp_single_clauses (gs
), spc
, flags
);
1631 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1633 newline_and_indent (buffer
, spc
+ 2);
1634 pp_left_brace (buffer
);
1635 pp_newline (buffer
);
1636 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1637 newline_and_indent (buffer
, spc
+ 2);
1638 pp_right_brace (buffer
);
1643 /* Dump a GIMPLE_OMP_TASKGROUP tuple on the pretty_printer BUFFER. */
1646 dump_gimple_omp_taskgroup (pretty_printer
*buffer
, const gimple
*gs
,
1647 int spc
, dump_flags_t flags
)
1649 if (flags
& TDF_RAW
)
1651 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1652 gimple_omp_body (gs
));
1653 dump_omp_clauses (buffer
, gimple_omp_taskgroup_clauses (gs
), spc
, flags
);
1654 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1658 pp_string (buffer
, "#pragma omp taskgroup");
1659 dump_omp_clauses (buffer
, gimple_omp_taskgroup_clauses (gs
), spc
, flags
);
1660 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1662 newline_and_indent (buffer
, spc
+ 2);
1663 pp_left_brace (buffer
);
1664 pp_newline (buffer
);
1665 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1666 newline_and_indent (buffer
, spc
+ 2);
1667 pp_right_brace (buffer
);
1672 /* Dump a GIMPLE_OMP_MASKED tuple on the pretty_printer BUFFER. */
1675 dump_gimple_omp_masked (pretty_printer
*buffer
, const gimple
*gs
,
1676 int spc
, dump_flags_t flags
)
1678 if (flags
& TDF_RAW
)
1680 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1681 gimple_omp_body (gs
));
1682 dump_omp_clauses (buffer
, gimple_omp_masked_clauses (gs
), spc
, flags
);
1683 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1687 pp_string (buffer
, "#pragma omp masked");
1688 dump_omp_clauses (buffer
, gimple_omp_masked_clauses (gs
), spc
, flags
);
1689 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1691 newline_and_indent (buffer
, spc
+ 2);
1692 pp_left_brace (buffer
);
1693 pp_newline (buffer
);
1694 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1695 newline_and_indent (buffer
, spc
+ 2);
1696 pp_right_brace (buffer
);
1701 /* Dump a GIMPLE_OMP_SCOPE tuple on the pretty_printer BUFFER. */
1704 dump_gimple_omp_scope (pretty_printer
*buffer
, const gimple
*gs
,
1705 int spc
, dump_flags_t flags
)
1707 if (flags
& TDF_RAW
)
1709 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1710 gimple_omp_body (gs
));
1711 dump_omp_clauses (buffer
, gimple_omp_scope_clauses (gs
), spc
, flags
);
1712 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1716 pp_string (buffer
, "#pragma omp scope");
1717 dump_omp_clauses (buffer
, gimple_omp_scope_clauses (gs
), spc
, flags
);
1718 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1720 newline_and_indent (buffer
, spc
+ 2);
1721 pp_left_brace (buffer
);
1722 pp_newline (buffer
);
1723 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1724 newline_and_indent (buffer
, spc
+ 2);
1725 pp_right_brace (buffer
);
1730 /* Dump a GIMPLE_OMP_TARGET tuple on the pretty_printer BUFFER. */
1733 dump_gimple_omp_target (pretty_printer
*buffer
, const gomp_target
*gs
,
1734 int spc
, dump_flags_t flags
)
1737 switch (gimple_omp_target_kind (gs
))
1739 case GF_OMP_TARGET_KIND_REGION
:
1742 case GF_OMP_TARGET_KIND_DATA
:
1745 case GF_OMP_TARGET_KIND_UPDATE
:
1748 case GF_OMP_TARGET_KIND_ENTER_DATA
:
1749 kind
= " enter data";
1751 case GF_OMP_TARGET_KIND_EXIT_DATA
:
1752 kind
= " exit data";
1754 case GF_OMP_TARGET_KIND_OACC_KERNELS
:
1755 kind
= " oacc_kernels";
1757 case GF_OMP_TARGET_KIND_OACC_PARALLEL
:
1758 kind
= " oacc_parallel";
1760 case GF_OMP_TARGET_KIND_OACC_SERIAL
:
1761 kind
= " oacc_serial";
1763 case GF_OMP_TARGET_KIND_OACC_DATA
:
1764 kind
= " oacc_data";
1766 case GF_OMP_TARGET_KIND_OACC_UPDATE
:
1767 kind
= " oacc_update";
1769 case GF_OMP_TARGET_KIND_OACC_ENTER_DATA
:
1770 kind
= " oacc_enter_data";
1772 case GF_OMP_TARGET_KIND_OACC_EXIT_DATA
:
1773 kind
= " oacc_exit_data";
1775 case GF_OMP_TARGET_KIND_OACC_DECLARE
:
1776 kind
= " oacc_declare";
1778 case GF_OMP_TARGET_KIND_OACC_HOST_DATA
:
1779 kind
= " oacc_host_data";
1781 case GF_OMP_TARGET_KIND_OACC_PARALLEL_KERNELS_PARALLELIZED
:
1782 kind
= " oacc_parallel_kernels_parallelized";
1784 case GF_OMP_TARGET_KIND_OACC_PARALLEL_KERNELS_GANG_SINGLE
:
1785 kind
= " oacc_parallel_kernels_gang_single";
1787 case GF_OMP_TARGET_KIND_OACC_DATA_KERNELS
:
1788 kind
= " oacc_data_kernels";
1793 if (flags
& TDF_RAW
)
1795 dump_gimple_fmt (buffer
, spc
, flags
, "%G%s <%+BODY <%S>%nCLAUSES <", gs
,
1796 kind
, gimple_omp_body (gs
));
1797 dump_omp_clauses (buffer
, gimple_omp_target_clauses (gs
), spc
, flags
);
1798 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T%n>",
1799 gimple_omp_target_child_fn (gs
),
1800 gimple_omp_target_data_arg (gs
));
1804 pp_string (buffer
, "#pragma omp target");
1805 pp_string (buffer
, kind
);
1806 dump_omp_clauses (buffer
, gimple_omp_target_clauses (gs
), spc
, flags
);
1807 if (gimple_omp_target_child_fn (gs
))
1809 pp_string (buffer
, " [child fn: ");
1810 dump_generic_node (buffer
, gimple_omp_target_child_fn (gs
),
1812 pp_string (buffer
, " (");
1813 if (gimple_omp_target_data_arg (gs
))
1814 dump_generic_node (buffer
, gimple_omp_target_data_arg (gs
),
1817 pp_string (buffer
, "???");
1818 pp_string (buffer
, ")]");
1820 gimple_seq body
= gimple_omp_body (gs
);
1821 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
1823 newline_and_indent (buffer
, spc
+ 2);
1824 pp_left_brace (buffer
);
1825 pp_newline (buffer
);
1826 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
1827 newline_and_indent (buffer
, spc
+ 2);
1828 pp_right_brace (buffer
);
1832 pp_newline (buffer
);
1833 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
1838 /* Dump a GIMPLE_OMP_TEAMS tuple on the pretty_printer BUFFER. */
1841 dump_gimple_omp_teams (pretty_printer
*buffer
, const gomp_teams
*gs
, int spc
,
1844 if (flags
& TDF_RAW
)
1846 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1847 gimple_omp_body (gs
));
1848 dump_omp_clauses (buffer
, gimple_omp_teams_clauses (gs
), spc
, flags
);
1849 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1853 pp_string (buffer
, "#pragma omp teams");
1854 dump_omp_clauses (buffer
, gimple_omp_teams_clauses (gs
), spc
, flags
);
1855 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1857 newline_and_indent (buffer
, spc
+ 2);
1858 pp_character (buffer
, '{');
1859 pp_newline (buffer
);
1860 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1861 newline_and_indent (buffer
, spc
+ 2);
1862 pp_character (buffer
, '}');
1867 /* Dump a GIMPLE_OMP_SECTIONS tuple on the pretty_printer BUFFER. */
1870 dump_gimple_omp_sections (pretty_printer
*buffer
, const gomp_sections
*gs
,
1871 int spc
, dump_flags_t flags
)
1873 if (flags
& TDF_RAW
)
1875 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1876 gimple_omp_body (gs
));
1877 dump_omp_clauses (buffer
, gimple_omp_sections_clauses (gs
), spc
, flags
);
1878 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1882 pp_string (buffer
, "#pragma omp sections");
1883 if (gimple_omp_sections_control (gs
))
1885 pp_string (buffer
, " <");
1886 dump_generic_node (buffer
, gimple_omp_sections_control (gs
), spc
,
1888 pp_greater (buffer
);
1890 dump_omp_clauses (buffer
, gimple_omp_sections_clauses (gs
), spc
, flags
);
1891 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1893 newline_and_indent (buffer
, spc
+ 2);
1894 pp_left_brace (buffer
);
1895 pp_newline (buffer
);
1896 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1897 newline_and_indent (buffer
, spc
+ 2);
1898 pp_right_brace (buffer
);
1903 /* Dump a GIMPLE_OMP_{MASTER,ORDERED,SECTION} tuple on the
1904 pretty_printer BUFFER. */
1907 dump_gimple_omp_block (pretty_printer
*buffer
, const gimple
*gs
, int spc
,
1910 if (flags
& TDF_RAW
)
1911 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1912 gimple_omp_body (gs
));
1915 switch (gimple_code (gs
))
1917 case GIMPLE_OMP_MASTER
:
1918 pp_string (buffer
, "#pragma omp master");
1920 case GIMPLE_OMP_SECTION
:
1921 pp_string (buffer
, "#pragma omp section");
1926 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1928 newline_and_indent (buffer
, spc
+ 2);
1929 pp_left_brace (buffer
);
1930 pp_newline (buffer
);
1931 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1932 newline_and_indent (buffer
, spc
+ 2);
1933 pp_right_brace (buffer
);
1938 /* Dump a GIMPLE_OMP_CRITICAL tuple on the pretty_printer BUFFER. */
1941 dump_gimple_omp_critical (pretty_printer
*buffer
, const gomp_critical
*gs
,
1942 int spc
, dump_flags_t flags
)
1944 if (flags
& TDF_RAW
)
1945 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1946 gimple_omp_body (gs
));
1949 pp_string (buffer
, "#pragma omp critical");
1950 if (gimple_omp_critical_name (gs
))
1952 pp_string (buffer
, " (");
1953 dump_generic_node (buffer
, gimple_omp_critical_name (gs
), spc
,
1955 pp_right_paren (buffer
);
1957 dump_omp_clauses (buffer
, gimple_omp_critical_clauses (gs
), spc
, flags
);
1958 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1960 newline_and_indent (buffer
, spc
+ 2);
1961 pp_left_brace (buffer
);
1962 pp_newline (buffer
);
1963 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1964 newline_and_indent (buffer
, spc
+ 2);
1965 pp_right_brace (buffer
);
1970 /* Dump a GIMPLE_OMP_ORDERED tuple on the pretty_printer BUFFER. */
1973 dump_gimple_omp_ordered (pretty_printer
*buffer
, const gomp_ordered
*gs
,
1974 int spc
, dump_flags_t flags
)
1976 if (flags
& TDF_RAW
)
1977 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1978 gimple_omp_body (gs
));
1981 pp_string (buffer
, "#pragma omp ordered");
1982 dump_omp_clauses (buffer
, gimple_omp_ordered_clauses (gs
), spc
, flags
);
1983 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1985 newline_and_indent (buffer
, spc
+ 2);
1986 pp_left_brace (buffer
);
1987 pp_newline (buffer
);
1988 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1989 newline_and_indent (buffer
, spc
+ 2);
1990 pp_right_brace (buffer
);
1995 /* Dump a GIMPLE_OMP_SCAN tuple on the pretty_printer BUFFER. */
1998 dump_gimple_omp_scan (pretty_printer
*buffer
, const gomp_scan
*gs
,
1999 int spc
, dump_flags_t flags
)
2001 if (flags
& TDF_RAW
)
2002 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
2003 gimple_omp_body (gs
));
2006 if (gimple_omp_scan_clauses (gs
))
2008 pp_string (buffer
, "#pragma omp scan");
2009 dump_omp_clauses (buffer
, gimple_omp_scan_clauses (gs
), spc
, flags
);
2011 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
2013 newline_and_indent (buffer
, spc
+ 2);
2014 pp_left_brace (buffer
);
2015 pp_newline (buffer
);
2016 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
2017 newline_and_indent (buffer
, spc
+ 2);
2018 pp_right_brace (buffer
);
2023 /* Dump a GIMPLE_OMP_RETURN tuple on the pretty_printer BUFFER. */
2026 dump_gimple_omp_return (pretty_printer
*buffer
, const gimple
*gs
, int spc
,
2029 if (flags
& TDF_RAW
)
2031 dump_gimple_fmt (buffer
, spc
, flags
, "%G <nowait=%d", gs
,
2032 (int) gimple_omp_return_nowait_p (gs
));
2033 if (gimple_omp_return_lhs (gs
))
2034 dump_gimple_fmt (buffer
, spc
, flags
, ", lhs=%T>",
2035 gimple_omp_return_lhs (gs
));
2037 dump_gimple_fmt (buffer
, spc
, flags
, ">");
2041 pp_string (buffer
, "#pragma omp return");
2042 if (gimple_omp_return_nowait_p (gs
))
2043 pp_string (buffer
, "(nowait)");
2044 if (gimple_omp_return_lhs (gs
))
2046 pp_string (buffer
, " (set ");
2047 dump_generic_node (buffer
, gimple_omp_return_lhs (gs
),
2049 pp_character (buffer
, ')');
2054 /* Dump a GIMPLE_ASSUME tuple on the pretty_printer BUFFER. */
2057 dump_gimple_assume (pretty_printer
*buffer
, const gimple
*gs
,
2058 int spc
, dump_flags_t flags
)
2060 if (flags
& TDF_RAW
)
2061 dump_gimple_fmt (buffer
, spc
, flags
,
2062 "%G [GUARD=%T] <%+BODY <%S> >",
2063 gs
, gimple_assume_guard (gs
),
2064 gimple_assume_body (gs
));
2067 pp_string (buffer
, "[[assume (");
2068 dump_generic_node (buffer
, gimple_assume_guard (gs
), spc
, flags
, false);
2069 pp_string (buffer
, ")]]");
2070 newline_and_indent (buffer
, spc
+ 2);
2071 pp_left_brace (buffer
);
2072 pp_newline (buffer
);
2073 dump_gimple_seq (buffer
, gimple_assume_body (gs
), spc
+ 4, flags
);
2074 newline_and_indent (buffer
, spc
+ 2);
2075 pp_right_brace (buffer
);
2079 /* Dump a GIMPLE_TRANSACTION tuple on the pretty_printer BUFFER. */
2082 dump_gimple_transaction (pretty_printer
*buffer
, const gtransaction
*gs
,
2083 int spc
, dump_flags_t flags
)
2085 unsigned subcode
= gimple_transaction_subcode (gs
);
2087 if (flags
& TDF_RAW
)
2089 dump_gimple_fmt (buffer
, spc
, flags
,
2090 "%G [SUBCODE=%x,NORM=%T,UNINST=%T,OVER=%T] "
2092 gs
, subcode
, gimple_transaction_label_norm (gs
),
2093 gimple_transaction_label_uninst (gs
),
2094 gimple_transaction_label_over (gs
),
2095 gimple_transaction_body (gs
));
2099 if (subcode
& GTMA_IS_OUTER
)
2100 pp_string (buffer
, "__transaction_atomic [[outer]]");
2101 else if (subcode
& GTMA_IS_RELAXED
)
2102 pp_string (buffer
, "__transaction_relaxed");
2104 pp_string (buffer
, "__transaction_atomic");
2105 subcode
&= ~GTMA_DECLARATION_MASK
;
2107 if (gimple_transaction_body (gs
))
2109 newline_and_indent (buffer
, spc
+ 2);
2110 pp_left_brace (buffer
);
2111 pp_newline (buffer
);
2112 dump_gimple_seq (buffer
, gimple_transaction_body (gs
),
2114 newline_and_indent (buffer
, spc
+ 2);
2115 pp_right_brace (buffer
);
2119 pp_string (buffer
, " //");
2120 if (gimple_transaction_label_norm (gs
))
2122 pp_string (buffer
, " NORM=");
2123 dump_generic_node (buffer
, gimple_transaction_label_norm (gs
),
2126 if (gimple_transaction_label_uninst (gs
))
2128 pp_string (buffer
, " UNINST=");
2129 dump_generic_node (buffer
, gimple_transaction_label_uninst (gs
),
2132 if (gimple_transaction_label_over (gs
))
2134 pp_string (buffer
, " OVER=");
2135 dump_generic_node (buffer
, gimple_transaction_label_over (gs
),
2140 pp_string (buffer
, " SUBCODE=[ ");
2141 if (subcode
& GTMA_HAVE_ABORT
)
2143 pp_string (buffer
, "GTMA_HAVE_ABORT ");
2144 subcode
&= ~GTMA_HAVE_ABORT
;
2146 if (subcode
& GTMA_HAVE_LOAD
)
2148 pp_string (buffer
, "GTMA_HAVE_LOAD ");
2149 subcode
&= ~GTMA_HAVE_LOAD
;
2151 if (subcode
& GTMA_HAVE_STORE
)
2153 pp_string (buffer
, "GTMA_HAVE_STORE ");
2154 subcode
&= ~GTMA_HAVE_STORE
;
2156 if (subcode
& GTMA_MAY_ENTER_IRREVOCABLE
)
2158 pp_string (buffer
, "GTMA_MAY_ENTER_IRREVOCABLE ");
2159 subcode
&= ~GTMA_MAY_ENTER_IRREVOCABLE
;
2161 if (subcode
& GTMA_DOES_GO_IRREVOCABLE
)
2163 pp_string (buffer
, "GTMA_DOES_GO_IRREVOCABLE ");
2164 subcode
&= ~GTMA_DOES_GO_IRREVOCABLE
;
2166 if (subcode
& GTMA_HAS_NO_INSTRUMENTATION
)
2168 pp_string (buffer
, "GTMA_HAS_NO_INSTRUMENTATION ");
2169 subcode
&= ~GTMA_HAS_NO_INSTRUMENTATION
;
2172 pp_printf (buffer
, "0x%x ", subcode
);
2173 pp_right_bracket (buffer
);
2179 /* Dump a GIMPLE_ASM tuple on the pretty_printer BUFFER, SPC spaces of
2180 indent. FLAGS specifies details to show in the dump (see TDF_* in
2184 dump_gimple_asm (pretty_printer
*buffer
, const gasm
*gs
, int spc
,
2187 unsigned int i
, n
, f
, fields
;
2189 if (flags
& TDF_RAW
)
2191 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+STRING <%n%s%n>", gs
,
2192 gimple_asm_string (gs
));
2194 n
= gimple_asm_noutputs (gs
);
2197 newline_and_indent (buffer
, spc
+ 2);
2198 pp_string (buffer
, "OUTPUT: ");
2199 for (i
= 0; i
< n
; i
++)
2201 dump_generic_node (buffer
, gimple_asm_output_op (gs
, i
),
2204 pp_string (buffer
, ", ");
2208 n
= gimple_asm_ninputs (gs
);
2211 newline_and_indent (buffer
, spc
+ 2);
2212 pp_string (buffer
, "INPUT: ");
2213 for (i
= 0; i
< n
; i
++)
2215 dump_generic_node (buffer
, gimple_asm_input_op (gs
, i
),
2218 pp_string (buffer
, ", ");
2222 n
= gimple_asm_nclobbers (gs
);
2225 newline_and_indent (buffer
, spc
+ 2);
2226 pp_string (buffer
, "CLOBBER: ");
2227 for (i
= 0; i
< n
; i
++)
2229 dump_generic_node (buffer
, gimple_asm_clobber_op (gs
, i
),
2232 pp_string (buffer
, ", ");
2236 n
= gimple_asm_nlabels (gs
);
2239 newline_and_indent (buffer
, spc
+ 2);
2240 pp_string (buffer
, "LABEL: ");
2241 for (i
= 0; i
< n
; i
++)
2243 dump_generic_node (buffer
, gimple_asm_label_op (gs
, i
),
2246 pp_string (buffer
, ", ");
2250 newline_and_indent (buffer
, spc
);
2251 pp_greater (buffer
);
2255 pp_string (buffer
, "__asm__");
2256 if (gimple_asm_volatile_p (gs
))
2257 pp_string (buffer
, " __volatile__");
2258 if (gimple_asm_inline_p (gs
))
2259 pp_string (buffer
, " __inline__");
2260 if (gimple_asm_nlabels (gs
))
2261 pp_string (buffer
, " goto");
2262 pp_string (buffer
, "(\"");
2263 pp_string (buffer
, gimple_asm_string (gs
));
2264 pp_string (buffer
, "\"");
2266 if (gimple_asm_nlabels (gs
))
2268 else if (gimple_asm_nclobbers (gs
))
2270 else if (gimple_asm_ninputs (gs
))
2272 else if (gimple_asm_noutputs (gs
))
2277 for (f
= 0; f
< fields
; ++f
)
2279 pp_string (buffer
, " : ");
2284 n
= gimple_asm_noutputs (gs
);
2285 for (i
= 0; i
< n
; i
++)
2287 dump_generic_node (buffer
, gimple_asm_output_op (gs
, i
),
2290 pp_string (buffer
, ", ");
2295 n
= gimple_asm_ninputs (gs
);
2296 for (i
= 0; i
< n
; i
++)
2298 dump_generic_node (buffer
, gimple_asm_input_op (gs
, i
),
2301 pp_string (buffer
, ", ");
2306 n
= gimple_asm_nclobbers (gs
);
2307 for (i
= 0; i
< n
; i
++)
2309 dump_generic_node (buffer
, gimple_asm_clobber_op (gs
, i
),
2312 pp_string (buffer
, ", ");
2317 n
= gimple_asm_nlabels (gs
);
2318 for (i
= 0; i
< n
; i
++)
2320 dump_generic_node (buffer
, gimple_asm_label_op (gs
, i
),
2323 pp_string (buffer
, ", ");
2332 pp_string (buffer
, ");");
2336 /* Dump ptr_info and range_info for NODE on pretty_printer BUFFER with
2337 SPC spaces of indent. */
2340 dump_ssaname_info (pretty_printer
*buffer
, tree node
, int spc
)
2342 if (TREE_CODE (node
) != SSA_NAME
)
2345 if (POINTER_TYPE_P (TREE_TYPE (node
))
2346 && SSA_NAME_PTR_INFO (node
))
2348 unsigned int align
, misalign
;
2349 struct ptr_info_def
*pi
= SSA_NAME_PTR_INFO (node
);
2350 pp_string (buffer
, "# PT = ");
2351 pp_points_to_solution (buffer
, &pi
->pt
);
2352 newline_and_indent (buffer
, spc
);
2353 if (get_ptr_info_alignment (pi
, &align
, &misalign
))
2355 pp_printf (buffer
, "# ALIGN = %u, MISALIGN = %u", align
, misalign
);
2356 newline_and_indent (buffer
, spc
);
2360 if (!POINTER_TYPE_P (TREE_TYPE (node
))
2361 && SSA_NAME_RANGE_INFO (node
))
2363 Value_Range
r (TREE_TYPE (node
));
2364 get_global_range_query ()->range_of_expr (r
, node
);
2365 pp_string (buffer
, "# RANGE ");
2366 pp_vrange (buffer
, &r
);
2367 newline_and_indent (buffer
, spc
);
2371 /* As dump_ssaname_info, but dump to FILE. */
2374 dump_ssaname_info_to_file (FILE *file
, tree node
, int spc
)
2376 pretty_printer buffer
;
2377 pp_needs_newline (&buffer
) = true;
2378 buffer
.buffer
->stream
= file
;
2379 dump_ssaname_info (&buffer
, node
, spc
);
2383 /* Dump a PHI node PHI. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1.
2384 The caller is responsible for calling pp_flush on BUFFER to finalize
2385 pretty printer. If COMMENT is true, print this after #. */
2388 dump_gimple_phi (pretty_printer
*buffer
, const gphi
*phi
, int spc
, bool comment
,
2392 tree lhs
= gimple_phi_result (phi
);
2394 if (flags
& TDF_ALIAS
)
2395 dump_ssaname_info (buffer
, lhs
, spc
);
2398 pp_string (buffer
, "# ");
2400 if (flags
& TDF_RAW
)
2401 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, ", phi
,
2402 gimple_phi_result (phi
));
2405 dump_generic_node (buffer
, lhs
, spc
, flags
, false);
2406 if (flags
& TDF_GIMPLE
)
2407 pp_string (buffer
, " = __PHI (");
2409 pp_string (buffer
, " = PHI <");
2411 for (i
= 0; i
< gimple_phi_num_args (phi
); i
++)
2413 if ((flags
& TDF_LINENO
) && gimple_phi_arg_has_location (phi
, i
))
2414 dump_location (buffer
, gimple_phi_arg_location (phi
, i
));
2415 basic_block src
= gimple_phi_arg_edge (phi
, i
)->src
;
2416 if (flags
& TDF_GIMPLE
)
2418 pp_string (buffer
, "__BB");
2419 pp_decimal_int (buffer
, src
->index
);
2420 pp_string (buffer
, ": ");
2422 dump_generic_node (buffer
, gimple_phi_arg_def (phi
, i
), spc
, flags
,
2424 if (! (flags
& TDF_GIMPLE
))
2426 pp_left_paren (buffer
);
2427 pp_decimal_int (buffer
, src
->index
);
2428 pp_right_paren (buffer
);
2430 if (i
< gimple_phi_num_args (phi
) - 1)
2431 pp_string (buffer
, ", ");
2433 if (flags
& TDF_GIMPLE
)
2434 pp_string (buffer
, ");");
2436 pp_greater (buffer
);
2440 /* Dump a GIMPLE_OMP_PARALLEL tuple on the pretty_printer BUFFER, SPC spaces
2441 of indent. FLAGS specifies details to show in the dump (see TDF_* in
2445 dump_gimple_omp_parallel (pretty_printer
*buffer
, const gomp_parallel
*gs
,
2446 int spc
, dump_flags_t flags
)
2448 if (flags
& TDF_RAW
)
2450 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
2451 gimple_omp_body (gs
));
2452 dump_omp_clauses (buffer
, gimple_omp_parallel_clauses (gs
), spc
, flags
);
2453 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T%n>",
2454 gimple_omp_parallel_child_fn (gs
),
2455 gimple_omp_parallel_data_arg (gs
));
2460 pp_string (buffer
, "#pragma omp parallel");
2461 dump_omp_clauses (buffer
, gimple_omp_parallel_clauses (gs
), spc
, flags
);
2462 if (gimple_omp_parallel_child_fn (gs
))
2464 pp_string (buffer
, " [child fn: ");
2465 dump_generic_node (buffer
, gimple_omp_parallel_child_fn (gs
),
2467 pp_string (buffer
, " (");
2468 if (gimple_omp_parallel_data_arg (gs
))
2469 dump_generic_node (buffer
, gimple_omp_parallel_data_arg (gs
),
2472 pp_string (buffer
, "???");
2473 pp_string (buffer
, ")]");
2475 body
= gimple_omp_body (gs
);
2476 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
2478 newline_and_indent (buffer
, spc
+ 2);
2479 pp_left_brace (buffer
);
2480 pp_newline (buffer
);
2481 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
2482 newline_and_indent (buffer
, spc
+ 2);
2483 pp_right_brace (buffer
);
2487 pp_newline (buffer
);
2488 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
2494 /* Dump a GIMPLE_OMP_TASK tuple on the pretty_printer BUFFER, SPC spaces
2495 of indent. FLAGS specifies details to show in the dump (see TDF_* in
2499 dump_gimple_omp_task (pretty_printer
*buffer
, const gomp_task
*gs
, int spc
,
2502 if (flags
& TDF_RAW
)
2504 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
2505 gimple_omp_body (gs
));
2506 dump_omp_clauses (buffer
, gimple_omp_task_clauses (gs
), spc
, flags
);
2507 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T, %T, %T, %T%n>",
2508 gimple_omp_task_child_fn (gs
),
2509 gimple_omp_task_data_arg (gs
),
2510 gimple_omp_task_copy_fn (gs
),
2511 gimple_omp_task_arg_size (gs
),
2512 gimple_omp_task_arg_size (gs
));
2517 if (gimple_omp_task_taskloop_p (gs
))
2518 pp_string (buffer
, "#pragma omp taskloop");
2519 else if (gimple_omp_task_taskwait_p (gs
))
2520 pp_string (buffer
, "#pragma omp taskwait");
2522 pp_string (buffer
, "#pragma omp task");
2523 dump_omp_clauses (buffer
, gimple_omp_task_clauses (gs
), spc
, flags
);
2524 if (gimple_omp_task_child_fn (gs
))
2526 pp_string (buffer
, " [child fn: ");
2527 dump_generic_node (buffer
, gimple_omp_task_child_fn (gs
),
2529 pp_string (buffer
, " (");
2530 if (gimple_omp_task_data_arg (gs
))
2531 dump_generic_node (buffer
, gimple_omp_task_data_arg (gs
),
2534 pp_string (buffer
, "???");
2535 pp_string (buffer
, ")]");
2537 body
= gimple_omp_body (gs
);
2538 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
2540 newline_and_indent (buffer
, spc
+ 2);
2541 pp_left_brace (buffer
);
2542 pp_newline (buffer
);
2543 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
2544 newline_and_indent (buffer
, spc
+ 2);
2545 pp_right_brace (buffer
);
2549 pp_newline (buffer
);
2550 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
2556 /* Dump a GIMPLE_OMP_ATOMIC_LOAD tuple on the pretty_printer BUFFER, SPC
2557 spaces of indent. FLAGS specifies details to show in the dump (see TDF_*
2561 dump_gimple_omp_atomic_load (pretty_printer
*buffer
, const gomp_atomic_load
*gs
,
2562 int spc
, dump_flags_t flags
)
2564 if (flags
& TDF_RAW
)
2566 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T>", gs
,
2567 gimple_omp_atomic_load_lhs (gs
),
2568 gimple_omp_atomic_load_rhs (gs
));
2572 pp_string (buffer
, "#pragma omp atomic_load");
2573 dump_omp_atomic_memory_order (buffer
,
2574 gimple_omp_atomic_memory_order (gs
));
2575 if (gimple_omp_atomic_need_value_p (gs
))
2576 pp_string (buffer
, " [needed]");
2577 if (gimple_omp_atomic_weak_p (gs
))
2578 pp_string (buffer
, " [weak]");
2579 newline_and_indent (buffer
, spc
+ 2);
2580 dump_generic_node (buffer
, gimple_omp_atomic_load_lhs (gs
),
2586 dump_generic_node (buffer
, gimple_omp_atomic_load_rhs (gs
),
2591 /* Dump a GIMPLE_OMP_ATOMIC_STORE tuple on the pretty_printer BUFFER, SPC
2592 spaces of indent. FLAGS specifies details to show in the dump (see TDF_*
2596 dump_gimple_omp_atomic_store (pretty_printer
*buffer
,
2597 const gomp_atomic_store
*gs
, int spc
,
2600 if (flags
& TDF_RAW
)
2602 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
,
2603 gimple_omp_atomic_store_val (gs
));
2607 pp_string (buffer
, "#pragma omp atomic_store");
2608 dump_omp_atomic_memory_order (buffer
,
2609 gimple_omp_atomic_memory_order (gs
));
2611 if (gimple_omp_atomic_need_value_p (gs
))
2612 pp_string (buffer
, "[needed] ");
2613 if (gimple_omp_atomic_weak_p (gs
))
2614 pp_string (buffer
, "[weak] ");
2615 pp_left_paren (buffer
);
2616 dump_generic_node (buffer
, gimple_omp_atomic_store_val (gs
),
2618 pp_right_paren (buffer
);
2623 /* Dump all the memory operands for statement GS. BUFFER, SPC and
2624 FLAGS are as in pp_gimple_stmt_1. */
2627 dump_gimple_mem_ops (pretty_printer
*buffer
, const gimple
*gs
, int spc
,
2630 tree vdef
= gimple_vdef (gs
);
2631 tree vuse
= gimple_vuse (gs
);
2633 if (vdef
!= NULL_TREE
)
2635 pp_string (buffer
, "# ");
2636 dump_generic_node (buffer
, vdef
, spc
+ 2, flags
, false);
2637 pp_string (buffer
, " = VDEF <");
2638 dump_generic_node (buffer
, vuse
, spc
+ 2, flags
, false);
2639 pp_greater (buffer
);
2640 newline_and_indent (buffer
, spc
);
2642 else if (vuse
!= NULL_TREE
)
2644 pp_string (buffer
, "# VUSE <");
2645 dump_generic_node (buffer
, vuse
, spc
+ 2, flags
, false);
2646 pp_greater (buffer
);
2647 newline_and_indent (buffer
, spc
);
2652 /* Print the gimple statement GS on the pretty printer BUFFER, SPC
2653 spaces of indent. FLAGS specifies details to show in the dump (see
2654 TDF_* in dumpfile.h). The caller is responsible for calling
2655 pp_flush on BUFFER to finalize the pretty printer. */
2658 pp_gimple_stmt_1 (pretty_printer
*buffer
, const gimple
*gs
, int spc
,
2664 if (flags
& TDF_STMTADDR
)
2665 pp_printf (buffer
, "<&%p> ", (const void *) gs
);
2667 if ((flags
& TDF_LINENO
) && gimple_has_location (gs
))
2668 dump_location (buffer
, gimple_location (gs
));
2672 int lp_nr
= lookup_stmt_eh_lp (gs
);
2674 pp_printf (buffer
, "[LP %d] ", lp_nr
);
2676 pp_printf (buffer
, "[MNT %d] ", -lp_nr
);
2679 if ((flags
& (TDF_VOPS
|TDF_MEMSYMS
))
2680 && gimple_has_mem_ops (gs
))
2681 dump_gimple_mem_ops (buffer
, gs
, spc
, flags
);
2683 if (gimple_has_lhs (gs
)
2684 && (flags
& TDF_ALIAS
))
2685 dump_ssaname_info (buffer
, gimple_get_lhs (gs
), spc
);
2687 switch (gimple_code (gs
))
2690 dump_gimple_asm (buffer
, as_a
<const gasm
*> (gs
), spc
, flags
);
2694 dump_gimple_assign (buffer
, as_a
<const gassign
*> (gs
), spc
, flags
);
2698 dump_gimple_bind (buffer
, as_a
<const gbind
*> (gs
), spc
, flags
);
2702 dump_gimple_call (buffer
, as_a
<const gcall
*> (gs
), spc
, flags
);
2706 dump_gimple_cond (buffer
, as_a
<const gcond
*> (gs
), spc
, flags
);
2710 dump_gimple_label (buffer
, as_a
<const glabel
*> (gs
), spc
, flags
);
2714 dump_gimple_goto (buffer
, as_a
<const ggoto
*> (gs
), spc
, flags
);
2718 pp_string (buffer
, "GIMPLE_NOP");
2722 dump_gimple_return (buffer
, as_a
<const greturn
*> (gs
), spc
, flags
);
2726 dump_gimple_switch (buffer
, as_a
<const gswitch
*> (gs
), spc
, flags
);
2730 dump_gimple_try (buffer
, as_a
<const gtry
*> (gs
), spc
, flags
);
2734 dump_gimple_phi (buffer
, as_a
<const gphi
*> (gs
), spc
, false, flags
);
2737 case GIMPLE_OMP_PARALLEL
:
2738 dump_gimple_omp_parallel (buffer
, as_a
<const gomp_parallel
*> (gs
), spc
,
2742 case GIMPLE_OMP_TASK
:
2743 dump_gimple_omp_task (buffer
, as_a
<const gomp_task
*> (gs
), spc
, flags
);
2746 case GIMPLE_OMP_ATOMIC_LOAD
:
2747 dump_gimple_omp_atomic_load (buffer
, as_a
<const gomp_atomic_load
*> (gs
),
2751 case GIMPLE_OMP_ATOMIC_STORE
:
2752 dump_gimple_omp_atomic_store (buffer
,
2753 as_a
<const gomp_atomic_store
*> (gs
),
2757 case GIMPLE_OMP_FOR
:
2758 dump_gimple_omp_for (buffer
, as_a
<const gomp_for
*> (gs
), spc
, flags
);
2761 case GIMPLE_OMP_CONTINUE
:
2762 dump_gimple_omp_continue (buffer
, as_a
<const gomp_continue
*> (gs
), spc
,
2766 case GIMPLE_OMP_SINGLE
:
2767 dump_gimple_omp_single (buffer
, as_a
<const gomp_single
*> (gs
), spc
,
2771 case GIMPLE_OMP_TARGET
:
2772 dump_gimple_omp_target (buffer
, as_a
<const gomp_target
*> (gs
), spc
,
2776 case GIMPLE_OMP_TEAMS
:
2777 dump_gimple_omp_teams (buffer
, as_a
<const gomp_teams
*> (gs
), spc
,
2781 case GIMPLE_OMP_RETURN
:
2782 dump_gimple_omp_return (buffer
, gs
, spc
, flags
);
2785 case GIMPLE_OMP_SECTIONS
:
2786 dump_gimple_omp_sections (buffer
, as_a
<const gomp_sections
*> (gs
),
2790 case GIMPLE_OMP_SECTIONS_SWITCH
:
2791 pp_string (buffer
, "GIMPLE_SECTIONS_SWITCH");
2794 case GIMPLE_OMP_TASKGROUP
:
2795 dump_gimple_omp_taskgroup (buffer
, gs
, spc
, flags
);
2798 case GIMPLE_OMP_MASKED
:
2799 dump_gimple_omp_masked (buffer
, gs
, spc
, flags
);
2802 case GIMPLE_OMP_SCOPE
:
2803 dump_gimple_omp_scope (buffer
, gs
, spc
, flags
);
2806 case GIMPLE_OMP_MASTER
:
2807 case GIMPLE_OMP_SECTION
:
2808 dump_gimple_omp_block (buffer
, gs
, spc
, flags
);
2811 case GIMPLE_OMP_ORDERED
:
2812 dump_gimple_omp_ordered (buffer
, as_a
<const gomp_ordered
*> (gs
), spc
,
2816 case GIMPLE_OMP_SCAN
:
2817 dump_gimple_omp_scan (buffer
, as_a
<const gomp_scan
*> (gs
), spc
,
2821 case GIMPLE_OMP_CRITICAL
:
2822 dump_gimple_omp_critical (buffer
, as_a
<const gomp_critical
*> (gs
), spc
,
2827 dump_gimple_catch (buffer
, as_a
<const gcatch
*> (gs
), spc
, flags
);
2830 case GIMPLE_EH_FILTER
:
2831 dump_gimple_eh_filter (buffer
, as_a
<const geh_filter
*> (gs
), spc
,
2835 case GIMPLE_EH_MUST_NOT_THROW
:
2836 dump_gimple_eh_must_not_throw (buffer
,
2837 as_a
<const geh_mnt
*> (gs
),
2841 case GIMPLE_EH_ELSE
:
2842 dump_gimple_eh_else (buffer
, as_a
<const geh_else
*> (gs
), spc
, flags
);
2846 dump_gimple_resx (buffer
, as_a
<const gresx
*> (gs
), spc
, flags
);
2849 case GIMPLE_EH_DISPATCH
:
2850 dump_gimple_eh_dispatch (buffer
, as_a
<const geh_dispatch
*> (gs
), spc
,
2855 dump_gimple_debug (buffer
, as_a
<const gdebug
*> (gs
), spc
, flags
);
2858 case GIMPLE_PREDICT
:
2859 pp_string (buffer
, "// predicted ");
2860 if (gimple_predict_outcome (gs
))
2861 pp_string (buffer
, "likely by ");
2863 pp_string (buffer
, "unlikely by ");
2864 pp_string (buffer
, predictor_name (gimple_predict_predictor (gs
)));
2865 pp_string (buffer
, " predictor.");
2869 dump_gimple_assume (buffer
, gs
, spc
, flags
);
2872 case GIMPLE_TRANSACTION
:
2873 dump_gimple_transaction (buffer
, as_a
<const gtransaction
*> (gs
), spc
,
2883 /* Dumps header of basic block BB to OUTF indented by INDENT
2884 spaces and details described by flags. */
2887 dump_gimple_bb_header (FILE *outf
, basic_block bb
, int indent
,
2890 if (flags
& TDF_BLOCKS
)
2892 if (flags
& TDF_LINENO
)
2894 gimple_stmt_iterator gsi
;
2896 fputs (";; ", outf
);
2898 for (gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
); gsi_next (&gsi
))
2899 if (!is_gimple_debug (gsi_stmt (gsi
))
2900 && get_lineno (gsi_stmt (gsi
)) != UNKNOWN_LOCATION
)
2902 fprintf (outf
, "%*sstarting at line %d",
2903 indent
, "", get_lineno (gsi_stmt (gsi
)));
2911 if (flags
& TDF_GIMPLE
)
2913 fprintf (outf
, "%*s__BB(%d", indent
, "", bb
->index
);
2914 if (bb
->loop_father
->header
== bb
)
2915 fprintf (outf
, ",loop_header(%d)", bb
->loop_father
->num
);
2916 if (bb
->count
.initialized_p ())
2917 fprintf (outf
, ",%s(%" PRIu64
")",
2918 profile_quality_as_string (bb
->count
.quality ()),
2919 bb
->count
.value ());
2920 fprintf (outf
, "):\n");
2923 fprintf (outf
, "%*s<bb %d> %s:\n",
2924 indent
, "", bb
->index
, dump_profile (bb
->count
));
2929 /* Dumps end of basic block BB to buffer BUFFER indented by INDENT
2933 dump_gimple_bb_footer (FILE *outf ATTRIBUTE_UNUSED
,
2934 basic_block bb ATTRIBUTE_UNUSED
,
2935 int indent ATTRIBUTE_UNUSED
,
2936 dump_flags_t flags ATTRIBUTE_UNUSED
)
2938 /* There is currently no GIMPLE-specific basic block info to dump. */
2943 /* Dump PHI nodes of basic block BB to BUFFER with details described
2944 by FLAGS and indented by INDENT spaces. */
2947 dump_phi_nodes (pretty_printer
*buffer
, basic_block bb
, int indent
,
2952 for (i
= gsi_start_phis (bb
); !gsi_end_p (i
); gsi_next (&i
))
2954 gphi
*phi
= i
.phi ();
2955 if (!virtual_operand_p (gimple_phi_result (phi
)) || (flags
& TDF_VOPS
))
2958 dump_gimple_phi (buffer
, phi
, indent
,
2959 (flags
& TDF_GIMPLE
) ? false : true, flags
);
2960 pp_newline (buffer
);
2966 /* Dump jump to basic block BB that is represented implicitly in the cfg
2970 pp_cfg_jump (pretty_printer
*buffer
, edge e
, dump_flags_t flags
)
2972 if (flags
& TDF_GIMPLE
)
2974 pp_string (buffer
, "goto __BB");
2975 pp_decimal_int (buffer
, e
->dest
->index
);
2976 if (e
->probability
.initialized_p ())
2978 pp_string (buffer
, "(");
2980 profile_quality_as_string (e
->probability
.quality ()));
2981 pp_string (buffer
, "(");
2982 pp_decimal_int (buffer
, e
->probability
.value ());
2983 pp_string (buffer
, "))");
2985 pp_semicolon (buffer
);
2989 pp_string (buffer
, "goto <bb ");
2990 pp_decimal_int (buffer
, e
->dest
->index
);
2991 pp_greater (buffer
);
2992 pp_semicolon (buffer
);
2994 dump_edge_probability (buffer
, e
);
2999 /* Dump edges represented implicitly in basic block BB to BUFFER, indented
3000 by INDENT spaces, with details given by FLAGS. */
3003 dump_implicit_edges (pretty_printer
*buffer
, basic_block bb
, int indent
,
3009 stmt
= last_stmt (bb
);
3011 if (stmt
&& gimple_code (stmt
) == GIMPLE_COND
)
3013 edge true_edge
, false_edge
;
3015 /* When we are emitting the code or changing CFG, it is possible that
3016 the edges are not yet created. When we are using debug_bb in such
3017 a situation, we do not want it to crash. */
3018 if (EDGE_COUNT (bb
->succs
) != 2)
3020 extract_true_false_edges_from_block (bb
, &true_edge
, &false_edge
);
3022 INDENT (indent
+ 2);
3023 pp_cfg_jump (buffer
, true_edge
, flags
);
3024 newline_and_indent (buffer
, indent
);
3025 pp_string (buffer
, "else");
3026 newline_and_indent (buffer
, indent
+ 2);
3027 pp_cfg_jump (buffer
, false_edge
, flags
);
3028 pp_newline (buffer
);
3032 /* If there is a fallthru edge, we may need to add an artificial
3033 goto to the dump. */
3034 e
= find_fallthru_edge (bb
->succs
);
3036 if (e
&& (e
->dest
!= bb
->next_bb
|| (flags
& TDF_GIMPLE
)))
3040 if ((flags
& TDF_LINENO
)
3041 && e
->goto_locus
!= UNKNOWN_LOCATION
)
3042 dump_location (buffer
, e
->goto_locus
);
3044 pp_cfg_jump (buffer
, e
, flags
);
3045 pp_newline (buffer
);
3050 /* Dumps basic block BB to buffer BUFFER with details described by FLAGS and
3051 indented by INDENT spaces. */
3054 gimple_dump_bb_buff (pretty_printer
*buffer
, basic_block bb
, int indent
,
3057 gimple_stmt_iterator gsi
;
3059 int label_indent
= indent
- 2;
3061 if (label_indent
< 0)
3064 dump_phi_nodes (buffer
, bb
, indent
, flags
);
3066 for (gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
); gsi_next (&gsi
))
3070 stmt
= gsi_stmt (gsi
);
3072 curr_indent
= gimple_code (stmt
) == GIMPLE_LABEL
? label_indent
: indent
;
3074 INDENT (curr_indent
);
3075 pp_gimple_stmt_1 (buffer
, stmt
, curr_indent
, flags
);
3076 pp_newline_and_flush (buffer
);
3077 gcc_checking_assert (DECL_STRUCT_FUNCTION (current_function_decl
));
3078 dump_histograms_for_stmt (DECL_STRUCT_FUNCTION (current_function_decl
),
3079 pp_buffer (buffer
)->stream
, stmt
);
3082 dump_implicit_edges (buffer
, bb
, indent
, flags
);
3087 /* Dumps basic block BB to FILE with details described by FLAGS and
3088 indented by INDENT spaces. */
3091 gimple_dump_bb (FILE *file
, basic_block bb
, int indent
, dump_flags_t flags
)
3093 dump_gimple_bb_header (file
, bb
, indent
, flags
);
3094 if (bb
->index
>= NUM_FIXED_BLOCKS
)
3096 pretty_printer buffer
;
3097 pp_needs_newline (&buffer
) = true;
3098 buffer
.buffer
->stream
= file
;
3099 gimple_dump_bb_buff (&buffer
, bb
, indent
, flags
);
3101 dump_gimple_bb_footer (file
, bb
, indent
, flags
);
3104 /* Dumps basic block BB to pretty-printer PP with default dump flags and
3105 no indentation, for use as a label of a DOT graph record-node.
3106 ??? Should just use gimple_dump_bb_buff here, except that value profiling
3107 histogram dumping doesn't know about pretty-printers. */
3110 gimple_dump_bb_for_graph (pretty_printer
*pp
, basic_block bb
)
3112 pp_printf (pp
, "<bb %d>:\n", bb
->index
);
3113 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
3115 for (gphi_iterator gsi
= gsi_start_phis (bb
); !gsi_end_p (gsi
);
3118 gphi
*phi
= gsi
.phi ();
3119 if (!virtual_operand_p (gimple_phi_result (phi
))
3120 || (dump_flags
& TDF_VOPS
))
3123 pp_write_text_to_stream (pp
);
3124 pp_string (pp
, "# ");
3125 pp_gimple_stmt_1 (pp
, phi
, 0, dump_flags
);
3127 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
3131 for (gimple_stmt_iterator gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
);
3134 gimple
*stmt
= gsi_stmt (gsi
);
3136 pp_write_text_to_stream (pp
);
3137 pp_gimple_stmt_1 (pp
, stmt
, 0, dump_flags
);
3139 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
3141 dump_implicit_edges (pp
, bb
, 0, dump_flags
);
3142 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
3146 # pragma GCC diagnostic pop