1/* Pretty formatting of GIMPLE statements and expressions.
2   Copyright (C) 2001-2015 Free Software Foundation, Inc.
3   Contributed by Aldy Hernandez <aldyh@redhat.com> and
4   Diego Novillo <dnovillo@google.com>
5
6This file is part of GCC.
7
8GCC is free software; you can redistribute it and/or modify it under
9the terms of the GNU General Public License as published by the Free
10Software Foundation; either version 3, or (at your option) any later
11version.
12
13GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14WARRANTY; without even the implied warranty of MERCHANTABILITY or
15FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
16for more details.
17
18You should have received a copy of the GNU General Public License
19along with GCC; see the file COPYING3.  If not see
20<http://www.gnu.org/licenses/>.  */
21
22#include "config.h"
23#include "system.h"
24#include "coretypes.h"
25#include "tm.h"
26#include "hash-set.h"
27#include "machmode.h"
28#include "vec.h"
29#include "double-int.h"
30#include "input.h"
31#include "alias.h"
32#include "symtab.h"
33#include "wide-int.h"
34#include "inchash.h"
35#include "tree.h"
36#include "fold-const.h"
37#include "stringpool.h"
38#include "diagnostic.h"
39#include "gimple-pretty-print.h"
40#include "bitmap.h"
41#include "predict.h"
42#include "hard-reg-set.h"
43#include "input.h"
44#include "function.h"
45#include "basic-block.h"
46#include "tree-ssa-alias.h"
47#include "internal-fn.h"
48#include "tree-eh.h"
49#include "gimple-expr.h"
50#include "is-a.h"
51#include "gimple.h"
52#include "gimple-iterator.h"
53#include "gimple-ssa.h"
54#include "hash-map.h"
55#include "plugin-api.h"
56#include "ipa-ref.h"
57#include "cgraph.h"
58#include "tree-cfg.h"
59#include "tree-ssanames.h"
60#include "dumpfile.h"	/* for dump_flags */
61#include "value-prof.h"
62#include "trans-mem.h"
63
64#define INDENT(SPACE)							\
65  do { int i; for (i = 0; i < SPACE; i++) pp_space (buffer); } while (0)
66
67#define GIMPLE_NIY do_niy (buffer,gs)
68
69/* Try to print on BUFFER a default message for the unrecognized
70   gimple statement GS.  */
71
72static void
73do_niy (pretty_printer *buffer, gimple gs)
74{
75  pp_printf (buffer, "<<< Unknown GIMPLE statement: %s >>>\n",
76	     gimple_code_name[(int) gimple_code (gs)]);
77}
78
79
80/* Emit a newline and SPC indentation spaces to BUFFER.  */
81
82static void
83newline_and_indent (pretty_printer *buffer, int spc)
84{
85  pp_newline (buffer);
86  INDENT (spc);
87}
88
89
90/* Print the GIMPLE statement GS on stderr.  */
91
92DEBUG_FUNCTION void
93debug_gimple_stmt (gimple gs)
94{
95  print_gimple_stmt (stderr, gs, 0, TDF_VOPS|TDF_MEMSYMS);
96}
97
98
99/* Print GIMPLE statement G to FILE using SPC indentation spaces and
100   FLAGS as in pp_gimple_stmt_1.  */
101
102void
103print_gimple_stmt (FILE *file, gimple g, int spc, int flags)
104{
105  pretty_printer buffer;
106  pp_needs_newline (&buffer) = true;
107  buffer.buffer->stream = file;
108  pp_gimple_stmt_1 (&buffer, g, spc, flags);
109  pp_newline_and_flush (&buffer);
110}
111
112DEBUG_FUNCTION void
113debug (gimple_statement_base &ref)
114{
115  print_gimple_stmt (stderr, &ref, 0, 0);
116}
117
118DEBUG_FUNCTION void
119debug (gimple_statement_base *ptr)
120{
121  if (ptr)
122    debug (*ptr);
123  else
124    fprintf (stderr, "<nil>\n");
125}
126
127
128/* Print GIMPLE statement G to FILE using SPC indentation spaces and
129   FLAGS as in pp_gimple_stmt_1.  Print only the right-hand side
130   of the statement.  */
131
132void
133print_gimple_expr (FILE *file, gimple g, int spc, int flags)
134{
135  flags |= TDF_RHS_ONLY;
136  pretty_printer buffer;
137  pp_needs_newline (&buffer) = true;
138  buffer.buffer->stream = file;
139  pp_gimple_stmt_1 (&buffer, g, spc, flags);
140  pp_flush (&buffer);
141}
142
143
144/* Print the GIMPLE sequence SEQ on BUFFER using SPC indentation
145   spaces and FLAGS as in pp_gimple_stmt_1.
146   The caller is responsible for calling pp_flush on BUFFER to finalize
147   the pretty printer.  */
148
149static void
150dump_gimple_seq (pretty_printer *buffer, gimple_seq seq, int spc, int flags)
151{
152  gimple_stmt_iterator i;
153
154  for (i = gsi_start (seq); !gsi_end_p (i); gsi_next (&i))
155    {
156      gimple gs = gsi_stmt (i);
157      INDENT (spc);
158      pp_gimple_stmt_1 (buffer, gs, spc, flags);
159      if (!gsi_one_before_end_p (i))
160	pp_newline (buffer);
161    }
162}
163
164
165/* Print GIMPLE sequence SEQ to FILE using SPC indentation spaces and
166   FLAGS as in pp_gimple_stmt_1.  */
167
168void
169print_gimple_seq (FILE *file, gimple_seq seq, int spc, int flags)
170{
171  pretty_printer buffer;
172  pp_needs_newline (&buffer) = true;
173  buffer.buffer->stream = file;
174  dump_gimple_seq (&buffer, seq, spc, flags);
175  pp_newline_and_flush (&buffer);
176}
177
178
179/* Print the GIMPLE sequence SEQ on stderr.  */
180
181DEBUG_FUNCTION void
182debug_gimple_seq (gimple_seq seq)
183{
184  print_gimple_seq (stderr, seq, 0, TDF_VOPS|TDF_MEMSYMS);
185}
186
187
188/* A simple helper to pretty-print some of the gimple tuples in the printf
189   style. The format modifiers are preceded by '%' and are:
190     'G' - outputs a string corresponding to the code of the given gimple,
191     'S' - outputs a gimple_seq with indent of spc + 2,
192     'T' - outputs the tree t,
193     'd' - outputs an int as a decimal,
194     's' - outputs a string,
195     'n' - outputs a newline,
196     'x' - outputs an int as hexadecimal,
197     '+' - increases indent by 2 then outputs a newline,
198     '-' - decreases indent by 2 then outputs a newline.   */
199
200static void
201dump_gimple_fmt (pretty_printer *buffer, int spc, int flags,
202                 const char *fmt, ...)
203{
204  va_list args;
205  const char *c;
206  const char *tmp;
207
208  va_start (args, fmt);
209  for (c = fmt; *c; c++)
210    {
211      if (*c == '%')
212        {
213          gimple_seq seq;
214          tree t;
215          gimple g;
216          switch (*++c)
217            {
218              case 'G':
219                g = va_arg (args, gimple);
220                tmp = gimple_code_name[gimple_code (g)];
221                pp_string (buffer, tmp);
222                break;
223
224              case 'S':
225                seq = va_arg (args, gimple_seq);
226                pp_newline (buffer);
227                dump_gimple_seq (buffer, seq, spc + 2, flags);
228                newline_and_indent (buffer, spc);
229                break;
230
231              case 'T':
232                t = va_arg (args, tree);
233                if (t == NULL_TREE)
234                  pp_string (buffer, "NULL");
235                else
236                  dump_generic_node (buffer, t, spc, flags, false);
237                break;
238
239              case 'd':
240                pp_decimal_int (buffer, va_arg (args, int));
241                break;
242
243              case 's':
244                pp_string (buffer, va_arg (args, char *));
245                break;
246
247              case 'n':
248                newline_and_indent (buffer, spc);
249                break;
250
251	      case 'x':
252		pp_scalar (buffer, "%x", va_arg (args, int));
253		break;
254
255              case '+':
256                spc += 2;
257                newline_and_indent (buffer, spc);
258                break;
259
260              case '-':
261                spc -= 2;
262                newline_and_indent (buffer, spc);
263                break;
264
265              default:
266                gcc_unreachable ();
267            }
268        }
269      else
270        pp_character (buffer, *c);
271    }
272  va_end (args);
273}
274
275
276/* Helper for dump_gimple_assign.  Print the unary RHS of the
277   assignment GS.  BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1.  */
278
279static void
280dump_unary_rhs (pretty_printer *buffer, gassign *gs, int spc, int flags)
281{
282  enum tree_code rhs_code = gimple_assign_rhs_code (gs);
283  tree lhs = gimple_assign_lhs (gs);
284  tree rhs = gimple_assign_rhs1 (gs);
285
286  switch (rhs_code)
287    {
288    case VIEW_CONVERT_EXPR:
289    case ASSERT_EXPR:
290      dump_generic_node (buffer, rhs, spc, flags, false);
291      break;
292
293    case FIXED_CONVERT_EXPR:
294    case ADDR_SPACE_CONVERT_EXPR:
295    case FIX_TRUNC_EXPR:
296    case FLOAT_EXPR:
297    CASE_CONVERT:
298      pp_left_paren (buffer);
299      dump_generic_node (buffer, TREE_TYPE (lhs), spc, flags, false);
300      pp_string (buffer, ") ");
301      if (op_prio (rhs) < op_code_prio (rhs_code))
302	{
303	  pp_left_paren (buffer);
304	  dump_generic_node (buffer, rhs, spc, flags, false);
305	  pp_right_paren (buffer);
306	}
307      else
308	dump_generic_node (buffer, rhs, spc, flags, false);
309      break;
310
311    case PAREN_EXPR:
312      pp_string (buffer, "((");
313      dump_generic_node (buffer, rhs, spc, flags, false);
314      pp_string (buffer, "))");
315      break;
316
317    case ABS_EXPR:
318      pp_string (buffer, "ABS_EXPR <");
319      dump_generic_node (buffer, rhs, spc, flags, false);
320      pp_greater (buffer);
321      break;
322
323    default:
324      if (TREE_CODE_CLASS (rhs_code) == tcc_declaration
325	  || TREE_CODE_CLASS (rhs_code) == tcc_constant
326	  || TREE_CODE_CLASS (rhs_code) == tcc_reference
327	  || rhs_code == SSA_NAME
328	  || rhs_code == ADDR_EXPR
329	  || rhs_code == CONSTRUCTOR)
330	{
331	  dump_generic_node (buffer, rhs, spc, flags, false);
332	  break;
333	}
334      else if (rhs_code == BIT_NOT_EXPR)
335	pp_complement (buffer);
336      else if (rhs_code == TRUTH_NOT_EXPR)
337	pp_exclamation (buffer);
338      else if (rhs_code == NEGATE_EXPR)
339	pp_minus (buffer);
340      else
341	{
342	  pp_left_bracket (buffer);
343	  pp_string (buffer, get_tree_code_name (rhs_code));
344	  pp_string (buffer, "] ");
345	}
346
347      if (op_prio (rhs) < op_code_prio (rhs_code))
348	{
349	  pp_left_paren (buffer);
350	  dump_generic_node (buffer, rhs, spc, flags, false);
351	  pp_right_paren (buffer);
352	}
353      else
354	dump_generic_node (buffer, rhs, spc, flags, false);
355      break;
356    }
357}
358
359
360/* Helper for dump_gimple_assign.  Print the binary RHS of the
361   assignment GS.  BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1.  */
362
363static void
364dump_binary_rhs (pretty_printer *buffer, gassign *gs, int spc, int flags)
365{
366  const char *p;
367  enum tree_code code = gimple_assign_rhs_code (gs);
368  switch (code)
369    {
370    case COMPLEX_EXPR:
371    case MIN_EXPR:
372    case MAX_EXPR:
373    case VEC_WIDEN_MULT_HI_EXPR:
374    case VEC_WIDEN_MULT_LO_EXPR:
375    case VEC_WIDEN_MULT_EVEN_EXPR:
376    case VEC_WIDEN_MULT_ODD_EXPR:
377    case VEC_PACK_TRUNC_EXPR:
378    case VEC_PACK_SAT_EXPR:
379    case VEC_PACK_FIX_TRUNC_EXPR:
380    case VEC_WIDEN_LSHIFT_HI_EXPR:
381    case VEC_WIDEN_LSHIFT_LO_EXPR:
382      for (p = get_tree_code_name (code); *p; p++)
383	pp_character (buffer, TOUPPER (*p));
384      pp_string (buffer, " <");
385      dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags, false);
386      pp_string (buffer, ", ");
387      dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags, false);
388      pp_greater (buffer);
389      break;
390
391    default:
392      if (op_prio (gimple_assign_rhs1 (gs)) <= op_code_prio (code))
393	{
394	  pp_left_paren (buffer);
395	  dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags,
396			     false);
397	  pp_right_paren (buffer);
398	}
399      else
400	dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags, false);
401      pp_space (buffer);
402      pp_string (buffer, op_symbol_code (gimple_assign_rhs_code (gs)));
403      pp_space (buffer);
404      if (op_prio (gimple_assign_rhs2 (gs)) <= op_code_prio (code))
405	{
406	  pp_left_paren (buffer);
407	  dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags,
408			     false);
409	  pp_right_paren (buffer);
410	}
411      else
412	dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags, false);
413    }
414}
415
416/* Helper for dump_gimple_assign.  Print the ternary RHS of the
417   assignment GS.  BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1.  */
418
419static void
420dump_ternary_rhs (pretty_printer *buffer, gassign *gs, int spc, int flags)
421{
422  const char *p;
423  enum tree_code code = gimple_assign_rhs_code (gs);
424  switch (code)
425    {
426    case WIDEN_MULT_PLUS_EXPR:
427    case WIDEN_MULT_MINUS_EXPR:
428      for (p = get_tree_code_name (code); *p; p++)
429	pp_character (buffer, TOUPPER (*p));
430      pp_string (buffer, " <");
431      dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags, false);
432      pp_string (buffer, ", ");
433      dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags, false);
434      pp_string (buffer, ", ");
435      dump_generic_node (buffer, gimple_assign_rhs3 (gs), spc, flags, false);
436      pp_greater (buffer);
437      break;
438
439    case FMA_EXPR:
440      dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags, false);
441      pp_string (buffer, " * ");
442      dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags, false);
443      pp_string (buffer, " + ");
444      dump_generic_node (buffer, gimple_assign_rhs3 (gs), spc, flags, false);
445      break;
446
447    case DOT_PROD_EXPR:
448      pp_string (buffer, "DOT_PROD_EXPR <");
449      dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags, false);
450      pp_string (buffer, ", ");
451      dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags, false);
452      pp_string (buffer, ", ");
453      dump_generic_node (buffer, gimple_assign_rhs3 (gs), spc, flags, false);
454      pp_greater (buffer);
455      break;
456
457    case SAD_EXPR:
458      pp_string (buffer, "SAD_EXPR <");
459      dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags, false);
460      pp_string (buffer, ", ");
461      dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags, false);
462      pp_string (buffer, ", ");
463      dump_generic_node (buffer, gimple_assign_rhs3 (gs), spc, flags, false);
464      pp_greater (buffer);
465      break;
466
467    case VEC_PERM_EXPR:
468      pp_string (buffer, "VEC_PERM_EXPR <");
469      dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags, false);
470      pp_string (buffer, ", ");
471      dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags, false);
472      pp_string (buffer, ", ");
473      dump_generic_node (buffer, gimple_assign_rhs3 (gs), spc, flags, false);
474      pp_greater (buffer);
475      break;
476
477    case REALIGN_LOAD_EXPR:
478      pp_string (buffer, "REALIGN_LOAD <");
479      dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags, false);
480      pp_string (buffer, ", ");
481      dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags, false);
482      pp_string (buffer, ", ");
483      dump_generic_node (buffer, gimple_assign_rhs3 (gs), spc, flags, false);
484      pp_greater (buffer);
485      break;
486
487    case COND_EXPR:
488      dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags, false);
489      pp_string (buffer, " ? ");
490      dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags, false);
491      pp_string (buffer, " : ");
492      dump_generic_node (buffer, gimple_assign_rhs3 (gs), spc, flags, false);
493      break;
494
495    case VEC_COND_EXPR:
496      pp_string (buffer, "VEC_COND_EXPR <");
497      dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags, false);
498      pp_string (buffer, ", ");
499      dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags, false);
500      pp_string (buffer, ", ");
501      dump_generic_node (buffer, gimple_assign_rhs3 (gs), spc, flags, false);
502      pp_greater (buffer);
503      break;
504
505    default:
506      gcc_unreachable ();
507    }
508}
509
510
511/* Dump the gimple assignment GS.  BUFFER, SPC and FLAGS are as in
512   pp_gimple_stmt_1.  */
513
514static void
515dump_gimple_assign (pretty_printer *buffer, gassign *gs, int spc, int flags)
516{
517  if (flags & TDF_RAW)
518    {
519      tree arg1 = NULL;
520      tree arg2 = NULL;
521      tree arg3 = NULL;
522      switch (gimple_num_ops (gs))
523	{
524	case 4:
525	  arg3 = gimple_assign_rhs3 (gs);
526	case 3:
527	  arg2 = gimple_assign_rhs2 (gs);
528	case 2:
529	  arg1 = gimple_assign_rhs1 (gs);
530	  break;
531	default:
532	  gcc_unreachable ();
533	}
534
535      dump_gimple_fmt (buffer, spc, flags, "%G <%s, %T, %T, %T, %T>", gs,
536		       get_tree_code_name (gimple_assign_rhs_code (gs)),
537                       gimple_assign_lhs (gs), arg1, arg2, arg3);
538    }
539  else
540    {
541      if (!(flags & TDF_RHS_ONLY))
542	{
543	  dump_generic_node (buffer, gimple_assign_lhs (gs), spc, flags, false);
544	  pp_space (buffer);
545	  pp_equal (buffer);
546
547	  if (gimple_assign_nontemporal_move_p (gs))
548	    pp_string (buffer, "{nt}");
549
550	  if (gimple_has_volatile_ops (gs))
551	    pp_string (buffer, "{v}");
552
553	  pp_space (buffer);
554	}
555
556      if (gimple_num_ops (gs) == 2)
557        dump_unary_rhs (buffer, gs, spc, flags);
558      else if (gimple_num_ops (gs) == 3)
559        dump_binary_rhs (buffer, gs, spc, flags);
560      else if (gimple_num_ops (gs) == 4)
561        dump_ternary_rhs (buffer, gs, spc, flags);
562      else
563        gcc_unreachable ();
564      if (!(flags & TDF_RHS_ONLY))
565	pp_semicolon (buffer);
566    }
567}
568
569
570/* Dump the return statement GS.  BUFFER, SPC and FLAGS are as in
571   pp_gimple_stmt_1.  */
572
573static void
574dump_gimple_return (pretty_printer *buffer, greturn *gs, int spc, int flags)
575{
576  tree t, t2;
577
578  t = gimple_return_retval (gs);
579  t2 = gimple_return_retbnd (gs);
580  if (flags & TDF_RAW)
581    dump_gimple_fmt (buffer, spc, flags, "%G <%T %T>", gs, t, t2);
582  else
583    {
584      pp_string (buffer, "return");
585      if (t)
586	{
587	  pp_space (buffer);
588	  dump_generic_node (buffer, t, spc, flags, false);
589	}
590      if (t2)
591	{
592	  pp_string (buffer, ", ");
593	  dump_generic_node (buffer, t2, spc, flags, false);
594	}
595      pp_semicolon (buffer);
596    }
597}
598
599
600/* Dump the call arguments for a gimple call. BUFFER, FLAGS are as in
601   dump_gimple_call.  */
602
603static void
604dump_gimple_call_args (pretty_printer *buffer, gcall *gs, int flags)
605{
606  size_t i;
607
608  for (i = 0; i < gimple_call_num_args (gs); i++)
609    {
610      dump_generic_node (buffer, gimple_call_arg (gs, i), 0, flags, false);
611      if (i < gimple_call_num_args (gs) - 1)
612	pp_string (buffer, ", ");
613    }
614
615  if (gimple_call_va_arg_pack_p (gs))
616    {
617      if (gimple_call_num_args (gs) > 0)
618        {
619          pp_comma (buffer);
620          pp_space (buffer);
621        }
622
623      pp_string (buffer, "__builtin_va_arg_pack ()");
624    }
625}
626
627/* Dump the points-to solution *PT to BUFFER.  */
628
629static void
630pp_points_to_solution (pretty_printer *buffer, struct pt_solution *pt)
631{
632  if (pt->anything)
633    {
634      pp_string (buffer, "anything ");
635      return;
636    }
637  if (pt->nonlocal)
638    pp_string (buffer, "nonlocal ");
639  if (pt->escaped)
640    pp_string (buffer, "escaped ");
641  if (pt->ipa_escaped)
642    pp_string (buffer, "unit-escaped ");
643  if (pt->null)
644    pp_string (buffer, "null ");
645  if (pt->vars
646      && !bitmap_empty_p (pt->vars))
647    {
648      bitmap_iterator bi;
649      unsigned i;
650      pp_string (buffer, "{ ");
651      EXECUTE_IF_SET_IN_BITMAP (pt->vars, 0, i, bi)
652	{
653	  pp_string (buffer, "D.");
654	  pp_decimal_int (buffer, i);
655	  pp_space (buffer);
656	}
657      pp_right_brace (buffer);
658      if (pt->vars_contains_nonlocal
659	  && pt->vars_contains_escaped_heap)
660	pp_string (buffer, " (nonlocal, escaped heap)");
661      else if (pt->vars_contains_nonlocal
662	       && pt->vars_contains_escaped)
663	pp_string (buffer, " (nonlocal, escaped)");
664      else if (pt->vars_contains_nonlocal)
665	pp_string (buffer, " (nonlocal)");
666      else if (pt->vars_contains_escaped_heap)
667	pp_string (buffer, " (escaped heap)");
668      else if (pt->vars_contains_escaped)
669	pp_string (buffer, " (escaped)");
670    }
671}
672
673/* Dump the call statement GS.  BUFFER, SPC and FLAGS are as in
674   pp_gimple_stmt_1.  */
675
676static void
677dump_gimple_call (pretty_printer *buffer, gcall *gs, int spc, int flags)
678{
679  tree lhs = gimple_call_lhs (gs);
680  tree fn = gimple_call_fn (gs);
681
682  if (flags & TDF_ALIAS)
683    {
684      struct pt_solution *pt;
685      pt = gimple_call_use_set (gs);
686      if (!pt_solution_empty_p (pt))
687	{
688	  pp_string (buffer, "# USE = ");
689	  pp_points_to_solution (buffer, pt);
690	  newline_and_indent (buffer, spc);
691	}
692      pt = gimple_call_clobber_set (gs);
693      if (!pt_solution_empty_p (pt))
694	{
695	  pp_string (buffer, "# CLB = ");
696	  pp_points_to_solution (buffer, pt);
697	  newline_and_indent (buffer, spc);
698	}
699    }
700
701  if (flags & TDF_RAW)
702    {
703      if (gimple_call_internal_p (gs))
704	dump_gimple_fmt (buffer, spc, flags, "%G <%s, %T", gs,
705			 internal_fn_name (gimple_call_internal_fn (gs)), lhs);
706      else
707	dump_gimple_fmt (buffer, spc, flags, "%G <%T, %T", gs, fn, lhs);
708      if (gimple_call_num_args (gs) > 0)
709        {
710          pp_string (buffer, ", ");
711          dump_gimple_call_args (buffer, gs, flags);
712        }
713      pp_greater (buffer);
714    }
715  else
716    {
717      if (lhs && !(flags & TDF_RHS_ONLY))
718        {
719          dump_generic_node (buffer, lhs, spc, flags, false);
720          pp_string (buffer, " =");
721
722	  if (gimple_has_volatile_ops (gs))
723	    pp_string (buffer, "{v}");
724
725	  pp_space (buffer);
726        }
727      if (gimple_call_internal_p (gs))
728	pp_string (buffer, internal_fn_name (gimple_call_internal_fn (gs)));
729      else
730	print_call_name (buffer, fn, flags);
731      pp_string (buffer, " (");
732      dump_gimple_call_args (buffer, gs, flags);
733      pp_right_paren (buffer);
734      if (!(flags & TDF_RHS_ONLY))
735	pp_semicolon (buffer);
736    }
737
738  if (gimple_call_chain (gs))
739    {
740      pp_string (buffer, " [static-chain: ");
741      dump_generic_node (buffer, gimple_call_chain (gs), spc, flags, false);
742      pp_right_bracket (buffer);
743    }
744
745  if (gimple_call_return_slot_opt_p (gs))
746    pp_string (buffer, " [return slot optimization]");
747  if (gimple_call_tail_p (gs))
748    pp_string (buffer, " [tail call]");
749
750  if (fn == NULL)
751    return;
752
753  /* Dump the arguments of _ITM_beginTransaction sanely.  */
754  if (TREE_CODE (fn) == ADDR_EXPR)
755    fn = TREE_OPERAND (fn, 0);
756  if (TREE_CODE (fn) == FUNCTION_DECL && decl_is_tm_clone (fn))
757    pp_string (buffer, " [tm-clone]");
758  if (TREE_CODE (fn) == FUNCTION_DECL
759      && DECL_BUILT_IN_CLASS (fn) == BUILT_IN_NORMAL
760      && DECL_FUNCTION_CODE (fn) == BUILT_IN_TM_START
761      && gimple_call_num_args (gs) > 0)
762    {
763      tree t = gimple_call_arg (gs, 0);
764      unsigned HOST_WIDE_INT props;
765      gcc_assert (TREE_CODE (t) == INTEGER_CST);
766
767      pp_string (buffer, " [ ");
768
769      /* Get the transaction code properties.  */
770      props = TREE_INT_CST_LOW (t);
771
772      if (props & PR_INSTRUMENTEDCODE)
773	pp_string (buffer, "instrumentedCode ");
774      if (props & PR_UNINSTRUMENTEDCODE)
775	pp_string (buffer, "uninstrumentedCode ");
776      if (props & PR_HASNOXMMUPDATE)
777	pp_string (buffer, "hasNoXMMUpdate ");
778      if (props & PR_HASNOABORT)
779	pp_string (buffer, "hasNoAbort ");
780      if (props & PR_HASNOIRREVOCABLE)
781	pp_string (buffer, "hasNoIrrevocable ");
782      if (props & PR_DOESGOIRREVOCABLE)
783	pp_string (buffer, "doesGoIrrevocable ");
784      if (props & PR_HASNOSIMPLEREADS)
785	pp_string (buffer, "hasNoSimpleReads ");
786      if (props & PR_AWBARRIERSOMITTED)
787	pp_string (buffer, "awBarriersOmitted ");
788      if (props & PR_RARBARRIERSOMITTED)
789	pp_string (buffer, "RaRBarriersOmitted ");
790      if (props & PR_UNDOLOGCODE)
791	pp_string (buffer, "undoLogCode ");
792      if (props & PR_PREFERUNINSTRUMENTED)
793	pp_string (buffer, "preferUninstrumented ");
794      if (props & PR_EXCEPTIONBLOCK)
795	pp_string (buffer, "exceptionBlock ");
796      if (props & PR_HASELSE)
797	pp_string (buffer, "hasElse ");
798      if (props & PR_READONLY)
799	pp_string (buffer, "readOnly ");
800
801      pp_right_bracket (buffer);
802    }
803}
804
805
806/* Dump the switch statement GS.  BUFFER, SPC and FLAGS are as in
807   pp_gimple_stmt_1.  */
808
809static void
810dump_gimple_switch (pretty_printer *buffer, gswitch *gs, int spc,
811		    int flags)
812{
813  unsigned int i;
814
815  GIMPLE_CHECK (gs, GIMPLE_SWITCH);
816  if (flags & TDF_RAW)
817    dump_gimple_fmt (buffer, spc, flags, "%G <%T, ", gs,
818                   gimple_switch_index (gs));
819  else
820    {
821      pp_string (buffer, "switch (");
822      dump_generic_node (buffer, gimple_switch_index (gs), spc, flags, true);
823      pp_string (buffer, ") <");
824    }
825
826  for (i = 0; i < gimple_switch_num_labels (gs); i++)
827    {
828      tree case_label = gimple_switch_label (gs, i);
829      gcc_checking_assert (case_label != NULL_TREE);
830      dump_generic_node (buffer, case_label, spc, flags, false);
831      pp_space (buffer);
832      dump_generic_node (buffer, CASE_LABEL (case_label), spc, flags, false);
833      if (i < gimple_switch_num_labels (gs) - 1)
834        pp_string (buffer, ", ");
835    }
836  pp_greater (buffer);
837}
838
839
840/* Dump the gimple conditional GS.  BUFFER, SPC and FLAGS are as in
841   pp_gimple_stmt_1.  */
842
843static void
844dump_gimple_cond (pretty_printer *buffer, gcond *gs, int spc, int flags)
845{
846  if (flags & TDF_RAW)
847    dump_gimple_fmt (buffer, spc, flags, "%G <%s, %T, %T, %T, %T>", gs,
848		     get_tree_code_name (gimple_cond_code (gs)),
849		     gimple_cond_lhs (gs), gimple_cond_rhs (gs),
850		     gimple_cond_true_label (gs), gimple_cond_false_label (gs));
851  else
852    {
853      if (!(flags & TDF_RHS_ONLY))
854	pp_string (buffer, "if (");
855      dump_generic_node (buffer, gimple_cond_lhs (gs), spc, flags, false);
856      pp_space (buffer);
857      pp_string (buffer, op_symbol_code (gimple_cond_code (gs)));
858      pp_space (buffer);
859      dump_generic_node (buffer, gimple_cond_rhs (gs), spc, flags, false);
860      if (!(flags & TDF_RHS_ONLY))
861	{
862	  pp_right_paren (buffer);
863
864	  if (gimple_cond_true_label (gs))
865	    {
866	      pp_string (buffer, " goto ");
867	      dump_generic_node (buffer, gimple_cond_true_label (gs),
868				 spc, flags, false);
869	      pp_semicolon (buffer);
870	    }
871	  if (gimple_cond_false_label (gs))
872	    {
873	      pp_string (buffer, " else goto ");
874	      dump_generic_node (buffer, gimple_cond_false_label (gs),
875				 spc, flags, false);
876	      pp_semicolon (buffer);
877	    }
878	}
879    }
880}
881
882
883/* Dump a GIMPLE_LABEL tuple on the pretty_printer BUFFER, SPC
884   spaces of indent.  FLAGS specifies details to show in the dump (see
885   TDF_* in dumpfils.h).  */
886
887static void
888dump_gimple_label (pretty_printer *buffer, glabel *gs, int spc, int flags)
889{
890  tree label = gimple_label_label (gs);
891  if (flags & TDF_RAW)
892      dump_gimple_fmt (buffer, spc, flags, "%G <%T>", gs, label);
893  else
894    {
895      dump_generic_node (buffer, label, spc, flags, false);
896      pp_colon (buffer);
897    }
898  if (DECL_NONLOCAL (label))
899    pp_string (buffer, " [non-local]");
900  if ((flags & TDF_EH) && EH_LANDING_PAD_NR (label))
901    pp_printf (buffer, " [LP %d]", EH_LANDING_PAD_NR (label));
902}
903
904/* Dump a GIMPLE_GOTO tuple on the pretty_printer BUFFER, SPC
905   spaces of indent.  FLAGS specifies details to show in the dump (see
906   TDF_* in dumpfile.h).  */
907
908static void
909dump_gimple_goto (pretty_printer *buffer, ggoto *gs, int spc, int flags)
910{
911  tree label = gimple_goto_dest (gs);
912  if (flags & TDF_RAW)
913    dump_gimple_fmt (buffer, spc, flags, "%G <%T>", gs, label);
914  else
915    dump_gimple_fmt (buffer, spc, flags, "goto %T;", label);
916}
917
918
919/* Dump a GIMPLE_BIND tuple on the pretty_printer BUFFER, SPC
920   spaces of indent.  FLAGS specifies details to show in the dump (see
921   TDF_* in dumpfile.h).  */
922
923static void
924dump_gimple_bind (pretty_printer *buffer, gbind *gs, int spc, int flags)
925{
926  if (flags & TDF_RAW)
927    dump_gimple_fmt (buffer, spc, flags, "%G <", gs);
928  else
929    pp_left_brace (buffer);
930  if (!(flags & TDF_SLIM))
931    {
932      tree var;
933
934      for (var = gimple_bind_vars (gs); var; var = DECL_CHAIN (var))
935	{
936          newline_and_indent (buffer, 2);
937	  print_declaration (buffer, var, spc, flags);
938	}
939      if (gimple_bind_vars (gs))
940	pp_newline (buffer);
941    }
942  pp_newline (buffer);
943  dump_gimple_seq (buffer, gimple_bind_body (gs), spc + 2, flags);
944  newline_and_indent (buffer, spc);
945  if (flags & TDF_RAW)
946    pp_greater (buffer);
947  else
948    pp_right_brace (buffer);
949}
950
951
952/* Dump a GIMPLE_TRY tuple on the pretty_printer BUFFER, SPC spaces of
953   indent.  FLAGS specifies details to show in the dump (see TDF_* in
954   dumpfile.h).  */
955
956static void
957dump_gimple_try (pretty_printer *buffer, gtry *gs, int spc, int flags)
958{
959  if (flags & TDF_RAW)
960    {
961      const char *type;
962      if (gimple_try_kind (gs) == GIMPLE_TRY_CATCH)
963        type = "GIMPLE_TRY_CATCH";
964      else if (gimple_try_kind (gs) == GIMPLE_TRY_FINALLY)
965        type = "GIMPLE_TRY_FINALLY";
966      else
967        type = "UNKNOWN GIMPLE_TRY";
968      dump_gimple_fmt (buffer, spc, flags,
969                       "%G <%s,%+EVAL <%S>%nCLEANUP <%S>%->", gs, type,
970                       gimple_try_eval (gs), gimple_try_cleanup (gs));
971    }
972  else
973    {
974      pp_string (buffer, "try");
975      newline_and_indent (buffer, spc + 2);
976      pp_left_brace (buffer);
977      pp_newline (buffer);
978
979      dump_gimple_seq (buffer, gimple_try_eval (gs), spc + 4, flags);
980      newline_and_indent (buffer, spc + 2);
981      pp_right_brace (buffer);
982
983      if (gimple_try_kind (gs) == GIMPLE_TRY_CATCH)
984	{
985	  newline_and_indent (buffer, spc);
986	  pp_string (buffer, "catch");
987	  newline_and_indent (buffer, spc + 2);
988	  pp_left_brace (buffer);
989	}
990      else if (gimple_try_kind (gs) == GIMPLE_TRY_FINALLY)
991	{
992	  newline_and_indent (buffer, spc);
993	  pp_string (buffer, "finally");
994	  newline_and_indent (buffer, spc + 2);
995	  pp_left_brace (buffer);
996	}
997      else
998	pp_string (buffer, " <UNKNOWN GIMPLE_TRY> {");
999
1000      pp_newline (buffer);
1001      dump_gimple_seq (buffer, gimple_try_cleanup (gs), spc + 4, flags);
1002      newline_and_indent (buffer, spc + 2);
1003      pp_right_brace (buffer);
1004    }
1005}
1006
1007
1008/* Dump a GIMPLE_CATCH tuple on the pretty_printer BUFFER, SPC spaces of
1009   indent.  FLAGS specifies details to show in the dump (see TDF_* in
1010   dumpfile.h).  */
1011
1012static void
1013dump_gimple_catch (pretty_printer *buffer, gcatch *gs, int spc, int flags)
1014{
1015  if (flags & TDF_RAW)
1016      dump_gimple_fmt (buffer, spc, flags, "%G <%T, %+CATCH <%S>%->", gs,
1017                       gimple_catch_types (gs), gimple_catch_handler (gs));
1018  else
1019      dump_gimple_fmt (buffer, spc, flags, "catch (%T)%+{%S}",
1020                       gimple_catch_types (gs), gimple_catch_handler (gs));
1021}
1022
1023
1024/* Dump a GIMPLE_EH_FILTER tuple on the pretty_printer BUFFER, SPC spaces of
1025   indent.  FLAGS specifies details to show in the dump (see TDF_* in
1026   dumpfile.h).  */
1027
1028static void
1029dump_gimple_eh_filter (pretty_printer *buffer, geh_filter *gs, int spc,
1030		       int flags)
1031{
1032  if (flags & TDF_RAW)
1033    dump_gimple_fmt (buffer, spc, flags, "%G <%T, %+FAILURE <%S>%->", gs,
1034                     gimple_eh_filter_types (gs),
1035                     gimple_eh_filter_failure (gs));
1036  else
1037    dump_gimple_fmt (buffer, spc, flags, "<<<eh_filter (%T)>>>%+{%+%S%-}",
1038                     gimple_eh_filter_types (gs),
1039                     gimple_eh_filter_failure (gs));
1040}
1041
1042
1043/* Dump a GIMPLE_EH_MUST_NOT_THROW tuple.  */
1044
1045static void
1046dump_gimple_eh_must_not_throw (pretty_printer *buffer,
1047			       geh_mnt *gs, int spc, int flags)
1048{
1049  if (flags & TDF_RAW)
1050    dump_gimple_fmt (buffer, spc, flags, "%G <%T>", gs,
1051		     gimple_eh_must_not_throw_fndecl (gs));
1052  else
1053    dump_gimple_fmt (buffer, spc, flags, "<<<eh_must_not_throw (%T)>>>",
1054		     gimple_eh_must_not_throw_fndecl (gs));
1055}
1056
1057
1058/* Dump a GIMPLE_EH_ELSE tuple on the pretty_printer BUFFER, SPC spaces of
1059   indent.  FLAGS specifies details to show in the dump (see TDF_* in
1060   dumpfile.h).  */
1061
1062static void
1063dump_gimple_eh_else (pretty_printer *buffer, geh_else *gs, int spc,
1064		     int flags)
1065{
1066  if (flags & TDF_RAW)
1067    dump_gimple_fmt (buffer, spc, flags,
1068		     "%G <%+N_BODY <%S>%nE_BODY <%S>%->", gs,
1069		     gimple_eh_else_n_body (gs), gimple_eh_else_e_body (gs));
1070  else
1071    dump_gimple_fmt (buffer, spc, flags,
1072		    "<<<if_normal_exit>>>%+{%S}%-<<<else_eh_exit>>>%+{%S}",
1073		     gimple_eh_else_n_body (gs), gimple_eh_else_e_body (gs));
1074}
1075
1076
1077/* Dump a GIMPLE_RESX tuple on the pretty_printer BUFFER, SPC spaces of
1078   indent.  FLAGS specifies details to show in the dump (see TDF_* in
1079   dumpfile.h).  */
1080
1081static void
1082dump_gimple_resx (pretty_printer *buffer, gresx *gs, int spc, int flags)
1083{
1084  if (flags & TDF_RAW)
1085    dump_gimple_fmt (buffer, spc, flags, "%G <%d>", gs,
1086		     gimple_resx_region (gs));
1087  else
1088    dump_gimple_fmt (buffer, spc, flags, "resx %d", gimple_resx_region (gs));
1089}
1090
1091/* Dump a GIMPLE_EH_DISPATCH tuple on the pretty_printer BUFFER.  */
1092
1093static void
1094dump_gimple_eh_dispatch (pretty_printer *buffer, geh_dispatch *gs, int spc, int flags)
1095{
1096  if (flags & TDF_RAW)
1097    dump_gimple_fmt (buffer, spc, flags, "%G <%d>", gs,
1098		     gimple_eh_dispatch_region (gs));
1099  else
1100    dump_gimple_fmt (buffer, spc, flags, "eh_dispatch %d",
1101		     gimple_eh_dispatch_region (gs));
1102}
1103
1104/* Dump a GIMPLE_DEBUG tuple on the pretty_printer BUFFER, SPC spaces
1105   of indent.  FLAGS specifies details to show in the dump (see TDF_*
1106   in dumpfile.h).  */
1107
1108static void
1109dump_gimple_debug (pretty_printer *buffer, gdebug *gs, int spc, int flags)
1110{
1111  switch (gs->subcode)
1112    {
1113    case GIMPLE_DEBUG_BIND:
1114      if (flags & TDF_RAW)
1115	dump_gimple_fmt (buffer, spc, flags, "%G BIND <%T, %T>", gs,
1116			 gimple_debug_bind_get_var (gs),
1117			 gimple_debug_bind_get_value (gs));
1118      else
1119	dump_gimple_fmt (buffer, spc, flags, "# DEBUG %T => %T",
1120			 gimple_debug_bind_get_var (gs),
1121			 gimple_debug_bind_get_value (gs));
1122      break;
1123
1124    case GIMPLE_DEBUG_SOURCE_BIND:
1125      if (flags & TDF_RAW)
1126	dump_gimple_fmt (buffer, spc, flags, "%G SRCBIND <%T, %T>", gs,
1127			 gimple_debug_source_bind_get_var (gs),
1128			 gimple_debug_source_bind_get_value (gs));
1129      else
1130	dump_gimple_fmt (buffer, spc, flags, "# DEBUG %T s=> %T",
1131			 gimple_debug_source_bind_get_var (gs),
1132			 gimple_debug_source_bind_get_value (gs));
1133      break;
1134
1135    default:
1136      gcc_unreachable ();
1137    }
1138}
1139
1140/* Dump a GIMPLE_OMP_FOR tuple on the pretty_printer BUFFER.  */
1141static void
1142dump_gimple_omp_for (pretty_printer *buffer, gomp_for *gs, int spc, int flags)
1143{
1144  size_t i;
1145
1146  if (flags & TDF_RAW)
1147    {
1148      const char *kind;
1149      switch (gimple_omp_for_kind (gs))
1150	{
1151	case GF_OMP_FOR_KIND_FOR:
1152	  kind = "";
1153	  break;
1154	case GF_OMP_FOR_KIND_DISTRIBUTE:
1155	  kind = " distribute";
1156	  break;
1157	case GF_OMP_FOR_KIND_CILKFOR:
1158	  kind = " _Cilk_for";
1159	  break;
1160	case GF_OMP_FOR_KIND_OACC_LOOP:
1161	  kind = " oacc_loop";
1162	  break;
1163	case GF_OMP_FOR_KIND_SIMD:
1164	  kind = " simd";
1165	  break;
1166	case GF_OMP_FOR_KIND_CILKSIMD:
1167	  kind = " cilksimd";
1168	  break;
1169	default:
1170	  gcc_unreachable ();
1171	}
1172      dump_gimple_fmt (buffer, spc, flags, "%G%s <%+BODY <%S>%nCLAUSES <", gs,
1173		       kind, gimple_omp_body (gs));
1174      dump_omp_clauses (buffer, gimple_omp_for_clauses (gs), spc, flags);
1175      dump_gimple_fmt (buffer, spc, flags, " >,");
1176      for (i = 0; i < gimple_omp_for_collapse (gs); i++)
1177	dump_gimple_fmt (buffer, spc, flags,
1178			 "%+%T, %T, %T, %s, %T,%n",
1179			 gimple_omp_for_index (gs, i),
1180			 gimple_omp_for_initial (gs, i),
1181			 gimple_omp_for_final (gs, i),
1182			 get_tree_code_name (gimple_omp_for_cond (gs, i)),
1183			 gimple_omp_for_incr (gs, i));
1184      dump_gimple_fmt (buffer, spc, flags, "PRE_BODY <%S>%->",
1185		       gimple_omp_for_pre_body (gs));
1186    }
1187  else
1188    {
1189      switch (gimple_omp_for_kind (gs))
1190	{
1191	case GF_OMP_FOR_KIND_FOR:
1192	  pp_string (buffer, "#pragma omp for");
1193	  break;
1194	case GF_OMP_FOR_KIND_DISTRIBUTE:
1195	  pp_string (buffer, "#pragma omp distribute");
1196	  break;
1197	case GF_OMP_FOR_KIND_CILKFOR:
1198	  break;
1199	case GF_OMP_FOR_KIND_OACC_LOOP:
1200	  pp_string (buffer, "#pragma acc loop");
1201	  break;
1202	case GF_OMP_FOR_KIND_SIMD:
1203	  pp_string (buffer, "#pragma omp simd");
1204	  break;
1205	case GF_OMP_FOR_KIND_CILKSIMD:
1206	  pp_string (buffer, "#pragma simd");
1207	  break;
1208	default:
1209	  gcc_unreachable ();
1210	}
1211      if (gimple_omp_for_kind (gs) != GF_OMP_FOR_KIND_CILKFOR)
1212	dump_omp_clauses (buffer, gimple_omp_for_clauses (gs), spc, flags);
1213      for (i = 0; i < gimple_omp_for_collapse (gs); i++)
1214	{
1215	  if (i)
1216	    spc += 2;
1217	  if (gimple_omp_for_kind (gs) == GF_OMP_FOR_KIND_CILKFOR)
1218	    pp_string (buffer, "_Cilk_for (");
1219	  else
1220	    {
1221	      newline_and_indent (buffer, spc);
1222	      pp_string (buffer, "for (");
1223	    }
1224	  dump_generic_node (buffer, gimple_omp_for_index (gs, i), spc,
1225			     flags, false);
1226	  pp_string (buffer, " = ");
1227	  dump_generic_node (buffer, gimple_omp_for_initial (gs, i), spc,
1228			     flags, false);
1229	  pp_string (buffer, "; ");
1230
1231	  dump_generic_node (buffer, gimple_omp_for_index (gs, i), spc,
1232			     flags, false);
1233	  pp_space (buffer);
1234	  switch (gimple_omp_for_cond (gs, i))
1235	    {
1236	    case LT_EXPR:
1237	      pp_less (buffer);
1238	      break;
1239	    case GT_EXPR:
1240	      pp_greater (buffer);
1241	      break;
1242	    case LE_EXPR:
1243	      pp_less_equal (buffer);
1244	      break;
1245	    case GE_EXPR:
1246	      pp_greater_equal (buffer);
1247	      break;
1248	    case NE_EXPR:
1249	      pp_string (buffer, "!=");
1250	      break;
1251	    default:
1252	      gcc_unreachable ();
1253	    }
1254	  pp_space (buffer);
1255	  dump_generic_node (buffer, gimple_omp_for_final (gs, i), spc,
1256			     flags, false);
1257	  pp_string (buffer, "; ");
1258
1259	  dump_generic_node (buffer, gimple_omp_for_index (gs, i), spc,
1260			     flags, false);
1261	  pp_string (buffer, " = ");
1262	  dump_generic_node (buffer, gimple_omp_for_incr (gs, i), spc,
1263			     flags, false);
1264	  pp_right_paren (buffer);
1265	}
1266
1267      if (!gimple_seq_empty_p (gimple_omp_body (gs)))
1268	{
1269	  if (gimple_omp_for_kind (gs) == GF_OMP_FOR_KIND_CILKFOR)
1270	    dump_omp_clauses (buffer, gimple_omp_for_clauses (gs), spc, flags);
1271	  newline_and_indent (buffer, spc + 2);
1272	  pp_left_brace (buffer);
1273	  pp_newline (buffer);
1274	  dump_gimple_seq (buffer, gimple_omp_body (gs), spc + 4, flags);
1275	  newline_and_indent (buffer, spc + 2);
1276	  pp_right_brace (buffer);
1277	}
1278    }
1279}
1280
1281/* Dump a GIMPLE_OMP_CONTINUE tuple on the pretty_printer BUFFER.  */
1282
1283static void
1284dump_gimple_omp_continue (pretty_printer *buffer, gomp_continue *gs,
1285			  int spc, int flags)
1286{
1287  if (flags & TDF_RAW)
1288    {
1289      dump_gimple_fmt (buffer, spc, flags, "%G <%T, %T>", gs,
1290                       gimple_omp_continue_control_def (gs),
1291                       gimple_omp_continue_control_use (gs));
1292    }
1293  else
1294    {
1295      pp_string (buffer, "#pragma omp continue (");
1296      dump_generic_node (buffer, gimple_omp_continue_control_def (gs),
1297	  		 spc, flags, false);
1298      pp_comma (buffer);
1299      pp_space (buffer);
1300      dump_generic_node (buffer, gimple_omp_continue_control_use (gs),
1301	  		 spc, flags, false);
1302      pp_right_paren (buffer);
1303    }
1304}
1305
1306/* Dump a GIMPLE_OMP_SINGLE tuple on the pretty_printer BUFFER.  */
1307
1308static void
1309dump_gimple_omp_single (pretty_printer *buffer, gomp_single *gs,
1310			int spc, int flags)
1311{
1312  if (flags & TDF_RAW)
1313    {
1314      dump_gimple_fmt (buffer, spc, flags, "%G <%+BODY <%S>%nCLAUSES <", gs,
1315		       gimple_omp_body (gs));
1316      dump_omp_clauses (buffer, gimple_omp_single_clauses (gs), spc, flags);
1317      dump_gimple_fmt (buffer, spc, flags, " >");
1318    }
1319  else
1320    {
1321      pp_string (buffer, "#pragma omp single");
1322      dump_omp_clauses (buffer, gimple_omp_single_clauses (gs), spc, flags);
1323      if (!gimple_seq_empty_p (gimple_omp_body (gs)))
1324	{
1325	  newline_and_indent (buffer, spc + 2);
1326	  pp_left_brace (buffer);
1327	  pp_newline (buffer);
1328	  dump_gimple_seq (buffer, gimple_omp_body (gs), spc + 4, flags);
1329	  newline_and_indent (buffer, spc + 2);
1330	  pp_right_brace (buffer);
1331	}
1332    }
1333}
1334
1335/* Dump a GIMPLE_OMP_TARGET tuple on the pretty_printer BUFFER.  */
1336
1337static void
1338dump_gimple_omp_target (pretty_printer *buffer, gomp_target *gs,
1339			int spc, int flags)
1340{
1341  const char *kind;
1342  switch (gimple_omp_target_kind (gs))
1343    {
1344    case GF_OMP_TARGET_KIND_REGION:
1345      kind = "";
1346      break;
1347    case GF_OMP_TARGET_KIND_DATA:
1348      kind = " data";
1349      break;
1350    case GF_OMP_TARGET_KIND_UPDATE:
1351      kind = " update";
1352      break;
1353    case GF_OMP_TARGET_KIND_OACC_KERNELS:
1354      kind = " oacc_kernels";
1355      break;
1356    case GF_OMP_TARGET_KIND_OACC_PARALLEL:
1357      kind = " oacc_parallel";
1358      break;
1359    case GF_OMP_TARGET_KIND_OACC_DATA:
1360      kind = " oacc_data";
1361      break;
1362    case GF_OMP_TARGET_KIND_OACC_UPDATE:
1363      kind = " oacc_update";
1364      break;
1365    case GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA:
1366      kind = " oacc_enter_exit_data";
1367      break;
1368    default:
1369      gcc_unreachable ();
1370    }
1371  if (flags & TDF_RAW)
1372    {
1373      dump_gimple_fmt (buffer, spc, flags, "%G%s <%+BODY <%S>%nCLAUSES <", gs,
1374		       kind, gimple_omp_body (gs));
1375      dump_omp_clauses (buffer, gimple_omp_target_clauses (gs), spc, flags);
1376      dump_gimple_fmt (buffer, spc, flags, " >, %T, %T%n>",
1377		       gimple_omp_target_child_fn (gs),
1378		       gimple_omp_target_data_arg (gs));
1379    }
1380  else
1381    {
1382      pp_string (buffer, "#pragma omp target");
1383      pp_string (buffer, kind);
1384      dump_omp_clauses (buffer, gimple_omp_target_clauses (gs), spc, flags);
1385      if (gimple_omp_target_child_fn (gs))
1386	{
1387	  pp_string (buffer, " [child fn: ");
1388	  dump_generic_node (buffer, gimple_omp_target_child_fn (gs),
1389			     spc, flags, false);
1390	  pp_string (buffer, " (");
1391	  if (gimple_omp_target_data_arg (gs))
1392	    dump_generic_node (buffer, gimple_omp_target_data_arg (gs),
1393			       spc, flags, false);
1394	  else
1395	    pp_string (buffer, "???");
1396	  pp_string (buffer, ")]");
1397	}
1398      gimple_seq body = gimple_omp_body (gs);
1399      if (body && gimple_code (gimple_seq_first_stmt (body)) != GIMPLE_BIND)
1400	{
1401	  newline_and_indent (buffer, spc + 2);
1402	  pp_left_brace (buffer);
1403	  pp_newline (buffer);
1404	  dump_gimple_seq (buffer, body, spc + 4, flags);
1405	  newline_and_indent (buffer, spc + 2);
1406	  pp_right_brace (buffer);
1407	}
1408      else if (body)
1409	{
1410	  pp_newline (buffer);
1411	  dump_gimple_seq (buffer, body, spc + 2, flags);
1412	}
1413    }
1414}
1415
1416/* Dump a GIMPLE_OMP_TEAMS tuple on the pretty_printer BUFFER.  */
1417
1418static void
1419dump_gimple_omp_teams (pretty_printer *buffer, gomp_teams *gs, int spc,
1420		       int flags)
1421{
1422  if (flags & TDF_RAW)
1423    {
1424      dump_gimple_fmt (buffer, spc, flags, "%G <%+BODY <%S>%nCLAUSES <", gs,
1425		       gimple_omp_body (gs));
1426      dump_omp_clauses (buffer, gimple_omp_teams_clauses (gs), spc, flags);
1427      dump_gimple_fmt (buffer, spc, flags, " >");
1428    }
1429  else
1430    {
1431      pp_string (buffer, "#pragma omp teams");
1432      dump_omp_clauses (buffer, gimple_omp_teams_clauses (gs), spc, flags);
1433      if (!gimple_seq_empty_p (gimple_omp_body (gs)))
1434	{
1435	  newline_and_indent (buffer, spc + 2);
1436	  pp_character (buffer, '{');
1437	  pp_newline (buffer);
1438	  dump_gimple_seq (buffer, gimple_omp_body (gs), spc + 4, flags);
1439	  newline_and_indent (buffer, spc + 2);
1440	  pp_character (buffer, '}');
1441	}
1442    }
1443}
1444
1445/* Dump a GIMPLE_OMP_SECTIONS tuple on the pretty_printer BUFFER.  */
1446
1447static void
1448dump_gimple_omp_sections (pretty_printer *buffer, gomp_sections *gs,
1449			  int spc, int flags)
1450{
1451  if (flags & TDF_RAW)
1452    {
1453      dump_gimple_fmt (buffer, spc, flags, "%G <%+BODY <%S>%nCLAUSES <", gs,
1454		       gimple_omp_body (gs));
1455      dump_omp_clauses (buffer, gimple_omp_sections_clauses (gs), spc, flags);
1456      dump_gimple_fmt (buffer, spc, flags, " >");
1457    }
1458  else
1459    {
1460      pp_string (buffer, "#pragma omp sections");
1461      if (gimple_omp_sections_control (gs))
1462	{
1463	  pp_string (buffer, " <");
1464	  dump_generic_node (buffer, gimple_omp_sections_control (gs), spc,
1465			     flags, false);
1466	  pp_greater (buffer);
1467	}
1468      dump_omp_clauses (buffer, gimple_omp_sections_clauses (gs), spc, flags);
1469      if (!gimple_seq_empty_p (gimple_omp_body (gs)))
1470	{
1471	  newline_and_indent (buffer, spc + 2);
1472	  pp_left_brace (buffer);
1473	  pp_newline (buffer);
1474	  dump_gimple_seq (buffer, gimple_omp_body (gs), spc + 4, flags);
1475	  newline_and_indent (buffer, spc + 2);
1476	  pp_right_brace (buffer);
1477	}
1478    }
1479}
1480
1481/* Dump a GIMPLE_OMP_{MASTER,TASKGROUP,ORDERED,SECTION} tuple on the
1482   pretty_printer BUFFER.  */
1483
1484static void
1485dump_gimple_omp_block (pretty_printer *buffer, gimple gs, int spc, int flags)
1486{
1487  if (flags & TDF_RAW)
1488    dump_gimple_fmt (buffer, spc, flags, "%G <%+BODY <%S> >", gs,
1489		     gimple_omp_body (gs));
1490  else
1491    {
1492      switch (gimple_code (gs))
1493	{
1494	case GIMPLE_OMP_MASTER:
1495	  pp_string (buffer, "#pragma omp master");
1496	  break;
1497	case GIMPLE_OMP_TASKGROUP:
1498	  pp_string (buffer, "#pragma omp taskgroup");
1499	  break;
1500	case GIMPLE_OMP_ORDERED:
1501	  pp_string (buffer, "#pragma omp ordered");
1502	  break;
1503	case GIMPLE_OMP_SECTION:
1504	  pp_string (buffer, "#pragma omp section");
1505	  break;
1506	default:
1507	  gcc_unreachable ();
1508	}
1509      if (!gimple_seq_empty_p (gimple_omp_body (gs)))
1510	{
1511	  newline_and_indent (buffer, spc + 2);
1512	  pp_left_brace (buffer);
1513	  pp_newline (buffer);
1514	  dump_gimple_seq (buffer, gimple_omp_body (gs), spc + 4, flags);
1515	  newline_and_indent (buffer, spc + 2);
1516	  pp_right_brace (buffer);
1517	}
1518    }
1519}
1520
1521/* Dump a GIMPLE_OMP_CRITICAL tuple on the pretty_printer BUFFER.  */
1522
1523static void
1524dump_gimple_omp_critical (pretty_printer *buffer, gomp_critical *gs,
1525			  int spc, int flags)
1526{
1527  if (flags & TDF_RAW)
1528    dump_gimple_fmt (buffer, spc, flags, "%G <%+BODY <%S> >", gs,
1529		     gimple_omp_body (gs));
1530  else
1531    {
1532      pp_string (buffer, "#pragma omp critical");
1533      if (gimple_omp_critical_name (gs))
1534	{
1535	  pp_string (buffer, " (");
1536	  dump_generic_node (buffer, gimple_omp_critical_name (gs), spc,
1537			     flags, false);
1538	  pp_right_paren (buffer);
1539	}
1540      if (!gimple_seq_empty_p (gimple_omp_body (gs)))
1541	{
1542	  newline_and_indent (buffer, spc + 2);
1543	  pp_left_brace (buffer);
1544	  pp_newline (buffer);
1545	  dump_gimple_seq (buffer, gimple_omp_body (gs), spc + 4, flags);
1546	  newline_and_indent (buffer, spc + 2);
1547	  pp_right_brace (buffer);
1548	}
1549    }
1550}
1551
1552/* Dump a GIMPLE_OMP_RETURN tuple on the pretty_printer BUFFER.  */
1553
1554static void
1555dump_gimple_omp_return (pretty_printer *buffer, gimple gs, int spc, int flags)
1556{
1557  if (flags & TDF_RAW)
1558    {
1559      dump_gimple_fmt (buffer, spc, flags, "%G <nowait=%d", gs,
1560                       (int) gimple_omp_return_nowait_p (gs));
1561      if (gimple_omp_return_lhs (gs))
1562	dump_gimple_fmt (buffer, spc, flags, ", lhs=%T>",
1563			 gimple_omp_return_lhs (gs));
1564      else
1565	dump_gimple_fmt (buffer, spc, flags, ">");
1566    }
1567  else
1568    {
1569      pp_string (buffer, "#pragma omp return");
1570      if (gimple_omp_return_nowait_p (gs))
1571	pp_string (buffer, "(nowait)");
1572      if (gimple_omp_return_lhs (gs))
1573	{
1574	  pp_string (buffer, " (set ");
1575	  dump_generic_node (buffer, gimple_omp_return_lhs (gs),
1576			     spc, flags, false);
1577	  pp_character (buffer, ')');
1578	}
1579    }
1580}
1581
1582/* Dump a GIMPLE_TRANSACTION tuple on the pretty_printer BUFFER.  */
1583
1584static void
1585dump_gimple_transaction (pretty_printer *buffer, gtransaction *gs,
1586			 int spc, int flags)
1587{
1588  unsigned subcode = gimple_transaction_subcode (gs);
1589
1590  if (flags & TDF_RAW)
1591    {
1592      dump_gimple_fmt (buffer, spc, flags,
1593		       "%G [SUBCODE=%x,LABEL=%T] <%+BODY <%S> >",
1594		       gs, subcode, gimple_transaction_label (gs),
1595		       gimple_transaction_body (gs));
1596    }
1597  else
1598    {
1599      if (subcode & GTMA_IS_OUTER)
1600	pp_string (buffer, "__transaction_atomic [[outer]]");
1601      else if (subcode & GTMA_IS_RELAXED)
1602	pp_string (buffer, "__transaction_relaxed");
1603      else
1604	pp_string (buffer, "__transaction_atomic");
1605      subcode &= ~GTMA_DECLARATION_MASK;
1606
1607      if (subcode || gimple_transaction_label (gs))
1608	{
1609	  pp_string (buffer, "  //");
1610	  if (gimple_transaction_label (gs))
1611	    {
1612	      pp_string (buffer, " LABEL=");
1613	      dump_generic_node (buffer, gimple_transaction_label (gs),
1614				 spc, flags, false);
1615	    }
1616	  if (subcode)
1617	    {
1618	      pp_string (buffer, " SUBCODE=[ ");
1619	      if (subcode & GTMA_HAVE_ABORT)
1620		{
1621		  pp_string (buffer, "GTMA_HAVE_ABORT ");
1622		  subcode &= ~GTMA_HAVE_ABORT;
1623		}
1624	      if (subcode & GTMA_HAVE_LOAD)
1625		{
1626		  pp_string (buffer, "GTMA_HAVE_LOAD ");
1627		  subcode &= ~GTMA_HAVE_LOAD;
1628		}
1629	      if (subcode & GTMA_HAVE_STORE)
1630		{
1631		  pp_string (buffer, "GTMA_HAVE_STORE ");
1632		  subcode &= ~GTMA_HAVE_STORE;
1633		}
1634	      if (subcode & GTMA_MAY_ENTER_IRREVOCABLE)
1635		{
1636		  pp_string (buffer, "GTMA_MAY_ENTER_IRREVOCABLE ");
1637		  subcode &= ~GTMA_MAY_ENTER_IRREVOCABLE;
1638		}
1639	      if (subcode & GTMA_DOES_GO_IRREVOCABLE)
1640		{
1641		  pp_string (buffer, "GTMA_DOES_GO_IRREVOCABLE ");
1642		  subcode &= ~GTMA_DOES_GO_IRREVOCABLE;
1643		}
1644	      if (subcode & GTMA_HAS_NO_INSTRUMENTATION)
1645		{
1646		  pp_string (buffer, "GTMA_HAS_NO_INSTRUMENTATION ");
1647		  subcode &= ~GTMA_HAS_NO_INSTRUMENTATION;
1648		}
1649	      if (subcode)
1650		pp_printf (buffer, "0x%x ", subcode);
1651	      pp_right_bracket (buffer);
1652	    }
1653	}
1654
1655      if (!gimple_seq_empty_p (gimple_transaction_body (gs)))
1656	{
1657	  newline_and_indent (buffer, spc + 2);
1658	  pp_left_brace (buffer);
1659	  pp_newline (buffer);
1660	  dump_gimple_seq (buffer, gimple_transaction_body (gs),
1661			   spc + 4, flags);
1662	  newline_and_indent (buffer, spc + 2);
1663	  pp_right_brace (buffer);
1664	}
1665    }
1666}
1667
1668/* Dump a GIMPLE_ASM tuple on the pretty_printer BUFFER, SPC spaces of
1669   indent.  FLAGS specifies details to show in the dump (see TDF_* in
1670   dumpfile.h).  */
1671
1672static void
1673dump_gimple_asm (pretty_printer *buffer, gasm *gs, int spc, int flags)
1674{
1675  unsigned int i, n, f, fields;
1676
1677  if (flags & TDF_RAW)
1678    {
1679      dump_gimple_fmt (buffer, spc, flags, "%G <%+STRING <%n%s%n>", gs,
1680                       gimple_asm_string (gs));
1681
1682      n = gimple_asm_noutputs (gs);
1683      if (n)
1684	{
1685	  newline_and_indent (buffer, spc + 2);
1686	  pp_string (buffer, "OUTPUT: ");
1687	  for (i = 0; i < n; i++)
1688	    {
1689	      dump_generic_node (buffer, gimple_asm_output_op (gs, i),
1690				 spc, flags, false);
1691	      if (i < n - 1)
1692		pp_string (buffer, ", ");
1693	    }
1694	}
1695
1696      n = gimple_asm_ninputs (gs);
1697      if (n)
1698	{
1699	  newline_and_indent (buffer, spc + 2);
1700	  pp_string (buffer, "INPUT: ");
1701	  for (i = 0; i < n; i++)
1702	    {
1703	      dump_generic_node (buffer, gimple_asm_input_op (gs, i),
1704				 spc, flags, false);
1705	      if (i < n - 1)
1706		pp_string (buffer, ", ");
1707	    }
1708	}
1709
1710      n = gimple_asm_nclobbers (gs);
1711      if (n)
1712	{
1713	  newline_and_indent (buffer, spc + 2);
1714	  pp_string (buffer, "CLOBBER: ");
1715	  for (i = 0; i < n; i++)
1716	    {
1717	      dump_generic_node (buffer, gimple_asm_clobber_op (gs, i),
1718				 spc, flags, false);
1719	      if (i < n - 1)
1720		pp_string (buffer, ", ");
1721	    }
1722	}
1723
1724      n = gimple_asm_nlabels (gs);
1725      if (n)
1726	{
1727	  newline_and_indent (buffer, spc + 2);
1728	  pp_string (buffer, "LABEL: ");
1729	  for (i = 0; i < n; i++)
1730	    {
1731	      dump_generic_node (buffer, gimple_asm_label_op (gs, i),
1732				 spc, flags, false);
1733	      if (i < n - 1)
1734		pp_string (buffer, ", ");
1735	    }
1736	}
1737
1738      newline_and_indent (buffer, spc);
1739      pp_greater (buffer);
1740    }
1741  else
1742    {
1743      pp_string (buffer, "__asm__");
1744      if (gimple_asm_volatile_p (gs))
1745	pp_string (buffer, " __volatile__");
1746      if (gimple_asm_nlabels (gs))
1747	pp_string (buffer, " goto");
1748      pp_string (buffer, "(\"");
1749      pp_string (buffer, gimple_asm_string (gs));
1750      pp_string (buffer, "\"");
1751
1752      if (gimple_asm_nlabels (gs))
1753	fields = 4;
1754      else if (gimple_asm_nclobbers (gs))
1755	fields = 3;
1756      else if (gimple_asm_ninputs (gs))
1757	fields = 2;
1758      else if (gimple_asm_noutputs (gs))
1759	fields = 1;
1760      else
1761	fields = 0;
1762
1763      for (f = 0; f < fields; ++f)
1764	{
1765	  pp_string (buffer, " : ");
1766
1767	  switch (f)
1768	    {
1769	    case 0:
1770	      n = gimple_asm_noutputs (gs);
1771	      for (i = 0; i < n; i++)
1772		{
1773		  dump_generic_node (buffer, gimple_asm_output_op (gs, i),
1774				     spc, flags, false);
1775		  if (i < n - 1)
1776		    pp_string (buffer, ", ");
1777		}
1778	      break;
1779
1780	    case 1:
1781	      n = gimple_asm_ninputs (gs);
1782	      for (i = 0; i < n; i++)
1783		{
1784		  dump_generic_node (buffer, gimple_asm_input_op (gs, i),
1785				     spc, flags, false);
1786		  if (i < n - 1)
1787		    pp_string (buffer, ", ");
1788		}
1789	      break;
1790
1791	    case 2:
1792	      n = gimple_asm_nclobbers (gs);
1793	      for (i = 0; i < n; i++)
1794		{
1795		  dump_generic_node (buffer, gimple_asm_clobber_op (gs, i),
1796				     spc, flags, false);
1797		  if (i < n - 1)
1798		    pp_string (buffer, ", ");
1799		}
1800	      break;
1801
1802	    case 3:
1803	      n = gimple_asm_nlabels (gs);
1804	      for (i = 0; i < n; i++)
1805		{
1806		  dump_generic_node (buffer, gimple_asm_label_op (gs, i),
1807				     spc, flags, false);
1808		  if (i < n - 1)
1809		    pp_string (buffer, ", ");
1810		}
1811	      break;
1812
1813	    default:
1814	      gcc_unreachable ();
1815	    }
1816	}
1817
1818      pp_string (buffer, ");");
1819    }
1820}
1821
1822/* Dump ptr_info and range_info for NODE on pretty_printer BUFFER with
1823   SPC spaces of indent.  */
1824
1825static void
1826dump_ssaname_info (pretty_printer *buffer, tree node, int spc)
1827{
1828  if (TREE_CODE (node) != SSA_NAME)
1829    return;
1830
1831  if (POINTER_TYPE_P (TREE_TYPE (node))
1832      && SSA_NAME_PTR_INFO (node))
1833    {
1834      unsigned int align, misalign;
1835      struct ptr_info_def *pi = SSA_NAME_PTR_INFO (node);
1836      pp_string (buffer, "# PT = ");
1837      pp_points_to_solution (buffer, &pi->pt);
1838      newline_and_indent (buffer, spc);
1839      if (get_ptr_info_alignment (pi, &align, &misalign))
1840	{
1841	  pp_printf (buffer, "# ALIGN = %u, MISALIGN = %u", align, misalign);
1842	  newline_and_indent (buffer, spc);
1843	}
1844    }
1845
1846  if (!POINTER_TYPE_P (TREE_TYPE (node))
1847      && SSA_NAME_RANGE_INFO (node))
1848    {
1849      wide_int min, max, nonzero_bits;
1850      value_range_type range_type = get_range_info (node, &min, &max);
1851
1852      if (range_type == VR_VARYING)
1853	pp_printf (buffer, "# RANGE VR_VARYING");
1854      else if (range_type == VR_RANGE || range_type == VR_ANTI_RANGE)
1855	{
1856	  pp_printf (buffer, "# RANGE ");
1857	  pp_printf (buffer, "%s[", range_type == VR_RANGE ? "" : "~");
1858	  pp_wide_int (buffer, min, TYPE_SIGN (TREE_TYPE (node)));
1859	  pp_printf (buffer, ", ");
1860	  pp_wide_int (buffer, max, TYPE_SIGN (TREE_TYPE (node)));
1861	  pp_printf (buffer, "]");
1862	}
1863      nonzero_bits = get_nonzero_bits (node);
1864      if (nonzero_bits != -1)
1865	{
1866	  pp_string (buffer, " NONZERO ");
1867	  pp_wide_int (buffer, nonzero_bits, UNSIGNED);
1868	}
1869      newline_and_indent (buffer, spc);
1870    }
1871}
1872
1873
1874/* Dump a PHI node PHI.  BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1.
1875   The caller is responsible for calling pp_flush on BUFFER to finalize
1876   pretty printer.  If COMMENT is true, print this after #.  */
1877
1878static void
1879dump_gimple_phi (pretty_printer *buffer, gphi *phi, int spc, bool comment,
1880		 int flags)
1881{
1882  size_t i;
1883  tree lhs = gimple_phi_result (phi);
1884
1885  if (flags & TDF_ALIAS)
1886    dump_ssaname_info (buffer, lhs, spc);
1887
1888  if (comment)
1889    pp_string (buffer, "# ");
1890
1891  if (flags & TDF_RAW)
1892    dump_gimple_fmt (buffer, spc, flags, "%G <%T, ", phi,
1893		     gimple_phi_result (phi));
1894  else
1895    {
1896      dump_generic_node (buffer, lhs, spc, flags, false);
1897      pp_string (buffer, " = PHI <");
1898    }
1899  for (i = 0; i < gimple_phi_num_args (phi); i++)
1900    {
1901      if ((flags & TDF_LINENO) && gimple_phi_arg_has_location (phi, i))
1902	dump_location (buffer, gimple_phi_arg_location (phi, i));
1903      dump_generic_node (buffer, gimple_phi_arg_def (phi, i), spc, flags,
1904			 false);
1905      pp_left_paren (buffer);
1906      pp_decimal_int (buffer, gimple_phi_arg_edge (phi, i)->src->index);
1907      pp_right_paren (buffer);
1908      if (i < gimple_phi_num_args (phi) - 1)
1909	pp_string (buffer, ", ");
1910    }
1911  pp_greater (buffer);
1912}
1913
1914
1915/* Dump a GIMPLE_OMP_PARALLEL tuple on the pretty_printer BUFFER, SPC spaces
1916   of indent.  FLAGS specifies details to show in the dump (see TDF_* in
1917   dumpfile.h).  */
1918
1919static void
1920dump_gimple_omp_parallel (pretty_printer *buffer, gomp_parallel *gs,
1921			  int spc, int flags)
1922{
1923  if (flags & TDF_RAW)
1924    {
1925      dump_gimple_fmt (buffer, spc, flags, "%G <%+BODY <%S>%nCLAUSES <", gs,
1926                       gimple_omp_body (gs));
1927      dump_omp_clauses (buffer, gimple_omp_parallel_clauses (gs), spc, flags);
1928      dump_gimple_fmt (buffer, spc, flags, " >, %T, %T%n>",
1929                       gimple_omp_parallel_child_fn (gs),
1930                       gimple_omp_parallel_data_arg (gs));
1931    }
1932  else
1933    {
1934      gimple_seq body;
1935      pp_string (buffer, "#pragma omp parallel");
1936      dump_omp_clauses (buffer, gimple_omp_parallel_clauses (gs), spc, flags);
1937      if (gimple_omp_parallel_child_fn (gs))
1938	{
1939	  pp_string (buffer, " [child fn: ");
1940	  dump_generic_node (buffer, gimple_omp_parallel_child_fn (gs),
1941			     spc, flags, false);
1942	  pp_string (buffer, " (");
1943	  if (gimple_omp_parallel_data_arg (gs))
1944	    dump_generic_node (buffer, gimple_omp_parallel_data_arg (gs),
1945			       spc, flags, false);
1946	  else
1947	    pp_string (buffer, "???");
1948	  pp_string (buffer, ")]");
1949	}
1950      body = gimple_omp_body (gs);
1951      if (body && gimple_code (gimple_seq_first_stmt (body)) != GIMPLE_BIND)
1952	{
1953	  newline_and_indent (buffer, spc + 2);
1954	  pp_left_brace (buffer);
1955	  pp_newline (buffer);
1956	  dump_gimple_seq (buffer, body, spc + 4, flags);
1957	  newline_and_indent (buffer, spc + 2);
1958	  pp_right_brace (buffer);
1959	}
1960      else if (body)
1961	{
1962	  pp_newline (buffer);
1963	  dump_gimple_seq (buffer, body, spc + 2, flags);
1964	}
1965    }
1966}
1967
1968
1969/* Dump a GIMPLE_OMP_TASK tuple on the pretty_printer BUFFER, SPC spaces
1970   of indent.  FLAGS specifies details to show in the dump (see TDF_* in
1971   dumpfile.h).  */
1972
1973static void
1974dump_gimple_omp_task (pretty_printer *buffer, gomp_task *gs, int spc,
1975		      int flags)
1976{
1977  if (flags & TDF_RAW)
1978    {
1979      dump_gimple_fmt (buffer, spc, flags, "%G <%+BODY <%S>%nCLAUSES <", gs,
1980                       gimple_omp_body (gs));
1981      dump_omp_clauses (buffer, gimple_omp_task_clauses (gs), spc, flags);
1982      dump_gimple_fmt (buffer, spc, flags, " >, %T, %T, %T, %T, %T%n>",
1983                       gimple_omp_task_child_fn (gs),
1984                       gimple_omp_task_data_arg (gs),
1985		       gimple_omp_task_copy_fn (gs),
1986		       gimple_omp_task_arg_size (gs),
1987		       gimple_omp_task_arg_size (gs));
1988    }
1989  else
1990    {
1991      gimple_seq body;
1992      pp_string (buffer, "#pragma omp task");
1993      dump_omp_clauses (buffer, gimple_omp_task_clauses (gs), spc, flags);
1994      if (gimple_omp_task_child_fn (gs))
1995	{
1996	  pp_string (buffer, " [child fn: ");
1997	  dump_generic_node (buffer, gimple_omp_task_child_fn (gs),
1998			     spc, flags, false);
1999	  pp_string (buffer, " (");
2000	  if (gimple_omp_task_data_arg (gs))
2001	    dump_generic_node (buffer, gimple_omp_task_data_arg (gs),
2002			       spc, flags, false);
2003	  else
2004	    pp_string (buffer, "???");
2005	  pp_string (buffer, ")]");
2006	}
2007      body = gimple_omp_body (gs);
2008      if (body && gimple_code (gimple_seq_first_stmt (body)) != GIMPLE_BIND)
2009	{
2010	  newline_and_indent (buffer, spc + 2);
2011	  pp_left_brace (buffer);
2012	  pp_newline (buffer);
2013	  dump_gimple_seq (buffer, body, spc + 4, flags);
2014	  newline_and_indent (buffer, spc + 2);
2015	  pp_right_brace (buffer);
2016	}
2017      else if (body)
2018	{
2019	  pp_newline (buffer);
2020	  dump_gimple_seq (buffer, body, spc + 2, flags);
2021	}
2022    }
2023}
2024
2025
2026/* Dump a GIMPLE_OMP_ATOMIC_LOAD tuple on the pretty_printer BUFFER, SPC
2027   spaces of indent.  FLAGS specifies details to show in the dump (see TDF_*
2028   in dumpfile.h).  */
2029
2030static void
2031dump_gimple_omp_atomic_load (pretty_printer *buffer, gomp_atomic_load *gs,
2032			     int spc, int flags)
2033{
2034  if (flags & TDF_RAW)
2035    {
2036      dump_gimple_fmt (buffer, spc, flags, "%G <%T, %T>", gs,
2037                       gimple_omp_atomic_load_lhs (gs),
2038                       gimple_omp_atomic_load_rhs (gs));
2039    }
2040  else
2041    {
2042      pp_string (buffer, "#pragma omp atomic_load");
2043      if (gimple_omp_atomic_seq_cst_p (gs))
2044	pp_string (buffer, " seq_cst");
2045      if (gimple_omp_atomic_need_value_p (gs))
2046	pp_string (buffer, " [needed]");
2047      newline_and_indent (buffer, spc + 2);
2048      dump_generic_node (buffer, gimple_omp_atomic_load_lhs (gs),
2049	  		 spc, flags, false);
2050      pp_space (buffer);
2051      pp_equal (buffer);
2052      pp_space (buffer);
2053      pp_star (buffer);
2054      dump_generic_node (buffer, gimple_omp_atomic_load_rhs (gs),
2055	  		 spc, flags, false);
2056    }
2057}
2058
2059/* Dump a GIMPLE_OMP_ATOMIC_STORE tuple on the pretty_printer BUFFER, SPC
2060   spaces of indent.  FLAGS specifies details to show in the dump (see TDF_*
2061   in dumpfile.h).  */
2062
2063static void
2064dump_gimple_omp_atomic_store (pretty_printer *buffer,
2065			      gomp_atomic_store *gs, int spc, int flags)
2066{
2067  if (flags & TDF_RAW)
2068    {
2069      dump_gimple_fmt (buffer, spc, flags, "%G <%T>", gs,
2070                       gimple_omp_atomic_store_val (gs));
2071    }
2072  else
2073    {
2074      pp_string (buffer, "#pragma omp atomic_store ");
2075      if (gimple_omp_atomic_seq_cst_p (gs))
2076	pp_string (buffer, "seq_cst ");
2077      if (gimple_omp_atomic_need_value_p (gs))
2078	pp_string (buffer, "[needed] ");
2079      pp_left_paren (buffer);
2080      dump_generic_node (buffer, gimple_omp_atomic_store_val (gs),
2081	  		 spc, flags, false);
2082      pp_right_paren (buffer);
2083    }
2084}
2085
2086
2087/* Dump all the memory operands for statement GS.  BUFFER, SPC and
2088   FLAGS are as in pp_gimple_stmt_1.  */
2089
2090static void
2091dump_gimple_mem_ops (pretty_printer *buffer, gimple gs, int spc, int flags)
2092{
2093  tree vdef = gimple_vdef (gs);
2094  tree vuse = gimple_vuse (gs);
2095
2096  if (vdef != NULL_TREE)
2097    {
2098      pp_string (buffer, "# ");
2099      dump_generic_node (buffer, vdef, spc + 2, flags, false);
2100      pp_string (buffer, " = VDEF <");
2101      dump_generic_node (buffer, vuse, spc + 2, flags, false);
2102      pp_greater (buffer);
2103      newline_and_indent (buffer, spc);
2104    }
2105  else if (vuse != NULL_TREE)
2106    {
2107      pp_string (buffer, "# VUSE <");
2108      dump_generic_node (buffer, vuse, spc + 2, flags, false);
2109      pp_greater (buffer);
2110      newline_and_indent (buffer, spc);
2111    }
2112}
2113
2114
2115/* Print the gimple statement GS on the pretty printer BUFFER, SPC
2116   spaces of indent.  FLAGS specifies details to show in the dump (see
2117   TDF_* in dumpfile.h).  The caller is responsible for calling
2118   pp_flush on BUFFER to finalize the pretty printer.  */
2119
2120void
2121pp_gimple_stmt_1 (pretty_printer *buffer, gimple gs, int spc, int flags)
2122{
2123  if (!gs)
2124    return;
2125
2126  if (flags & TDF_STMTADDR)
2127    pp_printf (buffer, "<&%p> ", (void *) gs);
2128
2129  if ((flags & TDF_LINENO) && gimple_has_location (gs))
2130    dump_location (buffer, gimple_location (gs));
2131
2132  if (flags & TDF_EH)
2133    {
2134      int lp_nr = lookup_stmt_eh_lp (gs);
2135      if (lp_nr > 0)
2136	pp_printf (buffer, "[LP %d] ", lp_nr);
2137      else if (lp_nr < 0)
2138	pp_printf (buffer, "[MNT %d] ", -lp_nr);
2139    }
2140
2141  if ((flags & (TDF_VOPS|TDF_MEMSYMS))
2142      && gimple_has_mem_ops (gs))
2143    dump_gimple_mem_ops (buffer, gs, spc, flags);
2144
2145  if (gimple_has_lhs (gs)
2146      && (flags & TDF_ALIAS))
2147    dump_ssaname_info (buffer, gimple_get_lhs (gs), spc);
2148
2149  switch (gimple_code (gs))
2150    {
2151    case GIMPLE_ASM:
2152      dump_gimple_asm (buffer, as_a <gasm *> (gs), spc, flags);
2153      break;
2154
2155    case GIMPLE_ASSIGN:
2156      dump_gimple_assign (buffer, as_a <gassign *> (gs), spc, flags);
2157      break;
2158
2159    case GIMPLE_BIND:
2160      dump_gimple_bind (buffer, as_a <gbind *> (gs), spc, flags);
2161      break;
2162
2163    case GIMPLE_CALL:
2164      dump_gimple_call (buffer, as_a <gcall *> (gs), spc, flags);
2165      break;
2166
2167    case GIMPLE_COND:
2168      dump_gimple_cond (buffer, as_a <gcond *> (gs), spc, flags);
2169      break;
2170
2171    case GIMPLE_LABEL:
2172      dump_gimple_label (buffer, as_a <glabel *> (gs), spc, flags);
2173      break;
2174
2175    case GIMPLE_GOTO:
2176      dump_gimple_goto (buffer, as_a <ggoto *> (gs), spc, flags);
2177      break;
2178
2179    case GIMPLE_NOP:
2180      pp_string (buffer, "GIMPLE_NOP");
2181      break;
2182
2183    case GIMPLE_RETURN:
2184      dump_gimple_return (buffer, as_a <greturn *> (gs), spc, flags);
2185      break;
2186
2187    case GIMPLE_SWITCH:
2188      dump_gimple_switch (buffer, as_a <gswitch *> (gs), spc, flags);
2189      break;
2190
2191    case GIMPLE_TRY:
2192      dump_gimple_try (buffer, as_a <gtry *> (gs), spc, flags);
2193      break;
2194
2195    case GIMPLE_PHI:
2196      dump_gimple_phi (buffer, as_a <gphi *> (gs), spc, false, flags);
2197      break;
2198
2199    case GIMPLE_OMP_PARALLEL:
2200      dump_gimple_omp_parallel (buffer, as_a <gomp_parallel *> (gs), spc,
2201				flags);
2202      break;
2203
2204    case GIMPLE_OMP_TASK:
2205      dump_gimple_omp_task (buffer, as_a <gomp_task *> (gs), spc, flags);
2206      break;
2207
2208    case GIMPLE_OMP_ATOMIC_LOAD:
2209      dump_gimple_omp_atomic_load (buffer, as_a <gomp_atomic_load *> (gs),
2210				   spc, flags);
2211      break;
2212
2213    case GIMPLE_OMP_ATOMIC_STORE:
2214      dump_gimple_omp_atomic_store (buffer,
2215				    as_a <gomp_atomic_store *> (gs),
2216				    spc, flags);
2217      break;
2218
2219    case GIMPLE_OMP_FOR:
2220      dump_gimple_omp_for (buffer, as_a <gomp_for *> (gs), spc, flags);
2221      break;
2222
2223    case GIMPLE_OMP_CONTINUE:
2224      dump_gimple_omp_continue (buffer, as_a <gomp_continue *> (gs), spc,
2225				flags);
2226      break;
2227
2228    case GIMPLE_OMP_SINGLE:
2229      dump_gimple_omp_single (buffer, as_a <gomp_single *> (gs), spc,
2230			      flags);
2231      break;
2232
2233    case GIMPLE_OMP_TARGET:
2234      dump_gimple_omp_target (buffer, as_a <gomp_target *> (gs), spc,
2235			      flags);
2236      break;
2237
2238    case GIMPLE_OMP_TEAMS:
2239      dump_gimple_omp_teams (buffer, as_a <gomp_teams *> (gs), spc,
2240			     flags);
2241      break;
2242
2243    case GIMPLE_OMP_RETURN:
2244      dump_gimple_omp_return (buffer, gs, spc, flags);
2245      break;
2246
2247    case GIMPLE_OMP_SECTIONS:
2248      dump_gimple_omp_sections (buffer, as_a <gomp_sections *> (gs),
2249				spc, flags);
2250      break;
2251
2252    case GIMPLE_OMP_SECTIONS_SWITCH:
2253      pp_string (buffer, "GIMPLE_SECTIONS_SWITCH");
2254      break;
2255
2256    case GIMPLE_OMP_MASTER:
2257    case GIMPLE_OMP_TASKGROUP:
2258    case GIMPLE_OMP_ORDERED:
2259    case GIMPLE_OMP_SECTION:
2260      dump_gimple_omp_block (buffer, gs, spc, flags);
2261      break;
2262
2263    case GIMPLE_OMP_CRITICAL:
2264      dump_gimple_omp_critical (buffer, as_a <gomp_critical *> (gs), spc,
2265				flags);
2266      break;
2267
2268    case GIMPLE_CATCH:
2269      dump_gimple_catch (buffer, as_a <gcatch *> (gs), spc, flags);
2270      break;
2271
2272    case GIMPLE_EH_FILTER:
2273      dump_gimple_eh_filter (buffer, as_a <geh_filter *> (gs), spc, flags);
2274      break;
2275
2276    case GIMPLE_EH_MUST_NOT_THROW:
2277      dump_gimple_eh_must_not_throw (buffer,
2278				     as_a <geh_mnt *> (gs),
2279				     spc, flags);
2280      break;
2281
2282    case GIMPLE_EH_ELSE:
2283      dump_gimple_eh_else (buffer, as_a <geh_else *> (gs), spc, flags);
2284      break;
2285
2286    case GIMPLE_RESX:
2287      dump_gimple_resx (buffer, as_a <gresx *> (gs), spc, flags);
2288      break;
2289
2290    case GIMPLE_EH_DISPATCH:
2291      dump_gimple_eh_dispatch (buffer, as_a <geh_dispatch *> (gs), spc,
2292			       flags);
2293      break;
2294
2295    case GIMPLE_DEBUG:
2296      dump_gimple_debug (buffer, as_a <gdebug *> (gs), spc, flags);
2297      break;
2298
2299    case GIMPLE_PREDICT:
2300      pp_string (buffer, "// predicted ");
2301      if (gimple_predict_outcome (gs))
2302	pp_string (buffer, "likely by ");
2303      else
2304	pp_string (buffer, "unlikely by ");
2305      pp_string (buffer, predictor_name (gimple_predict_predictor (gs)));
2306      pp_string (buffer, " predictor.");
2307      break;
2308
2309    case GIMPLE_TRANSACTION:
2310      dump_gimple_transaction (buffer, as_a <gtransaction *> (gs), spc,
2311			       flags);
2312      break;
2313
2314    default:
2315      GIMPLE_NIY;
2316    }
2317}
2318
2319
2320/* Dumps header of basic block BB to OUTF indented by INDENT
2321   spaces and details described by flags.  */
2322
2323static void
2324dump_gimple_bb_header (FILE *outf, basic_block bb, int indent, int flags)
2325{
2326  if (flags & TDF_BLOCKS)
2327    {
2328      if (flags & TDF_LINENO)
2329	{
2330	  gimple_stmt_iterator gsi;
2331
2332	  if (flags & TDF_COMMENT)
2333	    fputs (";; ", outf);
2334
2335	  for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
2336	    if (!is_gimple_debug (gsi_stmt (gsi))
2337		&& get_lineno (gsi_stmt (gsi)) != UNKNOWN_LOCATION)
2338	      {
2339		fprintf (outf, "%*sstarting at line %d",
2340			 indent, "", get_lineno (gsi_stmt (gsi)));
2341		break;
2342	      }
2343	  if (bb->discriminator)
2344	    fprintf (outf, ", discriminator %i", bb->discriminator);
2345	  fputc ('\n', outf);
2346	}
2347    }
2348  else
2349    {
2350      gimple stmt = first_stmt (bb);
2351      if (!stmt || gimple_code (stmt) != GIMPLE_LABEL)
2352	fprintf (outf, "%*s<bb %d>:\n", indent, "", bb->index);
2353    }
2354}
2355
2356
2357/* Dumps end of basic block BB to buffer BUFFER indented by INDENT
2358   spaces.  */
2359
2360static void
2361dump_gimple_bb_footer (FILE *outf ATTRIBUTE_UNUSED,
2362		       basic_block bb ATTRIBUTE_UNUSED,
2363		       int indent ATTRIBUTE_UNUSED,
2364		       int flags ATTRIBUTE_UNUSED)
2365{
2366  /* There is currently no GIMPLE-specific basic block info to dump.  */
2367  return;
2368}
2369
2370
2371/* Dump PHI nodes of basic block BB to BUFFER with details described
2372   by FLAGS and indented by INDENT spaces.  */
2373
2374static void
2375dump_phi_nodes (pretty_printer *buffer, basic_block bb, int indent, int flags)
2376{
2377  gphi_iterator i;
2378
2379  for (i = gsi_start_phis (bb); !gsi_end_p (i); gsi_next (&i))
2380    {
2381      gphi *phi = i.phi ();
2382      if (!virtual_operand_p (gimple_phi_result (phi)) || (flags & TDF_VOPS))
2383        {
2384          INDENT (indent);
2385	  dump_gimple_phi (buffer, phi, indent, true, flags);
2386          pp_newline (buffer);
2387        }
2388    }
2389}
2390
2391
2392/* Dump jump to basic block BB that is represented implicitly in the cfg
2393   to BUFFER.  */
2394
2395static void
2396pp_cfg_jump (pretty_printer *buffer, basic_block bb)
2397{
2398  gimple stmt;
2399
2400  stmt = first_stmt (bb);
2401
2402  pp_string (buffer, "goto <bb ");
2403  pp_decimal_int (buffer, bb->index);
2404  pp_greater (buffer);
2405  if (stmt && gimple_code (stmt) == GIMPLE_LABEL)
2406    {
2407      pp_string (buffer, " (");
2408      dump_generic_node (buffer,
2409			 gimple_label_label (as_a <glabel *> (stmt)),
2410			 0, 0, false);
2411      pp_right_paren (buffer);
2412      pp_semicolon (buffer);
2413    }
2414  else
2415    pp_semicolon (buffer);
2416}
2417
2418
2419/* Dump edges represented implicitly in basic block BB to BUFFER, indented
2420   by INDENT spaces, with details given by FLAGS.  */
2421
2422static void
2423dump_implicit_edges (pretty_printer *buffer, basic_block bb, int indent,
2424		     int flags)
2425{
2426  edge e;
2427  gimple stmt;
2428
2429  stmt = last_stmt (bb);
2430
2431  if (stmt && gimple_code (stmt) == GIMPLE_COND)
2432    {
2433      edge true_edge, false_edge;
2434
2435      /* When we are emitting the code or changing CFG, it is possible that
2436	 the edges are not yet created.  When we are using debug_bb in such
2437	 a situation, we do not want it to crash.  */
2438      if (EDGE_COUNT (bb->succs) != 2)
2439	return;
2440      extract_true_false_edges_from_block (bb, &true_edge, &false_edge);
2441
2442      INDENT (indent + 2);
2443      pp_cfg_jump (buffer, true_edge->dest);
2444      newline_and_indent (buffer, indent);
2445      pp_string (buffer, "else");
2446      newline_and_indent (buffer, indent + 2);
2447      pp_cfg_jump (buffer, false_edge->dest);
2448      pp_newline (buffer);
2449      return;
2450    }
2451
2452  /* If there is a fallthru edge, we may need to add an artificial
2453     goto to the dump.  */
2454  e = find_fallthru_edge (bb->succs);
2455
2456  if (e && e->dest != bb->next_bb)
2457    {
2458      INDENT (indent);
2459
2460      if ((flags & TDF_LINENO)
2461	  && e->goto_locus != UNKNOWN_LOCATION)
2462	dump_location (buffer, e->goto_locus);
2463
2464      pp_cfg_jump (buffer, e->dest);
2465      pp_newline (buffer);
2466    }
2467}
2468
2469
2470/* Dumps basic block BB to buffer BUFFER with details described by FLAGS and
2471   indented by INDENT spaces.  */
2472
2473static void
2474gimple_dump_bb_buff (pretty_printer *buffer, basic_block bb, int indent,
2475		     int flags)
2476{
2477  gimple_stmt_iterator gsi;
2478  gimple stmt;
2479  int label_indent = indent - 2;
2480
2481  if (label_indent < 0)
2482    label_indent = 0;
2483
2484  dump_phi_nodes (buffer, bb, indent, flags);
2485
2486  for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
2487    {
2488      int curr_indent;
2489
2490      stmt = gsi_stmt (gsi);
2491
2492      curr_indent = gimple_code (stmt) == GIMPLE_LABEL ? label_indent : indent;
2493
2494      INDENT (curr_indent);
2495      pp_gimple_stmt_1 (buffer, stmt, curr_indent, flags);
2496      pp_newline_and_flush (buffer);
2497      gcc_checking_assert (DECL_STRUCT_FUNCTION (current_function_decl));
2498      dump_histograms_for_stmt (DECL_STRUCT_FUNCTION (current_function_decl),
2499				pp_buffer (buffer)->stream, stmt);
2500    }
2501
2502  dump_implicit_edges (buffer, bb, indent, flags);
2503  pp_flush (buffer);
2504}
2505
2506
2507/* Dumps basic block BB to FILE with details described by FLAGS and
2508   indented by INDENT spaces.  */
2509
2510void
2511gimple_dump_bb (FILE *file, basic_block bb, int indent, int flags)
2512{
2513  dump_gimple_bb_header (file, bb, indent, flags);
2514  if (bb->index >= NUM_FIXED_BLOCKS)
2515    {
2516      pretty_printer buffer;
2517      pp_needs_newline (&buffer) = true;
2518      buffer.buffer->stream = file;
2519      gimple_dump_bb_buff (&buffer, bb, indent, flags);
2520    }
2521  dump_gimple_bb_footer (file, bb, indent, flags);
2522}
2523
2524/* Dumps basic block BB to pretty-printer PP with default dump flags and
2525   no indentation, for use as a label of a DOT graph record-node.
2526   ??? Should just use gimple_dump_bb_buff here, except that value profiling
2527   histogram dumping doesn't know about pretty-printers.  */
2528
2529void
2530gimple_dump_bb_for_graph (pretty_printer *pp, basic_block bb)
2531{
2532  pp_printf (pp, "<bb %d>:\n", bb->index);
2533  pp_write_text_as_dot_label_to_stream (pp, /*for_record=*/true);
2534
2535  for (gphi_iterator gsi = gsi_start_phis (bb); !gsi_end_p (gsi);
2536       gsi_next (&gsi))
2537    {
2538      gphi *phi = gsi.phi ();
2539      if (!virtual_operand_p (gimple_phi_result (phi))
2540	  || (dump_flags & TDF_VOPS))
2541	{
2542	  pp_bar (pp);
2543	  pp_write_text_to_stream (pp);
2544	  pp_string (pp, "# ");
2545	  pp_gimple_stmt_1 (pp, phi, 0, dump_flags);
2546	  pp_newline (pp);
2547	  pp_write_text_as_dot_label_to_stream (pp, /*for_record=*/true);
2548	}
2549    }
2550
2551  for (gimple_stmt_iterator gsi = gsi_start_bb (bb); !gsi_end_p (gsi);
2552       gsi_next (&gsi))
2553    {
2554      gimple stmt = gsi_stmt (gsi);
2555      pp_bar (pp);
2556      pp_write_text_to_stream (pp);
2557      pp_gimple_stmt_1 (pp, stmt, 0, dump_flags);
2558      pp_newline (pp);
2559      pp_write_text_as_dot_label_to_stream (pp, /*for_record=*/true);
2560    }
2561  dump_implicit_edges (pp, bb, 0, dump_flags);
2562  pp_write_text_as_dot_label_to_stream (pp, /*for_record=*/true);
2563}
2564
2565