1 /* Pretty formatting of GENERIC trees in C syntax.
2    Copyright (C) 2001-2021 Free Software Foundation, Inc.
3    Adapted from c-pretty-print.c by Diego Novillo <dnovillo@redhat.com>
4 
5 This file is part of GCC.
6 
7 GCC is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 3, or (at your option) any later
10 version.
11 
12 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15 for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING3.  If not see
19 <http://www.gnu.org/licenses/>.  */
20 
21 #include "config.h"
22 #include "system.h"
23 #include "coretypes.h"
24 #include "backend.h"
25 #include "rtl.h"
26 #include "tree.h"
27 #include "predict.h"
28 #include "cgraph.h"
29 #include "tree-pretty-print.h"
30 #include "stor-layout.h"
31 #include "langhooks.h"
32 #include "tree-iterator.h"
33 #include "dumpfile.h"
34 #include "internal-fn.h"
35 #include "gomp-constants.h"
36 #include "gimple.h"
37 #include "fold-const.h"
38 
39 /* Routines in this file get invoked via the default tree printer
40    used by diagnostics and thus they are called from pp_printf which
41    isn't reentrant.  Avoid using pp_printf in this file.  */
42 #pragma GCC poison pp_printf
43 
44 /* Disable warnings about quoting issues in the pp_xxx calls below
45    that (intentionally) don't follow GCC diagnostic conventions.  */
46 #if __GNUC__ >= 10
47 #  pragma GCC diagnostic push
48 #  pragma GCC diagnostic ignored "-Wformat-diag"
49 #endif
50 
51 /* Local functions, macros and variables.  */
52 static const char *op_symbol (const_tree);
53 static void newline_and_indent (pretty_printer *, int);
54 static void maybe_init_pretty_print (FILE *);
55 static void print_struct_decl (pretty_printer *, const_tree, int, dump_flags_t);
56 static void do_niy (pretty_printer *, const_tree, dump_flags_t);
57 
58 #define INDENT(SPACE) do { \
59   int i; for (i = 0; i<SPACE; i++) pp_space (pp); } while (0)
60 
61 #define NIY do_niy (pp, node, flags)
62 
63 static pretty_printer *tree_pp;
64 
65 /* Try to print something for an unknown tree code.  */
66 
67 static void
do_niy(pretty_printer * pp,const_tree node,dump_flags_t flags)68 do_niy (pretty_printer *pp, const_tree node, dump_flags_t flags)
69 {
70   int i, len;
71 
72   pp_string (pp, "<<< Unknown tree: ");
73   pp_string (pp, get_tree_code_name (TREE_CODE (node)));
74 
75   if (EXPR_P (node))
76     {
77       len = TREE_OPERAND_LENGTH (node);
78       for (i = 0; i < len; ++i)
79 	{
80 	  newline_and_indent (pp, 2);
81 	  dump_generic_node (pp, TREE_OPERAND (node, i), 2, flags, false);
82 	}
83     }
84 
85   pp_string (pp, " >>>");
86 }
87 
88 /* Debugging function to print out a generic expression.  */
89 
90 DEBUG_FUNCTION void
debug_generic_expr(tree t)91 debug_generic_expr (tree t)
92 {
93   print_generic_expr (stderr, t, TDF_VOPS|TDF_MEMSYMS);
94   fprintf (stderr, "\n");
95 }
96 
97 /* Debugging function to print out a generic statement.  */
98 
99 DEBUG_FUNCTION void
debug_generic_stmt(tree t)100 debug_generic_stmt (tree t)
101 {
102   print_generic_stmt (stderr, t, TDF_VOPS|TDF_MEMSYMS);
103   fprintf (stderr, "\n");
104 }
105 
106 /* Debugging function to print out a chain of trees .  */
107 
108 DEBUG_FUNCTION void
debug_tree_chain(tree t)109 debug_tree_chain (tree t)
110 {
111   hash_set<tree> seen;
112 
113   while (t)
114     {
115       print_generic_expr (stderr, t, TDF_VOPS|TDF_MEMSYMS|TDF_UID);
116       fprintf (stderr, " ");
117       t = TREE_CHAIN (t);
118       if (seen.add (t))
119 	{
120 	  fprintf (stderr, "... [cycled back to ");
121 	  print_generic_expr (stderr, t, TDF_VOPS|TDF_MEMSYMS|TDF_UID);
122 	  fprintf (stderr, "]");
123 	  break;
124 	}
125     }
126   fprintf (stderr, "\n");
127 }
128 
129 /* Prints declaration DECL to the FILE with details specified by FLAGS.  */
130 void
print_generic_decl(FILE * file,tree decl,dump_flags_t flags)131 print_generic_decl (FILE *file, tree decl, dump_flags_t flags)
132 {
133   maybe_init_pretty_print (file);
134   print_declaration (tree_pp, decl, 2, flags);
135   pp_write_text_to_stream (tree_pp);
136 }
137 
138 /* Print tree T, and its successors, on file FILE.  FLAGS specifies details
139    to show in the dump.  See TDF_* in dumpfile.h.  */
140 
141 void
print_generic_stmt(FILE * file,tree t,dump_flags_t flags)142 print_generic_stmt (FILE *file, tree t, dump_flags_t flags)
143 {
144   maybe_init_pretty_print (file);
145   dump_generic_node (tree_pp, t, 0, flags, true);
146   pp_newline_and_flush (tree_pp);
147 }
148 
149 /* Print tree T, and its successors, on file FILE.  FLAGS specifies details
150    to show in the dump.  See TDF_* in dumpfile.h.  The output is indented by
151    INDENT spaces.  */
152 
153 void
print_generic_stmt_indented(FILE * file,tree t,dump_flags_t flags,int indent)154 print_generic_stmt_indented (FILE *file, tree t, dump_flags_t flags, int indent)
155 {
156   int i;
157 
158   maybe_init_pretty_print (file);
159 
160   for (i = 0; i < indent; i++)
161     pp_space (tree_pp);
162   dump_generic_node (tree_pp, t, indent, flags, true);
163   pp_newline_and_flush (tree_pp);
164 }
165 
166 /* Print a single expression T on file FILE.  FLAGS specifies details to show
167    in the dump.  See TDF_* in dumpfile.h.  */
168 
169 void
print_generic_expr(FILE * file,tree t,dump_flags_t flags)170 print_generic_expr (FILE *file, tree t, dump_flags_t flags)
171 {
172   maybe_init_pretty_print (file);
173   dump_generic_node (tree_pp, t, 0, flags, false);
174   pp_flush (tree_pp);
175 }
176 
177 /* Print a single expression T to string, and return it.  The caller
178    must free the returned memory.  */
179 
180 char *
print_generic_expr_to_str(tree t)181 print_generic_expr_to_str (tree t)
182 {
183   pretty_printer pp;
184   dump_generic_node (&pp, t, 0, TDF_VOPS|TDF_MEMSYMS, false);
185   return xstrdup (pp_formatted_text (&pp));
186 }
187 
188 /* Dump NAME, an IDENTIFIER_POINTER, sanitized so that D<num> sequences
189    in it are replaced with Dxxxx, as long as they are at the start or
190    preceded by $ and at the end or followed by $.  See make_fancy_name
191    in tree-sra.c.  */
192 
193 static void
dump_fancy_name(pretty_printer * pp,tree name)194 dump_fancy_name (pretty_printer *pp, tree name)
195 {
196   int cnt = 0;
197   int length = IDENTIFIER_LENGTH (name);
198   const char *n = IDENTIFIER_POINTER (name);
199   do
200     {
201       n = strchr (n, 'D');
202       if (n == NULL)
203 	break;
204       if (ISDIGIT (n[1])
205 	  && (n == IDENTIFIER_POINTER (name) || n[-1] == '$'))
206 	{
207 	  int l = 2;
208 	  while (ISDIGIT (n[l]))
209 	    l++;
210 	  if (n[l] == '\0' || n[l] == '$')
211 	    {
212 	      cnt++;
213 	      length += 5 - l;
214 	    }
215 	  n += l;
216 	}
217       else
218 	n++;
219     }
220   while (1);
221   if (cnt == 0)
222     {
223       pp_tree_identifier (pp, name);
224       return;
225     }
226 
227   char *str = XNEWVEC (char, length + 1);
228   char *p = str;
229   const char *q;
230   q = n = IDENTIFIER_POINTER (name);
231   do
232     {
233       q = strchr (q, 'D');
234       if (q == NULL)
235 	break;
236       if (ISDIGIT (q[1])
237 	  && (q == IDENTIFIER_POINTER (name) || q[-1] == '$'))
238 	{
239 	  int l = 2;
240 	  while (ISDIGIT (q[l]))
241 	    l++;
242 	  if (q[l] == '\0' || q[l] == '$')
243 	    {
244 	      memcpy (p, n, q - n);
245 	      memcpy (p + (q - n), "Dxxxx", 5);
246 	      p += (q - n) + 5;
247 	      n = q + l;
248 	    }
249 	  q += l;
250 	}
251       else
252 	q++;
253     }
254   while (1);
255   memcpy (p, n, IDENTIFIER_LENGTH (name) - (n - IDENTIFIER_POINTER (name)));
256   str[length] = '\0';
257   if (pp_translate_identifiers (pp))
258     {
259       const char *text = identifier_to_locale (str);
260       pp_append_text (pp, text, text + strlen (text));
261     }
262   else
263     pp_append_text (pp, str, str + length);
264   XDELETEVEC (str);
265 }
266 
267 /* Dump the name of a _DECL node and its DECL_UID if TDF_UID is set
268    in FLAGS.  */
269 
270 static void
dump_decl_name(pretty_printer * pp,tree node,dump_flags_t flags)271 dump_decl_name (pretty_printer *pp, tree node, dump_flags_t flags)
272 {
273   tree name = DECL_NAME (node);
274   if (name)
275     {
276       if ((flags & TDF_ASMNAME)
277 	  && HAS_DECL_ASSEMBLER_NAME_P (node)
278 	  && DECL_ASSEMBLER_NAME_SET_P (node))
279 	pp_tree_identifier (pp, DECL_ASSEMBLER_NAME_RAW (node));
280       /* For -fcompare-debug don't dump DECL_NAMELESS names at all,
281 	 -g might have created more fancy names and their indexes
282 	 could get out of sync.  Usually those should be DECL_IGNORED_P
283 	 too, SRA can create even non-DECL_IGNORED_P DECL_NAMELESS fancy
284 	 names, let's hope those never get out of sync after doing the
285 	 dump_fancy_name sanitization.  */
286       else if ((flags & TDF_COMPARE_DEBUG)
287 	       && DECL_NAMELESS (node)
288 	       && DECL_IGNORED_P (node))
289 	name = NULL_TREE;
290       /* For DECL_NAMELESS names look for embedded uids in the
291 	 names and sanitize them for TDF_NOUID.  */
292       else if ((flags & TDF_NOUID) && DECL_NAMELESS (node))
293 	dump_fancy_name (pp, name);
294       else
295 	pp_tree_identifier (pp, name);
296     }
297   char uid_sep = (flags & TDF_GIMPLE) ? '_' : '.';
298   if ((flags & TDF_UID) || name == NULL_TREE)
299     {
300       if (TREE_CODE (node) == LABEL_DECL && LABEL_DECL_UID (node) != -1)
301 	{
302 	  pp_character (pp, 'L');
303 	  pp_character (pp, uid_sep);
304 	  pp_decimal_int (pp, (int) LABEL_DECL_UID (node));
305 	}
306       else if (TREE_CODE (node) == DEBUG_EXPR_DECL)
307 	{
308 	  if (flags & TDF_NOUID)
309 	    pp_string (pp, "D#xxxx");
310 	  else
311 	    {
312 	      pp_string (pp, "D#");
313 	      pp_decimal_int (pp, (int) DEBUG_TEMP_UID (node));
314 	    }
315 	}
316       else
317 	{
318 	  char c = TREE_CODE (node) == CONST_DECL ? 'C' : 'D';
319 	  pp_character (pp, c);
320 	  pp_character (pp, uid_sep);
321 	  if (flags & TDF_NOUID)
322 	    pp_string (pp, "xxxx");
323 	  else
324 	    pp_scalar (pp, "%u", DECL_UID (node));
325 	}
326     }
327   if ((flags & TDF_ALIAS) && DECL_PT_UID (node) != DECL_UID (node))
328     {
329       if (flags & TDF_NOUID)
330 	pp_string (pp, "ptD.xxxx");
331       else
332 	{
333 	  pp_string (pp, "ptD.");
334 	  pp_scalar (pp, "%u", DECL_PT_UID (node));
335 	}
336     }
337 }
338 
339 /* Like the above, but used for pretty printing function calls.  */
340 
341 static void
dump_function_name(pretty_printer * pp,tree node,dump_flags_t flags)342 dump_function_name (pretty_printer *pp, tree node, dump_flags_t flags)
343 {
344   if (CONVERT_EXPR_P (node))
345     node = TREE_OPERAND (node, 0);
346   if (DECL_NAME (node) && (flags & TDF_ASMNAME) == 0)
347     pp_string (pp, lang_hooks.decl_printable_name (node, 1));
348   else
349     dump_decl_name (pp, node, flags);
350 }
351 
352 /* Dump a function declaration.  NODE is the FUNCTION_TYPE.  PP, SPC and
353    FLAGS are as in dump_generic_node.  */
354 
355 static void
dump_function_declaration(pretty_printer * pp,tree node,int spc,dump_flags_t flags)356 dump_function_declaration (pretty_printer *pp, tree node,
357 			   int spc, dump_flags_t flags)
358 {
359   bool wrote_arg = false;
360   tree arg;
361 
362   pp_space (pp);
363   pp_left_paren (pp);
364 
365   /* Print the argument types.  */
366   arg = TYPE_ARG_TYPES (node);
367   while (arg && arg != void_list_node && arg != error_mark_node)
368     {
369       if (wrote_arg)
370 	{
371 	  pp_comma (pp);
372 	  pp_space (pp);
373 	}
374       wrote_arg = true;
375       dump_generic_node (pp, TREE_VALUE (arg), spc, flags, false);
376       arg = TREE_CHAIN (arg);
377     }
378 
379   /* Drop the trailing void_type_node if we had any previous argument.  */
380   if (arg == void_list_node && !wrote_arg)
381     pp_string (pp, "void");
382   /* Properly dump vararg function types.  */
383   else if (!arg && wrote_arg)
384     pp_string (pp, ", ...");
385   /* Avoid printing any arg for unprototyped functions.  */
386 
387   pp_right_paren (pp);
388 }
389 
390 /* Dump the domain associated with an array.  */
391 
392 static void
dump_array_domain(pretty_printer * pp,tree domain,int spc,dump_flags_t flags)393 dump_array_domain (pretty_printer *pp, tree domain, int spc, dump_flags_t flags)
394 {
395   pp_left_bracket (pp);
396   if (domain)
397     {
398       tree min = TYPE_MIN_VALUE (domain);
399       tree max = TYPE_MAX_VALUE (domain);
400 
401       if (min && max
402 	  && integer_zerop (min)
403 	  && tree_fits_shwi_p (max))
404 	pp_wide_integer (pp, tree_to_shwi (max) + 1);
405       else
406 	{
407 	  if (min)
408 	    dump_generic_node (pp, min, spc, flags, false);
409 	  pp_colon (pp);
410 	  if (max)
411 	    dump_generic_node (pp, max, spc, flags, false);
412 	}
413     }
414   else
415     pp_string (pp, "<unknown>");
416   pp_right_bracket (pp);
417 }
418 
419 
420 /* Dump OpenMP iterators ITER.  */
421 
422 static void
dump_omp_iterators(pretty_printer * pp,tree iter,int spc,dump_flags_t flags)423 dump_omp_iterators (pretty_printer *pp, tree iter, int spc, dump_flags_t flags)
424 {
425   pp_string (pp, "iterator(");
426   for (tree it = iter; it; it = TREE_CHAIN (it))
427     {
428       if (it != iter)
429 	pp_string (pp, ", ");
430       dump_generic_node (pp, TREE_TYPE (TREE_VEC_ELT (it, 0)), spc, flags,
431 			 false);
432       pp_space (pp);
433       dump_generic_node (pp, TREE_VEC_ELT (it, 0), spc, flags, false);
434       pp_equal (pp);
435       dump_generic_node (pp, TREE_VEC_ELT (it, 1), spc, flags, false);
436       pp_colon (pp);
437       dump_generic_node (pp, TREE_VEC_ELT (it, 2), spc, flags, false);
438       pp_colon (pp);
439       dump_generic_node (pp, TREE_VEC_ELT (it, 3), spc, flags, false);
440     }
441   pp_right_paren (pp);
442 }
443 
444 
445 /* Dump OpenMP clause CLAUSE.  PP, CLAUSE, SPC and FLAGS are as in
446    dump_generic_node.  */
447 
448 static void
dump_omp_clause(pretty_printer * pp,tree clause,int spc,dump_flags_t flags)449 dump_omp_clause (pretty_printer *pp, tree clause, int spc, dump_flags_t flags)
450 {
451   const char *name;
452   const char *modifier = NULL;
453   switch (OMP_CLAUSE_CODE (clause))
454     {
455     case OMP_CLAUSE_PRIVATE:
456       name = "private";
457       goto print_remap;
458     case OMP_CLAUSE_SHARED:
459       name = "shared";
460       goto print_remap;
461     case OMP_CLAUSE_FIRSTPRIVATE:
462       name = "firstprivate";
463       goto print_remap;
464     case OMP_CLAUSE_LASTPRIVATE:
465       name = "lastprivate";
466       if (OMP_CLAUSE_LASTPRIVATE_CONDITIONAL (clause))
467 	modifier = "conditional:";
468       goto print_remap;
469     case OMP_CLAUSE_COPYIN:
470       name = "copyin";
471       goto print_remap;
472     case OMP_CLAUSE_COPYPRIVATE:
473       name = "copyprivate";
474       goto print_remap;
475     case OMP_CLAUSE_UNIFORM:
476       name = "uniform";
477       goto print_remap;
478     case OMP_CLAUSE_USE_DEVICE_PTR:
479       name = "use_device_ptr";
480       if (OMP_CLAUSE_USE_DEVICE_PTR_IF_PRESENT (clause))
481 	modifier = "if_present:";
482       goto print_remap;
483     case OMP_CLAUSE_USE_DEVICE_ADDR:
484       name = "use_device_addr";
485       goto print_remap;
486     case OMP_CLAUSE_IS_DEVICE_PTR:
487       name = "is_device_ptr";
488       goto print_remap;
489     case OMP_CLAUSE_INCLUSIVE:
490       name = "inclusive";
491       goto print_remap;
492     case OMP_CLAUSE_EXCLUSIVE:
493       name = "exclusive";
494       goto print_remap;
495     case OMP_CLAUSE__LOOPTEMP_:
496       name = "_looptemp_";
497       goto print_remap;
498     case OMP_CLAUSE__REDUCTEMP_:
499       name = "_reductemp_";
500       goto print_remap;
501     case OMP_CLAUSE__CONDTEMP_:
502       name = "_condtemp_";
503       goto print_remap;
504     case OMP_CLAUSE__SCANTEMP_:
505       name = "_scantemp_";
506       goto print_remap;
507     case OMP_CLAUSE_TO_DECLARE:
508       name = "to";
509       goto print_remap;
510     case OMP_CLAUSE_LINK:
511       name = "link";
512       goto print_remap;
513     case OMP_CLAUSE_NONTEMPORAL:
514       name = "nontemporal";
515       goto print_remap;
516   print_remap:
517       pp_string (pp, name);
518       pp_left_paren (pp);
519       if (modifier)
520 	pp_string (pp, modifier);
521       dump_generic_node (pp, OMP_CLAUSE_DECL (clause),
522 			 spc, flags, false);
523       pp_right_paren (pp);
524       break;
525 
526     case OMP_CLAUSE_TASK_REDUCTION:
527     case OMP_CLAUSE_IN_REDUCTION:
528       pp_string (pp, OMP_CLAUSE_CODE (clause) == OMP_CLAUSE_IN_REDUCTION
529 		     ? "in_" : "task_");
530       /* FALLTHRU */
531     case OMP_CLAUSE_REDUCTION:
532       pp_string (pp, "reduction(");
533       if (OMP_CLAUSE_CODE (clause) == OMP_CLAUSE_REDUCTION)
534 	{
535 	  if (OMP_CLAUSE_REDUCTION_TASK (clause))
536 	    pp_string (pp, "task,");
537 	  else if (OMP_CLAUSE_REDUCTION_INSCAN (clause))
538 	    pp_string (pp, "inscan,");
539 	}
540       if (OMP_CLAUSE_REDUCTION_CODE (clause) != ERROR_MARK)
541 	{
542 	  pp_string (pp,
543 		     op_symbol_code (OMP_CLAUSE_REDUCTION_CODE (clause)));
544 	  pp_colon (pp);
545 	}
546       dump_generic_node (pp, OMP_CLAUSE_DECL (clause),
547 			 spc, flags, false);
548       pp_right_paren (pp);
549       break;
550 
551     case OMP_CLAUSE_IF:
552       pp_string (pp, "if(");
553       switch (OMP_CLAUSE_IF_MODIFIER (clause))
554 	{
555 	case ERROR_MARK: break;
556 	case VOID_CST: pp_string (pp, "cancel:"); break;
557 	case OMP_PARALLEL: pp_string (pp, "parallel:"); break;
558 	case OMP_SIMD: pp_string (pp, "simd:"); break;
559 	case OMP_TASK: pp_string (pp, "task:"); break;
560 	case OMP_TASKLOOP: pp_string (pp, "taskloop:"); break;
561 	case OMP_TARGET_DATA: pp_string (pp, "target data:"); break;
562 	case OMP_TARGET: pp_string (pp, "target:"); break;
563 	case OMP_TARGET_UPDATE: pp_string (pp, "target update:"); break;
564 	case OMP_TARGET_ENTER_DATA:
565 	  pp_string (pp, "target enter data:"); break;
566 	case OMP_TARGET_EXIT_DATA: pp_string (pp, "target exit data:"); break;
567 	default: gcc_unreachable ();
568 	}
569       dump_generic_node (pp, OMP_CLAUSE_IF_EXPR (clause),
570 			 spc, flags, false);
571       pp_right_paren (pp);
572       break;
573 
574     case OMP_CLAUSE_NUM_THREADS:
575       pp_string (pp, "num_threads(");
576       dump_generic_node (pp, OMP_CLAUSE_NUM_THREADS_EXPR (clause),
577 			 spc, flags, false);
578       pp_right_paren (pp);
579       break;
580 
581     case OMP_CLAUSE_NOWAIT:
582       pp_string (pp, "nowait");
583       break;
584     case OMP_CLAUSE_ORDERED:
585       pp_string (pp, "ordered");
586       if (OMP_CLAUSE_ORDERED_EXPR (clause))
587 	{
588 	  pp_left_paren (pp);
589 	  dump_generic_node (pp, OMP_CLAUSE_ORDERED_EXPR (clause),
590 			     spc, flags, false);
591 	  pp_right_paren (pp);
592 	}
593       break;
594 
595     case OMP_CLAUSE_DEFAULT:
596       pp_string (pp, "default(");
597       switch (OMP_CLAUSE_DEFAULT_KIND (clause))
598 	{
599 	case OMP_CLAUSE_DEFAULT_UNSPECIFIED:
600 	  break;
601 	case OMP_CLAUSE_DEFAULT_SHARED:
602 	  pp_string (pp, "shared");
603 	  break;
604 	case OMP_CLAUSE_DEFAULT_NONE:
605 	  pp_string (pp, "none");
606 	  break;
607 	case OMP_CLAUSE_DEFAULT_PRIVATE:
608 	  pp_string (pp, "private");
609 	  break;
610 	case OMP_CLAUSE_DEFAULT_FIRSTPRIVATE:
611 	  pp_string (pp, "firstprivate");
612 	  break;
613 	case OMP_CLAUSE_DEFAULT_PRESENT:
614 	  pp_string (pp, "present");
615 	  break;
616 	default:
617 	  gcc_unreachable ();
618 	}
619       pp_right_paren (pp);
620       break;
621 
622     case OMP_CLAUSE_SCHEDULE:
623       pp_string (pp, "schedule(");
624       if (OMP_CLAUSE_SCHEDULE_KIND (clause)
625 	  & (OMP_CLAUSE_SCHEDULE_MONOTONIC
626 	     | OMP_CLAUSE_SCHEDULE_NONMONOTONIC))
627 	{
628 	  if (OMP_CLAUSE_SCHEDULE_KIND (clause)
629 	      & OMP_CLAUSE_SCHEDULE_MONOTONIC)
630 	    pp_string (pp, "monotonic");
631 	  else
632 	    pp_string (pp, "nonmonotonic");
633 	  if (OMP_CLAUSE_SCHEDULE_SIMD (clause))
634 	    pp_comma (pp);
635 	  else
636 	    pp_colon (pp);
637 	}
638       if (OMP_CLAUSE_SCHEDULE_SIMD (clause))
639 	pp_string (pp, "simd:");
640 
641       switch (OMP_CLAUSE_SCHEDULE_KIND (clause) & OMP_CLAUSE_SCHEDULE_MASK)
642 	{
643 	case OMP_CLAUSE_SCHEDULE_STATIC:
644 	  pp_string (pp, "static");
645 	  break;
646 	case OMP_CLAUSE_SCHEDULE_DYNAMIC:
647 	  pp_string (pp, "dynamic");
648 	  break;
649 	case OMP_CLAUSE_SCHEDULE_GUIDED:
650 	  pp_string (pp, "guided");
651 	  break;
652 	case OMP_CLAUSE_SCHEDULE_RUNTIME:
653 	  pp_string (pp, "runtime");
654 	  break;
655 	case OMP_CLAUSE_SCHEDULE_AUTO:
656 	  pp_string (pp, "auto");
657 	  break;
658 	default:
659 	  gcc_unreachable ();
660 	}
661       if (OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (clause))
662 	{
663 	  pp_comma (pp);
664 	  dump_generic_node (pp, OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (clause),
665 			     spc, flags, false);
666 	}
667       pp_right_paren (pp);
668       break;
669 
670     case OMP_CLAUSE_UNTIED:
671       pp_string (pp, "untied");
672       break;
673 
674     case OMP_CLAUSE_COLLAPSE:
675       pp_string (pp, "collapse(");
676       dump_generic_node (pp, OMP_CLAUSE_COLLAPSE_EXPR (clause),
677 			 spc, flags, false);
678       pp_right_paren (pp);
679       break;
680 
681     case OMP_CLAUSE_FINAL:
682       pp_string (pp, "final(");
683       dump_generic_node (pp, OMP_CLAUSE_FINAL_EXPR (clause),
684 			 spc, flags, false);
685       pp_right_paren (pp);
686       break;
687 
688     case OMP_CLAUSE_MERGEABLE:
689       pp_string (pp, "mergeable");
690       break;
691 
692     case OMP_CLAUSE_LINEAR:
693       pp_string (pp, "linear(");
694       switch (OMP_CLAUSE_LINEAR_KIND (clause))
695 	{
696 	case OMP_CLAUSE_LINEAR_DEFAULT:
697 	  break;
698 	case OMP_CLAUSE_LINEAR_REF:
699 	  pp_string (pp, "ref(");
700 	  break;
701 	case OMP_CLAUSE_LINEAR_VAL:
702 	  pp_string (pp, "val(");
703 	  break;
704 	case OMP_CLAUSE_LINEAR_UVAL:
705 	  pp_string (pp, "uval(");
706 	  break;
707 	default:
708 	  gcc_unreachable ();
709 	}
710       dump_generic_node (pp, OMP_CLAUSE_DECL (clause),
711 			 spc, flags, false);
712       if (OMP_CLAUSE_LINEAR_KIND (clause) != OMP_CLAUSE_LINEAR_DEFAULT)
713 	pp_right_paren (pp);
714       pp_colon (pp);
715       dump_generic_node (pp, OMP_CLAUSE_LINEAR_STEP (clause),
716 			 spc, flags, false);
717       pp_right_paren (pp);
718       break;
719 
720     case OMP_CLAUSE_ALIGNED:
721       pp_string (pp, "aligned(");
722       dump_generic_node (pp, OMP_CLAUSE_DECL (clause),
723 			 spc, flags, false);
724       if (OMP_CLAUSE_ALIGNED_ALIGNMENT (clause))
725 	{
726 	  pp_colon (pp);
727 	  dump_generic_node (pp, OMP_CLAUSE_ALIGNED_ALIGNMENT (clause),
728 			     spc, flags, false);
729 	}
730       pp_right_paren (pp);
731       break;
732 
733     case OMP_CLAUSE_ALLOCATE:
734       pp_string (pp, "allocate(");
735       if (OMP_CLAUSE_ALLOCATE_ALLOCATOR (clause))
736 	{
737 	  dump_generic_node (pp, OMP_CLAUSE_ALLOCATE_ALLOCATOR (clause),
738 			     spc, flags, false);
739 	  pp_colon (pp);
740 	}
741       dump_generic_node (pp, OMP_CLAUSE_DECL (clause),
742 			 spc, flags, false);
743       pp_right_paren (pp);
744       break;
745 
746     case OMP_CLAUSE_DEPEND:
747       pp_string (pp, "depend(");
748       switch (OMP_CLAUSE_DEPEND_KIND (clause))
749 	{
750 	case OMP_CLAUSE_DEPEND_DEPOBJ:
751 	  name = "depobj";
752 	  break;
753 	case OMP_CLAUSE_DEPEND_IN:
754 	  name = "in";
755 	  break;
756 	case OMP_CLAUSE_DEPEND_OUT:
757 	  name = "out";
758 	  break;
759 	case OMP_CLAUSE_DEPEND_INOUT:
760 	  name = "inout";
761 	  break;
762 	case OMP_CLAUSE_DEPEND_MUTEXINOUTSET:
763 	  name = "mutexinoutset";
764 	  break;
765 	case OMP_CLAUSE_DEPEND_SOURCE:
766 	  pp_string (pp, "source)");
767 	  return;
768 	case OMP_CLAUSE_DEPEND_LAST:
769 	  name = "__internal__";
770 	  break;
771 	case OMP_CLAUSE_DEPEND_SINK:
772 	  pp_string (pp, "sink:");
773 	  for (tree t = OMP_CLAUSE_DECL (clause); t; t = TREE_CHAIN (t))
774 	    if (TREE_CODE (t) == TREE_LIST)
775 	      {
776 		dump_generic_node (pp, TREE_VALUE (t), spc, flags, false);
777 		if (TREE_PURPOSE (t) != integer_zero_node)
778 		  {
779 		    if (OMP_CLAUSE_DEPEND_SINK_NEGATIVE (t))
780 		      pp_minus (pp);
781 		    else
782 		      pp_plus (pp);
783 		    dump_generic_node (pp, TREE_PURPOSE (t), spc, flags,
784 				       false);
785 		  }
786 		if (TREE_CHAIN (t))
787 		  pp_comma (pp);
788 	      }
789 	    else
790 	      gcc_unreachable ();
791 	  pp_right_paren (pp);
792 	  return;
793 	default:
794 	  gcc_unreachable ();
795 	}
796       {
797 	tree t = OMP_CLAUSE_DECL (clause);
798 	if (TREE_CODE (t) == TREE_LIST
799 	    && TREE_PURPOSE (t)
800 	    && TREE_CODE (TREE_PURPOSE (t)) == TREE_VEC)
801 	  {
802 	    dump_omp_iterators (pp, TREE_PURPOSE (t), spc, flags);
803 	    pp_colon (pp);
804 	    t = TREE_VALUE (t);
805 	  }
806 	pp_string (pp, name);
807 	pp_colon (pp);
808 	dump_generic_node (pp, t, spc, flags, false);
809 	pp_right_paren (pp);
810       }
811       break;
812 
813     case OMP_CLAUSE_MAP:
814       pp_string (pp, "map(");
815       switch (OMP_CLAUSE_MAP_KIND (clause))
816 	{
817 	case GOMP_MAP_ALLOC:
818 	case GOMP_MAP_POINTER:
819 	  pp_string (pp, "alloc");
820 	  break;
821 	case GOMP_MAP_IF_PRESENT:
822 	  pp_string (pp, "no_alloc");
823 	  break;
824 	case GOMP_MAP_TO:
825 	case GOMP_MAP_TO_PSET:
826 	  pp_string (pp, "to");
827 	  break;
828 	case GOMP_MAP_FROM:
829 	  pp_string (pp, "from");
830 	  break;
831 	case GOMP_MAP_TOFROM:
832 	  pp_string (pp, "tofrom");
833 	  break;
834 	case GOMP_MAP_FORCE_ALLOC:
835 	  pp_string (pp, "force_alloc");
836 	  break;
837 	case GOMP_MAP_FORCE_TO:
838 	  pp_string (pp, "force_to");
839 	  break;
840 	case GOMP_MAP_FORCE_FROM:
841 	  pp_string (pp, "force_from");
842 	  break;
843 	case GOMP_MAP_FORCE_TOFROM:
844 	  pp_string (pp, "force_tofrom");
845 	  break;
846 	case GOMP_MAP_FORCE_PRESENT:
847 	  pp_string (pp, "force_present");
848 	  break;
849 	case GOMP_MAP_DELETE:
850 	  pp_string (pp, "delete");
851 	  break;
852 	case GOMP_MAP_FORCE_DEVICEPTR:
853 	  pp_string (pp, "force_deviceptr");
854 	  break;
855 	case GOMP_MAP_ALWAYS_TO:
856 	  pp_string (pp, "always,to");
857 	  break;
858 	case GOMP_MAP_ALWAYS_FROM:
859 	  pp_string (pp, "always,from");
860 	  break;
861 	case GOMP_MAP_ALWAYS_TOFROM:
862 	  pp_string (pp, "always,tofrom");
863 	  break;
864 	case GOMP_MAP_RELEASE:
865 	  pp_string (pp, "release");
866 	  break;
867 	case GOMP_MAP_FIRSTPRIVATE_POINTER:
868 	  pp_string (pp, "firstprivate");
869 	  break;
870 	case GOMP_MAP_FIRSTPRIVATE_REFERENCE:
871 	  pp_string (pp, "firstprivate ref");
872 	  break;
873 	case GOMP_MAP_STRUCT:
874 	  pp_string (pp, "struct");
875 	  break;
876 	case GOMP_MAP_ALWAYS_POINTER:
877 	  pp_string (pp, "always_pointer");
878 	  break;
879 	case GOMP_MAP_DEVICE_RESIDENT:
880 	  pp_string (pp, "device_resident");
881 	  break;
882 	case GOMP_MAP_LINK:
883 	  pp_string (pp, "link");
884 	  break;
885 	case GOMP_MAP_ATTACH:
886 	  pp_string (pp, "attach");
887 	  break;
888 	case GOMP_MAP_DETACH:
889 	  pp_string (pp, "detach");
890 	  break;
891 	case GOMP_MAP_FORCE_DETACH:
892 	  pp_string (pp, "force_detach");
893 	  break;
894 	case GOMP_MAP_ATTACH_DETACH:
895 	  pp_string (pp, "attach_detach");
896 	  break;
897 	default:
898 	  gcc_unreachable ();
899 	}
900       pp_colon (pp);
901       dump_generic_node (pp, OMP_CLAUSE_DECL (clause),
902 			 spc, flags, false);
903      print_clause_size:
904       if (OMP_CLAUSE_SIZE (clause))
905 	{
906 	  switch (OMP_CLAUSE_CODE (clause) == OMP_CLAUSE_MAP
907 		  ? OMP_CLAUSE_MAP_KIND (clause) : GOMP_MAP_TO)
908 	    {
909 	    case GOMP_MAP_POINTER:
910 	    case GOMP_MAP_FIRSTPRIVATE_POINTER:
911 	    case GOMP_MAP_FIRSTPRIVATE_REFERENCE:
912 	    case GOMP_MAP_ALWAYS_POINTER:
913 	      pp_string (pp, " [pointer assign, bias: ");
914 	      break;
915 	    case GOMP_MAP_TO_PSET:
916 	      pp_string (pp, " [pointer set, len: ");
917 	      break;
918 	    case GOMP_MAP_ATTACH:
919 	    case GOMP_MAP_DETACH:
920 	    case GOMP_MAP_FORCE_DETACH:
921 	    case GOMP_MAP_ATTACH_DETACH:
922 	      pp_string (pp, " [bias: ");
923 	      break;
924 	    default:
925 	      pp_string (pp, " [len: ");
926 	      break;
927 	    }
928 	  dump_generic_node (pp, OMP_CLAUSE_SIZE (clause),
929 			     spc, flags, false);
930 	  pp_right_bracket (pp);
931 	}
932       pp_right_paren (pp);
933       break;
934 
935     case OMP_CLAUSE_FROM:
936       pp_string (pp, "from(");
937       dump_generic_node (pp, OMP_CLAUSE_DECL (clause),
938 			 spc, flags, false);
939       goto print_clause_size;
940 
941     case OMP_CLAUSE_TO:
942       pp_string (pp, "to(");
943       dump_generic_node (pp, OMP_CLAUSE_DECL (clause),
944 			 spc, flags, false);
945       goto print_clause_size;
946 
947     case OMP_CLAUSE__CACHE_:
948       pp_string (pp, "(");
949       dump_generic_node (pp, OMP_CLAUSE_DECL (clause),
950 			 spc, flags, false);
951       goto print_clause_size;
952 
953     case OMP_CLAUSE_NUM_TEAMS:
954       pp_string (pp, "num_teams(");
955       dump_generic_node (pp, OMP_CLAUSE_NUM_TEAMS_EXPR (clause),
956 			 spc, flags, false);
957       pp_right_paren (pp);
958       break;
959 
960     case OMP_CLAUSE_THREAD_LIMIT:
961       pp_string (pp, "thread_limit(");
962       dump_generic_node (pp, OMP_CLAUSE_THREAD_LIMIT_EXPR (clause),
963 			 spc, flags, false);
964       pp_right_paren (pp);
965       break;
966 
967     case OMP_CLAUSE_DEVICE:
968       pp_string (pp, "device(");
969       dump_generic_node (pp, OMP_CLAUSE_DEVICE_ID (clause),
970 			 spc, flags, false);
971       pp_right_paren (pp);
972       break;
973 
974     case OMP_CLAUSE_DIST_SCHEDULE:
975       pp_string (pp, "dist_schedule(static");
976       if (OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR (clause))
977 	{
978 	  pp_comma (pp);
979 	  dump_generic_node (pp,
980 			     OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR (clause),
981 			     spc, flags, false);
982 	}
983       pp_right_paren (pp);
984       break;
985 
986     case OMP_CLAUSE_PROC_BIND:
987       pp_string (pp, "proc_bind(");
988       switch (OMP_CLAUSE_PROC_BIND_KIND (clause))
989 	{
990 	case OMP_CLAUSE_PROC_BIND_MASTER:
991 	  pp_string (pp, "master");
992 	  break;
993 	case OMP_CLAUSE_PROC_BIND_CLOSE:
994 	  pp_string (pp, "close");
995 	  break;
996 	case OMP_CLAUSE_PROC_BIND_SPREAD:
997 	  pp_string (pp, "spread");
998 	  break;
999 	default:
1000 	  gcc_unreachable ();
1001 	}
1002       pp_right_paren (pp);
1003       break;
1004 
1005     case OMP_CLAUSE_DEVICE_TYPE:
1006       pp_string (pp, "device_type(");
1007       switch (OMP_CLAUSE_DEVICE_TYPE_KIND (clause))
1008 	{
1009 	case OMP_CLAUSE_DEVICE_TYPE_HOST:
1010 	  pp_string (pp, "host");
1011 	  break;
1012 	case OMP_CLAUSE_DEVICE_TYPE_NOHOST:
1013 	  pp_string (pp, "nohost");
1014 	  break;
1015 	case OMP_CLAUSE_DEVICE_TYPE_ANY:
1016 	  pp_string (pp, "any");
1017 	  break;
1018 	default:
1019 	  gcc_unreachable ();
1020 	}
1021       pp_right_paren (pp);
1022       break;
1023 
1024     case OMP_CLAUSE_SAFELEN:
1025       pp_string (pp, "safelen(");
1026       dump_generic_node (pp, OMP_CLAUSE_SAFELEN_EXPR (clause),
1027 			 spc, flags, false);
1028       pp_right_paren (pp);
1029       break;
1030 
1031     case OMP_CLAUSE_SIMDLEN:
1032       pp_string (pp, "simdlen(");
1033       dump_generic_node (pp, OMP_CLAUSE_SIMDLEN_EXPR (clause),
1034 			 spc, flags, false);
1035       pp_right_paren (pp);
1036       break;
1037 
1038     case OMP_CLAUSE_PRIORITY:
1039       pp_string (pp, "priority(");
1040       dump_generic_node (pp, OMP_CLAUSE_PRIORITY_EXPR (clause),
1041 			 spc, flags, false);
1042       pp_right_paren (pp);
1043       break;
1044 
1045     case OMP_CLAUSE_GRAINSIZE:
1046       pp_string (pp, "grainsize(");
1047       dump_generic_node (pp, OMP_CLAUSE_GRAINSIZE_EXPR (clause),
1048 			 spc, flags, false);
1049       pp_right_paren (pp);
1050       break;
1051 
1052     case OMP_CLAUSE_NUM_TASKS:
1053       pp_string (pp, "num_tasks(");
1054       dump_generic_node (pp, OMP_CLAUSE_NUM_TASKS_EXPR (clause),
1055 			 spc, flags, false);
1056       pp_right_paren (pp);
1057       break;
1058 
1059     case OMP_CLAUSE_HINT:
1060       pp_string (pp, "hint(");
1061       dump_generic_node (pp, OMP_CLAUSE_HINT_EXPR (clause),
1062 			 spc, flags, false);
1063       pp_right_paren (pp);
1064       break;
1065 
1066     case OMP_CLAUSE_DEFAULTMAP:
1067       pp_string (pp, "defaultmap(");
1068       switch (OMP_CLAUSE_DEFAULTMAP_BEHAVIOR (clause))
1069 	{
1070 	case OMP_CLAUSE_DEFAULTMAP_ALLOC:
1071 	  pp_string (pp, "alloc");
1072 	  break;
1073 	case OMP_CLAUSE_DEFAULTMAP_TO:
1074 	  pp_string (pp, "to");
1075 	  break;
1076 	case OMP_CLAUSE_DEFAULTMAP_FROM:
1077 	  pp_string (pp, "from");
1078 	  break;
1079 	case OMP_CLAUSE_DEFAULTMAP_TOFROM:
1080 	  pp_string (pp, "tofrom");
1081 	  break;
1082 	case OMP_CLAUSE_DEFAULTMAP_FIRSTPRIVATE:
1083 	  pp_string (pp, "firstprivate");
1084 	  break;
1085 	case OMP_CLAUSE_DEFAULTMAP_NONE:
1086 	  pp_string (pp, "none");
1087 	  break;
1088 	case OMP_CLAUSE_DEFAULTMAP_DEFAULT:
1089 	  pp_string (pp, "default");
1090 	  break;
1091 	default:
1092 	  gcc_unreachable ();
1093 	}
1094       switch (OMP_CLAUSE_DEFAULTMAP_CATEGORY (clause))
1095 	{
1096 	case OMP_CLAUSE_DEFAULTMAP_CATEGORY_UNSPECIFIED:
1097 	  break;
1098 	case OMP_CLAUSE_DEFAULTMAP_CATEGORY_SCALAR:
1099 	  pp_string (pp, ":scalar");
1100 	  break;
1101 	case OMP_CLAUSE_DEFAULTMAP_CATEGORY_AGGREGATE:
1102 	  pp_string (pp, ":aggregate");
1103 	  break;
1104 	case OMP_CLAUSE_DEFAULTMAP_CATEGORY_ALLOCATABLE:
1105 	  pp_string (pp, ":allocatable");
1106 	  break;
1107 	case OMP_CLAUSE_DEFAULTMAP_CATEGORY_POINTER:
1108 	  pp_string (pp, ":pointer");
1109 	  break;
1110 	default:
1111 	  gcc_unreachable ();
1112 	}
1113       pp_right_paren (pp);
1114       break;
1115 
1116     case OMP_CLAUSE_ORDER:
1117       pp_string (pp, "order(concurrent)");
1118       break;
1119 
1120     case OMP_CLAUSE_BIND:
1121       pp_string (pp, "bind(");
1122       switch (OMP_CLAUSE_BIND_KIND (clause))
1123 	{
1124 	case OMP_CLAUSE_BIND_TEAMS:
1125 	  pp_string (pp, "teams");
1126 	  break;
1127 	case OMP_CLAUSE_BIND_PARALLEL:
1128 	  pp_string (pp, "parallel");
1129 	  break;
1130 	case OMP_CLAUSE_BIND_THREAD:
1131 	  pp_string (pp, "thread");
1132 	  break;
1133 	default:
1134 	  gcc_unreachable ();
1135 	}
1136       pp_right_paren (pp);
1137       break;
1138 
1139     case OMP_CLAUSE__SIMDUID_:
1140       pp_string (pp, "_simduid_(");
1141       dump_generic_node (pp, OMP_CLAUSE__SIMDUID__DECL (clause),
1142 			 spc, flags, false);
1143       pp_right_paren (pp);
1144       break;
1145 
1146     case OMP_CLAUSE__SIMT_:
1147       pp_string (pp, "_simt_");
1148       break;
1149 
1150     case OMP_CLAUSE_GANG:
1151       pp_string (pp, "gang");
1152       if (OMP_CLAUSE_GANG_EXPR (clause) != NULL_TREE)
1153 	{
1154 	  pp_string (pp, "(num: ");
1155 	  dump_generic_node (pp, OMP_CLAUSE_GANG_EXPR (clause),
1156 			     spc, flags, false);
1157 	}
1158       if (OMP_CLAUSE_GANG_STATIC_EXPR (clause) != NULL_TREE)
1159 	{
1160 	  if (OMP_CLAUSE_GANG_EXPR (clause) == NULL_TREE)
1161 	    pp_left_paren (pp);
1162 	  else
1163 	    pp_space (pp);
1164 	  pp_string (pp, "static:");
1165 	  if (OMP_CLAUSE_GANG_STATIC_EXPR (clause)
1166 	      == integer_minus_one_node)
1167 	    pp_character (pp, '*');
1168 	  else
1169 	    dump_generic_node (pp, OMP_CLAUSE_GANG_STATIC_EXPR (clause),
1170 			       spc, flags, false);
1171 	}
1172       if (OMP_CLAUSE_GANG_EXPR (clause) != NULL_TREE
1173 	  || OMP_CLAUSE_GANG_STATIC_EXPR (clause) != NULL_TREE)
1174 	pp_right_paren (pp);
1175       break;
1176 
1177     case OMP_CLAUSE_ASYNC:
1178       pp_string (pp, "async");
1179       if (OMP_CLAUSE_ASYNC_EXPR (clause))
1180         {
1181           pp_character(pp, '(');
1182           dump_generic_node (pp, OMP_CLAUSE_ASYNC_EXPR (clause),
1183                              spc, flags, false);
1184           pp_character(pp, ')');
1185         }
1186       break;
1187 
1188     case OMP_CLAUSE_AUTO:
1189     case OMP_CLAUSE_SEQ:
1190       pp_string (pp, omp_clause_code_name[OMP_CLAUSE_CODE (clause)]);
1191       break;
1192 
1193     case OMP_CLAUSE_WAIT:
1194       pp_string (pp, "wait(");
1195       dump_generic_node (pp, OMP_CLAUSE_WAIT_EXPR (clause),
1196 			 spc, flags, false);
1197       pp_character(pp, ')');
1198       break;
1199 
1200     case OMP_CLAUSE_WORKER:
1201       pp_string (pp, "worker");
1202       if (OMP_CLAUSE_WORKER_EXPR (clause) != NULL_TREE)
1203 	{
1204 	  pp_left_paren (pp);
1205 	  dump_generic_node (pp, OMP_CLAUSE_WORKER_EXPR (clause),
1206 			     spc, flags, false);
1207 	  pp_right_paren (pp);
1208 	}
1209       break;
1210 
1211     case OMP_CLAUSE_VECTOR:
1212       pp_string (pp, "vector");
1213       if (OMP_CLAUSE_VECTOR_EXPR (clause) != NULL_TREE)
1214 	{
1215 	  pp_left_paren (pp);
1216 	  dump_generic_node (pp, OMP_CLAUSE_VECTOR_EXPR (clause),
1217 			     spc, flags, false);
1218 	  pp_right_paren (pp);
1219 	}
1220       break;
1221 
1222     case OMP_CLAUSE_NUM_GANGS:
1223       pp_string (pp, "num_gangs(");
1224       dump_generic_node (pp, OMP_CLAUSE_NUM_GANGS_EXPR (clause),
1225                          spc, flags, false);
1226       pp_character (pp, ')');
1227       break;
1228 
1229     case OMP_CLAUSE_NUM_WORKERS:
1230       pp_string (pp, "num_workers(");
1231       dump_generic_node (pp, OMP_CLAUSE_NUM_WORKERS_EXPR (clause),
1232                          spc, flags, false);
1233       pp_character (pp, ')');
1234       break;
1235 
1236     case OMP_CLAUSE_VECTOR_LENGTH:
1237       pp_string (pp, "vector_length(");
1238       dump_generic_node (pp, OMP_CLAUSE_VECTOR_LENGTH_EXPR (clause),
1239                          spc, flags, false);
1240       pp_character (pp, ')');
1241       break;
1242 
1243     case OMP_CLAUSE_INBRANCH:
1244       pp_string (pp, "inbranch");
1245       break;
1246     case OMP_CLAUSE_NOTINBRANCH:
1247       pp_string (pp, "notinbranch");
1248       break;
1249     case OMP_CLAUSE_FOR:
1250       pp_string (pp, "for");
1251       break;
1252     case OMP_CLAUSE_PARALLEL:
1253       pp_string (pp, "parallel");
1254       break;
1255     case OMP_CLAUSE_SECTIONS:
1256       pp_string (pp, "sections");
1257       break;
1258     case OMP_CLAUSE_TASKGROUP:
1259       pp_string (pp, "taskgroup");
1260       break;
1261     case OMP_CLAUSE_NOGROUP:
1262       pp_string (pp, "nogroup");
1263       break;
1264     case OMP_CLAUSE_THREADS:
1265       pp_string (pp, "threads");
1266       break;
1267     case OMP_CLAUSE_SIMD:
1268       pp_string (pp, "simd");
1269       break;
1270     case OMP_CLAUSE_INDEPENDENT:
1271       pp_string (pp, "independent");
1272       break;
1273     case OMP_CLAUSE_TILE:
1274       pp_string (pp, "tile(");
1275       dump_generic_node (pp, OMP_CLAUSE_TILE_LIST (clause),
1276 			 spc, flags, false);
1277       pp_right_paren (pp);
1278       break;
1279 
1280     case OMP_CLAUSE_IF_PRESENT:
1281       pp_string (pp, "if_present");
1282       break;
1283     case OMP_CLAUSE_FINALIZE:
1284       pp_string (pp, "finalize");
1285       break;
1286     case OMP_CLAUSE_DETACH:
1287       pp_string (pp, "detach(");
1288       dump_generic_node (pp, OMP_CLAUSE_DECL (clause), spc, flags,
1289 			 false);
1290       pp_right_paren (pp);
1291       break;
1292 
1293     default:
1294       gcc_unreachable ();
1295     }
1296 }
1297 
1298 
1299 /* Dump the list of OpenMP clauses.  PP, SPC and FLAGS are as in
1300    dump_generic_node.  */
1301 
1302 void
dump_omp_clauses(pretty_printer * pp,tree clause,int spc,dump_flags_t flags)1303 dump_omp_clauses (pretty_printer *pp, tree clause, int spc, dump_flags_t flags)
1304 {
1305   if (clause == NULL)
1306     return;
1307 
1308   pp_space (pp);
1309   while (1)
1310     {
1311       dump_omp_clause (pp, clause, spc, flags);
1312       clause = OMP_CLAUSE_CHAIN (clause);
1313       if (clause == NULL)
1314 	return;
1315       pp_space (pp);
1316     }
1317 }
1318 
1319 
1320 /* Dump location LOC to PP.  */
1321 
1322 void
dump_location(pretty_printer * pp,location_t loc)1323 dump_location (pretty_printer *pp, location_t loc)
1324 {
1325   expanded_location xloc = expand_location (loc);
1326 
1327   pp_left_bracket (pp);
1328   if (xloc.file)
1329     {
1330       pp_string (pp, xloc.file);
1331       pp_string (pp, ":");
1332     }
1333   pp_decimal_int (pp, xloc.line);
1334   pp_colon (pp);
1335   pp_decimal_int (pp, xloc.column);
1336   pp_string (pp, "] ");
1337 }
1338 
1339 
1340 /* Dump lexical block BLOCK.  PP, SPC and FLAGS are as in
1341    dump_generic_node.  */
1342 
1343 static void
dump_block_node(pretty_printer * pp,tree block,int spc,dump_flags_t flags)1344 dump_block_node (pretty_printer *pp, tree block, int spc, dump_flags_t flags)
1345 {
1346   tree t;
1347 
1348   pp_string (pp, "BLOCK #");
1349   pp_decimal_int (pp, BLOCK_NUMBER (block));
1350   pp_character (pp, ' ');
1351 
1352   if (flags & TDF_ADDRESS)
1353     {
1354       pp_character (pp, '[');
1355       pp_scalar (pp, "%p", (void *) block);
1356       pp_string (pp, "] ");
1357     }
1358 
1359   if (TREE_ASM_WRITTEN (block))
1360     pp_string (pp, "[written] ");
1361 
1362   if (flags & TDF_SLIM)
1363     return;
1364 
1365   if (BLOCK_SOURCE_LOCATION (block))
1366     dump_location (pp, BLOCK_SOURCE_LOCATION (block));
1367 
1368   newline_and_indent (pp, spc + 2);
1369 
1370   if (BLOCK_SUPERCONTEXT (block))
1371     {
1372       pp_string (pp, "SUPERCONTEXT: ");
1373       dump_generic_node (pp, BLOCK_SUPERCONTEXT (block), 0,
1374 			 flags | TDF_SLIM, false);
1375       newline_and_indent (pp, spc + 2);
1376     }
1377 
1378   if (BLOCK_SUBBLOCKS (block))
1379     {
1380       pp_string (pp, "SUBBLOCKS: ");
1381       for (t = BLOCK_SUBBLOCKS (block); t; t = BLOCK_CHAIN (t))
1382 	{
1383 	  dump_generic_node (pp, t, 0, flags | TDF_SLIM, false);
1384 	  pp_space (pp);
1385 	}
1386       newline_and_indent (pp, spc + 2);
1387     }
1388 
1389   if (BLOCK_CHAIN (block))
1390     {
1391       pp_string (pp, "SIBLINGS: ");
1392       for (t = BLOCK_CHAIN (block); t; t = BLOCK_CHAIN (t))
1393 	{
1394 	  dump_generic_node (pp, t, 0, flags | TDF_SLIM, false);
1395 	  pp_space (pp);
1396 	}
1397       newline_and_indent (pp, spc + 2);
1398     }
1399 
1400   if (BLOCK_VARS (block))
1401     {
1402       pp_string (pp, "VARS: ");
1403       for (t = BLOCK_VARS (block); t; t = TREE_CHAIN (t))
1404 	{
1405 	  dump_generic_node (pp, t, 0, flags, false);
1406 	  pp_space (pp);
1407 	}
1408       newline_and_indent (pp, spc + 2);
1409     }
1410 
1411   if (vec_safe_length (BLOCK_NONLOCALIZED_VARS (block)) > 0)
1412     {
1413       unsigned i;
1414       vec<tree, va_gc> *nlv = BLOCK_NONLOCALIZED_VARS (block);
1415 
1416       pp_string (pp, "NONLOCALIZED_VARS: ");
1417       FOR_EACH_VEC_ELT (*nlv, i, t)
1418 	{
1419 	  dump_generic_node (pp, t, 0, flags, false);
1420 	  pp_space (pp);
1421 	}
1422       newline_and_indent (pp, spc + 2);
1423     }
1424 
1425   if (BLOCK_ABSTRACT_ORIGIN (block))
1426     {
1427       pp_string (pp, "ABSTRACT_ORIGIN: ");
1428       dump_generic_node (pp, BLOCK_ABSTRACT_ORIGIN (block), 0,
1429 			 flags | TDF_SLIM, false);
1430       newline_and_indent (pp, spc + 2);
1431     }
1432 
1433   if (BLOCK_FRAGMENT_ORIGIN (block))
1434     {
1435       pp_string (pp, "FRAGMENT_ORIGIN: ");
1436       dump_generic_node (pp, BLOCK_FRAGMENT_ORIGIN (block), 0,
1437 			 flags | TDF_SLIM, false);
1438       newline_and_indent (pp, spc + 2);
1439     }
1440 
1441   if (BLOCK_FRAGMENT_CHAIN (block))
1442     {
1443       pp_string (pp, "FRAGMENT_CHAIN: ");
1444       for (t = BLOCK_FRAGMENT_CHAIN (block); t; t = BLOCK_FRAGMENT_CHAIN (t))
1445 	{
1446 	  dump_generic_node (pp, t, 0, flags | TDF_SLIM, false);
1447 	  pp_space (pp);
1448 	}
1449       newline_and_indent (pp, spc + 2);
1450     }
1451 }
1452 
1453 /* Dump #pragma omp atomic memory order clause.  */
1454 
1455 void
dump_omp_atomic_memory_order(pretty_printer * pp,enum omp_memory_order mo)1456 dump_omp_atomic_memory_order (pretty_printer *pp, enum omp_memory_order mo)
1457 {
1458   switch (mo)
1459     {
1460     case OMP_MEMORY_ORDER_RELAXED:
1461       pp_string (pp, " relaxed");
1462       break;
1463     case OMP_MEMORY_ORDER_SEQ_CST:
1464       pp_string (pp, " seq_cst");
1465       break;
1466     case OMP_MEMORY_ORDER_ACQ_REL:
1467       pp_string (pp, " acq_rel");
1468       break;
1469     case OMP_MEMORY_ORDER_ACQUIRE:
1470       pp_string (pp, " acquire");
1471       break;
1472     case OMP_MEMORY_ORDER_RELEASE:
1473       pp_string (pp, " release");
1474       break;
1475     case OMP_MEMORY_ORDER_UNSPECIFIED:
1476       break;
1477     default:
1478       gcc_unreachable ();
1479     }
1480 }
1481 
1482 /* Helper to dump a MEM_REF node.  */
1483 
1484 static void
dump_mem_ref(pretty_printer * pp,tree node,int spc,dump_flags_t flags)1485 dump_mem_ref (pretty_printer *pp, tree node, int spc, dump_flags_t flags)
1486 {
1487   if (TREE_CODE (node) == MEM_REF && (flags & TDF_GIMPLE))
1488     {
1489       pp_string (pp, "__MEM <");
1490       dump_generic_node (pp, TREE_TYPE (node),
1491 			 spc, flags | TDF_SLIM, false);
1492       if (TYPE_ALIGN (TREE_TYPE (node))
1493 	  != TYPE_ALIGN (TYPE_MAIN_VARIANT (TREE_TYPE (node))))
1494 	{
1495 	  pp_string (pp, ", ");
1496 	  pp_decimal_int (pp, TYPE_ALIGN (TREE_TYPE (node)));
1497 	}
1498       pp_greater (pp);
1499       pp_string (pp, " (");
1500       if (TREE_TYPE (TREE_OPERAND (node, 0))
1501 	  != TREE_TYPE (TREE_OPERAND (node, 1)))
1502 	{
1503 	  pp_left_paren (pp);
1504 	  dump_generic_node (pp, TREE_TYPE (TREE_OPERAND (node, 1)),
1505 			     spc, flags | TDF_SLIM, false);
1506 	  pp_right_paren (pp);
1507 	}
1508       dump_generic_node (pp, TREE_OPERAND (node, 0),
1509 			 spc, flags | TDF_SLIM, false);
1510       if (! integer_zerop (TREE_OPERAND (node, 1)))
1511 	{
1512 	  pp_string (pp, " + ");
1513 	  dump_generic_node (pp, TREE_OPERAND (node, 1),
1514 			     spc, flags | TDF_SLIM, false);
1515 	}
1516       pp_right_paren (pp);
1517     }
1518   else if (TREE_CODE (node) == MEM_REF
1519 	   && integer_zerop (TREE_OPERAND (node, 1))
1520 	   /* Dump the types of INTEGER_CSTs explicitly, for we can't
1521 	      infer them and MEM_ATTR caching will share MEM_REFs
1522 	      with differently-typed op0s.  */
1523 	   && TREE_CODE (TREE_OPERAND (node, 0)) != INTEGER_CST
1524 	   /* Released SSA_NAMES have no TREE_TYPE.  */
1525 	   && TREE_TYPE (TREE_OPERAND (node, 0)) != NULL_TREE
1526 	   /* Same pointer types, but ignoring POINTER_TYPE vs.
1527 	      REFERENCE_TYPE.  */
1528 	   && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node, 0)))
1529 	       == TREE_TYPE (TREE_TYPE (TREE_OPERAND (node, 1))))
1530 	   && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (node, 0)))
1531 	       == TYPE_MODE (TREE_TYPE (TREE_OPERAND (node, 1))))
1532 	   && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node, 0)))
1533 	       == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node, 1))))
1534 	   /* Same value types ignoring qualifiers.  */
1535 	   && (TYPE_MAIN_VARIANT (TREE_TYPE (node))
1536 	       == TYPE_MAIN_VARIANT
1537 	       (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node, 1)))))
1538 	   && (!(flags & TDF_ALIAS)
1539 	       || MR_DEPENDENCE_CLIQUE (node) == 0))
1540     {
1541       if (TREE_CODE (TREE_OPERAND (node, 0)) != ADDR_EXPR)
1542 	{
1543 	  /* Enclose pointers to arrays in parentheses.  */
1544 	  tree op0 = TREE_OPERAND (node, 0);
1545 	  tree op0type = TREE_TYPE (op0);
1546 	  if (POINTER_TYPE_P (op0type)
1547 	      && TREE_CODE (TREE_TYPE (op0type)) == ARRAY_TYPE)
1548 	    pp_left_paren (pp);
1549 	  pp_star (pp);
1550 	  dump_generic_node (pp, op0, spc, flags, false);
1551 	  if (POINTER_TYPE_P (op0type)
1552 	      && TREE_CODE (TREE_TYPE (op0type)) == ARRAY_TYPE)
1553 	    pp_right_paren (pp);
1554 	}
1555       else
1556 	dump_generic_node (pp,
1557 			   TREE_OPERAND (TREE_OPERAND (node, 0), 0),
1558 			   spc, flags, false);
1559     }
1560   else
1561     {
1562       pp_string (pp, "MEM");
1563 
1564       tree nodetype = TREE_TYPE (node);
1565       tree op0 = TREE_OPERAND (node, 0);
1566       tree op1 = TREE_OPERAND (node, 1);
1567       tree op1type = TYPE_MAIN_VARIANT (TREE_TYPE (op1));
1568 
1569       tree op0size = TYPE_SIZE (nodetype);
1570       tree op1size = TYPE_SIZE (TREE_TYPE (op1type));
1571 
1572       if (!op0size || !op1size
1573 	  || !operand_equal_p (op0size, op1size, 0))
1574 	{
1575 	  pp_string (pp, " <");
1576 	  /* If the size of the type of the operand is not the same
1577 	     as the size of the MEM_REF expression include the type
1578 	     of the latter similar to the TDF_GIMPLE output to make
1579 	     it clear how many bytes of memory are being accessed.  */
1580 	  dump_generic_node (pp, nodetype, spc, flags | TDF_SLIM, false);
1581 	  pp_string (pp, "> ");
1582 	}
1583 
1584       pp_string (pp, "[(");
1585       dump_generic_node (pp, op1type, spc, flags | TDF_SLIM, false);
1586       pp_right_paren (pp);
1587       dump_generic_node (pp, op0, spc, flags, false);
1588       if (!integer_zerop (op1))
1589 	{
1590 	  pp_string (pp, " + ");
1591 	  dump_generic_node (pp, op1, spc, flags, false);
1592 	}
1593       if (TREE_CODE (node) == TARGET_MEM_REF)
1594 	{
1595 	  tree tmp = TMR_INDEX2 (node);
1596 	  if (tmp)
1597 	    {
1598 	      pp_string (pp, " + ");
1599 	      dump_generic_node (pp, tmp, spc, flags, false);
1600 	    }
1601 	  tmp = TMR_INDEX (node);
1602 	  if (tmp)
1603 	    {
1604 	      pp_string (pp, " + ");
1605 	      dump_generic_node (pp, tmp, spc, flags, false);
1606 	      tmp = TMR_STEP (node);
1607 	      pp_string (pp, " * ");
1608 	      if (tmp)
1609 		dump_generic_node (pp, tmp, spc, flags, false);
1610 	      else
1611 		pp_string (pp, "1");
1612 	    }
1613 	}
1614       if ((flags & TDF_ALIAS)
1615 	  && MR_DEPENDENCE_CLIQUE (node) != 0)
1616 	{
1617 	  pp_string (pp, " clique ");
1618 	  pp_unsigned_wide_integer (pp, MR_DEPENDENCE_CLIQUE (node));
1619 	  pp_string (pp, " base ");
1620 	  pp_unsigned_wide_integer (pp, MR_DEPENDENCE_BASE (node));
1621 	}
1622       pp_right_bracket (pp);
1623     }
1624 }
1625 
1626 /* Helper function for dump_generic_node.  Dump INIT or COND expression for
1627    OpenMP loop non-rectangular iterators.  */
1628 
1629 void
dump_omp_loop_non_rect_expr(pretty_printer * pp,tree node,int spc,dump_flags_t flags)1630 dump_omp_loop_non_rect_expr (pretty_printer *pp, tree node, int spc,
1631 			     dump_flags_t flags)
1632 {
1633   gcc_assert (TREE_CODE (node) == TREE_VEC);
1634   dump_generic_node (pp, TREE_VEC_ELT (node, 0), spc, flags, false);
1635   pp_string (pp, " * ");
1636   if (op_prio (TREE_VEC_ELT (node, 1)) <= op_code_prio (MULT_EXPR))
1637     {
1638       pp_left_paren (pp);
1639       dump_generic_node (pp, TREE_VEC_ELT (node, 1), spc, flags, false);
1640       pp_right_paren (pp);
1641     }
1642   else
1643     dump_generic_node (pp, TREE_VEC_ELT (node, 1), spc, flags, false);
1644   pp_string (pp, " + ");
1645   if (op_prio (TREE_VEC_ELT (node, 1)) <= op_code_prio (PLUS_EXPR))
1646     {
1647       pp_left_paren (pp);
1648       dump_generic_node (pp, TREE_VEC_ELT (node, 2), spc, flags, false);
1649       pp_right_paren (pp);
1650     }
1651   else
1652     dump_generic_node (pp, TREE_VEC_ELT (node, 2), spc, flags, false);
1653 }
1654 
1655 /* Dump the node NODE on the pretty_printer PP, SPC spaces of
1656    indent.  FLAGS specifies details to show in the dump (see TDF_* in
1657    dumpfile.h).  If IS_STMT is true, the object printed is considered
1658    to be a statement and it is terminated by ';' if appropriate.  */
1659 
1660 int
dump_generic_node(pretty_printer * pp,tree node,int spc,dump_flags_t flags,bool is_stmt)1661 dump_generic_node (pretty_printer *pp, tree node, int spc, dump_flags_t flags,
1662 		   bool is_stmt)
1663 {
1664   tree type;
1665   tree op0, op1;
1666   const char *str;
1667   bool is_expr;
1668   enum tree_code code;
1669 
1670   if (node == NULL_TREE)
1671     return spc;
1672 
1673   is_expr = EXPR_P (node);
1674 
1675   if (is_stmt && (flags & TDF_STMTADDR))
1676     {
1677       pp_string (pp, "<&");
1678       pp_scalar (pp, "%p", (void *)node);
1679       pp_string (pp, "> ");
1680     }
1681 
1682   if ((flags & TDF_LINENO) && EXPR_HAS_LOCATION (node))
1683     dump_location (pp, EXPR_LOCATION (node));
1684 
1685   code = TREE_CODE (node);
1686   switch (code)
1687     {
1688     case ERROR_MARK:
1689       pp_string (pp, "<<< error >>>");
1690       break;
1691 
1692     case IDENTIFIER_NODE:
1693       pp_tree_identifier (pp, node);
1694       break;
1695 
1696     case TREE_LIST:
1697       while (node && node != error_mark_node)
1698 	{
1699 	  if (TREE_PURPOSE (node))
1700 	    {
1701 	      dump_generic_node (pp, TREE_PURPOSE (node), spc, flags, false);
1702 	      pp_space (pp);
1703 	    }
1704 	  dump_generic_node (pp, TREE_VALUE (node), spc, flags, false);
1705 	  node = TREE_CHAIN (node);
1706 	  if (node && TREE_CODE (node) == TREE_LIST)
1707 	    {
1708 	      pp_comma (pp);
1709 	      pp_space (pp);
1710 	    }
1711 	}
1712       break;
1713 
1714     case TREE_BINFO:
1715       dump_generic_node (pp, BINFO_TYPE (node), spc, flags, false);
1716       break;
1717 
1718     case TREE_VEC:
1719       {
1720 	size_t i;
1721 	if (TREE_VEC_LENGTH (node) > 0)
1722 	  {
1723 	    size_t len = TREE_VEC_LENGTH (node);
1724 	    for (i = 0; i < len - 1; i++)
1725 	      {
1726 		dump_generic_node (pp, TREE_VEC_ELT (node, i), spc, flags,
1727 				   false);
1728 		pp_comma (pp);
1729 		pp_space (pp);
1730 	      }
1731 	    dump_generic_node (pp, TREE_VEC_ELT (node, len - 1), spc,
1732 			       flags, false);
1733 	  }
1734       }
1735       break;
1736 
1737     case VOID_TYPE:
1738     case INTEGER_TYPE:
1739     case REAL_TYPE:
1740     case FIXED_POINT_TYPE:
1741     case COMPLEX_TYPE:
1742     case VECTOR_TYPE:
1743     case ENUMERAL_TYPE:
1744     case BOOLEAN_TYPE:
1745     case OPAQUE_TYPE:
1746       {
1747 	unsigned int quals = TYPE_QUALS (node);
1748 	enum tree_code_class tclass;
1749 
1750 	if (quals & TYPE_QUAL_ATOMIC)
1751 	  pp_string (pp, "atomic ");
1752 	if (quals & TYPE_QUAL_CONST)
1753 	  pp_string (pp, "const ");
1754 	if (quals & TYPE_QUAL_VOLATILE)
1755 	  pp_string (pp, "volatile ");
1756 	if (quals & TYPE_QUAL_RESTRICT)
1757 	  pp_string (pp, "restrict ");
1758 
1759 	if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node)))
1760 	  {
1761 	    pp_string (pp, "<address-space-");
1762 	    pp_decimal_int (pp, TYPE_ADDR_SPACE (node));
1763 	    pp_string (pp, "> ");
1764 	  }
1765 
1766 	tclass = TREE_CODE_CLASS (TREE_CODE (node));
1767 
1768 	if (tclass == tcc_declaration)
1769 	  {
1770 	    if (DECL_NAME (node))
1771 	      dump_decl_name (pp, node, flags);
1772 	    else
1773               pp_string (pp, "<unnamed type decl>");
1774 	  }
1775 	else if (tclass == tcc_type)
1776 	  {
1777 	    if (TYPE_NAME (node))
1778 	      {
1779 		if (TREE_CODE (TYPE_NAME (node)) == IDENTIFIER_NODE)
1780 		  pp_tree_identifier (pp, TYPE_NAME (node));
1781 		else if (TREE_CODE (TYPE_NAME (node)) == TYPE_DECL
1782 			 && DECL_NAME (TYPE_NAME (node)))
1783 		  dump_decl_name (pp, TYPE_NAME (node), flags);
1784 		else
1785 		  pp_string (pp, "<unnamed type>");
1786 	      }
1787 	    else if (TREE_CODE (node) == VECTOR_TYPE)
1788 	      {
1789 		pp_string (pp, "vector");
1790 		pp_left_paren (pp);
1791 		pp_wide_integer (pp, TYPE_VECTOR_SUBPARTS (node));
1792 		pp_string (pp, ") ");
1793 		dump_generic_node (pp, TREE_TYPE (node), spc, flags, false);
1794 	      }
1795 	    else if (TREE_CODE (node) == INTEGER_TYPE)
1796 	      {
1797 		if (TYPE_PRECISION (node) == CHAR_TYPE_SIZE)
1798 		  pp_string (pp, (TYPE_UNSIGNED (node)
1799 				      ? "unsigned char"
1800 				      : "signed char"));
1801 		else if (TYPE_PRECISION (node) == SHORT_TYPE_SIZE)
1802 		  pp_string (pp, (TYPE_UNSIGNED (node)
1803 				      ? "unsigned short"
1804 				      : "signed short"));
1805 		else if (TYPE_PRECISION (node) == INT_TYPE_SIZE)
1806 		  pp_string (pp, (TYPE_UNSIGNED (node)
1807 				      ? "unsigned int"
1808 				      : "signed int"));
1809 		else if (TYPE_PRECISION (node) == LONG_TYPE_SIZE)
1810 		  pp_string (pp, (TYPE_UNSIGNED (node)
1811 				      ? "unsigned long"
1812 				      : "signed long"));
1813 		else if (TYPE_PRECISION (node) == LONG_LONG_TYPE_SIZE)
1814 		  pp_string (pp, (TYPE_UNSIGNED (node)
1815 				      ? "unsigned long long"
1816 				      : "signed long long"));
1817 		else if (TYPE_PRECISION (node) >= CHAR_TYPE_SIZE
1818 			 && pow2p_hwi (TYPE_PRECISION (node)))
1819 		  {
1820 		    pp_string (pp, (TYPE_UNSIGNED (node) ? "uint" : "int"));
1821 		    pp_decimal_int (pp, TYPE_PRECISION (node));
1822 		    pp_string (pp, "_t");
1823 		  }
1824 		else
1825 		  {
1826 		    pp_string (pp, (TYPE_UNSIGNED (node)
1827 					? "<unnamed-unsigned:"
1828 					: "<unnamed-signed:"));
1829 		    pp_decimal_int (pp, TYPE_PRECISION (node));
1830 		    pp_greater (pp);
1831 		  }
1832 	      }
1833 	    else if (TREE_CODE (node) == COMPLEX_TYPE)
1834 	      {
1835 		pp_string (pp, "__complex__ ");
1836 		dump_generic_node (pp, TREE_TYPE (node), spc, flags, false);
1837 	      }
1838 	    else if (TREE_CODE (node) == REAL_TYPE)
1839 	      {
1840 		pp_string (pp, "<float:");
1841 		pp_decimal_int (pp, TYPE_PRECISION (node));
1842 		pp_greater (pp);
1843 	      }
1844 	    else if (TREE_CODE (node) == FIXED_POINT_TYPE)
1845 	      {
1846 		pp_string (pp, "<fixed-point-");
1847 		pp_string (pp, TYPE_SATURATING (node) ? "sat:" : "nonsat:");
1848 		pp_decimal_int (pp, TYPE_PRECISION (node));
1849 		pp_greater (pp);
1850 	      }
1851 	    else if (TREE_CODE (node) == BOOLEAN_TYPE)
1852 	      {
1853 		pp_string (pp, (TYPE_UNSIGNED (node)
1854 				? "<unsigned-boolean:"
1855 				: "<signed-boolean:"));
1856 		pp_decimal_int (pp, TYPE_PRECISION (node));
1857 		pp_greater (pp);
1858 	      }
1859 	    else if (TREE_CODE (node) == VOID_TYPE)
1860 	      pp_string (pp, "void");
1861 	    else
1862               pp_string (pp, "<unnamed type>");
1863 	  }
1864 	break;
1865       }
1866 
1867     case POINTER_TYPE:
1868     case REFERENCE_TYPE:
1869       str = (TREE_CODE (node) == POINTER_TYPE ? "*" : "&");
1870 
1871       if (TREE_TYPE (node) == NULL)
1872         {
1873 	  pp_string (pp, str);
1874           pp_string (pp, "<null type>");
1875         }
1876       else if (TREE_CODE (TREE_TYPE (node)) == FUNCTION_TYPE)
1877         {
1878 	  tree fnode = TREE_TYPE (node);
1879 
1880 	  dump_generic_node (pp, TREE_TYPE (fnode), spc, flags, false);
1881 	  pp_space (pp);
1882 	  pp_left_paren (pp);
1883 	  pp_string (pp, str);
1884 	  if (TYPE_IDENTIFIER (node))
1885 	    dump_generic_node (pp, TYPE_NAME (node), spc, flags, false);
1886 	  else if (flags & TDF_NOUID)
1887 	    pp_string (pp, "<Txxxx>");
1888 	  else
1889 	    {
1890 	      pp_string (pp, "<T");
1891 	      pp_scalar (pp, "%x", TYPE_UID (node));
1892 	      pp_character (pp, '>');
1893 	    }
1894 
1895 	  pp_right_paren (pp);
1896 	  dump_function_declaration (pp, fnode, spc, flags);
1897 	}
1898       else
1899         {
1900 	  unsigned int quals = TYPE_QUALS (node);
1901 
1902           dump_generic_node (pp, TREE_TYPE (node), spc, flags, false);
1903 	  pp_space (pp);
1904 	  pp_string (pp, str);
1905 
1906 	  if (quals & TYPE_QUAL_CONST)
1907 	    pp_string (pp, " const");
1908 	  if (quals & TYPE_QUAL_VOLATILE)
1909 	    pp_string (pp, " volatile");
1910 	  if (quals & TYPE_QUAL_RESTRICT)
1911 	    pp_string (pp, " restrict");
1912 
1913 	  if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node)))
1914 	    {
1915 	      pp_string (pp, " <address-space-");
1916 	      pp_decimal_int (pp, TYPE_ADDR_SPACE (node));
1917 	      pp_greater (pp);
1918 	    }
1919 
1920 	  if (TYPE_REF_CAN_ALIAS_ALL (node))
1921 	    pp_string (pp, " {ref-all}");
1922 	}
1923       break;
1924 
1925     case OFFSET_TYPE:
1926       NIY;
1927       break;
1928 
1929     case MEM_REF:
1930     case TARGET_MEM_REF:
1931       dump_mem_ref (pp, node, spc, flags);
1932       break;
1933 
1934     case ARRAY_TYPE:
1935       {
1936 	unsigned int quals = TYPE_QUALS (node);
1937 	tree tmp;
1938 
1939 	if (quals & TYPE_QUAL_ATOMIC)
1940 	  pp_string (pp, "atomic ");
1941 	if (quals & TYPE_QUAL_CONST)
1942 	  pp_string (pp, "const ");
1943 	if (quals & TYPE_QUAL_VOLATILE)
1944 	  pp_string (pp, "volatile ");
1945 
1946 	/* Print the innermost component type.  */
1947 	for (tmp = TREE_TYPE (node); TREE_CODE (tmp) == ARRAY_TYPE;
1948 	     tmp = TREE_TYPE (tmp))
1949 	  ;
1950 	dump_generic_node (pp, tmp, spc, flags, false);
1951 
1952 	/* Print the dimensions.  */
1953 	for (tmp = node; TREE_CODE (tmp) == ARRAY_TYPE; tmp = TREE_TYPE (tmp))
1954 	  dump_array_domain (pp, TYPE_DOMAIN (tmp), spc, flags);
1955 	break;
1956       }
1957 
1958     case RECORD_TYPE:
1959     case UNION_TYPE:
1960     case QUAL_UNION_TYPE:
1961       {
1962 	unsigned int quals = TYPE_QUALS (node);
1963 
1964 	if (quals & TYPE_QUAL_ATOMIC)
1965 	  pp_string (pp, "atomic ");
1966 	if (quals & TYPE_QUAL_CONST)
1967 	  pp_string (pp, "const ");
1968 	if (quals & TYPE_QUAL_VOLATILE)
1969 	  pp_string (pp, "volatile ");
1970 
1971 	if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node)))
1972 	  {
1973 	    pp_string (pp, "<address-space-");
1974 	    pp_decimal_int (pp, TYPE_ADDR_SPACE (node));
1975 	    pp_string (pp, "> ");
1976 	  }
1977 
1978         /* Print the name of the structure.  */
1979         if (TREE_CODE (node) == RECORD_TYPE)
1980 	  pp_string (pp, "struct ");
1981         else if (TREE_CODE (node) == UNION_TYPE)
1982 	  pp_string (pp, "union ");
1983 
1984         if (TYPE_NAME (node))
1985 	  dump_generic_node (pp, TYPE_NAME (node), spc, flags, false);
1986 	else if (!(flags & TDF_SLIM))
1987 	  /* FIXME: If we eliminate the 'else' above and attempt
1988 	     to show the fields for named types, we may get stuck
1989 	     following a cycle of pointers to structs.  The alleged
1990 	     self-reference check in print_struct_decl will not detect
1991 	     cycles involving more than one pointer or struct type.  */
1992 	  print_struct_decl (pp, node, spc, flags);
1993         break;
1994       }
1995 
1996     case LANG_TYPE:
1997       NIY;
1998       break;
1999 
2000     case INTEGER_CST:
2001       if (flags & TDF_GIMPLE
2002 	  && (POINTER_TYPE_P (TREE_TYPE (node))
2003 	      || (TYPE_PRECISION (TREE_TYPE (node))
2004 		  < TYPE_PRECISION (integer_type_node))
2005 	      || exact_log2 (TYPE_PRECISION (TREE_TYPE (node))) == -1
2006 	      || tree_int_cst_sgn (node) < 0))
2007 	{
2008 	  pp_string (pp, "_Literal (");
2009 	  dump_generic_node (pp, TREE_TYPE (node), spc, flags, false);
2010 	  pp_string (pp, ") ");
2011 	}
2012       if (TREE_CODE (TREE_TYPE (node)) == POINTER_TYPE
2013 	  && ! (flags & TDF_GIMPLE))
2014 	{
2015 	  /* In the case of a pointer, one may want to divide by the
2016 	     size of the pointed-to type.  Unfortunately, this not
2017 	     straightforward.  The C front-end maps expressions
2018 
2019 	     (int *) 5
2020 	     int *p; (p + 5)
2021 
2022 	     in such a way that the two INTEGER_CST nodes for "5" have
2023 	     different values but identical types.  In the latter
2024 	     case, the 5 is multiplied by sizeof (int) in c-common.c
2025 	     (pointer_int_sum) to convert it to a byte address, and
2026 	     yet the type of the node is left unchanged.  Argh.  What
2027 	     is consistent though is that the number value corresponds
2028 	     to bytes (UNITS) offset.
2029 
2030              NB: Neither of the following divisors can be trivially
2031              used to recover the original literal:
2032 
2033              TREE_INT_CST_LOW (TYPE_SIZE_UNIT (TREE_TYPE (node)))
2034 	     TYPE_PRECISION (TREE_TYPE (TREE_TYPE (node)))  */
2035 	  pp_wide_integer (pp, TREE_INT_CST_LOW (node));
2036 	  pp_string (pp, "B"); /* pseudo-unit */
2037 	}
2038       else if (tree_fits_shwi_p (node))
2039 	pp_wide_integer (pp, tree_to_shwi (node));
2040       else if (tree_fits_uhwi_p (node))
2041 	pp_unsigned_wide_integer (pp, tree_to_uhwi (node));
2042       else
2043 	{
2044 	  wide_int val = wi::to_wide (node);
2045 
2046 	  if (wi::neg_p (val, TYPE_SIGN (TREE_TYPE (node))))
2047 	    {
2048 	      pp_minus (pp);
2049 	      val = -val;
2050 	    }
2051 	  print_hex (val, pp_buffer (pp)->digit_buffer);
2052 	  pp_string (pp, pp_buffer (pp)->digit_buffer);
2053 	}
2054       if ((flags & TDF_GIMPLE)
2055 	  && ! (POINTER_TYPE_P (TREE_TYPE (node))
2056 		|| (TYPE_PRECISION (TREE_TYPE (node))
2057 		    < TYPE_PRECISION (integer_type_node))
2058 		|| exact_log2 (TYPE_PRECISION (TREE_TYPE (node))) == -1))
2059 	{
2060 	  if (TYPE_UNSIGNED (TREE_TYPE (node)))
2061 	    pp_character (pp, 'u');
2062 	  if (TYPE_PRECISION (TREE_TYPE (node))
2063 	      == TYPE_PRECISION (unsigned_type_node))
2064 	    ;
2065 	  else if (TYPE_PRECISION (TREE_TYPE (node))
2066 		   == TYPE_PRECISION (long_unsigned_type_node))
2067 	    pp_character (pp, 'l');
2068 	  else if (TYPE_PRECISION (TREE_TYPE (node))
2069 		   == TYPE_PRECISION (long_long_unsigned_type_node))
2070 	    pp_string (pp, "ll");
2071 	}
2072       if (TREE_OVERFLOW (node))
2073 	pp_string (pp, "(OVF)");
2074       break;
2075 
2076     case POLY_INT_CST:
2077       pp_string (pp, "POLY_INT_CST [");
2078       dump_generic_node (pp, POLY_INT_CST_COEFF (node, 0), spc, flags, false);
2079       for (unsigned int i = 1; i < NUM_POLY_INT_COEFFS; ++i)
2080 	{
2081 	  pp_string (pp, ", ");
2082 	  dump_generic_node (pp, POLY_INT_CST_COEFF (node, i),
2083 			     spc, flags, false);
2084 	}
2085       pp_string (pp, "]");
2086       break;
2087 
2088     case REAL_CST:
2089       /* Code copied from print_node.  */
2090       {
2091 	REAL_VALUE_TYPE d;
2092 	if (TREE_OVERFLOW (node))
2093 	  pp_string (pp, " overflow");
2094 
2095 	d = TREE_REAL_CST (node);
2096 	if (REAL_VALUE_ISINF (d))
2097 	  pp_string (pp, REAL_VALUE_NEGATIVE (d) ? " -Inf" : " Inf");
2098 	else if (REAL_VALUE_ISNAN (d))
2099 	  pp_string (pp, " Nan");
2100 	else
2101 	  {
2102 	    char string[100];
2103 	    real_to_decimal (string, &d, sizeof (string), 0, 1);
2104 	    pp_string (pp, string);
2105 	  }
2106 	break;
2107       }
2108 
2109     case FIXED_CST:
2110       {
2111 	char string[100];
2112 	fixed_to_decimal (string, TREE_FIXED_CST_PTR (node), sizeof (string));
2113 	pp_string (pp, string);
2114 	break;
2115       }
2116 
2117     case COMPLEX_CST:
2118       pp_string (pp, "__complex__ (");
2119       dump_generic_node (pp, TREE_REALPART (node), spc, flags, false);
2120       pp_string (pp, ", ");
2121       dump_generic_node (pp, TREE_IMAGPART (node), spc, flags, false);
2122       pp_right_paren (pp);
2123       break;
2124 
2125     case STRING_CST:
2126       {
2127 	pp_string (pp, "\"");
2128 	if (unsigned nbytes = TREE_STRING_LENGTH (node))
2129 	  pretty_print_string (pp, TREE_STRING_POINTER (node), nbytes);
2130 	pp_string (pp, "\"");
2131 	break;
2132       }
2133 
2134     case VECTOR_CST:
2135       {
2136 	unsigned i;
2137 	if (flags & TDF_GIMPLE)
2138 	  {
2139 	    pp_string (pp, "_Literal (");
2140 	    dump_generic_node (pp, TREE_TYPE (node), spc, flags, false);
2141 	    pp_string (pp, ") ");
2142 	  }
2143 	pp_string (pp, "{ ");
2144 	unsigned HOST_WIDE_INT nunits;
2145 	if (!VECTOR_CST_NELTS (node).is_constant (&nunits))
2146 	  nunits = vector_cst_encoded_nelts (node);
2147 	for (i = 0; i < nunits; ++i)
2148 	  {
2149 	    if (i != 0)
2150 	      pp_string (pp, ", ");
2151 	    dump_generic_node (pp, VECTOR_CST_ELT (node, i),
2152 			       spc, flags, false);
2153 	  }
2154 	if (!VECTOR_CST_NELTS (node).is_constant ())
2155 	  pp_string (pp, ", ...");
2156 	pp_string (pp, " }");
2157       }
2158       break;
2159 
2160     case FUNCTION_TYPE:
2161     case METHOD_TYPE:
2162       dump_generic_node (pp, TREE_TYPE (node), spc, flags, false);
2163       pp_space (pp);
2164       if (TREE_CODE (node) == METHOD_TYPE)
2165 	{
2166 	  if (TYPE_METHOD_BASETYPE (node))
2167 	    dump_generic_node (pp, TYPE_NAME (TYPE_METHOD_BASETYPE (node)),
2168 			       spc, flags, false);
2169 	  else
2170 	    pp_string (pp, "<null method basetype>");
2171 	  pp_colon_colon (pp);
2172 	}
2173       if (TYPE_IDENTIFIER (node))
2174 	dump_generic_node (pp, TYPE_NAME (node), spc, flags, false);
2175       else if (TYPE_NAME (node) && DECL_NAME (TYPE_NAME (node)))
2176 	dump_decl_name (pp, TYPE_NAME (node), flags);
2177       else if (flags & TDF_NOUID)
2178 	pp_string (pp, "<Txxxx>");
2179       else
2180 	{
2181 	  pp_string (pp, "<T");
2182 	  pp_scalar (pp, "%x", TYPE_UID (node));
2183 	  pp_character (pp, '>');
2184 	}
2185       dump_function_declaration (pp, node, spc, flags);
2186       break;
2187 
2188     case FUNCTION_DECL:
2189     case CONST_DECL:
2190       dump_decl_name (pp, node, flags);
2191       break;
2192 
2193     case LABEL_DECL:
2194       if (DECL_NAME (node))
2195 	dump_decl_name (pp, node, flags);
2196       else if (LABEL_DECL_UID (node) != -1)
2197 	{
2198 	  if (flags & TDF_GIMPLE)
2199 	    {
2200 	      pp_character (pp, 'L');
2201 	      pp_decimal_int (pp, (int) LABEL_DECL_UID (node));
2202 	    }
2203 	  else
2204 	    {
2205 	      pp_string (pp, "<L");
2206 	      pp_decimal_int (pp, (int) LABEL_DECL_UID (node));
2207 	      pp_character (pp, '>');
2208 	    }
2209 	}
2210       else
2211 	{
2212 	  if (flags & TDF_NOUID)
2213 	    pp_string (pp, "<D.xxxx>");
2214 	  else
2215 	    {
2216 	      if (flags & TDF_GIMPLE)
2217 		{
2218 		  pp_character (pp, 'D');
2219 		  pp_scalar (pp, "%u", DECL_UID (node));
2220 		}
2221 	      else
2222 		{
2223 		  pp_string (pp, "<D.");
2224 		  pp_scalar (pp, "%u", DECL_UID (node));
2225 		  pp_character (pp, '>');
2226 		}
2227 	    }
2228 	}
2229       break;
2230 
2231     case TYPE_DECL:
2232       if (DECL_IS_UNDECLARED_BUILTIN (node))
2233 	{
2234 	  /* Don't print the declaration of built-in types.  */
2235 	  break;
2236 	}
2237       if (DECL_NAME (node))
2238 	dump_decl_name (pp, node, flags);
2239       else if (TYPE_NAME (TREE_TYPE (node)) != node)
2240 	{
2241 	  pp_string (pp, (TREE_CODE (TREE_TYPE (node)) == UNION_TYPE
2242 			  ? "union" : "struct "));
2243 	  dump_generic_node (pp, TREE_TYPE (node), spc, flags, false);
2244 	}
2245       else
2246 	pp_string (pp, "<anon>");
2247       break;
2248 
2249     case VAR_DECL:
2250     case PARM_DECL:
2251     case FIELD_DECL:
2252     case DEBUG_EXPR_DECL:
2253     case NAMESPACE_DECL:
2254     case NAMELIST_DECL:
2255       dump_decl_name (pp, node, flags);
2256       break;
2257 
2258     case RESULT_DECL:
2259       pp_string (pp, "<retval>");
2260       break;
2261 
2262     case COMPONENT_REF:
2263       op0 = TREE_OPERAND (node, 0);
2264       str = ".";
2265       if (op0
2266 	  && (TREE_CODE (op0) == INDIRECT_REF
2267 	      || (TREE_CODE (op0) == MEM_REF
2268 		  && TREE_CODE (TREE_OPERAND (op0, 0)) != ADDR_EXPR
2269 		  && integer_zerop (TREE_OPERAND (op0, 1))
2270 		  /* Dump the types of INTEGER_CSTs explicitly, for we
2271 		     can't infer them and MEM_ATTR caching will share
2272 		     MEM_REFs with differently-typed op0s.  */
2273 		  && TREE_CODE (TREE_OPERAND (op0, 0)) != INTEGER_CST
2274 		  /* Released SSA_NAMES have no TREE_TYPE.  */
2275 		  && TREE_TYPE (TREE_OPERAND (op0, 0)) != NULL_TREE
2276 		  /* Same pointer types, but ignoring POINTER_TYPE vs.
2277 		     REFERENCE_TYPE.  */
2278 		  && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0, 0)))
2279 		      == TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0, 1))))
2280 		  && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0, 0)))
2281 		      == TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0, 1))))
2282 		  && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0, 0)))
2283 		      == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0, 1))))
2284 		  /* Same value types ignoring qualifiers.  */
2285 		  && (TYPE_MAIN_VARIANT (TREE_TYPE (op0))
2286 		      == TYPE_MAIN_VARIANT
2287 		          (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0, 1)))))
2288 		  && MR_DEPENDENCE_CLIQUE (op0) == 0)))
2289 	{
2290 	  op0 = TREE_OPERAND (op0, 0);
2291 	  str = "->";
2292 	}
2293       if (op_prio (op0) < op_prio (node))
2294 	pp_left_paren (pp);
2295       dump_generic_node (pp, op0, spc, flags, false);
2296       if (op_prio (op0) < op_prio (node))
2297 	pp_right_paren (pp);
2298       pp_string (pp, str);
2299       dump_generic_node (pp, TREE_OPERAND (node, 1), spc, flags, false);
2300       op0 = component_ref_field_offset (node);
2301       if (op0 && TREE_CODE (op0) != INTEGER_CST)
2302 	{
2303 	  pp_string (pp, "{off: ");
2304 	      dump_generic_node (pp, op0, spc, flags, false);
2305 	      pp_right_brace (pp);
2306 	}
2307       break;
2308 
2309     case BIT_FIELD_REF:
2310       if (flags & TDF_GIMPLE)
2311 	{
2312 	  pp_string (pp, "__BIT_FIELD_REF <");
2313 	  dump_generic_node (pp, TREE_TYPE (node),
2314 			     spc, flags | TDF_SLIM, false);
2315 	  if (TYPE_ALIGN (TREE_TYPE (node))
2316 	      != TYPE_ALIGN (TYPE_MAIN_VARIANT (TREE_TYPE (node))))
2317 	    {
2318 	      pp_string (pp, ", ");
2319 	      pp_decimal_int (pp, TYPE_ALIGN (TREE_TYPE (node)));
2320 	    }
2321 	  pp_greater (pp);
2322 	  pp_string (pp, " (");
2323 	  dump_generic_node (pp, TREE_OPERAND (node, 0), spc,
2324 			     flags | TDF_SLIM, false);
2325 	  pp_string (pp, ", ");
2326 	  dump_generic_node (pp, TREE_OPERAND (node, 1), spc,
2327 			     flags | TDF_SLIM, false);
2328 	  pp_string (pp, ", ");
2329 	  dump_generic_node (pp, TREE_OPERAND (node, 2), spc,
2330 			     flags | TDF_SLIM, false);
2331 	  pp_right_paren (pp);
2332 	}
2333       else
2334 	{
2335 	  pp_string (pp, "BIT_FIELD_REF <");
2336 	  dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2337 	  pp_string (pp, ", ");
2338 	  dump_generic_node (pp, TREE_OPERAND (node, 1), spc, flags, false);
2339 	  pp_string (pp, ", ");
2340 	  dump_generic_node (pp, TREE_OPERAND (node, 2), spc, flags, false);
2341 	  pp_greater (pp);
2342 	}
2343       break;
2344 
2345     case BIT_INSERT_EXPR:
2346       pp_string (pp, "BIT_INSERT_EXPR <");
2347       dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2348       pp_string (pp, ", ");
2349       dump_generic_node (pp, TREE_OPERAND (node, 1), spc, flags, false);
2350       pp_string (pp, ", ");
2351       dump_generic_node (pp, TREE_OPERAND (node, 2), spc, flags, false);
2352       pp_string (pp, " (");
2353       if (INTEGRAL_TYPE_P (TREE_TYPE (TREE_OPERAND (node, 1))))
2354 	pp_decimal_int (pp,
2355 			TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (node, 1))));
2356       else
2357 	dump_generic_node (pp, TYPE_SIZE (TREE_TYPE (TREE_OPERAND (node, 1))),
2358 			   spc, flags, false);
2359       pp_string (pp, " bits)>");
2360       break;
2361 
2362     case ARRAY_REF:
2363     case ARRAY_RANGE_REF:
2364       op0 = TREE_OPERAND (node, 0);
2365       if (op_prio (op0) < op_prio (node))
2366 	pp_left_paren (pp);
2367       dump_generic_node (pp, op0, spc, flags, false);
2368       if (op_prio (op0) < op_prio (node))
2369 	pp_right_paren (pp);
2370       pp_left_bracket (pp);
2371       dump_generic_node (pp, TREE_OPERAND (node, 1), spc, flags, false);
2372       if (TREE_CODE (node) == ARRAY_RANGE_REF)
2373 	pp_string (pp, " ...");
2374       pp_right_bracket (pp);
2375 
2376       op0 = array_ref_low_bound (node);
2377       op1 = array_ref_element_size (node);
2378 
2379       if (!integer_zerop (op0)
2380 	  || TREE_OPERAND (node, 2)
2381 	  || TREE_OPERAND (node, 3))
2382 	{
2383 	  pp_string (pp, "{lb: ");
2384 	  dump_generic_node (pp, op0, spc, flags, false);
2385 	  pp_string (pp, " sz: ");
2386 	  dump_generic_node (pp, op1, spc, flags, false);
2387 	  pp_right_brace (pp);
2388 	}
2389       break;
2390 
2391     case CONSTRUCTOR:
2392       {
2393 	unsigned HOST_WIDE_INT ix;
2394 	tree field, val;
2395 	bool is_struct_init = false;
2396 	bool is_array_init = false;
2397 	widest_int curidx;
2398 	if (flags & TDF_GIMPLE)
2399 	  {
2400 	    pp_string (pp, "_Literal (");
2401 	    dump_generic_node (pp, TREE_TYPE (node), spc, flags, false);
2402 	    pp_string (pp, ") ");
2403 	  }
2404 	pp_left_brace (pp);
2405 	if (TREE_CLOBBER_P (node))
2406 	  pp_string (pp, "CLOBBER");
2407 	else if (TREE_CODE (TREE_TYPE (node)) == RECORD_TYPE
2408 		 || TREE_CODE (TREE_TYPE (node)) == UNION_TYPE)
2409 	  is_struct_init = true;
2410         else if (TREE_CODE (TREE_TYPE (node)) == ARRAY_TYPE
2411 		 && TYPE_DOMAIN (TREE_TYPE (node))
2412 		 && TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node)))
2413 		 && TREE_CODE (TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node))))
2414 		    == INTEGER_CST)
2415 	  {
2416 	    tree minv = TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node)));
2417 	    is_array_init = true;
2418 	    curidx = wi::to_widest (minv);
2419 	  }
2420 	FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (node), ix, field, val)
2421 	  {
2422 	    if (field)
2423 	      {
2424 		if (is_struct_init)
2425 		  {
2426 		    pp_dot (pp);
2427 		    dump_generic_node (pp, field, spc, flags, false);
2428 		    pp_equal (pp);
2429 		  }
2430 		else if (is_array_init
2431 			 && (TREE_CODE (field) != INTEGER_CST
2432 			     || curidx != wi::to_widest (field)))
2433 		  {
2434 		    pp_left_bracket (pp);
2435 		    if (TREE_CODE (field) == RANGE_EXPR)
2436 		      {
2437 			dump_generic_node (pp, TREE_OPERAND (field, 0), spc,
2438 					   flags, false);
2439 			pp_string (pp, " ... ");
2440 			dump_generic_node (pp, TREE_OPERAND (field, 1), spc,
2441 					   flags, false);
2442 			if (TREE_CODE (TREE_OPERAND (field, 1)) == INTEGER_CST)
2443 			  curidx = wi::to_widest (TREE_OPERAND (field, 1));
2444 		      }
2445 		    else
2446 		      dump_generic_node (pp, field, spc, flags, false);
2447 		    if (TREE_CODE (field) == INTEGER_CST)
2448 		      curidx = wi::to_widest (field);
2449 		    pp_string (pp, "]=");
2450 		  }
2451 	      }
2452             if (is_array_init)
2453 	      curidx += 1;
2454 	    if (val && TREE_CODE (val) == ADDR_EXPR)
2455 	      if (TREE_CODE (TREE_OPERAND (val, 0)) == FUNCTION_DECL)
2456 		val = TREE_OPERAND (val, 0);
2457 	    if (val && TREE_CODE (val) == FUNCTION_DECL)
2458 		dump_decl_name (pp, val, flags);
2459 	    else
2460 		dump_generic_node (pp, val, spc, flags, false);
2461 	    if (ix != CONSTRUCTOR_NELTS (node) - 1)
2462 	      {
2463 		pp_comma (pp);
2464 		pp_space (pp);
2465 	      }
2466 	  }
2467 	pp_right_brace (pp);
2468       }
2469       break;
2470 
2471     case COMPOUND_EXPR:
2472       {
2473 	tree *tp;
2474 	if (flags & TDF_SLIM)
2475 	  {
2476 	    pp_string (pp, "<COMPOUND_EXPR>");
2477 	    break;
2478 	  }
2479 
2480 	dump_generic_node (pp, TREE_OPERAND (node, 0),
2481 			   spc, flags, !(flags & TDF_SLIM));
2482 	if (flags & TDF_SLIM)
2483 	  newline_and_indent (pp, spc);
2484 	else
2485 	  {
2486 	    pp_comma (pp);
2487 	    pp_space (pp);
2488 	  }
2489 
2490 	for (tp = &TREE_OPERAND (node, 1);
2491 	     TREE_CODE (*tp) == COMPOUND_EXPR;
2492 	     tp = &TREE_OPERAND (*tp, 1))
2493 	  {
2494 	    dump_generic_node (pp, TREE_OPERAND (*tp, 0),
2495 			       spc, flags, !(flags & TDF_SLIM));
2496 	    if (flags & TDF_SLIM)
2497 	      newline_and_indent (pp, spc);
2498 	    else
2499 	      {
2500 	        pp_comma (pp);
2501 	        pp_space (pp);
2502 	      }
2503 	  }
2504 
2505 	dump_generic_node (pp, *tp, spc, flags, !(flags & TDF_SLIM));
2506       }
2507       break;
2508 
2509     case STATEMENT_LIST:
2510       {
2511 	tree_stmt_iterator si;
2512 	bool first = true;
2513 
2514 	if (flags & TDF_SLIM)
2515 	  {
2516 	    pp_string (pp, "<STATEMENT_LIST>");
2517 	    break;
2518 	  }
2519 
2520 	for (si = tsi_start (node); !tsi_end_p (si); tsi_next (&si))
2521 	  {
2522 	    if (!first)
2523 	      newline_and_indent (pp, spc);
2524 	    else
2525 	      first = false;
2526 	    dump_generic_node (pp, tsi_stmt (si), spc, flags, true);
2527 	  }
2528       }
2529       break;
2530 
2531     case MODIFY_EXPR:
2532     case INIT_EXPR:
2533       dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags,
2534 	  		 false);
2535       pp_space (pp);
2536       pp_equal (pp);
2537       pp_space (pp);
2538       dump_generic_node (pp, TREE_OPERAND (node, 1), spc, flags,
2539 	  		 false);
2540       break;
2541 
2542     case TARGET_EXPR:
2543       pp_string (pp, "TARGET_EXPR <");
2544       dump_generic_node (pp, TARGET_EXPR_SLOT (node), spc, flags, false);
2545       pp_comma (pp);
2546       pp_space (pp);
2547       dump_generic_node (pp, TARGET_EXPR_INITIAL (node), spc, flags, false);
2548       pp_greater (pp);
2549       break;
2550 
2551     case DECL_EXPR:
2552       print_declaration (pp, DECL_EXPR_DECL (node), spc, flags);
2553       is_stmt = false;
2554       break;
2555 
2556     case COND_EXPR:
2557       if (TREE_TYPE (node) == NULL || TREE_TYPE (node) == void_type_node)
2558 	{
2559 	  pp_string (pp, "if (");
2560 	  dump_generic_node (pp, COND_EXPR_COND (node), spc, flags, false);
2561 	  pp_right_paren (pp);
2562 	  /* The lowered cond_exprs should always be printed in full.  */
2563 	  if (COND_EXPR_THEN (node)
2564 	      && (IS_EMPTY_STMT (COND_EXPR_THEN (node))
2565 		  || TREE_CODE (COND_EXPR_THEN (node)) == GOTO_EXPR)
2566 	      && COND_EXPR_ELSE (node)
2567 	      && (IS_EMPTY_STMT (COND_EXPR_ELSE (node))
2568 		  || TREE_CODE (COND_EXPR_ELSE (node)) == GOTO_EXPR))
2569 	    {
2570 	      pp_space (pp);
2571 	      dump_generic_node (pp, COND_EXPR_THEN (node),
2572 				 0, flags, true);
2573 	      if (!IS_EMPTY_STMT (COND_EXPR_ELSE (node)))
2574 		{
2575 		  pp_string (pp, " else ");
2576 		  dump_generic_node (pp, COND_EXPR_ELSE (node),
2577 				     0, flags, true);
2578 		}
2579 	    }
2580 	  else if (!(flags & TDF_SLIM))
2581 	    {
2582 	      /* Output COND_EXPR_THEN.  */
2583 	      if (COND_EXPR_THEN (node))
2584 		{
2585 		  newline_and_indent (pp, spc+2);
2586 		  pp_left_brace (pp);
2587 		  newline_and_indent (pp, spc+4);
2588 		  dump_generic_node (pp, COND_EXPR_THEN (node), spc+4,
2589 				     flags, true);
2590 		  newline_and_indent (pp, spc+2);
2591 		  pp_right_brace (pp);
2592 		}
2593 
2594 	      /* Output COND_EXPR_ELSE.  */
2595 	      if (COND_EXPR_ELSE (node)
2596 		  && !IS_EMPTY_STMT (COND_EXPR_ELSE (node)))
2597 		{
2598 		  newline_and_indent (pp, spc);
2599 		  pp_string (pp, "else");
2600 		  newline_and_indent (pp, spc+2);
2601 		  pp_left_brace (pp);
2602 		  newline_and_indent (pp, spc+4);
2603 		  dump_generic_node (pp, COND_EXPR_ELSE (node), spc+4,
2604 			             flags, true);
2605 		  newline_and_indent (pp, spc+2);
2606 		  pp_right_brace (pp);
2607 		}
2608 	    }
2609 	  is_expr = false;
2610 	}
2611       else
2612 	{
2613 	  dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2614 	  pp_space (pp);
2615 	  pp_question (pp);
2616 	  pp_space (pp);
2617 	  dump_generic_node (pp, TREE_OPERAND (node, 1), spc, flags, false);
2618 	  pp_space (pp);
2619 	  pp_colon (pp);
2620 	  pp_space (pp);
2621 	  dump_generic_node (pp, TREE_OPERAND (node, 2), spc, flags, false);
2622 	}
2623       break;
2624 
2625     case BIND_EXPR:
2626       pp_left_brace (pp);
2627       if (!(flags & TDF_SLIM))
2628 	{
2629 	  if (BIND_EXPR_VARS (node))
2630 	    {
2631 	      pp_newline (pp);
2632 
2633 	      for (op0 = BIND_EXPR_VARS (node); op0; op0 = DECL_CHAIN (op0))
2634 		{
2635 		  print_declaration (pp, op0, spc+2, flags);
2636 		  pp_newline (pp);
2637 		}
2638 	    }
2639 
2640 	  newline_and_indent (pp, spc+2);
2641 	  dump_generic_node (pp, BIND_EXPR_BODY (node), spc+2, flags, true);
2642 	  newline_and_indent (pp, spc);
2643 	  pp_right_brace (pp);
2644 	}
2645       is_expr = false;
2646       break;
2647 
2648     case CALL_EXPR:
2649       if (CALL_EXPR_FN (node) != NULL_TREE)
2650 	print_call_name (pp, CALL_EXPR_FN (node), flags);
2651       else
2652 	{
2653 	  pp_dot (pp);
2654 	  pp_string (pp, internal_fn_name (CALL_EXPR_IFN (node)));
2655 	}
2656 
2657       /* Print parameters.  */
2658       pp_space (pp);
2659       pp_left_paren (pp);
2660       {
2661 	tree arg;
2662 	call_expr_arg_iterator iter;
2663 	FOR_EACH_CALL_EXPR_ARG (arg, iter, node)
2664 	  {
2665 	    dump_generic_node (pp, arg, spc, flags, false);
2666 	    if (more_call_expr_args_p (&iter))
2667 	      {
2668 		pp_comma (pp);
2669 		pp_space (pp);
2670 	      }
2671 	  }
2672       }
2673       if (CALL_EXPR_VA_ARG_PACK (node))
2674 	{
2675 	  if (call_expr_nargs (node) > 0)
2676 	    {
2677 	      pp_comma (pp);
2678 	      pp_space (pp);
2679 	    }
2680 	  pp_string (pp, "__builtin_va_arg_pack ()");
2681 	}
2682       pp_right_paren (pp);
2683 
2684       op1 = CALL_EXPR_STATIC_CHAIN (node);
2685       if (op1)
2686 	{
2687 	  pp_string (pp, " [static-chain: ");
2688 	  dump_generic_node (pp, op1, spc, flags, false);
2689 	  pp_right_bracket (pp);
2690 	}
2691 
2692       if (CALL_EXPR_RETURN_SLOT_OPT (node))
2693 	pp_string (pp, " [return slot optimization]");
2694       if (CALL_EXPR_TAILCALL (node))
2695 	pp_string (pp, " [tail call]");
2696       break;
2697 
2698     case WITH_CLEANUP_EXPR:
2699       NIY;
2700       break;
2701 
2702     case CLEANUP_POINT_EXPR:
2703       pp_string (pp, "<<cleanup_point ");
2704       dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2705       pp_string (pp, ">>");
2706       break;
2707 
2708     case PLACEHOLDER_EXPR:
2709       pp_string (pp, "<PLACEHOLDER_EXPR ");
2710       dump_generic_node (pp, TREE_TYPE (node), spc, flags, false);
2711       pp_greater (pp);
2712       break;
2713 
2714       /* Binary arithmetic and logic expressions.  */
2715     case WIDEN_PLUS_EXPR:
2716     case WIDEN_MINUS_EXPR:
2717     case WIDEN_SUM_EXPR:
2718     case WIDEN_MULT_EXPR:
2719     case MULT_EXPR:
2720     case MULT_HIGHPART_EXPR:
2721     case PLUS_EXPR:
2722     case POINTER_PLUS_EXPR:
2723     case POINTER_DIFF_EXPR:
2724     case MINUS_EXPR:
2725     case TRUNC_DIV_EXPR:
2726     case CEIL_DIV_EXPR:
2727     case FLOOR_DIV_EXPR:
2728     case ROUND_DIV_EXPR:
2729     case TRUNC_MOD_EXPR:
2730     case CEIL_MOD_EXPR:
2731     case FLOOR_MOD_EXPR:
2732     case ROUND_MOD_EXPR:
2733     case RDIV_EXPR:
2734     case EXACT_DIV_EXPR:
2735     case LSHIFT_EXPR:
2736     case RSHIFT_EXPR:
2737     case LROTATE_EXPR:
2738     case RROTATE_EXPR:
2739     case WIDEN_LSHIFT_EXPR:
2740     case BIT_IOR_EXPR:
2741     case BIT_XOR_EXPR:
2742     case BIT_AND_EXPR:
2743     case TRUTH_ANDIF_EXPR:
2744     case TRUTH_ORIF_EXPR:
2745     case TRUTH_AND_EXPR:
2746     case TRUTH_OR_EXPR:
2747     case TRUTH_XOR_EXPR:
2748     case LT_EXPR:
2749     case LE_EXPR:
2750     case GT_EXPR:
2751     case GE_EXPR:
2752     case EQ_EXPR:
2753     case NE_EXPR:
2754     case UNLT_EXPR:
2755     case UNLE_EXPR:
2756     case UNGT_EXPR:
2757     case UNGE_EXPR:
2758     case UNEQ_EXPR:
2759     case LTGT_EXPR:
2760     case ORDERED_EXPR:
2761     case UNORDERED_EXPR:
2762       {
2763 	const char *op = op_symbol (node);
2764 	op0 = TREE_OPERAND (node, 0);
2765 	op1 = TREE_OPERAND (node, 1);
2766 
2767 	/* When the operands are expressions with less priority,
2768 	   keep semantics of the tree representation.  */
2769 	if (op_prio (op0) <= op_prio (node))
2770 	  {
2771 	    pp_left_paren (pp);
2772 	    dump_generic_node (pp, op0, spc, flags, false);
2773 	    pp_right_paren (pp);
2774 	  }
2775 	else
2776 	  dump_generic_node (pp, op0, spc, flags, false);
2777 
2778 	pp_space (pp);
2779 	pp_string (pp, op);
2780 	pp_space (pp);
2781 
2782 	/* When the operands are expressions with less priority,
2783 	   keep semantics of the tree representation.  */
2784 	if (op_prio (op1) <= op_prio (node))
2785 	  {
2786 	    pp_left_paren (pp);
2787 	    dump_generic_node (pp, op1, spc, flags, false);
2788 	    pp_right_paren (pp);
2789 	  }
2790 	else
2791 	  dump_generic_node (pp, op1, spc, flags, false);
2792       }
2793       break;
2794 
2795       /* Unary arithmetic and logic expressions.  */
2796     case NEGATE_EXPR:
2797     case BIT_NOT_EXPR:
2798     case TRUTH_NOT_EXPR:
2799     case ADDR_EXPR:
2800     case PREDECREMENT_EXPR:
2801     case PREINCREMENT_EXPR:
2802     case INDIRECT_REF:
2803       if (TREE_CODE (node) == ADDR_EXPR
2804 	  && (TREE_CODE (TREE_OPERAND (node, 0)) == STRING_CST
2805 	      || TREE_CODE (TREE_OPERAND (node, 0)) == FUNCTION_DECL))
2806 	;	/* Do not output '&' for strings and function pointers.  */
2807       else
2808 	pp_string (pp, op_symbol (node));
2809 
2810       if (op_prio (TREE_OPERAND (node, 0)) < op_prio (node))
2811 	{
2812 	  pp_left_paren (pp);
2813 	  dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2814 	  pp_right_paren (pp);
2815 	}
2816       else
2817 	dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2818       break;
2819 
2820     case POSTDECREMENT_EXPR:
2821     case POSTINCREMENT_EXPR:
2822       if (op_prio (TREE_OPERAND (node, 0)) < op_prio (node))
2823 	{
2824 	  pp_left_paren (pp);
2825 	  dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2826 	  pp_right_paren (pp);
2827 	}
2828       else
2829 	dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2830       pp_string (pp, op_symbol (node));
2831       break;
2832 
2833     case MIN_EXPR:
2834       pp_string (pp, "MIN_EXPR <");
2835       dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2836       pp_string (pp, ", ");
2837       dump_generic_node (pp, TREE_OPERAND (node, 1), spc, flags, false);
2838       pp_greater (pp);
2839       break;
2840 
2841     case MAX_EXPR:
2842       pp_string (pp, "MAX_EXPR <");
2843       dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2844       pp_string (pp, ", ");
2845       dump_generic_node (pp, TREE_OPERAND (node, 1), spc, flags, false);
2846       pp_greater (pp);
2847       break;
2848 
2849     case ABS_EXPR:
2850       pp_string (pp, "ABS_EXPR <");
2851       dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2852       pp_greater (pp);
2853       break;
2854 
2855     case ABSU_EXPR:
2856       pp_string (pp, "ABSU_EXPR <");
2857       dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2858       pp_greater (pp);
2859       break;
2860 
2861     case RANGE_EXPR:
2862       NIY;
2863       break;
2864 
2865     case ADDR_SPACE_CONVERT_EXPR:
2866     case FIXED_CONVERT_EXPR:
2867     case FIX_TRUNC_EXPR:
2868     case FLOAT_EXPR:
2869     CASE_CONVERT:
2870       type = TREE_TYPE (node);
2871       op0 = TREE_OPERAND (node, 0);
2872       if (type != TREE_TYPE (op0))
2873 	{
2874 	  pp_left_paren (pp);
2875 	  dump_generic_node (pp, type, spc, flags, false);
2876 	  pp_string (pp, ") ");
2877 	}
2878       if (op_prio (op0) < op_prio (node))
2879 	pp_left_paren (pp);
2880       dump_generic_node (pp, op0, spc, flags, false);
2881       if (op_prio (op0) < op_prio (node))
2882 	pp_right_paren (pp);
2883       break;
2884 
2885     case VIEW_CONVERT_EXPR:
2886       if (flags & TDF_GIMPLE)
2887 	pp_string (pp, "__VIEW_CONVERT <");
2888       else
2889 	pp_string (pp, "VIEW_CONVERT_EXPR<");
2890       dump_generic_node (pp, TREE_TYPE (node), spc, flags, false);
2891       pp_string (pp, ">(");
2892       dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2893       pp_right_paren (pp);
2894       break;
2895 
2896     case PAREN_EXPR:
2897       pp_string (pp, "((");
2898       dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2899       pp_string (pp, "))");
2900       break;
2901 
2902     case NON_LVALUE_EXPR:
2903       pp_string (pp, "NON_LVALUE_EXPR <");
2904       dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2905       pp_greater (pp);
2906       break;
2907 
2908     case SAVE_EXPR:
2909       pp_string (pp, "SAVE_EXPR <");
2910       dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2911       pp_greater (pp);
2912       break;
2913 
2914     case COMPLEX_EXPR:
2915       pp_string (pp, "COMPLEX_EXPR <");
2916       dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2917       pp_string (pp, ", ");
2918       dump_generic_node (pp, TREE_OPERAND (node, 1), spc, flags, false);
2919       pp_greater (pp);
2920       break;
2921 
2922     case CONJ_EXPR:
2923       pp_string (pp, "CONJ_EXPR <");
2924       dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2925       pp_greater (pp);
2926       break;
2927 
2928     case REALPART_EXPR:
2929       if (flags & TDF_GIMPLE)
2930 	{
2931 	  pp_string (pp, "__real ");
2932 	  dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2933 	}
2934       else
2935 	{
2936 	  pp_string (pp, "REALPART_EXPR <");
2937 	  dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2938 	  pp_greater (pp);
2939 	}
2940       break;
2941 
2942     case IMAGPART_EXPR:
2943       if (flags & TDF_GIMPLE)
2944 	{
2945 	  pp_string (pp, "__imag ");
2946 	  dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2947 	}
2948       else
2949 	{
2950 	  pp_string (pp, "IMAGPART_EXPR <");
2951 	  dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2952 	  pp_greater (pp);
2953 	}
2954       break;
2955 
2956     case VA_ARG_EXPR:
2957       pp_string (pp, "VA_ARG_EXPR <");
2958       dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2959       pp_greater (pp);
2960       break;
2961 
2962     case TRY_FINALLY_EXPR:
2963     case TRY_CATCH_EXPR:
2964       pp_string (pp, "try");
2965       newline_and_indent (pp, spc+2);
2966       pp_left_brace (pp);
2967       newline_and_indent (pp, spc+4);
2968       dump_generic_node (pp, TREE_OPERAND (node, 0), spc+4, flags, true);
2969       newline_and_indent (pp, spc+2);
2970       pp_right_brace (pp);
2971       newline_and_indent (pp, spc);
2972       if (TREE_CODE (node) == TRY_CATCH_EXPR)
2973 	{
2974 	  node = TREE_OPERAND (node, 1);
2975 	  pp_string (pp, "catch");
2976 	}
2977       else
2978 	{
2979 	  gcc_assert (TREE_CODE (node) == TRY_FINALLY_EXPR);
2980 	  node = TREE_OPERAND (node, 1);
2981 	  pp_string (pp, "finally");
2982 	  if (TREE_CODE (node) == EH_ELSE_EXPR)
2983 	    {
2984 	      newline_and_indent (pp, spc+2);
2985 	      pp_left_brace (pp);
2986 	      newline_and_indent (pp, spc+4);
2987 	      dump_generic_node (pp, TREE_OPERAND (node, 0), spc+4,
2988 				 flags, true);
2989 	      newline_and_indent (pp, spc+2);
2990 	      pp_right_brace (pp);
2991 	      newline_and_indent (pp, spc);
2992 	      node = TREE_OPERAND (node, 1);
2993 	      pp_string (pp, "else");
2994 	    }
2995 	}
2996       newline_and_indent (pp, spc+2);
2997       pp_left_brace (pp);
2998       newline_and_indent (pp, spc+4);
2999       dump_generic_node (pp, node, spc+4, flags, true);
3000       newline_and_indent (pp, spc+2);
3001       pp_right_brace (pp);
3002       is_expr = false;
3003       break;
3004 
3005     case CATCH_EXPR:
3006       pp_string (pp, "catch (");
3007       dump_generic_node (pp, CATCH_TYPES (node), spc+2, flags, false);
3008       pp_right_paren (pp);
3009       newline_and_indent (pp, spc+2);
3010       pp_left_brace (pp);
3011       newline_and_indent (pp, spc+4);
3012       dump_generic_node (pp, CATCH_BODY (node), spc+4, flags, true);
3013       newline_and_indent (pp, spc+2);
3014       pp_right_brace (pp);
3015       is_expr = false;
3016       break;
3017 
3018     case EH_FILTER_EXPR:
3019       pp_string (pp, "<<<eh_filter (");
3020       dump_generic_node (pp, EH_FILTER_TYPES (node), spc+2, flags, false);
3021       pp_string (pp, ")>>>");
3022       newline_and_indent (pp, spc+2);
3023       pp_left_brace (pp);
3024       newline_and_indent (pp, spc+4);
3025       dump_generic_node (pp, EH_FILTER_FAILURE (node), spc+4, flags, true);
3026       newline_and_indent (pp, spc+2);
3027       pp_right_brace (pp);
3028       is_expr = false;
3029       break;
3030 
3031     case LABEL_EXPR:
3032       op0 = TREE_OPERAND (node, 0);
3033       /* If this is for break or continue, don't bother printing it.  */
3034       if (DECL_NAME (op0))
3035 	{
3036 	  const char *name = IDENTIFIER_POINTER (DECL_NAME (op0));
3037 	  if (strcmp (name, "break") == 0
3038 	      || strcmp (name, "continue") == 0)
3039 	    break;
3040 	}
3041       dump_generic_node (pp, op0, spc, flags, false);
3042       pp_colon (pp);
3043       if (DECL_NONLOCAL (op0))
3044 	pp_string (pp, " [non-local]");
3045       break;
3046 
3047     case LOOP_EXPR:
3048       pp_string (pp, "while (1)");
3049       if (!(flags & TDF_SLIM))
3050 	{
3051 	  newline_and_indent (pp, spc+2);
3052 	  pp_left_brace (pp);
3053 	  newline_and_indent (pp, spc+4);
3054 	  dump_generic_node (pp, LOOP_EXPR_BODY (node), spc+4, flags, true);
3055 	  newline_and_indent (pp, spc+2);
3056 	  pp_right_brace (pp);
3057 	}
3058       is_expr = false;
3059       break;
3060 
3061     case PREDICT_EXPR:
3062       pp_string (pp, "// predicted ");
3063       if (PREDICT_EXPR_OUTCOME (node))
3064         pp_string (pp, "likely by ");
3065       else
3066         pp_string (pp, "unlikely by ");
3067       pp_string (pp, predictor_name (PREDICT_EXPR_PREDICTOR (node)));
3068       pp_string (pp, " predictor.");
3069       break;
3070 
3071     case ANNOTATE_EXPR:
3072       pp_string (pp, "ANNOTATE_EXPR <");
3073       dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
3074       switch ((enum annot_expr_kind) TREE_INT_CST_LOW (TREE_OPERAND (node, 1)))
3075 	{
3076 	case annot_expr_ivdep_kind:
3077 	  pp_string (pp, ", ivdep");
3078 	  break;
3079 	case annot_expr_unroll_kind:
3080 	  {
3081 	    pp_string (pp, ", unroll ");
3082 	    pp_decimal_int (pp,
3083 			    (int) TREE_INT_CST_LOW (TREE_OPERAND (node, 2)));
3084 	    break;
3085 	  }
3086 	case annot_expr_no_vector_kind:
3087 	  pp_string (pp, ", no-vector");
3088 	  break;
3089 	case annot_expr_vector_kind:
3090 	  pp_string (pp, ", vector");
3091 	  break;
3092 	case annot_expr_parallel_kind:
3093 	  pp_string (pp, ", parallel");
3094 	  break;
3095 	default:
3096 	  gcc_unreachable ();
3097 	}
3098       pp_greater (pp);
3099       break;
3100 
3101     case RETURN_EXPR:
3102       pp_string (pp, "return");
3103       op0 = TREE_OPERAND (node, 0);
3104       if (op0)
3105 	{
3106 	  pp_space (pp);
3107 	  if (TREE_CODE (op0) == MODIFY_EXPR)
3108 	    dump_generic_node (pp, TREE_OPERAND (op0, 1),
3109 			       spc, flags, false);
3110 	  else
3111 	    dump_generic_node (pp, op0, spc, flags, false);
3112 	}
3113       break;
3114 
3115     case EXIT_EXPR:
3116       pp_string (pp, "if (");
3117       dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
3118       pp_string (pp, ") break");
3119       break;
3120 
3121     case SWITCH_EXPR:
3122       pp_string (pp, "switch (");
3123       dump_generic_node (pp, SWITCH_COND (node), spc, flags, false);
3124       pp_right_paren (pp);
3125       if (!(flags & TDF_SLIM))
3126 	{
3127 	  newline_and_indent (pp, spc+2);
3128 	  pp_left_brace (pp);
3129 	  if (SWITCH_BODY (node))
3130 	    {
3131 	      newline_and_indent (pp, spc+4);
3132 	      dump_generic_node (pp, SWITCH_BODY (node), spc+4, flags,
3133 		                 true);
3134 	    }
3135 	  newline_and_indent (pp, spc+2);
3136 	  pp_right_brace (pp);
3137 	}
3138       is_expr = false;
3139       break;
3140 
3141     case GOTO_EXPR:
3142       op0 = GOTO_DESTINATION (node);
3143       if (TREE_CODE (op0) != SSA_NAME && DECL_P (op0) && DECL_NAME (op0))
3144 	{
3145 	  const char *name = IDENTIFIER_POINTER (DECL_NAME (op0));
3146 	  if (strcmp (name, "break") == 0
3147 	      || strcmp (name, "continue") == 0)
3148 	    {
3149 	      pp_string (pp, name);
3150 	      break;
3151 	    }
3152 	}
3153       pp_string (pp, "goto ");
3154       dump_generic_node (pp, op0, spc, flags, false);
3155       break;
3156 
3157     case ASM_EXPR:
3158       pp_string (pp, "__asm__");
3159       if (ASM_VOLATILE_P (node))
3160 	pp_string (pp, " __volatile__");
3161       pp_left_paren (pp);
3162       dump_generic_node (pp, ASM_STRING (node), spc, flags, false);
3163       pp_colon (pp);
3164       dump_generic_node (pp, ASM_OUTPUTS (node), spc, flags, false);
3165       pp_colon (pp);
3166       dump_generic_node (pp, ASM_INPUTS (node), spc, flags, false);
3167       if (ASM_CLOBBERS (node))
3168 	{
3169 	  pp_colon (pp);
3170 	  dump_generic_node (pp, ASM_CLOBBERS (node), spc, flags, false);
3171 	}
3172       pp_right_paren (pp);
3173       break;
3174 
3175     case CASE_LABEL_EXPR:
3176       if (CASE_LOW (node) && CASE_HIGH (node))
3177 	{
3178 	  pp_string (pp, "case ");
3179 	  dump_generic_node (pp, CASE_LOW (node), spc, flags, false);
3180 	  pp_string (pp, " ... ");
3181 	  dump_generic_node (pp, CASE_HIGH (node), spc, flags, false);
3182 	}
3183       else if (CASE_LOW (node))
3184 	{
3185 	  pp_string (pp, "case ");
3186 	  dump_generic_node (pp, CASE_LOW (node), spc, flags, false);
3187 	}
3188       else
3189 	pp_string (pp, "default");
3190       pp_colon (pp);
3191       break;
3192 
3193     case OBJ_TYPE_REF:
3194       pp_string (pp, "OBJ_TYPE_REF(");
3195       dump_generic_node (pp, OBJ_TYPE_REF_EXPR (node), spc, flags, false);
3196       pp_semicolon (pp);
3197       /* We omit the class type for -fcompare-debug because we may
3198 	 drop TYPE_BINFO early depending on debug info, and then
3199 	 virtual_method_call_p would return false, whereas when
3200 	 TYPE_BINFO is preserved it may still return true and then
3201 	 we'd print the class type.  Compare tree and rtl dumps for
3202 	 libstdc++-prettyprinters/shared_ptr.cc with and without -g,
3203 	 for example, at occurrences of OBJ_TYPE_REF.  */
3204       if (!(flags & (TDF_SLIM | TDF_COMPARE_DEBUG))
3205 	  && virtual_method_call_p (node, true))
3206 	{
3207 	  pp_string (pp, "(");
3208 	  dump_generic_node (pp, obj_type_ref_class (node, true),
3209 			     spc, flags, false);
3210 	  pp_string (pp, ")");
3211 	}
3212       dump_generic_node (pp, OBJ_TYPE_REF_OBJECT (node), spc, flags, false);
3213       pp_arrow (pp);
3214       dump_generic_node (pp, OBJ_TYPE_REF_TOKEN (node), spc, flags, false);
3215       pp_right_paren (pp);
3216       break;
3217 
3218     case SSA_NAME:
3219       if (SSA_NAME_IDENTIFIER (node))
3220 	{
3221 	  if ((flags & TDF_NOUID)
3222 	      && SSA_NAME_VAR (node)
3223 	      && DECL_NAMELESS (SSA_NAME_VAR (node)))
3224 	    dump_fancy_name (pp, SSA_NAME_IDENTIFIER (node));
3225 	  else if (! (flags & TDF_GIMPLE)
3226 		   || SSA_NAME_VAR (node))
3227 	    dump_generic_node (pp, SSA_NAME_IDENTIFIER (node),
3228 			       spc, flags, false);
3229 	}
3230       pp_underscore (pp);
3231       pp_decimal_int (pp, SSA_NAME_VERSION (node));
3232       if (SSA_NAME_IS_DEFAULT_DEF (node))
3233 	pp_string (pp, "(D)");
3234       if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (node))
3235 	pp_string (pp, "(ab)");
3236       break;
3237 
3238     case WITH_SIZE_EXPR:
3239       pp_string (pp, "WITH_SIZE_EXPR <");
3240       dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
3241       pp_string (pp, ", ");
3242       dump_generic_node (pp, TREE_OPERAND (node, 1), spc, flags, false);
3243       pp_greater (pp);
3244       break;
3245 
3246     case ASSERT_EXPR:
3247       pp_string (pp, "ASSERT_EXPR <");
3248       dump_generic_node (pp, ASSERT_EXPR_VAR (node), spc, flags, false);
3249       pp_string (pp, ", ");
3250       dump_generic_node (pp, ASSERT_EXPR_COND (node), spc, flags, false);
3251       pp_greater (pp);
3252       break;
3253 
3254     case SCEV_KNOWN:
3255       pp_string (pp, "scev_known");
3256       break;
3257 
3258     case SCEV_NOT_KNOWN:
3259       pp_string (pp, "scev_not_known");
3260       break;
3261 
3262     case POLYNOMIAL_CHREC:
3263       pp_left_brace (pp);
3264       dump_generic_node (pp, CHREC_LEFT (node), spc, flags, false);
3265       pp_string (pp, ", +, ");
3266       dump_generic_node (pp, CHREC_RIGHT (node), spc, flags, false);
3267       pp_string (pp, "}_");
3268       pp_scalar (pp, "%u", CHREC_VARIABLE (node));
3269       is_stmt = false;
3270       break;
3271 
3272     case REALIGN_LOAD_EXPR:
3273       pp_string (pp, "REALIGN_LOAD <");
3274       dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
3275       pp_string (pp, ", ");
3276       dump_generic_node (pp, TREE_OPERAND (node, 1), spc, flags, false);
3277       pp_string (pp, ", ");
3278       dump_generic_node (pp, TREE_OPERAND (node, 2), spc, flags, false);
3279       pp_greater (pp);
3280       break;
3281 
3282     case VEC_COND_EXPR:
3283       pp_string (pp, " VEC_COND_EXPR < ");
3284       dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
3285       pp_string (pp, " , ");
3286       dump_generic_node (pp, TREE_OPERAND (node, 1), spc, flags, false);
3287       pp_string (pp, " , ");
3288       dump_generic_node (pp, TREE_OPERAND (node, 2), spc, flags, false);
3289       pp_string (pp, " > ");
3290       break;
3291 
3292     case VEC_PERM_EXPR:
3293       pp_string (pp, " VEC_PERM_EXPR < ");
3294       dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
3295       pp_string (pp, " , ");
3296       dump_generic_node (pp, TREE_OPERAND (node, 1), spc, flags, false);
3297       pp_string (pp, " , ");
3298       dump_generic_node (pp, TREE_OPERAND (node, 2), spc, flags, false);
3299       pp_string (pp, " > ");
3300       break;
3301 
3302     case DOT_PROD_EXPR:
3303       pp_string (pp, " DOT_PROD_EXPR < ");
3304       dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
3305       pp_string (pp, ", ");
3306       dump_generic_node (pp, TREE_OPERAND (node, 1), spc, flags, false);
3307       pp_string (pp, ", ");
3308       dump_generic_node (pp, TREE_OPERAND (node, 2), spc, flags, false);
3309       pp_string (pp, " > ");
3310       break;
3311 
3312     case WIDEN_MULT_PLUS_EXPR:
3313       pp_string (pp, " WIDEN_MULT_PLUS_EXPR < ");
3314       dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
3315       pp_string (pp, ", ");
3316       dump_generic_node (pp, TREE_OPERAND (node, 1), spc, flags, false);
3317       pp_string (pp, ", ");
3318       dump_generic_node (pp, TREE_OPERAND (node, 2), spc, flags, false);
3319       pp_string (pp, " > ");
3320       break;
3321 
3322     case WIDEN_MULT_MINUS_EXPR:
3323       pp_string (pp, " WIDEN_MULT_MINUS_EXPR < ");
3324       dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
3325       pp_string (pp, ", ");
3326       dump_generic_node (pp, TREE_OPERAND (node, 1), spc, flags, false);
3327       pp_string (pp, ", ");
3328       dump_generic_node (pp, TREE_OPERAND (node, 2), spc, flags, false);
3329       pp_string (pp, " > ");
3330       break;
3331 
3332     case OACC_PARALLEL:
3333       pp_string (pp, "#pragma acc parallel");
3334       goto dump_omp_clauses_body;
3335 
3336     case OACC_KERNELS:
3337       pp_string (pp, "#pragma acc kernels");
3338       goto dump_omp_clauses_body;
3339 
3340     case OACC_SERIAL:
3341       pp_string (pp, "#pragma acc serial");
3342       goto dump_omp_clauses_body;
3343 
3344     case OACC_DATA:
3345       pp_string (pp, "#pragma acc data");
3346       dump_omp_clauses (pp, OACC_DATA_CLAUSES (node), spc, flags);
3347       goto dump_omp_body;
3348 
3349     case OACC_HOST_DATA:
3350       pp_string (pp, "#pragma acc host_data");
3351       dump_omp_clauses (pp, OACC_HOST_DATA_CLAUSES (node), spc, flags);
3352       goto dump_omp_body;
3353 
3354     case OACC_DECLARE:
3355       pp_string (pp, "#pragma acc declare");
3356       dump_omp_clauses (pp, OACC_DECLARE_CLAUSES (node), spc, flags);
3357       break;
3358 
3359     case OACC_UPDATE:
3360       pp_string (pp, "#pragma acc update");
3361       dump_omp_clauses (pp, OACC_UPDATE_CLAUSES (node), spc, flags);
3362       break;
3363 
3364     case OACC_ENTER_DATA:
3365       pp_string (pp, "#pragma acc enter data");
3366       dump_omp_clauses (pp, OACC_ENTER_DATA_CLAUSES (node), spc, flags);
3367       break;
3368 
3369     case OACC_EXIT_DATA:
3370       pp_string (pp, "#pragma acc exit data");
3371       dump_omp_clauses (pp, OACC_EXIT_DATA_CLAUSES (node), spc, flags);
3372       break;
3373 
3374     case OACC_CACHE:
3375       pp_string (pp, "#pragma acc cache");
3376       dump_omp_clauses (pp, OACC_CACHE_CLAUSES (node), spc, flags);
3377       break;
3378 
3379     case OMP_PARALLEL:
3380       pp_string (pp, "#pragma omp parallel");
3381       dump_omp_clauses (pp, OMP_PARALLEL_CLAUSES (node), spc, flags);
3382       goto dump_omp_body;
3383 
3384     dump_omp_clauses_body:
3385       dump_omp_clauses (pp, OMP_CLAUSES (node), spc, flags);
3386       goto dump_omp_body;
3387 
3388     dump_omp_body:
3389       if (!(flags & TDF_SLIM) && OMP_BODY (node))
3390 	{
3391 	  newline_and_indent (pp, spc + 2);
3392 	  pp_left_brace (pp);
3393 	  newline_and_indent (pp, spc + 4);
3394 	  dump_generic_node (pp, OMP_BODY (node), spc + 4, flags, false);
3395 	  newline_and_indent (pp, spc + 2);
3396 	  pp_right_brace (pp);
3397 	}
3398       is_expr = false;
3399       break;
3400 
3401     case OMP_TASK:
3402       pp_string (pp, OMP_TASK_BODY (node) ? "#pragma omp task"
3403 					  : "#pragma omp taskwait");
3404       dump_omp_clauses (pp, OMP_TASK_CLAUSES (node), spc, flags);
3405       goto dump_omp_body;
3406 
3407     case OMP_FOR:
3408       pp_string (pp, "#pragma omp for");
3409       goto dump_omp_loop;
3410 
3411     case OMP_SIMD:
3412       pp_string (pp, "#pragma omp simd");
3413       goto dump_omp_loop;
3414 
3415     case OMP_DISTRIBUTE:
3416       pp_string (pp, "#pragma omp distribute");
3417       goto dump_omp_loop;
3418 
3419     case OMP_TASKLOOP:
3420       pp_string (pp, "#pragma omp taskloop");
3421       goto dump_omp_loop;
3422 
3423     case OMP_LOOP:
3424       pp_string (pp, "#pragma omp loop");
3425       goto dump_omp_loop;
3426 
3427     case OACC_LOOP:
3428       pp_string (pp, "#pragma acc loop");
3429       goto dump_omp_loop;
3430 
3431     case OMP_TEAMS:
3432       pp_string (pp, "#pragma omp teams");
3433       dump_omp_clauses (pp, OMP_TEAMS_CLAUSES (node), spc, flags);
3434       goto dump_omp_body;
3435 
3436     case OMP_TARGET_DATA:
3437       pp_string (pp, "#pragma omp target data");
3438       dump_omp_clauses (pp, OMP_TARGET_DATA_CLAUSES (node), spc, flags);
3439       goto dump_omp_body;
3440 
3441     case OMP_TARGET_ENTER_DATA:
3442       pp_string (pp, "#pragma omp target enter data");
3443       dump_omp_clauses (pp, OMP_TARGET_ENTER_DATA_CLAUSES (node), spc, flags);
3444       is_expr = false;
3445       break;
3446 
3447     case OMP_TARGET_EXIT_DATA:
3448       pp_string (pp, "#pragma omp target exit data");
3449       dump_omp_clauses (pp, OMP_TARGET_EXIT_DATA_CLAUSES (node), spc, flags);
3450       is_expr = false;
3451       break;
3452 
3453     case OMP_TARGET:
3454       pp_string (pp, "#pragma omp target");
3455       dump_omp_clauses (pp, OMP_TARGET_CLAUSES (node), spc, flags);
3456       goto dump_omp_body;
3457 
3458     case OMP_TARGET_UPDATE:
3459       pp_string (pp, "#pragma omp target update");
3460       dump_omp_clauses (pp, OMP_TARGET_UPDATE_CLAUSES (node), spc, flags);
3461       is_expr = false;
3462       break;
3463 
3464     dump_omp_loop:
3465       dump_omp_clauses (pp, OMP_FOR_CLAUSES (node), spc, flags);
3466       if (!(flags & TDF_SLIM))
3467 	{
3468 	  int i;
3469 
3470 	  if (OMP_FOR_PRE_BODY (node))
3471 	    {
3472 	      newline_and_indent (pp, spc + 2);
3473 	      pp_left_brace (pp);
3474 	      spc += 4;
3475 	      newline_and_indent (pp, spc);
3476 	      dump_generic_node (pp, OMP_FOR_PRE_BODY (node),
3477 				 spc, flags, false);
3478 	    }
3479 	  if (OMP_FOR_INIT (node))
3480 	    {
3481 	      spc -= 2;
3482 	      for (i = 0; i < TREE_VEC_LENGTH (OMP_FOR_INIT (node)); i++)
3483 		{
3484 		  spc += 2;
3485 		  newline_and_indent (pp, spc);
3486 		  pp_string (pp, "for (");
3487 		  tree init = TREE_VEC_ELT (OMP_FOR_INIT (node), i);
3488 		  if (TREE_CODE (init) != MODIFY_EXPR
3489 		      || TREE_CODE (TREE_OPERAND (init, 1)) != TREE_VEC)
3490 		    dump_generic_node (pp, init, spc, flags, false);
3491 		  else
3492 		    {
3493 		      dump_generic_node (pp, TREE_OPERAND (init, 0),
3494 					 spc, flags, false);
3495 		      pp_string (pp, " = ");
3496 		      dump_omp_loop_non_rect_expr (pp, TREE_OPERAND (init, 1),
3497 						   spc, flags);
3498 		    }
3499 		  pp_string (pp, "; ");
3500 		  tree cond = TREE_VEC_ELT (OMP_FOR_COND (node), i);
3501 		  if (!COMPARISON_CLASS_P (cond)
3502 		      || TREE_CODE (TREE_OPERAND (cond, 1)) != TREE_VEC)
3503 		    dump_generic_node (pp, cond, spc, flags, false);
3504 		  else
3505 		    {
3506 		      dump_generic_node (pp, TREE_OPERAND (cond, 0),
3507 					 spc, flags, false);
3508 		      const char *op = op_symbol (cond);
3509 		      pp_space (pp);
3510 		      pp_string (pp, op);
3511 		      pp_space (pp);
3512 		      dump_omp_loop_non_rect_expr (pp, TREE_OPERAND (cond, 1),
3513 						   spc, flags);
3514 		    }
3515 		  pp_string (pp, "; ");
3516 		  dump_generic_node (pp,
3517 				     TREE_VEC_ELT (OMP_FOR_INCR (node), i),
3518 				     spc, flags, false);
3519 		  pp_right_paren (pp);
3520 		}
3521 	    }
3522 	  if (OMP_FOR_BODY (node))
3523 	    {
3524 	      newline_and_indent (pp, spc + 2);
3525 	      pp_left_brace (pp);
3526 	      newline_and_indent (pp, spc + 4);
3527 	      dump_generic_node (pp, OMP_FOR_BODY (node), spc + 4, flags,
3528 		  false);
3529 	      newline_and_indent (pp, spc + 2);
3530 	      pp_right_brace (pp);
3531 	    }
3532 	  if (OMP_FOR_INIT (node))
3533 	    spc -= 2 * TREE_VEC_LENGTH (OMP_FOR_INIT (node)) - 2;
3534 	  if (OMP_FOR_PRE_BODY (node))
3535 	    {
3536 	      spc -= 4;
3537 	      newline_and_indent (pp, spc + 2);
3538 	      pp_right_brace (pp);
3539 	    }
3540 	}
3541       is_expr = false;
3542       break;
3543 
3544     case OMP_SECTIONS:
3545       pp_string (pp, "#pragma omp sections");
3546       dump_omp_clauses (pp, OMP_SECTIONS_CLAUSES (node), spc, flags);
3547       goto dump_omp_body;
3548 
3549     case OMP_SECTION:
3550       pp_string (pp, "#pragma omp section");
3551       goto dump_omp_body;
3552 
3553     case OMP_SCAN:
3554       if (OMP_SCAN_CLAUSES (node))
3555 	{
3556 	  pp_string (pp, "#pragma omp scan");
3557 	  dump_omp_clauses (pp, OMP_SCAN_CLAUSES (node), spc, flags);
3558 	}
3559       goto dump_omp_body;
3560 
3561     case OMP_MASTER:
3562       pp_string (pp, "#pragma omp master");
3563       goto dump_omp_body;
3564 
3565     case OMP_TASKGROUP:
3566       pp_string (pp, "#pragma omp taskgroup");
3567       dump_omp_clauses (pp, OMP_TASKGROUP_CLAUSES (node), spc, flags);
3568       goto dump_omp_body;
3569 
3570     case OMP_ORDERED:
3571       pp_string (pp, "#pragma omp ordered");
3572       dump_omp_clauses (pp, OMP_ORDERED_CLAUSES (node), spc, flags);
3573       goto dump_omp_body;
3574 
3575     case OMP_CRITICAL:
3576       pp_string (pp, "#pragma omp critical");
3577       if (OMP_CRITICAL_NAME (node))
3578 	{
3579 	  pp_space (pp);
3580 	  pp_left_paren (pp);
3581           dump_generic_node (pp, OMP_CRITICAL_NAME (node), spc,
3582 			     flags, false);
3583 	  pp_right_paren (pp);
3584 	}
3585       dump_omp_clauses (pp, OMP_CRITICAL_CLAUSES (node), spc, flags);
3586       goto dump_omp_body;
3587 
3588     case OMP_ATOMIC:
3589       pp_string (pp, "#pragma omp atomic");
3590       dump_omp_atomic_memory_order (pp, OMP_ATOMIC_MEMORY_ORDER (node));
3591       newline_and_indent (pp, spc + 2);
3592       dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
3593       pp_space (pp);
3594       pp_equal (pp);
3595       pp_space (pp);
3596       dump_generic_node (pp, TREE_OPERAND (node, 1), spc, flags, false);
3597       break;
3598 
3599     case OMP_ATOMIC_READ:
3600       pp_string (pp, "#pragma omp atomic read");
3601       dump_omp_atomic_memory_order (pp, OMP_ATOMIC_MEMORY_ORDER (node));
3602       newline_and_indent (pp, spc + 2);
3603       dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
3604       pp_space (pp);
3605       break;
3606 
3607     case OMP_ATOMIC_CAPTURE_OLD:
3608     case OMP_ATOMIC_CAPTURE_NEW:
3609       pp_string (pp, "#pragma omp atomic capture");
3610       dump_omp_atomic_memory_order (pp, OMP_ATOMIC_MEMORY_ORDER (node));
3611       newline_and_indent (pp, spc + 2);
3612       dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
3613       pp_space (pp);
3614       pp_equal (pp);
3615       pp_space (pp);
3616       dump_generic_node (pp, TREE_OPERAND (node, 1), spc, flags, false);
3617       break;
3618 
3619     case OMP_SINGLE:
3620       pp_string (pp, "#pragma omp single");
3621       dump_omp_clauses (pp, OMP_SINGLE_CLAUSES (node), spc, flags);
3622       goto dump_omp_body;
3623 
3624     case OMP_CLAUSE:
3625       dump_omp_clause (pp, node, spc, flags);
3626       is_expr = false;
3627       break;
3628 
3629     case TRANSACTION_EXPR:
3630       if (TRANSACTION_EXPR_OUTER (node))
3631 	pp_string (pp, "__transaction_atomic [[outer]]");
3632       else if (TRANSACTION_EXPR_RELAXED (node))
3633 	pp_string (pp, "__transaction_relaxed");
3634       else
3635 	pp_string (pp, "__transaction_atomic");
3636       if (!(flags & TDF_SLIM) && TRANSACTION_EXPR_BODY (node))
3637 	{
3638 	  newline_and_indent (pp, spc);
3639 	  pp_left_brace (pp);
3640 	  newline_and_indent (pp, spc + 2);
3641 	  dump_generic_node (pp, TRANSACTION_EXPR_BODY (node),
3642 			     spc + 2, flags, false);
3643 	  newline_and_indent (pp, spc);
3644 	  pp_right_brace (pp);
3645 	}
3646       is_expr = false;
3647       break;
3648 
3649     case VEC_SERIES_EXPR:
3650     case VEC_WIDEN_MULT_HI_EXPR:
3651     case VEC_WIDEN_MULT_LO_EXPR:
3652     case VEC_WIDEN_PLUS_HI_EXPR:
3653     case VEC_WIDEN_PLUS_LO_EXPR:
3654     case VEC_WIDEN_MINUS_HI_EXPR:
3655     case VEC_WIDEN_MINUS_LO_EXPR:
3656     case VEC_WIDEN_MULT_EVEN_EXPR:
3657     case VEC_WIDEN_MULT_ODD_EXPR:
3658     case VEC_WIDEN_LSHIFT_HI_EXPR:
3659     case VEC_WIDEN_LSHIFT_LO_EXPR:
3660       pp_space (pp);
3661       for (str = get_tree_code_name (code); *str; str++)
3662 	pp_character (pp, TOUPPER (*str));
3663       pp_string (pp, " < ");
3664       dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
3665       pp_string (pp, ", ");
3666       dump_generic_node (pp, TREE_OPERAND (node, 1), spc, flags, false);
3667       pp_string (pp, " > ");
3668       break;
3669 
3670     case VEC_DUPLICATE_EXPR:
3671       pp_space (pp);
3672       for (str = get_tree_code_name (code); *str; str++)
3673 	pp_character (pp, TOUPPER (*str));
3674       pp_string (pp, " < ");
3675       dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
3676       pp_string (pp, " > ");
3677       break;
3678 
3679     case VEC_UNPACK_HI_EXPR:
3680       pp_string (pp, " VEC_UNPACK_HI_EXPR < ");
3681       dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
3682       pp_string (pp, " > ");
3683       break;
3684 
3685     case VEC_UNPACK_LO_EXPR:
3686       pp_string (pp, " VEC_UNPACK_LO_EXPR < ");
3687       dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
3688       pp_string (pp, " > ");
3689       break;
3690 
3691     case VEC_UNPACK_FLOAT_HI_EXPR:
3692       pp_string (pp, " VEC_UNPACK_FLOAT_HI_EXPR < ");
3693       dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
3694       pp_string (pp, " > ");
3695       break;
3696 
3697     case VEC_UNPACK_FLOAT_LO_EXPR:
3698       pp_string (pp, " VEC_UNPACK_FLOAT_LO_EXPR < ");
3699       dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
3700       pp_string (pp, " > ");
3701       break;
3702 
3703     case VEC_UNPACK_FIX_TRUNC_HI_EXPR:
3704       pp_string (pp, " VEC_UNPACK_FIX_TRUNC_HI_EXPR < ");
3705       dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
3706       pp_string (pp, " > ");
3707       break;
3708 
3709     case VEC_UNPACK_FIX_TRUNC_LO_EXPR:
3710       pp_string (pp, " VEC_UNPACK_FIX_TRUNC_LO_EXPR < ");
3711       dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
3712       pp_string (pp, " > ");
3713       break;
3714 
3715     case VEC_PACK_TRUNC_EXPR:
3716       pp_string (pp, " VEC_PACK_TRUNC_EXPR < ");
3717       dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
3718       pp_string (pp, ", ");
3719       dump_generic_node (pp, TREE_OPERAND (node, 1), spc, flags, false);
3720       pp_string (pp, " > ");
3721       break;
3722 
3723     case VEC_PACK_SAT_EXPR:
3724       pp_string (pp, " VEC_PACK_SAT_EXPR < ");
3725       dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
3726       pp_string (pp, ", ");
3727       dump_generic_node (pp, TREE_OPERAND (node, 1), spc, flags, false);
3728       pp_string (pp, " > ");
3729       break;
3730 
3731     case VEC_PACK_FIX_TRUNC_EXPR:
3732       pp_string (pp, " VEC_PACK_FIX_TRUNC_EXPR < ");
3733       dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
3734       pp_string (pp, ", ");
3735       dump_generic_node (pp, TREE_OPERAND (node, 1), spc, flags, false);
3736       pp_string (pp, " > ");
3737       break;
3738 
3739     case VEC_PACK_FLOAT_EXPR:
3740       pp_string (pp, " VEC_PACK_FLOAT_EXPR < ");
3741       dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
3742       pp_string (pp, ", ");
3743       dump_generic_node (pp, TREE_OPERAND (node, 1), spc, flags, false);
3744       pp_string (pp, " > ");
3745       break;
3746 
3747     case BLOCK:
3748       dump_block_node (pp, node, spc, flags);
3749       break;
3750 
3751     case DEBUG_BEGIN_STMT:
3752       pp_string (pp, "# DEBUG BEGIN STMT");
3753       break;
3754 
3755     default:
3756       NIY;
3757     }
3758 
3759   if (is_stmt && is_expr)
3760     pp_semicolon (pp);
3761 
3762   return spc;
3763 }
3764 
3765 /* Print the declaration of a variable.  */
3766 
3767 void
print_declaration(pretty_printer * pp,tree t,int spc,dump_flags_t flags)3768 print_declaration (pretty_printer *pp, tree t, int spc, dump_flags_t flags)
3769 {
3770   INDENT (spc);
3771 
3772   if (TREE_CODE(t) == NAMELIST_DECL)
3773     {
3774       pp_string(pp, "namelist ");
3775       dump_decl_name (pp, t, flags);
3776       pp_semicolon (pp);
3777       return;
3778     }
3779 
3780   if (TREE_CODE (t) == TYPE_DECL)
3781     pp_string (pp, "typedef ");
3782 
3783   if (CODE_CONTAINS_STRUCT (TREE_CODE (t), TS_DECL_WRTL) && DECL_REGISTER (t))
3784     pp_string (pp, "register ");
3785 
3786   if (TREE_PUBLIC (t) && DECL_EXTERNAL (t))
3787     pp_string (pp, "extern ");
3788   else if (TREE_STATIC (t))
3789     pp_string (pp, "static ");
3790 
3791   /* Print the type and name.  */
3792   if (TREE_TYPE (t) && TREE_CODE (TREE_TYPE (t)) == ARRAY_TYPE)
3793     {
3794       tree tmp;
3795 
3796       /* Print array's type.  */
3797       tmp = TREE_TYPE (t);
3798       while (TREE_CODE (TREE_TYPE (tmp)) == ARRAY_TYPE)
3799 	tmp = TREE_TYPE (tmp);
3800       dump_generic_node (pp, TREE_TYPE (tmp), spc, flags, false);
3801 
3802       /* Print variable's name.  */
3803       pp_space (pp);
3804       dump_generic_node (pp, t, spc, flags, false);
3805 
3806       /* Print the dimensions.  */
3807       tmp = TREE_TYPE (t);
3808       while (TREE_CODE (tmp) == ARRAY_TYPE)
3809 	{
3810 	  dump_array_domain (pp, TYPE_DOMAIN (tmp), spc, flags);
3811 	  tmp = TREE_TYPE (tmp);
3812 	}
3813     }
3814   else if (TREE_CODE (t) == FUNCTION_DECL)
3815     {
3816       dump_generic_node (pp, TREE_TYPE (TREE_TYPE (t)), spc, flags, false);
3817       pp_space (pp);
3818       dump_decl_name (pp, t, flags);
3819       dump_function_declaration (pp, TREE_TYPE (t), spc, flags);
3820     }
3821   else
3822     {
3823       /* Print type declaration.  */
3824       dump_generic_node (pp, TREE_TYPE (t), spc, flags, false);
3825 
3826       /* Print variable's name.  */
3827       pp_space (pp);
3828       dump_generic_node (pp, t, spc, flags, false);
3829     }
3830 
3831   if (VAR_P (t) && DECL_HARD_REGISTER (t))
3832     {
3833       pp_string (pp, " __asm__ ");
3834       pp_left_paren (pp);
3835       dump_generic_node (pp, DECL_ASSEMBLER_NAME (t), spc, flags, false);
3836       pp_right_paren (pp);
3837     }
3838 
3839   /* The initial value of a function serves to determine whether the function
3840      is declared or defined.  So the following does not apply to function
3841      nodes.  */
3842   if (TREE_CODE (t) != FUNCTION_DECL)
3843     {
3844       /* Print the initial value.  */
3845       if (DECL_INITIAL (t))
3846 	{
3847 	  pp_space (pp);
3848 	  pp_equal (pp);
3849 	  pp_space (pp);
3850 	  if (!(flags & TDF_SLIM))
3851 	    dump_generic_node (pp, DECL_INITIAL (t), spc, flags, false);
3852 	  else
3853 	    pp_string (pp, "<<< omitted >>>");
3854 	}
3855     }
3856 
3857   if (VAR_P (t) && DECL_HAS_VALUE_EXPR_P (t))
3858     {
3859       pp_string (pp, " [value-expr: ");
3860       dump_generic_node (pp, DECL_VALUE_EXPR (t), spc, flags, false);
3861       pp_right_bracket (pp);
3862     }
3863 
3864   pp_semicolon (pp);
3865 }
3866 
3867 
3868 /* Prints a structure: name, fields, and methods.
3869    FIXME: Still incomplete.  */
3870 
3871 static void
print_struct_decl(pretty_printer * pp,const_tree node,int spc,dump_flags_t flags)3872 print_struct_decl (pretty_printer *pp, const_tree node, int spc,
3873 		   dump_flags_t flags)
3874 {
3875   /* Print the name of the structure.  */
3876   if (TYPE_NAME (node))
3877     {
3878       INDENT (spc);
3879       if (TREE_CODE (node) == RECORD_TYPE)
3880 	pp_string (pp, "struct ");
3881       else if ((TREE_CODE (node) == UNION_TYPE
3882 		|| TREE_CODE (node) == QUAL_UNION_TYPE))
3883 	pp_string (pp, "union ");
3884 
3885       dump_generic_node (pp, TYPE_NAME (node), spc, TDF_NONE, false);
3886     }
3887 
3888   /* Print the contents of the structure.  */
3889   pp_newline (pp);
3890   INDENT (spc);
3891   pp_left_brace (pp);
3892   pp_newline (pp);
3893 
3894   /* Print the fields of the structure.  */
3895   {
3896     tree tmp;
3897     tmp = TYPE_FIELDS (node);
3898     while (tmp)
3899       {
3900 	/* Avoid to print recursively the structure.  */
3901 	/* FIXME : Not implemented correctly...,
3902 	   what about the case when we have a cycle in the contain graph? ...
3903 	   Maybe this could be solved by looking at the scope in which the
3904 	   structure was declared.  */
3905 	if (TREE_TYPE (tmp) != node
3906 	    && (TREE_CODE (TREE_TYPE (tmp)) != POINTER_TYPE
3907 		|| TREE_TYPE (TREE_TYPE (tmp)) != node))
3908 	  {
3909 	    print_declaration (pp, tmp, spc+2, flags);
3910 	    pp_newline (pp);
3911 	  }
3912 	tmp = DECL_CHAIN (tmp);
3913       }
3914   }
3915   INDENT (spc);
3916   pp_right_brace (pp);
3917 }
3918 
3919 /* Return the priority of the operator CODE.
3920 
3921    From lowest to highest precedence with either left-to-right (L-R)
3922    or right-to-left (R-L) associativity]:
3923 
3924      1	[L-R] ,
3925      2	[R-L] = += -= *= /= %= &= ^= |= <<= >>=
3926      3	[R-L] ?:
3927      4	[L-R] ||
3928      5	[L-R] &&
3929      6	[L-R] |
3930      7	[L-R] ^
3931      8	[L-R] &
3932      9	[L-R] == !=
3933     10	[L-R] < <= > >=
3934     11	[L-R] << >>
3935     12	[L-R] + -
3936     13	[L-R] * / %
3937     14	[R-L] ! ~ ++ -- + - * & (type) sizeof
3938     15	[L-R] fn() [] -> .
3939 
3940    unary +, - and * have higher precedence than the corresponding binary
3941    operators.  */
3942 
3943 int
op_code_prio(enum tree_code code)3944 op_code_prio (enum tree_code code)
3945 {
3946   switch (code)
3947     {
3948     case TREE_LIST:
3949     case COMPOUND_EXPR:
3950     case BIND_EXPR:
3951       return 1;
3952 
3953     case MODIFY_EXPR:
3954     case INIT_EXPR:
3955       return 2;
3956 
3957     case COND_EXPR:
3958       return 3;
3959 
3960     case TRUTH_OR_EXPR:
3961     case TRUTH_ORIF_EXPR:
3962       return 4;
3963 
3964     case TRUTH_AND_EXPR:
3965     case TRUTH_ANDIF_EXPR:
3966       return 5;
3967 
3968     case BIT_IOR_EXPR:
3969       return 6;
3970 
3971     case BIT_XOR_EXPR:
3972     case TRUTH_XOR_EXPR:
3973       return 7;
3974 
3975     case BIT_AND_EXPR:
3976       return 8;
3977 
3978     case EQ_EXPR:
3979     case NE_EXPR:
3980       return 9;
3981 
3982     case UNLT_EXPR:
3983     case UNLE_EXPR:
3984     case UNGT_EXPR:
3985     case UNGE_EXPR:
3986     case UNEQ_EXPR:
3987     case LTGT_EXPR:
3988     case ORDERED_EXPR:
3989     case UNORDERED_EXPR:
3990     case LT_EXPR:
3991     case LE_EXPR:
3992     case GT_EXPR:
3993     case GE_EXPR:
3994       return 10;
3995 
3996     case LSHIFT_EXPR:
3997     case RSHIFT_EXPR:
3998     case LROTATE_EXPR:
3999     case RROTATE_EXPR:
4000     case VEC_WIDEN_LSHIFT_HI_EXPR:
4001     case VEC_WIDEN_LSHIFT_LO_EXPR:
4002     case WIDEN_LSHIFT_EXPR:
4003       return 11;
4004 
4005     case WIDEN_SUM_EXPR:
4006     case PLUS_EXPR:
4007     case POINTER_PLUS_EXPR:
4008     case POINTER_DIFF_EXPR:
4009     case MINUS_EXPR:
4010       return 12;
4011 
4012     case VEC_WIDEN_MULT_HI_EXPR:
4013     case VEC_WIDEN_MULT_LO_EXPR:
4014     case WIDEN_MULT_EXPR:
4015     case DOT_PROD_EXPR:
4016     case WIDEN_MULT_PLUS_EXPR:
4017     case WIDEN_MULT_MINUS_EXPR:
4018     case MULT_EXPR:
4019     case MULT_HIGHPART_EXPR:
4020     case TRUNC_DIV_EXPR:
4021     case CEIL_DIV_EXPR:
4022     case FLOOR_DIV_EXPR:
4023     case ROUND_DIV_EXPR:
4024     case RDIV_EXPR:
4025     case EXACT_DIV_EXPR:
4026     case TRUNC_MOD_EXPR:
4027     case CEIL_MOD_EXPR:
4028     case FLOOR_MOD_EXPR:
4029     case ROUND_MOD_EXPR:
4030       return 13;
4031 
4032     case TRUTH_NOT_EXPR:
4033     case BIT_NOT_EXPR:
4034     case POSTINCREMENT_EXPR:
4035     case POSTDECREMENT_EXPR:
4036     case PREINCREMENT_EXPR:
4037     case PREDECREMENT_EXPR:
4038     case NEGATE_EXPR:
4039     case INDIRECT_REF:
4040     case ADDR_EXPR:
4041     case FLOAT_EXPR:
4042     CASE_CONVERT:
4043     case FIX_TRUNC_EXPR:
4044     case TARGET_EXPR:
4045       return 14;
4046 
4047     case CALL_EXPR:
4048     case ARRAY_REF:
4049     case ARRAY_RANGE_REF:
4050     case COMPONENT_REF:
4051       return 15;
4052 
4053       /* Special expressions.  */
4054     case MIN_EXPR:
4055     case MAX_EXPR:
4056     case ABS_EXPR:
4057     case REALPART_EXPR:
4058     case IMAGPART_EXPR:
4059     case VEC_UNPACK_HI_EXPR:
4060     case VEC_UNPACK_LO_EXPR:
4061     case VEC_UNPACK_FLOAT_HI_EXPR:
4062     case VEC_UNPACK_FLOAT_LO_EXPR:
4063     case VEC_UNPACK_FIX_TRUNC_HI_EXPR:
4064     case VEC_UNPACK_FIX_TRUNC_LO_EXPR:
4065     case VEC_PACK_TRUNC_EXPR:
4066     case VEC_PACK_SAT_EXPR:
4067       return 16;
4068 
4069     default:
4070       /* Return an arbitrarily high precedence to avoid surrounding single
4071 	 VAR_DECLs in ()s.  */
4072       return 9999;
4073     }
4074 }
4075 
4076 /* Return the priority of the operator OP.  */
4077 
4078 int
op_prio(const_tree op)4079 op_prio (const_tree op)
4080 {
4081   enum tree_code code;
4082 
4083   if (op == NULL)
4084     return 9999;
4085 
4086   code = TREE_CODE (op);
4087   if (code == SAVE_EXPR || code == NON_LVALUE_EXPR)
4088     return op_prio (TREE_OPERAND (op, 0));
4089 
4090   return op_code_prio (code);
4091 }
4092 
4093 /* Return the symbol associated with operator CODE.  */
4094 
4095 const char *
op_symbol_code(enum tree_code code)4096 op_symbol_code (enum tree_code code)
4097 {
4098   switch (code)
4099     {
4100     case MODIFY_EXPR:
4101       return "=";
4102 
4103     case TRUTH_OR_EXPR:
4104     case TRUTH_ORIF_EXPR:
4105       return "||";
4106 
4107     case TRUTH_AND_EXPR:
4108     case TRUTH_ANDIF_EXPR:
4109       return "&&";
4110 
4111     case BIT_IOR_EXPR:
4112       return "|";
4113 
4114     case TRUTH_XOR_EXPR:
4115     case BIT_XOR_EXPR:
4116       return "^";
4117 
4118     case ADDR_EXPR:
4119     case BIT_AND_EXPR:
4120       return "&";
4121 
4122     case ORDERED_EXPR:
4123       return "ord";
4124     case UNORDERED_EXPR:
4125       return "unord";
4126 
4127     case EQ_EXPR:
4128       return "==";
4129     case UNEQ_EXPR:
4130       return "u==";
4131 
4132     case NE_EXPR:
4133       return "!=";
4134 
4135     case LT_EXPR:
4136       return "<";
4137     case UNLT_EXPR:
4138       return "u<";
4139 
4140     case LE_EXPR:
4141       return "<=";
4142     case UNLE_EXPR:
4143       return "u<=";
4144 
4145     case GT_EXPR:
4146       return ">";
4147     case UNGT_EXPR:
4148       return "u>";
4149 
4150     case GE_EXPR:
4151       return ">=";
4152     case UNGE_EXPR:
4153       return "u>=";
4154 
4155     case LTGT_EXPR:
4156       return "<>";
4157 
4158     case LSHIFT_EXPR:
4159       return "<<";
4160 
4161     case RSHIFT_EXPR:
4162       return ">>";
4163 
4164     case LROTATE_EXPR:
4165       return "r<<";
4166 
4167     case RROTATE_EXPR:
4168       return "r>>";
4169 
4170     case WIDEN_LSHIFT_EXPR:
4171       return "w<<";
4172 
4173     case WIDEN_PLUS_EXPR:
4174       return "w+";
4175 
4176     case WIDEN_MINUS_EXPR:
4177       return "w-";
4178 
4179     case POINTER_PLUS_EXPR:
4180       return "+";
4181 
4182     case PLUS_EXPR:
4183       return "+";
4184 
4185     case WIDEN_SUM_EXPR:
4186       return "w+";
4187 
4188     case WIDEN_MULT_EXPR:
4189       return "w*";
4190 
4191     case MULT_HIGHPART_EXPR:
4192       return "h*";
4193 
4194     case NEGATE_EXPR:
4195     case MINUS_EXPR:
4196     case POINTER_DIFF_EXPR:
4197       return "-";
4198 
4199     case BIT_NOT_EXPR:
4200       return "~";
4201 
4202     case TRUTH_NOT_EXPR:
4203       return "!";
4204 
4205     case MULT_EXPR:
4206     case INDIRECT_REF:
4207       return "*";
4208 
4209     case TRUNC_DIV_EXPR:
4210     case RDIV_EXPR:
4211       return "/";
4212 
4213     case CEIL_DIV_EXPR:
4214       return "/[cl]";
4215 
4216     case FLOOR_DIV_EXPR:
4217       return "/[fl]";
4218 
4219     case ROUND_DIV_EXPR:
4220       return "/[rd]";
4221 
4222     case EXACT_DIV_EXPR:
4223       return "/[ex]";
4224 
4225     case TRUNC_MOD_EXPR:
4226       return "%";
4227 
4228     case CEIL_MOD_EXPR:
4229       return "%[cl]";
4230 
4231     case FLOOR_MOD_EXPR:
4232       return "%[fl]";
4233 
4234     case ROUND_MOD_EXPR:
4235       return "%[rd]";
4236 
4237     case PREDECREMENT_EXPR:
4238       return " --";
4239 
4240     case PREINCREMENT_EXPR:
4241       return " ++";
4242 
4243     case POSTDECREMENT_EXPR:
4244       return "-- ";
4245 
4246     case POSTINCREMENT_EXPR:
4247       return "++ ";
4248 
4249     case MAX_EXPR:
4250       return "max";
4251 
4252     case MIN_EXPR:
4253       return "min";
4254 
4255     default:
4256       return "<<< ??? >>>";
4257     }
4258 }
4259 
4260 /* Return the symbol associated with operator OP.  */
4261 
4262 static const char *
op_symbol(const_tree op)4263 op_symbol (const_tree op)
4264 {
4265   return op_symbol_code (TREE_CODE (op));
4266 }
4267 
4268 /* Prints the name of a call.  NODE is the CALL_EXPR_FN of a CALL_EXPR or
4269    the gimple_call_fn of a GIMPLE_CALL.  */
4270 
4271 void
print_call_name(pretty_printer * pp,tree node,dump_flags_t flags)4272 print_call_name (pretty_printer *pp, tree node, dump_flags_t flags)
4273 {
4274   tree op0 = node;
4275 
4276   if (TREE_CODE (op0) == NON_LVALUE_EXPR)
4277     op0 = TREE_OPERAND (op0, 0);
4278 
4279  again:
4280   switch (TREE_CODE (op0))
4281     {
4282     case VAR_DECL:
4283     case PARM_DECL:
4284     case FUNCTION_DECL:
4285       dump_function_name (pp, op0, flags);
4286       break;
4287 
4288     case ADDR_EXPR:
4289     case INDIRECT_REF:
4290     CASE_CONVERT:
4291       op0 = TREE_OPERAND (op0, 0);
4292       goto again;
4293 
4294     case COND_EXPR:
4295       pp_left_paren (pp);
4296       dump_generic_node (pp, TREE_OPERAND (op0, 0), 0, flags, false);
4297       pp_string (pp, ") ? ");
4298       dump_generic_node (pp, TREE_OPERAND (op0, 1), 0, flags, false);
4299       pp_string (pp, " : ");
4300       dump_generic_node (pp, TREE_OPERAND (op0, 2), 0, flags, false);
4301       break;
4302 
4303     case ARRAY_REF:
4304       if (TREE_CODE (TREE_OPERAND (op0, 0)) == VAR_DECL)
4305 	dump_function_name (pp, TREE_OPERAND (op0, 0), flags);
4306       else
4307 	dump_generic_node (pp, op0, 0, flags, false);
4308       break;
4309 
4310     case MEM_REF:
4311       if (integer_zerop (TREE_OPERAND (op0, 1)))
4312 	{
4313 	  op0 = TREE_OPERAND (op0, 0);
4314 	  goto again;
4315 	}
4316       /* Fallthru.  */
4317     case COMPONENT_REF:
4318     case SSA_NAME:
4319     case OBJ_TYPE_REF:
4320       dump_generic_node (pp, op0, 0, flags, false);
4321       break;
4322 
4323     default:
4324       NIY;
4325     }
4326 }
4327 
4328 /* Print the first N characters in the array STR, replacing non-printable
4329    characters (including embedded nuls) with unambiguous escape sequences.  */
4330 
4331 void
pretty_print_string(pretty_printer * pp,const char * str,size_t n)4332 pretty_print_string (pretty_printer *pp, const char *str, size_t n)
4333 {
4334   if (str == NULL)
4335     return;
4336 
4337   for ( ; n; --n, ++str)
4338     {
4339       switch (str[0])
4340 	{
4341 	case '\b':
4342 	  pp_string (pp, "\\b");
4343 	  break;
4344 
4345 	case '\f':
4346 	  pp_string (pp, "\\f");
4347 	  break;
4348 
4349 	case '\n':
4350 	  pp_string (pp, "\\n");
4351 	  break;
4352 
4353 	case '\r':
4354 	  pp_string (pp, "\\r");
4355 	  break;
4356 
4357 	case '\t':
4358 	  pp_string (pp, "\\t");
4359 	  break;
4360 
4361 	case '\v':
4362 	  pp_string (pp, "\\v");
4363 	  break;
4364 
4365 	case '\\':
4366 	  pp_string (pp, "\\\\");
4367 	  break;
4368 
4369 	case '\"':
4370 	  pp_string (pp, "\\\"");
4371 	  break;
4372 
4373 	case '\'':
4374 	  pp_string (pp, "\\'");
4375 	  break;
4376 
4377 	default:
4378 	  if (str[0] || n > 1)
4379 	    {
4380 	      if (!ISPRINT (str[0]))
4381 		{
4382 		  char buf[5];
4383 		  sprintf (buf, "\\x%02x", (unsigned char)str[0]);
4384 		  pp_string (pp, buf);
4385 		}
4386 	      else
4387 		pp_character (pp, str[0]);
4388 	      break;
4389 	    }
4390 	}
4391     }
4392 }
4393 
4394 static void
maybe_init_pretty_print(FILE * file)4395 maybe_init_pretty_print (FILE *file)
4396 {
4397   if (!tree_pp)
4398     {
4399       tree_pp = new pretty_printer ();
4400       pp_needs_newline (tree_pp) = true;
4401       pp_translate_identifiers (tree_pp) = false;
4402     }
4403 
4404   tree_pp->buffer->stream = file;
4405 }
4406 
4407 static void
newline_and_indent(pretty_printer * pp,int spc)4408 newline_and_indent (pretty_printer *pp, int spc)
4409 {
4410   pp_newline (pp);
4411   INDENT (spc);
4412 }
4413 
4414 /* Handle the %K format for TEXT.  Separate from default_tree_printer
4415    so it can also be used in front ends.
4416    The location LOC and BLOCK are expected to be extracted by the caller
4417    from the %K argument arg via EXPR_LOCATION(arg) and TREE_BLOCK(arg).  */
4418 
4419 void
percent_K_format(text_info * text,location_t loc,tree block)4420 percent_K_format (text_info *text, location_t loc, tree block)
4421 {
4422   text->set_location (0, loc, SHOW_RANGE_WITH_CARET);
4423   gcc_assert (pp_ti_abstract_origin (text) != NULL);
4424   *pp_ti_abstract_origin (text) = NULL;
4425 
4426   while (block
4427 	 && TREE_CODE (block) == BLOCK
4428 	 && BLOCK_ABSTRACT_ORIGIN (block))
4429     {
4430       tree ao = BLOCK_ABSTRACT_ORIGIN (block);
4431       if (TREE_CODE (ao) == FUNCTION_DECL)
4432 	{
4433 	  *pp_ti_abstract_origin (text) = block;
4434 	  break;
4435 	}
4436       block = BLOCK_SUPERCONTEXT (block);
4437     }
4438 }
4439 
4440 /* Print the identifier ID to PRETTY-PRINTER.  */
4441 
4442 void
pp_tree_identifier(pretty_printer * pp,tree id)4443 pp_tree_identifier (pretty_printer *pp, tree id)
4444 {
4445   if (pp_translate_identifiers (pp))
4446     {
4447       const char *text = identifier_to_locale (IDENTIFIER_POINTER (id));
4448       pp_append_text (pp, text, text + strlen (text));
4449     }
4450   else
4451     pp_append_text (pp, IDENTIFIER_POINTER (id),
4452 		    IDENTIFIER_POINTER (id) + IDENTIFIER_LENGTH (id));
4453 }
4454 
4455 /* A helper function that is used to dump function information before the
4456    function dump.  */
4457 
4458 void
dump_function_header(FILE * dump_file,tree fdecl,dump_flags_t flags)4459 dump_function_header (FILE *dump_file, tree fdecl, dump_flags_t flags)
4460 {
4461   const char *dname, *aname;
4462   struct cgraph_node *node = cgraph_node::get (fdecl);
4463   struct function *fun = DECL_STRUCT_FUNCTION (fdecl);
4464 
4465   dname = lang_hooks.decl_printable_name (fdecl, 1);
4466 
4467   if (DECL_ASSEMBLER_NAME_SET_P (fdecl))
4468     aname = (IDENTIFIER_POINTER
4469              (DECL_ASSEMBLER_NAME (fdecl)));
4470   else
4471     aname = "<unset-asm-name>";
4472 
4473   fprintf (dump_file, "\n;; Function %s (%s, funcdef_no=%d",
4474 	   dname, aname, fun->funcdef_no);
4475   if (!(flags & TDF_NOUID))
4476     fprintf (dump_file, ", decl_uid=%d", DECL_UID (fdecl));
4477   if (node)
4478     {
4479       fprintf (dump_file, ", cgraph_uid=%d", node->get_uid ());
4480       fprintf (dump_file, ", symbol_order=%d)%s\n\n", node->order,
4481                node->frequency == NODE_FREQUENCY_HOT
4482                ? " (hot)"
4483                : node->frequency == NODE_FREQUENCY_UNLIKELY_EXECUTED
4484                ? " (unlikely executed)"
4485                : node->frequency == NODE_FREQUENCY_EXECUTED_ONCE
4486                ? " (executed once)"
4487                : "");
4488     }
4489   else
4490     fprintf (dump_file, ")\n\n");
4491 }
4492 
4493 /* Dump double_int D to pretty_printer PP.  UNS is true
4494    if D is unsigned and false otherwise.  */
4495 void
pp_double_int(pretty_printer * pp,double_int d,bool uns)4496 pp_double_int (pretty_printer *pp, double_int d, bool uns)
4497 {
4498   if (d.fits_shwi ())
4499     pp_wide_integer (pp, d.low);
4500   else if (d.fits_uhwi ())
4501     pp_unsigned_wide_integer (pp, d.low);
4502   else
4503     {
4504       unsigned HOST_WIDE_INT low = d.low;
4505       HOST_WIDE_INT high = d.high;
4506       if (!uns && d.is_negative ())
4507 	{
4508 	  pp_minus (pp);
4509 	  high = ~high + !low;
4510 	  low = -low;
4511 	}
4512       /* Would "%x%0*x" or "%x%*0x" get zero-padding on all
4513 	 systems?  */
4514       sprintf (pp_buffer (pp)->digit_buffer,
4515 	       HOST_WIDE_INT_PRINT_DOUBLE_HEX,
4516 	       (unsigned HOST_WIDE_INT) high, low);
4517       pp_string (pp, pp_buffer (pp)->digit_buffer);
4518     }
4519 }
4520 
4521 #if __GNUC__ >= 10
4522 #  pragma GCC diagnostic pop
4523 #endif
4524