1 /* Pretty formatting of GIMPLE statements and expressions.
2 Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
3 Free Software Foundation, Inc.
4 Contributed by Aldy Hernandez <aldyh@redhat.com> and
5 Diego Novillo <dnovillo@google.com>
7 This file is part of GCC.
9 GCC is free software; you can redistribute it and/or modify it under
10 the terms of the GNU General Public License as published by the Free
11 Software Foundation; either version 3, or (at your option) any later
14 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
15 WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19 You should have received a copy of the GNU General Public License
20 along with GCC; see the file COPYING3. If not see
21 <http://www.gnu.org/licenses/>. */
25 #include "coretypes.h"
28 #include "diagnostic.h"
31 #include "tree-flow.h"
32 #include "tree-pass.h"
34 #include "value-prof.h"
36 #define INDENT(SPACE) \
37 do { int i; for (i = 0; i < SPACE; i++) pp_space (buffer); } while (0)
39 static pretty_printer buffer
;
40 static bool initialized
= false;
42 #define GIMPLE_NIY do_niy (buffer,gs)
44 /* Try to print on BUFFER a default message for the unrecognized
45 gimple statement GS. */
48 do_niy (pretty_printer
*buffer
, gimple gs
)
50 pp_printf (buffer
, "<<< Unknown GIMPLE statement: %s >>>\n",
51 gimple_code_name
[(int) gimple_code (gs
)]);
55 /* Initialize the pretty printer on FILE if needed. */
58 maybe_init_pretty_print (FILE *file
)
62 pp_construct (&buffer
, NULL
, 0);
63 pp_needs_newline (&buffer
) = true;
67 buffer
.buffer
->stream
= file
;
71 /* Emit a newline and SPC indentantion spaces to BUFFER. */
74 newline_and_indent (pretty_printer
*buffer
, int spc
)
81 /* Print the GIMPLE statement GS on stderr. */
84 debug_gimple_stmt (gimple gs
)
86 print_gimple_stmt (stderr
, gs
, 0, TDF_VOPS
|TDF_MEMSYMS
);
87 fprintf (stderr
, "\n");
91 /* Dump GIMPLE statement G to FILE using SPC indentantion spaces and
92 FLAGS as in dump_gimple_stmt. */
95 print_gimple_stmt (FILE *file
, gimple g
, int spc
, int flags
)
97 maybe_init_pretty_print (file
);
98 dump_gimple_stmt (&buffer
, g
, spc
, flags
);
103 /* Dump GIMPLE statement G to FILE using SPC indentantion spaces and
104 FLAGS as in dump_gimple_stmt. Print only the right-hand side
108 print_gimple_expr (FILE *file
, gimple g
, int spc
, int flags
)
110 flags
|= TDF_RHS_ONLY
;
111 maybe_init_pretty_print (file
);
112 dump_gimple_stmt (&buffer
, g
, spc
, flags
);
116 /* Print the GIMPLE sequence SEQ on BUFFER using SPC indentantion
117 spaces and FLAGS as in dump_gimple_stmt. */
120 dump_gimple_seq (pretty_printer
*buffer
, gimple_seq seq
, int spc
, int flags
)
122 gimple_stmt_iterator i
;
124 for (i
= gsi_start (seq
); !gsi_end_p (i
); gsi_next (&i
))
126 gimple gs
= gsi_stmt (i
);
128 dump_gimple_stmt (buffer
, gs
, spc
, flags
);
129 if (!gsi_one_before_end_p (i
))
135 /* Dump GIMPLE sequence SEQ to FILE using SPC indentantion spaces and
136 FLAGS as in dump_gimple_stmt. */
139 print_gimple_seq (FILE *file
, gimple_seq seq
, int spc
, int flags
)
141 maybe_init_pretty_print (file
);
142 dump_gimple_seq (&buffer
, seq
, spc
, flags
);
147 /* Print the GIMPLE sequence SEQ on stderr. */
150 debug_gimple_seq (gimple_seq seq
)
152 print_gimple_seq (stderr
, seq
, 0, TDF_VOPS
|TDF_MEMSYMS
);
156 /* A simple helper to pretty-print some of the gimple tuples in the printf
157 style. The format modifiers are preceeded by '%' and are:
158 'G' - outputs a string corresponding to the code of the given gimple,
159 'S' - outputs a gimple_seq with indent of spc + 2,
160 'T' - outputs the tree t,
161 'd' - outputs an int as a decimal,
162 's' - outputs a string,
163 'n' - outputs a newline,
164 '+' - increases indent by 2 then outputs a newline,
165 '-' - decreases indent by 2 then outputs a newline. */
168 dump_gimple_fmt (pretty_printer
*buffer
, int spc
, int flags
,
169 const char *fmt
, ...)
175 va_start (args
, fmt
);
176 for (c
= fmt
; *c
; c
++)
186 g
= va_arg (args
, gimple
);
187 tmp
= gimple_code_name
[gimple_code (g
)];
188 pp_string (buffer
, tmp
);
192 seq
= va_arg (args
, gimple_seq
);
194 dump_gimple_seq (buffer
, seq
, spc
+ 2, flags
);
195 newline_and_indent (buffer
, spc
);
199 t
= va_arg (args
, tree
);
201 pp_string (buffer
, "NULL");
203 dump_generic_node (buffer
, t
, spc
, flags
, false);
207 pp_decimal_int (buffer
, va_arg (args
, int));
211 pp_string (buffer
, va_arg (args
, char *));
215 newline_and_indent (buffer
, spc
);
220 newline_and_indent (buffer
, spc
);
225 newline_and_indent (buffer
, spc
);
233 pp_character (buffer
, *c
);
239 /* Helper for dump_gimple_assign. Print the unary RHS of the
240 assignment GS. BUFFER, SPC and FLAGS are as in dump_gimple_stmt. */
243 dump_unary_rhs (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
245 enum tree_code rhs_code
= gimple_assign_rhs_code (gs
);
246 tree lhs
= gimple_assign_lhs (gs
);
247 tree rhs
= gimple_assign_rhs1 (gs
);
251 case VIEW_CONVERT_EXPR
:
253 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
256 case FIXED_CONVERT_EXPR
:
257 case ADDR_SPACE_CONVERT_EXPR
:
261 pp_character (buffer
, '(');
262 dump_generic_node (buffer
, TREE_TYPE (lhs
), spc
, flags
, false);
263 pp_string (buffer
, ") ");
264 if (op_prio (rhs
) < op_code_prio (rhs_code
))
266 pp_character (buffer
, '(');
267 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
268 pp_character (buffer
, ')');
271 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
275 pp_string (buffer
, "((");
276 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
277 pp_string (buffer
, "))");
281 pp_string (buffer
, "ABS_EXPR <");
282 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
283 pp_character (buffer
, '>');
287 if (TREE_CODE_CLASS (rhs_code
) == tcc_declaration
288 || TREE_CODE_CLASS (rhs_code
) == tcc_constant
289 || TREE_CODE_CLASS (rhs_code
) == tcc_reference
290 || rhs_code
== SSA_NAME
291 || rhs_code
== ADDR_EXPR
292 || rhs_code
== CONSTRUCTOR
)
294 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
297 else if (rhs_code
== BIT_NOT_EXPR
)
298 pp_character (buffer
, '~');
299 else if (rhs_code
== TRUTH_NOT_EXPR
)
300 pp_character (buffer
, '!');
301 else if (rhs_code
== NEGATE_EXPR
)
302 pp_character (buffer
, '-');
305 pp_character (buffer
, '[');
306 pp_string (buffer
, tree_code_name
[rhs_code
]);
307 pp_string (buffer
, "] ");
310 if (op_prio (rhs
) < op_code_prio (rhs_code
))
312 pp_character (buffer
, '(');
313 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
314 pp_character (buffer
, ')');
317 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
323 /* Helper for dump_gimple_assign. Print the binary RHS of the
324 assignment GS. BUFFER, SPC and FLAGS are as in dump_gimple_stmt. */
327 dump_binary_rhs (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
330 enum tree_code code
= gimple_assign_rhs_code (gs
);
336 case VEC_WIDEN_MULT_HI_EXPR
:
337 case VEC_WIDEN_MULT_LO_EXPR
:
338 case VEC_PACK_TRUNC_EXPR
:
339 case VEC_PACK_SAT_EXPR
:
340 case VEC_PACK_FIX_TRUNC_EXPR
:
341 case VEC_EXTRACT_EVEN_EXPR
:
342 case VEC_EXTRACT_ODD_EXPR
:
343 case VEC_INTERLEAVE_HIGH_EXPR
:
344 case VEC_INTERLEAVE_LOW_EXPR
:
345 for (p
= tree_code_name
[(int) code
]; *p
; p
++)
346 pp_character (buffer
, TOUPPER (*p
));
347 pp_string (buffer
, " <");
348 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
349 pp_string (buffer
, ", ");
350 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
351 pp_character (buffer
, '>');
355 if (op_prio (gimple_assign_rhs1 (gs
)) <= op_code_prio (code
))
357 pp_character (buffer
, '(');
358 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
,
360 pp_character (buffer
, ')');
363 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
365 pp_string (buffer
, op_symbol_code (gimple_assign_rhs_code (gs
)));
367 if (op_prio (gimple_assign_rhs2 (gs
)) <= op_code_prio (code
))
369 pp_character (buffer
, '(');
370 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
,
372 pp_character (buffer
, ')');
375 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
380 /* Dump the gimple assignment GS. BUFFER, SPC and FLAGS are as in
384 dump_gimple_assign (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
389 if (gimple_num_ops (gs
) == 2)
391 else if (gimple_num_ops (gs
) == 3)
392 last
= gimple_assign_rhs2 (gs
);
396 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%s, %T, %T, %T>", gs
,
397 tree_code_name
[gimple_assign_rhs_code (gs
)],
398 gimple_assign_lhs (gs
), gimple_assign_rhs1 (gs
), last
);
402 if (!(flags
& TDF_RHS_ONLY
))
404 dump_generic_node (buffer
, gimple_assign_lhs (gs
), spc
, flags
, false);
406 pp_character (buffer
, '=');
408 if (gimple_assign_nontemporal_move_p (gs
))
409 pp_string (buffer
, "{nt}");
411 if (gimple_has_volatile_ops (gs
))
412 pp_string (buffer
, "{v}");
417 if (gimple_num_ops (gs
) == 2)
418 dump_unary_rhs (buffer
, gs
, spc
, flags
);
419 else if (gimple_num_ops (gs
) == 3)
420 dump_binary_rhs (buffer
, gs
, spc
, flags
);
423 if (!(flags
& TDF_RHS_ONLY
))
424 pp_semicolon(buffer
);
429 /* Dump the return statement GS. BUFFER, SPC and FLAGS are as in
433 dump_gimple_return (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
437 t
= gimple_return_retval (gs
);
439 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
, t
);
442 pp_string (buffer
, "return");
446 dump_generic_node (buffer
, t
, spc
, flags
, false);
448 pp_semicolon (buffer
);
453 /* Dump the call arguments for a gimple call. BUFFER, FLAGS are as in
457 dump_gimple_call_args (pretty_printer
*buffer
, gimple gs
, int flags
)
461 for (i
= 0; i
< gimple_call_num_args (gs
); i
++)
463 dump_generic_node (buffer
, gimple_call_arg (gs
, i
), 0, flags
, false);
464 if (i
< gimple_call_num_args (gs
) - 1)
465 pp_string (buffer
, ", ");
468 if (gimple_call_va_arg_pack_p (gs
))
470 if (gimple_call_num_args (gs
) > 0)
472 pp_character (buffer
, ',');
476 pp_string (buffer
, "__builtin_va_arg_pack ()");
481 /* Dump the call statement GS. BUFFER, SPC and FLAGS are as in
485 dump_gimple_call (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
487 tree lhs
= gimple_call_lhs (gs
);
491 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T",
492 gs
, gimple_call_fn (gs
), lhs
);
493 if (gimple_call_num_args (gs
) > 0)
495 pp_string (buffer
, ", ");
496 dump_gimple_call_args (buffer
, gs
, flags
);
498 pp_character (buffer
, '>');
502 if (lhs
&& !(flags
& TDF_RHS_ONLY
))
504 dump_generic_node (buffer
, lhs
, spc
, flags
, false);
505 pp_string (buffer
, " =");
507 if (gimple_has_volatile_ops (gs
))
508 pp_string (buffer
, "{v}");
512 print_call_name (buffer
, gimple_call_fn (gs
), flags
);
513 pp_string (buffer
, " (");
514 dump_gimple_call_args (buffer
, gs
, flags
);
515 pp_character (buffer
, ')');
516 if (!(flags
& TDF_RHS_ONLY
))
517 pp_semicolon (buffer
);
520 if (gimple_call_chain (gs
))
522 pp_string (buffer
, " [static-chain: ");
523 dump_generic_node (buffer
, gimple_call_chain (gs
), spc
, flags
, false);
524 pp_character (buffer
, ']');
527 if (gimple_call_return_slot_opt_p (gs
))
528 pp_string (buffer
, " [return slot optimization]");
530 if (gimple_call_tail_p (gs
))
531 pp_string (buffer
, " [tail call]");
535 /* Dump the switch statement GS. BUFFER, SPC and FLAGS are as in
539 dump_gimple_switch (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
543 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
545 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, ", gs
,
546 gimple_switch_index (gs
));
549 pp_string (buffer
, "switch (");
550 dump_generic_node (buffer
, gimple_switch_index (gs
), spc
, flags
, true);
551 pp_string (buffer
, ") <");
554 for (i
= 0; i
< gimple_switch_num_labels (gs
); i
++)
556 tree case_label
= gimple_switch_label (gs
, i
);
557 if (case_label
== NULL_TREE
)
560 dump_generic_node (buffer
, case_label
, spc
, flags
, false);
561 pp_character (buffer
, ' ');
562 dump_generic_node (buffer
, CASE_LABEL (case_label
), spc
, flags
, false);
563 if (i
< gimple_switch_num_labels (gs
) - 1)
564 pp_string (buffer
, ", ");
566 pp_character (buffer
, '>');
570 /* Dump the gimple conditional GS. BUFFER, SPC and FLAGS are as in
574 dump_gimple_cond (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
577 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%s, %T, %T, %T, %T>", gs
,
578 tree_code_name
[gimple_cond_code (gs
)],
579 gimple_cond_lhs (gs
), gimple_cond_rhs (gs
),
580 gimple_cond_true_label (gs
), gimple_cond_false_label (gs
));
583 if (!(flags
& TDF_RHS_ONLY
))
584 pp_string (buffer
, "if (");
585 dump_generic_node (buffer
, gimple_cond_lhs (gs
), spc
, flags
, false);
587 pp_string (buffer
, op_symbol_code (gimple_cond_code (gs
)));
589 dump_generic_node (buffer
, gimple_cond_rhs (gs
), spc
, flags
, false);
590 if (!(flags
& TDF_RHS_ONLY
))
592 pp_character (buffer
, ')');
594 if (gimple_cond_true_label (gs
))
596 pp_string (buffer
, " goto ");
597 dump_generic_node (buffer
, gimple_cond_true_label (gs
),
599 pp_semicolon (buffer
);
601 if (gimple_cond_false_label (gs
))
603 pp_string (buffer
, " else goto ");
604 dump_generic_node (buffer
, gimple_cond_false_label (gs
),
606 pp_semicolon (buffer
);
613 /* Dump a GIMPLE_LABEL tuple on the pretty_printer BUFFER, SPC
614 spaces of indent. FLAGS specifies details to show in the dump (see
615 TDF_* in tree-pass.h). */
618 dump_gimple_label (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
620 tree label
= gimple_label_label (gs
);
622 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
, label
);
625 dump_generic_node (buffer
, label
, spc
, flags
, false);
626 pp_character (buffer
, ':');
628 if (DECL_NONLOCAL (label
))
629 pp_string (buffer
, " [non-local]");
630 if ((flags
& TDF_EH
) && EH_LANDING_PAD_NR (label
))
631 pp_printf (buffer
, " [LP %d]", EH_LANDING_PAD_NR (label
));
634 /* Dump a GIMPLE_GOTO tuple on the pretty_printer BUFFER, SPC
635 spaces of indent. FLAGS specifies details to show in the dump (see
636 TDF_* in tree-pass.h). */
639 dump_gimple_goto (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
641 tree label
= gimple_goto_dest (gs
);
643 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
, label
);
645 dump_gimple_fmt (buffer
, spc
, flags
, "goto %T;", label
);
649 /* Dump a GIMPLE_BIND tuple on the pretty_printer BUFFER, SPC
650 spaces of indent. FLAGS specifies details to show in the dump (see
651 TDF_* in tree-pass.h). */
654 dump_gimple_bind (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
657 dump_gimple_fmt (buffer
, spc
, flags
, "%G <", gs
);
659 pp_character (buffer
, '{');
660 if (!(flags
& TDF_SLIM
))
664 for (var
= gimple_bind_vars (gs
); var
; var
= TREE_CHAIN (var
))
666 newline_and_indent (buffer
, 2);
667 print_declaration (buffer
, var
, spc
, flags
);
669 if (gimple_bind_vars (gs
))
673 dump_gimple_seq (buffer
, gimple_bind_body (gs
), spc
+ 2, flags
);
674 newline_and_indent (buffer
, spc
);
676 pp_character (buffer
, '>');
678 pp_character (buffer
, '}');
682 /* Dump a GIMPLE_TRY tuple on the pretty_printer BUFFER, SPC spaces of
683 indent. FLAGS specifies details to show in the dump (see TDF_* in
687 dump_gimple_try (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
692 if (gimple_try_kind (gs
) == GIMPLE_TRY_CATCH
)
693 type
= "GIMPLE_TRY_CATCH";
694 else if (gimple_try_kind (gs
) == GIMPLE_TRY_FINALLY
)
695 type
= "GIMPLE_TRY_FINALLY";
697 type
= "UNKNOWN GIMPLE_TRY";
698 dump_gimple_fmt (buffer
, spc
, flags
,
699 "%G <%s,%+EVAL <%S>%nCLEANUP <%S>%->", gs
, type
,
700 gimple_try_eval (gs
), gimple_try_cleanup (gs
));
704 pp_string (buffer
, "try");
705 newline_and_indent (buffer
, spc
+ 2);
706 pp_character (buffer
, '{');
709 dump_gimple_seq (buffer
, gimple_try_eval (gs
), spc
+ 4, flags
);
710 newline_and_indent (buffer
, spc
+ 2);
711 pp_character (buffer
, '}');
713 if (gimple_try_kind (gs
) == GIMPLE_TRY_CATCH
)
715 newline_and_indent (buffer
, spc
);
716 pp_string (buffer
, "catch");
717 newline_and_indent (buffer
, spc
+ 2);
718 pp_character (buffer
, '{');
720 else if (gimple_try_kind (gs
) == GIMPLE_TRY_FINALLY
)
722 newline_and_indent (buffer
, spc
);
723 pp_string (buffer
, "finally");
724 newline_and_indent (buffer
, spc
+ 2);
725 pp_character (buffer
, '{');
728 pp_string (buffer
, " <UNKNOWN GIMPLE_TRY> {");
731 dump_gimple_seq (buffer
, gimple_try_cleanup (gs
), spc
+ 4, flags
);
732 newline_and_indent (buffer
, spc
+ 2);
733 pp_character (buffer
, '}');
738 /* Dump a GIMPLE_CATCH tuple on the pretty_printer BUFFER, SPC spaces of
739 indent. FLAGS specifies details to show in the dump (see TDF_* in
743 dump_gimple_catch (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
746 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %+CATCH <%S>%->", gs
,
747 gimple_catch_types (gs
), gimple_catch_handler (gs
));
749 dump_gimple_fmt (buffer
, spc
, flags
, "catch (%T)%+{%S}",
750 gimple_catch_types (gs
), gimple_catch_handler (gs
));
754 /* Dump a GIMPLE_EH_FILTER tuple on the pretty_printer BUFFER, SPC spaces of
755 indent. FLAGS specifies details to show in the dump (see TDF_* in
759 dump_gimple_eh_filter (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
762 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %+FAILURE <%S>%->", gs
,
763 gimple_eh_filter_types (gs
),
764 gimple_eh_filter_failure (gs
));
766 dump_gimple_fmt (buffer
, spc
, flags
, "<<<eh_filter (%T)>>>%+{%+%S%-}",
767 gimple_eh_filter_types (gs
),
768 gimple_eh_filter_failure (gs
));
772 /* Dump a GIMPLE_EH_MUST_NOT_THROW tuple. */
775 dump_gimple_eh_must_not_throw (pretty_printer
*buffer
, gimple gs
,
779 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
,
780 gimple_eh_must_not_throw_fndecl (gs
));
782 dump_gimple_fmt (buffer
, spc
, flags
, "<<<eh_must_not_throw (%T)>>>",
783 gimple_eh_must_not_throw_fndecl (gs
));
787 /* Dump a GIMPLE_RESX tuple on the pretty_printer BUFFER, SPC spaces of
788 indent. FLAGS specifies details to show in the dump (see TDF_* in
792 dump_gimple_resx (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
795 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%d>", gs
,
796 gimple_resx_region (gs
));
798 dump_gimple_fmt (buffer
, spc
, flags
, "resx %d", gimple_resx_region (gs
));
801 /* Dump a GIMPLE_EH_DISPATCH tuple on the pretty_printer BUFFER. */
804 dump_gimple_eh_dispatch (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
807 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%d>", gs
,
808 gimple_eh_dispatch_region (gs
));
810 dump_gimple_fmt (buffer
, spc
, flags
, "eh_dispatch %d",
811 gimple_eh_dispatch_region (gs
));
814 /* Dump a GIMPLE_DEBUG tuple on the pretty_printer BUFFER, SPC spaces
815 of indent. FLAGS specifies details to show in the dump (see TDF_*
819 dump_gimple_debug (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
821 switch (gs
->gsbase
.subcode
)
823 case GIMPLE_DEBUG_BIND
:
825 dump_gimple_fmt (buffer
, spc
, flags
, "%G BIND <%T, %T>", gs
,
826 gimple_debug_bind_get_var (gs
),
827 gimple_debug_bind_get_value (gs
));
829 dump_gimple_fmt (buffer
, spc
, flags
, "# DEBUG %T => %T",
830 gimple_debug_bind_get_var (gs
),
831 gimple_debug_bind_get_value (gs
));
839 /* Dump a GIMPLE_OMP_FOR tuple on the pretty_printer BUFFER. */
841 dump_gimple_omp_for (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
847 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
848 gimple_omp_body (gs
));
849 dump_omp_clauses (buffer
, gimple_omp_for_clauses (gs
), spc
, flags
);
850 dump_gimple_fmt (buffer
, spc
, flags
, " >,");
851 for (i
= 0; i
< gimple_omp_for_collapse (gs
); i
++)
852 dump_gimple_fmt (buffer
, spc
, flags
,
853 "%+%T, %T, %T, %s, %T,%n",
854 gimple_omp_for_index (gs
, i
),
855 gimple_omp_for_initial (gs
, i
),
856 gimple_omp_for_final (gs
, i
),
857 tree_code_name
[gimple_omp_for_cond (gs
, i
)],
858 gimple_omp_for_incr (gs
, i
));
859 dump_gimple_fmt (buffer
, spc
, flags
, "PRE_BODY <%S>%->",
860 gimple_omp_for_pre_body (gs
));
864 pp_string (buffer
, "#pragma omp for");
865 dump_omp_clauses (buffer
, gimple_omp_for_clauses (gs
), spc
, flags
);
866 for (i
= 0; i
< gimple_omp_for_collapse (gs
); i
++)
870 newline_and_indent (buffer
, spc
);
871 pp_string (buffer
, "for (");
872 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
874 pp_string (buffer
, " = ");
875 dump_generic_node (buffer
, gimple_omp_for_initial (gs
, i
), spc
,
877 pp_string (buffer
, "; ");
879 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
882 switch (gimple_omp_for_cond (gs
, i
))
885 pp_character (buffer
, '<');
888 pp_character (buffer
, '>');
891 pp_string (buffer
, "<=");
894 pp_string (buffer
, ">=");
900 dump_generic_node (buffer
, gimple_omp_for_final (gs
, i
), spc
,
902 pp_string (buffer
, "; ");
904 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
906 pp_string (buffer
, " = ");
907 dump_generic_node (buffer
, gimple_omp_for_incr (gs
, i
), spc
,
909 pp_character (buffer
, ')');
912 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
914 newline_and_indent (buffer
, spc
+ 2);
915 pp_character (buffer
, '{');
917 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
918 newline_and_indent (buffer
, spc
+ 2);
919 pp_character (buffer
, '}');
924 /* Dump a GIMPLE_OMP_CONTINUE tuple on the pretty_printer BUFFER. */
927 dump_gimple_omp_continue (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
931 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T>", gs
,
932 gimple_omp_continue_control_def (gs
),
933 gimple_omp_continue_control_use (gs
));
937 pp_string (buffer
, "#pragma omp continue (");
938 dump_generic_node (buffer
, gimple_omp_continue_control_def (gs
),
940 pp_character (buffer
, ',');
942 dump_generic_node (buffer
, gimple_omp_continue_control_use (gs
),
944 pp_character (buffer
, ')');
948 /* Dump a GIMPLE_OMP_SINGLE tuple on the pretty_printer BUFFER. */
951 dump_gimple_omp_single (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
955 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
956 gimple_omp_body (gs
));
957 dump_omp_clauses (buffer
, gimple_omp_single_clauses (gs
), spc
, flags
);
958 dump_gimple_fmt (buffer
, spc
, flags
, " >");
962 pp_string (buffer
, "#pragma omp single");
963 dump_omp_clauses (buffer
, gimple_omp_single_clauses (gs
), spc
, flags
);
964 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
966 newline_and_indent (buffer
, spc
+ 2);
967 pp_character (buffer
, '{');
969 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
970 newline_and_indent (buffer
, spc
+ 2);
971 pp_character (buffer
, '}');
976 /* Dump a GIMPLE_OMP_SECTIONS tuple on the pretty_printer BUFFER. */
979 dump_gimple_omp_sections (pretty_printer
*buffer
, gimple gs
, int spc
,
984 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
985 gimple_omp_body (gs
));
986 dump_omp_clauses (buffer
, gimple_omp_sections_clauses (gs
), spc
, flags
);
987 dump_gimple_fmt (buffer
, spc
, flags
, " >");
991 pp_string (buffer
, "#pragma omp sections");
992 if (gimple_omp_sections_control (gs
))
994 pp_string (buffer
, " <");
995 dump_generic_node (buffer
, gimple_omp_sections_control (gs
), spc
,
997 pp_character (buffer
, '>');
999 dump_omp_clauses (buffer
, gimple_omp_sections_clauses (gs
), spc
, flags
);
1000 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1002 newline_and_indent (buffer
, spc
+ 2);
1003 pp_character (buffer
, '{');
1004 pp_newline (buffer
);
1005 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1006 newline_and_indent (buffer
, spc
+ 2);
1007 pp_character (buffer
, '}');
1012 /* Dump a GIMPLE_OMP_{MASTER,ORDERED,SECTION} tuple on the pretty_printer
1016 dump_gimple_omp_block (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1018 if (flags
& TDF_RAW
)
1019 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1020 gimple_omp_body (gs
));
1023 switch (gimple_code (gs
))
1025 case GIMPLE_OMP_MASTER
:
1026 pp_string (buffer
, "#pragma omp master");
1028 case GIMPLE_OMP_ORDERED
:
1029 pp_string (buffer
, "#pragma omp ordered");
1031 case GIMPLE_OMP_SECTION
:
1032 pp_string (buffer
, "#pragma omp section");
1037 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1039 newline_and_indent (buffer
, spc
+ 2);
1040 pp_character (buffer
, '{');
1041 pp_newline (buffer
);
1042 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1043 newline_and_indent (buffer
, spc
+ 2);
1044 pp_character (buffer
, '}');
1049 /* Dump a GIMPLE_OMP_CRITICAL tuple on the pretty_printer BUFFER. */
1052 dump_gimple_omp_critical (pretty_printer
*buffer
, gimple gs
, int spc
,
1055 if (flags
& TDF_RAW
)
1056 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1057 gimple_omp_body (gs
));
1060 pp_string (buffer
, "#pragma omp critical");
1061 if (gimple_omp_critical_name (gs
))
1063 pp_string (buffer
, " (");
1064 dump_generic_node (buffer
, gimple_omp_critical_name (gs
), spc
,
1066 pp_character (buffer
, ')');
1068 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1070 newline_and_indent (buffer
, spc
+ 2);
1071 pp_character (buffer
, '{');
1072 pp_newline (buffer
);
1073 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1074 newline_and_indent (buffer
, spc
+ 2);
1075 pp_character (buffer
, '}');
1080 /* Dump a GIMPLE_OMP_RETURN tuple on the pretty_printer BUFFER. */
1083 dump_gimple_omp_return (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1085 if (flags
& TDF_RAW
)
1087 dump_gimple_fmt (buffer
, spc
, flags
, "%G <nowait=%d>", gs
,
1088 (int) gimple_omp_return_nowait_p (gs
));
1092 pp_string (buffer
, "#pragma omp return");
1093 if (gimple_omp_return_nowait_p (gs
))
1094 pp_string (buffer
, "(nowait)");
1098 /* Dump a GIMPLE_ASM tuple on the pretty_printer BUFFER, SPC spaces of
1099 indent. FLAGS specifies details to show in the dump (see TDF_* in
1103 dump_gimple_asm (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1105 unsigned int i
, n
, f
, fields
;
1107 if (flags
& TDF_RAW
)
1109 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+STRING <%n%s%n>", gs
,
1110 gimple_asm_string (gs
));
1112 n
= gimple_asm_noutputs (gs
);
1115 newline_and_indent (buffer
, spc
+ 2);
1116 pp_string (buffer
, "OUTPUT: ");
1117 for (i
= 0; i
< n
; i
++)
1119 dump_generic_node (buffer
, gimple_asm_output_op (gs
, i
),
1122 pp_string (buffer
, ", ");
1126 n
= gimple_asm_ninputs (gs
);
1129 newline_and_indent (buffer
, spc
+ 2);
1130 pp_string (buffer
, "INPUT: ");
1131 for (i
= 0; i
< n
; i
++)
1133 dump_generic_node (buffer
, gimple_asm_input_op (gs
, i
),
1136 pp_string (buffer
, ", ");
1140 n
= gimple_asm_nclobbers (gs
);
1143 newline_and_indent (buffer
, spc
+ 2);
1144 pp_string (buffer
, "CLOBBER: ");
1145 for (i
= 0; i
< n
; i
++)
1147 dump_generic_node (buffer
, gimple_asm_clobber_op (gs
, i
),
1150 pp_string (buffer
, ", ");
1154 n
= gimple_asm_nlabels (gs
);
1157 newline_and_indent (buffer
, spc
+ 2);
1158 pp_string (buffer
, "LABEL: ");
1159 for (i
= 0; i
< n
; i
++)
1161 dump_generic_node (buffer
, gimple_asm_label_op (gs
, i
),
1164 pp_string (buffer
, ", ");
1168 newline_and_indent (buffer
, spc
);
1169 pp_character (buffer
, '>');
1173 pp_string (buffer
, "__asm__");
1174 if (gimple_asm_volatile_p (gs
))
1175 pp_string (buffer
, " __volatile__");
1176 if (gimple_asm_nlabels (gs
))
1177 pp_string (buffer
, " goto");
1178 pp_string (buffer
, "(\"");
1179 pp_string (buffer
, gimple_asm_string (gs
));
1180 pp_string (buffer
, "\"");
1182 if (gimple_asm_nlabels (gs
))
1184 else if (gimple_asm_nclobbers (gs
))
1186 else if (gimple_asm_ninputs (gs
))
1188 else if (gimple_asm_noutputs (gs
))
1193 for (f
= 0; f
< fields
; ++f
)
1195 pp_string (buffer
, " : ");
1200 n
= gimple_asm_noutputs (gs
);
1201 for (i
= 0; i
< n
; i
++)
1203 dump_generic_node (buffer
, gimple_asm_output_op (gs
, i
),
1206 pp_string (buffer
, ", ");
1211 n
= gimple_asm_ninputs (gs
);
1212 for (i
= 0; i
< n
; i
++)
1214 dump_generic_node (buffer
, gimple_asm_input_op (gs
, i
),
1217 pp_string (buffer
, ", ");
1222 n
= gimple_asm_nclobbers (gs
);
1223 for (i
= 0; i
< n
; i
++)
1225 dump_generic_node (buffer
, gimple_asm_clobber_op (gs
, i
),
1228 pp_string (buffer
, ", ");
1233 n
= gimple_asm_nlabels (gs
);
1234 for (i
= 0; i
< n
; i
++)
1236 dump_generic_node (buffer
, gimple_asm_label_op (gs
, i
),
1239 pp_string (buffer
, ", ");
1248 pp_string (buffer
, ");");
1253 /* Dump a PHI node PHI. BUFFER, SPC and FLAGS are as in
1254 dump_gimple_stmt. */
1257 dump_gimple_phi (pretty_printer
*buffer
, gimple phi
, int spc
, int flags
)
1261 if (flags
& TDF_RAW
)
1262 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, ", phi
,
1263 gimple_phi_result (phi
));
1266 dump_generic_node (buffer
, gimple_phi_result (phi
), spc
, flags
, false);
1267 pp_string (buffer
, " = PHI <");
1269 for (i
= 0; i
< gimple_phi_num_args (phi
); i
++)
1271 if ((flags
& TDF_LINENO
) && gimple_phi_arg_has_location (phi
, i
))
1273 expanded_location xloc
;
1275 xloc
= expand_location (gimple_phi_arg_location (phi
, i
));
1276 pp_character (buffer
, '[');
1279 pp_string (buffer
, xloc
.file
);
1280 pp_string (buffer
, " : ");
1282 pp_decimal_int (buffer
, xloc
.line
);
1283 pp_string (buffer
, ":");
1284 pp_decimal_int (buffer
, xloc
.column
);
1285 pp_string (buffer
, "] ");
1287 dump_generic_node (buffer
, gimple_phi_arg_def (phi
, i
), spc
, flags
,
1289 pp_character (buffer
, '(');
1290 pp_decimal_int (buffer
, gimple_phi_arg_edge (phi
, i
)->src
->index
);
1291 pp_character (buffer
, ')');
1292 if (i
< gimple_phi_num_args (phi
) - 1)
1293 pp_string (buffer
, ", ");
1295 pp_character (buffer
, '>');
1299 /* Dump a GIMPLE_OMP_PARALLEL tuple on the pretty_printer BUFFER, SPC spaces
1300 of indent. FLAGS specifies details to show in the dump (see TDF_* in
1304 dump_gimple_omp_parallel (pretty_printer
*buffer
, gimple gs
, int spc
,
1307 if (flags
& TDF_RAW
)
1309 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1310 gimple_omp_body (gs
));
1311 dump_omp_clauses (buffer
, gimple_omp_parallel_clauses (gs
), spc
, flags
);
1312 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T%n>",
1313 gimple_omp_parallel_child_fn (gs
),
1314 gimple_omp_parallel_data_arg (gs
));
1319 pp_string (buffer
, "#pragma omp parallel");
1320 dump_omp_clauses (buffer
, gimple_omp_parallel_clauses (gs
), spc
, flags
);
1321 if (gimple_omp_parallel_child_fn (gs
))
1323 pp_string (buffer
, " [child fn: ");
1324 dump_generic_node (buffer
, gimple_omp_parallel_child_fn (gs
),
1326 pp_string (buffer
, " (");
1327 if (gimple_omp_parallel_data_arg (gs
))
1328 dump_generic_node (buffer
, gimple_omp_parallel_data_arg (gs
),
1331 pp_string (buffer
, "???");
1332 pp_string (buffer
, ")]");
1334 body
= gimple_omp_body (gs
);
1335 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
1337 newline_and_indent (buffer
, spc
+ 2);
1338 pp_character (buffer
, '{');
1339 pp_newline (buffer
);
1340 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
1341 newline_and_indent (buffer
, spc
+ 2);
1342 pp_character (buffer
, '}');
1346 pp_newline (buffer
);
1347 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
1353 /* Dump a GIMPLE_OMP_TASK tuple on the pretty_printer BUFFER, SPC spaces
1354 of indent. FLAGS specifies details to show in the dump (see TDF_* in
1358 dump_gimple_omp_task (pretty_printer
*buffer
, gimple gs
, int spc
,
1361 if (flags
& TDF_RAW
)
1363 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1364 gimple_omp_body (gs
));
1365 dump_omp_clauses (buffer
, gimple_omp_task_clauses (gs
), spc
, flags
);
1366 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T, %T, %T, %T%n>",
1367 gimple_omp_task_child_fn (gs
),
1368 gimple_omp_task_data_arg (gs
),
1369 gimple_omp_task_copy_fn (gs
),
1370 gimple_omp_task_arg_size (gs
),
1371 gimple_omp_task_arg_size (gs
));
1376 pp_string (buffer
, "#pragma omp task");
1377 dump_omp_clauses (buffer
, gimple_omp_task_clauses (gs
), spc
, flags
);
1378 if (gimple_omp_task_child_fn (gs
))
1380 pp_string (buffer
, " [child fn: ");
1381 dump_generic_node (buffer
, gimple_omp_task_child_fn (gs
),
1383 pp_string (buffer
, " (");
1384 if (gimple_omp_task_data_arg (gs
))
1385 dump_generic_node (buffer
, gimple_omp_task_data_arg (gs
),
1388 pp_string (buffer
, "???");
1389 pp_string (buffer
, ")]");
1391 body
= gimple_omp_body (gs
);
1392 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
1394 newline_and_indent (buffer
, spc
+ 2);
1395 pp_character (buffer
, '{');
1396 pp_newline (buffer
);
1397 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
1398 newline_and_indent (buffer
, spc
+ 2);
1399 pp_character (buffer
, '}');
1403 pp_newline (buffer
);
1404 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
1410 /* Dump a GIMPLE_OMP_ATOMIC_LOAD tuple on the pretty_printer BUFFER, SPC
1411 spaces of indent. FLAGS specifies details to show in the dump (see TDF_*
1415 dump_gimple_omp_atomic_load (pretty_printer
*buffer
, gimple gs
, int spc
,
1418 if (flags
& TDF_RAW
)
1420 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T>", gs
,
1421 gimple_omp_atomic_load_lhs (gs
),
1422 gimple_omp_atomic_load_rhs (gs
));
1426 pp_string (buffer
, "#pragma omp atomic_load");
1427 newline_and_indent (buffer
, spc
+ 2);
1428 dump_generic_node (buffer
, gimple_omp_atomic_load_lhs (gs
),
1431 pp_character (buffer
, '=');
1433 pp_character (buffer
, '*');
1434 dump_generic_node (buffer
, gimple_omp_atomic_load_rhs (gs
),
1439 /* Dump a GIMPLE_OMP_ATOMIC_STORE tuple on the pretty_printer BUFFER, SPC
1440 spaces of indent. FLAGS specifies details to show in the dump (see TDF_*
1444 dump_gimple_omp_atomic_store (pretty_printer
*buffer
, gimple gs
, int spc
,
1447 if (flags
& TDF_RAW
)
1449 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
,
1450 gimple_omp_atomic_store_val (gs
));
1454 pp_string (buffer
, "#pragma omp atomic_store (");
1455 dump_generic_node (buffer
, gimple_omp_atomic_store_val (gs
),
1457 pp_character (buffer
, ')');
1462 /* Dump all the memory operands for statement GS. BUFFER, SPC and
1463 FLAGS are as in dump_gimple_stmt. */
1466 dump_gimple_mem_ops (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1468 tree vdef
= gimple_vdef (gs
);
1469 tree vuse
= gimple_vuse (gs
);
1471 if (!ssa_operands_active () || !gimple_references_memory_p (gs
))
1474 if (vdef
!= NULL_TREE
)
1476 pp_string (buffer
, "# ");
1477 dump_generic_node (buffer
, vdef
, spc
+ 2, flags
, false);
1478 pp_string (buffer
, " = VDEF <");
1479 dump_generic_node (buffer
, vuse
, spc
+ 2, flags
, false);
1480 pp_character (buffer
, '>');
1481 newline_and_indent (buffer
, spc
);
1483 else if (vuse
!= NULL_TREE
)
1485 pp_string (buffer
, "# VUSE <");
1486 dump_generic_node (buffer
, vuse
, spc
+ 2, flags
, false);
1487 pp_character (buffer
, '>');
1488 newline_and_indent (buffer
, spc
);
1493 /* Dump the gimple statement GS on the pretty printer BUFFER, SPC
1494 spaces of indent. FLAGS specifies details to show in the dump (see
1495 TDF_* in tree-pass.h). */
1498 dump_gimple_stmt (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1503 if (flags
& TDF_STMTADDR
)
1504 pp_printf (buffer
, "<&%p> ", (void *) gs
);
1506 if ((flags
& TDF_LINENO
) && gimple_has_location (gs
))
1508 expanded_location xloc
= expand_location (gimple_location (gs
));
1509 pp_character (buffer
, '[');
1512 pp_string (buffer
, xloc
.file
);
1513 pp_string (buffer
, " : ");
1515 pp_decimal_int (buffer
, xloc
.line
);
1516 pp_string (buffer
, ":");
1517 pp_decimal_int (buffer
, xloc
.column
);
1518 pp_string (buffer
, "] ");
1523 int lp_nr
= lookup_stmt_eh_lp (gs
);
1525 pp_printf (buffer
, "[LP %d] ", lp_nr
);
1527 pp_printf (buffer
, "[MNT %d] ", -lp_nr
);
1530 if ((flags
& (TDF_VOPS
|TDF_MEMSYMS
))
1531 && gimple_has_mem_ops (gs
))
1532 dump_gimple_mem_ops (buffer
, gs
, spc
, flags
);
1534 switch (gimple_code (gs
))
1537 dump_gimple_asm (buffer
, gs
, spc
, flags
);
1541 dump_gimple_assign (buffer
, gs
, spc
, flags
);
1545 dump_gimple_bind (buffer
, gs
, spc
, flags
);
1549 dump_gimple_call (buffer
, gs
, spc
, flags
);
1553 dump_gimple_cond (buffer
, gs
, spc
, flags
);
1557 dump_gimple_label (buffer
, gs
, spc
, flags
);
1561 dump_gimple_goto (buffer
, gs
, spc
, flags
);
1565 pp_string (buffer
, "GIMPLE_NOP");
1569 dump_gimple_return (buffer
, gs
, spc
, flags
);
1573 dump_gimple_switch (buffer
, gs
, spc
, flags
);
1577 dump_gimple_try (buffer
, gs
, spc
, flags
);
1581 dump_gimple_phi (buffer
, gs
, spc
, flags
);
1584 case GIMPLE_OMP_PARALLEL
:
1585 dump_gimple_omp_parallel (buffer
, gs
, spc
, flags
);
1588 case GIMPLE_OMP_TASK
:
1589 dump_gimple_omp_task (buffer
, gs
, spc
, flags
);
1592 case GIMPLE_OMP_ATOMIC_LOAD
:
1593 dump_gimple_omp_atomic_load (buffer
, gs
, spc
, flags
);
1597 case GIMPLE_OMP_ATOMIC_STORE
:
1598 dump_gimple_omp_atomic_store (buffer
, gs
, spc
, flags
);
1601 case GIMPLE_OMP_FOR
:
1602 dump_gimple_omp_for (buffer
, gs
, spc
, flags
);
1605 case GIMPLE_OMP_CONTINUE
:
1606 dump_gimple_omp_continue (buffer
, gs
, spc
, flags
);
1609 case GIMPLE_OMP_SINGLE
:
1610 dump_gimple_omp_single (buffer
, gs
, spc
, flags
);
1613 case GIMPLE_OMP_RETURN
:
1614 dump_gimple_omp_return (buffer
, gs
, spc
, flags
);
1617 case GIMPLE_OMP_SECTIONS
:
1618 dump_gimple_omp_sections (buffer
, gs
, spc
, flags
);
1621 case GIMPLE_OMP_SECTIONS_SWITCH
:
1622 pp_string (buffer
, "GIMPLE_SECTIONS_SWITCH");
1625 case GIMPLE_OMP_MASTER
:
1626 case GIMPLE_OMP_ORDERED
:
1627 case GIMPLE_OMP_SECTION
:
1628 dump_gimple_omp_block (buffer
, gs
, spc
, flags
);
1631 case GIMPLE_OMP_CRITICAL
:
1632 dump_gimple_omp_critical (buffer
, gs
, spc
, flags
);
1636 dump_gimple_catch (buffer
, gs
, spc
, flags
);
1639 case GIMPLE_EH_FILTER
:
1640 dump_gimple_eh_filter (buffer
, gs
, spc
, flags
);
1643 case GIMPLE_EH_MUST_NOT_THROW
:
1644 dump_gimple_eh_must_not_throw (buffer
, gs
, spc
, flags
);
1648 dump_gimple_resx (buffer
, gs
, spc
, flags
);
1651 case GIMPLE_EH_DISPATCH
:
1652 dump_gimple_eh_dispatch (buffer
, gs
, spc
, flags
);
1656 dump_gimple_debug (buffer
, gs
, spc
, flags
);
1659 case GIMPLE_PREDICT
:
1660 pp_string (buffer
, "// predicted ");
1661 if (gimple_predict_outcome (gs
))
1662 pp_string (buffer
, "likely by ");
1664 pp_string (buffer
, "unlikely by ");
1665 pp_string (buffer
, predictor_name (gimple_predict_predictor (gs
)));
1666 pp_string (buffer
, " predictor.");
1673 /* If we're building a diagnostic, the formatted text will be
1674 written into BUFFER's stream by the caller; otherwise, write it
1676 if (!(flags
& TDF_DIAGNOSTIC
))
1677 pp_write_text_to_stream (buffer
);
1681 /* Dumps header of basic block BB to buffer BUFFER indented by INDENT
1682 spaces and details described by flags. */
1685 dump_bb_header (pretty_printer
*buffer
, basic_block bb
, int indent
, int flags
)
1691 if (flags
& TDF_BLOCKS
)
1694 pp_string (buffer
, "# BLOCK ");
1695 pp_decimal_int (buffer
, bb
->index
);
1698 pp_string (buffer
, " freq:");
1699 pp_decimal_int (buffer
, bb
->frequency
);
1703 pp_string (buffer
, " count:");
1704 pp_widest_integer (buffer
, bb
->count
);
1707 if (flags
& TDF_LINENO
)
1709 gimple_stmt_iterator gsi
;
1711 for (gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
); gsi_next (&gsi
))
1712 if (!is_gimple_debug (gsi_stmt (gsi
))
1713 && get_lineno (gsi_stmt (gsi
)) != UNKNOWN_LOCATION
)
1715 pp_string (buffer
, ", starting at line ");
1716 pp_decimal_int (buffer
, get_lineno (gsi_stmt (gsi
)));
1720 if (bb
->discriminator
)
1722 pp_string (buffer
, ", discriminator ");
1723 pp_decimal_int (buffer
, bb
->discriminator
);
1726 newline_and_indent (buffer
, indent
);
1728 pp_string (buffer
, "# PRED:");
1729 pp_write_text_to_stream (buffer
);
1730 FOR_EACH_EDGE (e
, ei
, bb
->preds
)
1731 if (flags
& TDF_SLIM
)
1733 pp_character (buffer
, ' ');
1734 if (e
->src
== ENTRY_BLOCK_PTR
)
1735 pp_string (buffer
, "ENTRY");
1737 pp_decimal_int (buffer
, e
->src
->index
);
1740 dump_edge_info (buffer
->buffer
->stream
, e
, 0);
1741 pp_newline (buffer
);
1745 stmt
= first_stmt (bb
);
1746 if (!stmt
|| gimple_code (stmt
) != GIMPLE_LABEL
)
1748 INDENT (indent
- 2);
1749 pp_string (buffer
, "<bb ");
1750 pp_decimal_int (buffer
, bb
->index
);
1751 pp_string (buffer
, ">:");
1752 pp_newline (buffer
);
1755 pp_write_text_to_stream (buffer
);
1756 check_bb_profile (bb
, buffer
->buffer
->stream
);
1760 /* Dumps end of basic block BB to buffer BUFFER indented by INDENT
1764 dump_bb_end (pretty_printer
*buffer
, basic_block bb
, int indent
, int flags
)
1770 pp_string (buffer
, "# SUCC:");
1771 pp_write_text_to_stream (buffer
);
1772 FOR_EACH_EDGE (e
, ei
, bb
->succs
)
1773 if (flags
& TDF_SLIM
)
1775 pp_character (buffer
, ' ');
1776 if (e
->dest
== EXIT_BLOCK_PTR
)
1777 pp_string (buffer
, "EXIT");
1779 pp_decimal_int (buffer
, e
->dest
->index
);
1782 dump_edge_info (buffer
->buffer
->stream
, e
, 1);
1783 pp_newline (buffer
);
1787 /* Dump PHI nodes of basic block BB to BUFFER with details described
1788 by FLAGS and indented by INDENT spaces. */
1791 dump_phi_nodes (pretty_printer
*buffer
, basic_block bb
, int indent
, int flags
)
1793 gimple_stmt_iterator i
;
1795 for (i
= gsi_start_phis (bb
); !gsi_end_p (i
); gsi_next (&i
))
1797 gimple phi
= gsi_stmt (i
);
1798 if (is_gimple_reg (gimple_phi_result (phi
)) || (flags
& TDF_VOPS
))
1801 pp_string (buffer
, "# ");
1802 dump_gimple_phi (buffer
, phi
, indent
, flags
);
1803 pp_newline (buffer
);
1809 /* Dump jump to basic block BB that is represented implicitly in the cfg
1813 pp_cfg_jump (pretty_printer
*buffer
, basic_block bb
)
1817 stmt
= first_stmt (bb
);
1819 pp_string (buffer
, "goto <bb ");
1820 pp_decimal_int (buffer
, bb
->index
);
1821 pp_character (buffer
, '>');
1822 if (stmt
&& gimple_code (stmt
) == GIMPLE_LABEL
)
1824 pp_string (buffer
, " (");
1825 dump_generic_node (buffer
, gimple_label_label (stmt
), 0, 0, false);
1826 pp_character (buffer
, ')');
1827 pp_semicolon (buffer
);
1830 pp_semicolon (buffer
);
1834 /* Dump edges represented implicitly in basic block BB to BUFFER, indented
1835 by INDENT spaces, with details given by FLAGS. */
1838 dump_implicit_edges (pretty_printer
*buffer
, basic_block bb
, int indent
,
1845 stmt
= last_stmt (bb
);
1847 if (stmt
&& gimple_code (stmt
) == GIMPLE_COND
)
1849 edge true_edge
, false_edge
;
1851 /* When we are emitting the code or changing CFG, it is possible that
1852 the edges are not yet created. When we are using debug_bb in such
1853 a situation, we do not want it to crash. */
1854 if (EDGE_COUNT (bb
->succs
) != 2)
1856 extract_true_false_edges_from_block (bb
, &true_edge
, &false_edge
);
1858 INDENT (indent
+ 2);
1859 pp_cfg_jump (buffer
, true_edge
->dest
);
1860 newline_and_indent (buffer
, indent
);
1861 pp_string (buffer
, "else");
1862 newline_and_indent (buffer
, indent
+ 2);
1863 pp_cfg_jump (buffer
, false_edge
->dest
);
1864 pp_newline (buffer
);
1868 /* If there is a fallthru edge, we may need to add an artificial
1869 goto to the dump. */
1870 FOR_EACH_EDGE (e
, ei
, bb
->succs
)
1871 if (e
->flags
& EDGE_FALLTHRU
)
1874 if (e
&& e
->dest
!= bb
->next_bb
)
1878 if ((flags
& TDF_LINENO
)
1879 && e
->goto_locus
!= UNKNOWN_LOCATION
1882 expanded_location goto_xloc
;
1883 goto_xloc
= expand_location (e
->goto_locus
);
1884 pp_character (buffer
, '[');
1887 pp_string (buffer
, goto_xloc
.file
);
1888 pp_string (buffer
, " : ");
1890 pp_decimal_int (buffer
, goto_xloc
.line
);
1891 pp_string (buffer
, " : ");
1892 pp_decimal_int (buffer
, goto_xloc
.column
);
1893 pp_string (buffer
, "] ");
1896 pp_cfg_jump (buffer
, e
->dest
);
1897 pp_newline (buffer
);
1902 /* Dumps basic block BB to buffer BUFFER with details described by FLAGS and
1903 indented by INDENT spaces. */
1906 gimple_dump_bb_buff (pretty_printer
*buffer
, basic_block bb
, int indent
,
1909 gimple_stmt_iterator gsi
;
1911 int label_indent
= indent
- 2;
1913 if (label_indent
< 0)
1916 dump_bb_header (buffer
, bb
, indent
, flags
);
1917 dump_phi_nodes (buffer
, bb
, indent
, flags
);
1919 for (gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
); gsi_next (&gsi
))
1923 stmt
= gsi_stmt (gsi
);
1925 curr_indent
= gimple_code (stmt
) == GIMPLE_LABEL
? label_indent
: indent
;
1927 INDENT (curr_indent
);
1928 dump_gimple_stmt (buffer
, stmt
, curr_indent
, flags
);
1929 pp_newline (buffer
);
1930 dump_histograms_for_stmt (cfun
, buffer
->buffer
->stream
, stmt
);
1933 dump_implicit_edges (buffer
, bb
, indent
, flags
);
1935 if (flags
& TDF_BLOCKS
)
1936 dump_bb_end (buffer
, bb
, indent
, flags
);
1940 /* Dumps basic block BB to FILE with details described by FLAGS and
1941 indented by INDENT spaces. */
1944 gimple_dump_bb (basic_block bb
, FILE *file
, int indent
, int flags
)
1946 maybe_init_pretty_print (file
);
1947 gimple_dump_bb_buff (&buffer
, bb
, indent
, flags
);