[PR c++/86374] Name lookup failure in enclosing template
[official-gcc.git] / gcc / tree-pretty-print.c
blobe65c40a41a333a7424fd1cead72234158a0f02dc
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>
5 This file is part of GCC.
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.
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.
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/>. */
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"
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);
46 #define INDENT(SPACE) do { \
47 int i; for (i = 0; i<SPACE; i++) pp_space (pp); } while (0)
49 #define NIY do_niy (pp, node, flags)
51 static pretty_printer *tree_pp;
53 /* Try to print something for an unknown tree code. */
55 static void
56 do_niy (pretty_printer *pp, const_tree node, dump_flags_t flags)
58 int i, len;
60 pp_string (pp, "<<< Unknown tree: ");
61 pp_string (pp, get_tree_code_name (TREE_CODE (node)));
63 if (EXPR_P (node))
65 len = TREE_OPERAND_LENGTH (node);
66 for (i = 0; i < len; ++i)
68 newline_and_indent (pp, 2);
69 dump_generic_node (pp, TREE_OPERAND (node, i), 2, flags, false);
73 pp_string (pp, " >>>");
76 /* Debugging function to print out a generic expression. */
78 DEBUG_FUNCTION void
79 debug_generic_expr (tree t)
81 print_generic_expr (stderr, t, TDF_VOPS|TDF_MEMSYMS);
82 fprintf (stderr, "\n");
85 /* Debugging function to print out a generic statement. */
87 DEBUG_FUNCTION void
88 debug_generic_stmt (tree t)
90 print_generic_stmt (stderr, t, TDF_VOPS|TDF_MEMSYMS);
91 fprintf (stderr, "\n");
94 /* Debugging function to print out a chain of trees . */
96 DEBUG_FUNCTION void
97 debug_tree_chain (tree t)
99 hash_set<tree> seen;
101 while (t)
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))
108 fprintf (stderr, "... [cycled back to ");
109 print_generic_expr (stderr, t, TDF_VOPS|TDF_MEMSYMS|TDF_UID);
110 fprintf (stderr, "]");
111 break;
114 fprintf (stderr, "\n");
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)
121 maybe_init_pretty_print (file);
122 print_declaration (tree_pp, decl, 2, flags);
123 pp_write_text_to_stream (tree_pp);
126 /* Print tree T, and its successors, on file FILE. FLAGS specifies details
127 to show in the dump. See TDF_* in dumpfile.h. */
129 void
130 print_generic_stmt (FILE *file, tree t, dump_flags_t flags)
132 maybe_init_pretty_print (file);
133 dump_generic_node (tree_pp, t, 0, flags, true);
134 pp_newline_and_flush (tree_pp);
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. */
141 void
142 print_generic_stmt_indented (FILE *file, tree t, dump_flags_t flags, int indent)
144 int i;
146 maybe_init_pretty_print (file);
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);
154 /* Print a single expression T on file FILE. FLAGS specifies details to show
155 in the dump. See TDF_* in dumpfile.h. */
157 void
158 print_generic_expr (FILE *file, tree t, dump_flags_t flags)
160 maybe_init_pretty_print (file);
161 dump_generic_node (tree_pp, t, 0, flags, false);
162 pp_flush (tree_pp);
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. */
170 static void
171 dump_fancy_name (pretty_printer *pp, tree name)
173 int cnt = 0;
174 int length = IDENTIFIER_LENGTH (name);
175 const char *n = IDENTIFIER_POINTER (name);
178 n = strchr (n, 'D');
179 if (n == NULL)
180 break;
181 if (ISDIGIT (n[1])
182 && (n == IDENTIFIER_POINTER (name) || n[-1] == '$'))
184 int l = 2;
185 while (ISDIGIT (n[l]))
186 l++;
187 if (n[l] == '\0' || n[l] == '$')
189 cnt++;
190 length += 5 - l;
192 n += l;
194 else
195 n++;
197 while (1);
198 if (cnt == 0)
200 pp_tree_identifier (pp, name);
201 return;
204 char *str = XNEWVEC (char, length + 1);
205 char *p = str;
206 const char *q;
207 q = n = IDENTIFIER_POINTER (name);
210 q = strchr (q, 'D');
211 if (q == NULL)
212 break;
213 if (ISDIGIT (q[1])
214 && (q == IDENTIFIER_POINTER (name) || q[-1] == '$'))
216 int l = 2;
217 while (ISDIGIT (q[l]))
218 l++;
219 if (q[l] == '\0' || q[l] == '$')
221 memcpy (p, n, q - n);
222 memcpy (p + (q - n), "Dxxxx", 5);
223 p += (q - n) + 5;
224 n = q + l;
226 q += l;
228 else
229 q++;
231 while (1);
232 memcpy (p, n, IDENTIFIER_LENGTH (name) - (n - IDENTIFIER_POINTER (name)));
233 str[length] = '\0';
234 if (pp_translate_identifiers (pp))
236 const char *text = identifier_to_locale (str);
237 pp_append_text (pp, text, text + strlen (text));
239 else
240 pp_append_text (pp, str, str + length);
241 XDELETEVEC (str);
244 /* Dump the name of a _DECL node and its DECL_UID if TDF_UID is set
245 in FLAGS. */
247 static void
248 dump_decl_name (pretty_printer *pp, tree node, dump_flags_t flags)
250 tree name = DECL_NAME (node);
251 if (name)
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);
274 char uid_sep = (flags & TDF_GIMPLE) ? '_' : '.';
275 if ((flags & TDF_UID) || name == NULL_TREE)
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)
281 if (flags & TDF_NOUID)
282 pp_string (pp, "D#xxxx");
283 else
284 pp_printf (pp, "D#%i", DEBUG_TEMP_UID (node));
286 else
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));
295 if ((flags & TDF_ALIAS) && DECL_PT_UID (node) != DECL_UID (node))
297 if (flags & TDF_NOUID)
298 pp_printf (pp, "ptD.xxxx");
299 else
300 pp_printf (pp, "ptD.%u", DECL_PT_UID (node));
304 /* Like the above, but used for pretty printing function calls. */
306 static void
307 dump_function_name (pretty_printer *pp, tree node, dump_flags_t flags)
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);
317 /* Dump a function declaration. NODE is the FUNCTION_TYPE. PP, SPC and
318 FLAGS are as in dump_generic_node. */
320 static void
321 dump_function_declaration (pretty_printer *pp, tree node,
322 int spc, dump_flags_t flags)
324 bool wrote_arg = false;
325 tree arg;
327 pp_space (pp);
328 pp_left_paren (pp);
330 /* Print the argument types. */
331 arg = TYPE_ARG_TYPES (node);
332 while (arg && arg != void_list_node && arg != error_mark_node)
334 if (wrote_arg)
336 pp_comma (pp);
337 pp_space (pp);
339 wrote_arg = true;
340 dump_generic_node (pp, TREE_VALUE (arg), spc, flags, false);
341 arg = TREE_CHAIN (arg);
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. */
352 pp_right_paren (pp);
355 /* Dump the domain associated with an array. */
357 static void
358 dump_array_domain (pretty_printer *pp, tree domain, int spc, dump_flags_t flags)
360 pp_left_bracket (pp);
361 if (domain)
363 tree min = TYPE_MIN_VALUE (domain);
364 tree max = TYPE_MAX_VALUE (domain);
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
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);
379 else
380 pp_string (pp, "<unknown>");
381 pp_right_bracket (pp);
385 /* Dump OpenMP clause CLAUSE. PP, CLAUSE, SPC and FLAGS are as in
386 dump_generic_node. */
388 static void
389 dump_omp_clause (pretty_printer *pp, tree clause, int spc, dump_flags_t flags)
391 const char *name;
393 switch (OMP_CLAUSE_CODE (clause))
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;
439 case OMP_CLAUSE_REDUCTION:
440 pp_string (pp, "reduction(");
441 if (OMP_CLAUSE_REDUCTION_CODE (clause) != ERROR_MARK)
443 pp_string (pp,
444 op_symbol_code (OMP_CLAUSE_REDUCTION_CODE (clause)));
445 pp_colon (pp);
447 dump_generic_node (pp, OMP_CLAUSE_DECL (clause),
448 spc, flags, false);
449 pp_right_paren (pp);
450 break;
452 case OMP_CLAUSE_IF:
453 pp_string (pp, "if(");
454 switch (OMP_CLAUSE_IF_MODIFIER (clause))
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 ();
468 dump_generic_node (pp, OMP_CLAUSE_IF_EXPR (clause),
469 spc, flags, false);
470 pp_right_paren (pp);
471 break;
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;
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))
487 pp_left_paren (pp);
488 dump_generic_node (pp, OMP_CLAUSE_ORDERED_EXPR (clause),
489 spc, flags, false);
490 pp_right_paren (pp);
492 break;
494 case OMP_CLAUSE_DEFAULT:
495 pp_string (pp, "default(");
496 switch (OMP_CLAUSE_DEFAULT_KIND (clause))
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 ();
518 pp_right_paren (pp);
519 break;
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))
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);
537 if (OMP_CLAUSE_SCHEDULE_SIMD (clause))
538 pp_string (pp, "simd:");
540 switch (OMP_CLAUSE_SCHEDULE_KIND (clause) & OMP_CLAUSE_SCHEDULE_MASK)
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 ();
560 if (OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (clause))
562 pp_comma (pp);
563 dump_generic_node (pp, OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (clause),
564 spc, flags, false);
566 pp_right_paren (pp);
567 break;
569 case OMP_CLAUSE_UNTIED:
570 pp_string (pp, "untied");
571 break;
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;
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;
587 case OMP_CLAUSE_MERGEABLE:
588 pp_string (pp, "mergeable");
589 break;
591 case OMP_CLAUSE_LINEAR:
592 pp_string (pp, "linear(");
593 switch (OMP_CLAUSE_LINEAR_KIND (clause))
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 ();
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;
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))
625 pp_colon (pp);
626 dump_generic_node (pp, OMP_CLAUSE_ALIGNED_ALIGNMENT (clause),
627 spc, flags, false);
629 pp_right_paren (pp);
630 break;
632 case OMP_CLAUSE_DEPEND:
633 pp_string (pp, "depend(");
634 switch (OMP_CLAUSE_DEPEND_KIND (clause))
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)
653 dump_generic_node (pp, TREE_VALUE (t), spc, flags, false);
654 if (TREE_PURPOSE (t) != integer_zero_node)
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);
663 if (TREE_CHAIN (t))
664 pp_comma (pp);
666 else
667 gcc_unreachable ();
668 pp_right_paren (pp);
669 return;
670 default:
671 gcc_unreachable ();
673 pp_colon (pp);
674 dump_generic_node (pp, OMP_CLAUSE_DECL (clause),
675 spc, flags, false);
676 pp_right_paren (pp);
677 break;
679 case OMP_CLAUSE_MAP:
680 pp_string (pp, "map(");
681 switch (OMP_CLAUSE_MAP_KIND (clause))
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 ();
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))
757 switch (OMP_CLAUSE_CODE (clause) == OMP_CLAUSE_MAP
758 ? OMP_CLAUSE_MAP_KIND (clause) : GOMP_MAP_TO)
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;
773 dump_generic_node (pp, OMP_CLAUSE_SIZE (clause),
774 spc, flags, false);
775 pp_right_bracket (pp);
777 pp_right_paren (pp);
778 break;
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;
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;
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;
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;
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;
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;
819 case OMP_CLAUSE_DIST_SCHEDULE:
820 pp_string (pp, "dist_schedule(static");
821 if (OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR (clause))
823 pp_comma (pp);
824 dump_generic_node (pp,
825 OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR (clause),
826 spc, flags, false);
828 pp_right_paren (pp);
829 break;
831 case OMP_CLAUSE_PROC_BIND:
832 pp_string (pp, "proc_bind(");
833 switch (OMP_CLAUSE_PROC_BIND_KIND (clause))
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 ();
847 pp_right_paren (pp);
848 break;
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;
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;
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;
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;
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;
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;
892 case OMP_CLAUSE_DEFAULTMAP:
893 pp_string (pp, "defaultmap(tofrom:scalar)");
894 break;
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;
903 case OMP_CLAUSE__SIMT_:
904 pp_string (pp, "_simt_");
905 break;
907 case OMP_CLAUSE_GANG:
908 pp_string (pp, "gang");
909 if (OMP_CLAUSE_GANG_EXPR (clause) != NULL_TREE)
911 pp_string (pp, "(num: ");
912 dump_generic_node (pp, OMP_CLAUSE_GANG_EXPR (clause),
913 spc, flags, false);
915 if (OMP_CLAUSE_GANG_STATIC_EXPR (clause) != NULL_TREE)
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);
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;
934 case OMP_CLAUSE_ASYNC:
935 pp_string (pp, "async");
936 if (OMP_CLAUSE_ASYNC_EXPR (clause))
938 pp_character(pp, '(');
939 dump_generic_node (pp, OMP_CLAUSE_ASYNC_EXPR (clause),
940 spc, flags, false);
941 pp_character(pp, ')');
943 break;
945 case OMP_CLAUSE_AUTO:
946 case OMP_CLAUSE_SEQ:
947 pp_string (pp, omp_clause_code_name[OMP_CLAUSE_CODE (clause)]);
948 break;
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;
957 case OMP_CLAUSE_WORKER:
958 pp_string (pp, "worker");
959 if (OMP_CLAUSE_WORKER_EXPR (clause) != NULL_TREE)
961 pp_left_paren (pp);
962 dump_generic_node (pp, OMP_CLAUSE_WORKER_EXPR (clause),
963 spc, flags, false);
964 pp_right_paren (pp);
966 break;
968 case OMP_CLAUSE_VECTOR:
969 pp_string (pp, "vector");
970 if (OMP_CLAUSE_VECTOR_EXPR (clause) != NULL_TREE)
972 pp_left_paren (pp);
973 dump_generic_node (pp, OMP_CLAUSE_VECTOR_EXPR (clause),
974 spc, flags, false);
975 pp_right_paren (pp);
977 break;
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;
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;
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;
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;
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 case OMP_CLAUSE_IF_PRESENT:
1049 pp_string (pp, "if_present");
1050 break;
1051 case OMP_CLAUSE_FINALIZE:
1052 pp_string (pp, "finalize");
1053 break;
1055 default:
1056 /* Should never happen. */
1057 dump_generic_node (pp, clause, spc, flags, false);
1058 break;
1063 /* Dump the list of OpenMP clauses. PP, SPC and FLAGS are as in
1064 dump_generic_node. */
1066 void
1067 dump_omp_clauses (pretty_printer *pp, tree clause, int spc, dump_flags_t flags)
1069 if (clause == NULL)
1070 return;
1072 pp_space (pp);
1073 while (1)
1075 dump_omp_clause (pp, clause, spc, flags);
1076 clause = OMP_CLAUSE_CHAIN (clause);
1077 if (clause == NULL)
1078 return;
1079 pp_space (pp);
1084 /* Dump location LOC to PP. */
1086 void
1087 dump_location (pretty_printer *pp, location_t loc)
1089 expanded_location xloc = expand_location (loc);
1091 pp_left_bracket (pp);
1092 if (xloc.file)
1094 pp_string (pp, xloc.file);
1095 pp_string (pp, ":");
1097 pp_decimal_int (pp, xloc.line);
1098 pp_colon (pp);
1099 pp_decimal_int (pp, xloc.column);
1100 pp_string (pp, "] ");
1104 /* Dump lexical block BLOCK. PP, SPC and FLAGS are as in
1105 dump_generic_node. */
1107 static void
1108 dump_block_node (pretty_printer *pp, tree block, int spc, dump_flags_t flags)
1110 tree t;
1112 pp_printf (pp, "BLOCK #%d ", BLOCK_NUMBER (block));
1114 if (flags & TDF_ADDRESS)
1115 pp_printf (pp, "[%p] ", (void *) block);
1117 if (BLOCK_ABSTRACT (block))
1118 pp_string (pp, "[abstract] ");
1120 if (TREE_ASM_WRITTEN (block))
1121 pp_string (pp, "[written] ");
1123 if (flags & TDF_SLIM)
1124 return;
1126 if (BLOCK_SOURCE_LOCATION (block))
1127 dump_location (pp, BLOCK_SOURCE_LOCATION (block));
1129 newline_and_indent (pp, spc + 2);
1131 if (BLOCK_SUPERCONTEXT (block))
1133 pp_string (pp, "SUPERCONTEXT: ");
1134 dump_generic_node (pp, BLOCK_SUPERCONTEXT (block), 0,
1135 flags | TDF_SLIM, false);
1136 newline_and_indent (pp, spc + 2);
1139 if (BLOCK_SUBBLOCKS (block))
1141 pp_string (pp, "SUBBLOCKS: ");
1142 for (t = BLOCK_SUBBLOCKS (block); t; t = BLOCK_CHAIN (t))
1144 dump_generic_node (pp, t, 0, flags | TDF_SLIM, false);
1145 pp_space (pp);
1147 newline_and_indent (pp, spc + 2);
1150 if (BLOCK_CHAIN (block))
1152 pp_string (pp, "SIBLINGS: ");
1153 for (t = BLOCK_CHAIN (block); t; t = BLOCK_CHAIN (t))
1155 dump_generic_node (pp, t, 0, flags | TDF_SLIM, false);
1156 pp_space (pp);
1158 newline_and_indent (pp, spc + 2);
1161 if (BLOCK_VARS (block))
1163 pp_string (pp, "VARS: ");
1164 for (t = BLOCK_VARS (block); t; t = TREE_CHAIN (t))
1166 dump_generic_node (pp, t, 0, flags, false);
1167 pp_space (pp);
1169 newline_and_indent (pp, spc + 2);
1172 if (vec_safe_length (BLOCK_NONLOCALIZED_VARS (block)) > 0)
1174 unsigned i;
1175 vec<tree, va_gc> *nlv = BLOCK_NONLOCALIZED_VARS (block);
1177 pp_string (pp, "NONLOCALIZED_VARS: ");
1178 FOR_EACH_VEC_ELT (*nlv, i, t)
1180 dump_generic_node (pp, t, 0, flags, false);
1181 pp_space (pp);
1183 newline_and_indent (pp, spc + 2);
1186 if (BLOCK_ABSTRACT_ORIGIN (block))
1188 pp_string (pp, "ABSTRACT_ORIGIN: ");
1189 dump_generic_node (pp, BLOCK_ABSTRACT_ORIGIN (block), 0,
1190 flags | TDF_SLIM, false);
1191 newline_and_indent (pp, spc + 2);
1194 if (BLOCK_FRAGMENT_ORIGIN (block))
1196 pp_string (pp, "FRAGMENT_ORIGIN: ");
1197 dump_generic_node (pp, BLOCK_FRAGMENT_ORIGIN (block), 0,
1198 flags | TDF_SLIM, false);
1199 newline_and_indent (pp, spc + 2);
1202 if (BLOCK_FRAGMENT_CHAIN (block))
1204 pp_string (pp, "FRAGMENT_CHAIN: ");
1205 for (t = BLOCK_FRAGMENT_CHAIN (block); t; t = BLOCK_FRAGMENT_CHAIN (t))
1207 dump_generic_node (pp, t, 0, flags | TDF_SLIM, false);
1208 pp_space (pp);
1210 newline_and_indent (pp, spc + 2);
1215 /* Dump the node NODE on the pretty_printer PP, SPC spaces of
1216 indent. FLAGS specifies details to show in the dump (see TDF_* in
1217 dumpfile.h). If IS_STMT is true, the object printed is considered
1218 to be a statement and it is terminated by ';' if appropriate. */
1221 dump_generic_node (pretty_printer *pp, tree node, int spc, dump_flags_t flags,
1222 bool is_stmt)
1224 tree type;
1225 tree op0, op1;
1226 const char *str;
1227 bool is_expr;
1228 enum tree_code code;
1230 if (node == NULL_TREE)
1231 return spc;
1233 is_expr = EXPR_P (node);
1235 if (is_stmt && (flags & TDF_STMTADDR))
1236 pp_printf (pp, "<&%p> ", (void *)node);
1238 if ((flags & TDF_LINENO) && EXPR_HAS_LOCATION (node))
1239 dump_location (pp, EXPR_LOCATION (node));
1241 code = TREE_CODE (node);
1242 switch (code)
1244 case ERROR_MARK:
1245 pp_string (pp, "<<< error >>>");
1246 break;
1248 case IDENTIFIER_NODE:
1249 pp_tree_identifier (pp, node);
1250 break;
1252 case TREE_LIST:
1253 while (node && node != error_mark_node)
1255 if (TREE_PURPOSE (node))
1257 dump_generic_node (pp, TREE_PURPOSE (node), spc, flags, false);
1258 pp_space (pp);
1260 dump_generic_node (pp, TREE_VALUE (node), spc, flags, false);
1261 node = TREE_CHAIN (node);
1262 if (node && TREE_CODE (node) == TREE_LIST)
1264 pp_comma (pp);
1265 pp_space (pp);
1268 break;
1270 case TREE_BINFO:
1271 dump_generic_node (pp, BINFO_TYPE (node), spc, flags, false);
1272 break;
1274 case TREE_VEC:
1276 size_t i;
1277 if (TREE_VEC_LENGTH (node) > 0)
1279 size_t len = TREE_VEC_LENGTH (node);
1280 for (i = 0; i < len - 1; i++)
1282 dump_generic_node (pp, TREE_VEC_ELT (node, i), spc, flags,
1283 false);
1284 pp_comma (pp);
1285 pp_space (pp);
1287 dump_generic_node (pp, TREE_VEC_ELT (node, len - 1), spc,
1288 flags, false);
1291 break;
1293 case VOID_TYPE:
1294 case INTEGER_TYPE:
1295 case REAL_TYPE:
1296 case FIXED_POINT_TYPE:
1297 case COMPLEX_TYPE:
1298 case VECTOR_TYPE:
1299 case ENUMERAL_TYPE:
1300 case BOOLEAN_TYPE:
1302 unsigned int quals = TYPE_QUALS (node);
1303 enum tree_code_class tclass;
1305 if (quals & TYPE_QUAL_ATOMIC)
1306 pp_string (pp, "atomic ");
1307 if (quals & TYPE_QUAL_CONST)
1308 pp_string (pp, "const ");
1309 else if (quals & TYPE_QUAL_VOLATILE)
1310 pp_string (pp, "volatile ");
1311 else if (quals & TYPE_QUAL_RESTRICT)
1312 pp_string (pp, "restrict ");
1314 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node)))
1316 pp_string (pp, "<address-space-");
1317 pp_decimal_int (pp, TYPE_ADDR_SPACE (node));
1318 pp_string (pp, "> ");
1321 tclass = TREE_CODE_CLASS (TREE_CODE (node));
1323 if (tclass == tcc_declaration)
1325 if (DECL_NAME (node))
1326 dump_decl_name (pp, node, flags);
1327 else
1328 pp_string (pp, "<unnamed type decl>");
1330 else if (tclass == tcc_type)
1332 if (TYPE_NAME (node))
1334 if (TREE_CODE (TYPE_NAME (node)) == IDENTIFIER_NODE)
1335 pp_tree_identifier (pp, TYPE_NAME (node));
1336 else if (TREE_CODE (TYPE_NAME (node)) == TYPE_DECL
1337 && DECL_NAME (TYPE_NAME (node)))
1338 dump_decl_name (pp, TYPE_NAME (node), flags);
1339 else
1340 pp_string (pp, "<unnamed type>");
1342 else if (TREE_CODE (node) == VECTOR_TYPE)
1344 pp_string (pp, "vector");
1345 pp_left_paren (pp);
1346 pp_wide_integer (pp, TYPE_VECTOR_SUBPARTS (node));
1347 pp_string (pp, ") ");
1348 dump_generic_node (pp, TREE_TYPE (node), spc, flags, false);
1350 else if (TREE_CODE (node) == INTEGER_TYPE)
1352 if (TYPE_PRECISION (node) == CHAR_TYPE_SIZE)
1353 pp_string (pp, (TYPE_UNSIGNED (node)
1354 ? "unsigned char"
1355 : "signed char"));
1356 else if (TYPE_PRECISION (node) == SHORT_TYPE_SIZE)
1357 pp_string (pp, (TYPE_UNSIGNED (node)
1358 ? "unsigned short"
1359 : "signed short"));
1360 else if (TYPE_PRECISION (node) == INT_TYPE_SIZE)
1361 pp_string (pp, (TYPE_UNSIGNED (node)
1362 ? "unsigned int"
1363 : "signed int"));
1364 else if (TYPE_PRECISION (node) == LONG_TYPE_SIZE)
1365 pp_string (pp, (TYPE_UNSIGNED (node)
1366 ? "unsigned long"
1367 : "signed long"));
1368 else if (TYPE_PRECISION (node) == LONG_LONG_TYPE_SIZE)
1369 pp_string (pp, (TYPE_UNSIGNED (node)
1370 ? "unsigned long long"
1371 : "signed long long"));
1372 else if (TYPE_PRECISION (node) >= CHAR_TYPE_SIZE
1373 && pow2p_hwi (TYPE_PRECISION (node)))
1375 pp_string (pp, (TYPE_UNSIGNED (node) ? "uint" : "int"));
1376 pp_decimal_int (pp, TYPE_PRECISION (node));
1377 pp_string (pp, "_t");
1379 else
1381 pp_string (pp, (TYPE_UNSIGNED (node)
1382 ? "<unnamed-unsigned:"
1383 : "<unnamed-signed:"));
1384 pp_decimal_int (pp, TYPE_PRECISION (node));
1385 pp_greater (pp);
1388 else if (TREE_CODE (node) == COMPLEX_TYPE)
1390 pp_string (pp, "__complex__ ");
1391 dump_generic_node (pp, TREE_TYPE (node), spc, flags, false);
1393 else if (TREE_CODE (node) == REAL_TYPE)
1395 pp_string (pp, "<float:");
1396 pp_decimal_int (pp, TYPE_PRECISION (node));
1397 pp_greater (pp);
1399 else if (TREE_CODE (node) == FIXED_POINT_TYPE)
1401 pp_string (pp, "<fixed-point-");
1402 pp_string (pp, TYPE_SATURATING (node) ? "sat:" : "nonsat:");
1403 pp_decimal_int (pp, TYPE_PRECISION (node));
1404 pp_greater (pp);
1406 else if (TREE_CODE (node) == VOID_TYPE)
1407 pp_string (pp, "void");
1408 else
1409 pp_string (pp, "<unnamed type>");
1411 break;
1414 case POINTER_TYPE:
1415 case REFERENCE_TYPE:
1416 str = (TREE_CODE (node) == POINTER_TYPE ? "*" : "&");
1418 if (TREE_TYPE (node) == NULL)
1420 pp_string (pp, str);
1421 pp_string (pp, "<null type>");
1423 else if (TREE_CODE (TREE_TYPE (node)) == FUNCTION_TYPE)
1425 tree fnode = TREE_TYPE (node);
1427 dump_generic_node (pp, TREE_TYPE (fnode), spc, flags, false);
1428 pp_space (pp);
1429 pp_left_paren (pp);
1430 pp_string (pp, str);
1431 if (TYPE_IDENTIFIER (node))
1432 dump_generic_node (pp, TYPE_NAME (node), spc, flags, false);
1433 else if (flags & TDF_NOUID)
1434 pp_printf (pp, "<Txxxx>");
1435 else
1436 pp_printf (pp, "<T%x>", TYPE_UID (node));
1438 pp_right_paren (pp);
1439 dump_function_declaration (pp, fnode, spc, flags);
1441 else
1443 unsigned int quals = TYPE_QUALS (node);
1445 dump_generic_node (pp, TREE_TYPE (node), spc, flags, false);
1446 pp_space (pp);
1447 pp_string (pp, str);
1449 if (quals & TYPE_QUAL_CONST)
1450 pp_string (pp, " const");
1451 if (quals & TYPE_QUAL_VOLATILE)
1452 pp_string (pp, " volatile");
1453 if (quals & TYPE_QUAL_RESTRICT)
1454 pp_string (pp, " restrict");
1456 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node)))
1458 pp_string (pp, " <address-space-");
1459 pp_decimal_int (pp, TYPE_ADDR_SPACE (node));
1460 pp_greater (pp);
1463 if (TYPE_REF_CAN_ALIAS_ALL (node))
1464 pp_string (pp, " {ref-all}");
1466 break;
1468 case OFFSET_TYPE:
1469 NIY;
1470 break;
1472 case MEM_REF:
1474 if (flags & TDF_GIMPLE)
1476 pp_string (pp, "__MEM <");
1477 dump_generic_node (pp, TREE_TYPE (node),
1478 spc, flags | TDF_SLIM, false);
1479 if (TYPE_ALIGN (TREE_TYPE (node))
1480 != TYPE_ALIGN (TYPE_MAIN_VARIANT (TREE_TYPE (node))))
1482 pp_string (pp, ", ");
1483 pp_decimal_int (pp, TYPE_ALIGN (TREE_TYPE (node)));
1485 pp_greater (pp);
1486 pp_string (pp, " (");
1487 if (TREE_TYPE (TREE_OPERAND (node, 0))
1488 != TREE_TYPE (TREE_OPERAND (node, 1)))
1490 pp_left_paren (pp);
1491 dump_generic_node (pp, TREE_TYPE (TREE_OPERAND (node, 1)),
1492 spc, flags | TDF_SLIM, false);
1493 pp_right_paren (pp);
1495 dump_generic_node (pp, TREE_OPERAND (node, 0),
1496 spc, flags | TDF_SLIM, false);
1497 if (! integer_zerop (TREE_OPERAND (node, 1)))
1499 pp_string (pp, " + ");
1500 dump_generic_node (pp, TREE_OPERAND (node, 1),
1501 spc, flags | TDF_SLIM, false);
1503 pp_right_paren (pp);
1505 else if (integer_zerop (TREE_OPERAND (node, 1))
1506 /* Dump the types of INTEGER_CSTs explicitly, for we can't
1507 infer them and MEM_ATTR caching will share MEM_REFs
1508 with differently-typed op0s. */
1509 && TREE_CODE (TREE_OPERAND (node, 0)) != INTEGER_CST
1510 /* Released SSA_NAMES have no TREE_TYPE. */
1511 && TREE_TYPE (TREE_OPERAND (node, 0)) != NULL_TREE
1512 /* Same pointer types, but ignoring POINTER_TYPE vs.
1513 REFERENCE_TYPE. */
1514 && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node, 0)))
1515 == TREE_TYPE (TREE_TYPE (TREE_OPERAND (node, 1))))
1516 && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (node, 0)))
1517 == TYPE_MODE (TREE_TYPE (TREE_OPERAND (node, 1))))
1518 && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node, 0)))
1519 == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node, 1))))
1520 /* Same value types ignoring qualifiers. */
1521 && (TYPE_MAIN_VARIANT (TREE_TYPE (node))
1522 == TYPE_MAIN_VARIANT
1523 (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node, 1)))))
1524 && (!(flags & TDF_ALIAS)
1525 || MR_DEPENDENCE_CLIQUE (node) == 0))
1527 if (TREE_CODE (TREE_OPERAND (node, 0)) != ADDR_EXPR)
1529 pp_star (pp);
1530 dump_generic_node (pp, TREE_OPERAND (node, 0),
1531 spc, flags, false);
1533 else
1534 dump_generic_node (pp,
1535 TREE_OPERAND (TREE_OPERAND (node, 0), 0),
1536 spc, flags, false);
1538 else
1540 tree ptype;
1542 pp_string (pp, "MEM[");
1543 pp_left_paren (pp);
1544 ptype = TYPE_MAIN_VARIANT (TREE_TYPE (TREE_OPERAND (node, 1)));
1545 dump_generic_node (pp, ptype,
1546 spc, flags | TDF_SLIM, false);
1547 pp_right_paren (pp);
1548 dump_generic_node (pp, TREE_OPERAND (node, 0),
1549 spc, flags, false);
1550 if (!integer_zerop (TREE_OPERAND (node, 1)))
1552 pp_string (pp, " + ");
1553 dump_generic_node (pp, TREE_OPERAND (node, 1),
1554 spc, flags, false);
1556 if ((flags & TDF_ALIAS)
1557 && MR_DEPENDENCE_CLIQUE (node) != 0)
1559 pp_string (pp, " clique ");
1560 pp_unsigned_wide_integer (pp, MR_DEPENDENCE_CLIQUE (node));
1561 pp_string (pp, " base ");
1562 pp_unsigned_wide_integer (pp, MR_DEPENDENCE_BASE (node));
1564 pp_right_bracket (pp);
1566 break;
1569 case TARGET_MEM_REF:
1571 const char *sep = "";
1572 tree tmp;
1574 pp_string (pp, "MEM[");
1576 if (TREE_CODE (TMR_BASE (node)) == ADDR_EXPR)
1578 pp_string (pp, sep);
1579 sep = ", ";
1580 pp_string (pp, "symbol: ");
1581 dump_generic_node (pp, TREE_OPERAND (TMR_BASE (node), 0),
1582 spc, flags, false);
1584 else
1586 pp_string (pp, sep);
1587 sep = ", ";
1588 pp_string (pp, "base: ");
1589 dump_generic_node (pp, TMR_BASE (node), spc, flags, false);
1591 tmp = TMR_INDEX2 (node);
1592 if (tmp)
1594 pp_string (pp, sep);
1595 sep = ", ";
1596 pp_string (pp, "base: ");
1597 dump_generic_node (pp, tmp, spc, flags, false);
1599 tmp = TMR_INDEX (node);
1600 if (tmp)
1602 pp_string (pp, sep);
1603 sep = ", ";
1604 pp_string (pp, "index: ");
1605 dump_generic_node (pp, tmp, spc, flags, false);
1607 tmp = TMR_STEP (node);
1608 if (tmp)
1610 pp_string (pp, sep);
1611 sep = ", ";
1612 pp_string (pp, "step: ");
1613 dump_generic_node (pp, tmp, spc, flags, false);
1615 tmp = TMR_OFFSET (node);
1616 if (tmp)
1618 pp_string (pp, sep);
1619 sep = ", ";
1620 pp_string (pp, "offset: ");
1621 dump_generic_node (pp, tmp, spc, flags, false);
1623 pp_right_bracket (pp);
1625 break;
1627 case ARRAY_TYPE:
1629 tree tmp;
1631 /* Print the innermost component type. */
1632 for (tmp = TREE_TYPE (node); TREE_CODE (tmp) == ARRAY_TYPE;
1633 tmp = TREE_TYPE (tmp))
1635 dump_generic_node (pp, tmp, spc, flags, false);
1637 /* Print the dimensions. */
1638 for (tmp = node; TREE_CODE (tmp) == ARRAY_TYPE; tmp = TREE_TYPE (tmp))
1639 dump_array_domain (pp, TYPE_DOMAIN (tmp), spc, flags);
1640 break;
1643 case RECORD_TYPE:
1644 case UNION_TYPE:
1645 case QUAL_UNION_TYPE:
1647 unsigned int quals = TYPE_QUALS (node);
1649 if (quals & TYPE_QUAL_ATOMIC)
1650 pp_string (pp, "atomic ");
1651 if (quals & TYPE_QUAL_CONST)
1652 pp_string (pp, "const ");
1653 if (quals & TYPE_QUAL_VOLATILE)
1654 pp_string (pp, "volatile ");
1656 /* Print the name of the structure. */
1657 if (TREE_CODE (node) == RECORD_TYPE)
1658 pp_string (pp, "struct ");
1659 else if (TREE_CODE (node) == UNION_TYPE)
1660 pp_string (pp, "union ");
1662 if (TYPE_NAME (node))
1663 dump_generic_node (pp, TYPE_NAME (node), spc, flags, false);
1664 else if (!(flags & TDF_SLIM))
1665 /* FIXME: If we eliminate the 'else' above and attempt
1666 to show the fields for named types, we may get stuck
1667 following a cycle of pointers to structs. The alleged
1668 self-reference check in print_struct_decl will not detect
1669 cycles involving more than one pointer or struct type. */
1670 print_struct_decl (pp, node, spc, flags);
1671 break;
1674 case LANG_TYPE:
1675 NIY;
1676 break;
1678 case INTEGER_CST:
1679 if (flags & TDF_GIMPLE
1680 && (POINTER_TYPE_P (TREE_TYPE (node))
1681 || (TYPE_PRECISION (TREE_TYPE (node))
1682 < TYPE_PRECISION (integer_type_node))
1683 || exact_log2 (TYPE_PRECISION (TREE_TYPE (node))) == -1))
1685 pp_string (pp, "_Literal (");
1686 dump_generic_node (pp, TREE_TYPE (node), spc, flags, false);
1687 pp_string (pp, ") ");
1689 if (TREE_CODE (TREE_TYPE (node)) == POINTER_TYPE
1690 && ! (flags & TDF_GIMPLE))
1692 /* In the case of a pointer, one may want to divide by the
1693 size of the pointed-to type. Unfortunately, this not
1694 straightforward. The C front-end maps expressions
1696 (int *) 5
1697 int *p; (p + 5)
1699 in such a way that the two INTEGER_CST nodes for "5" have
1700 different values but identical types. In the latter
1701 case, the 5 is multiplied by sizeof (int) in c-common.c
1702 (pointer_int_sum) to convert it to a byte address, and
1703 yet the type of the node is left unchanged. Argh. What
1704 is consistent though is that the number value corresponds
1705 to bytes (UNITS) offset.
1707 NB: Neither of the following divisors can be trivially
1708 used to recover the original literal:
1710 TREE_INT_CST_LOW (TYPE_SIZE_UNIT (TREE_TYPE (node)))
1711 TYPE_PRECISION (TREE_TYPE (TREE_TYPE (node))) */
1712 pp_wide_integer (pp, TREE_INT_CST_LOW (node));
1713 pp_string (pp, "B"); /* pseudo-unit */
1715 else if (tree_fits_shwi_p (node))
1716 pp_wide_integer (pp, tree_to_shwi (node));
1717 else if (tree_fits_uhwi_p (node))
1718 pp_unsigned_wide_integer (pp, tree_to_uhwi (node));
1719 else
1721 wide_int val = wi::to_wide (node);
1723 if (wi::neg_p (val, TYPE_SIGN (TREE_TYPE (node))))
1725 pp_minus (pp);
1726 val = -val;
1728 print_hex (val, pp_buffer (pp)->digit_buffer);
1729 pp_string (pp, pp_buffer (pp)->digit_buffer);
1731 if ((flags & TDF_GIMPLE)
1732 && ! (POINTER_TYPE_P (TREE_TYPE (node))
1733 || (TYPE_PRECISION (TREE_TYPE (node))
1734 < TYPE_PRECISION (integer_type_node))
1735 || exact_log2 (TYPE_PRECISION (TREE_TYPE (node))) == -1))
1737 if (TYPE_UNSIGNED (TREE_TYPE (node)))
1738 pp_character (pp, 'u');
1739 if (TYPE_PRECISION (TREE_TYPE (node))
1740 == TYPE_PRECISION (unsigned_type_node))
1742 else if (TYPE_PRECISION (TREE_TYPE (node))
1743 == TYPE_PRECISION (long_unsigned_type_node))
1744 pp_character (pp, 'l');
1745 else if (TYPE_PRECISION (TREE_TYPE (node))
1746 == TYPE_PRECISION (long_long_unsigned_type_node))
1747 pp_string (pp, "ll");
1749 if (TREE_OVERFLOW (node))
1750 pp_string (pp, "(OVF)");
1751 break;
1753 case POLY_INT_CST:
1754 pp_string (pp, "POLY_INT_CST [");
1755 dump_generic_node (pp, POLY_INT_CST_COEFF (node, 0), spc, flags, false);
1756 for (unsigned int i = 1; i < NUM_POLY_INT_COEFFS; ++i)
1758 pp_string (pp, ", ");
1759 dump_generic_node (pp, POLY_INT_CST_COEFF (node, i),
1760 spc, flags, false);
1762 pp_string (pp, "]");
1763 break;
1765 case REAL_CST:
1766 /* Code copied from print_node. */
1768 REAL_VALUE_TYPE d;
1769 if (TREE_OVERFLOW (node))
1770 pp_string (pp, " overflow");
1772 d = TREE_REAL_CST (node);
1773 if (REAL_VALUE_ISINF (d))
1774 pp_string (pp, REAL_VALUE_NEGATIVE (d) ? " -Inf" : " Inf");
1775 else if (REAL_VALUE_ISNAN (d))
1776 pp_string (pp, " Nan");
1777 else
1779 char string[100];
1780 real_to_decimal (string, &d, sizeof (string), 0, 1);
1781 pp_string (pp, string);
1783 break;
1786 case FIXED_CST:
1788 char string[100];
1789 fixed_to_decimal (string, TREE_FIXED_CST_PTR (node), sizeof (string));
1790 pp_string (pp, string);
1791 break;
1794 case COMPLEX_CST:
1795 pp_string (pp, "__complex__ (");
1796 dump_generic_node (pp, TREE_REALPART (node), spc, flags, false);
1797 pp_string (pp, ", ");
1798 dump_generic_node (pp, TREE_IMAGPART (node), spc, flags, false);
1799 pp_right_paren (pp);
1800 break;
1802 case STRING_CST:
1803 pp_string (pp, "\"");
1804 pretty_print_string (pp, TREE_STRING_POINTER (node));
1805 pp_string (pp, "\"");
1806 break;
1808 case VECTOR_CST:
1810 unsigned i;
1811 pp_string (pp, "{ ");
1812 unsigned HOST_WIDE_INT nunits;
1813 if (!VECTOR_CST_NELTS (node).is_constant (&nunits))
1814 nunits = vector_cst_encoded_nelts (node);
1815 for (i = 0; i < nunits; ++i)
1817 if (i != 0)
1818 pp_string (pp, ", ");
1819 dump_generic_node (pp, VECTOR_CST_ELT (node, i),
1820 spc, flags, false);
1822 if (!VECTOR_CST_NELTS (node).is_constant ())
1823 pp_string (pp, ", ...");
1824 pp_string (pp, " }");
1826 break;
1828 case FUNCTION_TYPE:
1829 case METHOD_TYPE:
1830 dump_generic_node (pp, TREE_TYPE (node), spc, flags, false);
1831 pp_space (pp);
1832 if (TREE_CODE (node) == METHOD_TYPE)
1834 if (TYPE_METHOD_BASETYPE (node))
1835 dump_generic_node (pp, TYPE_NAME (TYPE_METHOD_BASETYPE (node)),
1836 spc, flags, false);
1837 else
1838 pp_string (pp, "<null method basetype>");
1839 pp_colon_colon (pp);
1841 if (TYPE_IDENTIFIER (node))
1842 dump_generic_node (pp, TYPE_NAME (node), spc, flags, false);
1843 else if (TYPE_NAME (node) && DECL_NAME (TYPE_NAME (node)))
1844 dump_decl_name (pp, TYPE_NAME (node), flags);
1845 else if (flags & TDF_NOUID)
1846 pp_printf (pp, "<Txxxx>");
1847 else
1848 pp_printf (pp, "<T%x>", TYPE_UID (node));
1849 dump_function_declaration (pp, node, spc, flags);
1850 break;
1852 case FUNCTION_DECL:
1853 case CONST_DECL:
1854 dump_decl_name (pp, node, flags);
1855 break;
1857 case LABEL_DECL:
1858 if (DECL_NAME (node))
1859 dump_decl_name (pp, node, flags);
1860 else if (LABEL_DECL_UID (node) != -1)
1862 if (flags & TDF_GIMPLE)
1863 pp_printf (pp, "L%d", (int) LABEL_DECL_UID (node));
1864 else
1865 pp_printf (pp, "<L%d>", (int) LABEL_DECL_UID (node));
1867 else
1869 if (flags & TDF_NOUID)
1870 pp_string (pp, "<D.xxxx>");
1871 else
1873 if (flags & TDF_GIMPLE)
1874 pp_printf (pp, "<D%u>", DECL_UID (node));
1875 else
1876 pp_printf (pp, "<D.%u>", DECL_UID (node));
1879 break;
1881 case TYPE_DECL:
1882 if (DECL_IS_BUILTIN (node))
1884 /* Don't print the declaration of built-in types. */
1885 break;
1887 if (DECL_NAME (node))
1888 dump_decl_name (pp, node, flags);
1889 else if (TYPE_NAME (TREE_TYPE (node)) != node)
1891 pp_string (pp, (TREE_CODE (TREE_TYPE (node)) == UNION_TYPE
1892 ? "union" : "struct "));
1893 dump_generic_node (pp, TREE_TYPE (node), spc, flags, false);
1895 else
1896 pp_string (pp, "<anon>");
1897 break;
1899 case VAR_DECL:
1900 case PARM_DECL:
1901 case FIELD_DECL:
1902 case DEBUG_EXPR_DECL:
1903 case NAMESPACE_DECL:
1904 case NAMELIST_DECL:
1905 dump_decl_name (pp, node, flags);
1906 break;
1908 case RESULT_DECL:
1909 pp_string (pp, "<retval>");
1910 break;
1912 case COMPONENT_REF:
1913 op0 = TREE_OPERAND (node, 0);
1914 str = ".";
1915 if (op0
1916 && (TREE_CODE (op0) == INDIRECT_REF
1917 || (TREE_CODE (op0) == MEM_REF
1918 && TREE_CODE (TREE_OPERAND (op0, 0)) != ADDR_EXPR
1919 && integer_zerop (TREE_OPERAND (op0, 1))
1920 /* Dump the types of INTEGER_CSTs explicitly, for we
1921 can't infer them and MEM_ATTR caching will share
1922 MEM_REFs with differently-typed op0s. */
1923 && TREE_CODE (TREE_OPERAND (op0, 0)) != INTEGER_CST
1924 /* Released SSA_NAMES have no TREE_TYPE. */
1925 && TREE_TYPE (TREE_OPERAND (op0, 0)) != NULL_TREE
1926 /* Same pointer types, but ignoring POINTER_TYPE vs.
1927 REFERENCE_TYPE. */
1928 && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0, 0)))
1929 == TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0, 1))))
1930 && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0, 0)))
1931 == TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0, 1))))
1932 && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0, 0)))
1933 == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0, 1))))
1934 /* Same value types ignoring qualifiers. */
1935 && (TYPE_MAIN_VARIANT (TREE_TYPE (op0))
1936 == TYPE_MAIN_VARIANT
1937 (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0, 1)))))
1938 && MR_DEPENDENCE_CLIQUE (op0) == 0)))
1940 op0 = TREE_OPERAND (op0, 0);
1941 str = "->";
1943 if (op_prio (op0) < op_prio (node))
1944 pp_left_paren (pp);
1945 dump_generic_node (pp, op0, spc, flags, false);
1946 if (op_prio (op0) < op_prio (node))
1947 pp_right_paren (pp);
1948 pp_string (pp, str);
1949 dump_generic_node (pp, TREE_OPERAND (node, 1), spc, flags, false);
1950 op0 = component_ref_field_offset (node);
1951 if (op0 && TREE_CODE (op0) != INTEGER_CST)
1953 pp_string (pp, "{off: ");
1954 dump_generic_node (pp, op0, spc, flags, false);
1955 pp_right_brace (pp);
1957 break;
1959 case BIT_FIELD_REF:
1960 pp_string (pp, "BIT_FIELD_REF <");
1961 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
1962 pp_string (pp, ", ");
1963 dump_generic_node (pp, TREE_OPERAND (node, 1), spc, flags, false);
1964 pp_string (pp, ", ");
1965 dump_generic_node (pp, TREE_OPERAND (node, 2), spc, flags, false);
1966 pp_greater (pp);
1967 break;
1969 case BIT_INSERT_EXPR:
1970 pp_string (pp, "BIT_INSERT_EXPR <");
1971 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
1972 pp_string (pp, ", ");
1973 dump_generic_node (pp, TREE_OPERAND (node, 1), spc, flags, false);
1974 pp_string (pp, ", ");
1975 dump_generic_node (pp, TREE_OPERAND (node, 2), spc, flags, false);
1976 pp_string (pp, " (");
1977 if (INTEGRAL_TYPE_P (TREE_TYPE (TREE_OPERAND (node, 1))))
1978 pp_decimal_int (pp,
1979 TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (node, 1))));
1980 else
1981 dump_generic_node (pp, TYPE_SIZE (TREE_TYPE (TREE_OPERAND (node, 1))),
1982 spc, flags, false);
1983 pp_string (pp, " bits)>");
1984 break;
1986 case ARRAY_REF:
1987 case ARRAY_RANGE_REF:
1988 op0 = TREE_OPERAND (node, 0);
1989 if (op_prio (op0) < op_prio (node))
1990 pp_left_paren (pp);
1991 dump_generic_node (pp, op0, spc, flags, false);
1992 if (op_prio (op0) < op_prio (node))
1993 pp_right_paren (pp);
1994 pp_left_bracket (pp);
1995 dump_generic_node (pp, TREE_OPERAND (node, 1), spc, flags, false);
1996 if (TREE_CODE (node) == ARRAY_RANGE_REF)
1997 pp_string (pp, " ...");
1998 pp_right_bracket (pp);
2000 op0 = array_ref_low_bound (node);
2001 op1 = array_ref_element_size (node);
2003 if (!integer_zerop (op0)
2004 || TREE_OPERAND (node, 2)
2005 || TREE_OPERAND (node, 3))
2007 pp_string (pp, "{lb: ");
2008 dump_generic_node (pp, op0, spc, flags, false);
2009 pp_string (pp, " sz: ");
2010 dump_generic_node (pp, op1, spc, flags, false);
2011 pp_right_brace (pp);
2013 break;
2015 case CONSTRUCTOR:
2017 unsigned HOST_WIDE_INT ix;
2018 tree field, val;
2019 bool is_struct_init = false;
2020 bool is_array_init = false;
2021 widest_int curidx;
2022 pp_left_brace (pp);
2023 if (TREE_CLOBBER_P (node))
2024 pp_string (pp, "CLOBBER");
2025 else if (TREE_CODE (TREE_TYPE (node)) == RECORD_TYPE
2026 || TREE_CODE (TREE_TYPE (node)) == UNION_TYPE)
2027 is_struct_init = true;
2028 else if (TREE_CODE (TREE_TYPE (node)) == ARRAY_TYPE
2029 && TYPE_DOMAIN (TREE_TYPE (node))
2030 && TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node)))
2031 && TREE_CODE (TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node))))
2032 == INTEGER_CST)
2034 tree minv = TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node)));
2035 is_array_init = true;
2036 curidx = wi::to_widest (minv);
2038 FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (node), ix, field, val)
2040 if (field)
2042 if (is_struct_init)
2044 pp_dot (pp);
2045 dump_generic_node (pp, field, spc, flags, false);
2046 pp_equal (pp);
2048 else if (is_array_init
2049 && (TREE_CODE (field) != INTEGER_CST
2050 || curidx != wi::to_widest (field)))
2052 pp_left_bracket (pp);
2053 if (TREE_CODE (field) == RANGE_EXPR)
2055 dump_generic_node (pp, TREE_OPERAND (field, 0), spc,
2056 flags, false);
2057 pp_string (pp, " ... ");
2058 dump_generic_node (pp, TREE_OPERAND (field, 1), spc,
2059 flags, false);
2060 if (TREE_CODE (TREE_OPERAND (field, 1)) == INTEGER_CST)
2061 curidx = wi::to_widest (TREE_OPERAND (field, 1));
2063 else
2064 dump_generic_node (pp, field, spc, flags, false);
2065 if (TREE_CODE (field) == INTEGER_CST)
2066 curidx = wi::to_widest (field);
2067 pp_string (pp, "]=");
2070 if (is_array_init)
2071 curidx += 1;
2072 if (val && TREE_CODE (val) == ADDR_EXPR)
2073 if (TREE_CODE (TREE_OPERAND (val, 0)) == FUNCTION_DECL)
2074 val = TREE_OPERAND (val, 0);
2075 if (val && TREE_CODE (val) == FUNCTION_DECL)
2076 dump_decl_name (pp, val, flags);
2077 else
2078 dump_generic_node (pp, val, spc, flags, false);
2079 if (ix != CONSTRUCTOR_NELTS (node) - 1)
2081 pp_comma (pp);
2082 pp_space (pp);
2085 pp_right_brace (pp);
2087 break;
2089 case COMPOUND_EXPR:
2091 tree *tp;
2092 if (flags & TDF_SLIM)
2094 pp_string (pp, "<COMPOUND_EXPR>");
2095 break;
2098 dump_generic_node (pp, TREE_OPERAND (node, 0),
2099 spc, flags, !(flags & TDF_SLIM));
2100 if (flags & TDF_SLIM)
2101 newline_and_indent (pp, spc);
2102 else
2104 pp_comma (pp);
2105 pp_space (pp);
2108 for (tp = &TREE_OPERAND (node, 1);
2109 TREE_CODE (*tp) == COMPOUND_EXPR;
2110 tp = &TREE_OPERAND (*tp, 1))
2112 dump_generic_node (pp, TREE_OPERAND (*tp, 0),
2113 spc, flags, !(flags & TDF_SLIM));
2114 if (flags & TDF_SLIM)
2115 newline_and_indent (pp, spc);
2116 else
2118 pp_comma (pp);
2119 pp_space (pp);
2123 dump_generic_node (pp, *tp, spc, flags, !(flags & TDF_SLIM));
2125 break;
2127 case STATEMENT_LIST:
2129 tree_stmt_iterator si;
2130 bool first = true;
2132 if (flags & TDF_SLIM)
2134 pp_string (pp, "<STATEMENT_LIST>");
2135 break;
2138 for (si = tsi_start (node); !tsi_end_p (si); tsi_next (&si))
2140 if (!first)
2141 newline_and_indent (pp, spc);
2142 else
2143 first = false;
2144 dump_generic_node (pp, tsi_stmt (si), spc, flags, true);
2147 break;
2149 case MODIFY_EXPR:
2150 case INIT_EXPR:
2151 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags,
2152 false);
2153 pp_space (pp);
2154 pp_equal (pp);
2155 pp_space (pp);
2156 dump_generic_node (pp, TREE_OPERAND (node, 1), spc, flags,
2157 false);
2158 break;
2160 case TARGET_EXPR:
2161 pp_string (pp, "TARGET_EXPR <");
2162 dump_generic_node (pp, TARGET_EXPR_SLOT (node), spc, flags, false);
2163 pp_comma (pp);
2164 pp_space (pp);
2165 dump_generic_node (pp, TARGET_EXPR_INITIAL (node), spc, flags, false);
2166 pp_greater (pp);
2167 break;
2169 case DECL_EXPR:
2170 print_declaration (pp, DECL_EXPR_DECL (node), spc, flags);
2171 is_stmt = false;
2172 break;
2174 case COND_EXPR:
2175 if (TREE_TYPE (node) == NULL || TREE_TYPE (node) == void_type_node)
2177 pp_string (pp, "if (");
2178 dump_generic_node (pp, COND_EXPR_COND (node), spc, flags, false);
2179 pp_right_paren (pp);
2180 /* The lowered cond_exprs should always be printed in full. */
2181 if (COND_EXPR_THEN (node)
2182 && (IS_EMPTY_STMT (COND_EXPR_THEN (node))
2183 || TREE_CODE (COND_EXPR_THEN (node)) == GOTO_EXPR)
2184 && COND_EXPR_ELSE (node)
2185 && (IS_EMPTY_STMT (COND_EXPR_ELSE (node))
2186 || TREE_CODE (COND_EXPR_ELSE (node)) == GOTO_EXPR))
2188 pp_space (pp);
2189 dump_generic_node (pp, COND_EXPR_THEN (node),
2190 0, flags, true);
2191 if (!IS_EMPTY_STMT (COND_EXPR_ELSE (node)))
2193 pp_string (pp, " else ");
2194 dump_generic_node (pp, COND_EXPR_ELSE (node),
2195 0, flags, true);
2198 else if (!(flags & TDF_SLIM))
2200 /* Output COND_EXPR_THEN. */
2201 if (COND_EXPR_THEN (node))
2203 newline_and_indent (pp, spc+2);
2204 pp_left_brace (pp);
2205 newline_and_indent (pp, spc+4);
2206 dump_generic_node (pp, COND_EXPR_THEN (node), spc+4,
2207 flags, true);
2208 newline_and_indent (pp, spc+2);
2209 pp_right_brace (pp);
2212 /* Output COND_EXPR_ELSE. */
2213 if (COND_EXPR_ELSE (node)
2214 && !IS_EMPTY_STMT (COND_EXPR_ELSE (node)))
2216 newline_and_indent (pp, spc);
2217 pp_string (pp, "else");
2218 newline_and_indent (pp, spc+2);
2219 pp_left_brace (pp);
2220 newline_and_indent (pp, spc+4);
2221 dump_generic_node (pp, COND_EXPR_ELSE (node), spc+4,
2222 flags, true);
2223 newline_and_indent (pp, spc+2);
2224 pp_right_brace (pp);
2227 is_expr = false;
2229 else
2231 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2232 pp_space (pp);
2233 pp_question (pp);
2234 pp_space (pp);
2235 dump_generic_node (pp, TREE_OPERAND (node, 1), spc, flags, false);
2236 pp_space (pp);
2237 pp_colon (pp);
2238 pp_space (pp);
2239 dump_generic_node (pp, TREE_OPERAND (node, 2), spc, flags, false);
2241 break;
2243 case BIND_EXPR:
2244 pp_left_brace (pp);
2245 if (!(flags & TDF_SLIM))
2247 if (BIND_EXPR_VARS (node))
2249 pp_newline (pp);
2251 for (op0 = BIND_EXPR_VARS (node); op0; op0 = DECL_CHAIN (op0))
2253 print_declaration (pp, op0, spc+2, flags);
2254 pp_newline (pp);
2258 newline_and_indent (pp, spc+2);
2259 dump_generic_node (pp, BIND_EXPR_BODY (node), spc+2, flags, true);
2260 newline_and_indent (pp, spc);
2261 pp_right_brace (pp);
2263 is_expr = false;
2264 break;
2266 case CALL_EXPR:
2267 if (CALL_EXPR_FN (node) != NULL_TREE)
2268 print_call_name (pp, CALL_EXPR_FN (node), flags);
2269 else
2271 pp_dot (pp);
2272 pp_string (pp, internal_fn_name (CALL_EXPR_IFN (node)));
2275 /* Print parameters. */
2276 pp_space (pp);
2277 pp_left_paren (pp);
2279 tree arg;
2280 call_expr_arg_iterator iter;
2281 FOR_EACH_CALL_EXPR_ARG (arg, iter, node)
2283 dump_generic_node (pp, arg, spc, flags, false);
2284 if (more_call_expr_args_p (&iter))
2286 pp_comma (pp);
2287 pp_space (pp);
2291 if (CALL_EXPR_VA_ARG_PACK (node))
2293 if (call_expr_nargs (node) > 0)
2295 pp_comma (pp);
2296 pp_space (pp);
2298 pp_string (pp, "__builtin_va_arg_pack ()");
2300 pp_right_paren (pp);
2302 op1 = CALL_EXPR_STATIC_CHAIN (node);
2303 if (op1)
2305 pp_string (pp, " [static-chain: ");
2306 dump_generic_node (pp, op1, spc, flags, false);
2307 pp_right_bracket (pp);
2310 if (CALL_EXPR_RETURN_SLOT_OPT (node))
2311 pp_string (pp, " [return slot optimization]");
2312 if (CALL_EXPR_TAILCALL (node))
2313 pp_string (pp, " [tail call]");
2314 break;
2316 case WITH_CLEANUP_EXPR:
2317 NIY;
2318 break;
2320 case CLEANUP_POINT_EXPR:
2321 pp_string (pp, "<<cleanup_point ");
2322 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2323 pp_string (pp, ">>");
2324 break;
2326 case PLACEHOLDER_EXPR:
2327 pp_string (pp, "<PLACEHOLDER_EXPR ");
2328 dump_generic_node (pp, TREE_TYPE (node), spc, flags, false);
2329 pp_greater (pp);
2330 break;
2332 /* Binary arithmetic and logic expressions. */
2333 case WIDEN_SUM_EXPR:
2334 case WIDEN_MULT_EXPR:
2335 case MULT_EXPR:
2336 case MULT_HIGHPART_EXPR:
2337 case PLUS_EXPR:
2338 case POINTER_PLUS_EXPR:
2339 case POINTER_DIFF_EXPR:
2340 case MINUS_EXPR:
2341 case TRUNC_DIV_EXPR:
2342 case CEIL_DIV_EXPR:
2343 case FLOOR_DIV_EXPR:
2344 case ROUND_DIV_EXPR:
2345 case TRUNC_MOD_EXPR:
2346 case CEIL_MOD_EXPR:
2347 case FLOOR_MOD_EXPR:
2348 case ROUND_MOD_EXPR:
2349 case RDIV_EXPR:
2350 case EXACT_DIV_EXPR:
2351 case LSHIFT_EXPR:
2352 case RSHIFT_EXPR:
2353 case LROTATE_EXPR:
2354 case RROTATE_EXPR:
2355 case WIDEN_LSHIFT_EXPR:
2356 case BIT_IOR_EXPR:
2357 case BIT_XOR_EXPR:
2358 case BIT_AND_EXPR:
2359 case TRUTH_ANDIF_EXPR:
2360 case TRUTH_ORIF_EXPR:
2361 case TRUTH_AND_EXPR:
2362 case TRUTH_OR_EXPR:
2363 case TRUTH_XOR_EXPR:
2364 case LT_EXPR:
2365 case LE_EXPR:
2366 case GT_EXPR:
2367 case GE_EXPR:
2368 case EQ_EXPR:
2369 case NE_EXPR:
2370 case UNLT_EXPR:
2371 case UNLE_EXPR:
2372 case UNGT_EXPR:
2373 case UNGE_EXPR:
2374 case UNEQ_EXPR:
2375 case LTGT_EXPR:
2376 case ORDERED_EXPR:
2377 case UNORDERED_EXPR:
2379 const char *op = op_symbol (node);
2380 op0 = TREE_OPERAND (node, 0);
2381 op1 = TREE_OPERAND (node, 1);
2383 /* When the operands are expressions with less priority,
2384 keep semantics of the tree representation. */
2385 if (op_prio (op0) <= op_prio (node))
2387 pp_left_paren (pp);
2388 dump_generic_node (pp, op0, spc, flags, false);
2389 pp_right_paren (pp);
2391 else
2392 dump_generic_node (pp, op0, spc, flags, false);
2394 pp_space (pp);
2395 pp_string (pp, op);
2396 pp_space (pp);
2398 /* When the operands are expressions with less priority,
2399 keep semantics of the tree representation. */
2400 if (op_prio (op1) <= op_prio (node))
2402 pp_left_paren (pp);
2403 dump_generic_node (pp, op1, spc, flags, false);
2404 pp_right_paren (pp);
2406 else
2407 dump_generic_node (pp, op1, spc, flags, false);
2409 break;
2411 /* Unary arithmetic and logic expressions. */
2412 case NEGATE_EXPR:
2413 case BIT_NOT_EXPR:
2414 case TRUTH_NOT_EXPR:
2415 case ADDR_EXPR:
2416 case PREDECREMENT_EXPR:
2417 case PREINCREMENT_EXPR:
2418 case INDIRECT_REF:
2419 if (TREE_CODE (node) == ADDR_EXPR
2420 && (TREE_CODE (TREE_OPERAND (node, 0)) == STRING_CST
2421 || TREE_CODE (TREE_OPERAND (node, 0)) == FUNCTION_DECL))
2422 ; /* Do not output '&' for strings and function pointers. */
2423 else
2424 pp_string (pp, op_symbol (node));
2426 if (op_prio (TREE_OPERAND (node, 0)) < op_prio (node))
2428 pp_left_paren (pp);
2429 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2430 pp_right_paren (pp);
2432 else
2433 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2434 break;
2436 case POSTDECREMENT_EXPR:
2437 case POSTINCREMENT_EXPR:
2438 if (op_prio (TREE_OPERAND (node, 0)) < op_prio (node))
2440 pp_left_paren (pp);
2441 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2442 pp_right_paren (pp);
2444 else
2445 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2446 pp_string (pp, op_symbol (node));
2447 break;
2449 case MIN_EXPR:
2450 pp_string (pp, "MIN_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;
2457 case MAX_EXPR:
2458 pp_string (pp, "MAX_EXPR <");
2459 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2460 pp_string (pp, ", ");
2461 dump_generic_node (pp, TREE_OPERAND (node, 1), spc, flags, false);
2462 pp_greater (pp);
2463 break;
2465 case ABS_EXPR:
2466 pp_string (pp, "ABS_EXPR <");
2467 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2468 pp_greater (pp);
2469 break;
2471 case ABSU_EXPR:
2472 pp_string (pp, "ABSU_EXPR <");
2473 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2474 pp_greater (pp);
2475 break;
2477 case RANGE_EXPR:
2478 NIY;
2479 break;
2481 case ADDR_SPACE_CONVERT_EXPR:
2482 case FIXED_CONVERT_EXPR:
2483 case FIX_TRUNC_EXPR:
2484 case FLOAT_EXPR:
2485 CASE_CONVERT:
2486 type = TREE_TYPE (node);
2487 op0 = TREE_OPERAND (node, 0);
2488 if (type != TREE_TYPE (op0))
2490 pp_left_paren (pp);
2491 dump_generic_node (pp, type, spc, flags, false);
2492 pp_string (pp, ") ");
2494 if (op_prio (op0) < op_prio (node))
2495 pp_left_paren (pp);
2496 dump_generic_node (pp, op0, spc, flags, false);
2497 if (op_prio (op0) < op_prio (node))
2498 pp_right_paren (pp);
2499 break;
2501 case VIEW_CONVERT_EXPR:
2502 pp_string (pp, "VIEW_CONVERT_EXPR<");
2503 dump_generic_node (pp, TREE_TYPE (node), spc, flags, false);
2504 pp_string (pp, ">(");
2505 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2506 pp_right_paren (pp);
2507 break;
2509 case PAREN_EXPR:
2510 pp_string (pp, "((");
2511 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2512 pp_string (pp, "))");
2513 break;
2515 case NON_LVALUE_EXPR:
2516 pp_string (pp, "NON_LVALUE_EXPR <");
2517 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2518 pp_greater (pp);
2519 break;
2521 case SAVE_EXPR:
2522 pp_string (pp, "SAVE_EXPR <");
2523 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2524 pp_greater (pp);
2525 break;
2527 case COMPLEX_EXPR:
2528 pp_string (pp, "COMPLEX_EXPR <");
2529 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2530 pp_string (pp, ", ");
2531 dump_generic_node (pp, TREE_OPERAND (node, 1), spc, flags, false);
2532 pp_greater (pp);
2533 break;
2535 case CONJ_EXPR:
2536 pp_string (pp, "CONJ_EXPR <");
2537 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2538 pp_greater (pp);
2539 break;
2541 case REALPART_EXPR:
2542 if (flags & TDF_GIMPLE)
2544 pp_string (pp, "__real ");
2545 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2547 else
2549 pp_string (pp, "REALPART_EXPR <");
2550 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2551 pp_greater (pp);
2553 break;
2555 case IMAGPART_EXPR:
2556 if (flags & TDF_GIMPLE)
2558 pp_string (pp, "__imag ");
2559 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2561 else
2563 pp_string (pp, "IMAGPART_EXPR <");
2564 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2565 pp_greater (pp);
2567 break;
2569 case VA_ARG_EXPR:
2570 pp_string (pp, "VA_ARG_EXPR <");
2571 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2572 pp_greater (pp);
2573 break;
2575 case TRY_FINALLY_EXPR:
2576 case TRY_CATCH_EXPR:
2577 pp_string (pp, "try");
2578 newline_and_indent (pp, spc+2);
2579 pp_left_brace (pp);
2580 newline_and_indent (pp, spc+4);
2581 dump_generic_node (pp, TREE_OPERAND (node, 0), spc+4, flags, true);
2582 newline_and_indent (pp, spc+2);
2583 pp_right_brace (pp);
2584 newline_and_indent (pp, spc);
2585 pp_string (pp,
2586 (TREE_CODE (node) == TRY_CATCH_EXPR) ? "catch" : "finally");
2587 newline_and_indent (pp, spc+2);
2588 pp_left_brace (pp);
2589 newline_and_indent (pp, spc+4);
2590 dump_generic_node (pp, TREE_OPERAND (node, 1), spc+4, flags, true);
2591 newline_and_indent (pp, spc+2);
2592 pp_right_brace (pp);
2593 is_expr = false;
2594 break;
2596 case CATCH_EXPR:
2597 pp_string (pp, "catch (");
2598 dump_generic_node (pp, CATCH_TYPES (node), spc+2, flags, false);
2599 pp_right_paren (pp);
2600 newline_and_indent (pp, spc+2);
2601 pp_left_brace (pp);
2602 newline_and_indent (pp, spc+4);
2603 dump_generic_node (pp, CATCH_BODY (node), spc+4, flags, true);
2604 newline_and_indent (pp, spc+2);
2605 pp_right_brace (pp);
2606 is_expr = false;
2607 break;
2609 case EH_FILTER_EXPR:
2610 pp_string (pp, "<<<eh_filter (");
2611 dump_generic_node (pp, EH_FILTER_TYPES (node), spc+2, flags, false);
2612 pp_string (pp, ")>>>");
2613 newline_and_indent (pp, spc+2);
2614 pp_left_brace (pp);
2615 newline_and_indent (pp, spc+4);
2616 dump_generic_node (pp, EH_FILTER_FAILURE (node), spc+4, flags, true);
2617 newline_and_indent (pp, spc+2);
2618 pp_right_brace (pp);
2619 is_expr = false;
2620 break;
2622 case LABEL_EXPR:
2623 op0 = TREE_OPERAND (node, 0);
2624 /* If this is for break or continue, don't bother printing it. */
2625 if (DECL_NAME (op0))
2627 const char *name = IDENTIFIER_POINTER (DECL_NAME (op0));
2628 if (strcmp (name, "break") == 0
2629 || strcmp (name, "continue") == 0)
2630 break;
2632 dump_generic_node (pp, op0, spc, flags, false);
2633 pp_colon (pp);
2634 if (DECL_NONLOCAL (op0))
2635 pp_string (pp, " [non-local]");
2636 break;
2638 case LOOP_EXPR:
2639 pp_string (pp, "while (1)");
2640 if (!(flags & TDF_SLIM))
2642 newline_and_indent (pp, spc+2);
2643 pp_left_brace (pp);
2644 newline_and_indent (pp, spc+4);
2645 dump_generic_node (pp, LOOP_EXPR_BODY (node), spc+4, flags, true);
2646 newline_and_indent (pp, spc+2);
2647 pp_right_brace (pp);
2649 is_expr = false;
2650 break;
2652 case PREDICT_EXPR:
2653 pp_string (pp, "// predicted ");
2654 if (PREDICT_EXPR_OUTCOME (node))
2655 pp_string (pp, "likely by ");
2656 else
2657 pp_string (pp, "unlikely by ");
2658 pp_string (pp, predictor_name (PREDICT_EXPR_PREDICTOR (node)));
2659 pp_string (pp, " predictor.");
2660 break;
2662 case ANNOTATE_EXPR:
2663 pp_string (pp, "ANNOTATE_EXPR <");
2664 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2665 switch ((enum annot_expr_kind) TREE_INT_CST_LOW (TREE_OPERAND (node, 1)))
2667 case annot_expr_ivdep_kind:
2668 pp_string (pp, ", ivdep");
2669 break;
2670 case annot_expr_unroll_kind:
2671 pp_printf (pp, ", unroll %d",
2672 (int) TREE_INT_CST_LOW (TREE_OPERAND (node, 2)));
2673 break;
2674 case annot_expr_no_vector_kind:
2675 pp_string (pp, ", no-vector");
2676 break;
2677 case annot_expr_vector_kind:
2678 pp_string (pp, ", vector");
2679 break;
2680 case annot_expr_parallel_kind:
2681 pp_string (pp, ", parallel");
2682 break;
2683 default:
2684 gcc_unreachable ();
2686 pp_greater (pp);
2687 break;
2689 case RETURN_EXPR:
2690 pp_string (pp, "return");
2691 op0 = TREE_OPERAND (node, 0);
2692 if (op0)
2694 pp_space (pp);
2695 if (TREE_CODE (op0) == MODIFY_EXPR)
2696 dump_generic_node (pp, TREE_OPERAND (op0, 1),
2697 spc, flags, false);
2698 else
2699 dump_generic_node (pp, op0, spc, flags, false);
2701 break;
2703 case EXIT_EXPR:
2704 pp_string (pp, "if (");
2705 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2706 pp_string (pp, ") break");
2707 break;
2709 case SWITCH_EXPR:
2710 pp_string (pp, "switch (");
2711 dump_generic_node (pp, SWITCH_COND (node), spc, flags, false);
2712 pp_right_paren (pp);
2713 if (!(flags & TDF_SLIM))
2715 newline_and_indent (pp, spc+2);
2716 pp_left_brace (pp);
2717 if (SWITCH_BODY (node))
2719 newline_and_indent (pp, spc+4);
2720 dump_generic_node (pp, SWITCH_BODY (node), spc+4, flags,
2721 true);
2723 newline_and_indent (pp, spc+2);
2724 pp_right_brace (pp);
2726 is_expr = false;
2727 break;
2729 case GOTO_EXPR:
2730 op0 = GOTO_DESTINATION (node);
2731 if (TREE_CODE (op0) != SSA_NAME && DECL_P (op0) && DECL_NAME (op0))
2733 const char *name = IDENTIFIER_POINTER (DECL_NAME (op0));
2734 if (strcmp (name, "break") == 0
2735 || strcmp (name, "continue") == 0)
2737 pp_string (pp, name);
2738 break;
2741 pp_string (pp, "goto ");
2742 dump_generic_node (pp, op0, spc, flags, false);
2743 break;
2745 case ASM_EXPR:
2746 pp_string (pp, "__asm__");
2747 if (ASM_VOLATILE_P (node))
2748 pp_string (pp, " __volatile__");
2749 pp_left_paren (pp);
2750 dump_generic_node (pp, ASM_STRING (node), spc, flags, false);
2751 pp_colon (pp);
2752 dump_generic_node (pp, ASM_OUTPUTS (node), spc, flags, false);
2753 pp_colon (pp);
2754 dump_generic_node (pp, ASM_INPUTS (node), spc, flags, false);
2755 if (ASM_CLOBBERS (node))
2757 pp_colon (pp);
2758 dump_generic_node (pp, ASM_CLOBBERS (node), spc, flags, false);
2760 pp_right_paren (pp);
2761 break;
2763 case CASE_LABEL_EXPR:
2764 if (CASE_LOW (node) && CASE_HIGH (node))
2766 pp_string (pp, "case ");
2767 dump_generic_node (pp, CASE_LOW (node), spc, flags, false);
2768 pp_string (pp, " ... ");
2769 dump_generic_node (pp, CASE_HIGH (node), spc, flags, false);
2771 else if (CASE_LOW (node))
2773 pp_string (pp, "case ");
2774 dump_generic_node (pp, CASE_LOW (node), spc, flags, false);
2776 else
2777 pp_string (pp, "default");
2778 pp_colon (pp);
2779 break;
2781 case OBJ_TYPE_REF:
2782 pp_string (pp, "OBJ_TYPE_REF(");
2783 dump_generic_node (pp, OBJ_TYPE_REF_EXPR (node), spc, flags, false);
2784 pp_semicolon (pp);
2785 /* We omit the class type for -fcompare-debug because we may
2786 drop TYPE_BINFO early depending on debug info, and then
2787 virtual_method_call_p would return false, whereas when
2788 TYPE_BINFO is preserved it may still return true and then
2789 we'd print the class type. Compare tree and rtl dumps for
2790 libstdc++-prettyprinters/shared_ptr.cc with and without -g,
2791 for example, at occurrences of OBJ_TYPE_REF. */
2792 if (!(flags & (TDF_SLIM | TDF_COMPARE_DEBUG))
2793 && virtual_method_call_p (node))
2795 pp_string (pp, "(");
2796 dump_generic_node (pp, obj_type_ref_class (node), spc, flags, false);
2797 pp_string (pp, ")");
2799 dump_generic_node (pp, OBJ_TYPE_REF_OBJECT (node), spc, flags, false);
2800 pp_arrow (pp);
2801 dump_generic_node (pp, OBJ_TYPE_REF_TOKEN (node), spc, flags, false);
2802 pp_right_paren (pp);
2803 break;
2805 case SSA_NAME:
2806 if (SSA_NAME_IDENTIFIER (node))
2808 if ((flags & TDF_NOUID)
2809 && SSA_NAME_VAR (node)
2810 && DECL_NAMELESS (SSA_NAME_VAR (node)))
2811 dump_fancy_name (pp, SSA_NAME_IDENTIFIER (node));
2812 else if (! (flags & TDF_GIMPLE)
2813 || SSA_NAME_VAR (node))
2814 dump_generic_node (pp, SSA_NAME_IDENTIFIER (node),
2815 spc, flags, false);
2817 pp_underscore (pp);
2818 pp_decimal_int (pp, SSA_NAME_VERSION (node));
2819 if (SSA_NAME_IS_DEFAULT_DEF (node))
2820 pp_string (pp, "(D)");
2821 if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (node))
2822 pp_string (pp, "(ab)");
2823 break;
2825 case WITH_SIZE_EXPR:
2826 pp_string (pp, "WITH_SIZE_EXPR <");
2827 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2828 pp_string (pp, ", ");
2829 dump_generic_node (pp, TREE_OPERAND (node, 1), spc, flags, false);
2830 pp_greater (pp);
2831 break;
2833 case ASSERT_EXPR:
2834 pp_string (pp, "ASSERT_EXPR <");
2835 dump_generic_node (pp, ASSERT_EXPR_VAR (node), spc, flags, false);
2836 pp_string (pp, ", ");
2837 dump_generic_node (pp, ASSERT_EXPR_COND (node), spc, flags, false);
2838 pp_greater (pp);
2839 break;
2841 case SCEV_KNOWN:
2842 pp_string (pp, "scev_known");
2843 break;
2845 case SCEV_NOT_KNOWN:
2846 pp_string (pp, "scev_not_known");
2847 break;
2849 case POLYNOMIAL_CHREC:
2850 pp_left_brace (pp);
2851 dump_generic_node (pp, CHREC_LEFT (node), spc, flags, false);
2852 pp_string (pp, ", +, ");
2853 dump_generic_node (pp, CHREC_RIGHT (node), spc, flags, false);
2854 pp_printf (pp, "}_%u", CHREC_VARIABLE (node));
2855 is_stmt = false;
2856 break;
2858 case REALIGN_LOAD_EXPR:
2859 pp_string (pp, "REALIGN_LOAD <");
2860 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2861 pp_string (pp, ", ");
2862 dump_generic_node (pp, TREE_OPERAND (node, 1), spc, flags, false);
2863 pp_string (pp, ", ");
2864 dump_generic_node (pp, TREE_OPERAND (node, 2), spc, flags, false);
2865 pp_greater (pp);
2866 break;
2868 case VEC_COND_EXPR:
2869 pp_string (pp, " VEC_COND_EXPR < ");
2870 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2871 pp_string (pp, " , ");
2872 dump_generic_node (pp, TREE_OPERAND (node, 1), spc, flags, false);
2873 pp_string (pp, " , ");
2874 dump_generic_node (pp, TREE_OPERAND (node, 2), spc, flags, false);
2875 pp_string (pp, " > ");
2876 break;
2878 case VEC_PERM_EXPR:
2879 pp_string (pp, " VEC_PERM_EXPR < ");
2880 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2881 pp_string (pp, " , ");
2882 dump_generic_node (pp, TREE_OPERAND (node, 1), spc, flags, false);
2883 pp_string (pp, " , ");
2884 dump_generic_node (pp, TREE_OPERAND (node, 2), spc, flags, false);
2885 pp_string (pp, " > ");
2886 break;
2888 case DOT_PROD_EXPR:
2889 pp_string (pp, " DOT_PROD_EXPR < ");
2890 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2891 pp_string (pp, ", ");
2892 dump_generic_node (pp, TREE_OPERAND (node, 1), spc, flags, false);
2893 pp_string (pp, ", ");
2894 dump_generic_node (pp, TREE_OPERAND (node, 2), spc, flags, false);
2895 pp_string (pp, " > ");
2896 break;
2898 case WIDEN_MULT_PLUS_EXPR:
2899 pp_string (pp, " WIDEN_MULT_PLUS_EXPR < ");
2900 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2901 pp_string (pp, ", ");
2902 dump_generic_node (pp, TREE_OPERAND (node, 1), spc, flags, false);
2903 pp_string (pp, ", ");
2904 dump_generic_node (pp, TREE_OPERAND (node, 2), spc, flags, false);
2905 pp_string (pp, " > ");
2906 break;
2908 case WIDEN_MULT_MINUS_EXPR:
2909 pp_string (pp, " WIDEN_MULT_MINUS_EXPR < ");
2910 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2911 pp_string (pp, ", ");
2912 dump_generic_node (pp, TREE_OPERAND (node, 1), spc, flags, false);
2913 pp_string (pp, ", ");
2914 dump_generic_node (pp, TREE_OPERAND (node, 2), spc, flags, false);
2915 pp_string (pp, " > ");
2916 break;
2918 case OACC_PARALLEL:
2919 pp_string (pp, "#pragma acc parallel");
2920 goto dump_omp_clauses_body;
2922 case OACC_KERNELS:
2923 pp_string (pp, "#pragma acc kernels");
2924 goto dump_omp_clauses_body;
2926 case OACC_DATA:
2927 pp_string (pp, "#pragma acc data");
2928 dump_omp_clauses (pp, OACC_DATA_CLAUSES (node), spc, flags);
2929 goto dump_omp_body;
2931 case OACC_HOST_DATA:
2932 pp_string (pp, "#pragma acc host_data");
2933 dump_omp_clauses (pp, OACC_HOST_DATA_CLAUSES (node), spc, flags);
2934 goto dump_omp_body;
2936 case OACC_DECLARE:
2937 pp_string (pp, "#pragma acc declare");
2938 dump_omp_clauses (pp, OACC_DECLARE_CLAUSES (node), spc, flags);
2939 break;
2941 case OACC_UPDATE:
2942 pp_string (pp, "#pragma acc update");
2943 dump_omp_clauses (pp, OACC_UPDATE_CLAUSES (node), spc, flags);
2944 break;
2946 case OACC_ENTER_DATA:
2947 pp_string (pp, "#pragma acc enter data");
2948 dump_omp_clauses (pp, OACC_ENTER_DATA_CLAUSES (node), spc, flags);
2949 break;
2951 case OACC_EXIT_DATA:
2952 pp_string (pp, "#pragma acc exit data");
2953 dump_omp_clauses (pp, OACC_EXIT_DATA_CLAUSES (node), spc, flags);
2954 break;
2956 case OACC_CACHE:
2957 pp_string (pp, "#pragma acc cache");
2958 dump_omp_clauses (pp, OACC_CACHE_CLAUSES (node), spc, flags);
2959 break;
2961 case OMP_PARALLEL:
2962 pp_string (pp, "#pragma omp parallel");
2963 dump_omp_clauses (pp, OMP_PARALLEL_CLAUSES (node), spc, flags);
2964 goto dump_omp_body;
2966 dump_omp_clauses_body:
2967 dump_omp_clauses (pp, OMP_CLAUSES (node), spc, flags);
2968 goto dump_omp_body;
2970 dump_omp_body:
2971 if (!(flags & TDF_SLIM) && OMP_BODY (node))
2973 newline_and_indent (pp, spc + 2);
2974 pp_left_brace (pp);
2975 newline_and_indent (pp, spc + 4);
2976 dump_generic_node (pp, OMP_BODY (node), spc + 4, flags, false);
2977 newline_and_indent (pp, spc + 2);
2978 pp_right_brace (pp);
2980 is_expr = false;
2981 break;
2983 case OMP_TASK:
2984 pp_string (pp, "#pragma omp task");
2985 dump_omp_clauses (pp, OMP_TASK_CLAUSES (node), spc, flags);
2986 goto dump_omp_body;
2988 case OMP_FOR:
2989 pp_string (pp, "#pragma omp for");
2990 goto dump_omp_loop;
2992 case OMP_SIMD:
2993 pp_string (pp, "#pragma omp simd");
2994 goto dump_omp_loop;
2996 case OMP_DISTRIBUTE:
2997 pp_string (pp, "#pragma omp distribute");
2998 goto dump_omp_loop;
3000 case OMP_TASKLOOP:
3001 pp_string (pp, "#pragma omp taskloop");
3002 goto dump_omp_loop;
3004 case OACC_LOOP:
3005 pp_string (pp, "#pragma acc loop");
3006 goto dump_omp_loop;
3008 case OMP_TEAMS:
3009 pp_string (pp, "#pragma omp teams");
3010 dump_omp_clauses (pp, OMP_TEAMS_CLAUSES (node), spc, flags);
3011 goto dump_omp_body;
3013 case OMP_TARGET_DATA:
3014 pp_string (pp, "#pragma omp target data");
3015 dump_omp_clauses (pp, OMP_TARGET_DATA_CLAUSES (node), spc, flags);
3016 goto dump_omp_body;
3018 case OMP_TARGET_ENTER_DATA:
3019 pp_string (pp, "#pragma omp target enter data");
3020 dump_omp_clauses (pp, OMP_TARGET_ENTER_DATA_CLAUSES (node), spc, flags);
3021 is_expr = false;
3022 break;
3024 case OMP_TARGET_EXIT_DATA:
3025 pp_string (pp, "#pragma omp target exit data");
3026 dump_omp_clauses (pp, OMP_TARGET_EXIT_DATA_CLAUSES (node), spc, flags);
3027 is_expr = false;
3028 break;
3030 case OMP_TARGET:
3031 pp_string (pp, "#pragma omp target");
3032 dump_omp_clauses (pp, OMP_TARGET_CLAUSES (node), spc, flags);
3033 goto dump_omp_body;
3035 case OMP_TARGET_UPDATE:
3036 pp_string (pp, "#pragma omp target update");
3037 dump_omp_clauses (pp, OMP_TARGET_UPDATE_CLAUSES (node), spc, flags);
3038 is_expr = false;
3039 break;
3041 dump_omp_loop:
3042 dump_omp_clauses (pp, OMP_FOR_CLAUSES (node), spc, flags);
3043 if (!(flags & TDF_SLIM))
3045 int i;
3047 if (OMP_FOR_PRE_BODY (node))
3049 newline_and_indent (pp, spc + 2);
3050 pp_left_brace (pp);
3051 spc += 4;
3052 newline_and_indent (pp, spc);
3053 dump_generic_node (pp, OMP_FOR_PRE_BODY (node),
3054 spc, flags, false);
3056 if (OMP_FOR_INIT (node))
3058 spc -= 2;
3059 for (i = 0; i < TREE_VEC_LENGTH (OMP_FOR_INIT (node)); i++)
3061 spc += 2;
3062 newline_and_indent (pp, spc);
3063 pp_string (pp, "for (");
3064 dump_generic_node (pp,
3065 TREE_VEC_ELT (OMP_FOR_INIT (node), i),
3066 spc, flags, false);
3067 pp_string (pp, "; ");
3068 dump_generic_node (pp,
3069 TREE_VEC_ELT (OMP_FOR_COND (node), i),
3070 spc, flags, false);
3071 pp_string (pp, "; ");
3072 dump_generic_node (pp,
3073 TREE_VEC_ELT (OMP_FOR_INCR (node), i),
3074 spc, flags, false);
3075 pp_right_paren (pp);
3078 if (OMP_FOR_BODY (node))
3080 newline_and_indent (pp, spc + 2);
3081 pp_left_brace (pp);
3082 newline_and_indent (pp, spc + 4);
3083 dump_generic_node (pp, OMP_FOR_BODY (node), spc + 4, flags,
3084 false);
3085 newline_and_indent (pp, spc + 2);
3086 pp_right_brace (pp);
3088 if (OMP_FOR_INIT (node))
3089 spc -= 2 * TREE_VEC_LENGTH (OMP_FOR_INIT (node)) - 2;
3090 if (OMP_FOR_PRE_BODY (node))
3092 spc -= 4;
3093 newline_and_indent (pp, spc + 2);
3094 pp_right_brace (pp);
3097 is_expr = false;
3098 break;
3100 case OMP_SECTIONS:
3101 pp_string (pp, "#pragma omp sections");
3102 dump_omp_clauses (pp, OMP_SECTIONS_CLAUSES (node), spc, flags);
3103 goto dump_omp_body;
3105 case OMP_SECTION:
3106 pp_string (pp, "#pragma omp section");
3107 goto dump_omp_body;
3109 case OMP_MASTER:
3110 pp_string (pp, "#pragma omp master");
3111 goto dump_omp_body;
3113 case OMP_TASKGROUP:
3114 pp_string (pp, "#pragma omp taskgroup");
3115 goto dump_omp_body;
3117 case OMP_ORDERED:
3118 pp_string (pp, "#pragma omp ordered");
3119 dump_omp_clauses (pp, OMP_ORDERED_CLAUSES (node), spc, flags);
3120 goto dump_omp_body;
3122 case OMP_CRITICAL:
3123 pp_string (pp, "#pragma omp critical");
3124 if (OMP_CRITICAL_NAME (node))
3126 pp_space (pp);
3127 pp_left_paren (pp);
3128 dump_generic_node (pp, OMP_CRITICAL_NAME (node), spc,
3129 flags, false);
3130 pp_right_paren (pp);
3132 dump_omp_clauses (pp, OMP_CRITICAL_CLAUSES (node), spc, flags);
3133 goto dump_omp_body;
3135 case OMP_ATOMIC:
3136 pp_string (pp, "#pragma omp atomic");
3137 if (OMP_ATOMIC_SEQ_CST (node))
3138 pp_string (pp, " seq_cst");
3139 newline_and_indent (pp, spc + 2);
3140 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
3141 pp_space (pp);
3142 pp_equal (pp);
3143 pp_space (pp);
3144 dump_generic_node (pp, TREE_OPERAND (node, 1), spc, flags, false);
3145 break;
3147 case OMP_ATOMIC_READ:
3148 pp_string (pp, "#pragma omp atomic read");
3149 if (OMP_ATOMIC_SEQ_CST (node))
3150 pp_string (pp, " seq_cst");
3151 newline_and_indent (pp, spc + 2);
3152 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
3153 pp_space (pp);
3154 break;
3156 case OMP_ATOMIC_CAPTURE_OLD:
3157 case OMP_ATOMIC_CAPTURE_NEW:
3158 pp_string (pp, "#pragma omp atomic capture");
3159 if (OMP_ATOMIC_SEQ_CST (node))
3160 pp_string (pp, " seq_cst");
3161 newline_and_indent (pp, spc + 2);
3162 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
3163 pp_space (pp);
3164 pp_equal (pp);
3165 pp_space (pp);
3166 dump_generic_node (pp, TREE_OPERAND (node, 1), spc, flags, false);
3167 break;
3169 case OMP_SINGLE:
3170 pp_string (pp, "#pragma omp single");
3171 dump_omp_clauses (pp, OMP_SINGLE_CLAUSES (node), spc, flags);
3172 goto dump_omp_body;
3174 case OMP_CLAUSE:
3175 dump_omp_clause (pp, node, spc, flags);
3176 is_expr = false;
3177 break;
3179 case TRANSACTION_EXPR:
3180 if (TRANSACTION_EXPR_OUTER (node))
3181 pp_string (pp, "__transaction_atomic [[outer]]");
3182 else if (TRANSACTION_EXPR_RELAXED (node))
3183 pp_string (pp, "__transaction_relaxed");
3184 else
3185 pp_string (pp, "__transaction_atomic");
3186 if (!(flags & TDF_SLIM) && TRANSACTION_EXPR_BODY (node))
3188 newline_and_indent (pp, spc);
3189 pp_left_brace (pp);
3190 newline_and_indent (pp, spc + 2);
3191 dump_generic_node (pp, TRANSACTION_EXPR_BODY (node),
3192 spc + 2, flags, false);
3193 newline_and_indent (pp, spc);
3194 pp_right_brace (pp);
3196 is_expr = false;
3197 break;
3199 case VEC_SERIES_EXPR:
3200 case VEC_WIDEN_MULT_HI_EXPR:
3201 case VEC_WIDEN_MULT_LO_EXPR:
3202 case VEC_WIDEN_MULT_EVEN_EXPR:
3203 case VEC_WIDEN_MULT_ODD_EXPR:
3204 case VEC_WIDEN_LSHIFT_HI_EXPR:
3205 case VEC_WIDEN_LSHIFT_LO_EXPR:
3206 pp_space (pp);
3207 for (str = get_tree_code_name (code); *str; str++)
3208 pp_character (pp, TOUPPER (*str));
3209 pp_string (pp, " < ");
3210 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
3211 pp_string (pp, ", ");
3212 dump_generic_node (pp, TREE_OPERAND (node, 1), spc, flags, false);
3213 pp_string (pp, " > ");
3214 break;
3216 case VEC_DUPLICATE_EXPR:
3217 pp_space (pp);
3218 for (str = get_tree_code_name (code); *str; str++)
3219 pp_character (pp, TOUPPER (*str));
3220 pp_string (pp, " < ");
3221 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
3222 pp_string (pp, " > ");
3223 break;
3225 case VEC_UNPACK_HI_EXPR:
3226 pp_string (pp, " VEC_UNPACK_HI_EXPR < ");
3227 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
3228 pp_string (pp, " > ");
3229 break;
3231 case VEC_UNPACK_LO_EXPR:
3232 pp_string (pp, " VEC_UNPACK_LO_EXPR < ");
3233 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
3234 pp_string (pp, " > ");
3235 break;
3237 case VEC_UNPACK_FLOAT_HI_EXPR:
3238 pp_string (pp, " VEC_UNPACK_FLOAT_HI_EXPR < ");
3239 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
3240 pp_string (pp, " > ");
3241 break;
3243 case VEC_UNPACK_FLOAT_LO_EXPR:
3244 pp_string (pp, " VEC_UNPACK_FLOAT_LO_EXPR < ");
3245 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
3246 pp_string (pp, " > ");
3247 break;
3249 case VEC_UNPACK_FIX_TRUNC_HI_EXPR:
3250 pp_string (pp, " VEC_UNPACK_FIX_TRUNC_HI_EXPR < ");
3251 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
3252 pp_string (pp, " > ");
3253 break;
3255 case VEC_UNPACK_FIX_TRUNC_LO_EXPR:
3256 pp_string (pp, " VEC_UNPACK_FIX_TRUNC_LO_EXPR < ");
3257 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
3258 pp_string (pp, " > ");
3259 break;
3261 case VEC_PACK_TRUNC_EXPR:
3262 pp_string (pp, " VEC_PACK_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;
3269 case VEC_PACK_SAT_EXPR:
3270 pp_string (pp, " VEC_PACK_SAT_EXPR < ");
3271 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
3272 pp_string (pp, ", ");
3273 dump_generic_node (pp, TREE_OPERAND (node, 1), spc, flags, false);
3274 pp_string (pp, " > ");
3275 break;
3277 case VEC_PACK_FIX_TRUNC_EXPR:
3278 pp_string (pp, " VEC_PACK_FIX_TRUNC_EXPR < ");
3279 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
3280 pp_string (pp, ", ");
3281 dump_generic_node (pp, TREE_OPERAND (node, 1), spc, flags, false);
3282 pp_string (pp, " > ");
3283 break;
3285 case VEC_PACK_FLOAT_EXPR:
3286 pp_string (pp, " VEC_PACK_FLOAT_EXPR < ");
3287 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
3288 pp_string (pp, ", ");
3289 dump_generic_node (pp, TREE_OPERAND (node, 1), spc, flags, false);
3290 pp_string (pp, " > ");
3291 break;
3293 case BLOCK:
3294 dump_block_node (pp, node, spc, flags);
3295 break;
3297 case DEBUG_BEGIN_STMT:
3298 pp_string (pp, "# DEBUG BEGIN STMT");
3299 break;
3301 default:
3302 NIY;
3305 if (is_stmt && is_expr)
3306 pp_semicolon (pp);
3308 return spc;
3311 /* Print the declaration of a variable. */
3313 void
3314 print_declaration (pretty_printer *pp, tree t, int spc, dump_flags_t flags)
3316 INDENT (spc);
3318 if (TREE_CODE(t) == NAMELIST_DECL)
3320 pp_string(pp, "namelist ");
3321 dump_decl_name (pp, t, flags);
3322 pp_semicolon (pp);
3323 return;
3326 if (TREE_CODE (t) == TYPE_DECL)
3327 pp_string (pp, "typedef ");
3329 if (CODE_CONTAINS_STRUCT (TREE_CODE (t), TS_DECL_WRTL) && DECL_REGISTER (t))
3330 pp_string (pp, "register ");
3332 if (TREE_PUBLIC (t) && DECL_EXTERNAL (t))
3333 pp_string (pp, "extern ");
3334 else if (TREE_STATIC (t))
3335 pp_string (pp, "static ");
3337 /* Print the type and name. */
3338 if (TREE_TYPE (t) && TREE_CODE (TREE_TYPE (t)) == ARRAY_TYPE)
3340 tree tmp;
3342 /* Print array's type. */
3343 tmp = TREE_TYPE (t);
3344 while (TREE_CODE (TREE_TYPE (tmp)) == ARRAY_TYPE)
3345 tmp = TREE_TYPE (tmp);
3346 dump_generic_node (pp, TREE_TYPE (tmp), spc, flags, false);
3348 /* Print variable's name. */
3349 pp_space (pp);
3350 dump_generic_node (pp, t, spc, flags, false);
3352 /* Print the dimensions. */
3353 tmp = TREE_TYPE (t);
3354 while (TREE_CODE (tmp) == ARRAY_TYPE)
3356 dump_array_domain (pp, TYPE_DOMAIN (tmp), spc, flags);
3357 tmp = TREE_TYPE (tmp);
3360 else if (TREE_CODE (t) == FUNCTION_DECL)
3362 dump_generic_node (pp, TREE_TYPE (TREE_TYPE (t)), spc, flags, false);
3363 pp_space (pp);
3364 dump_decl_name (pp, t, flags);
3365 dump_function_declaration (pp, TREE_TYPE (t), spc, flags);
3367 else
3369 /* Print type declaration. */
3370 dump_generic_node (pp, TREE_TYPE (t), spc, flags, false);
3372 /* Print variable's name. */
3373 pp_space (pp);
3374 dump_generic_node (pp, t, spc, flags, false);
3377 if (VAR_P (t) && DECL_HARD_REGISTER (t))
3379 pp_string (pp, " __asm__ ");
3380 pp_left_paren (pp);
3381 dump_generic_node (pp, DECL_ASSEMBLER_NAME (t), spc, flags, false);
3382 pp_right_paren (pp);
3385 /* The initial value of a function serves to determine whether the function
3386 is declared or defined. So the following does not apply to function
3387 nodes. */
3388 if (TREE_CODE (t) != FUNCTION_DECL)
3390 /* Print the initial value. */
3391 if (DECL_INITIAL (t))
3393 pp_space (pp);
3394 pp_equal (pp);
3395 pp_space (pp);
3396 if (!(flags & TDF_SLIM))
3397 dump_generic_node (pp, DECL_INITIAL (t), spc, flags, false);
3398 else
3399 pp_string (pp, "<<< omitted >>>");
3403 if (VAR_P (t) && DECL_HAS_VALUE_EXPR_P (t))
3405 pp_string (pp, " [value-expr: ");
3406 dump_generic_node (pp, DECL_VALUE_EXPR (t), spc, flags, false);
3407 pp_right_bracket (pp);
3410 pp_semicolon (pp);
3414 /* Prints a structure: name, fields, and methods.
3415 FIXME: Still incomplete. */
3417 static void
3418 print_struct_decl (pretty_printer *pp, const_tree node, int spc,
3419 dump_flags_t flags)
3421 /* Print the name of the structure. */
3422 if (TYPE_NAME (node))
3424 INDENT (spc);
3425 if (TREE_CODE (node) == RECORD_TYPE)
3426 pp_string (pp, "struct ");
3427 else if ((TREE_CODE (node) == UNION_TYPE
3428 || TREE_CODE (node) == QUAL_UNION_TYPE))
3429 pp_string (pp, "union ");
3431 dump_generic_node (pp, TYPE_NAME (node), spc, TDF_NONE, false);
3434 /* Print the contents of the structure. */
3435 pp_newline (pp);
3436 INDENT (spc);
3437 pp_left_brace (pp);
3438 pp_newline (pp);
3440 /* Print the fields of the structure. */
3442 tree tmp;
3443 tmp = TYPE_FIELDS (node);
3444 while (tmp)
3446 /* Avoid to print recursively the structure. */
3447 /* FIXME : Not implemented correctly...,
3448 what about the case when we have a cycle in the contain graph? ...
3449 Maybe this could be solved by looking at the scope in which the
3450 structure was declared. */
3451 if (TREE_TYPE (tmp) != node
3452 && (TREE_CODE (TREE_TYPE (tmp)) != POINTER_TYPE
3453 || TREE_TYPE (TREE_TYPE (tmp)) != node))
3455 print_declaration (pp, tmp, spc+2, flags);
3456 pp_newline (pp);
3458 tmp = DECL_CHAIN (tmp);
3461 INDENT (spc);
3462 pp_right_brace (pp);
3465 /* Return the priority of the operator CODE.
3467 From lowest to highest precedence with either left-to-right (L-R)
3468 or right-to-left (R-L) associativity]:
3470 1 [L-R] ,
3471 2 [R-L] = += -= *= /= %= &= ^= |= <<= >>=
3472 3 [R-L] ?:
3473 4 [L-R] ||
3474 5 [L-R] &&
3475 6 [L-R] |
3476 7 [L-R] ^
3477 8 [L-R] &
3478 9 [L-R] == !=
3479 10 [L-R] < <= > >=
3480 11 [L-R] << >>
3481 12 [L-R] + -
3482 13 [L-R] * / %
3483 14 [R-L] ! ~ ++ -- + - * & (type) sizeof
3484 15 [L-R] fn() [] -> .
3486 unary +, - and * have higher precedence than the corresponding binary
3487 operators. */
3490 op_code_prio (enum tree_code code)
3492 switch (code)
3494 case TREE_LIST:
3495 case COMPOUND_EXPR:
3496 case BIND_EXPR:
3497 return 1;
3499 case MODIFY_EXPR:
3500 case INIT_EXPR:
3501 return 2;
3503 case COND_EXPR:
3504 return 3;
3506 case TRUTH_OR_EXPR:
3507 case TRUTH_ORIF_EXPR:
3508 return 4;
3510 case TRUTH_AND_EXPR:
3511 case TRUTH_ANDIF_EXPR:
3512 return 5;
3514 case BIT_IOR_EXPR:
3515 return 6;
3517 case BIT_XOR_EXPR:
3518 case TRUTH_XOR_EXPR:
3519 return 7;
3521 case BIT_AND_EXPR:
3522 return 8;
3524 case EQ_EXPR:
3525 case NE_EXPR:
3526 return 9;
3528 case UNLT_EXPR:
3529 case UNLE_EXPR:
3530 case UNGT_EXPR:
3531 case UNGE_EXPR:
3532 case UNEQ_EXPR:
3533 case LTGT_EXPR:
3534 case ORDERED_EXPR:
3535 case UNORDERED_EXPR:
3536 case LT_EXPR:
3537 case LE_EXPR:
3538 case GT_EXPR:
3539 case GE_EXPR:
3540 return 10;
3542 case LSHIFT_EXPR:
3543 case RSHIFT_EXPR:
3544 case LROTATE_EXPR:
3545 case RROTATE_EXPR:
3546 case VEC_WIDEN_LSHIFT_HI_EXPR:
3547 case VEC_WIDEN_LSHIFT_LO_EXPR:
3548 case WIDEN_LSHIFT_EXPR:
3549 return 11;
3551 case WIDEN_SUM_EXPR:
3552 case PLUS_EXPR:
3553 case POINTER_PLUS_EXPR:
3554 case POINTER_DIFF_EXPR:
3555 case MINUS_EXPR:
3556 return 12;
3558 case VEC_WIDEN_MULT_HI_EXPR:
3559 case VEC_WIDEN_MULT_LO_EXPR:
3560 case WIDEN_MULT_EXPR:
3561 case DOT_PROD_EXPR:
3562 case WIDEN_MULT_PLUS_EXPR:
3563 case WIDEN_MULT_MINUS_EXPR:
3564 case MULT_EXPR:
3565 case MULT_HIGHPART_EXPR:
3566 case TRUNC_DIV_EXPR:
3567 case CEIL_DIV_EXPR:
3568 case FLOOR_DIV_EXPR:
3569 case ROUND_DIV_EXPR:
3570 case RDIV_EXPR:
3571 case EXACT_DIV_EXPR:
3572 case TRUNC_MOD_EXPR:
3573 case CEIL_MOD_EXPR:
3574 case FLOOR_MOD_EXPR:
3575 case ROUND_MOD_EXPR:
3576 return 13;
3578 case TRUTH_NOT_EXPR:
3579 case BIT_NOT_EXPR:
3580 case POSTINCREMENT_EXPR:
3581 case POSTDECREMENT_EXPR:
3582 case PREINCREMENT_EXPR:
3583 case PREDECREMENT_EXPR:
3584 case NEGATE_EXPR:
3585 case INDIRECT_REF:
3586 case ADDR_EXPR:
3587 case FLOAT_EXPR:
3588 CASE_CONVERT:
3589 case FIX_TRUNC_EXPR:
3590 case TARGET_EXPR:
3591 return 14;
3593 case CALL_EXPR:
3594 case ARRAY_REF:
3595 case ARRAY_RANGE_REF:
3596 case COMPONENT_REF:
3597 return 15;
3599 /* Special expressions. */
3600 case MIN_EXPR:
3601 case MAX_EXPR:
3602 case ABS_EXPR:
3603 case REALPART_EXPR:
3604 case IMAGPART_EXPR:
3605 case VEC_UNPACK_HI_EXPR:
3606 case VEC_UNPACK_LO_EXPR:
3607 case VEC_UNPACK_FLOAT_HI_EXPR:
3608 case VEC_UNPACK_FLOAT_LO_EXPR:
3609 case VEC_UNPACK_FIX_TRUNC_HI_EXPR:
3610 case VEC_UNPACK_FIX_TRUNC_LO_EXPR:
3611 case VEC_PACK_TRUNC_EXPR:
3612 case VEC_PACK_SAT_EXPR:
3613 return 16;
3615 default:
3616 /* Return an arbitrarily high precedence to avoid surrounding single
3617 VAR_DECLs in ()s. */
3618 return 9999;
3622 /* Return the priority of the operator OP. */
3625 op_prio (const_tree op)
3627 enum tree_code code;
3629 if (op == NULL)
3630 return 9999;
3632 code = TREE_CODE (op);
3633 if (code == SAVE_EXPR || code == NON_LVALUE_EXPR)
3634 return op_prio (TREE_OPERAND (op, 0));
3636 return op_code_prio (code);
3639 /* Return the symbol associated with operator CODE. */
3641 const char *
3642 op_symbol_code (enum tree_code code)
3644 switch (code)
3646 case MODIFY_EXPR:
3647 return "=";
3649 case TRUTH_OR_EXPR:
3650 case TRUTH_ORIF_EXPR:
3651 return "||";
3653 case TRUTH_AND_EXPR:
3654 case TRUTH_ANDIF_EXPR:
3655 return "&&";
3657 case BIT_IOR_EXPR:
3658 return "|";
3660 case TRUTH_XOR_EXPR:
3661 case BIT_XOR_EXPR:
3662 return "^";
3664 case ADDR_EXPR:
3665 case BIT_AND_EXPR:
3666 return "&";
3668 case ORDERED_EXPR:
3669 return "ord";
3670 case UNORDERED_EXPR:
3671 return "unord";
3673 case EQ_EXPR:
3674 return "==";
3675 case UNEQ_EXPR:
3676 return "u==";
3678 case NE_EXPR:
3679 return "!=";
3681 case LT_EXPR:
3682 return "<";
3683 case UNLT_EXPR:
3684 return "u<";
3686 case LE_EXPR:
3687 return "<=";
3688 case UNLE_EXPR:
3689 return "u<=";
3691 case GT_EXPR:
3692 return ">";
3693 case UNGT_EXPR:
3694 return "u>";
3696 case GE_EXPR:
3697 return ">=";
3698 case UNGE_EXPR:
3699 return "u>=";
3701 case LTGT_EXPR:
3702 return "<>";
3704 case LSHIFT_EXPR:
3705 return "<<";
3707 case RSHIFT_EXPR:
3708 return ">>";
3710 case LROTATE_EXPR:
3711 return "r<<";
3713 case RROTATE_EXPR:
3714 return "r>>";
3716 case WIDEN_LSHIFT_EXPR:
3717 return "w<<";
3719 case POINTER_PLUS_EXPR:
3720 return "+";
3722 case PLUS_EXPR:
3723 return "+";
3725 case WIDEN_SUM_EXPR:
3726 return "w+";
3728 case WIDEN_MULT_EXPR:
3729 return "w*";
3731 case MULT_HIGHPART_EXPR:
3732 return "h*";
3734 case NEGATE_EXPR:
3735 case MINUS_EXPR:
3736 case POINTER_DIFF_EXPR:
3737 return "-";
3739 case BIT_NOT_EXPR:
3740 return "~";
3742 case TRUTH_NOT_EXPR:
3743 return "!";
3745 case MULT_EXPR:
3746 case INDIRECT_REF:
3747 return "*";
3749 case TRUNC_DIV_EXPR:
3750 case RDIV_EXPR:
3751 return "/";
3753 case CEIL_DIV_EXPR:
3754 return "/[cl]";
3756 case FLOOR_DIV_EXPR:
3757 return "/[fl]";
3759 case ROUND_DIV_EXPR:
3760 return "/[rd]";
3762 case EXACT_DIV_EXPR:
3763 return "/[ex]";
3765 case TRUNC_MOD_EXPR:
3766 return "%";
3768 case CEIL_MOD_EXPR:
3769 return "%[cl]";
3771 case FLOOR_MOD_EXPR:
3772 return "%[fl]";
3774 case ROUND_MOD_EXPR:
3775 return "%[rd]";
3777 case PREDECREMENT_EXPR:
3778 return " --";
3780 case PREINCREMENT_EXPR:
3781 return " ++";
3783 case POSTDECREMENT_EXPR:
3784 return "-- ";
3786 case POSTINCREMENT_EXPR:
3787 return "++ ";
3789 case MAX_EXPR:
3790 return "max";
3792 case MIN_EXPR:
3793 return "min";
3795 default:
3796 return "<<< ??? >>>";
3800 /* Return the symbol associated with operator OP. */
3802 static const char *
3803 op_symbol (const_tree op)
3805 return op_symbol_code (TREE_CODE (op));
3808 /* Prints the name of a call. NODE is the CALL_EXPR_FN of a CALL_EXPR or
3809 the gimple_call_fn of a GIMPLE_CALL. */
3811 void
3812 print_call_name (pretty_printer *pp, tree node, dump_flags_t flags)
3814 tree op0 = node;
3816 if (TREE_CODE (op0) == NON_LVALUE_EXPR)
3817 op0 = TREE_OPERAND (op0, 0);
3819 again:
3820 switch (TREE_CODE (op0))
3822 case VAR_DECL:
3823 case PARM_DECL:
3824 case FUNCTION_DECL:
3825 dump_function_name (pp, op0, flags);
3826 break;
3828 case ADDR_EXPR:
3829 case INDIRECT_REF:
3830 CASE_CONVERT:
3831 op0 = TREE_OPERAND (op0, 0);
3832 goto again;
3834 case COND_EXPR:
3835 pp_left_paren (pp);
3836 dump_generic_node (pp, TREE_OPERAND (op0, 0), 0, flags, false);
3837 pp_string (pp, ") ? ");
3838 dump_generic_node (pp, TREE_OPERAND (op0, 1), 0, flags, false);
3839 pp_string (pp, " : ");
3840 dump_generic_node (pp, TREE_OPERAND (op0, 2), 0, flags, false);
3841 break;
3843 case ARRAY_REF:
3844 if (TREE_CODE (TREE_OPERAND (op0, 0)) == VAR_DECL)
3845 dump_function_name (pp, TREE_OPERAND (op0, 0), flags);
3846 else
3847 dump_generic_node (pp, op0, 0, flags, false);
3848 break;
3850 case MEM_REF:
3851 if (integer_zerop (TREE_OPERAND (op0, 1)))
3853 op0 = TREE_OPERAND (op0, 0);
3854 goto again;
3856 /* Fallthru. */
3857 case COMPONENT_REF:
3858 case SSA_NAME:
3859 case OBJ_TYPE_REF:
3860 dump_generic_node (pp, op0, 0, flags, false);
3861 break;
3863 default:
3864 NIY;
3868 /* Parses the string STR and replaces new-lines by '\n', tabs by '\t', ... */
3870 static void
3871 pretty_print_string (pretty_printer *pp, const char *str)
3873 if (str == NULL)
3874 return;
3876 while (*str)
3878 switch (str[0])
3880 case '\b':
3881 pp_string (pp, "\\b");
3882 break;
3884 case '\f':
3885 pp_string (pp, "\\f");
3886 break;
3888 case '\n':
3889 pp_string (pp, "\\n");
3890 break;
3892 case '\r':
3893 pp_string (pp, "\\r");
3894 break;
3896 case '\t':
3897 pp_string (pp, "\\t");
3898 break;
3900 case '\v':
3901 pp_string (pp, "\\v");
3902 break;
3904 case '\\':
3905 pp_string (pp, "\\\\");
3906 break;
3908 case '\"':
3909 pp_string (pp, "\\\"");
3910 break;
3912 case '\'':
3913 pp_string (pp, "\\'");
3914 break;
3916 /* No need to handle \0; the loop terminates on \0. */
3918 case '\1':
3919 pp_string (pp, "\\1");
3920 break;
3922 case '\2':
3923 pp_string (pp, "\\2");
3924 break;
3926 case '\3':
3927 pp_string (pp, "\\3");
3928 break;
3930 case '\4':
3931 pp_string (pp, "\\4");
3932 break;
3934 case '\5':
3935 pp_string (pp, "\\5");
3936 break;
3938 case '\6':
3939 pp_string (pp, "\\6");
3940 break;
3942 case '\7':
3943 pp_string (pp, "\\7");
3944 break;
3946 default:
3947 if (!ISPRINT (str[0]))
3949 char buf[5];
3950 sprintf (buf, "\\x%x", (unsigned char)str[0]);
3951 pp_string (pp, buf);
3953 else
3954 pp_character (pp, str[0]);
3955 break;
3957 str++;
3961 static void
3962 maybe_init_pretty_print (FILE *file)
3964 if (!tree_pp)
3966 tree_pp = new pretty_printer ();
3967 pp_needs_newline (tree_pp) = true;
3968 pp_translate_identifiers (tree_pp) = false;
3971 tree_pp->buffer->stream = file;
3974 static void
3975 newline_and_indent (pretty_printer *pp, int spc)
3977 pp_newline (pp);
3978 INDENT (spc);
3981 /* Handle the %K format for TEXT. Separate from default_tree_printer
3982 so it can also be used in front ends.
3983 Argument is a statement from which EXPR_LOCATION and TREE_BLOCK will
3984 be recorded. */
3986 void
3987 percent_K_format (text_info *text, tree t)
3989 text->set_location (0, EXPR_LOCATION (t), true);
3990 gcc_assert (pp_ti_abstract_origin (text) != NULL);
3991 tree block = TREE_BLOCK (t);
3992 *pp_ti_abstract_origin (text) = NULL;
3994 if (in_lto_p)
3996 /* ??? LTO drops all BLOCK_ABSTRACT_ORIGINs apart from those
3997 representing the outermost block of an inlined function.
3998 So walk the BLOCK tree until we hit such a scope. */
3999 while (block
4000 && TREE_CODE (block) == BLOCK)
4002 if (inlined_function_outer_scope_p (block))
4004 *pp_ti_abstract_origin (text) = block;
4005 break;
4007 block = BLOCK_SUPERCONTEXT (block);
4009 return;
4012 while (block
4013 && TREE_CODE (block) == BLOCK
4014 && BLOCK_ABSTRACT_ORIGIN (block))
4016 tree ao = BLOCK_ABSTRACT_ORIGIN (block);
4018 while (TREE_CODE (ao) == BLOCK
4019 && BLOCK_ABSTRACT_ORIGIN (ao)
4020 && BLOCK_ABSTRACT_ORIGIN (ao) != ao)
4021 ao = BLOCK_ABSTRACT_ORIGIN (ao);
4023 if (TREE_CODE (ao) == FUNCTION_DECL)
4025 *pp_ti_abstract_origin (text) = block;
4026 break;
4028 block = BLOCK_SUPERCONTEXT (block);
4032 /* Print the identifier ID to PRETTY-PRINTER. */
4034 void
4035 pp_tree_identifier (pretty_printer *pp, tree id)
4037 if (pp_translate_identifiers (pp))
4039 const char *text = identifier_to_locale (IDENTIFIER_POINTER (id));
4040 pp_append_text (pp, text, text + strlen (text));
4042 else
4043 pp_append_text (pp, IDENTIFIER_POINTER (id),
4044 IDENTIFIER_POINTER (id) + IDENTIFIER_LENGTH (id));
4047 /* A helper function that is used to dump function information before the
4048 function dump. */
4050 void
4051 dump_function_header (FILE *dump_file, tree fdecl, dump_flags_t flags)
4053 const char *dname, *aname;
4054 struct cgraph_node *node = cgraph_node::get (fdecl);
4055 struct function *fun = DECL_STRUCT_FUNCTION (fdecl);
4057 dname = lang_hooks.decl_printable_name (fdecl, 1);
4059 if (DECL_ASSEMBLER_NAME_SET_P (fdecl))
4060 aname = (IDENTIFIER_POINTER
4061 (DECL_ASSEMBLER_NAME (fdecl)));
4062 else
4063 aname = "<unset-asm-name>";
4065 fprintf (dump_file, "\n;; Function %s (%s, funcdef_no=%d",
4066 dname, aname, fun->funcdef_no);
4067 if (!(flags & TDF_NOUID))
4068 fprintf (dump_file, ", decl_uid=%d", DECL_UID (fdecl));
4069 if (node)
4071 fprintf (dump_file, ", cgraph_uid=%d", node->get_uid ());
4072 fprintf (dump_file, ", symbol_order=%d)%s\n\n", node->order,
4073 node->frequency == NODE_FREQUENCY_HOT
4074 ? " (hot)"
4075 : node->frequency == NODE_FREQUENCY_UNLIKELY_EXECUTED
4076 ? " (unlikely executed)"
4077 : node->frequency == NODE_FREQUENCY_EXECUTED_ONCE
4078 ? " (executed once)"
4079 : "");
4081 else
4082 fprintf (dump_file, ")\n\n");
4085 /* Dump double_int D to pretty_printer PP. UNS is true
4086 if D is unsigned and false otherwise. */
4087 void
4088 pp_double_int (pretty_printer *pp, double_int d, bool uns)
4090 if (d.fits_shwi ())
4091 pp_wide_integer (pp, d.low);
4092 else if (d.fits_uhwi ())
4093 pp_unsigned_wide_integer (pp, d.low);
4094 else
4096 unsigned HOST_WIDE_INT low = d.low;
4097 HOST_WIDE_INT high = d.high;
4098 if (!uns && d.is_negative ())
4100 pp_minus (pp);
4101 high = ~high + !low;
4102 low = -low;
4104 /* Would "%x%0*x" or "%x%*0x" get zero-padding on all
4105 systems? */
4106 sprintf (pp_buffer (pp)->digit_buffer,
4107 HOST_WIDE_INT_PRINT_DOUBLE_HEX,
4108 (unsigned HOST_WIDE_INT) high, low);
4109 pp_string (pp, pp_buffer (pp)->digit_buffer);