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"
46 /* Disable warnings about quoting issues in the pp_xxx calls below
47 that (intentionally) don't follow GCC diagnostic conventions. */
49 # pragma GCC diagnostic push
50 # pragma GCC diagnostic ignored "-Wformat-diag"
53 #define INDENT(SPACE) \
54 do { int i; for (i = 0; i < SPACE; i++) pp_space (buffer); } while (0)
56 #define GIMPLE_NIY do_niy (buffer,gs)
58 /* Try to print on BUFFER a default message for the unrecognized
59 gimple statement GS. */
62 do_niy (pretty_printer
*buffer
, const gimple
*gs
)
64 pp_printf (buffer
, "<<< Unknown GIMPLE statement: %s >>>\n",
65 gimple_code_name
[(int) gimple_code (gs
)]);
69 /* Emit a newline and SPC indentation spaces to BUFFER. */
72 newline_and_indent (pretty_printer
*buffer
, int spc
)
79 /* Print the GIMPLE statement GS on stderr. */
82 debug_gimple_stmt (gimple
*gs
)
84 print_gimple_stmt (stderr
, gs
, 0, TDF_VOPS
|TDF_MEMSYMS
);
88 /* Return formatted string of a VALUE probability
89 (biased by REG_BR_PROB_BASE). Returned string is allocated
90 by xstrdup_for_dump. */
93 dump_profile (profile_count
&count
)
96 if (!count
.initialized_p ())
99 buf
= xasprintf ("[count: %" PRId64
"]",
100 count
.to_gcov_type ());
101 else if (count
.initialized_p ())
102 buf
= xasprintf ("[local count: %" PRId64
"]",
103 count
.to_gcov_type ());
105 const char *ret
= xstrdup_for_dump (buf
);
111 /* Return formatted string of a VALUE probability
112 (biased by REG_BR_PROB_BASE). Returned string is allocated
113 by xstrdup_for_dump. */
116 dump_probability (profile_probability probability
)
118 float minimum
= 0.01f
;
121 if (probability
.initialized_p ())
123 fvalue
= probability
.to_reg_br_prob_base () * 100.0f
/ REG_BR_PROB_BASE
;
124 if (fvalue
< minimum
&& probability
.to_reg_br_prob_base ())
129 if (probability
.initialized_p ())
130 buf
= xasprintf ("[%.2f%%]", fvalue
);
132 buf
= xasprintf ("[INV]");
134 const char *ret
= xstrdup_for_dump (buf
);
140 /* Dump E probability to BUFFER. */
143 dump_edge_probability (pretty_printer
*buffer
, edge e
)
145 pp_scalar (buffer
, " %s", dump_probability (e
->probability
));
148 /* Print GIMPLE statement G to FILE using SPC indentation spaces and
149 FLAGS as in pp_gimple_stmt_1. */
152 print_gimple_stmt (FILE *file
, gimple
*g
, int spc
, dump_flags_t flags
)
154 pretty_printer buffer
;
155 pp_needs_newline (&buffer
) = true;
156 buffer
.buffer
->stream
= file
;
157 pp_gimple_stmt_1 (&buffer
, g
, spc
, flags
);
158 pp_newline_and_flush (&buffer
);
164 print_gimple_stmt (stderr
, &ref
, 0, TDF_NONE
);
173 fprintf (stderr
, "<nil>\n");
177 /* Print GIMPLE statement G to FILE using SPC indentation spaces and
178 FLAGS as in pp_gimple_stmt_1. Print only the right-hand side
182 print_gimple_expr (FILE *file
, gimple
*g
, int spc
, dump_flags_t flags
)
184 flags
|= TDF_RHS_ONLY
;
185 pretty_printer buffer
;
186 pp_needs_newline (&buffer
) = true;
187 buffer
.buffer
->stream
= file
;
188 pp_gimple_stmt_1 (&buffer
, g
, spc
, flags
);
193 /* Print the GIMPLE sequence SEQ on BUFFER using SPC indentation
194 spaces and FLAGS as in pp_gimple_stmt_1.
195 The caller is responsible for calling pp_flush on BUFFER to finalize
196 the pretty printer. */
199 dump_gimple_seq (pretty_printer
*buffer
, gimple_seq seq
, int spc
,
202 gimple_stmt_iterator i
;
204 for (i
= gsi_start (seq
); !gsi_end_p (i
); gsi_next (&i
))
206 gimple
*gs
= gsi_stmt (i
);
208 pp_gimple_stmt_1 (buffer
, gs
, spc
, flags
);
209 if (!gsi_one_before_end_p (i
))
215 /* Print GIMPLE sequence SEQ to FILE using SPC indentation spaces and
216 FLAGS as in pp_gimple_stmt_1. */
219 print_gimple_seq (FILE *file
, gimple_seq seq
, int spc
, dump_flags_t flags
)
221 pretty_printer buffer
;
222 pp_needs_newline (&buffer
) = true;
223 buffer
.buffer
->stream
= file
;
224 dump_gimple_seq (&buffer
, seq
, spc
, flags
);
225 pp_newline_and_flush (&buffer
);
229 /* Print the GIMPLE sequence SEQ on stderr. */
232 debug_gimple_seq (gimple_seq seq
)
234 print_gimple_seq (stderr
, seq
, 0, TDF_VOPS
|TDF_MEMSYMS
);
238 /* A simple helper to pretty-print some of the gimple tuples in the printf
239 style. The format modifiers are preceded by '%' and are:
240 'G' - outputs a string corresponding to the code of the given gimple,
241 'S' - outputs a gimple_seq with indent of spc + 2,
242 'T' - outputs the tree t,
243 'd' - outputs an int as a decimal,
244 's' - outputs a string,
245 'n' - outputs a newline,
246 'x' - outputs an int as hexadecimal,
247 '+' - increases indent by 2 then outputs a newline,
248 '-' - decreases indent by 2 then outputs a newline. */
251 dump_gimple_fmt (pretty_printer
*buffer
, int spc
, dump_flags_t flags
,
252 const char *fmt
, ...)
258 va_start (args
, fmt
);
259 for (c
= fmt
; *c
; c
++)
269 g
= va_arg (args
, gimple
*);
270 tmp
= gimple_code_name
[gimple_code (g
)];
271 pp_string (buffer
, tmp
);
275 seq
= va_arg (args
, gimple_seq
);
277 dump_gimple_seq (buffer
, seq
, spc
+ 2, flags
);
278 newline_and_indent (buffer
, spc
);
282 t
= va_arg (args
, tree
);
284 pp_string (buffer
, "NULL");
286 dump_generic_node (buffer
, t
, spc
, flags
, false);
290 pp_decimal_int (buffer
, va_arg (args
, int));
294 pp_string (buffer
, va_arg (args
, char *));
298 newline_and_indent (buffer
, spc
);
302 pp_scalar (buffer
, "%x", va_arg (args
, int));
307 newline_and_indent (buffer
, spc
);
312 newline_and_indent (buffer
, spc
);
320 pp_character (buffer
, *c
);
326 /* Helper for dump_gimple_assign. Print the unary RHS of the
327 assignment GS. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. */
330 dump_unary_rhs (pretty_printer
*buffer
, const gassign
*gs
, int spc
,
333 enum tree_code rhs_code
= gimple_assign_rhs_code (gs
);
334 tree lhs
= gimple_assign_lhs (gs
);
335 tree rhs
= gimple_assign_rhs1 (gs
);
339 case VIEW_CONVERT_EXPR
:
341 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
344 case FIXED_CONVERT_EXPR
:
345 case ADDR_SPACE_CONVERT_EXPR
:
349 pp_left_paren (buffer
);
350 dump_generic_node (buffer
, TREE_TYPE (lhs
), spc
, flags
, false);
351 pp_string (buffer
, ") ");
352 if (op_prio (rhs
) < op_code_prio (rhs_code
))
354 pp_left_paren (buffer
);
355 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
356 pp_right_paren (buffer
);
359 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
363 pp_string (buffer
, "((");
364 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
365 pp_string (buffer
, "))");
370 if (flags
& TDF_GIMPLE
)
373 rhs_code
== ABS_EXPR
? "__ABS " : "__ABSU ");
374 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
379 rhs_code
== ABS_EXPR
? "ABS_EXPR <" : "ABSU_EXPR <");
380 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
386 if (TREE_CODE_CLASS (rhs_code
) == tcc_declaration
387 || TREE_CODE_CLASS (rhs_code
) == tcc_constant
388 || TREE_CODE_CLASS (rhs_code
) == tcc_reference
389 || rhs_code
== SSA_NAME
390 || rhs_code
== ADDR_EXPR
391 || rhs_code
== CONSTRUCTOR
)
393 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
396 else if (rhs_code
== BIT_NOT_EXPR
)
397 pp_complement (buffer
);
398 else if (rhs_code
== TRUTH_NOT_EXPR
)
399 pp_exclamation (buffer
);
400 else if (rhs_code
== NEGATE_EXPR
)
404 pp_left_bracket (buffer
);
405 pp_string (buffer
, get_tree_code_name (rhs_code
));
406 pp_string (buffer
, "] ");
409 if (op_prio (rhs
) < op_code_prio (rhs_code
))
411 pp_left_paren (buffer
);
412 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
413 pp_right_paren (buffer
);
416 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
422 /* Helper for dump_gimple_assign. Print the binary RHS of the
423 assignment GS. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. */
426 dump_binary_rhs (pretty_printer
*buffer
, const gassign
*gs
, int spc
,
430 enum tree_code code
= gimple_assign_rhs_code (gs
);
435 if (flags
& TDF_GIMPLE
)
437 pp_string (buffer
, code
== MIN_EXPR
? "__MIN (" : "__MAX (");
438 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
,
440 pp_string (buffer
, ", ");
441 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
,
443 pp_string (buffer
, ")");
451 case VEC_WIDEN_MULT_HI_EXPR
:
452 case VEC_WIDEN_MULT_LO_EXPR
:
453 case VEC_WIDEN_MULT_EVEN_EXPR
:
454 case VEC_WIDEN_MULT_ODD_EXPR
:
455 case VEC_PACK_TRUNC_EXPR
:
456 case VEC_PACK_SAT_EXPR
:
457 case VEC_PACK_FIX_TRUNC_EXPR
:
458 case VEC_PACK_FLOAT_EXPR
:
459 case VEC_WIDEN_LSHIFT_HI_EXPR
:
460 case VEC_WIDEN_LSHIFT_LO_EXPR
:
461 case VEC_WIDEN_PLUS_HI_EXPR
:
462 case VEC_WIDEN_PLUS_LO_EXPR
:
463 case VEC_WIDEN_MINUS_HI_EXPR
:
464 case VEC_WIDEN_MINUS_LO_EXPR
:
465 case VEC_SERIES_EXPR
:
466 for (p
= get_tree_code_name (code
); *p
; p
++)
467 pp_character (buffer
, TOUPPER (*p
));
468 pp_string (buffer
, " <");
469 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
470 pp_string (buffer
, ", ");
471 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
476 if (op_prio (gimple_assign_rhs1 (gs
)) <= op_code_prio (code
))
478 pp_left_paren (buffer
);
479 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
,
481 pp_right_paren (buffer
);
484 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
486 pp_string (buffer
, op_symbol_code (gimple_assign_rhs_code (gs
)));
488 if (op_prio (gimple_assign_rhs2 (gs
)) <= op_code_prio (code
))
490 pp_left_paren (buffer
);
491 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
,
493 pp_right_paren (buffer
);
496 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
500 /* Helper for dump_gimple_assign. Print the ternary RHS of the
501 assignment GS. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. */
504 dump_ternary_rhs (pretty_printer
*buffer
, const gassign
*gs
, int spc
,
508 enum tree_code code
= gimple_assign_rhs_code (gs
);
511 case WIDEN_MULT_PLUS_EXPR
:
512 case WIDEN_MULT_MINUS_EXPR
:
513 for (p
= get_tree_code_name (code
); *p
; p
++)
514 pp_character (buffer
, TOUPPER (*p
));
515 pp_string (buffer
, " <");
516 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
517 pp_string (buffer
, ", ");
518 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
519 pp_string (buffer
, ", ");
520 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
525 pp_string (buffer
, "DOT_PROD_EXPR <");
526 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
527 pp_string (buffer
, ", ");
528 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
529 pp_string (buffer
, ", ");
530 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
535 pp_string (buffer
, "SAD_EXPR <");
536 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
537 pp_string (buffer
, ", ");
538 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
539 pp_string (buffer
, ", ");
540 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
545 if (flags
& TDF_GIMPLE
)
546 pp_string (buffer
, "__VEC_PERM (");
548 pp_string (buffer
, "VEC_PERM_EXPR <");
549 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
550 pp_string (buffer
, ", ");
551 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
552 pp_string (buffer
, ", ");
553 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
554 if (flags
& TDF_GIMPLE
)
555 pp_right_paren (buffer
);
560 case REALIGN_LOAD_EXPR
:
561 pp_string (buffer
, "REALIGN_LOAD <");
562 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
563 pp_string (buffer
, ", ");
564 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
565 pp_string (buffer
, ", ");
566 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
571 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
572 pp_string (buffer
, " ? ");
573 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
574 pp_string (buffer
, " : ");
575 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
579 pp_string (buffer
, "VEC_COND_EXPR <");
580 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
581 pp_string (buffer
, ", ");
582 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
583 pp_string (buffer
, ", ");
584 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
588 case BIT_INSERT_EXPR
:
589 if (flags
& TDF_GIMPLE
)
591 pp_string (buffer
, "__BIT_INSERT (");
592 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
,
593 flags
| TDF_SLIM
, false);
594 pp_string (buffer
, ", ");
595 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
,
596 flags
| TDF_SLIM
, false);
597 pp_string (buffer
, ", ");
598 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
,
599 flags
| TDF_SLIM
, false);
600 pp_right_paren (buffer
);
604 pp_string (buffer
, "BIT_INSERT_EXPR <");
605 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
),
607 pp_string (buffer
, ", ");
608 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
),
610 pp_string (buffer
, ", ");
611 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
),
613 if (INTEGRAL_TYPE_P (TREE_TYPE (gimple_assign_rhs2 (gs
))))
615 pp_string (buffer
, " (");
616 pp_decimal_int (buffer
, TYPE_PRECISION
617 (TREE_TYPE (gimple_assign_rhs2 (gs
))));
618 pp_string (buffer
, " bits)");
630 /* Dump the gimple assignment GS. BUFFER, SPC and FLAGS are as in
634 dump_gimple_assign (pretty_printer
*buffer
, const gassign
*gs
, int spc
,
642 switch (gimple_num_ops (gs
))
645 arg3
= gimple_assign_rhs3 (gs
);
648 arg2
= gimple_assign_rhs2 (gs
);
651 arg1
= gimple_assign_rhs1 (gs
);
657 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%s, %T, %T, %T, %T>", gs
,
658 get_tree_code_name (gimple_assign_rhs_code (gs
)),
659 gimple_assign_lhs (gs
), arg1
, arg2
, arg3
);
663 if (!(flags
& TDF_RHS_ONLY
))
665 dump_generic_node (buffer
, gimple_assign_lhs (gs
), spc
, flags
, false);
669 if (gimple_assign_nontemporal_move_p (gs
))
670 pp_string (buffer
, "{nt}");
672 if (gimple_has_volatile_ops (gs
))
673 pp_string (buffer
, "{v}");
678 if (gimple_num_ops (gs
) == 2)
679 dump_unary_rhs (buffer
, gs
, spc
, flags
);
680 else if (gimple_num_ops (gs
) == 3)
681 dump_binary_rhs (buffer
, gs
, spc
, flags
);
682 else if (gimple_num_ops (gs
) == 4)
683 dump_ternary_rhs (buffer
, gs
, spc
, flags
);
686 if (!(flags
& TDF_RHS_ONLY
))
687 pp_semicolon (buffer
);
692 /* Dump the return statement GS. BUFFER, SPC and FLAGS are as in
696 dump_gimple_return (pretty_printer
*buffer
, const greturn
*gs
, int spc
,
701 t
= gimple_return_retval (gs
);
703 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
, t
);
706 pp_string (buffer
, "return");
710 dump_generic_node (buffer
, t
, spc
, flags
, false);
712 pp_semicolon (buffer
);
717 /* Dump the call arguments for a gimple call. BUFFER, FLAGS are as in
721 dump_gimple_call_args (pretty_printer
*buffer
, const gcall
*gs
,
726 /* Pretty print first arg to certain internal fns. */
727 if (gimple_call_internal_p (gs
))
729 const char *const *enums
= NULL
;
732 switch (gimple_call_internal_fn (gs
))
736 static const char *const unique_args
[] = {IFN_UNIQUE_CODES
};
740 limit
= ARRAY_SIZE (unique_args
);
745 static const char *const loop_args
[] = {IFN_GOACC_LOOP_CODES
};
748 limit
= ARRAY_SIZE (loop_args
);
751 case IFN_GOACC_REDUCTION
:
753 static const char *const reduction_args
[]
754 = {IFN_GOACC_REDUCTION_CODES
};
756 enums
= reduction_args
;
757 limit
= ARRAY_SIZE (reduction_args
);
760 case IFN_HWASAN_MARK
:
763 static const char *const asan_mark_args
[] = {IFN_ASAN_MARK_FLAGS
};
765 enums
= asan_mark_args
;
766 limit
= ARRAY_SIZE (asan_mark_args
);
774 tree arg0
= gimple_call_arg (gs
, 0);
777 if (TREE_CODE (arg0
) == INTEGER_CST
778 && tree_fits_shwi_p (arg0
)
779 && (v
= tree_to_shwi (arg0
)) >= 0 && v
< limit
)
782 pp_string (buffer
, enums
[v
]);
787 for (; i
< gimple_call_num_args (gs
); i
++)
790 pp_string (buffer
, ", ");
791 dump_generic_node (buffer
, gimple_call_arg (gs
, i
), 0, flags
, false);
794 if (gimple_call_va_arg_pack_p (gs
))
797 pp_string (buffer
, ", ");
799 pp_string (buffer
, "__builtin_va_arg_pack ()");
803 /* Dump the points-to solution *PT to BUFFER. */
806 pp_points_to_solution (pretty_printer
*buffer
, const pt_solution
*pt
)
810 pp_string (buffer
, "anything ");
814 pp_string (buffer
, "nonlocal ");
816 pp_string (buffer
, "escaped ");
818 pp_string (buffer
, "unit-escaped ");
820 pp_string (buffer
, "null ");
822 && !bitmap_empty_p (pt
->vars
))
826 pp_string (buffer
, "{ ");
827 EXECUTE_IF_SET_IN_BITMAP (pt
->vars
, 0, i
, bi
)
829 pp_string (buffer
, "D.");
830 pp_decimal_int (buffer
, i
);
833 pp_right_brace (buffer
);
834 if (pt
->vars_contains_nonlocal
835 || pt
->vars_contains_escaped
836 || pt
->vars_contains_escaped_heap
837 || pt
->vars_contains_restrict
)
839 const char *comma
= "";
840 pp_string (buffer
, " (");
841 if (pt
->vars_contains_nonlocal
)
843 pp_string (buffer
, "nonlocal");
846 if (pt
->vars_contains_escaped
)
848 pp_string (buffer
, comma
);
849 pp_string (buffer
, "escaped");
852 if (pt
->vars_contains_escaped_heap
)
854 pp_string (buffer
, comma
);
855 pp_string (buffer
, "escaped heap");
858 if (pt
->vars_contains_restrict
)
860 pp_string (buffer
, comma
);
861 pp_string (buffer
, "restrict");
864 if (pt
->vars_contains_interposable
)
866 pp_string (buffer
, comma
);
867 pp_string (buffer
, "interposable");
869 pp_string (buffer
, ")");
875 /* Dump the call statement GS. BUFFER, SPC and FLAGS are as in
879 dump_gimple_call (pretty_printer
*buffer
, const gcall
*gs
, int spc
,
882 tree lhs
= gimple_call_lhs (gs
);
883 tree fn
= gimple_call_fn (gs
);
885 if (flags
& TDF_ALIAS
)
887 const pt_solution
*pt
;
888 pt
= gimple_call_use_set (gs
);
889 if (!pt_solution_empty_p (pt
))
891 pp_string (buffer
, "# USE = ");
892 pp_points_to_solution (buffer
, pt
);
893 newline_and_indent (buffer
, spc
);
895 pt
= gimple_call_clobber_set (gs
);
896 if (!pt_solution_empty_p (pt
))
898 pp_string (buffer
, "# CLB = ");
899 pp_points_to_solution (buffer
, pt
);
900 newline_and_indent (buffer
, spc
);
906 if (gimple_call_internal_p (gs
))
907 dump_gimple_fmt (buffer
, spc
, flags
, "%G <.%s, %T", gs
,
908 internal_fn_name (gimple_call_internal_fn (gs
)), lhs
);
910 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T", gs
, fn
, lhs
);
911 if (gimple_call_num_args (gs
) > 0)
913 pp_string (buffer
, ", ");
914 dump_gimple_call_args (buffer
, gs
, flags
);
920 if (lhs
&& !(flags
& TDF_RHS_ONLY
))
922 dump_generic_node (buffer
, lhs
, spc
, flags
, false);
923 pp_string (buffer
, " =");
925 if (gimple_has_volatile_ops (gs
))
926 pp_string (buffer
, "{v}");
930 if (gimple_call_internal_p (gs
))
933 pp_string (buffer
, internal_fn_name (gimple_call_internal_fn (gs
)));
936 print_call_name (buffer
, fn
, flags
);
937 pp_string (buffer
, " (");
938 dump_gimple_call_args (buffer
, gs
, flags
);
939 pp_right_paren (buffer
);
940 if (!(flags
& TDF_RHS_ONLY
))
941 pp_semicolon (buffer
);
944 if (gimple_call_chain (gs
))
946 pp_string (buffer
, " [static-chain: ");
947 dump_generic_node (buffer
, gimple_call_chain (gs
), spc
, flags
, false);
948 pp_right_bracket (buffer
);
951 if (gimple_call_return_slot_opt_p (gs
))
952 pp_string (buffer
, " [return slot optimization]");
953 if (gimple_call_tail_p (gs
))
954 pp_string (buffer
, " [tail call]");
955 if (gimple_call_must_tail_p (gs
))
956 pp_string (buffer
, " [must tail call]");
961 /* Dump the arguments of _ITM_beginTransaction sanely. */
962 if (TREE_CODE (fn
) == ADDR_EXPR
)
963 fn
= TREE_OPERAND (fn
, 0);
964 if (TREE_CODE (fn
) == FUNCTION_DECL
&& decl_is_tm_clone (fn
))
965 pp_string (buffer
, " [tm-clone]");
966 if (TREE_CODE (fn
) == FUNCTION_DECL
967 && fndecl_built_in_p (fn
, BUILT_IN_TM_START
)
968 && gimple_call_num_args (gs
) > 0)
970 tree t
= gimple_call_arg (gs
, 0);
971 unsigned HOST_WIDE_INT props
;
972 gcc_assert (TREE_CODE (t
) == INTEGER_CST
);
974 pp_string (buffer
, " [ ");
976 /* Get the transaction code properties. */
977 props
= TREE_INT_CST_LOW (t
);
979 if (props
& PR_INSTRUMENTEDCODE
)
980 pp_string (buffer
, "instrumentedCode ");
981 if (props
& PR_UNINSTRUMENTEDCODE
)
982 pp_string (buffer
, "uninstrumentedCode ");
983 if (props
& PR_HASNOXMMUPDATE
)
984 pp_string (buffer
, "hasNoXMMUpdate ");
985 if (props
& PR_HASNOABORT
)
986 pp_string (buffer
, "hasNoAbort ");
987 if (props
& PR_HASNOIRREVOCABLE
)
988 pp_string (buffer
, "hasNoIrrevocable ");
989 if (props
& PR_DOESGOIRREVOCABLE
)
990 pp_string (buffer
, "doesGoIrrevocable ");
991 if (props
& PR_HASNOSIMPLEREADS
)
992 pp_string (buffer
, "hasNoSimpleReads ");
993 if (props
& PR_AWBARRIERSOMITTED
)
994 pp_string (buffer
, "awBarriersOmitted ");
995 if (props
& PR_RARBARRIERSOMITTED
)
996 pp_string (buffer
, "RaRBarriersOmitted ");
997 if (props
& PR_UNDOLOGCODE
)
998 pp_string (buffer
, "undoLogCode ");
999 if (props
& PR_PREFERUNINSTRUMENTED
)
1000 pp_string (buffer
, "preferUninstrumented ");
1001 if (props
& PR_EXCEPTIONBLOCK
)
1002 pp_string (buffer
, "exceptionBlock ");
1003 if (props
& PR_HASELSE
)
1004 pp_string (buffer
, "hasElse ");
1005 if (props
& PR_READONLY
)
1006 pp_string (buffer
, "readOnly ");
1008 pp_right_bracket (buffer
);
1013 /* Dump the switch statement GS. BUFFER, SPC and FLAGS are as in
1014 pp_gimple_stmt_1. */
1017 dump_gimple_switch (pretty_printer
*buffer
, const gswitch
*gs
, int spc
,
1022 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
1023 if (flags
& TDF_RAW
)
1024 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, ", gs
,
1025 gimple_switch_index (gs
));
1028 pp_string (buffer
, "switch (");
1029 dump_generic_node (buffer
, gimple_switch_index (gs
), spc
, flags
, true);
1030 if (flags
& TDF_GIMPLE
)
1031 pp_string (buffer
, ") {");
1033 pp_string (buffer
, ") <");
1036 for (i
= 0; i
< gimple_switch_num_labels (gs
); i
++)
1038 tree case_label
= gimple_switch_label (gs
, i
);
1039 gcc_checking_assert (case_label
!= NULL_TREE
);
1040 dump_generic_node (buffer
, case_label
, spc
, flags
, false);
1042 tree label
= CASE_LABEL (case_label
);
1043 dump_generic_node (buffer
, label
, spc
, flags
, false);
1045 if (cfun
&& cfun
->cfg
)
1047 basic_block dest
= label_to_block (cfun
, label
);
1050 edge label_edge
= find_edge (gimple_bb (gs
), dest
);
1051 if (label_edge
&& !(flags
& TDF_GIMPLE
))
1052 dump_edge_probability (buffer
, label_edge
);
1056 if (i
< gimple_switch_num_labels (gs
) - 1)
1058 if (flags
& TDF_GIMPLE
)
1059 pp_string (buffer
, "; ");
1061 pp_string (buffer
, ", ");
1064 if (flags
& TDF_GIMPLE
)
1065 pp_string (buffer
, "; }");
1067 pp_greater (buffer
);
1071 /* Dump the gimple conditional GS. BUFFER, SPC and FLAGS are as in
1072 pp_gimple_stmt_1. */
1075 dump_gimple_cond (pretty_printer
*buffer
, const gcond
*gs
, int spc
,
1078 if (flags
& TDF_RAW
)
1079 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%s, %T, %T, %T, %T>", gs
,
1080 get_tree_code_name (gimple_cond_code (gs
)),
1081 gimple_cond_lhs (gs
), gimple_cond_rhs (gs
),
1082 gimple_cond_true_label (gs
), gimple_cond_false_label (gs
));
1085 if (!(flags
& TDF_RHS_ONLY
))
1086 pp_string (buffer
, "if (");
1087 dump_generic_node (buffer
, gimple_cond_lhs (gs
), spc
, flags
, false);
1089 pp_string (buffer
, op_symbol_code (gimple_cond_code (gs
)));
1091 dump_generic_node (buffer
, gimple_cond_rhs (gs
), spc
, flags
, false);
1092 if (!(flags
& TDF_RHS_ONLY
))
1095 edge e
, true_edge
= NULL
, false_edge
= NULL
;
1096 basic_block bb
= gimple_bb (gs
);
1100 FOR_EACH_EDGE (e
, ei
, bb
->succs
)
1102 if (e
->flags
& EDGE_TRUE_VALUE
)
1104 else if (e
->flags
& EDGE_FALSE_VALUE
)
1109 bool has_edge_info
= true_edge
!= NULL
&& false_edge
!= NULL
;
1111 pp_right_paren (buffer
);
1113 if (gimple_cond_true_label (gs
))
1115 pp_string (buffer
, " goto ");
1116 dump_generic_node (buffer
, gimple_cond_true_label (gs
),
1118 if (has_edge_info
&& !(flags
& TDF_GIMPLE
))
1119 dump_edge_probability (buffer
, true_edge
);
1120 pp_semicolon (buffer
);
1122 if (gimple_cond_false_label (gs
))
1124 pp_string (buffer
, " else goto ");
1125 dump_generic_node (buffer
, gimple_cond_false_label (gs
),
1127 if (has_edge_info
&& !(flags
& TDF_GIMPLE
))
1128 dump_edge_probability (buffer
, false_edge
);
1130 pp_semicolon (buffer
);
1137 /* Dump a GIMPLE_LABEL tuple on the pretty_printer BUFFER, SPC
1138 spaces of indent. FLAGS specifies details to show in the dump (see
1139 TDF_* in dumpfils.h). */
1142 dump_gimple_label (pretty_printer
*buffer
, const glabel
*gs
, int spc
,
1145 tree label
= gimple_label_label (gs
);
1146 if (flags
& TDF_RAW
)
1147 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
, label
);
1150 dump_generic_node (buffer
, label
, spc
, flags
, false);
1153 if (flags
& TDF_GIMPLE
)
1155 if (DECL_NONLOCAL (label
))
1156 pp_string (buffer
, " [non-local]");
1157 if ((flags
& TDF_EH
) && EH_LANDING_PAD_NR (label
))
1158 pp_printf (buffer
, " [LP %d]", EH_LANDING_PAD_NR (label
));
1161 /* Dump a GIMPLE_GOTO tuple on the pretty_printer BUFFER, SPC
1162 spaces of indent. FLAGS specifies details to show in the dump (see
1163 TDF_* in dumpfile.h). */
1166 dump_gimple_goto (pretty_printer
*buffer
, const ggoto
*gs
, int spc
,
1169 tree label
= gimple_goto_dest (gs
);
1170 if (flags
& TDF_RAW
)
1171 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
, label
);
1173 dump_gimple_fmt (buffer
, spc
, flags
, "goto %T;", label
);
1177 /* Dump a GIMPLE_BIND tuple on the pretty_printer BUFFER, SPC
1178 spaces of indent. FLAGS specifies details to show in the dump (see
1179 TDF_* in dumpfile.h). */
1182 dump_gimple_bind (pretty_printer
*buffer
, const gbind
*gs
, int spc
,
1185 if (flags
& TDF_RAW
)
1186 dump_gimple_fmt (buffer
, spc
, flags
, "%G <", gs
);
1188 pp_left_brace (buffer
);
1189 if (!(flags
& TDF_SLIM
))
1193 for (var
= gimple_bind_vars (gs
); var
; var
= DECL_CHAIN (var
))
1195 newline_and_indent (buffer
, 2);
1196 print_declaration (buffer
, var
, spc
, flags
);
1198 if (gimple_bind_vars (gs
))
1199 pp_newline (buffer
);
1201 pp_newline (buffer
);
1202 dump_gimple_seq (buffer
, gimple_bind_body (gs
), spc
+ 2, flags
);
1203 newline_and_indent (buffer
, spc
);
1204 if (flags
& TDF_RAW
)
1205 pp_greater (buffer
);
1207 pp_right_brace (buffer
);
1211 /* Dump a GIMPLE_TRY tuple on the pretty_printer BUFFER, SPC spaces of
1212 indent. FLAGS specifies details to show in the dump (see TDF_* in
1216 dump_gimple_try (pretty_printer
*buffer
, const gtry
*gs
, int spc
,
1219 if (flags
& TDF_RAW
)
1222 if (gimple_try_kind (gs
) == GIMPLE_TRY_CATCH
)
1223 type
= "GIMPLE_TRY_CATCH";
1224 else if (gimple_try_kind (gs
) == GIMPLE_TRY_FINALLY
)
1225 type
= "GIMPLE_TRY_FINALLY";
1227 type
= "UNKNOWN GIMPLE_TRY";
1228 dump_gimple_fmt (buffer
, spc
, flags
,
1229 "%G <%s,%+EVAL <%S>%nCLEANUP <%S>%->", gs
, type
,
1230 gimple_try_eval (gs
), gimple_try_cleanup (gs
));
1234 pp_string (buffer
, "try");
1235 newline_and_indent (buffer
, spc
+ 2);
1236 pp_left_brace (buffer
);
1237 pp_newline (buffer
);
1239 dump_gimple_seq (buffer
, gimple_try_eval (gs
), spc
+ 4, flags
);
1240 newline_and_indent (buffer
, spc
+ 2);
1241 pp_right_brace (buffer
);
1243 gimple_seq seq
= gimple_try_cleanup (gs
);
1245 if (gimple_try_kind (gs
) == GIMPLE_TRY_CATCH
)
1247 newline_and_indent (buffer
, spc
);
1248 pp_string (buffer
, "catch");
1249 newline_and_indent (buffer
, spc
+ 2);
1250 pp_left_brace (buffer
);
1252 else if (gimple_try_kind (gs
) == GIMPLE_TRY_FINALLY
)
1254 newline_and_indent (buffer
, spc
);
1255 pp_string (buffer
, "finally");
1256 newline_and_indent (buffer
, spc
+ 2);
1257 pp_left_brace (buffer
);
1259 if (seq
&& is_a
<geh_else
*> (gimple_seq_first_stmt (seq
))
1260 && gimple_seq_nondebug_singleton_p (seq
))
1262 geh_else
*stmt
= as_a
<geh_else
*> (gimple_seq_first_stmt (seq
));
1263 seq
= gimple_eh_else_n_body (stmt
);
1264 pp_newline (buffer
);
1265 dump_gimple_seq (buffer
, seq
, spc
+ 4, flags
);
1266 newline_and_indent (buffer
, spc
+ 2);
1267 pp_right_brace (buffer
);
1268 seq
= gimple_eh_else_e_body (stmt
);
1269 newline_and_indent (buffer
, spc
);
1270 pp_string (buffer
, "else");
1271 newline_and_indent (buffer
, spc
+ 2);
1272 pp_left_brace (buffer
);
1276 pp_string (buffer
, " <UNKNOWN GIMPLE_TRY> {");
1278 pp_newline (buffer
);
1279 dump_gimple_seq (buffer
, seq
, spc
+ 4, flags
);
1280 newline_and_indent (buffer
, spc
+ 2);
1281 pp_right_brace (buffer
);
1286 /* Dump a GIMPLE_CATCH tuple on the pretty_printer BUFFER, SPC spaces of
1287 indent. FLAGS specifies details to show in the dump (see TDF_* in
1291 dump_gimple_catch (pretty_printer
*buffer
, const gcatch
*gs
, int spc
,
1294 if (flags
& TDF_RAW
)
1295 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %+CATCH <%S>%->", gs
,
1296 gimple_catch_types (gs
), gimple_catch_handler (gs
));
1298 dump_gimple_fmt (buffer
, spc
, flags
, "catch (%T)%+{%S}",
1299 gimple_catch_types (gs
), gimple_catch_handler (gs
));
1303 /* Dump a GIMPLE_EH_FILTER tuple on the pretty_printer BUFFER, SPC spaces of
1304 indent. FLAGS specifies details to show in the dump (see TDF_* in
1308 dump_gimple_eh_filter (pretty_printer
*buffer
, const geh_filter
*gs
, int spc
,
1311 if (flags
& TDF_RAW
)
1312 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %+FAILURE <%S>%->", gs
,
1313 gimple_eh_filter_types (gs
),
1314 gimple_eh_filter_failure (gs
));
1316 dump_gimple_fmt (buffer
, spc
, flags
, "<<<eh_filter (%T)>>>%+{%+%S%-}",
1317 gimple_eh_filter_types (gs
),
1318 gimple_eh_filter_failure (gs
));
1322 /* Dump a GIMPLE_EH_MUST_NOT_THROW tuple. */
1325 dump_gimple_eh_must_not_throw (pretty_printer
*buffer
,
1326 const geh_mnt
*gs
, int spc
, dump_flags_t flags
)
1328 if (flags
& TDF_RAW
)
1329 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
,
1330 gimple_eh_must_not_throw_fndecl (gs
));
1332 dump_gimple_fmt (buffer
, spc
, flags
, "<<<eh_must_not_throw (%T)>>>",
1333 gimple_eh_must_not_throw_fndecl (gs
));
1337 /* Dump a GIMPLE_EH_ELSE tuple on the pretty_printer BUFFER, SPC spaces of
1338 indent. FLAGS specifies details to show in the dump (see TDF_* in
1342 dump_gimple_eh_else (pretty_printer
*buffer
, const geh_else
*gs
, int spc
,
1345 if (flags
& TDF_RAW
)
1346 dump_gimple_fmt (buffer
, spc
, flags
,
1347 "%G <%+N_BODY <%S>%nE_BODY <%S>%->", gs
,
1348 gimple_eh_else_n_body (gs
), gimple_eh_else_e_body (gs
));
1350 dump_gimple_fmt (buffer
, spc
, flags
,
1351 "<<<if_normal_exit>>>%+{%S}%-<<<else_eh_exit>>>%+{%S}",
1352 gimple_eh_else_n_body (gs
), gimple_eh_else_e_body (gs
));
1356 /* Dump a GIMPLE_RESX tuple on the pretty_printer BUFFER, SPC spaces of
1357 indent. FLAGS specifies details to show in the dump (see TDF_* in
1361 dump_gimple_resx (pretty_printer
*buffer
, const gresx
*gs
, int spc
,
1364 if (flags
& TDF_RAW
)
1365 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%d>", gs
,
1366 gimple_resx_region (gs
));
1368 dump_gimple_fmt (buffer
, spc
, flags
, "resx %d", gimple_resx_region (gs
));
1371 /* Dump a GIMPLE_EH_DISPATCH tuple on the pretty_printer BUFFER. */
1374 dump_gimple_eh_dispatch (pretty_printer
*buffer
, const geh_dispatch
*gs
,
1375 int spc
, dump_flags_t flags
)
1377 if (flags
& TDF_RAW
)
1378 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%d>", gs
,
1379 gimple_eh_dispatch_region (gs
));
1381 dump_gimple_fmt (buffer
, spc
, flags
, "eh_dispatch %d",
1382 gimple_eh_dispatch_region (gs
));
1385 /* Dump a GIMPLE_DEBUG tuple on the pretty_printer BUFFER, SPC spaces
1386 of indent. FLAGS specifies details to show in the dump (see TDF_*
1390 dump_gimple_debug (pretty_printer
*buffer
, const gdebug
*gs
, int spc
,
1393 switch (gs
->subcode
)
1395 case GIMPLE_DEBUG_BIND
:
1396 if (flags
& TDF_RAW
)
1397 dump_gimple_fmt (buffer
, spc
, flags
, "%G BIND <%T, %T>", gs
,
1398 gimple_debug_bind_get_var (gs
),
1399 gimple_debug_bind_get_value (gs
));
1401 dump_gimple_fmt (buffer
, spc
, flags
, "# DEBUG %T => %T",
1402 gimple_debug_bind_get_var (gs
),
1403 gimple_debug_bind_get_value (gs
));
1406 case GIMPLE_DEBUG_SOURCE_BIND
:
1407 if (flags
& TDF_RAW
)
1408 dump_gimple_fmt (buffer
, spc
, flags
, "%G SRCBIND <%T, %T>", gs
,
1409 gimple_debug_source_bind_get_var (gs
),
1410 gimple_debug_source_bind_get_value (gs
));
1412 dump_gimple_fmt (buffer
, spc
, flags
, "# DEBUG %T s=> %T",
1413 gimple_debug_source_bind_get_var (gs
),
1414 gimple_debug_source_bind_get_value (gs
));
1417 case GIMPLE_DEBUG_BEGIN_STMT
:
1418 if (flags
& TDF_RAW
)
1419 dump_gimple_fmt (buffer
, spc
, flags
, "%G BEGIN_STMT", gs
);
1421 dump_gimple_fmt (buffer
, spc
, flags
, "# DEBUG BEGIN_STMT");
1424 case GIMPLE_DEBUG_INLINE_ENTRY
:
1425 if (flags
& TDF_RAW
)
1426 dump_gimple_fmt (buffer
, spc
, flags
, "%G INLINE_ENTRY %T", gs
,
1428 ? block_ultimate_origin (gimple_block (gs
))
1431 dump_gimple_fmt (buffer
, spc
, flags
, "# DEBUG INLINE_ENTRY %T",
1433 ? block_ultimate_origin (gimple_block (gs
))
1442 /* Dump a GIMPLE_OMP_FOR tuple on the pretty_printer BUFFER. */
1444 dump_gimple_omp_for (pretty_printer
*buffer
, const gomp_for
*gs
, int spc
,
1449 if (flags
& TDF_RAW
)
1452 switch (gimple_omp_for_kind (gs
))
1454 case GF_OMP_FOR_KIND_FOR
:
1457 case GF_OMP_FOR_KIND_DISTRIBUTE
:
1458 kind
= " distribute";
1460 case GF_OMP_FOR_KIND_TASKLOOP
:
1463 case GF_OMP_FOR_KIND_OACC_LOOP
:
1464 kind
= " oacc_loop";
1466 case GF_OMP_FOR_KIND_SIMD
:
1472 dump_gimple_fmt (buffer
, spc
, flags
, "%G%s <%+BODY <%S>%nCLAUSES <", gs
,
1473 kind
, gimple_omp_body (gs
));
1474 dump_omp_clauses (buffer
, gimple_omp_for_clauses (gs
), spc
, flags
);
1475 dump_gimple_fmt (buffer
, spc
, flags
, " >,");
1476 for (i
= 0; i
< gimple_omp_for_collapse (gs
); i
++)
1477 dump_gimple_fmt (buffer
, spc
, flags
,
1478 "%+%T, %T, %T, %s, %T,%n",
1479 gimple_omp_for_index (gs
, i
),
1480 gimple_omp_for_initial (gs
, i
),
1481 gimple_omp_for_final (gs
, i
),
1482 get_tree_code_name (gimple_omp_for_cond (gs
, i
)),
1483 gimple_omp_for_incr (gs
, i
));
1484 dump_gimple_fmt (buffer
, spc
, flags
, "PRE_BODY <%S>%->",
1485 gimple_omp_for_pre_body (gs
));
1489 switch (gimple_omp_for_kind (gs
))
1491 case GF_OMP_FOR_KIND_FOR
:
1492 pp_string (buffer
, "#pragma omp for");
1494 case GF_OMP_FOR_KIND_DISTRIBUTE
:
1495 pp_string (buffer
, "#pragma omp distribute");
1497 case GF_OMP_FOR_KIND_TASKLOOP
:
1498 pp_string (buffer
, "#pragma omp taskloop");
1500 case GF_OMP_FOR_KIND_OACC_LOOP
:
1501 pp_string (buffer
, "#pragma acc loop");
1503 case GF_OMP_FOR_KIND_SIMD
:
1504 pp_string (buffer
, "#pragma omp simd");
1509 dump_omp_clauses (buffer
, gimple_omp_for_clauses (gs
), spc
, flags
);
1510 for (i
= 0; i
< gimple_omp_for_collapse (gs
); i
++)
1514 newline_and_indent (buffer
, spc
);
1515 pp_string (buffer
, "for (");
1516 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
1518 pp_string (buffer
, " = ");
1519 tree init
= gimple_omp_for_initial (gs
, i
);
1520 if (TREE_CODE (init
) != TREE_VEC
)
1521 dump_generic_node (buffer
, init
, spc
, flags
, false);
1523 dump_omp_loop_non_rect_expr (buffer
, init
, spc
, flags
);
1524 pp_string (buffer
, "; ");
1526 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
1529 switch (gimple_omp_for_cond (gs
, i
))
1535 pp_greater (buffer
);
1538 pp_less_equal (buffer
);
1541 pp_greater_equal (buffer
);
1544 pp_string (buffer
, "!=");
1550 tree cond
= gimple_omp_for_final (gs
, i
);
1551 if (TREE_CODE (cond
) != TREE_VEC
)
1552 dump_generic_node (buffer
, cond
, spc
, flags
, false);
1554 dump_omp_loop_non_rect_expr (buffer
, cond
, spc
, flags
);
1555 pp_string (buffer
, "; ");
1557 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
1559 pp_string (buffer
, " = ");
1560 dump_generic_node (buffer
, gimple_omp_for_incr (gs
, i
), spc
,
1562 pp_right_paren (buffer
);
1565 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1567 newline_and_indent (buffer
, spc
+ 2);
1568 pp_left_brace (buffer
);
1569 pp_newline (buffer
);
1570 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1571 newline_and_indent (buffer
, spc
+ 2);
1572 pp_right_brace (buffer
);
1577 /* Dump a GIMPLE_OMP_CONTINUE tuple on the pretty_printer BUFFER. */
1580 dump_gimple_omp_continue (pretty_printer
*buffer
, const gomp_continue
*gs
,
1581 int spc
, dump_flags_t flags
)
1583 if (flags
& TDF_RAW
)
1585 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T>", gs
,
1586 gimple_omp_continue_control_def (gs
),
1587 gimple_omp_continue_control_use (gs
));
1591 pp_string (buffer
, "#pragma omp continue (");
1592 dump_generic_node (buffer
, gimple_omp_continue_control_def (gs
),
1596 dump_generic_node (buffer
, gimple_omp_continue_control_use (gs
),
1598 pp_right_paren (buffer
);
1602 /* Dump a GIMPLE_OMP_SINGLE tuple on the pretty_printer BUFFER. */
1605 dump_gimple_omp_single (pretty_printer
*buffer
, const gomp_single
*gs
,
1606 int spc
, dump_flags_t flags
)
1608 if (flags
& TDF_RAW
)
1610 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1611 gimple_omp_body (gs
));
1612 dump_omp_clauses (buffer
, gimple_omp_single_clauses (gs
), spc
, flags
);
1613 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1617 pp_string (buffer
, "#pragma omp single");
1618 dump_omp_clauses (buffer
, gimple_omp_single_clauses (gs
), spc
, flags
);
1619 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1621 newline_and_indent (buffer
, spc
+ 2);
1622 pp_left_brace (buffer
);
1623 pp_newline (buffer
);
1624 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1625 newline_and_indent (buffer
, spc
+ 2);
1626 pp_right_brace (buffer
);
1631 /* Dump a GIMPLE_OMP_TASKGROUP tuple on the pretty_printer BUFFER. */
1634 dump_gimple_omp_taskgroup (pretty_printer
*buffer
, const gimple
*gs
,
1635 int spc
, dump_flags_t flags
)
1637 if (flags
& TDF_RAW
)
1639 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1640 gimple_omp_body (gs
));
1641 dump_omp_clauses (buffer
, gimple_omp_taskgroup_clauses (gs
), spc
, flags
);
1642 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1646 pp_string (buffer
, "#pragma omp taskgroup");
1647 dump_omp_clauses (buffer
, gimple_omp_taskgroup_clauses (gs
), spc
, flags
);
1648 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1650 newline_and_indent (buffer
, spc
+ 2);
1651 pp_left_brace (buffer
);
1652 pp_newline (buffer
);
1653 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1654 newline_and_indent (buffer
, spc
+ 2);
1655 pp_right_brace (buffer
);
1660 /* Dump a GIMPLE_OMP_TARGET tuple on the pretty_printer BUFFER. */
1663 dump_gimple_omp_target (pretty_printer
*buffer
, const gomp_target
*gs
,
1664 int spc
, dump_flags_t flags
)
1667 switch (gimple_omp_target_kind (gs
))
1669 case GF_OMP_TARGET_KIND_REGION
:
1672 case GF_OMP_TARGET_KIND_DATA
:
1675 case GF_OMP_TARGET_KIND_UPDATE
:
1678 case GF_OMP_TARGET_KIND_ENTER_DATA
:
1679 kind
= " enter data";
1681 case GF_OMP_TARGET_KIND_EXIT_DATA
:
1682 kind
= " exit data";
1684 case GF_OMP_TARGET_KIND_OACC_KERNELS
:
1685 kind
= " oacc_kernels";
1687 case GF_OMP_TARGET_KIND_OACC_PARALLEL
:
1688 kind
= " oacc_parallel";
1690 case GF_OMP_TARGET_KIND_OACC_SERIAL
:
1691 kind
= " oacc_serial";
1693 case GF_OMP_TARGET_KIND_OACC_DATA
:
1694 kind
= " oacc_data";
1696 case GF_OMP_TARGET_KIND_OACC_UPDATE
:
1697 kind
= " oacc_update";
1699 case GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA
:
1700 kind
= " oacc_enter_exit_data";
1702 case GF_OMP_TARGET_KIND_OACC_DECLARE
:
1703 kind
= " oacc_declare";
1705 case GF_OMP_TARGET_KIND_OACC_HOST_DATA
:
1706 kind
= " oacc_host_data";
1708 case GF_OMP_TARGET_KIND_OACC_PARALLEL_KERNELS_PARALLELIZED
:
1709 kind
= " oacc_parallel_kernels_parallelized";
1711 case GF_OMP_TARGET_KIND_OACC_PARALLEL_KERNELS_GANG_SINGLE
:
1712 kind
= " oacc_parallel_kernels_gang_single";
1714 case GF_OMP_TARGET_KIND_OACC_DATA_KERNELS
:
1715 kind
= " oacc_data_kernels";
1720 if (flags
& TDF_RAW
)
1722 dump_gimple_fmt (buffer
, spc
, flags
, "%G%s <%+BODY <%S>%nCLAUSES <", gs
,
1723 kind
, gimple_omp_body (gs
));
1724 dump_omp_clauses (buffer
, gimple_omp_target_clauses (gs
), spc
, flags
);
1725 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T%n>",
1726 gimple_omp_target_child_fn (gs
),
1727 gimple_omp_target_data_arg (gs
));
1731 pp_string (buffer
, "#pragma omp target");
1732 pp_string (buffer
, kind
);
1733 dump_omp_clauses (buffer
, gimple_omp_target_clauses (gs
), spc
, flags
);
1734 if (gimple_omp_target_child_fn (gs
))
1736 pp_string (buffer
, " [child fn: ");
1737 dump_generic_node (buffer
, gimple_omp_target_child_fn (gs
),
1739 pp_string (buffer
, " (");
1740 if (gimple_omp_target_data_arg (gs
))
1741 dump_generic_node (buffer
, gimple_omp_target_data_arg (gs
),
1744 pp_string (buffer
, "???");
1745 pp_string (buffer
, ")]");
1747 gimple_seq body
= gimple_omp_body (gs
);
1748 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
1750 newline_and_indent (buffer
, spc
+ 2);
1751 pp_left_brace (buffer
);
1752 pp_newline (buffer
);
1753 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
1754 newline_and_indent (buffer
, spc
+ 2);
1755 pp_right_brace (buffer
);
1759 pp_newline (buffer
);
1760 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
1765 /* Dump a GIMPLE_OMP_TEAMS tuple on the pretty_printer BUFFER. */
1768 dump_gimple_omp_teams (pretty_printer
*buffer
, const gomp_teams
*gs
, int spc
,
1771 if (flags
& TDF_RAW
)
1773 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1774 gimple_omp_body (gs
));
1775 dump_omp_clauses (buffer
, gimple_omp_teams_clauses (gs
), spc
, flags
);
1776 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1780 pp_string (buffer
, "#pragma omp teams");
1781 dump_omp_clauses (buffer
, gimple_omp_teams_clauses (gs
), spc
, flags
);
1782 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1784 newline_and_indent (buffer
, spc
+ 2);
1785 pp_character (buffer
, '{');
1786 pp_newline (buffer
);
1787 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1788 newline_and_indent (buffer
, spc
+ 2);
1789 pp_character (buffer
, '}');
1794 /* Dump a GIMPLE_OMP_SECTIONS tuple on the pretty_printer BUFFER. */
1797 dump_gimple_omp_sections (pretty_printer
*buffer
, const gomp_sections
*gs
,
1798 int spc
, dump_flags_t flags
)
1800 if (flags
& TDF_RAW
)
1802 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1803 gimple_omp_body (gs
));
1804 dump_omp_clauses (buffer
, gimple_omp_sections_clauses (gs
), spc
, flags
);
1805 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1809 pp_string (buffer
, "#pragma omp sections");
1810 if (gimple_omp_sections_control (gs
))
1812 pp_string (buffer
, " <");
1813 dump_generic_node (buffer
, gimple_omp_sections_control (gs
), spc
,
1815 pp_greater (buffer
);
1817 dump_omp_clauses (buffer
, gimple_omp_sections_clauses (gs
), spc
, flags
);
1818 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1820 newline_and_indent (buffer
, spc
+ 2);
1821 pp_left_brace (buffer
);
1822 pp_newline (buffer
);
1823 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1824 newline_and_indent (buffer
, spc
+ 2);
1825 pp_right_brace (buffer
);
1830 /* Dump a GIMPLE_OMP_{MASTER,ORDERED,SECTION} tuple on the
1831 pretty_printer BUFFER. */
1834 dump_gimple_omp_block (pretty_printer
*buffer
, const gimple
*gs
, int spc
,
1837 if (flags
& TDF_RAW
)
1838 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1839 gimple_omp_body (gs
));
1842 switch (gimple_code (gs
))
1844 case GIMPLE_OMP_MASTER
:
1845 pp_string (buffer
, "#pragma omp master");
1847 case GIMPLE_OMP_SECTION
:
1848 pp_string (buffer
, "#pragma omp section");
1853 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1855 newline_and_indent (buffer
, spc
+ 2);
1856 pp_left_brace (buffer
);
1857 pp_newline (buffer
);
1858 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1859 newline_and_indent (buffer
, spc
+ 2);
1860 pp_right_brace (buffer
);
1865 /* Dump a GIMPLE_OMP_CRITICAL tuple on the pretty_printer BUFFER. */
1868 dump_gimple_omp_critical (pretty_printer
*buffer
, const gomp_critical
*gs
,
1869 int spc
, dump_flags_t flags
)
1871 if (flags
& TDF_RAW
)
1872 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1873 gimple_omp_body (gs
));
1876 pp_string (buffer
, "#pragma omp critical");
1877 if (gimple_omp_critical_name (gs
))
1879 pp_string (buffer
, " (");
1880 dump_generic_node (buffer
, gimple_omp_critical_name (gs
), spc
,
1882 pp_right_paren (buffer
);
1884 dump_omp_clauses (buffer
, gimple_omp_critical_clauses (gs
), spc
, flags
);
1885 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1887 newline_and_indent (buffer
, spc
+ 2);
1888 pp_left_brace (buffer
);
1889 pp_newline (buffer
);
1890 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1891 newline_and_indent (buffer
, spc
+ 2);
1892 pp_right_brace (buffer
);
1897 /* Dump a GIMPLE_OMP_ORDERED tuple on the pretty_printer BUFFER. */
1900 dump_gimple_omp_ordered (pretty_printer
*buffer
, const gomp_ordered
*gs
,
1901 int spc
, dump_flags_t flags
)
1903 if (flags
& TDF_RAW
)
1904 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1905 gimple_omp_body (gs
));
1908 pp_string (buffer
, "#pragma omp ordered");
1909 dump_omp_clauses (buffer
, gimple_omp_ordered_clauses (gs
), spc
, flags
);
1910 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1912 newline_and_indent (buffer
, spc
+ 2);
1913 pp_left_brace (buffer
);
1914 pp_newline (buffer
);
1915 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1916 newline_and_indent (buffer
, spc
+ 2);
1917 pp_right_brace (buffer
);
1922 /* Dump a GIMPLE_OMP_SCAN tuple on the pretty_printer BUFFER. */
1925 dump_gimple_omp_scan (pretty_printer
*buffer
, const gomp_scan
*gs
,
1926 int spc
, dump_flags_t flags
)
1928 if (flags
& TDF_RAW
)
1929 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1930 gimple_omp_body (gs
));
1933 if (gimple_omp_scan_clauses (gs
))
1935 pp_string (buffer
, "#pragma omp scan");
1936 dump_omp_clauses (buffer
, gimple_omp_scan_clauses (gs
), spc
, flags
);
1938 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1940 newline_and_indent (buffer
, spc
+ 2);
1941 pp_left_brace (buffer
);
1942 pp_newline (buffer
);
1943 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1944 newline_and_indent (buffer
, spc
+ 2);
1945 pp_right_brace (buffer
);
1950 /* Dump a GIMPLE_OMP_RETURN tuple on the pretty_printer BUFFER. */
1953 dump_gimple_omp_return (pretty_printer
*buffer
, const gimple
*gs
, int spc
,
1956 if (flags
& TDF_RAW
)
1958 dump_gimple_fmt (buffer
, spc
, flags
, "%G <nowait=%d", gs
,
1959 (int) gimple_omp_return_nowait_p (gs
));
1960 if (gimple_omp_return_lhs (gs
))
1961 dump_gimple_fmt (buffer
, spc
, flags
, ", lhs=%T>",
1962 gimple_omp_return_lhs (gs
));
1964 dump_gimple_fmt (buffer
, spc
, flags
, ">");
1968 pp_string (buffer
, "#pragma omp return");
1969 if (gimple_omp_return_nowait_p (gs
))
1970 pp_string (buffer
, "(nowait)");
1971 if (gimple_omp_return_lhs (gs
))
1973 pp_string (buffer
, " (set ");
1974 dump_generic_node (buffer
, gimple_omp_return_lhs (gs
),
1976 pp_character (buffer
, ')');
1981 /* Dump a GIMPLE_TRANSACTION tuple on the pretty_printer BUFFER. */
1984 dump_gimple_transaction (pretty_printer
*buffer
, const gtransaction
*gs
,
1985 int spc
, dump_flags_t flags
)
1987 unsigned subcode
= gimple_transaction_subcode (gs
);
1989 if (flags
& TDF_RAW
)
1991 dump_gimple_fmt (buffer
, spc
, flags
,
1992 "%G [SUBCODE=%x,NORM=%T,UNINST=%T,OVER=%T] "
1994 gs
, subcode
, gimple_transaction_label_norm (gs
),
1995 gimple_transaction_label_uninst (gs
),
1996 gimple_transaction_label_over (gs
),
1997 gimple_transaction_body (gs
));
2001 if (subcode
& GTMA_IS_OUTER
)
2002 pp_string (buffer
, "__transaction_atomic [[outer]]");
2003 else if (subcode
& GTMA_IS_RELAXED
)
2004 pp_string (buffer
, "__transaction_relaxed");
2006 pp_string (buffer
, "__transaction_atomic");
2007 subcode
&= ~GTMA_DECLARATION_MASK
;
2009 if (gimple_transaction_body (gs
))
2011 newline_and_indent (buffer
, spc
+ 2);
2012 pp_left_brace (buffer
);
2013 pp_newline (buffer
);
2014 dump_gimple_seq (buffer
, gimple_transaction_body (gs
),
2016 newline_and_indent (buffer
, spc
+ 2);
2017 pp_right_brace (buffer
);
2021 pp_string (buffer
, " //");
2022 if (gimple_transaction_label_norm (gs
))
2024 pp_string (buffer
, " NORM=");
2025 dump_generic_node (buffer
, gimple_transaction_label_norm (gs
),
2028 if (gimple_transaction_label_uninst (gs
))
2030 pp_string (buffer
, " UNINST=");
2031 dump_generic_node (buffer
, gimple_transaction_label_uninst (gs
),
2034 if (gimple_transaction_label_over (gs
))
2036 pp_string (buffer
, " OVER=");
2037 dump_generic_node (buffer
, gimple_transaction_label_over (gs
),
2042 pp_string (buffer
, " SUBCODE=[ ");
2043 if (subcode
& GTMA_HAVE_ABORT
)
2045 pp_string (buffer
, "GTMA_HAVE_ABORT ");
2046 subcode
&= ~GTMA_HAVE_ABORT
;
2048 if (subcode
& GTMA_HAVE_LOAD
)
2050 pp_string (buffer
, "GTMA_HAVE_LOAD ");
2051 subcode
&= ~GTMA_HAVE_LOAD
;
2053 if (subcode
& GTMA_HAVE_STORE
)
2055 pp_string (buffer
, "GTMA_HAVE_STORE ");
2056 subcode
&= ~GTMA_HAVE_STORE
;
2058 if (subcode
& GTMA_MAY_ENTER_IRREVOCABLE
)
2060 pp_string (buffer
, "GTMA_MAY_ENTER_IRREVOCABLE ");
2061 subcode
&= ~GTMA_MAY_ENTER_IRREVOCABLE
;
2063 if (subcode
& GTMA_DOES_GO_IRREVOCABLE
)
2065 pp_string (buffer
, "GTMA_DOES_GO_IRREVOCABLE ");
2066 subcode
&= ~GTMA_DOES_GO_IRREVOCABLE
;
2068 if (subcode
& GTMA_HAS_NO_INSTRUMENTATION
)
2070 pp_string (buffer
, "GTMA_HAS_NO_INSTRUMENTATION ");
2071 subcode
&= ~GTMA_HAS_NO_INSTRUMENTATION
;
2074 pp_printf (buffer
, "0x%x ", subcode
);
2075 pp_right_bracket (buffer
);
2081 /* Dump a GIMPLE_ASM tuple on the pretty_printer BUFFER, SPC spaces of
2082 indent. FLAGS specifies details to show in the dump (see TDF_* in
2086 dump_gimple_asm (pretty_printer
*buffer
, const gasm
*gs
, int spc
,
2089 unsigned int i
, n
, f
, fields
;
2091 if (flags
& TDF_RAW
)
2093 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+STRING <%n%s%n>", gs
,
2094 gimple_asm_string (gs
));
2096 n
= gimple_asm_noutputs (gs
);
2099 newline_and_indent (buffer
, spc
+ 2);
2100 pp_string (buffer
, "OUTPUT: ");
2101 for (i
= 0; i
< n
; i
++)
2103 dump_generic_node (buffer
, gimple_asm_output_op (gs
, i
),
2106 pp_string (buffer
, ", ");
2110 n
= gimple_asm_ninputs (gs
);
2113 newline_and_indent (buffer
, spc
+ 2);
2114 pp_string (buffer
, "INPUT: ");
2115 for (i
= 0; i
< n
; i
++)
2117 dump_generic_node (buffer
, gimple_asm_input_op (gs
, i
),
2120 pp_string (buffer
, ", ");
2124 n
= gimple_asm_nclobbers (gs
);
2127 newline_and_indent (buffer
, spc
+ 2);
2128 pp_string (buffer
, "CLOBBER: ");
2129 for (i
= 0; i
< n
; i
++)
2131 dump_generic_node (buffer
, gimple_asm_clobber_op (gs
, i
),
2134 pp_string (buffer
, ", ");
2138 n
= gimple_asm_nlabels (gs
);
2141 newline_and_indent (buffer
, spc
+ 2);
2142 pp_string (buffer
, "LABEL: ");
2143 for (i
= 0; i
< n
; i
++)
2145 dump_generic_node (buffer
, gimple_asm_label_op (gs
, i
),
2148 pp_string (buffer
, ", ");
2152 newline_and_indent (buffer
, spc
);
2153 pp_greater (buffer
);
2157 pp_string (buffer
, "__asm__");
2158 if (gimple_asm_volatile_p (gs
))
2159 pp_string (buffer
, " __volatile__");
2160 if (gimple_asm_inline_p (gs
))
2161 pp_string (buffer
, " __inline__");
2162 if (gimple_asm_nlabels (gs
))
2163 pp_string (buffer
, " goto");
2164 pp_string (buffer
, "(\"");
2165 pp_string (buffer
, gimple_asm_string (gs
));
2166 pp_string (buffer
, "\"");
2168 if (gimple_asm_nlabels (gs
))
2170 else if (gimple_asm_nclobbers (gs
))
2172 else if (gimple_asm_ninputs (gs
))
2174 else if (gimple_asm_noutputs (gs
))
2179 for (f
= 0; f
< fields
; ++f
)
2181 pp_string (buffer
, " : ");
2186 n
= gimple_asm_noutputs (gs
);
2187 for (i
= 0; i
< n
; i
++)
2189 dump_generic_node (buffer
, gimple_asm_output_op (gs
, i
),
2192 pp_string (buffer
, ", ");
2197 n
= gimple_asm_ninputs (gs
);
2198 for (i
= 0; i
< n
; i
++)
2200 dump_generic_node (buffer
, gimple_asm_input_op (gs
, i
),
2203 pp_string (buffer
, ", ");
2208 n
= gimple_asm_nclobbers (gs
);
2209 for (i
= 0; i
< n
; i
++)
2211 dump_generic_node (buffer
, gimple_asm_clobber_op (gs
, i
),
2214 pp_string (buffer
, ", ");
2219 n
= gimple_asm_nlabels (gs
);
2220 for (i
= 0; i
< n
; i
++)
2222 dump_generic_node (buffer
, gimple_asm_label_op (gs
, i
),
2225 pp_string (buffer
, ", ");
2234 pp_string (buffer
, ");");
2238 /* Dump ptr_info and range_info for NODE on pretty_printer BUFFER with
2239 SPC spaces of indent. */
2242 dump_ssaname_info (pretty_printer
*buffer
, tree node
, int spc
)
2244 if (TREE_CODE (node
) != SSA_NAME
)
2247 if (POINTER_TYPE_P (TREE_TYPE (node
))
2248 && SSA_NAME_PTR_INFO (node
))
2250 unsigned int align
, misalign
;
2251 struct ptr_info_def
*pi
= SSA_NAME_PTR_INFO (node
);
2252 pp_string (buffer
, "# PT = ");
2253 pp_points_to_solution (buffer
, &pi
->pt
);
2254 newline_and_indent (buffer
, spc
);
2255 if (get_ptr_info_alignment (pi
, &align
, &misalign
))
2257 pp_printf (buffer
, "# ALIGN = %u, MISALIGN = %u", align
, misalign
);
2258 newline_and_indent (buffer
, spc
);
2262 if (!POINTER_TYPE_P (TREE_TYPE (node
))
2263 && SSA_NAME_RANGE_INFO (node
))
2265 wide_int min
, max
, nonzero_bits
;
2266 value_range_kind range_type
= get_range_info (node
, &min
, &max
);
2268 if (range_type
== VR_VARYING
)
2269 pp_printf (buffer
, "# RANGE VR_VARYING");
2270 else if (range_type
== VR_RANGE
|| range_type
== VR_ANTI_RANGE
)
2272 pp_printf (buffer
, "# RANGE ");
2273 pp_printf (buffer
, "%s[", range_type
== VR_RANGE
? "" : "~");
2274 pp_wide_int (buffer
, min
, TYPE_SIGN (TREE_TYPE (node
)));
2275 pp_printf (buffer
, ", ");
2276 pp_wide_int (buffer
, max
, TYPE_SIGN (TREE_TYPE (node
)));
2277 pp_printf (buffer
, "]");
2279 nonzero_bits
= get_nonzero_bits (node
);
2280 if (nonzero_bits
!= -1)
2282 pp_string (buffer
, " NONZERO ");
2283 pp_wide_int (buffer
, nonzero_bits
, UNSIGNED
);
2285 newline_and_indent (buffer
, spc
);
2289 /* As dump_ssaname_info, but dump to FILE. */
2292 dump_ssaname_info_to_file (FILE *file
, tree node
, int spc
)
2294 pretty_printer buffer
;
2295 pp_needs_newline (&buffer
) = true;
2296 buffer
.buffer
->stream
= file
;
2297 dump_ssaname_info (&buffer
, node
, spc
);
2301 /* Dump a PHI node PHI. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1.
2302 The caller is responsible for calling pp_flush on BUFFER to finalize
2303 pretty printer. If COMMENT is true, print this after #. */
2306 dump_gimple_phi (pretty_printer
*buffer
, const gphi
*phi
, int spc
, bool comment
,
2310 tree lhs
= gimple_phi_result (phi
);
2312 if (flags
& TDF_ALIAS
)
2313 dump_ssaname_info (buffer
, lhs
, spc
);
2316 pp_string (buffer
, "# ");
2318 if (flags
& TDF_RAW
)
2319 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, ", phi
,
2320 gimple_phi_result (phi
));
2323 dump_generic_node (buffer
, lhs
, spc
, flags
, false);
2324 if (flags
& TDF_GIMPLE
)
2325 pp_string (buffer
, " = __PHI (");
2327 pp_string (buffer
, " = PHI <");
2329 for (i
= 0; i
< gimple_phi_num_args (phi
); i
++)
2331 if ((flags
& TDF_LINENO
) && gimple_phi_arg_has_location (phi
, i
))
2332 dump_location (buffer
, gimple_phi_arg_location (phi
, i
));
2333 basic_block src
= gimple_phi_arg_edge (phi
, i
)->src
;
2334 if (flags
& TDF_GIMPLE
)
2336 pp_string (buffer
, "__BB");
2337 pp_decimal_int (buffer
, src
->index
);
2338 pp_string (buffer
, ": ");
2340 dump_generic_node (buffer
, gimple_phi_arg_def (phi
, i
), spc
, flags
,
2342 if (! (flags
& TDF_GIMPLE
))
2344 pp_left_paren (buffer
);
2345 pp_decimal_int (buffer
, src
->index
);
2346 pp_right_paren (buffer
);
2348 if (i
< gimple_phi_num_args (phi
) - 1)
2349 pp_string (buffer
, ", ");
2351 if (flags
& TDF_GIMPLE
)
2352 pp_string (buffer
, ");");
2354 pp_greater (buffer
);
2358 /* Dump a GIMPLE_OMP_PARALLEL tuple on the pretty_printer BUFFER, SPC spaces
2359 of indent. FLAGS specifies details to show in the dump (see TDF_* in
2363 dump_gimple_omp_parallel (pretty_printer
*buffer
, const gomp_parallel
*gs
,
2364 int spc
, dump_flags_t flags
)
2366 if (flags
& TDF_RAW
)
2368 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
2369 gimple_omp_body (gs
));
2370 dump_omp_clauses (buffer
, gimple_omp_parallel_clauses (gs
), spc
, flags
);
2371 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T%n>",
2372 gimple_omp_parallel_child_fn (gs
),
2373 gimple_omp_parallel_data_arg (gs
));
2378 pp_string (buffer
, "#pragma omp parallel");
2379 dump_omp_clauses (buffer
, gimple_omp_parallel_clauses (gs
), spc
, flags
);
2380 if (gimple_omp_parallel_child_fn (gs
))
2382 pp_string (buffer
, " [child fn: ");
2383 dump_generic_node (buffer
, gimple_omp_parallel_child_fn (gs
),
2385 pp_string (buffer
, " (");
2386 if (gimple_omp_parallel_data_arg (gs
))
2387 dump_generic_node (buffer
, gimple_omp_parallel_data_arg (gs
),
2390 pp_string (buffer
, "???");
2391 pp_string (buffer
, ")]");
2393 body
= gimple_omp_body (gs
);
2394 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
2396 newline_and_indent (buffer
, spc
+ 2);
2397 pp_left_brace (buffer
);
2398 pp_newline (buffer
);
2399 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
2400 newline_and_indent (buffer
, spc
+ 2);
2401 pp_right_brace (buffer
);
2405 pp_newline (buffer
);
2406 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
2412 /* Dump a GIMPLE_OMP_TASK tuple on the pretty_printer BUFFER, SPC spaces
2413 of indent. FLAGS specifies details to show in the dump (see TDF_* in
2417 dump_gimple_omp_task (pretty_printer
*buffer
, const gomp_task
*gs
, int spc
,
2420 if (flags
& TDF_RAW
)
2422 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
2423 gimple_omp_body (gs
));
2424 dump_omp_clauses (buffer
, gimple_omp_task_clauses (gs
), spc
, flags
);
2425 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T, %T, %T, %T%n>",
2426 gimple_omp_task_child_fn (gs
),
2427 gimple_omp_task_data_arg (gs
),
2428 gimple_omp_task_copy_fn (gs
),
2429 gimple_omp_task_arg_size (gs
),
2430 gimple_omp_task_arg_size (gs
));
2435 if (gimple_omp_task_taskloop_p (gs
))
2436 pp_string (buffer
, "#pragma omp taskloop");
2437 else if (gimple_omp_task_taskwait_p (gs
))
2438 pp_string (buffer
, "#pragma omp taskwait");
2440 pp_string (buffer
, "#pragma omp task");
2441 dump_omp_clauses (buffer
, gimple_omp_task_clauses (gs
), spc
, flags
);
2442 if (gimple_omp_task_child_fn (gs
))
2444 pp_string (buffer
, " [child fn: ");
2445 dump_generic_node (buffer
, gimple_omp_task_child_fn (gs
),
2447 pp_string (buffer
, " (");
2448 if (gimple_omp_task_data_arg (gs
))
2449 dump_generic_node (buffer
, gimple_omp_task_data_arg (gs
),
2452 pp_string (buffer
, "???");
2453 pp_string (buffer
, ")]");
2455 body
= gimple_omp_body (gs
);
2456 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
2458 newline_and_indent (buffer
, spc
+ 2);
2459 pp_left_brace (buffer
);
2460 pp_newline (buffer
);
2461 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
2462 newline_and_indent (buffer
, spc
+ 2);
2463 pp_right_brace (buffer
);
2467 pp_newline (buffer
);
2468 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
2474 /* Dump a GIMPLE_OMP_ATOMIC_LOAD tuple on the pretty_printer BUFFER, SPC
2475 spaces of indent. FLAGS specifies details to show in the dump (see TDF_*
2479 dump_gimple_omp_atomic_load (pretty_printer
*buffer
, const gomp_atomic_load
*gs
,
2480 int spc
, dump_flags_t flags
)
2482 if (flags
& TDF_RAW
)
2484 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T>", gs
,
2485 gimple_omp_atomic_load_lhs (gs
),
2486 gimple_omp_atomic_load_rhs (gs
));
2490 pp_string (buffer
, "#pragma omp atomic_load");
2491 dump_omp_atomic_memory_order (buffer
,
2492 gimple_omp_atomic_memory_order (gs
));
2493 if (gimple_omp_atomic_need_value_p (gs
))
2494 pp_string (buffer
, " [needed]");
2495 newline_and_indent (buffer
, spc
+ 2);
2496 dump_generic_node (buffer
, gimple_omp_atomic_load_lhs (gs
),
2502 dump_generic_node (buffer
, gimple_omp_atomic_load_rhs (gs
),
2507 /* Dump a GIMPLE_OMP_ATOMIC_STORE tuple on the pretty_printer BUFFER, SPC
2508 spaces of indent. FLAGS specifies details to show in the dump (see TDF_*
2512 dump_gimple_omp_atomic_store (pretty_printer
*buffer
,
2513 const gomp_atomic_store
*gs
, int spc
,
2516 if (flags
& TDF_RAW
)
2518 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
,
2519 gimple_omp_atomic_store_val (gs
));
2523 pp_string (buffer
, "#pragma omp atomic_store");
2524 dump_omp_atomic_memory_order (buffer
,
2525 gimple_omp_atomic_memory_order (gs
));
2527 if (gimple_omp_atomic_need_value_p (gs
))
2528 pp_string (buffer
, "[needed] ");
2529 pp_left_paren (buffer
);
2530 dump_generic_node (buffer
, gimple_omp_atomic_store_val (gs
),
2532 pp_right_paren (buffer
);
2537 /* Dump all the memory operands for statement GS. BUFFER, SPC and
2538 FLAGS are as in pp_gimple_stmt_1. */
2541 dump_gimple_mem_ops (pretty_printer
*buffer
, const gimple
*gs
, int spc
,
2544 tree vdef
= gimple_vdef (gs
);
2545 tree vuse
= gimple_vuse (gs
);
2547 if (vdef
!= NULL_TREE
)
2549 pp_string (buffer
, "# ");
2550 dump_generic_node (buffer
, vdef
, spc
+ 2, flags
, false);
2551 pp_string (buffer
, " = VDEF <");
2552 dump_generic_node (buffer
, vuse
, spc
+ 2, flags
, false);
2553 pp_greater (buffer
);
2554 newline_and_indent (buffer
, spc
);
2556 else if (vuse
!= NULL_TREE
)
2558 pp_string (buffer
, "# VUSE <");
2559 dump_generic_node (buffer
, vuse
, spc
+ 2, flags
, false);
2560 pp_greater (buffer
);
2561 newline_and_indent (buffer
, spc
);
2566 /* Print the gimple statement GS on the pretty printer BUFFER, SPC
2567 spaces of indent. FLAGS specifies details to show in the dump (see
2568 TDF_* in dumpfile.h). The caller is responsible for calling
2569 pp_flush on BUFFER to finalize the pretty printer. */
2572 pp_gimple_stmt_1 (pretty_printer
*buffer
, const gimple
*gs
, int spc
,
2578 if (flags
& TDF_STMTADDR
)
2579 pp_printf (buffer
, "<&%p> ", (const void *) gs
);
2581 if ((flags
& TDF_LINENO
) && gimple_has_location (gs
))
2582 dump_location (buffer
, gimple_location (gs
));
2586 int lp_nr
= lookup_stmt_eh_lp (gs
);
2588 pp_printf (buffer
, "[LP %d] ", lp_nr
);
2590 pp_printf (buffer
, "[MNT %d] ", -lp_nr
);
2593 if ((flags
& (TDF_VOPS
|TDF_MEMSYMS
))
2594 && gimple_has_mem_ops (gs
))
2595 dump_gimple_mem_ops (buffer
, gs
, spc
, flags
);
2597 if (gimple_has_lhs (gs
)
2598 && (flags
& TDF_ALIAS
))
2599 dump_ssaname_info (buffer
, gimple_get_lhs (gs
), spc
);
2601 switch (gimple_code (gs
))
2604 dump_gimple_asm (buffer
, as_a
<const gasm
*> (gs
), spc
, flags
);
2608 dump_gimple_assign (buffer
, as_a
<const gassign
*> (gs
), spc
, flags
);
2612 dump_gimple_bind (buffer
, as_a
<const gbind
*> (gs
), spc
, flags
);
2616 dump_gimple_call (buffer
, as_a
<const gcall
*> (gs
), spc
, flags
);
2620 dump_gimple_cond (buffer
, as_a
<const gcond
*> (gs
), spc
, flags
);
2624 dump_gimple_label (buffer
, as_a
<const glabel
*> (gs
), spc
, flags
);
2628 dump_gimple_goto (buffer
, as_a
<const ggoto
*> (gs
), spc
, flags
);
2632 pp_string (buffer
, "GIMPLE_NOP");
2636 dump_gimple_return (buffer
, as_a
<const greturn
*> (gs
), spc
, flags
);
2640 dump_gimple_switch (buffer
, as_a
<const gswitch
*> (gs
), spc
, flags
);
2644 dump_gimple_try (buffer
, as_a
<const gtry
*> (gs
), spc
, flags
);
2648 dump_gimple_phi (buffer
, as_a
<const gphi
*> (gs
), spc
, false, flags
);
2651 case GIMPLE_OMP_PARALLEL
:
2652 dump_gimple_omp_parallel (buffer
, as_a
<const gomp_parallel
*> (gs
), spc
,
2656 case GIMPLE_OMP_TASK
:
2657 dump_gimple_omp_task (buffer
, as_a
<const gomp_task
*> (gs
), spc
, flags
);
2660 case GIMPLE_OMP_ATOMIC_LOAD
:
2661 dump_gimple_omp_atomic_load (buffer
, as_a
<const gomp_atomic_load
*> (gs
),
2665 case GIMPLE_OMP_ATOMIC_STORE
:
2666 dump_gimple_omp_atomic_store (buffer
,
2667 as_a
<const gomp_atomic_store
*> (gs
),
2671 case GIMPLE_OMP_FOR
:
2672 dump_gimple_omp_for (buffer
, as_a
<const gomp_for
*> (gs
), spc
, flags
);
2675 case GIMPLE_OMP_CONTINUE
:
2676 dump_gimple_omp_continue (buffer
, as_a
<const gomp_continue
*> (gs
), spc
,
2680 case GIMPLE_OMP_SINGLE
:
2681 dump_gimple_omp_single (buffer
, as_a
<const gomp_single
*> (gs
), spc
,
2685 case GIMPLE_OMP_TARGET
:
2686 dump_gimple_omp_target (buffer
, as_a
<const gomp_target
*> (gs
), spc
,
2690 case GIMPLE_OMP_TEAMS
:
2691 dump_gimple_omp_teams (buffer
, as_a
<const gomp_teams
*> (gs
), spc
,
2695 case GIMPLE_OMP_RETURN
:
2696 dump_gimple_omp_return (buffer
, gs
, spc
, flags
);
2699 case GIMPLE_OMP_SECTIONS
:
2700 dump_gimple_omp_sections (buffer
, as_a
<const gomp_sections
*> (gs
),
2704 case GIMPLE_OMP_SECTIONS_SWITCH
:
2705 pp_string (buffer
, "GIMPLE_SECTIONS_SWITCH");
2708 case GIMPLE_OMP_TASKGROUP
:
2709 dump_gimple_omp_taskgroup (buffer
, gs
, spc
, flags
);
2712 case GIMPLE_OMP_MASTER
:
2713 case GIMPLE_OMP_SECTION
:
2714 dump_gimple_omp_block (buffer
, gs
, spc
, flags
);
2717 case GIMPLE_OMP_ORDERED
:
2718 dump_gimple_omp_ordered (buffer
, as_a
<const gomp_ordered
*> (gs
), spc
,
2722 case GIMPLE_OMP_SCAN
:
2723 dump_gimple_omp_scan (buffer
, as_a
<const gomp_scan
*> (gs
), spc
,
2727 case GIMPLE_OMP_CRITICAL
:
2728 dump_gimple_omp_critical (buffer
, as_a
<const gomp_critical
*> (gs
), spc
,
2733 dump_gimple_catch (buffer
, as_a
<const gcatch
*> (gs
), spc
, flags
);
2736 case GIMPLE_EH_FILTER
:
2737 dump_gimple_eh_filter (buffer
, as_a
<const geh_filter
*> (gs
), spc
,
2741 case GIMPLE_EH_MUST_NOT_THROW
:
2742 dump_gimple_eh_must_not_throw (buffer
,
2743 as_a
<const geh_mnt
*> (gs
),
2747 case GIMPLE_EH_ELSE
:
2748 dump_gimple_eh_else (buffer
, as_a
<const geh_else
*> (gs
), spc
, flags
);
2752 dump_gimple_resx (buffer
, as_a
<const gresx
*> (gs
), spc
, flags
);
2755 case GIMPLE_EH_DISPATCH
:
2756 dump_gimple_eh_dispatch (buffer
, as_a
<const geh_dispatch
*> (gs
), spc
,
2761 dump_gimple_debug (buffer
, as_a
<const gdebug
*> (gs
), spc
, flags
);
2764 case GIMPLE_PREDICT
:
2765 pp_string (buffer
, "// predicted ");
2766 if (gimple_predict_outcome (gs
))
2767 pp_string (buffer
, "likely by ");
2769 pp_string (buffer
, "unlikely by ");
2770 pp_string (buffer
, predictor_name (gimple_predict_predictor (gs
)));
2771 pp_string (buffer
, " predictor.");
2774 case GIMPLE_TRANSACTION
:
2775 dump_gimple_transaction (buffer
, as_a
<const gtransaction
*> (gs
), spc
,
2785 /* Dumps header of basic block BB to OUTF indented by INDENT
2786 spaces and details described by flags. */
2789 dump_gimple_bb_header (FILE *outf
, basic_block bb
, int indent
,
2792 if (flags
& TDF_BLOCKS
)
2794 if (flags
& TDF_LINENO
)
2796 gimple_stmt_iterator gsi
;
2798 fputs (";; ", outf
);
2800 for (gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
); gsi_next (&gsi
))
2801 if (!is_gimple_debug (gsi_stmt (gsi
))
2802 && get_lineno (gsi_stmt (gsi
)) != UNKNOWN_LOCATION
)
2804 fprintf (outf
, "%*sstarting at line %d",
2805 indent
, "", get_lineno (gsi_stmt (gsi
)));
2808 if (bb
->discriminator
)
2809 fprintf (outf
, ", discriminator %i", bb
->discriminator
);
2815 if (flags
& TDF_GIMPLE
)
2817 fprintf (outf
, "%*s__BB(%d", indent
, "", bb
->index
);
2818 if (bb
->loop_father
->header
== bb
)
2819 fprintf (outf
, ",loop_header(%d)", bb
->loop_father
->num
);
2820 if (bb
->count
.initialized_p ())
2821 fprintf (outf
, ",%s(%d)",
2822 profile_quality_as_string (bb
->count
.quality ()),
2823 bb
->count
.value ());
2824 fprintf (outf
, "):\n");
2827 fprintf (outf
, "%*s<bb %d> %s:\n",
2828 indent
, "", bb
->index
, dump_profile (bb
->count
));
2833 /* Dumps end of basic block BB to buffer BUFFER indented by INDENT
2837 dump_gimple_bb_footer (FILE *outf ATTRIBUTE_UNUSED
,
2838 basic_block bb ATTRIBUTE_UNUSED
,
2839 int indent ATTRIBUTE_UNUSED
,
2840 dump_flags_t flags ATTRIBUTE_UNUSED
)
2842 /* There is currently no GIMPLE-specific basic block info to dump. */
2847 /* Dump PHI nodes of basic block BB to BUFFER with details described
2848 by FLAGS and indented by INDENT spaces. */
2851 dump_phi_nodes (pretty_printer
*buffer
, basic_block bb
, int indent
,
2856 for (i
= gsi_start_phis (bb
); !gsi_end_p (i
); gsi_next (&i
))
2858 gphi
*phi
= i
.phi ();
2859 if (!virtual_operand_p (gimple_phi_result (phi
)) || (flags
& TDF_VOPS
))
2862 dump_gimple_phi (buffer
, phi
, indent
,
2863 (flags
& TDF_GIMPLE
) ? false : true, flags
);
2864 pp_newline (buffer
);
2870 /* Dump jump to basic block BB that is represented implicitly in the cfg
2874 pp_cfg_jump (pretty_printer
*buffer
, edge e
, dump_flags_t flags
)
2876 if (flags
& TDF_GIMPLE
)
2878 pp_string (buffer
, "goto __BB");
2879 pp_decimal_int (buffer
, e
->dest
->index
);
2880 if (e
->probability
.initialized_p ())
2882 pp_string (buffer
, "(");
2884 profile_quality_as_string (e
->probability
.quality ()));
2885 pp_string (buffer
, "(");
2886 pp_decimal_int (buffer
, e
->probability
.value ());
2887 pp_string (buffer
, "))");
2889 pp_semicolon (buffer
);
2893 pp_string (buffer
, "goto <bb ");
2894 pp_decimal_int (buffer
, e
->dest
->index
);
2895 pp_greater (buffer
);
2896 pp_semicolon (buffer
);
2898 dump_edge_probability (buffer
, e
);
2903 /* Dump edges represented implicitly in basic block BB to BUFFER, indented
2904 by INDENT spaces, with details given by FLAGS. */
2907 dump_implicit_edges (pretty_printer
*buffer
, basic_block bb
, int indent
,
2913 stmt
= last_stmt (bb
);
2915 if (stmt
&& gimple_code (stmt
) == GIMPLE_COND
)
2917 edge true_edge
, false_edge
;
2919 /* When we are emitting the code or changing CFG, it is possible that
2920 the edges are not yet created. When we are using debug_bb in such
2921 a situation, we do not want it to crash. */
2922 if (EDGE_COUNT (bb
->succs
) != 2)
2924 extract_true_false_edges_from_block (bb
, &true_edge
, &false_edge
);
2926 INDENT (indent
+ 2);
2927 pp_cfg_jump (buffer
, true_edge
, flags
);
2928 newline_and_indent (buffer
, indent
);
2929 pp_string (buffer
, "else");
2930 newline_and_indent (buffer
, indent
+ 2);
2931 pp_cfg_jump (buffer
, false_edge
, flags
);
2932 pp_newline (buffer
);
2936 /* If there is a fallthru edge, we may need to add an artificial
2937 goto to the dump. */
2938 e
= find_fallthru_edge (bb
->succs
);
2940 if (e
&& (e
->dest
!= bb
->next_bb
|| (flags
& TDF_GIMPLE
)))
2944 if ((flags
& TDF_LINENO
)
2945 && e
->goto_locus
!= UNKNOWN_LOCATION
)
2946 dump_location (buffer
, e
->goto_locus
);
2948 pp_cfg_jump (buffer
, e
, flags
);
2949 pp_newline (buffer
);
2954 /* Dumps basic block BB to buffer BUFFER with details described by FLAGS and
2955 indented by INDENT spaces. */
2958 gimple_dump_bb_buff (pretty_printer
*buffer
, basic_block bb
, int indent
,
2961 gimple_stmt_iterator gsi
;
2963 int label_indent
= indent
- 2;
2965 if (label_indent
< 0)
2968 dump_phi_nodes (buffer
, bb
, indent
, flags
);
2970 for (gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
); gsi_next (&gsi
))
2974 stmt
= gsi_stmt (gsi
);
2976 curr_indent
= gimple_code (stmt
) == GIMPLE_LABEL
? label_indent
: indent
;
2978 INDENT (curr_indent
);
2979 pp_gimple_stmt_1 (buffer
, stmt
, curr_indent
, flags
);
2980 pp_newline_and_flush (buffer
);
2981 gcc_checking_assert (DECL_STRUCT_FUNCTION (current_function_decl
));
2982 dump_histograms_for_stmt (DECL_STRUCT_FUNCTION (current_function_decl
),
2983 pp_buffer (buffer
)->stream
, stmt
);
2986 dump_implicit_edges (buffer
, bb
, indent
, flags
);
2991 /* Dumps basic block BB to FILE with details described by FLAGS and
2992 indented by INDENT spaces. */
2995 gimple_dump_bb (FILE *file
, basic_block bb
, int indent
, dump_flags_t flags
)
2997 dump_gimple_bb_header (file
, bb
, indent
, flags
);
2998 if (bb
->index
>= NUM_FIXED_BLOCKS
)
3000 pretty_printer buffer
;
3001 pp_needs_newline (&buffer
) = true;
3002 buffer
.buffer
->stream
= file
;
3003 gimple_dump_bb_buff (&buffer
, bb
, indent
, flags
);
3005 dump_gimple_bb_footer (file
, bb
, indent
, flags
);
3008 /* Dumps basic block BB to pretty-printer PP with default dump flags and
3009 no indentation, for use as a label of a DOT graph record-node.
3010 ??? Should just use gimple_dump_bb_buff here, except that value profiling
3011 histogram dumping doesn't know about pretty-printers. */
3014 gimple_dump_bb_for_graph (pretty_printer
*pp
, basic_block bb
)
3016 pp_printf (pp
, "<bb %d>:\n", bb
->index
);
3017 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
3019 for (gphi_iterator gsi
= gsi_start_phis (bb
); !gsi_end_p (gsi
);
3022 gphi
*phi
= gsi
.phi ();
3023 if (!virtual_operand_p (gimple_phi_result (phi
))
3024 || (dump_flags
& TDF_VOPS
))
3027 pp_write_text_to_stream (pp
);
3028 pp_string (pp
, "# ");
3029 pp_gimple_stmt_1 (pp
, phi
, 0, dump_flags
);
3031 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
3035 for (gimple_stmt_iterator gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
);
3038 gimple
*stmt
= gsi_stmt (gsi
);
3040 pp_write_text_to_stream (pp
);
3041 pp_gimple_stmt_1 (pp
, stmt
, 0, dump_flags
);
3043 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
3045 dump_implicit_edges (pp
, bb
, 0, dump_flags
);
3046 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
3050 /* Handle the %G format for TEXT. Same as %K in handle_K_format in
3051 tree-pretty-print.c but with a Gimple statement as an argument. */
3054 percent_G_format (text_info
*text
)
3056 gimple
*stmt
= va_arg (*text
->args_ptr
, gimple
*);
3058 /* Fall back on the rich location if the statement doesn't have one. */
3059 location_t loc
= gimple_location (stmt
);
3060 if (loc
== UNKNOWN_LOCATION
)
3061 loc
= text
->m_richloc
->get_loc ();
3062 tree block
= gimple_block (stmt
);
3063 percent_K_format (text
, loc
, block
);
3067 # pragma GCC diagnostic pop