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_MASKED tuple on the pretty_printer BUFFER. */
1664 dump_gimple_omp_masked (pretty_printer
*buffer
, const gimple
*gs
,
1665 int spc
, dump_flags_t flags
)
1667 if (flags
& TDF_RAW
)
1669 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1670 gimple_omp_body (gs
));
1671 dump_omp_clauses (buffer
, gimple_omp_masked_clauses (gs
), spc
, flags
);
1672 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1676 pp_string (buffer
, "#pragma omp masked");
1677 dump_omp_clauses (buffer
, gimple_omp_masked_clauses (gs
), spc
, flags
);
1678 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1680 newline_and_indent (buffer
, spc
+ 2);
1681 pp_left_brace (buffer
);
1682 pp_newline (buffer
);
1683 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1684 newline_and_indent (buffer
, spc
+ 2);
1685 pp_right_brace (buffer
);
1690 /* Dump a GIMPLE_OMP_SCOPE tuple on the pretty_printer BUFFER. */
1693 dump_gimple_omp_scope (pretty_printer
*buffer
, const gimple
*gs
,
1694 int spc
, dump_flags_t flags
)
1696 if (flags
& TDF_RAW
)
1698 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1699 gimple_omp_body (gs
));
1700 dump_omp_clauses (buffer
, gimple_omp_scope_clauses (gs
), spc
, flags
);
1701 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1705 pp_string (buffer
, "#pragma omp scope");
1706 dump_omp_clauses (buffer
, gimple_omp_scope_clauses (gs
), spc
, flags
);
1707 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1709 newline_and_indent (buffer
, spc
+ 2);
1710 pp_left_brace (buffer
);
1711 pp_newline (buffer
);
1712 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1713 newline_and_indent (buffer
, spc
+ 2);
1714 pp_right_brace (buffer
);
1719 /* Dump a GIMPLE_OMP_TARGET tuple on the pretty_printer BUFFER. */
1722 dump_gimple_omp_target (pretty_printer
*buffer
, const gomp_target
*gs
,
1723 int spc
, dump_flags_t flags
)
1726 switch (gimple_omp_target_kind (gs
))
1728 case GF_OMP_TARGET_KIND_REGION
:
1731 case GF_OMP_TARGET_KIND_DATA
:
1734 case GF_OMP_TARGET_KIND_UPDATE
:
1737 case GF_OMP_TARGET_KIND_ENTER_DATA
:
1738 kind
= " enter data";
1740 case GF_OMP_TARGET_KIND_EXIT_DATA
:
1741 kind
= " exit data";
1743 case GF_OMP_TARGET_KIND_OACC_KERNELS
:
1744 kind
= " oacc_kernels";
1746 case GF_OMP_TARGET_KIND_OACC_PARALLEL
:
1747 kind
= " oacc_parallel";
1749 case GF_OMP_TARGET_KIND_OACC_SERIAL
:
1750 kind
= " oacc_serial";
1752 case GF_OMP_TARGET_KIND_OACC_DATA
:
1753 kind
= " oacc_data";
1755 case GF_OMP_TARGET_KIND_OACC_UPDATE
:
1756 kind
= " oacc_update";
1758 case GF_OMP_TARGET_KIND_OACC_ENTER_DATA
:
1759 kind
= " oacc_enter_data";
1761 case GF_OMP_TARGET_KIND_OACC_EXIT_DATA
:
1762 kind
= " oacc_exit_data";
1764 case GF_OMP_TARGET_KIND_OACC_DECLARE
:
1765 kind
= " oacc_declare";
1767 case GF_OMP_TARGET_KIND_OACC_HOST_DATA
:
1768 kind
= " oacc_host_data";
1770 case GF_OMP_TARGET_KIND_OACC_PARALLEL_KERNELS_PARALLELIZED
:
1771 kind
= " oacc_parallel_kernels_parallelized";
1773 case GF_OMP_TARGET_KIND_OACC_PARALLEL_KERNELS_GANG_SINGLE
:
1774 kind
= " oacc_parallel_kernels_gang_single";
1776 case GF_OMP_TARGET_KIND_OACC_DATA_KERNELS
:
1777 kind
= " oacc_data_kernels";
1782 if (flags
& TDF_RAW
)
1784 dump_gimple_fmt (buffer
, spc
, flags
, "%G%s <%+BODY <%S>%nCLAUSES <", gs
,
1785 kind
, gimple_omp_body (gs
));
1786 dump_omp_clauses (buffer
, gimple_omp_target_clauses (gs
), spc
, flags
);
1787 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T%n>",
1788 gimple_omp_target_child_fn (gs
),
1789 gimple_omp_target_data_arg (gs
));
1793 pp_string (buffer
, "#pragma omp target");
1794 pp_string (buffer
, kind
);
1795 dump_omp_clauses (buffer
, gimple_omp_target_clauses (gs
), spc
, flags
);
1796 if (gimple_omp_target_child_fn (gs
))
1798 pp_string (buffer
, " [child fn: ");
1799 dump_generic_node (buffer
, gimple_omp_target_child_fn (gs
),
1801 pp_string (buffer
, " (");
1802 if (gimple_omp_target_data_arg (gs
))
1803 dump_generic_node (buffer
, gimple_omp_target_data_arg (gs
),
1806 pp_string (buffer
, "???");
1807 pp_string (buffer
, ")]");
1809 gimple_seq body
= gimple_omp_body (gs
);
1810 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
1812 newline_and_indent (buffer
, spc
+ 2);
1813 pp_left_brace (buffer
);
1814 pp_newline (buffer
);
1815 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
1816 newline_and_indent (buffer
, spc
+ 2);
1817 pp_right_brace (buffer
);
1821 pp_newline (buffer
);
1822 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
1827 /* Dump a GIMPLE_OMP_TEAMS tuple on the pretty_printer BUFFER. */
1830 dump_gimple_omp_teams (pretty_printer
*buffer
, const gomp_teams
*gs
, int spc
,
1833 if (flags
& TDF_RAW
)
1835 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1836 gimple_omp_body (gs
));
1837 dump_omp_clauses (buffer
, gimple_omp_teams_clauses (gs
), spc
, flags
);
1838 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1842 pp_string (buffer
, "#pragma omp teams");
1843 dump_omp_clauses (buffer
, gimple_omp_teams_clauses (gs
), spc
, flags
);
1844 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1846 newline_and_indent (buffer
, spc
+ 2);
1847 pp_character (buffer
, '{');
1848 pp_newline (buffer
);
1849 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1850 newline_and_indent (buffer
, spc
+ 2);
1851 pp_character (buffer
, '}');
1856 /* Dump a GIMPLE_OMP_SECTIONS tuple on the pretty_printer BUFFER. */
1859 dump_gimple_omp_sections (pretty_printer
*buffer
, const gomp_sections
*gs
,
1860 int spc
, dump_flags_t flags
)
1862 if (flags
& TDF_RAW
)
1864 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1865 gimple_omp_body (gs
));
1866 dump_omp_clauses (buffer
, gimple_omp_sections_clauses (gs
), spc
, flags
);
1867 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1871 pp_string (buffer
, "#pragma omp sections");
1872 if (gimple_omp_sections_control (gs
))
1874 pp_string (buffer
, " <");
1875 dump_generic_node (buffer
, gimple_omp_sections_control (gs
), spc
,
1877 pp_greater (buffer
);
1879 dump_omp_clauses (buffer
, gimple_omp_sections_clauses (gs
), spc
, flags
);
1880 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1882 newline_and_indent (buffer
, spc
+ 2);
1883 pp_left_brace (buffer
);
1884 pp_newline (buffer
);
1885 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1886 newline_and_indent (buffer
, spc
+ 2);
1887 pp_right_brace (buffer
);
1892 /* Dump a GIMPLE_OMP_{MASTER,ORDERED,SECTION} tuple on the
1893 pretty_printer BUFFER. */
1896 dump_gimple_omp_block (pretty_printer
*buffer
, const gimple
*gs
, int spc
,
1899 if (flags
& TDF_RAW
)
1900 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1901 gimple_omp_body (gs
));
1904 switch (gimple_code (gs
))
1906 case GIMPLE_OMP_MASTER
:
1907 pp_string (buffer
, "#pragma omp master");
1909 case GIMPLE_OMP_SECTION
:
1910 pp_string (buffer
, "#pragma omp section");
1915 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1917 newline_and_indent (buffer
, spc
+ 2);
1918 pp_left_brace (buffer
);
1919 pp_newline (buffer
);
1920 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1921 newline_and_indent (buffer
, spc
+ 2);
1922 pp_right_brace (buffer
);
1927 /* Dump a GIMPLE_OMP_CRITICAL tuple on the pretty_printer BUFFER. */
1930 dump_gimple_omp_critical (pretty_printer
*buffer
, const gomp_critical
*gs
,
1931 int spc
, dump_flags_t flags
)
1933 if (flags
& TDF_RAW
)
1934 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1935 gimple_omp_body (gs
));
1938 pp_string (buffer
, "#pragma omp critical");
1939 if (gimple_omp_critical_name (gs
))
1941 pp_string (buffer
, " (");
1942 dump_generic_node (buffer
, gimple_omp_critical_name (gs
), spc
,
1944 pp_right_paren (buffer
);
1946 dump_omp_clauses (buffer
, gimple_omp_critical_clauses (gs
), spc
, flags
);
1947 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1949 newline_and_indent (buffer
, spc
+ 2);
1950 pp_left_brace (buffer
);
1951 pp_newline (buffer
);
1952 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1953 newline_and_indent (buffer
, spc
+ 2);
1954 pp_right_brace (buffer
);
1959 /* Dump a GIMPLE_OMP_ORDERED tuple on the pretty_printer BUFFER. */
1962 dump_gimple_omp_ordered (pretty_printer
*buffer
, const gomp_ordered
*gs
,
1963 int spc
, dump_flags_t flags
)
1965 if (flags
& TDF_RAW
)
1966 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1967 gimple_omp_body (gs
));
1970 pp_string (buffer
, "#pragma omp ordered");
1971 dump_omp_clauses (buffer
, gimple_omp_ordered_clauses (gs
), spc
, flags
);
1972 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1974 newline_and_indent (buffer
, spc
+ 2);
1975 pp_left_brace (buffer
);
1976 pp_newline (buffer
);
1977 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1978 newline_and_indent (buffer
, spc
+ 2);
1979 pp_right_brace (buffer
);
1984 /* Dump a GIMPLE_OMP_SCAN tuple on the pretty_printer BUFFER. */
1987 dump_gimple_omp_scan (pretty_printer
*buffer
, const gomp_scan
*gs
,
1988 int spc
, dump_flags_t flags
)
1990 if (flags
& TDF_RAW
)
1991 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1992 gimple_omp_body (gs
));
1995 if (gimple_omp_scan_clauses (gs
))
1997 pp_string (buffer
, "#pragma omp scan");
1998 dump_omp_clauses (buffer
, gimple_omp_scan_clauses (gs
), spc
, flags
);
2000 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
2002 newline_and_indent (buffer
, spc
+ 2);
2003 pp_left_brace (buffer
);
2004 pp_newline (buffer
);
2005 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
2006 newline_and_indent (buffer
, spc
+ 2);
2007 pp_right_brace (buffer
);
2012 /* Dump a GIMPLE_OMP_RETURN tuple on the pretty_printer BUFFER. */
2015 dump_gimple_omp_return (pretty_printer
*buffer
, const gimple
*gs
, int spc
,
2018 if (flags
& TDF_RAW
)
2020 dump_gimple_fmt (buffer
, spc
, flags
, "%G <nowait=%d", gs
,
2021 (int) gimple_omp_return_nowait_p (gs
));
2022 if (gimple_omp_return_lhs (gs
))
2023 dump_gimple_fmt (buffer
, spc
, flags
, ", lhs=%T>",
2024 gimple_omp_return_lhs (gs
));
2026 dump_gimple_fmt (buffer
, spc
, flags
, ">");
2030 pp_string (buffer
, "#pragma omp return");
2031 if (gimple_omp_return_nowait_p (gs
))
2032 pp_string (buffer
, "(nowait)");
2033 if (gimple_omp_return_lhs (gs
))
2035 pp_string (buffer
, " (set ");
2036 dump_generic_node (buffer
, gimple_omp_return_lhs (gs
),
2038 pp_character (buffer
, ')');
2043 /* Dump a GIMPLE_TRANSACTION tuple on the pretty_printer BUFFER. */
2046 dump_gimple_transaction (pretty_printer
*buffer
, const gtransaction
*gs
,
2047 int spc
, dump_flags_t flags
)
2049 unsigned subcode
= gimple_transaction_subcode (gs
);
2051 if (flags
& TDF_RAW
)
2053 dump_gimple_fmt (buffer
, spc
, flags
,
2054 "%G [SUBCODE=%x,NORM=%T,UNINST=%T,OVER=%T] "
2056 gs
, subcode
, gimple_transaction_label_norm (gs
),
2057 gimple_transaction_label_uninst (gs
),
2058 gimple_transaction_label_over (gs
),
2059 gimple_transaction_body (gs
));
2063 if (subcode
& GTMA_IS_OUTER
)
2064 pp_string (buffer
, "__transaction_atomic [[outer]]");
2065 else if (subcode
& GTMA_IS_RELAXED
)
2066 pp_string (buffer
, "__transaction_relaxed");
2068 pp_string (buffer
, "__transaction_atomic");
2069 subcode
&= ~GTMA_DECLARATION_MASK
;
2071 if (gimple_transaction_body (gs
))
2073 newline_and_indent (buffer
, spc
+ 2);
2074 pp_left_brace (buffer
);
2075 pp_newline (buffer
);
2076 dump_gimple_seq (buffer
, gimple_transaction_body (gs
),
2078 newline_and_indent (buffer
, spc
+ 2);
2079 pp_right_brace (buffer
);
2083 pp_string (buffer
, " //");
2084 if (gimple_transaction_label_norm (gs
))
2086 pp_string (buffer
, " NORM=");
2087 dump_generic_node (buffer
, gimple_transaction_label_norm (gs
),
2090 if (gimple_transaction_label_uninst (gs
))
2092 pp_string (buffer
, " UNINST=");
2093 dump_generic_node (buffer
, gimple_transaction_label_uninst (gs
),
2096 if (gimple_transaction_label_over (gs
))
2098 pp_string (buffer
, " OVER=");
2099 dump_generic_node (buffer
, gimple_transaction_label_over (gs
),
2104 pp_string (buffer
, " SUBCODE=[ ");
2105 if (subcode
& GTMA_HAVE_ABORT
)
2107 pp_string (buffer
, "GTMA_HAVE_ABORT ");
2108 subcode
&= ~GTMA_HAVE_ABORT
;
2110 if (subcode
& GTMA_HAVE_LOAD
)
2112 pp_string (buffer
, "GTMA_HAVE_LOAD ");
2113 subcode
&= ~GTMA_HAVE_LOAD
;
2115 if (subcode
& GTMA_HAVE_STORE
)
2117 pp_string (buffer
, "GTMA_HAVE_STORE ");
2118 subcode
&= ~GTMA_HAVE_STORE
;
2120 if (subcode
& GTMA_MAY_ENTER_IRREVOCABLE
)
2122 pp_string (buffer
, "GTMA_MAY_ENTER_IRREVOCABLE ");
2123 subcode
&= ~GTMA_MAY_ENTER_IRREVOCABLE
;
2125 if (subcode
& GTMA_DOES_GO_IRREVOCABLE
)
2127 pp_string (buffer
, "GTMA_DOES_GO_IRREVOCABLE ");
2128 subcode
&= ~GTMA_DOES_GO_IRREVOCABLE
;
2130 if (subcode
& GTMA_HAS_NO_INSTRUMENTATION
)
2132 pp_string (buffer
, "GTMA_HAS_NO_INSTRUMENTATION ");
2133 subcode
&= ~GTMA_HAS_NO_INSTRUMENTATION
;
2136 pp_printf (buffer
, "0x%x ", subcode
);
2137 pp_right_bracket (buffer
);
2143 /* Dump a GIMPLE_ASM tuple on the pretty_printer BUFFER, SPC spaces of
2144 indent. FLAGS specifies details to show in the dump (see TDF_* in
2148 dump_gimple_asm (pretty_printer
*buffer
, const gasm
*gs
, int spc
,
2151 unsigned int i
, n
, f
, fields
;
2153 if (flags
& TDF_RAW
)
2155 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+STRING <%n%s%n>", gs
,
2156 gimple_asm_string (gs
));
2158 n
= gimple_asm_noutputs (gs
);
2161 newline_and_indent (buffer
, spc
+ 2);
2162 pp_string (buffer
, "OUTPUT: ");
2163 for (i
= 0; i
< n
; i
++)
2165 dump_generic_node (buffer
, gimple_asm_output_op (gs
, i
),
2168 pp_string (buffer
, ", ");
2172 n
= gimple_asm_ninputs (gs
);
2175 newline_and_indent (buffer
, spc
+ 2);
2176 pp_string (buffer
, "INPUT: ");
2177 for (i
= 0; i
< n
; i
++)
2179 dump_generic_node (buffer
, gimple_asm_input_op (gs
, i
),
2182 pp_string (buffer
, ", ");
2186 n
= gimple_asm_nclobbers (gs
);
2189 newline_and_indent (buffer
, spc
+ 2);
2190 pp_string (buffer
, "CLOBBER: ");
2191 for (i
= 0; i
< n
; i
++)
2193 dump_generic_node (buffer
, gimple_asm_clobber_op (gs
, i
),
2196 pp_string (buffer
, ", ");
2200 n
= gimple_asm_nlabels (gs
);
2203 newline_and_indent (buffer
, spc
+ 2);
2204 pp_string (buffer
, "LABEL: ");
2205 for (i
= 0; i
< n
; i
++)
2207 dump_generic_node (buffer
, gimple_asm_label_op (gs
, i
),
2210 pp_string (buffer
, ", ");
2214 newline_and_indent (buffer
, spc
);
2215 pp_greater (buffer
);
2219 pp_string (buffer
, "__asm__");
2220 if (gimple_asm_volatile_p (gs
))
2221 pp_string (buffer
, " __volatile__");
2222 if (gimple_asm_inline_p (gs
))
2223 pp_string (buffer
, " __inline__");
2224 if (gimple_asm_nlabels (gs
))
2225 pp_string (buffer
, " goto");
2226 pp_string (buffer
, "(\"");
2227 pp_string (buffer
, gimple_asm_string (gs
));
2228 pp_string (buffer
, "\"");
2230 if (gimple_asm_nlabels (gs
))
2232 else if (gimple_asm_nclobbers (gs
))
2234 else if (gimple_asm_ninputs (gs
))
2236 else if (gimple_asm_noutputs (gs
))
2241 for (f
= 0; f
< fields
; ++f
)
2243 pp_string (buffer
, " : ");
2248 n
= gimple_asm_noutputs (gs
);
2249 for (i
= 0; i
< n
; i
++)
2251 dump_generic_node (buffer
, gimple_asm_output_op (gs
, i
),
2254 pp_string (buffer
, ", ");
2259 n
= gimple_asm_ninputs (gs
);
2260 for (i
= 0; i
< n
; i
++)
2262 dump_generic_node (buffer
, gimple_asm_input_op (gs
, i
),
2265 pp_string (buffer
, ", ");
2270 n
= gimple_asm_nclobbers (gs
);
2271 for (i
= 0; i
< n
; i
++)
2273 dump_generic_node (buffer
, gimple_asm_clobber_op (gs
, i
),
2276 pp_string (buffer
, ", ");
2281 n
= gimple_asm_nlabels (gs
);
2282 for (i
= 0; i
< n
; i
++)
2284 dump_generic_node (buffer
, gimple_asm_label_op (gs
, i
),
2287 pp_string (buffer
, ", ");
2296 pp_string (buffer
, ");");
2300 /* Dump ptr_info and range_info for NODE on pretty_printer BUFFER with
2301 SPC spaces of indent. */
2304 dump_ssaname_info (pretty_printer
*buffer
, tree node
, int spc
)
2306 if (TREE_CODE (node
) != SSA_NAME
)
2309 if (POINTER_TYPE_P (TREE_TYPE (node
))
2310 && SSA_NAME_PTR_INFO (node
))
2312 unsigned int align
, misalign
;
2313 struct ptr_info_def
*pi
= SSA_NAME_PTR_INFO (node
);
2314 pp_string (buffer
, "# PT = ");
2315 pp_points_to_solution (buffer
, &pi
->pt
);
2316 newline_and_indent (buffer
, spc
);
2317 if (get_ptr_info_alignment (pi
, &align
, &misalign
))
2319 pp_printf (buffer
, "# ALIGN = %u, MISALIGN = %u", align
, misalign
);
2320 newline_and_indent (buffer
, spc
);
2324 if (!POINTER_TYPE_P (TREE_TYPE (node
))
2325 && SSA_NAME_RANGE_INFO (node
))
2327 wide_int min
, max
, nonzero_bits
;
2330 get_global_range_query ()->range_of_expr (r
, node
);
2331 value_range_kind range_type
= r
.kind ();
2332 if (!r
.undefined_p ())
2334 min
= wi::to_wide (r
.min ());
2335 max
= wi::to_wide (r
.max ());
2338 // FIXME: Use irange::dump() instead.
2339 if (range_type
== VR_VARYING
)
2340 pp_printf (buffer
, "# RANGE VR_VARYING");
2341 else if (range_type
== VR_RANGE
|| range_type
== VR_ANTI_RANGE
)
2343 pp_printf (buffer
, "# RANGE ");
2344 pp_printf (buffer
, "%s[", range_type
== VR_RANGE
? "" : "~");
2345 pp_wide_int (buffer
, min
, TYPE_SIGN (TREE_TYPE (node
)));
2346 pp_printf (buffer
, ", ");
2347 pp_wide_int (buffer
, max
, TYPE_SIGN (TREE_TYPE (node
)));
2348 pp_printf (buffer
, "]");
2350 nonzero_bits
= get_nonzero_bits (node
);
2351 if (nonzero_bits
!= -1)
2353 pp_string (buffer
, " NONZERO ");
2354 pp_wide_int (buffer
, nonzero_bits
, UNSIGNED
);
2356 newline_and_indent (buffer
, spc
);
2360 /* As dump_ssaname_info, but dump to FILE. */
2363 dump_ssaname_info_to_file (FILE *file
, tree node
, int spc
)
2365 pretty_printer buffer
;
2366 pp_needs_newline (&buffer
) = true;
2367 buffer
.buffer
->stream
= file
;
2368 dump_ssaname_info (&buffer
, node
, spc
);
2372 /* Dump a PHI node PHI. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1.
2373 The caller is responsible for calling pp_flush on BUFFER to finalize
2374 pretty printer. If COMMENT is true, print this after #. */
2377 dump_gimple_phi (pretty_printer
*buffer
, const gphi
*phi
, int spc
, bool comment
,
2381 tree lhs
= gimple_phi_result (phi
);
2383 if (flags
& TDF_ALIAS
)
2384 dump_ssaname_info (buffer
, lhs
, spc
);
2387 pp_string (buffer
, "# ");
2389 if (flags
& TDF_RAW
)
2390 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, ", phi
,
2391 gimple_phi_result (phi
));
2394 dump_generic_node (buffer
, lhs
, spc
, flags
, false);
2395 if (flags
& TDF_GIMPLE
)
2396 pp_string (buffer
, " = __PHI (");
2398 pp_string (buffer
, " = PHI <");
2400 for (i
= 0; i
< gimple_phi_num_args (phi
); i
++)
2402 if ((flags
& TDF_LINENO
) && gimple_phi_arg_has_location (phi
, i
))
2403 dump_location (buffer
, gimple_phi_arg_location (phi
, i
));
2404 basic_block src
= gimple_phi_arg_edge (phi
, i
)->src
;
2405 if (flags
& TDF_GIMPLE
)
2407 pp_string (buffer
, "__BB");
2408 pp_decimal_int (buffer
, src
->index
);
2409 pp_string (buffer
, ": ");
2411 dump_generic_node (buffer
, gimple_phi_arg_def (phi
, i
), spc
, flags
,
2413 if (! (flags
& TDF_GIMPLE
))
2415 pp_left_paren (buffer
);
2416 pp_decimal_int (buffer
, src
->index
);
2417 pp_right_paren (buffer
);
2419 if (i
< gimple_phi_num_args (phi
) - 1)
2420 pp_string (buffer
, ", ");
2422 if (flags
& TDF_GIMPLE
)
2423 pp_string (buffer
, ");");
2425 pp_greater (buffer
);
2429 /* Dump a GIMPLE_OMP_PARALLEL tuple on the pretty_printer BUFFER, SPC spaces
2430 of indent. FLAGS specifies details to show in the dump (see TDF_* in
2434 dump_gimple_omp_parallel (pretty_printer
*buffer
, const gomp_parallel
*gs
,
2435 int spc
, dump_flags_t flags
)
2437 if (flags
& TDF_RAW
)
2439 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
2440 gimple_omp_body (gs
));
2441 dump_omp_clauses (buffer
, gimple_omp_parallel_clauses (gs
), spc
, flags
);
2442 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T%n>",
2443 gimple_omp_parallel_child_fn (gs
),
2444 gimple_omp_parallel_data_arg (gs
));
2449 pp_string (buffer
, "#pragma omp parallel");
2450 dump_omp_clauses (buffer
, gimple_omp_parallel_clauses (gs
), spc
, flags
);
2451 if (gimple_omp_parallel_child_fn (gs
))
2453 pp_string (buffer
, " [child fn: ");
2454 dump_generic_node (buffer
, gimple_omp_parallel_child_fn (gs
),
2456 pp_string (buffer
, " (");
2457 if (gimple_omp_parallel_data_arg (gs
))
2458 dump_generic_node (buffer
, gimple_omp_parallel_data_arg (gs
),
2461 pp_string (buffer
, "???");
2462 pp_string (buffer
, ")]");
2464 body
= gimple_omp_body (gs
);
2465 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
2467 newline_and_indent (buffer
, spc
+ 2);
2468 pp_left_brace (buffer
);
2469 pp_newline (buffer
);
2470 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
2471 newline_and_indent (buffer
, spc
+ 2);
2472 pp_right_brace (buffer
);
2476 pp_newline (buffer
);
2477 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
2483 /* Dump a GIMPLE_OMP_TASK tuple on the pretty_printer BUFFER, SPC spaces
2484 of indent. FLAGS specifies details to show in the dump (see TDF_* in
2488 dump_gimple_omp_task (pretty_printer
*buffer
, const gomp_task
*gs
, int spc
,
2491 if (flags
& TDF_RAW
)
2493 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
2494 gimple_omp_body (gs
));
2495 dump_omp_clauses (buffer
, gimple_omp_task_clauses (gs
), spc
, flags
);
2496 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T, %T, %T, %T%n>",
2497 gimple_omp_task_child_fn (gs
),
2498 gimple_omp_task_data_arg (gs
),
2499 gimple_omp_task_copy_fn (gs
),
2500 gimple_omp_task_arg_size (gs
),
2501 gimple_omp_task_arg_size (gs
));
2506 if (gimple_omp_task_taskloop_p (gs
))
2507 pp_string (buffer
, "#pragma omp taskloop");
2508 else if (gimple_omp_task_taskwait_p (gs
))
2509 pp_string (buffer
, "#pragma omp taskwait");
2511 pp_string (buffer
, "#pragma omp task");
2512 dump_omp_clauses (buffer
, gimple_omp_task_clauses (gs
), spc
, flags
);
2513 if (gimple_omp_task_child_fn (gs
))
2515 pp_string (buffer
, " [child fn: ");
2516 dump_generic_node (buffer
, gimple_omp_task_child_fn (gs
),
2518 pp_string (buffer
, " (");
2519 if (gimple_omp_task_data_arg (gs
))
2520 dump_generic_node (buffer
, gimple_omp_task_data_arg (gs
),
2523 pp_string (buffer
, "???");
2524 pp_string (buffer
, ")]");
2526 body
= gimple_omp_body (gs
);
2527 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
2529 newline_and_indent (buffer
, spc
+ 2);
2530 pp_left_brace (buffer
);
2531 pp_newline (buffer
);
2532 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
2533 newline_and_indent (buffer
, spc
+ 2);
2534 pp_right_brace (buffer
);
2538 pp_newline (buffer
);
2539 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
2545 /* Dump a GIMPLE_OMP_ATOMIC_LOAD tuple on the pretty_printer BUFFER, SPC
2546 spaces of indent. FLAGS specifies details to show in the dump (see TDF_*
2550 dump_gimple_omp_atomic_load (pretty_printer
*buffer
, const gomp_atomic_load
*gs
,
2551 int spc
, dump_flags_t flags
)
2553 if (flags
& TDF_RAW
)
2555 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T>", gs
,
2556 gimple_omp_atomic_load_lhs (gs
),
2557 gimple_omp_atomic_load_rhs (gs
));
2561 pp_string (buffer
, "#pragma omp atomic_load");
2562 dump_omp_atomic_memory_order (buffer
,
2563 gimple_omp_atomic_memory_order (gs
));
2564 if (gimple_omp_atomic_need_value_p (gs
))
2565 pp_string (buffer
, " [needed]");
2566 if (gimple_omp_atomic_weak_p (gs
))
2567 pp_string (buffer
, " [weak]");
2568 newline_and_indent (buffer
, spc
+ 2);
2569 dump_generic_node (buffer
, gimple_omp_atomic_load_lhs (gs
),
2575 dump_generic_node (buffer
, gimple_omp_atomic_load_rhs (gs
),
2580 /* Dump a GIMPLE_OMP_ATOMIC_STORE tuple on the pretty_printer BUFFER, SPC
2581 spaces of indent. FLAGS specifies details to show in the dump (see TDF_*
2585 dump_gimple_omp_atomic_store (pretty_printer
*buffer
,
2586 const gomp_atomic_store
*gs
, int spc
,
2589 if (flags
& TDF_RAW
)
2591 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
,
2592 gimple_omp_atomic_store_val (gs
));
2596 pp_string (buffer
, "#pragma omp atomic_store");
2597 dump_omp_atomic_memory_order (buffer
,
2598 gimple_omp_atomic_memory_order (gs
));
2600 if (gimple_omp_atomic_need_value_p (gs
))
2601 pp_string (buffer
, "[needed] ");
2602 if (gimple_omp_atomic_weak_p (gs
))
2603 pp_string (buffer
, "[weak] ");
2604 pp_left_paren (buffer
);
2605 dump_generic_node (buffer
, gimple_omp_atomic_store_val (gs
),
2607 pp_right_paren (buffer
);
2612 /* Dump all the memory operands for statement GS. BUFFER, SPC and
2613 FLAGS are as in pp_gimple_stmt_1. */
2616 dump_gimple_mem_ops (pretty_printer
*buffer
, const gimple
*gs
, int spc
,
2619 tree vdef
= gimple_vdef (gs
);
2620 tree vuse
= gimple_vuse (gs
);
2622 if (vdef
!= NULL_TREE
)
2624 pp_string (buffer
, "# ");
2625 dump_generic_node (buffer
, vdef
, spc
+ 2, flags
, false);
2626 pp_string (buffer
, " = VDEF <");
2627 dump_generic_node (buffer
, vuse
, spc
+ 2, flags
, false);
2628 pp_greater (buffer
);
2629 newline_and_indent (buffer
, spc
);
2631 else if (vuse
!= NULL_TREE
)
2633 pp_string (buffer
, "# VUSE <");
2634 dump_generic_node (buffer
, vuse
, spc
+ 2, flags
, false);
2635 pp_greater (buffer
);
2636 newline_and_indent (buffer
, spc
);
2641 /* Print the gimple statement GS on the pretty printer BUFFER, SPC
2642 spaces of indent. FLAGS specifies details to show in the dump (see
2643 TDF_* in dumpfile.h). The caller is responsible for calling
2644 pp_flush on BUFFER to finalize the pretty printer. */
2647 pp_gimple_stmt_1 (pretty_printer
*buffer
, const gimple
*gs
, int spc
,
2653 if (flags
& TDF_STMTADDR
)
2654 pp_printf (buffer
, "<&%p> ", (const void *) gs
);
2656 if ((flags
& TDF_LINENO
) && gimple_has_location (gs
))
2657 dump_location (buffer
, gimple_location (gs
));
2661 int lp_nr
= lookup_stmt_eh_lp (gs
);
2663 pp_printf (buffer
, "[LP %d] ", lp_nr
);
2665 pp_printf (buffer
, "[MNT %d] ", -lp_nr
);
2668 if ((flags
& (TDF_VOPS
|TDF_MEMSYMS
))
2669 && gimple_has_mem_ops (gs
))
2670 dump_gimple_mem_ops (buffer
, gs
, spc
, flags
);
2672 if (gimple_has_lhs (gs
)
2673 && (flags
& TDF_ALIAS
))
2674 dump_ssaname_info (buffer
, gimple_get_lhs (gs
), spc
);
2676 switch (gimple_code (gs
))
2679 dump_gimple_asm (buffer
, as_a
<const gasm
*> (gs
), spc
, flags
);
2683 dump_gimple_assign (buffer
, as_a
<const gassign
*> (gs
), spc
, flags
);
2687 dump_gimple_bind (buffer
, as_a
<const gbind
*> (gs
), spc
, flags
);
2691 dump_gimple_call (buffer
, as_a
<const gcall
*> (gs
), spc
, flags
);
2695 dump_gimple_cond (buffer
, as_a
<const gcond
*> (gs
), spc
, flags
);
2699 dump_gimple_label (buffer
, as_a
<const glabel
*> (gs
), spc
, flags
);
2703 dump_gimple_goto (buffer
, as_a
<const ggoto
*> (gs
), spc
, flags
);
2707 pp_string (buffer
, "GIMPLE_NOP");
2711 dump_gimple_return (buffer
, as_a
<const greturn
*> (gs
), spc
, flags
);
2715 dump_gimple_switch (buffer
, as_a
<const gswitch
*> (gs
), spc
, flags
);
2719 dump_gimple_try (buffer
, as_a
<const gtry
*> (gs
), spc
, flags
);
2723 dump_gimple_phi (buffer
, as_a
<const gphi
*> (gs
), spc
, false, flags
);
2726 case GIMPLE_OMP_PARALLEL
:
2727 dump_gimple_omp_parallel (buffer
, as_a
<const gomp_parallel
*> (gs
), spc
,
2731 case GIMPLE_OMP_TASK
:
2732 dump_gimple_omp_task (buffer
, as_a
<const gomp_task
*> (gs
), spc
, flags
);
2735 case GIMPLE_OMP_ATOMIC_LOAD
:
2736 dump_gimple_omp_atomic_load (buffer
, as_a
<const gomp_atomic_load
*> (gs
),
2740 case GIMPLE_OMP_ATOMIC_STORE
:
2741 dump_gimple_omp_atomic_store (buffer
,
2742 as_a
<const gomp_atomic_store
*> (gs
),
2746 case GIMPLE_OMP_FOR
:
2747 dump_gimple_omp_for (buffer
, as_a
<const gomp_for
*> (gs
), spc
, flags
);
2750 case GIMPLE_OMP_CONTINUE
:
2751 dump_gimple_omp_continue (buffer
, as_a
<const gomp_continue
*> (gs
), spc
,
2755 case GIMPLE_OMP_SINGLE
:
2756 dump_gimple_omp_single (buffer
, as_a
<const gomp_single
*> (gs
), spc
,
2760 case GIMPLE_OMP_TARGET
:
2761 dump_gimple_omp_target (buffer
, as_a
<const gomp_target
*> (gs
), spc
,
2765 case GIMPLE_OMP_TEAMS
:
2766 dump_gimple_omp_teams (buffer
, as_a
<const gomp_teams
*> (gs
), spc
,
2770 case GIMPLE_OMP_RETURN
:
2771 dump_gimple_omp_return (buffer
, gs
, spc
, flags
);
2774 case GIMPLE_OMP_SECTIONS
:
2775 dump_gimple_omp_sections (buffer
, as_a
<const gomp_sections
*> (gs
),
2779 case GIMPLE_OMP_SECTIONS_SWITCH
:
2780 pp_string (buffer
, "GIMPLE_SECTIONS_SWITCH");
2783 case GIMPLE_OMP_TASKGROUP
:
2784 dump_gimple_omp_taskgroup (buffer
, gs
, spc
, flags
);
2787 case GIMPLE_OMP_MASKED
:
2788 dump_gimple_omp_masked (buffer
, gs
, spc
, flags
);
2791 case GIMPLE_OMP_SCOPE
:
2792 dump_gimple_omp_scope (buffer
, gs
, spc
, flags
);
2795 case GIMPLE_OMP_MASTER
:
2796 case GIMPLE_OMP_SECTION
:
2797 dump_gimple_omp_block (buffer
, gs
, spc
, flags
);
2800 case GIMPLE_OMP_ORDERED
:
2801 dump_gimple_omp_ordered (buffer
, as_a
<const gomp_ordered
*> (gs
), spc
,
2805 case GIMPLE_OMP_SCAN
:
2806 dump_gimple_omp_scan (buffer
, as_a
<const gomp_scan
*> (gs
), spc
,
2810 case GIMPLE_OMP_CRITICAL
:
2811 dump_gimple_omp_critical (buffer
, as_a
<const gomp_critical
*> (gs
), spc
,
2816 dump_gimple_catch (buffer
, as_a
<const gcatch
*> (gs
), spc
, flags
);
2819 case GIMPLE_EH_FILTER
:
2820 dump_gimple_eh_filter (buffer
, as_a
<const geh_filter
*> (gs
), spc
,
2824 case GIMPLE_EH_MUST_NOT_THROW
:
2825 dump_gimple_eh_must_not_throw (buffer
,
2826 as_a
<const geh_mnt
*> (gs
),
2830 case GIMPLE_EH_ELSE
:
2831 dump_gimple_eh_else (buffer
, as_a
<const geh_else
*> (gs
), spc
, flags
);
2835 dump_gimple_resx (buffer
, as_a
<const gresx
*> (gs
), spc
, flags
);
2838 case GIMPLE_EH_DISPATCH
:
2839 dump_gimple_eh_dispatch (buffer
, as_a
<const geh_dispatch
*> (gs
), spc
,
2844 dump_gimple_debug (buffer
, as_a
<const gdebug
*> (gs
), spc
, flags
);
2847 case GIMPLE_PREDICT
:
2848 pp_string (buffer
, "// predicted ");
2849 if (gimple_predict_outcome (gs
))
2850 pp_string (buffer
, "likely by ");
2852 pp_string (buffer
, "unlikely by ");
2853 pp_string (buffer
, predictor_name (gimple_predict_predictor (gs
)));
2854 pp_string (buffer
, " predictor.");
2857 case GIMPLE_TRANSACTION
:
2858 dump_gimple_transaction (buffer
, as_a
<const gtransaction
*> (gs
), spc
,
2868 /* Dumps header of basic block BB to OUTF indented by INDENT
2869 spaces and details described by flags. */
2872 dump_gimple_bb_header (FILE *outf
, basic_block bb
, int indent
,
2875 if (flags
& TDF_BLOCKS
)
2877 if (flags
& TDF_LINENO
)
2879 gimple_stmt_iterator gsi
;
2881 fputs (";; ", outf
);
2883 for (gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
); gsi_next (&gsi
))
2884 if (!is_gimple_debug (gsi_stmt (gsi
))
2885 && get_lineno (gsi_stmt (gsi
)) != UNKNOWN_LOCATION
)
2887 fprintf (outf
, "%*sstarting at line %d",
2888 indent
, "", get_lineno (gsi_stmt (gsi
)));
2891 if (bb
->discriminator
)
2892 fprintf (outf
, ", discriminator %i", bb
->discriminator
);
2898 if (flags
& TDF_GIMPLE
)
2900 fprintf (outf
, "%*s__BB(%d", indent
, "", bb
->index
);
2901 if (bb
->loop_father
->header
== bb
)
2902 fprintf (outf
, ",loop_header(%d)", bb
->loop_father
->num
);
2903 if (bb
->count
.initialized_p ())
2904 fprintf (outf
, ",%s(%" PRIu64
")",
2905 profile_quality_as_string (bb
->count
.quality ()),
2906 bb
->count
.value ());
2907 fprintf (outf
, "):\n");
2910 fprintf (outf
, "%*s<bb %d> %s:\n",
2911 indent
, "", bb
->index
, dump_profile (bb
->count
));
2916 /* Dumps end of basic block BB to buffer BUFFER indented by INDENT
2920 dump_gimple_bb_footer (FILE *outf ATTRIBUTE_UNUSED
,
2921 basic_block bb ATTRIBUTE_UNUSED
,
2922 int indent ATTRIBUTE_UNUSED
,
2923 dump_flags_t flags ATTRIBUTE_UNUSED
)
2925 /* There is currently no GIMPLE-specific basic block info to dump. */
2930 /* Dump PHI nodes of basic block BB to BUFFER with details described
2931 by FLAGS and indented by INDENT spaces. */
2934 dump_phi_nodes (pretty_printer
*buffer
, basic_block bb
, int indent
,
2939 for (i
= gsi_start_phis (bb
); !gsi_end_p (i
); gsi_next (&i
))
2941 gphi
*phi
= i
.phi ();
2942 if (!virtual_operand_p (gimple_phi_result (phi
)) || (flags
& TDF_VOPS
))
2945 dump_gimple_phi (buffer
, phi
, indent
,
2946 (flags
& TDF_GIMPLE
) ? false : true, flags
);
2947 pp_newline (buffer
);
2953 /* Dump jump to basic block BB that is represented implicitly in the cfg
2957 pp_cfg_jump (pretty_printer
*buffer
, edge e
, dump_flags_t flags
)
2959 if (flags
& TDF_GIMPLE
)
2961 pp_string (buffer
, "goto __BB");
2962 pp_decimal_int (buffer
, e
->dest
->index
);
2963 if (e
->probability
.initialized_p ())
2965 pp_string (buffer
, "(");
2967 profile_quality_as_string (e
->probability
.quality ()));
2968 pp_string (buffer
, "(");
2969 pp_decimal_int (buffer
, e
->probability
.value ());
2970 pp_string (buffer
, "))");
2972 pp_semicolon (buffer
);
2976 pp_string (buffer
, "goto <bb ");
2977 pp_decimal_int (buffer
, e
->dest
->index
);
2978 pp_greater (buffer
);
2979 pp_semicolon (buffer
);
2981 dump_edge_probability (buffer
, e
);
2986 /* Dump edges represented implicitly in basic block BB to BUFFER, indented
2987 by INDENT spaces, with details given by FLAGS. */
2990 dump_implicit_edges (pretty_printer
*buffer
, basic_block bb
, int indent
,
2996 stmt
= last_stmt (bb
);
2998 if (stmt
&& gimple_code (stmt
) == GIMPLE_COND
)
3000 edge true_edge
, false_edge
;
3002 /* When we are emitting the code or changing CFG, it is possible that
3003 the edges are not yet created. When we are using debug_bb in such
3004 a situation, we do not want it to crash. */
3005 if (EDGE_COUNT (bb
->succs
) != 2)
3007 extract_true_false_edges_from_block (bb
, &true_edge
, &false_edge
);
3009 INDENT (indent
+ 2);
3010 pp_cfg_jump (buffer
, true_edge
, flags
);
3011 newline_and_indent (buffer
, indent
);
3012 pp_string (buffer
, "else");
3013 newline_and_indent (buffer
, indent
+ 2);
3014 pp_cfg_jump (buffer
, false_edge
, flags
);
3015 pp_newline (buffer
);
3019 /* If there is a fallthru edge, we may need to add an artificial
3020 goto to the dump. */
3021 e
= find_fallthru_edge (bb
->succs
);
3023 if (e
&& (e
->dest
!= bb
->next_bb
|| (flags
& TDF_GIMPLE
)))
3027 if ((flags
& TDF_LINENO
)
3028 && e
->goto_locus
!= UNKNOWN_LOCATION
)
3029 dump_location (buffer
, e
->goto_locus
);
3031 pp_cfg_jump (buffer
, e
, flags
);
3032 pp_newline (buffer
);
3037 /* Dumps basic block BB to buffer BUFFER with details described by FLAGS and
3038 indented by INDENT spaces. */
3041 gimple_dump_bb_buff (pretty_printer
*buffer
, basic_block bb
, int indent
,
3044 gimple_stmt_iterator gsi
;
3046 int label_indent
= indent
- 2;
3048 if (label_indent
< 0)
3051 dump_phi_nodes (buffer
, bb
, indent
, flags
);
3053 for (gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
); gsi_next (&gsi
))
3057 stmt
= gsi_stmt (gsi
);
3059 curr_indent
= gimple_code (stmt
) == GIMPLE_LABEL
? label_indent
: indent
;
3061 INDENT (curr_indent
);
3062 pp_gimple_stmt_1 (buffer
, stmt
, curr_indent
, flags
);
3063 pp_newline_and_flush (buffer
);
3064 gcc_checking_assert (DECL_STRUCT_FUNCTION (current_function_decl
));
3065 dump_histograms_for_stmt (DECL_STRUCT_FUNCTION (current_function_decl
),
3066 pp_buffer (buffer
)->stream
, stmt
);
3069 dump_implicit_edges (buffer
, bb
, indent
, flags
);
3074 /* Dumps basic block BB to FILE with details described by FLAGS and
3075 indented by INDENT spaces. */
3078 gimple_dump_bb (FILE *file
, basic_block bb
, int indent
, dump_flags_t flags
)
3080 dump_gimple_bb_header (file
, bb
, indent
, flags
);
3081 if (bb
->index
>= NUM_FIXED_BLOCKS
)
3083 pretty_printer buffer
;
3084 pp_needs_newline (&buffer
) = true;
3085 buffer
.buffer
->stream
= file
;
3086 gimple_dump_bb_buff (&buffer
, bb
, indent
, flags
);
3088 dump_gimple_bb_footer (file
, bb
, indent
, flags
);
3091 /* Dumps basic block BB to pretty-printer PP with default dump flags and
3092 no indentation, for use as a label of a DOT graph record-node.
3093 ??? Should just use gimple_dump_bb_buff here, except that value profiling
3094 histogram dumping doesn't know about pretty-printers. */
3097 gimple_dump_bb_for_graph (pretty_printer
*pp
, basic_block bb
)
3099 pp_printf (pp
, "<bb %d>:\n", bb
->index
);
3100 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
3102 for (gphi_iterator gsi
= gsi_start_phis (bb
); !gsi_end_p (gsi
);
3105 gphi
*phi
= gsi
.phi ();
3106 if (!virtual_operand_p (gimple_phi_result (phi
))
3107 || (dump_flags
& TDF_VOPS
))
3110 pp_write_text_to_stream (pp
);
3111 pp_string (pp
, "# ");
3112 pp_gimple_stmt_1 (pp
, phi
, 0, dump_flags
);
3114 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
3118 for (gimple_stmt_iterator gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
);
3121 gimple
*stmt
= gsi_stmt (gsi
);
3123 pp_write_text_to_stream (pp
);
3124 pp_gimple_stmt_1 (pp
, stmt
, 0, dump_flags
);
3126 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
3128 dump_implicit_edges (pp
, bb
, 0, dump_flags
);
3129 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
3133 # pragma GCC diagnostic pop