1 /* Pretty formatting of GIMPLE statements and expressions.
2 Copyright (C) 2001-2020 Free Software Foundation, Inc.
3 Contributed by Aldy Hernandez <aldyh@redhat.com> and
4 Diego Novillo <dnovillo@google.com>
6 This file is part of GCC.
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 3, or (at your option) any later
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING3. If not see
20 <http://www.gnu.org/licenses/>. */
24 #include "coretypes.h"
29 #include "gimple-predict.h"
32 #include "gimple-pretty-print.h"
33 #include "internal-fn.h"
35 #include "gimple-iterator.h"
37 #include "dumpfile.h" /* for dump_flags */
38 #include "value-prof.h"
39 #include "trans-mem.h"
41 #include "stringpool.h"
46 /* Disable warnings about quoting issues in the pp_xxx calls below
47 that (intentionally) don't follow GCC diagnostic conventions. */
49 # pragma GCC diagnostic push
50 # pragma GCC diagnostic ignored "-Wformat-diag"
53 #define INDENT(SPACE) \
54 do { int i; for (i = 0; i < SPACE; i++) pp_space (buffer); } while (0)
56 #define GIMPLE_NIY do_niy (buffer,gs)
58 /* Try to print on BUFFER a default message for the unrecognized
59 gimple statement GS. */
62 do_niy (pretty_printer
*buffer
, const gimple
*gs
)
64 pp_printf (buffer
, "<<< Unknown GIMPLE statement: %s >>>\n",
65 gimple_code_name
[(int) gimple_code (gs
)]);
69 /* Emit a newline and SPC indentation spaces to BUFFER. */
72 newline_and_indent (pretty_printer
*buffer
, int spc
)
79 /* Print the GIMPLE statement GS on stderr. */
82 debug_gimple_stmt (gimple
*gs
)
84 print_gimple_stmt (stderr
, gs
, 0, TDF_VOPS
|TDF_MEMSYMS
);
88 /* Return formatted string of a VALUE probability
89 (biased by REG_BR_PROB_BASE). Returned string is allocated
90 by xstrdup_for_dump. */
93 dump_profile (profile_count
&count
)
96 if (!count
.initialized_p ())
99 buf
= xasprintf ("[count: %" PRId64
"]",
100 count
.to_gcov_type ());
101 else if (count
.initialized_p ())
102 buf
= xasprintf ("[local count: %" PRId64
"]",
103 count
.to_gcov_type ());
105 const char *ret
= xstrdup_for_dump (buf
);
111 /* Return formatted string of a VALUE probability
112 (biased by REG_BR_PROB_BASE). Returned string is allocated
113 by xstrdup_for_dump. */
116 dump_probability (profile_probability probability
)
118 float minimum
= 0.01f
;
121 if (probability
.initialized_p ())
123 fvalue
= probability
.to_reg_br_prob_base () * 100.0f
/ REG_BR_PROB_BASE
;
124 if (fvalue
< minimum
&& probability
.to_reg_br_prob_base ())
129 if (probability
.initialized_p ())
130 buf
= xasprintf ("[%.2f%%]", fvalue
);
132 buf
= xasprintf ("[INV]");
134 const char *ret
= xstrdup_for_dump (buf
);
140 /* Dump E probability to BUFFER. */
143 dump_edge_probability (pretty_printer
*buffer
, edge e
)
145 pp_scalar (buffer
, " %s", dump_probability (e
->probability
));
148 /* Print GIMPLE statement G to FILE using SPC indentation spaces and
149 FLAGS as in pp_gimple_stmt_1. */
152 print_gimple_stmt (FILE *file
, gimple
*g
, int spc
, dump_flags_t flags
)
154 pretty_printer buffer
;
155 pp_needs_newline (&buffer
) = true;
156 buffer
.buffer
->stream
= file
;
157 pp_gimple_stmt_1 (&buffer
, g
, spc
, flags
);
158 pp_newline_and_flush (&buffer
);
164 print_gimple_stmt (stderr
, &ref
, 0, TDF_NONE
);
173 fprintf (stderr
, "<nil>\n");
177 /* Print GIMPLE statement G to FILE using SPC indentation spaces and
178 FLAGS as in pp_gimple_stmt_1. Print only the right-hand side
182 print_gimple_expr (FILE *file
, gimple
*g
, int spc
, dump_flags_t flags
)
184 flags
|= TDF_RHS_ONLY
;
185 pretty_printer buffer
;
186 pp_needs_newline (&buffer
) = true;
187 buffer
.buffer
->stream
= file
;
188 pp_gimple_stmt_1 (&buffer
, g
, spc
, flags
);
193 /* Print the GIMPLE sequence SEQ on BUFFER using SPC indentation
194 spaces and FLAGS as in pp_gimple_stmt_1.
195 The caller is responsible for calling pp_flush on BUFFER to finalize
196 the pretty printer. */
199 dump_gimple_seq (pretty_printer
*buffer
, gimple_seq seq
, int spc
,
202 gimple_stmt_iterator i
;
204 for (i
= gsi_start (seq
); !gsi_end_p (i
); gsi_next (&i
))
206 gimple
*gs
= gsi_stmt (i
);
208 pp_gimple_stmt_1 (buffer
, gs
, spc
, flags
);
209 if (!gsi_one_before_end_p (i
))
215 /* Print GIMPLE sequence SEQ to FILE using SPC indentation spaces and
216 FLAGS as in pp_gimple_stmt_1. */
219 print_gimple_seq (FILE *file
, gimple_seq seq
, int spc
, dump_flags_t flags
)
221 pretty_printer buffer
;
222 pp_needs_newline (&buffer
) = true;
223 buffer
.buffer
->stream
= file
;
224 dump_gimple_seq (&buffer
, seq
, spc
, flags
);
225 pp_newline_and_flush (&buffer
);
229 /* Print the GIMPLE sequence SEQ on stderr. */
232 debug_gimple_seq (gimple_seq seq
)
234 print_gimple_seq (stderr
, seq
, 0, TDF_VOPS
|TDF_MEMSYMS
);
238 /* A simple helper to pretty-print some of the gimple tuples in the printf
239 style. The format modifiers are preceded by '%' and are:
240 'G' - outputs a string corresponding to the code of the given gimple,
241 'S' - outputs a gimple_seq with indent of spc + 2,
242 'T' - outputs the tree t,
243 'd' - outputs an int as a decimal,
244 's' - outputs a string,
245 'n' - outputs a newline,
246 'x' - outputs an int as hexadecimal,
247 '+' - increases indent by 2 then outputs a newline,
248 '-' - decreases indent by 2 then outputs a newline. */
251 dump_gimple_fmt (pretty_printer
*buffer
, int spc
, dump_flags_t flags
,
252 const char *fmt
, ...)
258 va_start (args
, fmt
);
259 for (c
= fmt
; *c
; c
++)
269 g
= va_arg (args
, gimple
*);
270 tmp
= gimple_code_name
[gimple_code (g
)];
271 pp_string (buffer
, tmp
);
275 seq
= va_arg (args
, gimple_seq
);
277 dump_gimple_seq (buffer
, seq
, spc
+ 2, flags
);
278 newline_and_indent (buffer
, spc
);
282 t
= va_arg (args
, tree
);
284 pp_string (buffer
, "NULL");
286 dump_generic_node (buffer
, t
, spc
, flags
, false);
290 pp_decimal_int (buffer
, va_arg (args
, int));
294 pp_string (buffer
, va_arg (args
, char *));
298 newline_and_indent (buffer
, spc
);
302 pp_scalar (buffer
, "%x", va_arg (args
, int));
307 newline_and_indent (buffer
, spc
);
312 newline_and_indent (buffer
, spc
);
320 pp_character (buffer
, *c
);
326 /* Helper for dump_gimple_assign. Print the unary RHS of the
327 assignment GS. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. */
330 dump_unary_rhs (pretty_printer
*buffer
, const gassign
*gs
, int spc
,
333 enum tree_code rhs_code
= gimple_assign_rhs_code (gs
);
334 tree lhs
= gimple_assign_lhs (gs
);
335 tree rhs
= gimple_assign_rhs1 (gs
);
339 case VIEW_CONVERT_EXPR
:
341 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
344 case FIXED_CONVERT_EXPR
:
345 case ADDR_SPACE_CONVERT_EXPR
:
349 pp_left_paren (buffer
);
350 dump_generic_node (buffer
, TREE_TYPE (lhs
), spc
, flags
, false);
351 pp_string (buffer
, ") ");
352 if (op_prio (rhs
) < op_code_prio (rhs_code
))
354 pp_left_paren (buffer
);
355 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
356 pp_right_paren (buffer
);
359 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
363 pp_string (buffer
, "((");
364 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
365 pp_string (buffer
, "))");
370 if (flags
& TDF_GIMPLE
)
373 rhs_code
== ABS_EXPR
? "__ABS " : "__ABSU ");
374 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
379 rhs_code
== ABS_EXPR
? "ABS_EXPR <" : "ABSU_EXPR <");
380 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
386 if (TREE_CODE_CLASS (rhs_code
) == tcc_declaration
387 || TREE_CODE_CLASS (rhs_code
) == tcc_constant
388 || TREE_CODE_CLASS (rhs_code
) == tcc_reference
389 || rhs_code
== SSA_NAME
390 || rhs_code
== ADDR_EXPR
391 || rhs_code
== CONSTRUCTOR
)
393 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
396 else if (rhs_code
== BIT_NOT_EXPR
)
397 pp_complement (buffer
);
398 else if (rhs_code
== TRUTH_NOT_EXPR
)
399 pp_exclamation (buffer
);
400 else if (rhs_code
== NEGATE_EXPR
)
404 pp_left_bracket (buffer
);
405 pp_string (buffer
, get_tree_code_name (rhs_code
));
406 pp_string (buffer
, "] ");
409 if (op_prio (rhs
) < op_code_prio (rhs_code
))
411 pp_left_paren (buffer
);
412 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
413 pp_right_paren (buffer
);
416 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
422 /* Helper for dump_gimple_assign. Print the binary RHS of the
423 assignment GS. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. */
426 dump_binary_rhs (pretty_printer
*buffer
, const gassign
*gs
, int spc
,
430 enum tree_code code
= gimple_assign_rhs_code (gs
);
435 if (flags
& TDF_GIMPLE
)
437 pp_string (buffer
, code
== MIN_EXPR
? "__MIN (" : "__MAX (");
438 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
,
440 pp_string (buffer
, ", ");
441 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
,
443 pp_string (buffer
, ")");
449 case VEC_WIDEN_MULT_HI_EXPR
:
450 case VEC_WIDEN_MULT_LO_EXPR
:
451 case VEC_WIDEN_MULT_EVEN_EXPR
:
452 case VEC_WIDEN_MULT_ODD_EXPR
:
453 case VEC_PACK_TRUNC_EXPR
:
454 case VEC_PACK_SAT_EXPR
:
455 case VEC_PACK_FIX_TRUNC_EXPR
:
456 case VEC_PACK_FLOAT_EXPR
:
457 case VEC_WIDEN_LSHIFT_HI_EXPR
:
458 case VEC_WIDEN_LSHIFT_LO_EXPR
:
459 case VEC_SERIES_EXPR
:
460 for (p
= get_tree_code_name (code
); *p
; p
++)
461 pp_character (buffer
, TOUPPER (*p
));
462 pp_string (buffer
, " <");
463 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
464 pp_string (buffer
, ", ");
465 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
470 if (op_prio (gimple_assign_rhs1 (gs
)) <= op_code_prio (code
))
472 pp_left_paren (buffer
);
473 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
,
475 pp_right_paren (buffer
);
478 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
480 pp_string (buffer
, op_symbol_code (gimple_assign_rhs_code (gs
)));
482 if (op_prio (gimple_assign_rhs2 (gs
)) <= op_code_prio (code
))
484 pp_left_paren (buffer
);
485 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
,
487 pp_right_paren (buffer
);
490 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
494 /* Helper for dump_gimple_assign. Print the ternary RHS of the
495 assignment GS. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. */
498 dump_ternary_rhs (pretty_printer
*buffer
, const gassign
*gs
, int spc
,
502 enum tree_code code
= gimple_assign_rhs_code (gs
);
505 case WIDEN_MULT_PLUS_EXPR
:
506 case WIDEN_MULT_MINUS_EXPR
:
507 for (p
= get_tree_code_name (code
); *p
; p
++)
508 pp_character (buffer
, TOUPPER (*p
));
509 pp_string (buffer
, " <");
510 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
511 pp_string (buffer
, ", ");
512 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
513 pp_string (buffer
, ", ");
514 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
519 pp_string (buffer
, "DOT_PROD_EXPR <");
520 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
521 pp_string (buffer
, ", ");
522 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
523 pp_string (buffer
, ", ");
524 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
529 pp_string (buffer
, "SAD_EXPR <");
530 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
531 pp_string (buffer
, ", ");
532 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
533 pp_string (buffer
, ", ");
534 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
539 if (flags
& TDF_GIMPLE
)
540 pp_string (buffer
, "__VEC_PERM (");
542 pp_string (buffer
, "VEC_PERM_EXPR <");
543 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
544 pp_string (buffer
, ", ");
545 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
546 pp_string (buffer
, ", ");
547 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
548 if (flags
& TDF_GIMPLE
)
549 pp_right_paren (buffer
);
554 case REALIGN_LOAD_EXPR
:
555 pp_string (buffer
, "REALIGN_LOAD <");
556 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
557 pp_string (buffer
, ", ");
558 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
559 pp_string (buffer
, ", ");
560 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
565 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
566 pp_string (buffer
, " ? ");
567 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
568 pp_string (buffer
, " : ");
569 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
573 pp_string (buffer
, "VEC_COND_EXPR <");
574 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
575 pp_string (buffer
, ", ");
576 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
577 pp_string (buffer
, ", ");
578 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
582 case BIT_INSERT_EXPR
:
583 if (flags
& TDF_GIMPLE
)
585 pp_string (buffer
, "__BIT_INSERT (");
586 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
,
587 flags
| TDF_SLIM
, false);
588 pp_string (buffer
, ", ");
589 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
,
590 flags
| TDF_SLIM
, false);
591 pp_string (buffer
, ", ");
592 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
,
593 flags
| TDF_SLIM
, false);
594 pp_right_paren (buffer
);
598 pp_string (buffer
, "BIT_INSERT_EXPR <");
599 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
),
601 pp_string (buffer
, ", ");
602 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
),
604 pp_string (buffer
, ", ");
605 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
),
607 if (INTEGRAL_TYPE_P (TREE_TYPE (gimple_assign_rhs2 (gs
))))
609 pp_string (buffer
, " (");
610 pp_decimal_int (buffer
, TYPE_PRECISION
611 (TREE_TYPE (gimple_assign_rhs2 (gs
))));
612 pp_string (buffer
, " bits)");
624 /* Dump the gimple assignment GS. BUFFER, SPC and FLAGS are as in
628 dump_gimple_assign (pretty_printer
*buffer
, const gassign
*gs
, int spc
,
636 switch (gimple_num_ops (gs
))
639 arg3
= gimple_assign_rhs3 (gs
);
642 arg2
= gimple_assign_rhs2 (gs
);
645 arg1
= gimple_assign_rhs1 (gs
);
651 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%s, %T, %T, %T, %T>", gs
,
652 get_tree_code_name (gimple_assign_rhs_code (gs
)),
653 gimple_assign_lhs (gs
), arg1
, arg2
, arg3
);
657 if (!(flags
& TDF_RHS_ONLY
))
659 dump_generic_node (buffer
, gimple_assign_lhs (gs
), spc
, flags
, false);
663 if (gimple_assign_nontemporal_move_p (gs
))
664 pp_string (buffer
, "{nt}");
666 if (gimple_has_volatile_ops (gs
))
667 pp_string (buffer
, "{v}");
672 if (gimple_num_ops (gs
) == 2)
673 dump_unary_rhs (buffer
, gs
, spc
, flags
);
674 else if (gimple_num_ops (gs
) == 3)
675 dump_binary_rhs (buffer
, gs
, spc
, flags
);
676 else if (gimple_num_ops (gs
) == 4)
677 dump_ternary_rhs (buffer
, gs
, spc
, flags
);
680 if (!(flags
& TDF_RHS_ONLY
))
681 pp_semicolon (buffer
);
686 /* Dump the return statement GS. BUFFER, SPC and FLAGS are as in
690 dump_gimple_return (pretty_printer
*buffer
, const greturn
*gs
, int spc
,
695 t
= gimple_return_retval (gs
);
697 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
, t
);
700 pp_string (buffer
, "return");
704 dump_generic_node (buffer
, t
, spc
, flags
, false);
706 pp_semicolon (buffer
);
711 /* Dump the call arguments for a gimple call. BUFFER, FLAGS are as in
715 dump_gimple_call_args (pretty_printer
*buffer
, const gcall
*gs
,
720 /* Pretty print first arg to certain internal fns. */
721 if (gimple_call_internal_p (gs
))
723 const char *const *enums
= NULL
;
726 switch (gimple_call_internal_fn (gs
))
730 static const char *const unique_args
[] = {IFN_UNIQUE_CODES
};
734 limit
= ARRAY_SIZE (unique_args
);
739 static const char *const loop_args
[] = {IFN_GOACC_LOOP_CODES
};
742 limit
= ARRAY_SIZE (loop_args
);
745 case IFN_GOACC_REDUCTION
:
747 static const char *const reduction_args
[]
748 = {IFN_GOACC_REDUCTION_CODES
};
750 enums
= reduction_args
;
751 limit
= ARRAY_SIZE (reduction_args
);
756 static const char *const asan_mark_args
[] = {IFN_ASAN_MARK_FLAGS
};
758 enums
= asan_mark_args
;
759 limit
= ARRAY_SIZE (asan_mark_args
);
767 tree arg0
= gimple_call_arg (gs
, 0);
770 if (TREE_CODE (arg0
) == INTEGER_CST
771 && tree_fits_shwi_p (arg0
)
772 && (v
= tree_to_shwi (arg0
)) >= 0 && v
< limit
)
775 pp_string (buffer
, enums
[v
]);
780 for (; i
< gimple_call_num_args (gs
); i
++)
783 pp_string (buffer
, ", ");
784 dump_generic_node (buffer
, gimple_call_arg (gs
, i
), 0, flags
, false);
787 if (gimple_call_va_arg_pack_p (gs
))
790 pp_string (buffer
, ", ");
792 pp_string (buffer
, "__builtin_va_arg_pack ()");
796 /* Dump the points-to solution *PT to BUFFER. */
799 pp_points_to_solution (pretty_printer
*buffer
, const pt_solution
*pt
)
803 pp_string (buffer
, "anything ");
807 pp_string (buffer
, "nonlocal ");
809 pp_string (buffer
, "escaped ");
811 pp_string (buffer
, "unit-escaped ");
813 pp_string (buffer
, "null ");
815 && !bitmap_empty_p (pt
->vars
))
819 pp_string (buffer
, "{ ");
820 EXECUTE_IF_SET_IN_BITMAP (pt
->vars
, 0, i
, bi
)
822 pp_string (buffer
, "D.");
823 pp_decimal_int (buffer
, i
);
826 pp_right_brace (buffer
);
827 if (pt
->vars_contains_nonlocal
828 || pt
->vars_contains_escaped
829 || pt
->vars_contains_escaped_heap
830 || pt
->vars_contains_restrict
)
832 const char *comma
= "";
833 pp_string (buffer
, " (");
834 if (pt
->vars_contains_nonlocal
)
836 pp_string (buffer
, "nonlocal");
839 if (pt
->vars_contains_escaped
)
841 pp_string (buffer
, comma
);
842 pp_string (buffer
, "escaped");
845 if (pt
->vars_contains_escaped_heap
)
847 pp_string (buffer
, comma
);
848 pp_string (buffer
, "escaped heap");
851 if (pt
->vars_contains_restrict
)
853 pp_string (buffer
, comma
);
854 pp_string (buffer
, "restrict");
857 if (pt
->vars_contains_interposable
)
859 pp_string (buffer
, comma
);
860 pp_string (buffer
, "interposable");
862 pp_string (buffer
, ")");
868 /* Dump the call statement GS. BUFFER, SPC and FLAGS are as in
872 dump_gimple_call (pretty_printer
*buffer
, const gcall
*gs
, int spc
,
875 tree lhs
= gimple_call_lhs (gs
);
876 tree fn
= gimple_call_fn (gs
);
878 if (flags
& TDF_ALIAS
)
880 const pt_solution
*pt
;
881 pt
= gimple_call_use_set (gs
);
882 if (!pt_solution_empty_p (pt
))
884 pp_string (buffer
, "# USE = ");
885 pp_points_to_solution (buffer
, pt
);
886 newline_and_indent (buffer
, spc
);
888 pt
= gimple_call_clobber_set (gs
);
889 if (!pt_solution_empty_p (pt
))
891 pp_string (buffer
, "# CLB = ");
892 pp_points_to_solution (buffer
, pt
);
893 newline_and_indent (buffer
, spc
);
899 if (gimple_call_internal_p (gs
))
900 dump_gimple_fmt (buffer
, spc
, flags
, "%G <.%s, %T", gs
,
901 internal_fn_name (gimple_call_internal_fn (gs
)), lhs
);
903 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T", gs
, fn
, lhs
);
904 if (gimple_call_num_args (gs
) > 0)
906 pp_string (buffer
, ", ");
907 dump_gimple_call_args (buffer
, gs
, flags
);
913 if (lhs
&& !(flags
& TDF_RHS_ONLY
))
915 dump_generic_node (buffer
, lhs
, spc
, flags
, false);
916 pp_string (buffer
, " =");
918 if (gimple_has_volatile_ops (gs
))
919 pp_string (buffer
, "{v}");
923 if (gimple_call_internal_p (gs
))
926 pp_string (buffer
, internal_fn_name (gimple_call_internal_fn (gs
)));
929 print_call_name (buffer
, fn
, flags
);
930 pp_string (buffer
, " (");
931 dump_gimple_call_args (buffer
, gs
, flags
);
932 pp_right_paren (buffer
);
933 if (!(flags
& TDF_RHS_ONLY
))
934 pp_semicolon (buffer
);
937 if (gimple_call_chain (gs
))
939 pp_string (buffer
, " [static-chain: ");
940 dump_generic_node (buffer
, gimple_call_chain (gs
), spc
, flags
, false);
941 pp_right_bracket (buffer
);
944 if (gimple_call_return_slot_opt_p (gs
))
945 pp_string (buffer
, " [return slot optimization]");
946 if (gimple_call_tail_p (gs
))
947 pp_string (buffer
, " [tail call]");
948 if (gimple_call_must_tail_p (gs
))
949 pp_string (buffer
, " [must tail call]");
954 /* Dump the arguments of _ITM_beginTransaction sanely. */
955 if (TREE_CODE (fn
) == ADDR_EXPR
)
956 fn
= TREE_OPERAND (fn
, 0);
957 if (TREE_CODE (fn
) == FUNCTION_DECL
&& decl_is_tm_clone (fn
))
958 pp_string (buffer
, " [tm-clone]");
959 if (TREE_CODE (fn
) == FUNCTION_DECL
960 && fndecl_built_in_p (fn
, BUILT_IN_TM_START
)
961 && gimple_call_num_args (gs
) > 0)
963 tree t
= gimple_call_arg (gs
, 0);
964 unsigned HOST_WIDE_INT props
;
965 gcc_assert (TREE_CODE (t
) == INTEGER_CST
);
967 pp_string (buffer
, " [ ");
969 /* Get the transaction code properties. */
970 props
= TREE_INT_CST_LOW (t
);
972 if (props
& PR_INSTRUMENTEDCODE
)
973 pp_string (buffer
, "instrumentedCode ");
974 if (props
& PR_UNINSTRUMENTEDCODE
)
975 pp_string (buffer
, "uninstrumentedCode ");
976 if (props
& PR_HASNOXMMUPDATE
)
977 pp_string (buffer
, "hasNoXMMUpdate ");
978 if (props
& PR_HASNOABORT
)
979 pp_string (buffer
, "hasNoAbort ");
980 if (props
& PR_HASNOIRREVOCABLE
)
981 pp_string (buffer
, "hasNoIrrevocable ");
982 if (props
& PR_DOESGOIRREVOCABLE
)
983 pp_string (buffer
, "doesGoIrrevocable ");
984 if (props
& PR_HASNOSIMPLEREADS
)
985 pp_string (buffer
, "hasNoSimpleReads ");
986 if (props
& PR_AWBARRIERSOMITTED
)
987 pp_string (buffer
, "awBarriersOmitted ");
988 if (props
& PR_RARBARRIERSOMITTED
)
989 pp_string (buffer
, "RaRBarriersOmitted ");
990 if (props
& PR_UNDOLOGCODE
)
991 pp_string (buffer
, "undoLogCode ");
992 if (props
& PR_PREFERUNINSTRUMENTED
)
993 pp_string (buffer
, "preferUninstrumented ");
994 if (props
& PR_EXCEPTIONBLOCK
)
995 pp_string (buffer
, "exceptionBlock ");
996 if (props
& PR_HASELSE
)
997 pp_string (buffer
, "hasElse ");
998 if (props
& PR_READONLY
)
999 pp_string (buffer
, "readOnly ");
1001 pp_right_bracket (buffer
);
1006 /* Dump the switch statement GS. BUFFER, SPC and FLAGS are as in
1007 pp_gimple_stmt_1. */
1010 dump_gimple_switch (pretty_printer
*buffer
, const gswitch
*gs
, int spc
,
1015 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
1016 if (flags
& TDF_RAW
)
1017 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, ", gs
,
1018 gimple_switch_index (gs
));
1021 pp_string (buffer
, "switch (");
1022 dump_generic_node (buffer
, gimple_switch_index (gs
), spc
, flags
, true);
1023 if (flags
& TDF_GIMPLE
)
1024 pp_string (buffer
, ") {");
1026 pp_string (buffer
, ") <");
1029 for (i
= 0; i
< gimple_switch_num_labels (gs
); i
++)
1031 tree case_label
= gimple_switch_label (gs
, i
);
1032 gcc_checking_assert (case_label
!= NULL_TREE
);
1033 dump_generic_node (buffer
, case_label
, spc
, flags
, false);
1035 tree label
= CASE_LABEL (case_label
);
1036 dump_generic_node (buffer
, label
, spc
, flags
, false);
1038 if (cfun
&& cfun
->cfg
)
1040 basic_block dest
= label_to_block (cfun
, label
);
1043 edge label_edge
= find_edge (gimple_bb (gs
), dest
);
1044 if (label_edge
&& !(flags
& TDF_GIMPLE
))
1045 dump_edge_probability (buffer
, label_edge
);
1049 if (i
< gimple_switch_num_labels (gs
) - 1)
1051 if (flags
& TDF_GIMPLE
)
1052 pp_string (buffer
, "; ");
1054 pp_string (buffer
, ", ");
1057 if (flags
& TDF_GIMPLE
)
1058 pp_string (buffer
, "; }");
1060 pp_greater (buffer
);
1064 /* Dump the gimple conditional GS. BUFFER, SPC and FLAGS are as in
1065 pp_gimple_stmt_1. */
1068 dump_gimple_cond (pretty_printer
*buffer
, const gcond
*gs
, int spc
,
1071 if (flags
& TDF_RAW
)
1072 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%s, %T, %T, %T, %T>", gs
,
1073 get_tree_code_name (gimple_cond_code (gs
)),
1074 gimple_cond_lhs (gs
), gimple_cond_rhs (gs
),
1075 gimple_cond_true_label (gs
), gimple_cond_false_label (gs
));
1078 if (!(flags
& TDF_RHS_ONLY
))
1079 pp_string (buffer
, "if (");
1080 dump_generic_node (buffer
, gimple_cond_lhs (gs
), spc
, flags
, false);
1082 pp_string (buffer
, op_symbol_code (gimple_cond_code (gs
)));
1084 dump_generic_node (buffer
, gimple_cond_rhs (gs
), spc
, flags
, false);
1085 if (!(flags
& TDF_RHS_ONLY
))
1088 edge e
, true_edge
= NULL
, false_edge
= NULL
;
1089 basic_block bb
= gimple_bb (gs
);
1093 FOR_EACH_EDGE (e
, ei
, bb
->succs
)
1095 if (e
->flags
& EDGE_TRUE_VALUE
)
1097 else if (e
->flags
& EDGE_FALSE_VALUE
)
1102 bool has_edge_info
= true_edge
!= NULL
&& false_edge
!= NULL
;
1104 pp_right_paren (buffer
);
1106 if (gimple_cond_true_label (gs
))
1108 pp_string (buffer
, " goto ");
1109 dump_generic_node (buffer
, gimple_cond_true_label (gs
),
1111 if (has_edge_info
&& !(flags
& TDF_GIMPLE
))
1112 dump_edge_probability (buffer
, true_edge
);
1113 pp_semicolon (buffer
);
1115 if (gimple_cond_false_label (gs
))
1117 pp_string (buffer
, " else goto ");
1118 dump_generic_node (buffer
, gimple_cond_false_label (gs
),
1120 if (has_edge_info
&& !(flags
& TDF_GIMPLE
))
1121 dump_edge_probability (buffer
, false_edge
);
1123 pp_semicolon (buffer
);
1130 /* Dump a GIMPLE_LABEL tuple on the pretty_printer BUFFER, SPC
1131 spaces of indent. FLAGS specifies details to show in the dump (see
1132 TDF_* in dumpfils.h). */
1135 dump_gimple_label (pretty_printer
*buffer
, const glabel
*gs
, int spc
,
1138 tree label
= gimple_label_label (gs
);
1139 if (flags
& TDF_RAW
)
1140 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
, label
);
1143 dump_generic_node (buffer
, label
, spc
, flags
, false);
1146 if (flags
& TDF_GIMPLE
)
1148 if (DECL_NONLOCAL (label
))
1149 pp_string (buffer
, " [non-local]");
1150 if ((flags
& TDF_EH
) && EH_LANDING_PAD_NR (label
))
1151 pp_printf (buffer
, " [LP %d]", EH_LANDING_PAD_NR (label
));
1154 /* Dump a GIMPLE_GOTO tuple on the pretty_printer BUFFER, SPC
1155 spaces of indent. FLAGS specifies details to show in the dump (see
1156 TDF_* in dumpfile.h). */
1159 dump_gimple_goto (pretty_printer
*buffer
, const ggoto
*gs
, int spc
,
1162 tree label
= gimple_goto_dest (gs
);
1163 if (flags
& TDF_RAW
)
1164 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
, label
);
1166 dump_gimple_fmt (buffer
, spc
, flags
, "goto %T;", label
);
1170 /* Dump a GIMPLE_BIND tuple on the pretty_printer BUFFER, SPC
1171 spaces of indent. FLAGS specifies details to show in the dump (see
1172 TDF_* in dumpfile.h). */
1175 dump_gimple_bind (pretty_printer
*buffer
, const gbind
*gs
, int spc
,
1178 if (flags
& TDF_RAW
)
1179 dump_gimple_fmt (buffer
, spc
, flags
, "%G <", gs
);
1181 pp_left_brace (buffer
);
1182 if (!(flags
& TDF_SLIM
))
1186 for (var
= gimple_bind_vars (gs
); var
; var
= DECL_CHAIN (var
))
1188 newline_and_indent (buffer
, 2);
1189 print_declaration (buffer
, var
, spc
, flags
);
1191 if (gimple_bind_vars (gs
))
1192 pp_newline (buffer
);
1194 pp_newline (buffer
);
1195 dump_gimple_seq (buffer
, gimple_bind_body (gs
), spc
+ 2, flags
);
1196 newline_and_indent (buffer
, spc
);
1197 if (flags
& TDF_RAW
)
1198 pp_greater (buffer
);
1200 pp_right_brace (buffer
);
1204 /* Dump a GIMPLE_TRY tuple on the pretty_printer BUFFER, SPC spaces of
1205 indent. FLAGS specifies details to show in the dump (see TDF_* in
1209 dump_gimple_try (pretty_printer
*buffer
, const gtry
*gs
, int spc
,
1212 if (flags
& TDF_RAW
)
1215 if (gimple_try_kind (gs
) == GIMPLE_TRY_CATCH
)
1216 type
= "GIMPLE_TRY_CATCH";
1217 else if (gimple_try_kind (gs
) == GIMPLE_TRY_FINALLY
)
1218 type
= "GIMPLE_TRY_FINALLY";
1220 type
= "UNKNOWN GIMPLE_TRY";
1221 dump_gimple_fmt (buffer
, spc
, flags
,
1222 "%G <%s,%+EVAL <%S>%nCLEANUP <%S>%->", gs
, type
,
1223 gimple_try_eval (gs
), gimple_try_cleanup (gs
));
1227 pp_string (buffer
, "try");
1228 newline_and_indent (buffer
, spc
+ 2);
1229 pp_left_brace (buffer
);
1230 pp_newline (buffer
);
1232 dump_gimple_seq (buffer
, gimple_try_eval (gs
), spc
+ 4, flags
);
1233 newline_and_indent (buffer
, spc
+ 2);
1234 pp_right_brace (buffer
);
1236 gimple_seq seq
= gimple_try_cleanup (gs
);
1238 if (gimple_try_kind (gs
) == GIMPLE_TRY_CATCH
)
1240 newline_and_indent (buffer
, spc
);
1241 pp_string (buffer
, "catch");
1242 newline_and_indent (buffer
, spc
+ 2);
1243 pp_left_brace (buffer
);
1245 else if (gimple_try_kind (gs
) == GIMPLE_TRY_FINALLY
)
1247 newline_and_indent (buffer
, spc
);
1248 pp_string (buffer
, "finally");
1249 newline_and_indent (buffer
, spc
+ 2);
1250 pp_left_brace (buffer
);
1252 if (seq
&& is_a
<geh_else
*> (gimple_seq_first_stmt (seq
))
1253 && gimple_seq_nondebug_singleton_p (seq
))
1255 geh_else
*stmt
= as_a
<geh_else
*> (gimple_seq_first_stmt (seq
));
1256 seq
= gimple_eh_else_n_body (stmt
);
1257 pp_newline (buffer
);
1258 dump_gimple_seq (buffer
, seq
, spc
+ 4, flags
);
1259 newline_and_indent (buffer
, spc
+ 2);
1260 pp_right_brace (buffer
);
1261 seq
= gimple_eh_else_e_body (stmt
);
1262 newline_and_indent (buffer
, spc
);
1263 pp_string (buffer
, "else");
1264 newline_and_indent (buffer
, spc
+ 2);
1265 pp_left_brace (buffer
);
1269 pp_string (buffer
, " <UNKNOWN GIMPLE_TRY> {");
1271 pp_newline (buffer
);
1272 dump_gimple_seq (buffer
, seq
, spc
+ 4, flags
);
1273 newline_and_indent (buffer
, spc
+ 2);
1274 pp_right_brace (buffer
);
1279 /* Dump a GIMPLE_CATCH tuple on the pretty_printer BUFFER, SPC spaces of
1280 indent. FLAGS specifies details to show in the dump (see TDF_* in
1284 dump_gimple_catch (pretty_printer
*buffer
, const gcatch
*gs
, int spc
,
1287 if (flags
& TDF_RAW
)
1288 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %+CATCH <%S>%->", gs
,
1289 gimple_catch_types (gs
), gimple_catch_handler (gs
));
1291 dump_gimple_fmt (buffer
, spc
, flags
, "catch (%T)%+{%S}",
1292 gimple_catch_types (gs
), gimple_catch_handler (gs
));
1296 /* Dump a GIMPLE_EH_FILTER tuple on the pretty_printer BUFFER, SPC spaces of
1297 indent. FLAGS specifies details to show in the dump (see TDF_* in
1301 dump_gimple_eh_filter (pretty_printer
*buffer
, const geh_filter
*gs
, int spc
,
1304 if (flags
& TDF_RAW
)
1305 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %+FAILURE <%S>%->", gs
,
1306 gimple_eh_filter_types (gs
),
1307 gimple_eh_filter_failure (gs
));
1309 dump_gimple_fmt (buffer
, spc
, flags
, "<<<eh_filter (%T)>>>%+{%+%S%-}",
1310 gimple_eh_filter_types (gs
),
1311 gimple_eh_filter_failure (gs
));
1315 /* Dump a GIMPLE_EH_MUST_NOT_THROW tuple. */
1318 dump_gimple_eh_must_not_throw (pretty_printer
*buffer
,
1319 const geh_mnt
*gs
, int spc
, dump_flags_t flags
)
1321 if (flags
& TDF_RAW
)
1322 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
,
1323 gimple_eh_must_not_throw_fndecl (gs
));
1325 dump_gimple_fmt (buffer
, spc
, flags
, "<<<eh_must_not_throw (%T)>>>",
1326 gimple_eh_must_not_throw_fndecl (gs
));
1330 /* Dump a GIMPLE_EH_ELSE tuple on the pretty_printer BUFFER, SPC spaces of
1331 indent. FLAGS specifies details to show in the dump (see TDF_* in
1335 dump_gimple_eh_else (pretty_printer
*buffer
, const geh_else
*gs
, int spc
,
1338 if (flags
& TDF_RAW
)
1339 dump_gimple_fmt (buffer
, spc
, flags
,
1340 "%G <%+N_BODY <%S>%nE_BODY <%S>%->", gs
,
1341 gimple_eh_else_n_body (gs
), gimple_eh_else_e_body (gs
));
1343 dump_gimple_fmt (buffer
, spc
, flags
,
1344 "<<<if_normal_exit>>>%+{%S}%-<<<else_eh_exit>>>%+{%S}",
1345 gimple_eh_else_n_body (gs
), gimple_eh_else_e_body (gs
));
1349 /* Dump a GIMPLE_RESX tuple on the pretty_printer BUFFER, SPC spaces of
1350 indent. FLAGS specifies details to show in the dump (see TDF_* in
1354 dump_gimple_resx (pretty_printer
*buffer
, const gresx
*gs
, int spc
,
1357 if (flags
& TDF_RAW
)
1358 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%d>", gs
,
1359 gimple_resx_region (gs
));
1361 dump_gimple_fmt (buffer
, spc
, flags
, "resx %d", gimple_resx_region (gs
));
1364 /* Dump a GIMPLE_EH_DISPATCH tuple on the pretty_printer BUFFER. */
1367 dump_gimple_eh_dispatch (pretty_printer
*buffer
, const geh_dispatch
*gs
,
1368 int spc
, dump_flags_t flags
)
1370 if (flags
& TDF_RAW
)
1371 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%d>", gs
,
1372 gimple_eh_dispatch_region (gs
));
1374 dump_gimple_fmt (buffer
, spc
, flags
, "eh_dispatch %d",
1375 gimple_eh_dispatch_region (gs
));
1378 /* Dump a GIMPLE_DEBUG tuple on the pretty_printer BUFFER, SPC spaces
1379 of indent. FLAGS specifies details to show in the dump (see TDF_*
1383 dump_gimple_debug (pretty_printer
*buffer
, const gdebug
*gs
, int spc
,
1386 switch (gs
->subcode
)
1388 case GIMPLE_DEBUG_BIND
:
1389 if (flags
& TDF_RAW
)
1390 dump_gimple_fmt (buffer
, spc
, flags
, "%G BIND <%T, %T>", gs
,
1391 gimple_debug_bind_get_var (gs
),
1392 gimple_debug_bind_get_value (gs
));
1394 dump_gimple_fmt (buffer
, spc
, flags
, "# DEBUG %T => %T",
1395 gimple_debug_bind_get_var (gs
),
1396 gimple_debug_bind_get_value (gs
));
1399 case GIMPLE_DEBUG_SOURCE_BIND
:
1400 if (flags
& TDF_RAW
)
1401 dump_gimple_fmt (buffer
, spc
, flags
, "%G SRCBIND <%T, %T>", gs
,
1402 gimple_debug_source_bind_get_var (gs
),
1403 gimple_debug_source_bind_get_value (gs
));
1405 dump_gimple_fmt (buffer
, spc
, flags
, "# DEBUG %T s=> %T",
1406 gimple_debug_source_bind_get_var (gs
),
1407 gimple_debug_source_bind_get_value (gs
));
1410 case GIMPLE_DEBUG_BEGIN_STMT
:
1411 if (flags
& TDF_RAW
)
1412 dump_gimple_fmt (buffer
, spc
, flags
, "%G BEGIN_STMT", gs
);
1414 dump_gimple_fmt (buffer
, spc
, flags
, "# DEBUG BEGIN_STMT");
1417 case GIMPLE_DEBUG_INLINE_ENTRY
:
1418 if (flags
& TDF_RAW
)
1419 dump_gimple_fmt (buffer
, spc
, flags
, "%G INLINE_ENTRY %T", gs
,
1421 ? block_ultimate_origin (gimple_block (gs
))
1424 dump_gimple_fmt (buffer
, spc
, flags
, "# DEBUG INLINE_ENTRY %T",
1426 ? block_ultimate_origin (gimple_block (gs
))
1435 /* Dump a GIMPLE_OMP_FOR tuple on the pretty_printer BUFFER. */
1437 dump_gimple_omp_for (pretty_printer
*buffer
, const gomp_for
*gs
, int spc
,
1442 if (flags
& TDF_RAW
)
1445 switch (gimple_omp_for_kind (gs
))
1447 case GF_OMP_FOR_KIND_FOR
:
1450 case GF_OMP_FOR_KIND_DISTRIBUTE
:
1451 kind
= " distribute";
1453 case GF_OMP_FOR_KIND_TASKLOOP
:
1456 case GF_OMP_FOR_KIND_OACC_LOOP
:
1457 kind
= " oacc_loop";
1459 case GF_OMP_FOR_KIND_SIMD
:
1465 dump_gimple_fmt (buffer
, spc
, flags
, "%G%s <%+BODY <%S>%nCLAUSES <", gs
,
1466 kind
, gimple_omp_body (gs
));
1467 dump_omp_clauses (buffer
, gimple_omp_for_clauses (gs
), spc
, flags
);
1468 dump_gimple_fmt (buffer
, spc
, flags
, " >,");
1469 for (i
= 0; i
< gimple_omp_for_collapse (gs
); i
++)
1470 dump_gimple_fmt (buffer
, spc
, flags
,
1471 "%+%T, %T, %T, %s, %T,%n",
1472 gimple_omp_for_index (gs
, i
),
1473 gimple_omp_for_initial (gs
, i
),
1474 gimple_omp_for_final (gs
, i
),
1475 get_tree_code_name (gimple_omp_for_cond (gs
, i
)),
1476 gimple_omp_for_incr (gs
, i
));
1477 dump_gimple_fmt (buffer
, spc
, flags
, "PRE_BODY <%S>%->",
1478 gimple_omp_for_pre_body (gs
));
1482 switch (gimple_omp_for_kind (gs
))
1484 case GF_OMP_FOR_KIND_FOR
:
1485 pp_string (buffer
, "#pragma omp for");
1487 case GF_OMP_FOR_KIND_DISTRIBUTE
:
1488 pp_string (buffer
, "#pragma omp distribute");
1490 case GF_OMP_FOR_KIND_TASKLOOP
:
1491 pp_string (buffer
, "#pragma omp taskloop");
1493 case GF_OMP_FOR_KIND_OACC_LOOP
:
1494 pp_string (buffer
, "#pragma acc loop");
1496 case GF_OMP_FOR_KIND_SIMD
:
1497 pp_string (buffer
, "#pragma omp simd");
1499 case GF_OMP_FOR_KIND_GRID_LOOP
:
1500 pp_string (buffer
, "#pragma omp for grid_loop");
1505 dump_omp_clauses (buffer
, gimple_omp_for_clauses (gs
), spc
, flags
);
1506 for (i
= 0; i
< gimple_omp_for_collapse (gs
); i
++)
1510 newline_and_indent (buffer
, spc
);
1511 pp_string (buffer
, "for (");
1512 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
1514 pp_string (buffer
, " = ");
1515 dump_generic_node (buffer
, gimple_omp_for_initial (gs
, i
), spc
,
1517 pp_string (buffer
, "; ");
1519 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
1522 switch (gimple_omp_for_cond (gs
, i
))
1528 pp_greater (buffer
);
1531 pp_less_equal (buffer
);
1534 pp_greater_equal (buffer
);
1537 pp_string (buffer
, "!=");
1543 dump_generic_node (buffer
, gimple_omp_for_final (gs
, i
), spc
,
1545 pp_string (buffer
, "; ");
1547 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
1549 pp_string (buffer
, " = ");
1550 dump_generic_node (buffer
, gimple_omp_for_incr (gs
, i
), spc
,
1552 pp_right_paren (buffer
);
1555 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1557 newline_and_indent (buffer
, spc
+ 2);
1558 pp_left_brace (buffer
);
1559 pp_newline (buffer
);
1560 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1561 newline_and_indent (buffer
, spc
+ 2);
1562 pp_right_brace (buffer
);
1567 /* Dump a GIMPLE_OMP_CONTINUE tuple on the pretty_printer BUFFER. */
1570 dump_gimple_omp_continue (pretty_printer
*buffer
, const gomp_continue
*gs
,
1571 int spc
, dump_flags_t flags
)
1573 if (flags
& TDF_RAW
)
1575 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T>", gs
,
1576 gimple_omp_continue_control_def (gs
),
1577 gimple_omp_continue_control_use (gs
));
1581 pp_string (buffer
, "#pragma omp continue (");
1582 dump_generic_node (buffer
, gimple_omp_continue_control_def (gs
),
1586 dump_generic_node (buffer
, gimple_omp_continue_control_use (gs
),
1588 pp_right_paren (buffer
);
1592 /* Dump a GIMPLE_OMP_SINGLE tuple on the pretty_printer BUFFER. */
1595 dump_gimple_omp_single (pretty_printer
*buffer
, const gomp_single
*gs
,
1596 int spc
, dump_flags_t flags
)
1598 if (flags
& TDF_RAW
)
1600 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1601 gimple_omp_body (gs
));
1602 dump_omp_clauses (buffer
, gimple_omp_single_clauses (gs
), spc
, flags
);
1603 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1607 pp_string (buffer
, "#pragma omp single");
1608 dump_omp_clauses (buffer
, gimple_omp_single_clauses (gs
), spc
, flags
);
1609 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1611 newline_and_indent (buffer
, spc
+ 2);
1612 pp_left_brace (buffer
);
1613 pp_newline (buffer
);
1614 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1615 newline_and_indent (buffer
, spc
+ 2);
1616 pp_right_brace (buffer
);
1621 /* Dump a GIMPLE_OMP_TASKGROUP tuple on the pretty_printer BUFFER. */
1624 dump_gimple_omp_taskgroup (pretty_printer
*buffer
, const gimple
*gs
,
1625 int spc
, dump_flags_t flags
)
1627 if (flags
& TDF_RAW
)
1629 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1630 gimple_omp_body (gs
));
1631 dump_omp_clauses (buffer
, gimple_omp_taskgroup_clauses (gs
), spc
, flags
);
1632 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1636 pp_string (buffer
, "#pragma omp taskgroup");
1637 dump_omp_clauses (buffer
, gimple_omp_taskgroup_clauses (gs
), spc
, flags
);
1638 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1640 newline_and_indent (buffer
, spc
+ 2);
1641 pp_left_brace (buffer
);
1642 pp_newline (buffer
);
1643 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1644 newline_and_indent (buffer
, spc
+ 2);
1645 pp_right_brace (buffer
);
1650 /* Dump a GIMPLE_OMP_TARGET tuple on the pretty_printer BUFFER. */
1653 dump_gimple_omp_target (pretty_printer
*buffer
, const gomp_target
*gs
,
1654 int spc
, dump_flags_t flags
)
1657 switch (gimple_omp_target_kind (gs
))
1659 case GF_OMP_TARGET_KIND_REGION
:
1662 case GF_OMP_TARGET_KIND_DATA
:
1665 case GF_OMP_TARGET_KIND_UPDATE
:
1668 case GF_OMP_TARGET_KIND_ENTER_DATA
:
1669 kind
= " enter data";
1671 case GF_OMP_TARGET_KIND_EXIT_DATA
:
1672 kind
= " exit data";
1674 case GF_OMP_TARGET_KIND_OACC_KERNELS
:
1675 kind
= " oacc_kernels";
1677 case GF_OMP_TARGET_KIND_OACC_PARALLEL
:
1678 kind
= " oacc_parallel";
1680 case GF_OMP_TARGET_KIND_OACC_SERIAL
:
1681 kind
= " oacc_serial";
1683 case GF_OMP_TARGET_KIND_OACC_DATA
:
1684 kind
= " oacc_data";
1686 case GF_OMP_TARGET_KIND_OACC_UPDATE
:
1687 kind
= " oacc_update";
1689 case GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA
:
1690 kind
= " oacc_enter_exit_data";
1692 case GF_OMP_TARGET_KIND_OACC_DECLARE
:
1693 kind
= " oacc_declare";
1695 case GF_OMP_TARGET_KIND_OACC_HOST_DATA
:
1696 kind
= " oacc_host_data";
1701 if (flags
& TDF_RAW
)
1703 dump_gimple_fmt (buffer
, spc
, flags
, "%G%s <%+BODY <%S>%nCLAUSES <", gs
,
1704 kind
, gimple_omp_body (gs
));
1705 dump_omp_clauses (buffer
, gimple_omp_target_clauses (gs
), spc
, flags
);
1706 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T%n>",
1707 gimple_omp_target_child_fn (gs
),
1708 gimple_omp_target_data_arg (gs
));
1712 pp_string (buffer
, "#pragma omp target");
1713 pp_string (buffer
, kind
);
1714 dump_omp_clauses (buffer
, gimple_omp_target_clauses (gs
), spc
, flags
);
1715 if (gimple_omp_target_child_fn (gs
))
1717 pp_string (buffer
, " [child fn: ");
1718 dump_generic_node (buffer
, gimple_omp_target_child_fn (gs
),
1720 pp_string (buffer
, " (");
1721 if (gimple_omp_target_data_arg (gs
))
1722 dump_generic_node (buffer
, gimple_omp_target_data_arg (gs
),
1725 pp_string (buffer
, "???");
1726 pp_string (buffer
, ")]");
1728 gimple_seq body
= gimple_omp_body (gs
);
1729 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
1731 newline_and_indent (buffer
, spc
+ 2);
1732 pp_left_brace (buffer
);
1733 pp_newline (buffer
);
1734 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
1735 newline_and_indent (buffer
, spc
+ 2);
1736 pp_right_brace (buffer
);
1740 pp_newline (buffer
);
1741 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
1746 /* Dump a GIMPLE_OMP_TEAMS tuple on the pretty_printer BUFFER. */
1749 dump_gimple_omp_teams (pretty_printer
*buffer
, const gomp_teams
*gs
, int spc
,
1752 if (flags
& TDF_RAW
)
1754 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1755 gimple_omp_body (gs
));
1756 dump_omp_clauses (buffer
, gimple_omp_teams_clauses (gs
), spc
, flags
);
1757 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1761 pp_string (buffer
, "#pragma omp teams");
1762 dump_omp_clauses (buffer
, gimple_omp_teams_clauses (gs
), spc
, flags
);
1763 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1765 newline_and_indent (buffer
, spc
+ 2);
1766 pp_character (buffer
, '{');
1767 pp_newline (buffer
);
1768 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1769 newline_and_indent (buffer
, spc
+ 2);
1770 pp_character (buffer
, '}');
1775 /* Dump a GIMPLE_OMP_SECTIONS tuple on the pretty_printer BUFFER. */
1778 dump_gimple_omp_sections (pretty_printer
*buffer
, const gomp_sections
*gs
,
1779 int spc
, dump_flags_t flags
)
1781 if (flags
& TDF_RAW
)
1783 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1784 gimple_omp_body (gs
));
1785 dump_omp_clauses (buffer
, gimple_omp_sections_clauses (gs
), spc
, flags
);
1786 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1790 pp_string (buffer
, "#pragma omp sections");
1791 if (gimple_omp_sections_control (gs
))
1793 pp_string (buffer
, " <");
1794 dump_generic_node (buffer
, gimple_omp_sections_control (gs
), spc
,
1796 pp_greater (buffer
);
1798 dump_omp_clauses (buffer
, gimple_omp_sections_clauses (gs
), spc
, flags
);
1799 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1801 newline_and_indent (buffer
, spc
+ 2);
1802 pp_left_brace (buffer
);
1803 pp_newline (buffer
);
1804 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1805 newline_and_indent (buffer
, spc
+ 2);
1806 pp_right_brace (buffer
);
1811 /* Dump a GIMPLE_OMP_{MASTER,ORDERED,SECTION} tuple on the
1812 pretty_printer BUFFER. */
1815 dump_gimple_omp_block (pretty_printer
*buffer
, const gimple
*gs
, int spc
,
1818 if (flags
& TDF_RAW
)
1819 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1820 gimple_omp_body (gs
));
1823 switch (gimple_code (gs
))
1825 case GIMPLE_OMP_MASTER
:
1826 pp_string (buffer
, "#pragma omp master");
1828 case GIMPLE_OMP_SECTION
:
1829 pp_string (buffer
, "#pragma omp section");
1831 case GIMPLE_OMP_GRID_BODY
:
1832 pp_string (buffer
, "#pragma omp gridified body");
1837 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1839 newline_and_indent (buffer
, spc
+ 2);
1840 pp_left_brace (buffer
);
1841 pp_newline (buffer
);
1842 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1843 newline_and_indent (buffer
, spc
+ 2);
1844 pp_right_brace (buffer
);
1849 /* Dump a GIMPLE_OMP_CRITICAL tuple on the pretty_printer BUFFER. */
1852 dump_gimple_omp_critical (pretty_printer
*buffer
, const gomp_critical
*gs
,
1853 int spc
, dump_flags_t flags
)
1855 if (flags
& TDF_RAW
)
1856 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1857 gimple_omp_body (gs
));
1860 pp_string (buffer
, "#pragma omp critical");
1861 if (gimple_omp_critical_name (gs
))
1863 pp_string (buffer
, " (");
1864 dump_generic_node (buffer
, gimple_omp_critical_name (gs
), spc
,
1866 pp_right_paren (buffer
);
1868 dump_omp_clauses (buffer
, gimple_omp_critical_clauses (gs
), spc
, flags
);
1869 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1871 newline_and_indent (buffer
, spc
+ 2);
1872 pp_left_brace (buffer
);
1873 pp_newline (buffer
);
1874 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1875 newline_and_indent (buffer
, spc
+ 2);
1876 pp_right_brace (buffer
);
1881 /* Dump a GIMPLE_OMP_ORDERED tuple on the pretty_printer BUFFER. */
1884 dump_gimple_omp_ordered (pretty_printer
*buffer
, const gomp_ordered
*gs
,
1885 int spc
, dump_flags_t flags
)
1887 if (flags
& TDF_RAW
)
1888 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1889 gimple_omp_body (gs
));
1892 pp_string (buffer
, "#pragma omp ordered");
1893 dump_omp_clauses (buffer
, gimple_omp_ordered_clauses (gs
), spc
, flags
);
1894 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1896 newline_and_indent (buffer
, spc
+ 2);
1897 pp_left_brace (buffer
);
1898 pp_newline (buffer
);
1899 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1900 newline_and_indent (buffer
, spc
+ 2);
1901 pp_right_brace (buffer
);
1906 /* Dump a GIMPLE_OMP_SCAN tuple on the pretty_printer BUFFER. */
1909 dump_gimple_omp_scan (pretty_printer
*buffer
, const gomp_scan
*gs
,
1910 int spc
, dump_flags_t flags
)
1912 if (flags
& TDF_RAW
)
1913 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1914 gimple_omp_body (gs
));
1917 if (gimple_omp_scan_clauses (gs
))
1919 pp_string (buffer
, "#pragma omp scan");
1920 dump_omp_clauses (buffer
, gimple_omp_scan_clauses (gs
), spc
, flags
);
1922 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1924 newline_and_indent (buffer
, spc
+ 2);
1925 pp_left_brace (buffer
);
1926 pp_newline (buffer
);
1927 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1928 newline_and_indent (buffer
, spc
+ 2);
1929 pp_right_brace (buffer
);
1934 /* Dump a GIMPLE_OMP_RETURN tuple on the pretty_printer BUFFER. */
1937 dump_gimple_omp_return (pretty_printer
*buffer
, const gimple
*gs
, int spc
,
1940 if (flags
& TDF_RAW
)
1942 dump_gimple_fmt (buffer
, spc
, flags
, "%G <nowait=%d", gs
,
1943 (int) gimple_omp_return_nowait_p (gs
));
1944 if (gimple_omp_return_lhs (gs
))
1945 dump_gimple_fmt (buffer
, spc
, flags
, ", lhs=%T>",
1946 gimple_omp_return_lhs (gs
));
1948 dump_gimple_fmt (buffer
, spc
, flags
, ">");
1952 pp_string (buffer
, "#pragma omp return");
1953 if (gimple_omp_return_nowait_p (gs
))
1954 pp_string (buffer
, "(nowait)");
1955 if (gimple_omp_return_lhs (gs
))
1957 pp_string (buffer
, " (set ");
1958 dump_generic_node (buffer
, gimple_omp_return_lhs (gs
),
1960 pp_character (buffer
, ')');
1965 /* Dump a GIMPLE_TRANSACTION tuple on the pretty_printer BUFFER. */
1968 dump_gimple_transaction (pretty_printer
*buffer
, const gtransaction
*gs
,
1969 int spc
, dump_flags_t flags
)
1971 unsigned subcode
= gimple_transaction_subcode (gs
);
1973 if (flags
& TDF_RAW
)
1975 dump_gimple_fmt (buffer
, spc
, flags
,
1976 "%G [SUBCODE=%x,NORM=%T,UNINST=%T,OVER=%T] "
1978 gs
, subcode
, gimple_transaction_label_norm (gs
),
1979 gimple_transaction_label_uninst (gs
),
1980 gimple_transaction_label_over (gs
),
1981 gimple_transaction_body (gs
));
1985 if (subcode
& GTMA_IS_OUTER
)
1986 pp_string (buffer
, "__transaction_atomic [[outer]]");
1987 else if (subcode
& GTMA_IS_RELAXED
)
1988 pp_string (buffer
, "__transaction_relaxed");
1990 pp_string (buffer
, "__transaction_atomic");
1991 subcode
&= ~GTMA_DECLARATION_MASK
;
1993 if (gimple_transaction_body (gs
))
1995 newline_and_indent (buffer
, spc
+ 2);
1996 pp_left_brace (buffer
);
1997 pp_newline (buffer
);
1998 dump_gimple_seq (buffer
, gimple_transaction_body (gs
),
2000 newline_and_indent (buffer
, spc
+ 2);
2001 pp_right_brace (buffer
);
2005 pp_string (buffer
, " //");
2006 if (gimple_transaction_label_norm (gs
))
2008 pp_string (buffer
, " NORM=");
2009 dump_generic_node (buffer
, gimple_transaction_label_norm (gs
),
2012 if (gimple_transaction_label_uninst (gs
))
2014 pp_string (buffer
, " UNINST=");
2015 dump_generic_node (buffer
, gimple_transaction_label_uninst (gs
),
2018 if (gimple_transaction_label_over (gs
))
2020 pp_string (buffer
, " OVER=");
2021 dump_generic_node (buffer
, gimple_transaction_label_over (gs
),
2026 pp_string (buffer
, " SUBCODE=[ ");
2027 if (subcode
& GTMA_HAVE_ABORT
)
2029 pp_string (buffer
, "GTMA_HAVE_ABORT ");
2030 subcode
&= ~GTMA_HAVE_ABORT
;
2032 if (subcode
& GTMA_HAVE_LOAD
)
2034 pp_string (buffer
, "GTMA_HAVE_LOAD ");
2035 subcode
&= ~GTMA_HAVE_LOAD
;
2037 if (subcode
& GTMA_HAVE_STORE
)
2039 pp_string (buffer
, "GTMA_HAVE_STORE ");
2040 subcode
&= ~GTMA_HAVE_STORE
;
2042 if (subcode
& GTMA_MAY_ENTER_IRREVOCABLE
)
2044 pp_string (buffer
, "GTMA_MAY_ENTER_IRREVOCABLE ");
2045 subcode
&= ~GTMA_MAY_ENTER_IRREVOCABLE
;
2047 if (subcode
& GTMA_DOES_GO_IRREVOCABLE
)
2049 pp_string (buffer
, "GTMA_DOES_GO_IRREVOCABLE ");
2050 subcode
&= ~GTMA_DOES_GO_IRREVOCABLE
;
2052 if (subcode
& GTMA_HAS_NO_INSTRUMENTATION
)
2054 pp_string (buffer
, "GTMA_HAS_NO_INSTRUMENTATION ");
2055 subcode
&= ~GTMA_HAS_NO_INSTRUMENTATION
;
2058 pp_printf (buffer
, "0x%x ", subcode
);
2059 pp_right_bracket (buffer
);
2065 /* Dump a GIMPLE_ASM tuple on the pretty_printer BUFFER, SPC spaces of
2066 indent. FLAGS specifies details to show in the dump (see TDF_* in
2070 dump_gimple_asm (pretty_printer
*buffer
, const gasm
*gs
, int spc
,
2073 unsigned int i
, n
, f
, fields
;
2075 if (flags
& TDF_RAW
)
2077 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+STRING <%n%s%n>", gs
,
2078 gimple_asm_string (gs
));
2080 n
= gimple_asm_noutputs (gs
);
2083 newline_and_indent (buffer
, spc
+ 2);
2084 pp_string (buffer
, "OUTPUT: ");
2085 for (i
= 0; i
< n
; i
++)
2087 dump_generic_node (buffer
, gimple_asm_output_op (gs
, i
),
2090 pp_string (buffer
, ", ");
2094 n
= gimple_asm_ninputs (gs
);
2097 newline_and_indent (buffer
, spc
+ 2);
2098 pp_string (buffer
, "INPUT: ");
2099 for (i
= 0; i
< n
; i
++)
2101 dump_generic_node (buffer
, gimple_asm_input_op (gs
, i
),
2104 pp_string (buffer
, ", ");
2108 n
= gimple_asm_nclobbers (gs
);
2111 newline_and_indent (buffer
, spc
+ 2);
2112 pp_string (buffer
, "CLOBBER: ");
2113 for (i
= 0; i
< n
; i
++)
2115 dump_generic_node (buffer
, gimple_asm_clobber_op (gs
, i
),
2118 pp_string (buffer
, ", ");
2122 n
= gimple_asm_nlabels (gs
);
2125 newline_and_indent (buffer
, spc
+ 2);
2126 pp_string (buffer
, "LABEL: ");
2127 for (i
= 0; i
< n
; i
++)
2129 dump_generic_node (buffer
, gimple_asm_label_op (gs
, i
),
2132 pp_string (buffer
, ", ");
2136 newline_and_indent (buffer
, spc
);
2137 pp_greater (buffer
);
2141 pp_string (buffer
, "__asm__");
2142 if (gimple_asm_volatile_p (gs
))
2143 pp_string (buffer
, " __volatile__");
2144 if (gimple_asm_inline_p (gs
))
2145 pp_string (buffer
, " __inline__");
2146 if (gimple_asm_nlabels (gs
))
2147 pp_string (buffer
, " goto");
2148 pp_string (buffer
, "(\"");
2149 pp_string (buffer
, gimple_asm_string (gs
));
2150 pp_string (buffer
, "\"");
2152 if (gimple_asm_nlabels (gs
))
2154 else if (gimple_asm_nclobbers (gs
))
2156 else if (gimple_asm_ninputs (gs
))
2158 else if (gimple_asm_noutputs (gs
))
2163 for (f
= 0; f
< fields
; ++f
)
2165 pp_string (buffer
, " : ");
2170 n
= gimple_asm_noutputs (gs
);
2171 for (i
= 0; i
< n
; i
++)
2173 dump_generic_node (buffer
, gimple_asm_output_op (gs
, i
),
2176 pp_string (buffer
, ", ");
2181 n
= gimple_asm_ninputs (gs
);
2182 for (i
= 0; i
< n
; i
++)
2184 dump_generic_node (buffer
, gimple_asm_input_op (gs
, i
),
2187 pp_string (buffer
, ", ");
2192 n
= gimple_asm_nclobbers (gs
);
2193 for (i
= 0; i
< n
; i
++)
2195 dump_generic_node (buffer
, gimple_asm_clobber_op (gs
, i
),
2198 pp_string (buffer
, ", ");
2203 n
= gimple_asm_nlabels (gs
);
2204 for (i
= 0; i
< n
; i
++)
2206 dump_generic_node (buffer
, gimple_asm_label_op (gs
, i
),
2209 pp_string (buffer
, ", ");
2218 pp_string (buffer
, ");");
2222 /* Dump ptr_info and range_info for NODE on pretty_printer BUFFER with
2223 SPC spaces of indent. */
2226 dump_ssaname_info (pretty_printer
*buffer
, tree node
, int spc
)
2228 if (TREE_CODE (node
) != SSA_NAME
)
2231 if (POINTER_TYPE_P (TREE_TYPE (node
))
2232 && SSA_NAME_PTR_INFO (node
))
2234 unsigned int align
, misalign
;
2235 struct ptr_info_def
*pi
= SSA_NAME_PTR_INFO (node
);
2236 pp_string (buffer
, "# PT = ");
2237 pp_points_to_solution (buffer
, &pi
->pt
);
2238 newline_and_indent (buffer
, spc
);
2239 if (get_ptr_info_alignment (pi
, &align
, &misalign
))
2241 pp_printf (buffer
, "# ALIGN = %u, MISALIGN = %u", align
, misalign
);
2242 newline_and_indent (buffer
, spc
);
2246 if (!POINTER_TYPE_P (TREE_TYPE (node
))
2247 && SSA_NAME_RANGE_INFO (node
))
2249 wide_int min
, max
, nonzero_bits
;
2250 value_range_kind range_type
= get_range_info (node
, &min
, &max
);
2252 if (range_type
== VR_VARYING
)
2253 pp_printf (buffer
, "# RANGE VR_VARYING");
2254 else if (range_type
== VR_RANGE
|| range_type
== VR_ANTI_RANGE
)
2256 pp_printf (buffer
, "# RANGE ");
2257 pp_printf (buffer
, "%s[", range_type
== VR_RANGE
? "" : "~");
2258 pp_wide_int (buffer
, min
, TYPE_SIGN (TREE_TYPE (node
)));
2259 pp_printf (buffer
, ", ");
2260 pp_wide_int (buffer
, max
, TYPE_SIGN (TREE_TYPE (node
)));
2261 pp_printf (buffer
, "]");
2263 nonzero_bits
= get_nonzero_bits (node
);
2264 if (nonzero_bits
!= -1)
2266 pp_string (buffer
, " NONZERO ");
2267 pp_wide_int (buffer
, nonzero_bits
, UNSIGNED
);
2269 newline_and_indent (buffer
, spc
);
2273 /* As dump_ssaname_info, but dump to FILE. */
2276 dump_ssaname_info_to_file (FILE *file
, tree node
, int spc
)
2278 pretty_printer buffer
;
2279 pp_needs_newline (&buffer
) = true;
2280 buffer
.buffer
->stream
= file
;
2281 dump_ssaname_info (&buffer
, node
, spc
);
2285 /* Dump a PHI node PHI. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1.
2286 The caller is responsible for calling pp_flush on BUFFER to finalize
2287 pretty printer. If COMMENT is true, print this after #. */
2290 dump_gimple_phi (pretty_printer
*buffer
, const gphi
*phi
, int spc
, bool comment
,
2294 tree lhs
= gimple_phi_result (phi
);
2296 if (flags
& TDF_ALIAS
)
2297 dump_ssaname_info (buffer
, lhs
, spc
);
2300 pp_string (buffer
, "# ");
2302 if (flags
& TDF_RAW
)
2303 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, ", phi
,
2304 gimple_phi_result (phi
));
2307 dump_generic_node (buffer
, lhs
, spc
, flags
, false);
2308 if (flags
& TDF_GIMPLE
)
2309 pp_string (buffer
, " = __PHI (");
2311 pp_string (buffer
, " = PHI <");
2313 for (i
= 0; i
< gimple_phi_num_args (phi
); i
++)
2315 if ((flags
& TDF_LINENO
) && gimple_phi_arg_has_location (phi
, i
))
2316 dump_location (buffer
, gimple_phi_arg_location (phi
, i
));
2317 basic_block src
= gimple_phi_arg_edge (phi
, i
)->src
;
2318 if (flags
& TDF_GIMPLE
)
2320 pp_string (buffer
, "__BB");
2321 pp_decimal_int (buffer
, src
->index
);
2322 pp_string (buffer
, ": ");
2324 dump_generic_node (buffer
, gimple_phi_arg_def (phi
, i
), spc
, flags
,
2326 if (! (flags
& TDF_GIMPLE
))
2328 pp_left_paren (buffer
);
2329 pp_decimal_int (buffer
, src
->index
);
2330 pp_right_paren (buffer
);
2332 if (i
< gimple_phi_num_args (phi
) - 1)
2333 pp_string (buffer
, ", ");
2335 if (flags
& TDF_GIMPLE
)
2336 pp_string (buffer
, ");");
2338 pp_greater (buffer
);
2342 /* Dump a GIMPLE_OMP_PARALLEL tuple on the pretty_printer BUFFER, SPC spaces
2343 of indent. FLAGS specifies details to show in the dump (see TDF_* in
2347 dump_gimple_omp_parallel (pretty_printer
*buffer
, const gomp_parallel
*gs
,
2348 int spc
, dump_flags_t flags
)
2350 if (flags
& TDF_RAW
)
2352 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
2353 gimple_omp_body (gs
));
2354 dump_omp_clauses (buffer
, gimple_omp_parallel_clauses (gs
), spc
, flags
);
2355 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T%n>",
2356 gimple_omp_parallel_child_fn (gs
),
2357 gimple_omp_parallel_data_arg (gs
));
2362 pp_string (buffer
, "#pragma omp parallel");
2363 dump_omp_clauses (buffer
, gimple_omp_parallel_clauses (gs
), spc
, flags
);
2364 if (gimple_omp_parallel_child_fn (gs
))
2366 pp_string (buffer
, " [child fn: ");
2367 dump_generic_node (buffer
, gimple_omp_parallel_child_fn (gs
),
2369 pp_string (buffer
, " (");
2370 if (gimple_omp_parallel_data_arg (gs
))
2371 dump_generic_node (buffer
, gimple_omp_parallel_data_arg (gs
),
2374 pp_string (buffer
, "???");
2375 pp_string (buffer
, ")]");
2377 body
= gimple_omp_body (gs
);
2378 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
2380 newline_and_indent (buffer
, spc
+ 2);
2381 pp_left_brace (buffer
);
2382 pp_newline (buffer
);
2383 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
2384 newline_and_indent (buffer
, spc
+ 2);
2385 pp_right_brace (buffer
);
2389 pp_newline (buffer
);
2390 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
2396 /* Dump a GIMPLE_OMP_TASK tuple on the pretty_printer BUFFER, SPC spaces
2397 of indent. FLAGS specifies details to show in the dump (see TDF_* in
2401 dump_gimple_omp_task (pretty_printer
*buffer
, const gomp_task
*gs
, int spc
,
2404 if (flags
& TDF_RAW
)
2406 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
2407 gimple_omp_body (gs
));
2408 dump_omp_clauses (buffer
, gimple_omp_task_clauses (gs
), spc
, flags
);
2409 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T, %T, %T, %T%n>",
2410 gimple_omp_task_child_fn (gs
),
2411 gimple_omp_task_data_arg (gs
),
2412 gimple_omp_task_copy_fn (gs
),
2413 gimple_omp_task_arg_size (gs
),
2414 gimple_omp_task_arg_size (gs
));
2419 if (gimple_omp_task_taskloop_p (gs
))
2420 pp_string (buffer
, "#pragma omp taskloop");
2421 else if (gimple_omp_task_taskwait_p (gs
))
2422 pp_string (buffer
, "#pragma omp taskwait");
2424 pp_string (buffer
, "#pragma omp task");
2425 dump_omp_clauses (buffer
, gimple_omp_task_clauses (gs
), spc
, flags
);
2426 if (gimple_omp_task_child_fn (gs
))
2428 pp_string (buffer
, " [child fn: ");
2429 dump_generic_node (buffer
, gimple_omp_task_child_fn (gs
),
2431 pp_string (buffer
, " (");
2432 if (gimple_omp_task_data_arg (gs
))
2433 dump_generic_node (buffer
, gimple_omp_task_data_arg (gs
),
2436 pp_string (buffer
, "???");
2437 pp_string (buffer
, ")]");
2439 body
= gimple_omp_body (gs
);
2440 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
2442 newline_and_indent (buffer
, spc
+ 2);
2443 pp_left_brace (buffer
);
2444 pp_newline (buffer
);
2445 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
2446 newline_and_indent (buffer
, spc
+ 2);
2447 pp_right_brace (buffer
);
2451 pp_newline (buffer
);
2452 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
2458 /* Dump a GIMPLE_OMP_ATOMIC_LOAD tuple on the pretty_printer BUFFER, SPC
2459 spaces of indent. FLAGS specifies details to show in the dump (see TDF_*
2463 dump_gimple_omp_atomic_load (pretty_printer
*buffer
, const gomp_atomic_load
*gs
,
2464 int spc
, dump_flags_t flags
)
2466 if (flags
& TDF_RAW
)
2468 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T>", gs
,
2469 gimple_omp_atomic_load_lhs (gs
),
2470 gimple_omp_atomic_load_rhs (gs
));
2474 pp_string (buffer
, "#pragma omp atomic_load");
2475 dump_omp_atomic_memory_order (buffer
,
2476 gimple_omp_atomic_memory_order (gs
));
2477 if (gimple_omp_atomic_need_value_p (gs
))
2478 pp_string (buffer
, " [needed]");
2479 newline_and_indent (buffer
, spc
+ 2);
2480 dump_generic_node (buffer
, gimple_omp_atomic_load_lhs (gs
),
2486 dump_generic_node (buffer
, gimple_omp_atomic_load_rhs (gs
),
2491 /* Dump a GIMPLE_OMP_ATOMIC_STORE tuple on the pretty_printer BUFFER, SPC
2492 spaces of indent. FLAGS specifies details to show in the dump (see TDF_*
2496 dump_gimple_omp_atomic_store (pretty_printer
*buffer
,
2497 const gomp_atomic_store
*gs
, int spc
,
2500 if (flags
& TDF_RAW
)
2502 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
,
2503 gimple_omp_atomic_store_val (gs
));
2507 pp_string (buffer
, "#pragma omp atomic_store");
2508 dump_omp_atomic_memory_order (buffer
,
2509 gimple_omp_atomic_memory_order (gs
));
2511 if (gimple_omp_atomic_need_value_p (gs
))
2512 pp_string (buffer
, "[needed] ");
2513 pp_left_paren (buffer
);
2514 dump_generic_node (buffer
, gimple_omp_atomic_store_val (gs
),
2516 pp_right_paren (buffer
);
2521 /* Dump all the memory operands for statement GS. BUFFER, SPC and
2522 FLAGS are as in pp_gimple_stmt_1. */
2525 dump_gimple_mem_ops (pretty_printer
*buffer
, const gimple
*gs
, int spc
,
2528 tree vdef
= gimple_vdef (gs
);
2529 tree vuse
= gimple_vuse (gs
);
2531 if (vdef
!= NULL_TREE
)
2533 pp_string (buffer
, "# ");
2534 dump_generic_node (buffer
, vdef
, spc
+ 2, flags
, false);
2535 pp_string (buffer
, " = VDEF <");
2536 dump_generic_node (buffer
, vuse
, spc
+ 2, flags
, false);
2537 pp_greater (buffer
);
2538 newline_and_indent (buffer
, spc
);
2540 else if (vuse
!= NULL_TREE
)
2542 pp_string (buffer
, "# VUSE <");
2543 dump_generic_node (buffer
, vuse
, spc
+ 2, flags
, false);
2544 pp_greater (buffer
);
2545 newline_and_indent (buffer
, spc
);
2550 /* Print the gimple statement GS on the pretty printer BUFFER, SPC
2551 spaces of indent. FLAGS specifies details to show in the dump (see
2552 TDF_* in dumpfile.h). The caller is responsible for calling
2553 pp_flush on BUFFER to finalize the pretty printer. */
2556 pp_gimple_stmt_1 (pretty_printer
*buffer
, const gimple
*gs
, int spc
,
2562 if (flags
& TDF_STMTADDR
)
2563 pp_printf (buffer
, "<&%p> ", (const void *) gs
);
2565 if ((flags
& TDF_LINENO
) && gimple_has_location (gs
))
2566 dump_location (buffer
, gimple_location (gs
));
2570 int lp_nr
= lookup_stmt_eh_lp (gs
);
2572 pp_printf (buffer
, "[LP %d] ", lp_nr
);
2574 pp_printf (buffer
, "[MNT %d] ", -lp_nr
);
2577 if ((flags
& (TDF_VOPS
|TDF_MEMSYMS
))
2578 && gimple_has_mem_ops (gs
))
2579 dump_gimple_mem_ops (buffer
, gs
, spc
, flags
);
2581 if (gimple_has_lhs (gs
)
2582 && (flags
& TDF_ALIAS
))
2583 dump_ssaname_info (buffer
, gimple_get_lhs (gs
), spc
);
2585 switch (gimple_code (gs
))
2588 dump_gimple_asm (buffer
, as_a
<const gasm
*> (gs
), spc
, flags
);
2592 dump_gimple_assign (buffer
, as_a
<const gassign
*> (gs
), spc
, flags
);
2596 dump_gimple_bind (buffer
, as_a
<const gbind
*> (gs
), spc
, flags
);
2600 dump_gimple_call (buffer
, as_a
<const gcall
*> (gs
), spc
, flags
);
2604 dump_gimple_cond (buffer
, as_a
<const gcond
*> (gs
), spc
, flags
);
2608 dump_gimple_label (buffer
, as_a
<const glabel
*> (gs
), spc
, flags
);
2612 dump_gimple_goto (buffer
, as_a
<const ggoto
*> (gs
), spc
, flags
);
2616 pp_string (buffer
, "GIMPLE_NOP");
2620 dump_gimple_return (buffer
, as_a
<const greturn
*> (gs
), spc
, flags
);
2624 dump_gimple_switch (buffer
, as_a
<const gswitch
*> (gs
), spc
, flags
);
2628 dump_gimple_try (buffer
, as_a
<const gtry
*> (gs
), spc
, flags
);
2632 dump_gimple_phi (buffer
, as_a
<const gphi
*> (gs
), spc
, false, flags
);
2635 case GIMPLE_OMP_PARALLEL
:
2636 dump_gimple_omp_parallel (buffer
, as_a
<const gomp_parallel
*> (gs
), spc
,
2640 case GIMPLE_OMP_TASK
:
2641 dump_gimple_omp_task (buffer
, as_a
<const gomp_task
*> (gs
), spc
, flags
);
2644 case GIMPLE_OMP_ATOMIC_LOAD
:
2645 dump_gimple_omp_atomic_load (buffer
, as_a
<const gomp_atomic_load
*> (gs
),
2649 case GIMPLE_OMP_ATOMIC_STORE
:
2650 dump_gimple_omp_atomic_store (buffer
,
2651 as_a
<const gomp_atomic_store
*> (gs
),
2655 case GIMPLE_OMP_FOR
:
2656 dump_gimple_omp_for (buffer
, as_a
<const gomp_for
*> (gs
), spc
, flags
);
2659 case GIMPLE_OMP_CONTINUE
:
2660 dump_gimple_omp_continue (buffer
, as_a
<const gomp_continue
*> (gs
), spc
,
2664 case GIMPLE_OMP_SINGLE
:
2665 dump_gimple_omp_single (buffer
, as_a
<const gomp_single
*> (gs
), spc
,
2669 case GIMPLE_OMP_TARGET
:
2670 dump_gimple_omp_target (buffer
, as_a
<const gomp_target
*> (gs
), spc
,
2674 case GIMPLE_OMP_TEAMS
:
2675 dump_gimple_omp_teams (buffer
, as_a
<const gomp_teams
*> (gs
), spc
,
2679 case GIMPLE_OMP_RETURN
:
2680 dump_gimple_omp_return (buffer
, gs
, spc
, flags
);
2683 case GIMPLE_OMP_SECTIONS
:
2684 dump_gimple_omp_sections (buffer
, as_a
<const gomp_sections
*> (gs
),
2688 case GIMPLE_OMP_SECTIONS_SWITCH
:
2689 pp_string (buffer
, "GIMPLE_SECTIONS_SWITCH");
2692 case GIMPLE_OMP_TASKGROUP
:
2693 dump_gimple_omp_taskgroup (buffer
, gs
, spc
, flags
);
2696 case GIMPLE_OMP_MASTER
:
2697 case GIMPLE_OMP_SECTION
:
2698 case GIMPLE_OMP_GRID_BODY
:
2699 dump_gimple_omp_block (buffer
, gs
, spc
, flags
);
2702 case GIMPLE_OMP_ORDERED
:
2703 dump_gimple_omp_ordered (buffer
, as_a
<const gomp_ordered
*> (gs
), spc
,
2707 case GIMPLE_OMP_SCAN
:
2708 dump_gimple_omp_scan (buffer
, as_a
<const gomp_scan
*> (gs
), spc
,
2712 case GIMPLE_OMP_CRITICAL
:
2713 dump_gimple_omp_critical (buffer
, as_a
<const gomp_critical
*> (gs
), spc
,
2718 dump_gimple_catch (buffer
, as_a
<const gcatch
*> (gs
), spc
, flags
);
2721 case GIMPLE_EH_FILTER
:
2722 dump_gimple_eh_filter (buffer
, as_a
<const geh_filter
*> (gs
), spc
,
2726 case GIMPLE_EH_MUST_NOT_THROW
:
2727 dump_gimple_eh_must_not_throw (buffer
,
2728 as_a
<const geh_mnt
*> (gs
),
2732 case GIMPLE_EH_ELSE
:
2733 dump_gimple_eh_else (buffer
, as_a
<const geh_else
*> (gs
), spc
, flags
);
2737 dump_gimple_resx (buffer
, as_a
<const gresx
*> (gs
), spc
, flags
);
2740 case GIMPLE_EH_DISPATCH
:
2741 dump_gimple_eh_dispatch (buffer
, as_a
<const geh_dispatch
*> (gs
), spc
,
2746 dump_gimple_debug (buffer
, as_a
<const gdebug
*> (gs
), spc
, flags
);
2749 case GIMPLE_PREDICT
:
2750 pp_string (buffer
, "// predicted ");
2751 if (gimple_predict_outcome (gs
))
2752 pp_string (buffer
, "likely by ");
2754 pp_string (buffer
, "unlikely by ");
2755 pp_string (buffer
, predictor_name (gimple_predict_predictor (gs
)));
2756 pp_string (buffer
, " predictor.");
2759 case GIMPLE_TRANSACTION
:
2760 dump_gimple_transaction (buffer
, as_a
<const gtransaction
*> (gs
), spc
,
2770 /* Dumps header of basic block BB to OUTF indented by INDENT
2771 spaces and details described by flags. */
2774 dump_gimple_bb_header (FILE *outf
, basic_block bb
, int indent
,
2777 if (flags
& TDF_BLOCKS
)
2779 if (flags
& TDF_LINENO
)
2781 gimple_stmt_iterator gsi
;
2783 fputs (";; ", outf
);
2785 for (gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
); gsi_next (&gsi
))
2786 if (!is_gimple_debug (gsi_stmt (gsi
))
2787 && get_lineno (gsi_stmt (gsi
)) != UNKNOWN_LOCATION
)
2789 fprintf (outf
, "%*sstarting at line %d",
2790 indent
, "", get_lineno (gsi_stmt (gsi
)));
2793 if (bb
->discriminator
)
2794 fprintf (outf
, ", discriminator %i", bb
->discriminator
);
2800 if (flags
& TDF_GIMPLE
)
2802 fprintf (outf
, "%*s__BB(%d", indent
, "", bb
->index
);
2803 if (bb
->loop_father
->header
== bb
)
2804 fprintf (outf
, ",loop_header(%d)", bb
->loop_father
->num
);
2805 if (bb
->count
.initialized_p ())
2806 fprintf (outf
, ",%s(%d)",
2807 profile_quality_as_string (bb
->count
.quality ()),
2808 bb
->count
.value ());
2809 fprintf (outf
, "):\n");
2812 fprintf (outf
, "%*s<bb %d> %s:\n",
2813 indent
, "", bb
->index
, dump_profile (bb
->count
));
2818 /* Dumps end of basic block BB to buffer BUFFER indented by INDENT
2822 dump_gimple_bb_footer (FILE *outf ATTRIBUTE_UNUSED
,
2823 basic_block bb ATTRIBUTE_UNUSED
,
2824 int indent ATTRIBUTE_UNUSED
,
2825 dump_flags_t flags ATTRIBUTE_UNUSED
)
2827 /* There is currently no GIMPLE-specific basic block info to dump. */
2832 /* Dump PHI nodes of basic block BB to BUFFER with details described
2833 by FLAGS and indented by INDENT spaces. */
2836 dump_phi_nodes (pretty_printer
*buffer
, basic_block bb
, int indent
,
2841 for (i
= gsi_start_phis (bb
); !gsi_end_p (i
); gsi_next (&i
))
2843 gphi
*phi
= i
.phi ();
2844 if (!virtual_operand_p (gimple_phi_result (phi
)) || (flags
& TDF_VOPS
))
2847 dump_gimple_phi (buffer
, phi
, indent
,
2848 (flags
& TDF_GIMPLE
) ? false : true, flags
);
2849 pp_newline (buffer
);
2855 /* Dump jump to basic block BB that is represented implicitly in the cfg
2859 pp_cfg_jump (pretty_printer
*buffer
, edge e
, dump_flags_t flags
)
2861 if (flags
& TDF_GIMPLE
)
2863 pp_string (buffer
, "goto __BB");
2864 pp_decimal_int (buffer
, e
->dest
->index
);
2865 if (e
->probability
.initialized_p ())
2867 pp_string (buffer
, "(");
2869 profile_quality_as_string (e
->probability
.quality ()));
2870 pp_string (buffer
, "(");
2871 pp_decimal_int (buffer
, e
->probability
.value ());
2872 pp_string (buffer
, "))");
2874 pp_semicolon (buffer
);
2878 pp_string (buffer
, "goto <bb ");
2879 pp_decimal_int (buffer
, e
->dest
->index
);
2880 pp_greater (buffer
);
2881 pp_semicolon (buffer
);
2883 dump_edge_probability (buffer
, e
);
2888 /* Dump edges represented implicitly in basic block BB to BUFFER, indented
2889 by INDENT spaces, with details given by FLAGS. */
2892 dump_implicit_edges (pretty_printer
*buffer
, basic_block bb
, int indent
,
2898 stmt
= last_stmt (bb
);
2900 if (stmt
&& gimple_code (stmt
) == GIMPLE_COND
)
2902 edge true_edge
, false_edge
;
2904 /* When we are emitting the code or changing CFG, it is possible that
2905 the edges are not yet created. When we are using debug_bb in such
2906 a situation, we do not want it to crash. */
2907 if (EDGE_COUNT (bb
->succs
) != 2)
2909 extract_true_false_edges_from_block (bb
, &true_edge
, &false_edge
);
2911 INDENT (indent
+ 2);
2912 pp_cfg_jump (buffer
, true_edge
, flags
);
2913 newline_and_indent (buffer
, indent
);
2914 pp_string (buffer
, "else");
2915 newline_and_indent (buffer
, indent
+ 2);
2916 pp_cfg_jump (buffer
, false_edge
, flags
);
2917 pp_newline (buffer
);
2921 /* If there is a fallthru edge, we may need to add an artificial
2922 goto to the dump. */
2923 e
= find_fallthru_edge (bb
->succs
);
2925 if (e
&& (e
->dest
!= bb
->next_bb
|| (flags
& TDF_GIMPLE
)))
2929 if ((flags
& TDF_LINENO
)
2930 && e
->goto_locus
!= UNKNOWN_LOCATION
)
2931 dump_location (buffer
, e
->goto_locus
);
2933 pp_cfg_jump (buffer
, e
, flags
);
2934 pp_newline (buffer
);
2939 /* Dumps basic block BB to buffer BUFFER with details described by FLAGS and
2940 indented by INDENT spaces. */
2943 gimple_dump_bb_buff (pretty_printer
*buffer
, basic_block bb
, int indent
,
2946 gimple_stmt_iterator gsi
;
2948 int label_indent
= indent
- 2;
2950 if (label_indent
< 0)
2953 dump_phi_nodes (buffer
, bb
, indent
, flags
);
2955 for (gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
); gsi_next (&gsi
))
2959 stmt
= gsi_stmt (gsi
);
2961 curr_indent
= gimple_code (stmt
) == GIMPLE_LABEL
? label_indent
: indent
;
2963 INDENT (curr_indent
);
2964 pp_gimple_stmt_1 (buffer
, stmt
, curr_indent
, flags
);
2965 pp_newline_and_flush (buffer
);
2966 gcc_checking_assert (DECL_STRUCT_FUNCTION (current_function_decl
));
2967 dump_histograms_for_stmt (DECL_STRUCT_FUNCTION (current_function_decl
),
2968 pp_buffer (buffer
)->stream
, stmt
);
2971 dump_implicit_edges (buffer
, bb
, indent
, flags
);
2976 /* Dumps basic block BB to FILE with details described by FLAGS and
2977 indented by INDENT spaces. */
2980 gimple_dump_bb (FILE *file
, basic_block bb
, int indent
, dump_flags_t flags
)
2982 dump_gimple_bb_header (file
, bb
, indent
, flags
);
2983 if (bb
->index
>= NUM_FIXED_BLOCKS
)
2985 pretty_printer buffer
;
2986 pp_needs_newline (&buffer
) = true;
2987 buffer
.buffer
->stream
= file
;
2988 gimple_dump_bb_buff (&buffer
, bb
, indent
, flags
);
2990 dump_gimple_bb_footer (file
, bb
, indent
, flags
);
2993 /* Dumps basic block BB to pretty-printer PP with default dump flags and
2994 no indentation, for use as a label of a DOT graph record-node.
2995 ??? Should just use gimple_dump_bb_buff here, except that value profiling
2996 histogram dumping doesn't know about pretty-printers. */
2999 gimple_dump_bb_for_graph (pretty_printer
*pp
, basic_block bb
)
3001 pp_printf (pp
, "<bb %d>:\n", bb
->index
);
3002 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
3004 for (gphi_iterator gsi
= gsi_start_phis (bb
); !gsi_end_p (gsi
);
3007 gphi
*phi
= gsi
.phi ();
3008 if (!virtual_operand_p (gimple_phi_result (phi
))
3009 || (dump_flags
& TDF_VOPS
))
3012 pp_write_text_to_stream (pp
);
3013 pp_string (pp
, "# ");
3014 pp_gimple_stmt_1 (pp
, phi
, 0, dump_flags
);
3016 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
3020 for (gimple_stmt_iterator gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
);
3023 gimple
*stmt
= gsi_stmt (gsi
);
3025 pp_write_text_to_stream (pp
);
3026 pp_gimple_stmt_1 (pp
, stmt
, 0, dump_flags
);
3028 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
3030 dump_implicit_edges (pp
, bb
, 0, dump_flags
);
3031 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
3035 /* Handle the %G format for TEXT. Same as %K in handle_K_format in
3036 tree-pretty-print.c but with a Gimple statement as an argument. */
3039 percent_G_format (text_info
*text
)
3041 gimple
*stmt
= va_arg (*text
->args_ptr
, gimple
*);
3043 /* Fall back on the rich location if the statement doesn't have one. */
3044 location_t loc
= gimple_location (stmt
);
3045 if (loc
== UNKNOWN_LOCATION
)
3046 loc
= text
->m_richloc
->get_loc ();
3047 tree block
= gimple_block (stmt
);
3048 percent_K_format (text
, loc
, block
);
3052 # pragma GCC diagnostic pop