1 /* Pretty formatting of GIMPLE statements and expressions.
2 Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
3 2011 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"
29 #include "tree-pretty-print.h"
30 #include "gimple-pretty-print.h"
32 #include "tree-flow.h"
33 #include "tree-pass.h"
35 #include "value-prof.h"
37 #define INDENT(SPACE) \
38 do { int i; for (i = 0; i < SPACE; i++) pp_space (buffer); } while (0)
40 static pretty_printer buffer
;
41 static bool initialized
= false;
43 #define GIMPLE_NIY do_niy (buffer,gs)
45 /* Try to print on BUFFER a default message for the unrecognized
46 gimple statement GS. */
49 do_niy (pretty_printer
*buffer
, gimple gs
)
51 pp_printf (buffer
, "<<< Unknown GIMPLE statement: %s >>>\n",
52 gimple_code_name
[(int) gimple_code (gs
)]);
56 /* Initialize the pretty printer on FILE if needed. */
59 maybe_init_pretty_print (FILE *file
)
63 pp_construct (&buffer
, NULL
, 0);
64 pp_needs_newline (&buffer
) = true;
68 buffer
.buffer
->stream
= file
;
72 /* Emit a newline and SPC indentantion spaces to BUFFER. */
75 newline_and_indent (pretty_printer
*buffer
, int spc
)
82 /* Print the GIMPLE statement GS on stderr. */
85 debug_gimple_stmt (gimple gs
)
87 print_gimple_stmt (stderr
, gs
, 0, TDF_VOPS
|TDF_MEMSYMS
);
88 fprintf (stderr
, "\n");
92 /* Dump GIMPLE statement G to FILE using SPC indentantion spaces and
93 FLAGS as in dump_gimple_stmt. */
96 print_gimple_stmt (FILE *file
, gimple g
, int spc
, int flags
)
98 maybe_init_pretty_print (file
);
99 dump_gimple_stmt (&buffer
, g
, spc
, flags
);
104 /* Dump GIMPLE statement G to FILE using SPC indentantion spaces and
105 FLAGS as in dump_gimple_stmt. Print only the right-hand side
109 print_gimple_expr (FILE *file
, gimple g
, int spc
, int flags
)
111 flags
|= TDF_RHS_ONLY
;
112 maybe_init_pretty_print (file
);
113 dump_gimple_stmt (&buffer
, g
, spc
, flags
);
117 /* Print the GIMPLE sequence SEQ on BUFFER using SPC indentantion
118 spaces and FLAGS as in dump_gimple_stmt. */
121 dump_gimple_seq (pretty_printer
*buffer
, gimple_seq seq
, int spc
, int flags
)
123 gimple_stmt_iterator i
;
125 for (i
= gsi_start (seq
); !gsi_end_p (i
); gsi_next (&i
))
127 gimple gs
= gsi_stmt (i
);
129 dump_gimple_stmt (buffer
, gs
, spc
, flags
);
130 if (!gsi_one_before_end_p (i
))
136 /* Dump GIMPLE sequence SEQ to FILE using SPC indentantion spaces and
137 FLAGS as in dump_gimple_stmt. */
140 print_gimple_seq (FILE *file
, gimple_seq seq
, int spc
, int flags
)
142 maybe_init_pretty_print (file
);
143 dump_gimple_seq (&buffer
, seq
, spc
, flags
);
148 /* Print the GIMPLE sequence SEQ on stderr. */
151 debug_gimple_seq (gimple_seq seq
)
153 print_gimple_seq (stderr
, seq
, 0, TDF_VOPS
|TDF_MEMSYMS
);
157 /* A simple helper to pretty-print some of the gimple tuples in the printf
158 style. The format modifiers are preceeded by '%' and are:
159 'G' - outputs a string corresponding to the code of the given gimple,
160 'S' - outputs a gimple_seq with indent of spc + 2,
161 'T' - outputs the tree t,
162 'd' - outputs an int as a decimal,
163 's' - outputs a string,
164 'n' - outputs a newline,
165 '+' - increases indent by 2 then outputs a newline,
166 '-' - decreases indent by 2 then outputs a newline. */
169 dump_gimple_fmt (pretty_printer
*buffer
, int spc
, int flags
,
170 const char *fmt
, ...)
176 va_start (args
, fmt
);
177 for (c
= fmt
; *c
; c
++)
187 g
= va_arg (args
, gimple
);
188 tmp
= gimple_code_name
[gimple_code (g
)];
189 pp_string (buffer
, tmp
);
193 seq
= va_arg (args
, gimple_seq
);
195 dump_gimple_seq (buffer
, seq
, spc
+ 2, flags
);
196 newline_and_indent (buffer
, spc
);
200 t
= va_arg (args
, tree
);
202 pp_string (buffer
, "NULL");
204 dump_generic_node (buffer
, t
, spc
, flags
, false);
208 pp_decimal_int (buffer
, va_arg (args
, int));
212 pp_string (buffer
, va_arg (args
, char *));
216 newline_and_indent (buffer
, spc
);
221 newline_and_indent (buffer
, spc
);
226 newline_and_indent (buffer
, spc
);
234 pp_character (buffer
, *c
);
240 /* Helper for dump_gimple_assign. Print the unary RHS of the
241 assignment GS. BUFFER, SPC and FLAGS are as in dump_gimple_stmt. */
244 dump_unary_rhs (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
246 enum tree_code rhs_code
= gimple_assign_rhs_code (gs
);
247 tree lhs
= gimple_assign_lhs (gs
);
248 tree rhs
= gimple_assign_rhs1 (gs
);
252 case VIEW_CONVERT_EXPR
:
254 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
257 case FIXED_CONVERT_EXPR
:
258 case ADDR_SPACE_CONVERT_EXPR
:
262 pp_character (buffer
, '(');
263 dump_generic_node (buffer
, TREE_TYPE (lhs
), spc
, flags
, false);
264 pp_string (buffer
, ") ");
265 if (op_prio (rhs
) < op_code_prio (rhs_code
))
267 pp_character (buffer
, '(');
268 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
269 pp_character (buffer
, ')');
272 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
276 pp_string (buffer
, "((");
277 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
278 pp_string (buffer
, "))");
282 pp_string (buffer
, "ABS_EXPR <");
283 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
284 pp_character (buffer
, '>');
288 if (TREE_CODE_CLASS (rhs_code
) == tcc_declaration
289 || TREE_CODE_CLASS (rhs_code
) == tcc_constant
290 || TREE_CODE_CLASS (rhs_code
) == tcc_reference
291 || rhs_code
== SSA_NAME
292 || rhs_code
== ADDR_EXPR
293 || rhs_code
== CONSTRUCTOR
)
295 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
298 else if (rhs_code
== BIT_NOT_EXPR
)
299 pp_character (buffer
, '~');
300 else if (rhs_code
== TRUTH_NOT_EXPR
)
301 pp_character (buffer
, '!');
302 else if (rhs_code
== NEGATE_EXPR
)
303 pp_character (buffer
, '-');
306 pp_character (buffer
, '[');
307 pp_string (buffer
, tree_code_name
[rhs_code
]);
308 pp_string (buffer
, "] ");
311 if (op_prio (rhs
) < op_code_prio (rhs_code
))
313 pp_character (buffer
, '(');
314 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
315 pp_character (buffer
, ')');
318 dump_generic_node (buffer
, rhs
, spc
, flags
, false);
324 /* Helper for dump_gimple_assign. Print the binary RHS of the
325 assignment GS. BUFFER, SPC and FLAGS are as in dump_gimple_stmt. */
328 dump_binary_rhs (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
331 enum tree_code code
= gimple_assign_rhs_code (gs
);
337 case VEC_WIDEN_MULT_HI_EXPR
:
338 case VEC_WIDEN_MULT_LO_EXPR
:
339 case VEC_PACK_TRUNC_EXPR
:
340 case VEC_PACK_SAT_EXPR
:
341 case VEC_PACK_FIX_TRUNC_EXPR
:
342 case VEC_EXTRACT_EVEN_EXPR
:
343 case VEC_EXTRACT_ODD_EXPR
:
344 case VEC_INTERLEAVE_HIGH_EXPR
:
345 case VEC_INTERLEAVE_LOW_EXPR
:
346 case VEC_WIDEN_LSHIFT_HI_EXPR
:
347 case VEC_WIDEN_LSHIFT_LO_EXPR
:
348 for (p
= tree_code_name
[(int) code
]; *p
; p
++)
349 pp_character (buffer
, TOUPPER (*p
));
350 pp_string (buffer
, " <");
351 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
352 pp_string (buffer
, ", ");
353 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
354 pp_character (buffer
, '>');
358 if (op_prio (gimple_assign_rhs1 (gs
)) <= op_code_prio (code
))
360 pp_character (buffer
, '(');
361 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
,
363 pp_character (buffer
, ')');
366 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
368 pp_string (buffer
, op_symbol_code (gimple_assign_rhs_code (gs
)));
370 if (op_prio (gimple_assign_rhs2 (gs
)) <= op_code_prio (code
))
372 pp_character (buffer
, '(');
373 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
,
375 pp_character (buffer
, ')');
378 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
382 /* Helper for dump_gimple_assign. Print the ternary RHS of the
383 assignment GS. BUFFER, SPC and FLAGS are as in dump_gimple_stmt. */
386 dump_ternary_rhs (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
389 enum tree_code code
= gimple_assign_rhs_code (gs
);
392 case WIDEN_MULT_PLUS_EXPR
:
393 case WIDEN_MULT_MINUS_EXPR
:
394 for (p
= tree_code_name
[(int) code
]; *p
; p
++)
395 pp_character (buffer
, TOUPPER (*p
));
396 pp_string (buffer
, " <");
397 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
398 pp_string (buffer
, ", ");
399 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
400 pp_string (buffer
, ", ");
401 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
402 pp_character (buffer
, '>');
406 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
407 pp_string (buffer
, " * ");
408 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
409 pp_string (buffer
, " + ");
410 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
414 pp_string (buffer
, "DOT_PROD_EXPR <");
415 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
416 pp_string (buffer
, ", ");
417 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
418 pp_string (buffer
, ", ");
419 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
420 pp_string (buffer
, ">");
424 pp_string (buffer
, "VEC_PERM_EXPR <");
425 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
426 pp_string (buffer
, ", ");
427 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
428 pp_string (buffer
, ", ");
429 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
430 pp_string (buffer
, ">");
433 case REALIGN_LOAD_EXPR
:
434 pp_string (buffer
, "REALIGN_LOAD <");
435 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
436 pp_string (buffer
, ", ");
437 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
438 pp_string (buffer
, ", ");
439 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
440 pp_string (buffer
, ">");
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);
452 pp_string (buffer
, "VEC_COND_EXPR <");
453 dump_generic_node (buffer
, gimple_assign_rhs1 (gs
), spc
, flags
, false);
454 pp_string (buffer
, ", ");
455 dump_generic_node (buffer
, gimple_assign_rhs2 (gs
), spc
, flags
, false);
456 pp_string (buffer
, ", ");
457 dump_generic_node (buffer
, gimple_assign_rhs3 (gs
), spc
, flags
, false);
458 pp_string (buffer
, ">");
467 /* Dump the gimple assignment GS. BUFFER, SPC and FLAGS are as in
471 dump_gimple_assign (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
476 if (gimple_num_ops (gs
) == 2)
478 else if (gimple_num_ops (gs
) == 3)
479 last
= gimple_assign_rhs2 (gs
);
483 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%s, %T, %T, %T>", gs
,
484 tree_code_name
[gimple_assign_rhs_code (gs
)],
485 gimple_assign_lhs (gs
), gimple_assign_rhs1 (gs
), last
);
489 if (!(flags
& TDF_RHS_ONLY
))
491 dump_generic_node (buffer
, gimple_assign_lhs (gs
), spc
, flags
, false);
493 pp_character (buffer
, '=');
495 if (gimple_assign_nontemporal_move_p (gs
))
496 pp_string (buffer
, "{nt}");
498 if (gimple_has_volatile_ops (gs
))
499 pp_string (buffer
, "{v}");
504 if (gimple_num_ops (gs
) == 2)
505 dump_unary_rhs (buffer
, gs
, spc
, flags
);
506 else if (gimple_num_ops (gs
) == 3)
507 dump_binary_rhs (buffer
, gs
, spc
, flags
);
508 else if (gimple_num_ops (gs
) == 4)
509 dump_ternary_rhs (buffer
, gs
, spc
, flags
);
512 if (!(flags
& TDF_RHS_ONLY
))
513 pp_semicolon(buffer
);
518 /* Dump the return statement GS. BUFFER, SPC and FLAGS are as in
522 dump_gimple_return (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
526 t
= gimple_return_retval (gs
);
528 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
, t
);
531 pp_string (buffer
, "return");
535 dump_generic_node (buffer
, t
, spc
, flags
, false);
537 pp_semicolon (buffer
);
542 /* Dump the call arguments for a gimple call. BUFFER, FLAGS are as in
546 dump_gimple_call_args (pretty_printer
*buffer
, gimple gs
, int flags
)
550 for (i
= 0; i
< gimple_call_num_args (gs
); i
++)
552 dump_generic_node (buffer
, gimple_call_arg (gs
, i
), 0, flags
, false);
553 if (i
< gimple_call_num_args (gs
) - 1)
554 pp_string (buffer
, ", ");
557 if (gimple_call_va_arg_pack_p (gs
))
559 if (gimple_call_num_args (gs
) > 0)
561 pp_character (buffer
, ',');
565 pp_string (buffer
, "__builtin_va_arg_pack ()");
569 /* Dump the points-to solution *PT to BUFFER. */
572 pp_points_to_solution (pretty_printer
*buffer
, struct pt_solution
*pt
)
576 pp_string (buffer
, "anything ");
580 pp_string (buffer
, "nonlocal ");
582 pp_string (buffer
, "escaped ");
584 pp_string (buffer
, "unit-escaped ");
586 pp_string (buffer
, "null ");
588 && !bitmap_empty_p (pt
->vars
))
592 pp_string (buffer
, "{ ");
593 EXECUTE_IF_SET_IN_BITMAP (pt
->vars
, 0, i
, bi
)
595 tree var
= referenced_var_lookup (cfun
, i
);
598 dump_generic_node (buffer
, var
, 0, dump_flags
, false);
599 if (DECL_PT_UID (var
) != DECL_UID (var
))
601 pp_string (buffer
, "ptD.");
602 pp_decimal_int (buffer
, DECL_PT_UID (var
));
607 pp_string (buffer
, "D.");
608 pp_decimal_int (buffer
, i
);
610 pp_character (buffer
, ' ');
612 pp_character (buffer
, '}');
613 if (pt
->vars_contains_global
)
614 pp_string (buffer
, " (glob)");
618 /* Dump the call statement GS. BUFFER, SPC and FLAGS are as in
622 dump_gimple_call (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
624 tree lhs
= gimple_call_lhs (gs
);
626 if (flags
& TDF_ALIAS
)
628 struct pt_solution
*pt
;
629 pt
= gimple_call_use_set (gs
);
630 if (!pt_solution_empty_p (pt
))
632 pp_string (buffer
, "# USE = ");
633 pp_points_to_solution (buffer
, pt
);
634 newline_and_indent (buffer
, spc
);
636 pt
= gimple_call_clobber_set (gs
);
637 if (!pt_solution_empty_p (pt
))
639 pp_string (buffer
, "# CLB = ");
640 pp_points_to_solution (buffer
, pt
);
641 newline_and_indent (buffer
, spc
);
647 if (gimple_call_internal_p (gs
))
648 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%s, %T", gs
,
649 internal_fn_name (gimple_call_internal_fn (gs
)), lhs
);
651 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T",
652 gs
, gimple_call_fn (gs
), lhs
);
653 if (gimple_call_num_args (gs
) > 0)
655 pp_string (buffer
, ", ");
656 dump_gimple_call_args (buffer
, gs
, flags
);
658 pp_character (buffer
, '>');
662 if (lhs
&& !(flags
& TDF_RHS_ONLY
))
664 dump_generic_node (buffer
, lhs
, spc
, flags
, false);
665 pp_string (buffer
, " =");
667 if (gimple_has_volatile_ops (gs
))
668 pp_string (buffer
, "{v}");
672 if (gimple_call_internal_p (gs
))
673 pp_string (buffer
, internal_fn_name (gimple_call_internal_fn (gs
)));
675 print_call_name (buffer
, gimple_call_fn (gs
), flags
);
676 pp_string (buffer
, " (");
677 dump_gimple_call_args (buffer
, gs
, flags
);
678 pp_character (buffer
, ')');
679 if (!(flags
& TDF_RHS_ONLY
))
680 pp_semicolon (buffer
);
683 if (gimple_call_chain (gs
))
685 pp_string (buffer
, " [static-chain: ");
686 dump_generic_node (buffer
, gimple_call_chain (gs
), spc
, flags
, false);
687 pp_character (buffer
, ']');
690 if (gimple_call_return_slot_opt_p (gs
))
691 pp_string (buffer
, " [return slot optimization]");
693 if (gimple_call_tail_p (gs
))
694 pp_string (buffer
, " [tail call]");
698 /* Dump the switch statement GS. BUFFER, SPC and FLAGS are as in
702 dump_gimple_switch (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
706 GIMPLE_CHECK (gs
, GIMPLE_SWITCH
);
708 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, ", gs
,
709 gimple_switch_index (gs
));
712 pp_string (buffer
, "switch (");
713 dump_generic_node (buffer
, gimple_switch_index (gs
), spc
, flags
, true);
714 pp_string (buffer
, ") <");
717 for (i
= 0; i
< gimple_switch_num_labels (gs
); i
++)
719 tree case_label
= gimple_switch_label (gs
, i
);
720 if (case_label
== NULL_TREE
)
723 dump_generic_node (buffer
, case_label
, spc
, flags
, false);
724 pp_character (buffer
, ' ');
725 dump_generic_node (buffer
, CASE_LABEL (case_label
), spc
, flags
, false);
726 if (i
< gimple_switch_num_labels (gs
) - 1)
727 pp_string (buffer
, ", ");
729 pp_character (buffer
, '>');
733 /* Dump the gimple conditional GS. BUFFER, SPC and FLAGS are as in
737 dump_gimple_cond (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
740 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%s, %T, %T, %T, %T>", gs
,
741 tree_code_name
[gimple_cond_code (gs
)],
742 gimple_cond_lhs (gs
), gimple_cond_rhs (gs
),
743 gimple_cond_true_label (gs
), gimple_cond_false_label (gs
));
746 if (!(flags
& TDF_RHS_ONLY
))
747 pp_string (buffer
, "if (");
748 dump_generic_node (buffer
, gimple_cond_lhs (gs
), spc
, flags
, false);
750 pp_string (buffer
, op_symbol_code (gimple_cond_code (gs
)));
752 dump_generic_node (buffer
, gimple_cond_rhs (gs
), spc
, flags
, false);
753 if (!(flags
& TDF_RHS_ONLY
))
755 pp_character (buffer
, ')');
757 if (gimple_cond_true_label (gs
))
759 pp_string (buffer
, " goto ");
760 dump_generic_node (buffer
, gimple_cond_true_label (gs
),
762 pp_semicolon (buffer
);
764 if (gimple_cond_false_label (gs
))
766 pp_string (buffer
, " else goto ");
767 dump_generic_node (buffer
, gimple_cond_false_label (gs
),
769 pp_semicolon (buffer
);
776 /* Dump a GIMPLE_LABEL tuple on the pretty_printer BUFFER, SPC
777 spaces of indent. FLAGS specifies details to show in the dump (see
778 TDF_* in tree-pass.h). */
781 dump_gimple_label (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
783 tree label
= gimple_label_label (gs
);
785 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
, label
);
788 dump_generic_node (buffer
, label
, spc
, flags
, false);
789 pp_character (buffer
, ':');
791 if (DECL_NONLOCAL (label
))
792 pp_string (buffer
, " [non-local]");
793 if ((flags
& TDF_EH
) && EH_LANDING_PAD_NR (label
))
794 pp_printf (buffer
, " [LP %d]", EH_LANDING_PAD_NR (label
));
797 /* Dump a GIMPLE_GOTO tuple on the pretty_printer BUFFER, SPC
798 spaces of indent. FLAGS specifies details to show in the dump (see
799 TDF_* in tree-pass.h). */
802 dump_gimple_goto (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
804 tree label
= gimple_goto_dest (gs
);
806 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
, label
);
808 dump_gimple_fmt (buffer
, spc
, flags
, "goto %T;", label
);
812 /* Dump a GIMPLE_BIND tuple on the pretty_printer BUFFER, SPC
813 spaces of indent. FLAGS specifies details to show in the dump (see
814 TDF_* in tree-pass.h). */
817 dump_gimple_bind (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
820 dump_gimple_fmt (buffer
, spc
, flags
, "%G <", gs
);
822 pp_character (buffer
, '{');
823 if (!(flags
& TDF_SLIM
))
827 for (var
= gimple_bind_vars (gs
); var
; var
= DECL_CHAIN (var
))
829 newline_and_indent (buffer
, 2);
830 print_declaration (buffer
, var
, spc
, flags
);
832 if (gimple_bind_vars (gs
))
836 dump_gimple_seq (buffer
, gimple_bind_body (gs
), spc
+ 2, flags
);
837 newline_and_indent (buffer
, spc
);
839 pp_character (buffer
, '>');
841 pp_character (buffer
, '}');
845 /* Dump a GIMPLE_TRY tuple on the pretty_printer BUFFER, SPC spaces of
846 indent. FLAGS specifies details to show in the dump (see TDF_* in
850 dump_gimple_try (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
855 if (gimple_try_kind (gs
) == GIMPLE_TRY_CATCH
)
856 type
= "GIMPLE_TRY_CATCH";
857 else if (gimple_try_kind (gs
) == GIMPLE_TRY_FINALLY
)
858 type
= "GIMPLE_TRY_FINALLY";
860 type
= "UNKNOWN GIMPLE_TRY";
861 dump_gimple_fmt (buffer
, spc
, flags
,
862 "%G <%s,%+EVAL <%S>%nCLEANUP <%S>%->", gs
, type
,
863 gimple_try_eval (gs
), gimple_try_cleanup (gs
));
867 pp_string (buffer
, "try");
868 newline_and_indent (buffer
, spc
+ 2);
869 pp_character (buffer
, '{');
872 dump_gimple_seq (buffer
, gimple_try_eval (gs
), spc
+ 4, flags
);
873 newline_and_indent (buffer
, spc
+ 2);
874 pp_character (buffer
, '}');
876 if (gimple_try_kind (gs
) == GIMPLE_TRY_CATCH
)
878 newline_and_indent (buffer
, spc
);
879 pp_string (buffer
, "catch");
880 newline_and_indent (buffer
, spc
+ 2);
881 pp_character (buffer
, '{');
883 else if (gimple_try_kind (gs
) == GIMPLE_TRY_FINALLY
)
885 newline_and_indent (buffer
, spc
);
886 pp_string (buffer
, "finally");
887 newline_and_indent (buffer
, spc
+ 2);
888 pp_character (buffer
, '{');
891 pp_string (buffer
, " <UNKNOWN GIMPLE_TRY> {");
894 dump_gimple_seq (buffer
, gimple_try_cleanup (gs
), spc
+ 4, flags
);
895 newline_and_indent (buffer
, spc
+ 2);
896 pp_character (buffer
, '}');
901 /* Dump a GIMPLE_CATCH tuple on the pretty_printer BUFFER, SPC spaces of
902 indent. FLAGS specifies details to show in the dump (see TDF_* in
906 dump_gimple_catch (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
909 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %+CATCH <%S>%->", gs
,
910 gimple_catch_types (gs
), gimple_catch_handler (gs
));
912 dump_gimple_fmt (buffer
, spc
, flags
, "catch (%T)%+{%S}",
913 gimple_catch_types (gs
), gimple_catch_handler (gs
));
917 /* Dump a GIMPLE_EH_FILTER tuple on the pretty_printer BUFFER, SPC spaces of
918 indent. FLAGS specifies details to show in the dump (see TDF_* in
922 dump_gimple_eh_filter (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
925 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %+FAILURE <%S>%->", gs
,
926 gimple_eh_filter_types (gs
),
927 gimple_eh_filter_failure (gs
));
929 dump_gimple_fmt (buffer
, spc
, flags
, "<<<eh_filter (%T)>>>%+{%+%S%-}",
930 gimple_eh_filter_types (gs
),
931 gimple_eh_filter_failure (gs
));
935 /* Dump a GIMPLE_EH_MUST_NOT_THROW tuple. */
938 dump_gimple_eh_must_not_throw (pretty_printer
*buffer
, gimple gs
,
942 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
,
943 gimple_eh_must_not_throw_fndecl (gs
));
945 dump_gimple_fmt (buffer
, spc
, flags
, "<<<eh_must_not_throw (%T)>>>",
946 gimple_eh_must_not_throw_fndecl (gs
));
950 /* Dump a GIMPLE_RESX tuple on the pretty_printer BUFFER, SPC spaces of
951 indent. FLAGS specifies details to show in the dump (see TDF_* in
955 dump_gimple_resx (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
958 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%d>", gs
,
959 gimple_resx_region (gs
));
961 dump_gimple_fmt (buffer
, spc
, flags
, "resx %d", gimple_resx_region (gs
));
964 /* Dump a GIMPLE_EH_DISPATCH tuple on the pretty_printer BUFFER. */
967 dump_gimple_eh_dispatch (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
970 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%d>", gs
,
971 gimple_eh_dispatch_region (gs
));
973 dump_gimple_fmt (buffer
, spc
, flags
, "eh_dispatch %d",
974 gimple_eh_dispatch_region (gs
));
977 /* Dump a GIMPLE_DEBUG tuple on the pretty_printer BUFFER, SPC spaces
978 of indent. FLAGS specifies details to show in the dump (see TDF_*
982 dump_gimple_debug (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
984 switch (gs
->gsbase
.subcode
)
986 case GIMPLE_DEBUG_BIND
:
988 dump_gimple_fmt (buffer
, spc
, flags
, "%G BIND <%T, %T>", gs
,
989 gimple_debug_bind_get_var (gs
),
990 gimple_debug_bind_get_value (gs
));
992 dump_gimple_fmt (buffer
, spc
, flags
, "# DEBUG %T => %T",
993 gimple_debug_bind_get_var (gs
),
994 gimple_debug_bind_get_value (gs
));
997 case GIMPLE_DEBUG_SOURCE_BIND
:
999 dump_gimple_fmt (buffer
, spc
, flags
, "%G SRCBIND <%T, %T>", gs
,
1000 gimple_debug_source_bind_get_var (gs
),
1001 gimple_debug_source_bind_get_value (gs
));
1003 dump_gimple_fmt (buffer
, spc
, flags
, "# DEBUG %T s=> %T",
1004 gimple_debug_source_bind_get_var (gs
),
1005 gimple_debug_source_bind_get_value (gs
));
1013 /* Dump a GIMPLE_OMP_FOR tuple on the pretty_printer BUFFER. */
1015 dump_gimple_omp_for (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1019 if (flags
& TDF_RAW
)
1021 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1022 gimple_omp_body (gs
));
1023 dump_omp_clauses (buffer
, gimple_omp_for_clauses (gs
), spc
, flags
);
1024 dump_gimple_fmt (buffer
, spc
, flags
, " >,");
1025 for (i
= 0; i
< gimple_omp_for_collapse (gs
); i
++)
1026 dump_gimple_fmt (buffer
, spc
, flags
,
1027 "%+%T, %T, %T, %s, %T,%n",
1028 gimple_omp_for_index (gs
, i
),
1029 gimple_omp_for_initial (gs
, i
),
1030 gimple_omp_for_final (gs
, i
),
1031 tree_code_name
[gimple_omp_for_cond (gs
, i
)],
1032 gimple_omp_for_incr (gs
, i
));
1033 dump_gimple_fmt (buffer
, spc
, flags
, "PRE_BODY <%S>%->",
1034 gimple_omp_for_pre_body (gs
));
1038 pp_string (buffer
, "#pragma omp for");
1039 dump_omp_clauses (buffer
, gimple_omp_for_clauses (gs
), spc
, flags
);
1040 for (i
= 0; i
< gimple_omp_for_collapse (gs
); i
++)
1044 newline_and_indent (buffer
, spc
);
1045 pp_string (buffer
, "for (");
1046 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
1048 pp_string (buffer
, " = ");
1049 dump_generic_node (buffer
, gimple_omp_for_initial (gs
, i
), spc
,
1051 pp_string (buffer
, "; ");
1053 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
1056 switch (gimple_omp_for_cond (gs
, i
))
1059 pp_character (buffer
, '<');
1062 pp_character (buffer
, '>');
1065 pp_string (buffer
, "<=");
1068 pp_string (buffer
, ">=");
1074 dump_generic_node (buffer
, gimple_omp_for_final (gs
, i
), spc
,
1076 pp_string (buffer
, "; ");
1078 dump_generic_node (buffer
, gimple_omp_for_index (gs
, i
), spc
,
1080 pp_string (buffer
, " = ");
1081 dump_generic_node (buffer
, gimple_omp_for_incr (gs
, i
), spc
,
1083 pp_character (buffer
, ')');
1086 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1088 newline_and_indent (buffer
, spc
+ 2);
1089 pp_character (buffer
, '{');
1090 pp_newline (buffer
);
1091 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1092 newline_and_indent (buffer
, spc
+ 2);
1093 pp_character (buffer
, '}');
1098 /* Dump a GIMPLE_OMP_CONTINUE tuple on the pretty_printer BUFFER. */
1101 dump_gimple_omp_continue (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1103 if (flags
& TDF_RAW
)
1105 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T>", gs
,
1106 gimple_omp_continue_control_def (gs
),
1107 gimple_omp_continue_control_use (gs
));
1111 pp_string (buffer
, "#pragma omp continue (");
1112 dump_generic_node (buffer
, gimple_omp_continue_control_def (gs
),
1114 pp_character (buffer
, ',');
1116 dump_generic_node (buffer
, gimple_omp_continue_control_use (gs
),
1118 pp_character (buffer
, ')');
1122 /* Dump a GIMPLE_OMP_SINGLE tuple on the pretty_printer BUFFER. */
1125 dump_gimple_omp_single (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1127 if (flags
& TDF_RAW
)
1129 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1130 gimple_omp_body (gs
));
1131 dump_omp_clauses (buffer
, gimple_omp_single_clauses (gs
), spc
, flags
);
1132 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1136 pp_string (buffer
, "#pragma omp single");
1137 dump_omp_clauses (buffer
, gimple_omp_single_clauses (gs
), spc
, flags
);
1138 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1140 newline_and_indent (buffer
, spc
+ 2);
1141 pp_character (buffer
, '{');
1142 pp_newline (buffer
);
1143 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1144 newline_and_indent (buffer
, spc
+ 2);
1145 pp_character (buffer
, '}');
1150 /* Dump a GIMPLE_OMP_SECTIONS tuple on the pretty_printer BUFFER. */
1153 dump_gimple_omp_sections (pretty_printer
*buffer
, gimple gs
, int spc
,
1156 if (flags
& TDF_RAW
)
1158 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1159 gimple_omp_body (gs
));
1160 dump_omp_clauses (buffer
, gimple_omp_sections_clauses (gs
), spc
, flags
);
1161 dump_gimple_fmt (buffer
, spc
, flags
, " >");
1165 pp_string (buffer
, "#pragma omp sections");
1166 if (gimple_omp_sections_control (gs
))
1168 pp_string (buffer
, " <");
1169 dump_generic_node (buffer
, gimple_omp_sections_control (gs
), spc
,
1171 pp_character (buffer
, '>');
1173 dump_omp_clauses (buffer
, gimple_omp_sections_clauses (gs
), spc
, flags
);
1174 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1176 newline_and_indent (buffer
, spc
+ 2);
1177 pp_character (buffer
, '{');
1178 pp_newline (buffer
);
1179 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1180 newline_and_indent (buffer
, spc
+ 2);
1181 pp_character (buffer
, '}');
1186 /* Dump a GIMPLE_OMP_{MASTER,ORDERED,SECTION} tuple on the pretty_printer
1190 dump_gimple_omp_block (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1192 if (flags
& TDF_RAW
)
1193 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1194 gimple_omp_body (gs
));
1197 switch (gimple_code (gs
))
1199 case GIMPLE_OMP_MASTER
:
1200 pp_string (buffer
, "#pragma omp master");
1202 case GIMPLE_OMP_ORDERED
:
1203 pp_string (buffer
, "#pragma omp ordered");
1205 case GIMPLE_OMP_SECTION
:
1206 pp_string (buffer
, "#pragma omp section");
1211 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1213 newline_and_indent (buffer
, spc
+ 2);
1214 pp_character (buffer
, '{');
1215 pp_newline (buffer
);
1216 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1217 newline_and_indent (buffer
, spc
+ 2);
1218 pp_character (buffer
, '}');
1223 /* Dump a GIMPLE_OMP_CRITICAL tuple on the pretty_printer BUFFER. */
1226 dump_gimple_omp_critical (pretty_printer
*buffer
, gimple gs
, int spc
,
1229 if (flags
& TDF_RAW
)
1230 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S> >", gs
,
1231 gimple_omp_body (gs
));
1234 pp_string (buffer
, "#pragma omp critical");
1235 if (gimple_omp_critical_name (gs
))
1237 pp_string (buffer
, " (");
1238 dump_generic_node (buffer
, gimple_omp_critical_name (gs
), spc
,
1240 pp_character (buffer
, ')');
1242 if (!gimple_seq_empty_p (gimple_omp_body (gs
)))
1244 newline_and_indent (buffer
, spc
+ 2);
1245 pp_character (buffer
, '{');
1246 pp_newline (buffer
);
1247 dump_gimple_seq (buffer
, gimple_omp_body (gs
), spc
+ 4, flags
);
1248 newline_and_indent (buffer
, spc
+ 2);
1249 pp_character (buffer
, '}');
1254 /* Dump a GIMPLE_OMP_RETURN tuple on the pretty_printer BUFFER. */
1257 dump_gimple_omp_return (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1259 if (flags
& TDF_RAW
)
1261 dump_gimple_fmt (buffer
, spc
, flags
, "%G <nowait=%d>", gs
,
1262 (int) gimple_omp_return_nowait_p (gs
));
1266 pp_string (buffer
, "#pragma omp return");
1267 if (gimple_omp_return_nowait_p (gs
))
1268 pp_string (buffer
, "(nowait)");
1272 /* Dump a GIMPLE_ASM tuple on the pretty_printer BUFFER, SPC spaces of
1273 indent. FLAGS specifies details to show in the dump (see TDF_* in
1277 dump_gimple_asm (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1279 unsigned int i
, n
, f
, fields
;
1281 if (flags
& TDF_RAW
)
1283 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+STRING <%n%s%n>", gs
,
1284 gimple_asm_string (gs
));
1286 n
= gimple_asm_noutputs (gs
);
1289 newline_and_indent (buffer
, spc
+ 2);
1290 pp_string (buffer
, "OUTPUT: ");
1291 for (i
= 0; i
< n
; i
++)
1293 dump_generic_node (buffer
, gimple_asm_output_op (gs
, i
),
1296 pp_string (buffer
, ", ");
1300 n
= gimple_asm_ninputs (gs
);
1303 newline_and_indent (buffer
, spc
+ 2);
1304 pp_string (buffer
, "INPUT: ");
1305 for (i
= 0; i
< n
; i
++)
1307 dump_generic_node (buffer
, gimple_asm_input_op (gs
, i
),
1310 pp_string (buffer
, ", ");
1314 n
= gimple_asm_nclobbers (gs
);
1317 newline_and_indent (buffer
, spc
+ 2);
1318 pp_string (buffer
, "CLOBBER: ");
1319 for (i
= 0; i
< n
; i
++)
1321 dump_generic_node (buffer
, gimple_asm_clobber_op (gs
, i
),
1324 pp_string (buffer
, ", ");
1328 n
= gimple_asm_nlabels (gs
);
1331 newline_and_indent (buffer
, spc
+ 2);
1332 pp_string (buffer
, "LABEL: ");
1333 for (i
= 0; i
< n
; i
++)
1335 dump_generic_node (buffer
, gimple_asm_label_op (gs
, i
),
1338 pp_string (buffer
, ", ");
1342 newline_and_indent (buffer
, spc
);
1343 pp_character (buffer
, '>');
1347 pp_string (buffer
, "__asm__");
1348 if (gimple_asm_volatile_p (gs
))
1349 pp_string (buffer
, " __volatile__");
1350 if (gimple_asm_nlabels (gs
))
1351 pp_string (buffer
, " goto");
1352 pp_string (buffer
, "(\"");
1353 pp_string (buffer
, gimple_asm_string (gs
));
1354 pp_string (buffer
, "\"");
1356 if (gimple_asm_nlabels (gs
))
1358 else if (gimple_asm_nclobbers (gs
))
1360 else if (gimple_asm_ninputs (gs
))
1362 else if (gimple_asm_noutputs (gs
))
1367 for (f
= 0; f
< fields
; ++f
)
1369 pp_string (buffer
, " : ");
1374 n
= gimple_asm_noutputs (gs
);
1375 for (i
= 0; i
< n
; i
++)
1377 dump_generic_node (buffer
, gimple_asm_output_op (gs
, i
),
1380 pp_string (buffer
, ", ");
1385 n
= gimple_asm_ninputs (gs
);
1386 for (i
= 0; i
< n
; i
++)
1388 dump_generic_node (buffer
, gimple_asm_input_op (gs
, i
),
1391 pp_string (buffer
, ", ");
1396 n
= gimple_asm_nclobbers (gs
);
1397 for (i
= 0; i
< n
; i
++)
1399 dump_generic_node (buffer
, gimple_asm_clobber_op (gs
, i
),
1402 pp_string (buffer
, ", ");
1407 n
= gimple_asm_nlabels (gs
);
1408 for (i
= 0; i
< n
; i
++)
1410 dump_generic_node (buffer
, gimple_asm_label_op (gs
, i
),
1413 pp_string (buffer
, ", ");
1422 pp_string (buffer
, ");");
1427 /* Dump a PHI node PHI. BUFFER, SPC and FLAGS are as in
1428 dump_gimple_stmt. */
1431 dump_gimple_phi (pretty_printer
*buffer
, gimple phi
, int spc
, int flags
)
1434 tree lhs
= gimple_phi_result (phi
);
1436 if (flags
& TDF_ALIAS
1437 && POINTER_TYPE_P (TREE_TYPE (lhs
))
1438 && SSA_NAME_PTR_INFO (lhs
))
1440 struct ptr_info_def
*pi
= SSA_NAME_PTR_INFO (lhs
);
1441 pp_string (buffer
, "PT = ");
1442 pp_points_to_solution (buffer
, &pi
->pt
);
1443 newline_and_indent (buffer
, spc
);
1445 pp_printf (buffer
, "# ALIGN = %u, MISALIGN = %u",
1446 pi
->align
, pi
->misalign
);
1447 newline_and_indent (buffer
, spc
);
1448 pp_string (buffer
, "# ");
1451 if (flags
& TDF_RAW
)
1452 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, ", phi
,
1453 gimple_phi_result (phi
));
1456 dump_generic_node (buffer
, lhs
, spc
, flags
, false);
1457 pp_string (buffer
, " = PHI <");
1459 for (i
= 0; i
< gimple_phi_num_args (phi
); i
++)
1461 if ((flags
& TDF_LINENO
) && gimple_phi_arg_has_location (phi
, i
))
1463 expanded_location xloc
;
1465 xloc
= expand_location (gimple_phi_arg_location (phi
, i
));
1466 pp_character (buffer
, '[');
1469 pp_string (buffer
, xloc
.file
);
1470 pp_string (buffer
, " : ");
1472 pp_decimal_int (buffer
, xloc
.line
);
1473 pp_string (buffer
, ":");
1474 pp_decimal_int (buffer
, xloc
.column
);
1475 pp_string (buffer
, "] ");
1477 dump_generic_node (buffer
, gimple_phi_arg_def (phi
, i
), spc
, flags
,
1479 pp_character (buffer
, '(');
1480 pp_decimal_int (buffer
, gimple_phi_arg_edge (phi
, i
)->src
->index
);
1481 pp_character (buffer
, ')');
1482 if (i
< gimple_phi_num_args (phi
) - 1)
1483 pp_string (buffer
, ", ");
1485 pp_character (buffer
, '>');
1489 /* Dump a GIMPLE_OMP_PARALLEL tuple on the pretty_printer BUFFER, SPC spaces
1490 of indent. FLAGS specifies details to show in the dump (see TDF_* in
1494 dump_gimple_omp_parallel (pretty_printer
*buffer
, gimple gs
, int spc
,
1497 if (flags
& TDF_RAW
)
1499 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1500 gimple_omp_body (gs
));
1501 dump_omp_clauses (buffer
, gimple_omp_parallel_clauses (gs
), spc
, flags
);
1502 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T%n>",
1503 gimple_omp_parallel_child_fn (gs
),
1504 gimple_omp_parallel_data_arg (gs
));
1509 pp_string (buffer
, "#pragma omp parallel");
1510 dump_omp_clauses (buffer
, gimple_omp_parallel_clauses (gs
), spc
, flags
);
1511 if (gimple_omp_parallel_child_fn (gs
))
1513 pp_string (buffer
, " [child fn: ");
1514 dump_generic_node (buffer
, gimple_omp_parallel_child_fn (gs
),
1516 pp_string (buffer
, " (");
1517 if (gimple_omp_parallel_data_arg (gs
))
1518 dump_generic_node (buffer
, gimple_omp_parallel_data_arg (gs
),
1521 pp_string (buffer
, "???");
1522 pp_string (buffer
, ")]");
1524 body
= gimple_omp_body (gs
);
1525 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
1527 newline_and_indent (buffer
, spc
+ 2);
1528 pp_character (buffer
, '{');
1529 pp_newline (buffer
);
1530 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
1531 newline_and_indent (buffer
, spc
+ 2);
1532 pp_character (buffer
, '}');
1536 pp_newline (buffer
);
1537 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
1543 /* Dump a GIMPLE_OMP_TASK tuple on the pretty_printer BUFFER, SPC spaces
1544 of indent. FLAGS specifies details to show in the dump (see TDF_* in
1548 dump_gimple_omp_task (pretty_printer
*buffer
, gimple gs
, int spc
,
1551 if (flags
& TDF_RAW
)
1553 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%+BODY <%S>%nCLAUSES <", gs
,
1554 gimple_omp_body (gs
));
1555 dump_omp_clauses (buffer
, gimple_omp_task_clauses (gs
), spc
, flags
);
1556 dump_gimple_fmt (buffer
, spc
, flags
, " >, %T, %T, %T, %T, %T%n>",
1557 gimple_omp_task_child_fn (gs
),
1558 gimple_omp_task_data_arg (gs
),
1559 gimple_omp_task_copy_fn (gs
),
1560 gimple_omp_task_arg_size (gs
),
1561 gimple_omp_task_arg_size (gs
));
1566 pp_string (buffer
, "#pragma omp task");
1567 dump_omp_clauses (buffer
, gimple_omp_task_clauses (gs
), spc
, flags
);
1568 if (gimple_omp_task_child_fn (gs
))
1570 pp_string (buffer
, " [child fn: ");
1571 dump_generic_node (buffer
, gimple_omp_task_child_fn (gs
),
1573 pp_string (buffer
, " (");
1574 if (gimple_omp_task_data_arg (gs
))
1575 dump_generic_node (buffer
, gimple_omp_task_data_arg (gs
),
1578 pp_string (buffer
, "???");
1579 pp_string (buffer
, ")]");
1581 body
= gimple_omp_body (gs
);
1582 if (body
&& gimple_code (gimple_seq_first_stmt (body
)) != GIMPLE_BIND
)
1584 newline_and_indent (buffer
, spc
+ 2);
1585 pp_character (buffer
, '{');
1586 pp_newline (buffer
);
1587 dump_gimple_seq (buffer
, body
, spc
+ 4, flags
);
1588 newline_and_indent (buffer
, spc
+ 2);
1589 pp_character (buffer
, '}');
1593 pp_newline (buffer
);
1594 dump_gimple_seq (buffer
, body
, spc
+ 2, flags
);
1600 /* Dump a GIMPLE_OMP_ATOMIC_LOAD tuple on the pretty_printer BUFFER, SPC
1601 spaces of indent. FLAGS specifies details to show in the dump (see TDF_*
1605 dump_gimple_omp_atomic_load (pretty_printer
*buffer
, gimple gs
, int spc
,
1608 if (flags
& TDF_RAW
)
1610 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T, %T>", gs
,
1611 gimple_omp_atomic_load_lhs (gs
),
1612 gimple_omp_atomic_load_rhs (gs
));
1616 pp_string (buffer
, "#pragma omp atomic_load");
1617 newline_and_indent (buffer
, spc
+ 2);
1618 dump_generic_node (buffer
, gimple_omp_atomic_load_lhs (gs
),
1621 pp_character (buffer
, '=');
1623 pp_character (buffer
, '*');
1624 dump_generic_node (buffer
, gimple_omp_atomic_load_rhs (gs
),
1629 /* Dump a GIMPLE_OMP_ATOMIC_STORE tuple on the pretty_printer BUFFER, SPC
1630 spaces of indent. FLAGS specifies details to show in the dump (see TDF_*
1634 dump_gimple_omp_atomic_store (pretty_printer
*buffer
, gimple gs
, int spc
,
1637 if (flags
& TDF_RAW
)
1639 dump_gimple_fmt (buffer
, spc
, flags
, "%G <%T>", gs
,
1640 gimple_omp_atomic_store_val (gs
));
1644 pp_string (buffer
, "#pragma omp atomic_store (");
1645 dump_generic_node (buffer
, gimple_omp_atomic_store_val (gs
),
1647 pp_character (buffer
, ')');
1652 /* Dump all the memory operands for statement GS. BUFFER, SPC and
1653 FLAGS are as in dump_gimple_stmt. */
1656 dump_gimple_mem_ops (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1658 tree vdef
= gimple_vdef (gs
);
1659 tree vuse
= gimple_vuse (gs
);
1661 if (!ssa_operands_active () || !gimple_references_memory_p (gs
))
1664 if (vdef
!= NULL_TREE
)
1666 pp_string (buffer
, "# ");
1667 dump_generic_node (buffer
, vdef
, spc
+ 2, flags
, false);
1668 pp_string (buffer
, " = VDEF <");
1669 dump_generic_node (buffer
, vuse
, spc
+ 2, flags
, false);
1670 pp_character (buffer
, '>');
1671 newline_and_indent (buffer
, spc
);
1673 else if (vuse
!= NULL_TREE
)
1675 pp_string (buffer
, "# VUSE <");
1676 dump_generic_node (buffer
, vuse
, spc
+ 2, flags
, false);
1677 pp_character (buffer
, '>');
1678 newline_and_indent (buffer
, spc
);
1683 /* Dump the gimple statement GS on the pretty printer BUFFER, SPC
1684 spaces of indent. FLAGS specifies details to show in the dump (see
1685 TDF_* in tree-pass.h). */
1688 dump_gimple_stmt (pretty_printer
*buffer
, gimple gs
, int spc
, int flags
)
1693 if (flags
& TDF_STMTADDR
)
1694 pp_printf (buffer
, "<&%p> ", (void *) gs
);
1696 if ((flags
& TDF_LINENO
) && gimple_has_location (gs
))
1698 expanded_location xloc
= expand_location (gimple_location (gs
));
1699 pp_character (buffer
, '[');
1702 pp_string (buffer
, xloc
.file
);
1703 pp_string (buffer
, " : ");
1705 pp_decimal_int (buffer
, xloc
.line
);
1706 pp_string (buffer
, ":");
1707 pp_decimal_int (buffer
, xloc
.column
);
1708 pp_string (buffer
, "] ");
1713 int lp_nr
= lookup_stmt_eh_lp (gs
);
1715 pp_printf (buffer
, "[LP %d] ", lp_nr
);
1717 pp_printf (buffer
, "[MNT %d] ", -lp_nr
);
1720 if ((flags
& (TDF_VOPS
|TDF_MEMSYMS
))
1721 && gimple_has_mem_ops (gs
))
1722 dump_gimple_mem_ops (buffer
, gs
, spc
, flags
);
1724 if ((flags
& TDF_ALIAS
)
1725 && gimple_has_lhs (gs
))
1727 tree lhs
= gimple_get_lhs (gs
);
1728 if (TREE_CODE (lhs
) == SSA_NAME
1729 && POINTER_TYPE_P (TREE_TYPE (lhs
))
1730 && SSA_NAME_PTR_INFO (lhs
))
1732 struct ptr_info_def
*pi
= SSA_NAME_PTR_INFO (lhs
);
1733 pp_string (buffer
, "# PT = ");
1734 pp_points_to_solution (buffer
, &pi
->pt
);
1735 newline_and_indent (buffer
, spc
);
1738 pp_printf (buffer
, "# ALIGN = %u, MISALIGN = %u",
1739 pi
->align
, pi
->misalign
);
1740 newline_and_indent (buffer
, spc
);
1745 switch (gimple_code (gs
))
1748 dump_gimple_asm (buffer
, gs
, spc
, flags
);
1752 dump_gimple_assign (buffer
, gs
, spc
, flags
);
1756 dump_gimple_bind (buffer
, gs
, spc
, flags
);
1760 dump_gimple_call (buffer
, gs
, spc
, flags
);
1764 dump_gimple_cond (buffer
, gs
, spc
, flags
);
1768 dump_gimple_label (buffer
, gs
, spc
, flags
);
1772 dump_gimple_goto (buffer
, gs
, spc
, flags
);
1776 pp_string (buffer
, "GIMPLE_NOP");
1780 dump_gimple_return (buffer
, gs
, spc
, flags
);
1784 dump_gimple_switch (buffer
, gs
, spc
, flags
);
1788 dump_gimple_try (buffer
, gs
, spc
, flags
);
1792 dump_gimple_phi (buffer
, gs
, spc
, flags
);
1795 case GIMPLE_OMP_PARALLEL
:
1796 dump_gimple_omp_parallel (buffer
, gs
, spc
, flags
);
1799 case GIMPLE_OMP_TASK
:
1800 dump_gimple_omp_task (buffer
, gs
, spc
, flags
);
1803 case GIMPLE_OMP_ATOMIC_LOAD
:
1804 dump_gimple_omp_atomic_load (buffer
, gs
, spc
, flags
);
1808 case GIMPLE_OMP_ATOMIC_STORE
:
1809 dump_gimple_omp_atomic_store (buffer
, gs
, spc
, flags
);
1812 case GIMPLE_OMP_FOR
:
1813 dump_gimple_omp_for (buffer
, gs
, spc
, flags
);
1816 case GIMPLE_OMP_CONTINUE
:
1817 dump_gimple_omp_continue (buffer
, gs
, spc
, flags
);
1820 case GIMPLE_OMP_SINGLE
:
1821 dump_gimple_omp_single (buffer
, gs
, spc
, flags
);
1824 case GIMPLE_OMP_RETURN
:
1825 dump_gimple_omp_return (buffer
, gs
, spc
, flags
);
1828 case GIMPLE_OMP_SECTIONS
:
1829 dump_gimple_omp_sections (buffer
, gs
, spc
, flags
);
1832 case GIMPLE_OMP_SECTIONS_SWITCH
:
1833 pp_string (buffer
, "GIMPLE_SECTIONS_SWITCH");
1836 case GIMPLE_OMP_MASTER
:
1837 case GIMPLE_OMP_ORDERED
:
1838 case GIMPLE_OMP_SECTION
:
1839 dump_gimple_omp_block (buffer
, gs
, spc
, flags
);
1842 case GIMPLE_OMP_CRITICAL
:
1843 dump_gimple_omp_critical (buffer
, gs
, spc
, flags
);
1847 dump_gimple_catch (buffer
, gs
, spc
, flags
);
1850 case GIMPLE_EH_FILTER
:
1851 dump_gimple_eh_filter (buffer
, gs
, spc
, flags
);
1854 case GIMPLE_EH_MUST_NOT_THROW
:
1855 dump_gimple_eh_must_not_throw (buffer
, gs
, spc
, flags
);
1859 dump_gimple_resx (buffer
, gs
, spc
, flags
);
1862 case GIMPLE_EH_DISPATCH
:
1863 dump_gimple_eh_dispatch (buffer
, gs
, spc
, flags
);
1867 dump_gimple_debug (buffer
, gs
, spc
, flags
);
1870 case GIMPLE_PREDICT
:
1871 pp_string (buffer
, "// predicted ");
1872 if (gimple_predict_outcome (gs
))
1873 pp_string (buffer
, "likely by ");
1875 pp_string (buffer
, "unlikely by ");
1876 pp_string (buffer
, predictor_name (gimple_predict_predictor (gs
)));
1877 pp_string (buffer
, " predictor.");
1884 /* If we're building a diagnostic, the formatted text will be
1885 written into BUFFER's stream by the caller; otherwise, write it
1887 if (!(flags
& TDF_DIAGNOSTIC
))
1888 pp_write_text_to_stream (buffer
);
1892 /* Dumps header of basic block BB to buffer BUFFER indented by INDENT
1893 spaces and details described by flags. */
1896 dump_bb_header (pretty_printer
*buffer
, basic_block bb
, int indent
, int flags
)
1902 if (flags
& TDF_BLOCKS
)
1905 pp_string (buffer
, "# BLOCK ");
1906 pp_decimal_int (buffer
, bb
->index
);
1909 pp_string (buffer
, " freq:");
1910 pp_decimal_int (buffer
, bb
->frequency
);
1914 pp_string (buffer
, " count:");
1915 pp_widest_integer (buffer
, bb
->count
);
1918 if (flags
& TDF_LINENO
)
1920 gimple_stmt_iterator gsi
;
1922 for (gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
); gsi_next (&gsi
))
1923 if (!is_gimple_debug (gsi_stmt (gsi
))
1924 && get_lineno (gsi_stmt (gsi
)) != UNKNOWN_LOCATION
)
1926 pp_string (buffer
, ", starting at line ");
1927 pp_decimal_int (buffer
, get_lineno (gsi_stmt (gsi
)));
1931 if (bb
->discriminator
)
1933 pp_string (buffer
, ", discriminator ");
1934 pp_decimal_int (buffer
, bb
->discriminator
);
1937 newline_and_indent (buffer
, indent
);
1939 pp_string (buffer
, "# PRED:");
1940 pp_write_text_to_stream (buffer
);
1941 FOR_EACH_EDGE (e
, ei
, bb
->preds
)
1942 if (flags
& TDF_SLIM
)
1944 pp_character (buffer
, ' ');
1945 if (e
->src
== ENTRY_BLOCK_PTR
)
1946 pp_string (buffer
, "ENTRY");
1948 pp_decimal_int (buffer
, e
->src
->index
);
1951 dump_edge_info (buffer
->buffer
->stream
, e
, 0);
1952 pp_newline (buffer
);
1956 stmt
= first_stmt (bb
);
1957 if (!stmt
|| gimple_code (stmt
) != GIMPLE_LABEL
)
1959 INDENT (indent
- 2);
1960 pp_string (buffer
, "<bb ");
1961 pp_decimal_int (buffer
, bb
->index
);
1962 pp_string (buffer
, ">:");
1963 pp_newline (buffer
);
1966 pp_write_text_to_stream (buffer
);
1968 check_bb_profile (bb
, buffer
->buffer
->stream
);
1972 /* Dumps end of basic block BB to buffer BUFFER indented by INDENT
1976 dump_bb_end (pretty_printer
*buffer
, basic_block bb
, int indent
, int flags
)
1982 pp_string (buffer
, "# SUCC:");
1983 pp_write_text_to_stream (buffer
);
1984 FOR_EACH_EDGE (e
, ei
, bb
->succs
)
1985 if (flags
& TDF_SLIM
)
1987 pp_character (buffer
, ' ');
1988 if (e
->dest
== EXIT_BLOCK_PTR
)
1989 pp_string (buffer
, "EXIT");
1991 pp_decimal_int (buffer
, e
->dest
->index
);
1994 dump_edge_info (buffer
->buffer
->stream
, e
, 1);
1995 pp_newline (buffer
);
1999 /* Dump PHI nodes of basic block BB to BUFFER with details described
2000 by FLAGS and indented by INDENT spaces. */
2003 dump_phi_nodes (pretty_printer
*buffer
, basic_block bb
, int indent
, int flags
)
2005 gimple_stmt_iterator i
;
2007 for (i
= gsi_start_phis (bb
); !gsi_end_p (i
); gsi_next (&i
))
2009 gimple phi
= gsi_stmt (i
);
2010 if (is_gimple_reg (gimple_phi_result (phi
)) || (flags
& TDF_VOPS
))
2013 pp_string (buffer
, "# ");
2014 dump_gimple_phi (buffer
, phi
, indent
, flags
);
2015 pp_newline (buffer
);
2021 /* Dump jump to basic block BB that is represented implicitly in the cfg
2025 pp_cfg_jump (pretty_printer
*buffer
, basic_block bb
)
2029 stmt
= first_stmt (bb
);
2031 pp_string (buffer
, "goto <bb ");
2032 pp_decimal_int (buffer
, bb
->index
);
2033 pp_character (buffer
, '>');
2034 if (stmt
&& gimple_code (stmt
) == GIMPLE_LABEL
)
2036 pp_string (buffer
, " (");
2037 dump_generic_node (buffer
, gimple_label_label (stmt
), 0, 0, false);
2038 pp_character (buffer
, ')');
2039 pp_semicolon (buffer
);
2042 pp_semicolon (buffer
);
2046 /* Dump edges represented implicitly in basic block BB to BUFFER, indented
2047 by INDENT spaces, with details given by FLAGS. */
2050 dump_implicit_edges (pretty_printer
*buffer
, basic_block bb
, int indent
,
2056 stmt
= last_stmt (bb
);
2058 if (stmt
&& gimple_code (stmt
) == GIMPLE_COND
)
2060 edge true_edge
, false_edge
;
2062 /* When we are emitting the code or changing CFG, it is possible that
2063 the edges are not yet created. When we are using debug_bb in such
2064 a situation, we do not want it to crash. */
2065 if (EDGE_COUNT (bb
->succs
) != 2)
2067 extract_true_false_edges_from_block (bb
, &true_edge
, &false_edge
);
2069 INDENT (indent
+ 2);
2070 pp_cfg_jump (buffer
, true_edge
->dest
);
2071 newline_and_indent (buffer
, indent
);
2072 pp_string (buffer
, "else");
2073 newline_and_indent (buffer
, indent
+ 2);
2074 pp_cfg_jump (buffer
, false_edge
->dest
);
2075 pp_newline (buffer
);
2079 /* If there is a fallthru edge, we may need to add an artificial
2080 goto to the dump. */
2081 e
= find_fallthru_edge (bb
->succs
);
2083 if (e
&& e
->dest
!= bb
->next_bb
)
2087 if ((flags
& TDF_LINENO
)
2088 && e
->goto_locus
!= UNKNOWN_LOCATION
2091 expanded_location goto_xloc
;
2092 goto_xloc
= expand_location (e
->goto_locus
);
2093 pp_character (buffer
, '[');
2096 pp_string (buffer
, goto_xloc
.file
);
2097 pp_string (buffer
, " : ");
2099 pp_decimal_int (buffer
, goto_xloc
.line
);
2100 pp_string (buffer
, " : ");
2101 pp_decimal_int (buffer
, goto_xloc
.column
);
2102 pp_string (buffer
, "] ");
2105 pp_cfg_jump (buffer
, e
->dest
);
2106 pp_newline (buffer
);
2111 /* Dumps basic block BB to buffer BUFFER with details described by FLAGS and
2112 indented by INDENT spaces. */
2115 gimple_dump_bb_buff (pretty_printer
*buffer
, basic_block bb
, int indent
,
2118 gimple_stmt_iterator gsi
;
2120 int label_indent
= indent
- 2;
2122 if (label_indent
< 0)
2125 dump_bb_header (buffer
, bb
, indent
, flags
);
2126 dump_phi_nodes (buffer
, bb
, indent
, flags
);
2128 for (gsi
= gsi_start_bb (bb
); !gsi_end_p (gsi
); gsi_next (&gsi
))
2132 stmt
= gsi_stmt (gsi
);
2134 curr_indent
= gimple_code (stmt
) == GIMPLE_LABEL
? label_indent
: indent
;
2136 INDENT (curr_indent
);
2137 dump_gimple_stmt (buffer
, stmt
, curr_indent
, flags
);
2138 pp_newline (buffer
);
2139 dump_histograms_for_stmt (cfun
, buffer
->buffer
->stream
, stmt
);
2142 dump_implicit_edges (buffer
, bb
, indent
, flags
);
2144 if (flags
& TDF_BLOCKS
)
2145 dump_bb_end (buffer
, bb
, indent
, flags
);
2149 /* Dumps basic block BB to FILE with details described by FLAGS and
2150 indented by INDENT spaces. */
2153 gimple_dump_bb (basic_block bb
, FILE *file
, int indent
, int flags
)
2155 maybe_init_pretty_print (file
);
2156 gimple_dump_bb_buff (&buffer
, bb
, indent
, flags
);