1 /* Pretty formatting of GIMPLE statements and expressions.
2 Copyright (C) 2001-2017 Free Software Foundation, Inc.
3 Contributed by Aldy Hernandez <aldyh@redhat.com> and
4 Diego Novillo <dnovillo@google.com>
6 This file is part of GCC.
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 3, or (at your option) any later
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING3. If not see
20 <http://www.gnu.org/licenses/>. */
24 #include "coretypes.h"
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 if (flags
& TDF_GIMPLE
)
328 pp_string (buffer
, "__ABS ");
329 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
333 pp_string (buffer
, "ABS_EXPR <");
334 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
340 if (TREE_CODE_CLASS (rhs_code
) == tcc_declaration
341 || TREE_CODE_CLASS (rhs_code
) == tcc_constant
342 || TREE_CODE_CLASS (rhs_code
) == tcc_reference
343 || rhs_code
== SSA_NAME
344 || rhs_code
== ADDR_EXPR
345 || rhs_code
== CONSTRUCTOR
)
347 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
350 else if (rhs_code
== BIT_NOT_EXPR
)
351 pp_complement (buffer
);
352 else if (rhs_code
== TRUTH_NOT_EXPR
)
353 pp_exclamation (buffer
);
354 else if (rhs_code
== NEGATE_EXPR
)
358 pp_left_bracket (buffer
);
359 pp_string (buffer
, get_tree_code_name (rhs_code
));
360 pp_string (buffer
, "] ");
363 if (op_prio (rhs
) < op_code_prio (rhs_code
))
365 pp_left_paren (buffer
);
366 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
367 pp_right_paren (buffer
);
370 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
376 /* Helper for dump_gimple_assign. Print the binary RHS of the
377 assignment GS. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. */
380 dump_binary_rhs (pretty_printer
*buffer
, gassign
*gs
, int spc
, int flags
)
383 enum tree_code code
= gimple_assign_rhs_code (gs
);
389 case VEC_WIDEN_MULT_HI_EXPR
:
390 case VEC_WIDEN_MULT_LO_EXPR
:
391 case VEC_WIDEN_MULT_EVEN_EXPR
:
392 case VEC_WIDEN_MULT_ODD_EXPR
:
393 case VEC_PACK_TRUNC_EXPR
:
394 case VEC_PACK_SAT_EXPR
:
395 case VEC_PACK_FIX_TRUNC_EXPR
:
396 case VEC_WIDEN_LSHIFT_HI_EXPR
:
397 case VEC_WIDEN_LSHIFT_LO_EXPR
:
398 for (p
= get_tree_code_name (code
); *p
; p
++)
399 pp_character (buffer
, TOUPPER (*p
));
400 pp_string (buffer
, " <");
401 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
402 pp_string (buffer
, ", ");
403 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
408 if (op_prio (gimple_assign_rhs1 (gs
)) <= op_code_prio (code
))
410 pp_left_paren (buffer
);
411 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
,
413 pp_right_paren (buffer
);
416 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
418 pp_string (buffer
, op_symbol_code (gimple_assign_rhs_code (gs
)));
420 if (op_prio (gimple_assign_rhs2 (gs
)) <= op_code_prio (code
))
422 pp_left_paren (buffer
);
423 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
,
425 pp_right_paren (buffer
);
428 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
432 /* Helper for dump_gimple_assign. Print the ternary RHS of the
433 assignment GS. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. */
436 dump_ternary_rhs (pretty_printer
*buffer
, gassign
*gs
, int spc
, int flags
)
439 enum tree_code code
= gimple_assign_rhs_code (gs
);
442 case WIDEN_MULT_PLUS_EXPR
:
443 case WIDEN_MULT_MINUS_EXPR
:
444 for (p
= get_tree_code_name (code
); *p
; p
++)
445 pp_character (buffer
, TOUPPER (*p
));
446 pp_string (buffer
, " <");
447 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
448 pp_string (buffer
, ", ");
449 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
450 pp_string (buffer
, ", ");
451 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
456 if (flags
& TDF_GIMPLE
)
458 pp_string (buffer
, "__FMA (");
459 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
461 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
463 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
464 pp_right_paren (buffer
);
468 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
469 pp_string (buffer
, " * ");
470 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
471 pp_string (buffer
, " + ");
472 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
477 pp_string (buffer
, "DOT_PROD_EXPR <");
478 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
479 pp_string (buffer
, ", ");
480 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
481 pp_string (buffer
, ", ");
482 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
487 pp_string (buffer
, "SAD_EXPR <");
488 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
489 pp_string (buffer
, ", ");
490 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
491 pp_string (buffer
, ", ");
492 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
497 pp_string (buffer
, "VEC_PERM_EXPR <");
498 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
499 pp_string (buffer
, ", ");
500 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
501 pp_string (buffer
, ", ");
502 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
506 case REALIGN_LOAD_EXPR
:
507 pp_string (buffer
, "REALIGN_LOAD <");
508 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
509 pp_string (buffer
, ", ");
510 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
511 pp_string (buffer
, ", ");
512 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
517 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
518 pp_string (buffer
, " ? ");
519 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
520 pp_string (buffer
, " : ");
521 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
525 pp_string (buffer
, "VEC_COND_EXPR <");
526 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
527 pp_string (buffer
, ", ");
528 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
529 pp_string (buffer
, ", ");
530 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
534 case BIT_INSERT_EXPR
:
535 pp_string (buffer
, "BIT_INSERT_EXPR <");
536 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
537 pp_string (buffer
, ", ");
538 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
539 pp_string (buffer
, ", ");
540 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
541 pp_string (buffer
, " (");
542 if (INTEGRAL_TYPE_P (TREE_TYPE (gimple_assign_rhs2 (gs
))))
543 pp_decimal_int (buffer
,
544 TYPE_PRECISION (TREE_TYPE (gimple_assign_rhs2 (gs
))));
546 dump_generic_node (buffer
,
547 TYPE_SIZE (TREE_TYPE (gimple_assign_rhs2 (gs
))),
549 pp_string (buffer
, " bits)>");
558 /* Dump the gimple assignment GS. BUFFER, SPC and FLAGS are as in
562 dump_gimple_assign (pretty_printer
*buffer
, gassign
*gs
, int spc
, int flags
)
569 switch (gimple_num_ops (gs
))
572 arg3
= gimple_assign_rhs3 (gs
);
575 arg2
= gimple_assign_rhs2 (gs
);
578 arg1
= gimple_assign_rhs1 (gs
);
584 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%s, %T, %T, %T, %T>", gs
,
585 get_tree_code_name (gimple_assign_rhs_code (gs
)),
586 gimple_assign_lhs (gs
), arg1
, arg2
, arg3
);
590 if (!(flags
& TDF_RHS_ONLY
))
592 dump_generic_node (buffer
, gimple_assign_lhs (gs
), spc
, flags
, false);
596 if (gimple_assign_nontemporal_move_p (gs
))
597 pp_string (buffer
, "{nt}");
599 if (gimple_has_volatile_ops (gs
))
600 pp_string (buffer
, "{v}");
605 if (gimple_num_ops (gs
) == 2)
606 dump_unary_rhs (buffer
, gs
, spc
, flags
);
607 else if (gimple_num_ops (gs
) == 3)
608 dump_binary_rhs (buffer
, gs
, spc
, flags
);
609 else if (gimple_num_ops (gs
) == 4)
610 dump_ternary_rhs (buffer
, gs
, spc
, flags
);
613 if (!(flags
& TDF_RHS_ONLY
))
614 pp_semicolon (buffer
);
619 /* Dump the return statement GS. BUFFER, SPC and FLAGS are as in
623 dump_gimple_return (pretty_printer
*buffer
, greturn
*gs
, int spc
, int flags
)
627 t
= gimple_return_retval (gs
);
628 t2
= gimple_return_retbnd (gs
);
630 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T %T>", gs
, t
, t2
);
633 pp_string (buffer
, "return");
637 dump_generic_node (buffer
, t
, spc
, flags
, false);
641 pp_string (buffer
, ", ");
642 dump_generic_node (buffer
, t2
, spc
, flags
, false);
644 pp_semicolon (buffer
);
649 /* Dump the call arguments for a gimple call. BUFFER, FLAGS are as in
653 dump_gimple_call_args (pretty_printer
*buffer
, gcall
*gs
, int flags
)
657 /* Pretty print first arg to certain internal fns. */
658 if (gimple_call_internal_p (gs
))
660 const char *const *enums
= NULL
;
663 switch (gimple_call_internal_fn (gs
))
667 static const char *const unique_args
[] = {IFN_UNIQUE_CODES
};
671 limit
= ARRAY_SIZE (unique_args
);
676 static const char *const loop_args
[] = {IFN_GOACC_LOOP_CODES
};
679 limit
= ARRAY_SIZE (loop_args
);
682 case IFN_GOACC_REDUCTION
:
684 static const char *const reduction_args
[]
685 = {IFN_GOACC_REDUCTION_CODES
};
687 enums
= reduction_args
;
688 limit
= ARRAY_SIZE (reduction_args
);
693 static const char *const asan_mark_args
[] = {IFN_ASAN_MARK_FLAGS
};
695 enums
= asan_mark_args
;
696 limit
= ARRAY_SIZE (asan_mark_args
);
704 tree arg0
= gimple_call_arg (gs
, 0);
707 if (TREE_CODE (arg0
) == INTEGER_CST
708 && tree_fits_shwi_p (arg0
)
709 && (v
= tree_to_shwi (arg0
)) >= 0 && v
< limit
)
712 pp_string (buffer
, enums
[v
]);
717 for (; i
< gimple_call_num_args (gs
); i
++)
720 pp_string (buffer
, ", ");
721 dump_generic_node (buffer
, gimple_call_arg (gs
, i
), 0, flags
, false);
724 if (gimple_call_va_arg_pack_p (gs
))
727 pp_string (buffer
, ", ");
729 pp_string (buffer
, "__builtin_va_arg_pack ()");
733 /* Dump the points-to solution *PT to BUFFER. */
736 pp_points_to_solution (pretty_printer
*buffer
, struct pt_solution
*pt
)
740 pp_string (buffer
, "anything ");
744 pp_string (buffer
, "nonlocal ");
746 pp_string (buffer
, "escaped ");
748 pp_string (buffer
, "unit-escaped ");
750 pp_string (buffer
, "null ");
752 && !bitmap_empty_p (pt
->vars
))
756 pp_string (buffer
, "{ ");
757 EXECUTE_IF_SET_IN_BITMAP (pt
->vars
, 0, i
, bi
)
759 pp_string (buffer
, "D.");
760 pp_decimal_int (buffer
, i
);
763 pp_right_brace (buffer
);
764 if (pt
->vars_contains_nonlocal
765 || pt
->vars_contains_escaped
766 || pt
->vars_contains_escaped_heap
767 || pt
->vars_contains_restrict
)
769 const char *comma
= "";
770 pp_string (buffer
, " (");
771 if (pt
->vars_contains_nonlocal
)
773 pp_string (buffer
, "nonlocal");
776 if (pt
->vars_contains_escaped
)
778 pp_string (buffer
, comma
);
779 pp_string (buffer
, "escaped");
782 if (pt
->vars_contains_escaped_heap
)
784 pp_string (buffer
, comma
);
785 pp_string (buffer
, "escaped heap");
788 if (pt
->vars_contains_restrict
)
790 pp_string (buffer
, comma
);
791 pp_string (buffer
, "restrict");
794 if (pt
->vars_contains_interposable
)
796 pp_string (buffer
, comma
);
797 pp_string (buffer
, "interposable");
799 pp_string (buffer
, ")");
805 /* Dump the call statement GS. BUFFER, SPC and FLAGS are as in
809 dump_gimple_call (pretty_printer
*buffer
, gcall
*gs
, int spc
, int flags
)
811 tree lhs
= gimple_call_lhs (gs
);
812 tree fn
= gimple_call_fn (gs
);
814 if (flags
& TDF_ALIAS
)
816 struct pt_solution
*pt
;
817 pt
= gimple_call_use_set (gs
);
818 if (!pt_solution_empty_p (pt
))
820 pp_string (buffer
, "# USE = ");
821 pp_points_to_solution (buffer
, pt
);
822 newline_and_indent (buffer
, spc
);
824 pt
= gimple_call_clobber_set (gs
);
825 if (!pt_solution_empty_p (pt
))
827 pp_string (buffer
, "# CLB = ");
828 pp_points_to_solution (buffer
, pt
);
829 newline_and_indent (buffer
, spc
);
835 if (gimple_call_internal_p (gs
))
836 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%s, %T", gs
,
837 internal_fn_name (gimple_call_internal_fn (gs
)), lhs
);
839 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T", gs
, fn
, lhs
);
840 if (gimple_call_num_args (gs
) > 0)
842 pp_string (buffer
, ", ");
843 dump_gimple_call_args (buffer
, gs
, flags
);
849 if (lhs
&& !(flags
& TDF_RHS_ONLY
))
851 dump_generic_node (buffer
, lhs
, spc
, flags
, false);
852 pp_string (buffer
, " =");
854 if (gimple_has_volatile_ops (gs
))
855 pp_string (buffer
, "{v}");
859 if (gimple_call_internal_p (gs
))
860 pp_string (buffer
, internal_fn_name (gimple_call_internal_fn (gs
)));
862 print_call_name (buffer
, fn
, flags
);
863 pp_string (buffer
, " (");
864 dump_gimple_call_args (buffer
, gs
, flags
);
865 pp_right_paren (buffer
);
866 if (!(flags
& TDF_RHS_ONLY
))
867 pp_semicolon (buffer
);
870 if (gimple_call_chain (gs
))
872 pp_string (buffer
, " [static-chain: ");
873 dump_generic_node (buffer
, gimple_call_chain (gs
), spc
, flags
, false);
874 pp_right_bracket (buffer
);
877 if (gimple_call_return_slot_opt_p (gs
))
878 pp_string (buffer
, " [return slot optimization]");
879 if (gimple_call_tail_p (gs
))
880 pp_string (buffer
, " [tail call]");
881 if (gimple_call_must_tail_p (gs
))
882 pp_string (buffer
, " [must tail call]");
887 /* Dump the arguments of _ITM_beginTransaction sanely. */
888 if (TREE_CODE (fn
) == ADDR_EXPR
)
889 fn
= TREE_OPERAND (fn
, 0);
890 if (TREE_CODE (fn
) == FUNCTION_DECL
&& decl_is_tm_clone (fn
))
891 pp_string (buffer
, " [tm-clone]");
892 if (TREE_CODE (fn
) == FUNCTION_DECL
893 && DECL_BUILT_IN_CLASS (fn
) == BUILT_IN_NORMAL
894 && DECL_FUNCTION_CODE (fn
) == BUILT_IN_TM_START
895 && gimple_call_num_args (gs
) > 0)
897 tree t
= gimple_call_arg (gs
, 0);
898 unsigned HOST_WIDE_INT props
;
899 gcc_assert (TREE_CODE (t
) == INTEGER_CST
);
901 pp_string (buffer
, " [ ");
903 /* Get the transaction code properties. */
904 props
= TREE_INT_CST_LOW (t
);
906 if (props
& PR_INSTRUMENTEDCODE
)
907 pp_string (buffer
, "instrumentedCode ");
908 if (props
& PR_UNINSTRUMENTEDCODE
)
909 pp_string (buffer
, "uninstrumentedCode ");
910 if (props
& PR_HASNOXMMUPDATE
)
911 pp_string (buffer
, "hasNoXMMUpdate ");
912 if (props
& PR_HASNOABORT
)
913 pp_string (buffer
, "hasNoAbort ");
914 if (props
& PR_HASNOIRREVOCABLE
)
915 pp_string (buffer
, "hasNoIrrevocable ");
916 if (props
& PR_DOESGOIRREVOCABLE
)
917 pp_string (buffer
, "doesGoIrrevocable ");
918 if (props
& PR_HASNOSIMPLEREADS
)
919 pp_string (buffer
, "hasNoSimpleReads ");
920 if (props
& PR_AWBARRIERSOMITTED
)
921 pp_string (buffer
, "awBarriersOmitted ");
922 if (props
& PR_RARBARRIERSOMITTED
)
923 pp_string (buffer
, "RaRBarriersOmitted ");
924 if (props
& PR_UNDOLOGCODE
)
925 pp_string (buffer
, "undoLogCode ");
926 if (props
& PR_PREFERUNINSTRUMENTED
)
927 pp_string (buffer
, "preferUninstrumented ");
928 if (props
& PR_EXCEPTIONBLOCK
)
929 pp_string (buffer
, "exceptionBlock ");
930 if (props
& PR_HASELSE
)
931 pp_string (buffer
, "hasElse ");
932 if (props
& PR_READONLY
)
933 pp_string (buffer
, "readOnly ");
935 pp_right_bracket (buffer
);
940 /* Dump the switch statement GS. BUFFER, SPC and FLAGS are as in
944 dump_gimple_switch (pretty_printer
*buffer
, gswitch
*gs
, int spc
,
949 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
951 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, ", gs
,
952 gimple_switch_index (gs
));
955 pp_string (buffer
, "switch (");
956 dump_generic_node (buffer
, gimple_switch_index (gs
), spc
, flags
, true);
957 if (flags
& TDF_GIMPLE
)
958 pp_string (buffer
, ") {");
960 pp_string (buffer
, ") <");
963 for (i
= 0; i
< gimple_switch_num_labels (gs
); i
++)
965 tree case_label
= gimple_switch_label (gs
, i
);
966 gcc_checking_assert (case_label
!= NULL_TREE
);
967 dump_generic_node (buffer
, case_label
, spc
, flags
, false);
969 tree label
= CASE_LABEL (case_label
);
970 dump_generic_node (buffer
, label
, spc
, flags
, false);
972 if (cfun
&& cfun
->cfg
)
974 basic_block dest
= label_to_block (label
);
977 edge label_edge
= find_edge (gimple_bb (gs
), dest
);
978 if (label_edge
&& !(flags
& TDF_GIMPLE
))
979 dump_edge_probability (buffer
, label_edge
);
983 if (i
< gimple_switch_num_labels (gs
) - 1)
985 if (flags
& TDF_GIMPLE
)
986 pp_string (buffer
, "; ");
988 pp_string (buffer
, ", ");
991 if (flags
& TDF_GIMPLE
)
992 pp_string (buffer
, "; }");
998 /* Dump the gimple conditional GS. BUFFER, SPC and FLAGS are as in
1002 dump_gimple_cond (pretty_printer
*buffer
, gcond
*gs
, int spc
, int flags
)
1004 if (flags
& TDF_RAW
)
1005 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%s, %T, %T, %T, %T>", gs
,
1006 get_tree_code_name (gimple_cond_code (gs
)),
1007 gimple_cond_lhs (gs
), gimple_cond_rhs (gs
),
1008 gimple_cond_true_label (gs
), gimple_cond_false_label (gs
));
1011 if (!(flags
& TDF_RHS_ONLY
))
1012 pp_string (buffer
, "if (");
1013 dump_generic_node (buffer
, gimple_cond_lhs (gs
), spc
, flags
, false);
1015 pp_string (buffer
, op_symbol_code (gimple_cond_code (gs
)));
1017 dump_generic_node (buffer
, gimple_cond_rhs (gs
), spc
, flags
, false);
1018 if (!(flags
& TDF_RHS_ONLY
))
1021 edge e
, true_edge
= NULL
, false_edge
= NULL
;
1022 basic_block bb
= gimple_bb (gs
);
1026 FOR_EACH_EDGE (e
, ei
, bb
->succs
)
1028 if (e
->flags
& EDGE_TRUE_VALUE
)
1030 else if (e
->flags
& EDGE_FALSE_VALUE
)
1035 bool has_edge_info
= true_edge
!= NULL
&& false_edge
!= NULL
;
1037 pp_right_paren (buffer
);
1039 if (gimple_cond_true_label (gs
))
1041 pp_string (buffer
, " goto ");
1042 dump_generic_node (buffer
, gimple_cond_true_label (gs
),
1044 if (has_edge_info
&& !(flags
& TDF_GIMPLE
))
1045 dump_edge_probability (buffer
, true_edge
);
1046 pp_semicolon (buffer
);
1048 if (gimple_cond_false_label (gs
))
1050 pp_string (buffer
, " else goto ");
1051 dump_generic_node (buffer
, gimple_cond_false_label (gs
),
1053 if (has_edge_info
&& !(flags
& TDF_GIMPLE
))
1054 dump_edge_probability (buffer
, false_edge
);
1056 pp_semicolon (buffer
);
1063 /* Dump a GIMPLE_LABEL tuple on the pretty_printer BUFFER, SPC
1064 spaces of indent. FLAGS specifies details to show in the dump (see
1065 TDF_* in dumpfils.h). */
1068 dump_gimple_label (pretty_printer
*buffer
, glabel
*gs
, int spc
, int flags
)
1070 tree label
= gimple_label_label (gs
);
1071 if (flags
& TDF_RAW
)
1072 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
, label
);
1075 dump_generic_node (buffer
, label
, spc
, flags
, false);
1076 basic_block bb
= gimple_bb (gs
);
1077 if (bb
&& !(flags
& TDF_GIMPLE
))
1078 pp_scalar (buffer
, " %s", dump_probability (bb
->frequency
));
1081 if (flags
& TDF_GIMPLE
)
1083 if (DECL_NONLOCAL (label
))
1084 pp_string (buffer
, " [non-local]");
1085 if ((flags
& TDF_EH
) && EH_LANDING_PAD_NR (label
))
1086 pp_printf (buffer
, " [LP %d]", EH_LANDING_PAD_NR (label
));
1089 /* Dump a GIMPLE_GOTO tuple on the pretty_printer BUFFER, SPC
1090 spaces of indent. FLAGS specifies details to show in the dump (see
1091 TDF_* in dumpfile.h). */
1094 dump_gimple_goto (pretty_printer
*buffer
, ggoto
*gs
, int spc
, int flags
)
1096 tree label
= gimple_goto_dest (gs
);
1097 if (flags
& TDF_RAW
)
1098 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
, label
);
1100 dump_gimple_fmt (buffer
, spc
, flags
, "goto %T;", label
);
1104 /* Dump a GIMPLE_BIND tuple on the pretty_printer BUFFER, SPC
1105 spaces of indent. FLAGS specifies details to show in the dump (see
1106 TDF_* in dumpfile.h). */
1109 dump_gimple_bind (pretty_printer
*buffer
, gbind
*gs
, int spc
, int flags
)
1111 if (flags
& TDF_RAW
)
1112 dump_gimple_fmt (buffer
, spc
, flags
, "%G <", gs
);
1114 pp_left_brace (buffer
);
1115 if (!(flags
& TDF_SLIM
))
1119 for (var
= gimple_bind_vars (gs
); var
; var
= DECL_CHAIN (var
))
1121 newline_and_indent (buffer
, 2);
1122 print_declaration (buffer
, var
, spc
, flags
);
1124 if (gimple_bind_vars (gs
))
1125 pp_newline (buffer
);
1127 pp_newline (buffer
);
1128 dump_gimple_seq (buffer
, gimple_bind_body (gs
), spc
+ 2, flags
);
1129 newline_and_indent (buffer
, spc
);
1130 if (flags
& TDF_RAW
)
1131 pp_greater (buffer
);
1133 pp_right_brace (buffer
);
1137 /* Dump a GIMPLE_TRY tuple on the pretty_printer BUFFER, SPC spaces of
1138 indent. FLAGS specifies details to show in the dump (see TDF_* in
1142 dump_gimple_try (pretty_printer
*buffer
, gtry
*gs
, int spc
, int flags
)
1144 if (flags
& TDF_RAW
)
1147 if (gimple_try_kind (gs
) == GIMPLE_TRY_CATCH
)
1148 type
= "GIMPLE_TRY_CATCH";
1149 else if (gimple_try_kind (gs
) == GIMPLE_TRY_FINALLY
)
1150 type
= "GIMPLE_TRY_FINALLY";
1152 type
= "UNKNOWN GIMPLE_TRY";
1153 dump_gimple_fmt (buffer
, spc
, flags
,
1154 "%G <%s,%+EVAL <%S>%nCLEANUP <%S>%->", gs
, type
,
1155 gimple_try_eval (gs
), gimple_try_cleanup (gs
));
1159 pp_string (buffer
, "try");
1160 newline_and_indent (buffer
, spc
+ 2);
1161 pp_left_brace (buffer
);
1162 pp_newline (buffer
);
1164 dump_gimple_seq (buffer
, gimple_try_eval (gs
), spc
+ 4, flags
);
1165 newline_and_indent (buffer
, spc
+ 2);
1166 pp_right_brace (buffer
);
1168 if (gimple_try_kind (gs
) == GIMPLE_TRY_CATCH
)
1170 newline_and_indent (buffer
, spc
);
1171 pp_string (buffer
, "catch");
1172 newline_and_indent (buffer
, spc
+ 2);
1173 pp_left_brace (buffer
);
1175 else if (gimple_try_kind (gs
) == GIMPLE_TRY_FINALLY
)
1177 newline_and_indent (buffer
, spc
);
1178 pp_string (buffer
, "finally");
1179 newline_and_indent (buffer
, spc
+ 2);
1180 pp_left_brace (buffer
);
1183 pp_string (buffer
, " <UNKNOWN GIMPLE_TRY> {");
1185 pp_newline (buffer
);
1186 dump_gimple_seq (buffer
, gimple_try_cleanup (gs
), spc
+ 4, flags
);
1187 newline_and_indent (buffer
, spc
+ 2);
1188 pp_right_brace (buffer
);
1193 /* Dump a GIMPLE_CATCH tuple on the pretty_printer BUFFER, SPC spaces of
1194 indent. FLAGS specifies details to show in the dump (see TDF_* in
1198 dump_gimple_catch (pretty_printer
*buffer
, gcatch
*gs
, int spc
, int flags
)
1200 if (flags
& TDF_RAW
)
1201 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %+CATCH <%S>%->", gs
,
1202 gimple_catch_types (gs
), gimple_catch_handler (gs
));
1204 dump_gimple_fmt (buffer
, spc
, flags
, "catch (%T)%+{%S}",
1205 gimple_catch_types (gs
), gimple_catch_handler (gs
));
1209 /* Dump a GIMPLE_EH_FILTER tuple on the pretty_printer BUFFER, SPC spaces of
1210 indent. FLAGS specifies details to show in the dump (see TDF_* in
1214 dump_gimple_eh_filter (pretty_printer
*buffer
, geh_filter
*gs
, int spc
,
1217 if (flags
& TDF_RAW
)
1218 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %+FAILURE <%S>%->", gs
,
1219 gimple_eh_filter_types (gs
),
1220 gimple_eh_filter_failure (gs
));
1222 dump_gimple_fmt (buffer
, spc
, flags
, "<<<eh_filter (%T)>>>%+{%+%S%-}",
1223 gimple_eh_filter_types (gs
),
1224 gimple_eh_filter_failure (gs
));
1228 /* Dump a GIMPLE_EH_MUST_NOT_THROW tuple. */
1231 dump_gimple_eh_must_not_throw (pretty_printer
*buffer
,
1232 geh_mnt
*gs
, int spc
, int flags
)
1234 if (flags
& TDF_RAW
)
1235 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
,
1236 gimple_eh_must_not_throw_fndecl (gs
));
1238 dump_gimple_fmt (buffer
, spc
, flags
, "<<<eh_must_not_throw (%T)>>>",
1239 gimple_eh_must_not_throw_fndecl (gs
));
1243 /* Dump a GIMPLE_EH_ELSE tuple on the pretty_printer BUFFER, SPC spaces of
1244 indent. FLAGS specifies details to show in the dump (see TDF_* in
1248 dump_gimple_eh_else (pretty_printer
*buffer
, geh_else
*gs
, int spc
,
1251 if (flags
& TDF_RAW
)
1252 dump_gimple_fmt (buffer
, spc
, flags
,
1253 "%G <%+N_BODY <%S>%nE_BODY <%S>%->", gs
,
1254 gimple_eh_else_n_body (gs
), gimple_eh_else_e_body (gs
));
1256 dump_gimple_fmt (buffer
, spc
, flags
,
1257 "<<<if_normal_exit>>>%+{%S}%-<<<else_eh_exit>>>%+{%S}",
1258 gimple_eh_else_n_body (gs
), gimple_eh_else_e_body (gs
));
1262 /* Dump a GIMPLE_RESX tuple on the pretty_printer BUFFER, SPC spaces of
1263 indent. FLAGS specifies details to show in the dump (see TDF_* in
1267 dump_gimple_resx (pretty_printer
*buffer
, gresx
*gs
, int spc
, int flags
)
1269 if (flags
& TDF_RAW
)
1270 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%d>", gs
,
1271 gimple_resx_region (gs
));
1273 dump_gimple_fmt (buffer
, spc
, flags
, "resx %d", gimple_resx_region (gs
));
1276 /* Dump a GIMPLE_EH_DISPATCH tuple on the pretty_printer BUFFER. */
1279 dump_gimple_eh_dispatch (pretty_printer
*buffer
, geh_dispatch
*gs
, int spc
, int flags
)
1281 if (flags
& TDF_RAW
)
1282 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%d>", gs
,
1283 gimple_eh_dispatch_region (gs
));
1285 dump_gimple_fmt (buffer
, spc
, flags
, "eh_dispatch %d",
1286 gimple_eh_dispatch_region (gs
));
1289 /* Dump a GIMPLE_DEBUG tuple on the pretty_printer BUFFER, SPC spaces
1290 of indent. FLAGS specifies details to show in the dump (see TDF_*
1294 dump_gimple_debug (pretty_printer
*buffer
, gdebug
*gs
, int spc
, int flags
)
1296 switch (gs
->subcode
)
1298 case GIMPLE_DEBUG_BIND
:
1299 if (flags
& TDF_RAW
)
1300 dump_gimple_fmt (buffer
, spc
, flags
, "%G BIND <%T, %T>", gs
,
1301 gimple_debug_bind_get_var (gs
),
1302 gimple_debug_bind_get_value (gs
));
1304 dump_gimple_fmt (buffer
, spc
, flags
, "# DEBUG %T => %T",
1305 gimple_debug_bind_get_var (gs
),
1306 gimple_debug_bind_get_value (gs
));
1309 case GIMPLE_DEBUG_SOURCE_BIND
:
1310 if (flags
& TDF_RAW
)
1311 dump_gimple_fmt (buffer
, spc
, flags
, "%G SRCBIND <%T, %T>", gs
,
1312 gimple_debug_source_bind_get_var (gs
),
1313 gimple_debug_source_bind_get_value (gs
));
1315 dump_gimple_fmt (buffer
, spc
, flags
, "# DEBUG %T s=> %T",
1316 gimple_debug_source_bind_get_var (gs
),
1317 gimple_debug_source_bind_get_value (gs
));
1325 /* Dump a GIMPLE_OMP_FOR tuple on the pretty_printer BUFFER. */
1327 dump_gimple_omp_for (pretty_printer
*buffer
, gomp_for
*gs
, int spc
, int flags
)
1331 if (flags
& TDF_RAW
)
1334 switch (gimple_omp_for_kind (gs
))
1336 case GF_OMP_FOR_KIND_FOR
:
1339 case GF_OMP_FOR_KIND_DISTRIBUTE
:
1340 kind
= " distribute";
1342 case GF_OMP_FOR_KIND_TASKLOOP
:
1345 case GF_OMP_FOR_KIND_CILKFOR
:
1346 kind
= " _Cilk_for";
1348 case GF_OMP_FOR_KIND_OACC_LOOP
:
1349 kind
= " oacc_loop";
1351 case GF_OMP_FOR_KIND_SIMD
:
1354 case GF_OMP_FOR_KIND_CILKSIMD
:
1360 dump_gimple_fmt (buffer
, spc
, flags
, "%G%s <%+BODY <%S>%nCLAUSES <", gs
,
1361 kind
, gimple_omp_body (gs
));
1362 dump_omp_clauses (buffer
, gimple_omp_for_clauses (gs
), spc
, flags
);
1363 dump_gimple_fmt (buffer
, spc
, flags
, " >,");
1364 for (i
= 0; i
< gimple_omp_for_collapse (gs
); i
++)
1365 dump_gimple_fmt (buffer
, spc
, flags
,
1366 "%+%T, %T, %T, %s, %T,%n",
1367 gimple_omp_for_index (gs
, i
),
1368 gimple_omp_for_initial (gs
, i
),
1369 gimple_omp_for_final (gs
, i
),
1370 get_tree_code_name (gimple_omp_for_cond (gs
, i
)),
1371 gimple_omp_for_incr (gs
, i
));
1372 dump_gimple_fmt (buffer
, spc
, flags
, "PRE_BODY <%S>%->",
1373 gimple_omp_for_pre_body (gs
));
1377 switch (gimple_omp_for_kind (gs
))
1379 case GF_OMP_FOR_KIND_FOR
:
1380 pp_string (buffer
, "#pragma omp for");
1382 case GF_OMP_FOR_KIND_DISTRIBUTE
:
1383 pp_string (buffer
, "#pragma omp distribute");
1385 case GF_OMP_FOR_KIND_TASKLOOP
:
1386 pp_string (buffer
, "#pragma omp taskloop");
1388 case GF_OMP_FOR_KIND_CILKFOR
:
1390 case GF_OMP_FOR_KIND_OACC_LOOP
:
1391 pp_string (buffer
, "#pragma acc loop");
1393 case GF_OMP_FOR_KIND_SIMD
:
1394 pp_string (buffer
, "#pragma omp simd");
1396 case GF_OMP_FOR_KIND_CILKSIMD
:
1397 pp_string (buffer
, "#pragma simd");
1399 case GF_OMP_FOR_KIND_GRID_LOOP
:
1400 pp_string (buffer
, "#pragma omp for grid_loop");
1405 if (gimple_omp_for_kind (gs
) != GF_OMP_FOR_KIND_CILKFOR
)
1406 dump_omp_clauses (buffer
, gimple_omp_for_clauses (gs
), spc
, flags
);
1407 for (i
= 0; i
< gimple_omp_for_collapse (gs
); i
++)
1411 if (gimple_omp_for_kind (gs
) == GF_OMP_FOR_KIND_CILKFOR
)
1412 pp_string (buffer
, "_Cilk_for (");
1415 newline_and_indent (buffer
, spc
);
1416 pp_string (buffer
, "for (");
1418 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
1420 pp_string (buffer
, " = ");
1421 dump_generic_node (buffer
, gimple_omp_for_initial (gs
, i
), spc
,
1423 pp_string (buffer
, "; ");
1425 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
1428 switch (gimple_omp_for_cond (gs
, i
))
1434 pp_greater (buffer
);
1437 pp_less_equal (buffer
);
1440 pp_greater_equal (buffer
);
1443 pp_string (buffer
, "!=");
1449 dump_generic_node (buffer
, gimple_omp_for_final (gs
, i
), spc
,
1451 pp_string (buffer
, "; ");
1453 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
1455 pp_string (buffer
, " = ");
1456 dump_generic_node (buffer
, gimple_omp_for_incr (gs
, i
), spc
,
1458 pp_right_paren (buffer
);
1461 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1463 if (gimple_omp_for_kind (gs
) == GF_OMP_FOR_KIND_CILKFOR
)
1464 dump_omp_clauses (buffer
, gimple_omp_for_clauses (gs
), spc
, flags
);
1465 newline_and_indent (buffer
, spc
+ 2);
1466 pp_left_brace (buffer
);
1467 pp_newline (buffer
);
1468 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1469 newline_and_indent (buffer
, spc
+ 2);
1470 pp_right_brace (buffer
);
1475 /* Dump a GIMPLE_OMP_CONTINUE tuple on the pretty_printer BUFFER. */
1478 dump_gimple_omp_continue (pretty_printer
*buffer
, gomp_continue
*gs
,
1481 if (flags
& TDF_RAW
)
1483 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T>", gs
,
1484 gimple_omp_continue_control_def (gs
),
1485 gimple_omp_continue_control_use (gs
));
1489 pp_string (buffer
, "#pragma omp continue (");
1490 dump_generic_node (buffer
, gimple_omp_continue_control_def (gs
),
1494 dump_generic_node (buffer
, gimple_omp_continue_control_use (gs
),
1496 pp_right_paren (buffer
);
1500 /* Dump a GIMPLE_OMP_SINGLE tuple on the pretty_printer BUFFER. */
1503 dump_gimple_omp_single (pretty_printer
*buffer
, gomp_single
*gs
,
1506 if (flags
& TDF_RAW
)
1508 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1509 gimple_omp_body (gs
));
1510 dump_omp_clauses (buffer
, gimple_omp_single_clauses (gs
), spc
, flags
);
1511 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1515 pp_string (buffer
, "#pragma omp single");
1516 dump_omp_clauses (buffer
, gimple_omp_single_clauses (gs
), spc
, flags
);
1517 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1519 newline_and_indent (buffer
, spc
+ 2);
1520 pp_left_brace (buffer
);
1521 pp_newline (buffer
);
1522 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1523 newline_and_indent (buffer
, spc
+ 2);
1524 pp_right_brace (buffer
);
1529 /* Dump a GIMPLE_OMP_TARGET tuple on the pretty_printer BUFFER. */
1532 dump_gimple_omp_target (pretty_printer
*buffer
, gomp_target
*gs
,
1536 switch (gimple_omp_target_kind (gs
))
1538 case GF_OMP_TARGET_KIND_REGION
:
1541 case GF_OMP_TARGET_KIND_DATA
:
1544 case GF_OMP_TARGET_KIND_UPDATE
:
1547 case GF_OMP_TARGET_KIND_ENTER_DATA
:
1548 kind
= " enter data";
1550 case GF_OMP_TARGET_KIND_EXIT_DATA
:
1551 kind
= " exit data";
1553 case GF_OMP_TARGET_KIND_OACC_KERNELS
:
1554 kind
= " oacc_kernels";
1556 case GF_OMP_TARGET_KIND_OACC_PARALLEL
:
1557 kind
= " oacc_parallel";
1559 case GF_OMP_TARGET_KIND_OACC_DATA
:
1560 kind
= " oacc_data";
1562 case GF_OMP_TARGET_KIND_OACC_UPDATE
:
1563 kind
= " oacc_update";
1565 case GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA
:
1566 kind
= " oacc_enter_exit_data";
1568 case GF_OMP_TARGET_KIND_OACC_DECLARE
:
1569 kind
= " oacc_declare";
1571 case GF_OMP_TARGET_KIND_OACC_HOST_DATA
:
1572 kind
= " oacc_host_data";
1577 if (flags
& TDF_RAW
)
1579 dump_gimple_fmt (buffer
, spc
, flags
, "%G%s <%+BODY <%S>%nCLAUSES <", gs
,
1580 kind
, gimple_omp_body (gs
));
1581 dump_omp_clauses (buffer
, gimple_omp_target_clauses (gs
), spc
, flags
);
1582 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T%n>",
1583 gimple_omp_target_child_fn (gs
),
1584 gimple_omp_target_data_arg (gs
));
1588 pp_string (buffer
, "#pragma omp target");
1589 pp_string (buffer
, kind
);
1590 dump_omp_clauses (buffer
, gimple_omp_target_clauses (gs
), spc
, flags
);
1591 if (gimple_omp_target_child_fn (gs
))
1593 pp_string (buffer
, " [child fn: ");
1594 dump_generic_node (buffer
, gimple_omp_target_child_fn (gs
),
1596 pp_string (buffer
, " (");
1597 if (gimple_omp_target_data_arg (gs
))
1598 dump_generic_node (buffer
, gimple_omp_target_data_arg (gs
),
1601 pp_string (buffer
, "???");
1602 pp_string (buffer
, ")]");
1604 gimple_seq body
= gimple_omp_body (gs
);
1605 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
1607 newline_and_indent (buffer
, spc
+ 2);
1608 pp_left_brace (buffer
);
1609 pp_newline (buffer
);
1610 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
1611 newline_and_indent (buffer
, spc
+ 2);
1612 pp_right_brace (buffer
);
1616 pp_newline (buffer
);
1617 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
1622 /* Dump a GIMPLE_OMP_TEAMS tuple on the pretty_printer BUFFER. */
1625 dump_gimple_omp_teams (pretty_printer
*buffer
, gomp_teams
*gs
, int spc
,
1628 if (flags
& TDF_RAW
)
1630 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1631 gimple_omp_body (gs
));
1632 dump_omp_clauses (buffer
, gimple_omp_teams_clauses (gs
), spc
, flags
);
1633 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1637 pp_string (buffer
, "#pragma omp teams");
1638 dump_omp_clauses (buffer
, gimple_omp_teams_clauses (gs
), spc
, flags
);
1639 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1641 newline_and_indent (buffer
, spc
+ 2);
1642 pp_character (buffer
, '{');
1643 pp_newline (buffer
);
1644 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1645 newline_and_indent (buffer
, spc
+ 2);
1646 pp_character (buffer
, '}');
1651 /* Dump a GIMPLE_OMP_SECTIONS tuple on the pretty_printer BUFFER. */
1654 dump_gimple_omp_sections (pretty_printer
*buffer
, gomp_sections
*gs
,
1657 if (flags
& TDF_RAW
)
1659 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1660 gimple_omp_body (gs
));
1661 dump_omp_clauses (buffer
, gimple_omp_sections_clauses (gs
), spc
, flags
);
1662 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1666 pp_string (buffer
, "#pragma omp sections");
1667 if (gimple_omp_sections_control (gs
))
1669 pp_string (buffer
, " <");
1670 dump_generic_node (buffer
, gimple_omp_sections_control (gs
), spc
,
1672 pp_greater (buffer
);
1674 dump_omp_clauses (buffer
, gimple_omp_sections_clauses (gs
), spc
, flags
);
1675 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1677 newline_and_indent (buffer
, spc
+ 2);
1678 pp_left_brace (buffer
);
1679 pp_newline (buffer
);
1680 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1681 newline_and_indent (buffer
, spc
+ 2);
1682 pp_right_brace (buffer
);
1687 /* Dump a GIMPLE_OMP_{MASTER,TASKGROUP,ORDERED,SECTION} tuple on the
1688 pretty_printer BUFFER. */
1691 dump_gimple_omp_block (pretty_printer
*buffer
, gimple
*gs
, int spc
, int flags
)
1693 if (flags
& TDF_RAW
)
1694 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1695 gimple_omp_body (gs
));
1698 switch (gimple_code (gs
))
1700 case GIMPLE_OMP_MASTER
:
1701 pp_string (buffer
, "#pragma omp master");
1703 case GIMPLE_OMP_TASKGROUP
:
1704 pp_string (buffer
, "#pragma omp taskgroup");
1706 case GIMPLE_OMP_SECTION
:
1707 pp_string (buffer
, "#pragma omp section");
1709 case GIMPLE_OMP_GRID_BODY
:
1710 pp_string (buffer
, "#pragma omp gridified body");
1715 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1717 newline_and_indent (buffer
, spc
+ 2);
1718 pp_left_brace (buffer
);
1719 pp_newline (buffer
);
1720 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1721 newline_and_indent (buffer
, spc
+ 2);
1722 pp_right_brace (buffer
);
1727 /* Dump a GIMPLE_OMP_CRITICAL tuple on the pretty_printer BUFFER. */
1730 dump_gimple_omp_critical (pretty_printer
*buffer
, gomp_critical
*gs
,
1733 if (flags
& TDF_RAW
)
1734 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1735 gimple_omp_body (gs
));
1738 pp_string (buffer
, "#pragma omp critical");
1739 if (gimple_omp_critical_name (gs
))
1741 pp_string (buffer
, " (");
1742 dump_generic_node (buffer
, gimple_omp_critical_name (gs
), spc
,
1744 pp_right_paren (buffer
);
1746 dump_omp_clauses (buffer
, gimple_omp_critical_clauses (gs
), spc
, flags
);
1747 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1749 newline_and_indent (buffer
, spc
+ 2);
1750 pp_left_brace (buffer
);
1751 pp_newline (buffer
);
1752 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1753 newline_and_indent (buffer
, spc
+ 2);
1754 pp_right_brace (buffer
);
1759 /* Dump a GIMPLE_OMP_ORDERED tuple on the pretty_printer BUFFER. */
1762 dump_gimple_omp_ordered (pretty_printer
*buffer
, gomp_ordered
*gs
,
1765 if (flags
& TDF_RAW
)
1766 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1767 gimple_omp_body (gs
));
1770 pp_string (buffer
, "#pragma omp ordered");
1771 dump_omp_clauses (buffer
, gimple_omp_ordered_clauses (gs
), spc
, flags
);
1772 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1774 newline_and_indent (buffer
, spc
+ 2);
1775 pp_left_brace (buffer
);
1776 pp_newline (buffer
);
1777 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1778 newline_and_indent (buffer
, spc
+ 2);
1779 pp_right_brace (buffer
);
1784 /* Dump a GIMPLE_OMP_RETURN tuple on the pretty_printer BUFFER. */
1787 dump_gimple_omp_return (pretty_printer
*buffer
, gimple
*gs
, int spc
, int flags
)
1789 if (flags
& TDF_RAW
)
1791 dump_gimple_fmt (buffer
, spc
, flags
, "%G <nowait=%d", gs
,
1792 (int) gimple_omp_return_nowait_p (gs
));
1793 if (gimple_omp_return_lhs (gs
))
1794 dump_gimple_fmt (buffer
, spc
, flags
, ", lhs=%T>",
1795 gimple_omp_return_lhs (gs
));
1797 dump_gimple_fmt (buffer
, spc
, flags
, ">");
1801 pp_string (buffer
, "#pragma omp return");
1802 if (gimple_omp_return_nowait_p (gs
))
1803 pp_string (buffer
, "(nowait)");
1804 if (gimple_omp_return_lhs (gs
))
1806 pp_string (buffer
, " (set ");
1807 dump_generic_node (buffer
, gimple_omp_return_lhs (gs
),
1809 pp_character (buffer
, ')');
1814 /* Dump a GIMPLE_TRANSACTION tuple on the pretty_printer BUFFER. */
1817 dump_gimple_transaction (pretty_printer
*buffer
, gtransaction
*gs
,
1820 unsigned subcode
= gimple_transaction_subcode (gs
);
1822 if (flags
& TDF_RAW
)
1824 dump_gimple_fmt (buffer
, spc
, flags
,
1825 "%G [SUBCODE=%x,NORM=%T,UNINST=%T,OVER=%T] "
1827 gs
, subcode
, gimple_transaction_label_norm (gs
),
1828 gimple_transaction_label_uninst (gs
),
1829 gimple_transaction_label_over (gs
),
1830 gimple_transaction_body (gs
));
1834 if (subcode
& GTMA_IS_OUTER
)
1835 pp_string (buffer
, "__transaction_atomic [[outer]]");
1836 else if (subcode
& GTMA_IS_RELAXED
)
1837 pp_string (buffer
, "__transaction_relaxed");
1839 pp_string (buffer
, "__transaction_atomic");
1840 subcode
&= ~GTMA_DECLARATION_MASK
;
1842 if (gimple_transaction_body (gs
))
1844 newline_and_indent (buffer
, spc
+ 2);
1845 pp_left_brace (buffer
);
1846 pp_newline (buffer
);
1847 dump_gimple_seq (buffer
, gimple_transaction_body (gs
),
1849 newline_and_indent (buffer
, spc
+ 2);
1850 pp_right_brace (buffer
);
1854 pp_string (buffer
, " //");
1855 if (gimple_transaction_label_norm (gs
))
1857 pp_string (buffer
, " NORM=");
1858 dump_generic_node (buffer
, gimple_transaction_label_norm (gs
),
1861 if (gimple_transaction_label_uninst (gs
))
1863 pp_string (buffer
, " UNINST=");
1864 dump_generic_node (buffer
, gimple_transaction_label_uninst (gs
),
1867 if (gimple_transaction_label_over (gs
))
1869 pp_string (buffer
, " OVER=");
1870 dump_generic_node (buffer
, gimple_transaction_label_over (gs
),
1875 pp_string (buffer
, " SUBCODE=[ ");
1876 if (subcode
& GTMA_HAVE_ABORT
)
1878 pp_string (buffer
, "GTMA_HAVE_ABORT ");
1879 subcode
&= ~GTMA_HAVE_ABORT
;
1881 if (subcode
& GTMA_HAVE_LOAD
)
1883 pp_string (buffer
, "GTMA_HAVE_LOAD ");
1884 subcode
&= ~GTMA_HAVE_LOAD
;
1886 if (subcode
& GTMA_HAVE_STORE
)
1888 pp_string (buffer
, "GTMA_HAVE_STORE ");
1889 subcode
&= ~GTMA_HAVE_STORE
;
1891 if (subcode
& GTMA_MAY_ENTER_IRREVOCABLE
)
1893 pp_string (buffer
, "GTMA_MAY_ENTER_IRREVOCABLE ");
1894 subcode
&= ~GTMA_MAY_ENTER_IRREVOCABLE
;
1896 if (subcode
& GTMA_DOES_GO_IRREVOCABLE
)
1898 pp_string (buffer
, "GTMA_DOES_GO_IRREVOCABLE ");
1899 subcode
&= ~GTMA_DOES_GO_IRREVOCABLE
;
1901 if (subcode
& GTMA_HAS_NO_INSTRUMENTATION
)
1903 pp_string (buffer
, "GTMA_HAS_NO_INSTRUMENTATION ");
1904 subcode
&= ~GTMA_HAS_NO_INSTRUMENTATION
;
1907 pp_printf (buffer
, "0x%x ", subcode
);
1908 pp_right_bracket (buffer
);
1914 /* Dump a GIMPLE_ASM tuple on the pretty_printer BUFFER, SPC spaces of
1915 indent. FLAGS specifies details to show in the dump (see TDF_* in
1919 dump_gimple_asm (pretty_printer
*buffer
, gasm
*gs
, int spc
, int flags
)
1921 unsigned int i
, n
, f
, fields
;
1923 if (flags
& TDF_RAW
)
1925 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+STRING <%n%s%n>", gs
,
1926 gimple_asm_string (gs
));
1928 n
= gimple_asm_noutputs (gs
);
1931 newline_and_indent (buffer
, spc
+ 2);
1932 pp_string (buffer
, "OUTPUT: ");
1933 for (i
= 0; i
< n
; i
++)
1935 dump_generic_node (buffer
, gimple_asm_output_op (gs
, i
),
1938 pp_string (buffer
, ", ");
1942 n
= gimple_asm_ninputs (gs
);
1945 newline_and_indent (buffer
, spc
+ 2);
1946 pp_string (buffer
, "INPUT: ");
1947 for (i
= 0; i
< n
; i
++)
1949 dump_generic_node (buffer
, gimple_asm_input_op (gs
, i
),
1952 pp_string (buffer
, ", ");
1956 n
= gimple_asm_nclobbers (gs
);
1959 newline_and_indent (buffer
, spc
+ 2);
1960 pp_string (buffer
, "CLOBBER: ");
1961 for (i
= 0; i
< n
; i
++)
1963 dump_generic_node (buffer
, gimple_asm_clobber_op (gs
, i
),
1966 pp_string (buffer
, ", ");
1970 n
= gimple_asm_nlabels (gs
);
1973 newline_and_indent (buffer
, spc
+ 2);
1974 pp_string (buffer
, "LABEL: ");
1975 for (i
= 0; i
< n
; i
++)
1977 dump_generic_node (buffer
, gimple_asm_label_op (gs
, i
),
1980 pp_string (buffer
, ", ");
1984 newline_and_indent (buffer
, spc
);
1985 pp_greater (buffer
);
1989 pp_string (buffer
, "__asm__");
1990 if (gimple_asm_volatile_p (gs
))
1991 pp_string (buffer
, " __volatile__");
1992 if (gimple_asm_nlabels (gs
))
1993 pp_string (buffer
, " goto");
1994 pp_string (buffer
, "(\"");
1995 pp_string (buffer
, gimple_asm_string (gs
));
1996 pp_string (buffer
, "\"");
1998 if (gimple_asm_nlabels (gs
))
2000 else if (gimple_asm_nclobbers (gs
))
2002 else if (gimple_asm_ninputs (gs
))
2004 else if (gimple_asm_noutputs (gs
))
2009 for (f
= 0; f
< fields
; ++f
)
2011 pp_string (buffer
, " : ");
2016 n
= gimple_asm_noutputs (gs
);
2017 for (i
= 0; i
< n
; i
++)
2019 dump_generic_node (buffer
, gimple_asm_output_op (gs
, i
),
2022 pp_string (buffer
, ", ");
2027 n
= gimple_asm_ninputs (gs
);
2028 for (i
= 0; i
< n
; i
++)
2030 dump_generic_node (buffer
, gimple_asm_input_op (gs
, i
),
2033 pp_string (buffer
, ", ");
2038 n
= gimple_asm_nclobbers (gs
);
2039 for (i
= 0; i
< n
; i
++)
2041 dump_generic_node (buffer
, gimple_asm_clobber_op (gs
, i
),
2044 pp_string (buffer
, ", ");
2049 n
= gimple_asm_nlabels (gs
);
2050 for (i
= 0; i
< n
; i
++)
2052 dump_generic_node (buffer
, gimple_asm_label_op (gs
, i
),
2055 pp_string (buffer
, ", ");
2064 pp_string (buffer
, ");");
2068 /* Dump ptr_info and range_info for NODE on pretty_printer BUFFER with
2069 SPC spaces of indent. */
2072 dump_ssaname_info (pretty_printer
*buffer
, tree node
, int spc
)
2074 if (TREE_CODE (node
) != SSA_NAME
)
2077 if (POINTER_TYPE_P (TREE_TYPE (node
))
2078 && SSA_NAME_PTR_INFO (node
))
2080 unsigned int align
, misalign
;
2081 struct ptr_info_def
*pi
= SSA_NAME_PTR_INFO (node
);
2082 pp_string (buffer
, "# PT = ");
2083 pp_points_to_solution (buffer
, &pi
->pt
);
2084 newline_and_indent (buffer
, spc
);
2085 if (get_ptr_info_alignment (pi
, &align
, &misalign
))
2087 pp_printf (buffer
, "# ALIGN = %u, MISALIGN = %u", align
, misalign
);
2088 newline_and_indent (buffer
, spc
);
2092 if (!POINTER_TYPE_P (TREE_TYPE (node
))
2093 && SSA_NAME_RANGE_INFO (node
))
2095 wide_int min
, max
, nonzero_bits
;
2096 value_range_type range_type
= get_range_info (node
, &min
, &max
);
2098 if (range_type
== VR_VARYING
)
2099 pp_printf (buffer
, "# RANGE VR_VARYING");
2100 else if (range_type
== VR_RANGE
|| range_type
== VR_ANTI_RANGE
)
2102 pp_printf (buffer
, "# RANGE ");
2103 pp_printf (buffer
, "%s[", range_type
== VR_RANGE
? "" : "~");
2104 pp_wide_int (buffer
, min
, TYPE_SIGN (TREE_TYPE (node
)));
2105 pp_printf (buffer
, ", ");
2106 pp_wide_int (buffer
, max
, TYPE_SIGN (TREE_TYPE (node
)));
2107 pp_printf (buffer
, "]");
2109 nonzero_bits
= get_nonzero_bits (node
);
2110 if (nonzero_bits
!= -1)
2112 pp_string (buffer
, " NONZERO ");
2113 pp_wide_int (buffer
, nonzero_bits
, UNSIGNED
);
2115 newline_and_indent (buffer
, spc
);
2119 /* As dump_ssaname_info, but dump to FILE. */
2122 dump_ssaname_info_to_file (FILE *file
, tree node
, int spc
)
2124 pretty_printer buffer
;
2125 pp_needs_newline (&buffer
) = true;
2126 buffer
.buffer
->stream
= file
;
2127 dump_ssaname_info (&buffer
, node
, spc
);
2131 /* Dump a PHI node PHI. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1.
2132 The caller is responsible for calling pp_flush on BUFFER to finalize
2133 pretty printer. If COMMENT is true, print this after #. */
2136 dump_gimple_phi (pretty_printer
*buffer
, gphi
*phi
, int spc
, bool comment
,
2140 tree lhs
= gimple_phi_result (phi
);
2142 if (flags
& TDF_ALIAS
)
2143 dump_ssaname_info (buffer
, lhs
, spc
);
2146 pp_string (buffer
, "# ");
2148 if (flags
& TDF_RAW
)
2149 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, ", phi
,
2150 gimple_phi_result (phi
));
2153 dump_generic_node (buffer
, lhs
, spc
, flags
, false);
2154 if (flags
& TDF_GIMPLE
)
2155 pp_string (buffer
, " = __PHI (");
2157 pp_string (buffer
, " = PHI <");
2159 for (i
= 0; i
< gimple_phi_num_args (phi
); i
++)
2161 if ((flags
& TDF_LINENO
) && gimple_phi_arg_has_location (phi
, i
))
2162 dump_location (buffer
, gimple_phi_arg_location (phi
, i
));
2163 if (flags
& TDF_GIMPLE
)
2165 basic_block src
= gimple_phi_arg_edge (phi
, i
)->src
;
2166 gimple
*stmt
= first_stmt (src
);
2167 if (!stmt
|| gimple_code (stmt
) != GIMPLE_LABEL
)
2169 pp_string (buffer
, "bb_");
2170 pp_decimal_int (buffer
, src
->index
);
2173 dump_generic_node (buffer
, gimple_label_label (as_a
<glabel
*> (stmt
)), 0, flags
,
2175 pp_string (buffer
, ": ");
2177 dump_generic_node (buffer
, gimple_phi_arg_def (phi
, i
), spc
, flags
,
2179 if (! (flags
& TDF_GIMPLE
))
2181 pp_left_paren (buffer
);
2182 pp_decimal_int (buffer
, gimple_phi_arg_edge (phi
, i
)->src
->index
);
2183 pp_right_paren (buffer
);
2185 if (i
< gimple_phi_num_args (phi
) - 1)
2186 pp_string (buffer
, ", ");
2188 if (flags
& TDF_GIMPLE
)
2189 pp_string (buffer
, ");");
2191 pp_greater (buffer
);
2195 /* Dump a GIMPLE_OMP_PARALLEL tuple on the pretty_printer BUFFER, SPC spaces
2196 of indent. FLAGS specifies details to show in the dump (see TDF_* in
2200 dump_gimple_omp_parallel (pretty_printer
*buffer
, gomp_parallel
*gs
,
2203 if (flags
& TDF_RAW
)
2205 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
2206 gimple_omp_body (gs
));
2207 dump_omp_clauses (buffer
, gimple_omp_parallel_clauses (gs
), spc
, flags
);
2208 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T%n>",
2209 gimple_omp_parallel_child_fn (gs
),
2210 gimple_omp_parallel_data_arg (gs
));
2215 pp_string (buffer
, "#pragma omp parallel");
2216 dump_omp_clauses (buffer
, gimple_omp_parallel_clauses (gs
), spc
, flags
);
2217 if (gimple_omp_parallel_child_fn (gs
))
2219 pp_string (buffer
, " [child fn: ");
2220 dump_generic_node (buffer
, gimple_omp_parallel_child_fn (gs
),
2222 pp_string (buffer
, " (");
2223 if (gimple_omp_parallel_data_arg (gs
))
2224 dump_generic_node (buffer
, gimple_omp_parallel_data_arg (gs
),
2227 pp_string (buffer
, "???");
2228 pp_string (buffer
, ")]");
2230 body
= gimple_omp_body (gs
);
2231 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
2233 newline_and_indent (buffer
, spc
+ 2);
2234 pp_left_brace (buffer
);
2235 pp_newline (buffer
);
2236 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
2237 newline_and_indent (buffer
, spc
+ 2);
2238 pp_right_brace (buffer
);
2242 pp_newline (buffer
);
2243 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
2249 /* Dump a GIMPLE_OMP_TASK tuple on the pretty_printer BUFFER, SPC spaces
2250 of indent. FLAGS specifies details to show in the dump (see TDF_* in
2254 dump_gimple_omp_task (pretty_printer
*buffer
, gomp_task
*gs
, int spc
,
2257 if (flags
& TDF_RAW
)
2259 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
2260 gimple_omp_body (gs
));
2261 dump_omp_clauses (buffer
, gimple_omp_task_clauses (gs
), spc
, flags
);
2262 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T, %T, %T, %T%n>",
2263 gimple_omp_task_child_fn (gs
),
2264 gimple_omp_task_data_arg (gs
),
2265 gimple_omp_task_copy_fn (gs
),
2266 gimple_omp_task_arg_size (gs
),
2267 gimple_omp_task_arg_size (gs
));
2272 if (gimple_omp_task_taskloop_p (gs
))
2273 pp_string (buffer
, "#pragma omp taskloop");
2275 pp_string (buffer
, "#pragma omp task");
2276 dump_omp_clauses (buffer
, gimple_omp_task_clauses (gs
), spc
, flags
);
2277 if (gimple_omp_task_child_fn (gs
))
2279 pp_string (buffer
, " [child fn: ");
2280 dump_generic_node (buffer
, gimple_omp_task_child_fn (gs
),
2282 pp_string (buffer
, " (");
2283 if (gimple_omp_task_data_arg (gs
))
2284 dump_generic_node (buffer
, gimple_omp_task_data_arg (gs
),
2287 pp_string (buffer
, "???");
2288 pp_string (buffer
, ")]");
2290 body
= gimple_omp_body (gs
);
2291 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
2293 newline_and_indent (buffer
, spc
+ 2);
2294 pp_left_brace (buffer
);
2295 pp_newline (buffer
);
2296 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
2297 newline_and_indent (buffer
, spc
+ 2);
2298 pp_right_brace (buffer
);
2302 pp_newline (buffer
);
2303 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
2309 /* Dump a GIMPLE_OMP_ATOMIC_LOAD tuple on the pretty_printer BUFFER, SPC
2310 spaces of indent. FLAGS specifies details to show in the dump (see TDF_*
2314 dump_gimple_omp_atomic_load (pretty_printer
*buffer
, gomp_atomic_load
*gs
,
2317 if (flags
& TDF_RAW
)
2319 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T>", gs
,
2320 gimple_omp_atomic_load_lhs (gs
),
2321 gimple_omp_atomic_load_rhs (gs
));
2325 pp_string (buffer
, "#pragma omp atomic_load");
2326 if (gimple_omp_atomic_seq_cst_p (gs
))
2327 pp_string (buffer
, " seq_cst");
2328 if (gimple_omp_atomic_need_value_p (gs
))
2329 pp_string (buffer
, " [needed]");
2330 newline_and_indent (buffer
, spc
+ 2);
2331 dump_generic_node (buffer
, gimple_omp_atomic_load_lhs (gs
),
2337 dump_generic_node (buffer
, gimple_omp_atomic_load_rhs (gs
),
2342 /* Dump a GIMPLE_OMP_ATOMIC_STORE tuple on the pretty_printer BUFFER, SPC
2343 spaces of indent. FLAGS specifies details to show in the dump (see TDF_*
2347 dump_gimple_omp_atomic_store (pretty_printer
*buffer
,
2348 gomp_atomic_store
*gs
, int spc
, int flags
)
2350 if (flags
& TDF_RAW
)
2352 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
,
2353 gimple_omp_atomic_store_val (gs
));
2357 pp_string (buffer
, "#pragma omp atomic_store ");
2358 if (gimple_omp_atomic_seq_cst_p (gs
))
2359 pp_string (buffer
, "seq_cst ");
2360 if (gimple_omp_atomic_need_value_p (gs
))
2361 pp_string (buffer
, "[needed] ");
2362 pp_left_paren (buffer
);
2363 dump_generic_node (buffer
, gimple_omp_atomic_store_val (gs
),
2365 pp_right_paren (buffer
);
2370 /* Dump all the memory operands for statement GS. BUFFER, SPC and
2371 FLAGS are as in pp_gimple_stmt_1. */
2374 dump_gimple_mem_ops (pretty_printer
*buffer
, gimple
*gs
, int spc
, int flags
)
2376 tree vdef
= gimple_vdef (gs
);
2377 tree vuse
= gimple_vuse (gs
);
2379 if (vdef
!= NULL_TREE
)
2381 pp_string (buffer
, "# ");
2382 dump_generic_node (buffer
, vdef
, spc
+ 2, flags
, false);
2383 pp_string (buffer
, " = VDEF <");
2384 dump_generic_node (buffer
, vuse
, spc
+ 2, flags
, false);
2385 pp_greater (buffer
);
2386 newline_and_indent (buffer
, spc
);
2388 else if (vuse
!= NULL_TREE
)
2390 pp_string (buffer
, "# VUSE <");
2391 dump_generic_node (buffer
, vuse
, spc
+ 2, flags
, false);
2392 pp_greater (buffer
);
2393 newline_and_indent (buffer
, spc
);
2398 /* Print the gimple statement GS on the pretty printer BUFFER, SPC
2399 spaces of indent. FLAGS specifies details to show in the dump (see
2400 TDF_* in dumpfile.h). The caller is responsible for calling
2401 pp_flush on BUFFER to finalize the pretty printer. */
2404 pp_gimple_stmt_1 (pretty_printer
*buffer
, gimple
*gs
, int spc
, int flags
)
2409 if (flags
& TDF_STMTADDR
)
2410 pp_printf (buffer
, "<&%p> ", (void *) gs
);
2412 if ((flags
& TDF_LINENO
) && gimple_has_location (gs
))
2413 dump_location (buffer
, gimple_location (gs
));
2417 int lp_nr
= lookup_stmt_eh_lp (gs
);
2419 pp_printf (buffer
, "[LP %d] ", lp_nr
);
2421 pp_printf (buffer
, "[MNT %d] ", -lp_nr
);
2424 if ((flags
& (TDF_VOPS
|TDF_MEMSYMS
))
2425 && gimple_has_mem_ops (gs
))
2426 dump_gimple_mem_ops (buffer
, gs
, spc
, flags
);
2428 if (gimple_has_lhs (gs
)
2429 && (flags
& TDF_ALIAS
))
2430 dump_ssaname_info (buffer
, gimple_get_lhs (gs
), spc
);
2432 switch (gimple_code (gs
))
2435 dump_gimple_asm (buffer
, as_a
<gasm
*> (gs
), spc
, flags
);
2439 dump_gimple_assign (buffer
, as_a
<gassign
*> (gs
), spc
, flags
);
2443 dump_gimple_bind (buffer
, as_a
<gbind
*> (gs
), spc
, flags
);
2447 dump_gimple_call (buffer
, as_a
<gcall
*> (gs
), spc
, flags
);
2451 dump_gimple_cond (buffer
, as_a
<gcond
*> (gs
), spc
, flags
);
2455 dump_gimple_label (buffer
, as_a
<glabel
*> (gs
), spc
, flags
);
2459 dump_gimple_goto (buffer
, as_a
<ggoto
*> (gs
), spc
, flags
);
2463 pp_string (buffer
, "GIMPLE_NOP");
2467 dump_gimple_return (buffer
, as_a
<greturn
*> (gs
), spc
, flags
);
2471 dump_gimple_switch (buffer
, as_a
<gswitch
*> (gs
), spc
, flags
);
2475 dump_gimple_try (buffer
, as_a
<gtry
*> (gs
), spc
, flags
);
2479 dump_gimple_phi (buffer
, as_a
<gphi
*> (gs
), spc
, false, flags
);
2482 case GIMPLE_OMP_PARALLEL
:
2483 dump_gimple_omp_parallel (buffer
, as_a
<gomp_parallel
*> (gs
), spc
,
2487 case GIMPLE_OMP_TASK
:
2488 dump_gimple_omp_task (buffer
, as_a
<gomp_task
*> (gs
), spc
, flags
);
2491 case GIMPLE_OMP_ATOMIC_LOAD
:
2492 dump_gimple_omp_atomic_load (buffer
, as_a
<gomp_atomic_load
*> (gs
),
2496 case GIMPLE_OMP_ATOMIC_STORE
:
2497 dump_gimple_omp_atomic_store (buffer
,
2498 as_a
<gomp_atomic_store
*> (gs
),
2502 case GIMPLE_OMP_FOR
:
2503 dump_gimple_omp_for (buffer
, as_a
<gomp_for
*> (gs
), spc
, flags
);
2506 case GIMPLE_OMP_CONTINUE
:
2507 dump_gimple_omp_continue (buffer
, as_a
<gomp_continue
*> (gs
), spc
,
2511 case GIMPLE_OMP_SINGLE
:
2512 dump_gimple_omp_single (buffer
, as_a
<gomp_single
*> (gs
), spc
,
2516 case GIMPLE_OMP_TARGET
:
2517 dump_gimple_omp_target (buffer
, as_a
<gomp_target
*> (gs
), spc
,
2521 case GIMPLE_OMP_TEAMS
:
2522 dump_gimple_omp_teams (buffer
, as_a
<gomp_teams
*> (gs
), spc
,
2526 case GIMPLE_OMP_RETURN
:
2527 dump_gimple_omp_return (buffer
, gs
, spc
, flags
);
2530 case GIMPLE_OMP_SECTIONS
:
2531 dump_gimple_omp_sections (buffer
, as_a
<gomp_sections
*> (gs
),
2535 case GIMPLE_OMP_SECTIONS_SWITCH
:
2536 pp_string (buffer
, "GIMPLE_SECTIONS_SWITCH");
2539 case GIMPLE_OMP_MASTER
:
2540 case GIMPLE_OMP_TASKGROUP
:
2541 case GIMPLE_OMP_SECTION
:
2542 case GIMPLE_OMP_GRID_BODY
:
2543 dump_gimple_omp_block (buffer
, gs
, spc
, flags
);
2546 case GIMPLE_OMP_ORDERED
:
2547 dump_gimple_omp_ordered (buffer
, as_a
<gomp_ordered
*> (gs
), spc
,
2551 case GIMPLE_OMP_CRITICAL
:
2552 dump_gimple_omp_critical (buffer
, as_a
<gomp_critical
*> (gs
), spc
,
2557 dump_gimple_catch (buffer
, as_a
<gcatch
*> (gs
), spc
, flags
);
2560 case GIMPLE_EH_FILTER
:
2561 dump_gimple_eh_filter (buffer
, as_a
<geh_filter
*> (gs
), spc
, flags
);
2564 case GIMPLE_EH_MUST_NOT_THROW
:
2565 dump_gimple_eh_must_not_throw (buffer
,
2566 as_a
<geh_mnt
*> (gs
),
2570 case GIMPLE_EH_ELSE
:
2571 dump_gimple_eh_else (buffer
, as_a
<geh_else
*> (gs
), spc
, flags
);
2575 dump_gimple_resx (buffer
, as_a
<gresx
*> (gs
), spc
, flags
);
2578 case GIMPLE_EH_DISPATCH
:
2579 dump_gimple_eh_dispatch (buffer
, as_a
<geh_dispatch
*> (gs
), spc
,
2584 dump_gimple_debug (buffer
, as_a
<gdebug
*> (gs
), spc
, flags
);
2587 case GIMPLE_PREDICT
:
2588 pp_string (buffer
, "// predicted ");
2589 if (gimple_predict_outcome (gs
))
2590 pp_string (buffer
, "likely by ");
2592 pp_string (buffer
, "unlikely by ");
2593 pp_string (buffer
, predictor_name (gimple_predict_predictor (gs
)));
2594 pp_string (buffer
, " predictor.");
2597 case GIMPLE_TRANSACTION
:
2598 dump_gimple_transaction (buffer
, as_a
<gtransaction
*> (gs
), spc
,
2608 /* Dumps header of basic block BB to OUTF indented by INDENT
2609 spaces and details described by flags. */
2612 dump_gimple_bb_header (FILE *outf
, basic_block bb
, int indent
, int flags
)
2614 if (flags
& TDF_BLOCKS
)
2616 if (flags
& TDF_LINENO
)
2618 gimple_stmt_iterator gsi
;
2620 if (flags
& TDF_COMMENT
)
2621 fputs (";; ", outf
);
2623 for (gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
); gsi_next (&gsi
))
2624 if (!is_gimple_debug (gsi_stmt (gsi
))
2625 && get_lineno (gsi_stmt (gsi
)) != UNKNOWN_LOCATION
)
2627 fprintf (outf
, "%*sstarting at line %d",
2628 indent
, "", get_lineno (gsi_stmt (gsi
)));
2631 if (bb
->discriminator
)
2632 fprintf (outf
, ", discriminator %i", bb
->discriminator
);
2638 gimple
*stmt
= first_stmt (bb
);
2639 if (!stmt
|| gimple_code (stmt
) != GIMPLE_LABEL
)
2641 if (flags
& TDF_GIMPLE
)
2642 fprintf (outf
, "%*sbb_%d:\n", indent
, "", bb
->index
);
2644 fprintf (outf
, "%*s<bb %d> %s:\n",
2645 indent
, "", bb
->index
, dump_probability (bb
->frequency
));
2651 /* Dumps end of basic block BB to buffer BUFFER indented by INDENT
2655 dump_gimple_bb_footer (FILE *outf ATTRIBUTE_UNUSED
,
2656 basic_block bb ATTRIBUTE_UNUSED
,
2657 int indent ATTRIBUTE_UNUSED
,
2658 int flags ATTRIBUTE_UNUSED
)
2660 /* There is currently no GIMPLE-specific basic block info to dump. */
2665 /* Dump PHI nodes of basic block BB to BUFFER with details described
2666 by FLAGS and indented by INDENT spaces. */
2669 dump_phi_nodes (pretty_printer
*buffer
, basic_block bb
, int indent
, int flags
)
2673 for (i
= gsi_start_phis (bb
); !gsi_end_p (i
); gsi_next (&i
))
2675 gphi
*phi
= i
.phi ();
2676 if (!virtual_operand_p (gimple_phi_result (phi
)) || (flags
& TDF_VOPS
))
2679 dump_gimple_phi (buffer
, phi
, indent
,
2680 (flags
& TDF_GIMPLE
) ? false : true, flags
);
2681 pp_newline (buffer
);
2687 /* Dump jump to basic block BB that is represented implicitly in the cfg
2691 pp_cfg_jump (pretty_printer
*buffer
, edge e
, int flags
)
2693 if (flags
& TDF_GIMPLE
)
2695 pp_string (buffer
, "goto bb_");
2696 pp_decimal_int (buffer
, e
->dest
->index
);
2697 pp_semicolon (buffer
);
2701 gimple
*stmt
= first_stmt (e
->dest
);
2703 pp_string (buffer
, "goto <bb ");
2704 pp_decimal_int (buffer
, e
->dest
->index
);
2705 pp_greater (buffer
);
2706 if (stmt
&& gimple_code (stmt
) == GIMPLE_LABEL
)
2708 pp_string (buffer
, " (");
2709 dump_generic_node (buffer
,
2710 gimple_label_label (as_a
<glabel
*> (stmt
)),
2712 pp_right_paren (buffer
);
2713 pp_semicolon (buffer
);
2716 pp_semicolon (buffer
);
2718 dump_edge_probability (buffer
, e
);
2723 /* Dump edges represented implicitly in basic block BB to BUFFER, indented
2724 by INDENT spaces, with details given by FLAGS. */
2727 dump_implicit_edges (pretty_printer
*buffer
, basic_block bb
, int indent
,
2733 stmt
= last_stmt (bb
);
2735 if (stmt
&& gimple_code (stmt
) == GIMPLE_COND
)
2737 edge true_edge
, false_edge
;
2739 /* When we are emitting the code or changing CFG, it is possible that
2740 the edges are not yet created. When we are using debug_bb in such
2741 a situation, we do not want it to crash. */
2742 if (EDGE_COUNT (bb
->succs
) != 2)
2744 extract_true_false_edges_from_block (bb
, &true_edge
, &false_edge
);
2746 INDENT (indent
+ 2);
2747 pp_cfg_jump (buffer
, true_edge
, flags
);
2748 newline_and_indent (buffer
, indent
);
2749 pp_string (buffer
, "else");
2750 newline_and_indent (buffer
, indent
+ 2);
2751 pp_cfg_jump (buffer
, false_edge
, flags
);
2752 pp_newline (buffer
);
2756 /* If there is a fallthru edge, we may need to add an artificial
2757 goto to the dump. */
2758 e
= find_fallthru_edge (bb
->succs
);
2760 if (e
&& e
->dest
!= bb
->next_bb
)
2764 if ((flags
& TDF_LINENO
)
2765 && e
->goto_locus
!= UNKNOWN_LOCATION
)
2766 dump_location (buffer
, e
->goto_locus
);
2768 pp_cfg_jump (buffer
, e
, flags
);
2769 pp_newline (buffer
);
2774 /* Dumps basic block BB to buffer BUFFER with details described by FLAGS and
2775 indented by INDENT spaces. */
2778 gimple_dump_bb_buff (pretty_printer
*buffer
, basic_block bb
, int indent
,
2781 gimple_stmt_iterator gsi
;
2783 int label_indent
= indent
- 2;
2785 if (label_indent
< 0)
2788 dump_phi_nodes (buffer
, bb
, indent
, flags
);
2790 for (gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
); gsi_next (&gsi
))
2794 stmt
= gsi_stmt (gsi
);
2796 curr_indent
= gimple_code (stmt
) == GIMPLE_LABEL
? label_indent
: indent
;
2798 INDENT (curr_indent
);
2799 pp_gimple_stmt_1 (buffer
, stmt
, curr_indent
, flags
);
2800 pp_newline_and_flush (buffer
);
2801 gcc_checking_assert (DECL_STRUCT_FUNCTION (current_function_decl
));
2802 dump_histograms_for_stmt (DECL_STRUCT_FUNCTION (current_function_decl
),
2803 pp_buffer (buffer
)->stream
, stmt
);
2806 dump_implicit_edges (buffer
, bb
, indent
, flags
);
2811 /* Dumps basic block BB to FILE with details described by FLAGS and
2812 indented by INDENT spaces. */
2815 gimple_dump_bb (FILE *file
, basic_block bb
, int indent
, int flags
)
2817 dump_gimple_bb_header (file
, bb
, indent
, flags
);
2818 if (bb
->index
>= NUM_FIXED_BLOCKS
)
2820 pretty_printer buffer
;
2821 pp_needs_newline (&buffer
) = true;
2822 buffer
.buffer
->stream
= file
;
2823 gimple_dump_bb_buff (&buffer
, bb
, indent
, flags
);
2825 dump_gimple_bb_footer (file
, bb
, indent
, flags
);
2828 /* Dumps basic block BB to pretty-printer PP with default dump flags and
2829 no indentation, for use as a label of a DOT graph record-node.
2830 ??? Should just use gimple_dump_bb_buff here, except that value profiling
2831 histogram dumping doesn't know about pretty-printers. */
2834 gimple_dump_bb_for_graph (pretty_printer
*pp
, basic_block bb
)
2836 pp_printf (pp
, "<bb %d>:\n", bb
->index
);
2837 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
2839 for (gphi_iterator gsi
= gsi_start_phis (bb
); !gsi_end_p (gsi
);
2842 gphi
*phi
= gsi
.phi ();
2843 if (!virtual_operand_p (gimple_phi_result (phi
))
2844 || (dump_flags
& TDF_VOPS
))
2847 pp_write_text_to_stream (pp
);
2848 pp_string (pp
, "# ");
2849 pp_gimple_stmt_1 (pp
, phi
, 0, dump_flags
);
2851 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
2855 for (gimple_stmt_iterator gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
);
2858 gimple
*stmt
= gsi_stmt (gsi
);
2860 pp_write_text_to_stream (pp
);
2861 pp_gimple_stmt_1 (pp
, stmt
, 0, dump_flags
);
2863 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
2865 dump_implicit_edges (pp
, bb
, 0, dump_flags
);
2866 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);