1 /* Pretty formatting of GIMPLE statements and expressions.
2 Copyright (C) 2001-2016 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"
28 #include "gimple-predict.h"
31 #include "gimple-pretty-print.h"
32 #include "internal-fn.h"
34 #include "gimple-iterator.h"
36 #include "dumpfile.h" /* for dump_flags */
37 #include "value-prof.h"
38 #include "trans-mem.h"
42 #define INDENT(SPACE) \
43 do { int i; for (i = 0; i < SPACE; i++) pp_space (buffer); } while (0)
45 #define GIMPLE_NIY do_niy (buffer,gs)
47 /* Try to print on BUFFER a default message for the unrecognized
48 gimple statement GS. */
51 do_niy (pretty_printer
*buffer
, gimple
*gs
)
53 pp_printf (buffer
, "<<< Unknown GIMPLE statement: %s >>>\n",
54 gimple_code_name
[(int) gimple_code (gs
)]);
58 /* Emit a newline and SPC indentation spaces to BUFFER. */
61 newline_and_indent (pretty_printer
*buffer
, int spc
)
68 /* Print the GIMPLE statement GS on stderr. */
71 debug_gimple_stmt (gimple
*gs
)
73 print_gimple_stmt (stderr
, gs
, 0, TDF_VOPS
|TDF_MEMSYMS
);
77 /* Return formatted string of a VALUE probability
78 (biased by REG_BR_PROB_BASE). Returned string is allocated
79 by xstrdup_for_dump. */
82 dump_probability (int value
)
84 float minimum
= 0.01f
;
86 gcc_assert (0 <= value
&& value
<= REG_BR_PROB_BASE
);
87 float fvalue
= value
* 100.0f
/ REG_BR_PROB_BASE
;
88 if (fvalue
< minimum
&& value
> 0)
92 asprintf (&buf
, "[%.2f%%]", fvalue
);
93 const char *ret
= xstrdup_for_dump (buf
);
99 /* Dump E probability to BUFFER. */
102 dump_edge_probability (pretty_printer
*buffer
, edge e
)
104 pp_scalar (buffer
, " %s", dump_probability (e
->probability
));
107 /* Print GIMPLE statement G to FILE using SPC indentation spaces and
108 FLAGS as in pp_gimple_stmt_1. */
111 print_gimple_stmt (FILE *file
, gimple
*g
, int spc
, int flags
)
113 pretty_printer buffer
;
114 pp_needs_newline (&buffer
) = true;
115 buffer
.buffer
->stream
= file
;
116 pp_gimple_stmt_1 (&buffer
, g
, spc
, flags
);
117 pp_newline_and_flush (&buffer
);
123 print_gimple_stmt (stderr
, &ref
, 0, 0);
132 fprintf (stderr
, "<nil>\n");
136 /* Print GIMPLE statement G to FILE using SPC indentation spaces and
137 FLAGS as in pp_gimple_stmt_1. Print only the right-hand side
141 print_gimple_expr (FILE *file
, gimple
*g
, int spc
, int flags
)
143 flags
|= TDF_RHS_ONLY
;
144 pretty_printer buffer
;
145 pp_needs_newline (&buffer
) = true;
146 buffer
.buffer
->stream
= file
;
147 pp_gimple_stmt_1 (&buffer
, g
, spc
, flags
);
152 /* Print the GIMPLE sequence SEQ on BUFFER using SPC indentation
153 spaces and FLAGS as in pp_gimple_stmt_1.
154 The caller is responsible for calling pp_flush on BUFFER to finalize
155 the pretty printer. */
158 dump_gimple_seq (pretty_printer
*buffer
, gimple_seq seq
, int spc
, int flags
)
160 gimple_stmt_iterator i
;
162 for (i
= gsi_start (seq
); !gsi_end_p (i
); gsi_next (&i
))
164 gimple
*gs
= gsi_stmt (i
);
166 pp_gimple_stmt_1 (buffer
, gs
, spc
, flags
);
167 if (!gsi_one_before_end_p (i
))
173 /* Print GIMPLE sequence SEQ to FILE using SPC indentation spaces and
174 FLAGS as in pp_gimple_stmt_1. */
177 print_gimple_seq (FILE *file
, gimple_seq seq
, int spc
, int flags
)
179 pretty_printer buffer
;
180 pp_needs_newline (&buffer
) = true;
181 buffer
.buffer
->stream
= file
;
182 dump_gimple_seq (&buffer
, seq
, spc
, flags
);
183 pp_newline_and_flush (&buffer
);
187 /* Print the GIMPLE sequence SEQ on stderr. */
190 debug_gimple_seq (gimple_seq seq
)
192 print_gimple_seq (stderr
, seq
, 0, TDF_VOPS
|TDF_MEMSYMS
);
196 /* A simple helper to pretty-print some of the gimple tuples in the printf
197 style. The format modifiers are preceded by '%' and are:
198 'G' - outputs a string corresponding to the code of the given gimple,
199 'S' - outputs a gimple_seq with indent of spc + 2,
200 'T' - outputs the tree t,
201 'd' - outputs an int as a decimal,
202 's' - outputs a string,
203 'n' - outputs a newline,
204 'x' - outputs an int as hexadecimal,
205 '+' - increases indent by 2 then outputs a newline,
206 '-' - decreases indent by 2 then outputs a newline. */
209 dump_gimple_fmt (pretty_printer
*buffer
, int spc
, int flags
,
210 const char *fmt
, ...)
216 va_start (args
, fmt
);
217 for (c
= fmt
; *c
; c
++)
227 g
= va_arg (args
, gimple
*);
228 tmp
= gimple_code_name
[gimple_code (g
)];
229 pp_string (buffer
, tmp
);
233 seq
= va_arg (args
, gimple_seq
);
235 dump_gimple_seq (buffer
, seq
, spc
+ 2, flags
);
236 newline_and_indent (buffer
, spc
);
240 t
= va_arg (args
, tree
);
242 pp_string (buffer
, "NULL");
244 dump_generic_node (buffer
, t
, spc
, flags
, false);
248 pp_decimal_int (buffer
, va_arg (args
, int));
252 pp_string (buffer
, va_arg (args
, char *));
256 newline_and_indent (buffer
, spc
);
260 pp_scalar (buffer
, "%x", va_arg (args
, int));
265 newline_and_indent (buffer
, spc
);
270 newline_and_indent (buffer
, spc
);
278 pp_character (buffer
, *c
);
284 /* Helper for dump_gimple_assign. Print the unary RHS of the
285 assignment GS. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. */
288 dump_unary_rhs (pretty_printer
*buffer
, gassign
*gs
, int spc
, int flags
)
290 enum tree_code rhs_code
= gimple_assign_rhs_code (gs
);
291 tree lhs
= gimple_assign_lhs (gs
);
292 tree rhs
= gimple_assign_rhs1 (gs
);
296 case VIEW_CONVERT_EXPR
:
298 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
301 case FIXED_CONVERT_EXPR
:
302 case ADDR_SPACE_CONVERT_EXPR
:
306 pp_left_paren (buffer
);
307 dump_generic_node (buffer
, TREE_TYPE (lhs
), spc
, flags
, false);
308 pp_string (buffer
, ") ");
309 if (op_prio (rhs
) < op_code_prio (rhs_code
))
311 pp_left_paren (buffer
);
312 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
313 pp_right_paren (buffer
);
316 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
320 pp_string (buffer
, "((");
321 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
322 pp_string (buffer
, "))");
326 pp_string (buffer
, "ABS_EXPR <");
327 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
332 if (TREE_CODE_CLASS (rhs_code
) == tcc_declaration
333 || TREE_CODE_CLASS (rhs_code
) == tcc_constant
334 || TREE_CODE_CLASS (rhs_code
) == tcc_reference
335 || rhs_code
== SSA_NAME
336 || rhs_code
== ADDR_EXPR
337 || rhs_code
== CONSTRUCTOR
)
339 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
342 else if (rhs_code
== BIT_NOT_EXPR
)
343 pp_complement (buffer
);
344 else if (rhs_code
== TRUTH_NOT_EXPR
)
345 pp_exclamation (buffer
);
346 else if (rhs_code
== NEGATE_EXPR
)
350 pp_left_bracket (buffer
);
351 pp_string (buffer
, get_tree_code_name (rhs_code
));
352 pp_string (buffer
, "] ");
355 if (op_prio (rhs
) < op_code_prio (rhs_code
))
357 pp_left_paren (buffer
);
358 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
359 pp_right_paren (buffer
);
362 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
368 /* Helper for dump_gimple_assign. Print the binary RHS of the
369 assignment GS. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. */
372 dump_binary_rhs (pretty_printer
*buffer
, gassign
*gs
, int spc
, int flags
)
375 enum tree_code code
= gimple_assign_rhs_code (gs
);
381 case VEC_WIDEN_MULT_HI_EXPR
:
382 case VEC_WIDEN_MULT_LO_EXPR
:
383 case VEC_WIDEN_MULT_EVEN_EXPR
:
384 case VEC_WIDEN_MULT_ODD_EXPR
:
385 case VEC_PACK_TRUNC_EXPR
:
386 case VEC_PACK_SAT_EXPR
:
387 case VEC_PACK_FIX_TRUNC_EXPR
:
388 case VEC_WIDEN_LSHIFT_HI_EXPR
:
389 case VEC_WIDEN_LSHIFT_LO_EXPR
:
390 for (p
= get_tree_code_name (code
); *p
; p
++)
391 pp_character (buffer
, TOUPPER (*p
));
392 pp_string (buffer
, " <");
393 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
394 pp_string (buffer
, ", ");
395 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
400 if (op_prio (gimple_assign_rhs1 (gs
)) <= op_code_prio (code
))
402 pp_left_paren (buffer
);
403 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
,
405 pp_right_paren (buffer
);
408 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
410 pp_string (buffer
, op_symbol_code (gimple_assign_rhs_code (gs
)));
412 if (op_prio (gimple_assign_rhs2 (gs
)) <= op_code_prio (code
))
414 pp_left_paren (buffer
);
415 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
,
417 pp_right_paren (buffer
);
420 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
424 /* Helper for dump_gimple_assign. Print the ternary RHS of the
425 assignment GS. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. */
428 dump_ternary_rhs (pretty_printer
*buffer
, gassign
*gs
, int spc
, int flags
)
431 enum tree_code code
= gimple_assign_rhs_code (gs
);
434 case WIDEN_MULT_PLUS_EXPR
:
435 case WIDEN_MULT_MINUS_EXPR
:
436 for (p
= get_tree_code_name (code
); *p
; p
++)
437 pp_character (buffer
, TOUPPER (*p
));
438 pp_string (buffer
, " <");
439 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
440 pp_string (buffer
, ", ");
441 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
442 pp_string (buffer
, ", ");
443 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
448 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
449 pp_string (buffer
, " * ");
450 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
451 pp_string (buffer
, " + ");
452 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
456 pp_string (buffer
, "DOT_PROD_EXPR <");
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 pp_string (buffer
, "SAD_EXPR <");
467 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
468 pp_string (buffer
, ", ");
469 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
470 pp_string (buffer
, ", ");
471 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
476 pp_string (buffer
, "VEC_PERM_EXPR <");
477 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
478 pp_string (buffer
, ", ");
479 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
480 pp_string (buffer
, ", ");
481 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
485 case REALIGN_LOAD_EXPR
:
486 pp_string (buffer
, "REALIGN_LOAD <");
487 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
488 pp_string (buffer
, ", ");
489 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
490 pp_string (buffer
, ", ");
491 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
496 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
497 pp_string (buffer
, " ? ");
498 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
499 pp_string (buffer
, " : ");
500 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
504 pp_string (buffer
, "VEC_COND_EXPR <");
505 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
506 pp_string (buffer
, ", ");
507 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
508 pp_string (buffer
, ", ");
509 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
513 case BIT_INSERT_EXPR
:
514 pp_string (buffer
, "BIT_INSERT_EXPR <");
515 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
516 pp_string (buffer
, ", ");
517 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
518 pp_string (buffer
, ", ");
519 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
520 pp_string (buffer
, " (");
521 if (INTEGRAL_TYPE_P (TREE_TYPE (gimple_assign_rhs2 (gs
))))
522 pp_decimal_int (buffer
,
523 TYPE_PRECISION (TREE_TYPE (gimple_assign_rhs2 (gs
))));
525 dump_generic_node (buffer
,
526 TYPE_SIZE (TREE_TYPE (gimple_assign_rhs2 (gs
))),
528 pp_string (buffer
, " bits)>");
537 /* Dump the gimple assignment GS. BUFFER, SPC and FLAGS are as in
541 dump_gimple_assign (pretty_printer
*buffer
, gassign
*gs
, int spc
, int flags
)
548 switch (gimple_num_ops (gs
))
551 arg3
= gimple_assign_rhs3 (gs
);
554 arg2
= gimple_assign_rhs2 (gs
);
557 arg1
= gimple_assign_rhs1 (gs
);
563 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%s, %T, %T, %T, %T>", gs
,
564 get_tree_code_name (gimple_assign_rhs_code (gs
)),
565 gimple_assign_lhs (gs
), arg1
, arg2
, arg3
);
569 if (!(flags
& TDF_RHS_ONLY
))
571 dump_generic_node (buffer
, gimple_assign_lhs (gs
), spc
, flags
, false);
575 if (gimple_assign_nontemporal_move_p (gs
))
576 pp_string (buffer
, "{nt}");
578 if (gimple_has_volatile_ops (gs
))
579 pp_string (buffer
, "{v}");
584 if (gimple_num_ops (gs
) == 2)
585 dump_unary_rhs (buffer
, gs
, spc
, flags
);
586 else if (gimple_num_ops (gs
) == 3)
587 dump_binary_rhs (buffer
, gs
, spc
, flags
);
588 else if (gimple_num_ops (gs
) == 4)
589 dump_ternary_rhs (buffer
, gs
, spc
, flags
);
592 if (!(flags
& TDF_RHS_ONLY
))
593 pp_semicolon (buffer
);
598 /* Dump the return statement GS. BUFFER, SPC and FLAGS are as in
602 dump_gimple_return (pretty_printer
*buffer
, greturn
*gs
, int spc
, int flags
)
606 t
= gimple_return_retval (gs
);
607 t2
= gimple_return_retbnd (gs
);
609 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T %T>", gs
, t
, t2
);
612 pp_string (buffer
, "return");
616 dump_generic_node (buffer
, t
, spc
, flags
, false);
620 pp_string (buffer
, ", ");
621 dump_generic_node (buffer
, t2
, spc
, flags
, false);
623 pp_semicolon (buffer
);
628 /* Dump the call arguments for a gimple call. BUFFER, FLAGS are as in
632 dump_gimple_call_args (pretty_printer
*buffer
, gcall
*gs
, int flags
)
636 /* Pretty print first arg to certain internal fns. */
637 if (gimple_call_internal_p (gs
))
639 const char *const *enums
= NULL
;
642 switch (gimple_call_internal_fn (gs
))
646 static const char *const unique_args
[] = {IFN_UNIQUE_CODES
};
650 limit
= ARRAY_SIZE (unique_args
);
655 static const char *const loop_args
[] = {IFN_GOACC_LOOP_CODES
};
658 limit
= ARRAY_SIZE (loop_args
);
661 case IFN_GOACC_REDUCTION
:
663 static const char *const reduction_args
[]
664 = {IFN_GOACC_REDUCTION_CODES
};
666 enums
= reduction_args
;
667 limit
= ARRAY_SIZE (reduction_args
);
672 static const char *const asan_mark_args
[] = {IFN_ASAN_MARK_FLAGS
};
674 enums
= asan_mark_args
;
675 limit
= ARRAY_SIZE (asan_mark_args
);
683 tree arg0
= gimple_call_arg (gs
, 0);
686 if (TREE_CODE (arg0
) == INTEGER_CST
687 && tree_fits_shwi_p (arg0
)
688 && (v
= tree_to_shwi (arg0
)) >= 0 && v
< limit
)
691 pp_string (buffer
, enums
[v
]);
696 for (; i
< gimple_call_num_args (gs
); i
++)
699 pp_string (buffer
, ", ");
700 dump_generic_node (buffer
, gimple_call_arg (gs
, i
), 0, flags
, false);
703 if (gimple_call_va_arg_pack_p (gs
))
706 pp_string (buffer
, ", ");
708 pp_string (buffer
, "__builtin_va_arg_pack ()");
712 /* Dump the points-to solution *PT to BUFFER. */
715 pp_points_to_solution (pretty_printer
*buffer
, struct pt_solution
*pt
)
719 pp_string (buffer
, "anything ");
723 pp_string (buffer
, "nonlocal ");
725 pp_string (buffer
, "escaped ");
727 pp_string (buffer
, "unit-escaped ");
729 pp_string (buffer
, "null ");
731 && !bitmap_empty_p (pt
->vars
))
735 pp_string (buffer
, "{ ");
736 EXECUTE_IF_SET_IN_BITMAP (pt
->vars
, 0, i
, bi
)
738 pp_string (buffer
, "D.");
739 pp_decimal_int (buffer
, i
);
742 pp_right_brace (buffer
);
743 if (pt
->vars_contains_nonlocal
744 || pt
->vars_contains_escaped
745 || pt
->vars_contains_escaped_heap
746 || pt
->vars_contains_restrict
)
748 const char *comma
= "";
749 pp_string (buffer
, " (");
750 if (pt
->vars_contains_nonlocal
)
752 pp_string (buffer
, "nonlocal");
755 if (pt
->vars_contains_escaped
)
757 pp_string (buffer
, comma
);
758 pp_string (buffer
, "escaped");
761 if (pt
->vars_contains_escaped_heap
)
763 pp_string (buffer
, comma
);
764 pp_string (buffer
, "escaped heap");
767 if (pt
->vars_contains_restrict
)
769 pp_string (buffer
, comma
);
770 pp_string (buffer
, "restrict");
773 if (pt
->vars_contains_interposable
)
775 pp_string (buffer
, comma
);
776 pp_string (buffer
, "interposable");
778 pp_string (buffer
, ")");
784 /* Dump the call statement GS. BUFFER, SPC and FLAGS are as in
788 dump_gimple_call (pretty_printer
*buffer
, gcall
*gs
, int spc
, int flags
)
790 tree lhs
= gimple_call_lhs (gs
);
791 tree fn
= gimple_call_fn (gs
);
793 if (flags
& TDF_ALIAS
)
795 struct pt_solution
*pt
;
796 pt
= gimple_call_use_set (gs
);
797 if (!pt_solution_empty_p (pt
))
799 pp_string (buffer
, "# USE = ");
800 pp_points_to_solution (buffer
, pt
);
801 newline_and_indent (buffer
, spc
);
803 pt
= gimple_call_clobber_set (gs
);
804 if (!pt_solution_empty_p (pt
))
806 pp_string (buffer
, "# CLB = ");
807 pp_points_to_solution (buffer
, pt
);
808 newline_and_indent (buffer
, spc
);
814 if (gimple_call_internal_p (gs
))
815 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%s, %T", gs
,
816 internal_fn_name (gimple_call_internal_fn (gs
)), lhs
);
818 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T", gs
, fn
, lhs
);
819 if (gimple_call_num_args (gs
) > 0)
821 pp_string (buffer
, ", ");
822 dump_gimple_call_args (buffer
, gs
, flags
);
828 if (lhs
&& !(flags
& TDF_RHS_ONLY
))
830 dump_generic_node (buffer
, lhs
, spc
, flags
, false);
831 pp_string (buffer
, " =");
833 if (gimple_has_volatile_ops (gs
))
834 pp_string (buffer
, "{v}");
838 if (gimple_call_internal_p (gs
))
839 pp_string (buffer
, internal_fn_name (gimple_call_internal_fn (gs
)));
841 print_call_name (buffer
, fn
, flags
);
842 pp_string (buffer
, " (");
843 dump_gimple_call_args (buffer
, gs
, flags
);
844 pp_right_paren (buffer
);
845 if (!(flags
& TDF_RHS_ONLY
))
846 pp_semicolon (buffer
);
849 if (gimple_call_chain (gs
))
851 pp_string (buffer
, " [static-chain: ");
852 dump_generic_node (buffer
, gimple_call_chain (gs
), spc
, flags
, false);
853 pp_right_bracket (buffer
);
856 if (gimple_call_return_slot_opt_p (gs
))
857 pp_string (buffer
, " [return slot optimization]");
858 if (gimple_call_tail_p (gs
))
859 pp_string (buffer
, " [tail call]");
860 if (gimple_call_must_tail_p (gs
))
861 pp_string (buffer
, " [must tail call]");
866 /* Dump the arguments of _ITM_beginTransaction sanely. */
867 if (TREE_CODE (fn
) == ADDR_EXPR
)
868 fn
= TREE_OPERAND (fn
, 0);
869 if (TREE_CODE (fn
) == FUNCTION_DECL
&& decl_is_tm_clone (fn
))
870 pp_string (buffer
, " [tm-clone]");
871 if (TREE_CODE (fn
) == FUNCTION_DECL
872 && DECL_BUILT_IN_CLASS (fn
) == BUILT_IN_NORMAL
873 && DECL_FUNCTION_CODE (fn
) == BUILT_IN_TM_START
874 && gimple_call_num_args (gs
) > 0)
876 tree t
= gimple_call_arg (gs
, 0);
877 unsigned HOST_WIDE_INT props
;
878 gcc_assert (TREE_CODE (t
) == INTEGER_CST
);
880 pp_string (buffer
, " [ ");
882 /* Get the transaction code properties. */
883 props
= TREE_INT_CST_LOW (t
);
885 if (props
& PR_INSTRUMENTEDCODE
)
886 pp_string (buffer
, "instrumentedCode ");
887 if (props
& PR_UNINSTRUMENTEDCODE
)
888 pp_string (buffer
, "uninstrumentedCode ");
889 if (props
& PR_HASNOXMMUPDATE
)
890 pp_string (buffer
, "hasNoXMMUpdate ");
891 if (props
& PR_HASNOABORT
)
892 pp_string (buffer
, "hasNoAbort ");
893 if (props
& PR_HASNOIRREVOCABLE
)
894 pp_string (buffer
, "hasNoIrrevocable ");
895 if (props
& PR_DOESGOIRREVOCABLE
)
896 pp_string (buffer
, "doesGoIrrevocable ");
897 if (props
& PR_HASNOSIMPLEREADS
)
898 pp_string (buffer
, "hasNoSimpleReads ");
899 if (props
& PR_AWBARRIERSOMITTED
)
900 pp_string (buffer
, "awBarriersOmitted ");
901 if (props
& PR_RARBARRIERSOMITTED
)
902 pp_string (buffer
, "RaRBarriersOmitted ");
903 if (props
& PR_UNDOLOGCODE
)
904 pp_string (buffer
, "undoLogCode ");
905 if (props
& PR_PREFERUNINSTRUMENTED
)
906 pp_string (buffer
, "preferUninstrumented ");
907 if (props
& PR_EXCEPTIONBLOCK
)
908 pp_string (buffer
, "exceptionBlock ");
909 if (props
& PR_HASELSE
)
910 pp_string (buffer
, "hasElse ");
911 if (props
& PR_READONLY
)
912 pp_string (buffer
, "readOnly ");
914 pp_right_bracket (buffer
);
919 /* Dump the switch statement GS. BUFFER, SPC and FLAGS are as in
923 dump_gimple_switch (pretty_printer
*buffer
, gswitch
*gs
, int spc
,
928 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
930 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, ", gs
,
931 gimple_switch_index (gs
));
934 pp_string (buffer
, "switch (");
935 dump_generic_node (buffer
, gimple_switch_index (gs
), spc
, flags
, true);
936 if (flags
& TDF_GIMPLE
)
937 pp_string (buffer
, ") {");
939 pp_string (buffer
, ") <");
942 for (i
= 0; i
< gimple_switch_num_labels (gs
); i
++)
944 tree case_label
= gimple_switch_label (gs
, i
);
945 gcc_checking_assert (case_label
!= NULL_TREE
);
946 dump_generic_node (buffer
, case_label
, spc
, flags
, false);
948 tree label
= CASE_LABEL (case_label
);
949 dump_generic_node (buffer
, label
, spc
, flags
, false);
951 if (cfun
&& cfun
->cfg
)
953 basic_block dest
= label_to_block (label
);
956 edge label_edge
= find_edge (gimple_bb (gs
), dest
);
957 if (label_edge
&& !(flags
& TDF_GIMPLE
))
958 dump_edge_probability (buffer
, label_edge
);
962 if (i
< gimple_switch_num_labels (gs
) - 1)
964 if (flags
& TDF_GIMPLE
)
965 pp_string (buffer
, "; ");
967 pp_string (buffer
, ", ");
970 if (flags
& TDF_GIMPLE
)
971 pp_string (buffer
, "; }");
977 /* Dump the gimple conditional GS. BUFFER, SPC and FLAGS are as in
981 dump_gimple_cond (pretty_printer
*buffer
, gcond
*gs
, int spc
, int flags
)
984 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%s, %T, %T, %T, %T>", gs
,
985 get_tree_code_name (gimple_cond_code (gs
)),
986 gimple_cond_lhs (gs
), gimple_cond_rhs (gs
),
987 gimple_cond_true_label (gs
), gimple_cond_false_label (gs
));
990 if (!(flags
& TDF_RHS_ONLY
))
991 pp_string (buffer
, "if (");
992 dump_generic_node (buffer
, gimple_cond_lhs (gs
), spc
, flags
, false);
994 pp_string (buffer
, op_symbol_code (gimple_cond_code (gs
)));
996 dump_generic_node (buffer
, gimple_cond_rhs (gs
), spc
, flags
, false);
997 if (!(flags
& TDF_RHS_ONLY
))
1000 edge e
, true_edge
= NULL
, false_edge
= NULL
;
1001 basic_block bb
= gimple_bb (gs
);
1005 FOR_EACH_EDGE (e
, ei
, bb
->succs
)
1007 if (e
->flags
& EDGE_TRUE_VALUE
)
1009 else if (e
->flags
& EDGE_FALSE_VALUE
)
1014 bool has_edge_info
= true_edge
!= NULL
&& false_edge
!= NULL
;
1016 pp_right_paren (buffer
);
1018 if (gimple_cond_true_label (gs
))
1020 pp_string (buffer
, " goto ");
1021 dump_generic_node (buffer
, gimple_cond_true_label (gs
),
1023 if (has_edge_info
&& !(flags
& TDF_GIMPLE
))
1024 dump_edge_probability (buffer
, true_edge
);
1025 pp_semicolon (buffer
);
1027 if (gimple_cond_false_label (gs
))
1029 pp_string (buffer
, " else goto ");
1030 dump_generic_node (buffer
, gimple_cond_false_label (gs
),
1032 if (has_edge_info
&& !(flags
& TDF_GIMPLE
))
1033 dump_edge_probability (buffer
, false_edge
);
1035 pp_semicolon (buffer
);
1042 /* Dump a GIMPLE_LABEL tuple on the pretty_printer BUFFER, SPC
1043 spaces of indent. FLAGS specifies details to show in the dump (see
1044 TDF_* in dumpfils.h). */
1047 dump_gimple_label (pretty_printer
*buffer
, glabel
*gs
, int spc
, int flags
)
1049 tree label
= gimple_label_label (gs
);
1050 if (flags
& TDF_RAW
)
1051 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
, label
);
1054 dump_generic_node (buffer
, label
, spc
, flags
, false);
1055 basic_block bb
= gimple_bb (gs
);
1056 if (bb
&& !(flags
& TDF_GIMPLE
))
1057 pp_scalar (buffer
, " %s", dump_probability (bb
->frequency
));
1060 if (flags
& TDF_GIMPLE
)
1062 if (DECL_NONLOCAL (label
))
1063 pp_string (buffer
, " [non-local]");
1064 if ((flags
& TDF_EH
) && EH_LANDING_PAD_NR (label
))
1065 pp_printf (buffer
, " [LP %d]", EH_LANDING_PAD_NR (label
));
1068 /* Dump a GIMPLE_GOTO tuple on the pretty_printer BUFFER, SPC
1069 spaces of indent. FLAGS specifies details to show in the dump (see
1070 TDF_* in dumpfile.h). */
1073 dump_gimple_goto (pretty_printer
*buffer
, ggoto
*gs
, int spc
, int flags
)
1075 tree label
= gimple_goto_dest (gs
);
1076 if (flags
& TDF_RAW
)
1077 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
, label
);
1079 dump_gimple_fmt (buffer
, spc
, flags
, "goto %T;", label
);
1083 /* Dump a GIMPLE_BIND tuple on the pretty_printer BUFFER, SPC
1084 spaces of indent. FLAGS specifies details to show in the dump (see
1085 TDF_* in dumpfile.h). */
1088 dump_gimple_bind (pretty_printer
*buffer
, gbind
*gs
, int spc
, int flags
)
1090 if (flags
& TDF_RAW
)
1091 dump_gimple_fmt (buffer
, spc
, flags
, "%G <", gs
);
1093 pp_left_brace (buffer
);
1094 if (!(flags
& TDF_SLIM
))
1098 for (var
= gimple_bind_vars (gs
); var
; var
= DECL_CHAIN (var
))
1100 newline_and_indent (buffer
, 2);
1101 print_declaration (buffer
, var
, spc
, flags
);
1103 if (gimple_bind_vars (gs
))
1104 pp_newline (buffer
);
1106 pp_newline (buffer
);
1107 dump_gimple_seq (buffer
, gimple_bind_body (gs
), spc
+ 2, flags
);
1108 newline_and_indent (buffer
, spc
);
1109 if (flags
& TDF_RAW
)
1110 pp_greater (buffer
);
1112 pp_right_brace (buffer
);
1116 /* Dump a GIMPLE_TRY tuple on the pretty_printer BUFFER, SPC spaces of
1117 indent. FLAGS specifies details to show in the dump (see TDF_* in
1121 dump_gimple_try (pretty_printer
*buffer
, gtry
*gs
, int spc
, int flags
)
1123 if (flags
& TDF_RAW
)
1126 if (gimple_try_kind (gs
) == GIMPLE_TRY_CATCH
)
1127 type
= "GIMPLE_TRY_CATCH";
1128 else if (gimple_try_kind (gs
) == GIMPLE_TRY_FINALLY
)
1129 type
= "GIMPLE_TRY_FINALLY";
1131 type
= "UNKNOWN GIMPLE_TRY";
1132 dump_gimple_fmt (buffer
, spc
, flags
,
1133 "%G <%s,%+EVAL <%S>%nCLEANUP <%S>%->", gs
, type
,
1134 gimple_try_eval (gs
), gimple_try_cleanup (gs
));
1138 pp_string (buffer
, "try");
1139 newline_and_indent (buffer
, spc
+ 2);
1140 pp_left_brace (buffer
);
1141 pp_newline (buffer
);
1143 dump_gimple_seq (buffer
, gimple_try_eval (gs
), spc
+ 4, flags
);
1144 newline_and_indent (buffer
, spc
+ 2);
1145 pp_right_brace (buffer
);
1147 if (gimple_try_kind (gs
) == GIMPLE_TRY_CATCH
)
1149 newline_and_indent (buffer
, spc
);
1150 pp_string (buffer
, "catch");
1151 newline_and_indent (buffer
, spc
+ 2);
1152 pp_left_brace (buffer
);
1154 else if (gimple_try_kind (gs
) == GIMPLE_TRY_FINALLY
)
1156 newline_and_indent (buffer
, spc
);
1157 pp_string (buffer
, "finally");
1158 newline_and_indent (buffer
, spc
+ 2);
1159 pp_left_brace (buffer
);
1162 pp_string (buffer
, " <UNKNOWN GIMPLE_TRY> {");
1164 pp_newline (buffer
);
1165 dump_gimple_seq (buffer
, gimple_try_cleanup (gs
), spc
+ 4, flags
);
1166 newline_and_indent (buffer
, spc
+ 2);
1167 pp_right_brace (buffer
);
1172 /* Dump a GIMPLE_CATCH tuple on the pretty_printer BUFFER, SPC spaces of
1173 indent. FLAGS specifies details to show in the dump (see TDF_* in
1177 dump_gimple_catch (pretty_printer
*buffer
, gcatch
*gs
, int spc
, int flags
)
1179 if (flags
& TDF_RAW
)
1180 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %+CATCH <%S>%->", gs
,
1181 gimple_catch_types (gs
), gimple_catch_handler (gs
));
1183 dump_gimple_fmt (buffer
, spc
, flags
, "catch (%T)%+{%S}",
1184 gimple_catch_types (gs
), gimple_catch_handler (gs
));
1188 /* Dump a GIMPLE_EH_FILTER tuple on the pretty_printer BUFFER, SPC spaces of
1189 indent. FLAGS specifies details to show in the dump (see TDF_* in
1193 dump_gimple_eh_filter (pretty_printer
*buffer
, geh_filter
*gs
, int spc
,
1196 if (flags
& TDF_RAW
)
1197 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %+FAILURE <%S>%->", gs
,
1198 gimple_eh_filter_types (gs
),
1199 gimple_eh_filter_failure (gs
));
1201 dump_gimple_fmt (buffer
, spc
, flags
, "<<<eh_filter (%T)>>>%+{%+%S%-}",
1202 gimple_eh_filter_types (gs
),
1203 gimple_eh_filter_failure (gs
));
1207 /* Dump a GIMPLE_EH_MUST_NOT_THROW tuple. */
1210 dump_gimple_eh_must_not_throw (pretty_printer
*buffer
,
1211 geh_mnt
*gs
, int spc
, int flags
)
1213 if (flags
& TDF_RAW
)
1214 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
,
1215 gimple_eh_must_not_throw_fndecl (gs
));
1217 dump_gimple_fmt (buffer
, spc
, flags
, "<<<eh_must_not_throw (%T)>>>",
1218 gimple_eh_must_not_throw_fndecl (gs
));
1222 /* Dump a GIMPLE_EH_ELSE tuple on the pretty_printer BUFFER, SPC spaces of
1223 indent. FLAGS specifies details to show in the dump (see TDF_* in
1227 dump_gimple_eh_else (pretty_printer
*buffer
, geh_else
*gs
, int spc
,
1230 if (flags
& TDF_RAW
)
1231 dump_gimple_fmt (buffer
, spc
, flags
,
1232 "%G <%+N_BODY <%S>%nE_BODY <%S>%->", gs
,
1233 gimple_eh_else_n_body (gs
), gimple_eh_else_e_body (gs
));
1235 dump_gimple_fmt (buffer
, spc
, flags
,
1236 "<<<if_normal_exit>>>%+{%S}%-<<<else_eh_exit>>>%+{%S}",
1237 gimple_eh_else_n_body (gs
), gimple_eh_else_e_body (gs
));
1241 /* Dump a GIMPLE_RESX tuple on the pretty_printer BUFFER, SPC spaces of
1242 indent. FLAGS specifies details to show in the dump (see TDF_* in
1246 dump_gimple_resx (pretty_printer
*buffer
, gresx
*gs
, int spc
, int flags
)
1248 if (flags
& TDF_RAW
)
1249 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%d>", gs
,
1250 gimple_resx_region (gs
));
1252 dump_gimple_fmt (buffer
, spc
, flags
, "resx %d", gimple_resx_region (gs
));
1255 /* Dump a GIMPLE_EH_DISPATCH tuple on the pretty_printer BUFFER. */
1258 dump_gimple_eh_dispatch (pretty_printer
*buffer
, geh_dispatch
*gs
, int spc
, int flags
)
1260 if (flags
& TDF_RAW
)
1261 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%d>", gs
,
1262 gimple_eh_dispatch_region (gs
));
1264 dump_gimple_fmt (buffer
, spc
, flags
, "eh_dispatch %d",
1265 gimple_eh_dispatch_region (gs
));
1268 /* Dump a GIMPLE_DEBUG tuple on the pretty_printer BUFFER, SPC spaces
1269 of indent. FLAGS specifies details to show in the dump (see TDF_*
1273 dump_gimple_debug (pretty_printer
*buffer
, gdebug
*gs
, int spc
, int flags
)
1275 switch (gs
->subcode
)
1277 case GIMPLE_DEBUG_BIND
:
1278 if (flags
& TDF_RAW
)
1279 dump_gimple_fmt (buffer
, spc
, flags
, "%G BIND <%T, %T>", gs
,
1280 gimple_debug_bind_get_var (gs
),
1281 gimple_debug_bind_get_value (gs
));
1283 dump_gimple_fmt (buffer
, spc
, flags
, "# DEBUG %T => %T",
1284 gimple_debug_bind_get_var (gs
),
1285 gimple_debug_bind_get_value (gs
));
1288 case GIMPLE_DEBUG_SOURCE_BIND
:
1289 if (flags
& TDF_RAW
)
1290 dump_gimple_fmt (buffer
, spc
, flags
, "%G SRCBIND <%T, %T>", gs
,
1291 gimple_debug_source_bind_get_var (gs
),
1292 gimple_debug_source_bind_get_value (gs
));
1294 dump_gimple_fmt (buffer
, spc
, flags
, "# DEBUG %T s=> %T",
1295 gimple_debug_source_bind_get_var (gs
),
1296 gimple_debug_source_bind_get_value (gs
));
1304 /* Dump a GIMPLE_OMP_FOR tuple on the pretty_printer BUFFER. */
1306 dump_gimple_omp_for (pretty_printer
*buffer
, gomp_for
*gs
, int spc
, int flags
)
1310 if (flags
& TDF_RAW
)
1313 switch (gimple_omp_for_kind (gs
))
1315 case GF_OMP_FOR_KIND_FOR
:
1318 case GF_OMP_FOR_KIND_DISTRIBUTE
:
1319 kind
= " distribute";
1321 case GF_OMP_FOR_KIND_TASKLOOP
:
1324 case GF_OMP_FOR_KIND_CILKFOR
:
1325 kind
= " _Cilk_for";
1327 case GF_OMP_FOR_KIND_OACC_LOOP
:
1328 kind
= " oacc_loop";
1330 case GF_OMP_FOR_KIND_SIMD
:
1333 case GF_OMP_FOR_KIND_CILKSIMD
:
1339 dump_gimple_fmt (buffer
, spc
, flags
, "%G%s <%+BODY <%S>%nCLAUSES <", gs
,
1340 kind
, gimple_omp_body (gs
));
1341 dump_omp_clauses (buffer
, gimple_omp_for_clauses (gs
), spc
, flags
);
1342 dump_gimple_fmt (buffer
, spc
, flags
, " >,");
1343 for (i
= 0; i
< gimple_omp_for_collapse (gs
); i
++)
1344 dump_gimple_fmt (buffer
, spc
, flags
,
1345 "%+%T, %T, %T, %s, %T,%n",
1346 gimple_omp_for_index (gs
, i
),
1347 gimple_omp_for_initial (gs
, i
),
1348 gimple_omp_for_final (gs
, i
),
1349 get_tree_code_name (gimple_omp_for_cond (gs
, i
)),
1350 gimple_omp_for_incr (gs
, i
));
1351 dump_gimple_fmt (buffer
, spc
, flags
, "PRE_BODY <%S>%->",
1352 gimple_omp_for_pre_body (gs
));
1356 switch (gimple_omp_for_kind (gs
))
1358 case GF_OMP_FOR_KIND_FOR
:
1359 pp_string (buffer
, "#pragma omp for");
1361 case GF_OMP_FOR_KIND_DISTRIBUTE
:
1362 pp_string (buffer
, "#pragma omp distribute");
1364 case GF_OMP_FOR_KIND_TASKLOOP
:
1365 pp_string (buffer
, "#pragma omp taskloop");
1367 case GF_OMP_FOR_KIND_CILKFOR
:
1369 case GF_OMP_FOR_KIND_OACC_LOOP
:
1370 pp_string (buffer
, "#pragma acc loop");
1372 case GF_OMP_FOR_KIND_SIMD
:
1373 pp_string (buffer
, "#pragma omp simd");
1375 case GF_OMP_FOR_KIND_CILKSIMD
:
1376 pp_string (buffer
, "#pragma simd");
1378 case GF_OMP_FOR_KIND_GRID_LOOP
:
1379 pp_string (buffer
, "#pragma omp for grid_loop");
1384 if (gimple_omp_for_kind (gs
) != GF_OMP_FOR_KIND_CILKFOR
)
1385 dump_omp_clauses (buffer
, gimple_omp_for_clauses (gs
), spc
, flags
);
1386 for (i
= 0; i
< gimple_omp_for_collapse (gs
); i
++)
1390 if (gimple_omp_for_kind (gs
) == GF_OMP_FOR_KIND_CILKFOR
)
1391 pp_string (buffer
, "_Cilk_for (");
1394 newline_and_indent (buffer
, spc
);
1395 pp_string (buffer
, "for (");
1397 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
1399 pp_string (buffer
, " = ");
1400 dump_generic_node (buffer
, gimple_omp_for_initial (gs
, i
), spc
,
1402 pp_string (buffer
, "; ");
1404 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
1407 switch (gimple_omp_for_cond (gs
, i
))
1413 pp_greater (buffer
);
1416 pp_less_equal (buffer
);
1419 pp_greater_equal (buffer
);
1422 pp_string (buffer
, "!=");
1428 dump_generic_node (buffer
, gimple_omp_for_final (gs
, i
), spc
,
1430 pp_string (buffer
, "; ");
1432 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
1434 pp_string (buffer
, " = ");
1435 dump_generic_node (buffer
, gimple_omp_for_incr (gs
, i
), spc
,
1437 pp_right_paren (buffer
);
1440 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1442 if (gimple_omp_for_kind (gs
) == GF_OMP_FOR_KIND_CILKFOR
)
1443 dump_omp_clauses (buffer
, gimple_omp_for_clauses (gs
), spc
, flags
);
1444 newline_and_indent (buffer
, spc
+ 2);
1445 pp_left_brace (buffer
);
1446 pp_newline (buffer
);
1447 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1448 newline_and_indent (buffer
, spc
+ 2);
1449 pp_right_brace (buffer
);
1454 /* Dump a GIMPLE_OMP_CONTINUE tuple on the pretty_printer BUFFER. */
1457 dump_gimple_omp_continue (pretty_printer
*buffer
, gomp_continue
*gs
,
1460 if (flags
& TDF_RAW
)
1462 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T>", gs
,
1463 gimple_omp_continue_control_def (gs
),
1464 gimple_omp_continue_control_use (gs
));
1468 pp_string (buffer
, "#pragma omp continue (");
1469 dump_generic_node (buffer
, gimple_omp_continue_control_def (gs
),
1473 dump_generic_node (buffer
, gimple_omp_continue_control_use (gs
),
1475 pp_right_paren (buffer
);
1479 /* Dump a GIMPLE_OMP_SINGLE tuple on the pretty_printer BUFFER. */
1482 dump_gimple_omp_single (pretty_printer
*buffer
, gomp_single
*gs
,
1485 if (flags
& TDF_RAW
)
1487 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1488 gimple_omp_body (gs
));
1489 dump_omp_clauses (buffer
, gimple_omp_single_clauses (gs
), spc
, flags
);
1490 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1494 pp_string (buffer
, "#pragma omp single");
1495 dump_omp_clauses (buffer
, gimple_omp_single_clauses (gs
), spc
, flags
);
1496 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1498 newline_and_indent (buffer
, spc
+ 2);
1499 pp_left_brace (buffer
);
1500 pp_newline (buffer
);
1501 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1502 newline_and_indent (buffer
, spc
+ 2);
1503 pp_right_brace (buffer
);
1508 /* Dump a GIMPLE_OMP_TARGET tuple on the pretty_printer BUFFER. */
1511 dump_gimple_omp_target (pretty_printer
*buffer
, gomp_target
*gs
,
1515 switch (gimple_omp_target_kind (gs
))
1517 case GF_OMP_TARGET_KIND_REGION
:
1520 case GF_OMP_TARGET_KIND_DATA
:
1523 case GF_OMP_TARGET_KIND_UPDATE
:
1526 case GF_OMP_TARGET_KIND_ENTER_DATA
:
1527 kind
= " enter data";
1529 case GF_OMP_TARGET_KIND_EXIT_DATA
:
1530 kind
= " exit data";
1532 case GF_OMP_TARGET_KIND_OACC_KERNELS
:
1533 kind
= " oacc_kernels";
1535 case GF_OMP_TARGET_KIND_OACC_PARALLEL
:
1536 kind
= " oacc_parallel";
1538 case GF_OMP_TARGET_KIND_OACC_DATA
:
1539 kind
= " oacc_data";
1541 case GF_OMP_TARGET_KIND_OACC_UPDATE
:
1542 kind
= " oacc_update";
1544 case GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA
:
1545 kind
= " oacc_enter_exit_data";
1547 case GF_OMP_TARGET_KIND_OACC_DECLARE
:
1548 kind
= " oacc_declare";
1550 case GF_OMP_TARGET_KIND_OACC_HOST_DATA
:
1551 kind
= " oacc_host_data";
1556 if (flags
& TDF_RAW
)
1558 dump_gimple_fmt (buffer
, spc
, flags
, "%G%s <%+BODY <%S>%nCLAUSES <", gs
,
1559 kind
, gimple_omp_body (gs
));
1560 dump_omp_clauses (buffer
, gimple_omp_target_clauses (gs
), spc
, flags
);
1561 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T%n>",
1562 gimple_omp_target_child_fn (gs
),
1563 gimple_omp_target_data_arg (gs
));
1567 pp_string (buffer
, "#pragma omp target");
1568 pp_string (buffer
, kind
);
1569 dump_omp_clauses (buffer
, gimple_omp_target_clauses (gs
), spc
, flags
);
1570 if (gimple_omp_target_child_fn (gs
))
1572 pp_string (buffer
, " [child fn: ");
1573 dump_generic_node (buffer
, gimple_omp_target_child_fn (gs
),
1575 pp_string (buffer
, " (");
1576 if (gimple_omp_target_data_arg (gs
))
1577 dump_generic_node (buffer
, gimple_omp_target_data_arg (gs
),
1580 pp_string (buffer
, "???");
1581 pp_string (buffer
, ")]");
1583 gimple_seq body
= gimple_omp_body (gs
);
1584 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
1586 newline_and_indent (buffer
, spc
+ 2);
1587 pp_left_brace (buffer
);
1588 pp_newline (buffer
);
1589 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
1590 newline_and_indent (buffer
, spc
+ 2);
1591 pp_right_brace (buffer
);
1595 pp_newline (buffer
);
1596 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
1601 /* Dump a GIMPLE_OMP_TEAMS tuple on the pretty_printer BUFFER. */
1604 dump_gimple_omp_teams (pretty_printer
*buffer
, gomp_teams
*gs
, int spc
,
1607 if (flags
& TDF_RAW
)
1609 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1610 gimple_omp_body (gs
));
1611 dump_omp_clauses (buffer
, gimple_omp_teams_clauses (gs
), spc
, flags
);
1612 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1616 pp_string (buffer
, "#pragma omp teams");
1617 dump_omp_clauses (buffer
, gimple_omp_teams_clauses (gs
), spc
, flags
);
1618 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1620 newline_and_indent (buffer
, spc
+ 2);
1621 pp_character (buffer
, '{');
1622 pp_newline (buffer
);
1623 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1624 newline_and_indent (buffer
, spc
+ 2);
1625 pp_character (buffer
, '}');
1630 /* Dump a GIMPLE_OMP_SECTIONS tuple on the pretty_printer BUFFER. */
1633 dump_gimple_omp_sections (pretty_printer
*buffer
, gomp_sections
*gs
,
1636 if (flags
& TDF_RAW
)
1638 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1639 gimple_omp_body (gs
));
1640 dump_omp_clauses (buffer
, gimple_omp_sections_clauses (gs
), spc
, flags
);
1641 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1645 pp_string (buffer
, "#pragma omp sections");
1646 if (gimple_omp_sections_control (gs
))
1648 pp_string (buffer
, " <");
1649 dump_generic_node (buffer
, gimple_omp_sections_control (gs
), spc
,
1651 pp_greater (buffer
);
1653 dump_omp_clauses (buffer
, gimple_omp_sections_clauses (gs
), spc
, flags
);
1654 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1656 newline_and_indent (buffer
, spc
+ 2);
1657 pp_left_brace (buffer
);
1658 pp_newline (buffer
);
1659 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1660 newline_and_indent (buffer
, spc
+ 2);
1661 pp_right_brace (buffer
);
1666 /* Dump a GIMPLE_OMP_{MASTER,TASKGROUP,ORDERED,SECTION} tuple on the
1667 pretty_printer BUFFER. */
1670 dump_gimple_omp_block (pretty_printer
*buffer
, gimple
*gs
, int spc
, int flags
)
1672 if (flags
& TDF_RAW
)
1673 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1674 gimple_omp_body (gs
));
1677 switch (gimple_code (gs
))
1679 case GIMPLE_OMP_MASTER
:
1680 pp_string (buffer
, "#pragma omp master");
1682 case GIMPLE_OMP_TASKGROUP
:
1683 pp_string (buffer
, "#pragma omp taskgroup");
1685 case GIMPLE_OMP_SECTION
:
1686 pp_string (buffer
, "#pragma omp section");
1688 case GIMPLE_OMP_GRID_BODY
:
1689 pp_string (buffer
, "#pragma omp gridified body");
1694 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1696 newline_and_indent (buffer
, spc
+ 2);
1697 pp_left_brace (buffer
);
1698 pp_newline (buffer
);
1699 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1700 newline_and_indent (buffer
, spc
+ 2);
1701 pp_right_brace (buffer
);
1706 /* Dump a GIMPLE_OMP_CRITICAL tuple on the pretty_printer BUFFER. */
1709 dump_gimple_omp_critical (pretty_printer
*buffer
, gomp_critical
*gs
,
1712 if (flags
& TDF_RAW
)
1713 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1714 gimple_omp_body (gs
));
1717 pp_string (buffer
, "#pragma omp critical");
1718 if (gimple_omp_critical_name (gs
))
1720 pp_string (buffer
, " (");
1721 dump_generic_node (buffer
, gimple_omp_critical_name (gs
), spc
,
1723 pp_right_paren (buffer
);
1725 dump_omp_clauses (buffer
, gimple_omp_critical_clauses (gs
), spc
, flags
);
1726 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1728 newline_and_indent (buffer
, spc
+ 2);
1729 pp_left_brace (buffer
);
1730 pp_newline (buffer
);
1731 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1732 newline_and_indent (buffer
, spc
+ 2);
1733 pp_right_brace (buffer
);
1738 /* Dump a GIMPLE_OMP_ORDERED tuple on the pretty_printer BUFFER. */
1741 dump_gimple_omp_ordered (pretty_printer
*buffer
, gomp_ordered
*gs
,
1744 if (flags
& TDF_RAW
)
1745 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1746 gimple_omp_body (gs
));
1749 pp_string (buffer
, "#pragma omp ordered");
1750 dump_omp_clauses (buffer
, gimple_omp_ordered_clauses (gs
), spc
, flags
);
1751 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1753 newline_and_indent (buffer
, spc
+ 2);
1754 pp_left_brace (buffer
);
1755 pp_newline (buffer
);
1756 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1757 newline_and_indent (buffer
, spc
+ 2);
1758 pp_right_brace (buffer
);
1763 /* Dump a GIMPLE_OMP_RETURN tuple on the pretty_printer BUFFER. */
1766 dump_gimple_omp_return (pretty_printer
*buffer
, gimple
*gs
, int spc
, int flags
)
1768 if (flags
& TDF_RAW
)
1770 dump_gimple_fmt (buffer
, spc
, flags
, "%G <nowait=%d", gs
,
1771 (int) gimple_omp_return_nowait_p (gs
));
1772 if (gimple_omp_return_lhs (gs
))
1773 dump_gimple_fmt (buffer
, spc
, flags
, ", lhs=%T>",
1774 gimple_omp_return_lhs (gs
));
1776 dump_gimple_fmt (buffer
, spc
, flags
, ">");
1780 pp_string (buffer
, "#pragma omp return");
1781 if (gimple_omp_return_nowait_p (gs
))
1782 pp_string (buffer
, "(nowait)");
1783 if (gimple_omp_return_lhs (gs
))
1785 pp_string (buffer
, " (set ");
1786 dump_generic_node (buffer
, gimple_omp_return_lhs (gs
),
1788 pp_character (buffer
, ')');
1793 /* Dump a GIMPLE_TRANSACTION tuple on the pretty_printer BUFFER. */
1796 dump_gimple_transaction (pretty_printer
*buffer
, gtransaction
*gs
,
1799 unsigned subcode
= gimple_transaction_subcode (gs
);
1801 if (flags
& TDF_RAW
)
1803 dump_gimple_fmt (buffer
, spc
, flags
,
1804 "%G [SUBCODE=%x,NORM=%T,UNINST=%T,OVER=%T] "
1806 gs
, subcode
, gimple_transaction_label_norm (gs
),
1807 gimple_transaction_label_uninst (gs
),
1808 gimple_transaction_label_over (gs
),
1809 gimple_transaction_body (gs
));
1813 if (subcode
& GTMA_IS_OUTER
)
1814 pp_string (buffer
, "__transaction_atomic [[outer]]");
1815 else if (subcode
& GTMA_IS_RELAXED
)
1816 pp_string (buffer
, "__transaction_relaxed");
1818 pp_string (buffer
, "__transaction_atomic");
1819 subcode
&= ~GTMA_DECLARATION_MASK
;
1821 if (gimple_transaction_body (gs
))
1823 newline_and_indent (buffer
, spc
+ 2);
1824 pp_left_brace (buffer
);
1825 pp_newline (buffer
);
1826 dump_gimple_seq (buffer
, gimple_transaction_body (gs
),
1828 newline_and_indent (buffer
, spc
+ 2);
1829 pp_right_brace (buffer
);
1833 pp_string (buffer
, " //");
1834 if (gimple_transaction_label_norm (gs
))
1836 pp_string (buffer
, " NORM=");
1837 dump_generic_node (buffer
, gimple_transaction_label_norm (gs
),
1840 if (gimple_transaction_label_uninst (gs
))
1842 pp_string (buffer
, " UNINST=");
1843 dump_generic_node (buffer
, gimple_transaction_label_uninst (gs
),
1846 if (gimple_transaction_label_over (gs
))
1848 pp_string (buffer
, " OVER=");
1849 dump_generic_node (buffer
, gimple_transaction_label_over (gs
),
1854 pp_string (buffer
, " SUBCODE=[ ");
1855 if (subcode
& GTMA_HAVE_ABORT
)
1857 pp_string (buffer
, "GTMA_HAVE_ABORT ");
1858 subcode
&= ~GTMA_HAVE_ABORT
;
1860 if (subcode
& GTMA_HAVE_LOAD
)
1862 pp_string (buffer
, "GTMA_HAVE_LOAD ");
1863 subcode
&= ~GTMA_HAVE_LOAD
;
1865 if (subcode
& GTMA_HAVE_STORE
)
1867 pp_string (buffer
, "GTMA_HAVE_STORE ");
1868 subcode
&= ~GTMA_HAVE_STORE
;
1870 if (subcode
& GTMA_MAY_ENTER_IRREVOCABLE
)
1872 pp_string (buffer
, "GTMA_MAY_ENTER_IRREVOCABLE ");
1873 subcode
&= ~GTMA_MAY_ENTER_IRREVOCABLE
;
1875 if (subcode
& GTMA_DOES_GO_IRREVOCABLE
)
1877 pp_string (buffer
, "GTMA_DOES_GO_IRREVOCABLE ");
1878 subcode
&= ~GTMA_DOES_GO_IRREVOCABLE
;
1880 if (subcode
& GTMA_HAS_NO_INSTRUMENTATION
)
1882 pp_string (buffer
, "GTMA_HAS_NO_INSTRUMENTATION ");
1883 subcode
&= ~GTMA_HAS_NO_INSTRUMENTATION
;
1886 pp_printf (buffer
, "0x%x ", subcode
);
1887 pp_right_bracket (buffer
);
1893 /* Dump a GIMPLE_ASM tuple on the pretty_printer BUFFER, SPC spaces of
1894 indent. FLAGS specifies details to show in the dump (see TDF_* in
1898 dump_gimple_asm (pretty_printer
*buffer
, gasm
*gs
, int spc
, int flags
)
1900 unsigned int i
, n
, f
, fields
;
1902 if (flags
& TDF_RAW
)
1904 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+STRING <%n%s%n>", gs
,
1905 gimple_asm_string (gs
));
1907 n
= gimple_asm_noutputs (gs
);
1910 newline_and_indent (buffer
, spc
+ 2);
1911 pp_string (buffer
, "OUTPUT: ");
1912 for (i
= 0; i
< n
; i
++)
1914 dump_generic_node (buffer
, gimple_asm_output_op (gs
, i
),
1917 pp_string (buffer
, ", ");
1921 n
= gimple_asm_ninputs (gs
);
1924 newline_and_indent (buffer
, spc
+ 2);
1925 pp_string (buffer
, "INPUT: ");
1926 for (i
= 0; i
< n
; i
++)
1928 dump_generic_node (buffer
, gimple_asm_input_op (gs
, i
),
1931 pp_string (buffer
, ", ");
1935 n
= gimple_asm_nclobbers (gs
);
1938 newline_and_indent (buffer
, spc
+ 2);
1939 pp_string (buffer
, "CLOBBER: ");
1940 for (i
= 0; i
< n
; i
++)
1942 dump_generic_node (buffer
, gimple_asm_clobber_op (gs
, i
),
1945 pp_string (buffer
, ", ");
1949 n
= gimple_asm_nlabels (gs
);
1952 newline_and_indent (buffer
, spc
+ 2);
1953 pp_string (buffer
, "LABEL: ");
1954 for (i
= 0; i
< n
; i
++)
1956 dump_generic_node (buffer
, gimple_asm_label_op (gs
, i
),
1959 pp_string (buffer
, ", ");
1963 newline_and_indent (buffer
, spc
);
1964 pp_greater (buffer
);
1968 pp_string (buffer
, "__asm__");
1969 if (gimple_asm_volatile_p (gs
))
1970 pp_string (buffer
, " __volatile__");
1971 if (gimple_asm_nlabels (gs
))
1972 pp_string (buffer
, " goto");
1973 pp_string (buffer
, "(\"");
1974 pp_string (buffer
, gimple_asm_string (gs
));
1975 pp_string (buffer
, "\"");
1977 if (gimple_asm_nlabels (gs
))
1979 else if (gimple_asm_nclobbers (gs
))
1981 else if (gimple_asm_ninputs (gs
))
1983 else if (gimple_asm_noutputs (gs
))
1988 for (f
= 0; f
< fields
; ++f
)
1990 pp_string (buffer
, " : ");
1995 n
= gimple_asm_noutputs (gs
);
1996 for (i
= 0; i
< n
; i
++)
1998 dump_generic_node (buffer
, gimple_asm_output_op (gs
, i
),
2001 pp_string (buffer
, ", ");
2006 n
= gimple_asm_ninputs (gs
);
2007 for (i
= 0; i
< n
; i
++)
2009 dump_generic_node (buffer
, gimple_asm_input_op (gs
, i
),
2012 pp_string (buffer
, ", ");
2017 n
= gimple_asm_nclobbers (gs
);
2018 for (i
= 0; i
< n
; i
++)
2020 dump_generic_node (buffer
, gimple_asm_clobber_op (gs
, i
),
2023 pp_string (buffer
, ", ");
2028 n
= gimple_asm_nlabels (gs
);
2029 for (i
= 0; i
< n
; i
++)
2031 dump_generic_node (buffer
, gimple_asm_label_op (gs
, i
),
2034 pp_string (buffer
, ", ");
2043 pp_string (buffer
, ");");
2047 /* Dump ptr_info and range_info for NODE on pretty_printer BUFFER with
2048 SPC spaces of indent. */
2051 dump_ssaname_info (pretty_printer
*buffer
, tree node
, int spc
)
2053 if (TREE_CODE (node
) != SSA_NAME
)
2056 if (POINTER_TYPE_P (TREE_TYPE (node
))
2057 && SSA_NAME_PTR_INFO (node
))
2059 unsigned int align
, misalign
;
2060 struct ptr_info_def
*pi
= SSA_NAME_PTR_INFO (node
);
2061 pp_string (buffer
, "# PT = ");
2062 pp_points_to_solution (buffer
, &pi
->pt
);
2063 newline_and_indent (buffer
, spc
);
2064 if (get_ptr_info_alignment (pi
, &align
, &misalign
))
2066 pp_printf (buffer
, "# ALIGN = %u, MISALIGN = %u", align
, misalign
);
2067 newline_and_indent (buffer
, spc
);
2071 if (!POINTER_TYPE_P (TREE_TYPE (node
))
2072 && SSA_NAME_RANGE_INFO (node
))
2074 wide_int min
, max
, nonzero_bits
;
2075 value_range_type range_type
= get_range_info (node
, &min
, &max
);
2077 if (range_type
== VR_VARYING
)
2078 pp_printf (buffer
, "# RANGE VR_VARYING");
2079 else if (range_type
== VR_RANGE
|| range_type
== VR_ANTI_RANGE
)
2081 pp_printf (buffer
, "# RANGE ");
2082 pp_printf (buffer
, "%s[", range_type
== VR_RANGE
? "" : "~");
2083 pp_wide_int (buffer
, min
, TYPE_SIGN (TREE_TYPE (node
)));
2084 pp_printf (buffer
, ", ");
2085 pp_wide_int (buffer
, max
, TYPE_SIGN (TREE_TYPE (node
)));
2086 pp_printf (buffer
, "]");
2088 nonzero_bits
= get_nonzero_bits (node
);
2089 if (nonzero_bits
!= -1)
2091 pp_string (buffer
, " NONZERO ");
2092 pp_wide_int (buffer
, nonzero_bits
, UNSIGNED
);
2094 newline_and_indent (buffer
, spc
);
2098 /* As dump_ssaname_info, but dump to FILE. */
2101 dump_ssaname_info_to_file (FILE *file
, tree node
, int spc
)
2103 pretty_printer buffer
;
2104 pp_needs_newline (&buffer
) = true;
2105 buffer
.buffer
->stream
= file
;
2106 dump_ssaname_info (&buffer
, node
, spc
);
2110 /* Dump a PHI node PHI. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1.
2111 The caller is responsible for calling pp_flush on BUFFER to finalize
2112 pretty printer. If COMMENT is true, print this after #. */
2115 dump_gimple_phi (pretty_printer
*buffer
, gphi
*phi
, int spc
, bool comment
,
2119 tree lhs
= gimple_phi_result (phi
);
2121 if (flags
& TDF_ALIAS
)
2122 dump_ssaname_info (buffer
, lhs
, spc
);
2125 pp_string (buffer
, "# ");
2127 if (flags
& TDF_RAW
)
2128 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, ", phi
,
2129 gimple_phi_result (phi
));
2132 dump_generic_node (buffer
, lhs
, spc
, flags
, false);
2133 if (flags
& TDF_GIMPLE
)
2134 pp_string (buffer
, " = __PHI (");
2136 pp_string (buffer
, " = PHI <");
2138 for (i
= 0; i
< gimple_phi_num_args (phi
); i
++)
2140 if ((flags
& TDF_LINENO
) && gimple_phi_arg_has_location (phi
, i
))
2141 dump_location (buffer
, gimple_phi_arg_location (phi
, i
));
2142 if (flags
& TDF_GIMPLE
)
2144 basic_block src
= gimple_phi_arg_edge (phi
, i
)->src
;
2145 gimple
*stmt
= first_stmt (src
);
2146 if (!stmt
|| gimple_code (stmt
) != GIMPLE_LABEL
)
2148 pp_string (buffer
, "bb_");
2149 pp_decimal_int (buffer
, src
->index
);
2152 dump_generic_node (buffer
, gimple_label_label (as_a
<glabel
*> (stmt
)), 0, flags
,
2154 pp_string (buffer
, ": ");
2156 dump_generic_node (buffer
, gimple_phi_arg_def (phi
, i
), spc
, flags
,
2158 if (! (flags
& TDF_GIMPLE
))
2160 pp_left_paren (buffer
);
2161 pp_decimal_int (buffer
, gimple_phi_arg_edge (phi
, i
)->src
->index
);
2162 pp_right_paren (buffer
);
2164 if (i
< gimple_phi_num_args (phi
) - 1)
2165 pp_string (buffer
, ", ");
2167 if (flags
& TDF_GIMPLE
)
2168 pp_string (buffer
, ");");
2170 pp_greater (buffer
);
2174 /* Dump a GIMPLE_OMP_PARALLEL tuple on the pretty_printer BUFFER, SPC spaces
2175 of indent. FLAGS specifies details to show in the dump (see TDF_* in
2179 dump_gimple_omp_parallel (pretty_printer
*buffer
, gomp_parallel
*gs
,
2182 if (flags
& TDF_RAW
)
2184 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
2185 gimple_omp_body (gs
));
2186 dump_omp_clauses (buffer
, gimple_omp_parallel_clauses (gs
), spc
, flags
);
2187 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T%n>",
2188 gimple_omp_parallel_child_fn (gs
),
2189 gimple_omp_parallel_data_arg (gs
));
2194 pp_string (buffer
, "#pragma omp parallel");
2195 dump_omp_clauses (buffer
, gimple_omp_parallel_clauses (gs
), spc
, flags
);
2196 if (gimple_omp_parallel_child_fn (gs
))
2198 pp_string (buffer
, " [child fn: ");
2199 dump_generic_node (buffer
, gimple_omp_parallel_child_fn (gs
),
2201 pp_string (buffer
, " (");
2202 if (gimple_omp_parallel_data_arg (gs
))
2203 dump_generic_node (buffer
, gimple_omp_parallel_data_arg (gs
),
2206 pp_string (buffer
, "???");
2207 pp_string (buffer
, ")]");
2209 body
= gimple_omp_body (gs
);
2210 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
2212 newline_and_indent (buffer
, spc
+ 2);
2213 pp_left_brace (buffer
);
2214 pp_newline (buffer
);
2215 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
2216 newline_and_indent (buffer
, spc
+ 2);
2217 pp_right_brace (buffer
);
2221 pp_newline (buffer
);
2222 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
2228 /* Dump a GIMPLE_OMP_TASK tuple on the pretty_printer BUFFER, SPC spaces
2229 of indent. FLAGS specifies details to show in the dump (see TDF_* in
2233 dump_gimple_omp_task (pretty_printer
*buffer
, gomp_task
*gs
, int spc
,
2236 if (flags
& TDF_RAW
)
2238 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
2239 gimple_omp_body (gs
));
2240 dump_omp_clauses (buffer
, gimple_omp_task_clauses (gs
), spc
, flags
);
2241 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T, %T, %T, %T%n>",
2242 gimple_omp_task_child_fn (gs
),
2243 gimple_omp_task_data_arg (gs
),
2244 gimple_omp_task_copy_fn (gs
),
2245 gimple_omp_task_arg_size (gs
),
2246 gimple_omp_task_arg_size (gs
));
2251 if (gimple_omp_task_taskloop_p (gs
))
2252 pp_string (buffer
, "#pragma omp taskloop");
2254 pp_string (buffer
, "#pragma omp task");
2255 dump_omp_clauses (buffer
, gimple_omp_task_clauses (gs
), spc
, flags
);
2256 if (gimple_omp_task_child_fn (gs
))
2258 pp_string (buffer
, " [child fn: ");
2259 dump_generic_node (buffer
, gimple_omp_task_child_fn (gs
),
2261 pp_string (buffer
, " (");
2262 if (gimple_omp_task_data_arg (gs
))
2263 dump_generic_node (buffer
, gimple_omp_task_data_arg (gs
),
2266 pp_string (buffer
, "???");
2267 pp_string (buffer
, ")]");
2269 body
= gimple_omp_body (gs
);
2270 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
2272 newline_and_indent (buffer
, spc
+ 2);
2273 pp_left_brace (buffer
);
2274 pp_newline (buffer
);
2275 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
2276 newline_and_indent (buffer
, spc
+ 2);
2277 pp_right_brace (buffer
);
2281 pp_newline (buffer
);
2282 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
2288 /* Dump a GIMPLE_OMP_ATOMIC_LOAD tuple on the pretty_printer BUFFER, SPC
2289 spaces of indent. FLAGS specifies details to show in the dump (see TDF_*
2293 dump_gimple_omp_atomic_load (pretty_printer
*buffer
, gomp_atomic_load
*gs
,
2296 if (flags
& TDF_RAW
)
2298 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T>", gs
,
2299 gimple_omp_atomic_load_lhs (gs
),
2300 gimple_omp_atomic_load_rhs (gs
));
2304 pp_string (buffer
, "#pragma omp atomic_load");
2305 if (gimple_omp_atomic_seq_cst_p (gs
))
2306 pp_string (buffer
, " seq_cst");
2307 if (gimple_omp_atomic_need_value_p (gs
))
2308 pp_string (buffer
, " [needed]");
2309 newline_and_indent (buffer
, spc
+ 2);
2310 dump_generic_node (buffer
, gimple_omp_atomic_load_lhs (gs
),
2316 dump_generic_node (buffer
, gimple_omp_atomic_load_rhs (gs
),
2321 /* Dump a GIMPLE_OMP_ATOMIC_STORE tuple on the pretty_printer BUFFER, SPC
2322 spaces of indent. FLAGS specifies details to show in the dump (see TDF_*
2326 dump_gimple_omp_atomic_store (pretty_printer
*buffer
,
2327 gomp_atomic_store
*gs
, int spc
, int flags
)
2329 if (flags
& TDF_RAW
)
2331 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
,
2332 gimple_omp_atomic_store_val (gs
));
2336 pp_string (buffer
, "#pragma omp atomic_store ");
2337 if (gimple_omp_atomic_seq_cst_p (gs
))
2338 pp_string (buffer
, "seq_cst ");
2339 if (gimple_omp_atomic_need_value_p (gs
))
2340 pp_string (buffer
, "[needed] ");
2341 pp_left_paren (buffer
);
2342 dump_generic_node (buffer
, gimple_omp_atomic_store_val (gs
),
2344 pp_right_paren (buffer
);
2349 /* Dump all the memory operands for statement GS. BUFFER, SPC and
2350 FLAGS are as in pp_gimple_stmt_1. */
2353 dump_gimple_mem_ops (pretty_printer
*buffer
, gimple
*gs
, int spc
, int flags
)
2355 tree vdef
= gimple_vdef (gs
);
2356 tree vuse
= gimple_vuse (gs
);
2358 if (vdef
!= NULL_TREE
)
2360 pp_string (buffer
, "# ");
2361 dump_generic_node (buffer
, vdef
, spc
+ 2, flags
, false);
2362 pp_string (buffer
, " = VDEF <");
2363 dump_generic_node (buffer
, vuse
, spc
+ 2, flags
, false);
2364 pp_greater (buffer
);
2365 newline_and_indent (buffer
, spc
);
2367 else if (vuse
!= NULL_TREE
)
2369 pp_string (buffer
, "# VUSE <");
2370 dump_generic_node (buffer
, vuse
, spc
+ 2, flags
, false);
2371 pp_greater (buffer
);
2372 newline_and_indent (buffer
, spc
);
2377 /* Print the gimple statement GS on the pretty printer BUFFER, SPC
2378 spaces of indent. FLAGS specifies details to show in the dump (see
2379 TDF_* in dumpfile.h). The caller is responsible for calling
2380 pp_flush on BUFFER to finalize the pretty printer. */
2383 pp_gimple_stmt_1 (pretty_printer
*buffer
, gimple
*gs
, int spc
, int flags
)
2388 if (flags
& TDF_STMTADDR
)
2389 pp_printf (buffer
, "<&%p> ", (void *) gs
);
2391 if ((flags
& TDF_LINENO
) && gimple_has_location (gs
))
2392 dump_location (buffer
, gimple_location (gs
));
2396 int lp_nr
= lookup_stmt_eh_lp (gs
);
2398 pp_printf (buffer
, "[LP %d] ", lp_nr
);
2400 pp_printf (buffer
, "[MNT %d] ", -lp_nr
);
2403 if ((flags
& (TDF_VOPS
|TDF_MEMSYMS
))
2404 && gimple_has_mem_ops (gs
))
2405 dump_gimple_mem_ops (buffer
, gs
, spc
, flags
);
2407 if (gimple_has_lhs (gs
)
2408 && (flags
& TDF_ALIAS
))
2409 dump_ssaname_info (buffer
, gimple_get_lhs (gs
), spc
);
2411 switch (gimple_code (gs
))
2414 dump_gimple_asm (buffer
, as_a
<gasm
*> (gs
), spc
, flags
);
2418 dump_gimple_assign (buffer
, as_a
<gassign
*> (gs
), spc
, flags
);
2422 dump_gimple_bind (buffer
, as_a
<gbind
*> (gs
), spc
, flags
);
2426 dump_gimple_call (buffer
, as_a
<gcall
*> (gs
), spc
, flags
);
2430 dump_gimple_cond (buffer
, as_a
<gcond
*> (gs
), spc
, flags
);
2434 dump_gimple_label (buffer
, as_a
<glabel
*> (gs
), spc
, flags
);
2438 dump_gimple_goto (buffer
, as_a
<ggoto
*> (gs
), spc
, flags
);
2442 pp_string (buffer
, "GIMPLE_NOP");
2446 dump_gimple_return (buffer
, as_a
<greturn
*> (gs
), spc
, flags
);
2450 dump_gimple_switch (buffer
, as_a
<gswitch
*> (gs
), spc
, flags
);
2454 dump_gimple_try (buffer
, as_a
<gtry
*> (gs
), spc
, flags
);
2458 dump_gimple_phi (buffer
, as_a
<gphi
*> (gs
), spc
, false, flags
);
2461 case GIMPLE_OMP_PARALLEL
:
2462 dump_gimple_omp_parallel (buffer
, as_a
<gomp_parallel
*> (gs
), spc
,
2466 case GIMPLE_OMP_TASK
:
2467 dump_gimple_omp_task (buffer
, as_a
<gomp_task
*> (gs
), spc
, flags
);
2470 case GIMPLE_OMP_ATOMIC_LOAD
:
2471 dump_gimple_omp_atomic_load (buffer
, as_a
<gomp_atomic_load
*> (gs
),
2475 case GIMPLE_OMP_ATOMIC_STORE
:
2476 dump_gimple_omp_atomic_store (buffer
,
2477 as_a
<gomp_atomic_store
*> (gs
),
2481 case GIMPLE_OMP_FOR
:
2482 dump_gimple_omp_for (buffer
, as_a
<gomp_for
*> (gs
), spc
, flags
);
2485 case GIMPLE_OMP_CONTINUE
:
2486 dump_gimple_omp_continue (buffer
, as_a
<gomp_continue
*> (gs
), spc
,
2490 case GIMPLE_OMP_SINGLE
:
2491 dump_gimple_omp_single (buffer
, as_a
<gomp_single
*> (gs
), spc
,
2495 case GIMPLE_OMP_TARGET
:
2496 dump_gimple_omp_target (buffer
, as_a
<gomp_target
*> (gs
), spc
,
2500 case GIMPLE_OMP_TEAMS
:
2501 dump_gimple_omp_teams (buffer
, as_a
<gomp_teams
*> (gs
), spc
,
2505 case GIMPLE_OMP_RETURN
:
2506 dump_gimple_omp_return (buffer
, gs
, spc
, flags
);
2509 case GIMPLE_OMP_SECTIONS
:
2510 dump_gimple_omp_sections (buffer
, as_a
<gomp_sections
*> (gs
),
2514 case GIMPLE_OMP_SECTIONS_SWITCH
:
2515 pp_string (buffer
, "GIMPLE_SECTIONS_SWITCH");
2518 case GIMPLE_OMP_MASTER
:
2519 case GIMPLE_OMP_TASKGROUP
:
2520 case GIMPLE_OMP_SECTION
:
2521 case GIMPLE_OMP_GRID_BODY
:
2522 dump_gimple_omp_block (buffer
, gs
, spc
, flags
);
2525 case GIMPLE_OMP_ORDERED
:
2526 dump_gimple_omp_ordered (buffer
, as_a
<gomp_ordered
*> (gs
), spc
,
2530 case GIMPLE_OMP_CRITICAL
:
2531 dump_gimple_omp_critical (buffer
, as_a
<gomp_critical
*> (gs
), spc
,
2536 dump_gimple_catch (buffer
, as_a
<gcatch
*> (gs
), spc
, flags
);
2539 case GIMPLE_EH_FILTER
:
2540 dump_gimple_eh_filter (buffer
, as_a
<geh_filter
*> (gs
), spc
, flags
);
2543 case GIMPLE_EH_MUST_NOT_THROW
:
2544 dump_gimple_eh_must_not_throw (buffer
,
2545 as_a
<geh_mnt
*> (gs
),
2549 case GIMPLE_EH_ELSE
:
2550 dump_gimple_eh_else (buffer
, as_a
<geh_else
*> (gs
), spc
, flags
);
2554 dump_gimple_resx (buffer
, as_a
<gresx
*> (gs
), spc
, flags
);
2557 case GIMPLE_EH_DISPATCH
:
2558 dump_gimple_eh_dispatch (buffer
, as_a
<geh_dispatch
*> (gs
), spc
,
2563 dump_gimple_debug (buffer
, as_a
<gdebug
*> (gs
), spc
, flags
);
2566 case GIMPLE_PREDICT
:
2567 pp_string (buffer
, "// predicted ");
2568 if (gimple_predict_outcome (gs
))
2569 pp_string (buffer
, "likely by ");
2571 pp_string (buffer
, "unlikely by ");
2572 pp_string (buffer
, predictor_name (gimple_predict_predictor (gs
)));
2573 pp_string (buffer
, " predictor.");
2576 case GIMPLE_TRANSACTION
:
2577 dump_gimple_transaction (buffer
, as_a
<gtransaction
*> (gs
), spc
,
2587 /* Dumps header of basic block BB to OUTF indented by INDENT
2588 spaces and details described by flags. */
2591 dump_gimple_bb_header (FILE *outf
, basic_block bb
, int indent
, int flags
)
2593 if (flags
& TDF_BLOCKS
)
2595 if (flags
& TDF_LINENO
)
2597 gimple_stmt_iterator gsi
;
2599 if (flags
& TDF_COMMENT
)
2600 fputs (";; ", outf
);
2602 for (gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
); gsi_next (&gsi
))
2603 if (!is_gimple_debug (gsi_stmt (gsi
))
2604 && get_lineno (gsi_stmt (gsi
)) != UNKNOWN_LOCATION
)
2606 fprintf (outf
, "%*sstarting at line %d",
2607 indent
, "", get_lineno (gsi_stmt (gsi
)));
2610 if (bb
->discriminator
)
2611 fprintf (outf
, ", discriminator %i", bb
->discriminator
);
2617 gimple
*stmt
= first_stmt (bb
);
2618 if (!stmt
|| gimple_code (stmt
) != GIMPLE_LABEL
)
2620 if (flags
& TDF_GIMPLE
)
2621 fprintf (outf
, "%*sbb_%d:\n", indent
, "", bb
->index
);
2623 fprintf (outf
, "%*s<bb %d> %s:\n",
2624 indent
, "", bb
->index
, dump_probability (bb
->frequency
));
2630 /* Dumps end of basic block BB to buffer BUFFER indented by INDENT
2634 dump_gimple_bb_footer (FILE *outf ATTRIBUTE_UNUSED
,
2635 basic_block bb ATTRIBUTE_UNUSED
,
2636 int indent ATTRIBUTE_UNUSED
,
2637 int flags ATTRIBUTE_UNUSED
)
2639 /* There is currently no GIMPLE-specific basic block info to dump. */
2644 /* Dump PHI nodes of basic block BB to BUFFER with details described
2645 by FLAGS and indented by INDENT spaces. */
2648 dump_phi_nodes (pretty_printer
*buffer
, basic_block bb
, int indent
, int flags
)
2652 for (i
= gsi_start_phis (bb
); !gsi_end_p (i
); gsi_next (&i
))
2654 gphi
*phi
= i
.phi ();
2655 if (!virtual_operand_p (gimple_phi_result (phi
)) || (flags
& TDF_VOPS
))
2658 dump_gimple_phi (buffer
, phi
, indent
,
2659 (flags
& TDF_GIMPLE
) ? false : true, flags
);
2660 pp_newline (buffer
);
2666 /* Dump jump to basic block BB that is represented implicitly in the cfg
2670 pp_cfg_jump (pretty_printer
*buffer
, edge e
, int flags
)
2672 if (flags
& TDF_GIMPLE
)
2674 pp_string (buffer
, "goto bb_");
2675 pp_decimal_int (buffer
, e
->dest
->index
);
2676 pp_semicolon (buffer
);
2680 gimple
*stmt
= first_stmt (e
->dest
);
2682 pp_string (buffer
, "goto <bb ");
2683 pp_decimal_int (buffer
, e
->dest
->index
);
2684 pp_greater (buffer
);
2685 if (stmt
&& gimple_code (stmt
) == GIMPLE_LABEL
)
2687 pp_string (buffer
, " (");
2688 dump_generic_node (buffer
,
2689 gimple_label_label (as_a
<glabel
*> (stmt
)),
2691 pp_right_paren (buffer
);
2692 pp_semicolon (buffer
);
2695 pp_semicolon (buffer
);
2697 dump_edge_probability (buffer
, e
);
2702 /* Dump edges represented implicitly in basic block BB to BUFFER, indented
2703 by INDENT spaces, with details given by FLAGS. */
2706 dump_implicit_edges (pretty_printer
*buffer
, basic_block bb
, int indent
,
2712 stmt
= last_stmt (bb
);
2714 if (stmt
&& gimple_code (stmt
) == GIMPLE_COND
)
2716 edge true_edge
, false_edge
;
2718 /* When we are emitting the code or changing CFG, it is possible that
2719 the edges are not yet created. When we are using debug_bb in such
2720 a situation, we do not want it to crash. */
2721 if (EDGE_COUNT (bb
->succs
) != 2)
2723 extract_true_false_edges_from_block (bb
, &true_edge
, &false_edge
);
2725 INDENT (indent
+ 2);
2726 pp_cfg_jump (buffer
, true_edge
, flags
);
2727 newline_and_indent (buffer
, indent
);
2728 pp_string (buffer
, "else");
2729 newline_and_indent (buffer
, indent
+ 2);
2730 pp_cfg_jump (buffer
, false_edge
, flags
);
2731 pp_newline (buffer
);
2735 /* If there is a fallthru edge, we may need to add an artificial
2736 goto to the dump. */
2737 e
= find_fallthru_edge (bb
->succs
);
2739 if (e
&& e
->dest
!= bb
->next_bb
)
2743 if ((flags
& TDF_LINENO
)
2744 && e
->goto_locus
!= UNKNOWN_LOCATION
)
2745 dump_location (buffer
, e
->goto_locus
);
2747 pp_cfg_jump (buffer
, e
, flags
);
2748 pp_newline (buffer
);
2753 /* Dumps basic block BB to buffer BUFFER with details described by FLAGS and
2754 indented by INDENT spaces. */
2757 gimple_dump_bb_buff (pretty_printer
*buffer
, basic_block bb
, int indent
,
2760 gimple_stmt_iterator gsi
;
2762 int label_indent
= indent
- 2;
2764 if (label_indent
< 0)
2767 dump_phi_nodes (buffer
, bb
, indent
, flags
);
2769 for (gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
); gsi_next (&gsi
))
2773 stmt
= gsi_stmt (gsi
);
2775 curr_indent
= gimple_code (stmt
) == GIMPLE_LABEL
? label_indent
: indent
;
2777 INDENT (curr_indent
);
2778 pp_gimple_stmt_1 (buffer
, stmt
, curr_indent
, flags
);
2779 pp_newline_and_flush (buffer
);
2780 gcc_checking_assert (DECL_STRUCT_FUNCTION (current_function_decl
));
2781 dump_histograms_for_stmt (DECL_STRUCT_FUNCTION (current_function_decl
),
2782 pp_buffer (buffer
)->stream
, stmt
);
2785 dump_implicit_edges (buffer
, bb
, indent
, flags
);
2790 /* Dumps basic block BB to FILE with details described by FLAGS and
2791 indented by INDENT spaces. */
2794 gimple_dump_bb (FILE *file
, basic_block bb
, int indent
, int flags
)
2796 dump_gimple_bb_header (file
, bb
, indent
, flags
);
2797 if (bb
->index
>= NUM_FIXED_BLOCKS
)
2799 pretty_printer buffer
;
2800 pp_needs_newline (&buffer
) = true;
2801 buffer
.buffer
->stream
= file
;
2802 gimple_dump_bb_buff (&buffer
, bb
, indent
, flags
);
2804 dump_gimple_bb_footer (file
, bb
, indent
, flags
);
2807 /* Dumps basic block BB to pretty-printer PP with default dump flags and
2808 no indentation, for use as a label of a DOT graph record-node.
2809 ??? Should just use gimple_dump_bb_buff here, except that value profiling
2810 histogram dumping doesn't know about pretty-printers. */
2813 gimple_dump_bb_for_graph (pretty_printer
*pp
, basic_block bb
)
2815 pp_printf (pp
, "<bb %d>:\n", bb
->index
);
2816 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
2818 for (gphi_iterator gsi
= gsi_start_phis (bb
); !gsi_end_p (gsi
);
2821 gphi
*phi
= gsi
.phi ();
2822 if (!virtual_operand_p (gimple_phi_result (phi
))
2823 || (dump_flags
& TDF_VOPS
))
2826 pp_write_text_to_stream (pp
);
2827 pp_string (pp
, "# ");
2828 pp_gimple_stmt_1 (pp
, phi
, 0, dump_flags
);
2830 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
2834 for (gimple_stmt_iterator gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
);
2837 gimple
*stmt
= gsi_stmt (gsi
);
2839 pp_write_text_to_stream (pp
);
2840 pp_gimple_stmt_1 (pp
, stmt
, 0, dump_flags
);
2842 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
2844 dump_implicit_edges (pp
, bb
, 0, dump_flags
);
2845 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);