1 /* Pretty formatting of GIMPLE statements and expressions.
2 Copyright (C) 2001-2024 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_SERIES_EXPR
:
463 for (p
= get_tree_code_name (code
); *p
; p
++)
464 pp_character (buffer
, TOUPPER (*p
));
465 pp_string (buffer
, " <");
466 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
467 pp_string (buffer
, ", ");
468 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
473 if (op_prio (gimple_assign_rhs1 (gs
)) <= op_code_prio (code
))
475 pp_left_paren (buffer
);
476 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
,
478 pp_right_paren (buffer
);
481 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
483 pp_string (buffer
, op_symbol_code (gimple_assign_rhs_code (gs
), flags
));
485 if (op_prio (gimple_assign_rhs2 (gs
)) <= op_code_prio (code
))
487 pp_left_paren (buffer
);
488 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
,
490 pp_right_paren (buffer
);
493 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
497 /* Helper for dump_gimple_assign. Print the ternary RHS of the
498 assignment GS. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. */
501 dump_ternary_rhs (pretty_printer
*buffer
, const gassign
*gs
, int spc
,
505 enum tree_code code
= gimple_assign_rhs_code (gs
);
508 case WIDEN_MULT_PLUS_EXPR
:
509 case WIDEN_MULT_MINUS_EXPR
:
510 for (p
= get_tree_code_name (code
); *p
; p
++)
511 pp_character (buffer
, TOUPPER (*p
));
512 pp_string (buffer
, " <");
513 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
514 pp_string (buffer
, ", ");
515 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
516 pp_string (buffer
, ", ");
517 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
522 pp_string (buffer
, "DOT_PROD_EXPR <");
523 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
524 pp_string (buffer
, ", ");
525 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
526 pp_string (buffer
, ", ");
527 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
532 pp_string (buffer
, "SAD_EXPR <");
533 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
534 pp_string (buffer
, ", ");
535 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
536 pp_string (buffer
, ", ");
537 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
542 if (flags
& TDF_GIMPLE
)
543 pp_string (buffer
, "__VEC_PERM (");
545 pp_string (buffer
, "VEC_PERM_EXPR <");
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);
551 if (flags
& TDF_GIMPLE
)
552 pp_right_paren (buffer
);
557 case REALIGN_LOAD_EXPR
:
558 pp_string (buffer
, "REALIGN_LOAD <");
559 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
560 pp_string (buffer
, ", ");
561 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
562 pp_string (buffer
, ", ");
563 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
568 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
569 pp_string (buffer
, " ? ");
570 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
571 pp_string (buffer
, " : ");
572 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
576 pp_string (buffer
, "VEC_COND_EXPR <");
577 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
578 pp_string (buffer
, ", ");
579 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
580 pp_string (buffer
, ", ");
581 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
585 case BIT_INSERT_EXPR
:
586 if (flags
& TDF_GIMPLE
)
588 pp_string (buffer
, "__BIT_INSERT (");
589 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
,
590 flags
| TDF_SLIM
, false);
591 pp_string (buffer
, ", ");
592 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
,
593 flags
| TDF_SLIM
, false);
594 pp_string (buffer
, ", ");
595 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
,
596 flags
| TDF_SLIM
, false);
597 pp_right_paren (buffer
);
601 pp_string (buffer
, "BIT_INSERT_EXPR <");
602 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
),
604 pp_string (buffer
, ", ");
605 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
),
607 pp_string (buffer
, ", ");
608 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
),
610 if (INTEGRAL_TYPE_P (TREE_TYPE (gimple_assign_rhs2 (gs
))))
612 pp_string (buffer
, " (");
613 pp_decimal_int (buffer
, TYPE_PRECISION
614 (TREE_TYPE (gimple_assign_rhs2 (gs
))));
615 pp_string (buffer
, " bits)");
627 /* Dump the gimple assignment GS. BUFFER, SPC and FLAGS are as in
631 dump_gimple_assign (pretty_printer
*buffer
, const gassign
*gs
, int spc
,
639 switch (gimple_num_ops (gs
))
642 arg3
= gimple_assign_rhs3 (gs
);
645 arg2
= gimple_assign_rhs2 (gs
);
648 arg1
= gimple_assign_rhs1 (gs
);
654 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%s, %T, %T, %T, %T>", gs
,
655 get_tree_code_name (gimple_assign_rhs_code (gs
)),
656 gimple_assign_lhs (gs
), arg1
, arg2
, arg3
);
660 if (!(flags
& TDF_RHS_ONLY
))
662 dump_generic_node (buffer
, gimple_assign_lhs (gs
), spc
, flags
, false);
666 if (gimple_assign_nontemporal_move_p (gs
))
667 pp_string (buffer
, "{nt}");
669 if (gimple_has_volatile_ops (gs
))
670 pp_string (buffer
, "{v}");
675 if (gimple_num_ops (gs
) == 2)
676 dump_unary_rhs (buffer
, gs
, spc
,
677 ((flags
& TDF_GIMPLE
)
678 && gimple_assign_rhs_class (gs
) != GIMPLE_SINGLE_RHS
)
679 ? (flags
| TDF_GIMPLE_VAL
) : flags
);
680 else if (gimple_num_ops (gs
) == 3)
681 dump_binary_rhs (buffer
, gs
, spc
,
683 ? (flags
| TDF_GIMPLE_VAL
) : flags
);
684 else if (gimple_num_ops (gs
) == 4)
685 dump_ternary_rhs (buffer
, gs
, spc
,
687 ? (flags
| TDF_GIMPLE_VAL
) : flags
);
690 if (!(flags
& TDF_RHS_ONLY
))
691 pp_semicolon (buffer
);
696 /* Dump the return statement GS. BUFFER, SPC and FLAGS are as in
700 dump_gimple_return (pretty_printer
*buffer
, const greturn
*gs
, int spc
,
705 t
= gimple_return_retval (gs
);
707 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
, t
);
710 pp_string (buffer
, "return");
714 dump_generic_node (buffer
, t
, spc
, flags
, false);
716 pp_semicolon (buffer
);
721 /* Dump the call arguments for a gimple call. BUFFER, FLAGS are as in
725 dump_gimple_call_args (pretty_printer
*buffer
, const gcall
*gs
,
730 /* Pretty print first arg to certain internal fns. */
731 if (gimple_call_internal_p (gs
))
733 const char *const *enums
= NULL
;
736 switch (gimple_call_internal_fn (gs
))
740 static const char *const unique_args
[] = {IFN_UNIQUE_CODES
};
744 limit
= ARRAY_SIZE (unique_args
);
749 static const char *const loop_args
[] = {IFN_GOACC_LOOP_CODES
};
752 limit
= ARRAY_SIZE (loop_args
);
755 case IFN_GOACC_REDUCTION
:
757 static const char *const reduction_args
[]
758 = {IFN_GOACC_REDUCTION_CODES
};
760 enums
= reduction_args
;
761 limit
= ARRAY_SIZE (reduction_args
);
764 case IFN_HWASAN_MARK
:
767 static const char *const asan_mark_args
[] = {IFN_ASAN_MARK_FLAGS
};
769 enums
= asan_mark_args
;
770 limit
= ARRAY_SIZE (asan_mark_args
);
778 tree arg0
= gimple_call_arg (gs
, 0);
781 if (TREE_CODE (arg0
) == INTEGER_CST
782 && tree_fits_shwi_p (arg0
)
783 && (v
= tree_to_shwi (arg0
)) >= 0 && v
< limit
)
786 pp_string (buffer
, enums
[v
]);
791 for (; i
< gimple_call_num_args (gs
); i
++)
794 pp_string (buffer
, ", ");
795 dump_generic_node (buffer
, gimple_call_arg (gs
, i
), 0, flags
, false);
798 if (gimple_call_va_arg_pack_p (gs
))
801 pp_string (buffer
, ", ");
803 pp_string (buffer
, "__builtin_va_arg_pack ()");
807 /* Dump the points-to solution *PT to BUFFER. */
810 pp_points_to_solution (pretty_printer
*buffer
, const pt_solution
*pt
)
814 pp_string (buffer
, "anything ");
818 pp_string (buffer
, "nonlocal ");
820 pp_string (buffer
, "escaped ");
822 pp_string (buffer
, "unit-escaped ");
824 pp_string (buffer
, "null ");
826 && !bitmap_empty_p (pt
->vars
))
830 pp_string (buffer
, "{ ");
831 EXECUTE_IF_SET_IN_BITMAP (pt
->vars
, 0, i
, bi
)
833 pp_string (buffer
, "D.");
834 pp_decimal_int (buffer
, i
);
837 pp_right_brace (buffer
);
838 if (pt
->vars_contains_nonlocal
839 || pt
->vars_contains_escaped
840 || pt
->vars_contains_escaped_heap
841 || pt
->vars_contains_restrict
)
843 const char *comma
= "";
844 pp_string (buffer
, " (");
845 if (pt
->vars_contains_nonlocal
)
847 pp_string (buffer
, "nonlocal");
850 if (pt
->vars_contains_escaped
)
852 pp_string (buffer
, comma
);
853 pp_string (buffer
, "escaped");
856 if (pt
->vars_contains_escaped_heap
)
858 pp_string (buffer
, comma
);
859 pp_string (buffer
, "escaped heap");
862 if (pt
->vars_contains_restrict
)
864 pp_string (buffer
, comma
);
865 pp_string (buffer
, "restrict");
868 if (pt
->vars_contains_interposable
)
870 pp_string (buffer
, comma
);
871 pp_string (buffer
, "interposable");
873 pp_string (buffer
, ")");
879 /* Dump the call statement GS. BUFFER, SPC and FLAGS are as in
883 dump_gimple_call (pretty_printer
*buffer
, const gcall
*gs
, int spc
,
886 tree lhs
= gimple_call_lhs (gs
);
887 tree fn
= gimple_call_fn (gs
);
889 if (flags
& TDF_ALIAS
)
891 const pt_solution
*pt
;
892 pt
= gimple_call_use_set (gs
);
893 if (!pt_solution_empty_p (pt
))
895 pp_string (buffer
, "# USE = ");
896 pp_points_to_solution (buffer
, pt
);
897 newline_and_indent (buffer
, spc
);
899 pt
= gimple_call_clobber_set (gs
);
900 if (!pt_solution_empty_p (pt
))
902 pp_string (buffer
, "# CLB = ");
903 pp_points_to_solution (buffer
, pt
);
904 newline_and_indent (buffer
, spc
);
910 if (gimple_call_internal_p (gs
))
911 dump_gimple_fmt (buffer
, spc
, flags
, "%G <.%s, %T", gs
,
912 internal_fn_name (gimple_call_internal_fn (gs
)), lhs
);
914 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T", gs
, fn
, lhs
);
915 if (gimple_call_num_args (gs
) > 0)
917 pp_string (buffer
, ", ");
918 dump_gimple_call_args (buffer
, gs
, flags
);
924 if (lhs
&& !(flags
& TDF_RHS_ONLY
))
926 dump_generic_node (buffer
, lhs
, spc
, flags
, false);
927 pp_string (buffer
, " =");
929 if (gimple_has_volatile_ops (gs
))
930 pp_string (buffer
, "{v}");
934 if (gimple_call_internal_p (gs
))
937 pp_string (buffer
, internal_fn_name (gimple_call_internal_fn (gs
)));
940 print_call_name (buffer
, fn
, flags
);
941 pp_string (buffer
, " (");
942 dump_gimple_call_args (buffer
, gs
, flags
);
943 pp_right_paren (buffer
);
944 if (!(flags
& TDF_RHS_ONLY
))
945 pp_semicolon (buffer
);
948 if (gimple_call_chain (gs
))
950 pp_string (buffer
, " [static-chain: ");
951 dump_generic_node (buffer
, gimple_call_chain (gs
), spc
, flags
, false);
952 pp_right_bracket (buffer
);
955 if (gimple_call_return_slot_opt_p (gs
))
956 pp_string (buffer
, " [return slot optimization]");
957 if (gimple_call_tail_p (gs
))
958 pp_string (buffer
, " [tail call]");
959 if (gimple_call_must_tail_p (gs
))
960 pp_string (buffer
, " [must tail call]");
965 /* Dump the arguments of _ITM_beginTransaction sanely. */
966 if (TREE_CODE (fn
) == ADDR_EXPR
)
967 fn
= TREE_OPERAND (fn
, 0);
968 if (TREE_CODE (fn
) == FUNCTION_DECL
&& decl_is_tm_clone (fn
))
969 pp_string (buffer
, " [tm-clone]");
970 if (TREE_CODE (fn
) == FUNCTION_DECL
971 && fndecl_built_in_p (fn
, BUILT_IN_TM_START
)
972 && gimple_call_num_args (gs
) > 0)
974 tree t
= gimple_call_arg (gs
, 0);
975 unsigned HOST_WIDE_INT props
;
976 gcc_assert (TREE_CODE (t
) == INTEGER_CST
);
978 pp_string (buffer
, " [ ");
980 /* Get the transaction code properties. */
981 props
= TREE_INT_CST_LOW (t
);
983 if (props
& PR_INSTRUMENTEDCODE
)
984 pp_string (buffer
, "instrumentedCode ");
985 if (props
& PR_UNINSTRUMENTEDCODE
)
986 pp_string (buffer
, "uninstrumentedCode ");
987 if (props
& PR_HASNOXMMUPDATE
)
988 pp_string (buffer
, "hasNoXMMUpdate ");
989 if (props
& PR_HASNOABORT
)
990 pp_string (buffer
, "hasNoAbort ");
991 if (props
& PR_HASNOIRREVOCABLE
)
992 pp_string (buffer
, "hasNoIrrevocable ");
993 if (props
& PR_DOESGOIRREVOCABLE
)
994 pp_string (buffer
, "doesGoIrrevocable ");
995 if (props
& PR_HASNOSIMPLEREADS
)
996 pp_string (buffer
, "hasNoSimpleReads ");
997 if (props
& PR_AWBARRIERSOMITTED
)
998 pp_string (buffer
, "awBarriersOmitted ");
999 if (props
& PR_RARBARRIERSOMITTED
)
1000 pp_string (buffer
, "RaRBarriersOmitted ");
1001 if (props
& PR_UNDOLOGCODE
)
1002 pp_string (buffer
, "undoLogCode ");
1003 if (props
& PR_PREFERUNINSTRUMENTED
)
1004 pp_string (buffer
, "preferUninstrumented ");
1005 if (props
& PR_EXCEPTIONBLOCK
)
1006 pp_string (buffer
, "exceptionBlock ");
1007 if (props
& PR_HASELSE
)
1008 pp_string (buffer
, "hasElse ");
1009 if (props
& PR_READONLY
)
1010 pp_string (buffer
, "readOnly ");
1012 pp_right_bracket (buffer
);
1017 /* Dump the switch statement GS. BUFFER, SPC and FLAGS are as in
1018 pp_gimple_stmt_1. */
1021 dump_gimple_switch (pretty_printer
*buffer
, const gswitch
*gs
, int spc
,
1026 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
1027 if (flags
& TDF_RAW
)
1028 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, ", gs
,
1029 gimple_switch_index (gs
));
1032 pp_string (buffer
, "switch (");
1033 dump_generic_node (buffer
, gimple_switch_index (gs
), spc
, flags
, true);
1034 if (flags
& TDF_GIMPLE
)
1035 pp_string (buffer
, ") {");
1037 pp_string (buffer
, ") <");
1040 for (i
= 0; i
< gimple_switch_num_labels (gs
); i
++)
1042 tree case_label
= gimple_switch_label (gs
, i
);
1043 gcc_checking_assert (case_label
!= NULL_TREE
);
1044 dump_generic_node (buffer
, case_label
, spc
, flags
, false);
1046 tree label
= CASE_LABEL (case_label
);
1047 dump_generic_node (buffer
, label
, spc
, flags
, false);
1049 if (cfun
&& cfun
->cfg
)
1051 basic_block dest
= label_to_block (cfun
, label
);
1054 edge label_edge
= find_edge (gimple_bb (gs
), dest
);
1055 if (label_edge
&& !(flags
& TDF_GIMPLE
))
1056 dump_edge_probability (buffer
, label_edge
);
1060 if (i
< gimple_switch_num_labels (gs
) - 1)
1062 if (flags
& TDF_GIMPLE
)
1063 pp_string (buffer
, "; ");
1065 pp_string (buffer
, ", ");
1068 if (flags
& TDF_GIMPLE
)
1069 pp_string (buffer
, "; }");
1071 pp_greater (buffer
);
1075 /* Dump the gimple conditional GS. BUFFER, SPC and FLAGS are as in
1076 pp_gimple_stmt_1. */
1079 dump_gimple_cond (pretty_printer
*buffer
, const gcond
*gs
, int spc
,
1082 if (flags
& TDF_RAW
)
1083 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%s, %T, %T, %T, %T>", gs
,
1084 get_tree_code_name (gimple_cond_code (gs
)),
1085 gimple_cond_lhs (gs
), gimple_cond_rhs (gs
),
1086 gimple_cond_true_label (gs
), gimple_cond_false_label (gs
));
1089 if (!(flags
& TDF_RHS_ONLY
))
1090 pp_string (buffer
, "if (");
1091 dump_generic_node (buffer
, gimple_cond_lhs (gs
), spc
,
1092 flags
| ((flags
& TDF_GIMPLE
) ? TDF_GIMPLE_VAL
: TDF_NONE
),
1095 pp_string (buffer
, op_symbol_code (gimple_cond_code (gs
), flags
));
1097 dump_generic_node (buffer
, gimple_cond_rhs (gs
), spc
,
1098 flags
| ((flags
& TDF_GIMPLE
) ? TDF_GIMPLE_VAL
: TDF_NONE
),
1100 if (!(flags
& TDF_RHS_ONLY
))
1103 edge e
, true_edge
= NULL
, false_edge
= NULL
;
1104 basic_block bb
= gimple_bb (gs
);
1108 FOR_EACH_EDGE (e
, ei
, bb
->succs
)
1110 if (e
->flags
& EDGE_TRUE_VALUE
)
1112 else if (e
->flags
& EDGE_FALSE_VALUE
)
1117 bool has_edge_info
= true_edge
!= NULL
&& false_edge
!= NULL
;
1119 pp_right_paren (buffer
);
1121 if (gimple_cond_true_label (gs
))
1123 pp_string (buffer
, " goto ");
1124 dump_generic_node (buffer
, gimple_cond_true_label (gs
),
1126 if (has_edge_info
&& !(flags
& TDF_GIMPLE
))
1127 dump_edge_probability (buffer
, true_edge
);
1128 pp_semicolon (buffer
);
1130 if (gimple_cond_false_label (gs
))
1132 pp_string (buffer
, " else goto ");
1133 dump_generic_node (buffer
, gimple_cond_false_label (gs
),
1135 if (has_edge_info
&& !(flags
& TDF_GIMPLE
))
1136 dump_edge_probability (buffer
, false_edge
);
1138 pp_semicolon (buffer
);
1145 /* Dump a GIMPLE_LABEL tuple on the pretty_printer BUFFER, SPC
1146 spaces of indent. FLAGS specifies details to show in the dump (see
1147 TDF_* in dumpfils.h). */
1150 dump_gimple_label (pretty_printer
*buffer
, const glabel
*gs
, int spc
,
1153 tree label
= gimple_label_label (gs
);
1154 if (flags
& TDF_RAW
)
1155 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
, label
);
1158 dump_generic_node (buffer
, label
, spc
, flags
, false);
1161 if (flags
& TDF_GIMPLE
)
1163 if (DECL_NONLOCAL (label
))
1164 pp_string (buffer
, " [non-local]");
1165 if ((flags
& TDF_EH
) && EH_LANDING_PAD_NR (label
))
1166 pp_printf (buffer
, " [LP %d]", EH_LANDING_PAD_NR (label
));
1169 /* Dump a GIMPLE_GOTO tuple on the pretty_printer BUFFER, SPC
1170 spaces of indent. FLAGS specifies details to show in the dump (see
1171 TDF_* in dumpfile.h). */
1174 dump_gimple_goto (pretty_printer
*buffer
, const ggoto
*gs
, int spc
,
1177 tree label
= gimple_goto_dest (gs
);
1178 if (flags
& TDF_RAW
)
1179 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
, label
);
1181 dump_gimple_fmt (buffer
, spc
, flags
, "goto %T;", label
);
1185 /* Dump a GIMPLE_BIND tuple on the pretty_printer BUFFER, SPC
1186 spaces of indent. FLAGS specifies details to show in the dump (see
1187 TDF_* in dumpfile.h). */
1190 dump_gimple_bind (pretty_printer
*buffer
, const gbind
*gs
, int spc
,
1193 if (flags
& TDF_RAW
)
1194 dump_gimple_fmt (buffer
, spc
, flags
, "%G <", gs
);
1196 pp_left_brace (buffer
);
1197 if (!(flags
& TDF_SLIM
))
1201 for (var
= gimple_bind_vars (gs
); var
; var
= DECL_CHAIN (var
))
1203 newline_and_indent (buffer
, 2);
1204 print_declaration (buffer
, var
, spc
, flags
);
1206 if (gimple_bind_vars (gs
))
1207 pp_newline (buffer
);
1209 pp_newline (buffer
);
1210 dump_gimple_seq (buffer
, gimple_bind_body (gs
), spc
+ 2, flags
);
1211 newline_and_indent (buffer
, spc
);
1212 if (flags
& TDF_RAW
)
1213 pp_greater (buffer
);
1215 pp_right_brace (buffer
);
1219 /* Dump a GIMPLE_TRY tuple on the pretty_printer BUFFER, SPC spaces of
1220 indent. FLAGS specifies details to show in the dump (see TDF_* in
1224 dump_gimple_try (pretty_printer
*buffer
, const gtry
*gs
, int spc
,
1227 if (flags
& TDF_RAW
)
1230 if (gimple_try_kind (gs
) == GIMPLE_TRY_CATCH
)
1231 type
= "GIMPLE_TRY_CATCH";
1232 else if (gimple_try_kind (gs
) == GIMPLE_TRY_FINALLY
)
1233 type
= "GIMPLE_TRY_FINALLY";
1235 type
= "UNKNOWN GIMPLE_TRY";
1236 dump_gimple_fmt (buffer
, spc
, flags
,
1237 "%G <%s,%+EVAL <%S>%nCLEANUP <%S>%->", gs
, type
,
1238 gimple_try_eval (gs
), gimple_try_cleanup (gs
));
1242 pp_string (buffer
, "try");
1243 newline_and_indent (buffer
, spc
+ 2);
1244 pp_left_brace (buffer
);
1245 pp_newline (buffer
);
1247 dump_gimple_seq (buffer
, gimple_try_eval (gs
), spc
+ 4, flags
);
1248 newline_and_indent (buffer
, spc
+ 2);
1249 pp_right_brace (buffer
);
1251 gimple_seq seq
= gimple_try_cleanup (gs
);
1253 if (gimple_try_kind (gs
) == GIMPLE_TRY_CATCH
)
1255 newline_and_indent (buffer
, spc
);
1256 pp_string (buffer
, "catch");
1257 newline_and_indent (buffer
, spc
+ 2);
1258 pp_left_brace (buffer
);
1260 else if (gimple_try_kind (gs
) == GIMPLE_TRY_FINALLY
)
1262 newline_and_indent (buffer
, spc
);
1263 pp_string (buffer
, "finally");
1264 newline_and_indent (buffer
, spc
+ 2);
1265 pp_left_brace (buffer
);
1267 if (seq
&& is_a
<geh_else
*> (gimple_seq_first_stmt (seq
))
1268 && gimple_seq_nondebug_singleton_p (seq
))
1270 geh_else
*stmt
= as_a
<geh_else
*> (gimple_seq_first_stmt (seq
));
1271 seq
= gimple_eh_else_n_body (stmt
);
1272 pp_newline (buffer
);
1273 dump_gimple_seq (buffer
, seq
, spc
+ 4, flags
);
1274 newline_and_indent (buffer
, spc
+ 2);
1275 pp_right_brace (buffer
);
1276 seq
= gimple_eh_else_e_body (stmt
);
1277 newline_and_indent (buffer
, spc
);
1278 pp_string (buffer
, "else");
1279 newline_and_indent (buffer
, spc
+ 2);
1280 pp_left_brace (buffer
);
1284 pp_string (buffer
, " <UNKNOWN GIMPLE_TRY> {");
1286 pp_newline (buffer
);
1287 dump_gimple_seq (buffer
, seq
, spc
+ 4, flags
);
1288 newline_and_indent (buffer
, spc
+ 2);
1289 pp_right_brace (buffer
);
1294 /* Dump a GIMPLE_CATCH tuple on the pretty_printer BUFFER, SPC spaces of
1295 indent. FLAGS specifies details to show in the dump (see TDF_* in
1299 dump_gimple_catch (pretty_printer
*buffer
, const gcatch
*gs
, int spc
,
1302 if (flags
& TDF_RAW
)
1303 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %+CATCH <%S>%->", gs
,
1304 gimple_catch_types (gs
), gimple_catch_handler (gs
));
1306 dump_gimple_fmt (buffer
, spc
, flags
, "catch (%T)%+{%S}",
1307 gimple_catch_types (gs
), gimple_catch_handler (gs
));
1311 /* Dump a GIMPLE_EH_FILTER tuple on the pretty_printer BUFFER, SPC spaces of
1312 indent. FLAGS specifies details to show in the dump (see TDF_* in
1316 dump_gimple_eh_filter (pretty_printer
*buffer
, const geh_filter
*gs
, int spc
,
1319 if (flags
& TDF_RAW
)
1320 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %+FAILURE <%S>%->", gs
,
1321 gimple_eh_filter_types (gs
),
1322 gimple_eh_filter_failure (gs
));
1324 dump_gimple_fmt (buffer
, spc
, flags
, "<<<eh_filter (%T)>>>%+{%+%S%-}",
1325 gimple_eh_filter_types (gs
),
1326 gimple_eh_filter_failure (gs
));
1330 /* Dump a GIMPLE_EH_MUST_NOT_THROW tuple. */
1333 dump_gimple_eh_must_not_throw (pretty_printer
*buffer
,
1334 const geh_mnt
*gs
, int spc
, dump_flags_t flags
)
1336 if (flags
& TDF_RAW
)
1337 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
,
1338 gimple_eh_must_not_throw_fndecl (gs
));
1340 dump_gimple_fmt (buffer
, spc
, flags
, "<<<eh_must_not_throw (%T)>>>",
1341 gimple_eh_must_not_throw_fndecl (gs
));
1345 /* Dump a GIMPLE_EH_ELSE tuple on the pretty_printer BUFFER, SPC spaces of
1346 indent. FLAGS specifies details to show in the dump (see TDF_* in
1350 dump_gimple_eh_else (pretty_printer
*buffer
, const geh_else
*gs
, int spc
,
1353 if (flags
& TDF_RAW
)
1354 dump_gimple_fmt (buffer
, spc
, flags
,
1355 "%G <%+N_BODY <%S>%nE_BODY <%S>%->", gs
,
1356 gimple_eh_else_n_body (gs
), gimple_eh_else_e_body (gs
));
1358 dump_gimple_fmt (buffer
, spc
, flags
,
1359 "<<<if_normal_exit>>>%+{%S}%-<<<else_eh_exit>>>%+{%S}",
1360 gimple_eh_else_n_body (gs
), gimple_eh_else_e_body (gs
));
1364 /* Dump a GIMPLE_RESX tuple on the pretty_printer BUFFER, SPC spaces of
1365 indent. FLAGS specifies details to show in the dump (see TDF_* in
1369 dump_gimple_resx (pretty_printer
*buffer
, const gresx
*gs
, int spc
,
1372 if (flags
& TDF_RAW
)
1373 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%d>", gs
,
1374 gimple_resx_region (gs
));
1376 dump_gimple_fmt (buffer
, spc
, flags
, "resx %d", gimple_resx_region (gs
));
1379 /* Dump a GIMPLE_EH_DISPATCH tuple on the pretty_printer BUFFER. */
1382 dump_gimple_eh_dispatch (pretty_printer
*buffer
, const geh_dispatch
*gs
,
1383 int spc
, dump_flags_t flags
)
1385 if (flags
& TDF_RAW
)
1386 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%d>", gs
,
1387 gimple_eh_dispatch_region (gs
));
1389 dump_gimple_fmt (buffer
, spc
, flags
, "eh_dispatch %d",
1390 gimple_eh_dispatch_region (gs
));
1393 /* Dump a GIMPLE_DEBUG tuple on the pretty_printer BUFFER, SPC spaces
1394 of indent. FLAGS specifies details to show in the dump (see TDF_*
1398 dump_gimple_debug (pretty_printer
*buffer
, const gdebug
*gs
, int spc
,
1401 switch (gs
->subcode
)
1403 case GIMPLE_DEBUG_BIND
:
1404 if (flags
& TDF_RAW
)
1405 dump_gimple_fmt (buffer
, spc
, flags
, "%G BIND <%T, %T>", gs
,
1406 gimple_debug_bind_get_var (gs
),
1407 gimple_debug_bind_get_value (gs
));
1409 dump_gimple_fmt (buffer
, spc
, flags
, "# DEBUG %T => %T",
1410 gimple_debug_bind_get_var (gs
),
1411 gimple_debug_bind_get_value (gs
));
1414 case GIMPLE_DEBUG_SOURCE_BIND
:
1415 if (flags
& TDF_RAW
)
1416 dump_gimple_fmt (buffer
, spc
, flags
, "%G SRCBIND <%T, %T>", gs
,
1417 gimple_debug_source_bind_get_var (gs
),
1418 gimple_debug_source_bind_get_value (gs
));
1420 dump_gimple_fmt (buffer
, spc
, flags
, "# DEBUG %T s=> %T",
1421 gimple_debug_source_bind_get_var (gs
),
1422 gimple_debug_source_bind_get_value (gs
));
1425 case GIMPLE_DEBUG_BEGIN_STMT
:
1426 if (flags
& TDF_RAW
)
1427 dump_gimple_fmt (buffer
, spc
, flags
, "%G BEGIN_STMT", gs
);
1429 dump_gimple_fmt (buffer
, spc
, flags
, "# DEBUG BEGIN_STMT");
1432 case GIMPLE_DEBUG_INLINE_ENTRY
:
1433 if (flags
& TDF_RAW
)
1434 dump_gimple_fmt (buffer
, spc
, flags
, "%G INLINE_ENTRY %T", gs
,
1436 ? block_ultimate_origin (gimple_block (gs
))
1439 dump_gimple_fmt (buffer
, spc
, flags
, "# DEBUG INLINE_ENTRY %T",
1441 ? block_ultimate_origin (gimple_block (gs
))
1450 /* Dump a GIMPLE_OMP_FOR tuple on the pretty_printer BUFFER. */
1452 dump_gimple_omp_for (pretty_printer
*buffer
, const gomp_for
*gs
, int spc
,
1457 if (flags
& TDF_RAW
)
1460 switch (gimple_omp_for_kind (gs
))
1462 case GF_OMP_FOR_KIND_FOR
:
1465 case GF_OMP_FOR_KIND_DISTRIBUTE
:
1466 kind
= " distribute";
1468 case GF_OMP_FOR_KIND_TASKLOOP
:
1471 case GF_OMP_FOR_KIND_OACC_LOOP
:
1472 kind
= " oacc_loop";
1474 case GF_OMP_FOR_KIND_SIMD
:
1480 dump_gimple_fmt (buffer
, spc
, flags
, "%G%s <%+BODY <%S>%nCLAUSES <", gs
,
1481 kind
, gimple_omp_body (gs
));
1482 dump_omp_clauses (buffer
, gimple_omp_for_clauses (gs
), spc
, flags
);
1483 dump_gimple_fmt (buffer
, spc
, flags
, " >,");
1484 for (i
= 0; i
< gimple_omp_for_collapse (gs
); i
++)
1485 dump_gimple_fmt (buffer
, spc
, flags
,
1486 "%+%T, %T, %T, %s, %T,%n",
1487 gimple_omp_for_index (gs
, i
),
1488 gimple_omp_for_initial (gs
, i
),
1489 gimple_omp_for_final (gs
, i
),
1490 get_tree_code_name (gimple_omp_for_cond (gs
, i
)),
1491 gimple_omp_for_incr (gs
, i
));
1492 dump_gimple_fmt (buffer
, spc
, flags
, "PRE_BODY <%S>%->",
1493 gimple_omp_for_pre_body (gs
));
1497 switch (gimple_omp_for_kind (gs
))
1499 case GF_OMP_FOR_KIND_FOR
:
1500 pp_string (buffer
, "#pragma omp for");
1502 case GF_OMP_FOR_KIND_DISTRIBUTE
:
1503 pp_string (buffer
, "#pragma omp distribute");
1505 case GF_OMP_FOR_KIND_TASKLOOP
:
1506 pp_string (buffer
, "#pragma omp taskloop");
1508 case GF_OMP_FOR_KIND_OACC_LOOP
:
1509 pp_string (buffer
, "#pragma acc loop");
1511 case GF_OMP_FOR_KIND_SIMD
:
1512 pp_string (buffer
, "#pragma omp simd");
1517 dump_omp_clauses (buffer
, gimple_omp_for_clauses (gs
), spc
, flags
);
1518 for (i
= 0; i
< gimple_omp_for_collapse (gs
); i
++)
1522 newline_and_indent (buffer
, spc
);
1523 pp_string (buffer
, "for (");
1524 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
1526 pp_string (buffer
, " = ");
1527 tree init
= gimple_omp_for_initial (gs
, i
);
1528 if (TREE_CODE (init
) != TREE_VEC
)
1529 dump_generic_node (buffer
, init
, spc
, flags
, false);
1531 dump_omp_loop_non_rect_expr (buffer
, init
, spc
, flags
);
1532 pp_string (buffer
, "; ");
1534 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
1537 switch (gimple_omp_for_cond (gs
, i
))
1543 pp_greater (buffer
);
1546 pp_less_equal (buffer
);
1549 pp_greater_equal (buffer
);
1552 pp_string (buffer
, "!=");
1558 tree cond
= gimple_omp_for_final (gs
, i
);
1559 if (TREE_CODE (cond
) != TREE_VEC
)
1560 dump_generic_node (buffer
, cond
, spc
, flags
, false);
1562 dump_omp_loop_non_rect_expr (buffer
, cond
, spc
, flags
);
1563 pp_string (buffer
, "; ");
1565 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
1567 pp_string (buffer
, " = ");
1568 dump_generic_node (buffer
, gimple_omp_for_incr (gs
, i
), spc
,
1570 pp_right_paren (buffer
);
1573 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1575 newline_and_indent (buffer
, spc
+ 2);
1576 pp_left_brace (buffer
);
1577 pp_newline (buffer
);
1578 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1579 newline_and_indent (buffer
, spc
+ 2);
1580 pp_right_brace (buffer
);
1585 /* Dump a GIMPLE_OMP_CONTINUE tuple on the pretty_printer BUFFER. */
1588 dump_gimple_omp_continue (pretty_printer
*buffer
, const gomp_continue
*gs
,
1589 int spc
, dump_flags_t flags
)
1591 if (flags
& TDF_RAW
)
1593 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T>", gs
,
1594 gimple_omp_continue_control_def (gs
),
1595 gimple_omp_continue_control_use (gs
));
1599 pp_string (buffer
, "#pragma omp continue (");
1600 dump_generic_node (buffer
, gimple_omp_continue_control_def (gs
),
1604 dump_generic_node (buffer
, gimple_omp_continue_control_use (gs
),
1606 pp_right_paren (buffer
);
1610 /* Dump a GIMPLE_OMP_SINGLE tuple on the pretty_printer BUFFER. */
1613 dump_gimple_omp_single (pretty_printer
*buffer
, const gomp_single
*gs
,
1614 int spc
, dump_flags_t flags
)
1616 if (flags
& TDF_RAW
)
1618 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1619 gimple_omp_body (gs
));
1620 dump_omp_clauses (buffer
, gimple_omp_single_clauses (gs
), spc
, flags
);
1621 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1625 pp_string (buffer
, "#pragma omp single");
1626 dump_omp_clauses (buffer
, gimple_omp_single_clauses (gs
), spc
, flags
);
1627 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1629 newline_and_indent (buffer
, spc
+ 2);
1630 pp_left_brace (buffer
);
1631 pp_newline (buffer
);
1632 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1633 newline_and_indent (buffer
, spc
+ 2);
1634 pp_right_brace (buffer
);
1639 /* Dump a GIMPLE_OMP_TASKGROUP tuple on the pretty_printer BUFFER. */
1642 dump_gimple_omp_taskgroup (pretty_printer
*buffer
, const gimple
*gs
,
1643 int spc
, dump_flags_t flags
)
1645 if (flags
& TDF_RAW
)
1647 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1648 gimple_omp_body (gs
));
1649 dump_omp_clauses (buffer
, gimple_omp_taskgroup_clauses (gs
), spc
, flags
);
1650 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1654 pp_string (buffer
, "#pragma omp taskgroup");
1655 dump_omp_clauses (buffer
, gimple_omp_taskgroup_clauses (gs
), spc
, flags
);
1656 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1658 newline_and_indent (buffer
, spc
+ 2);
1659 pp_left_brace (buffer
);
1660 pp_newline (buffer
);
1661 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1662 newline_and_indent (buffer
, spc
+ 2);
1663 pp_right_brace (buffer
);
1668 /* Dump a GIMPLE_OMP_MASKED tuple on the pretty_printer BUFFER. */
1671 dump_gimple_omp_masked (pretty_printer
*buffer
, const gimple
*gs
,
1672 int spc
, dump_flags_t flags
)
1674 if (flags
& TDF_RAW
)
1676 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1677 gimple_omp_body (gs
));
1678 dump_omp_clauses (buffer
, gimple_omp_masked_clauses (gs
), spc
, flags
);
1679 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1683 pp_string (buffer
, "#pragma omp masked");
1684 dump_omp_clauses (buffer
, gimple_omp_masked_clauses (gs
), spc
, flags
);
1685 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1687 newline_and_indent (buffer
, spc
+ 2);
1688 pp_left_brace (buffer
);
1689 pp_newline (buffer
);
1690 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1691 newline_and_indent (buffer
, spc
+ 2);
1692 pp_right_brace (buffer
);
1697 /* Dump a GIMPLE_OMP_SCOPE tuple on the pretty_printer BUFFER. */
1700 dump_gimple_omp_scope (pretty_printer
*buffer
, const gimple
*gs
,
1701 int spc
, dump_flags_t flags
)
1703 if (flags
& TDF_RAW
)
1705 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1706 gimple_omp_body (gs
));
1707 dump_omp_clauses (buffer
, gimple_omp_scope_clauses (gs
), spc
, flags
);
1708 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1712 pp_string (buffer
, "#pragma omp scope");
1713 dump_omp_clauses (buffer
, gimple_omp_scope_clauses (gs
), spc
, flags
);
1714 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1716 newline_and_indent (buffer
, spc
+ 2);
1717 pp_left_brace (buffer
);
1718 pp_newline (buffer
);
1719 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1720 newline_and_indent (buffer
, spc
+ 2);
1721 pp_right_brace (buffer
);
1726 /* Dump a GIMPLE_OMP_TARGET tuple on the pretty_printer BUFFER. */
1729 dump_gimple_omp_target (pretty_printer
*buffer
, const gomp_target
*gs
,
1730 int spc
, dump_flags_t flags
)
1733 switch (gimple_omp_target_kind (gs
))
1735 case GF_OMP_TARGET_KIND_REGION
:
1738 case GF_OMP_TARGET_KIND_DATA
:
1741 case GF_OMP_TARGET_KIND_UPDATE
:
1744 case GF_OMP_TARGET_KIND_ENTER_DATA
:
1745 kind
= " enter data";
1747 case GF_OMP_TARGET_KIND_EXIT_DATA
:
1748 kind
= " exit data";
1750 case GF_OMP_TARGET_KIND_OACC_KERNELS
:
1751 kind
= " oacc_kernels";
1753 case GF_OMP_TARGET_KIND_OACC_PARALLEL
:
1754 kind
= " oacc_parallel";
1756 case GF_OMP_TARGET_KIND_OACC_SERIAL
:
1757 kind
= " oacc_serial";
1759 case GF_OMP_TARGET_KIND_OACC_DATA
:
1760 kind
= " oacc_data";
1762 case GF_OMP_TARGET_KIND_OACC_UPDATE
:
1763 kind
= " oacc_update";
1765 case GF_OMP_TARGET_KIND_OACC_ENTER_DATA
:
1766 kind
= " oacc_enter_data";
1768 case GF_OMP_TARGET_KIND_OACC_EXIT_DATA
:
1769 kind
= " oacc_exit_data";
1771 case GF_OMP_TARGET_KIND_OACC_DECLARE
:
1772 kind
= " oacc_declare";
1774 case GF_OMP_TARGET_KIND_OACC_HOST_DATA
:
1775 kind
= " oacc_host_data";
1777 case GF_OMP_TARGET_KIND_OACC_PARALLEL_KERNELS_PARALLELIZED
:
1778 kind
= " oacc_parallel_kernels_parallelized";
1780 case GF_OMP_TARGET_KIND_OACC_PARALLEL_KERNELS_GANG_SINGLE
:
1781 kind
= " oacc_parallel_kernels_gang_single";
1783 case GF_OMP_TARGET_KIND_OACC_DATA_KERNELS
:
1784 kind
= " oacc_data_kernels";
1789 if (flags
& TDF_RAW
)
1791 dump_gimple_fmt (buffer
, spc
, flags
, "%G%s <%+BODY <%S>%nCLAUSES <", gs
,
1792 kind
, gimple_omp_body (gs
));
1793 dump_omp_clauses (buffer
, gimple_omp_target_clauses (gs
), spc
, flags
);
1794 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T%n>",
1795 gimple_omp_target_child_fn (gs
),
1796 gimple_omp_target_data_arg (gs
));
1800 pp_string (buffer
, "#pragma omp target");
1801 pp_string (buffer
, kind
);
1802 dump_omp_clauses (buffer
, gimple_omp_target_clauses (gs
), spc
, flags
);
1803 if (gimple_omp_target_child_fn (gs
))
1805 pp_string (buffer
, " [child fn: ");
1806 dump_generic_node (buffer
, gimple_omp_target_child_fn (gs
),
1808 pp_string (buffer
, " (");
1809 if (gimple_omp_target_data_arg (gs
))
1810 dump_generic_node (buffer
, gimple_omp_target_data_arg (gs
),
1813 pp_string (buffer
, "???");
1814 pp_string (buffer
, ")]");
1816 gimple_seq body
= gimple_omp_body (gs
);
1817 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
1819 newline_and_indent (buffer
, spc
+ 2);
1820 pp_left_brace (buffer
);
1821 pp_newline (buffer
);
1822 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
1823 newline_and_indent (buffer
, spc
+ 2);
1824 pp_right_brace (buffer
);
1828 pp_newline (buffer
);
1829 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
1834 /* Dump a GIMPLE_OMP_TEAMS tuple on the pretty_printer BUFFER. */
1837 dump_gimple_omp_teams (pretty_printer
*buffer
, const gomp_teams
*gs
, int spc
,
1840 if (flags
& TDF_RAW
)
1842 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1843 gimple_omp_body (gs
));
1844 dump_omp_clauses (buffer
, gimple_omp_teams_clauses (gs
), spc
, flags
);
1845 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1849 pp_string (buffer
, "#pragma omp teams");
1850 dump_omp_clauses (buffer
, gimple_omp_teams_clauses (gs
), spc
, flags
);
1851 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1853 newline_and_indent (buffer
, spc
+ 2);
1854 pp_character (buffer
, '{');
1855 pp_newline (buffer
);
1856 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1857 newline_and_indent (buffer
, spc
+ 2);
1858 pp_character (buffer
, '}');
1863 /* Dump a GIMPLE_OMP_SECTIONS tuple on the pretty_printer BUFFER. */
1866 dump_gimple_omp_sections (pretty_printer
*buffer
, const gomp_sections
*gs
,
1867 int spc
, dump_flags_t flags
)
1869 if (flags
& TDF_RAW
)
1871 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1872 gimple_omp_body (gs
));
1873 dump_omp_clauses (buffer
, gimple_omp_sections_clauses (gs
), spc
, flags
);
1874 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1878 pp_string (buffer
, "#pragma omp sections");
1879 if (gimple_omp_sections_control (gs
))
1881 pp_string (buffer
, " <");
1882 dump_generic_node (buffer
, gimple_omp_sections_control (gs
), spc
,
1884 pp_greater (buffer
);
1886 dump_omp_clauses (buffer
, gimple_omp_sections_clauses (gs
), spc
, flags
);
1887 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1889 newline_and_indent (buffer
, spc
+ 2);
1890 pp_left_brace (buffer
);
1891 pp_newline (buffer
);
1892 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1893 newline_and_indent (buffer
, spc
+ 2);
1894 pp_right_brace (buffer
);
1899 /* Dump a GIMPLE_OMP_{MASTER,ORDERED,SECTION,STRUCTURED_BLOCK} tuple on the
1900 pretty_printer BUFFER. */
1903 dump_gimple_omp_block (pretty_printer
*buffer
, const gimple
*gs
, int spc
,
1906 if (flags
& TDF_RAW
)
1907 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1908 gimple_omp_body (gs
));
1911 switch (gimple_code (gs
))
1913 case GIMPLE_OMP_MASTER
:
1914 pp_string (buffer
, "#pragma omp master");
1916 case GIMPLE_OMP_SECTION
:
1917 pp_string (buffer
, "#pragma omp section");
1919 case GIMPLE_OMP_STRUCTURED_BLOCK
:
1920 pp_string (buffer
, "#pragma omp __structured_block");
1925 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1927 newline_and_indent (buffer
, spc
+ 2);
1928 pp_left_brace (buffer
);
1929 pp_newline (buffer
);
1930 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1931 newline_and_indent (buffer
, spc
+ 2);
1932 pp_right_brace (buffer
);
1937 /* Dump a GIMPLE_OMP_CRITICAL tuple on the pretty_printer BUFFER. */
1940 dump_gimple_omp_critical (pretty_printer
*buffer
, const gomp_critical
*gs
,
1941 int spc
, dump_flags_t flags
)
1943 if (flags
& TDF_RAW
)
1944 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1945 gimple_omp_body (gs
));
1948 pp_string (buffer
, "#pragma omp critical");
1949 if (gimple_omp_critical_name (gs
))
1951 pp_string (buffer
, " (");
1952 dump_generic_node (buffer
, gimple_omp_critical_name (gs
), spc
,
1954 pp_right_paren (buffer
);
1956 dump_omp_clauses (buffer
, gimple_omp_critical_clauses (gs
), spc
, flags
);
1957 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1959 newline_and_indent (buffer
, spc
+ 2);
1960 pp_left_brace (buffer
);
1961 pp_newline (buffer
);
1962 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1963 newline_and_indent (buffer
, spc
+ 2);
1964 pp_right_brace (buffer
);
1969 /* Dump a GIMPLE_OMP_ORDERED tuple on the pretty_printer BUFFER. */
1972 dump_gimple_omp_ordered (pretty_printer
*buffer
, const gomp_ordered
*gs
,
1973 int spc
, dump_flags_t flags
)
1975 if (flags
& TDF_RAW
)
1976 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1977 gimple_omp_body (gs
));
1980 pp_string (buffer
, "#pragma omp ordered");
1981 dump_omp_clauses (buffer
, gimple_omp_ordered_clauses (gs
), spc
, flags
);
1982 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1984 newline_and_indent (buffer
, spc
+ 2);
1985 pp_left_brace (buffer
);
1986 pp_newline (buffer
);
1987 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1988 newline_and_indent (buffer
, spc
+ 2);
1989 pp_right_brace (buffer
);
1994 /* Dump a GIMPLE_OMP_SCAN tuple on the pretty_printer BUFFER. */
1997 dump_gimple_omp_scan (pretty_printer
*buffer
, const gomp_scan
*gs
,
1998 int spc
, dump_flags_t flags
)
2000 if (flags
& TDF_RAW
)
2001 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
2002 gimple_omp_body (gs
));
2005 if (gimple_omp_scan_clauses (gs
))
2007 pp_string (buffer
, "#pragma omp scan");
2008 dump_omp_clauses (buffer
, gimple_omp_scan_clauses (gs
), spc
, flags
);
2010 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
2012 newline_and_indent (buffer
, spc
+ 2);
2013 pp_left_brace (buffer
);
2014 pp_newline (buffer
);
2015 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
2016 newline_and_indent (buffer
, spc
+ 2);
2017 pp_right_brace (buffer
);
2022 /* Dump a GIMPLE_OMP_RETURN tuple on the pretty_printer BUFFER. */
2025 dump_gimple_omp_return (pretty_printer
*buffer
, const gimple
*gs
, int spc
,
2028 if (flags
& TDF_RAW
)
2030 dump_gimple_fmt (buffer
, spc
, flags
, "%G <nowait=%d", gs
,
2031 (int) gimple_omp_return_nowait_p (gs
));
2032 if (gimple_omp_return_lhs (gs
))
2033 dump_gimple_fmt (buffer
, spc
, flags
, ", lhs=%T>",
2034 gimple_omp_return_lhs (gs
));
2036 dump_gimple_fmt (buffer
, spc
, flags
, ">");
2040 pp_string (buffer
, "#pragma omp return");
2041 if (gimple_omp_return_nowait_p (gs
))
2042 pp_string (buffer
, "(nowait)");
2043 if (gimple_omp_return_lhs (gs
))
2045 pp_string (buffer
, " (set ");
2046 dump_generic_node (buffer
, gimple_omp_return_lhs (gs
),
2048 pp_character (buffer
, ')');
2053 /* Dump a GIMPLE_ASSUME tuple on the pretty_printer BUFFER. */
2056 dump_gimple_assume (pretty_printer
*buffer
, const gimple
*gs
,
2057 int spc
, dump_flags_t flags
)
2059 if (flags
& TDF_RAW
)
2060 dump_gimple_fmt (buffer
, spc
, flags
,
2061 "%G [GUARD=%T] <%+BODY <%S> >",
2062 gs
, gimple_assume_guard (gs
),
2063 gimple_assume_body (gs
));
2066 pp_string (buffer
, "[[assume (");
2067 dump_generic_node (buffer
, gimple_assume_guard (gs
), spc
, flags
, false);
2068 pp_string (buffer
, ")]]");
2069 newline_and_indent (buffer
, spc
+ 2);
2070 pp_left_brace (buffer
);
2071 pp_newline (buffer
);
2072 dump_gimple_seq (buffer
, gimple_assume_body (gs
), spc
+ 4, flags
);
2073 newline_and_indent (buffer
, spc
+ 2);
2074 pp_right_brace (buffer
);
2078 /* Dump a GIMPLE_TRANSACTION tuple on the pretty_printer BUFFER. */
2081 dump_gimple_transaction (pretty_printer
*buffer
, const gtransaction
*gs
,
2082 int spc
, dump_flags_t flags
)
2084 unsigned subcode
= gimple_transaction_subcode (gs
);
2086 if (flags
& TDF_RAW
)
2088 dump_gimple_fmt (buffer
, spc
, flags
,
2089 "%G [SUBCODE=%x,NORM=%T,UNINST=%T,OVER=%T] "
2091 gs
, subcode
, gimple_transaction_label_norm (gs
),
2092 gimple_transaction_label_uninst (gs
),
2093 gimple_transaction_label_over (gs
),
2094 gimple_transaction_body (gs
));
2098 if (subcode
& GTMA_IS_OUTER
)
2099 pp_string (buffer
, "__transaction_atomic [[outer]]");
2100 else if (subcode
& GTMA_IS_RELAXED
)
2101 pp_string (buffer
, "__transaction_relaxed");
2103 pp_string (buffer
, "__transaction_atomic");
2104 subcode
&= ~GTMA_DECLARATION_MASK
;
2106 if (gimple_transaction_body (gs
))
2108 newline_and_indent (buffer
, spc
+ 2);
2109 pp_left_brace (buffer
);
2110 pp_newline (buffer
);
2111 dump_gimple_seq (buffer
, gimple_transaction_body (gs
),
2113 newline_and_indent (buffer
, spc
+ 2);
2114 pp_right_brace (buffer
);
2118 pp_string (buffer
, " //");
2119 if (gimple_transaction_label_norm (gs
))
2121 pp_string (buffer
, " NORM=");
2122 dump_generic_node (buffer
, gimple_transaction_label_norm (gs
),
2125 if (gimple_transaction_label_uninst (gs
))
2127 pp_string (buffer
, " UNINST=");
2128 dump_generic_node (buffer
, gimple_transaction_label_uninst (gs
),
2131 if (gimple_transaction_label_over (gs
))
2133 pp_string (buffer
, " OVER=");
2134 dump_generic_node (buffer
, gimple_transaction_label_over (gs
),
2139 pp_string (buffer
, " SUBCODE=[ ");
2140 if (subcode
& GTMA_HAVE_ABORT
)
2142 pp_string (buffer
, "GTMA_HAVE_ABORT ");
2143 subcode
&= ~GTMA_HAVE_ABORT
;
2145 if (subcode
& GTMA_HAVE_LOAD
)
2147 pp_string (buffer
, "GTMA_HAVE_LOAD ");
2148 subcode
&= ~GTMA_HAVE_LOAD
;
2150 if (subcode
& GTMA_HAVE_STORE
)
2152 pp_string (buffer
, "GTMA_HAVE_STORE ");
2153 subcode
&= ~GTMA_HAVE_STORE
;
2155 if (subcode
& GTMA_MAY_ENTER_IRREVOCABLE
)
2157 pp_string (buffer
, "GTMA_MAY_ENTER_IRREVOCABLE ");
2158 subcode
&= ~GTMA_MAY_ENTER_IRREVOCABLE
;
2160 if (subcode
& GTMA_DOES_GO_IRREVOCABLE
)
2162 pp_string (buffer
, "GTMA_DOES_GO_IRREVOCABLE ");
2163 subcode
&= ~GTMA_DOES_GO_IRREVOCABLE
;
2165 if (subcode
& GTMA_HAS_NO_INSTRUMENTATION
)
2167 pp_string (buffer
, "GTMA_HAS_NO_INSTRUMENTATION ");
2168 subcode
&= ~GTMA_HAS_NO_INSTRUMENTATION
;
2171 pp_printf (buffer
, "0x%x ", subcode
);
2172 pp_right_bracket (buffer
);
2178 /* Dump a GIMPLE_ASM tuple on the pretty_printer BUFFER, SPC spaces of
2179 indent. FLAGS specifies details to show in the dump (see TDF_* in
2183 dump_gimple_asm (pretty_printer
*buffer
, const gasm
*gs
, int spc
,
2186 unsigned int i
, n
, f
, fields
;
2188 if (flags
& TDF_RAW
)
2190 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+STRING <%n%s%n>", gs
,
2191 gimple_asm_string (gs
));
2193 n
= gimple_asm_noutputs (gs
);
2196 newline_and_indent (buffer
, spc
+ 2);
2197 pp_string (buffer
, "OUTPUT: ");
2198 for (i
= 0; i
< n
; i
++)
2200 dump_generic_node (buffer
, gimple_asm_output_op (gs
, i
),
2203 pp_string (buffer
, ", ");
2207 n
= gimple_asm_ninputs (gs
);
2210 newline_and_indent (buffer
, spc
+ 2);
2211 pp_string (buffer
, "INPUT: ");
2212 for (i
= 0; i
< n
; i
++)
2214 dump_generic_node (buffer
, gimple_asm_input_op (gs
, i
),
2217 pp_string (buffer
, ", ");
2221 n
= gimple_asm_nclobbers (gs
);
2224 newline_and_indent (buffer
, spc
+ 2);
2225 pp_string (buffer
, "CLOBBER: ");
2226 for (i
= 0; i
< n
; i
++)
2228 dump_generic_node (buffer
, gimple_asm_clobber_op (gs
, i
),
2231 pp_string (buffer
, ", ");
2235 n
= gimple_asm_nlabels (gs
);
2238 newline_and_indent (buffer
, spc
+ 2);
2239 pp_string (buffer
, "LABEL: ");
2240 for (i
= 0; i
< n
; i
++)
2242 dump_generic_node (buffer
, gimple_asm_label_op (gs
, i
),
2245 pp_string (buffer
, ", ");
2249 newline_and_indent (buffer
, spc
);
2250 pp_greater (buffer
);
2254 pp_string (buffer
, "__asm__");
2255 if (gimple_asm_volatile_p (gs
))
2256 pp_string (buffer
, " __volatile__");
2257 if (gimple_asm_inline_p (gs
))
2258 pp_string (buffer
, " __inline__");
2259 if (gimple_asm_nlabels (gs
))
2260 pp_string (buffer
, " goto");
2261 pp_string (buffer
, "(\"");
2262 pp_string (buffer
, gimple_asm_string (gs
));
2263 pp_string (buffer
, "\"");
2265 if (gimple_asm_nlabels (gs
))
2267 else if (gimple_asm_nclobbers (gs
))
2269 else if (gimple_asm_ninputs (gs
))
2271 else if (gimple_asm_noutputs (gs
))
2276 for (f
= 0; f
< fields
; ++f
)
2278 pp_string (buffer
, " : ");
2283 n
= gimple_asm_noutputs (gs
);
2284 for (i
= 0; i
< n
; i
++)
2286 dump_generic_node (buffer
, gimple_asm_output_op (gs
, i
),
2289 pp_string (buffer
, ", ");
2294 n
= gimple_asm_ninputs (gs
);
2295 for (i
= 0; i
< n
; i
++)
2297 dump_generic_node (buffer
, gimple_asm_input_op (gs
, i
),
2300 pp_string (buffer
, ", ");
2305 n
= gimple_asm_nclobbers (gs
);
2306 for (i
= 0; i
< n
; i
++)
2308 dump_generic_node (buffer
, gimple_asm_clobber_op (gs
, i
),
2311 pp_string (buffer
, ", ");
2316 n
= gimple_asm_nlabels (gs
);
2317 for (i
= 0; i
< n
; i
++)
2319 dump_generic_node (buffer
, gimple_asm_label_op (gs
, i
),
2322 pp_string (buffer
, ", ");
2331 pp_string (buffer
, ");");
2335 /* Dump ptr_info and range_info for NODE on pretty_printer BUFFER with
2336 SPC spaces of indent. */
2339 dump_ssaname_info (pretty_printer
*buffer
, tree node
, int spc
)
2341 if (TREE_CODE (node
) != SSA_NAME
)
2344 if (POINTER_TYPE_P (TREE_TYPE (node
))
2345 && SSA_NAME_PTR_INFO (node
))
2347 unsigned int align
, misalign
;
2348 struct ptr_info_def
*pi
= SSA_NAME_PTR_INFO (node
);
2349 pp_string (buffer
, "# PT = ");
2350 pp_points_to_solution (buffer
, &pi
->pt
);
2351 newline_and_indent (buffer
, spc
);
2352 if (get_ptr_info_alignment (pi
, &align
, &misalign
))
2354 pp_printf (buffer
, "# ALIGN = %u, MISALIGN = %u", align
, misalign
);
2355 newline_and_indent (buffer
, spc
);
2359 if (!POINTER_TYPE_P (TREE_TYPE (node
))
2360 && SSA_NAME_RANGE_INFO (node
))
2362 Value_Range
r (TREE_TYPE (node
));
2363 get_global_range_query ()->range_of_expr (r
, node
);
2364 pp_string (buffer
, "# RANGE ");
2365 pp_vrange (buffer
, &r
);
2366 newline_and_indent (buffer
, spc
);
2370 /* As dump_ssaname_info, but dump to FILE. */
2373 dump_ssaname_info_to_file (FILE *file
, tree node
, int spc
)
2375 pretty_printer buffer
;
2376 pp_needs_newline (&buffer
) = true;
2377 buffer
.buffer
->stream
= file
;
2378 dump_ssaname_info (&buffer
, node
, spc
);
2382 /* Dump a PHI node PHI. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1.
2383 The caller is responsible for calling pp_flush on BUFFER to finalize
2384 pretty printer. If COMMENT is true, print this after #. */
2387 dump_gimple_phi (pretty_printer
*buffer
, const gphi
*phi
, int spc
, bool comment
,
2391 tree lhs
= gimple_phi_result (phi
);
2393 if (flags
& TDF_ALIAS
)
2394 dump_ssaname_info (buffer
, lhs
, spc
);
2397 pp_string (buffer
, "# ");
2399 if (flags
& TDF_RAW
)
2400 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, ", phi
,
2401 gimple_phi_result (phi
));
2404 dump_generic_node (buffer
, lhs
, spc
, flags
, false);
2405 if (flags
& TDF_GIMPLE
)
2406 pp_string (buffer
, " = __PHI (");
2408 pp_string (buffer
, " = PHI <");
2410 for (i
= 0; i
< gimple_phi_num_args (phi
); i
++)
2412 if ((flags
& TDF_LINENO
) && gimple_phi_arg_has_location (phi
, i
))
2413 dump_location (buffer
, gimple_phi_arg_location (phi
, i
));
2414 basic_block src
= gimple_phi_arg_edge (phi
, i
)->src
;
2415 if (flags
& TDF_GIMPLE
)
2417 pp_string (buffer
, "__BB");
2418 pp_decimal_int (buffer
, src
->index
);
2419 pp_string (buffer
, ": ");
2421 dump_generic_node (buffer
, gimple_phi_arg_def (phi
, i
), spc
, flags
,
2423 if (! (flags
& TDF_GIMPLE
))
2425 pp_left_paren (buffer
);
2426 pp_decimal_int (buffer
, src
->index
);
2427 pp_right_paren (buffer
);
2429 if (i
< gimple_phi_num_args (phi
) - 1)
2430 pp_string (buffer
, ", ");
2432 if (flags
& TDF_GIMPLE
)
2433 pp_string (buffer
, ");");
2435 pp_greater (buffer
);
2439 /* Dump a GIMPLE_OMP_PARALLEL tuple on the pretty_printer BUFFER, SPC spaces
2440 of indent. FLAGS specifies details to show in the dump (see TDF_* in
2444 dump_gimple_omp_parallel (pretty_printer
*buffer
, const gomp_parallel
*gs
,
2445 int spc
, dump_flags_t flags
)
2447 if (flags
& TDF_RAW
)
2449 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
2450 gimple_omp_body (gs
));
2451 dump_omp_clauses (buffer
, gimple_omp_parallel_clauses (gs
), spc
, flags
);
2452 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T%n>",
2453 gimple_omp_parallel_child_fn (gs
),
2454 gimple_omp_parallel_data_arg (gs
));
2459 pp_string (buffer
, "#pragma omp parallel");
2460 dump_omp_clauses (buffer
, gimple_omp_parallel_clauses (gs
), spc
, flags
);
2461 if (gimple_omp_parallel_child_fn (gs
))
2463 pp_string (buffer
, " [child fn: ");
2464 dump_generic_node (buffer
, gimple_omp_parallel_child_fn (gs
),
2466 pp_string (buffer
, " (");
2467 if (gimple_omp_parallel_data_arg (gs
))
2468 dump_generic_node (buffer
, gimple_omp_parallel_data_arg (gs
),
2471 pp_string (buffer
, "???");
2472 pp_string (buffer
, ")]");
2474 body
= gimple_omp_body (gs
);
2475 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
2477 newline_and_indent (buffer
, spc
+ 2);
2478 pp_left_brace (buffer
);
2479 pp_newline (buffer
);
2480 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
2481 newline_and_indent (buffer
, spc
+ 2);
2482 pp_right_brace (buffer
);
2486 pp_newline (buffer
);
2487 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
2493 /* Dump a GIMPLE_OMP_TASK tuple on the pretty_printer BUFFER, SPC spaces
2494 of indent. FLAGS specifies details to show in the dump (see TDF_* in
2498 dump_gimple_omp_task (pretty_printer
*buffer
, const gomp_task
*gs
, int spc
,
2501 if (flags
& TDF_RAW
)
2503 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
2504 gimple_omp_body (gs
));
2505 dump_omp_clauses (buffer
, gimple_omp_task_clauses (gs
), spc
, flags
);
2506 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T, %T, %T, %T%n>",
2507 gimple_omp_task_child_fn (gs
),
2508 gimple_omp_task_data_arg (gs
),
2509 gimple_omp_task_copy_fn (gs
),
2510 gimple_omp_task_arg_size (gs
),
2511 gimple_omp_task_arg_size (gs
));
2516 if (gimple_omp_task_taskloop_p (gs
))
2517 pp_string (buffer
, "#pragma omp taskloop");
2518 else if (gimple_omp_task_taskwait_p (gs
))
2519 pp_string (buffer
, "#pragma omp taskwait");
2521 pp_string (buffer
, "#pragma omp task");
2522 dump_omp_clauses (buffer
, gimple_omp_task_clauses (gs
), spc
, flags
);
2523 if (gimple_omp_task_child_fn (gs
))
2525 pp_string (buffer
, " [child fn: ");
2526 dump_generic_node (buffer
, gimple_omp_task_child_fn (gs
),
2528 pp_string (buffer
, " (");
2529 if (gimple_omp_task_data_arg (gs
))
2530 dump_generic_node (buffer
, gimple_omp_task_data_arg (gs
),
2533 pp_string (buffer
, "???");
2534 pp_string (buffer
, ")]");
2536 body
= gimple_omp_body (gs
);
2537 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
2539 newline_and_indent (buffer
, spc
+ 2);
2540 pp_left_brace (buffer
);
2541 pp_newline (buffer
);
2542 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
2543 newline_and_indent (buffer
, spc
+ 2);
2544 pp_right_brace (buffer
);
2548 pp_newline (buffer
);
2549 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
2555 /* Dump a GIMPLE_OMP_ATOMIC_LOAD tuple on the pretty_printer BUFFER, SPC
2556 spaces of indent. FLAGS specifies details to show in the dump (see TDF_*
2560 dump_gimple_omp_atomic_load (pretty_printer
*buffer
, const gomp_atomic_load
*gs
,
2561 int spc
, dump_flags_t flags
)
2563 if (flags
& TDF_RAW
)
2565 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T>", gs
,
2566 gimple_omp_atomic_load_lhs (gs
),
2567 gimple_omp_atomic_load_rhs (gs
));
2571 pp_string (buffer
, "#pragma omp atomic_load");
2572 dump_omp_atomic_memory_order (buffer
,
2573 gimple_omp_atomic_memory_order (gs
));
2574 if (gimple_omp_atomic_need_value_p (gs
))
2575 pp_string (buffer
, " [needed]");
2576 if (gimple_omp_atomic_weak_p (gs
))
2577 pp_string (buffer
, " [weak]");
2578 newline_and_indent (buffer
, spc
+ 2);
2579 dump_generic_node (buffer
, gimple_omp_atomic_load_lhs (gs
),
2585 dump_generic_node (buffer
, gimple_omp_atomic_load_rhs (gs
),
2590 /* Dump a GIMPLE_OMP_ATOMIC_STORE tuple on the pretty_printer BUFFER, SPC
2591 spaces of indent. FLAGS specifies details to show in the dump (see TDF_*
2595 dump_gimple_omp_atomic_store (pretty_printer
*buffer
,
2596 const gomp_atomic_store
*gs
, int spc
,
2599 if (flags
& TDF_RAW
)
2601 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
,
2602 gimple_omp_atomic_store_val (gs
));
2606 pp_string (buffer
, "#pragma omp atomic_store");
2607 dump_omp_atomic_memory_order (buffer
,
2608 gimple_omp_atomic_memory_order (gs
));
2610 if (gimple_omp_atomic_need_value_p (gs
))
2611 pp_string (buffer
, "[needed] ");
2612 if (gimple_omp_atomic_weak_p (gs
))
2613 pp_string (buffer
, "[weak] ");
2614 pp_left_paren (buffer
);
2615 dump_generic_node (buffer
, gimple_omp_atomic_store_val (gs
),
2617 pp_right_paren (buffer
);
2622 /* Dump all the memory operands for statement GS. BUFFER, SPC and
2623 FLAGS are as in pp_gimple_stmt_1. */
2626 dump_gimple_mem_ops (pretty_printer
*buffer
, const gimple
*gs
, int spc
,
2629 tree vdef
= gimple_vdef (gs
);
2630 tree vuse
= gimple_vuse (gs
);
2632 if (vdef
!= NULL_TREE
)
2634 pp_string (buffer
, "# ");
2635 dump_generic_node (buffer
, vdef
, spc
+ 2, flags
, false);
2636 pp_string (buffer
, " = VDEF <");
2637 dump_generic_node (buffer
, vuse
, spc
+ 2, flags
, false);
2638 pp_greater (buffer
);
2639 newline_and_indent (buffer
, spc
);
2641 else if (vuse
!= NULL_TREE
)
2643 pp_string (buffer
, "# VUSE <");
2644 dump_generic_node (buffer
, vuse
, spc
+ 2, flags
, false);
2645 pp_greater (buffer
);
2646 newline_and_indent (buffer
, spc
);
2651 /* Print the gimple statement GS on the pretty printer BUFFER, SPC
2652 spaces of indent. FLAGS specifies details to show in the dump (see
2653 TDF_* in dumpfile.h). The caller is responsible for calling
2654 pp_flush on BUFFER to finalize the pretty printer. */
2657 pp_gimple_stmt_1 (pretty_printer
*buffer
, const gimple
*gs
, int spc
,
2663 if (flags
& TDF_STMTADDR
)
2664 pp_printf (buffer
, "<&%p> ", (const void *) gs
);
2666 if ((flags
& TDF_LINENO
) && gimple_has_location (gs
))
2667 dump_location (buffer
, gimple_location (gs
));
2671 int lp_nr
= lookup_stmt_eh_lp (gs
);
2673 pp_printf (buffer
, "[LP %d] ", lp_nr
);
2675 pp_printf (buffer
, "[MNT %d] ", -lp_nr
);
2678 if ((flags
& (TDF_VOPS
|TDF_MEMSYMS
))
2679 && gimple_has_mem_ops (gs
))
2680 dump_gimple_mem_ops (buffer
, gs
, spc
, flags
);
2682 if (gimple_has_lhs (gs
)
2683 && (flags
& TDF_ALIAS
))
2684 dump_ssaname_info (buffer
, gimple_get_lhs (gs
), spc
);
2686 switch (gimple_code (gs
))
2689 dump_gimple_asm (buffer
, as_a
<const gasm
*> (gs
), spc
, flags
);
2693 dump_gimple_assign (buffer
, as_a
<const gassign
*> (gs
), spc
, flags
);
2697 dump_gimple_bind (buffer
, as_a
<const gbind
*> (gs
), spc
, flags
);
2701 dump_gimple_call (buffer
, as_a
<const gcall
*> (gs
), spc
, flags
);
2705 dump_gimple_cond (buffer
, as_a
<const gcond
*> (gs
), spc
, flags
);
2709 dump_gimple_label (buffer
, as_a
<const glabel
*> (gs
), spc
, flags
);
2713 dump_gimple_goto (buffer
, as_a
<const ggoto
*> (gs
), spc
, flags
);
2717 pp_string (buffer
, "GIMPLE_NOP");
2721 dump_gimple_return (buffer
, as_a
<const greturn
*> (gs
), spc
, flags
);
2725 dump_gimple_switch (buffer
, as_a
<const gswitch
*> (gs
), spc
, flags
);
2729 dump_gimple_try (buffer
, as_a
<const gtry
*> (gs
), spc
, flags
);
2733 dump_gimple_phi (buffer
, as_a
<const gphi
*> (gs
), spc
, false, flags
);
2736 case GIMPLE_OMP_PARALLEL
:
2737 dump_gimple_omp_parallel (buffer
, as_a
<const gomp_parallel
*> (gs
), spc
,
2741 case GIMPLE_OMP_TASK
:
2742 dump_gimple_omp_task (buffer
, as_a
<const gomp_task
*> (gs
), spc
, flags
);
2745 case GIMPLE_OMP_ATOMIC_LOAD
:
2746 dump_gimple_omp_atomic_load (buffer
, as_a
<const gomp_atomic_load
*> (gs
),
2750 case GIMPLE_OMP_ATOMIC_STORE
:
2751 dump_gimple_omp_atomic_store (buffer
,
2752 as_a
<const gomp_atomic_store
*> (gs
),
2756 case GIMPLE_OMP_FOR
:
2757 dump_gimple_omp_for (buffer
, as_a
<const gomp_for
*> (gs
), spc
, flags
);
2760 case GIMPLE_OMP_CONTINUE
:
2761 dump_gimple_omp_continue (buffer
, as_a
<const gomp_continue
*> (gs
), spc
,
2765 case GIMPLE_OMP_SINGLE
:
2766 dump_gimple_omp_single (buffer
, as_a
<const gomp_single
*> (gs
), spc
,
2770 case GIMPLE_OMP_TARGET
:
2771 dump_gimple_omp_target (buffer
, as_a
<const gomp_target
*> (gs
), spc
,
2775 case GIMPLE_OMP_TEAMS
:
2776 dump_gimple_omp_teams (buffer
, as_a
<const gomp_teams
*> (gs
), spc
,
2780 case GIMPLE_OMP_RETURN
:
2781 dump_gimple_omp_return (buffer
, gs
, spc
, flags
);
2784 case GIMPLE_OMP_SECTIONS
:
2785 dump_gimple_omp_sections (buffer
, as_a
<const gomp_sections
*> (gs
),
2789 case GIMPLE_OMP_SECTIONS_SWITCH
:
2790 pp_string (buffer
, "GIMPLE_SECTIONS_SWITCH");
2793 case GIMPLE_OMP_TASKGROUP
:
2794 dump_gimple_omp_taskgroup (buffer
, gs
, spc
, flags
);
2797 case GIMPLE_OMP_MASKED
:
2798 dump_gimple_omp_masked (buffer
, gs
, spc
, flags
);
2801 case GIMPLE_OMP_SCOPE
:
2802 dump_gimple_omp_scope (buffer
, gs
, spc
, flags
);
2805 case GIMPLE_OMP_MASTER
:
2806 case GIMPLE_OMP_SECTION
:
2807 case GIMPLE_OMP_STRUCTURED_BLOCK
:
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
,
3008 if (safe_is_a
<gcond
*> (*gsi_last_bb (bb
)))
3010 edge true_edge
, false_edge
;
3012 /* When we are emitting the code or changing CFG, it is possible that
3013 the edges are not yet created. When we are using debug_bb in such
3014 a situation, we do not want it to crash. */
3015 if (EDGE_COUNT (bb
->succs
) != 2)
3017 extract_true_false_edges_from_block (bb
, &true_edge
, &false_edge
);
3019 INDENT (indent
+ 2);
3020 pp_cfg_jump (buffer
, true_edge
, flags
);
3021 newline_and_indent (buffer
, indent
);
3022 pp_string (buffer
, "else");
3023 newline_and_indent (buffer
, indent
+ 2);
3024 pp_cfg_jump (buffer
, false_edge
, flags
);
3025 pp_newline (buffer
);
3029 /* If there is a fallthru edge, we may need to add an artificial
3030 goto to the dump. */
3031 e
= find_fallthru_edge (bb
->succs
);
3033 if (e
&& (e
->dest
!= bb
->next_bb
|| (flags
& TDF_GIMPLE
)))
3037 if ((flags
& TDF_LINENO
)
3038 && e
->goto_locus
!= UNKNOWN_LOCATION
)
3039 dump_location (buffer
, e
->goto_locus
);
3041 pp_cfg_jump (buffer
, e
, flags
);
3042 pp_newline (buffer
);
3047 /* Dumps basic block BB to buffer BUFFER with details described by FLAGS and
3048 indented by INDENT spaces. */
3051 gimple_dump_bb_buff (pretty_printer
*buffer
, basic_block bb
, int indent
,
3054 gimple_stmt_iterator gsi
;
3056 int label_indent
= indent
- 2;
3058 if (label_indent
< 0)
3061 dump_phi_nodes (buffer
, bb
, indent
, flags
);
3063 for (gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
); gsi_next (&gsi
))
3067 stmt
= gsi_stmt (gsi
);
3069 curr_indent
= gimple_code (stmt
) == GIMPLE_LABEL
? label_indent
: indent
;
3071 INDENT (curr_indent
);
3072 pp_gimple_stmt_1 (buffer
, stmt
, curr_indent
, flags
);
3073 pp_newline_and_flush (buffer
);
3074 gcc_checking_assert (DECL_STRUCT_FUNCTION (current_function_decl
));
3075 dump_histograms_for_stmt (DECL_STRUCT_FUNCTION (current_function_decl
),
3076 pp_buffer (buffer
)->stream
, stmt
);
3079 dump_implicit_edges (buffer
, bb
, indent
, flags
);
3084 /* Dumps basic block BB to FILE with details described by FLAGS and
3085 indented by INDENT spaces. */
3088 gimple_dump_bb (FILE *file
, basic_block bb
, int indent
, dump_flags_t flags
)
3090 dump_gimple_bb_header (file
, bb
, indent
, flags
);
3091 if (bb
->index
>= NUM_FIXED_BLOCKS
)
3093 pretty_printer buffer
;
3094 pp_needs_newline (&buffer
) = true;
3095 buffer
.buffer
->stream
= file
;
3096 gimple_dump_bb_buff (&buffer
, bb
, indent
, flags
);
3098 dump_gimple_bb_footer (file
, bb
, indent
, flags
);
3101 /* Dumps basic block BB to pretty-printer PP with default dump flags and
3102 no indentation, for use as a label of a DOT graph record-node.
3103 ??? Should just use gimple_dump_bb_buff here, except that value profiling
3104 histogram dumping doesn't know about pretty-printers. */
3107 gimple_dump_bb_for_graph (pretty_printer
*pp
, basic_block bb
)
3109 pp_printf (pp
, "<bb %d>:\n", bb
->index
);
3110 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
3112 for (gphi_iterator gsi
= gsi_start_phis (bb
); !gsi_end_p (gsi
);
3115 gphi
*phi
= gsi
.phi ();
3116 if (!virtual_operand_p (gimple_phi_result (phi
))
3117 || (dump_flags
& TDF_VOPS
))
3120 pp_write_text_to_stream (pp
);
3121 pp_string (pp
, "# ");
3122 pp_gimple_stmt_1 (pp
, phi
, 0, dump_flags
);
3124 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
3128 for (gimple_stmt_iterator gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
);
3131 gimple
*stmt
= gsi_stmt (gsi
);
3133 pp_write_text_to_stream (pp
);
3134 pp_gimple_stmt_1 (pp
, stmt
, 0, dump_flags
);
3136 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
3138 dump_implicit_edges (pp
, bb
, 0, dump_flags
);
3139 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
3143 # pragma GCC diagnostic pop