1 /* Pretty formatting of GIMPLE statements and expressions.
2 Copyright (C) 2001-2022 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
:
343 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
346 case FIXED_CONVERT_EXPR
:
347 case ADDR_SPACE_CONVERT_EXPR
:
351 pp_left_paren (buffer
);
352 dump_generic_node (buffer
, TREE_TYPE (lhs
), spc
, flags
, false);
353 pp_string (buffer
, ") ");
354 if (op_prio (rhs
) < op_code_prio (rhs_code
))
356 pp_left_paren (buffer
);
357 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
358 pp_right_paren (buffer
);
361 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
365 pp_string (buffer
, "((");
366 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
367 pp_string (buffer
, "))");
372 if (flags
& TDF_GIMPLE
)
375 rhs_code
== ABS_EXPR
? "__ABS " : "__ABSU ");
376 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
381 rhs_code
== ABS_EXPR
? "ABS_EXPR <" : "ABSU_EXPR <");
382 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
388 if (TREE_CODE_CLASS (rhs_code
) == tcc_declaration
389 || TREE_CODE_CLASS (rhs_code
) == tcc_constant
390 || TREE_CODE_CLASS (rhs_code
) == tcc_reference
391 || rhs_code
== SSA_NAME
392 || rhs_code
== ADDR_EXPR
393 || rhs_code
== CONSTRUCTOR
)
395 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
398 else if (rhs_code
== BIT_NOT_EXPR
)
399 pp_complement (buffer
);
400 else if (rhs_code
== TRUTH_NOT_EXPR
)
401 pp_exclamation (buffer
);
402 else if (rhs_code
== NEGATE_EXPR
)
406 pp_left_bracket (buffer
);
407 pp_string (buffer
, get_tree_code_name (rhs_code
));
408 pp_string (buffer
, "] ");
411 if (op_prio (rhs
) < op_code_prio (rhs_code
))
413 pp_left_paren (buffer
);
414 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
415 pp_right_paren (buffer
);
418 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
424 /* Helper for dump_gimple_assign. Print the binary RHS of the
425 assignment GS. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. */
428 dump_binary_rhs (pretty_printer
*buffer
, const gassign
*gs
, int spc
,
432 enum tree_code code
= gimple_assign_rhs_code (gs
);
437 if (flags
& TDF_GIMPLE
)
439 pp_string (buffer
, code
== MIN_EXPR
? "__MIN (" : "__MAX (");
440 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
,
442 pp_string (buffer
, ", ");
443 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
,
445 pp_string (buffer
, ")");
453 case VEC_WIDEN_MULT_HI_EXPR
:
454 case VEC_WIDEN_MULT_LO_EXPR
:
455 case VEC_WIDEN_MULT_EVEN_EXPR
:
456 case VEC_WIDEN_MULT_ODD_EXPR
:
457 case VEC_PACK_TRUNC_EXPR
:
458 case VEC_PACK_SAT_EXPR
:
459 case VEC_PACK_FIX_TRUNC_EXPR
:
460 case VEC_PACK_FLOAT_EXPR
:
461 case VEC_WIDEN_LSHIFT_HI_EXPR
:
462 case VEC_WIDEN_LSHIFT_LO_EXPR
:
463 case VEC_WIDEN_PLUS_HI_EXPR
:
464 case VEC_WIDEN_PLUS_LO_EXPR
:
465 case VEC_WIDEN_MINUS_HI_EXPR
:
466 case VEC_WIDEN_MINUS_LO_EXPR
:
467 case VEC_SERIES_EXPR
:
468 for (p
= get_tree_code_name (code
); *p
; p
++)
469 pp_character (buffer
, TOUPPER (*p
));
470 pp_string (buffer
, " <");
471 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
472 pp_string (buffer
, ", ");
473 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
478 if (op_prio (gimple_assign_rhs1 (gs
)) <= op_code_prio (code
))
480 pp_left_paren (buffer
);
481 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
,
483 pp_right_paren (buffer
);
486 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
488 pp_string (buffer
, op_symbol_code (gimple_assign_rhs_code (gs
)));
490 if (op_prio (gimple_assign_rhs2 (gs
)) <= op_code_prio (code
))
492 pp_left_paren (buffer
);
493 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
,
495 pp_right_paren (buffer
);
498 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
502 /* Helper for dump_gimple_assign. Print the ternary RHS of the
503 assignment GS. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. */
506 dump_ternary_rhs (pretty_printer
*buffer
, const gassign
*gs
, int spc
,
510 enum tree_code code
= gimple_assign_rhs_code (gs
);
513 case WIDEN_MULT_PLUS_EXPR
:
514 case WIDEN_MULT_MINUS_EXPR
:
515 for (p
= get_tree_code_name (code
); *p
; p
++)
516 pp_character (buffer
, TOUPPER (*p
));
517 pp_string (buffer
, " <");
518 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
519 pp_string (buffer
, ", ");
520 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
521 pp_string (buffer
, ", ");
522 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
527 pp_string (buffer
, "DOT_PROD_EXPR <");
528 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
529 pp_string (buffer
, ", ");
530 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
531 pp_string (buffer
, ", ");
532 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
537 pp_string (buffer
, "SAD_EXPR <");
538 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
539 pp_string (buffer
, ", ");
540 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
541 pp_string (buffer
, ", ");
542 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
547 if (flags
& TDF_GIMPLE
)
548 pp_string (buffer
, "__VEC_PERM (");
550 pp_string (buffer
, "VEC_PERM_EXPR <");
551 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
552 pp_string (buffer
, ", ");
553 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
554 pp_string (buffer
, ", ");
555 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
556 if (flags
& TDF_GIMPLE
)
557 pp_right_paren (buffer
);
562 case REALIGN_LOAD_EXPR
:
563 pp_string (buffer
, "REALIGN_LOAD <");
564 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
565 pp_string (buffer
, ", ");
566 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
567 pp_string (buffer
, ", ");
568 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
573 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
574 pp_string (buffer
, " ? ");
575 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
576 pp_string (buffer
, " : ");
577 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
581 pp_string (buffer
, "VEC_COND_EXPR <");
582 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
583 pp_string (buffer
, ", ");
584 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
585 pp_string (buffer
, ", ");
586 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
590 case BIT_INSERT_EXPR
:
591 if (flags
& TDF_GIMPLE
)
593 pp_string (buffer
, "__BIT_INSERT (");
594 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
,
595 flags
| TDF_SLIM
, false);
596 pp_string (buffer
, ", ");
597 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
,
598 flags
| TDF_SLIM
, false);
599 pp_string (buffer
, ", ");
600 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
,
601 flags
| TDF_SLIM
, false);
602 pp_right_paren (buffer
);
606 pp_string (buffer
, "BIT_INSERT_EXPR <");
607 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
),
609 pp_string (buffer
, ", ");
610 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
),
612 pp_string (buffer
, ", ");
613 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
),
615 if (INTEGRAL_TYPE_P (TREE_TYPE (gimple_assign_rhs2 (gs
))))
617 pp_string (buffer
, " (");
618 pp_decimal_int (buffer
, TYPE_PRECISION
619 (TREE_TYPE (gimple_assign_rhs2 (gs
))));
620 pp_string (buffer
, " bits)");
632 /* Dump the gimple assignment GS. BUFFER, SPC and FLAGS are as in
636 dump_gimple_assign (pretty_printer
*buffer
, const gassign
*gs
, int spc
,
644 switch (gimple_num_ops (gs
))
647 arg3
= gimple_assign_rhs3 (gs
);
650 arg2
= gimple_assign_rhs2 (gs
);
653 arg1
= gimple_assign_rhs1 (gs
);
659 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%s, %T, %T, %T, %T>", gs
,
660 get_tree_code_name (gimple_assign_rhs_code (gs
)),
661 gimple_assign_lhs (gs
), arg1
, arg2
, arg3
);
665 if (!(flags
& TDF_RHS_ONLY
))
667 dump_generic_node (buffer
, gimple_assign_lhs (gs
), spc
, flags
, false);
671 if (gimple_assign_nontemporal_move_p (gs
))
672 pp_string (buffer
, "{nt}");
674 if (gimple_has_volatile_ops (gs
))
675 pp_string (buffer
, "{v}");
680 if (gimple_num_ops (gs
) == 2)
681 dump_unary_rhs (buffer
, gs
, spc
,
682 ((flags
& TDF_GIMPLE
)
683 && gimple_assign_rhs_class (gs
) != GIMPLE_SINGLE_RHS
)
684 ? (flags
| TDF_GIMPLE_VAL
) : flags
);
685 else if (gimple_num_ops (gs
) == 3)
686 dump_binary_rhs (buffer
, gs
, spc
,
688 ? (flags
| TDF_GIMPLE_VAL
) : flags
);
689 else if (gimple_num_ops (gs
) == 4)
690 dump_ternary_rhs (buffer
, gs
, spc
,
692 ? (flags
| TDF_GIMPLE_VAL
) : flags
);
695 if (!(flags
& TDF_RHS_ONLY
))
696 pp_semicolon (buffer
);
701 /* Dump the return statement GS. BUFFER, SPC and FLAGS are as in
705 dump_gimple_return (pretty_printer
*buffer
, const greturn
*gs
, int spc
,
710 t
= gimple_return_retval (gs
);
712 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
, t
);
715 pp_string (buffer
, "return");
719 dump_generic_node (buffer
, t
, spc
, flags
, false);
721 pp_semicolon (buffer
);
726 /* Dump the call arguments for a gimple call. BUFFER, FLAGS are as in
730 dump_gimple_call_args (pretty_printer
*buffer
, const gcall
*gs
,
735 /* Pretty print first arg to certain internal fns. */
736 if (gimple_call_internal_p (gs
))
738 const char *const *enums
= NULL
;
741 switch (gimple_call_internal_fn (gs
))
745 static const char *const unique_args
[] = {IFN_UNIQUE_CODES
};
749 limit
= ARRAY_SIZE (unique_args
);
754 static const char *const loop_args
[] = {IFN_GOACC_LOOP_CODES
};
757 limit
= ARRAY_SIZE (loop_args
);
760 case IFN_GOACC_REDUCTION
:
762 static const char *const reduction_args
[]
763 = {IFN_GOACC_REDUCTION_CODES
};
765 enums
= reduction_args
;
766 limit
= ARRAY_SIZE (reduction_args
);
769 case IFN_HWASAN_MARK
:
772 static const char *const asan_mark_args
[] = {IFN_ASAN_MARK_FLAGS
};
774 enums
= asan_mark_args
;
775 limit
= ARRAY_SIZE (asan_mark_args
);
783 tree arg0
= gimple_call_arg (gs
, 0);
786 if (TREE_CODE (arg0
) == INTEGER_CST
787 && tree_fits_shwi_p (arg0
)
788 && (v
= tree_to_shwi (arg0
)) >= 0 && v
< limit
)
791 pp_string (buffer
, enums
[v
]);
796 for (; i
< gimple_call_num_args (gs
); i
++)
799 pp_string (buffer
, ", ");
800 dump_generic_node (buffer
, gimple_call_arg (gs
, i
), 0, flags
, false);
803 if (gimple_call_va_arg_pack_p (gs
))
806 pp_string (buffer
, ", ");
808 pp_string (buffer
, "__builtin_va_arg_pack ()");
812 /* Dump the points-to solution *PT to BUFFER. */
815 pp_points_to_solution (pretty_printer
*buffer
, const pt_solution
*pt
)
819 pp_string (buffer
, "anything ");
823 pp_string (buffer
, "nonlocal ");
825 pp_string (buffer
, "escaped ");
827 pp_string (buffer
, "unit-escaped ");
829 pp_string (buffer
, "null ");
831 && !bitmap_empty_p (pt
->vars
))
835 pp_string (buffer
, "{ ");
836 EXECUTE_IF_SET_IN_BITMAP (pt
->vars
, 0, i
, bi
)
838 pp_string (buffer
, "D.");
839 pp_decimal_int (buffer
, i
);
842 pp_right_brace (buffer
);
843 if (pt
->vars_contains_nonlocal
844 || pt
->vars_contains_escaped
845 || pt
->vars_contains_escaped_heap
846 || pt
->vars_contains_restrict
)
848 const char *comma
= "";
849 pp_string (buffer
, " (");
850 if (pt
->vars_contains_nonlocal
)
852 pp_string (buffer
, "nonlocal");
855 if (pt
->vars_contains_escaped
)
857 pp_string (buffer
, comma
);
858 pp_string (buffer
, "escaped");
861 if (pt
->vars_contains_escaped_heap
)
863 pp_string (buffer
, comma
);
864 pp_string (buffer
, "escaped heap");
867 if (pt
->vars_contains_restrict
)
869 pp_string (buffer
, comma
);
870 pp_string (buffer
, "restrict");
873 if (pt
->vars_contains_interposable
)
875 pp_string (buffer
, comma
);
876 pp_string (buffer
, "interposable");
878 pp_string (buffer
, ")");
884 /* Dump the call statement GS. BUFFER, SPC and FLAGS are as in
888 dump_gimple_call (pretty_printer
*buffer
, const gcall
*gs
, int spc
,
891 tree lhs
= gimple_call_lhs (gs
);
892 tree fn
= gimple_call_fn (gs
);
894 if (flags
& TDF_ALIAS
)
896 const pt_solution
*pt
;
897 pt
= gimple_call_use_set (gs
);
898 if (!pt_solution_empty_p (pt
))
900 pp_string (buffer
, "# USE = ");
901 pp_points_to_solution (buffer
, pt
);
902 newline_and_indent (buffer
, spc
);
904 pt
= gimple_call_clobber_set (gs
);
905 if (!pt_solution_empty_p (pt
))
907 pp_string (buffer
, "# CLB = ");
908 pp_points_to_solution (buffer
, pt
);
909 newline_and_indent (buffer
, spc
);
915 if (gimple_call_internal_p (gs
))
916 dump_gimple_fmt (buffer
, spc
, flags
, "%G <.%s, %T", gs
,
917 internal_fn_name (gimple_call_internal_fn (gs
)), lhs
);
919 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T", gs
, fn
, lhs
);
920 if (gimple_call_num_args (gs
) > 0)
922 pp_string (buffer
, ", ");
923 dump_gimple_call_args (buffer
, gs
, flags
);
929 if (lhs
&& !(flags
& TDF_RHS_ONLY
))
931 dump_generic_node (buffer
, lhs
, spc
, flags
, false);
932 pp_string (buffer
, " =");
934 if (gimple_has_volatile_ops (gs
))
935 pp_string (buffer
, "{v}");
939 if (gimple_call_internal_p (gs
))
942 pp_string (buffer
, internal_fn_name (gimple_call_internal_fn (gs
)));
945 print_call_name (buffer
, fn
, flags
);
946 pp_string (buffer
, " (");
947 dump_gimple_call_args (buffer
, gs
, flags
);
948 pp_right_paren (buffer
);
949 if (!(flags
& TDF_RHS_ONLY
))
950 pp_semicolon (buffer
);
953 if (gimple_call_chain (gs
))
955 pp_string (buffer
, " [static-chain: ");
956 dump_generic_node (buffer
, gimple_call_chain (gs
), spc
, flags
, false);
957 pp_right_bracket (buffer
);
960 if (gimple_call_return_slot_opt_p (gs
))
961 pp_string (buffer
, " [return slot optimization]");
962 if (gimple_call_tail_p (gs
))
963 pp_string (buffer
, " [tail call]");
964 if (gimple_call_must_tail_p (gs
))
965 pp_string (buffer
, " [must tail call]");
970 /* Dump the arguments of _ITM_beginTransaction sanely. */
971 if (TREE_CODE (fn
) == ADDR_EXPR
)
972 fn
= TREE_OPERAND (fn
, 0);
973 if (TREE_CODE (fn
) == FUNCTION_DECL
&& decl_is_tm_clone (fn
))
974 pp_string (buffer
, " [tm-clone]");
975 if (TREE_CODE (fn
) == FUNCTION_DECL
976 && fndecl_built_in_p (fn
, BUILT_IN_TM_START
)
977 && gimple_call_num_args (gs
) > 0)
979 tree t
= gimple_call_arg (gs
, 0);
980 unsigned HOST_WIDE_INT props
;
981 gcc_assert (TREE_CODE (t
) == INTEGER_CST
);
983 pp_string (buffer
, " [ ");
985 /* Get the transaction code properties. */
986 props
= TREE_INT_CST_LOW (t
);
988 if (props
& PR_INSTRUMENTEDCODE
)
989 pp_string (buffer
, "instrumentedCode ");
990 if (props
& PR_UNINSTRUMENTEDCODE
)
991 pp_string (buffer
, "uninstrumentedCode ");
992 if (props
& PR_HASNOXMMUPDATE
)
993 pp_string (buffer
, "hasNoXMMUpdate ");
994 if (props
& PR_HASNOABORT
)
995 pp_string (buffer
, "hasNoAbort ");
996 if (props
& PR_HASNOIRREVOCABLE
)
997 pp_string (buffer
, "hasNoIrrevocable ");
998 if (props
& PR_DOESGOIRREVOCABLE
)
999 pp_string (buffer
, "doesGoIrrevocable ");
1000 if (props
& PR_HASNOSIMPLEREADS
)
1001 pp_string (buffer
, "hasNoSimpleReads ");
1002 if (props
& PR_AWBARRIERSOMITTED
)
1003 pp_string (buffer
, "awBarriersOmitted ");
1004 if (props
& PR_RARBARRIERSOMITTED
)
1005 pp_string (buffer
, "RaRBarriersOmitted ");
1006 if (props
& PR_UNDOLOGCODE
)
1007 pp_string (buffer
, "undoLogCode ");
1008 if (props
& PR_PREFERUNINSTRUMENTED
)
1009 pp_string (buffer
, "preferUninstrumented ");
1010 if (props
& PR_EXCEPTIONBLOCK
)
1011 pp_string (buffer
, "exceptionBlock ");
1012 if (props
& PR_HASELSE
)
1013 pp_string (buffer
, "hasElse ");
1014 if (props
& PR_READONLY
)
1015 pp_string (buffer
, "readOnly ");
1017 pp_right_bracket (buffer
);
1022 /* Dump the switch statement GS. BUFFER, SPC and FLAGS are as in
1023 pp_gimple_stmt_1. */
1026 dump_gimple_switch (pretty_printer
*buffer
, const gswitch
*gs
, int spc
,
1031 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
1032 if (flags
& TDF_RAW
)
1033 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, ", gs
,
1034 gimple_switch_index (gs
));
1037 pp_string (buffer
, "switch (");
1038 dump_generic_node (buffer
, gimple_switch_index (gs
), spc
, flags
, true);
1039 if (flags
& TDF_GIMPLE
)
1040 pp_string (buffer
, ") {");
1042 pp_string (buffer
, ") <");
1045 for (i
= 0; i
< gimple_switch_num_labels (gs
); i
++)
1047 tree case_label
= gimple_switch_label (gs
, i
);
1048 gcc_checking_assert (case_label
!= NULL_TREE
);
1049 dump_generic_node (buffer
, case_label
, spc
, flags
, false);
1051 tree label
= CASE_LABEL (case_label
);
1052 dump_generic_node (buffer
, label
, spc
, flags
, false);
1054 if (cfun
&& cfun
->cfg
)
1056 basic_block dest
= label_to_block (cfun
, label
);
1059 edge label_edge
= find_edge (gimple_bb (gs
), dest
);
1060 if (label_edge
&& !(flags
& TDF_GIMPLE
))
1061 dump_edge_probability (buffer
, label_edge
);
1065 if (i
< gimple_switch_num_labels (gs
) - 1)
1067 if (flags
& TDF_GIMPLE
)
1068 pp_string (buffer
, "; ");
1070 pp_string (buffer
, ", ");
1073 if (flags
& TDF_GIMPLE
)
1074 pp_string (buffer
, "; }");
1076 pp_greater (buffer
);
1080 /* Dump the gimple conditional GS. BUFFER, SPC and FLAGS are as in
1081 pp_gimple_stmt_1. */
1084 dump_gimple_cond (pretty_printer
*buffer
, const gcond
*gs
, int spc
,
1087 if (flags
& TDF_RAW
)
1088 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%s, %T, %T, %T, %T>", gs
,
1089 get_tree_code_name (gimple_cond_code (gs
)),
1090 gimple_cond_lhs (gs
), gimple_cond_rhs (gs
),
1091 gimple_cond_true_label (gs
), gimple_cond_false_label (gs
));
1094 if (!(flags
& TDF_RHS_ONLY
))
1095 pp_string (buffer
, "if (");
1096 dump_generic_node (buffer
, gimple_cond_lhs (gs
), spc
,
1097 flags
| ((flags
& TDF_GIMPLE
) ? TDF_GIMPLE_VAL
: TDF_NONE
),
1100 pp_string (buffer
, op_symbol_code (gimple_cond_code (gs
)));
1102 dump_generic_node (buffer
, gimple_cond_rhs (gs
), spc
,
1103 flags
| ((flags
& TDF_GIMPLE
) ? TDF_GIMPLE_VAL
: TDF_NONE
),
1105 if (!(flags
& TDF_RHS_ONLY
))
1108 edge e
, true_edge
= NULL
, false_edge
= NULL
;
1109 basic_block bb
= gimple_bb (gs
);
1113 FOR_EACH_EDGE (e
, ei
, bb
->succs
)
1115 if (e
->flags
& EDGE_TRUE_VALUE
)
1117 else if (e
->flags
& EDGE_FALSE_VALUE
)
1122 bool has_edge_info
= true_edge
!= NULL
&& false_edge
!= NULL
;
1124 pp_right_paren (buffer
);
1126 if (gimple_cond_true_label (gs
))
1128 pp_string (buffer
, " goto ");
1129 dump_generic_node (buffer
, gimple_cond_true_label (gs
),
1131 if (has_edge_info
&& !(flags
& TDF_GIMPLE
))
1132 dump_edge_probability (buffer
, true_edge
);
1133 pp_semicolon (buffer
);
1135 if (gimple_cond_false_label (gs
))
1137 pp_string (buffer
, " else goto ");
1138 dump_generic_node (buffer
, gimple_cond_false_label (gs
),
1140 if (has_edge_info
&& !(flags
& TDF_GIMPLE
))
1141 dump_edge_probability (buffer
, false_edge
);
1143 pp_semicolon (buffer
);
1150 /* Dump a GIMPLE_LABEL tuple on the pretty_printer BUFFER, SPC
1151 spaces of indent. FLAGS specifies details to show in the dump (see
1152 TDF_* in dumpfils.h). */
1155 dump_gimple_label (pretty_printer
*buffer
, const glabel
*gs
, int spc
,
1158 tree label
= gimple_label_label (gs
);
1159 if (flags
& TDF_RAW
)
1160 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
, label
);
1163 dump_generic_node (buffer
, label
, spc
, flags
, false);
1166 if (flags
& TDF_GIMPLE
)
1168 if (DECL_NONLOCAL (label
))
1169 pp_string (buffer
, " [non-local]");
1170 if ((flags
& TDF_EH
) && EH_LANDING_PAD_NR (label
))
1171 pp_printf (buffer
, " [LP %d]", EH_LANDING_PAD_NR (label
));
1174 /* Dump a GIMPLE_GOTO tuple on the pretty_printer BUFFER, SPC
1175 spaces of indent. FLAGS specifies details to show in the dump (see
1176 TDF_* in dumpfile.h). */
1179 dump_gimple_goto (pretty_printer
*buffer
, const ggoto
*gs
, int spc
,
1182 tree label
= gimple_goto_dest (gs
);
1183 if (flags
& TDF_RAW
)
1184 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
, label
);
1186 dump_gimple_fmt (buffer
, spc
, flags
, "goto %T;", label
);
1190 /* Dump a GIMPLE_BIND tuple on the pretty_printer BUFFER, SPC
1191 spaces of indent. FLAGS specifies details to show in the dump (see
1192 TDF_* in dumpfile.h). */
1195 dump_gimple_bind (pretty_printer
*buffer
, const gbind
*gs
, int spc
,
1198 if (flags
& TDF_RAW
)
1199 dump_gimple_fmt (buffer
, spc
, flags
, "%G <", gs
);
1201 pp_left_brace (buffer
);
1202 if (!(flags
& TDF_SLIM
))
1206 for (var
= gimple_bind_vars (gs
); var
; var
= DECL_CHAIN (var
))
1208 newline_and_indent (buffer
, 2);
1209 print_declaration (buffer
, var
, spc
, flags
);
1211 if (gimple_bind_vars (gs
))
1212 pp_newline (buffer
);
1214 pp_newline (buffer
);
1215 dump_gimple_seq (buffer
, gimple_bind_body (gs
), spc
+ 2, flags
);
1216 newline_and_indent (buffer
, spc
);
1217 if (flags
& TDF_RAW
)
1218 pp_greater (buffer
);
1220 pp_right_brace (buffer
);
1224 /* Dump a GIMPLE_TRY tuple on the pretty_printer BUFFER, SPC spaces of
1225 indent. FLAGS specifies details to show in the dump (see TDF_* in
1229 dump_gimple_try (pretty_printer
*buffer
, const gtry
*gs
, int spc
,
1232 if (flags
& TDF_RAW
)
1235 if (gimple_try_kind (gs
) == GIMPLE_TRY_CATCH
)
1236 type
= "GIMPLE_TRY_CATCH";
1237 else if (gimple_try_kind (gs
) == GIMPLE_TRY_FINALLY
)
1238 type
= "GIMPLE_TRY_FINALLY";
1240 type
= "UNKNOWN GIMPLE_TRY";
1241 dump_gimple_fmt (buffer
, spc
, flags
,
1242 "%G <%s,%+EVAL <%S>%nCLEANUP <%S>%->", gs
, type
,
1243 gimple_try_eval (gs
), gimple_try_cleanup (gs
));
1247 pp_string (buffer
, "try");
1248 newline_and_indent (buffer
, spc
+ 2);
1249 pp_left_brace (buffer
);
1250 pp_newline (buffer
);
1252 dump_gimple_seq (buffer
, gimple_try_eval (gs
), spc
+ 4, flags
);
1253 newline_and_indent (buffer
, spc
+ 2);
1254 pp_right_brace (buffer
);
1256 gimple_seq seq
= gimple_try_cleanup (gs
);
1258 if (gimple_try_kind (gs
) == GIMPLE_TRY_CATCH
)
1260 newline_and_indent (buffer
, spc
);
1261 pp_string (buffer
, "catch");
1262 newline_and_indent (buffer
, spc
+ 2);
1263 pp_left_brace (buffer
);
1265 else if (gimple_try_kind (gs
) == GIMPLE_TRY_FINALLY
)
1267 newline_and_indent (buffer
, spc
);
1268 pp_string (buffer
, "finally");
1269 newline_and_indent (buffer
, spc
+ 2);
1270 pp_left_brace (buffer
);
1272 if (seq
&& is_a
<geh_else
*> (gimple_seq_first_stmt (seq
))
1273 && gimple_seq_nondebug_singleton_p (seq
))
1275 geh_else
*stmt
= as_a
<geh_else
*> (gimple_seq_first_stmt (seq
));
1276 seq
= gimple_eh_else_n_body (stmt
);
1277 pp_newline (buffer
);
1278 dump_gimple_seq (buffer
, seq
, spc
+ 4, flags
);
1279 newline_and_indent (buffer
, spc
+ 2);
1280 pp_right_brace (buffer
);
1281 seq
= gimple_eh_else_e_body (stmt
);
1282 newline_and_indent (buffer
, spc
);
1283 pp_string (buffer
, "else");
1284 newline_and_indent (buffer
, spc
+ 2);
1285 pp_left_brace (buffer
);
1289 pp_string (buffer
, " <UNKNOWN GIMPLE_TRY> {");
1291 pp_newline (buffer
);
1292 dump_gimple_seq (buffer
, seq
, spc
+ 4, flags
);
1293 newline_and_indent (buffer
, spc
+ 2);
1294 pp_right_brace (buffer
);
1299 /* Dump a GIMPLE_CATCH tuple on the pretty_printer BUFFER, SPC spaces of
1300 indent. FLAGS specifies details to show in the dump (see TDF_* in
1304 dump_gimple_catch (pretty_printer
*buffer
, const gcatch
*gs
, int spc
,
1307 if (flags
& TDF_RAW
)
1308 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %+CATCH <%S>%->", gs
,
1309 gimple_catch_types (gs
), gimple_catch_handler (gs
));
1311 dump_gimple_fmt (buffer
, spc
, flags
, "catch (%T)%+{%S}",
1312 gimple_catch_types (gs
), gimple_catch_handler (gs
));
1316 /* Dump a GIMPLE_EH_FILTER tuple on the pretty_printer BUFFER, SPC spaces of
1317 indent. FLAGS specifies details to show in the dump (see TDF_* in
1321 dump_gimple_eh_filter (pretty_printer
*buffer
, const geh_filter
*gs
, int spc
,
1324 if (flags
& TDF_RAW
)
1325 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %+FAILURE <%S>%->", gs
,
1326 gimple_eh_filter_types (gs
),
1327 gimple_eh_filter_failure (gs
));
1329 dump_gimple_fmt (buffer
, spc
, flags
, "<<<eh_filter (%T)>>>%+{%+%S%-}",
1330 gimple_eh_filter_types (gs
),
1331 gimple_eh_filter_failure (gs
));
1335 /* Dump a GIMPLE_EH_MUST_NOT_THROW tuple. */
1338 dump_gimple_eh_must_not_throw (pretty_printer
*buffer
,
1339 const geh_mnt
*gs
, int spc
, dump_flags_t flags
)
1341 if (flags
& TDF_RAW
)
1342 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
,
1343 gimple_eh_must_not_throw_fndecl (gs
));
1345 dump_gimple_fmt (buffer
, spc
, flags
, "<<<eh_must_not_throw (%T)>>>",
1346 gimple_eh_must_not_throw_fndecl (gs
));
1350 /* Dump a GIMPLE_EH_ELSE tuple on the pretty_printer BUFFER, SPC spaces of
1351 indent. FLAGS specifies details to show in the dump (see TDF_* in
1355 dump_gimple_eh_else (pretty_printer
*buffer
, const geh_else
*gs
, int spc
,
1358 if (flags
& TDF_RAW
)
1359 dump_gimple_fmt (buffer
, spc
, flags
,
1360 "%G <%+N_BODY <%S>%nE_BODY <%S>%->", gs
,
1361 gimple_eh_else_n_body (gs
), gimple_eh_else_e_body (gs
));
1363 dump_gimple_fmt (buffer
, spc
, flags
,
1364 "<<<if_normal_exit>>>%+{%S}%-<<<else_eh_exit>>>%+{%S}",
1365 gimple_eh_else_n_body (gs
), gimple_eh_else_e_body (gs
));
1369 /* Dump a GIMPLE_RESX tuple on the pretty_printer BUFFER, SPC spaces of
1370 indent. FLAGS specifies details to show in the dump (see TDF_* in
1374 dump_gimple_resx (pretty_printer
*buffer
, const gresx
*gs
, int spc
,
1377 if (flags
& TDF_RAW
)
1378 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%d>", gs
,
1379 gimple_resx_region (gs
));
1381 dump_gimple_fmt (buffer
, spc
, flags
, "resx %d", gimple_resx_region (gs
));
1384 /* Dump a GIMPLE_EH_DISPATCH tuple on the pretty_printer BUFFER. */
1387 dump_gimple_eh_dispatch (pretty_printer
*buffer
, const geh_dispatch
*gs
,
1388 int spc
, dump_flags_t flags
)
1390 if (flags
& TDF_RAW
)
1391 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%d>", gs
,
1392 gimple_eh_dispatch_region (gs
));
1394 dump_gimple_fmt (buffer
, spc
, flags
, "eh_dispatch %d",
1395 gimple_eh_dispatch_region (gs
));
1398 /* Dump a GIMPLE_DEBUG tuple on the pretty_printer BUFFER, SPC spaces
1399 of indent. FLAGS specifies details to show in the dump (see TDF_*
1403 dump_gimple_debug (pretty_printer
*buffer
, const gdebug
*gs
, int spc
,
1406 switch (gs
->subcode
)
1408 case GIMPLE_DEBUG_BIND
:
1409 if (flags
& TDF_RAW
)
1410 dump_gimple_fmt (buffer
, spc
, flags
, "%G BIND <%T, %T>", gs
,
1411 gimple_debug_bind_get_var (gs
),
1412 gimple_debug_bind_get_value (gs
));
1414 dump_gimple_fmt (buffer
, spc
, flags
, "# DEBUG %T => %T",
1415 gimple_debug_bind_get_var (gs
),
1416 gimple_debug_bind_get_value (gs
));
1419 case GIMPLE_DEBUG_SOURCE_BIND
:
1420 if (flags
& TDF_RAW
)
1421 dump_gimple_fmt (buffer
, spc
, flags
, "%G SRCBIND <%T, %T>", gs
,
1422 gimple_debug_source_bind_get_var (gs
),
1423 gimple_debug_source_bind_get_value (gs
));
1425 dump_gimple_fmt (buffer
, spc
, flags
, "# DEBUG %T s=> %T",
1426 gimple_debug_source_bind_get_var (gs
),
1427 gimple_debug_source_bind_get_value (gs
));
1430 case GIMPLE_DEBUG_BEGIN_STMT
:
1431 if (flags
& TDF_RAW
)
1432 dump_gimple_fmt (buffer
, spc
, flags
, "%G BEGIN_STMT", gs
);
1434 dump_gimple_fmt (buffer
, spc
, flags
, "# DEBUG BEGIN_STMT");
1437 case GIMPLE_DEBUG_INLINE_ENTRY
:
1438 if (flags
& TDF_RAW
)
1439 dump_gimple_fmt (buffer
, spc
, flags
, "%G INLINE_ENTRY %T", gs
,
1441 ? block_ultimate_origin (gimple_block (gs
))
1444 dump_gimple_fmt (buffer
, spc
, flags
, "# DEBUG INLINE_ENTRY %T",
1446 ? block_ultimate_origin (gimple_block (gs
))
1455 /* Dump a GIMPLE_OMP_FOR tuple on the pretty_printer BUFFER. */
1457 dump_gimple_omp_for (pretty_printer
*buffer
, const gomp_for
*gs
, int spc
,
1462 if (flags
& TDF_RAW
)
1465 switch (gimple_omp_for_kind (gs
))
1467 case GF_OMP_FOR_KIND_FOR
:
1470 case GF_OMP_FOR_KIND_DISTRIBUTE
:
1471 kind
= " distribute";
1473 case GF_OMP_FOR_KIND_TASKLOOP
:
1476 case GF_OMP_FOR_KIND_OACC_LOOP
:
1477 kind
= " oacc_loop";
1479 case GF_OMP_FOR_KIND_SIMD
:
1485 dump_gimple_fmt (buffer
, spc
, flags
, "%G%s <%+BODY <%S>%nCLAUSES <", gs
,
1486 kind
, gimple_omp_body (gs
));
1487 dump_omp_clauses (buffer
, gimple_omp_for_clauses (gs
), spc
, flags
);
1488 dump_gimple_fmt (buffer
, spc
, flags
, " >,");
1489 for (i
= 0; i
< gimple_omp_for_collapse (gs
); i
++)
1490 dump_gimple_fmt (buffer
, spc
, flags
,
1491 "%+%T, %T, %T, %s, %T,%n",
1492 gimple_omp_for_index (gs
, i
),
1493 gimple_omp_for_initial (gs
, i
),
1494 gimple_omp_for_final (gs
, i
),
1495 get_tree_code_name (gimple_omp_for_cond (gs
, i
)),
1496 gimple_omp_for_incr (gs
, i
));
1497 dump_gimple_fmt (buffer
, spc
, flags
, "PRE_BODY <%S>%->",
1498 gimple_omp_for_pre_body (gs
));
1502 switch (gimple_omp_for_kind (gs
))
1504 case GF_OMP_FOR_KIND_FOR
:
1505 pp_string (buffer
, "#pragma omp for");
1507 case GF_OMP_FOR_KIND_DISTRIBUTE
:
1508 pp_string (buffer
, "#pragma omp distribute");
1510 case GF_OMP_FOR_KIND_TASKLOOP
:
1511 pp_string (buffer
, "#pragma omp taskloop");
1513 case GF_OMP_FOR_KIND_OACC_LOOP
:
1514 pp_string (buffer
, "#pragma acc loop");
1516 case GF_OMP_FOR_KIND_SIMD
:
1517 pp_string (buffer
, "#pragma omp simd");
1522 dump_omp_clauses (buffer
, gimple_omp_for_clauses (gs
), spc
, flags
);
1523 for (i
= 0; i
< gimple_omp_for_collapse (gs
); i
++)
1527 newline_and_indent (buffer
, spc
);
1528 pp_string (buffer
, "for (");
1529 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
1531 pp_string (buffer
, " = ");
1532 tree init
= gimple_omp_for_initial (gs
, i
);
1533 if (TREE_CODE (init
) != TREE_VEC
)
1534 dump_generic_node (buffer
, init
, spc
, flags
, false);
1536 dump_omp_loop_non_rect_expr (buffer
, init
, spc
, flags
);
1537 pp_string (buffer
, "; ");
1539 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
1542 switch (gimple_omp_for_cond (gs
, i
))
1548 pp_greater (buffer
);
1551 pp_less_equal (buffer
);
1554 pp_greater_equal (buffer
);
1557 pp_string (buffer
, "!=");
1563 tree cond
= gimple_omp_for_final (gs
, i
);
1564 if (TREE_CODE (cond
) != TREE_VEC
)
1565 dump_generic_node (buffer
, cond
, spc
, flags
, false);
1567 dump_omp_loop_non_rect_expr (buffer
, cond
, spc
, flags
);
1568 pp_string (buffer
, "; ");
1570 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
1572 pp_string (buffer
, " = ");
1573 dump_generic_node (buffer
, gimple_omp_for_incr (gs
, i
), spc
,
1575 pp_right_paren (buffer
);
1578 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1580 newline_and_indent (buffer
, spc
+ 2);
1581 pp_left_brace (buffer
);
1582 pp_newline (buffer
);
1583 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1584 newline_and_indent (buffer
, spc
+ 2);
1585 pp_right_brace (buffer
);
1590 /* Dump a GIMPLE_OMP_CONTINUE tuple on the pretty_printer BUFFER. */
1593 dump_gimple_omp_continue (pretty_printer
*buffer
, const gomp_continue
*gs
,
1594 int spc
, dump_flags_t flags
)
1596 if (flags
& TDF_RAW
)
1598 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T>", gs
,
1599 gimple_omp_continue_control_def (gs
),
1600 gimple_omp_continue_control_use (gs
));
1604 pp_string (buffer
, "#pragma omp continue (");
1605 dump_generic_node (buffer
, gimple_omp_continue_control_def (gs
),
1609 dump_generic_node (buffer
, gimple_omp_continue_control_use (gs
),
1611 pp_right_paren (buffer
);
1615 /* Dump a GIMPLE_OMP_SINGLE tuple on the pretty_printer BUFFER. */
1618 dump_gimple_omp_single (pretty_printer
*buffer
, const gomp_single
*gs
,
1619 int spc
, dump_flags_t flags
)
1621 if (flags
& TDF_RAW
)
1623 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1624 gimple_omp_body (gs
));
1625 dump_omp_clauses (buffer
, gimple_omp_single_clauses (gs
), spc
, flags
);
1626 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1630 pp_string (buffer
, "#pragma omp single");
1631 dump_omp_clauses (buffer
, gimple_omp_single_clauses (gs
), spc
, flags
);
1632 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1634 newline_and_indent (buffer
, spc
+ 2);
1635 pp_left_brace (buffer
);
1636 pp_newline (buffer
);
1637 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1638 newline_and_indent (buffer
, spc
+ 2);
1639 pp_right_brace (buffer
);
1644 /* Dump a GIMPLE_OMP_TASKGROUP tuple on the pretty_printer BUFFER. */
1647 dump_gimple_omp_taskgroup (pretty_printer
*buffer
, const gimple
*gs
,
1648 int spc
, dump_flags_t flags
)
1650 if (flags
& TDF_RAW
)
1652 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1653 gimple_omp_body (gs
));
1654 dump_omp_clauses (buffer
, gimple_omp_taskgroup_clauses (gs
), spc
, flags
);
1655 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1659 pp_string (buffer
, "#pragma omp taskgroup");
1660 dump_omp_clauses (buffer
, gimple_omp_taskgroup_clauses (gs
), spc
, flags
);
1661 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1663 newline_and_indent (buffer
, spc
+ 2);
1664 pp_left_brace (buffer
);
1665 pp_newline (buffer
);
1666 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1667 newline_and_indent (buffer
, spc
+ 2);
1668 pp_right_brace (buffer
);
1673 /* Dump a GIMPLE_OMP_MASKED tuple on the pretty_printer BUFFER. */
1676 dump_gimple_omp_masked (pretty_printer
*buffer
, const gimple
*gs
,
1677 int spc
, dump_flags_t flags
)
1679 if (flags
& TDF_RAW
)
1681 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1682 gimple_omp_body (gs
));
1683 dump_omp_clauses (buffer
, gimple_omp_masked_clauses (gs
), spc
, flags
);
1684 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1688 pp_string (buffer
, "#pragma omp masked");
1689 dump_omp_clauses (buffer
, gimple_omp_masked_clauses (gs
), spc
, flags
);
1690 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1692 newline_and_indent (buffer
, spc
+ 2);
1693 pp_left_brace (buffer
);
1694 pp_newline (buffer
);
1695 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1696 newline_and_indent (buffer
, spc
+ 2);
1697 pp_right_brace (buffer
);
1702 /* Dump a GIMPLE_OMP_SCOPE tuple on the pretty_printer BUFFER. */
1705 dump_gimple_omp_scope (pretty_printer
*buffer
, const gimple
*gs
,
1706 int spc
, dump_flags_t flags
)
1708 if (flags
& TDF_RAW
)
1710 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1711 gimple_omp_body (gs
));
1712 dump_omp_clauses (buffer
, gimple_omp_scope_clauses (gs
), spc
, flags
);
1713 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1717 pp_string (buffer
, "#pragma omp scope");
1718 dump_omp_clauses (buffer
, gimple_omp_scope_clauses (gs
), spc
, flags
);
1719 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1721 newline_and_indent (buffer
, spc
+ 2);
1722 pp_left_brace (buffer
);
1723 pp_newline (buffer
);
1724 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1725 newline_and_indent (buffer
, spc
+ 2);
1726 pp_right_brace (buffer
);
1731 /* Dump a GIMPLE_OMP_TARGET tuple on the pretty_printer BUFFER. */
1734 dump_gimple_omp_target (pretty_printer
*buffer
, const gomp_target
*gs
,
1735 int spc
, dump_flags_t flags
)
1738 switch (gimple_omp_target_kind (gs
))
1740 case GF_OMP_TARGET_KIND_REGION
:
1743 case GF_OMP_TARGET_KIND_DATA
:
1746 case GF_OMP_TARGET_KIND_UPDATE
:
1749 case GF_OMP_TARGET_KIND_ENTER_DATA
:
1750 kind
= " enter data";
1752 case GF_OMP_TARGET_KIND_EXIT_DATA
:
1753 kind
= " exit data";
1755 case GF_OMP_TARGET_KIND_OACC_KERNELS
:
1756 kind
= " oacc_kernels";
1758 case GF_OMP_TARGET_KIND_OACC_PARALLEL
:
1759 kind
= " oacc_parallel";
1761 case GF_OMP_TARGET_KIND_OACC_SERIAL
:
1762 kind
= " oacc_serial";
1764 case GF_OMP_TARGET_KIND_OACC_DATA
:
1765 kind
= " oacc_data";
1767 case GF_OMP_TARGET_KIND_OACC_UPDATE
:
1768 kind
= " oacc_update";
1770 case GF_OMP_TARGET_KIND_OACC_ENTER_DATA
:
1771 kind
= " oacc_enter_data";
1773 case GF_OMP_TARGET_KIND_OACC_EXIT_DATA
:
1774 kind
= " oacc_exit_data";
1776 case GF_OMP_TARGET_KIND_OACC_DECLARE
:
1777 kind
= " oacc_declare";
1779 case GF_OMP_TARGET_KIND_OACC_HOST_DATA
:
1780 kind
= " oacc_host_data";
1782 case GF_OMP_TARGET_KIND_OACC_PARALLEL_KERNELS_PARALLELIZED
:
1783 kind
= " oacc_parallel_kernels_parallelized";
1785 case GF_OMP_TARGET_KIND_OACC_PARALLEL_KERNELS_GANG_SINGLE
:
1786 kind
= " oacc_parallel_kernels_gang_single";
1788 case GF_OMP_TARGET_KIND_OACC_DATA_KERNELS
:
1789 kind
= " oacc_data_kernels";
1794 if (flags
& TDF_RAW
)
1796 dump_gimple_fmt (buffer
, spc
, flags
, "%G%s <%+BODY <%S>%nCLAUSES <", gs
,
1797 kind
, gimple_omp_body (gs
));
1798 dump_omp_clauses (buffer
, gimple_omp_target_clauses (gs
), spc
, flags
);
1799 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T%n>",
1800 gimple_omp_target_child_fn (gs
),
1801 gimple_omp_target_data_arg (gs
));
1805 pp_string (buffer
, "#pragma omp target");
1806 pp_string (buffer
, kind
);
1807 dump_omp_clauses (buffer
, gimple_omp_target_clauses (gs
), spc
, flags
);
1808 if (gimple_omp_target_child_fn (gs
))
1810 pp_string (buffer
, " [child fn: ");
1811 dump_generic_node (buffer
, gimple_omp_target_child_fn (gs
),
1813 pp_string (buffer
, " (");
1814 if (gimple_omp_target_data_arg (gs
))
1815 dump_generic_node (buffer
, gimple_omp_target_data_arg (gs
),
1818 pp_string (buffer
, "???");
1819 pp_string (buffer
, ")]");
1821 gimple_seq body
= gimple_omp_body (gs
);
1822 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
1824 newline_and_indent (buffer
, spc
+ 2);
1825 pp_left_brace (buffer
);
1826 pp_newline (buffer
);
1827 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
1828 newline_and_indent (buffer
, spc
+ 2);
1829 pp_right_brace (buffer
);
1833 pp_newline (buffer
);
1834 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
1839 /* Dump a GIMPLE_OMP_TEAMS tuple on the pretty_printer BUFFER. */
1842 dump_gimple_omp_teams (pretty_printer
*buffer
, const gomp_teams
*gs
, int spc
,
1845 if (flags
& TDF_RAW
)
1847 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1848 gimple_omp_body (gs
));
1849 dump_omp_clauses (buffer
, gimple_omp_teams_clauses (gs
), spc
, flags
);
1850 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1854 pp_string (buffer
, "#pragma omp teams");
1855 dump_omp_clauses (buffer
, gimple_omp_teams_clauses (gs
), spc
, flags
);
1856 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1858 newline_and_indent (buffer
, spc
+ 2);
1859 pp_character (buffer
, '{');
1860 pp_newline (buffer
);
1861 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1862 newline_and_indent (buffer
, spc
+ 2);
1863 pp_character (buffer
, '}');
1868 /* Dump a GIMPLE_OMP_SECTIONS tuple on the pretty_printer BUFFER. */
1871 dump_gimple_omp_sections (pretty_printer
*buffer
, const gomp_sections
*gs
,
1872 int spc
, dump_flags_t flags
)
1874 if (flags
& TDF_RAW
)
1876 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1877 gimple_omp_body (gs
));
1878 dump_omp_clauses (buffer
, gimple_omp_sections_clauses (gs
), spc
, flags
);
1879 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1883 pp_string (buffer
, "#pragma omp sections");
1884 if (gimple_omp_sections_control (gs
))
1886 pp_string (buffer
, " <");
1887 dump_generic_node (buffer
, gimple_omp_sections_control (gs
), spc
,
1889 pp_greater (buffer
);
1891 dump_omp_clauses (buffer
, gimple_omp_sections_clauses (gs
), spc
, flags
);
1892 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1894 newline_and_indent (buffer
, spc
+ 2);
1895 pp_left_brace (buffer
);
1896 pp_newline (buffer
);
1897 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1898 newline_and_indent (buffer
, spc
+ 2);
1899 pp_right_brace (buffer
);
1904 /* Dump a GIMPLE_OMP_{MASTER,ORDERED,SECTION} tuple on the
1905 pretty_printer BUFFER. */
1908 dump_gimple_omp_block (pretty_printer
*buffer
, const gimple
*gs
, int spc
,
1911 if (flags
& TDF_RAW
)
1912 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1913 gimple_omp_body (gs
));
1916 switch (gimple_code (gs
))
1918 case GIMPLE_OMP_MASTER
:
1919 pp_string (buffer
, "#pragma omp master");
1921 case GIMPLE_OMP_SECTION
:
1922 pp_string (buffer
, "#pragma omp section");
1927 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1929 newline_and_indent (buffer
, spc
+ 2);
1930 pp_left_brace (buffer
);
1931 pp_newline (buffer
);
1932 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1933 newline_and_indent (buffer
, spc
+ 2);
1934 pp_right_brace (buffer
);
1939 /* Dump a GIMPLE_OMP_CRITICAL tuple on the pretty_printer BUFFER. */
1942 dump_gimple_omp_critical (pretty_printer
*buffer
, const gomp_critical
*gs
,
1943 int spc
, dump_flags_t flags
)
1945 if (flags
& TDF_RAW
)
1946 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1947 gimple_omp_body (gs
));
1950 pp_string (buffer
, "#pragma omp critical");
1951 if (gimple_omp_critical_name (gs
))
1953 pp_string (buffer
, " (");
1954 dump_generic_node (buffer
, gimple_omp_critical_name (gs
), spc
,
1956 pp_right_paren (buffer
);
1958 dump_omp_clauses (buffer
, gimple_omp_critical_clauses (gs
), spc
, flags
);
1959 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1961 newline_and_indent (buffer
, spc
+ 2);
1962 pp_left_brace (buffer
);
1963 pp_newline (buffer
);
1964 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1965 newline_and_indent (buffer
, spc
+ 2);
1966 pp_right_brace (buffer
);
1971 /* Dump a GIMPLE_OMP_ORDERED tuple on the pretty_printer BUFFER. */
1974 dump_gimple_omp_ordered (pretty_printer
*buffer
, const gomp_ordered
*gs
,
1975 int spc
, dump_flags_t flags
)
1977 if (flags
& TDF_RAW
)
1978 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1979 gimple_omp_body (gs
));
1982 pp_string (buffer
, "#pragma omp ordered");
1983 dump_omp_clauses (buffer
, gimple_omp_ordered_clauses (gs
), spc
, flags
);
1984 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1986 newline_and_indent (buffer
, spc
+ 2);
1987 pp_left_brace (buffer
);
1988 pp_newline (buffer
);
1989 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1990 newline_and_indent (buffer
, spc
+ 2);
1991 pp_right_brace (buffer
);
1996 /* Dump a GIMPLE_OMP_SCAN tuple on the pretty_printer BUFFER. */
1999 dump_gimple_omp_scan (pretty_printer
*buffer
, const gomp_scan
*gs
,
2000 int spc
, dump_flags_t flags
)
2002 if (flags
& TDF_RAW
)
2003 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
2004 gimple_omp_body (gs
));
2007 if (gimple_omp_scan_clauses (gs
))
2009 pp_string (buffer
, "#pragma omp scan");
2010 dump_omp_clauses (buffer
, gimple_omp_scan_clauses (gs
), spc
, flags
);
2012 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
2014 newline_and_indent (buffer
, spc
+ 2);
2015 pp_left_brace (buffer
);
2016 pp_newline (buffer
);
2017 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
2018 newline_and_indent (buffer
, spc
+ 2);
2019 pp_right_brace (buffer
);
2024 /* Dump a GIMPLE_OMP_RETURN tuple on the pretty_printer BUFFER. */
2027 dump_gimple_omp_return (pretty_printer
*buffer
, const gimple
*gs
, int spc
,
2030 if (flags
& TDF_RAW
)
2032 dump_gimple_fmt (buffer
, spc
, flags
, "%G <nowait=%d", gs
,
2033 (int) gimple_omp_return_nowait_p (gs
));
2034 if (gimple_omp_return_lhs (gs
))
2035 dump_gimple_fmt (buffer
, spc
, flags
, ", lhs=%T>",
2036 gimple_omp_return_lhs (gs
));
2038 dump_gimple_fmt (buffer
, spc
, flags
, ">");
2042 pp_string (buffer
, "#pragma omp return");
2043 if (gimple_omp_return_nowait_p (gs
))
2044 pp_string (buffer
, "(nowait)");
2045 if (gimple_omp_return_lhs (gs
))
2047 pp_string (buffer
, " (set ");
2048 dump_generic_node (buffer
, gimple_omp_return_lhs (gs
),
2050 pp_character (buffer
, ')');
2055 /* Dump a GIMPLE_TRANSACTION tuple on the pretty_printer BUFFER. */
2058 dump_gimple_transaction (pretty_printer
*buffer
, const gtransaction
*gs
,
2059 int spc
, dump_flags_t flags
)
2061 unsigned subcode
= gimple_transaction_subcode (gs
);
2063 if (flags
& TDF_RAW
)
2065 dump_gimple_fmt (buffer
, spc
, flags
,
2066 "%G [SUBCODE=%x,NORM=%T,UNINST=%T,OVER=%T] "
2068 gs
, subcode
, gimple_transaction_label_norm (gs
),
2069 gimple_transaction_label_uninst (gs
),
2070 gimple_transaction_label_over (gs
),
2071 gimple_transaction_body (gs
));
2075 if (subcode
& GTMA_IS_OUTER
)
2076 pp_string (buffer
, "__transaction_atomic [[outer]]");
2077 else if (subcode
& GTMA_IS_RELAXED
)
2078 pp_string (buffer
, "__transaction_relaxed");
2080 pp_string (buffer
, "__transaction_atomic");
2081 subcode
&= ~GTMA_DECLARATION_MASK
;
2083 if (gimple_transaction_body (gs
))
2085 newline_and_indent (buffer
, spc
+ 2);
2086 pp_left_brace (buffer
);
2087 pp_newline (buffer
);
2088 dump_gimple_seq (buffer
, gimple_transaction_body (gs
),
2090 newline_and_indent (buffer
, spc
+ 2);
2091 pp_right_brace (buffer
);
2095 pp_string (buffer
, " //");
2096 if (gimple_transaction_label_norm (gs
))
2098 pp_string (buffer
, " NORM=");
2099 dump_generic_node (buffer
, gimple_transaction_label_norm (gs
),
2102 if (gimple_transaction_label_uninst (gs
))
2104 pp_string (buffer
, " UNINST=");
2105 dump_generic_node (buffer
, gimple_transaction_label_uninst (gs
),
2108 if (gimple_transaction_label_over (gs
))
2110 pp_string (buffer
, " OVER=");
2111 dump_generic_node (buffer
, gimple_transaction_label_over (gs
),
2116 pp_string (buffer
, " SUBCODE=[ ");
2117 if (subcode
& GTMA_HAVE_ABORT
)
2119 pp_string (buffer
, "GTMA_HAVE_ABORT ");
2120 subcode
&= ~GTMA_HAVE_ABORT
;
2122 if (subcode
& GTMA_HAVE_LOAD
)
2124 pp_string (buffer
, "GTMA_HAVE_LOAD ");
2125 subcode
&= ~GTMA_HAVE_LOAD
;
2127 if (subcode
& GTMA_HAVE_STORE
)
2129 pp_string (buffer
, "GTMA_HAVE_STORE ");
2130 subcode
&= ~GTMA_HAVE_STORE
;
2132 if (subcode
& GTMA_MAY_ENTER_IRREVOCABLE
)
2134 pp_string (buffer
, "GTMA_MAY_ENTER_IRREVOCABLE ");
2135 subcode
&= ~GTMA_MAY_ENTER_IRREVOCABLE
;
2137 if (subcode
& GTMA_DOES_GO_IRREVOCABLE
)
2139 pp_string (buffer
, "GTMA_DOES_GO_IRREVOCABLE ");
2140 subcode
&= ~GTMA_DOES_GO_IRREVOCABLE
;
2142 if (subcode
& GTMA_HAS_NO_INSTRUMENTATION
)
2144 pp_string (buffer
, "GTMA_HAS_NO_INSTRUMENTATION ");
2145 subcode
&= ~GTMA_HAS_NO_INSTRUMENTATION
;
2148 pp_printf (buffer
, "0x%x ", subcode
);
2149 pp_right_bracket (buffer
);
2155 /* Dump a GIMPLE_ASM tuple on the pretty_printer BUFFER, SPC spaces of
2156 indent. FLAGS specifies details to show in the dump (see TDF_* in
2160 dump_gimple_asm (pretty_printer
*buffer
, const gasm
*gs
, int spc
,
2163 unsigned int i
, n
, f
, fields
;
2165 if (flags
& TDF_RAW
)
2167 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+STRING <%n%s%n>", gs
,
2168 gimple_asm_string (gs
));
2170 n
= gimple_asm_noutputs (gs
);
2173 newline_and_indent (buffer
, spc
+ 2);
2174 pp_string (buffer
, "OUTPUT: ");
2175 for (i
= 0; i
< n
; i
++)
2177 dump_generic_node (buffer
, gimple_asm_output_op (gs
, i
),
2180 pp_string (buffer
, ", ");
2184 n
= gimple_asm_ninputs (gs
);
2187 newline_and_indent (buffer
, spc
+ 2);
2188 pp_string (buffer
, "INPUT: ");
2189 for (i
= 0; i
< n
; i
++)
2191 dump_generic_node (buffer
, gimple_asm_input_op (gs
, i
),
2194 pp_string (buffer
, ", ");
2198 n
= gimple_asm_nclobbers (gs
);
2201 newline_and_indent (buffer
, spc
+ 2);
2202 pp_string (buffer
, "CLOBBER: ");
2203 for (i
= 0; i
< n
; i
++)
2205 dump_generic_node (buffer
, gimple_asm_clobber_op (gs
, i
),
2208 pp_string (buffer
, ", ");
2212 n
= gimple_asm_nlabels (gs
);
2215 newline_and_indent (buffer
, spc
+ 2);
2216 pp_string (buffer
, "LABEL: ");
2217 for (i
= 0; i
< n
; i
++)
2219 dump_generic_node (buffer
, gimple_asm_label_op (gs
, i
),
2222 pp_string (buffer
, ", ");
2226 newline_and_indent (buffer
, spc
);
2227 pp_greater (buffer
);
2231 pp_string (buffer
, "__asm__");
2232 if (gimple_asm_volatile_p (gs
))
2233 pp_string (buffer
, " __volatile__");
2234 if (gimple_asm_inline_p (gs
))
2235 pp_string (buffer
, " __inline__");
2236 if (gimple_asm_nlabels (gs
))
2237 pp_string (buffer
, " goto");
2238 pp_string (buffer
, "(\"");
2239 pp_string (buffer
, gimple_asm_string (gs
));
2240 pp_string (buffer
, "\"");
2242 if (gimple_asm_nlabels (gs
))
2244 else if (gimple_asm_nclobbers (gs
))
2246 else if (gimple_asm_ninputs (gs
))
2248 else if (gimple_asm_noutputs (gs
))
2253 for (f
= 0; f
< fields
; ++f
)
2255 pp_string (buffer
, " : ");
2260 n
= gimple_asm_noutputs (gs
);
2261 for (i
= 0; i
< n
; i
++)
2263 dump_generic_node (buffer
, gimple_asm_output_op (gs
, i
),
2266 pp_string (buffer
, ", ");
2271 n
= gimple_asm_ninputs (gs
);
2272 for (i
= 0; i
< n
; i
++)
2274 dump_generic_node (buffer
, gimple_asm_input_op (gs
, i
),
2277 pp_string (buffer
, ", ");
2282 n
= gimple_asm_nclobbers (gs
);
2283 for (i
= 0; i
< n
; i
++)
2285 dump_generic_node (buffer
, gimple_asm_clobber_op (gs
, i
),
2288 pp_string (buffer
, ", ");
2293 n
= gimple_asm_nlabels (gs
);
2294 for (i
= 0; i
< n
; i
++)
2296 dump_generic_node (buffer
, gimple_asm_label_op (gs
, i
),
2299 pp_string (buffer
, ", ");
2308 pp_string (buffer
, ");");
2312 /* Dump ptr_info and range_info for NODE on pretty_printer BUFFER with
2313 SPC spaces of indent. */
2316 dump_ssaname_info (pretty_printer
*buffer
, tree node
, int spc
)
2318 if (TREE_CODE (node
) != SSA_NAME
)
2321 if (POINTER_TYPE_P (TREE_TYPE (node
))
2322 && SSA_NAME_PTR_INFO (node
))
2324 unsigned int align
, misalign
;
2325 struct ptr_info_def
*pi
= SSA_NAME_PTR_INFO (node
);
2326 pp_string (buffer
, "# PT = ");
2327 pp_points_to_solution (buffer
, &pi
->pt
);
2328 newline_and_indent (buffer
, spc
);
2329 if (get_ptr_info_alignment (pi
, &align
, &misalign
))
2331 pp_printf (buffer
, "# ALIGN = %u, MISALIGN = %u", align
, misalign
);
2332 newline_and_indent (buffer
, spc
);
2336 if (!POINTER_TYPE_P (TREE_TYPE (node
))
2337 && SSA_NAME_RANGE_INFO (node
))
2339 Value_Range
r (TREE_TYPE (node
));
2340 get_global_range_query ()->range_of_expr (r
, node
);
2341 pp_string (buffer
, "# RANGE ");
2342 pp_vrange (buffer
, &r
);
2343 newline_and_indent (buffer
, spc
);
2347 /* As dump_ssaname_info, but dump to FILE. */
2350 dump_ssaname_info_to_file (FILE *file
, tree node
, int spc
)
2352 pretty_printer buffer
;
2353 pp_needs_newline (&buffer
) = true;
2354 buffer
.buffer
->stream
= file
;
2355 dump_ssaname_info (&buffer
, node
, spc
);
2359 /* Dump a PHI node PHI. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1.
2360 The caller is responsible for calling pp_flush on BUFFER to finalize
2361 pretty printer. If COMMENT is true, print this after #. */
2364 dump_gimple_phi (pretty_printer
*buffer
, const gphi
*phi
, int spc
, bool comment
,
2368 tree lhs
= gimple_phi_result (phi
);
2370 if (flags
& TDF_ALIAS
)
2371 dump_ssaname_info (buffer
, lhs
, spc
);
2374 pp_string (buffer
, "# ");
2376 if (flags
& TDF_RAW
)
2377 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, ", phi
,
2378 gimple_phi_result (phi
));
2381 dump_generic_node (buffer
, lhs
, spc
, flags
, false);
2382 if (flags
& TDF_GIMPLE
)
2383 pp_string (buffer
, " = __PHI (");
2385 pp_string (buffer
, " = PHI <");
2387 for (i
= 0; i
< gimple_phi_num_args (phi
); i
++)
2389 if ((flags
& TDF_LINENO
) && gimple_phi_arg_has_location (phi
, i
))
2390 dump_location (buffer
, gimple_phi_arg_location (phi
, i
));
2391 basic_block src
= gimple_phi_arg_edge (phi
, i
)->src
;
2392 if (flags
& TDF_GIMPLE
)
2394 pp_string (buffer
, "__BB");
2395 pp_decimal_int (buffer
, src
->index
);
2396 pp_string (buffer
, ": ");
2398 dump_generic_node (buffer
, gimple_phi_arg_def (phi
, i
), spc
, flags
,
2400 if (! (flags
& TDF_GIMPLE
))
2402 pp_left_paren (buffer
);
2403 pp_decimal_int (buffer
, src
->index
);
2404 pp_right_paren (buffer
);
2406 if (i
< gimple_phi_num_args (phi
) - 1)
2407 pp_string (buffer
, ", ");
2409 if (flags
& TDF_GIMPLE
)
2410 pp_string (buffer
, ");");
2412 pp_greater (buffer
);
2416 /* Dump a GIMPLE_OMP_PARALLEL tuple on the pretty_printer BUFFER, SPC spaces
2417 of indent. FLAGS specifies details to show in the dump (see TDF_* in
2421 dump_gimple_omp_parallel (pretty_printer
*buffer
, const gomp_parallel
*gs
,
2422 int spc
, dump_flags_t flags
)
2424 if (flags
& TDF_RAW
)
2426 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
2427 gimple_omp_body (gs
));
2428 dump_omp_clauses (buffer
, gimple_omp_parallel_clauses (gs
), spc
, flags
);
2429 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T%n>",
2430 gimple_omp_parallel_child_fn (gs
),
2431 gimple_omp_parallel_data_arg (gs
));
2436 pp_string (buffer
, "#pragma omp parallel");
2437 dump_omp_clauses (buffer
, gimple_omp_parallel_clauses (gs
), spc
, flags
);
2438 if (gimple_omp_parallel_child_fn (gs
))
2440 pp_string (buffer
, " [child fn: ");
2441 dump_generic_node (buffer
, gimple_omp_parallel_child_fn (gs
),
2443 pp_string (buffer
, " (");
2444 if (gimple_omp_parallel_data_arg (gs
))
2445 dump_generic_node (buffer
, gimple_omp_parallel_data_arg (gs
),
2448 pp_string (buffer
, "???");
2449 pp_string (buffer
, ")]");
2451 body
= gimple_omp_body (gs
);
2452 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
2454 newline_and_indent (buffer
, spc
+ 2);
2455 pp_left_brace (buffer
);
2456 pp_newline (buffer
);
2457 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
2458 newline_and_indent (buffer
, spc
+ 2);
2459 pp_right_brace (buffer
);
2463 pp_newline (buffer
);
2464 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
2470 /* Dump a GIMPLE_OMP_TASK tuple on the pretty_printer BUFFER, SPC spaces
2471 of indent. FLAGS specifies details to show in the dump (see TDF_* in
2475 dump_gimple_omp_task (pretty_printer
*buffer
, const gomp_task
*gs
, int spc
,
2478 if (flags
& TDF_RAW
)
2480 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
2481 gimple_omp_body (gs
));
2482 dump_omp_clauses (buffer
, gimple_omp_task_clauses (gs
), spc
, flags
);
2483 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T, %T, %T, %T%n>",
2484 gimple_omp_task_child_fn (gs
),
2485 gimple_omp_task_data_arg (gs
),
2486 gimple_omp_task_copy_fn (gs
),
2487 gimple_omp_task_arg_size (gs
),
2488 gimple_omp_task_arg_size (gs
));
2493 if (gimple_omp_task_taskloop_p (gs
))
2494 pp_string (buffer
, "#pragma omp taskloop");
2495 else if (gimple_omp_task_taskwait_p (gs
))
2496 pp_string (buffer
, "#pragma omp taskwait");
2498 pp_string (buffer
, "#pragma omp task");
2499 dump_omp_clauses (buffer
, gimple_omp_task_clauses (gs
), spc
, flags
);
2500 if (gimple_omp_task_child_fn (gs
))
2502 pp_string (buffer
, " [child fn: ");
2503 dump_generic_node (buffer
, gimple_omp_task_child_fn (gs
),
2505 pp_string (buffer
, " (");
2506 if (gimple_omp_task_data_arg (gs
))
2507 dump_generic_node (buffer
, gimple_omp_task_data_arg (gs
),
2510 pp_string (buffer
, "???");
2511 pp_string (buffer
, ")]");
2513 body
= gimple_omp_body (gs
);
2514 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
2516 newline_and_indent (buffer
, spc
+ 2);
2517 pp_left_brace (buffer
);
2518 pp_newline (buffer
);
2519 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
2520 newline_and_indent (buffer
, spc
+ 2);
2521 pp_right_brace (buffer
);
2525 pp_newline (buffer
);
2526 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
2532 /* Dump a GIMPLE_OMP_ATOMIC_LOAD tuple on the pretty_printer BUFFER, SPC
2533 spaces of indent. FLAGS specifies details to show in the dump (see TDF_*
2537 dump_gimple_omp_atomic_load (pretty_printer
*buffer
, const gomp_atomic_load
*gs
,
2538 int spc
, dump_flags_t flags
)
2540 if (flags
& TDF_RAW
)
2542 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T>", gs
,
2543 gimple_omp_atomic_load_lhs (gs
),
2544 gimple_omp_atomic_load_rhs (gs
));
2548 pp_string (buffer
, "#pragma omp atomic_load");
2549 dump_omp_atomic_memory_order (buffer
,
2550 gimple_omp_atomic_memory_order (gs
));
2551 if (gimple_omp_atomic_need_value_p (gs
))
2552 pp_string (buffer
, " [needed]");
2553 if (gimple_omp_atomic_weak_p (gs
))
2554 pp_string (buffer
, " [weak]");
2555 newline_and_indent (buffer
, spc
+ 2);
2556 dump_generic_node (buffer
, gimple_omp_atomic_load_lhs (gs
),
2562 dump_generic_node (buffer
, gimple_omp_atomic_load_rhs (gs
),
2567 /* Dump a GIMPLE_OMP_ATOMIC_STORE tuple on the pretty_printer BUFFER, SPC
2568 spaces of indent. FLAGS specifies details to show in the dump (see TDF_*
2572 dump_gimple_omp_atomic_store (pretty_printer
*buffer
,
2573 const gomp_atomic_store
*gs
, int spc
,
2576 if (flags
& TDF_RAW
)
2578 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
,
2579 gimple_omp_atomic_store_val (gs
));
2583 pp_string (buffer
, "#pragma omp atomic_store");
2584 dump_omp_atomic_memory_order (buffer
,
2585 gimple_omp_atomic_memory_order (gs
));
2587 if (gimple_omp_atomic_need_value_p (gs
))
2588 pp_string (buffer
, "[needed] ");
2589 if (gimple_omp_atomic_weak_p (gs
))
2590 pp_string (buffer
, "[weak] ");
2591 pp_left_paren (buffer
);
2592 dump_generic_node (buffer
, gimple_omp_atomic_store_val (gs
),
2594 pp_right_paren (buffer
);
2599 /* Dump all the memory operands for statement GS. BUFFER, SPC and
2600 FLAGS are as in pp_gimple_stmt_1. */
2603 dump_gimple_mem_ops (pretty_printer
*buffer
, const gimple
*gs
, int spc
,
2606 tree vdef
= gimple_vdef (gs
);
2607 tree vuse
= gimple_vuse (gs
);
2609 if (vdef
!= NULL_TREE
)
2611 pp_string (buffer
, "# ");
2612 dump_generic_node (buffer
, vdef
, spc
+ 2, flags
, false);
2613 pp_string (buffer
, " = VDEF <");
2614 dump_generic_node (buffer
, vuse
, spc
+ 2, flags
, false);
2615 pp_greater (buffer
);
2616 newline_and_indent (buffer
, spc
);
2618 else if (vuse
!= NULL_TREE
)
2620 pp_string (buffer
, "# VUSE <");
2621 dump_generic_node (buffer
, vuse
, spc
+ 2, flags
, false);
2622 pp_greater (buffer
);
2623 newline_and_indent (buffer
, spc
);
2628 /* Print the gimple statement GS on the pretty printer BUFFER, SPC
2629 spaces of indent. FLAGS specifies details to show in the dump (see
2630 TDF_* in dumpfile.h). The caller is responsible for calling
2631 pp_flush on BUFFER to finalize the pretty printer. */
2634 pp_gimple_stmt_1 (pretty_printer
*buffer
, const gimple
*gs
, int spc
,
2640 if (flags
& TDF_STMTADDR
)
2641 pp_printf (buffer
, "<&%p> ", (const void *) gs
);
2643 if ((flags
& TDF_LINENO
) && gimple_has_location (gs
))
2644 dump_location (buffer
, gimple_location (gs
));
2648 int lp_nr
= lookup_stmt_eh_lp (gs
);
2650 pp_printf (buffer
, "[LP %d] ", lp_nr
);
2652 pp_printf (buffer
, "[MNT %d] ", -lp_nr
);
2655 if ((flags
& (TDF_VOPS
|TDF_MEMSYMS
))
2656 && gimple_has_mem_ops (gs
))
2657 dump_gimple_mem_ops (buffer
, gs
, spc
, flags
);
2659 if (gimple_has_lhs (gs
)
2660 && (flags
& TDF_ALIAS
))
2661 dump_ssaname_info (buffer
, gimple_get_lhs (gs
), spc
);
2663 switch (gimple_code (gs
))
2666 dump_gimple_asm (buffer
, as_a
<const gasm
*> (gs
), spc
, flags
);
2670 dump_gimple_assign (buffer
, as_a
<const gassign
*> (gs
), spc
, flags
);
2674 dump_gimple_bind (buffer
, as_a
<const gbind
*> (gs
), spc
, flags
);
2678 dump_gimple_call (buffer
, as_a
<const gcall
*> (gs
), spc
, flags
);
2682 dump_gimple_cond (buffer
, as_a
<const gcond
*> (gs
), spc
, flags
);
2686 dump_gimple_label (buffer
, as_a
<const glabel
*> (gs
), spc
, flags
);
2690 dump_gimple_goto (buffer
, as_a
<const ggoto
*> (gs
), spc
, flags
);
2694 pp_string (buffer
, "GIMPLE_NOP");
2698 dump_gimple_return (buffer
, as_a
<const greturn
*> (gs
), spc
, flags
);
2702 dump_gimple_switch (buffer
, as_a
<const gswitch
*> (gs
), spc
, flags
);
2706 dump_gimple_try (buffer
, as_a
<const gtry
*> (gs
), spc
, flags
);
2710 dump_gimple_phi (buffer
, as_a
<const gphi
*> (gs
), spc
, false, flags
);
2713 case GIMPLE_OMP_PARALLEL
:
2714 dump_gimple_omp_parallel (buffer
, as_a
<const gomp_parallel
*> (gs
), spc
,
2718 case GIMPLE_OMP_TASK
:
2719 dump_gimple_omp_task (buffer
, as_a
<const gomp_task
*> (gs
), spc
, flags
);
2722 case GIMPLE_OMP_ATOMIC_LOAD
:
2723 dump_gimple_omp_atomic_load (buffer
, as_a
<const gomp_atomic_load
*> (gs
),
2727 case GIMPLE_OMP_ATOMIC_STORE
:
2728 dump_gimple_omp_atomic_store (buffer
,
2729 as_a
<const gomp_atomic_store
*> (gs
),
2733 case GIMPLE_OMP_FOR
:
2734 dump_gimple_omp_for (buffer
, as_a
<const gomp_for
*> (gs
), spc
, flags
);
2737 case GIMPLE_OMP_CONTINUE
:
2738 dump_gimple_omp_continue (buffer
, as_a
<const gomp_continue
*> (gs
), spc
,
2742 case GIMPLE_OMP_SINGLE
:
2743 dump_gimple_omp_single (buffer
, as_a
<const gomp_single
*> (gs
), spc
,
2747 case GIMPLE_OMP_TARGET
:
2748 dump_gimple_omp_target (buffer
, as_a
<const gomp_target
*> (gs
), spc
,
2752 case GIMPLE_OMP_TEAMS
:
2753 dump_gimple_omp_teams (buffer
, as_a
<const gomp_teams
*> (gs
), spc
,
2757 case GIMPLE_OMP_RETURN
:
2758 dump_gimple_omp_return (buffer
, gs
, spc
, flags
);
2761 case GIMPLE_OMP_SECTIONS
:
2762 dump_gimple_omp_sections (buffer
, as_a
<const gomp_sections
*> (gs
),
2766 case GIMPLE_OMP_SECTIONS_SWITCH
:
2767 pp_string (buffer
, "GIMPLE_SECTIONS_SWITCH");
2770 case GIMPLE_OMP_TASKGROUP
:
2771 dump_gimple_omp_taskgroup (buffer
, gs
, spc
, flags
);
2774 case GIMPLE_OMP_MASKED
:
2775 dump_gimple_omp_masked (buffer
, gs
, spc
, flags
);
2778 case GIMPLE_OMP_SCOPE
:
2779 dump_gimple_omp_scope (buffer
, gs
, spc
, flags
);
2782 case GIMPLE_OMP_MASTER
:
2783 case GIMPLE_OMP_SECTION
:
2784 dump_gimple_omp_block (buffer
, gs
, spc
, flags
);
2787 case GIMPLE_OMP_ORDERED
:
2788 dump_gimple_omp_ordered (buffer
, as_a
<const gomp_ordered
*> (gs
), spc
,
2792 case GIMPLE_OMP_SCAN
:
2793 dump_gimple_omp_scan (buffer
, as_a
<const gomp_scan
*> (gs
), spc
,
2797 case GIMPLE_OMP_CRITICAL
:
2798 dump_gimple_omp_critical (buffer
, as_a
<const gomp_critical
*> (gs
), spc
,
2803 dump_gimple_catch (buffer
, as_a
<const gcatch
*> (gs
), spc
, flags
);
2806 case GIMPLE_EH_FILTER
:
2807 dump_gimple_eh_filter (buffer
, as_a
<const geh_filter
*> (gs
), spc
,
2811 case GIMPLE_EH_MUST_NOT_THROW
:
2812 dump_gimple_eh_must_not_throw (buffer
,
2813 as_a
<const geh_mnt
*> (gs
),
2817 case GIMPLE_EH_ELSE
:
2818 dump_gimple_eh_else (buffer
, as_a
<const geh_else
*> (gs
), spc
, flags
);
2822 dump_gimple_resx (buffer
, as_a
<const gresx
*> (gs
), spc
, flags
);
2825 case GIMPLE_EH_DISPATCH
:
2826 dump_gimple_eh_dispatch (buffer
, as_a
<const geh_dispatch
*> (gs
), spc
,
2831 dump_gimple_debug (buffer
, as_a
<const gdebug
*> (gs
), spc
, flags
);
2834 case GIMPLE_PREDICT
:
2835 pp_string (buffer
, "// predicted ");
2836 if (gimple_predict_outcome (gs
))
2837 pp_string (buffer
, "likely by ");
2839 pp_string (buffer
, "unlikely by ");
2840 pp_string (buffer
, predictor_name (gimple_predict_predictor (gs
)));
2841 pp_string (buffer
, " predictor.");
2844 case GIMPLE_TRANSACTION
:
2845 dump_gimple_transaction (buffer
, as_a
<const gtransaction
*> (gs
), spc
,
2855 /* Dumps header of basic block BB to OUTF indented by INDENT
2856 spaces and details described by flags. */
2859 dump_gimple_bb_header (FILE *outf
, basic_block bb
, int indent
,
2862 if (flags
& TDF_BLOCKS
)
2864 if (flags
& TDF_LINENO
)
2866 gimple_stmt_iterator gsi
;
2868 fputs (";; ", outf
);
2870 for (gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
); gsi_next (&gsi
))
2871 if (!is_gimple_debug (gsi_stmt (gsi
))
2872 && get_lineno (gsi_stmt (gsi
)) != UNKNOWN_LOCATION
)
2874 fprintf (outf
, "%*sstarting at line %d",
2875 indent
, "", get_lineno (gsi_stmt (gsi
)));
2883 if (flags
& TDF_GIMPLE
)
2885 fprintf (outf
, "%*s__BB(%d", indent
, "", bb
->index
);
2886 if (bb
->loop_father
->header
== bb
)
2887 fprintf (outf
, ",loop_header(%d)", bb
->loop_father
->num
);
2888 if (bb
->count
.initialized_p ())
2889 fprintf (outf
, ",%s(%" PRIu64
")",
2890 profile_quality_as_string (bb
->count
.quality ()),
2891 bb
->count
.value ());
2892 fprintf (outf
, "):\n");
2895 fprintf (outf
, "%*s<bb %d> %s:\n",
2896 indent
, "", bb
->index
, dump_profile (bb
->count
));
2901 /* Dumps end of basic block BB to buffer BUFFER indented by INDENT
2905 dump_gimple_bb_footer (FILE *outf ATTRIBUTE_UNUSED
,
2906 basic_block bb ATTRIBUTE_UNUSED
,
2907 int indent ATTRIBUTE_UNUSED
,
2908 dump_flags_t flags ATTRIBUTE_UNUSED
)
2910 /* There is currently no GIMPLE-specific basic block info to dump. */
2915 /* Dump PHI nodes of basic block BB to BUFFER with details described
2916 by FLAGS and indented by INDENT spaces. */
2919 dump_phi_nodes (pretty_printer
*buffer
, basic_block bb
, int indent
,
2924 for (i
= gsi_start_phis (bb
); !gsi_end_p (i
); gsi_next (&i
))
2926 gphi
*phi
= i
.phi ();
2927 if (!virtual_operand_p (gimple_phi_result (phi
)) || (flags
& TDF_VOPS
))
2930 dump_gimple_phi (buffer
, phi
, indent
,
2931 (flags
& TDF_GIMPLE
) ? false : true, flags
);
2932 pp_newline (buffer
);
2938 /* Dump jump to basic block BB that is represented implicitly in the cfg
2942 pp_cfg_jump (pretty_printer
*buffer
, edge e
, dump_flags_t flags
)
2944 if (flags
& TDF_GIMPLE
)
2946 pp_string (buffer
, "goto __BB");
2947 pp_decimal_int (buffer
, e
->dest
->index
);
2948 if (e
->probability
.initialized_p ())
2950 pp_string (buffer
, "(");
2952 profile_quality_as_string (e
->probability
.quality ()));
2953 pp_string (buffer
, "(");
2954 pp_decimal_int (buffer
, e
->probability
.value ());
2955 pp_string (buffer
, "))");
2957 pp_semicolon (buffer
);
2961 pp_string (buffer
, "goto <bb ");
2962 pp_decimal_int (buffer
, e
->dest
->index
);
2963 pp_greater (buffer
);
2964 pp_semicolon (buffer
);
2966 dump_edge_probability (buffer
, e
);
2971 /* Dump edges represented implicitly in basic block BB to BUFFER, indented
2972 by INDENT spaces, with details given by FLAGS. */
2975 dump_implicit_edges (pretty_printer
*buffer
, basic_block bb
, int indent
,
2981 stmt
= last_stmt (bb
);
2983 if (stmt
&& gimple_code (stmt
) == GIMPLE_COND
)
2985 edge true_edge
, false_edge
;
2987 /* When we are emitting the code or changing CFG, it is possible that
2988 the edges are not yet created. When we are using debug_bb in such
2989 a situation, we do not want it to crash. */
2990 if (EDGE_COUNT (bb
->succs
) != 2)
2992 extract_true_false_edges_from_block (bb
, &true_edge
, &false_edge
);
2994 INDENT (indent
+ 2);
2995 pp_cfg_jump (buffer
, true_edge
, flags
);
2996 newline_and_indent (buffer
, indent
);
2997 pp_string (buffer
, "else");
2998 newline_and_indent (buffer
, indent
+ 2);
2999 pp_cfg_jump (buffer
, false_edge
, flags
);
3000 pp_newline (buffer
);
3004 /* If there is a fallthru edge, we may need to add an artificial
3005 goto to the dump. */
3006 e
= find_fallthru_edge (bb
->succs
);
3008 if (e
&& (e
->dest
!= bb
->next_bb
|| (flags
& TDF_GIMPLE
)))
3012 if ((flags
& TDF_LINENO
)
3013 && e
->goto_locus
!= UNKNOWN_LOCATION
)
3014 dump_location (buffer
, e
->goto_locus
);
3016 pp_cfg_jump (buffer
, e
, flags
);
3017 pp_newline (buffer
);
3022 /* Dumps basic block BB to buffer BUFFER with details described by FLAGS and
3023 indented by INDENT spaces. */
3026 gimple_dump_bb_buff (pretty_printer
*buffer
, basic_block bb
, int indent
,
3029 gimple_stmt_iterator gsi
;
3031 int label_indent
= indent
- 2;
3033 if (label_indent
< 0)
3036 dump_phi_nodes (buffer
, bb
, indent
, flags
);
3038 for (gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
); gsi_next (&gsi
))
3042 stmt
= gsi_stmt (gsi
);
3044 curr_indent
= gimple_code (stmt
) == GIMPLE_LABEL
? label_indent
: indent
;
3046 INDENT (curr_indent
);
3047 pp_gimple_stmt_1 (buffer
, stmt
, curr_indent
, flags
);
3048 pp_newline_and_flush (buffer
);
3049 gcc_checking_assert (DECL_STRUCT_FUNCTION (current_function_decl
));
3050 dump_histograms_for_stmt (DECL_STRUCT_FUNCTION (current_function_decl
),
3051 pp_buffer (buffer
)->stream
, stmt
);
3054 dump_implicit_edges (buffer
, bb
, indent
, flags
);
3059 /* Dumps basic block BB to FILE with details described by FLAGS and
3060 indented by INDENT spaces. */
3063 gimple_dump_bb (FILE *file
, basic_block bb
, int indent
, dump_flags_t flags
)
3065 dump_gimple_bb_header (file
, bb
, indent
, flags
);
3066 if (bb
->index
>= NUM_FIXED_BLOCKS
)
3068 pretty_printer buffer
;
3069 pp_needs_newline (&buffer
) = true;
3070 buffer
.buffer
->stream
= file
;
3071 gimple_dump_bb_buff (&buffer
, bb
, indent
, flags
);
3073 dump_gimple_bb_footer (file
, bb
, indent
, flags
);
3076 /* Dumps basic block BB to pretty-printer PP with default dump flags and
3077 no indentation, for use as a label of a DOT graph record-node.
3078 ??? Should just use gimple_dump_bb_buff here, except that value profiling
3079 histogram dumping doesn't know about pretty-printers. */
3082 gimple_dump_bb_for_graph (pretty_printer
*pp
, basic_block bb
)
3084 pp_printf (pp
, "<bb %d>:\n", bb
->index
);
3085 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
3087 for (gphi_iterator gsi
= gsi_start_phis (bb
); !gsi_end_p (gsi
);
3090 gphi
*phi
= gsi
.phi ();
3091 if (!virtual_operand_p (gimple_phi_result (phi
))
3092 || (dump_flags
& TDF_VOPS
))
3095 pp_write_text_to_stream (pp
);
3096 pp_string (pp
, "# ");
3097 pp_gimple_stmt_1 (pp
, phi
, 0, dump_flags
);
3099 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
3103 for (gimple_stmt_iterator gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
);
3106 gimple
*stmt
= gsi_stmt (gsi
);
3108 pp_write_text_to_stream (pp
);
3109 pp_gimple_stmt_1 (pp
, stmt
, 0, dump_flags
);
3111 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
3113 dump_implicit_edges (pp
, bb
, 0, dump_flags
);
3114 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
3118 # pragma GCC diagnostic pop