2014-02-20 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / tree-pretty-print.c
blob0595499ec25c0ae6497235da8596a09116fce80d
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 dump_decl_name (buffer, node, flags);
1394 break;
1396 case RESULT_DECL:
1397 pp_string (buffer, "<retval>");
1398 break;
1400 case COMPONENT_REF:
1401 op0 = TREE_OPERAND (node, 0);
1402 str = ".";
1403 if (op0
1404 && (TREE_CODE (op0) == INDIRECT_REF
1405 || (TREE_CODE (op0) == MEM_REF
1406 && TREE_CODE (TREE_OPERAND (op0, 0)) != ADDR_EXPR
1407 && integer_zerop (TREE_OPERAND (op0, 1))
1408 /* Dump the types of INTEGER_CSTs explicitly, for we
1409 can't infer them and MEM_ATTR caching will share
1410 MEM_REFs with differently-typed op0s. */
1411 && TREE_CODE (TREE_OPERAND (op0, 0)) != INTEGER_CST
1412 /* Released SSA_NAMES have no TREE_TYPE. */
1413 && TREE_TYPE (TREE_OPERAND (op0, 0)) != NULL_TREE
1414 /* Same pointer types, but ignoring POINTER_TYPE vs.
1415 REFERENCE_TYPE. */
1416 && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0, 0)))
1417 == TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0, 1))))
1418 && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0, 0)))
1419 == TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0, 1))))
1420 && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0, 0)))
1421 == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0, 1))))
1422 /* Same value types ignoring qualifiers. */
1423 && (TYPE_MAIN_VARIANT (TREE_TYPE (op0))
1424 == TYPE_MAIN_VARIANT
1425 (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0, 1))))))))
1427 op0 = TREE_OPERAND (op0, 0);
1428 str = "->";
1430 if (op_prio (op0) < op_prio (node))
1431 pp_left_paren (buffer);
1432 dump_generic_node (buffer, op0, spc, flags, false);
1433 if (op_prio (op0) < op_prio (node))
1434 pp_right_paren (buffer);
1435 pp_string (buffer, str);
1436 dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
1437 op0 = component_ref_field_offset (node);
1438 if (op0 && TREE_CODE (op0) != INTEGER_CST)
1440 pp_string (buffer, "{off: ");
1441 dump_generic_node (buffer, op0, spc, flags, false);
1442 pp_right_brace (buffer);
1444 break;
1446 case BIT_FIELD_REF:
1447 pp_string (buffer, "BIT_FIELD_REF <");
1448 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1449 pp_string (buffer, ", ");
1450 dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
1451 pp_string (buffer, ", ");
1452 dump_generic_node (buffer, TREE_OPERAND (node, 2), spc, flags, false);
1453 pp_greater (buffer);
1454 break;
1456 case ARRAY_REF:
1457 case ARRAY_RANGE_REF:
1458 op0 = TREE_OPERAND (node, 0);
1459 if (op_prio (op0) < op_prio (node))
1460 pp_left_paren (buffer);
1461 dump_generic_node (buffer, op0, spc, flags, false);
1462 if (op_prio (op0) < op_prio (node))
1463 pp_right_paren (buffer);
1464 pp_left_bracket (buffer);
1465 dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
1466 if (TREE_CODE (node) == ARRAY_RANGE_REF)
1467 pp_string (buffer, " ...");
1468 pp_right_bracket (buffer);
1470 op0 = array_ref_low_bound (node);
1471 op1 = array_ref_element_size (node);
1473 if (!integer_zerop (op0)
1474 || TREE_OPERAND (node, 2)
1475 || TREE_OPERAND (node, 3))
1477 pp_string (buffer, "{lb: ");
1478 dump_generic_node (buffer, op0, spc, flags, false);
1479 pp_string (buffer, " sz: ");
1480 dump_generic_node (buffer, op1, spc, flags, false);
1481 pp_right_brace (buffer);
1483 break;
1485 case CONSTRUCTOR:
1487 unsigned HOST_WIDE_INT ix;
1488 tree field, val;
1489 bool is_struct_init = false;
1490 bool is_array_init = false;
1491 double_int curidx = double_int_zero;
1492 pp_left_brace (buffer);
1493 if (TREE_CLOBBER_P (node))
1494 pp_string (buffer, "CLOBBER");
1495 else if (TREE_CODE (TREE_TYPE (node)) == RECORD_TYPE
1496 || TREE_CODE (TREE_TYPE (node)) == UNION_TYPE)
1497 is_struct_init = true;
1498 else if (TREE_CODE (TREE_TYPE (node)) == ARRAY_TYPE
1499 && TYPE_DOMAIN (TREE_TYPE (node))
1500 && TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node)))
1501 && TREE_CODE (TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node))))
1502 == INTEGER_CST)
1504 tree minv = TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node)));
1505 is_array_init = true;
1506 curidx = tree_to_double_int (minv);
1508 FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (node), ix, field, val)
1510 if (field)
1512 if (is_struct_init)
1514 pp_dot (buffer);
1515 dump_generic_node (buffer, field, spc, flags, false);
1516 pp_equal (buffer);
1518 else if (is_array_init
1519 && (TREE_CODE (field) != INTEGER_CST
1520 || tree_to_double_int (field) != curidx))
1522 pp_left_bracket (buffer);
1523 if (TREE_CODE (field) == RANGE_EXPR)
1525 dump_generic_node (buffer, TREE_OPERAND (field, 0), spc,
1526 flags, false);
1527 pp_string (buffer, " ... ");
1528 dump_generic_node (buffer, TREE_OPERAND (field, 1), spc,
1529 flags, false);
1530 if (TREE_CODE (TREE_OPERAND (field, 1)) == INTEGER_CST)
1531 curidx = tree_to_double_int (TREE_OPERAND (field, 1));
1533 else
1534 dump_generic_node (buffer, field, spc, flags, false);
1535 if (TREE_CODE (field) == INTEGER_CST)
1536 curidx = tree_to_double_int (field);
1537 pp_string (buffer, "]=");
1540 if (is_array_init)
1541 curidx += double_int_one;
1542 if (val && TREE_CODE (val) == ADDR_EXPR)
1543 if (TREE_CODE (TREE_OPERAND (val, 0)) == FUNCTION_DECL)
1544 val = TREE_OPERAND (val, 0);
1545 if (val && TREE_CODE (val) == FUNCTION_DECL)
1546 dump_decl_name (buffer, val, flags);
1547 else
1548 dump_generic_node (buffer, val, spc, flags, false);
1549 if (ix != vec_safe_length (CONSTRUCTOR_ELTS (node)) - 1)
1551 pp_comma (buffer);
1552 pp_space (buffer);
1555 pp_right_brace (buffer);
1557 break;
1559 case COMPOUND_EXPR:
1561 tree *tp;
1562 if (flags & TDF_SLIM)
1564 pp_string (buffer, "<COMPOUND_EXPR>");
1565 break;
1568 dump_generic_node (buffer, TREE_OPERAND (node, 0),
1569 spc, flags, !(flags & TDF_SLIM));
1570 if (flags & TDF_SLIM)
1571 newline_and_indent (buffer, spc);
1572 else
1574 pp_comma (buffer);
1575 pp_space (buffer);
1578 for (tp = &TREE_OPERAND (node, 1);
1579 TREE_CODE (*tp) == COMPOUND_EXPR;
1580 tp = &TREE_OPERAND (*tp, 1))
1582 dump_generic_node (buffer, TREE_OPERAND (*tp, 0),
1583 spc, flags, !(flags & TDF_SLIM));
1584 if (flags & TDF_SLIM)
1585 newline_and_indent (buffer, spc);
1586 else
1588 pp_comma (buffer);
1589 pp_space (buffer);
1593 dump_generic_node (buffer, *tp, spc, flags, !(flags & TDF_SLIM));
1595 break;
1597 case STATEMENT_LIST:
1599 tree_stmt_iterator si;
1600 bool first = true;
1602 if (flags & TDF_SLIM)
1604 pp_string (buffer, "<STATEMENT_LIST>");
1605 break;
1608 for (si = tsi_start (node); !tsi_end_p (si); tsi_next (&si))
1610 if (!first)
1611 newline_and_indent (buffer, spc);
1612 else
1613 first = false;
1614 dump_generic_node (buffer, tsi_stmt (si), spc, flags, true);
1617 break;
1619 case MODIFY_EXPR:
1620 case INIT_EXPR:
1621 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags,
1622 false);
1623 pp_space (buffer);
1624 pp_equal (buffer);
1625 pp_space (buffer);
1626 dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags,
1627 false);
1628 break;
1630 case TARGET_EXPR:
1631 pp_string (buffer, "TARGET_EXPR <");
1632 dump_generic_node (buffer, TARGET_EXPR_SLOT (node), spc, flags, false);
1633 pp_comma (buffer);
1634 pp_space (buffer);
1635 dump_generic_node (buffer, TARGET_EXPR_INITIAL (node), spc, flags, false);
1636 pp_greater (buffer);
1637 break;
1639 case DECL_EXPR:
1640 print_declaration (buffer, DECL_EXPR_DECL (node), spc, flags);
1641 is_stmt = false;
1642 break;
1644 case COND_EXPR:
1645 if (TREE_TYPE (node) == NULL || TREE_TYPE (node) == void_type_node)
1647 pp_string (buffer, "if (");
1648 dump_generic_node (buffer, COND_EXPR_COND (node), spc, flags, false);
1649 pp_right_paren (buffer);
1650 /* The lowered cond_exprs should always be printed in full. */
1651 if (COND_EXPR_THEN (node)
1652 && (IS_EMPTY_STMT (COND_EXPR_THEN (node))
1653 || TREE_CODE (COND_EXPR_THEN (node)) == GOTO_EXPR)
1654 && COND_EXPR_ELSE (node)
1655 && (IS_EMPTY_STMT (COND_EXPR_ELSE (node))
1656 || TREE_CODE (COND_EXPR_ELSE (node)) == GOTO_EXPR))
1658 pp_space (buffer);
1659 dump_generic_node (buffer, COND_EXPR_THEN (node),
1660 0, flags, true);
1661 if (!IS_EMPTY_STMT (COND_EXPR_ELSE (node)))
1663 pp_string (buffer, " else ");
1664 dump_generic_node (buffer, COND_EXPR_ELSE (node),
1665 0, flags, true);
1668 else if (!(flags & TDF_SLIM))
1670 /* Output COND_EXPR_THEN. */
1671 if (COND_EXPR_THEN (node))
1673 newline_and_indent (buffer, spc+2);
1674 pp_left_brace (buffer);
1675 newline_and_indent (buffer, spc+4);
1676 dump_generic_node (buffer, COND_EXPR_THEN (node), spc+4,
1677 flags, true);
1678 newline_and_indent (buffer, spc+2);
1679 pp_right_brace (buffer);
1682 /* Output COND_EXPR_ELSE. */
1683 if (COND_EXPR_ELSE (node)
1684 && !IS_EMPTY_STMT (COND_EXPR_ELSE (node)))
1686 newline_and_indent (buffer, spc);
1687 pp_string (buffer, "else");
1688 newline_and_indent (buffer, spc+2);
1689 pp_left_brace (buffer);
1690 newline_and_indent (buffer, spc+4);
1691 dump_generic_node (buffer, COND_EXPR_ELSE (node), spc+4,
1692 flags, true);
1693 newline_and_indent (buffer, spc+2);
1694 pp_right_brace (buffer);
1697 is_expr = false;
1699 else
1701 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1702 pp_space (buffer);
1703 pp_question (buffer);
1704 pp_space (buffer);
1705 dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
1706 pp_space (buffer);
1707 pp_colon (buffer);
1708 pp_space (buffer);
1709 dump_generic_node (buffer, TREE_OPERAND (node, 2), spc, flags, false);
1711 break;
1713 case BIND_EXPR:
1714 pp_left_brace (buffer);
1715 if (!(flags & TDF_SLIM))
1717 if (BIND_EXPR_VARS (node))
1719 pp_newline (buffer);
1721 for (op0 = BIND_EXPR_VARS (node); op0; op0 = DECL_CHAIN (op0))
1723 print_declaration (buffer, op0, spc+2, flags);
1724 pp_newline (buffer);
1728 newline_and_indent (buffer, spc+2);
1729 dump_generic_node (buffer, BIND_EXPR_BODY (node), spc+2, flags, true);
1730 newline_and_indent (buffer, spc);
1731 pp_right_brace (buffer);
1733 is_expr = false;
1734 break;
1736 case CALL_EXPR:
1737 print_call_name (buffer, CALL_EXPR_FN (node), flags);
1739 /* Print parameters. */
1740 pp_space (buffer);
1741 pp_left_paren (buffer);
1743 tree arg;
1744 call_expr_arg_iterator iter;
1745 FOR_EACH_CALL_EXPR_ARG (arg, iter, node)
1747 dump_generic_node (buffer, arg, spc, flags, false);
1748 if (more_call_expr_args_p (&iter))
1750 pp_comma (buffer);
1751 pp_space (buffer);
1755 if (CALL_EXPR_VA_ARG_PACK (node))
1757 if (call_expr_nargs (node) > 0)
1759 pp_comma (buffer);
1760 pp_space (buffer);
1762 pp_string (buffer, "__builtin_va_arg_pack ()");
1764 pp_right_paren (buffer);
1766 op1 = CALL_EXPR_STATIC_CHAIN (node);
1767 if (op1)
1769 pp_string (buffer, " [static-chain: ");
1770 dump_generic_node (buffer, op1, spc, flags, false);
1771 pp_right_bracket (buffer);
1774 if (CALL_EXPR_RETURN_SLOT_OPT (node))
1775 pp_string (buffer, " [return slot optimization]");
1776 if (CALL_EXPR_TAILCALL (node))
1777 pp_string (buffer, " [tail call]");
1778 break;
1780 case WITH_CLEANUP_EXPR:
1781 NIY;
1782 break;
1784 case CLEANUP_POINT_EXPR:
1785 pp_string (buffer, "<<cleanup_point ");
1786 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1787 pp_string (buffer, ">>");
1788 break;
1790 case PLACEHOLDER_EXPR:
1791 pp_string (buffer, "<PLACEHOLDER_EXPR ");
1792 dump_generic_node (buffer, TREE_TYPE (node), spc, flags, false);
1793 pp_greater (buffer);
1794 break;
1796 /* Binary arithmetic and logic expressions. */
1797 case WIDEN_SUM_EXPR:
1798 case WIDEN_MULT_EXPR:
1799 case MULT_EXPR:
1800 case MULT_HIGHPART_EXPR:
1801 case PLUS_EXPR:
1802 case POINTER_PLUS_EXPR:
1803 case MINUS_EXPR:
1804 case TRUNC_DIV_EXPR:
1805 case CEIL_DIV_EXPR:
1806 case FLOOR_DIV_EXPR:
1807 case ROUND_DIV_EXPR:
1808 case TRUNC_MOD_EXPR:
1809 case CEIL_MOD_EXPR:
1810 case FLOOR_MOD_EXPR:
1811 case ROUND_MOD_EXPR:
1812 case RDIV_EXPR:
1813 case EXACT_DIV_EXPR:
1814 case LSHIFT_EXPR:
1815 case RSHIFT_EXPR:
1816 case LROTATE_EXPR:
1817 case RROTATE_EXPR:
1818 case VEC_LSHIFT_EXPR:
1819 case VEC_RSHIFT_EXPR:
1820 case WIDEN_LSHIFT_EXPR:
1821 case BIT_IOR_EXPR:
1822 case BIT_XOR_EXPR:
1823 case BIT_AND_EXPR:
1824 case TRUTH_ANDIF_EXPR:
1825 case TRUTH_ORIF_EXPR:
1826 case TRUTH_AND_EXPR:
1827 case TRUTH_OR_EXPR:
1828 case TRUTH_XOR_EXPR:
1829 case LT_EXPR:
1830 case LE_EXPR:
1831 case GT_EXPR:
1832 case GE_EXPR:
1833 case EQ_EXPR:
1834 case NE_EXPR:
1835 case UNLT_EXPR:
1836 case UNLE_EXPR:
1837 case UNGT_EXPR:
1838 case UNGE_EXPR:
1839 case UNEQ_EXPR:
1840 case LTGT_EXPR:
1841 case ORDERED_EXPR:
1842 case UNORDERED_EXPR:
1844 const char *op = op_symbol (node);
1845 op0 = TREE_OPERAND (node, 0);
1846 op1 = TREE_OPERAND (node, 1);
1848 /* When the operands are expressions with less priority,
1849 keep semantics of the tree representation. */
1850 if (op_prio (op0) <= op_prio (node))
1852 pp_left_paren (buffer);
1853 dump_generic_node (buffer, op0, spc, flags, false);
1854 pp_right_paren (buffer);
1856 else
1857 dump_generic_node (buffer, op0, spc, flags, false);
1859 pp_space (buffer);
1860 pp_string (buffer, op);
1861 pp_space (buffer);
1863 /* When the operands are expressions with less priority,
1864 keep semantics of the tree representation. */
1865 if (op_prio (op1) <= op_prio (node))
1867 pp_left_paren (buffer);
1868 dump_generic_node (buffer, op1, spc, flags, false);
1869 pp_right_paren (buffer);
1871 else
1872 dump_generic_node (buffer, op1, spc, flags, false);
1874 break;
1876 /* Unary arithmetic and logic expressions. */
1877 case NEGATE_EXPR:
1878 case BIT_NOT_EXPR:
1879 case TRUTH_NOT_EXPR:
1880 case ADDR_EXPR:
1881 case PREDECREMENT_EXPR:
1882 case PREINCREMENT_EXPR:
1883 case INDIRECT_REF:
1884 if (TREE_CODE (node) == ADDR_EXPR
1885 && (TREE_CODE (TREE_OPERAND (node, 0)) == STRING_CST
1886 || TREE_CODE (TREE_OPERAND (node, 0)) == FUNCTION_DECL))
1887 ; /* Do not output '&' for strings and function pointers. */
1888 else
1889 pp_string (buffer, op_symbol (node));
1891 if (op_prio (TREE_OPERAND (node, 0)) < op_prio (node))
1893 pp_left_paren (buffer);
1894 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1895 pp_right_paren (buffer);
1897 else
1898 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1899 break;
1901 case POSTDECREMENT_EXPR:
1902 case POSTINCREMENT_EXPR:
1903 if (op_prio (TREE_OPERAND (node, 0)) < op_prio (node))
1905 pp_left_paren (buffer);
1906 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1907 pp_right_paren (buffer);
1909 else
1910 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1911 pp_string (buffer, op_symbol (node));
1912 break;
1914 case MIN_EXPR:
1915 pp_string (buffer, "MIN_EXPR <");
1916 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1917 pp_string (buffer, ", ");
1918 dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
1919 pp_greater (buffer);
1920 break;
1922 case MAX_EXPR:
1923 pp_string (buffer, "MAX_EXPR <");
1924 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1925 pp_string (buffer, ", ");
1926 dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
1927 pp_greater (buffer);
1928 break;
1930 case ABS_EXPR:
1931 pp_string (buffer, "ABS_EXPR <");
1932 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1933 pp_greater (buffer);
1934 break;
1936 case RANGE_EXPR:
1937 NIY;
1938 break;
1940 case ADDR_SPACE_CONVERT_EXPR:
1941 case FIXED_CONVERT_EXPR:
1942 case FIX_TRUNC_EXPR:
1943 case FLOAT_EXPR:
1944 CASE_CONVERT:
1945 type = TREE_TYPE (node);
1946 op0 = TREE_OPERAND (node, 0);
1947 if (type != TREE_TYPE (op0))
1949 pp_left_paren (buffer);
1950 dump_generic_node (buffer, type, spc, flags, false);
1951 pp_string (buffer, ") ");
1953 if (op_prio (op0) < op_prio (node))
1954 pp_left_paren (buffer);
1955 dump_generic_node (buffer, op0, spc, flags, false);
1956 if (op_prio (op0) < op_prio (node))
1957 pp_right_paren (buffer);
1958 break;
1960 case VIEW_CONVERT_EXPR:
1961 pp_string (buffer, "VIEW_CONVERT_EXPR<");
1962 dump_generic_node (buffer, TREE_TYPE (node), spc, flags, false);
1963 pp_string (buffer, ">(");
1964 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1965 pp_right_paren (buffer);
1966 break;
1968 case PAREN_EXPR:
1969 pp_string (buffer, "((");
1970 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1971 pp_string (buffer, "))");
1972 break;
1974 case NON_LVALUE_EXPR:
1975 pp_string (buffer, "NON_LVALUE_EXPR <");
1976 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1977 pp_greater (buffer);
1978 break;
1980 case SAVE_EXPR:
1981 pp_string (buffer, "SAVE_EXPR <");
1982 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1983 pp_greater (buffer);
1984 break;
1986 case COMPLEX_EXPR:
1987 pp_string (buffer, "COMPLEX_EXPR <");
1988 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1989 pp_string (buffer, ", ");
1990 dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
1991 pp_greater (buffer);
1992 break;
1994 case CONJ_EXPR:
1995 pp_string (buffer, "CONJ_EXPR <");
1996 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1997 pp_greater (buffer);
1998 break;
2000 case REALPART_EXPR:
2001 pp_string (buffer, "REALPART_EXPR <");
2002 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
2003 pp_greater (buffer);
2004 break;
2006 case IMAGPART_EXPR:
2007 pp_string (buffer, "IMAGPART_EXPR <");
2008 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
2009 pp_greater (buffer);
2010 break;
2012 case VA_ARG_EXPR:
2013 pp_string (buffer, "VA_ARG_EXPR <");
2014 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
2015 pp_greater (buffer);
2016 break;
2018 case TRY_FINALLY_EXPR:
2019 case TRY_CATCH_EXPR:
2020 pp_string (buffer, "try");
2021 newline_and_indent (buffer, spc+2);
2022 pp_left_brace (buffer);
2023 newline_and_indent (buffer, spc+4);
2024 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc+4, flags, true);
2025 newline_and_indent (buffer, spc+2);
2026 pp_right_brace (buffer);
2027 newline_and_indent (buffer, spc);
2028 pp_string (buffer,
2029 (TREE_CODE (node) == TRY_CATCH_EXPR) ? "catch" : "finally");
2030 newline_and_indent (buffer, spc+2);
2031 pp_left_brace (buffer);
2032 newline_and_indent (buffer, spc+4);
2033 dump_generic_node (buffer, TREE_OPERAND (node, 1), spc+4, flags, true);
2034 newline_and_indent (buffer, spc+2);
2035 pp_right_brace (buffer);
2036 is_expr = false;
2037 break;
2039 case CATCH_EXPR:
2040 pp_string (buffer, "catch (");
2041 dump_generic_node (buffer, CATCH_TYPES (node), spc+2, flags, false);
2042 pp_right_paren (buffer);
2043 newline_and_indent (buffer, spc+2);
2044 pp_left_brace (buffer);
2045 newline_and_indent (buffer, spc+4);
2046 dump_generic_node (buffer, CATCH_BODY (node), spc+4, flags, true);
2047 newline_and_indent (buffer, spc+2);
2048 pp_right_brace (buffer);
2049 is_expr = false;
2050 break;
2052 case EH_FILTER_EXPR:
2053 pp_string (buffer, "<<<eh_filter (");
2054 dump_generic_node (buffer, EH_FILTER_TYPES (node), spc+2, flags, false);
2055 pp_string (buffer, ")>>>");
2056 newline_and_indent (buffer, spc+2);
2057 pp_left_brace (buffer);
2058 newline_and_indent (buffer, spc+4);
2059 dump_generic_node (buffer, EH_FILTER_FAILURE (node), spc+4, flags, true);
2060 newline_and_indent (buffer, spc+2);
2061 pp_right_brace (buffer);
2062 is_expr = false;
2063 break;
2065 case LABEL_EXPR:
2066 op0 = TREE_OPERAND (node, 0);
2067 /* If this is for break or continue, don't bother printing it. */
2068 if (DECL_NAME (op0))
2070 const char *name = IDENTIFIER_POINTER (DECL_NAME (op0));
2071 if (strcmp (name, "break") == 0
2072 || strcmp (name, "continue") == 0)
2073 break;
2075 dump_generic_node (buffer, op0, spc, flags, false);
2076 pp_colon (buffer);
2077 if (DECL_NONLOCAL (op0))
2078 pp_string (buffer, " [non-local]");
2079 break;
2081 case LOOP_EXPR:
2082 pp_string (buffer, "while (1)");
2083 if (!(flags & TDF_SLIM))
2085 newline_and_indent (buffer, spc+2);
2086 pp_left_brace (buffer);
2087 newline_and_indent (buffer, spc+4);
2088 dump_generic_node (buffer, LOOP_EXPR_BODY (node), spc+4, flags, true);
2089 newline_and_indent (buffer, spc+2);
2090 pp_right_brace (buffer);
2092 is_expr = false;
2093 break;
2095 case PREDICT_EXPR:
2096 pp_string (buffer, "// predicted ");
2097 if (PREDICT_EXPR_OUTCOME (node))
2098 pp_string (buffer, "likely by ");
2099 else
2100 pp_string (buffer, "unlikely by ");
2101 pp_string (buffer, predictor_name (PREDICT_EXPR_PREDICTOR (node)));
2102 pp_string (buffer, " predictor.");
2103 break;
2105 case ANNOTATE_EXPR:
2106 pp_string (buffer, "ANNOTATE_EXPR <");
2107 switch ((enum annot_expr_kind) TREE_INT_CST_LOW (TREE_OPERAND (node, 1)))
2109 case annot_expr_ivdep_kind:
2110 pp_string (buffer, "ivdep, ");
2111 break;
2113 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
2114 pp_greater (buffer);
2115 break;
2117 case RETURN_EXPR:
2118 pp_string (buffer, "return");
2119 op0 = TREE_OPERAND (node, 0);
2120 if (op0)
2122 pp_space (buffer);
2123 if (TREE_CODE (op0) == MODIFY_EXPR)
2124 dump_generic_node (buffer, TREE_OPERAND (op0, 1),
2125 spc, flags, false);
2126 else
2127 dump_generic_node (buffer, op0, spc, flags, false);
2129 break;
2131 case EXIT_EXPR:
2132 pp_string (buffer, "if (");
2133 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
2134 pp_string (buffer, ") break");
2135 break;
2137 case SWITCH_EXPR:
2138 pp_string (buffer, "switch (");
2139 dump_generic_node (buffer, SWITCH_COND (node), spc, flags, false);
2140 pp_right_paren (buffer);
2141 if (!(flags & TDF_SLIM))
2143 newline_and_indent (buffer, spc+2);
2144 pp_left_brace (buffer);
2145 if (SWITCH_BODY (node))
2147 newline_and_indent (buffer, spc+4);
2148 dump_generic_node (buffer, SWITCH_BODY (node), spc+4, flags,
2149 true);
2151 else
2153 tree vec = SWITCH_LABELS (node);
2154 size_t i, n = TREE_VEC_LENGTH (vec);
2155 for (i = 0; i < n; ++i)
2157 tree elt = TREE_VEC_ELT (vec, i);
2158 newline_and_indent (buffer, spc+4);
2159 if (elt)
2161 dump_generic_node (buffer, elt, spc+4, flags, false);
2162 pp_string (buffer, " goto ");
2163 dump_generic_node (buffer, CASE_LABEL (elt), spc+4,
2164 flags, true);
2165 pp_semicolon (buffer);
2167 else
2168 pp_string (buffer, "case ???: goto ???;");
2171 newline_and_indent (buffer, spc+2);
2172 pp_right_brace (buffer);
2174 is_expr = false;
2175 break;
2177 case GOTO_EXPR:
2178 op0 = GOTO_DESTINATION (node);
2179 if (TREE_CODE (op0) != SSA_NAME && DECL_P (op0) && DECL_NAME (op0))
2181 const char *name = IDENTIFIER_POINTER (DECL_NAME (op0));
2182 if (strcmp (name, "break") == 0
2183 || strcmp (name, "continue") == 0)
2185 pp_string (buffer, name);
2186 break;
2189 pp_string (buffer, "goto ");
2190 dump_generic_node (buffer, op0, spc, flags, false);
2191 break;
2193 case ASM_EXPR:
2194 pp_string (buffer, "__asm__");
2195 if (ASM_VOLATILE_P (node))
2196 pp_string (buffer, " __volatile__");
2197 pp_left_paren (buffer);
2198 dump_generic_node (buffer, ASM_STRING (node), spc, flags, false);
2199 pp_colon (buffer);
2200 dump_generic_node (buffer, ASM_OUTPUTS (node), spc, flags, false);
2201 pp_colon (buffer);
2202 dump_generic_node (buffer, ASM_INPUTS (node), spc, flags, false);
2203 if (ASM_CLOBBERS (node))
2205 pp_colon (buffer);
2206 dump_generic_node (buffer, ASM_CLOBBERS (node), spc, flags, false);
2208 pp_right_paren (buffer);
2209 break;
2211 case CASE_LABEL_EXPR:
2212 if (CASE_LOW (node) && CASE_HIGH (node))
2214 pp_string (buffer, "case ");
2215 dump_generic_node (buffer, CASE_LOW (node), spc, flags, false);
2216 pp_string (buffer, " ... ");
2217 dump_generic_node (buffer, CASE_HIGH (node), spc, flags, false);
2219 else if (CASE_LOW (node))
2221 pp_string (buffer, "case ");
2222 dump_generic_node (buffer, CASE_LOW (node), spc, flags, false);
2224 else
2225 pp_string (buffer, "default");
2226 pp_colon (buffer);
2227 break;
2229 case OBJ_TYPE_REF:
2230 pp_string (buffer, "OBJ_TYPE_REF(");
2231 dump_generic_node (buffer, OBJ_TYPE_REF_EXPR (node), spc, flags, false);
2232 pp_semicolon (buffer);
2233 if (!(flags & TDF_SLIM) && virtual_method_call_p (node))
2235 pp_string (buffer, "(");
2236 dump_generic_node (buffer, obj_type_ref_class (node), spc, flags, false);
2237 pp_string (buffer, ")");
2239 dump_generic_node (buffer, OBJ_TYPE_REF_OBJECT (node), spc, flags, false);
2240 pp_arrow (buffer);
2241 dump_generic_node (buffer, OBJ_TYPE_REF_TOKEN (node), spc, flags, false);
2242 pp_right_paren (buffer);
2243 break;
2245 case SSA_NAME:
2246 if (SSA_NAME_IDENTIFIER (node))
2247 dump_generic_node (buffer, SSA_NAME_IDENTIFIER (node),
2248 spc, flags, false);
2249 pp_underscore (buffer);
2250 pp_decimal_int (buffer, SSA_NAME_VERSION (node));
2251 if (SSA_NAME_IS_DEFAULT_DEF (node))
2252 pp_string (buffer, "(D)");
2253 if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (node))
2254 pp_string (buffer, "(ab)");
2255 break;
2257 case WITH_SIZE_EXPR:
2258 pp_string (buffer, "WITH_SIZE_EXPR <");
2259 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
2260 pp_string (buffer, ", ");
2261 dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
2262 pp_greater (buffer);
2263 break;
2265 case ASSERT_EXPR:
2266 pp_string (buffer, "ASSERT_EXPR <");
2267 dump_generic_node (buffer, ASSERT_EXPR_VAR (node), spc, flags, false);
2268 pp_string (buffer, ", ");
2269 dump_generic_node (buffer, ASSERT_EXPR_COND (node), spc, flags, false);
2270 pp_greater (buffer);
2271 break;
2273 case SCEV_KNOWN:
2274 pp_string (buffer, "scev_known");
2275 break;
2277 case SCEV_NOT_KNOWN:
2278 pp_string (buffer, "scev_not_known");
2279 break;
2281 case POLYNOMIAL_CHREC:
2282 pp_left_brace (buffer);
2283 dump_generic_node (buffer, CHREC_LEFT (node), spc, flags, false);
2284 pp_string (buffer, ", +, ");
2285 dump_generic_node (buffer, CHREC_RIGHT (node), spc, flags, false);
2286 pp_string (buffer, "}_");
2287 dump_generic_node (buffer, CHREC_VAR (node), spc, flags, false);
2288 is_stmt = false;
2289 break;
2291 case REALIGN_LOAD_EXPR:
2292 pp_string (buffer, "REALIGN_LOAD <");
2293 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
2294 pp_string (buffer, ", ");
2295 dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
2296 pp_string (buffer, ", ");
2297 dump_generic_node (buffer, TREE_OPERAND (node, 2), spc, flags, false);
2298 pp_greater (buffer);
2299 break;
2301 case VEC_COND_EXPR:
2302 pp_string (buffer, " VEC_COND_EXPR < ");
2303 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
2304 pp_string (buffer, " , ");
2305 dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
2306 pp_string (buffer, " , ");
2307 dump_generic_node (buffer, TREE_OPERAND (node, 2), spc, flags, false);
2308 pp_string (buffer, " > ");
2309 break;
2311 case VEC_PERM_EXPR:
2312 pp_string (buffer, " VEC_PERM_EXPR < ");
2313 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
2314 pp_string (buffer, " , ");
2315 dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
2316 pp_string (buffer, " , ");
2317 dump_generic_node (buffer, TREE_OPERAND (node, 2), spc, flags, false);
2318 pp_string (buffer, " > ");
2319 break;
2321 case DOT_PROD_EXPR:
2322 pp_string (buffer, " DOT_PROD_EXPR < ");
2323 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
2324 pp_string (buffer, ", ");
2325 dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
2326 pp_string (buffer, ", ");
2327 dump_generic_node (buffer, TREE_OPERAND (node, 2), spc, flags, false);
2328 pp_string (buffer, " > ");
2329 break;
2331 case WIDEN_MULT_PLUS_EXPR:
2332 pp_string (buffer, " WIDEN_MULT_PLUS_EXPR < ");
2333 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
2334 pp_string (buffer, ", ");
2335 dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
2336 pp_string (buffer, ", ");
2337 dump_generic_node (buffer, TREE_OPERAND (node, 2), spc, flags, false);
2338 pp_string (buffer, " > ");
2339 break;
2341 case WIDEN_MULT_MINUS_EXPR:
2342 pp_string (buffer, " WIDEN_MULT_MINUS_EXPR < ");
2343 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
2344 pp_string (buffer, ", ");
2345 dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
2346 pp_string (buffer, ", ");
2347 dump_generic_node (buffer, TREE_OPERAND (node, 2), spc, flags, false);
2348 pp_string (buffer, " > ");
2349 break;
2351 case FMA_EXPR:
2352 pp_string (buffer, " FMA_EXPR < ");
2353 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
2354 pp_string (buffer, ", ");
2355 dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
2356 pp_string (buffer, ", ");
2357 dump_generic_node (buffer, TREE_OPERAND (node, 2), spc, flags, false);
2358 pp_string (buffer, " > ");
2359 break;
2361 case OMP_PARALLEL:
2362 pp_string (buffer, "#pragma omp parallel");
2363 dump_omp_clauses (buffer, OMP_PARALLEL_CLAUSES (node), spc, flags);
2365 dump_omp_body:
2366 if (!(flags & TDF_SLIM) && OMP_BODY (node))
2368 newline_and_indent (buffer, spc + 2);
2369 pp_left_brace (buffer);
2370 newline_and_indent (buffer, spc + 4);
2371 dump_generic_node (buffer, OMP_BODY (node), spc + 4, flags, false);
2372 newline_and_indent (buffer, spc + 2);
2373 pp_right_brace (buffer);
2375 is_expr = false;
2376 break;
2378 case OMP_TASK:
2379 pp_string (buffer, "#pragma omp task");
2380 dump_omp_clauses (buffer, OMP_TASK_CLAUSES (node), spc, flags);
2381 goto dump_omp_body;
2383 case OMP_FOR:
2384 pp_string (buffer, "#pragma omp for");
2385 goto dump_omp_loop;
2387 case OMP_SIMD:
2388 pp_string (buffer, "#pragma omp simd");
2389 goto dump_omp_loop;
2391 case CILK_SIMD:
2392 pp_string (buffer, "#pragma simd");
2393 goto dump_omp_loop;
2395 case OMP_DISTRIBUTE:
2396 pp_string (buffer, "#pragma omp distribute");
2397 goto dump_omp_loop;
2399 case OMP_TEAMS:
2400 pp_string (buffer, "#pragma omp teams");
2401 dump_omp_clauses (buffer, OMP_TEAMS_CLAUSES (node), spc, flags);
2402 goto dump_omp_body;
2404 case OMP_TARGET_DATA:
2405 pp_string (buffer, "#pragma omp target data");
2406 dump_omp_clauses (buffer, OMP_TARGET_DATA_CLAUSES (node), spc, flags);
2407 goto dump_omp_body;
2409 case OMP_TARGET:
2410 pp_string (buffer, "#pragma omp target");
2411 dump_omp_clauses (buffer, OMP_TARGET_CLAUSES (node), spc, flags);
2412 goto dump_omp_body;
2414 case OMP_TARGET_UPDATE:
2415 pp_string (buffer, "#pragma omp target update");
2416 dump_omp_clauses (buffer, OMP_TARGET_UPDATE_CLAUSES (node), spc, flags);
2417 is_expr = false;
2418 break;
2420 dump_omp_loop:
2421 dump_omp_clauses (buffer, OMP_FOR_CLAUSES (node), spc, flags);
2423 if (!(flags & TDF_SLIM))
2425 int i;
2427 if (OMP_FOR_PRE_BODY (node))
2429 newline_and_indent (buffer, spc + 2);
2430 pp_left_brace (buffer);
2431 spc += 4;
2432 newline_and_indent (buffer, spc);
2433 dump_generic_node (buffer, OMP_FOR_PRE_BODY (node),
2434 spc, flags, false);
2436 if (OMP_FOR_INIT (node))
2438 spc -= 2;
2439 for (i = 0; i < TREE_VEC_LENGTH (OMP_FOR_INIT (node)); i++)
2441 spc += 2;
2442 newline_and_indent (buffer, spc);
2443 pp_string (buffer, "for (");
2444 dump_generic_node (buffer,
2445 TREE_VEC_ELT (OMP_FOR_INIT (node), i),
2446 spc, flags, false);
2447 pp_string (buffer, "; ");
2448 dump_generic_node (buffer,
2449 TREE_VEC_ELT (OMP_FOR_COND (node), i),
2450 spc, flags, false);
2451 pp_string (buffer, "; ");
2452 dump_generic_node (buffer,
2453 TREE_VEC_ELT (OMP_FOR_INCR (node), i),
2454 spc, flags, false);
2455 pp_right_paren (buffer);
2458 if (OMP_FOR_BODY (node))
2460 newline_and_indent (buffer, spc + 2);
2461 pp_left_brace (buffer);
2462 newline_and_indent (buffer, spc + 4);
2463 dump_generic_node (buffer, OMP_FOR_BODY (node), spc + 4, flags,
2464 false);
2465 newline_and_indent (buffer, spc + 2);
2466 pp_right_brace (buffer);
2468 if (OMP_FOR_INIT (node))
2469 spc -= 2 * TREE_VEC_LENGTH (OMP_FOR_INIT (node)) - 2;
2470 if (OMP_FOR_PRE_BODY (node))
2472 spc -= 4;
2473 newline_and_indent (buffer, spc + 2);
2474 pp_right_brace (buffer);
2477 is_expr = false;
2478 break;
2480 case OMP_SECTIONS:
2481 pp_string (buffer, "#pragma omp sections");
2482 dump_omp_clauses (buffer, OMP_SECTIONS_CLAUSES (node), spc, flags);
2483 goto dump_omp_body;
2485 case OMP_SECTION:
2486 pp_string (buffer, "#pragma omp section");
2487 goto dump_omp_body;
2489 case OMP_MASTER:
2490 pp_string (buffer, "#pragma omp master");
2491 goto dump_omp_body;
2493 case OMP_TASKGROUP:
2494 pp_string (buffer, "#pragma omp taskgroup");
2495 goto dump_omp_body;
2497 case OMP_ORDERED:
2498 pp_string (buffer, "#pragma omp ordered");
2499 goto dump_omp_body;
2501 case OMP_CRITICAL:
2502 pp_string (buffer, "#pragma omp critical");
2503 if (OMP_CRITICAL_NAME (node))
2505 pp_space (buffer);
2506 pp_left_paren (buffer);
2507 dump_generic_node (buffer, OMP_CRITICAL_NAME (node), spc,
2508 flags, false);
2509 pp_right_paren (buffer);
2511 goto dump_omp_body;
2513 case OMP_ATOMIC:
2514 pp_string (buffer, "#pragma omp atomic");
2515 if (OMP_ATOMIC_SEQ_CST (node))
2516 pp_string (buffer, " seq_cst");
2517 newline_and_indent (buffer, spc + 2);
2518 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
2519 pp_space (buffer);
2520 pp_equal (buffer);
2521 pp_space (buffer);
2522 dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
2523 break;
2525 case OMP_ATOMIC_READ:
2526 pp_string (buffer, "#pragma omp atomic read");
2527 if (OMP_ATOMIC_SEQ_CST (node))
2528 pp_string (buffer, " seq_cst");
2529 newline_and_indent (buffer, spc + 2);
2530 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
2531 pp_space (buffer);
2532 break;
2534 case OMP_ATOMIC_CAPTURE_OLD:
2535 case OMP_ATOMIC_CAPTURE_NEW:
2536 pp_string (buffer, "#pragma omp atomic capture");
2537 if (OMP_ATOMIC_SEQ_CST (node))
2538 pp_string (buffer, " seq_cst");
2539 newline_and_indent (buffer, spc + 2);
2540 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
2541 pp_space (buffer);
2542 pp_equal (buffer);
2543 pp_space (buffer);
2544 dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
2545 break;
2547 case OMP_SINGLE:
2548 pp_string (buffer, "#pragma omp single");
2549 dump_omp_clauses (buffer, OMP_SINGLE_CLAUSES (node), spc, flags);
2550 goto dump_omp_body;
2552 case OMP_CLAUSE:
2553 dump_omp_clause (buffer, node, spc, flags);
2554 is_expr = false;
2555 break;
2557 case TRANSACTION_EXPR:
2558 if (TRANSACTION_EXPR_OUTER (node))
2559 pp_string (buffer, "__transaction_atomic [[outer]]");
2560 else if (TRANSACTION_EXPR_RELAXED (node))
2561 pp_string (buffer, "__transaction_relaxed");
2562 else
2563 pp_string (buffer, "__transaction_atomic");
2564 if (!(flags & TDF_SLIM) && TRANSACTION_EXPR_BODY (node))
2566 newline_and_indent (buffer, spc);
2567 pp_left_brace (buffer);
2568 newline_and_indent (buffer, spc + 2);
2569 dump_generic_node (buffer, TRANSACTION_EXPR_BODY (node),
2570 spc + 2, flags, false);
2571 newline_and_indent (buffer, spc);
2572 pp_right_brace (buffer);
2574 is_expr = false;
2575 break;
2577 case REDUC_MAX_EXPR:
2578 pp_string (buffer, " REDUC_MAX_EXPR < ");
2579 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
2580 pp_string (buffer, " > ");
2581 break;
2583 case REDUC_MIN_EXPR:
2584 pp_string (buffer, " REDUC_MIN_EXPR < ");
2585 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
2586 pp_string (buffer, " > ");
2587 break;
2589 case REDUC_PLUS_EXPR:
2590 pp_string (buffer, " REDUC_PLUS_EXPR < ");
2591 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
2592 pp_string (buffer, " > ");
2593 break;
2595 case VEC_WIDEN_MULT_HI_EXPR:
2596 case VEC_WIDEN_MULT_LO_EXPR:
2597 case VEC_WIDEN_MULT_EVEN_EXPR:
2598 case VEC_WIDEN_MULT_ODD_EXPR:
2599 case VEC_WIDEN_LSHIFT_HI_EXPR:
2600 case VEC_WIDEN_LSHIFT_LO_EXPR:
2601 pp_space (buffer);
2602 for (str = get_tree_code_name (code); *str; str++)
2603 pp_character (buffer, TOUPPER (*str));
2604 pp_string (buffer, " < ");
2605 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
2606 pp_string (buffer, ", ");
2607 dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
2608 pp_string (buffer, " > ");
2609 break;
2611 case VEC_UNPACK_HI_EXPR:
2612 pp_string (buffer, " VEC_UNPACK_HI_EXPR < ");
2613 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
2614 pp_string (buffer, " > ");
2615 break;
2617 case VEC_UNPACK_LO_EXPR:
2618 pp_string (buffer, " VEC_UNPACK_LO_EXPR < ");
2619 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
2620 pp_string (buffer, " > ");
2621 break;
2623 case VEC_UNPACK_FLOAT_HI_EXPR:
2624 pp_string (buffer, " VEC_UNPACK_FLOAT_HI_EXPR < ");
2625 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
2626 pp_string (buffer, " > ");
2627 break;
2629 case VEC_UNPACK_FLOAT_LO_EXPR:
2630 pp_string (buffer, " VEC_UNPACK_FLOAT_LO_EXPR < ");
2631 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
2632 pp_string (buffer, " > ");
2633 break;
2635 case VEC_PACK_TRUNC_EXPR:
2636 pp_string (buffer, " VEC_PACK_TRUNC_EXPR < ");
2637 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
2638 pp_string (buffer, ", ");
2639 dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
2640 pp_string (buffer, " > ");
2641 break;
2643 case VEC_PACK_SAT_EXPR:
2644 pp_string (buffer, " VEC_PACK_SAT_EXPR < ");
2645 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
2646 pp_string (buffer, ", ");
2647 dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
2648 pp_string (buffer, " > ");
2649 break;
2651 case VEC_PACK_FIX_TRUNC_EXPR:
2652 pp_string (buffer, " VEC_PACK_FIX_TRUNC_EXPR < ");
2653 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
2654 pp_string (buffer, ", ");
2655 dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
2656 pp_string (buffer, " > ");
2657 break;
2659 case BLOCK:
2660 dump_block_node (buffer, node, spc, flags);
2661 break;
2663 case CILK_SPAWN_STMT:
2664 pp_string (buffer, "_Cilk_spawn ");
2665 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
2666 break;
2668 case CILK_SYNC_STMT:
2669 pp_string (buffer, "_Cilk_sync");
2670 break;
2672 default:
2673 NIY;
2676 if (is_stmt && is_expr)
2677 pp_semicolon (buffer);
2679 return spc;
2682 /* Print the declaration of a variable. */
2684 void
2685 print_declaration (pretty_printer *buffer, tree t, int spc, int flags)
2687 INDENT (spc);
2689 if (TREE_CODE (t) == TYPE_DECL)
2690 pp_string (buffer, "typedef ");
2692 if (CODE_CONTAINS_STRUCT (TREE_CODE (t), TS_DECL_WRTL) && DECL_REGISTER (t))
2693 pp_string (buffer, "register ");
2695 if (TREE_PUBLIC (t) && DECL_EXTERNAL (t))
2696 pp_string (buffer, "extern ");
2697 else if (TREE_STATIC (t))
2698 pp_string (buffer, "static ");
2700 /* Print the type and name. */
2701 if (TREE_TYPE (t) && TREE_CODE (TREE_TYPE (t)) == ARRAY_TYPE)
2703 tree tmp;
2705 /* Print array's type. */
2706 tmp = TREE_TYPE (t);
2707 while (TREE_CODE (TREE_TYPE (tmp)) == ARRAY_TYPE)
2708 tmp = TREE_TYPE (tmp);
2709 dump_generic_node (buffer, TREE_TYPE (tmp), spc, flags, false);
2711 /* Print variable's name. */
2712 pp_space (buffer);
2713 dump_generic_node (buffer, t, spc, flags, false);
2715 /* Print the dimensions. */
2716 tmp = TREE_TYPE (t);
2717 while (TREE_CODE (tmp) == ARRAY_TYPE)
2719 dump_array_domain (buffer, TYPE_DOMAIN (tmp), spc, flags);
2720 tmp = TREE_TYPE (tmp);
2723 else if (TREE_CODE (t) == FUNCTION_DECL)
2725 dump_generic_node (buffer, TREE_TYPE (TREE_TYPE (t)), spc, flags, false);
2726 pp_space (buffer);
2727 dump_decl_name (buffer, t, flags);
2728 dump_function_declaration (buffer, TREE_TYPE (t), spc, flags);
2730 else
2732 /* Print type declaration. */
2733 dump_generic_node (buffer, TREE_TYPE (t), spc, flags, false);
2735 /* Print variable's name. */
2736 pp_space (buffer);
2737 dump_generic_node (buffer, t, spc, flags, false);
2740 if (TREE_CODE (t) == VAR_DECL && DECL_HARD_REGISTER (t))
2742 pp_string (buffer, " __asm__ ");
2743 pp_left_paren (buffer);
2744 dump_generic_node (buffer, DECL_ASSEMBLER_NAME (t), spc, flags, false);
2745 pp_right_paren (buffer);
2748 /* The initial value of a function serves to determine whether the function
2749 is declared or defined. So the following does not apply to function
2750 nodes. */
2751 if (TREE_CODE (t) != FUNCTION_DECL)
2753 /* Print the initial value. */
2754 if (DECL_INITIAL (t))
2756 pp_space (buffer);
2757 pp_equal (buffer);
2758 pp_space (buffer);
2759 dump_generic_node (buffer, DECL_INITIAL (t), spc, flags, false);
2763 if (TREE_CODE (t) == VAR_DECL && DECL_HAS_VALUE_EXPR_P (t))
2765 pp_string (buffer, " [value-expr: ");
2766 dump_generic_node (buffer, DECL_VALUE_EXPR (t), spc, flags, false);
2767 pp_right_bracket (buffer);
2770 pp_semicolon (buffer);
2774 /* Prints a structure: name, fields, and methods.
2775 FIXME: Still incomplete. */
2777 static void
2778 print_struct_decl (pretty_printer *buffer, const_tree node, int spc, int flags)
2780 /* Print the name of the structure. */
2781 if (TYPE_NAME (node))
2783 INDENT (spc);
2784 if (TREE_CODE (node) == RECORD_TYPE)
2785 pp_string (buffer, "struct ");
2786 else if ((TREE_CODE (node) == UNION_TYPE
2787 || TREE_CODE (node) == QUAL_UNION_TYPE))
2788 pp_string (buffer, "union ");
2790 dump_generic_node (buffer, TYPE_NAME (node), spc, 0, false);
2793 /* Print the contents of the structure. */
2794 pp_newline (buffer);
2795 INDENT (spc);
2796 pp_left_brace (buffer);
2797 pp_newline (buffer);
2799 /* Print the fields of the structure. */
2801 tree tmp;
2802 tmp = TYPE_FIELDS (node);
2803 while (tmp)
2805 /* Avoid to print recursively the structure. */
2806 /* FIXME : Not implemented correctly...,
2807 what about the case when we have a cycle in the contain graph? ...
2808 Maybe this could be solved by looking at the scope in which the
2809 structure was declared. */
2810 if (TREE_TYPE (tmp) != node
2811 && (TREE_CODE (TREE_TYPE (tmp)) != POINTER_TYPE
2812 || TREE_TYPE (TREE_TYPE (tmp)) != node))
2814 print_declaration (buffer, tmp, spc+2, flags);
2815 pp_newline (buffer);
2817 tmp = DECL_CHAIN (tmp);
2820 INDENT (spc);
2821 pp_right_brace (buffer);
2824 /* Return the priority of the operator CODE.
2826 From lowest to highest precedence with either left-to-right (L-R)
2827 or right-to-left (R-L) associativity]:
2829 1 [L-R] ,
2830 2 [R-L] = += -= *= /= %= &= ^= |= <<= >>=
2831 3 [R-L] ?:
2832 4 [L-R] ||
2833 5 [L-R] &&
2834 6 [L-R] |
2835 7 [L-R] ^
2836 8 [L-R] &
2837 9 [L-R] == !=
2838 10 [L-R] < <= > >=
2839 11 [L-R] << >>
2840 12 [L-R] + -
2841 13 [L-R] * / %
2842 14 [R-L] ! ~ ++ -- + - * & (type) sizeof
2843 15 [L-R] fn() [] -> .
2845 unary +, - and * have higher precedence than the corresponding binary
2846 operators. */
2849 op_code_prio (enum tree_code code)
2851 switch (code)
2853 case TREE_LIST:
2854 case COMPOUND_EXPR:
2855 case BIND_EXPR:
2856 return 1;
2858 case MODIFY_EXPR:
2859 case INIT_EXPR:
2860 return 2;
2862 case COND_EXPR:
2863 return 3;
2865 case TRUTH_OR_EXPR:
2866 case TRUTH_ORIF_EXPR:
2867 return 4;
2869 case TRUTH_AND_EXPR:
2870 case TRUTH_ANDIF_EXPR:
2871 return 5;
2873 case BIT_IOR_EXPR:
2874 return 6;
2876 case BIT_XOR_EXPR:
2877 case TRUTH_XOR_EXPR:
2878 return 7;
2880 case BIT_AND_EXPR:
2881 return 8;
2883 case EQ_EXPR:
2884 case NE_EXPR:
2885 return 9;
2887 case UNLT_EXPR:
2888 case UNLE_EXPR:
2889 case UNGT_EXPR:
2890 case UNGE_EXPR:
2891 case UNEQ_EXPR:
2892 case LTGT_EXPR:
2893 case ORDERED_EXPR:
2894 case UNORDERED_EXPR:
2895 case LT_EXPR:
2896 case LE_EXPR:
2897 case GT_EXPR:
2898 case GE_EXPR:
2899 return 10;
2901 case LSHIFT_EXPR:
2902 case RSHIFT_EXPR:
2903 case LROTATE_EXPR:
2904 case RROTATE_EXPR:
2905 case VEC_WIDEN_LSHIFT_HI_EXPR:
2906 case VEC_WIDEN_LSHIFT_LO_EXPR:
2907 case WIDEN_LSHIFT_EXPR:
2908 return 11;
2910 case WIDEN_SUM_EXPR:
2911 case PLUS_EXPR:
2912 case POINTER_PLUS_EXPR:
2913 case MINUS_EXPR:
2914 return 12;
2916 case VEC_WIDEN_MULT_HI_EXPR:
2917 case VEC_WIDEN_MULT_LO_EXPR:
2918 case WIDEN_MULT_EXPR:
2919 case DOT_PROD_EXPR:
2920 case WIDEN_MULT_PLUS_EXPR:
2921 case WIDEN_MULT_MINUS_EXPR:
2922 case MULT_EXPR:
2923 case MULT_HIGHPART_EXPR:
2924 case TRUNC_DIV_EXPR:
2925 case CEIL_DIV_EXPR:
2926 case FLOOR_DIV_EXPR:
2927 case ROUND_DIV_EXPR:
2928 case RDIV_EXPR:
2929 case EXACT_DIV_EXPR:
2930 case TRUNC_MOD_EXPR:
2931 case CEIL_MOD_EXPR:
2932 case FLOOR_MOD_EXPR:
2933 case ROUND_MOD_EXPR:
2934 case FMA_EXPR:
2935 return 13;
2937 case TRUTH_NOT_EXPR:
2938 case BIT_NOT_EXPR:
2939 case POSTINCREMENT_EXPR:
2940 case POSTDECREMENT_EXPR:
2941 case PREINCREMENT_EXPR:
2942 case PREDECREMENT_EXPR:
2943 case NEGATE_EXPR:
2944 case INDIRECT_REF:
2945 case ADDR_EXPR:
2946 case FLOAT_EXPR:
2947 CASE_CONVERT:
2948 case FIX_TRUNC_EXPR:
2949 case TARGET_EXPR:
2950 return 14;
2952 case CALL_EXPR:
2953 case ARRAY_REF:
2954 case ARRAY_RANGE_REF:
2955 case COMPONENT_REF:
2956 return 15;
2958 /* Special expressions. */
2959 case MIN_EXPR:
2960 case MAX_EXPR:
2961 case ABS_EXPR:
2962 case REALPART_EXPR:
2963 case IMAGPART_EXPR:
2964 case REDUC_MAX_EXPR:
2965 case REDUC_MIN_EXPR:
2966 case REDUC_PLUS_EXPR:
2967 case VEC_LSHIFT_EXPR:
2968 case VEC_RSHIFT_EXPR:
2969 case VEC_UNPACK_HI_EXPR:
2970 case VEC_UNPACK_LO_EXPR:
2971 case VEC_UNPACK_FLOAT_HI_EXPR:
2972 case VEC_UNPACK_FLOAT_LO_EXPR:
2973 case VEC_PACK_TRUNC_EXPR:
2974 case VEC_PACK_SAT_EXPR:
2975 return 16;
2977 default:
2978 /* Return an arbitrarily high precedence to avoid surrounding single
2979 VAR_DECLs in ()s. */
2980 return 9999;
2984 /* Return the priority of the operator OP. */
2987 op_prio (const_tree op)
2989 enum tree_code code;
2991 if (op == NULL)
2992 return 9999;
2994 code = TREE_CODE (op);
2995 if (code == SAVE_EXPR || code == NON_LVALUE_EXPR)
2996 return op_prio (TREE_OPERAND (op, 0));
2998 return op_code_prio (code);
3001 /* Return the symbol associated with operator CODE. */
3003 const char *
3004 op_symbol_code (enum tree_code code)
3006 switch (code)
3008 case MODIFY_EXPR:
3009 return "=";
3011 case TRUTH_OR_EXPR:
3012 case TRUTH_ORIF_EXPR:
3013 return "||";
3015 case TRUTH_AND_EXPR:
3016 case TRUTH_ANDIF_EXPR:
3017 return "&&";
3019 case BIT_IOR_EXPR:
3020 return "|";
3022 case TRUTH_XOR_EXPR:
3023 case BIT_XOR_EXPR:
3024 return "^";
3026 case ADDR_EXPR:
3027 case BIT_AND_EXPR:
3028 return "&";
3030 case ORDERED_EXPR:
3031 return "ord";
3032 case UNORDERED_EXPR:
3033 return "unord";
3035 case EQ_EXPR:
3036 return "==";
3037 case UNEQ_EXPR:
3038 return "u==";
3040 case NE_EXPR:
3041 return "!=";
3043 case LT_EXPR:
3044 return "<";
3045 case UNLT_EXPR:
3046 return "u<";
3048 case LE_EXPR:
3049 return "<=";
3050 case UNLE_EXPR:
3051 return "u<=";
3053 case GT_EXPR:
3054 return ">";
3055 case UNGT_EXPR:
3056 return "u>";
3058 case GE_EXPR:
3059 return ">=";
3060 case UNGE_EXPR:
3061 return "u>=";
3063 case LTGT_EXPR:
3064 return "<>";
3066 case LSHIFT_EXPR:
3067 return "<<";
3069 case RSHIFT_EXPR:
3070 return ">>";
3072 case LROTATE_EXPR:
3073 return "r<<";
3075 case RROTATE_EXPR:
3076 return "r>>";
3078 case VEC_LSHIFT_EXPR:
3079 return "v<<";
3081 case VEC_RSHIFT_EXPR:
3082 return "v>>";
3084 case WIDEN_LSHIFT_EXPR:
3085 return "w<<";
3087 case POINTER_PLUS_EXPR:
3088 return "+";
3090 case PLUS_EXPR:
3091 return "+";
3093 case REDUC_PLUS_EXPR:
3094 return "r+";
3096 case WIDEN_SUM_EXPR:
3097 return "w+";
3099 case WIDEN_MULT_EXPR:
3100 return "w*";
3102 case MULT_HIGHPART_EXPR:
3103 return "h*";
3105 case NEGATE_EXPR:
3106 case MINUS_EXPR:
3107 return "-";
3109 case BIT_NOT_EXPR:
3110 return "~";
3112 case TRUTH_NOT_EXPR:
3113 return "!";
3115 case MULT_EXPR:
3116 case INDIRECT_REF:
3117 return "*";
3119 case TRUNC_DIV_EXPR:
3120 case RDIV_EXPR:
3121 return "/";
3123 case CEIL_DIV_EXPR:
3124 return "/[cl]";
3126 case FLOOR_DIV_EXPR:
3127 return "/[fl]";
3129 case ROUND_DIV_EXPR:
3130 return "/[rd]";
3132 case EXACT_DIV_EXPR:
3133 return "/[ex]";
3135 case TRUNC_MOD_EXPR:
3136 return "%";
3138 case CEIL_MOD_EXPR:
3139 return "%[cl]";
3141 case FLOOR_MOD_EXPR:
3142 return "%[fl]";
3144 case ROUND_MOD_EXPR:
3145 return "%[rd]";
3147 case PREDECREMENT_EXPR:
3148 return " --";
3150 case PREINCREMENT_EXPR:
3151 return " ++";
3153 case POSTDECREMENT_EXPR:
3154 return "-- ";
3156 case POSTINCREMENT_EXPR:
3157 return "++ ";
3159 case MAX_EXPR:
3160 return "max";
3162 case MIN_EXPR:
3163 return "min";
3165 default:
3166 return "<<< ??? >>>";
3170 /* Return the symbol associated with operator OP. */
3172 static const char *
3173 op_symbol (const_tree op)
3175 return op_symbol_code (TREE_CODE (op));
3178 /* Prints the name of a call. NODE is the CALL_EXPR_FN of a CALL_EXPR or
3179 the gimple_call_fn of a GIMPLE_CALL. */
3181 void
3182 print_call_name (pretty_printer *buffer, tree node, int flags)
3184 tree op0 = node;
3186 if (TREE_CODE (op0) == NON_LVALUE_EXPR)
3187 op0 = TREE_OPERAND (op0, 0);
3189 again:
3190 switch (TREE_CODE (op0))
3192 case VAR_DECL:
3193 case PARM_DECL:
3194 case FUNCTION_DECL:
3195 dump_function_name (buffer, op0, flags);
3196 break;
3198 case ADDR_EXPR:
3199 case INDIRECT_REF:
3200 case NOP_EXPR:
3201 op0 = TREE_OPERAND (op0, 0);
3202 goto again;
3204 case COND_EXPR:
3205 pp_left_paren (buffer);
3206 dump_generic_node (buffer, TREE_OPERAND (op0, 0), 0, flags, false);
3207 pp_string (buffer, ") ? ");
3208 dump_generic_node (buffer, TREE_OPERAND (op0, 1), 0, flags, false);
3209 pp_string (buffer, " : ");
3210 dump_generic_node (buffer, TREE_OPERAND (op0, 2), 0, flags, false);
3211 break;
3213 case ARRAY_REF:
3214 if (TREE_CODE (TREE_OPERAND (op0, 0)) == VAR_DECL)
3215 dump_function_name (buffer, TREE_OPERAND (op0, 0), flags);
3216 else
3217 dump_generic_node (buffer, op0, 0, flags, false);
3218 break;
3220 case MEM_REF:
3221 if (integer_zerop (TREE_OPERAND (op0, 1)))
3223 op0 = TREE_OPERAND (op0, 0);
3224 goto again;
3226 /* Fallthru. */
3227 case COMPONENT_REF:
3228 case SSA_NAME:
3229 case OBJ_TYPE_REF:
3230 dump_generic_node (buffer, op0, 0, flags, false);
3231 break;
3233 default:
3234 NIY;
3238 /* Parses the string STR and replaces new-lines by '\n', tabs by '\t', ... */
3240 static void
3241 pretty_print_string (pretty_printer *buffer, const char *str)
3243 if (str == NULL)
3244 return;
3246 while (*str)
3248 switch (str[0])
3250 case '\b':
3251 pp_string (buffer, "\\b");
3252 break;
3254 case '\f':
3255 pp_string (buffer, "\\f");
3256 break;
3258 case '\n':
3259 pp_string (buffer, "\\n");
3260 break;
3262 case '\r':
3263 pp_string (buffer, "\\r");
3264 break;
3266 case '\t':
3267 pp_string (buffer, "\\t");
3268 break;
3270 case '\v':
3271 pp_string (buffer, "\\v");
3272 break;
3274 case '\\':
3275 pp_string (buffer, "\\\\");
3276 break;
3278 case '\"':
3279 pp_string (buffer, "\\\"");
3280 break;
3282 case '\'':
3283 pp_string (buffer, "\\'");
3284 break;
3286 /* No need to handle \0; the loop terminates on \0. */
3288 case '\1':
3289 pp_string (buffer, "\\1");
3290 break;
3292 case '\2':
3293 pp_string (buffer, "\\2");
3294 break;
3296 case '\3':
3297 pp_string (buffer, "\\3");
3298 break;
3300 case '\4':
3301 pp_string (buffer, "\\4");
3302 break;
3304 case '\5':
3305 pp_string (buffer, "\\5");
3306 break;
3308 case '\6':
3309 pp_string (buffer, "\\6");
3310 break;
3312 case '\7':
3313 pp_string (buffer, "\\7");
3314 break;
3316 default:
3317 pp_character (buffer, str[0]);
3318 break;
3320 str++;
3324 static void
3325 maybe_init_pretty_print (FILE *file)
3327 if (!initialized)
3329 new (&buffer) pretty_printer ();
3330 pp_needs_newline (&buffer) = true;
3331 pp_translate_identifiers (&buffer) = false;
3332 initialized = 1;
3335 buffer.buffer->stream = file;
3338 static void
3339 newline_and_indent (pretty_printer *buffer, int spc)
3341 pp_newline (buffer);
3342 INDENT (spc);
3345 /* Handle a %K format for TEXT. Separate from default_tree_printer so
3346 it can also be used in front ends.
3347 %K: a statement, from which EXPR_LOCATION and TREE_BLOCK will be recorded.
3350 void
3351 percent_K_format (text_info *text)
3353 tree t = va_arg (*text->args_ptr, tree), block;
3354 gcc_assert (text->locus != NULL);
3355 *text->locus = EXPR_LOCATION (t);
3356 gcc_assert (pp_ti_abstract_origin (text) != NULL);
3357 block = TREE_BLOCK (t);
3358 *pp_ti_abstract_origin (text) = NULL;
3359 while (block
3360 && TREE_CODE (block) == BLOCK
3361 && BLOCK_ABSTRACT_ORIGIN (block))
3363 tree ao = BLOCK_ABSTRACT_ORIGIN (block);
3365 while (TREE_CODE (ao) == BLOCK
3366 && BLOCK_ABSTRACT_ORIGIN (ao)
3367 && BLOCK_ABSTRACT_ORIGIN (ao) != ao)
3368 ao = BLOCK_ABSTRACT_ORIGIN (ao);
3370 if (TREE_CODE (ao) == FUNCTION_DECL)
3372 *pp_ti_abstract_origin (text) = block;
3373 break;
3375 block = BLOCK_SUPERCONTEXT (block);
3379 /* Print the identifier ID to PRETTY-PRINTER. */
3381 void
3382 pp_tree_identifier (pretty_printer *pp, tree id)
3384 if (pp_translate_identifiers (pp))
3386 const char *text = identifier_to_locale (IDENTIFIER_POINTER (id));
3387 pp_append_text (pp, text, text + strlen (text));
3389 else
3390 pp_append_text (pp, IDENTIFIER_POINTER (id),
3391 IDENTIFIER_POINTER (id) + IDENTIFIER_LENGTH (id));
3394 /* A helper function that is used to dump function information before the
3395 function dump. */
3397 void
3398 dump_function_header (FILE *dump_file, tree fdecl, int flags)
3400 const char *dname, *aname;
3401 struct cgraph_node *node = cgraph_get_node (fdecl);
3402 struct function *fun = DECL_STRUCT_FUNCTION (fdecl);
3404 dname = lang_hooks.decl_printable_name (fdecl, 2);
3406 if (DECL_ASSEMBLER_NAME_SET_P (fdecl))
3407 aname = (IDENTIFIER_POINTER
3408 (DECL_ASSEMBLER_NAME (fdecl)));
3409 else
3410 aname = "<unset-asm-name>";
3412 fprintf (dump_file, "\n;; Function %s (%s, funcdef_no=%d",
3413 dname, aname, fun->funcdef_no);
3414 if (!(flags & TDF_NOUID))
3415 fprintf (dump_file, ", decl_uid=%d", DECL_UID (fdecl));
3416 if (node)
3418 fprintf (dump_file, ", symbol_order=%d)%s\n\n", node->order,
3419 node->frequency == NODE_FREQUENCY_HOT
3420 ? " (hot)"
3421 : node->frequency == NODE_FREQUENCY_UNLIKELY_EXECUTED
3422 ? " (unlikely executed)"
3423 : node->frequency == NODE_FREQUENCY_EXECUTED_ONCE
3424 ? " (executed once)"
3425 : "");
3427 else
3428 fprintf (dump_file, ")\n\n");
3431 /* Dump double_int D to pretty_printer PP. UNS is true
3432 if D is unsigned and false otherwise. */
3433 void
3434 pp_double_int (pretty_printer *pp, double_int d, bool uns)
3436 if (d.fits_shwi ())
3437 pp_wide_integer (pp, d.low);
3438 else if (d.fits_uhwi ())
3439 pp_unsigned_wide_integer (pp, d.low);
3440 else
3442 unsigned HOST_WIDE_INT low = d.low;
3443 HOST_WIDE_INT high = d.high;
3444 if (!uns && d.is_negative ())
3446 pp_minus (pp);
3447 high = ~high + !low;
3448 low = -low;
3450 /* Would "%x%0*x" or "%x%*0x" get zero-padding on all
3451 systems? */
3452 sprintf (pp_buffer (pp)->digit_buffer,
3453 HOST_WIDE_INT_PRINT_DOUBLE_HEX,
3454 (unsigned HOST_WIDE_INT) high, low);
3455 pp_string (pp, pp_buffer (pp)->digit_buffer);