1 /* Pretty formatting of GENERIC trees in C syntax.
2 Copyright (C) 2001-2013 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
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
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/>. */
23 #include "coretypes.h"
26 #include "tree-pretty-print.h"
29 #include "langhooks.h"
30 #include "tree-iterator.h"
31 #include "tree-chrec.h"
33 #include "value-prof.h"
36 #include <new> // For placement-new.
38 /* Local functions, macros and variables. */
39 static const char *op_symbol (const_tree
);
40 static void pretty_print_string (pretty_printer
*, const char*);
41 static void newline_and_indent (pretty_printer
*, int);
42 static void maybe_init_pretty_print (FILE *);
43 static void print_struct_decl (pretty_printer
*, const_tree
, int, int);
44 static void do_niy (pretty_printer
*, const_tree
);
46 #define INDENT(SPACE) do { \
47 int i; for (i = 0; i<SPACE; i++) pp_space (buffer); } while (0)
49 #define NIY do_niy (buffer, node)
51 static pretty_printer buffer
;
52 static int initialized
= 0;
54 /* Try to print something for an unknown tree code. */
57 do_niy (pretty_printer
*buffer
, const_tree node
)
61 pp_string (buffer
, "<<< Unknown tree: ");
62 pp_string (buffer
, get_tree_code_name (TREE_CODE (node
)));
66 len
= TREE_OPERAND_LENGTH (node
);
67 for (i
= 0; i
< len
; ++i
)
69 newline_and_indent (buffer
, 2);
70 dump_generic_node (buffer
, TREE_OPERAND (node
, i
), 2, 0, false);
74 pp_string (buffer
, " >>>");
77 /* Debugging function to print out a generic expression. */
80 debug_generic_expr (tree t
)
82 print_generic_expr (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
);
83 fprintf (stderr
, "\n");
86 /* Debugging function to print out a generic statement. */
89 debug_generic_stmt (tree t
)
91 print_generic_stmt (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
);
92 fprintf (stderr
, "\n");
95 /* Debugging function to print out a chain of trees . */
98 debug_tree_chain (tree t
)
100 struct pointer_set_t
*seen
= pointer_set_create ();
104 print_generic_expr (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
|TDF_UID
);
105 fprintf (stderr
, " ");
107 if (pointer_set_insert (seen
, t
))
109 fprintf (stderr
, "... [cycled back to ");
110 print_generic_expr (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
|TDF_UID
);
111 fprintf (stderr
, "]");
115 fprintf (stderr
, "\n");
117 pointer_set_destroy (seen
);
120 /* Prints declaration DECL to the FILE with details specified by FLAGS. */
122 print_generic_decl (FILE *file
, tree decl
, int flags
)
124 maybe_init_pretty_print (file
);
125 print_declaration (&buffer
, decl
, 2, flags
);
126 pp_write_text_to_stream (&buffer
);
129 /* Print tree T, and its successors, on file FILE. FLAGS specifies details
130 to show in the dump. See TDF_* in dumpfile.h. */
133 print_generic_stmt (FILE *file
, tree t
, int flags
)
135 maybe_init_pretty_print (file
);
136 dump_generic_node (&buffer
, t
, 0, flags
, true);
137 pp_newline_and_flush (&buffer
);
140 /* Print tree T, and its successors, on file FILE. FLAGS specifies details
141 to show in the dump. See TDF_* in dumpfile.h. The output is indented by
145 print_generic_stmt_indented (FILE *file
, tree t
, int flags
, int indent
)
149 maybe_init_pretty_print (file
);
151 for (i
= 0; i
< indent
; i
++)
153 dump_generic_node (&buffer
, t
, indent
, flags
, true);
154 pp_newline_and_flush (&buffer
);
157 /* Print a single expression T on file FILE. FLAGS specifies details to show
158 in the dump. See TDF_* in dumpfile.h. */
161 print_generic_expr (FILE *file
, tree t
, int flags
)
163 maybe_init_pretty_print (file
);
164 dump_generic_node (&buffer
, t
, 0, flags
, false);
168 /* Dump the name of a _DECL node and its DECL_UID if TDF_UID is set
172 dump_decl_name (pretty_printer
*buffer
, tree node
, int flags
)
174 if (DECL_NAME (node
))
176 if ((flags
& TDF_ASMNAME
) && DECL_ASSEMBLER_NAME_SET_P (node
))
177 pp_tree_identifier (buffer
, DECL_ASSEMBLER_NAME (node
));
179 pp_tree_identifier (buffer
, DECL_NAME (node
));
181 if ((flags
& TDF_UID
) || DECL_NAME (node
) == NULL_TREE
)
183 if (TREE_CODE (node
) == LABEL_DECL
&& LABEL_DECL_UID (node
) != -1)
184 pp_printf (buffer
, "L.%d", (int) LABEL_DECL_UID (node
));
185 else if (TREE_CODE (node
) == DEBUG_EXPR_DECL
)
187 if (flags
& TDF_NOUID
)
188 pp_string (buffer
, "D#xxxx");
190 pp_printf (buffer
, "D#%i", DEBUG_TEMP_UID (node
));
194 char c
= TREE_CODE (node
) == CONST_DECL
? 'C' : 'D';
195 if (flags
& TDF_NOUID
)
196 pp_printf (buffer
, "%c.xxxx", c
);
198 pp_printf (buffer
, "%c.%u", c
, DECL_UID (node
));
201 if ((flags
& TDF_ALIAS
) && DECL_PT_UID (node
) != DECL_UID (node
))
203 if (flags
& TDF_NOUID
)
204 pp_printf (buffer
, "ptD.xxxx");
206 pp_printf (buffer
, "ptD.%u", DECL_PT_UID (node
));
210 /* Like the above, but used for pretty printing function calls. */
213 dump_function_name (pretty_printer
*buffer
, tree node
, int flags
)
215 if (TREE_CODE (node
) == NOP_EXPR
)
216 node
= TREE_OPERAND (node
, 0);
217 if (DECL_NAME (node
) && (flags
& TDF_ASMNAME
) == 0)
218 pp_string (buffer
, lang_hooks
.decl_printable_name (node
, 1));
220 dump_decl_name (buffer
, node
, flags
);
223 /* Dump a function declaration. NODE is the FUNCTION_TYPE. BUFFER, SPC and
224 FLAGS are as in dump_generic_node. */
227 dump_function_declaration (pretty_printer
*buffer
, tree node
,
230 bool wrote_arg
= false;
234 pp_left_paren (buffer
);
236 /* Print the argument types. */
237 arg
= TYPE_ARG_TYPES (node
);
238 while (arg
&& arg
!= void_list_node
&& arg
!= error_mark_node
)
246 dump_generic_node (buffer
, TREE_VALUE (arg
), spc
, flags
, false);
247 arg
= TREE_CHAIN (arg
);
250 /* Drop the trailing void_type_node if we had any previous argument. */
251 if (arg
== void_list_node
&& !wrote_arg
)
252 pp_string (buffer
, "void");
253 /* Properly dump vararg function types. */
254 else if (!arg
&& wrote_arg
)
255 pp_string (buffer
, ", ...");
256 /* Avoid printing any arg for unprototyped functions. */
258 pp_right_paren (buffer
);
261 /* Dump the domain associated with an array. */
264 dump_array_domain (pretty_printer
*buffer
, tree domain
, int spc
, int flags
)
266 pp_left_bracket (buffer
);
269 tree min
= TYPE_MIN_VALUE (domain
);
270 tree max
= TYPE_MAX_VALUE (domain
);
273 && integer_zerop (min
)
274 && host_integerp (max
, 0))
275 pp_wide_integer (buffer
, TREE_INT_CST_LOW (max
) + 1);
279 dump_generic_node (buffer
, min
, spc
, flags
, false);
282 dump_generic_node (buffer
, max
, spc
, flags
, false);
286 pp_string (buffer
, "<unknown>");
287 pp_right_bracket (buffer
);
291 /* Dump OpenMP clause CLAUSE. BUFFER, CLAUSE, SPC and FLAGS are as in
292 dump_generic_node. */
295 dump_omp_clause (pretty_printer
*buffer
, tree clause
, int spc
, int flags
)
299 switch (OMP_CLAUSE_CODE (clause
))
301 case OMP_CLAUSE_PRIVATE
:
304 case OMP_CLAUSE_SHARED
:
307 case OMP_CLAUSE_FIRSTPRIVATE
:
308 name
= "firstprivate";
310 case OMP_CLAUSE_LASTPRIVATE
:
311 name
= "lastprivate";
313 case OMP_CLAUSE_COPYIN
:
316 case OMP_CLAUSE_COPYPRIVATE
:
317 name
= "copyprivate";
319 case OMP_CLAUSE_UNIFORM
:
322 case OMP_CLAUSE__LOOPTEMP_
:
326 pp_string (buffer
, name
);
327 pp_left_paren (buffer
);
328 dump_generic_node (buffer
, OMP_CLAUSE_DECL (clause
),
330 pp_right_paren (buffer
);
333 case OMP_CLAUSE_REDUCTION
:
334 pp_string (buffer
, "reduction(");
335 if (OMP_CLAUSE_REDUCTION_CODE (clause
) != ERROR_MARK
)
338 op_symbol_code (OMP_CLAUSE_REDUCTION_CODE (clause
)));
341 dump_generic_node (buffer
, OMP_CLAUSE_DECL (clause
),
343 pp_right_paren (buffer
);
347 pp_string (buffer
, "if(");
348 dump_generic_node (buffer
, OMP_CLAUSE_IF_EXPR (clause
),
350 pp_right_paren (buffer
);
353 case OMP_CLAUSE_NUM_THREADS
:
354 pp_string (buffer
, "num_threads(");
355 dump_generic_node (buffer
, OMP_CLAUSE_NUM_THREADS_EXPR (clause
),
357 pp_right_paren (buffer
);
360 case OMP_CLAUSE_NOWAIT
:
361 pp_string (buffer
, "nowait");
363 case OMP_CLAUSE_ORDERED
:
364 pp_string (buffer
, "ordered");
367 case OMP_CLAUSE_DEFAULT
:
368 pp_string (buffer
, "default(");
369 switch (OMP_CLAUSE_DEFAULT_KIND (clause
))
371 case OMP_CLAUSE_DEFAULT_UNSPECIFIED
:
373 case OMP_CLAUSE_DEFAULT_SHARED
:
374 pp_string (buffer
, "shared");
376 case OMP_CLAUSE_DEFAULT_NONE
:
377 pp_string (buffer
, "none");
379 case OMP_CLAUSE_DEFAULT_PRIVATE
:
380 pp_string (buffer
, "private");
382 case OMP_CLAUSE_DEFAULT_FIRSTPRIVATE
:
383 pp_string (buffer
, "firstprivate");
388 pp_right_paren (buffer
);
391 case OMP_CLAUSE_SCHEDULE
:
392 pp_string (buffer
, "schedule(");
393 switch (OMP_CLAUSE_SCHEDULE_KIND (clause
))
395 case OMP_CLAUSE_SCHEDULE_STATIC
:
396 pp_string (buffer
, "static");
398 case OMP_CLAUSE_SCHEDULE_DYNAMIC
:
399 pp_string (buffer
, "dynamic");
401 case OMP_CLAUSE_SCHEDULE_GUIDED
:
402 pp_string (buffer
, "guided");
404 case OMP_CLAUSE_SCHEDULE_RUNTIME
:
405 pp_string (buffer
, "runtime");
407 case OMP_CLAUSE_SCHEDULE_AUTO
:
408 pp_string (buffer
, "auto");
413 if (OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (clause
))
416 dump_generic_node (buffer
, OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (clause
),
419 pp_right_paren (buffer
);
422 case OMP_CLAUSE_UNTIED
:
423 pp_string (buffer
, "untied");
426 case OMP_CLAUSE_COLLAPSE
:
427 pp_string (buffer
, "collapse(");
428 dump_generic_node (buffer
, OMP_CLAUSE_COLLAPSE_EXPR (clause
),
430 pp_right_paren (buffer
);
433 case OMP_CLAUSE_FINAL
:
434 pp_string (buffer
, "final(");
435 dump_generic_node (buffer
, OMP_CLAUSE_FINAL_EXPR (clause
),
437 pp_right_paren (buffer
);
440 case OMP_CLAUSE_MERGEABLE
:
441 pp_string (buffer
, "mergeable");
444 case OMP_CLAUSE_LINEAR
:
445 pp_string (buffer
, "linear(");
446 dump_generic_node (buffer
, OMP_CLAUSE_DECL (clause
),
449 dump_generic_node (buffer
, OMP_CLAUSE_LINEAR_STEP (clause
),
451 pp_right_paren (buffer
);
454 case OMP_CLAUSE_ALIGNED
:
455 pp_string (buffer
, "aligned(");
456 dump_generic_node (buffer
, OMP_CLAUSE_DECL (clause
),
458 if (OMP_CLAUSE_ALIGNED_ALIGNMENT (clause
))
461 dump_generic_node (buffer
, OMP_CLAUSE_ALIGNED_ALIGNMENT (clause
),
464 pp_right_paren (buffer
);
467 case OMP_CLAUSE_DEPEND
:
468 pp_string (buffer
, "depend(");
469 switch (OMP_CLAUSE_DEPEND_KIND (clause
))
471 case OMP_CLAUSE_DEPEND_IN
:
472 pp_string (buffer
, "in");
474 case OMP_CLAUSE_DEPEND_OUT
:
475 pp_string (buffer
, "out");
477 case OMP_CLAUSE_DEPEND_INOUT
:
478 pp_string (buffer
, "inout");
484 dump_generic_node (buffer
, OMP_CLAUSE_DECL (clause
),
486 pp_right_paren (buffer
);
490 pp_string (buffer
, "map(");
491 switch (OMP_CLAUSE_MAP_KIND (clause
))
493 case OMP_CLAUSE_MAP_ALLOC
:
494 case OMP_CLAUSE_MAP_POINTER
:
495 pp_string (buffer
, "alloc");
497 case OMP_CLAUSE_MAP_TO
:
498 pp_string (buffer
, "to");
500 case OMP_CLAUSE_MAP_FROM
:
501 pp_string (buffer
, "from");
503 case OMP_CLAUSE_MAP_TOFROM
:
504 pp_string (buffer
, "tofrom");
510 dump_generic_node (buffer
, OMP_CLAUSE_DECL (clause
),
513 if (OMP_CLAUSE_SIZE (clause
))
515 if (OMP_CLAUSE_CODE (clause
) == OMP_CLAUSE_MAP
516 && OMP_CLAUSE_MAP_KIND (clause
) == OMP_CLAUSE_MAP_POINTER
)
517 pp_string (buffer
, " [pointer assign, bias: ");
519 pp_string (buffer
, " [len: ");
520 dump_generic_node (buffer
, OMP_CLAUSE_SIZE (clause
),
522 pp_right_bracket (buffer
);
524 pp_right_paren (buffer
);
527 case OMP_CLAUSE_FROM
:
528 pp_string (buffer
, "from(");
529 dump_generic_node (buffer
, OMP_CLAUSE_DECL (clause
),
531 goto print_clause_size
;
534 pp_string (buffer
, "to(");
535 dump_generic_node (buffer
, OMP_CLAUSE_DECL (clause
),
537 goto print_clause_size
;
539 case OMP_CLAUSE_NUM_TEAMS
:
540 pp_string (buffer
, "num_teams(");
541 dump_generic_node (buffer
, OMP_CLAUSE_NUM_TEAMS_EXPR (clause
),
543 pp_right_paren (buffer
);
546 case OMP_CLAUSE_THREAD_LIMIT
:
547 pp_string (buffer
, "thread_limit(");
548 dump_generic_node (buffer
, OMP_CLAUSE_THREAD_LIMIT_EXPR (clause
),
550 pp_right_paren (buffer
);
553 case OMP_CLAUSE_DEVICE
:
554 pp_string (buffer
, "device(");
555 dump_generic_node (buffer
, OMP_CLAUSE_DEVICE_ID (clause
),
557 pp_right_paren (buffer
);
560 case OMP_CLAUSE_DIST_SCHEDULE
:
561 pp_string (buffer
, "dist_schedule(static");
562 if (OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR (clause
))
565 dump_generic_node (buffer
,
566 OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR (clause
),
569 pp_right_paren (buffer
);
572 case OMP_CLAUSE_PROC_BIND
:
573 pp_string (buffer
, "proc_bind(");
574 switch (OMP_CLAUSE_PROC_BIND_KIND (clause
))
576 case OMP_CLAUSE_PROC_BIND_MASTER
:
577 pp_string (buffer
, "master");
579 case OMP_CLAUSE_PROC_BIND_CLOSE
:
580 pp_string (buffer
, "close");
582 case OMP_CLAUSE_PROC_BIND_SPREAD
:
583 pp_string (buffer
, "spread");
588 pp_right_paren (buffer
);
591 case OMP_CLAUSE_SAFELEN
:
592 pp_string (buffer
, "safelen(");
593 dump_generic_node (buffer
, OMP_CLAUSE_SAFELEN_EXPR (clause
),
595 pp_right_paren (buffer
);
598 case OMP_CLAUSE_SIMDLEN
:
599 pp_string (buffer
, "simdlen(");
600 dump_generic_node (buffer
, OMP_CLAUSE_SIMDLEN_EXPR (clause
),
602 pp_right_paren (buffer
);
605 case OMP_CLAUSE__SIMDUID_
:
606 pp_string (buffer
, "_simduid_(");
607 dump_generic_node (buffer
, OMP_CLAUSE__SIMDUID__DECL (clause
),
609 pp_right_paren (buffer
);
612 case OMP_CLAUSE_INBRANCH
:
613 pp_string (buffer
, "inbranch");
615 case OMP_CLAUSE_NOTINBRANCH
:
616 pp_string (buffer
, "notinbranch");
619 pp_string (buffer
, "for");
621 case OMP_CLAUSE_PARALLEL
:
622 pp_string (buffer
, "parallel");
624 case OMP_CLAUSE_SECTIONS
:
625 pp_string (buffer
, "sections");
627 case OMP_CLAUSE_TASKGROUP
:
628 pp_string (buffer
, "taskgroup");
632 /* Should never happen. */
633 dump_generic_node (buffer
, clause
, spc
, flags
, false);
639 /* Dump the list of OpenMP clauses. BUFFER, SPC and FLAGS are as in
640 dump_generic_node. */
643 dump_omp_clauses (pretty_printer
*buffer
, tree clause
, int spc
, int flags
)
651 dump_omp_clause (buffer
, clause
, spc
, flags
);
652 clause
= OMP_CLAUSE_CHAIN (clause
);
660 /* Dump location LOC to BUFFER. */
663 dump_location (pretty_printer
*buffer
, location_t loc
)
665 expanded_location xloc
= expand_location (loc
);
667 pp_left_bracket (buffer
);
670 pp_string (buffer
, xloc
.file
);
671 pp_string (buffer
, " : ");
673 pp_decimal_int (buffer
, xloc
.line
);
674 pp_string (buffer
, "] ");
678 /* Dump lexical block BLOCK. BUFFER, SPC and FLAGS are as in
679 dump_generic_node. */
682 dump_block_node (pretty_printer
*buffer
, tree block
, int spc
, int flags
)
686 pp_printf (buffer
, "BLOCK #%d ", BLOCK_NUMBER (block
));
688 if (flags
& TDF_ADDRESS
)
689 pp_printf (buffer
, "[%p] ", (void *) block
);
691 if (BLOCK_ABSTRACT (block
))
692 pp_string (buffer
, "[abstract] ");
694 if (TREE_ASM_WRITTEN (block
))
695 pp_string (buffer
, "[written] ");
697 if (flags
& TDF_SLIM
)
700 if (BLOCK_SOURCE_LOCATION (block
))
701 dump_location (buffer
, BLOCK_SOURCE_LOCATION (block
));
703 newline_and_indent (buffer
, spc
+ 2);
705 if (BLOCK_SUPERCONTEXT (block
))
707 pp_string (buffer
, "SUPERCONTEXT: ");
708 dump_generic_node (buffer
, BLOCK_SUPERCONTEXT (block
), 0,
709 flags
| TDF_SLIM
, false);
710 newline_and_indent (buffer
, spc
+ 2);
713 if (BLOCK_SUBBLOCKS (block
))
715 pp_string (buffer
, "SUBBLOCKS: ");
716 for (t
= BLOCK_SUBBLOCKS (block
); t
; t
= BLOCK_CHAIN (t
))
718 dump_generic_node (buffer
, t
, 0, flags
| TDF_SLIM
, false);
721 newline_and_indent (buffer
, spc
+ 2);
724 if (BLOCK_CHAIN (block
))
726 pp_string (buffer
, "SIBLINGS: ");
727 for (t
= BLOCK_CHAIN (block
); t
; t
= BLOCK_CHAIN (t
))
729 dump_generic_node (buffer
, t
, 0, flags
| TDF_SLIM
, false);
732 newline_and_indent (buffer
, spc
+ 2);
735 if (BLOCK_VARS (block
))
737 pp_string (buffer
, "VARS: ");
738 for (t
= BLOCK_VARS (block
); t
; t
= TREE_CHAIN (t
))
740 dump_generic_node (buffer
, t
, 0, flags
, false);
743 newline_and_indent (buffer
, spc
+ 2);
746 if (vec_safe_length (BLOCK_NONLOCALIZED_VARS (block
)) > 0)
749 vec
<tree
, va_gc
> *nlv
= BLOCK_NONLOCALIZED_VARS (block
);
751 pp_string (buffer
, "NONLOCALIZED_VARS: ");
752 FOR_EACH_VEC_ELT (*nlv
, i
, t
)
754 dump_generic_node (buffer
, t
, 0, flags
, false);
757 newline_and_indent (buffer
, spc
+ 2);
760 if (BLOCK_ABSTRACT_ORIGIN (block
))
762 pp_string (buffer
, "ABSTRACT_ORIGIN: ");
763 dump_generic_node (buffer
, BLOCK_ABSTRACT_ORIGIN (block
), 0,
764 flags
| TDF_SLIM
, false);
765 newline_and_indent (buffer
, spc
+ 2);
768 if (BLOCK_FRAGMENT_ORIGIN (block
))
770 pp_string (buffer
, "FRAGMENT_ORIGIN: ");
771 dump_generic_node (buffer
, BLOCK_FRAGMENT_ORIGIN (block
), 0,
772 flags
| TDF_SLIM
, false);
773 newline_and_indent (buffer
, spc
+ 2);
776 if (BLOCK_FRAGMENT_CHAIN (block
))
778 pp_string (buffer
, "FRAGMENT_CHAIN: ");
779 for (t
= BLOCK_FRAGMENT_CHAIN (block
); t
; t
= BLOCK_FRAGMENT_CHAIN (t
))
781 dump_generic_node (buffer
, t
, 0, flags
| TDF_SLIM
, false);
784 newline_and_indent (buffer
, spc
+ 2);
789 /* Dump the node NODE on the pretty_printer BUFFER, SPC spaces of
790 indent. FLAGS specifies details to show in the dump (see TDF_* in
791 dumpfile.h). If IS_STMT is true, the object printed is considered
792 to be a statement and it is terminated by ';' if appropriate. */
795 dump_generic_node (pretty_printer
*buffer
, tree node
, int spc
, int flags
,
804 if (node
== NULL_TREE
)
807 is_expr
= EXPR_P (node
);
809 if (is_stmt
&& (flags
& TDF_STMTADDR
))
810 pp_printf (buffer
, "<&%p> ", (void *)node
);
812 if ((flags
& TDF_LINENO
) && EXPR_HAS_LOCATION (node
))
813 dump_location (buffer
, EXPR_LOCATION (node
));
815 code
= TREE_CODE (node
);
819 pp_string (buffer
, "<<< error >>>");
822 case IDENTIFIER_NODE
:
823 pp_tree_identifier (buffer
, node
);
827 while (node
&& node
!= error_mark_node
)
829 if (TREE_PURPOSE (node
))
831 dump_generic_node (buffer
, TREE_PURPOSE (node
), spc
, flags
, false);
834 dump_generic_node (buffer
, TREE_VALUE (node
), spc
, flags
, false);
835 node
= TREE_CHAIN (node
);
836 if (node
&& TREE_CODE (node
) == TREE_LIST
)
845 dump_generic_node (buffer
, BINFO_TYPE (node
), spc
, flags
, false);
851 if (TREE_VEC_LENGTH (node
) > 0)
853 size_t len
= TREE_VEC_LENGTH (node
);
854 for (i
= 0; i
< len
- 1; i
++)
856 dump_generic_node (buffer
, TREE_VEC_ELT (node
, i
), spc
, flags
,
861 dump_generic_node (buffer
, TREE_VEC_ELT (node
, len
- 1), spc
,
870 case FIXED_POINT_TYPE
:
876 unsigned int quals
= TYPE_QUALS (node
);
877 enum tree_code_class tclass
;
879 if (quals
& TYPE_QUAL_CONST
)
880 pp_string (buffer
, "const ");
881 else if (quals
& TYPE_QUAL_VOLATILE
)
882 pp_string (buffer
, "volatile ");
883 else if (quals
& TYPE_QUAL_RESTRICT
)
884 pp_string (buffer
, "restrict ");
886 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
888 pp_string (buffer
, "<address-space-");
889 pp_decimal_int (buffer
, TYPE_ADDR_SPACE (node
));
890 pp_string (buffer
, "> ");
893 tclass
= TREE_CODE_CLASS (TREE_CODE (node
));
895 if (tclass
== tcc_declaration
)
897 if (DECL_NAME (node
))
898 dump_decl_name (buffer
, node
, flags
);
900 pp_string (buffer
, "<unnamed type decl>");
902 else if (tclass
== tcc_type
)
904 if (TYPE_NAME (node
))
906 if (TREE_CODE (TYPE_NAME (node
)) == IDENTIFIER_NODE
)
907 pp_tree_identifier (buffer
, TYPE_NAME (node
));
908 else if (TREE_CODE (TYPE_NAME (node
)) == TYPE_DECL
909 && DECL_NAME (TYPE_NAME (node
)))
910 dump_decl_name (buffer
, TYPE_NAME (node
), flags
);
912 pp_string (buffer
, "<unnamed type>");
914 else if (TREE_CODE (node
) == VECTOR_TYPE
)
916 pp_string (buffer
, "vector");
917 pp_left_paren (buffer
);
918 pp_wide_integer (buffer
, TYPE_VECTOR_SUBPARTS (node
));
919 pp_string (buffer
, ") ");
920 dump_generic_node (buffer
, TREE_TYPE (node
), spc
, flags
, false);
922 else if (TREE_CODE (node
) == INTEGER_TYPE
)
924 if (TYPE_PRECISION (node
) == CHAR_TYPE_SIZE
)
925 pp_string (buffer
, (TYPE_UNSIGNED (node
)
928 else if (TYPE_PRECISION (node
) == SHORT_TYPE_SIZE
)
929 pp_string (buffer
, (TYPE_UNSIGNED (node
)
932 else if (TYPE_PRECISION (node
) == INT_TYPE_SIZE
)
933 pp_string (buffer
, (TYPE_UNSIGNED (node
)
936 else if (TYPE_PRECISION (node
) == LONG_TYPE_SIZE
)
937 pp_string (buffer
, (TYPE_UNSIGNED (node
)
940 else if (TYPE_PRECISION (node
) == LONG_LONG_TYPE_SIZE
)
941 pp_string (buffer
, (TYPE_UNSIGNED (node
)
942 ? "unsigned long long"
943 : "signed long long"));
944 else if (TYPE_PRECISION (node
) >= CHAR_TYPE_SIZE
945 && exact_log2 (TYPE_PRECISION (node
)) != -1)
947 pp_string (buffer
, (TYPE_UNSIGNED (node
) ? "uint" : "int"));
948 pp_decimal_int (buffer
, TYPE_PRECISION (node
));
949 pp_string (buffer
, "_t");
953 pp_string (buffer
, (TYPE_UNSIGNED (node
)
954 ? "<unnamed-unsigned:"
955 : "<unnamed-signed:"));
956 pp_decimal_int (buffer
, TYPE_PRECISION (node
));
960 else if (TREE_CODE (node
) == COMPLEX_TYPE
)
962 pp_string (buffer
, "__complex__ ");
963 dump_generic_node (buffer
, TREE_TYPE (node
), spc
, flags
, false);
965 else if (TREE_CODE (node
) == REAL_TYPE
)
967 pp_string (buffer
, "<float:");
968 pp_decimal_int (buffer
, TYPE_PRECISION (node
));
971 else if (TREE_CODE (node
) == FIXED_POINT_TYPE
)
973 pp_string (buffer
, "<fixed-point-");
974 pp_string (buffer
, TYPE_SATURATING (node
) ? "sat:" : "nonsat:");
975 pp_decimal_int (buffer
, TYPE_PRECISION (node
));
978 else if (TREE_CODE (node
) == VOID_TYPE
)
979 pp_string (buffer
, "void");
981 pp_string (buffer
, "<unnamed type>");
988 str
= (TREE_CODE (node
) == POINTER_TYPE
? "*" : "&");
990 if (TREE_TYPE (node
) == NULL
)
992 pp_string (buffer
, str
);
993 pp_string (buffer
, "<null type>");
995 else if (TREE_CODE (TREE_TYPE (node
)) == FUNCTION_TYPE
)
997 tree fnode
= TREE_TYPE (node
);
999 dump_generic_node (buffer
, TREE_TYPE (fnode
), spc
, flags
, false);
1001 pp_left_paren (buffer
);
1002 pp_string (buffer
, str
);
1003 if (TYPE_NAME (node
) && DECL_NAME (TYPE_NAME (node
)))
1004 dump_decl_name (buffer
, TYPE_NAME (node
), flags
);
1005 else if (flags
& TDF_NOUID
)
1006 pp_printf (buffer
, "<Txxxx>");
1008 pp_printf (buffer
, "<T%x>", TYPE_UID (node
));
1010 pp_right_paren (buffer
);
1011 dump_function_declaration (buffer
, fnode
, spc
, flags
);
1015 unsigned int quals
= TYPE_QUALS (node
);
1017 dump_generic_node (buffer
, TREE_TYPE (node
), spc
, flags
, false);
1019 pp_string (buffer
, str
);
1021 if (quals
& TYPE_QUAL_CONST
)
1022 pp_string (buffer
, " const");
1023 if (quals
& TYPE_QUAL_VOLATILE
)
1024 pp_string (buffer
, " volatile");
1025 if (quals
& TYPE_QUAL_RESTRICT
)
1026 pp_string (buffer
, " restrict");
1028 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
1030 pp_string (buffer
, " <address-space-");
1031 pp_decimal_int (buffer
, TYPE_ADDR_SPACE (node
));
1032 pp_greater (buffer
);
1035 if (TYPE_REF_CAN_ALIAS_ALL (node
))
1036 pp_string (buffer
, " {ref-all}");
1046 if (integer_zerop (TREE_OPERAND (node
, 1))
1047 /* Dump the types of INTEGER_CSTs explicitly, for we can't
1048 infer them and MEM_ATTR caching will share MEM_REFs
1049 with differently-typed op0s. */
1050 && TREE_CODE (TREE_OPERAND (node
, 0)) != INTEGER_CST
1051 /* Released SSA_NAMES have no TREE_TYPE. */
1052 && TREE_TYPE (TREE_OPERAND (node
, 0)) != NULL_TREE
1053 /* Same pointer types, but ignoring POINTER_TYPE vs.
1055 && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 0)))
1056 == TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 1))))
1057 && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (node
, 0)))
1058 == TYPE_MODE (TREE_TYPE (TREE_OPERAND (node
, 1))))
1059 && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node
, 0)))
1060 == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node
, 1))))
1061 /* Same value types ignoring qualifiers. */
1062 && (TYPE_MAIN_VARIANT (TREE_TYPE (node
))
1063 == TYPE_MAIN_VARIANT
1064 (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 1))))))
1066 if (TREE_CODE (TREE_OPERAND (node
, 0)) != ADDR_EXPR
)
1069 dump_generic_node (buffer
, TREE_OPERAND (node
, 0),
1073 dump_generic_node (buffer
,
1074 TREE_OPERAND (TREE_OPERAND (node
, 0), 0),
1081 pp_string (buffer
, "MEM[");
1082 pp_left_paren (buffer
);
1083 ptype
= TYPE_MAIN_VARIANT (TREE_TYPE (TREE_OPERAND (node
, 1)));
1084 dump_generic_node (buffer
, ptype
,
1085 spc
, flags
| TDF_SLIM
, false);
1086 pp_right_paren (buffer
);
1087 dump_generic_node (buffer
, TREE_OPERAND (node
, 0),
1089 if (!integer_zerop (TREE_OPERAND (node
, 1)))
1091 pp_string (buffer
, " + ");
1092 dump_generic_node (buffer
, TREE_OPERAND (node
, 1),
1095 pp_right_bracket (buffer
);
1100 case TARGET_MEM_REF
:
1102 const char *sep
= "";
1105 pp_string (buffer
, "MEM[");
1107 if (TREE_CODE (TMR_BASE (node
)) == ADDR_EXPR
)
1109 pp_string (buffer
, sep
);
1111 pp_string (buffer
, "symbol: ");
1112 dump_generic_node (buffer
, TREE_OPERAND (TMR_BASE (node
), 0),
1117 pp_string (buffer
, sep
);
1119 pp_string (buffer
, "base: ");
1120 dump_generic_node (buffer
, TMR_BASE (node
), spc
, flags
, false);
1122 tmp
= TMR_INDEX2 (node
);
1125 pp_string (buffer
, sep
);
1127 pp_string (buffer
, "base: ");
1128 dump_generic_node (buffer
, tmp
, spc
, flags
, false);
1130 tmp
= TMR_INDEX (node
);
1133 pp_string (buffer
, sep
);
1135 pp_string (buffer
, "index: ");
1136 dump_generic_node (buffer
, tmp
, spc
, flags
, false);
1138 tmp
= TMR_STEP (node
);
1141 pp_string (buffer
, sep
);
1143 pp_string (buffer
, "step: ");
1144 dump_generic_node (buffer
, tmp
, spc
, flags
, false);
1146 tmp
= TMR_OFFSET (node
);
1149 pp_string (buffer
, sep
);
1151 pp_string (buffer
, "offset: ");
1152 dump_generic_node (buffer
, tmp
, spc
, flags
, false);
1154 pp_right_bracket (buffer
);
1162 /* Print the innermost component type. */
1163 for (tmp
= TREE_TYPE (node
); TREE_CODE (tmp
) == ARRAY_TYPE
;
1164 tmp
= TREE_TYPE (tmp
))
1166 dump_generic_node (buffer
, tmp
, spc
, flags
, false);
1168 /* Print the dimensions. */
1169 for (tmp
= node
; TREE_CODE (tmp
) == ARRAY_TYPE
; tmp
= TREE_TYPE (tmp
))
1170 dump_array_domain (buffer
, TYPE_DOMAIN (tmp
), spc
, flags
);
1176 case QUAL_UNION_TYPE
:
1178 unsigned int quals
= TYPE_QUALS (node
);
1180 if (quals
& TYPE_QUAL_CONST
)
1181 pp_string (buffer
, "const ");
1182 if (quals
& TYPE_QUAL_VOLATILE
)
1183 pp_string (buffer
, "volatile ");
1185 /* Print the name of the structure. */
1186 if (TREE_CODE (node
) == RECORD_TYPE
)
1187 pp_string (buffer
, "struct ");
1188 else if (TREE_CODE (node
) == UNION_TYPE
)
1189 pp_string (buffer
, "union ");
1191 if (TYPE_NAME (node
))
1192 dump_generic_node (buffer
, TYPE_NAME (node
), spc
, flags
, false);
1193 else if (!(flags
& TDF_SLIM
))
1194 /* FIXME: If we eliminate the 'else' above and attempt
1195 to show the fields for named types, we may get stuck
1196 following a cycle of pointers to structs. The alleged
1197 self-reference check in print_struct_decl will not detect
1198 cycles involving more than one pointer or struct type. */
1199 print_struct_decl (buffer
, node
, spc
, flags
);
1208 if (TREE_CODE (TREE_TYPE (node
)) == POINTER_TYPE
)
1210 /* In the case of a pointer, one may want to divide by the
1211 size of the pointed-to type. Unfortunately, this not
1212 straightforward. The C front-end maps expressions
1217 in such a way that the two INTEGER_CST nodes for "5" have
1218 different values but identical types. In the latter
1219 case, the 5 is multiplied by sizeof (int) in c-common.c
1220 (pointer_int_sum) to convert it to a byte address, and
1221 yet the type of the node is left unchanged. Argh. What
1222 is consistent though is that the number value corresponds
1223 to bytes (UNITS) offset.
1225 NB: Neither of the following divisors can be trivially
1226 used to recover the original literal:
1228 TREE_INT_CST_LOW (TYPE_SIZE_UNIT (TREE_TYPE (node)))
1229 TYPE_PRECISION (TREE_TYPE (TREE_TYPE (node))) */
1230 pp_wide_integer (buffer
, TREE_INT_CST_LOW (node
));
1231 pp_string (buffer
, "B"); /* pseudo-unit */
1234 pp_double_int (buffer
, tree_to_double_int (node
),
1235 TYPE_UNSIGNED (TREE_TYPE (node
)));
1236 if (TREE_OVERFLOW (node
))
1237 pp_string (buffer
, "(OVF)");
1241 /* Code copied from print_node. */
1244 if (TREE_OVERFLOW (node
))
1245 pp_string (buffer
, " overflow");
1247 #if !defined(REAL_IS_NOT_DOUBLE) || defined(REAL_ARITHMETIC)
1248 d
= TREE_REAL_CST (node
);
1249 if (REAL_VALUE_ISINF (d
))
1250 pp_string (buffer
, REAL_VALUE_NEGATIVE (d
) ? " -Inf" : " Inf");
1251 else if (REAL_VALUE_ISNAN (d
))
1252 pp_string (buffer
, " Nan");
1256 real_to_decimal (string
, &d
, sizeof (string
), 0, 1);
1257 pp_string (buffer
, string
);
1262 unsigned char *p
= (unsigned char *) &TREE_REAL_CST (node
);
1263 pp_string (buffer
, "0x");
1264 for (i
= 0; i
< sizeof TREE_REAL_CST (node
); i
++)
1265 output_formatted_integer (buffer
, "%02x", *p
++);
1274 fixed_to_decimal (string
, TREE_FIXED_CST_PTR (node
), sizeof (string
));
1275 pp_string (buffer
, string
);
1280 pp_string (buffer
, "__complex__ (");
1281 dump_generic_node (buffer
, TREE_REALPART (node
), spc
, flags
, false);
1282 pp_string (buffer
, ", ");
1283 dump_generic_node (buffer
, TREE_IMAGPART (node
), spc
, flags
, false);
1284 pp_right_paren (buffer
);
1288 pp_string (buffer
, "\"");
1289 pretty_print_string (buffer
, TREE_STRING_POINTER (node
));
1290 pp_string (buffer
, "\"");
1296 pp_string (buffer
, "{ ");
1297 for (i
= 0; i
< VECTOR_CST_NELTS (node
); ++i
)
1300 pp_string (buffer
, ", ");
1301 dump_generic_node (buffer
, VECTOR_CST_ELT (node
, i
),
1304 pp_string (buffer
, " }");
1310 dump_generic_node (buffer
, TREE_TYPE (node
), spc
, flags
, false);
1312 if (TREE_CODE (node
) == METHOD_TYPE
)
1314 if (TYPE_METHOD_BASETYPE (node
))
1315 dump_decl_name (buffer
, TYPE_NAME (TYPE_METHOD_BASETYPE (node
)),
1318 pp_string (buffer
, "<null method basetype>");
1319 pp_colon_colon (buffer
);
1321 if (TYPE_NAME (node
) && DECL_NAME (TYPE_NAME (node
)))
1322 dump_decl_name (buffer
, TYPE_NAME (node
), flags
);
1323 else if (flags
& TDF_NOUID
)
1324 pp_printf (buffer
, "<Txxxx>");
1326 pp_printf (buffer
, "<T%x>", TYPE_UID (node
));
1327 dump_function_declaration (buffer
, node
, spc
, flags
);
1332 dump_decl_name (buffer
, node
, flags
);
1336 if (DECL_NAME (node
))
1337 dump_decl_name (buffer
, node
, flags
);
1338 else if (LABEL_DECL_UID (node
) != -1)
1339 pp_printf (buffer
, "<L%d>", (int) LABEL_DECL_UID (node
));
1342 if (flags
& TDF_NOUID
)
1343 pp_string (buffer
, "<D.xxxx>");
1345 pp_printf (buffer
, "<D.%u>", DECL_UID (node
));
1350 if (DECL_IS_BUILTIN (node
))
1352 /* Don't print the declaration of built-in types. */
1355 if (DECL_NAME (node
))
1356 dump_decl_name (buffer
, node
, flags
);
1357 else if (TYPE_NAME (TREE_TYPE (node
)) != node
)
1359 if ((TREE_CODE (TREE_TYPE (node
)) == RECORD_TYPE
1360 || TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
)
1361 && TYPE_METHODS (TREE_TYPE (node
)))
1363 /* The type is a c++ class: all structures have at least
1365 pp_string (buffer
, "class ");
1366 dump_generic_node (buffer
, TREE_TYPE (node
), spc
, flags
, false);
1371 (TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
1372 ? "union" : "struct "));
1373 dump_generic_node (buffer
, TREE_TYPE (node
), spc
, flags
, false);
1377 pp_string (buffer
, "<anon>");
1383 case DEBUG_EXPR_DECL
:
1384 case NAMESPACE_DECL
:
1385 dump_decl_name (buffer
, node
, flags
);
1389 pp_string (buffer
, "<retval>");
1393 op0
= TREE_OPERAND (node
, 0);
1396 && (TREE_CODE (op0
) == INDIRECT_REF
1397 || (TREE_CODE (op0
) == MEM_REF
1398 && TREE_CODE (TREE_OPERAND (op0
, 0)) != ADDR_EXPR
1399 && integer_zerop (TREE_OPERAND (op0
, 1))
1400 /* Dump the types of INTEGER_CSTs explicitly, for we
1401 can't infer them and MEM_ATTR caching will share
1402 MEM_REFs with differently-typed op0s. */
1403 && TREE_CODE (TREE_OPERAND (op0
, 0)) != INTEGER_CST
1404 /* Released SSA_NAMES have no TREE_TYPE. */
1405 && TREE_TYPE (TREE_OPERAND (op0
, 0)) != NULL_TREE
1406 /* Same pointer types, but ignoring POINTER_TYPE vs.
1408 && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 0)))
1409 == TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 1))))
1410 && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0
, 0)))
1411 == TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0
, 1))))
1412 && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0
, 0)))
1413 == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0
, 1))))
1414 /* Same value types ignoring qualifiers. */
1415 && (TYPE_MAIN_VARIANT (TREE_TYPE (op0
))
1416 == TYPE_MAIN_VARIANT
1417 (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 1))))))))
1419 op0
= TREE_OPERAND (op0
, 0);
1422 if (op_prio (op0
) < op_prio (node
))
1423 pp_left_paren (buffer
);
1424 dump_generic_node (buffer
, op0
, spc
, flags
, false);
1425 if (op_prio (op0
) < op_prio (node
))
1426 pp_right_paren (buffer
);
1427 pp_string (buffer
, str
);
1428 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1429 op0
= component_ref_field_offset (node
);
1430 if (op0
&& TREE_CODE (op0
) != INTEGER_CST
)
1432 pp_string (buffer
, "{off: ");
1433 dump_generic_node (buffer
, op0
, spc
, flags
, false);
1434 pp_right_brace (buffer
);
1439 pp_string (buffer
, "BIT_FIELD_REF <");
1440 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1441 pp_string (buffer
, ", ");
1442 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1443 pp_string (buffer
, ", ");
1444 dump_generic_node (buffer
, TREE_OPERAND (node
, 2), spc
, flags
, false);
1445 pp_greater (buffer
);
1449 case ARRAY_RANGE_REF
:
1450 op0
= TREE_OPERAND (node
, 0);
1451 if (op_prio (op0
) < op_prio (node
))
1452 pp_left_paren (buffer
);
1453 dump_generic_node (buffer
, op0
, spc
, flags
, false);
1454 if (op_prio (op0
) < op_prio (node
))
1455 pp_right_paren (buffer
);
1456 pp_left_bracket (buffer
);
1457 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1458 if (TREE_CODE (node
) == ARRAY_RANGE_REF
)
1459 pp_string (buffer
, " ...");
1460 pp_right_bracket (buffer
);
1462 op0
= array_ref_low_bound (node
);
1463 op1
= array_ref_element_size (node
);
1465 if (!integer_zerop (op0
)
1466 || TREE_OPERAND (node
, 2)
1467 || TREE_OPERAND (node
, 3))
1469 pp_string (buffer
, "{lb: ");
1470 dump_generic_node (buffer
, op0
, spc
, flags
, false);
1471 pp_string (buffer
, " sz: ");
1472 dump_generic_node (buffer
, op1
, spc
, flags
, false);
1473 pp_right_brace (buffer
);
1479 unsigned HOST_WIDE_INT ix
;
1481 bool is_struct_init
= false;
1482 bool is_array_init
= false;
1483 double_int curidx
= double_int_zero
;
1484 pp_left_brace (buffer
);
1485 if (TREE_CLOBBER_P (node
))
1486 pp_string (buffer
, "CLOBBER");
1487 else if (TREE_CODE (TREE_TYPE (node
)) == RECORD_TYPE
1488 || TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
)
1489 is_struct_init
= true;
1490 else if (TREE_CODE (TREE_TYPE (node
)) == ARRAY_TYPE
1491 && TYPE_DOMAIN (TREE_TYPE (node
))
1492 && TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
)))
1493 && TREE_CODE (TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
))))
1496 tree minv
= TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
)));
1497 is_array_init
= true;
1498 curidx
= tree_to_double_int (minv
);
1500 FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (node
), ix
, field
, val
)
1507 dump_generic_node (buffer
, field
, spc
, flags
, false);
1510 else if (is_array_init
1511 && (TREE_CODE (field
) != INTEGER_CST
1512 || tree_to_double_int (field
) != curidx
))
1514 pp_left_bracket (buffer
);
1515 if (TREE_CODE (field
) == RANGE_EXPR
)
1517 dump_generic_node (buffer
, TREE_OPERAND (field
, 0), spc
,
1519 pp_string (buffer
, " ... ");
1520 dump_generic_node (buffer
, TREE_OPERAND (field
, 1), spc
,
1522 if (TREE_CODE (TREE_OPERAND (field
, 1)) == INTEGER_CST
)
1523 curidx
= tree_to_double_int (TREE_OPERAND (field
, 1));
1526 dump_generic_node (buffer
, field
, spc
, flags
, false);
1527 if (TREE_CODE (field
) == INTEGER_CST
)
1528 curidx
= tree_to_double_int (field
);
1529 pp_string (buffer
, "]=");
1533 curidx
+= double_int_one
;
1534 if (val
&& TREE_CODE (val
) == ADDR_EXPR
)
1535 if (TREE_CODE (TREE_OPERAND (val
, 0)) == FUNCTION_DECL
)
1536 val
= TREE_OPERAND (val
, 0);
1537 if (val
&& TREE_CODE (val
) == FUNCTION_DECL
)
1538 dump_decl_name (buffer
, val
, flags
);
1540 dump_generic_node (buffer
, val
, spc
, flags
, false);
1541 if (ix
!= vec_safe_length (CONSTRUCTOR_ELTS (node
)) - 1)
1547 pp_right_brace (buffer
);
1554 if (flags
& TDF_SLIM
)
1556 pp_string (buffer
, "<COMPOUND_EXPR>");
1560 dump_generic_node (buffer
, TREE_OPERAND (node
, 0),
1561 spc
, flags
, !(flags
& TDF_SLIM
));
1562 if (flags
& TDF_SLIM
)
1563 newline_and_indent (buffer
, spc
);
1570 for (tp
= &TREE_OPERAND (node
, 1);
1571 TREE_CODE (*tp
) == COMPOUND_EXPR
;
1572 tp
= &TREE_OPERAND (*tp
, 1))
1574 dump_generic_node (buffer
, TREE_OPERAND (*tp
, 0),
1575 spc
, flags
, !(flags
& TDF_SLIM
));
1576 if (flags
& TDF_SLIM
)
1577 newline_and_indent (buffer
, spc
);
1585 dump_generic_node (buffer
, *tp
, spc
, flags
, !(flags
& TDF_SLIM
));
1589 case STATEMENT_LIST
:
1591 tree_stmt_iterator si
;
1594 if (flags
& TDF_SLIM
)
1596 pp_string (buffer
, "<STATEMENT_LIST>");
1600 for (si
= tsi_start (node
); !tsi_end_p (si
); tsi_next (&si
))
1603 newline_and_indent (buffer
, spc
);
1606 dump_generic_node (buffer
, tsi_stmt (si
), spc
, flags
, true);
1613 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
,
1618 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
,
1623 pp_string (buffer
, "TARGET_EXPR <");
1624 dump_generic_node (buffer
, TARGET_EXPR_SLOT (node
), spc
, flags
, false);
1627 dump_generic_node (buffer
, TARGET_EXPR_INITIAL (node
), spc
, flags
, false);
1628 pp_greater (buffer
);
1632 print_declaration (buffer
, DECL_EXPR_DECL (node
), spc
, flags
);
1637 if (TREE_TYPE (node
) == NULL
|| TREE_TYPE (node
) == void_type_node
)
1639 pp_string (buffer
, "if (");
1640 dump_generic_node (buffer
, COND_EXPR_COND (node
), spc
, flags
, false);
1641 pp_right_paren (buffer
);
1642 /* The lowered cond_exprs should always be printed in full. */
1643 if (COND_EXPR_THEN (node
)
1644 && (IS_EMPTY_STMT (COND_EXPR_THEN (node
))
1645 || TREE_CODE (COND_EXPR_THEN (node
)) == GOTO_EXPR
)
1646 && COND_EXPR_ELSE (node
)
1647 && (IS_EMPTY_STMT (COND_EXPR_ELSE (node
))
1648 || TREE_CODE (COND_EXPR_ELSE (node
)) == GOTO_EXPR
))
1651 dump_generic_node (buffer
, COND_EXPR_THEN (node
),
1653 if (!IS_EMPTY_STMT (COND_EXPR_ELSE (node
)))
1655 pp_string (buffer
, " else ");
1656 dump_generic_node (buffer
, COND_EXPR_ELSE (node
),
1660 else if (!(flags
& TDF_SLIM
))
1662 /* Output COND_EXPR_THEN. */
1663 if (COND_EXPR_THEN (node
))
1665 newline_and_indent (buffer
, spc
+2);
1666 pp_left_brace (buffer
);
1667 newline_and_indent (buffer
, spc
+4);
1668 dump_generic_node (buffer
, COND_EXPR_THEN (node
), spc
+4,
1670 newline_and_indent (buffer
, spc
+2);
1671 pp_right_brace (buffer
);
1674 /* Output COND_EXPR_ELSE. */
1675 if (COND_EXPR_ELSE (node
)
1676 && !IS_EMPTY_STMT (COND_EXPR_ELSE (node
)))
1678 newline_and_indent (buffer
, spc
);
1679 pp_string (buffer
, "else");
1680 newline_and_indent (buffer
, spc
+2);
1681 pp_left_brace (buffer
);
1682 newline_and_indent (buffer
, spc
+4);
1683 dump_generic_node (buffer
, COND_EXPR_ELSE (node
), spc
+4,
1685 newline_and_indent (buffer
, spc
+2);
1686 pp_right_brace (buffer
);
1693 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1695 pp_question (buffer
);
1697 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1701 dump_generic_node (buffer
, TREE_OPERAND (node
, 2), spc
, flags
, false);
1706 pp_left_brace (buffer
);
1707 if (!(flags
& TDF_SLIM
))
1709 if (BIND_EXPR_VARS (node
))
1711 pp_newline (buffer
);
1713 for (op0
= BIND_EXPR_VARS (node
); op0
; op0
= DECL_CHAIN (op0
))
1715 print_declaration (buffer
, op0
, spc
+2, flags
);
1716 pp_newline (buffer
);
1720 newline_and_indent (buffer
, spc
+2);
1721 dump_generic_node (buffer
, BIND_EXPR_BODY (node
), spc
+2, flags
, true);
1722 newline_and_indent (buffer
, spc
);
1723 pp_right_brace (buffer
);
1729 print_call_name (buffer
, CALL_EXPR_FN (node
), flags
);
1731 /* Print parameters. */
1733 pp_left_paren (buffer
);
1736 call_expr_arg_iterator iter
;
1737 FOR_EACH_CALL_EXPR_ARG (arg
, iter
, node
)
1739 dump_generic_node (buffer
, arg
, spc
, flags
, false);
1740 if (more_call_expr_args_p (&iter
))
1747 if (CALL_EXPR_VA_ARG_PACK (node
))
1749 if (call_expr_nargs (node
) > 0)
1754 pp_string (buffer
, "__builtin_va_arg_pack ()");
1756 pp_right_paren (buffer
);
1758 op1
= CALL_EXPR_STATIC_CHAIN (node
);
1761 pp_string (buffer
, " [static-chain: ");
1762 dump_generic_node (buffer
, op1
, spc
, flags
, false);
1763 pp_right_bracket (buffer
);
1766 if (CALL_EXPR_RETURN_SLOT_OPT (node
))
1767 pp_string (buffer
, " [return slot optimization]");
1768 if (CALL_EXPR_TAILCALL (node
))
1769 pp_string (buffer
, " [tail call]");
1772 case WITH_CLEANUP_EXPR
:
1776 case CLEANUP_POINT_EXPR
:
1777 pp_string (buffer
, "<<cleanup_point ");
1778 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1779 pp_string (buffer
, ">>");
1782 case PLACEHOLDER_EXPR
:
1783 pp_string (buffer
, "<PLACEHOLDER_EXPR ");
1784 dump_generic_node (buffer
, TREE_TYPE (node
), spc
, flags
, false);
1785 pp_greater (buffer
);
1788 /* Binary arithmetic and logic expressions. */
1789 case WIDEN_SUM_EXPR
:
1790 case WIDEN_MULT_EXPR
:
1792 case MULT_HIGHPART_EXPR
:
1794 case POINTER_PLUS_EXPR
:
1796 case TRUNC_DIV_EXPR
:
1798 case FLOOR_DIV_EXPR
:
1799 case ROUND_DIV_EXPR
:
1800 case TRUNC_MOD_EXPR
:
1802 case FLOOR_MOD_EXPR
:
1803 case ROUND_MOD_EXPR
:
1805 case EXACT_DIV_EXPR
:
1810 case VEC_LSHIFT_EXPR
:
1811 case VEC_RSHIFT_EXPR
:
1812 case WIDEN_LSHIFT_EXPR
:
1816 case TRUTH_ANDIF_EXPR
:
1817 case TRUTH_ORIF_EXPR
:
1818 case TRUTH_AND_EXPR
:
1820 case TRUTH_XOR_EXPR
:
1834 case UNORDERED_EXPR
:
1836 const char *op
= op_symbol (node
);
1837 op0
= TREE_OPERAND (node
, 0);
1838 op1
= TREE_OPERAND (node
, 1);
1840 /* When the operands are expressions with less priority,
1841 keep semantics of the tree representation. */
1842 if (op_prio (op0
) <= op_prio (node
))
1844 pp_left_paren (buffer
);
1845 dump_generic_node (buffer
, op0
, spc
, flags
, false);
1846 pp_right_paren (buffer
);
1849 dump_generic_node (buffer
, op0
, spc
, flags
, false);
1852 pp_string (buffer
, op
);
1855 /* When the operands are expressions with less priority,
1856 keep semantics of the tree representation. */
1857 if (op_prio (op1
) <= op_prio (node
))
1859 pp_left_paren (buffer
);
1860 dump_generic_node (buffer
, op1
, spc
, flags
, false);
1861 pp_right_paren (buffer
);
1864 dump_generic_node (buffer
, op1
, spc
, flags
, false);
1868 /* Unary arithmetic and logic expressions. */
1871 case TRUTH_NOT_EXPR
:
1873 case PREDECREMENT_EXPR
:
1874 case PREINCREMENT_EXPR
:
1876 if (TREE_CODE (node
) == ADDR_EXPR
1877 && (TREE_CODE (TREE_OPERAND (node
, 0)) == STRING_CST
1878 || TREE_CODE (TREE_OPERAND (node
, 0)) == FUNCTION_DECL
))
1879 ; /* Do not output '&' for strings and function pointers. */
1881 pp_string (buffer
, op_symbol (node
));
1883 if (op_prio (TREE_OPERAND (node
, 0)) < op_prio (node
))
1885 pp_left_paren (buffer
);
1886 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1887 pp_right_paren (buffer
);
1890 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1893 case POSTDECREMENT_EXPR
:
1894 case POSTINCREMENT_EXPR
:
1895 if (op_prio (TREE_OPERAND (node
, 0)) < op_prio (node
))
1897 pp_left_paren (buffer
);
1898 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1899 pp_right_paren (buffer
);
1902 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1903 pp_string (buffer
, op_symbol (node
));
1907 pp_string (buffer
, "MIN_EXPR <");
1908 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1909 pp_string (buffer
, ", ");
1910 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1911 pp_greater (buffer
);
1915 pp_string (buffer
, "MAX_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
);
1923 pp_string (buffer
, "ABS_EXPR <");
1924 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1925 pp_greater (buffer
);
1932 case ADDR_SPACE_CONVERT_EXPR
:
1933 case FIXED_CONVERT_EXPR
:
1934 case FIX_TRUNC_EXPR
:
1937 type
= TREE_TYPE (node
);
1938 op0
= TREE_OPERAND (node
, 0);
1939 if (type
!= TREE_TYPE (op0
))
1941 pp_left_paren (buffer
);
1942 dump_generic_node (buffer
, type
, spc
, flags
, false);
1943 pp_string (buffer
, ") ");
1945 if (op_prio (op0
) < op_prio (node
))
1946 pp_left_paren (buffer
);
1947 dump_generic_node (buffer
, op0
, spc
, flags
, false);
1948 if (op_prio (op0
) < op_prio (node
))
1949 pp_right_paren (buffer
);
1952 case VIEW_CONVERT_EXPR
:
1953 pp_string (buffer
, "VIEW_CONVERT_EXPR<");
1954 dump_generic_node (buffer
, TREE_TYPE (node
), spc
, flags
, false);
1955 pp_string (buffer
, ">(");
1956 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1957 pp_right_paren (buffer
);
1961 pp_string (buffer
, "((");
1962 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1963 pp_string (buffer
, "))");
1966 case NON_LVALUE_EXPR
:
1967 pp_string (buffer
, "NON_LVALUE_EXPR <");
1968 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1969 pp_greater (buffer
);
1973 pp_string (buffer
, "SAVE_EXPR <");
1974 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1975 pp_greater (buffer
);
1979 pp_string (buffer
, "COMPLEX_EXPR <");
1980 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1981 pp_string (buffer
, ", ");
1982 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1983 pp_greater (buffer
);
1987 pp_string (buffer
, "CONJ_EXPR <");
1988 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1989 pp_greater (buffer
);
1993 pp_string (buffer
, "REALPART_EXPR <");
1994 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1995 pp_greater (buffer
);
1999 pp_string (buffer
, "IMAGPART_EXPR <");
2000 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2001 pp_greater (buffer
);
2005 pp_string (buffer
, "VA_ARG_EXPR <");
2006 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2007 pp_greater (buffer
);
2010 case TRY_FINALLY_EXPR
:
2011 case TRY_CATCH_EXPR
:
2012 pp_string (buffer
, "try");
2013 newline_and_indent (buffer
, spc
+2);
2014 pp_left_brace (buffer
);
2015 newline_and_indent (buffer
, spc
+4);
2016 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
+4, flags
, true);
2017 newline_and_indent (buffer
, spc
+2);
2018 pp_right_brace (buffer
);
2019 newline_and_indent (buffer
, spc
);
2021 (TREE_CODE (node
) == TRY_CATCH_EXPR
) ? "catch" : "finally");
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
, 1), spc
+4, flags
, true);
2026 newline_and_indent (buffer
, spc
+2);
2027 pp_right_brace (buffer
);
2032 pp_string (buffer
, "catch (");
2033 dump_generic_node (buffer
, CATCH_TYPES (node
), spc
+2, flags
, false);
2034 pp_right_paren (buffer
);
2035 newline_and_indent (buffer
, spc
+2);
2036 pp_left_brace (buffer
);
2037 newline_and_indent (buffer
, spc
+4);
2038 dump_generic_node (buffer
, CATCH_BODY (node
), spc
+4, flags
, true);
2039 newline_and_indent (buffer
, spc
+2);
2040 pp_right_brace (buffer
);
2044 case EH_FILTER_EXPR
:
2045 pp_string (buffer
, "<<<eh_filter (");
2046 dump_generic_node (buffer
, EH_FILTER_TYPES (node
), spc
+2, flags
, false);
2047 pp_string (buffer
, ")>>>");
2048 newline_and_indent (buffer
, spc
+2);
2049 pp_left_brace (buffer
);
2050 newline_and_indent (buffer
, spc
+4);
2051 dump_generic_node (buffer
, EH_FILTER_FAILURE (node
), spc
+4, flags
, true);
2052 newline_and_indent (buffer
, spc
+2);
2053 pp_right_brace (buffer
);
2058 op0
= TREE_OPERAND (node
, 0);
2059 /* If this is for break or continue, don't bother printing it. */
2060 if (DECL_NAME (op0
))
2062 const char *name
= IDENTIFIER_POINTER (DECL_NAME (op0
));
2063 if (strcmp (name
, "break") == 0
2064 || strcmp (name
, "continue") == 0)
2067 dump_generic_node (buffer
, op0
, spc
, flags
, false);
2069 if (DECL_NONLOCAL (op0
))
2070 pp_string (buffer
, " [non-local]");
2074 pp_string (buffer
, "while (1)");
2075 if (!(flags
& TDF_SLIM
))
2077 newline_and_indent (buffer
, spc
+2);
2078 pp_left_brace (buffer
);
2079 newline_and_indent (buffer
, spc
+4);
2080 dump_generic_node (buffer
, LOOP_EXPR_BODY (node
), spc
+4, flags
, true);
2081 newline_and_indent (buffer
, spc
+2);
2082 pp_right_brace (buffer
);
2088 pp_string (buffer
, "// predicted ");
2089 if (PREDICT_EXPR_OUTCOME (node
))
2090 pp_string (buffer
, "likely by ");
2092 pp_string (buffer
, "unlikely by ");
2093 pp_string (buffer
, predictor_name (PREDICT_EXPR_PREDICTOR (node
)));
2094 pp_string (buffer
, " predictor.");
2098 pp_string (buffer
, "return");
2099 op0
= TREE_OPERAND (node
, 0);
2103 if (TREE_CODE (op0
) == MODIFY_EXPR
)
2104 dump_generic_node (buffer
, TREE_OPERAND (op0
, 1),
2107 dump_generic_node (buffer
, op0
, spc
, flags
, false);
2112 pp_string (buffer
, "if (");
2113 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2114 pp_string (buffer
, ") break");
2118 pp_string (buffer
, "switch (");
2119 dump_generic_node (buffer
, SWITCH_COND (node
), spc
, flags
, false);
2120 pp_right_paren (buffer
);
2121 if (!(flags
& TDF_SLIM
))
2123 newline_and_indent (buffer
, spc
+2);
2124 pp_left_brace (buffer
);
2125 if (SWITCH_BODY (node
))
2127 newline_and_indent (buffer
, spc
+4);
2128 dump_generic_node (buffer
, SWITCH_BODY (node
), spc
+4, flags
,
2133 tree vec
= SWITCH_LABELS (node
);
2134 size_t i
, n
= TREE_VEC_LENGTH (vec
);
2135 for (i
= 0; i
< n
; ++i
)
2137 tree elt
= TREE_VEC_ELT (vec
, i
);
2138 newline_and_indent (buffer
, spc
+4);
2141 dump_generic_node (buffer
, elt
, spc
+4, flags
, false);
2142 pp_string (buffer
, " goto ");
2143 dump_generic_node (buffer
, CASE_LABEL (elt
), spc
+4,
2145 pp_semicolon (buffer
);
2148 pp_string (buffer
, "case ???: goto ???;");
2151 newline_and_indent (buffer
, spc
+2);
2152 pp_right_brace (buffer
);
2158 op0
= GOTO_DESTINATION (node
);
2159 if (TREE_CODE (op0
) != SSA_NAME
&& DECL_P (op0
) && DECL_NAME (op0
))
2161 const char *name
= IDENTIFIER_POINTER (DECL_NAME (op0
));
2162 if (strcmp (name
, "break") == 0
2163 || strcmp (name
, "continue") == 0)
2165 pp_string (buffer
, name
);
2169 pp_string (buffer
, "goto ");
2170 dump_generic_node (buffer
, op0
, spc
, flags
, false);
2174 pp_string (buffer
, "__asm__");
2175 if (ASM_VOLATILE_P (node
))
2176 pp_string (buffer
, " __volatile__");
2177 pp_left_paren (buffer
);
2178 dump_generic_node (buffer
, ASM_STRING (node
), spc
, flags
, false);
2180 dump_generic_node (buffer
, ASM_OUTPUTS (node
), spc
, flags
, false);
2182 dump_generic_node (buffer
, ASM_INPUTS (node
), spc
, flags
, false);
2183 if (ASM_CLOBBERS (node
))
2186 dump_generic_node (buffer
, ASM_CLOBBERS (node
), spc
, flags
, false);
2188 pp_right_paren (buffer
);
2191 case CASE_LABEL_EXPR
:
2192 if (CASE_LOW (node
) && CASE_HIGH (node
))
2194 pp_string (buffer
, "case ");
2195 dump_generic_node (buffer
, CASE_LOW (node
), spc
, flags
, false);
2196 pp_string (buffer
, " ... ");
2197 dump_generic_node (buffer
, CASE_HIGH (node
), spc
, flags
, false);
2199 else if (CASE_LOW (node
))
2201 pp_string (buffer
, "case ");
2202 dump_generic_node (buffer
, CASE_LOW (node
), spc
, flags
, false);
2205 pp_string (buffer
, "default");
2210 pp_string (buffer
, "OBJ_TYPE_REF(");
2211 dump_generic_node (buffer
, OBJ_TYPE_REF_EXPR (node
), spc
, flags
, false);
2212 pp_semicolon (buffer
);
2213 dump_generic_node (buffer
, OBJ_TYPE_REF_OBJECT (node
), spc
, flags
, false);
2215 dump_generic_node (buffer
, OBJ_TYPE_REF_TOKEN (node
), spc
, flags
, false);
2216 pp_right_paren (buffer
);
2220 if (SSA_NAME_IDENTIFIER (node
))
2221 dump_generic_node (buffer
, SSA_NAME_IDENTIFIER (node
),
2223 pp_underscore (buffer
);
2224 pp_decimal_int (buffer
, SSA_NAME_VERSION (node
));
2225 if (SSA_NAME_IS_DEFAULT_DEF (node
))
2226 pp_string (buffer
, "(D)");
2227 if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (node
))
2228 pp_string (buffer
, "(ab)");
2231 case WITH_SIZE_EXPR
:
2232 pp_string (buffer
, "WITH_SIZE_EXPR <");
2233 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2234 pp_string (buffer
, ", ");
2235 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2236 pp_greater (buffer
);
2240 pp_string (buffer
, "ASSERT_EXPR <");
2241 dump_generic_node (buffer
, ASSERT_EXPR_VAR (node
), spc
, flags
, false);
2242 pp_string (buffer
, ", ");
2243 dump_generic_node (buffer
, ASSERT_EXPR_COND (node
), spc
, flags
, false);
2244 pp_greater (buffer
);
2248 pp_string (buffer
, "scev_known");
2251 case SCEV_NOT_KNOWN
:
2252 pp_string (buffer
, "scev_not_known");
2255 case POLYNOMIAL_CHREC
:
2256 pp_left_brace (buffer
);
2257 dump_generic_node (buffer
, CHREC_LEFT (node
), spc
, flags
, false);
2258 pp_string (buffer
, ", +, ");
2259 dump_generic_node (buffer
, CHREC_RIGHT (node
), spc
, flags
, false);
2260 pp_string (buffer
, "}_");
2261 dump_generic_node (buffer
, CHREC_VAR (node
), spc
, flags
, false);
2265 case REALIGN_LOAD_EXPR
:
2266 pp_string (buffer
, "REALIGN_LOAD <");
2267 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2268 pp_string (buffer
, ", ");
2269 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2270 pp_string (buffer
, ", ");
2271 dump_generic_node (buffer
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2272 pp_greater (buffer
);
2276 pp_string (buffer
, " VEC_COND_EXPR < ");
2277 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2278 pp_string (buffer
, " , ");
2279 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2280 pp_string (buffer
, " , ");
2281 dump_generic_node (buffer
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2282 pp_string (buffer
, " > ");
2286 pp_string (buffer
, " VEC_PERM_EXPR < ");
2287 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2288 pp_string (buffer
, " , ");
2289 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2290 pp_string (buffer
, " , ");
2291 dump_generic_node (buffer
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2292 pp_string (buffer
, " > ");
2296 pp_string (buffer
, " DOT_PROD_EXPR < ");
2297 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2298 pp_string (buffer
, ", ");
2299 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2300 pp_string (buffer
, ", ");
2301 dump_generic_node (buffer
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2302 pp_string (buffer
, " > ");
2305 case WIDEN_MULT_PLUS_EXPR
:
2306 pp_string (buffer
, " WIDEN_MULT_PLUS_EXPR < ");
2307 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2308 pp_string (buffer
, ", ");
2309 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2310 pp_string (buffer
, ", ");
2311 dump_generic_node (buffer
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2312 pp_string (buffer
, " > ");
2315 case WIDEN_MULT_MINUS_EXPR
:
2316 pp_string (buffer
, " WIDEN_MULT_MINUS_EXPR < ");
2317 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2318 pp_string (buffer
, ", ");
2319 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2320 pp_string (buffer
, ", ");
2321 dump_generic_node (buffer
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2322 pp_string (buffer
, " > ");
2326 pp_string (buffer
, " FMA_EXPR < ");
2327 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2328 pp_string (buffer
, ", ");
2329 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2330 pp_string (buffer
, ", ");
2331 dump_generic_node (buffer
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2332 pp_string (buffer
, " > ");
2336 pp_string (buffer
, "#pragma omp parallel");
2337 dump_omp_clauses (buffer
, OMP_PARALLEL_CLAUSES (node
), spc
, flags
);
2340 if (!(flags
& TDF_SLIM
) && OMP_BODY (node
))
2342 newline_and_indent (buffer
, spc
+ 2);
2343 pp_left_brace (buffer
);
2344 newline_and_indent (buffer
, spc
+ 4);
2345 dump_generic_node (buffer
, OMP_BODY (node
), spc
+ 4, flags
, false);
2346 newline_and_indent (buffer
, spc
+ 2);
2347 pp_right_brace (buffer
);
2353 pp_string (buffer
, "#pragma omp task");
2354 dump_omp_clauses (buffer
, OMP_TASK_CLAUSES (node
), spc
, flags
);
2358 pp_string (buffer
, "#pragma omp for");
2362 pp_string (buffer
, "#pragma omp simd");
2365 case OMP_DISTRIBUTE
:
2366 pp_string (buffer
, "#pragma omp distribute");
2370 pp_string (buffer
, "#pragma omp teams");
2371 dump_omp_clauses (buffer
, OMP_TEAMS_CLAUSES (node
), spc
, flags
);
2374 case OMP_TARGET_DATA
:
2375 pp_string (buffer
, "#pragma omp target data");
2376 dump_omp_clauses (buffer
, OMP_TARGET_DATA_CLAUSES (node
), spc
, flags
);
2380 pp_string (buffer
, "#pragma omp target");
2381 dump_omp_clauses (buffer
, OMP_TARGET_CLAUSES (node
), spc
, flags
);
2384 case OMP_TARGET_UPDATE
:
2385 pp_string (buffer
, "#pragma omp target update");
2386 dump_omp_clauses (buffer
, OMP_TARGET_UPDATE_CLAUSES (node
), spc
, flags
);
2391 dump_omp_clauses (buffer
, OMP_FOR_CLAUSES (node
), spc
, flags
);
2393 if (!(flags
& TDF_SLIM
))
2397 if (OMP_FOR_PRE_BODY (node
))
2399 newline_and_indent (buffer
, spc
+ 2);
2400 pp_left_brace (buffer
);
2402 newline_and_indent (buffer
, spc
);
2403 dump_generic_node (buffer
, OMP_FOR_PRE_BODY (node
),
2406 if (OMP_FOR_INIT (node
))
2409 for (i
= 0; i
< TREE_VEC_LENGTH (OMP_FOR_INIT (node
)); i
++)
2412 newline_and_indent (buffer
, spc
);
2413 pp_string (buffer
, "for (");
2414 dump_generic_node (buffer
,
2415 TREE_VEC_ELT (OMP_FOR_INIT (node
), i
),
2417 pp_string (buffer
, "; ");
2418 dump_generic_node (buffer
,
2419 TREE_VEC_ELT (OMP_FOR_COND (node
), i
),
2421 pp_string (buffer
, "; ");
2422 dump_generic_node (buffer
,
2423 TREE_VEC_ELT (OMP_FOR_INCR (node
), i
),
2425 pp_right_paren (buffer
);
2428 if (OMP_FOR_BODY (node
))
2430 newline_and_indent (buffer
, spc
+ 2);
2431 pp_left_brace (buffer
);
2432 newline_and_indent (buffer
, spc
+ 4);
2433 dump_generic_node (buffer
, OMP_FOR_BODY (node
), spc
+ 4, flags
,
2435 newline_and_indent (buffer
, spc
+ 2);
2436 pp_right_brace (buffer
);
2438 if (OMP_FOR_INIT (node
))
2439 spc
-= 2 * TREE_VEC_LENGTH (OMP_FOR_INIT (node
)) - 2;
2440 if (OMP_FOR_PRE_BODY (node
))
2443 newline_and_indent (buffer
, spc
+ 2);
2444 pp_right_brace (buffer
);
2451 pp_string (buffer
, "#pragma omp sections");
2452 dump_omp_clauses (buffer
, OMP_SECTIONS_CLAUSES (node
), spc
, flags
);
2456 pp_string (buffer
, "#pragma omp section");
2460 pp_string (buffer
, "#pragma omp master");
2464 pp_string (buffer
, "#pragma omp taskgroup");
2468 pp_string (buffer
, "#pragma omp ordered");
2472 pp_string (buffer
, "#pragma omp critical");
2473 if (OMP_CRITICAL_NAME (node
))
2476 pp_left_paren (buffer
);
2477 dump_generic_node (buffer
, OMP_CRITICAL_NAME (node
), spc
,
2479 pp_right_paren (buffer
);
2484 pp_string (buffer
, "#pragma omp atomic");
2485 if (OMP_ATOMIC_SEQ_CST (node
))
2486 pp_string (buffer
, " seq_cst");
2487 newline_and_indent (buffer
, spc
+ 2);
2488 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2492 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2495 case OMP_ATOMIC_READ
:
2496 pp_string (buffer
, "#pragma omp atomic read");
2497 if (OMP_ATOMIC_SEQ_CST (node
))
2498 pp_string (buffer
, " seq_cst");
2499 newline_and_indent (buffer
, spc
+ 2);
2500 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2504 case OMP_ATOMIC_CAPTURE_OLD
:
2505 case OMP_ATOMIC_CAPTURE_NEW
:
2506 pp_string (buffer
, "#pragma omp atomic capture");
2507 if (OMP_ATOMIC_SEQ_CST (node
))
2508 pp_string (buffer
, " seq_cst");
2509 newline_and_indent (buffer
, spc
+ 2);
2510 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2514 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2518 pp_string (buffer
, "#pragma omp single");
2519 dump_omp_clauses (buffer
, OMP_SINGLE_CLAUSES (node
), spc
, flags
);
2523 dump_omp_clause (buffer
, node
, spc
, flags
);
2527 case TRANSACTION_EXPR
:
2528 if (TRANSACTION_EXPR_OUTER (node
))
2529 pp_string (buffer
, "__transaction_atomic [[outer]]");
2530 else if (TRANSACTION_EXPR_RELAXED (node
))
2531 pp_string (buffer
, "__transaction_relaxed");
2533 pp_string (buffer
, "__transaction_atomic");
2534 if (!(flags
& TDF_SLIM
) && TRANSACTION_EXPR_BODY (node
))
2536 newline_and_indent (buffer
, spc
);
2537 pp_left_brace (buffer
);
2538 newline_and_indent (buffer
, spc
+ 2);
2539 dump_generic_node (buffer
, TRANSACTION_EXPR_BODY (node
),
2540 spc
+ 2, flags
, false);
2541 newline_and_indent (buffer
, spc
);
2542 pp_right_brace (buffer
);
2547 case REDUC_MAX_EXPR
:
2548 pp_string (buffer
, " REDUC_MAX_EXPR < ");
2549 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2550 pp_string (buffer
, " > ");
2553 case REDUC_MIN_EXPR
:
2554 pp_string (buffer
, " REDUC_MIN_EXPR < ");
2555 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2556 pp_string (buffer
, " > ");
2559 case REDUC_PLUS_EXPR
:
2560 pp_string (buffer
, " REDUC_PLUS_EXPR < ");
2561 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2562 pp_string (buffer
, " > ");
2565 case VEC_WIDEN_MULT_HI_EXPR
:
2566 case VEC_WIDEN_MULT_LO_EXPR
:
2567 case VEC_WIDEN_MULT_EVEN_EXPR
:
2568 case VEC_WIDEN_MULT_ODD_EXPR
:
2569 case VEC_WIDEN_LSHIFT_HI_EXPR
:
2570 case VEC_WIDEN_LSHIFT_LO_EXPR
:
2572 for (str
= get_tree_code_name (code
); *str
; str
++)
2573 pp_character (buffer
, TOUPPER (*str
));
2574 pp_string (buffer
, " < ");
2575 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2576 pp_string (buffer
, ", ");
2577 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2578 pp_string (buffer
, " > ");
2581 case VEC_UNPACK_HI_EXPR
:
2582 pp_string (buffer
, " VEC_UNPACK_HI_EXPR < ");
2583 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2584 pp_string (buffer
, " > ");
2587 case VEC_UNPACK_LO_EXPR
:
2588 pp_string (buffer
, " VEC_UNPACK_LO_EXPR < ");
2589 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2590 pp_string (buffer
, " > ");
2593 case VEC_UNPACK_FLOAT_HI_EXPR
:
2594 pp_string (buffer
, " VEC_UNPACK_FLOAT_HI_EXPR < ");
2595 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2596 pp_string (buffer
, " > ");
2599 case VEC_UNPACK_FLOAT_LO_EXPR
:
2600 pp_string (buffer
, " VEC_UNPACK_FLOAT_LO_EXPR < ");
2601 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2602 pp_string (buffer
, " > ");
2605 case VEC_PACK_TRUNC_EXPR
:
2606 pp_string (buffer
, " VEC_PACK_TRUNC_EXPR < ");
2607 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2608 pp_string (buffer
, ", ");
2609 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2610 pp_string (buffer
, " > ");
2613 case VEC_PACK_SAT_EXPR
:
2614 pp_string (buffer
, " VEC_PACK_SAT_EXPR < ");
2615 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2616 pp_string (buffer
, ", ");
2617 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2618 pp_string (buffer
, " > ");
2621 case VEC_PACK_FIX_TRUNC_EXPR
:
2622 pp_string (buffer
, " VEC_PACK_FIX_TRUNC_EXPR < ");
2623 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2624 pp_string (buffer
, ", ");
2625 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2626 pp_string (buffer
, " > ");
2630 dump_block_node (buffer
, node
, spc
, flags
);
2637 if (is_stmt
&& is_expr
)
2638 pp_semicolon (buffer
);
2643 /* Print the declaration of a variable. */
2646 print_declaration (pretty_printer
*buffer
, tree t
, int spc
, int flags
)
2650 if (TREE_CODE (t
) == TYPE_DECL
)
2651 pp_string (buffer
, "typedef ");
2653 if (CODE_CONTAINS_STRUCT (TREE_CODE (t
), TS_DECL_WRTL
) && DECL_REGISTER (t
))
2654 pp_string (buffer
, "register ");
2656 if (TREE_PUBLIC (t
) && DECL_EXTERNAL (t
))
2657 pp_string (buffer
, "extern ");
2658 else if (TREE_STATIC (t
))
2659 pp_string (buffer
, "static ");
2661 /* Print the type and name. */
2662 if (TREE_TYPE (t
) && TREE_CODE (TREE_TYPE (t
)) == ARRAY_TYPE
)
2666 /* Print array's type. */
2667 tmp
= TREE_TYPE (t
);
2668 while (TREE_CODE (TREE_TYPE (tmp
)) == ARRAY_TYPE
)
2669 tmp
= TREE_TYPE (tmp
);
2670 dump_generic_node (buffer
, TREE_TYPE (tmp
), spc
, flags
, false);
2672 /* Print variable's name. */
2674 dump_generic_node (buffer
, t
, spc
, flags
, false);
2676 /* Print the dimensions. */
2677 tmp
= TREE_TYPE (t
);
2678 while (TREE_CODE (tmp
) == ARRAY_TYPE
)
2680 dump_array_domain (buffer
, TYPE_DOMAIN (tmp
), spc
, flags
);
2681 tmp
= TREE_TYPE (tmp
);
2684 else if (TREE_CODE (t
) == FUNCTION_DECL
)
2686 dump_generic_node (buffer
, TREE_TYPE (TREE_TYPE (t
)), spc
, flags
, false);
2688 dump_decl_name (buffer
, t
, flags
);
2689 dump_function_declaration (buffer
, TREE_TYPE (t
), spc
, flags
);
2693 /* Print type declaration. */
2694 dump_generic_node (buffer
, TREE_TYPE (t
), spc
, flags
, false);
2696 /* Print variable's name. */
2698 dump_generic_node (buffer
, t
, spc
, flags
, false);
2701 if (TREE_CODE (t
) == VAR_DECL
&& DECL_HARD_REGISTER (t
))
2703 pp_string (buffer
, " __asm__ ");
2704 pp_left_paren (buffer
);
2705 dump_generic_node (buffer
, DECL_ASSEMBLER_NAME (t
), spc
, flags
, false);
2706 pp_right_paren (buffer
);
2709 /* The initial value of a function serves to determine whether the function
2710 is declared or defined. So the following does not apply to function
2712 if (TREE_CODE (t
) != FUNCTION_DECL
)
2714 /* Print the initial value. */
2715 if (DECL_INITIAL (t
))
2720 dump_generic_node (buffer
, DECL_INITIAL (t
), spc
, flags
, false);
2724 if (TREE_CODE (t
) == VAR_DECL
&& DECL_HAS_VALUE_EXPR_P (t
))
2726 pp_string (buffer
, " [value-expr: ");
2727 dump_generic_node (buffer
, DECL_VALUE_EXPR (t
), spc
, flags
, false);
2728 pp_right_bracket (buffer
);
2731 pp_semicolon (buffer
);
2735 /* Prints a structure: name, fields, and methods.
2736 FIXME: Still incomplete. */
2739 print_struct_decl (pretty_printer
*buffer
, const_tree node
, int spc
, int flags
)
2741 /* Print the name of the structure. */
2742 if (TYPE_NAME (node
))
2745 if (TREE_CODE (node
) == RECORD_TYPE
)
2746 pp_string (buffer
, "struct ");
2747 else if ((TREE_CODE (node
) == UNION_TYPE
2748 || TREE_CODE (node
) == QUAL_UNION_TYPE
))
2749 pp_string (buffer
, "union ");
2751 dump_generic_node (buffer
, TYPE_NAME (node
), spc
, 0, false);
2754 /* Print the contents of the structure. */
2755 pp_newline (buffer
);
2757 pp_left_brace (buffer
);
2758 pp_newline (buffer
);
2760 /* Print the fields of the structure. */
2763 tmp
= TYPE_FIELDS (node
);
2766 /* Avoid to print recursively the structure. */
2767 /* FIXME : Not implemented correctly...,
2768 what about the case when we have a cycle in the contain graph? ...
2769 Maybe this could be solved by looking at the scope in which the
2770 structure was declared. */
2771 if (TREE_TYPE (tmp
) != node
2772 && (TREE_CODE (TREE_TYPE (tmp
)) != POINTER_TYPE
2773 || TREE_TYPE (TREE_TYPE (tmp
)) != node
))
2775 print_declaration (buffer
, tmp
, spc
+2, flags
);
2776 pp_newline (buffer
);
2778 tmp
= DECL_CHAIN (tmp
);
2782 pp_right_brace (buffer
);
2785 /* Return the priority of the operator CODE.
2787 From lowest to highest precedence with either left-to-right (L-R)
2788 or right-to-left (R-L) associativity]:
2791 2 [R-L] = += -= *= /= %= &= ^= |= <<= >>=
2803 14 [R-L] ! ~ ++ -- + - * & (type) sizeof
2804 15 [L-R] fn() [] -> .
2806 unary +, - and * have higher precedence than the corresponding binary
2810 op_code_prio (enum tree_code code
)
2827 case TRUTH_ORIF_EXPR
:
2830 case TRUTH_AND_EXPR
:
2831 case TRUTH_ANDIF_EXPR
:
2838 case TRUTH_XOR_EXPR
:
2855 case UNORDERED_EXPR
:
2866 case VEC_WIDEN_LSHIFT_HI_EXPR
:
2867 case VEC_WIDEN_LSHIFT_LO_EXPR
:
2868 case WIDEN_LSHIFT_EXPR
:
2871 case WIDEN_SUM_EXPR
:
2873 case POINTER_PLUS_EXPR
:
2877 case VEC_WIDEN_MULT_HI_EXPR
:
2878 case VEC_WIDEN_MULT_LO_EXPR
:
2879 case WIDEN_MULT_EXPR
:
2881 case WIDEN_MULT_PLUS_EXPR
:
2882 case WIDEN_MULT_MINUS_EXPR
:
2884 case MULT_HIGHPART_EXPR
:
2885 case TRUNC_DIV_EXPR
:
2887 case FLOOR_DIV_EXPR
:
2888 case ROUND_DIV_EXPR
:
2890 case EXACT_DIV_EXPR
:
2891 case TRUNC_MOD_EXPR
:
2893 case FLOOR_MOD_EXPR
:
2894 case ROUND_MOD_EXPR
:
2898 case TRUTH_NOT_EXPR
:
2900 case POSTINCREMENT_EXPR
:
2901 case POSTDECREMENT_EXPR
:
2902 case PREINCREMENT_EXPR
:
2903 case PREDECREMENT_EXPR
:
2909 case FIX_TRUNC_EXPR
:
2915 case ARRAY_RANGE_REF
:
2919 /* Special expressions. */
2925 case REDUC_MAX_EXPR
:
2926 case REDUC_MIN_EXPR
:
2927 case REDUC_PLUS_EXPR
:
2928 case VEC_LSHIFT_EXPR
:
2929 case VEC_RSHIFT_EXPR
:
2930 case VEC_UNPACK_HI_EXPR
:
2931 case VEC_UNPACK_LO_EXPR
:
2932 case VEC_UNPACK_FLOAT_HI_EXPR
:
2933 case VEC_UNPACK_FLOAT_LO_EXPR
:
2934 case VEC_PACK_TRUNC_EXPR
:
2935 case VEC_PACK_SAT_EXPR
:
2939 /* Return an arbitrarily high precedence to avoid surrounding single
2940 VAR_DECLs in ()s. */
2945 /* Return the priority of the operator OP. */
2948 op_prio (const_tree op
)
2950 enum tree_code code
;
2955 code
= TREE_CODE (op
);
2956 if (code
== SAVE_EXPR
|| code
== NON_LVALUE_EXPR
)
2957 return op_prio (TREE_OPERAND (op
, 0));
2959 return op_code_prio (code
);
2962 /* Return the symbol associated with operator CODE. */
2965 op_symbol_code (enum tree_code code
)
2973 case TRUTH_ORIF_EXPR
:
2976 case TRUTH_AND_EXPR
:
2977 case TRUTH_ANDIF_EXPR
:
2983 case TRUTH_XOR_EXPR
:
2993 case UNORDERED_EXPR
:
3039 case VEC_LSHIFT_EXPR
:
3042 case VEC_RSHIFT_EXPR
:
3045 case WIDEN_LSHIFT_EXPR
:
3048 case POINTER_PLUS_EXPR
:
3054 case REDUC_PLUS_EXPR
:
3057 case WIDEN_SUM_EXPR
:
3060 case WIDEN_MULT_EXPR
:
3063 case MULT_HIGHPART_EXPR
:
3073 case TRUTH_NOT_EXPR
:
3080 case TRUNC_DIV_EXPR
:
3087 case FLOOR_DIV_EXPR
:
3090 case ROUND_DIV_EXPR
:
3093 case EXACT_DIV_EXPR
:
3096 case TRUNC_MOD_EXPR
:
3102 case FLOOR_MOD_EXPR
:
3105 case ROUND_MOD_EXPR
:
3108 case PREDECREMENT_EXPR
:
3111 case PREINCREMENT_EXPR
:
3114 case POSTDECREMENT_EXPR
:
3117 case POSTINCREMENT_EXPR
:
3127 return "<<< ??? >>>";
3131 /* Return the symbol associated with operator OP. */
3134 op_symbol (const_tree op
)
3136 return op_symbol_code (TREE_CODE (op
));
3139 /* Prints the name of a call. NODE is the CALL_EXPR_FN of a CALL_EXPR or
3140 the gimple_call_fn of a GIMPLE_CALL. */
3143 print_call_name (pretty_printer
*buffer
, tree node
, int flags
)
3147 if (TREE_CODE (op0
) == NON_LVALUE_EXPR
)
3148 op0
= TREE_OPERAND (op0
, 0);
3151 switch (TREE_CODE (op0
))
3156 dump_function_name (buffer
, op0
, flags
);
3162 op0
= TREE_OPERAND (op0
, 0);
3166 pp_left_paren (buffer
);
3167 dump_generic_node (buffer
, TREE_OPERAND (op0
, 0), 0, flags
, false);
3168 pp_string (buffer
, ") ? ");
3169 dump_generic_node (buffer
, TREE_OPERAND (op0
, 1), 0, flags
, false);
3170 pp_string (buffer
, " : ");
3171 dump_generic_node (buffer
, TREE_OPERAND (op0
, 2), 0, flags
, false);
3175 if (TREE_CODE (TREE_OPERAND (op0
, 0)) == VAR_DECL
)
3176 dump_function_name (buffer
, TREE_OPERAND (op0
, 0), flags
);
3178 dump_generic_node (buffer
, op0
, 0, flags
, false);
3182 if (integer_zerop (TREE_OPERAND (op0
, 1)))
3184 op0
= TREE_OPERAND (op0
, 0);
3191 dump_generic_node (buffer
, op0
, 0, flags
, false);
3199 /* Parses the string STR and replaces new-lines by '\n', tabs by '\t', ... */
3202 pretty_print_string (pretty_printer
*buffer
, const char *str
)
3212 pp_string (buffer
, "\\b");
3216 pp_string (buffer
, "\\f");
3220 pp_string (buffer
, "\\n");
3224 pp_string (buffer
, "\\r");
3228 pp_string (buffer
, "\\t");
3232 pp_string (buffer
, "\\v");
3236 pp_string (buffer
, "\\\\");
3240 pp_string (buffer
, "\\\"");
3244 pp_string (buffer
, "\\'");
3247 /* No need to handle \0; the loop terminates on \0. */
3250 pp_string (buffer
, "\\1");
3254 pp_string (buffer
, "\\2");
3258 pp_string (buffer
, "\\3");
3262 pp_string (buffer
, "\\4");
3266 pp_string (buffer
, "\\5");
3270 pp_string (buffer
, "\\6");
3274 pp_string (buffer
, "\\7");
3278 pp_character (buffer
, str
[0]);
3286 maybe_init_pretty_print (FILE *file
)
3290 new (&buffer
) pretty_printer ();
3291 pp_needs_newline (&buffer
) = true;
3292 pp_translate_identifiers (&buffer
) = false;
3296 buffer
.buffer
->stream
= file
;
3300 newline_and_indent (pretty_printer
*buffer
, int spc
)
3302 pp_newline (buffer
);
3306 /* Handle a %K format for TEXT. Separate from default_tree_printer so
3307 it can also be used in front ends.
3308 %K: a statement, from which EXPR_LOCATION and TREE_BLOCK will be recorded.
3312 percent_K_format (text_info
*text
)
3314 tree t
= va_arg (*text
->args_ptr
, tree
), block
;
3315 gcc_assert (text
->locus
!= NULL
);
3316 *text
->locus
= EXPR_LOCATION (t
);
3317 gcc_assert (pp_ti_abstract_origin (text
) != NULL
);
3318 block
= TREE_BLOCK (t
);
3319 *pp_ti_abstract_origin (text
) = NULL
;
3321 && TREE_CODE (block
) == BLOCK
3322 && BLOCK_ABSTRACT_ORIGIN (block
))
3324 tree ao
= BLOCK_ABSTRACT_ORIGIN (block
);
3326 while (TREE_CODE (ao
) == BLOCK
3327 && BLOCK_ABSTRACT_ORIGIN (ao
)
3328 && BLOCK_ABSTRACT_ORIGIN (ao
) != ao
)
3329 ao
= BLOCK_ABSTRACT_ORIGIN (ao
);
3331 if (TREE_CODE (ao
) == FUNCTION_DECL
)
3333 *pp_ti_abstract_origin (text
) = block
;
3336 block
= BLOCK_SUPERCONTEXT (block
);
3340 /* Print the identifier ID to PRETTY-PRINTER. */
3343 pp_tree_identifier (pretty_printer
*pp
, tree id
)
3345 if (pp_translate_identifiers (pp
))
3347 const char *text
= identifier_to_locale (IDENTIFIER_POINTER (id
));
3348 pp_append_text (pp
, text
, text
+ strlen (text
));
3351 pp_append_text (pp
, IDENTIFIER_POINTER (id
),
3352 IDENTIFIER_POINTER (id
) + IDENTIFIER_LENGTH (id
));
3355 /* A helper function that is used to dump function information before the
3359 dump_function_header (FILE *dump_file
, tree fdecl
, int flags
)
3361 const char *dname
, *aname
;
3362 struct cgraph_node
*node
= cgraph_get_node (fdecl
);
3363 struct function
*fun
= DECL_STRUCT_FUNCTION (fdecl
);
3365 dname
= lang_hooks
.decl_printable_name (fdecl
, 2);
3367 if (DECL_ASSEMBLER_NAME_SET_P (fdecl
))
3368 aname
= (IDENTIFIER_POINTER
3369 (DECL_ASSEMBLER_NAME (fdecl
)));
3371 aname
= "<unset-asm-name>";
3373 fprintf (dump_file
, "\n;; Function %s (%s, funcdef_no=%d",
3374 dname
, aname
, fun
->funcdef_no
);
3375 if (!(flags
& TDF_NOUID
))
3376 fprintf (dump_file
, ", decl_uid=%d", DECL_UID (fdecl
));
3379 fprintf (dump_file
, ", symbol_order=%d)%s\n\n", node
->symbol
.order
,
3380 node
->frequency
== NODE_FREQUENCY_HOT
3382 : node
->frequency
== NODE_FREQUENCY_UNLIKELY_EXECUTED
3383 ? " (unlikely executed)"
3384 : node
->frequency
== NODE_FREQUENCY_EXECUTED_ONCE
3385 ? " (executed once)"
3389 fprintf (dump_file
, ")\n\n");
3392 /* Dump double_int D to pretty_printer PP. UNS is true
3393 if D is unsigned and false otherwise. */
3395 pp_double_int (pretty_printer
*pp
, double_int d
, bool uns
)
3398 pp_wide_integer (pp
, d
.low
);
3399 else if (d
.fits_uhwi ())
3400 pp_unsigned_wide_integer (pp
, d
.low
);
3403 unsigned HOST_WIDE_INT low
= d
.low
;
3404 HOST_WIDE_INT high
= d
.high
;
3405 if (!uns
&& d
.is_negative ())
3408 high
= ~high
+ !low
;
3411 /* Would "%x%0*x" or "%x%*0x" get zero-padding on all
3413 sprintf (pp_buffer (pp
)->digit_buffer
,
3414 HOST_WIDE_INT_PRINT_DOUBLE_HEX
,
3415 (unsigned HOST_WIDE_INT
) high
, low
);
3416 pp_string (pp
, pp_buffer (pp
)->digit_buffer
);