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
, ")");
451 case VEC_WIDEN_MULT_HI_EXPR
:
452 case VEC_WIDEN_MULT_LO_EXPR
:
453 case VEC_WIDEN_MULT_EVEN_EXPR
:
454 case VEC_WIDEN_MULT_ODD_EXPR
:
455 case VEC_PACK_TRUNC_EXPR
:
456 case VEC_PACK_SAT_EXPR
:
457 case VEC_PACK_FIX_TRUNC_EXPR
:
458 case VEC_PACK_FLOAT_EXPR
:
459 case VEC_WIDEN_LSHIFT_HI_EXPR
:
460 case VEC_WIDEN_LSHIFT_LO_EXPR
:
461 case VEC_SERIES_EXPR
:
462 for (p
= get_tree_code_name (code
); *p
; p
++)
463 pp_character (buffer
, TOUPPER (*p
));
464 pp_string (buffer
, " <");
465 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
466 pp_string (buffer
, ", ");
467 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
472 if (op_prio (gimple_assign_rhs1 (gs
)) <= op_code_prio (code
))
474 pp_left_paren (buffer
);
475 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
,
477 pp_right_paren (buffer
);
480 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
482 pp_string (buffer
, op_symbol_code (gimple_assign_rhs_code (gs
)));
484 if (op_prio (gimple_assign_rhs2 (gs
)) <= op_code_prio (code
))
486 pp_left_paren (buffer
);
487 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
,
489 pp_right_paren (buffer
);
492 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
496 /* Helper for dump_gimple_assign. Print the ternary RHS of the
497 assignment GS. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. */
500 dump_ternary_rhs (pretty_printer
*buffer
, const gassign
*gs
, int spc
,
504 enum tree_code code
= gimple_assign_rhs_code (gs
);
507 case WIDEN_MULT_PLUS_EXPR
:
508 case WIDEN_MULT_MINUS_EXPR
:
509 for (p
= get_tree_code_name (code
); *p
; p
++)
510 pp_character (buffer
, TOUPPER (*p
));
511 pp_string (buffer
, " <");
512 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
513 pp_string (buffer
, ", ");
514 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
515 pp_string (buffer
, ", ");
516 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
521 pp_string (buffer
, "DOT_PROD_EXPR <");
522 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
523 pp_string (buffer
, ", ");
524 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
525 pp_string (buffer
, ", ");
526 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
531 pp_string (buffer
, "SAD_EXPR <");
532 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
533 pp_string (buffer
, ", ");
534 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
535 pp_string (buffer
, ", ");
536 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
541 if (flags
& TDF_GIMPLE
)
542 pp_string (buffer
, "__VEC_PERM (");
544 pp_string (buffer
, "VEC_PERM_EXPR <");
545 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
546 pp_string (buffer
, ", ");
547 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
548 pp_string (buffer
, ", ");
549 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
550 if (flags
& TDF_GIMPLE
)
551 pp_right_paren (buffer
);
556 case REALIGN_LOAD_EXPR
:
557 pp_string (buffer
, "REALIGN_LOAD <");
558 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
559 pp_string (buffer
, ", ");
560 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
561 pp_string (buffer
, ", ");
562 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
567 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
568 pp_string (buffer
, " ? ");
569 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
570 pp_string (buffer
, " : ");
571 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
575 pp_string (buffer
, "VEC_COND_EXPR <");
576 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
577 pp_string (buffer
, ", ");
578 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
579 pp_string (buffer
, ", ");
580 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
584 case BIT_INSERT_EXPR
:
585 if (flags
& TDF_GIMPLE
)
587 pp_string (buffer
, "__BIT_INSERT (");
588 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
,
589 flags
| TDF_SLIM
, false);
590 pp_string (buffer
, ", ");
591 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
,
592 flags
| TDF_SLIM
, false);
593 pp_string (buffer
, ", ");
594 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
,
595 flags
| TDF_SLIM
, false);
596 pp_right_paren (buffer
);
600 pp_string (buffer
, "BIT_INSERT_EXPR <");
601 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
),
603 pp_string (buffer
, ", ");
604 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
),
606 pp_string (buffer
, ", ");
607 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
),
609 if (INTEGRAL_TYPE_P (TREE_TYPE (gimple_assign_rhs2 (gs
))))
611 pp_string (buffer
, " (");
612 pp_decimal_int (buffer
, TYPE_PRECISION
613 (TREE_TYPE (gimple_assign_rhs2 (gs
))));
614 pp_string (buffer
, " bits)");
626 /* Dump the gimple assignment GS. BUFFER, SPC and FLAGS are as in
630 dump_gimple_assign (pretty_printer
*buffer
, const gassign
*gs
, int spc
,
638 switch (gimple_num_ops (gs
))
641 arg3
= gimple_assign_rhs3 (gs
);
644 arg2
= gimple_assign_rhs2 (gs
);
647 arg1
= gimple_assign_rhs1 (gs
);
653 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%s, %T, %T, %T, %T>", gs
,
654 get_tree_code_name (gimple_assign_rhs_code (gs
)),
655 gimple_assign_lhs (gs
), arg1
, arg2
, arg3
);
659 if (!(flags
& TDF_RHS_ONLY
))
661 dump_generic_node (buffer
, gimple_assign_lhs (gs
), spc
, flags
, false);
665 if (gimple_assign_nontemporal_move_p (gs
))
666 pp_string (buffer
, "{nt}");
668 if (gimple_has_volatile_ops (gs
))
669 pp_string (buffer
, "{v}");
674 if (gimple_num_ops (gs
) == 2)
675 dump_unary_rhs (buffer
, gs
, spc
, flags
);
676 else if (gimple_num_ops (gs
) == 3)
677 dump_binary_rhs (buffer
, gs
, spc
, flags
);
678 else if (gimple_num_ops (gs
) == 4)
679 dump_ternary_rhs (buffer
, gs
, spc
, flags
);
682 if (!(flags
& TDF_RHS_ONLY
))
683 pp_semicolon (buffer
);
688 /* Dump the return statement GS. BUFFER, SPC and FLAGS are as in
692 dump_gimple_return (pretty_printer
*buffer
, const greturn
*gs
, int spc
,
697 t
= gimple_return_retval (gs
);
699 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
, t
);
702 pp_string (buffer
, "return");
706 dump_generic_node (buffer
, t
, spc
, flags
, false);
708 pp_semicolon (buffer
);
713 /* Dump the call arguments for a gimple call. BUFFER, FLAGS are as in
717 dump_gimple_call_args (pretty_printer
*buffer
, const gcall
*gs
,
722 /* Pretty print first arg to certain internal fns. */
723 if (gimple_call_internal_p (gs
))
725 const char *const *enums
= NULL
;
728 switch (gimple_call_internal_fn (gs
))
732 static const char *const unique_args
[] = {IFN_UNIQUE_CODES
};
736 limit
= ARRAY_SIZE (unique_args
);
741 static const char *const loop_args
[] = {IFN_GOACC_LOOP_CODES
};
744 limit
= ARRAY_SIZE (loop_args
);
747 case IFN_GOACC_REDUCTION
:
749 static const char *const reduction_args
[]
750 = {IFN_GOACC_REDUCTION_CODES
};
752 enums
= reduction_args
;
753 limit
= ARRAY_SIZE (reduction_args
);
758 static const char *const asan_mark_args
[] = {IFN_ASAN_MARK_FLAGS
};
760 enums
= asan_mark_args
;
761 limit
= ARRAY_SIZE (asan_mark_args
);
769 tree arg0
= gimple_call_arg (gs
, 0);
772 if (TREE_CODE (arg0
) == INTEGER_CST
773 && tree_fits_shwi_p (arg0
)
774 && (v
= tree_to_shwi (arg0
)) >= 0 && v
< limit
)
777 pp_string (buffer
, enums
[v
]);
782 for (; i
< gimple_call_num_args (gs
); i
++)
785 pp_string (buffer
, ", ");
786 dump_generic_node (buffer
, gimple_call_arg (gs
, i
), 0, flags
, false);
789 if (gimple_call_va_arg_pack_p (gs
))
792 pp_string (buffer
, ", ");
794 pp_string (buffer
, "__builtin_va_arg_pack ()");
798 /* Dump the points-to solution *PT to BUFFER. */
801 pp_points_to_solution (pretty_printer
*buffer
, const pt_solution
*pt
)
805 pp_string (buffer
, "anything ");
809 pp_string (buffer
, "nonlocal ");
811 pp_string (buffer
, "escaped ");
813 pp_string (buffer
, "unit-escaped ");
815 pp_string (buffer
, "null ");
817 && !bitmap_empty_p (pt
->vars
))
821 pp_string (buffer
, "{ ");
822 EXECUTE_IF_SET_IN_BITMAP (pt
->vars
, 0, i
, bi
)
824 pp_string (buffer
, "D.");
825 pp_decimal_int (buffer
, i
);
828 pp_right_brace (buffer
);
829 if (pt
->vars_contains_nonlocal
830 || pt
->vars_contains_escaped
831 || pt
->vars_contains_escaped_heap
832 || pt
->vars_contains_restrict
)
834 const char *comma
= "";
835 pp_string (buffer
, " (");
836 if (pt
->vars_contains_nonlocal
)
838 pp_string (buffer
, "nonlocal");
841 if (pt
->vars_contains_escaped
)
843 pp_string (buffer
, comma
);
844 pp_string (buffer
, "escaped");
847 if (pt
->vars_contains_escaped_heap
)
849 pp_string (buffer
, comma
);
850 pp_string (buffer
, "escaped heap");
853 if (pt
->vars_contains_restrict
)
855 pp_string (buffer
, comma
);
856 pp_string (buffer
, "restrict");
859 if (pt
->vars_contains_interposable
)
861 pp_string (buffer
, comma
);
862 pp_string (buffer
, "interposable");
864 pp_string (buffer
, ")");
870 /* Dump the call statement GS. BUFFER, SPC and FLAGS are as in
874 dump_gimple_call (pretty_printer
*buffer
, const gcall
*gs
, int spc
,
877 tree lhs
= gimple_call_lhs (gs
);
878 tree fn
= gimple_call_fn (gs
);
880 if (flags
& TDF_ALIAS
)
882 const pt_solution
*pt
;
883 pt
= gimple_call_use_set (gs
);
884 if (!pt_solution_empty_p (pt
))
886 pp_string (buffer
, "# USE = ");
887 pp_points_to_solution (buffer
, pt
);
888 newline_and_indent (buffer
, spc
);
890 pt
= gimple_call_clobber_set (gs
);
891 if (!pt_solution_empty_p (pt
))
893 pp_string (buffer
, "# CLB = ");
894 pp_points_to_solution (buffer
, pt
);
895 newline_and_indent (buffer
, spc
);
901 if (gimple_call_internal_p (gs
))
902 dump_gimple_fmt (buffer
, spc
, flags
, "%G <.%s, %T", gs
,
903 internal_fn_name (gimple_call_internal_fn (gs
)), lhs
);
905 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T", gs
, fn
, lhs
);
906 if (gimple_call_num_args (gs
) > 0)
908 pp_string (buffer
, ", ");
909 dump_gimple_call_args (buffer
, gs
, flags
);
915 if (lhs
&& !(flags
& TDF_RHS_ONLY
))
917 dump_generic_node (buffer
, lhs
, spc
, flags
, false);
918 pp_string (buffer
, " =");
920 if (gimple_has_volatile_ops (gs
))
921 pp_string (buffer
, "{v}");
925 if (gimple_call_internal_p (gs
))
928 pp_string (buffer
, internal_fn_name (gimple_call_internal_fn (gs
)));
931 print_call_name (buffer
, fn
, flags
);
932 pp_string (buffer
, " (");
933 dump_gimple_call_args (buffer
, gs
, flags
);
934 pp_right_paren (buffer
);
935 if (!(flags
& TDF_RHS_ONLY
))
936 pp_semicolon (buffer
);
939 if (gimple_call_chain (gs
))
941 pp_string (buffer
, " [static-chain: ");
942 dump_generic_node (buffer
, gimple_call_chain (gs
), spc
, flags
, false);
943 pp_right_bracket (buffer
);
946 if (gimple_call_return_slot_opt_p (gs
))
947 pp_string (buffer
, " [return slot optimization]");
948 if (gimple_call_tail_p (gs
))
949 pp_string (buffer
, " [tail call]");
950 if (gimple_call_must_tail_p (gs
))
951 pp_string (buffer
, " [must tail call]");
956 /* Dump the arguments of _ITM_beginTransaction sanely. */
957 if (TREE_CODE (fn
) == ADDR_EXPR
)
958 fn
= TREE_OPERAND (fn
, 0);
959 if (TREE_CODE (fn
) == FUNCTION_DECL
&& decl_is_tm_clone (fn
))
960 pp_string (buffer
, " [tm-clone]");
961 if (TREE_CODE (fn
) == FUNCTION_DECL
962 && fndecl_built_in_p (fn
, BUILT_IN_TM_START
)
963 && gimple_call_num_args (gs
) > 0)
965 tree t
= gimple_call_arg (gs
, 0);
966 unsigned HOST_WIDE_INT props
;
967 gcc_assert (TREE_CODE (t
) == INTEGER_CST
);
969 pp_string (buffer
, " [ ");
971 /* Get the transaction code properties. */
972 props
= TREE_INT_CST_LOW (t
);
974 if (props
& PR_INSTRUMENTEDCODE
)
975 pp_string (buffer
, "instrumentedCode ");
976 if (props
& PR_UNINSTRUMENTEDCODE
)
977 pp_string (buffer
, "uninstrumentedCode ");
978 if (props
& PR_HASNOXMMUPDATE
)
979 pp_string (buffer
, "hasNoXMMUpdate ");
980 if (props
& PR_HASNOABORT
)
981 pp_string (buffer
, "hasNoAbort ");
982 if (props
& PR_HASNOIRREVOCABLE
)
983 pp_string (buffer
, "hasNoIrrevocable ");
984 if (props
& PR_DOESGOIRREVOCABLE
)
985 pp_string (buffer
, "doesGoIrrevocable ");
986 if (props
& PR_HASNOSIMPLEREADS
)
987 pp_string (buffer
, "hasNoSimpleReads ");
988 if (props
& PR_AWBARRIERSOMITTED
)
989 pp_string (buffer
, "awBarriersOmitted ");
990 if (props
& PR_RARBARRIERSOMITTED
)
991 pp_string (buffer
, "RaRBarriersOmitted ");
992 if (props
& PR_UNDOLOGCODE
)
993 pp_string (buffer
, "undoLogCode ");
994 if (props
& PR_PREFERUNINSTRUMENTED
)
995 pp_string (buffer
, "preferUninstrumented ");
996 if (props
& PR_EXCEPTIONBLOCK
)
997 pp_string (buffer
, "exceptionBlock ");
998 if (props
& PR_HASELSE
)
999 pp_string (buffer
, "hasElse ");
1000 if (props
& PR_READONLY
)
1001 pp_string (buffer
, "readOnly ");
1003 pp_right_bracket (buffer
);
1008 /* Dump the switch statement GS. BUFFER, SPC and FLAGS are as in
1009 pp_gimple_stmt_1. */
1012 dump_gimple_switch (pretty_printer
*buffer
, const gswitch
*gs
, int spc
,
1017 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
1018 if (flags
& TDF_RAW
)
1019 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, ", gs
,
1020 gimple_switch_index (gs
));
1023 pp_string (buffer
, "switch (");
1024 dump_generic_node (buffer
, gimple_switch_index (gs
), spc
, flags
, true);
1025 if (flags
& TDF_GIMPLE
)
1026 pp_string (buffer
, ") {");
1028 pp_string (buffer
, ") <");
1031 for (i
= 0; i
< gimple_switch_num_labels (gs
); i
++)
1033 tree case_label
= gimple_switch_label (gs
, i
);
1034 gcc_checking_assert (case_label
!= NULL_TREE
);
1035 dump_generic_node (buffer
, case_label
, spc
, flags
, false);
1037 tree label
= CASE_LABEL (case_label
);
1038 dump_generic_node (buffer
, label
, spc
, flags
, false);
1040 if (cfun
&& cfun
->cfg
)
1042 basic_block dest
= label_to_block (cfun
, label
);
1045 edge label_edge
= find_edge (gimple_bb (gs
), dest
);
1046 if (label_edge
&& !(flags
& TDF_GIMPLE
))
1047 dump_edge_probability (buffer
, label_edge
);
1051 if (i
< gimple_switch_num_labels (gs
) - 1)
1053 if (flags
& TDF_GIMPLE
)
1054 pp_string (buffer
, "; ");
1056 pp_string (buffer
, ", ");
1059 if (flags
& TDF_GIMPLE
)
1060 pp_string (buffer
, "; }");
1062 pp_greater (buffer
);
1066 /* Dump the gimple conditional GS. BUFFER, SPC and FLAGS are as in
1067 pp_gimple_stmt_1. */
1070 dump_gimple_cond (pretty_printer
*buffer
, const gcond
*gs
, int spc
,
1073 if (flags
& TDF_RAW
)
1074 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%s, %T, %T, %T, %T>", gs
,
1075 get_tree_code_name (gimple_cond_code (gs
)),
1076 gimple_cond_lhs (gs
), gimple_cond_rhs (gs
),
1077 gimple_cond_true_label (gs
), gimple_cond_false_label (gs
));
1080 if (!(flags
& TDF_RHS_ONLY
))
1081 pp_string (buffer
, "if (");
1082 dump_generic_node (buffer
, gimple_cond_lhs (gs
), spc
, flags
, false);
1084 pp_string (buffer
, op_symbol_code (gimple_cond_code (gs
)));
1086 dump_generic_node (buffer
, gimple_cond_rhs (gs
), spc
, flags
, false);
1087 if (!(flags
& TDF_RHS_ONLY
))
1090 edge e
, true_edge
= NULL
, false_edge
= NULL
;
1091 basic_block bb
= gimple_bb (gs
);
1095 FOR_EACH_EDGE (e
, ei
, bb
->succs
)
1097 if (e
->flags
& EDGE_TRUE_VALUE
)
1099 else if (e
->flags
& EDGE_FALSE_VALUE
)
1104 bool has_edge_info
= true_edge
!= NULL
&& false_edge
!= NULL
;
1106 pp_right_paren (buffer
);
1108 if (gimple_cond_true_label (gs
))
1110 pp_string (buffer
, " goto ");
1111 dump_generic_node (buffer
, gimple_cond_true_label (gs
),
1113 if (has_edge_info
&& !(flags
& TDF_GIMPLE
))
1114 dump_edge_probability (buffer
, true_edge
);
1115 pp_semicolon (buffer
);
1117 if (gimple_cond_false_label (gs
))
1119 pp_string (buffer
, " else goto ");
1120 dump_generic_node (buffer
, gimple_cond_false_label (gs
),
1122 if (has_edge_info
&& !(flags
& TDF_GIMPLE
))
1123 dump_edge_probability (buffer
, false_edge
);
1125 pp_semicolon (buffer
);
1132 /* Dump a GIMPLE_LABEL tuple on the pretty_printer BUFFER, SPC
1133 spaces of indent. FLAGS specifies details to show in the dump (see
1134 TDF_* in dumpfils.h). */
1137 dump_gimple_label (pretty_printer
*buffer
, const glabel
*gs
, int spc
,
1140 tree label
= gimple_label_label (gs
);
1141 if (flags
& TDF_RAW
)
1142 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
, label
);
1145 dump_generic_node (buffer
, label
, spc
, flags
, false);
1148 if (flags
& TDF_GIMPLE
)
1150 if (DECL_NONLOCAL (label
))
1151 pp_string (buffer
, " [non-local]");
1152 if ((flags
& TDF_EH
) && EH_LANDING_PAD_NR (label
))
1153 pp_printf (buffer
, " [LP %d]", EH_LANDING_PAD_NR (label
));
1156 /* Dump a GIMPLE_GOTO tuple on the pretty_printer BUFFER, SPC
1157 spaces of indent. FLAGS specifies details to show in the dump (see
1158 TDF_* in dumpfile.h). */
1161 dump_gimple_goto (pretty_printer
*buffer
, const ggoto
*gs
, int spc
,
1164 tree label
= gimple_goto_dest (gs
);
1165 if (flags
& TDF_RAW
)
1166 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
, label
);
1168 dump_gimple_fmt (buffer
, spc
, flags
, "goto %T;", label
);
1172 /* Dump a GIMPLE_BIND tuple on the pretty_printer BUFFER, SPC
1173 spaces of indent. FLAGS specifies details to show in the dump (see
1174 TDF_* in dumpfile.h). */
1177 dump_gimple_bind (pretty_printer
*buffer
, const gbind
*gs
, int spc
,
1180 if (flags
& TDF_RAW
)
1181 dump_gimple_fmt (buffer
, spc
, flags
, "%G <", gs
);
1183 pp_left_brace (buffer
);
1184 if (!(flags
& TDF_SLIM
))
1188 for (var
= gimple_bind_vars (gs
); var
; var
= DECL_CHAIN (var
))
1190 newline_and_indent (buffer
, 2);
1191 print_declaration (buffer
, var
, spc
, flags
);
1193 if (gimple_bind_vars (gs
))
1194 pp_newline (buffer
);
1196 pp_newline (buffer
);
1197 dump_gimple_seq (buffer
, gimple_bind_body (gs
), spc
+ 2, flags
);
1198 newline_and_indent (buffer
, spc
);
1199 if (flags
& TDF_RAW
)
1200 pp_greater (buffer
);
1202 pp_right_brace (buffer
);
1206 /* Dump a GIMPLE_TRY tuple on the pretty_printer BUFFER, SPC spaces of
1207 indent. FLAGS specifies details to show in the dump (see TDF_* in
1211 dump_gimple_try (pretty_printer
*buffer
, const gtry
*gs
, int spc
,
1214 if (flags
& TDF_RAW
)
1217 if (gimple_try_kind (gs
) == GIMPLE_TRY_CATCH
)
1218 type
= "GIMPLE_TRY_CATCH";
1219 else if (gimple_try_kind (gs
) == GIMPLE_TRY_FINALLY
)
1220 type
= "GIMPLE_TRY_FINALLY";
1222 type
= "UNKNOWN GIMPLE_TRY";
1223 dump_gimple_fmt (buffer
, spc
, flags
,
1224 "%G <%s,%+EVAL <%S>%nCLEANUP <%S>%->", gs
, type
,
1225 gimple_try_eval (gs
), gimple_try_cleanup (gs
));
1229 pp_string (buffer
, "try");
1230 newline_and_indent (buffer
, spc
+ 2);
1231 pp_left_brace (buffer
);
1232 pp_newline (buffer
);
1234 dump_gimple_seq (buffer
, gimple_try_eval (gs
), spc
+ 4, flags
);
1235 newline_and_indent (buffer
, spc
+ 2);
1236 pp_right_brace (buffer
);
1238 gimple_seq seq
= gimple_try_cleanup (gs
);
1240 if (gimple_try_kind (gs
) == GIMPLE_TRY_CATCH
)
1242 newline_and_indent (buffer
, spc
);
1243 pp_string (buffer
, "catch");
1244 newline_and_indent (buffer
, spc
+ 2);
1245 pp_left_brace (buffer
);
1247 else if (gimple_try_kind (gs
) == GIMPLE_TRY_FINALLY
)
1249 newline_and_indent (buffer
, spc
);
1250 pp_string (buffer
, "finally");
1251 newline_and_indent (buffer
, spc
+ 2);
1252 pp_left_brace (buffer
);
1254 if (seq
&& is_a
<geh_else
*> (gimple_seq_first_stmt (seq
))
1255 && gimple_seq_nondebug_singleton_p (seq
))
1257 geh_else
*stmt
= as_a
<geh_else
*> (gimple_seq_first_stmt (seq
));
1258 seq
= gimple_eh_else_n_body (stmt
);
1259 pp_newline (buffer
);
1260 dump_gimple_seq (buffer
, seq
, spc
+ 4, flags
);
1261 newline_and_indent (buffer
, spc
+ 2);
1262 pp_right_brace (buffer
);
1263 seq
= gimple_eh_else_e_body (stmt
);
1264 newline_and_indent (buffer
, spc
);
1265 pp_string (buffer
, "else");
1266 newline_and_indent (buffer
, spc
+ 2);
1267 pp_left_brace (buffer
);
1271 pp_string (buffer
, " <UNKNOWN GIMPLE_TRY> {");
1273 pp_newline (buffer
);
1274 dump_gimple_seq (buffer
, seq
, spc
+ 4, flags
);
1275 newline_and_indent (buffer
, spc
+ 2);
1276 pp_right_brace (buffer
);
1281 /* Dump a GIMPLE_CATCH tuple on the pretty_printer BUFFER, SPC spaces of
1282 indent. FLAGS specifies details to show in the dump (see TDF_* in
1286 dump_gimple_catch (pretty_printer
*buffer
, const gcatch
*gs
, int spc
,
1289 if (flags
& TDF_RAW
)
1290 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %+CATCH <%S>%->", gs
,
1291 gimple_catch_types (gs
), gimple_catch_handler (gs
));
1293 dump_gimple_fmt (buffer
, spc
, flags
, "catch (%T)%+{%S}",
1294 gimple_catch_types (gs
), gimple_catch_handler (gs
));
1298 /* Dump a GIMPLE_EH_FILTER tuple on the pretty_printer BUFFER, SPC spaces of
1299 indent. FLAGS specifies details to show in the dump (see TDF_* in
1303 dump_gimple_eh_filter (pretty_printer
*buffer
, const geh_filter
*gs
, int spc
,
1306 if (flags
& TDF_RAW
)
1307 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %+FAILURE <%S>%->", gs
,
1308 gimple_eh_filter_types (gs
),
1309 gimple_eh_filter_failure (gs
));
1311 dump_gimple_fmt (buffer
, spc
, flags
, "<<<eh_filter (%T)>>>%+{%+%S%-}",
1312 gimple_eh_filter_types (gs
),
1313 gimple_eh_filter_failure (gs
));
1317 /* Dump a GIMPLE_EH_MUST_NOT_THROW tuple. */
1320 dump_gimple_eh_must_not_throw (pretty_printer
*buffer
,
1321 const geh_mnt
*gs
, int spc
, dump_flags_t flags
)
1323 if (flags
& TDF_RAW
)
1324 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
,
1325 gimple_eh_must_not_throw_fndecl (gs
));
1327 dump_gimple_fmt (buffer
, spc
, flags
, "<<<eh_must_not_throw (%T)>>>",
1328 gimple_eh_must_not_throw_fndecl (gs
));
1332 /* Dump a GIMPLE_EH_ELSE tuple on the pretty_printer BUFFER, SPC spaces of
1333 indent. FLAGS specifies details to show in the dump (see TDF_* in
1337 dump_gimple_eh_else (pretty_printer
*buffer
, const geh_else
*gs
, int spc
,
1340 if (flags
& TDF_RAW
)
1341 dump_gimple_fmt (buffer
, spc
, flags
,
1342 "%G <%+N_BODY <%S>%nE_BODY <%S>%->", gs
,
1343 gimple_eh_else_n_body (gs
), gimple_eh_else_e_body (gs
));
1345 dump_gimple_fmt (buffer
, spc
, flags
,
1346 "<<<if_normal_exit>>>%+{%S}%-<<<else_eh_exit>>>%+{%S}",
1347 gimple_eh_else_n_body (gs
), gimple_eh_else_e_body (gs
));
1351 /* Dump a GIMPLE_RESX tuple on the pretty_printer BUFFER, SPC spaces of
1352 indent. FLAGS specifies details to show in the dump (see TDF_* in
1356 dump_gimple_resx (pretty_printer
*buffer
, const gresx
*gs
, int spc
,
1359 if (flags
& TDF_RAW
)
1360 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%d>", gs
,
1361 gimple_resx_region (gs
));
1363 dump_gimple_fmt (buffer
, spc
, flags
, "resx %d", gimple_resx_region (gs
));
1366 /* Dump a GIMPLE_EH_DISPATCH tuple on the pretty_printer BUFFER. */
1369 dump_gimple_eh_dispatch (pretty_printer
*buffer
, const geh_dispatch
*gs
,
1370 int spc
, dump_flags_t flags
)
1372 if (flags
& TDF_RAW
)
1373 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%d>", gs
,
1374 gimple_eh_dispatch_region (gs
));
1376 dump_gimple_fmt (buffer
, spc
, flags
, "eh_dispatch %d",
1377 gimple_eh_dispatch_region (gs
));
1380 /* Dump a GIMPLE_DEBUG tuple on the pretty_printer BUFFER, SPC spaces
1381 of indent. FLAGS specifies details to show in the dump (see TDF_*
1385 dump_gimple_debug (pretty_printer
*buffer
, const gdebug
*gs
, int spc
,
1388 switch (gs
->subcode
)
1390 case GIMPLE_DEBUG_BIND
:
1391 if (flags
& TDF_RAW
)
1392 dump_gimple_fmt (buffer
, spc
, flags
, "%G BIND <%T, %T>", gs
,
1393 gimple_debug_bind_get_var (gs
),
1394 gimple_debug_bind_get_value (gs
));
1396 dump_gimple_fmt (buffer
, spc
, flags
, "# DEBUG %T => %T",
1397 gimple_debug_bind_get_var (gs
),
1398 gimple_debug_bind_get_value (gs
));
1401 case GIMPLE_DEBUG_SOURCE_BIND
:
1402 if (flags
& TDF_RAW
)
1403 dump_gimple_fmt (buffer
, spc
, flags
, "%G SRCBIND <%T, %T>", gs
,
1404 gimple_debug_source_bind_get_var (gs
),
1405 gimple_debug_source_bind_get_value (gs
));
1407 dump_gimple_fmt (buffer
, spc
, flags
, "# DEBUG %T s=> %T",
1408 gimple_debug_source_bind_get_var (gs
),
1409 gimple_debug_source_bind_get_value (gs
));
1412 case GIMPLE_DEBUG_BEGIN_STMT
:
1413 if (flags
& TDF_RAW
)
1414 dump_gimple_fmt (buffer
, spc
, flags
, "%G BEGIN_STMT", gs
);
1416 dump_gimple_fmt (buffer
, spc
, flags
, "# DEBUG BEGIN_STMT");
1419 case GIMPLE_DEBUG_INLINE_ENTRY
:
1420 if (flags
& TDF_RAW
)
1421 dump_gimple_fmt (buffer
, spc
, flags
, "%G INLINE_ENTRY %T", gs
,
1423 ? block_ultimate_origin (gimple_block (gs
))
1426 dump_gimple_fmt (buffer
, spc
, flags
, "# DEBUG INLINE_ENTRY %T",
1428 ? block_ultimate_origin (gimple_block (gs
))
1437 /* Dump a GIMPLE_OMP_FOR tuple on the pretty_printer BUFFER. */
1439 dump_gimple_omp_for (pretty_printer
*buffer
, const gomp_for
*gs
, int spc
,
1444 if (flags
& TDF_RAW
)
1447 switch (gimple_omp_for_kind (gs
))
1449 case GF_OMP_FOR_KIND_FOR
:
1452 case GF_OMP_FOR_KIND_DISTRIBUTE
:
1453 kind
= " distribute";
1455 case GF_OMP_FOR_KIND_TASKLOOP
:
1458 case GF_OMP_FOR_KIND_OACC_LOOP
:
1459 kind
= " oacc_loop";
1461 case GF_OMP_FOR_KIND_SIMD
:
1467 dump_gimple_fmt (buffer
, spc
, flags
, "%G%s <%+BODY <%S>%nCLAUSES <", gs
,
1468 kind
, gimple_omp_body (gs
));
1469 dump_omp_clauses (buffer
, gimple_omp_for_clauses (gs
), spc
, flags
);
1470 dump_gimple_fmt (buffer
, spc
, flags
, " >,");
1471 for (i
= 0; i
< gimple_omp_for_collapse (gs
); i
++)
1472 dump_gimple_fmt (buffer
, spc
, flags
,
1473 "%+%T, %T, %T, %s, %T,%n",
1474 gimple_omp_for_index (gs
, i
),
1475 gimple_omp_for_initial (gs
, i
),
1476 gimple_omp_for_final (gs
, i
),
1477 get_tree_code_name (gimple_omp_for_cond (gs
, i
)),
1478 gimple_omp_for_incr (gs
, i
));
1479 dump_gimple_fmt (buffer
, spc
, flags
, "PRE_BODY <%S>%->",
1480 gimple_omp_for_pre_body (gs
));
1484 switch (gimple_omp_for_kind (gs
))
1486 case GF_OMP_FOR_KIND_FOR
:
1487 pp_string (buffer
, "#pragma omp for");
1489 case GF_OMP_FOR_KIND_DISTRIBUTE
:
1490 pp_string (buffer
, "#pragma omp distribute");
1492 case GF_OMP_FOR_KIND_TASKLOOP
:
1493 pp_string (buffer
, "#pragma omp taskloop");
1495 case GF_OMP_FOR_KIND_OACC_LOOP
:
1496 pp_string (buffer
, "#pragma acc loop");
1498 case GF_OMP_FOR_KIND_SIMD
:
1499 pp_string (buffer
, "#pragma omp simd");
1504 dump_omp_clauses (buffer
, gimple_omp_for_clauses (gs
), spc
, flags
);
1505 for (i
= 0; i
< gimple_omp_for_collapse (gs
); i
++)
1509 newline_and_indent (buffer
, spc
);
1510 pp_string (buffer
, "for (");
1511 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
1513 pp_string (buffer
, " = ");
1514 tree init
= gimple_omp_for_initial (gs
, i
);
1515 if (TREE_CODE (init
) != TREE_VEC
)
1516 dump_generic_node (buffer
, init
, spc
, flags
, false);
1518 dump_omp_loop_non_rect_expr (buffer
, init
, spc
, flags
);
1519 pp_string (buffer
, "; ");
1521 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
1524 switch (gimple_omp_for_cond (gs
, i
))
1530 pp_greater (buffer
);
1533 pp_less_equal (buffer
);
1536 pp_greater_equal (buffer
);
1539 pp_string (buffer
, "!=");
1545 tree cond
= gimple_omp_for_final (gs
, i
);
1546 if (TREE_CODE (cond
) != TREE_VEC
)
1547 dump_generic_node (buffer
, cond
, spc
, flags
, false);
1549 dump_omp_loop_non_rect_expr (buffer
, cond
, spc
, flags
);
1550 pp_string (buffer
, "; ");
1552 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
1554 pp_string (buffer
, " = ");
1555 dump_generic_node (buffer
, gimple_omp_for_incr (gs
, i
), spc
,
1557 pp_right_paren (buffer
);
1560 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1562 newline_and_indent (buffer
, spc
+ 2);
1563 pp_left_brace (buffer
);
1564 pp_newline (buffer
);
1565 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1566 newline_and_indent (buffer
, spc
+ 2);
1567 pp_right_brace (buffer
);
1572 /* Dump a GIMPLE_OMP_CONTINUE tuple on the pretty_printer BUFFER. */
1575 dump_gimple_omp_continue (pretty_printer
*buffer
, const gomp_continue
*gs
,
1576 int spc
, dump_flags_t flags
)
1578 if (flags
& TDF_RAW
)
1580 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T>", gs
,
1581 gimple_omp_continue_control_def (gs
),
1582 gimple_omp_continue_control_use (gs
));
1586 pp_string (buffer
, "#pragma omp continue (");
1587 dump_generic_node (buffer
, gimple_omp_continue_control_def (gs
),
1591 dump_generic_node (buffer
, gimple_omp_continue_control_use (gs
),
1593 pp_right_paren (buffer
);
1597 /* Dump a GIMPLE_OMP_SINGLE tuple on the pretty_printer BUFFER. */
1600 dump_gimple_omp_single (pretty_printer
*buffer
, const gomp_single
*gs
,
1601 int spc
, dump_flags_t flags
)
1603 if (flags
& TDF_RAW
)
1605 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1606 gimple_omp_body (gs
));
1607 dump_omp_clauses (buffer
, gimple_omp_single_clauses (gs
), spc
, flags
);
1608 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1612 pp_string (buffer
, "#pragma omp single");
1613 dump_omp_clauses (buffer
, gimple_omp_single_clauses (gs
), spc
, flags
);
1614 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1616 newline_and_indent (buffer
, spc
+ 2);
1617 pp_left_brace (buffer
);
1618 pp_newline (buffer
);
1619 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1620 newline_and_indent (buffer
, spc
+ 2);
1621 pp_right_brace (buffer
);
1626 /* Dump a GIMPLE_OMP_TASKGROUP tuple on the pretty_printer BUFFER. */
1629 dump_gimple_omp_taskgroup (pretty_printer
*buffer
, const gimple
*gs
,
1630 int spc
, dump_flags_t flags
)
1632 if (flags
& TDF_RAW
)
1634 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1635 gimple_omp_body (gs
));
1636 dump_omp_clauses (buffer
, gimple_omp_taskgroup_clauses (gs
), spc
, flags
);
1637 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1641 pp_string (buffer
, "#pragma omp taskgroup");
1642 dump_omp_clauses (buffer
, gimple_omp_taskgroup_clauses (gs
), spc
, flags
);
1643 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1645 newline_and_indent (buffer
, spc
+ 2);
1646 pp_left_brace (buffer
);
1647 pp_newline (buffer
);
1648 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1649 newline_and_indent (buffer
, spc
+ 2);
1650 pp_right_brace (buffer
);
1655 /* Dump a GIMPLE_OMP_TARGET tuple on the pretty_printer BUFFER. */
1658 dump_gimple_omp_target (pretty_printer
*buffer
, const gomp_target
*gs
,
1659 int spc
, dump_flags_t flags
)
1662 switch (gimple_omp_target_kind (gs
))
1664 case GF_OMP_TARGET_KIND_REGION
:
1667 case GF_OMP_TARGET_KIND_DATA
:
1670 case GF_OMP_TARGET_KIND_UPDATE
:
1673 case GF_OMP_TARGET_KIND_ENTER_DATA
:
1674 kind
= " enter data";
1676 case GF_OMP_TARGET_KIND_EXIT_DATA
:
1677 kind
= " exit data";
1679 case GF_OMP_TARGET_KIND_OACC_KERNELS
:
1680 kind
= " oacc_kernels";
1682 case GF_OMP_TARGET_KIND_OACC_PARALLEL
:
1683 kind
= " oacc_parallel";
1685 case GF_OMP_TARGET_KIND_OACC_SERIAL
:
1686 kind
= " oacc_serial";
1688 case GF_OMP_TARGET_KIND_OACC_DATA
:
1689 kind
= " oacc_data";
1691 case GF_OMP_TARGET_KIND_OACC_UPDATE
:
1692 kind
= " oacc_update";
1694 case GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA
:
1695 kind
= " oacc_enter_exit_data";
1697 case GF_OMP_TARGET_KIND_OACC_DECLARE
:
1698 kind
= " oacc_declare";
1700 case GF_OMP_TARGET_KIND_OACC_HOST_DATA
:
1701 kind
= " oacc_host_data";
1706 if (flags
& TDF_RAW
)
1708 dump_gimple_fmt (buffer
, spc
, flags
, "%G%s <%+BODY <%S>%nCLAUSES <", gs
,
1709 kind
, gimple_omp_body (gs
));
1710 dump_omp_clauses (buffer
, gimple_omp_target_clauses (gs
), spc
, flags
);
1711 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T%n>",
1712 gimple_omp_target_child_fn (gs
),
1713 gimple_omp_target_data_arg (gs
));
1717 pp_string (buffer
, "#pragma omp target");
1718 pp_string (buffer
, kind
);
1719 dump_omp_clauses (buffer
, gimple_omp_target_clauses (gs
), spc
, flags
);
1720 if (gimple_omp_target_child_fn (gs
))
1722 pp_string (buffer
, " [child fn: ");
1723 dump_generic_node (buffer
, gimple_omp_target_child_fn (gs
),
1725 pp_string (buffer
, " (");
1726 if (gimple_omp_target_data_arg (gs
))
1727 dump_generic_node (buffer
, gimple_omp_target_data_arg (gs
),
1730 pp_string (buffer
, "???");
1731 pp_string (buffer
, ")]");
1733 gimple_seq body
= gimple_omp_body (gs
);
1734 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
1736 newline_and_indent (buffer
, spc
+ 2);
1737 pp_left_brace (buffer
);
1738 pp_newline (buffer
);
1739 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
1740 newline_and_indent (buffer
, spc
+ 2);
1741 pp_right_brace (buffer
);
1745 pp_newline (buffer
);
1746 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
1751 /* Dump a GIMPLE_OMP_TEAMS tuple on the pretty_printer BUFFER. */
1754 dump_gimple_omp_teams (pretty_printer
*buffer
, const gomp_teams
*gs
, int spc
,
1757 if (flags
& TDF_RAW
)
1759 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1760 gimple_omp_body (gs
));
1761 dump_omp_clauses (buffer
, gimple_omp_teams_clauses (gs
), spc
, flags
);
1762 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1766 pp_string (buffer
, "#pragma omp teams");
1767 dump_omp_clauses (buffer
, gimple_omp_teams_clauses (gs
), spc
, flags
);
1768 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1770 newline_and_indent (buffer
, spc
+ 2);
1771 pp_character (buffer
, '{');
1772 pp_newline (buffer
);
1773 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1774 newline_and_indent (buffer
, spc
+ 2);
1775 pp_character (buffer
, '}');
1780 /* Dump a GIMPLE_OMP_SECTIONS tuple on the pretty_printer BUFFER. */
1783 dump_gimple_omp_sections (pretty_printer
*buffer
, const gomp_sections
*gs
,
1784 int spc
, dump_flags_t flags
)
1786 if (flags
& TDF_RAW
)
1788 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1789 gimple_omp_body (gs
));
1790 dump_omp_clauses (buffer
, gimple_omp_sections_clauses (gs
), spc
, flags
);
1791 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1795 pp_string (buffer
, "#pragma omp sections");
1796 if (gimple_omp_sections_control (gs
))
1798 pp_string (buffer
, " <");
1799 dump_generic_node (buffer
, gimple_omp_sections_control (gs
), spc
,
1801 pp_greater (buffer
);
1803 dump_omp_clauses (buffer
, gimple_omp_sections_clauses (gs
), spc
, flags
);
1804 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1806 newline_and_indent (buffer
, spc
+ 2);
1807 pp_left_brace (buffer
);
1808 pp_newline (buffer
);
1809 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1810 newline_and_indent (buffer
, spc
+ 2);
1811 pp_right_brace (buffer
);
1816 /* Dump a GIMPLE_OMP_{MASTER,ORDERED,SECTION} tuple on the
1817 pretty_printer BUFFER. */
1820 dump_gimple_omp_block (pretty_printer
*buffer
, const gimple
*gs
, int spc
,
1823 if (flags
& TDF_RAW
)
1824 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1825 gimple_omp_body (gs
));
1828 switch (gimple_code (gs
))
1830 case GIMPLE_OMP_MASTER
:
1831 pp_string (buffer
, "#pragma omp master");
1833 case GIMPLE_OMP_SECTION
:
1834 pp_string (buffer
, "#pragma omp section");
1839 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1841 newline_and_indent (buffer
, spc
+ 2);
1842 pp_left_brace (buffer
);
1843 pp_newline (buffer
);
1844 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1845 newline_and_indent (buffer
, spc
+ 2);
1846 pp_right_brace (buffer
);
1851 /* Dump a GIMPLE_OMP_CRITICAL tuple on the pretty_printer BUFFER. */
1854 dump_gimple_omp_critical (pretty_printer
*buffer
, const gomp_critical
*gs
,
1855 int spc
, dump_flags_t flags
)
1857 if (flags
& TDF_RAW
)
1858 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1859 gimple_omp_body (gs
));
1862 pp_string (buffer
, "#pragma omp critical");
1863 if (gimple_omp_critical_name (gs
))
1865 pp_string (buffer
, " (");
1866 dump_generic_node (buffer
, gimple_omp_critical_name (gs
), spc
,
1868 pp_right_paren (buffer
);
1870 dump_omp_clauses (buffer
, gimple_omp_critical_clauses (gs
), spc
, flags
);
1871 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1873 newline_and_indent (buffer
, spc
+ 2);
1874 pp_left_brace (buffer
);
1875 pp_newline (buffer
);
1876 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1877 newline_and_indent (buffer
, spc
+ 2);
1878 pp_right_brace (buffer
);
1883 /* Dump a GIMPLE_OMP_ORDERED tuple on the pretty_printer BUFFER. */
1886 dump_gimple_omp_ordered (pretty_printer
*buffer
, const gomp_ordered
*gs
,
1887 int spc
, dump_flags_t flags
)
1889 if (flags
& TDF_RAW
)
1890 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1891 gimple_omp_body (gs
));
1894 pp_string (buffer
, "#pragma omp ordered");
1895 dump_omp_clauses (buffer
, gimple_omp_ordered_clauses (gs
), spc
, flags
);
1896 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1898 newline_and_indent (buffer
, spc
+ 2);
1899 pp_left_brace (buffer
);
1900 pp_newline (buffer
);
1901 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1902 newline_and_indent (buffer
, spc
+ 2);
1903 pp_right_brace (buffer
);
1908 /* Dump a GIMPLE_OMP_SCAN tuple on the pretty_printer BUFFER. */
1911 dump_gimple_omp_scan (pretty_printer
*buffer
, const gomp_scan
*gs
,
1912 int spc
, dump_flags_t flags
)
1914 if (flags
& TDF_RAW
)
1915 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1916 gimple_omp_body (gs
));
1919 if (gimple_omp_scan_clauses (gs
))
1921 pp_string (buffer
, "#pragma omp scan");
1922 dump_omp_clauses (buffer
, gimple_omp_scan_clauses (gs
), spc
, flags
);
1924 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1926 newline_and_indent (buffer
, spc
+ 2);
1927 pp_left_brace (buffer
);
1928 pp_newline (buffer
);
1929 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1930 newline_and_indent (buffer
, spc
+ 2);
1931 pp_right_brace (buffer
);
1936 /* Dump a GIMPLE_OMP_RETURN tuple on the pretty_printer BUFFER. */
1939 dump_gimple_omp_return (pretty_printer
*buffer
, const gimple
*gs
, int spc
,
1942 if (flags
& TDF_RAW
)
1944 dump_gimple_fmt (buffer
, spc
, flags
, "%G <nowait=%d", gs
,
1945 (int) gimple_omp_return_nowait_p (gs
));
1946 if (gimple_omp_return_lhs (gs
))
1947 dump_gimple_fmt (buffer
, spc
, flags
, ", lhs=%T>",
1948 gimple_omp_return_lhs (gs
));
1950 dump_gimple_fmt (buffer
, spc
, flags
, ">");
1954 pp_string (buffer
, "#pragma omp return");
1955 if (gimple_omp_return_nowait_p (gs
))
1956 pp_string (buffer
, "(nowait)");
1957 if (gimple_omp_return_lhs (gs
))
1959 pp_string (buffer
, " (set ");
1960 dump_generic_node (buffer
, gimple_omp_return_lhs (gs
),
1962 pp_character (buffer
, ')');
1967 /* Dump a GIMPLE_TRANSACTION tuple on the pretty_printer BUFFER. */
1970 dump_gimple_transaction (pretty_printer
*buffer
, const gtransaction
*gs
,
1971 int spc
, dump_flags_t flags
)
1973 unsigned subcode
= gimple_transaction_subcode (gs
);
1975 if (flags
& TDF_RAW
)
1977 dump_gimple_fmt (buffer
, spc
, flags
,
1978 "%G [SUBCODE=%x,NORM=%T,UNINST=%T,OVER=%T] "
1980 gs
, subcode
, gimple_transaction_label_norm (gs
),
1981 gimple_transaction_label_uninst (gs
),
1982 gimple_transaction_label_over (gs
),
1983 gimple_transaction_body (gs
));
1987 if (subcode
& GTMA_IS_OUTER
)
1988 pp_string (buffer
, "__transaction_atomic [[outer]]");
1989 else if (subcode
& GTMA_IS_RELAXED
)
1990 pp_string (buffer
, "__transaction_relaxed");
1992 pp_string (buffer
, "__transaction_atomic");
1993 subcode
&= ~GTMA_DECLARATION_MASK
;
1995 if (gimple_transaction_body (gs
))
1997 newline_and_indent (buffer
, spc
+ 2);
1998 pp_left_brace (buffer
);
1999 pp_newline (buffer
);
2000 dump_gimple_seq (buffer
, gimple_transaction_body (gs
),
2002 newline_and_indent (buffer
, spc
+ 2);
2003 pp_right_brace (buffer
);
2007 pp_string (buffer
, " //");
2008 if (gimple_transaction_label_norm (gs
))
2010 pp_string (buffer
, " NORM=");
2011 dump_generic_node (buffer
, gimple_transaction_label_norm (gs
),
2014 if (gimple_transaction_label_uninst (gs
))
2016 pp_string (buffer
, " UNINST=");
2017 dump_generic_node (buffer
, gimple_transaction_label_uninst (gs
),
2020 if (gimple_transaction_label_over (gs
))
2022 pp_string (buffer
, " OVER=");
2023 dump_generic_node (buffer
, gimple_transaction_label_over (gs
),
2028 pp_string (buffer
, " SUBCODE=[ ");
2029 if (subcode
& GTMA_HAVE_ABORT
)
2031 pp_string (buffer
, "GTMA_HAVE_ABORT ");
2032 subcode
&= ~GTMA_HAVE_ABORT
;
2034 if (subcode
& GTMA_HAVE_LOAD
)
2036 pp_string (buffer
, "GTMA_HAVE_LOAD ");
2037 subcode
&= ~GTMA_HAVE_LOAD
;
2039 if (subcode
& GTMA_HAVE_STORE
)
2041 pp_string (buffer
, "GTMA_HAVE_STORE ");
2042 subcode
&= ~GTMA_HAVE_STORE
;
2044 if (subcode
& GTMA_MAY_ENTER_IRREVOCABLE
)
2046 pp_string (buffer
, "GTMA_MAY_ENTER_IRREVOCABLE ");
2047 subcode
&= ~GTMA_MAY_ENTER_IRREVOCABLE
;
2049 if (subcode
& GTMA_DOES_GO_IRREVOCABLE
)
2051 pp_string (buffer
, "GTMA_DOES_GO_IRREVOCABLE ");
2052 subcode
&= ~GTMA_DOES_GO_IRREVOCABLE
;
2054 if (subcode
& GTMA_HAS_NO_INSTRUMENTATION
)
2056 pp_string (buffer
, "GTMA_HAS_NO_INSTRUMENTATION ");
2057 subcode
&= ~GTMA_HAS_NO_INSTRUMENTATION
;
2060 pp_printf (buffer
, "0x%x ", subcode
);
2061 pp_right_bracket (buffer
);
2067 /* Dump a GIMPLE_ASM tuple on the pretty_printer BUFFER, SPC spaces of
2068 indent. FLAGS specifies details to show in the dump (see TDF_* in
2072 dump_gimple_asm (pretty_printer
*buffer
, const gasm
*gs
, int spc
,
2075 unsigned int i
, n
, f
, fields
;
2077 if (flags
& TDF_RAW
)
2079 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+STRING <%n%s%n>", gs
,
2080 gimple_asm_string (gs
));
2082 n
= gimple_asm_noutputs (gs
);
2085 newline_and_indent (buffer
, spc
+ 2);
2086 pp_string (buffer
, "OUTPUT: ");
2087 for (i
= 0; i
< n
; i
++)
2089 dump_generic_node (buffer
, gimple_asm_output_op (gs
, i
),
2092 pp_string (buffer
, ", ");
2096 n
= gimple_asm_ninputs (gs
);
2099 newline_and_indent (buffer
, spc
+ 2);
2100 pp_string (buffer
, "INPUT: ");
2101 for (i
= 0; i
< n
; i
++)
2103 dump_generic_node (buffer
, gimple_asm_input_op (gs
, i
),
2106 pp_string (buffer
, ", ");
2110 n
= gimple_asm_nclobbers (gs
);
2113 newline_and_indent (buffer
, spc
+ 2);
2114 pp_string (buffer
, "CLOBBER: ");
2115 for (i
= 0; i
< n
; i
++)
2117 dump_generic_node (buffer
, gimple_asm_clobber_op (gs
, i
),
2120 pp_string (buffer
, ", ");
2124 n
= gimple_asm_nlabels (gs
);
2127 newline_and_indent (buffer
, spc
+ 2);
2128 pp_string (buffer
, "LABEL: ");
2129 for (i
= 0; i
< n
; i
++)
2131 dump_generic_node (buffer
, gimple_asm_label_op (gs
, i
),
2134 pp_string (buffer
, ", ");
2138 newline_and_indent (buffer
, spc
);
2139 pp_greater (buffer
);
2143 pp_string (buffer
, "__asm__");
2144 if (gimple_asm_volatile_p (gs
))
2145 pp_string (buffer
, " __volatile__");
2146 if (gimple_asm_inline_p (gs
))
2147 pp_string (buffer
, " __inline__");
2148 if (gimple_asm_nlabels (gs
))
2149 pp_string (buffer
, " goto");
2150 pp_string (buffer
, "(\"");
2151 pp_string (buffer
, gimple_asm_string (gs
));
2152 pp_string (buffer
, "\"");
2154 if (gimple_asm_nlabels (gs
))
2156 else if (gimple_asm_nclobbers (gs
))
2158 else if (gimple_asm_ninputs (gs
))
2160 else if (gimple_asm_noutputs (gs
))
2165 for (f
= 0; f
< fields
; ++f
)
2167 pp_string (buffer
, " : ");
2172 n
= gimple_asm_noutputs (gs
);
2173 for (i
= 0; i
< n
; i
++)
2175 dump_generic_node (buffer
, gimple_asm_output_op (gs
, i
),
2178 pp_string (buffer
, ", ");
2183 n
= gimple_asm_ninputs (gs
);
2184 for (i
= 0; i
< n
; i
++)
2186 dump_generic_node (buffer
, gimple_asm_input_op (gs
, i
),
2189 pp_string (buffer
, ", ");
2194 n
= gimple_asm_nclobbers (gs
);
2195 for (i
= 0; i
< n
; i
++)
2197 dump_generic_node (buffer
, gimple_asm_clobber_op (gs
, i
),
2200 pp_string (buffer
, ", ");
2205 n
= gimple_asm_nlabels (gs
);
2206 for (i
= 0; i
< n
; i
++)
2208 dump_generic_node (buffer
, gimple_asm_label_op (gs
, i
),
2211 pp_string (buffer
, ", ");
2220 pp_string (buffer
, ");");
2224 /* Dump ptr_info and range_info for NODE on pretty_printer BUFFER with
2225 SPC spaces of indent. */
2228 dump_ssaname_info (pretty_printer
*buffer
, tree node
, int spc
)
2230 if (TREE_CODE (node
) != SSA_NAME
)
2233 if (POINTER_TYPE_P (TREE_TYPE (node
))
2234 && SSA_NAME_PTR_INFO (node
))
2236 unsigned int align
, misalign
;
2237 struct ptr_info_def
*pi
= SSA_NAME_PTR_INFO (node
);
2238 pp_string (buffer
, "# PT = ");
2239 pp_points_to_solution (buffer
, &pi
->pt
);
2240 newline_and_indent (buffer
, spc
);
2241 if (get_ptr_info_alignment (pi
, &align
, &misalign
))
2243 pp_printf (buffer
, "# ALIGN = %u, MISALIGN = %u", align
, misalign
);
2244 newline_and_indent (buffer
, spc
);
2248 if (!POINTER_TYPE_P (TREE_TYPE (node
))
2249 && SSA_NAME_RANGE_INFO (node
))
2251 wide_int min
, max
, nonzero_bits
;
2252 value_range_kind range_type
= get_range_info (node
, &min
, &max
);
2254 if (range_type
== VR_VARYING
)
2255 pp_printf (buffer
, "# RANGE VR_VARYING");
2256 else if (range_type
== VR_RANGE
|| range_type
== VR_ANTI_RANGE
)
2258 pp_printf (buffer
, "# RANGE ");
2259 pp_printf (buffer
, "%s[", range_type
== VR_RANGE
? "" : "~");
2260 pp_wide_int (buffer
, min
, TYPE_SIGN (TREE_TYPE (node
)));
2261 pp_printf (buffer
, ", ");
2262 pp_wide_int (buffer
, max
, TYPE_SIGN (TREE_TYPE (node
)));
2263 pp_printf (buffer
, "]");
2265 nonzero_bits
= get_nonzero_bits (node
);
2266 if (nonzero_bits
!= -1)
2268 pp_string (buffer
, " NONZERO ");
2269 pp_wide_int (buffer
, nonzero_bits
, UNSIGNED
);
2271 newline_and_indent (buffer
, spc
);
2275 /* As dump_ssaname_info, but dump to FILE. */
2278 dump_ssaname_info_to_file (FILE *file
, tree node
, int spc
)
2280 pretty_printer buffer
;
2281 pp_needs_newline (&buffer
) = true;
2282 buffer
.buffer
->stream
= file
;
2283 dump_ssaname_info (&buffer
, node
, spc
);
2287 /* Dump a PHI node PHI. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1.
2288 The caller is responsible for calling pp_flush on BUFFER to finalize
2289 pretty printer. If COMMENT is true, print this after #. */
2292 dump_gimple_phi (pretty_printer
*buffer
, const gphi
*phi
, int spc
, bool comment
,
2296 tree lhs
= gimple_phi_result (phi
);
2298 if (flags
& TDF_ALIAS
)
2299 dump_ssaname_info (buffer
, lhs
, spc
);
2302 pp_string (buffer
, "# ");
2304 if (flags
& TDF_RAW
)
2305 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, ", phi
,
2306 gimple_phi_result (phi
));
2309 dump_generic_node (buffer
, lhs
, spc
, flags
, false);
2310 if (flags
& TDF_GIMPLE
)
2311 pp_string (buffer
, " = __PHI (");
2313 pp_string (buffer
, " = PHI <");
2315 for (i
= 0; i
< gimple_phi_num_args (phi
); i
++)
2317 if ((flags
& TDF_LINENO
) && gimple_phi_arg_has_location (phi
, i
))
2318 dump_location (buffer
, gimple_phi_arg_location (phi
, i
));
2319 basic_block src
= gimple_phi_arg_edge (phi
, i
)->src
;
2320 if (flags
& TDF_GIMPLE
)
2322 pp_string (buffer
, "__BB");
2323 pp_decimal_int (buffer
, src
->index
);
2324 pp_string (buffer
, ": ");
2326 dump_generic_node (buffer
, gimple_phi_arg_def (phi
, i
), spc
, flags
,
2328 if (! (flags
& TDF_GIMPLE
))
2330 pp_left_paren (buffer
);
2331 pp_decimal_int (buffer
, src
->index
);
2332 pp_right_paren (buffer
);
2334 if (i
< gimple_phi_num_args (phi
) - 1)
2335 pp_string (buffer
, ", ");
2337 if (flags
& TDF_GIMPLE
)
2338 pp_string (buffer
, ");");
2340 pp_greater (buffer
);
2344 /* Dump a GIMPLE_OMP_PARALLEL tuple on the pretty_printer BUFFER, SPC spaces
2345 of indent. FLAGS specifies details to show in the dump (see TDF_* in
2349 dump_gimple_omp_parallel (pretty_printer
*buffer
, const gomp_parallel
*gs
,
2350 int spc
, dump_flags_t flags
)
2352 if (flags
& TDF_RAW
)
2354 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
2355 gimple_omp_body (gs
));
2356 dump_omp_clauses (buffer
, gimple_omp_parallel_clauses (gs
), spc
, flags
);
2357 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T%n>",
2358 gimple_omp_parallel_child_fn (gs
),
2359 gimple_omp_parallel_data_arg (gs
));
2364 pp_string (buffer
, "#pragma omp parallel");
2365 dump_omp_clauses (buffer
, gimple_omp_parallel_clauses (gs
), spc
, flags
);
2366 if (gimple_omp_parallel_child_fn (gs
))
2368 pp_string (buffer
, " [child fn: ");
2369 dump_generic_node (buffer
, gimple_omp_parallel_child_fn (gs
),
2371 pp_string (buffer
, " (");
2372 if (gimple_omp_parallel_data_arg (gs
))
2373 dump_generic_node (buffer
, gimple_omp_parallel_data_arg (gs
),
2376 pp_string (buffer
, "???");
2377 pp_string (buffer
, ")]");
2379 body
= gimple_omp_body (gs
);
2380 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
2382 newline_and_indent (buffer
, spc
+ 2);
2383 pp_left_brace (buffer
);
2384 pp_newline (buffer
);
2385 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
2386 newline_and_indent (buffer
, spc
+ 2);
2387 pp_right_brace (buffer
);
2391 pp_newline (buffer
);
2392 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
2398 /* Dump a GIMPLE_OMP_TASK tuple on the pretty_printer BUFFER, SPC spaces
2399 of indent. FLAGS specifies details to show in the dump (see TDF_* in
2403 dump_gimple_omp_task (pretty_printer
*buffer
, const gomp_task
*gs
, int spc
,
2406 if (flags
& TDF_RAW
)
2408 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
2409 gimple_omp_body (gs
));
2410 dump_omp_clauses (buffer
, gimple_omp_task_clauses (gs
), spc
, flags
);
2411 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T, %T, %T, %T%n>",
2412 gimple_omp_task_child_fn (gs
),
2413 gimple_omp_task_data_arg (gs
),
2414 gimple_omp_task_copy_fn (gs
),
2415 gimple_omp_task_arg_size (gs
),
2416 gimple_omp_task_arg_size (gs
));
2421 if (gimple_omp_task_taskloop_p (gs
))
2422 pp_string (buffer
, "#pragma omp taskloop");
2423 else if (gimple_omp_task_taskwait_p (gs
))
2424 pp_string (buffer
, "#pragma omp taskwait");
2426 pp_string (buffer
, "#pragma omp task");
2427 dump_omp_clauses (buffer
, gimple_omp_task_clauses (gs
), spc
, flags
);
2428 if (gimple_omp_task_child_fn (gs
))
2430 pp_string (buffer
, " [child fn: ");
2431 dump_generic_node (buffer
, gimple_omp_task_child_fn (gs
),
2433 pp_string (buffer
, " (");
2434 if (gimple_omp_task_data_arg (gs
))
2435 dump_generic_node (buffer
, gimple_omp_task_data_arg (gs
),
2438 pp_string (buffer
, "???");
2439 pp_string (buffer
, ")]");
2441 body
= gimple_omp_body (gs
);
2442 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
2444 newline_and_indent (buffer
, spc
+ 2);
2445 pp_left_brace (buffer
);
2446 pp_newline (buffer
);
2447 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
2448 newline_and_indent (buffer
, spc
+ 2);
2449 pp_right_brace (buffer
);
2453 pp_newline (buffer
);
2454 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
2460 /* Dump a GIMPLE_OMP_ATOMIC_LOAD tuple on the pretty_printer BUFFER, SPC
2461 spaces of indent. FLAGS specifies details to show in the dump (see TDF_*
2465 dump_gimple_omp_atomic_load (pretty_printer
*buffer
, const gomp_atomic_load
*gs
,
2466 int spc
, dump_flags_t flags
)
2468 if (flags
& TDF_RAW
)
2470 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T>", gs
,
2471 gimple_omp_atomic_load_lhs (gs
),
2472 gimple_omp_atomic_load_rhs (gs
));
2476 pp_string (buffer
, "#pragma omp atomic_load");
2477 dump_omp_atomic_memory_order (buffer
,
2478 gimple_omp_atomic_memory_order (gs
));
2479 if (gimple_omp_atomic_need_value_p (gs
))
2480 pp_string (buffer
, " [needed]");
2481 newline_and_indent (buffer
, spc
+ 2);
2482 dump_generic_node (buffer
, gimple_omp_atomic_load_lhs (gs
),
2488 dump_generic_node (buffer
, gimple_omp_atomic_load_rhs (gs
),
2493 /* Dump a GIMPLE_OMP_ATOMIC_STORE tuple on the pretty_printer BUFFER, SPC
2494 spaces of indent. FLAGS specifies details to show in the dump (see TDF_*
2498 dump_gimple_omp_atomic_store (pretty_printer
*buffer
,
2499 const gomp_atomic_store
*gs
, int spc
,
2502 if (flags
& TDF_RAW
)
2504 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
,
2505 gimple_omp_atomic_store_val (gs
));
2509 pp_string (buffer
, "#pragma omp atomic_store");
2510 dump_omp_atomic_memory_order (buffer
,
2511 gimple_omp_atomic_memory_order (gs
));
2513 if (gimple_omp_atomic_need_value_p (gs
))
2514 pp_string (buffer
, "[needed] ");
2515 pp_left_paren (buffer
);
2516 dump_generic_node (buffer
, gimple_omp_atomic_store_val (gs
),
2518 pp_right_paren (buffer
);
2523 /* Dump all the memory operands for statement GS. BUFFER, SPC and
2524 FLAGS are as in pp_gimple_stmt_1. */
2527 dump_gimple_mem_ops (pretty_printer
*buffer
, const gimple
*gs
, int spc
,
2530 tree vdef
= gimple_vdef (gs
);
2531 tree vuse
= gimple_vuse (gs
);
2533 if (vdef
!= NULL_TREE
)
2535 pp_string (buffer
, "# ");
2536 dump_generic_node (buffer
, vdef
, spc
+ 2, flags
, false);
2537 pp_string (buffer
, " = VDEF <");
2538 dump_generic_node (buffer
, vuse
, spc
+ 2, flags
, false);
2539 pp_greater (buffer
);
2540 newline_and_indent (buffer
, spc
);
2542 else if (vuse
!= NULL_TREE
)
2544 pp_string (buffer
, "# VUSE <");
2545 dump_generic_node (buffer
, vuse
, spc
+ 2, flags
, false);
2546 pp_greater (buffer
);
2547 newline_and_indent (buffer
, spc
);
2552 /* Print the gimple statement GS on the pretty printer BUFFER, SPC
2553 spaces of indent. FLAGS specifies details to show in the dump (see
2554 TDF_* in dumpfile.h). The caller is responsible for calling
2555 pp_flush on BUFFER to finalize the pretty printer. */
2558 pp_gimple_stmt_1 (pretty_printer
*buffer
, const gimple
*gs
, int spc
,
2564 if (flags
& TDF_STMTADDR
)
2565 pp_printf (buffer
, "<&%p> ", (const void *) gs
);
2567 if ((flags
& TDF_LINENO
) && gimple_has_location (gs
))
2568 dump_location (buffer
, gimple_location (gs
));
2572 int lp_nr
= lookup_stmt_eh_lp (gs
);
2574 pp_printf (buffer
, "[LP %d] ", lp_nr
);
2576 pp_printf (buffer
, "[MNT %d] ", -lp_nr
);
2579 if ((flags
& (TDF_VOPS
|TDF_MEMSYMS
))
2580 && gimple_has_mem_ops (gs
))
2581 dump_gimple_mem_ops (buffer
, gs
, spc
, flags
);
2583 if (gimple_has_lhs (gs
)
2584 && (flags
& TDF_ALIAS
))
2585 dump_ssaname_info (buffer
, gimple_get_lhs (gs
), spc
);
2587 switch (gimple_code (gs
))
2590 dump_gimple_asm (buffer
, as_a
<const gasm
*> (gs
), spc
, flags
);
2594 dump_gimple_assign (buffer
, as_a
<const gassign
*> (gs
), spc
, flags
);
2598 dump_gimple_bind (buffer
, as_a
<const gbind
*> (gs
), spc
, flags
);
2602 dump_gimple_call (buffer
, as_a
<const gcall
*> (gs
), spc
, flags
);
2606 dump_gimple_cond (buffer
, as_a
<const gcond
*> (gs
), spc
, flags
);
2610 dump_gimple_label (buffer
, as_a
<const glabel
*> (gs
), spc
, flags
);
2614 dump_gimple_goto (buffer
, as_a
<const ggoto
*> (gs
), spc
, flags
);
2618 pp_string (buffer
, "GIMPLE_NOP");
2622 dump_gimple_return (buffer
, as_a
<const greturn
*> (gs
), spc
, flags
);
2626 dump_gimple_switch (buffer
, as_a
<const gswitch
*> (gs
), spc
, flags
);
2630 dump_gimple_try (buffer
, as_a
<const gtry
*> (gs
), spc
, flags
);
2634 dump_gimple_phi (buffer
, as_a
<const gphi
*> (gs
), spc
, false, flags
);
2637 case GIMPLE_OMP_PARALLEL
:
2638 dump_gimple_omp_parallel (buffer
, as_a
<const gomp_parallel
*> (gs
), spc
,
2642 case GIMPLE_OMP_TASK
:
2643 dump_gimple_omp_task (buffer
, as_a
<const gomp_task
*> (gs
), spc
, flags
);
2646 case GIMPLE_OMP_ATOMIC_LOAD
:
2647 dump_gimple_omp_atomic_load (buffer
, as_a
<const gomp_atomic_load
*> (gs
),
2651 case GIMPLE_OMP_ATOMIC_STORE
:
2652 dump_gimple_omp_atomic_store (buffer
,
2653 as_a
<const gomp_atomic_store
*> (gs
),
2657 case GIMPLE_OMP_FOR
:
2658 dump_gimple_omp_for (buffer
, as_a
<const gomp_for
*> (gs
), spc
, flags
);
2661 case GIMPLE_OMP_CONTINUE
:
2662 dump_gimple_omp_continue (buffer
, as_a
<const gomp_continue
*> (gs
), spc
,
2666 case GIMPLE_OMP_SINGLE
:
2667 dump_gimple_omp_single (buffer
, as_a
<const gomp_single
*> (gs
), spc
,
2671 case GIMPLE_OMP_TARGET
:
2672 dump_gimple_omp_target (buffer
, as_a
<const gomp_target
*> (gs
), spc
,
2676 case GIMPLE_OMP_TEAMS
:
2677 dump_gimple_omp_teams (buffer
, as_a
<const gomp_teams
*> (gs
), spc
,
2681 case GIMPLE_OMP_RETURN
:
2682 dump_gimple_omp_return (buffer
, gs
, spc
, flags
);
2685 case GIMPLE_OMP_SECTIONS
:
2686 dump_gimple_omp_sections (buffer
, as_a
<const gomp_sections
*> (gs
),
2690 case GIMPLE_OMP_SECTIONS_SWITCH
:
2691 pp_string (buffer
, "GIMPLE_SECTIONS_SWITCH");
2694 case GIMPLE_OMP_TASKGROUP
:
2695 dump_gimple_omp_taskgroup (buffer
, gs
, spc
, flags
);
2698 case GIMPLE_OMP_MASTER
:
2699 case GIMPLE_OMP_SECTION
:
2700 dump_gimple_omp_block (buffer
, gs
, spc
, flags
);
2703 case GIMPLE_OMP_ORDERED
:
2704 dump_gimple_omp_ordered (buffer
, as_a
<const gomp_ordered
*> (gs
), spc
,
2708 case GIMPLE_OMP_SCAN
:
2709 dump_gimple_omp_scan (buffer
, as_a
<const gomp_scan
*> (gs
), spc
,
2713 case GIMPLE_OMP_CRITICAL
:
2714 dump_gimple_omp_critical (buffer
, as_a
<const gomp_critical
*> (gs
), spc
,
2719 dump_gimple_catch (buffer
, as_a
<const gcatch
*> (gs
), spc
, flags
);
2722 case GIMPLE_EH_FILTER
:
2723 dump_gimple_eh_filter (buffer
, as_a
<const geh_filter
*> (gs
), spc
,
2727 case GIMPLE_EH_MUST_NOT_THROW
:
2728 dump_gimple_eh_must_not_throw (buffer
,
2729 as_a
<const geh_mnt
*> (gs
),
2733 case GIMPLE_EH_ELSE
:
2734 dump_gimple_eh_else (buffer
, as_a
<const geh_else
*> (gs
), spc
, flags
);
2738 dump_gimple_resx (buffer
, as_a
<const gresx
*> (gs
), spc
, flags
);
2741 case GIMPLE_EH_DISPATCH
:
2742 dump_gimple_eh_dispatch (buffer
, as_a
<const geh_dispatch
*> (gs
), spc
,
2747 dump_gimple_debug (buffer
, as_a
<const gdebug
*> (gs
), spc
, flags
);
2750 case GIMPLE_PREDICT
:
2751 pp_string (buffer
, "// predicted ");
2752 if (gimple_predict_outcome (gs
))
2753 pp_string (buffer
, "likely by ");
2755 pp_string (buffer
, "unlikely by ");
2756 pp_string (buffer
, predictor_name (gimple_predict_predictor (gs
)));
2757 pp_string (buffer
, " predictor.");
2760 case GIMPLE_TRANSACTION
:
2761 dump_gimple_transaction (buffer
, as_a
<const gtransaction
*> (gs
), spc
,
2771 /* Dumps header of basic block BB to OUTF indented by INDENT
2772 spaces and details described by flags. */
2775 dump_gimple_bb_header (FILE *outf
, basic_block bb
, int indent
,
2778 if (flags
& TDF_BLOCKS
)
2780 if (flags
& TDF_LINENO
)
2782 gimple_stmt_iterator gsi
;
2784 fputs (";; ", outf
);
2786 for (gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
); gsi_next (&gsi
))
2787 if (!is_gimple_debug (gsi_stmt (gsi
))
2788 && get_lineno (gsi_stmt (gsi
)) != UNKNOWN_LOCATION
)
2790 fprintf (outf
, "%*sstarting at line %d",
2791 indent
, "", get_lineno (gsi_stmt (gsi
)));
2794 if (bb
->discriminator
)
2795 fprintf (outf
, ", discriminator %i", bb
->discriminator
);
2801 if (flags
& TDF_GIMPLE
)
2803 fprintf (outf
, "%*s__BB(%d", indent
, "", bb
->index
);
2804 if (bb
->loop_father
->header
== bb
)
2805 fprintf (outf
, ",loop_header(%d)", bb
->loop_father
->num
);
2806 if (bb
->count
.initialized_p ())
2807 fprintf (outf
, ",%s(%d)",
2808 profile_quality_as_string (bb
->count
.quality ()),
2809 bb
->count
.value ());
2810 fprintf (outf
, "):\n");
2813 fprintf (outf
, "%*s<bb %d> %s:\n",
2814 indent
, "", bb
->index
, dump_profile (bb
->count
));
2819 /* Dumps end of basic block BB to buffer BUFFER indented by INDENT
2823 dump_gimple_bb_footer (FILE *outf ATTRIBUTE_UNUSED
,
2824 basic_block bb ATTRIBUTE_UNUSED
,
2825 int indent ATTRIBUTE_UNUSED
,
2826 dump_flags_t flags ATTRIBUTE_UNUSED
)
2828 /* There is currently no GIMPLE-specific basic block info to dump. */
2833 /* Dump PHI nodes of basic block BB to BUFFER with details described
2834 by FLAGS and indented by INDENT spaces. */
2837 dump_phi_nodes (pretty_printer
*buffer
, basic_block bb
, int indent
,
2842 for (i
= gsi_start_phis (bb
); !gsi_end_p (i
); gsi_next (&i
))
2844 gphi
*phi
= i
.phi ();
2845 if (!virtual_operand_p (gimple_phi_result (phi
)) || (flags
& TDF_VOPS
))
2848 dump_gimple_phi (buffer
, phi
, indent
,
2849 (flags
& TDF_GIMPLE
) ? false : true, flags
);
2850 pp_newline (buffer
);
2856 /* Dump jump to basic block BB that is represented implicitly in the cfg
2860 pp_cfg_jump (pretty_printer
*buffer
, edge e
, dump_flags_t flags
)
2862 if (flags
& TDF_GIMPLE
)
2864 pp_string (buffer
, "goto __BB");
2865 pp_decimal_int (buffer
, e
->dest
->index
);
2866 if (e
->probability
.initialized_p ())
2868 pp_string (buffer
, "(");
2870 profile_quality_as_string (e
->probability
.quality ()));
2871 pp_string (buffer
, "(");
2872 pp_decimal_int (buffer
, e
->probability
.value ());
2873 pp_string (buffer
, "))");
2875 pp_semicolon (buffer
);
2879 pp_string (buffer
, "goto <bb ");
2880 pp_decimal_int (buffer
, e
->dest
->index
);
2881 pp_greater (buffer
);
2882 pp_semicolon (buffer
);
2884 dump_edge_probability (buffer
, e
);
2889 /* Dump edges represented implicitly in basic block BB to BUFFER, indented
2890 by INDENT spaces, with details given by FLAGS. */
2893 dump_implicit_edges (pretty_printer
*buffer
, basic_block bb
, int indent
,
2899 stmt
= last_stmt (bb
);
2901 if (stmt
&& gimple_code (stmt
) == GIMPLE_COND
)
2903 edge true_edge
, false_edge
;
2905 /* When we are emitting the code or changing CFG, it is possible that
2906 the edges are not yet created. When we are using debug_bb in such
2907 a situation, we do not want it to crash. */
2908 if (EDGE_COUNT (bb
->succs
) != 2)
2910 extract_true_false_edges_from_block (bb
, &true_edge
, &false_edge
);
2912 INDENT (indent
+ 2);
2913 pp_cfg_jump (buffer
, true_edge
, flags
);
2914 newline_and_indent (buffer
, indent
);
2915 pp_string (buffer
, "else");
2916 newline_and_indent (buffer
, indent
+ 2);
2917 pp_cfg_jump (buffer
, false_edge
, flags
);
2918 pp_newline (buffer
);
2922 /* If there is a fallthru edge, we may need to add an artificial
2923 goto to the dump. */
2924 e
= find_fallthru_edge (bb
->succs
);
2926 if (e
&& (e
->dest
!= bb
->next_bb
|| (flags
& TDF_GIMPLE
)))
2930 if ((flags
& TDF_LINENO
)
2931 && e
->goto_locus
!= UNKNOWN_LOCATION
)
2932 dump_location (buffer
, e
->goto_locus
);
2934 pp_cfg_jump (buffer
, e
, flags
);
2935 pp_newline (buffer
);
2940 /* Dumps basic block BB to buffer BUFFER with details described by FLAGS and
2941 indented by INDENT spaces. */
2944 gimple_dump_bb_buff (pretty_printer
*buffer
, basic_block bb
, int indent
,
2947 gimple_stmt_iterator gsi
;
2949 int label_indent
= indent
- 2;
2951 if (label_indent
< 0)
2954 dump_phi_nodes (buffer
, bb
, indent
, flags
);
2956 for (gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
); gsi_next (&gsi
))
2960 stmt
= gsi_stmt (gsi
);
2962 curr_indent
= gimple_code (stmt
) == GIMPLE_LABEL
? label_indent
: indent
;
2964 INDENT (curr_indent
);
2965 pp_gimple_stmt_1 (buffer
, stmt
, curr_indent
, flags
);
2966 pp_newline_and_flush (buffer
);
2967 gcc_checking_assert (DECL_STRUCT_FUNCTION (current_function_decl
));
2968 dump_histograms_for_stmt (DECL_STRUCT_FUNCTION (current_function_decl
),
2969 pp_buffer (buffer
)->stream
, stmt
);
2972 dump_implicit_edges (buffer
, bb
, indent
, flags
);
2977 /* Dumps basic block BB to FILE with details described by FLAGS and
2978 indented by INDENT spaces. */
2981 gimple_dump_bb (FILE *file
, basic_block bb
, int indent
, dump_flags_t flags
)
2983 dump_gimple_bb_header (file
, bb
, indent
, flags
);
2984 if (bb
->index
>= NUM_FIXED_BLOCKS
)
2986 pretty_printer buffer
;
2987 pp_needs_newline (&buffer
) = true;
2988 buffer
.buffer
->stream
= file
;
2989 gimple_dump_bb_buff (&buffer
, bb
, indent
, flags
);
2991 dump_gimple_bb_footer (file
, bb
, indent
, flags
);
2994 /* Dumps basic block BB to pretty-printer PP with default dump flags and
2995 no indentation, for use as a label of a DOT graph record-node.
2996 ??? Should just use gimple_dump_bb_buff here, except that value profiling
2997 histogram dumping doesn't know about pretty-printers. */
3000 gimple_dump_bb_for_graph (pretty_printer
*pp
, basic_block bb
)
3002 pp_printf (pp
, "<bb %d>:\n", bb
->index
);
3003 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
3005 for (gphi_iterator gsi
= gsi_start_phis (bb
); !gsi_end_p (gsi
);
3008 gphi
*phi
= gsi
.phi ();
3009 if (!virtual_operand_p (gimple_phi_result (phi
))
3010 || (dump_flags
& TDF_VOPS
))
3013 pp_write_text_to_stream (pp
);
3014 pp_string (pp
, "# ");
3015 pp_gimple_stmt_1 (pp
, phi
, 0, dump_flags
);
3017 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
3021 for (gimple_stmt_iterator gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
);
3024 gimple
*stmt
= gsi_stmt (gsi
);
3026 pp_write_text_to_stream (pp
);
3027 pp_gimple_stmt_1 (pp
, stmt
, 0, dump_flags
);
3029 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
3031 dump_implicit_edges (pp
, bb
, 0, dump_flags
);
3032 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
3036 /* Handle the %G format for TEXT. Same as %K in handle_K_format in
3037 tree-pretty-print.c but with a Gimple statement as an argument. */
3040 percent_G_format (text_info
*text
)
3042 gimple
*stmt
= va_arg (*text
->args_ptr
, gimple
*);
3044 /* Fall back on the rich location if the statement doesn't have one. */
3045 location_t loc
= gimple_location (stmt
);
3046 if (loc
== UNKNOWN_LOCATION
)
3047 loc
= text
->m_richloc
->get_loc ();
3048 tree block
= gimple_block (stmt
);
3049 percent_K_format (text
, loc
, block
);
3053 # pragma GCC diagnostic pop