1 /* Pretty formatting of GIMPLE statements and expressions.
2 Copyright (C) 2001-2021 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"
45 #include "gimple-range.h"
47 /* Disable warnings about quoting issues in the pp_xxx calls below
48 that (intentionally) don't follow GCC diagnostic conventions. */
50 # pragma GCC diagnostic push
51 # pragma GCC diagnostic ignored "-Wformat-diag"
54 #define INDENT(SPACE) \
55 do { int i; for (i = 0; i < SPACE; i++) pp_space (buffer); } while (0)
57 #define GIMPLE_NIY do_niy (buffer,gs)
59 /* Try to print on BUFFER a default message for the unrecognized
60 gimple statement GS. */
63 do_niy (pretty_printer
*buffer
, const gimple
*gs
)
65 pp_printf (buffer
, "<<< Unknown GIMPLE statement: %s >>>\n",
66 gimple_code_name
[(int) gimple_code (gs
)]);
70 /* Emit a newline and SPC indentation spaces to BUFFER. */
73 newline_and_indent (pretty_printer
*buffer
, int spc
)
80 /* Print the GIMPLE statement GS on stderr. */
83 debug_gimple_stmt (gimple
*gs
)
85 print_gimple_stmt (stderr
, gs
, 0, TDF_VOPS
|TDF_MEMSYMS
);
89 /* Return formatted string of a VALUE probability
90 (biased by REG_BR_PROB_BASE). Returned string is allocated
91 by xstrdup_for_dump. */
94 dump_profile (profile_count
&count
)
97 if (!count
.initialized_p ())
100 buf
= xasprintf ("[count: %" PRId64
"]",
101 count
.to_gcov_type ());
102 else if (count
.initialized_p ())
103 buf
= xasprintf ("[local count: %" PRId64
"]",
104 count
.to_gcov_type ());
106 const char *ret
= xstrdup_for_dump (buf
);
112 /* Return formatted string of a VALUE probability
113 (biased by REG_BR_PROB_BASE). Returned string is allocated
114 by xstrdup_for_dump. */
117 dump_probability (profile_probability probability
)
119 float minimum
= 0.01f
;
122 if (probability
.initialized_p ())
124 fvalue
= probability
.to_reg_br_prob_base () * 100.0f
/ REG_BR_PROB_BASE
;
125 if (fvalue
< minimum
&& probability
.to_reg_br_prob_base ())
130 if (probability
.initialized_p ())
131 buf
= xasprintf ("[%.2f%%]", fvalue
);
133 buf
= xasprintf ("[INV]");
135 const char *ret
= xstrdup_for_dump (buf
);
141 /* Dump E probability to BUFFER. */
144 dump_edge_probability (pretty_printer
*buffer
, edge e
)
146 pp_scalar (buffer
, " %s", dump_probability (e
->probability
));
149 /* Print GIMPLE statement G to FILE using SPC indentation spaces and
150 FLAGS as in pp_gimple_stmt_1. */
153 print_gimple_stmt (FILE *file
, gimple
*g
, int spc
, dump_flags_t flags
)
155 pretty_printer buffer
;
156 pp_needs_newline (&buffer
) = true;
157 buffer
.buffer
->stream
= file
;
158 pp_gimple_stmt_1 (&buffer
, g
, spc
, flags
);
159 pp_newline_and_flush (&buffer
);
165 print_gimple_stmt (stderr
, &ref
, 0, TDF_NONE
);
174 fprintf (stderr
, "<nil>\n");
178 /* Print GIMPLE statement G to FILE using SPC indentation spaces and
179 FLAGS as in pp_gimple_stmt_1. Print only the right-hand side
183 print_gimple_expr (FILE *file
, gimple
*g
, int spc
, dump_flags_t flags
)
185 flags
|= TDF_RHS_ONLY
;
186 pretty_printer buffer
;
187 pp_needs_newline (&buffer
) = true;
188 buffer
.buffer
->stream
= file
;
189 pp_gimple_stmt_1 (&buffer
, g
, spc
, flags
);
194 /* Print the GIMPLE sequence SEQ on BUFFER using SPC indentation
195 spaces and FLAGS as in pp_gimple_stmt_1.
196 The caller is responsible for calling pp_flush on BUFFER to finalize
197 the pretty printer. */
200 dump_gimple_seq (pretty_printer
*buffer
, gimple_seq seq
, int spc
,
203 gimple_stmt_iterator i
;
205 for (i
= gsi_start (seq
); !gsi_end_p (i
); gsi_next (&i
))
207 gimple
*gs
= gsi_stmt (i
);
209 pp_gimple_stmt_1 (buffer
, gs
, spc
, flags
);
210 if (!gsi_one_before_end_p (i
))
216 /* Print GIMPLE sequence SEQ to FILE using SPC indentation spaces and
217 FLAGS as in pp_gimple_stmt_1. */
220 print_gimple_seq (FILE *file
, gimple_seq seq
, int spc
, dump_flags_t flags
)
222 pretty_printer buffer
;
223 pp_needs_newline (&buffer
) = true;
224 buffer
.buffer
->stream
= file
;
225 dump_gimple_seq (&buffer
, seq
, spc
, flags
);
226 pp_newline_and_flush (&buffer
);
230 /* Print the GIMPLE sequence SEQ on stderr. */
233 debug_gimple_seq (gimple_seq seq
)
235 print_gimple_seq (stderr
, seq
, 0, TDF_VOPS
|TDF_MEMSYMS
);
239 /* A simple helper to pretty-print some of the gimple tuples in the printf
240 style. The format modifiers are preceded by '%' and are:
241 'G' - outputs a string corresponding to the code of the given gimple,
242 'S' - outputs a gimple_seq with indent of spc + 2,
243 'T' - outputs the tree t,
244 'd' - outputs an int as a decimal,
245 's' - outputs a string,
246 'n' - outputs a newline,
247 'x' - outputs an int as hexadecimal,
248 '+' - increases indent by 2 then outputs a newline,
249 '-' - decreases indent by 2 then outputs a newline. */
252 dump_gimple_fmt (pretty_printer
*buffer
, int spc
, dump_flags_t flags
,
253 const char *fmt
, ...)
259 va_start (args
, fmt
);
260 for (c
= fmt
; *c
; c
++)
270 g
= va_arg (args
, gimple
*);
271 tmp
= gimple_code_name
[gimple_code (g
)];
272 pp_string (buffer
, tmp
);
276 seq
= va_arg (args
, gimple_seq
);
278 dump_gimple_seq (buffer
, seq
, spc
+ 2, flags
);
279 newline_and_indent (buffer
, spc
);
283 t
= va_arg (args
, tree
);
285 pp_string (buffer
, "NULL");
287 dump_generic_node (buffer
, t
, spc
, flags
, false);
291 pp_decimal_int (buffer
, va_arg (args
, int));
295 pp_string (buffer
, va_arg (args
, char *));
299 newline_and_indent (buffer
, spc
);
303 pp_scalar (buffer
, "%x", va_arg (args
, int));
308 newline_and_indent (buffer
, spc
);
313 newline_and_indent (buffer
, spc
);
321 pp_character (buffer
, *c
);
327 /* Helper for dump_gimple_assign. Print the unary RHS of the
328 assignment GS. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. */
331 dump_unary_rhs (pretty_printer
*buffer
, const gassign
*gs
, int spc
,
334 enum tree_code rhs_code
= gimple_assign_rhs_code (gs
);
335 tree lhs
= gimple_assign_lhs (gs
);
336 tree rhs
= gimple_assign_rhs1 (gs
);
340 case VIEW_CONVERT_EXPR
:
342 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
345 case FIXED_CONVERT_EXPR
:
346 case ADDR_SPACE_CONVERT_EXPR
:
350 pp_left_paren (buffer
);
351 dump_generic_node (buffer
, TREE_TYPE (lhs
), spc
, flags
, false);
352 pp_string (buffer
, ") ");
353 if (op_prio (rhs
) < op_code_prio (rhs_code
))
355 pp_left_paren (buffer
);
356 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
357 pp_right_paren (buffer
);
360 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
364 pp_string (buffer
, "((");
365 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
366 pp_string (buffer
, "))");
371 if (flags
& TDF_GIMPLE
)
374 rhs_code
== ABS_EXPR
? "__ABS " : "__ABSU ");
375 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
380 rhs_code
== ABS_EXPR
? "ABS_EXPR <" : "ABSU_EXPR <");
381 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
387 if (TREE_CODE_CLASS (rhs_code
) == tcc_declaration
388 || TREE_CODE_CLASS (rhs_code
) == tcc_constant
389 || TREE_CODE_CLASS (rhs_code
) == tcc_reference
390 || rhs_code
== SSA_NAME
391 || rhs_code
== ADDR_EXPR
392 || rhs_code
== CONSTRUCTOR
)
394 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
397 else if (rhs_code
== BIT_NOT_EXPR
)
398 pp_complement (buffer
);
399 else if (rhs_code
== TRUTH_NOT_EXPR
)
400 pp_exclamation (buffer
);
401 else if (rhs_code
== NEGATE_EXPR
)
405 pp_left_bracket (buffer
);
406 pp_string (buffer
, get_tree_code_name (rhs_code
));
407 pp_string (buffer
, "] ");
410 if (op_prio (rhs
) < op_code_prio (rhs_code
))
412 pp_left_paren (buffer
);
413 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
414 pp_right_paren (buffer
);
417 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
423 /* Helper for dump_gimple_assign. Print the binary RHS of the
424 assignment GS. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. */
427 dump_binary_rhs (pretty_printer
*buffer
, const gassign
*gs
, int spc
,
431 enum tree_code code
= gimple_assign_rhs_code (gs
);
436 if (flags
& TDF_GIMPLE
)
438 pp_string (buffer
, code
== MIN_EXPR
? "__MIN (" : "__MAX (");
439 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
,
441 pp_string (buffer
, ", ");
442 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
,
444 pp_string (buffer
, ")");
452 case VEC_WIDEN_MULT_HI_EXPR
:
453 case VEC_WIDEN_MULT_LO_EXPR
:
454 case VEC_WIDEN_MULT_EVEN_EXPR
:
455 case VEC_WIDEN_MULT_ODD_EXPR
:
456 case VEC_PACK_TRUNC_EXPR
:
457 case VEC_PACK_SAT_EXPR
:
458 case VEC_PACK_FIX_TRUNC_EXPR
:
459 case VEC_PACK_FLOAT_EXPR
:
460 case VEC_WIDEN_LSHIFT_HI_EXPR
:
461 case VEC_WIDEN_LSHIFT_LO_EXPR
:
462 case VEC_WIDEN_PLUS_HI_EXPR
:
463 case VEC_WIDEN_PLUS_LO_EXPR
:
464 case VEC_WIDEN_MINUS_HI_EXPR
:
465 case VEC_WIDEN_MINUS_LO_EXPR
:
466 case VEC_SERIES_EXPR
:
467 for (p
= get_tree_code_name (code
); *p
; p
++)
468 pp_character (buffer
, TOUPPER (*p
));
469 pp_string (buffer
, " <");
470 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
471 pp_string (buffer
, ", ");
472 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
477 if (op_prio (gimple_assign_rhs1 (gs
)) <= op_code_prio (code
))
479 pp_left_paren (buffer
);
480 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
,
482 pp_right_paren (buffer
);
485 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
487 pp_string (buffer
, op_symbol_code (gimple_assign_rhs_code (gs
)));
489 if (op_prio (gimple_assign_rhs2 (gs
)) <= op_code_prio (code
))
491 pp_left_paren (buffer
);
492 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
,
494 pp_right_paren (buffer
);
497 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
501 /* Helper for dump_gimple_assign. Print the ternary RHS of the
502 assignment GS. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. */
505 dump_ternary_rhs (pretty_printer
*buffer
, const gassign
*gs
, int spc
,
509 enum tree_code code
= gimple_assign_rhs_code (gs
);
512 case WIDEN_MULT_PLUS_EXPR
:
513 case WIDEN_MULT_MINUS_EXPR
:
514 for (p
= get_tree_code_name (code
); *p
; p
++)
515 pp_character (buffer
, TOUPPER (*p
));
516 pp_string (buffer
, " <");
517 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
518 pp_string (buffer
, ", ");
519 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
520 pp_string (buffer
, ", ");
521 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
526 pp_string (buffer
, "DOT_PROD_EXPR <");
527 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
528 pp_string (buffer
, ", ");
529 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
530 pp_string (buffer
, ", ");
531 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
536 pp_string (buffer
, "SAD_EXPR <");
537 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
538 pp_string (buffer
, ", ");
539 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
540 pp_string (buffer
, ", ");
541 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
546 if (flags
& TDF_GIMPLE
)
547 pp_string (buffer
, "__VEC_PERM (");
549 pp_string (buffer
, "VEC_PERM_EXPR <");
550 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
551 pp_string (buffer
, ", ");
552 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
553 pp_string (buffer
, ", ");
554 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
555 if (flags
& TDF_GIMPLE
)
556 pp_right_paren (buffer
);
561 case REALIGN_LOAD_EXPR
:
562 pp_string (buffer
, "REALIGN_LOAD <");
563 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
564 pp_string (buffer
, ", ");
565 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
566 pp_string (buffer
, ", ");
567 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
572 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
573 pp_string (buffer
, " ? ");
574 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
575 pp_string (buffer
, " : ");
576 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
580 pp_string (buffer
, "VEC_COND_EXPR <");
581 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
582 pp_string (buffer
, ", ");
583 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
584 pp_string (buffer
, ", ");
585 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
589 case BIT_INSERT_EXPR
:
590 if (flags
& TDF_GIMPLE
)
592 pp_string (buffer
, "__BIT_INSERT (");
593 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
,
594 flags
| TDF_SLIM
, false);
595 pp_string (buffer
, ", ");
596 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
,
597 flags
| TDF_SLIM
, false);
598 pp_string (buffer
, ", ");
599 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
,
600 flags
| TDF_SLIM
, false);
601 pp_right_paren (buffer
);
605 pp_string (buffer
, "BIT_INSERT_EXPR <");
606 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
),
608 pp_string (buffer
, ", ");
609 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
),
611 pp_string (buffer
, ", ");
612 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
),
614 if (INTEGRAL_TYPE_P (TREE_TYPE (gimple_assign_rhs2 (gs
))))
616 pp_string (buffer
, " (");
617 pp_decimal_int (buffer
, TYPE_PRECISION
618 (TREE_TYPE (gimple_assign_rhs2 (gs
))));
619 pp_string (buffer
, " bits)");
631 /* Dump the gimple assignment GS. BUFFER, SPC and FLAGS are as in
635 dump_gimple_assign (pretty_printer
*buffer
, const gassign
*gs
, int spc
,
643 switch (gimple_num_ops (gs
))
646 arg3
= gimple_assign_rhs3 (gs
);
649 arg2
= gimple_assign_rhs2 (gs
);
652 arg1
= gimple_assign_rhs1 (gs
);
658 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%s, %T, %T, %T, %T>", gs
,
659 get_tree_code_name (gimple_assign_rhs_code (gs
)),
660 gimple_assign_lhs (gs
), arg1
, arg2
, arg3
);
664 if (!(flags
& TDF_RHS_ONLY
))
666 dump_generic_node (buffer
, gimple_assign_lhs (gs
), spc
, flags
, false);
670 if (gimple_assign_nontemporal_move_p (gs
))
671 pp_string (buffer
, "{nt}");
673 if (gimple_has_volatile_ops (gs
))
674 pp_string (buffer
, "{v}");
679 if (gimple_num_ops (gs
) == 2)
680 dump_unary_rhs (buffer
, gs
, spc
, flags
);
681 else if (gimple_num_ops (gs
) == 3)
682 dump_binary_rhs (buffer
, gs
, spc
, flags
);
683 else if (gimple_num_ops (gs
) == 4)
684 dump_ternary_rhs (buffer
, gs
, spc
, flags
);
687 if (!(flags
& TDF_RHS_ONLY
))
688 pp_semicolon (buffer
);
693 /* Dump the return statement GS. BUFFER, SPC and FLAGS are as in
697 dump_gimple_return (pretty_printer
*buffer
, const greturn
*gs
, int spc
,
702 t
= gimple_return_retval (gs
);
704 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
, t
);
707 pp_string (buffer
, "return");
711 dump_generic_node (buffer
, t
, spc
, flags
, false);
713 pp_semicolon (buffer
);
718 /* Dump the call arguments for a gimple call. BUFFER, FLAGS are as in
722 dump_gimple_call_args (pretty_printer
*buffer
, const gcall
*gs
,
727 /* Pretty print first arg to certain internal fns. */
728 if (gimple_call_internal_p (gs
))
730 const char *const *enums
= NULL
;
733 switch (gimple_call_internal_fn (gs
))
737 static const char *const unique_args
[] = {IFN_UNIQUE_CODES
};
741 limit
= ARRAY_SIZE (unique_args
);
746 static const char *const loop_args
[] = {IFN_GOACC_LOOP_CODES
};
749 limit
= ARRAY_SIZE (loop_args
);
752 case IFN_GOACC_REDUCTION
:
754 static const char *const reduction_args
[]
755 = {IFN_GOACC_REDUCTION_CODES
};
757 enums
= reduction_args
;
758 limit
= ARRAY_SIZE (reduction_args
);
761 case IFN_HWASAN_MARK
:
764 static const char *const asan_mark_args
[] = {IFN_ASAN_MARK_FLAGS
};
766 enums
= asan_mark_args
;
767 limit
= ARRAY_SIZE (asan_mark_args
);
775 tree arg0
= gimple_call_arg (gs
, 0);
778 if (TREE_CODE (arg0
) == INTEGER_CST
779 && tree_fits_shwi_p (arg0
)
780 && (v
= tree_to_shwi (arg0
)) >= 0 && v
< limit
)
783 pp_string (buffer
, enums
[v
]);
788 for (; i
< gimple_call_num_args (gs
); i
++)
791 pp_string (buffer
, ", ");
792 dump_generic_node (buffer
, gimple_call_arg (gs
, i
), 0, flags
, false);
795 if (gimple_call_va_arg_pack_p (gs
))
798 pp_string (buffer
, ", ");
800 pp_string (buffer
, "__builtin_va_arg_pack ()");
804 /* Dump the points-to solution *PT to BUFFER. */
807 pp_points_to_solution (pretty_printer
*buffer
, const pt_solution
*pt
)
811 pp_string (buffer
, "anything ");
815 pp_string (buffer
, "nonlocal ");
817 pp_string (buffer
, "escaped ");
819 pp_string (buffer
, "unit-escaped ");
821 pp_string (buffer
, "null ");
823 && !bitmap_empty_p (pt
->vars
))
827 pp_string (buffer
, "{ ");
828 EXECUTE_IF_SET_IN_BITMAP (pt
->vars
, 0, i
, bi
)
830 pp_string (buffer
, "D.");
831 pp_decimal_int (buffer
, i
);
834 pp_right_brace (buffer
);
835 if (pt
->vars_contains_nonlocal
836 || pt
->vars_contains_escaped
837 || pt
->vars_contains_escaped_heap
838 || pt
->vars_contains_restrict
)
840 const char *comma
= "";
841 pp_string (buffer
, " (");
842 if (pt
->vars_contains_nonlocal
)
844 pp_string (buffer
, "nonlocal");
847 if (pt
->vars_contains_escaped
)
849 pp_string (buffer
, comma
);
850 pp_string (buffer
, "escaped");
853 if (pt
->vars_contains_escaped_heap
)
855 pp_string (buffer
, comma
);
856 pp_string (buffer
, "escaped heap");
859 if (pt
->vars_contains_restrict
)
861 pp_string (buffer
, comma
);
862 pp_string (buffer
, "restrict");
865 if (pt
->vars_contains_interposable
)
867 pp_string (buffer
, comma
);
868 pp_string (buffer
, "interposable");
870 pp_string (buffer
, ")");
876 /* Dump the call statement GS. BUFFER, SPC and FLAGS are as in
880 dump_gimple_call (pretty_printer
*buffer
, const gcall
*gs
, int spc
,
883 tree lhs
= gimple_call_lhs (gs
);
884 tree fn
= gimple_call_fn (gs
);
886 if (flags
& TDF_ALIAS
)
888 const pt_solution
*pt
;
889 pt
= gimple_call_use_set (gs
);
890 if (!pt_solution_empty_p (pt
))
892 pp_string (buffer
, "# USE = ");
893 pp_points_to_solution (buffer
, pt
);
894 newline_and_indent (buffer
, spc
);
896 pt
= gimple_call_clobber_set (gs
);
897 if (!pt_solution_empty_p (pt
))
899 pp_string (buffer
, "# CLB = ");
900 pp_points_to_solution (buffer
, pt
);
901 newline_and_indent (buffer
, spc
);
907 if (gimple_call_internal_p (gs
))
908 dump_gimple_fmt (buffer
, spc
, flags
, "%G <.%s, %T", gs
,
909 internal_fn_name (gimple_call_internal_fn (gs
)), lhs
);
911 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T", gs
, fn
, lhs
);
912 if (gimple_call_num_args (gs
) > 0)
914 pp_string (buffer
, ", ");
915 dump_gimple_call_args (buffer
, gs
, flags
);
921 if (lhs
&& !(flags
& TDF_RHS_ONLY
))
923 dump_generic_node (buffer
, lhs
, spc
, flags
, false);
924 pp_string (buffer
, " =");
926 if (gimple_has_volatile_ops (gs
))
927 pp_string (buffer
, "{v}");
931 if (gimple_call_internal_p (gs
))
934 pp_string (buffer
, internal_fn_name (gimple_call_internal_fn (gs
)));
937 print_call_name (buffer
, fn
, flags
);
938 pp_string (buffer
, " (");
939 dump_gimple_call_args (buffer
, gs
, flags
);
940 pp_right_paren (buffer
);
941 if (!(flags
& TDF_RHS_ONLY
))
942 pp_semicolon (buffer
);
945 if (gimple_call_chain (gs
))
947 pp_string (buffer
, " [static-chain: ");
948 dump_generic_node (buffer
, gimple_call_chain (gs
), spc
, flags
, false);
949 pp_right_bracket (buffer
);
952 if (gimple_call_return_slot_opt_p (gs
))
953 pp_string (buffer
, " [return slot optimization]");
954 if (gimple_call_tail_p (gs
))
955 pp_string (buffer
, " [tail call]");
956 if (gimple_call_must_tail_p (gs
))
957 pp_string (buffer
, " [must tail call]");
962 /* Dump the arguments of _ITM_beginTransaction sanely. */
963 if (TREE_CODE (fn
) == ADDR_EXPR
)
964 fn
= TREE_OPERAND (fn
, 0);
965 if (TREE_CODE (fn
) == FUNCTION_DECL
&& decl_is_tm_clone (fn
))
966 pp_string (buffer
, " [tm-clone]");
967 if (TREE_CODE (fn
) == FUNCTION_DECL
968 && fndecl_built_in_p (fn
, BUILT_IN_TM_START
)
969 && gimple_call_num_args (gs
) > 0)
971 tree t
= gimple_call_arg (gs
, 0);
972 unsigned HOST_WIDE_INT props
;
973 gcc_assert (TREE_CODE (t
) == INTEGER_CST
);
975 pp_string (buffer
, " [ ");
977 /* Get the transaction code properties. */
978 props
= TREE_INT_CST_LOW (t
);
980 if (props
& PR_INSTRUMENTEDCODE
)
981 pp_string (buffer
, "instrumentedCode ");
982 if (props
& PR_UNINSTRUMENTEDCODE
)
983 pp_string (buffer
, "uninstrumentedCode ");
984 if (props
& PR_HASNOXMMUPDATE
)
985 pp_string (buffer
, "hasNoXMMUpdate ");
986 if (props
& PR_HASNOABORT
)
987 pp_string (buffer
, "hasNoAbort ");
988 if (props
& PR_HASNOIRREVOCABLE
)
989 pp_string (buffer
, "hasNoIrrevocable ");
990 if (props
& PR_DOESGOIRREVOCABLE
)
991 pp_string (buffer
, "doesGoIrrevocable ");
992 if (props
& PR_HASNOSIMPLEREADS
)
993 pp_string (buffer
, "hasNoSimpleReads ");
994 if (props
& PR_AWBARRIERSOMITTED
)
995 pp_string (buffer
, "awBarriersOmitted ");
996 if (props
& PR_RARBARRIERSOMITTED
)
997 pp_string (buffer
, "RaRBarriersOmitted ");
998 if (props
& PR_UNDOLOGCODE
)
999 pp_string (buffer
, "undoLogCode ");
1000 if (props
& PR_PREFERUNINSTRUMENTED
)
1001 pp_string (buffer
, "preferUninstrumented ");
1002 if (props
& PR_EXCEPTIONBLOCK
)
1003 pp_string (buffer
, "exceptionBlock ");
1004 if (props
& PR_HASELSE
)
1005 pp_string (buffer
, "hasElse ");
1006 if (props
& PR_READONLY
)
1007 pp_string (buffer
, "readOnly ");
1009 pp_right_bracket (buffer
);
1014 /* Dump the switch statement GS. BUFFER, SPC and FLAGS are as in
1015 pp_gimple_stmt_1. */
1018 dump_gimple_switch (pretty_printer
*buffer
, const gswitch
*gs
, int spc
,
1023 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
1024 if (flags
& TDF_RAW
)
1025 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, ", gs
,
1026 gimple_switch_index (gs
));
1029 pp_string (buffer
, "switch (");
1030 dump_generic_node (buffer
, gimple_switch_index (gs
), spc
, flags
, true);
1031 if (flags
& TDF_GIMPLE
)
1032 pp_string (buffer
, ") {");
1034 pp_string (buffer
, ") <");
1037 for (i
= 0; i
< gimple_switch_num_labels (gs
); i
++)
1039 tree case_label
= gimple_switch_label (gs
, i
);
1040 gcc_checking_assert (case_label
!= NULL_TREE
);
1041 dump_generic_node (buffer
, case_label
, spc
, flags
, false);
1043 tree label
= CASE_LABEL (case_label
);
1044 dump_generic_node (buffer
, label
, spc
, flags
, false);
1046 if (cfun
&& cfun
->cfg
)
1048 basic_block dest
= label_to_block (cfun
, label
);
1051 edge label_edge
= find_edge (gimple_bb (gs
), dest
);
1052 if (label_edge
&& !(flags
& TDF_GIMPLE
))
1053 dump_edge_probability (buffer
, label_edge
);
1057 if (i
< gimple_switch_num_labels (gs
) - 1)
1059 if (flags
& TDF_GIMPLE
)
1060 pp_string (buffer
, "; ");
1062 pp_string (buffer
, ", ");
1065 if (flags
& TDF_GIMPLE
)
1066 pp_string (buffer
, "; }");
1068 pp_greater (buffer
);
1072 /* Dump the gimple conditional GS. BUFFER, SPC and FLAGS are as in
1073 pp_gimple_stmt_1. */
1076 dump_gimple_cond (pretty_printer
*buffer
, const gcond
*gs
, int spc
,
1079 if (flags
& TDF_RAW
)
1080 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%s, %T, %T, %T, %T>", gs
,
1081 get_tree_code_name (gimple_cond_code (gs
)),
1082 gimple_cond_lhs (gs
), gimple_cond_rhs (gs
),
1083 gimple_cond_true_label (gs
), gimple_cond_false_label (gs
));
1086 if (!(flags
& TDF_RHS_ONLY
))
1087 pp_string (buffer
, "if (");
1088 dump_generic_node (buffer
, gimple_cond_lhs (gs
), spc
, flags
, false);
1090 pp_string (buffer
, op_symbol_code (gimple_cond_code (gs
)));
1092 dump_generic_node (buffer
, gimple_cond_rhs (gs
), spc
, flags
, false);
1093 if (!(flags
& TDF_RHS_ONLY
))
1096 edge e
, true_edge
= NULL
, false_edge
= NULL
;
1097 basic_block bb
= gimple_bb (gs
);
1101 FOR_EACH_EDGE (e
, ei
, bb
->succs
)
1103 if (e
->flags
& EDGE_TRUE_VALUE
)
1105 else if (e
->flags
& EDGE_FALSE_VALUE
)
1110 bool has_edge_info
= true_edge
!= NULL
&& false_edge
!= NULL
;
1112 pp_right_paren (buffer
);
1114 if (gimple_cond_true_label (gs
))
1116 pp_string (buffer
, " goto ");
1117 dump_generic_node (buffer
, gimple_cond_true_label (gs
),
1119 if (has_edge_info
&& !(flags
& TDF_GIMPLE
))
1120 dump_edge_probability (buffer
, true_edge
);
1121 pp_semicolon (buffer
);
1123 if (gimple_cond_false_label (gs
))
1125 pp_string (buffer
, " else goto ");
1126 dump_generic_node (buffer
, gimple_cond_false_label (gs
),
1128 if (has_edge_info
&& !(flags
& TDF_GIMPLE
))
1129 dump_edge_probability (buffer
, false_edge
);
1131 pp_semicolon (buffer
);
1138 /* Dump a GIMPLE_LABEL tuple on the pretty_printer BUFFER, SPC
1139 spaces of indent. FLAGS specifies details to show in the dump (see
1140 TDF_* in dumpfils.h). */
1143 dump_gimple_label (pretty_printer
*buffer
, const glabel
*gs
, int spc
,
1146 tree label
= gimple_label_label (gs
);
1147 if (flags
& TDF_RAW
)
1148 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
, label
);
1151 dump_generic_node (buffer
, label
, spc
, flags
, false);
1154 if (flags
& TDF_GIMPLE
)
1156 if (DECL_NONLOCAL (label
))
1157 pp_string (buffer
, " [non-local]");
1158 if ((flags
& TDF_EH
) && EH_LANDING_PAD_NR (label
))
1159 pp_printf (buffer
, " [LP %d]", EH_LANDING_PAD_NR (label
));
1162 /* Dump a GIMPLE_GOTO tuple on the pretty_printer BUFFER, SPC
1163 spaces of indent. FLAGS specifies details to show in the dump (see
1164 TDF_* in dumpfile.h). */
1167 dump_gimple_goto (pretty_printer
*buffer
, const ggoto
*gs
, int spc
,
1170 tree label
= gimple_goto_dest (gs
);
1171 if (flags
& TDF_RAW
)
1172 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
, label
);
1174 dump_gimple_fmt (buffer
, spc
, flags
, "goto %T;", label
);
1178 /* Dump a GIMPLE_BIND tuple on the pretty_printer BUFFER, SPC
1179 spaces of indent. FLAGS specifies details to show in the dump (see
1180 TDF_* in dumpfile.h). */
1183 dump_gimple_bind (pretty_printer
*buffer
, const gbind
*gs
, int spc
,
1186 if (flags
& TDF_RAW
)
1187 dump_gimple_fmt (buffer
, spc
, flags
, "%G <", gs
);
1189 pp_left_brace (buffer
);
1190 if (!(flags
& TDF_SLIM
))
1194 for (var
= gimple_bind_vars (gs
); var
; var
= DECL_CHAIN (var
))
1196 newline_and_indent (buffer
, 2);
1197 print_declaration (buffer
, var
, spc
, flags
);
1199 if (gimple_bind_vars (gs
))
1200 pp_newline (buffer
);
1202 pp_newline (buffer
);
1203 dump_gimple_seq (buffer
, gimple_bind_body (gs
), spc
+ 2, flags
);
1204 newline_and_indent (buffer
, spc
);
1205 if (flags
& TDF_RAW
)
1206 pp_greater (buffer
);
1208 pp_right_brace (buffer
);
1212 /* Dump a GIMPLE_TRY tuple on the pretty_printer BUFFER, SPC spaces of
1213 indent. FLAGS specifies details to show in the dump (see TDF_* in
1217 dump_gimple_try (pretty_printer
*buffer
, const gtry
*gs
, int spc
,
1220 if (flags
& TDF_RAW
)
1223 if (gimple_try_kind (gs
) == GIMPLE_TRY_CATCH
)
1224 type
= "GIMPLE_TRY_CATCH";
1225 else if (gimple_try_kind (gs
) == GIMPLE_TRY_FINALLY
)
1226 type
= "GIMPLE_TRY_FINALLY";
1228 type
= "UNKNOWN GIMPLE_TRY";
1229 dump_gimple_fmt (buffer
, spc
, flags
,
1230 "%G <%s,%+EVAL <%S>%nCLEANUP <%S>%->", gs
, type
,
1231 gimple_try_eval (gs
), gimple_try_cleanup (gs
));
1235 pp_string (buffer
, "try");
1236 newline_and_indent (buffer
, spc
+ 2);
1237 pp_left_brace (buffer
);
1238 pp_newline (buffer
);
1240 dump_gimple_seq (buffer
, gimple_try_eval (gs
), spc
+ 4, flags
);
1241 newline_and_indent (buffer
, spc
+ 2);
1242 pp_right_brace (buffer
);
1244 gimple_seq seq
= gimple_try_cleanup (gs
);
1246 if (gimple_try_kind (gs
) == GIMPLE_TRY_CATCH
)
1248 newline_and_indent (buffer
, spc
);
1249 pp_string (buffer
, "catch");
1250 newline_and_indent (buffer
, spc
+ 2);
1251 pp_left_brace (buffer
);
1253 else if (gimple_try_kind (gs
) == GIMPLE_TRY_FINALLY
)
1255 newline_and_indent (buffer
, spc
);
1256 pp_string (buffer
, "finally");
1257 newline_and_indent (buffer
, spc
+ 2);
1258 pp_left_brace (buffer
);
1260 if (seq
&& is_a
<geh_else
*> (gimple_seq_first_stmt (seq
))
1261 && gimple_seq_nondebug_singleton_p (seq
))
1263 geh_else
*stmt
= as_a
<geh_else
*> (gimple_seq_first_stmt (seq
));
1264 seq
= gimple_eh_else_n_body (stmt
);
1265 pp_newline (buffer
);
1266 dump_gimple_seq (buffer
, seq
, spc
+ 4, flags
);
1267 newline_and_indent (buffer
, spc
+ 2);
1268 pp_right_brace (buffer
);
1269 seq
= gimple_eh_else_e_body (stmt
);
1270 newline_and_indent (buffer
, spc
);
1271 pp_string (buffer
, "else");
1272 newline_and_indent (buffer
, spc
+ 2);
1273 pp_left_brace (buffer
);
1277 pp_string (buffer
, " <UNKNOWN GIMPLE_TRY> {");
1279 pp_newline (buffer
);
1280 dump_gimple_seq (buffer
, seq
, spc
+ 4, flags
);
1281 newline_and_indent (buffer
, spc
+ 2);
1282 pp_right_brace (buffer
);
1287 /* Dump a GIMPLE_CATCH tuple on the pretty_printer BUFFER, SPC spaces of
1288 indent. FLAGS specifies details to show in the dump (see TDF_* in
1292 dump_gimple_catch (pretty_printer
*buffer
, const gcatch
*gs
, int spc
,
1295 if (flags
& TDF_RAW
)
1296 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %+CATCH <%S>%->", gs
,
1297 gimple_catch_types (gs
), gimple_catch_handler (gs
));
1299 dump_gimple_fmt (buffer
, spc
, flags
, "catch (%T)%+{%S}",
1300 gimple_catch_types (gs
), gimple_catch_handler (gs
));
1304 /* Dump a GIMPLE_EH_FILTER tuple on the pretty_printer BUFFER, SPC spaces of
1305 indent. FLAGS specifies details to show in the dump (see TDF_* in
1309 dump_gimple_eh_filter (pretty_printer
*buffer
, const geh_filter
*gs
, int spc
,
1312 if (flags
& TDF_RAW
)
1313 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %+FAILURE <%S>%->", gs
,
1314 gimple_eh_filter_types (gs
),
1315 gimple_eh_filter_failure (gs
));
1317 dump_gimple_fmt (buffer
, spc
, flags
, "<<<eh_filter (%T)>>>%+{%+%S%-}",
1318 gimple_eh_filter_types (gs
),
1319 gimple_eh_filter_failure (gs
));
1323 /* Dump a GIMPLE_EH_MUST_NOT_THROW tuple. */
1326 dump_gimple_eh_must_not_throw (pretty_printer
*buffer
,
1327 const geh_mnt
*gs
, int spc
, dump_flags_t flags
)
1329 if (flags
& TDF_RAW
)
1330 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
,
1331 gimple_eh_must_not_throw_fndecl (gs
));
1333 dump_gimple_fmt (buffer
, spc
, flags
, "<<<eh_must_not_throw (%T)>>>",
1334 gimple_eh_must_not_throw_fndecl (gs
));
1338 /* Dump a GIMPLE_EH_ELSE tuple on the pretty_printer BUFFER, SPC spaces of
1339 indent. FLAGS specifies details to show in the dump (see TDF_* in
1343 dump_gimple_eh_else (pretty_printer
*buffer
, const geh_else
*gs
, int spc
,
1346 if (flags
& TDF_RAW
)
1347 dump_gimple_fmt (buffer
, spc
, flags
,
1348 "%G <%+N_BODY <%S>%nE_BODY <%S>%->", gs
,
1349 gimple_eh_else_n_body (gs
), gimple_eh_else_e_body (gs
));
1351 dump_gimple_fmt (buffer
, spc
, flags
,
1352 "<<<if_normal_exit>>>%+{%S}%-<<<else_eh_exit>>>%+{%S}",
1353 gimple_eh_else_n_body (gs
), gimple_eh_else_e_body (gs
));
1357 /* Dump a GIMPLE_RESX tuple on the pretty_printer BUFFER, SPC spaces of
1358 indent. FLAGS specifies details to show in the dump (see TDF_* in
1362 dump_gimple_resx (pretty_printer
*buffer
, const gresx
*gs
, int spc
,
1365 if (flags
& TDF_RAW
)
1366 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%d>", gs
,
1367 gimple_resx_region (gs
));
1369 dump_gimple_fmt (buffer
, spc
, flags
, "resx %d", gimple_resx_region (gs
));
1372 /* Dump a GIMPLE_EH_DISPATCH tuple on the pretty_printer BUFFER. */
1375 dump_gimple_eh_dispatch (pretty_printer
*buffer
, const geh_dispatch
*gs
,
1376 int spc
, dump_flags_t flags
)
1378 if (flags
& TDF_RAW
)
1379 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%d>", gs
,
1380 gimple_eh_dispatch_region (gs
));
1382 dump_gimple_fmt (buffer
, spc
, flags
, "eh_dispatch %d",
1383 gimple_eh_dispatch_region (gs
));
1386 /* Dump a GIMPLE_DEBUG tuple on the pretty_printer BUFFER, SPC spaces
1387 of indent. FLAGS specifies details to show in the dump (see TDF_*
1391 dump_gimple_debug (pretty_printer
*buffer
, const gdebug
*gs
, int spc
,
1394 switch (gs
->subcode
)
1396 case GIMPLE_DEBUG_BIND
:
1397 if (flags
& TDF_RAW
)
1398 dump_gimple_fmt (buffer
, spc
, flags
, "%G BIND <%T, %T>", gs
,
1399 gimple_debug_bind_get_var (gs
),
1400 gimple_debug_bind_get_value (gs
));
1402 dump_gimple_fmt (buffer
, spc
, flags
, "# DEBUG %T => %T",
1403 gimple_debug_bind_get_var (gs
),
1404 gimple_debug_bind_get_value (gs
));
1407 case GIMPLE_DEBUG_SOURCE_BIND
:
1408 if (flags
& TDF_RAW
)
1409 dump_gimple_fmt (buffer
, spc
, flags
, "%G SRCBIND <%T, %T>", gs
,
1410 gimple_debug_source_bind_get_var (gs
),
1411 gimple_debug_source_bind_get_value (gs
));
1413 dump_gimple_fmt (buffer
, spc
, flags
, "# DEBUG %T s=> %T",
1414 gimple_debug_source_bind_get_var (gs
),
1415 gimple_debug_source_bind_get_value (gs
));
1418 case GIMPLE_DEBUG_BEGIN_STMT
:
1419 if (flags
& TDF_RAW
)
1420 dump_gimple_fmt (buffer
, spc
, flags
, "%G BEGIN_STMT", gs
);
1422 dump_gimple_fmt (buffer
, spc
, flags
, "# DEBUG BEGIN_STMT");
1425 case GIMPLE_DEBUG_INLINE_ENTRY
:
1426 if (flags
& TDF_RAW
)
1427 dump_gimple_fmt (buffer
, spc
, flags
, "%G INLINE_ENTRY %T", gs
,
1429 ? block_ultimate_origin (gimple_block (gs
))
1432 dump_gimple_fmt (buffer
, spc
, flags
, "# DEBUG INLINE_ENTRY %T",
1434 ? block_ultimate_origin (gimple_block (gs
))
1443 /* Dump a GIMPLE_OMP_FOR tuple on the pretty_printer BUFFER. */
1445 dump_gimple_omp_for (pretty_printer
*buffer
, const gomp_for
*gs
, int spc
,
1450 if (flags
& TDF_RAW
)
1453 switch (gimple_omp_for_kind (gs
))
1455 case GF_OMP_FOR_KIND_FOR
:
1458 case GF_OMP_FOR_KIND_DISTRIBUTE
:
1459 kind
= " distribute";
1461 case GF_OMP_FOR_KIND_TASKLOOP
:
1464 case GF_OMP_FOR_KIND_OACC_LOOP
:
1465 kind
= " oacc_loop";
1467 case GF_OMP_FOR_KIND_SIMD
:
1473 dump_gimple_fmt (buffer
, spc
, flags
, "%G%s <%+BODY <%S>%nCLAUSES <", gs
,
1474 kind
, gimple_omp_body (gs
));
1475 dump_omp_clauses (buffer
, gimple_omp_for_clauses (gs
), spc
, flags
);
1476 dump_gimple_fmt (buffer
, spc
, flags
, " >,");
1477 for (i
= 0; i
< gimple_omp_for_collapse (gs
); i
++)
1478 dump_gimple_fmt (buffer
, spc
, flags
,
1479 "%+%T, %T, %T, %s, %T,%n",
1480 gimple_omp_for_index (gs
, i
),
1481 gimple_omp_for_initial (gs
, i
),
1482 gimple_omp_for_final (gs
, i
),
1483 get_tree_code_name (gimple_omp_for_cond (gs
, i
)),
1484 gimple_omp_for_incr (gs
, i
));
1485 dump_gimple_fmt (buffer
, spc
, flags
, "PRE_BODY <%S>%->",
1486 gimple_omp_for_pre_body (gs
));
1490 switch (gimple_omp_for_kind (gs
))
1492 case GF_OMP_FOR_KIND_FOR
:
1493 pp_string (buffer
, "#pragma omp for");
1495 case GF_OMP_FOR_KIND_DISTRIBUTE
:
1496 pp_string (buffer
, "#pragma omp distribute");
1498 case GF_OMP_FOR_KIND_TASKLOOP
:
1499 pp_string (buffer
, "#pragma omp taskloop");
1501 case GF_OMP_FOR_KIND_OACC_LOOP
:
1502 pp_string (buffer
, "#pragma acc loop");
1504 case GF_OMP_FOR_KIND_SIMD
:
1505 pp_string (buffer
, "#pragma omp simd");
1510 dump_omp_clauses (buffer
, gimple_omp_for_clauses (gs
), spc
, flags
);
1511 for (i
= 0; i
< gimple_omp_for_collapse (gs
); i
++)
1515 newline_and_indent (buffer
, spc
);
1516 pp_string (buffer
, "for (");
1517 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
1519 pp_string (buffer
, " = ");
1520 tree init
= gimple_omp_for_initial (gs
, i
);
1521 if (TREE_CODE (init
) != TREE_VEC
)
1522 dump_generic_node (buffer
, init
, spc
, flags
, false);
1524 dump_omp_loop_non_rect_expr (buffer
, init
, spc
, flags
);
1525 pp_string (buffer
, "; ");
1527 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
1530 switch (gimple_omp_for_cond (gs
, i
))
1536 pp_greater (buffer
);
1539 pp_less_equal (buffer
);
1542 pp_greater_equal (buffer
);
1545 pp_string (buffer
, "!=");
1551 tree cond
= gimple_omp_for_final (gs
, i
);
1552 if (TREE_CODE (cond
) != TREE_VEC
)
1553 dump_generic_node (buffer
, cond
, spc
, flags
, false);
1555 dump_omp_loop_non_rect_expr (buffer
, cond
, spc
, flags
);
1556 pp_string (buffer
, "; ");
1558 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
1560 pp_string (buffer
, " = ");
1561 dump_generic_node (buffer
, gimple_omp_for_incr (gs
, i
), spc
,
1563 pp_right_paren (buffer
);
1566 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1568 newline_and_indent (buffer
, spc
+ 2);
1569 pp_left_brace (buffer
);
1570 pp_newline (buffer
);
1571 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1572 newline_and_indent (buffer
, spc
+ 2);
1573 pp_right_brace (buffer
);
1578 /* Dump a GIMPLE_OMP_CONTINUE tuple on the pretty_printer BUFFER. */
1581 dump_gimple_omp_continue (pretty_printer
*buffer
, const gomp_continue
*gs
,
1582 int spc
, dump_flags_t flags
)
1584 if (flags
& TDF_RAW
)
1586 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T>", gs
,
1587 gimple_omp_continue_control_def (gs
),
1588 gimple_omp_continue_control_use (gs
));
1592 pp_string (buffer
, "#pragma omp continue (");
1593 dump_generic_node (buffer
, gimple_omp_continue_control_def (gs
),
1597 dump_generic_node (buffer
, gimple_omp_continue_control_use (gs
),
1599 pp_right_paren (buffer
);
1603 /* Dump a GIMPLE_OMP_SINGLE tuple on the pretty_printer BUFFER. */
1606 dump_gimple_omp_single (pretty_printer
*buffer
, const gomp_single
*gs
,
1607 int spc
, dump_flags_t flags
)
1609 if (flags
& TDF_RAW
)
1611 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1612 gimple_omp_body (gs
));
1613 dump_omp_clauses (buffer
, gimple_omp_single_clauses (gs
), spc
, flags
);
1614 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1618 pp_string (buffer
, "#pragma omp single");
1619 dump_omp_clauses (buffer
, gimple_omp_single_clauses (gs
), spc
, flags
);
1620 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1622 newline_and_indent (buffer
, spc
+ 2);
1623 pp_left_brace (buffer
);
1624 pp_newline (buffer
);
1625 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1626 newline_and_indent (buffer
, spc
+ 2);
1627 pp_right_brace (buffer
);
1632 /* Dump a GIMPLE_OMP_TASKGROUP tuple on the pretty_printer BUFFER. */
1635 dump_gimple_omp_taskgroup (pretty_printer
*buffer
, const gimple
*gs
,
1636 int spc
, dump_flags_t flags
)
1638 if (flags
& TDF_RAW
)
1640 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1641 gimple_omp_body (gs
));
1642 dump_omp_clauses (buffer
, gimple_omp_taskgroup_clauses (gs
), spc
, flags
);
1643 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1647 pp_string (buffer
, "#pragma omp taskgroup");
1648 dump_omp_clauses (buffer
, gimple_omp_taskgroup_clauses (gs
), spc
, flags
);
1649 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1651 newline_and_indent (buffer
, spc
+ 2);
1652 pp_left_brace (buffer
);
1653 pp_newline (buffer
);
1654 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1655 newline_and_indent (buffer
, spc
+ 2);
1656 pp_right_brace (buffer
);
1661 /* Dump a GIMPLE_OMP_TARGET tuple on the pretty_printer BUFFER. */
1664 dump_gimple_omp_target (pretty_printer
*buffer
, const gomp_target
*gs
,
1665 int spc
, dump_flags_t flags
)
1668 switch (gimple_omp_target_kind (gs
))
1670 case GF_OMP_TARGET_KIND_REGION
:
1673 case GF_OMP_TARGET_KIND_DATA
:
1676 case GF_OMP_TARGET_KIND_UPDATE
:
1679 case GF_OMP_TARGET_KIND_ENTER_DATA
:
1680 kind
= " enter data";
1682 case GF_OMP_TARGET_KIND_EXIT_DATA
:
1683 kind
= " exit data";
1685 case GF_OMP_TARGET_KIND_OACC_KERNELS
:
1686 kind
= " oacc_kernels";
1688 case GF_OMP_TARGET_KIND_OACC_PARALLEL
:
1689 kind
= " oacc_parallel";
1691 case GF_OMP_TARGET_KIND_OACC_SERIAL
:
1692 kind
= " oacc_serial";
1694 case GF_OMP_TARGET_KIND_OACC_DATA
:
1695 kind
= " oacc_data";
1697 case GF_OMP_TARGET_KIND_OACC_UPDATE
:
1698 kind
= " oacc_update";
1700 case GF_OMP_TARGET_KIND_OACC_ENTER_DATA
:
1701 kind
= " oacc_enter_data";
1703 case GF_OMP_TARGET_KIND_OACC_EXIT_DATA
:
1704 kind
= " oacc_exit_data";
1706 case GF_OMP_TARGET_KIND_OACC_DECLARE
:
1707 kind
= " oacc_declare";
1709 case GF_OMP_TARGET_KIND_OACC_HOST_DATA
:
1710 kind
= " oacc_host_data";
1712 case GF_OMP_TARGET_KIND_OACC_PARALLEL_KERNELS_PARALLELIZED
:
1713 kind
= " oacc_parallel_kernels_parallelized";
1715 case GF_OMP_TARGET_KIND_OACC_PARALLEL_KERNELS_GANG_SINGLE
:
1716 kind
= " oacc_parallel_kernels_gang_single";
1718 case GF_OMP_TARGET_KIND_OACC_DATA_KERNELS
:
1719 kind
= " oacc_data_kernels";
1724 if (flags
& TDF_RAW
)
1726 dump_gimple_fmt (buffer
, spc
, flags
, "%G%s <%+BODY <%S>%nCLAUSES <", gs
,
1727 kind
, gimple_omp_body (gs
));
1728 dump_omp_clauses (buffer
, gimple_omp_target_clauses (gs
), spc
, flags
);
1729 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T%n>",
1730 gimple_omp_target_child_fn (gs
),
1731 gimple_omp_target_data_arg (gs
));
1735 pp_string (buffer
, "#pragma omp target");
1736 pp_string (buffer
, kind
);
1737 dump_omp_clauses (buffer
, gimple_omp_target_clauses (gs
), spc
, flags
);
1738 if (gimple_omp_target_child_fn (gs
))
1740 pp_string (buffer
, " [child fn: ");
1741 dump_generic_node (buffer
, gimple_omp_target_child_fn (gs
),
1743 pp_string (buffer
, " (");
1744 if (gimple_omp_target_data_arg (gs
))
1745 dump_generic_node (buffer
, gimple_omp_target_data_arg (gs
),
1748 pp_string (buffer
, "???");
1749 pp_string (buffer
, ")]");
1751 gimple_seq body
= gimple_omp_body (gs
);
1752 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
1754 newline_and_indent (buffer
, spc
+ 2);
1755 pp_left_brace (buffer
);
1756 pp_newline (buffer
);
1757 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
1758 newline_and_indent (buffer
, spc
+ 2);
1759 pp_right_brace (buffer
);
1763 pp_newline (buffer
);
1764 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
1769 /* Dump a GIMPLE_OMP_TEAMS tuple on the pretty_printer BUFFER. */
1772 dump_gimple_omp_teams (pretty_printer
*buffer
, const gomp_teams
*gs
, int spc
,
1775 if (flags
& TDF_RAW
)
1777 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1778 gimple_omp_body (gs
));
1779 dump_omp_clauses (buffer
, gimple_omp_teams_clauses (gs
), spc
, flags
);
1780 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1784 pp_string (buffer
, "#pragma omp teams");
1785 dump_omp_clauses (buffer
, gimple_omp_teams_clauses (gs
), spc
, flags
);
1786 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1788 newline_and_indent (buffer
, spc
+ 2);
1789 pp_character (buffer
, '{');
1790 pp_newline (buffer
);
1791 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1792 newline_and_indent (buffer
, spc
+ 2);
1793 pp_character (buffer
, '}');
1798 /* Dump a GIMPLE_OMP_SECTIONS tuple on the pretty_printer BUFFER. */
1801 dump_gimple_omp_sections (pretty_printer
*buffer
, const gomp_sections
*gs
,
1802 int spc
, dump_flags_t flags
)
1804 if (flags
& TDF_RAW
)
1806 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1807 gimple_omp_body (gs
));
1808 dump_omp_clauses (buffer
, gimple_omp_sections_clauses (gs
), spc
, flags
);
1809 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1813 pp_string (buffer
, "#pragma omp sections");
1814 if (gimple_omp_sections_control (gs
))
1816 pp_string (buffer
, " <");
1817 dump_generic_node (buffer
, gimple_omp_sections_control (gs
), spc
,
1819 pp_greater (buffer
);
1821 dump_omp_clauses (buffer
, gimple_omp_sections_clauses (gs
), spc
, flags
);
1822 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1824 newline_and_indent (buffer
, spc
+ 2);
1825 pp_left_brace (buffer
);
1826 pp_newline (buffer
);
1827 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1828 newline_and_indent (buffer
, spc
+ 2);
1829 pp_right_brace (buffer
);
1834 /* Dump a GIMPLE_OMP_{MASTER,ORDERED,SECTION} tuple on the
1835 pretty_printer BUFFER. */
1838 dump_gimple_omp_block (pretty_printer
*buffer
, const gimple
*gs
, int spc
,
1841 if (flags
& TDF_RAW
)
1842 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1843 gimple_omp_body (gs
));
1846 switch (gimple_code (gs
))
1848 case GIMPLE_OMP_MASTER
:
1849 pp_string (buffer
, "#pragma omp master");
1851 case GIMPLE_OMP_SECTION
:
1852 pp_string (buffer
, "#pragma omp section");
1857 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1859 newline_and_indent (buffer
, spc
+ 2);
1860 pp_left_brace (buffer
);
1861 pp_newline (buffer
);
1862 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1863 newline_and_indent (buffer
, spc
+ 2);
1864 pp_right_brace (buffer
);
1869 /* Dump a GIMPLE_OMP_CRITICAL tuple on the pretty_printer BUFFER. */
1872 dump_gimple_omp_critical (pretty_printer
*buffer
, const gomp_critical
*gs
,
1873 int spc
, dump_flags_t flags
)
1875 if (flags
& TDF_RAW
)
1876 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1877 gimple_omp_body (gs
));
1880 pp_string (buffer
, "#pragma omp critical");
1881 if (gimple_omp_critical_name (gs
))
1883 pp_string (buffer
, " (");
1884 dump_generic_node (buffer
, gimple_omp_critical_name (gs
), spc
,
1886 pp_right_paren (buffer
);
1888 dump_omp_clauses (buffer
, gimple_omp_critical_clauses (gs
), spc
, flags
);
1889 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1891 newline_and_indent (buffer
, spc
+ 2);
1892 pp_left_brace (buffer
);
1893 pp_newline (buffer
);
1894 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1895 newline_and_indent (buffer
, spc
+ 2);
1896 pp_right_brace (buffer
);
1901 /* Dump a GIMPLE_OMP_ORDERED tuple on the pretty_printer BUFFER. */
1904 dump_gimple_omp_ordered (pretty_printer
*buffer
, const gomp_ordered
*gs
,
1905 int spc
, dump_flags_t flags
)
1907 if (flags
& TDF_RAW
)
1908 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1909 gimple_omp_body (gs
));
1912 pp_string (buffer
, "#pragma omp ordered");
1913 dump_omp_clauses (buffer
, gimple_omp_ordered_clauses (gs
), spc
, flags
);
1914 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1916 newline_and_indent (buffer
, spc
+ 2);
1917 pp_left_brace (buffer
);
1918 pp_newline (buffer
);
1919 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1920 newline_and_indent (buffer
, spc
+ 2);
1921 pp_right_brace (buffer
);
1926 /* Dump a GIMPLE_OMP_SCAN tuple on the pretty_printer BUFFER. */
1929 dump_gimple_omp_scan (pretty_printer
*buffer
, const gomp_scan
*gs
,
1930 int spc
, dump_flags_t flags
)
1932 if (flags
& TDF_RAW
)
1933 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1934 gimple_omp_body (gs
));
1937 if (gimple_omp_scan_clauses (gs
))
1939 pp_string (buffer
, "#pragma omp scan");
1940 dump_omp_clauses (buffer
, gimple_omp_scan_clauses (gs
), spc
, flags
);
1942 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1944 newline_and_indent (buffer
, spc
+ 2);
1945 pp_left_brace (buffer
);
1946 pp_newline (buffer
);
1947 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1948 newline_and_indent (buffer
, spc
+ 2);
1949 pp_right_brace (buffer
);
1954 /* Dump a GIMPLE_OMP_RETURN tuple on the pretty_printer BUFFER. */
1957 dump_gimple_omp_return (pretty_printer
*buffer
, const gimple
*gs
, int spc
,
1960 if (flags
& TDF_RAW
)
1962 dump_gimple_fmt (buffer
, spc
, flags
, "%G <nowait=%d", gs
,
1963 (int) gimple_omp_return_nowait_p (gs
));
1964 if (gimple_omp_return_lhs (gs
))
1965 dump_gimple_fmt (buffer
, spc
, flags
, ", lhs=%T>",
1966 gimple_omp_return_lhs (gs
));
1968 dump_gimple_fmt (buffer
, spc
, flags
, ">");
1972 pp_string (buffer
, "#pragma omp return");
1973 if (gimple_omp_return_nowait_p (gs
))
1974 pp_string (buffer
, "(nowait)");
1975 if (gimple_omp_return_lhs (gs
))
1977 pp_string (buffer
, " (set ");
1978 dump_generic_node (buffer
, gimple_omp_return_lhs (gs
),
1980 pp_character (buffer
, ')');
1985 /* Dump a GIMPLE_TRANSACTION tuple on the pretty_printer BUFFER. */
1988 dump_gimple_transaction (pretty_printer
*buffer
, const gtransaction
*gs
,
1989 int spc
, dump_flags_t flags
)
1991 unsigned subcode
= gimple_transaction_subcode (gs
);
1993 if (flags
& TDF_RAW
)
1995 dump_gimple_fmt (buffer
, spc
, flags
,
1996 "%G [SUBCODE=%x,NORM=%T,UNINST=%T,OVER=%T] "
1998 gs
, subcode
, gimple_transaction_label_norm (gs
),
1999 gimple_transaction_label_uninst (gs
),
2000 gimple_transaction_label_over (gs
),
2001 gimple_transaction_body (gs
));
2005 if (subcode
& GTMA_IS_OUTER
)
2006 pp_string (buffer
, "__transaction_atomic [[outer]]");
2007 else if (subcode
& GTMA_IS_RELAXED
)
2008 pp_string (buffer
, "__transaction_relaxed");
2010 pp_string (buffer
, "__transaction_atomic");
2011 subcode
&= ~GTMA_DECLARATION_MASK
;
2013 if (gimple_transaction_body (gs
))
2015 newline_and_indent (buffer
, spc
+ 2);
2016 pp_left_brace (buffer
);
2017 pp_newline (buffer
);
2018 dump_gimple_seq (buffer
, gimple_transaction_body (gs
),
2020 newline_and_indent (buffer
, spc
+ 2);
2021 pp_right_brace (buffer
);
2025 pp_string (buffer
, " //");
2026 if (gimple_transaction_label_norm (gs
))
2028 pp_string (buffer
, " NORM=");
2029 dump_generic_node (buffer
, gimple_transaction_label_norm (gs
),
2032 if (gimple_transaction_label_uninst (gs
))
2034 pp_string (buffer
, " UNINST=");
2035 dump_generic_node (buffer
, gimple_transaction_label_uninst (gs
),
2038 if (gimple_transaction_label_over (gs
))
2040 pp_string (buffer
, " OVER=");
2041 dump_generic_node (buffer
, gimple_transaction_label_over (gs
),
2046 pp_string (buffer
, " SUBCODE=[ ");
2047 if (subcode
& GTMA_HAVE_ABORT
)
2049 pp_string (buffer
, "GTMA_HAVE_ABORT ");
2050 subcode
&= ~GTMA_HAVE_ABORT
;
2052 if (subcode
& GTMA_HAVE_LOAD
)
2054 pp_string (buffer
, "GTMA_HAVE_LOAD ");
2055 subcode
&= ~GTMA_HAVE_LOAD
;
2057 if (subcode
& GTMA_HAVE_STORE
)
2059 pp_string (buffer
, "GTMA_HAVE_STORE ");
2060 subcode
&= ~GTMA_HAVE_STORE
;
2062 if (subcode
& GTMA_MAY_ENTER_IRREVOCABLE
)
2064 pp_string (buffer
, "GTMA_MAY_ENTER_IRREVOCABLE ");
2065 subcode
&= ~GTMA_MAY_ENTER_IRREVOCABLE
;
2067 if (subcode
& GTMA_DOES_GO_IRREVOCABLE
)
2069 pp_string (buffer
, "GTMA_DOES_GO_IRREVOCABLE ");
2070 subcode
&= ~GTMA_DOES_GO_IRREVOCABLE
;
2072 if (subcode
& GTMA_HAS_NO_INSTRUMENTATION
)
2074 pp_string (buffer
, "GTMA_HAS_NO_INSTRUMENTATION ");
2075 subcode
&= ~GTMA_HAS_NO_INSTRUMENTATION
;
2078 pp_printf (buffer
, "0x%x ", subcode
);
2079 pp_right_bracket (buffer
);
2085 /* Dump a GIMPLE_ASM tuple on the pretty_printer BUFFER, SPC spaces of
2086 indent. FLAGS specifies details to show in the dump (see TDF_* in
2090 dump_gimple_asm (pretty_printer
*buffer
, const gasm
*gs
, int spc
,
2093 unsigned int i
, n
, f
, fields
;
2095 if (flags
& TDF_RAW
)
2097 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+STRING <%n%s%n>", gs
,
2098 gimple_asm_string (gs
));
2100 n
= gimple_asm_noutputs (gs
);
2103 newline_and_indent (buffer
, spc
+ 2);
2104 pp_string (buffer
, "OUTPUT: ");
2105 for (i
= 0; i
< n
; i
++)
2107 dump_generic_node (buffer
, gimple_asm_output_op (gs
, i
),
2110 pp_string (buffer
, ", ");
2114 n
= gimple_asm_ninputs (gs
);
2117 newline_and_indent (buffer
, spc
+ 2);
2118 pp_string (buffer
, "INPUT: ");
2119 for (i
= 0; i
< n
; i
++)
2121 dump_generic_node (buffer
, gimple_asm_input_op (gs
, i
),
2124 pp_string (buffer
, ", ");
2128 n
= gimple_asm_nclobbers (gs
);
2131 newline_and_indent (buffer
, spc
+ 2);
2132 pp_string (buffer
, "CLOBBER: ");
2133 for (i
= 0; i
< n
; i
++)
2135 dump_generic_node (buffer
, gimple_asm_clobber_op (gs
, i
),
2138 pp_string (buffer
, ", ");
2142 n
= gimple_asm_nlabels (gs
);
2145 newline_and_indent (buffer
, spc
+ 2);
2146 pp_string (buffer
, "LABEL: ");
2147 for (i
= 0; i
< n
; i
++)
2149 dump_generic_node (buffer
, gimple_asm_label_op (gs
, i
),
2152 pp_string (buffer
, ", ");
2156 newline_and_indent (buffer
, spc
);
2157 pp_greater (buffer
);
2161 pp_string (buffer
, "__asm__");
2162 if (gimple_asm_volatile_p (gs
))
2163 pp_string (buffer
, " __volatile__");
2164 if (gimple_asm_inline_p (gs
))
2165 pp_string (buffer
, " __inline__");
2166 if (gimple_asm_nlabels (gs
))
2167 pp_string (buffer
, " goto");
2168 pp_string (buffer
, "(\"");
2169 pp_string (buffer
, gimple_asm_string (gs
));
2170 pp_string (buffer
, "\"");
2172 if (gimple_asm_nlabels (gs
))
2174 else if (gimple_asm_nclobbers (gs
))
2176 else if (gimple_asm_ninputs (gs
))
2178 else if (gimple_asm_noutputs (gs
))
2183 for (f
= 0; f
< fields
; ++f
)
2185 pp_string (buffer
, " : ");
2190 n
= gimple_asm_noutputs (gs
);
2191 for (i
= 0; i
< n
; i
++)
2193 dump_generic_node (buffer
, gimple_asm_output_op (gs
, i
),
2196 pp_string (buffer
, ", ");
2201 n
= gimple_asm_ninputs (gs
);
2202 for (i
= 0; i
< n
; i
++)
2204 dump_generic_node (buffer
, gimple_asm_input_op (gs
, i
),
2207 pp_string (buffer
, ", ");
2212 n
= gimple_asm_nclobbers (gs
);
2213 for (i
= 0; i
< n
; i
++)
2215 dump_generic_node (buffer
, gimple_asm_clobber_op (gs
, i
),
2218 pp_string (buffer
, ", ");
2223 n
= gimple_asm_nlabels (gs
);
2224 for (i
= 0; i
< n
; i
++)
2226 dump_generic_node (buffer
, gimple_asm_label_op (gs
, i
),
2229 pp_string (buffer
, ", ");
2238 pp_string (buffer
, ");");
2242 /* Dump ptr_info and range_info for NODE on pretty_printer BUFFER with
2243 SPC spaces of indent. */
2246 dump_ssaname_info (pretty_printer
*buffer
, tree node
, int spc
)
2248 if (TREE_CODE (node
) != SSA_NAME
)
2251 if (POINTER_TYPE_P (TREE_TYPE (node
))
2252 && SSA_NAME_PTR_INFO (node
))
2254 unsigned int align
, misalign
;
2255 struct ptr_info_def
*pi
= SSA_NAME_PTR_INFO (node
);
2256 pp_string (buffer
, "# PT = ");
2257 pp_points_to_solution (buffer
, &pi
->pt
);
2258 newline_and_indent (buffer
, spc
);
2259 if (get_ptr_info_alignment (pi
, &align
, &misalign
))
2261 pp_printf (buffer
, "# ALIGN = %u, MISALIGN = %u", align
, misalign
);
2262 newline_and_indent (buffer
, spc
);
2266 if (!POINTER_TYPE_P (TREE_TYPE (node
))
2267 && SSA_NAME_RANGE_INFO (node
))
2269 wide_int min
, max
, nonzero_bits
;
2272 get_global_range_query ()->range_of_expr (r
, node
);
2273 value_range_kind range_type
= r
.kind ();
2274 if (!r
.undefined_p ())
2276 min
= wi::to_wide (r
.min ());
2277 max
= wi::to_wide (r
.max ());
2280 // FIXME: Use irange::dump() instead.
2281 if (range_type
== VR_VARYING
)
2282 pp_printf (buffer
, "# RANGE VR_VARYING");
2283 else if (range_type
== VR_RANGE
|| range_type
== VR_ANTI_RANGE
)
2285 pp_printf (buffer
, "# RANGE ");
2286 pp_printf (buffer
, "%s[", range_type
== VR_RANGE
? "" : "~");
2287 pp_wide_int (buffer
, min
, TYPE_SIGN (TREE_TYPE (node
)));
2288 pp_printf (buffer
, ", ");
2289 pp_wide_int (buffer
, max
, TYPE_SIGN (TREE_TYPE (node
)));
2290 pp_printf (buffer
, "]");
2292 nonzero_bits
= get_nonzero_bits (node
);
2293 if (nonzero_bits
!= -1)
2295 pp_string (buffer
, " NONZERO ");
2296 pp_wide_int (buffer
, nonzero_bits
, UNSIGNED
);
2298 newline_and_indent (buffer
, spc
);
2302 /* As dump_ssaname_info, but dump to FILE. */
2305 dump_ssaname_info_to_file (FILE *file
, tree node
, int spc
)
2307 pretty_printer buffer
;
2308 pp_needs_newline (&buffer
) = true;
2309 buffer
.buffer
->stream
= file
;
2310 dump_ssaname_info (&buffer
, node
, spc
);
2314 /* Dump a PHI node PHI. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1.
2315 The caller is responsible for calling pp_flush on BUFFER to finalize
2316 pretty printer. If COMMENT is true, print this after #. */
2319 dump_gimple_phi (pretty_printer
*buffer
, const gphi
*phi
, int spc
, bool comment
,
2323 tree lhs
= gimple_phi_result (phi
);
2325 if (flags
& TDF_ALIAS
)
2326 dump_ssaname_info (buffer
, lhs
, spc
);
2329 pp_string (buffer
, "# ");
2331 if (flags
& TDF_RAW
)
2332 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, ", phi
,
2333 gimple_phi_result (phi
));
2336 dump_generic_node (buffer
, lhs
, spc
, flags
, false);
2337 if (flags
& TDF_GIMPLE
)
2338 pp_string (buffer
, " = __PHI (");
2340 pp_string (buffer
, " = PHI <");
2342 for (i
= 0; i
< gimple_phi_num_args (phi
); i
++)
2344 if ((flags
& TDF_LINENO
) && gimple_phi_arg_has_location (phi
, i
))
2345 dump_location (buffer
, gimple_phi_arg_location (phi
, i
));
2346 basic_block src
= gimple_phi_arg_edge (phi
, i
)->src
;
2347 if (flags
& TDF_GIMPLE
)
2349 pp_string (buffer
, "__BB");
2350 pp_decimal_int (buffer
, src
->index
);
2351 pp_string (buffer
, ": ");
2353 dump_generic_node (buffer
, gimple_phi_arg_def (phi
, i
), spc
, flags
,
2355 if (! (flags
& TDF_GIMPLE
))
2357 pp_left_paren (buffer
);
2358 pp_decimal_int (buffer
, src
->index
);
2359 pp_right_paren (buffer
);
2361 if (i
< gimple_phi_num_args (phi
) - 1)
2362 pp_string (buffer
, ", ");
2364 if (flags
& TDF_GIMPLE
)
2365 pp_string (buffer
, ");");
2367 pp_greater (buffer
);
2371 /* Dump a GIMPLE_OMP_PARALLEL tuple on the pretty_printer BUFFER, SPC spaces
2372 of indent. FLAGS specifies details to show in the dump (see TDF_* in
2376 dump_gimple_omp_parallel (pretty_printer
*buffer
, const gomp_parallel
*gs
,
2377 int spc
, dump_flags_t flags
)
2379 if (flags
& TDF_RAW
)
2381 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
2382 gimple_omp_body (gs
));
2383 dump_omp_clauses (buffer
, gimple_omp_parallel_clauses (gs
), spc
, flags
);
2384 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T%n>",
2385 gimple_omp_parallel_child_fn (gs
),
2386 gimple_omp_parallel_data_arg (gs
));
2391 pp_string (buffer
, "#pragma omp parallel");
2392 dump_omp_clauses (buffer
, gimple_omp_parallel_clauses (gs
), spc
, flags
);
2393 if (gimple_omp_parallel_child_fn (gs
))
2395 pp_string (buffer
, " [child fn: ");
2396 dump_generic_node (buffer
, gimple_omp_parallel_child_fn (gs
),
2398 pp_string (buffer
, " (");
2399 if (gimple_omp_parallel_data_arg (gs
))
2400 dump_generic_node (buffer
, gimple_omp_parallel_data_arg (gs
),
2403 pp_string (buffer
, "???");
2404 pp_string (buffer
, ")]");
2406 body
= gimple_omp_body (gs
);
2407 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
2409 newline_and_indent (buffer
, spc
+ 2);
2410 pp_left_brace (buffer
);
2411 pp_newline (buffer
);
2412 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
2413 newline_and_indent (buffer
, spc
+ 2);
2414 pp_right_brace (buffer
);
2418 pp_newline (buffer
);
2419 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
2425 /* Dump a GIMPLE_OMP_TASK tuple on the pretty_printer BUFFER, SPC spaces
2426 of indent. FLAGS specifies details to show in the dump (see TDF_* in
2430 dump_gimple_omp_task (pretty_printer
*buffer
, const gomp_task
*gs
, int spc
,
2433 if (flags
& TDF_RAW
)
2435 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
2436 gimple_omp_body (gs
));
2437 dump_omp_clauses (buffer
, gimple_omp_task_clauses (gs
), spc
, flags
);
2438 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T, %T, %T, %T%n>",
2439 gimple_omp_task_child_fn (gs
),
2440 gimple_omp_task_data_arg (gs
),
2441 gimple_omp_task_copy_fn (gs
),
2442 gimple_omp_task_arg_size (gs
),
2443 gimple_omp_task_arg_size (gs
));
2448 if (gimple_omp_task_taskloop_p (gs
))
2449 pp_string (buffer
, "#pragma omp taskloop");
2450 else if (gimple_omp_task_taskwait_p (gs
))
2451 pp_string (buffer
, "#pragma omp taskwait");
2453 pp_string (buffer
, "#pragma omp task");
2454 dump_omp_clauses (buffer
, gimple_omp_task_clauses (gs
), spc
, flags
);
2455 if (gimple_omp_task_child_fn (gs
))
2457 pp_string (buffer
, " [child fn: ");
2458 dump_generic_node (buffer
, gimple_omp_task_child_fn (gs
),
2460 pp_string (buffer
, " (");
2461 if (gimple_omp_task_data_arg (gs
))
2462 dump_generic_node (buffer
, gimple_omp_task_data_arg (gs
),
2465 pp_string (buffer
, "???");
2466 pp_string (buffer
, ")]");
2468 body
= gimple_omp_body (gs
);
2469 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
2471 newline_and_indent (buffer
, spc
+ 2);
2472 pp_left_brace (buffer
);
2473 pp_newline (buffer
);
2474 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
2475 newline_and_indent (buffer
, spc
+ 2);
2476 pp_right_brace (buffer
);
2480 pp_newline (buffer
);
2481 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
2487 /* Dump a GIMPLE_OMP_ATOMIC_LOAD tuple on the pretty_printer BUFFER, SPC
2488 spaces of indent. FLAGS specifies details to show in the dump (see TDF_*
2492 dump_gimple_omp_atomic_load (pretty_printer
*buffer
, const gomp_atomic_load
*gs
,
2493 int spc
, dump_flags_t flags
)
2495 if (flags
& TDF_RAW
)
2497 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T>", gs
,
2498 gimple_omp_atomic_load_lhs (gs
),
2499 gimple_omp_atomic_load_rhs (gs
));
2503 pp_string (buffer
, "#pragma omp atomic_load");
2504 dump_omp_atomic_memory_order (buffer
,
2505 gimple_omp_atomic_memory_order (gs
));
2506 if (gimple_omp_atomic_need_value_p (gs
))
2507 pp_string (buffer
, " [needed]");
2508 newline_and_indent (buffer
, spc
+ 2);
2509 dump_generic_node (buffer
, gimple_omp_atomic_load_lhs (gs
),
2515 dump_generic_node (buffer
, gimple_omp_atomic_load_rhs (gs
),
2520 /* Dump a GIMPLE_OMP_ATOMIC_STORE tuple on the pretty_printer BUFFER, SPC
2521 spaces of indent. FLAGS specifies details to show in the dump (see TDF_*
2525 dump_gimple_omp_atomic_store (pretty_printer
*buffer
,
2526 const gomp_atomic_store
*gs
, int spc
,
2529 if (flags
& TDF_RAW
)
2531 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
,
2532 gimple_omp_atomic_store_val (gs
));
2536 pp_string (buffer
, "#pragma omp atomic_store");
2537 dump_omp_atomic_memory_order (buffer
,
2538 gimple_omp_atomic_memory_order (gs
));
2540 if (gimple_omp_atomic_need_value_p (gs
))
2541 pp_string (buffer
, "[needed] ");
2542 pp_left_paren (buffer
);
2543 dump_generic_node (buffer
, gimple_omp_atomic_store_val (gs
),
2545 pp_right_paren (buffer
);
2550 /* Dump all the memory operands for statement GS. BUFFER, SPC and
2551 FLAGS are as in pp_gimple_stmt_1. */
2554 dump_gimple_mem_ops (pretty_printer
*buffer
, const gimple
*gs
, int spc
,
2557 tree vdef
= gimple_vdef (gs
);
2558 tree vuse
= gimple_vuse (gs
);
2560 if (vdef
!= NULL_TREE
)
2562 pp_string (buffer
, "# ");
2563 dump_generic_node (buffer
, vdef
, spc
+ 2, flags
, false);
2564 pp_string (buffer
, " = VDEF <");
2565 dump_generic_node (buffer
, vuse
, spc
+ 2, flags
, false);
2566 pp_greater (buffer
);
2567 newline_and_indent (buffer
, spc
);
2569 else if (vuse
!= NULL_TREE
)
2571 pp_string (buffer
, "# VUSE <");
2572 dump_generic_node (buffer
, vuse
, spc
+ 2, flags
, false);
2573 pp_greater (buffer
);
2574 newline_and_indent (buffer
, spc
);
2579 /* Print the gimple statement GS on the pretty printer BUFFER, SPC
2580 spaces of indent. FLAGS specifies details to show in the dump (see
2581 TDF_* in dumpfile.h). The caller is responsible for calling
2582 pp_flush on BUFFER to finalize the pretty printer. */
2585 pp_gimple_stmt_1 (pretty_printer
*buffer
, const gimple
*gs
, int spc
,
2591 if (flags
& TDF_STMTADDR
)
2592 pp_printf (buffer
, "<&%p> ", (const void *) gs
);
2594 if ((flags
& TDF_LINENO
) && gimple_has_location (gs
))
2595 dump_location (buffer
, gimple_location (gs
));
2599 int lp_nr
= lookup_stmt_eh_lp (gs
);
2601 pp_printf (buffer
, "[LP %d] ", lp_nr
);
2603 pp_printf (buffer
, "[MNT %d] ", -lp_nr
);
2606 if ((flags
& (TDF_VOPS
|TDF_MEMSYMS
))
2607 && gimple_has_mem_ops (gs
))
2608 dump_gimple_mem_ops (buffer
, gs
, spc
, flags
);
2610 if (gimple_has_lhs (gs
)
2611 && (flags
& TDF_ALIAS
))
2612 dump_ssaname_info (buffer
, gimple_get_lhs (gs
), spc
);
2614 switch (gimple_code (gs
))
2617 dump_gimple_asm (buffer
, as_a
<const gasm
*> (gs
), spc
, flags
);
2621 dump_gimple_assign (buffer
, as_a
<const gassign
*> (gs
), spc
, flags
);
2625 dump_gimple_bind (buffer
, as_a
<const gbind
*> (gs
), spc
, flags
);
2629 dump_gimple_call (buffer
, as_a
<const gcall
*> (gs
), spc
, flags
);
2633 dump_gimple_cond (buffer
, as_a
<const gcond
*> (gs
), spc
, flags
);
2637 dump_gimple_label (buffer
, as_a
<const glabel
*> (gs
), spc
, flags
);
2641 dump_gimple_goto (buffer
, as_a
<const ggoto
*> (gs
), spc
, flags
);
2645 pp_string (buffer
, "GIMPLE_NOP");
2649 dump_gimple_return (buffer
, as_a
<const greturn
*> (gs
), spc
, flags
);
2653 dump_gimple_switch (buffer
, as_a
<const gswitch
*> (gs
), spc
, flags
);
2657 dump_gimple_try (buffer
, as_a
<const gtry
*> (gs
), spc
, flags
);
2661 dump_gimple_phi (buffer
, as_a
<const gphi
*> (gs
), spc
, false, flags
);
2664 case GIMPLE_OMP_PARALLEL
:
2665 dump_gimple_omp_parallel (buffer
, as_a
<const gomp_parallel
*> (gs
), spc
,
2669 case GIMPLE_OMP_TASK
:
2670 dump_gimple_omp_task (buffer
, as_a
<const gomp_task
*> (gs
), spc
, flags
);
2673 case GIMPLE_OMP_ATOMIC_LOAD
:
2674 dump_gimple_omp_atomic_load (buffer
, as_a
<const gomp_atomic_load
*> (gs
),
2678 case GIMPLE_OMP_ATOMIC_STORE
:
2679 dump_gimple_omp_atomic_store (buffer
,
2680 as_a
<const gomp_atomic_store
*> (gs
),
2684 case GIMPLE_OMP_FOR
:
2685 dump_gimple_omp_for (buffer
, as_a
<const gomp_for
*> (gs
), spc
, flags
);
2688 case GIMPLE_OMP_CONTINUE
:
2689 dump_gimple_omp_continue (buffer
, as_a
<const gomp_continue
*> (gs
), spc
,
2693 case GIMPLE_OMP_SINGLE
:
2694 dump_gimple_omp_single (buffer
, as_a
<const gomp_single
*> (gs
), spc
,
2698 case GIMPLE_OMP_TARGET
:
2699 dump_gimple_omp_target (buffer
, as_a
<const gomp_target
*> (gs
), spc
,
2703 case GIMPLE_OMP_TEAMS
:
2704 dump_gimple_omp_teams (buffer
, as_a
<const gomp_teams
*> (gs
), spc
,
2708 case GIMPLE_OMP_RETURN
:
2709 dump_gimple_omp_return (buffer
, gs
, spc
, flags
);
2712 case GIMPLE_OMP_SECTIONS
:
2713 dump_gimple_omp_sections (buffer
, as_a
<const gomp_sections
*> (gs
),
2717 case GIMPLE_OMP_SECTIONS_SWITCH
:
2718 pp_string (buffer
, "GIMPLE_SECTIONS_SWITCH");
2721 case GIMPLE_OMP_TASKGROUP
:
2722 dump_gimple_omp_taskgroup (buffer
, gs
, spc
, flags
);
2725 case GIMPLE_OMP_MASTER
:
2726 case GIMPLE_OMP_SECTION
:
2727 dump_gimple_omp_block (buffer
, gs
, spc
, flags
);
2730 case GIMPLE_OMP_ORDERED
:
2731 dump_gimple_omp_ordered (buffer
, as_a
<const gomp_ordered
*> (gs
), spc
,
2735 case GIMPLE_OMP_SCAN
:
2736 dump_gimple_omp_scan (buffer
, as_a
<const gomp_scan
*> (gs
), spc
,
2740 case GIMPLE_OMP_CRITICAL
:
2741 dump_gimple_omp_critical (buffer
, as_a
<const gomp_critical
*> (gs
), spc
,
2746 dump_gimple_catch (buffer
, as_a
<const gcatch
*> (gs
), spc
, flags
);
2749 case GIMPLE_EH_FILTER
:
2750 dump_gimple_eh_filter (buffer
, as_a
<const geh_filter
*> (gs
), spc
,
2754 case GIMPLE_EH_MUST_NOT_THROW
:
2755 dump_gimple_eh_must_not_throw (buffer
,
2756 as_a
<const geh_mnt
*> (gs
),
2760 case GIMPLE_EH_ELSE
:
2761 dump_gimple_eh_else (buffer
, as_a
<const geh_else
*> (gs
), spc
, flags
);
2765 dump_gimple_resx (buffer
, as_a
<const gresx
*> (gs
), spc
, flags
);
2768 case GIMPLE_EH_DISPATCH
:
2769 dump_gimple_eh_dispatch (buffer
, as_a
<const geh_dispatch
*> (gs
), spc
,
2774 dump_gimple_debug (buffer
, as_a
<const gdebug
*> (gs
), spc
, flags
);
2777 case GIMPLE_PREDICT
:
2778 pp_string (buffer
, "// predicted ");
2779 if (gimple_predict_outcome (gs
))
2780 pp_string (buffer
, "likely by ");
2782 pp_string (buffer
, "unlikely by ");
2783 pp_string (buffer
, predictor_name (gimple_predict_predictor (gs
)));
2784 pp_string (buffer
, " predictor.");
2787 case GIMPLE_TRANSACTION
:
2788 dump_gimple_transaction (buffer
, as_a
<const gtransaction
*> (gs
), spc
,
2798 /* Dumps header of basic block BB to OUTF indented by INDENT
2799 spaces and details described by flags. */
2802 dump_gimple_bb_header (FILE *outf
, basic_block bb
, int indent
,
2805 if (flags
& TDF_BLOCKS
)
2807 if (flags
& TDF_LINENO
)
2809 gimple_stmt_iterator gsi
;
2811 fputs (";; ", outf
);
2813 for (gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
); gsi_next (&gsi
))
2814 if (!is_gimple_debug (gsi_stmt (gsi
))
2815 && get_lineno (gsi_stmt (gsi
)) != UNKNOWN_LOCATION
)
2817 fprintf (outf
, "%*sstarting at line %d",
2818 indent
, "", get_lineno (gsi_stmt (gsi
)));
2821 if (bb
->discriminator
)
2822 fprintf (outf
, ", discriminator %i", bb
->discriminator
);
2828 if (flags
& TDF_GIMPLE
)
2830 fprintf (outf
, "%*s__BB(%d", indent
, "", bb
->index
);
2831 if (bb
->loop_father
->header
== bb
)
2832 fprintf (outf
, ",loop_header(%d)", bb
->loop_father
->num
);
2833 if (bb
->count
.initialized_p ())
2834 fprintf (outf
, ",%s(%" PRIu64
")",
2835 profile_quality_as_string (bb
->count
.quality ()),
2836 bb
->count
.value ());
2837 fprintf (outf
, "):\n");
2840 fprintf (outf
, "%*s<bb %d> %s:\n",
2841 indent
, "", bb
->index
, dump_profile (bb
->count
));
2846 /* Dumps end of basic block BB to buffer BUFFER indented by INDENT
2850 dump_gimple_bb_footer (FILE *outf ATTRIBUTE_UNUSED
,
2851 basic_block bb ATTRIBUTE_UNUSED
,
2852 int indent ATTRIBUTE_UNUSED
,
2853 dump_flags_t flags ATTRIBUTE_UNUSED
)
2855 /* There is currently no GIMPLE-specific basic block info to dump. */
2860 /* Dump PHI nodes of basic block BB to BUFFER with details described
2861 by FLAGS and indented by INDENT spaces. */
2864 dump_phi_nodes (pretty_printer
*buffer
, basic_block bb
, int indent
,
2869 for (i
= gsi_start_phis (bb
); !gsi_end_p (i
); gsi_next (&i
))
2871 gphi
*phi
= i
.phi ();
2872 if (!virtual_operand_p (gimple_phi_result (phi
)) || (flags
& TDF_VOPS
))
2875 dump_gimple_phi (buffer
, phi
, indent
,
2876 (flags
& TDF_GIMPLE
) ? false : true, flags
);
2877 pp_newline (buffer
);
2883 /* Dump jump to basic block BB that is represented implicitly in the cfg
2887 pp_cfg_jump (pretty_printer
*buffer
, edge e
, dump_flags_t flags
)
2889 if (flags
& TDF_GIMPLE
)
2891 pp_string (buffer
, "goto __BB");
2892 pp_decimal_int (buffer
, e
->dest
->index
);
2893 if (e
->probability
.initialized_p ())
2895 pp_string (buffer
, "(");
2897 profile_quality_as_string (e
->probability
.quality ()));
2898 pp_string (buffer
, "(");
2899 pp_decimal_int (buffer
, e
->probability
.value ());
2900 pp_string (buffer
, "))");
2902 pp_semicolon (buffer
);
2906 pp_string (buffer
, "goto <bb ");
2907 pp_decimal_int (buffer
, e
->dest
->index
);
2908 pp_greater (buffer
);
2909 pp_semicolon (buffer
);
2911 dump_edge_probability (buffer
, e
);
2916 /* Dump edges represented implicitly in basic block BB to BUFFER, indented
2917 by INDENT spaces, with details given by FLAGS. */
2920 dump_implicit_edges (pretty_printer
*buffer
, basic_block bb
, int indent
,
2926 stmt
= last_stmt (bb
);
2928 if (stmt
&& gimple_code (stmt
) == GIMPLE_COND
)
2930 edge true_edge
, false_edge
;
2932 /* When we are emitting the code or changing CFG, it is possible that
2933 the edges are not yet created. When we are using debug_bb in such
2934 a situation, we do not want it to crash. */
2935 if (EDGE_COUNT (bb
->succs
) != 2)
2937 extract_true_false_edges_from_block (bb
, &true_edge
, &false_edge
);
2939 INDENT (indent
+ 2);
2940 pp_cfg_jump (buffer
, true_edge
, flags
);
2941 newline_and_indent (buffer
, indent
);
2942 pp_string (buffer
, "else");
2943 newline_and_indent (buffer
, indent
+ 2);
2944 pp_cfg_jump (buffer
, false_edge
, flags
);
2945 pp_newline (buffer
);
2949 /* If there is a fallthru edge, we may need to add an artificial
2950 goto to the dump. */
2951 e
= find_fallthru_edge (bb
->succs
);
2953 if (e
&& (e
->dest
!= bb
->next_bb
|| (flags
& TDF_GIMPLE
)))
2957 if ((flags
& TDF_LINENO
)
2958 && e
->goto_locus
!= UNKNOWN_LOCATION
)
2959 dump_location (buffer
, e
->goto_locus
);
2961 pp_cfg_jump (buffer
, e
, flags
);
2962 pp_newline (buffer
);
2967 /* Dumps basic block BB to buffer BUFFER with details described by FLAGS and
2968 indented by INDENT spaces. */
2971 gimple_dump_bb_buff (pretty_printer
*buffer
, basic_block bb
, int indent
,
2974 gimple_stmt_iterator gsi
;
2976 int label_indent
= indent
- 2;
2978 if (label_indent
< 0)
2981 dump_phi_nodes (buffer
, bb
, indent
, flags
);
2983 for (gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
); gsi_next (&gsi
))
2987 stmt
= gsi_stmt (gsi
);
2989 curr_indent
= gimple_code (stmt
) == GIMPLE_LABEL
? label_indent
: indent
;
2991 INDENT (curr_indent
);
2992 pp_gimple_stmt_1 (buffer
, stmt
, curr_indent
, flags
);
2993 pp_newline_and_flush (buffer
);
2994 gcc_checking_assert (DECL_STRUCT_FUNCTION (current_function_decl
));
2995 dump_histograms_for_stmt (DECL_STRUCT_FUNCTION (current_function_decl
),
2996 pp_buffer (buffer
)->stream
, stmt
);
2999 dump_implicit_edges (buffer
, bb
, indent
, flags
);
3004 /* Dumps basic block BB to FILE with details described by FLAGS and
3005 indented by INDENT spaces. */
3008 gimple_dump_bb (FILE *file
, basic_block bb
, int indent
, dump_flags_t flags
)
3010 dump_gimple_bb_header (file
, bb
, indent
, flags
);
3011 if (bb
->index
>= NUM_FIXED_BLOCKS
)
3013 pretty_printer buffer
;
3014 pp_needs_newline (&buffer
) = true;
3015 buffer
.buffer
->stream
= file
;
3016 gimple_dump_bb_buff (&buffer
, bb
, indent
, flags
);
3018 dump_gimple_bb_footer (file
, bb
, indent
, flags
);
3021 /* Dumps basic block BB to pretty-printer PP with default dump flags and
3022 no indentation, for use as a label of a DOT graph record-node.
3023 ??? Should just use gimple_dump_bb_buff here, except that value profiling
3024 histogram dumping doesn't know about pretty-printers. */
3027 gimple_dump_bb_for_graph (pretty_printer
*pp
, basic_block bb
)
3029 pp_printf (pp
, "<bb %d>:\n", bb
->index
);
3030 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
3032 for (gphi_iterator gsi
= gsi_start_phis (bb
); !gsi_end_p (gsi
);
3035 gphi
*phi
= gsi
.phi ();
3036 if (!virtual_operand_p (gimple_phi_result (phi
))
3037 || (dump_flags
& TDF_VOPS
))
3040 pp_write_text_to_stream (pp
);
3041 pp_string (pp
, "# ");
3042 pp_gimple_stmt_1 (pp
, phi
, 0, dump_flags
);
3044 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
3048 for (gimple_stmt_iterator gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
);
3051 gimple
*stmt
= gsi_stmt (gsi
);
3053 pp_write_text_to_stream (pp
);
3054 pp_gimple_stmt_1 (pp
, stmt
, 0, dump_flags
);
3056 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
3058 dump_implicit_edges (pp
, bb
, 0, dump_flags
);
3059 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
3063 # pragma GCC diagnostic pop