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"
31 #include "insn-config.h"
40 #include "tree-pretty-print.h"
41 #include "gimple-expr.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"
50 #include "gomp-constants.h"
52 /* Local functions, macros and variables. */
53 static const char *op_symbol (const_tree
);
54 static void pretty_print_string (pretty_printer
*, const char*);
55 static void newline_and_indent (pretty_printer
*, int);
56 static void maybe_init_pretty_print (FILE *);
57 static void print_struct_decl (pretty_printer
*, const_tree
, int, int);
58 static void do_niy (pretty_printer
*, const_tree
);
60 #define INDENT(SPACE) do { \
61 int i; for (i = 0; i<SPACE; i++) pp_space (pp); } while (0)
63 #define NIY do_niy (pp, node)
65 static pretty_printer
*tree_pp
;
67 /* Try to print something for an unknown tree code. */
70 do_niy (pretty_printer
*pp
, const_tree node
)
74 pp_string (pp
, "<<< Unknown tree: ");
75 pp_string (pp
, get_tree_code_name (TREE_CODE (node
)));
79 len
= TREE_OPERAND_LENGTH (node
);
80 for (i
= 0; i
< len
; ++i
)
82 newline_and_indent (pp
, 2);
83 dump_generic_node (pp
, TREE_OPERAND (node
, i
), 2, 0, false);
87 pp_string (pp
, " >>>");
90 /* Debugging function to print out a generic expression. */
93 debug_generic_expr (tree t
)
95 print_generic_expr (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
);
96 fprintf (stderr
, "\n");
99 /* Debugging function to print out a generic statement. */
102 debug_generic_stmt (tree t
)
104 print_generic_stmt (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
);
105 fprintf (stderr
, "\n");
108 /* Debugging function to print out a chain of trees . */
111 debug_tree_chain (tree t
)
117 print_generic_expr (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
|TDF_UID
);
118 fprintf (stderr
, " ");
122 fprintf (stderr
, "... [cycled back to ");
123 print_generic_expr (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
|TDF_UID
);
124 fprintf (stderr
, "]");
128 fprintf (stderr
, "\n");
131 /* Prints declaration DECL to the FILE with details specified by FLAGS. */
133 print_generic_decl (FILE *file
, tree decl
, int flags
)
135 maybe_init_pretty_print (file
);
136 print_declaration (tree_pp
, decl
, 2, flags
);
137 pp_write_text_to_stream (tree_pp
);
140 /* Print tree T, and its successors, on file FILE. FLAGS specifies details
141 to show in the dump. See TDF_* in dumpfile.h. */
144 print_generic_stmt (FILE *file
, tree t
, int flags
)
146 maybe_init_pretty_print (file
);
147 dump_generic_node (tree_pp
, t
, 0, flags
, true);
148 pp_newline_and_flush (tree_pp
);
151 /* Print tree T, and its successors, on file FILE. FLAGS specifies details
152 to show in the dump. See TDF_* in dumpfile.h. The output is indented by
156 print_generic_stmt_indented (FILE *file
, tree t
, int flags
, int indent
)
160 maybe_init_pretty_print (file
);
162 for (i
= 0; i
< indent
; i
++)
164 dump_generic_node (tree_pp
, t
, indent
, flags
, true);
165 pp_newline_and_flush (tree_pp
);
168 /* Print a single expression T on file FILE. FLAGS specifies details to show
169 in the dump. See TDF_* in dumpfile.h. */
172 print_generic_expr (FILE *file
, tree t
, int flags
)
174 maybe_init_pretty_print (file
);
175 dump_generic_node (tree_pp
, t
, 0, flags
, false);
179 /* Dump the name of a _DECL node and its DECL_UID if TDF_UID is set
183 dump_decl_name (pretty_printer
*pp
, tree node
, int flags
)
185 if (DECL_NAME (node
))
187 if ((flags
& TDF_ASMNAME
) && DECL_ASSEMBLER_NAME_SET_P (node
))
188 pp_tree_identifier (pp
, DECL_ASSEMBLER_NAME (node
));
190 pp_tree_identifier (pp
, DECL_NAME (node
));
192 if ((flags
& TDF_UID
) || DECL_NAME (node
) == NULL_TREE
)
194 if (TREE_CODE (node
) == LABEL_DECL
&& LABEL_DECL_UID (node
) != -1)
195 pp_printf (pp
, "L.%d", (int) LABEL_DECL_UID (node
));
196 else if (TREE_CODE (node
) == DEBUG_EXPR_DECL
)
198 if (flags
& TDF_NOUID
)
199 pp_string (pp
, "D#xxxx");
201 pp_printf (pp
, "D#%i", DEBUG_TEMP_UID (node
));
205 char c
= TREE_CODE (node
) == CONST_DECL
? 'C' : 'D';
206 if (flags
& TDF_NOUID
)
207 pp_printf (pp
, "%c.xxxx", c
);
209 pp_printf (pp
, "%c.%u", c
, DECL_UID (node
));
212 if ((flags
& TDF_ALIAS
) && DECL_PT_UID (node
) != DECL_UID (node
))
214 if (flags
& TDF_NOUID
)
215 pp_printf (pp
, "ptD.xxxx");
217 pp_printf (pp
, "ptD.%u", DECL_PT_UID (node
));
221 /* Like the above, but used for pretty printing function calls. */
224 dump_function_name (pretty_printer
*pp
, tree node
, int flags
)
226 if (CONVERT_EXPR_P (node
))
227 node
= TREE_OPERAND (node
, 0);
228 if (DECL_NAME (node
) && (flags
& TDF_ASMNAME
) == 0)
229 pp_string (pp
, lang_hooks
.decl_printable_name (node
, 1));
231 dump_decl_name (pp
, node
, flags
);
234 /* Dump a function declaration. NODE is the FUNCTION_TYPE. PP, SPC and
235 FLAGS are as in dump_generic_node. */
238 dump_function_declaration (pretty_printer
*pp
, tree node
,
241 bool wrote_arg
= false;
247 /* Print the argument types. */
248 arg
= TYPE_ARG_TYPES (node
);
249 while (arg
&& arg
!= void_list_node
&& arg
!= error_mark_node
)
257 dump_generic_node (pp
, TREE_VALUE (arg
), spc
, flags
, false);
258 arg
= TREE_CHAIN (arg
);
261 /* Drop the trailing void_type_node if we had any previous argument. */
262 if (arg
== void_list_node
&& !wrote_arg
)
263 pp_string (pp
, "void");
264 /* Properly dump vararg function types. */
265 else if (!arg
&& wrote_arg
)
266 pp_string (pp
, ", ...");
267 /* Avoid printing any arg for unprototyped functions. */
272 /* Dump the domain associated with an array. */
275 dump_array_domain (pretty_printer
*pp
, tree domain
, int spc
, int flags
)
277 pp_left_bracket (pp
);
280 tree min
= TYPE_MIN_VALUE (domain
);
281 tree max
= TYPE_MAX_VALUE (domain
);
284 && integer_zerop (min
)
285 && tree_fits_shwi_p (max
))
286 pp_wide_integer (pp
, tree_to_shwi (max
) + 1);
290 dump_generic_node (pp
, min
, spc
, flags
, false);
293 dump_generic_node (pp
, max
, spc
, flags
, false);
297 pp_string (pp
, "<unknown>");
298 pp_right_bracket (pp
);
302 /* Dump OpenMP clause CLAUSE. PP, CLAUSE, SPC and FLAGS are as in
303 dump_generic_node. */
306 dump_omp_clause (pretty_printer
*pp
, tree clause
, int spc
, int flags
)
310 switch (OMP_CLAUSE_CODE (clause
))
312 case OMP_CLAUSE_PRIVATE
:
315 case OMP_CLAUSE_SHARED
:
318 case OMP_CLAUSE_FIRSTPRIVATE
:
319 name
= "firstprivate";
321 case OMP_CLAUSE_LASTPRIVATE
:
322 name
= "lastprivate";
324 case OMP_CLAUSE_COPYIN
:
327 case OMP_CLAUSE_COPYPRIVATE
:
328 name
= "copyprivate";
330 case OMP_CLAUSE_UNIFORM
:
333 case OMP_CLAUSE__LOOPTEMP_
:
336 case OMP_CLAUSE_DEVICE_RESIDENT
:
337 name
= "device_resident";
339 case OMP_CLAUSE_USE_DEVICE
:
343 pp_string (pp
, name
);
345 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
350 case OMP_CLAUSE_REDUCTION
:
351 pp_string (pp
, "reduction(");
352 if (OMP_CLAUSE_REDUCTION_CODE (clause
) != ERROR_MARK
)
355 op_symbol_code (OMP_CLAUSE_REDUCTION_CODE (clause
)));
358 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
364 pp_string (pp
, "if(");
365 dump_generic_node (pp
, OMP_CLAUSE_IF_EXPR (clause
),
370 case OMP_CLAUSE_NUM_THREADS
:
371 pp_string (pp
, "num_threads(");
372 dump_generic_node (pp
, OMP_CLAUSE_NUM_THREADS_EXPR (clause
),
377 case OMP_CLAUSE__CILK_FOR_COUNT_
:
378 pp_string (pp
, "_Cilk_for_count_(");
379 dump_generic_node (pp
, OMP_CLAUSE_OPERAND (clause
, 0),
384 case OMP_CLAUSE_NOWAIT
:
385 pp_string (pp
, "nowait");
387 case OMP_CLAUSE_ORDERED
:
388 pp_string (pp
, "ordered");
391 case OMP_CLAUSE_DEFAULT
:
392 pp_string (pp
, "default(");
393 switch (OMP_CLAUSE_DEFAULT_KIND (clause
))
395 case OMP_CLAUSE_DEFAULT_UNSPECIFIED
:
397 case OMP_CLAUSE_DEFAULT_SHARED
:
398 pp_string (pp
, "shared");
400 case OMP_CLAUSE_DEFAULT_NONE
:
401 pp_string (pp
, "none");
403 case OMP_CLAUSE_DEFAULT_PRIVATE
:
404 pp_string (pp
, "private");
406 case OMP_CLAUSE_DEFAULT_FIRSTPRIVATE
:
407 pp_string (pp
, "firstprivate");
415 case OMP_CLAUSE_SCHEDULE
:
416 pp_string (pp
, "schedule(");
417 switch (OMP_CLAUSE_SCHEDULE_KIND (clause
))
419 case OMP_CLAUSE_SCHEDULE_STATIC
:
420 pp_string (pp
, "static");
422 case OMP_CLAUSE_SCHEDULE_DYNAMIC
:
423 pp_string (pp
, "dynamic");
425 case OMP_CLAUSE_SCHEDULE_GUIDED
:
426 pp_string (pp
, "guided");
428 case OMP_CLAUSE_SCHEDULE_RUNTIME
:
429 pp_string (pp
, "runtime");
431 case OMP_CLAUSE_SCHEDULE_AUTO
:
432 pp_string (pp
, "auto");
434 case OMP_CLAUSE_SCHEDULE_CILKFOR
:
435 pp_string (pp
, "cilk-for grain");
440 if (OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (clause
))
443 dump_generic_node (pp
, OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (clause
),
449 case OMP_CLAUSE_UNTIED
:
450 pp_string (pp
, "untied");
453 case OMP_CLAUSE_COLLAPSE
:
454 pp_string (pp
, "collapse(");
455 dump_generic_node (pp
, OMP_CLAUSE_COLLAPSE_EXPR (clause
),
460 case OMP_CLAUSE_FINAL
:
461 pp_string (pp
, "final(");
462 dump_generic_node (pp
, OMP_CLAUSE_FINAL_EXPR (clause
),
467 case OMP_CLAUSE_MERGEABLE
:
468 pp_string (pp
, "mergeable");
471 case OMP_CLAUSE_LINEAR
:
472 pp_string (pp
, "linear(");
473 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
476 dump_generic_node (pp
, OMP_CLAUSE_LINEAR_STEP (clause
),
481 case OMP_CLAUSE_ALIGNED
:
482 pp_string (pp
, "aligned(");
483 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
485 if (OMP_CLAUSE_ALIGNED_ALIGNMENT (clause
))
488 dump_generic_node (pp
, OMP_CLAUSE_ALIGNED_ALIGNMENT (clause
),
494 case OMP_CLAUSE_DEPEND
:
495 pp_string (pp
, "depend(");
496 switch (OMP_CLAUSE_DEPEND_KIND (clause
))
498 case OMP_CLAUSE_DEPEND_IN
:
499 pp_string (pp
, "in");
501 case OMP_CLAUSE_DEPEND_OUT
:
502 pp_string (pp
, "out");
504 case OMP_CLAUSE_DEPEND_INOUT
:
505 pp_string (pp
, "inout");
511 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
517 pp_string (pp
, "map(");
518 switch (OMP_CLAUSE_MAP_KIND (clause
))
521 case GOMP_MAP_POINTER
:
522 pp_string (pp
, "alloc");
525 case GOMP_MAP_TO_PSET
:
526 pp_string (pp
, "to");
529 pp_string (pp
, "from");
531 case GOMP_MAP_TOFROM
:
532 pp_string (pp
, "tofrom");
534 case GOMP_MAP_FORCE_ALLOC
:
535 pp_string (pp
, "force_alloc");
537 case GOMP_MAP_FORCE_TO
:
538 pp_string (pp
, "force_to");
540 case GOMP_MAP_FORCE_FROM
:
541 pp_string (pp
, "force_from");
543 case GOMP_MAP_FORCE_TOFROM
:
544 pp_string (pp
, "force_tofrom");
546 case GOMP_MAP_FORCE_PRESENT
:
547 pp_string (pp
, "force_present");
549 case GOMP_MAP_FORCE_DEALLOC
:
550 pp_string (pp
, "force_dealloc");
552 case GOMP_MAP_FORCE_DEVICEPTR
:
553 pp_string (pp
, "force_deviceptr");
559 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
562 if (OMP_CLAUSE_SIZE (clause
))
564 if (OMP_CLAUSE_CODE (clause
) == OMP_CLAUSE_MAP
565 && OMP_CLAUSE_MAP_KIND (clause
) == GOMP_MAP_POINTER
)
566 pp_string (pp
, " [pointer assign, bias: ");
567 else if (OMP_CLAUSE_CODE (clause
) == OMP_CLAUSE_MAP
568 && OMP_CLAUSE_MAP_KIND (clause
) == GOMP_MAP_TO_PSET
)
569 pp_string (pp
, " [pointer set, len: ");
571 pp_string (pp
, " [len: ");
572 dump_generic_node (pp
, OMP_CLAUSE_SIZE (clause
),
574 pp_right_bracket (pp
);
579 case OMP_CLAUSE_FROM
:
580 pp_string (pp
, "from(");
581 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
583 goto print_clause_size
;
586 pp_string (pp
, "to(");
587 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
589 goto print_clause_size
;
591 case OMP_CLAUSE__CACHE_
:
593 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
595 goto print_clause_size
;
597 case OMP_CLAUSE_NUM_TEAMS
:
598 pp_string (pp
, "num_teams(");
599 dump_generic_node (pp
, OMP_CLAUSE_NUM_TEAMS_EXPR (clause
),
604 case OMP_CLAUSE_THREAD_LIMIT
:
605 pp_string (pp
, "thread_limit(");
606 dump_generic_node (pp
, OMP_CLAUSE_THREAD_LIMIT_EXPR (clause
),
611 case OMP_CLAUSE_DEVICE
:
612 pp_string (pp
, "device(");
613 dump_generic_node (pp
, OMP_CLAUSE_DEVICE_ID (clause
),
618 case OMP_CLAUSE_DIST_SCHEDULE
:
619 pp_string (pp
, "dist_schedule(static");
620 if (OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR (clause
))
623 dump_generic_node (pp
,
624 OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR (clause
),
630 case OMP_CLAUSE_PROC_BIND
:
631 pp_string (pp
, "proc_bind(");
632 switch (OMP_CLAUSE_PROC_BIND_KIND (clause
))
634 case OMP_CLAUSE_PROC_BIND_MASTER
:
635 pp_string (pp
, "master");
637 case OMP_CLAUSE_PROC_BIND_CLOSE
:
638 pp_string (pp
, "close");
640 case OMP_CLAUSE_PROC_BIND_SPREAD
:
641 pp_string (pp
, "spread");
649 case OMP_CLAUSE_SAFELEN
:
650 pp_string (pp
, "safelen(");
651 dump_generic_node (pp
, OMP_CLAUSE_SAFELEN_EXPR (clause
),
656 case OMP_CLAUSE_SIMDLEN
:
657 pp_string (pp
, "simdlen(");
658 dump_generic_node (pp
, OMP_CLAUSE_SIMDLEN_EXPR (clause
),
663 case OMP_CLAUSE__SIMDUID_
:
664 pp_string (pp
, "_simduid_(");
665 dump_generic_node (pp
, OMP_CLAUSE__SIMDUID__DECL (clause
),
670 case OMP_CLAUSE_GANG
:
671 pp_string (pp
, "gang");
672 if (OMP_CLAUSE_GANG_EXPR (clause
) != NULL_TREE
)
674 pp_string (pp
, "(num: ");
675 dump_generic_node (pp
, OMP_CLAUSE_GANG_EXPR (clause
),
678 if (OMP_CLAUSE_GANG_STATIC_EXPR (clause
) != NULL_TREE
)
680 if (OMP_CLAUSE_GANG_EXPR (clause
) == NULL_TREE
)
684 pp_string (pp
, "static:");
685 if (OMP_CLAUSE_GANG_STATIC_EXPR (clause
)
686 == integer_minus_one_node
)
687 pp_character (pp
, '*');
689 dump_generic_node (pp
, OMP_CLAUSE_GANG_STATIC_EXPR (clause
),
692 if (OMP_CLAUSE_GANG_EXPR (clause
) != NULL_TREE
693 || OMP_CLAUSE_GANG_STATIC_EXPR (clause
) != NULL_TREE
)
697 case OMP_CLAUSE_ASYNC
:
698 pp_string (pp
, "async");
699 if (OMP_CLAUSE_ASYNC_EXPR (clause
))
701 pp_character(pp
, '(');
702 dump_generic_node (pp
, OMP_CLAUSE_ASYNC_EXPR (clause
),
704 pp_character(pp
, ')');
708 case OMP_CLAUSE_AUTO
:
710 pp_string (pp
, omp_clause_code_name
[OMP_CLAUSE_CODE (clause
)]);
713 case OMP_CLAUSE_WAIT
:
714 pp_string (pp
, "wait(");
715 dump_generic_node (pp
, OMP_CLAUSE_WAIT_EXPR (clause
),
717 pp_character(pp
, ')');
720 case OMP_CLAUSE_WORKER
:
721 pp_string (pp
, "worker");
722 if (OMP_CLAUSE_WORKER_EXPR (clause
) != NULL_TREE
)
725 dump_generic_node (pp
, OMP_CLAUSE_WORKER_EXPR (clause
),
731 case OMP_CLAUSE_VECTOR
:
732 pp_string (pp
, "vector");
733 if (OMP_CLAUSE_VECTOR_EXPR (clause
) != NULL_TREE
)
736 dump_generic_node (pp
, OMP_CLAUSE_VECTOR_EXPR (clause
),
742 case OMP_CLAUSE_NUM_GANGS
:
743 pp_string (pp
, "num_gangs(");
744 dump_generic_node (pp
, OMP_CLAUSE_NUM_GANGS_EXPR (clause
),
746 pp_character (pp
, ')');
749 case OMP_CLAUSE_NUM_WORKERS
:
750 pp_string (pp
, "num_workers(");
751 dump_generic_node (pp
, OMP_CLAUSE_NUM_WORKERS_EXPR (clause
),
753 pp_character (pp
, ')');
756 case OMP_CLAUSE_VECTOR_LENGTH
:
757 pp_string (pp
, "vector_length(");
758 dump_generic_node (pp
, OMP_CLAUSE_VECTOR_LENGTH_EXPR (clause
),
760 pp_character (pp
, ')');
763 case OMP_CLAUSE_INBRANCH
:
764 pp_string (pp
, "inbranch");
766 case OMP_CLAUSE_NOTINBRANCH
:
767 pp_string (pp
, "notinbranch");
770 pp_string (pp
, "for");
772 case OMP_CLAUSE_PARALLEL
:
773 pp_string (pp
, "parallel");
775 case OMP_CLAUSE_SECTIONS
:
776 pp_string (pp
, "sections");
778 case OMP_CLAUSE_TASKGROUP
:
779 pp_string (pp
, "taskgroup");
781 case OMP_CLAUSE_INDEPENDENT
:
782 pp_string (pp
, "independent");
786 /* Should never happen. */
787 dump_generic_node (pp
, clause
, spc
, flags
, false);
793 /* Dump the list of OpenMP clauses. PP, SPC and FLAGS are as in
794 dump_generic_node. */
797 dump_omp_clauses (pretty_printer
*pp
, tree clause
, int spc
, int flags
)
805 dump_omp_clause (pp
, clause
, spc
, flags
);
806 clause
= OMP_CLAUSE_CHAIN (clause
);
814 /* Dump location LOC to PP. */
817 dump_location (pretty_printer
*pp
, location_t loc
)
819 expanded_location xloc
= expand_location (loc
);
821 pp_left_bracket (pp
);
824 pp_string (pp
, xloc
.file
);
827 pp_decimal_int (pp
, xloc
.line
);
829 pp_decimal_int (pp
, xloc
.column
);
830 pp_string (pp
, "] ");
834 /* Dump lexical block BLOCK. PP, SPC and FLAGS are as in
835 dump_generic_node. */
838 dump_block_node (pretty_printer
*pp
, tree block
, int spc
, int flags
)
842 pp_printf (pp
, "BLOCK #%d ", BLOCK_NUMBER (block
));
844 if (flags
& TDF_ADDRESS
)
845 pp_printf (pp
, "[%p] ", (void *) block
);
847 if (BLOCK_ABSTRACT (block
))
848 pp_string (pp
, "[abstract] ");
850 if (TREE_ASM_WRITTEN (block
))
851 pp_string (pp
, "[written] ");
853 if (flags
& TDF_SLIM
)
856 if (BLOCK_SOURCE_LOCATION (block
))
857 dump_location (pp
, BLOCK_SOURCE_LOCATION (block
));
859 newline_and_indent (pp
, spc
+ 2);
861 if (BLOCK_SUPERCONTEXT (block
))
863 pp_string (pp
, "SUPERCONTEXT: ");
864 dump_generic_node (pp
, BLOCK_SUPERCONTEXT (block
), 0,
865 flags
| TDF_SLIM
, false);
866 newline_and_indent (pp
, spc
+ 2);
869 if (BLOCK_SUBBLOCKS (block
))
871 pp_string (pp
, "SUBBLOCKS: ");
872 for (t
= BLOCK_SUBBLOCKS (block
); t
; t
= BLOCK_CHAIN (t
))
874 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
877 newline_and_indent (pp
, spc
+ 2);
880 if (BLOCK_CHAIN (block
))
882 pp_string (pp
, "SIBLINGS: ");
883 for (t
= BLOCK_CHAIN (block
); t
; t
= BLOCK_CHAIN (t
))
885 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
888 newline_and_indent (pp
, spc
+ 2);
891 if (BLOCK_VARS (block
))
893 pp_string (pp
, "VARS: ");
894 for (t
= BLOCK_VARS (block
); t
; t
= TREE_CHAIN (t
))
896 dump_generic_node (pp
, t
, 0, flags
, false);
899 newline_and_indent (pp
, spc
+ 2);
902 if (vec_safe_length (BLOCK_NONLOCALIZED_VARS (block
)) > 0)
905 vec
<tree
, va_gc
> *nlv
= BLOCK_NONLOCALIZED_VARS (block
);
907 pp_string (pp
, "NONLOCALIZED_VARS: ");
908 FOR_EACH_VEC_ELT (*nlv
, i
, t
)
910 dump_generic_node (pp
, t
, 0, flags
, false);
913 newline_and_indent (pp
, spc
+ 2);
916 if (BLOCK_ABSTRACT_ORIGIN (block
))
918 pp_string (pp
, "ABSTRACT_ORIGIN: ");
919 dump_generic_node (pp
, BLOCK_ABSTRACT_ORIGIN (block
), 0,
920 flags
| TDF_SLIM
, false);
921 newline_and_indent (pp
, spc
+ 2);
924 if (BLOCK_FRAGMENT_ORIGIN (block
))
926 pp_string (pp
, "FRAGMENT_ORIGIN: ");
927 dump_generic_node (pp
, BLOCK_FRAGMENT_ORIGIN (block
), 0,
928 flags
| TDF_SLIM
, false);
929 newline_and_indent (pp
, spc
+ 2);
932 if (BLOCK_FRAGMENT_CHAIN (block
))
934 pp_string (pp
, "FRAGMENT_CHAIN: ");
935 for (t
= BLOCK_FRAGMENT_CHAIN (block
); t
; t
= BLOCK_FRAGMENT_CHAIN (t
))
937 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
940 newline_and_indent (pp
, spc
+ 2);
945 /* Dump the node NODE on the pretty_printer PP, SPC spaces of
946 indent. FLAGS specifies details to show in the dump (see TDF_* in
947 dumpfile.h). If IS_STMT is true, the object printed is considered
948 to be a statement and it is terminated by ';' if appropriate. */
951 dump_generic_node (pretty_printer
*pp
, tree node
, int spc
, int flags
,
960 if (node
== NULL_TREE
)
963 is_expr
= EXPR_P (node
);
965 if (is_stmt
&& (flags
& TDF_STMTADDR
))
966 pp_printf (pp
, "<&%p> ", (void *)node
);
968 if ((flags
& TDF_LINENO
) && EXPR_HAS_LOCATION (node
))
969 dump_location (pp
, EXPR_LOCATION (node
));
971 code
= TREE_CODE (node
);
975 pp_string (pp
, "<<< error >>>");
978 case IDENTIFIER_NODE
:
979 pp_tree_identifier (pp
, node
);
983 while (node
&& node
!= error_mark_node
)
985 if (TREE_PURPOSE (node
))
987 dump_generic_node (pp
, TREE_PURPOSE (node
), spc
, flags
, false);
990 dump_generic_node (pp
, TREE_VALUE (node
), spc
, flags
, false);
991 node
= TREE_CHAIN (node
);
992 if (node
&& TREE_CODE (node
) == TREE_LIST
)
1001 dump_generic_node (pp
, BINFO_TYPE (node
), spc
, flags
, false);
1007 if (TREE_VEC_LENGTH (node
) > 0)
1009 size_t len
= TREE_VEC_LENGTH (node
);
1010 for (i
= 0; i
< len
- 1; i
++)
1012 dump_generic_node (pp
, TREE_VEC_ELT (node
, i
), spc
, flags
,
1017 dump_generic_node (pp
, TREE_VEC_ELT (node
, len
- 1), spc
,
1024 case POINTER_BOUNDS_TYPE
:
1027 case FIXED_POINT_TYPE
:
1033 unsigned int quals
= TYPE_QUALS (node
);
1034 enum tree_code_class tclass
;
1036 if (quals
& TYPE_QUAL_ATOMIC
)
1037 pp_string (pp
, "atomic ");
1038 if (quals
& TYPE_QUAL_CONST
)
1039 pp_string (pp
, "const ");
1040 else if (quals
& TYPE_QUAL_VOLATILE
)
1041 pp_string (pp
, "volatile ");
1042 else if (quals
& TYPE_QUAL_RESTRICT
)
1043 pp_string (pp
, "restrict ");
1045 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
1047 pp_string (pp
, "<address-space-");
1048 pp_decimal_int (pp
, TYPE_ADDR_SPACE (node
));
1049 pp_string (pp
, "> ");
1052 tclass
= TREE_CODE_CLASS (TREE_CODE (node
));
1054 if (tclass
== tcc_declaration
)
1056 if (DECL_NAME (node
))
1057 dump_decl_name (pp
, node
, flags
);
1059 pp_string (pp
, "<unnamed type decl>");
1061 else if (tclass
== tcc_type
)
1063 if (TYPE_NAME (node
))
1065 if (TREE_CODE (TYPE_NAME (node
)) == IDENTIFIER_NODE
)
1066 pp_tree_identifier (pp
, TYPE_NAME (node
));
1067 else if (TREE_CODE (TYPE_NAME (node
)) == TYPE_DECL
1068 && DECL_NAME (TYPE_NAME (node
)))
1069 dump_decl_name (pp
, TYPE_NAME (node
), flags
);
1071 pp_string (pp
, "<unnamed type>");
1073 else if (TREE_CODE (node
) == VECTOR_TYPE
)
1075 pp_string (pp
, "vector");
1077 pp_wide_integer (pp
, TYPE_VECTOR_SUBPARTS (node
));
1078 pp_string (pp
, ") ");
1079 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1081 else if (TREE_CODE (node
) == INTEGER_TYPE
)
1083 if (TYPE_PRECISION (node
) == CHAR_TYPE_SIZE
)
1084 pp_string (pp
, (TYPE_UNSIGNED (node
)
1087 else if (TYPE_PRECISION (node
) == SHORT_TYPE_SIZE
)
1088 pp_string (pp
, (TYPE_UNSIGNED (node
)
1091 else if (TYPE_PRECISION (node
) == INT_TYPE_SIZE
)
1092 pp_string (pp
, (TYPE_UNSIGNED (node
)
1095 else if (TYPE_PRECISION (node
) == LONG_TYPE_SIZE
)
1096 pp_string (pp
, (TYPE_UNSIGNED (node
)
1099 else if (TYPE_PRECISION (node
) == LONG_LONG_TYPE_SIZE
)
1100 pp_string (pp
, (TYPE_UNSIGNED (node
)
1101 ? "unsigned long long"
1102 : "signed long long"));
1103 else if (TYPE_PRECISION (node
) >= CHAR_TYPE_SIZE
1104 && exact_log2 (TYPE_PRECISION (node
)) != -1)
1106 pp_string (pp
, (TYPE_UNSIGNED (node
) ? "uint" : "int"));
1107 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1108 pp_string (pp
, "_t");
1112 pp_string (pp
, (TYPE_UNSIGNED (node
)
1113 ? "<unnamed-unsigned:"
1114 : "<unnamed-signed:"));
1115 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1119 else if (TREE_CODE (node
) == COMPLEX_TYPE
)
1121 pp_string (pp
, "__complex__ ");
1122 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1124 else if (TREE_CODE (node
) == REAL_TYPE
)
1126 pp_string (pp
, "<float:");
1127 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1130 else if (TREE_CODE (node
) == FIXED_POINT_TYPE
)
1132 pp_string (pp
, "<fixed-point-");
1133 pp_string (pp
, TYPE_SATURATING (node
) ? "sat:" : "nonsat:");
1134 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1137 else if (TREE_CODE (node
) == VOID_TYPE
)
1138 pp_string (pp
, "void");
1140 pp_string (pp
, "<unnamed type>");
1146 case REFERENCE_TYPE
:
1147 str
= (TREE_CODE (node
) == POINTER_TYPE
? "*" : "&");
1149 if (TREE_TYPE (node
) == NULL
)
1151 pp_string (pp
, str
);
1152 pp_string (pp
, "<null type>");
1154 else if (TREE_CODE (TREE_TYPE (node
)) == FUNCTION_TYPE
)
1156 tree fnode
= TREE_TYPE (node
);
1158 dump_generic_node (pp
, TREE_TYPE (fnode
), spc
, flags
, false);
1161 pp_string (pp
, str
);
1162 if (TYPE_NAME (node
) && DECL_NAME (TYPE_NAME (node
)))
1163 dump_decl_name (pp
, TYPE_NAME (node
), flags
);
1164 else if (flags
& TDF_NOUID
)
1165 pp_printf (pp
, "<Txxxx>");
1167 pp_printf (pp
, "<T%x>", TYPE_UID (node
));
1169 pp_right_paren (pp
);
1170 dump_function_declaration (pp
, fnode
, spc
, flags
);
1174 unsigned int quals
= TYPE_QUALS (node
);
1176 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1178 pp_string (pp
, str
);
1180 if (quals
& TYPE_QUAL_CONST
)
1181 pp_string (pp
, " const");
1182 if (quals
& TYPE_QUAL_VOLATILE
)
1183 pp_string (pp
, " volatile");
1184 if (quals
& TYPE_QUAL_RESTRICT
)
1185 pp_string (pp
, " restrict");
1187 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
1189 pp_string (pp
, " <address-space-");
1190 pp_decimal_int (pp
, TYPE_ADDR_SPACE (node
));
1194 if (TYPE_REF_CAN_ALIAS_ALL (node
))
1195 pp_string (pp
, " {ref-all}");
1205 if (integer_zerop (TREE_OPERAND (node
, 1))
1206 /* Dump the types of INTEGER_CSTs explicitly, for we can't
1207 infer them and MEM_ATTR caching will share MEM_REFs
1208 with differently-typed op0s. */
1209 && TREE_CODE (TREE_OPERAND (node
, 0)) != INTEGER_CST
1210 /* Released SSA_NAMES have no TREE_TYPE. */
1211 && TREE_TYPE (TREE_OPERAND (node
, 0)) != NULL_TREE
1212 /* Same pointer types, but ignoring POINTER_TYPE vs.
1214 && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 0)))
1215 == TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 1))))
1216 && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (node
, 0)))
1217 == TYPE_MODE (TREE_TYPE (TREE_OPERAND (node
, 1))))
1218 && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node
, 0)))
1219 == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node
, 1))))
1220 /* Same value types ignoring qualifiers. */
1221 && (TYPE_MAIN_VARIANT (TREE_TYPE (node
))
1222 == TYPE_MAIN_VARIANT
1223 (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 1)))))
1224 && (!(flags
& TDF_ALIAS
)
1225 || MR_DEPENDENCE_CLIQUE (node
) == 0))
1227 if (TREE_CODE (TREE_OPERAND (node
, 0)) != ADDR_EXPR
)
1230 dump_generic_node (pp
, TREE_OPERAND (node
, 0),
1234 dump_generic_node (pp
,
1235 TREE_OPERAND (TREE_OPERAND (node
, 0), 0),
1242 pp_string (pp
, "MEM[");
1244 ptype
= TYPE_MAIN_VARIANT (TREE_TYPE (TREE_OPERAND (node
, 1)));
1245 dump_generic_node (pp
, ptype
,
1246 spc
, flags
| TDF_SLIM
, false);
1247 pp_right_paren (pp
);
1248 dump_generic_node (pp
, TREE_OPERAND (node
, 0),
1250 if (!integer_zerop (TREE_OPERAND (node
, 1)))
1252 pp_string (pp
, " + ");
1253 dump_generic_node (pp
, TREE_OPERAND (node
, 1),
1256 if ((flags
& TDF_ALIAS
)
1257 && MR_DEPENDENCE_CLIQUE (node
) != 0)
1259 pp_string (pp
, " clique ");
1260 pp_unsigned_wide_integer (pp
, MR_DEPENDENCE_CLIQUE (node
));
1261 pp_string (pp
, " base ");
1262 pp_unsigned_wide_integer (pp
, MR_DEPENDENCE_BASE (node
));
1264 pp_right_bracket (pp
);
1269 case TARGET_MEM_REF
:
1271 const char *sep
= "";
1274 pp_string (pp
, "MEM[");
1276 if (TREE_CODE (TMR_BASE (node
)) == ADDR_EXPR
)
1278 pp_string (pp
, sep
);
1280 pp_string (pp
, "symbol: ");
1281 dump_generic_node (pp
, TREE_OPERAND (TMR_BASE (node
), 0),
1286 pp_string (pp
, sep
);
1288 pp_string (pp
, "base: ");
1289 dump_generic_node (pp
, TMR_BASE (node
), spc
, flags
, false);
1291 tmp
= TMR_INDEX2 (node
);
1294 pp_string (pp
, sep
);
1296 pp_string (pp
, "base: ");
1297 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1299 tmp
= TMR_INDEX (node
);
1302 pp_string (pp
, sep
);
1304 pp_string (pp
, "index: ");
1305 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1307 tmp
= TMR_STEP (node
);
1310 pp_string (pp
, sep
);
1312 pp_string (pp
, "step: ");
1313 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1315 tmp
= TMR_OFFSET (node
);
1318 pp_string (pp
, sep
);
1320 pp_string (pp
, "offset: ");
1321 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1323 pp_right_bracket (pp
);
1331 /* Print the innermost component type. */
1332 for (tmp
= TREE_TYPE (node
); TREE_CODE (tmp
) == ARRAY_TYPE
;
1333 tmp
= TREE_TYPE (tmp
))
1335 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1337 /* Print the dimensions. */
1338 for (tmp
= node
; TREE_CODE (tmp
) == ARRAY_TYPE
; tmp
= TREE_TYPE (tmp
))
1339 dump_array_domain (pp
, TYPE_DOMAIN (tmp
), spc
, flags
);
1345 case QUAL_UNION_TYPE
:
1347 unsigned int quals
= TYPE_QUALS (node
);
1349 if (quals
& TYPE_QUAL_ATOMIC
)
1350 pp_string (pp
, "atomic ");
1351 if (quals
& TYPE_QUAL_CONST
)
1352 pp_string (pp
, "const ");
1353 if (quals
& TYPE_QUAL_VOLATILE
)
1354 pp_string (pp
, "volatile ");
1356 /* Print the name of the structure. */
1357 if (TREE_CODE (node
) == RECORD_TYPE
)
1358 pp_string (pp
, "struct ");
1359 else if (TREE_CODE (node
) == UNION_TYPE
)
1360 pp_string (pp
, "union ");
1362 if (TYPE_NAME (node
))
1363 dump_generic_node (pp
, TYPE_NAME (node
), spc
, flags
, false);
1364 else if (!(flags
& TDF_SLIM
))
1365 /* FIXME: If we eliminate the 'else' above and attempt
1366 to show the fields for named types, we may get stuck
1367 following a cycle of pointers to structs. The alleged
1368 self-reference check in print_struct_decl will not detect
1369 cycles involving more than one pointer or struct type. */
1370 print_struct_decl (pp
, node
, spc
, flags
);
1379 if (TREE_CODE (TREE_TYPE (node
)) == POINTER_TYPE
)
1381 /* In the case of a pointer, one may want to divide by the
1382 size of the pointed-to type. Unfortunately, this not
1383 straightforward. The C front-end maps expressions
1388 in such a way that the two INTEGER_CST nodes for "5" have
1389 different values but identical types. In the latter
1390 case, the 5 is multiplied by sizeof (int) in c-common.c
1391 (pointer_int_sum) to convert it to a byte address, and
1392 yet the type of the node is left unchanged. Argh. What
1393 is consistent though is that the number value corresponds
1394 to bytes (UNITS) offset.
1396 NB: Neither of the following divisors can be trivially
1397 used to recover the original literal:
1399 TREE_INT_CST_LOW (TYPE_SIZE_UNIT (TREE_TYPE (node)))
1400 TYPE_PRECISION (TREE_TYPE (TREE_TYPE (node))) */
1401 pp_wide_integer (pp
, TREE_INT_CST_LOW (node
));
1402 pp_string (pp
, "B"); /* pseudo-unit */
1404 else if (tree_fits_shwi_p (node
))
1405 pp_wide_integer (pp
, tree_to_shwi (node
));
1406 else if (tree_fits_uhwi_p (node
))
1407 pp_unsigned_wide_integer (pp
, tree_to_uhwi (node
));
1410 wide_int val
= node
;
1412 if (wi::neg_p (val
, TYPE_SIGN (TREE_TYPE (node
))))
1417 print_hex (val
, pp_buffer (pp
)->digit_buffer
);
1418 pp_string (pp
, pp_buffer (pp
)->digit_buffer
);
1420 if (TREE_OVERFLOW (node
))
1421 pp_string (pp
, "(OVF)");
1425 /* Code copied from print_node. */
1428 if (TREE_OVERFLOW (node
))
1429 pp_string (pp
, " overflow");
1431 #if !defined(REAL_IS_NOT_DOUBLE) || defined(REAL_ARITHMETIC)
1432 d
= TREE_REAL_CST (node
);
1433 if (REAL_VALUE_ISINF (d
))
1434 pp_string (pp
, REAL_VALUE_NEGATIVE (d
) ? " -Inf" : " Inf");
1435 else if (REAL_VALUE_ISNAN (d
))
1436 pp_string (pp
, " Nan");
1440 real_to_decimal (string
, &d
, sizeof (string
), 0, 1);
1441 pp_string (pp
, string
);
1446 unsigned char *p
= (unsigned char *) &TREE_REAL_CST (node
);
1447 pp_string (pp
, "0x");
1448 for (i
= 0; i
< sizeof TREE_REAL_CST (node
); i
++)
1449 output_formatted_integer (pp
, "%02x", *p
++);
1458 fixed_to_decimal (string
, TREE_FIXED_CST_PTR (node
), sizeof (string
));
1459 pp_string (pp
, string
);
1464 pp_string (pp
, "__complex__ (");
1465 dump_generic_node (pp
, TREE_REALPART (node
), spc
, flags
, false);
1466 pp_string (pp
, ", ");
1467 dump_generic_node (pp
, TREE_IMAGPART (node
), spc
, flags
, false);
1468 pp_right_paren (pp
);
1472 pp_string (pp
, "\"");
1473 pretty_print_string (pp
, TREE_STRING_POINTER (node
));
1474 pp_string (pp
, "\"");
1480 pp_string (pp
, "{ ");
1481 for (i
= 0; i
< VECTOR_CST_NELTS (node
); ++i
)
1484 pp_string (pp
, ", ");
1485 dump_generic_node (pp
, VECTOR_CST_ELT (node
, i
),
1488 pp_string (pp
, " }");
1494 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1496 if (TREE_CODE (node
) == METHOD_TYPE
)
1498 if (TYPE_METHOD_BASETYPE (node
))
1499 dump_decl_name (pp
, TYPE_NAME (TYPE_METHOD_BASETYPE (node
)),
1502 pp_string (pp
, "<null method basetype>");
1503 pp_colon_colon (pp
);
1505 if (TYPE_NAME (node
) && DECL_NAME (TYPE_NAME (node
)))
1506 dump_decl_name (pp
, TYPE_NAME (node
), flags
);
1507 else if (flags
& TDF_NOUID
)
1508 pp_printf (pp
, "<Txxxx>");
1510 pp_printf (pp
, "<T%x>", TYPE_UID (node
));
1511 dump_function_declaration (pp
, node
, spc
, flags
);
1516 dump_decl_name (pp
, node
, flags
);
1520 if (DECL_NAME (node
))
1521 dump_decl_name (pp
, node
, flags
);
1522 else if (LABEL_DECL_UID (node
) != -1)
1523 pp_printf (pp
, "<L%d>", (int) LABEL_DECL_UID (node
));
1526 if (flags
& TDF_NOUID
)
1527 pp_string (pp
, "<D.xxxx>");
1529 pp_printf (pp
, "<D.%u>", DECL_UID (node
));
1534 if (DECL_IS_BUILTIN (node
))
1536 /* Don't print the declaration of built-in types. */
1539 if (DECL_NAME (node
))
1540 dump_decl_name (pp
, node
, flags
);
1541 else if (TYPE_NAME (TREE_TYPE (node
)) != node
)
1543 if ((TREE_CODE (TREE_TYPE (node
)) == RECORD_TYPE
1544 || TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
)
1545 && TYPE_METHODS (TREE_TYPE (node
)))
1547 /* The type is a c++ class: all structures have at least
1549 pp_string (pp
, "class ");
1550 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1555 (TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
1556 ? "union" : "struct "));
1557 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1561 pp_string (pp
, "<anon>");
1567 case DEBUG_EXPR_DECL
:
1568 case NAMESPACE_DECL
:
1570 dump_decl_name (pp
, node
, flags
);
1574 pp_string (pp
, "<retval>");
1578 op0
= TREE_OPERAND (node
, 0);
1581 && (TREE_CODE (op0
) == INDIRECT_REF
1582 || (TREE_CODE (op0
) == MEM_REF
1583 && TREE_CODE (TREE_OPERAND (op0
, 0)) != ADDR_EXPR
1584 && integer_zerop (TREE_OPERAND (op0
, 1))
1585 /* Dump the types of INTEGER_CSTs explicitly, for we
1586 can't infer them and MEM_ATTR caching will share
1587 MEM_REFs with differently-typed op0s. */
1588 && TREE_CODE (TREE_OPERAND (op0
, 0)) != INTEGER_CST
1589 /* Released SSA_NAMES have no TREE_TYPE. */
1590 && TREE_TYPE (TREE_OPERAND (op0
, 0)) != NULL_TREE
1591 /* Same pointer types, but ignoring POINTER_TYPE vs.
1593 && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 0)))
1594 == TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 1))))
1595 && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0
, 0)))
1596 == TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0
, 1))))
1597 && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0
, 0)))
1598 == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0
, 1))))
1599 /* Same value types ignoring qualifiers. */
1600 && (TYPE_MAIN_VARIANT (TREE_TYPE (op0
))
1601 == TYPE_MAIN_VARIANT
1602 (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 1)))))
1603 && MR_DEPENDENCE_CLIQUE (op0
) == 0)))
1605 op0
= TREE_OPERAND (op0
, 0);
1608 if (op_prio (op0
) < op_prio (node
))
1610 dump_generic_node (pp
, op0
, spc
, flags
, false);
1611 if (op_prio (op0
) < op_prio (node
))
1612 pp_right_paren (pp
);
1613 pp_string (pp
, str
);
1614 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1615 op0
= component_ref_field_offset (node
);
1616 if (op0
&& TREE_CODE (op0
) != INTEGER_CST
)
1618 pp_string (pp
, "{off: ");
1619 dump_generic_node (pp
, op0
, spc
, flags
, false);
1620 pp_right_brace (pp
);
1625 pp_string (pp
, "BIT_FIELD_REF <");
1626 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1627 pp_string (pp
, ", ");
1628 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1629 pp_string (pp
, ", ");
1630 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
1635 case ARRAY_RANGE_REF
:
1636 op0
= TREE_OPERAND (node
, 0);
1637 if (op_prio (op0
) < op_prio (node
))
1639 dump_generic_node (pp
, op0
, spc
, flags
, false);
1640 if (op_prio (op0
) < op_prio (node
))
1641 pp_right_paren (pp
);
1642 pp_left_bracket (pp
);
1643 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1644 if (TREE_CODE (node
) == ARRAY_RANGE_REF
)
1645 pp_string (pp
, " ...");
1646 pp_right_bracket (pp
);
1648 op0
= array_ref_low_bound (node
);
1649 op1
= array_ref_element_size (node
);
1651 if (!integer_zerop (op0
)
1652 || TREE_OPERAND (node
, 2)
1653 || TREE_OPERAND (node
, 3))
1655 pp_string (pp
, "{lb: ");
1656 dump_generic_node (pp
, op0
, spc
, flags
, false);
1657 pp_string (pp
, " sz: ");
1658 dump_generic_node (pp
, op1
, spc
, flags
, false);
1659 pp_right_brace (pp
);
1665 unsigned HOST_WIDE_INT ix
;
1667 bool is_struct_init
= false;
1668 bool is_array_init
= false;
1671 if (TREE_CLOBBER_P (node
))
1672 pp_string (pp
, "CLOBBER");
1673 else if (TREE_CODE (TREE_TYPE (node
)) == RECORD_TYPE
1674 || TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
)
1675 is_struct_init
= true;
1676 else if (TREE_CODE (TREE_TYPE (node
)) == ARRAY_TYPE
1677 && TYPE_DOMAIN (TREE_TYPE (node
))
1678 && TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
)))
1679 && TREE_CODE (TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
))))
1682 tree minv
= TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
)));
1683 is_array_init
= true;
1684 curidx
= wi::to_widest (minv
);
1686 FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (node
), ix
, field
, val
)
1693 dump_generic_node (pp
, field
, spc
, flags
, false);
1696 else if (is_array_init
1697 && (TREE_CODE (field
) != INTEGER_CST
1698 || curidx
!= wi::to_widest (field
)))
1700 pp_left_bracket (pp
);
1701 if (TREE_CODE (field
) == RANGE_EXPR
)
1703 dump_generic_node (pp
, TREE_OPERAND (field
, 0), spc
,
1705 pp_string (pp
, " ... ");
1706 dump_generic_node (pp
, TREE_OPERAND (field
, 1), spc
,
1708 if (TREE_CODE (TREE_OPERAND (field
, 1)) == INTEGER_CST
)
1709 curidx
= wi::to_widest (TREE_OPERAND (field
, 1));
1712 dump_generic_node (pp
, field
, spc
, flags
, false);
1713 if (TREE_CODE (field
) == INTEGER_CST
)
1714 curidx
= wi::to_widest (field
);
1715 pp_string (pp
, "]=");
1720 if (val
&& TREE_CODE (val
) == ADDR_EXPR
)
1721 if (TREE_CODE (TREE_OPERAND (val
, 0)) == FUNCTION_DECL
)
1722 val
= TREE_OPERAND (val
, 0);
1723 if (val
&& TREE_CODE (val
) == FUNCTION_DECL
)
1724 dump_decl_name (pp
, val
, flags
);
1726 dump_generic_node (pp
, val
, spc
, flags
, false);
1727 if (ix
!= vec_safe_length (CONSTRUCTOR_ELTS (node
)) - 1)
1733 pp_right_brace (pp
);
1740 if (flags
& TDF_SLIM
)
1742 pp_string (pp
, "<COMPOUND_EXPR>");
1746 dump_generic_node (pp
, TREE_OPERAND (node
, 0),
1747 spc
, flags
, !(flags
& TDF_SLIM
));
1748 if (flags
& TDF_SLIM
)
1749 newline_and_indent (pp
, spc
);
1756 for (tp
= &TREE_OPERAND (node
, 1);
1757 TREE_CODE (*tp
) == COMPOUND_EXPR
;
1758 tp
= &TREE_OPERAND (*tp
, 1))
1760 dump_generic_node (pp
, TREE_OPERAND (*tp
, 0),
1761 spc
, flags
, !(flags
& TDF_SLIM
));
1762 if (flags
& TDF_SLIM
)
1763 newline_and_indent (pp
, spc
);
1771 dump_generic_node (pp
, *tp
, spc
, flags
, !(flags
& TDF_SLIM
));
1775 case STATEMENT_LIST
:
1777 tree_stmt_iterator si
;
1780 if (flags
& TDF_SLIM
)
1782 pp_string (pp
, "<STATEMENT_LIST>");
1786 for (si
= tsi_start (node
); !tsi_end_p (si
); tsi_next (&si
))
1789 newline_and_indent (pp
, spc
);
1792 dump_generic_node (pp
, tsi_stmt (si
), spc
, flags
, true);
1799 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
,
1804 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
,
1809 pp_string (pp
, "TARGET_EXPR <");
1810 dump_generic_node (pp
, TARGET_EXPR_SLOT (node
), spc
, flags
, false);
1813 dump_generic_node (pp
, TARGET_EXPR_INITIAL (node
), spc
, flags
, false);
1818 print_declaration (pp
, DECL_EXPR_DECL (node
), spc
, flags
);
1823 if (TREE_TYPE (node
) == NULL
|| TREE_TYPE (node
) == void_type_node
)
1825 pp_string (pp
, "if (");
1826 dump_generic_node (pp
, COND_EXPR_COND (node
), spc
, flags
, false);
1827 pp_right_paren (pp
);
1828 /* The lowered cond_exprs should always be printed in full. */
1829 if (COND_EXPR_THEN (node
)
1830 && (IS_EMPTY_STMT (COND_EXPR_THEN (node
))
1831 || TREE_CODE (COND_EXPR_THEN (node
)) == GOTO_EXPR
)
1832 && COND_EXPR_ELSE (node
)
1833 && (IS_EMPTY_STMT (COND_EXPR_ELSE (node
))
1834 || TREE_CODE (COND_EXPR_ELSE (node
)) == GOTO_EXPR
))
1837 dump_generic_node (pp
, COND_EXPR_THEN (node
),
1839 if (!IS_EMPTY_STMT (COND_EXPR_ELSE (node
)))
1841 pp_string (pp
, " else ");
1842 dump_generic_node (pp
, COND_EXPR_ELSE (node
),
1846 else if (!(flags
& TDF_SLIM
))
1848 /* Output COND_EXPR_THEN. */
1849 if (COND_EXPR_THEN (node
))
1851 newline_and_indent (pp
, spc
+2);
1853 newline_and_indent (pp
, spc
+4);
1854 dump_generic_node (pp
, COND_EXPR_THEN (node
), spc
+4,
1856 newline_and_indent (pp
, spc
+2);
1857 pp_right_brace (pp
);
1860 /* Output COND_EXPR_ELSE. */
1861 if (COND_EXPR_ELSE (node
)
1862 && !IS_EMPTY_STMT (COND_EXPR_ELSE (node
)))
1864 newline_and_indent (pp
, spc
);
1865 pp_string (pp
, "else");
1866 newline_and_indent (pp
, spc
+2);
1868 newline_and_indent (pp
, spc
+4);
1869 dump_generic_node (pp
, COND_EXPR_ELSE (node
), spc
+4,
1871 newline_and_indent (pp
, spc
+2);
1872 pp_right_brace (pp
);
1879 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1883 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1887 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
1893 if (!(flags
& TDF_SLIM
))
1895 if (BIND_EXPR_VARS (node
))
1899 for (op0
= BIND_EXPR_VARS (node
); op0
; op0
= DECL_CHAIN (op0
))
1901 print_declaration (pp
, op0
, spc
+2, flags
);
1906 newline_and_indent (pp
, spc
+2);
1907 dump_generic_node (pp
, BIND_EXPR_BODY (node
), spc
+2, flags
, true);
1908 newline_and_indent (pp
, spc
);
1909 pp_right_brace (pp
);
1915 if (CALL_EXPR_FN (node
) != NULL_TREE
)
1916 print_call_name (pp
, CALL_EXPR_FN (node
), flags
);
1918 pp_string (pp
, internal_fn_name (CALL_EXPR_IFN (node
)));
1920 /* Print parameters. */
1925 call_expr_arg_iterator iter
;
1926 FOR_EACH_CALL_EXPR_ARG (arg
, iter
, node
)
1928 dump_generic_node (pp
, arg
, spc
, flags
, false);
1929 if (more_call_expr_args_p (&iter
))
1936 if (CALL_EXPR_VA_ARG_PACK (node
))
1938 if (call_expr_nargs (node
) > 0)
1943 pp_string (pp
, "__builtin_va_arg_pack ()");
1945 pp_right_paren (pp
);
1947 op1
= CALL_EXPR_STATIC_CHAIN (node
);
1950 pp_string (pp
, " [static-chain: ");
1951 dump_generic_node (pp
, op1
, spc
, flags
, false);
1952 pp_right_bracket (pp
);
1955 if (CALL_EXPR_RETURN_SLOT_OPT (node
))
1956 pp_string (pp
, " [return slot optimization]");
1957 if (CALL_EXPR_TAILCALL (node
))
1958 pp_string (pp
, " [tail call]");
1961 case WITH_CLEANUP_EXPR
:
1965 case CLEANUP_POINT_EXPR
:
1966 pp_string (pp
, "<<cleanup_point ");
1967 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1968 pp_string (pp
, ">>");
1971 case PLACEHOLDER_EXPR
:
1972 pp_string (pp
, "<PLACEHOLDER_EXPR ");
1973 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1977 /* Binary arithmetic and logic expressions. */
1978 case WIDEN_SUM_EXPR
:
1979 case WIDEN_MULT_EXPR
:
1981 case MULT_HIGHPART_EXPR
:
1983 case POINTER_PLUS_EXPR
:
1985 case TRUNC_DIV_EXPR
:
1987 case FLOOR_DIV_EXPR
:
1988 case ROUND_DIV_EXPR
:
1989 case TRUNC_MOD_EXPR
:
1991 case FLOOR_MOD_EXPR
:
1992 case ROUND_MOD_EXPR
:
1994 case EXACT_DIV_EXPR
:
1999 case WIDEN_LSHIFT_EXPR
:
2003 case TRUTH_ANDIF_EXPR
:
2004 case TRUTH_ORIF_EXPR
:
2005 case TRUTH_AND_EXPR
:
2007 case TRUTH_XOR_EXPR
:
2021 case UNORDERED_EXPR
:
2023 const char *op
= op_symbol (node
);
2024 op0
= TREE_OPERAND (node
, 0);
2025 op1
= TREE_OPERAND (node
, 1);
2027 /* When the operands are expressions with less priority,
2028 keep semantics of the tree representation. */
2029 if (op_prio (op0
) <= op_prio (node
))
2032 dump_generic_node (pp
, op0
, spc
, flags
, false);
2033 pp_right_paren (pp
);
2036 dump_generic_node (pp
, op0
, spc
, flags
, false);
2042 /* When the operands are expressions with less priority,
2043 keep semantics of the tree representation. */
2044 if (op_prio (op1
) <= op_prio (node
))
2047 dump_generic_node (pp
, op1
, spc
, flags
, false);
2048 pp_right_paren (pp
);
2051 dump_generic_node (pp
, op1
, spc
, flags
, false);
2055 /* Unary arithmetic and logic expressions. */
2058 case TRUTH_NOT_EXPR
:
2060 case PREDECREMENT_EXPR
:
2061 case PREINCREMENT_EXPR
:
2063 if (TREE_CODE (node
) == ADDR_EXPR
2064 && (TREE_CODE (TREE_OPERAND (node
, 0)) == STRING_CST
2065 || TREE_CODE (TREE_OPERAND (node
, 0)) == FUNCTION_DECL
))
2066 ; /* Do not output '&' for strings and function pointers. */
2068 pp_string (pp
, op_symbol (node
));
2070 if (op_prio (TREE_OPERAND (node
, 0)) < op_prio (node
))
2073 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2074 pp_right_paren (pp
);
2077 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2080 case POSTDECREMENT_EXPR
:
2081 case POSTINCREMENT_EXPR
:
2082 if (op_prio (TREE_OPERAND (node
, 0)) < op_prio (node
))
2085 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2086 pp_right_paren (pp
);
2089 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2090 pp_string (pp
, op_symbol (node
));
2094 pp_string (pp
, "MIN_EXPR <");
2095 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2096 pp_string (pp
, ", ");
2097 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2102 pp_string (pp
, "MAX_EXPR <");
2103 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2104 pp_string (pp
, ", ");
2105 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2110 pp_string (pp
, "ABS_EXPR <");
2111 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2119 case ADDR_SPACE_CONVERT_EXPR
:
2120 case FIXED_CONVERT_EXPR
:
2121 case FIX_TRUNC_EXPR
:
2124 type
= TREE_TYPE (node
);
2125 op0
= TREE_OPERAND (node
, 0);
2126 if (type
!= TREE_TYPE (op0
))
2129 dump_generic_node (pp
, type
, spc
, flags
, false);
2130 pp_string (pp
, ") ");
2132 if (op_prio (op0
) < op_prio (node
))
2134 dump_generic_node (pp
, op0
, spc
, flags
, false);
2135 if (op_prio (op0
) < op_prio (node
))
2136 pp_right_paren (pp
);
2139 case VIEW_CONVERT_EXPR
:
2140 pp_string (pp
, "VIEW_CONVERT_EXPR<");
2141 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2142 pp_string (pp
, ">(");
2143 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2144 pp_right_paren (pp
);
2148 pp_string (pp
, "((");
2149 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2150 pp_string (pp
, "))");
2153 case NON_LVALUE_EXPR
:
2154 pp_string (pp
, "NON_LVALUE_EXPR <");
2155 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2160 pp_string (pp
, "SAVE_EXPR <");
2161 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2166 pp_string (pp
, "COMPLEX_EXPR <");
2167 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2168 pp_string (pp
, ", ");
2169 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2174 pp_string (pp
, "CONJ_EXPR <");
2175 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2180 pp_string (pp
, "REALPART_EXPR <");
2181 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2186 pp_string (pp
, "IMAGPART_EXPR <");
2187 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2192 pp_string (pp
, "VA_ARG_EXPR <");
2193 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2197 case TRY_FINALLY_EXPR
:
2198 case TRY_CATCH_EXPR
:
2199 pp_string (pp
, "try");
2200 newline_and_indent (pp
, spc
+2);
2202 newline_and_indent (pp
, spc
+4);
2203 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
+4, flags
, true);
2204 newline_and_indent (pp
, spc
+2);
2205 pp_right_brace (pp
);
2206 newline_and_indent (pp
, spc
);
2208 (TREE_CODE (node
) == TRY_CATCH_EXPR
) ? "catch" : "finally");
2209 newline_and_indent (pp
, spc
+2);
2211 newline_and_indent (pp
, spc
+4);
2212 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
+4, flags
, true);
2213 newline_and_indent (pp
, spc
+2);
2214 pp_right_brace (pp
);
2219 pp_string (pp
, "catch (");
2220 dump_generic_node (pp
, CATCH_TYPES (node
), spc
+2, flags
, false);
2221 pp_right_paren (pp
);
2222 newline_and_indent (pp
, spc
+2);
2224 newline_and_indent (pp
, spc
+4);
2225 dump_generic_node (pp
, CATCH_BODY (node
), spc
+4, flags
, true);
2226 newline_and_indent (pp
, spc
+2);
2227 pp_right_brace (pp
);
2231 case EH_FILTER_EXPR
:
2232 pp_string (pp
, "<<<eh_filter (");
2233 dump_generic_node (pp
, EH_FILTER_TYPES (node
), spc
+2, flags
, false);
2234 pp_string (pp
, ")>>>");
2235 newline_and_indent (pp
, spc
+2);
2237 newline_and_indent (pp
, spc
+4);
2238 dump_generic_node (pp
, EH_FILTER_FAILURE (node
), spc
+4, flags
, true);
2239 newline_and_indent (pp
, spc
+2);
2240 pp_right_brace (pp
);
2245 op0
= TREE_OPERAND (node
, 0);
2246 /* If this is for break or continue, don't bother printing it. */
2247 if (DECL_NAME (op0
))
2249 const char *name
= IDENTIFIER_POINTER (DECL_NAME (op0
));
2250 if (strcmp (name
, "break") == 0
2251 || strcmp (name
, "continue") == 0)
2254 dump_generic_node (pp
, op0
, spc
, flags
, false);
2256 if (DECL_NONLOCAL (op0
))
2257 pp_string (pp
, " [non-local]");
2261 pp_string (pp
, "while (1)");
2262 if (!(flags
& TDF_SLIM
))
2264 newline_and_indent (pp
, spc
+2);
2266 newline_and_indent (pp
, spc
+4);
2267 dump_generic_node (pp
, LOOP_EXPR_BODY (node
), spc
+4, flags
, true);
2268 newline_and_indent (pp
, spc
+2);
2269 pp_right_brace (pp
);
2275 pp_string (pp
, "// predicted ");
2276 if (PREDICT_EXPR_OUTCOME (node
))
2277 pp_string (pp
, "likely by ");
2279 pp_string (pp
, "unlikely by ");
2280 pp_string (pp
, predictor_name (PREDICT_EXPR_PREDICTOR (node
)));
2281 pp_string (pp
, " predictor.");
2285 pp_string (pp
, "ANNOTATE_EXPR <");
2286 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2287 switch ((enum annot_expr_kind
) TREE_INT_CST_LOW (TREE_OPERAND (node
, 1)))
2289 case annot_expr_ivdep_kind
:
2290 pp_string (pp
, ", ivdep");
2292 case annot_expr_no_vector_kind
:
2293 pp_string (pp
, ", no-vector");
2295 case annot_expr_vector_kind
:
2296 pp_string (pp
, ", vector");
2305 pp_string (pp
, "return");
2306 op0
= TREE_OPERAND (node
, 0);
2310 if (TREE_CODE (op0
) == MODIFY_EXPR
)
2311 dump_generic_node (pp
, TREE_OPERAND (op0
, 1),
2314 dump_generic_node (pp
, op0
, spc
, flags
, false);
2319 pp_string (pp
, "if (");
2320 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2321 pp_string (pp
, ") break");
2325 pp_string (pp
, "switch (");
2326 dump_generic_node (pp
, SWITCH_COND (node
), spc
, flags
, false);
2327 pp_right_paren (pp
);
2328 if (!(flags
& TDF_SLIM
))
2330 newline_and_indent (pp
, spc
+2);
2332 if (SWITCH_BODY (node
))
2334 newline_and_indent (pp
, spc
+4);
2335 dump_generic_node (pp
, SWITCH_BODY (node
), spc
+4, flags
,
2340 tree vec
= SWITCH_LABELS (node
);
2341 size_t i
, n
= TREE_VEC_LENGTH (vec
);
2342 for (i
= 0; i
< n
; ++i
)
2344 tree elt
= TREE_VEC_ELT (vec
, i
);
2345 newline_and_indent (pp
, spc
+4);
2348 dump_generic_node (pp
, elt
, spc
+4, flags
, false);
2349 pp_string (pp
, " goto ");
2350 dump_generic_node (pp
, CASE_LABEL (elt
), spc
+4,
2355 pp_string (pp
, "case ???: goto ???;");
2358 newline_and_indent (pp
, spc
+2);
2359 pp_right_brace (pp
);
2365 op0
= GOTO_DESTINATION (node
);
2366 if (TREE_CODE (op0
) != SSA_NAME
&& DECL_P (op0
) && DECL_NAME (op0
))
2368 const char *name
= IDENTIFIER_POINTER (DECL_NAME (op0
));
2369 if (strcmp (name
, "break") == 0
2370 || strcmp (name
, "continue") == 0)
2372 pp_string (pp
, name
);
2376 pp_string (pp
, "goto ");
2377 dump_generic_node (pp
, op0
, spc
, flags
, false);
2381 pp_string (pp
, "__asm__");
2382 if (ASM_VOLATILE_P (node
))
2383 pp_string (pp
, " __volatile__");
2385 dump_generic_node (pp
, ASM_STRING (node
), spc
, flags
, false);
2387 dump_generic_node (pp
, ASM_OUTPUTS (node
), spc
, flags
, false);
2389 dump_generic_node (pp
, ASM_INPUTS (node
), spc
, flags
, false);
2390 if (ASM_CLOBBERS (node
))
2393 dump_generic_node (pp
, ASM_CLOBBERS (node
), spc
, flags
, false);
2395 pp_right_paren (pp
);
2398 case CASE_LABEL_EXPR
:
2399 if (CASE_LOW (node
) && CASE_HIGH (node
))
2401 pp_string (pp
, "case ");
2402 dump_generic_node (pp
, CASE_LOW (node
), spc
, flags
, false);
2403 pp_string (pp
, " ... ");
2404 dump_generic_node (pp
, CASE_HIGH (node
), spc
, flags
, false);
2406 else if (CASE_LOW (node
))
2408 pp_string (pp
, "case ");
2409 dump_generic_node (pp
, CASE_LOW (node
), spc
, flags
, false);
2412 pp_string (pp
, "default");
2417 pp_string (pp
, "OBJ_TYPE_REF(");
2418 dump_generic_node (pp
, OBJ_TYPE_REF_EXPR (node
), spc
, flags
, false);
2420 if (!(flags
& TDF_SLIM
) && virtual_method_call_p (node
))
2422 pp_string (pp
, "(");
2423 dump_generic_node (pp
, obj_type_ref_class (node
), spc
, flags
, false);
2424 pp_string (pp
, ")");
2426 dump_generic_node (pp
, OBJ_TYPE_REF_OBJECT (node
), spc
, flags
, false);
2428 dump_generic_node (pp
, OBJ_TYPE_REF_TOKEN (node
), spc
, flags
, false);
2429 pp_right_paren (pp
);
2433 if (SSA_NAME_IDENTIFIER (node
))
2434 dump_generic_node (pp
, SSA_NAME_IDENTIFIER (node
),
2437 pp_decimal_int (pp
, SSA_NAME_VERSION (node
));
2438 if (SSA_NAME_IS_DEFAULT_DEF (node
))
2439 pp_string (pp
, "(D)");
2440 if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (node
))
2441 pp_string (pp
, "(ab)");
2444 case WITH_SIZE_EXPR
:
2445 pp_string (pp
, "WITH_SIZE_EXPR <");
2446 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2447 pp_string (pp
, ", ");
2448 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2453 pp_string (pp
, "ASSERT_EXPR <");
2454 dump_generic_node (pp
, ASSERT_EXPR_VAR (node
), spc
, flags
, false);
2455 pp_string (pp
, ", ");
2456 dump_generic_node (pp
, ASSERT_EXPR_COND (node
), spc
, flags
, false);
2461 pp_string (pp
, "scev_known");
2464 case SCEV_NOT_KNOWN
:
2465 pp_string (pp
, "scev_not_known");
2468 case POLYNOMIAL_CHREC
:
2470 dump_generic_node (pp
, CHREC_LEFT (node
), spc
, flags
, false);
2471 pp_string (pp
, ", +, ");
2472 dump_generic_node (pp
, CHREC_RIGHT (node
), spc
, flags
, false);
2473 pp_string (pp
, "}_");
2474 dump_generic_node (pp
, CHREC_VAR (node
), spc
, flags
, false);
2478 case REALIGN_LOAD_EXPR
:
2479 pp_string (pp
, "REALIGN_LOAD <");
2480 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2481 pp_string (pp
, ", ");
2482 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2483 pp_string (pp
, ", ");
2484 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2489 pp_string (pp
, " VEC_COND_EXPR < ");
2490 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2491 pp_string (pp
, " , ");
2492 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2493 pp_string (pp
, " , ");
2494 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2495 pp_string (pp
, " > ");
2499 pp_string (pp
, " VEC_PERM_EXPR < ");
2500 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2501 pp_string (pp
, " , ");
2502 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2503 pp_string (pp
, " , ");
2504 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2505 pp_string (pp
, " > ");
2509 pp_string (pp
, " DOT_PROD_EXPR < ");
2510 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2511 pp_string (pp
, ", ");
2512 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2513 pp_string (pp
, ", ");
2514 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2515 pp_string (pp
, " > ");
2518 case WIDEN_MULT_PLUS_EXPR
:
2519 pp_string (pp
, " WIDEN_MULT_PLUS_EXPR < ");
2520 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2521 pp_string (pp
, ", ");
2522 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2523 pp_string (pp
, ", ");
2524 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2525 pp_string (pp
, " > ");
2528 case WIDEN_MULT_MINUS_EXPR
:
2529 pp_string (pp
, " WIDEN_MULT_MINUS_EXPR < ");
2530 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2531 pp_string (pp
, ", ");
2532 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2533 pp_string (pp
, ", ");
2534 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2535 pp_string (pp
, " > ");
2539 pp_string (pp
, " FMA_EXPR < ");
2540 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2541 pp_string (pp
, ", ");
2542 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2543 pp_string (pp
, ", ");
2544 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2545 pp_string (pp
, " > ");
2549 pp_string (pp
, "#pragma acc parallel");
2550 dump_omp_clauses (pp
, OACC_PARALLEL_CLAUSES (node
), spc
, flags
);
2554 pp_string (pp
, "#pragma acc kernels");
2555 dump_omp_clauses (pp
, OACC_KERNELS_CLAUSES (node
), spc
, flags
);
2559 pp_string (pp
, "#pragma acc data");
2560 dump_omp_clauses (pp
, OACC_DATA_CLAUSES (node
), spc
, flags
);
2563 case OACC_HOST_DATA
:
2564 pp_string (pp
, "#pragma acc host_data");
2565 dump_omp_clauses (pp
, OACC_HOST_DATA_CLAUSES (node
), spc
, flags
);
2569 pp_string (pp
, "#pragma acc declare");
2570 dump_omp_clauses (pp
, OACC_DECLARE_CLAUSES (node
), spc
, flags
);
2574 pp_string (pp
, "#pragma acc update");
2575 dump_omp_clauses (pp
, OACC_UPDATE_CLAUSES (node
), spc
, flags
);
2578 case OACC_ENTER_DATA
:
2579 pp_string (pp
, "#pragma acc enter data");
2580 dump_omp_clauses (pp
, OACC_ENTER_DATA_CLAUSES (node
), spc
, flags
);
2583 case OACC_EXIT_DATA
:
2584 pp_string (pp
, "#pragma acc exit data");
2585 dump_omp_clauses (pp
, OACC_EXIT_DATA_CLAUSES (node
), spc
, flags
);
2589 pp_string (pp
, "#pragma acc cache");
2590 dump_omp_clauses (pp
, OACC_CACHE_CLAUSES (node
), spc
, flags
);
2594 pp_string (pp
, "#pragma omp parallel");
2595 dump_omp_clauses (pp
, OMP_PARALLEL_CLAUSES (node
), spc
, flags
);
2598 if (!(flags
& TDF_SLIM
) && OMP_BODY (node
))
2600 newline_and_indent (pp
, spc
+ 2);
2602 newline_and_indent (pp
, spc
+ 4);
2603 dump_generic_node (pp
, OMP_BODY (node
), spc
+ 4, flags
, false);
2604 newline_and_indent (pp
, spc
+ 2);
2605 pp_right_brace (pp
);
2611 pp_string (pp
, "#pragma omp task");
2612 dump_omp_clauses (pp
, OMP_TASK_CLAUSES (node
), spc
, flags
);
2616 pp_string (pp
, "#pragma omp for");
2620 pp_string (pp
, "#pragma omp simd");
2624 pp_string (pp
, "#pragma simd");
2628 /* This label points one line after dumping the clauses.
2629 For _Cilk_for the clauses are dumped after the _Cilk_for (...)
2630 parameters are printed out. */
2631 goto dump_omp_loop_cilk_for
;
2633 case OMP_DISTRIBUTE
:
2634 pp_string (pp
, "#pragma omp distribute");
2638 pp_string (pp
, "#pragma acc loop");
2642 pp_string (pp
, "#pragma omp teams");
2643 dump_omp_clauses (pp
, OMP_TEAMS_CLAUSES (node
), spc
, flags
);
2646 case OMP_TARGET_DATA
:
2647 pp_string (pp
, "#pragma omp target data");
2648 dump_omp_clauses (pp
, OMP_TARGET_DATA_CLAUSES (node
), spc
, flags
);
2652 pp_string (pp
, "#pragma omp target");
2653 dump_omp_clauses (pp
, OMP_TARGET_CLAUSES (node
), spc
, flags
);
2656 case OMP_TARGET_UPDATE
:
2657 pp_string (pp
, "#pragma omp target update");
2658 dump_omp_clauses (pp
, OMP_TARGET_UPDATE_CLAUSES (node
), spc
, flags
);
2663 dump_omp_clauses (pp
, OMP_FOR_CLAUSES (node
), spc
, flags
);
2665 dump_omp_loop_cilk_for
:
2666 if (!(flags
& TDF_SLIM
))
2670 if (OMP_FOR_PRE_BODY (node
))
2672 if (TREE_CODE (node
) == CILK_FOR
)
2673 pp_string (pp
, " ");
2675 newline_and_indent (pp
, spc
+ 2);
2678 newline_and_indent (pp
, spc
);
2679 dump_generic_node (pp
, OMP_FOR_PRE_BODY (node
),
2682 if (OMP_FOR_INIT (node
))
2685 for (i
= 0; i
< TREE_VEC_LENGTH (OMP_FOR_INIT (node
)); i
++)
2688 if (TREE_CODE (node
) != CILK_FOR
|| OMP_FOR_PRE_BODY (node
))
2689 newline_and_indent (pp
, spc
);
2690 if (TREE_CODE (node
) == CILK_FOR
)
2691 pp_string (pp
, "_Cilk_for (");
2693 pp_string (pp
, "for (");
2694 dump_generic_node (pp
,
2695 TREE_VEC_ELT (OMP_FOR_INIT (node
), i
),
2697 pp_string (pp
, "; ");
2698 dump_generic_node (pp
,
2699 TREE_VEC_ELT (OMP_FOR_COND (node
), i
),
2701 pp_string (pp
, "; ");
2702 dump_generic_node (pp
,
2703 TREE_VEC_ELT (OMP_FOR_INCR (node
), i
),
2705 pp_right_paren (pp
);
2707 if (TREE_CODE (node
) == CILK_FOR
)
2708 dump_omp_clauses (pp
, OMP_FOR_CLAUSES (node
), spc
, flags
);
2710 if (OMP_FOR_BODY (node
))
2712 newline_and_indent (pp
, spc
+ 2);
2714 newline_and_indent (pp
, spc
+ 4);
2715 dump_generic_node (pp
, OMP_FOR_BODY (node
), spc
+ 4, flags
,
2717 newline_and_indent (pp
, spc
+ 2);
2718 pp_right_brace (pp
);
2720 if (OMP_FOR_INIT (node
))
2721 spc
-= 2 * TREE_VEC_LENGTH (OMP_FOR_INIT (node
)) - 2;
2722 if (OMP_FOR_PRE_BODY (node
))
2725 newline_and_indent (pp
, spc
+ 2);
2726 pp_right_brace (pp
);
2733 pp_string (pp
, "#pragma omp sections");
2734 dump_omp_clauses (pp
, OMP_SECTIONS_CLAUSES (node
), spc
, flags
);
2738 pp_string (pp
, "#pragma omp section");
2742 pp_string (pp
, "#pragma omp master");
2746 pp_string (pp
, "#pragma omp taskgroup");
2750 pp_string (pp
, "#pragma omp ordered");
2754 pp_string (pp
, "#pragma omp critical");
2755 if (OMP_CRITICAL_NAME (node
))
2759 dump_generic_node (pp
, OMP_CRITICAL_NAME (node
), spc
,
2761 pp_right_paren (pp
);
2766 pp_string (pp
, "#pragma omp atomic");
2767 if (OMP_ATOMIC_SEQ_CST (node
))
2768 pp_string (pp
, " seq_cst");
2769 newline_and_indent (pp
, spc
+ 2);
2770 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2774 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2777 case OMP_ATOMIC_READ
:
2778 pp_string (pp
, "#pragma omp atomic read");
2779 if (OMP_ATOMIC_SEQ_CST (node
))
2780 pp_string (pp
, " seq_cst");
2781 newline_and_indent (pp
, spc
+ 2);
2782 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2786 case OMP_ATOMIC_CAPTURE_OLD
:
2787 case OMP_ATOMIC_CAPTURE_NEW
:
2788 pp_string (pp
, "#pragma omp atomic capture");
2789 if (OMP_ATOMIC_SEQ_CST (node
))
2790 pp_string (pp
, " seq_cst");
2791 newline_and_indent (pp
, spc
+ 2);
2792 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2796 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2800 pp_string (pp
, "#pragma omp single");
2801 dump_omp_clauses (pp
, OMP_SINGLE_CLAUSES (node
), spc
, flags
);
2805 dump_omp_clause (pp
, node
, spc
, flags
);
2809 case TRANSACTION_EXPR
:
2810 if (TRANSACTION_EXPR_OUTER (node
))
2811 pp_string (pp
, "__transaction_atomic [[outer]]");
2812 else if (TRANSACTION_EXPR_RELAXED (node
))
2813 pp_string (pp
, "__transaction_relaxed");
2815 pp_string (pp
, "__transaction_atomic");
2816 if (!(flags
& TDF_SLIM
) && TRANSACTION_EXPR_BODY (node
))
2818 newline_and_indent (pp
, spc
);
2820 newline_and_indent (pp
, spc
+ 2);
2821 dump_generic_node (pp
, TRANSACTION_EXPR_BODY (node
),
2822 spc
+ 2, flags
, false);
2823 newline_and_indent (pp
, spc
);
2824 pp_right_brace (pp
);
2829 case REDUC_MAX_EXPR
:
2830 pp_string (pp
, " REDUC_MAX_EXPR < ");
2831 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2832 pp_string (pp
, " > ");
2835 case REDUC_MIN_EXPR
:
2836 pp_string (pp
, " REDUC_MIN_EXPR < ");
2837 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2838 pp_string (pp
, " > ");
2841 case REDUC_PLUS_EXPR
:
2842 pp_string (pp
, " REDUC_PLUS_EXPR < ");
2843 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2844 pp_string (pp
, " > ");
2847 case VEC_WIDEN_MULT_HI_EXPR
:
2848 case VEC_WIDEN_MULT_LO_EXPR
:
2849 case VEC_WIDEN_MULT_EVEN_EXPR
:
2850 case VEC_WIDEN_MULT_ODD_EXPR
:
2851 case VEC_WIDEN_LSHIFT_HI_EXPR
:
2852 case VEC_WIDEN_LSHIFT_LO_EXPR
:
2854 for (str
= get_tree_code_name (code
); *str
; str
++)
2855 pp_character (pp
, TOUPPER (*str
));
2856 pp_string (pp
, " < ");
2857 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2858 pp_string (pp
, ", ");
2859 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2860 pp_string (pp
, " > ");
2863 case VEC_UNPACK_HI_EXPR
:
2864 pp_string (pp
, " VEC_UNPACK_HI_EXPR < ");
2865 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2866 pp_string (pp
, " > ");
2869 case VEC_UNPACK_LO_EXPR
:
2870 pp_string (pp
, " VEC_UNPACK_LO_EXPR < ");
2871 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2872 pp_string (pp
, " > ");
2875 case VEC_UNPACK_FLOAT_HI_EXPR
:
2876 pp_string (pp
, " VEC_UNPACK_FLOAT_HI_EXPR < ");
2877 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2878 pp_string (pp
, " > ");
2881 case VEC_UNPACK_FLOAT_LO_EXPR
:
2882 pp_string (pp
, " VEC_UNPACK_FLOAT_LO_EXPR < ");
2883 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2884 pp_string (pp
, " > ");
2887 case VEC_PACK_TRUNC_EXPR
:
2888 pp_string (pp
, " VEC_PACK_TRUNC_EXPR < ");
2889 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2890 pp_string (pp
, ", ");
2891 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2892 pp_string (pp
, " > ");
2895 case VEC_PACK_SAT_EXPR
:
2896 pp_string (pp
, " VEC_PACK_SAT_EXPR < ");
2897 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2898 pp_string (pp
, ", ");
2899 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2900 pp_string (pp
, " > ");
2903 case VEC_PACK_FIX_TRUNC_EXPR
:
2904 pp_string (pp
, " VEC_PACK_FIX_TRUNC_EXPR < ");
2905 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2906 pp_string (pp
, ", ");
2907 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2908 pp_string (pp
, " > ");
2912 dump_block_node (pp
, node
, spc
, flags
);
2915 case CILK_SPAWN_STMT
:
2916 pp_string (pp
, "_Cilk_spawn ");
2917 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2920 case CILK_SYNC_STMT
:
2921 pp_string (pp
, "_Cilk_sync");
2928 if (is_stmt
&& is_expr
)
2934 /* Print the declaration of a variable. */
2937 print_declaration (pretty_printer
*pp
, tree t
, int spc
, int flags
)
2941 if (TREE_CODE(t
) == NAMELIST_DECL
)
2943 pp_string(pp
, "namelist ");
2944 dump_decl_name (pp
, t
, flags
);
2949 if (TREE_CODE (t
) == TYPE_DECL
)
2950 pp_string (pp
, "typedef ");
2952 if (CODE_CONTAINS_STRUCT (TREE_CODE (t
), TS_DECL_WRTL
) && DECL_REGISTER (t
))
2953 pp_string (pp
, "register ");
2955 if (TREE_PUBLIC (t
) && DECL_EXTERNAL (t
))
2956 pp_string (pp
, "extern ");
2957 else if (TREE_STATIC (t
))
2958 pp_string (pp
, "static ");
2960 /* Print the type and name. */
2961 if (TREE_TYPE (t
) && TREE_CODE (TREE_TYPE (t
)) == ARRAY_TYPE
)
2965 /* Print array's type. */
2966 tmp
= TREE_TYPE (t
);
2967 while (TREE_CODE (TREE_TYPE (tmp
)) == ARRAY_TYPE
)
2968 tmp
= TREE_TYPE (tmp
);
2969 dump_generic_node (pp
, TREE_TYPE (tmp
), spc
, flags
, false);
2971 /* Print variable's name. */
2973 dump_generic_node (pp
, t
, spc
, flags
, false);
2975 /* Print the dimensions. */
2976 tmp
= TREE_TYPE (t
);
2977 while (TREE_CODE (tmp
) == ARRAY_TYPE
)
2979 dump_array_domain (pp
, TYPE_DOMAIN (tmp
), spc
, flags
);
2980 tmp
= TREE_TYPE (tmp
);
2983 else if (TREE_CODE (t
) == FUNCTION_DECL
)
2985 dump_generic_node (pp
, TREE_TYPE (TREE_TYPE (t
)), spc
, flags
, false);
2987 dump_decl_name (pp
, t
, flags
);
2988 dump_function_declaration (pp
, TREE_TYPE (t
), spc
, flags
);
2992 /* Print type declaration. */
2993 dump_generic_node (pp
, TREE_TYPE (t
), spc
, flags
, false);
2995 /* Print variable's name. */
2997 dump_generic_node (pp
, t
, spc
, flags
, false);
3000 if (TREE_CODE (t
) == VAR_DECL
&& DECL_HARD_REGISTER (t
))
3002 pp_string (pp
, " __asm__ ");
3004 dump_generic_node (pp
, DECL_ASSEMBLER_NAME (t
), spc
, flags
, false);
3005 pp_right_paren (pp
);
3008 /* The initial value of a function serves to determine whether the function
3009 is declared or defined. So the following does not apply to function
3011 if (TREE_CODE (t
) != FUNCTION_DECL
)
3013 /* Print the initial value. */
3014 if (DECL_INITIAL (t
))
3019 dump_generic_node (pp
, DECL_INITIAL (t
), spc
, flags
, false);
3023 if (TREE_CODE (t
) == VAR_DECL
&& DECL_HAS_VALUE_EXPR_P (t
))
3025 pp_string (pp
, " [value-expr: ");
3026 dump_generic_node (pp
, DECL_VALUE_EXPR (t
), spc
, flags
, false);
3027 pp_right_bracket (pp
);
3034 /* Prints a structure: name, fields, and methods.
3035 FIXME: Still incomplete. */
3038 print_struct_decl (pretty_printer
*pp
, const_tree node
, int spc
, int flags
)
3040 /* Print the name of the structure. */
3041 if (TYPE_NAME (node
))
3044 if (TREE_CODE (node
) == RECORD_TYPE
)
3045 pp_string (pp
, "struct ");
3046 else if ((TREE_CODE (node
) == UNION_TYPE
3047 || TREE_CODE (node
) == QUAL_UNION_TYPE
))
3048 pp_string (pp
, "union ");
3050 dump_generic_node (pp
, TYPE_NAME (node
), spc
, 0, false);
3053 /* Print the contents of the structure. */
3059 /* Print the fields of the structure. */
3062 tmp
= TYPE_FIELDS (node
);
3065 /* Avoid to print recursively the structure. */
3066 /* FIXME : Not implemented correctly...,
3067 what about the case when we have a cycle in the contain graph? ...
3068 Maybe this could be solved by looking at the scope in which the
3069 structure was declared. */
3070 if (TREE_TYPE (tmp
) != node
3071 && (TREE_CODE (TREE_TYPE (tmp
)) != POINTER_TYPE
3072 || TREE_TYPE (TREE_TYPE (tmp
)) != node
))
3074 print_declaration (pp
, tmp
, spc
+2, flags
);
3077 tmp
= DECL_CHAIN (tmp
);
3081 pp_right_brace (pp
);
3084 /* Return the priority of the operator CODE.
3086 From lowest to highest precedence with either left-to-right (L-R)
3087 or right-to-left (R-L) associativity]:
3090 2 [R-L] = += -= *= /= %= &= ^= |= <<= >>=
3102 14 [R-L] ! ~ ++ -- + - * & (type) sizeof
3103 15 [L-R] fn() [] -> .
3105 unary +, - and * have higher precedence than the corresponding binary
3109 op_code_prio (enum tree_code code
)
3126 case TRUTH_ORIF_EXPR
:
3129 case TRUTH_AND_EXPR
:
3130 case TRUTH_ANDIF_EXPR
:
3137 case TRUTH_XOR_EXPR
:
3154 case UNORDERED_EXPR
:
3165 case VEC_WIDEN_LSHIFT_HI_EXPR
:
3166 case VEC_WIDEN_LSHIFT_LO_EXPR
:
3167 case WIDEN_LSHIFT_EXPR
:
3170 case WIDEN_SUM_EXPR
:
3172 case POINTER_PLUS_EXPR
:
3176 case VEC_WIDEN_MULT_HI_EXPR
:
3177 case VEC_WIDEN_MULT_LO_EXPR
:
3178 case WIDEN_MULT_EXPR
:
3180 case WIDEN_MULT_PLUS_EXPR
:
3181 case WIDEN_MULT_MINUS_EXPR
:
3183 case MULT_HIGHPART_EXPR
:
3184 case TRUNC_DIV_EXPR
:
3186 case FLOOR_DIV_EXPR
:
3187 case ROUND_DIV_EXPR
:
3189 case EXACT_DIV_EXPR
:
3190 case TRUNC_MOD_EXPR
:
3192 case FLOOR_MOD_EXPR
:
3193 case ROUND_MOD_EXPR
:
3197 case TRUTH_NOT_EXPR
:
3199 case POSTINCREMENT_EXPR
:
3200 case POSTDECREMENT_EXPR
:
3201 case PREINCREMENT_EXPR
:
3202 case PREDECREMENT_EXPR
:
3208 case FIX_TRUNC_EXPR
:
3214 case ARRAY_RANGE_REF
:
3218 /* Special expressions. */
3224 case REDUC_MAX_EXPR
:
3225 case REDUC_MIN_EXPR
:
3226 case REDUC_PLUS_EXPR
:
3227 case VEC_UNPACK_HI_EXPR
:
3228 case VEC_UNPACK_LO_EXPR
:
3229 case VEC_UNPACK_FLOAT_HI_EXPR
:
3230 case VEC_UNPACK_FLOAT_LO_EXPR
:
3231 case VEC_PACK_TRUNC_EXPR
:
3232 case VEC_PACK_SAT_EXPR
:
3236 /* Return an arbitrarily high precedence to avoid surrounding single
3237 VAR_DECLs in ()s. */
3242 /* Return the priority of the operator OP. */
3245 op_prio (const_tree op
)
3247 enum tree_code code
;
3252 code
= TREE_CODE (op
);
3253 if (code
== SAVE_EXPR
|| code
== NON_LVALUE_EXPR
)
3254 return op_prio (TREE_OPERAND (op
, 0));
3256 return op_code_prio (code
);
3259 /* Return the symbol associated with operator CODE. */
3262 op_symbol_code (enum tree_code code
)
3270 case TRUTH_ORIF_EXPR
:
3273 case TRUTH_AND_EXPR
:
3274 case TRUTH_ANDIF_EXPR
:
3280 case TRUTH_XOR_EXPR
:
3290 case UNORDERED_EXPR
:
3336 case WIDEN_LSHIFT_EXPR
:
3339 case POINTER_PLUS_EXPR
:
3345 case REDUC_PLUS_EXPR
:
3348 case WIDEN_SUM_EXPR
:
3351 case WIDEN_MULT_EXPR
:
3354 case MULT_HIGHPART_EXPR
:
3364 case TRUTH_NOT_EXPR
:
3371 case TRUNC_DIV_EXPR
:
3378 case FLOOR_DIV_EXPR
:
3381 case ROUND_DIV_EXPR
:
3384 case EXACT_DIV_EXPR
:
3387 case TRUNC_MOD_EXPR
:
3393 case FLOOR_MOD_EXPR
:
3396 case ROUND_MOD_EXPR
:
3399 case PREDECREMENT_EXPR
:
3402 case PREINCREMENT_EXPR
:
3405 case POSTDECREMENT_EXPR
:
3408 case POSTINCREMENT_EXPR
:
3418 return "<<< ??? >>>";
3422 /* Return the symbol associated with operator OP. */
3425 op_symbol (const_tree op
)
3427 return op_symbol_code (TREE_CODE (op
));
3430 /* Prints the name of a call. NODE is the CALL_EXPR_FN of a CALL_EXPR or
3431 the gimple_call_fn of a GIMPLE_CALL. */
3434 print_call_name (pretty_printer
*pp
, tree node
, int flags
)
3438 if (TREE_CODE (op0
) == NON_LVALUE_EXPR
)
3439 op0
= TREE_OPERAND (op0
, 0);
3442 switch (TREE_CODE (op0
))
3447 dump_function_name (pp
, op0
, flags
);
3453 op0
= TREE_OPERAND (op0
, 0);
3458 dump_generic_node (pp
, TREE_OPERAND (op0
, 0), 0, flags
, false);
3459 pp_string (pp
, ") ? ");
3460 dump_generic_node (pp
, TREE_OPERAND (op0
, 1), 0, flags
, false);
3461 pp_string (pp
, " : ");
3462 dump_generic_node (pp
, TREE_OPERAND (op0
, 2), 0, flags
, false);
3466 if (TREE_CODE (TREE_OPERAND (op0
, 0)) == VAR_DECL
)
3467 dump_function_name (pp
, TREE_OPERAND (op0
, 0), flags
);
3469 dump_generic_node (pp
, op0
, 0, flags
, false);
3473 if (integer_zerop (TREE_OPERAND (op0
, 1)))
3475 op0
= TREE_OPERAND (op0
, 0);
3482 dump_generic_node (pp
, op0
, 0, flags
, false);
3490 /* Parses the string STR and replaces new-lines by '\n', tabs by '\t', ... */
3493 pretty_print_string (pretty_printer
*pp
, const char *str
)
3503 pp_string (pp
, "\\b");
3507 pp_string (pp
, "\\f");
3511 pp_string (pp
, "\\n");
3515 pp_string (pp
, "\\r");
3519 pp_string (pp
, "\\t");
3523 pp_string (pp
, "\\v");
3527 pp_string (pp
, "\\\\");
3531 pp_string (pp
, "\\\"");
3535 pp_string (pp
, "\\'");
3538 /* No need to handle \0; the loop terminates on \0. */
3541 pp_string (pp
, "\\1");
3545 pp_string (pp
, "\\2");
3549 pp_string (pp
, "\\3");
3553 pp_string (pp
, "\\4");
3557 pp_string (pp
, "\\5");
3561 pp_string (pp
, "\\6");
3565 pp_string (pp
, "\\7");
3569 pp_character (pp
, str
[0]);
3577 maybe_init_pretty_print (FILE *file
)
3581 tree_pp
= new pretty_printer ();
3582 pp_needs_newline (tree_pp
) = true;
3583 pp_translate_identifiers (tree_pp
) = false;
3586 tree_pp
->buffer
->stream
= file
;
3590 newline_and_indent (pretty_printer
*pp
, int spc
)
3596 /* Handle a %K format for TEXT. Separate from default_tree_printer so
3597 it can also be used in front ends.
3598 %K: a statement, from which EXPR_LOCATION and TREE_BLOCK will be recorded.
3602 percent_K_format (text_info
*text
)
3604 tree t
= va_arg (*text
->args_ptr
, tree
), block
;
3605 text
->set_location (0, EXPR_LOCATION (t
));
3606 gcc_assert (pp_ti_abstract_origin (text
) != NULL
);
3607 block
= TREE_BLOCK (t
);
3608 *pp_ti_abstract_origin (text
) = NULL
;
3612 /* ??? LTO drops all BLOCK_ABSTRACT_ORIGINs apart from those
3613 representing the outermost block of an inlined function.
3614 So walk the BLOCK tree until we hit such a scope. */
3616 && TREE_CODE (block
) == BLOCK
)
3618 if (inlined_function_outer_scope_p (block
))
3620 *pp_ti_abstract_origin (text
) = block
;
3623 block
= BLOCK_SUPERCONTEXT (block
);
3629 && TREE_CODE (block
) == BLOCK
3630 && BLOCK_ABSTRACT_ORIGIN (block
))
3632 tree ao
= BLOCK_ABSTRACT_ORIGIN (block
);
3634 while (TREE_CODE (ao
) == BLOCK
3635 && BLOCK_ABSTRACT_ORIGIN (ao
)
3636 && BLOCK_ABSTRACT_ORIGIN (ao
) != ao
)
3637 ao
= BLOCK_ABSTRACT_ORIGIN (ao
);
3639 if (TREE_CODE (ao
) == FUNCTION_DECL
)
3641 *pp_ti_abstract_origin (text
) = block
;
3644 block
= BLOCK_SUPERCONTEXT (block
);
3648 /* Print the identifier ID to PRETTY-PRINTER. */
3651 pp_tree_identifier (pretty_printer
*pp
, tree id
)
3653 if (pp_translate_identifiers (pp
))
3655 const char *text
= identifier_to_locale (IDENTIFIER_POINTER (id
));
3656 pp_append_text (pp
, text
, text
+ strlen (text
));
3659 pp_append_text (pp
, IDENTIFIER_POINTER (id
),
3660 IDENTIFIER_POINTER (id
) + IDENTIFIER_LENGTH (id
));
3663 /* A helper function that is used to dump function information before the
3667 dump_function_header (FILE *dump_file
, tree fdecl
, int flags
)
3669 const char *dname
, *aname
;
3670 struct cgraph_node
*node
= cgraph_node::get (fdecl
);
3671 struct function
*fun
= DECL_STRUCT_FUNCTION (fdecl
);
3673 dname
= lang_hooks
.decl_printable_name (fdecl
, 2);
3675 if (DECL_ASSEMBLER_NAME_SET_P (fdecl
))
3676 aname
= (IDENTIFIER_POINTER
3677 (DECL_ASSEMBLER_NAME (fdecl
)));
3679 aname
= "<unset-asm-name>";
3681 fprintf (dump_file
, "\n;; Function %s (%s, funcdef_no=%d",
3682 dname
, aname
, fun
->funcdef_no
);
3683 if (!(flags
& TDF_NOUID
))
3684 fprintf (dump_file
, ", decl_uid=%d", DECL_UID (fdecl
));
3687 fprintf (dump_file
, ", cgraph_uid=%d", node
->uid
);
3688 fprintf (dump_file
, ", symbol_order=%d)%s\n\n", node
->order
,
3689 node
->frequency
== NODE_FREQUENCY_HOT
3691 : node
->frequency
== NODE_FREQUENCY_UNLIKELY_EXECUTED
3692 ? " (unlikely executed)"
3693 : node
->frequency
== NODE_FREQUENCY_EXECUTED_ONCE
3694 ? " (executed once)"
3698 fprintf (dump_file
, ")\n\n");
3701 /* Dump double_int D to pretty_printer PP. UNS is true
3702 if D is unsigned and false otherwise. */
3704 pp_double_int (pretty_printer
*pp
, double_int d
, bool uns
)
3707 pp_wide_integer (pp
, d
.low
);
3708 else if (d
.fits_uhwi ())
3709 pp_unsigned_wide_integer (pp
, d
.low
);
3712 unsigned HOST_WIDE_INT low
= d
.low
;
3713 HOST_WIDE_INT high
= d
.high
;
3714 if (!uns
&& d
.is_negative ())
3717 high
= ~high
+ !low
;
3720 /* Would "%x%0*x" or "%x%*0x" get zero-padding on all
3722 sprintf (pp_buffer (pp
)->digit_buffer
,
3723 HOST_WIDE_INT_PRINT_DOUBLE_HEX
,
3724 (unsigned HOST_WIDE_INT
) high
, low
);
3725 pp_string (pp
, pp_buffer (pp
)->digit_buffer
);