1 /* Pretty formatting of GENERIC trees in C syntax.
2 Copyright (C) 2001-2014 Free Software Foundation, Inc.
3 Adapted from c-pretty-print.c by Diego Novillo <dnovillo@redhat.com>
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 3, or (at your option) any later
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 "stor-layout.h"
28 #include "tree-pretty-print.h"
31 #include "gimple-expr.h"
35 #include "plugin-api.h"
38 #include "hard-reg-set.h"
43 #include "langhooks.h"
44 #include "tree-iterator.h"
45 #include "tree-chrec.h"
47 #include "value-prof.h"
48 #include "wide-int-print.h"
49 #include "internal-fn.h"
51 /* Local functions, macros and variables. */
52 static const char *op_symbol (const_tree
);
53 static void pretty_print_string (pretty_printer
*, const char*);
54 static void newline_and_indent (pretty_printer
*, int);
55 static void maybe_init_pretty_print (FILE *);
56 static void print_struct_decl (pretty_printer
*, const_tree
, int, int);
57 static void do_niy (pretty_printer
*, const_tree
);
59 #define INDENT(SPACE) do { \
60 int i; for (i = 0; i<SPACE; i++) pp_space (pp); } while (0)
62 #define NIY do_niy (pp, node)
64 static pretty_printer
*tree_pp
;
66 /* Try to print something for an unknown tree code. */
69 do_niy (pretty_printer
*pp
, const_tree node
)
73 pp_string (pp
, "<<< Unknown tree: ");
74 pp_string (pp
, get_tree_code_name (TREE_CODE (node
)));
78 len
= TREE_OPERAND_LENGTH (node
);
79 for (i
= 0; i
< len
; ++i
)
81 newline_and_indent (pp
, 2);
82 dump_generic_node (pp
, TREE_OPERAND (node
, i
), 2, 0, false);
86 pp_string (pp
, " >>>");
89 /* Debugging function to print out a generic expression. */
92 debug_generic_expr (tree t
)
94 print_generic_expr (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
);
95 fprintf (stderr
, "\n");
98 /* Debugging function to print out a generic statement. */
101 debug_generic_stmt (tree t
)
103 print_generic_stmt (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
);
104 fprintf (stderr
, "\n");
107 /* Debugging function to print out a chain of trees . */
110 debug_tree_chain (tree t
)
116 print_generic_expr (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
|TDF_UID
);
117 fprintf (stderr
, " ");
121 fprintf (stderr
, "... [cycled back to ");
122 print_generic_expr (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
|TDF_UID
);
123 fprintf (stderr
, "]");
127 fprintf (stderr
, "\n");
130 /* Prints declaration DECL to the FILE with details specified by FLAGS. */
132 print_generic_decl (FILE *file
, tree decl
, int flags
)
134 maybe_init_pretty_print (file
);
135 print_declaration (tree_pp
, decl
, 2, flags
);
136 pp_write_text_to_stream (tree_pp
);
139 /* Print tree T, and its successors, on file FILE. FLAGS specifies details
140 to show in the dump. See TDF_* in dumpfile.h. */
143 print_generic_stmt (FILE *file
, tree t
, int flags
)
145 maybe_init_pretty_print (file
);
146 dump_generic_node (tree_pp
, t
, 0, flags
, true);
147 pp_newline_and_flush (tree_pp
);
150 /* Print tree T, and its successors, on file FILE. FLAGS specifies details
151 to show in the dump. See TDF_* in dumpfile.h. The output is indented by
155 print_generic_stmt_indented (FILE *file
, tree t
, int flags
, int indent
)
159 maybe_init_pretty_print (file
);
161 for (i
= 0; i
< indent
; i
++)
163 dump_generic_node (tree_pp
, t
, indent
, flags
, true);
164 pp_newline_and_flush (tree_pp
);
167 /* Print a single expression T on file FILE. FLAGS specifies details to show
168 in the dump. See TDF_* in dumpfile.h. */
171 print_generic_expr (FILE *file
, tree t
, int flags
)
173 maybe_init_pretty_print (file
);
174 dump_generic_node (tree_pp
, t
, 0, flags
, false);
178 /* Dump the name of a _DECL node and its DECL_UID if TDF_UID is set
182 dump_decl_name (pretty_printer
*pp
, tree node
, int flags
)
184 if (DECL_NAME (node
))
186 if ((flags
& TDF_ASMNAME
) && DECL_ASSEMBLER_NAME_SET_P (node
))
187 pp_tree_identifier (pp
, DECL_ASSEMBLER_NAME (node
));
189 pp_tree_identifier (pp
, DECL_NAME (node
));
191 if ((flags
& TDF_UID
) || DECL_NAME (node
) == NULL_TREE
)
193 if (TREE_CODE (node
) == LABEL_DECL
&& LABEL_DECL_UID (node
) != -1)
194 pp_printf (pp
, "L.%d", (int) LABEL_DECL_UID (node
));
195 else if (TREE_CODE (node
) == DEBUG_EXPR_DECL
)
197 if (flags
& TDF_NOUID
)
198 pp_string (pp
, "D#xxxx");
200 pp_printf (pp
, "D#%i", DEBUG_TEMP_UID (node
));
204 char c
= TREE_CODE (node
) == CONST_DECL
? 'C' : 'D';
205 if (flags
& TDF_NOUID
)
206 pp_printf (pp
, "%c.xxxx", c
);
208 pp_printf (pp
, "%c.%u", c
, DECL_UID (node
));
211 if ((flags
& TDF_ALIAS
) && DECL_PT_UID (node
) != DECL_UID (node
))
213 if (flags
& TDF_NOUID
)
214 pp_printf (pp
, "ptD.xxxx");
216 pp_printf (pp
, "ptD.%u", DECL_PT_UID (node
));
220 /* Like the above, but used for pretty printing function calls. */
223 dump_function_name (pretty_printer
*pp
, tree node
, int flags
)
225 if (CONVERT_EXPR_P (node
))
226 node
= TREE_OPERAND (node
, 0);
227 if (DECL_NAME (node
) && (flags
& TDF_ASMNAME
) == 0)
228 pp_string (pp
, lang_hooks
.decl_printable_name (node
, 1));
230 dump_decl_name (pp
, node
, flags
);
233 /* Dump a function declaration. NODE is the FUNCTION_TYPE. PP, SPC and
234 FLAGS are as in dump_generic_node. */
237 dump_function_declaration (pretty_printer
*pp
, tree node
,
240 bool wrote_arg
= false;
246 /* Print the argument types. */
247 arg
= TYPE_ARG_TYPES (node
);
248 while (arg
&& arg
!= void_list_node
&& arg
!= error_mark_node
)
256 dump_generic_node (pp
, TREE_VALUE (arg
), spc
, flags
, false);
257 arg
= TREE_CHAIN (arg
);
260 /* Drop the trailing void_type_node if we had any previous argument. */
261 if (arg
== void_list_node
&& !wrote_arg
)
262 pp_string (pp
, "void");
263 /* Properly dump vararg function types. */
264 else if (!arg
&& wrote_arg
)
265 pp_string (pp
, ", ...");
266 /* Avoid printing any arg for unprototyped functions. */
271 /* Dump the domain associated with an array. */
274 dump_array_domain (pretty_printer
*pp
, tree domain
, int spc
, int flags
)
276 pp_left_bracket (pp
);
279 tree min
= TYPE_MIN_VALUE (domain
);
280 tree max
= TYPE_MAX_VALUE (domain
);
283 && integer_zerop (min
)
284 && tree_fits_shwi_p (max
))
285 pp_wide_integer (pp
, tree_to_shwi (max
) + 1);
289 dump_generic_node (pp
, min
, spc
, flags
, false);
292 dump_generic_node (pp
, max
, spc
, flags
, false);
296 pp_string (pp
, "<unknown>");
297 pp_right_bracket (pp
);
301 /* Dump OpenMP clause CLAUSE. PP, CLAUSE, SPC and FLAGS are as in
302 dump_generic_node. */
305 dump_omp_clause (pretty_printer
*pp
, tree clause
, int spc
, int flags
)
309 switch (OMP_CLAUSE_CODE (clause
))
311 case OMP_CLAUSE_PRIVATE
:
314 case OMP_CLAUSE_SHARED
:
317 case OMP_CLAUSE_FIRSTPRIVATE
:
318 name
= "firstprivate";
320 case OMP_CLAUSE_LASTPRIVATE
:
321 name
= "lastprivate";
323 case OMP_CLAUSE_COPYIN
:
326 case OMP_CLAUSE_COPYPRIVATE
:
327 name
= "copyprivate";
329 case OMP_CLAUSE_UNIFORM
:
332 case OMP_CLAUSE__LOOPTEMP_
:
336 pp_string (pp
, name
);
338 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
343 case OMP_CLAUSE_REDUCTION
:
344 pp_string (pp
, "reduction(");
345 if (OMP_CLAUSE_REDUCTION_CODE (clause
) != ERROR_MARK
)
348 op_symbol_code (OMP_CLAUSE_REDUCTION_CODE (clause
)));
351 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
357 pp_string (pp
, "if(");
358 dump_generic_node (pp
, OMP_CLAUSE_IF_EXPR (clause
),
363 case OMP_CLAUSE_NUM_THREADS
:
364 pp_string (pp
, "num_threads(");
365 dump_generic_node (pp
, OMP_CLAUSE_NUM_THREADS_EXPR (clause
),
370 case OMP_CLAUSE__CILK_FOR_COUNT_
:
371 pp_string (pp
, "_Cilk_for_count_(");
372 dump_generic_node (pp
, OMP_CLAUSE_OPERAND (clause
, 0),
377 case OMP_CLAUSE_NOWAIT
:
378 pp_string (pp
, "nowait");
380 case OMP_CLAUSE_ORDERED
:
381 pp_string (pp
, "ordered");
384 case OMP_CLAUSE_DEFAULT
:
385 pp_string (pp
, "default(");
386 switch (OMP_CLAUSE_DEFAULT_KIND (clause
))
388 case OMP_CLAUSE_DEFAULT_UNSPECIFIED
:
390 case OMP_CLAUSE_DEFAULT_SHARED
:
391 pp_string (pp
, "shared");
393 case OMP_CLAUSE_DEFAULT_NONE
:
394 pp_string (pp
, "none");
396 case OMP_CLAUSE_DEFAULT_PRIVATE
:
397 pp_string (pp
, "private");
399 case OMP_CLAUSE_DEFAULT_FIRSTPRIVATE
:
400 pp_string (pp
, "firstprivate");
408 case OMP_CLAUSE_SCHEDULE
:
409 pp_string (pp
, "schedule(");
410 switch (OMP_CLAUSE_SCHEDULE_KIND (clause
))
412 case OMP_CLAUSE_SCHEDULE_STATIC
:
413 pp_string (pp
, "static");
415 case OMP_CLAUSE_SCHEDULE_DYNAMIC
:
416 pp_string (pp
, "dynamic");
418 case OMP_CLAUSE_SCHEDULE_GUIDED
:
419 pp_string (pp
, "guided");
421 case OMP_CLAUSE_SCHEDULE_RUNTIME
:
422 pp_string (pp
, "runtime");
424 case OMP_CLAUSE_SCHEDULE_AUTO
:
425 pp_string (pp
, "auto");
427 case OMP_CLAUSE_SCHEDULE_CILKFOR
:
428 pp_string (pp
, "cilk-for grain");
433 if (OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (clause
))
436 dump_generic_node (pp
, OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (clause
),
442 case OMP_CLAUSE_UNTIED
:
443 pp_string (pp
, "untied");
446 case OMP_CLAUSE_COLLAPSE
:
447 pp_string (pp
, "collapse(");
448 dump_generic_node (pp
, OMP_CLAUSE_COLLAPSE_EXPR (clause
),
453 case OMP_CLAUSE_FINAL
:
454 pp_string (pp
, "final(");
455 dump_generic_node (pp
, OMP_CLAUSE_FINAL_EXPR (clause
),
460 case OMP_CLAUSE_MERGEABLE
:
461 pp_string (pp
, "mergeable");
464 case OMP_CLAUSE_LINEAR
:
465 pp_string (pp
, "linear(");
466 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
469 dump_generic_node (pp
, OMP_CLAUSE_LINEAR_STEP (clause
),
474 case OMP_CLAUSE_ALIGNED
:
475 pp_string (pp
, "aligned(");
476 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
478 if (OMP_CLAUSE_ALIGNED_ALIGNMENT (clause
))
481 dump_generic_node (pp
, OMP_CLAUSE_ALIGNED_ALIGNMENT (clause
),
487 case OMP_CLAUSE_DEPEND
:
488 pp_string (pp
, "depend(");
489 switch (OMP_CLAUSE_DEPEND_KIND (clause
))
491 case OMP_CLAUSE_DEPEND_IN
:
492 pp_string (pp
, "in");
494 case OMP_CLAUSE_DEPEND_OUT
:
495 pp_string (pp
, "out");
497 case OMP_CLAUSE_DEPEND_INOUT
:
498 pp_string (pp
, "inout");
504 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
510 pp_string (pp
, "map(");
511 switch (OMP_CLAUSE_MAP_KIND (clause
))
513 case OMP_CLAUSE_MAP_ALLOC
:
514 case OMP_CLAUSE_MAP_POINTER
:
515 pp_string (pp
, "alloc");
517 case OMP_CLAUSE_MAP_TO
:
518 case OMP_CLAUSE_MAP_TO_PSET
:
519 pp_string (pp
, "to");
521 case OMP_CLAUSE_MAP_FROM
:
522 pp_string (pp
, "from");
524 case OMP_CLAUSE_MAP_TOFROM
:
525 pp_string (pp
, "tofrom");
531 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
534 if (OMP_CLAUSE_SIZE (clause
))
536 if (OMP_CLAUSE_CODE (clause
) == OMP_CLAUSE_MAP
537 && OMP_CLAUSE_MAP_KIND (clause
) == OMP_CLAUSE_MAP_POINTER
)
538 pp_string (pp
, " [pointer assign, bias: ");
539 else if (OMP_CLAUSE_CODE (clause
) == OMP_CLAUSE_MAP
540 && OMP_CLAUSE_MAP_KIND (clause
) == OMP_CLAUSE_MAP_TO_PSET
)
541 pp_string (pp
, " [pointer set, len: ");
543 pp_string (pp
, " [len: ");
544 dump_generic_node (pp
, OMP_CLAUSE_SIZE (clause
),
546 pp_right_bracket (pp
);
551 case OMP_CLAUSE_FROM
:
552 pp_string (pp
, "from(");
553 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
555 goto print_clause_size
;
558 pp_string (pp
, "to(");
559 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
561 goto print_clause_size
;
563 case OMP_CLAUSE_NUM_TEAMS
:
564 pp_string (pp
, "num_teams(");
565 dump_generic_node (pp
, OMP_CLAUSE_NUM_TEAMS_EXPR (clause
),
570 case OMP_CLAUSE_THREAD_LIMIT
:
571 pp_string (pp
, "thread_limit(");
572 dump_generic_node (pp
, OMP_CLAUSE_THREAD_LIMIT_EXPR (clause
),
577 case OMP_CLAUSE_DEVICE
:
578 pp_string (pp
, "device(");
579 dump_generic_node (pp
, OMP_CLAUSE_DEVICE_ID (clause
),
584 case OMP_CLAUSE_DIST_SCHEDULE
:
585 pp_string (pp
, "dist_schedule(static");
586 if (OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR (clause
))
589 dump_generic_node (pp
,
590 OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR (clause
),
596 case OMP_CLAUSE_PROC_BIND
:
597 pp_string (pp
, "proc_bind(");
598 switch (OMP_CLAUSE_PROC_BIND_KIND (clause
))
600 case OMP_CLAUSE_PROC_BIND_MASTER
:
601 pp_string (pp
, "master");
603 case OMP_CLAUSE_PROC_BIND_CLOSE
:
604 pp_string (pp
, "close");
606 case OMP_CLAUSE_PROC_BIND_SPREAD
:
607 pp_string (pp
, "spread");
615 case OMP_CLAUSE_SAFELEN
:
616 pp_string (pp
, "safelen(");
617 dump_generic_node (pp
, OMP_CLAUSE_SAFELEN_EXPR (clause
),
622 case OMP_CLAUSE_SIMDLEN
:
623 pp_string (pp
, "simdlen(");
624 dump_generic_node (pp
, OMP_CLAUSE_SIMDLEN_EXPR (clause
),
629 case OMP_CLAUSE__SIMDUID_
:
630 pp_string (pp
, "_simduid_(");
631 dump_generic_node (pp
, OMP_CLAUSE__SIMDUID__DECL (clause
),
636 case OMP_CLAUSE_INBRANCH
:
637 pp_string (pp
, "inbranch");
639 case OMP_CLAUSE_NOTINBRANCH
:
640 pp_string (pp
, "notinbranch");
643 pp_string (pp
, "for");
645 case OMP_CLAUSE_PARALLEL
:
646 pp_string (pp
, "parallel");
648 case OMP_CLAUSE_SECTIONS
:
649 pp_string (pp
, "sections");
651 case OMP_CLAUSE_TASKGROUP
:
652 pp_string (pp
, "taskgroup");
656 /* Should never happen. */
657 dump_generic_node (pp
, clause
, spc
, flags
, false);
663 /* Dump the list of OpenMP clauses. PP, SPC and FLAGS are as in
664 dump_generic_node. */
667 dump_omp_clauses (pretty_printer
*pp
, tree clause
, int spc
, int flags
)
675 dump_omp_clause (pp
, clause
, spc
, flags
);
676 clause
= OMP_CLAUSE_CHAIN (clause
);
684 /* Dump location LOC to PP. */
687 dump_location (pretty_printer
*pp
, location_t loc
)
689 expanded_location xloc
= expand_location (loc
);
691 pp_left_bracket (pp
);
694 pp_string (pp
, xloc
.file
);
697 pp_decimal_int (pp
, xloc
.line
);
699 pp_decimal_int (pp
, xloc
.column
);
700 pp_string (pp
, "] ");
704 /* Dump lexical block BLOCK. PP, SPC and FLAGS are as in
705 dump_generic_node. */
708 dump_block_node (pretty_printer
*pp
, tree block
, int spc
, int flags
)
712 pp_printf (pp
, "BLOCK #%d ", BLOCK_NUMBER (block
));
714 if (flags
& TDF_ADDRESS
)
715 pp_printf (pp
, "[%p] ", (void *) block
);
717 if (BLOCK_ABSTRACT (block
))
718 pp_string (pp
, "[abstract] ");
720 if (TREE_ASM_WRITTEN (block
))
721 pp_string (pp
, "[written] ");
723 if (flags
& TDF_SLIM
)
726 if (BLOCK_SOURCE_LOCATION (block
))
727 dump_location (pp
, BLOCK_SOURCE_LOCATION (block
));
729 newline_and_indent (pp
, spc
+ 2);
731 if (BLOCK_SUPERCONTEXT (block
))
733 pp_string (pp
, "SUPERCONTEXT: ");
734 dump_generic_node (pp
, BLOCK_SUPERCONTEXT (block
), 0,
735 flags
| TDF_SLIM
, false);
736 newline_and_indent (pp
, spc
+ 2);
739 if (BLOCK_SUBBLOCKS (block
))
741 pp_string (pp
, "SUBBLOCKS: ");
742 for (t
= BLOCK_SUBBLOCKS (block
); t
; t
= BLOCK_CHAIN (t
))
744 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
747 newline_and_indent (pp
, spc
+ 2);
750 if (BLOCK_CHAIN (block
))
752 pp_string (pp
, "SIBLINGS: ");
753 for (t
= BLOCK_CHAIN (block
); t
; t
= BLOCK_CHAIN (t
))
755 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
758 newline_and_indent (pp
, spc
+ 2);
761 if (BLOCK_VARS (block
))
763 pp_string (pp
, "VARS: ");
764 for (t
= BLOCK_VARS (block
); t
; t
= TREE_CHAIN (t
))
766 dump_generic_node (pp
, t
, 0, flags
, false);
769 newline_and_indent (pp
, spc
+ 2);
772 if (vec_safe_length (BLOCK_NONLOCALIZED_VARS (block
)) > 0)
775 vec
<tree
, va_gc
> *nlv
= BLOCK_NONLOCALIZED_VARS (block
);
777 pp_string (pp
, "NONLOCALIZED_VARS: ");
778 FOR_EACH_VEC_ELT (*nlv
, i
, t
)
780 dump_generic_node (pp
, t
, 0, flags
, false);
783 newline_and_indent (pp
, spc
+ 2);
786 if (BLOCK_ABSTRACT_ORIGIN (block
))
788 pp_string (pp
, "ABSTRACT_ORIGIN: ");
789 dump_generic_node (pp
, BLOCK_ABSTRACT_ORIGIN (block
), 0,
790 flags
| TDF_SLIM
, false);
791 newline_and_indent (pp
, spc
+ 2);
794 if (BLOCK_FRAGMENT_ORIGIN (block
))
796 pp_string (pp
, "FRAGMENT_ORIGIN: ");
797 dump_generic_node (pp
, BLOCK_FRAGMENT_ORIGIN (block
), 0,
798 flags
| TDF_SLIM
, false);
799 newline_and_indent (pp
, spc
+ 2);
802 if (BLOCK_FRAGMENT_CHAIN (block
))
804 pp_string (pp
, "FRAGMENT_CHAIN: ");
805 for (t
= BLOCK_FRAGMENT_CHAIN (block
); t
; t
= BLOCK_FRAGMENT_CHAIN (t
))
807 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
810 newline_and_indent (pp
, spc
+ 2);
815 /* Dump the node NODE on the pretty_printer PP, SPC spaces of
816 indent. FLAGS specifies details to show in the dump (see TDF_* in
817 dumpfile.h). If IS_STMT is true, the object printed is considered
818 to be a statement and it is terminated by ';' if appropriate. */
821 dump_generic_node (pretty_printer
*pp
, tree node
, int spc
, int flags
,
830 if (node
== NULL_TREE
)
833 is_expr
= EXPR_P (node
);
835 if (is_stmt
&& (flags
& TDF_STMTADDR
))
836 pp_printf (pp
, "<&%p> ", (void *)node
);
838 if ((flags
& TDF_LINENO
) && EXPR_HAS_LOCATION (node
))
839 dump_location (pp
, EXPR_LOCATION (node
));
841 code
= TREE_CODE (node
);
845 pp_string (pp
, "<<< error >>>");
848 case IDENTIFIER_NODE
:
849 pp_tree_identifier (pp
, node
);
853 while (node
&& node
!= error_mark_node
)
855 if (TREE_PURPOSE (node
))
857 dump_generic_node (pp
, TREE_PURPOSE (node
), spc
, flags
, false);
860 dump_generic_node (pp
, TREE_VALUE (node
), spc
, flags
, false);
861 node
= TREE_CHAIN (node
);
862 if (node
&& TREE_CODE (node
) == TREE_LIST
)
871 dump_generic_node (pp
, BINFO_TYPE (node
), spc
, flags
, false);
877 if (TREE_VEC_LENGTH (node
) > 0)
879 size_t len
= TREE_VEC_LENGTH (node
);
880 for (i
= 0; i
< len
- 1; i
++)
882 dump_generic_node (pp
, TREE_VEC_ELT (node
, i
), spc
, flags
,
887 dump_generic_node (pp
, TREE_VEC_ELT (node
, len
- 1), spc
,
894 case POINTER_BOUNDS_TYPE
:
897 case FIXED_POINT_TYPE
:
903 unsigned int quals
= TYPE_QUALS (node
);
904 enum tree_code_class tclass
;
906 if (quals
& TYPE_QUAL_ATOMIC
)
907 pp_string (pp
, "atomic ");
908 if (quals
& TYPE_QUAL_CONST
)
909 pp_string (pp
, "const ");
910 else if (quals
& TYPE_QUAL_VOLATILE
)
911 pp_string (pp
, "volatile ");
912 else if (quals
& TYPE_QUAL_RESTRICT
)
913 pp_string (pp
, "restrict ");
915 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
917 pp_string (pp
, "<address-space-");
918 pp_decimal_int (pp
, TYPE_ADDR_SPACE (node
));
919 pp_string (pp
, "> ");
922 tclass
= TREE_CODE_CLASS (TREE_CODE (node
));
924 if (tclass
== tcc_declaration
)
926 if (DECL_NAME (node
))
927 dump_decl_name (pp
, node
, flags
);
929 pp_string (pp
, "<unnamed type decl>");
931 else if (tclass
== tcc_type
)
933 if (TYPE_NAME (node
))
935 if (TREE_CODE (TYPE_NAME (node
)) == IDENTIFIER_NODE
)
936 pp_tree_identifier (pp
, TYPE_NAME (node
));
937 else if (TREE_CODE (TYPE_NAME (node
)) == TYPE_DECL
938 && DECL_NAME (TYPE_NAME (node
)))
939 dump_decl_name (pp
, TYPE_NAME (node
), flags
);
941 pp_string (pp
, "<unnamed type>");
943 else if (TREE_CODE (node
) == VECTOR_TYPE
)
945 pp_string (pp
, "vector");
947 pp_wide_integer (pp
, TYPE_VECTOR_SUBPARTS (node
));
948 pp_string (pp
, ") ");
949 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
951 else if (TREE_CODE (node
) == INTEGER_TYPE
)
953 if (TYPE_PRECISION (node
) == CHAR_TYPE_SIZE
)
954 pp_string (pp
, (TYPE_UNSIGNED (node
)
957 else if (TYPE_PRECISION (node
) == SHORT_TYPE_SIZE
)
958 pp_string (pp
, (TYPE_UNSIGNED (node
)
961 else if (TYPE_PRECISION (node
) == INT_TYPE_SIZE
)
962 pp_string (pp
, (TYPE_UNSIGNED (node
)
965 else if (TYPE_PRECISION (node
) == LONG_TYPE_SIZE
)
966 pp_string (pp
, (TYPE_UNSIGNED (node
)
969 else if (TYPE_PRECISION (node
) == LONG_LONG_TYPE_SIZE
)
970 pp_string (pp
, (TYPE_UNSIGNED (node
)
971 ? "unsigned long long"
972 : "signed long long"));
973 else if (TYPE_PRECISION (node
) >= CHAR_TYPE_SIZE
974 && exact_log2 (TYPE_PRECISION (node
)) != -1)
976 pp_string (pp
, (TYPE_UNSIGNED (node
) ? "uint" : "int"));
977 pp_decimal_int (pp
, TYPE_PRECISION (node
));
978 pp_string (pp
, "_t");
982 pp_string (pp
, (TYPE_UNSIGNED (node
)
983 ? "<unnamed-unsigned:"
984 : "<unnamed-signed:"));
985 pp_decimal_int (pp
, TYPE_PRECISION (node
));
989 else if (TREE_CODE (node
) == COMPLEX_TYPE
)
991 pp_string (pp
, "__complex__ ");
992 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
994 else if (TREE_CODE (node
) == REAL_TYPE
)
996 pp_string (pp
, "<float:");
997 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1000 else if (TREE_CODE (node
) == FIXED_POINT_TYPE
)
1002 pp_string (pp
, "<fixed-point-");
1003 pp_string (pp
, TYPE_SATURATING (node
) ? "sat:" : "nonsat:");
1004 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1007 else if (TREE_CODE (node
) == VOID_TYPE
)
1008 pp_string (pp
, "void");
1010 pp_string (pp
, "<unnamed type>");
1016 case REFERENCE_TYPE
:
1017 str
= (TREE_CODE (node
) == POINTER_TYPE
? "*" : "&");
1019 if (TREE_TYPE (node
) == NULL
)
1021 pp_string (pp
, str
);
1022 pp_string (pp
, "<null type>");
1024 else if (TREE_CODE (TREE_TYPE (node
)) == FUNCTION_TYPE
)
1026 tree fnode
= TREE_TYPE (node
);
1028 dump_generic_node (pp
, TREE_TYPE (fnode
), spc
, flags
, false);
1031 pp_string (pp
, str
);
1032 if (TYPE_NAME (node
) && DECL_NAME (TYPE_NAME (node
)))
1033 dump_decl_name (pp
, TYPE_NAME (node
), flags
);
1034 else if (flags
& TDF_NOUID
)
1035 pp_printf (pp
, "<Txxxx>");
1037 pp_printf (pp
, "<T%x>", TYPE_UID (node
));
1039 pp_right_paren (pp
);
1040 dump_function_declaration (pp
, fnode
, spc
, flags
);
1044 unsigned int quals
= TYPE_QUALS (node
);
1046 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1048 pp_string (pp
, str
);
1050 if (quals
& TYPE_QUAL_CONST
)
1051 pp_string (pp
, " const");
1052 if (quals
& TYPE_QUAL_VOLATILE
)
1053 pp_string (pp
, " volatile");
1054 if (quals
& TYPE_QUAL_RESTRICT
)
1055 pp_string (pp
, " restrict");
1057 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
1059 pp_string (pp
, " <address-space-");
1060 pp_decimal_int (pp
, TYPE_ADDR_SPACE (node
));
1064 if (TYPE_REF_CAN_ALIAS_ALL (node
))
1065 pp_string (pp
, " {ref-all}");
1075 if (integer_zerop (TREE_OPERAND (node
, 1))
1076 /* Dump the types of INTEGER_CSTs explicitly, for we can't
1077 infer them and MEM_ATTR caching will share MEM_REFs
1078 with differently-typed op0s. */
1079 && TREE_CODE (TREE_OPERAND (node
, 0)) != INTEGER_CST
1080 /* Released SSA_NAMES have no TREE_TYPE. */
1081 && TREE_TYPE (TREE_OPERAND (node
, 0)) != NULL_TREE
1082 /* Same pointer types, but ignoring POINTER_TYPE vs.
1084 && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 0)))
1085 == TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 1))))
1086 && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (node
, 0)))
1087 == TYPE_MODE (TREE_TYPE (TREE_OPERAND (node
, 1))))
1088 && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node
, 0)))
1089 == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node
, 1))))
1090 /* Same value types ignoring qualifiers. */
1091 && (TYPE_MAIN_VARIANT (TREE_TYPE (node
))
1092 == TYPE_MAIN_VARIANT
1093 (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 1)))))
1094 && (!(flags
& TDF_ALIAS
)
1095 || MR_DEPENDENCE_CLIQUE (node
) == 0))
1097 if (TREE_CODE (TREE_OPERAND (node
, 0)) != ADDR_EXPR
)
1100 dump_generic_node (pp
, TREE_OPERAND (node
, 0),
1104 dump_generic_node (pp
,
1105 TREE_OPERAND (TREE_OPERAND (node
, 0), 0),
1112 pp_string (pp
, "MEM[");
1114 ptype
= TYPE_MAIN_VARIANT (TREE_TYPE (TREE_OPERAND (node
, 1)));
1115 dump_generic_node (pp
, ptype
,
1116 spc
, flags
| TDF_SLIM
, false);
1117 pp_right_paren (pp
);
1118 dump_generic_node (pp
, TREE_OPERAND (node
, 0),
1120 if (!integer_zerop (TREE_OPERAND (node
, 1)))
1122 pp_string (pp
, " + ");
1123 dump_generic_node (pp
, TREE_OPERAND (node
, 1),
1126 if ((flags
& TDF_ALIAS
)
1127 && MR_DEPENDENCE_CLIQUE (node
) != 0)
1129 pp_string (pp
, " clique ");
1130 pp_unsigned_wide_integer (pp
, MR_DEPENDENCE_CLIQUE (node
));
1131 pp_string (pp
, " base ");
1132 pp_unsigned_wide_integer (pp
, MR_DEPENDENCE_BASE (node
));
1134 pp_right_bracket (pp
);
1139 case TARGET_MEM_REF
:
1141 const char *sep
= "";
1144 pp_string (pp
, "MEM[");
1146 if (TREE_CODE (TMR_BASE (node
)) == ADDR_EXPR
)
1148 pp_string (pp
, sep
);
1150 pp_string (pp
, "symbol: ");
1151 dump_generic_node (pp
, TREE_OPERAND (TMR_BASE (node
), 0),
1156 pp_string (pp
, sep
);
1158 pp_string (pp
, "base: ");
1159 dump_generic_node (pp
, TMR_BASE (node
), spc
, flags
, false);
1161 tmp
= TMR_INDEX2 (node
);
1164 pp_string (pp
, sep
);
1166 pp_string (pp
, "base: ");
1167 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1169 tmp
= TMR_INDEX (node
);
1172 pp_string (pp
, sep
);
1174 pp_string (pp
, "index: ");
1175 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1177 tmp
= TMR_STEP (node
);
1180 pp_string (pp
, sep
);
1182 pp_string (pp
, "step: ");
1183 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1185 tmp
= TMR_OFFSET (node
);
1188 pp_string (pp
, sep
);
1190 pp_string (pp
, "offset: ");
1191 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1193 pp_right_bracket (pp
);
1201 /* Print the innermost component type. */
1202 for (tmp
= TREE_TYPE (node
); TREE_CODE (tmp
) == ARRAY_TYPE
;
1203 tmp
= TREE_TYPE (tmp
))
1205 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1207 /* Print the dimensions. */
1208 for (tmp
= node
; TREE_CODE (tmp
) == ARRAY_TYPE
; tmp
= TREE_TYPE (tmp
))
1209 dump_array_domain (pp
, TYPE_DOMAIN (tmp
), spc
, flags
);
1215 case QUAL_UNION_TYPE
:
1217 unsigned int quals
= TYPE_QUALS (node
);
1219 if (quals
& TYPE_QUAL_ATOMIC
)
1220 pp_string (pp
, "atomic ");
1221 if (quals
& TYPE_QUAL_CONST
)
1222 pp_string (pp
, "const ");
1223 if (quals
& TYPE_QUAL_VOLATILE
)
1224 pp_string (pp
, "volatile ");
1226 /* Print the name of the structure. */
1227 if (TREE_CODE (node
) == RECORD_TYPE
)
1228 pp_string (pp
, "struct ");
1229 else if (TREE_CODE (node
) == UNION_TYPE
)
1230 pp_string (pp
, "union ");
1232 if (TYPE_NAME (node
))
1233 dump_generic_node (pp
, TYPE_NAME (node
), spc
, flags
, false);
1234 else if (!(flags
& TDF_SLIM
))
1235 /* FIXME: If we eliminate the 'else' above and attempt
1236 to show the fields for named types, we may get stuck
1237 following a cycle of pointers to structs. The alleged
1238 self-reference check in print_struct_decl will not detect
1239 cycles involving more than one pointer or struct type. */
1240 print_struct_decl (pp
, node
, spc
, flags
);
1249 if (TREE_CODE (TREE_TYPE (node
)) == POINTER_TYPE
)
1251 /* In the case of a pointer, one may want to divide by the
1252 size of the pointed-to type. Unfortunately, this not
1253 straightforward. The C front-end maps expressions
1258 in such a way that the two INTEGER_CST nodes for "5" have
1259 different values but identical types. In the latter
1260 case, the 5 is multiplied by sizeof (int) in c-common.c
1261 (pointer_int_sum) to convert it to a byte address, and
1262 yet the type of the node is left unchanged. Argh. What
1263 is consistent though is that the number value corresponds
1264 to bytes (UNITS) offset.
1266 NB: Neither of the following divisors can be trivially
1267 used to recover the original literal:
1269 TREE_INT_CST_LOW (TYPE_SIZE_UNIT (TREE_TYPE (node)))
1270 TYPE_PRECISION (TREE_TYPE (TREE_TYPE (node))) */
1271 pp_wide_integer (pp
, TREE_INT_CST_LOW (node
));
1272 pp_string (pp
, "B"); /* pseudo-unit */
1274 else if (tree_fits_shwi_p (node
))
1275 pp_wide_integer (pp
, tree_to_shwi (node
));
1276 else if (tree_fits_uhwi_p (node
))
1277 pp_unsigned_wide_integer (pp
, tree_to_uhwi (node
));
1280 wide_int val
= node
;
1282 if (wi::neg_p (val
, TYPE_SIGN (TREE_TYPE (node
))))
1287 print_hex (val
, pp_buffer (pp
)->digit_buffer
);
1288 pp_string (pp
, pp_buffer (pp
)->digit_buffer
);
1290 if (TREE_OVERFLOW (node
))
1291 pp_string (pp
, "(OVF)");
1295 /* Code copied from print_node. */
1298 if (TREE_OVERFLOW (node
))
1299 pp_string (pp
, " overflow");
1301 #if !defined(REAL_IS_NOT_DOUBLE) || defined(REAL_ARITHMETIC)
1302 d
= TREE_REAL_CST (node
);
1303 if (REAL_VALUE_ISINF (d
))
1304 pp_string (pp
, REAL_VALUE_NEGATIVE (d
) ? " -Inf" : " Inf");
1305 else if (REAL_VALUE_ISNAN (d
))
1306 pp_string (pp
, " Nan");
1310 real_to_decimal (string
, &d
, sizeof (string
), 0, 1);
1311 pp_string (pp
, string
);
1316 unsigned char *p
= (unsigned char *) &TREE_REAL_CST (node
);
1317 pp_string (pp
, "0x");
1318 for (i
= 0; i
< sizeof TREE_REAL_CST (node
); i
++)
1319 output_formatted_integer (pp
, "%02x", *p
++);
1328 fixed_to_decimal (string
, TREE_FIXED_CST_PTR (node
), sizeof (string
));
1329 pp_string (pp
, string
);
1334 pp_string (pp
, "__complex__ (");
1335 dump_generic_node (pp
, TREE_REALPART (node
), spc
, flags
, false);
1336 pp_string (pp
, ", ");
1337 dump_generic_node (pp
, TREE_IMAGPART (node
), spc
, flags
, false);
1338 pp_right_paren (pp
);
1342 pp_string (pp
, "\"");
1343 pretty_print_string (pp
, TREE_STRING_POINTER (node
));
1344 pp_string (pp
, "\"");
1350 pp_string (pp
, "{ ");
1351 for (i
= 0; i
< VECTOR_CST_NELTS (node
); ++i
)
1354 pp_string (pp
, ", ");
1355 dump_generic_node (pp
, VECTOR_CST_ELT (node
, i
),
1358 pp_string (pp
, " }");
1364 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1366 if (TREE_CODE (node
) == METHOD_TYPE
)
1368 if (TYPE_METHOD_BASETYPE (node
))
1369 dump_decl_name (pp
, TYPE_NAME (TYPE_METHOD_BASETYPE (node
)),
1372 pp_string (pp
, "<null method basetype>");
1373 pp_colon_colon (pp
);
1375 if (TYPE_NAME (node
) && DECL_NAME (TYPE_NAME (node
)))
1376 dump_decl_name (pp
, TYPE_NAME (node
), flags
);
1377 else if (flags
& TDF_NOUID
)
1378 pp_printf (pp
, "<Txxxx>");
1380 pp_printf (pp
, "<T%x>", TYPE_UID (node
));
1381 dump_function_declaration (pp
, node
, spc
, flags
);
1386 dump_decl_name (pp
, node
, flags
);
1390 if (DECL_NAME (node
))
1391 dump_decl_name (pp
, node
, flags
);
1392 else if (LABEL_DECL_UID (node
) != -1)
1393 pp_printf (pp
, "<L%d>", (int) LABEL_DECL_UID (node
));
1396 if (flags
& TDF_NOUID
)
1397 pp_string (pp
, "<D.xxxx>");
1399 pp_printf (pp
, "<D.%u>", DECL_UID (node
));
1404 if (DECL_IS_BUILTIN (node
))
1406 /* Don't print the declaration of built-in types. */
1409 if (DECL_NAME (node
))
1410 dump_decl_name (pp
, node
, flags
);
1411 else if (TYPE_NAME (TREE_TYPE (node
)) != node
)
1413 if ((TREE_CODE (TREE_TYPE (node
)) == RECORD_TYPE
1414 || TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
)
1415 && TYPE_METHODS (TREE_TYPE (node
)))
1417 /* The type is a c++ class: all structures have at least
1419 pp_string (pp
, "class ");
1420 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1425 (TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
1426 ? "union" : "struct "));
1427 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1431 pp_string (pp
, "<anon>");
1437 case DEBUG_EXPR_DECL
:
1438 case NAMESPACE_DECL
:
1440 dump_decl_name (pp
, node
, flags
);
1444 pp_string (pp
, "<retval>");
1448 op0
= TREE_OPERAND (node
, 0);
1451 && (TREE_CODE (op0
) == INDIRECT_REF
1452 || (TREE_CODE (op0
) == MEM_REF
1453 && TREE_CODE (TREE_OPERAND (op0
, 0)) != ADDR_EXPR
1454 && integer_zerop (TREE_OPERAND (op0
, 1))
1455 /* Dump the types of INTEGER_CSTs explicitly, for we
1456 can't infer them and MEM_ATTR caching will share
1457 MEM_REFs with differently-typed op0s. */
1458 && TREE_CODE (TREE_OPERAND (op0
, 0)) != INTEGER_CST
1459 /* Released SSA_NAMES have no TREE_TYPE. */
1460 && TREE_TYPE (TREE_OPERAND (op0
, 0)) != NULL_TREE
1461 /* Same pointer types, but ignoring POINTER_TYPE vs.
1463 && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 0)))
1464 == TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 1))))
1465 && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0
, 0)))
1466 == TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0
, 1))))
1467 && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0
, 0)))
1468 == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0
, 1))))
1469 /* Same value types ignoring qualifiers. */
1470 && (TYPE_MAIN_VARIANT (TREE_TYPE (op0
))
1471 == TYPE_MAIN_VARIANT
1472 (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 1)))))
1473 && MR_DEPENDENCE_CLIQUE (op0
) == 0)))
1475 op0
= TREE_OPERAND (op0
, 0);
1478 if (op_prio (op0
) < op_prio (node
))
1480 dump_generic_node (pp
, op0
, spc
, flags
, false);
1481 if (op_prio (op0
) < op_prio (node
))
1482 pp_right_paren (pp
);
1483 pp_string (pp
, str
);
1484 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1485 op0
= component_ref_field_offset (node
);
1486 if (op0
&& TREE_CODE (op0
) != INTEGER_CST
)
1488 pp_string (pp
, "{off: ");
1489 dump_generic_node (pp
, op0
, spc
, flags
, false);
1490 pp_right_brace (pp
);
1495 pp_string (pp
, "BIT_FIELD_REF <");
1496 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1497 pp_string (pp
, ", ");
1498 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1499 pp_string (pp
, ", ");
1500 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
1505 case ARRAY_RANGE_REF
:
1506 op0
= TREE_OPERAND (node
, 0);
1507 if (op_prio (op0
) < op_prio (node
))
1509 dump_generic_node (pp
, op0
, spc
, flags
, false);
1510 if (op_prio (op0
) < op_prio (node
))
1511 pp_right_paren (pp
);
1512 pp_left_bracket (pp
);
1513 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1514 if (TREE_CODE (node
) == ARRAY_RANGE_REF
)
1515 pp_string (pp
, " ...");
1516 pp_right_bracket (pp
);
1518 op0
= array_ref_low_bound (node
);
1519 op1
= array_ref_element_size (node
);
1521 if (!integer_zerop (op0
)
1522 || TREE_OPERAND (node
, 2)
1523 || TREE_OPERAND (node
, 3))
1525 pp_string (pp
, "{lb: ");
1526 dump_generic_node (pp
, op0
, spc
, flags
, false);
1527 pp_string (pp
, " sz: ");
1528 dump_generic_node (pp
, op1
, spc
, flags
, false);
1529 pp_right_brace (pp
);
1535 unsigned HOST_WIDE_INT ix
;
1537 bool is_struct_init
= false;
1538 bool is_array_init
= false;
1541 if (TREE_CLOBBER_P (node
))
1542 pp_string (pp
, "CLOBBER");
1543 else if (TREE_CODE (TREE_TYPE (node
)) == RECORD_TYPE
1544 || TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
)
1545 is_struct_init
= true;
1546 else if (TREE_CODE (TREE_TYPE (node
)) == ARRAY_TYPE
1547 && TYPE_DOMAIN (TREE_TYPE (node
))
1548 && TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
)))
1549 && TREE_CODE (TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
))))
1552 tree minv
= TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
)));
1553 is_array_init
= true;
1554 curidx
= wi::to_widest (minv
);
1556 FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (node
), ix
, field
, val
)
1563 dump_generic_node (pp
, field
, spc
, flags
, false);
1566 else if (is_array_init
1567 && (TREE_CODE (field
) != INTEGER_CST
1568 || curidx
!= wi::to_widest (field
)))
1570 pp_left_bracket (pp
);
1571 if (TREE_CODE (field
) == RANGE_EXPR
)
1573 dump_generic_node (pp
, TREE_OPERAND (field
, 0), spc
,
1575 pp_string (pp
, " ... ");
1576 dump_generic_node (pp
, TREE_OPERAND (field
, 1), spc
,
1578 if (TREE_CODE (TREE_OPERAND (field
, 1)) == INTEGER_CST
)
1579 curidx
= wi::to_widest (TREE_OPERAND (field
, 1));
1582 dump_generic_node (pp
, field
, spc
, flags
, false);
1583 if (TREE_CODE (field
) == INTEGER_CST
)
1584 curidx
= wi::to_widest (field
);
1585 pp_string (pp
, "]=");
1590 if (val
&& TREE_CODE (val
) == ADDR_EXPR
)
1591 if (TREE_CODE (TREE_OPERAND (val
, 0)) == FUNCTION_DECL
)
1592 val
= TREE_OPERAND (val
, 0);
1593 if (val
&& TREE_CODE (val
) == FUNCTION_DECL
)
1594 dump_decl_name (pp
, val
, flags
);
1596 dump_generic_node (pp
, val
, spc
, flags
, false);
1597 if (ix
!= vec_safe_length (CONSTRUCTOR_ELTS (node
)) - 1)
1603 pp_right_brace (pp
);
1610 if (flags
& TDF_SLIM
)
1612 pp_string (pp
, "<COMPOUND_EXPR>");
1616 dump_generic_node (pp
, TREE_OPERAND (node
, 0),
1617 spc
, flags
, !(flags
& TDF_SLIM
));
1618 if (flags
& TDF_SLIM
)
1619 newline_and_indent (pp
, spc
);
1626 for (tp
= &TREE_OPERAND (node
, 1);
1627 TREE_CODE (*tp
) == COMPOUND_EXPR
;
1628 tp
= &TREE_OPERAND (*tp
, 1))
1630 dump_generic_node (pp
, TREE_OPERAND (*tp
, 0),
1631 spc
, flags
, !(flags
& TDF_SLIM
));
1632 if (flags
& TDF_SLIM
)
1633 newline_and_indent (pp
, spc
);
1641 dump_generic_node (pp
, *tp
, spc
, flags
, !(flags
& TDF_SLIM
));
1645 case STATEMENT_LIST
:
1647 tree_stmt_iterator si
;
1650 if (flags
& TDF_SLIM
)
1652 pp_string (pp
, "<STATEMENT_LIST>");
1656 for (si
= tsi_start (node
); !tsi_end_p (si
); tsi_next (&si
))
1659 newline_and_indent (pp
, spc
);
1662 dump_generic_node (pp
, tsi_stmt (si
), spc
, flags
, true);
1669 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
,
1674 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
,
1679 pp_string (pp
, "TARGET_EXPR <");
1680 dump_generic_node (pp
, TARGET_EXPR_SLOT (node
), spc
, flags
, false);
1683 dump_generic_node (pp
, TARGET_EXPR_INITIAL (node
), spc
, flags
, false);
1688 print_declaration (pp
, DECL_EXPR_DECL (node
), spc
, flags
);
1693 if (TREE_TYPE (node
) == NULL
|| TREE_TYPE (node
) == void_type_node
)
1695 pp_string (pp
, "if (");
1696 dump_generic_node (pp
, COND_EXPR_COND (node
), spc
, flags
, false);
1697 pp_right_paren (pp
);
1698 /* The lowered cond_exprs should always be printed in full. */
1699 if (COND_EXPR_THEN (node
)
1700 && (IS_EMPTY_STMT (COND_EXPR_THEN (node
))
1701 || TREE_CODE (COND_EXPR_THEN (node
)) == GOTO_EXPR
)
1702 && COND_EXPR_ELSE (node
)
1703 && (IS_EMPTY_STMT (COND_EXPR_ELSE (node
))
1704 || TREE_CODE (COND_EXPR_ELSE (node
)) == GOTO_EXPR
))
1707 dump_generic_node (pp
, COND_EXPR_THEN (node
),
1709 if (!IS_EMPTY_STMT (COND_EXPR_ELSE (node
)))
1711 pp_string (pp
, " else ");
1712 dump_generic_node (pp
, COND_EXPR_ELSE (node
),
1716 else if (!(flags
& TDF_SLIM
))
1718 /* Output COND_EXPR_THEN. */
1719 if (COND_EXPR_THEN (node
))
1721 newline_and_indent (pp
, spc
+2);
1723 newline_and_indent (pp
, spc
+4);
1724 dump_generic_node (pp
, COND_EXPR_THEN (node
), spc
+4,
1726 newline_and_indent (pp
, spc
+2);
1727 pp_right_brace (pp
);
1730 /* Output COND_EXPR_ELSE. */
1731 if (COND_EXPR_ELSE (node
)
1732 && !IS_EMPTY_STMT (COND_EXPR_ELSE (node
)))
1734 newline_and_indent (pp
, spc
);
1735 pp_string (pp
, "else");
1736 newline_and_indent (pp
, spc
+2);
1738 newline_and_indent (pp
, spc
+4);
1739 dump_generic_node (pp
, COND_EXPR_ELSE (node
), spc
+4,
1741 newline_and_indent (pp
, spc
+2);
1742 pp_right_brace (pp
);
1749 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1753 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1757 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
1763 if (!(flags
& TDF_SLIM
))
1765 if (BIND_EXPR_VARS (node
))
1769 for (op0
= BIND_EXPR_VARS (node
); op0
; op0
= DECL_CHAIN (op0
))
1771 print_declaration (pp
, op0
, spc
+2, flags
);
1776 newline_and_indent (pp
, spc
+2);
1777 dump_generic_node (pp
, BIND_EXPR_BODY (node
), spc
+2, flags
, true);
1778 newline_and_indent (pp
, spc
);
1779 pp_right_brace (pp
);
1785 if (CALL_EXPR_FN (node
) != NULL_TREE
)
1786 print_call_name (pp
, CALL_EXPR_FN (node
), flags
);
1788 pp_string (pp
, internal_fn_name (CALL_EXPR_IFN (node
)));
1790 /* Print parameters. */
1795 call_expr_arg_iterator iter
;
1796 FOR_EACH_CALL_EXPR_ARG (arg
, iter
, node
)
1798 dump_generic_node (pp
, arg
, spc
, flags
, false);
1799 if (more_call_expr_args_p (&iter
))
1806 if (CALL_EXPR_VA_ARG_PACK (node
))
1808 if (call_expr_nargs (node
) > 0)
1813 pp_string (pp
, "__builtin_va_arg_pack ()");
1815 pp_right_paren (pp
);
1817 op1
= CALL_EXPR_STATIC_CHAIN (node
);
1820 pp_string (pp
, " [static-chain: ");
1821 dump_generic_node (pp
, op1
, spc
, flags
, false);
1822 pp_right_bracket (pp
);
1825 if (CALL_EXPR_RETURN_SLOT_OPT (node
))
1826 pp_string (pp
, " [return slot optimization]");
1827 if (CALL_EXPR_TAILCALL (node
))
1828 pp_string (pp
, " [tail call]");
1831 case WITH_CLEANUP_EXPR
:
1835 case CLEANUP_POINT_EXPR
:
1836 pp_string (pp
, "<<cleanup_point ");
1837 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1838 pp_string (pp
, ">>");
1841 case PLACEHOLDER_EXPR
:
1842 pp_string (pp
, "<PLACEHOLDER_EXPR ");
1843 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1847 /* Binary arithmetic and logic expressions. */
1848 case WIDEN_SUM_EXPR
:
1849 case WIDEN_MULT_EXPR
:
1851 case MULT_HIGHPART_EXPR
:
1853 case POINTER_PLUS_EXPR
:
1855 case TRUNC_DIV_EXPR
:
1857 case FLOOR_DIV_EXPR
:
1858 case ROUND_DIV_EXPR
:
1859 case TRUNC_MOD_EXPR
:
1861 case FLOOR_MOD_EXPR
:
1862 case ROUND_MOD_EXPR
:
1864 case EXACT_DIV_EXPR
:
1869 case WIDEN_LSHIFT_EXPR
:
1873 case TRUTH_ANDIF_EXPR
:
1874 case TRUTH_ORIF_EXPR
:
1875 case TRUTH_AND_EXPR
:
1877 case TRUTH_XOR_EXPR
:
1891 case UNORDERED_EXPR
:
1893 const char *op
= op_symbol (node
);
1894 op0
= TREE_OPERAND (node
, 0);
1895 op1
= TREE_OPERAND (node
, 1);
1897 /* When the operands are expressions with less priority,
1898 keep semantics of the tree representation. */
1899 if (op_prio (op0
) <= op_prio (node
))
1902 dump_generic_node (pp
, op0
, spc
, flags
, false);
1903 pp_right_paren (pp
);
1906 dump_generic_node (pp
, op0
, spc
, flags
, false);
1912 /* When the operands are expressions with less priority,
1913 keep semantics of the tree representation. */
1914 if (op_prio (op1
) <= op_prio (node
))
1917 dump_generic_node (pp
, op1
, spc
, flags
, false);
1918 pp_right_paren (pp
);
1921 dump_generic_node (pp
, op1
, spc
, flags
, false);
1925 /* Unary arithmetic and logic expressions. */
1928 case TRUTH_NOT_EXPR
:
1930 case PREDECREMENT_EXPR
:
1931 case PREINCREMENT_EXPR
:
1933 if (TREE_CODE (node
) == ADDR_EXPR
1934 && (TREE_CODE (TREE_OPERAND (node
, 0)) == STRING_CST
1935 || TREE_CODE (TREE_OPERAND (node
, 0)) == FUNCTION_DECL
))
1936 ; /* Do not output '&' for strings and function pointers. */
1938 pp_string (pp
, op_symbol (node
));
1940 if (op_prio (TREE_OPERAND (node
, 0)) < op_prio (node
))
1943 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1944 pp_right_paren (pp
);
1947 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1950 case POSTDECREMENT_EXPR
:
1951 case POSTINCREMENT_EXPR
:
1952 if (op_prio (TREE_OPERAND (node
, 0)) < op_prio (node
))
1955 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1956 pp_right_paren (pp
);
1959 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1960 pp_string (pp
, op_symbol (node
));
1964 pp_string (pp
, "MIN_EXPR <");
1965 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1966 pp_string (pp
, ", ");
1967 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1972 pp_string (pp
, "MAX_EXPR <");
1973 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1974 pp_string (pp
, ", ");
1975 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1980 pp_string (pp
, "ABS_EXPR <");
1981 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1989 case ADDR_SPACE_CONVERT_EXPR
:
1990 case FIXED_CONVERT_EXPR
:
1991 case FIX_TRUNC_EXPR
:
1994 type
= TREE_TYPE (node
);
1995 op0
= TREE_OPERAND (node
, 0);
1996 if (type
!= TREE_TYPE (op0
))
1999 dump_generic_node (pp
, type
, spc
, flags
, false);
2000 pp_string (pp
, ") ");
2002 if (op_prio (op0
) < op_prio (node
))
2004 dump_generic_node (pp
, op0
, spc
, flags
, false);
2005 if (op_prio (op0
) < op_prio (node
))
2006 pp_right_paren (pp
);
2009 case VIEW_CONVERT_EXPR
:
2010 pp_string (pp
, "VIEW_CONVERT_EXPR<");
2011 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2012 pp_string (pp
, ">(");
2013 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2014 pp_right_paren (pp
);
2018 pp_string (pp
, "((");
2019 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2020 pp_string (pp
, "))");
2023 case NON_LVALUE_EXPR
:
2024 pp_string (pp
, "NON_LVALUE_EXPR <");
2025 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2030 pp_string (pp
, "SAVE_EXPR <");
2031 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2036 pp_string (pp
, "COMPLEX_EXPR <");
2037 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2038 pp_string (pp
, ", ");
2039 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2044 pp_string (pp
, "CONJ_EXPR <");
2045 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2050 pp_string (pp
, "REALPART_EXPR <");
2051 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2056 pp_string (pp
, "IMAGPART_EXPR <");
2057 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2062 pp_string (pp
, "VA_ARG_EXPR <");
2063 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2067 case TRY_FINALLY_EXPR
:
2068 case TRY_CATCH_EXPR
:
2069 pp_string (pp
, "try");
2070 newline_and_indent (pp
, spc
+2);
2072 newline_and_indent (pp
, spc
+4);
2073 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
+4, flags
, true);
2074 newline_and_indent (pp
, spc
+2);
2075 pp_right_brace (pp
);
2076 newline_and_indent (pp
, spc
);
2078 (TREE_CODE (node
) == TRY_CATCH_EXPR
) ? "catch" : "finally");
2079 newline_and_indent (pp
, spc
+2);
2081 newline_and_indent (pp
, spc
+4);
2082 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
+4, flags
, true);
2083 newline_and_indent (pp
, spc
+2);
2084 pp_right_brace (pp
);
2089 pp_string (pp
, "catch (");
2090 dump_generic_node (pp
, CATCH_TYPES (node
), spc
+2, flags
, false);
2091 pp_right_paren (pp
);
2092 newline_and_indent (pp
, spc
+2);
2094 newline_and_indent (pp
, spc
+4);
2095 dump_generic_node (pp
, CATCH_BODY (node
), spc
+4, flags
, true);
2096 newline_and_indent (pp
, spc
+2);
2097 pp_right_brace (pp
);
2101 case EH_FILTER_EXPR
:
2102 pp_string (pp
, "<<<eh_filter (");
2103 dump_generic_node (pp
, EH_FILTER_TYPES (node
), spc
+2, flags
, false);
2104 pp_string (pp
, ")>>>");
2105 newline_and_indent (pp
, spc
+2);
2107 newline_and_indent (pp
, spc
+4);
2108 dump_generic_node (pp
, EH_FILTER_FAILURE (node
), spc
+4, flags
, true);
2109 newline_and_indent (pp
, spc
+2);
2110 pp_right_brace (pp
);
2115 op0
= TREE_OPERAND (node
, 0);
2116 /* If this is for break or continue, don't bother printing it. */
2117 if (DECL_NAME (op0
))
2119 const char *name
= IDENTIFIER_POINTER (DECL_NAME (op0
));
2120 if (strcmp (name
, "break") == 0
2121 || strcmp (name
, "continue") == 0)
2124 dump_generic_node (pp
, op0
, spc
, flags
, false);
2126 if (DECL_NONLOCAL (op0
))
2127 pp_string (pp
, " [non-local]");
2131 pp_string (pp
, "while (1)");
2132 if (!(flags
& TDF_SLIM
))
2134 newline_and_indent (pp
, spc
+2);
2136 newline_and_indent (pp
, spc
+4);
2137 dump_generic_node (pp
, LOOP_EXPR_BODY (node
), spc
+4, flags
, true);
2138 newline_and_indent (pp
, spc
+2);
2139 pp_right_brace (pp
);
2145 pp_string (pp
, "// predicted ");
2146 if (PREDICT_EXPR_OUTCOME (node
))
2147 pp_string (pp
, "likely by ");
2149 pp_string (pp
, "unlikely by ");
2150 pp_string (pp
, predictor_name (PREDICT_EXPR_PREDICTOR (node
)));
2151 pp_string (pp
, " predictor.");
2155 pp_string (pp
, "ANNOTATE_EXPR <");
2156 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2157 switch ((enum annot_expr_kind
) TREE_INT_CST_LOW (TREE_OPERAND (node
, 1)))
2159 case annot_expr_ivdep_kind
:
2160 pp_string (pp
, ", ivdep");
2162 case annot_expr_no_vector_kind
:
2163 pp_string (pp
, ", no-vector");
2165 case annot_expr_vector_kind
:
2166 pp_string (pp
, ", vector");
2175 pp_string (pp
, "return");
2176 op0
= TREE_OPERAND (node
, 0);
2180 if (TREE_CODE (op0
) == MODIFY_EXPR
)
2181 dump_generic_node (pp
, TREE_OPERAND (op0
, 1),
2184 dump_generic_node (pp
, op0
, spc
, flags
, false);
2189 pp_string (pp
, "if (");
2190 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2191 pp_string (pp
, ") break");
2195 pp_string (pp
, "switch (");
2196 dump_generic_node (pp
, SWITCH_COND (node
), spc
, flags
, false);
2197 pp_right_paren (pp
);
2198 if (!(flags
& TDF_SLIM
))
2200 newline_and_indent (pp
, spc
+2);
2202 if (SWITCH_BODY (node
))
2204 newline_and_indent (pp
, spc
+4);
2205 dump_generic_node (pp
, SWITCH_BODY (node
), spc
+4, flags
,
2210 tree vec
= SWITCH_LABELS (node
);
2211 size_t i
, n
= TREE_VEC_LENGTH (vec
);
2212 for (i
= 0; i
< n
; ++i
)
2214 tree elt
= TREE_VEC_ELT (vec
, i
);
2215 newline_and_indent (pp
, spc
+4);
2218 dump_generic_node (pp
, elt
, spc
+4, flags
, false);
2219 pp_string (pp
, " goto ");
2220 dump_generic_node (pp
, CASE_LABEL (elt
), spc
+4,
2225 pp_string (pp
, "case ???: goto ???;");
2228 newline_and_indent (pp
, spc
+2);
2229 pp_right_brace (pp
);
2235 op0
= GOTO_DESTINATION (node
);
2236 if (TREE_CODE (op0
) != SSA_NAME
&& DECL_P (op0
) && DECL_NAME (op0
))
2238 const char *name
= IDENTIFIER_POINTER (DECL_NAME (op0
));
2239 if (strcmp (name
, "break") == 0
2240 || strcmp (name
, "continue") == 0)
2242 pp_string (pp
, name
);
2246 pp_string (pp
, "goto ");
2247 dump_generic_node (pp
, op0
, spc
, flags
, false);
2251 pp_string (pp
, "__asm__");
2252 if (ASM_VOLATILE_P (node
))
2253 pp_string (pp
, " __volatile__");
2255 dump_generic_node (pp
, ASM_STRING (node
), spc
, flags
, false);
2257 dump_generic_node (pp
, ASM_OUTPUTS (node
), spc
, flags
, false);
2259 dump_generic_node (pp
, ASM_INPUTS (node
), spc
, flags
, false);
2260 if (ASM_CLOBBERS (node
))
2263 dump_generic_node (pp
, ASM_CLOBBERS (node
), spc
, flags
, false);
2265 pp_right_paren (pp
);
2268 case CASE_LABEL_EXPR
:
2269 if (CASE_LOW (node
) && CASE_HIGH (node
))
2271 pp_string (pp
, "case ");
2272 dump_generic_node (pp
, CASE_LOW (node
), spc
, flags
, false);
2273 pp_string (pp
, " ... ");
2274 dump_generic_node (pp
, CASE_HIGH (node
), spc
, flags
, false);
2276 else if (CASE_LOW (node
))
2278 pp_string (pp
, "case ");
2279 dump_generic_node (pp
, CASE_LOW (node
), spc
, flags
, false);
2282 pp_string (pp
, "default");
2287 pp_string (pp
, "OBJ_TYPE_REF(");
2288 dump_generic_node (pp
, OBJ_TYPE_REF_EXPR (node
), spc
, flags
, false);
2290 if (!(flags
& TDF_SLIM
) && virtual_method_call_p (node
))
2292 pp_string (pp
, "(");
2293 dump_generic_node (pp
, obj_type_ref_class (node
), spc
, flags
, false);
2294 pp_string (pp
, ")");
2296 dump_generic_node (pp
, OBJ_TYPE_REF_OBJECT (node
), spc
, flags
, false);
2298 dump_generic_node (pp
, OBJ_TYPE_REF_TOKEN (node
), spc
, flags
, false);
2299 pp_right_paren (pp
);
2303 if (SSA_NAME_IDENTIFIER (node
))
2304 dump_generic_node (pp
, SSA_NAME_IDENTIFIER (node
),
2307 pp_decimal_int (pp
, SSA_NAME_VERSION (node
));
2308 if (SSA_NAME_IS_DEFAULT_DEF (node
))
2309 pp_string (pp
, "(D)");
2310 if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (node
))
2311 pp_string (pp
, "(ab)");
2314 case WITH_SIZE_EXPR
:
2315 pp_string (pp
, "WITH_SIZE_EXPR <");
2316 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2317 pp_string (pp
, ", ");
2318 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2323 pp_string (pp
, "ASSERT_EXPR <");
2324 dump_generic_node (pp
, ASSERT_EXPR_VAR (node
), spc
, flags
, false);
2325 pp_string (pp
, ", ");
2326 dump_generic_node (pp
, ASSERT_EXPR_COND (node
), spc
, flags
, false);
2331 pp_string (pp
, "scev_known");
2334 case SCEV_NOT_KNOWN
:
2335 pp_string (pp
, "scev_not_known");
2338 case POLYNOMIAL_CHREC
:
2340 dump_generic_node (pp
, CHREC_LEFT (node
), spc
, flags
, false);
2341 pp_string (pp
, ", +, ");
2342 dump_generic_node (pp
, CHREC_RIGHT (node
), spc
, flags
, false);
2343 pp_string (pp
, "}_");
2344 dump_generic_node (pp
, CHREC_VAR (node
), spc
, flags
, false);
2348 case REALIGN_LOAD_EXPR
:
2349 pp_string (pp
, "REALIGN_LOAD <");
2350 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2351 pp_string (pp
, ", ");
2352 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2353 pp_string (pp
, ", ");
2354 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2359 pp_string (pp
, " VEC_COND_EXPR < ");
2360 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2361 pp_string (pp
, " , ");
2362 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2363 pp_string (pp
, " , ");
2364 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2365 pp_string (pp
, " > ");
2369 pp_string (pp
, " VEC_PERM_EXPR < ");
2370 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2371 pp_string (pp
, " , ");
2372 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2373 pp_string (pp
, " , ");
2374 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2375 pp_string (pp
, " > ");
2379 pp_string (pp
, " DOT_PROD_EXPR < ");
2380 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2381 pp_string (pp
, ", ");
2382 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2383 pp_string (pp
, ", ");
2384 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2385 pp_string (pp
, " > ");
2388 case WIDEN_MULT_PLUS_EXPR
:
2389 pp_string (pp
, " WIDEN_MULT_PLUS_EXPR < ");
2390 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2391 pp_string (pp
, ", ");
2392 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2393 pp_string (pp
, ", ");
2394 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2395 pp_string (pp
, " > ");
2398 case WIDEN_MULT_MINUS_EXPR
:
2399 pp_string (pp
, " WIDEN_MULT_MINUS_EXPR < ");
2400 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2401 pp_string (pp
, ", ");
2402 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2403 pp_string (pp
, ", ");
2404 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2405 pp_string (pp
, " > ");
2409 pp_string (pp
, " FMA_EXPR < ");
2410 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2411 pp_string (pp
, ", ");
2412 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2413 pp_string (pp
, ", ");
2414 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2415 pp_string (pp
, " > ");
2419 pp_string (pp
, "#pragma omp parallel");
2420 dump_omp_clauses (pp
, OMP_PARALLEL_CLAUSES (node
), spc
, flags
);
2423 if (!(flags
& TDF_SLIM
) && OMP_BODY (node
))
2425 newline_and_indent (pp
, spc
+ 2);
2427 newline_and_indent (pp
, spc
+ 4);
2428 dump_generic_node (pp
, OMP_BODY (node
), spc
+ 4, flags
, false);
2429 newline_and_indent (pp
, spc
+ 2);
2430 pp_right_brace (pp
);
2436 pp_string (pp
, "#pragma omp task");
2437 dump_omp_clauses (pp
, OMP_TASK_CLAUSES (node
), spc
, flags
);
2441 pp_string (pp
, "#pragma omp for");
2445 pp_string (pp
, "#pragma omp simd");
2449 pp_string (pp
, "#pragma simd");
2453 /* This label points one line after dumping the clauses.
2454 For _Cilk_for the clauses are dumped after the _Cilk_for (...)
2455 parameters are printed out. */
2456 goto dump_omp_loop_cilk_for
;
2458 case OMP_DISTRIBUTE
:
2459 pp_string (pp
, "#pragma omp distribute");
2463 pp_string (pp
, "#pragma omp teams");
2464 dump_omp_clauses (pp
, OMP_TEAMS_CLAUSES (node
), spc
, flags
);
2467 case OMP_TARGET_DATA
:
2468 pp_string (pp
, "#pragma omp target data");
2469 dump_omp_clauses (pp
, OMP_TARGET_DATA_CLAUSES (node
), spc
, flags
);
2473 pp_string (pp
, "#pragma omp target");
2474 dump_omp_clauses (pp
, OMP_TARGET_CLAUSES (node
), spc
, flags
);
2477 case OMP_TARGET_UPDATE
:
2478 pp_string (pp
, "#pragma omp target update");
2479 dump_omp_clauses (pp
, OMP_TARGET_UPDATE_CLAUSES (node
), spc
, flags
);
2484 dump_omp_clauses (pp
, OMP_FOR_CLAUSES (node
), spc
, flags
);
2486 dump_omp_loop_cilk_for
:
2487 if (!(flags
& TDF_SLIM
))
2491 if (OMP_FOR_PRE_BODY (node
))
2493 if (TREE_CODE (node
) == CILK_FOR
)
2494 pp_string (pp
, " ");
2496 newline_and_indent (pp
, spc
+ 2);
2499 newline_and_indent (pp
, spc
);
2500 dump_generic_node (pp
, OMP_FOR_PRE_BODY (node
),
2503 if (OMP_FOR_INIT (node
))
2506 for (i
= 0; i
< TREE_VEC_LENGTH (OMP_FOR_INIT (node
)); i
++)
2509 if (TREE_CODE (node
) != CILK_FOR
|| OMP_FOR_PRE_BODY (node
))
2510 newline_and_indent (pp
, spc
);
2511 if (TREE_CODE (node
) == CILK_FOR
)
2512 pp_string (pp
, "_Cilk_for (");
2514 pp_string (pp
, "for (");
2515 dump_generic_node (pp
,
2516 TREE_VEC_ELT (OMP_FOR_INIT (node
), i
),
2518 pp_string (pp
, "; ");
2519 dump_generic_node (pp
,
2520 TREE_VEC_ELT (OMP_FOR_COND (node
), i
),
2522 pp_string (pp
, "; ");
2523 dump_generic_node (pp
,
2524 TREE_VEC_ELT (OMP_FOR_INCR (node
), i
),
2526 pp_right_paren (pp
);
2528 if (TREE_CODE (node
) == CILK_FOR
)
2529 dump_omp_clauses (pp
, OMP_FOR_CLAUSES (node
), spc
, flags
);
2531 if (OMP_FOR_BODY (node
))
2533 newline_and_indent (pp
, spc
+ 2);
2535 newline_and_indent (pp
, spc
+ 4);
2536 dump_generic_node (pp
, OMP_FOR_BODY (node
), spc
+ 4, flags
,
2538 newline_and_indent (pp
, spc
+ 2);
2539 pp_right_brace (pp
);
2541 if (OMP_FOR_INIT (node
))
2542 spc
-= 2 * TREE_VEC_LENGTH (OMP_FOR_INIT (node
)) - 2;
2543 if (OMP_FOR_PRE_BODY (node
))
2546 newline_and_indent (pp
, spc
+ 2);
2547 pp_right_brace (pp
);
2554 pp_string (pp
, "#pragma omp sections");
2555 dump_omp_clauses (pp
, OMP_SECTIONS_CLAUSES (node
), spc
, flags
);
2559 pp_string (pp
, "#pragma omp section");
2563 pp_string (pp
, "#pragma omp master");
2567 pp_string (pp
, "#pragma omp taskgroup");
2571 pp_string (pp
, "#pragma omp ordered");
2575 pp_string (pp
, "#pragma omp critical");
2576 if (OMP_CRITICAL_NAME (node
))
2580 dump_generic_node (pp
, OMP_CRITICAL_NAME (node
), spc
,
2582 pp_right_paren (pp
);
2587 pp_string (pp
, "#pragma omp atomic");
2588 if (OMP_ATOMIC_SEQ_CST (node
))
2589 pp_string (pp
, " seq_cst");
2590 newline_and_indent (pp
, spc
+ 2);
2591 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2595 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2598 case OMP_ATOMIC_READ
:
2599 pp_string (pp
, "#pragma omp atomic read");
2600 if (OMP_ATOMIC_SEQ_CST (node
))
2601 pp_string (pp
, " seq_cst");
2602 newline_and_indent (pp
, spc
+ 2);
2603 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2607 case OMP_ATOMIC_CAPTURE_OLD
:
2608 case OMP_ATOMIC_CAPTURE_NEW
:
2609 pp_string (pp
, "#pragma omp atomic capture");
2610 if (OMP_ATOMIC_SEQ_CST (node
))
2611 pp_string (pp
, " seq_cst");
2612 newline_and_indent (pp
, spc
+ 2);
2613 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2617 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2621 pp_string (pp
, "#pragma omp single");
2622 dump_omp_clauses (pp
, OMP_SINGLE_CLAUSES (node
), spc
, flags
);
2626 dump_omp_clause (pp
, node
, spc
, flags
);
2630 case TRANSACTION_EXPR
:
2631 if (TRANSACTION_EXPR_OUTER (node
))
2632 pp_string (pp
, "__transaction_atomic [[outer]]");
2633 else if (TRANSACTION_EXPR_RELAXED (node
))
2634 pp_string (pp
, "__transaction_relaxed");
2636 pp_string (pp
, "__transaction_atomic");
2637 if (!(flags
& TDF_SLIM
) && TRANSACTION_EXPR_BODY (node
))
2639 newline_and_indent (pp
, spc
);
2641 newline_and_indent (pp
, spc
+ 2);
2642 dump_generic_node (pp
, TRANSACTION_EXPR_BODY (node
),
2643 spc
+ 2, flags
, false);
2644 newline_and_indent (pp
, spc
);
2645 pp_right_brace (pp
);
2650 case REDUC_MAX_EXPR
:
2651 pp_string (pp
, " REDUC_MAX_EXPR < ");
2652 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2653 pp_string (pp
, " > ");
2656 case REDUC_MIN_EXPR
:
2657 pp_string (pp
, " REDUC_MIN_EXPR < ");
2658 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2659 pp_string (pp
, " > ");
2662 case REDUC_PLUS_EXPR
:
2663 pp_string (pp
, " REDUC_PLUS_EXPR < ");
2664 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2665 pp_string (pp
, " > ");
2668 case VEC_WIDEN_MULT_HI_EXPR
:
2669 case VEC_WIDEN_MULT_LO_EXPR
:
2670 case VEC_WIDEN_MULT_EVEN_EXPR
:
2671 case VEC_WIDEN_MULT_ODD_EXPR
:
2672 case VEC_WIDEN_LSHIFT_HI_EXPR
:
2673 case VEC_WIDEN_LSHIFT_LO_EXPR
:
2675 for (str
= get_tree_code_name (code
); *str
; str
++)
2676 pp_character (pp
, TOUPPER (*str
));
2677 pp_string (pp
, " < ");
2678 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2679 pp_string (pp
, ", ");
2680 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2681 pp_string (pp
, " > ");
2684 case VEC_UNPACK_HI_EXPR
:
2685 pp_string (pp
, " VEC_UNPACK_HI_EXPR < ");
2686 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2687 pp_string (pp
, " > ");
2690 case VEC_UNPACK_LO_EXPR
:
2691 pp_string (pp
, " VEC_UNPACK_LO_EXPR < ");
2692 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2693 pp_string (pp
, " > ");
2696 case VEC_UNPACK_FLOAT_HI_EXPR
:
2697 pp_string (pp
, " VEC_UNPACK_FLOAT_HI_EXPR < ");
2698 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2699 pp_string (pp
, " > ");
2702 case VEC_UNPACK_FLOAT_LO_EXPR
:
2703 pp_string (pp
, " VEC_UNPACK_FLOAT_LO_EXPR < ");
2704 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2705 pp_string (pp
, " > ");
2708 case VEC_PACK_TRUNC_EXPR
:
2709 pp_string (pp
, " VEC_PACK_TRUNC_EXPR < ");
2710 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2711 pp_string (pp
, ", ");
2712 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2713 pp_string (pp
, " > ");
2716 case VEC_PACK_SAT_EXPR
:
2717 pp_string (pp
, " VEC_PACK_SAT_EXPR < ");
2718 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2719 pp_string (pp
, ", ");
2720 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2721 pp_string (pp
, " > ");
2724 case VEC_PACK_FIX_TRUNC_EXPR
:
2725 pp_string (pp
, " VEC_PACK_FIX_TRUNC_EXPR < ");
2726 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2727 pp_string (pp
, ", ");
2728 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2729 pp_string (pp
, " > ");
2733 dump_block_node (pp
, node
, spc
, flags
);
2736 case CILK_SPAWN_STMT
:
2737 pp_string (pp
, "_Cilk_spawn ");
2738 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2741 case CILK_SYNC_STMT
:
2742 pp_string (pp
, "_Cilk_sync");
2749 if (is_stmt
&& is_expr
)
2755 /* Print the declaration of a variable. */
2758 print_declaration (pretty_printer
*pp
, tree t
, int spc
, int flags
)
2762 if (TREE_CODE(t
) == NAMELIST_DECL
)
2764 pp_string(pp
, "namelist ");
2765 dump_decl_name (pp
, t
, flags
);
2770 if (TREE_CODE (t
) == TYPE_DECL
)
2771 pp_string (pp
, "typedef ");
2773 if (CODE_CONTAINS_STRUCT (TREE_CODE (t
), TS_DECL_WRTL
) && DECL_REGISTER (t
))
2774 pp_string (pp
, "register ");
2776 if (TREE_PUBLIC (t
) && DECL_EXTERNAL (t
))
2777 pp_string (pp
, "extern ");
2778 else if (TREE_STATIC (t
))
2779 pp_string (pp
, "static ");
2781 /* Print the type and name. */
2782 if (TREE_TYPE (t
) && TREE_CODE (TREE_TYPE (t
)) == ARRAY_TYPE
)
2786 /* Print array's type. */
2787 tmp
= TREE_TYPE (t
);
2788 while (TREE_CODE (TREE_TYPE (tmp
)) == ARRAY_TYPE
)
2789 tmp
= TREE_TYPE (tmp
);
2790 dump_generic_node (pp
, TREE_TYPE (tmp
), spc
, flags
, false);
2792 /* Print variable's name. */
2794 dump_generic_node (pp
, t
, spc
, flags
, false);
2796 /* Print the dimensions. */
2797 tmp
= TREE_TYPE (t
);
2798 while (TREE_CODE (tmp
) == ARRAY_TYPE
)
2800 dump_array_domain (pp
, TYPE_DOMAIN (tmp
), spc
, flags
);
2801 tmp
= TREE_TYPE (tmp
);
2804 else if (TREE_CODE (t
) == FUNCTION_DECL
)
2806 dump_generic_node (pp
, TREE_TYPE (TREE_TYPE (t
)), spc
, flags
, false);
2808 dump_decl_name (pp
, t
, flags
);
2809 dump_function_declaration (pp
, TREE_TYPE (t
), spc
, flags
);
2813 /* Print type declaration. */
2814 dump_generic_node (pp
, TREE_TYPE (t
), spc
, flags
, false);
2816 /* Print variable's name. */
2818 dump_generic_node (pp
, t
, spc
, flags
, false);
2821 if (TREE_CODE (t
) == VAR_DECL
&& DECL_HARD_REGISTER (t
))
2823 pp_string (pp
, " __asm__ ");
2825 dump_generic_node (pp
, DECL_ASSEMBLER_NAME (t
), spc
, flags
, false);
2826 pp_right_paren (pp
);
2829 /* The initial value of a function serves to determine whether the function
2830 is declared or defined. So the following does not apply to function
2832 if (TREE_CODE (t
) != FUNCTION_DECL
)
2834 /* Print the initial value. */
2835 if (DECL_INITIAL (t
))
2840 dump_generic_node (pp
, DECL_INITIAL (t
), spc
, flags
, false);
2844 if (TREE_CODE (t
) == VAR_DECL
&& DECL_HAS_VALUE_EXPR_P (t
))
2846 pp_string (pp
, " [value-expr: ");
2847 dump_generic_node (pp
, DECL_VALUE_EXPR (t
), spc
, flags
, false);
2848 pp_right_bracket (pp
);
2855 /* Prints a structure: name, fields, and methods.
2856 FIXME: Still incomplete. */
2859 print_struct_decl (pretty_printer
*pp
, const_tree node
, int spc
, int flags
)
2861 /* Print the name of the structure. */
2862 if (TYPE_NAME (node
))
2865 if (TREE_CODE (node
) == RECORD_TYPE
)
2866 pp_string (pp
, "struct ");
2867 else if ((TREE_CODE (node
) == UNION_TYPE
2868 || TREE_CODE (node
) == QUAL_UNION_TYPE
))
2869 pp_string (pp
, "union ");
2871 dump_generic_node (pp
, TYPE_NAME (node
), spc
, 0, false);
2874 /* Print the contents of the structure. */
2880 /* Print the fields of the structure. */
2883 tmp
= TYPE_FIELDS (node
);
2886 /* Avoid to print recursively the structure. */
2887 /* FIXME : Not implemented correctly...,
2888 what about the case when we have a cycle in the contain graph? ...
2889 Maybe this could be solved by looking at the scope in which the
2890 structure was declared. */
2891 if (TREE_TYPE (tmp
) != node
2892 && (TREE_CODE (TREE_TYPE (tmp
)) != POINTER_TYPE
2893 || TREE_TYPE (TREE_TYPE (tmp
)) != node
))
2895 print_declaration (pp
, tmp
, spc
+2, flags
);
2898 tmp
= DECL_CHAIN (tmp
);
2902 pp_right_brace (pp
);
2905 /* Return the priority of the operator CODE.
2907 From lowest to highest precedence with either left-to-right (L-R)
2908 or right-to-left (R-L) associativity]:
2911 2 [R-L] = += -= *= /= %= &= ^= |= <<= >>=
2923 14 [R-L] ! ~ ++ -- + - * & (type) sizeof
2924 15 [L-R] fn() [] -> .
2926 unary +, - and * have higher precedence than the corresponding binary
2930 op_code_prio (enum tree_code code
)
2947 case TRUTH_ORIF_EXPR
:
2950 case TRUTH_AND_EXPR
:
2951 case TRUTH_ANDIF_EXPR
:
2958 case TRUTH_XOR_EXPR
:
2975 case UNORDERED_EXPR
:
2986 case VEC_WIDEN_LSHIFT_HI_EXPR
:
2987 case VEC_WIDEN_LSHIFT_LO_EXPR
:
2988 case WIDEN_LSHIFT_EXPR
:
2991 case WIDEN_SUM_EXPR
:
2993 case POINTER_PLUS_EXPR
:
2997 case VEC_WIDEN_MULT_HI_EXPR
:
2998 case VEC_WIDEN_MULT_LO_EXPR
:
2999 case WIDEN_MULT_EXPR
:
3001 case WIDEN_MULT_PLUS_EXPR
:
3002 case WIDEN_MULT_MINUS_EXPR
:
3004 case MULT_HIGHPART_EXPR
:
3005 case TRUNC_DIV_EXPR
:
3007 case FLOOR_DIV_EXPR
:
3008 case ROUND_DIV_EXPR
:
3010 case EXACT_DIV_EXPR
:
3011 case TRUNC_MOD_EXPR
:
3013 case FLOOR_MOD_EXPR
:
3014 case ROUND_MOD_EXPR
:
3018 case TRUTH_NOT_EXPR
:
3020 case POSTINCREMENT_EXPR
:
3021 case POSTDECREMENT_EXPR
:
3022 case PREINCREMENT_EXPR
:
3023 case PREDECREMENT_EXPR
:
3029 case FIX_TRUNC_EXPR
:
3035 case ARRAY_RANGE_REF
:
3039 /* Special expressions. */
3045 case REDUC_MAX_EXPR
:
3046 case REDUC_MIN_EXPR
:
3047 case REDUC_PLUS_EXPR
:
3048 case VEC_UNPACK_HI_EXPR
:
3049 case VEC_UNPACK_LO_EXPR
:
3050 case VEC_UNPACK_FLOAT_HI_EXPR
:
3051 case VEC_UNPACK_FLOAT_LO_EXPR
:
3052 case VEC_PACK_TRUNC_EXPR
:
3053 case VEC_PACK_SAT_EXPR
:
3057 /* Return an arbitrarily high precedence to avoid surrounding single
3058 VAR_DECLs in ()s. */
3063 /* Return the priority of the operator OP. */
3066 op_prio (const_tree op
)
3068 enum tree_code code
;
3073 code
= TREE_CODE (op
);
3074 if (code
== SAVE_EXPR
|| code
== NON_LVALUE_EXPR
)
3075 return op_prio (TREE_OPERAND (op
, 0));
3077 return op_code_prio (code
);
3080 /* Return the symbol associated with operator CODE. */
3083 op_symbol_code (enum tree_code code
)
3091 case TRUTH_ORIF_EXPR
:
3094 case TRUTH_AND_EXPR
:
3095 case TRUTH_ANDIF_EXPR
:
3101 case TRUTH_XOR_EXPR
:
3111 case UNORDERED_EXPR
:
3157 case WIDEN_LSHIFT_EXPR
:
3160 case POINTER_PLUS_EXPR
:
3166 case REDUC_PLUS_EXPR
:
3169 case WIDEN_SUM_EXPR
:
3172 case WIDEN_MULT_EXPR
:
3175 case MULT_HIGHPART_EXPR
:
3185 case TRUTH_NOT_EXPR
:
3192 case TRUNC_DIV_EXPR
:
3199 case FLOOR_DIV_EXPR
:
3202 case ROUND_DIV_EXPR
:
3205 case EXACT_DIV_EXPR
:
3208 case TRUNC_MOD_EXPR
:
3214 case FLOOR_MOD_EXPR
:
3217 case ROUND_MOD_EXPR
:
3220 case PREDECREMENT_EXPR
:
3223 case PREINCREMENT_EXPR
:
3226 case POSTDECREMENT_EXPR
:
3229 case POSTINCREMENT_EXPR
:
3239 return "<<< ??? >>>";
3243 /* Return the symbol associated with operator OP. */
3246 op_symbol (const_tree op
)
3248 return op_symbol_code (TREE_CODE (op
));
3251 /* Prints the name of a call. NODE is the CALL_EXPR_FN of a CALL_EXPR or
3252 the gimple_call_fn of a GIMPLE_CALL. */
3255 print_call_name (pretty_printer
*pp
, tree node
, int flags
)
3259 if (TREE_CODE (op0
) == NON_LVALUE_EXPR
)
3260 op0
= TREE_OPERAND (op0
, 0);
3263 switch (TREE_CODE (op0
))
3268 dump_function_name (pp
, op0
, flags
);
3274 op0
= TREE_OPERAND (op0
, 0);
3279 dump_generic_node (pp
, TREE_OPERAND (op0
, 0), 0, flags
, false);
3280 pp_string (pp
, ") ? ");
3281 dump_generic_node (pp
, TREE_OPERAND (op0
, 1), 0, flags
, false);
3282 pp_string (pp
, " : ");
3283 dump_generic_node (pp
, TREE_OPERAND (op0
, 2), 0, flags
, false);
3287 if (TREE_CODE (TREE_OPERAND (op0
, 0)) == VAR_DECL
)
3288 dump_function_name (pp
, TREE_OPERAND (op0
, 0), flags
);
3290 dump_generic_node (pp
, op0
, 0, flags
, false);
3294 if (integer_zerop (TREE_OPERAND (op0
, 1)))
3296 op0
= TREE_OPERAND (op0
, 0);
3303 dump_generic_node (pp
, op0
, 0, flags
, false);
3311 /* Parses the string STR and replaces new-lines by '\n', tabs by '\t', ... */
3314 pretty_print_string (pretty_printer
*pp
, const char *str
)
3324 pp_string (pp
, "\\b");
3328 pp_string (pp
, "\\f");
3332 pp_string (pp
, "\\n");
3336 pp_string (pp
, "\\r");
3340 pp_string (pp
, "\\t");
3344 pp_string (pp
, "\\v");
3348 pp_string (pp
, "\\\\");
3352 pp_string (pp
, "\\\"");
3356 pp_string (pp
, "\\'");
3359 /* No need to handle \0; the loop terminates on \0. */
3362 pp_string (pp
, "\\1");
3366 pp_string (pp
, "\\2");
3370 pp_string (pp
, "\\3");
3374 pp_string (pp
, "\\4");
3378 pp_string (pp
, "\\5");
3382 pp_string (pp
, "\\6");
3386 pp_string (pp
, "\\7");
3390 pp_character (pp
, str
[0]);
3398 maybe_init_pretty_print (FILE *file
)
3402 tree_pp
= new pretty_printer ();
3403 pp_needs_newline (tree_pp
) = true;
3404 pp_translate_identifiers (tree_pp
) = false;
3407 tree_pp
->buffer
->stream
= file
;
3411 newline_and_indent (pretty_printer
*pp
, int spc
)
3417 /* Handle a %K format for TEXT. Separate from default_tree_printer so
3418 it can also be used in front ends.
3419 %K: a statement, from which EXPR_LOCATION and TREE_BLOCK will be recorded.
3423 percent_K_format (text_info
*text
)
3425 tree t
= va_arg (*text
->args_ptr
, tree
), block
;
3426 gcc_assert (text
->locus
!= NULL
);
3427 *text
->locus
= EXPR_LOCATION (t
);
3428 gcc_assert (pp_ti_abstract_origin (text
) != NULL
);
3429 block
= TREE_BLOCK (t
);
3430 *pp_ti_abstract_origin (text
) = NULL
;
3434 /* ??? LTO drops all BLOCK_ABSTRACT_ORIGINs apart from those
3435 representing the outermost block of an inlined function.
3436 So walk the BLOCK tree until we hit such a scope. */
3438 && TREE_CODE (block
) == BLOCK
)
3440 if (inlined_function_outer_scope_p (block
))
3442 *pp_ti_abstract_origin (text
) = block
;
3445 block
= BLOCK_SUPERCONTEXT (block
);
3451 && TREE_CODE (block
) == BLOCK
3452 && BLOCK_ABSTRACT_ORIGIN (block
))
3454 tree ao
= BLOCK_ABSTRACT_ORIGIN (block
);
3456 while (TREE_CODE (ao
) == BLOCK
3457 && BLOCK_ABSTRACT_ORIGIN (ao
)
3458 && BLOCK_ABSTRACT_ORIGIN (ao
) != ao
)
3459 ao
= BLOCK_ABSTRACT_ORIGIN (ao
);
3461 if (TREE_CODE (ao
) == FUNCTION_DECL
)
3463 *pp_ti_abstract_origin (text
) = block
;
3466 block
= BLOCK_SUPERCONTEXT (block
);
3470 /* Print the identifier ID to PRETTY-PRINTER. */
3473 pp_tree_identifier (pretty_printer
*pp
, tree id
)
3475 if (pp_translate_identifiers (pp
))
3477 const char *text
= identifier_to_locale (IDENTIFIER_POINTER (id
));
3478 pp_append_text (pp
, text
, text
+ strlen (text
));
3481 pp_append_text (pp
, IDENTIFIER_POINTER (id
),
3482 IDENTIFIER_POINTER (id
) + IDENTIFIER_LENGTH (id
));
3485 /* A helper function that is used to dump function information before the
3489 dump_function_header (FILE *dump_file
, tree fdecl
, int flags
)
3491 const char *dname
, *aname
;
3492 struct cgraph_node
*node
= cgraph_node::get (fdecl
);
3493 struct function
*fun
= DECL_STRUCT_FUNCTION (fdecl
);
3495 dname
= lang_hooks
.decl_printable_name (fdecl
, 2);
3497 if (DECL_ASSEMBLER_NAME_SET_P (fdecl
))
3498 aname
= (IDENTIFIER_POINTER
3499 (DECL_ASSEMBLER_NAME (fdecl
)));
3501 aname
= "<unset-asm-name>";
3503 fprintf (dump_file
, "\n;; Function %s (%s, funcdef_no=%d",
3504 dname
, aname
, fun
->funcdef_no
);
3505 if (!(flags
& TDF_NOUID
))
3506 fprintf (dump_file
, ", decl_uid=%d", DECL_UID (fdecl
));
3509 fprintf (dump_file
, ", cgraph_uid=%d", node
->uid
);
3510 fprintf (dump_file
, ", symbol_order=%d)%s\n\n", node
->order
,
3511 node
->frequency
== NODE_FREQUENCY_HOT
3513 : node
->frequency
== NODE_FREQUENCY_UNLIKELY_EXECUTED
3514 ? " (unlikely executed)"
3515 : node
->frequency
== NODE_FREQUENCY_EXECUTED_ONCE
3516 ? " (executed once)"
3520 fprintf (dump_file
, ")\n\n");
3523 /* Dump double_int D to pretty_printer PP. UNS is true
3524 if D is unsigned and false otherwise. */
3526 pp_double_int (pretty_printer
*pp
, double_int d
, bool uns
)
3529 pp_wide_integer (pp
, d
.low
);
3530 else if (d
.fits_uhwi ())
3531 pp_unsigned_wide_integer (pp
, d
.low
);
3534 unsigned HOST_WIDE_INT low
= d
.low
;
3535 HOST_WIDE_INT high
= d
.high
;
3536 if (!uns
&& d
.is_negative ())
3539 high
= ~high
+ !low
;
3542 /* Would "%x%0*x" or "%x%*0x" get zero-padding on all
3544 sprintf (pp_buffer (pp
)->digit_buffer
,
3545 HOST_WIDE_INT_PRINT_DOUBLE_HEX
,
3546 (unsigned HOST_WIDE_INT
) high
, low
);
3547 pp_string (pp
, pp_buffer (pp
)->digit_buffer
);