* jvspec.c (jvgenmain_spec): Don't handle -fnew-verifier.
[gcc.git] / gcc / gimple-pretty-print.c
1 /* Pretty formatting of GIMPLE statements and expressions.
2 Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
3 Free Software Foundation, Inc.
4 Contributed by Aldy Hernandez <aldyh@redhat.com> and
5 Diego Novillo <dnovillo@google.com>
6
7 This file is part of GCC.
8
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
12 version.
13
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
17 for more details.
18
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/>. */
22
23 #include "config.h"
24 #include "system.h"
25 #include "coretypes.h"
26 #include "tm.h"
27 #include "tree.h"
28 #include "diagnostic.h"
29 #include "tree-pretty-print.h"
30 #include "gimple-pretty-print.h"
31 #include "hashtab.h"
32 #include "tree-flow.h"
33 #include "tree-pass.h"
34 #include "gimple.h"
35 #include "value-prof.h"
36
37 #define INDENT(SPACE) \
38 do { int i; for (i = 0; i < SPACE; i++) pp_space (buffer); } while (0)
39
40 static pretty_printer buffer;
41 static bool initialized = false;
42
43 #define GIMPLE_NIY do_niy (buffer,gs)
44
45 /* Try to print on BUFFER a default message for the unrecognized
46 gimple statement GS. */
47
48 static void
49 do_niy (pretty_printer *buffer, gimple gs)
50 {
51 pp_printf (buffer, "<<< Unknown GIMPLE statement: %s >>>\n",
52 gimple_code_name[(int) gimple_code (gs)]);
53 }
54
55
56 /* Initialize the pretty printer on FILE if needed. */
57
58 static void
59 maybe_init_pretty_print (FILE *file)
60 {
61 if (!initialized)
62 {
63 pp_construct (&buffer, NULL, 0);
64 pp_needs_newline (&buffer) = true;
65 initialized = true;
66 }
67
68 buffer.buffer->stream = file;
69 }
70
71
72 /* Emit a newline and SPC indentantion spaces to BUFFER. */
73
74 static void
75 newline_and_indent (pretty_printer *buffer, int spc)
76 {
77 pp_newline (buffer);
78 INDENT (spc);
79 }
80
81
82 /* Print the GIMPLE statement GS on stderr. */
83
84 DEBUG_FUNCTION void
85 debug_gimple_stmt (gimple gs)
86 {
87 print_gimple_stmt (stderr, gs, 0, TDF_VOPS|TDF_MEMSYMS);
88 fprintf (stderr, "\n");
89 }
90
91
92 /* Dump GIMPLE statement G to FILE using SPC indentantion spaces and
93 FLAGS as in dump_gimple_stmt. */
94
95 void
96 print_gimple_stmt (FILE *file, gimple g, int spc, int flags)
97 {
98 maybe_init_pretty_print (file);
99 dump_gimple_stmt (&buffer, g, spc, flags);
100 pp_flush (&buffer);
101 }
102
103
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
106 of the statement. */
107
108 void
109 print_gimple_expr (FILE *file, gimple g, int spc, int flags)
110 {
111 flags |= TDF_RHS_ONLY;
112 maybe_init_pretty_print (file);
113 dump_gimple_stmt (&buffer, g, spc, flags);
114 }
115
116
117 /* Print the GIMPLE sequence SEQ on BUFFER using SPC indentantion
118 spaces and FLAGS as in dump_gimple_stmt. */
119
120 static void
121 dump_gimple_seq (pretty_printer *buffer, gimple_seq seq, int spc, int flags)
122 {
123 gimple_stmt_iterator i;
124
125 for (i = gsi_start (seq); !gsi_end_p (i); gsi_next (&i))
126 {
127 gimple gs = gsi_stmt (i);
128 INDENT (spc);
129 dump_gimple_stmt (buffer, gs, spc, flags);
130 if (!gsi_one_before_end_p (i))
131 pp_newline (buffer);
132 }
133 }
134
135
136 /* Dump GIMPLE sequence SEQ to FILE using SPC indentantion spaces and
137 FLAGS as in dump_gimple_stmt. */
138
139 void
140 print_gimple_seq (FILE *file, gimple_seq seq, int spc, int flags)
141 {
142 maybe_init_pretty_print (file);
143 dump_gimple_seq (&buffer, seq, spc, flags);
144 pp_flush (&buffer);
145 }
146
147
148 /* Print the GIMPLE sequence SEQ on stderr. */
149
150 DEBUG_FUNCTION void
151 debug_gimple_seq (gimple_seq seq)
152 {
153 print_gimple_seq (stderr, seq, 0, TDF_VOPS|TDF_MEMSYMS);
154 }
155
156
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. */
167
168 static void
169 dump_gimple_fmt (pretty_printer *buffer, int spc, int flags,
170 const char *fmt, ...)
171 {
172 va_list args;
173 const char *c;
174 const char *tmp;
175
176 va_start (args, fmt);
177 for (c = fmt; *c; c++)
178 {
179 if (*c == '%')
180 {
181 gimple_seq seq;
182 tree t;
183 gimple g;
184 switch (*++c)
185 {
186 case 'G':
187 g = va_arg (args, gimple);
188 tmp = gimple_code_name[gimple_code (g)];
189 pp_string (buffer, tmp);
190 break;
191
192 case 'S':
193 seq = va_arg (args, gimple_seq);
194 pp_newline (buffer);
195 dump_gimple_seq (buffer, seq, spc + 2, flags);
196 newline_and_indent (buffer, spc);
197 break;
198
199 case 'T':
200 t = va_arg (args, tree);
201 if (t == NULL_TREE)
202 pp_string (buffer, "NULL");
203 else
204 dump_generic_node (buffer, t, spc, flags, false);
205 break;
206
207 case 'd':
208 pp_decimal_int (buffer, va_arg (args, int));
209 break;
210
211 case 's':
212 pp_string (buffer, va_arg (args, char *));
213 break;
214
215 case 'n':
216 newline_and_indent (buffer, spc);
217 break;
218
219 case '+':
220 spc += 2;
221 newline_and_indent (buffer, spc);
222 break;
223
224 case '-':
225 spc -= 2;
226 newline_and_indent (buffer, spc);
227 break;
228
229 default:
230 gcc_unreachable ();
231 }
232 }
233 else
234 pp_character (buffer, *c);
235 }
236 va_end (args);
237 }
238
239
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. */
242
243 static void
244 dump_unary_rhs (pretty_printer *buffer, gimple gs, int spc, int flags)
245 {
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);
249
250 switch (rhs_code)
251 {
252 case VIEW_CONVERT_EXPR:
253 case ASSERT_EXPR:
254 dump_generic_node (buffer, rhs, spc, flags, false);
255 break;
256
257 case FIXED_CONVERT_EXPR:
258 case ADDR_SPACE_CONVERT_EXPR:
259 case FIX_TRUNC_EXPR:
260 case FLOAT_EXPR:
261 CASE_CONVERT:
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))
266 {
267 pp_character (buffer, '(');
268 dump_generic_node (buffer, rhs, spc, flags, false);
269 pp_character (buffer, ')');
270 }
271 else
272 dump_generic_node (buffer, rhs, spc, flags, false);
273 break;
274
275 case PAREN_EXPR:
276 pp_string (buffer, "((");
277 dump_generic_node (buffer, rhs, spc, flags, false);
278 pp_string (buffer, "))");
279 break;
280
281 case ABS_EXPR:
282 pp_string (buffer, "ABS_EXPR <");
283 dump_generic_node (buffer, rhs, spc, flags, false);
284 pp_character (buffer, '>');
285 break;
286
287 default:
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)
294 {
295 dump_generic_node (buffer, rhs, spc, flags, false);
296 break;
297 }
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, '-');
304 else
305 {
306 pp_character (buffer, '[');
307 pp_string (buffer, tree_code_name [rhs_code]);
308 pp_string (buffer, "] ");
309 }
310
311 if (op_prio (rhs) < op_code_prio (rhs_code))
312 {
313 pp_character (buffer, '(');
314 dump_generic_node (buffer, rhs, spc, flags, false);
315 pp_character (buffer, ')');
316 }
317 else
318 dump_generic_node (buffer, rhs, spc, flags, false);
319 break;
320 }
321 }
322
323
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. */
326
327 static void
328 dump_binary_rhs (pretty_printer *buffer, gimple gs, int spc, int flags)
329 {
330 const char *p;
331 enum tree_code code = gimple_assign_rhs_code (gs);
332 switch (code)
333 {
334 case COMPLEX_EXPR:
335 case MIN_EXPR:
336 case MAX_EXPR:
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 for (p = tree_code_name [(int) code]; *p; p++)
347 pp_character (buffer, TOUPPER (*p));
348 pp_string (buffer, " <");
349 dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags, false);
350 pp_string (buffer, ", ");
351 dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags, false);
352 pp_character (buffer, '>');
353 break;
354
355 default:
356 if (op_prio (gimple_assign_rhs1 (gs)) <= op_code_prio (code))
357 {
358 pp_character (buffer, '(');
359 dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags,
360 false);
361 pp_character (buffer, ')');
362 }
363 else
364 dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags, false);
365 pp_space (buffer);
366 pp_string (buffer, op_symbol_code (gimple_assign_rhs_code (gs)));
367 pp_space (buffer);
368 if (op_prio (gimple_assign_rhs2 (gs)) <= op_code_prio (code))
369 {
370 pp_character (buffer, '(');
371 dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags,
372 false);
373 pp_character (buffer, ')');
374 }
375 else
376 dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags, false);
377 }
378 }
379
380 /* Helper for dump_gimple_assign. Print the ternary RHS of the
381 assignment GS. BUFFER, SPC and FLAGS are as in dump_gimple_stmt. */
382
383 static void
384 dump_ternary_rhs (pretty_printer *buffer, gimple gs, int spc, int flags)
385 {
386 const char *p;
387 enum tree_code code = gimple_assign_rhs_code (gs);
388 switch (code)
389 {
390 case WIDEN_MULT_PLUS_EXPR:
391 case WIDEN_MULT_MINUS_EXPR:
392 for (p = tree_code_name [(int) code]; *p; p++)
393 pp_character (buffer, TOUPPER (*p));
394 pp_string (buffer, " <");
395 dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags, false);
396 pp_string (buffer, ", ");
397 dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags, false);
398 pp_string (buffer, ", ");
399 dump_generic_node (buffer, gimple_assign_rhs3 (gs), spc, flags, false);
400 pp_character (buffer, '>');
401 break;
402
403 default:
404 gcc_unreachable ();
405 }
406 }
407
408
409 /* Dump the gimple assignment GS. BUFFER, SPC and FLAGS are as in
410 dump_gimple_stmt. */
411
412 static void
413 dump_gimple_assign (pretty_printer *buffer, gimple gs, int spc, int flags)
414 {
415 if (flags & TDF_RAW)
416 {
417 tree last;
418 if (gimple_num_ops (gs) == 2)
419 last = NULL_TREE;
420 else if (gimple_num_ops (gs) == 3)
421 last = gimple_assign_rhs2 (gs);
422 else
423 gcc_unreachable ();
424
425 dump_gimple_fmt (buffer, spc, flags, "%G <%s, %T, %T, %T>", gs,
426 tree_code_name[gimple_assign_rhs_code (gs)],
427 gimple_assign_lhs (gs), gimple_assign_rhs1 (gs), last);
428 }
429 else
430 {
431 if (!(flags & TDF_RHS_ONLY))
432 {
433 dump_generic_node (buffer, gimple_assign_lhs (gs), spc, flags, false);
434 pp_space (buffer);
435 pp_character (buffer, '=');
436
437 if (gimple_assign_nontemporal_move_p (gs))
438 pp_string (buffer, "{nt}");
439
440 if (gimple_has_volatile_ops (gs))
441 pp_string (buffer, "{v}");
442
443 pp_space (buffer);
444 }
445
446 if (gimple_num_ops (gs) == 2)
447 dump_unary_rhs (buffer, gs, spc, flags);
448 else if (gimple_num_ops (gs) == 3)
449 dump_binary_rhs (buffer, gs, spc, flags);
450 else if (gimple_num_ops (gs) == 4)
451 dump_ternary_rhs (buffer, gs, spc, flags);
452 else
453 gcc_unreachable ();
454 if (!(flags & TDF_RHS_ONLY))
455 pp_semicolon(buffer);
456 }
457 }
458
459
460 /* Dump the return statement GS. BUFFER, SPC and FLAGS are as in
461 dump_gimple_stmt. */
462
463 static void
464 dump_gimple_return (pretty_printer *buffer, gimple gs, int spc, int flags)
465 {
466 tree t;
467
468 t = gimple_return_retval (gs);
469 if (flags & TDF_RAW)
470 dump_gimple_fmt (buffer, spc, flags, "%G <%T>", gs, t);
471 else
472 {
473 pp_string (buffer, "return");
474 if (t)
475 {
476 pp_space (buffer);
477 dump_generic_node (buffer, t, spc, flags, false);
478 }
479 pp_semicolon (buffer);
480 }
481 }
482
483
484 /* Dump the call arguments for a gimple call. BUFFER, FLAGS are as in
485 dump_gimple_call. */
486
487 static void
488 dump_gimple_call_args (pretty_printer *buffer, gimple gs, int flags)
489 {
490 size_t i;
491
492 for (i = 0; i < gimple_call_num_args (gs); i++)
493 {
494 dump_generic_node (buffer, gimple_call_arg (gs, i), 0, flags, false);
495 if (i < gimple_call_num_args (gs) - 1)
496 pp_string (buffer, ", ");
497 }
498
499 if (gimple_call_va_arg_pack_p (gs))
500 {
501 if (gimple_call_num_args (gs) > 0)
502 {
503 pp_character (buffer, ',');
504 pp_space (buffer);
505 }
506
507 pp_string (buffer, "__builtin_va_arg_pack ()");
508 }
509 }
510
511 /* Dump the points-to solution *PT to BUFFER. */
512
513 static void
514 pp_points_to_solution (pretty_printer *buffer, struct pt_solution *pt)
515 {
516 if (pt->anything)
517 {
518 pp_string (buffer, "anything ");
519 return;
520 }
521 if (pt->nonlocal)
522 pp_string (buffer, "nonlocal ");
523 if (pt->escaped)
524 pp_string (buffer, "escaped ");
525 if (pt->ipa_escaped)
526 pp_string (buffer, "unit-escaped ");
527 if (pt->null)
528 pp_string (buffer, "null ");
529 if (pt->vars
530 && !bitmap_empty_p (pt->vars))
531 {
532 bitmap_iterator bi;
533 unsigned i;
534 pp_string (buffer, "{ ");
535 EXECUTE_IF_SET_IN_BITMAP (pt->vars, 0, i, bi)
536 {
537 tree var = referenced_var_lookup (i);
538 if (var)
539 {
540 dump_generic_node (buffer, var, 0, dump_flags, false);
541 if (DECL_PT_UID (var) != DECL_UID (var))
542 {
543 pp_string (buffer, "ptD.");
544 pp_decimal_int (buffer, DECL_PT_UID (var));
545 }
546 }
547 else
548 {
549 pp_string (buffer, "D.");
550 pp_decimal_int (buffer, i);
551 }
552 pp_character (buffer, ' ');
553 }
554 pp_character (buffer, '}');
555 if (pt->vars_contains_global)
556 pp_string (buffer, " (glob)");
557 if (pt->vars_contains_restrict)
558 pp_string (buffer, " (restr)");
559 }
560 }
561
562 /* Dump the call statement GS. BUFFER, SPC and FLAGS are as in
563 dump_gimple_stmt. */
564
565 static void
566 dump_gimple_call (pretty_printer *buffer, gimple gs, int spc, int flags)
567 {
568 tree lhs = gimple_call_lhs (gs);
569
570 if (flags & TDF_ALIAS)
571 {
572 struct pt_solution *pt;
573 pt = gimple_call_use_set (gs);
574 if (!pt_solution_empty_p (pt))
575 {
576 pp_string (buffer, "# USE = ");
577 pp_points_to_solution (buffer, pt);
578 newline_and_indent (buffer, spc);
579 }
580 pt = gimple_call_clobber_set (gs);
581 if (!pt_solution_empty_p (pt))
582 {
583 pp_string (buffer, "# CLB = ");
584 pp_points_to_solution (buffer, pt);
585 newline_and_indent (buffer, spc);
586 }
587 }
588
589 if (flags & TDF_RAW)
590 {
591 dump_gimple_fmt (buffer, spc, flags, "%G <%T, %T",
592 gs, gimple_call_fn (gs), lhs);
593 if (gimple_call_num_args (gs) > 0)
594 {
595 pp_string (buffer, ", ");
596 dump_gimple_call_args (buffer, gs, flags);
597 }
598 pp_character (buffer, '>');
599 }
600 else
601 {
602 if (lhs && !(flags & TDF_RHS_ONLY))
603 {
604 dump_generic_node (buffer, lhs, spc, flags, false);
605 pp_string (buffer, " =");
606
607 if (gimple_has_volatile_ops (gs))
608 pp_string (buffer, "{v}");
609
610 pp_space (buffer);
611 }
612 print_call_name (buffer, gimple_call_fn (gs), flags);
613 pp_string (buffer, " (");
614 dump_gimple_call_args (buffer, gs, flags);
615 pp_character (buffer, ')');
616 if (!(flags & TDF_RHS_ONLY))
617 pp_semicolon (buffer);
618 }
619
620 if (gimple_call_chain (gs))
621 {
622 pp_string (buffer, " [static-chain: ");
623 dump_generic_node (buffer, gimple_call_chain (gs), spc, flags, false);
624 pp_character (buffer, ']');
625 }
626
627 if (gimple_call_return_slot_opt_p (gs))
628 pp_string (buffer, " [return slot optimization]");
629
630 if (gimple_call_tail_p (gs))
631 pp_string (buffer, " [tail call]");
632 }
633
634
635 /* Dump the switch statement GS. BUFFER, SPC and FLAGS are as in
636 dump_gimple_stmt. */
637
638 static void
639 dump_gimple_switch (pretty_printer *buffer, gimple gs, int spc, int flags)
640 {
641 unsigned int i;
642
643 GIMPLE_CHECK (gs, GIMPLE_SWITCH);
644 if (flags & TDF_RAW)
645 dump_gimple_fmt (buffer, spc, flags, "%G <%T, ", gs,
646 gimple_switch_index (gs));
647 else
648 {
649 pp_string (buffer, "switch (");
650 dump_generic_node (buffer, gimple_switch_index (gs), spc, flags, true);
651 pp_string (buffer, ") <");
652 }
653
654 for (i = 0; i < gimple_switch_num_labels (gs); i++)
655 {
656 tree case_label = gimple_switch_label (gs, i);
657 if (case_label == NULL_TREE)
658 continue;
659
660 dump_generic_node (buffer, case_label, spc, flags, false);
661 pp_character (buffer, ' ');
662 dump_generic_node (buffer, CASE_LABEL (case_label), spc, flags, false);
663 if (i < gimple_switch_num_labels (gs) - 1)
664 pp_string (buffer, ", ");
665 }
666 pp_character (buffer, '>');
667 }
668
669
670 /* Dump the gimple conditional GS. BUFFER, SPC and FLAGS are as in
671 dump_gimple_stmt. */
672
673 static void
674 dump_gimple_cond (pretty_printer *buffer, gimple gs, int spc, int flags)
675 {
676 if (flags & TDF_RAW)
677 dump_gimple_fmt (buffer, spc, flags, "%G <%s, %T, %T, %T, %T>", gs,
678 tree_code_name [gimple_cond_code (gs)],
679 gimple_cond_lhs (gs), gimple_cond_rhs (gs),
680 gimple_cond_true_label (gs), gimple_cond_false_label (gs));
681 else
682 {
683 if (!(flags & TDF_RHS_ONLY))
684 pp_string (buffer, "if (");
685 dump_generic_node (buffer, gimple_cond_lhs (gs), spc, flags, false);
686 pp_space (buffer);
687 pp_string (buffer, op_symbol_code (gimple_cond_code (gs)));
688 pp_space (buffer);
689 dump_generic_node (buffer, gimple_cond_rhs (gs), spc, flags, false);
690 if (!(flags & TDF_RHS_ONLY))
691 {
692 pp_character (buffer, ')');
693
694 if (gimple_cond_true_label (gs))
695 {
696 pp_string (buffer, " goto ");
697 dump_generic_node (buffer, gimple_cond_true_label (gs),
698 spc, flags, false);
699 pp_semicolon (buffer);
700 }
701 if (gimple_cond_false_label (gs))
702 {
703 pp_string (buffer, " else goto ");
704 dump_generic_node (buffer, gimple_cond_false_label (gs),
705 spc, flags, false);
706 pp_semicolon (buffer);
707 }
708 }
709 }
710 }
711
712
713 /* Dump a GIMPLE_LABEL tuple on the pretty_printer BUFFER, SPC
714 spaces of indent. FLAGS specifies details to show in the dump (see
715 TDF_* in tree-pass.h). */
716
717 static void
718 dump_gimple_label (pretty_printer *buffer, gimple gs, int spc, int flags)
719 {
720 tree label = gimple_label_label (gs);
721 if (flags & TDF_RAW)
722 dump_gimple_fmt (buffer, spc, flags, "%G <%T>", gs, label);
723 else
724 {
725 dump_generic_node (buffer, label, spc, flags, false);
726 pp_character (buffer, ':');
727 }
728 if (DECL_NONLOCAL (label))
729 pp_string (buffer, " [non-local]");
730 if ((flags & TDF_EH) && EH_LANDING_PAD_NR (label))
731 pp_printf (buffer, " [LP %d]", EH_LANDING_PAD_NR (label));
732 }
733
734 /* Dump a GIMPLE_GOTO tuple on the pretty_printer BUFFER, SPC
735 spaces of indent. FLAGS specifies details to show in the dump (see
736 TDF_* in tree-pass.h). */
737
738 static void
739 dump_gimple_goto (pretty_printer *buffer, gimple gs, int spc, int flags)
740 {
741 tree label = gimple_goto_dest (gs);
742 if (flags & TDF_RAW)
743 dump_gimple_fmt (buffer, spc, flags, "%G <%T>", gs, label);
744 else
745 dump_gimple_fmt (buffer, spc, flags, "goto %T;", label);
746 }
747
748
749 /* Dump a GIMPLE_BIND tuple on the pretty_printer BUFFER, SPC
750 spaces of indent. FLAGS specifies details to show in the dump (see
751 TDF_* in tree-pass.h). */
752
753 static void
754 dump_gimple_bind (pretty_printer *buffer, gimple gs, int spc, int flags)
755 {
756 if (flags & TDF_RAW)
757 dump_gimple_fmt (buffer, spc, flags, "%G <", gs);
758 else
759 pp_character (buffer, '{');
760 if (!(flags & TDF_SLIM))
761 {
762 tree var;
763
764 for (var = gimple_bind_vars (gs); var; var = DECL_CHAIN (var))
765 {
766 newline_and_indent (buffer, 2);
767 print_declaration (buffer, var, spc, flags);
768 }
769 if (gimple_bind_vars (gs))
770 pp_newline (buffer);
771 }
772 pp_newline (buffer);
773 dump_gimple_seq (buffer, gimple_bind_body (gs), spc + 2, flags);
774 newline_and_indent (buffer, spc);
775 if (flags & TDF_RAW)
776 pp_character (buffer, '>');
777 else
778 pp_character (buffer, '}');
779 }
780
781
782 /* Dump a GIMPLE_TRY tuple on the pretty_printer BUFFER, SPC spaces of
783 indent. FLAGS specifies details to show in the dump (see TDF_* in
784 tree-pass.h). */
785
786 static void
787 dump_gimple_try (pretty_printer *buffer, gimple gs, int spc, int flags)
788 {
789 if (flags & TDF_RAW)
790 {
791 const char *type;
792 if (gimple_try_kind (gs) == GIMPLE_TRY_CATCH)
793 type = "GIMPLE_TRY_CATCH";
794 else if (gimple_try_kind (gs) == GIMPLE_TRY_FINALLY)
795 type = "GIMPLE_TRY_FINALLY";
796 else
797 type = "UNKNOWN GIMPLE_TRY";
798 dump_gimple_fmt (buffer, spc, flags,
799 "%G <%s,%+EVAL <%S>%nCLEANUP <%S>%->", gs, type,
800 gimple_try_eval (gs), gimple_try_cleanup (gs));
801 }
802 else
803 {
804 pp_string (buffer, "try");
805 newline_and_indent (buffer, spc + 2);
806 pp_character (buffer, '{');
807 pp_newline (buffer);
808
809 dump_gimple_seq (buffer, gimple_try_eval (gs), spc + 4, flags);
810 newline_and_indent (buffer, spc + 2);
811 pp_character (buffer, '}');
812
813 if (gimple_try_kind (gs) == GIMPLE_TRY_CATCH)
814 {
815 newline_and_indent (buffer, spc);
816 pp_string (buffer, "catch");
817 newline_and_indent (buffer, spc + 2);
818 pp_character (buffer, '{');
819 }
820 else if (gimple_try_kind (gs) == GIMPLE_TRY_FINALLY)
821 {
822 newline_and_indent (buffer, spc);
823 pp_string (buffer, "finally");
824 newline_and_indent (buffer, spc + 2);
825 pp_character (buffer, '{');
826 }
827 else
828 pp_string (buffer, " <UNKNOWN GIMPLE_TRY> {");
829
830 pp_newline (buffer);
831 dump_gimple_seq (buffer, gimple_try_cleanup (gs), spc + 4, flags);
832 newline_and_indent (buffer, spc + 2);
833 pp_character (buffer, '}');
834 }
835 }
836
837
838 /* Dump a GIMPLE_CATCH tuple on the pretty_printer BUFFER, SPC spaces of
839 indent. FLAGS specifies details to show in the dump (see TDF_* in
840 tree-pass.h). */
841
842 static void
843 dump_gimple_catch (pretty_printer *buffer, gimple gs, int spc, int flags)
844 {
845 if (flags & TDF_RAW)
846 dump_gimple_fmt (buffer, spc, flags, "%G <%T, %+CATCH <%S>%->", gs,
847 gimple_catch_types (gs), gimple_catch_handler (gs));
848 else
849 dump_gimple_fmt (buffer, spc, flags, "catch (%T)%+{%S}",
850 gimple_catch_types (gs), gimple_catch_handler (gs));
851 }
852
853
854 /* Dump a GIMPLE_EH_FILTER tuple on the pretty_printer BUFFER, SPC spaces of
855 indent. FLAGS specifies details to show in the dump (see TDF_* in
856 tree-pass.h). */
857
858 static void
859 dump_gimple_eh_filter (pretty_printer *buffer, gimple gs, int spc, int flags)
860 {
861 if (flags & TDF_RAW)
862 dump_gimple_fmt (buffer, spc, flags, "%G <%T, %+FAILURE <%S>%->", gs,
863 gimple_eh_filter_types (gs),
864 gimple_eh_filter_failure (gs));
865 else
866 dump_gimple_fmt (buffer, spc, flags, "<<<eh_filter (%T)>>>%+{%+%S%-}",
867 gimple_eh_filter_types (gs),
868 gimple_eh_filter_failure (gs));
869 }
870
871
872 /* Dump a GIMPLE_EH_MUST_NOT_THROW tuple. */
873
874 static void
875 dump_gimple_eh_must_not_throw (pretty_printer *buffer, gimple gs,
876 int spc, int flags)
877 {
878 if (flags & TDF_RAW)
879 dump_gimple_fmt (buffer, spc, flags, "%G <%T>", gs,
880 gimple_eh_must_not_throw_fndecl (gs));
881 else
882 dump_gimple_fmt (buffer, spc, flags, "<<<eh_must_not_throw (%T)>>>",
883 gimple_eh_must_not_throw_fndecl (gs));
884 }
885
886
887 /* Dump a GIMPLE_RESX tuple on the pretty_printer BUFFER, SPC spaces of
888 indent. FLAGS specifies details to show in the dump (see TDF_* in
889 tree-pass.h). */
890
891 static void
892 dump_gimple_resx (pretty_printer *buffer, gimple gs, int spc, int flags)
893 {
894 if (flags & TDF_RAW)
895 dump_gimple_fmt (buffer, spc, flags, "%G <%d>", gs,
896 gimple_resx_region (gs));
897 else
898 dump_gimple_fmt (buffer, spc, flags, "resx %d", gimple_resx_region (gs));
899 }
900
901 /* Dump a GIMPLE_EH_DISPATCH tuple on the pretty_printer BUFFER. */
902
903 static void
904 dump_gimple_eh_dispatch (pretty_printer *buffer, gimple gs, int spc, int flags)
905 {
906 if (flags & TDF_RAW)
907 dump_gimple_fmt (buffer, spc, flags, "%G <%d>", gs,
908 gimple_eh_dispatch_region (gs));
909 else
910 dump_gimple_fmt (buffer, spc, flags, "eh_dispatch %d",
911 gimple_eh_dispatch_region (gs));
912 }
913
914 /* Dump a GIMPLE_DEBUG tuple on the pretty_printer BUFFER, SPC spaces
915 of indent. FLAGS specifies details to show in the dump (see TDF_*
916 in tree-pass.h). */
917
918 static void
919 dump_gimple_debug (pretty_printer *buffer, gimple gs, int spc, int flags)
920 {
921 switch (gs->gsbase.subcode)
922 {
923 case GIMPLE_DEBUG_BIND:
924 if (flags & TDF_RAW)
925 dump_gimple_fmt (buffer, spc, flags, "%G BIND <%T, %T>", gs,
926 gimple_debug_bind_get_var (gs),
927 gimple_debug_bind_get_value (gs));
928 else
929 dump_gimple_fmt (buffer, spc, flags, "# DEBUG %T => %T",
930 gimple_debug_bind_get_var (gs),
931 gimple_debug_bind_get_value (gs));
932 break;
933
934 default:
935 gcc_unreachable ();
936 }
937 }
938
939 /* Dump a GIMPLE_OMP_FOR tuple on the pretty_printer BUFFER. */
940 static void
941 dump_gimple_omp_for (pretty_printer *buffer, gimple gs, int spc, int flags)
942 {
943 size_t i;
944
945 if (flags & TDF_RAW)
946 {
947 dump_gimple_fmt (buffer, spc, flags, "%G <%+BODY <%S>%nCLAUSES <", gs,
948 gimple_omp_body (gs));
949 dump_omp_clauses (buffer, gimple_omp_for_clauses (gs), spc, flags);
950 dump_gimple_fmt (buffer, spc, flags, " >,");
951 for (i = 0; i < gimple_omp_for_collapse (gs); i++)
952 dump_gimple_fmt (buffer, spc, flags,
953 "%+%T, %T, %T, %s, %T,%n",
954 gimple_omp_for_index (gs, i),
955 gimple_omp_for_initial (gs, i),
956 gimple_omp_for_final (gs, i),
957 tree_code_name[gimple_omp_for_cond (gs, i)],
958 gimple_omp_for_incr (gs, i));
959 dump_gimple_fmt (buffer, spc, flags, "PRE_BODY <%S>%->",
960 gimple_omp_for_pre_body (gs));
961 }
962 else
963 {
964 pp_string (buffer, "#pragma omp for");
965 dump_omp_clauses (buffer, gimple_omp_for_clauses (gs), spc, flags);
966 for (i = 0; i < gimple_omp_for_collapse (gs); i++)
967 {
968 if (i)
969 spc += 2;
970 newline_and_indent (buffer, spc);
971 pp_string (buffer, "for (");
972 dump_generic_node (buffer, gimple_omp_for_index (gs, i), spc,
973 flags, false);
974 pp_string (buffer, " = ");
975 dump_generic_node (buffer, gimple_omp_for_initial (gs, i), spc,
976 flags, false);
977 pp_string (buffer, "; ");
978
979 dump_generic_node (buffer, gimple_omp_for_index (gs, i), spc,
980 flags, false);
981 pp_space (buffer);
982 switch (gimple_omp_for_cond (gs, i))
983 {
984 case LT_EXPR:
985 pp_character (buffer, '<');
986 break;
987 case GT_EXPR:
988 pp_character (buffer, '>');
989 break;
990 case LE_EXPR:
991 pp_string (buffer, "<=");
992 break;
993 case GE_EXPR:
994 pp_string (buffer, ">=");
995 break;
996 default:
997 gcc_unreachable ();
998 }
999 pp_space (buffer);
1000 dump_generic_node (buffer, gimple_omp_for_final (gs, i), spc,
1001 flags, false);
1002 pp_string (buffer, "; ");
1003
1004 dump_generic_node (buffer, gimple_omp_for_index (gs, i), spc,
1005 flags, false);
1006 pp_string (buffer, " = ");
1007 dump_generic_node (buffer, gimple_omp_for_incr (gs, i), spc,
1008 flags, false);
1009 pp_character (buffer, ')');
1010 }
1011
1012 if (!gimple_seq_empty_p (gimple_omp_body (gs)))
1013 {
1014 newline_and_indent (buffer, spc + 2);
1015 pp_character (buffer, '{');
1016 pp_newline (buffer);
1017 dump_gimple_seq (buffer, gimple_omp_body (gs), spc + 4, flags);
1018 newline_and_indent (buffer, spc + 2);
1019 pp_character (buffer, '}');
1020 }
1021 }
1022 }
1023
1024 /* Dump a GIMPLE_OMP_CONTINUE tuple on the pretty_printer BUFFER. */
1025
1026 static void
1027 dump_gimple_omp_continue (pretty_printer *buffer, gimple gs, int spc, int flags)
1028 {
1029 if (flags & TDF_RAW)
1030 {
1031 dump_gimple_fmt (buffer, spc, flags, "%G <%T, %T>", gs,
1032 gimple_omp_continue_control_def (gs),
1033 gimple_omp_continue_control_use (gs));
1034 }
1035 else
1036 {
1037 pp_string (buffer, "#pragma omp continue (");
1038 dump_generic_node (buffer, gimple_omp_continue_control_def (gs),
1039 spc, flags, false);
1040 pp_character (buffer, ',');
1041 pp_space (buffer);
1042 dump_generic_node (buffer, gimple_omp_continue_control_use (gs),
1043 spc, flags, false);
1044 pp_character (buffer, ')');
1045 }
1046 }
1047
1048 /* Dump a GIMPLE_OMP_SINGLE tuple on the pretty_printer BUFFER. */
1049
1050 static void
1051 dump_gimple_omp_single (pretty_printer *buffer, gimple gs, int spc, int flags)
1052 {
1053 if (flags & TDF_RAW)
1054 {
1055 dump_gimple_fmt (buffer, spc, flags, "%G <%+BODY <%S>%nCLAUSES <", gs,
1056 gimple_omp_body (gs));
1057 dump_omp_clauses (buffer, gimple_omp_single_clauses (gs), spc, flags);
1058 dump_gimple_fmt (buffer, spc, flags, " >");
1059 }
1060 else
1061 {
1062 pp_string (buffer, "#pragma omp single");
1063 dump_omp_clauses (buffer, gimple_omp_single_clauses (gs), spc, flags);
1064 if (!gimple_seq_empty_p (gimple_omp_body (gs)))
1065 {
1066 newline_and_indent (buffer, spc + 2);
1067 pp_character (buffer, '{');
1068 pp_newline (buffer);
1069 dump_gimple_seq (buffer, gimple_omp_body (gs), spc + 4, flags);
1070 newline_and_indent (buffer, spc + 2);
1071 pp_character (buffer, '}');
1072 }
1073 }
1074 }
1075
1076 /* Dump a GIMPLE_OMP_SECTIONS tuple on the pretty_printer BUFFER. */
1077
1078 static void
1079 dump_gimple_omp_sections (pretty_printer *buffer, gimple gs, int spc,
1080 int flags)
1081 {
1082 if (flags & TDF_RAW)
1083 {
1084 dump_gimple_fmt (buffer, spc, flags, "%G <%+BODY <%S>%nCLAUSES <", gs,
1085 gimple_omp_body (gs));
1086 dump_omp_clauses (buffer, gimple_omp_sections_clauses (gs), spc, flags);
1087 dump_gimple_fmt (buffer, spc, flags, " >");
1088 }
1089 else
1090 {
1091 pp_string (buffer, "#pragma omp sections");
1092 if (gimple_omp_sections_control (gs))
1093 {
1094 pp_string (buffer, " <");
1095 dump_generic_node (buffer, gimple_omp_sections_control (gs), spc,
1096 flags, false);
1097 pp_character (buffer, '>');
1098 }
1099 dump_omp_clauses (buffer, gimple_omp_sections_clauses (gs), spc, flags);
1100 if (!gimple_seq_empty_p (gimple_omp_body (gs)))
1101 {
1102 newline_and_indent (buffer, spc + 2);
1103 pp_character (buffer, '{');
1104 pp_newline (buffer);
1105 dump_gimple_seq (buffer, gimple_omp_body (gs), spc + 4, flags);
1106 newline_and_indent (buffer, spc + 2);
1107 pp_character (buffer, '}');
1108 }
1109 }
1110 }
1111
1112 /* Dump a GIMPLE_OMP_{MASTER,ORDERED,SECTION} tuple on the pretty_printer
1113 BUFFER. */
1114
1115 static void
1116 dump_gimple_omp_block (pretty_printer *buffer, gimple gs, int spc, int flags)
1117 {
1118 if (flags & TDF_RAW)
1119 dump_gimple_fmt (buffer, spc, flags, "%G <%+BODY <%S> >", gs,
1120 gimple_omp_body (gs));
1121 else
1122 {
1123 switch (gimple_code (gs))
1124 {
1125 case GIMPLE_OMP_MASTER:
1126 pp_string (buffer, "#pragma omp master");
1127 break;
1128 case GIMPLE_OMP_ORDERED:
1129 pp_string (buffer, "#pragma omp ordered");
1130 break;
1131 case GIMPLE_OMP_SECTION:
1132 pp_string (buffer, "#pragma omp section");
1133 break;
1134 default:
1135 gcc_unreachable ();
1136 }
1137 if (!gimple_seq_empty_p (gimple_omp_body (gs)))
1138 {
1139 newline_and_indent (buffer, spc + 2);
1140 pp_character (buffer, '{');
1141 pp_newline (buffer);
1142 dump_gimple_seq (buffer, gimple_omp_body (gs), spc + 4, flags);
1143 newline_and_indent (buffer, spc + 2);
1144 pp_character (buffer, '}');
1145 }
1146 }
1147 }
1148
1149 /* Dump a GIMPLE_OMP_CRITICAL tuple on the pretty_printer BUFFER. */
1150
1151 static void
1152 dump_gimple_omp_critical (pretty_printer *buffer, gimple gs, int spc,
1153 int flags)
1154 {
1155 if (flags & TDF_RAW)
1156 dump_gimple_fmt (buffer, spc, flags, "%G <%+BODY <%S> >", gs,
1157 gimple_omp_body (gs));
1158 else
1159 {
1160 pp_string (buffer, "#pragma omp critical");
1161 if (gimple_omp_critical_name (gs))
1162 {
1163 pp_string (buffer, " (");
1164 dump_generic_node (buffer, gimple_omp_critical_name (gs), spc,
1165 flags, false);
1166 pp_character (buffer, ')');
1167 }
1168 if (!gimple_seq_empty_p (gimple_omp_body (gs)))
1169 {
1170 newline_and_indent (buffer, spc + 2);
1171 pp_character (buffer, '{');
1172 pp_newline (buffer);
1173 dump_gimple_seq (buffer, gimple_omp_body (gs), spc + 4, flags);
1174 newline_and_indent (buffer, spc + 2);
1175 pp_character (buffer, '}');
1176 }
1177 }
1178 }
1179
1180 /* Dump a GIMPLE_OMP_RETURN tuple on the pretty_printer BUFFER. */
1181
1182 static void
1183 dump_gimple_omp_return (pretty_printer *buffer, gimple gs, int spc, int flags)
1184 {
1185 if (flags & TDF_RAW)
1186 {
1187 dump_gimple_fmt (buffer, spc, flags, "%G <nowait=%d>", gs,
1188 (int) gimple_omp_return_nowait_p (gs));
1189 }
1190 else
1191 {
1192 pp_string (buffer, "#pragma omp return");
1193 if (gimple_omp_return_nowait_p (gs))
1194 pp_string (buffer, "(nowait)");
1195 }
1196 }
1197
1198 /* Dump a GIMPLE_ASM tuple on the pretty_printer BUFFER, SPC spaces of
1199 indent. FLAGS specifies details to show in the dump (see TDF_* in
1200 tree-pass.h). */
1201
1202 static void
1203 dump_gimple_asm (pretty_printer *buffer, gimple gs, int spc, int flags)
1204 {
1205 unsigned int i, n, f, fields;
1206
1207 if (flags & TDF_RAW)
1208 {
1209 dump_gimple_fmt (buffer, spc, flags, "%G <%+STRING <%n%s%n>", gs,
1210 gimple_asm_string (gs));
1211
1212 n = gimple_asm_noutputs (gs);
1213 if (n)
1214 {
1215 newline_and_indent (buffer, spc + 2);
1216 pp_string (buffer, "OUTPUT: ");
1217 for (i = 0; i < n; i++)
1218 {
1219 dump_generic_node (buffer, gimple_asm_output_op (gs, i),
1220 spc, flags, false);
1221 if (i < n - 1)
1222 pp_string (buffer, ", ");
1223 }
1224 }
1225
1226 n = gimple_asm_ninputs (gs);
1227 if (n)
1228 {
1229 newline_and_indent (buffer, spc + 2);
1230 pp_string (buffer, "INPUT: ");
1231 for (i = 0; i < n; i++)
1232 {
1233 dump_generic_node (buffer, gimple_asm_input_op (gs, i),
1234 spc, flags, false);
1235 if (i < n - 1)
1236 pp_string (buffer, ", ");
1237 }
1238 }
1239
1240 n = gimple_asm_nclobbers (gs);
1241 if (n)
1242 {
1243 newline_and_indent (buffer, spc + 2);
1244 pp_string (buffer, "CLOBBER: ");
1245 for (i = 0; i < n; i++)
1246 {
1247 dump_generic_node (buffer, gimple_asm_clobber_op (gs, i),
1248 spc, flags, false);
1249 if (i < n - 1)
1250 pp_string (buffer, ", ");
1251 }
1252 }
1253
1254 n = gimple_asm_nlabels (gs);
1255 if (n)
1256 {
1257 newline_and_indent (buffer, spc + 2);
1258 pp_string (buffer, "LABEL: ");
1259 for (i = 0; i < n; i++)
1260 {
1261 dump_generic_node (buffer, gimple_asm_label_op (gs, i),
1262 spc, flags, false);
1263 if (i < n - 1)
1264 pp_string (buffer, ", ");
1265 }
1266 }
1267
1268 newline_and_indent (buffer, spc);
1269 pp_character (buffer, '>');
1270 }
1271 else
1272 {
1273 pp_string (buffer, "__asm__");
1274 if (gimple_asm_volatile_p (gs))
1275 pp_string (buffer, " __volatile__");
1276 if (gimple_asm_nlabels (gs))
1277 pp_string (buffer, " goto");
1278 pp_string (buffer, "(\"");
1279 pp_string (buffer, gimple_asm_string (gs));
1280 pp_string (buffer, "\"");
1281
1282 if (gimple_asm_nlabels (gs))
1283 fields = 4;
1284 else if (gimple_asm_nclobbers (gs))
1285 fields = 3;
1286 else if (gimple_asm_ninputs (gs))
1287 fields = 2;
1288 else if (gimple_asm_noutputs (gs))
1289 fields = 1;
1290 else
1291 fields = 0;
1292
1293 for (f = 0; f < fields; ++f)
1294 {
1295 pp_string (buffer, " : ");
1296
1297 switch (f)
1298 {
1299 case 0:
1300 n = gimple_asm_noutputs (gs);
1301 for (i = 0; i < n; i++)
1302 {
1303 dump_generic_node (buffer, gimple_asm_output_op (gs, i),
1304 spc, flags, false);
1305 if (i < n - 1)
1306 pp_string (buffer, ", ");
1307 }
1308 break;
1309
1310 case 1:
1311 n = gimple_asm_ninputs (gs);
1312 for (i = 0; i < n; i++)
1313 {
1314 dump_generic_node (buffer, gimple_asm_input_op (gs, i),
1315 spc, flags, false);
1316 if (i < n - 1)
1317 pp_string (buffer, ", ");
1318 }
1319 break;
1320
1321 case 2:
1322 n = gimple_asm_nclobbers (gs);
1323 for (i = 0; i < n; i++)
1324 {
1325 dump_generic_node (buffer, gimple_asm_clobber_op (gs, i),
1326 spc, flags, false);
1327 if (i < n - 1)
1328 pp_string (buffer, ", ");
1329 }
1330 break;
1331
1332 case 3:
1333 n = gimple_asm_nlabels (gs);
1334 for (i = 0; i < n; i++)
1335 {
1336 dump_generic_node (buffer, gimple_asm_label_op (gs, i),
1337 spc, flags, false);
1338 if (i < n - 1)
1339 pp_string (buffer, ", ");
1340 }
1341 break;
1342
1343 default:
1344 gcc_unreachable ();
1345 }
1346 }
1347
1348 pp_string (buffer, ");");
1349 }
1350 }
1351
1352
1353 /* Dump a PHI node PHI. BUFFER, SPC and FLAGS are as in
1354 dump_gimple_stmt. */
1355
1356 static void
1357 dump_gimple_phi (pretty_printer *buffer, gimple phi, int spc, int flags)
1358 {
1359 size_t i;
1360 tree lhs = gimple_phi_result (phi);
1361
1362 if (flags & TDF_ALIAS
1363 && POINTER_TYPE_P (TREE_TYPE (lhs))
1364 && SSA_NAME_PTR_INFO (lhs))
1365 {
1366 struct ptr_info_def *pi = SSA_NAME_PTR_INFO (lhs);
1367 pp_string (buffer, "PT = ");
1368 pp_points_to_solution (buffer, &pi->pt);
1369 newline_and_indent (buffer, spc);
1370 if (pi->align != 1)
1371 pp_printf (buffer, "# ALIGN = %u, MISALIGN = %u",
1372 pi->align, pi->misalign);
1373 newline_and_indent (buffer, spc);
1374 pp_string (buffer, "# ");
1375 }
1376
1377 if (flags & TDF_RAW)
1378 dump_gimple_fmt (buffer, spc, flags, "%G <%T, ", phi,
1379 gimple_phi_result (phi));
1380 else
1381 {
1382 dump_generic_node (buffer, lhs, spc, flags, false);
1383 pp_string (buffer, " = PHI <");
1384 }
1385 for (i = 0; i < gimple_phi_num_args (phi); i++)
1386 {
1387 if ((flags & TDF_LINENO) && gimple_phi_arg_has_location (phi, i))
1388 {
1389 expanded_location xloc;
1390
1391 xloc = expand_location (gimple_phi_arg_location (phi, i));
1392 pp_character (buffer, '[');
1393 if (xloc.file)
1394 {
1395 pp_string (buffer, xloc.file);
1396 pp_string (buffer, " : ");
1397 }
1398 pp_decimal_int (buffer, xloc.line);
1399 pp_string (buffer, ":");
1400 pp_decimal_int (buffer, xloc.column);
1401 pp_string (buffer, "] ");
1402 }
1403 dump_generic_node (buffer, gimple_phi_arg_def (phi, i), spc, flags,
1404 false);
1405 pp_character (buffer, '(');
1406 pp_decimal_int (buffer, gimple_phi_arg_edge (phi, i)->src->index);
1407 pp_character (buffer, ')');
1408 if (i < gimple_phi_num_args (phi) - 1)
1409 pp_string (buffer, ", ");
1410 }
1411 pp_character (buffer, '>');
1412 }
1413
1414
1415 /* Dump a GIMPLE_OMP_PARALLEL tuple on the pretty_printer BUFFER, SPC spaces
1416 of indent. FLAGS specifies details to show in the dump (see TDF_* in
1417 tree-pass.h). */
1418
1419 static void
1420 dump_gimple_omp_parallel (pretty_printer *buffer, gimple gs, int spc,
1421 int flags)
1422 {
1423 if (flags & TDF_RAW)
1424 {
1425 dump_gimple_fmt (buffer, spc, flags, "%G <%+BODY <%S>%nCLAUSES <", gs,
1426 gimple_omp_body (gs));
1427 dump_omp_clauses (buffer, gimple_omp_parallel_clauses (gs), spc, flags);
1428 dump_gimple_fmt (buffer, spc, flags, " >, %T, %T%n>",
1429 gimple_omp_parallel_child_fn (gs),
1430 gimple_omp_parallel_data_arg (gs));
1431 }
1432 else
1433 {
1434 gimple_seq body;
1435 pp_string (buffer, "#pragma omp parallel");
1436 dump_omp_clauses (buffer, gimple_omp_parallel_clauses (gs), spc, flags);
1437 if (gimple_omp_parallel_child_fn (gs))
1438 {
1439 pp_string (buffer, " [child fn: ");
1440 dump_generic_node (buffer, gimple_omp_parallel_child_fn (gs),
1441 spc, flags, false);
1442 pp_string (buffer, " (");
1443 if (gimple_omp_parallel_data_arg (gs))
1444 dump_generic_node (buffer, gimple_omp_parallel_data_arg (gs),
1445 spc, flags, false);
1446 else
1447 pp_string (buffer, "???");
1448 pp_string (buffer, ")]");
1449 }
1450 body = gimple_omp_body (gs);
1451 if (body && gimple_code (gimple_seq_first_stmt (body)) != GIMPLE_BIND)
1452 {
1453 newline_and_indent (buffer, spc + 2);
1454 pp_character (buffer, '{');
1455 pp_newline (buffer);
1456 dump_gimple_seq (buffer, body, spc + 4, flags);
1457 newline_and_indent (buffer, spc + 2);
1458 pp_character (buffer, '}');
1459 }
1460 else if (body)
1461 {
1462 pp_newline (buffer);
1463 dump_gimple_seq (buffer, body, spc + 2, flags);
1464 }
1465 }
1466 }
1467
1468
1469 /* Dump a GIMPLE_OMP_TASK tuple on the pretty_printer BUFFER, SPC spaces
1470 of indent. FLAGS specifies details to show in the dump (see TDF_* in
1471 tree-pass.h). */
1472
1473 static void
1474 dump_gimple_omp_task (pretty_printer *buffer, gimple gs, int spc,
1475 int flags)
1476 {
1477 if (flags & TDF_RAW)
1478 {
1479 dump_gimple_fmt (buffer, spc, flags, "%G <%+BODY <%S>%nCLAUSES <", gs,
1480 gimple_omp_body (gs));
1481 dump_omp_clauses (buffer, gimple_omp_task_clauses (gs), spc, flags);
1482 dump_gimple_fmt (buffer, spc, flags, " >, %T, %T, %T, %T, %T%n>",
1483 gimple_omp_task_child_fn (gs),
1484 gimple_omp_task_data_arg (gs),
1485 gimple_omp_task_copy_fn (gs),
1486 gimple_omp_task_arg_size (gs),
1487 gimple_omp_task_arg_size (gs));
1488 }
1489 else
1490 {
1491 gimple_seq body;
1492 pp_string (buffer, "#pragma omp task");
1493 dump_omp_clauses (buffer, gimple_omp_task_clauses (gs), spc, flags);
1494 if (gimple_omp_task_child_fn (gs))
1495 {
1496 pp_string (buffer, " [child fn: ");
1497 dump_generic_node (buffer, gimple_omp_task_child_fn (gs),
1498 spc, flags, false);
1499 pp_string (buffer, " (");
1500 if (gimple_omp_task_data_arg (gs))
1501 dump_generic_node (buffer, gimple_omp_task_data_arg (gs),
1502 spc, flags, false);
1503 else
1504 pp_string (buffer, "???");
1505 pp_string (buffer, ")]");
1506 }
1507 body = gimple_omp_body (gs);
1508 if (body && gimple_code (gimple_seq_first_stmt (body)) != GIMPLE_BIND)
1509 {
1510 newline_and_indent (buffer, spc + 2);
1511 pp_character (buffer, '{');
1512 pp_newline (buffer);
1513 dump_gimple_seq (buffer, body, spc + 4, flags);
1514 newline_and_indent (buffer, spc + 2);
1515 pp_character (buffer, '}');
1516 }
1517 else if (body)
1518 {
1519 pp_newline (buffer);
1520 dump_gimple_seq (buffer, body, spc + 2, flags);
1521 }
1522 }
1523 }
1524
1525
1526 /* Dump a GIMPLE_OMP_ATOMIC_LOAD tuple on the pretty_printer BUFFER, SPC
1527 spaces of indent. FLAGS specifies details to show in the dump (see TDF_*
1528 in tree-pass.h). */
1529
1530 static void
1531 dump_gimple_omp_atomic_load (pretty_printer *buffer, gimple gs, int spc,
1532 int flags)
1533 {
1534 if (flags & TDF_RAW)
1535 {
1536 dump_gimple_fmt (buffer, spc, flags, "%G <%T, %T>", gs,
1537 gimple_omp_atomic_load_lhs (gs),
1538 gimple_omp_atomic_load_rhs (gs));
1539 }
1540 else
1541 {
1542 pp_string (buffer, "#pragma omp atomic_load");
1543 newline_and_indent (buffer, spc + 2);
1544 dump_generic_node (buffer, gimple_omp_atomic_load_lhs (gs),
1545 spc, flags, false);
1546 pp_space (buffer);
1547 pp_character (buffer, '=');
1548 pp_space (buffer);
1549 pp_character (buffer, '*');
1550 dump_generic_node (buffer, gimple_omp_atomic_load_rhs (gs),
1551 spc, flags, false);
1552 }
1553 }
1554
1555 /* Dump a GIMPLE_OMP_ATOMIC_STORE tuple on the pretty_printer BUFFER, SPC
1556 spaces of indent. FLAGS specifies details to show in the dump (see TDF_*
1557 in tree-pass.h). */
1558
1559 static void
1560 dump_gimple_omp_atomic_store (pretty_printer *buffer, gimple gs, int spc,
1561 int flags)
1562 {
1563 if (flags & TDF_RAW)
1564 {
1565 dump_gimple_fmt (buffer, spc, flags, "%G <%T>", gs,
1566 gimple_omp_atomic_store_val (gs));
1567 }
1568 else
1569 {
1570 pp_string (buffer, "#pragma omp atomic_store (");
1571 dump_generic_node (buffer, gimple_omp_atomic_store_val (gs),
1572 spc, flags, false);
1573 pp_character (buffer, ')');
1574 }
1575 }
1576
1577
1578 /* Dump all the memory operands for statement GS. BUFFER, SPC and
1579 FLAGS are as in dump_gimple_stmt. */
1580
1581 static void
1582 dump_gimple_mem_ops (pretty_printer *buffer, gimple gs, int spc, int flags)
1583 {
1584 tree vdef = gimple_vdef (gs);
1585 tree vuse = gimple_vuse (gs);
1586
1587 if (!ssa_operands_active () || !gimple_references_memory_p (gs))
1588 return;
1589
1590 if (vdef != NULL_TREE)
1591 {
1592 pp_string (buffer, "# ");
1593 dump_generic_node (buffer, vdef, spc + 2, flags, false);
1594 pp_string (buffer, " = VDEF <");
1595 dump_generic_node (buffer, vuse, spc + 2, flags, false);
1596 pp_character (buffer, '>');
1597 newline_and_indent (buffer, spc);
1598 }
1599 else if (vuse != NULL_TREE)
1600 {
1601 pp_string (buffer, "# VUSE <");
1602 dump_generic_node (buffer, vuse, spc + 2, flags, false);
1603 pp_character (buffer, '>');
1604 newline_and_indent (buffer, spc);
1605 }
1606 }
1607
1608
1609 /* Dump the gimple statement GS on the pretty printer BUFFER, SPC
1610 spaces of indent. FLAGS specifies details to show in the dump (see
1611 TDF_* in tree-pass.h). */
1612
1613 void
1614 dump_gimple_stmt (pretty_printer *buffer, gimple gs, int spc, int flags)
1615 {
1616 if (!gs)
1617 return;
1618
1619 if (flags & TDF_STMTADDR)
1620 pp_printf (buffer, "<&%p> ", (void *) gs);
1621
1622 if ((flags & TDF_LINENO) && gimple_has_location (gs))
1623 {
1624 expanded_location xloc = expand_location (gimple_location (gs));
1625 pp_character (buffer, '[');
1626 if (xloc.file)
1627 {
1628 pp_string (buffer, xloc.file);
1629 pp_string (buffer, " : ");
1630 }
1631 pp_decimal_int (buffer, xloc.line);
1632 pp_string (buffer, ":");
1633 pp_decimal_int (buffer, xloc.column);
1634 pp_string (buffer, "] ");
1635 }
1636
1637 if (flags & TDF_EH)
1638 {
1639 int lp_nr = lookup_stmt_eh_lp (gs);
1640 if (lp_nr > 0)
1641 pp_printf (buffer, "[LP %d] ", lp_nr);
1642 else if (lp_nr < 0)
1643 pp_printf (buffer, "[MNT %d] ", -lp_nr);
1644 }
1645
1646 if ((flags & (TDF_VOPS|TDF_MEMSYMS))
1647 && gimple_has_mem_ops (gs))
1648 dump_gimple_mem_ops (buffer, gs, spc, flags);
1649
1650 if ((flags & TDF_ALIAS)
1651 && gimple_has_lhs (gs))
1652 {
1653 tree lhs = gimple_get_lhs (gs);
1654 if (TREE_CODE (lhs) == SSA_NAME
1655 && POINTER_TYPE_P (TREE_TYPE (lhs))
1656 && SSA_NAME_PTR_INFO (lhs))
1657 {
1658 struct ptr_info_def *pi = SSA_NAME_PTR_INFO (lhs);
1659 pp_string (buffer, "# PT = ");
1660 pp_points_to_solution (buffer, &pi->pt);
1661 newline_and_indent (buffer, spc);
1662 if (pi->align != 1)
1663 {
1664 pp_printf (buffer, "# ALIGN = %u, MISALIGN = %u",
1665 pi->align, pi->misalign);
1666 newline_and_indent (buffer, spc);
1667 }
1668 }
1669 }
1670
1671 switch (gimple_code (gs))
1672 {
1673 case GIMPLE_ASM:
1674 dump_gimple_asm (buffer, gs, spc, flags);
1675 break;
1676
1677 case GIMPLE_ASSIGN:
1678 dump_gimple_assign (buffer, gs, spc, flags);
1679 break;
1680
1681 case GIMPLE_BIND:
1682 dump_gimple_bind (buffer, gs, spc, flags);
1683 break;
1684
1685 case GIMPLE_CALL:
1686 dump_gimple_call (buffer, gs, spc, flags);
1687 break;
1688
1689 case GIMPLE_COND:
1690 dump_gimple_cond (buffer, gs, spc, flags);
1691 break;
1692
1693 case GIMPLE_LABEL:
1694 dump_gimple_label (buffer, gs, spc, flags);
1695 break;
1696
1697 case GIMPLE_GOTO:
1698 dump_gimple_goto (buffer, gs, spc, flags);
1699 break;
1700
1701 case GIMPLE_NOP:
1702 pp_string (buffer, "GIMPLE_NOP");
1703 break;
1704
1705 case GIMPLE_RETURN:
1706 dump_gimple_return (buffer, gs, spc, flags);
1707 break;
1708
1709 case GIMPLE_SWITCH:
1710 dump_gimple_switch (buffer, gs, spc, flags);
1711 break;
1712
1713 case GIMPLE_TRY:
1714 dump_gimple_try (buffer, gs, spc, flags);
1715 break;
1716
1717 case GIMPLE_PHI:
1718 dump_gimple_phi (buffer, gs, spc, flags);
1719 break;
1720
1721 case GIMPLE_OMP_PARALLEL:
1722 dump_gimple_omp_parallel (buffer, gs, spc, flags);
1723 break;
1724
1725 case GIMPLE_OMP_TASK:
1726 dump_gimple_omp_task (buffer, gs, spc, flags);
1727 break;
1728
1729 case GIMPLE_OMP_ATOMIC_LOAD:
1730 dump_gimple_omp_atomic_load (buffer, gs, spc, flags);
1731
1732 break;
1733
1734 case GIMPLE_OMP_ATOMIC_STORE:
1735 dump_gimple_omp_atomic_store (buffer, gs, spc, flags);
1736 break;
1737
1738 case GIMPLE_OMP_FOR:
1739 dump_gimple_omp_for (buffer, gs, spc, flags);
1740 break;
1741
1742 case GIMPLE_OMP_CONTINUE:
1743 dump_gimple_omp_continue (buffer, gs, spc, flags);
1744 break;
1745
1746 case GIMPLE_OMP_SINGLE:
1747 dump_gimple_omp_single (buffer, gs, spc, flags);
1748 break;
1749
1750 case GIMPLE_OMP_RETURN:
1751 dump_gimple_omp_return (buffer, gs, spc, flags);
1752 break;
1753
1754 case GIMPLE_OMP_SECTIONS:
1755 dump_gimple_omp_sections (buffer, gs, spc, flags);
1756 break;
1757
1758 case GIMPLE_OMP_SECTIONS_SWITCH:
1759 pp_string (buffer, "GIMPLE_SECTIONS_SWITCH");
1760 break;
1761
1762 case GIMPLE_OMP_MASTER:
1763 case GIMPLE_OMP_ORDERED:
1764 case GIMPLE_OMP_SECTION:
1765 dump_gimple_omp_block (buffer, gs, spc, flags);
1766 break;
1767
1768 case GIMPLE_OMP_CRITICAL:
1769 dump_gimple_omp_critical (buffer, gs, spc, flags);
1770 break;
1771
1772 case GIMPLE_CATCH:
1773 dump_gimple_catch (buffer, gs, spc, flags);
1774 break;
1775
1776 case GIMPLE_EH_FILTER:
1777 dump_gimple_eh_filter (buffer, gs, spc, flags);
1778 break;
1779
1780 case GIMPLE_EH_MUST_NOT_THROW:
1781 dump_gimple_eh_must_not_throw (buffer, gs, spc, flags);
1782 break;
1783
1784 case GIMPLE_RESX:
1785 dump_gimple_resx (buffer, gs, spc, flags);
1786 break;
1787
1788 case GIMPLE_EH_DISPATCH:
1789 dump_gimple_eh_dispatch (buffer, gs, spc, flags);
1790 break;
1791
1792 case GIMPLE_DEBUG:
1793 dump_gimple_debug (buffer, gs, spc, flags);
1794 break;
1795
1796 case GIMPLE_PREDICT:
1797 pp_string (buffer, "// predicted ");
1798 if (gimple_predict_outcome (gs))
1799 pp_string (buffer, "likely by ");
1800 else
1801 pp_string (buffer, "unlikely by ");
1802 pp_string (buffer, predictor_name (gimple_predict_predictor (gs)));
1803 pp_string (buffer, " predictor.");
1804 break;
1805
1806 default:
1807 GIMPLE_NIY;
1808 }
1809
1810 /* If we're building a diagnostic, the formatted text will be
1811 written into BUFFER's stream by the caller; otherwise, write it
1812 now. */
1813 if (!(flags & TDF_DIAGNOSTIC))
1814 pp_write_text_to_stream (buffer);
1815 }
1816
1817
1818 /* Dumps header of basic block BB to buffer BUFFER indented by INDENT
1819 spaces and details described by flags. */
1820
1821 static void
1822 dump_bb_header (pretty_printer *buffer, basic_block bb, int indent, int flags)
1823 {
1824 edge e;
1825 gimple stmt;
1826 edge_iterator ei;
1827
1828 if (flags & TDF_BLOCKS)
1829 {
1830 INDENT (indent);
1831 pp_string (buffer, "# BLOCK ");
1832 pp_decimal_int (buffer, bb->index);
1833 if (bb->frequency)
1834 {
1835 pp_string (buffer, " freq:");
1836 pp_decimal_int (buffer, bb->frequency);
1837 }
1838 if (bb->count)
1839 {
1840 pp_string (buffer, " count:");
1841 pp_widest_integer (buffer, bb->count);
1842 }
1843
1844 if (flags & TDF_LINENO)
1845 {
1846 gimple_stmt_iterator gsi;
1847
1848 for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
1849 if (!is_gimple_debug (gsi_stmt (gsi))
1850 && get_lineno (gsi_stmt (gsi)) != UNKNOWN_LOCATION)
1851 {
1852 pp_string (buffer, ", starting at line ");
1853 pp_decimal_int (buffer, get_lineno (gsi_stmt (gsi)));
1854 break;
1855 }
1856
1857 if (bb->discriminator)
1858 {
1859 pp_string (buffer, ", discriminator ");
1860 pp_decimal_int (buffer, bb->discriminator);
1861 }
1862 }
1863 newline_and_indent (buffer, indent);
1864
1865 pp_string (buffer, "# PRED:");
1866 pp_write_text_to_stream (buffer);
1867 FOR_EACH_EDGE (e, ei, bb->preds)
1868 if (flags & TDF_SLIM)
1869 {
1870 pp_character (buffer, ' ');
1871 if (e->src == ENTRY_BLOCK_PTR)
1872 pp_string (buffer, "ENTRY");
1873 else
1874 pp_decimal_int (buffer, e->src->index);
1875 }
1876 else
1877 dump_edge_info (buffer->buffer->stream, e, 0);
1878 pp_newline (buffer);
1879 }
1880 else
1881 {
1882 stmt = first_stmt (bb);
1883 if (!stmt || gimple_code (stmt) != GIMPLE_LABEL)
1884 {
1885 INDENT (indent - 2);
1886 pp_string (buffer, "<bb ");
1887 pp_decimal_int (buffer, bb->index);
1888 pp_string (buffer, ">:");
1889 pp_newline (buffer);
1890 }
1891 }
1892 pp_write_text_to_stream (buffer);
1893 check_bb_profile (bb, buffer->buffer->stream);
1894 }
1895
1896
1897 /* Dumps end of basic block BB to buffer BUFFER indented by INDENT
1898 spaces. */
1899
1900 static void
1901 dump_bb_end (pretty_printer *buffer, basic_block bb, int indent, int flags)
1902 {
1903 edge e;
1904 edge_iterator ei;
1905
1906 INDENT (indent);
1907 pp_string (buffer, "# SUCC:");
1908 pp_write_text_to_stream (buffer);
1909 FOR_EACH_EDGE (e, ei, bb->succs)
1910 if (flags & TDF_SLIM)
1911 {
1912 pp_character (buffer, ' ');
1913 if (e->dest == EXIT_BLOCK_PTR)
1914 pp_string (buffer, "EXIT");
1915 else
1916 pp_decimal_int (buffer, e->dest->index);
1917 }
1918 else
1919 dump_edge_info (buffer->buffer->stream, e, 1);
1920 pp_newline (buffer);
1921 }
1922
1923
1924 /* Dump PHI nodes of basic block BB to BUFFER with details described
1925 by FLAGS and indented by INDENT spaces. */
1926
1927 static void
1928 dump_phi_nodes (pretty_printer *buffer, basic_block bb, int indent, int flags)
1929 {
1930 gimple_stmt_iterator i;
1931
1932 for (i = gsi_start_phis (bb); !gsi_end_p (i); gsi_next (&i))
1933 {
1934 gimple phi = gsi_stmt (i);
1935 if (is_gimple_reg (gimple_phi_result (phi)) || (flags & TDF_VOPS))
1936 {
1937 INDENT (indent);
1938 pp_string (buffer, "# ");
1939 dump_gimple_phi (buffer, phi, indent, flags);
1940 pp_newline (buffer);
1941 }
1942 }
1943 }
1944
1945
1946 /* Dump jump to basic block BB that is represented implicitly in the cfg
1947 to BUFFER. */
1948
1949 static void
1950 pp_cfg_jump (pretty_printer *buffer, basic_block bb)
1951 {
1952 gimple stmt;
1953
1954 stmt = first_stmt (bb);
1955
1956 pp_string (buffer, "goto <bb ");
1957 pp_decimal_int (buffer, bb->index);
1958 pp_character (buffer, '>');
1959 if (stmt && gimple_code (stmt) == GIMPLE_LABEL)
1960 {
1961 pp_string (buffer, " (");
1962 dump_generic_node (buffer, gimple_label_label (stmt), 0, 0, false);
1963 pp_character (buffer, ')');
1964 pp_semicolon (buffer);
1965 }
1966 else
1967 pp_semicolon (buffer);
1968 }
1969
1970
1971 /* Dump edges represented implicitly in basic block BB to BUFFER, indented
1972 by INDENT spaces, with details given by FLAGS. */
1973
1974 static void
1975 dump_implicit_edges (pretty_printer *buffer, basic_block bb, int indent,
1976 int flags)
1977 {
1978 edge e;
1979 edge_iterator ei;
1980 gimple stmt;
1981
1982 stmt = last_stmt (bb);
1983
1984 if (stmt && gimple_code (stmt) == GIMPLE_COND)
1985 {
1986 edge true_edge, false_edge;
1987
1988 /* When we are emitting the code or changing CFG, it is possible that
1989 the edges are not yet created. When we are using debug_bb in such
1990 a situation, we do not want it to crash. */
1991 if (EDGE_COUNT (bb->succs) != 2)
1992 return;
1993 extract_true_false_edges_from_block (bb, &true_edge, &false_edge);
1994
1995 INDENT (indent + 2);
1996 pp_cfg_jump (buffer, true_edge->dest);
1997 newline_and_indent (buffer, indent);
1998 pp_string (buffer, "else");
1999 newline_and_indent (buffer, indent + 2);
2000 pp_cfg_jump (buffer, false_edge->dest);
2001 pp_newline (buffer);
2002 return;
2003 }
2004
2005 /* If there is a fallthru edge, we may need to add an artificial
2006 goto to the dump. */
2007 FOR_EACH_EDGE (e, ei, bb->succs)
2008 if (e->flags & EDGE_FALLTHRU)
2009 break;
2010
2011 if (e && e->dest != bb->next_bb)
2012 {
2013 INDENT (indent);
2014
2015 if ((flags & TDF_LINENO)
2016 && e->goto_locus != UNKNOWN_LOCATION
2017 )
2018 {
2019 expanded_location goto_xloc;
2020 goto_xloc = expand_location (e->goto_locus);
2021 pp_character (buffer, '[');
2022 if (goto_xloc.file)
2023 {
2024 pp_string (buffer, goto_xloc.file);
2025 pp_string (buffer, " : ");
2026 }
2027 pp_decimal_int (buffer, goto_xloc.line);
2028 pp_string (buffer, " : ");
2029 pp_decimal_int (buffer, goto_xloc.column);
2030 pp_string (buffer, "] ");
2031 }
2032
2033 pp_cfg_jump (buffer, e->dest);
2034 pp_newline (buffer);
2035 }
2036 }
2037
2038
2039 /* Dumps basic block BB to buffer BUFFER with details described by FLAGS and
2040 indented by INDENT spaces. */
2041
2042 static void
2043 gimple_dump_bb_buff (pretty_printer *buffer, basic_block bb, int indent,
2044 int flags)
2045 {
2046 gimple_stmt_iterator gsi;
2047 gimple stmt;
2048 int label_indent = indent - 2;
2049
2050 if (label_indent < 0)
2051 label_indent = 0;
2052
2053 dump_bb_header (buffer, bb, indent, flags);
2054 dump_phi_nodes (buffer, bb, indent, flags);
2055
2056 for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
2057 {
2058 int curr_indent;
2059
2060 stmt = gsi_stmt (gsi);
2061
2062 curr_indent = gimple_code (stmt) == GIMPLE_LABEL ? label_indent : indent;
2063
2064 INDENT (curr_indent);
2065 dump_gimple_stmt (buffer, stmt, curr_indent, flags);
2066 pp_newline (buffer);
2067 dump_histograms_for_stmt (cfun, buffer->buffer->stream, stmt);
2068 }
2069
2070 dump_implicit_edges (buffer, bb, indent, flags);
2071
2072 if (flags & TDF_BLOCKS)
2073 dump_bb_end (buffer, bb, indent, flags);
2074 }
2075
2076
2077 /* Dumps basic block BB to FILE with details described by FLAGS and
2078 indented by INDENT spaces. */
2079
2080 void
2081 gimple_dump_bb (basic_block bb, FILE *file, int indent, int flags)
2082 {
2083 maybe_init_pretty_print (file);
2084 gimple_dump_bb_buff (&buffer, bb, indent, flags);
2085 pp_flush (&buffer);
2086 }