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_EXIT_DATA
:
1701 kind
= " oacc_enter_exit_data";
1703 case GF_OMP_TARGET_KIND_OACC_DECLARE
:
1704 kind
= " oacc_declare";
1706 case GF_OMP_TARGET_KIND_OACC_HOST_DATA
:
1707 kind
= " oacc_host_data";
1709 case GF_OMP_TARGET_KIND_OACC_PARALLEL_KERNELS_PARALLELIZED
:
1710 kind
= " oacc_parallel_kernels_parallelized";
1712 case GF_OMP_TARGET_KIND_OACC_PARALLEL_KERNELS_GANG_SINGLE
:
1713 kind
= " oacc_parallel_kernels_gang_single";
1715 case GF_OMP_TARGET_KIND_OACC_DATA_KERNELS
:
1716 kind
= " oacc_data_kernels";
1721 if (flags
& TDF_RAW
)
1723 dump_gimple_fmt (buffer
, spc
, flags
, "%G%s <%+BODY <%S>%nCLAUSES <", gs
,
1724 kind
, gimple_omp_body (gs
));
1725 dump_omp_clauses (buffer
, gimple_omp_target_clauses (gs
), spc
, flags
);
1726 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T%n>",
1727 gimple_omp_target_child_fn (gs
),
1728 gimple_omp_target_data_arg (gs
));
1732 pp_string (buffer
, "#pragma omp target");
1733 pp_string (buffer
, kind
);
1734 dump_omp_clauses (buffer
, gimple_omp_target_clauses (gs
), spc
, flags
);
1735 if (gimple_omp_target_child_fn (gs
))
1737 pp_string (buffer
, " [child fn: ");
1738 dump_generic_node (buffer
, gimple_omp_target_child_fn (gs
),
1740 pp_string (buffer
, " (");
1741 if (gimple_omp_target_data_arg (gs
))
1742 dump_generic_node (buffer
, gimple_omp_target_data_arg (gs
),
1745 pp_string (buffer
, "???");
1746 pp_string (buffer
, ")]");
1748 gimple_seq body
= gimple_omp_body (gs
);
1749 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
1751 newline_and_indent (buffer
, spc
+ 2);
1752 pp_left_brace (buffer
);
1753 pp_newline (buffer
);
1754 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
1755 newline_and_indent (buffer
, spc
+ 2);
1756 pp_right_brace (buffer
);
1760 pp_newline (buffer
);
1761 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
1766 /* Dump a GIMPLE_OMP_TEAMS tuple on the pretty_printer BUFFER. */
1769 dump_gimple_omp_teams (pretty_printer
*buffer
, const gomp_teams
*gs
, int spc
,
1772 if (flags
& TDF_RAW
)
1774 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1775 gimple_omp_body (gs
));
1776 dump_omp_clauses (buffer
, gimple_omp_teams_clauses (gs
), spc
, flags
);
1777 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1781 pp_string (buffer
, "#pragma omp teams");
1782 dump_omp_clauses (buffer
, gimple_omp_teams_clauses (gs
), spc
, flags
);
1783 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1785 newline_and_indent (buffer
, spc
+ 2);
1786 pp_character (buffer
, '{');
1787 pp_newline (buffer
);
1788 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1789 newline_and_indent (buffer
, spc
+ 2);
1790 pp_character (buffer
, '}');
1795 /* Dump a GIMPLE_OMP_SECTIONS tuple on the pretty_printer BUFFER. */
1798 dump_gimple_omp_sections (pretty_printer
*buffer
, const gomp_sections
*gs
,
1799 int spc
, dump_flags_t flags
)
1801 if (flags
& TDF_RAW
)
1803 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1804 gimple_omp_body (gs
));
1805 dump_omp_clauses (buffer
, gimple_omp_sections_clauses (gs
), spc
, flags
);
1806 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1810 pp_string (buffer
, "#pragma omp sections");
1811 if (gimple_omp_sections_control (gs
))
1813 pp_string (buffer
, " <");
1814 dump_generic_node (buffer
, gimple_omp_sections_control (gs
), spc
,
1816 pp_greater (buffer
);
1818 dump_omp_clauses (buffer
, gimple_omp_sections_clauses (gs
), spc
, flags
);
1819 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1821 newline_and_indent (buffer
, spc
+ 2);
1822 pp_left_brace (buffer
);
1823 pp_newline (buffer
);
1824 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1825 newline_and_indent (buffer
, spc
+ 2);
1826 pp_right_brace (buffer
);
1831 /* Dump a GIMPLE_OMP_{MASTER,ORDERED,SECTION} tuple on the
1832 pretty_printer BUFFER. */
1835 dump_gimple_omp_block (pretty_printer
*buffer
, const gimple
*gs
, int spc
,
1838 if (flags
& TDF_RAW
)
1839 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1840 gimple_omp_body (gs
));
1843 switch (gimple_code (gs
))
1845 case GIMPLE_OMP_MASTER
:
1846 pp_string (buffer
, "#pragma omp master");
1848 case GIMPLE_OMP_SECTION
:
1849 pp_string (buffer
, "#pragma omp section");
1854 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1856 newline_and_indent (buffer
, spc
+ 2);
1857 pp_left_brace (buffer
);
1858 pp_newline (buffer
);
1859 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1860 newline_and_indent (buffer
, spc
+ 2);
1861 pp_right_brace (buffer
);
1866 /* Dump a GIMPLE_OMP_CRITICAL tuple on the pretty_printer BUFFER. */
1869 dump_gimple_omp_critical (pretty_printer
*buffer
, const gomp_critical
*gs
,
1870 int spc
, dump_flags_t flags
)
1872 if (flags
& TDF_RAW
)
1873 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1874 gimple_omp_body (gs
));
1877 pp_string (buffer
, "#pragma omp critical");
1878 if (gimple_omp_critical_name (gs
))
1880 pp_string (buffer
, " (");
1881 dump_generic_node (buffer
, gimple_omp_critical_name (gs
), spc
,
1883 pp_right_paren (buffer
);
1885 dump_omp_clauses (buffer
, gimple_omp_critical_clauses (gs
), spc
, flags
);
1886 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1888 newline_and_indent (buffer
, spc
+ 2);
1889 pp_left_brace (buffer
);
1890 pp_newline (buffer
);
1891 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1892 newline_and_indent (buffer
, spc
+ 2);
1893 pp_right_brace (buffer
);
1898 /* Dump a GIMPLE_OMP_ORDERED tuple on the pretty_printer BUFFER. */
1901 dump_gimple_omp_ordered (pretty_printer
*buffer
, const gomp_ordered
*gs
,
1902 int spc
, dump_flags_t flags
)
1904 if (flags
& TDF_RAW
)
1905 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1906 gimple_omp_body (gs
));
1909 pp_string (buffer
, "#pragma omp ordered");
1910 dump_omp_clauses (buffer
, gimple_omp_ordered_clauses (gs
), spc
, flags
);
1911 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1913 newline_and_indent (buffer
, spc
+ 2);
1914 pp_left_brace (buffer
);
1915 pp_newline (buffer
);
1916 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1917 newline_and_indent (buffer
, spc
+ 2);
1918 pp_right_brace (buffer
);
1923 /* Dump a GIMPLE_OMP_SCAN tuple on the pretty_printer BUFFER. */
1926 dump_gimple_omp_scan (pretty_printer
*buffer
, const gomp_scan
*gs
,
1927 int spc
, dump_flags_t flags
)
1929 if (flags
& TDF_RAW
)
1930 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1931 gimple_omp_body (gs
));
1934 if (gimple_omp_scan_clauses (gs
))
1936 pp_string (buffer
, "#pragma omp scan");
1937 dump_omp_clauses (buffer
, gimple_omp_scan_clauses (gs
), spc
, flags
);
1939 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1941 newline_and_indent (buffer
, spc
+ 2);
1942 pp_left_brace (buffer
);
1943 pp_newline (buffer
);
1944 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1945 newline_and_indent (buffer
, spc
+ 2);
1946 pp_right_brace (buffer
);
1951 /* Dump a GIMPLE_OMP_RETURN tuple on the pretty_printer BUFFER. */
1954 dump_gimple_omp_return (pretty_printer
*buffer
, const gimple
*gs
, int spc
,
1957 if (flags
& TDF_RAW
)
1959 dump_gimple_fmt (buffer
, spc
, flags
, "%G <nowait=%d", gs
,
1960 (int) gimple_omp_return_nowait_p (gs
));
1961 if (gimple_omp_return_lhs (gs
))
1962 dump_gimple_fmt (buffer
, spc
, flags
, ", lhs=%T>",
1963 gimple_omp_return_lhs (gs
));
1965 dump_gimple_fmt (buffer
, spc
, flags
, ">");
1969 pp_string (buffer
, "#pragma omp return");
1970 if (gimple_omp_return_nowait_p (gs
))
1971 pp_string (buffer
, "(nowait)");
1972 if (gimple_omp_return_lhs (gs
))
1974 pp_string (buffer
, " (set ");
1975 dump_generic_node (buffer
, gimple_omp_return_lhs (gs
),
1977 pp_character (buffer
, ')');
1982 /* Dump a GIMPLE_TRANSACTION tuple on the pretty_printer BUFFER. */
1985 dump_gimple_transaction (pretty_printer
*buffer
, const gtransaction
*gs
,
1986 int spc
, dump_flags_t flags
)
1988 unsigned subcode
= gimple_transaction_subcode (gs
);
1990 if (flags
& TDF_RAW
)
1992 dump_gimple_fmt (buffer
, spc
, flags
,
1993 "%G [SUBCODE=%x,NORM=%T,UNINST=%T,OVER=%T] "
1995 gs
, subcode
, gimple_transaction_label_norm (gs
),
1996 gimple_transaction_label_uninst (gs
),
1997 gimple_transaction_label_over (gs
),
1998 gimple_transaction_body (gs
));
2002 if (subcode
& GTMA_IS_OUTER
)
2003 pp_string (buffer
, "__transaction_atomic [[outer]]");
2004 else if (subcode
& GTMA_IS_RELAXED
)
2005 pp_string (buffer
, "__transaction_relaxed");
2007 pp_string (buffer
, "__transaction_atomic");
2008 subcode
&= ~GTMA_DECLARATION_MASK
;
2010 if (gimple_transaction_body (gs
))
2012 newline_and_indent (buffer
, spc
+ 2);
2013 pp_left_brace (buffer
);
2014 pp_newline (buffer
);
2015 dump_gimple_seq (buffer
, gimple_transaction_body (gs
),
2017 newline_and_indent (buffer
, spc
+ 2);
2018 pp_right_brace (buffer
);
2022 pp_string (buffer
, " //");
2023 if (gimple_transaction_label_norm (gs
))
2025 pp_string (buffer
, " NORM=");
2026 dump_generic_node (buffer
, gimple_transaction_label_norm (gs
),
2029 if (gimple_transaction_label_uninst (gs
))
2031 pp_string (buffer
, " UNINST=");
2032 dump_generic_node (buffer
, gimple_transaction_label_uninst (gs
),
2035 if (gimple_transaction_label_over (gs
))
2037 pp_string (buffer
, " OVER=");
2038 dump_generic_node (buffer
, gimple_transaction_label_over (gs
),
2043 pp_string (buffer
, " SUBCODE=[ ");
2044 if (subcode
& GTMA_HAVE_ABORT
)
2046 pp_string (buffer
, "GTMA_HAVE_ABORT ");
2047 subcode
&= ~GTMA_HAVE_ABORT
;
2049 if (subcode
& GTMA_HAVE_LOAD
)
2051 pp_string (buffer
, "GTMA_HAVE_LOAD ");
2052 subcode
&= ~GTMA_HAVE_LOAD
;
2054 if (subcode
& GTMA_HAVE_STORE
)
2056 pp_string (buffer
, "GTMA_HAVE_STORE ");
2057 subcode
&= ~GTMA_HAVE_STORE
;
2059 if (subcode
& GTMA_MAY_ENTER_IRREVOCABLE
)
2061 pp_string (buffer
, "GTMA_MAY_ENTER_IRREVOCABLE ");
2062 subcode
&= ~GTMA_MAY_ENTER_IRREVOCABLE
;
2064 if (subcode
& GTMA_DOES_GO_IRREVOCABLE
)
2066 pp_string (buffer
, "GTMA_DOES_GO_IRREVOCABLE ");
2067 subcode
&= ~GTMA_DOES_GO_IRREVOCABLE
;
2069 if (subcode
& GTMA_HAS_NO_INSTRUMENTATION
)
2071 pp_string (buffer
, "GTMA_HAS_NO_INSTRUMENTATION ");
2072 subcode
&= ~GTMA_HAS_NO_INSTRUMENTATION
;
2075 pp_printf (buffer
, "0x%x ", subcode
);
2076 pp_right_bracket (buffer
);
2082 /* Dump a GIMPLE_ASM tuple on the pretty_printer BUFFER, SPC spaces of
2083 indent. FLAGS specifies details to show in the dump (see TDF_* in
2087 dump_gimple_asm (pretty_printer
*buffer
, const gasm
*gs
, int spc
,
2090 unsigned int i
, n
, f
, fields
;
2092 if (flags
& TDF_RAW
)
2094 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+STRING <%n%s%n>", gs
,
2095 gimple_asm_string (gs
));
2097 n
= gimple_asm_noutputs (gs
);
2100 newline_and_indent (buffer
, spc
+ 2);
2101 pp_string (buffer
, "OUTPUT: ");
2102 for (i
= 0; i
< n
; i
++)
2104 dump_generic_node (buffer
, gimple_asm_output_op (gs
, i
),
2107 pp_string (buffer
, ", ");
2111 n
= gimple_asm_ninputs (gs
);
2114 newline_and_indent (buffer
, spc
+ 2);
2115 pp_string (buffer
, "INPUT: ");
2116 for (i
= 0; i
< n
; i
++)
2118 dump_generic_node (buffer
, gimple_asm_input_op (gs
, i
),
2121 pp_string (buffer
, ", ");
2125 n
= gimple_asm_nclobbers (gs
);
2128 newline_and_indent (buffer
, spc
+ 2);
2129 pp_string (buffer
, "CLOBBER: ");
2130 for (i
= 0; i
< n
; i
++)
2132 dump_generic_node (buffer
, gimple_asm_clobber_op (gs
, i
),
2135 pp_string (buffer
, ", ");
2139 n
= gimple_asm_nlabels (gs
);
2142 newline_and_indent (buffer
, spc
+ 2);
2143 pp_string (buffer
, "LABEL: ");
2144 for (i
= 0; i
< n
; i
++)
2146 dump_generic_node (buffer
, gimple_asm_label_op (gs
, i
),
2149 pp_string (buffer
, ", ");
2153 newline_and_indent (buffer
, spc
);
2154 pp_greater (buffer
);
2158 pp_string (buffer
, "__asm__");
2159 if (gimple_asm_volatile_p (gs
))
2160 pp_string (buffer
, " __volatile__");
2161 if (gimple_asm_inline_p (gs
))
2162 pp_string (buffer
, " __inline__");
2163 if (gimple_asm_nlabels (gs
))
2164 pp_string (buffer
, " goto");
2165 pp_string (buffer
, "(\"");
2166 pp_string (buffer
, gimple_asm_string (gs
));
2167 pp_string (buffer
, "\"");
2169 if (gimple_asm_nlabels (gs
))
2171 else if (gimple_asm_nclobbers (gs
))
2173 else if (gimple_asm_ninputs (gs
))
2175 else if (gimple_asm_noutputs (gs
))
2180 for (f
= 0; f
< fields
; ++f
)
2182 pp_string (buffer
, " : ");
2187 n
= gimple_asm_noutputs (gs
);
2188 for (i
= 0; i
< n
; i
++)
2190 dump_generic_node (buffer
, gimple_asm_output_op (gs
, i
),
2193 pp_string (buffer
, ", ");
2198 n
= gimple_asm_ninputs (gs
);
2199 for (i
= 0; i
< n
; i
++)
2201 dump_generic_node (buffer
, gimple_asm_input_op (gs
, i
),
2204 pp_string (buffer
, ", ");
2209 n
= gimple_asm_nclobbers (gs
);
2210 for (i
= 0; i
< n
; i
++)
2212 dump_generic_node (buffer
, gimple_asm_clobber_op (gs
, i
),
2215 pp_string (buffer
, ", ");
2220 n
= gimple_asm_nlabels (gs
);
2221 for (i
= 0; i
< n
; i
++)
2223 dump_generic_node (buffer
, gimple_asm_label_op (gs
, i
),
2226 pp_string (buffer
, ", ");
2235 pp_string (buffer
, ");");
2239 /* Dump ptr_info and range_info for NODE on pretty_printer BUFFER with
2240 SPC spaces of indent. */
2243 dump_ssaname_info (pretty_printer
*buffer
, tree node
, int spc
)
2245 if (TREE_CODE (node
) != SSA_NAME
)
2248 if (POINTER_TYPE_P (TREE_TYPE (node
))
2249 && SSA_NAME_PTR_INFO (node
))
2251 unsigned int align
, misalign
;
2252 struct ptr_info_def
*pi
= SSA_NAME_PTR_INFO (node
);
2253 pp_string (buffer
, "# PT = ");
2254 pp_points_to_solution (buffer
, &pi
->pt
);
2255 newline_and_indent (buffer
, spc
);
2256 if (get_ptr_info_alignment (pi
, &align
, &misalign
))
2258 pp_printf (buffer
, "# ALIGN = %u, MISALIGN = %u", align
, misalign
);
2259 newline_and_indent (buffer
, spc
);
2263 if (!POINTER_TYPE_P (TREE_TYPE (node
))
2264 && SSA_NAME_RANGE_INFO (node
))
2266 wide_int min
, max
, nonzero_bits
;
2269 get_global_range_query ()->range_of_expr (r
, node
);
2270 value_range_kind range_type
= r
.kind ();
2271 if (!r
.undefined_p ())
2273 min
= wi::to_wide (r
.min ());
2274 max
= wi::to_wide (r
.max ());
2277 // FIXME: Use irange::dump() instead.
2278 if (range_type
== VR_VARYING
)
2279 pp_printf (buffer
, "# RANGE VR_VARYING");
2280 else if (range_type
== VR_RANGE
|| range_type
== VR_ANTI_RANGE
)
2282 pp_printf (buffer
, "# RANGE ");
2283 pp_printf (buffer
, "%s[", range_type
== VR_RANGE
? "" : "~");
2284 pp_wide_int (buffer
, min
, TYPE_SIGN (TREE_TYPE (node
)));
2285 pp_printf (buffer
, ", ");
2286 pp_wide_int (buffer
, max
, TYPE_SIGN (TREE_TYPE (node
)));
2287 pp_printf (buffer
, "]");
2289 nonzero_bits
= get_nonzero_bits (node
);
2290 if (nonzero_bits
!= -1)
2292 pp_string (buffer
, " NONZERO ");
2293 pp_wide_int (buffer
, nonzero_bits
, UNSIGNED
);
2295 newline_and_indent (buffer
, spc
);
2299 /* As dump_ssaname_info, but dump to FILE. */
2302 dump_ssaname_info_to_file (FILE *file
, tree node
, int spc
)
2304 pretty_printer buffer
;
2305 pp_needs_newline (&buffer
) = true;
2306 buffer
.buffer
->stream
= file
;
2307 dump_ssaname_info (&buffer
, node
, spc
);
2311 /* Dump a PHI node PHI. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1.
2312 The caller is responsible for calling pp_flush on BUFFER to finalize
2313 pretty printer. If COMMENT is true, print this after #. */
2316 dump_gimple_phi (pretty_printer
*buffer
, const gphi
*phi
, int spc
, bool comment
,
2320 tree lhs
= gimple_phi_result (phi
);
2322 if (flags
& TDF_ALIAS
)
2323 dump_ssaname_info (buffer
, lhs
, spc
);
2326 pp_string (buffer
, "# ");
2328 if (flags
& TDF_RAW
)
2329 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, ", phi
,
2330 gimple_phi_result (phi
));
2333 dump_generic_node (buffer
, lhs
, spc
, flags
, false);
2334 if (flags
& TDF_GIMPLE
)
2335 pp_string (buffer
, " = __PHI (");
2337 pp_string (buffer
, " = PHI <");
2339 for (i
= 0; i
< gimple_phi_num_args (phi
); i
++)
2341 if ((flags
& TDF_LINENO
) && gimple_phi_arg_has_location (phi
, i
))
2342 dump_location (buffer
, gimple_phi_arg_location (phi
, i
));
2343 basic_block src
= gimple_phi_arg_edge (phi
, i
)->src
;
2344 if (flags
& TDF_GIMPLE
)
2346 pp_string (buffer
, "__BB");
2347 pp_decimal_int (buffer
, src
->index
);
2348 pp_string (buffer
, ": ");
2350 dump_generic_node (buffer
, gimple_phi_arg_def (phi
, i
), spc
, flags
,
2352 if (! (flags
& TDF_GIMPLE
))
2354 pp_left_paren (buffer
);
2355 pp_decimal_int (buffer
, src
->index
);
2356 pp_right_paren (buffer
);
2358 if (i
< gimple_phi_num_args (phi
) - 1)
2359 pp_string (buffer
, ", ");
2361 if (flags
& TDF_GIMPLE
)
2362 pp_string (buffer
, ");");
2364 pp_greater (buffer
);
2368 /* Dump a GIMPLE_OMP_PARALLEL tuple on the pretty_printer BUFFER, SPC spaces
2369 of indent. FLAGS specifies details to show in the dump (see TDF_* in
2373 dump_gimple_omp_parallel (pretty_printer
*buffer
, const gomp_parallel
*gs
,
2374 int spc
, dump_flags_t flags
)
2376 if (flags
& TDF_RAW
)
2378 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
2379 gimple_omp_body (gs
));
2380 dump_omp_clauses (buffer
, gimple_omp_parallel_clauses (gs
), spc
, flags
);
2381 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T%n>",
2382 gimple_omp_parallel_child_fn (gs
),
2383 gimple_omp_parallel_data_arg (gs
));
2388 pp_string (buffer
, "#pragma omp parallel");
2389 dump_omp_clauses (buffer
, gimple_omp_parallel_clauses (gs
), spc
, flags
);
2390 if (gimple_omp_parallel_child_fn (gs
))
2392 pp_string (buffer
, " [child fn: ");
2393 dump_generic_node (buffer
, gimple_omp_parallel_child_fn (gs
),
2395 pp_string (buffer
, " (");
2396 if (gimple_omp_parallel_data_arg (gs
))
2397 dump_generic_node (buffer
, gimple_omp_parallel_data_arg (gs
),
2400 pp_string (buffer
, "???");
2401 pp_string (buffer
, ")]");
2403 body
= gimple_omp_body (gs
);
2404 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
2406 newline_and_indent (buffer
, spc
+ 2);
2407 pp_left_brace (buffer
);
2408 pp_newline (buffer
);
2409 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
2410 newline_and_indent (buffer
, spc
+ 2);
2411 pp_right_brace (buffer
);
2415 pp_newline (buffer
);
2416 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
2422 /* Dump a GIMPLE_OMP_TASK tuple on the pretty_printer BUFFER, SPC spaces
2423 of indent. FLAGS specifies details to show in the dump (see TDF_* in
2427 dump_gimple_omp_task (pretty_printer
*buffer
, const gomp_task
*gs
, int spc
,
2430 if (flags
& TDF_RAW
)
2432 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
2433 gimple_omp_body (gs
));
2434 dump_omp_clauses (buffer
, gimple_omp_task_clauses (gs
), spc
, flags
);
2435 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T, %T, %T, %T%n>",
2436 gimple_omp_task_child_fn (gs
),
2437 gimple_omp_task_data_arg (gs
),
2438 gimple_omp_task_copy_fn (gs
),
2439 gimple_omp_task_arg_size (gs
),
2440 gimple_omp_task_arg_size (gs
));
2445 if (gimple_omp_task_taskloop_p (gs
))
2446 pp_string (buffer
, "#pragma omp taskloop");
2447 else if (gimple_omp_task_taskwait_p (gs
))
2448 pp_string (buffer
, "#pragma omp taskwait");
2450 pp_string (buffer
, "#pragma omp task");
2451 dump_omp_clauses (buffer
, gimple_omp_task_clauses (gs
), spc
, flags
);
2452 if (gimple_omp_task_child_fn (gs
))
2454 pp_string (buffer
, " [child fn: ");
2455 dump_generic_node (buffer
, gimple_omp_task_child_fn (gs
),
2457 pp_string (buffer
, " (");
2458 if (gimple_omp_task_data_arg (gs
))
2459 dump_generic_node (buffer
, gimple_omp_task_data_arg (gs
),
2462 pp_string (buffer
, "???");
2463 pp_string (buffer
, ")]");
2465 body
= gimple_omp_body (gs
);
2466 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
2468 newline_and_indent (buffer
, spc
+ 2);
2469 pp_left_brace (buffer
);
2470 pp_newline (buffer
);
2471 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
2472 newline_and_indent (buffer
, spc
+ 2);
2473 pp_right_brace (buffer
);
2477 pp_newline (buffer
);
2478 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
2484 /* Dump a GIMPLE_OMP_ATOMIC_LOAD tuple on the pretty_printer BUFFER, SPC
2485 spaces of indent. FLAGS specifies details to show in the dump (see TDF_*
2489 dump_gimple_omp_atomic_load (pretty_printer
*buffer
, const gomp_atomic_load
*gs
,
2490 int spc
, dump_flags_t flags
)
2492 if (flags
& TDF_RAW
)
2494 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T>", gs
,
2495 gimple_omp_atomic_load_lhs (gs
),
2496 gimple_omp_atomic_load_rhs (gs
));
2500 pp_string (buffer
, "#pragma omp atomic_load");
2501 dump_omp_atomic_memory_order (buffer
,
2502 gimple_omp_atomic_memory_order (gs
));
2503 if (gimple_omp_atomic_need_value_p (gs
))
2504 pp_string (buffer
, " [needed]");
2505 newline_and_indent (buffer
, spc
+ 2);
2506 dump_generic_node (buffer
, gimple_omp_atomic_load_lhs (gs
),
2512 dump_generic_node (buffer
, gimple_omp_atomic_load_rhs (gs
),
2517 /* Dump a GIMPLE_OMP_ATOMIC_STORE tuple on the pretty_printer BUFFER, SPC
2518 spaces of indent. FLAGS specifies details to show in the dump (see TDF_*
2522 dump_gimple_omp_atomic_store (pretty_printer
*buffer
,
2523 const gomp_atomic_store
*gs
, int spc
,
2526 if (flags
& TDF_RAW
)
2528 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
,
2529 gimple_omp_atomic_store_val (gs
));
2533 pp_string (buffer
, "#pragma omp atomic_store");
2534 dump_omp_atomic_memory_order (buffer
,
2535 gimple_omp_atomic_memory_order (gs
));
2537 if (gimple_omp_atomic_need_value_p (gs
))
2538 pp_string (buffer
, "[needed] ");
2539 pp_left_paren (buffer
);
2540 dump_generic_node (buffer
, gimple_omp_atomic_store_val (gs
),
2542 pp_right_paren (buffer
);
2547 /* Dump all the memory operands for statement GS. BUFFER, SPC and
2548 FLAGS are as in pp_gimple_stmt_1. */
2551 dump_gimple_mem_ops (pretty_printer
*buffer
, const gimple
*gs
, int spc
,
2554 tree vdef
= gimple_vdef (gs
);
2555 tree vuse
= gimple_vuse (gs
);
2557 if (vdef
!= NULL_TREE
)
2559 pp_string (buffer
, "# ");
2560 dump_generic_node (buffer
, vdef
, spc
+ 2, flags
, false);
2561 pp_string (buffer
, " = VDEF <");
2562 dump_generic_node (buffer
, vuse
, spc
+ 2, flags
, false);
2563 pp_greater (buffer
);
2564 newline_and_indent (buffer
, spc
);
2566 else if (vuse
!= NULL_TREE
)
2568 pp_string (buffer
, "# VUSE <");
2569 dump_generic_node (buffer
, vuse
, spc
+ 2, flags
, false);
2570 pp_greater (buffer
);
2571 newline_and_indent (buffer
, spc
);
2576 /* Print the gimple statement GS on the pretty printer BUFFER, SPC
2577 spaces of indent. FLAGS specifies details to show in the dump (see
2578 TDF_* in dumpfile.h). The caller is responsible for calling
2579 pp_flush on BUFFER to finalize the pretty printer. */
2582 pp_gimple_stmt_1 (pretty_printer
*buffer
, const gimple
*gs
, int spc
,
2588 if (flags
& TDF_STMTADDR
)
2589 pp_printf (buffer
, "<&%p> ", (const void *) gs
);
2591 if ((flags
& TDF_LINENO
) && gimple_has_location (gs
))
2592 dump_location (buffer
, gimple_location (gs
));
2596 int lp_nr
= lookup_stmt_eh_lp (gs
);
2598 pp_printf (buffer
, "[LP %d] ", lp_nr
);
2600 pp_printf (buffer
, "[MNT %d] ", -lp_nr
);
2603 if ((flags
& (TDF_VOPS
|TDF_MEMSYMS
))
2604 && gimple_has_mem_ops (gs
))
2605 dump_gimple_mem_ops (buffer
, gs
, spc
, flags
);
2607 if (gimple_has_lhs (gs
)
2608 && (flags
& TDF_ALIAS
))
2609 dump_ssaname_info (buffer
, gimple_get_lhs (gs
), spc
);
2611 switch (gimple_code (gs
))
2614 dump_gimple_asm (buffer
, as_a
<const gasm
*> (gs
), spc
, flags
);
2618 dump_gimple_assign (buffer
, as_a
<const gassign
*> (gs
), spc
, flags
);
2622 dump_gimple_bind (buffer
, as_a
<const gbind
*> (gs
), spc
, flags
);
2626 dump_gimple_call (buffer
, as_a
<const gcall
*> (gs
), spc
, flags
);
2630 dump_gimple_cond (buffer
, as_a
<const gcond
*> (gs
), spc
, flags
);
2634 dump_gimple_label (buffer
, as_a
<const glabel
*> (gs
), spc
, flags
);
2638 dump_gimple_goto (buffer
, as_a
<const ggoto
*> (gs
), spc
, flags
);
2642 pp_string (buffer
, "GIMPLE_NOP");
2646 dump_gimple_return (buffer
, as_a
<const greturn
*> (gs
), spc
, flags
);
2650 dump_gimple_switch (buffer
, as_a
<const gswitch
*> (gs
), spc
, flags
);
2654 dump_gimple_try (buffer
, as_a
<const gtry
*> (gs
), spc
, flags
);
2658 dump_gimple_phi (buffer
, as_a
<const gphi
*> (gs
), spc
, false, flags
);
2661 case GIMPLE_OMP_PARALLEL
:
2662 dump_gimple_omp_parallel (buffer
, as_a
<const gomp_parallel
*> (gs
), spc
,
2666 case GIMPLE_OMP_TASK
:
2667 dump_gimple_omp_task (buffer
, as_a
<const gomp_task
*> (gs
), spc
, flags
);
2670 case GIMPLE_OMP_ATOMIC_LOAD
:
2671 dump_gimple_omp_atomic_load (buffer
, as_a
<const gomp_atomic_load
*> (gs
),
2675 case GIMPLE_OMP_ATOMIC_STORE
:
2676 dump_gimple_omp_atomic_store (buffer
,
2677 as_a
<const gomp_atomic_store
*> (gs
),
2681 case GIMPLE_OMP_FOR
:
2682 dump_gimple_omp_for (buffer
, as_a
<const gomp_for
*> (gs
), spc
, flags
);
2685 case GIMPLE_OMP_CONTINUE
:
2686 dump_gimple_omp_continue (buffer
, as_a
<const gomp_continue
*> (gs
), spc
,
2690 case GIMPLE_OMP_SINGLE
:
2691 dump_gimple_omp_single (buffer
, as_a
<const gomp_single
*> (gs
), spc
,
2695 case GIMPLE_OMP_TARGET
:
2696 dump_gimple_omp_target (buffer
, as_a
<const gomp_target
*> (gs
), spc
,
2700 case GIMPLE_OMP_TEAMS
:
2701 dump_gimple_omp_teams (buffer
, as_a
<const gomp_teams
*> (gs
), spc
,
2705 case GIMPLE_OMP_RETURN
:
2706 dump_gimple_omp_return (buffer
, gs
, spc
, flags
);
2709 case GIMPLE_OMP_SECTIONS
:
2710 dump_gimple_omp_sections (buffer
, as_a
<const gomp_sections
*> (gs
),
2714 case GIMPLE_OMP_SECTIONS_SWITCH
:
2715 pp_string (buffer
, "GIMPLE_SECTIONS_SWITCH");
2718 case GIMPLE_OMP_TASKGROUP
:
2719 dump_gimple_omp_taskgroup (buffer
, gs
, spc
, flags
);
2722 case GIMPLE_OMP_MASTER
:
2723 case GIMPLE_OMP_SECTION
:
2724 dump_gimple_omp_block (buffer
, gs
, spc
, flags
);
2727 case GIMPLE_OMP_ORDERED
:
2728 dump_gimple_omp_ordered (buffer
, as_a
<const gomp_ordered
*> (gs
), spc
,
2732 case GIMPLE_OMP_SCAN
:
2733 dump_gimple_omp_scan (buffer
, as_a
<const gomp_scan
*> (gs
), spc
,
2737 case GIMPLE_OMP_CRITICAL
:
2738 dump_gimple_omp_critical (buffer
, as_a
<const gomp_critical
*> (gs
), spc
,
2743 dump_gimple_catch (buffer
, as_a
<const gcatch
*> (gs
), spc
, flags
);
2746 case GIMPLE_EH_FILTER
:
2747 dump_gimple_eh_filter (buffer
, as_a
<const geh_filter
*> (gs
), spc
,
2751 case GIMPLE_EH_MUST_NOT_THROW
:
2752 dump_gimple_eh_must_not_throw (buffer
,
2753 as_a
<const geh_mnt
*> (gs
),
2757 case GIMPLE_EH_ELSE
:
2758 dump_gimple_eh_else (buffer
, as_a
<const geh_else
*> (gs
), spc
, flags
);
2762 dump_gimple_resx (buffer
, as_a
<const gresx
*> (gs
), spc
, flags
);
2765 case GIMPLE_EH_DISPATCH
:
2766 dump_gimple_eh_dispatch (buffer
, as_a
<const geh_dispatch
*> (gs
), spc
,
2771 dump_gimple_debug (buffer
, as_a
<const gdebug
*> (gs
), spc
, flags
);
2774 case GIMPLE_PREDICT
:
2775 pp_string (buffer
, "// predicted ");
2776 if (gimple_predict_outcome (gs
))
2777 pp_string (buffer
, "likely by ");
2779 pp_string (buffer
, "unlikely by ");
2780 pp_string (buffer
, predictor_name (gimple_predict_predictor (gs
)));
2781 pp_string (buffer
, " predictor.");
2784 case GIMPLE_TRANSACTION
:
2785 dump_gimple_transaction (buffer
, as_a
<const gtransaction
*> (gs
), spc
,
2795 /* Dumps header of basic block BB to OUTF indented by INDENT
2796 spaces and details described by flags. */
2799 dump_gimple_bb_header (FILE *outf
, basic_block bb
, int indent
,
2802 if (flags
& TDF_BLOCKS
)
2804 if (flags
& TDF_LINENO
)
2806 gimple_stmt_iterator gsi
;
2808 fputs (";; ", outf
);
2810 for (gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
); gsi_next (&gsi
))
2811 if (!is_gimple_debug (gsi_stmt (gsi
))
2812 && get_lineno (gsi_stmt (gsi
)) != UNKNOWN_LOCATION
)
2814 fprintf (outf
, "%*sstarting at line %d",
2815 indent
, "", get_lineno (gsi_stmt (gsi
)));
2818 if (bb
->discriminator
)
2819 fprintf (outf
, ", discriminator %i", bb
->discriminator
);
2825 if (flags
& TDF_GIMPLE
)
2827 fprintf (outf
, "%*s__BB(%d", indent
, "", bb
->index
);
2828 if (bb
->loop_father
->header
== bb
)
2829 fprintf (outf
, ",loop_header(%d)", bb
->loop_father
->num
);
2830 if (bb
->count
.initialized_p ())
2831 fprintf (outf
, ",%s(%d)",
2832 profile_quality_as_string (bb
->count
.quality ()),
2833 bb
->count
.value ());
2834 fprintf (outf
, "):\n");
2837 fprintf (outf
, "%*s<bb %d> %s:\n",
2838 indent
, "", bb
->index
, dump_profile (bb
->count
));
2843 /* Dumps end of basic block BB to buffer BUFFER indented by INDENT
2847 dump_gimple_bb_footer (FILE *outf ATTRIBUTE_UNUSED
,
2848 basic_block bb ATTRIBUTE_UNUSED
,
2849 int indent ATTRIBUTE_UNUSED
,
2850 dump_flags_t flags ATTRIBUTE_UNUSED
)
2852 /* There is currently no GIMPLE-specific basic block info to dump. */
2857 /* Dump PHI nodes of basic block BB to BUFFER with details described
2858 by FLAGS and indented by INDENT spaces. */
2861 dump_phi_nodes (pretty_printer
*buffer
, basic_block bb
, int indent
,
2866 for (i
= gsi_start_phis (bb
); !gsi_end_p (i
); gsi_next (&i
))
2868 gphi
*phi
= i
.phi ();
2869 if (!virtual_operand_p (gimple_phi_result (phi
)) || (flags
& TDF_VOPS
))
2872 dump_gimple_phi (buffer
, phi
, indent
,
2873 (flags
& TDF_GIMPLE
) ? false : true, flags
);
2874 pp_newline (buffer
);
2880 /* Dump jump to basic block BB that is represented implicitly in the cfg
2884 pp_cfg_jump (pretty_printer
*buffer
, edge e
, dump_flags_t flags
)
2886 if (flags
& TDF_GIMPLE
)
2888 pp_string (buffer
, "goto __BB");
2889 pp_decimal_int (buffer
, e
->dest
->index
);
2890 if (e
->probability
.initialized_p ())
2892 pp_string (buffer
, "(");
2894 profile_quality_as_string (e
->probability
.quality ()));
2895 pp_string (buffer
, "(");
2896 pp_decimal_int (buffer
, e
->probability
.value ());
2897 pp_string (buffer
, "))");
2899 pp_semicolon (buffer
);
2903 pp_string (buffer
, "goto <bb ");
2904 pp_decimal_int (buffer
, e
->dest
->index
);
2905 pp_greater (buffer
);
2906 pp_semicolon (buffer
);
2908 dump_edge_probability (buffer
, e
);
2913 /* Dump edges represented implicitly in basic block BB to BUFFER, indented
2914 by INDENT spaces, with details given by FLAGS. */
2917 dump_implicit_edges (pretty_printer
*buffer
, basic_block bb
, int indent
,
2923 stmt
= last_stmt (bb
);
2925 if (stmt
&& gimple_code (stmt
) == GIMPLE_COND
)
2927 edge true_edge
, false_edge
;
2929 /* When we are emitting the code or changing CFG, it is possible that
2930 the edges are not yet created. When we are using debug_bb in such
2931 a situation, we do not want it to crash. */
2932 if (EDGE_COUNT (bb
->succs
) != 2)
2934 extract_true_false_edges_from_block (bb
, &true_edge
, &false_edge
);
2936 INDENT (indent
+ 2);
2937 pp_cfg_jump (buffer
, true_edge
, flags
);
2938 newline_and_indent (buffer
, indent
);
2939 pp_string (buffer
, "else");
2940 newline_and_indent (buffer
, indent
+ 2);
2941 pp_cfg_jump (buffer
, false_edge
, flags
);
2942 pp_newline (buffer
);
2946 /* If there is a fallthru edge, we may need to add an artificial
2947 goto to the dump. */
2948 e
= find_fallthru_edge (bb
->succs
);
2950 if (e
&& (e
->dest
!= bb
->next_bb
|| (flags
& TDF_GIMPLE
)))
2954 if ((flags
& TDF_LINENO
)
2955 && e
->goto_locus
!= UNKNOWN_LOCATION
)
2956 dump_location (buffer
, e
->goto_locus
);
2958 pp_cfg_jump (buffer
, e
, flags
);
2959 pp_newline (buffer
);
2964 /* Dumps basic block BB to buffer BUFFER with details described by FLAGS and
2965 indented by INDENT spaces. */
2968 gimple_dump_bb_buff (pretty_printer
*buffer
, basic_block bb
, int indent
,
2971 gimple_stmt_iterator gsi
;
2973 int label_indent
= indent
- 2;
2975 if (label_indent
< 0)
2978 dump_phi_nodes (buffer
, bb
, indent
, flags
);
2980 for (gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
); gsi_next (&gsi
))
2984 stmt
= gsi_stmt (gsi
);
2986 curr_indent
= gimple_code (stmt
) == GIMPLE_LABEL
? label_indent
: indent
;
2988 INDENT (curr_indent
);
2989 pp_gimple_stmt_1 (buffer
, stmt
, curr_indent
, flags
);
2990 pp_newline_and_flush (buffer
);
2991 gcc_checking_assert (DECL_STRUCT_FUNCTION (current_function_decl
));
2992 dump_histograms_for_stmt (DECL_STRUCT_FUNCTION (current_function_decl
),
2993 pp_buffer (buffer
)->stream
, stmt
);
2996 dump_implicit_edges (buffer
, bb
, indent
, flags
);
3001 /* Dumps basic block BB to FILE with details described by FLAGS and
3002 indented by INDENT spaces. */
3005 gimple_dump_bb (FILE *file
, basic_block bb
, int indent
, dump_flags_t flags
)
3007 dump_gimple_bb_header (file
, bb
, indent
, flags
);
3008 if (bb
->index
>= NUM_FIXED_BLOCKS
)
3010 pretty_printer buffer
;
3011 pp_needs_newline (&buffer
) = true;
3012 buffer
.buffer
->stream
= file
;
3013 gimple_dump_bb_buff (&buffer
, bb
, indent
, flags
);
3015 dump_gimple_bb_footer (file
, bb
, indent
, flags
);
3018 /* Dumps basic block BB to pretty-printer PP with default dump flags and
3019 no indentation, for use as a label of a DOT graph record-node.
3020 ??? Should just use gimple_dump_bb_buff here, except that value profiling
3021 histogram dumping doesn't know about pretty-printers. */
3024 gimple_dump_bb_for_graph (pretty_printer
*pp
, basic_block bb
)
3026 pp_printf (pp
, "<bb %d>:\n", bb
->index
);
3027 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
3029 for (gphi_iterator gsi
= gsi_start_phis (bb
); !gsi_end_p (gsi
);
3032 gphi
*phi
= gsi
.phi ();
3033 if (!virtual_operand_p (gimple_phi_result (phi
))
3034 || (dump_flags
& TDF_VOPS
))
3037 pp_write_text_to_stream (pp
);
3038 pp_string (pp
, "# ");
3039 pp_gimple_stmt_1 (pp
, phi
, 0, dump_flags
);
3041 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
3045 for (gimple_stmt_iterator gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
);
3048 gimple
*stmt
= gsi_stmt (gsi
);
3050 pp_write_text_to_stream (pp
);
3051 pp_gimple_stmt_1 (pp
, stmt
, 0, dump_flags
);
3053 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
3055 dump_implicit_edges (pp
, bb
, 0, dump_flags
);
3056 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
3060 /* Handle the %G format for TEXT. Same as %K in handle_K_format in
3061 tree-pretty-print.c but with a Gimple statement as an argument. */
3064 percent_G_format (text_info
*text
)
3066 gimple
*stmt
= va_arg (*text
->args_ptr
, gimple
*);
3068 /* Fall back on the rich location if the statement doesn't have one. */
3069 location_t loc
= gimple_location (stmt
);
3070 if (loc
== UNKNOWN_LOCATION
)
3071 loc
= text
->m_richloc
->get_loc ();
3072 tree block
= gimple_block (stmt
);
3073 percent_K_format (text
, loc
, block
);
3077 # pragma GCC diagnostic pop