Allow Objective-c++ to recognise lambdas.
[official-gcc.git] / gcc / tree-pretty-print.c
blob808c15d8768ed1a02735f00bba475d26365db773
1 /* Pretty formatting of GENERIC trees in C syntax.
2 Copyright (C) 2001-2014 Free Software Foundation, Inc.
3 Adapted from c-pretty-print.c by Diego Novillo <dnovillo@redhat.com>
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 3, or (at your option) any later
10 version.
12 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 for more details.
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING3. If not see
19 <http://www.gnu.org/licenses/>. */
21 #include "config.h"
22 #include "system.h"
23 #include "coretypes.h"
24 #include "tm.h"
25 #include "tree.h"
26 #include "stor-layout.h"
27 #include "expr.h"
28 #include "tree-pretty-print.h"
29 #include "hashtab.h"
30 #include "hash-set.h"
31 #include "gimple-expr.h"
32 #include "predict.h"
33 #include "hash-map.h"
34 #include "is-a.h"
35 #include "plugin-api.h"
36 #include "vec.h"
37 #include "machmode.h"
38 #include "hard-reg-set.h"
39 #include "input.h"
40 #include "function.h"
41 #include "ipa-ref.h"
42 #include "cgraph.h"
43 #include "langhooks.h"
44 #include "tree-iterator.h"
45 #include "tree-chrec.h"
46 #include "dumpfile.h"
47 #include "value-prof.h"
48 #include "wide-int-print.h"
49 #include "internal-fn.h"
51 /* Local functions, macros and variables. */
52 static const char *op_symbol (const_tree);
53 static void pretty_print_string (pretty_printer *, const char*);
54 static void newline_and_indent (pretty_printer *, int);
55 static void maybe_init_pretty_print (FILE *);
56 static void print_struct_decl (pretty_printer *, const_tree, int, int);
57 static void do_niy (pretty_printer *, const_tree);
59 #define INDENT(SPACE) do { \
60 int i; for (i = 0; i<SPACE; i++) pp_space (pp); } while (0)
62 #define NIY do_niy (pp, node)
64 static pretty_printer *tree_pp;
66 /* Try to print something for an unknown tree code. */
68 static void
69 do_niy (pretty_printer *pp, const_tree node)
71 int i, len;
73 pp_string (pp, "<<< Unknown tree: ");
74 pp_string (pp, get_tree_code_name (TREE_CODE (node)));
76 if (EXPR_P (node))
78 len = TREE_OPERAND_LENGTH (node);
79 for (i = 0; i < len; ++i)
81 newline_and_indent (pp, 2);
82 dump_generic_node (pp, TREE_OPERAND (node, i), 2, 0, false);
86 pp_string (pp, " >>>");
89 /* Debugging function to print out a generic expression. */
91 DEBUG_FUNCTION void
92 debug_generic_expr (tree t)
94 print_generic_expr (stderr, t, TDF_VOPS|TDF_MEMSYMS);
95 fprintf (stderr, "\n");
98 /* Debugging function to print out a generic statement. */
100 DEBUG_FUNCTION void
101 debug_generic_stmt (tree t)
103 print_generic_stmt (stderr, t, TDF_VOPS|TDF_MEMSYMS);
104 fprintf (stderr, "\n");
107 /* Debugging function to print out a chain of trees . */
109 DEBUG_FUNCTION void
110 debug_tree_chain (tree t)
112 hash_set<tree> seen;
114 while (t)
116 print_generic_expr (stderr, t, TDF_VOPS|TDF_MEMSYMS|TDF_UID);
117 fprintf (stderr, " ");
118 t = TREE_CHAIN (t);
119 if (seen.add (t))
121 fprintf (stderr, "... [cycled back to ");
122 print_generic_expr (stderr, t, TDF_VOPS|TDF_MEMSYMS|TDF_UID);
123 fprintf (stderr, "]");
124 break;
127 fprintf (stderr, "\n");
130 /* Prints declaration DECL to the FILE with details specified by FLAGS. */
131 void
132 print_generic_decl (FILE *file, tree decl, int flags)
134 maybe_init_pretty_print (file);
135 print_declaration (tree_pp, decl, 2, flags);
136 pp_write_text_to_stream (tree_pp);
139 /* Print tree T, and its successors, on file FILE. FLAGS specifies details
140 to show in the dump. See TDF_* in dumpfile.h. */
142 void
143 print_generic_stmt (FILE *file, tree t, int flags)
145 maybe_init_pretty_print (file);
146 dump_generic_node (tree_pp, t, 0, flags, true);
147 pp_newline_and_flush (tree_pp);
150 /* Print tree T, and its successors, on file FILE. FLAGS specifies details
151 to show in the dump. See TDF_* in dumpfile.h. The output is indented by
152 INDENT spaces. */
154 void
155 print_generic_stmt_indented (FILE *file, tree t, int flags, int indent)
157 int i;
159 maybe_init_pretty_print (file);
161 for (i = 0; i < indent; i++)
162 pp_space (tree_pp);
163 dump_generic_node (tree_pp, t, indent, flags, true);
164 pp_newline_and_flush (tree_pp);
167 /* Print a single expression T on file FILE. FLAGS specifies details to show
168 in the dump. See TDF_* in dumpfile.h. */
170 void
171 print_generic_expr (FILE *file, tree t, int flags)
173 maybe_init_pretty_print (file);
174 dump_generic_node (tree_pp, t, 0, flags, false);
175 pp_flush (tree_pp);
178 /* Dump the name of a _DECL node and its DECL_UID if TDF_UID is set
179 in FLAGS. */
181 static void
182 dump_decl_name (pretty_printer *pp, tree node, int flags)
184 if (DECL_NAME (node))
186 if ((flags & TDF_ASMNAME) && DECL_ASSEMBLER_NAME_SET_P (node))
187 pp_tree_identifier (pp, DECL_ASSEMBLER_NAME (node));
188 else
189 pp_tree_identifier (pp, DECL_NAME (node));
191 if ((flags & TDF_UID) || DECL_NAME (node) == NULL_TREE)
193 if (TREE_CODE (node) == LABEL_DECL && LABEL_DECL_UID (node) != -1)
194 pp_printf (pp, "L.%d", (int) LABEL_DECL_UID (node));
195 else if (TREE_CODE (node) == DEBUG_EXPR_DECL)
197 if (flags & TDF_NOUID)
198 pp_string (pp, "D#xxxx");
199 else
200 pp_printf (pp, "D#%i", DEBUG_TEMP_UID (node));
202 else
204 char c = TREE_CODE (node) == CONST_DECL ? 'C' : 'D';
205 if (flags & TDF_NOUID)
206 pp_printf (pp, "%c.xxxx", c);
207 else
208 pp_printf (pp, "%c.%u", c, DECL_UID (node));
211 if ((flags & TDF_ALIAS) && DECL_PT_UID (node) != DECL_UID (node))
213 if (flags & TDF_NOUID)
214 pp_printf (pp, "ptD.xxxx");
215 else
216 pp_printf (pp, "ptD.%u", DECL_PT_UID (node));
220 /* Like the above, but used for pretty printing function calls. */
222 static void
223 dump_function_name (pretty_printer *pp, tree node, int flags)
225 if (CONVERT_EXPR_P (node))
226 node = TREE_OPERAND (node, 0);
227 if (DECL_NAME (node) && (flags & TDF_ASMNAME) == 0)
228 pp_string (pp, lang_hooks.decl_printable_name (node, 1));
229 else
230 dump_decl_name (pp, node, flags);
233 /* Dump a function declaration. NODE is the FUNCTION_TYPE. PP, SPC and
234 FLAGS are as in dump_generic_node. */
236 static void
237 dump_function_declaration (pretty_printer *pp, tree node,
238 int spc, int flags)
240 bool wrote_arg = false;
241 tree arg;
243 pp_space (pp);
244 pp_left_paren (pp);
246 /* Print the argument types. */
247 arg = TYPE_ARG_TYPES (node);
248 while (arg && arg != void_list_node && arg != error_mark_node)
250 if (wrote_arg)
252 pp_comma (pp);
253 pp_space (pp);
255 wrote_arg = true;
256 dump_generic_node (pp, TREE_VALUE (arg), spc, flags, false);
257 arg = TREE_CHAIN (arg);
260 /* Drop the trailing void_type_node if we had any previous argument. */
261 if (arg == void_list_node && !wrote_arg)
262 pp_string (pp, "void");
263 /* Properly dump vararg function types. */
264 else if (!arg && wrote_arg)
265 pp_string (pp, ", ...");
266 /* Avoid printing any arg for unprototyped functions. */
268 pp_right_paren (pp);
271 /* Dump the domain associated with an array. */
273 static void
274 dump_array_domain (pretty_printer *pp, tree domain, int spc, int flags)
276 pp_left_bracket (pp);
277 if (domain)
279 tree min = TYPE_MIN_VALUE (domain);
280 tree max = TYPE_MAX_VALUE (domain);
282 if (min && max
283 && integer_zerop (min)
284 && tree_fits_shwi_p (max))
285 pp_wide_integer (pp, tree_to_shwi (max) + 1);
286 else
288 if (min)
289 dump_generic_node (pp, min, spc, flags, false);
290 pp_colon (pp);
291 if (max)
292 dump_generic_node (pp, max, spc, flags, false);
295 else
296 pp_string (pp, "<unknown>");
297 pp_right_bracket (pp);
301 /* Dump OpenMP clause CLAUSE. PP, CLAUSE, SPC and FLAGS are as in
302 dump_generic_node. */
304 static void
305 dump_omp_clause (pretty_printer *pp, tree clause, int spc, int flags)
307 const char *name;
309 switch (OMP_CLAUSE_CODE (clause))
311 case OMP_CLAUSE_PRIVATE:
312 name = "private";
313 goto print_remap;
314 case OMP_CLAUSE_SHARED:
315 name = "shared";
316 goto print_remap;
317 case OMP_CLAUSE_FIRSTPRIVATE:
318 name = "firstprivate";
319 goto print_remap;
320 case OMP_CLAUSE_LASTPRIVATE:
321 name = "lastprivate";
322 goto print_remap;
323 case OMP_CLAUSE_COPYIN:
324 name = "copyin";
325 goto print_remap;
326 case OMP_CLAUSE_COPYPRIVATE:
327 name = "copyprivate";
328 goto print_remap;
329 case OMP_CLAUSE_UNIFORM:
330 name = "uniform";
331 goto print_remap;
332 case OMP_CLAUSE__LOOPTEMP_:
333 name = "_looptemp_";
334 goto print_remap;
335 print_remap:
336 pp_string (pp, name);
337 pp_left_paren (pp);
338 dump_generic_node (pp, OMP_CLAUSE_DECL (clause),
339 spc, flags, false);
340 pp_right_paren (pp);
341 break;
343 case OMP_CLAUSE_REDUCTION:
344 pp_string (pp, "reduction(");
345 if (OMP_CLAUSE_REDUCTION_CODE (clause) != ERROR_MARK)
347 pp_string (pp,
348 op_symbol_code (OMP_CLAUSE_REDUCTION_CODE (clause)));
349 pp_colon (pp);
351 dump_generic_node (pp, OMP_CLAUSE_DECL (clause),
352 spc, flags, false);
353 pp_right_paren (pp);
354 break;
356 case OMP_CLAUSE_IF:
357 pp_string (pp, "if(");
358 dump_generic_node (pp, OMP_CLAUSE_IF_EXPR (clause),
359 spc, flags, false);
360 pp_right_paren (pp);
361 break;
363 case OMP_CLAUSE_NUM_THREADS:
364 pp_string (pp, "num_threads(");
365 dump_generic_node (pp, OMP_CLAUSE_NUM_THREADS_EXPR (clause),
366 spc, flags, false);
367 pp_right_paren (pp);
368 break;
370 case OMP_CLAUSE__CILK_FOR_COUNT_:
371 pp_string (pp, "_Cilk_for_count_(");
372 dump_generic_node (pp, OMP_CLAUSE_OPERAND (clause, 0),
373 spc, flags, false);
374 pp_right_paren (pp);
375 break;
377 case OMP_CLAUSE_NOWAIT:
378 pp_string (pp, "nowait");
379 break;
380 case OMP_CLAUSE_ORDERED:
381 pp_string (pp, "ordered");
382 break;
384 case OMP_CLAUSE_DEFAULT:
385 pp_string (pp, "default(");
386 switch (OMP_CLAUSE_DEFAULT_KIND (clause))
388 case OMP_CLAUSE_DEFAULT_UNSPECIFIED:
389 break;
390 case OMP_CLAUSE_DEFAULT_SHARED:
391 pp_string (pp, "shared");
392 break;
393 case OMP_CLAUSE_DEFAULT_NONE:
394 pp_string (pp, "none");
395 break;
396 case OMP_CLAUSE_DEFAULT_PRIVATE:
397 pp_string (pp, "private");
398 break;
399 case OMP_CLAUSE_DEFAULT_FIRSTPRIVATE:
400 pp_string (pp, "firstprivate");
401 break;
402 default:
403 gcc_unreachable ();
405 pp_right_paren (pp);
406 break;
408 case OMP_CLAUSE_SCHEDULE:
409 pp_string (pp, "schedule(");
410 switch (OMP_CLAUSE_SCHEDULE_KIND (clause))
412 case OMP_CLAUSE_SCHEDULE_STATIC:
413 pp_string (pp, "static");
414 break;
415 case OMP_CLAUSE_SCHEDULE_DYNAMIC:
416 pp_string (pp, "dynamic");
417 break;
418 case OMP_CLAUSE_SCHEDULE_GUIDED:
419 pp_string (pp, "guided");
420 break;
421 case OMP_CLAUSE_SCHEDULE_RUNTIME:
422 pp_string (pp, "runtime");
423 break;
424 case OMP_CLAUSE_SCHEDULE_AUTO:
425 pp_string (pp, "auto");
426 break;
427 case OMP_CLAUSE_SCHEDULE_CILKFOR:
428 pp_string (pp, "cilk-for grain");
429 break;
430 default:
431 gcc_unreachable ();
433 if (OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (clause))
435 pp_comma (pp);
436 dump_generic_node (pp, OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (clause),
437 spc, flags, false);
439 pp_right_paren (pp);
440 break;
442 case OMP_CLAUSE_UNTIED:
443 pp_string (pp, "untied");
444 break;
446 case OMP_CLAUSE_COLLAPSE:
447 pp_string (pp, "collapse(");
448 dump_generic_node (pp, OMP_CLAUSE_COLLAPSE_EXPR (clause),
449 spc, flags, false);
450 pp_right_paren (pp);
451 break;
453 case OMP_CLAUSE_FINAL:
454 pp_string (pp, "final(");
455 dump_generic_node (pp, OMP_CLAUSE_FINAL_EXPR (clause),
456 spc, flags, false);
457 pp_right_paren (pp);
458 break;
460 case OMP_CLAUSE_MERGEABLE:
461 pp_string (pp, "mergeable");
462 break;
464 case OMP_CLAUSE_LINEAR:
465 pp_string (pp, "linear(");
466 dump_generic_node (pp, OMP_CLAUSE_DECL (clause),
467 spc, flags, false);
468 pp_colon (pp);
469 dump_generic_node (pp, OMP_CLAUSE_LINEAR_STEP (clause),
470 spc, flags, false);
471 pp_right_paren (pp);
472 break;
474 case OMP_CLAUSE_ALIGNED:
475 pp_string (pp, "aligned(");
476 dump_generic_node (pp, OMP_CLAUSE_DECL (clause),
477 spc, flags, false);
478 if (OMP_CLAUSE_ALIGNED_ALIGNMENT (clause))
480 pp_colon (pp);
481 dump_generic_node (pp, OMP_CLAUSE_ALIGNED_ALIGNMENT (clause),
482 spc, flags, false);
484 pp_right_paren (pp);
485 break;
487 case OMP_CLAUSE_DEPEND:
488 pp_string (pp, "depend(");
489 switch (OMP_CLAUSE_DEPEND_KIND (clause))
491 case OMP_CLAUSE_DEPEND_IN:
492 pp_string (pp, "in");
493 break;
494 case OMP_CLAUSE_DEPEND_OUT:
495 pp_string (pp, "out");
496 break;
497 case OMP_CLAUSE_DEPEND_INOUT:
498 pp_string (pp, "inout");
499 break;
500 default:
501 gcc_unreachable ();
503 pp_colon (pp);
504 dump_generic_node (pp, OMP_CLAUSE_DECL (clause),
505 spc, flags, false);
506 pp_right_paren (pp);
507 break;
509 case OMP_CLAUSE_MAP:
510 pp_string (pp, "map(");
511 switch (OMP_CLAUSE_MAP_KIND (clause))
513 case OMP_CLAUSE_MAP_ALLOC:
514 case OMP_CLAUSE_MAP_POINTER:
515 pp_string (pp, "alloc");
516 break;
517 case OMP_CLAUSE_MAP_TO:
518 case OMP_CLAUSE_MAP_TO_PSET:
519 pp_string (pp, "to");
520 break;
521 case OMP_CLAUSE_MAP_FROM:
522 pp_string (pp, "from");
523 break;
524 case OMP_CLAUSE_MAP_TOFROM:
525 pp_string (pp, "tofrom");
526 break;
527 default:
528 gcc_unreachable ();
530 pp_colon (pp);
531 dump_generic_node (pp, OMP_CLAUSE_DECL (clause),
532 spc, flags, false);
533 print_clause_size:
534 if (OMP_CLAUSE_SIZE (clause))
536 if (OMP_CLAUSE_CODE (clause) == OMP_CLAUSE_MAP
537 && OMP_CLAUSE_MAP_KIND (clause) == OMP_CLAUSE_MAP_POINTER)
538 pp_string (pp, " [pointer assign, bias: ");
539 else if (OMP_CLAUSE_CODE (clause) == OMP_CLAUSE_MAP
540 && OMP_CLAUSE_MAP_KIND (clause) == OMP_CLAUSE_MAP_TO_PSET)
541 pp_string (pp, " [pointer set, len: ");
542 else
543 pp_string (pp, " [len: ");
544 dump_generic_node (pp, OMP_CLAUSE_SIZE (clause),
545 spc, flags, false);
546 pp_right_bracket (pp);
548 pp_right_paren (pp);
549 break;
551 case OMP_CLAUSE_FROM:
552 pp_string (pp, "from(");
553 dump_generic_node (pp, OMP_CLAUSE_DECL (clause),
554 spc, flags, false);
555 goto print_clause_size;
557 case OMP_CLAUSE_TO:
558 pp_string (pp, "to(");
559 dump_generic_node (pp, OMP_CLAUSE_DECL (clause),
560 spc, flags, false);
561 goto print_clause_size;
563 case OMP_CLAUSE_NUM_TEAMS:
564 pp_string (pp, "num_teams(");
565 dump_generic_node (pp, OMP_CLAUSE_NUM_TEAMS_EXPR (clause),
566 spc, flags, false);
567 pp_right_paren (pp);
568 break;
570 case OMP_CLAUSE_THREAD_LIMIT:
571 pp_string (pp, "thread_limit(");
572 dump_generic_node (pp, OMP_CLAUSE_THREAD_LIMIT_EXPR (clause),
573 spc, flags, false);
574 pp_right_paren (pp);
575 break;
577 case OMP_CLAUSE_DEVICE:
578 pp_string (pp, "device(");
579 dump_generic_node (pp, OMP_CLAUSE_DEVICE_ID (clause),
580 spc, flags, false);
581 pp_right_paren (pp);
582 break;
584 case OMP_CLAUSE_DIST_SCHEDULE:
585 pp_string (pp, "dist_schedule(static");
586 if (OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR (clause))
588 pp_comma (pp);
589 dump_generic_node (pp,
590 OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR (clause),
591 spc, flags, false);
593 pp_right_paren (pp);
594 break;
596 case OMP_CLAUSE_PROC_BIND:
597 pp_string (pp, "proc_bind(");
598 switch (OMP_CLAUSE_PROC_BIND_KIND (clause))
600 case OMP_CLAUSE_PROC_BIND_MASTER:
601 pp_string (pp, "master");
602 break;
603 case OMP_CLAUSE_PROC_BIND_CLOSE:
604 pp_string (pp, "close");
605 break;
606 case OMP_CLAUSE_PROC_BIND_SPREAD:
607 pp_string (pp, "spread");
608 break;
609 default:
610 gcc_unreachable ();
612 pp_right_paren (pp);
613 break;
615 case OMP_CLAUSE_SAFELEN:
616 pp_string (pp, "safelen(");
617 dump_generic_node (pp, OMP_CLAUSE_SAFELEN_EXPR (clause),
618 spc, flags, false);
619 pp_right_paren (pp);
620 break;
622 case OMP_CLAUSE_SIMDLEN:
623 pp_string (pp, "simdlen(");
624 dump_generic_node (pp, OMP_CLAUSE_SIMDLEN_EXPR (clause),
625 spc, flags, false);
626 pp_right_paren (pp);
627 break;
629 case OMP_CLAUSE__SIMDUID_:
630 pp_string (pp, "_simduid_(");
631 dump_generic_node (pp, OMP_CLAUSE__SIMDUID__DECL (clause),
632 spc, flags, false);
633 pp_right_paren (pp);
634 break;
636 case OMP_CLAUSE_INBRANCH:
637 pp_string (pp, "inbranch");
638 break;
639 case OMP_CLAUSE_NOTINBRANCH:
640 pp_string (pp, "notinbranch");
641 break;
642 case OMP_CLAUSE_FOR:
643 pp_string (pp, "for");
644 break;
645 case OMP_CLAUSE_PARALLEL:
646 pp_string (pp, "parallel");
647 break;
648 case OMP_CLAUSE_SECTIONS:
649 pp_string (pp, "sections");
650 break;
651 case OMP_CLAUSE_TASKGROUP:
652 pp_string (pp, "taskgroup");
653 break;
655 default:
656 /* Should never happen. */
657 dump_generic_node (pp, clause, spc, flags, false);
658 break;
663 /* Dump the list of OpenMP clauses. PP, SPC and FLAGS are as in
664 dump_generic_node. */
666 void
667 dump_omp_clauses (pretty_printer *pp, tree clause, int spc, int flags)
669 if (clause == NULL)
670 return;
672 pp_space (pp);
673 while (1)
675 dump_omp_clause (pp, clause, spc, flags);
676 clause = OMP_CLAUSE_CHAIN (clause);
677 if (clause == NULL)
678 return;
679 pp_space (pp);
684 /* Dump location LOC to PP. */
686 void
687 dump_location (pretty_printer *pp, location_t loc)
689 expanded_location xloc = expand_location (loc);
691 pp_left_bracket (pp);
692 if (xloc.file)
694 pp_string (pp, xloc.file);
695 pp_string (pp, ":");
697 pp_decimal_int (pp, xloc.line);
698 pp_colon (pp);
699 pp_decimal_int (pp, xloc.column);
700 pp_string (pp, "] ");
704 /* Dump lexical block BLOCK. PP, SPC and FLAGS are as in
705 dump_generic_node. */
707 static void
708 dump_block_node (pretty_printer *pp, tree block, int spc, int flags)
710 tree t;
712 pp_printf (pp, "BLOCK #%d ", BLOCK_NUMBER (block));
714 if (flags & TDF_ADDRESS)
715 pp_printf (pp, "[%p] ", (void *) block);
717 if (BLOCK_ABSTRACT (block))
718 pp_string (pp, "[abstract] ");
720 if (TREE_ASM_WRITTEN (block))
721 pp_string (pp, "[written] ");
723 if (flags & TDF_SLIM)
724 return;
726 if (BLOCK_SOURCE_LOCATION (block))
727 dump_location (pp, BLOCK_SOURCE_LOCATION (block));
729 newline_and_indent (pp, spc + 2);
731 if (BLOCK_SUPERCONTEXT (block))
733 pp_string (pp, "SUPERCONTEXT: ");
734 dump_generic_node (pp, BLOCK_SUPERCONTEXT (block), 0,
735 flags | TDF_SLIM, false);
736 newline_and_indent (pp, spc + 2);
739 if (BLOCK_SUBBLOCKS (block))
741 pp_string (pp, "SUBBLOCKS: ");
742 for (t = BLOCK_SUBBLOCKS (block); t; t = BLOCK_CHAIN (t))
744 dump_generic_node (pp, t, 0, flags | TDF_SLIM, false);
745 pp_space (pp);
747 newline_and_indent (pp, spc + 2);
750 if (BLOCK_CHAIN (block))
752 pp_string (pp, "SIBLINGS: ");
753 for (t = BLOCK_CHAIN (block); t; t = BLOCK_CHAIN (t))
755 dump_generic_node (pp, t, 0, flags | TDF_SLIM, false);
756 pp_space (pp);
758 newline_and_indent (pp, spc + 2);
761 if (BLOCK_VARS (block))
763 pp_string (pp, "VARS: ");
764 for (t = BLOCK_VARS (block); t; t = TREE_CHAIN (t))
766 dump_generic_node (pp, t, 0, flags, false);
767 pp_space (pp);
769 newline_and_indent (pp, spc + 2);
772 if (vec_safe_length (BLOCK_NONLOCALIZED_VARS (block)) > 0)
774 unsigned i;
775 vec<tree, va_gc> *nlv = BLOCK_NONLOCALIZED_VARS (block);
777 pp_string (pp, "NONLOCALIZED_VARS: ");
778 FOR_EACH_VEC_ELT (*nlv, i, t)
780 dump_generic_node (pp, t, 0, flags, false);
781 pp_space (pp);
783 newline_and_indent (pp, spc + 2);
786 if (BLOCK_ABSTRACT_ORIGIN (block))
788 pp_string (pp, "ABSTRACT_ORIGIN: ");
789 dump_generic_node (pp, BLOCK_ABSTRACT_ORIGIN (block), 0,
790 flags | TDF_SLIM, false);
791 newline_and_indent (pp, spc + 2);
794 if (BLOCK_FRAGMENT_ORIGIN (block))
796 pp_string (pp, "FRAGMENT_ORIGIN: ");
797 dump_generic_node (pp, BLOCK_FRAGMENT_ORIGIN (block), 0,
798 flags | TDF_SLIM, false);
799 newline_and_indent (pp, spc + 2);
802 if (BLOCK_FRAGMENT_CHAIN (block))
804 pp_string (pp, "FRAGMENT_CHAIN: ");
805 for (t = BLOCK_FRAGMENT_CHAIN (block); t; t = BLOCK_FRAGMENT_CHAIN (t))
807 dump_generic_node (pp, t, 0, flags | TDF_SLIM, false);
808 pp_space (pp);
810 newline_and_indent (pp, spc + 2);
815 /* Dump the node NODE on the pretty_printer PP, SPC spaces of
816 indent. FLAGS specifies details to show in the dump (see TDF_* in
817 dumpfile.h). If IS_STMT is true, the object printed is considered
818 to be a statement and it is terminated by ';' if appropriate. */
821 dump_generic_node (pretty_printer *pp, tree node, int spc, int flags,
822 bool is_stmt)
824 tree type;
825 tree op0, op1;
826 const char *str;
827 bool is_expr;
828 enum tree_code code;
830 if (node == NULL_TREE)
831 return spc;
833 is_expr = EXPR_P (node);
835 if (is_stmt && (flags & TDF_STMTADDR))
836 pp_printf (pp, "<&%p> ", (void *)node);
838 if ((flags & TDF_LINENO) && EXPR_HAS_LOCATION (node))
839 dump_location (pp, EXPR_LOCATION (node));
841 code = TREE_CODE (node);
842 switch (code)
844 case ERROR_MARK:
845 pp_string (pp, "<<< error >>>");
846 break;
848 case IDENTIFIER_NODE:
849 pp_tree_identifier (pp, node);
850 break;
852 case TREE_LIST:
853 while (node && node != error_mark_node)
855 if (TREE_PURPOSE (node))
857 dump_generic_node (pp, TREE_PURPOSE (node), spc, flags, false);
858 pp_space (pp);
860 dump_generic_node (pp, TREE_VALUE (node), spc, flags, false);
861 node = TREE_CHAIN (node);
862 if (node && TREE_CODE (node) == TREE_LIST)
864 pp_comma (pp);
865 pp_space (pp);
868 break;
870 case TREE_BINFO:
871 dump_generic_node (pp, BINFO_TYPE (node), spc, flags, false);
872 break;
874 case TREE_VEC:
876 size_t i;
877 if (TREE_VEC_LENGTH (node) > 0)
879 size_t len = TREE_VEC_LENGTH (node);
880 for (i = 0; i < len - 1; i++)
882 dump_generic_node (pp, TREE_VEC_ELT (node, i), spc, flags,
883 false);
884 pp_comma (pp);
885 pp_space (pp);
887 dump_generic_node (pp, TREE_VEC_ELT (node, len - 1), spc,
888 flags, false);
891 break;
893 case VOID_TYPE:
894 case POINTER_BOUNDS_TYPE:
895 case INTEGER_TYPE:
896 case REAL_TYPE:
897 case FIXED_POINT_TYPE:
898 case COMPLEX_TYPE:
899 case VECTOR_TYPE:
900 case ENUMERAL_TYPE:
901 case BOOLEAN_TYPE:
903 unsigned int quals = TYPE_QUALS (node);
904 enum tree_code_class tclass;
906 if (quals & TYPE_QUAL_ATOMIC)
907 pp_string (pp, "atomic ");
908 if (quals & TYPE_QUAL_CONST)
909 pp_string (pp, "const ");
910 else if (quals & TYPE_QUAL_VOLATILE)
911 pp_string (pp, "volatile ");
912 else if (quals & TYPE_QUAL_RESTRICT)
913 pp_string (pp, "restrict ");
915 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node)))
917 pp_string (pp, "<address-space-");
918 pp_decimal_int (pp, TYPE_ADDR_SPACE (node));
919 pp_string (pp, "> ");
922 tclass = TREE_CODE_CLASS (TREE_CODE (node));
924 if (tclass == tcc_declaration)
926 if (DECL_NAME (node))
927 dump_decl_name (pp, node, flags);
928 else
929 pp_string (pp, "<unnamed type decl>");
931 else if (tclass == tcc_type)
933 if (TYPE_NAME (node))
935 if (TREE_CODE (TYPE_NAME (node)) == IDENTIFIER_NODE)
936 pp_tree_identifier (pp, TYPE_NAME (node));
937 else if (TREE_CODE (TYPE_NAME (node)) == TYPE_DECL
938 && DECL_NAME (TYPE_NAME (node)))
939 dump_decl_name (pp, TYPE_NAME (node), flags);
940 else
941 pp_string (pp, "<unnamed type>");
943 else if (TREE_CODE (node) == VECTOR_TYPE)
945 pp_string (pp, "vector");
946 pp_left_paren (pp);
947 pp_wide_integer (pp, TYPE_VECTOR_SUBPARTS (node));
948 pp_string (pp, ") ");
949 dump_generic_node (pp, TREE_TYPE (node), spc, flags, false);
951 else if (TREE_CODE (node) == INTEGER_TYPE)
953 if (TYPE_PRECISION (node) == CHAR_TYPE_SIZE)
954 pp_string (pp, (TYPE_UNSIGNED (node)
955 ? "unsigned char"
956 : "signed char"));
957 else if (TYPE_PRECISION (node) == SHORT_TYPE_SIZE)
958 pp_string (pp, (TYPE_UNSIGNED (node)
959 ? "unsigned short"
960 : "signed short"));
961 else if (TYPE_PRECISION (node) == INT_TYPE_SIZE)
962 pp_string (pp, (TYPE_UNSIGNED (node)
963 ? "unsigned int"
964 : "signed int"));
965 else if (TYPE_PRECISION (node) == LONG_TYPE_SIZE)
966 pp_string (pp, (TYPE_UNSIGNED (node)
967 ? "unsigned long"
968 : "signed long"));
969 else if (TYPE_PRECISION (node) == LONG_LONG_TYPE_SIZE)
970 pp_string (pp, (TYPE_UNSIGNED (node)
971 ? "unsigned long long"
972 : "signed long long"));
973 else if (TYPE_PRECISION (node) >= CHAR_TYPE_SIZE
974 && exact_log2 (TYPE_PRECISION (node)) != -1)
976 pp_string (pp, (TYPE_UNSIGNED (node) ? "uint" : "int"));
977 pp_decimal_int (pp, TYPE_PRECISION (node));
978 pp_string (pp, "_t");
980 else
982 pp_string (pp, (TYPE_UNSIGNED (node)
983 ? "<unnamed-unsigned:"
984 : "<unnamed-signed:"));
985 pp_decimal_int (pp, TYPE_PRECISION (node));
986 pp_greater (pp);
989 else if (TREE_CODE (node) == COMPLEX_TYPE)
991 pp_string (pp, "__complex__ ");
992 dump_generic_node (pp, TREE_TYPE (node), spc, flags, false);
994 else if (TREE_CODE (node) == REAL_TYPE)
996 pp_string (pp, "<float:");
997 pp_decimal_int (pp, TYPE_PRECISION (node));
998 pp_greater (pp);
1000 else if (TREE_CODE (node) == FIXED_POINT_TYPE)
1002 pp_string (pp, "<fixed-point-");
1003 pp_string (pp, TYPE_SATURATING (node) ? "sat:" : "nonsat:");
1004 pp_decimal_int (pp, TYPE_PRECISION (node));
1005 pp_greater (pp);
1007 else if (TREE_CODE (node) == VOID_TYPE)
1008 pp_string (pp, "void");
1009 else
1010 pp_string (pp, "<unnamed type>");
1012 break;
1015 case POINTER_TYPE:
1016 case REFERENCE_TYPE:
1017 str = (TREE_CODE (node) == POINTER_TYPE ? "*" : "&");
1019 if (TREE_TYPE (node) == NULL)
1021 pp_string (pp, str);
1022 pp_string (pp, "<null type>");
1024 else if (TREE_CODE (TREE_TYPE (node)) == FUNCTION_TYPE)
1026 tree fnode = TREE_TYPE (node);
1028 dump_generic_node (pp, TREE_TYPE (fnode), spc, flags, false);
1029 pp_space (pp);
1030 pp_left_paren (pp);
1031 pp_string (pp, str);
1032 if (TYPE_NAME (node) && DECL_NAME (TYPE_NAME (node)))
1033 dump_decl_name (pp, TYPE_NAME (node), flags);
1034 else if (flags & TDF_NOUID)
1035 pp_printf (pp, "<Txxxx>");
1036 else
1037 pp_printf (pp, "<T%x>", TYPE_UID (node));
1039 pp_right_paren (pp);
1040 dump_function_declaration (pp, fnode, spc, flags);
1042 else
1044 unsigned int quals = TYPE_QUALS (node);
1046 dump_generic_node (pp, TREE_TYPE (node), spc, flags, false);
1047 pp_space (pp);
1048 pp_string (pp, str);
1050 if (quals & TYPE_QUAL_CONST)
1051 pp_string (pp, " const");
1052 if (quals & TYPE_QUAL_VOLATILE)
1053 pp_string (pp, " volatile");
1054 if (quals & TYPE_QUAL_RESTRICT)
1055 pp_string (pp, " restrict");
1057 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node)))
1059 pp_string (pp, " <address-space-");
1060 pp_decimal_int (pp, TYPE_ADDR_SPACE (node));
1061 pp_greater (pp);
1064 if (TYPE_REF_CAN_ALIAS_ALL (node))
1065 pp_string (pp, " {ref-all}");
1067 break;
1069 case OFFSET_TYPE:
1070 NIY;
1071 break;
1073 case MEM_REF:
1075 if (integer_zerop (TREE_OPERAND (node, 1))
1076 /* Dump the types of INTEGER_CSTs explicitly, for we can't
1077 infer them and MEM_ATTR caching will share MEM_REFs
1078 with differently-typed op0s. */
1079 && TREE_CODE (TREE_OPERAND (node, 0)) != INTEGER_CST
1080 /* Released SSA_NAMES have no TREE_TYPE. */
1081 && TREE_TYPE (TREE_OPERAND (node, 0)) != NULL_TREE
1082 /* Same pointer types, but ignoring POINTER_TYPE vs.
1083 REFERENCE_TYPE. */
1084 && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node, 0)))
1085 == TREE_TYPE (TREE_TYPE (TREE_OPERAND (node, 1))))
1086 && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (node, 0)))
1087 == TYPE_MODE (TREE_TYPE (TREE_OPERAND (node, 1))))
1088 && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node, 0)))
1089 == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node, 1))))
1090 /* Same value types ignoring qualifiers. */
1091 && (TYPE_MAIN_VARIANT (TREE_TYPE (node))
1092 == TYPE_MAIN_VARIANT
1093 (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node, 1)))))
1094 && (!(flags & TDF_ALIAS)
1095 || MR_DEPENDENCE_CLIQUE (node) == 0))
1097 if (TREE_CODE (TREE_OPERAND (node, 0)) != ADDR_EXPR)
1099 pp_star (pp);
1100 dump_generic_node (pp, TREE_OPERAND (node, 0),
1101 spc, flags, false);
1103 else
1104 dump_generic_node (pp,
1105 TREE_OPERAND (TREE_OPERAND (node, 0), 0),
1106 spc, flags, false);
1108 else
1110 tree ptype;
1112 pp_string (pp, "MEM[");
1113 pp_left_paren (pp);
1114 ptype = TYPE_MAIN_VARIANT (TREE_TYPE (TREE_OPERAND (node, 1)));
1115 dump_generic_node (pp, ptype,
1116 spc, flags | TDF_SLIM, false);
1117 pp_right_paren (pp);
1118 dump_generic_node (pp, TREE_OPERAND (node, 0),
1119 spc, flags, false);
1120 if (!integer_zerop (TREE_OPERAND (node, 1)))
1122 pp_string (pp, " + ");
1123 dump_generic_node (pp, TREE_OPERAND (node, 1),
1124 spc, flags, false);
1126 if ((flags & TDF_ALIAS)
1127 && MR_DEPENDENCE_CLIQUE (node) != 0)
1129 pp_string (pp, " clique ");
1130 pp_unsigned_wide_integer (pp, MR_DEPENDENCE_CLIQUE (node));
1131 pp_string (pp, " base ");
1132 pp_unsigned_wide_integer (pp, MR_DEPENDENCE_BASE (node));
1134 pp_right_bracket (pp);
1136 break;
1139 case TARGET_MEM_REF:
1141 const char *sep = "";
1142 tree tmp;
1144 pp_string (pp, "MEM[");
1146 if (TREE_CODE (TMR_BASE (node)) == ADDR_EXPR)
1148 pp_string (pp, sep);
1149 sep = ", ";
1150 pp_string (pp, "symbol: ");
1151 dump_generic_node (pp, TREE_OPERAND (TMR_BASE (node), 0),
1152 spc, flags, false);
1154 else
1156 pp_string (pp, sep);
1157 sep = ", ";
1158 pp_string (pp, "base: ");
1159 dump_generic_node (pp, TMR_BASE (node), spc, flags, false);
1161 tmp = TMR_INDEX2 (node);
1162 if (tmp)
1164 pp_string (pp, sep);
1165 sep = ", ";
1166 pp_string (pp, "base: ");
1167 dump_generic_node (pp, tmp, spc, flags, false);
1169 tmp = TMR_INDEX (node);
1170 if (tmp)
1172 pp_string (pp, sep);
1173 sep = ", ";
1174 pp_string (pp, "index: ");
1175 dump_generic_node (pp, tmp, spc, flags, false);
1177 tmp = TMR_STEP (node);
1178 if (tmp)
1180 pp_string (pp, sep);
1181 sep = ", ";
1182 pp_string (pp, "step: ");
1183 dump_generic_node (pp, tmp, spc, flags, false);
1185 tmp = TMR_OFFSET (node);
1186 if (tmp)
1188 pp_string (pp, sep);
1189 sep = ", ";
1190 pp_string (pp, "offset: ");
1191 dump_generic_node (pp, tmp, spc, flags, false);
1193 pp_right_bracket (pp);
1195 break;
1197 case ARRAY_TYPE:
1199 tree tmp;
1201 /* Print the innermost component type. */
1202 for (tmp = TREE_TYPE (node); TREE_CODE (tmp) == ARRAY_TYPE;
1203 tmp = TREE_TYPE (tmp))
1205 dump_generic_node (pp, tmp, spc, flags, false);
1207 /* Print the dimensions. */
1208 for (tmp = node; TREE_CODE (tmp) == ARRAY_TYPE; tmp = TREE_TYPE (tmp))
1209 dump_array_domain (pp, TYPE_DOMAIN (tmp), spc, flags);
1210 break;
1213 case RECORD_TYPE:
1214 case UNION_TYPE:
1215 case QUAL_UNION_TYPE:
1217 unsigned int quals = TYPE_QUALS (node);
1219 if (quals & TYPE_QUAL_ATOMIC)
1220 pp_string (pp, "atomic ");
1221 if (quals & TYPE_QUAL_CONST)
1222 pp_string (pp, "const ");
1223 if (quals & TYPE_QUAL_VOLATILE)
1224 pp_string (pp, "volatile ");
1226 /* Print the name of the structure. */
1227 if (TREE_CODE (node) == RECORD_TYPE)
1228 pp_string (pp, "struct ");
1229 else if (TREE_CODE (node) == UNION_TYPE)
1230 pp_string (pp, "union ");
1232 if (TYPE_NAME (node))
1233 dump_generic_node (pp, TYPE_NAME (node), spc, flags, false);
1234 else if (!(flags & TDF_SLIM))
1235 /* FIXME: If we eliminate the 'else' above and attempt
1236 to show the fields for named types, we may get stuck
1237 following a cycle of pointers to structs. The alleged
1238 self-reference check in print_struct_decl will not detect
1239 cycles involving more than one pointer or struct type. */
1240 print_struct_decl (pp, node, spc, flags);
1241 break;
1244 case LANG_TYPE:
1245 NIY;
1246 break;
1248 case INTEGER_CST:
1249 if (TREE_CODE (TREE_TYPE (node)) == POINTER_TYPE)
1251 /* In the case of a pointer, one may want to divide by the
1252 size of the pointed-to type. Unfortunately, this not
1253 straightforward. The C front-end maps expressions
1255 (int *) 5
1256 int *p; (p + 5)
1258 in such a way that the two INTEGER_CST nodes for "5" have
1259 different values but identical types. In the latter
1260 case, the 5 is multiplied by sizeof (int) in c-common.c
1261 (pointer_int_sum) to convert it to a byte address, and
1262 yet the type of the node is left unchanged. Argh. What
1263 is consistent though is that the number value corresponds
1264 to bytes (UNITS) offset.
1266 NB: Neither of the following divisors can be trivially
1267 used to recover the original literal:
1269 TREE_INT_CST_LOW (TYPE_SIZE_UNIT (TREE_TYPE (node)))
1270 TYPE_PRECISION (TREE_TYPE (TREE_TYPE (node))) */
1271 pp_wide_integer (pp, TREE_INT_CST_LOW (node));
1272 pp_string (pp, "B"); /* pseudo-unit */
1274 else if (tree_fits_shwi_p (node))
1275 pp_wide_integer (pp, tree_to_shwi (node));
1276 else if (tree_fits_uhwi_p (node))
1277 pp_unsigned_wide_integer (pp, tree_to_uhwi (node));
1278 else
1280 wide_int val = node;
1282 if (wi::neg_p (val, TYPE_SIGN (TREE_TYPE (node))))
1284 pp_minus (pp);
1285 val = -val;
1287 print_hex (val, pp_buffer (pp)->digit_buffer);
1288 pp_string (pp, pp_buffer (pp)->digit_buffer);
1290 if (TREE_OVERFLOW (node))
1291 pp_string (pp, "(OVF)");
1292 break;
1294 case REAL_CST:
1295 /* Code copied from print_node. */
1297 REAL_VALUE_TYPE d;
1298 if (TREE_OVERFLOW (node))
1299 pp_string (pp, " overflow");
1301 #if !defined(REAL_IS_NOT_DOUBLE) || defined(REAL_ARITHMETIC)
1302 d = TREE_REAL_CST (node);
1303 if (REAL_VALUE_ISINF (d))
1304 pp_string (pp, REAL_VALUE_NEGATIVE (d) ? " -Inf" : " Inf");
1305 else if (REAL_VALUE_ISNAN (d))
1306 pp_string (pp, " Nan");
1307 else
1309 char string[100];
1310 real_to_decimal (string, &d, sizeof (string), 0, 1);
1311 pp_string (pp, string);
1313 #else
1315 HOST_WIDE_INT i;
1316 unsigned char *p = (unsigned char *) &TREE_REAL_CST (node);
1317 pp_string (pp, "0x");
1318 for (i = 0; i < sizeof TREE_REAL_CST (node); i++)
1319 output_formatted_integer (pp, "%02x", *p++);
1321 #endif
1322 break;
1325 case FIXED_CST:
1327 char string[100];
1328 fixed_to_decimal (string, TREE_FIXED_CST_PTR (node), sizeof (string));
1329 pp_string (pp, string);
1330 break;
1333 case COMPLEX_CST:
1334 pp_string (pp, "__complex__ (");
1335 dump_generic_node (pp, TREE_REALPART (node), spc, flags, false);
1336 pp_string (pp, ", ");
1337 dump_generic_node (pp, TREE_IMAGPART (node), spc, flags, false);
1338 pp_right_paren (pp);
1339 break;
1341 case STRING_CST:
1342 pp_string (pp, "\"");
1343 pretty_print_string (pp, TREE_STRING_POINTER (node));
1344 pp_string (pp, "\"");
1345 break;
1347 case VECTOR_CST:
1349 unsigned i;
1350 pp_string (pp, "{ ");
1351 for (i = 0; i < VECTOR_CST_NELTS (node); ++i)
1353 if (i != 0)
1354 pp_string (pp, ", ");
1355 dump_generic_node (pp, VECTOR_CST_ELT (node, i),
1356 spc, flags, false);
1358 pp_string (pp, " }");
1360 break;
1362 case FUNCTION_TYPE:
1363 case METHOD_TYPE:
1364 dump_generic_node (pp, TREE_TYPE (node), spc, flags, false);
1365 pp_space (pp);
1366 if (TREE_CODE (node) == METHOD_TYPE)
1368 if (TYPE_METHOD_BASETYPE (node))
1369 dump_decl_name (pp, TYPE_NAME (TYPE_METHOD_BASETYPE (node)),
1370 flags);
1371 else
1372 pp_string (pp, "<null method basetype>");
1373 pp_colon_colon (pp);
1375 if (TYPE_NAME (node) && DECL_NAME (TYPE_NAME (node)))
1376 dump_decl_name (pp, TYPE_NAME (node), flags);
1377 else if (flags & TDF_NOUID)
1378 pp_printf (pp, "<Txxxx>");
1379 else
1380 pp_printf (pp, "<T%x>", TYPE_UID (node));
1381 dump_function_declaration (pp, node, spc, flags);
1382 break;
1384 case FUNCTION_DECL:
1385 case CONST_DECL:
1386 dump_decl_name (pp, node, flags);
1387 break;
1389 case LABEL_DECL:
1390 if (DECL_NAME (node))
1391 dump_decl_name (pp, node, flags);
1392 else if (LABEL_DECL_UID (node) != -1)
1393 pp_printf (pp, "<L%d>", (int) LABEL_DECL_UID (node));
1394 else
1396 if (flags & TDF_NOUID)
1397 pp_string (pp, "<D.xxxx>");
1398 else
1399 pp_printf (pp, "<D.%u>", DECL_UID (node));
1401 break;
1403 case TYPE_DECL:
1404 if (DECL_IS_BUILTIN (node))
1406 /* Don't print the declaration of built-in types. */
1407 break;
1409 if (DECL_NAME (node))
1410 dump_decl_name (pp, node, flags);
1411 else if (TYPE_NAME (TREE_TYPE (node)) != node)
1413 if ((TREE_CODE (TREE_TYPE (node)) == RECORD_TYPE
1414 || TREE_CODE (TREE_TYPE (node)) == UNION_TYPE)
1415 && TYPE_METHODS (TREE_TYPE (node)))
1417 /* The type is a c++ class: all structures have at least
1418 4 methods. */
1419 pp_string (pp, "class ");
1420 dump_generic_node (pp, TREE_TYPE (node), spc, flags, false);
1422 else
1424 pp_string (pp,
1425 (TREE_CODE (TREE_TYPE (node)) == UNION_TYPE
1426 ? "union" : "struct "));
1427 dump_generic_node (pp, TREE_TYPE (node), spc, flags, false);
1430 else
1431 pp_string (pp, "<anon>");
1432 break;
1434 case VAR_DECL:
1435 case PARM_DECL:
1436 case FIELD_DECL:
1437 case DEBUG_EXPR_DECL:
1438 case NAMESPACE_DECL:
1439 case NAMELIST_DECL:
1440 dump_decl_name (pp, node, flags);
1441 break;
1443 case RESULT_DECL:
1444 pp_string (pp, "<retval>");
1445 break;
1447 case COMPONENT_REF:
1448 op0 = TREE_OPERAND (node, 0);
1449 str = ".";
1450 if (op0
1451 && (TREE_CODE (op0) == INDIRECT_REF
1452 || (TREE_CODE (op0) == MEM_REF
1453 && TREE_CODE (TREE_OPERAND (op0, 0)) != ADDR_EXPR
1454 && integer_zerop (TREE_OPERAND (op0, 1))
1455 /* Dump the types of INTEGER_CSTs explicitly, for we
1456 can't infer them and MEM_ATTR caching will share
1457 MEM_REFs with differently-typed op0s. */
1458 && TREE_CODE (TREE_OPERAND (op0, 0)) != INTEGER_CST
1459 /* Released SSA_NAMES have no TREE_TYPE. */
1460 && TREE_TYPE (TREE_OPERAND (op0, 0)) != NULL_TREE
1461 /* Same pointer types, but ignoring POINTER_TYPE vs.
1462 REFERENCE_TYPE. */
1463 && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0, 0)))
1464 == TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0, 1))))
1465 && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0, 0)))
1466 == TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0, 1))))
1467 && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0, 0)))
1468 == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0, 1))))
1469 /* Same value types ignoring qualifiers. */
1470 && (TYPE_MAIN_VARIANT (TREE_TYPE (op0))
1471 == TYPE_MAIN_VARIANT
1472 (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0, 1)))))
1473 && MR_DEPENDENCE_CLIQUE (op0) == 0)))
1475 op0 = TREE_OPERAND (op0, 0);
1476 str = "->";
1478 if (op_prio (op0) < op_prio (node))
1479 pp_left_paren (pp);
1480 dump_generic_node (pp, op0, spc, flags, false);
1481 if (op_prio (op0) < op_prio (node))
1482 pp_right_paren (pp);
1483 pp_string (pp, str);
1484 dump_generic_node (pp, TREE_OPERAND (node, 1), spc, flags, false);
1485 op0 = component_ref_field_offset (node);
1486 if (op0 && TREE_CODE (op0) != INTEGER_CST)
1488 pp_string (pp, "{off: ");
1489 dump_generic_node (pp, op0, spc, flags, false);
1490 pp_right_brace (pp);
1492 break;
1494 case BIT_FIELD_REF:
1495 pp_string (pp, "BIT_FIELD_REF <");
1496 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
1497 pp_string (pp, ", ");
1498 dump_generic_node (pp, TREE_OPERAND (node, 1), spc, flags, false);
1499 pp_string (pp, ", ");
1500 dump_generic_node (pp, TREE_OPERAND (node, 2), spc, flags, false);
1501 pp_greater (pp);
1502 break;
1504 case ARRAY_REF:
1505 case ARRAY_RANGE_REF:
1506 op0 = TREE_OPERAND (node, 0);
1507 if (op_prio (op0) < op_prio (node))
1508 pp_left_paren (pp);
1509 dump_generic_node (pp, op0, spc, flags, false);
1510 if (op_prio (op0) < op_prio (node))
1511 pp_right_paren (pp);
1512 pp_left_bracket (pp);
1513 dump_generic_node (pp, TREE_OPERAND (node, 1), spc, flags, false);
1514 if (TREE_CODE (node) == ARRAY_RANGE_REF)
1515 pp_string (pp, " ...");
1516 pp_right_bracket (pp);
1518 op0 = array_ref_low_bound (node);
1519 op1 = array_ref_element_size (node);
1521 if (!integer_zerop (op0)
1522 || TREE_OPERAND (node, 2)
1523 || TREE_OPERAND (node, 3))
1525 pp_string (pp, "{lb: ");
1526 dump_generic_node (pp, op0, spc, flags, false);
1527 pp_string (pp, " sz: ");
1528 dump_generic_node (pp, op1, spc, flags, false);
1529 pp_right_brace (pp);
1531 break;
1533 case CONSTRUCTOR:
1535 unsigned HOST_WIDE_INT ix;
1536 tree field, val;
1537 bool is_struct_init = false;
1538 bool is_array_init = false;
1539 widest_int curidx;
1540 pp_left_brace (pp);
1541 if (TREE_CLOBBER_P (node))
1542 pp_string (pp, "CLOBBER");
1543 else if (TREE_CODE (TREE_TYPE (node)) == RECORD_TYPE
1544 || TREE_CODE (TREE_TYPE (node)) == UNION_TYPE)
1545 is_struct_init = true;
1546 else if (TREE_CODE (TREE_TYPE (node)) == ARRAY_TYPE
1547 && TYPE_DOMAIN (TREE_TYPE (node))
1548 && TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node)))
1549 && TREE_CODE (TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node))))
1550 == INTEGER_CST)
1552 tree minv = TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node)));
1553 is_array_init = true;
1554 curidx = wi::to_widest (minv);
1556 FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (node), ix, field, val)
1558 if (field)
1560 if (is_struct_init)
1562 pp_dot (pp);
1563 dump_generic_node (pp, field, spc, flags, false);
1564 pp_equal (pp);
1566 else if (is_array_init
1567 && (TREE_CODE (field) != INTEGER_CST
1568 || curidx != wi::to_widest (field)))
1570 pp_left_bracket (pp);
1571 if (TREE_CODE (field) == RANGE_EXPR)
1573 dump_generic_node (pp, TREE_OPERAND (field, 0), spc,
1574 flags, false);
1575 pp_string (pp, " ... ");
1576 dump_generic_node (pp, TREE_OPERAND (field, 1), spc,
1577 flags, false);
1578 if (TREE_CODE (TREE_OPERAND (field, 1)) == INTEGER_CST)
1579 curidx = wi::to_widest (TREE_OPERAND (field, 1));
1581 else
1582 dump_generic_node (pp, field, spc, flags, false);
1583 if (TREE_CODE (field) == INTEGER_CST)
1584 curidx = wi::to_widest (field);
1585 pp_string (pp, "]=");
1588 if (is_array_init)
1589 curidx += 1;
1590 if (val && TREE_CODE (val) == ADDR_EXPR)
1591 if (TREE_CODE (TREE_OPERAND (val, 0)) == FUNCTION_DECL)
1592 val = TREE_OPERAND (val, 0);
1593 if (val && TREE_CODE (val) == FUNCTION_DECL)
1594 dump_decl_name (pp, val, flags);
1595 else
1596 dump_generic_node (pp, val, spc, flags, false);
1597 if (ix != vec_safe_length (CONSTRUCTOR_ELTS (node)) - 1)
1599 pp_comma (pp);
1600 pp_space (pp);
1603 pp_right_brace (pp);
1605 break;
1607 case COMPOUND_EXPR:
1609 tree *tp;
1610 if (flags & TDF_SLIM)
1612 pp_string (pp, "<COMPOUND_EXPR>");
1613 break;
1616 dump_generic_node (pp, TREE_OPERAND (node, 0),
1617 spc, flags, !(flags & TDF_SLIM));
1618 if (flags & TDF_SLIM)
1619 newline_and_indent (pp, spc);
1620 else
1622 pp_comma (pp);
1623 pp_space (pp);
1626 for (tp = &TREE_OPERAND (node, 1);
1627 TREE_CODE (*tp) == COMPOUND_EXPR;
1628 tp = &TREE_OPERAND (*tp, 1))
1630 dump_generic_node (pp, TREE_OPERAND (*tp, 0),
1631 spc, flags, !(flags & TDF_SLIM));
1632 if (flags & TDF_SLIM)
1633 newline_and_indent (pp, spc);
1634 else
1636 pp_comma (pp);
1637 pp_space (pp);
1641 dump_generic_node (pp, *tp, spc, flags, !(flags & TDF_SLIM));
1643 break;
1645 case STATEMENT_LIST:
1647 tree_stmt_iterator si;
1648 bool first = true;
1650 if (flags & TDF_SLIM)
1652 pp_string (pp, "<STATEMENT_LIST>");
1653 break;
1656 for (si = tsi_start (node); !tsi_end_p (si); tsi_next (&si))
1658 if (!first)
1659 newline_and_indent (pp, spc);
1660 else
1661 first = false;
1662 dump_generic_node (pp, tsi_stmt (si), spc, flags, true);
1665 break;
1667 case MODIFY_EXPR:
1668 case INIT_EXPR:
1669 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags,
1670 false);
1671 pp_space (pp);
1672 pp_equal (pp);
1673 pp_space (pp);
1674 dump_generic_node (pp, TREE_OPERAND (node, 1), spc, flags,
1675 false);
1676 break;
1678 case TARGET_EXPR:
1679 pp_string (pp, "TARGET_EXPR <");
1680 dump_generic_node (pp, TARGET_EXPR_SLOT (node), spc, flags, false);
1681 pp_comma (pp);
1682 pp_space (pp);
1683 dump_generic_node (pp, TARGET_EXPR_INITIAL (node), spc, flags, false);
1684 pp_greater (pp);
1685 break;
1687 case DECL_EXPR:
1688 print_declaration (pp, DECL_EXPR_DECL (node), spc, flags);
1689 is_stmt = false;
1690 break;
1692 case COND_EXPR:
1693 if (TREE_TYPE (node) == NULL || TREE_TYPE (node) == void_type_node)
1695 pp_string (pp, "if (");
1696 dump_generic_node (pp, COND_EXPR_COND (node), spc, flags, false);
1697 pp_right_paren (pp);
1698 /* The lowered cond_exprs should always be printed in full. */
1699 if (COND_EXPR_THEN (node)
1700 && (IS_EMPTY_STMT (COND_EXPR_THEN (node))
1701 || TREE_CODE (COND_EXPR_THEN (node)) == GOTO_EXPR)
1702 && COND_EXPR_ELSE (node)
1703 && (IS_EMPTY_STMT (COND_EXPR_ELSE (node))
1704 || TREE_CODE (COND_EXPR_ELSE (node)) == GOTO_EXPR))
1706 pp_space (pp);
1707 dump_generic_node (pp, COND_EXPR_THEN (node),
1708 0, flags, true);
1709 if (!IS_EMPTY_STMT (COND_EXPR_ELSE (node)))
1711 pp_string (pp, " else ");
1712 dump_generic_node (pp, COND_EXPR_ELSE (node),
1713 0, flags, true);
1716 else if (!(flags & TDF_SLIM))
1718 /* Output COND_EXPR_THEN. */
1719 if (COND_EXPR_THEN (node))
1721 newline_and_indent (pp, spc+2);
1722 pp_left_brace (pp);
1723 newline_and_indent (pp, spc+4);
1724 dump_generic_node (pp, COND_EXPR_THEN (node), spc+4,
1725 flags, true);
1726 newline_and_indent (pp, spc+2);
1727 pp_right_brace (pp);
1730 /* Output COND_EXPR_ELSE. */
1731 if (COND_EXPR_ELSE (node)
1732 && !IS_EMPTY_STMT (COND_EXPR_ELSE (node)))
1734 newline_and_indent (pp, spc);
1735 pp_string (pp, "else");
1736 newline_and_indent (pp, spc+2);
1737 pp_left_brace (pp);
1738 newline_and_indent (pp, spc+4);
1739 dump_generic_node (pp, COND_EXPR_ELSE (node), spc+4,
1740 flags, true);
1741 newline_and_indent (pp, spc+2);
1742 pp_right_brace (pp);
1745 is_expr = false;
1747 else
1749 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
1750 pp_space (pp);
1751 pp_question (pp);
1752 pp_space (pp);
1753 dump_generic_node (pp, TREE_OPERAND (node, 1), spc, flags, false);
1754 pp_space (pp);
1755 pp_colon (pp);
1756 pp_space (pp);
1757 dump_generic_node (pp, TREE_OPERAND (node, 2), spc, flags, false);
1759 break;
1761 case BIND_EXPR:
1762 pp_left_brace (pp);
1763 if (!(flags & TDF_SLIM))
1765 if (BIND_EXPR_VARS (node))
1767 pp_newline (pp);
1769 for (op0 = BIND_EXPR_VARS (node); op0; op0 = DECL_CHAIN (op0))
1771 print_declaration (pp, op0, spc+2, flags);
1772 pp_newline (pp);
1776 newline_and_indent (pp, spc+2);
1777 dump_generic_node (pp, BIND_EXPR_BODY (node), spc+2, flags, true);
1778 newline_and_indent (pp, spc);
1779 pp_right_brace (pp);
1781 is_expr = false;
1782 break;
1784 case CALL_EXPR:
1785 if (CALL_EXPR_FN (node) != NULL_TREE)
1786 print_call_name (pp, CALL_EXPR_FN (node), flags);
1787 else
1788 pp_string (pp, internal_fn_name (CALL_EXPR_IFN (node)));
1790 /* Print parameters. */
1791 pp_space (pp);
1792 pp_left_paren (pp);
1794 tree arg;
1795 call_expr_arg_iterator iter;
1796 FOR_EACH_CALL_EXPR_ARG (arg, iter, node)
1798 dump_generic_node (pp, arg, spc, flags, false);
1799 if (more_call_expr_args_p (&iter))
1801 pp_comma (pp);
1802 pp_space (pp);
1806 if (CALL_EXPR_VA_ARG_PACK (node))
1808 if (call_expr_nargs (node) > 0)
1810 pp_comma (pp);
1811 pp_space (pp);
1813 pp_string (pp, "__builtin_va_arg_pack ()");
1815 pp_right_paren (pp);
1817 op1 = CALL_EXPR_STATIC_CHAIN (node);
1818 if (op1)
1820 pp_string (pp, " [static-chain: ");
1821 dump_generic_node (pp, op1, spc, flags, false);
1822 pp_right_bracket (pp);
1825 if (CALL_EXPR_RETURN_SLOT_OPT (node))
1826 pp_string (pp, " [return slot optimization]");
1827 if (CALL_EXPR_TAILCALL (node))
1828 pp_string (pp, " [tail call]");
1829 break;
1831 case WITH_CLEANUP_EXPR:
1832 NIY;
1833 break;
1835 case CLEANUP_POINT_EXPR:
1836 pp_string (pp, "<<cleanup_point ");
1837 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
1838 pp_string (pp, ">>");
1839 break;
1841 case PLACEHOLDER_EXPR:
1842 pp_string (pp, "<PLACEHOLDER_EXPR ");
1843 dump_generic_node (pp, TREE_TYPE (node), spc, flags, false);
1844 pp_greater (pp);
1845 break;
1847 /* Binary arithmetic and logic expressions. */
1848 case WIDEN_SUM_EXPR:
1849 case WIDEN_MULT_EXPR:
1850 case MULT_EXPR:
1851 case MULT_HIGHPART_EXPR:
1852 case PLUS_EXPR:
1853 case POINTER_PLUS_EXPR:
1854 case MINUS_EXPR:
1855 case TRUNC_DIV_EXPR:
1856 case CEIL_DIV_EXPR:
1857 case FLOOR_DIV_EXPR:
1858 case ROUND_DIV_EXPR:
1859 case TRUNC_MOD_EXPR:
1860 case CEIL_MOD_EXPR:
1861 case FLOOR_MOD_EXPR:
1862 case ROUND_MOD_EXPR:
1863 case RDIV_EXPR:
1864 case EXACT_DIV_EXPR:
1865 case LSHIFT_EXPR:
1866 case RSHIFT_EXPR:
1867 case LROTATE_EXPR:
1868 case RROTATE_EXPR:
1869 case WIDEN_LSHIFT_EXPR:
1870 case BIT_IOR_EXPR:
1871 case BIT_XOR_EXPR:
1872 case BIT_AND_EXPR:
1873 case TRUTH_ANDIF_EXPR:
1874 case TRUTH_ORIF_EXPR:
1875 case TRUTH_AND_EXPR:
1876 case TRUTH_OR_EXPR:
1877 case TRUTH_XOR_EXPR:
1878 case LT_EXPR:
1879 case LE_EXPR:
1880 case GT_EXPR:
1881 case GE_EXPR:
1882 case EQ_EXPR:
1883 case NE_EXPR:
1884 case UNLT_EXPR:
1885 case UNLE_EXPR:
1886 case UNGT_EXPR:
1887 case UNGE_EXPR:
1888 case UNEQ_EXPR:
1889 case LTGT_EXPR:
1890 case ORDERED_EXPR:
1891 case UNORDERED_EXPR:
1893 const char *op = op_symbol (node);
1894 op0 = TREE_OPERAND (node, 0);
1895 op1 = TREE_OPERAND (node, 1);
1897 /* When the operands are expressions with less priority,
1898 keep semantics of the tree representation. */
1899 if (op_prio (op0) <= op_prio (node))
1901 pp_left_paren (pp);
1902 dump_generic_node (pp, op0, spc, flags, false);
1903 pp_right_paren (pp);
1905 else
1906 dump_generic_node (pp, op0, spc, flags, false);
1908 pp_space (pp);
1909 pp_string (pp, op);
1910 pp_space (pp);
1912 /* When the operands are expressions with less priority,
1913 keep semantics of the tree representation. */
1914 if (op_prio (op1) <= op_prio (node))
1916 pp_left_paren (pp);
1917 dump_generic_node (pp, op1, spc, flags, false);
1918 pp_right_paren (pp);
1920 else
1921 dump_generic_node (pp, op1, spc, flags, false);
1923 break;
1925 /* Unary arithmetic and logic expressions. */
1926 case NEGATE_EXPR:
1927 case BIT_NOT_EXPR:
1928 case TRUTH_NOT_EXPR:
1929 case ADDR_EXPR:
1930 case PREDECREMENT_EXPR:
1931 case PREINCREMENT_EXPR:
1932 case INDIRECT_REF:
1933 if (TREE_CODE (node) == ADDR_EXPR
1934 && (TREE_CODE (TREE_OPERAND (node, 0)) == STRING_CST
1935 || TREE_CODE (TREE_OPERAND (node, 0)) == FUNCTION_DECL))
1936 ; /* Do not output '&' for strings and function pointers. */
1937 else
1938 pp_string (pp, op_symbol (node));
1940 if (op_prio (TREE_OPERAND (node, 0)) < op_prio (node))
1942 pp_left_paren (pp);
1943 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
1944 pp_right_paren (pp);
1946 else
1947 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
1948 break;
1950 case POSTDECREMENT_EXPR:
1951 case POSTINCREMENT_EXPR:
1952 if (op_prio (TREE_OPERAND (node, 0)) < op_prio (node))
1954 pp_left_paren (pp);
1955 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
1956 pp_right_paren (pp);
1958 else
1959 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
1960 pp_string (pp, op_symbol (node));
1961 break;
1963 case MIN_EXPR:
1964 pp_string (pp, "MIN_EXPR <");
1965 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
1966 pp_string (pp, ", ");
1967 dump_generic_node (pp, TREE_OPERAND (node, 1), spc, flags, false);
1968 pp_greater (pp);
1969 break;
1971 case MAX_EXPR:
1972 pp_string (pp, "MAX_EXPR <");
1973 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
1974 pp_string (pp, ", ");
1975 dump_generic_node (pp, TREE_OPERAND (node, 1), spc, flags, false);
1976 pp_greater (pp);
1977 break;
1979 case ABS_EXPR:
1980 pp_string (pp, "ABS_EXPR <");
1981 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
1982 pp_greater (pp);
1983 break;
1985 case RANGE_EXPR:
1986 NIY;
1987 break;
1989 case ADDR_SPACE_CONVERT_EXPR:
1990 case FIXED_CONVERT_EXPR:
1991 case FIX_TRUNC_EXPR:
1992 case FLOAT_EXPR:
1993 CASE_CONVERT:
1994 type = TREE_TYPE (node);
1995 op0 = TREE_OPERAND (node, 0);
1996 if (type != TREE_TYPE (op0))
1998 pp_left_paren (pp);
1999 dump_generic_node (pp, type, spc, flags, false);
2000 pp_string (pp, ") ");
2002 if (op_prio (op0) < op_prio (node))
2003 pp_left_paren (pp);
2004 dump_generic_node (pp, op0, spc, flags, false);
2005 if (op_prio (op0) < op_prio (node))
2006 pp_right_paren (pp);
2007 break;
2009 case VIEW_CONVERT_EXPR:
2010 pp_string (pp, "VIEW_CONVERT_EXPR<");
2011 dump_generic_node (pp, TREE_TYPE (node), spc, flags, false);
2012 pp_string (pp, ">(");
2013 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2014 pp_right_paren (pp);
2015 break;
2017 case PAREN_EXPR:
2018 pp_string (pp, "((");
2019 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2020 pp_string (pp, "))");
2021 break;
2023 case NON_LVALUE_EXPR:
2024 pp_string (pp, "NON_LVALUE_EXPR <");
2025 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2026 pp_greater (pp);
2027 break;
2029 case SAVE_EXPR:
2030 pp_string (pp, "SAVE_EXPR <");
2031 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2032 pp_greater (pp);
2033 break;
2035 case COMPLEX_EXPR:
2036 pp_string (pp, "COMPLEX_EXPR <");
2037 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2038 pp_string (pp, ", ");
2039 dump_generic_node (pp, TREE_OPERAND (node, 1), spc, flags, false);
2040 pp_greater (pp);
2041 break;
2043 case CONJ_EXPR:
2044 pp_string (pp, "CONJ_EXPR <");
2045 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2046 pp_greater (pp);
2047 break;
2049 case REALPART_EXPR:
2050 pp_string (pp, "REALPART_EXPR <");
2051 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2052 pp_greater (pp);
2053 break;
2055 case IMAGPART_EXPR:
2056 pp_string (pp, "IMAGPART_EXPR <");
2057 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2058 pp_greater (pp);
2059 break;
2061 case VA_ARG_EXPR:
2062 pp_string (pp, "VA_ARG_EXPR <");
2063 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2064 pp_greater (pp);
2065 break;
2067 case TRY_FINALLY_EXPR:
2068 case TRY_CATCH_EXPR:
2069 pp_string (pp, "try");
2070 newline_and_indent (pp, spc+2);
2071 pp_left_brace (pp);
2072 newline_and_indent (pp, spc+4);
2073 dump_generic_node (pp, TREE_OPERAND (node, 0), spc+4, flags, true);
2074 newline_and_indent (pp, spc+2);
2075 pp_right_brace (pp);
2076 newline_and_indent (pp, spc);
2077 pp_string (pp,
2078 (TREE_CODE (node) == TRY_CATCH_EXPR) ? "catch" : "finally");
2079 newline_and_indent (pp, spc+2);
2080 pp_left_brace (pp);
2081 newline_and_indent (pp, spc+4);
2082 dump_generic_node (pp, TREE_OPERAND (node, 1), spc+4, flags, true);
2083 newline_and_indent (pp, spc+2);
2084 pp_right_brace (pp);
2085 is_expr = false;
2086 break;
2088 case CATCH_EXPR:
2089 pp_string (pp, "catch (");
2090 dump_generic_node (pp, CATCH_TYPES (node), spc+2, flags, false);
2091 pp_right_paren (pp);
2092 newline_and_indent (pp, spc+2);
2093 pp_left_brace (pp);
2094 newline_and_indent (pp, spc+4);
2095 dump_generic_node (pp, CATCH_BODY (node), spc+4, flags, true);
2096 newline_and_indent (pp, spc+2);
2097 pp_right_brace (pp);
2098 is_expr = false;
2099 break;
2101 case EH_FILTER_EXPR:
2102 pp_string (pp, "<<<eh_filter (");
2103 dump_generic_node (pp, EH_FILTER_TYPES (node), spc+2, flags, false);
2104 pp_string (pp, ")>>>");
2105 newline_and_indent (pp, spc+2);
2106 pp_left_brace (pp);
2107 newline_and_indent (pp, spc+4);
2108 dump_generic_node (pp, EH_FILTER_FAILURE (node), spc+4, flags, true);
2109 newline_and_indent (pp, spc+2);
2110 pp_right_brace (pp);
2111 is_expr = false;
2112 break;
2114 case LABEL_EXPR:
2115 op0 = TREE_OPERAND (node, 0);
2116 /* If this is for break or continue, don't bother printing it. */
2117 if (DECL_NAME (op0))
2119 const char *name = IDENTIFIER_POINTER (DECL_NAME (op0));
2120 if (strcmp (name, "break") == 0
2121 || strcmp (name, "continue") == 0)
2122 break;
2124 dump_generic_node (pp, op0, spc, flags, false);
2125 pp_colon (pp);
2126 if (DECL_NONLOCAL (op0))
2127 pp_string (pp, " [non-local]");
2128 break;
2130 case LOOP_EXPR:
2131 pp_string (pp, "while (1)");
2132 if (!(flags & TDF_SLIM))
2134 newline_and_indent (pp, spc+2);
2135 pp_left_brace (pp);
2136 newline_and_indent (pp, spc+4);
2137 dump_generic_node (pp, LOOP_EXPR_BODY (node), spc+4, flags, true);
2138 newline_and_indent (pp, spc+2);
2139 pp_right_brace (pp);
2141 is_expr = false;
2142 break;
2144 case PREDICT_EXPR:
2145 pp_string (pp, "// predicted ");
2146 if (PREDICT_EXPR_OUTCOME (node))
2147 pp_string (pp, "likely by ");
2148 else
2149 pp_string (pp, "unlikely by ");
2150 pp_string (pp, predictor_name (PREDICT_EXPR_PREDICTOR (node)));
2151 pp_string (pp, " predictor.");
2152 break;
2154 case ANNOTATE_EXPR:
2155 pp_string (pp, "ANNOTATE_EXPR <");
2156 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2157 switch ((enum annot_expr_kind) TREE_INT_CST_LOW (TREE_OPERAND (node, 1)))
2159 case annot_expr_ivdep_kind:
2160 pp_string (pp, ", ivdep");
2161 break;
2162 case annot_expr_no_vector_kind:
2163 pp_string (pp, ", no-vector");
2164 break;
2165 case annot_expr_vector_kind:
2166 pp_string (pp, ", vector");
2167 break;
2168 default:
2169 gcc_unreachable ();
2171 pp_greater (pp);
2172 break;
2174 case RETURN_EXPR:
2175 pp_string (pp, "return");
2176 op0 = TREE_OPERAND (node, 0);
2177 if (op0)
2179 pp_space (pp);
2180 if (TREE_CODE (op0) == MODIFY_EXPR)
2181 dump_generic_node (pp, TREE_OPERAND (op0, 1),
2182 spc, flags, false);
2183 else
2184 dump_generic_node (pp, op0, spc, flags, false);
2186 break;
2188 case EXIT_EXPR:
2189 pp_string (pp, "if (");
2190 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2191 pp_string (pp, ") break");
2192 break;
2194 case SWITCH_EXPR:
2195 pp_string (pp, "switch (");
2196 dump_generic_node (pp, SWITCH_COND (node), spc, flags, false);
2197 pp_right_paren (pp);
2198 if (!(flags & TDF_SLIM))
2200 newline_and_indent (pp, spc+2);
2201 pp_left_brace (pp);
2202 if (SWITCH_BODY (node))
2204 newline_and_indent (pp, spc+4);
2205 dump_generic_node (pp, SWITCH_BODY (node), spc+4, flags,
2206 true);
2208 else
2210 tree vec = SWITCH_LABELS (node);
2211 size_t i, n = TREE_VEC_LENGTH (vec);
2212 for (i = 0; i < n; ++i)
2214 tree elt = TREE_VEC_ELT (vec, i);
2215 newline_and_indent (pp, spc+4);
2216 if (elt)
2218 dump_generic_node (pp, elt, spc+4, flags, false);
2219 pp_string (pp, " goto ");
2220 dump_generic_node (pp, CASE_LABEL (elt), spc+4,
2221 flags, true);
2222 pp_semicolon (pp);
2224 else
2225 pp_string (pp, "case ???: goto ???;");
2228 newline_and_indent (pp, spc+2);
2229 pp_right_brace (pp);
2231 is_expr = false;
2232 break;
2234 case GOTO_EXPR:
2235 op0 = GOTO_DESTINATION (node);
2236 if (TREE_CODE (op0) != SSA_NAME && DECL_P (op0) && DECL_NAME (op0))
2238 const char *name = IDENTIFIER_POINTER (DECL_NAME (op0));
2239 if (strcmp (name, "break") == 0
2240 || strcmp (name, "continue") == 0)
2242 pp_string (pp, name);
2243 break;
2246 pp_string (pp, "goto ");
2247 dump_generic_node (pp, op0, spc, flags, false);
2248 break;
2250 case ASM_EXPR:
2251 pp_string (pp, "__asm__");
2252 if (ASM_VOLATILE_P (node))
2253 pp_string (pp, " __volatile__");
2254 pp_left_paren (pp);
2255 dump_generic_node (pp, ASM_STRING (node), spc, flags, false);
2256 pp_colon (pp);
2257 dump_generic_node (pp, ASM_OUTPUTS (node), spc, flags, false);
2258 pp_colon (pp);
2259 dump_generic_node (pp, ASM_INPUTS (node), spc, flags, false);
2260 if (ASM_CLOBBERS (node))
2262 pp_colon (pp);
2263 dump_generic_node (pp, ASM_CLOBBERS (node), spc, flags, false);
2265 pp_right_paren (pp);
2266 break;
2268 case CASE_LABEL_EXPR:
2269 if (CASE_LOW (node) && CASE_HIGH (node))
2271 pp_string (pp, "case ");
2272 dump_generic_node (pp, CASE_LOW (node), spc, flags, false);
2273 pp_string (pp, " ... ");
2274 dump_generic_node (pp, CASE_HIGH (node), spc, flags, false);
2276 else if (CASE_LOW (node))
2278 pp_string (pp, "case ");
2279 dump_generic_node (pp, CASE_LOW (node), spc, flags, false);
2281 else
2282 pp_string (pp, "default");
2283 pp_colon (pp);
2284 break;
2286 case OBJ_TYPE_REF:
2287 pp_string (pp, "OBJ_TYPE_REF(");
2288 dump_generic_node (pp, OBJ_TYPE_REF_EXPR (node), spc, flags, false);
2289 pp_semicolon (pp);
2290 if (!(flags & TDF_SLIM) && virtual_method_call_p (node))
2292 pp_string (pp, "(");
2293 dump_generic_node (pp, obj_type_ref_class (node), spc, flags, false);
2294 pp_string (pp, ")");
2296 dump_generic_node (pp, OBJ_TYPE_REF_OBJECT (node), spc, flags, false);
2297 pp_arrow (pp);
2298 dump_generic_node (pp, OBJ_TYPE_REF_TOKEN (node), spc, flags, false);
2299 pp_right_paren (pp);
2300 break;
2302 case SSA_NAME:
2303 if (SSA_NAME_IDENTIFIER (node))
2304 dump_generic_node (pp, SSA_NAME_IDENTIFIER (node),
2305 spc, flags, false);
2306 pp_underscore (pp);
2307 pp_decimal_int (pp, SSA_NAME_VERSION (node));
2308 if (SSA_NAME_IS_DEFAULT_DEF (node))
2309 pp_string (pp, "(D)");
2310 if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (node))
2311 pp_string (pp, "(ab)");
2312 break;
2314 case WITH_SIZE_EXPR:
2315 pp_string (pp, "WITH_SIZE_EXPR <");
2316 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2317 pp_string (pp, ", ");
2318 dump_generic_node (pp, TREE_OPERAND (node, 1), spc, flags, false);
2319 pp_greater (pp);
2320 break;
2322 case ASSERT_EXPR:
2323 pp_string (pp, "ASSERT_EXPR <");
2324 dump_generic_node (pp, ASSERT_EXPR_VAR (node), spc, flags, false);
2325 pp_string (pp, ", ");
2326 dump_generic_node (pp, ASSERT_EXPR_COND (node), spc, flags, false);
2327 pp_greater (pp);
2328 break;
2330 case SCEV_KNOWN:
2331 pp_string (pp, "scev_known");
2332 break;
2334 case SCEV_NOT_KNOWN:
2335 pp_string (pp, "scev_not_known");
2336 break;
2338 case POLYNOMIAL_CHREC:
2339 pp_left_brace (pp);
2340 dump_generic_node (pp, CHREC_LEFT (node), spc, flags, false);
2341 pp_string (pp, ", +, ");
2342 dump_generic_node (pp, CHREC_RIGHT (node), spc, flags, false);
2343 pp_string (pp, "}_");
2344 dump_generic_node (pp, CHREC_VAR (node), spc, flags, false);
2345 is_stmt = false;
2346 break;
2348 case REALIGN_LOAD_EXPR:
2349 pp_string (pp, "REALIGN_LOAD <");
2350 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2351 pp_string (pp, ", ");
2352 dump_generic_node (pp, TREE_OPERAND (node, 1), spc, flags, false);
2353 pp_string (pp, ", ");
2354 dump_generic_node (pp, TREE_OPERAND (node, 2), spc, flags, false);
2355 pp_greater (pp);
2356 break;
2358 case VEC_COND_EXPR:
2359 pp_string (pp, " VEC_COND_EXPR < ");
2360 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2361 pp_string (pp, " , ");
2362 dump_generic_node (pp, TREE_OPERAND (node, 1), spc, flags, false);
2363 pp_string (pp, " , ");
2364 dump_generic_node (pp, TREE_OPERAND (node, 2), spc, flags, false);
2365 pp_string (pp, " > ");
2366 break;
2368 case VEC_PERM_EXPR:
2369 pp_string (pp, " VEC_PERM_EXPR < ");
2370 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2371 pp_string (pp, " , ");
2372 dump_generic_node (pp, TREE_OPERAND (node, 1), spc, flags, false);
2373 pp_string (pp, " , ");
2374 dump_generic_node (pp, TREE_OPERAND (node, 2), spc, flags, false);
2375 pp_string (pp, " > ");
2376 break;
2378 case DOT_PROD_EXPR:
2379 pp_string (pp, " DOT_PROD_EXPR < ");
2380 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2381 pp_string (pp, ", ");
2382 dump_generic_node (pp, TREE_OPERAND (node, 1), spc, flags, false);
2383 pp_string (pp, ", ");
2384 dump_generic_node (pp, TREE_OPERAND (node, 2), spc, flags, false);
2385 pp_string (pp, " > ");
2386 break;
2388 case WIDEN_MULT_PLUS_EXPR:
2389 pp_string (pp, " WIDEN_MULT_PLUS_EXPR < ");
2390 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2391 pp_string (pp, ", ");
2392 dump_generic_node (pp, TREE_OPERAND (node, 1), spc, flags, false);
2393 pp_string (pp, ", ");
2394 dump_generic_node (pp, TREE_OPERAND (node, 2), spc, flags, false);
2395 pp_string (pp, " > ");
2396 break;
2398 case WIDEN_MULT_MINUS_EXPR:
2399 pp_string (pp, " WIDEN_MULT_MINUS_EXPR < ");
2400 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2401 pp_string (pp, ", ");
2402 dump_generic_node (pp, TREE_OPERAND (node, 1), spc, flags, false);
2403 pp_string (pp, ", ");
2404 dump_generic_node (pp, TREE_OPERAND (node, 2), spc, flags, false);
2405 pp_string (pp, " > ");
2406 break;
2408 case FMA_EXPR:
2409 pp_string (pp, " FMA_EXPR < ");
2410 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2411 pp_string (pp, ", ");
2412 dump_generic_node (pp, TREE_OPERAND (node, 1), spc, flags, false);
2413 pp_string (pp, ", ");
2414 dump_generic_node (pp, TREE_OPERAND (node, 2), spc, flags, false);
2415 pp_string (pp, " > ");
2416 break;
2418 case OMP_PARALLEL:
2419 pp_string (pp, "#pragma omp parallel");
2420 dump_omp_clauses (pp, OMP_PARALLEL_CLAUSES (node), spc, flags);
2422 dump_omp_body:
2423 if (!(flags & TDF_SLIM) && OMP_BODY (node))
2425 newline_and_indent (pp, spc + 2);
2426 pp_left_brace (pp);
2427 newline_and_indent (pp, spc + 4);
2428 dump_generic_node (pp, OMP_BODY (node), spc + 4, flags, false);
2429 newline_and_indent (pp, spc + 2);
2430 pp_right_brace (pp);
2432 is_expr = false;
2433 break;
2435 case OMP_TASK:
2436 pp_string (pp, "#pragma omp task");
2437 dump_omp_clauses (pp, OMP_TASK_CLAUSES (node), spc, flags);
2438 goto dump_omp_body;
2440 case OMP_FOR:
2441 pp_string (pp, "#pragma omp for");
2442 goto dump_omp_loop;
2444 case OMP_SIMD:
2445 pp_string (pp, "#pragma omp simd");
2446 goto dump_omp_loop;
2448 case CILK_SIMD:
2449 pp_string (pp, "#pragma simd");
2450 goto dump_omp_loop;
2452 case CILK_FOR:
2453 /* This label points one line after dumping the clauses.
2454 For _Cilk_for the clauses are dumped after the _Cilk_for (...)
2455 parameters are printed out. */
2456 goto dump_omp_loop_cilk_for;
2458 case OMP_DISTRIBUTE:
2459 pp_string (pp, "#pragma omp distribute");
2460 goto dump_omp_loop;
2462 case OMP_TEAMS:
2463 pp_string (pp, "#pragma omp teams");
2464 dump_omp_clauses (pp, OMP_TEAMS_CLAUSES (node), spc, flags);
2465 goto dump_omp_body;
2467 case OMP_TARGET_DATA:
2468 pp_string (pp, "#pragma omp target data");
2469 dump_omp_clauses (pp, OMP_TARGET_DATA_CLAUSES (node), spc, flags);
2470 goto dump_omp_body;
2472 case OMP_TARGET:
2473 pp_string (pp, "#pragma omp target");
2474 dump_omp_clauses (pp, OMP_TARGET_CLAUSES (node), spc, flags);
2475 goto dump_omp_body;
2477 case OMP_TARGET_UPDATE:
2478 pp_string (pp, "#pragma omp target update");
2479 dump_omp_clauses (pp, OMP_TARGET_UPDATE_CLAUSES (node), spc, flags);
2480 is_expr = false;
2481 break;
2483 dump_omp_loop:
2484 dump_omp_clauses (pp, OMP_FOR_CLAUSES (node), spc, flags);
2486 dump_omp_loop_cilk_for:
2487 if (!(flags & TDF_SLIM))
2489 int i;
2491 if (OMP_FOR_PRE_BODY (node))
2493 if (TREE_CODE (node) == CILK_FOR)
2494 pp_string (pp, " ");
2495 else
2496 newline_and_indent (pp, spc + 2);
2497 pp_left_brace (pp);
2498 spc += 4;
2499 newline_and_indent (pp, spc);
2500 dump_generic_node (pp, OMP_FOR_PRE_BODY (node),
2501 spc, flags, false);
2503 if (OMP_FOR_INIT (node))
2505 spc -= 2;
2506 for (i = 0; i < TREE_VEC_LENGTH (OMP_FOR_INIT (node)); i++)
2508 spc += 2;
2509 if (TREE_CODE (node) != CILK_FOR || OMP_FOR_PRE_BODY (node))
2510 newline_and_indent (pp, spc);
2511 if (TREE_CODE (node) == CILK_FOR)
2512 pp_string (pp, "_Cilk_for (");
2513 else
2514 pp_string (pp, "for (");
2515 dump_generic_node (pp,
2516 TREE_VEC_ELT (OMP_FOR_INIT (node), i),
2517 spc, flags, false);
2518 pp_string (pp, "; ");
2519 dump_generic_node (pp,
2520 TREE_VEC_ELT (OMP_FOR_COND (node), i),
2521 spc, flags, false);
2522 pp_string (pp, "; ");
2523 dump_generic_node (pp,
2524 TREE_VEC_ELT (OMP_FOR_INCR (node), i),
2525 spc, flags, false);
2526 pp_right_paren (pp);
2528 if (TREE_CODE (node) == CILK_FOR)
2529 dump_omp_clauses (pp, OMP_FOR_CLAUSES (node), spc, flags);
2531 if (OMP_FOR_BODY (node))
2533 newline_and_indent (pp, spc + 2);
2534 pp_left_brace (pp);
2535 newline_and_indent (pp, spc + 4);
2536 dump_generic_node (pp, OMP_FOR_BODY (node), spc + 4, flags,
2537 false);
2538 newline_and_indent (pp, spc + 2);
2539 pp_right_brace (pp);
2541 if (OMP_FOR_INIT (node))
2542 spc -= 2 * TREE_VEC_LENGTH (OMP_FOR_INIT (node)) - 2;
2543 if (OMP_FOR_PRE_BODY (node))
2545 spc -= 4;
2546 newline_and_indent (pp, spc + 2);
2547 pp_right_brace (pp);
2550 is_expr = false;
2551 break;
2553 case OMP_SECTIONS:
2554 pp_string (pp, "#pragma omp sections");
2555 dump_omp_clauses (pp, OMP_SECTIONS_CLAUSES (node), spc, flags);
2556 goto dump_omp_body;
2558 case OMP_SECTION:
2559 pp_string (pp, "#pragma omp section");
2560 goto dump_omp_body;
2562 case OMP_MASTER:
2563 pp_string (pp, "#pragma omp master");
2564 goto dump_omp_body;
2566 case OMP_TASKGROUP:
2567 pp_string (pp, "#pragma omp taskgroup");
2568 goto dump_omp_body;
2570 case OMP_ORDERED:
2571 pp_string (pp, "#pragma omp ordered");
2572 goto dump_omp_body;
2574 case OMP_CRITICAL:
2575 pp_string (pp, "#pragma omp critical");
2576 if (OMP_CRITICAL_NAME (node))
2578 pp_space (pp);
2579 pp_left_paren (pp);
2580 dump_generic_node (pp, OMP_CRITICAL_NAME (node), spc,
2581 flags, false);
2582 pp_right_paren (pp);
2584 goto dump_omp_body;
2586 case OMP_ATOMIC:
2587 pp_string (pp, "#pragma omp atomic");
2588 if (OMP_ATOMIC_SEQ_CST (node))
2589 pp_string (pp, " seq_cst");
2590 newline_and_indent (pp, spc + 2);
2591 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2592 pp_space (pp);
2593 pp_equal (pp);
2594 pp_space (pp);
2595 dump_generic_node (pp, TREE_OPERAND (node, 1), spc, flags, false);
2596 break;
2598 case OMP_ATOMIC_READ:
2599 pp_string (pp, "#pragma omp atomic read");
2600 if (OMP_ATOMIC_SEQ_CST (node))
2601 pp_string (pp, " seq_cst");
2602 newline_and_indent (pp, spc + 2);
2603 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2604 pp_space (pp);
2605 break;
2607 case OMP_ATOMIC_CAPTURE_OLD:
2608 case OMP_ATOMIC_CAPTURE_NEW:
2609 pp_string (pp, "#pragma omp atomic capture");
2610 if (OMP_ATOMIC_SEQ_CST (node))
2611 pp_string (pp, " seq_cst");
2612 newline_and_indent (pp, spc + 2);
2613 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2614 pp_space (pp);
2615 pp_equal (pp);
2616 pp_space (pp);
2617 dump_generic_node (pp, TREE_OPERAND (node, 1), spc, flags, false);
2618 break;
2620 case OMP_SINGLE:
2621 pp_string (pp, "#pragma omp single");
2622 dump_omp_clauses (pp, OMP_SINGLE_CLAUSES (node), spc, flags);
2623 goto dump_omp_body;
2625 case OMP_CLAUSE:
2626 dump_omp_clause (pp, node, spc, flags);
2627 is_expr = false;
2628 break;
2630 case TRANSACTION_EXPR:
2631 if (TRANSACTION_EXPR_OUTER (node))
2632 pp_string (pp, "__transaction_atomic [[outer]]");
2633 else if (TRANSACTION_EXPR_RELAXED (node))
2634 pp_string (pp, "__transaction_relaxed");
2635 else
2636 pp_string (pp, "__transaction_atomic");
2637 if (!(flags & TDF_SLIM) && TRANSACTION_EXPR_BODY (node))
2639 newline_and_indent (pp, spc);
2640 pp_left_brace (pp);
2641 newline_and_indent (pp, spc + 2);
2642 dump_generic_node (pp, TRANSACTION_EXPR_BODY (node),
2643 spc + 2, flags, false);
2644 newline_and_indent (pp, spc);
2645 pp_right_brace (pp);
2647 is_expr = false;
2648 break;
2650 case REDUC_MAX_EXPR:
2651 pp_string (pp, " REDUC_MAX_EXPR < ");
2652 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2653 pp_string (pp, " > ");
2654 break;
2656 case REDUC_MIN_EXPR:
2657 pp_string (pp, " REDUC_MIN_EXPR < ");
2658 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2659 pp_string (pp, " > ");
2660 break;
2662 case REDUC_PLUS_EXPR:
2663 pp_string (pp, " REDUC_PLUS_EXPR < ");
2664 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2665 pp_string (pp, " > ");
2666 break;
2668 case VEC_WIDEN_MULT_HI_EXPR:
2669 case VEC_WIDEN_MULT_LO_EXPR:
2670 case VEC_WIDEN_MULT_EVEN_EXPR:
2671 case VEC_WIDEN_MULT_ODD_EXPR:
2672 case VEC_WIDEN_LSHIFT_HI_EXPR:
2673 case VEC_WIDEN_LSHIFT_LO_EXPR:
2674 pp_space (pp);
2675 for (str = get_tree_code_name (code); *str; str++)
2676 pp_character (pp, TOUPPER (*str));
2677 pp_string (pp, " < ");
2678 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2679 pp_string (pp, ", ");
2680 dump_generic_node (pp, TREE_OPERAND (node, 1), spc, flags, false);
2681 pp_string (pp, " > ");
2682 break;
2684 case VEC_UNPACK_HI_EXPR:
2685 pp_string (pp, " VEC_UNPACK_HI_EXPR < ");
2686 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2687 pp_string (pp, " > ");
2688 break;
2690 case VEC_UNPACK_LO_EXPR:
2691 pp_string (pp, " VEC_UNPACK_LO_EXPR < ");
2692 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2693 pp_string (pp, " > ");
2694 break;
2696 case VEC_UNPACK_FLOAT_HI_EXPR:
2697 pp_string (pp, " VEC_UNPACK_FLOAT_HI_EXPR < ");
2698 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2699 pp_string (pp, " > ");
2700 break;
2702 case VEC_UNPACK_FLOAT_LO_EXPR:
2703 pp_string (pp, " VEC_UNPACK_FLOAT_LO_EXPR < ");
2704 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2705 pp_string (pp, " > ");
2706 break;
2708 case VEC_PACK_TRUNC_EXPR:
2709 pp_string (pp, " VEC_PACK_TRUNC_EXPR < ");
2710 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2711 pp_string (pp, ", ");
2712 dump_generic_node (pp, TREE_OPERAND (node, 1), spc, flags, false);
2713 pp_string (pp, " > ");
2714 break;
2716 case VEC_PACK_SAT_EXPR:
2717 pp_string (pp, " VEC_PACK_SAT_EXPR < ");
2718 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2719 pp_string (pp, ", ");
2720 dump_generic_node (pp, TREE_OPERAND (node, 1), spc, flags, false);
2721 pp_string (pp, " > ");
2722 break;
2724 case VEC_PACK_FIX_TRUNC_EXPR:
2725 pp_string (pp, " VEC_PACK_FIX_TRUNC_EXPR < ");
2726 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2727 pp_string (pp, ", ");
2728 dump_generic_node (pp, TREE_OPERAND (node, 1), spc, flags, false);
2729 pp_string (pp, " > ");
2730 break;
2732 case BLOCK:
2733 dump_block_node (pp, node, spc, flags);
2734 break;
2736 case CILK_SPAWN_STMT:
2737 pp_string (pp, "_Cilk_spawn ");
2738 dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
2739 break;
2741 case CILK_SYNC_STMT:
2742 pp_string (pp, "_Cilk_sync");
2743 break;
2745 default:
2746 NIY;
2749 if (is_stmt && is_expr)
2750 pp_semicolon (pp);
2752 return spc;
2755 /* Print the declaration of a variable. */
2757 void
2758 print_declaration (pretty_printer *pp, tree t, int spc, int flags)
2760 INDENT (spc);
2762 if (TREE_CODE(t) == NAMELIST_DECL)
2764 pp_string(pp, "namelist ");
2765 dump_decl_name (pp, t, flags);
2766 pp_semicolon (pp);
2767 return;
2770 if (TREE_CODE (t) == TYPE_DECL)
2771 pp_string (pp, "typedef ");
2773 if (CODE_CONTAINS_STRUCT (TREE_CODE (t), TS_DECL_WRTL) && DECL_REGISTER (t))
2774 pp_string (pp, "register ");
2776 if (TREE_PUBLIC (t) && DECL_EXTERNAL (t))
2777 pp_string (pp, "extern ");
2778 else if (TREE_STATIC (t))
2779 pp_string (pp, "static ");
2781 /* Print the type and name. */
2782 if (TREE_TYPE (t) && TREE_CODE (TREE_TYPE (t)) == ARRAY_TYPE)
2784 tree tmp;
2786 /* Print array's type. */
2787 tmp = TREE_TYPE (t);
2788 while (TREE_CODE (TREE_TYPE (tmp)) == ARRAY_TYPE)
2789 tmp = TREE_TYPE (tmp);
2790 dump_generic_node (pp, TREE_TYPE (tmp), spc, flags, false);
2792 /* Print variable's name. */
2793 pp_space (pp);
2794 dump_generic_node (pp, t, spc, flags, false);
2796 /* Print the dimensions. */
2797 tmp = TREE_TYPE (t);
2798 while (TREE_CODE (tmp) == ARRAY_TYPE)
2800 dump_array_domain (pp, TYPE_DOMAIN (tmp), spc, flags);
2801 tmp = TREE_TYPE (tmp);
2804 else if (TREE_CODE (t) == FUNCTION_DECL)
2806 dump_generic_node (pp, TREE_TYPE (TREE_TYPE (t)), spc, flags, false);
2807 pp_space (pp);
2808 dump_decl_name (pp, t, flags);
2809 dump_function_declaration (pp, TREE_TYPE (t), spc, flags);
2811 else
2813 /* Print type declaration. */
2814 dump_generic_node (pp, TREE_TYPE (t), spc, flags, false);
2816 /* Print variable's name. */
2817 pp_space (pp);
2818 dump_generic_node (pp, t, spc, flags, false);
2821 if (TREE_CODE (t) == VAR_DECL && DECL_HARD_REGISTER (t))
2823 pp_string (pp, " __asm__ ");
2824 pp_left_paren (pp);
2825 dump_generic_node (pp, DECL_ASSEMBLER_NAME (t), spc, flags, false);
2826 pp_right_paren (pp);
2829 /* The initial value of a function serves to determine whether the function
2830 is declared or defined. So the following does not apply to function
2831 nodes. */
2832 if (TREE_CODE (t) != FUNCTION_DECL)
2834 /* Print the initial value. */
2835 if (DECL_INITIAL (t))
2837 pp_space (pp);
2838 pp_equal (pp);
2839 pp_space (pp);
2840 dump_generic_node (pp, DECL_INITIAL (t), spc, flags, false);
2844 if (TREE_CODE (t) == VAR_DECL && DECL_HAS_VALUE_EXPR_P (t))
2846 pp_string (pp, " [value-expr: ");
2847 dump_generic_node (pp, DECL_VALUE_EXPR (t), spc, flags, false);
2848 pp_right_bracket (pp);
2851 pp_semicolon (pp);
2855 /* Prints a structure: name, fields, and methods.
2856 FIXME: Still incomplete. */
2858 static void
2859 print_struct_decl (pretty_printer *pp, const_tree node, int spc, int flags)
2861 /* Print the name of the structure. */
2862 if (TYPE_NAME (node))
2864 INDENT (spc);
2865 if (TREE_CODE (node) == RECORD_TYPE)
2866 pp_string (pp, "struct ");
2867 else if ((TREE_CODE (node) == UNION_TYPE
2868 || TREE_CODE (node) == QUAL_UNION_TYPE))
2869 pp_string (pp, "union ");
2871 dump_generic_node (pp, TYPE_NAME (node), spc, 0, false);
2874 /* Print the contents of the structure. */
2875 pp_newline (pp);
2876 INDENT (spc);
2877 pp_left_brace (pp);
2878 pp_newline (pp);
2880 /* Print the fields of the structure. */
2882 tree tmp;
2883 tmp = TYPE_FIELDS (node);
2884 while (tmp)
2886 /* Avoid to print recursively the structure. */
2887 /* FIXME : Not implemented correctly...,
2888 what about the case when we have a cycle in the contain graph? ...
2889 Maybe this could be solved by looking at the scope in which the
2890 structure was declared. */
2891 if (TREE_TYPE (tmp) != node
2892 && (TREE_CODE (TREE_TYPE (tmp)) != POINTER_TYPE
2893 || TREE_TYPE (TREE_TYPE (tmp)) != node))
2895 print_declaration (pp, tmp, spc+2, flags);
2896 pp_newline (pp);
2898 tmp = DECL_CHAIN (tmp);
2901 INDENT (spc);
2902 pp_right_brace (pp);
2905 /* Return the priority of the operator CODE.
2907 From lowest to highest precedence with either left-to-right (L-R)
2908 or right-to-left (R-L) associativity]:
2910 1 [L-R] ,
2911 2 [R-L] = += -= *= /= %= &= ^= |= <<= >>=
2912 3 [R-L] ?:
2913 4 [L-R] ||
2914 5 [L-R] &&
2915 6 [L-R] |
2916 7 [L-R] ^
2917 8 [L-R] &
2918 9 [L-R] == !=
2919 10 [L-R] < <= > >=
2920 11 [L-R] << >>
2921 12 [L-R] + -
2922 13 [L-R] * / %
2923 14 [R-L] ! ~ ++ -- + - * & (type) sizeof
2924 15 [L-R] fn() [] -> .
2926 unary +, - and * have higher precedence than the corresponding binary
2927 operators. */
2930 op_code_prio (enum tree_code code)
2932 switch (code)
2934 case TREE_LIST:
2935 case COMPOUND_EXPR:
2936 case BIND_EXPR:
2937 return 1;
2939 case MODIFY_EXPR:
2940 case INIT_EXPR:
2941 return 2;
2943 case COND_EXPR:
2944 return 3;
2946 case TRUTH_OR_EXPR:
2947 case TRUTH_ORIF_EXPR:
2948 return 4;
2950 case TRUTH_AND_EXPR:
2951 case TRUTH_ANDIF_EXPR:
2952 return 5;
2954 case BIT_IOR_EXPR:
2955 return 6;
2957 case BIT_XOR_EXPR:
2958 case TRUTH_XOR_EXPR:
2959 return 7;
2961 case BIT_AND_EXPR:
2962 return 8;
2964 case EQ_EXPR:
2965 case NE_EXPR:
2966 return 9;
2968 case UNLT_EXPR:
2969 case UNLE_EXPR:
2970 case UNGT_EXPR:
2971 case UNGE_EXPR:
2972 case UNEQ_EXPR:
2973 case LTGT_EXPR:
2974 case ORDERED_EXPR:
2975 case UNORDERED_EXPR:
2976 case LT_EXPR:
2977 case LE_EXPR:
2978 case GT_EXPR:
2979 case GE_EXPR:
2980 return 10;
2982 case LSHIFT_EXPR:
2983 case RSHIFT_EXPR:
2984 case LROTATE_EXPR:
2985 case RROTATE_EXPR:
2986 case VEC_WIDEN_LSHIFT_HI_EXPR:
2987 case VEC_WIDEN_LSHIFT_LO_EXPR:
2988 case WIDEN_LSHIFT_EXPR:
2989 return 11;
2991 case WIDEN_SUM_EXPR:
2992 case PLUS_EXPR:
2993 case POINTER_PLUS_EXPR:
2994 case MINUS_EXPR:
2995 return 12;
2997 case VEC_WIDEN_MULT_HI_EXPR:
2998 case VEC_WIDEN_MULT_LO_EXPR:
2999 case WIDEN_MULT_EXPR:
3000 case DOT_PROD_EXPR:
3001 case WIDEN_MULT_PLUS_EXPR:
3002 case WIDEN_MULT_MINUS_EXPR:
3003 case MULT_EXPR:
3004 case MULT_HIGHPART_EXPR:
3005 case TRUNC_DIV_EXPR:
3006 case CEIL_DIV_EXPR:
3007 case FLOOR_DIV_EXPR:
3008 case ROUND_DIV_EXPR:
3009 case RDIV_EXPR:
3010 case EXACT_DIV_EXPR:
3011 case TRUNC_MOD_EXPR:
3012 case CEIL_MOD_EXPR:
3013 case FLOOR_MOD_EXPR:
3014 case ROUND_MOD_EXPR:
3015 case FMA_EXPR:
3016 return 13;
3018 case TRUTH_NOT_EXPR:
3019 case BIT_NOT_EXPR:
3020 case POSTINCREMENT_EXPR:
3021 case POSTDECREMENT_EXPR:
3022 case PREINCREMENT_EXPR:
3023 case PREDECREMENT_EXPR:
3024 case NEGATE_EXPR:
3025 case INDIRECT_REF:
3026 case ADDR_EXPR:
3027 case FLOAT_EXPR:
3028 CASE_CONVERT:
3029 case FIX_TRUNC_EXPR:
3030 case TARGET_EXPR:
3031 return 14;
3033 case CALL_EXPR:
3034 case ARRAY_REF:
3035 case ARRAY_RANGE_REF:
3036 case COMPONENT_REF:
3037 return 15;
3039 /* Special expressions. */
3040 case MIN_EXPR:
3041 case MAX_EXPR:
3042 case ABS_EXPR:
3043 case REALPART_EXPR:
3044 case IMAGPART_EXPR:
3045 case REDUC_MAX_EXPR:
3046 case REDUC_MIN_EXPR:
3047 case REDUC_PLUS_EXPR:
3048 case VEC_UNPACK_HI_EXPR:
3049 case VEC_UNPACK_LO_EXPR:
3050 case VEC_UNPACK_FLOAT_HI_EXPR:
3051 case VEC_UNPACK_FLOAT_LO_EXPR:
3052 case VEC_PACK_TRUNC_EXPR:
3053 case VEC_PACK_SAT_EXPR:
3054 return 16;
3056 default:
3057 /* Return an arbitrarily high precedence to avoid surrounding single
3058 VAR_DECLs in ()s. */
3059 return 9999;
3063 /* Return the priority of the operator OP. */
3066 op_prio (const_tree op)
3068 enum tree_code code;
3070 if (op == NULL)
3071 return 9999;
3073 code = TREE_CODE (op);
3074 if (code == SAVE_EXPR || code == NON_LVALUE_EXPR)
3075 return op_prio (TREE_OPERAND (op, 0));
3077 return op_code_prio (code);
3080 /* Return the symbol associated with operator CODE. */
3082 const char *
3083 op_symbol_code (enum tree_code code)
3085 switch (code)
3087 case MODIFY_EXPR:
3088 return "=";
3090 case TRUTH_OR_EXPR:
3091 case TRUTH_ORIF_EXPR:
3092 return "||";
3094 case TRUTH_AND_EXPR:
3095 case TRUTH_ANDIF_EXPR:
3096 return "&&";
3098 case BIT_IOR_EXPR:
3099 return "|";
3101 case TRUTH_XOR_EXPR:
3102 case BIT_XOR_EXPR:
3103 return "^";
3105 case ADDR_EXPR:
3106 case BIT_AND_EXPR:
3107 return "&";
3109 case ORDERED_EXPR:
3110 return "ord";
3111 case UNORDERED_EXPR:
3112 return "unord";
3114 case EQ_EXPR:
3115 return "==";
3116 case UNEQ_EXPR:
3117 return "u==";
3119 case NE_EXPR:
3120 return "!=";
3122 case LT_EXPR:
3123 return "<";
3124 case UNLT_EXPR:
3125 return "u<";
3127 case LE_EXPR:
3128 return "<=";
3129 case UNLE_EXPR:
3130 return "u<=";
3132 case GT_EXPR:
3133 return ">";
3134 case UNGT_EXPR:
3135 return "u>";
3137 case GE_EXPR:
3138 return ">=";
3139 case UNGE_EXPR:
3140 return "u>=";
3142 case LTGT_EXPR:
3143 return "<>";
3145 case LSHIFT_EXPR:
3146 return "<<";
3148 case RSHIFT_EXPR:
3149 return ">>";
3151 case LROTATE_EXPR:
3152 return "r<<";
3154 case RROTATE_EXPR:
3155 return "r>>";
3157 case WIDEN_LSHIFT_EXPR:
3158 return "w<<";
3160 case POINTER_PLUS_EXPR:
3161 return "+";
3163 case PLUS_EXPR:
3164 return "+";
3166 case REDUC_PLUS_EXPR:
3167 return "r+";
3169 case WIDEN_SUM_EXPR:
3170 return "w+";
3172 case WIDEN_MULT_EXPR:
3173 return "w*";
3175 case MULT_HIGHPART_EXPR:
3176 return "h*";
3178 case NEGATE_EXPR:
3179 case MINUS_EXPR:
3180 return "-";
3182 case BIT_NOT_EXPR:
3183 return "~";
3185 case TRUTH_NOT_EXPR:
3186 return "!";
3188 case MULT_EXPR:
3189 case INDIRECT_REF:
3190 return "*";
3192 case TRUNC_DIV_EXPR:
3193 case RDIV_EXPR:
3194 return "/";
3196 case CEIL_DIV_EXPR:
3197 return "/[cl]";
3199 case FLOOR_DIV_EXPR:
3200 return "/[fl]";
3202 case ROUND_DIV_EXPR:
3203 return "/[rd]";
3205 case EXACT_DIV_EXPR:
3206 return "/[ex]";
3208 case TRUNC_MOD_EXPR:
3209 return "%";
3211 case CEIL_MOD_EXPR:
3212 return "%[cl]";
3214 case FLOOR_MOD_EXPR:
3215 return "%[fl]";
3217 case ROUND_MOD_EXPR:
3218 return "%[rd]";
3220 case PREDECREMENT_EXPR:
3221 return " --";
3223 case PREINCREMENT_EXPR:
3224 return " ++";
3226 case POSTDECREMENT_EXPR:
3227 return "-- ";
3229 case POSTINCREMENT_EXPR:
3230 return "++ ";
3232 case MAX_EXPR:
3233 return "max";
3235 case MIN_EXPR:
3236 return "min";
3238 default:
3239 return "<<< ??? >>>";
3243 /* Return the symbol associated with operator OP. */
3245 static const char *
3246 op_symbol (const_tree op)
3248 return op_symbol_code (TREE_CODE (op));
3251 /* Prints the name of a call. NODE is the CALL_EXPR_FN of a CALL_EXPR or
3252 the gimple_call_fn of a GIMPLE_CALL. */
3254 void
3255 print_call_name (pretty_printer *pp, tree node, int flags)
3257 tree op0 = node;
3259 if (TREE_CODE (op0) == NON_LVALUE_EXPR)
3260 op0 = TREE_OPERAND (op0, 0);
3262 again:
3263 switch (TREE_CODE (op0))
3265 case VAR_DECL:
3266 case PARM_DECL:
3267 case FUNCTION_DECL:
3268 dump_function_name (pp, op0, flags);
3269 break;
3271 case ADDR_EXPR:
3272 case INDIRECT_REF:
3273 CASE_CONVERT:
3274 op0 = TREE_OPERAND (op0, 0);
3275 goto again;
3277 case COND_EXPR:
3278 pp_left_paren (pp);
3279 dump_generic_node (pp, TREE_OPERAND (op0, 0), 0, flags, false);
3280 pp_string (pp, ") ? ");
3281 dump_generic_node (pp, TREE_OPERAND (op0, 1), 0, flags, false);
3282 pp_string (pp, " : ");
3283 dump_generic_node (pp, TREE_OPERAND (op0, 2), 0, flags, false);
3284 break;
3286 case ARRAY_REF:
3287 if (TREE_CODE (TREE_OPERAND (op0, 0)) == VAR_DECL)
3288 dump_function_name (pp, TREE_OPERAND (op0, 0), flags);
3289 else
3290 dump_generic_node (pp, op0, 0, flags, false);
3291 break;
3293 case MEM_REF:
3294 if (integer_zerop (TREE_OPERAND (op0, 1)))
3296 op0 = TREE_OPERAND (op0, 0);
3297 goto again;
3299 /* Fallthru. */
3300 case COMPONENT_REF:
3301 case SSA_NAME:
3302 case OBJ_TYPE_REF:
3303 dump_generic_node (pp, op0, 0, flags, false);
3304 break;
3306 default:
3307 NIY;
3311 /* Parses the string STR and replaces new-lines by '\n', tabs by '\t', ... */
3313 static void
3314 pretty_print_string (pretty_printer *pp, const char *str)
3316 if (str == NULL)
3317 return;
3319 while (*str)
3321 switch (str[0])
3323 case '\b':
3324 pp_string (pp, "\\b");
3325 break;
3327 case '\f':
3328 pp_string (pp, "\\f");
3329 break;
3331 case '\n':
3332 pp_string (pp, "\\n");
3333 break;
3335 case '\r':
3336 pp_string (pp, "\\r");
3337 break;
3339 case '\t':
3340 pp_string (pp, "\\t");
3341 break;
3343 case '\v':
3344 pp_string (pp, "\\v");
3345 break;
3347 case '\\':
3348 pp_string (pp, "\\\\");
3349 break;
3351 case '\"':
3352 pp_string (pp, "\\\"");
3353 break;
3355 case '\'':
3356 pp_string (pp, "\\'");
3357 break;
3359 /* No need to handle \0; the loop terminates on \0. */
3361 case '\1':
3362 pp_string (pp, "\\1");
3363 break;
3365 case '\2':
3366 pp_string (pp, "\\2");
3367 break;
3369 case '\3':
3370 pp_string (pp, "\\3");
3371 break;
3373 case '\4':
3374 pp_string (pp, "\\4");
3375 break;
3377 case '\5':
3378 pp_string (pp, "\\5");
3379 break;
3381 case '\6':
3382 pp_string (pp, "\\6");
3383 break;
3385 case '\7':
3386 pp_string (pp, "\\7");
3387 break;
3389 default:
3390 pp_character (pp, str[0]);
3391 break;
3393 str++;
3397 static void
3398 maybe_init_pretty_print (FILE *file)
3400 if (!tree_pp)
3402 tree_pp = new pretty_printer ();
3403 pp_needs_newline (tree_pp) = true;
3404 pp_translate_identifiers (tree_pp) = false;
3407 tree_pp->buffer->stream = file;
3410 static void
3411 newline_and_indent (pretty_printer *pp, int spc)
3413 pp_newline (pp);
3414 INDENT (spc);
3417 /* Handle a %K format for TEXT. Separate from default_tree_printer so
3418 it can also be used in front ends.
3419 %K: a statement, from which EXPR_LOCATION and TREE_BLOCK will be recorded.
3422 void
3423 percent_K_format (text_info *text)
3425 tree t = va_arg (*text->args_ptr, tree), block;
3426 gcc_assert (text->locus != NULL);
3427 *text->locus = EXPR_LOCATION (t);
3428 gcc_assert (pp_ti_abstract_origin (text) != NULL);
3429 block = TREE_BLOCK (t);
3430 *pp_ti_abstract_origin (text) = NULL;
3432 if (in_lto_p)
3434 /* ??? LTO drops all BLOCK_ABSTRACT_ORIGINs apart from those
3435 representing the outermost block of an inlined function.
3436 So walk the BLOCK tree until we hit such a scope. */
3437 while (block
3438 && TREE_CODE (block) == BLOCK)
3440 if (inlined_function_outer_scope_p (block))
3442 *pp_ti_abstract_origin (text) = block;
3443 break;
3445 block = BLOCK_SUPERCONTEXT (block);
3447 return;
3450 while (block
3451 && TREE_CODE (block) == BLOCK
3452 && BLOCK_ABSTRACT_ORIGIN (block))
3454 tree ao = BLOCK_ABSTRACT_ORIGIN (block);
3456 while (TREE_CODE (ao) == BLOCK
3457 && BLOCK_ABSTRACT_ORIGIN (ao)
3458 && BLOCK_ABSTRACT_ORIGIN (ao) != ao)
3459 ao = BLOCK_ABSTRACT_ORIGIN (ao);
3461 if (TREE_CODE (ao) == FUNCTION_DECL)
3463 *pp_ti_abstract_origin (text) = block;
3464 break;
3466 block = BLOCK_SUPERCONTEXT (block);
3470 /* Print the identifier ID to PRETTY-PRINTER. */
3472 void
3473 pp_tree_identifier (pretty_printer *pp, tree id)
3475 if (pp_translate_identifiers (pp))
3477 const char *text = identifier_to_locale (IDENTIFIER_POINTER (id));
3478 pp_append_text (pp, text, text + strlen (text));
3480 else
3481 pp_append_text (pp, IDENTIFIER_POINTER (id),
3482 IDENTIFIER_POINTER (id) + IDENTIFIER_LENGTH (id));
3485 /* A helper function that is used to dump function information before the
3486 function dump. */
3488 void
3489 dump_function_header (FILE *dump_file, tree fdecl, int flags)
3491 const char *dname, *aname;
3492 struct cgraph_node *node = cgraph_node::get (fdecl);
3493 struct function *fun = DECL_STRUCT_FUNCTION (fdecl);
3495 dname = lang_hooks.decl_printable_name (fdecl, 2);
3497 if (DECL_ASSEMBLER_NAME_SET_P (fdecl))
3498 aname = (IDENTIFIER_POINTER
3499 (DECL_ASSEMBLER_NAME (fdecl)));
3500 else
3501 aname = "<unset-asm-name>";
3503 fprintf (dump_file, "\n;; Function %s (%s, funcdef_no=%d",
3504 dname, aname, fun->funcdef_no);
3505 if (!(flags & TDF_NOUID))
3506 fprintf (dump_file, ", decl_uid=%d", DECL_UID (fdecl));
3507 if (node)
3509 fprintf (dump_file, ", cgraph_uid=%d", node->uid);
3510 fprintf (dump_file, ", symbol_order=%d)%s\n\n", node->order,
3511 node->frequency == NODE_FREQUENCY_HOT
3512 ? " (hot)"
3513 : node->frequency == NODE_FREQUENCY_UNLIKELY_EXECUTED
3514 ? " (unlikely executed)"
3515 : node->frequency == NODE_FREQUENCY_EXECUTED_ONCE
3516 ? " (executed once)"
3517 : "");
3519 else
3520 fprintf (dump_file, ")\n\n");
3523 /* Dump double_int D to pretty_printer PP. UNS is true
3524 if D is unsigned and false otherwise. */
3525 void
3526 pp_double_int (pretty_printer *pp, double_int d, bool uns)
3528 if (d.fits_shwi ())
3529 pp_wide_integer (pp, d.low);
3530 else if (d.fits_uhwi ())
3531 pp_unsigned_wide_integer (pp, d.low);
3532 else
3534 unsigned HOST_WIDE_INT low = d.low;
3535 HOST_WIDE_INT high = d.high;
3536 if (!uns && d.is_negative ())
3538 pp_minus (pp);
3539 high = ~high + !low;
3540 low = -low;
3542 /* Would "%x%0*x" or "%x%*0x" get zero-padding on all
3543 systems? */
3544 sprintf (pp_buffer (pp)->digit_buffer,
3545 HOST_WIDE_INT_PRINT_DOUBLE_HEX,
3546 (unsigned HOST_WIDE_INT) high, low);
3547 pp_string (pp, pp_buffer (pp)->digit_buffer);