1 /* Pretty formatting of GIMPLE statements and expressions.
2 Copyright (C) 2001-2015 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"
30 #include "fold-const.h"
31 #include "stringpool.h"
32 #include "diagnostic.h"
33 #include "gimple-pretty-print.h"
36 #include "hard-reg-set.h"
39 #include "basic-block.h"
40 #include "tree-ssa-alias.h"
41 #include "internal-fn.h"
43 #include "gimple-expr.h"
46 #include "gimple-iterator.h"
47 #include "gimple-ssa.h"
48 #include "plugin-api.h"
52 #include "tree-ssanames.h"
53 #include "dumpfile.h" /* for dump_flags */
54 #include "value-prof.h"
55 #include "trans-mem.h"
57 #define INDENT(SPACE) \
58 do { int i; for (i = 0; i < SPACE; i++) pp_space (buffer); } while (0)
60 #define GIMPLE_NIY do_niy (buffer,gs)
62 /* Try to print on BUFFER a default message for the unrecognized
63 gimple statement GS. */
66 do_niy (pretty_printer
*buffer
, gimple gs
)
68 pp_printf (buffer
, "<<< Unknown GIMPLE statement: %s >>>\n",
69 gimple_code_name
[(int) gimple_code (gs
)]);
73 /* Emit a newline and SPC indentation spaces to BUFFER. */
76 newline_and_indent (pretty_printer
*buffer
, int spc
)
83 /* Print the GIMPLE statement GS on stderr. */
86 debug_gimple_stmt (gimple gs
)
88 print_gimple_stmt (stderr
, gs
, 0, TDF_VOPS
|TDF_MEMSYMS
);
92 /* Print GIMPLE statement G to FILE using SPC indentation spaces and
93 FLAGS as in pp_gimple_stmt_1. */
96 print_gimple_stmt (FILE *file
, gimple g
, int spc
, int flags
)
98 pretty_printer buffer
;
99 pp_needs_newline (&buffer
) = true;
100 buffer
.buffer
->stream
= file
;
101 pp_gimple_stmt_1 (&buffer
, g
, spc
, flags
);
102 pp_newline_and_flush (&buffer
);
106 debug (gimple_statement_base
&ref
)
108 print_gimple_stmt (stderr
, &ref
, 0, 0);
112 debug (gimple_statement_base
*ptr
)
117 fprintf (stderr
, "<nil>\n");
121 /* Print GIMPLE statement G to FILE using SPC indentation spaces and
122 FLAGS as in pp_gimple_stmt_1. Print only the right-hand side
126 print_gimple_expr (FILE *file
, gimple g
, int spc
, int flags
)
128 flags
|= TDF_RHS_ONLY
;
129 pretty_printer buffer
;
130 pp_needs_newline (&buffer
) = true;
131 buffer
.buffer
->stream
= file
;
132 pp_gimple_stmt_1 (&buffer
, g
, spc
, flags
);
137 /* Print the GIMPLE sequence SEQ on BUFFER using SPC indentation
138 spaces and FLAGS as in pp_gimple_stmt_1.
139 The caller is responsible for calling pp_flush on BUFFER to finalize
140 the pretty printer. */
143 dump_gimple_seq (pretty_printer
*buffer
, gimple_seq seq
, int spc
, int flags
)
145 gimple_stmt_iterator i
;
147 for (i
= gsi_start (seq
); !gsi_end_p (i
); gsi_next (&i
))
149 gimple gs
= gsi_stmt (i
);
151 pp_gimple_stmt_1 (buffer
, gs
, spc
, flags
);
152 if (!gsi_one_before_end_p (i
))
158 /* Print GIMPLE sequence SEQ to FILE using SPC indentation spaces and
159 FLAGS as in pp_gimple_stmt_1. */
162 print_gimple_seq (FILE *file
, gimple_seq seq
, int spc
, int flags
)
164 pretty_printer buffer
;
165 pp_needs_newline (&buffer
) = true;
166 buffer
.buffer
->stream
= file
;
167 dump_gimple_seq (&buffer
, seq
, spc
, flags
);
168 pp_newline_and_flush (&buffer
);
172 /* Print the GIMPLE sequence SEQ on stderr. */
175 debug_gimple_seq (gimple_seq seq
)
177 print_gimple_seq (stderr
, seq
, 0, TDF_VOPS
|TDF_MEMSYMS
);
181 /* A simple helper to pretty-print some of the gimple tuples in the printf
182 style. The format modifiers are preceded by '%' and are:
183 'G' - outputs a string corresponding to the code of the given gimple,
184 'S' - outputs a gimple_seq with indent of spc + 2,
185 'T' - outputs the tree t,
186 'd' - outputs an int as a decimal,
187 's' - outputs a string,
188 'n' - outputs a newline,
189 'x' - outputs an int as hexadecimal,
190 '+' - increases indent by 2 then outputs a newline,
191 '-' - decreases indent by 2 then outputs a newline. */
194 dump_gimple_fmt (pretty_printer
*buffer
, int spc
, int flags
,
195 const char *fmt
, ...)
201 va_start (args
, fmt
);
202 for (c
= fmt
; *c
; c
++)
212 g
= va_arg (args
, gimple
);
213 tmp
= gimple_code_name
[gimple_code (g
)];
214 pp_string (buffer
, tmp
);
218 seq
= va_arg (args
, gimple_seq
);
220 dump_gimple_seq (buffer
, seq
, spc
+ 2, flags
);
221 newline_and_indent (buffer
, spc
);
225 t
= va_arg (args
, tree
);
227 pp_string (buffer
, "NULL");
229 dump_generic_node (buffer
, t
, spc
, flags
, false);
233 pp_decimal_int (buffer
, va_arg (args
, int));
237 pp_string (buffer
, va_arg (args
, char *));
241 newline_and_indent (buffer
, spc
);
245 pp_scalar (buffer
, "%x", va_arg (args
, int));
250 newline_and_indent (buffer
, spc
);
255 newline_and_indent (buffer
, spc
);
263 pp_character (buffer
, *c
);
269 /* Helper for dump_gimple_assign. Print the unary RHS of the
270 assignment GS. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. */
273 dump_unary_rhs (pretty_printer
*buffer
, gassign
*gs
, int spc
, int flags
)
275 enum tree_code rhs_code
= gimple_assign_rhs_code (gs
);
276 tree lhs
= gimple_assign_lhs (gs
);
277 tree rhs
= gimple_assign_rhs1 (gs
);
281 case VIEW_CONVERT_EXPR
:
283 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
286 case FIXED_CONVERT_EXPR
:
287 case ADDR_SPACE_CONVERT_EXPR
:
291 pp_left_paren (buffer
);
292 dump_generic_node (buffer
, TREE_TYPE (lhs
), spc
, flags
, false);
293 pp_string (buffer
, ") ");
294 if (op_prio (rhs
) < op_code_prio (rhs_code
))
296 pp_left_paren (buffer
);
297 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
298 pp_right_paren (buffer
);
301 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
305 pp_string (buffer
, "((");
306 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
307 pp_string (buffer
, "))");
311 pp_string (buffer
, "ABS_EXPR <");
312 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
317 if (TREE_CODE_CLASS (rhs_code
) == tcc_declaration
318 || TREE_CODE_CLASS (rhs_code
) == tcc_constant
319 || TREE_CODE_CLASS (rhs_code
) == tcc_reference
320 || rhs_code
== SSA_NAME
321 || rhs_code
== ADDR_EXPR
322 || rhs_code
== CONSTRUCTOR
)
324 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
327 else if (rhs_code
== BIT_NOT_EXPR
)
328 pp_complement (buffer
);
329 else if (rhs_code
== TRUTH_NOT_EXPR
)
330 pp_exclamation (buffer
);
331 else if (rhs_code
== NEGATE_EXPR
)
335 pp_left_bracket (buffer
);
336 pp_string (buffer
, get_tree_code_name (rhs_code
));
337 pp_string (buffer
, "] ");
340 if (op_prio (rhs
) < op_code_prio (rhs_code
))
342 pp_left_paren (buffer
);
343 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
344 pp_right_paren (buffer
);
347 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
353 /* Helper for dump_gimple_assign. Print the binary RHS of the
354 assignment GS. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. */
357 dump_binary_rhs (pretty_printer
*buffer
, gassign
*gs
, int spc
, int flags
)
360 enum tree_code code
= gimple_assign_rhs_code (gs
);
366 case VEC_WIDEN_MULT_HI_EXPR
:
367 case VEC_WIDEN_MULT_LO_EXPR
:
368 case VEC_WIDEN_MULT_EVEN_EXPR
:
369 case VEC_WIDEN_MULT_ODD_EXPR
:
370 case VEC_PACK_TRUNC_EXPR
:
371 case VEC_PACK_SAT_EXPR
:
372 case VEC_PACK_FIX_TRUNC_EXPR
:
373 case VEC_WIDEN_LSHIFT_HI_EXPR
:
374 case VEC_WIDEN_LSHIFT_LO_EXPR
:
375 for (p
= get_tree_code_name (code
); *p
; p
++)
376 pp_character (buffer
, TOUPPER (*p
));
377 pp_string (buffer
, " <");
378 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
379 pp_string (buffer
, ", ");
380 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
385 if (op_prio (gimple_assign_rhs1 (gs
)) <= op_code_prio (code
))
387 pp_left_paren (buffer
);
388 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
,
390 pp_right_paren (buffer
);
393 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
395 pp_string (buffer
, op_symbol_code (gimple_assign_rhs_code (gs
)));
397 if (op_prio (gimple_assign_rhs2 (gs
)) <= op_code_prio (code
))
399 pp_left_paren (buffer
);
400 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
,
402 pp_right_paren (buffer
);
405 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
409 /* Helper for dump_gimple_assign. Print the ternary RHS of the
410 assignment GS. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. */
413 dump_ternary_rhs (pretty_printer
*buffer
, gassign
*gs
, int spc
, int flags
)
416 enum tree_code code
= gimple_assign_rhs_code (gs
);
419 case WIDEN_MULT_PLUS_EXPR
:
420 case WIDEN_MULT_MINUS_EXPR
:
421 for (p
= get_tree_code_name (code
); *p
; p
++)
422 pp_character (buffer
, TOUPPER (*p
));
423 pp_string (buffer
, " <");
424 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
425 pp_string (buffer
, ", ");
426 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
427 pp_string (buffer
, ", ");
428 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
433 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
434 pp_string (buffer
, " * ");
435 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
436 pp_string (buffer
, " + ");
437 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
441 pp_string (buffer
, "DOT_PROD_EXPR <");
442 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
443 pp_string (buffer
, ", ");
444 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
445 pp_string (buffer
, ", ");
446 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
451 pp_string (buffer
, "SAD_EXPR <");
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 pp_string (buffer
, "VEC_PERM_EXPR <");
462 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
463 pp_string (buffer
, ", ");
464 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
465 pp_string (buffer
, ", ");
466 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
470 case REALIGN_LOAD_EXPR
:
471 pp_string (buffer
, "REALIGN_LOAD <");
472 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
473 pp_string (buffer
, ", ");
474 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
475 pp_string (buffer
, ", ");
476 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
481 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
482 pp_string (buffer
, " ? ");
483 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
484 pp_string (buffer
, " : ");
485 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
489 pp_string (buffer
, "VEC_COND_EXPR <");
490 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
491 pp_string (buffer
, ", ");
492 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
493 pp_string (buffer
, ", ");
494 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
504 /* Dump the gimple assignment GS. BUFFER, SPC and FLAGS are as in
508 dump_gimple_assign (pretty_printer
*buffer
, gassign
*gs
, int spc
, int flags
)
515 switch (gimple_num_ops (gs
))
518 arg3
= gimple_assign_rhs3 (gs
);
520 arg2
= gimple_assign_rhs2 (gs
);
522 arg1
= gimple_assign_rhs1 (gs
);
528 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%s, %T, %T, %T, %T>", gs
,
529 get_tree_code_name (gimple_assign_rhs_code (gs
)),
530 gimple_assign_lhs (gs
), arg1
, arg2
, arg3
);
534 if (!(flags
& TDF_RHS_ONLY
))
536 dump_generic_node (buffer
, gimple_assign_lhs (gs
), spc
, flags
, false);
540 if (gimple_assign_nontemporal_move_p (gs
))
541 pp_string (buffer
, "{nt}");
543 if (gimple_has_volatile_ops (gs
))
544 pp_string (buffer
, "{v}");
549 if (gimple_num_ops (gs
) == 2)
550 dump_unary_rhs (buffer
, gs
, spc
, flags
);
551 else if (gimple_num_ops (gs
) == 3)
552 dump_binary_rhs (buffer
, gs
, spc
, flags
);
553 else if (gimple_num_ops (gs
) == 4)
554 dump_ternary_rhs (buffer
, gs
, spc
, flags
);
557 if (!(flags
& TDF_RHS_ONLY
))
558 pp_semicolon (buffer
);
563 /* Dump the return statement GS. BUFFER, SPC and FLAGS are as in
567 dump_gimple_return (pretty_printer
*buffer
, greturn
*gs
, int spc
, int flags
)
571 t
= gimple_return_retval (gs
);
572 t2
= gimple_return_retbnd (gs
);
574 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T %T>", gs
, t
, t2
);
577 pp_string (buffer
, "return");
581 dump_generic_node (buffer
, t
, spc
, flags
, false);
585 pp_string (buffer
, ", ");
586 dump_generic_node (buffer
, t2
, spc
, flags
, false);
588 pp_semicolon (buffer
);
593 /* Dump the call arguments for a gimple call. BUFFER, FLAGS are as in
597 dump_gimple_call_args (pretty_printer
*buffer
, gcall
*gs
, int flags
)
601 for (i
= 0; i
< gimple_call_num_args (gs
); i
++)
603 dump_generic_node (buffer
, gimple_call_arg (gs
, i
), 0, flags
, false);
604 if (i
< gimple_call_num_args (gs
) - 1)
605 pp_string (buffer
, ", ");
608 if (gimple_call_va_arg_pack_p (gs
))
610 if (gimple_call_num_args (gs
) > 0)
616 pp_string (buffer
, "__builtin_va_arg_pack ()");
620 /* Dump the points-to solution *PT to BUFFER. */
623 pp_points_to_solution (pretty_printer
*buffer
, struct pt_solution
*pt
)
627 pp_string (buffer
, "anything ");
631 pp_string (buffer
, "nonlocal ");
633 pp_string (buffer
, "escaped ");
635 pp_string (buffer
, "unit-escaped ");
637 pp_string (buffer
, "null ");
639 && !bitmap_empty_p (pt
->vars
))
643 pp_string (buffer
, "{ ");
644 EXECUTE_IF_SET_IN_BITMAP (pt
->vars
, 0, i
, bi
)
646 pp_string (buffer
, "D.");
647 pp_decimal_int (buffer
, i
);
650 pp_right_brace (buffer
);
651 if (pt
->vars_contains_nonlocal
652 && pt
->vars_contains_escaped_heap
)
653 pp_string (buffer
, " (nonlocal, escaped heap)");
654 else if (pt
->vars_contains_nonlocal
655 && pt
->vars_contains_escaped
)
656 pp_string (buffer
, " (nonlocal, escaped)");
657 else if (pt
->vars_contains_nonlocal
)
658 pp_string (buffer
, " (nonlocal)");
659 else if (pt
->vars_contains_escaped_heap
)
660 pp_string (buffer
, " (escaped heap)");
661 else if (pt
->vars_contains_escaped
)
662 pp_string (buffer
, " (escaped)");
666 /* Dump the call statement GS. BUFFER, SPC and FLAGS are as in
670 dump_gimple_call (pretty_printer
*buffer
, gcall
*gs
, int spc
, int flags
)
672 tree lhs
= gimple_call_lhs (gs
);
673 tree fn
= gimple_call_fn (gs
);
675 if (flags
& TDF_ALIAS
)
677 struct pt_solution
*pt
;
678 pt
= gimple_call_use_set (gs
);
679 if (!pt_solution_empty_p (pt
))
681 pp_string (buffer
, "# USE = ");
682 pp_points_to_solution (buffer
, pt
);
683 newline_and_indent (buffer
, spc
);
685 pt
= gimple_call_clobber_set (gs
);
686 if (!pt_solution_empty_p (pt
))
688 pp_string (buffer
, "# CLB = ");
689 pp_points_to_solution (buffer
, pt
);
690 newline_and_indent (buffer
, spc
);
696 if (gimple_call_internal_p (gs
))
697 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%s, %T", gs
,
698 internal_fn_name (gimple_call_internal_fn (gs
)), lhs
);
700 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T", gs
, fn
, lhs
);
701 if (gimple_call_num_args (gs
) > 0)
703 pp_string (buffer
, ", ");
704 dump_gimple_call_args (buffer
, gs
, flags
);
710 if (lhs
&& !(flags
& TDF_RHS_ONLY
))
712 dump_generic_node (buffer
, lhs
, spc
, flags
, false);
713 pp_string (buffer
, " =");
715 if (gimple_has_volatile_ops (gs
))
716 pp_string (buffer
, "{v}");
720 if (gimple_call_internal_p (gs
))
721 pp_string (buffer
, internal_fn_name (gimple_call_internal_fn (gs
)));
723 print_call_name (buffer
, fn
, flags
);
724 pp_string (buffer
, " (");
725 dump_gimple_call_args (buffer
, gs
, flags
);
726 pp_right_paren (buffer
);
727 if (!(flags
& TDF_RHS_ONLY
))
728 pp_semicolon (buffer
);
731 if (gimple_call_chain (gs
))
733 pp_string (buffer
, " [static-chain: ");
734 dump_generic_node (buffer
, gimple_call_chain (gs
), spc
, flags
, false);
735 pp_right_bracket (buffer
);
738 if (gimple_call_return_slot_opt_p (gs
))
739 pp_string (buffer
, " [return slot optimization]");
740 if (gimple_call_tail_p (gs
))
741 pp_string (buffer
, " [tail call]");
746 /* Dump the arguments of _ITM_beginTransaction sanely. */
747 if (TREE_CODE (fn
) == ADDR_EXPR
)
748 fn
= TREE_OPERAND (fn
, 0);
749 if (TREE_CODE (fn
) == FUNCTION_DECL
&& decl_is_tm_clone (fn
))
750 pp_string (buffer
, " [tm-clone]");
751 if (TREE_CODE (fn
) == FUNCTION_DECL
752 && DECL_BUILT_IN_CLASS (fn
) == BUILT_IN_NORMAL
753 && DECL_FUNCTION_CODE (fn
) == BUILT_IN_TM_START
754 && gimple_call_num_args (gs
) > 0)
756 tree t
= gimple_call_arg (gs
, 0);
757 unsigned HOST_WIDE_INT props
;
758 gcc_assert (TREE_CODE (t
) == INTEGER_CST
);
760 pp_string (buffer
, " [ ");
762 /* Get the transaction code properties. */
763 props
= TREE_INT_CST_LOW (t
);
765 if (props
& PR_INSTRUMENTEDCODE
)
766 pp_string (buffer
, "instrumentedCode ");
767 if (props
& PR_UNINSTRUMENTEDCODE
)
768 pp_string (buffer
, "uninstrumentedCode ");
769 if (props
& PR_HASNOXMMUPDATE
)
770 pp_string (buffer
, "hasNoXMMUpdate ");
771 if (props
& PR_HASNOABORT
)
772 pp_string (buffer
, "hasNoAbort ");
773 if (props
& PR_HASNOIRREVOCABLE
)
774 pp_string (buffer
, "hasNoIrrevocable ");
775 if (props
& PR_DOESGOIRREVOCABLE
)
776 pp_string (buffer
, "doesGoIrrevocable ");
777 if (props
& PR_HASNOSIMPLEREADS
)
778 pp_string (buffer
, "hasNoSimpleReads ");
779 if (props
& PR_AWBARRIERSOMITTED
)
780 pp_string (buffer
, "awBarriersOmitted ");
781 if (props
& PR_RARBARRIERSOMITTED
)
782 pp_string (buffer
, "RaRBarriersOmitted ");
783 if (props
& PR_UNDOLOGCODE
)
784 pp_string (buffer
, "undoLogCode ");
785 if (props
& PR_PREFERUNINSTRUMENTED
)
786 pp_string (buffer
, "preferUninstrumented ");
787 if (props
& PR_EXCEPTIONBLOCK
)
788 pp_string (buffer
, "exceptionBlock ");
789 if (props
& PR_HASELSE
)
790 pp_string (buffer
, "hasElse ");
791 if (props
& PR_READONLY
)
792 pp_string (buffer
, "readOnly ");
794 pp_right_bracket (buffer
);
799 /* Dump the switch statement GS. BUFFER, SPC and FLAGS are as in
803 dump_gimple_switch (pretty_printer
*buffer
, gswitch
*gs
, int spc
,
808 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
810 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, ", gs
,
811 gimple_switch_index (gs
));
814 pp_string (buffer
, "switch (");
815 dump_generic_node (buffer
, gimple_switch_index (gs
), spc
, flags
, true);
816 pp_string (buffer
, ") <");
819 for (i
= 0; i
< gimple_switch_num_labels (gs
); i
++)
821 tree case_label
= gimple_switch_label (gs
, i
);
822 gcc_checking_assert (case_label
!= NULL_TREE
);
823 dump_generic_node (buffer
, case_label
, spc
, flags
, false);
825 dump_generic_node (buffer
, CASE_LABEL (case_label
), spc
, flags
, false);
826 if (i
< gimple_switch_num_labels (gs
) - 1)
827 pp_string (buffer
, ", ");
833 /* Dump the gimple conditional GS. BUFFER, SPC and FLAGS are as in
837 dump_gimple_cond (pretty_printer
*buffer
, gcond
*gs
, int spc
, int flags
)
840 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%s, %T, %T, %T, %T>", gs
,
841 get_tree_code_name (gimple_cond_code (gs
)),
842 gimple_cond_lhs (gs
), gimple_cond_rhs (gs
),
843 gimple_cond_true_label (gs
), gimple_cond_false_label (gs
));
846 if (!(flags
& TDF_RHS_ONLY
))
847 pp_string (buffer
, "if (");
848 dump_generic_node (buffer
, gimple_cond_lhs (gs
), spc
, flags
, false);
850 pp_string (buffer
, op_symbol_code (gimple_cond_code (gs
)));
852 dump_generic_node (buffer
, gimple_cond_rhs (gs
), spc
, flags
, false);
853 if (!(flags
& TDF_RHS_ONLY
))
855 pp_right_paren (buffer
);
857 if (gimple_cond_true_label (gs
))
859 pp_string (buffer
, " goto ");
860 dump_generic_node (buffer
, gimple_cond_true_label (gs
),
862 pp_semicolon (buffer
);
864 if (gimple_cond_false_label (gs
))
866 pp_string (buffer
, " else goto ");
867 dump_generic_node (buffer
, gimple_cond_false_label (gs
),
869 pp_semicolon (buffer
);
876 /* Dump a GIMPLE_LABEL tuple on the pretty_printer BUFFER, SPC
877 spaces of indent. FLAGS specifies details to show in the dump (see
878 TDF_* in dumpfils.h). */
881 dump_gimple_label (pretty_printer
*buffer
, glabel
*gs
, int spc
, int flags
)
883 tree label
= gimple_label_label (gs
);
885 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
, label
);
888 dump_generic_node (buffer
, label
, spc
, flags
, false);
891 if (DECL_NONLOCAL (label
))
892 pp_string (buffer
, " [non-local]");
893 if ((flags
& TDF_EH
) && EH_LANDING_PAD_NR (label
))
894 pp_printf (buffer
, " [LP %d]", EH_LANDING_PAD_NR (label
));
897 /* Dump a GIMPLE_GOTO tuple on the pretty_printer BUFFER, SPC
898 spaces of indent. FLAGS specifies details to show in the dump (see
899 TDF_* in dumpfile.h). */
902 dump_gimple_goto (pretty_printer
*buffer
, ggoto
*gs
, int spc
, int flags
)
904 tree label
= gimple_goto_dest (gs
);
906 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
, label
);
908 dump_gimple_fmt (buffer
, spc
, flags
, "goto %T;", label
);
912 /* Dump a GIMPLE_BIND tuple on the pretty_printer BUFFER, SPC
913 spaces of indent. FLAGS specifies details to show in the dump (see
914 TDF_* in dumpfile.h). */
917 dump_gimple_bind (pretty_printer
*buffer
, gbind
*gs
, int spc
, int flags
)
920 dump_gimple_fmt (buffer
, spc
, flags
, "%G <", gs
);
922 pp_left_brace (buffer
);
923 if (!(flags
& TDF_SLIM
))
927 for (var
= gimple_bind_vars (gs
); var
; var
= DECL_CHAIN (var
))
929 newline_and_indent (buffer
, 2);
930 print_declaration (buffer
, var
, spc
, flags
);
932 if (gimple_bind_vars (gs
))
936 dump_gimple_seq (buffer
, gimple_bind_body (gs
), spc
+ 2, flags
);
937 newline_and_indent (buffer
, spc
);
941 pp_right_brace (buffer
);
945 /* Dump a GIMPLE_TRY tuple on the pretty_printer BUFFER, SPC spaces of
946 indent. FLAGS specifies details to show in the dump (see TDF_* in
950 dump_gimple_try (pretty_printer
*buffer
, gtry
*gs
, int spc
, int flags
)
955 if (gimple_try_kind (gs
) == GIMPLE_TRY_CATCH
)
956 type
= "GIMPLE_TRY_CATCH";
957 else if (gimple_try_kind (gs
) == GIMPLE_TRY_FINALLY
)
958 type
= "GIMPLE_TRY_FINALLY";
960 type
= "UNKNOWN GIMPLE_TRY";
961 dump_gimple_fmt (buffer
, spc
, flags
,
962 "%G <%s,%+EVAL <%S>%nCLEANUP <%S>%->", gs
, type
,
963 gimple_try_eval (gs
), gimple_try_cleanup (gs
));
967 pp_string (buffer
, "try");
968 newline_and_indent (buffer
, spc
+ 2);
969 pp_left_brace (buffer
);
972 dump_gimple_seq (buffer
, gimple_try_eval (gs
), spc
+ 4, flags
);
973 newline_and_indent (buffer
, spc
+ 2);
974 pp_right_brace (buffer
);
976 if (gimple_try_kind (gs
) == GIMPLE_TRY_CATCH
)
978 newline_and_indent (buffer
, spc
);
979 pp_string (buffer
, "catch");
980 newline_and_indent (buffer
, spc
+ 2);
981 pp_left_brace (buffer
);
983 else if (gimple_try_kind (gs
) == GIMPLE_TRY_FINALLY
)
985 newline_and_indent (buffer
, spc
);
986 pp_string (buffer
, "finally");
987 newline_and_indent (buffer
, spc
+ 2);
988 pp_left_brace (buffer
);
991 pp_string (buffer
, " <UNKNOWN GIMPLE_TRY> {");
994 dump_gimple_seq (buffer
, gimple_try_cleanup (gs
), spc
+ 4, flags
);
995 newline_and_indent (buffer
, spc
+ 2);
996 pp_right_brace (buffer
);
1001 /* Dump a GIMPLE_CATCH tuple on the pretty_printer BUFFER, SPC spaces of
1002 indent. FLAGS specifies details to show in the dump (see TDF_* in
1006 dump_gimple_catch (pretty_printer
*buffer
, gcatch
*gs
, int spc
, int flags
)
1008 if (flags
& TDF_RAW
)
1009 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %+CATCH <%S>%->", gs
,
1010 gimple_catch_types (gs
), gimple_catch_handler (gs
));
1012 dump_gimple_fmt (buffer
, spc
, flags
, "catch (%T)%+{%S}",
1013 gimple_catch_types (gs
), gimple_catch_handler (gs
));
1017 /* Dump a GIMPLE_EH_FILTER tuple on the pretty_printer BUFFER, SPC spaces of
1018 indent. FLAGS specifies details to show in the dump (see TDF_* in
1022 dump_gimple_eh_filter (pretty_printer
*buffer
, geh_filter
*gs
, int spc
,
1025 if (flags
& TDF_RAW
)
1026 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %+FAILURE <%S>%->", gs
,
1027 gimple_eh_filter_types (gs
),
1028 gimple_eh_filter_failure (gs
));
1030 dump_gimple_fmt (buffer
, spc
, flags
, "<<<eh_filter (%T)>>>%+{%+%S%-}",
1031 gimple_eh_filter_types (gs
),
1032 gimple_eh_filter_failure (gs
));
1036 /* Dump a GIMPLE_EH_MUST_NOT_THROW tuple. */
1039 dump_gimple_eh_must_not_throw (pretty_printer
*buffer
,
1040 geh_mnt
*gs
, int spc
, int flags
)
1042 if (flags
& TDF_RAW
)
1043 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
,
1044 gimple_eh_must_not_throw_fndecl (gs
));
1046 dump_gimple_fmt (buffer
, spc
, flags
, "<<<eh_must_not_throw (%T)>>>",
1047 gimple_eh_must_not_throw_fndecl (gs
));
1051 /* Dump a GIMPLE_EH_ELSE tuple on the pretty_printer BUFFER, SPC spaces of
1052 indent. FLAGS specifies details to show in the dump (see TDF_* in
1056 dump_gimple_eh_else (pretty_printer
*buffer
, geh_else
*gs
, int spc
,
1059 if (flags
& TDF_RAW
)
1060 dump_gimple_fmt (buffer
, spc
, flags
,
1061 "%G <%+N_BODY <%S>%nE_BODY <%S>%->", gs
,
1062 gimple_eh_else_n_body (gs
), gimple_eh_else_e_body (gs
));
1064 dump_gimple_fmt (buffer
, spc
, flags
,
1065 "<<<if_normal_exit>>>%+{%S}%-<<<else_eh_exit>>>%+{%S}",
1066 gimple_eh_else_n_body (gs
), gimple_eh_else_e_body (gs
));
1070 /* Dump a GIMPLE_RESX tuple on the pretty_printer BUFFER, SPC spaces of
1071 indent. FLAGS specifies details to show in the dump (see TDF_* in
1075 dump_gimple_resx (pretty_printer
*buffer
, gresx
*gs
, int spc
, int flags
)
1077 if (flags
& TDF_RAW
)
1078 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%d>", gs
,
1079 gimple_resx_region (gs
));
1081 dump_gimple_fmt (buffer
, spc
, flags
, "resx %d", gimple_resx_region (gs
));
1084 /* Dump a GIMPLE_EH_DISPATCH tuple on the pretty_printer BUFFER. */
1087 dump_gimple_eh_dispatch (pretty_printer
*buffer
, geh_dispatch
*gs
, int spc
, int flags
)
1089 if (flags
& TDF_RAW
)
1090 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%d>", gs
,
1091 gimple_eh_dispatch_region (gs
));
1093 dump_gimple_fmt (buffer
, spc
, flags
, "eh_dispatch %d",
1094 gimple_eh_dispatch_region (gs
));
1097 /* Dump a GIMPLE_DEBUG tuple on the pretty_printer BUFFER, SPC spaces
1098 of indent. FLAGS specifies details to show in the dump (see TDF_*
1102 dump_gimple_debug (pretty_printer
*buffer
, gdebug
*gs
, int spc
, int flags
)
1104 switch (gs
->subcode
)
1106 case GIMPLE_DEBUG_BIND
:
1107 if (flags
& TDF_RAW
)
1108 dump_gimple_fmt (buffer
, spc
, flags
, "%G BIND <%T, %T>", gs
,
1109 gimple_debug_bind_get_var (gs
),
1110 gimple_debug_bind_get_value (gs
));
1112 dump_gimple_fmt (buffer
, spc
, flags
, "# DEBUG %T => %T",
1113 gimple_debug_bind_get_var (gs
),
1114 gimple_debug_bind_get_value (gs
));
1117 case GIMPLE_DEBUG_SOURCE_BIND
:
1118 if (flags
& TDF_RAW
)
1119 dump_gimple_fmt (buffer
, spc
, flags
, "%G SRCBIND <%T, %T>", gs
,
1120 gimple_debug_source_bind_get_var (gs
),
1121 gimple_debug_source_bind_get_value (gs
));
1123 dump_gimple_fmt (buffer
, spc
, flags
, "# DEBUG %T s=> %T",
1124 gimple_debug_source_bind_get_var (gs
),
1125 gimple_debug_source_bind_get_value (gs
));
1133 /* Dump a GIMPLE_OMP_FOR tuple on the pretty_printer BUFFER. */
1135 dump_gimple_omp_for (pretty_printer
*buffer
, gomp_for
*gs
, int spc
, int flags
)
1139 if (flags
& TDF_RAW
)
1142 switch (gimple_omp_for_kind (gs
))
1144 case GF_OMP_FOR_KIND_FOR
:
1147 case GF_OMP_FOR_KIND_DISTRIBUTE
:
1148 kind
= " distribute";
1150 case GF_OMP_FOR_KIND_CILKFOR
:
1151 kind
= " _Cilk_for";
1153 case GF_OMP_FOR_KIND_OACC_LOOP
:
1154 kind
= " oacc_loop";
1156 case GF_OMP_FOR_KIND_SIMD
:
1159 case GF_OMP_FOR_KIND_CILKSIMD
:
1165 dump_gimple_fmt (buffer
, spc
, flags
, "%G%s <%+BODY <%S>%nCLAUSES <", gs
,
1166 kind
, gimple_omp_body (gs
));
1167 dump_omp_clauses (buffer
, gimple_omp_for_clauses (gs
), spc
, flags
);
1168 dump_gimple_fmt (buffer
, spc
, flags
, " >,");
1169 for (i
= 0; i
< gimple_omp_for_collapse (gs
); i
++)
1170 dump_gimple_fmt (buffer
, spc
, flags
,
1171 "%+%T, %T, %T, %s, %T,%n",
1172 gimple_omp_for_index (gs
, i
),
1173 gimple_omp_for_initial (gs
, i
),
1174 gimple_omp_for_final (gs
, i
),
1175 get_tree_code_name (gimple_omp_for_cond (gs
, i
)),
1176 gimple_omp_for_incr (gs
, i
));
1177 dump_gimple_fmt (buffer
, spc
, flags
, "PRE_BODY <%S>%->",
1178 gimple_omp_for_pre_body (gs
));
1182 switch (gimple_omp_for_kind (gs
))
1184 case GF_OMP_FOR_KIND_FOR
:
1185 pp_string (buffer
, "#pragma omp for");
1187 case GF_OMP_FOR_KIND_DISTRIBUTE
:
1188 pp_string (buffer
, "#pragma omp distribute");
1190 case GF_OMP_FOR_KIND_CILKFOR
:
1192 case GF_OMP_FOR_KIND_OACC_LOOP
:
1193 pp_string (buffer
, "#pragma acc loop");
1195 case GF_OMP_FOR_KIND_SIMD
:
1196 pp_string (buffer
, "#pragma omp simd");
1198 case GF_OMP_FOR_KIND_CILKSIMD
:
1199 pp_string (buffer
, "#pragma simd");
1204 if (gimple_omp_for_kind (gs
) != GF_OMP_FOR_KIND_CILKFOR
)
1205 dump_omp_clauses (buffer
, gimple_omp_for_clauses (gs
), spc
, flags
);
1206 for (i
= 0; i
< gimple_omp_for_collapse (gs
); i
++)
1210 if (gimple_omp_for_kind (gs
) == GF_OMP_FOR_KIND_CILKFOR
)
1211 pp_string (buffer
, "_Cilk_for (");
1214 newline_and_indent (buffer
, spc
);
1215 pp_string (buffer
, "for (");
1217 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
1219 pp_string (buffer
, " = ");
1220 dump_generic_node (buffer
, gimple_omp_for_initial (gs
, i
), spc
,
1222 pp_string (buffer
, "; ");
1224 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
1227 switch (gimple_omp_for_cond (gs
, i
))
1233 pp_greater (buffer
);
1236 pp_less_equal (buffer
);
1239 pp_greater_equal (buffer
);
1242 pp_string (buffer
, "!=");
1248 dump_generic_node (buffer
, gimple_omp_for_final (gs
, i
), spc
,
1250 pp_string (buffer
, "; ");
1252 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
1254 pp_string (buffer
, " = ");
1255 dump_generic_node (buffer
, gimple_omp_for_incr (gs
, i
), spc
,
1257 pp_right_paren (buffer
);
1260 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1262 if (gimple_omp_for_kind (gs
) == GF_OMP_FOR_KIND_CILKFOR
)
1263 dump_omp_clauses (buffer
, gimple_omp_for_clauses (gs
), spc
, flags
);
1264 newline_and_indent (buffer
, spc
+ 2);
1265 pp_left_brace (buffer
);
1266 pp_newline (buffer
);
1267 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1268 newline_and_indent (buffer
, spc
+ 2);
1269 pp_right_brace (buffer
);
1274 /* Dump a GIMPLE_OMP_CONTINUE tuple on the pretty_printer BUFFER. */
1277 dump_gimple_omp_continue (pretty_printer
*buffer
, gomp_continue
*gs
,
1280 if (flags
& TDF_RAW
)
1282 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T>", gs
,
1283 gimple_omp_continue_control_def (gs
),
1284 gimple_omp_continue_control_use (gs
));
1288 pp_string (buffer
, "#pragma omp continue (");
1289 dump_generic_node (buffer
, gimple_omp_continue_control_def (gs
),
1293 dump_generic_node (buffer
, gimple_omp_continue_control_use (gs
),
1295 pp_right_paren (buffer
);
1299 /* Dump a GIMPLE_OMP_SINGLE tuple on the pretty_printer BUFFER. */
1302 dump_gimple_omp_single (pretty_printer
*buffer
, gomp_single
*gs
,
1305 if (flags
& TDF_RAW
)
1307 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1308 gimple_omp_body (gs
));
1309 dump_omp_clauses (buffer
, gimple_omp_single_clauses (gs
), spc
, flags
);
1310 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1314 pp_string (buffer
, "#pragma omp single");
1315 dump_omp_clauses (buffer
, gimple_omp_single_clauses (gs
), spc
, flags
);
1316 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1318 newline_and_indent (buffer
, spc
+ 2);
1319 pp_left_brace (buffer
);
1320 pp_newline (buffer
);
1321 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1322 newline_and_indent (buffer
, spc
+ 2);
1323 pp_right_brace (buffer
);
1328 /* Dump a GIMPLE_OMP_TARGET tuple on the pretty_printer BUFFER. */
1331 dump_gimple_omp_target (pretty_printer
*buffer
, gomp_target
*gs
,
1335 switch (gimple_omp_target_kind (gs
))
1337 case GF_OMP_TARGET_KIND_REGION
:
1340 case GF_OMP_TARGET_KIND_DATA
:
1343 case GF_OMP_TARGET_KIND_UPDATE
:
1346 case GF_OMP_TARGET_KIND_OACC_KERNELS
:
1347 kind
= " oacc_kernels";
1349 case GF_OMP_TARGET_KIND_OACC_PARALLEL
:
1350 kind
= " oacc_parallel";
1352 case GF_OMP_TARGET_KIND_OACC_DATA
:
1353 kind
= " oacc_data";
1355 case GF_OMP_TARGET_KIND_OACC_UPDATE
:
1356 kind
= " oacc_update";
1358 case GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA
:
1359 kind
= " oacc_enter_exit_data";
1364 if (flags
& TDF_RAW
)
1366 dump_gimple_fmt (buffer
, spc
, flags
, "%G%s <%+BODY <%S>%nCLAUSES <", gs
,
1367 kind
, gimple_omp_body (gs
));
1368 dump_omp_clauses (buffer
, gimple_omp_target_clauses (gs
), spc
, flags
);
1369 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T%n>",
1370 gimple_omp_target_child_fn (gs
),
1371 gimple_omp_target_data_arg (gs
));
1375 pp_string (buffer
, "#pragma omp target");
1376 pp_string (buffer
, kind
);
1377 dump_omp_clauses (buffer
, gimple_omp_target_clauses (gs
), spc
, flags
);
1378 if (gimple_omp_target_child_fn (gs
))
1380 pp_string (buffer
, " [child fn: ");
1381 dump_generic_node (buffer
, gimple_omp_target_child_fn (gs
),
1383 pp_string (buffer
, " (");
1384 if (gimple_omp_target_data_arg (gs
))
1385 dump_generic_node (buffer
, gimple_omp_target_data_arg (gs
),
1388 pp_string (buffer
, "???");
1389 pp_string (buffer
, ")]");
1391 gimple_seq body
= gimple_omp_body (gs
);
1392 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
1394 newline_and_indent (buffer
, spc
+ 2);
1395 pp_left_brace (buffer
);
1396 pp_newline (buffer
);
1397 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
1398 newline_and_indent (buffer
, spc
+ 2);
1399 pp_right_brace (buffer
);
1403 pp_newline (buffer
);
1404 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
1409 /* Dump a GIMPLE_OMP_TEAMS tuple on the pretty_printer BUFFER. */
1412 dump_gimple_omp_teams (pretty_printer
*buffer
, gomp_teams
*gs
, int spc
,
1415 if (flags
& TDF_RAW
)
1417 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1418 gimple_omp_body (gs
));
1419 dump_omp_clauses (buffer
, gimple_omp_teams_clauses (gs
), spc
, flags
);
1420 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1424 pp_string (buffer
, "#pragma omp teams");
1425 dump_omp_clauses (buffer
, gimple_omp_teams_clauses (gs
), spc
, flags
);
1426 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1428 newline_and_indent (buffer
, spc
+ 2);
1429 pp_character (buffer
, '{');
1430 pp_newline (buffer
);
1431 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1432 newline_and_indent (buffer
, spc
+ 2);
1433 pp_character (buffer
, '}');
1438 /* Dump a GIMPLE_OMP_SECTIONS tuple on the pretty_printer BUFFER. */
1441 dump_gimple_omp_sections (pretty_printer
*buffer
, gomp_sections
*gs
,
1444 if (flags
& TDF_RAW
)
1446 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1447 gimple_omp_body (gs
));
1448 dump_omp_clauses (buffer
, gimple_omp_sections_clauses (gs
), spc
, flags
);
1449 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1453 pp_string (buffer
, "#pragma omp sections");
1454 if (gimple_omp_sections_control (gs
))
1456 pp_string (buffer
, " <");
1457 dump_generic_node (buffer
, gimple_omp_sections_control (gs
), spc
,
1459 pp_greater (buffer
);
1461 dump_omp_clauses (buffer
, gimple_omp_sections_clauses (gs
), spc
, flags
);
1462 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1464 newline_and_indent (buffer
, spc
+ 2);
1465 pp_left_brace (buffer
);
1466 pp_newline (buffer
);
1467 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1468 newline_and_indent (buffer
, spc
+ 2);
1469 pp_right_brace (buffer
);
1474 /* Dump a GIMPLE_OMP_{MASTER,TASKGROUP,ORDERED,SECTION} tuple on the
1475 pretty_printer BUFFER. */
1478 dump_gimple_omp_block (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1480 if (flags
& TDF_RAW
)
1481 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1482 gimple_omp_body (gs
));
1485 switch (gimple_code (gs
))
1487 case GIMPLE_OMP_MASTER
:
1488 pp_string (buffer
, "#pragma omp master");
1490 case GIMPLE_OMP_TASKGROUP
:
1491 pp_string (buffer
, "#pragma omp taskgroup");
1493 case GIMPLE_OMP_ORDERED
:
1494 pp_string (buffer
, "#pragma omp ordered");
1496 case GIMPLE_OMP_SECTION
:
1497 pp_string (buffer
, "#pragma omp section");
1502 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1504 newline_and_indent (buffer
, spc
+ 2);
1505 pp_left_brace (buffer
);
1506 pp_newline (buffer
);
1507 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1508 newline_and_indent (buffer
, spc
+ 2);
1509 pp_right_brace (buffer
);
1514 /* Dump a GIMPLE_OMP_CRITICAL tuple on the pretty_printer BUFFER. */
1517 dump_gimple_omp_critical (pretty_printer
*buffer
, gomp_critical
*gs
,
1520 if (flags
& TDF_RAW
)
1521 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1522 gimple_omp_body (gs
));
1525 pp_string (buffer
, "#pragma omp critical");
1526 if (gimple_omp_critical_name (gs
))
1528 pp_string (buffer
, " (");
1529 dump_generic_node (buffer
, gimple_omp_critical_name (gs
), spc
,
1531 pp_right_paren (buffer
);
1533 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1535 newline_and_indent (buffer
, spc
+ 2);
1536 pp_left_brace (buffer
);
1537 pp_newline (buffer
);
1538 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1539 newline_and_indent (buffer
, spc
+ 2);
1540 pp_right_brace (buffer
);
1545 /* Dump a GIMPLE_OMP_RETURN tuple on the pretty_printer BUFFER. */
1548 dump_gimple_omp_return (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1550 if (flags
& TDF_RAW
)
1552 dump_gimple_fmt (buffer
, spc
, flags
, "%G <nowait=%d", gs
,
1553 (int) gimple_omp_return_nowait_p (gs
));
1554 if (gimple_omp_return_lhs (gs
))
1555 dump_gimple_fmt (buffer
, spc
, flags
, ", lhs=%T>",
1556 gimple_omp_return_lhs (gs
));
1558 dump_gimple_fmt (buffer
, spc
, flags
, ">");
1562 pp_string (buffer
, "#pragma omp return");
1563 if (gimple_omp_return_nowait_p (gs
))
1564 pp_string (buffer
, "(nowait)");
1565 if (gimple_omp_return_lhs (gs
))
1567 pp_string (buffer
, " (set ");
1568 dump_generic_node (buffer
, gimple_omp_return_lhs (gs
),
1570 pp_character (buffer
, ')');
1575 /* Dump a GIMPLE_TRANSACTION tuple on the pretty_printer BUFFER. */
1578 dump_gimple_transaction (pretty_printer
*buffer
, gtransaction
*gs
,
1581 unsigned subcode
= gimple_transaction_subcode (gs
);
1583 if (flags
& TDF_RAW
)
1585 dump_gimple_fmt (buffer
, spc
, flags
,
1586 "%G [SUBCODE=%x,LABEL=%T] <%+BODY <%S> >",
1587 gs
, subcode
, gimple_transaction_label (gs
),
1588 gimple_transaction_body (gs
));
1592 if (subcode
& GTMA_IS_OUTER
)
1593 pp_string (buffer
, "__transaction_atomic [[outer]]");
1594 else if (subcode
& GTMA_IS_RELAXED
)
1595 pp_string (buffer
, "__transaction_relaxed");
1597 pp_string (buffer
, "__transaction_atomic");
1598 subcode
&= ~GTMA_DECLARATION_MASK
;
1600 if (subcode
|| gimple_transaction_label (gs
))
1602 pp_string (buffer
, " //");
1603 if (gimple_transaction_label (gs
))
1605 pp_string (buffer
, " LABEL=");
1606 dump_generic_node (buffer
, gimple_transaction_label (gs
),
1611 pp_string (buffer
, " SUBCODE=[ ");
1612 if (subcode
& GTMA_HAVE_ABORT
)
1614 pp_string (buffer
, "GTMA_HAVE_ABORT ");
1615 subcode
&= ~GTMA_HAVE_ABORT
;
1617 if (subcode
& GTMA_HAVE_LOAD
)
1619 pp_string (buffer
, "GTMA_HAVE_LOAD ");
1620 subcode
&= ~GTMA_HAVE_LOAD
;
1622 if (subcode
& GTMA_HAVE_STORE
)
1624 pp_string (buffer
, "GTMA_HAVE_STORE ");
1625 subcode
&= ~GTMA_HAVE_STORE
;
1627 if (subcode
& GTMA_MAY_ENTER_IRREVOCABLE
)
1629 pp_string (buffer
, "GTMA_MAY_ENTER_IRREVOCABLE ");
1630 subcode
&= ~GTMA_MAY_ENTER_IRREVOCABLE
;
1632 if (subcode
& GTMA_DOES_GO_IRREVOCABLE
)
1634 pp_string (buffer
, "GTMA_DOES_GO_IRREVOCABLE ");
1635 subcode
&= ~GTMA_DOES_GO_IRREVOCABLE
;
1637 if (subcode
& GTMA_HAS_NO_INSTRUMENTATION
)
1639 pp_string (buffer
, "GTMA_HAS_NO_INSTRUMENTATION ");
1640 subcode
&= ~GTMA_HAS_NO_INSTRUMENTATION
;
1643 pp_printf (buffer
, "0x%x ", subcode
);
1644 pp_right_bracket (buffer
);
1648 if (!gimple_seq_empty_p (gimple_transaction_body (gs
)))
1650 newline_and_indent (buffer
, spc
+ 2);
1651 pp_left_brace (buffer
);
1652 pp_newline (buffer
);
1653 dump_gimple_seq (buffer
, gimple_transaction_body (gs
),
1655 newline_and_indent (buffer
, spc
+ 2);
1656 pp_right_brace (buffer
);
1661 /* Dump a GIMPLE_ASM tuple on the pretty_printer BUFFER, SPC spaces of
1662 indent. FLAGS specifies details to show in the dump (see TDF_* in
1666 dump_gimple_asm (pretty_printer
*buffer
, gasm
*gs
, int spc
, int flags
)
1668 unsigned int i
, n
, f
, fields
;
1670 if (flags
& TDF_RAW
)
1672 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+STRING <%n%s%n>", gs
,
1673 gimple_asm_string (gs
));
1675 n
= gimple_asm_noutputs (gs
);
1678 newline_and_indent (buffer
, spc
+ 2);
1679 pp_string (buffer
, "OUTPUT: ");
1680 for (i
= 0; i
< n
; i
++)
1682 dump_generic_node (buffer
, gimple_asm_output_op (gs
, i
),
1685 pp_string (buffer
, ", ");
1689 n
= gimple_asm_ninputs (gs
);
1692 newline_and_indent (buffer
, spc
+ 2);
1693 pp_string (buffer
, "INPUT: ");
1694 for (i
= 0; i
< n
; i
++)
1696 dump_generic_node (buffer
, gimple_asm_input_op (gs
, i
),
1699 pp_string (buffer
, ", ");
1703 n
= gimple_asm_nclobbers (gs
);
1706 newline_and_indent (buffer
, spc
+ 2);
1707 pp_string (buffer
, "CLOBBER: ");
1708 for (i
= 0; i
< n
; i
++)
1710 dump_generic_node (buffer
, gimple_asm_clobber_op (gs
, i
),
1713 pp_string (buffer
, ", ");
1717 n
= gimple_asm_nlabels (gs
);
1720 newline_and_indent (buffer
, spc
+ 2);
1721 pp_string (buffer
, "LABEL: ");
1722 for (i
= 0; i
< n
; i
++)
1724 dump_generic_node (buffer
, gimple_asm_label_op (gs
, i
),
1727 pp_string (buffer
, ", ");
1731 newline_and_indent (buffer
, spc
);
1732 pp_greater (buffer
);
1736 pp_string (buffer
, "__asm__");
1737 if (gimple_asm_volatile_p (gs
))
1738 pp_string (buffer
, " __volatile__");
1739 if (gimple_asm_nlabels (gs
))
1740 pp_string (buffer
, " goto");
1741 pp_string (buffer
, "(\"");
1742 pp_string (buffer
, gimple_asm_string (gs
));
1743 pp_string (buffer
, "\"");
1745 if (gimple_asm_nlabels (gs
))
1747 else if (gimple_asm_nclobbers (gs
))
1749 else if (gimple_asm_ninputs (gs
))
1751 else if (gimple_asm_noutputs (gs
))
1756 for (f
= 0; f
< fields
; ++f
)
1758 pp_string (buffer
, " : ");
1763 n
= gimple_asm_noutputs (gs
);
1764 for (i
= 0; i
< n
; i
++)
1766 dump_generic_node (buffer
, gimple_asm_output_op (gs
, i
),
1769 pp_string (buffer
, ", ");
1774 n
= gimple_asm_ninputs (gs
);
1775 for (i
= 0; i
< n
; i
++)
1777 dump_generic_node (buffer
, gimple_asm_input_op (gs
, i
),
1780 pp_string (buffer
, ", ");
1785 n
= gimple_asm_nclobbers (gs
);
1786 for (i
= 0; i
< n
; i
++)
1788 dump_generic_node (buffer
, gimple_asm_clobber_op (gs
, i
),
1791 pp_string (buffer
, ", ");
1796 n
= gimple_asm_nlabels (gs
);
1797 for (i
= 0; i
< n
; i
++)
1799 dump_generic_node (buffer
, gimple_asm_label_op (gs
, i
),
1802 pp_string (buffer
, ", ");
1811 pp_string (buffer
, ");");
1815 /* Dump ptr_info and range_info for NODE on pretty_printer BUFFER with
1816 SPC spaces of indent. */
1819 dump_ssaname_info (pretty_printer
*buffer
, tree node
, int spc
)
1821 if (TREE_CODE (node
) != SSA_NAME
)
1824 if (POINTER_TYPE_P (TREE_TYPE (node
))
1825 && SSA_NAME_PTR_INFO (node
))
1827 unsigned int align
, misalign
;
1828 struct ptr_info_def
*pi
= SSA_NAME_PTR_INFO (node
);
1829 pp_string (buffer
, "# PT = ");
1830 pp_points_to_solution (buffer
, &pi
->pt
);
1831 newline_and_indent (buffer
, spc
);
1832 if (get_ptr_info_alignment (pi
, &align
, &misalign
))
1834 pp_printf (buffer
, "# ALIGN = %u, MISALIGN = %u", align
, misalign
);
1835 newline_and_indent (buffer
, spc
);
1839 if (!POINTER_TYPE_P (TREE_TYPE (node
))
1840 && SSA_NAME_RANGE_INFO (node
))
1842 wide_int min
, max
, nonzero_bits
;
1843 value_range_type range_type
= get_range_info (node
, &min
, &max
);
1845 if (range_type
== VR_VARYING
)
1846 pp_printf (buffer
, "# RANGE VR_VARYING");
1847 else if (range_type
== VR_RANGE
|| range_type
== VR_ANTI_RANGE
)
1849 pp_printf (buffer
, "# RANGE ");
1850 pp_printf (buffer
, "%s[", range_type
== VR_RANGE
? "" : "~");
1851 pp_wide_int (buffer
, min
, TYPE_SIGN (TREE_TYPE (node
)));
1852 pp_printf (buffer
, ", ");
1853 pp_wide_int (buffer
, max
, TYPE_SIGN (TREE_TYPE (node
)));
1854 pp_printf (buffer
, "]");
1856 nonzero_bits
= get_nonzero_bits (node
);
1857 if (nonzero_bits
!= -1)
1859 pp_string (buffer
, " NONZERO ");
1860 pp_wide_int (buffer
, nonzero_bits
, UNSIGNED
);
1862 newline_and_indent (buffer
, spc
);
1867 /* Dump a PHI node PHI. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1.
1868 The caller is responsible for calling pp_flush on BUFFER to finalize
1869 pretty printer. If COMMENT is true, print this after #. */
1872 dump_gimple_phi (pretty_printer
*buffer
, gphi
*phi
, int spc
, bool comment
,
1876 tree lhs
= gimple_phi_result (phi
);
1878 if (flags
& TDF_ALIAS
)
1879 dump_ssaname_info (buffer
, lhs
, spc
);
1882 pp_string (buffer
, "# ");
1884 if (flags
& TDF_RAW
)
1885 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, ", phi
,
1886 gimple_phi_result (phi
));
1889 dump_generic_node (buffer
, lhs
, spc
, flags
, false);
1890 pp_string (buffer
, " = PHI <");
1892 for (i
= 0; i
< gimple_phi_num_args (phi
); i
++)
1894 if ((flags
& TDF_LINENO
) && gimple_phi_arg_has_location (phi
, i
))
1895 dump_location (buffer
, gimple_phi_arg_location (phi
, i
));
1896 dump_generic_node (buffer
, gimple_phi_arg_def (phi
, i
), spc
, flags
,
1898 pp_left_paren (buffer
);
1899 pp_decimal_int (buffer
, gimple_phi_arg_edge (phi
, i
)->src
->index
);
1900 pp_right_paren (buffer
);
1901 if (i
< gimple_phi_num_args (phi
) - 1)
1902 pp_string (buffer
, ", ");
1904 pp_greater (buffer
);
1908 /* Dump a GIMPLE_OMP_PARALLEL tuple on the pretty_printer BUFFER, SPC spaces
1909 of indent. FLAGS specifies details to show in the dump (see TDF_* in
1913 dump_gimple_omp_parallel (pretty_printer
*buffer
, gomp_parallel
*gs
,
1916 if (flags
& TDF_RAW
)
1918 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1919 gimple_omp_body (gs
));
1920 dump_omp_clauses (buffer
, gimple_omp_parallel_clauses (gs
), spc
, flags
);
1921 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T%n>",
1922 gimple_omp_parallel_child_fn (gs
),
1923 gimple_omp_parallel_data_arg (gs
));
1928 pp_string (buffer
, "#pragma omp parallel");
1929 dump_omp_clauses (buffer
, gimple_omp_parallel_clauses (gs
), spc
, flags
);
1930 if (gimple_omp_parallel_child_fn (gs
))
1932 pp_string (buffer
, " [child fn: ");
1933 dump_generic_node (buffer
, gimple_omp_parallel_child_fn (gs
),
1935 pp_string (buffer
, " (");
1936 if (gimple_omp_parallel_data_arg (gs
))
1937 dump_generic_node (buffer
, gimple_omp_parallel_data_arg (gs
),
1940 pp_string (buffer
, "???");
1941 pp_string (buffer
, ")]");
1943 body
= gimple_omp_body (gs
);
1944 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
1946 newline_and_indent (buffer
, spc
+ 2);
1947 pp_left_brace (buffer
);
1948 pp_newline (buffer
);
1949 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
1950 newline_and_indent (buffer
, spc
+ 2);
1951 pp_right_brace (buffer
);
1955 pp_newline (buffer
);
1956 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
1962 /* Dump a GIMPLE_OMP_TASK tuple on the pretty_printer BUFFER, SPC spaces
1963 of indent. FLAGS specifies details to show in the dump (see TDF_* in
1967 dump_gimple_omp_task (pretty_printer
*buffer
, gomp_task
*gs
, int spc
,
1970 if (flags
& TDF_RAW
)
1972 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1973 gimple_omp_body (gs
));
1974 dump_omp_clauses (buffer
, gimple_omp_task_clauses (gs
), spc
, flags
);
1975 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T, %T, %T, %T%n>",
1976 gimple_omp_task_child_fn (gs
),
1977 gimple_omp_task_data_arg (gs
),
1978 gimple_omp_task_copy_fn (gs
),
1979 gimple_omp_task_arg_size (gs
),
1980 gimple_omp_task_arg_size (gs
));
1985 pp_string (buffer
, "#pragma omp task");
1986 dump_omp_clauses (buffer
, gimple_omp_task_clauses (gs
), spc
, flags
);
1987 if (gimple_omp_task_child_fn (gs
))
1989 pp_string (buffer
, " [child fn: ");
1990 dump_generic_node (buffer
, gimple_omp_task_child_fn (gs
),
1992 pp_string (buffer
, " (");
1993 if (gimple_omp_task_data_arg (gs
))
1994 dump_generic_node (buffer
, gimple_omp_task_data_arg (gs
),
1997 pp_string (buffer
, "???");
1998 pp_string (buffer
, ")]");
2000 body
= gimple_omp_body (gs
);
2001 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
2003 newline_and_indent (buffer
, spc
+ 2);
2004 pp_left_brace (buffer
);
2005 pp_newline (buffer
);
2006 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
2007 newline_and_indent (buffer
, spc
+ 2);
2008 pp_right_brace (buffer
);
2012 pp_newline (buffer
);
2013 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
2019 /* Dump a GIMPLE_OMP_ATOMIC_LOAD tuple on the pretty_printer BUFFER, SPC
2020 spaces of indent. FLAGS specifies details to show in the dump (see TDF_*
2024 dump_gimple_omp_atomic_load (pretty_printer
*buffer
, gomp_atomic_load
*gs
,
2027 if (flags
& TDF_RAW
)
2029 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T>", gs
,
2030 gimple_omp_atomic_load_lhs (gs
),
2031 gimple_omp_atomic_load_rhs (gs
));
2035 pp_string (buffer
, "#pragma omp atomic_load");
2036 if (gimple_omp_atomic_seq_cst_p (gs
))
2037 pp_string (buffer
, " seq_cst");
2038 if (gimple_omp_atomic_need_value_p (gs
))
2039 pp_string (buffer
, " [needed]");
2040 newline_and_indent (buffer
, spc
+ 2);
2041 dump_generic_node (buffer
, gimple_omp_atomic_load_lhs (gs
),
2047 dump_generic_node (buffer
, gimple_omp_atomic_load_rhs (gs
),
2052 /* Dump a GIMPLE_OMP_ATOMIC_STORE tuple on the pretty_printer BUFFER, SPC
2053 spaces of indent. FLAGS specifies details to show in the dump (see TDF_*
2057 dump_gimple_omp_atomic_store (pretty_printer
*buffer
,
2058 gomp_atomic_store
*gs
, int spc
, int flags
)
2060 if (flags
& TDF_RAW
)
2062 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
,
2063 gimple_omp_atomic_store_val (gs
));
2067 pp_string (buffer
, "#pragma omp atomic_store ");
2068 if (gimple_omp_atomic_seq_cst_p (gs
))
2069 pp_string (buffer
, "seq_cst ");
2070 if (gimple_omp_atomic_need_value_p (gs
))
2071 pp_string (buffer
, "[needed] ");
2072 pp_left_paren (buffer
);
2073 dump_generic_node (buffer
, gimple_omp_atomic_store_val (gs
),
2075 pp_right_paren (buffer
);
2080 /* Dump all the memory operands for statement GS. BUFFER, SPC and
2081 FLAGS are as in pp_gimple_stmt_1. */
2084 dump_gimple_mem_ops (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
2086 tree vdef
= gimple_vdef (gs
);
2087 tree vuse
= gimple_vuse (gs
);
2089 if (vdef
!= NULL_TREE
)
2091 pp_string (buffer
, "# ");
2092 dump_generic_node (buffer
, vdef
, spc
+ 2, flags
, false);
2093 pp_string (buffer
, " = VDEF <");
2094 dump_generic_node (buffer
, vuse
, spc
+ 2, flags
, false);
2095 pp_greater (buffer
);
2096 newline_and_indent (buffer
, spc
);
2098 else if (vuse
!= NULL_TREE
)
2100 pp_string (buffer
, "# VUSE <");
2101 dump_generic_node (buffer
, vuse
, spc
+ 2, flags
, false);
2102 pp_greater (buffer
);
2103 newline_and_indent (buffer
, spc
);
2108 /* Print the gimple statement GS on the pretty printer BUFFER, SPC
2109 spaces of indent. FLAGS specifies details to show in the dump (see
2110 TDF_* in dumpfile.h). The caller is responsible for calling
2111 pp_flush on BUFFER to finalize the pretty printer. */
2114 pp_gimple_stmt_1 (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
2119 if (flags
& TDF_STMTADDR
)
2120 pp_printf (buffer
, "<&%p> ", (void *) gs
);
2122 if ((flags
& TDF_LINENO
) && gimple_has_location (gs
))
2123 dump_location (buffer
, gimple_location (gs
));
2127 int lp_nr
= lookup_stmt_eh_lp (gs
);
2129 pp_printf (buffer
, "[LP %d] ", lp_nr
);
2131 pp_printf (buffer
, "[MNT %d] ", -lp_nr
);
2134 if ((flags
& (TDF_VOPS
|TDF_MEMSYMS
))
2135 && gimple_has_mem_ops (gs
))
2136 dump_gimple_mem_ops (buffer
, gs
, spc
, flags
);
2138 if (gimple_has_lhs (gs
)
2139 && (flags
& TDF_ALIAS
))
2140 dump_ssaname_info (buffer
, gimple_get_lhs (gs
), spc
);
2142 switch (gimple_code (gs
))
2145 dump_gimple_asm (buffer
, as_a
<gasm
*> (gs
), spc
, flags
);
2149 dump_gimple_assign (buffer
, as_a
<gassign
*> (gs
), spc
, flags
);
2153 dump_gimple_bind (buffer
, as_a
<gbind
*> (gs
), spc
, flags
);
2157 dump_gimple_call (buffer
, as_a
<gcall
*> (gs
), spc
, flags
);
2161 dump_gimple_cond (buffer
, as_a
<gcond
*> (gs
), spc
, flags
);
2165 dump_gimple_label (buffer
, as_a
<glabel
*> (gs
), spc
, flags
);
2169 dump_gimple_goto (buffer
, as_a
<ggoto
*> (gs
), spc
, flags
);
2173 pp_string (buffer
, "GIMPLE_NOP");
2177 dump_gimple_return (buffer
, as_a
<greturn
*> (gs
), spc
, flags
);
2181 dump_gimple_switch (buffer
, as_a
<gswitch
*> (gs
), spc
, flags
);
2185 dump_gimple_try (buffer
, as_a
<gtry
*> (gs
), spc
, flags
);
2189 dump_gimple_phi (buffer
, as_a
<gphi
*> (gs
), spc
, false, flags
);
2192 case GIMPLE_OMP_PARALLEL
:
2193 dump_gimple_omp_parallel (buffer
, as_a
<gomp_parallel
*> (gs
), spc
,
2197 case GIMPLE_OMP_TASK
:
2198 dump_gimple_omp_task (buffer
, as_a
<gomp_task
*> (gs
), spc
, flags
);
2201 case GIMPLE_OMP_ATOMIC_LOAD
:
2202 dump_gimple_omp_atomic_load (buffer
, as_a
<gomp_atomic_load
*> (gs
),
2206 case GIMPLE_OMP_ATOMIC_STORE
:
2207 dump_gimple_omp_atomic_store (buffer
,
2208 as_a
<gomp_atomic_store
*> (gs
),
2212 case GIMPLE_OMP_FOR
:
2213 dump_gimple_omp_for (buffer
, as_a
<gomp_for
*> (gs
), spc
, flags
);
2216 case GIMPLE_OMP_CONTINUE
:
2217 dump_gimple_omp_continue (buffer
, as_a
<gomp_continue
*> (gs
), spc
,
2221 case GIMPLE_OMP_SINGLE
:
2222 dump_gimple_omp_single (buffer
, as_a
<gomp_single
*> (gs
), spc
,
2226 case GIMPLE_OMP_TARGET
:
2227 dump_gimple_omp_target (buffer
, as_a
<gomp_target
*> (gs
), spc
,
2231 case GIMPLE_OMP_TEAMS
:
2232 dump_gimple_omp_teams (buffer
, as_a
<gomp_teams
*> (gs
), spc
,
2236 case GIMPLE_OMP_RETURN
:
2237 dump_gimple_omp_return (buffer
, gs
, spc
, flags
);
2240 case GIMPLE_OMP_SECTIONS
:
2241 dump_gimple_omp_sections (buffer
, as_a
<gomp_sections
*> (gs
),
2245 case GIMPLE_OMP_SECTIONS_SWITCH
:
2246 pp_string (buffer
, "GIMPLE_SECTIONS_SWITCH");
2249 case GIMPLE_OMP_MASTER
:
2250 case GIMPLE_OMP_TASKGROUP
:
2251 case GIMPLE_OMP_ORDERED
:
2252 case GIMPLE_OMP_SECTION
:
2253 dump_gimple_omp_block (buffer
, gs
, spc
, flags
);
2256 case GIMPLE_OMP_CRITICAL
:
2257 dump_gimple_omp_critical (buffer
, as_a
<gomp_critical
*> (gs
), spc
,
2262 dump_gimple_catch (buffer
, as_a
<gcatch
*> (gs
), spc
, flags
);
2265 case GIMPLE_EH_FILTER
:
2266 dump_gimple_eh_filter (buffer
, as_a
<geh_filter
*> (gs
), spc
, flags
);
2269 case GIMPLE_EH_MUST_NOT_THROW
:
2270 dump_gimple_eh_must_not_throw (buffer
,
2271 as_a
<geh_mnt
*> (gs
),
2275 case GIMPLE_EH_ELSE
:
2276 dump_gimple_eh_else (buffer
, as_a
<geh_else
*> (gs
), spc
, flags
);
2280 dump_gimple_resx (buffer
, as_a
<gresx
*> (gs
), spc
, flags
);
2283 case GIMPLE_EH_DISPATCH
:
2284 dump_gimple_eh_dispatch (buffer
, as_a
<geh_dispatch
*> (gs
), spc
,
2289 dump_gimple_debug (buffer
, as_a
<gdebug
*> (gs
), spc
, flags
);
2292 case GIMPLE_PREDICT
:
2293 pp_string (buffer
, "// predicted ");
2294 if (gimple_predict_outcome (gs
))
2295 pp_string (buffer
, "likely by ");
2297 pp_string (buffer
, "unlikely by ");
2298 pp_string (buffer
, predictor_name (gimple_predict_predictor (gs
)));
2299 pp_string (buffer
, " predictor.");
2302 case GIMPLE_TRANSACTION
:
2303 dump_gimple_transaction (buffer
, as_a
<gtransaction
*> (gs
), spc
,
2313 /* Dumps header of basic block BB to OUTF indented by INDENT
2314 spaces and details described by flags. */
2317 dump_gimple_bb_header (FILE *outf
, basic_block bb
, int indent
, int flags
)
2319 if (flags
& TDF_BLOCKS
)
2321 if (flags
& TDF_LINENO
)
2323 gimple_stmt_iterator gsi
;
2325 if (flags
& TDF_COMMENT
)
2326 fputs (";; ", outf
);
2328 for (gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
); gsi_next (&gsi
))
2329 if (!is_gimple_debug (gsi_stmt (gsi
))
2330 && get_lineno (gsi_stmt (gsi
)) != UNKNOWN_LOCATION
)
2332 fprintf (outf
, "%*sstarting at line %d",
2333 indent
, "", get_lineno (gsi_stmt (gsi
)));
2336 if (bb
->discriminator
)
2337 fprintf (outf
, ", discriminator %i", bb
->discriminator
);
2343 gimple stmt
= first_stmt (bb
);
2344 if (!stmt
|| gimple_code (stmt
) != GIMPLE_LABEL
)
2345 fprintf (outf
, "%*s<bb %d>:\n", indent
, "", bb
->index
);
2350 /* Dumps end of basic block BB to buffer BUFFER indented by INDENT
2354 dump_gimple_bb_footer (FILE *outf ATTRIBUTE_UNUSED
,
2355 basic_block bb ATTRIBUTE_UNUSED
,
2356 int indent ATTRIBUTE_UNUSED
,
2357 int flags ATTRIBUTE_UNUSED
)
2359 /* There is currently no GIMPLE-specific basic block info to dump. */
2364 /* Dump PHI nodes of basic block BB to BUFFER with details described
2365 by FLAGS and indented by INDENT spaces. */
2368 dump_phi_nodes (pretty_printer
*buffer
, basic_block bb
, int indent
, int flags
)
2372 for (i
= gsi_start_phis (bb
); !gsi_end_p (i
); gsi_next (&i
))
2374 gphi
*phi
= i
.phi ();
2375 if (!virtual_operand_p (gimple_phi_result (phi
)) || (flags
& TDF_VOPS
))
2378 dump_gimple_phi (buffer
, phi
, indent
, true, flags
);
2379 pp_newline (buffer
);
2385 /* Dump jump to basic block BB that is represented implicitly in the cfg
2389 pp_cfg_jump (pretty_printer
*buffer
, basic_block bb
)
2393 stmt
= first_stmt (bb
);
2395 pp_string (buffer
, "goto <bb ");
2396 pp_decimal_int (buffer
, bb
->index
);
2397 pp_greater (buffer
);
2398 if (stmt
&& gimple_code (stmt
) == GIMPLE_LABEL
)
2400 pp_string (buffer
, " (");
2401 dump_generic_node (buffer
,
2402 gimple_label_label (as_a
<glabel
*> (stmt
)),
2404 pp_right_paren (buffer
);
2405 pp_semicolon (buffer
);
2408 pp_semicolon (buffer
);
2412 /* Dump edges represented implicitly in basic block BB to BUFFER, indented
2413 by INDENT spaces, with details given by FLAGS. */
2416 dump_implicit_edges (pretty_printer
*buffer
, basic_block bb
, int indent
,
2422 stmt
= last_stmt (bb
);
2424 if (stmt
&& gimple_code (stmt
) == GIMPLE_COND
)
2426 edge true_edge
, false_edge
;
2428 /* When we are emitting the code or changing CFG, it is possible that
2429 the edges are not yet created. When we are using debug_bb in such
2430 a situation, we do not want it to crash. */
2431 if (EDGE_COUNT (bb
->succs
) != 2)
2433 extract_true_false_edges_from_block (bb
, &true_edge
, &false_edge
);
2435 INDENT (indent
+ 2);
2436 pp_cfg_jump (buffer
, true_edge
->dest
);
2437 newline_and_indent (buffer
, indent
);
2438 pp_string (buffer
, "else");
2439 newline_and_indent (buffer
, indent
+ 2);
2440 pp_cfg_jump (buffer
, false_edge
->dest
);
2441 pp_newline (buffer
);
2445 /* If there is a fallthru edge, we may need to add an artificial
2446 goto to the dump. */
2447 e
= find_fallthru_edge (bb
->succs
);
2449 if (e
&& e
->dest
!= bb
->next_bb
)
2453 if ((flags
& TDF_LINENO
)
2454 && e
->goto_locus
!= UNKNOWN_LOCATION
)
2455 dump_location (buffer
, e
->goto_locus
);
2457 pp_cfg_jump (buffer
, e
->dest
);
2458 pp_newline (buffer
);
2463 /* Dumps basic block BB to buffer BUFFER with details described by FLAGS and
2464 indented by INDENT spaces. */
2467 gimple_dump_bb_buff (pretty_printer
*buffer
, basic_block bb
, int indent
,
2470 gimple_stmt_iterator gsi
;
2472 int label_indent
= indent
- 2;
2474 if (label_indent
< 0)
2477 dump_phi_nodes (buffer
, bb
, indent
, flags
);
2479 for (gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
); gsi_next (&gsi
))
2483 stmt
= gsi_stmt (gsi
);
2485 curr_indent
= gimple_code (stmt
) == GIMPLE_LABEL
? label_indent
: indent
;
2487 INDENT (curr_indent
);
2488 pp_gimple_stmt_1 (buffer
, stmt
, curr_indent
, flags
);
2489 pp_newline_and_flush (buffer
);
2490 gcc_checking_assert (DECL_STRUCT_FUNCTION (current_function_decl
));
2491 dump_histograms_for_stmt (DECL_STRUCT_FUNCTION (current_function_decl
),
2492 pp_buffer (buffer
)->stream
, stmt
);
2495 dump_implicit_edges (buffer
, bb
, indent
, flags
);
2500 /* Dumps basic block BB to FILE with details described by FLAGS and
2501 indented by INDENT spaces. */
2504 gimple_dump_bb (FILE *file
, basic_block bb
, int indent
, int flags
)
2506 dump_gimple_bb_header (file
, bb
, indent
, flags
);
2507 if (bb
->index
>= NUM_FIXED_BLOCKS
)
2509 pretty_printer buffer
;
2510 pp_needs_newline (&buffer
) = true;
2511 buffer
.buffer
->stream
= file
;
2512 gimple_dump_bb_buff (&buffer
, bb
, indent
, flags
);
2514 dump_gimple_bb_footer (file
, bb
, indent
, flags
);
2517 /* Dumps basic block BB to pretty-printer PP with default dump flags and
2518 no indentation, for use as a label of a DOT graph record-node.
2519 ??? Should just use gimple_dump_bb_buff here, except that value profiling
2520 histogram dumping doesn't know about pretty-printers. */
2523 gimple_dump_bb_for_graph (pretty_printer
*pp
, basic_block bb
)
2525 pp_printf (pp
, "<bb %d>:\n", bb
->index
);
2526 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
2528 for (gphi_iterator gsi
= gsi_start_phis (bb
); !gsi_end_p (gsi
);
2531 gphi
*phi
= gsi
.phi ();
2532 if (!virtual_operand_p (gimple_phi_result (phi
))
2533 || (dump_flags
& TDF_VOPS
))
2536 pp_write_text_to_stream (pp
);
2537 pp_string (pp
, "# ");
2538 pp_gimple_stmt_1 (pp
, phi
, 0, dump_flags
);
2540 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
2544 for (gimple_stmt_iterator gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
);
2547 gimple stmt
= gsi_stmt (gsi
);
2549 pp_write_text_to_stream (pp
);
2550 pp_gimple_stmt_1 (pp
, stmt
, 0, dump_flags
);
2552 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
2554 dump_implicit_edges (pp
, bb
, 0, dump_flags
);
2555 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);