GCC Rust: Parsing in floats now
[official-gcc.git] / gcc / tree-pretty-print.c
blob83d5ca62d6c5c7b79ebd381d9008f46f28a09c1e
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 "pointer-set.h"
31 #include "gimple-expr.h"
32 #include "cgraph.h"
33 #include "langhooks.h"
34 #include "tree-iterator.h"
35 #include "tree-chrec.h"
36 #include "dumpfile.h"
37 #include "value-prof.h"
38 #include "predict.h"
40 #include <new> // For placement-new.
42 /* Local functions, macros and variables. */
43 static const char *op_symbol (const_tree);
44 static void pretty_print_string (pretty_printer *, const char*);
45 static void newline_and_indent (pretty_printer *, int);
46 static void maybe_init_pretty_print (FILE *);
47 static void print_struct_decl (pretty_printer *, const_tree, int, int);
48 static void do_niy (pretty_printer *, const_tree);
50 #define INDENT(SPACE) do { \
51 int i; for (i = 0; i<SPACE; i++) pp_space (buffer); } while (0)
53 #define NIY do_niy (buffer, node)
55 static pretty_printer buffer;
56 static int initialized = 0;
58 /* Try to print something for an unknown tree code. */
60 static void
61 do_niy (pretty_printer *buffer, const_tree node)
63 int i, len;
65 pp_string (buffer, "<<< Unknown tree: ");
66 pp_string (buffer, get_tree_code_name (TREE_CODE (node)));
68 if (EXPR_P (node))
70 len = TREE_OPERAND_LENGTH (node);
71 for (i = 0; i < len; ++i)
73 newline_and_indent (buffer, 2);
74 dump_generic_node (buffer, TREE_OPERAND (node, i), 2, 0, false);
78 pp_string (buffer, " >>>");
81 /* Debugging function to print out a generic expression. */
83 DEBUG_FUNCTION void
84 debug_generic_expr (tree t)
86 print_generic_expr (stderr, t, TDF_VOPS|TDF_MEMSYMS);
87 fprintf (stderr, "\n");
90 /* Debugging function to print out a generic statement. */
92 DEBUG_FUNCTION void
93 debug_generic_stmt (tree t)
95 print_generic_stmt (stderr, t, TDF_VOPS|TDF_MEMSYMS);
96 fprintf (stderr, "\n");
99 /* Debugging function to print out a chain of trees . */
101 DEBUG_FUNCTION void
102 debug_tree_chain (tree t)
104 struct pointer_set_t *seen = pointer_set_create ();
106 while (t)
108 print_generic_expr (stderr, t, TDF_VOPS|TDF_MEMSYMS|TDF_UID);
109 fprintf (stderr, " ");
110 t = TREE_CHAIN (t);
111 if (pointer_set_insert (seen, t))
113 fprintf (stderr, "... [cycled back to ");
114 print_generic_expr (stderr, t, TDF_VOPS|TDF_MEMSYMS|TDF_UID);
115 fprintf (stderr, "]");
116 break;
119 fprintf (stderr, "\n");
121 pointer_set_destroy (seen);
124 /* Prints declaration DECL to the FILE with details specified by FLAGS. */
125 void
126 print_generic_decl (FILE *file, tree decl, int flags)
128 maybe_init_pretty_print (file);
129 print_declaration (&buffer, decl, 2, flags);
130 pp_write_text_to_stream (&buffer);
133 /* Print tree T, and its successors, on file FILE. FLAGS specifies details
134 to show in the dump. See TDF_* in dumpfile.h. */
136 void
137 print_generic_stmt (FILE *file, tree t, int flags)
139 maybe_init_pretty_print (file);
140 dump_generic_node (&buffer, t, 0, flags, true);
141 pp_newline_and_flush (&buffer);
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. */
148 void
149 print_generic_stmt_indented (FILE *file, tree t, int flags, int indent)
151 int i;
153 maybe_init_pretty_print (file);
155 for (i = 0; i < indent; i++)
156 pp_space (&buffer);
157 dump_generic_node (&buffer, t, indent, flags, true);
158 pp_newline_and_flush (&buffer);
161 /* Print a single expression T on file FILE. FLAGS specifies details to show
162 in the dump. See TDF_* in dumpfile.h. */
164 void
165 print_generic_expr (FILE *file, tree t, int flags)
167 maybe_init_pretty_print (file);
168 dump_generic_node (&buffer, t, 0, flags, false);
169 pp_flush (&buffer);
172 /* Dump the name of a _DECL node and its DECL_UID if TDF_UID is set
173 in FLAGS. */
175 static void
176 dump_decl_name (pretty_printer *buffer, tree node, int flags)
178 if (DECL_NAME (node))
180 if ((flags & TDF_ASMNAME) && DECL_ASSEMBLER_NAME_SET_P (node))
181 pp_tree_identifier (buffer, DECL_ASSEMBLER_NAME (node));
182 else
183 pp_tree_identifier (buffer, DECL_NAME (node));
185 if ((flags & TDF_UID) || DECL_NAME (node) == NULL_TREE)
187 if (TREE_CODE (node) == LABEL_DECL && LABEL_DECL_UID (node) != -1)
188 pp_printf (buffer, "L.%d", (int) LABEL_DECL_UID (node));
189 else if (TREE_CODE (node) == DEBUG_EXPR_DECL)
191 if (flags & TDF_NOUID)
192 pp_string (buffer, "D#xxxx");
193 else
194 pp_printf (buffer, "D#%i", DEBUG_TEMP_UID (node));
196 else
198 char c = TREE_CODE (node) == CONST_DECL ? 'C' : 'D';
199 if (flags & TDF_NOUID)
200 pp_printf (buffer, "%c.xxxx", c);
201 else
202 pp_printf (buffer, "%c.%u", c, DECL_UID (node));
205 if ((flags & TDF_ALIAS) && DECL_PT_UID (node) != DECL_UID (node))
207 if (flags & TDF_NOUID)
208 pp_printf (buffer, "ptD.xxxx");
209 else
210 pp_printf (buffer, "ptD.%u", DECL_PT_UID (node));
214 /* Like the above, but used for pretty printing function calls. */
216 static void
217 dump_function_name (pretty_printer *buffer, tree node, int flags)
219 if (TREE_CODE (node) == NOP_EXPR)
220 node = TREE_OPERAND (node, 0);
221 if (DECL_NAME (node) && (flags & TDF_ASMNAME) == 0)
222 pp_string (buffer, lang_hooks.decl_printable_name (node, 1));
223 else
224 dump_decl_name (buffer, node, flags);
227 /* Dump a function declaration. NODE is the FUNCTION_TYPE. BUFFER, SPC and
228 FLAGS are as in dump_generic_node. */
230 static void
231 dump_function_declaration (pretty_printer *buffer, tree node,
232 int spc, int flags)
234 bool wrote_arg = false;
235 tree arg;
237 pp_space (buffer);
238 pp_left_paren (buffer);
240 /* Print the argument types. */
241 arg = TYPE_ARG_TYPES (node);
242 while (arg && arg != void_list_node && arg != error_mark_node)
244 if (wrote_arg)
246 pp_comma (buffer);
247 pp_space (buffer);
249 wrote_arg = true;
250 dump_generic_node (buffer, TREE_VALUE (arg), spc, flags, false);
251 arg = TREE_CHAIN (arg);
254 /* Drop the trailing void_type_node if we had any previous argument. */
255 if (arg == void_list_node && !wrote_arg)
256 pp_string (buffer, "void");
257 /* Properly dump vararg function types. */
258 else if (!arg && wrote_arg)
259 pp_string (buffer, ", ...");
260 /* Avoid printing any arg for unprototyped functions. */
262 pp_right_paren (buffer);
265 /* Dump the domain associated with an array. */
267 static void
268 dump_array_domain (pretty_printer *buffer, tree domain, int spc, int flags)
270 pp_left_bracket (buffer);
271 if (domain)
273 tree min = TYPE_MIN_VALUE (domain);
274 tree max = TYPE_MAX_VALUE (domain);
276 if (min && max
277 && integer_zerop (min)
278 && tree_fits_shwi_p (max))
279 pp_wide_integer (buffer, tree_to_shwi (max) + 1);
280 else
282 if (min)
283 dump_generic_node (buffer, min, spc, flags, false);
284 pp_colon (buffer);
285 if (max)
286 dump_generic_node (buffer, max, spc, flags, false);
289 else
290 pp_string (buffer, "<unknown>");
291 pp_right_bracket (buffer);
295 /* Dump OpenMP clause CLAUSE. BUFFER, CLAUSE, SPC and FLAGS are as in
296 dump_generic_node. */
298 static void
299 dump_omp_clause (pretty_printer *buffer, tree clause, int spc, int flags)
301 const char *name;
303 switch (OMP_CLAUSE_CODE (clause))
305 case OMP_CLAUSE_PRIVATE:
306 name = "private";
307 goto print_remap;
308 case OMP_CLAUSE_SHARED:
309 name = "shared";
310 goto print_remap;
311 case OMP_CLAUSE_FIRSTPRIVATE:
312 name = "firstprivate";
313 goto print_remap;
314 case OMP_CLAUSE_LASTPRIVATE:
315 name = "lastprivate";
316 goto print_remap;
317 case OMP_CLAUSE_COPYIN:
318 name = "copyin";
319 goto print_remap;
320 case OMP_CLAUSE_COPYPRIVATE:
321 name = "copyprivate";
322 goto print_remap;
323 case OMP_CLAUSE_UNIFORM:
324 name = "uniform";
325 goto print_remap;
326 case OMP_CLAUSE__LOOPTEMP_:
327 name = "_looptemp_";
328 goto print_remap;
329 print_remap:
330 pp_string (buffer, name);
331 pp_left_paren (buffer);
332 dump_generic_node (buffer, OMP_CLAUSE_DECL (clause),
333 spc, flags, false);
334 pp_right_paren (buffer);
335 break;
337 case OMP_CLAUSE_REDUCTION:
338 pp_string (buffer, "reduction(");
339 if (OMP_CLAUSE_REDUCTION_CODE (clause) != ERROR_MARK)
341 pp_string (buffer,
342 op_symbol_code (OMP_CLAUSE_REDUCTION_CODE (clause)));
343 pp_colon (buffer);
345 dump_generic_node (buffer, OMP_CLAUSE_DECL (clause),
346 spc, flags, false);
347 pp_right_paren (buffer);
348 break;
350 case OMP_CLAUSE_IF:
351 pp_string (buffer, "if(");
352 dump_generic_node (buffer, OMP_CLAUSE_IF_EXPR (clause),
353 spc, flags, false);
354 pp_right_paren (buffer);
355 break;
357 case OMP_CLAUSE_NUM_THREADS:
358 pp_string (buffer, "num_threads(");
359 dump_generic_node (buffer, OMP_CLAUSE_NUM_THREADS_EXPR (clause),
360 spc, flags, false);
361 pp_right_paren (buffer);
362 break;
364 case OMP_CLAUSE_NOWAIT:
365 pp_string (buffer, "nowait");
366 break;
367 case OMP_CLAUSE_ORDERED:
368 pp_string (buffer, "ordered");
369 break;
371 case OMP_CLAUSE_DEFAULT:
372 pp_string (buffer, "default(");
373 switch (OMP_CLAUSE_DEFAULT_KIND (clause))
375 case OMP_CLAUSE_DEFAULT_UNSPECIFIED:
376 break;
377 case OMP_CLAUSE_DEFAULT_SHARED:
378 pp_string (buffer, "shared");
379 break;
380 case OMP_CLAUSE_DEFAULT_NONE:
381 pp_string (buffer, "none");
382 break;
383 case OMP_CLAUSE_DEFAULT_PRIVATE:
384 pp_string (buffer, "private");
385 break;
386 case OMP_CLAUSE_DEFAULT_FIRSTPRIVATE:
387 pp_string (buffer, "firstprivate");
388 break;
389 default:
390 gcc_unreachable ();
392 pp_right_paren (buffer);
393 break;
395 case OMP_CLAUSE_SCHEDULE:
396 pp_string (buffer, "schedule(");
397 switch (OMP_CLAUSE_SCHEDULE_KIND (clause))
399 case OMP_CLAUSE_SCHEDULE_STATIC:
400 pp_string (buffer, "static");
401 break;
402 case OMP_CLAUSE_SCHEDULE_DYNAMIC:
403 pp_string (buffer, "dynamic");
404 break;
405 case OMP_CLAUSE_SCHEDULE_GUIDED:
406 pp_string (buffer, "guided");
407 break;
408 case OMP_CLAUSE_SCHEDULE_RUNTIME:
409 pp_string (buffer, "runtime");
410 break;
411 case OMP_CLAUSE_SCHEDULE_AUTO:
412 pp_string (buffer, "auto");
413 break;
414 default:
415 gcc_unreachable ();
417 if (OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (clause))
419 pp_comma (buffer);
420 dump_generic_node (buffer, OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (clause),
421 spc, flags, false);
423 pp_right_paren (buffer);
424 break;
426 case OMP_CLAUSE_UNTIED:
427 pp_string (buffer, "untied");
428 break;
430 case OMP_CLAUSE_COLLAPSE:
431 pp_string (buffer, "collapse(");
432 dump_generic_node (buffer, OMP_CLAUSE_COLLAPSE_EXPR (clause),
433 spc, flags, false);
434 pp_right_paren (buffer);
435 break;
437 case OMP_CLAUSE_FINAL:
438 pp_string (buffer, "final(");
439 dump_generic_node (buffer, OMP_CLAUSE_FINAL_EXPR (clause),
440 spc, flags, false);
441 pp_right_paren (buffer);
442 break;
444 case OMP_CLAUSE_MERGEABLE:
445 pp_string (buffer, "mergeable");
446 break;
448 case OMP_CLAUSE_LINEAR:
449 pp_string (buffer, "linear(");
450 dump_generic_node (buffer, OMP_CLAUSE_DECL (clause),
451 spc, flags, false);
452 pp_colon (buffer);
453 dump_generic_node (buffer, OMP_CLAUSE_LINEAR_STEP (clause),
454 spc, flags, false);
455 pp_right_paren (buffer);
456 break;
458 case OMP_CLAUSE_ALIGNED:
459 pp_string (buffer, "aligned(");
460 dump_generic_node (buffer, OMP_CLAUSE_DECL (clause),
461 spc, flags, false);
462 if (OMP_CLAUSE_ALIGNED_ALIGNMENT (clause))
464 pp_colon (buffer);
465 dump_generic_node (buffer, OMP_CLAUSE_ALIGNED_ALIGNMENT (clause),
466 spc, flags, false);
468 pp_right_paren (buffer);
469 break;
471 case OMP_CLAUSE_DEPEND:
472 pp_string (buffer, "depend(");
473 switch (OMP_CLAUSE_DEPEND_KIND (clause))
475 case OMP_CLAUSE_DEPEND_IN:
476 pp_string (buffer, "in");
477 break;
478 case OMP_CLAUSE_DEPEND_OUT:
479 pp_string (buffer, "out");
480 break;
481 case OMP_CLAUSE_DEPEND_INOUT:
482 pp_string (buffer, "inout");
483 break;
484 default:
485 gcc_unreachable ();
487 pp_colon (buffer);
488 dump_generic_node (buffer, OMP_CLAUSE_DECL (clause),
489 spc, flags, false);
490 pp_right_paren (buffer);
491 break;
493 case OMP_CLAUSE_MAP:
494 pp_string (buffer, "map(");
495 switch (OMP_CLAUSE_MAP_KIND (clause))
497 case OMP_CLAUSE_MAP_ALLOC:
498 case OMP_CLAUSE_MAP_POINTER:
499 pp_string (buffer, "alloc");
500 break;
501 case OMP_CLAUSE_MAP_TO:
502 pp_string (buffer, "to");
503 break;
504 case OMP_CLAUSE_MAP_FROM:
505 pp_string (buffer, "from");
506 break;
507 case OMP_CLAUSE_MAP_TOFROM:
508 pp_string (buffer, "tofrom");
509 break;
510 default:
511 gcc_unreachable ();
513 pp_colon (buffer);
514 dump_generic_node (buffer, OMP_CLAUSE_DECL (clause),
515 spc, flags, false);
516 print_clause_size:
517 if (OMP_CLAUSE_SIZE (clause))
519 if (OMP_CLAUSE_CODE (clause) == OMP_CLAUSE_MAP
520 && OMP_CLAUSE_MAP_KIND (clause) == OMP_CLAUSE_MAP_POINTER)
521 pp_string (buffer, " [pointer assign, bias: ");
522 else
523 pp_string (buffer, " [len: ");
524 dump_generic_node (buffer, OMP_CLAUSE_SIZE (clause),
525 spc, flags, false);
526 pp_right_bracket (buffer);
528 pp_right_paren (buffer);
529 break;
531 case OMP_CLAUSE_FROM:
532 pp_string (buffer, "from(");
533 dump_generic_node (buffer, OMP_CLAUSE_DECL (clause),
534 spc, flags, false);
535 goto print_clause_size;
537 case OMP_CLAUSE_TO:
538 pp_string (buffer, "to(");
539 dump_generic_node (buffer, OMP_CLAUSE_DECL (clause),
540 spc, flags, false);
541 goto print_clause_size;
543 case OMP_CLAUSE_NUM_TEAMS:
544 pp_string (buffer, "num_teams(");
545 dump_generic_node (buffer, OMP_CLAUSE_NUM_TEAMS_EXPR (clause),
546 spc, flags, false);
547 pp_right_paren (buffer);
548 break;
550 case OMP_CLAUSE_THREAD_LIMIT:
551 pp_string (buffer, "thread_limit(");
552 dump_generic_node (buffer, OMP_CLAUSE_THREAD_LIMIT_EXPR (clause),
553 spc, flags, false);
554 pp_right_paren (buffer);
555 break;
557 case OMP_CLAUSE_DEVICE:
558 pp_string (buffer, "device(");
559 dump_generic_node (buffer, OMP_CLAUSE_DEVICE_ID (clause),
560 spc, flags, false);
561 pp_right_paren (buffer);
562 break;
564 case OMP_CLAUSE_DIST_SCHEDULE:
565 pp_string (buffer, "dist_schedule(static");
566 if (OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR (clause))
568 pp_comma (buffer);
569 dump_generic_node (buffer,
570 OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR (clause),
571 spc, flags, false);
573 pp_right_paren (buffer);
574 break;
576 case OMP_CLAUSE_PROC_BIND:
577 pp_string (buffer, "proc_bind(");
578 switch (OMP_CLAUSE_PROC_BIND_KIND (clause))
580 case OMP_CLAUSE_PROC_BIND_MASTER:
581 pp_string (buffer, "master");
582 break;
583 case OMP_CLAUSE_PROC_BIND_CLOSE:
584 pp_string (buffer, "close");
585 break;
586 case OMP_CLAUSE_PROC_BIND_SPREAD:
587 pp_string (buffer, "spread");
588 break;
589 default:
590 gcc_unreachable ();
592 pp_right_paren (buffer);
593 break;
595 case OMP_CLAUSE_SAFELEN:
596 pp_string (buffer, "safelen(");
597 dump_generic_node (buffer, OMP_CLAUSE_SAFELEN_EXPR (clause),
598 spc, flags, false);
599 pp_right_paren (buffer);
600 break;
602 case OMP_CLAUSE_SIMDLEN:
603 pp_string (buffer, "simdlen(");
604 dump_generic_node (buffer, OMP_CLAUSE_SIMDLEN_EXPR (clause),
605 spc, flags, false);
606 pp_right_paren (buffer);
607 break;
609 case OMP_CLAUSE__SIMDUID_:
610 pp_string (buffer, "_simduid_(");
611 dump_generic_node (buffer, OMP_CLAUSE__SIMDUID__DECL (clause),
612 spc, flags, false);
613 pp_right_paren (buffer);
614 break;
616 case OMP_CLAUSE_INBRANCH:
617 pp_string (buffer, "inbranch");
618 break;
619 case OMP_CLAUSE_NOTINBRANCH:
620 pp_string (buffer, "notinbranch");
621 break;
622 case OMP_CLAUSE_FOR:
623 pp_string (buffer, "for");
624 break;
625 case OMP_CLAUSE_PARALLEL:
626 pp_string (buffer, "parallel");
627 break;
628 case OMP_CLAUSE_SECTIONS:
629 pp_string (buffer, "sections");
630 break;
631 case OMP_CLAUSE_TASKGROUP:
632 pp_string (buffer, "taskgroup");
633 break;
635 default:
636 /* Should never happen. */
637 dump_generic_node (buffer, clause, spc, flags, false);
638 break;
643 /* Dump the list of OpenMP clauses. BUFFER, SPC and FLAGS are as in
644 dump_generic_node. */
646 void
647 dump_omp_clauses (pretty_printer *buffer, tree clause, int spc, int flags)
649 if (clause == NULL)
650 return;
652 pp_space (buffer);
653 while (1)
655 dump_omp_clause (buffer, clause, spc, flags);
656 clause = OMP_CLAUSE_CHAIN (clause);
657 if (clause == NULL)
658 return;
659 pp_space (buffer);
664 /* Dump location LOC to BUFFER. */
666 static void
667 dump_location (pretty_printer *buffer, location_t loc)
669 expanded_location xloc = expand_location (loc);
671 pp_left_bracket (buffer);
672 if (xloc.file)
674 pp_string (buffer, xloc.file);
675 pp_string (buffer, " : ");
677 pp_decimal_int (buffer, xloc.line);
678 pp_string (buffer, "] ");
682 /* Dump lexical block BLOCK. BUFFER, SPC and FLAGS are as in
683 dump_generic_node. */
685 static void
686 dump_block_node (pretty_printer *buffer, tree block, int spc, int flags)
688 tree t;
690 pp_printf (buffer, "BLOCK #%d ", BLOCK_NUMBER (block));
692 if (flags & TDF_ADDRESS)
693 pp_printf (buffer, "[%p] ", (void *) block);
695 if (BLOCK_ABSTRACT (block))
696 pp_string (buffer, "[abstract] ");
698 if (TREE_ASM_WRITTEN (block))
699 pp_string (buffer, "[written] ");
701 if (flags & TDF_SLIM)
702 return;
704 if (BLOCK_SOURCE_LOCATION (block))
705 dump_location (buffer, BLOCK_SOURCE_LOCATION (block));
707 newline_and_indent (buffer, spc + 2);
709 if (BLOCK_SUPERCONTEXT (block))
711 pp_string (buffer, "SUPERCONTEXT: ");
712 dump_generic_node (buffer, BLOCK_SUPERCONTEXT (block), 0,
713 flags | TDF_SLIM, false);
714 newline_and_indent (buffer, spc + 2);
717 if (BLOCK_SUBBLOCKS (block))
719 pp_string (buffer, "SUBBLOCKS: ");
720 for (t = BLOCK_SUBBLOCKS (block); t; t = BLOCK_CHAIN (t))
722 dump_generic_node (buffer, t, 0, flags | TDF_SLIM, false);
723 pp_space (buffer);
725 newline_and_indent (buffer, spc + 2);
728 if (BLOCK_CHAIN (block))
730 pp_string (buffer, "SIBLINGS: ");
731 for (t = BLOCK_CHAIN (block); t; t = BLOCK_CHAIN (t))
733 dump_generic_node (buffer, t, 0, flags | TDF_SLIM, false);
734 pp_space (buffer);
736 newline_and_indent (buffer, spc + 2);
739 if (BLOCK_VARS (block))
741 pp_string (buffer, "VARS: ");
742 for (t = BLOCK_VARS (block); t; t = TREE_CHAIN (t))
744 dump_generic_node (buffer, t, 0, flags, false);
745 pp_space (buffer);
747 newline_and_indent (buffer, spc + 2);
750 if (vec_safe_length (BLOCK_NONLOCALIZED_VARS (block)) > 0)
752 unsigned i;
753 vec<tree, va_gc> *nlv = BLOCK_NONLOCALIZED_VARS (block);
755 pp_string (buffer, "NONLOCALIZED_VARS: ");
756 FOR_EACH_VEC_ELT (*nlv, i, t)
758 dump_generic_node (buffer, t, 0, flags, false);
759 pp_space (buffer);
761 newline_and_indent (buffer, spc + 2);
764 if (BLOCK_ABSTRACT_ORIGIN (block))
766 pp_string (buffer, "ABSTRACT_ORIGIN: ");
767 dump_generic_node (buffer, BLOCK_ABSTRACT_ORIGIN (block), 0,
768 flags | TDF_SLIM, false);
769 newline_and_indent (buffer, spc + 2);
772 if (BLOCK_FRAGMENT_ORIGIN (block))
774 pp_string (buffer, "FRAGMENT_ORIGIN: ");
775 dump_generic_node (buffer, BLOCK_FRAGMENT_ORIGIN (block), 0,
776 flags | TDF_SLIM, false);
777 newline_and_indent (buffer, spc + 2);
780 if (BLOCK_FRAGMENT_CHAIN (block))
782 pp_string (buffer, "FRAGMENT_CHAIN: ");
783 for (t = BLOCK_FRAGMENT_CHAIN (block); t; t = BLOCK_FRAGMENT_CHAIN (t))
785 dump_generic_node (buffer, t, 0, flags | TDF_SLIM, false);
786 pp_space (buffer);
788 newline_and_indent (buffer, spc + 2);
793 /* Dump the node NODE on the pretty_printer BUFFER, SPC spaces of
794 indent. FLAGS specifies details to show in the dump (see TDF_* in
795 dumpfile.h). If IS_STMT is true, the object printed is considered
796 to be a statement and it is terminated by ';' if appropriate. */
799 dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
800 bool is_stmt)
802 tree type;
803 tree op0, op1;
804 const char *str;
805 bool is_expr;
806 enum tree_code code;
808 if (node == NULL_TREE)
809 return spc;
811 is_expr = EXPR_P (node);
813 if (is_stmt && (flags & TDF_STMTADDR))
814 pp_printf (buffer, "<&%p> ", (void *)node);
816 if ((flags & TDF_LINENO) && EXPR_HAS_LOCATION (node))
817 dump_location (buffer, EXPR_LOCATION (node));
819 code = TREE_CODE (node);
820 switch (code)
822 case ERROR_MARK:
823 pp_string (buffer, "<<< error >>>");
824 break;
826 case IDENTIFIER_NODE:
827 pp_tree_identifier (buffer, node);
828 break;
830 case TREE_LIST:
831 while (node && node != error_mark_node)
833 if (TREE_PURPOSE (node))
835 dump_generic_node (buffer, TREE_PURPOSE (node), spc, flags, false);
836 pp_space (buffer);
838 dump_generic_node (buffer, TREE_VALUE (node), spc, flags, false);
839 node = TREE_CHAIN (node);
840 if (node && TREE_CODE (node) == TREE_LIST)
842 pp_comma (buffer);
843 pp_space (buffer);
846 break;
848 case TREE_BINFO:
849 dump_generic_node (buffer, BINFO_TYPE (node), spc, flags, false);
850 break;
852 case TREE_VEC:
854 size_t i;
855 if (TREE_VEC_LENGTH (node) > 0)
857 size_t len = TREE_VEC_LENGTH (node);
858 for (i = 0; i < len - 1; i++)
860 dump_generic_node (buffer, TREE_VEC_ELT (node, i), spc, flags,
861 false);
862 pp_comma (buffer);
863 pp_space (buffer);
865 dump_generic_node (buffer, TREE_VEC_ELT (node, len - 1), spc,
866 flags, false);
869 break;
871 case VOID_TYPE:
872 case INTEGER_TYPE:
873 case REAL_TYPE:
874 case FIXED_POINT_TYPE:
875 case COMPLEX_TYPE:
876 case VECTOR_TYPE:
877 case ENUMERAL_TYPE:
878 case BOOLEAN_TYPE:
880 unsigned int quals = TYPE_QUALS (node);
881 enum tree_code_class tclass;
883 if (quals & TYPE_QUAL_ATOMIC)
884 pp_string (buffer, "atomic ");
885 if (quals & TYPE_QUAL_CONST)
886 pp_string (buffer, "const ");
887 else if (quals & TYPE_QUAL_VOLATILE)
888 pp_string (buffer, "volatile ");
889 else if (quals & TYPE_QUAL_RESTRICT)
890 pp_string (buffer, "restrict ");
892 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node)))
894 pp_string (buffer, "<address-space-");
895 pp_decimal_int (buffer, TYPE_ADDR_SPACE (node));
896 pp_string (buffer, "> ");
899 tclass = TREE_CODE_CLASS (TREE_CODE (node));
901 if (tclass == tcc_declaration)
903 if (DECL_NAME (node))
904 dump_decl_name (buffer, node, flags);
905 else
906 pp_string (buffer, "<unnamed type decl>");
908 else if (tclass == tcc_type)
910 if (TYPE_NAME (node))
912 if (TREE_CODE (TYPE_NAME (node)) == IDENTIFIER_NODE)
913 pp_tree_identifier (buffer, TYPE_NAME (node));
914 else if (TREE_CODE (TYPE_NAME (node)) == TYPE_DECL
915 && DECL_NAME (TYPE_NAME (node)))
916 dump_decl_name (buffer, TYPE_NAME (node), flags);
917 else
918 pp_string (buffer, "<unnamed type>");
920 else if (TREE_CODE (node) == VECTOR_TYPE)
922 pp_string (buffer, "vector");
923 pp_left_paren (buffer);
924 pp_wide_integer (buffer, TYPE_VECTOR_SUBPARTS (node));
925 pp_string (buffer, ") ");
926 dump_generic_node (buffer, TREE_TYPE (node), spc, flags, false);
928 else if (TREE_CODE (node) == INTEGER_TYPE)
930 if (TYPE_PRECISION (node) == CHAR_TYPE_SIZE)
931 pp_string (buffer, (TYPE_UNSIGNED (node)
932 ? "unsigned char"
933 : "signed char"));
934 else if (TYPE_PRECISION (node) == SHORT_TYPE_SIZE)
935 pp_string (buffer, (TYPE_UNSIGNED (node)
936 ? "unsigned short"
937 : "signed short"));
938 else if (TYPE_PRECISION (node) == INT_TYPE_SIZE)
939 pp_string (buffer, (TYPE_UNSIGNED (node)
940 ? "unsigned int"
941 : "signed int"));
942 else if (TYPE_PRECISION (node) == LONG_TYPE_SIZE)
943 pp_string (buffer, (TYPE_UNSIGNED (node)
944 ? "unsigned long"
945 : "signed long"));
946 else if (TYPE_PRECISION (node) == LONG_LONG_TYPE_SIZE)
947 pp_string (buffer, (TYPE_UNSIGNED (node)
948 ? "unsigned long long"
949 : "signed long long"));
950 else if (TYPE_PRECISION (node) >= CHAR_TYPE_SIZE
951 && exact_log2 (TYPE_PRECISION (node)) != -1)
953 pp_string (buffer, (TYPE_UNSIGNED (node) ? "uint" : "int"));
954 pp_decimal_int (buffer, TYPE_PRECISION (node));
955 pp_string (buffer, "_t");
957 else
959 pp_string (buffer, (TYPE_UNSIGNED (node)
960 ? "<unnamed-unsigned:"
961 : "<unnamed-signed:"));
962 pp_decimal_int (buffer, TYPE_PRECISION (node));
963 pp_greater (buffer);
966 else if (TREE_CODE (node) == COMPLEX_TYPE)
968 pp_string (buffer, "__complex__ ");
969 dump_generic_node (buffer, TREE_TYPE (node), spc, flags, false);
971 else if (TREE_CODE (node) == REAL_TYPE)
973 pp_string (buffer, "<float:");
974 pp_decimal_int (buffer, TYPE_PRECISION (node));
975 pp_greater (buffer);
977 else if (TREE_CODE (node) == FIXED_POINT_TYPE)
979 pp_string (buffer, "<fixed-point-");
980 pp_string (buffer, TYPE_SATURATING (node) ? "sat:" : "nonsat:");
981 pp_decimal_int (buffer, TYPE_PRECISION (node));
982 pp_greater (buffer);
984 else if (TREE_CODE (node) == VOID_TYPE)
985 pp_string (buffer, "void");
986 else
987 pp_string (buffer, "<unnamed type>");
989 break;
992 case POINTER_TYPE:
993 case REFERENCE_TYPE:
994 str = (TREE_CODE (node) == POINTER_TYPE ? "*" : "&");
996 if (TREE_TYPE (node) == NULL)
998 pp_string (buffer, str);
999 pp_string (buffer, "<null type>");
1001 else if (TREE_CODE (TREE_TYPE (node)) == FUNCTION_TYPE)
1003 tree fnode = TREE_TYPE (node);
1005 dump_generic_node (buffer, TREE_TYPE (fnode), spc, flags, false);
1006 pp_space (buffer);
1007 pp_left_paren (buffer);
1008 pp_string (buffer, str);
1009 if (TYPE_NAME (node) && DECL_NAME (TYPE_NAME (node)))
1010 dump_decl_name (buffer, TYPE_NAME (node), flags);
1011 else if (flags & TDF_NOUID)
1012 pp_printf (buffer, "<Txxxx>");
1013 else
1014 pp_printf (buffer, "<T%x>", TYPE_UID (node));
1016 pp_right_paren (buffer);
1017 dump_function_declaration (buffer, fnode, spc, flags);
1019 else
1021 unsigned int quals = TYPE_QUALS (node);
1023 dump_generic_node (buffer, TREE_TYPE (node), spc, flags, false);
1024 pp_space (buffer);
1025 pp_string (buffer, str);
1027 if (quals & TYPE_QUAL_CONST)
1028 pp_string (buffer, " const");
1029 if (quals & TYPE_QUAL_VOLATILE)
1030 pp_string (buffer, " volatile");
1031 if (quals & TYPE_QUAL_RESTRICT)
1032 pp_string (buffer, " restrict");
1034 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node)))
1036 pp_string (buffer, " <address-space-");
1037 pp_decimal_int (buffer, TYPE_ADDR_SPACE (node));
1038 pp_greater (buffer);
1041 if (TYPE_REF_CAN_ALIAS_ALL (node))
1042 pp_string (buffer, " {ref-all}");
1044 break;
1046 case OFFSET_TYPE:
1047 NIY;
1048 break;
1050 case MEM_REF:
1052 if (integer_zerop (TREE_OPERAND (node, 1))
1053 /* Dump the types of INTEGER_CSTs explicitly, for we can't
1054 infer them and MEM_ATTR caching will share MEM_REFs
1055 with differently-typed op0s. */
1056 && TREE_CODE (TREE_OPERAND (node, 0)) != INTEGER_CST
1057 /* Released SSA_NAMES have no TREE_TYPE. */
1058 && TREE_TYPE (TREE_OPERAND (node, 0)) != NULL_TREE
1059 /* Same pointer types, but ignoring POINTER_TYPE vs.
1060 REFERENCE_TYPE. */
1061 && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node, 0)))
1062 == TREE_TYPE (TREE_TYPE (TREE_OPERAND (node, 1))))
1063 && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (node, 0)))
1064 == TYPE_MODE (TREE_TYPE (TREE_OPERAND (node, 1))))
1065 && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node, 0)))
1066 == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node, 1))))
1067 /* Same value types ignoring qualifiers. */
1068 && (TYPE_MAIN_VARIANT (TREE_TYPE (node))
1069 == TYPE_MAIN_VARIANT
1070 (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node, 1))))))
1072 if (TREE_CODE (TREE_OPERAND (node, 0)) != ADDR_EXPR)
1074 pp_star (buffer);
1075 dump_generic_node (buffer, TREE_OPERAND (node, 0),
1076 spc, flags, false);
1078 else
1079 dump_generic_node (buffer,
1080 TREE_OPERAND (TREE_OPERAND (node, 0), 0),
1081 spc, flags, false);
1083 else
1085 tree ptype;
1087 pp_string (buffer, "MEM[");
1088 pp_left_paren (buffer);
1089 ptype = TYPE_MAIN_VARIANT (TREE_TYPE (TREE_OPERAND (node, 1)));
1090 dump_generic_node (buffer, ptype,
1091 spc, flags | TDF_SLIM, false);
1092 pp_right_paren (buffer);
1093 dump_generic_node (buffer, TREE_OPERAND (node, 0),
1094 spc, flags, false);
1095 if (!integer_zerop (TREE_OPERAND (node, 1)))
1097 pp_string (buffer, " + ");
1098 dump_generic_node (buffer, TREE_OPERAND (node, 1),
1099 spc, flags, false);
1101 pp_right_bracket (buffer);
1103 break;
1106 case TARGET_MEM_REF:
1108 const char *sep = "";
1109 tree tmp;
1111 pp_string (buffer, "MEM[");
1113 if (TREE_CODE (TMR_BASE (node)) == ADDR_EXPR)
1115 pp_string (buffer, sep);
1116 sep = ", ";
1117 pp_string (buffer, "symbol: ");
1118 dump_generic_node (buffer, TREE_OPERAND (TMR_BASE (node), 0),
1119 spc, flags, false);
1121 else
1123 pp_string (buffer, sep);
1124 sep = ", ";
1125 pp_string (buffer, "base: ");
1126 dump_generic_node (buffer, TMR_BASE (node), spc, flags, false);
1128 tmp = TMR_INDEX2 (node);
1129 if (tmp)
1131 pp_string (buffer, sep);
1132 sep = ", ";
1133 pp_string (buffer, "base: ");
1134 dump_generic_node (buffer, tmp, spc, flags, false);
1136 tmp = TMR_INDEX (node);
1137 if (tmp)
1139 pp_string (buffer, sep);
1140 sep = ", ";
1141 pp_string (buffer, "index: ");
1142 dump_generic_node (buffer, tmp, spc, flags, false);
1144 tmp = TMR_STEP (node);
1145 if (tmp)
1147 pp_string (buffer, sep);
1148 sep = ", ";
1149 pp_string (buffer, "step: ");
1150 dump_generic_node (buffer, tmp, spc, flags, false);
1152 tmp = TMR_OFFSET (node);
1153 if (tmp)
1155 pp_string (buffer, sep);
1156 sep = ", ";
1157 pp_string (buffer, "offset: ");
1158 dump_generic_node (buffer, tmp, spc, flags, false);
1160 pp_right_bracket (buffer);
1162 break;
1164 case ARRAY_TYPE:
1166 tree tmp;
1168 /* Print the innermost component type. */
1169 for (tmp = TREE_TYPE (node); TREE_CODE (tmp) == ARRAY_TYPE;
1170 tmp = TREE_TYPE (tmp))
1172 dump_generic_node (buffer, tmp, spc, flags, false);
1174 /* Print the dimensions. */
1175 for (tmp = node; TREE_CODE (tmp) == ARRAY_TYPE; tmp = TREE_TYPE (tmp))
1176 dump_array_domain (buffer, TYPE_DOMAIN (tmp), spc, flags);
1177 break;
1180 case RECORD_TYPE:
1181 case UNION_TYPE:
1182 case QUAL_UNION_TYPE:
1184 unsigned int quals = TYPE_QUALS (node);
1186 if (quals & TYPE_QUAL_ATOMIC)
1187 pp_string (buffer, "atomic ");
1188 if (quals & TYPE_QUAL_CONST)
1189 pp_string (buffer, "const ");
1190 if (quals & TYPE_QUAL_VOLATILE)
1191 pp_string (buffer, "volatile ");
1193 /* Print the name of the structure. */
1194 if (TREE_CODE (node) == RECORD_TYPE)
1195 pp_string (buffer, "struct ");
1196 else if (TREE_CODE (node) == UNION_TYPE)
1197 pp_string (buffer, "union ");
1199 if (TYPE_NAME (node))
1200 dump_generic_node (buffer, TYPE_NAME (node), spc, flags, false);
1201 else if (!(flags & TDF_SLIM))
1202 /* FIXME: If we eliminate the 'else' above and attempt
1203 to show the fields for named types, we may get stuck
1204 following a cycle of pointers to structs. The alleged
1205 self-reference check in print_struct_decl will not detect
1206 cycles involving more than one pointer or struct type. */
1207 print_struct_decl (buffer, node, spc, flags);
1208 break;
1211 case LANG_TYPE:
1212 NIY;
1213 break;
1215 case INTEGER_CST:
1216 if (TREE_CODE (TREE_TYPE (node)) == POINTER_TYPE)
1218 /* In the case of a pointer, one may want to divide by the
1219 size of the pointed-to type. Unfortunately, this not
1220 straightforward. The C front-end maps expressions
1222 (int *) 5
1223 int *p; (p + 5)
1225 in such a way that the two INTEGER_CST nodes for "5" have
1226 different values but identical types. In the latter
1227 case, the 5 is multiplied by sizeof (int) in c-common.c
1228 (pointer_int_sum) to convert it to a byte address, and
1229 yet the type of the node is left unchanged. Argh. What
1230 is consistent though is that the number value corresponds
1231 to bytes (UNITS) offset.
1233 NB: Neither of the following divisors can be trivially
1234 used to recover the original literal:
1236 TREE_INT_CST_LOW (TYPE_SIZE_UNIT (TREE_TYPE (node)))
1237 TYPE_PRECISION (TREE_TYPE (TREE_TYPE (node))) */
1238 pp_wide_integer (buffer, TREE_INT_CST_LOW (node));
1239 pp_string (buffer, "B"); /* pseudo-unit */
1241 else
1242 pp_double_int (buffer, tree_to_double_int (node),
1243 TYPE_UNSIGNED (TREE_TYPE (node)));
1244 if (TREE_OVERFLOW (node))
1245 pp_string (buffer, "(OVF)");
1246 break;
1248 case REAL_CST:
1249 /* Code copied from print_node. */
1251 REAL_VALUE_TYPE d;
1252 if (TREE_OVERFLOW (node))
1253 pp_string (buffer, " overflow");
1255 #if !defined(REAL_IS_NOT_DOUBLE) || defined(REAL_ARITHMETIC)
1256 d = TREE_REAL_CST (node);
1257 if (REAL_VALUE_ISINF (d))
1258 pp_string (buffer, REAL_VALUE_NEGATIVE (d) ? " -Inf" : " Inf");
1259 else if (REAL_VALUE_ISNAN (d))
1260 pp_string (buffer, " Nan");
1261 else
1263 char string[100];
1264 real_to_decimal (string, &d, sizeof (string), 0, 1);
1265 pp_string (buffer, string);
1267 #else
1269 HOST_WIDE_INT i;
1270 unsigned char *p = (unsigned char *) &TREE_REAL_CST (node);
1271 pp_string (buffer, "0x");
1272 for (i = 0; i < sizeof TREE_REAL_CST (node); i++)
1273 output_formatted_integer (buffer, "%02x", *p++);
1275 #endif
1276 break;
1279 case FIXED_CST:
1281 char string[100];
1282 fixed_to_decimal (string, TREE_FIXED_CST_PTR (node), sizeof (string));
1283 pp_string (buffer, string);
1284 break;
1287 case COMPLEX_CST:
1288 pp_string (buffer, "__complex__ (");
1289 dump_generic_node (buffer, TREE_REALPART (node), spc, flags, false);
1290 pp_string (buffer, ", ");
1291 dump_generic_node (buffer, TREE_IMAGPART (node), spc, flags, false);
1292 pp_right_paren (buffer);
1293 break;
1295 case STRING_CST:
1296 pp_string (buffer, "\"");
1297 pretty_print_string (buffer, TREE_STRING_POINTER (node));
1298 pp_string (buffer, "\"");
1299 break;
1301 case VECTOR_CST:
1303 unsigned i;
1304 pp_string (buffer, "{ ");
1305 for (i = 0; i < VECTOR_CST_NELTS (node); ++i)
1307 if (i != 0)
1308 pp_string (buffer, ", ");
1309 dump_generic_node (buffer, VECTOR_CST_ELT (node, i),
1310 spc, flags, false);
1312 pp_string (buffer, " }");
1314 break;
1316 case FUNCTION_TYPE:
1317 case METHOD_TYPE:
1318 dump_generic_node (buffer, TREE_TYPE (node), spc, flags, false);
1319 pp_space (buffer);
1320 if (TREE_CODE (node) == METHOD_TYPE)
1322 if (TYPE_METHOD_BASETYPE (node))
1323 dump_decl_name (buffer, TYPE_NAME (TYPE_METHOD_BASETYPE (node)),
1324 flags);
1325 else
1326 pp_string (buffer, "<null method basetype>");
1327 pp_colon_colon (buffer);
1329 if (TYPE_NAME (node) && DECL_NAME (TYPE_NAME (node)))
1330 dump_decl_name (buffer, TYPE_NAME (node), flags);
1331 else if (flags & TDF_NOUID)
1332 pp_printf (buffer, "<Txxxx>");
1333 else
1334 pp_printf (buffer, "<T%x>", TYPE_UID (node));
1335 dump_function_declaration (buffer, node, spc, flags);
1336 break;
1338 case FUNCTION_DECL:
1339 case CONST_DECL:
1340 dump_decl_name (buffer, node, flags);
1341 break;
1343 case LABEL_DECL:
1344 if (DECL_NAME (node))
1345 dump_decl_name (buffer, node, flags);
1346 else if (LABEL_DECL_UID (node) != -1)
1347 pp_printf (buffer, "<L%d>", (int) LABEL_DECL_UID (node));
1348 else
1350 if (flags & TDF_NOUID)
1351 pp_string (buffer, "<D.xxxx>");
1352 else
1353 pp_printf (buffer, "<D.%u>", DECL_UID (node));
1355 break;
1357 case TYPE_DECL:
1358 if (DECL_IS_BUILTIN (node))
1360 /* Don't print the declaration of built-in types. */
1361 break;
1363 if (DECL_NAME (node))
1364 dump_decl_name (buffer, node, flags);
1365 else if (TYPE_NAME (TREE_TYPE (node)) != node)
1367 if ((TREE_CODE (TREE_TYPE (node)) == RECORD_TYPE
1368 || TREE_CODE (TREE_TYPE (node)) == UNION_TYPE)
1369 && TYPE_METHODS (TREE_TYPE (node)))
1371 /* The type is a c++ class: all structures have at least
1372 4 methods. */
1373 pp_string (buffer, "class ");
1374 dump_generic_node (buffer, TREE_TYPE (node), spc, flags, false);
1376 else
1378 pp_string (buffer,
1379 (TREE_CODE (TREE_TYPE (node)) == UNION_TYPE
1380 ? "union" : "struct "));
1381 dump_generic_node (buffer, TREE_TYPE (node), spc, flags, false);
1384 else
1385 pp_string (buffer, "<anon>");
1386 break;
1388 case VAR_DECL:
1389 case PARM_DECL:
1390 case FIELD_DECL:
1391 case DEBUG_EXPR_DECL:
1392 case NAMESPACE_DECL:
1393 case NAMELIST_DECL:
1394 dump_decl_name (buffer, node, flags);
1395 break;
1397 case RESULT_DECL:
1398 pp_string (buffer, "<retval>");
1399 break;
1401 case COMPONENT_REF:
1402 op0 = TREE_OPERAND (node, 0);
1403 str = ".";
1404 if (op0
1405 && (TREE_CODE (op0) == INDIRECT_REF
1406 || (TREE_CODE (op0) == MEM_REF
1407 && TREE_CODE (TREE_OPERAND (op0, 0)) != ADDR_EXPR
1408 && integer_zerop (TREE_OPERAND (op0, 1))
1409 /* Dump the types of INTEGER_CSTs explicitly, for we
1410 can't infer them and MEM_ATTR caching will share
1411 MEM_REFs with differently-typed op0s. */
1412 && TREE_CODE (TREE_OPERAND (op0, 0)) != INTEGER_CST
1413 /* Released SSA_NAMES have no TREE_TYPE. */
1414 && TREE_TYPE (TREE_OPERAND (op0, 0)) != NULL_TREE
1415 /* Same pointer types, but ignoring POINTER_TYPE vs.
1416 REFERENCE_TYPE. */
1417 && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0, 0)))
1418 == TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0, 1))))
1419 && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0, 0)))
1420 == TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0, 1))))
1421 && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0, 0)))
1422 == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0, 1))))
1423 /* Same value types ignoring qualifiers. */
1424 && (TYPE_MAIN_VARIANT (TREE_TYPE (op0))
1425 == TYPE_MAIN_VARIANT
1426 (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0, 1))))))))
1428 op0 = TREE_OPERAND (op0, 0);
1429 str = "->";
1431 if (op_prio (op0) < op_prio (node))
1432 pp_left_paren (buffer);
1433 dump_generic_node (buffer, op0, spc, flags, false);
1434 if (op_prio (op0) < op_prio (node))
1435 pp_right_paren (buffer);
1436 pp_string (buffer, str);
1437 dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
1438 op0 = component_ref_field_offset (node);
1439 if (op0 && TREE_CODE (op0) != INTEGER_CST)
1441 pp_string (buffer, "{off: ");
1442 dump_generic_node (buffer, op0, spc, flags, false);
1443 pp_right_brace (buffer);
1445 break;
1447 case BIT_FIELD_REF:
1448 pp_string (buffer, "BIT_FIELD_REF <");
1449 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1450 pp_string (buffer, ", ");
1451 dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
1452 pp_string (buffer, ", ");
1453 dump_generic_node (buffer, TREE_OPERAND (node, 2), spc, flags, false);
1454 pp_greater (buffer);
1455 break;
1457 case ARRAY_REF:
1458 case ARRAY_RANGE_REF:
1459 op0 = TREE_OPERAND (node, 0);
1460 if (op_prio (op0) < op_prio (node))
1461 pp_left_paren (buffer);
1462 dump_generic_node (buffer, op0, spc, flags, false);
1463 if (op_prio (op0) < op_prio (node))
1464 pp_right_paren (buffer);
1465 pp_left_bracket (buffer);
1466 dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
1467 if (TREE_CODE (node) == ARRAY_RANGE_REF)
1468 pp_string (buffer, " ...");
1469 pp_right_bracket (buffer);
1471 op0 = array_ref_low_bound (node);
1472 op1 = array_ref_element_size (node);
1474 if (!integer_zerop (op0)
1475 || TREE_OPERAND (node, 2)
1476 || TREE_OPERAND (node, 3))
1478 pp_string (buffer, "{lb: ");
1479 dump_generic_node (buffer, op0, spc, flags, false);
1480 pp_string (buffer, " sz: ");
1481 dump_generic_node (buffer, op1, spc, flags, false);
1482 pp_right_brace (buffer);
1484 break;
1486 case CONSTRUCTOR:
1488 unsigned HOST_WIDE_INT ix;
1489 tree field, val;
1490 bool is_struct_init = false;
1491 bool is_array_init = false;
1492 double_int curidx = double_int_zero;
1493 pp_left_brace (buffer);
1494 if (TREE_CLOBBER_P (node))
1495 pp_string (buffer, "CLOBBER");
1496 else if (TREE_CODE (TREE_TYPE (node)) == RECORD_TYPE
1497 || TREE_CODE (TREE_TYPE (node)) == UNION_TYPE)
1498 is_struct_init = true;
1499 else if (TREE_CODE (TREE_TYPE (node)) == ARRAY_TYPE
1500 && TYPE_DOMAIN (TREE_TYPE (node))
1501 && TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node)))
1502 && TREE_CODE (TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node))))
1503 == INTEGER_CST)
1505 tree minv = TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node)));
1506 is_array_init = true;
1507 curidx = tree_to_double_int (minv);
1509 FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (node), ix, field, val)
1511 if (field)
1513 if (is_struct_init)
1515 pp_dot (buffer);
1516 dump_generic_node (buffer, field, spc, flags, false);
1517 pp_equal (buffer);
1519 else if (is_array_init
1520 && (TREE_CODE (field) != INTEGER_CST
1521 || tree_to_double_int (field) != curidx))
1523 pp_left_bracket (buffer);
1524 if (TREE_CODE (field) == RANGE_EXPR)
1526 dump_generic_node (buffer, TREE_OPERAND (field, 0), spc,
1527 flags, false);
1528 pp_string (buffer, " ... ");
1529 dump_generic_node (buffer, TREE_OPERAND (field, 1), spc,
1530 flags, false);
1531 if (TREE_CODE (TREE_OPERAND (field, 1)) == INTEGER_CST)
1532 curidx = tree_to_double_int (TREE_OPERAND (field, 1));
1534 else
1535 dump_generic_node (buffer, field, spc, flags, false);
1536 if (TREE_CODE (field) == INTEGER_CST)
1537 curidx = tree_to_double_int (field);
1538 pp_string (buffer, "]=");
1541 if (is_array_init)
1542 curidx += double_int_one;
1543 if (val && TREE_CODE (val) == ADDR_EXPR)
1544 if (TREE_CODE (TREE_OPERAND (val, 0)) == FUNCTION_DECL)
1545 val = TREE_OPERAND (val, 0);
1546 if (val && TREE_CODE (val) == FUNCTION_DECL)
1547 dump_decl_name (buffer, val, flags);
1548 else
1549 dump_generic_node (buffer, val, spc, flags, false);
1550 if (ix != vec_safe_length (CONSTRUCTOR_ELTS (node)) - 1)
1552 pp_comma (buffer);
1553 pp_space (buffer);
1556 pp_right_brace (buffer);
1558 break;
1560 case COMPOUND_EXPR:
1562 tree *tp;
1563 if (flags & TDF_SLIM)
1565 pp_string (buffer, "<COMPOUND_EXPR>");
1566 break;
1569 dump_generic_node (buffer, TREE_OPERAND (node, 0),
1570 spc, flags, !(flags & TDF_SLIM));
1571 if (flags & TDF_SLIM)
1572 newline_and_indent (buffer, spc);
1573 else
1575 pp_comma (buffer);
1576 pp_space (buffer);
1579 for (tp = &TREE_OPERAND (node, 1);
1580 TREE_CODE (*tp) == COMPOUND_EXPR;
1581 tp = &TREE_OPERAND (*tp, 1))
1583 dump_generic_node (buffer, TREE_OPERAND (*tp, 0),
1584 spc, flags, !(flags & TDF_SLIM));
1585 if (flags & TDF_SLIM)
1586 newline_and_indent (buffer, spc);
1587 else
1589 pp_comma (buffer);
1590 pp_space (buffer);
1594 dump_generic_node (buffer, *tp, spc, flags, !(flags & TDF_SLIM));
1596 break;
1598 case STATEMENT_LIST:
1600 tree_stmt_iterator si;
1601 bool first = true;
1603 if (flags & TDF_SLIM)
1605 pp_string (buffer, "<STATEMENT_LIST>");
1606 break;
1609 for (si = tsi_start (node); !tsi_end_p (si); tsi_next (&si))
1611 if (!first)
1612 newline_and_indent (buffer, spc);
1613 else
1614 first = false;
1615 dump_generic_node (buffer, tsi_stmt (si), spc, flags, true);
1618 break;
1620 case MODIFY_EXPR:
1621 case INIT_EXPR:
1622 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags,
1623 false);
1624 pp_space (buffer);
1625 pp_equal (buffer);
1626 pp_space (buffer);
1627 dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags,
1628 false);
1629 break;
1631 case TARGET_EXPR:
1632 pp_string (buffer, "TARGET_EXPR <");
1633 dump_generic_node (buffer, TARGET_EXPR_SLOT (node), spc, flags, false);
1634 pp_comma (buffer);
1635 pp_space (buffer);
1636 dump_generic_node (buffer, TARGET_EXPR_INITIAL (node), spc, flags, false);
1637 pp_greater (buffer);
1638 break;
1640 case DECL_EXPR:
1641 print_declaration (buffer, DECL_EXPR_DECL (node), spc, flags);
1642 is_stmt = false;
1643 break;
1645 case COND_EXPR:
1646 if (TREE_TYPE (node) == NULL || TREE_TYPE (node) == void_type_node)
1648 pp_string (buffer, "if (");
1649 dump_generic_node (buffer, COND_EXPR_COND (node), spc, flags, false);
1650 pp_right_paren (buffer);
1651 /* The lowered cond_exprs should always be printed in full. */
1652 if (COND_EXPR_THEN (node)
1653 && (IS_EMPTY_STMT (COND_EXPR_THEN (node))
1654 || TREE_CODE (COND_EXPR_THEN (node)) == GOTO_EXPR)
1655 && COND_EXPR_ELSE (node)
1656 && (IS_EMPTY_STMT (COND_EXPR_ELSE (node))
1657 || TREE_CODE (COND_EXPR_ELSE (node)) == GOTO_EXPR))
1659 pp_space (buffer);
1660 dump_generic_node (buffer, COND_EXPR_THEN (node),
1661 0, flags, true);
1662 if (!IS_EMPTY_STMT (COND_EXPR_ELSE (node)))
1664 pp_string (buffer, " else ");
1665 dump_generic_node (buffer, COND_EXPR_ELSE (node),
1666 0, flags, true);
1669 else if (!(flags & TDF_SLIM))
1671 /* Output COND_EXPR_THEN. */
1672 if (COND_EXPR_THEN (node))
1674 newline_and_indent (buffer, spc+2);
1675 pp_left_brace (buffer);
1676 newline_and_indent (buffer, spc+4);
1677 dump_generic_node (buffer, COND_EXPR_THEN (node), spc+4,
1678 flags, true);
1679 newline_and_indent (buffer, spc+2);
1680 pp_right_brace (buffer);
1683 /* Output COND_EXPR_ELSE. */
1684 if (COND_EXPR_ELSE (node)
1685 && !IS_EMPTY_STMT (COND_EXPR_ELSE (node)))
1687 newline_and_indent (buffer, spc);
1688 pp_string (buffer, "else");
1689 newline_and_indent (buffer, spc+2);
1690 pp_left_brace (buffer);
1691 newline_and_indent (buffer, spc+4);
1692 dump_generic_node (buffer, COND_EXPR_ELSE (node), spc+4,
1693 flags, true);
1694 newline_and_indent (buffer, spc+2);
1695 pp_right_brace (buffer);
1698 is_expr = false;
1700 else
1702 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1703 pp_space (buffer);
1704 pp_question (buffer);
1705 pp_space (buffer);
1706 dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
1707 pp_space (buffer);
1708 pp_colon (buffer);
1709 pp_space (buffer);
1710 dump_generic_node (buffer, TREE_OPERAND (node, 2), spc, flags, false);
1712 break;
1714 case BIND_EXPR:
1715 pp_left_brace (buffer);
1716 if (!(flags & TDF_SLIM))
1718 if (BIND_EXPR_VARS (node))
1720 pp_newline (buffer);
1722 for (op0 = BIND_EXPR_VARS (node); op0; op0 = DECL_CHAIN (op0))
1724 print_declaration (buffer, op0, spc+2, flags);
1725 pp_newline (buffer);
1729 newline_and_indent (buffer, spc+2);
1730 dump_generic_node (buffer, BIND_EXPR_BODY (node), spc+2, flags, true);
1731 newline_and_indent (buffer, spc);
1732 pp_right_brace (buffer);
1734 is_expr = false;
1735 break;
1737 case CALL_EXPR:
1738 print_call_name (buffer, CALL_EXPR_FN (node), flags);
1740 /* Print parameters. */
1741 pp_space (buffer);
1742 pp_left_paren (buffer);
1744 tree arg;
1745 call_expr_arg_iterator iter;
1746 FOR_EACH_CALL_EXPR_ARG (arg, iter, node)
1748 dump_generic_node (buffer, arg, spc, flags, false);
1749 if (more_call_expr_args_p (&iter))
1751 pp_comma (buffer);
1752 pp_space (buffer);
1756 if (CALL_EXPR_VA_ARG_PACK (node))
1758 if (call_expr_nargs (node) > 0)
1760 pp_comma (buffer);
1761 pp_space (buffer);
1763 pp_string (buffer, "__builtin_va_arg_pack ()");
1765 pp_right_paren (buffer);
1767 op1 = CALL_EXPR_STATIC_CHAIN (node);
1768 if (op1)
1770 pp_string (buffer, " [static-chain: ");
1771 dump_generic_node (buffer, op1, spc, flags, false);
1772 pp_right_bracket (buffer);
1775 if (CALL_EXPR_RETURN_SLOT_OPT (node))
1776 pp_string (buffer, " [return slot optimization]");
1777 if (CALL_EXPR_TAILCALL (node))
1778 pp_string (buffer, " [tail call]");
1779 break;
1781 case WITH_CLEANUP_EXPR:
1782 NIY;
1783 break;
1785 case CLEANUP_POINT_EXPR:
1786 pp_string (buffer, "<<cleanup_point ");
1787 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1788 pp_string (buffer, ">>");
1789 break;
1791 case PLACEHOLDER_EXPR:
1792 pp_string (buffer, "<PLACEHOLDER_EXPR ");
1793 dump_generic_node (buffer, TREE_TYPE (node), spc, flags, false);
1794 pp_greater (buffer);
1795 break;
1797 /* Binary arithmetic and logic expressions. */
1798 case WIDEN_SUM_EXPR:
1799 case WIDEN_MULT_EXPR:
1800 case MULT_EXPR:
1801 case MULT_HIGHPART_EXPR:
1802 case PLUS_EXPR:
1803 case POINTER_PLUS_EXPR:
1804 case MINUS_EXPR:
1805 case TRUNC_DIV_EXPR:
1806 case CEIL_DIV_EXPR:
1807 case FLOOR_DIV_EXPR:
1808 case ROUND_DIV_EXPR:
1809 case TRUNC_MOD_EXPR:
1810 case CEIL_MOD_EXPR:
1811 case FLOOR_MOD_EXPR:
1812 case ROUND_MOD_EXPR:
1813 case RDIV_EXPR:
1814 case EXACT_DIV_EXPR:
1815 case LSHIFT_EXPR:
1816 case RSHIFT_EXPR:
1817 case LROTATE_EXPR:
1818 case RROTATE_EXPR:
1819 case VEC_LSHIFT_EXPR:
1820 case VEC_RSHIFT_EXPR:
1821 case WIDEN_LSHIFT_EXPR:
1822 case BIT_IOR_EXPR:
1823 case BIT_XOR_EXPR:
1824 case BIT_AND_EXPR:
1825 case TRUTH_ANDIF_EXPR:
1826 case TRUTH_ORIF_EXPR:
1827 case TRUTH_AND_EXPR:
1828 case TRUTH_OR_EXPR:
1829 case TRUTH_XOR_EXPR:
1830 case LT_EXPR:
1831 case LE_EXPR:
1832 case GT_EXPR:
1833 case GE_EXPR:
1834 case EQ_EXPR:
1835 case NE_EXPR:
1836 case UNLT_EXPR:
1837 case UNLE_EXPR:
1838 case UNGT_EXPR:
1839 case UNGE_EXPR:
1840 case UNEQ_EXPR:
1841 case LTGT_EXPR:
1842 case ORDERED_EXPR:
1843 case UNORDERED_EXPR:
1845 const char *op = op_symbol (node);
1846 op0 = TREE_OPERAND (node, 0);
1847 op1 = TREE_OPERAND (node, 1);
1849 /* When the operands are expressions with less priority,
1850 keep semantics of the tree representation. */
1851 if (op_prio (op0) <= op_prio (node))
1853 pp_left_paren (buffer);
1854 dump_generic_node (buffer, op0, spc, flags, false);
1855 pp_right_paren (buffer);
1857 else
1858 dump_generic_node (buffer, op0, spc, flags, false);
1860 pp_space (buffer);
1861 pp_string (buffer, op);
1862 pp_space (buffer);
1864 /* When the operands are expressions with less priority,
1865 keep semantics of the tree representation. */
1866 if (op_prio (op1) <= op_prio (node))
1868 pp_left_paren (buffer);
1869 dump_generic_node (buffer, op1, spc, flags, false);
1870 pp_right_paren (buffer);
1872 else
1873 dump_generic_node (buffer, op1, spc, flags, false);
1875 break;
1877 /* Unary arithmetic and logic expressions. */
1878 case NEGATE_EXPR:
1879 case BIT_NOT_EXPR:
1880 case TRUTH_NOT_EXPR:
1881 case ADDR_EXPR:
1882 case PREDECREMENT_EXPR:
1883 case PREINCREMENT_EXPR:
1884 case INDIRECT_REF:
1885 if (TREE_CODE (node) == ADDR_EXPR
1886 && (TREE_CODE (TREE_OPERAND (node, 0)) == STRING_CST
1887 || TREE_CODE (TREE_OPERAND (node, 0)) == FUNCTION_DECL))
1888 ; /* Do not output '&' for strings and function pointers. */
1889 else
1890 pp_string (buffer, op_symbol (node));
1892 if (op_prio (TREE_OPERAND (node, 0)) < op_prio (node))
1894 pp_left_paren (buffer);
1895 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1896 pp_right_paren (buffer);
1898 else
1899 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1900 break;
1902 case POSTDECREMENT_EXPR:
1903 case POSTINCREMENT_EXPR:
1904 if (op_prio (TREE_OPERAND (node, 0)) < op_prio (node))
1906 pp_left_paren (buffer);
1907 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1908 pp_right_paren (buffer);
1910 else
1911 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1912 pp_string (buffer, op_symbol (node));
1913 break;
1915 case MIN_EXPR:
1916 pp_string (buffer, "MIN_EXPR <");
1917 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1918 pp_string (buffer, ", ");
1919 dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
1920 pp_greater (buffer);
1921 break;
1923 case MAX_EXPR:
1924 pp_string (buffer, "MAX_EXPR <");
1925 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1926 pp_string (buffer, ", ");
1927 dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
1928 pp_greater (buffer);
1929 break;
1931 case ABS_EXPR:
1932 pp_string (buffer, "ABS_EXPR <");
1933 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1934 pp_greater (buffer);
1935 break;
1937 case RANGE_EXPR:
1938 NIY;
1939 break;
1941 case ADDR_SPACE_CONVERT_EXPR:
1942 case FIXED_CONVERT_EXPR:
1943 case FIX_TRUNC_EXPR:
1944 case FLOAT_EXPR:
1945 CASE_CONVERT:
1946 type = TREE_TYPE (node);
1947 op0 = TREE_OPERAND (node, 0);
1948 if (type != TREE_TYPE (op0))
1950 pp_left_paren (buffer);
1951 dump_generic_node (buffer, type, spc, flags, false);
1952 pp_string (buffer, ") ");
1954 if (op_prio (op0) < op_prio (node))
1955 pp_left_paren (buffer);
1956 dump_generic_node (buffer, op0, spc, flags, false);
1957 if (op_prio (op0) < op_prio (node))
1958 pp_right_paren (buffer);
1959 break;
1961 case VIEW_CONVERT_EXPR:
1962 pp_string (buffer, "VIEW_CONVERT_EXPR<");
1963 dump_generic_node (buffer, TREE_TYPE (node), spc, flags, false);
1964 pp_string (buffer, ">(");
1965 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1966 pp_right_paren (buffer);
1967 break;
1969 case PAREN_EXPR:
1970 pp_string (buffer, "((");
1971 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1972 pp_string (buffer, "))");
1973 break;
1975 case NON_LVALUE_EXPR:
1976 pp_string (buffer, "NON_LVALUE_EXPR <");
1977 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1978 pp_greater (buffer);
1979 break;
1981 case SAVE_EXPR:
1982 pp_string (buffer, "SAVE_EXPR <");
1983 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1984 pp_greater (buffer);
1985 break;
1987 case COMPLEX_EXPR:
1988 pp_string (buffer, "COMPLEX_EXPR <");
1989 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1990 pp_string (buffer, ", ");
1991 dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
1992 pp_greater (buffer);
1993 break;
1995 case CONJ_EXPR:
1996 pp_string (buffer, "CONJ_EXPR <");
1997 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1998 pp_greater (buffer);
1999 break;
2001 case REALPART_EXPR:
2002 pp_string (buffer, "REALPART_EXPR <");
2003 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
2004 pp_greater (buffer);
2005 break;
2007 case IMAGPART_EXPR:
2008 pp_string (buffer, "IMAGPART_EXPR <");
2009 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
2010 pp_greater (buffer);
2011 break;
2013 case VA_ARG_EXPR:
2014 pp_string (buffer, "VA_ARG_EXPR <");
2015 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
2016 pp_greater (buffer);
2017 break;
2019 case TRY_FINALLY_EXPR:
2020 case TRY_CATCH_EXPR:
2021 pp_string (buffer, "try");
2022 newline_and_indent (buffer, spc+2);
2023 pp_left_brace (buffer);
2024 newline_and_indent (buffer, spc+4);
2025 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc+4, flags, true);
2026 newline_and_indent (buffer, spc+2);
2027 pp_right_brace (buffer);
2028 newline_and_indent (buffer, spc);
2029 pp_string (buffer,
2030 (TREE_CODE (node) == TRY_CATCH_EXPR) ? "catch" : "finally");
2031 newline_and_indent (buffer, spc+2);
2032 pp_left_brace (buffer);
2033 newline_and_indent (buffer, spc+4);
2034 dump_generic_node (buffer, TREE_OPERAND (node, 1), spc+4, flags, true);
2035 newline_and_indent (buffer, spc+2);
2036 pp_right_brace (buffer);
2037 is_expr = false;
2038 break;
2040 case CATCH_EXPR:
2041 pp_string (buffer, "catch (");
2042 dump_generic_node (buffer, CATCH_TYPES (node), spc+2, flags, false);
2043 pp_right_paren (buffer);
2044 newline_and_indent (buffer, spc+2);
2045 pp_left_brace (buffer);
2046 newline_and_indent (buffer, spc+4);
2047 dump_generic_node (buffer, CATCH_BODY (node), spc+4, flags, true);
2048 newline_and_indent (buffer, spc+2);
2049 pp_right_brace (buffer);
2050 is_expr = false;
2051 break;
2053 case EH_FILTER_EXPR:
2054 pp_string (buffer, "<<<eh_filter (");
2055 dump_generic_node (buffer, EH_FILTER_TYPES (node), spc+2, flags, false);
2056 pp_string (buffer, ")>>>");
2057 newline_and_indent (buffer, spc+2);
2058 pp_left_brace (buffer);
2059 newline_and_indent (buffer, spc+4);
2060 dump_generic_node (buffer, EH_FILTER_FAILURE (node), spc+4, flags, true);
2061 newline_and_indent (buffer, spc+2);
2062 pp_right_brace (buffer);
2063 is_expr = false;
2064 break;
2066 case LABEL_EXPR:
2067 op0 = TREE_OPERAND (node, 0);
2068 /* If this is for break or continue, don't bother printing it. */
2069 if (DECL_NAME (op0))
2071 const char *name = IDENTIFIER_POINTER (DECL_NAME (op0));
2072 if (strcmp (name, "break") == 0
2073 || strcmp (name, "continue") == 0)
2074 break;
2076 dump_generic_node (buffer, op0, spc, flags, false);
2077 pp_colon (buffer);
2078 if (DECL_NONLOCAL (op0))
2079 pp_string (buffer, " [non-local]");
2080 break;
2082 case LOOP_EXPR:
2083 pp_string (buffer, "while (1)");
2084 if (!(flags & TDF_SLIM))
2086 newline_and_indent (buffer, spc+2);
2087 pp_left_brace (buffer);
2088 newline_and_indent (buffer, spc+4);
2089 dump_generic_node (buffer, LOOP_EXPR_BODY (node), spc+4, flags, true);
2090 newline_and_indent (buffer, spc+2);
2091 pp_right_brace (buffer);
2093 is_expr = false;
2094 break;
2096 case PREDICT_EXPR:
2097 pp_string (buffer, "// predicted ");
2098 if (PREDICT_EXPR_OUTCOME (node))
2099 pp_string (buffer, "likely by ");
2100 else
2101 pp_string (buffer, "unlikely by ");
2102 pp_string (buffer, predictor_name (PREDICT_EXPR_PREDICTOR (node)));
2103 pp_string (buffer, " predictor.");
2104 break;
2106 case ANNOTATE_EXPR:
2107 pp_string (buffer, "ANNOTATE_EXPR <");
2108 switch ((enum annot_expr_kind) TREE_INT_CST_LOW (TREE_OPERAND (node, 1)))
2110 case annot_expr_ivdep_kind:
2111 pp_string (buffer, "ivdep, ");
2112 break;
2114 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
2115 pp_greater (buffer);
2116 break;
2118 case RETURN_EXPR:
2119 pp_string (buffer, "return");
2120 op0 = TREE_OPERAND (node, 0);
2121 if (op0)
2123 pp_space (buffer);
2124 if (TREE_CODE (op0) == MODIFY_EXPR)
2125 dump_generic_node (buffer, TREE_OPERAND (op0, 1),
2126 spc, flags, false);
2127 else
2128 dump_generic_node (buffer, op0, spc, flags, false);
2130 break;
2132 case EXIT_EXPR:
2133 pp_string (buffer, "if (");
2134 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
2135 pp_string (buffer, ") break");
2136 break;
2138 case SWITCH_EXPR:
2139 pp_string (buffer, "switch (");
2140 dump_generic_node (buffer, SWITCH_COND (node), spc, flags, false);
2141 pp_right_paren (buffer);
2142 if (!(flags & TDF_SLIM))
2144 newline_and_indent (buffer, spc+2);
2145 pp_left_brace (buffer);
2146 if (SWITCH_BODY (node))
2148 newline_and_indent (buffer, spc+4);
2149 dump_generic_node (buffer, SWITCH_BODY (node), spc+4, flags,
2150 true);
2152 else
2154 tree vec = SWITCH_LABELS (node);
2155 size_t i, n = TREE_VEC_LENGTH (vec);
2156 for (i = 0; i < n; ++i)
2158 tree elt = TREE_VEC_ELT (vec, i);
2159 newline_and_indent (buffer, spc+4);
2160 if (elt)
2162 dump_generic_node (buffer, elt, spc+4, flags, false);
2163 pp_string (buffer, " goto ");
2164 dump_generic_node (buffer, CASE_LABEL (elt), spc+4,
2165 flags, true);
2166 pp_semicolon (buffer);
2168 else
2169 pp_string (buffer, "case ???: goto ???;");
2172 newline_and_indent (buffer, spc+2);
2173 pp_right_brace (buffer);
2175 is_expr = false;
2176 break;
2178 case GOTO_EXPR:
2179 op0 = GOTO_DESTINATION (node);
2180 if (TREE_CODE (op0) != SSA_NAME && DECL_P (op0) && DECL_NAME (op0))
2182 const char *name = IDENTIFIER_POINTER (DECL_NAME (op0));
2183 if (strcmp (name, "break") == 0
2184 || strcmp (name, "continue") == 0)
2186 pp_string (buffer, name);
2187 break;
2190 pp_string (buffer, "goto ");
2191 dump_generic_node (buffer, op0, spc, flags, false);
2192 break;
2194 case ASM_EXPR:
2195 pp_string (buffer, "__asm__");
2196 if (ASM_VOLATILE_P (node))
2197 pp_string (buffer, " __volatile__");
2198 pp_left_paren (buffer);
2199 dump_generic_node (buffer, ASM_STRING (node), spc, flags, false);
2200 pp_colon (buffer);
2201 dump_generic_node (buffer, ASM_OUTPUTS (node), spc, flags, false);
2202 pp_colon (buffer);
2203 dump_generic_node (buffer, ASM_INPUTS (node), spc, flags, false);
2204 if (ASM_CLOBBERS (node))
2206 pp_colon (buffer);
2207 dump_generic_node (buffer, ASM_CLOBBERS (node), spc, flags, false);
2209 pp_right_paren (buffer);
2210 break;
2212 case CASE_LABEL_EXPR:
2213 if (CASE_LOW (node) && CASE_HIGH (node))
2215 pp_string (buffer, "case ");
2216 dump_generic_node (buffer, CASE_LOW (node), spc, flags, false);
2217 pp_string (buffer, " ... ");
2218 dump_generic_node (buffer, CASE_HIGH (node), spc, flags, false);
2220 else if (CASE_LOW (node))
2222 pp_string (buffer, "case ");
2223 dump_generic_node (buffer, CASE_LOW (node), spc, flags, false);
2225 else
2226 pp_string (buffer, "default");
2227 pp_colon (buffer);
2228 break;
2230 case OBJ_TYPE_REF:
2231 pp_string (buffer, "OBJ_TYPE_REF(");
2232 dump_generic_node (buffer, OBJ_TYPE_REF_EXPR (node), spc, flags, false);
2233 pp_semicolon (buffer);
2234 if (!(flags & TDF_SLIM) && virtual_method_call_p (node))
2236 pp_string (buffer, "(");
2237 dump_generic_node (buffer, obj_type_ref_class (node), spc, flags, false);
2238 pp_string (buffer, ")");
2240 dump_generic_node (buffer, OBJ_TYPE_REF_OBJECT (node), spc, flags, false);
2241 pp_arrow (buffer);
2242 dump_generic_node (buffer, OBJ_TYPE_REF_TOKEN (node), spc, flags, false);
2243 pp_right_paren (buffer);
2244 break;
2246 case SSA_NAME:
2247 if (SSA_NAME_IDENTIFIER (node))
2248 dump_generic_node (buffer, SSA_NAME_IDENTIFIER (node),
2249 spc, flags, false);
2250 pp_underscore (buffer);
2251 pp_decimal_int (buffer, SSA_NAME_VERSION (node));
2252 if (SSA_NAME_IS_DEFAULT_DEF (node))
2253 pp_string (buffer, "(D)");
2254 if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (node))
2255 pp_string (buffer, "(ab)");
2256 break;
2258 case WITH_SIZE_EXPR:
2259 pp_string (buffer, "WITH_SIZE_EXPR <");
2260 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
2261 pp_string (buffer, ", ");
2262 dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
2263 pp_greater (buffer);
2264 break;
2266 case ASSERT_EXPR:
2267 pp_string (buffer, "ASSERT_EXPR <");
2268 dump_generic_node (buffer, ASSERT_EXPR_VAR (node), spc, flags, false);
2269 pp_string (buffer, ", ");
2270 dump_generic_node (buffer, ASSERT_EXPR_COND (node), spc, flags, false);
2271 pp_greater (buffer);
2272 break;
2274 case SCEV_KNOWN:
2275 pp_string (buffer, "scev_known");
2276 break;
2278 case SCEV_NOT_KNOWN:
2279 pp_string (buffer, "scev_not_known");
2280 break;
2282 case POLYNOMIAL_CHREC:
2283 pp_left_brace (buffer);
2284 dump_generic_node (buffer, CHREC_LEFT (node), spc, flags, false);
2285 pp_string (buffer, ", +, ");
2286 dump_generic_node (buffer, CHREC_RIGHT (node), spc, flags, false);
2287 pp_string (buffer, "}_");
2288 dump_generic_node (buffer, CHREC_VAR (node), spc, flags, false);
2289 is_stmt = false;
2290 break;
2292 case REALIGN_LOAD_EXPR:
2293 pp_string (buffer, "REALIGN_LOAD <");
2294 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
2295 pp_string (buffer, ", ");
2296 dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
2297 pp_string (buffer, ", ");
2298 dump_generic_node (buffer, TREE_OPERAND (node, 2), spc, flags, false);
2299 pp_greater (buffer);
2300 break;
2302 case VEC_COND_EXPR:
2303 pp_string (buffer, " VEC_COND_EXPR < ");
2304 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
2305 pp_string (buffer, " , ");
2306 dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
2307 pp_string (buffer, " , ");
2308 dump_generic_node (buffer, TREE_OPERAND (node, 2), spc, flags, false);
2309 pp_string (buffer, " > ");
2310 break;
2312 case VEC_PERM_EXPR:
2313 pp_string (buffer, " VEC_PERM_EXPR < ");
2314 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
2315 pp_string (buffer, " , ");
2316 dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
2317 pp_string (buffer, " , ");
2318 dump_generic_node (buffer, TREE_OPERAND (node, 2), spc, flags, false);
2319 pp_string (buffer, " > ");
2320 break;
2322 case DOT_PROD_EXPR:
2323 pp_string (buffer, " DOT_PROD_EXPR < ");
2324 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
2325 pp_string (buffer, ", ");
2326 dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
2327 pp_string (buffer, ", ");
2328 dump_generic_node (buffer, TREE_OPERAND (node, 2), spc, flags, false);
2329 pp_string (buffer, " > ");
2330 break;
2332 case WIDEN_MULT_PLUS_EXPR:
2333 pp_string (buffer, " WIDEN_MULT_PLUS_EXPR < ");
2334 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
2335 pp_string (buffer, ", ");
2336 dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
2337 pp_string (buffer, ", ");
2338 dump_generic_node (buffer, TREE_OPERAND (node, 2), spc, flags, false);
2339 pp_string (buffer, " > ");
2340 break;
2342 case WIDEN_MULT_MINUS_EXPR:
2343 pp_string (buffer, " WIDEN_MULT_MINUS_EXPR < ");
2344 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
2345 pp_string (buffer, ", ");
2346 dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
2347 pp_string (buffer, ", ");
2348 dump_generic_node (buffer, TREE_OPERAND (node, 2), spc, flags, false);
2349 pp_string (buffer, " > ");
2350 break;
2352 case FMA_EXPR:
2353 pp_string (buffer, " FMA_EXPR < ");
2354 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
2355 pp_string (buffer, ", ");
2356 dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
2357 pp_string (buffer, ", ");
2358 dump_generic_node (buffer, TREE_OPERAND (node, 2), spc, flags, false);
2359 pp_string (buffer, " > ");
2360 break;
2362 case OMP_PARALLEL:
2363 pp_string (buffer, "#pragma omp parallel");
2364 dump_omp_clauses (buffer, OMP_PARALLEL_CLAUSES (node), spc, flags);
2366 dump_omp_body:
2367 if (!(flags & TDF_SLIM) && OMP_BODY (node))
2369 newline_and_indent (buffer, spc + 2);
2370 pp_left_brace (buffer);
2371 newline_and_indent (buffer, spc + 4);
2372 dump_generic_node (buffer, OMP_BODY (node), spc + 4, flags, false);
2373 newline_and_indent (buffer, spc + 2);
2374 pp_right_brace (buffer);
2376 is_expr = false;
2377 break;
2379 case OMP_TASK:
2380 pp_string (buffer, "#pragma omp task");
2381 dump_omp_clauses (buffer, OMP_TASK_CLAUSES (node), spc, flags);
2382 goto dump_omp_body;
2384 case OMP_FOR:
2385 pp_string (buffer, "#pragma omp for");
2386 goto dump_omp_loop;
2388 case OMP_SIMD:
2389 pp_string (buffer, "#pragma omp simd");
2390 goto dump_omp_loop;
2392 case CILK_SIMD:
2393 pp_string (buffer, "#pragma simd");
2394 goto dump_omp_loop;
2396 case OMP_DISTRIBUTE:
2397 pp_string (buffer, "#pragma omp distribute");
2398 goto dump_omp_loop;
2400 case OMP_TEAMS:
2401 pp_string (buffer, "#pragma omp teams");
2402 dump_omp_clauses (buffer, OMP_TEAMS_CLAUSES (node), spc, flags);
2403 goto dump_omp_body;
2405 case OMP_TARGET_DATA:
2406 pp_string (buffer, "#pragma omp target data");
2407 dump_omp_clauses (buffer, OMP_TARGET_DATA_CLAUSES (node), spc, flags);
2408 goto dump_omp_body;
2410 case OMP_TARGET:
2411 pp_string (buffer, "#pragma omp target");
2412 dump_omp_clauses (buffer, OMP_TARGET_CLAUSES (node), spc, flags);
2413 goto dump_omp_body;
2415 case OMP_TARGET_UPDATE:
2416 pp_string (buffer, "#pragma omp target update");
2417 dump_omp_clauses (buffer, OMP_TARGET_UPDATE_CLAUSES (node), spc, flags);
2418 is_expr = false;
2419 break;
2421 dump_omp_loop:
2422 dump_omp_clauses (buffer, OMP_FOR_CLAUSES (node), spc, flags);
2424 if (!(flags & TDF_SLIM))
2426 int i;
2428 if (OMP_FOR_PRE_BODY (node))
2430 newline_and_indent (buffer, spc + 2);
2431 pp_left_brace (buffer);
2432 spc += 4;
2433 newline_and_indent (buffer, spc);
2434 dump_generic_node (buffer, OMP_FOR_PRE_BODY (node),
2435 spc, flags, false);
2437 if (OMP_FOR_INIT (node))
2439 spc -= 2;
2440 for (i = 0; i < TREE_VEC_LENGTH (OMP_FOR_INIT (node)); i++)
2442 spc += 2;
2443 newline_and_indent (buffer, spc);
2444 pp_string (buffer, "for (");
2445 dump_generic_node (buffer,
2446 TREE_VEC_ELT (OMP_FOR_INIT (node), i),
2447 spc, flags, false);
2448 pp_string (buffer, "; ");
2449 dump_generic_node (buffer,
2450 TREE_VEC_ELT (OMP_FOR_COND (node), i),
2451 spc, flags, false);
2452 pp_string (buffer, "; ");
2453 dump_generic_node (buffer,
2454 TREE_VEC_ELT (OMP_FOR_INCR (node), i),
2455 spc, flags, false);
2456 pp_right_paren (buffer);
2459 if (OMP_FOR_BODY (node))
2461 newline_and_indent (buffer, spc + 2);
2462 pp_left_brace (buffer);
2463 newline_and_indent (buffer, spc + 4);
2464 dump_generic_node (buffer, OMP_FOR_BODY (node), spc + 4, flags,
2465 false);
2466 newline_and_indent (buffer, spc + 2);
2467 pp_right_brace (buffer);
2469 if (OMP_FOR_INIT (node))
2470 spc -= 2 * TREE_VEC_LENGTH (OMP_FOR_INIT (node)) - 2;
2471 if (OMP_FOR_PRE_BODY (node))
2473 spc -= 4;
2474 newline_and_indent (buffer, spc + 2);
2475 pp_right_brace (buffer);
2478 is_expr = false;
2479 break;
2481 case OMP_SECTIONS:
2482 pp_string (buffer, "#pragma omp sections");
2483 dump_omp_clauses (buffer, OMP_SECTIONS_CLAUSES (node), spc, flags);
2484 goto dump_omp_body;
2486 case OMP_SECTION:
2487 pp_string (buffer, "#pragma omp section");
2488 goto dump_omp_body;
2490 case OMP_MASTER:
2491 pp_string (buffer, "#pragma omp master");
2492 goto dump_omp_body;
2494 case OMP_TASKGROUP:
2495 pp_string (buffer, "#pragma omp taskgroup");
2496 goto dump_omp_body;
2498 case OMP_ORDERED:
2499 pp_string (buffer, "#pragma omp ordered");
2500 goto dump_omp_body;
2502 case OMP_CRITICAL:
2503 pp_string (buffer, "#pragma omp critical");
2504 if (OMP_CRITICAL_NAME (node))
2506 pp_space (buffer);
2507 pp_left_paren (buffer);
2508 dump_generic_node (buffer, OMP_CRITICAL_NAME (node), spc,
2509 flags, false);
2510 pp_right_paren (buffer);
2512 goto dump_omp_body;
2514 case OMP_ATOMIC:
2515 pp_string (buffer, "#pragma omp atomic");
2516 if (OMP_ATOMIC_SEQ_CST (node))
2517 pp_string (buffer, " seq_cst");
2518 newline_and_indent (buffer, spc + 2);
2519 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
2520 pp_space (buffer);
2521 pp_equal (buffer);
2522 pp_space (buffer);
2523 dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
2524 break;
2526 case OMP_ATOMIC_READ:
2527 pp_string (buffer, "#pragma omp atomic read");
2528 if (OMP_ATOMIC_SEQ_CST (node))
2529 pp_string (buffer, " seq_cst");
2530 newline_and_indent (buffer, spc + 2);
2531 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
2532 pp_space (buffer);
2533 break;
2535 case OMP_ATOMIC_CAPTURE_OLD:
2536 case OMP_ATOMIC_CAPTURE_NEW:
2537 pp_string (buffer, "#pragma omp atomic capture");
2538 if (OMP_ATOMIC_SEQ_CST (node))
2539 pp_string (buffer, " seq_cst");
2540 newline_and_indent (buffer, spc + 2);
2541 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
2542 pp_space (buffer);
2543 pp_equal (buffer);
2544 pp_space (buffer);
2545 dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
2546 break;
2548 case OMP_SINGLE:
2549 pp_string (buffer, "#pragma omp single");
2550 dump_omp_clauses (buffer, OMP_SINGLE_CLAUSES (node), spc, flags);
2551 goto dump_omp_body;
2553 case OMP_CLAUSE:
2554 dump_omp_clause (buffer, node, spc, flags);
2555 is_expr = false;
2556 break;
2558 case TRANSACTION_EXPR:
2559 if (TRANSACTION_EXPR_OUTER (node))
2560 pp_string (buffer, "__transaction_atomic [[outer]]");
2561 else if (TRANSACTION_EXPR_RELAXED (node))
2562 pp_string (buffer, "__transaction_relaxed");
2563 else
2564 pp_string (buffer, "__transaction_atomic");
2565 if (!(flags & TDF_SLIM) && TRANSACTION_EXPR_BODY (node))
2567 newline_and_indent (buffer, spc);
2568 pp_left_brace (buffer);
2569 newline_and_indent (buffer, spc + 2);
2570 dump_generic_node (buffer, TRANSACTION_EXPR_BODY (node),
2571 spc + 2, flags, false);
2572 newline_and_indent (buffer, spc);
2573 pp_right_brace (buffer);
2575 is_expr = false;
2576 break;
2578 case REDUC_MAX_EXPR:
2579 pp_string (buffer, " REDUC_MAX_EXPR < ");
2580 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
2581 pp_string (buffer, " > ");
2582 break;
2584 case REDUC_MIN_EXPR:
2585 pp_string (buffer, " REDUC_MIN_EXPR < ");
2586 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
2587 pp_string (buffer, " > ");
2588 break;
2590 case REDUC_PLUS_EXPR:
2591 pp_string (buffer, " REDUC_PLUS_EXPR < ");
2592 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
2593 pp_string (buffer, " > ");
2594 break;
2596 case VEC_WIDEN_MULT_HI_EXPR:
2597 case VEC_WIDEN_MULT_LO_EXPR:
2598 case VEC_WIDEN_MULT_EVEN_EXPR:
2599 case VEC_WIDEN_MULT_ODD_EXPR:
2600 case VEC_WIDEN_LSHIFT_HI_EXPR:
2601 case VEC_WIDEN_LSHIFT_LO_EXPR:
2602 pp_space (buffer);
2603 for (str = get_tree_code_name (code); *str; str++)
2604 pp_character (buffer, TOUPPER (*str));
2605 pp_string (buffer, " < ");
2606 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
2607 pp_string (buffer, ", ");
2608 dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
2609 pp_string (buffer, " > ");
2610 break;
2612 case VEC_UNPACK_HI_EXPR:
2613 pp_string (buffer, " VEC_UNPACK_HI_EXPR < ");
2614 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
2615 pp_string (buffer, " > ");
2616 break;
2618 case VEC_UNPACK_LO_EXPR:
2619 pp_string (buffer, " VEC_UNPACK_LO_EXPR < ");
2620 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
2621 pp_string (buffer, " > ");
2622 break;
2624 case VEC_UNPACK_FLOAT_HI_EXPR:
2625 pp_string (buffer, " VEC_UNPACK_FLOAT_HI_EXPR < ");
2626 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
2627 pp_string (buffer, " > ");
2628 break;
2630 case VEC_UNPACK_FLOAT_LO_EXPR:
2631 pp_string (buffer, " VEC_UNPACK_FLOAT_LO_EXPR < ");
2632 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
2633 pp_string (buffer, " > ");
2634 break;
2636 case VEC_PACK_TRUNC_EXPR:
2637 pp_string (buffer, " VEC_PACK_TRUNC_EXPR < ");
2638 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
2639 pp_string (buffer, ", ");
2640 dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
2641 pp_string (buffer, " > ");
2642 break;
2644 case VEC_PACK_SAT_EXPR:
2645 pp_string (buffer, " VEC_PACK_SAT_EXPR < ");
2646 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
2647 pp_string (buffer, ", ");
2648 dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
2649 pp_string (buffer, " > ");
2650 break;
2652 case VEC_PACK_FIX_TRUNC_EXPR:
2653 pp_string (buffer, " VEC_PACK_FIX_TRUNC_EXPR < ");
2654 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
2655 pp_string (buffer, ", ");
2656 dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
2657 pp_string (buffer, " > ");
2658 break;
2660 case BLOCK:
2661 dump_block_node (buffer, node, spc, flags);
2662 break;
2664 case CILK_SPAWN_STMT:
2665 pp_string (buffer, "_Cilk_spawn ");
2666 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
2667 break;
2669 case CILK_SYNC_STMT:
2670 pp_string (buffer, "_Cilk_sync");
2671 break;
2673 default:
2674 NIY;
2677 if (is_stmt && is_expr)
2678 pp_semicolon (buffer);
2680 return spc;
2683 /* Print the declaration of a variable. */
2685 void
2686 print_declaration (pretty_printer *buffer, tree t, int spc, int flags)
2688 INDENT (spc);
2690 if (TREE_CODE(t) == NAMELIST_DECL)
2692 pp_string(buffer, "namelist ");
2693 dump_decl_name (buffer, t, flags);
2694 pp_semicolon (buffer);
2695 return;
2698 if (TREE_CODE (t) == TYPE_DECL)
2699 pp_string (buffer, "typedef ");
2701 if (CODE_CONTAINS_STRUCT (TREE_CODE (t), TS_DECL_WRTL) && DECL_REGISTER (t))
2702 pp_string (buffer, "register ");
2704 if (TREE_PUBLIC (t) && DECL_EXTERNAL (t))
2705 pp_string (buffer, "extern ");
2706 else if (TREE_STATIC (t))
2707 pp_string (buffer, "static ");
2709 /* Print the type and name. */
2710 if (TREE_TYPE (t) && TREE_CODE (TREE_TYPE (t)) == ARRAY_TYPE)
2712 tree tmp;
2714 /* Print array's type. */
2715 tmp = TREE_TYPE (t);
2716 while (TREE_CODE (TREE_TYPE (tmp)) == ARRAY_TYPE)
2717 tmp = TREE_TYPE (tmp);
2718 dump_generic_node (buffer, TREE_TYPE (tmp), spc, flags, false);
2720 /* Print variable's name. */
2721 pp_space (buffer);
2722 dump_generic_node (buffer, t, spc, flags, false);
2724 /* Print the dimensions. */
2725 tmp = TREE_TYPE (t);
2726 while (TREE_CODE (tmp) == ARRAY_TYPE)
2728 dump_array_domain (buffer, TYPE_DOMAIN (tmp), spc, flags);
2729 tmp = TREE_TYPE (tmp);
2732 else if (TREE_CODE (t) == FUNCTION_DECL)
2734 dump_generic_node (buffer, TREE_TYPE (TREE_TYPE (t)), spc, flags, false);
2735 pp_space (buffer);
2736 dump_decl_name (buffer, t, flags);
2737 dump_function_declaration (buffer, TREE_TYPE (t), spc, flags);
2739 else
2741 /* Print type declaration. */
2742 dump_generic_node (buffer, TREE_TYPE (t), spc, flags, false);
2744 /* Print variable's name. */
2745 pp_space (buffer);
2746 dump_generic_node (buffer, t, spc, flags, false);
2749 if (TREE_CODE (t) == VAR_DECL && DECL_HARD_REGISTER (t))
2751 pp_string (buffer, " __asm__ ");
2752 pp_left_paren (buffer);
2753 dump_generic_node (buffer, DECL_ASSEMBLER_NAME (t), spc, flags, false);
2754 pp_right_paren (buffer);
2757 /* The initial value of a function serves to determine whether the function
2758 is declared or defined. So the following does not apply to function
2759 nodes. */
2760 if (TREE_CODE (t) != FUNCTION_DECL)
2762 /* Print the initial value. */
2763 if (DECL_INITIAL (t))
2765 pp_space (buffer);
2766 pp_equal (buffer);
2767 pp_space (buffer);
2768 dump_generic_node (buffer, DECL_INITIAL (t), spc, flags, false);
2772 if (TREE_CODE (t) == VAR_DECL && DECL_HAS_VALUE_EXPR_P (t))
2774 pp_string (buffer, " [value-expr: ");
2775 dump_generic_node (buffer, DECL_VALUE_EXPR (t), spc, flags, false);
2776 pp_right_bracket (buffer);
2779 pp_semicolon (buffer);
2783 /* Prints a structure: name, fields, and methods.
2784 FIXME: Still incomplete. */
2786 static void
2787 print_struct_decl (pretty_printer *buffer, const_tree node, int spc, int flags)
2789 /* Print the name of the structure. */
2790 if (TYPE_NAME (node))
2792 INDENT (spc);
2793 if (TREE_CODE (node) == RECORD_TYPE)
2794 pp_string (buffer, "struct ");
2795 else if ((TREE_CODE (node) == UNION_TYPE
2796 || TREE_CODE (node) == QUAL_UNION_TYPE))
2797 pp_string (buffer, "union ");
2799 dump_generic_node (buffer, TYPE_NAME (node), spc, 0, false);
2802 /* Print the contents of the structure. */
2803 pp_newline (buffer);
2804 INDENT (spc);
2805 pp_left_brace (buffer);
2806 pp_newline (buffer);
2808 /* Print the fields of the structure. */
2810 tree tmp;
2811 tmp = TYPE_FIELDS (node);
2812 while (tmp)
2814 /* Avoid to print recursively the structure. */
2815 /* FIXME : Not implemented correctly...,
2816 what about the case when we have a cycle in the contain graph? ...
2817 Maybe this could be solved by looking at the scope in which the
2818 structure was declared. */
2819 if (TREE_TYPE (tmp) != node
2820 && (TREE_CODE (TREE_TYPE (tmp)) != POINTER_TYPE
2821 || TREE_TYPE (TREE_TYPE (tmp)) != node))
2823 print_declaration (buffer, tmp, spc+2, flags);
2824 pp_newline (buffer);
2826 tmp = DECL_CHAIN (tmp);
2829 INDENT (spc);
2830 pp_right_brace (buffer);
2833 /* Return the priority of the operator CODE.
2835 From lowest to highest precedence with either left-to-right (L-R)
2836 or right-to-left (R-L) associativity]:
2838 1 [L-R] ,
2839 2 [R-L] = += -= *= /= %= &= ^= |= <<= >>=
2840 3 [R-L] ?:
2841 4 [L-R] ||
2842 5 [L-R] &&
2843 6 [L-R] |
2844 7 [L-R] ^
2845 8 [L-R] &
2846 9 [L-R] == !=
2847 10 [L-R] < <= > >=
2848 11 [L-R] << >>
2849 12 [L-R] + -
2850 13 [L-R] * / %
2851 14 [R-L] ! ~ ++ -- + - * & (type) sizeof
2852 15 [L-R] fn() [] -> .
2854 unary +, - and * have higher precedence than the corresponding binary
2855 operators. */
2858 op_code_prio (enum tree_code code)
2860 switch (code)
2862 case TREE_LIST:
2863 case COMPOUND_EXPR:
2864 case BIND_EXPR:
2865 return 1;
2867 case MODIFY_EXPR:
2868 case INIT_EXPR:
2869 return 2;
2871 case COND_EXPR:
2872 return 3;
2874 case TRUTH_OR_EXPR:
2875 case TRUTH_ORIF_EXPR:
2876 return 4;
2878 case TRUTH_AND_EXPR:
2879 case TRUTH_ANDIF_EXPR:
2880 return 5;
2882 case BIT_IOR_EXPR:
2883 return 6;
2885 case BIT_XOR_EXPR:
2886 case TRUTH_XOR_EXPR:
2887 return 7;
2889 case BIT_AND_EXPR:
2890 return 8;
2892 case EQ_EXPR:
2893 case NE_EXPR:
2894 return 9;
2896 case UNLT_EXPR:
2897 case UNLE_EXPR:
2898 case UNGT_EXPR:
2899 case UNGE_EXPR:
2900 case UNEQ_EXPR:
2901 case LTGT_EXPR:
2902 case ORDERED_EXPR:
2903 case UNORDERED_EXPR:
2904 case LT_EXPR:
2905 case LE_EXPR:
2906 case GT_EXPR:
2907 case GE_EXPR:
2908 return 10;
2910 case LSHIFT_EXPR:
2911 case RSHIFT_EXPR:
2912 case LROTATE_EXPR:
2913 case RROTATE_EXPR:
2914 case VEC_WIDEN_LSHIFT_HI_EXPR:
2915 case VEC_WIDEN_LSHIFT_LO_EXPR:
2916 case WIDEN_LSHIFT_EXPR:
2917 return 11;
2919 case WIDEN_SUM_EXPR:
2920 case PLUS_EXPR:
2921 case POINTER_PLUS_EXPR:
2922 case MINUS_EXPR:
2923 return 12;
2925 case VEC_WIDEN_MULT_HI_EXPR:
2926 case VEC_WIDEN_MULT_LO_EXPR:
2927 case WIDEN_MULT_EXPR:
2928 case DOT_PROD_EXPR:
2929 case WIDEN_MULT_PLUS_EXPR:
2930 case WIDEN_MULT_MINUS_EXPR:
2931 case MULT_EXPR:
2932 case MULT_HIGHPART_EXPR:
2933 case TRUNC_DIV_EXPR:
2934 case CEIL_DIV_EXPR:
2935 case FLOOR_DIV_EXPR:
2936 case ROUND_DIV_EXPR:
2937 case RDIV_EXPR:
2938 case EXACT_DIV_EXPR:
2939 case TRUNC_MOD_EXPR:
2940 case CEIL_MOD_EXPR:
2941 case FLOOR_MOD_EXPR:
2942 case ROUND_MOD_EXPR:
2943 case FMA_EXPR:
2944 return 13;
2946 case TRUTH_NOT_EXPR:
2947 case BIT_NOT_EXPR:
2948 case POSTINCREMENT_EXPR:
2949 case POSTDECREMENT_EXPR:
2950 case PREINCREMENT_EXPR:
2951 case PREDECREMENT_EXPR:
2952 case NEGATE_EXPR:
2953 case INDIRECT_REF:
2954 case ADDR_EXPR:
2955 case FLOAT_EXPR:
2956 CASE_CONVERT:
2957 case FIX_TRUNC_EXPR:
2958 case TARGET_EXPR:
2959 return 14;
2961 case CALL_EXPR:
2962 case ARRAY_REF:
2963 case ARRAY_RANGE_REF:
2964 case COMPONENT_REF:
2965 return 15;
2967 /* Special expressions. */
2968 case MIN_EXPR:
2969 case MAX_EXPR:
2970 case ABS_EXPR:
2971 case REALPART_EXPR:
2972 case IMAGPART_EXPR:
2973 case REDUC_MAX_EXPR:
2974 case REDUC_MIN_EXPR:
2975 case REDUC_PLUS_EXPR:
2976 case VEC_LSHIFT_EXPR:
2977 case VEC_RSHIFT_EXPR:
2978 case VEC_UNPACK_HI_EXPR:
2979 case VEC_UNPACK_LO_EXPR:
2980 case VEC_UNPACK_FLOAT_HI_EXPR:
2981 case VEC_UNPACK_FLOAT_LO_EXPR:
2982 case VEC_PACK_TRUNC_EXPR:
2983 case VEC_PACK_SAT_EXPR:
2984 return 16;
2986 default:
2987 /* Return an arbitrarily high precedence to avoid surrounding single
2988 VAR_DECLs in ()s. */
2989 return 9999;
2993 /* Return the priority of the operator OP. */
2996 op_prio (const_tree op)
2998 enum tree_code code;
3000 if (op == NULL)
3001 return 9999;
3003 code = TREE_CODE (op);
3004 if (code == SAVE_EXPR || code == NON_LVALUE_EXPR)
3005 return op_prio (TREE_OPERAND (op, 0));
3007 return op_code_prio (code);
3010 /* Return the symbol associated with operator CODE. */
3012 const char *
3013 op_symbol_code (enum tree_code code)
3015 switch (code)
3017 case MODIFY_EXPR:
3018 return "=";
3020 case TRUTH_OR_EXPR:
3021 case TRUTH_ORIF_EXPR:
3022 return "||";
3024 case TRUTH_AND_EXPR:
3025 case TRUTH_ANDIF_EXPR:
3026 return "&&";
3028 case BIT_IOR_EXPR:
3029 return "|";
3031 case TRUTH_XOR_EXPR:
3032 case BIT_XOR_EXPR:
3033 return "^";
3035 case ADDR_EXPR:
3036 case BIT_AND_EXPR:
3037 return "&";
3039 case ORDERED_EXPR:
3040 return "ord";
3041 case UNORDERED_EXPR:
3042 return "unord";
3044 case EQ_EXPR:
3045 return "==";
3046 case UNEQ_EXPR:
3047 return "u==";
3049 case NE_EXPR:
3050 return "!=";
3052 case LT_EXPR:
3053 return "<";
3054 case UNLT_EXPR:
3055 return "u<";
3057 case LE_EXPR:
3058 return "<=";
3059 case UNLE_EXPR:
3060 return "u<=";
3062 case GT_EXPR:
3063 return ">";
3064 case UNGT_EXPR:
3065 return "u>";
3067 case GE_EXPR:
3068 return ">=";
3069 case UNGE_EXPR:
3070 return "u>=";
3072 case LTGT_EXPR:
3073 return "<>";
3075 case LSHIFT_EXPR:
3076 return "<<";
3078 case RSHIFT_EXPR:
3079 return ">>";
3081 case LROTATE_EXPR:
3082 return "r<<";
3084 case RROTATE_EXPR:
3085 return "r>>";
3087 case VEC_LSHIFT_EXPR:
3088 return "v<<";
3090 case VEC_RSHIFT_EXPR:
3091 return "v>>";
3093 case WIDEN_LSHIFT_EXPR:
3094 return "w<<";
3096 case POINTER_PLUS_EXPR:
3097 return "+";
3099 case PLUS_EXPR:
3100 return "+";
3102 case REDUC_PLUS_EXPR:
3103 return "r+";
3105 case WIDEN_SUM_EXPR:
3106 return "w+";
3108 case WIDEN_MULT_EXPR:
3109 return "w*";
3111 case MULT_HIGHPART_EXPR:
3112 return "h*";
3114 case NEGATE_EXPR:
3115 case MINUS_EXPR:
3116 return "-";
3118 case BIT_NOT_EXPR:
3119 return "~";
3121 case TRUTH_NOT_EXPR:
3122 return "!";
3124 case MULT_EXPR:
3125 case INDIRECT_REF:
3126 return "*";
3128 case TRUNC_DIV_EXPR:
3129 case RDIV_EXPR:
3130 return "/";
3132 case CEIL_DIV_EXPR:
3133 return "/[cl]";
3135 case FLOOR_DIV_EXPR:
3136 return "/[fl]";
3138 case ROUND_DIV_EXPR:
3139 return "/[rd]";
3141 case EXACT_DIV_EXPR:
3142 return "/[ex]";
3144 case TRUNC_MOD_EXPR:
3145 return "%";
3147 case CEIL_MOD_EXPR:
3148 return "%[cl]";
3150 case FLOOR_MOD_EXPR:
3151 return "%[fl]";
3153 case ROUND_MOD_EXPR:
3154 return "%[rd]";
3156 case PREDECREMENT_EXPR:
3157 return " --";
3159 case PREINCREMENT_EXPR:
3160 return " ++";
3162 case POSTDECREMENT_EXPR:
3163 return "-- ";
3165 case POSTINCREMENT_EXPR:
3166 return "++ ";
3168 case MAX_EXPR:
3169 return "max";
3171 case MIN_EXPR:
3172 return "min";
3174 default:
3175 return "<<< ??? >>>";
3179 /* Return the symbol associated with operator OP. */
3181 static const char *
3182 op_symbol (const_tree op)
3184 return op_symbol_code (TREE_CODE (op));
3187 /* Prints the name of a call. NODE is the CALL_EXPR_FN of a CALL_EXPR or
3188 the gimple_call_fn of a GIMPLE_CALL. */
3190 void
3191 print_call_name (pretty_printer *buffer, tree node, int flags)
3193 tree op0 = node;
3195 if (TREE_CODE (op0) == NON_LVALUE_EXPR)
3196 op0 = TREE_OPERAND (op0, 0);
3198 again:
3199 switch (TREE_CODE (op0))
3201 case VAR_DECL:
3202 case PARM_DECL:
3203 case FUNCTION_DECL:
3204 dump_function_name (buffer, op0, flags);
3205 break;
3207 case ADDR_EXPR:
3208 case INDIRECT_REF:
3209 case NOP_EXPR:
3210 op0 = TREE_OPERAND (op0, 0);
3211 goto again;
3213 case COND_EXPR:
3214 pp_left_paren (buffer);
3215 dump_generic_node (buffer, TREE_OPERAND (op0, 0), 0, flags, false);
3216 pp_string (buffer, ") ? ");
3217 dump_generic_node (buffer, TREE_OPERAND (op0, 1), 0, flags, false);
3218 pp_string (buffer, " : ");
3219 dump_generic_node (buffer, TREE_OPERAND (op0, 2), 0, flags, false);
3220 break;
3222 case ARRAY_REF:
3223 if (TREE_CODE (TREE_OPERAND (op0, 0)) == VAR_DECL)
3224 dump_function_name (buffer, TREE_OPERAND (op0, 0), flags);
3225 else
3226 dump_generic_node (buffer, op0, 0, flags, false);
3227 break;
3229 case MEM_REF:
3230 if (integer_zerop (TREE_OPERAND (op0, 1)))
3232 op0 = TREE_OPERAND (op0, 0);
3233 goto again;
3235 /* Fallthru. */
3236 case COMPONENT_REF:
3237 case SSA_NAME:
3238 case OBJ_TYPE_REF:
3239 dump_generic_node (buffer, op0, 0, flags, false);
3240 break;
3242 default:
3243 NIY;
3247 /* Parses the string STR and replaces new-lines by '\n', tabs by '\t', ... */
3249 static void
3250 pretty_print_string (pretty_printer *buffer, const char *str)
3252 if (str == NULL)
3253 return;
3255 while (*str)
3257 switch (str[0])
3259 case '\b':
3260 pp_string (buffer, "\\b");
3261 break;
3263 case '\f':
3264 pp_string (buffer, "\\f");
3265 break;
3267 case '\n':
3268 pp_string (buffer, "\\n");
3269 break;
3271 case '\r':
3272 pp_string (buffer, "\\r");
3273 break;
3275 case '\t':
3276 pp_string (buffer, "\\t");
3277 break;
3279 case '\v':
3280 pp_string (buffer, "\\v");
3281 break;
3283 case '\\':
3284 pp_string (buffer, "\\\\");
3285 break;
3287 case '\"':
3288 pp_string (buffer, "\\\"");
3289 break;
3291 case '\'':
3292 pp_string (buffer, "\\'");
3293 break;
3295 /* No need to handle \0; the loop terminates on \0. */
3297 case '\1':
3298 pp_string (buffer, "\\1");
3299 break;
3301 case '\2':
3302 pp_string (buffer, "\\2");
3303 break;
3305 case '\3':
3306 pp_string (buffer, "\\3");
3307 break;
3309 case '\4':
3310 pp_string (buffer, "\\4");
3311 break;
3313 case '\5':
3314 pp_string (buffer, "\\5");
3315 break;
3317 case '\6':
3318 pp_string (buffer, "\\6");
3319 break;
3321 case '\7':
3322 pp_string (buffer, "\\7");
3323 break;
3325 default:
3326 pp_character (buffer, str[0]);
3327 break;
3329 str++;
3333 static void
3334 maybe_init_pretty_print (FILE *file)
3336 if (!initialized)
3338 new (&buffer) pretty_printer ();
3339 pp_needs_newline (&buffer) = true;
3340 pp_translate_identifiers (&buffer) = false;
3341 initialized = 1;
3344 buffer.buffer->stream = file;
3347 static void
3348 newline_and_indent (pretty_printer *buffer, int spc)
3350 pp_newline (buffer);
3351 INDENT (spc);
3354 /* Handle a %K format for TEXT. Separate from default_tree_printer so
3355 it can also be used in front ends.
3356 %K: a statement, from which EXPR_LOCATION and TREE_BLOCK will be recorded.
3359 void
3360 percent_K_format (text_info *text)
3362 tree t = va_arg (*text->args_ptr, tree), block;
3363 gcc_assert (text->locus != NULL);
3364 *text->locus = EXPR_LOCATION (t);
3365 gcc_assert (pp_ti_abstract_origin (text) != NULL);
3366 block = TREE_BLOCK (t);
3367 *pp_ti_abstract_origin (text) = NULL;
3369 if (in_lto_p)
3371 /* ??? LTO drops all BLOCK_ABSTRACT_ORIGINs apart from those
3372 representing the outermost block of an inlined function.
3373 So walk the BLOCK tree until we hit such a scope. */
3374 while (block
3375 && TREE_CODE (block) == BLOCK)
3377 if (inlined_function_outer_scope_p (block))
3379 *pp_ti_abstract_origin (text) = block;
3380 break;
3382 block = BLOCK_SUPERCONTEXT (block);
3384 return;
3387 while (block
3388 && TREE_CODE (block) == BLOCK
3389 && BLOCK_ABSTRACT_ORIGIN (block))
3391 tree ao = BLOCK_ABSTRACT_ORIGIN (block);
3393 while (TREE_CODE (ao) == BLOCK
3394 && BLOCK_ABSTRACT_ORIGIN (ao)
3395 && BLOCK_ABSTRACT_ORIGIN (ao) != ao)
3396 ao = BLOCK_ABSTRACT_ORIGIN (ao);
3398 if (TREE_CODE (ao) == FUNCTION_DECL)
3400 *pp_ti_abstract_origin (text) = block;
3401 break;
3403 block = BLOCK_SUPERCONTEXT (block);
3407 /* Print the identifier ID to PRETTY-PRINTER. */
3409 void
3410 pp_tree_identifier (pretty_printer *pp, tree id)
3412 if (pp_translate_identifiers (pp))
3414 const char *text = identifier_to_locale (IDENTIFIER_POINTER (id));
3415 pp_append_text (pp, text, text + strlen (text));
3417 else
3418 pp_append_text (pp, IDENTIFIER_POINTER (id),
3419 IDENTIFIER_POINTER (id) + IDENTIFIER_LENGTH (id));
3422 /* A helper function that is used to dump function information before the
3423 function dump. */
3425 void
3426 dump_function_header (FILE *dump_file, tree fdecl, int flags)
3428 const char *dname, *aname;
3429 struct cgraph_node *node = cgraph_get_node (fdecl);
3430 struct function *fun = DECL_STRUCT_FUNCTION (fdecl);
3432 dname = lang_hooks.decl_printable_name (fdecl, 2);
3434 if (DECL_ASSEMBLER_NAME_SET_P (fdecl))
3435 aname = (IDENTIFIER_POINTER
3436 (DECL_ASSEMBLER_NAME (fdecl)));
3437 else
3438 aname = "<unset-asm-name>";
3440 fprintf (dump_file, "\n;; Function %s (%s, funcdef_no=%d",
3441 dname, aname, fun->funcdef_no);
3442 if (!(flags & TDF_NOUID))
3443 fprintf (dump_file, ", decl_uid=%d", DECL_UID (fdecl));
3444 if (node)
3446 fprintf (dump_file, ", symbol_order=%d)%s\n\n", node->order,
3447 node->frequency == NODE_FREQUENCY_HOT
3448 ? " (hot)"
3449 : node->frequency == NODE_FREQUENCY_UNLIKELY_EXECUTED
3450 ? " (unlikely executed)"
3451 : node->frequency == NODE_FREQUENCY_EXECUTED_ONCE
3452 ? " (executed once)"
3453 : "");
3455 else
3456 fprintf (dump_file, ")\n\n");
3459 /* Dump double_int D to pretty_printer PP. UNS is true
3460 if D is unsigned and false otherwise. */
3461 void
3462 pp_double_int (pretty_printer *pp, double_int d, bool uns)
3464 if (d.fits_shwi ())
3465 pp_wide_integer (pp, d.low);
3466 else if (d.fits_uhwi ())
3467 pp_unsigned_wide_integer (pp, d.low);
3468 else if (HOST_BITS_PER_DOUBLE_INT == HOST_BITS_PER_WIDEST_INT)
3469 pp_scalar (pp,
3471 ? HOST_WIDEST_INT_PRINT_UNSIGNED : HOST_WIDEST_INT_PRINT_DEC,
3472 (HOST_WIDEST_INT) ((((unsigned HOST_WIDEST_INT) d.high << 1)
3473 << (HOST_BITS_PER_WIDE_INT - 1)) | d.low));
3474 else
3476 unsigned HOST_WIDE_INT low = d.low;
3477 HOST_WIDE_INT high = d.high;
3478 if (!uns && d.is_negative ())
3480 pp_minus (pp);
3481 high = ~high + !low;
3482 low = -low;
3484 /* Would "%x%0*x" or "%x%*0x" get zero-padding on all
3485 systems? */
3486 sprintf (pp_buffer (pp)->digit_buffer,
3487 HOST_WIDE_INT_PRINT_DOUBLE_HEX,
3488 (unsigned HOST_WIDE_INT) high, low);
3489 pp_string (pp, pp_buffer (pp)->digit_buffer);