OSDN Git Service

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