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_profile (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 buf
= xasprintf ("[%.2f%%] [count: %" PRId64
"]", fvalue
,
95 count
.to_gcov_type ());
97 buf
= xasprintf ("[%.2f%%] [count: INV]", fvalue
);
99 const char *ret
= xstrdup_for_dump (buf
);
105 /* Return formatted string of a VALUE probability
106 (biased by REG_BR_PROB_BASE). Returned string is allocated
107 by xstrdup_for_dump. */
110 dump_probability (profile_probability probability
, profile_count
&count
)
112 float minimum
= 0.01f
;
115 if (probability
.initialized_p ())
117 fvalue
= probability
.to_reg_br_prob_base () * 100.0f
/ REG_BR_PROB_BASE
;
118 if (fvalue
< minimum
&& probability
.to_reg_br_prob_base ())
123 if (count
.initialized_p ())
124 buf
= xasprintf ("[%.2f%%] [count: %" PRId64
"]", fvalue
,
125 count
.to_gcov_type ());
126 else if (probability
.initialized_p ())
127 buf
= xasprintf ("[%.2f%%] [count: INV]", fvalue
);
129 buf
= xasprintf ("[INV] [count: INV]");
131 const char *ret
= xstrdup_for_dump (buf
);
137 /* Dump E probability to BUFFER. */
140 dump_edge_probability (pretty_printer
*buffer
, edge e
)
142 pp_scalar (buffer
, " %s", dump_probability (e
->probability
, e
->count
));
145 /* Print GIMPLE statement G to FILE using SPC indentation spaces and
146 FLAGS as in pp_gimple_stmt_1. */
149 print_gimple_stmt (FILE *file
, gimple
*g
, int spc
, dump_flags_t flags
)
151 pretty_printer buffer
;
152 pp_needs_newline (&buffer
) = true;
153 buffer
.buffer
->stream
= file
;
154 pp_gimple_stmt_1 (&buffer
, g
, spc
, flags
);
155 pp_newline_and_flush (&buffer
);
161 print_gimple_stmt (stderr
, &ref
, 0, 0);
170 fprintf (stderr
, "<nil>\n");
174 /* Print GIMPLE statement G to FILE using SPC indentation spaces and
175 FLAGS as in pp_gimple_stmt_1. Print only the right-hand side
179 print_gimple_expr (FILE *file
, gimple
*g
, int spc
, dump_flags_t flags
)
181 flags
|= TDF_RHS_ONLY
;
182 pretty_printer buffer
;
183 pp_needs_newline (&buffer
) = true;
184 buffer
.buffer
->stream
= file
;
185 pp_gimple_stmt_1 (&buffer
, g
, spc
, flags
);
190 /* Print the GIMPLE sequence SEQ on BUFFER using SPC indentation
191 spaces and FLAGS as in pp_gimple_stmt_1.
192 The caller is responsible for calling pp_flush on BUFFER to finalize
193 the pretty printer. */
196 dump_gimple_seq (pretty_printer
*buffer
, gimple_seq seq
, int spc
,
199 gimple_stmt_iterator i
;
201 for (i
= gsi_start (seq
); !gsi_end_p (i
); gsi_next (&i
))
203 gimple
*gs
= gsi_stmt (i
);
205 pp_gimple_stmt_1 (buffer
, gs
, spc
, flags
);
206 if (!gsi_one_before_end_p (i
))
212 /* Print GIMPLE sequence SEQ to FILE using SPC indentation spaces and
213 FLAGS as in pp_gimple_stmt_1. */
216 print_gimple_seq (FILE *file
, gimple_seq seq
, int spc
, dump_flags_t flags
)
218 pretty_printer buffer
;
219 pp_needs_newline (&buffer
) = true;
220 buffer
.buffer
->stream
= file
;
221 dump_gimple_seq (&buffer
, seq
, spc
, flags
);
222 pp_newline_and_flush (&buffer
);
226 /* Print the GIMPLE sequence SEQ on stderr. */
229 debug_gimple_seq (gimple_seq seq
)
231 print_gimple_seq (stderr
, seq
, 0, TDF_VOPS
|TDF_MEMSYMS
);
235 /* A simple helper to pretty-print some of the gimple tuples in the printf
236 style. The format modifiers are preceded by '%' and are:
237 'G' - outputs a string corresponding to the code of the given gimple,
238 'S' - outputs a gimple_seq with indent of spc + 2,
239 'T' - outputs the tree t,
240 'd' - outputs an int as a decimal,
241 's' - outputs a string,
242 'n' - outputs a newline,
243 'x' - outputs an int as hexadecimal,
244 '+' - increases indent by 2 then outputs a newline,
245 '-' - decreases indent by 2 then outputs a newline. */
248 dump_gimple_fmt (pretty_printer
*buffer
, int spc
, dump_flags_t flags
,
249 const char *fmt
, ...)
255 va_start (args
, fmt
);
256 for (c
= fmt
; *c
; c
++)
266 g
= va_arg (args
, gimple
*);
267 tmp
= gimple_code_name
[gimple_code (g
)];
268 pp_string (buffer
, tmp
);
272 seq
= va_arg (args
, gimple_seq
);
274 dump_gimple_seq (buffer
, seq
, spc
+ 2, flags
);
275 newline_and_indent (buffer
, spc
);
279 t
= va_arg (args
, tree
);
281 pp_string (buffer
, "NULL");
283 dump_generic_node (buffer
, t
, spc
, flags
, false);
287 pp_decimal_int (buffer
, va_arg (args
, int));
291 pp_string (buffer
, va_arg (args
, char *));
295 newline_and_indent (buffer
, spc
);
299 pp_scalar (buffer
, "%x", va_arg (args
, int));
304 newline_and_indent (buffer
, spc
);
309 newline_and_indent (buffer
, spc
);
317 pp_character (buffer
, *c
);
323 /* Helper for dump_gimple_assign. Print the unary RHS of the
324 assignment GS. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. */
327 dump_unary_rhs (pretty_printer
*buffer
, gassign
*gs
, int spc
,
330 enum tree_code rhs_code
= gimple_assign_rhs_code (gs
);
331 tree lhs
= gimple_assign_lhs (gs
);
332 tree rhs
= gimple_assign_rhs1 (gs
);
336 case VIEW_CONVERT_EXPR
:
338 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
341 case FIXED_CONVERT_EXPR
:
342 case ADDR_SPACE_CONVERT_EXPR
:
346 pp_left_paren (buffer
);
347 dump_generic_node (buffer
, TREE_TYPE (lhs
), spc
, flags
, false);
348 pp_string (buffer
, ") ");
349 if (op_prio (rhs
) < op_code_prio (rhs_code
))
351 pp_left_paren (buffer
);
352 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
353 pp_right_paren (buffer
);
356 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
360 pp_string (buffer
, "((");
361 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
362 pp_string (buffer
, "))");
366 if (flags
& TDF_GIMPLE
)
368 pp_string (buffer
, "__ABS ");
369 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
373 pp_string (buffer
, "ABS_EXPR <");
374 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
380 if (TREE_CODE_CLASS (rhs_code
) == tcc_declaration
381 || TREE_CODE_CLASS (rhs_code
) == tcc_constant
382 || TREE_CODE_CLASS (rhs_code
) == tcc_reference
383 || rhs_code
== SSA_NAME
384 || rhs_code
== ADDR_EXPR
385 || rhs_code
== CONSTRUCTOR
)
387 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
390 else if (rhs_code
== BIT_NOT_EXPR
)
391 pp_complement (buffer
);
392 else if (rhs_code
== TRUTH_NOT_EXPR
)
393 pp_exclamation (buffer
);
394 else if (rhs_code
== NEGATE_EXPR
)
398 pp_left_bracket (buffer
);
399 pp_string (buffer
, get_tree_code_name (rhs_code
));
400 pp_string (buffer
, "] ");
403 if (op_prio (rhs
) < op_code_prio (rhs_code
))
405 pp_left_paren (buffer
);
406 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
407 pp_right_paren (buffer
);
410 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
416 /* Helper for dump_gimple_assign. Print the binary RHS of the
417 assignment GS. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. */
420 dump_binary_rhs (pretty_printer
*buffer
, gassign
*gs
, int spc
,
424 enum tree_code code
= gimple_assign_rhs_code (gs
);
430 case VEC_WIDEN_MULT_HI_EXPR
:
431 case VEC_WIDEN_MULT_LO_EXPR
:
432 case VEC_WIDEN_MULT_EVEN_EXPR
:
433 case VEC_WIDEN_MULT_ODD_EXPR
:
434 case VEC_PACK_TRUNC_EXPR
:
435 case VEC_PACK_SAT_EXPR
:
436 case VEC_PACK_FIX_TRUNC_EXPR
:
437 case VEC_WIDEN_LSHIFT_HI_EXPR
:
438 case VEC_WIDEN_LSHIFT_LO_EXPR
:
439 for (p
= get_tree_code_name (code
); *p
; p
++)
440 pp_character (buffer
, TOUPPER (*p
));
441 pp_string (buffer
, " <");
442 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
443 pp_string (buffer
, ", ");
444 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
449 if (op_prio (gimple_assign_rhs1 (gs
)) <= op_code_prio (code
))
451 pp_left_paren (buffer
);
452 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
,
454 pp_right_paren (buffer
);
457 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
459 pp_string (buffer
, op_symbol_code (gimple_assign_rhs_code (gs
)));
461 if (op_prio (gimple_assign_rhs2 (gs
)) <= op_code_prio (code
))
463 pp_left_paren (buffer
);
464 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
,
466 pp_right_paren (buffer
);
469 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
473 /* Helper for dump_gimple_assign. Print the ternary RHS of the
474 assignment GS. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. */
477 dump_ternary_rhs (pretty_printer
*buffer
, gassign
*gs
, int spc
,
481 enum tree_code code
= gimple_assign_rhs_code (gs
);
484 case WIDEN_MULT_PLUS_EXPR
:
485 case WIDEN_MULT_MINUS_EXPR
:
486 for (p
= get_tree_code_name (code
); *p
; p
++)
487 pp_character (buffer
, TOUPPER (*p
));
488 pp_string (buffer
, " <");
489 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
490 pp_string (buffer
, ", ");
491 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
492 pp_string (buffer
, ", ");
493 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
498 if (flags
& TDF_GIMPLE
)
500 pp_string (buffer
, "__FMA (");
501 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
503 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
505 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
506 pp_right_paren (buffer
);
510 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
511 pp_string (buffer
, " * ");
512 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
513 pp_string (buffer
, " + ");
514 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
519 pp_string (buffer
, "DOT_PROD_EXPR <");
520 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
521 pp_string (buffer
, ", ");
522 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
523 pp_string (buffer
, ", ");
524 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
529 pp_string (buffer
, "SAD_EXPR <");
530 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
531 pp_string (buffer
, ", ");
532 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
533 pp_string (buffer
, ", ");
534 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
539 pp_string (buffer
, "VEC_PERM_EXPR <");
540 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
541 pp_string (buffer
, ", ");
542 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
543 pp_string (buffer
, ", ");
544 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
548 case REALIGN_LOAD_EXPR
:
549 pp_string (buffer
, "REALIGN_LOAD <");
550 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
551 pp_string (buffer
, ", ");
552 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
553 pp_string (buffer
, ", ");
554 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
559 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
560 pp_string (buffer
, " ? ");
561 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
562 pp_string (buffer
, " : ");
563 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
567 pp_string (buffer
, "VEC_COND_EXPR <");
568 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
569 pp_string (buffer
, ", ");
570 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
571 pp_string (buffer
, ", ");
572 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
576 case BIT_INSERT_EXPR
:
577 pp_string (buffer
, "BIT_INSERT_EXPR <");
578 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
579 pp_string (buffer
, ", ");
580 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
581 pp_string (buffer
, ", ");
582 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
583 pp_string (buffer
, " (");
584 if (INTEGRAL_TYPE_P (TREE_TYPE (gimple_assign_rhs2 (gs
))))
585 pp_decimal_int (buffer
,
586 TYPE_PRECISION (TREE_TYPE (gimple_assign_rhs2 (gs
))));
588 dump_generic_node (buffer
,
589 TYPE_SIZE (TREE_TYPE (gimple_assign_rhs2 (gs
))),
591 pp_string (buffer
, " bits)>");
600 /* Dump the gimple assignment GS. BUFFER, SPC and FLAGS are as in
604 dump_gimple_assign (pretty_printer
*buffer
, gassign
*gs
, int spc
,
612 switch (gimple_num_ops (gs
))
615 arg3
= gimple_assign_rhs3 (gs
);
618 arg2
= gimple_assign_rhs2 (gs
);
621 arg1
= gimple_assign_rhs1 (gs
);
627 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%s, %T, %T, %T, %T>", gs
,
628 get_tree_code_name (gimple_assign_rhs_code (gs
)),
629 gimple_assign_lhs (gs
), arg1
, arg2
, arg3
);
633 if (!(flags
& TDF_RHS_ONLY
))
635 dump_generic_node (buffer
, gimple_assign_lhs (gs
), spc
, flags
, false);
639 if (gimple_assign_nontemporal_move_p (gs
))
640 pp_string (buffer
, "{nt}");
642 if (gimple_has_volatile_ops (gs
))
643 pp_string (buffer
, "{v}");
648 if (gimple_num_ops (gs
) == 2)
649 dump_unary_rhs (buffer
, gs
, spc
, flags
);
650 else if (gimple_num_ops (gs
) == 3)
651 dump_binary_rhs (buffer
, gs
, spc
, flags
);
652 else if (gimple_num_ops (gs
) == 4)
653 dump_ternary_rhs (buffer
, gs
, spc
, flags
);
656 if (!(flags
& TDF_RHS_ONLY
))
657 pp_semicolon (buffer
);
662 /* Dump the return statement GS. BUFFER, SPC and FLAGS are as in
666 dump_gimple_return (pretty_printer
*buffer
, greturn
*gs
, int spc
,
671 t
= gimple_return_retval (gs
);
672 t2
= gimple_return_retbnd (gs
);
674 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T %T>", gs
, t
, t2
);
677 pp_string (buffer
, "return");
681 dump_generic_node (buffer
, t
, spc
, flags
, false);
685 pp_string (buffer
, ", ");
686 dump_generic_node (buffer
, t2
, spc
, flags
, false);
688 pp_semicolon (buffer
);
693 /* Dump the call arguments for a gimple call. BUFFER, FLAGS are as in
697 dump_gimple_call_args (pretty_printer
*buffer
, gcall
*gs
, dump_flags_t flags
)
701 /* Pretty print first arg to certain internal fns. */
702 if (gimple_call_internal_p (gs
))
704 const char *const *enums
= NULL
;
707 switch (gimple_call_internal_fn (gs
))
711 static const char *const unique_args
[] = {IFN_UNIQUE_CODES
};
715 limit
= ARRAY_SIZE (unique_args
);
720 static const char *const loop_args
[] = {IFN_GOACC_LOOP_CODES
};
723 limit
= ARRAY_SIZE (loop_args
);
726 case IFN_GOACC_REDUCTION
:
728 static const char *const reduction_args
[]
729 = {IFN_GOACC_REDUCTION_CODES
};
731 enums
= reduction_args
;
732 limit
= ARRAY_SIZE (reduction_args
);
737 static const char *const asan_mark_args
[] = {IFN_ASAN_MARK_FLAGS
};
739 enums
= asan_mark_args
;
740 limit
= ARRAY_SIZE (asan_mark_args
);
748 tree arg0
= gimple_call_arg (gs
, 0);
751 if (TREE_CODE (arg0
) == INTEGER_CST
752 && tree_fits_shwi_p (arg0
)
753 && (v
= tree_to_shwi (arg0
)) >= 0 && v
< limit
)
756 pp_string (buffer
, enums
[v
]);
761 for (; i
< gimple_call_num_args (gs
); i
++)
764 pp_string (buffer
, ", ");
765 dump_generic_node (buffer
, gimple_call_arg (gs
, i
), 0, flags
, false);
768 if (gimple_call_va_arg_pack_p (gs
))
771 pp_string (buffer
, ", ");
773 pp_string (buffer
, "__builtin_va_arg_pack ()");
777 /* Dump the points-to solution *PT to BUFFER. */
780 pp_points_to_solution (pretty_printer
*buffer
, struct pt_solution
*pt
)
784 pp_string (buffer
, "anything ");
788 pp_string (buffer
, "nonlocal ");
790 pp_string (buffer
, "escaped ");
792 pp_string (buffer
, "unit-escaped ");
794 pp_string (buffer
, "null ");
796 && !bitmap_empty_p (pt
->vars
))
800 pp_string (buffer
, "{ ");
801 EXECUTE_IF_SET_IN_BITMAP (pt
->vars
, 0, i
, bi
)
803 pp_string (buffer
, "D.");
804 pp_decimal_int (buffer
, i
);
807 pp_right_brace (buffer
);
808 if (pt
->vars_contains_nonlocal
809 || pt
->vars_contains_escaped
810 || pt
->vars_contains_escaped_heap
811 || pt
->vars_contains_restrict
)
813 const char *comma
= "";
814 pp_string (buffer
, " (");
815 if (pt
->vars_contains_nonlocal
)
817 pp_string (buffer
, "nonlocal");
820 if (pt
->vars_contains_escaped
)
822 pp_string (buffer
, comma
);
823 pp_string (buffer
, "escaped");
826 if (pt
->vars_contains_escaped_heap
)
828 pp_string (buffer
, comma
);
829 pp_string (buffer
, "escaped heap");
832 if (pt
->vars_contains_restrict
)
834 pp_string (buffer
, comma
);
835 pp_string (buffer
, "restrict");
838 if (pt
->vars_contains_interposable
)
840 pp_string (buffer
, comma
);
841 pp_string (buffer
, "interposable");
843 pp_string (buffer
, ")");
849 /* Dump the call statement GS. BUFFER, SPC and FLAGS are as in
853 dump_gimple_call (pretty_printer
*buffer
, gcall
*gs
, int spc
,
856 tree lhs
= gimple_call_lhs (gs
);
857 tree fn
= gimple_call_fn (gs
);
859 if (flags
& TDF_ALIAS
)
861 struct pt_solution
*pt
;
862 pt
= gimple_call_use_set (gs
);
863 if (!pt_solution_empty_p (pt
))
865 pp_string (buffer
, "# USE = ");
866 pp_points_to_solution (buffer
, pt
);
867 newline_and_indent (buffer
, spc
);
869 pt
= gimple_call_clobber_set (gs
);
870 if (!pt_solution_empty_p (pt
))
872 pp_string (buffer
, "# CLB = ");
873 pp_points_to_solution (buffer
, pt
);
874 newline_and_indent (buffer
, spc
);
880 if (gimple_call_internal_p (gs
))
881 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%s, %T", gs
,
882 internal_fn_name (gimple_call_internal_fn (gs
)), lhs
);
884 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T", gs
, fn
, lhs
);
885 if (gimple_call_num_args (gs
) > 0)
887 pp_string (buffer
, ", ");
888 dump_gimple_call_args (buffer
, gs
, flags
);
894 if (lhs
&& !(flags
& TDF_RHS_ONLY
))
896 dump_generic_node (buffer
, lhs
, spc
, flags
, false);
897 pp_string (buffer
, " =");
899 if (gimple_has_volatile_ops (gs
))
900 pp_string (buffer
, "{v}");
904 if (gimple_call_internal_p (gs
))
905 pp_string (buffer
, internal_fn_name (gimple_call_internal_fn (gs
)));
907 print_call_name (buffer
, fn
, flags
);
908 pp_string (buffer
, " (");
909 dump_gimple_call_args (buffer
, gs
, flags
);
910 pp_right_paren (buffer
);
911 if (!(flags
& TDF_RHS_ONLY
))
912 pp_semicolon (buffer
);
915 if (gimple_call_chain (gs
))
917 pp_string (buffer
, " [static-chain: ");
918 dump_generic_node (buffer
, gimple_call_chain (gs
), spc
, flags
, false);
919 pp_right_bracket (buffer
);
922 if (gimple_call_return_slot_opt_p (gs
))
923 pp_string (buffer
, " [return slot optimization]");
924 if (gimple_call_tail_p (gs
))
925 pp_string (buffer
, " [tail call]");
926 if (gimple_call_must_tail_p (gs
))
927 pp_string (buffer
, " [must tail call]");
932 /* Dump the arguments of _ITM_beginTransaction sanely. */
933 if (TREE_CODE (fn
) == ADDR_EXPR
)
934 fn
= TREE_OPERAND (fn
, 0);
935 if (TREE_CODE (fn
) == FUNCTION_DECL
&& decl_is_tm_clone (fn
))
936 pp_string (buffer
, " [tm-clone]");
937 if (TREE_CODE (fn
) == FUNCTION_DECL
938 && DECL_BUILT_IN_CLASS (fn
) == BUILT_IN_NORMAL
939 && DECL_FUNCTION_CODE (fn
) == BUILT_IN_TM_START
940 && gimple_call_num_args (gs
) > 0)
942 tree t
= gimple_call_arg (gs
, 0);
943 unsigned HOST_WIDE_INT props
;
944 gcc_assert (TREE_CODE (t
) == INTEGER_CST
);
946 pp_string (buffer
, " [ ");
948 /* Get the transaction code properties. */
949 props
= TREE_INT_CST_LOW (t
);
951 if (props
& PR_INSTRUMENTEDCODE
)
952 pp_string (buffer
, "instrumentedCode ");
953 if (props
& PR_UNINSTRUMENTEDCODE
)
954 pp_string (buffer
, "uninstrumentedCode ");
955 if (props
& PR_HASNOXMMUPDATE
)
956 pp_string (buffer
, "hasNoXMMUpdate ");
957 if (props
& PR_HASNOABORT
)
958 pp_string (buffer
, "hasNoAbort ");
959 if (props
& PR_HASNOIRREVOCABLE
)
960 pp_string (buffer
, "hasNoIrrevocable ");
961 if (props
& PR_DOESGOIRREVOCABLE
)
962 pp_string (buffer
, "doesGoIrrevocable ");
963 if (props
& PR_HASNOSIMPLEREADS
)
964 pp_string (buffer
, "hasNoSimpleReads ");
965 if (props
& PR_AWBARRIERSOMITTED
)
966 pp_string (buffer
, "awBarriersOmitted ");
967 if (props
& PR_RARBARRIERSOMITTED
)
968 pp_string (buffer
, "RaRBarriersOmitted ");
969 if (props
& PR_UNDOLOGCODE
)
970 pp_string (buffer
, "undoLogCode ");
971 if (props
& PR_PREFERUNINSTRUMENTED
)
972 pp_string (buffer
, "preferUninstrumented ");
973 if (props
& PR_EXCEPTIONBLOCK
)
974 pp_string (buffer
, "exceptionBlock ");
975 if (props
& PR_HASELSE
)
976 pp_string (buffer
, "hasElse ");
977 if (props
& PR_READONLY
)
978 pp_string (buffer
, "readOnly ");
980 pp_right_bracket (buffer
);
985 /* Dump the switch statement GS. BUFFER, SPC and FLAGS are as in
989 dump_gimple_switch (pretty_printer
*buffer
, gswitch
*gs
, int spc
,
994 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
996 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, ", gs
,
997 gimple_switch_index (gs
));
1000 pp_string (buffer
, "switch (");
1001 dump_generic_node (buffer
, gimple_switch_index (gs
), spc
, flags
, true);
1002 if (flags
& TDF_GIMPLE
)
1003 pp_string (buffer
, ") {");
1005 pp_string (buffer
, ") <");
1008 for (i
= 0; i
< gimple_switch_num_labels (gs
); i
++)
1010 tree case_label
= gimple_switch_label (gs
, i
);
1011 gcc_checking_assert (case_label
!= NULL_TREE
);
1012 dump_generic_node (buffer
, case_label
, spc
, flags
, false);
1014 tree label
= CASE_LABEL (case_label
);
1015 dump_generic_node (buffer
, label
, spc
, flags
, false);
1017 if (cfun
&& cfun
->cfg
)
1019 basic_block dest
= label_to_block (label
);
1022 edge label_edge
= find_edge (gimple_bb (gs
), dest
);
1023 if (label_edge
&& !(flags
& TDF_GIMPLE
))
1024 dump_edge_probability (buffer
, label_edge
);
1028 if (i
< gimple_switch_num_labels (gs
) - 1)
1030 if (flags
& TDF_GIMPLE
)
1031 pp_string (buffer
, "; ");
1033 pp_string (buffer
, ", ");
1036 if (flags
& TDF_GIMPLE
)
1037 pp_string (buffer
, "; }");
1039 pp_greater (buffer
);
1043 /* Dump the gimple conditional GS. BUFFER, SPC and FLAGS are as in
1044 pp_gimple_stmt_1. */
1047 dump_gimple_cond (pretty_printer
*buffer
, gcond
*gs
, int spc
,
1050 if (flags
& TDF_RAW
)
1051 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%s, %T, %T, %T, %T>", gs
,
1052 get_tree_code_name (gimple_cond_code (gs
)),
1053 gimple_cond_lhs (gs
), gimple_cond_rhs (gs
),
1054 gimple_cond_true_label (gs
), gimple_cond_false_label (gs
));
1057 if (!(flags
& TDF_RHS_ONLY
))
1058 pp_string (buffer
, "if (");
1059 dump_generic_node (buffer
, gimple_cond_lhs (gs
), spc
, flags
, false);
1061 pp_string (buffer
, op_symbol_code (gimple_cond_code (gs
)));
1063 dump_generic_node (buffer
, gimple_cond_rhs (gs
), spc
, flags
, false);
1064 if (!(flags
& TDF_RHS_ONLY
))
1067 edge e
, true_edge
= NULL
, false_edge
= NULL
;
1068 basic_block bb
= gimple_bb (gs
);
1072 FOR_EACH_EDGE (e
, ei
, bb
->succs
)
1074 if (e
->flags
& EDGE_TRUE_VALUE
)
1076 else if (e
->flags
& EDGE_FALSE_VALUE
)
1081 bool has_edge_info
= true_edge
!= NULL
&& false_edge
!= NULL
;
1083 pp_right_paren (buffer
);
1085 if (gimple_cond_true_label (gs
))
1087 pp_string (buffer
, " goto ");
1088 dump_generic_node (buffer
, gimple_cond_true_label (gs
),
1090 if (has_edge_info
&& !(flags
& TDF_GIMPLE
))
1091 dump_edge_probability (buffer
, true_edge
);
1092 pp_semicolon (buffer
);
1094 if (gimple_cond_false_label (gs
))
1096 pp_string (buffer
, " else goto ");
1097 dump_generic_node (buffer
, gimple_cond_false_label (gs
),
1099 if (has_edge_info
&& !(flags
& TDF_GIMPLE
))
1100 dump_edge_probability (buffer
, false_edge
);
1102 pp_semicolon (buffer
);
1109 /* Dump a GIMPLE_LABEL tuple on the pretty_printer BUFFER, SPC
1110 spaces of indent. FLAGS specifies details to show in the dump (see
1111 TDF_* in dumpfils.h). */
1114 dump_gimple_label (pretty_printer
*buffer
, glabel
*gs
, int spc
,
1117 tree label
= gimple_label_label (gs
);
1118 if (flags
& TDF_RAW
)
1119 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
, label
);
1122 dump_generic_node (buffer
, label
, spc
, flags
, false);
1125 if (flags
& TDF_GIMPLE
)
1127 if (DECL_NONLOCAL (label
))
1128 pp_string (buffer
, " [non-local]");
1129 if ((flags
& TDF_EH
) && EH_LANDING_PAD_NR (label
))
1130 pp_printf (buffer
, " [LP %d]", EH_LANDING_PAD_NR (label
));
1133 /* Dump a GIMPLE_GOTO tuple on the pretty_printer BUFFER, SPC
1134 spaces of indent. FLAGS specifies details to show in the dump (see
1135 TDF_* in dumpfile.h). */
1138 dump_gimple_goto (pretty_printer
*buffer
, ggoto
*gs
, int spc
,
1141 tree label
= gimple_goto_dest (gs
);
1142 if (flags
& TDF_RAW
)
1143 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
, label
);
1145 dump_gimple_fmt (buffer
, spc
, flags
, "goto %T;", label
);
1149 /* Dump a GIMPLE_BIND tuple on the pretty_printer BUFFER, SPC
1150 spaces of indent. FLAGS specifies details to show in the dump (see
1151 TDF_* in dumpfile.h). */
1154 dump_gimple_bind (pretty_printer
*buffer
, gbind
*gs
, int spc
,
1157 if (flags
& TDF_RAW
)
1158 dump_gimple_fmt (buffer
, spc
, flags
, "%G <", gs
);
1160 pp_left_brace (buffer
);
1161 if (!(flags
& TDF_SLIM
))
1165 for (var
= gimple_bind_vars (gs
); var
; var
= DECL_CHAIN (var
))
1167 newline_and_indent (buffer
, 2);
1168 print_declaration (buffer
, var
, spc
, flags
);
1170 if (gimple_bind_vars (gs
))
1171 pp_newline (buffer
);
1173 pp_newline (buffer
);
1174 dump_gimple_seq (buffer
, gimple_bind_body (gs
), spc
+ 2, flags
);
1175 newline_and_indent (buffer
, spc
);
1176 if (flags
& TDF_RAW
)
1177 pp_greater (buffer
);
1179 pp_right_brace (buffer
);
1183 /* Dump a GIMPLE_TRY tuple on the pretty_printer BUFFER, SPC spaces of
1184 indent. FLAGS specifies details to show in the dump (see TDF_* in
1188 dump_gimple_try (pretty_printer
*buffer
, gtry
*gs
, int spc
,
1191 if (flags
& TDF_RAW
)
1194 if (gimple_try_kind (gs
) == GIMPLE_TRY_CATCH
)
1195 type
= "GIMPLE_TRY_CATCH";
1196 else if (gimple_try_kind (gs
) == GIMPLE_TRY_FINALLY
)
1197 type
= "GIMPLE_TRY_FINALLY";
1199 type
= "UNKNOWN GIMPLE_TRY";
1200 dump_gimple_fmt (buffer
, spc
, flags
,
1201 "%G <%s,%+EVAL <%S>%nCLEANUP <%S>%->", gs
, type
,
1202 gimple_try_eval (gs
), gimple_try_cleanup (gs
));
1206 pp_string (buffer
, "try");
1207 newline_and_indent (buffer
, spc
+ 2);
1208 pp_left_brace (buffer
);
1209 pp_newline (buffer
);
1211 dump_gimple_seq (buffer
, gimple_try_eval (gs
), spc
+ 4, flags
);
1212 newline_and_indent (buffer
, spc
+ 2);
1213 pp_right_brace (buffer
);
1215 if (gimple_try_kind (gs
) == GIMPLE_TRY_CATCH
)
1217 newline_and_indent (buffer
, spc
);
1218 pp_string (buffer
, "catch");
1219 newline_and_indent (buffer
, spc
+ 2);
1220 pp_left_brace (buffer
);
1222 else if (gimple_try_kind (gs
) == GIMPLE_TRY_FINALLY
)
1224 newline_and_indent (buffer
, spc
);
1225 pp_string (buffer
, "finally");
1226 newline_and_indent (buffer
, spc
+ 2);
1227 pp_left_brace (buffer
);
1230 pp_string (buffer
, " <UNKNOWN GIMPLE_TRY> {");
1232 pp_newline (buffer
);
1233 dump_gimple_seq (buffer
, gimple_try_cleanup (gs
), spc
+ 4, flags
);
1234 newline_and_indent (buffer
, spc
+ 2);
1235 pp_right_brace (buffer
);
1240 /* Dump a GIMPLE_CATCH tuple on the pretty_printer BUFFER, SPC spaces of
1241 indent. FLAGS specifies details to show in the dump (see TDF_* in
1245 dump_gimple_catch (pretty_printer
*buffer
, gcatch
*gs
, int spc
,
1248 if (flags
& TDF_RAW
)
1249 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %+CATCH <%S>%->", gs
,
1250 gimple_catch_types (gs
), gimple_catch_handler (gs
));
1252 dump_gimple_fmt (buffer
, spc
, flags
, "catch (%T)%+{%S}",
1253 gimple_catch_types (gs
), gimple_catch_handler (gs
));
1257 /* Dump a GIMPLE_EH_FILTER tuple on the pretty_printer BUFFER, SPC spaces of
1258 indent. FLAGS specifies details to show in the dump (see TDF_* in
1262 dump_gimple_eh_filter (pretty_printer
*buffer
, geh_filter
*gs
, int spc
,
1265 if (flags
& TDF_RAW
)
1266 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %+FAILURE <%S>%->", gs
,
1267 gimple_eh_filter_types (gs
),
1268 gimple_eh_filter_failure (gs
));
1270 dump_gimple_fmt (buffer
, spc
, flags
, "<<<eh_filter (%T)>>>%+{%+%S%-}",
1271 gimple_eh_filter_types (gs
),
1272 gimple_eh_filter_failure (gs
));
1276 /* Dump a GIMPLE_EH_MUST_NOT_THROW tuple. */
1279 dump_gimple_eh_must_not_throw (pretty_printer
*buffer
,
1280 geh_mnt
*gs
, int spc
, dump_flags_t flags
)
1282 if (flags
& TDF_RAW
)
1283 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
,
1284 gimple_eh_must_not_throw_fndecl (gs
));
1286 dump_gimple_fmt (buffer
, spc
, flags
, "<<<eh_must_not_throw (%T)>>>",
1287 gimple_eh_must_not_throw_fndecl (gs
));
1291 /* Dump a GIMPLE_EH_ELSE tuple on the pretty_printer BUFFER, SPC spaces of
1292 indent. FLAGS specifies details to show in the dump (see TDF_* in
1296 dump_gimple_eh_else (pretty_printer
*buffer
, geh_else
*gs
, int spc
,
1299 if (flags
& TDF_RAW
)
1300 dump_gimple_fmt (buffer
, spc
, flags
,
1301 "%G <%+N_BODY <%S>%nE_BODY <%S>%->", gs
,
1302 gimple_eh_else_n_body (gs
), gimple_eh_else_e_body (gs
));
1304 dump_gimple_fmt (buffer
, spc
, flags
,
1305 "<<<if_normal_exit>>>%+{%S}%-<<<else_eh_exit>>>%+{%S}",
1306 gimple_eh_else_n_body (gs
), gimple_eh_else_e_body (gs
));
1310 /* Dump a GIMPLE_RESX tuple on the pretty_printer BUFFER, SPC spaces of
1311 indent. FLAGS specifies details to show in the dump (see TDF_* in
1315 dump_gimple_resx (pretty_printer
*buffer
, gresx
*gs
, int spc
,
1318 if (flags
& TDF_RAW
)
1319 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%d>", gs
,
1320 gimple_resx_region (gs
));
1322 dump_gimple_fmt (buffer
, spc
, flags
, "resx %d", gimple_resx_region (gs
));
1325 /* Dump a GIMPLE_EH_DISPATCH tuple on the pretty_printer BUFFER. */
1328 dump_gimple_eh_dispatch (pretty_printer
*buffer
, geh_dispatch
*gs
, int spc
,
1331 if (flags
& TDF_RAW
)
1332 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%d>", gs
,
1333 gimple_eh_dispatch_region (gs
));
1335 dump_gimple_fmt (buffer
, spc
, flags
, "eh_dispatch %d",
1336 gimple_eh_dispatch_region (gs
));
1339 /* Dump a GIMPLE_DEBUG tuple on the pretty_printer BUFFER, SPC spaces
1340 of indent. FLAGS specifies details to show in the dump (see TDF_*
1344 dump_gimple_debug (pretty_printer
*buffer
, gdebug
*gs
, int spc
,
1347 switch (gs
->subcode
)
1349 case GIMPLE_DEBUG_BIND
:
1350 if (flags
& TDF_RAW
)
1351 dump_gimple_fmt (buffer
, spc
, flags
, "%G BIND <%T, %T>", gs
,
1352 gimple_debug_bind_get_var (gs
),
1353 gimple_debug_bind_get_value (gs
));
1355 dump_gimple_fmt (buffer
, spc
, flags
, "# DEBUG %T => %T",
1356 gimple_debug_bind_get_var (gs
),
1357 gimple_debug_bind_get_value (gs
));
1360 case GIMPLE_DEBUG_SOURCE_BIND
:
1361 if (flags
& TDF_RAW
)
1362 dump_gimple_fmt (buffer
, spc
, flags
, "%G SRCBIND <%T, %T>", gs
,
1363 gimple_debug_source_bind_get_var (gs
),
1364 gimple_debug_source_bind_get_value (gs
));
1366 dump_gimple_fmt (buffer
, spc
, flags
, "# DEBUG %T s=> %T",
1367 gimple_debug_source_bind_get_var (gs
),
1368 gimple_debug_source_bind_get_value (gs
));
1376 /* Dump a GIMPLE_OMP_FOR tuple on the pretty_printer BUFFER. */
1378 dump_gimple_omp_for (pretty_printer
*buffer
, gomp_for
*gs
, int spc
,
1383 if (flags
& TDF_RAW
)
1386 switch (gimple_omp_for_kind (gs
))
1388 case GF_OMP_FOR_KIND_FOR
:
1391 case GF_OMP_FOR_KIND_DISTRIBUTE
:
1392 kind
= " distribute";
1394 case GF_OMP_FOR_KIND_TASKLOOP
:
1397 case GF_OMP_FOR_KIND_CILKFOR
:
1398 kind
= " _Cilk_for";
1400 case GF_OMP_FOR_KIND_OACC_LOOP
:
1401 kind
= " oacc_loop";
1403 case GF_OMP_FOR_KIND_SIMD
:
1406 case GF_OMP_FOR_KIND_CILKSIMD
:
1412 dump_gimple_fmt (buffer
, spc
, flags
, "%G%s <%+BODY <%S>%nCLAUSES <", gs
,
1413 kind
, gimple_omp_body (gs
));
1414 dump_omp_clauses (buffer
, gimple_omp_for_clauses (gs
), spc
, flags
);
1415 dump_gimple_fmt (buffer
, spc
, flags
, " >,");
1416 for (i
= 0; i
< gimple_omp_for_collapse (gs
); i
++)
1417 dump_gimple_fmt (buffer
, spc
, flags
,
1418 "%+%T, %T, %T, %s, %T,%n",
1419 gimple_omp_for_index (gs
, i
),
1420 gimple_omp_for_initial (gs
, i
),
1421 gimple_omp_for_final (gs
, i
),
1422 get_tree_code_name (gimple_omp_for_cond (gs
, i
)),
1423 gimple_omp_for_incr (gs
, i
));
1424 dump_gimple_fmt (buffer
, spc
, flags
, "PRE_BODY <%S>%->",
1425 gimple_omp_for_pre_body (gs
));
1429 switch (gimple_omp_for_kind (gs
))
1431 case GF_OMP_FOR_KIND_FOR
:
1432 pp_string (buffer
, "#pragma omp for");
1434 case GF_OMP_FOR_KIND_DISTRIBUTE
:
1435 pp_string (buffer
, "#pragma omp distribute");
1437 case GF_OMP_FOR_KIND_TASKLOOP
:
1438 pp_string (buffer
, "#pragma omp taskloop");
1440 case GF_OMP_FOR_KIND_CILKFOR
:
1442 case GF_OMP_FOR_KIND_OACC_LOOP
:
1443 pp_string (buffer
, "#pragma acc loop");
1445 case GF_OMP_FOR_KIND_SIMD
:
1446 pp_string (buffer
, "#pragma omp simd");
1448 case GF_OMP_FOR_KIND_CILKSIMD
:
1449 pp_string (buffer
, "#pragma simd");
1451 case GF_OMP_FOR_KIND_GRID_LOOP
:
1452 pp_string (buffer
, "#pragma omp for grid_loop");
1457 if (gimple_omp_for_kind (gs
) != GF_OMP_FOR_KIND_CILKFOR
)
1458 dump_omp_clauses (buffer
, gimple_omp_for_clauses (gs
), spc
, flags
);
1459 for (i
= 0; i
< gimple_omp_for_collapse (gs
); i
++)
1463 if (gimple_omp_for_kind (gs
) == GF_OMP_FOR_KIND_CILKFOR
)
1464 pp_string (buffer
, "_Cilk_for (");
1467 newline_and_indent (buffer
, spc
);
1468 pp_string (buffer
, "for (");
1470 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
1472 pp_string (buffer
, " = ");
1473 dump_generic_node (buffer
, gimple_omp_for_initial (gs
, i
), spc
,
1475 pp_string (buffer
, "; ");
1477 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
1480 switch (gimple_omp_for_cond (gs
, i
))
1486 pp_greater (buffer
);
1489 pp_less_equal (buffer
);
1492 pp_greater_equal (buffer
);
1495 pp_string (buffer
, "!=");
1501 dump_generic_node (buffer
, gimple_omp_for_final (gs
, i
), spc
,
1503 pp_string (buffer
, "; ");
1505 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
1507 pp_string (buffer
, " = ");
1508 dump_generic_node (buffer
, gimple_omp_for_incr (gs
, i
), spc
,
1510 pp_right_paren (buffer
);
1513 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1515 if (gimple_omp_for_kind (gs
) == GF_OMP_FOR_KIND_CILKFOR
)
1516 dump_omp_clauses (buffer
, gimple_omp_for_clauses (gs
), spc
, flags
);
1517 newline_and_indent (buffer
, spc
+ 2);
1518 pp_left_brace (buffer
);
1519 pp_newline (buffer
);
1520 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1521 newline_and_indent (buffer
, spc
+ 2);
1522 pp_right_brace (buffer
);
1527 /* Dump a GIMPLE_OMP_CONTINUE tuple on the pretty_printer BUFFER. */
1530 dump_gimple_omp_continue (pretty_printer
*buffer
, gomp_continue
*gs
,
1531 int spc
, dump_flags_t flags
)
1533 if (flags
& TDF_RAW
)
1535 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T>", gs
,
1536 gimple_omp_continue_control_def (gs
),
1537 gimple_omp_continue_control_use (gs
));
1541 pp_string (buffer
, "#pragma omp continue (");
1542 dump_generic_node (buffer
, gimple_omp_continue_control_def (gs
),
1546 dump_generic_node (buffer
, gimple_omp_continue_control_use (gs
),
1548 pp_right_paren (buffer
);
1552 /* Dump a GIMPLE_OMP_SINGLE tuple on the pretty_printer BUFFER. */
1555 dump_gimple_omp_single (pretty_printer
*buffer
, gomp_single
*gs
,
1556 int spc
, dump_flags_t flags
)
1558 if (flags
& TDF_RAW
)
1560 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1561 gimple_omp_body (gs
));
1562 dump_omp_clauses (buffer
, gimple_omp_single_clauses (gs
), spc
, flags
);
1563 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1567 pp_string (buffer
, "#pragma omp single");
1568 dump_omp_clauses (buffer
, gimple_omp_single_clauses (gs
), spc
, flags
);
1569 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1571 newline_and_indent (buffer
, spc
+ 2);
1572 pp_left_brace (buffer
);
1573 pp_newline (buffer
);
1574 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1575 newline_and_indent (buffer
, spc
+ 2);
1576 pp_right_brace (buffer
);
1581 /* Dump a GIMPLE_OMP_TARGET tuple on the pretty_printer BUFFER. */
1584 dump_gimple_omp_target (pretty_printer
*buffer
, gomp_target
*gs
,
1585 int spc
, dump_flags_t flags
)
1588 switch (gimple_omp_target_kind (gs
))
1590 case GF_OMP_TARGET_KIND_REGION
:
1593 case GF_OMP_TARGET_KIND_DATA
:
1596 case GF_OMP_TARGET_KIND_UPDATE
:
1599 case GF_OMP_TARGET_KIND_ENTER_DATA
:
1600 kind
= " enter data";
1602 case GF_OMP_TARGET_KIND_EXIT_DATA
:
1603 kind
= " exit data";
1605 case GF_OMP_TARGET_KIND_OACC_KERNELS
:
1606 kind
= " oacc_kernels";
1608 case GF_OMP_TARGET_KIND_OACC_PARALLEL
:
1609 kind
= " oacc_parallel";
1611 case GF_OMP_TARGET_KIND_OACC_DATA
:
1612 kind
= " oacc_data";
1614 case GF_OMP_TARGET_KIND_OACC_UPDATE
:
1615 kind
= " oacc_update";
1617 case GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA
:
1618 kind
= " oacc_enter_exit_data";
1620 case GF_OMP_TARGET_KIND_OACC_DECLARE
:
1621 kind
= " oacc_declare";
1623 case GF_OMP_TARGET_KIND_OACC_HOST_DATA
:
1624 kind
= " oacc_host_data";
1629 if (flags
& TDF_RAW
)
1631 dump_gimple_fmt (buffer
, spc
, flags
, "%G%s <%+BODY <%S>%nCLAUSES <", gs
,
1632 kind
, gimple_omp_body (gs
));
1633 dump_omp_clauses (buffer
, gimple_omp_target_clauses (gs
), spc
, flags
);
1634 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T%n>",
1635 gimple_omp_target_child_fn (gs
),
1636 gimple_omp_target_data_arg (gs
));
1640 pp_string (buffer
, "#pragma omp target");
1641 pp_string (buffer
, kind
);
1642 dump_omp_clauses (buffer
, gimple_omp_target_clauses (gs
), spc
, flags
);
1643 if (gimple_omp_target_child_fn (gs
))
1645 pp_string (buffer
, " [child fn: ");
1646 dump_generic_node (buffer
, gimple_omp_target_child_fn (gs
),
1648 pp_string (buffer
, " (");
1649 if (gimple_omp_target_data_arg (gs
))
1650 dump_generic_node (buffer
, gimple_omp_target_data_arg (gs
),
1653 pp_string (buffer
, "???");
1654 pp_string (buffer
, ")]");
1656 gimple_seq body
= gimple_omp_body (gs
);
1657 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
1659 newline_and_indent (buffer
, spc
+ 2);
1660 pp_left_brace (buffer
);
1661 pp_newline (buffer
);
1662 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
1663 newline_and_indent (buffer
, spc
+ 2);
1664 pp_right_brace (buffer
);
1668 pp_newline (buffer
);
1669 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
1674 /* Dump a GIMPLE_OMP_TEAMS tuple on the pretty_printer BUFFER. */
1677 dump_gimple_omp_teams (pretty_printer
*buffer
, gomp_teams
*gs
, int spc
,
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_teams_clauses (gs
), spc
, flags
);
1685 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1689 pp_string (buffer
, "#pragma omp teams");
1690 dump_omp_clauses (buffer
, gimple_omp_teams_clauses (gs
), spc
, flags
);
1691 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1693 newline_and_indent (buffer
, spc
+ 2);
1694 pp_character (buffer
, '{');
1695 pp_newline (buffer
);
1696 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1697 newline_and_indent (buffer
, spc
+ 2);
1698 pp_character (buffer
, '}');
1703 /* Dump a GIMPLE_OMP_SECTIONS tuple on the pretty_printer BUFFER. */
1706 dump_gimple_omp_sections (pretty_printer
*buffer
, gomp_sections
*gs
,
1707 int spc
, dump_flags_t flags
)
1709 if (flags
& TDF_RAW
)
1711 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1712 gimple_omp_body (gs
));
1713 dump_omp_clauses (buffer
, gimple_omp_sections_clauses (gs
), spc
, flags
);
1714 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1718 pp_string (buffer
, "#pragma omp sections");
1719 if (gimple_omp_sections_control (gs
))
1721 pp_string (buffer
, " <");
1722 dump_generic_node (buffer
, gimple_omp_sections_control (gs
), spc
,
1724 pp_greater (buffer
);
1726 dump_omp_clauses (buffer
, gimple_omp_sections_clauses (gs
), spc
, flags
);
1727 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1729 newline_and_indent (buffer
, spc
+ 2);
1730 pp_left_brace (buffer
);
1731 pp_newline (buffer
);
1732 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1733 newline_and_indent (buffer
, spc
+ 2);
1734 pp_right_brace (buffer
);
1739 /* Dump a GIMPLE_OMP_{MASTER,TASKGROUP,ORDERED,SECTION} tuple on the
1740 pretty_printer BUFFER. */
1743 dump_gimple_omp_block (pretty_printer
*buffer
, gimple
*gs
, int spc
,
1746 if (flags
& TDF_RAW
)
1747 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1748 gimple_omp_body (gs
));
1751 switch (gimple_code (gs
))
1753 case GIMPLE_OMP_MASTER
:
1754 pp_string (buffer
, "#pragma omp master");
1756 case GIMPLE_OMP_TASKGROUP
:
1757 pp_string (buffer
, "#pragma omp taskgroup");
1759 case GIMPLE_OMP_SECTION
:
1760 pp_string (buffer
, "#pragma omp section");
1762 case GIMPLE_OMP_GRID_BODY
:
1763 pp_string (buffer
, "#pragma omp gridified body");
1768 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1770 newline_and_indent (buffer
, spc
+ 2);
1771 pp_left_brace (buffer
);
1772 pp_newline (buffer
);
1773 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1774 newline_and_indent (buffer
, spc
+ 2);
1775 pp_right_brace (buffer
);
1780 /* Dump a GIMPLE_OMP_CRITICAL tuple on the pretty_printer BUFFER. */
1783 dump_gimple_omp_critical (pretty_printer
*buffer
, gomp_critical
*gs
,
1784 int spc
, dump_flags_t flags
)
1786 if (flags
& TDF_RAW
)
1787 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1788 gimple_omp_body (gs
));
1791 pp_string (buffer
, "#pragma omp critical");
1792 if (gimple_omp_critical_name (gs
))
1794 pp_string (buffer
, " (");
1795 dump_generic_node (buffer
, gimple_omp_critical_name (gs
), spc
,
1797 pp_right_paren (buffer
);
1799 dump_omp_clauses (buffer
, gimple_omp_critical_clauses (gs
), spc
, flags
);
1800 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1802 newline_and_indent (buffer
, spc
+ 2);
1803 pp_left_brace (buffer
);
1804 pp_newline (buffer
);
1805 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1806 newline_and_indent (buffer
, spc
+ 2);
1807 pp_right_brace (buffer
);
1812 /* Dump a GIMPLE_OMP_ORDERED tuple on the pretty_printer BUFFER. */
1815 dump_gimple_omp_ordered (pretty_printer
*buffer
, gomp_ordered
*gs
,
1816 int spc
, dump_flags_t flags
)
1818 if (flags
& TDF_RAW
)
1819 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1820 gimple_omp_body (gs
));
1823 pp_string (buffer
, "#pragma omp ordered");
1824 dump_omp_clauses (buffer
, gimple_omp_ordered_clauses (gs
), spc
, flags
);
1825 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1827 newline_and_indent (buffer
, spc
+ 2);
1828 pp_left_brace (buffer
);
1829 pp_newline (buffer
);
1830 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1831 newline_and_indent (buffer
, spc
+ 2);
1832 pp_right_brace (buffer
);
1837 /* Dump a GIMPLE_OMP_RETURN tuple on the pretty_printer BUFFER. */
1840 dump_gimple_omp_return (pretty_printer
*buffer
, gimple
*gs
, int spc
,
1843 if (flags
& TDF_RAW
)
1845 dump_gimple_fmt (buffer
, spc
, flags
, "%G <nowait=%d", gs
,
1846 (int) gimple_omp_return_nowait_p (gs
));
1847 if (gimple_omp_return_lhs (gs
))
1848 dump_gimple_fmt (buffer
, spc
, flags
, ", lhs=%T>",
1849 gimple_omp_return_lhs (gs
));
1851 dump_gimple_fmt (buffer
, spc
, flags
, ">");
1855 pp_string (buffer
, "#pragma omp return");
1856 if (gimple_omp_return_nowait_p (gs
))
1857 pp_string (buffer
, "(nowait)");
1858 if (gimple_omp_return_lhs (gs
))
1860 pp_string (buffer
, " (set ");
1861 dump_generic_node (buffer
, gimple_omp_return_lhs (gs
),
1863 pp_character (buffer
, ')');
1868 /* Dump a GIMPLE_TRANSACTION tuple on the pretty_printer BUFFER. */
1871 dump_gimple_transaction (pretty_printer
*buffer
, gtransaction
*gs
,
1872 int spc
, dump_flags_t flags
)
1874 unsigned subcode
= gimple_transaction_subcode (gs
);
1876 if (flags
& TDF_RAW
)
1878 dump_gimple_fmt (buffer
, spc
, flags
,
1879 "%G [SUBCODE=%x,NORM=%T,UNINST=%T,OVER=%T] "
1881 gs
, subcode
, gimple_transaction_label_norm (gs
),
1882 gimple_transaction_label_uninst (gs
),
1883 gimple_transaction_label_over (gs
),
1884 gimple_transaction_body (gs
));
1888 if (subcode
& GTMA_IS_OUTER
)
1889 pp_string (buffer
, "__transaction_atomic [[outer]]");
1890 else if (subcode
& GTMA_IS_RELAXED
)
1891 pp_string (buffer
, "__transaction_relaxed");
1893 pp_string (buffer
, "__transaction_atomic");
1894 subcode
&= ~GTMA_DECLARATION_MASK
;
1896 if (gimple_transaction_body (gs
))
1898 newline_and_indent (buffer
, spc
+ 2);
1899 pp_left_brace (buffer
);
1900 pp_newline (buffer
);
1901 dump_gimple_seq (buffer
, gimple_transaction_body (gs
),
1903 newline_and_indent (buffer
, spc
+ 2);
1904 pp_right_brace (buffer
);
1908 pp_string (buffer
, " //");
1909 if (gimple_transaction_label_norm (gs
))
1911 pp_string (buffer
, " NORM=");
1912 dump_generic_node (buffer
, gimple_transaction_label_norm (gs
),
1915 if (gimple_transaction_label_uninst (gs
))
1917 pp_string (buffer
, " UNINST=");
1918 dump_generic_node (buffer
, gimple_transaction_label_uninst (gs
),
1921 if (gimple_transaction_label_over (gs
))
1923 pp_string (buffer
, " OVER=");
1924 dump_generic_node (buffer
, gimple_transaction_label_over (gs
),
1929 pp_string (buffer
, " SUBCODE=[ ");
1930 if (subcode
& GTMA_HAVE_ABORT
)
1932 pp_string (buffer
, "GTMA_HAVE_ABORT ");
1933 subcode
&= ~GTMA_HAVE_ABORT
;
1935 if (subcode
& GTMA_HAVE_LOAD
)
1937 pp_string (buffer
, "GTMA_HAVE_LOAD ");
1938 subcode
&= ~GTMA_HAVE_LOAD
;
1940 if (subcode
& GTMA_HAVE_STORE
)
1942 pp_string (buffer
, "GTMA_HAVE_STORE ");
1943 subcode
&= ~GTMA_HAVE_STORE
;
1945 if (subcode
& GTMA_MAY_ENTER_IRREVOCABLE
)
1947 pp_string (buffer
, "GTMA_MAY_ENTER_IRREVOCABLE ");
1948 subcode
&= ~GTMA_MAY_ENTER_IRREVOCABLE
;
1950 if (subcode
& GTMA_DOES_GO_IRREVOCABLE
)
1952 pp_string (buffer
, "GTMA_DOES_GO_IRREVOCABLE ");
1953 subcode
&= ~GTMA_DOES_GO_IRREVOCABLE
;
1955 if (subcode
& GTMA_HAS_NO_INSTRUMENTATION
)
1957 pp_string (buffer
, "GTMA_HAS_NO_INSTRUMENTATION ");
1958 subcode
&= ~GTMA_HAS_NO_INSTRUMENTATION
;
1961 pp_printf (buffer
, "0x%x ", subcode
);
1962 pp_right_bracket (buffer
);
1968 /* Dump a GIMPLE_ASM tuple on the pretty_printer BUFFER, SPC spaces of
1969 indent. FLAGS specifies details to show in the dump (see TDF_* in
1973 dump_gimple_asm (pretty_printer
*buffer
, gasm
*gs
, int spc
, dump_flags_t flags
)
1975 unsigned int i
, n
, f
, fields
;
1977 if (flags
& TDF_RAW
)
1979 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+STRING <%n%s%n>", gs
,
1980 gimple_asm_string (gs
));
1982 n
= gimple_asm_noutputs (gs
);
1985 newline_and_indent (buffer
, spc
+ 2);
1986 pp_string (buffer
, "OUTPUT: ");
1987 for (i
= 0; i
< n
; i
++)
1989 dump_generic_node (buffer
, gimple_asm_output_op (gs
, i
),
1992 pp_string (buffer
, ", ");
1996 n
= gimple_asm_ninputs (gs
);
1999 newline_and_indent (buffer
, spc
+ 2);
2000 pp_string (buffer
, "INPUT: ");
2001 for (i
= 0; i
< n
; i
++)
2003 dump_generic_node (buffer
, gimple_asm_input_op (gs
, i
),
2006 pp_string (buffer
, ", ");
2010 n
= gimple_asm_nclobbers (gs
);
2013 newline_and_indent (buffer
, spc
+ 2);
2014 pp_string (buffer
, "CLOBBER: ");
2015 for (i
= 0; i
< n
; i
++)
2017 dump_generic_node (buffer
, gimple_asm_clobber_op (gs
, i
),
2020 pp_string (buffer
, ", ");
2024 n
= gimple_asm_nlabels (gs
);
2027 newline_and_indent (buffer
, spc
+ 2);
2028 pp_string (buffer
, "LABEL: ");
2029 for (i
= 0; i
< n
; i
++)
2031 dump_generic_node (buffer
, gimple_asm_label_op (gs
, i
),
2034 pp_string (buffer
, ", ");
2038 newline_and_indent (buffer
, spc
);
2039 pp_greater (buffer
);
2043 pp_string (buffer
, "__asm__");
2044 if (gimple_asm_volatile_p (gs
))
2045 pp_string (buffer
, " __volatile__");
2046 if (gimple_asm_nlabels (gs
))
2047 pp_string (buffer
, " goto");
2048 pp_string (buffer
, "(\"");
2049 pp_string (buffer
, gimple_asm_string (gs
));
2050 pp_string (buffer
, "\"");
2052 if (gimple_asm_nlabels (gs
))
2054 else if (gimple_asm_nclobbers (gs
))
2056 else if (gimple_asm_ninputs (gs
))
2058 else if (gimple_asm_noutputs (gs
))
2063 for (f
= 0; f
< fields
; ++f
)
2065 pp_string (buffer
, " : ");
2070 n
= gimple_asm_noutputs (gs
);
2071 for (i
= 0; i
< n
; i
++)
2073 dump_generic_node (buffer
, gimple_asm_output_op (gs
, i
),
2076 pp_string (buffer
, ", ");
2081 n
= gimple_asm_ninputs (gs
);
2082 for (i
= 0; i
< n
; i
++)
2084 dump_generic_node (buffer
, gimple_asm_input_op (gs
, i
),
2087 pp_string (buffer
, ", ");
2092 n
= gimple_asm_nclobbers (gs
);
2093 for (i
= 0; i
< n
; i
++)
2095 dump_generic_node (buffer
, gimple_asm_clobber_op (gs
, i
),
2098 pp_string (buffer
, ", ");
2103 n
= gimple_asm_nlabels (gs
);
2104 for (i
= 0; i
< n
; i
++)
2106 dump_generic_node (buffer
, gimple_asm_label_op (gs
, i
),
2109 pp_string (buffer
, ", ");
2118 pp_string (buffer
, ");");
2122 /* Dump ptr_info and range_info for NODE on pretty_printer BUFFER with
2123 SPC spaces of indent. */
2126 dump_ssaname_info (pretty_printer
*buffer
, tree node
, int spc
)
2128 if (TREE_CODE (node
) != SSA_NAME
)
2131 if (POINTER_TYPE_P (TREE_TYPE (node
))
2132 && SSA_NAME_PTR_INFO (node
))
2134 unsigned int align
, misalign
;
2135 struct ptr_info_def
*pi
= SSA_NAME_PTR_INFO (node
);
2136 pp_string (buffer
, "# PT = ");
2137 pp_points_to_solution (buffer
, &pi
->pt
);
2138 newline_and_indent (buffer
, spc
);
2139 if (get_ptr_info_alignment (pi
, &align
, &misalign
))
2141 pp_printf (buffer
, "# ALIGN = %u, MISALIGN = %u", align
, misalign
);
2142 newline_and_indent (buffer
, spc
);
2146 if (!POINTER_TYPE_P (TREE_TYPE (node
))
2147 && SSA_NAME_RANGE_INFO (node
))
2149 wide_int min
, max
, nonzero_bits
;
2150 value_range_type range_type
= get_range_info (node
, &min
, &max
);
2152 if (range_type
== VR_VARYING
)
2153 pp_printf (buffer
, "# RANGE VR_VARYING");
2154 else if (range_type
== VR_RANGE
|| range_type
== VR_ANTI_RANGE
)
2156 pp_printf (buffer
, "# RANGE ");
2157 pp_printf (buffer
, "%s[", range_type
== VR_RANGE
? "" : "~");
2158 pp_wide_int (buffer
, min
, TYPE_SIGN (TREE_TYPE (node
)));
2159 pp_printf (buffer
, ", ");
2160 pp_wide_int (buffer
, max
, TYPE_SIGN (TREE_TYPE (node
)));
2161 pp_printf (buffer
, "]");
2163 nonzero_bits
= get_nonzero_bits (node
);
2164 if (nonzero_bits
!= -1)
2166 pp_string (buffer
, " NONZERO ");
2167 pp_wide_int (buffer
, nonzero_bits
, UNSIGNED
);
2169 newline_and_indent (buffer
, spc
);
2173 /* As dump_ssaname_info, but dump to FILE. */
2176 dump_ssaname_info_to_file (FILE *file
, tree node
, int spc
)
2178 pretty_printer buffer
;
2179 pp_needs_newline (&buffer
) = true;
2180 buffer
.buffer
->stream
= file
;
2181 dump_ssaname_info (&buffer
, node
, spc
);
2185 /* Dump a PHI node PHI. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1.
2186 The caller is responsible for calling pp_flush on BUFFER to finalize
2187 pretty printer. If COMMENT is true, print this after #. */
2190 dump_gimple_phi (pretty_printer
*buffer
, gphi
*phi
, int spc
, bool comment
,
2194 tree lhs
= gimple_phi_result (phi
);
2196 if (flags
& TDF_ALIAS
)
2197 dump_ssaname_info (buffer
, lhs
, spc
);
2200 pp_string (buffer
, "# ");
2202 if (flags
& TDF_RAW
)
2203 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, ", phi
,
2204 gimple_phi_result (phi
));
2207 dump_generic_node (buffer
, lhs
, spc
, flags
, false);
2208 if (flags
& TDF_GIMPLE
)
2209 pp_string (buffer
, " = __PHI (");
2211 pp_string (buffer
, " = PHI <");
2213 for (i
= 0; i
< gimple_phi_num_args (phi
); i
++)
2215 if ((flags
& TDF_LINENO
) && gimple_phi_arg_has_location (phi
, i
))
2216 dump_location (buffer
, gimple_phi_arg_location (phi
, i
));
2217 if (flags
& TDF_GIMPLE
)
2219 basic_block src
= gimple_phi_arg_edge (phi
, i
)->src
;
2220 gimple
*stmt
= first_stmt (src
);
2221 if (!stmt
|| gimple_code (stmt
) != GIMPLE_LABEL
)
2223 pp_string (buffer
, "bb_");
2224 pp_decimal_int (buffer
, src
->index
);
2227 dump_generic_node (buffer
, gimple_label_label (as_a
<glabel
*> (stmt
)), 0, flags
,
2229 pp_string (buffer
, ": ");
2231 dump_generic_node (buffer
, gimple_phi_arg_def (phi
, i
), spc
, flags
,
2233 if (! (flags
& TDF_GIMPLE
))
2235 pp_left_paren (buffer
);
2236 pp_decimal_int (buffer
, gimple_phi_arg_edge (phi
, i
)->src
->index
);
2237 pp_right_paren (buffer
);
2239 if (i
< gimple_phi_num_args (phi
) - 1)
2240 pp_string (buffer
, ", ");
2242 if (flags
& TDF_GIMPLE
)
2243 pp_string (buffer
, ");");
2245 pp_greater (buffer
);
2249 /* Dump a GIMPLE_OMP_PARALLEL tuple on the pretty_printer BUFFER, SPC spaces
2250 of indent. FLAGS specifies details to show in the dump (see TDF_* in
2254 dump_gimple_omp_parallel (pretty_printer
*buffer
, gomp_parallel
*gs
,
2255 int spc
, dump_flags_t flags
)
2257 if (flags
& TDF_RAW
)
2259 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
2260 gimple_omp_body (gs
));
2261 dump_omp_clauses (buffer
, gimple_omp_parallel_clauses (gs
), spc
, flags
);
2262 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T%n>",
2263 gimple_omp_parallel_child_fn (gs
),
2264 gimple_omp_parallel_data_arg (gs
));
2269 pp_string (buffer
, "#pragma omp parallel");
2270 dump_omp_clauses (buffer
, gimple_omp_parallel_clauses (gs
), spc
, flags
);
2271 if (gimple_omp_parallel_child_fn (gs
))
2273 pp_string (buffer
, " [child fn: ");
2274 dump_generic_node (buffer
, gimple_omp_parallel_child_fn (gs
),
2276 pp_string (buffer
, " (");
2277 if (gimple_omp_parallel_data_arg (gs
))
2278 dump_generic_node (buffer
, gimple_omp_parallel_data_arg (gs
),
2281 pp_string (buffer
, "???");
2282 pp_string (buffer
, ")]");
2284 body
= gimple_omp_body (gs
);
2285 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
2287 newline_and_indent (buffer
, spc
+ 2);
2288 pp_left_brace (buffer
);
2289 pp_newline (buffer
);
2290 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
2291 newline_and_indent (buffer
, spc
+ 2);
2292 pp_right_brace (buffer
);
2296 pp_newline (buffer
);
2297 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
2303 /* Dump a GIMPLE_OMP_TASK tuple on the pretty_printer BUFFER, SPC spaces
2304 of indent. FLAGS specifies details to show in the dump (see TDF_* in
2308 dump_gimple_omp_task (pretty_printer
*buffer
, gomp_task
*gs
, int spc
,
2311 if (flags
& TDF_RAW
)
2313 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
2314 gimple_omp_body (gs
));
2315 dump_omp_clauses (buffer
, gimple_omp_task_clauses (gs
), spc
, flags
);
2316 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T, %T, %T, %T%n>",
2317 gimple_omp_task_child_fn (gs
),
2318 gimple_omp_task_data_arg (gs
),
2319 gimple_omp_task_copy_fn (gs
),
2320 gimple_omp_task_arg_size (gs
),
2321 gimple_omp_task_arg_size (gs
));
2326 if (gimple_omp_task_taskloop_p (gs
))
2327 pp_string (buffer
, "#pragma omp taskloop");
2329 pp_string (buffer
, "#pragma omp task");
2330 dump_omp_clauses (buffer
, gimple_omp_task_clauses (gs
), spc
, flags
);
2331 if (gimple_omp_task_child_fn (gs
))
2333 pp_string (buffer
, " [child fn: ");
2334 dump_generic_node (buffer
, gimple_omp_task_child_fn (gs
),
2336 pp_string (buffer
, " (");
2337 if (gimple_omp_task_data_arg (gs
))
2338 dump_generic_node (buffer
, gimple_omp_task_data_arg (gs
),
2341 pp_string (buffer
, "???");
2342 pp_string (buffer
, ")]");
2344 body
= gimple_omp_body (gs
);
2345 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
2347 newline_and_indent (buffer
, spc
+ 2);
2348 pp_left_brace (buffer
);
2349 pp_newline (buffer
);
2350 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
2351 newline_and_indent (buffer
, spc
+ 2);
2352 pp_right_brace (buffer
);
2356 pp_newline (buffer
);
2357 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
2363 /* Dump a GIMPLE_OMP_ATOMIC_LOAD tuple on the pretty_printer BUFFER, SPC
2364 spaces of indent. FLAGS specifies details to show in the dump (see TDF_*
2368 dump_gimple_omp_atomic_load (pretty_printer
*buffer
, gomp_atomic_load
*gs
,
2369 int spc
, dump_flags_t flags
)
2371 if (flags
& TDF_RAW
)
2373 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T>", gs
,
2374 gimple_omp_atomic_load_lhs (gs
),
2375 gimple_omp_atomic_load_rhs (gs
));
2379 pp_string (buffer
, "#pragma omp atomic_load");
2380 if (gimple_omp_atomic_seq_cst_p (gs
))
2381 pp_string (buffer
, " seq_cst");
2382 if (gimple_omp_atomic_need_value_p (gs
))
2383 pp_string (buffer
, " [needed]");
2384 newline_and_indent (buffer
, spc
+ 2);
2385 dump_generic_node (buffer
, gimple_omp_atomic_load_lhs (gs
),
2391 dump_generic_node (buffer
, gimple_omp_atomic_load_rhs (gs
),
2396 /* Dump a GIMPLE_OMP_ATOMIC_STORE tuple on the pretty_printer BUFFER, SPC
2397 spaces of indent. FLAGS specifies details to show in the dump (see TDF_*
2401 dump_gimple_omp_atomic_store (pretty_printer
*buffer
,
2402 gomp_atomic_store
*gs
, int spc
,
2405 if (flags
& TDF_RAW
)
2407 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
,
2408 gimple_omp_atomic_store_val (gs
));
2412 pp_string (buffer
, "#pragma omp atomic_store ");
2413 if (gimple_omp_atomic_seq_cst_p (gs
))
2414 pp_string (buffer
, "seq_cst ");
2415 if (gimple_omp_atomic_need_value_p (gs
))
2416 pp_string (buffer
, "[needed] ");
2417 pp_left_paren (buffer
);
2418 dump_generic_node (buffer
, gimple_omp_atomic_store_val (gs
),
2420 pp_right_paren (buffer
);
2425 /* Dump all the memory operands for statement GS. BUFFER, SPC and
2426 FLAGS are as in pp_gimple_stmt_1. */
2429 dump_gimple_mem_ops (pretty_printer
*buffer
, gimple
*gs
, int spc
,
2432 tree vdef
= gimple_vdef (gs
);
2433 tree vuse
= gimple_vuse (gs
);
2435 if (vdef
!= NULL_TREE
)
2437 pp_string (buffer
, "# ");
2438 dump_generic_node (buffer
, vdef
, spc
+ 2, flags
, false);
2439 pp_string (buffer
, " = VDEF <");
2440 dump_generic_node (buffer
, vuse
, spc
+ 2, flags
, false);
2441 pp_greater (buffer
);
2442 newline_and_indent (buffer
, spc
);
2444 else if (vuse
!= NULL_TREE
)
2446 pp_string (buffer
, "# VUSE <");
2447 dump_generic_node (buffer
, vuse
, spc
+ 2, flags
, false);
2448 pp_greater (buffer
);
2449 newline_and_indent (buffer
, spc
);
2454 /* Print the gimple statement GS on the pretty printer BUFFER, SPC
2455 spaces of indent. FLAGS specifies details to show in the dump (see
2456 TDF_* in dumpfile.h). The caller is responsible for calling
2457 pp_flush on BUFFER to finalize the pretty printer. */
2460 pp_gimple_stmt_1 (pretty_printer
*buffer
, gimple
*gs
, int spc
,
2466 if (flags
& TDF_STMTADDR
)
2467 pp_printf (buffer
, "<&%p> ", (void *) gs
);
2469 if ((flags
& TDF_LINENO
) && gimple_has_location (gs
))
2470 dump_location (buffer
, gimple_location (gs
));
2474 int lp_nr
= lookup_stmt_eh_lp (gs
);
2476 pp_printf (buffer
, "[LP %d] ", lp_nr
);
2478 pp_printf (buffer
, "[MNT %d] ", -lp_nr
);
2481 if ((flags
& (TDF_VOPS
|TDF_MEMSYMS
))
2482 && gimple_has_mem_ops (gs
))
2483 dump_gimple_mem_ops (buffer
, gs
, spc
, flags
);
2485 if (gimple_has_lhs (gs
)
2486 && (flags
& TDF_ALIAS
))
2487 dump_ssaname_info (buffer
, gimple_get_lhs (gs
), spc
);
2489 switch (gimple_code (gs
))
2492 dump_gimple_asm (buffer
, as_a
<gasm
*> (gs
), spc
, flags
);
2496 dump_gimple_assign (buffer
, as_a
<gassign
*> (gs
), spc
, flags
);
2500 dump_gimple_bind (buffer
, as_a
<gbind
*> (gs
), spc
, flags
);
2504 dump_gimple_call (buffer
, as_a
<gcall
*> (gs
), spc
, flags
);
2508 dump_gimple_cond (buffer
, as_a
<gcond
*> (gs
), spc
, flags
);
2512 dump_gimple_label (buffer
, as_a
<glabel
*> (gs
), spc
, flags
);
2516 dump_gimple_goto (buffer
, as_a
<ggoto
*> (gs
), spc
, flags
);
2520 pp_string (buffer
, "GIMPLE_NOP");
2524 dump_gimple_return (buffer
, as_a
<greturn
*> (gs
), spc
, flags
);
2528 dump_gimple_switch (buffer
, as_a
<gswitch
*> (gs
), spc
, flags
);
2532 dump_gimple_try (buffer
, as_a
<gtry
*> (gs
), spc
, flags
);
2536 dump_gimple_phi (buffer
, as_a
<gphi
*> (gs
), spc
, false, flags
);
2539 case GIMPLE_OMP_PARALLEL
:
2540 dump_gimple_omp_parallel (buffer
, as_a
<gomp_parallel
*> (gs
), spc
,
2544 case GIMPLE_OMP_TASK
:
2545 dump_gimple_omp_task (buffer
, as_a
<gomp_task
*> (gs
), spc
, flags
);
2548 case GIMPLE_OMP_ATOMIC_LOAD
:
2549 dump_gimple_omp_atomic_load (buffer
, as_a
<gomp_atomic_load
*> (gs
),
2553 case GIMPLE_OMP_ATOMIC_STORE
:
2554 dump_gimple_omp_atomic_store (buffer
,
2555 as_a
<gomp_atomic_store
*> (gs
),
2559 case GIMPLE_OMP_FOR
:
2560 dump_gimple_omp_for (buffer
, as_a
<gomp_for
*> (gs
), spc
, flags
);
2563 case GIMPLE_OMP_CONTINUE
:
2564 dump_gimple_omp_continue (buffer
, as_a
<gomp_continue
*> (gs
), spc
,
2568 case GIMPLE_OMP_SINGLE
:
2569 dump_gimple_omp_single (buffer
, as_a
<gomp_single
*> (gs
), spc
,
2573 case GIMPLE_OMP_TARGET
:
2574 dump_gimple_omp_target (buffer
, as_a
<gomp_target
*> (gs
), spc
,
2578 case GIMPLE_OMP_TEAMS
:
2579 dump_gimple_omp_teams (buffer
, as_a
<gomp_teams
*> (gs
), spc
,
2583 case GIMPLE_OMP_RETURN
:
2584 dump_gimple_omp_return (buffer
, gs
, spc
, flags
);
2587 case GIMPLE_OMP_SECTIONS
:
2588 dump_gimple_omp_sections (buffer
, as_a
<gomp_sections
*> (gs
),
2592 case GIMPLE_OMP_SECTIONS_SWITCH
:
2593 pp_string (buffer
, "GIMPLE_SECTIONS_SWITCH");
2596 case GIMPLE_OMP_MASTER
:
2597 case GIMPLE_OMP_TASKGROUP
:
2598 case GIMPLE_OMP_SECTION
:
2599 case GIMPLE_OMP_GRID_BODY
:
2600 dump_gimple_omp_block (buffer
, gs
, spc
, flags
);
2603 case GIMPLE_OMP_ORDERED
:
2604 dump_gimple_omp_ordered (buffer
, as_a
<gomp_ordered
*> (gs
), spc
,
2608 case GIMPLE_OMP_CRITICAL
:
2609 dump_gimple_omp_critical (buffer
, as_a
<gomp_critical
*> (gs
), spc
,
2614 dump_gimple_catch (buffer
, as_a
<gcatch
*> (gs
), spc
, flags
);
2617 case GIMPLE_EH_FILTER
:
2618 dump_gimple_eh_filter (buffer
, as_a
<geh_filter
*> (gs
), spc
, flags
);
2621 case GIMPLE_EH_MUST_NOT_THROW
:
2622 dump_gimple_eh_must_not_throw (buffer
,
2623 as_a
<geh_mnt
*> (gs
),
2627 case GIMPLE_EH_ELSE
:
2628 dump_gimple_eh_else (buffer
, as_a
<geh_else
*> (gs
), spc
, flags
);
2632 dump_gimple_resx (buffer
, as_a
<gresx
*> (gs
), spc
, flags
);
2635 case GIMPLE_EH_DISPATCH
:
2636 dump_gimple_eh_dispatch (buffer
, as_a
<geh_dispatch
*> (gs
), spc
,
2641 dump_gimple_debug (buffer
, as_a
<gdebug
*> (gs
), spc
, flags
);
2644 case GIMPLE_PREDICT
:
2645 pp_string (buffer
, "// predicted ");
2646 if (gimple_predict_outcome (gs
))
2647 pp_string (buffer
, "likely by ");
2649 pp_string (buffer
, "unlikely by ");
2650 pp_string (buffer
, predictor_name (gimple_predict_predictor (gs
)));
2651 pp_string (buffer
, " predictor.");
2654 case GIMPLE_TRANSACTION
:
2655 dump_gimple_transaction (buffer
, as_a
<gtransaction
*> (gs
), spc
,
2665 /* Dumps header of basic block BB to OUTF indented by INDENT
2666 spaces and details described by flags. */
2669 dump_gimple_bb_header (FILE *outf
, basic_block bb
, int indent
,
2672 if (flags
& TDF_BLOCKS
)
2674 if (flags
& TDF_LINENO
)
2676 gimple_stmt_iterator gsi
;
2678 fputs (";; ", outf
);
2680 for (gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
); gsi_next (&gsi
))
2681 if (!is_gimple_debug (gsi_stmt (gsi
))
2682 && get_lineno (gsi_stmt (gsi
)) != UNKNOWN_LOCATION
)
2684 fprintf (outf
, "%*sstarting at line %d",
2685 indent
, "", get_lineno (gsi_stmt (gsi
)));
2688 if (bb
->discriminator
)
2689 fprintf (outf
, ", discriminator %i", bb
->discriminator
);
2695 if (flags
& TDF_GIMPLE
)
2696 fprintf (outf
, "%*sbb_%d:\n", indent
, "", bb
->index
);
2698 fprintf (outf
, "%*s<bb %d> %s:\n",
2699 indent
, "", bb
->index
, dump_profile (bb
->frequency
,
2705 /* Dumps end of basic block BB to buffer BUFFER indented by INDENT
2709 dump_gimple_bb_footer (FILE *outf ATTRIBUTE_UNUSED
,
2710 basic_block bb ATTRIBUTE_UNUSED
,
2711 int indent ATTRIBUTE_UNUSED
,
2712 dump_flags_t flags ATTRIBUTE_UNUSED
)
2714 /* There is currently no GIMPLE-specific basic block info to dump. */
2719 /* Dump PHI nodes of basic block BB to BUFFER with details described
2720 by FLAGS and indented by INDENT spaces. */
2723 dump_phi_nodes (pretty_printer
*buffer
, basic_block bb
, int indent
,
2728 for (i
= gsi_start_phis (bb
); !gsi_end_p (i
); gsi_next (&i
))
2730 gphi
*phi
= i
.phi ();
2731 if (!virtual_operand_p (gimple_phi_result (phi
)) || (flags
& TDF_VOPS
))
2734 dump_gimple_phi (buffer
, phi
, indent
,
2735 (flags
& TDF_GIMPLE
) ? false : true, flags
);
2736 pp_newline (buffer
);
2742 /* Dump jump to basic block BB that is represented implicitly in the cfg
2746 pp_cfg_jump (pretty_printer
*buffer
, edge e
, dump_flags_t flags
)
2748 if (flags
& TDF_GIMPLE
)
2750 pp_string (buffer
, "goto bb_");
2751 pp_decimal_int (buffer
, e
->dest
->index
);
2752 pp_semicolon (buffer
);
2756 pp_string (buffer
, "goto <bb ");
2757 pp_decimal_int (buffer
, e
->dest
->index
);
2758 pp_greater (buffer
);
2759 pp_semicolon (buffer
);
2761 dump_edge_probability (buffer
, e
);
2766 /* Dump edges represented implicitly in basic block BB to BUFFER, indented
2767 by INDENT spaces, with details given by FLAGS. */
2770 dump_implicit_edges (pretty_printer
*buffer
, basic_block bb
, int indent
,
2776 stmt
= last_stmt (bb
);
2778 if (stmt
&& gimple_code (stmt
) == GIMPLE_COND
)
2780 edge true_edge
, false_edge
;
2782 /* When we are emitting the code or changing CFG, it is possible that
2783 the edges are not yet created. When we are using debug_bb in such
2784 a situation, we do not want it to crash. */
2785 if (EDGE_COUNT (bb
->succs
) != 2)
2787 extract_true_false_edges_from_block (bb
, &true_edge
, &false_edge
);
2789 INDENT (indent
+ 2);
2790 pp_cfg_jump (buffer
, true_edge
, flags
);
2791 newline_and_indent (buffer
, indent
);
2792 pp_string (buffer
, "else");
2793 newline_and_indent (buffer
, indent
+ 2);
2794 pp_cfg_jump (buffer
, false_edge
, flags
);
2795 pp_newline (buffer
);
2799 /* If there is a fallthru edge, we may need to add an artificial
2800 goto to the dump. */
2801 e
= find_fallthru_edge (bb
->succs
);
2803 if (e
&& e
->dest
!= bb
->next_bb
)
2807 if ((flags
& TDF_LINENO
)
2808 && e
->goto_locus
!= UNKNOWN_LOCATION
)
2809 dump_location (buffer
, e
->goto_locus
);
2811 pp_cfg_jump (buffer
, e
, flags
);
2812 pp_newline (buffer
);
2817 /* Dumps basic block BB to buffer BUFFER with details described by FLAGS and
2818 indented by INDENT spaces. */
2821 gimple_dump_bb_buff (pretty_printer
*buffer
, basic_block bb
, int indent
,
2824 gimple_stmt_iterator gsi
;
2826 int label_indent
= indent
- 2;
2828 if (label_indent
< 0)
2831 dump_phi_nodes (buffer
, bb
, indent
, flags
);
2833 for (gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
); gsi_next (&gsi
))
2837 stmt
= gsi_stmt (gsi
);
2839 curr_indent
= gimple_code (stmt
) == GIMPLE_LABEL
? label_indent
: indent
;
2841 INDENT (curr_indent
);
2842 pp_gimple_stmt_1 (buffer
, stmt
, curr_indent
, flags
);
2843 pp_newline_and_flush (buffer
);
2844 gcc_checking_assert (DECL_STRUCT_FUNCTION (current_function_decl
));
2845 dump_histograms_for_stmt (DECL_STRUCT_FUNCTION (current_function_decl
),
2846 pp_buffer (buffer
)->stream
, stmt
);
2849 dump_implicit_edges (buffer
, bb
, indent
, flags
);
2854 /* Dumps basic block BB to FILE with details described by FLAGS and
2855 indented by INDENT spaces. */
2858 gimple_dump_bb (FILE *file
, basic_block bb
, int indent
, dump_flags_t flags
)
2860 dump_gimple_bb_header (file
, bb
, indent
, flags
);
2861 if (bb
->index
>= NUM_FIXED_BLOCKS
)
2863 pretty_printer buffer
;
2864 pp_needs_newline (&buffer
) = true;
2865 buffer
.buffer
->stream
= file
;
2866 gimple_dump_bb_buff (&buffer
, bb
, indent
, flags
);
2868 dump_gimple_bb_footer (file
, bb
, indent
, flags
);
2871 /* Dumps basic block BB to pretty-printer PP with default dump flags and
2872 no indentation, for use as a label of a DOT graph record-node.
2873 ??? Should just use gimple_dump_bb_buff here, except that value profiling
2874 histogram dumping doesn't know about pretty-printers. */
2877 gimple_dump_bb_for_graph (pretty_printer
*pp
, basic_block bb
)
2879 pp_printf (pp
, "<bb %d>:\n", bb
->index
);
2880 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
2882 for (gphi_iterator gsi
= gsi_start_phis (bb
); !gsi_end_p (gsi
);
2885 gphi
*phi
= gsi
.phi ();
2886 if (!virtual_operand_p (gimple_phi_result (phi
))
2887 || (dump_flags
& TDF_VOPS
))
2890 pp_write_text_to_stream (pp
);
2891 pp_string (pp
, "# ");
2892 pp_gimple_stmt_1 (pp
, phi
, 0, dump_flags
);
2894 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
2898 for (gimple_stmt_iterator gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
);
2901 gimple
*stmt
= gsi_stmt (gsi
);
2903 pp_write_text_to_stream (pp
);
2904 pp_gimple_stmt_1 (pp
, stmt
, 0, dump_flags
);
2906 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
2908 dump_implicit_edges (pp
, bb
, 0, dump_flags
);
2909 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);