1 /* Pretty formatting of GIMPLE statements and expressions.
2 Copyright (C) 2001-2013 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"
27 #include "diagnostic.h"
28 #include "gimple-pretty-print.h"
30 #include "tree-flow.h"
31 #include "dumpfile.h" /* for dump_flags */
33 #include "value-prof.h"
34 #include "trans-mem.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 indentation 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
);
90 /* Print GIMPLE statement G to FILE using SPC indentation spaces and
91 FLAGS as in pp_gimple_stmt_1. */
94 print_gimple_stmt (FILE *file
, gimple g
, int spc
, int flags
)
96 maybe_init_pretty_print (file
);
97 pp_gimple_stmt_1 (&buffer
, g
, spc
, flags
);
98 pp_newline_and_flush (&buffer
);
102 debug (gimple_statement_d
&ref
)
104 print_gimple_stmt (stderr
, &ref
, 0, 0);
108 debug (gimple_statement_d
*ptr
)
113 fprintf (stderr
, "<nil>\n");
117 /* Print GIMPLE statement G to FILE using SPC indentation spaces and
118 FLAGS as in pp_gimple_stmt_1. Print only the right-hand side
122 print_gimple_expr (FILE *file
, gimple g
, int spc
, int flags
)
124 flags
|= TDF_RHS_ONLY
;
125 maybe_init_pretty_print (file
);
126 pp_gimple_stmt_1 (&buffer
, g
, spc
, flags
);
131 /* Print the GIMPLE sequence SEQ on BUFFER using SPC indentation
132 spaces and FLAGS as in pp_gimple_stmt_1.
133 The caller is responsible for calling pp_flush on BUFFER to finalize
134 the pretty printer. */
137 dump_gimple_seq (pretty_printer
*buffer
, gimple_seq seq
, int spc
, int flags
)
139 gimple_stmt_iterator i
;
141 for (i
= gsi_start (seq
); !gsi_end_p (i
); gsi_next (&i
))
143 gimple gs
= gsi_stmt (i
);
145 pp_gimple_stmt_1 (buffer
, gs
, spc
, flags
);
146 if (!gsi_one_before_end_p (i
))
152 /* Print GIMPLE sequence SEQ to FILE using SPC indentation spaces and
153 FLAGS as in pp_gimple_stmt_1. */
156 print_gimple_seq (FILE *file
, gimple_seq seq
, int spc
, int flags
)
158 maybe_init_pretty_print (file
);
159 dump_gimple_seq (&buffer
, seq
, spc
, flags
);
160 pp_newline_and_flush (&buffer
);
164 /* Print the GIMPLE sequence SEQ on stderr. */
167 debug_gimple_seq (gimple_seq seq
)
169 print_gimple_seq (stderr
, seq
, 0, TDF_VOPS
|TDF_MEMSYMS
);
173 /* A simple helper to pretty-print some of the gimple tuples in the printf
174 style. The format modifiers are preceded by '%' and are:
175 'G' - outputs a string corresponding to the code of the given gimple,
176 'S' - outputs a gimple_seq with indent of spc + 2,
177 'T' - outputs the tree t,
178 'd' - outputs an int as a decimal,
179 's' - outputs a string,
180 'n' - outputs a newline,
181 'x' - outputs an int as hexadecimal,
182 '+' - increases indent by 2 then outputs a newline,
183 '-' - decreases indent by 2 then outputs a newline. */
186 dump_gimple_fmt (pretty_printer
*buffer
, int spc
, int flags
,
187 const char *fmt
, ...)
193 va_start (args
, fmt
);
194 for (c
= fmt
; *c
; c
++)
204 g
= va_arg (args
, gimple
);
205 tmp
= gimple_code_name
[gimple_code (g
)];
206 pp_string (buffer
, tmp
);
210 seq
= va_arg (args
, gimple_seq
);
212 dump_gimple_seq (buffer
, seq
, spc
+ 2, flags
);
213 newline_and_indent (buffer
, spc
);
217 t
= va_arg (args
, tree
);
219 pp_string (buffer
, "NULL");
221 dump_generic_node (buffer
, t
, spc
, flags
, false);
225 pp_decimal_int (buffer
, va_arg (args
, int));
229 pp_string (buffer
, va_arg (args
, char *));
233 newline_and_indent (buffer
, spc
);
237 pp_scalar (buffer
, "%x", va_arg (args
, int));
242 newline_and_indent (buffer
, spc
);
247 newline_and_indent (buffer
, spc
);
255 pp_character (buffer
, *c
);
261 /* Helper for dump_gimple_assign. Print the unary RHS of the
262 assignment GS. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. */
265 dump_unary_rhs (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
267 enum tree_code rhs_code
= gimple_assign_rhs_code (gs
);
268 tree lhs
= gimple_assign_lhs (gs
);
269 tree rhs
= gimple_assign_rhs1 (gs
);
273 case VIEW_CONVERT_EXPR
:
275 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
278 case FIXED_CONVERT_EXPR
:
279 case ADDR_SPACE_CONVERT_EXPR
:
283 pp_character (buffer
, '(');
284 dump_generic_node (buffer
, TREE_TYPE (lhs
), spc
, flags
, false);
285 pp_string (buffer
, ") ");
286 if (op_prio (rhs
) < op_code_prio (rhs_code
))
288 pp_character (buffer
, '(');
289 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
290 pp_character (buffer
, ')');
293 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
297 pp_string (buffer
, "((");
298 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
299 pp_string (buffer
, "))");
303 pp_string (buffer
, "ABS_EXPR <");
304 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
305 pp_character (buffer
, '>');
309 if (TREE_CODE_CLASS (rhs_code
) == tcc_declaration
310 || TREE_CODE_CLASS (rhs_code
) == tcc_constant
311 || TREE_CODE_CLASS (rhs_code
) == tcc_reference
312 || rhs_code
== SSA_NAME
313 || rhs_code
== ADDR_EXPR
314 || rhs_code
== CONSTRUCTOR
)
316 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
319 else if (rhs_code
== BIT_NOT_EXPR
)
320 pp_character (buffer
, '~');
321 else if (rhs_code
== TRUTH_NOT_EXPR
)
322 pp_character (buffer
, '!');
323 else if (rhs_code
== NEGATE_EXPR
)
324 pp_character (buffer
, '-');
327 pp_character (buffer
, '[');
328 pp_string (buffer
, tree_code_name
[rhs_code
]);
329 pp_string (buffer
, "] ");
332 if (op_prio (rhs
) < op_code_prio (rhs_code
))
334 pp_character (buffer
, '(');
335 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
336 pp_character (buffer
, ')');
339 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
345 /* Helper for dump_gimple_assign. Print the binary RHS of the
346 assignment GS. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. */
349 dump_binary_rhs (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
352 enum tree_code code
= gimple_assign_rhs_code (gs
);
358 case VEC_WIDEN_MULT_HI_EXPR
:
359 case VEC_WIDEN_MULT_LO_EXPR
:
360 case VEC_WIDEN_MULT_EVEN_EXPR
:
361 case VEC_WIDEN_MULT_ODD_EXPR
:
362 case VEC_PACK_TRUNC_EXPR
:
363 case VEC_PACK_SAT_EXPR
:
364 case VEC_PACK_FIX_TRUNC_EXPR
:
365 case VEC_WIDEN_LSHIFT_HI_EXPR
:
366 case VEC_WIDEN_LSHIFT_LO_EXPR
:
367 for (p
= tree_code_name
[(int) code
]; *p
; p
++)
368 pp_character (buffer
, TOUPPER (*p
));
369 pp_string (buffer
, " <");
370 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
371 pp_string (buffer
, ", ");
372 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
373 pp_character (buffer
, '>');
377 if (op_prio (gimple_assign_rhs1 (gs
)) <= op_code_prio (code
))
379 pp_character (buffer
, '(');
380 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
,
382 pp_character (buffer
, ')');
385 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
387 pp_string (buffer
, op_symbol_code (gimple_assign_rhs_code (gs
)));
389 if (op_prio (gimple_assign_rhs2 (gs
)) <= op_code_prio (code
))
391 pp_character (buffer
, '(');
392 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
,
394 pp_character (buffer
, ')');
397 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
401 /* Helper for dump_gimple_assign. Print the ternary RHS of the
402 assignment GS. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1. */
405 dump_ternary_rhs (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
408 enum tree_code code
= gimple_assign_rhs_code (gs
);
411 case WIDEN_MULT_PLUS_EXPR
:
412 case WIDEN_MULT_MINUS_EXPR
:
413 for (p
= tree_code_name
[(int) code
]; *p
; p
++)
414 pp_character (buffer
, TOUPPER (*p
));
415 pp_string (buffer
, " <");
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);
421 pp_character (buffer
, '>');
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);
433 pp_string (buffer
, "DOT_PROD_EXPR <");
434 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
435 pp_string (buffer
, ", ");
436 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
437 pp_string (buffer
, ", ");
438 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
439 pp_string (buffer
, ">");
443 pp_string (buffer
, "VEC_PERM_EXPR <");
444 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
445 pp_string (buffer
, ", ");
446 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
447 pp_string (buffer
, ", ");
448 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
449 pp_string (buffer
, ">");
452 case REALIGN_LOAD_EXPR
:
453 pp_string (buffer
, "REALIGN_LOAD <");
454 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
455 pp_string (buffer
, ", ");
456 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
457 pp_string (buffer
, ", ");
458 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
459 pp_string (buffer
, ">");
463 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
464 pp_string (buffer
, " ? ");
465 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
466 pp_string (buffer
, " : ");
467 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
471 pp_string (buffer
, "VEC_COND_EXPR <");
472 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
473 pp_string (buffer
, ", ");
474 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
475 pp_string (buffer
, ", ");
476 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
477 pp_string (buffer
, ">");
486 /* Dump the gimple assignment GS. BUFFER, SPC and FLAGS are as in
490 dump_gimple_assign (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
497 switch (gimple_num_ops (gs
))
500 arg3
= gimple_assign_rhs3 (gs
);
502 arg2
= gimple_assign_rhs2 (gs
);
504 arg1
= gimple_assign_rhs1 (gs
);
510 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%s, %T, %T, %T, %T>", gs
,
511 tree_code_name
[gimple_assign_rhs_code (gs
)],
512 gimple_assign_lhs (gs
), arg1
, arg2
, arg3
);
516 if (!(flags
& TDF_RHS_ONLY
))
518 dump_generic_node (buffer
, gimple_assign_lhs (gs
), spc
, flags
, false);
520 pp_character (buffer
, '=');
522 if (gimple_assign_nontemporal_move_p (gs
))
523 pp_string (buffer
, "{nt}");
525 if (gimple_has_volatile_ops (gs
))
526 pp_string (buffer
, "{v}");
531 if (gimple_num_ops (gs
) == 2)
532 dump_unary_rhs (buffer
, gs
, spc
, flags
);
533 else if (gimple_num_ops (gs
) == 3)
534 dump_binary_rhs (buffer
, gs
, spc
, flags
);
535 else if (gimple_num_ops (gs
) == 4)
536 dump_ternary_rhs (buffer
, gs
, spc
, flags
);
539 if (!(flags
& TDF_RHS_ONLY
))
540 pp_semicolon(buffer
);
545 /* Dump the return statement GS. BUFFER, SPC and FLAGS are as in
549 dump_gimple_return (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
553 t
= gimple_return_retval (gs
);
555 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
, t
);
558 pp_string (buffer
, "return");
562 dump_generic_node (buffer
, t
, spc
, flags
, false);
564 pp_semicolon (buffer
);
569 /* Dump the call arguments for a gimple call. BUFFER, FLAGS are as in
573 dump_gimple_call_args (pretty_printer
*buffer
, gimple gs
, int flags
)
577 for (i
= 0; i
< gimple_call_num_args (gs
); i
++)
579 dump_generic_node (buffer
, gimple_call_arg (gs
, i
), 0, flags
, false);
580 if (i
< gimple_call_num_args (gs
) - 1)
581 pp_string (buffer
, ", ");
584 if (gimple_call_va_arg_pack_p (gs
))
586 if (gimple_call_num_args (gs
) > 0)
588 pp_character (buffer
, ',');
592 pp_string (buffer
, "__builtin_va_arg_pack ()");
596 /* Dump the points-to solution *PT to BUFFER. */
599 pp_points_to_solution (pretty_printer
*buffer
, struct pt_solution
*pt
)
603 pp_string (buffer
, "anything ");
607 pp_string (buffer
, "nonlocal ");
609 pp_string (buffer
, "escaped ");
611 pp_string (buffer
, "unit-escaped ");
613 pp_string (buffer
, "null ");
615 && !bitmap_empty_p (pt
->vars
))
619 pp_string (buffer
, "{ ");
620 EXECUTE_IF_SET_IN_BITMAP (pt
->vars
, 0, i
, bi
)
622 pp_string (buffer
, "D.");
623 pp_decimal_int (buffer
, i
);
624 pp_character (buffer
, ' ');
626 pp_character (buffer
, '}');
627 if (pt
->vars_contains_global
)
628 pp_string (buffer
, " (glob)");
632 /* Dump the call statement GS. BUFFER, SPC and FLAGS are as in
636 dump_gimple_call (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
638 tree lhs
= gimple_call_lhs (gs
);
639 tree fn
= gimple_call_fn (gs
);
641 if (flags
& TDF_ALIAS
)
643 struct pt_solution
*pt
;
644 pt
= gimple_call_use_set (gs
);
645 if (!pt_solution_empty_p (pt
))
647 pp_string (buffer
, "# USE = ");
648 pp_points_to_solution (buffer
, pt
);
649 newline_and_indent (buffer
, spc
);
651 pt
= gimple_call_clobber_set (gs
);
652 if (!pt_solution_empty_p (pt
))
654 pp_string (buffer
, "# CLB = ");
655 pp_points_to_solution (buffer
, pt
);
656 newline_and_indent (buffer
, spc
);
662 if (gimple_call_internal_p (gs
))
663 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%s, %T", gs
,
664 internal_fn_name (gimple_call_internal_fn (gs
)), lhs
);
666 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T", gs
, fn
, lhs
);
667 if (gimple_call_num_args (gs
) > 0)
669 pp_string (buffer
, ", ");
670 dump_gimple_call_args (buffer
, gs
, flags
);
672 pp_character (buffer
, '>');
676 if (lhs
&& !(flags
& TDF_RHS_ONLY
))
678 dump_generic_node (buffer
, lhs
, spc
, flags
, false);
679 pp_string (buffer
, " =");
681 if (gimple_has_volatile_ops (gs
))
682 pp_string (buffer
, "{v}");
686 if (gimple_call_internal_p (gs
))
687 pp_string (buffer
, internal_fn_name (gimple_call_internal_fn (gs
)));
689 print_call_name (buffer
, fn
, flags
);
690 pp_string (buffer
, " (");
691 dump_gimple_call_args (buffer
, gs
, flags
);
692 pp_character (buffer
, ')');
693 if (!(flags
& TDF_RHS_ONLY
))
694 pp_semicolon (buffer
);
697 if (gimple_call_chain (gs
))
699 pp_string (buffer
, " [static-chain: ");
700 dump_generic_node (buffer
, gimple_call_chain (gs
), spc
, flags
, false);
701 pp_character (buffer
, ']');
704 if (gimple_call_return_slot_opt_p (gs
))
705 pp_string (buffer
, " [return slot optimization]");
706 if (gimple_call_tail_p (gs
))
707 pp_string (buffer
, " [tail call]");
712 /* Dump the arguments of _ITM_beginTransaction sanely. */
713 if (TREE_CODE (fn
) == ADDR_EXPR
)
714 fn
= TREE_OPERAND (fn
, 0);
715 if (TREE_CODE (fn
) == FUNCTION_DECL
&& decl_is_tm_clone (fn
))
716 pp_string (buffer
, " [tm-clone]");
717 if (TREE_CODE (fn
) == FUNCTION_DECL
718 && DECL_BUILT_IN_CLASS (fn
) == BUILT_IN_NORMAL
719 && DECL_FUNCTION_CODE (fn
) == BUILT_IN_TM_START
720 && gimple_call_num_args (gs
) > 0)
722 tree t
= gimple_call_arg (gs
, 0);
723 unsigned HOST_WIDE_INT props
;
724 gcc_assert (TREE_CODE (t
) == INTEGER_CST
);
726 pp_string (buffer
, " [ ");
728 /* Get the transaction code properties. */
729 props
= TREE_INT_CST_LOW (t
);
731 if (props
& PR_INSTRUMENTEDCODE
)
732 pp_string (buffer
, "instrumentedCode ");
733 if (props
& PR_UNINSTRUMENTEDCODE
)
734 pp_string (buffer
, "uninstrumentedCode ");
735 if (props
& PR_HASNOXMMUPDATE
)
736 pp_string (buffer
, "hasNoXMMUpdate ");
737 if (props
& PR_HASNOABORT
)
738 pp_string (buffer
, "hasNoAbort ");
739 if (props
& PR_HASNOIRREVOCABLE
)
740 pp_string (buffer
, "hasNoIrrevocable ");
741 if (props
& PR_DOESGOIRREVOCABLE
)
742 pp_string (buffer
, "doesGoIrrevocable ");
743 if (props
& PR_HASNOSIMPLEREADS
)
744 pp_string (buffer
, "hasNoSimpleReads ");
745 if (props
& PR_AWBARRIERSOMITTED
)
746 pp_string (buffer
, "awBarriersOmitted ");
747 if (props
& PR_RARBARRIERSOMITTED
)
748 pp_string (buffer
, "RaRBarriersOmitted ");
749 if (props
& PR_UNDOLOGCODE
)
750 pp_string (buffer
, "undoLogCode ");
751 if (props
& PR_PREFERUNINSTRUMENTED
)
752 pp_string (buffer
, "preferUninstrumented ");
753 if (props
& PR_EXCEPTIONBLOCK
)
754 pp_string (buffer
, "exceptionBlock ");
755 if (props
& PR_HASELSE
)
756 pp_string (buffer
, "hasElse ");
757 if (props
& PR_READONLY
)
758 pp_string (buffer
, "readOnly ");
760 pp_string (buffer
, "]");
765 /* Dump the switch statement GS. BUFFER, SPC and FLAGS are as in
769 dump_gimple_switch (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
773 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
775 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, ", gs
,
776 gimple_switch_index (gs
));
779 pp_string (buffer
, "switch (");
780 dump_generic_node (buffer
, gimple_switch_index (gs
), spc
, flags
, true);
781 pp_string (buffer
, ") <");
784 for (i
= 0; i
< gimple_switch_num_labels (gs
); i
++)
786 tree case_label
= gimple_switch_label (gs
, i
);
787 gcc_checking_assert (case_label
!= NULL_TREE
);
788 dump_generic_node (buffer
, case_label
, spc
, flags
, false);
789 pp_character (buffer
, ' ');
790 dump_generic_node (buffer
, CASE_LABEL (case_label
), spc
, flags
, false);
791 if (i
< gimple_switch_num_labels (gs
) - 1)
792 pp_string (buffer
, ", ");
794 pp_character (buffer
, '>');
798 /* Dump the gimple conditional GS. BUFFER, SPC and FLAGS are as in
802 dump_gimple_cond (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
805 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%s, %T, %T, %T, %T>", gs
,
806 tree_code_name
[gimple_cond_code (gs
)],
807 gimple_cond_lhs (gs
), gimple_cond_rhs (gs
),
808 gimple_cond_true_label (gs
), gimple_cond_false_label (gs
));
811 if (!(flags
& TDF_RHS_ONLY
))
812 pp_string (buffer
, "if (");
813 dump_generic_node (buffer
, gimple_cond_lhs (gs
), spc
, flags
, false);
815 pp_string (buffer
, op_symbol_code (gimple_cond_code (gs
)));
817 dump_generic_node (buffer
, gimple_cond_rhs (gs
), spc
, flags
, false);
818 if (!(flags
& TDF_RHS_ONLY
))
820 pp_character (buffer
, ')');
822 if (gimple_cond_true_label (gs
))
824 pp_string (buffer
, " goto ");
825 dump_generic_node (buffer
, gimple_cond_true_label (gs
),
827 pp_semicolon (buffer
);
829 if (gimple_cond_false_label (gs
))
831 pp_string (buffer
, " else goto ");
832 dump_generic_node (buffer
, gimple_cond_false_label (gs
),
834 pp_semicolon (buffer
);
841 /* Dump a GIMPLE_LABEL tuple on the pretty_printer BUFFER, SPC
842 spaces of indent. FLAGS specifies details to show in the dump (see
843 TDF_* in dumpfils.h). */
846 dump_gimple_label (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
848 tree label
= gimple_label_label (gs
);
850 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
, label
);
853 dump_generic_node (buffer
, label
, spc
, flags
, false);
854 pp_character (buffer
, ':');
856 if (DECL_NONLOCAL (label
))
857 pp_string (buffer
, " [non-local]");
858 if ((flags
& TDF_EH
) && EH_LANDING_PAD_NR (label
))
859 pp_printf (buffer
, " [LP %d]", EH_LANDING_PAD_NR (label
));
862 /* Dump a GIMPLE_GOTO tuple on the pretty_printer BUFFER, SPC
863 spaces of indent. FLAGS specifies details to show in the dump (see
864 TDF_* in dumpfile.h). */
867 dump_gimple_goto (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
869 tree label
= gimple_goto_dest (gs
);
871 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
, label
);
873 dump_gimple_fmt (buffer
, spc
, flags
, "goto %T;", label
);
877 /* Dump a GIMPLE_BIND tuple on the pretty_printer BUFFER, SPC
878 spaces of indent. FLAGS specifies details to show in the dump (see
879 TDF_* in dumpfile.h). */
882 dump_gimple_bind (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
885 dump_gimple_fmt (buffer
, spc
, flags
, "%G <", gs
);
887 pp_character (buffer
, '{');
888 if (!(flags
& TDF_SLIM
))
892 for (var
= gimple_bind_vars (gs
); var
; var
= DECL_CHAIN (var
))
894 newline_and_indent (buffer
, 2);
895 print_declaration (buffer
, var
, spc
, flags
);
897 if (gimple_bind_vars (gs
))
901 dump_gimple_seq (buffer
, gimple_bind_body (gs
), spc
+ 2, flags
);
902 newline_and_indent (buffer
, spc
);
904 pp_character (buffer
, '>');
906 pp_character (buffer
, '}');
910 /* Dump a GIMPLE_TRY tuple on the pretty_printer BUFFER, SPC spaces of
911 indent. FLAGS specifies details to show in the dump (see TDF_* in
915 dump_gimple_try (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
920 if (gimple_try_kind (gs
) == GIMPLE_TRY_CATCH
)
921 type
= "GIMPLE_TRY_CATCH";
922 else if (gimple_try_kind (gs
) == GIMPLE_TRY_FINALLY
)
923 type
= "GIMPLE_TRY_FINALLY";
925 type
= "UNKNOWN GIMPLE_TRY";
926 dump_gimple_fmt (buffer
, spc
, flags
,
927 "%G <%s,%+EVAL <%S>%nCLEANUP <%S>%->", gs
, type
,
928 gimple_try_eval (gs
), gimple_try_cleanup (gs
));
932 pp_string (buffer
, "try");
933 newline_and_indent (buffer
, spc
+ 2);
934 pp_character (buffer
, '{');
937 dump_gimple_seq (buffer
, gimple_try_eval (gs
), spc
+ 4, flags
);
938 newline_and_indent (buffer
, spc
+ 2);
939 pp_character (buffer
, '}');
941 if (gimple_try_kind (gs
) == GIMPLE_TRY_CATCH
)
943 newline_and_indent (buffer
, spc
);
944 pp_string (buffer
, "catch");
945 newline_and_indent (buffer
, spc
+ 2);
946 pp_character (buffer
, '{');
948 else if (gimple_try_kind (gs
) == GIMPLE_TRY_FINALLY
)
950 newline_and_indent (buffer
, spc
);
951 pp_string (buffer
, "finally");
952 newline_and_indent (buffer
, spc
+ 2);
953 pp_character (buffer
, '{');
956 pp_string (buffer
, " <UNKNOWN GIMPLE_TRY> {");
959 dump_gimple_seq (buffer
, gimple_try_cleanup (gs
), spc
+ 4, flags
);
960 newline_and_indent (buffer
, spc
+ 2);
961 pp_character (buffer
, '}');
966 /* Dump a GIMPLE_CATCH tuple on the pretty_printer BUFFER, SPC spaces of
967 indent. FLAGS specifies details to show in the dump (see TDF_* in
971 dump_gimple_catch (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
974 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %+CATCH <%S>%->", gs
,
975 gimple_catch_types (gs
), gimple_catch_handler (gs
));
977 dump_gimple_fmt (buffer
, spc
, flags
, "catch (%T)%+{%S}",
978 gimple_catch_types (gs
), gimple_catch_handler (gs
));
982 /* Dump a GIMPLE_EH_FILTER tuple on the pretty_printer BUFFER, SPC spaces of
983 indent. FLAGS specifies details to show in the dump (see TDF_* in
987 dump_gimple_eh_filter (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
990 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %+FAILURE <%S>%->", gs
,
991 gimple_eh_filter_types (gs
),
992 gimple_eh_filter_failure (gs
));
994 dump_gimple_fmt (buffer
, spc
, flags
, "<<<eh_filter (%T)>>>%+{%+%S%-}",
995 gimple_eh_filter_types (gs
),
996 gimple_eh_filter_failure (gs
));
1000 /* Dump a GIMPLE_EH_MUST_NOT_THROW tuple. */
1003 dump_gimple_eh_must_not_throw (pretty_printer
*buffer
, gimple gs
,
1006 if (flags
& TDF_RAW
)
1007 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
,
1008 gimple_eh_must_not_throw_fndecl (gs
));
1010 dump_gimple_fmt (buffer
, spc
, flags
, "<<<eh_must_not_throw (%T)>>>",
1011 gimple_eh_must_not_throw_fndecl (gs
));
1015 /* Dump a GIMPLE_EH_ELSE tuple on the pretty_printer BUFFER, SPC spaces of
1016 indent. FLAGS specifies details to show in the dump (see TDF_* in
1020 dump_gimple_eh_else (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1022 if (flags
& TDF_RAW
)
1023 dump_gimple_fmt (buffer
, spc
, flags
,
1024 "%G <%+N_BODY <%S>%nE_BODY <%S>%->", gs
,
1025 gimple_eh_else_n_body (gs
), gimple_eh_else_e_body (gs
));
1027 dump_gimple_fmt (buffer
, spc
, flags
,
1028 "<<<if_normal_exit>>>%+{%S}%-<<<else_eh_exit>>>%+{%S}",
1029 gimple_eh_else_n_body (gs
), gimple_eh_else_e_body (gs
));
1033 /* Dump a GIMPLE_RESX tuple on the pretty_printer BUFFER, SPC spaces of
1034 indent. FLAGS specifies details to show in the dump (see TDF_* in
1038 dump_gimple_resx (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1040 if (flags
& TDF_RAW
)
1041 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%d>", gs
,
1042 gimple_resx_region (gs
));
1044 dump_gimple_fmt (buffer
, spc
, flags
, "resx %d", gimple_resx_region (gs
));
1047 /* Dump a GIMPLE_EH_DISPATCH tuple on the pretty_printer BUFFER. */
1050 dump_gimple_eh_dispatch (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1052 if (flags
& TDF_RAW
)
1053 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%d>", gs
,
1054 gimple_eh_dispatch_region (gs
));
1056 dump_gimple_fmt (buffer
, spc
, flags
, "eh_dispatch %d",
1057 gimple_eh_dispatch_region (gs
));
1060 /* Dump a GIMPLE_DEBUG tuple on the pretty_printer BUFFER, SPC spaces
1061 of indent. FLAGS specifies details to show in the dump (see TDF_*
1065 dump_gimple_debug (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1067 switch (gs
->gsbase
.subcode
)
1069 case GIMPLE_DEBUG_BIND
:
1070 if (flags
& TDF_RAW
)
1071 dump_gimple_fmt (buffer
, spc
, flags
, "%G BIND <%T, %T>", gs
,
1072 gimple_debug_bind_get_var (gs
),
1073 gimple_debug_bind_get_value (gs
));
1075 dump_gimple_fmt (buffer
, spc
, flags
, "# DEBUG %T => %T",
1076 gimple_debug_bind_get_var (gs
),
1077 gimple_debug_bind_get_value (gs
));
1080 case GIMPLE_DEBUG_SOURCE_BIND
:
1081 if (flags
& TDF_RAW
)
1082 dump_gimple_fmt (buffer
, spc
, flags
, "%G SRCBIND <%T, %T>", gs
,
1083 gimple_debug_source_bind_get_var (gs
),
1084 gimple_debug_source_bind_get_value (gs
));
1086 dump_gimple_fmt (buffer
, spc
, flags
, "# DEBUG %T s=> %T",
1087 gimple_debug_source_bind_get_var (gs
),
1088 gimple_debug_source_bind_get_value (gs
));
1096 /* Dump a GIMPLE_OMP_FOR tuple on the pretty_printer BUFFER. */
1098 dump_gimple_omp_for (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1102 if (flags
& TDF_RAW
)
1104 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1105 gimple_omp_body (gs
));
1106 dump_omp_clauses (buffer
, gimple_omp_for_clauses (gs
), spc
, flags
);
1107 dump_gimple_fmt (buffer
, spc
, flags
, " >,");
1108 for (i
= 0; i
< gimple_omp_for_collapse (gs
); i
++)
1109 dump_gimple_fmt (buffer
, spc
, flags
,
1110 "%+%T, %T, %T, %s, %T,%n",
1111 gimple_omp_for_index (gs
, i
),
1112 gimple_omp_for_initial (gs
, i
),
1113 gimple_omp_for_final (gs
, i
),
1114 tree_code_name
[gimple_omp_for_cond (gs
, i
)],
1115 gimple_omp_for_incr (gs
, i
));
1116 dump_gimple_fmt (buffer
, spc
, flags
, "PRE_BODY <%S>%->",
1117 gimple_omp_for_pre_body (gs
));
1121 pp_string (buffer
, "#pragma omp for");
1122 dump_omp_clauses (buffer
, gimple_omp_for_clauses (gs
), spc
, flags
);
1123 for (i
= 0; i
< gimple_omp_for_collapse (gs
); i
++)
1127 newline_and_indent (buffer
, spc
);
1128 pp_string (buffer
, "for (");
1129 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
1131 pp_string (buffer
, " = ");
1132 dump_generic_node (buffer
, gimple_omp_for_initial (gs
, i
), spc
,
1134 pp_string (buffer
, "; ");
1136 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
1139 switch (gimple_omp_for_cond (gs
, i
))
1142 pp_character (buffer
, '<');
1145 pp_character (buffer
, '>');
1148 pp_string (buffer
, "<=");
1151 pp_string (buffer
, ">=");
1157 dump_generic_node (buffer
, gimple_omp_for_final (gs
, i
), spc
,
1159 pp_string (buffer
, "; ");
1161 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
1163 pp_string (buffer
, " = ");
1164 dump_generic_node (buffer
, gimple_omp_for_incr (gs
, i
), spc
,
1166 pp_character (buffer
, ')');
1169 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1171 newline_and_indent (buffer
, spc
+ 2);
1172 pp_character (buffer
, '{');
1173 pp_newline (buffer
);
1174 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1175 newline_and_indent (buffer
, spc
+ 2);
1176 pp_character (buffer
, '}');
1181 /* Dump a GIMPLE_OMP_CONTINUE tuple on the pretty_printer BUFFER. */
1184 dump_gimple_omp_continue (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1186 if (flags
& TDF_RAW
)
1188 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T>", gs
,
1189 gimple_omp_continue_control_def (gs
),
1190 gimple_omp_continue_control_use (gs
));
1194 pp_string (buffer
, "#pragma omp continue (");
1195 dump_generic_node (buffer
, gimple_omp_continue_control_def (gs
),
1197 pp_character (buffer
, ',');
1199 dump_generic_node (buffer
, gimple_omp_continue_control_use (gs
),
1201 pp_character (buffer
, ')');
1205 /* Dump a GIMPLE_OMP_SINGLE tuple on the pretty_printer BUFFER. */
1208 dump_gimple_omp_single (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1210 if (flags
& TDF_RAW
)
1212 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1213 gimple_omp_body (gs
));
1214 dump_omp_clauses (buffer
, gimple_omp_single_clauses (gs
), spc
, flags
);
1215 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1219 pp_string (buffer
, "#pragma omp single");
1220 dump_omp_clauses (buffer
, gimple_omp_single_clauses (gs
), spc
, flags
);
1221 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1223 newline_and_indent (buffer
, spc
+ 2);
1224 pp_character (buffer
, '{');
1225 pp_newline (buffer
);
1226 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1227 newline_and_indent (buffer
, spc
+ 2);
1228 pp_character (buffer
, '}');
1233 /* Dump a GIMPLE_OMP_SECTIONS tuple on the pretty_printer BUFFER. */
1236 dump_gimple_omp_sections (pretty_printer
*buffer
, gimple gs
, int spc
,
1239 if (flags
& TDF_RAW
)
1241 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1242 gimple_omp_body (gs
));
1243 dump_omp_clauses (buffer
, gimple_omp_sections_clauses (gs
), spc
, flags
);
1244 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1248 pp_string (buffer
, "#pragma omp sections");
1249 if (gimple_omp_sections_control (gs
))
1251 pp_string (buffer
, " <");
1252 dump_generic_node (buffer
, gimple_omp_sections_control (gs
), spc
,
1254 pp_character (buffer
, '>');
1256 dump_omp_clauses (buffer
, gimple_omp_sections_clauses (gs
), spc
, flags
);
1257 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1259 newline_and_indent (buffer
, spc
+ 2);
1260 pp_character (buffer
, '{');
1261 pp_newline (buffer
);
1262 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1263 newline_and_indent (buffer
, spc
+ 2);
1264 pp_character (buffer
, '}');
1269 /* Dump a GIMPLE_OMP_{MASTER,ORDERED,SECTION} tuple on the pretty_printer
1273 dump_gimple_omp_block (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1275 if (flags
& TDF_RAW
)
1276 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1277 gimple_omp_body (gs
));
1280 switch (gimple_code (gs
))
1282 case GIMPLE_OMP_MASTER
:
1283 pp_string (buffer
, "#pragma omp master");
1285 case GIMPLE_OMP_ORDERED
:
1286 pp_string (buffer
, "#pragma omp ordered");
1288 case GIMPLE_OMP_SECTION
:
1289 pp_string (buffer
, "#pragma omp section");
1294 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1296 newline_and_indent (buffer
, spc
+ 2);
1297 pp_character (buffer
, '{');
1298 pp_newline (buffer
);
1299 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1300 newline_and_indent (buffer
, spc
+ 2);
1301 pp_character (buffer
, '}');
1306 /* Dump a GIMPLE_OMP_CRITICAL tuple on the pretty_printer BUFFER. */
1309 dump_gimple_omp_critical (pretty_printer
*buffer
, gimple gs
, int spc
,
1312 if (flags
& TDF_RAW
)
1313 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1314 gimple_omp_body (gs
));
1317 pp_string (buffer
, "#pragma omp critical");
1318 if (gimple_omp_critical_name (gs
))
1320 pp_string (buffer
, " (");
1321 dump_generic_node (buffer
, gimple_omp_critical_name (gs
), spc
,
1323 pp_character (buffer
, ')');
1325 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1327 newline_and_indent (buffer
, spc
+ 2);
1328 pp_character (buffer
, '{');
1329 pp_newline (buffer
);
1330 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1331 newline_and_indent (buffer
, spc
+ 2);
1332 pp_character (buffer
, '}');
1337 /* Dump a GIMPLE_OMP_RETURN tuple on the pretty_printer BUFFER. */
1340 dump_gimple_omp_return (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1342 if (flags
& TDF_RAW
)
1344 dump_gimple_fmt (buffer
, spc
, flags
, "%G <nowait=%d>", gs
,
1345 (int) gimple_omp_return_nowait_p (gs
));
1349 pp_string (buffer
, "#pragma omp return");
1350 if (gimple_omp_return_nowait_p (gs
))
1351 pp_string (buffer
, "(nowait)");
1355 /* Dump a GIMPLE_TRANSACTION tuple on the pretty_printer BUFFER. */
1358 dump_gimple_transaction (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1360 unsigned subcode
= gimple_transaction_subcode (gs
);
1362 if (flags
& TDF_RAW
)
1364 dump_gimple_fmt (buffer
, spc
, flags
,
1365 "%G [SUBCODE=%x,LABEL=%T] <%+BODY <%S> >",
1366 gs
, subcode
, gimple_transaction_label (gs
),
1367 gimple_transaction_body (gs
));
1371 if (subcode
& GTMA_IS_OUTER
)
1372 pp_string (buffer
, "__transaction_atomic [[outer]]");
1373 else if (subcode
& GTMA_IS_RELAXED
)
1374 pp_string (buffer
, "__transaction_relaxed");
1376 pp_string (buffer
, "__transaction_atomic");
1377 subcode
&= ~GTMA_DECLARATION_MASK
;
1379 if (subcode
|| gimple_transaction_label (gs
))
1381 pp_string (buffer
, " //");
1382 if (gimple_transaction_label (gs
))
1384 pp_string (buffer
, " LABEL=");
1385 dump_generic_node (buffer
, gimple_transaction_label (gs
),
1390 pp_string (buffer
, " SUBCODE=[ ");
1391 if (subcode
& GTMA_HAVE_ABORT
)
1393 pp_string (buffer
, "GTMA_HAVE_ABORT ");
1394 subcode
&= ~GTMA_HAVE_ABORT
;
1396 if (subcode
& GTMA_HAVE_LOAD
)
1398 pp_string (buffer
, "GTMA_HAVE_LOAD ");
1399 subcode
&= ~GTMA_HAVE_LOAD
;
1401 if (subcode
& GTMA_HAVE_STORE
)
1403 pp_string (buffer
, "GTMA_HAVE_STORE ");
1404 subcode
&= ~GTMA_HAVE_STORE
;
1406 if (subcode
& GTMA_MAY_ENTER_IRREVOCABLE
)
1408 pp_string (buffer
, "GTMA_MAY_ENTER_IRREVOCABLE ");
1409 subcode
&= ~GTMA_MAY_ENTER_IRREVOCABLE
;
1411 if (subcode
& GTMA_DOES_GO_IRREVOCABLE
)
1413 pp_string (buffer
, "GTMA_DOES_GO_IRREVOCABLE ");
1414 subcode
&= ~GTMA_DOES_GO_IRREVOCABLE
;
1416 if (subcode
& GTMA_HAS_NO_INSTRUMENTATION
)
1418 pp_string (buffer
, "GTMA_HAS_NO_INSTRUMENTATION ");
1419 subcode
&= ~GTMA_HAS_NO_INSTRUMENTATION
;
1422 pp_printf (buffer
, "0x%x ", subcode
);
1423 pp_string (buffer
, "]");
1427 if (!gimple_seq_empty_p (gimple_transaction_body (gs
)))
1429 newline_and_indent (buffer
, spc
+ 2);
1430 pp_character (buffer
, '{');
1431 pp_newline (buffer
);
1432 dump_gimple_seq (buffer
, gimple_transaction_body (gs
),
1434 newline_and_indent (buffer
, spc
+ 2);
1435 pp_character (buffer
, '}');
1440 /* Dump a GIMPLE_ASM tuple on the pretty_printer BUFFER, SPC spaces of
1441 indent. FLAGS specifies details to show in the dump (see TDF_* in
1445 dump_gimple_asm (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1447 unsigned int i
, n
, f
, fields
;
1449 if (flags
& TDF_RAW
)
1451 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+STRING <%n%s%n>", gs
,
1452 gimple_asm_string (gs
));
1454 n
= gimple_asm_noutputs (gs
);
1457 newline_and_indent (buffer
, spc
+ 2);
1458 pp_string (buffer
, "OUTPUT: ");
1459 for (i
= 0; i
< n
; i
++)
1461 dump_generic_node (buffer
, gimple_asm_output_op (gs
, i
),
1464 pp_string (buffer
, ", ");
1468 n
= gimple_asm_ninputs (gs
);
1471 newline_and_indent (buffer
, spc
+ 2);
1472 pp_string (buffer
, "INPUT: ");
1473 for (i
= 0; i
< n
; i
++)
1475 dump_generic_node (buffer
, gimple_asm_input_op (gs
, i
),
1478 pp_string (buffer
, ", ");
1482 n
= gimple_asm_nclobbers (gs
);
1485 newline_and_indent (buffer
, spc
+ 2);
1486 pp_string (buffer
, "CLOBBER: ");
1487 for (i
= 0; i
< n
; i
++)
1489 dump_generic_node (buffer
, gimple_asm_clobber_op (gs
, i
),
1492 pp_string (buffer
, ", ");
1496 n
= gimple_asm_nlabels (gs
);
1499 newline_and_indent (buffer
, spc
+ 2);
1500 pp_string (buffer
, "LABEL: ");
1501 for (i
= 0; i
< n
; i
++)
1503 dump_generic_node (buffer
, gimple_asm_label_op (gs
, i
),
1506 pp_string (buffer
, ", ");
1510 newline_and_indent (buffer
, spc
);
1511 pp_character (buffer
, '>');
1515 pp_string (buffer
, "__asm__");
1516 if (gimple_asm_volatile_p (gs
))
1517 pp_string (buffer
, " __volatile__");
1518 if (gimple_asm_nlabels (gs
))
1519 pp_string (buffer
, " goto");
1520 pp_string (buffer
, "(\"");
1521 pp_string (buffer
, gimple_asm_string (gs
));
1522 pp_string (buffer
, "\"");
1524 if (gimple_asm_nlabels (gs
))
1526 else if (gimple_asm_nclobbers (gs
))
1528 else if (gimple_asm_ninputs (gs
))
1530 else if (gimple_asm_noutputs (gs
))
1535 for (f
= 0; f
< fields
; ++f
)
1537 pp_string (buffer
, " : ");
1542 n
= gimple_asm_noutputs (gs
);
1543 for (i
= 0; i
< n
; i
++)
1545 dump_generic_node (buffer
, gimple_asm_output_op (gs
, i
),
1548 pp_string (buffer
, ", ");
1553 n
= gimple_asm_ninputs (gs
);
1554 for (i
= 0; i
< n
; i
++)
1556 dump_generic_node (buffer
, gimple_asm_input_op (gs
, i
),
1559 pp_string (buffer
, ", ");
1564 n
= gimple_asm_nclobbers (gs
);
1565 for (i
= 0; i
< n
; i
++)
1567 dump_generic_node (buffer
, gimple_asm_clobber_op (gs
, i
),
1570 pp_string (buffer
, ", ");
1575 n
= gimple_asm_nlabels (gs
);
1576 for (i
= 0; i
< n
; i
++)
1578 dump_generic_node (buffer
, gimple_asm_label_op (gs
, i
),
1581 pp_string (buffer
, ", ");
1590 pp_string (buffer
, ");");
1595 /* Dump a PHI node PHI. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1.
1596 The caller is responsible for calling pp_flush on BUFFER to finalize
1600 dump_gimple_phi (pretty_printer
*buffer
, gimple phi
, int spc
, int flags
)
1603 tree lhs
= gimple_phi_result (phi
);
1605 if (flags
& TDF_ALIAS
1606 && POINTER_TYPE_P (TREE_TYPE (lhs
))
1607 && SSA_NAME_PTR_INFO (lhs
))
1609 unsigned int align
, misalign
;
1610 struct ptr_info_def
*pi
= SSA_NAME_PTR_INFO (lhs
);
1611 pp_string (buffer
, "PT = ");
1612 pp_points_to_solution (buffer
, &pi
->pt
);
1613 newline_and_indent (buffer
, spc
);
1614 if (get_ptr_info_alignment (pi
, &align
, &misalign
))
1616 pp_printf (buffer
, "# ALIGN = %u, MISALIGN = %u", align
, misalign
);
1617 newline_and_indent (buffer
, spc
);
1619 pp_string (buffer
, "# ");
1622 if (flags
& TDF_RAW
)
1623 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, ", phi
,
1624 gimple_phi_result (phi
));
1627 dump_generic_node (buffer
, lhs
, spc
, flags
, false);
1628 pp_string (buffer
, " = PHI <");
1630 for (i
= 0; i
< gimple_phi_num_args (phi
); i
++)
1632 if ((flags
& TDF_LINENO
) && gimple_phi_arg_has_location (phi
, i
))
1634 expanded_location xloc
;
1636 xloc
= expand_location (gimple_phi_arg_location (phi
, i
));
1637 pp_character (buffer
, '[');
1640 pp_string (buffer
, xloc
.file
);
1641 pp_string (buffer
, " : ");
1643 pp_decimal_int (buffer
, xloc
.line
);
1644 pp_string (buffer
, ":");
1645 pp_decimal_int (buffer
, xloc
.column
);
1646 pp_string (buffer
, "] ");
1648 dump_generic_node (buffer
, gimple_phi_arg_def (phi
, i
), spc
, flags
,
1650 pp_character (buffer
, '(');
1651 pp_decimal_int (buffer
, gimple_phi_arg_edge (phi
, i
)->src
->index
);
1652 pp_character (buffer
, ')');
1653 if (i
< gimple_phi_num_args (phi
) - 1)
1654 pp_string (buffer
, ", ");
1656 pp_character (buffer
, '>');
1660 /* Dump a GIMPLE_OMP_PARALLEL tuple on the pretty_printer BUFFER, SPC spaces
1661 of indent. FLAGS specifies details to show in the dump (see TDF_* in
1665 dump_gimple_omp_parallel (pretty_printer
*buffer
, gimple gs
, int spc
,
1668 if (flags
& TDF_RAW
)
1670 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1671 gimple_omp_body (gs
));
1672 dump_omp_clauses (buffer
, gimple_omp_parallel_clauses (gs
), spc
, flags
);
1673 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T%n>",
1674 gimple_omp_parallel_child_fn (gs
),
1675 gimple_omp_parallel_data_arg (gs
));
1680 pp_string (buffer
, "#pragma omp parallel");
1681 dump_omp_clauses (buffer
, gimple_omp_parallel_clauses (gs
), spc
, flags
);
1682 if (gimple_omp_parallel_child_fn (gs
))
1684 pp_string (buffer
, " [child fn: ");
1685 dump_generic_node (buffer
, gimple_omp_parallel_child_fn (gs
),
1687 pp_string (buffer
, " (");
1688 if (gimple_omp_parallel_data_arg (gs
))
1689 dump_generic_node (buffer
, gimple_omp_parallel_data_arg (gs
),
1692 pp_string (buffer
, "???");
1693 pp_string (buffer
, ")]");
1695 body
= gimple_omp_body (gs
);
1696 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
1698 newline_and_indent (buffer
, spc
+ 2);
1699 pp_character (buffer
, '{');
1700 pp_newline (buffer
);
1701 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
1702 newline_and_indent (buffer
, spc
+ 2);
1703 pp_character (buffer
, '}');
1707 pp_newline (buffer
);
1708 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
1714 /* Dump a GIMPLE_OMP_TASK tuple on the pretty_printer BUFFER, SPC spaces
1715 of indent. FLAGS specifies details to show in the dump (see TDF_* in
1719 dump_gimple_omp_task (pretty_printer
*buffer
, gimple gs
, int spc
,
1722 if (flags
& TDF_RAW
)
1724 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1725 gimple_omp_body (gs
));
1726 dump_omp_clauses (buffer
, gimple_omp_task_clauses (gs
), spc
, flags
);
1727 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T, %T, %T, %T%n>",
1728 gimple_omp_task_child_fn (gs
),
1729 gimple_omp_task_data_arg (gs
),
1730 gimple_omp_task_copy_fn (gs
),
1731 gimple_omp_task_arg_size (gs
),
1732 gimple_omp_task_arg_size (gs
));
1737 pp_string (buffer
, "#pragma omp task");
1738 dump_omp_clauses (buffer
, gimple_omp_task_clauses (gs
), spc
, flags
);
1739 if (gimple_omp_task_child_fn (gs
))
1741 pp_string (buffer
, " [child fn: ");
1742 dump_generic_node (buffer
, gimple_omp_task_child_fn (gs
),
1744 pp_string (buffer
, " (");
1745 if (gimple_omp_task_data_arg (gs
))
1746 dump_generic_node (buffer
, gimple_omp_task_data_arg (gs
),
1749 pp_string (buffer
, "???");
1750 pp_string (buffer
, ")]");
1752 body
= gimple_omp_body (gs
);
1753 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
1755 newline_and_indent (buffer
, spc
+ 2);
1756 pp_character (buffer
, '{');
1757 pp_newline (buffer
);
1758 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
1759 newline_and_indent (buffer
, spc
+ 2);
1760 pp_character (buffer
, '}');
1764 pp_newline (buffer
);
1765 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
1771 /* Dump a GIMPLE_OMP_ATOMIC_LOAD tuple on the pretty_printer BUFFER, SPC
1772 spaces of indent. FLAGS specifies details to show in the dump (see TDF_*
1776 dump_gimple_omp_atomic_load (pretty_printer
*buffer
, gimple gs
, int spc
,
1779 if (flags
& TDF_RAW
)
1781 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T>", gs
,
1782 gimple_omp_atomic_load_lhs (gs
),
1783 gimple_omp_atomic_load_rhs (gs
));
1787 pp_string (buffer
, "#pragma omp atomic_load");
1788 if (gimple_omp_atomic_need_value_p (gs
))
1789 pp_string (buffer
, " [needed]");
1790 newline_and_indent (buffer
, spc
+ 2);
1791 dump_generic_node (buffer
, gimple_omp_atomic_load_lhs (gs
),
1794 pp_character (buffer
, '=');
1796 pp_character (buffer
, '*');
1797 dump_generic_node (buffer
, gimple_omp_atomic_load_rhs (gs
),
1802 /* Dump a GIMPLE_OMP_ATOMIC_STORE tuple on the pretty_printer BUFFER, SPC
1803 spaces of indent. FLAGS specifies details to show in the dump (see TDF_*
1807 dump_gimple_omp_atomic_store (pretty_printer
*buffer
, gimple gs
, int spc
,
1810 if (flags
& TDF_RAW
)
1812 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
,
1813 gimple_omp_atomic_store_val (gs
));
1817 pp_string (buffer
, "#pragma omp atomic_store ");
1818 if (gimple_omp_atomic_need_value_p (gs
))
1819 pp_string (buffer
, "[needed] ");
1820 pp_character (buffer
, '(');
1821 dump_generic_node (buffer
, gimple_omp_atomic_store_val (gs
),
1823 pp_character (buffer
, ')');
1828 /* Dump all the memory operands for statement GS. BUFFER, SPC and
1829 FLAGS are as in pp_gimple_stmt_1. */
1832 dump_gimple_mem_ops (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1834 tree vdef
= gimple_vdef (gs
);
1835 tree vuse
= gimple_vuse (gs
);
1837 if (!ssa_operands_active (DECL_STRUCT_FUNCTION (current_function_decl
))
1838 || !gimple_references_memory_p (gs
))
1841 if (vdef
!= NULL_TREE
)
1843 pp_string (buffer
, "# ");
1844 dump_generic_node (buffer
, vdef
, spc
+ 2, flags
, false);
1845 pp_string (buffer
, " = VDEF <");
1846 dump_generic_node (buffer
, vuse
, spc
+ 2, flags
, false);
1847 pp_character (buffer
, '>');
1848 newline_and_indent (buffer
, spc
);
1850 else if (vuse
!= NULL_TREE
)
1852 pp_string (buffer
, "# VUSE <");
1853 dump_generic_node (buffer
, vuse
, spc
+ 2, flags
, false);
1854 pp_character (buffer
, '>');
1855 newline_and_indent (buffer
, spc
);
1860 /* Print the gimple statement GS on the pretty printer BUFFER, SPC
1861 spaces of indent. FLAGS specifies details to show in the dump (see
1862 TDF_* in dumpfile.h). The caller is responsible for calling
1863 pp_flush on BUFFER to finalize the pretty printer. */
1866 pp_gimple_stmt_1 (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1871 if (flags
& TDF_STMTADDR
)
1872 pp_printf (buffer
, "<&%p> ", (void *) gs
);
1874 if ((flags
& TDF_LINENO
) && gimple_has_location (gs
))
1876 expanded_location xloc
= expand_location (gimple_location (gs
));
1877 pp_character (buffer
, '[');
1880 pp_string (buffer
, xloc
.file
);
1881 pp_string (buffer
, " : ");
1883 pp_decimal_int (buffer
, xloc
.line
);
1884 pp_string (buffer
, ":");
1885 pp_decimal_int (buffer
, xloc
.column
);
1886 pp_string (buffer
, "] ");
1891 int lp_nr
= lookup_stmt_eh_lp (gs
);
1893 pp_printf (buffer
, "[LP %d] ", lp_nr
);
1895 pp_printf (buffer
, "[MNT %d] ", -lp_nr
);
1898 if ((flags
& (TDF_VOPS
|TDF_MEMSYMS
))
1899 && gimple_has_mem_ops (gs
))
1900 dump_gimple_mem_ops (buffer
, gs
, spc
, flags
);
1902 if ((flags
& TDF_ALIAS
)
1903 && gimple_has_lhs (gs
))
1905 tree lhs
= gimple_get_lhs (gs
);
1906 if (TREE_CODE (lhs
) == SSA_NAME
1907 && POINTER_TYPE_P (TREE_TYPE (lhs
))
1908 && SSA_NAME_PTR_INFO (lhs
))
1910 unsigned int align
, misalign
;
1911 struct ptr_info_def
*pi
= SSA_NAME_PTR_INFO (lhs
);
1912 pp_string (buffer
, "# PT = ");
1913 pp_points_to_solution (buffer
, &pi
->pt
);
1914 newline_and_indent (buffer
, spc
);
1915 if (get_ptr_info_alignment (pi
, &align
, &misalign
))
1917 pp_printf (buffer
, "# ALIGN = %u, MISALIGN = %u",
1919 newline_and_indent (buffer
, spc
);
1924 switch (gimple_code (gs
))
1927 dump_gimple_asm (buffer
, gs
, spc
, flags
);
1931 dump_gimple_assign (buffer
, gs
, spc
, flags
);
1935 dump_gimple_bind (buffer
, gs
, spc
, flags
);
1939 dump_gimple_call (buffer
, gs
, spc
, flags
);
1943 dump_gimple_cond (buffer
, gs
, spc
, flags
);
1947 dump_gimple_label (buffer
, gs
, spc
, flags
);
1951 dump_gimple_goto (buffer
, gs
, spc
, flags
);
1955 pp_string (buffer
, "GIMPLE_NOP");
1959 dump_gimple_return (buffer
, gs
, spc
, flags
);
1963 dump_gimple_switch (buffer
, gs
, spc
, flags
);
1967 dump_gimple_try (buffer
, gs
, spc
, flags
);
1971 dump_gimple_phi (buffer
, gs
, spc
, flags
);
1974 case GIMPLE_OMP_PARALLEL
:
1975 dump_gimple_omp_parallel (buffer
, gs
, spc
, flags
);
1978 case GIMPLE_OMP_TASK
:
1979 dump_gimple_omp_task (buffer
, gs
, spc
, flags
);
1982 case GIMPLE_OMP_ATOMIC_LOAD
:
1983 dump_gimple_omp_atomic_load (buffer
, gs
, spc
, flags
);
1987 case GIMPLE_OMP_ATOMIC_STORE
:
1988 dump_gimple_omp_atomic_store (buffer
, gs
, spc
, flags
);
1991 case GIMPLE_OMP_FOR
:
1992 dump_gimple_omp_for (buffer
, gs
, spc
, flags
);
1995 case GIMPLE_OMP_CONTINUE
:
1996 dump_gimple_omp_continue (buffer
, gs
, spc
, flags
);
1999 case GIMPLE_OMP_SINGLE
:
2000 dump_gimple_omp_single (buffer
, gs
, spc
, flags
);
2003 case GIMPLE_OMP_RETURN
:
2004 dump_gimple_omp_return (buffer
, gs
, spc
, flags
);
2007 case GIMPLE_OMP_SECTIONS
:
2008 dump_gimple_omp_sections (buffer
, gs
, spc
, flags
);
2011 case GIMPLE_OMP_SECTIONS_SWITCH
:
2012 pp_string (buffer
, "GIMPLE_SECTIONS_SWITCH");
2015 case GIMPLE_OMP_MASTER
:
2016 case GIMPLE_OMP_ORDERED
:
2017 case GIMPLE_OMP_SECTION
:
2018 dump_gimple_omp_block (buffer
, gs
, spc
, flags
);
2021 case GIMPLE_OMP_CRITICAL
:
2022 dump_gimple_omp_critical (buffer
, gs
, spc
, flags
);
2026 dump_gimple_catch (buffer
, gs
, spc
, flags
);
2029 case GIMPLE_EH_FILTER
:
2030 dump_gimple_eh_filter (buffer
, gs
, spc
, flags
);
2033 case GIMPLE_EH_MUST_NOT_THROW
:
2034 dump_gimple_eh_must_not_throw (buffer
, gs
, spc
, flags
);
2037 case GIMPLE_EH_ELSE
:
2038 dump_gimple_eh_else (buffer
, gs
, spc
, flags
);
2042 dump_gimple_resx (buffer
, gs
, spc
, flags
);
2045 case GIMPLE_EH_DISPATCH
:
2046 dump_gimple_eh_dispatch (buffer
, gs
, spc
, flags
);
2050 dump_gimple_debug (buffer
, gs
, spc
, flags
);
2053 case GIMPLE_PREDICT
:
2054 pp_string (buffer
, "// predicted ");
2055 if (gimple_predict_outcome (gs
))
2056 pp_string (buffer
, "likely by ");
2058 pp_string (buffer
, "unlikely by ");
2059 pp_string (buffer
, predictor_name (gimple_predict_predictor (gs
)));
2060 pp_string (buffer
, " predictor.");
2063 case GIMPLE_TRANSACTION
:
2064 dump_gimple_transaction (buffer
, gs
, spc
, flags
);
2073 /* Dumps header of basic block BB to OUTF indented by INDENT
2074 spaces and details described by flags. */
2077 dump_gimple_bb_header (FILE *outf
, basic_block bb
, int indent
, int flags
)
2079 if (flags
& TDF_BLOCKS
)
2081 if (flags
& TDF_LINENO
)
2083 gimple_stmt_iterator gsi
;
2085 if (flags
& TDF_COMMENT
)
2086 fputs (";; ", outf
);
2088 for (gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
); gsi_next (&gsi
))
2089 if (!is_gimple_debug (gsi_stmt (gsi
))
2090 && get_lineno (gsi_stmt (gsi
)) != UNKNOWN_LOCATION
)
2092 fprintf (outf
, "%*sstarting at line %d",
2093 indent
, "", get_lineno (gsi_stmt (gsi
)));
2096 if (bb
->discriminator
)
2097 fprintf (outf
, ", discriminator %i", bb
->discriminator
);
2103 gimple stmt
= first_stmt (bb
);
2104 if (!stmt
|| gimple_code (stmt
) != GIMPLE_LABEL
)
2105 fprintf (outf
, "%*s<bb %d>:\n", indent
, "", bb
->index
);
2110 /* Dumps end of basic block BB to buffer BUFFER indented by INDENT
2114 dump_gimple_bb_footer (FILE *outf ATTRIBUTE_UNUSED
,
2115 basic_block bb ATTRIBUTE_UNUSED
,
2116 int indent ATTRIBUTE_UNUSED
,
2117 int flags ATTRIBUTE_UNUSED
)
2119 /* There is currently no GIMPLE-specific basic block info to dump. */
2124 /* Dump PHI nodes of basic block BB to BUFFER with details described
2125 by FLAGS and indented by INDENT spaces. */
2128 dump_phi_nodes (pretty_printer
*buffer
, basic_block bb
, int indent
, int flags
)
2130 gimple_stmt_iterator i
;
2132 for (i
= gsi_start_phis (bb
); !gsi_end_p (i
); gsi_next (&i
))
2134 gimple phi
= gsi_stmt (i
);
2135 if (!virtual_operand_p (gimple_phi_result (phi
)) || (flags
& TDF_VOPS
))
2138 pp_string (buffer
, "# ");
2139 dump_gimple_phi (buffer
, phi
, indent
, flags
);
2140 pp_newline (buffer
);
2146 /* Dump jump to basic block BB that is represented implicitly in the cfg
2150 pp_cfg_jump (pretty_printer
*buffer
, basic_block bb
)
2154 stmt
= first_stmt (bb
);
2156 pp_string (buffer
, "goto <bb ");
2157 pp_decimal_int (buffer
, bb
->index
);
2158 pp_character (buffer
, '>');
2159 if (stmt
&& gimple_code (stmt
) == GIMPLE_LABEL
)
2161 pp_string (buffer
, " (");
2162 dump_generic_node (buffer
, gimple_label_label (stmt
), 0, 0, false);
2163 pp_character (buffer
, ')');
2164 pp_semicolon (buffer
);
2167 pp_semicolon (buffer
);
2171 /* Dump edges represented implicitly in basic block BB to BUFFER, indented
2172 by INDENT spaces, with details given by FLAGS. */
2175 dump_implicit_edges (pretty_printer
*buffer
, basic_block bb
, int indent
,
2181 stmt
= last_stmt (bb
);
2183 if (stmt
&& gimple_code (stmt
) == GIMPLE_COND
)
2185 edge true_edge
, false_edge
;
2187 /* When we are emitting the code or changing CFG, it is possible that
2188 the edges are not yet created. When we are using debug_bb in such
2189 a situation, we do not want it to crash. */
2190 if (EDGE_COUNT (bb
->succs
) != 2)
2192 extract_true_false_edges_from_block (bb
, &true_edge
, &false_edge
);
2194 INDENT (indent
+ 2);
2195 pp_cfg_jump (buffer
, true_edge
->dest
);
2196 newline_and_indent (buffer
, indent
);
2197 pp_string (buffer
, "else");
2198 newline_and_indent (buffer
, indent
+ 2);
2199 pp_cfg_jump (buffer
, false_edge
->dest
);
2200 pp_newline (buffer
);
2204 /* If there is a fallthru edge, we may need to add an artificial
2205 goto to the dump. */
2206 e
= find_fallthru_edge (bb
->succs
);
2208 if (e
&& e
->dest
!= bb
->next_bb
)
2212 if ((flags
& TDF_LINENO
)
2213 && e
->goto_locus
!= UNKNOWN_LOCATION
2216 expanded_location goto_xloc
;
2217 goto_xloc
= expand_location (e
->goto_locus
);
2218 pp_character (buffer
, '[');
2221 pp_string (buffer
, goto_xloc
.file
);
2222 pp_string (buffer
, " : ");
2224 pp_decimal_int (buffer
, goto_xloc
.line
);
2225 pp_string (buffer
, " : ");
2226 pp_decimal_int (buffer
, goto_xloc
.column
);
2227 pp_string (buffer
, "] ");
2230 pp_cfg_jump (buffer
, e
->dest
);
2231 pp_newline (buffer
);
2236 /* Dumps basic block BB to buffer BUFFER with details described by FLAGS and
2237 indented by INDENT spaces. */
2240 gimple_dump_bb_buff (pretty_printer
*buffer
, basic_block bb
, int indent
,
2243 gimple_stmt_iterator gsi
;
2245 int label_indent
= indent
- 2;
2247 if (label_indent
< 0)
2250 dump_phi_nodes (buffer
, bb
, indent
, flags
);
2252 for (gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
); gsi_next (&gsi
))
2256 stmt
= gsi_stmt (gsi
);
2258 curr_indent
= gimple_code (stmt
) == GIMPLE_LABEL
? label_indent
: indent
;
2260 INDENT (curr_indent
);
2261 pp_gimple_stmt_1 (buffer
, stmt
, curr_indent
, flags
);
2262 pp_newline_and_flush (buffer
);
2263 gcc_checking_assert (DECL_STRUCT_FUNCTION (current_function_decl
));
2264 dump_histograms_for_stmt (DECL_STRUCT_FUNCTION (current_function_decl
),
2265 buffer
->buffer
->stream
, stmt
);
2268 dump_implicit_edges (buffer
, bb
, indent
, flags
);
2273 /* Dumps basic block BB to FILE with details described by FLAGS and
2274 indented by INDENT spaces. */
2277 gimple_dump_bb (FILE *file
, basic_block bb
, int indent
, int flags
)
2279 dump_gimple_bb_header (file
, bb
, indent
, flags
);
2280 if (bb
->index
>= NUM_FIXED_BLOCKS
)
2282 maybe_init_pretty_print (file
);
2283 gimple_dump_bb_buff (&buffer
, bb
, indent
, flags
);
2285 dump_gimple_bb_footer (file
, bb
, indent
, flags
);
2288 /* Dumps basic block BB to pretty-printer PP with default dump flags and
2289 no indentation, for use as a label of a DOT graph record-node.
2290 ??? Should just use gimple_dump_bb_buff here, except that value profiling
2291 histogram dumping doesn't know about pretty-printers. */
2294 gimple_dump_bb_for_graph (pretty_printer
*pp
, basic_block bb
)
2296 gimple_stmt_iterator gsi
;
2298 pp_printf (pp
, "<bb %d>:\n", bb
->index
);
2299 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
2301 for (gsi
= gsi_start_phis (bb
); !gsi_end_p (gsi
); gsi_next (&gsi
))
2303 gimple phi
= gsi_stmt (gsi
);
2304 if (!virtual_operand_p (gimple_phi_result (phi
))
2305 || (dump_flags
& TDF_VOPS
))
2307 pp_character (pp
, '|');
2308 pp_write_text_to_stream (pp
);
2309 pp_string (pp
, "# ");
2310 pp_gimple_stmt_1 (pp
, phi
, 0, dump_flags
);
2312 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
2316 for (gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
); gsi_next (&gsi
))
2318 gimple stmt
= gsi_stmt (gsi
);
2319 pp_character (pp
, '|');
2320 pp_write_text_to_stream (pp
);
2321 pp_gimple_stmt_1 (pp
, stmt
, 0, dump_flags
);
2323 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);
2325 dump_implicit_edges (pp
, bb
, 0, dump_flags
);
2326 pp_write_text_as_dot_label_to_stream (pp
, /*for_record=*/true);