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"
41 #define INDENT(SPACE) \
42 do { int i; for (i = 0; i < SPACE; i++) pp_space (buffer); } while (0)
44 #define GIMPLE_NIY do_niy (buffer,gs)
46 /* Try to print on BUFFER a default message for the unrecognized
47 gimple statement GS. */
50 do_niy (pretty_printer
*buffer
, gimple
*gs
)
52 pp_printf (buffer
, "<<< Unknown GIMPLE statement: %s >>>\n",
53 gimple_code_name
[(int) gimple_code (gs
)]);
57 /* Emit a newline and SPC indentation spaces to BUFFER. */
60 newline_and_indent (pretty_printer
*buffer
, int spc
)
67 /* Print the GIMPLE statement GS on stderr. */
70 debug_gimple_stmt (gimple
*gs
)
72 print_gimple_stmt (stderr
, gs
, 0, TDF_VOPS
|TDF_MEMSYMS
);
75 /* Dump E probability to BUFFER. */
78 dump_edge_probability (pretty_printer
*buffer
, edge e
)
80 pp_scalar (buffer
, " [%.1f%%]",
81 e
->probability
* 100.0 / REG_BR_PROB_BASE
);
84 /* Print GIMPLE statement G to FILE using SPC indentation spaces and
85 FLAGS as in pp_gimple_stmt_1. */
88 print_gimple_stmt (FILE *file
, gimple
*g
, int spc
, int flags
)
90 pretty_printer buffer
;
91 pp_needs_newline (&buffer
) = true;
92 buffer
.buffer
->stream
= file
;
93 pp_gimple_stmt_1 (&buffer
, g
, spc
, flags
);
94 pp_newline_and_flush (&buffer
);
100 print_gimple_stmt (stderr
, &ref
, 0, 0);
109 fprintf (stderr
, "<nil>\n");
113 /* Print GIMPLE statement G to FILE using SPC indentation spaces and
114 FLAGS as in pp_gimple_stmt_1. Print only the right-hand side
118 print_gimple_expr (FILE *file
, gimple
*g
, int spc
, int flags
)
120 flags
|= TDF_RHS_ONLY
;
121 pretty_printer buffer
;
122 pp_needs_newline (&buffer
) = true;
123 buffer
.buffer
->stream
= file
;
124 pp_gimple_stmt_1 (&buffer
, g
, spc
, flags
);
129 /* Print the GIMPLE sequence SEQ on BUFFER using SPC indentation
130 spaces and FLAGS as in pp_gimple_stmt_1.
131 The caller is responsible for calling pp_flush on BUFFER to finalize
132 the pretty printer. */
135 dump_gimple_seq (pretty_printer
*buffer
, gimple_seq seq
, int spc
, int flags
)
137 gimple_stmt_iterator i
;
139 for (i
= gsi_start (seq
); !gsi_end_p (i
); gsi_next (&i
))
141 gimple
*gs
= gsi_stmt (i
);
143 pp_gimple_stmt_1 (buffer
, gs
, spc
, flags
);
144 if (!gsi_one_before_end_p (i
))
150 /* Print GIMPLE sequence SEQ to FILE using SPC indentation spaces and
151 FLAGS as in pp_gimple_stmt_1. */
154 print_gimple_seq (FILE *file
, gimple_seq seq
, int spc
, int flags
)
156 pretty_printer buffer
;
157 pp_needs_newline (&buffer
) = true;
158 buffer
.buffer
->stream
= file
;
159 dump_gimple_seq (&buffer
, seq
, spc
, flags
);
160 pp_newline_and_flush (&buffer
);
164 /* Print the GIMPLE sequence SEQ on stderr. */
167 debug_gimple_seq (gimple_seq seq
)
169 print_gimple_seq (stderr
, seq
, 0, TDF_VOPS
|TDF_MEMSYMS
);
173 /* A simple helper to pretty-print some of the gimple tuples in the printf
174 style. The format modifiers are preceded by '%' and are:
175 'G' - outputs a string corresponding to the code of the given gimple,
176 'S' - outputs a gimple_seq with indent of spc + 2,
177 'T' - outputs the tree t,
178 'd' - outputs an int as a decimal,
179 's' - outputs a string,
180 'n' - outputs a newline,
181 'x' - outputs an int as hexadecimal,
182 '+' - increases indent by 2 then outputs a newline,
183 '-' - decreases indent by 2 then outputs a newline. */
186 dump_gimple_fmt (pretty_printer
*buffer
, int spc
, int flags
,
187 const char *fmt
, ...)
193 va_start (args
, fmt
);
194 for (c
= fmt
; *c
; c
++)
204 g
= va_arg (args
, gimple
*);
205 tmp
= gimple_code_name
[gimple_code (g
)];
206 pp_string (buffer
, tmp
);
210 seq
= va_arg (args
, gimple_seq
);
212 dump_gimple_seq (buffer
, seq
, spc
+ 2, flags
);
213 newline_and_indent (buffer
, spc
);
217 t
= va_arg (args
, tree
);
219 pp_string (buffer
, "NULL");
221 dump_generic_node (buffer
, t
, spc
, flags
, false);
225 pp_decimal_int (buffer
, va_arg (args
, int));
229 pp_string (buffer
, va_arg (args
, char *));
233 newline_and_indent (buffer
, spc
);
237 pp_scalar (buffer
, "%x", va_arg (args
, int));
242 newline_and_indent (buffer
, spc
);
247 newline_and_indent (buffer
, spc
);
255 pp_character (buffer
, *c
);
261 /* Helper for dump_gimple_assign. Print the unary RHS of the
262 assignment GS. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. */
265 dump_unary_rhs (pretty_printer
*buffer
, gassign
*gs
, int spc
, int flags
)
267 enum tree_code rhs_code
= gimple_assign_rhs_code (gs
);
268 tree lhs
= gimple_assign_lhs (gs
);
269 tree rhs
= gimple_assign_rhs1 (gs
);
273 case VIEW_CONVERT_EXPR
:
275 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
278 case FIXED_CONVERT_EXPR
:
279 case ADDR_SPACE_CONVERT_EXPR
:
283 pp_left_paren (buffer
);
284 dump_generic_node (buffer
, TREE_TYPE (lhs
), spc
, flags
, false);
285 pp_string (buffer
, ") ");
286 if (op_prio (rhs
) < op_code_prio (rhs_code
))
288 pp_left_paren (buffer
);
289 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
290 pp_right_paren (buffer
);
293 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
297 pp_string (buffer
, "((");
298 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
299 pp_string (buffer
, "))");
303 pp_string (buffer
, "ABS_EXPR <");
304 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
309 if (TREE_CODE_CLASS (rhs_code
) == tcc_declaration
310 || TREE_CODE_CLASS (rhs_code
) == tcc_constant
311 || TREE_CODE_CLASS (rhs_code
) == tcc_reference
312 || rhs_code
== SSA_NAME
313 || rhs_code
== ADDR_EXPR
314 || rhs_code
== CONSTRUCTOR
)
316 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
319 else if (rhs_code
== BIT_NOT_EXPR
)
320 pp_complement (buffer
);
321 else if (rhs_code
== TRUTH_NOT_EXPR
)
322 pp_exclamation (buffer
);
323 else if (rhs_code
== NEGATE_EXPR
)
327 pp_left_bracket (buffer
);
328 pp_string (buffer
, get_tree_code_name (rhs_code
));
329 pp_string (buffer
, "] ");
332 if (op_prio (rhs
) < op_code_prio (rhs_code
))
334 pp_left_paren (buffer
);
335 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
336 pp_right_paren (buffer
);
339 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
345 /* Helper for dump_gimple_assign. Print the binary RHS of the
346 assignment GS. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. */
349 dump_binary_rhs (pretty_printer
*buffer
, gassign
*gs
, int spc
, int flags
)
352 enum tree_code code
= gimple_assign_rhs_code (gs
);
358 case VEC_WIDEN_MULT_HI_EXPR
:
359 case VEC_WIDEN_MULT_LO_EXPR
:
360 case VEC_WIDEN_MULT_EVEN_EXPR
:
361 case VEC_WIDEN_MULT_ODD_EXPR
:
362 case VEC_PACK_TRUNC_EXPR
:
363 case VEC_PACK_SAT_EXPR
:
364 case VEC_PACK_FIX_TRUNC_EXPR
:
365 case VEC_WIDEN_LSHIFT_HI_EXPR
:
366 case VEC_WIDEN_LSHIFT_LO_EXPR
:
367 for (p
= get_tree_code_name (code
); *p
; p
++)
368 pp_character (buffer
, TOUPPER (*p
));
369 pp_string (buffer
, " <");
370 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
371 pp_string (buffer
, ", ");
372 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
377 if (op_prio (gimple_assign_rhs1 (gs
)) <= op_code_prio (code
))
379 pp_left_paren (buffer
);
380 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
,
382 pp_right_paren (buffer
);
385 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
387 pp_string (buffer
, op_symbol_code (gimple_assign_rhs_code (gs
)));
389 if (op_prio (gimple_assign_rhs2 (gs
)) <= op_code_prio (code
))
391 pp_left_paren (buffer
);
392 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
,
394 pp_right_paren (buffer
);
397 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
401 /* Helper for dump_gimple_assign. Print the ternary RHS of the
402 assignment GS. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. */
405 dump_ternary_rhs (pretty_printer
*buffer
, gassign
*gs
, int spc
, int flags
)
408 enum tree_code code
= gimple_assign_rhs_code (gs
);
411 case WIDEN_MULT_PLUS_EXPR
:
412 case WIDEN_MULT_MINUS_EXPR
:
413 for (p
= get_tree_code_name (code
); *p
; p
++)
414 pp_character (buffer
, TOUPPER (*p
));
415 pp_string (buffer
, " <");
416 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
417 pp_string (buffer
, ", ");
418 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
419 pp_string (buffer
, ", ");
420 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
425 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
426 pp_string (buffer
, " * ");
427 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
428 pp_string (buffer
, " + ");
429 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
433 pp_string (buffer
, "DOT_PROD_EXPR <");
434 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
435 pp_string (buffer
, ", ");
436 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
437 pp_string (buffer
, ", ");
438 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
443 pp_string (buffer
, "SAD_EXPR <");
444 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
445 pp_string (buffer
, ", ");
446 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
447 pp_string (buffer
, ", ");
448 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
453 pp_string (buffer
, "VEC_PERM_EXPR <");
454 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
455 pp_string (buffer
, ", ");
456 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
457 pp_string (buffer
, ", ");
458 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
462 case REALIGN_LOAD_EXPR
:
463 pp_string (buffer
, "REALIGN_LOAD <");
464 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
465 pp_string (buffer
, ", ");
466 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
467 pp_string (buffer
, ", ");
468 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
473 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
474 pp_string (buffer
, " ? ");
475 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
476 pp_string (buffer
, " : ");
477 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
481 pp_string (buffer
, "VEC_COND_EXPR <");
482 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
483 pp_string (buffer
, ", ");
484 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
485 pp_string (buffer
, ", ");
486 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
490 case BIT_INSERT_EXPR
:
491 pp_string (buffer
, "BIT_INSERT_EXPR <");
492 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
493 pp_string (buffer
, ", ");
494 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
495 pp_string (buffer
, ", ");
496 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
497 pp_string (buffer
, " (");
498 if (INTEGRAL_TYPE_P (TREE_TYPE (gimple_assign_rhs2 (gs
))))
499 pp_decimal_int (buffer
,
500 TYPE_PRECISION (TREE_TYPE (gimple_assign_rhs2 (gs
))));
502 dump_generic_node (buffer
,
503 TYPE_SIZE (TREE_TYPE (gimple_assign_rhs2 (gs
))),
505 pp_string (buffer
, " bits)>");
514 /* Dump the gimple assignment GS. BUFFER, SPC and FLAGS are as in
518 dump_gimple_assign (pretty_printer
*buffer
, gassign
*gs
, int spc
, int flags
)
525 switch (gimple_num_ops (gs
))
528 arg3
= gimple_assign_rhs3 (gs
);
531 arg2
= gimple_assign_rhs2 (gs
);
534 arg1
= gimple_assign_rhs1 (gs
);
540 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%s, %T, %T, %T, %T>", gs
,
541 get_tree_code_name (gimple_assign_rhs_code (gs
)),
542 gimple_assign_lhs (gs
), arg1
, arg2
, arg3
);
546 if (!(flags
& TDF_RHS_ONLY
))
548 dump_generic_node (buffer
, gimple_assign_lhs (gs
), spc
, flags
, false);
552 if (gimple_assign_nontemporal_move_p (gs
))
553 pp_string (buffer
, "{nt}");
555 if (gimple_has_volatile_ops (gs
))
556 pp_string (buffer
, "{v}");
561 if (gimple_num_ops (gs
) == 2)
562 dump_unary_rhs (buffer
, gs
, spc
, flags
);
563 else if (gimple_num_ops (gs
) == 3)
564 dump_binary_rhs (buffer
, gs
, spc
, flags
);
565 else if (gimple_num_ops (gs
) == 4)
566 dump_ternary_rhs (buffer
, gs
, spc
, flags
);
569 if (!(flags
& TDF_RHS_ONLY
))
570 pp_semicolon (buffer
);
575 /* Dump the return statement GS. BUFFER, SPC and FLAGS are as in
579 dump_gimple_return (pretty_printer
*buffer
, greturn
*gs
, int spc
, int flags
)
583 t
= gimple_return_retval (gs
);
584 t2
= gimple_return_retbnd (gs
);
586 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T %T>", gs
, t
, t2
);
589 pp_string (buffer
, "return");
593 dump_generic_node (buffer
, t
, spc
, flags
, false);
597 pp_string (buffer
, ", ");
598 dump_generic_node (buffer
, t2
, spc
, flags
, false);
600 pp_semicolon (buffer
);
605 /* Dump the call arguments for a gimple call. BUFFER, FLAGS are as in
609 dump_gimple_call_args (pretty_printer
*buffer
, gcall
*gs
, int flags
)
613 /* Pretty print first arg to certain internal fns. */
614 if (gimple_call_internal_p (gs
))
616 const char *const *enums
= NULL
;
619 switch (gimple_call_internal_fn (gs
))
623 static const char *const unique_args
[] = {IFN_UNIQUE_CODES
};
627 limit
= ARRAY_SIZE (unique_args
);
632 static const char *const loop_args
[] = {IFN_GOACC_LOOP_CODES
};
635 limit
= ARRAY_SIZE (loop_args
);
638 case IFN_GOACC_REDUCTION
:
640 static const char *const reduction_args
[]
641 = {IFN_GOACC_REDUCTION_CODES
};
643 enums
= reduction_args
;
644 limit
= ARRAY_SIZE (reduction_args
);
652 tree arg0
= gimple_call_arg (gs
, 0);
655 if (TREE_CODE (arg0
) == INTEGER_CST
656 && tree_fits_shwi_p (arg0
)
657 && (v
= tree_to_shwi (arg0
)) >= 0 && v
< limit
)
660 pp_string (buffer
, enums
[v
]);
665 for (; i
< gimple_call_num_args (gs
); i
++)
668 pp_string (buffer
, ", ");
669 dump_generic_node (buffer
, gimple_call_arg (gs
, i
), 0, flags
, false);
672 if (gimple_call_va_arg_pack_p (gs
))
675 pp_string (buffer
, ", ");
677 pp_string (buffer
, "__builtin_va_arg_pack ()");
681 /* Dump the points-to solution *PT to BUFFER. */
684 pp_points_to_solution (pretty_printer
*buffer
, struct pt_solution
*pt
)
688 pp_string (buffer
, "anything ");
692 pp_string (buffer
, "nonlocal ");
694 pp_string (buffer
, "escaped ");
696 pp_string (buffer
, "unit-escaped ");
698 pp_string (buffer
, "null ");
700 && !bitmap_empty_p (pt
->vars
))
704 pp_string (buffer
, "{ ");
705 EXECUTE_IF_SET_IN_BITMAP (pt
->vars
, 0, i
, bi
)
707 pp_string (buffer
, "D.");
708 pp_decimal_int (buffer
, i
);
711 pp_right_brace (buffer
);
712 if (pt
->vars_contains_nonlocal
713 || pt
->vars_contains_escaped
714 || pt
->vars_contains_escaped_heap
715 || pt
->vars_contains_restrict
)
717 const char *comma
= "";
718 pp_string (buffer
, " (");
719 if (pt
->vars_contains_nonlocal
)
721 pp_string (buffer
, "nonlocal");
724 if (pt
->vars_contains_escaped
)
726 pp_string (buffer
, comma
);
727 pp_string (buffer
, "escaped");
730 if (pt
->vars_contains_escaped_heap
)
732 pp_string (buffer
, comma
);
733 pp_string (buffer
, "escaped heap");
736 if (pt
->vars_contains_restrict
)
738 pp_string (buffer
, comma
);
739 pp_string (buffer
, "restrict");
742 if (pt
->vars_contains_interposable
)
744 pp_string (buffer
, comma
);
745 pp_string (buffer
, "interposable");
747 pp_string (buffer
, ")");
753 /* Dump the call statement GS. BUFFER, SPC and FLAGS are as in
757 dump_gimple_call (pretty_printer
*buffer
, gcall
*gs
, int spc
, int flags
)
759 tree lhs
= gimple_call_lhs (gs
);
760 tree fn
= gimple_call_fn (gs
);
762 if (flags
& TDF_ALIAS
)
764 struct pt_solution
*pt
;
765 pt
= gimple_call_use_set (gs
);
766 if (!pt_solution_empty_p (pt
))
768 pp_string (buffer
, "# USE = ");
769 pp_points_to_solution (buffer
, pt
);
770 newline_and_indent (buffer
, spc
);
772 pt
= gimple_call_clobber_set (gs
);
773 if (!pt_solution_empty_p (pt
))
775 pp_string (buffer
, "# CLB = ");
776 pp_points_to_solution (buffer
, pt
);
777 newline_and_indent (buffer
, spc
);
783 if (gimple_call_internal_p (gs
))
784 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%s, %T", gs
,
785 internal_fn_name (gimple_call_internal_fn (gs
)), lhs
);
787 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T", gs
, fn
, lhs
);
788 if (gimple_call_num_args (gs
) > 0)
790 pp_string (buffer
, ", ");
791 dump_gimple_call_args (buffer
, gs
, flags
);
797 if (lhs
&& !(flags
& TDF_RHS_ONLY
))
799 dump_generic_node (buffer
, lhs
, spc
, flags
, false);
800 pp_string (buffer
, " =");
802 if (gimple_has_volatile_ops (gs
))
803 pp_string (buffer
, "{v}");
807 if (gimple_call_internal_p (gs
))
808 pp_string (buffer
, internal_fn_name (gimple_call_internal_fn (gs
)));
810 print_call_name (buffer
, fn
, flags
);
811 pp_string (buffer
, " (");
812 dump_gimple_call_args (buffer
, gs
, flags
);
813 pp_right_paren (buffer
);
814 if (!(flags
& TDF_RHS_ONLY
))
815 pp_semicolon (buffer
);
818 if (gimple_call_chain (gs
))
820 pp_string (buffer
, " [static-chain: ");
821 dump_generic_node (buffer
, gimple_call_chain (gs
), spc
, flags
, false);
822 pp_right_bracket (buffer
);
825 if (gimple_call_return_slot_opt_p (gs
))
826 pp_string (buffer
, " [return slot optimization]");
827 if (gimple_call_tail_p (gs
))
828 pp_string (buffer
, " [tail call]");
829 if (gimple_call_must_tail_p (gs
))
830 pp_string (buffer
, " [must tail call]");
835 /* Dump the arguments of _ITM_beginTransaction sanely. */
836 if (TREE_CODE (fn
) == ADDR_EXPR
)
837 fn
= TREE_OPERAND (fn
, 0);
838 if (TREE_CODE (fn
) == FUNCTION_DECL
&& decl_is_tm_clone (fn
))
839 pp_string (buffer
, " [tm-clone]");
840 if (TREE_CODE (fn
) == FUNCTION_DECL
841 && DECL_BUILT_IN_CLASS (fn
) == BUILT_IN_NORMAL
842 && DECL_FUNCTION_CODE (fn
) == BUILT_IN_TM_START
843 && gimple_call_num_args (gs
) > 0)
845 tree t
= gimple_call_arg (gs
, 0);
846 unsigned HOST_WIDE_INT props
;
847 gcc_assert (TREE_CODE (t
) == INTEGER_CST
);
849 pp_string (buffer
, " [ ");
851 /* Get the transaction code properties. */
852 props
= TREE_INT_CST_LOW (t
);
854 if (props
& PR_INSTRUMENTEDCODE
)
855 pp_string (buffer
, "instrumentedCode ");
856 if (props
& PR_UNINSTRUMENTEDCODE
)
857 pp_string (buffer
, "uninstrumentedCode ");
858 if (props
& PR_HASNOXMMUPDATE
)
859 pp_string (buffer
, "hasNoXMMUpdate ");
860 if (props
& PR_HASNOABORT
)
861 pp_string (buffer
, "hasNoAbort ");
862 if (props
& PR_HASNOIRREVOCABLE
)
863 pp_string (buffer
, "hasNoIrrevocable ");
864 if (props
& PR_DOESGOIRREVOCABLE
)
865 pp_string (buffer
, "doesGoIrrevocable ");
866 if (props
& PR_HASNOSIMPLEREADS
)
867 pp_string (buffer
, "hasNoSimpleReads ");
868 if (props
& PR_AWBARRIERSOMITTED
)
869 pp_string (buffer
, "awBarriersOmitted ");
870 if (props
& PR_RARBARRIERSOMITTED
)
871 pp_string (buffer
, "RaRBarriersOmitted ");
872 if (props
& PR_UNDOLOGCODE
)
873 pp_string (buffer
, "undoLogCode ");
874 if (props
& PR_PREFERUNINSTRUMENTED
)
875 pp_string (buffer
, "preferUninstrumented ");
876 if (props
& PR_EXCEPTIONBLOCK
)
877 pp_string (buffer
, "exceptionBlock ");
878 if (props
& PR_HASELSE
)
879 pp_string (buffer
, "hasElse ");
880 if (props
& PR_READONLY
)
881 pp_string (buffer
, "readOnly ");
883 pp_right_bracket (buffer
);
888 /* Dump the switch statement GS. BUFFER, SPC and FLAGS are as in
892 dump_gimple_switch (pretty_printer
*buffer
, gswitch
*gs
, int spc
,
897 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
899 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, ", gs
,
900 gimple_switch_index (gs
));
903 pp_string (buffer
, "switch (");
904 dump_generic_node (buffer
, gimple_switch_index (gs
), spc
, flags
, true);
905 if (flags
& TDF_GIMPLE
)
906 pp_string (buffer
, ") {");
908 pp_string (buffer
, ") <");
911 for (i
= 0; i
< gimple_switch_num_labels (gs
); i
++)
913 tree case_label
= gimple_switch_label (gs
, i
);
914 gcc_checking_assert (case_label
!= NULL_TREE
);
915 dump_generic_node (buffer
, case_label
, spc
, flags
, false);
917 tree label
= CASE_LABEL (case_label
);
918 dump_generic_node (buffer
, label
, spc
, flags
, false);
920 if (cfun
&& cfun
->cfg
)
922 basic_block dest
= label_to_block (label
);
925 edge label_edge
= find_edge (gimple_bb (gs
), dest
);
926 if (label_edge
&& !(flags
& TDF_GIMPLE
))
927 dump_edge_probability (buffer
, label_edge
);
931 if (i
< gimple_switch_num_labels (gs
) - 1)
933 if (flags
& TDF_GIMPLE
)
934 pp_string (buffer
, "; ");
936 pp_string (buffer
, ", ");
939 if (flags
& TDF_GIMPLE
)
940 pp_string (buffer
, "; }");
946 /* Dump the gimple conditional GS. BUFFER, SPC and FLAGS are as in
950 dump_gimple_cond (pretty_printer
*buffer
, gcond
*gs
, int spc
, int flags
)
953 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%s, %T, %T, %T, %T>", gs
,
954 get_tree_code_name (gimple_cond_code (gs
)),
955 gimple_cond_lhs (gs
), gimple_cond_rhs (gs
),
956 gimple_cond_true_label (gs
), gimple_cond_false_label (gs
));
959 if (!(flags
& TDF_RHS_ONLY
))
960 pp_string (buffer
, "if (");
961 dump_generic_node (buffer
, gimple_cond_lhs (gs
), spc
, flags
, false);
963 pp_string (buffer
, op_symbol_code (gimple_cond_code (gs
)));
965 dump_generic_node (buffer
, gimple_cond_rhs (gs
), spc
, flags
, false);
966 if (!(flags
& TDF_RHS_ONLY
))
969 edge e
, true_edge
= NULL
, false_edge
= NULL
;
970 basic_block bb
= gimple_bb (gs
);
974 FOR_EACH_EDGE (e
, ei
, bb
->succs
)
976 if (e
->flags
& EDGE_TRUE_VALUE
)
978 else if (e
->flags
& EDGE_FALSE_VALUE
)
983 bool has_edge_info
= true_edge
!= NULL
&& false_edge
!= NULL
;
985 pp_right_paren (buffer
);
987 if (gimple_cond_true_label (gs
))
989 pp_string (buffer
, " goto ");
990 dump_generic_node (buffer
, gimple_cond_true_label (gs
),
992 if (has_edge_info
&& !(flags
& TDF_GIMPLE
))
993 dump_edge_probability (buffer
, true_edge
);
994 pp_semicolon (buffer
);
996 if (gimple_cond_false_label (gs
))
998 pp_string (buffer
, " else goto ");
999 dump_generic_node (buffer
, gimple_cond_false_label (gs
),
1001 if (has_edge_info
&& !(flags
& TDF_GIMPLE
))
1002 dump_edge_probability (buffer
, false_edge
);
1004 pp_semicolon (buffer
);
1011 /* Dump a GIMPLE_LABEL tuple on the pretty_printer BUFFER, SPC
1012 spaces of indent. FLAGS specifies details to show in the dump (see
1013 TDF_* in dumpfils.h). */
1016 dump_gimple_label (pretty_printer
*buffer
, glabel
*gs
, int spc
, int flags
)
1018 tree label
= gimple_label_label (gs
);
1019 if (flags
& TDF_RAW
)
1020 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
, label
);
1023 dump_generic_node (buffer
, label
, spc
, flags
, false);
1024 basic_block bb
= gimple_bb (gs
);
1025 if (bb
&& !(flags
& TDF_GIMPLE
))
1026 pp_scalar (buffer
, " [%.1f%%]",
1027 bb
->frequency
* 100.0 / REG_BR_PROB_BASE
);
1030 if (flags
& TDF_GIMPLE
)
1032 if (DECL_NONLOCAL (label
))
1033 pp_string (buffer
, " [non-local]");
1034 if ((flags
& TDF_EH
) && EH_LANDING_PAD_NR (label
))
1035 pp_printf (buffer
, " [LP %d]", EH_LANDING_PAD_NR (label
));
1038 /* Dump a GIMPLE_GOTO tuple on the pretty_printer BUFFER, SPC
1039 spaces of indent. FLAGS specifies details to show in the dump (see
1040 TDF_* in dumpfile.h). */
1043 dump_gimple_goto (pretty_printer
*buffer
, ggoto
*gs
, int spc
, int flags
)
1045 tree label
= gimple_goto_dest (gs
);
1046 if (flags
& TDF_RAW
)
1047 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
, label
);
1049 dump_gimple_fmt (buffer
, spc
, flags
, "goto %T;", label
);
1053 /* Dump a GIMPLE_BIND tuple on the pretty_printer BUFFER, SPC
1054 spaces of indent. FLAGS specifies details to show in the dump (see
1055 TDF_* in dumpfile.h). */
1058 dump_gimple_bind (pretty_printer
*buffer
, gbind
*gs
, int spc
, int flags
)
1060 if (flags
& TDF_RAW
)
1061 dump_gimple_fmt (buffer
, spc
, flags
, "%G <", gs
);
1063 pp_left_brace (buffer
);
1064 if (!(flags
& TDF_SLIM
))
1068 for (var
= gimple_bind_vars (gs
); var
; var
= DECL_CHAIN (var
))
1070 newline_and_indent (buffer
, 2);
1071 print_declaration (buffer
, var
, spc
, flags
);
1073 if (gimple_bind_vars (gs
))
1074 pp_newline (buffer
);
1076 pp_newline (buffer
);
1077 dump_gimple_seq (buffer
, gimple_bind_body (gs
), spc
+ 2, flags
);
1078 newline_and_indent (buffer
, spc
);
1079 if (flags
& TDF_RAW
)
1080 pp_greater (buffer
);
1082 pp_right_brace (buffer
);
1086 /* Dump a GIMPLE_TRY tuple on the pretty_printer BUFFER, SPC spaces of
1087 indent. FLAGS specifies details to show in the dump (see TDF_* in
1091 dump_gimple_try (pretty_printer
*buffer
, gtry
*gs
, int spc
, int flags
)
1093 if (flags
& TDF_RAW
)
1096 if (gimple_try_kind (gs
) == GIMPLE_TRY_CATCH
)
1097 type
= "GIMPLE_TRY_CATCH";
1098 else if (gimple_try_kind (gs
) == GIMPLE_TRY_FINALLY
)
1099 type
= "GIMPLE_TRY_FINALLY";
1101 type
= "UNKNOWN GIMPLE_TRY";
1102 dump_gimple_fmt (buffer
, spc
, flags
,
1103 "%G <%s,%+EVAL <%S>%nCLEANUP <%S>%->", gs
, type
,
1104 gimple_try_eval (gs
), gimple_try_cleanup (gs
));
1108 pp_string (buffer
, "try");
1109 newline_and_indent (buffer
, spc
+ 2);
1110 pp_left_brace (buffer
);
1111 pp_newline (buffer
);
1113 dump_gimple_seq (buffer
, gimple_try_eval (gs
), spc
+ 4, flags
);
1114 newline_and_indent (buffer
, spc
+ 2);
1115 pp_right_brace (buffer
);
1117 if (gimple_try_kind (gs
) == GIMPLE_TRY_CATCH
)
1119 newline_and_indent (buffer
, spc
);
1120 pp_string (buffer
, "catch");
1121 newline_and_indent (buffer
, spc
+ 2);
1122 pp_left_brace (buffer
);
1124 else if (gimple_try_kind (gs
) == GIMPLE_TRY_FINALLY
)
1126 newline_and_indent (buffer
, spc
);
1127 pp_string (buffer
, "finally");
1128 newline_and_indent (buffer
, spc
+ 2);
1129 pp_left_brace (buffer
);
1132 pp_string (buffer
, " <UNKNOWN GIMPLE_TRY> {");
1134 pp_newline (buffer
);
1135 dump_gimple_seq (buffer
, gimple_try_cleanup (gs
), spc
+ 4, flags
);
1136 newline_and_indent (buffer
, spc
+ 2);
1137 pp_right_brace (buffer
);
1142 /* Dump a GIMPLE_CATCH tuple on the pretty_printer BUFFER, SPC spaces of
1143 indent. FLAGS specifies details to show in the dump (see TDF_* in
1147 dump_gimple_catch (pretty_printer
*buffer
, gcatch
*gs
, int spc
, int flags
)
1149 if (flags
& TDF_RAW
)
1150 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %+CATCH <%S>%->", gs
,
1151 gimple_catch_types (gs
), gimple_catch_handler (gs
));
1153 dump_gimple_fmt (buffer
, spc
, flags
, "catch (%T)%+{%S}",
1154 gimple_catch_types (gs
), gimple_catch_handler (gs
));
1158 /* Dump a GIMPLE_EH_FILTER tuple on the pretty_printer BUFFER, SPC spaces of
1159 indent. FLAGS specifies details to show in the dump (see TDF_* in
1163 dump_gimple_eh_filter (pretty_printer
*buffer
, geh_filter
*gs
, int spc
,
1166 if (flags
& TDF_RAW
)
1167 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %+FAILURE <%S>%->", gs
,
1168 gimple_eh_filter_types (gs
),
1169 gimple_eh_filter_failure (gs
));
1171 dump_gimple_fmt (buffer
, spc
, flags
, "<<<eh_filter (%T)>>>%+{%+%S%-}",
1172 gimple_eh_filter_types (gs
),
1173 gimple_eh_filter_failure (gs
));
1177 /* Dump a GIMPLE_EH_MUST_NOT_THROW tuple. */
1180 dump_gimple_eh_must_not_throw (pretty_printer
*buffer
,
1181 geh_mnt
*gs
, int spc
, int flags
)
1183 if (flags
& TDF_RAW
)
1184 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
,
1185 gimple_eh_must_not_throw_fndecl (gs
));
1187 dump_gimple_fmt (buffer
, spc
, flags
, "<<<eh_must_not_throw (%T)>>>",
1188 gimple_eh_must_not_throw_fndecl (gs
));
1192 /* Dump a GIMPLE_EH_ELSE tuple on the pretty_printer BUFFER, SPC spaces of
1193 indent. FLAGS specifies details to show in the dump (see TDF_* in
1197 dump_gimple_eh_else (pretty_printer
*buffer
, geh_else
*gs
, int spc
,
1200 if (flags
& TDF_RAW
)
1201 dump_gimple_fmt (buffer
, spc
, flags
,
1202 "%G <%+N_BODY <%S>%nE_BODY <%S>%->", gs
,
1203 gimple_eh_else_n_body (gs
), gimple_eh_else_e_body (gs
));
1205 dump_gimple_fmt (buffer
, spc
, flags
,
1206 "<<<if_normal_exit>>>%+{%S}%-<<<else_eh_exit>>>%+{%S}",
1207 gimple_eh_else_n_body (gs
), gimple_eh_else_e_body (gs
));
1211 /* Dump a GIMPLE_RESX tuple on the pretty_printer BUFFER, SPC spaces of
1212 indent. FLAGS specifies details to show in the dump (see TDF_* in
1216 dump_gimple_resx (pretty_printer
*buffer
, gresx
*gs
, int spc
, int flags
)
1218 if (flags
& TDF_RAW
)
1219 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%d>", gs
,
1220 gimple_resx_region (gs
));
1222 dump_gimple_fmt (buffer
, spc
, flags
, "resx %d", gimple_resx_region (gs
));
1225 /* Dump a GIMPLE_EH_DISPATCH tuple on the pretty_printer BUFFER. */
1228 dump_gimple_eh_dispatch (pretty_printer
*buffer
, geh_dispatch
*gs
, int spc
, int flags
)
1230 if (flags
& TDF_RAW
)
1231 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%d>", gs
,
1232 gimple_eh_dispatch_region (gs
));
1234 dump_gimple_fmt (buffer
, spc
, flags
, "eh_dispatch %d",
1235 gimple_eh_dispatch_region (gs
));
1238 /* Dump a GIMPLE_DEBUG tuple on the pretty_printer BUFFER, SPC spaces
1239 of indent. FLAGS specifies details to show in the dump (see TDF_*
1243 dump_gimple_debug (pretty_printer
*buffer
, gdebug
*gs
, int spc
, int flags
)
1245 switch (gs
->subcode
)
1247 case GIMPLE_DEBUG_BIND
:
1248 if (flags
& TDF_RAW
)
1249 dump_gimple_fmt (buffer
, spc
, flags
, "%G BIND <%T, %T>", gs
,
1250 gimple_debug_bind_get_var (gs
),
1251 gimple_debug_bind_get_value (gs
));
1253 dump_gimple_fmt (buffer
, spc
, flags
, "# DEBUG %T => %T",
1254 gimple_debug_bind_get_var (gs
),
1255 gimple_debug_bind_get_value (gs
));
1258 case GIMPLE_DEBUG_SOURCE_BIND
:
1259 if (flags
& TDF_RAW
)
1260 dump_gimple_fmt (buffer
, spc
, flags
, "%G SRCBIND <%T, %T>", gs
,
1261 gimple_debug_source_bind_get_var (gs
),
1262 gimple_debug_source_bind_get_value (gs
));
1264 dump_gimple_fmt (buffer
, spc
, flags
, "# DEBUG %T s=> %T",
1265 gimple_debug_source_bind_get_var (gs
),
1266 gimple_debug_source_bind_get_value (gs
));
1274 /* Dump a GIMPLE_OMP_FOR tuple on the pretty_printer BUFFER. */
1276 dump_gimple_omp_for (pretty_printer
*buffer
, gomp_for
*gs
, int spc
, int flags
)
1280 if (flags
& TDF_RAW
)
1283 switch (gimple_omp_for_kind (gs
))
1285 case GF_OMP_FOR_KIND_FOR
:
1288 case GF_OMP_FOR_KIND_DISTRIBUTE
:
1289 kind
= " distribute";
1291 case GF_OMP_FOR_KIND_TASKLOOP
:
1294 case GF_OMP_FOR_KIND_CILKFOR
:
1295 kind
= " _Cilk_for";
1297 case GF_OMP_FOR_KIND_OACC_LOOP
:
1298 kind
= " oacc_loop";
1300 case GF_OMP_FOR_KIND_SIMD
:
1303 case GF_OMP_FOR_KIND_CILKSIMD
:
1309 dump_gimple_fmt (buffer
, spc
, flags
, "%G%s <%+BODY <%S>%nCLAUSES <", gs
,
1310 kind
, gimple_omp_body (gs
));
1311 dump_omp_clauses (buffer
, gimple_omp_for_clauses (gs
), spc
, flags
);
1312 dump_gimple_fmt (buffer
, spc
, flags
, " >,");
1313 for (i
= 0; i
< gimple_omp_for_collapse (gs
); i
++)
1314 dump_gimple_fmt (buffer
, spc
, flags
,
1315 "%+%T, %T, %T, %s, %T,%n",
1316 gimple_omp_for_index (gs
, i
),
1317 gimple_omp_for_initial (gs
, i
),
1318 gimple_omp_for_final (gs
, i
),
1319 get_tree_code_name (gimple_omp_for_cond (gs
, i
)),
1320 gimple_omp_for_incr (gs
, i
));
1321 dump_gimple_fmt (buffer
, spc
, flags
, "PRE_BODY <%S>%->",
1322 gimple_omp_for_pre_body (gs
));
1326 switch (gimple_omp_for_kind (gs
))
1328 case GF_OMP_FOR_KIND_FOR
:
1329 pp_string (buffer
, "#pragma omp for");
1331 case GF_OMP_FOR_KIND_DISTRIBUTE
:
1332 pp_string (buffer
, "#pragma omp distribute");
1334 case GF_OMP_FOR_KIND_TASKLOOP
:
1335 pp_string (buffer
, "#pragma omp taskloop");
1337 case GF_OMP_FOR_KIND_CILKFOR
:
1339 case GF_OMP_FOR_KIND_OACC_LOOP
:
1340 pp_string (buffer
, "#pragma acc loop");
1342 case GF_OMP_FOR_KIND_SIMD
:
1343 pp_string (buffer
, "#pragma omp simd");
1345 case GF_OMP_FOR_KIND_CILKSIMD
:
1346 pp_string (buffer
, "#pragma simd");
1348 case GF_OMP_FOR_KIND_GRID_LOOP
:
1349 pp_string (buffer
, "#pragma omp for grid_loop");
1354 if (gimple_omp_for_kind (gs
) != GF_OMP_FOR_KIND_CILKFOR
)
1355 dump_omp_clauses (buffer
, gimple_omp_for_clauses (gs
), spc
, flags
);
1356 for (i
= 0; i
< gimple_omp_for_collapse (gs
); i
++)
1360 if (gimple_omp_for_kind (gs
) == GF_OMP_FOR_KIND_CILKFOR
)
1361 pp_string (buffer
, "_Cilk_for (");
1364 newline_and_indent (buffer
, spc
);
1365 pp_string (buffer
, "for (");
1367 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
1369 pp_string (buffer
, " = ");
1370 dump_generic_node (buffer
, gimple_omp_for_initial (gs
, i
), spc
,
1372 pp_string (buffer
, "; ");
1374 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
1377 switch (gimple_omp_for_cond (gs
, i
))
1383 pp_greater (buffer
);
1386 pp_less_equal (buffer
);
1389 pp_greater_equal (buffer
);
1392 pp_string (buffer
, "!=");
1398 dump_generic_node (buffer
, gimple_omp_for_final (gs
, i
), spc
,
1400 pp_string (buffer
, "; ");
1402 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
1404 pp_string (buffer
, " = ");
1405 dump_generic_node (buffer
, gimple_omp_for_incr (gs
, i
), spc
,
1407 pp_right_paren (buffer
);
1410 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1412 if (gimple_omp_for_kind (gs
) == GF_OMP_FOR_KIND_CILKFOR
)
1413 dump_omp_clauses (buffer
, gimple_omp_for_clauses (gs
), spc
, flags
);
1414 newline_and_indent (buffer
, spc
+ 2);
1415 pp_left_brace (buffer
);
1416 pp_newline (buffer
);
1417 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1418 newline_and_indent (buffer
, spc
+ 2);
1419 pp_right_brace (buffer
);
1424 /* Dump a GIMPLE_OMP_CONTINUE tuple on the pretty_printer BUFFER. */
1427 dump_gimple_omp_continue (pretty_printer
*buffer
, gomp_continue
*gs
,
1430 if (flags
& TDF_RAW
)
1432 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T>", gs
,
1433 gimple_omp_continue_control_def (gs
),
1434 gimple_omp_continue_control_use (gs
));
1438 pp_string (buffer
, "#pragma omp continue (");
1439 dump_generic_node (buffer
, gimple_omp_continue_control_def (gs
),
1443 dump_generic_node (buffer
, gimple_omp_continue_control_use (gs
),
1445 pp_right_paren (buffer
);
1449 /* Dump a GIMPLE_OMP_SINGLE tuple on the pretty_printer BUFFER. */
1452 dump_gimple_omp_single (pretty_printer
*buffer
, gomp_single
*gs
,
1455 if (flags
& TDF_RAW
)
1457 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1458 gimple_omp_body (gs
));
1459 dump_omp_clauses (buffer
, gimple_omp_single_clauses (gs
), spc
, flags
);
1460 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1464 pp_string (buffer
, "#pragma omp single");
1465 dump_omp_clauses (buffer
, gimple_omp_single_clauses (gs
), spc
, flags
);
1466 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1468 newline_and_indent (buffer
, spc
+ 2);
1469 pp_left_brace (buffer
);
1470 pp_newline (buffer
);
1471 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1472 newline_and_indent (buffer
, spc
+ 2);
1473 pp_right_brace (buffer
);
1478 /* Dump a GIMPLE_OMP_TARGET tuple on the pretty_printer BUFFER. */
1481 dump_gimple_omp_target (pretty_printer
*buffer
, gomp_target
*gs
,
1485 switch (gimple_omp_target_kind (gs
))
1487 case GF_OMP_TARGET_KIND_REGION
:
1490 case GF_OMP_TARGET_KIND_DATA
:
1493 case GF_OMP_TARGET_KIND_UPDATE
:
1496 case GF_OMP_TARGET_KIND_ENTER_DATA
:
1497 kind
= " enter data";
1499 case GF_OMP_TARGET_KIND_EXIT_DATA
:
1500 kind
= " exit data";
1502 case GF_OMP_TARGET_KIND_OACC_KERNELS
:
1503 kind
= " oacc_kernels";
1505 case GF_OMP_TARGET_KIND_OACC_PARALLEL
:
1506 kind
= " oacc_parallel";
1508 case GF_OMP_TARGET_KIND_OACC_DATA
:
1509 kind
= " oacc_data";
1511 case GF_OMP_TARGET_KIND_OACC_UPDATE
:
1512 kind
= " oacc_update";
1514 case GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA
:
1515 kind
= " oacc_enter_exit_data";
1517 case GF_OMP_TARGET_KIND_OACC_DECLARE
:
1518 kind
= " oacc_declare";
1520 case GF_OMP_TARGET_KIND_OACC_HOST_DATA
:
1521 kind
= " oacc_host_data";
1526 if (flags
& TDF_RAW
)
1528 dump_gimple_fmt (buffer
, spc
, flags
, "%G%s <%+BODY <%S>%nCLAUSES <", gs
,
1529 kind
, gimple_omp_body (gs
));
1530 dump_omp_clauses (buffer
, gimple_omp_target_clauses (gs
), spc
, flags
);
1531 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T%n>",
1532 gimple_omp_target_child_fn (gs
),
1533 gimple_omp_target_data_arg (gs
));
1537 pp_string (buffer
, "#pragma omp target");
1538 pp_string (buffer
, kind
);
1539 dump_omp_clauses (buffer
, gimple_omp_target_clauses (gs
), spc
, flags
);
1540 if (gimple_omp_target_child_fn (gs
))
1542 pp_string (buffer
, " [child fn: ");
1543 dump_generic_node (buffer
, gimple_omp_target_child_fn (gs
),
1545 pp_string (buffer
, " (");
1546 if (gimple_omp_target_data_arg (gs
))
1547 dump_generic_node (buffer
, gimple_omp_target_data_arg (gs
),
1550 pp_string (buffer
, "???");
1551 pp_string (buffer
, ")]");
1553 gimple_seq body
= gimple_omp_body (gs
);
1554 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
1556 newline_and_indent (buffer
, spc
+ 2);
1557 pp_left_brace (buffer
);
1558 pp_newline (buffer
);
1559 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
1560 newline_and_indent (buffer
, spc
+ 2);
1561 pp_right_brace (buffer
);
1565 pp_newline (buffer
);
1566 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
1571 /* Dump a GIMPLE_OMP_TEAMS tuple on the pretty_printer BUFFER. */
1574 dump_gimple_omp_teams (pretty_printer
*buffer
, gomp_teams
*gs
, int spc
,
1577 if (flags
& TDF_RAW
)
1579 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1580 gimple_omp_body (gs
));
1581 dump_omp_clauses (buffer
, gimple_omp_teams_clauses (gs
), spc
, flags
);
1582 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1586 pp_string (buffer
, "#pragma omp teams");
1587 dump_omp_clauses (buffer
, gimple_omp_teams_clauses (gs
), spc
, flags
);
1588 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1590 newline_and_indent (buffer
, spc
+ 2);
1591 pp_character (buffer
, '{');
1592 pp_newline (buffer
);
1593 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1594 newline_and_indent (buffer
, spc
+ 2);
1595 pp_character (buffer
, '}');
1600 /* Dump a GIMPLE_OMP_SECTIONS tuple on the pretty_printer BUFFER. */
1603 dump_gimple_omp_sections (pretty_printer
*buffer
, gomp_sections
*gs
,
1606 if (flags
& TDF_RAW
)
1608 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1609 gimple_omp_body (gs
));
1610 dump_omp_clauses (buffer
, gimple_omp_sections_clauses (gs
), spc
, flags
);
1611 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1615 pp_string (buffer
, "#pragma omp sections");
1616 if (gimple_omp_sections_control (gs
))
1618 pp_string (buffer
, " <");
1619 dump_generic_node (buffer
, gimple_omp_sections_control (gs
), spc
,
1621 pp_greater (buffer
);
1623 dump_omp_clauses (buffer
, gimple_omp_sections_clauses (gs
), spc
, flags
);
1624 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1626 newline_and_indent (buffer
, spc
+ 2);
1627 pp_left_brace (buffer
);
1628 pp_newline (buffer
);
1629 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1630 newline_and_indent (buffer
, spc
+ 2);
1631 pp_right_brace (buffer
);
1636 /* Dump a GIMPLE_OMP_{MASTER,TASKGROUP,ORDERED,SECTION} tuple on the
1637 pretty_printer BUFFER. */
1640 dump_gimple_omp_block (pretty_printer
*buffer
, gimple
*gs
, int spc
, int flags
)
1642 if (flags
& TDF_RAW
)
1643 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1644 gimple_omp_body (gs
));
1647 switch (gimple_code (gs
))
1649 case GIMPLE_OMP_MASTER
:
1650 pp_string (buffer
, "#pragma omp master");
1652 case GIMPLE_OMP_TASKGROUP
:
1653 pp_string (buffer
, "#pragma omp taskgroup");
1655 case GIMPLE_OMP_SECTION
:
1656 pp_string (buffer
, "#pragma omp section");
1658 case GIMPLE_OMP_GRID_BODY
:
1659 pp_string (buffer
, "#pragma omp gridified body");
1664 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1666 newline_and_indent (buffer
, spc
+ 2);
1667 pp_left_brace (buffer
);
1668 pp_newline (buffer
);
1669 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1670 newline_and_indent (buffer
, spc
+ 2);
1671 pp_right_brace (buffer
);
1676 /* Dump a GIMPLE_OMP_CRITICAL tuple on the pretty_printer BUFFER. */
1679 dump_gimple_omp_critical (pretty_printer
*buffer
, gomp_critical
*gs
,
1682 if (flags
& TDF_RAW
)
1683 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1684 gimple_omp_body (gs
));
1687 pp_string (buffer
, "#pragma omp critical");
1688 if (gimple_omp_critical_name (gs
))
1690 pp_string (buffer
, " (");
1691 dump_generic_node (buffer
, gimple_omp_critical_name (gs
), spc
,
1693 pp_right_paren (buffer
);
1695 dump_omp_clauses (buffer
, gimple_omp_critical_clauses (gs
), spc
, flags
);
1696 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1698 newline_and_indent (buffer
, spc
+ 2);
1699 pp_left_brace (buffer
);
1700 pp_newline (buffer
);
1701 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1702 newline_and_indent (buffer
, spc
+ 2);
1703 pp_right_brace (buffer
);
1708 /* Dump a GIMPLE_OMP_ORDERED tuple on the pretty_printer BUFFER. */
1711 dump_gimple_omp_ordered (pretty_printer
*buffer
, gomp_ordered
*gs
,
1714 if (flags
& TDF_RAW
)
1715 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1716 gimple_omp_body (gs
));
1719 pp_string (buffer
, "#pragma omp ordered");
1720 dump_omp_clauses (buffer
, gimple_omp_ordered_clauses (gs
), spc
, flags
);
1721 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1723 newline_and_indent (buffer
, spc
+ 2);
1724 pp_left_brace (buffer
);
1725 pp_newline (buffer
);
1726 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1727 newline_and_indent (buffer
, spc
+ 2);
1728 pp_right_brace (buffer
);
1733 /* Dump a GIMPLE_OMP_RETURN tuple on the pretty_printer BUFFER. */
1736 dump_gimple_omp_return (pretty_printer
*buffer
, gimple
*gs
, int spc
, int flags
)
1738 if (flags
& TDF_RAW
)
1740 dump_gimple_fmt (buffer
, spc
, flags
, "%G <nowait=%d", gs
,
1741 (int) gimple_omp_return_nowait_p (gs
));
1742 if (gimple_omp_return_lhs (gs
))
1743 dump_gimple_fmt (buffer
, spc
, flags
, ", lhs=%T>",
1744 gimple_omp_return_lhs (gs
));
1746 dump_gimple_fmt (buffer
, spc
, flags
, ">");
1750 pp_string (buffer
, "#pragma omp return");
1751 if (gimple_omp_return_nowait_p (gs
))
1752 pp_string (buffer
, "(nowait)");
1753 if (gimple_omp_return_lhs (gs
))
1755 pp_string (buffer
, " (set ");
1756 dump_generic_node (buffer
, gimple_omp_return_lhs (gs
),
1758 pp_character (buffer
, ')');
1763 /* Dump a GIMPLE_TRANSACTION tuple on the pretty_printer BUFFER. */
1766 dump_gimple_transaction (pretty_printer
*buffer
, gtransaction
*gs
,
1769 unsigned subcode
= gimple_transaction_subcode (gs
);
1771 if (flags
& TDF_RAW
)
1773 dump_gimple_fmt (buffer
, spc
, flags
,
1774 "%G [SUBCODE=%x,NORM=%T,UNINST=%T,OVER=%T] "
1776 gs
, subcode
, gimple_transaction_label_norm (gs
),
1777 gimple_transaction_label_uninst (gs
),
1778 gimple_transaction_label_over (gs
),
1779 gimple_transaction_body (gs
));
1783 if (subcode
& GTMA_IS_OUTER
)
1784 pp_string (buffer
, "__transaction_atomic [[outer]]");
1785 else if (subcode
& GTMA_IS_RELAXED
)
1786 pp_string (buffer
, "__transaction_relaxed");
1788 pp_string (buffer
, "__transaction_atomic");
1789 subcode
&= ~GTMA_DECLARATION_MASK
;
1791 if (gimple_transaction_body (gs
))
1793 newline_and_indent (buffer
, spc
+ 2);
1794 pp_left_brace (buffer
);
1795 pp_newline (buffer
);
1796 dump_gimple_seq (buffer
, gimple_transaction_body (gs
),
1798 newline_and_indent (buffer
, spc
+ 2);
1799 pp_right_brace (buffer
);
1803 pp_string (buffer
, " //");
1804 if (gimple_transaction_label_norm (gs
))
1806 pp_string (buffer
, " NORM=");
1807 dump_generic_node (buffer
, gimple_transaction_label_norm (gs
),
1810 if (gimple_transaction_label_uninst (gs
))
1812 pp_string (buffer
, " UNINST=");
1813 dump_generic_node (buffer
, gimple_transaction_label_uninst (gs
),
1816 if (gimple_transaction_label_over (gs
))
1818 pp_string (buffer
, " OVER=");
1819 dump_generic_node (buffer
, gimple_transaction_label_over (gs
),
1824 pp_string (buffer
, " SUBCODE=[ ");
1825 if (subcode
& GTMA_HAVE_ABORT
)
1827 pp_string (buffer
, "GTMA_HAVE_ABORT ");
1828 subcode
&= ~GTMA_HAVE_ABORT
;
1830 if (subcode
& GTMA_HAVE_LOAD
)
1832 pp_string (buffer
, "GTMA_HAVE_LOAD ");
1833 subcode
&= ~GTMA_HAVE_LOAD
;
1835 if (subcode
& GTMA_HAVE_STORE
)
1837 pp_string (buffer
, "GTMA_HAVE_STORE ");
1838 subcode
&= ~GTMA_HAVE_STORE
;
1840 if (subcode
& GTMA_MAY_ENTER_IRREVOCABLE
)
1842 pp_string (buffer
, "GTMA_MAY_ENTER_IRREVOCABLE ");
1843 subcode
&= ~GTMA_MAY_ENTER_IRREVOCABLE
;
1845 if (subcode
& GTMA_DOES_GO_IRREVOCABLE
)
1847 pp_string (buffer
, "GTMA_DOES_GO_IRREVOCABLE ");
1848 subcode
&= ~GTMA_DOES_GO_IRREVOCABLE
;
1850 if (subcode
& GTMA_HAS_NO_INSTRUMENTATION
)
1852 pp_string (buffer
, "GTMA_HAS_NO_INSTRUMENTATION ");
1853 subcode
&= ~GTMA_HAS_NO_INSTRUMENTATION
;
1856 pp_printf (buffer
, "0x%x ", subcode
);
1857 pp_right_bracket (buffer
);
1863 /* Dump a GIMPLE_ASM tuple on the pretty_printer BUFFER, SPC spaces of
1864 indent. FLAGS specifies details to show in the dump (see TDF_* in
1868 dump_gimple_asm (pretty_printer
*buffer
, gasm
*gs
, int spc
, int flags
)
1870 unsigned int i
, n
, f
, fields
;
1872 if (flags
& TDF_RAW
)
1874 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+STRING <%n%s%n>", gs
,
1875 gimple_asm_string (gs
));
1877 n
= gimple_asm_noutputs (gs
);
1880 newline_and_indent (buffer
, spc
+ 2);
1881 pp_string (buffer
, "OUTPUT: ");
1882 for (i
= 0; i
< n
; i
++)
1884 dump_generic_node (buffer
, gimple_asm_output_op (gs
, i
),
1887 pp_string (buffer
, ", ");
1891 n
= gimple_asm_ninputs (gs
);
1894 newline_and_indent (buffer
, spc
+ 2);
1895 pp_string (buffer
, "INPUT: ");
1896 for (i
= 0; i
< n
; i
++)
1898 dump_generic_node (buffer
, gimple_asm_input_op (gs
, i
),
1901 pp_string (buffer
, ", ");
1905 n
= gimple_asm_nclobbers (gs
);
1908 newline_and_indent (buffer
, spc
+ 2);
1909 pp_string (buffer
, "CLOBBER: ");
1910 for (i
= 0; i
< n
; i
++)
1912 dump_generic_node (buffer
, gimple_asm_clobber_op (gs
, i
),
1915 pp_string (buffer
, ", ");
1919 n
= gimple_asm_nlabels (gs
);
1922 newline_and_indent (buffer
, spc
+ 2);
1923 pp_string (buffer
, "LABEL: ");
1924 for (i
= 0; i
< n
; i
++)
1926 dump_generic_node (buffer
, gimple_asm_label_op (gs
, i
),
1929 pp_string (buffer
, ", ");
1933 newline_and_indent (buffer
, spc
);
1934 pp_greater (buffer
);
1938 pp_string (buffer
, "__asm__");
1939 if (gimple_asm_volatile_p (gs
))
1940 pp_string (buffer
, " __volatile__");
1941 if (gimple_asm_nlabels (gs
))
1942 pp_string (buffer
, " goto");
1943 pp_string (buffer
, "(\"");
1944 pp_string (buffer
, gimple_asm_string (gs
));
1945 pp_string (buffer
, "\"");
1947 if (gimple_asm_nlabels (gs
))
1949 else if (gimple_asm_nclobbers (gs
))
1951 else if (gimple_asm_ninputs (gs
))
1953 else if (gimple_asm_noutputs (gs
))
1958 for (f
= 0; f
< fields
; ++f
)
1960 pp_string (buffer
, " : ");
1965 n
= gimple_asm_noutputs (gs
);
1966 for (i
= 0; i
< n
; i
++)
1968 dump_generic_node (buffer
, gimple_asm_output_op (gs
, i
),
1971 pp_string (buffer
, ", ");
1976 n
= gimple_asm_ninputs (gs
);
1977 for (i
= 0; i
< n
; i
++)
1979 dump_generic_node (buffer
, gimple_asm_input_op (gs
, i
),
1982 pp_string (buffer
, ", ");
1987 n
= gimple_asm_nclobbers (gs
);
1988 for (i
= 0; i
< n
; i
++)
1990 dump_generic_node (buffer
, gimple_asm_clobber_op (gs
, i
),
1993 pp_string (buffer
, ", ");
1998 n
= gimple_asm_nlabels (gs
);
1999 for (i
= 0; i
< n
; i
++)
2001 dump_generic_node (buffer
, gimple_asm_label_op (gs
, i
),
2004 pp_string (buffer
, ", ");
2013 pp_string (buffer
, ");");
2017 /* Dump ptr_info and range_info for NODE on pretty_printer BUFFER with
2018 SPC spaces of indent. */
2021 dump_ssaname_info (pretty_printer
*buffer
, tree node
, int spc
)
2023 if (TREE_CODE (node
) != SSA_NAME
)
2026 if (POINTER_TYPE_P (TREE_TYPE (node
))
2027 && SSA_NAME_PTR_INFO (node
))
2029 unsigned int align
, misalign
;
2030 struct ptr_info_def
*pi
= SSA_NAME_PTR_INFO (node
);
2031 pp_string (buffer
, "# PT = ");
2032 pp_points_to_solution (buffer
, &pi
->pt
);
2033 newline_and_indent (buffer
, spc
);
2034 if (get_ptr_info_alignment (pi
, &align
, &misalign
))
2036 pp_printf (buffer
, "# ALIGN = %u, MISALIGN = %u", align
, misalign
);
2037 newline_and_indent (buffer
, spc
);
2041 if (!POINTER_TYPE_P (TREE_TYPE (node
))
2042 && SSA_NAME_RANGE_INFO (node
))
2044 wide_int min
, max
, nonzero_bits
;
2045 value_range_type range_type
= get_range_info (node
, &min
, &max
);
2047 if (range_type
== VR_VARYING
)
2048 pp_printf (buffer
, "# RANGE VR_VARYING");
2049 else if (range_type
== VR_RANGE
|| range_type
== VR_ANTI_RANGE
)
2051 pp_printf (buffer
, "# RANGE ");
2052 pp_printf (buffer
, "%s[", range_type
== VR_RANGE
? "" : "~");
2053 pp_wide_int (buffer
, min
, TYPE_SIGN (TREE_TYPE (node
)));
2054 pp_printf (buffer
, ", ");
2055 pp_wide_int (buffer
, max
, TYPE_SIGN (TREE_TYPE (node
)));
2056 pp_printf (buffer
, "]");
2058 nonzero_bits
= get_nonzero_bits (node
);
2059 if (nonzero_bits
!= -1)
2061 pp_string (buffer
, " NONZERO ");
2062 pp_wide_int (buffer
, nonzero_bits
, UNSIGNED
);
2064 newline_and_indent (buffer
, spc
);
2068 /* As dump_ssaname_info, but dump to FILE. */
2071 dump_ssaname_info_to_file (FILE *file
, tree node
, int spc
)
2073 pretty_printer buffer
;
2074 pp_needs_newline (&buffer
) = true;
2075 buffer
.buffer
->stream
= file
;
2076 dump_ssaname_info (&buffer
, node
, spc
);
2080 /* Dump a PHI node PHI. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1.
2081 The caller is responsible for calling pp_flush on BUFFER to finalize
2082 pretty printer. If COMMENT is true, print this after #. */
2085 dump_gimple_phi (pretty_printer
*buffer
, gphi
*phi
, int spc
, bool comment
,
2089 tree lhs
= gimple_phi_result (phi
);
2091 if (flags
& TDF_ALIAS
)
2092 dump_ssaname_info (buffer
, lhs
, spc
);
2095 pp_string (buffer
, "# ");
2097 if (flags
& TDF_RAW
)
2098 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, ", phi
,
2099 gimple_phi_result (phi
));
2102 dump_generic_node (buffer
, lhs
, spc
, flags
, false);
2103 if (flags
& TDF_GIMPLE
)
2104 pp_string (buffer
, " = __PHI (");
2106 pp_string (buffer
, " = PHI <");
2108 for (i
= 0; i
< gimple_phi_num_args (phi
); i
++)
2110 if ((flags
& TDF_LINENO
) && gimple_phi_arg_has_location (phi
, i
))
2111 dump_location (buffer
, gimple_phi_arg_location (phi
, i
));
2112 if (flags
& TDF_GIMPLE
)
2114 basic_block src
= gimple_phi_arg_edge (phi
, i
)->src
;
2115 gimple
*stmt
= first_stmt (src
);
2116 if (!stmt
|| gimple_code (stmt
) != GIMPLE_LABEL
)
2118 pp_string (buffer
, "bb_");
2119 pp_decimal_int (buffer
, src
->index
);
2122 dump_generic_node (buffer
, gimple_label_label (as_a
<glabel
*> (stmt
)), 0, flags
,
2124 pp_string (buffer
, ": ");
2126 dump_generic_node (buffer
, gimple_phi_arg_def (phi
, i
), spc
, flags
,
2128 if (! (flags
& TDF_GIMPLE
))
2130 pp_left_paren (buffer
);
2131 pp_decimal_int (buffer
, gimple_phi_arg_edge (phi
, i
)->src
->index
);
2132 pp_right_paren (buffer
);
2134 if (i
< gimple_phi_num_args (phi
) - 1)
2135 pp_string (buffer
, ", ");
2137 if (flags
& TDF_GIMPLE
)
2138 pp_string (buffer
, ");");
2140 pp_greater (buffer
);
2144 /* Dump a GIMPLE_OMP_PARALLEL tuple on the pretty_printer BUFFER, SPC spaces
2145 of indent. FLAGS specifies details to show in the dump (see TDF_* in
2149 dump_gimple_omp_parallel (pretty_printer
*buffer
, gomp_parallel
*gs
,
2152 if (flags
& TDF_RAW
)
2154 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
2155 gimple_omp_body (gs
));
2156 dump_omp_clauses (buffer
, gimple_omp_parallel_clauses (gs
), spc
, flags
);
2157 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T%n>",
2158 gimple_omp_parallel_child_fn (gs
),
2159 gimple_omp_parallel_data_arg (gs
));
2164 pp_string (buffer
, "#pragma omp parallel");
2165 dump_omp_clauses (buffer
, gimple_omp_parallel_clauses (gs
), spc
, flags
);
2166 if (gimple_omp_parallel_child_fn (gs
))
2168 pp_string (buffer
, " [child fn: ");
2169 dump_generic_node (buffer
, gimple_omp_parallel_child_fn (gs
),
2171 pp_string (buffer
, " (");
2172 if (gimple_omp_parallel_data_arg (gs
))
2173 dump_generic_node (buffer
, gimple_omp_parallel_data_arg (gs
),
2176 pp_string (buffer
, "???");
2177 pp_string (buffer
, ")]");
2179 body
= gimple_omp_body (gs
);
2180 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
2182 newline_and_indent (buffer
, spc
+ 2);
2183 pp_left_brace (buffer
);
2184 pp_newline (buffer
);
2185 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
2186 newline_and_indent (buffer
, spc
+ 2);
2187 pp_right_brace (buffer
);
2191 pp_newline (buffer
);
2192 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
2198 /* Dump a GIMPLE_OMP_TASK tuple on the pretty_printer BUFFER, SPC spaces
2199 of indent. FLAGS specifies details to show in the dump (see TDF_* in
2203 dump_gimple_omp_task (pretty_printer
*buffer
, gomp_task
*gs
, int spc
,
2206 if (flags
& TDF_RAW
)
2208 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
2209 gimple_omp_body (gs
));
2210 dump_omp_clauses (buffer
, gimple_omp_task_clauses (gs
), spc
, flags
);
2211 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T, %T, %T, %T%n>",
2212 gimple_omp_task_child_fn (gs
),
2213 gimple_omp_task_data_arg (gs
),
2214 gimple_omp_task_copy_fn (gs
),
2215 gimple_omp_task_arg_size (gs
),
2216 gimple_omp_task_arg_size (gs
));
2221 if (gimple_omp_task_taskloop_p (gs
))
2222 pp_string (buffer
, "#pragma omp taskloop");
2224 pp_string (buffer
, "#pragma omp task");
2225 dump_omp_clauses (buffer
, gimple_omp_task_clauses (gs
), spc
, flags
);
2226 if (gimple_omp_task_child_fn (gs
))
2228 pp_string (buffer
, " [child fn: ");
2229 dump_generic_node (buffer
, gimple_omp_task_child_fn (gs
),
2231 pp_string (buffer
, " (");
2232 if (gimple_omp_task_data_arg (gs
))
2233 dump_generic_node (buffer
, gimple_omp_task_data_arg (gs
),
2236 pp_string (buffer
, "???");
2237 pp_string (buffer
, ")]");
2239 body
= gimple_omp_body (gs
);
2240 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
2242 newline_and_indent (buffer
, spc
+ 2);
2243 pp_left_brace (buffer
);
2244 pp_newline (buffer
);
2245 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
2246 newline_and_indent (buffer
, spc
+ 2);
2247 pp_right_brace (buffer
);
2251 pp_newline (buffer
);
2252 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
2258 /* Dump a GIMPLE_OMP_ATOMIC_LOAD tuple on the pretty_printer BUFFER, SPC
2259 spaces of indent. FLAGS specifies details to show in the dump (see TDF_*
2263 dump_gimple_omp_atomic_load (pretty_printer
*buffer
, gomp_atomic_load
*gs
,
2266 if (flags
& TDF_RAW
)
2268 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T>", gs
,
2269 gimple_omp_atomic_load_lhs (gs
),
2270 gimple_omp_atomic_load_rhs (gs
));
2274 pp_string (buffer
, "#pragma omp atomic_load");
2275 if (gimple_omp_atomic_seq_cst_p (gs
))
2276 pp_string (buffer
, " seq_cst");
2277 if (gimple_omp_atomic_need_value_p (gs
))
2278 pp_string (buffer
, " [needed]");
2279 newline_and_indent (buffer
, spc
+ 2);
2280 dump_generic_node (buffer
, gimple_omp_atomic_load_lhs (gs
),
2286 dump_generic_node (buffer
, gimple_omp_atomic_load_rhs (gs
),
2291 /* Dump a GIMPLE_OMP_ATOMIC_STORE tuple on the pretty_printer BUFFER, SPC
2292 spaces of indent. FLAGS specifies details to show in the dump (see TDF_*
2296 dump_gimple_omp_atomic_store (pretty_printer
*buffer
,
2297 gomp_atomic_store
*gs
, int spc
, int flags
)
2299 if (flags
& TDF_RAW
)
2301 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
,
2302 gimple_omp_atomic_store_val (gs
));
2306 pp_string (buffer
, "#pragma omp atomic_store ");
2307 if (gimple_omp_atomic_seq_cst_p (gs
))
2308 pp_string (buffer
, "seq_cst ");
2309 if (gimple_omp_atomic_need_value_p (gs
))
2310 pp_string (buffer
, "[needed] ");
2311 pp_left_paren (buffer
);
2312 dump_generic_node (buffer
, gimple_omp_atomic_store_val (gs
),
2314 pp_right_paren (buffer
);
2319 /* Dump all the memory operands for statement GS. BUFFER, SPC and
2320 FLAGS are as in pp_gimple_stmt_1. */
2323 dump_gimple_mem_ops (pretty_printer
*buffer
, gimple
*gs
, int spc
, int flags
)
2325 tree vdef
= gimple_vdef (gs
);
2326 tree vuse
= gimple_vuse (gs
);
2328 if (vdef
!= NULL_TREE
)
2330 pp_string (buffer
, "# ");
2331 dump_generic_node (buffer
, vdef
, spc
+ 2, flags
, false);
2332 pp_string (buffer
, " = VDEF <");
2333 dump_generic_node (buffer
, vuse
, spc
+ 2, flags
, false);
2334 pp_greater (buffer
);
2335 newline_and_indent (buffer
, spc
);
2337 else if (vuse
!= NULL_TREE
)
2339 pp_string (buffer
, "# VUSE <");
2340 dump_generic_node (buffer
, vuse
, spc
+ 2, flags
, false);
2341 pp_greater (buffer
);
2342 newline_and_indent (buffer
, spc
);
2347 /* Print the gimple statement GS on the pretty printer BUFFER, SPC
2348 spaces of indent. FLAGS specifies details to show in the dump (see
2349 TDF_* in dumpfile.h). The caller is responsible for calling
2350 pp_flush on BUFFER to finalize the pretty printer. */
2353 pp_gimple_stmt_1 (pretty_printer
*buffer
, gimple
*gs
, int spc
, int flags
)
2358 if (flags
& TDF_STMTADDR
)
2359 pp_printf (buffer
, "<&%p> ", (void *) gs
);
2361 if ((flags
& TDF_LINENO
) && gimple_has_location (gs
))
2362 dump_location (buffer
, gimple_location (gs
));
2366 int lp_nr
= lookup_stmt_eh_lp (gs
);
2368 pp_printf (buffer
, "[LP %d] ", lp_nr
);
2370 pp_printf (buffer
, "[MNT %d] ", -lp_nr
);
2373 if ((flags
& (TDF_VOPS
|TDF_MEMSYMS
))
2374 && gimple_has_mem_ops (gs
))
2375 dump_gimple_mem_ops (buffer
, gs
, spc
, flags
);
2377 if (gimple_has_lhs (gs
)
2378 && (flags
& TDF_ALIAS
))
2379 dump_ssaname_info (buffer
, gimple_get_lhs (gs
), spc
);
2381 switch (gimple_code (gs
))
2384 dump_gimple_asm (buffer
, as_a
<gasm
*> (gs
), spc
, flags
);
2388 dump_gimple_assign (buffer
, as_a
<gassign
*> (gs
), spc
, flags
);
2392 dump_gimple_bind (buffer
, as_a
<gbind
*> (gs
), spc
, flags
);
2396 dump_gimple_call (buffer
, as_a
<gcall
*> (gs
), spc
, flags
);
2400 dump_gimple_cond (buffer
, as_a
<gcond
*> (gs
), spc
, flags
);
2404 dump_gimple_label (buffer
, as_a
<glabel
*> (gs
), spc
, flags
);
2408 dump_gimple_goto (buffer
, as_a
<ggoto
*> (gs
), spc
, flags
);
2412 pp_string (buffer
, "GIMPLE_NOP");
2416 dump_gimple_return (buffer
, as_a
<greturn
*> (gs
), spc
, flags
);
2420 dump_gimple_switch (buffer
, as_a
<gswitch
*> (gs
), spc
, flags
);
2424 dump_gimple_try (buffer
, as_a
<gtry
*> (gs
), spc
, flags
);
2428 dump_gimple_phi (buffer
, as_a
<gphi
*> (gs
), spc
, false, flags
);
2431 case GIMPLE_OMP_PARALLEL
:
2432 dump_gimple_omp_parallel (buffer
, as_a
<gomp_parallel
*> (gs
), spc
,
2436 case GIMPLE_OMP_TASK
:
2437 dump_gimple_omp_task (buffer
, as_a
<gomp_task
*> (gs
), spc
, flags
);
2440 case GIMPLE_OMP_ATOMIC_LOAD
:
2441 dump_gimple_omp_atomic_load (buffer
, as_a
<gomp_atomic_load
*> (gs
),
2445 case GIMPLE_OMP_ATOMIC_STORE
:
2446 dump_gimple_omp_atomic_store (buffer
,
2447 as_a
<gomp_atomic_store
*> (gs
),
2451 case GIMPLE_OMP_FOR
:
2452 dump_gimple_omp_for (buffer
, as_a
<gomp_for
*> (gs
), spc
, flags
);
2455 case GIMPLE_OMP_CONTINUE
:
2456 dump_gimple_omp_continue (buffer
, as_a
<gomp_continue
*> (gs
), spc
,
2460 case GIMPLE_OMP_SINGLE
:
2461 dump_gimple_omp_single (buffer
, as_a
<gomp_single
*> (gs
), spc
,
2465 case GIMPLE_OMP_TARGET
:
2466 dump_gimple_omp_target (buffer
, as_a
<gomp_target
*> (gs
), spc
,
2470 case GIMPLE_OMP_TEAMS
:
2471 dump_gimple_omp_teams (buffer
, as_a
<gomp_teams
*> (gs
), spc
,
2475 case GIMPLE_OMP_RETURN
:
2476 dump_gimple_omp_return (buffer
, gs
, spc
, flags
);
2479 case GIMPLE_OMP_SECTIONS
:
2480 dump_gimple_omp_sections (buffer
, as_a
<gomp_sections
*> (gs
),
2484 case GIMPLE_OMP_SECTIONS_SWITCH
:
2485 pp_string (buffer
, "GIMPLE_SECTIONS_SWITCH");
2488 case GIMPLE_OMP_MASTER
:
2489 case GIMPLE_OMP_TASKGROUP
:
2490 case GIMPLE_OMP_SECTION
:
2491 case GIMPLE_OMP_GRID_BODY
:
2492 dump_gimple_omp_block (buffer
, gs
, spc
, flags
);
2495 case GIMPLE_OMP_ORDERED
:
2496 dump_gimple_omp_ordered (buffer
, as_a
<gomp_ordered
*> (gs
), spc
,
2500 case GIMPLE_OMP_CRITICAL
:
2501 dump_gimple_omp_critical (buffer
, as_a
<gomp_critical
*> (gs
), spc
,
2506 dump_gimple_catch (buffer
, as_a
<gcatch
*> (gs
), spc
, flags
);
2509 case GIMPLE_EH_FILTER
:
2510 dump_gimple_eh_filter (buffer
, as_a
<geh_filter
*> (gs
), spc
, flags
);
2513 case GIMPLE_EH_MUST_NOT_THROW
:
2514 dump_gimple_eh_must_not_throw (buffer
,
2515 as_a
<geh_mnt
*> (gs
),
2519 case GIMPLE_EH_ELSE
:
2520 dump_gimple_eh_else (buffer
, as_a
<geh_else
*> (gs
), spc
, flags
);
2524 dump_gimple_resx (buffer
, as_a
<gresx
*> (gs
), spc
, flags
);
2527 case GIMPLE_EH_DISPATCH
:
2528 dump_gimple_eh_dispatch (buffer
, as_a
<geh_dispatch
*> (gs
), spc
,
2533 dump_gimple_debug (buffer
, as_a
<gdebug
*> (gs
), spc
, flags
);
2536 case GIMPLE_PREDICT
:
2537 pp_string (buffer
, "// predicted ");
2538 if (gimple_predict_outcome (gs
))
2539 pp_string (buffer
, "likely by ");
2541 pp_string (buffer
, "unlikely by ");
2542 pp_string (buffer
, predictor_name (gimple_predict_predictor (gs
)));
2543 pp_string (buffer
, " predictor.");
2546 case GIMPLE_TRANSACTION
:
2547 dump_gimple_transaction (buffer
, as_a
<gtransaction
*> (gs
), spc
,
2557 /* Dumps header of basic block BB to OUTF indented by INDENT
2558 spaces and details described by flags. */
2561 dump_gimple_bb_header (FILE *outf
, basic_block bb
, int indent
, int flags
)
2563 if (flags
& TDF_BLOCKS
)
2565 if (flags
& TDF_LINENO
)
2567 gimple_stmt_iterator gsi
;
2569 if (flags
& TDF_COMMENT
)
2570 fputs (";; ", outf
);
2572 for (gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
); gsi_next (&gsi
))
2573 if (!is_gimple_debug (gsi_stmt (gsi
))
2574 && get_lineno (gsi_stmt (gsi
)) != UNKNOWN_LOCATION
)
2576 fprintf (outf
, "%*sstarting at line %d",
2577 indent
, "", get_lineno (gsi_stmt (gsi
)));
2580 if (bb
->discriminator
)
2581 fprintf (outf
, ", discriminator %i", bb
->discriminator
);
2587 gimple
*stmt
= first_stmt (bb
);
2588 if (!stmt
|| gimple_code (stmt
) != GIMPLE_LABEL
)
2590 if (flags
& TDF_GIMPLE
)
2591 fprintf (outf
, "%*sbb_%d:\n", indent
, "", bb
->index
);
2593 fprintf (outf
, "%*s<bb %d> [%.1f%%]:\n", indent
, "", bb
->index
,
2594 bb
->frequency
* 100.0 / REG_BR_PROB_BASE
);
2600 /* Dumps end of basic block BB to buffer BUFFER indented by INDENT
2604 dump_gimple_bb_footer (FILE *outf ATTRIBUTE_UNUSED
,
2605 basic_block bb ATTRIBUTE_UNUSED
,
2606 int indent ATTRIBUTE_UNUSED
,
2607 int flags ATTRIBUTE_UNUSED
)
2609 /* There is currently no GIMPLE-specific basic block info to dump. */
2614 /* Dump PHI nodes of basic block BB to BUFFER with details described
2615 by FLAGS and indented by INDENT spaces. */
2618 dump_phi_nodes (pretty_printer
*buffer
, basic_block bb
, int indent
, int flags
)
2622 for (i
= gsi_start_phis (bb
); !gsi_end_p (i
); gsi_next (&i
))
2624 gphi
*phi
= i
.phi ();
2625 if (!virtual_operand_p (gimple_phi_result (phi
)) || (flags
& TDF_VOPS
))
2628 dump_gimple_phi (buffer
, phi
, indent
,
2629 (flags
& TDF_GIMPLE
) ? false : true, flags
);
2630 pp_newline (buffer
);
2636 /* Dump jump to basic block BB that is represented implicitly in the cfg
2640 pp_cfg_jump (pretty_printer
*buffer
, edge e
, int flags
)
2642 if (flags
& TDF_GIMPLE
)
2644 pp_string (buffer
, "goto bb_");
2645 pp_decimal_int (buffer
, e
->dest
->index
);
2646 pp_semicolon (buffer
);
2650 gimple
*stmt
= first_stmt (e
->dest
);
2652 pp_string (buffer
, "goto <bb ");
2653 pp_decimal_int (buffer
, e
->dest
->index
);
2654 pp_greater (buffer
);
2655 if (stmt
&& gimple_code (stmt
) == GIMPLE_LABEL
)
2657 pp_string (buffer
, " (");
2658 dump_generic_node (buffer
,
2659 gimple_label_label (as_a
<glabel
*> (stmt
)),
2661 pp_right_paren (buffer
);
2662 pp_semicolon (buffer
);
2665 pp_semicolon (buffer
);
2667 dump_edge_probability (buffer
, e
);
2672 /* Dump edges represented implicitly in basic block BB to BUFFER, indented
2673 by INDENT spaces, with details given by FLAGS. */
2676 dump_implicit_edges (pretty_printer
*buffer
, basic_block bb
, int indent
,
2682 stmt
= last_stmt (bb
);
2684 if (stmt
&& gimple_code (stmt
) == GIMPLE_COND
)
2686 edge true_edge
, false_edge
;
2688 /* When we are emitting the code or changing CFG, it is possible that
2689 the edges are not yet created. When we are using debug_bb in such
2690 a situation, we do not want it to crash. */
2691 if (EDGE_COUNT (bb
->succs
) != 2)
2693 extract_true_false_edges_from_block (bb
, &true_edge
, &false_edge
);
2695 INDENT (indent
+ 2);
2696 pp_cfg_jump (buffer
, true_edge
, flags
);
2697 newline_and_indent (buffer
, indent
);
2698 pp_string (buffer
, "else");
2699 newline_and_indent (buffer
, indent
+ 2);
2700 pp_cfg_jump (buffer
, false_edge
, flags
);
2701 pp_newline (buffer
);
2705 /* If there is a fallthru edge, we may need to add an artificial
2706 goto to the dump. */
2707 e
= find_fallthru_edge (bb
->succs
);
2709 if (e
&& e
->dest
!= bb
->next_bb
)
2713 if ((flags
& TDF_LINENO
)
2714 && e
->goto_locus
!= UNKNOWN_LOCATION
)
2715 dump_location (buffer
, e
->goto_locus
);
2717 pp_cfg_jump (buffer
, e
, flags
);
2718 pp_newline (buffer
);
2723 /* Dumps basic block BB to buffer BUFFER with details described by FLAGS and
2724 indented by INDENT spaces. */
2727 gimple_dump_bb_buff (pretty_printer
*buffer
, basic_block bb
, int indent
,
2730 gimple_stmt_iterator gsi
;
2732 int label_indent
= indent
- 2;
2734 if (label_indent
< 0)
2737 dump_phi_nodes (buffer
, bb
, indent
, flags
);
2739 for (gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
); gsi_next (&gsi
))
2743 stmt
= gsi_stmt (gsi
);
2745 curr_indent
= gimple_code (stmt
) == GIMPLE_LABEL
? label_indent
: indent
;
2747 INDENT (curr_indent
);
2748 pp_gimple_stmt_1 (buffer
, stmt
, curr_indent
, flags
);
2749 pp_newline_and_flush (buffer
);
2750 gcc_checking_assert (DECL_STRUCT_FUNCTION (current_function_decl
));
2751 dump_histograms_for_stmt (DECL_STRUCT_FUNCTION (current_function_decl
),
2752 pp_buffer (buffer
)->stream
, stmt
);
2755 dump_implicit_edges (buffer
, bb
, indent
, flags
);
2760 /* Dumps basic block BB to FILE with details described by FLAGS and
2761 indented by INDENT spaces. */
2764 gimple_dump_bb (FILE *file
, basic_block bb
, int indent
, int flags
)
2766 dump_gimple_bb_header (file
, bb
, indent
, flags
);
2767 if (bb
->index
>= NUM_FIXED_BLOCKS
)
2769 pretty_printer buffer
;
2770 pp_needs_newline (&buffer
) = true;
2771 buffer
.buffer
->stream
= file
;
2772 gimple_dump_bb_buff (&buffer
, bb
, indent
, flags
);
2774 dump_gimple_bb_footer (file
, bb
, indent
, flags
);
2777 /* Dumps basic block BB to pretty-printer PP with default dump flags and
2778 no indentation, for use as a label of a DOT graph record-node.
2779 ??? Should just use gimple_dump_bb_buff here, except that value profiling
2780 histogram dumping doesn't know about pretty-printers. */
2783 gimple_dump_bb_for_graph (pretty_printer
*pp
, basic_block bb
)
2785 pp_printf (pp
, "<bb %d>:\n", bb
->index
);
2786 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
2788 for (gphi_iterator gsi
= gsi_start_phis (bb
); !gsi_end_p (gsi
);
2791 gphi
*phi
= gsi
.phi ();
2792 if (!virtual_operand_p (gimple_phi_result (phi
))
2793 || (dump_flags
& TDF_VOPS
))
2796 pp_write_text_to_stream (pp
);
2797 pp_string (pp
, "# ");
2798 pp_gimple_stmt_1 (pp
, phi
, 0, dump_flags
);
2800 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
2804 for (gimple_stmt_iterator gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
);
2807 gimple
*stmt
= gsi_stmt (gsi
);
2809 pp_write_text_to_stream (pp
);
2810 pp_gimple_stmt_1 (pp
, stmt
, 0, dump_flags
);
2812 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
2814 dump_implicit_edges (pp
, bb
, 0, dump_flags
);
2815 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);