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"
28 #include "gimple-predict.h"
31 #include "gimple-pretty-print.h"
32 #include "internal-fn.h"
34 #include "gimple-iterator.h"
36 #include "dumpfile.h" /* for dump_flags */
37 #include "value-prof.h"
38 #include "trans-mem.h"
40 #define INDENT(SPACE) \
41 do { int i; for (i = 0; i < SPACE; i++) pp_space (buffer); } while (0)
43 #define GIMPLE_NIY do_niy (buffer,gs)
45 /* Try to print on BUFFER a default message for the unrecognized
46 gimple statement GS. */
49 do_niy (pretty_printer
*buffer
, gimple
*gs
)
51 pp_printf (buffer
, "<<< Unknown GIMPLE statement: %s >>>\n",
52 gimple_code_name
[(int) gimple_code (gs
)]);
56 /* Emit a newline and SPC indentation spaces to BUFFER. */
59 newline_and_indent (pretty_printer
*buffer
, int spc
)
66 /* Print the GIMPLE statement GS on stderr. */
69 debug_gimple_stmt (gimple
*gs
)
71 print_gimple_stmt (stderr
, gs
, 0, TDF_VOPS
|TDF_MEMSYMS
);
75 /* Print GIMPLE statement G to FILE using SPC indentation spaces and
76 FLAGS as in pp_gimple_stmt_1. */
79 print_gimple_stmt (FILE *file
, gimple
*g
, int spc
, int flags
)
81 pretty_printer buffer
;
82 pp_needs_newline (&buffer
) = true;
83 buffer
.buffer
->stream
= file
;
84 pp_gimple_stmt_1 (&buffer
, g
, spc
, flags
);
85 pp_newline_and_flush (&buffer
);
91 print_gimple_stmt (stderr
, &ref
, 0, 0);
100 fprintf (stderr
, "<nil>\n");
104 /* Print GIMPLE statement G to FILE using SPC indentation spaces and
105 FLAGS as in pp_gimple_stmt_1. Print only the right-hand side
109 print_gimple_expr (FILE *file
, gimple
*g
, int spc
, int flags
)
111 flags
|= TDF_RHS_ONLY
;
112 pretty_printer buffer
;
113 pp_needs_newline (&buffer
) = true;
114 buffer
.buffer
->stream
= file
;
115 pp_gimple_stmt_1 (&buffer
, g
, spc
, flags
);
120 /* Print the GIMPLE sequence SEQ on BUFFER using SPC indentation
121 spaces and FLAGS as in pp_gimple_stmt_1.
122 The caller is responsible for calling pp_flush on BUFFER to finalize
123 the pretty printer. */
126 dump_gimple_seq (pretty_printer
*buffer
, gimple_seq seq
, int spc
, int flags
)
128 gimple_stmt_iterator i
;
130 for (i
= gsi_start (seq
); !gsi_end_p (i
); gsi_next (&i
))
132 gimple
*gs
= gsi_stmt (i
);
134 pp_gimple_stmt_1 (buffer
, gs
, spc
, flags
);
135 if (!gsi_one_before_end_p (i
))
141 /* Print GIMPLE sequence SEQ to FILE using SPC indentation spaces and
142 FLAGS as in pp_gimple_stmt_1. */
145 print_gimple_seq (FILE *file
, gimple_seq seq
, int spc
, int flags
)
147 pretty_printer buffer
;
148 pp_needs_newline (&buffer
) = true;
149 buffer
.buffer
->stream
= file
;
150 dump_gimple_seq (&buffer
, seq
, spc
, flags
);
151 pp_newline_and_flush (&buffer
);
155 /* Print the GIMPLE sequence SEQ on stderr. */
158 debug_gimple_seq (gimple_seq seq
)
160 print_gimple_seq (stderr
, seq
, 0, TDF_VOPS
|TDF_MEMSYMS
);
164 /* A simple helper to pretty-print some of the gimple tuples in the printf
165 style. The format modifiers are preceded by '%' and are:
166 'G' - outputs a string corresponding to the code of the given gimple,
167 'S' - outputs a gimple_seq with indent of spc + 2,
168 'T' - outputs the tree t,
169 'd' - outputs an int as a decimal,
170 's' - outputs a string,
171 'n' - outputs a newline,
172 'x' - outputs an int as hexadecimal,
173 '+' - increases indent by 2 then outputs a newline,
174 '-' - decreases indent by 2 then outputs a newline. */
177 dump_gimple_fmt (pretty_printer
*buffer
, int spc
, int flags
,
178 const char *fmt
, ...)
184 va_start (args
, fmt
);
185 for (c
= fmt
; *c
; c
++)
195 g
= va_arg (args
, gimple
*);
196 tmp
= gimple_code_name
[gimple_code (g
)];
197 pp_string (buffer
, tmp
);
201 seq
= va_arg (args
, gimple_seq
);
203 dump_gimple_seq (buffer
, seq
, spc
+ 2, flags
);
204 newline_and_indent (buffer
, spc
);
208 t
= va_arg (args
, tree
);
210 pp_string (buffer
, "NULL");
212 dump_generic_node (buffer
, t
, spc
, flags
, false);
216 pp_decimal_int (buffer
, va_arg (args
, int));
220 pp_string (buffer
, va_arg (args
, char *));
224 newline_and_indent (buffer
, spc
);
228 pp_scalar (buffer
, "%x", va_arg (args
, int));
233 newline_and_indent (buffer
, spc
);
238 newline_and_indent (buffer
, spc
);
246 pp_character (buffer
, *c
);
252 /* Helper for dump_gimple_assign. Print the unary RHS of the
253 assignment GS. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. */
256 dump_unary_rhs (pretty_printer
*buffer
, gassign
*gs
, int spc
, int flags
)
258 enum tree_code rhs_code
= gimple_assign_rhs_code (gs
);
259 tree lhs
= gimple_assign_lhs (gs
);
260 tree rhs
= gimple_assign_rhs1 (gs
);
264 case VIEW_CONVERT_EXPR
:
266 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
269 case FIXED_CONVERT_EXPR
:
270 case ADDR_SPACE_CONVERT_EXPR
:
274 pp_left_paren (buffer
);
275 dump_generic_node (buffer
, TREE_TYPE (lhs
), spc
, flags
, false);
276 pp_string (buffer
, ") ");
277 if (op_prio (rhs
) < op_code_prio (rhs_code
))
279 pp_left_paren (buffer
);
280 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
281 pp_right_paren (buffer
);
284 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
288 pp_string (buffer
, "((");
289 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
290 pp_string (buffer
, "))");
294 pp_string (buffer
, "ABS_EXPR <");
295 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
300 if (TREE_CODE_CLASS (rhs_code
) == tcc_declaration
301 || TREE_CODE_CLASS (rhs_code
) == tcc_constant
302 || TREE_CODE_CLASS (rhs_code
) == tcc_reference
303 || rhs_code
== SSA_NAME
304 || rhs_code
== ADDR_EXPR
305 || rhs_code
== CONSTRUCTOR
)
307 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
310 else if (rhs_code
== BIT_NOT_EXPR
)
311 pp_complement (buffer
);
312 else if (rhs_code
== TRUTH_NOT_EXPR
)
313 pp_exclamation (buffer
);
314 else if (rhs_code
== NEGATE_EXPR
)
318 pp_left_bracket (buffer
);
319 pp_string (buffer
, get_tree_code_name (rhs_code
));
320 pp_string (buffer
, "] ");
323 if (op_prio (rhs
) < op_code_prio (rhs_code
))
325 pp_left_paren (buffer
);
326 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
327 pp_right_paren (buffer
);
330 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
336 /* Helper for dump_gimple_assign. Print the binary RHS of the
337 assignment GS. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. */
340 dump_binary_rhs (pretty_printer
*buffer
, gassign
*gs
, int spc
, int flags
)
343 enum tree_code code
= gimple_assign_rhs_code (gs
);
349 case VEC_WIDEN_MULT_HI_EXPR
:
350 case VEC_WIDEN_MULT_LO_EXPR
:
351 case VEC_WIDEN_MULT_EVEN_EXPR
:
352 case VEC_WIDEN_MULT_ODD_EXPR
:
353 case VEC_PACK_TRUNC_EXPR
:
354 case VEC_PACK_SAT_EXPR
:
355 case VEC_PACK_FIX_TRUNC_EXPR
:
356 case VEC_WIDEN_LSHIFT_HI_EXPR
:
357 case VEC_WIDEN_LSHIFT_LO_EXPR
:
358 for (p
= get_tree_code_name (code
); *p
; p
++)
359 pp_character (buffer
, TOUPPER (*p
));
360 pp_string (buffer
, " <");
361 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
362 pp_string (buffer
, ", ");
363 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
368 if (op_prio (gimple_assign_rhs1 (gs
)) <= op_code_prio (code
))
370 pp_left_paren (buffer
);
371 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
,
373 pp_right_paren (buffer
);
376 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
378 pp_string (buffer
, op_symbol_code (gimple_assign_rhs_code (gs
)));
380 if (op_prio (gimple_assign_rhs2 (gs
)) <= op_code_prio (code
))
382 pp_left_paren (buffer
);
383 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
,
385 pp_right_paren (buffer
);
388 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
392 /* Helper for dump_gimple_assign. Print the ternary RHS of the
393 assignment GS. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. */
396 dump_ternary_rhs (pretty_printer
*buffer
, gassign
*gs
, int spc
, int flags
)
399 enum tree_code code
= gimple_assign_rhs_code (gs
);
402 case WIDEN_MULT_PLUS_EXPR
:
403 case WIDEN_MULT_MINUS_EXPR
:
404 for (p
= get_tree_code_name (code
); *p
; p
++)
405 pp_character (buffer
, TOUPPER (*p
));
406 pp_string (buffer
, " <");
407 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
408 pp_string (buffer
, ", ");
409 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
410 pp_string (buffer
, ", ");
411 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
416 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
417 pp_string (buffer
, " * ");
418 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
419 pp_string (buffer
, " + ");
420 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
424 pp_string (buffer
, "DOT_PROD_EXPR <");
425 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
426 pp_string (buffer
, ", ");
427 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
428 pp_string (buffer
, ", ");
429 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
434 pp_string (buffer
, "SAD_EXPR <");
435 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
436 pp_string (buffer
, ", ");
437 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
438 pp_string (buffer
, ", ");
439 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
444 pp_string (buffer
, "VEC_PERM_EXPR <");
445 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
446 pp_string (buffer
, ", ");
447 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
448 pp_string (buffer
, ", ");
449 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
453 case REALIGN_LOAD_EXPR
:
454 pp_string (buffer
, "REALIGN_LOAD <");
455 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
456 pp_string (buffer
, ", ");
457 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
458 pp_string (buffer
, ", ");
459 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
464 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
465 pp_string (buffer
, " ? ");
466 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
467 pp_string (buffer
, " : ");
468 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
472 pp_string (buffer
, "VEC_COND_EXPR <");
473 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
474 pp_string (buffer
, ", ");
475 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
476 pp_string (buffer
, ", ");
477 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
487 /* Dump the gimple assignment GS. BUFFER, SPC and FLAGS are as in
491 dump_gimple_assign (pretty_printer
*buffer
, gassign
*gs
, int spc
, int flags
)
498 switch (gimple_num_ops (gs
))
501 arg3
= gimple_assign_rhs3 (gs
);
503 arg2
= gimple_assign_rhs2 (gs
);
505 arg1
= gimple_assign_rhs1 (gs
);
511 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%s, %T, %T, %T, %T>", gs
,
512 get_tree_code_name (gimple_assign_rhs_code (gs
)),
513 gimple_assign_lhs (gs
), arg1
, arg2
, arg3
);
517 if (!(flags
& TDF_RHS_ONLY
))
519 dump_generic_node (buffer
, gimple_assign_lhs (gs
), spc
, flags
, false);
523 if (gimple_assign_nontemporal_move_p (gs
))
524 pp_string (buffer
, "{nt}");
526 if (gimple_has_volatile_ops (gs
))
527 pp_string (buffer
, "{v}");
532 if (gimple_num_ops (gs
) == 2)
533 dump_unary_rhs (buffer
, gs
, spc
, flags
);
534 else if (gimple_num_ops (gs
) == 3)
535 dump_binary_rhs (buffer
, gs
, spc
, flags
);
536 else if (gimple_num_ops (gs
) == 4)
537 dump_ternary_rhs (buffer
, gs
, spc
, flags
);
540 if (!(flags
& TDF_RHS_ONLY
))
541 pp_semicolon (buffer
);
546 /* Dump the return statement GS. BUFFER, SPC and FLAGS are as in
550 dump_gimple_return (pretty_printer
*buffer
, greturn
*gs
, int spc
, int flags
)
554 t
= gimple_return_retval (gs
);
555 t2
= gimple_return_retbnd (gs
);
557 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T %T>", gs
, t
, t2
);
560 pp_string (buffer
, "return");
564 dump_generic_node (buffer
, t
, spc
, flags
, false);
568 pp_string (buffer
, ", ");
569 dump_generic_node (buffer
, t2
, spc
, flags
, false);
571 pp_semicolon (buffer
);
576 /* Dump the call arguments for a gimple call. BUFFER, FLAGS are as in
580 dump_gimple_call_args (pretty_printer
*buffer
, gcall
*gs
, int flags
)
584 for (i
= 0; i
< gimple_call_num_args (gs
); i
++)
586 dump_generic_node (buffer
, gimple_call_arg (gs
, i
), 0, flags
, false);
587 if (i
< gimple_call_num_args (gs
) - 1)
588 pp_string (buffer
, ", ");
591 if (gimple_call_va_arg_pack_p (gs
))
593 if (gimple_call_num_args (gs
) > 0)
599 pp_string (buffer
, "__builtin_va_arg_pack ()");
603 /* Dump the points-to solution *PT to BUFFER. */
606 pp_points_to_solution (pretty_printer
*buffer
, struct pt_solution
*pt
)
610 pp_string (buffer
, "anything ");
614 pp_string (buffer
, "nonlocal ");
616 pp_string (buffer
, "escaped ");
618 pp_string (buffer
, "unit-escaped ");
620 pp_string (buffer
, "null ");
622 && !bitmap_empty_p (pt
->vars
))
626 pp_string (buffer
, "{ ");
627 EXECUTE_IF_SET_IN_BITMAP (pt
->vars
, 0, i
, bi
)
629 pp_string (buffer
, "D.");
630 pp_decimal_int (buffer
, i
);
633 pp_right_brace (buffer
);
634 if (pt
->vars_contains_nonlocal
635 && pt
->vars_contains_escaped_heap
)
636 pp_string (buffer
, " (nonlocal, escaped heap)");
637 else if (pt
->vars_contains_nonlocal
638 && pt
->vars_contains_escaped
)
639 pp_string (buffer
, " (nonlocal, escaped)");
640 else if (pt
->vars_contains_nonlocal
)
641 pp_string (buffer
, " (nonlocal)");
642 else if (pt
->vars_contains_escaped_heap
)
643 pp_string (buffer
, " (escaped heap)");
644 else if (pt
->vars_contains_escaped
)
645 pp_string (buffer
, " (escaped)");
649 /* Dump the call statement GS. BUFFER, SPC and FLAGS are as in
653 dump_gimple_call (pretty_printer
*buffer
, gcall
*gs
, int spc
, int flags
)
655 tree lhs
= gimple_call_lhs (gs
);
656 tree fn
= gimple_call_fn (gs
);
658 if (flags
& TDF_ALIAS
)
660 struct pt_solution
*pt
;
661 pt
= gimple_call_use_set (gs
);
662 if (!pt_solution_empty_p (pt
))
664 pp_string (buffer
, "# USE = ");
665 pp_points_to_solution (buffer
, pt
);
666 newline_and_indent (buffer
, spc
);
668 pt
= gimple_call_clobber_set (gs
);
669 if (!pt_solution_empty_p (pt
))
671 pp_string (buffer
, "# CLB = ");
672 pp_points_to_solution (buffer
, pt
);
673 newline_and_indent (buffer
, spc
);
679 if (gimple_call_internal_p (gs
))
680 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%s, %T", gs
,
681 internal_fn_name (gimple_call_internal_fn (gs
)), lhs
);
683 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T", gs
, fn
, lhs
);
684 if (gimple_call_num_args (gs
) > 0)
686 pp_string (buffer
, ", ");
687 dump_gimple_call_args (buffer
, gs
, flags
);
693 if (lhs
&& !(flags
& TDF_RHS_ONLY
))
695 dump_generic_node (buffer
, lhs
, spc
, flags
, false);
696 pp_string (buffer
, " =");
698 if (gimple_has_volatile_ops (gs
))
699 pp_string (buffer
, "{v}");
703 if (gimple_call_internal_p (gs
))
704 pp_string (buffer
, internal_fn_name (gimple_call_internal_fn (gs
)));
706 print_call_name (buffer
, fn
, flags
);
707 pp_string (buffer
, " (");
708 dump_gimple_call_args (buffer
, gs
, flags
);
709 pp_right_paren (buffer
);
710 if (!(flags
& TDF_RHS_ONLY
))
711 pp_semicolon (buffer
);
714 if (gimple_call_chain (gs
))
716 pp_string (buffer
, " [static-chain: ");
717 dump_generic_node (buffer
, gimple_call_chain (gs
), spc
, flags
, false);
718 pp_right_bracket (buffer
);
721 if (gimple_call_return_slot_opt_p (gs
))
722 pp_string (buffer
, " [return slot optimization]");
723 if (gimple_call_tail_p (gs
))
724 pp_string (buffer
, " [tail call]");
729 /* Dump the arguments of _ITM_beginTransaction sanely. */
730 if (TREE_CODE (fn
) == ADDR_EXPR
)
731 fn
= TREE_OPERAND (fn
, 0);
732 if (TREE_CODE (fn
) == FUNCTION_DECL
&& decl_is_tm_clone (fn
))
733 pp_string (buffer
, " [tm-clone]");
734 if (TREE_CODE (fn
) == FUNCTION_DECL
735 && DECL_BUILT_IN_CLASS (fn
) == BUILT_IN_NORMAL
736 && DECL_FUNCTION_CODE (fn
) == BUILT_IN_TM_START
737 && gimple_call_num_args (gs
) > 0)
739 tree t
= gimple_call_arg (gs
, 0);
740 unsigned HOST_WIDE_INT props
;
741 gcc_assert (TREE_CODE (t
) == INTEGER_CST
);
743 pp_string (buffer
, " [ ");
745 /* Get the transaction code properties. */
746 props
= TREE_INT_CST_LOW (t
);
748 if (props
& PR_INSTRUMENTEDCODE
)
749 pp_string (buffer
, "instrumentedCode ");
750 if (props
& PR_UNINSTRUMENTEDCODE
)
751 pp_string (buffer
, "uninstrumentedCode ");
752 if (props
& PR_HASNOXMMUPDATE
)
753 pp_string (buffer
, "hasNoXMMUpdate ");
754 if (props
& PR_HASNOABORT
)
755 pp_string (buffer
, "hasNoAbort ");
756 if (props
& PR_HASNOIRREVOCABLE
)
757 pp_string (buffer
, "hasNoIrrevocable ");
758 if (props
& PR_DOESGOIRREVOCABLE
)
759 pp_string (buffer
, "doesGoIrrevocable ");
760 if (props
& PR_HASNOSIMPLEREADS
)
761 pp_string (buffer
, "hasNoSimpleReads ");
762 if (props
& PR_AWBARRIERSOMITTED
)
763 pp_string (buffer
, "awBarriersOmitted ");
764 if (props
& PR_RARBARRIERSOMITTED
)
765 pp_string (buffer
, "RaRBarriersOmitted ");
766 if (props
& PR_UNDOLOGCODE
)
767 pp_string (buffer
, "undoLogCode ");
768 if (props
& PR_PREFERUNINSTRUMENTED
)
769 pp_string (buffer
, "preferUninstrumented ");
770 if (props
& PR_EXCEPTIONBLOCK
)
771 pp_string (buffer
, "exceptionBlock ");
772 if (props
& PR_HASELSE
)
773 pp_string (buffer
, "hasElse ");
774 if (props
& PR_READONLY
)
775 pp_string (buffer
, "readOnly ");
777 pp_right_bracket (buffer
);
782 /* Dump the switch statement GS. BUFFER, SPC and FLAGS are as in
786 dump_gimple_switch (pretty_printer
*buffer
, gswitch
*gs
, int spc
,
791 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
793 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, ", gs
,
794 gimple_switch_index (gs
));
797 pp_string (buffer
, "switch (");
798 dump_generic_node (buffer
, gimple_switch_index (gs
), spc
, flags
, true);
799 pp_string (buffer
, ") <");
802 for (i
= 0; i
< gimple_switch_num_labels (gs
); i
++)
804 tree case_label
= gimple_switch_label (gs
, i
);
805 gcc_checking_assert (case_label
!= NULL_TREE
);
806 dump_generic_node (buffer
, case_label
, spc
, flags
, false);
808 dump_generic_node (buffer
, CASE_LABEL (case_label
), spc
, flags
, false);
809 if (i
< gimple_switch_num_labels (gs
) - 1)
810 pp_string (buffer
, ", ");
816 /* Dump the gimple conditional GS. BUFFER, SPC and FLAGS are as in
820 dump_gimple_cond (pretty_printer
*buffer
, gcond
*gs
, int spc
, int flags
)
823 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%s, %T, %T, %T, %T>", gs
,
824 get_tree_code_name (gimple_cond_code (gs
)),
825 gimple_cond_lhs (gs
), gimple_cond_rhs (gs
),
826 gimple_cond_true_label (gs
), gimple_cond_false_label (gs
));
829 if (!(flags
& TDF_RHS_ONLY
))
830 pp_string (buffer
, "if (");
831 dump_generic_node (buffer
, gimple_cond_lhs (gs
), spc
, flags
, false);
833 pp_string (buffer
, op_symbol_code (gimple_cond_code (gs
)));
835 dump_generic_node (buffer
, gimple_cond_rhs (gs
), spc
, flags
, false);
836 if (!(flags
& TDF_RHS_ONLY
))
838 pp_right_paren (buffer
);
840 if (gimple_cond_true_label (gs
))
842 pp_string (buffer
, " goto ");
843 dump_generic_node (buffer
, gimple_cond_true_label (gs
),
845 pp_semicolon (buffer
);
847 if (gimple_cond_false_label (gs
))
849 pp_string (buffer
, " else goto ");
850 dump_generic_node (buffer
, gimple_cond_false_label (gs
),
852 pp_semicolon (buffer
);
859 /* Dump a GIMPLE_LABEL tuple on the pretty_printer BUFFER, SPC
860 spaces of indent. FLAGS specifies details to show in the dump (see
861 TDF_* in dumpfils.h). */
864 dump_gimple_label (pretty_printer
*buffer
, glabel
*gs
, int spc
, int flags
)
866 tree label
= gimple_label_label (gs
);
868 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
, label
);
871 dump_generic_node (buffer
, label
, spc
, flags
, false);
874 if (DECL_NONLOCAL (label
))
875 pp_string (buffer
, " [non-local]");
876 if ((flags
& TDF_EH
) && EH_LANDING_PAD_NR (label
))
877 pp_printf (buffer
, " [LP %d]", EH_LANDING_PAD_NR (label
));
880 /* Dump a GIMPLE_GOTO tuple on the pretty_printer BUFFER, SPC
881 spaces of indent. FLAGS specifies details to show in the dump (see
882 TDF_* in dumpfile.h). */
885 dump_gimple_goto (pretty_printer
*buffer
, ggoto
*gs
, int spc
, int flags
)
887 tree label
= gimple_goto_dest (gs
);
889 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
, label
);
891 dump_gimple_fmt (buffer
, spc
, flags
, "goto %T;", label
);
895 /* Dump a GIMPLE_BIND tuple on the pretty_printer BUFFER, SPC
896 spaces of indent. FLAGS specifies details to show in the dump (see
897 TDF_* in dumpfile.h). */
900 dump_gimple_bind (pretty_printer
*buffer
, gbind
*gs
, int spc
, int flags
)
903 dump_gimple_fmt (buffer
, spc
, flags
, "%G <", gs
);
905 pp_left_brace (buffer
);
906 if (!(flags
& TDF_SLIM
))
910 for (var
= gimple_bind_vars (gs
); var
; var
= DECL_CHAIN (var
))
912 newline_and_indent (buffer
, 2);
913 print_declaration (buffer
, var
, spc
, flags
);
915 if (gimple_bind_vars (gs
))
919 dump_gimple_seq (buffer
, gimple_bind_body (gs
), spc
+ 2, flags
);
920 newline_and_indent (buffer
, spc
);
924 pp_right_brace (buffer
);
928 /* Dump a GIMPLE_TRY tuple on the pretty_printer BUFFER, SPC spaces of
929 indent. FLAGS specifies details to show in the dump (see TDF_* in
933 dump_gimple_try (pretty_printer
*buffer
, gtry
*gs
, int spc
, int flags
)
938 if (gimple_try_kind (gs
) == GIMPLE_TRY_CATCH
)
939 type
= "GIMPLE_TRY_CATCH";
940 else if (gimple_try_kind (gs
) == GIMPLE_TRY_FINALLY
)
941 type
= "GIMPLE_TRY_FINALLY";
943 type
= "UNKNOWN GIMPLE_TRY";
944 dump_gimple_fmt (buffer
, spc
, flags
,
945 "%G <%s,%+EVAL <%S>%nCLEANUP <%S>%->", gs
, type
,
946 gimple_try_eval (gs
), gimple_try_cleanup (gs
));
950 pp_string (buffer
, "try");
951 newline_and_indent (buffer
, spc
+ 2);
952 pp_left_brace (buffer
);
955 dump_gimple_seq (buffer
, gimple_try_eval (gs
), spc
+ 4, flags
);
956 newline_and_indent (buffer
, spc
+ 2);
957 pp_right_brace (buffer
);
959 if (gimple_try_kind (gs
) == GIMPLE_TRY_CATCH
)
961 newline_and_indent (buffer
, spc
);
962 pp_string (buffer
, "catch");
963 newline_and_indent (buffer
, spc
+ 2);
964 pp_left_brace (buffer
);
966 else if (gimple_try_kind (gs
) == GIMPLE_TRY_FINALLY
)
968 newline_and_indent (buffer
, spc
);
969 pp_string (buffer
, "finally");
970 newline_and_indent (buffer
, spc
+ 2);
971 pp_left_brace (buffer
);
974 pp_string (buffer
, " <UNKNOWN GIMPLE_TRY> {");
977 dump_gimple_seq (buffer
, gimple_try_cleanup (gs
), spc
+ 4, flags
);
978 newline_and_indent (buffer
, spc
+ 2);
979 pp_right_brace (buffer
);
984 /* Dump a GIMPLE_CATCH tuple on the pretty_printer BUFFER, SPC spaces of
985 indent. FLAGS specifies details to show in the dump (see TDF_* in
989 dump_gimple_catch (pretty_printer
*buffer
, gcatch
*gs
, int spc
, int flags
)
992 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %+CATCH <%S>%->", gs
,
993 gimple_catch_types (gs
), gimple_catch_handler (gs
));
995 dump_gimple_fmt (buffer
, spc
, flags
, "catch (%T)%+{%S}",
996 gimple_catch_types (gs
), gimple_catch_handler (gs
));
1000 /* Dump a GIMPLE_EH_FILTER tuple on the pretty_printer BUFFER, SPC spaces of
1001 indent. FLAGS specifies details to show in the dump (see TDF_* in
1005 dump_gimple_eh_filter (pretty_printer
*buffer
, geh_filter
*gs
, int spc
,
1008 if (flags
& TDF_RAW
)
1009 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %+FAILURE <%S>%->", gs
,
1010 gimple_eh_filter_types (gs
),
1011 gimple_eh_filter_failure (gs
));
1013 dump_gimple_fmt (buffer
, spc
, flags
, "<<<eh_filter (%T)>>>%+{%+%S%-}",
1014 gimple_eh_filter_types (gs
),
1015 gimple_eh_filter_failure (gs
));
1019 /* Dump a GIMPLE_EH_MUST_NOT_THROW tuple. */
1022 dump_gimple_eh_must_not_throw (pretty_printer
*buffer
,
1023 geh_mnt
*gs
, int spc
, int flags
)
1025 if (flags
& TDF_RAW
)
1026 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
,
1027 gimple_eh_must_not_throw_fndecl (gs
));
1029 dump_gimple_fmt (buffer
, spc
, flags
, "<<<eh_must_not_throw (%T)>>>",
1030 gimple_eh_must_not_throw_fndecl (gs
));
1034 /* Dump a GIMPLE_EH_ELSE tuple on the pretty_printer BUFFER, SPC spaces of
1035 indent. FLAGS specifies details to show in the dump (see TDF_* in
1039 dump_gimple_eh_else (pretty_printer
*buffer
, geh_else
*gs
, int spc
,
1042 if (flags
& TDF_RAW
)
1043 dump_gimple_fmt (buffer
, spc
, flags
,
1044 "%G <%+N_BODY <%S>%nE_BODY <%S>%->", gs
,
1045 gimple_eh_else_n_body (gs
), gimple_eh_else_e_body (gs
));
1047 dump_gimple_fmt (buffer
, spc
, flags
,
1048 "<<<if_normal_exit>>>%+{%S}%-<<<else_eh_exit>>>%+{%S}",
1049 gimple_eh_else_n_body (gs
), gimple_eh_else_e_body (gs
));
1053 /* Dump a GIMPLE_RESX tuple on the pretty_printer BUFFER, SPC spaces of
1054 indent. FLAGS specifies details to show in the dump (see TDF_* in
1058 dump_gimple_resx (pretty_printer
*buffer
, gresx
*gs
, int spc
, int flags
)
1060 if (flags
& TDF_RAW
)
1061 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%d>", gs
,
1062 gimple_resx_region (gs
));
1064 dump_gimple_fmt (buffer
, spc
, flags
, "resx %d", gimple_resx_region (gs
));
1067 /* Dump a GIMPLE_EH_DISPATCH tuple on the pretty_printer BUFFER. */
1070 dump_gimple_eh_dispatch (pretty_printer
*buffer
, geh_dispatch
*gs
, int spc
, int flags
)
1072 if (flags
& TDF_RAW
)
1073 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%d>", gs
,
1074 gimple_eh_dispatch_region (gs
));
1076 dump_gimple_fmt (buffer
, spc
, flags
, "eh_dispatch %d",
1077 gimple_eh_dispatch_region (gs
));
1080 /* Dump a GIMPLE_DEBUG tuple on the pretty_printer BUFFER, SPC spaces
1081 of indent. FLAGS specifies details to show in the dump (see TDF_*
1085 dump_gimple_debug (pretty_printer
*buffer
, gdebug
*gs
, int spc
, int flags
)
1087 switch (gs
->subcode
)
1089 case GIMPLE_DEBUG_BIND
:
1090 if (flags
& TDF_RAW
)
1091 dump_gimple_fmt (buffer
, spc
, flags
, "%G BIND <%T, %T>", gs
,
1092 gimple_debug_bind_get_var (gs
),
1093 gimple_debug_bind_get_value (gs
));
1095 dump_gimple_fmt (buffer
, spc
, flags
, "# DEBUG %T => %T",
1096 gimple_debug_bind_get_var (gs
),
1097 gimple_debug_bind_get_value (gs
));
1100 case GIMPLE_DEBUG_SOURCE_BIND
:
1101 if (flags
& TDF_RAW
)
1102 dump_gimple_fmt (buffer
, spc
, flags
, "%G SRCBIND <%T, %T>", gs
,
1103 gimple_debug_source_bind_get_var (gs
),
1104 gimple_debug_source_bind_get_value (gs
));
1106 dump_gimple_fmt (buffer
, spc
, flags
, "# DEBUG %T s=> %T",
1107 gimple_debug_source_bind_get_var (gs
),
1108 gimple_debug_source_bind_get_value (gs
));
1116 /* Dump a GIMPLE_OMP_FOR tuple on the pretty_printer BUFFER. */
1118 dump_gimple_omp_for (pretty_printer
*buffer
, gomp_for
*gs
, int spc
, int flags
)
1122 if (flags
& TDF_RAW
)
1125 switch (gimple_omp_for_kind (gs
))
1127 case GF_OMP_FOR_KIND_FOR
:
1130 case GF_OMP_FOR_KIND_DISTRIBUTE
:
1131 kind
= " distribute";
1133 case GF_OMP_FOR_KIND_TASKLOOP
:
1136 case GF_OMP_FOR_KIND_CILKFOR
:
1137 kind
= " _Cilk_for";
1139 case GF_OMP_FOR_KIND_OACC_LOOP
:
1140 kind
= " oacc_loop";
1142 case GF_OMP_FOR_KIND_SIMD
:
1145 case GF_OMP_FOR_KIND_CILKSIMD
:
1151 dump_gimple_fmt (buffer
, spc
, flags
, "%G%s <%+BODY <%S>%nCLAUSES <", gs
,
1152 kind
, gimple_omp_body (gs
));
1153 dump_omp_clauses (buffer
, gimple_omp_for_clauses (gs
), spc
, flags
);
1154 dump_gimple_fmt (buffer
, spc
, flags
, " >,");
1155 for (i
= 0; i
< gimple_omp_for_collapse (gs
); i
++)
1156 dump_gimple_fmt (buffer
, spc
, flags
,
1157 "%+%T, %T, %T, %s, %T,%n",
1158 gimple_omp_for_index (gs
, i
),
1159 gimple_omp_for_initial (gs
, i
),
1160 gimple_omp_for_final (gs
, i
),
1161 get_tree_code_name (gimple_omp_for_cond (gs
, i
)),
1162 gimple_omp_for_incr (gs
, i
));
1163 dump_gimple_fmt (buffer
, spc
, flags
, "PRE_BODY <%S>%->",
1164 gimple_omp_for_pre_body (gs
));
1168 switch (gimple_omp_for_kind (gs
))
1170 case GF_OMP_FOR_KIND_FOR
:
1171 pp_string (buffer
, "#pragma omp for");
1173 case GF_OMP_FOR_KIND_DISTRIBUTE
:
1174 pp_string (buffer
, "#pragma omp distribute");
1176 case GF_OMP_FOR_KIND_TASKLOOP
:
1177 pp_string (buffer
, "#pragma omp taskloop");
1179 case GF_OMP_FOR_KIND_CILKFOR
:
1181 case GF_OMP_FOR_KIND_OACC_LOOP
:
1182 pp_string (buffer
, "#pragma acc loop");
1184 case GF_OMP_FOR_KIND_SIMD
:
1185 pp_string (buffer
, "#pragma omp simd");
1187 case GF_OMP_FOR_KIND_CILKSIMD
:
1188 pp_string (buffer
, "#pragma simd");
1193 if (gimple_omp_for_kind (gs
) != GF_OMP_FOR_KIND_CILKFOR
)
1194 dump_omp_clauses (buffer
, gimple_omp_for_clauses (gs
), spc
, flags
);
1195 for (i
= 0; i
< gimple_omp_for_collapse (gs
); i
++)
1199 if (gimple_omp_for_kind (gs
) == GF_OMP_FOR_KIND_CILKFOR
)
1200 pp_string (buffer
, "_Cilk_for (");
1203 newline_and_indent (buffer
, spc
);
1204 pp_string (buffer
, "for (");
1206 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
1208 pp_string (buffer
, " = ");
1209 dump_generic_node (buffer
, gimple_omp_for_initial (gs
, i
), spc
,
1211 pp_string (buffer
, "; ");
1213 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
1216 switch (gimple_omp_for_cond (gs
, i
))
1222 pp_greater (buffer
);
1225 pp_less_equal (buffer
);
1228 pp_greater_equal (buffer
);
1231 pp_string (buffer
, "!=");
1237 dump_generic_node (buffer
, gimple_omp_for_final (gs
, i
), spc
,
1239 pp_string (buffer
, "; ");
1241 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
1243 pp_string (buffer
, " = ");
1244 dump_generic_node (buffer
, gimple_omp_for_incr (gs
, i
), spc
,
1246 pp_right_paren (buffer
);
1249 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1251 if (gimple_omp_for_kind (gs
) == GF_OMP_FOR_KIND_CILKFOR
)
1252 dump_omp_clauses (buffer
, gimple_omp_for_clauses (gs
), spc
, flags
);
1253 newline_and_indent (buffer
, spc
+ 2);
1254 pp_left_brace (buffer
);
1255 pp_newline (buffer
);
1256 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1257 newline_and_indent (buffer
, spc
+ 2);
1258 pp_right_brace (buffer
);
1263 /* Dump a GIMPLE_OMP_CONTINUE tuple on the pretty_printer BUFFER. */
1266 dump_gimple_omp_continue (pretty_printer
*buffer
, gomp_continue
*gs
,
1269 if (flags
& TDF_RAW
)
1271 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T>", gs
,
1272 gimple_omp_continue_control_def (gs
),
1273 gimple_omp_continue_control_use (gs
));
1277 pp_string (buffer
, "#pragma omp continue (");
1278 dump_generic_node (buffer
, gimple_omp_continue_control_def (gs
),
1282 dump_generic_node (buffer
, gimple_omp_continue_control_use (gs
),
1284 pp_right_paren (buffer
);
1288 /* Dump a GIMPLE_OMP_SINGLE tuple on the pretty_printer BUFFER. */
1291 dump_gimple_omp_single (pretty_printer
*buffer
, gomp_single
*gs
,
1294 if (flags
& TDF_RAW
)
1296 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1297 gimple_omp_body (gs
));
1298 dump_omp_clauses (buffer
, gimple_omp_single_clauses (gs
), spc
, flags
);
1299 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1303 pp_string (buffer
, "#pragma omp single");
1304 dump_omp_clauses (buffer
, gimple_omp_single_clauses (gs
), spc
, flags
);
1305 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1307 newline_and_indent (buffer
, spc
+ 2);
1308 pp_left_brace (buffer
);
1309 pp_newline (buffer
);
1310 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1311 newline_and_indent (buffer
, spc
+ 2);
1312 pp_right_brace (buffer
);
1317 /* Dump a GIMPLE_OMP_TARGET tuple on the pretty_printer BUFFER. */
1320 dump_gimple_omp_target (pretty_printer
*buffer
, gomp_target
*gs
,
1324 switch (gimple_omp_target_kind (gs
))
1326 case GF_OMP_TARGET_KIND_REGION
:
1329 case GF_OMP_TARGET_KIND_DATA
:
1332 case GF_OMP_TARGET_KIND_UPDATE
:
1335 case GF_OMP_TARGET_KIND_ENTER_DATA
:
1336 kind
= " enter data";
1338 case GF_OMP_TARGET_KIND_EXIT_DATA
:
1339 kind
= " exit data";
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";
1356 case GF_OMP_TARGET_KIND_OACC_DECLARE
:
1357 kind
= " oacc_declare";
1359 case GF_OMP_TARGET_KIND_OACC_HOST_DATA
:
1360 kind
= " oacc_host_data";
1365 if (flags
& TDF_RAW
)
1367 dump_gimple_fmt (buffer
, spc
, flags
, "%G%s <%+BODY <%S>%nCLAUSES <", gs
,
1368 kind
, gimple_omp_body (gs
));
1369 dump_omp_clauses (buffer
, gimple_omp_target_clauses (gs
), spc
, flags
);
1370 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T%n>",
1371 gimple_omp_target_child_fn (gs
),
1372 gimple_omp_target_data_arg (gs
));
1376 pp_string (buffer
, "#pragma omp target");
1377 pp_string (buffer
, kind
);
1378 dump_omp_clauses (buffer
, gimple_omp_target_clauses (gs
), spc
, flags
);
1379 if (gimple_omp_target_child_fn (gs
))
1381 pp_string (buffer
, " [child fn: ");
1382 dump_generic_node (buffer
, gimple_omp_target_child_fn (gs
),
1384 pp_string (buffer
, " (");
1385 if (gimple_omp_target_data_arg (gs
))
1386 dump_generic_node (buffer
, gimple_omp_target_data_arg (gs
),
1389 pp_string (buffer
, "???");
1390 pp_string (buffer
, ")]");
1392 gimple_seq body
= gimple_omp_body (gs
);
1393 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
1395 newline_and_indent (buffer
, spc
+ 2);
1396 pp_left_brace (buffer
);
1397 pp_newline (buffer
);
1398 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
1399 newline_and_indent (buffer
, spc
+ 2);
1400 pp_right_brace (buffer
);
1404 pp_newline (buffer
);
1405 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
1410 /* Dump a GIMPLE_OMP_TEAMS tuple on the pretty_printer BUFFER. */
1413 dump_gimple_omp_teams (pretty_printer
*buffer
, gomp_teams
*gs
, int spc
,
1416 if (flags
& TDF_RAW
)
1418 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1419 gimple_omp_body (gs
));
1420 dump_omp_clauses (buffer
, gimple_omp_teams_clauses (gs
), spc
, flags
);
1421 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1425 pp_string (buffer
, "#pragma omp teams");
1426 dump_omp_clauses (buffer
, gimple_omp_teams_clauses (gs
), spc
, flags
);
1427 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1429 newline_and_indent (buffer
, spc
+ 2);
1430 pp_character (buffer
, '{');
1431 pp_newline (buffer
);
1432 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1433 newline_and_indent (buffer
, spc
+ 2);
1434 pp_character (buffer
, '}');
1439 /* Dump a GIMPLE_OMP_SECTIONS tuple on the pretty_printer BUFFER. */
1442 dump_gimple_omp_sections (pretty_printer
*buffer
, gomp_sections
*gs
,
1445 if (flags
& TDF_RAW
)
1447 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1448 gimple_omp_body (gs
));
1449 dump_omp_clauses (buffer
, gimple_omp_sections_clauses (gs
), spc
, flags
);
1450 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1454 pp_string (buffer
, "#pragma omp sections");
1455 if (gimple_omp_sections_control (gs
))
1457 pp_string (buffer
, " <");
1458 dump_generic_node (buffer
, gimple_omp_sections_control (gs
), spc
,
1460 pp_greater (buffer
);
1462 dump_omp_clauses (buffer
, gimple_omp_sections_clauses (gs
), spc
, flags
);
1463 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1465 newline_and_indent (buffer
, spc
+ 2);
1466 pp_left_brace (buffer
);
1467 pp_newline (buffer
);
1468 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1469 newline_and_indent (buffer
, spc
+ 2);
1470 pp_right_brace (buffer
);
1475 /* Dump a GIMPLE_OMP_{MASTER,TASKGROUP,ORDERED,SECTION} tuple on the
1476 pretty_printer BUFFER. */
1479 dump_gimple_omp_block (pretty_printer
*buffer
, gimple
*gs
, int spc
, int flags
)
1481 if (flags
& TDF_RAW
)
1482 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1483 gimple_omp_body (gs
));
1486 switch (gimple_code (gs
))
1488 case GIMPLE_OMP_MASTER
:
1489 pp_string (buffer
, "#pragma omp master");
1491 case GIMPLE_OMP_TASKGROUP
:
1492 pp_string (buffer
, "#pragma omp taskgroup");
1494 case GIMPLE_OMP_SECTION
:
1495 pp_string (buffer
, "#pragma omp section");
1500 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1502 newline_and_indent (buffer
, spc
+ 2);
1503 pp_left_brace (buffer
);
1504 pp_newline (buffer
);
1505 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1506 newline_and_indent (buffer
, spc
+ 2);
1507 pp_right_brace (buffer
);
1512 /* Dump a GIMPLE_OMP_CRITICAL tuple on the pretty_printer BUFFER. */
1515 dump_gimple_omp_critical (pretty_printer
*buffer
, gomp_critical
*gs
,
1518 if (flags
& TDF_RAW
)
1519 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1520 gimple_omp_body (gs
));
1523 pp_string (buffer
, "#pragma omp critical");
1524 if (gimple_omp_critical_name (gs
))
1526 pp_string (buffer
, " (");
1527 dump_generic_node (buffer
, gimple_omp_critical_name (gs
), spc
,
1529 pp_right_paren (buffer
);
1531 dump_omp_clauses (buffer
, gimple_omp_critical_clauses (gs
), spc
, flags
);
1532 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1534 newline_and_indent (buffer
, spc
+ 2);
1535 pp_left_brace (buffer
);
1536 pp_newline (buffer
);
1537 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1538 newline_and_indent (buffer
, spc
+ 2);
1539 pp_right_brace (buffer
);
1544 /* Dump a GIMPLE_OMP_ORDERED tuple on the pretty_printer BUFFER. */
1547 dump_gimple_omp_ordered (pretty_printer
*buffer
, gomp_ordered
*gs
,
1550 if (flags
& TDF_RAW
)
1551 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1552 gimple_omp_body (gs
));
1555 pp_string (buffer
, "#pragma omp ordered");
1556 dump_omp_clauses (buffer
, gimple_omp_ordered_clauses (gs
), spc
, flags
);
1557 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1559 newline_and_indent (buffer
, spc
+ 2);
1560 pp_left_brace (buffer
);
1561 pp_newline (buffer
);
1562 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1563 newline_and_indent (buffer
, spc
+ 2);
1564 pp_right_brace (buffer
);
1569 /* Dump a GIMPLE_OMP_RETURN tuple on the pretty_printer BUFFER. */
1572 dump_gimple_omp_return (pretty_printer
*buffer
, gimple
*gs
, int spc
, int flags
)
1574 if (flags
& TDF_RAW
)
1576 dump_gimple_fmt (buffer
, spc
, flags
, "%G <nowait=%d", gs
,
1577 (int) gimple_omp_return_nowait_p (gs
));
1578 if (gimple_omp_return_lhs (gs
))
1579 dump_gimple_fmt (buffer
, spc
, flags
, ", lhs=%T>",
1580 gimple_omp_return_lhs (gs
));
1582 dump_gimple_fmt (buffer
, spc
, flags
, ">");
1586 pp_string (buffer
, "#pragma omp return");
1587 if (gimple_omp_return_nowait_p (gs
))
1588 pp_string (buffer
, "(nowait)");
1589 if (gimple_omp_return_lhs (gs
))
1591 pp_string (buffer
, " (set ");
1592 dump_generic_node (buffer
, gimple_omp_return_lhs (gs
),
1594 pp_character (buffer
, ')');
1599 /* Dump a GIMPLE_TRANSACTION tuple on the pretty_printer BUFFER. */
1602 dump_gimple_transaction (pretty_printer
*buffer
, gtransaction
*gs
,
1605 unsigned subcode
= gimple_transaction_subcode (gs
);
1607 if (flags
& TDF_RAW
)
1609 dump_gimple_fmt (buffer
, spc
, flags
,
1610 "%G [SUBCODE=%x,LABEL=%T] <%+BODY <%S> >",
1611 gs
, subcode
, gimple_transaction_label (gs
),
1612 gimple_transaction_body (gs
));
1616 if (subcode
& GTMA_IS_OUTER
)
1617 pp_string (buffer
, "__transaction_atomic [[outer]]");
1618 else if (subcode
& GTMA_IS_RELAXED
)
1619 pp_string (buffer
, "__transaction_relaxed");
1621 pp_string (buffer
, "__transaction_atomic");
1622 subcode
&= ~GTMA_DECLARATION_MASK
;
1624 if (subcode
|| gimple_transaction_label (gs
))
1626 pp_string (buffer
, " //");
1627 if (gimple_transaction_label (gs
))
1629 pp_string (buffer
, " LABEL=");
1630 dump_generic_node (buffer
, gimple_transaction_label (gs
),
1635 pp_string (buffer
, " SUBCODE=[ ");
1636 if (subcode
& GTMA_HAVE_ABORT
)
1638 pp_string (buffer
, "GTMA_HAVE_ABORT ");
1639 subcode
&= ~GTMA_HAVE_ABORT
;
1641 if (subcode
& GTMA_HAVE_LOAD
)
1643 pp_string (buffer
, "GTMA_HAVE_LOAD ");
1644 subcode
&= ~GTMA_HAVE_LOAD
;
1646 if (subcode
& GTMA_HAVE_STORE
)
1648 pp_string (buffer
, "GTMA_HAVE_STORE ");
1649 subcode
&= ~GTMA_HAVE_STORE
;
1651 if (subcode
& GTMA_MAY_ENTER_IRREVOCABLE
)
1653 pp_string (buffer
, "GTMA_MAY_ENTER_IRREVOCABLE ");
1654 subcode
&= ~GTMA_MAY_ENTER_IRREVOCABLE
;
1656 if (subcode
& GTMA_DOES_GO_IRREVOCABLE
)
1658 pp_string (buffer
, "GTMA_DOES_GO_IRREVOCABLE ");
1659 subcode
&= ~GTMA_DOES_GO_IRREVOCABLE
;
1661 if (subcode
& GTMA_HAS_NO_INSTRUMENTATION
)
1663 pp_string (buffer
, "GTMA_HAS_NO_INSTRUMENTATION ");
1664 subcode
&= ~GTMA_HAS_NO_INSTRUMENTATION
;
1667 pp_printf (buffer
, "0x%x ", subcode
);
1668 pp_right_bracket (buffer
);
1672 if (!gimple_seq_empty_p (gimple_transaction_body (gs
)))
1674 newline_and_indent (buffer
, spc
+ 2);
1675 pp_left_brace (buffer
);
1676 pp_newline (buffer
);
1677 dump_gimple_seq (buffer
, gimple_transaction_body (gs
),
1679 newline_and_indent (buffer
, spc
+ 2);
1680 pp_right_brace (buffer
);
1685 /* Dump a GIMPLE_ASM tuple on the pretty_printer BUFFER, SPC spaces of
1686 indent. FLAGS specifies details to show in the dump (see TDF_* in
1690 dump_gimple_asm (pretty_printer
*buffer
, gasm
*gs
, int spc
, int flags
)
1692 unsigned int i
, n
, f
, fields
;
1694 if (flags
& TDF_RAW
)
1696 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+STRING <%n%s%n>", gs
,
1697 gimple_asm_string (gs
));
1699 n
= gimple_asm_noutputs (gs
);
1702 newline_and_indent (buffer
, spc
+ 2);
1703 pp_string (buffer
, "OUTPUT: ");
1704 for (i
= 0; i
< n
; i
++)
1706 dump_generic_node (buffer
, gimple_asm_output_op (gs
, i
),
1709 pp_string (buffer
, ", ");
1713 n
= gimple_asm_ninputs (gs
);
1716 newline_and_indent (buffer
, spc
+ 2);
1717 pp_string (buffer
, "INPUT: ");
1718 for (i
= 0; i
< n
; i
++)
1720 dump_generic_node (buffer
, gimple_asm_input_op (gs
, i
),
1723 pp_string (buffer
, ", ");
1727 n
= gimple_asm_nclobbers (gs
);
1730 newline_and_indent (buffer
, spc
+ 2);
1731 pp_string (buffer
, "CLOBBER: ");
1732 for (i
= 0; i
< n
; i
++)
1734 dump_generic_node (buffer
, gimple_asm_clobber_op (gs
, i
),
1737 pp_string (buffer
, ", ");
1741 n
= gimple_asm_nlabels (gs
);
1744 newline_and_indent (buffer
, spc
+ 2);
1745 pp_string (buffer
, "LABEL: ");
1746 for (i
= 0; i
< n
; i
++)
1748 dump_generic_node (buffer
, gimple_asm_label_op (gs
, i
),
1751 pp_string (buffer
, ", ");
1755 newline_and_indent (buffer
, spc
);
1756 pp_greater (buffer
);
1760 pp_string (buffer
, "__asm__");
1761 if (gimple_asm_volatile_p (gs
))
1762 pp_string (buffer
, " __volatile__");
1763 if (gimple_asm_nlabels (gs
))
1764 pp_string (buffer
, " goto");
1765 pp_string (buffer
, "(\"");
1766 pp_string (buffer
, gimple_asm_string (gs
));
1767 pp_string (buffer
, "\"");
1769 if (gimple_asm_nlabels (gs
))
1771 else if (gimple_asm_nclobbers (gs
))
1773 else if (gimple_asm_ninputs (gs
))
1775 else if (gimple_asm_noutputs (gs
))
1780 for (f
= 0; f
< fields
; ++f
)
1782 pp_string (buffer
, " : ");
1787 n
= gimple_asm_noutputs (gs
);
1788 for (i
= 0; i
< n
; i
++)
1790 dump_generic_node (buffer
, gimple_asm_output_op (gs
, i
),
1793 pp_string (buffer
, ", ");
1798 n
= gimple_asm_ninputs (gs
);
1799 for (i
= 0; i
< n
; i
++)
1801 dump_generic_node (buffer
, gimple_asm_input_op (gs
, i
),
1804 pp_string (buffer
, ", ");
1809 n
= gimple_asm_nclobbers (gs
);
1810 for (i
= 0; i
< n
; i
++)
1812 dump_generic_node (buffer
, gimple_asm_clobber_op (gs
, i
),
1815 pp_string (buffer
, ", ");
1820 n
= gimple_asm_nlabels (gs
);
1821 for (i
= 0; i
< n
; i
++)
1823 dump_generic_node (buffer
, gimple_asm_label_op (gs
, i
),
1826 pp_string (buffer
, ", ");
1835 pp_string (buffer
, ");");
1839 /* Dump ptr_info and range_info for NODE on pretty_printer BUFFER with
1840 SPC spaces of indent. */
1843 dump_ssaname_info (pretty_printer
*buffer
, tree node
, int spc
)
1845 if (TREE_CODE (node
) != SSA_NAME
)
1848 if (POINTER_TYPE_P (TREE_TYPE (node
))
1849 && SSA_NAME_PTR_INFO (node
))
1851 unsigned int align
, misalign
;
1852 struct ptr_info_def
*pi
= SSA_NAME_PTR_INFO (node
);
1853 pp_string (buffer
, "# PT = ");
1854 pp_points_to_solution (buffer
, &pi
->pt
);
1855 newline_and_indent (buffer
, spc
);
1856 if (get_ptr_info_alignment (pi
, &align
, &misalign
))
1858 pp_printf (buffer
, "# ALIGN = %u, MISALIGN = %u", align
, misalign
);
1859 newline_and_indent (buffer
, spc
);
1863 if (!POINTER_TYPE_P (TREE_TYPE (node
))
1864 && SSA_NAME_RANGE_INFO (node
))
1866 wide_int min
, max
, nonzero_bits
;
1867 value_range_type range_type
= get_range_info (node
, &min
, &max
);
1869 if (range_type
== VR_VARYING
)
1870 pp_printf (buffer
, "# RANGE VR_VARYING");
1871 else if (range_type
== VR_RANGE
|| range_type
== VR_ANTI_RANGE
)
1873 pp_printf (buffer
, "# RANGE ");
1874 pp_printf (buffer
, "%s[", range_type
== VR_RANGE
? "" : "~");
1875 pp_wide_int (buffer
, min
, TYPE_SIGN (TREE_TYPE (node
)));
1876 pp_printf (buffer
, ", ");
1877 pp_wide_int (buffer
, max
, TYPE_SIGN (TREE_TYPE (node
)));
1878 pp_printf (buffer
, "]");
1880 nonzero_bits
= get_nonzero_bits (node
);
1881 if (nonzero_bits
!= -1)
1883 pp_string (buffer
, " NONZERO ");
1884 pp_wide_int (buffer
, nonzero_bits
, UNSIGNED
);
1886 newline_and_indent (buffer
, spc
);
1890 /* As dump_ssaname_info, but dump to FILE. */
1893 dump_ssaname_info_to_file (FILE *file
, tree node
, int spc
)
1895 pretty_printer buffer
;
1896 pp_needs_newline (&buffer
) = true;
1897 buffer
.buffer
->stream
= file
;
1898 dump_ssaname_info (&buffer
, node
, spc
);
1902 /* Dump a PHI node PHI. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1.
1903 The caller is responsible for calling pp_flush on BUFFER to finalize
1904 pretty printer. If COMMENT is true, print this after #. */
1907 dump_gimple_phi (pretty_printer
*buffer
, gphi
*phi
, int spc
, bool comment
,
1911 tree lhs
= gimple_phi_result (phi
);
1913 if (flags
& TDF_ALIAS
)
1914 dump_ssaname_info (buffer
, lhs
, spc
);
1917 pp_string (buffer
, "# ");
1919 if (flags
& TDF_RAW
)
1920 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, ", phi
,
1921 gimple_phi_result (phi
));
1924 dump_generic_node (buffer
, lhs
, spc
, flags
, false);
1925 pp_string (buffer
, " = PHI <");
1927 for (i
= 0; i
< gimple_phi_num_args (phi
); i
++)
1929 if ((flags
& TDF_LINENO
) && gimple_phi_arg_has_location (phi
, i
))
1930 dump_location (buffer
, gimple_phi_arg_location (phi
, i
));
1931 dump_generic_node (buffer
, gimple_phi_arg_def (phi
, i
), spc
, flags
,
1933 pp_left_paren (buffer
);
1934 pp_decimal_int (buffer
, gimple_phi_arg_edge (phi
, i
)->src
->index
);
1935 pp_right_paren (buffer
);
1936 if (i
< gimple_phi_num_args (phi
) - 1)
1937 pp_string (buffer
, ", ");
1939 pp_greater (buffer
);
1943 /* Dump a GIMPLE_OMP_PARALLEL tuple on the pretty_printer BUFFER, SPC spaces
1944 of indent. FLAGS specifies details to show in the dump (see TDF_* in
1948 dump_gimple_omp_parallel (pretty_printer
*buffer
, gomp_parallel
*gs
,
1951 if (flags
& TDF_RAW
)
1953 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1954 gimple_omp_body (gs
));
1955 dump_omp_clauses (buffer
, gimple_omp_parallel_clauses (gs
), spc
, flags
);
1956 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T%n>",
1957 gimple_omp_parallel_child_fn (gs
),
1958 gimple_omp_parallel_data_arg (gs
));
1963 pp_string (buffer
, "#pragma omp parallel");
1964 dump_omp_clauses (buffer
, gimple_omp_parallel_clauses (gs
), spc
, flags
);
1965 if (gimple_omp_parallel_child_fn (gs
))
1967 pp_string (buffer
, " [child fn: ");
1968 dump_generic_node (buffer
, gimple_omp_parallel_child_fn (gs
),
1970 pp_string (buffer
, " (");
1971 if (gimple_omp_parallel_data_arg (gs
))
1972 dump_generic_node (buffer
, gimple_omp_parallel_data_arg (gs
),
1975 pp_string (buffer
, "???");
1976 pp_string (buffer
, ")]");
1978 body
= gimple_omp_body (gs
);
1979 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
1981 newline_and_indent (buffer
, spc
+ 2);
1982 pp_left_brace (buffer
);
1983 pp_newline (buffer
);
1984 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
1985 newline_and_indent (buffer
, spc
+ 2);
1986 pp_right_brace (buffer
);
1990 pp_newline (buffer
);
1991 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
1997 /* Dump a GIMPLE_OMP_TASK tuple on the pretty_printer BUFFER, SPC spaces
1998 of indent. FLAGS specifies details to show in the dump (see TDF_* in
2002 dump_gimple_omp_task (pretty_printer
*buffer
, gomp_task
*gs
, int spc
,
2005 if (flags
& TDF_RAW
)
2007 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
2008 gimple_omp_body (gs
));
2009 dump_omp_clauses (buffer
, gimple_omp_task_clauses (gs
), spc
, flags
);
2010 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T, %T, %T, %T%n>",
2011 gimple_omp_task_child_fn (gs
),
2012 gimple_omp_task_data_arg (gs
),
2013 gimple_omp_task_copy_fn (gs
),
2014 gimple_omp_task_arg_size (gs
),
2015 gimple_omp_task_arg_size (gs
));
2020 if (gimple_omp_task_taskloop_p (gs
))
2021 pp_string (buffer
, "#pragma omp taskloop");
2023 pp_string (buffer
, "#pragma omp task");
2024 dump_omp_clauses (buffer
, gimple_omp_task_clauses (gs
), spc
, flags
);
2025 if (gimple_omp_task_child_fn (gs
))
2027 pp_string (buffer
, " [child fn: ");
2028 dump_generic_node (buffer
, gimple_omp_task_child_fn (gs
),
2030 pp_string (buffer
, " (");
2031 if (gimple_omp_task_data_arg (gs
))
2032 dump_generic_node (buffer
, gimple_omp_task_data_arg (gs
),
2035 pp_string (buffer
, "???");
2036 pp_string (buffer
, ")]");
2038 body
= gimple_omp_body (gs
);
2039 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
2041 newline_and_indent (buffer
, spc
+ 2);
2042 pp_left_brace (buffer
);
2043 pp_newline (buffer
);
2044 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
2045 newline_and_indent (buffer
, spc
+ 2);
2046 pp_right_brace (buffer
);
2050 pp_newline (buffer
);
2051 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
2057 /* Dump a GIMPLE_OMP_ATOMIC_LOAD tuple on the pretty_printer BUFFER, SPC
2058 spaces of indent. FLAGS specifies details to show in the dump (see TDF_*
2062 dump_gimple_omp_atomic_load (pretty_printer
*buffer
, gomp_atomic_load
*gs
,
2065 if (flags
& TDF_RAW
)
2067 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T>", gs
,
2068 gimple_omp_atomic_load_lhs (gs
),
2069 gimple_omp_atomic_load_rhs (gs
));
2073 pp_string (buffer
, "#pragma omp atomic_load");
2074 if (gimple_omp_atomic_seq_cst_p (gs
))
2075 pp_string (buffer
, " seq_cst");
2076 if (gimple_omp_atomic_need_value_p (gs
))
2077 pp_string (buffer
, " [needed]");
2078 newline_and_indent (buffer
, spc
+ 2);
2079 dump_generic_node (buffer
, gimple_omp_atomic_load_lhs (gs
),
2085 dump_generic_node (buffer
, gimple_omp_atomic_load_rhs (gs
),
2090 /* Dump a GIMPLE_OMP_ATOMIC_STORE tuple on the pretty_printer BUFFER, SPC
2091 spaces of indent. FLAGS specifies details to show in the dump (see TDF_*
2095 dump_gimple_omp_atomic_store (pretty_printer
*buffer
,
2096 gomp_atomic_store
*gs
, int spc
, int flags
)
2098 if (flags
& TDF_RAW
)
2100 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
,
2101 gimple_omp_atomic_store_val (gs
));
2105 pp_string (buffer
, "#pragma omp atomic_store ");
2106 if (gimple_omp_atomic_seq_cst_p (gs
))
2107 pp_string (buffer
, "seq_cst ");
2108 if (gimple_omp_atomic_need_value_p (gs
))
2109 pp_string (buffer
, "[needed] ");
2110 pp_left_paren (buffer
);
2111 dump_generic_node (buffer
, gimple_omp_atomic_store_val (gs
),
2113 pp_right_paren (buffer
);
2118 /* Dump all the memory operands for statement GS. BUFFER, SPC and
2119 FLAGS are as in pp_gimple_stmt_1. */
2122 dump_gimple_mem_ops (pretty_printer
*buffer
, gimple
*gs
, int spc
, int flags
)
2124 tree vdef
= gimple_vdef (gs
);
2125 tree vuse
= gimple_vuse (gs
);
2127 if (vdef
!= NULL_TREE
)
2129 pp_string (buffer
, "# ");
2130 dump_generic_node (buffer
, vdef
, spc
+ 2, flags
, false);
2131 pp_string (buffer
, " = VDEF <");
2132 dump_generic_node (buffer
, vuse
, spc
+ 2, flags
, false);
2133 pp_greater (buffer
);
2134 newline_and_indent (buffer
, spc
);
2136 else if (vuse
!= NULL_TREE
)
2138 pp_string (buffer
, "# VUSE <");
2139 dump_generic_node (buffer
, vuse
, spc
+ 2, flags
, false);
2140 pp_greater (buffer
);
2141 newline_and_indent (buffer
, spc
);
2146 /* Print the gimple statement GS on the pretty printer BUFFER, SPC
2147 spaces of indent. FLAGS specifies details to show in the dump (see
2148 TDF_* in dumpfile.h). The caller is responsible for calling
2149 pp_flush on BUFFER to finalize the pretty printer. */
2152 pp_gimple_stmt_1 (pretty_printer
*buffer
, gimple
*gs
, int spc
, int flags
)
2157 if (flags
& TDF_STMTADDR
)
2158 pp_printf (buffer
, "<&%p> ", (void *) gs
);
2160 if ((flags
& TDF_LINENO
) && gimple_has_location (gs
))
2161 dump_location (buffer
, gimple_location (gs
));
2165 int lp_nr
= lookup_stmt_eh_lp (gs
);
2167 pp_printf (buffer
, "[LP %d] ", lp_nr
);
2169 pp_printf (buffer
, "[MNT %d] ", -lp_nr
);
2172 if ((flags
& (TDF_VOPS
|TDF_MEMSYMS
))
2173 && gimple_has_mem_ops (gs
))
2174 dump_gimple_mem_ops (buffer
, gs
, spc
, flags
);
2176 if (gimple_has_lhs (gs
)
2177 && (flags
& TDF_ALIAS
))
2178 dump_ssaname_info (buffer
, gimple_get_lhs (gs
), spc
);
2180 switch (gimple_code (gs
))
2183 dump_gimple_asm (buffer
, as_a
<gasm
*> (gs
), spc
, flags
);
2187 dump_gimple_assign (buffer
, as_a
<gassign
*> (gs
), spc
, flags
);
2191 dump_gimple_bind (buffer
, as_a
<gbind
*> (gs
), spc
, flags
);
2195 dump_gimple_call (buffer
, as_a
<gcall
*> (gs
), spc
, flags
);
2199 dump_gimple_cond (buffer
, as_a
<gcond
*> (gs
), spc
, flags
);
2203 dump_gimple_label (buffer
, as_a
<glabel
*> (gs
), spc
, flags
);
2207 dump_gimple_goto (buffer
, as_a
<ggoto
*> (gs
), spc
, flags
);
2211 pp_string (buffer
, "GIMPLE_NOP");
2215 dump_gimple_return (buffer
, as_a
<greturn
*> (gs
), spc
, flags
);
2219 dump_gimple_switch (buffer
, as_a
<gswitch
*> (gs
), spc
, flags
);
2223 dump_gimple_try (buffer
, as_a
<gtry
*> (gs
), spc
, flags
);
2227 dump_gimple_phi (buffer
, as_a
<gphi
*> (gs
), spc
, false, flags
);
2230 case GIMPLE_OMP_PARALLEL
:
2231 dump_gimple_omp_parallel (buffer
, as_a
<gomp_parallel
*> (gs
), spc
,
2235 case GIMPLE_OMP_TASK
:
2236 dump_gimple_omp_task (buffer
, as_a
<gomp_task
*> (gs
), spc
, flags
);
2239 case GIMPLE_OMP_ATOMIC_LOAD
:
2240 dump_gimple_omp_atomic_load (buffer
, as_a
<gomp_atomic_load
*> (gs
),
2244 case GIMPLE_OMP_ATOMIC_STORE
:
2245 dump_gimple_omp_atomic_store (buffer
,
2246 as_a
<gomp_atomic_store
*> (gs
),
2250 case GIMPLE_OMP_FOR
:
2251 dump_gimple_omp_for (buffer
, as_a
<gomp_for
*> (gs
), spc
, flags
);
2254 case GIMPLE_OMP_CONTINUE
:
2255 dump_gimple_omp_continue (buffer
, as_a
<gomp_continue
*> (gs
), spc
,
2259 case GIMPLE_OMP_SINGLE
:
2260 dump_gimple_omp_single (buffer
, as_a
<gomp_single
*> (gs
), spc
,
2264 case GIMPLE_OMP_TARGET
:
2265 dump_gimple_omp_target (buffer
, as_a
<gomp_target
*> (gs
), spc
,
2269 case GIMPLE_OMP_TEAMS
:
2270 dump_gimple_omp_teams (buffer
, as_a
<gomp_teams
*> (gs
), spc
,
2274 case GIMPLE_OMP_RETURN
:
2275 dump_gimple_omp_return (buffer
, gs
, spc
, flags
);
2278 case GIMPLE_OMP_SECTIONS
:
2279 dump_gimple_omp_sections (buffer
, as_a
<gomp_sections
*> (gs
),
2283 case GIMPLE_OMP_SECTIONS_SWITCH
:
2284 pp_string (buffer
, "GIMPLE_SECTIONS_SWITCH");
2287 case GIMPLE_OMP_MASTER
:
2288 case GIMPLE_OMP_TASKGROUP
:
2289 case GIMPLE_OMP_SECTION
:
2290 dump_gimple_omp_block (buffer
, gs
, spc
, flags
);
2293 case GIMPLE_OMP_ORDERED
:
2294 dump_gimple_omp_ordered (buffer
, as_a
<gomp_ordered
*> (gs
), spc
,
2298 case GIMPLE_OMP_CRITICAL
:
2299 dump_gimple_omp_critical (buffer
, as_a
<gomp_critical
*> (gs
), spc
,
2304 dump_gimple_catch (buffer
, as_a
<gcatch
*> (gs
), spc
, flags
);
2307 case GIMPLE_EH_FILTER
:
2308 dump_gimple_eh_filter (buffer
, as_a
<geh_filter
*> (gs
), spc
, flags
);
2311 case GIMPLE_EH_MUST_NOT_THROW
:
2312 dump_gimple_eh_must_not_throw (buffer
,
2313 as_a
<geh_mnt
*> (gs
),
2317 case GIMPLE_EH_ELSE
:
2318 dump_gimple_eh_else (buffer
, as_a
<geh_else
*> (gs
), spc
, flags
);
2322 dump_gimple_resx (buffer
, as_a
<gresx
*> (gs
), spc
, flags
);
2325 case GIMPLE_EH_DISPATCH
:
2326 dump_gimple_eh_dispatch (buffer
, as_a
<geh_dispatch
*> (gs
), spc
,
2331 dump_gimple_debug (buffer
, as_a
<gdebug
*> (gs
), spc
, flags
);
2334 case GIMPLE_PREDICT
:
2335 pp_string (buffer
, "// predicted ");
2336 if (gimple_predict_outcome (gs
))
2337 pp_string (buffer
, "likely by ");
2339 pp_string (buffer
, "unlikely by ");
2340 pp_string (buffer
, predictor_name (gimple_predict_predictor (gs
)));
2341 pp_string (buffer
, " predictor.");
2344 case GIMPLE_TRANSACTION
:
2345 dump_gimple_transaction (buffer
, as_a
<gtransaction
*> (gs
), spc
,
2355 /* Dumps header of basic block BB to OUTF indented by INDENT
2356 spaces and details described by flags. */
2359 dump_gimple_bb_header (FILE *outf
, basic_block bb
, int indent
, int flags
)
2361 if (flags
& TDF_BLOCKS
)
2363 if (flags
& TDF_LINENO
)
2365 gimple_stmt_iterator gsi
;
2367 if (flags
& TDF_COMMENT
)
2368 fputs (";; ", outf
);
2370 for (gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
); gsi_next (&gsi
))
2371 if (!is_gimple_debug (gsi_stmt (gsi
))
2372 && get_lineno (gsi_stmt (gsi
)) != UNKNOWN_LOCATION
)
2374 fprintf (outf
, "%*sstarting at line %d",
2375 indent
, "", get_lineno (gsi_stmt (gsi
)));
2378 if (bb
->discriminator
)
2379 fprintf (outf
, ", discriminator %i", bb
->discriminator
);
2385 gimple
*stmt
= first_stmt (bb
);
2386 if (!stmt
|| gimple_code (stmt
) != GIMPLE_LABEL
)
2387 fprintf (outf
, "%*s<bb %d>:\n", indent
, "", bb
->index
);
2392 /* Dumps end of basic block BB to buffer BUFFER indented by INDENT
2396 dump_gimple_bb_footer (FILE *outf ATTRIBUTE_UNUSED
,
2397 basic_block bb ATTRIBUTE_UNUSED
,
2398 int indent ATTRIBUTE_UNUSED
,
2399 int flags ATTRIBUTE_UNUSED
)
2401 /* There is currently no GIMPLE-specific basic block info to dump. */
2406 /* Dump PHI nodes of basic block BB to BUFFER with details described
2407 by FLAGS and indented by INDENT spaces. */
2410 dump_phi_nodes (pretty_printer
*buffer
, basic_block bb
, int indent
, int flags
)
2414 for (i
= gsi_start_phis (bb
); !gsi_end_p (i
); gsi_next (&i
))
2416 gphi
*phi
= i
.phi ();
2417 if (!virtual_operand_p (gimple_phi_result (phi
)) || (flags
& TDF_VOPS
))
2420 dump_gimple_phi (buffer
, phi
, indent
, true, flags
);
2421 pp_newline (buffer
);
2427 /* Dump jump to basic block BB that is represented implicitly in the cfg
2431 pp_cfg_jump (pretty_printer
*buffer
, basic_block bb
)
2435 stmt
= first_stmt (bb
);
2437 pp_string (buffer
, "goto <bb ");
2438 pp_decimal_int (buffer
, bb
->index
);
2439 pp_greater (buffer
);
2440 if (stmt
&& gimple_code (stmt
) == GIMPLE_LABEL
)
2442 pp_string (buffer
, " (");
2443 dump_generic_node (buffer
,
2444 gimple_label_label (as_a
<glabel
*> (stmt
)),
2446 pp_right_paren (buffer
);
2447 pp_semicolon (buffer
);
2450 pp_semicolon (buffer
);
2454 /* Dump edges represented implicitly in basic block BB to BUFFER, indented
2455 by INDENT spaces, with details given by FLAGS. */
2458 dump_implicit_edges (pretty_printer
*buffer
, basic_block bb
, int indent
,
2464 stmt
= last_stmt (bb
);
2466 if (stmt
&& gimple_code (stmt
) == GIMPLE_COND
)
2468 edge true_edge
, false_edge
;
2470 /* When we are emitting the code or changing CFG, it is possible that
2471 the edges are not yet created. When we are using debug_bb in such
2472 a situation, we do not want it to crash. */
2473 if (EDGE_COUNT (bb
->succs
) != 2)
2475 extract_true_false_edges_from_block (bb
, &true_edge
, &false_edge
);
2477 INDENT (indent
+ 2);
2478 pp_cfg_jump (buffer
, true_edge
->dest
);
2479 newline_and_indent (buffer
, indent
);
2480 pp_string (buffer
, "else");
2481 newline_and_indent (buffer
, indent
+ 2);
2482 pp_cfg_jump (buffer
, false_edge
->dest
);
2483 pp_newline (buffer
);
2487 /* If there is a fallthru edge, we may need to add an artificial
2488 goto to the dump. */
2489 e
= find_fallthru_edge (bb
->succs
);
2491 if (e
&& e
->dest
!= bb
->next_bb
)
2495 if ((flags
& TDF_LINENO
)
2496 && e
->goto_locus
!= UNKNOWN_LOCATION
)
2497 dump_location (buffer
, e
->goto_locus
);
2499 pp_cfg_jump (buffer
, e
->dest
);
2500 pp_newline (buffer
);
2505 /* Dumps basic block BB to buffer BUFFER with details described by FLAGS and
2506 indented by INDENT spaces. */
2509 gimple_dump_bb_buff (pretty_printer
*buffer
, basic_block bb
, int indent
,
2512 gimple_stmt_iterator gsi
;
2514 int label_indent
= indent
- 2;
2516 if (label_indent
< 0)
2519 dump_phi_nodes (buffer
, bb
, indent
, flags
);
2521 for (gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
); gsi_next (&gsi
))
2525 stmt
= gsi_stmt (gsi
);
2527 curr_indent
= gimple_code (stmt
) == GIMPLE_LABEL
? label_indent
: indent
;
2529 INDENT (curr_indent
);
2530 pp_gimple_stmt_1 (buffer
, stmt
, curr_indent
, flags
);
2531 pp_newline_and_flush (buffer
);
2532 gcc_checking_assert (DECL_STRUCT_FUNCTION (current_function_decl
));
2533 dump_histograms_for_stmt (DECL_STRUCT_FUNCTION (current_function_decl
),
2534 pp_buffer (buffer
)->stream
, stmt
);
2537 dump_implicit_edges (buffer
, bb
, indent
, flags
);
2542 /* Dumps basic block BB to FILE with details described by FLAGS and
2543 indented by INDENT spaces. */
2546 gimple_dump_bb (FILE *file
, basic_block bb
, int indent
, int flags
)
2548 dump_gimple_bb_header (file
, bb
, indent
, flags
);
2549 if (bb
->index
>= NUM_FIXED_BLOCKS
)
2551 pretty_printer buffer
;
2552 pp_needs_newline (&buffer
) = true;
2553 buffer
.buffer
->stream
= file
;
2554 gimple_dump_bb_buff (&buffer
, bb
, indent
, flags
);
2556 dump_gimple_bb_footer (file
, bb
, indent
, flags
);
2559 /* Dumps basic block BB to pretty-printer PP with default dump flags and
2560 no indentation, for use as a label of a DOT graph record-node.
2561 ??? Should just use gimple_dump_bb_buff here, except that value profiling
2562 histogram dumping doesn't know about pretty-printers. */
2565 gimple_dump_bb_for_graph (pretty_printer
*pp
, basic_block bb
)
2567 pp_printf (pp
, "<bb %d>:\n", bb
->index
);
2568 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
2570 for (gphi_iterator gsi
= gsi_start_phis (bb
); !gsi_end_p (gsi
);
2573 gphi
*phi
= gsi
.phi ();
2574 if (!virtual_operand_p (gimple_phi_result (phi
))
2575 || (dump_flags
& TDF_VOPS
))
2578 pp_write_text_to_stream (pp
);
2579 pp_string (pp
, "# ");
2580 pp_gimple_stmt_1 (pp
, phi
, 0, dump_flags
);
2582 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
2586 for (gimple_stmt_iterator gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
);
2589 gimple
*stmt
= gsi_stmt (gsi
);
2591 pp_write_text_to_stream (pp
);
2592 pp_gimple_stmt_1 (pp
, stmt
, 0, dump_flags
);
2594 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
2596 dump_implicit_edges (pp
, bb
, 0, dump_flags
);
2597 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);