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"
47 #include "tree-ssanames.h"
48 #include "dumpfile.h" /* for dump_flags */
49 #include "value-prof.h"
50 #include "trans-mem.h"
52 #define INDENT(SPACE) \
53 do { int i; for (i = 0; i < SPACE; i++) pp_space (buffer); } while (0)
55 #define GIMPLE_NIY do_niy (buffer,gs)
57 /* Try to print on BUFFER a default message for the unrecognized
58 gimple statement GS. */
61 do_niy (pretty_printer
*buffer
, gimple gs
)
63 pp_printf (buffer
, "<<< Unknown GIMPLE statement: %s >>>\n",
64 gimple_code_name
[(int) gimple_code (gs
)]);
68 /* Emit a newline and SPC indentation spaces to BUFFER. */
71 newline_and_indent (pretty_printer
*buffer
, int spc
)
78 /* Print the GIMPLE statement GS on stderr. */
81 debug_gimple_stmt (gimple gs
)
83 print_gimple_stmt (stderr
, gs
, 0, TDF_VOPS
|TDF_MEMSYMS
);
87 /* Print GIMPLE statement G to FILE using SPC indentation spaces and
88 FLAGS as in pp_gimple_stmt_1. */
91 print_gimple_stmt (FILE *file
, gimple g
, int spc
, int flags
)
93 pretty_printer buffer
;
94 pp_needs_newline (&buffer
) = true;
95 buffer
.buffer
->stream
= file
;
96 pp_gimple_stmt_1 (&buffer
, g
, spc
, flags
);
97 pp_newline_and_flush (&buffer
);
101 debug (gimple_statement_base
&ref
)
103 print_gimple_stmt (stderr
, &ref
, 0, 0);
107 debug (gimple_statement_base
*ptr
)
112 fprintf (stderr
, "<nil>\n");
116 /* Print GIMPLE statement G to FILE using SPC indentation spaces and
117 FLAGS as in pp_gimple_stmt_1. Print only the right-hand side
121 print_gimple_expr (FILE *file
, gimple g
, int spc
, int flags
)
123 flags
|= TDF_RHS_ONLY
;
124 pretty_printer buffer
;
125 pp_needs_newline (&buffer
) = true;
126 buffer
.buffer
->stream
= file
;
127 pp_gimple_stmt_1 (&buffer
, g
, spc
, flags
);
132 /* Print the GIMPLE sequence SEQ on BUFFER using SPC indentation
133 spaces and FLAGS as in pp_gimple_stmt_1.
134 The caller is responsible for calling pp_flush on BUFFER to finalize
135 the pretty printer. */
138 dump_gimple_seq (pretty_printer
*buffer
, gimple_seq seq
, int spc
, int flags
)
140 gimple_stmt_iterator i
;
142 for (i
= gsi_start (seq
); !gsi_end_p (i
); gsi_next (&i
))
144 gimple gs
= gsi_stmt (i
);
146 pp_gimple_stmt_1 (buffer
, gs
, spc
, flags
);
147 if (!gsi_one_before_end_p (i
))
153 /* Print GIMPLE sequence SEQ to FILE using SPC indentation spaces and
154 FLAGS as in pp_gimple_stmt_1. */
157 print_gimple_seq (FILE *file
, gimple_seq seq
, int spc
, int flags
)
159 pretty_printer buffer
;
160 pp_needs_newline (&buffer
) = true;
161 buffer
.buffer
->stream
= file
;
162 dump_gimple_seq (&buffer
, seq
, spc
, flags
);
163 pp_newline_and_flush (&buffer
);
167 /* Print the GIMPLE sequence SEQ on stderr. */
170 debug_gimple_seq (gimple_seq seq
)
172 print_gimple_seq (stderr
, seq
, 0, TDF_VOPS
|TDF_MEMSYMS
);
176 /* A simple helper to pretty-print some of the gimple tuples in the printf
177 style. The format modifiers are preceded by '%' and are:
178 'G' - outputs a string corresponding to the code of the given gimple,
179 'S' - outputs a gimple_seq with indent of spc + 2,
180 'T' - outputs the tree t,
181 'd' - outputs an int as a decimal,
182 's' - outputs a string,
183 'n' - outputs a newline,
184 'x' - outputs an int as hexadecimal,
185 '+' - increases indent by 2 then outputs a newline,
186 '-' - decreases indent by 2 then outputs a newline. */
189 dump_gimple_fmt (pretty_printer
*buffer
, int spc
, int flags
,
190 const char *fmt
, ...)
196 va_start (args
, fmt
);
197 for (c
= fmt
; *c
; c
++)
207 g
= va_arg (args
, gimple
);
208 tmp
= gimple_code_name
[gimple_code (g
)];
209 pp_string (buffer
, tmp
);
213 seq
= va_arg (args
, gimple_seq
);
215 dump_gimple_seq (buffer
, seq
, spc
+ 2, flags
);
216 newline_and_indent (buffer
, spc
);
220 t
= va_arg (args
, tree
);
222 pp_string (buffer
, "NULL");
224 dump_generic_node (buffer
, t
, spc
, flags
, false);
228 pp_decimal_int (buffer
, va_arg (args
, int));
232 pp_string (buffer
, va_arg (args
, char *));
236 newline_and_indent (buffer
, spc
);
240 pp_scalar (buffer
, "%x", va_arg (args
, int));
245 newline_and_indent (buffer
, spc
);
250 newline_and_indent (buffer
, spc
);
258 pp_character (buffer
, *c
);
264 /* Helper for dump_gimple_assign. Print the unary RHS of the
265 assignment GS. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. */
268 dump_unary_rhs (pretty_printer
*buffer
, gassign
*gs
, int spc
, int flags
)
270 enum tree_code rhs_code
= gimple_assign_rhs_code (gs
);
271 tree lhs
= gimple_assign_lhs (gs
);
272 tree rhs
= gimple_assign_rhs1 (gs
);
276 case VIEW_CONVERT_EXPR
:
278 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
281 case FIXED_CONVERT_EXPR
:
282 case ADDR_SPACE_CONVERT_EXPR
:
286 pp_left_paren (buffer
);
287 dump_generic_node (buffer
, TREE_TYPE (lhs
), spc
, flags
, false);
288 pp_string (buffer
, ") ");
289 if (op_prio (rhs
) < op_code_prio (rhs_code
))
291 pp_left_paren (buffer
);
292 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
293 pp_right_paren (buffer
);
296 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
300 pp_string (buffer
, "((");
301 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
302 pp_string (buffer
, "))");
306 pp_string (buffer
, "ABS_EXPR <");
307 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
312 if (TREE_CODE_CLASS (rhs_code
) == tcc_declaration
313 || TREE_CODE_CLASS (rhs_code
) == tcc_constant
314 || TREE_CODE_CLASS (rhs_code
) == tcc_reference
315 || rhs_code
== SSA_NAME
316 || rhs_code
== ADDR_EXPR
317 || rhs_code
== CONSTRUCTOR
)
319 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
322 else if (rhs_code
== BIT_NOT_EXPR
)
323 pp_complement (buffer
);
324 else if (rhs_code
== TRUTH_NOT_EXPR
)
325 pp_exclamation (buffer
);
326 else if (rhs_code
== NEGATE_EXPR
)
330 pp_left_bracket (buffer
);
331 pp_string (buffer
, get_tree_code_name (rhs_code
));
332 pp_string (buffer
, "] ");
335 if (op_prio (rhs
) < op_code_prio (rhs_code
))
337 pp_left_paren (buffer
);
338 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
339 pp_right_paren (buffer
);
342 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
348 /* Helper for dump_gimple_assign. Print the binary RHS of the
349 assignment GS. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. */
352 dump_binary_rhs (pretty_printer
*buffer
, gassign
*gs
, int spc
, int flags
)
355 enum tree_code code
= gimple_assign_rhs_code (gs
);
361 case VEC_WIDEN_MULT_HI_EXPR
:
362 case VEC_WIDEN_MULT_LO_EXPR
:
363 case VEC_WIDEN_MULT_EVEN_EXPR
:
364 case VEC_WIDEN_MULT_ODD_EXPR
:
365 case VEC_PACK_TRUNC_EXPR
:
366 case VEC_PACK_SAT_EXPR
:
367 case VEC_PACK_FIX_TRUNC_EXPR
:
368 case VEC_WIDEN_LSHIFT_HI_EXPR
:
369 case VEC_WIDEN_LSHIFT_LO_EXPR
:
370 for (p
= get_tree_code_name (code
); *p
; p
++)
371 pp_character (buffer
, TOUPPER (*p
));
372 pp_string (buffer
, " <");
373 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
374 pp_string (buffer
, ", ");
375 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
380 if (op_prio (gimple_assign_rhs1 (gs
)) <= op_code_prio (code
))
382 pp_left_paren (buffer
);
383 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
,
385 pp_right_paren (buffer
);
388 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
390 pp_string (buffer
, op_symbol_code (gimple_assign_rhs_code (gs
)));
392 if (op_prio (gimple_assign_rhs2 (gs
)) <= op_code_prio (code
))
394 pp_left_paren (buffer
);
395 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
,
397 pp_right_paren (buffer
);
400 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
404 /* Helper for dump_gimple_assign. Print the ternary RHS of the
405 assignment GS. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. */
408 dump_ternary_rhs (pretty_printer
*buffer
, gassign
*gs
, int spc
, int flags
)
411 enum tree_code code
= gimple_assign_rhs_code (gs
);
414 case WIDEN_MULT_PLUS_EXPR
:
415 case WIDEN_MULT_MINUS_EXPR
:
416 for (p
= get_tree_code_name (code
); *p
; p
++)
417 pp_character (buffer
, TOUPPER (*p
));
418 pp_string (buffer
, " <");
419 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
420 pp_string (buffer
, ", ");
421 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
422 pp_string (buffer
, ", ");
423 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
428 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
429 pp_string (buffer
, " * ");
430 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
431 pp_string (buffer
, " + ");
432 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
436 pp_string (buffer
, "DOT_PROD_EXPR <");
437 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
438 pp_string (buffer
, ", ");
439 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
440 pp_string (buffer
, ", ");
441 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
446 pp_string (buffer
, "SAD_EXPR <");
447 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
448 pp_string (buffer
, ", ");
449 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
450 pp_string (buffer
, ", ");
451 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
456 pp_string (buffer
, "VEC_PERM_EXPR <");
457 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
458 pp_string (buffer
, ", ");
459 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
460 pp_string (buffer
, ", ");
461 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
465 case REALIGN_LOAD_EXPR
:
466 pp_string (buffer
, "REALIGN_LOAD <");
467 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
468 pp_string (buffer
, ", ");
469 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
470 pp_string (buffer
, ", ");
471 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
476 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
477 pp_string (buffer
, " ? ");
478 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
479 pp_string (buffer
, " : ");
480 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
484 pp_string (buffer
, "VEC_COND_EXPR <");
485 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
486 pp_string (buffer
, ", ");
487 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
488 pp_string (buffer
, ", ");
489 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
499 /* Dump the gimple assignment GS. BUFFER, SPC and FLAGS are as in
503 dump_gimple_assign (pretty_printer
*buffer
, gassign
*gs
, int spc
, int flags
)
510 switch (gimple_num_ops (gs
))
513 arg3
= gimple_assign_rhs3 (gs
);
515 arg2
= gimple_assign_rhs2 (gs
);
517 arg1
= gimple_assign_rhs1 (gs
);
523 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%s, %T, %T, %T, %T>", gs
,
524 get_tree_code_name (gimple_assign_rhs_code (gs
)),
525 gimple_assign_lhs (gs
), arg1
, arg2
, arg3
);
529 if (!(flags
& TDF_RHS_ONLY
))
531 dump_generic_node (buffer
, gimple_assign_lhs (gs
), spc
, flags
, false);
535 if (gimple_assign_nontemporal_move_p (gs
))
536 pp_string (buffer
, "{nt}");
538 if (gimple_has_volatile_ops (gs
))
539 pp_string (buffer
, "{v}");
544 if (gimple_num_ops (gs
) == 2)
545 dump_unary_rhs (buffer
, gs
, spc
, flags
);
546 else if (gimple_num_ops (gs
) == 3)
547 dump_binary_rhs (buffer
, gs
, spc
, flags
);
548 else if (gimple_num_ops (gs
) == 4)
549 dump_ternary_rhs (buffer
, gs
, spc
, flags
);
552 if (!(flags
& TDF_RHS_ONLY
))
553 pp_semicolon (buffer
);
558 /* Dump the return statement GS. BUFFER, SPC and FLAGS are as in
562 dump_gimple_return (pretty_printer
*buffer
, greturn
*gs
, int spc
, int flags
)
566 t
= gimple_return_retval (gs
);
567 t2
= gimple_return_retbnd (gs
);
569 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T %T>", gs
, t
, t2
);
572 pp_string (buffer
, "return");
576 dump_generic_node (buffer
, t
, spc
, flags
, false);
580 pp_string (buffer
, ", ");
581 dump_generic_node (buffer
, t2
, spc
, flags
, false);
583 pp_semicolon (buffer
);
588 /* Dump the call arguments for a gimple call. BUFFER, FLAGS are as in
592 dump_gimple_call_args (pretty_printer
*buffer
, gcall
*gs
, int flags
)
596 for (i
= 0; i
< gimple_call_num_args (gs
); i
++)
598 dump_generic_node (buffer
, gimple_call_arg (gs
, i
), 0, flags
, false);
599 if (i
< gimple_call_num_args (gs
) - 1)
600 pp_string (buffer
, ", ");
603 if (gimple_call_va_arg_pack_p (gs
))
605 if (gimple_call_num_args (gs
) > 0)
611 pp_string (buffer
, "__builtin_va_arg_pack ()");
615 /* Dump the points-to solution *PT to BUFFER. */
618 pp_points_to_solution (pretty_printer
*buffer
, struct pt_solution
*pt
)
622 pp_string (buffer
, "anything ");
626 pp_string (buffer
, "nonlocal ");
628 pp_string (buffer
, "escaped ");
630 pp_string (buffer
, "unit-escaped ");
632 pp_string (buffer
, "null ");
634 && !bitmap_empty_p (pt
->vars
))
638 pp_string (buffer
, "{ ");
639 EXECUTE_IF_SET_IN_BITMAP (pt
->vars
, 0, i
, bi
)
641 pp_string (buffer
, "D.");
642 pp_decimal_int (buffer
, i
);
645 pp_right_brace (buffer
);
646 if (pt
->vars_contains_nonlocal
647 && pt
->vars_contains_escaped_heap
)
648 pp_string (buffer
, " (nonlocal, escaped heap)");
649 else if (pt
->vars_contains_nonlocal
650 && pt
->vars_contains_escaped
)
651 pp_string (buffer
, " (nonlocal, escaped)");
652 else if (pt
->vars_contains_nonlocal
)
653 pp_string (buffer
, " (nonlocal)");
654 else if (pt
->vars_contains_escaped_heap
)
655 pp_string (buffer
, " (escaped heap)");
656 else if (pt
->vars_contains_escaped
)
657 pp_string (buffer
, " (escaped)");
661 /* Dump the call statement GS. BUFFER, SPC and FLAGS are as in
665 dump_gimple_call (pretty_printer
*buffer
, gcall
*gs
, int spc
, int flags
)
667 tree lhs
= gimple_call_lhs (gs
);
668 tree fn
= gimple_call_fn (gs
);
670 if (flags
& TDF_ALIAS
)
672 struct pt_solution
*pt
;
673 pt
= gimple_call_use_set (gs
);
674 if (!pt_solution_empty_p (pt
))
676 pp_string (buffer
, "# USE = ");
677 pp_points_to_solution (buffer
, pt
);
678 newline_and_indent (buffer
, spc
);
680 pt
= gimple_call_clobber_set (gs
);
681 if (!pt_solution_empty_p (pt
))
683 pp_string (buffer
, "# CLB = ");
684 pp_points_to_solution (buffer
, pt
);
685 newline_and_indent (buffer
, spc
);
691 if (gimple_call_internal_p (gs
))
692 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%s, %T", gs
,
693 internal_fn_name (gimple_call_internal_fn (gs
)), lhs
);
695 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T", gs
, fn
, lhs
);
696 if (gimple_call_num_args (gs
) > 0)
698 pp_string (buffer
, ", ");
699 dump_gimple_call_args (buffer
, gs
, flags
);
705 if (lhs
&& !(flags
& TDF_RHS_ONLY
))
707 dump_generic_node (buffer
, lhs
, spc
, flags
, false);
708 pp_string (buffer
, " =");
710 if (gimple_has_volatile_ops (gs
))
711 pp_string (buffer
, "{v}");
715 if (gimple_call_internal_p (gs
))
716 pp_string (buffer
, internal_fn_name (gimple_call_internal_fn (gs
)));
718 print_call_name (buffer
, fn
, flags
);
719 pp_string (buffer
, " (");
720 dump_gimple_call_args (buffer
, gs
, flags
);
721 pp_right_paren (buffer
);
722 if (!(flags
& TDF_RHS_ONLY
))
723 pp_semicolon (buffer
);
726 if (gimple_call_chain (gs
))
728 pp_string (buffer
, " [static-chain: ");
729 dump_generic_node (buffer
, gimple_call_chain (gs
), spc
, flags
, false);
730 pp_right_bracket (buffer
);
733 if (gimple_call_return_slot_opt_p (gs
))
734 pp_string (buffer
, " [return slot optimization]");
735 if (gimple_call_tail_p (gs
))
736 pp_string (buffer
, " [tail call]");
741 /* Dump the arguments of _ITM_beginTransaction sanely. */
742 if (TREE_CODE (fn
) == ADDR_EXPR
)
743 fn
= TREE_OPERAND (fn
, 0);
744 if (TREE_CODE (fn
) == FUNCTION_DECL
&& decl_is_tm_clone (fn
))
745 pp_string (buffer
, " [tm-clone]");
746 if (TREE_CODE (fn
) == FUNCTION_DECL
747 && DECL_BUILT_IN_CLASS (fn
) == BUILT_IN_NORMAL
748 && DECL_FUNCTION_CODE (fn
) == BUILT_IN_TM_START
749 && gimple_call_num_args (gs
) > 0)
751 tree t
= gimple_call_arg (gs
, 0);
752 unsigned HOST_WIDE_INT props
;
753 gcc_assert (TREE_CODE (t
) == INTEGER_CST
);
755 pp_string (buffer
, " [ ");
757 /* Get the transaction code properties. */
758 props
= TREE_INT_CST_LOW (t
);
760 if (props
& PR_INSTRUMENTEDCODE
)
761 pp_string (buffer
, "instrumentedCode ");
762 if (props
& PR_UNINSTRUMENTEDCODE
)
763 pp_string (buffer
, "uninstrumentedCode ");
764 if (props
& PR_HASNOXMMUPDATE
)
765 pp_string (buffer
, "hasNoXMMUpdate ");
766 if (props
& PR_HASNOABORT
)
767 pp_string (buffer
, "hasNoAbort ");
768 if (props
& PR_HASNOIRREVOCABLE
)
769 pp_string (buffer
, "hasNoIrrevocable ");
770 if (props
& PR_DOESGOIRREVOCABLE
)
771 pp_string (buffer
, "doesGoIrrevocable ");
772 if (props
& PR_HASNOSIMPLEREADS
)
773 pp_string (buffer
, "hasNoSimpleReads ");
774 if (props
& PR_AWBARRIERSOMITTED
)
775 pp_string (buffer
, "awBarriersOmitted ");
776 if (props
& PR_RARBARRIERSOMITTED
)
777 pp_string (buffer
, "RaRBarriersOmitted ");
778 if (props
& PR_UNDOLOGCODE
)
779 pp_string (buffer
, "undoLogCode ");
780 if (props
& PR_PREFERUNINSTRUMENTED
)
781 pp_string (buffer
, "preferUninstrumented ");
782 if (props
& PR_EXCEPTIONBLOCK
)
783 pp_string (buffer
, "exceptionBlock ");
784 if (props
& PR_HASELSE
)
785 pp_string (buffer
, "hasElse ");
786 if (props
& PR_READONLY
)
787 pp_string (buffer
, "readOnly ");
789 pp_right_bracket (buffer
);
794 /* Dump the switch statement GS. BUFFER, SPC and FLAGS are as in
798 dump_gimple_switch (pretty_printer
*buffer
, gswitch
*gs
, int spc
,
803 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
805 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, ", gs
,
806 gimple_switch_index (gs
));
809 pp_string (buffer
, "switch (");
810 dump_generic_node (buffer
, gimple_switch_index (gs
), spc
, flags
, true);
811 pp_string (buffer
, ") <");
814 for (i
= 0; i
< gimple_switch_num_labels (gs
); i
++)
816 tree case_label
= gimple_switch_label (gs
, i
);
817 gcc_checking_assert (case_label
!= NULL_TREE
);
818 dump_generic_node (buffer
, case_label
, spc
, flags
, false);
820 dump_generic_node (buffer
, CASE_LABEL (case_label
), spc
, flags
, false);
821 if (i
< gimple_switch_num_labels (gs
) - 1)
822 pp_string (buffer
, ", ");
828 /* Dump the gimple conditional GS. BUFFER, SPC and FLAGS are as in
832 dump_gimple_cond (pretty_printer
*buffer
, gcond
*gs
, int spc
, int flags
)
835 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%s, %T, %T, %T, %T>", gs
,
836 get_tree_code_name (gimple_cond_code (gs
)),
837 gimple_cond_lhs (gs
), gimple_cond_rhs (gs
),
838 gimple_cond_true_label (gs
), gimple_cond_false_label (gs
));
841 if (!(flags
& TDF_RHS_ONLY
))
842 pp_string (buffer
, "if (");
843 dump_generic_node (buffer
, gimple_cond_lhs (gs
), spc
, flags
, false);
845 pp_string (buffer
, op_symbol_code (gimple_cond_code (gs
)));
847 dump_generic_node (buffer
, gimple_cond_rhs (gs
), spc
, flags
, false);
848 if (!(flags
& TDF_RHS_ONLY
))
850 pp_right_paren (buffer
);
852 if (gimple_cond_true_label (gs
))
854 pp_string (buffer
, " goto ");
855 dump_generic_node (buffer
, gimple_cond_true_label (gs
),
857 pp_semicolon (buffer
);
859 if (gimple_cond_false_label (gs
))
861 pp_string (buffer
, " else goto ");
862 dump_generic_node (buffer
, gimple_cond_false_label (gs
),
864 pp_semicolon (buffer
);
871 /* Dump a GIMPLE_LABEL tuple on the pretty_printer BUFFER, SPC
872 spaces of indent. FLAGS specifies details to show in the dump (see
873 TDF_* in dumpfils.h). */
876 dump_gimple_label (pretty_printer
*buffer
, glabel
*gs
, int spc
, int flags
)
878 tree label
= gimple_label_label (gs
);
880 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
, label
);
883 dump_generic_node (buffer
, label
, spc
, flags
, false);
886 if (DECL_NONLOCAL (label
))
887 pp_string (buffer
, " [non-local]");
888 if ((flags
& TDF_EH
) && EH_LANDING_PAD_NR (label
))
889 pp_printf (buffer
, " [LP %d]", EH_LANDING_PAD_NR (label
));
892 /* Dump a GIMPLE_GOTO tuple on the pretty_printer BUFFER, SPC
893 spaces of indent. FLAGS specifies details to show in the dump (see
894 TDF_* in dumpfile.h). */
897 dump_gimple_goto (pretty_printer
*buffer
, ggoto
*gs
, int spc
, int flags
)
899 tree label
= gimple_goto_dest (gs
);
901 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
, label
);
903 dump_gimple_fmt (buffer
, spc
, flags
, "goto %T;", label
);
907 /* Dump a GIMPLE_BIND tuple on the pretty_printer BUFFER, SPC
908 spaces of indent. FLAGS specifies details to show in the dump (see
909 TDF_* in dumpfile.h). */
912 dump_gimple_bind (pretty_printer
*buffer
, gbind
*gs
, int spc
, int flags
)
915 dump_gimple_fmt (buffer
, spc
, flags
, "%G <", gs
);
917 pp_left_brace (buffer
);
918 if (!(flags
& TDF_SLIM
))
922 for (var
= gimple_bind_vars (gs
); var
; var
= DECL_CHAIN (var
))
924 newline_and_indent (buffer
, 2);
925 print_declaration (buffer
, var
, spc
, flags
);
927 if (gimple_bind_vars (gs
))
931 dump_gimple_seq (buffer
, gimple_bind_body (gs
), spc
+ 2, flags
);
932 newline_and_indent (buffer
, spc
);
936 pp_right_brace (buffer
);
940 /* Dump a GIMPLE_TRY tuple on the pretty_printer BUFFER, SPC spaces of
941 indent. FLAGS specifies details to show in the dump (see TDF_* in
945 dump_gimple_try (pretty_printer
*buffer
, gtry
*gs
, int spc
, int flags
)
950 if (gimple_try_kind (gs
) == GIMPLE_TRY_CATCH
)
951 type
= "GIMPLE_TRY_CATCH";
952 else if (gimple_try_kind (gs
) == GIMPLE_TRY_FINALLY
)
953 type
= "GIMPLE_TRY_FINALLY";
955 type
= "UNKNOWN GIMPLE_TRY";
956 dump_gimple_fmt (buffer
, spc
, flags
,
957 "%G <%s,%+EVAL <%S>%nCLEANUP <%S>%->", gs
, type
,
958 gimple_try_eval (gs
), gimple_try_cleanup (gs
));
962 pp_string (buffer
, "try");
963 newline_and_indent (buffer
, spc
+ 2);
964 pp_left_brace (buffer
);
967 dump_gimple_seq (buffer
, gimple_try_eval (gs
), spc
+ 4, flags
);
968 newline_and_indent (buffer
, spc
+ 2);
969 pp_right_brace (buffer
);
971 if (gimple_try_kind (gs
) == GIMPLE_TRY_CATCH
)
973 newline_and_indent (buffer
, spc
);
974 pp_string (buffer
, "catch");
975 newline_and_indent (buffer
, spc
+ 2);
976 pp_left_brace (buffer
);
978 else if (gimple_try_kind (gs
) == GIMPLE_TRY_FINALLY
)
980 newline_and_indent (buffer
, spc
);
981 pp_string (buffer
, "finally");
982 newline_and_indent (buffer
, spc
+ 2);
983 pp_left_brace (buffer
);
986 pp_string (buffer
, " <UNKNOWN GIMPLE_TRY> {");
989 dump_gimple_seq (buffer
, gimple_try_cleanup (gs
), spc
+ 4, flags
);
990 newline_and_indent (buffer
, spc
+ 2);
991 pp_right_brace (buffer
);
996 /* Dump a GIMPLE_CATCH tuple on the pretty_printer BUFFER, SPC spaces of
997 indent. FLAGS specifies details to show in the dump (see TDF_* in
1001 dump_gimple_catch (pretty_printer
*buffer
, gcatch
*gs
, int spc
, int flags
)
1003 if (flags
& TDF_RAW
)
1004 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %+CATCH <%S>%->", gs
,
1005 gimple_catch_types (gs
), gimple_catch_handler (gs
));
1007 dump_gimple_fmt (buffer
, spc
, flags
, "catch (%T)%+{%S}",
1008 gimple_catch_types (gs
), gimple_catch_handler (gs
));
1012 /* Dump a GIMPLE_EH_FILTER tuple on the pretty_printer BUFFER, SPC spaces of
1013 indent. FLAGS specifies details to show in the dump (see TDF_* in
1017 dump_gimple_eh_filter (pretty_printer
*buffer
, geh_filter
*gs
, int spc
,
1020 if (flags
& TDF_RAW
)
1021 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %+FAILURE <%S>%->", gs
,
1022 gimple_eh_filter_types (gs
),
1023 gimple_eh_filter_failure (gs
));
1025 dump_gimple_fmt (buffer
, spc
, flags
, "<<<eh_filter (%T)>>>%+{%+%S%-}",
1026 gimple_eh_filter_types (gs
),
1027 gimple_eh_filter_failure (gs
));
1031 /* Dump a GIMPLE_EH_MUST_NOT_THROW tuple. */
1034 dump_gimple_eh_must_not_throw (pretty_printer
*buffer
,
1035 geh_mnt
*gs
, int spc
, int flags
)
1037 if (flags
& TDF_RAW
)
1038 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
,
1039 gimple_eh_must_not_throw_fndecl (gs
));
1041 dump_gimple_fmt (buffer
, spc
, flags
, "<<<eh_must_not_throw (%T)>>>",
1042 gimple_eh_must_not_throw_fndecl (gs
));
1046 /* Dump a GIMPLE_EH_ELSE tuple on the pretty_printer BUFFER, SPC spaces of
1047 indent. FLAGS specifies details to show in the dump (see TDF_* in
1051 dump_gimple_eh_else (pretty_printer
*buffer
, geh_else
*gs
, int spc
,
1054 if (flags
& TDF_RAW
)
1055 dump_gimple_fmt (buffer
, spc
, flags
,
1056 "%G <%+N_BODY <%S>%nE_BODY <%S>%->", gs
,
1057 gimple_eh_else_n_body (gs
), gimple_eh_else_e_body (gs
));
1059 dump_gimple_fmt (buffer
, spc
, flags
,
1060 "<<<if_normal_exit>>>%+{%S}%-<<<else_eh_exit>>>%+{%S}",
1061 gimple_eh_else_n_body (gs
), gimple_eh_else_e_body (gs
));
1065 /* Dump a GIMPLE_RESX tuple on the pretty_printer BUFFER, SPC spaces of
1066 indent. FLAGS specifies details to show in the dump (see TDF_* in
1070 dump_gimple_resx (pretty_printer
*buffer
, gresx
*gs
, int spc
, int flags
)
1072 if (flags
& TDF_RAW
)
1073 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%d>", gs
,
1074 gimple_resx_region (gs
));
1076 dump_gimple_fmt (buffer
, spc
, flags
, "resx %d", gimple_resx_region (gs
));
1079 /* Dump a GIMPLE_EH_DISPATCH tuple on the pretty_printer BUFFER. */
1082 dump_gimple_eh_dispatch (pretty_printer
*buffer
, geh_dispatch
*gs
, int spc
, int flags
)
1084 if (flags
& TDF_RAW
)
1085 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%d>", gs
,
1086 gimple_eh_dispatch_region (gs
));
1088 dump_gimple_fmt (buffer
, spc
, flags
, "eh_dispatch %d",
1089 gimple_eh_dispatch_region (gs
));
1092 /* Dump a GIMPLE_DEBUG tuple on the pretty_printer BUFFER, SPC spaces
1093 of indent. FLAGS specifies details to show in the dump (see TDF_*
1097 dump_gimple_debug (pretty_printer
*buffer
, gdebug
*gs
, int spc
, int flags
)
1099 switch (gs
->subcode
)
1101 case GIMPLE_DEBUG_BIND
:
1102 if (flags
& TDF_RAW
)
1103 dump_gimple_fmt (buffer
, spc
, flags
, "%G BIND <%T, %T>", gs
,
1104 gimple_debug_bind_get_var (gs
),
1105 gimple_debug_bind_get_value (gs
));
1107 dump_gimple_fmt (buffer
, spc
, flags
, "# DEBUG %T => %T",
1108 gimple_debug_bind_get_var (gs
),
1109 gimple_debug_bind_get_value (gs
));
1112 case GIMPLE_DEBUG_SOURCE_BIND
:
1113 if (flags
& TDF_RAW
)
1114 dump_gimple_fmt (buffer
, spc
, flags
, "%G SRCBIND <%T, %T>", gs
,
1115 gimple_debug_source_bind_get_var (gs
),
1116 gimple_debug_source_bind_get_value (gs
));
1118 dump_gimple_fmt (buffer
, spc
, flags
, "# DEBUG %T s=> %T",
1119 gimple_debug_source_bind_get_var (gs
),
1120 gimple_debug_source_bind_get_value (gs
));
1128 /* Dump a GIMPLE_OMP_FOR tuple on the pretty_printer BUFFER. */
1130 dump_gimple_omp_for (pretty_printer
*buffer
, gomp_for
*gs
, int spc
, int flags
)
1134 if (flags
& TDF_RAW
)
1137 switch (gimple_omp_for_kind (gs
))
1139 case GF_OMP_FOR_KIND_FOR
:
1142 case GF_OMP_FOR_KIND_DISTRIBUTE
:
1143 kind
= " distribute";
1145 case GF_OMP_FOR_KIND_CILKFOR
:
1146 kind
= " _Cilk_for";
1148 case GF_OMP_FOR_KIND_OACC_LOOP
:
1149 kind
= " oacc_loop";
1151 case GF_OMP_FOR_KIND_SIMD
:
1154 case GF_OMP_FOR_KIND_CILKSIMD
:
1160 dump_gimple_fmt (buffer
, spc
, flags
, "%G%s <%+BODY <%S>%nCLAUSES <", gs
,
1161 kind
, gimple_omp_body (gs
));
1162 dump_omp_clauses (buffer
, gimple_omp_for_clauses (gs
), spc
, flags
);
1163 dump_gimple_fmt (buffer
, spc
, flags
, " >,");
1164 for (i
= 0; i
< gimple_omp_for_collapse (gs
); i
++)
1165 dump_gimple_fmt (buffer
, spc
, flags
,
1166 "%+%T, %T, %T, %s, %T,%n",
1167 gimple_omp_for_index (gs
, i
),
1168 gimple_omp_for_initial (gs
, i
),
1169 gimple_omp_for_final (gs
, i
),
1170 get_tree_code_name (gimple_omp_for_cond (gs
, i
)),
1171 gimple_omp_for_incr (gs
, i
));
1172 dump_gimple_fmt (buffer
, spc
, flags
, "PRE_BODY <%S>%->",
1173 gimple_omp_for_pre_body (gs
));
1177 switch (gimple_omp_for_kind (gs
))
1179 case GF_OMP_FOR_KIND_FOR
:
1180 pp_string (buffer
, "#pragma omp for");
1182 case GF_OMP_FOR_KIND_DISTRIBUTE
:
1183 pp_string (buffer
, "#pragma omp distribute");
1185 case GF_OMP_FOR_KIND_CILKFOR
:
1187 case GF_OMP_FOR_KIND_OACC_LOOP
:
1188 pp_string (buffer
, "#pragma acc loop");
1190 case GF_OMP_FOR_KIND_SIMD
:
1191 pp_string (buffer
, "#pragma omp simd");
1193 case GF_OMP_FOR_KIND_CILKSIMD
:
1194 pp_string (buffer
, "#pragma simd");
1199 if (gimple_omp_for_kind (gs
) != GF_OMP_FOR_KIND_CILKFOR
)
1200 dump_omp_clauses (buffer
, gimple_omp_for_clauses (gs
), spc
, flags
);
1201 for (i
= 0; i
< gimple_omp_for_collapse (gs
); i
++)
1205 if (gimple_omp_for_kind (gs
) == GF_OMP_FOR_KIND_CILKFOR
)
1206 pp_string (buffer
, "_Cilk_for (");
1209 newline_and_indent (buffer
, spc
);
1210 pp_string (buffer
, "for (");
1212 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
1214 pp_string (buffer
, " = ");
1215 dump_generic_node (buffer
, gimple_omp_for_initial (gs
, i
), spc
,
1217 pp_string (buffer
, "; ");
1219 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
1222 switch (gimple_omp_for_cond (gs
, i
))
1228 pp_greater (buffer
);
1231 pp_less_equal (buffer
);
1234 pp_greater_equal (buffer
);
1237 pp_string (buffer
, "!=");
1243 dump_generic_node (buffer
, gimple_omp_for_final (gs
, i
), spc
,
1245 pp_string (buffer
, "; ");
1247 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
1249 pp_string (buffer
, " = ");
1250 dump_generic_node (buffer
, gimple_omp_for_incr (gs
, i
), spc
,
1252 pp_right_paren (buffer
);
1255 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1257 if (gimple_omp_for_kind (gs
) == GF_OMP_FOR_KIND_CILKFOR
)
1258 dump_omp_clauses (buffer
, gimple_omp_for_clauses (gs
), spc
, flags
);
1259 newline_and_indent (buffer
, spc
+ 2);
1260 pp_left_brace (buffer
);
1261 pp_newline (buffer
);
1262 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1263 newline_and_indent (buffer
, spc
+ 2);
1264 pp_right_brace (buffer
);
1269 /* Dump a GIMPLE_OMP_CONTINUE tuple on the pretty_printer BUFFER. */
1272 dump_gimple_omp_continue (pretty_printer
*buffer
, gomp_continue
*gs
,
1275 if (flags
& TDF_RAW
)
1277 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T>", gs
,
1278 gimple_omp_continue_control_def (gs
),
1279 gimple_omp_continue_control_use (gs
));
1283 pp_string (buffer
, "#pragma omp continue (");
1284 dump_generic_node (buffer
, gimple_omp_continue_control_def (gs
),
1288 dump_generic_node (buffer
, gimple_omp_continue_control_use (gs
),
1290 pp_right_paren (buffer
);
1294 /* Dump a GIMPLE_OMP_SINGLE tuple on the pretty_printer BUFFER. */
1297 dump_gimple_omp_single (pretty_printer
*buffer
, gomp_single
*gs
,
1300 if (flags
& TDF_RAW
)
1302 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1303 gimple_omp_body (gs
));
1304 dump_omp_clauses (buffer
, gimple_omp_single_clauses (gs
), spc
, flags
);
1305 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1309 pp_string (buffer
, "#pragma omp single");
1310 dump_omp_clauses (buffer
, gimple_omp_single_clauses (gs
), spc
, flags
);
1311 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1313 newline_and_indent (buffer
, spc
+ 2);
1314 pp_left_brace (buffer
);
1315 pp_newline (buffer
);
1316 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1317 newline_and_indent (buffer
, spc
+ 2);
1318 pp_right_brace (buffer
);
1323 /* Dump a GIMPLE_OMP_TARGET tuple on the pretty_printer BUFFER. */
1326 dump_gimple_omp_target (pretty_printer
*buffer
, gomp_target
*gs
,
1330 switch (gimple_omp_target_kind (gs
))
1332 case GF_OMP_TARGET_KIND_REGION
:
1335 case GF_OMP_TARGET_KIND_DATA
:
1338 case GF_OMP_TARGET_KIND_UPDATE
:
1341 case GF_OMP_TARGET_KIND_OACC_KERNELS
:
1342 kind
= " oacc_kernels";
1344 case GF_OMP_TARGET_KIND_OACC_PARALLEL
:
1345 kind
= " oacc_parallel";
1347 case GF_OMP_TARGET_KIND_OACC_DATA
:
1348 kind
= " oacc_data";
1350 case GF_OMP_TARGET_KIND_OACC_UPDATE
:
1351 kind
= " oacc_update";
1353 case GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA
:
1354 kind
= " oacc_enter_exit_data";
1359 if (flags
& TDF_RAW
)
1361 dump_gimple_fmt (buffer
, spc
, flags
, "%G%s <%+BODY <%S>%nCLAUSES <", gs
,
1362 kind
, gimple_omp_body (gs
));
1363 dump_omp_clauses (buffer
, gimple_omp_target_clauses (gs
), spc
, flags
);
1364 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T%n>",
1365 gimple_omp_target_child_fn (gs
),
1366 gimple_omp_target_data_arg (gs
));
1370 pp_string (buffer
, "#pragma omp target");
1371 pp_string (buffer
, kind
);
1372 dump_omp_clauses (buffer
, gimple_omp_target_clauses (gs
), spc
, flags
);
1373 if (gimple_omp_target_child_fn (gs
))
1375 pp_string (buffer
, " [child fn: ");
1376 dump_generic_node (buffer
, gimple_omp_target_child_fn (gs
),
1378 pp_string (buffer
, " (");
1379 if (gimple_omp_target_data_arg (gs
))
1380 dump_generic_node (buffer
, gimple_omp_target_data_arg (gs
),
1383 pp_string (buffer
, "???");
1384 pp_string (buffer
, ")]");
1386 gimple_seq body
= gimple_omp_body (gs
);
1387 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
1389 newline_and_indent (buffer
, spc
+ 2);
1390 pp_left_brace (buffer
);
1391 pp_newline (buffer
);
1392 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
1393 newline_and_indent (buffer
, spc
+ 2);
1394 pp_right_brace (buffer
);
1398 pp_newline (buffer
);
1399 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
1404 /* Dump a GIMPLE_OMP_TEAMS tuple on the pretty_printer BUFFER. */
1407 dump_gimple_omp_teams (pretty_printer
*buffer
, gomp_teams
*gs
, int spc
,
1410 if (flags
& TDF_RAW
)
1412 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1413 gimple_omp_body (gs
));
1414 dump_omp_clauses (buffer
, gimple_omp_teams_clauses (gs
), spc
, flags
);
1415 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1419 pp_string (buffer
, "#pragma omp teams");
1420 dump_omp_clauses (buffer
, gimple_omp_teams_clauses (gs
), spc
, flags
);
1421 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1423 newline_and_indent (buffer
, spc
+ 2);
1424 pp_character (buffer
, '{');
1425 pp_newline (buffer
);
1426 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1427 newline_and_indent (buffer
, spc
+ 2);
1428 pp_character (buffer
, '}');
1433 /* Dump a GIMPLE_OMP_SECTIONS tuple on the pretty_printer BUFFER. */
1436 dump_gimple_omp_sections (pretty_printer
*buffer
, gomp_sections
*gs
,
1439 if (flags
& TDF_RAW
)
1441 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1442 gimple_omp_body (gs
));
1443 dump_omp_clauses (buffer
, gimple_omp_sections_clauses (gs
), spc
, flags
);
1444 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1448 pp_string (buffer
, "#pragma omp sections");
1449 if (gimple_omp_sections_control (gs
))
1451 pp_string (buffer
, " <");
1452 dump_generic_node (buffer
, gimple_omp_sections_control (gs
), spc
,
1454 pp_greater (buffer
);
1456 dump_omp_clauses (buffer
, gimple_omp_sections_clauses (gs
), spc
, flags
);
1457 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1459 newline_and_indent (buffer
, spc
+ 2);
1460 pp_left_brace (buffer
);
1461 pp_newline (buffer
);
1462 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1463 newline_and_indent (buffer
, spc
+ 2);
1464 pp_right_brace (buffer
);
1469 /* Dump a GIMPLE_OMP_{MASTER,TASKGROUP,ORDERED,SECTION} tuple on the
1470 pretty_printer BUFFER. */
1473 dump_gimple_omp_block (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1475 if (flags
& TDF_RAW
)
1476 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1477 gimple_omp_body (gs
));
1480 switch (gimple_code (gs
))
1482 case GIMPLE_OMP_MASTER
:
1483 pp_string (buffer
, "#pragma omp master");
1485 case GIMPLE_OMP_TASKGROUP
:
1486 pp_string (buffer
, "#pragma omp taskgroup");
1488 case GIMPLE_OMP_ORDERED
:
1489 pp_string (buffer
, "#pragma omp ordered");
1491 case GIMPLE_OMP_SECTION
:
1492 pp_string (buffer
, "#pragma omp section");
1497 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1499 newline_and_indent (buffer
, spc
+ 2);
1500 pp_left_brace (buffer
);
1501 pp_newline (buffer
);
1502 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1503 newline_and_indent (buffer
, spc
+ 2);
1504 pp_right_brace (buffer
);
1509 /* Dump a GIMPLE_OMP_CRITICAL tuple on the pretty_printer BUFFER. */
1512 dump_gimple_omp_critical (pretty_printer
*buffer
, gomp_critical
*gs
,
1515 if (flags
& TDF_RAW
)
1516 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1517 gimple_omp_body (gs
));
1520 pp_string (buffer
, "#pragma omp critical");
1521 if (gimple_omp_critical_name (gs
))
1523 pp_string (buffer
, " (");
1524 dump_generic_node (buffer
, gimple_omp_critical_name (gs
), spc
,
1526 pp_right_paren (buffer
);
1528 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1530 newline_and_indent (buffer
, spc
+ 2);
1531 pp_left_brace (buffer
);
1532 pp_newline (buffer
);
1533 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1534 newline_and_indent (buffer
, spc
+ 2);
1535 pp_right_brace (buffer
);
1540 /* Dump a GIMPLE_OMP_RETURN tuple on the pretty_printer BUFFER. */
1543 dump_gimple_omp_return (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1545 if (flags
& TDF_RAW
)
1547 dump_gimple_fmt (buffer
, spc
, flags
, "%G <nowait=%d", gs
,
1548 (int) gimple_omp_return_nowait_p (gs
));
1549 if (gimple_omp_return_lhs (gs
))
1550 dump_gimple_fmt (buffer
, spc
, flags
, ", lhs=%T>",
1551 gimple_omp_return_lhs (gs
));
1553 dump_gimple_fmt (buffer
, spc
, flags
, ">");
1557 pp_string (buffer
, "#pragma omp return");
1558 if (gimple_omp_return_nowait_p (gs
))
1559 pp_string (buffer
, "(nowait)");
1560 if (gimple_omp_return_lhs (gs
))
1562 pp_string (buffer
, " (set ");
1563 dump_generic_node (buffer
, gimple_omp_return_lhs (gs
),
1565 pp_character (buffer
, ')');
1570 /* Dump a GIMPLE_TRANSACTION tuple on the pretty_printer BUFFER. */
1573 dump_gimple_transaction (pretty_printer
*buffer
, gtransaction
*gs
,
1576 unsigned subcode
= gimple_transaction_subcode (gs
);
1578 if (flags
& TDF_RAW
)
1580 dump_gimple_fmt (buffer
, spc
, flags
,
1581 "%G [SUBCODE=%x,LABEL=%T] <%+BODY <%S> >",
1582 gs
, subcode
, gimple_transaction_label (gs
),
1583 gimple_transaction_body (gs
));
1587 if (subcode
& GTMA_IS_OUTER
)
1588 pp_string (buffer
, "__transaction_atomic [[outer]]");
1589 else if (subcode
& GTMA_IS_RELAXED
)
1590 pp_string (buffer
, "__transaction_relaxed");
1592 pp_string (buffer
, "__transaction_atomic");
1593 subcode
&= ~GTMA_DECLARATION_MASK
;
1595 if (subcode
|| gimple_transaction_label (gs
))
1597 pp_string (buffer
, " //");
1598 if (gimple_transaction_label (gs
))
1600 pp_string (buffer
, " LABEL=");
1601 dump_generic_node (buffer
, gimple_transaction_label (gs
),
1606 pp_string (buffer
, " SUBCODE=[ ");
1607 if (subcode
& GTMA_HAVE_ABORT
)
1609 pp_string (buffer
, "GTMA_HAVE_ABORT ");
1610 subcode
&= ~GTMA_HAVE_ABORT
;
1612 if (subcode
& GTMA_HAVE_LOAD
)
1614 pp_string (buffer
, "GTMA_HAVE_LOAD ");
1615 subcode
&= ~GTMA_HAVE_LOAD
;
1617 if (subcode
& GTMA_HAVE_STORE
)
1619 pp_string (buffer
, "GTMA_HAVE_STORE ");
1620 subcode
&= ~GTMA_HAVE_STORE
;
1622 if (subcode
& GTMA_MAY_ENTER_IRREVOCABLE
)
1624 pp_string (buffer
, "GTMA_MAY_ENTER_IRREVOCABLE ");
1625 subcode
&= ~GTMA_MAY_ENTER_IRREVOCABLE
;
1627 if (subcode
& GTMA_DOES_GO_IRREVOCABLE
)
1629 pp_string (buffer
, "GTMA_DOES_GO_IRREVOCABLE ");
1630 subcode
&= ~GTMA_DOES_GO_IRREVOCABLE
;
1632 if (subcode
& GTMA_HAS_NO_INSTRUMENTATION
)
1634 pp_string (buffer
, "GTMA_HAS_NO_INSTRUMENTATION ");
1635 subcode
&= ~GTMA_HAS_NO_INSTRUMENTATION
;
1638 pp_printf (buffer
, "0x%x ", subcode
);
1639 pp_right_bracket (buffer
);
1643 if (!gimple_seq_empty_p (gimple_transaction_body (gs
)))
1645 newline_and_indent (buffer
, spc
+ 2);
1646 pp_left_brace (buffer
);
1647 pp_newline (buffer
);
1648 dump_gimple_seq (buffer
, gimple_transaction_body (gs
),
1650 newline_and_indent (buffer
, spc
+ 2);
1651 pp_right_brace (buffer
);
1656 /* Dump a GIMPLE_ASM tuple on the pretty_printer BUFFER, SPC spaces of
1657 indent. FLAGS specifies details to show in the dump (see TDF_* in
1661 dump_gimple_asm (pretty_printer
*buffer
, gasm
*gs
, int spc
, int flags
)
1663 unsigned int i
, n
, f
, fields
;
1665 if (flags
& TDF_RAW
)
1667 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+STRING <%n%s%n>", gs
,
1668 gimple_asm_string (gs
));
1670 n
= gimple_asm_noutputs (gs
);
1673 newline_and_indent (buffer
, spc
+ 2);
1674 pp_string (buffer
, "OUTPUT: ");
1675 for (i
= 0; i
< n
; i
++)
1677 dump_generic_node (buffer
, gimple_asm_output_op (gs
, i
),
1680 pp_string (buffer
, ", ");
1684 n
= gimple_asm_ninputs (gs
);
1687 newline_and_indent (buffer
, spc
+ 2);
1688 pp_string (buffer
, "INPUT: ");
1689 for (i
= 0; i
< n
; i
++)
1691 dump_generic_node (buffer
, gimple_asm_input_op (gs
, i
),
1694 pp_string (buffer
, ", ");
1698 n
= gimple_asm_nclobbers (gs
);
1701 newline_and_indent (buffer
, spc
+ 2);
1702 pp_string (buffer
, "CLOBBER: ");
1703 for (i
= 0; i
< n
; i
++)
1705 dump_generic_node (buffer
, gimple_asm_clobber_op (gs
, i
),
1708 pp_string (buffer
, ", ");
1712 n
= gimple_asm_nlabels (gs
);
1715 newline_and_indent (buffer
, spc
+ 2);
1716 pp_string (buffer
, "LABEL: ");
1717 for (i
= 0; i
< n
; i
++)
1719 dump_generic_node (buffer
, gimple_asm_label_op (gs
, i
),
1722 pp_string (buffer
, ", ");
1726 newline_and_indent (buffer
, spc
);
1727 pp_greater (buffer
);
1731 pp_string (buffer
, "__asm__");
1732 if (gimple_asm_volatile_p (gs
))
1733 pp_string (buffer
, " __volatile__");
1734 if (gimple_asm_nlabels (gs
))
1735 pp_string (buffer
, " goto");
1736 pp_string (buffer
, "(\"");
1737 pp_string (buffer
, gimple_asm_string (gs
));
1738 pp_string (buffer
, "\"");
1740 if (gimple_asm_nlabels (gs
))
1742 else if (gimple_asm_nclobbers (gs
))
1744 else if (gimple_asm_ninputs (gs
))
1746 else if (gimple_asm_noutputs (gs
))
1751 for (f
= 0; f
< fields
; ++f
)
1753 pp_string (buffer
, " : ");
1758 n
= gimple_asm_noutputs (gs
);
1759 for (i
= 0; i
< n
; i
++)
1761 dump_generic_node (buffer
, gimple_asm_output_op (gs
, i
),
1764 pp_string (buffer
, ", ");
1769 n
= gimple_asm_ninputs (gs
);
1770 for (i
= 0; i
< n
; i
++)
1772 dump_generic_node (buffer
, gimple_asm_input_op (gs
, i
),
1775 pp_string (buffer
, ", ");
1780 n
= gimple_asm_nclobbers (gs
);
1781 for (i
= 0; i
< n
; i
++)
1783 dump_generic_node (buffer
, gimple_asm_clobber_op (gs
, i
),
1786 pp_string (buffer
, ", ");
1791 n
= gimple_asm_nlabels (gs
);
1792 for (i
= 0; i
< n
; i
++)
1794 dump_generic_node (buffer
, gimple_asm_label_op (gs
, i
),
1797 pp_string (buffer
, ", ");
1806 pp_string (buffer
, ");");
1810 /* Dump ptr_info and range_info for NODE on pretty_printer BUFFER with
1811 SPC spaces of indent. */
1814 dump_ssaname_info (pretty_printer
*buffer
, tree node
, int spc
)
1816 if (TREE_CODE (node
) != SSA_NAME
)
1819 if (POINTER_TYPE_P (TREE_TYPE (node
))
1820 && SSA_NAME_PTR_INFO (node
))
1822 unsigned int align
, misalign
;
1823 struct ptr_info_def
*pi
= SSA_NAME_PTR_INFO (node
);
1824 pp_string (buffer
, "# PT = ");
1825 pp_points_to_solution (buffer
, &pi
->pt
);
1826 newline_and_indent (buffer
, spc
);
1827 if (get_ptr_info_alignment (pi
, &align
, &misalign
))
1829 pp_printf (buffer
, "# ALIGN = %u, MISALIGN = %u", align
, misalign
);
1830 newline_and_indent (buffer
, spc
);
1834 if (!POINTER_TYPE_P (TREE_TYPE (node
))
1835 && SSA_NAME_RANGE_INFO (node
))
1837 wide_int min
, max
, nonzero_bits
;
1838 value_range_type range_type
= get_range_info (node
, &min
, &max
);
1840 if (range_type
== VR_VARYING
)
1841 pp_printf (buffer
, "# RANGE VR_VARYING");
1842 else if (range_type
== VR_RANGE
|| range_type
== VR_ANTI_RANGE
)
1844 pp_printf (buffer
, "# RANGE ");
1845 pp_printf (buffer
, "%s[", range_type
== VR_RANGE
? "" : "~");
1846 pp_wide_int (buffer
, min
, TYPE_SIGN (TREE_TYPE (node
)));
1847 pp_printf (buffer
, ", ");
1848 pp_wide_int (buffer
, max
, TYPE_SIGN (TREE_TYPE (node
)));
1849 pp_printf (buffer
, "]");
1851 nonzero_bits
= get_nonzero_bits (node
);
1852 if (nonzero_bits
!= -1)
1854 pp_string (buffer
, " NONZERO ");
1855 pp_wide_int (buffer
, nonzero_bits
, UNSIGNED
);
1857 newline_and_indent (buffer
, spc
);
1862 /* Dump a PHI node PHI. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1.
1863 The caller is responsible for calling pp_flush on BUFFER to finalize
1864 pretty printer. If COMMENT is true, print this after #. */
1867 dump_gimple_phi (pretty_printer
*buffer
, gphi
*phi
, int spc
, bool comment
,
1871 tree lhs
= gimple_phi_result (phi
);
1873 if (flags
& TDF_ALIAS
)
1874 dump_ssaname_info (buffer
, lhs
, spc
);
1877 pp_string (buffer
, "# ");
1879 if (flags
& TDF_RAW
)
1880 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, ", phi
,
1881 gimple_phi_result (phi
));
1884 dump_generic_node (buffer
, lhs
, spc
, flags
, false);
1885 pp_string (buffer
, " = PHI <");
1887 for (i
= 0; i
< gimple_phi_num_args (phi
); i
++)
1889 if ((flags
& TDF_LINENO
) && gimple_phi_arg_has_location (phi
, i
))
1890 dump_location (buffer
, gimple_phi_arg_location (phi
, i
));
1891 dump_generic_node (buffer
, gimple_phi_arg_def (phi
, i
), spc
, flags
,
1893 pp_left_paren (buffer
);
1894 pp_decimal_int (buffer
, gimple_phi_arg_edge (phi
, i
)->src
->index
);
1895 pp_right_paren (buffer
);
1896 if (i
< gimple_phi_num_args (phi
) - 1)
1897 pp_string (buffer
, ", ");
1899 pp_greater (buffer
);
1903 /* Dump a GIMPLE_OMP_PARALLEL tuple on the pretty_printer BUFFER, SPC spaces
1904 of indent. FLAGS specifies details to show in the dump (see TDF_* in
1908 dump_gimple_omp_parallel (pretty_printer
*buffer
, gomp_parallel
*gs
,
1911 if (flags
& TDF_RAW
)
1913 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1914 gimple_omp_body (gs
));
1915 dump_omp_clauses (buffer
, gimple_omp_parallel_clauses (gs
), spc
, flags
);
1916 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T%n>",
1917 gimple_omp_parallel_child_fn (gs
),
1918 gimple_omp_parallel_data_arg (gs
));
1923 pp_string (buffer
, "#pragma omp parallel");
1924 dump_omp_clauses (buffer
, gimple_omp_parallel_clauses (gs
), spc
, flags
);
1925 if (gimple_omp_parallel_child_fn (gs
))
1927 pp_string (buffer
, " [child fn: ");
1928 dump_generic_node (buffer
, gimple_omp_parallel_child_fn (gs
),
1930 pp_string (buffer
, " (");
1931 if (gimple_omp_parallel_data_arg (gs
))
1932 dump_generic_node (buffer
, gimple_omp_parallel_data_arg (gs
),
1935 pp_string (buffer
, "???");
1936 pp_string (buffer
, ")]");
1938 body
= gimple_omp_body (gs
);
1939 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
1941 newline_and_indent (buffer
, spc
+ 2);
1942 pp_left_brace (buffer
);
1943 pp_newline (buffer
);
1944 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
1945 newline_and_indent (buffer
, spc
+ 2);
1946 pp_right_brace (buffer
);
1950 pp_newline (buffer
);
1951 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
1957 /* Dump a GIMPLE_OMP_TASK tuple on the pretty_printer BUFFER, SPC spaces
1958 of indent. FLAGS specifies details to show in the dump (see TDF_* in
1962 dump_gimple_omp_task (pretty_printer
*buffer
, gomp_task
*gs
, int spc
,
1965 if (flags
& TDF_RAW
)
1967 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1968 gimple_omp_body (gs
));
1969 dump_omp_clauses (buffer
, gimple_omp_task_clauses (gs
), spc
, flags
);
1970 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T, %T, %T, %T%n>",
1971 gimple_omp_task_child_fn (gs
),
1972 gimple_omp_task_data_arg (gs
),
1973 gimple_omp_task_copy_fn (gs
),
1974 gimple_omp_task_arg_size (gs
),
1975 gimple_omp_task_arg_size (gs
));
1980 pp_string (buffer
, "#pragma omp task");
1981 dump_omp_clauses (buffer
, gimple_omp_task_clauses (gs
), spc
, flags
);
1982 if (gimple_omp_task_child_fn (gs
))
1984 pp_string (buffer
, " [child fn: ");
1985 dump_generic_node (buffer
, gimple_omp_task_child_fn (gs
),
1987 pp_string (buffer
, " (");
1988 if (gimple_omp_task_data_arg (gs
))
1989 dump_generic_node (buffer
, gimple_omp_task_data_arg (gs
),
1992 pp_string (buffer
, "???");
1993 pp_string (buffer
, ")]");
1995 body
= gimple_omp_body (gs
);
1996 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
1998 newline_and_indent (buffer
, spc
+ 2);
1999 pp_left_brace (buffer
);
2000 pp_newline (buffer
);
2001 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
2002 newline_and_indent (buffer
, spc
+ 2);
2003 pp_right_brace (buffer
);
2007 pp_newline (buffer
);
2008 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
2014 /* Dump a GIMPLE_OMP_ATOMIC_LOAD tuple on the pretty_printer BUFFER, SPC
2015 spaces of indent. FLAGS specifies details to show in the dump (see TDF_*
2019 dump_gimple_omp_atomic_load (pretty_printer
*buffer
, gomp_atomic_load
*gs
,
2022 if (flags
& TDF_RAW
)
2024 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T>", gs
,
2025 gimple_omp_atomic_load_lhs (gs
),
2026 gimple_omp_atomic_load_rhs (gs
));
2030 pp_string (buffer
, "#pragma omp atomic_load");
2031 if (gimple_omp_atomic_seq_cst_p (gs
))
2032 pp_string (buffer
, " seq_cst");
2033 if (gimple_omp_atomic_need_value_p (gs
))
2034 pp_string (buffer
, " [needed]");
2035 newline_and_indent (buffer
, spc
+ 2);
2036 dump_generic_node (buffer
, gimple_omp_atomic_load_lhs (gs
),
2042 dump_generic_node (buffer
, gimple_omp_atomic_load_rhs (gs
),
2047 /* Dump a GIMPLE_OMP_ATOMIC_STORE tuple on the pretty_printer BUFFER, SPC
2048 spaces of indent. FLAGS specifies details to show in the dump (see TDF_*
2052 dump_gimple_omp_atomic_store (pretty_printer
*buffer
,
2053 gomp_atomic_store
*gs
, int spc
, int flags
)
2055 if (flags
& TDF_RAW
)
2057 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
,
2058 gimple_omp_atomic_store_val (gs
));
2062 pp_string (buffer
, "#pragma omp atomic_store ");
2063 if (gimple_omp_atomic_seq_cst_p (gs
))
2064 pp_string (buffer
, "seq_cst ");
2065 if (gimple_omp_atomic_need_value_p (gs
))
2066 pp_string (buffer
, "[needed] ");
2067 pp_left_paren (buffer
);
2068 dump_generic_node (buffer
, gimple_omp_atomic_store_val (gs
),
2070 pp_right_paren (buffer
);
2075 /* Dump all the memory operands for statement GS. BUFFER, SPC and
2076 FLAGS are as in pp_gimple_stmt_1. */
2079 dump_gimple_mem_ops (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
2081 tree vdef
= gimple_vdef (gs
);
2082 tree vuse
= gimple_vuse (gs
);
2084 if (vdef
!= NULL_TREE
)
2086 pp_string (buffer
, "# ");
2087 dump_generic_node (buffer
, vdef
, spc
+ 2, flags
, false);
2088 pp_string (buffer
, " = VDEF <");
2089 dump_generic_node (buffer
, vuse
, spc
+ 2, flags
, false);
2090 pp_greater (buffer
);
2091 newline_and_indent (buffer
, spc
);
2093 else if (vuse
!= NULL_TREE
)
2095 pp_string (buffer
, "# VUSE <");
2096 dump_generic_node (buffer
, vuse
, spc
+ 2, flags
, false);
2097 pp_greater (buffer
);
2098 newline_and_indent (buffer
, spc
);
2103 /* Print the gimple statement GS on the pretty printer BUFFER, SPC
2104 spaces of indent. FLAGS specifies details to show in the dump (see
2105 TDF_* in dumpfile.h). The caller is responsible for calling
2106 pp_flush on BUFFER to finalize the pretty printer. */
2109 pp_gimple_stmt_1 (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
2114 if (flags
& TDF_STMTADDR
)
2115 pp_printf (buffer
, "<&%p> ", (void *) gs
);
2117 if ((flags
& TDF_LINENO
) && gimple_has_location (gs
))
2118 dump_location (buffer
, gimple_location (gs
));
2122 int lp_nr
= lookup_stmt_eh_lp (gs
);
2124 pp_printf (buffer
, "[LP %d] ", lp_nr
);
2126 pp_printf (buffer
, "[MNT %d] ", -lp_nr
);
2129 if ((flags
& (TDF_VOPS
|TDF_MEMSYMS
))
2130 && gimple_has_mem_ops (gs
))
2131 dump_gimple_mem_ops (buffer
, gs
, spc
, flags
);
2133 if (gimple_has_lhs (gs
)
2134 && (flags
& TDF_ALIAS
))
2135 dump_ssaname_info (buffer
, gimple_get_lhs (gs
), spc
);
2137 switch (gimple_code (gs
))
2140 dump_gimple_asm (buffer
, as_a
<gasm
*> (gs
), spc
, flags
);
2144 dump_gimple_assign (buffer
, as_a
<gassign
*> (gs
), spc
, flags
);
2148 dump_gimple_bind (buffer
, as_a
<gbind
*> (gs
), spc
, flags
);
2152 dump_gimple_call (buffer
, as_a
<gcall
*> (gs
), spc
, flags
);
2156 dump_gimple_cond (buffer
, as_a
<gcond
*> (gs
), spc
, flags
);
2160 dump_gimple_label (buffer
, as_a
<glabel
*> (gs
), spc
, flags
);
2164 dump_gimple_goto (buffer
, as_a
<ggoto
*> (gs
), spc
, flags
);
2168 pp_string (buffer
, "GIMPLE_NOP");
2172 dump_gimple_return (buffer
, as_a
<greturn
*> (gs
), spc
, flags
);
2176 dump_gimple_switch (buffer
, as_a
<gswitch
*> (gs
), spc
, flags
);
2180 dump_gimple_try (buffer
, as_a
<gtry
*> (gs
), spc
, flags
);
2184 dump_gimple_phi (buffer
, as_a
<gphi
*> (gs
), spc
, false, flags
);
2187 case GIMPLE_OMP_PARALLEL
:
2188 dump_gimple_omp_parallel (buffer
, as_a
<gomp_parallel
*> (gs
), spc
,
2192 case GIMPLE_OMP_TASK
:
2193 dump_gimple_omp_task (buffer
, as_a
<gomp_task
*> (gs
), spc
, flags
);
2196 case GIMPLE_OMP_ATOMIC_LOAD
:
2197 dump_gimple_omp_atomic_load (buffer
, as_a
<gomp_atomic_load
*> (gs
),
2201 case GIMPLE_OMP_ATOMIC_STORE
:
2202 dump_gimple_omp_atomic_store (buffer
,
2203 as_a
<gomp_atomic_store
*> (gs
),
2207 case GIMPLE_OMP_FOR
:
2208 dump_gimple_omp_for (buffer
, as_a
<gomp_for
*> (gs
), spc
, flags
);
2211 case GIMPLE_OMP_CONTINUE
:
2212 dump_gimple_omp_continue (buffer
, as_a
<gomp_continue
*> (gs
), spc
,
2216 case GIMPLE_OMP_SINGLE
:
2217 dump_gimple_omp_single (buffer
, as_a
<gomp_single
*> (gs
), spc
,
2221 case GIMPLE_OMP_TARGET
:
2222 dump_gimple_omp_target (buffer
, as_a
<gomp_target
*> (gs
), spc
,
2226 case GIMPLE_OMP_TEAMS
:
2227 dump_gimple_omp_teams (buffer
, as_a
<gomp_teams
*> (gs
), spc
,
2231 case GIMPLE_OMP_RETURN
:
2232 dump_gimple_omp_return (buffer
, gs
, spc
, flags
);
2235 case GIMPLE_OMP_SECTIONS
:
2236 dump_gimple_omp_sections (buffer
, as_a
<gomp_sections
*> (gs
),
2240 case GIMPLE_OMP_SECTIONS_SWITCH
:
2241 pp_string (buffer
, "GIMPLE_SECTIONS_SWITCH");
2244 case GIMPLE_OMP_MASTER
:
2245 case GIMPLE_OMP_TASKGROUP
:
2246 case GIMPLE_OMP_ORDERED
:
2247 case GIMPLE_OMP_SECTION
:
2248 dump_gimple_omp_block (buffer
, gs
, spc
, flags
);
2251 case GIMPLE_OMP_CRITICAL
:
2252 dump_gimple_omp_critical (buffer
, as_a
<gomp_critical
*> (gs
), spc
,
2257 dump_gimple_catch (buffer
, as_a
<gcatch
*> (gs
), spc
, flags
);
2260 case GIMPLE_EH_FILTER
:
2261 dump_gimple_eh_filter (buffer
, as_a
<geh_filter
*> (gs
), spc
, flags
);
2264 case GIMPLE_EH_MUST_NOT_THROW
:
2265 dump_gimple_eh_must_not_throw (buffer
,
2266 as_a
<geh_mnt
*> (gs
),
2270 case GIMPLE_EH_ELSE
:
2271 dump_gimple_eh_else (buffer
, as_a
<geh_else
*> (gs
), spc
, flags
);
2275 dump_gimple_resx (buffer
, as_a
<gresx
*> (gs
), spc
, flags
);
2278 case GIMPLE_EH_DISPATCH
:
2279 dump_gimple_eh_dispatch (buffer
, as_a
<geh_dispatch
*> (gs
), spc
,
2284 dump_gimple_debug (buffer
, as_a
<gdebug
*> (gs
), spc
, flags
);
2287 case GIMPLE_PREDICT
:
2288 pp_string (buffer
, "// predicted ");
2289 if (gimple_predict_outcome (gs
))
2290 pp_string (buffer
, "likely by ");
2292 pp_string (buffer
, "unlikely by ");
2293 pp_string (buffer
, predictor_name (gimple_predict_predictor (gs
)));
2294 pp_string (buffer
, " predictor.");
2297 case GIMPLE_TRANSACTION
:
2298 dump_gimple_transaction (buffer
, as_a
<gtransaction
*> (gs
), spc
,
2308 /* Dumps header of basic block BB to OUTF indented by INDENT
2309 spaces and details described by flags. */
2312 dump_gimple_bb_header (FILE *outf
, basic_block bb
, int indent
, int flags
)
2314 if (flags
& TDF_BLOCKS
)
2316 if (flags
& TDF_LINENO
)
2318 gimple_stmt_iterator gsi
;
2320 if (flags
& TDF_COMMENT
)
2321 fputs (";; ", outf
);
2323 for (gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
); gsi_next (&gsi
))
2324 if (!is_gimple_debug (gsi_stmt (gsi
))
2325 && get_lineno (gsi_stmt (gsi
)) != UNKNOWN_LOCATION
)
2327 fprintf (outf
, "%*sstarting at line %d",
2328 indent
, "", get_lineno (gsi_stmt (gsi
)));
2331 if (bb
->discriminator
)
2332 fprintf (outf
, ", discriminator %i", bb
->discriminator
);
2338 gimple stmt
= first_stmt (bb
);
2339 if (!stmt
|| gimple_code (stmt
) != GIMPLE_LABEL
)
2340 fprintf (outf
, "%*s<bb %d>:\n", indent
, "", bb
->index
);
2345 /* Dumps end of basic block BB to buffer BUFFER indented by INDENT
2349 dump_gimple_bb_footer (FILE *outf ATTRIBUTE_UNUSED
,
2350 basic_block bb ATTRIBUTE_UNUSED
,
2351 int indent ATTRIBUTE_UNUSED
,
2352 int flags ATTRIBUTE_UNUSED
)
2354 /* There is currently no GIMPLE-specific basic block info to dump. */
2359 /* Dump PHI nodes of basic block BB to BUFFER with details described
2360 by FLAGS and indented by INDENT spaces. */
2363 dump_phi_nodes (pretty_printer
*buffer
, basic_block bb
, int indent
, int flags
)
2367 for (i
= gsi_start_phis (bb
); !gsi_end_p (i
); gsi_next (&i
))
2369 gphi
*phi
= i
.phi ();
2370 if (!virtual_operand_p (gimple_phi_result (phi
)) || (flags
& TDF_VOPS
))
2373 dump_gimple_phi (buffer
, phi
, indent
, true, flags
);
2374 pp_newline (buffer
);
2380 /* Dump jump to basic block BB that is represented implicitly in the cfg
2384 pp_cfg_jump (pretty_printer
*buffer
, basic_block bb
)
2388 stmt
= first_stmt (bb
);
2390 pp_string (buffer
, "goto <bb ");
2391 pp_decimal_int (buffer
, bb
->index
);
2392 pp_greater (buffer
);
2393 if (stmt
&& gimple_code (stmt
) == GIMPLE_LABEL
)
2395 pp_string (buffer
, " (");
2396 dump_generic_node (buffer
,
2397 gimple_label_label (as_a
<glabel
*> (stmt
)),
2399 pp_right_paren (buffer
);
2400 pp_semicolon (buffer
);
2403 pp_semicolon (buffer
);
2407 /* Dump edges represented implicitly in basic block BB to BUFFER, indented
2408 by INDENT spaces, with details given by FLAGS. */
2411 dump_implicit_edges (pretty_printer
*buffer
, basic_block bb
, int indent
,
2417 stmt
= last_stmt (bb
);
2419 if (stmt
&& gimple_code (stmt
) == GIMPLE_COND
)
2421 edge true_edge
, false_edge
;
2423 /* When we are emitting the code or changing CFG, it is possible that
2424 the edges are not yet created. When we are using debug_bb in such
2425 a situation, we do not want it to crash. */
2426 if (EDGE_COUNT (bb
->succs
) != 2)
2428 extract_true_false_edges_from_block (bb
, &true_edge
, &false_edge
);
2430 INDENT (indent
+ 2);
2431 pp_cfg_jump (buffer
, true_edge
->dest
);
2432 newline_and_indent (buffer
, indent
);
2433 pp_string (buffer
, "else");
2434 newline_and_indent (buffer
, indent
+ 2);
2435 pp_cfg_jump (buffer
, false_edge
->dest
);
2436 pp_newline (buffer
);
2440 /* If there is a fallthru edge, we may need to add an artificial
2441 goto to the dump. */
2442 e
= find_fallthru_edge (bb
->succs
);
2444 if (e
&& e
->dest
!= bb
->next_bb
)
2448 if ((flags
& TDF_LINENO
)
2449 && e
->goto_locus
!= UNKNOWN_LOCATION
)
2450 dump_location (buffer
, e
->goto_locus
);
2452 pp_cfg_jump (buffer
, e
->dest
);
2453 pp_newline (buffer
);
2458 /* Dumps basic block BB to buffer BUFFER with details described by FLAGS and
2459 indented by INDENT spaces. */
2462 gimple_dump_bb_buff (pretty_printer
*buffer
, basic_block bb
, int indent
,
2465 gimple_stmt_iterator gsi
;
2467 int label_indent
= indent
- 2;
2469 if (label_indent
< 0)
2472 dump_phi_nodes (buffer
, bb
, indent
, flags
);
2474 for (gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
); gsi_next (&gsi
))
2478 stmt
= gsi_stmt (gsi
);
2480 curr_indent
= gimple_code (stmt
) == GIMPLE_LABEL
? label_indent
: indent
;
2482 INDENT (curr_indent
);
2483 pp_gimple_stmt_1 (buffer
, stmt
, curr_indent
, flags
);
2484 pp_newline_and_flush (buffer
);
2485 gcc_checking_assert (DECL_STRUCT_FUNCTION (current_function_decl
));
2486 dump_histograms_for_stmt (DECL_STRUCT_FUNCTION (current_function_decl
),
2487 pp_buffer (buffer
)->stream
, stmt
);
2490 dump_implicit_edges (buffer
, bb
, indent
, flags
);
2495 /* Dumps basic block BB to FILE with details described by FLAGS and
2496 indented by INDENT spaces. */
2499 gimple_dump_bb (FILE *file
, basic_block bb
, int indent
, int flags
)
2501 dump_gimple_bb_header (file
, bb
, indent
, flags
);
2502 if (bb
->index
>= NUM_FIXED_BLOCKS
)
2504 pretty_printer buffer
;
2505 pp_needs_newline (&buffer
) = true;
2506 buffer
.buffer
->stream
= file
;
2507 gimple_dump_bb_buff (&buffer
, bb
, indent
, flags
);
2509 dump_gimple_bb_footer (file
, bb
, indent
, flags
);
2512 /* Dumps basic block BB to pretty-printer PP with default dump flags and
2513 no indentation, for use as a label of a DOT graph record-node.
2514 ??? Should just use gimple_dump_bb_buff here, except that value profiling
2515 histogram dumping doesn't know about pretty-printers. */
2518 gimple_dump_bb_for_graph (pretty_printer
*pp
, basic_block bb
)
2520 pp_printf (pp
, "<bb %d>:\n", bb
->index
);
2521 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
2523 for (gphi_iterator gsi
= gsi_start_phis (bb
); !gsi_end_p (gsi
);
2526 gphi
*phi
= gsi
.phi ();
2527 if (!virtual_operand_p (gimple_phi_result (phi
))
2528 || (dump_flags
& TDF_VOPS
))
2531 pp_write_text_to_stream (pp
);
2532 pp_string (pp
, "# ");
2533 pp_gimple_stmt_1 (pp
, phi
, 0, dump_flags
);
2535 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
2539 for (gimple_stmt_iterator gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
);
2542 gimple stmt
= gsi_stmt (gsi
);
2544 pp_write_text_to_stream (pp
);
2545 pp_gimple_stmt_1 (pp
, stmt
, 0, dump_flags
);
2547 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
2549 dump_implicit_edges (pp
, bb
, 0, dump_flags
);
2550 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);