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