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"
29 #include "fold-const.h"
30 #include "stringpool.h"
31 #include "diagnostic.h"
32 #include "gimple-pretty-print.h"
35 #include "hard-reg-set.h"
37 #include "basic-block.h"
38 #include "tree-ssa-alias.h"
39 #include "internal-fn.h"
41 #include "gimple-expr.h"
43 #include "gimple-iterator.h"
44 #include "gimple-ssa.h"
45 #include "plugin-api.h"
49 #include "tree-ssanames.h"
50 #include "dumpfile.h" /* for dump_flags */
51 #include "value-prof.h"
52 #include "trans-mem.h"
54 #define INDENT(SPACE) \
55 do { int i; for (i = 0; i < SPACE; i++) pp_space (buffer); } while (0)
57 #define GIMPLE_NIY do_niy (buffer,gs)
59 /* Try to print on BUFFER a default message for the unrecognized
60 gimple statement GS. */
63 do_niy (pretty_printer
*buffer
, gimple gs
)
65 pp_printf (buffer
, "<<< Unknown GIMPLE statement: %s >>>\n",
66 gimple_code_name
[(int) gimple_code (gs
)]);
70 /* Emit a newline and SPC indentation spaces to BUFFER. */
73 newline_and_indent (pretty_printer
*buffer
, int spc
)
80 /* Print the GIMPLE statement GS on stderr. */
83 debug_gimple_stmt (gimple gs
)
85 print_gimple_stmt (stderr
, gs
, 0, TDF_VOPS
|TDF_MEMSYMS
);
89 /* Print GIMPLE statement G to FILE using SPC indentation spaces and
90 FLAGS as in pp_gimple_stmt_1. */
93 print_gimple_stmt (FILE *file
, gimple g
, int spc
, int flags
)
95 pretty_printer buffer
;
96 pp_needs_newline (&buffer
) = true;
97 buffer
.buffer
->stream
= file
;
98 pp_gimple_stmt_1 (&buffer
, g
, spc
, flags
);
99 pp_newline_and_flush (&buffer
);
103 debug (gimple_statement_base
&ref
)
105 print_gimple_stmt (stderr
, &ref
, 0, 0);
109 debug (gimple_statement_base
*ptr
)
114 fprintf (stderr
, "<nil>\n");
118 /* Print GIMPLE statement G to FILE using SPC indentation spaces and
119 FLAGS as in pp_gimple_stmt_1. Print only the right-hand side
123 print_gimple_expr (FILE *file
, gimple g
, int spc
, int flags
)
125 flags
|= TDF_RHS_ONLY
;
126 pretty_printer buffer
;
127 pp_needs_newline (&buffer
) = true;
128 buffer
.buffer
->stream
= file
;
129 pp_gimple_stmt_1 (&buffer
, g
, spc
, flags
);
134 /* Print the GIMPLE sequence SEQ on BUFFER using SPC indentation
135 spaces and FLAGS as in pp_gimple_stmt_1.
136 The caller is responsible for calling pp_flush on BUFFER to finalize
137 the pretty printer. */
140 dump_gimple_seq (pretty_printer
*buffer
, gimple_seq seq
, int spc
, int flags
)
142 gimple_stmt_iterator i
;
144 for (i
= gsi_start (seq
); !gsi_end_p (i
); gsi_next (&i
))
146 gimple gs
= gsi_stmt (i
);
148 pp_gimple_stmt_1 (buffer
, gs
, spc
, flags
);
149 if (!gsi_one_before_end_p (i
))
155 /* Print GIMPLE sequence SEQ to FILE using SPC indentation spaces and
156 FLAGS as in pp_gimple_stmt_1. */
159 print_gimple_seq (FILE *file
, gimple_seq seq
, int spc
, int flags
)
161 pretty_printer buffer
;
162 pp_needs_newline (&buffer
) = true;
163 buffer
.buffer
->stream
= file
;
164 dump_gimple_seq (&buffer
, seq
, spc
, flags
);
165 pp_newline_and_flush (&buffer
);
169 /* Print the GIMPLE sequence SEQ on stderr. */
172 debug_gimple_seq (gimple_seq seq
)
174 print_gimple_seq (stderr
, seq
, 0, TDF_VOPS
|TDF_MEMSYMS
);
178 /* A simple helper to pretty-print some of the gimple tuples in the printf
179 style. The format modifiers are preceded by '%' and are:
180 'G' - outputs a string corresponding to the code of the given gimple,
181 'S' - outputs a gimple_seq with indent of spc + 2,
182 'T' - outputs the tree t,
183 'd' - outputs an int as a decimal,
184 's' - outputs a string,
185 'n' - outputs a newline,
186 'x' - outputs an int as hexadecimal,
187 '+' - increases indent by 2 then outputs a newline,
188 '-' - decreases indent by 2 then outputs a newline. */
191 dump_gimple_fmt (pretty_printer
*buffer
, int spc
, int flags
,
192 const char *fmt
, ...)
198 va_start (args
, fmt
);
199 for (c
= fmt
; *c
; c
++)
209 g
= va_arg (args
, gimple
);
210 tmp
= gimple_code_name
[gimple_code (g
)];
211 pp_string (buffer
, tmp
);
215 seq
= va_arg (args
, gimple_seq
);
217 dump_gimple_seq (buffer
, seq
, spc
+ 2, flags
);
218 newline_and_indent (buffer
, spc
);
222 t
= va_arg (args
, tree
);
224 pp_string (buffer
, "NULL");
226 dump_generic_node (buffer
, t
, spc
, flags
, false);
230 pp_decimal_int (buffer
, va_arg (args
, int));
234 pp_string (buffer
, va_arg (args
, char *));
238 newline_and_indent (buffer
, spc
);
242 pp_scalar (buffer
, "%x", va_arg (args
, int));
247 newline_and_indent (buffer
, spc
);
252 newline_and_indent (buffer
, spc
);
260 pp_character (buffer
, *c
);
266 /* Helper for dump_gimple_assign. Print the unary RHS of the
267 assignment GS. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. */
270 dump_unary_rhs (pretty_printer
*buffer
, gassign
*gs
, int spc
, int flags
)
272 enum tree_code rhs_code
= gimple_assign_rhs_code (gs
);
273 tree lhs
= gimple_assign_lhs (gs
);
274 tree rhs
= gimple_assign_rhs1 (gs
);
278 case VIEW_CONVERT_EXPR
:
280 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
283 case FIXED_CONVERT_EXPR
:
284 case ADDR_SPACE_CONVERT_EXPR
:
288 pp_left_paren (buffer
);
289 dump_generic_node (buffer
, TREE_TYPE (lhs
), spc
, flags
, false);
290 pp_string (buffer
, ") ");
291 if (op_prio (rhs
) < op_code_prio (rhs_code
))
293 pp_left_paren (buffer
);
294 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
295 pp_right_paren (buffer
);
298 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
302 pp_string (buffer
, "((");
303 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
304 pp_string (buffer
, "))");
308 pp_string (buffer
, "ABS_EXPR <");
309 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
314 if (TREE_CODE_CLASS (rhs_code
) == tcc_declaration
315 || TREE_CODE_CLASS (rhs_code
) == tcc_constant
316 || TREE_CODE_CLASS (rhs_code
) == tcc_reference
317 || rhs_code
== SSA_NAME
318 || rhs_code
== ADDR_EXPR
319 || rhs_code
== CONSTRUCTOR
)
321 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
324 else if (rhs_code
== BIT_NOT_EXPR
)
325 pp_complement (buffer
);
326 else if (rhs_code
== TRUTH_NOT_EXPR
)
327 pp_exclamation (buffer
);
328 else if (rhs_code
== NEGATE_EXPR
)
332 pp_left_bracket (buffer
);
333 pp_string (buffer
, get_tree_code_name (rhs_code
));
334 pp_string (buffer
, "] ");
337 if (op_prio (rhs
) < op_code_prio (rhs_code
))
339 pp_left_paren (buffer
);
340 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
341 pp_right_paren (buffer
);
344 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
350 /* Helper for dump_gimple_assign. Print the binary RHS of the
351 assignment GS. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. */
354 dump_binary_rhs (pretty_printer
*buffer
, gassign
*gs
, int spc
, int flags
)
357 enum tree_code code
= gimple_assign_rhs_code (gs
);
363 case VEC_WIDEN_MULT_HI_EXPR
:
364 case VEC_WIDEN_MULT_LO_EXPR
:
365 case VEC_WIDEN_MULT_EVEN_EXPR
:
366 case VEC_WIDEN_MULT_ODD_EXPR
:
367 case VEC_PACK_TRUNC_EXPR
:
368 case VEC_PACK_SAT_EXPR
:
369 case VEC_PACK_FIX_TRUNC_EXPR
:
370 case VEC_WIDEN_LSHIFT_HI_EXPR
:
371 case VEC_WIDEN_LSHIFT_LO_EXPR
:
372 for (p
= get_tree_code_name (code
); *p
; p
++)
373 pp_character (buffer
, TOUPPER (*p
));
374 pp_string (buffer
, " <");
375 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
376 pp_string (buffer
, ", ");
377 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
382 if (op_prio (gimple_assign_rhs1 (gs
)) <= op_code_prio (code
))
384 pp_left_paren (buffer
);
385 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
,
387 pp_right_paren (buffer
);
390 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
392 pp_string (buffer
, op_symbol_code (gimple_assign_rhs_code (gs
)));
394 if (op_prio (gimple_assign_rhs2 (gs
)) <= op_code_prio (code
))
396 pp_left_paren (buffer
);
397 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
,
399 pp_right_paren (buffer
);
402 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
406 /* Helper for dump_gimple_assign. Print the ternary RHS of the
407 assignment GS. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. */
410 dump_ternary_rhs (pretty_printer
*buffer
, gassign
*gs
, int spc
, int flags
)
413 enum tree_code code
= gimple_assign_rhs_code (gs
);
416 case WIDEN_MULT_PLUS_EXPR
:
417 case WIDEN_MULT_MINUS_EXPR
:
418 for (p
= get_tree_code_name (code
); *p
; p
++)
419 pp_character (buffer
, TOUPPER (*p
));
420 pp_string (buffer
, " <");
421 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
422 pp_string (buffer
, ", ");
423 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
424 pp_string (buffer
, ", ");
425 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
430 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
431 pp_string (buffer
, " * ");
432 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
433 pp_string (buffer
, " + ");
434 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
438 pp_string (buffer
, "DOT_PROD_EXPR <");
439 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
440 pp_string (buffer
, ", ");
441 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
442 pp_string (buffer
, ", ");
443 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
448 pp_string (buffer
, "SAD_EXPR <");
449 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
450 pp_string (buffer
, ", ");
451 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
452 pp_string (buffer
, ", ");
453 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
458 pp_string (buffer
, "VEC_PERM_EXPR <");
459 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
460 pp_string (buffer
, ", ");
461 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
462 pp_string (buffer
, ", ");
463 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
467 case REALIGN_LOAD_EXPR
:
468 pp_string (buffer
, "REALIGN_LOAD <");
469 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
470 pp_string (buffer
, ", ");
471 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
472 pp_string (buffer
, ", ");
473 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
478 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
479 pp_string (buffer
, " ? ");
480 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
481 pp_string (buffer
, " : ");
482 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
486 pp_string (buffer
, "VEC_COND_EXPR <");
487 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
488 pp_string (buffer
, ", ");
489 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
490 pp_string (buffer
, ", ");
491 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
501 /* Dump the gimple assignment GS. BUFFER, SPC and FLAGS are as in
505 dump_gimple_assign (pretty_printer
*buffer
, gassign
*gs
, int spc
, int flags
)
512 switch (gimple_num_ops (gs
))
515 arg3
= gimple_assign_rhs3 (gs
);
517 arg2
= gimple_assign_rhs2 (gs
);
519 arg1
= gimple_assign_rhs1 (gs
);
525 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%s, %T, %T, %T, %T>", gs
,
526 get_tree_code_name (gimple_assign_rhs_code (gs
)),
527 gimple_assign_lhs (gs
), arg1
, arg2
, arg3
);
531 if (!(flags
& TDF_RHS_ONLY
))
533 dump_generic_node (buffer
, gimple_assign_lhs (gs
), spc
, flags
, false);
537 if (gimple_assign_nontemporal_move_p (gs
))
538 pp_string (buffer
, "{nt}");
540 if (gimple_has_volatile_ops (gs
))
541 pp_string (buffer
, "{v}");
546 if (gimple_num_ops (gs
) == 2)
547 dump_unary_rhs (buffer
, gs
, spc
, flags
);
548 else if (gimple_num_ops (gs
) == 3)
549 dump_binary_rhs (buffer
, gs
, spc
, flags
);
550 else if (gimple_num_ops (gs
) == 4)
551 dump_ternary_rhs (buffer
, gs
, spc
, flags
);
554 if (!(flags
& TDF_RHS_ONLY
))
555 pp_semicolon (buffer
);
560 /* Dump the return statement GS. BUFFER, SPC and FLAGS are as in
564 dump_gimple_return (pretty_printer
*buffer
, greturn
*gs
, int spc
, int flags
)
568 t
= gimple_return_retval (gs
);
569 t2
= gimple_return_retbnd (gs
);
571 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T %T>", gs
, t
, t2
);
574 pp_string (buffer
, "return");
578 dump_generic_node (buffer
, t
, spc
, flags
, false);
582 pp_string (buffer
, ", ");
583 dump_generic_node (buffer
, t2
, spc
, flags
, false);
585 pp_semicolon (buffer
);
590 /* Dump the call arguments for a gimple call. BUFFER, FLAGS are as in
594 dump_gimple_call_args (pretty_printer
*buffer
, gcall
*gs
, int flags
)
598 for (i
= 0; i
< gimple_call_num_args (gs
); i
++)
600 dump_generic_node (buffer
, gimple_call_arg (gs
, i
), 0, flags
, false);
601 if (i
< gimple_call_num_args (gs
) - 1)
602 pp_string (buffer
, ", ");
605 if (gimple_call_va_arg_pack_p (gs
))
607 if (gimple_call_num_args (gs
) > 0)
613 pp_string (buffer
, "__builtin_va_arg_pack ()");
617 /* Dump the points-to solution *PT to BUFFER. */
620 pp_points_to_solution (pretty_printer
*buffer
, struct pt_solution
*pt
)
624 pp_string (buffer
, "anything ");
628 pp_string (buffer
, "nonlocal ");
630 pp_string (buffer
, "escaped ");
632 pp_string (buffer
, "unit-escaped ");
634 pp_string (buffer
, "null ");
636 && !bitmap_empty_p (pt
->vars
))
640 pp_string (buffer
, "{ ");
641 EXECUTE_IF_SET_IN_BITMAP (pt
->vars
, 0, i
, bi
)
643 pp_string (buffer
, "D.");
644 pp_decimal_int (buffer
, i
);
647 pp_right_brace (buffer
);
648 if (pt
->vars_contains_nonlocal
649 && pt
->vars_contains_escaped_heap
)
650 pp_string (buffer
, " (nonlocal, escaped heap)");
651 else if (pt
->vars_contains_nonlocal
652 && pt
->vars_contains_escaped
)
653 pp_string (buffer
, " (nonlocal, escaped)");
654 else if (pt
->vars_contains_nonlocal
)
655 pp_string (buffer
, " (nonlocal)");
656 else if (pt
->vars_contains_escaped_heap
)
657 pp_string (buffer
, " (escaped heap)");
658 else if (pt
->vars_contains_escaped
)
659 pp_string (buffer
, " (escaped)");
663 /* Dump the call statement GS. BUFFER, SPC and FLAGS are as in
667 dump_gimple_call (pretty_printer
*buffer
, gcall
*gs
, int spc
, int flags
)
669 tree lhs
= gimple_call_lhs (gs
);
670 tree fn
= gimple_call_fn (gs
);
672 if (flags
& TDF_ALIAS
)
674 struct pt_solution
*pt
;
675 pt
= gimple_call_use_set (gs
);
676 if (!pt_solution_empty_p (pt
))
678 pp_string (buffer
, "# USE = ");
679 pp_points_to_solution (buffer
, pt
);
680 newline_and_indent (buffer
, spc
);
682 pt
= gimple_call_clobber_set (gs
);
683 if (!pt_solution_empty_p (pt
))
685 pp_string (buffer
, "# CLB = ");
686 pp_points_to_solution (buffer
, pt
);
687 newline_and_indent (buffer
, spc
);
693 if (gimple_call_internal_p (gs
))
694 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%s, %T", gs
,
695 internal_fn_name (gimple_call_internal_fn (gs
)), lhs
);
697 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T", gs
, fn
, lhs
);
698 if (gimple_call_num_args (gs
) > 0)
700 pp_string (buffer
, ", ");
701 dump_gimple_call_args (buffer
, gs
, flags
);
707 if (lhs
&& !(flags
& TDF_RHS_ONLY
))
709 dump_generic_node (buffer
, lhs
, spc
, flags
, false);
710 pp_string (buffer
, " =");
712 if (gimple_has_volatile_ops (gs
))
713 pp_string (buffer
, "{v}");
717 if (gimple_call_internal_p (gs
))
718 pp_string (buffer
, internal_fn_name (gimple_call_internal_fn (gs
)));
720 print_call_name (buffer
, fn
, flags
);
721 pp_string (buffer
, " (");
722 dump_gimple_call_args (buffer
, gs
, flags
);
723 pp_right_paren (buffer
);
724 if (!(flags
& TDF_RHS_ONLY
))
725 pp_semicolon (buffer
);
728 if (gimple_call_chain (gs
))
730 pp_string (buffer
, " [static-chain: ");
731 dump_generic_node (buffer
, gimple_call_chain (gs
), spc
, flags
, false);
732 pp_right_bracket (buffer
);
735 if (gimple_call_return_slot_opt_p (gs
))
736 pp_string (buffer
, " [return slot optimization]");
737 if (gimple_call_tail_p (gs
))
738 pp_string (buffer
, " [tail call]");
743 /* Dump the arguments of _ITM_beginTransaction sanely. */
744 if (TREE_CODE (fn
) == ADDR_EXPR
)
745 fn
= TREE_OPERAND (fn
, 0);
746 if (TREE_CODE (fn
) == FUNCTION_DECL
&& decl_is_tm_clone (fn
))
747 pp_string (buffer
, " [tm-clone]");
748 if (TREE_CODE (fn
) == FUNCTION_DECL
749 && DECL_BUILT_IN_CLASS (fn
) == BUILT_IN_NORMAL
750 && DECL_FUNCTION_CODE (fn
) == BUILT_IN_TM_START
751 && gimple_call_num_args (gs
) > 0)
753 tree t
= gimple_call_arg (gs
, 0);
754 unsigned HOST_WIDE_INT props
;
755 gcc_assert (TREE_CODE (t
) == INTEGER_CST
);
757 pp_string (buffer
, " [ ");
759 /* Get the transaction code properties. */
760 props
= TREE_INT_CST_LOW (t
);
762 if (props
& PR_INSTRUMENTEDCODE
)
763 pp_string (buffer
, "instrumentedCode ");
764 if (props
& PR_UNINSTRUMENTEDCODE
)
765 pp_string (buffer
, "uninstrumentedCode ");
766 if (props
& PR_HASNOXMMUPDATE
)
767 pp_string (buffer
, "hasNoXMMUpdate ");
768 if (props
& PR_HASNOABORT
)
769 pp_string (buffer
, "hasNoAbort ");
770 if (props
& PR_HASNOIRREVOCABLE
)
771 pp_string (buffer
, "hasNoIrrevocable ");
772 if (props
& PR_DOESGOIRREVOCABLE
)
773 pp_string (buffer
, "doesGoIrrevocable ");
774 if (props
& PR_HASNOSIMPLEREADS
)
775 pp_string (buffer
, "hasNoSimpleReads ");
776 if (props
& PR_AWBARRIERSOMITTED
)
777 pp_string (buffer
, "awBarriersOmitted ");
778 if (props
& PR_RARBARRIERSOMITTED
)
779 pp_string (buffer
, "RaRBarriersOmitted ");
780 if (props
& PR_UNDOLOGCODE
)
781 pp_string (buffer
, "undoLogCode ");
782 if (props
& PR_PREFERUNINSTRUMENTED
)
783 pp_string (buffer
, "preferUninstrumented ");
784 if (props
& PR_EXCEPTIONBLOCK
)
785 pp_string (buffer
, "exceptionBlock ");
786 if (props
& PR_HASELSE
)
787 pp_string (buffer
, "hasElse ");
788 if (props
& PR_READONLY
)
789 pp_string (buffer
, "readOnly ");
791 pp_right_bracket (buffer
);
796 /* Dump the switch statement GS. BUFFER, SPC and FLAGS are as in
800 dump_gimple_switch (pretty_printer
*buffer
, gswitch
*gs
, int spc
,
805 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
807 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, ", gs
,
808 gimple_switch_index (gs
));
811 pp_string (buffer
, "switch (");
812 dump_generic_node (buffer
, gimple_switch_index (gs
), spc
, flags
, true);
813 pp_string (buffer
, ") <");
816 for (i
= 0; i
< gimple_switch_num_labels (gs
); i
++)
818 tree case_label
= gimple_switch_label (gs
, i
);
819 gcc_checking_assert (case_label
!= NULL_TREE
);
820 dump_generic_node (buffer
, case_label
, spc
, flags
, false);
822 dump_generic_node (buffer
, CASE_LABEL (case_label
), spc
, flags
, false);
823 if (i
< gimple_switch_num_labels (gs
) - 1)
824 pp_string (buffer
, ", ");
830 /* Dump the gimple conditional GS. BUFFER, SPC and FLAGS are as in
834 dump_gimple_cond (pretty_printer
*buffer
, gcond
*gs
, int spc
, int flags
)
837 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%s, %T, %T, %T, %T>", gs
,
838 get_tree_code_name (gimple_cond_code (gs
)),
839 gimple_cond_lhs (gs
), gimple_cond_rhs (gs
),
840 gimple_cond_true_label (gs
), gimple_cond_false_label (gs
));
843 if (!(flags
& TDF_RHS_ONLY
))
844 pp_string (buffer
, "if (");
845 dump_generic_node (buffer
, gimple_cond_lhs (gs
), spc
, flags
, false);
847 pp_string (buffer
, op_symbol_code (gimple_cond_code (gs
)));
849 dump_generic_node (buffer
, gimple_cond_rhs (gs
), spc
, flags
, false);
850 if (!(flags
& TDF_RHS_ONLY
))
852 pp_right_paren (buffer
);
854 if (gimple_cond_true_label (gs
))
856 pp_string (buffer
, " goto ");
857 dump_generic_node (buffer
, gimple_cond_true_label (gs
),
859 pp_semicolon (buffer
);
861 if (gimple_cond_false_label (gs
))
863 pp_string (buffer
, " else goto ");
864 dump_generic_node (buffer
, gimple_cond_false_label (gs
),
866 pp_semicolon (buffer
);
873 /* Dump a GIMPLE_LABEL tuple on the pretty_printer BUFFER, SPC
874 spaces of indent. FLAGS specifies details to show in the dump (see
875 TDF_* in dumpfils.h). */
878 dump_gimple_label (pretty_printer
*buffer
, glabel
*gs
, int spc
, int flags
)
880 tree label
= gimple_label_label (gs
);
882 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
, label
);
885 dump_generic_node (buffer
, label
, spc
, flags
, false);
888 if (DECL_NONLOCAL (label
))
889 pp_string (buffer
, " [non-local]");
890 if ((flags
& TDF_EH
) && EH_LANDING_PAD_NR (label
))
891 pp_printf (buffer
, " [LP %d]", EH_LANDING_PAD_NR (label
));
894 /* Dump a GIMPLE_GOTO tuple on the pretty_printer BUFFER, SPC
895 spaces of indent. FLAGS specifies details to show in the dump (see
896 TDF_* in dumpfile.h). */
899 dump_gimple_goto (pretty_printer
*buffer
, ggoto
*gs
, int spc
, int flags
)
901 tree label
= gimple_goto_dest (gs
);
903 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
, label
);
905 dump_gimple_fmt (buffer
, spc
, flags
, "goto %T;", label
);
909 /* Dump a GIMPLE_BIND tuple on the pretty_printer BUFFER, SPC
910 spaces of indent. FLAGS specifies details to show in the dump (see
911 TDF_* in dumpfile.h). */
914 dump_gimple_bind (pretty_printer
*buffer
, gbind
*gs
, int spc
, int flags
)
917 dump_gimple_fmt (buffer
, spc
, flags
, "%G <", gs
);
919 pp_left_brace (buffer
);
920 if (!(flags
& TDF_SLIM
))
924 for (var
= gimple_bind_vars (gs
); var
; var
= DECL_CHAIN (var
))
926 newline_and_indent (buffer
, 2);
927 print_declaration (buffer
, var
, spc
, flags
);
929 if (gimple_bind_vars (gs
))
933 dump_gimple_seq (buffer
, gimple_bind_body (gs
), spc
+ 2, flags
);
934 newline_and_indent (buffer
, spc
);
938 pp_right_brace (buffer
);
942 /* Dump a GIMPLE_TRY tuple on the pretty_printer BUFFER, SPC spaces of
943 indent. FLAGS specifies details to show in the dump (see TDF_* in
947 dump_gimple_try (pretty_printer
*buffer
, gtry
*gs
, int spc
, int flags
)
952 if (gimple_try_kind (gs
) == GIMPLE_TRY_CATCH
)
953 type
= "GIMPLE_TRY_CATCH";
954 else if (gimple_try_kind (gs
) == GIMPLE_TRY_FINALLY
)
955 type
= "GIMPLE_TRY_FINALLY";
957 type
= "UNKNOWN GIMPLE_TRY";
958 dump_gimple_fmt (buffer
, spc
, flags
,
959 "%G <%s,%+EVAL <%S>%nCLEANUP <%S>%->", gs
, type
,
960 gimple_try_eval (gs
), gimple_try_cleanup (gs
));
964 pp_string (buffer
, "try");
965 newline_and_indent (buffer
, spc
+ 2);
966 pp_left_brace (buffer
);
969 dump_gimple_seq (buffer
, gimple_try_eval (gs
), spc
+ 4, flags
);
970 newline_and_indent (buffer
, spc
+ 2);
971 pp_right_brace (buffer
);
973 if (gimple_try_kind (gs
) == GIMPLE_TRY_CATCH
)
975 newline_and_indent (buffer
, spc
);
976 pp_string (buffer
, "catch");
977 newline_and_indent (buffer
, spc
+ 2);
978 pp_left_brace (buffer
);
980 else if (gimple_try_kind (gs
) == GIMPLE_TRY_FINALLY
)
982 newline_and_indent (buffer
, spc
);
983 pp_string (buffer
, "finally");
984 newline_and_indent (buffer
, spc
+ 2);
985 pp_left_brace (buffer
);
988 pp_string (buffer
, " <UNKNOWN GIMPLE_TRY> {");
991 dump_gimple_seq (buffer
, gimple_try_cleanup (gs
), spc
+ 4, flags
);
992 newline_and_indent (buffer
, spc
+ 2);
993 pp_right_brace (buffer
);
998 /* Dump a GIMPLE_CATCH tuple on the pretty_printer BUFFER, SPC spaces of
999 indent. FLAGS specifies details to show in the dump (see TDF_* in
1003 dump_gimple_catch (pretty_printer
*buffer
, gcatch
*gs
, int spc
, int flags
)
1005 if (flags
& TDF_RAW
)
1006 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %+CATCH <%S>%->", gs
,
1007 gimple_catch_types (gs
), gimple_catch_handler (gs
));
1009 dump_gimple_fmt (buffer
, spc
, flags
, "catch (%T)%+{%S}",
1010 gimple_catch_types (gs
), gimple_catch_handler (gs
));
1014 /* Dump a GIMPLE_EH_FILTER tuple on the pretty_printer BUFFER, SPC spaces of
1015 indent. FLAGS specifies details to show in the dump (see TDF_* in
1019 dump_gimple_eh_filter (pretty_printer
*buffer
, geh_filter
*gs
, int spc
,
1022 if (flags
& TDF_RAW
)
1023 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %+FAILURE <%S>%->", gs
,
1024 gimple_eh_filter_types (gs
),
1025 gimple_eh_filter_failure (gs
));
1027 dump_gimple_fmt (buffer
, spc
, flags
, "<<<eh_filter (%T)>>>%+{%+%S%-}",
1028 gimple_eh_filter_types (gs
),
1029 gimple_eh_filter_failure (gs
));
1033 /* Dump a GIMPLE_EH_MUST_NOT_THROW tuple. */
1036 dump_gimple_eh_must_not_throw (pretty_printer
*buffer
,
1037 geh_mnt
*gs
, int spc
, int flags
)
1039 if (flags
& TDF_RAW
)
1040 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
,
1041 gimple_eh_must_not_throw_fndecl (gs
));
1043 dump_gimple_fmt (buffer
, spc
, flags
, "<<<eh_must_not_throw (%T)>>>",
1044 gimple_eh_must_not_throw_fndecl (gs
));
1048 /* Dump a GIMPLE_EH_ELSE tuple on the pretty_printer BUFFER, SPC spaces of
1049 indent. FLAGS specifies details to show in the dump (see TDF_* in
1053 dump_gimple_eh_else (pretty_printer
*buffer
, geh_else
*gs
, int spc
,
1056 if (flags
& TDF_RAW
)
1057 dump_gimple_fmt (buffer
, spc
, flags
,
1058 "%G <%+N_BODY <%S>%nE_BODY <%S>%->", gs
,
1059 gimple_eh_else_n_body (gs
), gimple_eh_else_e_body (gs
));
1061 dump_gimple_fmt (buffer
, spc
, flags
,
1062 "<<<if_normal_exit>>>%+{%S}%-<<<else_eh_exit>>>%+{%S}",
1063 gimple_eh_else_n_body (gs
), gimple_eh_else_e_body (gs
));
1067 /* Dump a GIMPLE_RESX tuple on the pretty_printer BUFFER, SPC spaces of
1068 indent. FLAGS specifies details to show in the dump (see TDF_* in
1072 dump_gimple_resx (pretty_printer
*buffer
, gresx
*gs
, int spc
, int flags
)
1074 if (flags
& TDF_RAW
)
1075 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%d>", gs
,
1076 gimple_resx_region (gs
));
1078 dump_gimple_fmt (buffer
, spc
, flags
, "resx %d", gimple_resx_region (gs
));
1081 /* Dump a GIMPLE_EH_DISPATCH tuple on the pretty_printer BUFFER. */
1084 dump_gimple_eh_dispatch (pretty_printer
*buffer
, geh_dispatch
*gs
, int spc
, int flags
)
1086 if (flags
& TDF_RAW
)
1087 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%d>", gs
,
1088 gimple_eh_dispatch_region (gs
));
1090 dump_gimple_fmt (buffer
, spc
, flags
, "eh_dispatch %d",
1091 gimple_eh_dispatch_region (gs
));
1094 /* Dump a GIMPLE_DEBUG tuple on the pretty_printer BUFFER, SPC spaces
1095 of indent. FLAGS specifies details to show in the dump (see TDF_*
1099 dump_gimple_debug (pretty_printer
*buffer
, gdebug
*gs
, int spc
, int flags
)
1101 switch (gs
->subcode
)
1103 case GIMPLE_DEBUG_BIND
:
1104 if (flags
& TDF_RAW
)
1105 dump_gimple_fmt (buffer
, spc
, flags
, "%G BIND <%T, %T>", gs
,
1106 gimple_debug_bind_get_var (gs
),
1107 gimple_debug_bind_get_value (gs
));
1109 dump_gimple_fmt (buffer
, spc
, flags
, "# DEBUG %T => %T",
1110 gimple_debug_bind_get_var (gs
),
1111 gimple_debug_bind_get_value (gs
));
1114 case GIMPLE_DEBUG_SOURCE_BIND
:
1115 if (flags
& TDF_RAW
)
1116 dump_gimple_fmt (buffer
, spc
, flags
, "%G SRCBIND <%T, %T>", gs
,
1117 gimple_debug_source_bind_get_var (gs
),
1118 gimple_debug_source_bind_get_value (gs
));
1120 dump_gimple_fmt (buffer
, spc
, flags
, "# DEBUG %T s=> %T",
1121 gimple_debug_source_bind_get_var (gs
),
1122 gimple_debug_source_bind_get_value (gs
));
1130 /* Dump a GIMPLE_OMP_FOR tuple on the pretty_printer BUFFER. */
1132 dump_gimple_omp_for (pretty_printer
*buffer
, gomp_for
*gs
, int spc
, int flags
)
1136 if (flags
& TDF_RAW
)
1139 switch (gimple_omp_for_kind (gs
))
1141 case GF_OMP_FOR_KIND_FOR
:
1144 case GF_OMP_FOR_KIND_DISTRIBUTE
:
1145 kind
= " distribute";
1147 case GF_OMP_FOR_KIND_CILKFOR
:
1148 kind
= " _Cilk_for";
1150 case GF_OMP_FOR_KIND_OACC_LOOP
:
1151 kind
= " oacc_loop";
1153 case GF_OMP_FOR_KIND_SIMD
:
1156 case GF_OMP_FOR_KIND_CILKSIMD
:
1162 dump_gimple_fmt (buffer
, spc
, flags
, "%G%s <%+BODY <%S>%nCLAUSES <", gs
,
1163 kind
, gimple_omp_body (gs
));
1164 dump_omp_clauses (buffer
, gimple_omp_for_clauses (gs
), spc
, flags
);
1165 dump_gimple_fmt (buffer
, spc
, flags
, " >,");
1166 for (i
= 0; i
< gimple_omp_for_collapse (gs
); i
++)
1167 dump_gimple_fmt (buffer
, spc
, flags
,
1168 "%+%T, %T, %T, %s, %T,%n",
1169 gimple_omp_for_index (gs
, i
),
1170 gimple_omp_for_initial (gs
, i
),
1171 gimple_omp_for_final (gs
, i
),
1172 get_tree_code_name (gimple_omp_for_cond (gs
, i
)),
1173 gimple_omp_for_incr (gs
, i
));
1174 dump_gimple_fmt (buffer
, spc
, flags
, "PRE_BODY <%S>%->",
1175 gimple_omp_for_pre_body (gs
));
1179 switch (gimple_omp_for_kind (gs
))
1181 case GF_OMP_FOR_KIND_FOR
:
1182 pp_string (buffer
, "#pragma omp for");
1184 case GF_OMP_FOR_KIND_DISTRIBUTE
:
1185 pp_string (buffer
, "#pragma omp distribute");
1187 case GF_OMP_FOR_KIND_CILKFOR
:
1189 case GF_OMP_FOR_KIND_OACC_LOOP
:
1190 pp_string (buffer
, "#pragma acc loop");
1192 case GF_OMP_FOR_KIND_SIMD
:
1193 pp_string (buffer
, "#pragma omp simd");
1195 case GF_OMP_FOR_KIND_CILKSIMD
:
1196 pp_string (buffer
, "#pragma simd");
1201 if (gimple_omp_for_kind (gs
) != GF_OMP_FOR_KIND_CILKFOR
)
1202 dump_omp_clauses (buffer
, gimple_omp_for_clauses (gs
), spc
, flags
);
1203 for (i
= 0; i
< gimple_omp_for_collapse (gs
); i
++)
1207 if (gimple_omp_for_kind (gs
) == GF_OMP_FOR_KIND_CILKFOR
)
1208 pp_string (buffer
, "_Cilk_for (");
1211 newline_and_indent (buffer
, spc
);
1212 pp_string (buffer
, "for (");
1214 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
1216 pp_string (buffer
, " = ");
1217 dump_generic_node (buffer
, gimple_omp_for_initial (gs
, i
), spc
,
1219 pp_string (buffer
, "; ");
1221 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
1224 switch (gimple_omp_for_cond (gs
, i
))
1230 pp_greater (buffer
);
1233 pp_less_equal (buffer
);
1236 pp_greater_equal (buffer
);
1239 pp_string (buffer
, "!=");
1245 dump_generic_node (buffer
, gimple_omp_for_final (gs
, i
), spc
,
1247 pp_string (buffer
, "; ");
1249 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
1251 pp_string (buffer
, " = ");
1252 dump_generic_node (buffer
, gimple_omp_for_incr (gs
, i
), spc
,
1254 pp_right_paren (buffer
);
1257 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1259 if (gimple_omp_for_kind (gs
) == GF_OMP_FOR_KIND_CILKFOR
)
1260 dump_omp_clauses (buffer
, gimple_omp_for_clauses (gs
), spc
, flags
);
1261 newline_and_indent (buffer
, spc
+ 2);
1262 pp_left_brace (buffer
);
1263 pp_newline (buffer
);
1264 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1265 newline_and_indent (buffer
, spc
+ 2);
1266 pp_right_brace (buffer
);
1271 /* Dump a GIMPLE_OMP_CONTINUE tuple on the pretty_printer BUFFER. */
1274 dump_gimple_omp_continue (pretty_printer
*buffer
, gomp_continue
*gs
,
1277 if (flags
& TDF_RAW
)
1279 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T>", gs
,
1280 gimple_omp_continue_control_def (gs
),
1281 gimple_omp_continue_control_use (gs
));
1285 pp_string (buffer
, "#pragma omp continue (");
1286 dump_generic_node (buffer
, gimple_omp_continue_control_def (gs
),
1290 dump_generic_node (buffer
, gimple_omp_continue_control_use (gs
),
1292 pp_right_paren (buffer
);
1296 /* Dump a GIMPLE_OMP_SINGLE tuple on the pretty_printer BUFFER. */
1299 dump_gimple_omp_single (pretty_printer
*buffer
, gomp_single
*gs
,
1302 if (flags
& TDF_RAW
)
1304 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1305 gimple_omp_body (gs
));
1306 dump_omp_clauses (buffer
, gimple_omp_single_clauses (gs
), spc
, flags
);
1307 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1311 pp_string (buffer
, "#pragma omp single");
1312 dump_omp_clauses (buffer
, gimple_omp_single_clauses (gs
), spc
, flags
);
1313 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1315 newline_and_indent (buffer
, spc
+ 2);
1316 pp_left_brace (buffer
);
1317 pp_newline (buffer
);
1318 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1319 newline_and_indent (buffer
, spc
+ 2);
1320 pp_right_brace (buffer
);
1325 /* Dump a GIMPLE_OMP_TARGET tuple on the pretty_printer BUFFER. */
1328 dump_gimple_omp_target (pretty_printer
*buffer
, gomp_target
*gs
,
1332 switch (gimple_omp_target_kind (gs
))
1334 case GF_OMP_TARGET_KIND_REGION
:
1337 case GF_OMP_TARGET_KIND_DATA
:
1340 case GF_OMP_TARGET_KIND_UPDATE
:
1343 case GF_OMP_TARGET_KIND_OACC_KERNELS
:
1344 kind
= " oacc_kernels";
1346 case GF_OMP_TARGET_KIND_OACC_PARALLEL
:
1347 kind
= " oacc_parallel";
1349 case GF_OMP_TARGET_KIND_OACC_DATA
:
1350 kind
= " oacc_data";
1352 case GF_OMP_TARGET_KIND_OACC_UPDATE
:
1353 kind
= " oacc_update";
1355 case GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA
:
1356 kind
= " oacc_enter_exit_data";
1361 if (flags
& TDF_RAW
)
1363 dump_gimple_fmt (buffer
, spc
, flags
, "%G%s <%+BODY <%S>%nCLAUSES <", gs
,
1364 kind
, gimple_omp_body (gs
));
1365 dump_omp_clauses (buffer
, gimple_omp_target_clauses (gs
), spc
, flags
);
1366 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T%n>",
1367 gimple_omp_target_child_fn (gs
),
1368 gimple_omp_target_data_arg (gs
));
1372 pp_string (buffer
, "#pragma omp target");
1373 pp_string (buffer
, kind
);
1374 dump_omp_clauses (buffer
, gimple_omp_target_clauses (gs
), spc
, flags
);
1375 if (gimple_omp_target_child_fn (gs
))
1377 pp_string (buffer
, " [child fn: ");
1378 dump_generic_node (buffer
, gimple_omp_target_child_fn (gs
),
1380 pp_string (buffer
, " (");
1381 if (gimple_omp_target_data_arg (gs
))
1382 dump_generic_node (buffer
, gimple_omp_target_data_arg (gs
),
1385 pp_string (buffer
, "???");
1386 pp_string (buffer
, ")]");
1388 gimple_seq body
= gimple_omp_body (gs
);
1389 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
1391 newline_and_indent (buffer
, spc
+ 2);
1392 pp_left_brace (buffer
);
1393 pp_newline (buffer
);
1394 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
1395 newline_and_indent (buffer
, spc
+ 2);
1396 pp_right_brace (buffer
);
1400 pp_newline (buffer
);
1401 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
1406 /* Dump a GIMPLE_OMP_TEAMS tuple on the pretty_printer BUFFER. */
1409 dump_gimple_omp_teams (pretty_printer
*buffer
, gomp_teams
*gs
, int spc
,
1412 if (flags
& TDF_RAW
)
1414 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1415 gimple_omp_body (gs
));
1416 dump_omp_clauses (buffer
, gimple_omp_teams_clauses (gs
), spc
, flags
);
1417 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1421 pp_string (buffer
, "#pragma omp teams");
1422 dump_omp_clauses (buffer
, gimple_omp_teams_clauses (gs
), spc
, flags
);
1423 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1425 newline_and_indent (buffer
, spc
+ 2);
1426 pp_character (buffer
, '{');
1427 pp_newline (buffer
);
1428 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1429 newline_and_indent (buffer
, spc
+ 2);
1430 pp_character (buffer
, '}');
1435 /* Dump a GIMPLE_OMP_SECTIONS tuple on the pretty_printer BUFFER. */
1438 dump_gimple_omp_sections (pretty_printer
*buffer
, gomp_sections
*gs
,
1441 if (flags
& TDF_RAW
)
1443 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1444 gimple_omp_body (gs
));
1445 dump_omp_clauses (buffer
, gimple_omp_sections_clauses (gs
), spc
, flags
);
1446 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1450 pp_string (buffer
, "#pragma omp sections");
1451 if (gimple_omp_sections_control (gs
))
1453 pp_string (buffer
, " <");
1454 dump_generic_node (buffer
, gimple_omp_sections_control (gs
), spc
,
1456 pp_greater (buffer
);
1458 dump_omp_clauses (buffer
, gimple_omp_sections_clauses (gs
), spc
, flags
);
1459 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1461 newline_and_indent (buffer
, spc
+ 2);
1462 pp_left_brace (buffer
);
1463 pp_newline (buffer
);
1464 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1465 newline_and_indent (buffer
, spc
+ 2);
1466 pp_right_brace (buffer
);
1471 /* Dump a GIMPLE_OMP_{MASTER,TASKGROUP,ORDERED,SECTION} tuple on the
1472 pretty_printer BUFFER. */
1475 dump_gimple_omp_block (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1477 if (flags
& TDF_RAW
)
1478 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1479 gimple_omp_body (gs
));
1482 switch (gimple_code (gs
))
1484 case GIMPLE_OMP_MASTER
:
1485 pp_string (buffer
, "#pragma omp master");
1487 case GIMPLE_OMP_TASKGROUP
:
1488 pp_string (buffer
, "#pragma omp taskgroup");
1490 case GIMPLE_OMP_ORDERED
:
1491 pp_string (buffer
, "#pragma omp ordered");
1493 case GIMPLE_OMP_SECTION
:
1494 pp_string (buffer
, "#pragma omp section");
1499 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1501 newline_and_indent (buffer
, spc
+ 2);
1502 pp_left_brace (buffer
);
1503 pp_newline (buffer
);
1504 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1505 newline_and_indent (buffer
, spc
+ 2);
1506 pp_right_brace (buffer
);
1511 /* Dump a GIMPLE_OMP_CRITICAL tuple on the pretty_printer BUFFER. */
1514 dump_gimple_omp_critical (pretty_printer
*buffer
, gomp_critical
*gs
,
1517 if (flags
& TDF_RAW
)
1518 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1519 gimple_omp_body (gs
));
1522 pp_string (buffer
, "#pragma omp critical");
1523 if (gimple_omp_critical_name (gs
))
1525 pp_string (buffer
, " (");
1526 dump_generic_node (buffer
, gimple_omp_critical_name (gs
), spc
,
1528 pp_right_paren (buffer
);
1530 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1532 newline_and_indent (buffer
, spc
+ 2);
1533 pp_left_brace (buffer
);
1534 pp_newline (buffer
);
1535 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1536 newline_and_indent (buffer
, spc
+ 2);
1537 pp_right_brace (buffer
);
1542 /* Dump a GIMPLE_OMP_RETURN tuple on the pretty_printer BUFFER. */
1545 dump_gimple_omp_return (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1547 if (flags
& TDF_RAW
)
1549 dump_gimple_fmt (buffer
, spc
, flags
, "%G <nowait=%d", gs
,
1550 (int) gimple_omp_return_nowait_p (gs
));
1551 if (gimple_omp_return_lhs (gs
))
1552 dump_gimple_fmt (buffer
, spc
, flags
, ", lhs=%T>",
1553 gimple_omp_return_lhs (gs
));
1555 dump_gimple_fmt (buffer
, spc
, flags
, ">");
1559 pp_string (buffer
, "#pragma omp return");
1560 if (gimple_omp_return_nowait_p (gs
))
1561 pp_string (buffer
, "(nowait)");
1562 if (gimple_omp_return_lhs (gs
))
1564 pp_string (buffer
, " (set ");
1565 dump_generic_node (buffer
, gimple_omp_return_lhs (gs
),
1567 pp_character (buffer
, ')');
1572 /* Dump a GIMPLE_TRANSACTION tuple on the pretty_printer BUFFER. */
1575 dump_gimple_transaction (pretty_printer
*buffer
, gtransaction
*gs
,
1578 unsigned subcode
= gimple_transaction_subcode (gs
);
1580 if (flags
& TDF_RAW
)
1582 dump_gimple_fmt (buffer
, spc
, flags
,
1583 "%G [SUBCODE=%x,LABEL=%T] <%+BODY <%S> >",
1584 gs
, subcode
, gimple_transaction_label (gs
),
1585 gimple_transaction_body (gs
));
1589 if (subcode
& GTMA_IS_OUTER
)
1590 pp_string (buffer
, "__transaction_atomic [[outer]]");
1591 else if (subcode
& GTMA_IS_RELAXED
)
1592 pp_string (buffer
, "__transaction_relaxed");
1594 pp_string (buffer
, "__transaction_atomic");
1595 subcode
&= ~GTMA_DECLARATION_MASK
;
1597 if (subcode
|| gimple_transaction_label (gs
))
1599 pp_string (buffer
, " //");
1600 if (gimple_transaction_label (gs
))
1602 pp_string (buffer
, " LABEL=");
1603 dump_generic_node (buffer
, gimple_transaction_label (gs
),
1608 pp_string (buffer
, " SUBCODE=[ ");
1609 if (subcode
& GTMA_HAVE_ABORT
)
1611 pp_string (buffer
, "GTMA_HAVE_ABORT ");
1612 subcode
&= ~GTMA_HAVE_ABORT
;
1614 if (subcode
& GTMA_HAVE_LOAD
)
1616 pp_string (buffer
, "GTMA_HAVE_LOAD ");
1617 subcode
&= ~GTMA_HAVE_LOAD
;
1619 if (subcode
& GTMA_HAVE_STORE
)
1621 pp_string (buffer
, "GTMA_HAVE_STORE ");
1622 subcode
&= ~GTMA_HAVE_STORE
;
1624 if (subcode
& GTMA_MAY_ENTER_IRREVOCABLE
)
1626 pp_string (buffer
, "GTMA_MAY_ENTER_IRREVOCABLE ");
1627 subcode
&= ~GTMA_MAY_ENTER_IRREVOCABLE
;
1629 if (subcode
& GTMA_DOES_GO_IRREVOCABLE
)
1631 pp_string (buffer
, "GTMA_DOES_GO_IRREVOCABLE ");
1632 subcode
&= ~GTMA_DOES_GO_IRREVOCABLE
;
1634 if (subcode
& GTMA_HAS_NO_INSTRUMENTATION
)
1636 pp_string (buffer
, "GTMA_HAS_NO_INSTRUMENTATION ");
1637 subcode
&= ~GTMA_HAS_NO_INSTRUMENTATION
;
1640 pp_printf (buffer
, "0x%x ", subcode
);
1641 pp_right_bracket (buffer
);
1645 if (!gimple_seq_empty_p (gimple_transaction_body (gs
)))
1647 newline_and_indent (buffer
, spc
+ 2);
1648 pp_left_brace (buffer
);
1649 pp_newline (buffer
);
1650 dump_gimple_seq (buffer
, gimple_transaction_body (gs
),
1652 newline_and_indent (buffer
, spc
+ 2);
1653 pp_right_brace (buffer
);
1658 /* Dump a GIMPLE_ASM tuple on the pretty_printer BUFFER, SPC spaces of
1659 indent. FLAGS specifies details to show in the dump (see TDF_* in
1663 dump_gimple_asm (pretty_printer
*buffer
, gasm
*gs
, int spc
, int flags
)
1665 unsigned int i
, n
, f
, fields
;
1667 if (flags
& TDF_RAW
)
1669 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+STRING <%n%s%n>", gs
,
1670 gimple_asm_string (gs
));
1672 n
= gimple_asm_noutputs (gs
);
1675 newline_and_indent (buffer
, spc
+ 2);
1676 pp_string (buffer
, "OUTPUT: ");
1677 for (i
= 0; i
< n
; i
++)
1679 dump_generic_node (buffer
, gimple_asm_output_op (gs
, i
),
1682 pp_string (buffer
, ", ");
1686 n
= gimple_asm_ninputs (gs
);
1689 newline_and_indent (buffer
, spc
+ 2);
1690 pp_string (buffer
, "INPUT: ");
1691 for (i
= 0; i
< n
; i
++)
1693 dump_generic_node (buffer
, gimple_asm_input_op (gs
, i
),
1696 pp_string (buffer
, ", ");
1700 n
= gimple_asm_nclobbers (gs
);
1703 newline_and_indent (buffer
, spc
+ 2);
1704 pp_string (buffer
, "CLOBBER: ");
1705 for (i
= 0; i
< n
; i
++)
1707 dump_generic_node (buffer
, gimple_asm_clobber_op (gs
, i
),
1710 pp_string (buffer
, ", ");
1714 n
= gimple_asm_nlabels (gs
);
1717 newline_and_indent (buffer
, spc
+ 2);
1718 pp_string (buffer
, "LABEL: ");
1719 for (i
= 0; i
< n
; i
++)
1721 dump_generic_node (buffer
, gimple_asm_label_op (gs
, i
),
1724 pp_string (buffer
, ", ");
1728 newline_and_indent (buffer
, spc
);
1729 pp_greater (buffer
);
1733 pp_string (buffer
, "__asm__");
1734 if (gimple_asm_volatile_p (gs
))
1735 pp_string (buffer
, " __volatile__");
1736 if (gimple_asm_nlabels (gs
))
1737 pp_string (buffer
, " goto");
1738 pp_string (buffer
, "(\"");
1739 pp_string (buffer
, gimple_asm_string (gs
));
1740 pp_string (buffer
, "\"");
1742 if (gimple_asm_nlabels (gs
))
1744 else if (gimple_asm_nclobbers (gs
))
1746 else if (gimple_asm_ninputs (gs
))
1748 else if (gimple_asm_noutputs (gs
))
1753 for (f
= 0; f
< fields
; ++f
)
1755 pp_string (buffer
, " : ");
1760 n
= gimple_asm_noutputs (gs
);
1761 for (i
= 0; i
< n
; i
++)
1763 dump_generic_node (buffer
, gimple_asm_output_op (gs
, i
),
1766 pp_string (buffer
, ", ");
1771 n
= gimple_asm_ninputs (gs
);
1772 for (i
= 0; i
< n
; i
++)
1774 dump_generic_node (buffer
, gimple_asm_input_op (gs
, i
),
1777 pp_string (buffer
, ", ");
1782 n
= gimple_asm_nclobbers (gs
);
1783 for (i
= 0; i
< n
; i
++)
1785 dump_generic_node (buffer
, gimple_asm_clobber_op (gs
, i
),
1788 pp_string (buffer
, ", ");
1793 n
= gimple_asm_nlabels (gs
);
1794 for (i
= 0; i
< n
; i
++)
1796 dump_generic_node (buffer
, gimple_asm_label_op (gs
, i
),
1799 pp_string (buffer
, ", ");
1808 pp_string (buffer
, ");");
1812 /* Dump ptr_info and range_info for NODE on pretty_printer BUFFER with
1813 SPC spaces of indent. */
1816 dump_ssaname_info (pretty_printer
*buffer
, tree node
, int spc
)
1818 if (TREE_CODE (node
) != SSA_NAME
)
1821 if (POINTER_TYPE_P (TREE_TYPE (node
))
1822 && SSA_NAME_PTR_INFO (node
))
1824 unsigned int align
, misalign
;
1825 struct ptr_info_def
*pi
= SSA_NAME_PTR_INFO (node
);
1826 pp_string (buffer
, "# PT = ");
1827 pp_points_to_solution (buffer
, &pi
->pt
);
1828 newline_and_indent (buffer
, spc
);
1829 if (get_ptr_info_alignment (pi
, &align
, &misalign
))
1831 pp_printf (buffer
, "# ALIGN = %u, MISALIGN = %u", align
, misalign
);
1832 newline_and_indent (buffer
, spc
);
1836 if (!POINTER_TYPE_P (TREE_TYPE (node
))
1837 && SSA_NAME_RANGE_INFO (node
))
1839 wide_int min
, max
, nonzero_bits
;
1840 value_range_type range_type
= get_range_info (node
, &min
, &max
);
1842 if (range_type
== VR_VARYING
)
1843 pp_printf (buffer
, "# RANGE VR_VARYING");
1844 else if (range_type
== VR_RANGE
|| range_type
== VR_ANTI_RANGE
)
1846 pp_printf (buffer
, "# RANGE ");
1847 pp_printf (buffer
, "%s[", range_type
== VR_RANGE
? "" : "~");
1848 pp_wide_int (buffer
, min
, TYPE_SIGN (TREE_TYPE (node
)));
1849 pp_printf (buffer
, ", ");
1850 pp_wide_int (buffer
, max
, TYPE_SIGN (TREE_TYPE (node
)));
1851 pp_printf (buffer
, "]");
1853 nonzero_bits
= get_nonzero_bits (node
);
1854 if (nonzero_bits
!= -1)
1856 pp_string (buffer
, " NONZERO ");
1857 pp_wide_int (buffer
, nonzero_bits
, UNSIGNED
);
1859 newline_and_indent (buffer
, spc
);
1864 /* Dump a PHI node PHI. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1.
1865 The caller is responsible for calling pp_flush on BUFFER to finalize
1866 pretty printer. If COMMENT is true, print this after #. */
1869 dump_gimple_phi (pretty_printer
*buffer
, gphi
*phi
, int spc
, bool comment
,
1873 tree lhs
= gimple_phi_result (phi
);
1875 if (flags
& TDF_ALIAS
)
1876 dump_ssaname_info (buffer
, lhs
, spc
);
1879 pp_string (buffer
, "# ");
1881 if (flags
& TDF_RAW
)
1882 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, ", phi
,
1883 gimple_phi_result (phi
));
1886 dump_generic_node (buffer
, lhs
, spc
, flags
, false);
1887 pp_string (buffer
, " = PHI <");
1889 for (i
= 0; i
< gimple_phi_num_args (phi
); i
++)
1891 if ((flags
& TDF_LINENO
) && gimple_phi_arg_has_location (phi
, i
))
1892 dump_location (buffer
, gimple_phi_arg_location (phi
, i
));
1893 dump_generic_node (buffer
, gimple_phi_arg_def (phi
, i
), spc
, flags
,
1895 pp_left_paren (buffer
);
1896 pp_decimal_int (buffer
, gimple_phi_arg_edge (phi
, i
)->src
->index
);
1897 pp_right_paren (buffer
);
1898 if (i
< gimple_phi_num_args (phi
) - 1)
1899 pp_string (buffer
, ", ");
1901 pp_greater (buffer
);
1905 /* Dump a GIMPLE_OMP_PARALLEL tuple on the pretty_printer BUFFER, SPC spaces
1906 of indent. FLAGS specifies details to show in the dump (see TDF_* in
1910 dump_gimple_omp_parallel (pretty_printer
*buffer
, gomp_parallel
*gs
,
1913 if (flags
& TDF_RAW
)
1915 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1916 gimple_omp_body (gs
));
1917 dump_omp_clauses (buffer
, gimple_omp_parallel_clauses (gs
), spc
, flags
);
1918 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T%n>",
1919 gimple_omp_parallel_child_fn (gs
),
1920 gimple_omp_parallel_data_arg (gs
));
1925 pp_string (buffer
, "#pragma omp parallel");
1926 dump_omp_clauses (buffer
, gimple_omp_parallel_clauses (gs
), spc
, flags
);
1927 if (gimple_omp_parallel_child_fn (gs
))
1929 pp_string (buffer
, " [child fn: ");
1930 dump_generic_node (buffer
, gimple_omp_parallel_child_fn (gs
),
1932 pp_string (buffer
, " (");
1933 if (gimple_omp_parallel_data_arg (gs
))
1934 dump_generic_node (buffer
, gimple_omp_parallel_data_arg (gs
),
1937 pp_string (buffer
, "???");
1938 pp_string (buffer
, ")]");
1940 body
= gimple_omp_body (gs
);
1941 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
1943 newline_and_indent (buffer
, spc
+ 2);
1944 pp_left_brace (buffer
);
1945 pp_newline (buffer
);
1946 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
1947 newline_and_indent (buffer
, spc
+ 2);
1948 pp_right_brace (buffer
);
1952 pp_newline (buffer
);
1953 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
1959 /* Dump a GIMPLE_OMP_TASK tuple on the pretty_printer BUFFER, SPC spaces
1960 of indent. FLAGS specifies details to show in the dump (see TDF_* in
1964 dump_gimple_omp_task (pretty_printer
*buffer
, gomp_task
*gs
, int spc
,
1967 if (flags
& TDF_RAW
)
1969 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1970 gimple_omp_body (gs
));
1971 dump_omp_clauses (buffer
, gimple_omp_task_clauses (gs
), spc
, flags
);
1972 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T, %T, %T, %T%n>",
1973 gimple_omp_task_child_fn (gs
),
1974 gimple_omp_task_data_arg (gs
),
1975 gimple_omp_task_copy_fn (gs
),
1976 gimple_omp_task_arg_size (gs
),
1977 gimple_omp_task_arg_size (gs
));
1982 pp_string (buffer
, "#pragma omp task");
1983 dump_omp_clauses (buffer
, gimple_omp_task_clauses (gs
), spc
, flags
);
1984 if (gimple_omp_task_child_fn (gs
))
1986 pp_string (buffer
, " [child fn: ");
1987 dump_generic_node (buffer
, gimple_omp_task_child_fn (gs
),
1989 pp_string (buffer
, " (");
1990 if (gimple_omp_task_data_arg (gs
))
1991 dump_generic_node (buffer
, gimple_omp_task_data_arg (gs
),
1994 pp_string (buffer
, "???");
1995 pp_string (buffer
, ")]");
1997 body
= gimple_omp_body (gs
);
1998 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
2000 newline_and_indent (buffer
, spc
+ 2);
2001 pp_left_brace (buffer
);
2002 pp_newline (buffer
);
2003 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
2004 newline_and_indent (buffer
, spc
+ 2);
2005 pp_right_brace (buffer
);
2009 pp_newline (buffer
);
2010 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
2016 /* Dump a GIMPLE_OMP_ATOMIC_LOAD tuple on the pretty_printer BUFFER, SPC
2017 spaces of indent. FLAGS specifies details to show in the dump (see TDF_*
2021 dump_gimple_omp_atomic_load (pretty_printer
*buffer
, gomp_atomic_load
*gs
,
2024 if (flags
& TDF_RAW
)
2026 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T>", gs
,
2027 gimple_omp_atomic_load_lhs (gs
),
2028 gimple_omp_atomic_load_rhs (gs
));
2032 pp_string (buffer
, "#pragma omp atomic_load");
2033 if (gimple_omp_atomic_seq_cst_p (gs
))
2034 pp_string (buffer
, " seq_cst");
2035 if (gimple_omp_atomic_need_value_p (gs
))
2036 pp_string (buffer
, " [needed]");
2037 newline_and_indent (buffer
, spc
+ 2);
2038 dump_generic_node (buffer
, gimple_omp_atomic_load_lhs (gs
),
2044 dump_generic_node (buffer
, gimple_omp_atomic_load_rhs (gs
),
2049 /* Dump a GIMPLE_OMP_ATOMIC_STORE tuple on the pretty_printer BUFFER, SPC
2050 spaces of indent. FLAGS specifies details to show in the dump (see TDF_*
2054 dump_gimple_omp_atomic_store (pretty_printer
*buffer
,
2055 gomp_atomic_store
*gs
, int spc
, int flags
)
2057 if (flags
& TDF_RAW
)
2059 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
,
2060 gimple_omp_atomic_store_val (gs
));
2064 pp_string (buffer
, "#pragma omp atomic_store ");
2065 if (gimple_omp_atomic_seq_cst_p (gs
))
2066 pp_string (buffer
, "seq_cst ");
2067 if (gimple_omp_atomic_need_value_p (gs
))
2068 pp_string (buffer
, "[needed] ");
2069 pp_left_paren (buffer
);
2070 dump_generic_node (buffer
, gimple_omp_atomic_store_val (gs
),
2072 pp_right_paren (buffer
);
2077 /* Dump all the memory operands for statement GS. BUFFER, SPC and
2078 FLAGS are as in pp_gimple_stmt_1. */
2081 dump_gimple_mem_ops (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
2083 tree vdef
= gimple_vdef (gs
);
2084 tree vuse
= gimple_vuse (gs
);
2086 if (vdef
!= NULL_TREE
)
2088 pp_string (buffer
, "# ");
2089 dump_generic_node (buffer
, vdef
, spc
+ 2, flags
, false);
2090 pp_string (buffer
, " = VDEF <");
2091 dump_generic_node (buffer
, vuse
, spc
+ 2, flags
, false);
2092 pp_greater (buffer
);
2093 newline_and_indent (buffer
, spc
);
2095 else if (vuse
!= NULL_TREE
)
2097 pp_string (buffer
, "# VUSE <");
2098 dump_generic_node (buffer
, vuse
, spc
+ 2, flags
, false);
2099 pp_greater (buffer
);
2100 newline_and_indent (buffer
, spc
);
2105 /* Print the gimple statement GS on the pretty printer BUFFER, SPC
2106 spaces of indent. FLAGS specifies details to show in the dump (see
2107 TDF_* in dumpfile.h). The caller is responsible for calling
2108 pp_flush on BUFFER to finalize the pretty printer. */
2111 pp_gimple_stmt_1 (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
2116 if (flags
& TDF_STMTADDR
)
2117 pp_printf (buffer
, "<&%p> ", (void *) gs
);
2119 if ((flags
& TDF_LINENO
) && gimple_has_location (gs
))
2120 dump_location (buffer
, gimple_location (gs
));
2124 int lp_nr
= lookup_stmt_eh_lp (gs
);
2126 pp_printf (buffer
, "[LP %d] ", lp_nr
);
2128 pp_printf (buffer
, "[MNT %d] ", -lp_nr
);
2131 if ((flags
& (TDF_VOPS
|TDF_MEMSYMS
))
2132 && gimple_has_mem_ops (gs
))
2133 dump_gimple_mem_ops (buffer
, gs
, spc
, flags
);
2135 if (gimple_has_lhs (gs
)
2136 && (flags
& TDF_ALIAS
))
2137 dump_ssaname_info (buffer
, gimple_get_lhs (gs
), spc
);
2139 switch (gimple_code (gs
))
2142 dump_gimple_asm (buffer
, as_a
<gasm
*> (gs
), spc
, flags
);
2146 dump_gimple_assign (buffer
, as_a
<gassign
*> (gs
), spc
, flags
);
2150 dump_gimple_bind (buffer
, as_a
<gbind
*> (gs
), spc
, flags
);
2154 dump_gimple_call (buffer
, as_a
<gcall
*> (gs
), spc
, flags
);
2158 dump_gimple_cond (buffer
, as_a
<gcond
*> (gs
), spc
, flags
);
2162 dump_gimple_label (buffer
, as_a
<glabel
*> (gs
), spc
, flags
);
2166 dump_gimple_goto (buffer
, as_a
<ggoto
*> (gs
), spc
, flags
);
2170 pp_string (buffer
, "GIMPLE_NOP");
2174 dump_gimple_return (buffer
, as_a
<greturn
*> (gs
), spc
, flags
);
2178 dump_gimple_switch (buffer
, as_a
<gswitch
*> (gs
), spc
, flags
);
2182 dump_gimple_try (buffer
, as_a
<gtry
*> (gs
), spc
, flags
);
2186 dump_gimple_phi (buffer
, as_a
<gphi
*> (gs
), spc
, false, flags
);
2189 case GIMPLE_OMP_PARALLEL
:
2190 dump_gimple_omp_parallel (buffer
, as_a
<gomp_parallel
*> (gs
), spc
,
2194 case GIMPLE_OMP_TASK
:
2195 dump_gimple_omp_task (buffer
, as_a
<gomp_task
*> (gs
), spc
, flags
);
2198 case GIMPLE_OMP_ATOMIC_LOAD
:
2199 dump_gimple_omp_atomic_load (buffer
, as_a
<gomp_atomic_load
*> (gs
),
2203 case GIMPLE_OMP_ATOMIC_STORE
:
2204 dump_gimple_omp_atomic_store (buffer
,
2205 as_a
<gomp_atomic_store
*> (gs
),
2209 case GIMPLE_OMP_FOR
:
2210 dump_gimple_omp_for (buffer
, as_a
<gomp_for
*> (gs
), spc
, flags
);
2213 case GIMPLE_OMP_CONTINUE
:
2214 dump_gimple_omp_continue (buffer
, as_a
<gomp_continue
*> (gs
), spc
,
2218 case GIMPLE_OMP_SINGLE
:
2219 dump_gimple_omp_single (buffer
, as_a
<gomp_single
*> (gs
), spc
,
2223 case GIMPLE_OMP_TARGET
:
2224 dump_gimple_omp_target (buffer
, as_a
<gomp_target
*> (gs
), spc
,
2228 case GIMPLE_OMP_TEAMS
:
2229 dump_gimple_omp_teams (buffer
, as_a
<gomp_teams
*> (gs
), spc
,
2233 case GIMPLE_OMP_RETURN
:
2234 dump_gimple_omp_return (buffer
, gs
, spc
, flags
);
2237 case GIMPLE_OMP_SECTIONS
:
2238 dump_gimple_omp_sections (buffer
, as_a
<gomp_sections
*> (gs
),
2242 case GIMPLE_OMP_SECTIONS_SWITCH
:
2243 pp_string (buffer
, "GIMPLE_SECTIONS_SWITCH");
2246 case GIMPLE_OMP_MASTER
:
2247 case GIMPLE_OMP_TASKGROUP
:
2248 case GIMPLE_OMP_ORDERED
:
2249 case GIMPLE_OMP_SECTION
:
2250 dump_gimple_omp_block (buffer
, gs
, spc
, flags
);
2253 case GIMPLE_OMP_CRITICAL
:
2254 dump_gimple_omp_critical (buffer
, as_a
<gomp_critical
*> (gs
), spc
,
2259 dump_gimple_catch (buffer
, as_a
<gcatch
*> (gs
), spc
, flags
);
2262 case GIMPLE_EH_FILTER
:
2263 dump_gimple_eh_filter (buffer
, as_a
<geh_filter
*> (gs
), spc
, flags
);
2266 case GIMPLE_EH_MUST_NOT_THROW
:
2267 dump_gimple_eh_must_not_throw (buffer
,
2268 as_a
<geh_mnt
*> (gs
),
2272 case GIMPLE_EH_ELSE
:
2273 dump_gimple_eh_else (buffer
, as_a
<geh_else
*> (gs
), spc
, flags
);
2277 dump_gimple_resx (buffer
, as_a
<gresx
*> (gs
), spc
, flags
);
2280 case GIMPLE_EH_DISPATCH
:
2281 dump_gimple_eh_dispatch (buffer
, as_a
<geh_dispatch
*> (gs
), spc
,
2286 dump_gimple_debug (buffer
, as_a
<gdebug
*> (gs
), spc
, flags
);
2289 case GIMPLE_PREDICT
:
2290 pp_string (buffer
, "// predicted ");
2291 if (gimple_predict_outcome (gs
))
2292 pp_string (buffer
, "likely by ");
2294 pp_string (buffer
, "unlikely by ");
2295 pp_string (buffer
, predictor_name (gimple_predict_predictor (gs
)));
2296 pp_string (buffer
, " predictor.");
2299 case GIMPLE_TRANSACTION
:
2300 dump_gimple_transaction (buffer
, as_a
<gtransaction
*> (gs
), spc
,
2310 /* Dumps header of basic block BB to OUTF indented by INDENT
2311 spaces and details described by flags. */
2314 dump_gimple_bb_header (FILE *outf
, basic_block bb
, int indent
, int flags
)
2316 if (flags
& TDF_BLOCKS
)
2318 if (flags
& TDF_LINENO
)
2320 gimple_stmt_iterator gsi
;
2322 if (flags
& TDF_COMMENT
)
2323 fputs (";; ", outf
);
2325 for (gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
); gsi_next (&gsi
))
2326 if (!is_gimple_debug (gsi_stmt (gsi
))
2327 && get_lineno (gsi_stmt (gsi
)) != UNKNOWN_LOCATION
)
2329 fprintf (outf
, "%*sstarting at line %d",
2330 indent
, "", get_lineno (gsi_stmt (gsi
)));
2333 if (bb
->discriminator
)
2334 fprintf (outf
, ", discriminator %i", bb
->discriminator
);
2340 gimple stmt
= first_stmt (bb
);
2341 if (!stmt
|| gimple_code (stmt
) != GIMPLE_LABEL
)
2342 fprintf (outf
, "%*s<bb %d>:\n", indent
, "", bb
->index
);
2347 /* Dumps end of basic block BB to buffer BUFFER indented by INDENT
2351 dump_gimple_bb_footer (FILE *outf ATTRIBUTE_UNUSED
,
2352 basic_block bb ATTRIBUTE_UNUSED
,
2353 int indent ATTRIBUTE_UNUSED
,
2354 int flags ATTRIBUTE_UNUSED
)
2356 /* There is currently no GIMPLE-specific basic block info to dump. */
2361 /* Dump PHI nodes of basic block BB to BUFFER with details described
2362 by FLAGS and indented by INDENT spaces. */
2365 dump_phi_nodes (pretty_printer
*buffer
, basic_block bb
, int indent
, int flags
)
2369 for (i
= gsi_start_phis (bb
); !gsi_end_p (i
); gsi_next (&i
))
2371 gphi
*phi
= i
.phi ();
2372 if (!virtual_operand_p (gimple_phi_result (phi
)) || (flags
& TDF_VOPS
))
2375 dump_gimple_phi (buffer
, phi
, indent
, true, flags
);
2376 pp_newline (buffer
);
2382 /* Dump jump to basic block BB that is represented implicitly in the cfg
2386 pp_cfg_jump (pretty_printer
*buffer
, basic_block bb
)
2390 stmt
= first_stmt (bb
);
2392 pp_string (buffer
, "goto <bb ");
2393 pp_decimal_int (buffer
, bb
->index
);
2394 pp_greater (buffer
);
2395 if (stmt
&& gimple_code (stmt
) == GIMPLE_LABEL
)
2397 pp_string (buffer
, " (");
2398 dump_generic_node (buffer
,
2399 gimple_label_label (as_a
<glabel
*> (stmt
)),
2401 pp_right_paren (buffer
);
2402 pp_semicolon (buffer
);
2405 pp_semicolon (buffer
);
2409 /* Dump edges represented implicitly in basic block BB to BUFFER, indented
2410 by INDENT spaces, with details given by FLAGS. */
2413 dump_implicit_edges (pretty_printer
*buffer
, basic_block bb
, int indent
,
2419 stmt
= last_stmt (bb
);
2421 if (stmt
&& gimple_code (stmt
) == GIMPLE_COND
)
2423 edge true_edge
, false_edge
;
2425 /* When we are emitting the code or changing CFG, it is possible that
2426 the edges are not yet created. When we are using debug_bb in such
2427 a situation, we do not want it to crash. */
2428 if (EDGE_COUNT (bb
->succs
) != 2)
2430 extract_true_false_edges_from_block (bb
, &true_edge
, &false_edge
);
2432 INDENT (indent
+ 2);
2433 pp_cfg_jump (buffer
, true_edge
->dest
);
2434 newline_and_indent (buffer
, indent
);
2435 pp_string (buffer
, "else");
2436 newline_and_indent (buffer
, indent
+ 2);
2437 pp_cfg_jump (buffer
, false_edge
->dest
);
2438 pp_newline (buffer
);
2442 /* If there is a fallthru edge, we may need to add an artificial
2443 goto to the dump. */
2444 e
= find_fallthru_edge (bb
->succs
);
2446 if (e
&& e
->dest
!= bb
->next_bb
)
2450 if ((flags
& TDF_LINENO
)
2451 && e
->goto_locus
!= UNKNOWN_LOCATION
)
2452 dump_location (buffer
, e
->goto_locus
);
2454 pp_cfg_jump (buffer
, e
->dest
);
2455 pp_newline (buffer
);
2460 /* Dumps basic block BB to buffer BUFFER with details described by FLAGS and
2461 indented by INDENT spaces. */
2464 gimple_dump_bb_buff (pretty_printer
*buffer
, basic_block bb
, int indent
,
2467 gimple_stmt_iterator gsi
;
2469 int label_indent
= indent
- 2;
2471 if (label_indent
< 0)
2474 dump_phi_nodes (buffer
, bb
, indent
, flags
);
2476 for (gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
); gsi_next (&gsi
))
2480 stmt
= gsi_stmt (gsi
);
2482 curr_indent
= gimple_code (stmt
) == GIMPLE_LABEL
? label_indent
: indent
;
2484 INDENT (curr_indent
);
2485 pp_gimple_stmt_1 (buffer
, stmt
, curr_indent
, flags
);
2486 pp_newline_and_flush (buffer
);
2487 gcc_checking_assert (DECL_STRUCT_FUNCTION (current_function_decl
));
2488 dump_histograms_for_stmt (DECL_STRUCT_FUNCTION (current_function_decl
),
2489 pp_buffer (buffer
)->stream
, stmt
);
2492 dump_implicit_edges (buffer
, bb
, indent
, flags
);
2497 /* Dumps basic block BB to FILE with details described by FLAGS and
2498 indented by INDENT spaces. */
2501 gimple_dump_bb (FILE *file
, basic_block bb
, int indent
, int flags
)
2503 dump_gimple_bb_header (file
, bb
, indent
, flags
);
2504 if (bb
->index
>= NUM_FIXED_BLOCKS
)
2506 pretty_printer buffer
;
2507 pp_needs_newline (&buffer
) = true;
2508 buffer
.buffer
->stream
= file
;
2509 gimple_dump_bb_buff (&buffer
, bb
, indent
, flags
);
2511 dump_gimple_bb_footer (file
, bb
, indent
, flags
);
2514 /* Dumps basic block BB to pretty-printer PP with default dump flags and
2515 no indentation, for use as a label of a DOT graph record-node.
2516 ??? Should just use gimple_dump_bb_buff here, except that value profiling
2517 histogram dumping doesn't know about pretty-printers. */
2520 gimple_dump_bb_for_graph (pretty_printer
*pp
, basic_block bb
)
2522 pp_printf (pp
, "<bb %d>:\n", bb
->index
);
2523 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
2525 for (gphi_iterator gsi
= gsi_start_phis (bb
); !gsi_end_p (gsi
);
2528 gphi
*phi
= gsi
.phi ();
2529 if (!virtual_operand_p (gimple_phi_result (phi
))
2530 || (dump_flags
& TDF_VOPS
))
2533 pp_write_text_to_stream (pp
);
2534 pp_string (pp
, "# ");
2535 pp_gimple_stmt_1 (pp
, phi
, 0, dump_flags
);
2537 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
2541 for (gimple_stmt_iterator gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
);
2544 gimple stmt
= gsi_stmt (gsi
);
2546 pp_write_text_to_stream (pp
);
2547 pp_gimple_stmt_1 (pp
, stmt
, 0, dump_flags
);
2549 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
2551 dump_implicit_edges (pp
, bb
, 0, dump_flags
);
2552 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);