1 /* Pretty formatting of GIMPLE statements and expressions.
2 Copyright (C) 2001-2017 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"
43 #define INDENT(SPACE) \
44 do { int i; for (i = 0; i < SPACE; i++) pp_space (buffer); } while (0)
46 #define GIMPLE_NIY do_niy (buffer,gs)
48 /* Try to print on BUFFER a default message for the unrecognized
49 gimple statement GS. */
52 do_niy (pretty_printer
*buffer
, gimple
*gs
)
54 pp_printf (buffer
, "<<< Unknown GIMPLE statement: %s >>>\n",
55 gimple_code_name
[(int) gimple_code (gs
)]);
59 /* Emit a newline and SPC indentation spaces to BUFFER. */
62 newline_and_indent (pretty_printer
*buffer
, int spc
)
69 /* Print the GIMPLE statement GS on stderr. */
72 debug_gimple_stmt (gimple
*gs
)
74 print_gimple_stmt (stderr
, gs
, 0, TDF_VOPS
|TDF_MEMSYMS
);
78 /* Return formatted string of a VALUE probability
79 (biased by REG_BR_PROB_BASE). Returned string is allocated
80 by xstrdup_for_dump. */
83 dump_probability (int frequency
, profile_count
&count
)
85 float minimum
= 0.01f
;
87 gcc_assert (0 <= frequency
&& frequency
<= REG_BR_PROB_BASE
);
88 float fvalue
= frequency
* 100.0f
/ REG_BR_PROB_BASE
;
89 if (fvalue
< minimum
&& frequency
> 0)
93 if (count
.initialized_p ())
94 asprintf (&buf
, "[%.2f%%] [count: %" PRId64
"]", fvalue
,
95 count
.to_gcov_type ());
97 asprintf (&buf
, "[%.2f%%] [count: INV]", fvalue
);
99 const char *ret
= xstrdup_for_dump (buf
);
105 /* Dump E probability to BUFFER. */
108 dump_edge_probability (pretty_printer
*buffer
, edge e
)
110 pp_scalar (buffer
, " %s", dump_probability (e
->probability
, e
->count
));
113 /* Print GIMPLE statement G to FILE using SPC indentation spaces and
114 FLAGS as in pp_gimple_stmt_1. */
117 print_gimple_stmt (FILE *file
, gimple
*g
, int spc
, dump_flags_t flags
)
119 pretty_printer buffer
;
120 pp_needs_newline (&buffer
) = true;
121 buffer
.buffer
->stream
= file
;
122 pp_gimple_stmt_1 (&buffer
, g
, spc
, flags
);
123 pp_newline_and_flush (&buffer
);
129 print_gimple_stmt (stderr
, &ref
, 0, 0);
138 fprintf (stderr
, "<nil>\n");
142 /* Print GIMPLE statement G to FILE using SPC indentation spaces and
143 FLAGS as in pp_gimple_stmt_1. Print only the right-hand side
147 print_gimple_expr (FILE *file
, gimple
*g
, int spc
, dump_flags_t flags
)
149 flags
|= TDF_RHS_ONLY
;
150 pretty_printer buffer
;
151 pp_needs_newline (&buffer
) = true;
152 buffer
.buffer
->stream
= file
;
153 pp_gimple_stmt_1 (&buffer
, g
, spc
, flags
);
158 /* Print the GIMPLE sequence SEQ on BUFFER using SPC indentation
159 spaces and FLAGS as in pp_gimple_stmt_1.
160 The caller is responsible for calling pp_flush on BUFFER to finalize
161 the pretty printer. */
164 dump_gimple_seq (pretty_printer
*buffer
, gimple_seq seq
, int spc
,
167 gimple_stmt_iterator i
;
169 for (i
= gsi_start (seq
); !gsi_end_p (i
); gsi_next (&i
))
171 gimple
*gs
= gsi_stmt (i
);
173 pp_gimple_stmt_1 (buffer
, gs
, spc
, flags
);
174 if (!gsi_one_before_end_p (i
))
180 /* Print GIMPLE sequence SEQ to FILE using SPC indentation spaces and
181 FLAGS as in pp_gimple_stmt_1. */
184 print_gimple_seq (FILE *file
, gimple_seq seq
, int spc
, dump_flags_t flags
)
186 pretty_printer buffer
;
187 pp_needs_newline (&buffer
) = true;
188 buffer
.buffer
->stream
= file
;
189 dump_gimple_seq (&buffer
, seq
, spc
, flags
);
190 pp_newline_and_flush (&buffer
);
194 /* Print the GIMPLE sequence SEQ on stderr. */
197 debug_gimple_seq (gimple_seq seq
)
199 print_gimple_seq (stderr
, seq
, 0, TDF_VOPS
|TDF_MEMSYMS
);
203 /* A simple helper to pretty-print some of the gimple tuples in the printf
204 style. The format modifiers are preceded by '%' and are:
205 'G' - outputs a string corresponding to the code of the given gimple,
206 'S' - outputs a gimple_seq with indent of spc + 2,
207 'T' - outputs the tree t,
208 'd' - outputs an int as a decimal,
209 's' - outputs a string,
210 'n' - outputs a newline,
211 'x' - outputs an int as hexadecimal,
212 '+' - increases indent by 2 then outputs a newline,
213 '-' - decreases indent by 2 then outputs a newline. */
216 dump_gimple_fmt (pretty_printer
*buffer
, int spc
, dump_flags_t flags
,
217 const char *fmt
, ...)
223 va_start (args
, fmt
);
224 for (c
= fmt
; *c
; c
++)
234 g
= va_arg (args
, gimple
*);
235 tmp
= gimple_code_name
[gimple_code (g
)];
236 pp_string (buffer
, tmp
);
240 seq
= va_arg (args
, gimple_seq
);
242 dump_gimple_seq (buffer
, seq
, spc
+ 2, flags
);
243 newline_and_indent (buffer
, spc
);
247 t
= va_arg (args
, tree
);
249 pp_string (buffer
, "NULL");
251 dump_generic_node (buffer
, t
, spc
, flags
, false);
255 pp_decimal_int (buffer
, va_arg (args
, int));
259 pp_string (buffer
, va_arg (args
, char *));
263 newline_and_indent (buffer
, spc
);
267 pp_scalar (buffer
, "%x", va_arg (args
, int));
272 newline_and_indent (buffer
, spc
);
277 newline_and_indent (buffer
, spc
);
285 pp_character (buffer
, *c
);
291 /* Helper for dump_gimple_assign. Print the unary RHS of the
292 assignment GS. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. */
295 dump_unary_rhs (pretty_printer
*buffer
, gassign
*gs
, int spc
,
298 enum tree_code rhs_code
= gimple_assign_rhs_code (gs
);
299 tree lhs
= gimple_assign_lhs (gs
);
300 tree rhs
= gimple_assign_rhs1 (gs
);
304 case VIEW_CONVERT_EXPR
:
306 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
309 case FIXED_CONVERT_EXPR
:
310 case ADDR_SPACE_CONVERT_EXPR
:
314 pp_left_paren (buffer
);
315 dump_generic_node (buffer
, TREE_TYPE (lhs
), spc
, flags
, false);
316 pp_string (buffer
, ") ");
317 if (op_prio (rhs
) < op_code_prio (rhs_code
))
319 pp_left_paren (buffer
);
320 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
321 pp_right_paren (buffer
);
324 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
328 pp_string (buffer
, "((");
329 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
330 pp_string (buffer
, "))");
334 if (flags
& TDF_GIMPLE
)
336 pp_string (buffer
, "__ABS ");
337 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
341 pp_string (buffer
, "ABS_EXPR <");
342 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
348 if (TREE_CODE_CLASS (rhs_code
) == tcc_declaration
349 || TREE_CODE_CLASS (rhs_code
) == tcc_constant
350 || TREE_CODE_CLASS (rhs_code
) == tcc_reference
351 || rhs_code
== SSA_NAME
352 || rhs_code
== ADDR_EXPR
353 || rhs_code
== CONSTRUCTOR
)
355 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
358 else if (rhs_code
== BIT_NOT_EXPR
)
359 pp_complement (buffer
);
360 else if (rhs_code
== TRUTH_NOT_EXPR
)
361 pp_exclamation (buffer
);
362 else if (rhs_code
== NEGATE_EXPR
)
366 pp_left_bracket (buffer
);
367 pp_string (buffer
, get_tree_code_name (rhs_code
));
368 pp_string (buffer
, "] ");
371 if (op_prio (rhs
) < op_code_prio (rhs_code
))
373 pp_left_paren (buffer
);
374 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
375 pp_right_paren (buffer
);
378 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
384 /* Helper for dump_gimple_assign. Print the binary RHS of the
385 assignment GS. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. */
388 dump_binary_rhs (pretty_printer
*buffer
, gassign
*gs
, int spc
,
392 enum tree_code code
= gimple_assign_rhs_code (gs
);
398 case VEC_WIDEN_MULT_HI_EXPR
:
399 case VEC_WIDEN_MULT_LO_EXPR
:
400 case VEC_WIDEN_MULT_EVEN_EXPR
:
401 case VEC_WIDEN_MULT_ODD_EXPR
:
402 case VEC_PACK_TRUNC_EXPR
:
403 case VEC_PACK_SAT_EXPR
:
404 case VEC_PACK_FIX_TRUNC_EXPR
:
405 case VEC_WIDEN_LSHIFT_HI_EXPR
:
406 case VEC_WIDEN_LSHIFT_LO_EXPR
:
407 for (p
= get_tree_code_name (code
); *p
; p
++)
408 pp_character (buffer
, TOUPPER (*p
));
409 pp_string (buffer
, " <");
410 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
411 pp_string (buffer
, ", ");
412 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
417 if (op_prio (gimple_assign_rhs1 (gs
)) <= op_code_prio (code
))
419 pp_left_paren (buffer
);
420 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
,
422 pp_right_paren (buffer
);
425 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
427 pp_string (buffer
, op_symbol_code (gimple_assign_rhs_code (gs
)));
429 if (op_prio (gimple_assign_rhs2 (gs
)) <= op_code_prio (code
))
431 pp_left_paren (buffer
);
432 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
,
434 pp_right_paren (buffer
);
437 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
441 /* Helper for dump_gimple_assign. Print the ternary RHS of the
442 assignment GS. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. */
445 dump_ternary_rhs (pretty_printer
*buffer
, gassign
*gs
, int spc
,
449 enum tree_code code
= gimple_assign_rhs_code (gs
);
452 case WIDEN_MULT_PLUS_EXPR
:
453 case WIDEN_MULT_MINUS_EXPR
:
454 for (p
= get_tree_code_name (code
); *p
; p
++)
455 pp_character (buffer
, TOUPPER (*p
));
456 pp_string (buffer
, " <");
457 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
458 pp_string (buffer
, ", ");
459 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
460 pp_string (buffer
, ", ");
461 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
466 if (flags
& TDF_GIMPLE
)
468 pp_string (buffer
, "__FMA (");
469 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
471 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
473 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
474 pp_right_paren (buffer
);
478 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
479 pp_string (buffer
, " * ");
480 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
481 pp_string (buffer
, " + ");
482 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
487 pp_string (buffer
, "DOT_PROD_EXPR <");
488 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
489 pp_string (buffer
, ", ");
490 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
491 pp_string (buffer
, ", ");
492 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
497 pp_string (buffer
, "SAD_EXPR <");
498 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
499 pp_string (buffer
, ", ");
500 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
501 pp_string (buffer
, ", ");
502 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
507 pp_string (buffer
, "VEC_PERM_EXPR <");
508 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
509 pp_string (buffer
, ", ");
510 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
511 pp_string (buffer
, ", ");
512 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
516 case REALIGN_LOAD_EXPR
:
517 pp_string (buffer
, "REALIGN_LOAD <");
518 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
519 pp_string (buffer
, ", ");
520 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
521 pp_string (buffer
, ", ");
522 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
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);
535 pp_string (buffer
, "VEC_COND_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);
544 case BIT_INSERT_EXPR
:
545 pp_string (buffer
, "BIT_INSERT_EXPR <");
546 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
547 pp_string (buffer
, ", ");
548 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
549 pp_string (buffer
, ", ");
550 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
551 pp_string (buffer
, " (");
552 if (INTEGRAL_TYPE_P (TREE_TYPE (gimple_assign_rhs2 (gs
))))
553 pp_decimal_int (buffer
,
554 TYPE_PRECISION (TREE_TYPE (gimple_assign_rhs2 (gs
))));
556 dump_generic_node (buffer
,
557 TYPE_SIZE (TREE_TYPE (gimple_assign_rhs2 (gs
))),
559 pp_string (buffer
, " bits)>");
568 /* Dump the gimple assignment GS. BUFFER, SPC and FLAGS are as in
572 dump_gimple_assign (pretty_printer
*buffer
, gassign
*gs
, int spc
,
580 switch (gimple_num_ops (gs
))
583 arg3
= gimple_assign_rhs3 (gs
);
586 arg2
= gimple_assign_rhs2 (gs
);
589 arg1
= gimple_assign_rhs1 (gs
);
595 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%s, %T, %T, %T, %T>", gs
,
596 get_tree_code_name (gimple_assign_rhs_code (gs
)),
597 gimple_assign_lhs (gs
), arg1
, arg2
, arg3
);
601 if (!(flags
& TDF_RHS_ONLY
))
603 dump_generic_node (buffer
, gimple_assign_lhs (gs
), spc
, flags
, false);
607 if (gimple_assign_nontemporal_move_p (gs
))
608 pp_string (buffer
, "{nt}");
610 if (gimple_has_volatile_ops (gs
))
611 pp_string (buffer
, "{v}");
616 if (gimple_num_ops (gs
) == 2)
617 dump_unary_rhs (buffer
, gs
, spc
, flags
);
618 else if (gimple_num_ops (gs
) == 3)
619 dump_binary_rhs (buffer
, gs
, spc
, flags
);
620 else if (gimple_num_ops (gs
) == 4)
621 dump_ternary_rhs (buffer
, gs
, spc
, flags
);
624 if (!(flags
& TDF_RHS_ONLY
))
625 pp_semicolon (buffer
);
630 /* Dump the return statement GS. BUFFER, SPC and FLAGS are as in
634 dump_gimple_return (pretty_printer
*buffer
, greturn
*gs
, int spc
,
639 t
= gimple_return_retval (gs
);
640 t2
= gimple_return_retbnd (gs
);
642 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T %T>", gs
, t
, t2
);
645 pp_string (buffer
, "return");
649 dump_generic_node (buffer
, t
, spc
, flags
, false);
653 pp_string (buffer
, ", ");
654 dump_generic_node (buffer
, t2
, spc
, flags
, false);
656 pp_semicolon (buffer
);
661 /* Dump the call arguments for a gimple call. BUFFER, FLAGS are as in
665 dump_gimple_call_args (pretty_printer
*buffer
, gcall
*gs
, dump_flags_t flags
)
669 /* Pretty print first arg to certain internal fns. */
670 if (gimple_call_internal_p (gs
))
672 const char *const *enums
= NULL
;
675 switch (gimple_call_internal_fn (gs
))
679 static const char *const unique_args
[] = {IFN_UNIQUE_CODES
};
683 limit
= ARRAY_SIZE (unique_args
);
688 static const char *const loop_args
[] = {IFN_GOACC_LOOP_CODES
};
691 limit
= ARRAY_SIZE (loop_args
);
694 case IFN_GOACC_REDUCTION
:
696 static const char *const reduction_args
[]
697 = {IFN_GOACC_REDUCTION_CODES
};
699 enums
= reduction_args
;
700 limit
= ARRAY_SIZE (reduction_args
);
705 static const char *const asan_mark_args
[] = {IFN_ASAN_MARK_FLAGS
};
707 enums
= asan_mark_args
;
708 limit
= ARRAY_SIZE (asan_mark_args
);
716 tree arg0
= gimple_call_arg (gs
, 0);
719 if (TREE_CODE (arg0
) == INTEGER_CST
720 && tree_fits_shwi_p (arg0
)
721 && (v
= tree_to_shwi (arg0
)) >= 0 && v
< limit
)
724 pp_string (buffer
, enums
[v
]);
729 for (; i
< gimple_call_num_args (gs
); i
++)
732 pp_string (buffer
, ", ");
733 dump_generic_node (buffer
, gimple_call_arg (gs
, i
), 0, flags
, false);
736 if (gimple_call_va_arg_pack_p (gs
))
739 pp_string (buffer
, ", ");
741 pp_string (buffer
, "__builtin_va_arg_pack ()");
745 /* Dump the points-to solution *PT to BUFFER. */
748 pp_points_to_solution (pretty_printer
*buffer
, struct pt_solution
*pt
)
752 pp_string (buffer
, "anything ");
756 pp_string (buffer
, "nonlocal ");
758 pp_string (buffer
, "escaped ");
760 pp_string (buffer
, "unit-escaped ");
762 pp_string (buffer
, "null ");
764 && !bitmap_empty_p (pt
->vars
))
768 pp_string (buffer
, "{ ");
769 EXECUTE_IF_SET_IN_BITMAP (pt
->vars
, 0, i
, bi
)
771 pp_string (buffer
, "D.");
772 pp_decimal_int (buffer
, i
);
775 pp_right_brace (buffer
);
776 if (pt
->vars_contains_nonlocal
777 || pt
->vars_contains_escaped
778 || pt
->vars_contains_escaped_heap
779 || pt
->vars_contains_restrict
)
781 const char *comma
= "";
782 pp_string (buffer
, " (");
783 if (pt
->vars_contains_nonlocal
)
785 pp_string (buffer
, "nonlocal");
788 if (pt
->vars_contains_escaped
)
790 pp_string (buffer
, comma
);
791 pp_string (buffer
, "escaped");
794 if (pt
->vars_contains_escaped_heap
)
796 pp_string (buffer
, comma
);
797 pp_string (buffer
, "escaped heap");
800 if (pt
->vars_contains_restrict
)
802 pp_string (buffer
, comma
);
803 pp_string (buffer
, "restrict");
806 if (pt
->vars_contains_interposable
)
808 pp_string (buffer
, comma
);
809 pp_string (buffer
, "interposable");
811 pp_string (buffer
, ")");
817 /* Dump the call statement GS. BUFFER, SPC and FLAGS are as in
821 dump_gimple_call (pretty_printer
*buffer
, gcall
*gs
, int spc
,
824 tree lhs
= gimple_call_lhs (gs
);
825 tree fn
= gimple_call_fn (gs
);
827 if (flags
& TDF_ALIAS
)
829 struct pt_solution
*pt
;
830 pt
= gimple_call_use_set (gs
);
831 if (!pt_solution_empty_p (pt
))
833 pp_string (buffer
, "# USE = ");
834 pp_points_to_solution (buffer
, pt
);
835 newline_and_indent (buffer
, spc
);
837 pt
= gimple_call_clobber_set (gs
);
838 if (!pt_solution_empty_p (pt
))
840 pp_string (buffer
, "# CLB = ");
841 pp_points_to_solution (buffer
, pt
);
842 newline_and_indent (buffer
, spc
);
848 if (gimple_call_internal_p (gs
))
849 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%s, %T", gs
,
850 internal_fn_name (gimple_call_internal_fn (gs
)), lhs
);
852 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T", gs
, fn
, lhs
);
853 if (gimple_call_num_args (gs
) > 0)
855 pp_string (buffer
, ", ");
856 dump_gimple_call_args (buffer
, gs
, flags
);
862 if (lhs
&& !(flags
& TDF_RHS_ONLY
))
864 dump_generic_node (buffer
, lhs
, spc
, flags
, false);
865 pp_string (buffer
, " =");
867 if (gimple_has_volatile_ops (gs
))
868 pp_string (buffer
, "{v}");
872 if (gimple_call_internal_p (gs
))
873 pp_string (buffer
, internal_fn_name (gimple_call_internal_fn (gs
)));
875 print_call_name (buffer
, fn
, flags
);
876 pp_string (buffer
, " (");
877 dump_gimple_call_args (buffer
, gs
, flags
);
878 pp_right_paren (buffer
);
879 if (!(flags
& TDF_RHS_ONLY
))
880 pp_semicolon (buffer
);
883 if (gimple_call_chain (gs
))
885 pp_string (buffer
, " [static-chain: ");
886 dump_generic_node (buffer
, gimple_call_chain (gs
), spc
, flags
, false);
887 pp_right_bracket (buffer
);
890 if (gimple_call_return_slot_opt_p (gs
))
891 pp_string (buffer
, " [return slot optimization]");
892 if (gimple_call_tail_p (gs
))
893 pp_string (buffer
, " [tail call]");
894 if (gimple_call_must_tail_p (gs
))
895 pp_string (buffer
, " [must tail call]");
900 /* Dump the arguments of _ITM_beginTransaction sanely. */
901 if (TREE_CODE (fn
) == ADDR_EXPR
)
902 fn
= TREE_OPERAND (fn
, 0);
903 if (TREE_CODE (fn
) == FUNCTION_DECL
&& decl_is_tm_clone (fn
))
904 pp_string (buffer
, " [tm-clone]");
905 if (TREE_CODE (fn
) == FUNCTION_DECL
906 && DECL_BUILT_IN_CLASS (fn
) == BUILT_IN_NORMAL
907 && DECL_FUNCTION_CODE (fn
) == BUILT_IN_TM_START
908 && gimple_call_num_args (gs
) > 0)
910 tree t
= gimple_call_arg (gs
, 0);
911 unsigned HOST_WIDE_INT props
;
912 gcc_assert (TREE_CODE (t
) == INTEGER_CST
);
914 pp_string (buffer
, " [ ");
916 /* Get the transaction code properties. */
917 props
= TREE_INT_CST_LOW (t
);
919 if (props
& PR_INSTRUMENTEDCODE
)
920 pp_string (buffer
, "instrumentedCode ");
921 if (props
& PR_UNINSTRUMENTEDCODE
)
922 pp_string (buffer
, "uninstrumentedCode ");
923 if (props
& PR_HASNOXMMUPDATE
)
924 pp_string (buffer
, "hasNoXMMUpdate ");
925 if (props
& PR_HASNOABORT
)
926 pp_string (buffer
, "hasNoAbort ");
927 if (props
& PR_HASNOIRREVOCABLE
)
928 pp_string (buffer
, "hasNoIrrevocable ");
929 if (props
& PR_DOESGOIRREVOCABLE
)
930 pp_string (buffer
, "doesGoIrrevocable ");
931 if (props
& PR_HASNOSIMPLEREADS
)
932 pp_string (buffer
, "hasNoSimpleReads ");
933 if (props
& PR_AWBARRIERSOMITTED
)
934 pp_string (buffer
, "awBarriersOmitted ");
935 if (props
& PR_RARBARRIERSOMITTED
)
936 pp_string (buffer
, "RaRBarriersOmitted ");
937 if (props
& PR_UNDOLOGCODE
)
938 pp_string (buffer
, "undoLogCode ");
939 if (props
& PR_PREFERUNINSTRUMENTED
)
940 pp_string (buffer
, "preferUninstrumented ");
941 if (props
& PR_EXCEPTIONBLOCK
)
942 pp_string (buffer
, "exceptionBlock ");
943 if (props
& PR_HASELSE
)
944 pp_string (buffer
, "hasElse ");
945 if (props
& PR_READONLY
)
946 pp_string (buffer
, "readOnly ");
948 pp_right_bracket (buffer
);
953 /* Dump the switch statement GS. BUFFER, SPC and FLAGS are as in
957 dump_gimple_switch (pretty_printer
*buffer
, gswitch
*gs
, int spc
,
962 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
964 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, ", gs
,
965 gimple_switch_index (gs
));
968 pp_string (buffer
, "switch (");
969 dump_generic_node (buffer
, gimple_switch_index (gs
), spc
, flags
, true);
970 if (flags
& TDF_GIMPLE
)
971 pp_string (buffer
, ") {");
973 pp_string (buffer
, ") <");
976 for (i
= 0; i
< gimple_switch_num_labels (gs
); i
++)
978 tree case_label
= gimple_switch_label (gs
, i
);
979 gcc_checking_assert (case_label
!= NULL_TREE
);
980 dump_generic_node (buffer
, case_label
, spc
, flags
, false);
982 tree label
= CASE_LABEL (case_label
);
983 dump_generic_node (buffer
, label
, spc
, flags
, false);
985 if (cfun
&& cfun
->cfg
)
987 basic_block dest
= label_to_block (label
);
990 edge label_edge
= find_edge (gimple_bb (gs
), dest
);
991 if (label_edge
&& !(flags
& TDF_GIMPLE
))
992 dump_edge_probability (buffer
, label_edge
);
996 if (i
< gimple_switch_num_labels (gs
) - 1)
998 if (flags
& TDF_GIMPLE
)
999 pp_string (buffer
, "; ");
1001 pp_string (buffer
, ", ");
1004 if (flags
& TDF_GIMPLE
)
1005 pp_string (buffer
, "; }");
1007 pp_greater (buffer
);
1011 /* Dump the gimple conditional GS. BUFFER, SPC and FLAGS are as in
1012 pp_gimple_stmt_1. */
1015 dump_gimple_cond (pretty_printer
*buffer
, gcond
*gs
, int spc
,
1018 if (flags
& TDF_RAW
)
1019 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%s, %T, %T, %T, %T>", gs
,
1020 get_tree_code_name (gimple_cond_code (gs
)),
1021 gimple_cond_lhs (gs
), gimple_cond_rhs (gs
),
1022 gimple_cond_true_label (gs
), gimple_cond_false_label (gs
));
1025 if (!(flags
& TDF_RHS_ONLY
))
1026 pp_string (buffer
, "if (");
1027 dump_generic_node (buffer
, gimple_cond_lhs (gs
), spc
, flags
, false);
1029 pp_string (buffer
, op_symbol_code (gimple_cond_code (gs
)));
1031 dump_generic_node (buffer
, gimple_cond_rhs (gs
), spc
, flags
, false);
1032 if (!(flags
& TDF_RHS_ONLY
))
1035 edge e
, true_edge
= NULL
, false_edge
= NULL
;
1036 basic_block bb
= gimple_bb (gs
);
1040 FOR_EACH_EDGE (e
, ei
, bb
->succs
)
1042 if (e
->flags
& EDGE_TRUE_VALUE
)
1044 else if (e
->flags
& EDGE_FALSE_VALUE
)
1049 bool has_edge_info
= true_edge
!= NULL
&& false_edge
!= NULL
;
1051 pp_right_paren (buffer
);
1053 if (gimple_cond_true_label (gs
))
1055 pp_string (buffer
, " goto ");
1056 dump_generic_node (buffer
, gimple_cond_true_label (gs
),
1058 if (has_edge_info
&& !(flags
& TDF_GIMPLE
))
1059 dump_edge_probability (buffer
, true_edge
);
1060 pp_semicolon (buffer
);
1062 if (gimple_cond_false_label (gs
))
1064 pp_string (buffer
, " else goto ");
1065 dump_generic_node (buffer
, gimple_cond_false_label (gs
),
1067 if (has_edge_info
&& !(flags
& TDF_GIMPLE
))
1068 dump_edge_probability (buffer
, false_edge
);
1070 pp_semicolon (buffer
);
1077 /* Dump a GIMPLE_LABEL tuple on the pretty_printer BUFFER, SPC
1078 spaces of indent. FLAGS specifies details to show in the dump (see
1079 TDF_* in dumpfils.h). */
1082 dump_gimple_label (pretty_printer
*buffer
, glabel
*gs
, int spc
,
1085 tree label
= gimple_label_label (gs
);
1086 if (flags
& TDF_RAW
)
1087 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
, label
);
1090 dump_generic_node (buffer
, label
, spc
, flags
, false);
1091 basic_block bb
= gimple_bb (gs
);
1092 if (bb
&& !(flags
& TDF_GIMPLE
))
1093 pp_scalar (buffer
, " %s", dump_probability (bb
->frequency
, bb
->count
));
1096 if (flags
& TDF_GIMPLE
)
1098 if (DECL_NONLOCAL (label
))
1099 pp_string (buffer
, " [non-local]");
1100 if ((flags
& TDF_EH
) && EH_LANDING_PAD_NR (label
))
1101 pp_printf (buffer
, " [LP %d]", EH_LANDING_PAD_NR (label
));
1104 /* Dump a GIMPLE_GOTO tuple on the pretty_printer BUFFER, SPC
1105 spaces of indent. FLAGS specifies details to show in the dump (see
1106 TDF_* in dumpfile.h). */
1109 dump_gimple_goto (pretty_printer
*buffer
, ggoto
*gs
, int spc
,
1112 tree label
= gimple_goto_dest (gs
);
1113 if (flags
& TDF_RAW
)
1114 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
, label
);
1116 dump_gimple_fmt (buffer
, spc
, flags
, "goto %T;", label
);
1120 /* Dump a GIMPLE_BIND tuple on the pretty_printer BUFFER, SPC
1121 spaces of indent. FLAGS specifies details to show in the dump (see
1122 TDF_* in dumpfile.h). */
1125 dump_gimple_bind (pretty_printer
*buffer
, gbind
*gs
, int spc
,
1128 if (flags
& TDF_RAW
)
1129 dump_gimple_fmt (buffer
, spc
, flags
, "%G <", gs
);
1131 pp_left_brace (buffer
);
1132 if (!(flags
& TDF_SLIM
))
1136 for (var
= gimple_bind_vars (gs
); var
; var
= DECL_CHAIN (var
))
1138 newline_and_indent (buffer
, 2);
1139 print_declaration (buffer
, var
, spc
, flags
);
1141 if (gimple_bind_vars (gs
))
1142 pp_newline (buffer
);
1144 pp_newline (buffer
);
1145 dump_gimple_seq (buffer
, gimple_bind_body (gs
), spc
+ 2, flags
);
1146 newline_and_indent (buffer
, spc
);
1147 if (flags
& TDF_RAW
)
1148 pp_greater (buffer
);
1150 pp_right_brace (buffer
);
1154 /* Dump a GIMPLE_TRY tuple on the pretty_printer BUFFER, SPC spaces of
1155 indent. FLAGS specifies details to show in the dump (see TDF_* in
1159 dump_gimple_try (pretty_printer
*buffer
, gtry
*gs
, int spc
,
1162 if (flags
& TDF_RAW
)
1165 if (gimple_try_kind (gs
) == GIMPLE_TRY_CATCH
)
1166 type
= "GIMPLE_TRY_CATCH";
1167 else if (gimple_try_kind (gs
) == GIMPLE_TRY_FINALLY
)
1168 type
= "GIMPLE_TRY_FINALLY";
1170 type
= "UNKNOWN GIMPLE_TRY";
1171 dump_gimple_fmt (buffer
, spc
, flags
,
1172 "%G <%s,%+EVAL <%S>%nCLEANUP <%S>%->", gs
, type
,
1173 gimple_try_eval (gs
), gimple_try_cleanup (gs
));
1177 pp_string (buffer
, "try");
1178 newline_and_indent (buffer
, spc
+ 2);
1179 pp_left_brace (buffer
);
1180 pp_newline (buffer
);
1182 dump_gimple_seq (buffer
, gimple_try_eval (gs
), spc
+ 4, flags
);
1183 newline_and_indent (buffer
, spc
+ 2);
1184 pp_right_brace (buffer
);
1186 if (gimple_try_kind (gs
) == GIMPLE_TRY_CATCH
)
1188 newline_and_indent (buffer
, spc
);
1189 pp_string (buffer
, "catch");
1190 newline_and_indent (buffer
, spc
+ 2);
1191 pp_left_brace (buffer
);
1193 else if (gimple_try_kind (gs
) == GIMPLE_TRY_FINALLY
)
1195 newline_and_indent (buffer
, spc
);
1196 pp_string (buffer
, "finally");
1197 newline_and_indent (buffer
, spc
+ 2);
1198 pp_left_brace (buffer
);
1201 pp_string (buffer
, " <UNKNOWN GIMPLE_TRY> {");
1203 pp_newline (buffer
);
1204 dump_gimple_seq (buffer
, gimple_try_cleanup (gs
), spc
+ 4, flags
);
1205 newline_and_indent (buffer
, spc
+ 2);
1206 pp_right_brace (buffer
);
1211 /* Dump a GIMPLE_CATCH 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_catch (pretty_printer
*buffer
, gcatch
*gs
, int spc
,
1219 if (flags
& TDF_RAW
)
1220 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %+CATCH <%S>%->", gs
,
1221 gimple_catch_types (gs
), gimple_catch_handler (gs
));
1223 dump_gimple_fmt (buffer
, spc
, flags
, "catch (%T)%+{%S}",
1224 gimple_catch_types (gs
), gimple_catch_handler (gs
));
1228 /* Dump a GIMPLE_EH_FILTER tuple on the pretty_printer BUFFER, SPC spaces of
1229 indent. FLAGS specifies details to show in the dump (see TDF_* in
1233 dump_gimple_eh_filter (pretty_printer
*buffer
, geh_filter
*gs
, int spc
,
1236 if (flags
& TDF_RAW
)
1237 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %+FAILURE <%S>%->", gs
,
1238 gimple_eh_filter_types (gs
),
1239 gimple_eh_filter_failure (gs
));
1241 dump_gimple_fmt (buffer
, spc
, flags
, "<<<eh_filter (%T)>>>%+{%+%S%-}",
1242 gimple_eh_filter_types (gs
),
1243 gimple_eh_filter_failure (gs
));
1247 /* Dump a GIMPLE_EH_MUST_NOT_THROW tuple. */
1250 dump_gimple_eh_must_not_throw (pretty_printer
*buffer
,
1251 geh_mnt
*gs
, int spc
, dump_flags_t flags
)
1253 if (flags
& TDF_RAW
)
1254 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
,
1255 gimple_eh_must_not_throw_fndecl (gs
));
1257 dump_gimple_fmt (buffer
, spc
, flags
, "<<<eh_must_not_throw (%T)>>>",
1258 gimple_eh_must_not_throw_fndecl (gs
));
1262 /* Dump a GIMPLE_EH_ELSE tuple on the pretty_printer BUFFER, SPC spaces of
1263 indent. FLAGS specifies details to show in the dump (see TDF_* in
1267 dump_gimple_eh_else (pretty_printer
*buffer
, geh_else
*gs
, int spc
,
1270 if (flags
& TDF_RAW
)
1271 dump_gimple_fmt (buffer
, spc
, flags
,
1272 "%G <%+N_BODY <%S>%nE_BODY <%S>%->", gs
,
1273 gimple_eh_else_n_body (gs
), gimple_eh_else_e_body (gs
));
1275 dump_gimple_fmt (buffer
, spc
, flags
,
1276 "<<<if_normal_exit>>>%+{%S}%-<<<else_eh_exit>>>%+{%S}",
1277 gimple_eh_else_n_body (gs
), gimple_eh_else_e_body (gs
));
1281 /* Dump a GIMPLE_RESX tuple on the pretty_printer BUFFER, SPC spaces of
1282 indent. FLAGS specifies details to show in the dump (see TDF_* in
1286 dump_gimple_resx (pretty_printer
*buffer
, gresx
*gs
, int spc
,
1289 if (flags
& TDF_RAW
)
1290 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%d>", gs
,
1291 gimple_resx_region (gs
));
1293 dump_gimple_fmt (buffer
, spc
, flags
, "resx %d", gimple_resx_region (gs
));
1296 /* Dump a GIMPLE_EH_DISPATCH tuple on the pretty_printer BUFFER. */
1299 dump_gimple_eh_dispatch (pretty_printer
*buffer
, geh_dispatch
*gs
, int spc
,
1302 if (flags
& TDF_RAW
)
1303 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%d>", gs
,
1304 gimple_eh_dispatch_region (gs
));
1306 dump_gimple_fmt (buffer
, spc
, flags
, "eh_dispatch %d",
1307 gimple_eh_dispatch_region (gs
));
1310 /* Dump a GIMPLE_DEBUG tuple on the pretty_printer BUFFER, SPC spaces
1311 of indent. FLAGS specifies details to show in the dump (see TDF_*
1315 dump_gimple_debug (pretty_printer
*buffer
, gdebug
*gs
, int spc
,
1318 switch (gs
->subcode
)
1320 case GIMPLE_DEBUG_BIND
:
1321 if (flags
& TDF_RAW
)
1322 dump_gimple_fmt (buffer
, spc
, flags
, "%G BIND <%T, %T>", gs
,
1323 gimple_debug_bind_get_var (gs
),
1324 gimple_debug_bind_get_value (gs
));
1326 dump_gimple_fmt (buffer
, spc
, flags
, "# DEBUG %T => %T",
1327 gimple_debug_bind_get_var (gs
),
1328 gimple_debug_bind_get_value (gs
));
1331 case GIMPLE_DEBUG_SOURCE_BIND
:
1332 if (flags
& TDF_RAW
)
1333 dump_gimple_fmt (buffer
, spc
, flags
, "%G SRCBIND <%T, %T>", gs
,
1334 gimple_debug_source_bind_get_var (gs
),
1335 gimple_debug_source_bind_get_value (gs
));
1337 dump_gimple_fmt (buffer
, spc
, flags
, "# DEBUG %T s=> %T",
1338 gimple_debug_source_bind_get_var (gs
),
1339 gimple_debug_source_bind_get_value (gs
));
1347 /* Dump a GIMPLE_OMP_FOR tuple on the pretty_printer BUFFER. */
1349 dump_gimple_omp_for (pretty_printer
*buffer
, gomp_for
*gs
, int spc
,
1354 if (flags
& TDF_RAW
)
1357 switch (gimple_omp_for_kind (gs
))
1359 case GF_OMP_FOR_KIND_FOR
:
1362 case GF_OMP_FOR_KIND_DISTRIBUTE
:
1363 kind
= " distribute";
1365 case GF_OMP_FOR_KIND_TASKLOOP
:
1368 case GF_OMP_FOR_KIND_CILKFOR
:
1369 kind
= " _Cilk_for";
1371 case GF_OMP_FOR_KIND_OACC_LOOP
:
1372 kind
= " oacc_loop";
1374 case GF_OMP_FOR_KIND_SIMD
:
1377 case GF_OMP_FOR_KIND_CILKSIMD
:
1383 dump_gimple_fmt (buffer
, spc
, flags
, "%G%s <%+BODY <%S>%nCLAUSES <", gs
,
1384 kind
, gimple_omp_body (gs
));
1385 dump_omp_clauses (buffer
, gimple_omp_for_clauses (gs
), spc
, flags
);
1386 dump_gimple_fmt (buffer
, spc
, flags
, " >,");
1387 for (i
= 0; i
< gimple_omp_for_collapse (gs
); i
++)
1388 dump_gimple_fmt (buffer
, spc
, flags
,
1389 "%+%T, %T, %T, %s, %T,%n",
1390 gimple_omp_for_index (gs
, i
),
1391 gimple_omp_for_initial (gs
, i
),
1392 gimple_omp_for_final (gs
, i
),
1393 get_tree_code_name (gimple_omp_for_cond (gs
, i
)),
1394 gimple_omp_for_incr (gs
, i
));
1395 dump_gimple_fmt (buffer
, spc
, flags
, "PRE_BODY <%S>%->",
1396 gimple_omp_for_pre_body (gs
));
1400 switch (gimple_omp_for_kind (gs
))
1402 case GF_OMP_FOR_KIND_FOR
:
1403 pp_string (buffer
, "#pragma omp for");
1405 case GF_OMP_FOR_KIND_DISTRIBUTE
:
1406 pp_string (buffer
, "#pragma omp distribute");
1408 case GF_OMP_FOR_KIND_TASKLOOP
:
1409 pp_string (buffer
, "#pragma omp taskloop");
1411 case GF_OMP_FOR_KIND_CILKFOR
:
1413 case GF_OMP_FOR_KIND_OACC_LOOP
:
1414 pp_string (buffer
, "#pragma acc loop");
1416 case GF_OMP_FOR_KIND_SIMD
:
1417 pp_string (buffer
, "#pragma omp simd");
1419 case GF_OMP_FOR_KIND_CILKSIMD
:
1420 pp_string (buffer
, "#pragma simd");
1422 case GF_OMP_FOR_KIND_GRID_LOOP
:
1423 pp_string (buffer
, "#pragma omp for grid_loop");
1428 if (gimple_omp_for_kind (gs
) != GF_OMP_FOR_KIND_CILKFOR
)
1429 dump_omp_clauses (buffer
, gimple_omp_for_clauses (gs
), spc
, flags
);
1430 for (i
= 0; i
< gimple_omp_for_collapse (gs
); i
++)
1434 if (gimple_omp_for_kind (gs
) == GF_OMP_FOR_KIND_CILKFOR
)
1435 pp_string (buffer
, "_Cilk_for (");
1438 newline_and_indent (buffer
, spc
);
1439 pp_string (buffer
, "for (");
1441 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
1443 pp_string (buffer
, " = ");
1444 dump_generic_node (buffer
, gimple_omp_for_initial (gs
, i
), spc
,
1446 pp_string (buffer
, "; ");
1448 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
1451 switch (gimple_omp_for_cond (gs
, i
))
1457 pp_greater (buffer
);
1460 pp_less_equal (buffer
);
1463 pp_greater_equal (buffer
);
1466 pp_string (buffer
, "!=");
1472 dump_generic_node (buffer
, gimple_omp_for_final (gs
, i
), spc
,
1474 pp_string (buffer
, "; ");
1476 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
1478 pp_string (buffer
, " = ");
1479 dump_generic_node (buffer
, gimple_omp_for_incr (gs
, i
), spc
,
1481 pp_right_paren (buffer
);
1484 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1486 if (gimple_omp_for_kind (gs
) == GF_OMP_FOR_KIND_CILKFOR
)
1487 dump_omp_clauses (buffer
, gimple_omp_for_clauses (gs
), spc
, flags
);
1488 newline_and_indent (buffer
, spc
+ 2);
1489 pp_left_brace (buffer
);
1490 pp_newline (buffer
);
1491 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1492 newline_and_indent (buffer
, spc
+ 2);
1493 pp_right_brace (buffer
);
1498 /* Dump a GIMPLE_OMP_CONTINUE tuple on the pretty_printer BUFFER. */
1501 dump_gimple_omp_continue (pretty_printer
*buffer
, gomp_continue
*gs
,
1502 int spc
, dump_flags_t flags
)
1504 if (flags
& TDF_RAW
)
1506 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T>", gs
,
1507 gimple_omp_continue_control_def (gs
),
1508 gimple_omp_continue_control_use (gs
));
1512 pp_string (buffer
, "#pragma omp continue (");
1513 dump_generic_node (buffer
, gimple_omp_continue_control_def (gs
),
1517 dump_generic_node (buffer
, gimple_omp_continue_control_use (gs
),
1519 pp_right_paren (buffer
);
1523 /* Dump a GIMPLE_OMP_SINGLE tuple on the pretty_printer BUFFER. */
1526 dump_gimple_omp_single (pretty_printer
*buffer
, gomp_single
*gs
,
1527 int spc
, dump_flags_t flags
)
1529 if (flags
& TDF_RAW
)
1531 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1532 gimple_omp_body (gs
));
1533 dump_omp_clauses (buffer
, gimple_omp_single_clauses (gs
), spc
, flags
);
1534 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1538 pp_string (buffer
, "#pragma omp single");
1539 dump_omp_clauses (buffer
, gimple_omp_single_clauses (gs
), spc
, flags
);
1540 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1542 newline_and_indent (buffer
, spc
+ 2);
1543 pp_left_brace (buffer
);
1544 pp_newline (buffer
);
1545 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1546 newline_and_indent (buffer
, spc
+ 2);
1547 pp_right_brace (buffer
);
1552 /* Dump a GIMPLE_OMP_TARGET tuple on the pretty_printer BUFFER. */
1555 dump_gimple_omp_target (pretty_printer
*buffer
, gomp_target
*gs
,
1556 int spc
, dump_flags_t flags
)
1559 switch (gimple_omp_target_kind (gs
))
1561 case GF_OMP_TARGET_KIND_REGION
:
1564 case GF_OMP_TARGET_KIND_DATA
:
1567 case GF_OMP_TARGET_KIND_UPDATE
:
1570 case GF_OMP_TARGET_KIND_ENTER_DATA
:
1571 kind
= " enter data";
1573 case GF_OMP_TARGET_KIND_EXIT_DATA
:
1574 kind
= " exit data";
1576 case GF_OMP_TARGET_KIND_OACC_KERNELS
:
1577 kind
= " oacc_kernels";
1579 case GF_OMP_TARGET_KIND_OACC_PARALLEL
:
1580 kind
= " oacc_parallel";
1582 case GF_OMP_TARGET_KIND_OACC_DATA
:
1583 kind
= " oacc_data";
1585 case GF_OMP_TARGET_KIND_OACC_UPDATE
:
1586 kind
= " oacc_update";
1588 case GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA
:
1589 kind
= " oacc_enter_exit_data";
1591 case GF_OMP_TARGET_KIND_OACC_DECLARE
:
1592 kind
= " oacc_declare";
1594 case GF_OMP_TARGET_KIND_OACC_HOST_DATA
:
1595 kind
= " oacc_host_data";
1600 if (flags
& TDF_RAW
)
1602 dump_gimple_fmt (buffer
, spc
, flags
, "%G%s <%+BODY <%S>%nCLAUSES <", gs
,
1603 kind
, gimple_omp_body (gs
));
1604 dump_omp_clauses (buffer
, gimple_omp_target_clauses (gs
), spc
, flags
);
1605 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T%n>",
1606 gimple_omp_target_child_fn (gs
),
1607 gimple_omp_target_data_arg (gs
));
1611 pp_string (buffer
, "#pragma omp target");
1612 pp_string (buffer
, kind
);
1613 dump_omp_clauses (buffer
, gimple_omp_target_clauses (gs
), spc
, flags
);
1614 if (gimple_omp_target_child_fn (gs
))
1616 pp_string (buffer
, " [child fn: ");
1617 dump_generic_node (buffer
, gimple_omp_target_child_fn (gs
),
1619 pp_string (buffer
, " (");
1620 if (gimple_omp_target_data_arg (gs
))
1621 dump_generic_node (buffer
, gimple_omp_target_data_arg (gs
),
1624 pp_string (buffer
, "???");
1625 pp_string (buffer
, ")]");
1627 gimple_seq body
= gimple_omp_body (gs
);
1628 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
1630 newline_and_indent (buffer
, spc
+ 2);
1631 pp_left_brace (buffer
);
1632 pp_newline (buffer
);
1633 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
1634 newline_and_indent (buffer
, spc
+ 2);
1635 pp_right_brace (buffer
);
1639 pp_newline (buffer
);
1640 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
1645 /* Dump a GIMPLE_OMP_TEAMS tuple on the pretty_printer BUFFER. */
1648 dump_gimple_omp_teams (pretty_printer
*buffer
, gomp_teams
*gs
, int spc
,
1651 if (flags
& TDF_RAW
)
1653 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1654 gimple_omp_body (gs
));
1655 dump_omp_clauses (buffer
, gimple_omp_teams_clauses (gs
), spc
, flags
);
1656 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1660 pp_string (buffer
, "#pragma omp teams");
1661 dump_omp_clauses (buffer
, gimple_omp_teams_clauses (gs
), spc
, flags
);
1662 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1664 newline_and_indent (buffer
, spc
+ 2);
1665 pp_character (buffer
, '{');
1666 pp_newline (buffer
);
1667 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1668 newline_and_indent (buffer
, spc
+ 2);
1669 pp_character (buffer
, '}');
1674 /* Dump a GIMPLE_OMP_SECTIONS tuple on the pretty_printer BUFFER. */
1677 dump_gimple_omp_sections (pretty_printer
*buffer
, gomp_sections
*gs
,
1678 int spc
, dump_flags_t flags
)
1680 if (flags
& TDF_RAW
)
1682 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1683 gimple_omp_body (gs
));
1684 dump_omp_clauses (buffer
, gimple_omp_sections_clauses (gs
), spc
, flags
);
1685 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1689 pp_string (buffer
, "#pragma omp sections");
1690 if (gimple_omp_sections_control (gs
))
1692 pp_string (buffer
, " <");
1693 dump_generic_node (buffer
, gimple_omp_sections_control (gs
), spc
,
1695 pp_greater (buffer
);
1697 dump_omp_clauses (buffer
, gimple_omp_sections_clauses (gs
), spc
, flags
);
1698 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1700 newline_and_indent (buffer
, spc
+ 2);
1701 pp_left_brace (buffer
);
1702 pp_newline (buffer
);
1703 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1704 newline_and_indent (buffer
, spc
+ 2);
1705 pp_right_brace (buffer
);
1710 /* Dump a GIMPLE_OMP_{MASTER,TASKGROUP,ORDERED,SECTION} tuple on the
1711 pretty_printer BUFFER. */
1714 dump_gimple_omp_block (pretty_printer
*buffer
, gimple
*gs
, int spc
,
1717 if (flags
& TDF_RAW
)
1718 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1719 gimple_omp_body (gs
));
1722 switch (gimple_code (gs
))
1724 case GIMPLE_OMP_MASTER
:
1725 pp_string (buffer
, "#pragma omp master");
1727 case GIMPLE_OMP_TASKGROUP
:
1728 pp_string (buffer
, "#pragma omp taskgroup");
1730 case GIMPLE_OMP_SECTION
:
1731 pp_string (buffer
, "#pragma omp section");
1733 case GIMPLE_OMP_GRID_BODY
:
1734 pp_string (buffer
, "#pragma omp gridified body");
1739 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1741 newline_and_indent (buffer
, spc
+ 2);
1742 pp_left_brace (buffer
);
1743 pp_newline (buffer
);
1744 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1745 newline_and_indent (buffer
, spc
+ 2);
1746 pp_right_brace (buffer
);
1751 /* Dump a GIMPLE_OMP_CRITICAL tuple on the pretty_printer BUFFER. */
1754 dump_gimple_omp_critical (pretty_printer
*buffer
, gomp_critical
*gs
,
1755 int spc
, dump_flags_t flags
)
1757 if (flags
& TDF_RAW
)
1758 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1759 gimple_omp_body (gs
));
1762 pp_string (buffer
, "#pragma omp critical");
1763 if (gimple_omp_critical_name (gs
))
1765 pp_string (buffer
, " (");
1766 dump_generic_node (buffer
, gimple_omp_critical_name (gs
), spc
,
1768 pp_right_paren (buffer
);
1770 dump_omp_clauses (buffer
, gimple_omp_critical_clauses (gs
), spc
, flags
);
1771 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1773 newline_and_indent (buffer
, spc
+ 2);
1774 pp_left_brace (buffer
);
1775 pp_newline (buffer
);
1776 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1777 newline_and_indent (buffer
, spc
+ 2);
1778 pp_right_brace (buffer
);
1783 /* Dump a GIMPLE_OMP_ORDERED tuple on the pretty_printer BUFFER. */
1786 dump_gimple_omp_ordered (pretty_printer
*buffer
, gomp_ordered
*gs
,
1787 int spc
, dump_flags_t flags
)
1789 if (flags
& TDF_RAW
)
1790 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1791 gimple_omp_body (gs
));
1794 pp_string (buffer
, "#pragma omp ordered");
1795 dump_omp_clauses (buffer
, gimple_omp_ordered_clauses (gs
), spc
, flags
);
1796 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1798 newline_and_indent (buffer
, spc
+ 2);
1799 pp_left_brace (buffer
);
1800 pp_newline (buffer
);
1801 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1802 newline_and_indent (buffer
, spc
+ 2);
1803 pp_right_brace (buffer
);
1808 /* Dump a GIMPLE_OMP_RETURN tuple on the pretty_printer BUFFER. */
1811 dump_gimple_omp_return (pretty_printer
*buffer
, gimple
*gs
, int spc
,
1814 if (flags
& TDF_RAW
)
1816 dump_gimple_fmt (buffer
, spc
, flags
, "%G <nowait=%d", gs
,
1817 (int) gimple_omp_return_nowait_p (gs
));
1818 if (gimple_omp_return_lhs (gs
))
1819 dump_gimple_fmt (buffer
, spc
, flags
, ", lhs=%T>",
1820 gimple_omp_return_lhs (gs
));
1822 dump_gimple_fmt (buffer
, spc
, flags
, ">");
1826 pp_string (buffer
, "#pragma omp return");
1827 if (gimple_omp_return_nowait_p (gs
))
1828 pp_string (buffer
, "(nowait)");
1829 if (gimple_omp_return_lhs (gs
))
1831 pp_string (buffer
, " (set ");
1832 dump_generic_node (buffer
, gimple_omp_return_lhs (gs
),
1834 pp_character (buffer
, ')');
1839 /* Dump a GIMPLE_TRANSACTION tuple on the pretty_printer BUFFER. */
1842 dump_gimple_transaction (pretty_printer
*buffer
, gtransaction
*gs
,
1843 int spc
, dump_flags_t flags
)
1845 unsigned subcode
= gimple_transaction_subcode (gs
);
1847 if (flags
& TDF_RAW
)
1849 dump_gimple_fmt (buffer
, spc
, flags
,
1850 "%G [SUBCODE=%x,NORM=%T,UNINST=%T,OVER=%T] "
1852 gs
, subcode
, gimple_transaction_label_norm (gs
),
1853 gimple_transaction_label_uninst (gs
),
1854 gimple_transaction_label_over (gs
),
1855 gimple_transaction_body (gs
));
1859 if (subcode
& GTMA_IS_OUTER
)
1860 pp_string (buffer
, "__transaction_atomic [[outer]]");
1861 else if (subcode
& GTMA_IS_RELAXED
)
1862 pp_string (buffer
, "__transaction_relaxed");
1864 pp_string (buffer
, "__transaction_atomic");
1865 subcode
&= ~GTMA_DECLARATION_MASK
;
1867 if (gimple_transaction_body (gs
))
1869 newline_and_indent (buffer
, spc
+ 2);
1870 pp_left_brace (buffer
);
1871 pp_newline (buffer
);
1872 dump_gimple_seq (buffer
, gimple_transaction_body (gs
),
1874 newline_and_indent (buffer
, spc
+ 2);
1875 pp_right_brace (buffer
);
1879 pp_string (buffer
, " //");
1880 if (gimple_transaction_label_norm (gs
))
1882 pp_string (buffer
, " NORM=");
1883 dump_generic_node (buffer
, gimple_transaction_label_norm (gs
),
1886 if (gimple_transaction_label_uninst (gs
))
1888 pp_string (buffer
, " UNINST=");
1889 dump_generic_node (buffer
, gimple_transaction_label_uninst (gs
),
1892 if (gimple_transaction_label_over (gs
))
1894 pp_string (buffer
, " OVER=");
1895 dump_generic_node (buffer
, gimple_transaction_label_over (gs
),
1900 pp_string (buffer
, " SUBCODE=[ ");
1901 if (subcode
& GTMA_HAVE_ABORT
)
1903 pp_string (buffer
, "GTMA_HAVE_ABORT ");
1904 subcode
&= ~GTMA_HAVE_ABORT
;
1906 if (subcode
& GTMA_HAVE_LOAD
)
1908 pp_string (buffer
, "GTMA_HAVE_LOAD ");
1909 subcode
&= ~GTMA_HAVE_LOAD
;
1911 if (subcode
& GTMA_HAVE_STORE
)
1913 pp_string (buffer
, "GTMA_HAVE_STORE ");
1914 subcode
&= ~GTMA_HAVE_STORE
;
1916 if (subcode
& GTMA_MAY_ENTER_IRREVOCABLE
)
1918 pp_string (buffer
, "GTMA_MAY_ENTER_IRREVOCABLE ");
1919 subcode
&= ~GTMA_MAY_ENTER_IRREVOCABLE
;
1921 if (subcode
& GTMA_DOES_GO_IRREVOCABLE
)
1923 pp_string (buffer
, "GTMA_DOES_GO_IRREVOCABLE ");
1924 subcode
&= ~GTMA_DOES_GO_IRREVOCABLE
;
1926 if (subcode
& GTMA_HAS_NO_INSTRUMENTATION
)
1928 pp_string (buffer
, "GTMA_HAS_NO_INSTRUMENTATION ");
1929 subcode
&= ~GTMA_HAS_NO_INSTRUMENTATION
;
1932 pp_printf (buffer
, "0x%x ", subcode
);
1933 pp_right_bracket (buffer
);
1939 /* Dump a GIMPLE_ASM tuple on the pretty_printer BUFFER, SPC spaces of
1940 indent. FLAGS specifies details to show in the dump (see TDF_* in
1944 dump_gimple_asm (pretty_printer
*buffer
, gasm
*gs
, int spc
, dump_flags_t flags
)
1946 unsigned int i
, n
, f
, fields
;
1948 if (flags
& TDF_RAW
)
1950 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+STRING <%n%s%n>", gs
,
1951 gimple_asm_string (gs
));
1953 n
= gimple_asm_noutputs (gs
);
1956 newline_and_indent (buffer
, spc
+ 2);
1957 pp_string (buffer
, "OUTPUT: ");
1958 for (i
= 0; i
< n
; i
++)
1960 dump_generic_node (buffer
, gimple_asm_output_op (gs
, i
),
1963 pp_string (buffer
, ", ");
1967 n
= gimple_asm_ninputs (gs
);
1970 newline_and_indent (buffer
, spc
+ 2);
1971 pp_string (buffer
, "INPUT: ");
1972 for (i
= 0; i
< n
; i
++)
1974 dump_generic_node (buffer
, gimple_asm_input_op (gs
, i
),
1977 pp_string (buffer
, ", ");
1981 n
= gimple_asm_nclobbers (gs
);
1984 newline_and_indent (buffer
, spc
+ 2);
1985 pp_string (buffer
, "CLOBBER: ");
1986 for (i
= 0; i
< n
; i
++)
1988 dump_generic_node (buffer
, gimple_asm_clobber_op (gs
, i
),
1991 pp_string (buffer
, ", ");
1995 n
= gimple_asm_nlabels (gs
);
1998 newline_and_indent (buffer
, spc
+ 2);
1999 pp_string (buffer
, "LABEL: ");
2000 for (i
= 0; i
< n
; i
++)
2002 dump_generic_node (buffer
, gimple_asm_label_op (gs
, i
),
2005 pp_string (buffer
, ", ");
2009 newline_and_indent (buffer
, spc
);
2010 pp_greater (buffer
);
2014 pp_string (buffer
, "__asm__");
2015 if (gimple_asm_volatile_p (gs
))
2016 pp_string (buffer
, " __volatile__");
2017 if (gimple_asm_nlabels (gs
))
2018 pp_string (buffer
, " goto");
2019 pp_string (buffer
, "(\"");
2020 pp_string (buffer
, gimple_asm_string (gs
));
2021 pp_string (buffer
, "\"");
2023 if (gimple_asm_nlabels (gs
))
2025 else if (gimple_asm_nclobbers (gs
))
2027 else if (gimple_asm_ninputs (gs
))
2029 else if (gimple_asm_noutputs (gs
))
2034 for (f
= 0; f
< fields
; ++f
)
2036 pp_string (buffer
, " : ");
2041 n
= gimple_asm_noutputs (gs
);
2042 for (i
= 0; i
< n
; i
++)
2044 dump_generic_node (buffer
, gimple_asm_output_op (gs
, i
),
2047 pp_string (buffer
, ", ");
2052 n
= gimple_asm_ninputs (gs
);
2053 for (i
= 0; i
< n
; i
++)
2055 dump_generic_node (buffer
, gimple_asm_input_op (gs
, i
),
2058 pp_string (buffer
, ", ");
2063 n
= gimple_asm_nclobbers (gs
);
2064 for (i
= 0; i
< n
; i
++)
2066 dump_generic_node (buffer
, gimple_asm_clobber_op (gs
, i
),
2069 pp_string (buffer
, ", ");
2074 n
= gimple_asm_nlabels (gs
);
2075 for (i
= 0; i
< n
; i
++)
2077 dump_generic_node (buffer
, gimple_asm_label_op (gs
, i
),
2080 pp_string (buffer
, ", ");
2089 pp_string (buffer
, ");");
2093 /* Dump ptr_info and range_info for NODE on pretty_printer BUFFER with
2094 SPC spaces of indent. */
2097 dump_ssaname_info (pretty_printer
*buffer
, tree node
, int spc
)
2099 if (TREE_CODE (node
) != SSA_NAME
)
2102 if (POINTER_TYPE_P (TREE_TYPE (node
))
2103 && SSA_NAME_PTR_INFO (node
))
2105 unsigned int align
, misalign
;
2106 struct ptr_info_def
*pi
= SSA_NAME_PTR_INFO (node
);
2107 pp_string (buffer
, "# PT = ");
2108 pp_points_to_solution (buffer
, &pi
->pt
);
2109 newline_and_indent (buffer
, spc
);
2110 if (get_ptr_info_alignment (pi
, &align
, &misalign
))
2112 pp_printf (buffer
, "# ALIGN = %u, MISALIGN = %u", align
, misalign
);
2113 newline_and_indent (buffer
, spc
);
2117 if (!POINTER_TYPE_P (TREE_TYPE (node
))
2118 && SSA_NAME_RANGE_INFO (node
))
2120 wide_int min
, max
, nonzero_bits
;
2121 value_range_type range_type
= get_range_info (node
, &min
, &max
);
2123 if (range_type
== VR_VARYING
)
2124 pp_printf (buffer
, "# RANGE VR_VARYING");
2125 else if (range_type
== VR_RANGE
|| range_type
== VR_ANTI_RANGE
)
2127 pp_printf (buffer
, "# RANGE ");
2128 pp_printf (buffer
, "%s[", range_type
== VR_RANGE
? "" : "~");
2129 pp_wide_int (buffer
, min
, TYPE_SIGN (TREE_TYPE (node
)));
2130 pp_printf (buffer
, ", ");
2131 pp_wide_int (buffer
, max
, TYPE_SIGN (TREE_TYPE (node
)));
2132 pp_printf (buffer
, "]");
2134 nonzero_bits
= get_nonzero_bits (node
);
2135 if (nonzero_bits
!= -1)
2137 pp_string (buffer
, " NONZERO ");
2138 pp_wide_int (buffer
, nonzero_bits
, UNSIGNED
);
2140 newline_and_indent (buffer
, spc
);
2144 /* As dump_ssaname_info, but dump to FILE. */
2147 dump_ssaname_info_to_file (FILE *file
, tree node
, int spc
)
2149 pretty_printer buffer
;
2150 pp_needs_newline (&buffer
) = true;
2151 buffer
.buffer
->stream
= file
;
2152 dump_ssaname_info (&buffer
, node
, spc
);
2156 /* Dump a PHI node PHI. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1.
2157 The caller is responsible for calling pp_flush on BUFFER to finalize
2158 pretty printer. If COMMENT is true, print this after #. */
2161 dump_gimple_phi (pretty_printer
*buffer
, gphi
*phi
, int spc
, bool comment
,
2165 tree lhs
= gimple_phi_result (phi
);
2167 if (flags
& TDF_ALIAS
)
2168 dump_ssaname_info (buffer
, lhs
, spc
);
2171 pp_string (buffer
, "# ");
2173 if (flags
& TDF_RAW
)
2174 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, ", phi
,
2175 gimple_phi_result (phi
));
2178 dump_generic_node (buffer
, lhs
, spc
, flags
, false);
2179 if (flags
& TDF_GIMPLE
)
2180 pp_string (buffer
, " = __PHI (");
2182 pp_string (buffer
, " = PHI <");
2184 for (i
= 0; i
< gimple_phi_num_args (phi
); i
++)
2186 if ((flags
& TDF_LINENO
) && gimple_phi_arg_has_location (phi
, i
))
2187 dump_location (buffer
, gimple_phi_arg_location (phi
, i
));
2188 if (flags
& TDF_GIMPLE
)
2190 basic_block src
= gimple_phi_arg_edge (phi
, i
)->src
;
2191 gimple
*stmt
= first_stmt (src
);
2192 if (!stmt
|| gimple_code (stmt
) != GIMPLE_LABEL
)
2194 pp_string (buffer
, "bb_");
2195 pp_decimal_int (buffer
, src
->index
);
2198 dump_generic_node (buffer
, gimple_label_label (as_a
<glabel
*> (stmt
)), 0, flags
,
2200 pp_string (buffer
, ": ");
2202 dump_generic_node (buffer
, gimple_phi_arg_def (phi
, i
), spc
, flags
,
2204 if (! (flags
& TDF_GIMPLE
))
2206 pp_left_paren (buffer
);
2207 pp_decimal_int (buffer
, gimple_phi_arg_edge (phi
, i
)->src
->index
);
2208 pp_right_paren (buffer
);
2210 if (i
< gimple_phi_num_args (phi
) - 1)
2211 pp_string (buffer
, ", ");
2213 if (flags
& TDF_GIMPLE
)
2214 pp_string (buffer
, ");");
2216 pp_greater (buffer
);
2220 /* Dump a GIMPLE_OMP_PARALLEL tuple on the pretty_printer BUFFER, SPC spaces
2221 of indent. FLAGS specifies details to show in the dump (see TDF_* in
2225 dump_gimple_omp_parallel (pretty_printer
*buffer
, gomp_parallel
*gs
,
2226 int spc
, dump_flags_t flags
)
2228 if (flags
& TDF_RAW
)
2230 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
2231 gimple_omp_body (gs
));
2232 dump_omp_clauses (buffer
, gimple_omp_parallel_clauses (gs
), spc
, flags
);
2233 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T%n>",
2234 gimple_omp_parallel_child_fn (gs
),
2235 gimple_omp_parallel_data_arg (gs
));
2240 pp_string (buffer
, "#pragma omp parallel");
2241 dump_omp_clauses (buffer
, gimple_omp_parallel_clauses (gs
), spc
, flags
);
2242 if (gimple_omp_parallel_child_fn (gs
))
2244 pp_string (buffer
, " [child fn: ");
2245 dump_generic_node (buffer
, gimple_omp_parallel_child_fn (gs
),
2247 pp_string (buffer
, " (");
2248 if (gimple_omp_parallel_data_arg (gs
))
2249 dump_generic_node (buffer
, gimple_omp_parallel_data_arg (gs
),
2252 pp_string (buffer
, "???");
2253 pp_string (buffer
, ")]");
2255 body
= gimple_omp_body (gs
);
2256 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
2258 newline_and_indent (buffer
, spc
+ 2);
2259 pp_left_brace (buffer
);
2260 pp_newline (buffer
);
2261 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
2262 newline_and_indent (buffer
, spc
+ 2);
2263 pp_right_brace (buffer
);
2267 pp_newline (buffer
);
2268 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
2274 /* Dump a GIMPLE_OMP_TASK tuple on the pretty_printer BUFFER, SPC spaces
2275 of indent. FLAGS specifies details to show in the dump (see TDF_* in
2279 dump_gimple_omp_task (pretty_printer
*buffer
, gomp_task
*gs
, int spc
,
2282 if (flags
& TDF_RAW
)
2284 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
2285 gimple_omp_body (gs
));
2286 dump_omp_clauses (buffer
, gimple_omp_task_clauses (gs
), spc
, flags
);
2287 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T, %T, %T, %T%n>",
2288 gimple_omp_task_child_fn (gs
),
2289 gimple_omp_task_data_arg (gs
),
2290 gimple_omp_task_copy_fn (gs
),
2291 gimple_omp_task_arg_size (gs
),
2292 gimple_omp_task_arg_size (gs
));
2297 if (gimple_omp_task_taskloop_p (gs
))
2298 pp_string (buffer
, "#pragma omp taskloop");
2300 pp_string (buffer
, "#pragma omp task");
2301 dump_omp_clauses (buffer
, gimple_omp_task_clauses (gs
), spc
, flags
);
2302 if (gimple_omp_task_child_fn (gs
))
2304 pp_string (buffer
, " [child fn: ");
2305 dump_generic_node (buffer
, gimple_omp_task_child_fn (gs
),
2307 pp_string (buffer
, " (");
2308 if (gimple_omp_task_data_arg (gs
))
2309 dump_generic_node (buffer
, gimple_omp_task_data_arg (gs
),
2312 pp_string (buffer
, "???");
2313 pp_string (buffer
, ")]");
2315 body
= gimple_omp_body (gs
);
2316 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
2318 newline_and_indent (buffer
, spc
+ 2);
2319 pp_left_brace (buffer
);
2320 pp_newline (buffer
);
2321 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
2322 newline_and_indent (buffer
, spc
+ 2);
2323 pp_right_brace (buffer
);
2327 pp_newline (buffer
);
2328 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
2334 /* Dump a GIMPLE_OMP_ATOMIC_LOAD tuple on the pretty_printer BUFFER, SPC
2335 spaces of indent. FLAGS specifies details to show in the dump (see TDF_*
2339 dump_gimple_omp_atomic_load (pretty_printer
*buffer
, gomp_atomic_load
*gs
,
2340 int spc
, dump_flags_t flags
)
2342 if (flags
& TDF_RAW
)
2344 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T>", gs
,
2345 gimple_omp_atomic_load_lhs (gs
),
2346 gimple_omp_atomic_load_rhs (gs
));
2350 pp_string (buffer
, "#pragma omp atomic_load");
2351 if (gimple_omp_atomic_seq_cst_p (gs
))
2352 pp_string (buffer
, " seq_cst");
2353 if (gimple_omp_atomic_need_value_p (gs
))
2354 pp_string (buffer
, " [needed]");
2355 newline_and_indent (buffer
, spc
+ 2);
2356 dump_generic_node (buffer
, gimple_omp_atomic_load_lhs (gs
),
2362 dump_generic_node (buffer
, gimple_omp_atomic_load_rhs (gs
),
2367 /* Dump a GIMPLE_OMP_ATOMIC_STORE tuple on the pretty_printer BUFFER, SPC
2368 spaces of indent. FLAGS specifies details to show in the dump (see TDF_*
2372 dump_gimple_omp_atomic_store (pretty_printer
*buffer
,
2373 gomp_atomic_store
*gs
, int spc
,
2376 if (flags
& TDF_RAW
)
2378 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
,
2379 gimple_omp_atomic_store_val (gs
));
2383 pp_string (buffer
, "#pragma omp atomic_store ");
2384 if (gimple_omp_atomic_seq_cst_p (gs
))
2385 pp_string (buffer
, "seq_cst ");
2386 if (gimple_omp_atomic_need_value_p (gs
))
2387 pp_string (buffer
, "[needed] ");
2388 pp_left_paren (buffer
);
2389 dump_generic_node (buffer
, gimple_omp_atomic_store_val (gs
),
2391 pp_right_paren (buffer
);
2396 /* Dump all the memory operands for statement GS. BUFFER, SPC and
2397 FLAGS are as in pp_gimple_stmt_1. */
2400 dump_gimple_mem_ops (pretty_printer
*buffer
, gimple
*gs
, int spc
,
2403 tree vdef
= gimple_vdef (gs
);
2404 tree vuse
= gimple_vuse (gs
);
2406 if (vdef
!= NULL_TREE
)
2408 pp_string (buffer
, "# ");
2409 dump_generic_node (buffer
, vdef
, spc
+ 2, flags
, false);
2410 pp_string (buffer
, " = VDEF <");
2411 dump_generic_node (buffer
, vuse
, spc
+ 2, flags
, false);
2412 pp_greater (buffer
);
2413 newline_and_indent (buffer
, spc
);
2415 else if (vuse
!= NULL_TREE
)
2417 pp_string (buffer
, "# VUSE <");
2418 dump_generic_node (buffer
, vuse
, spc
+ 2, flags
, false);
2419 pp_greater (buffer
);
2420 newline_and_indent (buffer
, spc
);
2425 /* Print the gimple statement GS on the pretty printer BUFFER, SPC
2426 spaces of indent. FLAGS specifies details to show in the dump (see
2427 TDF_* in dumpfile.h). The caller is responsible for calling
2428 pp_flush on BUFFER to finalize the pretty printer. */
2431 pp_gimple_stmt_1 (pretty_printer
*buffer
, gimple
*gs
, int spc
,
2437 if (flags
& TDF_STMTADDR
)
2438 pp_printf (buffer
, "<&%p> ", (void *) gs
);
2440 if ((flags
& TDF_LINENO
) && gimple_has_location (gs
))
2441 dump_location (buffer
, gimple_location (gs
));
2445 int lp_nr
= lookup_stmt_eh_lp (gs
);
2447 pp_printf (buffer
, "[LP %d] ", lp_nr
);
2449 pp_printf (buffer
, "[MNT %d] ", -lp_nr
);
2452 if ((flags
& (TDF_VOPS
|TDF_MEMSYMS
))
2453 && gimple_has_mem_ops (gs
))
2454 dump_gimple_mem_ops (buffer
, gs
, spc
, flags
);
2456 if (gimple_has_lhs (gs
)
2457 && (flags
& TDF_ALIAS
))
2458 dump_ssaname_info (buffer
, gimple_get_lhs (gs
), spc
);
2460 switch (gimple_code (gs
))
2463 dump_gimple_asm (buffer
, as_a
<gasm
*> (gs
), spc
, flags
);
2467 dump_gimple_assign (buffer
, as_a
<gassign
*> (gs
), spc
, flags
);
2471 dump_gimple_bind (buffer
, as_a
<gbind
*> (gs
), spc
, flags
);
2475 dump_gimple_call (buffer
, as_a
<gcall
*> (gs
), spc
, flags
);
2479 dump_gimple_cond (buffer
, as_a
<gcond
*> (gs
), spc
, flags
);
2483 dump_gimple_label (buffer
, as_a
<glabel
*> (gs
), spc
, flags
);
2487 dump_gimple_goto (buffer
, as_a
<ggoto
*> (gs
), spc
, flags
);
2491 pp_string (buffer
, "GIMPLE_NOP");
2495 dump_gimple_return (buffer
, as_a
<greturn
*> (gs
), spc
, flags
);
2499 dump_gimple_switch (buffer
, as_a
<gswitch
*> (gs
), spc
, flags
);
2503 dump_gimple_try (buffer
, as_a
<gtry
*> (gs
), spc
, flags
);
2507 dump_gimple_phi (buffer
, as_a
<gphi
*> (gs
), spc
, false, flags
);
2510 case GIMPLE_OMP_PARALLEL
:
2511 dump_gimple_omp_parallel (buffer
, as_a
<gomp_parallel
*> (gs
), spc
,
2515 case GIMPLE_OMP_TASK
:
2516 dump_gimple_omp_task (buffer
, as_a
<gomp_task
*> (gs
), spc
, flags
);
2519 case GIMPLE_OMP_ATOMIC_LOAD
:
2520 dump_gimple_omp_atomic_load (buffer
, as_a
<gomp_atomic_load
*> (gs
),
2524 case GIMPLE_OMP_ATOMIC_STORE
:
2525 dump_gimple_omp_atomic_store (buffer
,
2526 as_a
<gomp_atomic_store
*> (gs
),
2530 case GIMPLE_OMP_FOR
:
2531 dump_gimple_omp_for (buffer
, as_a
<gomp_for
*> (gs
), spc
, flags
);
2534 case GIMPLE_OMP_CONTINUE
:
2535 dump_gimple_omp_continue (buffer
, as_a
<gomp_continue
*> (gs
), spc
,
2539 case GIMPLE_OMP_SINGLE
:
2540 dump_gimple_omp_single (buffer
, as_a
<gomp_single
*> (gs
), spc
,
2544 case GIMPLE_OMP_TARGET
:
2545 dump_gimple_omp_target (buffer
, as_a
<gomp_target
*> (gs
), spc
,
2549 case GIMPLE_OMP_TEAMS
:
2550 dump_gimple_omp_teams (buffer
, as_a
<gomp_teams
*> (gs
), spc
,
2554 case GIMPLE_OMP_RETURN
:
2555 dump_gimple_omp_return (buffer
, gs
, spc
, flags
);
2558 case GIMPLE_OMP_SECTIONS
:
2559 dump_gimple_omp_sections (buffer
, as_a
<gomp_sections
*> (gs
),
2563 case GIMPLE_OMP_SECTIONS_SWITCH
:
2564 pp_string (buffer
, "GIMPLE_SECTIONS_SWITCH");
2567 case GIMPLE_OMP_MASTER
:
2568 case GIMPLE_OMP_TASKGROUP
:
2569 case GIMPLE_OMP_SECTION
:
2570 case GIMPLE_OMP_GRID_BODY
:
2571 dump_gimple_omp_block (buffer
, gs
, spc
, flags
);
2574 case GIMPLE_OMP_ORDERED
:
2575 dump_gimple_omp_ordered (buffer
, as_a
<gomp_ordered
*> (gs
), spc
,
2579 case GIMPLE_OMP_CRITICAL
:
2580 dump_gimple_omp_critical (buffer
, as_a
<gomp_critical
*> (gs
), spc
,
2585 dump_gimple_catch (buffer
, as_a
<gcatch
*> (gs
), spc
, flags
);
2588 case GIMPLE_EH_FILTER
:
2589 dump_gimple_eh_filter (buffer
, as_a
<geh_filter
*> (gs
), spc
, flags
);
2592 case GIMPLE_EH_MUST_NOT_THROW
:
2593 dump_gimple_eh_must_not_throw (buffer
,
2594 as_a
<geh_mnt
*> (gs
),
2598 case GIMPLE_EH_ELSE
:
2599 dump_gimple_eh_else (buffer
, as_a
<geh_else
*> (gs
), spc
, flags
);
2603 dump_gimple_resx (buffer
, as_a
<gresx
*> (gs
), spc
, flags
);
2606 case GIMPLE_EH_DISPATCH
:
2607 dump_gimple_eh_dispatch (buffer
, as_a
<geh_dispatch
*> (gs
), spc
,
2612 dump_gimple_debug (buffer
, as_a
<gdebug
*> (gs
), spc
, flags
);
2615 case GIMPLE_PREDICT
:
2616 pp_string (buffer
, "// predicted ");
2617 if (gimple_predict_outcome (gs
))
2618 pp_string (buffer
, "likely by ");
2620 pp_string (buffer
, "unlikely by ");
2621 pp_string (buffer
, predictor_name (gimple_predict_predictor (gs
)));
2622 pp_string (buffer
, " predictor.");
2625 case GIMPLE_TRANSACTION
:
2626 dump_gimple_transaction (buffer
, as_a
<gtransaction
*> (gs
), spc
,
2636 /* Dumps header of basic block BB to OUTF indented by INDENT
2637 spaces and details described by flags. */
2640 dump_gimple_bb_header (FILE *outf
, basic_block bb
, int indent
,
2643 if (flags
& TDF_BLOCKS
)
2645 if (flags
& TDF_LINENO
)
2647 gimple_stmt_iterator gsi
;
2649 fputs (";; ", outf
);
2651 for (gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
); gsi_next (&gsi
))
2652 if (!is_gimple_debug (gsi_stmt (gsi
))
2653 && get_lineno (gsi_stmt (gsi
)) != UNKNOWN_LOCATION
)
2655 fprintf (outf
, "%*sstarting at line %d",
2656 indent
, "", get_lineno (gsi_stmt (gsi
)));
2659 if (bb
->discriminator
)
2660 fprintf (outf
, ", discriminator %i", bb
->discriminator
);
2666 gimple
*stmt
= first_stmt (bb
);
2667 if (!stmt
|| gimple_code (stmt
) != GIMPLE_LABEL
)
2669 if (flags
& TDF_GIMPLE
)
2670 fprintf (outf
, "%*sbb_%d:\n", indent
, "", bb
->index
);
2672 fprintf (outf
, "%*s<bb %d> %s:\n",
2673 indent
, "", bb
->index
, dump_probability (bb
->frequency
,
2680 /* Dumps end of basic block BB to buffer BUFFER indented by INDENT
2684 dump_gimple_bb_footer (FILE *outf ATTRIBUTE_UNUSED
,
2685 basic_block bb ATTRIBUTE_UNUSED
,
2686 int indent ATTRIBUTE_UNUSED
,
2687 dump_flags_t flags ATTRIBUTE_UNUSED
)
2689 /* There is currently no GIMPLE-specific basic block info to dump. */
2694 /* Dump PHI nodes of basic block BB to BUFFER with details described
2695 by FLAGS and indented by INDENT spaces. */
2698 dump_phi_nodes (pretty_printer
*buffer
, basic_block bb
, int indent
,
2703 for (i
= gsi_start_phis (bb
); !gsi_end_p (i
); gsi_next (&i
))
2705 gphi
*phi
= i
.phi ();
2706 if (!virtual_operand_p (gimple_phi_result (phi
)) || (flags
& TDF_VOPS
))
2709 dump_gimple_phi (buffer
, phi
, indent
,
2710 (flags
& TDF_GIMPLE
) ? false : true, flags
);
2711 pp_newline (buffer
);
2717 /* Dump jump to basic block BB that is represented implicitly in the cfg
2721 pp_cfg_jump (pretty_printer
*buffer
, edge e
, dump_flags_t flags
)
2723 if (flags
& TDF_GIMPLE
)
2725 pp_string (buffer
, "goto bb_");
2726 pp_decimal_int (buffer
, e
->dest
->index
);
2727 pp_semicolon (buffer
);
2731 gimple
*stmt
= first_stmt (e
->dest
);
2733 pp_string (buffer
, "goto <bb ");
2734 pp_decimal_int (buffer
, e
->dest
->index
);
2735 pp_greater (buffer
);
2736 if (stmt
&& gimple_code (stmt
) == GIMPLE_LABEL
)
2738 pp_string (buffer
, " (");
2739 dump_generic_node (buffer
,
2740 gimple_label_label (as_a
<glabel
*> (stmt
)),
2742 pp_right_paren (buffer
);
2743 pp_semicolon (buffer
);
2746 pp_semicolon (buffer
);
2748 dump_edge_probability (buffer
, e
);
2753 /* Dump edges represented implicitly in basic block BB to BUFFER, indented
2754 by INDENT spaces, with details given by FLAGS. */
2757 dump_implicit_edges (pretty_printer
*buffer
, basic_block bb
, int indent
,
2763 stmt
= last_stmt (bb
);
2765 if (stmt
&& gimple_code (stmt
) == GIMPLE_COND
)
2767 edge true_edge
, false_edge
;
2769 /* When we are emitting the code or changing CFG, it is possible that
2770 the edges are not yet created. When we are using debug_bb in such
2771 a situation, we do not want it to crash. */
2772 if (EDGE_COUNT (bb
->succs
) != 2)
2774 extract_true_false_edges_from_block (bb
, &true_edge
, &false_edge
);
2776 INDENT (indent
+ 2);
2777 pp_cfg_jump (buffer
, true_edge
, flags
);
2778 newline_and_indent (buffer
, indent
);
2779 pp_string (buffer
, "else");
2780 newline_and_indent (buffer
, indent
+ 2);
2781 pp_cfg_jump (buffer
, false_edge
, flags
);
2782 pp_newline (buffer
);
2786 /* If there is a fallthru edge, we may need to add an artificial
2787 goto to the dump. */
2788 e
= find_fallthru_edge (bb
->succs
);
2790 if (e
&& e
->dest
!= bb
->next_bb
)
2794 if ((flags
& TDF_LINENO
)
2795 && e
->goto_locus
!= UNKNOWN_LOCATION
)
2796 dump_location (buffer
, e
->goto_locus
);
2798 pp_cfg_jump (buffer
, e
, flags
);
2799 pp_newline (buffer
);
2804 /* Dumps basic block BB to buffer BUFFER with details described by FLAGS and
2805 indented by INDENT spaces. */
2808 gimple_dump_bb_buff (pretty_printer
*buffer
, basic_block bb
, int indent
,
2811 gimple_stmt_iterator gsi
;
2813 int label_indent
= indent
- 2;
2815 if (label_indent
< 0)
2818 dump_phi_nodes (buffer
, bb
, indent
, flags
);
2820 for (gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
); gsi_next (&gsi
))
2824 stmt
= gsi_stmt (gsi
);
2826 curr_indent
= gimple_code (stmt
) == GIMPLE_LABEL
? label_indent
: indent
;
2828 INDENT (curr_indent
);
2829 pp_gimple_stmt_1 (buffer
, stmt
, curr_indent
, flags
);
2830 pp_newline_and_flush (buffer
);
2831 gcc_checking_assert (DECL_STRUCT_FUNCTION (current_function_decl
));
2832 dump_histograms_for_stmt (DECL_STRUCT_FUNCTION (current_function_decl
),
2833 pp_buffer (buffer
)->stream
, stmt
);
2836 dump_implicit_edges (buffer
, bb
, indent
, flags
);
2841 /* Dumps basic block BB to FILE with details described by FLAGS and
2842 indented by INDENT spaces. */
2845 gimple_dump_bb (FILE *file
, basic_block bb
, int indent
, dump_flags_t flags
)
2847 dump_gimple_bb_header (file
, bb
, indent
, flags
);
2848 if (bb
->index
>= NUM_FIXED_BLOCKS
)
2850 pretty_printer buffer
;
2851 pp_needs_newline (&buffer
) = true;
2852 buffer
.buffer
->stream
= file
;
2853 gimple_dump_bb_buff (&buffer
, bb
, indent
, flags
);
2855 dump_gimple_bb_footer (file
, bb
, indent
, flags
);
2858 /* Dumps basic block BB to pretty-printer PP with default dump flags and
2859 no indentation, for use as a label of a DOT graph record-node.
2860 ??? Should just use gimple_dump_bb_buff here, except that value profiling
2861 histogram dumping doesn't know about pretty-printers. */
2864 gimple_dump_bb_for_graph (pretty_printer
*pp
, basic_block bb
)
2866 pp_printf (pp
, "<bb %d>:\n", bb
->index
);
2867 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
2869 for (gphi_iterator gsi
= gsi_start_phis (bb
); !gsi_end_p (gsi
);
2872 gphi
*phi
= gsi
.phi ();
2873 if (!virtual_operand_p (gimple_phi_result (phi
))
2874 || (dump_flags
& TDF_VOPS
))
2877 pp_write_text_to_stream (pp
);
2878 pp_string (pp
, "# ");
2879 pp_gimple_stmt_1 (pp
, phi
, 0, dump_flags
);
2881 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
2885 for (gimple_stmt_iterator gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
);
2888 gimple
*stmt
= gsi_stmt (gsi
);
2890 pp_write_text_to_stream (pp
);
2891 pp_gimple_stmt_1 (pp
, stmt
, 0, dump_flags
);
2893 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
2895 dump_implicit_edges (pp
, bb
, 0, dump_flags
);
2896 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);