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"
30 #include "langhooks.h"
31 #include "tree-iterator.h"
32 #include "tree-chrec.h"
34 #include "value-prof.h"
37 #include <new> // For placement-new.
39 /* Local functions, macros and variables. */
40 static const char *op_symbol (const_tree
);
41 static void pretty_print_string (pretty_printer
*, const char*);
42 static void newline_and_indent (pretty_printer
*, int);
43 static void maybe_init_pretty_print (FILE *);
44 static void print_struct_decl (pretty_printer
*, const_tree
, int, int);
45 static void do_niy (pretty_printer
*, const_tree
);
47 #define INDENT(SPACE) do { \
48 int i; for (i = 0; i<SPACE; i++) pp_space (buffer); } while (0)
50 #define NIY do_niy (buffer, node)
52 static pretty_printer buffer
;
53 static int initialized
= 0;
55 /* Try to print something for an unknown tree code. */
58 do_niy (pretty_printer
*buffer
, const_tree node
)
62 pp_string (buffer
, "<<< Unknown tree: ");
63 pp_string (buffer
, get_tree_code_name (TREE_CODE (node
)));
67 len
= TREE_OPERAND_LENGTH (node
);
68 for (i
= 0; i
< len
; ++i
)
70 newline_and_indent (buffer
, 2);
71 dump_generic_node (buffer
, TREE_OPERAND (node
, i
), 2, 0, false);
75 pp_string (buffer
, " >>>");
78 /* Debugging function to print out a generic expression. */
81 debug_generic_expr (tree t
)
83 print_generic_expr (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
);
84 fprintf (stderr
, "\n");
87 /* Debugging function to print out a generic statement. */
90 debug_generic_stmt (tree t
)
92 print_generic_stmt (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
);
93 fprintf (stderr
, "\n");
96 /* Debugging function to print out a chain of trees . */
99 debug_tree_chain (tree t
)
101 struct pointer_set_t
*seen
= pointer_set_create ();
105 print_generic_expr (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
|TDF_UID
);
106 fprintf (stderr
, " ");
108 if (pointer_set_insert (seen
, t
))
110 fprintf (stderr
, "... [cycled back to ");
111 print_generic_expr (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
|TDF_UID
);
112 fprintf (stderr
, "]");
116 fprintf (stderr
, "\n");
118 pointer_set_destroy (seen
);
121 /* Prints declaration DECL to the FILE with details specified by FLAGS. */
123 print_generic_decl (FILE *file
, tree decl
, int flags
)
125 maybe_init_pretty_print (file
);
126 print_declaration (&buffer
, decl
, 2, flags
);
127 pp_write_text_to_stream (&buffer
);
130 /* Print tree T, and its successors, on file FILE. FLAGS specifies details
131 to show in the dump. See TDF_* in dumpfile.h. */
134 print_generic_stmt (FILE *file
, tree t
, int flags
)
136 maybe_init_pretty_print (file
);
137 dump_generic_node (&buffer
, t
, 0, flags
, true);
138 pp_newline_and_flush (&buffer
);
141 /* Print tree T, and its successors, on file FILE. FLAGS specifies details
142 to show in the dump. See TDF_* in dumpfile.h. The output is indented by
146 print_generic_stmt_indented (FILE *file
, tree t
, int flags
, int indent
)
150 maybe_init_pretty_print (file
);
152 for (i
= 0; i
< indent
; i
++)
154 dump_generic_node (&buffer
, t
, indent
, flags
, true);
155 pp_newline_and_flush (&buffer
);
158 /* Print a single expression T on file FILE. FLAGS specifies details to show
159 in the dump. See TDF_* in dumpfile.h. */
162 print_generic_expr (FILE *file
, tree t
, int flags
)
164 maybe_init_pretty_print (file
);
165 dump_generic_node (&buffer
, t
, 0, flags
, false);
169 /* Dump the name of a _DECL node and its DECL_UID if TDF_UID is set
173 dump_decl_name (pretty_printer
*buffer
, tree node
, int flags
)
175 if (DECL_NAME (node
))
177 if ((flags
& TDF_ASMNAME
) && DECL_ASSEMBLER_NAME_SET_P (node
))
178 pp_tree_identifier (buffer
, DECL_ASSEMBLER_NAME (node
));
180 pp_tree_identifier (buffer
, DECL_NAME (node
));
182 if ((flags
& TDF_UID
) || DECL_NAME (node
) == NULL_TREE
)
184 if (TREE_CODE (node
) == LABEL_DECL
&& LABEL_DECL_UID (node
) != -1)
185 pp_printf (buffer
, "L.%d", (int) LABEL_DECL_UID (node
));
186 else if (TREE_CODE (node
) == DEBUG_EXPR_DECL
)
188 if (flags
& TDF_NOUID
)
189 pp_string (buffer
, "D#xxxx");
191 pp_printf (buffer
, "D#%i", DEBUG_TEMP_UID (node
));
195 char c
= TREE_CODE (node
) == CONST_DECL
? 'C' : 'D';
196 if (flags
& TDF_NOUID
)
197 pp_printf (buffer
, "%c.xxxx", c
);
199 pp_printf (buffer
, "%c.%u", c
, DECL_UID (node
));
202 if ((flags
& TDF_ALIAS
) && DECL_PT_UID (node
) != DECL_UID (node
))
204 if (flags
& TDF_NOUID
)
205 pp_printf (buffer
, "ptD.xxxx");
207 pp_printf (buffer
, "ptD.%u", DECL_PT_UID (node
));
211 /* Like the above, but used for pretty printing function calls. */
214 dump_function_name (pretty_printer
*buffer
, tree node
, int flags
)
216 if (TREE_CODE (node
) == NOP_EXPR
)
217 node
= TREE_OPERAND (node
, 0);
218 if (DECL_NAME (node
) && (flags
& TDF_ASMNAME
) == 0)
219 pp_string (buffer
, lang_hooks
.decl_printable_name (node
, 1));
221 dump_decl_name (buffer
, node
, flags
);
224 /* Dump a function declaration. NODE is the FUNCTION_TYPE. BUFFER, SPC and
225 FLAGS are as in dump_generic_node. */
228 dump_function_declaration (pretty_printer
*buffer
, tree node
,
231 bool wrote_arg
= false;
235 pp_left_paren (buffer
);
237 /* Print the argument types. */
238 arg
= TYPE_ARG_TYPES (node
);
239 while (arg
&& arg
!= void_list_node
&& arg
!= error_mark_node
)
247 dump_generic_node (buffer
, TREE_VALUE (arg
), spc
, flags
, false);
248 arg
= TREE_CHAIN (arg
);
251 /* Drop the trailing void_type_node if we had any previous argument. */
252 if (arg
== void_list_node
&& !wrote_arg
)
253 pp_string (buffer
, "void");
254 /* Properly dump vararg function types. */
255 else if (!arg
&& wrote_arg
)
256 pp_string (buffer
, ", ...");
257 /* Avoid printing any arg for unprototyped functions. */
259 pp_right_paren (buffer
);
262 /* Dump the domain associated with an array. */
265 dump_array_domain (pretty_printer
*buffer
, tree domain
, int spc
, int flags
)
267 pp_left_bracket (buffer
);
270 tree min
= TYPE_MIN_VALUE (domain
);
271 tree max
= TYPE_MAX_VALUE (domain
);
274 && integer_zerop (min
)
275 && tree_fits_shwi_p (max
))
276 pp_wide_integer (buffer
, TREE_INT_CST_LOW (max
) + 1);
280 dump_generic_node (buffer
, min
, spc
, flags
, false);
283 dump_generic_node (buffer
, max
, spc
, flags
, false);
287 pp_string (buffer
, "<unknown>");
288 pp_right_bracket (buffer
);
292 /* Dump OpenMP clause CLAUSE. BUFFER, CLAUSE, SPC and FLAGS are as in
293 dump_generic_node. */
296 dump_omp_clause (pretty_printer
*buffer
, tree clause
, int spc
, int flags
)
300 switch (OMP_CLAUSE_CODE (clause
))
302 case OMP_CLAUSE_PRIVATE
:
305 case OMP_CLAUSE_SHARED
:
308 case OMP_CLAUSE_FIRSTPRIVATE
:
309 name
= "firstprivate";
311 case OMP_CLAUSE_LASTPRIVATE
:
312 name
= "lastprivate";
314 case OMP_CLAUSE_COPYIN
:
317 case OMP_CLAUSE_COPYPRIVATE
:
318 name
= "copyprivate";
320 case OMP_CLAUSE_UNIFORM
:
323 case OMP_CLAUSE__LOOPTEMP_
:
327 pp_string (buffer
, name
);
328 pp_left_paren (buffer
);
329 dump_generic_node (buffer
, OMP_CLAUSE_DECL (clause
),
331 pp_right_paren (buffer
);
334 case OMP_CLAUSE_REDUCTION
:
335 pp_string (buffer
, "reduction(");
336 if (OMP_CLAUSE_REDUCTION_CODE (clause
) != ERROR_MARK
)
339 op_symbol_code (OMP_CLAUSE_REDUCTION_CODE (clause
)));
342 dump_generic_node (buffer
, OMP_CLAUSE_DECL (clause
),
344 pp_right_paren (buffer
);
348 pp_string (buffer
, "if(");
349 dump_generic_node (buffer
, OMP_CLAUSE_IF_EXPR (clause
),
351 pp_right_paren (buffer
);
354 case OMP_CLAUSE_NUM_THREADS
:
355 pp_string (buffer
, "num_threads(");
356 dump_generic_node (buffer
, OMP_CLAUSE_NUM_THREADS_EXPR (clause
),
358 pp_right_paren (buffer
);
361 case OMP_CLAUSE_NOWAIT
:
362 pp_string (buffer
, "nowait");
364 case OMP_CLAUSE_ORDERED
:
365 pp_string (buffer
, "ordered");
368 case OMP_CLAUSE_DEFAULT
:
369 pp_string (buffer
, "default(");
370 switch (OMP_CLAUSE_DEFAULT_KIND (clause
))
372 case OMP_CLAUSE_DEFAULT_UNSPECIFIED
:
374 case OMP_CLAUSE_DEFAULT_SHARED
:
375 pp_string (buffer
, "shared");
377 case OMP_CLAUSE_DEFAULT_NONE
:
378 pp_string (buffer
, "none");
380 case OMP_CLAUSE_DEFAULT_PRIVATE
:
381 pp_string (buffer
, "private");
383 case OMP_CLAUSE_DEFAULT_FIRSTPRIVATE
:
384 pp_string (buffer
, "firstprivate");
389 pp_right_paren (buffer
);
392 case OMP_CLAUSE_SCHEDULE
:
393 pp_string (buffer
, "schedule(");
394 switch (OMP_CLAUSE_SCHEDULE_KIND (clause
))
396 case OMP_CLAUSE_SCHEDULE_STATIC
:
397 pp_string (buffer
, "static");
399 case OMP_CLAUSE_SCHEDULE_DYNAMIC
:
400 pp_string (buffer
, "dynamic");
402 case OMP_CLAUSE_SCHEDULE_GUIDED
:
403 pp_string (buffer
, "guided");
405 case OMP_CLAUSE_SCHEDULE_RUNTIME
:
406 pp_string (buffer
, "runtime");
408 case OMP_CLAUSE_SCHEDULE_AUTO
:
409 pp_string (buffer
, "auto");
414 if (OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (clause
))
417 dump_generic_node (buffer
, OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (clause
),
420 pp_right_paren (buffer
);
423 case OMP_CLAUSE_UNTIED
:
424 pp_string (buffer
, "untied");
427 case OMP_CLAUSE_COLLAPSE
:
428 pp_string (buffer
, "collapse(");
429 dump_generic_node (buffer
, OMP_CLAUSE_COLLAPSE_EXPR (clause
),
431 pp_right_paren (buffer
);
434 case OMP_CLAUSE_FINAL
:
435 pp_string (buffer
, "final(");
436 dump_generic_node (buffer
, OMP_CLAUSE_FINAL_EXPR (clause
),
438 pp_right_paren (buffer
);
441 case OMP_CLAUSE_MERGEABLE
:
442 pp_string (buffer
, "mergeable");
445 case OMP_CLAUSE_LINEAR
:
446 pp_string (buffer
, "linear(");
447 dump_generic_node (buffer
, OMP_CLAUSE_DECL (clause
),
450 dump_generic_node (buffer
, OMP_CLAUSE_LINEAR_STEP (clause
),
452 pp_right_paren (buffer
);
455 case OMP_CLAUSE_ALIGNED
:
456 pp_string (buffer
, "aligned(");
457 dump_generic_node (buffer
, OMP_CLAUSE_DECL (clause
),
459 if (OMP_CLAUSE_ALIGNED_ALIGNMENT (clause
))
462 dump_generic_node (buffer
, OMP_CLAUSE_ALIGNED_ALIGNMENT (clause
),
465 pp_right_paren (buffer
);
468 case OMP_CLAUSE_DEPEND
:
469 pp_string (buffer
, "depend(");
470 switch (OMP_CLAUSE_DEPEND_KIND (clause
))
472 case OMP_CLAUSE_DEPEND_IN
:
473 pp_string (buffer
, "in");
475 case OMP_CLAUSE_DEPEND_OUT
:
476 pp_string (buffer
, "out");
478 case OMP_CLAUSE_DEPEND_INOUT
:
479 pp_string (buffer
, "inout");
485 dump_generic_node (buffer
, OMP_CLAUSE_DECL (clause
),
487 pp_right_paren (buffer
);
491 pp_string (buffer
, "map(");
492 switch (OMP_CLAUSE_MAP_KIND (clause
))
494 case OMP_CLAUSE_MAP_ALLOC
:
495 case OMP_CLAUSE_MAP_POINTER
:
496 pp_string (buffer
, "alloc");
498 case OMP_CLAUSE_MAP_TO
:
499 pp_string (buffer
, "to");
501 case OMP_CLAUSE_MAP_FROM
:
502 pp_string (buffer
, "from");
504 case OMP_CLAUSE_MAP_TOFROM
:
505 pp_string (buffer
, "tofrom");
511 dump_generic_node (buffer
, OMP_CLAUSE_DECL (clause
),
514 if (OMP_CLAUSE_SIZE (clause
))
516 if (OMP_CLAUSE_CODE (clause
) == OMP_CLAUSE_MAP
517 && OMP_CLAUSE_MAP_KIND (clause
) == OMP_CLAUSE_MAP_POINTER
)
518 pp_string (buffer
, " [pointer assign, bias: ");
520 pp_string (buffer
, " [len: ");
521 dump_generic_node (buffer
, OMP_CLAUSE_SIZE (clause
),
523 pp_right_bracket (buffer
);
525 pp_right_paren (buffer
);
528 case OMP_CLAUSE_FROM
:
529 pp_string (buffer
, "from(");
530 dump_generic_node (buffer
, OMP_CLAUSE_DECL (clause
),
532 goto print_clause_size
;
535 pp_string (buffer
, "to(");
536 dump_generic_node (buffer
, OMP_CLAUSE_DECL (clause
),
538 goto print_clause_size
;
540 case OMP_CLAUSE_NUM_TEAMS
:
541 pp_string (buffer
, "num_teams(");
542 dump_generic_node (buffer
, OMP_CLAUSE_NUM_TEAMS_EXPR (clause
),
544 pp_right_paren (buffer
);
547 case OMP_CLAUSE_THREAD_LIMIT
:
548 pp_string (buffer
, "thread_limit(");
549 dump_generic_node (buffer
, OMP_CLAUSE_THREAD_LIMIT_EXPR (clause
),
551 pp_right_paren (buffer
);
554 case OMP_CLAUSE_DEVICE
:
555 pp_string (buffer
, "device(");
556 dump_generic_node (buffer
, OMP_CLAUSE_DEVICE_ID (clause
),
558 pp_right_paren (buffer
);
561 case OMP_CLAUSE_DIST_SCHEDULE
:
562 pp_string (buffer
, "dist_schedule(static");
563 if (OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR (clause
))
566 dump_generic_node (buffer
,
567 OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR (clause
),
570 pp_right_paren (buffer
);
573 case OMP_CLAUSE_PROC_BIND
:
574 pp_string (buffer
, "proc_bind(");
575 switch (OMP_CLAUSE_PROC_BIND_KIND (clause
))
577 case OMP_CLAUSE_PROC_BIND_MASTER
:
578 pp_string (buffer
, "master");
580 case OMP_CLAUSE_PROC_BIND_CLOSE
:
581 pp_string (buffer
, "close");
583 case OMP_CLAUSE_PROC_BIND_SPREAD
:
584 pp_string (buffer
, "spread");
589 pp_right_paren (buffer
);
592 case OMP_CLAUSE_SAFELEN
:
593 pp_string (buffer
, "safelen(");
594 dump_generic_node (buffer
, OMP_CLAUSE_SAFELEN_EXPR (clause
),
596 pp_right_paren (buffer
);
599 case OMP_CLAUSE_SIMDLEN
:
600 pp_string (buffer
, "simdlen(");
601 dump_generic_node (buffer
, OMP_CLAUSE_SIMDLEN_EXPR (clause
),
603 pp_right_paren (buffer
);
606 case OMP_CLAUSE__SIMDUID_
:
607 pp_string (buffer
, "_simduid_(");
608 dump_generic_node (buffer
, OMP_CLAUSE__SIMDUID__DECL (clause
),
610 pp_right_paren (buffer
);
613 case OMP_CLAUSE_INBRANCH
:
614 pp_string (buffer
, "inbranch");
616 case OMP_CLAUSE_NOTINBRANCH
:
617 pp_string (buffer
, "notinbranch");
620 pp_string (buffer
, "for");
622 case OMP_CLAUSE_PARALLEL
:
623 pp_string (buffer
, "parallel");
625 case OMP_CLAUSE_SECTIONS
:
626 pp_string (buffer
, "sections");
628 case OMP_CLAUSE_TASKGROUP
:
629 pp_string (buffer
, "taskgroup");
633 /* Should never happen. */
634 dump_generic_node (buffer
, clause
, spc
, flags
, false);
640 /* Dump the list of OpenMP clauses. BUFFER, SPC and FLAGS are as in
641 dump_generic_node. */
644 dump_omp_clauses (pretty_printer
*buffer
, tree clause
, int spc
, int flags
)
652 dump_omp_clause (buffer
, clause
, spc
, flags
);
653 clause
= OMP_CLAUSE_CHAIN (clause
);
661 /* Dump location LOC to BUFFER. */
664 dump_location (pretty_printer
*buffer
, location_t loc
)
666 expanded_location xloc
= expand_location (loc
);
668 pp_left_bracket (buffer
);
671 pp_string (buffer
, xloc
.file
);
672 pp_string (buffer
, " : ");
674 pp_decimal_int (buffer
, xloc
.line
);
675 pp_string (buffer
, "] ");
679 /* Dump lexical block BLOCK. BUFFER, SPC and FLAGS are as in
680 dump_generic_node. */
683 dump_block_node (pretty_printer
*buffer
, tree block
, int spc
, int flags
)
687 pp_printf (buffer
, "BLOCK #%d ", BLOCK_NUMBER (block
));
689 if (flags
& TDF_ADDRESS
)
690 pp_printf (buffer
, "[%p] ", (void *) block
);
692 if (BLOCK_ABSTRACT (block
))
693 pp_string (buffer
, "[abstract] ");
695 if (TREE_ASM_WRITTEN (block
))
696 pp_string (buffer
, "[written] ");
698 if (flags
& TDF_SLIM
)
701 if (BLOCK_SOURCE_LOCATION (block
))
702 dump_location (buffer
, BLOCK_SOURCE_LOCATION (block
));
704 newline_and_indent (buffer
, spc
+ 2);
706 if (BLOCK_SUPERCONTEXT (block
))
708 pp_string (buffer
, "SUPERCONTEXT: ");
709 dump_generic_node (buffer
, BLOCK_SUPERCONTEXT (block
), 0,
710 flags
| TDF_SLIM
, false);
711 newline_and_indent (buffer
, spc
+ 2);
714 if (BLOCK_SUBBLOCKS (block
))
716 pp_string (buffer
, "SUBBLOCKS: ");
717 for (t
= BLOCK_SUBBLOCKS (block
); t
; t
= BLOCK_CHAIN (t
))
719 dump_generic_node (buffer
, t
, 0, flags
| TDF_SLIM
, false);
722 newline_and_indent (buffer
, spc
+ 2);
725 if (BLOCK_CHAIN (block
))
727 pp_string (buffer
, "SIBLINGS: ");
728 for (t
= BLOCK_CHAIN (block
); t
; t
= BLOCK_CHAIN (t
))
730 dump_generic_node (buffer
, t
, 0, flags
| TDF_SLIM
, false);
733 newline_and_indent (buffer
, spc
+ 2);
736 if (BLOCK_VARS (block
))
738 pp_string (buffer
, "VARS: ");
739 for (t
= BLOCK_VARS (block
); t
; t
= TREE_CHAIN (t
))
741 dump_generic_node (buffer
, t
, 0, flags
, false);
744 newline_and_indent (buffer
, spc
+ 2);
747 if (vec_safe_length (BLOCK_NONLOCALIZED_VARS (block
)) > 0)
750 vec
<tree
, va_gc
> *nlv
= BLOCK_NONLOCALIZED_VARS (block
);
752 pp_string (buffer
, "NONLOCALIZED_VARS: ");
753 FOR_EACH_VEC_ELT (*nlv
, i
, t
)
755 dump_generic_node (buffer
, t
, 0, flags
, false);
758 newline_and_indent (buffer
, spc
+ 2);
761 if (BLOCK_ABSTRACT_ORIGIN (block
))
763 pp_string (buffer
, "ABSTRACT_ORIGIN: ");
764 dump_generic_node (buffer
, BLOCK_ABSTRACT_ORIGIN (block
), 0,
765 flags
| TDF_SLIM
, false);
766 newline_and_indent (buffer
, spc
+ 2);
769 if (BLOCK_FRAGMENT_ORIGIN (block
))
771 pp_string (buffer
, "FRAGMENT_ORIGIN: ");
772 dump_generic_node (buffer
, BLOCK_FRAGMENT_ORIGIN (block
), 0,
773 flags
| TDF_SLIM
, false);
774 newline_and_indent (buffer
, spc
+ 2);
777 if (BLOCK_FRAGMENT_CHAIN (block
))
779 pp_string (buffer
, "FRAGMENT_CHAIN: ");
780 for (t
= BLOCK_FRAGMENT_CHAIN (block
); t
; t
= BLOCK_FRAGMENT_CHAIN (t
))
782 dump_generic_node (buffer
, t
, 0, flags
| TDF_SLIM
, false);
785 newline_and_indent (buffer
, spc
+ 2);
790 /* Dump the node NODE on the pretty_printer BUFFER, SPC spaces of
791 indent. FLAGS specifies details to show in the dump (see TDF_* in
792 dumpfile.h). If IS_STMT is true, the object printed is considered
793 to be a statement and it is terminated by ';' if appropriate. */
796 dump_generic_node (pretty_printer
*buffer
, tree node
, int spc
, int flags
,
805 if (node
== NULL_TREE
)
808 is_expr
= EXPR_P (node
);
810 if (is_stmt
&& (flags
& TDF_STMTADDR
))
811 pp_printf (buffer
, "<&%p> ", (void *)node
);
813 if ((flags
& TDF_LINENO
) && EXPR_HAS_LOCATION (node
))
814 dump_location (buffer
, EXPR_LOCATION (node
));
816 code
= TREE_CODE (node
);
820 pp_string (buffer
, "<<< error >>>");
823 case IDENTIFIER_NODE
:
824 pp_tree_identifier (buffer
, node
);
828 while (node
&& node
!= error_mark_node
)
830 if (TREE_PURPOSE (node
))
832 dump_generic_node (buffer
, TREE_PURPOSE (node
), spc
, flags
, false);
835 dump_generic_node (buffer
, TREE_VALUE (node
), spc
, flags
, false);
836 node
= TREE_CHAIN (node
);
837 if (node
&& TREE_CODE (node
) == TREE_LIST
)
846 dump_generic_node (buffer
, BINFO_TYPE (node
), spc
, flags
, false);
852 if (TREE_VEC_LENGTH (node
) > 0)
854 size_t len
= TREE_VEC_LENGTH (node
);
855 for (i
= 0; i
< len
- 1; i
++)
857 dump_generic_node (buffer
, TREE_VEC_ELT (node
, i
), spc
, flags
,
862 dump_generic_node (buffer
, TREE_VEC_ELT (node
, len
- 1), spc
,
869 case POINTER_BOUNDS_TYPE
:
872 case FIXED_POINT_TYPE
:
878 unsigned int quals
= TYPE_QUALS (node
);
879 enum tree_code_class tclass
;
881 if (quals
& TYPE_QUAL_ATOMIC
)
882 pp_string (buffer
, "atomic ");
883 if (quals
& TYPE_QUAL_CONST
)
884 pp_string (buffer
, "const ");
885 else if (quals
& TYPE_QUAL_VOLATILE
)
886 pp_string (buffer
, "volatile ");
887 else if (quals
& TYPE_QUAL_RESTRICT
)
888 pp_string (buffer
, "restrict ");
890 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
892 pp_string (buffer
, "<address-space-");
893 pp_decimal_int (buffer
, TYPE_ADDR_SPACE (node
));
894 pp_string (buffer
, "> ");
897 tclass
= TREE_CODE_CLASS (TREE_CODE (node
));
899 if (tclass
== tcc_declaration
)
901 if (DECL_NAME (node
))
902 dump_decl_name (buffer
, node
, flags
);
904 pp_string (buffer
, "<unnamed type decl>");
906 else if (tclass
== tcc_type
)
908 if (TYPE_NAME (node
))
910 if (TREE_CODE (TYPE_NAME (node
)) == IDENTIFIER_NODE
)
911 pp_tree_identifier (buffer
, TYPE_NAME (node
));
912 else if (TREE_CODE (TYPE_NAME (node
)) == TYPE_DECL
913 && DECL_NAME (TYPE_NAME (node
)))
914 dump_decl_name (buffer
, TYPE_NAME (node
), flags
);
916 pp_string (buffer
, "<unnamed type>");
918 else if (TREE_CODE (node
) == VECTOR_TYPE
)
920 pp_string (buffer
, "vector");
921 pp_left_paren (buffer
);
922 pp_wide_integer (buffer
, TYPE_VECTOR_SUBPARTS (node
));
923 pp_string (buffer
, ") ");
924 dump_generic_node (buffer
, TREE_TYPE (node
), spc
, flags
, false);
926 else if (TREE_CODE (node
) == INTEGER_TYPE
)
928 if (TYPE_PRECISION (node
) == CHAR_TYPE_SIZE
)
929 pp_string (buffer
, (TYPE_UNSIGNED (node
)
932 else if (TYPE_PRECISION (node
) == SHORT_TYPE_SIZE
)
933 pp_string (buffer
, (TYPE_UNSIGNED (node
)
936 else if (TYPE_PRECISION (node
) == INT_TYPE_SIZE
)
937 pp_string (buffer
, (TYPE_UNSIGNED (node
)
940 else if (TYPE_PRECISION (node
) == LONG_TYPE_SIZE
)
941 pp_string (buffer
, (TYPE_UNSIGNED (node
)
944 else if (TYPE_PRECISION (node
) == LONG_LONG_TYPE_SIZE
)
945 pp_string (buffer
, (TYPE_UNSIGNED (node
)
946 ? "unsigned long long"
947 : "signed long long"));
948 else if (TYPE_PRECISION (node
) >= CHAR_TYPE_SIZE
949 && exact_log2 (TYPE_PRECISION (node
)) != -1)
951 pp_string (buffer
, (TYPE_UNSIGNED (node
) ? "uint" : "int"));
952 pp_decimal_int (buffer
, TYPE_PRECISION (node
));
953 pp_string (buffer
, "_t");
957 pp_string (buffer
, (TYPE_UNSIGNED (node
)
958 ? "<unnamed-unsigned:"
959 : "<unnamed-signed:"));
960 pp_decimal_int (buffer
, TYPE_PRECISION (node
));
964 else if (TREE_CODE (node
) == COMPLEX_TYPE
)
966 pp_string (buffer
, "__complex__ ");
967 dump_generic_node (buffer
, TREE_TYPE (node
), spc
, flags
, false);
969 else if (TREE_CODE (node
) == REAL_TYPE
)
971 pp_string (buffer
, "<float:");
972 pp_decimal_int (buffer
, TYPE_PRECISION (node
));
975 else if (TREE_CODE (node
) == FIXED_POINT_TYPE
)
977 pp_string (buffer
, "<fixed-point-");
978 pp_string (buffer
, TYPE_SATURATING (node
) ? "sat:" : "nonsat:");
979 pp_decimal_int (buffer
, TYPE_PRECISION (node
));
982 else if (TREE_CODE (node
) == VOID_TYPE
)
983 pp_string (buffer
, "void");
985 pp_string (buffer
, "<unnamed type>");
992 str
= (TREE_CODE (node
) == POINTER_TYPE
? "*" : "&");
994 if (TREE_TYPE (node
) == NULL
)
996 pp_string (buffer
, str
);
997 pp_string (buffer
, "<null type>");
999 else if (TREE_CODE (TREE_TYPE (node
)) == FUNCTION_TYPE
)
1001 tree fnode
= TREE_TYPE (node
);
1003 dump_generic_node (buffer
, TREE_TYPE (fnode
), spc
, flags
, false);
1005 pp_left_paren (buffer
);
1006 pp_string (buffer
, str
);
1007 if (TYPE_NAME (node
) && DECL_NAME (TYPE_NAME (node
)))
1008 dump_decl_name (buffer
, TYPE_NAME (node
), flags
);
1009 else if (flags
& TDF_NOUID
)
1010 pp_printf (buffer
, "<Txxxx>");
1012 pp_printf (buffer
, "<T%x>", TYPE_UID (node
));
1014 pp_right_paren (buffer
);
1015 dump_function_declaration (buffer
, fnode
, spc
, flags
);
1019 unsigned int quals
= TYPE_QUALS (node
);
1021 dump_generic_node (buffer
, TREE_TYPE (node
), spc
, flags
, false);
1023 pp_string (buffer
, str
);
1025 if (quals
& TYPE_QUAL_CONST
)
1026 pp_string (buffer
, " const");
1027 if (quals
& TYPE_QUAL_VOLATILE
)
1028 pp_string (buffer
, " volatile");
1029 if (quals
& TYPE_QUAL_RESTRICT
)
1030 pp_string (buffer
, " restrict");
1032 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
1034 pp_string (buffer
, " <address-space-");
1035 pp_decimal_int (buffer
, TYPE_ADDR_SPACE (node
));
1036 pp_greater (buffer
);
1039 if (TYPE_REF_CAN_ALIAS_ALL (node
))
1040 pp_string (buffer
, " {ref-all}");
1050 if (integer_zerop (TREE_OPERAND (node
, 1))
1051 /* Dump the types of INTEGER_CSTs explicitly, for we can't
1052 infer them and MEM_ATTR caching will share MEM_REFs
1053 with differently-typed op0s. */
1054 && TREE_CODE (TREE_OPERAND (node
, 0)) != INTEGER_CST
1055 /* Released SSA_NAMES have no TREE_TYPE. */
1056 && TREE_TYPE (TREE_OPERAND (node
, 0)) != NULL_TREE
1057 /* Same pointer types, but ignoring POINTER_TYPE vs.
1059 && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 0)))
1060 == TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 1))))
1061 && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (node
, 0)))
1062 == TYPE_MODE (TREE_TYPE (TREE_OPERAND (node
, 1))))
1063 && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node
, 0)))
1064 == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node
, 1))))
1065 /* Same value types ignoring qualifiers. */
1066 && (TYPE_MAIN_VARIANT (TREE_TYPE (node
))
1067 == TYPE_MAIN_VARIANT
1068 (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 1))))))
1070 if (TREE_CODE (TREE_OPERAND (node
, 0)) != ADDR_EXPR
)
1073 dump_generic_node (buffer
, TREE_OPERAND (node
, 0),
1077 dump_generic_node (buffer
,
1078 TREE_OPERAND (TREE_OPERAND (node
, 0), 0),
1085 pp_string (buffer
, "MEM[");
1086 pp_left_paren (buffer
);
1087 ptype
= TYPE_MAIN_VARIANT (TREE_TYPE (TREE_OPERAND (node
, 1)));
1088 dump_generic_node (buffer
, ptype
,
1089 spc
, flags
| TDF_SLIM
, false);
1090 pp_right_paren (buffer
);
1091 dump_generic_node (buffer
, TREE_OPERAND (node
, 0),
1093 if (!integer_zerop (TREE_OPERAND (node
, 1)))
1095 pp_string (buffer
, " + ");
1096 dump_generic_node (buffer
, TREE_OPERAND (node
, 1),
1099 pp_right_bracket (buffer
);
1104 case TARGET_MEM_REF
:
1106 const char *sep
= "";
1109 pp_string (buffer
, "MEM[");
1111 if (TREE_CODE (TMR_BASE (node
)) == ADDR_EXPR
)
1113 pp_string (buffer
, sep
);
1115 pp_string (buffer
, "symbol: ");
1116 dump_generic_node (buffer
, TREE_OPERAND (TMR_BASE (node
), 0),
1121 pp_string (buffer
, sep
);
1123 pp_string (buffer
, "base: ");
1124 dump_generic_node (buffer
, TMR_BASE (node
), spc
, flags
, false);
1126 tmp
= TMR_INDEX2 (node
);
1129 pp_string (buffer
, sep
);
1131 pp_string (buffer
, "base: ");
1132 dump_generic_node (buffer
, tmp
, spc
, flags
, false);
1134 tmp
= TMR_INDEX (node
);
1137 pp_string (buffer
, sep
);
1139 pp_string (buffer
, "index: ");
1140 dump_generic_node (buffer
, tmp
, spc
, flags
, false);
1142 tmp
= TMR_STEP (node
);
1145 pp_string (buffer
, sep
);
1147 pp_string (buffer
, "step: ");
1148 dump_generic_node (buffer
, tmp
, spc
, flags
, false);
1150 tmp
= TMR_OFFSET (node
);
1153 pp_string (buffer
, sep
);
1155 pp_string (buffer
, "offset: ");
1156 dump_generic_node (buffer
, tmp
, spc
, flags
, false);
1158 pp_right_bracket (buffer
);
1166 /* Print the innermost component type. */
1167 for (tmp
= TREE_TYPE (node
); TREE_CODE (tmp
) == ARRAY_TYPE
;
1168 tmp
= TREE_TYPE (tmp
))
1170 dump_generic_node (buffer
, tmp
, spc
, flags
, false);
1172 /* Print the dimensions. */
1173 for (tmp
= node
; TREE_CODE (tmp
) == ARRAY_TYPE
; tmp
= TREE_TYPE (tmp
))
1174 dump_array_domain (buffer
, TYPE_DOMAIN (tmp
), spc
, flags
);
1180 case QUAL_UNION_TYPE
:
1182 unsigned int quals
= TYPE_QUALS (node
);
1184 if (quals
& TYPE_QUAL_ATOMIC
)
1185 pp_string (buffer
, "atomic ");
1186 if (quals
& TYPE_QUAL_CONST
)
1187 pp_string (buffer
, "const ");
1188 if (quals
& TYPE_QUAL_VOLATILE
)
1189 pp_string (buffer
, "volatile ");
1191 /* Print the name of the structure. */
1192 if (TREE_CODE (node
) == RECORD_TYPE
)
1193 pp_string (buffer
, "struct ");
1194 else if (TREE_CODE (node
) == UNION_TYPE
)
1195 pp_string (buffer
, "union ");
1197 if (TYPE_NAME (node
))
1198 dump_generic_node (buffer
, TYPE_NAME (node
), spc
, flags
, false);
1199 else if (!(flags
& TDF_SLIM
))
1200 /* FIXME: If we eliminate the 'else' above and attempt
1201 to show the fields for named types, we may get stuck
1202 following a cycle of pointers to structs. The alleged
1203 self-reference check in print_struct_decl will not detect
1204 cycles involving more than one pointer or struct type. */
1205 print_struct_decl (buffer
, node
, spc
, flags
);
1214 if (TREE_CODE (TREE_TYPE (node
)) == POINTER_TYPE
)
1216 /* In the case of a pointer, one may want to divide by the
1217 size of the pointed-to type. Unfortunately, this not
1218 straightforward. The C front-end maps expressions
1223 in such a way that the two INTEGER_CST nodes for "5" have
1224 different values but identical types. In the latter
1225 case, the 5 is multiplied by sizeof (int) in c-common.c
1226 (pointer_int_sum) to convert it to a byte address, and
1227 yet the type of the node is left unchanged. Argh. What
1228 is consistent though is that the number value corresponds
1229 to bytes (UNITS) offset.
1231 NB: Neither of the following divisors can be trivially
1232 used to recover the original literal:
1234 TREE_INT_CST_LOW (TYPE_SIZE_UNIT (TREE_TYPE (node)))
1235 TYPE_PRECISION (TREE_TYPE (TREE_TYPE (node))) */
1236 pp_wide_integer (buffer
, TREE_INT_CST_LOW (node
));
1237 pp_string (buffer
, "B"); /* pseudo-unit */
1240 pp_double_int (buffer
, tree_to_double_int (node
),
1241 TYPE_UNSIGNED (TREE_TYPE (node
)));
1242 if (TREE_OVERFLOW (node
))
1243 pp_string (buffer
, "(OVF)");
1247 /* Code copied from print_node. */
1250 if (TREE_OVERFLOW (node
))
1251 pp_string (buffer
, " overflow");
1253 #if !defined(REAL_IS_NOT_DOUBLE) || defined(REAL_ARITHMETIC)
1254 d
= TREE_REAL_CST (node
);
1255 if (REAL_VALUE_ISINF (d
))
1256 pp_string (buffer
, REAL_VALUE_NEGATIVE (d
) ? " -Inf" : " Inf");
1257 else if (REAL_VALUE_ISNAN (d
))
1258 pp_string (buffer
, " Nan");
1262 real_to_decimal (string
, &d
, sizeof (string
), 0, 1);
1263 pp_string (buffer
, string
);
1268 unsigned char *p
= (unsigned char *) &TREE_REAL_CST (node
);
1269 pp_string (buffer
, "0x");
1270 for (i
= 0; i
< sizeof TREE_REAL_CST (node
); i
++)
1271 output_formatted_integer (buffer
, "%02x", *p
++);
1280 fixed_to_decimal (string
, TREE_FIXED_CST_PTR (node
), sizeof (string
));
1281 pp_string (buffer
, string
);
1286 pp_string (buffer
, "__complex__ (");
1287 dump_generic_node (buffer
, TREE_REALPART (node
), spc
, flags
, false);
1288 pp_string (buffer
, ", ");
1289 dump_generic_node (buffer
, TREE_IMAGPART (node
), spc
, flags
, false);
1290 pp_right_paren (buffer
);
1294 pp_string (buffer
, "\"");
1295 pretty_print_string (buffer
, TREE_STRING_POINTER (node
));
1296 pp_string (buffer
, "\"");
1302 pp_string (buffer
, "{ ");
1303 for (i
= 0; i
< VECTOR_CST_NELTS (node
); ++i
)
1306 pp_string (buffer
, ", ");
1307 dump_generic_node (buffer
, VECTOR_CST_ELT (node
, i
),
1310 pp_string (buffer
, " }");
1316 dump_generic_node (buffer
, TREE_TYPE (node
), spc
, flags
, false);
1318 if (TREE_CODE (node
) == METHOD_TYPE
)
1320 if (TYPE_METHOD_BASETYPE (node
))
1321 dump_decl_name (buffer
, TYPE_NAME (TYPE_METHOD_BASETYPE (node
)),
1324 pp_string (buffer
, "<null method basetype>");
1325 pp_colon_colon (buffer
);
1327 if (TYPE_NAME (node
) && DECL_NAME (TYPE_NAME (node
)))
1328 dump_decl_name (buffer
, TYPE_NAME (node
), flags
);
1329 else if (flags
& TDF_NOUID
)
1330 pp_printf (buffer
, "<Txxxx>");
1332 pp_printf (buffer
, "<T%x>", TYPE_UID (node
));
1333 dump_function_declaration (buffer
, node
, spc
, flags
);
1338 dump_decl_name (buffer
, node
, flags
);
1342 if (DECL_NAME (node
))
1343 dump_decl_name (buffer
, node
, flags
);
1344 else if (LABEL_DECL_UID (node
) != -1)
1345 pp_printf (buffer
, "<L%d>", (int) LABEL_DECL_UID (node
));
1348 if (flags
& TDF_NOUID
)
1349 pp_string (buffer
, "<D.xxxx>");
1351 pp_printf (buffer
, "<D.%u>", DECL_UID (node
));
1356 if (DECL_IS_BUILTIN (node
))
1358 /* Don't print the declaration of built-in types. */
1361 if (DECL_NAME (node
))
1362 dump_decl_name (buffer
, node
, flags
);
1363 else if (TYPE_NAME (TREE_TYPE (node
)) != node
)
1365 if ((TREE_CODE (TREE_TYPE (node
)) == RECORD_TYPE
1366 || TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
)
1367 && TYPE_METHODS (TREE_TYPE (node
)))
1369 /* The type is a c++ class: all structures have at least
1371 pp_string (buffer
, "class ");
1372 dump_generic_node (buffer
, TREE_TYPE (node
), spc
, flags
, false);
1377 (TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
1378 ? "union" : "struct "));
1379 dump_generic_node (buffer
, TREE_TYPE (node
), spc
, flags
, false);
1383 pp_string (buffer
, "<anon>");
1389 case DEBUG_EXPR_DECL
:
1390 case NAMESPACE_DECL
:
1391 dump_decl_name (buffer
, node
, flags
);
1395 pp_string (buffer
, "<retval>");
1399 op0
= TREE_OPERAND (node
, 0);
1402 && (TREE_CODE (op0
) == INDIRECT_REF
1403 || (TREE_CODE (op0
) == MEM_REF
1404 && TREE_CODE (TREE_OPERAND (op0
, 0)) != ADDR_EXPR
1405 && integer_zerop (TREE_OPERAND (op0
, 1))
1406 /* Dump the types of INTEGER_CSTs explicitly, for we
1407 can't infer them and MEM_ATTR caching will share
1408 MEM_REFs with differently-typed op0s. */
1409 && TREE_CODE (TREE_OPERAND (op0
, 0)) != INTEGER_CST
1410 /* Released SSA_NAMES have no TREE_TYPE. */
1411 && TREE_TYPE (TREE_OPERAND (op0
, 0)) != NULL_TREE
1412 /* Same pointer types, but ignoring POINTER_TYPE vs.
1414 && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 0)))
1415 == TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 1))))
1416 && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0
, 0)))
1417 == TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0
, 1))))
1418 && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0
, 0)))
1419 == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0
, 1))))
1420 /* Same value types ignoring qualifiers. */
1421 && (TYPE_MAIN_VARIANT (TREE_TYPE (op0
))
1422 == TYPE_MAIN_VARIANT
1423 (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 1))))))))
1425 op0
= TREE_OPERAND (op0
, 0);
1428 if (op_prio (op0
) < op_prio (node
))
1429 pp_left_paren (buffer
);
1430 dump_generic_node (buffer
, op0
, spc
, flags
, false);
1431 if (op_prio (op0
) < op_prio (node
))
1432 pp_right_paren (buffer
);
1433 pp_string (buffer
, str
);
1434 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1435 op0
= component_ref_field_offset (node
);
1436 if (op0
&& TREE_CODE (op0
) != INTEGER_CST
)
1438 pp_string (buffer
, "{off: ");
1439 dump_generic_node (buffer
, op0
, spc
, flags
, false);
1440 pp_right_brace (buffer
);
1445 pp_string (buffer
, "BIT_FIELD_REF <");
1446 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1447 pp_string (buffer
, ", ");
1448 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1449 pp_string (buffer
, ", ");
1450 dump_generic_node (buffer
, TREE_OPERAND (node
, 2), spc
, flags
, false);
1451 pp_greater (buffer
);
1455 case ARRAY_RANGE_REF
:
1456 op0
= TREE_OPERAND (node
, 0);
1457 if (op_prio (op0
) < op_prio (node
))
1458 pp_left_paren (buffer
);
1459 dump_generic_node (buffer
, op0
, spc
, flags
, false);
1460 if (op_prio (op0
) < op_prio (node
))
1461 pp_right_paren (buffer
);
1462 pp_left_bracket (buffer
);
1463 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1464 if (TREE_CODE (node
) == ARRAY_RANGE_REF
)
1465 pp_string (buffer
, " ...");
1466 pp_right_bracket (buffer
);
1468 op0
= array_ref_low_bound (node
);
1469 op1
= array_ref_element_size (node
);
1471 if (!integer_zerop (op0
)
1472 || TREE_OPERAND (node
, 2)
1473 || TREE_OPERAND (node
, 3))
1475 pp_string (buffer
, "{lb: ");
1476 dump_generic_node (buffer
, op0
, spc
, flags
, false);
1477 pp_string (buffer
, " sz: ");
1478 dump_generic_node (buffer
, op1
, spc
, flags
, false);
1479 pp_right_brace (buffer
);
1485 unsigned HOST_WIDE_INT ix
;
1487 bool is_struct_init
= false;
1488 bool is_array_init
= false;
1489 double_int curidx
= double_int_zero
;
1490 pp_left_brace (buffer
);
1491 if (TREE_CLOBBER_P (node
))
1492 pp_string (buffer
, "CLOBBER");
1493 else if (TREE_CODE (TREE_TYPE (node
)) == RECORD_TYPE
1494 || TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
)
1495 is_struct_init
= true;
1496 else if (TREE_CODE (TREE_TYPE (node
)) == ARRAY_TYPE
1497 && TYPE_DOMAIN (TREE_TYPE (node
))
1498 && TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
)))
1499 && TREE_CODE (TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
))))
1502 tree minv
= TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
)));
1503 is_array_init
= true;
1504 curidx
= tree_to_double_int (minv
);
1506 FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (node
), ix
, field
, val
)
1513 dump_generic_node (buffer
, field
, spc
, flags
, false);
1516 else if (is_array_init
1517 && (TREE_CODE (field
) != INTEGER_CST
1518 || tree_to_double_int (field
) != curidx
))
1520 pp_left_bracket (buffer
);
1521 if (TREE_CODE (field
) == RANGE_EXPR
)
1523 dump_generic_node (buffer
, TREE_OPERAND (field
, 0), spc
,
1525 pp_string (buffer
, " ... ");
1526 dump_generic_node (buffer
, TREE_OPERAND (field
, 1), spc
,
1528 if (TREE_CODE (TREE_OPERAND (field
, 1)) == INTEGER_CST
)
1529 curidx
= tree_to_double_int (TREE_OPERAND (field
, 1));
1532 dump_generic_node (buffer
, field
, spc
, flags
, false);
1533 if (TREE_CODE (field
) == INTEGER_CST
)
1534 curidx
= tree_to_double_int (field
);
1535 pp_string (buffer
, "]=");
1539 curidx
+= double_int_one
;
1540 if (val
&& TREE_CODE (val
) == ADDR_EXPR
)
1541 if (TREE_CODE (TREE_OPERAND (val
, 0)) == FUNCTION_DECL
)
1542 val
= TREE_OPERAND (val
, 0);
1543 if (val
&& TREE_CODE (val
) == FUNCTION_DECL
)
1544 dump_decl_name (buffer
, val
, flags
);
1546 dump_generic_node (buffer
, val
, spc
, flags
, false);
1547 if (ix
!= vec_safe_length (CONSTRUCTOR_ELTS (node
)) - 1)
1553 pp_right_brace (buffer
);
1560 if (flags
& TDF_SLIM
)
1562 pp_string (buffer
, "<COMPOUND_EXPR>");
1566 dump_generic_node (buffer
, TREE_OPERAND (node
, 0),
1567 spc
, flags
, !(flags
& TDF_SLIM
));
1568 if (flags
& TDF_SLIM
)
1569 newline_and_indent (buffer
, spc
);
1576 for (tp
= &TREE_OPERAND (node
, 1);
1577 TREE_CODE (*tp
) == COMPOUND_EXPR
;
1578 tp
= &TREE_OPERAND (*tp
, 1))
1580 dump_generic_node (buffer
, TREE_OPERAND (*tp
, 0),
1581 spc
, flags
, !(flags
& TDF_SLIM
));
1582 if (flags
& TDF_SLIM
)
1583 newline_and_indent (buffer
, spc
);
1591 dump_generic_node (buffer
, *tp
, spc
, flags
, !(flags
& TDF_SLIM
));
1595 case STATEMENT_LIST
:
1597 tree_stmt_iterator si
;
1600 if (flags
& TDF_SLIM
)
1602 pp_string (buffer
, "<STATEMENT_LIST>");
1606 for (si
= tsi_start (node
); !tsi_end_p (si
); tsi_next (&si
))
1609 newline_and_indent (buffer
, spc
);
1612 dump_generic_node (buffer
, tsi_stmt (si
), spc
, flags
, true);
1619 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
,
1624 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
,
1629 pp_string (buffer
, "TARGET_EXPR <");
1630 dump_generic_node (buffer
, TARGET_EXPR_SLOT (node
), spc
, flags
, false);
1633 dump_generic_node (buffer
, TARGET_EXPR_INITIAL (node
), spc
, flags
, false);
1634 pp_greater (buffer
);
1638 print_declaration (buffer
, DECL_EXPR_DECL (node
), spc
, flags
);
1643 if (TREE_TYPE (node
) == NULL
|| TREE_TYPE (node
) == void_type_node
)
1645 pp_string (buffer
, "if (");
1646 dump_generic_node (buffer
, COND_EXPR_COND (node
), spc
, flags
, false);
1647 pp_right_paren (buffer
);
1648 /* The lowered cond_exprs should always be printed in full. */
1649 if (COND_EXPR_THEN (node
)
1650 && (IS_EMPTY_STMT (COND_EXPR_THEN (node
))
1651 || TREE_CODE (COND_EXPR_THEN (node
)) == GOTO_EXPR
)
1652 && COND_EXPR_ELSE (node
)
1653 && (IS_EMPTY_STMT (COND_EXPR_ELSE (node
))
1654 || TREE_CODE (COND_EXPR_ELSE (node
)) == GOTO_EXPR
))
1657 dump_generic_node (buffer
, COND_EXPR_THEN (node
),
1659 if (!IS_EMPTY_STMT (COND_EXPR_ELSE (node
)))
1661 pp_string (buffer
, " else ");
1662 dump_generic_node (buffer
, COND_EXPR_ELSE (node
),
1666 else if (!(flags
& TDF_SLIM
))
1668 /* Output COND_EXPR_THEN. */
1669 if (COND_EXPR_THEN (node
))
1671 newline_and_indent (buffer
, spc
+2);
1672 pp_left_brace (buffer
);
1673 newline_and_indent (buffer
, spc
+4);
1674 dump_generic_node (buffer
, COND_EXPR_THEN (node
), spc
+4,
1676 newline_and_indent (buffer
, spc
+2);
1677 pp_right_brace (buffer
);
1680 /* Output COND_EXPR_ELSE. */
1681 if (COND_EXPR_ELSE (node
)
1682 && !IS_EMPTY_STMT (COND_EXPR_ELSE (node
)))
1684 newline_and_indent (buffer
, spc
);
1685 pp_string (buffer
, "else");
1686 newline_and_indent (buffer
, spc
+2);
1687 pp_left_brace (buffer
);
1688 newline_and_indent (buffer
, spc
+4);
1689 dump_generic_node (buffer
, COND_EXPR_ELSE (node
), spc
+4,
1691 newline_and_indent (buffer
, spc
+2);
1692 pp_right_brace (buffer
);
1699 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1701 pp_question (buffer
);
1703 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1707 dump_generic_node (buffer
, TREE_OPERAND (node
, 2), spc
, flags
, false);
1712 pp_left_brace (buffer
);
1713 if (!(flags
& TDF_SLIM
))
1715 if (BIND_EXPR_VARS (node
))
1717 pp_newline (buffer
);
1719 for (op0
= BIND_EXPR_VARS (node
); op0
; op0
= DECL_CHAIN (op0
))
1721 print_declaration (buffer
, op0
, spc
+2, flags
);
1722 pp_newline (buffer
);
1726 newline_and_indent (buffer
, spc
+2);
1727 dump_generic_node (buffer
, BIND_EXPR_BODY (node
), spc
+2, flags
, true);
1728 newline_and_indent (buffer
, spc
);
1729 pp_right_brace (buffer
);
1735 print_call_name (buffer
, CALL_EXPR_FN (node
), flags
);
1737 /* Print parameters. */
1739 pp_left_paren (buffer
);
1742 call_expr_arg_iterator iter
;
1743 FOR_EACH_CALL_EXPR_ARG (arg
, iter
, node
)
1745 dump_generic_node (buffer
, arg
, spc
, flags
, false);
1746 if (more_call_expr_args_p (&iter
))
1753 if (CALL_EXPR_VA_ARG_PACK (node
))
1755 if (call_expr_nargs (node
) > 0)
1760 pp_string (buffer
, "__builtin_va_arg_pack ()");
1762 pp_right_paren (buffer
);
1764 op1
= CALL_EXPR_STATIC_CHAIN (node
);
1767 pp_string (buffer
, " [static-chain: ");
1768 dump_generic_node (buffer
, op1
, spc
, flags
, false);
1769 pp_right_bracket (buffer
);
1772 if (CALL_EXPR_RETURN_SLOT_OPT (node
))
1773 pp_string (buffer
, " [return slot optimization]");
1774 if (CALL_EXPR_TAILCALL (node
))
1775 pp_string (buffer
, " [tail call]");
1778 case WITH_CLEANUP_EXPR
:
1782 case CLEANUP_POINT_EXPR
:
1783 pp_string (buffer
, "<<cleanup_point ");
1784 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1785 pp_string (buffer
, ">>");
1788 case PLACEHOLDER_EXPR
:
1789 pp_string (buffer
, "<PLACEHOLDER_EXPR ");
1790 dump_generic_node (buffer
, TREE_TYPE (node
), spc
, flags
, false);
1791 pp_greater (buffer
);
1794 /* Binary arithmetic and logic expressions. */
1795 case WIDEN_SUM_EXPR
:
1796 case WIDEN_MULT_EXPR
:
1798 case MULT_HIGHPART_EXPR
:
1800 case POINTER_PLUS_EXPR
:
1802 case TRUNC_DIV_EXPR
:
1804 case FLOOR_DIV_EXPR
:
1805 case ROUND_DIV_EXPR
:
1806 case TRUNC_MOD_EXPR
:
1808 case FLOOR_MOD_EXPR
:
1809 case ROUND_MOD_EXPR
:
1811 case EXACT_DIV_EXPR
:
1816 case VEC_LSHIFT_EXPR
:
1817 case VEC_RSHIFT_EXPR
:
1818 case WIDEN_LSHIFT_EXPR
:
1822 case TRUTH_ANDIF_EXPR
:
1823 case TRUTH_ORIF_EXPR
:
1824 case TRUTH_AND_EXPR
:
1826 case TRUTH_XOR_EXPR
:
1840 case UNORDERED_EXPR
:
1842 const char *op
= op_symbol (node
);
1843 op0
= TREE_OPERAND (node
, 0);
1844 op1
= TREE_OPERAND (node
, 1);
1846 /* When the operands are expressions with less priority,
1847 keep semantics of the tree representation. */
1848 if (op_prio (op0
) <= op_prio (node
))
1850 pp_left_paren (buffer
);
1851 dump_generic_node (buffer
, op0
, spc
, flags
, false);
1852 pp_right_paren (buffer
);
1855 dump_generic_node (buffer
, op0
, spc
, flags
, false);
1858 pp_string (buffer
, op
);
1861 /* When the operands are expressions with less priority,
1862 keep semantics of the tree representation. */
1863 if (op_prio (op1
) <= op_prio (node
))
1865 pp_left_paren (buffer
);
1866 dump_generic_node (buffer
, op1
, spc
, flags
, false);
1867 pp_right_paren (buffer
);
1870 dump_generic_node (buffer
, op1
, spc
, flags
, false);
1874 /* Unary arithmetic and logic expressions. */
1877 case TRUTH_NOT_EXPR
:
1879 case PREDECREMENT_EXPR
:
1880 case PREINCREMENT_EXPR
:
1882 if (TREE_CODE (node
) == ADDR_EXPR
1883 && (TREE_CODE (TREE_OPERAND (node
, 0)) == STRING_CST
1884 || TREE_CODE (TREE_OPERAND (node
, 0)) == FUNCTION_DECL
))
1885 ; /* Do not output '&' for strings and function pointers. */
1887 pp_string (buffer
, op_symbol (node
));
1889 if (op_prio (TREE_OPERAND (node
, 0)) < op_prio (node
))
1891 pp_left_paren (buffer
);
1892 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1893 pp_right_paren (buffer
);
1896 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1899 case POSTDECREMENT_EXPR
:
1900 case POSTINCREMENT_EXPR
:
1901 if (op_prio (TREE_OPERAND (node
, 0)) < op_prio (node
))
1903 pp_left_paren (buffer
);
1904 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1905 pp_right_paren (buffer
);
1908 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1909 pp_string (buffer
, op_symbol (node
));
1913 pp_string (buffer
, "MIN_EXPR <");
1914 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1915 pp_string (buffer
, ", ");
1916 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1917 pp_greater (buffer
);
1921 pp_string (buffer
, "MAX_EXPR <");
1922 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1923 pp_string (buffer
, ", ");
1924 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1925 pp_greater (buffer
);
1929 pp_string (buffer
, "ABS_EXPR <");
1930 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1931 pp_greater (buffer
);
1938 case ADDR_SPACE_CONVERT_EXPR
:
1939 case FIXED_CONVERT_EXPR
:
1940 case FIX_TRUNC_EXPR
:
1943 type
= TREE_TYPE (node
);
1944 op0
= TREE_OPERAND (node
, 0);
1945 if (type
!= TREE_TYPE (op0
))
1947 pp_left_paren (buffer
);
1948 dump_generic_node (buffer
, type
, spc
, flags
, false);
1949 pp_string (buffer
, ") ");
1951 if (op_prio (op0
) < op_prio (node
))
1952 pp_left_paren (buffer
);
1953 dump_generic_node (buffer
, op0
, spc
, flags
, false);
1954 if (op_prio (op0
) < op_prio (node
))
1955 pp_right_paren (buffer
);
1958 case VIEW_CONVERT_EXPR
:
1959 pp_string (buffer
, "VIEW_CONVERT_EXPR<");
1960 dump_generic_node (buffer
, TREE_TYPE (node
), spc
, flags
, false);
1961 pp_string (buffer
, ">(");
1962 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1963 pp_right_paren (buffer
);
1967 pp_string (buffer
, "((");
1968 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1969 pp_string (buffer
, "))");
1972 case NON_LVALUE_EXPR
:
1973 pp_string (buffer
, "NON_LVALUE_EXPR <");
1974 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1975 pp_greater (buffer
);
1979 pp_string (buffer
, "SAVE_EXPR <");
1980 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1981 pp_greater (buffer
);
1985 pp_string (buffer
, "COMPLEX_EXPR <");
1986 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1987 pp_string (buffer
, ", ");
1988 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1989 pp_greater (buffer
);
1993 pp_string (buffer
, "CONJ_EXPR <");
1994 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1995 pp_greater (buffer
);
1999 pp_string (buffer
, "REALPART_EXPR <");
2000 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2001 pp_greater (buffer
);
2005 pp_string (buffer
, "IMAGPART_EXPR <");
2006 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2007 pp_greater (buffer
);
2011 pp_string (buffer
, "VA_ARG_EXPR <");
2012 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2013 pp_greater (buffer
);
2016 case TRY_FINALLY_EXPR
:
2017 case TRY_CATCH_EXPR
:
2018 pp_string (buffer
, "try");
2019 newline_and_indent (buffer
, spc
+2);
2020 pp_left_brace (buffer
);
2021 newline_and_indent (buffer
, spc
+4);
2022 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
+4, flags
, true);
2023 newline_and_indent (buffer
, spc
+2);
2024 pp_right_brace (buffer
);
2025 newline_and_indent (buffer
, spc
);
2027 (TREE_CODE (node
) == TRY_CATCH_EXPR
) ? "catch" : "finally");
2028 newline_and_indent (buffer
, spc
+2);
2029 pp_left_brace (buffer
);
2030 newline_and_indent (buffer
, spc
+4);
2031 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
+4, flags
, true);
2032 newline_and_indent (buffer
, spc
+2);
2033 pp_right_brace (buffer
);
2038 pp_string (buffer
, "catch (");
2039 dump_generic_node (buffer
, CATCH_TYPES (node
), spc
+2, flags
, false);
2040 pp_right_paren (buffer
);
2041 newline_and_indent (buffer
, spc
+2);
2042 pp_left_brace (buffer
);
2043 newline_and_indent (buffer
, spc
+4);
2044 dump_generic_node (buffer
, CATCH_BODY (node
), spc
+4, flags
, true);
2045 newline_and_indent (buffer
, spc
+2);
2046 pp_right_brace (buffer
);
2050 case EH_FILTER_EXPR
:
2051 pp_string (buffer
, "<<<eh_filter (");
2052 dump_generic_node (buffer
, EH_FILTER_TYPES (node
), spc
+2, flags
, false);
2053 pp_string (buffer
, ")>>>");
2054 newline_and_indent (buffer
, spc
+2);
2055 pp_left_brace (buffer
);
2056 newline_and_indent (buffer
, spc
+4);
2057 dump_generic_node (buffer
, EH_FILTER_FAILURE (node
), spc
+4, flags
, true);
2058 newline_and_indent (buffer
, spc
+2);
2059 pp_right_brace (buffer
);
2064 op0
= TREE_OPERAND (node
, 0);
2065 /* If this is for break or continue, don't bother printing it. */
2066 if (DECL_NAME (op0
))
2068 const char *name
= IDENTIFIER_POINTER (DECL_NAME (op0
));
2069 if (strcmp (name
, "break") == 0
2070 || strcmp (name
, "continue") == 0)
2073 dump_generic_node (buffer
, op0
, spc
, flags
, false);
2075 if (DECL_NONLOCAL (op0
))
2076 pp_string (buffer
, " [non-local]");
2080 pp_string (buffer
, "while (1)");
2081 if (!(flags
& TDF_SLIM
))
2083 newline_and_indent (buffer
, spc
+2);
2084 pp_left_brace (buffer
);
2085 newline_and_indent (buffer
, spc
+4);
2086 dump_generic_node (buffer
, LOOP_EXPR_BODY (node
), spc
+4, flags
, true);
2087 newline_and_indent (buffer
, spc
+2);
2088 pp_right_brace (buffer
);
2094 pp_string (buffer
, "// predicted ");
2095 if (PREDICT_EXPR_OUTCOME (node
))
2096 pp_string (buffer
, "likely by ");
2098 pp_string (buffer
, "unlikely by ");
2099 pp_string (buffer
, predictor_name (PREDICT_EXPR_PREDICTOR (node
)));
2100 pp_string (buffer
, " predictor.");
2104 pp_string (buffer
, "ANNOTATE_EXPR <");
2105 switch ((enum annot_expr_kind
) TREE_INT_CST_LOW (TREE_OPERAND (node
, 1)))
2107 case annot_expr_ivdep_kind
:
2108 pp_string (buffer
, "ivdep, ");
2111 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2112 pp_greater (buffer
);
2116 pp_string (buffer
, "return");
2117 op0
= TREE_OPERAND (node
, 0);
2121 if (TREE_CODE (op0
) == MODIFY_EXPR
)
2122 dump_generic_node (buffer
, TREE_OPERAND (op0
, 1),
2125 dump_generic_node (buffer
, op0
, spc
, flags
, false);
2130 pp_string (buffer
, "if (");
2131 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2132 pp_string (buffer
, ") break");
2136 pp_string (buffer
, "switch (");
2137 dump_generic_node (buffer
, SWITCH_COND (node
), spc
, flags
, false);
2138 pp_right_paren (buffer
);
2139 if (!(flags
& TDF_SLIM
))
2141 newline_and_indent (buffer
, spc
+2);
2142 pp_left_brace (buffer
);
2143 if (SWITCH_BODY (node
))
2145 newline_and_indent (buffer
, spc
+4);
2146 dump_generic_node (buffer
, SWITCH_BODY (node
), spc
+4, flags
,
2151 tree vec
= SWITCH_LABELS (node
);
2152 size_t i
, n
= TREE_VEC_LENGTH (vec
);
2153 for (i
= 0; i
< n
; ++i
)
2155 tree elt
= TREE_VEC_ELT (vec
, i
);
2156 newline_and_indent (buffer
, spc
+4);
2159 dump_generic_node (buffer
, elt
, spc
+4, flags
, false);
2160 pp_string (buffer
, " goto ");
2161 dump_generic_node (buffer
, CASE_LABEL (elt
), spc
+4,
2163 pp_semicolon (buffer
);
2166 pp_string (buffer
, "case ???: goto ???;");
2169 newline_and_indent (buffer
, spc
+2);
2170 pp_right_brace (buffer
);
2176 op0
= GOTO_DESTINATION (node
);
2177 if (TREE_CODE (op0
) != SSA_NAME
&& DECL_P (op0
) && DECL_NAME (op0
))
2179 const char *name
= IDENTIFIER_POINTER (DECL_NAME (op0
));
2180 if (strcmp (name
, "break") == 0
2181 || strcmp (name
, "continue") == 0)
2183 pp_string (buffer
, name
);
2187 pp_string (buffer
, "goto ");
2188 dump_generic_node (buffer
, op0
, spc
, flags
, false);
2192 pp_string (buffer
, "__asm__");
2193 if (ASM_VOLATILE_P (node
))
2194 pp_string (buffer
, " __volatile__");
2195 pp_left_paren (buffer
);
2196 dump_generic_node (buffer
, ASM_STRING (node
), spc
, flags
, false);
2198 dump_generic_node (buffer
, ASM_OUTPUTS (node
), spc
, flags
, false);
2200 dump_generic_node (buffer
, ASM_INPUTS (node
), spc
, flags
, false);
2201 if (ASM_CLOBBERS (node
))
2204 dump_generic_node (buffer
, ASM_CLOBBERS (node
), spc
, flags
, false);
2206 pp_right_paren (buffer
);
2209 case CASE_LABEL_EXPR
:
2210 if (CASE_LOW (node
) && CASE_HIGH (node
))
2212 pp_string (buffer
, "case ");
2213 dump_generic_node (buffer
, CASE_LOW (node
), spc
, flags
, false);
2214 pp_string (buffer
, " ... ");
2215 dump_generic_node (buffer
, CASE_HIGH (node
), spc
, flags
, false);
2217 else if (CASE_LOW (node
))
2219 pp_string (buffer
, "case ");
2220 dump_generic_node (buffer
, CASE_LOW (node
), spc
, flags
, false);
2223 pp_string (buffer
, "default");
2228 pp_string (buffer
, "OBJ_TYPE_REF(");
2229 dump_generic_node (buffer
, OBJ_TYPE_REF_EXPR (node
), spc
, flags
, false);
2230 pp_semicolon (buffer
);
2231 dump_generic_node (buffer
, OBJ_TYPE_REF_OBJECT (node
), spc
, flags
, false);
2233 dump_generic_node (buffer
, OBJ_TYPE_REF_TOKEN (node
), spc
, flags
, false);
2234 pp_right_paren (buffer
);
2238 if (SSA_NAME_IDENTIFIER (node
))
2239 dump_generic_node (buffer
, SSA_NAME_IDENTIFIER (node
),
2241 pp_underscore (buffer
);
2242 pp_decimal_int (buffer
, SSA_NAME_VERSION (node
));
2243 if (SSA_NAME_IS_DEFAULT_DEF (node
))
2244 pp_string (buffer
, "(D)");
2245 if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (node
))
2246 pp_string (buffer
, "(ab)");
2249 case WITH_SIZE_EXPR
:
2250 pp_string (buffer
, "WITH_SIZE_EXPR <");
2251 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2252 pp_string (buffer
, ", ");
2253 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2254 pp_greater (buffer
);
2258 pp_string (buffer
, "ASSERT_EXPR <");
2259 dump_generic_node (buffer
, ASSERT_EXPR_VAR (node
), spc
, flags
, false);
2260 pp_string (buffer
, ", ");
2261 dump_generic_node (buffer
, ASSERT_EXPR_COND (node
), spc
, flags
, false);
2262 pp_greater (buffer
);
2266 pp_string (buffer
, "scev_known");
2269 case SCEV_NOT_KNOWN
:
2270 pp_string (buffer
, "scev_not_known");
2273 case POLYNOMIAL_CHREC
:
2274 pp_left_brace (buffer
);
2275 dump_generic_node (buffer
, CHREC_LEFT (node
), spc
, flags
, false);
2276 pp_string (buffer
, ", +, ");
2277 dump_generic_node (buffer
, CHREC_RIGHT (node
), spc
, flags
, false);
2278 pp_string (buffer
, "}_");
2279 dump_generic_node (buffer
, CHREC_VAR (node
), spc
, flags
, false);
2283 case REALIGN_LOAD_EXPR
:
2284 pp_string (buffer
, "REALIGN_LOAD <");
2285 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2286 pp_string (buffer
, ", ");
2287 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2288 pp_string (buffer
, ", ");
2289 dump_generic_node (buffer
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2290 pp_greater (buffer
);
2294 pp_string (buffer
, " VEC_COND_EXPR < ");
2295 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2296 pp_string (buffer
, " , ");
2297 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2298 pp_string (buffer
, " , ");
2299 dump_generic_node (buffer
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2300 pp_string (buffer
, " > ");
2304 pp_string (buffer
, " VEC_PERM_EXPR < ");
2305 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2306 pp_string (buffer
, " , ");
2307 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2308 pp_string (buffer
, " , ");
2309 dump_generic_node (buffer
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2310 pp_string (buffer
, " > ");
2314 pp_string (buffer
, " DOT_PROD_EXPR < ");
2315 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2316 pp_string (buffer
, ", ");
2317 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2318 pp_string (buffer
, ", ");
2319 dump_generic_node (buffer
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2320 pp_string (buffer
, " > ");
2323 case WIDEN_MULT_PLUS_EXPR
:
2324 pp_string (buffer
, " WIDEN_MULT_PLUS_EXPR < ");
2325 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2326 pp_string (buffer
, ", ");
2327 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2328 pp_string (buffer
, ", ");
2329 dump_generic_node (buffer
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2330 pp_string (buffer
, " > ");
2333 case WIDEN_MULT_MINUS_EXPR
:
2334 pp_string (buffer
, " WIDEN_MULT_MINUS_EXPR < ");
2335 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2336 pp_string (buffer
, ", ");
2337 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2338 pp_string (buffer
, ", ");
2339 dump_generic_node (buffer
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2340 pp_string (buffer
, " > ");
2344 pp_string (buffer
, " FMA_EXPR < ");
2345 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2346 pp_string (buffer
, ", ");
2347 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2348 pp_string (buffer
, ", ");
2349 dump_generic_node (buffer
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2350 pp_string (buffer
, " > ");
2354 pp_string (buffer
, "#pragma omp parallel");
2355 dump_omp_clauses (buffer
, OMP_PARALLEL_CLAUSES (node
), spc
, flags
);
2358 if (!(flags
& TDF_SLIM
) && OMP_BODY (node
))
2360 newline_and_indent (buffer
, spc
+ 2);
2361 pp_left_brace (buffer
);
2362 newline_and_indent (buffer
, spc
+ 4);
2363 dump_generic_node (buffer
, OMP_BODY (node
), spc
+ 4, flags
, false);
2364 newline_and_indent (buffer
, spc
+ 2);
2365 pp_right_brace (buffer
);
2371 pp_string (buffer
, "#pragma omp task");
2372 dump_omp_clauses (buffer
, OMP_TASK_CLAUSES (node
), spc
, flags
);
2376 pp_string (buffer
, "#pragma omp for");
2380 pp_string (buffer
, "#pragma omp simd");
2384 pp_string (buffer
, "#pragma simd");
2387 case OMP_DISTRIBUTE
:
2388 pp_string (buffer
, "#pragma omp distribute");
2392 pp_string (buffer
, "#pragma omp teams");
2393 dump_omp_clauses (buffer
, OMP_TEAMS_CLAUSES (node
), spc
, flags
);
2396 case OMP_TARGET_DATA
:
2397 pp_string (buffer
, "#pragma omp target data");
2398 dump_omp_clauses (buffer
, OMP_TARGET_DATA_CLAUSES (node
), spc
, flags
);
2402 pp_string (buffer
, "#pragma omp target");
2403 dump_omp_clauses (buffer
, OMP_TARGET_CLAUSES (node
), spc
, flags
);
2406 case OMP_TARGET_UPDATE
:
2407 pp_string (buffer
, "#pragma omp target update");
2408 dump_omp_clauses (buffer
, OMP_TARGET_UPDATE_CLAUSES (node
), spc
, flags
);
2413 dump_omp_clauses (buffer
, OMP_FOR_CLAUSES (node
), spc
, flags
);
2415 if (!(flags
& TDF_SLIM
))
2419 if (OMP_FOR_PRE_BODY (node
))
2421 newline_and_indent (buffer
, spc
+ 2);
2422 pp_left_brace (buffer
);
2424 newline_and_indent (buffer
, spc
);
2425 dump_generic_node (buffer
, OMP_FOR_PRE_BODY (node
),
2428 if (OMP_FOR_INIT (node
))
2431 for (i
= 0; i
< TREE_VEC_LENGTH (OMP_FOR_INIT (node
)); i
++)
2434 newline_and_indent (buffer
, spc
);
2435 pp_string (buffer
, "for (");
2436 dump_generic_node (buffer
,
2437 TREE_VEC_ELT (OMP_FOR_INIT (node
), i
),
2439 pp_string (buffer
, "; ");
2440 dump_generic_node (buffer
,
2441 TREE_VEC_ELT (OMP_FOR_COND (node
), i
),
2443 pp_string (buffer
, "; ");
2444 dump_generic_node (buffer
,
2445 TREE_VEC_ELT (OMP_FOR_INCR (node
), i
),
2447 pp_right_paren (buffer
);
2450 if (OMP_FOR_BODY (node
))
2452 newline_and_indent (buffer
, spc
+ 2);
2453 pp_left_brace (buffer
);
2454 newline_and_indent (buffer
, spc
+ 4);
2455 dump_generic_node (buffer
, OMP_FOR_BODY (node
), spc
+ 4, flags
,
2457 newline_and_indent (buffer
, spc
+ 2);
2458 pp_right_brace (buffer
);
2460 if (OMP_FOR_INIT (node
))
2461 spc
-= 2 * TREE_VEC_LENGTH (OMP_FOR_INIT (node
)) - 2;
2462 if (OMP_FOR_PRE_BODY (node
))
2465 newline_and_indent (buffer
, spc
+ 2);
2466 pp_right_brace (buffer
);
2473 pp_string (buffer
, "#pragma omp sections");
2474 dump_omp_clauses (buffer
, OMP_SECTIONS_CLAUSES (node
), spc
, flags
);
2478 pp_string (buffer
, "#pragma omp section");
2482 pp_string (buffer
, "#pragma omp master");
2486 pp_string (buffer
, "#pragma omp taskgroup");
2490 pp_string (buffer
, "#pragma omp ordered");
2494 pp_string (buffer
, "#pragma omp critical");
2495 if (OMP_CRITICAL_NAME (node
))
2498 pp_left_paren (buffer
);
2499 dump_generic_node (buffer
, OMP_CRITICAL_NAME (node
), spc
,
2501 pp_right_paren (buffer
);
2506 pp_string (buffer
, "#pragma omp atomic");
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);
2517 case OMP_ATOMIC_READ
:
2518 pp_string (buffer
, "#pragma omp atomic read");
2519 if (OMP_ATOMIC_SEQ_CST (node
))
2520 pp_string (buffer
, " seq_cst");
2521 newline_and_indent (buffer
, spc
+ 2);
2522 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2526 case OMP_ATOMIC_CAPTURE_OLD
:
2527 case OMP_ATOMIC_CAPTURE_NEW
:
2528 pp_string (buffer
, "#pragma omp atomic capture");
2529 if (OMP_ATOMIC_SEQ_CST (node
))
2530 pp_string (buffer
, " seq_cst");
2531 newline_and_indent (buffer
, spc
+ 2);
2532 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2536 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2540 pp_string (buffer
, "#pragma omp single");
2541 dump_omp_clauses (buffer
, OMP_SINGLE_CLAUSES (node
), spc
, flags
);
2545 dump_omp_clause (buffer
, node
, spc
, flags
);
2549 case TRANSACTION_EXPR
:
2550 if (TRANSACTION_EXPR_OUTER (node
))
2551 pp_string (buffer
, "__transaction_atomic [[outer]]");
2552 else if (TRANSACTION_EXPR_RELAXED (node
))
2553 pp_string (buffer
, "__transaction_relaxed");
2555 pp_string (buffer
, "__transaction_atomic");
2556 if (!(flags
& TDF_SLIM
) && TRANSACTION_EXPR_BODY (node
))
2558 newline_and_indent (buffer
, spc
);
2559 pp_left_brace (buffer
);
2560 newline_and_indent (buffer
, spc
+ 2);
2561 dump_generic_node (buffer
, TRANSACTION_EXPR_BODY (node
),
2562 spc
+ 2, flags
, false);
2563 newline_and_indent (buffer
, spc
);
2564 pp_right_brace (buffer
);
2569 case REDUC_MAX_EXPR
:
2570 pp_string (buffer
, " REDUC_MAX_EXPR < ");
2571 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2572 pp_string (buffer
, " > ");
2575 case REDUC_MIN_EXPR
:
2576 pp_string (buffer
, " REDUC_MIN_EXPR < ");
2577 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2578 pp_string (buffer
, " > ");
2581 case REDUC_PLUS_EXPR
:
2582 pp_string (buffer
, " REDUC_PLUS_EXPR < ");
2583 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2584 pp_string (buffer
, " > ");
2587 case VEC_WIDEN_MULT_HI_EXPR
:
2588 case VEC_WIDEN_MULT_LO_EXPR
:
2589 case VEC_WIDEN_MULT_EVEN_EXPR
:
2590 case VEC_WIDEN_MULT_ODD_EXPR
:
2591 case VEC_WIDEN_LSHIFT_HI_EXPR
:
2592 case VEC_WIDEN_LSHIFT_LO_EXPR
:
2594 for (str
= get_tree_code_name (code
); *str
; str
++)
2595 pp_character (buffer
, TOUPPER (*str
));
2596 pp_string (buffer
, " < ");
2597 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2598 pp_string (buffer
, ", ");
2599 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2600 pp_string (buffer
, " > ");
2603 case VEC_UNPACK_HI_EXPR
:
2604 pp_string (buffer
, " VEC_UNPACK_HI_EXPR < ");
2605 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2606 pp_string (buffer
, " > ");
2609 case VEC_UNPACK_LO_EXPR
:
2610 pp_string (buffer
, " VEC_UNPACK_LO_EXPR < ");
2611 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2612 pp_string (buffer
, " > ");
2615 case VEC_UNPACK_FLOAT_HI_EXPR
:
2616 pp_string (buffer
, " VEC_UNPACK_FLOAT_HI_EXPR < ");
2617 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2618 pp_string (buffer
, " > ");
2621 case VEC_UNPACK_FLOAT_LO_EXPR
:
2622 pp_string (buffer
, " VEC_UNPACK_FLOAT_LO_EXPR < ");
2623 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2624 pp_string (buffer
, " > ");
2627 case VEC_PACK_TRUNC_EXPR
:
2628 pp_string (buffer
, " VEC_PACK_TRUNC_EXPR < ");
2629 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2630 pp_string (buffer
, ", ");
2631 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2632 pp_string (buffer
, " > ");
2635 case VEC_PACK_SAT_EXPR
:
2636 pp_string (buffer
, " VEC_PACK_SAT_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
, " > ");
2643 case VEC_PACK_FIX_TRUNC_EXPR
:
2644 pp_string (buffer
, " VEC_PACK_FIX_TRUNC_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
, " > ");
2652 dump_block_node (buffer
, node
, spc
, flags
);
2655 case CILK_SPAWN_STMT
:
2656 pp_string (buffer
, "_Cilk_spawn ");
2657 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2660 case CILK_SYNC_STMT
:
2661 pp_string (buffer
, "_Cilk_sync");
2668 if (is_stmt
&& is_expr
)
2669 pp_semicolon (buffer
);
2674 /* Print the declaration of a variable. */
2677 print_declaration (pretty_printer
*buffer
, tree t
, int spc
, int flags
)
2681 if (TREE_CODE (t
) == TYPE_DECL
)
2682 pp_string (buffer
, "typedef ");
2684 if (CODE_CONTAINS_STRUCT (TREE_CODE (t
), TS_DECL_WRTL
) && DECL_REGISTER (t
))
2685 pp_string (buffer
, "register ");
2687 if (TREE_PUBLIC (t
) && DECL_EXTERNAL (t
))
2688 pp_string (buffer
, "extern ");
2689 else if (TREE_STATIC (t
))
2690 pp_string (buffer
, "static ");
2692 /* Print the type and name. */
2693 if (TREE_TYPE (t
) && TREE_CODE (TREE_TYPE (t
)) == ARRAY_TYPE
)
2697 /* Print array's type. */
2698 tmp
= TREE_TYPE (t
);
2699 while (TREE_CODE (TREE_TYPE (tmp
)) == ARRAY_TYPE
)
2700 tmp
= TREE_TYPE (tmp
);
2701 dump_generic_node (buffer
, TREE_TYPE (tmp
), spc
, flags
, false);
2703 /* Print variable's name. */
2705 dump_generic_node (buffer
, t
, spc
, flags
, false);
2707 /* Print the dimensions. */
2708 tmp
= TREE_TYPE (t
);
2709 while (TREE_CODE (tmp
) == ARRAY_TYPE
)
2711 dump_array_domain (buffer
, TYPE_DOMAIN (tmp
), spc
, flags
);
2712 tmp
= TREE_TYPE (tmp
);
2715 else if (TREE_CODE (t
) == FUNCTION_DECL
)
2717 dump_generic_node (buffer
, TREE_TYPE (TREE_TYPE (t
)), spc
, flags
, false);
2719 dump_decl_name (buffer
, t
, flags
);
2720 dump_function_declaration (buffer
, TREE_TYPE (t
), spc
, flags
);
2724 /* Print type declaration. */
2725 dump_generic_node (buffer
, TREE_TYPE (t
), spc
, flags
, false);
2727 /* Print variable's name. */
2729 dump_generic_node (buffer
, t
, spc
, flags
, false);
2732 if (TREE_CODE (t
) == VAR_DECL
&& DECL_HARD_REGISTER (t
))
2734 pp_string (buffer
, " __asm__ ");
2735 pp_left_paren (buffer
);
2736 dump_generic_node (buffer
, DECL_ASSEMBLER_NAME (t
), spc
, flags
, false);
2737 pp_right_paren (buffer
);
2740 /* The initial value of a function serves to determine whether the function
2741 is declared or defined. So the following does not apply to function
2743 if (TREE_CODE (t
) != FUNCTION_DECL
)
2745 /* Print the initial value. */
2746 if (DECL_INITIAL (t
))
2751 dump_generic_node (buffer
, DECL_INITIAL (t
), spc
, flags
, false);
2755 if (TREE_CODE (t
) == VAR_DECL
&& DECL_HAS_VALUE_EXPR_P (t
))
2757 pp_string (buffer
, " [value-expr: ");
2758 dump_generic_node (buffer
, DECL_VALUE_EXPR (t
), spc
, flags
, false);
2759 pp_right_bracket (buffer
);
2762 pp_semicolon (buffer
);
2766 /* Prints a structure: name, fields, and methods.
2767 FIXME: Still incomplete. */
2770 print_struct_decl (pretty_printer
*buffer
, const_tree node
, int spc
, int flags
)
2772 /* Print the name of the structure. */
2773 if (TYPE_NAME (node
))
2776 if (TREE_CODE (node
) == RECORD_TYPE
)
2777 pp_string (buffer
, "struct ");
2778 else if ((TREE_CODE (node
) == UNION_TYPE
2779 || TREE_CODE (node
) == QUAL_UNION_TYPE
))
2780 pp_string (buffer
, "union ");
2782 dump_generic_node (buffer
, TYPE_NAME (node
), spc
, 0, false);
2785 /* Print the contents of the structure. */
2786 pp_newline (buffer
);
2788 pp_left_brace (buffer
);
2789 pp_newline (buffer
);
2791 /* Print the fields of the structure. */
2794 tmp
= TYPE_FIELDS (node
);
2797 /* Avoid to print recursively the structure. */
2798 /* FIXME : Not implemented correctly...,
2799 what about the case when we have a cycle in the contain graph? ...
2800 Maybe this could be solved by looking at the scope in which the
2801 structure was declared. */
2802 if (TREE_TYPE (tmp
) != node
2803 && (TREE_CODE (TREE_TYPE (tmp
)) != POINTER_TYPE
2804 || TREE_TYPE (TREE_TYPE (tmp
)) != node
))
2806 print_declaration (buffer
, tmp
, spc
+2, flags
);
2807 pp_newline (buffer
);
2809 tmp
= DECL_CHAIN (tmp
);
2813 pp_right_brace (buffer
);
2816 /* Return the priority of the operator CODE.
2818 From lowest to highest precedence with either left-to-right (L-R)
2819 or right-to-left (R-L) associativity]:
2822 2 [R-L] = += -= *= /= %= &= ^= |= <<= >>=
2834 14 [R-L] ! ~ ++ -- + - * & (type) sizeof
2835 15 [L-R] fn() [] -> .
2837 unary +, - and * have higher precedence than the corresponding binary
2841 op_code_prio (enum tree_code code
)
2858 case TRUTH_ORIF_EXPR
:
2861 case TRUTH_AND_EXPR
:
2862 case TRUTH_ANDIF_EXPR
:
2869 case TRUTH_XOR_EXPR
:
2886 case UNORDERED_EXPR
:
2897 case VEC_WIDEN_LSHIFT_HI_EXPR
:
2898 case VEC_WIDEN_LSHIFT_LO_EXPR
:
2899 case WIDEN_LSHIFT_EXPR
:
2902 case WIDEN_SUM_EXPR
:
2904 case POINTER_PLUS_EXPR
:
2908 case VEC_WIDEN_MULT_HI_EXPR
:
2909 case VEC_WIDEN_MULT_LO_EXPR
:
2910 case WIDEN_MULT_EXPR
:
2912 case WIDEN_MULT_PLUS_EXPR
:
2913 case WIDEN_MULT_MINUS_EXPR
:
2915 case MULT_HIGHPART_EXPR
:
2916 case TRUNC_DIV_EXPR
:
2918 case FLOOR_DIV_EXPR
:
2919 case ROUND_DIV_EXPR
:
2921 case EXACT_DIV_EXPR
:
2922 case TRUNC_MOD_EXPR
:
2924 case FLOOR_MOD_EXPR
:
2925 case ROUND_MOD_EXPR
:
2929 case TRUTH_NOT_EXPR
:
2931 case POSTINCREMENT_EXPR
:
2932 case POSTDECREMENT_EXPR
:
2933 case PREINCREMENT_EXPR
:
2934 case PREDECREMENT_EXPR
:
2940 case FIX_TRUNC_EXPR
:
2946 case ARRAY_RANGE_REF
:
2950 /* Special expressions. */
2956 case REDUC_MAX_EXPR
:
2957 case REDUC_MIN_EXPR
:
2958 case REDUC_PLUS_EXPR
:
2959 case VEC_LSHIFT_EXPR
:
2960 case VEC_RSHIFT_EXPR
:
2961 case VEC_UNPACK_HI_EXPR
:
2962 case VEC_UNPACK_LO_EXPR
:
2963 case VEC_UNPACK_FLOAT_HI_EXPR
:
2964 case VEC_UNPACK_FLOAT_LO_EXPR
:
2965 case VEC_PACK_TRUNC_EXPR
:
2966 case VEC_PACK_SAT_EXPR
:
2970 /* Return an arbitrarily high precedence to avoid surrounding single
2971 VAR_DECLs in ()s. */
2976 /* Return the priority of the operator OP. */
2979 op_prio (const_tree op
)
2981 enum tree_code code
;
2986 code
= TREE_CODE (op
);
2987 if (code
== SAVE_EXPR
|| code
== NON_LVALUE_EXPR
)
2988 return op_prio (TREE_OPERAND (op
, 0));
2990 return op_code_prio (code
);
2993 /* Return the symbol associated with operator CODE. */
2996 op_symbol_code (enum tree_code code
)
3004 case TRUTH_ORIF_EXPR
:
3007 case TRUTH_AND_EXPR
:
3008 case TRUTH_ANDIF_EXPR
:
3014 case TRUTH_XOR_EXPR
:
3024 case UNORDERED_EXPR
:
3070 case VEC_LSHIFT_EXPR
:
3073 case VEC_RSHIFT_EXPR
:
3076 case WIDEN_LSHIFT_EXPR
:
3079 case POINTER_PLUS_EXPR
:
3085 case REDUC_PLUS_EXPR
:
3088 case WIDEN_SUM_EXPR
:
3091 case WIDEN_MULT_EXPR
:
3094 case MULT_HIGHPART_EXPR
:
3104 case TRUTH_NOT_EXPR
:
3111 case TRUNC_DIV_EXPR
:
3118 case FLOOR_DIV_EXPR
:
3121 case ROUND_DIV_EXPR
:
3124 case EXACT_DIV_EXPR
:
3127 case TRUNC_MOD_EXPR
:
3133 case FLOOR_MOD_EXPR
:
3136 case ROUND_MOD_EXPR
:
3139 case PREDECREMENT_EXPR
:
3142 case PREINCREMENT_EXPR
:
3145 case POSTDECREMENT_EXPR
:
3148 case POSTINCREMENT_EXPR
:
3158 return "<<< ??? >>>";
3162 /* Return the symbol associated with operator OP. */
3165 op_symbol (const_tree op
)
3167 return op_symbol_code (TREE_CODE (op
));
3170 /* Prints the name of a call. NODE is the CALL_EXPR_FN of a CALL_EXPR or
3171 the gimple_call_fn of a GIMPLE_CALL. */
3174 print_call_name (pretty_printer
*buffer
, tree node
, int flags
)
3178 if (TREE_CODE (op0
) == NON_LVALUE_EXPR
)
3179 op0
= TREE_OPERAND (op0
, 0);
3182 switch (TREE_CODE (op0
))
3187 dump_function_name (buffer
, op0
, flags
);
3193 op0
= TREE_OPERAND (op0
, 0);
3197 pp_left_paren (buffer
);
3198 dump_generic_node (buffer
, TREE_OPERAND (op0
, 0), 0, flags
, false);
3199 pp_string (buffer
, ") ? ");
3200 dump_generic_node (buffer
, TREE_OPERAND (op0
, 1), 0, flags
, false);
3201 pp_string (buffer
, " : ");
3202 dump_generic_node (buffer
, TREE_OPERAND (op0
, 2), 0, flags
, false);
3206 if (TREE_CODE (TREE_OPERAND (op0
, 0)) == VAR_DECL
)
3207 dump_function_name (buffer
, TREE_OPERAND (op0
, 0), flags
);
3209 dump_generic_node (buffer
, op0
, 0, flags
, false);
3213 if (integer_zerop (TREE_OPERAND (op0
, 1)))
3215 op0
= TREE_OPERAND (op0
, 0);
3222 dump_generic_node (buffer
, op0
, 0, flags
, false);
3230 /* Parses the string STR and replaces new-lines by '\n', tabs by '\t', ... */
3233 pretty_print_string (pretty_printer
*buffer
, const char *str
)
3243 pp_string (buffer
, "\\b");
3247 pp_string (buffer
, "\\f");
3251 pp_string (buffer
, "\\n");
3255 pp_string (buffer
, "\\r");
3259 pp_string (buffer
, "\\t");
3263 pp_string (buffer
, "\\v");
3267 pp_string (buffer
, "\\\\");
3271 pp_string (buffer
, "\\\"");
3275 pp_string (buffer
, "\\'");
3278 /* No need to handle \0; the loop terminates on \0. */
3281 pp_string (buffer
, "\\1");
3285 pp_string (buffer
, "\\2");
3289 pp_string (buffer
, "\\3");
3293 pp_string (buffer
, "\\4");
3297 pp_string (buffer
, "\\5");
3301 pp_string (buffer
, "\\6");
3305 pp_string (buffer
, "\\7");
3309 pp_character (buffer
, str
[0]);
3317 maybe_init_pretty_print (FILE *file
)
3321 new (&buffer
) pretty_printer ();
3322 pp_needs_newline (&buffer
) = true;
3323 pp_translate_identifiers (&buffer
) = false;
3327 buffer
.buffer
->stream
= file
;
3331 newline_and_indent (pretty_printer
*buffer
, int spc
)
3333 pp_newline (buffer
);
3337 /* Handle a %K format for TEXT. Separate from default_tree_printer so
3338 it can also be used in front ends.
3339 %K: a statement, from which EXPR_LOCATION and TREE_BLOCK will be recorded.
3343 percent_K_format (text_info
*text
)
3345 tree t
= va_arg (*text
->args_ptr
, tree
), block
;
3346 gcc_assert (text
->locus
!= NULL
);
3347 *text
->locus
= EXPR_LOCATION (t
);
3348 gcc_assert (pp_ti_abstract_origin (text
) != NULL
);
3349 block
= TREE_BLOCK (t
);
3350 *pp_ti_abstract_origin (text
) = NULL
;
3352 && TREE_CODE (block
) == BLOCK
3353 && BLOCK_ABSTRACT_ORIGIN (block
))
3355 tree ao
= BLOCK_ABSTRACT_ORIGIN (block
);
3357 while (TREE_CODE (ao
) == BLOCK
3358 && BLOCK_ABSTRACT_ORIGIN (ao
)
3359 && BLOCK_ABSTRACT_ORIGIN (ao
) != ao
)
3360 ao
= BLOCK_ABSTRACT_ORIGIN (ao
);
3362 if (TREE_CODE (ao
) == FUNCTION_DECL
)
3364 *pp_ti_abstract_origin (text
) = block
;
3367 block
= BLOCK_SUPERCONTEXT (block
);
3371 /* Print the identifier ID to PRETTY-PRINTER. */
3374 pp_tree_identifier (pretty_printer
*pp
, tree id
)
3376 if (pp_translate_identifiers (pp
))
3378 const char *text
= identifier_to_locale (IDENTIFIER_POINTER (id
));
3379 pp_append_text (pp
, text
, text
+ strlen (text
));
3382 pp_append_text (pp
, IDENTIFIER_POINTER (id
),
3383 IDENTIFIER_POINTER (id
) + IDENTIFIER_LENGTH (id
));
3386 /* A helper function that is used to dump function information before the
3390 dump_function_header (FILE *dump_file
, tree fdecl
, int flags
)
3392 const char *dname
, *aname
;
3393 struct cgraph_node
*node
= cgraph_get_node (fdecl
);
3394 struct function
*fun
= DECL_STRUCT_FUNCTION (fdecl
);
3396 dname
= lang_hooks
.decl_printable_name (fdecl
, 2);
3398 if (DECL_ASSEMBLER_NAME_SET_P (fdecl
))
3399 aname
= (IDENTIFIER_POINTER
3400 (DECL_ASSEMBLER_NAME (fdecl
)));
3402 aname
= "<unset-asm-name>";
3404 fprintf (dump_file
, "\n;; Function %s (%s, funcdef_no=%d",
3405 dname
, aname
, fun
->funcdef_no
);
3406 if (!(flags
& TDF_NOUID
))
3407 fprintf (dump_file
, ", decl_uid=%d", DECL_UID (fdecl
));
3410 fprintf (dump_file
, ", symbol_order=%d)%s\n\n", node
->order
,
3411 node
->frequency
== NODE_FREQUENCY_HOT
3413 : node
->frequency
== NODE_FREQUENCY_UNLIKELY_EXECUTED
3414 ? " (unlikely executed)"
3415 : node
->frequency
== NODE_FREQUENCY_EXECUTED_ONCE
3416 ? " (executed once)"
3420 fprintf (dump_file
, ")\n\n");
3423 /* Dump double_int D to pretty_printer PP. UNS is true
3424 if D is unsigned and false otherwise. */
3426 pp_double_int (pretty_printer
*pp
, double_int d
, bool uns
)
3429 pp_wide_integer (pp
, d
.low
);
3430 else if (d
.fits_uhwi ())
3431 pp_unsigned_wide_integer (pp
, d
.low
);
3434 unsigned HOST_WIDE_INT low
= d
.low
;
3435 HOST_WIDE_INT high
= d
.high
;
3436 if (!uns
&& d
.is_negative ())
3439 high
= ~high
+ !low
;
3442 /* Would "%x%0*x" or "%x%*0x" get zero-padding on all
3444 sprintf (pp_buffer (pp
)->digit_buffer
,
3445 HOST_WIDE_INT_PRINT_DOUBLE_HEX
,
3446 (unsigned HOST_WIDE_INT
) high
, low
);
3447 pp_string (pp
, pp_buffer (pp
)->digit_buffer
);