1 /* Pretty formatting of GENERIC trees in C syntax.
2 Copyright (C) 2001-2015 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"
28 #include "stor-layout.h"
29 #include "hard-reg-set.h"
33 #include "insn-config.h"
42 #include "tree-pretty-print.h"
43 #include "gimple-expr.h"
46 #include "langhooks.h"
47 #include "tree-iterator.h"
48 #include "tree-chrec.h"
50 #include "value-prof.h"
51 #include "wide-int-print.h"
52 #include "internal-fn.h"
53 #include "gomp-constants.h"
55 /* Local functions, macros and variables. */
56 static const char *op_symbol (const_tree
);
57 static void pretty_print_string (pretty_printer
*, const char*);
58 static void newline_and_indent (pretty_printer
*, int);
59 static void maybe_init_pretty_print (FILE *);
60 static void print_struct_decl (pretty_printer
*, const_tree
, int, int);
61 static void do_niy (pretty_printer
*, const_tree
);
63 #define INDENT(SPACE) do { \
64 int i; for (i = 0; i<SPACE; i++) pp_space (pp); } while (0)
66 #define NIY do_niy (pp, node)
68 static pretty_printer
*tree_pp
;
70 /* Try to print something for an unknown tree code. */
73 do_niy (pretty_printer
*pp
, const_tree node
)
77 pp_string (pp
, "<<< Unknown tree: ");
78 pp_string (pp
, get_tree_code_name (TREE_CODE (node
)));
82 len
= TREE_OPERAND_LENGTH (node
);
83 for (i
= 0; i
< len
; ++i
)
85 newline_and_indent (pp
, 2);
86 dump_generic_node (pp
, TREE_OPERAND (node
, i
), 2, 0, false);
90 pp_string (pp
, " >>>");
93 /* Debugging function to print out a generic expression. */
96 debug_generic_expr (tree t
)
98 print_generic_expr (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
);
99 fprintf (stderr
, "\n");
102 /* Debugging function to print out a generic statement. */
105 debug_generic_stmt (tree t
)
107 print_generic_stmt (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
);
108 fprintf (stderr
, "\n");
111 /* Debugging function to print out a chain of trees . */
114 debug_tree_chain (tree t
)
120 print_generic_expr (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
|TDF_UID
);
121 fprintf (stderr
, " ");
125 fprintf (stderr
, "... [cycled back to ");
126 print_generic_expr (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
|TDF_UID
);
127 fprintf (stderr
, "]");
131 fprintf (stderr
, "\n");
134 /* Prints declaration DECL to the FILE with details specified by FLAGS. */
136 print_generic_decl (FILE *file
, tree decl
, int flags
)
138 maybe_init_pretty_print (file
);
139 print_declaration (tree_pp
, decl
, 2, flags
);
140 pp_write_text_to_stream (tree_pp
);
143 /* Print tree T, and its successors, on file FILE. FLAGS specifies details
144 to show in the dump. See TDF_* in dumpfile.h. */
147 print_generic_stmt (FILE *file
, tree t
, int flags
)
149 maybe_init_pretty_print (file
);
150 dump_generic_node (tree_pp
, t
, 0, flags
, true);
151 pp_newline_and_flush (tree_pp
);
154 /* Print tree T, and its successors, on file FILE. FLAGS specifies details
155 to show in the dump. See TDF_* in dumpfile.h. The output is indented by
159 print_generic_stmt_indented (FILE *file
, tree t
, int flags
, int indent
)
163 maybe_init_pretty_print (file
);
165 for (i
= 0; i
< indent
; i
++)
167 dump_generic_node (tree_pp
, t
, indent
, flags
, true);
168 pp_newline_and_flush (tree_pp
);
171 /* Print a single expression T on file FILE. FLAGS specifies details to show
172 in the dump. See TDF_* in dumpfile.h. */
175 print_generic_expr (FILE *file
, tree t
, int flags
)
177 maybe_init_pretty_print (file
);
178 dump_generic_node (tree_pp
, t
, 0, flags
, false);
182 /* Dump the name of a _DECL node and its DECL_UID if TDF_UID is set
186 dump_decl_name (pretty_printer
*pp
, tree node
, int flags
)
188 if (DECL_NAME (node
))
190 if ((flags
& TDF_ASMNAME
) && DECL_ASSEMBLER_NAME_SET_P (node
))
191 pp_tree_identifier (pp
, DECL_ASSEMBLER_NAME (node
));
193 pp_tree_identifier (pp
, DECL_NAME (node
));
195 if ((flags
& TDF_UID
) || DECL_NAME (node
) == NULL_TREE
)
197 if (TREE_CODE (node
) == LABEL_DECL
&& LABEL_DECL_UID (node
) != -1)
198 pp_printf (pp
, "L.%d", (int) LABEL_DECL_UID (node
));
199 else if (TREE_CODE (node
) == DEBUG_EXPR_DECL
)
201 if (flags
& TDF_NOUID
)
202 pp_string (pp
, "D#xxxx");
204 pp_printf (pp
, "D#%i", DEBUG_TEMP_UID (node
));
208 char c
= TREE_CODE (node
) == CONST_DECL
? 'C' : 'D';
209 if (flags
& TDF_NOUID
)
210 pp_printf (pp
, "%c.xxxx", c
);
212 pp_printf (pp
, "%c.%u", c
, DECL_UID (node
));
215 if ((flags
& TDF_ALIAS
) && DECL_PT_UID (node
) != DECL_UID (node
))
217 if (flags
& TDF_NOUID
)
218 pp_printf (pp
, "ptD.xxxx");
220 pp_printf (pp
, "ptD.%u", DECL_PT_UID (node
));
224 /* Like the above, but used for pretty printing function calls. */
227 dump_function_name (pretty_printer
*pp
, tree node
, int flags
)
229 if (CONVERT_EXPR_P (node
))
230 node
= TREE_OPERAND (node
, 0);
231 if (DECL_NAME (node
) && (flags
& TDF_ASMNAME
) == 0)
232 pp_string (pp
, lang_hooks
.decl_printable_name (node
, 1));
234 dump_decl_name (pp
, node
, flags
);
237 /* Dump a function declaration. NODE is the FUNCTION_TYPE. PP, SPC and
238 FLAGS are as in dump_generic_node. */
241 dump_function_declaration (pretty_printer
*pp
, tree node
,
244 bool wrote_arg
= false;
250 /* Print the argument types. */
251 arg
= TYPE_ARG_TYPES (node
);
252 while (arg
&& arg
!= void_list_node
&& arg
!= error_mark_node
)
260 dump_generic_node (pp
, TREE_VALUE (arg
), spc
, flags
, false);
261 arg
= TREE_CHAIN (arg
);
264 /* Drop the trailing void_type_node if we had any previous argument. */
265 if (arg
== void_list_node
&& !wrote_arg
)
266 pp_string (pp
, "void");
267 /* Properly dump vararg function types. */
268 else if (!arg
&& wrote_arg
)
269 pp_string (pp
, ", ...");
270 /* Avoid printing any arg for unprototyped functions. */
275 /* Dump the domain associated with an array. */
278 dump_array_domain (pretty_printer
*pp
, tree domain
, int spc
, int flags
)
280 pp_left_bracket (pp
);
283 tree min
= TYPE_MIN_VALUE (domain
);
284 tree max
= TYPE_MAX_VALUE (domain
);
287 && integer_zerop (min
)
288 && tree_fits_shwi_p (max
))
289 pp_wide_integer (pp
, tree_to_shwi (max
) + 1);
293 dump_generic_node (pp
, min
, spc
, flags
, false);
296 dump_generic_node (pp
, max
, spc
, flags
, false);
300 pp_string (pp
, "<unknown>");
301 pp_right_bracket (pp
);
305 /* Dump OpenMP clause CLAUSE. PP, CLAUSE, SPC and FLAGS are as in
306 dump_generic_node. */
309 dump_omp_clause (pretty_printer
*pp
, tree clause
, int spc
, int flags
)
313 switch (OMP_CLAUSE_CODE (clause
))
315 case OMP_CLAUSE_PRIVATE
:
318 case OMP_CLAUSE_SHARED
:
321 case OMP_CLAUSE_FIRSTPRIVATE
:
322 name
= "firstprivate";
324 case OMP_CLAUSE_LASTPRIVATE
:
325 name
= "lastprivate";
327 case OMP_CLAUSE_COPYIN
:
330 case OMP_CLAUSE_COPYPRIVATE
:
331 name
= "copyprivate";
333 case OMP_CLAUSE_UNIFORM
:
336 case OMP_CLAUSE__LOOPTEMP_
:
339 case OMP_CLAUSE_DEVICE_RESIDENT
:
340 name
= "device_resident";
342 case OMP_CLAUSE_USE_DEVICE
:
346 pp_string (pp
, name
);
348 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
353 case OMP_CLAUSE_REDUCTION
:
354 pp_string (pp
, "reduction(");
355 if (OMP_CLAUSE_REDUCTION_CODE (clause
) != ERROR_MARK
)
358 op_symbol_code (OMP_CLAUSE_REDUCTION_CODE (clause
)));
361 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
367 pp_string (pp
, "if(");
368 dump_generic_node (pp
, OMP_CLAUSE_IF_EXPR (clause
),
373 case OMP_CLAUSE_NUM_THREADS
:
374 pp_string (pp
, "num_threads(");
375 dump_generic_node (pp
, OMP_CLAUSE_NUM_THREADS_EXPR (clause
),
380 case OMP_CLAUSE__CILK_FOR_COUNT_
:
381 pp_string (pp
, "_Cilk_for_count_(");
382 dump_generic_node (pp
, OMP_CLAUSE_OPERAND (clause
, 0),
387 case OMP_CLAUSE_NOWAIT
:
388 pp_string (pp
, "nowait");
390 case OMP_CLAUSE_ORDERED
:
391 pp_string (pp
, "ordered");
394 case OMP_CLAUSE_DEFAULT
:
395 pp_string (pp
, "default(");
396 switch (OMP_CLAUSE_DEFAULT_KIND (clause
))
398 case OMP_CLAUSE_DEFAULT_UNSPECIFIED
:
400 case OMP_CLAUSE_DEFAULT_SHARED
:
401 pp_string (pp
, "shared");
403 case OMP_CLAUSE_DEFAULT_NONE
:
404 pp_string (pp
, "none");
406 case OMP_CLAUSE_DEFAULT_PRIVATE
:
407 pp_string (pp
, "private");
409 case OMP_CLAUSE_DEFAULT_FIRSTPRIVATE
:
410 pp_string (pp
, "firstprivate");
418 case OMP_CLAUSE_SCHEDULE
:
419 pp_string (pp
, "schedule(");
420 switch (OMP_CLAUSE_SCHEDULE_KIND (clause
))
422 case OMP_CLAUSE_SCHEDULE_STATIC
:
423 pp_string (pp
, "static");
425 case OMP_CLAUSE_SCHEDULE_DYNAMIC
:
426 pp_string (pp
, "dynamic");
428 case OMP_CLAUSE_SCHEDULE_GUIDED
:
429 pp_string (pp
, "guided");
431 case OMP_CLAUSE_SCHEDULE_RUNTIME
:
432 pp_string (pp
, "runtime");
434 case OMP_CLAUSE_SCHEDULE_AUTO
:
435 pp_string (pp
, "auto");
437 case OMP_CLAUSE_SCHEDULE_CILKFOR
:
438 pp_string (pp
, "cilk-for grain");
443 if (OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (clause
))
446 dump_generic_node (pp
, OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (clause
),
452 case OMP_CLAUSE_UNTIED
:
453 pp_string (pp
, "untied");
456 case OMP_CLAUSE_COLLAPSE
:
457 pp_string (pp
, "collapse(");
458 dump_generic_node (pp
, OMP_CLAUSE_COLLAPSE_EXPR (clause
),
463 case OMP_CLAUSE_FINAL
:
464 pp_string (pp
, "final(");
465 dump_generic_node (pp
, OMP_CLAUSE_FINAL_EXPR (clause
),
470 case OMP_CLAUSE_MERGEABLE
:
471 pp_string (pp
, "mergeable");
474 case OMP_CLAUSE_LINEAR
:
475 pp_string (pp
, "linear(");
476 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
479 dump_generic_node (pp
, OMP_CLAUSE_LINEAR_STEP (clause
),
484 case OMP_CLAUSE_ALIGNED
:
485 pp_string (pp
, "aligned(");
486 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
488 if (OMP_CLAUSE_ALIGNED_ALIGNMENT (clause
))
491 dump_generic_node (pp
, OMP_CLAUSE_ALIGNED_ALIGNMENT (clause
),
497 case OMP_CLAUSE_DEPEND
:
498 pp_string (pp
, "depend(");
499 switch (OMP_CLAUSE_DEPEND_KIND (clause
))
501 case OMP_CLAUSE_DEPEND_IN
:
502 pp_string (pp
, "in");
504 case OMP_CLAUSE_DEPEND_OUT
:
505 pp_string (pp
, "out");
507 case OMP_CLAUSE_DEPEND_INOUT
:
508 pp_string (pp
, "inout");
514 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
520 pp_string (pp
, "map(");
521 switch (OMP_CLAUSE_MAP_KIND (clause
))
524 case GOMP_MAP_POINTER
:
525 pp_string (pp
, "alloc");
528 case GOMP_MAP_TO_PSET
:
529 pp_string (pp
, "to");
532 pp_string (pp
, "from");
534 case GOMP_MAP_TOFROM
:
535 pp_string (pp
, "tofrom");
537 case GOMP_MAP_FORCE_ALLOC
:
538 pp_string (pp
, "force_alloc");
540 case GOMP_MAP_FORCE_TO
:
541 pp_string (pp
, "force_to");
543 case GOMP_MAP_FORCE_FROM
:
544 pp_string (pp
, "force_from");
546 case GOMP_MAP_FORCE_TOFROM
:
547 pp_string (pp
, "force_tofrom");
549 case GOMP_MAP_FORCE_PRESENT
:
550 pp_string (pp
, "force_present");
552 case GOMP_MAP_FORCE_DEALLOC
:
553 pp_string (pp
, "force_dealloc");
555 case GOMP_MAP_FORCE_DEVICEPTR
:
556 pp_string (pp
, "force_deviceptr");
562 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
565 if (OMP_CLAUSE_SIZE (clause
))
567 if (OMP_CLAUSE_CODE (clause
) == OMP_CLAUSE_MAP
568 && OMP_CLAUSE_MAP_KIND (clause
) == GOMP_MAP_POINTER
)
569 pp_string (pp
, " [pointer assign, bias: ");
570 else if (OMP_CLAUSE_CODE (clause
) == OMP_CLAUSE_MAP
571 && OMP_CLAUSE_MAP_KIND (clause
) == GOMP_MAP_TO_PSET
)
572 pp_string (pp
, " [pointer set, len: ");
574 pp_string (pp
, " [len: ");
575 dump_generic_node (pp
, OMP_CLAUSE_SIZE (clause
),
577 pp_right_bracket (pp
);
582 case OMP_CLAUSE_FROM
:
583 pp_string (pp
, "from(");
584 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
586 goto print_clause_size
;
589 pp_string (pp
, "to(");
590 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
592 goto print_clause_size
;
594 case OMP_CLAUSE__CACHE_
:
596 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
598 goto print_clause_size
;
600 case OMP_CLAUSE_NUM_TEAMS
:
601 pp_string (pp
, "num_teams(");
602 dump_generic_node (pp
, OMP_CLAUSE_NUM_TEAMS_EXPR (clause
),
607 case OMP_CLAUSE_THREAD_LIMIT
:
608 pp_string (pp
, "thread_limit(");
609 dump_generic_node (pp
, OMP_CLAUSE_THREAD_LIMIT_EXPR (clause
),
614 case OMP_CLAUSE_DEVICE
:
615 pp_string (pp
, "device(");
616 dump_generic_node (pp
, OMP_CLAUSE_DEVICE_ID (clause
),
621 case OMP_CLAUSE_DIST_SCHEDULE
:
622 pp_string (pp
, "dist_schedule(static");
623 if (OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR (clause
))
626 dump_generic_node (pp
,
627 OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR (clause
),
633 case OMP_CLAUSE_PROC_BIND
:
634 pp_string (pp
, "proc_bind(");
635 switch (OMP_CLAUSE_PROC_BIND_KIND (clause
))
637 case OMP_CLAUSE_PROC_BIND_MASTER
:
638 pp_string (pp
, "master");
640 case OMP_CLAUSE_PROC_BIND_CLOSE
:
641 pp_string (pp
, "close");
643 case OMP_CLAUSE_PROC_BIND_SPREAD
:
644 pp_string (pp
, "spread");
652 case OMP_CLAUSE_SAFELEN
:
653 pp_string (pp
, "safelen(");
654 dump_generic_node (pp
, OMP_CLAUSE_SAFELEN_EXPR (clause
),
659 case OMP_CLAUSE_SIMDLEN
:
660 pp_string (pp
, "simdlen(");
661 dump_generic_node (pp
, OMP_CLAUSE_SIMDLEN_EXPR (clause
),
666 case OMP_CLAUSE__SIMDUID_
:
667 pp_string (pp
, "_simduid_(");
668 dump_generic_node (pp
, OMP_CLAUSE__SIMDUID__DECL (clause
),
673 case OMP_CLAUSE_GANG
:
674 pp_string (pp
, "gang");
675 if (OMP_CLAUSE_GANG_EXPR (clause
) != NULL_TREE
)
677 pp_string (pp
, "(num: ");
678 dump_generic_node (pp
, OMP_CLAUSE_GANG_EXPR (clause
),
681 if (OMP_CLAUSE_GANG_STATIC_EXPR (clause
) != NULL_TREE
)
683 if (OMP_CLAUSE_GANG_EXPR (clause
) == NULL_TREE
)
687 pp_string (pp
, "static:");
688 if (OMP_CLAUSE_GANG_STATIC_EXPR (clause
)
689 == integer_minus_one_node
)
690 pp_character (pp
, '*');
692 dump_generic_node (pp
, OMP_CLAUSE_GANG_STATIC_EXPR (clause
),
695 if (OMP_CLAUSE_GANG_EXPR (clause
) != NULL_TREE
696 || OMP_CLAUSE_GANG_STATIC_EXPR (clause
) != NULL_TREE
)
700 case OMP_CLAUSE_ASYNC
:
701 pp_string (pp
, "async");
702 if (OMP_CLAUSE_ASYNC_EXPR (clause
))
704 pp_character(pp
, '(');
705 dump_generic_node (pp
, OMP_CLAUSE_ASYNC_EXPR (clause
),
707 pp_character(pp
, ')');
711 case OMP_CLAUSE_AUTO
:
713 pp_string (pp
, omp_clause_code_name
[OMP_CLAUSE_CODE (clause
)]);
716 case OMP_CLAUSE_WAIT
:
717 pp_string (pp
, "wait(");
718 dump_generic_node (pp
, OMP_CLAUSE_WAIT_EXPR (clause
),
720 pp_character(pp
, ')');
723 case OMP_CLAUSE_WORKER
:
724 pp_string (pp
, "worker");
725 if (OMP_CLAUSE_WORKER_EXPR (clause
) != NULL_TREE
)
728 dump_generic_node (pp
, OMP_CLAUSE_WORKER_EXPR (clause
),
734 case OMP_CLAUSE_VECTOR
:
735 pp_string (pp
, "vector");
736 if (OMP_CLAUSE_VECTOR_EXPR (clause
) != NULL_TREE
)
739 dump_generic_node (pp
, OMP_CLAUSE_VECTOR_EXPR (clause
),
745 case OMP_CLAUSE_NUM_GANGS
:
746 pp_string (pp
, "num_gangs(");
747 dump_generic_node (pp
, OMP_CLAUSE_NUM_GANGS_EXPR (clause
),
749 pp_character (pp
, ')');
752 case OMP_CLAUSE_NUM_WORKERS
:
753 pp_string (pp
, "num_workers(");
754 dump_generic_node (pp
, OMP_CLAUSE_NUM_WORKERS_EXPR (clause
),
756 pp_character (pp
, ')');
759 case OMP_CLAUSE_VECTOR_LENGTH
:
760 pp_string (pp
, "vector_length(");
761 dump_generic_node (pp
, OMP_CLAUSE_VECTOR_LENGTH_EXPR (clause
),
763 pp_character (pp
, ')');
766 case OMP_CLAUSE_INBRANCH
:
767 pp_string (pp
, "inbranch");
769 case OMP_CLAUSE_NOTINBRANCH
:
770 pp_string (pp
, "notinbranch");
773 pp_string (pp
, "for");
775 case OMP_CLAUSE_PARALLEL
:
776 pp_string (pp
, "parallel");
778 case OMP_CLAUSE_SECTIONS
:
779 pp_string (pp
, "sections");
781 case OMP_CLAUSE_TASKGROUP
:
782 pp_string (pp
, "taskgroup");
784 case OMP_CLAUSE_INDEPENDENT
:
785 pp_string (pp
, "independent");
789 /* Should never happen. */
790 dump_generic_node (pp
, clause
, spc
, flags
, false);
796 /* Dump the list of OpenMP clauses. PP, SPC and FLAGS are as in
797 dump_generic_node. */
800 dump_omp_clauses (pretty_printer
*pp
, tree clause
, int spc
, int flags
)
808 dump_omp_clause (pp
, clause
, spc
, flags
);
809 clause
= OMP_CLAUSE_CHAIN (clause
);
817 /* Dump location LOC to PP. */
820 dump_location (pretty_printer
*pp
, location_t loc
)
822 expanded_location xloc
= expand_location (loc
);
824 pp_left_bracket (pp
);
827 pp_string (pp
, xloc
.file
);
830 pp_decimal_int (pp
, xloc
.line
);
832 pp_decimal_int (pp
, xloc
.column
);
833 pp_string (pp
, "] ");
837 /* Dump lexical block BLOCK. PP, SPC and FLAGS are as in
838 dump_generic_node. */
841 dump_block_node (pretty_printer
*pp
, tree block
, int spc
, int flags
)
845 pp_printf (pp
, "BLOCK #%d ", BLOCK_NUMBER (block
));
847 if (flags
& TDF_ADDRESS
)
848 pp_printf (pp
, "[%p] ", (void *) block
);
850 if (BLOCK_ABSTRACT (block
))
851 pp_string (pp
, "[abstract] ");
853 if (TREE_ASM_WRITTEN (block
))
854 pp_string (pp
, "[written] ");
856 if (flags
& TDF_SLIM
)
859 if (BLOCK_SOURCE_LOCATION (block
))
860 dump_location (pp
, BLOCK_SOURCE_LOCATION (block
));
862 newline_and_indent (pp
, spc
+ 2);
864 if (BLOCK_SUPERCONTEXT (block
))
866 pp_string (pp
, "SUPERCONTEXT: ");
867 dump_generic_node (pp
, BLOCK_SUPERCONTEXT (block
), 0,
868 flags
| TDF_SLIM
, false);
869 newline_and_indent (pp
, spc
+ 2);
872 if (BLOCK_SUBBLOCKS (block
))
874 pp_string (pp
, "SUBBLOCKS: ");
875 for (t
= BLOCK_SUBBLOCKS (block
); t
; t
= BLOCK_CHAIN (t
))
877 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
880 newline_and_indent (pp
, spc
+ 2);
883 if (BLOCK_CHAIN (block
))
885 pp_string (pp
, "SIBLINGS: ");
886 for (t
= BLOCK_CHAIN (block
); t
; t
= BLOCK_CHAIN (t
))
888 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
891 newline_and_indent (pp
, spc
+ 2);
894 if (BLOCK_VARS (block
))
896 pp_string (pp
, "VARS: ");
897 for (t
= BLOCK_VARS (block
); t
; t
= TREE_CHAIN (t
))
899 dump_generic_node (pp
, t
, 0, flags
, false);
902 newline_and_indent (pp
, spc
+ 2);
905 if (vec_safe_length (BLOCK_NONLOCALIZED_VARS (block
)) > 0)
908 vec
<tree
, va_gc
> *nlv
= BLOCK_NONLOCALIZED_VARS (block
);
910 pp_string (pp
, "NONLOCALIZED_VARS: ");
911 FOR_EACH_VEC_ELT (*nlv
, i
, t
)
913 dump_generic_node (pp
, t
, 0, flags
, false);
916 newline_and_indent (pp
, spc
+ 2);
919 if (BLOCK_ABSTRACT_ORIGIN (block
))
921 pp_string (pp
, "ABSTRACT_ORIGIN: ");
922 dump_generic_node (pp
, BLOCK_ABSTRACT_ORIGIN (block
), 0,
923 flags
| TDF_SLIM
, false);
924 newline_and_indent (pp
, spc
+ 2);
927 if (BLOCK_FRAGMENT_ORIGIN (block
))
929 pp_string (pp
, "FRAGMENT_ORIGIN: ");
930 dump_generic_node (pp
, BLOCK_FRAGMENT_ORIGIN (block
), 0,
931 flags
| TDF_SLIM
, false);
932 newline_and_indent (pp
, spc
+ 2);
935 if (BLOCK_FRAGMENT_CHAIN (block
))
937 pp_string (pp
, "FRAGMENT_CHAIN: ");
938 for (t
= BLOCK_FRAGMENT_CHAIN (block
); t
; t
= BLOCK_FRAGMENT_CHAIN (t
))
940 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
943 newline_and_indent (pp
, spc
+ 2);
948 /* Dump the node NODE on the pretty_printer PP, SPC spaces of
949 indent. FLAGS specifies details to show in the dump (see TDF_* in
950 dumpfile.h). If IS_STMT is true, the object printed is considered
951 to be a statement and it is terminated by ';' if appropriate. */
954 dump_generic_node (pretty_printer
*pp
, tree node
, int spc
, int flags
,
963 if (node
== NULL_TREE
)
966 is_expr
= EXPR_P (node
);
968 if (is_stmt
&& (flags
& TDF_STMTADDR
))
969 pp_printf (pp
, "<&%p> ", (void *)node
);
971 if ((flags
& TDF_LINENO
) && EXPR_HAS_LOCATION (node
))
972 dump_location (pp
, EXPR_LOCATION (node
));
974 code
= TREE_CODE (node
);
978 pp_string (pp
, "<<< error >>>");
981 case IDENTIFIER_NODE
:
982 pp_tree_identifier (pp
, node
);
986 while (node
&& node
!= error_mark_node
)
988 if (TREE_PURPOSE (node
))
990 dump_generic_node (pp
, TREE_PURPOSE (node
), spc
, flags
, false);
993 dump_generic_node (pp
, TREE_VALUE (node
), spc
, flags
, false);
994 node
= TREE_CHAIN (node
);
995 if (node
&& TREE_CODE (node
) == TREE_LIST
)
1004 dump_generic_node (pp
, BINFO_TYPE (node
), spc
, flags
, false);
1010 if (TREE_VEC_LENGTH (node
) > 0)
1012 size_t len
= TREE_VEC_LENGTH (node
);
1013 for (i
= 0; i
< len
- 1; i
++)
1015 dump_generic_node (pp
, TREE_VEC_ELT (node
, i
), spc
, flags
,
1020 dump_generic_node (pp
, TREE_VEC_ELT (node
, len
- 1), spc
,
1027 case POINTER_BOUNDS_TYPE
:
1030 case FIXED_POINT_TYPE
:
1036 unsigned int quals
= TYPE_QUALS (node
);
1037 enum tree_code_class tclass
;
1039 if (quals
& TYPE_QUAL_ATOMIC
)
1040 pp_string (pp
, "atomic ");
1041 if (quals
& TYPE_QUAL_CONST
)
1042 pp_string (pp
, "const ");
1043 else if (quals
& TYPE_QUAL_VOLATILE
)
1044 pp_string (pp
, "volatile ");
1045 else if (quals
& TYPE_QUAL_RESTRICT
)
1046 pp_string (pp
, "restrict ");
1048 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
1050 pp_string (pp
, "<address-space-");
1051 pp_decimal_int (pp
, TYPE_ADDR_SPACE (node
));
1052 pp_string (pp
, "> ");
1055 tclass
= TREE_CODE_CLASS (TREE_CODE (node
));
1057 if (tclass
== tcc_declaration
)
1059 if (DECL_NAME (node
))
1060 dump_decl_name (pp
, node
, flags
);
1062 pp_string (pp
, "<unnamed type decl>");
1064 else if (tclass
== tcc_type
)
1066 if (TYPE_NAME (node
))
1068 if (TREE_CODE (TYPE_NAME (node
)) == IDENTIFIER_NODE
)
1069 pp_tree_identifier (pp
, TYPE_NAME (node
));
1070 else if (TREE_CODE (TYPE_NAME (node
)) == TYPE_DECL
1071 && DECL_NAME (TYPE_NAME (node
)))
1072 dump_decl_name (pp
, TYPE_NAME (node
), flags
);
1074 pp_string (pp
, "<unnamed type>");
1076 else if (TREE_CODE (node
) == VECTOR_TYPE
)
1078 pp_string (pp
, "vector");
1080 pp_wide_integer (pp
, TYPE_VECTOR_SUBPARTS (node
));
1081 pp_string (pp
, ") ");
1082 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1084 else if (TREE_CODE (node
) == INTEGER_TYPE
)
1086 if (TYPE_PRECISION (node
) == CHAR_TYPE_SIZE
)
1087 pp_string (pp
, (TYPE_UNSIGNED (node
)
1090 else if (TYPE_PRECISION (node
) == SHORT_TYPE_SIZE
)
1091 pp_string (pp
, (TYPE_UNSIGNED (node
)
1094 else if (TYPE_PRECISION (node
) == INT_TYPE_SIZE
)
1095 pp_string (pp
, (TYPE_UNSIGNED (node
)
1098 else if (TYPE_PRECISION (node
) == LONG_TYPE_SIZE
)
1099 pp_string (pp
, (TYPE_UNSIGNED (node
)
1102 else if (TYPE_PRECISION (node
) == LONG_LONG_TYPE_SIZE
)
1103 pp_string (pp
, (TYPE_UNSIGNED (node
)
1104 ? "unsigned long long"
1105 : "signed long long"));
1106 else if (TYPE_PRECISION (node
) >= CHAR_TYPE_SIZE
1107 && exact_log2 (TYPE_PRECISION (node
)) != -1)
1109 pp_string (pp
, (TYPE_UNSIGNED (node
) ? "uint" : "int"));
1110 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1111 pp_string (pp
, "_t");
1115 pp_string (pp
, (TYPE_UNSIGNED (node
)
1116 ? "<unnamed-unsigned:"
1117 : "<unnamed-signed:"));
1118 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1122 else if (TREE_CODE (node
) == COMPLEX_TYPE
)
1124 pp_string (pp
, "__complex__ ");
1125 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1127 else if (TREE_CODE (node
) == REAL_TYPE
)
1129 pp_string (pp
, "<float:");
1130 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1133 else if (TREE_CODE (node
) == FIXED_POINT_TYPE
)
1135 pp_string (pp
, "<fixed-point-");
1136 pp_string (pp
, TYPE_SATURATING (node
) ? "sat:" : "nonsat:");
1137 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1140 else if (TREE_CODE (node
) == VOID_TYPE
)
1141 pp_string (pp
, "void");
1143 pp_string (pp
, "<unnamed type>");
1149 case REFERENCE_TYPE
:
1150 str
= (TREE_CODE (node
) == POINTER_TYPE
? "*" : "&");
1152 if (TREE_TYPE (node
) == NULL
)
1154 pp_string (pp
, str
);
1155 pp_string (pp
, "<null type>");
1157 else if (TREE_CODE (TREE_TYPE (node
)) == FUNCTION_TYPE
)
1159 tree fnode
= TREE_TYPE (node
);
1161 dump_generic_node (pp
, TREE_TYPE (fnode
), spc
, flags
, false);
1164 pp_string (pp
, str
);
1165 if (TYPE_NAME (node
) && DECL_NAME (TYPE_NAME (node
)))
1166 dump_decl_name (pp
, TYPE_NAME (node
), flags
);
1167 else if (flags
& TDF_NOUID
)
1168 pp_printf (pp
, "<Txxxx>");
1170 pp_printf (pp
, "<T%x>", TYPE_UID (node
));
1172 pp_right_paren (pp
);
1173 dump_function_declaration (pp
, fnode
, spc
, flags
);
1177 unsigned int quals
= TYPE_QUALS (node
);
1179 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1181 pp_string (pp
, str
);
1183 if (quals
& TYPE_QUAL_CONST
)
1184 pp_string (pp
, " const");
1185 if (quals
& TYPE_QUAL_VOLATILE
)
1186 pp_string (pp
, " volatile");
1187 if (quals
& TYPE_QUAL_RESTRICT
)
1188 pp_string (pp
, " restrict");
1190 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
1192 pp_string (pp
, " <address-space-");
1193 pp_decimal_int (pp
, TYPE_ADDR_SPACE (node
));
1197 if (TYPE_REF_CAN_ALIAS_ALL (node
))
1198 pp_string (pp
, " {ref-all}");
1208 if (integer_zerop (TREE_OPERAND (node
, 1))
1209 /* Dump the types of INTEGER_CSTs explicitly, for we can't
1210 infer them and MEM_ATTR caching will share MEM_REFs
1211 with differently-typed op0s. */
1212 && TREE_CODE (TREE_OPERAND (node
, 0)) != INTEGER_CST
1213 /* Released SSA_NAMES have no TREE_TYPE. */
1214 && TREE_TYPE (TREE_OPERAND (node
, 0)) != NULL_TREE
1215 /* Same pointer types, but ignoring POINTER_TYPE vs.
1217 && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 0)))
1218 == TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 1))))
1219 && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (node
, 0)))
1220 == TYPE_MODE (TREE_TYPE (TREE_OPERAND (node
, 1))))
1221 && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node
, 0)))
1222 == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node
, 1))))
1223 /* Same value types ignoring qualifiers. */
1224 && (TYPE_MAIN_VARIANT (TREE_TYPE (node
))
1225 == TYPE_MAIN_VARIANT
1226 (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 1)))))
1227 && (!(flags
& TDF_ALIAS
)
1228 || MR_DEPENDENCE_CLIQUE (node
) == 0))
1230 if (TREE_CODE (TREE_OPERAND (node
, 0)) != ADDR_EXPR
)
1233 dump_generic_node (pp
, TREE_OPERAND (node
, 0),
1237 dump_generic_node (pp
,
1238 TREE_OPERAND (TREE_OPERAND (node
, 0), 0),
1245 pp_string (pp
, "MEM[");
1247 ptype
= TYPE_MAIN_VARIANT (TREE_TYPE (TREE_OPERAND (node
, 1)));
1248 dump_generic_node (pp
, ptype
,
1249 spc
, flags
| TDF_SLIM
, false);
1250 pp_right_paren (pp
);
1251 dump_generic_node (pp
, TREE_OPERAND (node
, 0),
1253 if (!integer_zerop (TREE_OPERAND (node
, 1)))
1255 pp_string (pp
, " + ");
1256 dump_generic_node (pp
, TREE_OPERAND (node
, 1),
1259 if ((flags
& TDF_ALIAS
)
1260 && MR_DEPENDENCE_CLIQUE (node
) != 0)
1262 pp_string (pp
, " clique ");
1263 pp_unsigned_wide_integer (pp
, MR_DEPENDENCE_CLIQUE (node
));
1264 pp_string (pp
, " base ");
1265 pp_unsigned_wide_integer (pp
, MR_DEPENDENCE_BASE (node
));
1267 pp_right_bracket (pp
);
1272 case TARGET_MEM_REF
:
1274 const char *sep
= "";
1277 pp_string (pp
, "MEM[");
1279 if (TREE_CODE (TMR_BASE (node
)) == ADDR_EXPR
)
1281 pp_string (pp
, sep
);
1283 pp_string (pp
, "symbol: ");
1284 dump_generic_node (pp
, TREE_OPERAND (TMR_BASE (node
), 0),
1289 pp_string (pp
, sep
);
1291 pp_string (pp
, "base: ");
1292 dump_generic_node (pp
, TMR_BASE (node
), spc
, flags
, false);
1294 tmp
= TMR_INDEX2 (node
);
1297 pp_string (pp
, sep
);
1299 pp_string (pp
, "base: ");
1300 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1302 tmp
= TMR_INDEX (node
);
1305 pp_string (pp
, sep
);
1307 pp_string (pp
, "index: ");
1308 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1310 tmp
= TMR_STEP (node
);
1313 pp_string (pp
, sep
);
1315 pp_string (pp
, "step: ");
1316 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1318 tmp
= TMR_OFFSET (node
);
1321 pp_string (pp
, sep
);
1323 pp_string (pp
, "offset: ");
1324 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1326 pp_right_bracket (pp
);
1334 /* Print the innermost component type. */
1335 for (tmp
= TREE_TYPE (node
); TREE_CODE (tmp
) == ARRAY_TYPE
;
1336 tmp
= TREE_TYPE (tmp
))
1338 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1340 /* Print the dimensions. */
1341 for (tmp
= node
; TREE_CODE (tmp
) == ARRAY_TYPE
; tmp
= TREE_TYPE (tmp
))
1342 dump_array_domain (pp
, TYPE_DOMAIN (tmp
), spc
, flags
);
1348 case QUAL_UNION_TYPE
:
1350 unsigned int quals
= TYPE_QUALS (node
);
1352 if (quals
& TYPE_QUAL_ATOMIC
)
1353 pp_string (pp
, "atomic ");
1354 if (quals
& TYPE_QUAL_CONST
)
1355 pp_string (pp
, "const ");
1356 if (quals
& TYPE_QUAL_VOLATILE
)
1357 pp_string (pp
, "volatile ");
1359 /* Print the name of the structure. */
1360 if (TREE_CODE (node
) == RECORD_TYPE
)
1361 pp_string (pp
, "struct ");
1362 else if (TREE_CODE (node
) == UNION_TYPE
)
1363 pp_string (pp
, "union ");
1365 if (TYPE_NAME (node
))
1366 dump_generic_node (pp
, TYPE_NAME (node
), spc
, flags
, false);
1367 else if (!(flags
& TDF_SLIM
))
1368 /* FIXME: If we eliminate the 'else' above and attempt
1369 to show the fields for named types, we may get stuck
1370 following a cycle of pointers to structs. The alleged
1371 self-reference check in print_struct_decl will not detect
1372 cycles involving more than one pointer or struct type. */
1373 print_struct_decl (pp
, node
, spc
, flags
);
1382 if (TREE_CODE (TREE_TYPE (node
)) == POINTER_TYPE
)
1384 /* In the case of a pointer, one may want to divide by the
1385 size of the pointed-to type. Unfortunately, this not
1386 straightforward. The C front-end maps expressions
1391 in such a way that the two INTEGER_CST nodes for "5" have
1392 different values but identical types. In the latter
1393 case, the 5 is multiplied by sizeof (int) in c-common.c
1394 (pointer_int_sum) to convert it to a byte address, and
1395 yet the type of the node is left unchanged. Argh. What
1396 is consistent though is that the number value corresponds
1397 to bytes (UNITS) offset.
1399 NB: Neither of the following divisors can be trivially
1400 used to recover the original literal:
1402 TREE_INT_CST_LOW (TYPE_SIZE_UNIT (TREE_TYPE (node)))
1403 TYPE_PRECISION (TREE_TYPE (TREE_TYPE (node))) */
1404 pp_wide_integer (pp
, TREE_INT_CST_LOW (node
));
1405 pp_string (pp
, "B"); /* pseudo-unit */
1407 else if (tree_fits_shwi_p (node
))
1408 pp_wide_integer (pp
, tree_to_shwi (node
));
1409 else if (tree_fits_uhwi_p (node
))
1410 pp_unsigned_wide_integer (pp
, tree_to_uhwi (node
));
1413 wide_int val
= node
;
1415 if (wi::neg_p (val
, TYPE_SIGN (TREE_TYPE (node
))))
1420 print_hex (val
, pp_buffer (pp
)->digit_buffer
);
1421 pp_string (pp
, pp_buffer (pp
)->digit_buffer
);
1423 if (TREE_OVERFLOW (node
))
1424 pp_string (pp
, "(OVF)");
1428 /* Code copied from print_node. */
1431 if (TREE_OVERFLOW (node
))
1432 pp_string (pp
, " overflow");
1434 #if !defined(REAL_IS_NOT_DOUBLE) || defined(REAL_ARITHMETIC)
1435 d
= TREE_REAL_CST (node
);
1436 if (REAL_VALUE_ISINF (d
))
1437 pp_string (pp
, REAL_VALUE_NEGATIVE (d
) ? " -Inf" : " Inf");
1438 else if (REAL_VALUE_ISNAN (d
))
1439 pp_string (pp
, " Nan");
1443 real_to_decimal (string
, &d
, sizeof (string
), 0, 1);
1444 pp_string (pp
, string
);
1449 unsigned char *p
= (unsigned char *) &TREE_REAL_CST (node
);
1450 pp_string (pp
, "0x");
1451 for (i
= 0; i
< sizeof TREE_REAL_CST (node
); i
++)
1452 output_formatted_integer (pp
, "%02x", *p
++);
1461 fixed_to_decimal (string
, TREE_FIXED_CST_PTR (node
), sizeof (string
));
1462 pp_string (pp
, string
);
1467 pp_string (pp
, "__complex__ (");
1468 dump_generic_node (pp
, TREE_REALPART (node
), spc
, flags
, false);
1469 pp_string (pp
, ", ");
1470 dump_generic_node (pp
, TREE_IMAGPART (node
), spc
, flags
, false);
1471 pp_right_paren (pp
);
1475 pp_string (pp
, "\"");
1476 pretty_print_string (pp
, TREE_STRING_POINTER (node
));
1477 pp_string (pp
, "\"");
1483 pp_string (pp
, "{ ");
1484 for (i
= 0; i
< VECTOR_CST_NELTS (node
); ++i
)
1487 pp_string (pp
, ", ");
1488 dump_generic_node (pp
, VECTOR_CST_ELT (node
, i
),
1491 pp_string (pp
, " }");
1497 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1499 if (TREE_CODE (node
) == METHOD_TYPE
)
1501 if (TYPE_METHOD_BASETYPE (node
))
1502 dump_decl_name (pp
, TYPE_NAME (TYPE_METHOD_BASETYPE (node
)),
1505 pp_string (pp
, "<null method basetype>");
1506 pp_colon_colon (pp
);
1508 if (TYPE_NAME (node
) && DECL_NAME (TYPE_NAME (node
)))
1509 dump_decl_name (pp
, TYPE_NAME (node
), flags
);
1510 else if (flags
& TDF_NOUID
)
1511 pp_printf (pp
, "<Txxxx>");
1513 pp_printf (pp
, "<T%x>", TYPE_UID (node
));
1514 dump_function_declaration (pp
, node
, spc
, flags
);
1519 dump_decl_name (pp
, node
, flags
);
1523 if (DECL_NAME (node
))
1524 dump_decl_name (pp
, node
, flags
);
1525 else if (LABEL_DECL_UID (node
) != -1)
1526 pp_printf (pp
, "<L%d>", (int) LABEL_DECL_UID (node
));
1529 if (flags
& TDF_NOUID
)
1530 pp_string (pp
, "<D.xxxx>");
1532 pp_printf (pp
, "<D.%u>", DECL_UID (node
));
1537 if (DECL_IS_BUILTIN (node
))
1539 /* Don't print the declaration of built-in types. */
1542 if (DECL_NAME (node
))
1543 dump_decl_name (pp
, node
, flags
);
1544 else if (TYPE_NAME (TREE_TYPE (node
)) != node
)
1546 if ((TREE_CODE (TREE_TYPE (node
)) == RECORD_TYPE
1547 || TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
)
1548 && TYPE_METHODS (TREE_TYPE (node
)))
1550 /* The type is a c++ class: all structures have at least
1552 pp_string (pp
, "class ");
1553 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1558 (TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
1559 ? "union" : "struct "));
1560 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1564 pp_string (pp
, "<anon>");
1570 case DEBUG_EXPR_DECL
:
1571 case NAMESPACE_DECL
:
1573 dump_decl_name (pp
, node
, flags
);
1577 pp_string (pp
, "<retval>");
1581 op0
= TREE_OPERAND (node
, 0);
1584 && (TREE_CODE (op0
) == INDIRECT_REF
1585 || (TREE_CODE (op0
) == MEM_REF
1586 && TREE_CODE (TREE_OPERAND (op0
, 0)) != ADDR_EXPR
1587 && integer_zerop (TREE_OPERAND (op0
, 1))
1588 /* Dump the types of INTEGER_CSTs explicitly, for we
1589 can't infer them and MEM_ATTR caching will share
1590 MEM_REFs with differently-typed op0s. */
1591 && TREE_CODE (TREE_OPERAND (op0
, 0)) != INTEGER_CST
1592 /* Released SSA_NAMES have no TREE_TYPE. */
1593 && TREE_TYPE (TREE_OPERAND (op0
, 0)) != NULL_TREE
1594 /* Same pointer types, but ignoring POINTER_TYPE vs.
1596 && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 0)))
1597 == TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 1))))
1598 && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0
, 0)))
1599 == TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0
, 1))))
1600 && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0
, 0)))
1601 == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0
, 1))))
1602 /* Same value types ignoring qualifiers. */
1603 && (TYPE_MAIN_VARIANT (TREE_TYPE (op0
))
1604 == TYPE_MAIN_VARIANT
1605 (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 1)))))
1606 && MR_DEPENDENCE_CLIQUE (op0
) == 0)))
1608 op0
= TREE_OPERAND (op0
, 0);
1611 if (op_prio (op0
) < op_prio (node
))
1613 dump_generic_node (pp
, op0
, spc
, flags
, false);
1614 if (op_prio (op0
) < op_prio (node
))
1615 pp_right_paren (pp
);
1616 pp_string (pp
, str
);
1617 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1618 op0
= component_ref_field_offset (node
);
1619 if (op0
&& TREE_CODE (op0
) != INTEGER_CST
)
1621 pp_string (pp
, "{off: ");
1622 dump_generic_node (pp
, op0
, spc
, flags
, false);
1623 pp_right_brace (pp
);
1628 pp_string (pp
, "BIT_FIELD_REF <");
1629 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1630 pp_string (pp
, ", ");
1631 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1632 pp_string (pp
, ", ");
1633 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
1638 case ARRAY_RANGE_REF
:
1639 op0
= TREE_OPERAND (node
, 0);
1640 if (op_prio (op0
) < op_prio (node
))
1642 dump_generic_node (pp
, op0
, spc
, flags
, false);
1643 if (op_prio (op0
) < op_prio (node
))
1644 pp_right_paren (pp
);
1645 pp_left_bracket (pp
);
1646 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1647 if (TREE_CODE (node
) == ARRAY_RANGE_REF
)
1648 pp_string (pp
, " ...");
1649 pp_right_bracket (pp
);
1651 op0
= array_ref_low_bound (node
);
1652 op1
= array_ref_element_size (node
);
1654 if (!integer_zerop (op0
)
1655 || TREE_OPERAND (node
, 2)
1656 || TREE_OPERAND (node
, 3))
1658 pp_string (pp
, "{lb: ");
1659 dump_generic_node (pp
, op0
, spc
, flags
, false);
1660 pp_string (pp
, " sz: ");
1661 dump_generic_node (pp
, op1
, spc
, flags
, false);
1662 pp_right_brace (pp
);
1668 unsigned HOST_WIDE_INT ix
;
1670 bool is_struct_init
= false;
1671 bool is_array_init
= false;
1674 if (TREE_CLOBBER_P (node
))
1675 pp_string (pp
, "CLOBBER");
1676 else if (TREE_CODE (TREE_TYPE (node
)) == RECORD_TYPE
1677 || TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
)
1678 is_struct_init
= true;
1679 else if (TREE_CODE (TREE_TYPE (node
)) == ARRAY_TYPE
1680 && TYPE_DOMAIN (TREE_TYPE (node
))
1681 && TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
)))
1682 && TREE_CODE (TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
))))
1685 tree minv
= TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
)));
1686 is_array_init
= true;
1687 curidx
= wi::to_widest (minv
);
1689 FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (node
), ix
, field
, val
)
1696 dump_generic_node (pp
, field
, spc
, flags
, false);
1699 else if (is_array_init
1700 && (TREE_CODE (field
) != INTEGER_CST
1701 || curidx
!= wi::to_widest (field
)))
1703 pp_left_bracket (pp
);
1704 if (TREE_CODE (field
) == RANGE_EXPR
)
1706 dump_generic_node (pp
, TREE_OPERAND (field
, 0), spc
,
1708 pp_string (pp
, " ... ");
1709 dump_generic_node (pp
, TREE_OPERAND (field
, 1), spc
,
1711 if (TREE_CODE (TREE_OPERAND (field
, 1)) == INTEGER_CST
)
1712 curidx
= wi::to_widest (TREE_OPERAND (field
, 1));
1715 dump_generic_node (pp
, field
, spc
, flags
, false);
1716 if (TREE_CODE (field
) == INTEGER_CST
)
1717 curidx
= wi::to_widest (field
);
1718 pp_string (pp
, "]=");
1723 if (val
&& TREE_CODE (val
) == ADDR_EXPR
)
1724 if (TREE_CODE (TREE_OPERAND (val
, 0)) == FUNCTION_DECL
)
1725 val
= TREE_OPERAND (val
, 0);
1726 if (val
&& TREE_CODE (val
) == FUNCTION_DECL
)
1727 dump_decl_name (pp
, val
, flags
);
1729 dump_generic_node (pp
, val
, spc
, flags
, false);
1730 if (ix
!= vec_safe_length (CONSTRUCTOR_ELTS (node
)) - 1)
1736 pp_right_brace (pp
);
1743 if (flags
& TDF_SLIM
)
1745 pp_string (pp
, "<COMPOUND_EXPR>");
1749 dump_generic_node (pp
, TREE_OPERAND (node
, 0),
1750 spc
, flags
, !(flags
& TDF_SLIM
));
1751 if (flags
& TDF_SLIM
)
1752 newline_and_indent (pp
, spc
);
1759 for (tp
= &TREE_OPERAND (node
, 1);
1760 TREE_CODE (*tp
) == COMPOUND_EXPR
;
1761 tp
= &TREE_OPERAND (*tp
, 1))
1763 dump_generic_node (pp
, TREE_OPERAND (*tp
, 0),
1764 spc
, flags
, !(flags
& TDF_SLIM
));
1765 if (flags
& TDF_SLIM
)
1766 newline_and_indent (pp
, spc
);
1774 dump_generic_node (pp
, *tp
, spc
, flags
, !(flags
& TDF_SLIM
));
1778 case STATEMENT_LIST
:
1780 tree_stmt_iterator si
;
1783 if (flags
& TDF_SLIM
)
1785 pp_string (pp
, "<STATEMENT_LIST>");
1789 for (si
= tsi_start (node
); !tsi_end_p (si
); tsi_next (&si
))
1792 newline_and_indent (pp
, spc
);
1795 dump_generic_node (pp
, tsi_stmt (si
), spc
, flags
, true);
1802 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
,
1807 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
,
1812 pp_string (pp
, "TARGET_EXPR <");
1813 dump_generic_node (pp
, TARGET_EXPR_SLOT (node
), spc
, flags
, false);
1816 dump_generic_node (pp
, TARGET_EXPR_INITIAL (node
), spc
, flags
, false);
1821 print_declaration (pp
, DECL_EXPR_DECL (node
), spc
, flags
);
1826 if (TREE_TYPE (node
) == NULL
|| TREE_TYPE (node
) == void_type_node
)
1828 pp_string (pp
, "if (");
1829 dump_generic_node (pp
, COND_EXPR_COND (node
), spc
, flags
, false);
1830 pp_right_paren (pp
);
1831 /* The lowered cond_exprs should always be printed in full. */
1832 if (COND_EXPR_THEN (node
)
1833 && (IS_EMPTY_STMT (COND_EXPR_THEN (node
))
1834 || TREE_CODE (COND_EXPR_THEN (node
)) == GOTO_EXPR
)
1835 && COND_EXPR_ELSE (node
)
1836 && (IS_EMPTY_STMT (COND_EXPR_ELSE (node
))
1837 || TREE_CODE (COND_EXPR_ELSE (node
)) == GOTO_EXPR
))
1840 dump_generic_node (pp
, COND_EXPR_THEN (node
),
1842 if (!IS_EMPTY_STMT (COND_EXPR_ELSE (node
)))
1844 pp_string (pp
, " else ");
1845 dump_generic_node (pp
, COND_EXPR_ELSE (node
),
1849 else if (!(flags
& TDF_SLIM
))
1851 /* Output COND_EXPR_THEN. */
1852 if (COND_EXPR_THEN (node
))
1854 newline_and_indent (pp
, spc
+2);
1856 newline_and_indent (pp
, spc
+4);
1857 dump_generic_node (pp
, COND_EXPR_THEN (node
), spc
+4,
1859 newline_and_indent (pp
, spc
+2);
1860 pp_right_brace (pp
);
1863 /* Output COND_EXPR_ELSE. */
1864 if (COND_EXPR_ELSE (node
)
1865 && !IS_EMPTY_STMT (COND_EXPR_ELSE (node
)))
1867 newline_and_indent (pp
, spc
);
1868 pp_string (pp
, "else");
1869 newline_and_indent (pp
, spc
+2);
1871 newline_and_indent (pp
, spc
+4);
1872 dump_generic_node (pp
, COND_EXPR_ELSE (node
), spc
+4,
1874 newline_and_indent (pp
, spc
+2);
1875 pp_right_brace (pp
);
1882 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1886 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1890 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
1896 if (!(flags
& TDF_SLIM
))
1898 if (BIND_EXPR_VARS (node
))
1902 for (op0
= BIND_EXPR_VARS (node
); op0
; op0
= DECL_CHAIN (op0
))
1904 print_declaration (pp
, op0
, spc
+2, flags
);
1909 newline_and_indent (pp
, spc
+2);
1910 dump_generic_node (pp
, BIND_EXPR_BODY (node
), spc
+2, flags
, true);
1911 newline_and_indent (pp
, spc
);
1912 pp_right_brace (pp
);
1918 if (CALL_EXPR_FN (node
) != NULL_TREE
)
1919 print_call_name (pp
, CALL_EXPR_FN (node
), flags
);
1921 pp_string (pp
, internal_fn_name (CALL_EXPR_IFN (node
)));
1923 /* Print parameters. */
1928 call_expr_arg_iterator iter
;
1929 FOR_EACH_CALL_EXPR_ARG (arg
, iter
, node
)
1931 dump_generic_node (pp
, arg
, spc
, flags
, false);
1932 if (more_call_expr_args_p (&iter
))
1939 if (CALL_EXPR_VA_ARG_PACK (node
))
1941 if (call_expr_nargs (node
) > 0)
1946 pp_string (pp
, "__builtin_va_arg_pack ()");
1948 pp_right_paren (pp
);
1950 op1
= CALL_EXPR_STATIC_CHAIN (node
);
1953 pp_string (pp
, " [static-chain: ");
1954 dump_generic_node (pp
, op1
, spc
, flags
, false);
1955 pp_right_bracket (pp
);
1958 if (CALL_EXPR_RETURN_SLOT_OPT (node
))
1959 pp_string (pp
, " [return slot optimization]");
1960 if (CALL_EXPR_TAILCALL (node
))
1961 pp_string (pp
, " [tail call]");
1964 case WITH_CLEANUP_EXPR
:
1968 case CLEANUP_POINT_EXPR
:
1969 pp_string (pp
, "<<cleanup_point ");
1970 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1971 pp_string (pp
, ">>");
1974 case PLACEHOLDER_EXPR
:
1975 pp_string (pp
, "<PLACEHOLDER_EXPR ");
1976 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1980 /* Binary arithmetic and logic expressions. */
1981 case WIDEN_SUM_EXPR
:
1982 case WIDEN_MULT_EXPR
:
1984 case MULT_HIGHPART_EXPR
:
1986 case POINTER_PLUS_EXPR
:
1988 case TRUNC_DIV_EXPR
:
1990 case FLOOR_DIV_EXPR
:
1991 case ROUND_DIV_EXPR
:
1992 case TRUNC_MOD_EXPR
:
1994 case FLOOR_MOD_EXPR
:
1995 case ROUND_MOD_EXPR
:
1997 case EXACT_DIV_EXPR
:
2002 case WIDEN_LSHIFT_EXPR
:
2006 case TRUTH_ANDIF_EXPR
:
2007 case TRUTH_ORIF_EXPR
:
2008 case TRUTH_AND_EXPR
:
2010 case TRUTH_XOR_EXPR
:
2024 case UNORDERED_EXPR
:
2026 const char *op
= op_symbol (node
);
2027 op0
= TREE_OPERAND (node
, 0);
2028 op1
= TREE_OPERAND (node
, 1);
2030 /* When the operands are expressions with less priority,
2031 keep semantics of the tree representation. */
2032 if (op_prio (op0
) <= op_prio (node
))
2035 dump_generic_node (pp
, op0
, spc
, flags
, false);
2036 pp_right_paren (pp
);
2039 dump_generic_node (pp
, op0
, spc
, flags
, false);
2045 /* When the operands are expressions with less priority,
2046 keep semantics of the tree representation. */
2047 if (op_prio (op1
) <= op_prio (node
))
2050 dump_generic_node (pp
, op1
, spc
, flags
, false);
2051 pp_right_paren (pp
);
2054 dump_generic_node (pp
, op1
, spc
, flags
, false);
2058 /* Unary arithmetic and logic expressions. */
2061 case TRUTH_NOT_EXPR
:
2063 case PREDECREMENT_EXPR
:
2064 case PREINCREMENT_EXPR
:
2066 if (TREE_CODE (node
) == ADDR_EXPR
2067 && (TREE_CODE (TREE_OPERAND (node
, 0)) == STRING_CST
2068 || TREE_CODE (TREE_OPERAND (node
, 0)) == FUNCTION_DECL
))
2069 ; /* Do not output '&' for strings and function pointers. */
2071 pp_string (pp
, op_symbol (node
));
2073 if (op_prio (TREE_OPERAND (node
, 0)) < op_prio (node
))
2076 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2077 pp_right_paren (pp
);
2080 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2083 case POSTDECREMENT_EXPR
:
2084 case POSTINCREMENT_EXPR
:
2085 if (op_prio (TREE_OPERAND (node
, 0)) < op_prio (node
))
2088 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2089 pp_right_paren (pp
);
2092 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2093 pp_string (pp
, op_symbol (node
));
2097 pp_string (pp
, "MIN_EXPR <");
2098 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2099 pp_string (pp
, ", ");
2100 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2105 pp_string (pp
, "MAX_EXPR <");
2106 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2107 pp_string (pp
, ", ");
2108 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2113 pp_string (pp
, "ABS_EXPR <");
2114 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2122 case ADDR_SPACE_CONVERT_EXPR
:
2123 case FIXED_CONVERT_EXPR
:
2124 case FIX_TRUNC_EXPR
:
2127 type
= TREE_TYPE (node
);
2128 op0
= TREE_OPERAND (node
, 0);
2129 if (type
!= TREE_TYPE (op0
))
2132 dump_generic_node (pp
, type
, spc
, flags
, false);
2133 pp_string (pp
, ") ");
2135 if (op_prio (op0
) < op_prio (node
))
2137 dump_generic_node (pp
, op0
, spc
, flags
, false);
2138 if (op_prio (op0
) < op_prio (node
))
2139 pp_right_paren (pp
);
2142 case VIEW_CONVERT_EXPR
:
2143 pp_string (pp
, "VIEW_CONVERT_EXPR<");
2144 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2145 pp_string (pp
, ">(");
2146 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2147 pp_right_paren (pp
);
2151 pp_string (pp
, "((");
2152 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2153 pp_string (pp
, "))");
2156 case NON_LVALUE_EXPR
:
2157 pp_string (pp
, "NON_LVALUE_EXPR <");
2158 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2163 pp_string (pp
, "SAVE_EXPR <");
2164 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2169 pp_string (pp
, "COMPLEX_EXPR <");
2170 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2171 pp_string (pp
, ", ");
2172 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2177 pp_string (pp
, "CONJ_EXPR <");
2178 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2183 pp_string (pp
, "REALPART_EXPR <");
2184 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2189 pp_string (pp
, "IMAGPART_EXPR <");
2190 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2195 pp_string (pp
, "VA_ARG_EXPR <");
2196 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2200 case TRY_FINALLY_EXPR
:
2201 case TRY_CATCH_EXPR
:
2202 pp_string (pp
, "try");
2203 newline_and_indent (pp
, spc
+2);
2205 newline_and_indent (pp
, spc
+4);
2206 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
+4, flags
, true);
2207 newline_and_indent (pp
, spc
+2);
2208 pp_right_brace (pp
);
2209 newline_and_indent (pp
, spc
);
2211 (TREE_CODE (node
) == TRY_CATCH_EXPR
) ? "catch" : "finally");
2212 newline_and_indent (pp
, spc
+2);
2214 newline_and_indent (pp
, spc
+4);
2215 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
+4, flags
, true);
2216 newline_and_indent (pp
, spc
+2);
2217 pp_right_brace (pp
);
2222 pp_string (pp
, "catch (");
2223 dump_generic_node (pp
, CATCH_TYPES (node
), spc
+2, flags
, false);
2224 pp_right_paren (pp
);
2225 newline_and_indent (pp
, spc
+2);
2227 newline_and_indent (pp
, spc
+4);
2228 dump_generic_node (pp
, CATCH_BODY (node
), spc
+4, flags
, true);
2229 newline_and_indent (pp
, spc
+2);
2230 pp_right_brace (pp
);
2234 case EH_FILTER_EXPR
:
2235 pp_string (pp
, "<<<eh_filter (");
2236 dump_generic_node (pp
, EH_FILTER_TYPES (node
), spc
+2, flags
, false);
2237 pp_string (pp
, ")>>>");
2238 newline_and_indent (pp
, spc
+2);
2240 newline_and_indent (pp
, spc
+4);
2241 dump_generic_node (pp
, EH_FILTER_FAILURE (node
), spc
+4, flags
, true);
2242 newline_and_indent (pp
, spc
+2);
2243 pp_right_brace (pp
);
2248 op0
= TREE_OPERAND (node
, 0);
2249 /* If this is for break or continue, don't bother printing it. */
2250 if (DECL_NAME (op0
))
2252 const char *name
= IDENTIFIER_POINTER (DECL_NAME (op0
));
2253 if (strcmp (name
, "break") == 0
2254 || strcmp (name
, "continue") == 0)
2257 dump_generic_node (pp
, op0
, spc
, flags
, false);
2259 if (DECL_NONLOCAL (op0
))
2260 pp_string (pp
, " [non-local]");
2264 pp_string (pp
, "while (1)");
2265 if (!(flags
& TDF_SLIM
))
2267 newline_and_indent (pp
, spc
+2);
2269 newline_and_indent (pp
, spc
+4);
2270 dump_generic_node (pp
, LOOP_EXPR_BODY (node
), spc
+4, flags
, true);
2271 newline_and_indent (pp
, spc
+2);
2272 pp_right_brace (pp
);
2278 pp_string (pp
, "// predicted ");
2279 if (PREDICT_EXPR_OUTCOME (node
))
2280 pp_string (pp
, "likely by ");
2282 pp_string (pp
, "unlikely by ");
2283 pp_string (pp
, predictor_name (PREDICT_EXPR_PREDICTOR (node
)));
2284 pp_string (pp
, " predictor.");
2288 pp_string (pp
, "ANNOTATE_EXPR <");
2289 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2290 switch ((enum annot_expr_kind
) TREE_INT_CST_LOW (TREE_OPERAND (node
, 1)))
2292 case annot_expr_ivdep_kind
:
2293 pp_string (pp
, ", ivdep");
2295 case annot_expr_no_vector_kind
:
2296 pp_string (pp
, ", no-vector");
2298 case annot_expr_vector_kind
:
2299 pp_string (pp
, ", vector");
2308 pp_string (pp
, "return");
2309 op0
= TREE_OPERAND (node
, 0);
2313 if (TREE_CODE (op0
) == MODIFY_EXPR
)
2314 dump_generic_node (pp
, TREE_OPERAND (op0
, 1),
2317 dump_generic_node (pp
, op0
, spc
, flags
, false);
2322 pp_string (pp
, "if (");
2323 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2324 pp_string (pp
, ") break");
2328 pp_string (pp
, "switch (");
2329 dump_generic_node (pp
, SWITCH_COND (node
), spc
, flags
, false);
2330 pp_right_paren (pp
);
2331 if (!(flags
& TDF_SLIM
))
2333 newline_and_indent (pp
, spc
+2);
2335 if (SWITCH_BODY (node
))
2337 newline_and_indent (pp
, spc
+4);
2338 dump_generic_node (pp
, SWITCH_BODY (node
), spc
+4, flags
,
2343 tree vec
= SWITCH_LABELS (node
);
2344 size_t i
, n
= TREE_VEC_LENGTH (vec
);
2345 for (i
= 0; i
< n
; ++i
)
2347 tree elt
= TREE_VEC_ELT (vec
, i
);
2348 newline_and_indent (pp
, spc
+4);
2351 dump_generic_node (pp
, elt
, spc
+4, flags
, false);
2352 pp_string (pp
, " goto ");
2353 dump_generic_node (pp
, CASE_LABEL (elt
), spc
+4,
2358 pp_string (pp
, "case ???: goto ???;");
2361 newline_and_indent (pp
, spc
+2);
2362 pp_right_brace (pp
);
2368 op0
= GOTO_DESTINATION (node
);
2369 if (TREE_CODE (op0
) != SSA_NAME
&& DECL_P (op0
) && DECL_NAME (op0
))
2371 const char *name
= IDENTIFIER_POINTER (DECL_NAME (op0
));
2372 if (strcmp (name
, "break") == 0
2373 || strcmp (name
, "continue") == 0)
2375 pp_string (pp
, name
);
2379 pp_string (pp
, "goto ");
2380 dump_generic_node (pp
, op0
, spc
, flags
, false);
2384 pp_string (pp
, "__asm__");
2385 if (ASM_VOLATILE_P (node
))
2386 pp_string (pp
, " __volatile__");
2388 dump_generic_node (pp
, ASM_STRING (node
), spc
, flags
, false);
2390 dump_generic_node (pp
, ASM_OUTPUTS (node
), spc
, flags
, false);
2392 dump_generic_node (pp
, ASM_INPUTS (node
), spc
, flags
, false);
2393 if (ASM_CLOBBERS (node
))
2396 dump_generic_node (pp
, ASM_CLOBBERS (node
), spc
, flags
, false);
2398 pp_right_paren (pp
);
2401 case CASE_LABEL_EXPR
:
2402 if (CASE_LOW (node
) && CASE_HIGH (node
))
2404 pp_string (pp
, "case ");
2405 dump_generic_node (pp
, CASE_LOW (node
), spc
, flags
, false);
2406 pp_string (pp
, " ... ");
2407 dump_generic_node (pp
, CASE_HIGH (node
), spc
, flags
, false);
2409 else if (CASE_LOW (node
))
2411 pp_string (pp
, "case ");
2412 dump_generic_node (pp
, CASE_LOW (node
), spc
, flags
, false);
2415 pp_string (pp
, "default");
2420 pp_string (pp
, "OBJ_TYPE_REF(");
2421 dump_generic_node (pp
, OBJ_TYPE_REF_EXPR (node
), spc
, flags
, false);
2423 if (!(flags
& TDF_SLIM
) && virtual_method_call_p (node
))
2425 pp_string (pp
, "(");
2426 dump_generic_node (pp
, obj_type_ref_class (node
), spc
, flags
, false);
2427 pp_string (pp
, ")");
2429 dump_generic_node (pp
, OBJ_TYPE_REF_OBJECT (node
), spc
, flags
, false);
2431 dump_generic_node (pp
, OBJ_TYPE_REF_TOKEN (node
), spc
, flags
, false);
2432 pp_right_paren (pp
);
2436 if (SSA_NAME_IDENTIFIER (node
))
2437 dump_generic_node (pp
, SSA_NAME_IDENTIFIER (node
),
2440 pp_decimal_int (pp
, SSA_NAME_VERSION (node
));
2441 if (SSA_NAME_IS_DEFAULT_DEF (node
))
2442 pp_string (pp
, "(D)");
2443 if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (node
))
2444 pp_string (pp
, "(ab)");
2447 case WITH_SIZE_EXPR
:
2448 pp_string (pp
, "WITH_SIZE_EXPR <");
2449 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2450 pp_string (pp
, ", ");
2451 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2456 pp_string (pp
, "ASSERT_EXPR <");
2457 dump_generic_node (pp
, ASSERT_EXPR_VAR (node
), spc
, flags
, false);
2458 pp_string (pp
, ", ");
2459 dump_generic_node (pp
, ASSERT_EXPR_COND (node
), spc
, flags
, false);
2464 pp_string (pp
, "scev_known");
2467 case SCEV_NOT_KNOWN
:
2468 pp_string (pp
, "scev_not_known");
2471 case POLYNOMIAL_CHREC
:
2473 dump_generic_node (pp
, CHREC_LEFT (node
), spc
, flags
, false);
2474 pp_string (pp
, ", +, ");
2475 dump_generic_node (pp
, CHREC_RIGHT (node
), spc
, flags
, false);
2476 pp_string (pp
, "}_");
2477 dump_generic_node (pp
, CHREC_VAR (node
), spc
, flags
, false);
2481 case REALIGN_LOAD_EXPR
:
2482 pp_string (pp
, "REALIGN_LOAD <");
2483 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2484 pp_string (pp
, ", ");
2485 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2486 pp_string (pp
, ", ");
2487 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2492 pp_string (pp
, " VEC_COND_EXPR < ");
2493 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2494 pp_string (pp
, " , ");
2495 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2496 pp_string (pp
, " , ");
2497 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2498 pp_string (pp
, " > ");
2502 pp_string (pp
, " VEC_PERM_EXPR < ");
2503 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2504 pp_string (pp
, " , ");
2505 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2506 pp_string (pp
, " , ");
2507 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2508 pp_string (pp
, " > ");
2512 pp_string (pp
, " DOT_PROD_EXPR < ");
2513 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2514 pp_string (pp
, ", ");
2515 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2516 pp_string (pp
, ", ");
2517 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2518 pp_string (pp
, " > ");
2521 case WIDEN_MULT_PLUS_EXPR
:
2522 pp_string (pp
, " WIDEN_MULT_PLUS_EXPR < ");
2523 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2524 pp_string (pp
, ", ");
2525 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2526 pp_string (pp
, ", ");
2527 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2528 pp_string (pp
, " > ");
2531 case WIDEN_MULT_MINUS_EXPR
:
2532 pp_string (pp
, " WIDEN_MULT_MINUS_EXPR < ");
2533 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2534 pp_string (pp
, ", ");
2535 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2536 pp_string (pp
, ", ");
2537 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2538 pp_string (pp
, " > ");
2542 pp_string (pp
, " FMA_EXPR < ");
2543 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2544 pp_string (pp
, ", ");
2545 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2546 pp_string (pp
, ", ");
2547 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2548 pp_string (pp
, " > ");
2552 pp_string (pp
, "#pragma acc parallel");
2553 dump_omp_clauses (pp
, OACC_PARALLEL_CLAUSES (node
), spc
, flags
);
2557 pp_string (pp
, "#pragma acc kernels");
2558 dump_omp_clauses (pp
, OACC_KERNELS_CLAUSES (node
), spc
, flags
);
2562 pp_string (pp
, "#pragma acc data");
2563 dump_omp_clauses (pp
, OACC_DATA_CLAUSES (node
), spc
, flags
);
2566 case OACC_HOST_DATA
:
2567 pp_string (pp
, "#pragma acc host_data");
2568 dump_omp_clauses (pp
, OACC_HOST_DATA_CLAUSES (node
), spc
, flags
);
2572 pp_string (pp
, "#pragma acc declare");
2573 dump_omp_clauses (pp
, OACC_DECLARE_CLAUSES (node
), spc
, flags
);
2577 pp_string (pp
, "#pragma acc update");
2578 dump_omp_clauses (pp
, OACC_UPDATE_CLAUSES (node
), spc
, flags
);
2581 case OACC_ENTER_DATA
:
2582 pp_string (pp
, "#pragma acc enter data");
2583 dump_omp_clauses (pp
, OACC_ENTER_DATA_CLAUSES (node
), spc
, flags
);
2586 case OACC_EXIT_DATA
:
2587 pp_string (pp
, "#pragma acc exit data");
2588 dump_omp_clauses (pp
, OACC_EXIT_DATA_CLAUSES (node
), spc
, flags
);
2592 pp_string (pp
, "#pragma acc cache");
2593 dump_omp_clauses (pp
, OACC_CACHE_CLAUSES (node
), spc
, flags
);
2597 pp_string (pp
, "#pragma omp parallel");
2598 dump_omp_clauses (pp
, OMP_PARALLEL_CLAUSES (node
), spc
, flags
);
2601 if (!(flags
& TDF_SLIM
) && OMP_BODY (node
))
2603 newline_and_indent (pp
, spc
+ 2);
2605 newline_and_indent (pp
, spc
+ 4);
2606 dump_generic_node (pp
, OMP_BODY (node
), spc
+ 4, flags
, false);
2607 newline_and_indent (pp
, spc
+ 2);
2608 pp_right_brace (pp
);
2614 pp_string (pp
, "#pragma omp task");
2615 dump_omp_clauses (pp
, OMP_TASK_CLAUSES (node
), spc
, flags
);
2619 pp_string (pp
, "#pragma omp for");
2623 pp_string (pp
, "#pragma omp simd");
2627 pp_string (pp
, "#pragma simd");
2631 /* This label points one line after dumping the clauses.
2632 For _Cilk_for the clauses are dumped after the _Cilk_for (...)
2633 parameters are printed out. */
2634 goto dump_omp_loop_cilk_for
;
2636 case OMP_DISTRIBUTE
:
2637 pp_string (pp
, "#pragma omp distribute");
2641 pp_string (pp
, "#pragma acc loop");
2645 pp_string (pp
, "#pragma omp teams");
2646 dump_omp_clauses (pp
, OMP_TEAMS_CLAUSES (node
), spc
, flags
);
2649 case OMP_TARGET_DATA
:
2650 pp_string (pp
, "#pragma omp target data");
2651 dump_omp_clauses (pp
, OMP_TARGET_DATA_CLAUSES (node
), spc
, flags
);
2655 pp_string (pp
, "#pragma omp target");
2656 dump_omp_clauses (pp
, OMP_TARGET_CLAUSES (node
), spc
, flags
);
2659 case OMP_TARGET_UPDATE
:
2660 pp_string (pp
, "#pragma omp target update");
2661 dump_omp_clauses (pp
, OMP_TARGET_UPDATE_CLAUSES (node
), spc
, flags
);
2666 dump_omp_clauses (pp
, OMP_FOR_CLAUSES (node
), spc
, flags
);
2668 dump_omp_loop_cilk_for
:
2669 if (!(flags
& TDF_SLIM
))
2673 if (OMP_FOR_PRE_BODY (node
))
2675 if (TREE_CODE (node
) == CILK_FOR
)
2676 pp_string (pp
, " ");
2678 newline_and_indent (pp
, spc
+ 2);
2681 newline_and_indent (pp
, spc
);
2682 dump_generic_node (pp
, OMP_FOR_PRE_BODY (node
),
2685 if (OMP_FOR_INIT (node
))
2688 for (i
= 0; i
< TREE_VEC_LENGTH (OMP_FOR_INIT (node
)); i
++)
2691 if (TREE_CODE (node
) != CILK_FOR
|| OMP_FOR_PRE_BODY (node
))
2692 newline_and_indent (pp
, spc
);
2693 if (TREE_CODE (node
) == CILK_FOR
)
2694 pp_string (pp
, "_Cilk_for (");
2696 pp_string (pp
, "for (");
2697 dump_generic_node (pp
,
2698 TREE_VEC_ELT (OMP_FOR_INIT (node
), i
),
2700 pp_string (pp
, "; ");
2701 dump_generic_node (pp
,
2702 TREE_VEC_ELT (OMP_FOR_COND (node
), i
),
2704 pp_string (pp
, "; ");
2705 dump_generic_node (pp
,
2706 TREE_VEC_ELT (OMP_FOR_INCR (node
), i
),
2708 pp_right_paren (pp
);
2710 if (TREE_CODE (node
) == CILK_FOR
)
2711 dump_omp_clauses (pp
, OMP_FOR_CLAUSES (node
), spc
, flags
);
2713 if (OMP_FOR_BODY (node
))
2715 newline_and_indent (pp
, spc
+ 2);
2717 newline_and_indent (pp
, spc
+ 4);
2718 dump_generic_node (pp
, OMP_FOR_BODY (node
), spc
+ 4, flags
,
2720 newline_and_indent (pp
, spc
+ 2);
2721 pp_right_brace (pp
);
2723 if (OMP_FOR_INIT (node
))
2724 spc
-= 2 * TREE_VEC_LENGTH (OMP_FOR_INIT (node
)) - 2;
2725 if (OMP_FOR_PRE_BODY (node
))
2728 newline_and_indent (pp
, spc
+ 2);
2729 pp_right_brace (pp
);
2736 pp_string (pp
, "#pragma omp sections");
2737 dump_omp_clauses (pp
, OMP_SECTIONS_CLAUSES (node
), spc
, flags
);
2741 pp_string (pp
, "#pragma omp section");
2745 pp_string (pp
, "#pragma omp master");
2749 pp_string (pp
, "#pragma omp taskgroup");
2753 pp_string (pp
, "#pragma omp ordered");
2757 pp_string (pp
, "#pragma omp critical");
2758 if (OMP_CRITICAL_NAME (node
))
2762 dump_generic_node (pp
, OMP_CRITICAL_NAME (node
), spc
,
2764 pp_right_paren (pp
);
2769 pp_string (pp
, "#pragma omp atomic");
2770 if (OMP_ATOMIC_SEQ_CST (node
))
2771 pp_string (pp
, " seq_cst");
2772 newline_and_indent (pp
, spc
+ 2);
2773 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2777 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2780 case OMP_ATOMIC_READ
:
2781 pp_string (pp
, "#pragma omp atomic read");
2782 if (OMP_ATOMIC_SEQ_CST (node
))
2783 pp_string (pp
, " seq_cst");
2784 newline_and_indent (pp
, spc
+ 2);
2785 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2789 case OMP_ATOMIC_CAPTURE_OLD
:
2790 case OMP_ATOMIC_CAPTURE_NEW
:
2791 pp_string (pp
, "#pragma omp atomic capture");
2792 if (OMP_ATOMIC_SEQ_CST (node
))
2793 pp_string (pp
, " seq_cst");
2794 newline_and_indent (pp
, spc
+ 2);
2795 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2799 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2803 pp_string (pp
, "#pragma omp single");
2804 dump_omp_clauses (pp
, OMP_SINGLE_CLAUSES (node
), spc
, flags
);
2808 dump_omp_clause (pp
, node
, spc
, flags
);
2812 case TRANSACTION_EXPR
:
2813 if (TRANSACTION_EXPR_OUTER (node
))
2814 pp_string (pp
, "__transaction_atomic [[outer]]");
2815 else if (TRANSACTION_EXPR_RELAXED (node
))
2816 pp_string (pp
, "__transaction_relaxed");
2818 pp_string (pp
, "__transaction_atomic");
2819 if (!(flags
& TDF_SLIM
) && TRANSACTION_EXPR_BODY (node
))
2821 newline_and_indent (pp
, spc
);
2823 newline_and_indent (pp
, spc
+ 2);
2824 dump_generic_node (pp
, TRANSACTION_EXPR_BODY (node
),
2825 spc
+ 2, flags
, false);
2826 newline_and_indent (pp
, spc
);
2827 pp_right_brace (pp
);
2832 case REDUC_MAX_EXPR
:
2833 pp_string (pp
, " REDUC_MAX_EXPR < ");
2834 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2835 pp_string (pp
, " > ");
2838 case REDUC_MIN_EXPR
:
2839 pp_string (pp
, " REDUC_MIN_EXPR < ");
2840 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2841 pp_string (pp
, " > ");
2844 case REDUC_PLUS_EXPR
:
2845 pp_string (pp
, " REDUC_PLUS_EXPR < ");
2846 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2847 pp_string (pp
, " > ");
2850 case VEC_WIDEN_MULT_HI_EXPR
:
2851 case VEC_WIDEN_MULT_LO_EXPR
:
2852 case VEC_WIDEN_MULT_EVEN_EXPR
:
2853 case VEC_WIDEN_MULT_ODD_EXPR
:
2854 case VEC_WIDEN_LSHIFT_HI_EXPR
:
2855 case VEC_WIDEN_LSHIFT_LO_EXPR
:
2857 for (str
= get_tree_code_name (code
); *str
; str
++)
2858 pp_character (pp
, TOUPPER (*str
));
2859 pp_string (pp
, " < ");
2860 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2861 pp_string (pp
, ", ");
2862 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2863 pp_string (pp
, " > ");
2866 case VEC_UNPACK_HI_EXPR
:
2867 pp_string (pp
, " VEC_UNPACK_HI_EXPR < ");
2868 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2869 pp_string (pp
, " > ");
2872 case VEC_UNPACK_LO_EXPR
:
2873 pp_string (pp
, " VEC_UNPACK_LO_EXPR < ");
2874 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2875 pp_string (pp
, " > ");
2878 case VEC_UNPACK_FLOAT_HI_EXPR
:
2879 pp_string (pp
, " VEC_UNPACK_FLOAT_HI_EXPR < ");
2880 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2881 pp_string (pp
, " > ");
2884 case VEC_UNPACK_FLOAT_LO_EXPR
:
2885 pp_string (pp
, " VEC_UNPACK_FLOAT_LO_EXPR < ");
2886 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2887 pp_string (pp
, " > ");
2890 case VEC_PACK_TRUNC_EXPR
:
2891 pp_string (pp
, " VEC_PACK_TRUNC_EXPR < ");
2892 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2893 pp_string (pp
, ", ");
2894 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2895 pp_string (pp
, " > ");
2898 case VEC_PACK_SAT_EXPR
:
2899 pp_string (pp
, " VEC_PACK_SAT_EXPR < ");
2900 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2901 pp_string (pp
, ", ");
2902 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2903 pp_string (pp
, " > ");
2906 case VEC_PACK_FIX_TRUNC_EXPR
:
2907 pp_string (pp
, " VEC_PACK_FIX_TRUNC_EXPR < ");
2908 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2909 pp_string (pp
, ", ");
2910 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2911 pp_string (pp
, " > ");
2915 dump_block_node (pp
, node
, spc
, flags
);
2918 case CILK_SPAWN_STMT
:
2919 pp_string (pp
, "_Cilk_spawn ");
2920 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2923 case CILK_SYNC_STMT
:
2924 pp_string (pp
, "_Cilk_sync");
2931 if (is_stmt
&& is_expr
)
2937 /* Print the declaration of a variable. */
2940 print_declaration (pretty_printer
*pp
, tree t
, int spc
, int flags
)
2944 if (TREE_CODE(t
) == NAMELIST_DECL
)
2946 pp_string(pp
, "namelist ");
2947 dump_decl_name (pp
, t
, flags
);
2952 if (TREE_CODE (t
) == TYPE_DECL
)
2953 pp_string (pp
, "typedef ");
2955 if (CODE_CONTAINS_STRUCT (TREE_CODE (t
), TS_DECL_WRTL
) && DECL_REGISTER (t
))
2956 pp_string (pp
, "register ");
2958 if (TREE_PUBLIC (t
) && DECL_EXTERNAL (t
))
2959 pp_string (pp
, "extern ");
2960 else if (TREE_STATIC (t
))
2961 pp_string (pp
, "static ");
2963 /* Print the type and name. */
2964 if (TREE_TYPE (t
) && TREE_CODE (TREE_TYPE (t
)) == ARRAY_TYPE
)
2968 /* Print array's type. */
2969 tmp
= TREE_TYPE (t
);
2970 while (TREE_CODE (TREE_TYPE (tmp
)) == ARRAY_TYPE
)
2971 tmp
= TREE_TYPE (tmp
);
2972 dump_generic_node (pp
, TREE_TYPE (tmp
), spc
, flags
, false);
2974 /* Print variable's name. */
2976 dump_generic_node (pp
, t
, spc
, flags
, false);
2978 /* Print the dimensions. */
2979 tmp
= TREE_TYPE (t
);
2980 while (TREE_CODE (tmp
) == ARRAY_TYPE
)
2982 dump_array_domain (pp
, TYPE_DOMAIN (tmp
), spc
, flags
);
2983 tmp
= TREE_TYPE (tmp
);
2986 else if (TREE_CODE (t
) == FUNCTION_DECL
)
2988 dump_generic_node (pp
, TREE_TYPE (TREE_TYPE (t
)), spc
, flags
, false);
2990 dump_decl_name (pp
, t
, flags
);
2991 dump_function_declaration (pp
, TREE_TYPE (t
), spc
, flags
);
2995 /* Print type declaration. */
2996 dump_generic_node (pp
, TREE_TYPE (t
), spc
, flags
, false);
2998 /* Print variable's name. */
3000 dump_generic_node (pp
, t
, spc
, flags
, false);
3003 if (TREE_CODE (t
) == VAR_DECL
&& DECL_HARD_REGISTER (t
))
3005 pp_string (pp
, " __asm__ ");
3007 dump_generic_node (pp
, DECL_ASSEMBLER_NAME (t
), spc
, flags
, false);
3008 pp_right_paren (pp
);
3011 /* The initial value of a function serves to determine whether the function
3012 is declared or defined. So the following does not apply to function
3014 if (TREE_CODE (t
) != FUNCTION_DECL
)
3016 /* Print the initial value. */
3017 if (DECL_INITIAL (t
))
3022 dump_generic_node (pp
, DECL_INITIAL (t
), spc
, flags
, false);
3026 if (TREE_CODE (t
) == VAR_DECL
&& DECL_HAS_VALUE_EXPR_P (t
))
3028 pp_string (pp
, " [value-expr: ");
3029 dump_generic_node (pp
, DECL_VALUE_EXPR (t
), spc
, flags
, false);
3030 pp_right_bracket (pp
);
3037 /* Prints a structure: name, fields, and methods.
3038 FIXME: Still incomplete. */
3041 print_struct_decl (pretty_printer
*pp
, const_tree node
, int spc
, int flags
)
3043 /* Print the name of the structure. */
3044 if (TYPE_NAME (node
))
3047 if (TREE_CODE (node
) == RECORD_TYPE
)
3048 pp_string (pp
, "struct ");
3049 else if ((TREE_CODE (node
) == UNION_TYPE
3050 || TREE_CODE (node
) == QUAL_UNION_TYPE
))
3051 pp_string (pp
, "union ");
3053 dump_generic_node (pp
, TYPE_NAME (node
), spc
, 0, false);
3056 /* Print the contents of the structure. */
3062 /* Print the fields of the structure. */
3065 tmp
= TYPE_FIELDS (node
);
3068 /* Avoid to print recursively the structure. */
3069 /* FIXME : Not implemented correctly...,
3070 what about the case when we have a cycle in the contain graph? ...
3071 Maybe this could be solved by looking at the scope in which the
3072 structure was declared. */
3073 if (TREE_TYPE (tmp
) != node
3074 && (TREE_CODE (TREE_TYPE (tmp
)) != POINTER_TYPE
3075 || TREE_TYPE (TREE_TYPE (tmp
)) != node
))
3077 print_declaration (pp
, tmp
, spc
+2, flags
);
3080 tmp
= DECL_CHAIN (tmp
);
3084 pp_right_brace (pp
);
3087 /* Return the priority of the operator CODE.
3089 From lowest to highest precedence with either left-to-right (L-R)
3090 or right-to-left (R-L) associativity]:
3093 2 [R-L] = += -= *= /= %= &= ^= |= <<= >>=
3105 14 [R-L] ! ~ ++ -- + - * & (type) sizeof
3106 15 [L-R] fn() [] -> .
3108 unary +, - and * have higher precedence than the corresponding binary
3112 op_code_prio (enum tree_code code
)
3129 case TRUTH_ORIF_EXPR
:
3132 case TRUTH_AND_EXPR
:
3133 case TRUTH_ANDIF_EXPR
:
3140 case TRUTH_XOR_EXPR
:
3157 case UNORDERED_EXPR
:
3168 case VEC_WIDEN_LSHIFT_HI_EXPR
:
3169 case VEC_WIDEN_LSHIFT_LO_EXPR
:
3170 case WIDEN_LSHIFT_EXPR
:
3173 case WIDEN_SUM_EXPR
:
3175 case POINTER_PLUS_EXPR
:
3179 case VEC_WIDEN_MULT_HI_EXPR
:
3180 case VEC_WIDEN_MULT_LO_EXPR
:
3181 case WIDEN_MULT_EXPR
:
3183 case WIDEN_MULT_PLUS_EXPR
:
3184 case WIDEN_MULT_MINUS_EXPR
:
3186 case MULT_HIGHPART_EXPR
:
3187 case TRUNC_DIV_EXPR
:
3189 case FLOOR_DIV_EXPR
:
3190 case ROUND_DIV_EXPR
:
3192 case EXACT_DIV_EXPR
:
3193 case TRUNC_MOD_EXPR
:
3195 case FLOOR_MOD_EXPR
:
3196 case ROUND_MOD_EXPR
:
3200 case TRUTH_NOT_EXPR
:
3202 case POSTINCREMENT_EXPR
:
3203 case POSTDECREMENT_EXPR
:
3204 case PREINCREMENT_EXPR
:
3205 case PREDECREMENT_EXPR
:
3211 case FIX_TRUNC_EXPR
:
3217 case ARRAY_RANGE_REF
:
3221 /* Special expressions. */
3227 case REDUC_MAX_EXPR
:
3228 case REDUC_MIN_EXPR
:
3229 case REDUC_PLUS_EXPR
:
3230 case VEC_UNPACK_HI_EXPR
:
3231 case VEC_UNPACK_LO_EXPR
:
3232 case VEC_UNPACK_FLOAT_HI_EXPR
:
3233 case VEC_UNPACK_FLOAT_LO_EXPR
:
3234 case VEC_PACK_TRUNC_EXPR
:
3235 case VEC_PACK_SAT_EXPR
:
3239 /* Return an arbitrarily high precedence to avoid surrounding single
3240 VAR_DECLs in ()s. */
3245 /* Return the priority of the operator OP. */
3248 op_prio (const_tree op
)
3250 enum tree_code code
;
3255 code
= TREE_CODE (op
);
3256 if (code
== SAVE_EXPR
|| code
== NON_LVALUE_EXPR
)
3257 return op_prio (TREE_OPERAND (op
, 0));
3259 return op_code_prio (code
);
3262 /* Return the symbol associated with operator CODE. */
3265 op_symbol_code (enum tree_code code
)
3273 case TRUTH_ORIF_EXPR
:
3276 case TRUTH_AND_EXPR
:
3277 case TRUTH_ANDIF_EXPR
:
3283 case TRUTH_XOR_EXPR
:
3293 case UNORDERED_EXPR
:
3339 case WIDEN_LSHIFT_EXPR
:
3342 case POINTER_PLUS_EXPR
:
3348 case REDUC_PLUS_EXPR
:
3351 case WIDEN_SUM_EXPR
:
3354 case WIDEN_MULT_EXPR
:
3357 case MULT_HIGHPART_EXPR
:
3367 case TRUTH_NOT_EXPR
:
3374 case TRUNC_DIV_EXPR
:
3381 case FLOOR_DIV_EXPR
:
3384 case ROUND_DIV_EXPR
:
3387 case EXACT_DIV_EXPR
:
3390 case TRUNC_MOD_EXPR
:
3396 case FLOOR_MOD_EXPR
:
3399 case ROUND_MOD_EXPR
:
3402 case PREDECREMENT_EXPR
:
3405 case PREINCREMENT_EXPR
:
3408 case POSTDECREMENT_EXPR
:
3411 case POSTINCREMENT_EXPR
:
3421 return "<<< ??? >>>";
3425 /* Return the symbol associated with operator OP. */
3428 op_symbol (const_tree op
)
3430 return op_symbol_code (TREE_CODE (op
));
3433 /* Prints the name of a call. NODE is the CALL_EXPR_FN of a CALL_EXPR or
3434 the gimple_call_fn of a GIMPLE_CALL. */
3437 print_call_name (pretty_printer
*pp
, tree node
, int flags
)
3441 if (TREE_CODE (op0
) == NON_LVALUE_EXPR
)
3442 op0
= TREE_OPERAND (op0
, 0);
3445 switch (TREE_CODE (op0
))
3450 dump_function_name (pp
, op0
, flags
);
3456 op0
= TREE_OPERAND (op0
, 0);
3461 dump_generic_node (pp
, TREE_OPERAND (op0
, 0), 0, flags
, false);
3462 pp_string (pp
, ") ? ");
3463 dump_generic_node (pp
, TREE_OPERAND (op0
, 1), 0, flags
, false);
3464 pp_string (pp
, " : ");
3465 dump_generic_node (pp
, TREE_OPERAND (op0
, 2), 0, flags
, false);
3469 if (TREE_CODE (TREE_OPERAND (op0
, 0)) == VAR_DECL
)
3470 dump_function_name (pp
, TREE_OPERAND (op0
, 0), flags
);
3472 dump_generic_node (pp
, op0
, 0, flags
, false);
3476 if (integer_zerop (TREE_OPERAND (op0
, 1)))
3478 op0
= TREE_OPERAND (op0
, 0);
3485 dump_generic_node (pp
, op0
, 0, flags
, false);
3493 /* Parses the string STR and replaces new-lines by '\n', tabs by '\t', ... */
3496 pretty_print_string (pretty_printer
*pp
, const char *str
)
3506 pp_string (pp
, "\\b");
3510 pp_string (pp
, "\\f");
3514 pp_string (pp
, "\\n");
3518 pp_string (pp
, "\\r");
3522 pp_string (pp
, "\\t");
3526 pp_string (pp
, "\\v");
3530 pp_string (pp
, "\\\\");
3534 pp_string (pp
, "\\\"");
3538 pp_string (pp
, "\\'");
3541 /* No need to handle \0; the loop terminates on \0. */
3544 pp_string (pp
, "\\1");
3548 pp_string (pp
, "\\2");
3552 pp_string (pp
, "\\3");
3556 pp_string (pp
, "\\4");
3560 pp_string (pp
, "\\5");
3564 pp_string (pp
, "\\6");
3568 pp_string (pp
, "\\7");
3572 pp_character (pp
, str
[0]);
3580 maybe_init_pretty_print (FILE *file
)
3584 tree_pp
= new pretty_printer ();
3585 pp_needs_newline (tree_pp
) = true;
3586 pp_translate_identifiers (tree_pp
) = false;
3589 tree_pp
->buffer
->stream
= file
;
3593 newline_and_indent (pretty_printer
*pp
, int spc
)
3599 /* Handle a %K format for TEXT. Separate from default_tree_printer so
3600 it can also be used in front ends.
3601 %K: a statement, from which EXPR_LOCATION and TREE_BLOCK will be recorded.
3605 percent_K_format (text_info
*text
)
3607 tree t
= va_arg (*text
->args_ptr
, tree
), block
;
3608 text
->set_location (0, EXPR_LOCATION (t
));
3609 gcc_assert (pp_ti_abstract_origin (text
) != NULL
);
3610 block
= TREE_BLOCK (t
);
3611 *pp_ti_abstract_origin (text
) = NULL
;
3615 /* ??? LTO drops all BLOCK_ABSTRACT_ORIGINs apart from those
3616 representing the outermost block of an inlined function.
3617 So walk the BLOCK tree until we hit such a scope. */
3619 && TREE_CODE (block
) == BLOCK
)
3621 if (inlined_function_outer_scope_p (block
))
3623 *pp_ti_abstract_origin (text
) = block
;
3626 block
= BLOCK_SUPERCONTEXT (block
);
3632 && TREE_CODE (block
) == BLOCK
3633 && BLOCK_ABSTRACT_ORIGIN (block
))
3635 tree ao
= BLOCK_ABSTRACT_ORIGIN (block
);
3637 while (TREE_CODE (ao
) == BLOCK
3638 && BLOCK_ABSTRACT_ORIGIN (ao
)
3639 && BLOCK_ABSTRACT_ORIGIN (ao
) != ao
)
3640 ao
= BLOCK_ABSTRACT_ORIGIN (ao
);
3642 if (TREE_CODE (ao
) == FUNCTION_DECL
)
3644 *pp_ti_abstract_origin (text
) = block
;
3647 block
= BLOCK_SUPERCONTEXT (block
);
3651 /* Print the identifier ID to PRETTY-PRINTER. */
3654 pp_tree_identifier (pretty_printer
*pp
, tree id
)
3656 if (pp_translate_identifiers (pp
))
3658 const char *text
= identifier_to_locale (IDENTIFIER_POINTER (id
));
3659 pp_append_text (pp
, text
, text
+ strlen (text
));
3662 pp_append_text (pp
, IDENTIFIER_POINTER (id
),
3663 IDENTIFIER_POINTER (id
) + IDENTIFIER_LENGTH (id
));
3666 /* A helper function that is used to dump function information before the
3670 dump_function_header (FILE *dump_file
, tree fdecl
, int flags
)
3672 const char *dname
, *aname
;
3673 struct cgraph_node
*node
= cgraph_node::get (fdecl
);
3674 struct function
*fun
= DECL_STRUCT_FUNCTION (fdecl
);
3676 dname
= lang_hooks
.decl_printable_name (fdecl
, 2);
3678 if (DECL_ASSEMBLER_NAME_SET_P (fdecl
))
3679 aname
= (IDENTIFIER_POINTER
3680 (DECL_ASSEMBLER_NAME (fdecl
)));
3682 aname
= "<unset-asm-name>";
3684 fprintf (dump_file
, "\n;; Function %s (%s, funcdef_no=%d",
3685 dname
, aname
, fun
->funcdef_no
);
3686 if (!(flags
& TDF_NOUID
))
3687 fprintf (dump_file
, ", decl_uid=%d", DECL_UID (fdecl
));
3690 fprintf (dump_file
, ", cgraph_uid=%d", node
->uid
);
3691 fprintf (dump_file
, ", symbol_order=%d)%s\n\n", node
->order
,
3692 node
->frequency
== NODE_FREQUENCY_HOT
3694 : node
->frequency
== NODE_FREQUENCY_UNLIKELY_EXECUTED
3695 ? " (unlikely executed)"
3696 : node
->frequency
== NODE_FREQUENCY_EXECUTED_ONCE
3697 ? " (executed once)"
3701 fprintf (dump_file
, ")\n\n");
3704 /* Dump double_int D to pretty_printer PP. UNS is true
3705 if D is unsigned and false otherwise. */
3707 pp_double_int (pretty_printer
*pp
, double_int d
, bool uns
)
3710 pp_wide_integer (pp
, d
.low
);
3711 else if (d
.fits_uhwi ())
3712 pp_unsigned_wide_integer (pp
, d
.low
);
3715 unsigned HOST_WIDE_INT low
= d
.low
;
3716 HOST_WIDE_INT high
= d
.high
;
3717 if (!uns
&& d
.is_negative ())
3720 high
= ~high
+ !low
;
3723 /* Would "%x%0*x" or "%x%*0x" get zero-padding on all
3725 sprintf (pp_buffer (pp
)->digit_buffer
,
3726 HOST_WIDE_INT_PRINT_DOUBLE_HEX
,
3727 (unsigned HOST_WIDE_INT
) high
, low
);
3728 pp_string (pp
, pp_buffer (pp
)->digit_buffer
);