1 /* Pretty formatting of GIMPLE statements and expressions.
2 Copyright (C) 2001-2017 Free Software Foundation, Inc.
3 Contributed by Aldy Hernandez <aldyh@redhat.com> and
4 Diego Novillo <dnovillo@google.com>
6 This file is part of GCC.
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 3, or (at your option) any later
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING3. If not see
20 <http://www.gnu.org/licenses/>. */
24 #include "coretypes.h"
29 #include "gimple-predict.h"
32 #include "gimple-pretty-print.h"
33 #include "internal-fn.h"
35 #include "gimple-iterator.h"
37 #include "dumpfile.h" /* for dump_flags */
38 #include "value-prof.h"
39 #include "trans-mem.h"
43 #define INDENT(SPACE) \
44 do { int i; for (i = 0; i < SPACE; i++) pp_space (buffer); } while (0)
46 #define GIMPLE_NIY do_niy (buffer,gs)
48 /* Try to print on BUFFER a default message for the unrecognized
49 gimple statement GS. */
52 do_niy (pretty_printer
*buffer
, gimple
*gs
)
54 pp_printf (buffer
, "<<< Unknown GIMPLE statement: %s >>>\n",
55 gimple_code_name
[(int) gimple_code (gs
)]);
59 /* Emit a newline and SPC indentation spaces to BUFFER. */
62 newline_and_indent (pretty_printer
*buffer
, int spc
)
69 /* Print the GIMPLE statement GS on stderr. */
72 debug_gimple_stmt (gimple
*gs
)
74 print_gimple_stmt (stderr
, gs
, 0, TDF_VOPS
|TDF_MEMSYMS
);
78 /* Return formatted string of a VALUE probability
79 (biased by REG_BR_PROB_BASE). Returned string is allocated
80 by xstrdup_for_dump. */
83 dump_probability (int value
)
85 float minimum
= 0.01f
;
87 gcc_assert (0 <= value
&& value
<= REG_BR_PROB_BASE
);
88 float fvalue
= value
* 100.0f
/ REG_BR_PROB_BASE
;
89 if (fvalue
< minimum
&& value
> 0)
93 asprintf (&buf
, "[%.2f%%]", fvalue
);
94 const char *ret
= xstrdup_for_dump (buf
);
100 /* Dump E probability to BUFFER. */
103 dump_edge_probability (pretty_printer
*buffer
, edge e
)
105 pp_scalar (buffer
, " %s", dump_probability (e
->probability
));
108 /* Print GIMPLE statement G to FILE using SPC indentation spaces and
109 FLAGS as in pp_gimple_stmt_1. */
112 print_gimple_stmt (FILE *file
, gimple
*g
, int spc
, dump_flags_t flags
)
114 pretty_printer buffer
;
115 pp_needs_newline (&buffer
) = true;
116 buffer
.buffer
->stream
= file
;
117 pp_gimple_stmt_1 (&buffer
, g
, spc
, flags
);
118 pp_newline_and_flush (&buffer
);
124 print_gimple_stmt (stderr
, &ref
, 0, 0);
133 fprintf (stderr
, "<nil>\n");
137 /* Print GIMPLE statement G to FILE using SPC indentation spaces and
138 FLAGS as in pp_gimple_stmt_1. Print only the right-hand side
142 print_gimple_expr (FILE *file
, gimple
*g
, int spc
, dump_flags_t flags
)
144 flags
|= TDF_RHS_ONLY
;
145 pretty_printer buffer
;
146 pp_needs_newline (&buffer
) = true;
147 buffer
.buffer
->stream
= file
;
148 pp_gimple_stmt_1 (&buffer
, g
, spc
, flags
);
153 /* Print the GIMPLE sequence SEQ on BUFFER using SPC indentation
154 spaces and FLAGS as in pp_gimple_stmt_1.
155 The caller is responsible for calling pp_flush on BUFFER to finalize
156 the pretty printer. */
159 dump_gimple_seq (pretty_printer
*buffer
, gimple_seq seq
, int spc
,
162 gimple_stmt_iterator i
;
164 for (i
= gsi_start (seq
); !gsi_end_p (i
); gsi_next (&i
))
166 gimple
*gs
= gsi_stmt (i
);
168 pp_gimple_stmt_1 (buffer
, gs
, spc
, flags
);
169 if (!gsi_one_before_end_p (i
))
175 /* Print GIMPLE sequence SEQ to FILE using SPC indentation spaces and
176 FLAGS as in pp_gimple_stmt_1. */
179 print_gimple_seq (FILE *file
, gimple_seq seq
, int spc
, dump_flags_t flags
)
181 pretty_printer buffer
;
182 pp_needs_newline (&buffer
) = true;
183 buffer
.buffer
->stream
= file
;
184 dump_gimple_seq (&buffer
, seq
, spc
, flags
);
185 pp_newline_and_flush (&buffer
);
189 /* Print the GIMPLE sequence SEQ on stderr. */
192 debug_gimple_seq (gimple_seq seq
)
194 print_gimple_seq (stderr
, seq
, 0, TDF_VOPS
|TDF_MEMSYMS
);
198 /* A simple helper to pretty-print some of the gimple tuples in the printf
199 style. The format modifiers are preceded by '%' and are:
200 'G' - outputs a string corresponding to the code of the given gimple,
201 'S' - outputs a gimple_seq with indent of spc + 2,
202 'T' - outputs the tree t,
203 'd' - outputs an int as a decimal,
204 's' - outputs a string,
205 'n' - outputs a newline,
206 'x' - outputs an int as hexadecimal,
207 '+' - increases indent by 2 then outputs a newline,
208 '-' - decreases indent by 2 then outputs a newline. */
211 dump_gimple_fmt (pretty_printer
*buffer
, int spc
, dump_flags_t flags
,
212 const char *fmt
, ...)
218 va_start (args
, fmt
);
219 for (c
= fmt
; *c
; c
++)
229 g
= va_arg (args
, gimple
*);
230 tmp
= gimple_code_name
[gimple_code (g
)];
231 pp_string (buffer
, tmp
);
235 seq
= va_arg (args
, gimple_seq
);
237 dump_gimple_seq (buffer
, seq
, spc
+ 2, flags
);
238 newline_and_indent (buffer
, spc
);
242 t
= va_arg (args
, tree
);
244 pp_string (buffer
, "NULL");
246 dump_generic_node (buffer
, t
, spc
, flags
, false);
250 pp_decimal_int (buffer
, va_arg (args
, int));
254 pp_string (buffer
, va_arg (args
, char *));
258 newline_and_indent (buffer
, spc
);
262 pp_scalar (buffer
, "%x", va_arg (args
, int));
267 newline_and_indent (buffer
, spc
);
272 newline_and_indent (buffer
, spc
);
280 pp_character (buffer
, *c
);
286 /* Helper for dump_gimple_assign. Print the unary RHS of the
287 assignment GS. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. */
290 dump_unary_rhs (pretty_printer
*buffer
, gassign
*gs
, int spc
,
293 enum tree_code rhs_code
= gimple_assign_rhs_code (gs
);
294 tree lhs
= gimple_assign_lhs (gs
);
295 tree rhs
= gimple_assign_rhs1 (gs
);
299 case VIEW_CONVERT_EXPR
:
301 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
304 case FIXED_CONVERT_EXPR
:
305 case ADDR_SPACE_CONVERT_EXPR
:
309 pp_left_paren (buffer
);
310 dump_generic_node (buffer
, TREE_TYPE (lhs
), spc
, flags
, false);
311 pp_string (buffer
, ") ");
312 if (op_prio (rhs
) < op_code_prio (rhs_code
))
314 pp_left_paren (buffer
);
315 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
316 pp_right_paren (buffer
);
319 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
323 pp_string (buffer
, "((");
324 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
325 pp_string (buffer
, "))");
329 if (flags
& TDF_GIMPLE
)
331 pp_string (buffer
, "__ABS ");
332 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
336 pp_string (buffer
, "ABS_EXPR <");
337 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
343 if (TREE_CODE_CLASS (rhs_code
) == tcc_declaration
344 || TREE_CODE_CLASS (rhs_code
) == tcc_constant
345 || TREE_CODE_CLASS (rhs_code
) == tcc_reference
346 || rhs_code
== SSA_NAME
347 || rhs_code
== ADDR_EXPR
348 || rhs_code
== CONSTRUCTOR
)
350 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
353 else if (rhs_code
== BIT_NOT_EXPR
)
354 pp_complement (buffer
);
355 else if (rhs_code
== TRUTH_NOT_EXPR
)
356 pp_exclamation (buffer
);
357 else if (rhs_code
== NEGATE_EXPR
)
361 pp_left_bracket (buffer
);
362 pp_string (buffer
, get_tree_code_name (rhs_code
));
363 pp_string (buffer
, "] ");
366 if (op_prio (rhs
) < op_code_prio (rhs_code
))
368 pp_left_paren (buffer
);
369 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
370 pp_right_paren (buffer
);
373 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
379 /* Helper for dump_gimple_assign. Print the binary RHS of the
380 assignment GS. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. */
383 dump_binary_rhs (pretty_printer
*buffer
, gassign
*gs
, int spc
,
387 enum tree_code code
= gimple_assign_rhs_code (gs
);
393 case VEC_WIDEN_MULT_HI_EXPR
:
394 case VEC_WIDEN_MULT_LO_EXPR
:
395 case VEC_WIDEN_MULT_EVEN_EXPR
:
396 case VEC_WIDEN_MULT_ODD_EXPR
:
397 case VEC_PACK_TRUNC_EXPR
:
398 case VEC_PACK_SAT_EXPR
:
399 case VEC_PACK_FIX_TRUNC_EXPR
:
400 case VEC_WIDEN_LSHIFT_HI_EXPR
:
401 case VEC_WIDEN_LSHIFT_LO_EXPR
:
402 for (p
= get_tree_code_name (code
); *p
; p
++)
403 pp_character (buffer
, TOUPPER (*p
));
404 pp_string (buffer
, " <");
405 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
406 pp_string (buffer
, ", ");
407 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
412 if (op_prio (gimple_assign_rhs1 (gs
)) <= op_code_prio (code
))
414 pp_left_paren (buffer
);
415 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
,
417 pp_right_paren (buffer
);
420 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
422 pp_string (buffer
, op_symbol_code (gimple_assign_rhs_code (gs
)));
424 if (op_prio (gimple_assign_rhs2 (gs
)) <= op_code_prio (code
))
426 pp_left_paren (buffer
);
427 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
,
429 pp_right_paren (buffer
);
432 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
436 /* Helper for dump_gimple_assign. Print the ternary RHS of the
437 assignment GS. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. */
440 dump_ternary_rhs (pretty_printer
*buffer
, gassign
*gs
, int spc
,
444 enum tree_code code
= gimple_assign_rhs_code (gs
);
447 case WIDEN_MULT_PLUS_EXPR
:
448 case WIDEN_MULT_MINUS_EXPR
:
449 for (p
= get_tree_code_name (code
); *p
; p
++)
450 pp_character (buffer
, TOUPPER (*p
));
451 pp_string (buffer
, " <");
452 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
453 pp_string (buffer
, ", ");
454 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
455 pp_string (buffer
, ", ");
456 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
461 if (flags
& TDF_GIMPLE
)
463 pp_string (buffer
, "__FMA (");
464 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
466 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
468 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
469 pp_right_paren (buffer
);
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);
482 pp_string (buffer
, "DOT_PROD_EXPR <");
483 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
484 pp_string (buffer
, ", ");
485 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
486 pp_string (buffer
, ", ");
487 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
492 pp_string (buffer
, "SAD_EXPR <");
493 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
494 pp_string (buffer
, ", ");
495 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
496 pp_string (buffer
, ", ");
497 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
502 pp_string (buffer
, "VEC_PERM_EXPR <");
503 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
504 pp_string (buffer
, ", ");
505 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
506 pp_string (buffer
, ", ");
507 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
511 case REALIGN_LOAD_EXPR
:
512 pp_string (buffer
, "REALIGN_LOAD <");
513 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
514 pp_string (buffer
, ", ");
515 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
516 pp_string (buffer
, ", ");
517 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
522 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
523 pp_string (buffer
, " ? ");
524 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
525 pp_string (buffer
, " : ");
526 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
530 pp_string (buffer
, "VEC_COND_EXPR <");
531 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
532 pp_string (buffer
, ", ");
533 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
534 pp_string (buffer
, ", ");
535 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
539 case BIT_INSERT_EXPR
:
540 pp_string (buffer
, "BIT_INSERT_EXPR <");
541 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
542 pp_string (buffer
, ", ");
543 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
544 pp_string (buffer
, ", ");
545 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
546 pp_string (buffer
, " (");
547 if (INTEGRAL_TYPE_P (TREE_TYPE (gimple_assign_rhs2 (gs
))))
548 pp_decimal_int (buffer
,
549 TYPE_PRECISION (TREE_TYPE (gimple_assign_rhs2 (gs
))));
551 dump_generic_node (buffer
,
552 TYPE_SIZE (TREE_TYPE (gimple_assign_rhs2 (gs
))),
554 pp_string (buffer
, " bits)>");
563 /* Dump the gimple assignment GS. BUFFER, SPC and FLAGS are as in
567 dump_gimple_assign (pretty_printer
*buffer
, gassign
*gs
, int spc
,
575 switch (gimple_num_ops (gs
))
578 arg3
= gimple_assign_rhs3 (gs
);
581 arg2
= gimple_assign_rhs2 (gs
);
584 arg1
= gimple_assign_rhs1 (gs
);
590 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%s, %T, %T, %T, %T>", gs
,
591 get_tree_code_name (gimple_assign_rhs_code (gs
)),
592 gimple_assign_lhs (gs
), arg1
, arg2
, arg3
);
596 if (!(flags
& TDF_RHS_ONLY
))
598 dump_generic_node (buffer
, gimple_assign_lhs (gs
), spc
, flags
, false);
602 if (gimple_assign_nontemporal_move_p (gs
))
603 pp_string (buffer
, "{nt}");
605 if (gimple_has_volatile_ops (gs
))
606 pp_string (buffer
, "{v}");
611 if (gimple_num_ops (gs
) == 2)
612 dump_unary_rhs (buffer
, gs
, spc
, flags
);
613 else if (gimple_num_ops (gs
) == 3)
614 dump_binary_rhs (buffer
, gs
, spc
, flags
);
615 else if (gimple_num_ops (gs
) == 4)
616 dump_ternary_rhs (buffer
, gs
, spc
, flags
);
619 if (!(flags
& TDF_RHS_ONLY
))
620 pp_semicolon (buffer
);
625 /* Dump the return statement GS. BUFFER, SPC and FLAGS are as in
629 dump_gimple_return (pretty_printer
*buffer
, greturn
*gs
, int spc
,
634 t
= gimple_return_retval (gs
);
635 t2
= gimple_return_retbnd (gs
);
637 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T %T>", gs
, t
, t2
);
640 pp_string (buffer
, "return");
644 dump_generic_node (buffer
, t
, spc
, flags
, false);
648 pp_string (buffer
, ", ");
649 dump_generic_node (buffer
, t2
, spc
, flags
, false);
651 pp_semicolon (buffer
);
656 /* Dump the call arguments for a gimple call. BUFFER, FLAGS are as in
660 dump_gimple_call_args (pretty_printer
*buffer
, gcall
*gs
, dump_flags_t flags
)
664 /* Pretty print first arg to certain internal fns. */
665 if (gimple_call_internal_p (gs
))
667 const char *const *enums
= NULL
;
670 switch (gimple_call_internal_fn (gs
))
674 static const char *const unique_args
[] = {IFN_UNIQUE_CODES
};
678 limit
= ARRAY_SIZE (unique_args
);
683 static const char *const loop_args
[] = {IFN_GOACC_LOOP_CODES
};
686 limit
= ARRAY_SIZE (loop_args
);
689 case IFN_GOACC_REDUCTION
:
691 static const char *const reduction_args
[]
692 = {IFN_GOACC_REDUCTION_CODES
};
694 enums
= reduction_args
;
695 limit
= ARRAY_SIZE (reduction_args
);
700 static const char *const asan_mark_args
[] = {IFN_ASAN_MARK_FLAGS
};
702 enums
= asan_mark_args
;
703 limit
= ARRAY_SIZE (asan_mark_args
);
711 tree arg0
= gimple_call_arg (gs
, 0);
714 if (TREE_CODE (arg0
) == INTEGER_CST
715 && tree_fits_shwi_p (arg0
)
716 && (v
= tree_to_shwi (arg0
)) >= 0 && v
< limit
)
719 pp_string (buffer
, enums
[v
]);
724 for (; i
< gimple_call_num_args (gs
); i
++)
727 pp_string (buffer
, ", ");
728 dump_generic_node (buffer
, gimple_call_arg (gs
, i
), 0, flags
, false);
731 if (gimple_call_va_arg_pack_p (gs
))
734 pp_string (buffer
, ", ");
736 pp_string (buffer
, "__builtin_va_arg_pack ()");
740 /* Dump the points-to solution *PT to BUFFER. */
743 pp_points_to_solution (pretty_printer
*buffer
, struct pt_solution
*pt
)
747 pp_string (buffer
, "anything ");
751 pp_string (buffer
, "nonlocal ");
753 pp_string (buffer
, "escaped ");
755 pp_string (buffer
, "unit-escaped ");
757 pp_string (buffer
, "null ");
759 && !bitmap_empty_p (pt
->vars
))
763 pp_string (buffer
, "{ ");
764 EXECUTE_IF_SET_IN_BITMAP (pt
->vars
, 0, i
, bi
)
766 pp_string (buffer
, "D.");
767 pp_decimal_int (buffer
, i
);
770 pp_right_brace (buffer
);
771 if (pt
->vars_contains_nonlocal
772 || pt
->vars_contains_escaped
773 || pt
->vars_contains_escaped_heap
774 || pt
->vars_contains_restrict
)
776 const char *comma
= "";
777 pp_string (buffer
, " (");
778 if (pt
->vars_contains_nonlocal
)
780 pp_string (buffer
, "nonlocal");
783 if (pt
->vars_contains_escaped
)
785 pp_string (buffer
, comma
);
786 pp_string (buffer
, "escaped");
789 if (pt
->vars_contains_escaped_heap
)
791 pp_string (buffer
, comma
);
792 pp_string (buffer
, "escaped heap");
795 if (pt
->vars_contains_restrict
)
797 pp_string (buffer
, comma
);
798 pp_string (buffer
, "restrict");
801 if (pt
->vars_contains_interposable
)
803 pp_string (buffer
, comma
);
804 pp_string (buffer
, "interposable");
806 pp_string (buffer
, ")");
812 /* Dump the call statement GS. BUFFER, SPC and FLAGS are as in
816 dump_gimple_call (pretty_printer
*buffer
, gcall
*gs
, int spc
,
819 tree lhs
= gimple_call_lhs (gs
);
820 tree fn
= gimple_call_fn (gs
);
822 if (flags
& TDF_ALIAS
)
824 struct pt_solution
*pt
;
825 pt
= gimple_call_use_set (gs
);
826 if (!pt_solution_empty_p (pt
))
828 pp_string (buffer
, "# USE = ");
829 pp_points_to_solution (buffer
, pt
);
830 newline_and_indent (buffer
, spc
);
832 pt
= gimple_call_clobber_set (gs
);
833 if (!pt_solution_empty_p (pt
))
835 pp_string (buffer
, "# CLB = ");
836 pp_points_to_solution (buffer
, pt
);
837 newline_and_indent (buffer
, spc
);
843 if (gimple_call_internal_p (gs
))
844 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%s, %T", gs
,
845 internal_fn_name (gimple_call_internal_fn (gs
)), lhs
);
847 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T", gs
, fn
, lhs
);
848 if (gimple_call_num_args (gs
) > 0)
850 pp_string (buffer
, ", ");
851 dump_gimple_call_args (buffer
, gs
, flags
);
857 if (lhs
&& !(flags
& TDF_RHS_ONLY
))
859 dump_generic_node (buffer
, lhs
, spc
, flags
, false);
860 pp_string (buffer
, " =");
862 if (gimple_has_volatile_ops (gs
))
863 pp_string (buffer
, "{v}");
867 if (gimple_call_internal_p (gs
))
868 pp_string (buffer
, internal_fn_name (gimple_call_internal_fn (gs
)));
870 print_call_name (buffer
, fn
, flags
);
871 pp_string (buffer
, " (");
872 dump_gimple_call_args (buffer
, gs
, flags
);
873 pp_right_paren (buffer
);
874 if (!(flags
& TDF_RHS_ONLY
))
875 pp_semicolon (buffer
);
878 if (gimple_call_chain (gs
))
880 pp_string (buffer
, " [static-chain: ");
881 dump_generic_node (buffer
, gimple_call_chain (gs
), spc
, flags
, false);
882 pp_right_bracket (buffer
);
885 if (gimple_call_return_slot_opt_p (gs
))
886 pp_string (buffer
, " [return slot optimization]");
887 if (gimple_call_tail_p (gs
))
888 pp_string (buffer
, " [tail call]");
889 if (gimple_call_must_tail_p (gs
))
890 pp_string (buffer
, " [must tail call]");
895 /* Dump the arguments of _ITM_beginTransaction sanely. */
896 if (TREE_CODE (fn
) == ADDR_EXPR
)
897 fn
= TREE_OPERAND (fn
, 0);
898 if (TREE_CODE (fn
) == FUNCTION_DECL
&& decl_is_tm_clone (fn
))
899 pp_string (buffer
, " [tm-clone]");
900 if (TREE_CODE (fn
) == FUNCTION_DECL
901 && DECL_BUILT_IN_CLASS (fn
) == BUILT_IN_NORMAL
902 && DECL_FUNCTION_CODE (fn
) == BUILT_IN_TM_START
903 && gimple_call_num_args (gs
) > 0)
905 tree t
= gimple_call_arg (gs
, 0);
906 unsigned HOST_WIDE_INT props
;
907 gcc_assert (TREE_CODE (t
) == INTEGER_CST
);
909 pp_string (buffer
, " [ ");
911 /* Get the transaction code properties. */
912 props
= TREE_INT_CST_LOW (t
);
914 if (props
& PR_INSTRUMENTEDCODE
)
915 pp_string (buffer
, "instrumentedCode ");
916 if (props
& PR_UNINSTRUMENTEDCODE
)
917 pp_string (buffer
, "uninstrumentedCode ");
918 if (props
& PR_HASNOXMMUPDATE
)
919 pp_string (buffer
, "hasNoXMMUpdate ");
920 if (props
& PR_HASNOABORT
)
921 pp_string (buffer
, "hasNoAbort ");
922 if (props
& PR_HASNOIRREVOCABLE
)
923 pp_string (buffer
, "hasNoIrrevocable ");
924 if (props
& PR_DOESGOIRREVOCABLE
)
925 pp_string (buffer
, "doesGoIrrevocable ");
926 if (props
& PR_HASNOSIMPLEREADS
)
927 pp_string (buffer
, "hasNoSimpleReads ");
928 if (props
& PR_AWBARRIERSOMITTED
)
929 pp_string (buffer
, "awBarriersOmitted ");
930 if (props
& PR_RARBARRIERSOMITTED
)
931 pp_string (buffer
, "RaRBarriersOmitted ");
932 if (props
& PR_UNDOLOGCODE
)
933 pp_string (buffer
, "undoLogCode ");
934 if (props
& PR_PREFERUNINSTRUMENTED
)
935 pp_string (buffer
, "preferUninstrumented ");
936 if (props
& PR_EXCEPTIONBLOCK
)
937 pp_string (buffer
, "exceptionBlock ");
938 if (props
& PR_HASELSE
)
939 pp_string (buffer
, "hasElse ");
940 if (props
& PR_READONLY
)
941 pp_string (buffer
, "readOnly ");
943 pp_right_bracket (buffer
);
948 /* Dump the switch statement GS. BUFFER, SPC and FLAGS are as in
952 dump_gimple_switch (pretty_printer
*buffer
, gswitch
*gs
, int spc
,
957 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
959 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, ", gs
,
960 gimple_switch_index (gs
));
963 pp_string (buffer
, "switch (");
964 dump_generic_node (buffer
, gimple_switch_index (gs
), spc
, flags
, true);
965 if (flags
& TDF_GIMPLE
)
966 pp_string (buffer
, ") {");
968 pp_string (buffer
, ") <");
971 for (i
= 0; i
< gimple_switch_num_labels (gs
); i
++)
973 tree case_label
= gimple_switch_label (gs
, i
);
974 gcc_checking_assert (case_label
!= NULL_TREE
);
975 dump_generic_node (buffer
, case_label
, spc
, flags
, false);
977 tree label
= CASE_LABEL (case_label
);
978 dump_generic_node (buffer
, label
, spc
, flags
, false);
980 if (cfun
&& cfun
->cfg
)
982 basic_block dest
= label_to_block (label
);
985 edge label_edge
= find_edge (gimple_bb (gs
), dest
);
986 if (label_edge
&& !(flags
& TDF_GIMPLE
))
987 dump_edge_probability (buffer
, label_edge
);
991 if (i
< gimple_switch_num_labels (gs
) - 1)
993 if (flags
& TDF_GIMPLE
)
994 pp_string (buffer
, "; ");
996 pp_string (buffer
, ", ");
999 if (flags
& TDF_GIMPLE
)
1000 pp_string (buffer
, "; }");
1002 pp_greater (buffer
);
1006 /* Dump the gimple conditional GS. BUFFER, SPC and FLAGS are as in
1007 pp_gimple_stmt_1. */
1010 dump_gimple_cond (pretty_printer
*buffer
, gcond
*gs
, int spc
,
1013 if (flags
& TDF_RAW
)
1014 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%s, %T, %T, %T, %T>", gs
,
1015 get_tree_code_name (gimple_cond_code (gs
)),
1016 gimple_cond_lhs (gs
), gimple_cond_rhs (gs
),
1017 gimple_cond_true_label (gs
), gimple_cond_false_label (gs
));
1020 if (!(flags
& TDF_RHS_ONLY
))
1021 pp_string (buffer
, "if (");
1022 dump_generic_node (buffer
, gimple_cond_lhs (gs
), spc
, flags
, false);
1024 pp_string (buffer
, op_symbol_code (gimple_cond_code (gs
)));
1026 dump_generic_node (buffer
, gimple_cond_rhs (gs
), spc
, flags
, false);
1027 if (!(flags
& TDF_RHS_ONLY
))
1030 edge e
, true_edge
= NULL
, false_edge
= NULL
;
1031 basic_block bb
= gimple_bb (gs
);
1035 FOR_EACH_EDGE (e
, ei
, bb
->succs
)
1037 if (e
->flags
& EDGE_TRUE_VALUE
)
1039 else if (e
->flags
& EDGE_FALSE_VALUE
)
1044 bool has_edge_info
= true_edge
!= NULL
&& false_edge
!= NULL
;
1046 pp_right_paren (buffer
);
1048 if (gimple_cond_true_label (gs
))
1050 pp_string (buffer
, " goto ");
1051 dump_generic_node (buffer
, gimple_cond_true_label (gs
),
1053 if (has_edge_info
&& !(flags
& TDF_GIMPLE
))
1054 dump_edge_probability (buffer
, true_edge
);
1055 pp_semicolon (buffer
);
1057 if (gimple_cond_false_label (gs
))
1059 pp_string (buffer
, " else goto ");
1060 dump_generic_node (buffer
, gimple_cond_false_label (gs
),
1062 if (has_edge_info
&& !(flags
& TDF_GIMPLE
))
1063 dump_edge_probability (buffer
, false_edge
);
1065 pp_semicolon (buffer
);
1072 /* Dump a GIMPLE_LABEL tuple on the pretty_printer BUFFER, SPC
1073 spaces of indent. FLAGS specifies details to show in the dump (see
1074 TDF_* in dumpfils.h). */
1077 dump_gimple_label (pretty_printer
*buffer
, glabel
*gs
, int spc
,
1080 tree label
= gimple_label_label (gs
);
1081 if (flags
& TDF_RAW
)
1082 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
, label
);
1085 dump_generic_node (buffer
, label
, spc
, flags
, false);
1086 basic_block bb
= gimple_bb (gs
);
1087 if (bb
&& !(flags
& TDF_GIMPLE
))
1088 pp_scalar (buffer
, " %s", dump_probability (bb
->frequency
));
1091 if (flags
& TDF_GIMPLE
)
1093 if (DECL_NONLOCAL (label
))
1094 pp_string (buffer
, " [non-local]");
1095 if ((flags
& TDF_EH
) && EH_LANDING_PAD_NR (label
))
1096 pp_printf (buffer
, " [LP %d]", EH_LANDING_PAD_NR (label
));
1099 /* Dump a GIMPLE_GOTO tuple on the pretty_printer BUFFER, SPC
1100 spaces of indent. FLAGS specifies details to show in the dump (see
1101 TDF_* in dumpfile.h). */
1104 dump_gimple_goto (pretty_printer
*buffer
, ggoto
*gs
, int spc
,
1107 tree label
= gimple_goto_dest (gs
);
1108 if (flags
& TDF_RAW
)
1109 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
, label
);
1111 dump_gimple_fmt (buffer
, spc
, flags
, "goto %T;", label
);
1115 /* Dump a GIMPLE_BIND tuple on the pretty_printer BUFFER, SPC
1116 spaces of indent. FLAGS specifies details to show in the dump (see
1117 TDF_* in dumpfile.h). */
1120 dump_gimple_bind (pretty_printer
*buffer
, gbind
*gs
, int spc
,
1123 if (flags
& TDF_RAW
)
1124 dump_gimple_fmt (buffer
, spc
, flags
, "%G <", gs
);
1126 pp_left_brace (buffer
);
1127 if (!(flags
& TDF_SLIM
))
1131 for (var
= gimple_bind_vars (gs
); var
; var
= DECL_CHAIN (var
))
1133 newline_and_indent (buffer
, 2);
1134 print_declaration (buffer
, var
, spc
, flags
);
1136 if (gimple_bind_vars (gs
))
1137 pp_newline (buffer
);
1139 pp_newline (buffer
);
1140 dump_gimple_seq (buffer
, gimple_bind_body (gs
), spc
+ 2, flags
);
1141 newline_and_indent (buffer
, spc
);
1142 if (flags
& TDF_RAW
)
1143 pp_greater (buffer
);
1145 pp_right_brace (buffer
);
1149 /* Dump a GIMPLE_TRY tuple on the pretty_printer BUFFER, SPC spaces of
1150 indent. FLAGS specifies details to show in the dump (see TDF_* in
1154 dump_gimple_try (pretty_printer
*buffer
, gtry
*gs
, int spc
,
1157 if (flags
& TDF_RAW
)
1160 if (gimple_try_kind (gs
) == GIMPLE_TRY_CATCH
)
1161 type
= "GIMPLE_TRY_CATCH";
1162 else if (gimple_try_kind (gs
) == GIMPLE_TRY_FINALLY
)
1163 type
= "GIMPLE_TRY_FINALLY";
1165 type
= "UNKNOWN GIMPLE_TRY";
1166 dump_gimple_fmt (buffer
, spc
, flags
,
1167 "%G <%s,%+EVAL <%S>%nCLEANUP <%S>%->", gs
, type
,
1168 gimple_try_eval (gs
), gimple_try_cleanup (gs
));
1172 pp_string (buffer
, "try");
1173 newline_and_indent (buffer
, spc
+ 2);
1174 pp_left_brace (buffer
);
1175 pp_newline (buffer
);
1177 dump_gimple_seq (buffer
, gimple_try_eval (gs
), spc
+ 4, flags
);
1178 newline_and_indent (buffer
, spc
+ 2);
1179 pp_right_brace (buffer
);
1181 if (gimple_try_kind (gs
) == GIMPLE_TRY_CATCH
)
1183 newline_and_indent (buffer
, spc
);
1184 pp_string (buffer
, "catch");
1185 newline_and_indent (buffer
, spc
+ 2);
1186 pp_left_brace (buffer
);
1188 else if (gimple_try_kind (gs
) == GIMPLE_TRY_FINALLY
)
1190 newline_and_indent (buffer
, spc
);
1191 pp_string (buffer
, "finally");
1192 newline_and_indent (buffer
, spc
+ 2);
1193 pp_left_brace (buffer
);
1196 pp_string (buffer
, " <UNKNOWN GIMPLE_TRY> {");
1198 pp_newline (buffer
);
1199 dump_gimple_seq (buffer
, gimple_try_cleanup (gs
), spc
+ 4, flags
);
1200 newline_and_indent (buffer
, spc
+ 2);
1201 pp_right_brace (buffer
);
1206 /* Dump a GIMPLE_CATCH tuple on the pretty_printer BUFFER, SPC spaces of
1207 indent. FLAGS specifies details to show in the dump (see TDF_* in
1211 dump_gimple_catch (pretty_printer
*buffer
, gcatch
*gs
, int spc
,
1214 if (flags
& TDF_RAW
)
1215 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %+CATCH <%S>%->", gs
,
1216 gimple_catch_types (gs
), gimple_catch_handler (gs
));
1218 dump_gimple_fmt (buffer
, spc
, flags
, "catch (%T)%+{%S}",
1219 gimple_catch_types (gs
), gimple_catch_handler (gs
));
1223 /* Dump a GIMPLE_EH_FILTER tuple on the pretty_printer BUFFER, SPC spaces of
1224 indent. FLAGS specifies details to show in the dump (see TDF_* in
1228 dump_gimple_eh_filter (pretty_printer
*buffer
, geh_filter
*gs
, int spc
,
1231 if (flags
& TDF_RAW
)
1232 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %+FAILURE <%S>%->", gs
,
1233 gimple_eh_filter_types (gs
),
1234 gimple_eh_filter_failure (gs
));
1236 dump_gimple_fmt (buffer
, spc
, flags
, "<<<eh_filter (%T)>>>%+{%+%S%-}",
1237 gimple_eh_filter_types (gs
),
1238 gimple_eh_filter_failure (gs
));
1242 /* Dump a GIMPLE_EH_MUST_NOT_THROW tuple. */
1245 dump_gimple_eh_must_not_throw (pretty_printer
*buffer
,
1246 geh_mnt
*gs
, int spc
, dump_flags_t flags
)
1248 if (flags
& TDF_RAW
)
1249 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
,
1250 gimple_eh_must_not_throw_fndecl (gs
));
1252 dump_gimple_fmt (buffer
, spc
, flags
, "<<<eh_must_not_throw (%T)>>>",
1253 gimple_eh_must_not_throw_fndecl (gs
));
1257 /* Dump a GIMPLE_EH_ELSE tuple on the pretty_printer BUFFER, SPC spaces of
1258 indent. FLAGS specifies details to show in the dump (see TDF_* in
1262 dump_gimple_eh_else (pretty_printer
*buffer
, geh_else
*gs
, int spc
,
1265 if (flags
& TDF_RAW
)
1266 dump_gimple_fmt (buffer
, spc
, flags
,
1267 "%G <%+N_BODY <%S>%nE_BODY <%S>%->", gs
,
1268 gimple_eh_else_n_body (gs
), gimple_eh_else_e_body (gs
));
1270 dump_gimple_fmt (buffer
, spc
, flags
,
1271 "<<<if_normal_exit>>>%+{%S}%-<<<else_eh_exit>>>%+{%S}",
1272 gimple_eh_else_n_body (gs
), gimple_eh_else_e_body (gs
));
1276 /* Dump a GIMPLE_RESX tuple on the pretty_printer BUFFER, SPC spaces of
1277 indent. FLAGS specifies details to show in the dump (see TDF_* in
1281 dump_gimple_resx (pretty_printer
*buffer
, gresx
*gs
, int spc
,
1284 if (flags
& TDF_RAW
)
1285 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%d>", gs
,
1286 gimple_resx_region (gs
));
1288 dump_gimple_fmt (buffer
, spc
, flags
, "resx %d", gimple_resx_region (gs
));
1291 /* Dump a GIMPLE_EH_DISPATCH tuple on the pretty_printer BUFFER. */
1294 dump_gimple_eh_dispatch (pretty_printer
*buffer
, geh_dispatch
*gs
, int spc
,
1297 if (flags
& TDF_RAW
)
1298 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%d>", gs
,
1299 gimple_eh_dispatch_region (gs
));
1301 dump_gimple_fmt (buffer
, spc
, flags
, "eh_dispatch %d",
1302 gimple_eh_dispatch_region (gs
));
1305 /* Dump a GIMPLE_DEBUG tuple on the pretty_printer BUFFER, SPC spaces
1306 of indent. FLAGS specifies details to show in the dump (see TDF_*
1310 dump_gimple_debug (pretty_printer
*buffer
, gdebug
*gs
, int spc
,
1313 switch (gs
->subcode
)
1315 case GIMPLE_DEBUG_BIND
:
1316 if (flags
& TDF_RAW
)
1317 dump_gimple_fmt (buffer
, spc
, flags
, "%G BIND <%T, %T>", gs
,
1318 gimple_debug_bind_get_var (gs
),
1319 gimple_debug_bind_get_value (gs
));
1321 dump_gimple_fmt (buffer
, spc
, flags
, "# DEBUG %T => %T",
1322 gimple_debug_bind_get_var (gs
),
1323 gimple_debug_bind_get_value (gs
));
1326 case GIMPLE_DEBUG_SOURCE_BIND
:
1327 if (flags
& TDF_RAW
)
1328 dump_gimple_fmt (buffer
, spc
, flags
, "%G SRCBIND <%T, %T>", gs
,
1329 gimple_debug_source_bind_get_var (gs
),
1330 gimple_debug_source_bind_get_value (gs
));
1332 dump_gimple_fmt (buffer
, spc
, flags
, "# DEBUG %T s=> %T",
1333 gimple_debug_source_bind_get_var (gs
),
1334 gimple_debug_source_bind_get_value (gs
));
1342 /* Dump a GIMPLE_OMP_FOR tuple on the pretty_printer BUFFER. */
1344 dump_gimple_omp_for (pretty_printer
*buffer
, gomp_for
*gs
, int spc
,
1349 if (flags
& TDF_RAW
)
1352 switch (gimple_omp_for_kind (gs
))
1354 case GF_OMP_FOR_KIND_FOR
:
1357 case GF_OMP_FOR_KIND_DISTRIBUTE
:
1358 kind
= " distribute";
1360 case GF_OMP_FOR_KIND_TASKLOOP
:
1363 case GF_OMP_FOR_KIND_CILKFOR
:
1364 kind
= " _Cilk_for";
1366 case GF_OMP_FOR_KIND_OACC_LOOP
:
1367 kind
= " oacc_loop";
1369 case GF_OMP_FOR_KIND_SIMD
:
1372 case GF_OMP_FOR_KIND_CILKSIMD
:
1378 dump_gimple_fmt (buffer
, spc
, flags
, "%G%s <%+BODY <%S>%nCLAUSES <", gs
,
1379 kind
, gimple_omp_body (gs
));
1380 dump_omp_clauses (buffer
, gimple_omp_for_clauses (gs
), spc
, flags
);
1381 dump_gimple_fmt (buffer
, spc
, flags
, " >,");
1382 for (i
= 0; i
< gimple_omp_for_collapse (gs
); i
++)
1383 dump_gimple_fmt (buffer
, spc
, flags
,
1384 "%+%T, %T, %T, %s, %T,%n",
1385 gimple_omp_for_index (gs
, i
),
1386 gimple_omp_for_initial (gs
, i
),
1387 gimple_omp_for_final (gs
, i
),
1388 get_tree_code_name (gimple_omp_for_cond (gs
, i
)),
1389 gimple_omp_for_incr (gs
, i
));
1390 dump_gimple_fmt (buffer
, spc
, flags
, "PRE_BODY <%S>%->",
1391 gimple_omp_for_pre_body (gs
));
1395 switch (gimple_omp_for_kind (gs
))
1397 case GF_OMP_FOR_KIND_FOR
:
1398 pp_string (buffer
, "#pragma omp for");
1400 case GF_OMP_FOR_KIND_DISTRIBUTE
:
1401 pp_string (buffer
, "#pragma omp distribute");
1403 case GF_OMP_FOR_KIND_TASKLOOP
:
1404 pp_string (buffer
, "#pragma omp taskloop");
1406 case GF_OMP_FOR_KIND_CILKFOR
:
1408 case GF_OMP_FOR_KIND_OACC_LOOP
:
1409 pp_string (buffer
, "#pragma acc loop");
1411 case GF_OMP_FOR_KIND_SIMD
:
1412 pp_string (buffer
, "#pragma omp simd");
1414 case GF_OMP_FOR_KIND_CILKSIMD
:
1415 pp_string (buffer
, "#pragma simd");
1417 case GF_OMP_FOR_KIND_GRID_LOOP
:
1418 pp_string (buffer
, "#pragma omp for grid_loop");
1423 if (gimple_omp_for_kind (gs
) != GF_OMP_FOR_KIND_CILKFOR
)
1424 dump_omp_clauses (buffer
, gimple_omp_for_clauses (gs
), spc
, flags
);
1425 for (i
= 0; i
< gimple_omp_for_collapse (gs
); i
++)
1429 if (gimple_omp_for_kind (gs
) == GF_OMP_FOR_KIND_CILKFOR
)
1430 pp_string (buffer
, "_Cilk_for (");
1433 newline_and_indent (buffer
, spc
);
1434 pp_string (buffer
, "for (");
1436 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
1438 pp_string (buffer
, " = ");
1439 dump_generic_node (buffer
, gimple_omp_for_initial (gs
, i
), spc
,
1441 pp_string (buffer
, "; ");
1443 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
1446 switch (gimple_omp_for_cond (gs
, i
))
1452 pp_greater (buffer
);
1455 pp_less_equal (buffer
);
1458 pp_greater_equal (buffer
);
1461 pp_string (buffer
, "!=");
1467 dump_generic_node (buffer
, gimple_omp_for_final (gs
, i
), spc
,
1469 pp_string (buffer
, "; ");
1471 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
1473 pp_string (buffer
, " = ");
1474 dump_generic_node (buffer
, gimple_omp_for_incr (gs
, i
), spc
,
1476 pp_right_paren (buffer
);
1479 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1481 if (gimple_omp_for_kind (gs
) == GF_OMP_FOR_KIND_CILKFOR
)
1482 dump_omp_clauses (buffer
, gimple_omp_for_clauses (gs
), spc
, flags
);
1483 newline_and_indent (buffer
, spc
+ 2);
1484 pp_left_brace (buffer
);
1485 pp_newline (buffer
);
1486 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1487 newline_and_indent (buffer
, spc
+ 2);
1488 pp_right_brace (buffer
);
1493 /* Dump a GIMPLE_OMP_CONTINUE tuple on the pretty_printer BUFFER. */
1496 dump_gimple_omp_continue (pretty_printer
*buffer
, gomp_continue
*gs
,
1497 int spc
, dump_flags_t flags
)
1499 if (flags
& TDF_RAW
)
1501 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T>", gs
,
1502 gimple_omp_continue_control_def (gs
),
1503 gimple_omp_continue_control_use (gs
));
1507 pp_string (buffer
, "#pragma omp continue (");
1508 dump_generic_node (buffer
, gimple_omp_continue_control_def (gs
),
1512 dump_generic_node (buffer
, gimple_omp_continue_control_use (gs
),
1514 pp_right_paren (buffer
);
1518 /* Dump a GIMPLE_OMP_SINGLE tuple on the pretty_printer BUFFER. */
1521 dump_gimple_omp_single (pretty_printer
*buffer
, gomp_single
*gs
,
1522 int spc
, dump_flags_t flags
)
1524 if (flags
& TDF_RAW
)
1526 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1527 gimple_omp_body (gs
));
1528 dump_omp_clauses (buffer
, gimple_omp_single_clauses (gs
), spc
, flags
);
1529 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1533 pp_string (buffer
, "#pragma omp single");
1534 dump_omp_clauses (buffer
, gimple_omp_single_clauses (gs
), spc
, flags
);
1535 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1537 newline_and_indent (buffer
, spc
+ 2);
1538 pp_left_brace (buffer
);
1539 pp_newline (buffer
);
1540 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1541 newline_and_indent (buffer
, spc
+ 2);
1542 pp_right_brace (buffer
);
1547 /* Dump a GIMPLE_OMP_TARGET tuple on the pretty_printer BUFFER. */
1550 dump_gimple_omp_target (pretty_printer
*buffer
, gomp_target
*gs
,
1551 int spc
, dump_flags_t flags
)
1554 switch (gimple_omp_target_kind (gs
))
1556 case GF_OMP_TARGET_KIND_REGION
:
1559 case GF_OMP_TARGET_KIND_DATA
:
1562 case GF_OMP_TARGET_KIND_UPDATE
:
1565 case GF_OMP_TARGET_KIND_ENTER_DATA
:
1566 kind
= " enter data";
1568 case GF_OMP_TARGET_KIND_EXIT_DATA
:
1569 kind
= " exit data";
1571 case GF_OMP_TARGET_KIND_OACC_KERNELS
:
1572 kind
= " oacc_kernels";
1574 case GF_OMP_TARGET_KIND_OACC_PARALLEL
:
1575 kind
= " oacc_parallel";
1577 case GF_OMP_TARGET_KIND_OACC_DATA
:
1578 kind
= " oacc_data";
1580 case GF_OMP_TARGET_KIND_OACC_UPDATE
:
1581 kind
= " oacc_update";
1583 case GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA
:
1584 kind
= " oacc_enter_exit_data";
1586 case GF_OMP_TARGET_KIND_OACC_DECLARE
:
1587 kind
= " oacc_declare";
1589 case GF_OMP_TARGET_KIND_OACC_HOST_DATA
:
1590 kind
= " oacc_host_data";
1595 if (flags
& TDF_RAW
)
1597 dump_gimple_fmt (buffer
, spc
, flags
, "%G%s <%+BODY <%S>%nCLAUSES <", gs
,
1598 kind
, gimple_omp_body (gs
));
1599 dump_omp_clauses (buffer
, gimple_omp_target_clauses (gs
), spc
, flags
);
1600 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T%n>",
1601 gimple_omp_target_child_fn (gs
),
1602 gimple_omp_target_data_arg (gs
));
1606 pp_string (buffer
, "#pragma omp target");
1607 pp_string (buffer
, kind
);
1608 dump_omp_clauses (buffer
, gimple_omp_target_clauses (gs
), spc
, flags
);
1609 if (gimple_omp_target_child_fn (gs
))
1611 pp_string (buffer
, " [child fn: ");
1612 dump_generic_node (buffer
, gimple_omp_target_child_fn (gs
),
1614 pp_string (buffer
, " (");
1615 if (gimple_omp_target_data_arg (gs
))
1616 dump_generic_node (buffer
, gimple_omp_target_data_arg (gs
),
1619 pp_string (buffer
, "???");
1620 pp_string (buffer
, ")]");
1622 gimple_seq body
= gimple_omp_body (gs
);
1623 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
1625 newline_and_indent (buffer
, spc
+ 2);
1626 pp_left_brace (buffer
);
1627 pp_newline (buffer
);
1628 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
1629 newline_and_indent (buffer
, spc
+ 2);
1630 pp_right_brace (buffer
);
1634 pp_newline (buffer
);
1635 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
1640 /* Dump a GIMPLE_OMP_TEAMS tuple on the pretty_printer BUFFER. */
1643 dump_gimple_omp_teams (pretty_printer
*buffer
, gomp_teams
*gs
, int spc
,
1646 if (flags
& TDF_RAW
)
1648 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1649 gimple_omp_body (gs
));
1650 dump_omp_clauses (buffer
, gimple_omp_teams_clauses (gs
), spc
, flags
);
1651 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1655 pp_string (buffer
, "#pragma omp teams");
1656 dump_omp_clauses (buffer
, gimple_omp_teams_clauses (gs
), spc
, flags
);
1657 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1659 newline_and_indent (buffer
, spc
+ 2);
1660 pp_character (buffer
, '{');
1661 pp_newline (buffer
);
1662 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1663 newline_and_indent (buffer
, spc
+ 2);
1664 pp_character (buffer
, '}');
1669 /* Dump a GIMPLE_OMP_SECTIONS tuple on the pretty_printer BUFFER. */
1672 dump_gimple_omp_sections (pretty_printer
*buffer
, gomp_sections
*gs
,
1673 int spc
, dump_flags_t flags
)
1675 if (flags
& TDF_RAW
)
1677 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1678 gimple_omp_body (gs
));
1679 dump_omp_clauses (buffer
, gimple_omp_sections_clauses (gs
), spc
, flags
);
1680 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1684 pp_string (buffer
, "#pragma omp sections");
1685 if (gimple_omp_sections_control (gs
))
1687 pp_string (buffer
, " <");
1688 dump_generic_node (buffer
, gimple_omp_sections_control (gs
), spc
,
1690 pp_greater (buffer
);
1692 dump_omp_clauses (buffer
, gimple_omp_sections_clauses (gs
), spc
, flags
);
1693 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1695 newline_and_indent (buffer
, spc
+ 2);
1696 pp_left_brace (buffer
);
1697 pp_newline (buffer
);
1698 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1699 newline_and_indent (buffer
, spc
+ 2);
1700 pp_right_brace (buffer
);
1705 /* Dump a GIMPLE_OMP_{MASTER,TASKGROUP,ORDERED,SECTION} tuple on the
1706 pretty_printer BUFFER. */
1709 dump_gimple_omp_block (pretty_printer
*buffer
, gimple
*gs
, int spc
,
1712 if (flags
& TDF_RAW
)
1713 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1714 gimple_omp_body (gs
));
1717 switch (gimple_code (gs
))
1719 case GIMPLE_OMP_MASTER
:
1720 pp_string (buffer
, "#pragma omp master");
1722 case GIMPLE_OMP_TASKGROUP
:
1723 pp_string (buffer
, "#pragma omp taskgroup");
1725 case GIMPLE_OMP_SECTION
:
1726 pp_string (buffer
, "#pragma omp section");
1728 case GIMPLE_OMP_GRID_BODY
:
1729 pp_string (buffer
, "#pragma omp gridified body");
1734 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1736 newline_and_indent (buffer
, spc
+ 2);
1737 pp_left_brace (buffer
);
1738 pp_newline (buffer
);
1739 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1740 newline_and_indent (buffer
, spc
+ 2);
1741 pp_right_brace (buffer
);
1746 /* Dump a GIMPLE_OMP_CRITICAL tuple on the pretty_printer BUFFER. */
1749 dump_gimple_omp_critical (pretty_printer
*buffer
, gomp_critical
*gs
,
1750 int spc
, dump_flags_t flags
)
1752 if (flags
& TDF_RAW
)
1753 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1754 gimple_omp_body (gs
));
1757 pp_string (buffer
, "#pragma omp critical");
1758 if (gimple_omp_critical_name (gs
))
1760 pp_string (buffer
, " (");
1761 dump_generic_node (buffer
, gimple_omp_critical_name (gs
), spc
,
1763 pp_right_paren (buffer
);
1765 dump_omp_clauses (buffer
, gimple_omp_critical_clauses (gs
), spc
, flags
);
1766 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1768 newline_and_indent (buffer
, spc
+ 2);
1769 pp_left_brace (buffer
);
1770 pp_newline (buffer
);
1771 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1772 newline_and_indent (buffer
, spc
+ 2);
1773 pp_right_brace (buffer
);
1778 /* Dump a GIMPLE_OMP_ORDERED tuple on the pretty_printer BUFFER. */
1781 dump_gimple_omp_ordered (pretty_printer
*buffer
, gomp_ordered
*gs
,
1782 int spc
, dump_flags_t flags
)
1784 if (flags
& TDF_RAW
)
1785 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1786 gimple_omp_body (gs
));
1789 pp_string (buffer
, "#pragma omp ordered");
1790 dump_omp_clauses (buffer
, gimple_omp_ordered_clauses (gs
), spc
, flags
);
1791 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1793 newline_and_indent (buffer
, spc
+ 2);
1794 pp_left_brace (buffer
);
1795 pp_newline (buffer
);
1796 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1797 newline_and_indent (buffer
, spc
+ 2);
1798 pp_right_brace (buffer
);
1803 /* Dump a GIMPLE_OMP_RETURN tuple on the pretty_printer BUFFER. */
1806 dump_gimple_omp_return (pretty_printer
*buffer
, gimple
*gs
, int spc
,
1809 if (flags
& TDF_RAW
)
1811 dump_gimple_fmt (buffer
, spc
, flags
, "%G <nowait=%d", gs
,
1812 (int) gimple_omp_return_nowait_p (gs
));
1813 if (gimple_omp_return_lhs (gs
))
1814 dump_gimple_fmt (buffer
, spc
, flags
, ", lhs=%T>",
1815 gimple_omp_return_lhs (gs
));
1817 dump_gimple_fmt (buffer
, spc
, flags
, ">");
1821 pp_string (buffer
, "#pragma omp return");
1822 if (gimple_omp_return_nowait_p (gs
))
1823 pp_string (buffer
, "(nowait)");
1824 if (gimple_omp_return_lhs (gs
))
1826 pp_string (buffer
, " (set ");
1827 dump_generic_node (buffer
, gimple_omp_return_lhs (gs
),
1829 pp_character (buffer
, ')');
1834 /* Dump a GIMPLE_TRANSACTION tuple on the pretty_printer BUFFER. */
1837 dump_gimple_transaction (pretty_printer
*buffer
, gtransaction
*gs
,
1838 int spc
, dump_flags_t flags
)
1840 unsigned subcode
= gimple_transaction_subcode (gs
);
1842 if (flags
& TDF_RAW
)
1844 dump_gimple_fmt (buffer
, spc
, flags
,
1845 "%G [SUBCODE=%x,NORM=%T,UNINST=%T,OVER=%T] "
1847 gs
, subcode
, gimple_transaction_label_norm (gs
),
1848 gimple_transaction_label_uninst (gs
),
1849 gimple_transaction_label_over (gs
),
1850 gimple_transaction_body (gs
));
1854 if (subcode
& GTMA_IS_OUTER
)
1855 pp_string (buffer
, "__transaction_atomic [[outer]]");
1856 else if (subcode
& GTMA_IS_RELAXED
)
1857 pp_string (buffer
, "__transaction_relaxed");
1859 pp_string (buffer
, "__transaction_atomic");
1860 subcode
&= ~GTMA_DECLARATION_MASK
;
1862 if (gimple_transaction_body (gs
))
1864 newline_and_indent (buffer
, spc
+ 2);
1865 pp_left_brace (buffer
);
1866 pp_newline (buffer
);
1867 dump_gimple_seq (buffer
, gimple_transaction_body (gs
),
1869 newline_and_indent (buffer
, spc
+ 2);
1870 pp_right_brace (buffer
);
1874 pp_string (buffer
, " //");
1875 if (gimple_transaction_label_norm (gs
))
1877 pp_string (buffer
, " NORM=");
1878 dump_generic_node (buffer
, gimple_transaction_label_norm (gs
),
1881 if (gimple_transaction_label_uninst (gs
))
1883 pp_string (buffer
, " UNINST=");
1884 dump_generic_node (buffer
, gimple_transaction_label_uninst (gs
),
1887 if (gimple_transaction_label_over (gs
))
1889 pp_string (buffer
, " OVER=");
1890 dump_generic_node (buffer
, gimple_transaction_label_over (gs
),
1895 pp_string (buffer
, " SUBCODE=[ ");
1896 if (subcode
& GTMA_HAVE_ABORT
)
1898 pp_string (buffer
, "GTMA_HAVE_ABORT ");
1899 subcode
&= ~GTMA_HAVE_ABORT
;
1901 if (subcode
& GTMA_HAVE_LOAD
)
1903 pp_string (buffer
, "GTMA_HAVE_LOAD ");
1904 subcode
&= ~GTMA_HAVE_LOAD
;
1906 if (subcode
& GTMA_HAVE_STORE
)
1908 pp_string (buffer
, "GTMA_HAVE_STORE ");
1909 subcode
&= ~GTMA_HAVE_STORE
;
1911 if (subcode
& GTMA_MAY_ENTER_IRREVOCABLE
)
1913 pp_string (buffer
, "GTMA_MAY_ENTER_IRREVOCABLE ");
1914 subcode
&= ~GTMA_MAY_ENTER_IRREVOCABLE
;
1916 if (subcode
& GTMA_DOES_GO_IRREVOCABLE
)
1918 pp_string (buffer
, "GTMA_DOES_GO_IRREVOCABLE ");
1919 subcode
&= ~GTMA_DOES_GO_IRREVOCABLE
;
1921 if (subcode
& GTMA_HAS_NO_INSTRUMENTATION
)
1923 pp_string (buffer
, "GTMA_HAS_NO_INSTRUMENTATION ");
1924 subcode
&= ~GTMA_HAS_NO_INSTRUMENTATION
;
1927 pp_printf (buffer
, "0x%x ", subcode
);
1928 pp_right_bracket (buffer
);
1934 /* Dump a GIMPLE_ASM tuple on the pretty_printer BUFFER, SPC spaces of
1935 indent. FLAGS specifies details to show in the dump (see TDF_* in
1939 dump_gimple_asm (pretty_printer
*buffer
, gasm
*gs
, int spc
, dump_flags_t flags
)
1941 unsigned int i
, n
, f
, fields
;
1943 if (flags
& TDF_RAW
)
1945 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+STRING <%n%s%n>", gs
,
1946 gimple_asm_string (gs
));
1948 n
= gimple_asm_noutputs (gs
);
1951 newline_and_indent (buffer
, spc
+ 2);
1952 pp_string (buffer
, "OUTPUT: ");
1953 for (i
= 0; i
< n
; i
++)
1955 dump_generic_node (buffer
, gimple_asm_output_op (gs
, i
),
1958 pp_string (buffer
, ", ");
1962 n
= gimple_asm_ninputs (gs
);
1965 newline_and_indent (buffer
, spc
+ 2);
1966 pp_string (buffer
, "INPUT: ");
1967 for (i
= 0; i
< n
; i
++)
1969 dump_generic_node (buffer
, gimple_asm_input_op (gs
, i
),
1972 pp_string (buffer
, ", ");
1976 n
= gimple_asm_nclobbers (gs
);
1979 newline_and_indent (buffer
, spc
+ 2);
1980 pp_string (buffer
, "CLOBBER: ");
1981 for (i
= 0; i
< n
; i
++)
1983 dump_generic_node (buffer
, gimple_asm_clobber_op (gs
, i
),
1986 pp_string (buffer
, ", ");
1990 n
= gimple_asm_nlabels (gs
);
1993 newline_and_indent (buffer
, spc
+ 2);
1994 pp_string (buffer
, "LABEL: ");
1995 for (i
= 0; i
< n
; i
++)
1997 dump_generic_node (buffer
, gimple_asm_label_op (gs
, i
),
2000 pp_string (buffer
, ", ");
2004 newline_and_indent (buffer
, spc
);
2005 pp_greater (buffer
);
2009 pp_string (buffer
, "__asm__");
2010 if (gimple_asm_volatile_p (gs
))
2011 pp_string (buffer
, " __volatile__");
2012 if (gimple_asm_nlabels (gs
))
2013 pp_string (buffer
, " goto");
2014 pp_string (buffer
, "(\"");
2015 pp_string (buffer
, gimple_asm_string (gs
));
2016 pp_string (buffer
, "\"");
2018 if (gimple_asm_nlabels (gs
))
2020 else if (gimple_asm_nclobbers (gs
))
2022 else if (gimple_asm_ninputs (gs
))
2024 else if (gimple_asm_noutputs (gs
))
2029 for (f
= 0; f
< fields
; ++f
)
2031 pp_string (buffer
, " : ");
2036 n
= gimple_asm_noutputs (gs
);
2037 for (i
= 0; i
< n
; i
++)
2039 dump_generic_node (buffer
, gimple_asm_output_op (gs
, i
),
2042 pp_string (buffer
, ", ");
2047 n
= gimple_asm_ninputs (gs
);
2048 for (i
= 0; i
< n
; i
++)
2050 dump_generic_node (buffer
, gimple_asm_input_op (gs
, i
),
2053 pp_string (buffer
, ", ");
2058 n
= gimple_asm_nclobbers (gs
);
2059 for (i
= 0; i
< n
; i
++)
2061 dump_generic_node (buffer
, gimple_asm_clobber_op (gs
, i
),
2064 pp_string (buffer
, ", ");
2069 n
= gimple_asm_nlabels (gs
);
2070 for (i
= 0; i
< n
; i
++)
2072 dump_generic_node (buffer
, gimple_asm_label_op (gs
, i
),
2075 pp_string (buffer
, ", ");
2084 pp_string (buffer
, ");");
2088 /* Dump ptr_info and range_info for NODE on pretty_printer BUFFER with
2089 SPC spaces of indent. */
2092 dump_ssaname_info (pretty_printer
*buffer
, tree node
, int spc
)
2094 if (TREE_CODE (node
) != SSA_NAME
)
2097 if (POINTER_TYPE_P (TREE_TYPE (node
))
2098 && SSA_NAME_PTR_INFO (node
))
2100 unsigned int align
, misalign
;
2101 struct ptr_info_def
*pi
= SSA_NAME_PTR_INFO (node
);
2102 pp_string (buffer
, "# PT = ");
2103 pp_points_to_solution (buffer
, &pi
->pt
);
2104 newline_and_indent (buffer
, spc
);
2105 if (get_ptr_info_alignment (pi
, &align
, &misalign
))
2107 pp_printf (buffer
, "# ALIGN = %u, MISALIGN = %u", align
, misalign
);
2108 newline_and_indent (buffer
, spc
);
2112 if (!POINTER_TYPE_P (TREE_TYPE (node
))
2113 && SSA_NAME_RANGE_INFO (node
))
2115 wide_int min
, max
, nonzero_bits
;
2116 value_range_type range_type
= get_range_info (node
, &min
, &max
);
2118 if (range_type
== VR_VARYING
)
2119 pp_printf (buffer
, "# RANGE VR_VARYING");
2120 else if (range_type
== VR_RANGE
|| range_type
== VR_ANTI_RANGE
)
2122 pp_printf (buffer
, "# RANGE ");
2123 pp_printf (buffer
, "%s[", range_type
== VR_RANGE
? "" : "~");
2124 pp_wide_int (buffer
, min
, TYPE_SIGN (TREE_TYPE (node
)));
2125 pp_printf (buffer
, ", ");
2126 pp_wide_int (buffer
, max
, TYPE_SIGN (TREE_TYPE (node
)));
2127 pp_printf (buffer
, "]");
2129 nonzero_bits
= get_nonzero_bits (node
);
2130 if (nonzero_bits
!= -1)
2132 pp_string (buffer
, " NONZERO ");
2133 pp_wide_int (buffer
, nonzero_bits
, UNSIGNED
);
2135 newline_and_indent (buffer
, spc
);
2139 /* As dump_ssaname_info, but dump to FILE. */
2142 dump_ssaname_info_to_file (FILE *file
, tree node
, int spc
)
2144 pretty_printer buffer
;
2145 pp_needs_newline (&buffer
) = true;
2146 buffer
.buffer
->stream
= file
;
2147 dump_ssaname_info (&buffer
, node
, spc
);
2151 /* Dump a PHI node PHI. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1.
2152 The caller is responsible for calling pp_flush on BUFFER to finalize
2153 pretty printer. If COMMENT is true, print this after #. */
2156 dump_gimple_phi (pretty_printer
*buffer
, gphi
*phi
, int spc
, bool comment
,
2160 tree lhs
= gimple_phi_result (phi
);
2162 if (flags
& TDF_ALIAS
)
2163 dump_ssaname_info (buffer
, lhs
, spc
);
2166 pp_string (buffer
, "# ");
2168 if (flags
& TDF_RAW
)
2169 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, ", phi
,
2170 gimple_phi_result (phi
));
2173 dump_generic_node (buffer
, lhs
, spc
, flags
, false);
2174 if (flags
& TDF_GIMPLE
)
2175 pp_string (buffer
, " = __PHI (");
2177 pp_string (buffer
, " = PHI <");
2179 for (i
= 0; i
< gimple_phi_num_args (phi
); i
++)
2181 if ((flags
& TDF_LINENO
) && gimple_phi_arg_has_location (phi
, i
))
2182 dump_location (buffer
, gimple_phi_arg_location (phi
, i
));
2183 if (flags
& TDF_GIMPLE
)
2185 basic_block src
= gimple_phi_arg_edge (phi
, i
)->src
;
2186 gimple
*stmt
= first_stmt (src
);
2187 if (!stmt
|| gimple_code (stmt
) != GIMPLE_LABEL
)
2189 pp_string (buffer
, "bb_");
2190 pp_decimal_int (buffer
, src
->index
);
2193 dump_generic_node (buffer
, gimple_label_label (as_a
<glabel
*> (stmt
)), 0, flags
,
2195 pp_string (buffer
, ": ");
2197 dump_generic_node (buffer
, gimple_phi_arg_def (phi
, i
), spc
, flags
,
2199 if (! (flags
& TDF_GIMPLE
))
2201 pp_left_paren (buffer
);
2202 pp_decimal_int (buffer
, gimple_phi_arg_edge (phi
, i
)->src
->index
);
2203 pp_right_paren (buffer
);
2205 if (i
< gimple_phi_num_args (phi
) - 1)
2206 pp_string (buffer
, ", ");
2208 if (flags
& TDF_GIMPLE
)
2209 pp_string (buffer
, ");");
2211 pp_greater (buffer
);
2215 /* Dump a GIMPLE_OMP_PARALLEL tuple on the pretty_printer BUFFER, SPC spaces
2216 of indent. FLAGS specifies details to show in the dump (see TDF_* in
2220 dump_gimple_omp_parallel (pretty_printer
*buffer
, gomp_parallel
*gs
,
2221 int spc
, dump_flags_t flags
)
2223 if (flags
& TDF_RAW
)
2225 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
2226 gimple_omp_body (gs
));
2227 dump_omp_clauses (buffer
, gimple_omp_parallel_clauses (gs
), spc
, flags
);
2228 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T%n>",
2229 gimple_omp_parallel_child_fn (gs
),
2230 gimple_omp_parallel_data_arg (gs
));
2235 pp_string (buffer
, "#pragma omp parallel");
2236 dump_omp_clauses (buffer
, gimple_omp_parallel_clauses (gs
), spc
, flags
);
2237 if (gimple_omp_parallel_child_fn (gs
))
2239 pp_string (buffer
, " [child fn: ");
2240 dump_generic_node (buffer
, gimple_omp_parallel_child_fn (gs
),
2242 pp_string (buffer
, " (");
2243 if (gimple_omp_parallel_data_arg (gs
))
2244 dump_generic_node (buffer
, gimple_omp_parallel_data_arg (gs
),
2247 pp_string (buffer
, "???");
2248 pp_string (buffer
, ")]");
2250 body
= gimple_omp_body (gs
);
2251 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
2253 newline_and_indent (buffer
, spc
+ 2);
2254 pp_left_brace (buffer
);
2255 pp_newline (buffer
);
2256 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
2257 newline_and_indent (buffer
, spc
+ 2);
2258 pp_right_brace (buffer
);
2262 pp_newline (buffer
);
2263 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
2269 /* Dump a GIMPLE_OMP_TASK tuple on the pretty_printer BUFFER, SPC spaces
2270 of indent. FLAGS specifies details to show in the dump (see TDF_* in
2274 dump_gimple_omp_task (pretty_printer
*buffer
, gomp_task
*gs
, int spc
,
2277 if (flags
& TDF_RAW
)
2279 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
2280 gimple_omp_body (gs
));
2281 dump_omp_clauses (buffer
, gimple_omp_task_clauses (gs
), spc
, flags
);
2282 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T, %T, %T, %T%n>",
2283 gimple_omp_task_child_fn (gs
),
2284 gimple_omp_task_data_arg (gs
),
2285 gimple_omp_task_copy_fn (gs
),
2286 gimple_omp_task_arg_size (gs
),
2287 gimple_omp_task_arg_size (gs
));
2292 if (gimple_omp_task_taskloop_p (gs
))
2293 pp_string (buffer
, "#pragma omp taskloop");
2295 pp_string (buffer
, "#pragma omp task");
2296 dump_omp_clauses (buffer
, gimple_omp_task_clauses (gs
), spc
, flags
);
2297 if (gimple_omp_task_child_fn (gs
))
2299 pp_string (buffer
, " [child fn: ");
2300 dump_generic_node (buffer
, gimple_omp_task_child_fn (gs
),
2302 pp_string (buffer
, " (");
2303 if (gimple_omp_task_data_arg (gs
))
2304 dump_generic_node (buffer
, gimple_omp_task_data_arg (gs
),
2307 pp_string (buffer
, "???");
2308 pp_string (buffer
, ")]");
2310 body
= gimple_omp_body (gs
);
2311 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
2313 newline_and_indent (buffer
, spc
+ 2);
2314 pp_left_brace (buffer
);
2315 pp_newline (buffer
);
2316 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
2317 newline_and_indent (buffer
, spc
+ 2);
2318 pp_right_brace (buffer
);
2322 pp_newline (buffer
);
2323 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
2329 /* Dump a GIMPLE_OMP_ATOMIC_LOAD tuple on the pretty_printer BUFFER, SPC
2330 spaces of indent. FLAGS specifies details to show in the dump (see TDF_*
2334 dump_gimple_omp_atomic_load (pretty_printer
*buffer
, gomp_atomic_load
*gs
,
2335 int spc
, dump_flags_t flags
)
2337 if (flags
& TDF_RAW
)
2339 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T>", gs
,
2340 gimple_omp_atomic_load_lhs (gs
),
2341 gimple_omp_atomic_load_rhs (gs
));
2345 pp_string (buffer
, "#pragma omp atomic_load");
2346 if (gimple_omp_atomic_seq_cst_p (gs
))
2347 pp_string (buffer
, " seq_cst");
2348 if (gimple_omp_atomic_need_value_p (gs
))
2349 pp_string (buffer
, " [needed]");
2350 newline_and_indent (buffer
, spc
+ 2);
2351 dump_generic_node (buffer
, gimple_omp_atomic_load_lhs (gs
),
2357 dump_generic_node (buffer
, gimple_omp_atomic_load_rhs (gs
),
2362 /* Dump a GIMPLE_OMP_ATOMIC_STORE tuple on the pretty_printer BUFFER, SPC
2363 spaces of indent. FLAGS specifies details to show in the dump (see TDF_*
2367 dump_gimple_omp_atomic_store (pretty_printer
*buffer
,
2368 gomp_atomic_store
*gs
, int spc
,
2371 if (flags
& TDF_RAW
)
2373 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
,
2374 gimple_omp_atomic_store_val (gs
));
2378 pp_string (buffer
, "#pragma omp atomic_store ");
2379 if (gimple_omp_atomic_seq_cst_p (gs
))
2380 pp_string (buffer
, "seq_cst ");
2381 if (gimple_omp_atomic_need_value_p (gs
))
2382 pp_string (buffer
, "[needed] ");
2383 pp_left_paren (buffer
);
2384 dump_generic_node (buffer
, gimple_omp_atomic_store_val (gs
),
2386 pp_right_paren (buffer
);
2391 /* Dump all the memory operands for statement GS. BUFFER, SPC and
2392 FLAGS are as in pp_gimple_stmt_1. */
2395 dump_gimple_mem_ops (pretty_printer
*buffer
, gimple
*gs
, int spc
,
2398 tree vdef
= gimple_vdef (gs
);
2399 tree vuse
= gimple_vuse (gs
);
2401 if (vdef
!= NULL_TREE
)
2403 pp_string (buffer
, "# ");
2404 dump_generic_node (buffer
, vdef
, spc
+ 2, flags
, false);
2405 pp_string (buffer
, " = VDEF <");
2406 dump_generic_node (buffer
, vuse
, spc
+ 2, flags
, false);
2407 pp_greater (buffer
);
2408 newline_and_indent (buffer
, spc
);
2410 else if (vuse
!= NULL_TREE
)
2412 pp_string (buffer
, "# VUSE <");
2413 dump_generic_node (buffer
, vuse
, spc
+ 2, flags
, false);
2414 pp_greater (buffer
);
2415 newline_and_indent (buffer
, spc
);
2420 /* Print the gimple statement GS on the pretty printer BUFFER, SPC
2421 spaces of indent. FLAGS specifies details to show in the dump (see
2422 TDF_* in dumpfile.h). The caller is responsible for calling
2423 pp_flush on BUFFER to finalize the pretty printer. */
2426 pp_gimple_stmt_1 (pretty_printer
*buffer
, gimple
*gs
, int spc
,
2432 if (flags
& TDF_STMTADDR
)
2433 pp_printf (buffer
, "<&%p> ", (void *) gs
);
2435 if ((flags
& TDF_LINENO
) && gimple_has_location (gs
))
2436 dump_location (buffer
, gimple_location (gs
));
2440 int lp_nr
= lookup_stmt_eh_lp (gs
);
2442 pp_printf (buffer
, "[LP %d] ", lp_nr
);
2444 pp_printf (buffer
, "[MNT %d] ", -lp_nr
);
2447 if ((flags
& (TDF_VOPS
|TDF_MEMSYMS
))
2448 && gimple_has_mem_ops (gs
))
2449 dump_gimple_mem_ops (buffer
, gs
, spc
, flags
);
2451 if (gimple_has_lhs (gs
)
2452 && (flags
& TDF_ALIAS
))
2453 dump_ssaname_info (buffer
, gimple_get_lhs (gs
), spc
);
2455 switch (gimple_code (gs
))
2458 dump_gimple_asm (buffer
, as_a
<gasm
*> (gs
), spc
, flags
);
2462 dump_gimple_assign (buffer
, as_a
<gassign
*> (gs
), spc
, flags
);
2466 dump_gimple_bind (buffer
, as_a
<gbind
*> (gs
), spc
, flags
);
2470 dump_gimple_call (buffer
, as_a
<gcall
*> (gs
), spc
, flags
);
2474 dump_gimple_cond (buffer
, as_a
<gcond
*> (gs
), spc
, flags
);
2478 dump_gimple_label (buffer
, as_a
<glabel
*> (gs
), spc
, flags
);
2482 dump_gimple_goto (buffer
, as_a
<ggoto
*> (gs
), spc
, flags
);
2486 pp_string (buffer
, "GIMPLE_NOP");
2490 dump_gimple_return (buffer
, as_a
<greturn
*> (gs
), spc
, flags
);
2494 dump_gimple_switch (buffer
, as_a
<gswitch
*> (gs
), spc
, flags
);
2498 dump_gimple_try (buffer
, as_a
<gtry
*> (gs
), spc
, flags
);
2502 dump_gimple_phi (buffer
, as_a
<gphi
*> (gs
), spc
, false, flags
);
2505 case GIMPLE_OMP_PARALLEL
:
2506 dump_gimple_omp_parallel (buffer
, as_a
<gomp_parallel
*> (gs
), spc
,
2510 case GIMPLE_OMP_TASK
:
2511 dump_gimple_omp_task (buffer
, as_a
<gomp_task
*> (gs
), spc
, flags
);
2514 case GIMPLE_OMP_ATOMIC_LOAD
:
2515 dump_gimple_omp_atomic_load (buffer
, as_a
<gomp_atomic_load
*> (gs
),
2519 case GIMPLE_OMP_ATOMIC_STORE
:
2520 dump_gimple_omp_atomic_store (buffer
,
2521 as_a
<gomp_atomic_store
*> (gs
),
2525 case GIMPLE_OMP_FOR
:
2526 dump_gimple_omp_for (buffer
, as_a
<gomp_for
*> (gs
), spc
, flags
);
2529 case GIMPLE_OMP_CONTINUE
:
2530 dump_gimple_omp_continue (buffer
, as_a
<gomp_continue
*> (gs
), spc
,
2534 case GIMPLE_OMP_SINGLE
:
2535 dump_gimple_omp_single (buffer
, as_a
<gomp_single
*> (gs
), spc
,
2539 case GIMPLE_OMP_TARGET
:
2540 dump_gimple_omp_target (buffer
, as_a
<gomp_target
*> (gs
), spc
,
2544 case GIMPLE_OMP_TEAMS
:
2545 dump_gimple_omp_teams (buffer
, as_a
<gomp_teams
*> (gs
), spc
,
2549 case GIMPLE_OMP_RETURN
:
2550 dump_gimple_omp_return (buffer
, gs
, spc
, flags
);
2553 case GIMPLE_OMP_SECTIONS
:
2554 dump_gimple_omp_sections (buffer
, as_a
<gomp_sections
*> (gs
),
2558 case GIMPLE_OMP_SECTIONS_SWITCH
:
2559 pp_string (buffer
, "GIMPLE_SECTIONS_SWITCH");
2562 case GIMPLE_OMP_MASTER
:
2563 case GIMPLE_OMP_TASKGROUP
:
2564 case GIMPLE_OMP_SECTION
:
2565 case GIMPLE_OMP_GRID_BODY
:
2566 dump_gimple_omp_block (buffer
, gs
, spc
, flags
);
2569 case GIMPLE_OMP_ORDERED
:
2570 dump_gimple_omp_ordered (buffer
, as_a
<gomp_ordered
*> (gs
), spc
,
2574 case GIMPLE_OMP_CRITICAL
:
2575 dump_gimple_omp_critical (buffer
, as_a
<gomp_critical
*> (gs
), spc
,
2580 dump_gimple_catch (buffer
, as_a
<gcatch
*> (gs
), spc
, flags
);
2583 case GIMPLE_EH_FILTER
:
2584 dump_gimple_eh_filter (buffer
, as_a
<geh_filter
*> (gs
), spc
, flags
);
2587 case GIMPLE_EH_MUST_NOT_THROW
:
2588 dump_gimple_eh_must_not_throw (buffer
,
2589 as_a
<geh_mnt
*> (gs
),
2593 case GIMPLE_EH_ELSE
:
2594 dump_gimple_eh_else (buffer
, as_a
<geh_else
*> (gs
), spc
, flags
);
2598 dump_gimple_resx (buffer
, as_a
<gresx
*> (gs
), spc
, flags
);
2601 case GIMPLE_EH_DISPATCH
:
2602 dump_gimple_eh_dispatch (buffer
, as_a
<geh_dispatch
*> (gs
), spc
,
2607 dump_gimple_debug (buffer
, as_a
<gdebug
*> (gs
), spc
, flags
);
2610 case GIMPLE_PREDICT
:
2611 pp_string (buffer
, "// predicted ");
2612 if (gimple_predict_outcome (gs
))
2613 pp_string (buffer
, "likely by ");
2615 pp_string (buffer
, "unlikely by ");
2616 pp_string (buffer
, predictor_name (gimple_predict_predictor (gs
)));
2617 pp_string (buffer
, " predictor.");
2620 case GIMPLE_TRANSACTION
:
2621 dump_gimple_transaction (buffer
, as_a
<gtransaction
*> (gs
), spc
,
2631 /* Dumps header of basic block BB to OUTF indented by INDENT
2632 spaces and details described by flags. */
2635 dump_gimple_bb_header (FILE *outf
, basic_block bb
, int indent
,
2638 if (flags
& TDF_BLOCKS
)
2640 if (flags
& TDF_LINENO
)
2642 gimple_stmt_iterator gsi
;
2644 if (flags
& TDF_COMMENT
)
2645 fputs (";; ", outf
);
2647 for (gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
); gsi_next (&gsi
))
2648 if (!is_gimple_debug (gsi_stmt (gsi
))
2649 && get_lineno (gsi_stmt (gsi
)) != UNKNOWN_LOCATION
)
2651 fprintf (outf
, "%*sstarting at line %d",
2652 indent
, "", get_lineno (gsi_stmt (gsi
)));
2655 if (bb
->discriminator
)
2656 fprintf (outf
, ", discriminator %i", bb
->discriminator
);
2662 gimple
*stmt
= first_stmt (bb
);
2663 if (!stmt
|| gimple_code (stmt
) != GIMPLE_LABEL
)
2665 if (flags
& TDF_GIMPLE
)
2666 fprintf (outf
, "%*sbb_%d:\n", indent
, "", bb
->index
);
2668 fprintf (outf
, "%*s<bb %d> %s:\n",
2669 indent
, "", bb
->index
, dump_probability (bb
->frequency
));
2675 /* Dumps end of basic block BB to buffer BUFFER indented by INDENT
2679 dump_gimple_bb_footer (FILE *outf ATTRIBUTE_UNUSED
,
2680 basic_block bb ATTRIBUTE_UNUSED
,
2681 int indent ATTRIBUTE_UNUSED
,
2682 dump_flags_t flags ATTRIBUTE_UNUSED
)
2684 /* There is currently no GIMPLE-specific basic block info to dump. */
2689 /* Dump PHI nodes of basic block BB to BUFFER with details described
2690 by FLAGS and indented by INDENT spaces. */
2693 dump_phi_nodes (pretty_printer
*buffer
, basic_block bb
, int indent
,
2698 for (i
= gsi_start_phis (bb
); !gsi_end_p (i
); gsi_next (&i
))
2700 gphi
*phi
= i
.phi ();
2701 if (!virtual_operand_p (gimple_phi_result (phi
)) || (flags
& TDF_VOPS
))
2704 dump_gimple_phi (buffer
, phi
, indent
,
2705 (flags
& TDF_GIMPLE
) ? false : true, flags
);
2706 pp_newline (buffer
);
2712 /* Dump jump to basic block BB that is represented implicitly in the cfg
2716 pp_cfg_jump (pretty_printer
*buffer
, edge e
, dump_flags_t flags
)
2718 if (flags
& TDF_GIMPLE
)
2720 pp_string (buffer
, "goto bb_");
2721 pp_decimal_int (buffer
, e
->dest
->index
);
2722 pp_semicolon (buffer
);
2726 gimple
*stmt
= first_stmt (e
->dest
);
2728 pp_string (buffer
, "goto <bb ");
2729 pp_decimal_int (buffer
, e
->dest
->index
);
2730 pp_greater (buffer
);
2731 if (stmt
&& gimple_code (stmt
) == GIMPLE_LABEL
)
2733 pp_string (buffer
, " (");
2734 dump_generic_node (buffer
,
2735 gimple_label_label (as_a
<glabel
*> (stmt
)),
2737 pp_right_paren (buffer
);
2738 pp_semicolon (buffer
);
2741 pp_semicolon (buffer
);
2743 dump_edge_probability (buffer
, e
);
2748 /* Dump edges represented implicitly in basic block BB to BUFFER, indented
2749 by INDENT spaces, with details given by FLAGS. */
2752 dump_implicit_edges (pretty_printer
*buffer
, basic_block bb
, int indent
,
2758 stmt
= last_stmt (bb
);
2760 if (stmt
&& gimple_code (stmt
) == GIMPLE_COND
)
2762 edge true_edge
, false_edge
;
2764 /* When we are emitting the code or changing CFG, it is possible that
2765 the edges are not yet created. When we are using debug_bb in such
2766 a situation, we do not want it to crash. */
2767 if (EDGE_COUNT (bb
->succs
) != 2)
2769 extract_true_false_edges_from_block (bb
, &true_edge
, &false_edge
);
2771 INDENT (indent
+ 2);
2772 pp_cfg_jump (buffer
, true_edge
, flags
);
2773 newline_and_indent (buffer
, indent
);
2774 pp_string (buffer
, "else");
2775 newline_and_indent (buffer
, indent
+ 2);
2776 pp_cfg_jump (buffer
, false_edge
, flags
);
2777 pp_newline (buffer
);
2781 /* If there is a fallthru edge, we may need to add an artificial
2782 goto to the dump. */
2783 e
= find_fallthru_edge (bb
->succs
);
2785 if (e
&& e
->dest
!= bb
->next_bb
)
2789 if ((flags
& TDF_LINENO
)
2790 && e
->goto_locus
!= UNKNOWN_LOCATION
)
2791 dump_location (buffer
, e
->goto_locus
);
2793 pp_cfg_jump (buffer
, e
, flags
);
2794 pp_newline (buffer
);
2799 /* Dumps basic block BB to buffer BUFFER with details described by FLAGS and
2800 indented by INDENT spaces. */
2803 gimple_dump_bb_buff (pretty_printer
*buffer
, basic_block bb
, int indent
,
2806 gimple_stmt_iterator gsi
;
2808 int label_indent
= indent
- 2;
2810 if (label_indent
< 0)
2813 dump_phi_nodes (buffer
, bb
, indent
, flags
);
2815 for (gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
); gsi_next (&gsi
))
2819 stmt
= gsi_stmt (gsi
);
2821 curr_indent
= gimple_code (stmt
) == GIMPLE_LABEL
? label_indent
: indent
;
2823 INDENT (curr_indent
);
2824 pp_gimple_stmt_1 (buffer
, stmt
, curr_indent
, flags
);
2825 pp_newline_and_flush (buffer
);
2826 gcc_checking_assert (DECL_STRUCT_FUNCTION (current_function_decl
));
2827 dump_histograms_for_stmt (DECL_STRUCT_FUNCTION (current_function_decl
),
2828 pp_buffer (buffer
)->stream
, stmt
);
2831 dump_implicit_edges (buffer
, bb
, indent
, flags
);
2836 /* Dumps basic block BB to FILE with details described by FLAGS and
2837 indented by INDENT spaces. */
2840 gimple_dump_bb (FILE *file
, basic_block bb
, int indent
, dump_flags_t flags
)
2842 dump_gimple_bb_header (file
, bb
, indent
, flags
);
2843 if (bb
->index
>= NUM_FIXED_BLOCKS
)
2845 pretty_printer buffer
;
2846 pp_needs_newline (&buffer
) = true;
2847 buffer
.buffer
->stream
= file
;
2848 gimple_dump_bb_buff (&buffer
, bb
, indent
, flags
);
2850 dump_gimple_bb_footer (file
, bb
, indent
, flags
);
2853 /* Dumps basic block BB to pretty-printer PP with default dump flags and
2854 no indentation, for use as a label of a DOT graph record-node.
2855 ??? Should just use gimple_dump_bb_buff here, except that value profiling
2856 histogram dumping doesn't know about pretty-printers. */
2859 gimple_dump_bb_for_graph (pretty_printer
*pp
, basic_block bb
)
2861 pp_printf (pp
, "<bb %d>:\n", bb
->index
);
2862 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
2864 for (gphi_iterator gsi
= gsi_start_phis (bb
); !gsi_end_p (gsi
);
2867 gphi
*phi
= gsi
.phi ();
2868 if (!virtual_operand_p (gimple_phi_result (phi
))
2869 || (dump_flags
& TDF_VOPS
))
2872 pp_write_text_to_stream (pp
);
2873 pp_string (pp
, "# ");
2874 pp_gimple_stmt_1 (pp
, phi
, 0, dump_flags
);
2876 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
2880 for (gimple_stmt_iterator gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
);
2883 gimple
*stmt
= gsi_stmt (gsi
);
2885 pp_write_text_to_stream (pp
);
2886 pp_gimple_stmt_1 (pp
, stmt
, 0, dump_flags
);
2888 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
2890 dump_implicit_edges (pp
, bb
, 0, dump_flags
);
2891 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);