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