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 "double-int.h"
35 #include "stor-layout.h"
37 #include "hard-reg-set.h"
41 #include "statistics.h"
43 #include "fixed-value.h"
44 #include "insn-config.h"
53 #include "tree-pretty-print.h"
54 #include "gimple-expr.h"
58 #include "plugin-api.h"
61 #include "langhooks.h"
62 #include "tree-iterator.h"
63 #include "tree-chrec.h"
65 #include "value-prof.h"
66 #include "wide-int-print.h"
67 #include "internal-fn.h"
68 #include "gomp-constants.h"
70 /* Local functions, macros and variables. */
71 static const char *op_symbol (const_tree
);
72 static void pretty_print_string (pretty_printer
*, const char*);
73 static void newline_and_indent (pretty_printer
*, int);
74 static void maybe_init_pretty_print (FILE *);
75 static void print_struct_decl (pretty_printer
*, const_tree
, int, int);
76 static void do_niy (pretty_printer
*, const_tree
);
78 #define INDENT(SPACE) do { \
79 int i; for (i = 0; i<SPACE; i++) pp_space (pp); } while (0)
81 #define NIY do_niy (pp, node)
83 static pretty_printer
*tree_pp
;
85 /* Try to print something for an unknown tree code. */
88 do_niy (pretty_printer
*pp
, const_tree node
)
92 pp_string (pp
, "<<< Unknown tree: ");
93 pp_string (pp
, get_tree_code_name (TREE_CODE (node
)));
97 len
= TREE_OPERAND_LENGTH (node
);
98 for (i
= 0; i
< len
; ++i
)
100 newline_and_indent (pp
, 2);
101 dump_generic_node (pp
, TREE_OPERAND (node
, i
), 2, 0, false);
105 pp_string (pp
, " >>>");
108 /* Debugging function to print out a generic expression. */
111 debug_generic_expr (tree t
)
113 print_generic_expr (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
);
114 fprintf (stderr
, "\n");
117 /* Debugging function to print out a generic statement. */
120 debug_generic_stmt (tree t
)
122 print_generic_stmt (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
);
123 fprintf (stderr
, "\n");
126 /* Debugging function to print out a chain of trees . */
129 debug_tree_chain (tree t
)
135 print_generic_expr (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
|TDF_UID
);
136 fprintf (stderr
, " ");
140 fprintf (stderr
, "... [cycled back to ");
141 print_generic_expr (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
|TDF_UID
);
142 fprintf (stderr
, "]");
146 fprintf (stderr
, "\n");
149 /* Prints declaration DECL to the FILE with details specified by FLAGS. */
151 print_generic_decl (FILE *file
, tree decl
, int flags
)
153 maybe_init_pretty_print (file
);
154 print_declaration (tree_pp
, decl
, 2, flags
);
155 pp_write_text_to_stream (tree_pp
);
158 /* Print tree T, and its successors, on file FILE. FLAGS specifies details
159 to show in the dump. See TDF_* in dumpfile.h. */
162 print_generic_stmt (FILE *file
, tree t
, int flags
)
164 maybe_init_pretty_print (file
);
165 dump_generic_node (tree_pp
, t
, 0, flags
, true);
166 pp_newline_and_flush (tree_pp
);
169 /* Print tree T, and its successors, on file FILE. FLAGS specifies details
170 to show in the dump. See TDF_* in dumpfile.h. The output is indented by
174 print_generic_stmt_indented (FILE *file
, tree t
, int flags
, int indent
)
178 maybe_init_pretty_print (file
);
180 for (i
= 0; i
< indent
; i
++)
182 dump_generic_node (tree_pp
, t
, indent
, flags
, true);
183 pp_newline_and_flush (tree_pp
);
186 /* Print a single expression T on file FILE. FLAGS specifies details to show
187 in the dump. See TDF_* in dumpfile.h. */
190 print_generic_expr (FILE *file
, tree t
, int flags
)
192 maybe_init_pretty_print (file
);
193 dump_generic_node (tree_pp
, t
, 0, flags
, false);
197 /* Dump the name of a _DECL node and its DECL_UID if TDF_UID is set
201 dump_decl_name (pretty_printer
*pp
, tree node
, int flags
)
203 if (DECL_NAME (node
))
205 if ((flags
& TDF_ASMNAME
) && DECL_ASSEMBLER_NAME_SET_P (node
))
206 pp_tree_identifier (pp
, DECL_ASSEMBLER_NAME (node
));
208 pp_tree_identifier (pp
, DECL_NAME (node
));
210 if ((flags
& TDF_UID
) || DECL_NAME (node
) == NULL_TREE
)
212 if (TREE_CODE (node
) == LABEL_DECL
&& LABEL_DECL_UID (node
) != -1)
213 pp_printf (pp
, "L.%d", (int) LABEL_DECL_UID (node
));
214 else if (TREE_CODE (node
) == DEBUG_EXPR_DECL
)
216 if (flags
& TDF_NOUID
)
217 pp_string (pp
, "D#xxxx");
219 pp_printf (pp
, "D#%i", DEBUG_TEMP_UID (node
));
223 char c
= TREE_CODE (node
) == CONST_DECL
? 'C' : 'D';
224 if (flags
& TDF_NOUID
)
225 pp_printf (pp
, "%c.xxxx", c
);
227 pp_printf (pp
, "%c.%u", c
, DECL_UID (node
));
230 if ((flags
& TDF_ALIAS
) && DECL_PT_UID (node
) != DECL_UID (node
))
232 if (flags
& TDF_NOUID
)
233 pp_printf (pp
, "ptD.xxxx");
235 pp_printf (pp
, "ptD.%u", DECL_PT_UID (node
));
239 /* Like the above, but used for pretty printing function calls. */
242 dump_function_name (pretty_printer
*pp
, tree node
, int flags
)
244 if (CONVERT_EXPR_P (node
))
245 node
= TREE_OPERAND (node
, 0);
246 if (DECL_NAME (node
) && (flags
& TDF_ASMNAME
) == 0)
247 pp_string (pp
, lang_hooks
.decl_printable_name (node
, 1));
249 dump_decl_name (pp
, node
, flags
);
252 /* Dump a function declaration. NODE is the FUNCTION_TYPE. PP, SPC and
253 FLAGS are as in dump_generic_node. */
256 dump_function_declaration (pretty_printer
*pp
, tree node
,
259 bool wrote_arg
= false;
265 /* Print the argument types. */
266 arg
= TYPE_ARG_TYPES (node
);
267 while (arg
&& arg
!= void_list_node
&& arg
!= error_mark_node
)
275 dump_generic_node (pp
, TREE_VALUE (arg
), spc
, flags
, false);
276 arg
= TREE_CHAIN (arg
);
279 /* Drop the trailing void_type_node if we had any previous argument. */
280 if (arg
== void_list_node
&& !wrote_arg
)
281 pp_string (pp
, "void");
282 /* Properly dump vararg function types. */
283 else if (!arg
&& wrote_arg
)
284 pp_string (pp
, ", ...");
285 /* Avoid printing any arg for unprototyped functions. */
290 /* Dump the domain associated with an array. */
293 dump_array_domain (pretty_printer
*pp
, tree domain
, int spc
, int flags
)
295 pp_left_bracket (pp
);
298 tree min
= TYPE_MIN_VALUE (domain
);
299 tree max
= TYPE_MAX_VALUE (domain
);
302 && integer_zerop (min
)
303 && tree_fits_shwi_p (max
))
304 pp_wide_integer (pp
, tree_to_shwi (max
) + 1);
308 dump_generic_node (pp
, min
, spc
, flags
, false);
311 dump_generic_node (pp
, max
, spc
, flags
, false);
315 pp_string (pp
, "<unknown>");
316 pp_right_bracket (pp
);
320 /* Dump OpenMP clause CLAUSE. PP, CLAUSE, SPC and FLAGS are as in
321 dump_generic_node. */
324 dump_omp_clause (pretty_printer
*pp
, tree clause
, int spc
, int flags
)
328 switch (OMP_CLAUSE_CODE (clause
))
330 case OMP_CLAUSE_PRIVATE
:
333 case OMP_CLAUSE_SHARED
:
336 case OMP_CLAUSE_FIRSTPRIVATE
:
337 name
= "firstprivate";
339 case OMP_CLAUSE_LASTPRIVATE
:
340 name
= "lastprivate";
342 case OMP_CLAUSE_COPYIN
:
345 case OMP_CLAUSE_COPYPRIVATE
:
346 name
= "copyprivate";
348 case OMP_CLAUSE_UNIFORM
:
351 case OMP_CLAUSE__LOOPTEMP_
:
354 case OMP_CLAUSE_DEVICE_RESIDENT
:
355 name
= "device_resident";
357 case OMP_CLAUSE_USE_DEVICE
:
361 pp_string (pp
, name
);
363 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
368 case OMP_CLAUSE_REDUCTION
:
369 pp_string (pp
, "reduction(");
370 if (OMP_CLAUSE_REDUCTION_CODE (clause
) != ERROR_MARK
)
373 op_symbol_code (OMP_CLAUSE_REDUCTION_CODE (clause
)));
376 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
382 pp_string (pp
, "if(");
383 dump_generic_node (pp
, OMP_CLAUSE_IF_EXPR (clause
),
388 case OMP_CLAUSE_NUM_THREADS
:
389 pp_string (pp
, "num_threads(");
390 dump_generic_node (pp
, OMP_CLAUSE_NUM_THREADS_EXPR (clause
),
395 case OMP_CLAUSE__CILK_FOR_COUNT_
:
396 pp_string (pp
, "_Cilk_for_count_(");
397 dump_generic_node (pp
, OMP_CLAUSE_OPERAND (clause
, 0),
402 case OMP_CLAUSE_NOWAIT
:
403 pp_string (pp
, "nowait");
405 case OMP_CLAUSE_ORDERED
:
406 pp_string (pp
, "ordered");
409 case OMP_CLAUSE_DEFAULT
:
410 pp_string (pp
, "default(");
411 switch (OMP_CLAUSE_DEFAULT_KIND (clause
))
413 case OMP_CLAUSE_DEFAULT_UNSPECIFIED
:
415 case OMP_CLAUSE_DEFAULT_SHARED
:
416 pp_string (pp
, "shared");
418 case OMP_CLAUSE_DEFAULT_NONE
:
419 pp_string (pp
, "none");
421 case OMP_CLAUSE_DEFAULT_PRIVATE
:
422 pp_string (pp
, "private");
424 case OMP_CLAUSE_DEFAULT_FIRSTPRIVATE
:
425 pp_string (pp
, "firstprivate");
433 case OMP_CLAUSE_SCHEDULE
:
434 pp_string (pp
, "schedule(");
435 switch (OMP_CLAUSE_SCHEDULE_KIND (clause
))
437 case OMP_CLAUSE_SCHEDULE_STATIC
:
438 pp_string (pp
, "static");
440 case OMP_CLAUSE_SCHEDULE_DYNAMIC
:
441 pp_string (pp
, "dynamic");
443 case OMP_CLAUSE_SCHEDULE_GUIDED
:
444 pp_string (pp
, "guided");
446 case OMP_CLAUSE_SCHEDULE_RUNTIME
:
447 pp_string (pp
, "runtime");
449 case OMP_CLAUSE_SCHEDULE_AUTO
:
450 pp_string (pp
, "auto");
452 case OMP_CLAUSE_SCHEDULE_CILKFOR
:
453 pp_string (pp
, "cilk-for grain");
458 if (OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (clause
))
461 dump_generic_node (pp
, OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (clause
),
467 case OMP_CLAUSE_UNTIED
:
468 pp_string (pp
, "untied");
471 case OMP_CLAUSE_COLLAPSE
:
472 pp_string (pp
, "collapse(");
473 dump_generic_node (pp
, OMP_CLAUSE_COLLAPSE_EXPR (clause
),
478 case OMP_CLAUSE_FINAL
:
479 pp_string (pp
, "final(");
480 dump_generic_node (pp
, OMP_CLAUSE_FINAL_EXPR (clause
),
485 case OMP_CLAUSE_MERGEABLE
:
486 pp_string (pp
, "mergeable");
489 case OMP_CLAUSE_LINEAR
:
490 pp_string (pp
, "linear(");
491 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
494 dump_generic_node (pp
, OMP_CLAUSE_LINEAR_STEP (clause
),
499 case OMP_CLAUSE_ALIGNED
:
500 pp_string (pp
, "aligned(");
501 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
503 if (OMP_CLAUSE_ALIGNED_ALIGNMENT (clause
))
506 dump_generic_node (pp
, OMP_CLAUSE_ALIGNED_ALIGNMENT (clause
),
512 case OMP_CLAUSE_DEPEND
:
513 pp_string (pp
, "depend(");
514 switch (OMP_CLAUSE_DEPEND_KIND (clause
))
516 case OMP_CLAUSE_DEPEND_IN
:
517 pp_string (pp
, "in");
519 case OMP_CLAUSE_DEPEND_OUT
:
520 pp_string (pp
, "out");
522 case OMP_CLAUSE_DEPEND_INOUT
:
523 pp_string (pp
, "inout");
529 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
535 pp_string (pp
, "map(");
536 switch (OMP_CLAUSE_MAP_KIND (clause
))
539 case GOMP_MAP_POINTER
:
540 pp_string (pp
, "alloc");
543 case GOMP_MAP_TO_PSET
:
544 pp_string (pp
, "to");
547 pp_string (pp
, "from");
549 case GOMP_MAP_TOFROM
:
550 pp_string (pp
, "tofrom");
552 case GOMP_MAP_FORCE_ALLOC
:
553 pp_string (pp
, "force_alloc");
555 case GOMP_MAP_FORCE_TO
:
556 pp_string (pp
, "force_to");
558 case GOMP_MAP_FORCE_FROM
:
559 pp_string (pp
, "force_from");
561 case GOMP_MAP_FORCE_TOFROM
:
562 pp_string (pp
, "force_tofrom");
564 case GOMP_MAP_FORCE_PRESENT
:
565 pp_string (pp
, "force_present");
567 case GOMP_MAP_FORCE_DEALLOC
:
568 pp_string (pp
, "force_dealloc");
570 case GOMP_MAP_FORCE_DEVICEPTR
:
571 pp_string (pp
, "force_deviceptr");
577 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
580 if (OMP_CLAUSE_SIZE (clause
))
582 if (OMP_CLAUSE_CODE (clause
) == OMP_CLAUSE_MAP
583 && OMP_CLAUSE_MAP_KIND (clause
) == GOMP_MAP_POINTER
)
584 pp_string (pp
, " [pointer assign, bias: ");
585 else if (OMP_CLAUSE_CODE (clause
) == OMP_CLAUSE_MAP
586 && OMP_CLAUSE_MAP_KIND (clause
) == GOMP_MAP_TO_PSET
)
587 pp_string (pp
, " [pointer set, len: ");
589 pp_string (pp
, " [len: ");
590 dump_generic_node (pp
, OMP_CLAUSE_SIZE (clause
),
592 pp_right_bracket (pp
);
597 case OMP_CLAUSE_FROM
:
598 pp_string (pp
, "from(");
599 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
601 goto print_clause_size
;
604 pp_string (pp
, "to(");
605 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
607 goto print_clause_size
;
609 case OMP_CLAUSE__CACHE_
:
611 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
613 goto print_clause_size
;
615 case OMP_CLAUSE_NUM_TEAMS
:
616 pp_string (pp
, "num_teams(");
617 dump_generic_node (pp
, OMP_CLAUSE_NUM_TEAMS_EXPR (clause
),
622 case OMP_CLAUSE_THREAD_LIMIT
:
623 pp_string (pp
, "thread_limit(");
624 dump_generic_node (pp
, OMP_CLAUSE_THREAD_LIMIT_EXPR (clause
),
629 case OMP_CLAUSE_DEVICE
:
630 pp_string (pp
, "device(");
631 dump_generic_node (pp
, OMP_CLAUSE_DEVICE_ID (clause
),
636 case OMP_CLAUSE_DIST_SCHEDULE
:
637 pp_string (pp
, "dist_schedule(static");
638 if (OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR (clause
))
641 dump_generic_node (pp
,
642 OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR (clause
),
648 case OMP_CLAUSE_PROC_BIND
:
649 pp_string (pp
, "proc_bind(");
650 switch (OMP_CLAUSE_PROC_BIND_KIND (clause
))
652 case OMP_CLAUSE_PROC_BIND_MASTER
:
653 pp_string (pp
, "master");
655 case OMP_CLAUSE_PROC_BIND_CLOSE
:
656 pp_string (pp
, "close");
658 case OMP_CLAUSE_PROC_BIND_SPREAD
:
659 pp_string (pp
, "spread");
667 case OMP_CLAUSE_SAFELEN
:
668 pp_string (pp
, "safelen(");
669 dump_generic_node (pp
, OMP_CLAUSE_SAFELEN_EXPR (clause
),
674 case OMP_CLAUSE_SIMDLEN
:
675 pp_string (pp
, "simdlen(");
676 dump_generic_node (pp
, OMP_CLAUSE_SIMDLEN_EXPR (clause
),
681 case OMP_CLAUSE__SIMDUID_
:
682 pp_string (pp
, "_simduid_(");
683 dump_generic_node (pp
, OMP_CLAUSE__SIMDUID__DECL (clause
),
688 case OMP_CLAUSE_GANG
:
689 pp_string (pp
, "gang");
690 if (OMP_CLAUSE_GANG_EXPR (clause
) != NULL_TREE
)
692 pp_string (pp
, "(num: ");
693 dump_generic_node (pp
, OMP_CLAUSE_GANG_EXPR (clause
),
696 if (OMP_CLAUSE_GANG_STATIC_EXPR (clause
) != NULL_TREE
)
698 if (OMP_CLAUSE_GANG_EXPR (clause
) == NULL_TREE
)
702 pp_string (pp
, "static:");
703 if (OMP_CLAUSE_GANG_STATIC_EXPR (clause
)
704 == integer_minus_one_node
)
705 pp_character (pp
, '*');
707 dump_generic_node (pp
, OMP_CLAUSE_GANG_STATIC_EXPR (clause
),
710 if (OMP_CLAUSE_GANG_EXPR (clause
) != NULL_TREE
711 || OMP_CLAUSE_GANG_STATIC_EXPR (clause
) != NULL_TREE
)
715 case OMP_CLAUSE_ASYNC
:
716 pp_string (pp
, "async");
717 if (OMP_CLAUSE_ASYNC_EXPR (clause
))
719 pp_character(pp
, '(');
720 dump_generic_node (pp
, OMP_CLAUSE_ASYNC_EXPR (clause
),
722 pp_character(pp
, ')');
726 case OMP_CLAUSE_AUTO
:
728 pp_string (pp
, omp_clause_code_name
[OMP_CLAUSE_CODE (clause
)]);
731 case OMP_CLAUSE_WAIT
:
732 pp_string (pp
, "wait(");
733 dump_generic_node (pp
, OMP_CLAUSE_WAIT_EXPR (clause
),
735 pp_character(pp
, ')');
738 case OMP_CLAUSE_WORKER
:
739 pp_string (pp
, "worker");
740 if (OMP_CLAUSE_WORKER_EXPR (clause
) != NULL_TREE
)
743 dump_generic_node (pp
, OMP_CLAUSE_WORKER_EXPR (clause
),
749 case OMP_CLAUSE_VECTOR
:
750 pp_string (pp
, "vector");
751 if (OMP_CLAUSE_VECTOR_EXPR (clause
) != NULL_TREE
)
754 dump_generic_node (pp
, OMP_CLAUSE_VECTOR_EXPR (clause
),
760 case OMP_CLAUSE_NUM_GANGS
:
761 pp_string (pp
, "num_gangs(");
762 dump_generic_node (pp
, OMP_CLAUSE_NUM_GANGS_EXPR (clause
),
764 pp_character (pp
, ')');
767 case OMP_CLAUSE_NUM_WORKERS
:
768 pp_string (pp
, "num_workers(");
769 dump_generic_node (pp
, OMP_CLAUSE_NUM_WORKERS_EXPR (clause
),
771 pp_character (pp
, ')');
774 case OMP_CLAUSE_VECTOR_LENGTH
:
775 pp_string (pp
, "vector_length(");
776 dump_generic_node (pp
, OMP_CLAUSE_VECTOR_LENGTH_EXPR (clause
),
778 pp_character (pp
, ')');
781 case OMP_CLAUSE_INBRANCH
:
782 pp_string (pp
, "inbranch");
784 case OMP_CLAUSE_NOTINBRANCH
:
785 pp_string (pp
, "notinbranch");
788 pp_string (pp
, "for");
790 case OMP_CLAUSE_PARALLEL
:
791 pp_string (pp
, "parallel");
793 case OMP_CLAUSE_SECTIONS
:
794 pp_string (pp
, "sections");
796 case OMP_CLAUSE_TASKGROUP
:
797 pp_string (pp
, "taskgroup");
799 case OMP_CLAUSE_INDEPENDENT
:
800 pp_string (pp
, "independent");
804 /* Should never happen. */
805 dump_generic_node (pp
, clause
, spc
, flags
, false);
811 /* Dump the list of OpenMP clauses. PP, SPC and FLAGS are as in
812 dump_generic_node. */
815 dump_omp_clauses (pretty_printer
*pp
, tree clause
, int spc
, int flags
)
823 dump_omp_clause (pp
, clause
, spc
, flags
);
824 clause
= OMP_CLAUSE_CHAIN (clause
);
832 /* Dump location LOC to PP. */
835 dump_location (pretty_printer
*pp
, location_t loc
)
837 expanded_location xloc
= expand_location (loc
);
839 pp_left_bracket (pp
);
842 pp_string (pp
, xloc
.file
);
845 pp_decimal_int (pp
, xloc
.line
);
847 pp_decimal_int (pp
, xloc
.column
);
848 pp_string (pp
, "] ");
852 /* Dump lexical block BLOCK. PP, SPC and FLAGS are as in
853 dump_generic_node. */
856 dump_block_node (pretty_printer
*pp
, tree block
, int spc
, int flags
)
860 pp_printf (pp
, "BLOCK #%d ", BLOCK_NUMBER (block
));
862 if (flags
& TDF_ADDRESS
)
863 pp_printf (pp
, "[%p] ", (void *) block
);
865 if (BLOCK_ABSTRACT (block
))
866 pp_string (pp
, "[abstract] ");
868 if (TREE_ASM_WRITTEN (block
))
869 pp_string (pp
, "[written] ");
871 if (flags
& TDF_SLIM
)
874 if (BLOCK_SOURCE_LOCATION (block
))
875 dump_location (pp
, BLOCK_SOURCE_LOCATION (block
));
877 newline_and_indent (pp
, spc
+ 2);
879 if (BLOCK_SUPERCONTEXT (block
))
881 pp_string (pp
, "SUPERCONTEXT: ");
882 dump_generic_node (pp
, BLOCK_SUPERCONTEXT (block
), 0,
883 flags
| TDF_SLIM
, false);
884 newline_and_indent (pp
, spc
+ 2);
887 if (BLOCK_SUBBLOCKS (block
))
889 pp_string (pp
, "SUBBLOCKS: ");
890 for (t
= BLOCK_SUBBLOCKS (block
); t
; t
= BLOCK_CHAIN (t
))
892 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
895 newline_and_indent (pp
, spc
+ 2);
898 if (BLOCK_CHAIN (block
))
900 pp_string (pp
, "SIBLINGS: ");
901 for (t
= BLOCK_CHAIN (block
); t
; t
= BLOCK_CHAIN (t
))
903 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
906 newline_and_indent (pp
, spc
+ 2);
909 if (BLOCK_VARS (block
))
911 pp_string (pp
, "VARS: ");
912 for (t
= BLOCK_VARS (block
); t
; t
= TREE_CHAIN (t
))
914 dump_generic_node (pp
, t
, 0, flags
, false);
917 newline_and_indent (pp
, spc
+ 2);
920 if (vec_safe_length (BLOCK_NONLOCALIZED_VARS (block
)) > 0)
923 vec
<tree
, va_gc
> *nlv
= BLOCK_NONLOCALIZED_VARS (block
);
925 pp_string (pp
, "NONLOCALIZED_VARS: ");
926 FOR_EACH_VEC_ELT (*nlv
, i
, t
)
928 dump_generic_node (pp
, t
, 0, flags
, false);
931 newline_and_indent (pp
, spc
+ 2);
934 if (BLOCK_ABSTRACT_ORIGIN (block
))
936 pp_string (pp
, "ABSTRACT_ORIGIN: ");
937 dump_generic_node (pp
, BLOCK_ABSTRACT_ORIGIN (block
), 0,
938 flags
| TDF_SLIM
, false);
939 newline_and_indent (pp
, spc
+ 2);
942 if (BLOCK_FRAGMENT_ORIGIN (block
))
944 pp_string (pp
, "FRAGMENT_ORIGIN: ");
945 dump_generic_node (pp
, BLOCK_FRAGMENT_ORIGIN (block
), 0,
946 flags
| TDF_SLIM
, false);
947 newline_and_indent (pp
, spc
+ 2);
950 if (BLOCK_FRAGMENT_CHAIN (block
))
952 pp_string (pp
, "FRAGMENT_CHAIN: ");
953 for (t
= BLOCK_FRAGMENT_CHAIN (block
); t
; t
= BLOCK_FRAGMENT_CHAIN (t
))
955 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
958 newline_and_indent (pp
, spc
+ 2);
963 /* Dump the node NODE on the pretty_printer PP, SPC spaces of
964 indent. FLAGS specifies details to show in the dump (see TDF_* in
965 dumpfile.h). If IS_STMT is true, the object printed is considered
966 to be a statement and it is terminated by ';' if appropriate. */
969 dump_generic_node (pretty_printer
*pp
, tree node
, int spc
, int flags
,
978 if (node
== NULL_TREE
)
981 is_expr
= EXPR_P (node
);
983 if (is_stmt
&& (flags
& TDF_STMTADDR
))
984 pp_printf (pp
, "<&%p> ", (void *)node
);
986 if ((flags
& TDF_LINENO
) && EXPR_HAS_LOCATION (node
))
987 dump_location (pp
, EXPR_LOCATION (node
));
989 code
= TREE_CODE (node
);
993 pp_string (pp
, "<<< error >>>");
996 case IDENTIFIER_NODE
:
997 pp_tree_identifier (pp
, node
);
1001 while (node
&& node
!= error_mark_node
)
1003 if (TREE_PURPOSE (node
))
1005 dump_generic_node (pp
, TREE_PURPOSE (node
), spc
, flags
, false);
1008 dump_generic_node (pp
, TREE_VALUE (node
), spc
, flags
, false);
1009 node
= TREE_CHAIN (node
);
1010 if (node
&& TREE_CODE (node
) == TREE_LIST
)
1019 dump_generic_node (pp
, BINFO_TYPE (node
), spc
, flags
, false);
1025 if (TREE_VEC_LENGTH (node
) > 0)
1027 size_t len
= TREE_VEC_LENGTH (node
);
1028 for (i
= 0; i
< len
- 1; i
++)
1030 dump_generic_node (pp
, TREE_VEC_ELT (node
, i
), spc
, flags
,
1035 dump_generic_node (pp
, TREE_VEC_ELT (node
, len
- 1), spc
,
1042 case POINTER_BOUNDS_TYPE
:
1045 case FIXED_POINT_TYPE
:
1051 unsigned int quals
= TYPE_QUALS (node
);
1052 enum tree_code_class tclass
;
1054 if (quals
& TYPE_QUAL_ATOMIC
)
1055 pp_string (pp
, "atomic ");
1056 if (quals
& TYPE_QUAL_CONST
)
1057 pp_string (pp
, "const ");
1058 else if (quals
& TYPE_QUAL_VOLATILE
)
1059 pp_string (pp
, "volatile ");
1060 else if (quals
& TYPE_QUAL_RESTRICT
)
1061 pp_string (pp
, "restrict ");
1063 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
1065 pp_string (pp
, "<address-space-");
1066 pp_decimal_int (pp
, TYPE_ADDR_SPACE (node
));
1067 pp_string (pp
, "> ");
1070 tclass
= TREE_CODE_CLASS (TREE_CODE (node
));
1072 if (tclass
== tcc_declaration
)
1074 if (DECL_NAME (node
))
1075 dump_decl_name (pp
, node
, flags
);
1077 pp_string (pp
, "<unnamed type decl>");
1079 else if (tclass
== tcc_type
)
1081 if (TYPE_NAME (node
))
1083 if (TREE_CODE (TYPE_NAME (node
)) == IDENTIFIER_NODE
)
1084 pp_tree_identifier (pp
, TYPE_NAME (node
));
1085 else if (TREE_CODE (TYPE_NAME (node
)) == TYPE_DECL
1086 && DECL_NAME (TYPE_NAME (node
)))
1087 dump_decl_name (pp
, TYPE_NAME (node
), flags
);
1089 pp_string (pp
, "<unnamed type>");
1091 else if (TREE_CODE (node
) == VECTOR_TYPE
)
1093 pp_string (pp
, "vector");
1095 pp_wide_integer (pp
, TYPE_VECTOR_SUBPARTS (node
));
1096 pp_string (pp
, ") ");
1097 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1099 else if (TREE_CODE (node
) == INTEGER_TYPE
)
1101 if (TYPE_PRECISION (node
) == CHAR_TYPE_SIZE
)
1102 pp_string (pp
, (TYPE_UNSIGNED (node
)
1105 else if (TYPE_PRECISION (node
) == SHORT_TYPE_SIZE
)
1106 pp_string (pp
, (TYPE_UNSIGNED (node
)
1109 else if (TYPE_PRECISION (node
) == INT_TYPE_SIZE
)
1110 pp_string (pp
, (TYPE_UNSIGNED (node
)
1113 else if (TYPE_PRECISION (node
) == LONG_TYPE_SIZE
)
1114 pp_string (pp
, (TYPE_UNSIGNED (node
)
1117 else if (TYPE_PRECISION (node
) == LONG_LONG_TYPE_SIZE
)
1118 pp_string (pp
, (TYPE_UNSIGNED (node
)
1119 ? "unsigned long long"
1120 : "signed long long"));
1121 else if (TYPE_PRECISION (node
) >= CHAR_TYPE_SIZE
1122 && exact_log2 (TYPE_PRECISION (node
)) != -1)
1124 pp_string (pp
, (TYPE_UNSIGNED (node
) ? "uint" : "int"));
1125 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1126 pp_string (pp
, "_t");
1130 pp_string (pp
, (TYPE_UNSIGNED (node
)
1131 ? "<unnamed-unsigned:"
1132 : "<unnamed-signed:"));
1133 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1137 else if (TREE_CODE (node
) == COMPLEX_TYPE
)
1139 pp_string (pp
, "__complex__ ");
1140 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1142 else if (TREE_CODE (node
) == REAL_TYPE
)
1144 pp_string (pp
, "<float:");
1145 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1148 else if (TREE_CODE (node
) == FIXED_POINT_TYPE
)
1150 pp_string (pp
, "<fixed-point-");
1151 pp_string (pp
, TYPE_SATURATING (node
) ? "sat:" : "nonsat:");
1152 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1155 else if (TREE_CODE (node
) == VOID_TYPE
)
1156 pp_string (pp
, "void");
1158 pp_string (pp
, "<unnamed type>");
1164 case REFERENCE_TYPE
:
1165 str
= (TREE_CODE (node
) == POINTER_TYPE
? "*" : "&");
1167 if (TREE_TYPE (node
) == NULL
)
1169 pp_string (pp
, str
);
1170 pp_string (pp
, "<null type>");
1172 else if (TREE_CODE (TREE_TYPE (node
)) == FUNCTION_TYPE
)
1174 tree fnode
= TREE_TYPE (node
);
1176 dump_generic_node (pp
, TREE_TYPE (fnode
), spc
, flags
, false);
1179 pp_string (pp
, str
);
1180 if (TYPE_NAME (node
) && DECL_NAME (TYPE_NAME (node
)))
1181 dump_decl_name (pp
, TYPE_NAME (node
), flags
);
1182 else if (flags
& TDF_NOUID
)
1183 pp_printf (pp
, "<Txxxx>");
1185 pp_printf (pp
, "<T%x>", TYPE_UID (node
));
1187 pp_right_paren (pp
);
1188 dump_function_declaration (pp
, fnode
, spc
, flags
);
1192 unsigned int quals
= TYPE_QUALS (node
);
1194 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1196 pp_string (pp
, str
);
1198 if (quals
& TYPE_QUAL_CONST
)
1199 pp_string (pp
, " const");
1200 if (quals
& TYPE_QUAL_VOLATILE
)
1201 pp_string (pp
, " volatile");
1202 if (quals
& TYPE_QUAL_RESTRICT
)
1203 pp_string (pp
, " restrict");
1205 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
1207 pp_string (pp
, " <address-space-");
1208 pp_decimal_int (pp
, TYPE_ADDR_SPACE (node
));
1212 if (TYPE_REF_CAN_ALIAS_ALL (node
))
1213 pp_string (pp
, " {ref-all}");
1223 if (integer_zerop (TREE_OPERAND (node
, 1))
1224 /* Dump the types of INTEGER_CSTs explicitly, for we can't
1225 infer them and MEM_ATTR caching will share MEM_REFs
1226 with differently-typed op0s. */
1227 && TREE_CODE (TREE_OPERAND (node
, 0)) != INTEGER_CST
1228 /* Released SSA_NAMES have no TREE_TYPE. */
1229 && TREE_TYPE (TREE_OPERAND (node
, 0)) != NULL_TREE
1230 /* Same pointer types, but ignoring POINTER_TYPE vs.
1232 && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 0)))
1233 == TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 1))))
1234 && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (node
, 0)))
1235 == TYPE_MODE (TREE_TYPE (TREE_OPERAND (node
, 1))))
1236 && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node
, 0)))
1237 == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node
, 1))))
1238 /* Same value types ignoring qualifiers. */
1239 && (TYPE_MAIN_VARIANT (TREE_TYPE (node
))
1240 == TYPE_MAIN_VARIANT
1241 (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 1)))))
1242 && (!(flags
& TDF_ALIAS
)
1243 || MR_DEPENDENCE_CLIQUE (node
) == 0))
1245 if (TREE_CODE (TREE_OPERAND (node
, 0)) != ADDR_EXPR
)
1248 dump_generic_node (pp
, TREE_OPERAND (node
, 0),
1252 dump_generic_node (pp
,
1253 TREE_OPERAND (TREE_OPERAND (node
, 0), 0),
1260 pp_string (pp
, "MEM[");
1262 ptype
= TYPE_MAIN_VARIANT (TREE_TYPE (TREE_OPERAND (node
, 1)));
1263 dump_generic_node (pp
, ptype
,
1264 spc
, flags
| TDF_SLIM
, false);
1265 pp_right_paren (pp
);
1266 dump_generic_node (pp
, TREE_OPERAND (node
, 0),
1268 if (!integer_zerop (TREE_OPERAND (node
, 1)))
1270 pp_string (pp
, " + ");
1271 dump_generic_node (pp
, TREE_OPERAND (node
, 1),
1274 if ((flags
& TDF_ALIAS
)
1275 && MR_DEPENDENCE_CLIQUE (node
) != 0)
1277 pp_string (pp
, " clique ");
1278 pp_unsigned_wide_integer (pp
, MR_DEPENDENCE_CLIQUE (node
));
1279 pp_string (pp
, " base ");
1280 pp_unsigned_wide_integer (pp
, MR_DEPENDENCE_BASE (node
));
1282 pp_right_bracket (pp
);
1287 case TARGET_MEM_REF
:
1289 const char *sep
= "";
1292 pp_string (pp
, "MEM[");
1294 if (TREE_CODE (TMR_BASE (node
)) == ADDR_EXPR
)
1296 pp_string (pp
, sep
);
1298 pp_string (pp
, "symbol: ");
1299 dump_generic_node (pp
, TREE_OPERAND (TMR_BASE (node
), 0),
1304 pp_string (pp
, sep
);
1306 pp_string (pp
, "base: ");
1307 dump_generic_node (pp
, TMR_BASE (node
), spc
, flags
, false);
1309 tmp
= TMR_INDEX2 (node
);
1312 pp_string (pp
, sep
);
1314 pp_string (pp
, "base: ");
1315 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1317 tmp
= TMR_INDEX (node
);
1320 pp_string (pp
, sep
);
1322 pp_string (pp
, "index: ");
1323 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1325 tmp
= TMR_STEP (node
);
1328 pp_string (pp
, sep
);
1330 pp_string (pp
, "step: ");
1331 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1333 tmp
= TMR_OFFSET (node
);
1336 pp_string (pp
, sep
);
1338 pp_string (pp
, "offset: ");
1339 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1341 pp_right_bracket (pp
);
1349 /* Print the innermost component type. */
1350 for (tmp
= TREE_TYPE (node
); TREE_CODE (tmp
) == ARRAY_TYPE
;
1351 tmp
= TREE_TYPE (tmp
))
1353 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1355 /* Print the dimensions. */
1356 for (tmp
= node
; TREE_CODE (tmp
) == ARRAY_TYPE
; tmp
= TREE_TYPE (tmp
))
1357 dump_array_domain (pp
, TYPE_DOMAIN (tmp
), spc
, flags
);
1363 case QUAL_UNION_TYPE
:
1365 unsigned int quals
= TYPE_QUALS (node
);
1367 if (quals
& TYPE_QUAL_ATOMIC
)
1368 pp_string (pp
, "atomic ");
1369 if (quals
& TYPE_QUAL_CONST
)
1370 pp_string (pp
, "const ");
1371 if (quals
& TYPE_QUAL_VOLATILE
)
1372 pp_string (pp
, "volatile ");
1374 /* Print the name of the structure. */
1375 if (TREE_CODE (node
) == RECORD_TYPE
)
1376 pp_string (pp
, "struct ");
1377 else if (TREE_CODE (node
) == UNION_TYPE
)
1378 pp_string (pp
, "union ");
1380 if (TYPE_NAME (node
))
1381 dump_generic_node (pp
, TYPE_NAME (node
), spc
, flags
, false);
1382 else if (!(flags
& TDF_SLIM
))
1383 /* FIXME: If we eliminate the 'else' above and attempt
1384 to show the fields for named types, we may get stuck
1385 following a cycle of pointers to structs. The alleged
1386 self-reference check in print_struct_decl will not detect
1387 cycles involving more than one pointer or struct type. */
1388 print_struct_decl (pp
, node
, spc
, flags
);
1397 if (TREE_CODE (TREE_TYPE (node
)) == POINTER_TYPE
)
1399 /* In the case of a pointer, one may want to divide by the
1400 size of the pointed-to type. Unfortunately, this not
1401 straightforward. The C front-end maps expressions
1406 in such a way that the two INTEGER_CST nodes for "5" have
1407 different values but identical types. In the latter
1408 case, the 5 is multiplied by sizeof (int) in c-common.c
1409 (pointer_int_sum) to convert it to a byte address, and
1410 yet the type of the node is left unchanged. Argh. What
1411 is consistent though is that the number value corresponds
1412 to bytes (UNITS) offset.
1414 NB: Neither of the following divisors can be trivially
1415 used to recover the original literal:
1417 TREE_INT_CST_LOW (TYPE_SIZE_UNIT (TREE_TYPE (node)))
1418 TYPE_PRECISION (TREE_TYPE (TREE_TYPE (node))) */
1419 pp_wide_integer (pp
, TREE_INT_CST_LOW (node
));
1420 pp_string (pp
, "B"); /* pseudo-unit */
1422 else if (tree_fits_shwi_p (node
))
1423 pp_wide_integer (pp
, tree_to_shwi (node
));
1424 else if (tree_fits_uhwi_p (node
))
1425 pp_unsigned_wide_integer (pp
, tree_to_uhwi (node
));
1428 wide_int val
= node
;
1430 if (wi::neg_p (val
, TYPE_SIGN (TREE_TYPE (node
))))
1435 print_hex (val
, pp_buffer (pp
)->digit_buffer
);
1436 pp_string (pp
, pp_buffer (pp
)->digit_buffer
);
1438 if (TREE_OVERFLOW (node
))
1439 pp_string (pp
, "(OVF)");
1443 /* Code copied from print_node. */
1446 if (TREE_OVERFLOW (node
))
1447 pp_string (pp
, " overflow");
1449 #if !defined(REAL_IS_NOT_DOUBLE) || defined(REAL_ARITHMETIC)
1450 d
= TREE_REAL_CST (node
);
1451 if (REAL_VALUE_ISINF (d
))
1452 pp_string (pp
, REAL_VALUE_NEGATIVE (d
) ? " -Inf" : " Inf");
1453 else if (REAL_VALUE_ISNAN (d
))
1454 pp_string (pp
, " Nan");
1458 real_to_decimal (string
, &d
, sizeof (string
), 0, 1);
1459 pp_string (pp
, string
);
1464 unsigned char *p
= (unsigned char *) &TREE_REAL_CST (node
);
1465 pp_string (pp
, "0x");
1466 for (i
= 0; i
< sizeof TREE_REAL_CST (node
); i
++)
1467 output_formatted_integer (pp
, "%02x", *p
++);
1476 fixed_to_decimal (string
, TREE_FIXED_CST_PTR (node
), sizeof (string
));
1477 pp_string (pp
, string
);
1482 pp_string (pp
, "__complex__ (");
1483 dump_generic_node (pp
, TREE_REALPART (node
), spc
, flags
, false);
1484 pp_string (pp
, ", ");
1485 dump_generic_node (pp
, TREE_IMAGPART (node
), spc
, flags
, false);
1486 pp_right_paren (pp
);
1490 pp_string (pp
, "\"");
1491 pretty_print_string (pp
, TREE_STRING_POINTER (node
));
1492 pp_string (pp
, "\"");
1498 pp_string (pp
, "{ ");
1499 for (i
= 0; i
< VECTOR_CST_NELTS (node
); ++i
)
1502 pp_string (pp
, ", ");
1503 dump_generic_node (pp
, VECTOR_CST_ELT (node
, i
),
1506 pp_string (pp
, " }");
1512 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1514 if (TREE_CODE (node
) == METHOD_TYPE
)
1516 if (TYPE_METHOD_BASETYPE (node
))
1517 dump_decl_name (pp
, TYPE_NAME (TYPE_METHOD_BASETYPE (node
)),
1520 pp_string (pp
, "<null method basetype>");
1521 pp_colon_colon (pp
);
1523 if (TYPE_NAME (node
) && DECL_NAME (TYPE_NAME (node
)))
1524 dump_decl_name (pp
, TYPE_NAME (node
), flags
);
1525 else if (flags
& TDF_NOUID
)
1526 pp_printf (pp
, "<Txxxx>");
1528 pp_printf (pp
, "<T%x>", TYPE_UID (node
));
1529 dump_function_declaration (pp
, node
, spc
, flags
);
1534 dump_decl_name (pp
, node
, flags
);
1538 if (DECL_NAME (node
))
1539 dump_decl_name (pp
, node
, flags
);
1540 else if (LABEL_DECL_UID (node
) != -1)
1541 pp_printf (pp
, "<L%d>", (int) LABEL_DECL_UID (node
));
1544 if (flags
& TDF_NOUID
)
1545 pp_string (pp
, "<D.xxxx>");
1547 pp_printf (pp
, "<D.%u>", DECL_UID (node
));
1552 if (DECL_IS_BUILTIN (node
))
1554 /* Don't print the declaration of built-in types. */
1557 if (DECL_NAME (node
))
1558 dump_decl_name (pp
, node
, flags
);
1559 else if (TYPE_NAME (TREE_TYPE (node
)) != node
)
1561 if ((TREE_CODE (TREE_TYPE (node
)) == RECORD_TYPE
1562 || TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
)
1563 && TYPE_METHODS (TREE_TYPE (node
)))
1565 /* The type is a c++ class: all structures have at least
1567 pp_string (pp
, "class ");
1568 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1573 (TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
1574 ? "union" : "struct "));
1575 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1579 pp_string (pp
, "<anon>");
1585 case DEBUG_EXPR_DECL
:
1586 case NAMESPACE_DECL
:
1588 dump_decl_name (pp
, node
, flags
);
1592 pp_string (pp
, "<retval>");
1596 op0
= TREE_OPERAND (node
, 0);
1599 && (TREE_CODE (op0
) == INDIRECT_REF
1600 || (TREE_CODE (op0
) == MEM_REF
1601 && TREE_CODE (TREE_OPERAND (op0
, 0)) != ADDR_EXPR
1602 && integer_zerop (TREE_OPERAND (op0
, 1))
1603 /* Dump the types of INTEGER_CSTs explicitly, for we
1604 can't infer them and MEM_ATTR caching will share
1605 MEM_REFs with differently-typed op0s. */
1606 && TREE_CODE (TREE_OPERAND (op0
, 0)) != INTEGER_CST
1607 /* Released SSA_NAMES have no TREE_TYPE. */
1608 && TREE_TYPE (TREE_OPERAND (op0
, 0)) != NULL_TREE
1609 /* Same pointer types, but ignoring POINTER_TYPE vs.
1611 && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 0)))
1612 == TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 1))))
1613 && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0
, 0)))
1614 == TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0
, 1))))
1615 && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0
, 0)))
1616 == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0
, 1))))
1617 /* Same value types ignoring qualifiers. */
1618 && (TYPE_MAIN_VARIANT (TREE_TYPE (op0
))
1619 == TYPE_MAIN_VARIANT
1620 (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 1)))))
1621 && MR_DEPENDENCE_CLIQUE (op0
) == 0)))
1623 op0
= TREE_OPERAND (op0
, 0);
1626 if (op_prio (op0
) < op_prio (node
))
1628 dump_generic_node (pp
, op0
, spc
, flags
, false);
1629 if (op_prio (op0
) < op_prio (node
))
1630 pp_right_paren (pp
);
1631 pp_string (pp
, str
);
1632 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1633 op0
= component_ref_field_offset (node
);
1634 if (op0
&& TREE_CODE (op0
) != INTEGER_CST
)
1636 pp_string (pp
, "{off: ");
1637 dump_generic_node (pp
, op0
, spc
, flags
, false);
1638 pp_right_brace (pp
);
1643 pp_string (pp
, "BIT_FIELD_REF <");
1644 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1645 pp_string (pp
, ", ");
1646 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1647 pp_string (pp
, ", ");
1648 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
1653 case ARRAY_RANGE_REF
:
1654 op0
= TREE_OPERAND (node
, 0);
1655 if (op_prio (op0
) < op_prio (node
))
1657 dump_generic_node (pp
, op0
, spc
, flags
, false);
1658 if (op_prio (op0
) < op_prio (node
))
1659 pp_right_paren (pp
);
1660 pp_left_bracket (pp
);
1661 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1662 if (TREE_CODE (node
) == ARRAY_RANGE_REF
)
1663 pp_string (pp
, " ...");
1664 pp_right_bracket (pp
);
1666 op0
= array_ref_low_bound (node
);
1667 op1
= array_ref_element_size (node
);
1669 if (!integer_zerop (op0
)
1670 || TREE_OPERAND (node
, 2)
1671 || TREE_OPERAND (node
, 3))
1673 pp_string (pp
, "{lb: ");
1674 dump_generic_node (pp
, op0
, spc
, flags
, false);
1675 pp_string (pp
, " sz: ");
1676 dump_generic_node (pp
, op1
, spc
, flags
, false);
1677 pp_right_brace (pp
);
1683 unsigned HOST_WIDE_INT ix
;
1685 bool is_struct_init
= false;
1686 bool is_array_init
= false;
1689 if (TREE_CLOBBER_P (node
))
1690 pp_string (pp
, "CLOBBER");
1691 else if (TREE_CODE (TREE_TYPE (node
)) == RECORD_TYPE
1692 || TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
)
1693 is_struct_init
= true;
1694 else if (TREE_CODE (TREE_TYPE (node
)) == ARRAY_TYPE
1695 && TYPE_DOMAIN (TREE_TYPE (node
))
1696 && TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
)))
1697 && TREE_CODE (TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
))))
1700 tree minv
= TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
)));
1701 is_array_init
= true;
1702 curidx
= wi::to_widest (minv
);
1704 FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (node
), ix
, field
, val
)
1711 dump_generic_node (pp
, field
, spc
, flags
, false);
1714 else if (is_array_init
1715 && (TREE_CODE (field
) != INTEGER_CST
1716 || curidx
!= wi::to_widest (field
)))
1718 pp_left_bracket (pp
);
1719 if (TREE_CODE (field
) == RANGE_EXPR
)
1721 dump_generic_node (pp
, TREE_OPERAND (field
, 0), spc
,
1723 pp_string (pp
, " ... ");
1724 dump_generic_node (pp
, TREE_OPERAND (field
, 1), spc
,
1726 if (TREE_CODE (TREE_OPERAND (field
, 1)) == INTEGER_CST
)
1727 curidx
= wi::to_widest (TREE_OPERAND (field
, 1));
1730 dump_generic_node (pp
, field
, spc
, flags
, false);
1731 if (TREE_CODE (field
) == INTEGER_CST
)
1732 curidx
= wi::to_widest (field
);
1733 pp_string (pp
, "]=");
1738 if (val
&& TREE_CODE (val
) == ADDR_EXPR
)
1739 if (TREE_CODE (TREE_OPERAND (val
, 0)) == FUNCTION_DECL
)
1740 val
= TREE_OPERAND (val
, 0);
1741 if (val
&& TREE_CODE (val
) == FUNCTION_DECL
)
1742 dump_decl_name (pp
, val
, flags
);
1744 dump_generic_node (pp
, val
, spc
, flags
, false);
1745 if (ix
!= vec_safe_length (CONSTRUCTOR_ELTS (node
)) - 1)
1751 pp_right_brace (pp
);
1758 if (flags
& TDF_SLIM
)
1760 pp_string (pp
, "<COMPOUND_EXPR>");
1764 dump_generic_node (pp
, TREE_OPERAND (node
, 0),
1765 spc
, flags
, !(flags
& TDF_SLIM
));
1766 if (flags
& TDF_SLIM
)
1767 newline_and_indent (pp
, spc
);
1774 for (tp
= &TREE_OPERAND (node
, 1);
1775 TREE_CODE (*tp
) == COMPOUND_EXPR
;
1776 tp
= &TREE_OPERAND (*tp
, 1))
1778 dump_generic_node (pp
, TREE_OPERAND (*tp
, 0),
1779 spc
, flags
, !(flags
& TDF_SLIM
));
1780 if (flags
& TDF_SLIM
)
1781 newline_and_indent (pp
, spc
);
1789 dump_generic_node (pp
, *tp
, spc
, flags
, !(flags
& TDF_SLIM
));
1793 case STATEMENT_LIST
:
1795 tree_stmt_iterator si
;
1798 if (flags
& TDF_SLIM
)
1800 pp_string (pp
, "<STATEMENT_LIST>");
1804 for (si
= tsi_start (node
); !tsi_end_p (si
); tsi_next (&si
))
1807 newline_and_indent (pp
, spc
);
1810 dump_generic_node (pp
, tsi_stmt (si
), spc
, flags
, true);
1817 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
,
1822 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
,
1827 pp_string (pp
, "TARGET_EXPR <");
1828 dump_generic_node (pp
, TARGET_EXPR_SLOT (node
), spc
, flags
, false);
1831 dump_generic_node (pp
, TARGET_EXPR_INITIAL (node
), spc
, flags
, false);
1836 print_declaration (pp
, DECL_EXPR_DECL (node
), spc
, flags
);
1841 if (TREE_TYPE (node
) == NULL
|| TREE_TYPE (node
) == void_type_node
)
1843 pp_string (pp
, "if (");
1844 dump_generic_node (pp
, COND_EXPR_COND (node
), spc
, flags
, false);
1845 pp_right_paren (pp
);
1846 /* The lowered cond_exprs should always be printed in full. */
1847 if (COND_EXPR_THEN (node
)
1848 && (IS_EMPTY_STMT (COND_EXPR_THEN (node
))
1849 || TREE_CODE (COND_EXPR_THEN (node
)) == GOTO_EXPR
)
1850 && COND_EXPR_ELSE (node
)
1851 && (IS_EMPTY_STMT (COND_EXPR_ELSE (node
))
1852 || TREE_CODE (COND_EXPR_ELSE (node
)) == GOTO_EXPR
))
1855 dump_generic_node (pp
, COND_EXPR_THEN (node
),
1857 if (!IS_EMPTY_STMT (COND_EXPR_ELSE (node
)))
1859 pp_string (pp
, " else ");
1860 dump_generic_node (pp
, COND_EXPR_ELSE (node
),
1864 else if (!(flags
& TDF_SLIM
))
1866 /* Output COND_EXPR_THEN. */
1867 if (COND_EXPR_THEN (node
))
1869 newline_and_indent (pp
, spc
+2);
1871 newline_and_indent (pp
, spc
+4);
1872 dump_generic_node (pp
, COND_EXPR_THEN (node
), spc
+4,
1874 newline_and_indent (pp
, spc
+2);
1875 pp_right_brace (pp
);
1878 /* Output COND_EXPR_ELSE. */
1879 if (COND_EXPR_ELSE (node
)
1880 && !IS_EMPTY_STMT (COND_EXPR_ELSE (node
)))
1882 newline_and_indent (pp
, spc
);
1883 pp_string (pp
, "else");
1884 newline_and_indent (pp
, spc
+2);
1886 newline_and_indent (pp
, spc
+4);
1887 dump_generic_node (pp
, COND_EXPR_ELSE (node
), spc
+4,
1889 newline_and_indent (pp
, spc
+2);
1890 pp_right_brace (pp
);
1897 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1901 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1905 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
1911 if (!(flags
& TDF_SLIM
))
1913 if (BIND_EXPR_VARS (node
))
1917 for (op0
= BIND_EXPR_VARS (node
); op0
; op0
= DECL_CHAIN (op0
))
1919 print_declaration (pp
, op0
, spc
+2, flags
);
1924 newline_and_indent (pp
, spc
+2);
1925 dump_generic_node (pp
, BIND_EXPR_BODY (node
), spc
+2, flags
, true);
1926 newline_and_indent (pp
, spc
);
1927 pp_right_brace (pp
);
1933 if (CALL_EXPR_FN (node
) != NULL_TREE
)
1934 print_call_name (pp
, CALL_EXPR_FN (node
), flags
);
1936 pp_string (pp
, internal_fn_name (CALL_EXPR_IFN (node
)));
1938 /* Print parameters. */
1943 call_expr_arg_iterator iter
;
1944 FOR_EACH_CALL_EXPR_ARG (arg
, iter
, node
)
1946 dump_generic_node (pp
, arg
, spc
, flags
, false);
1947 if (more_call_expr_args_p (&iter
))
1954 if (CALL_EXPR_VA_ARG_PACK (node
))
1956 if (call_expr_nargs (node
) > 0)
1961 pp_string (pp
, "__builtin_va_arg_pack ()");
1963 pp_right_paren (pp
);
1965 op1
= CALL_EXPR_STATIC_CHAIN (node
);
1968 pp_string (pp
, " [static-chain: ");
1969 dump_generic_node (pp
, op1
, spc
, flags
, false);
1970 pp_right_bracket (pp
);
1973 if (CALL_EXPR_RETURN_SLOT_OPT (node
))
1974 pp_string (pp
, " [return slot optimization]");
1975 if (CALL_EXPR_TAILCALL (node
))
1976 pp_string (pp
, " [tail call]");
1979 case WITH_CLEANUP_EXPR
:
1983 case CLEANUP_POINT_EXPR
:
1984 pp_string (pp
, "<<cleanup_point ");
1985 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1986 pp_string (pp
, ">>");
1989 case PLACEHOLDER_EXPR
:
1990 pp_string (pp
, "<PLACEHOLDER_EXPR ");
1991 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1995 /* Binary arithmetic and logic expressions. */
1996 case WIDEN_SUM_EXPR
:
1997 case WIDEN_MULT_EXPR
:
1999 case MULT_HIGHPART_EXPR
:
2001 case POINTER_PLUS_EXPR
:
2003 case TRUNC_DIV_EXPR
:
2005 case FLOOR_DIV_EXPR
:
2006 case ROUND_DIV_EXPR
:
2007 case TRUNC_MOD_EXPR
:
2009 case FLOOR_MOD_EXPR
:
2010 case ROUND_MOD_EXPR
:
2012 case EXACT_DIV_EXPR
:
2017 case WIDEN_LSHIFT_EXPR
:
2021 case TRUTH_ANDIF_EXPR
:
2022 case TRUTH_ORIF_EXPR
:
2023 case TRUTH_AND_EXPR
:
2025 case TRUTH_XOR_EXPR
:
2039 case UNORDERED_EXPR
:
2041 const char *op
= op_symbol (node
);
2042 op0
= TREE_OPERAND (node
, 0);
2043 op1
= TREE_OPERAND (node
, 1);
2045 /* When the operands are expressions with less priority,
2046 keep semantics of the tree representation. */
2047 if (op_prio (op0
) <= op_prio (node
))
2050 dump_generic_node (pp
, op0
, spc
, flags
, false);
2051 pp_right_paren (pp
);
2054 dump_generic_node (pp
, op0
, spc
, flags
, false);
2060 /* When the operands are expressions with less priority,
2061 keep semantics of the tree representation. */
2062 if (op_prio (op1
) <= op_prio (node
))
2065 dump_generic_node (pp
, op1
, spc
, flags
, false);
2066 pp_right_paren (pp
);
2069 dump_generic_node (pp
, op1
, spc
, flags
, false);
2073 /* Unary arithmetic and logic expressions. */
2076 case TRUTH_NOT_EXPR
:
2078 case PREDECREMENT_EXPR
:
2079 case PREINCREMENT_EXPR
:
2081 if (TREE_CODE (node
) == ADDR_EXPR
2082 && (TREE_CODE (TREE_OPERAND (node
, 0)) == STRING_CST
2083 || TREE_CODE (TREE_OPERAND (node
, 0)) == FUNCTION_DECL
))
2084 ; /* Do not output '&' for strings and function pointers. */
2086 pp_string (pp
, op_symbol (node
));
2088 if (op_prio (TREE_OPERAND (node
, 0)) < op_prio (node
))
2091 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2092 pp_right_paren (pp
);
2095 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2098 case POSTDECREMENT_EXPR
:
2099 case POSTINCREMENT_EXPR
:
2100 if (op_prio (TREE_OPERAND (node
, 0)) < op_prio (node
))
2103 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2104 pp_right_paren (pp
);
2107 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2108 pp_string (pp
, op_symbol (node
));
2112 pp_string (pp
, "MIN_EXPR <");
2113 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2114 pp_string (pp
, ", ");
2115 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2120 pp_string (pp
, "MAX_EXPR <");
2121 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2122 pp_string (pp
, ", ");
2123 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2128 pp_string (pp
, "ABS_EXPR <");
2129 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2137 case ADDR_SPACE_CONVERT_EXPR
:
2138 case FIXED_CONVERT_EXPR
:
2139 case FIX_TRUNC_EXPR
:
2142 type
= TREE_TYPE (node
);
2143 op0
= TREE_OPERAND (node
, 0);
2144 if (type
!= TREE_TYPE (op0
))
2147 dump_generic_node (pp
, type
, spc
, flags
, false);
2148 pp_string (pp
, ") ");
2150 if (op_prio (op0
) < op_prio (node
))
2152 dump_generic_node (pp
, op0
, spc
, flags
, false);
2153 if (op_prio (op0
) < op_prio (node
))
2154 pp_right_paren (pp
);
2157 case VIEW_CONVERT_EXPR
:
2158 pp_string (pp
, "VIEW_CONVERT_EXPR<");
2159 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2160 pp_string (pp
, ">(");
2161 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2162 pp_right_paren (pp
);
2166 pp_string (pp
, "((");
2167 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2168 pp_string (pp
, "))");
2171 case NON_LVALUE_EXPR
:
2172 pp_string (pp
, "NON_LVALUE_EXPR <");
2173 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2178 pp_string (pp
, "SAVE_EXPR <");
2179 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2184 pp_string (pp
, "COMPLEX_EXPR <");
2185 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2186 pp_string (pp
, ", ");
2187 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2192 pp_string (pp
, "CONJ_EXPR <");
2193 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2198 pp_string (pp
, "REALPART_EXPR <");
2199 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2204 pp_string (pp
, "IMAGPART_EXPR <");
2205 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2210 pp_string (pp
, "VA_ARG_EXPR <");
2211 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2215 case TRY_FINALLY_EXPR
:
2216 case TRY_CATCH_EXPR
:
2217 pp_string (pp
, "try");
2218 newline_and_indent (pp
, spc
+2);
2220 newline_and_indent (pp
, spc
+4);
2221 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
+4, flags
, true);
2222 newline_and_indent (pp
, spc
+2);
2223 pp_right_brace (pp
);
2224 newline_and_indent (pp
, spc
);
2226 (TREE_CODE (node
) == TRY_CATCH_EXPR
) ? "catch" : "finally");
2227 newline_and_indent (pp
, spc
+2);
2229 newline_and_indent (pp
, spc
+4);
2230 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
+4, flags
, true);
2231 newline_and_indent (pp
, spc
+2);
2232 pp_right_brace (pp
);
2237 pp_string (pp
, "catch (");
2238 dump_generic_node (pp
, CATCH_TYPES (node
), spc
+2, flags
, false);
2239 pp_right_paren (pp
);
2240 newline_and_indent (pp
, spc
+2);
2242 newline_and_indent (pp
, spc
+4);
2243 dump_generic_node (pp
, CATCH_BODY (node
), spc
+4, flags
, true);
2244 newline_and_indent (pp
, spc
+2);
2245 pp_right_brace (pp
);
2249 case EH_FILTER_EXPR
:
2250 pp_string (pp
, "<<<eh_filter (");
2251 dump_generic_node (pp
, EH_FILTER_TYPES (node
), spc
+2, flags
, false);
2252 pp_string (pp
, ")>>>");
2253 newline_and_indent (pp
, spc
+2);
2255 newline_and_indent (pp
, spc
+4);
2256 dump_generic_node (pp
, EH_FILTER_FAILURE (node
), spc
+4, flags
, true);
2257 newline_and_indent (pp
, spc
+2);
2258 pp_right_brace (pp
);
2263 op0
= TREE_OPERAND (node
, 0);
2264 /* If this is for break or continue, don't bother printing it. */
2265 if (DECL_NAME (op0
))
2267 const char *name
= IDENTIFIER_POINTER (DECL_NAME (op0
));
2268 if (strcmp (name
, "break") == 0
2269 || strcmp (name
, "continue") == 0)
2272 dump_generic_node (pp
, op0
, spc
, flags
, false);
2274 if (DECL_NONLOCAL (op0
))
2275 pp_string (pp
, " [non-local]");
2279 pp_string (pp
, "while (1)");
2280 if (!(flags
& TDF_SLIM
))
2282 newline_and_indent (pp
, spc
+2);
2284 newline_and_indent (pp
, spc
+4);
2285 dump_generic_node (pp
, LOOP_EXPR_BODY (node
), spc
+4, flags
, true);
2286 newline_and_indent (pp
, spc
+2);
2287 pp_right_brace (pp
);
2293 pp_string (pp
, "// predicted ");
2294 if (PREDICT_EXPR_OUTCOME (node
))
2295 pp_string (pp
, "likely by ");
2297 pp_string (pp
, "unlikely by ");
2298 pp_string (pp
, predictor_name (PREDICT_EXPR_PREDICTOR (node
)));
2299 pp_string (pp
, " predictor.");
2303 pp_string (pp
, "ANNOTATE_EXPR <");
2304 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2305 switch ((enum annot_expr_kind
) TREE_INT_CST_LOW (TREE_OPERAND (node
, 1)))
2307 case annot_expr_ivdep_kind
:
2308 pp_string (pp
, ", ivdep");
2310 case annot_expr_no_vector_kind
:
2311 pp_string (pp
, ", no-vector");
2313 case annot_expr_vector_kind
:
2314 pp_string (pp
, ", vector");
2323 pp_string (pp
, "return");
2324 op0
= TREE_OPERAND (node
, 0);
2328 if (TREE_CODE (op0
) == MODIFY_EXPR
)
2329 dump_generic_node (pp
, TREE_OPERAND (op0
, 1),
2332 dump_generic_node (pp
, op0
, spc
, flags
, false);
2337 pp_string (pp
, "if (");
2338 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2339 pp_string (pp
, ") break");
2343 pp_string (pp
, "switch (");
2344 dump_generic_node (pp
, SWITCH_COND (node
), spc
, flags
, false);
2345 pp_right_paren (pp
);
2346 if (!(flags
& TDF_SLIM
))
2348 newline_and_indent (pp
, spc
+2);
2350 if (SWITCH_BODY (node
))
2352 newline_and_indent (pp
, spc
+4);
2353 dump_generic_node (pp
, SWITCH_BODY (node
), spc
+4, flags
,
2358 tree vec
= SWITCH_LABELS (node
);
2359 size_t i
, n
= TREE_VEC_LENGTH (vec
);
2360 for (i
= 0; i
< n
; ++i
)
2362 tree elt
= TREE_VEC_ELT (vec
, i
);
2363 newline_and_indent (pp
, spc
+4);
2366 dump_generic_node (pp
, elt
, spc
+4, flags
, false);
2367 pp_string (pp
, " goto ");
2368 dump_generic_node (pp
, CASE_LABEL (elt
), spc
+4,
2373 pp_string (pp
, "case ???: goto ???;");
2376 newline_and_indent (pp
, spc
+2);
2377 pp_right_brace (pp
);
2383 op0
= GOTO_DESTINATION (node
);
2384 if (TREE_CODE (op0
) != SSA_NAME
&& DECL_P (op0
) && DECL_NAME (op0
))
2386 const char *name
= IDENTIFIER_POINTER (DECL_NAME (op0
));
2387 if (strcmp (name
, "break") == 0
2388 || strcmp (name
, "continue") == 0)
2390 pp_string (pp
, name
);
2394 pp_string (pp
, "goto ");
2395 dump_generic_node (pp
, op0
, spc
, flags
, false);
2399 pp_string (pp
, "__asm__");
2400 if (ASM_VOLATILE_P (node
))
2401 pp_string (pp
, " __volatile__");
2403 dump_generic_node (pp
, ASM_STRING (node
), spc
, flags
, false);
2405 dump_generic_node (pp
, ASM_OUTPUTS (node
), spc
, flags
, false);
2407 dump_generic_node (pp
, ASM_INPUTS (node
), spc
, flags
, false);
2408 if (ASM_CLOBBERS (node
))
2411 dump_generic_node (pp
, ASM_CLOBBERS (node
), spc
, flags
, false);
2413 pp_right_paren (pp
);
2416 case CASE_LABEL_EXPR
:
2417 if (CASE_LOW (node
) && CASE_HIGH (node
))
2419 pp_string (pp
, "case ");
2420 dump_generic_node (pp
, CASE_LOW (node
), spc
, flags
, false);
2421 pp_string (pp
, " ... ");
2422 dump_generic_node (pp
, CASE_HIGH (node
), spc
, flags
, false);
2424 else if (CASE_LOW (node
))
2426 pp_string (pp
, "case ");
2427 dump_generic_node (pp
, CASE_LOW (node
), spc
, flags
, false);
2430 pp_string (pp
, "default");
2435 pp_string (pp
, "OBJ_TYPE_REF(");
2436 dump_generic_node (pp
, OBJ_TYPE_REF_EXPR (node
), spc
, flags
, false);
2438 if (!(flags
& TDF_SLIM
) && virtual_method_call_p (node
))
2440 pp_string (pp
, "(");
2441 dump_generic_node (pp
, obj_type_ref_class (node
), spc
, flags
, false);
2442 pp_string (pp
, ")");
2444 dump_generic_node (pp
, OBJ_TYPE_REF_OBJECT (node
), spc
, flags
, false);
2446 dump_generic_node (pp
, OBJ_TYPE_REF_TOKEN (node
), spc
, flags
, false);
2447 pp_right_paren (pp
);
2451 if (SSA_NAME_IDENTIFIER (node
))
2452 dump_generic_node (pp
, SSA_NAME_IDENTIFIER (node
),
2455 pp_decimal_int (pp
, SSA_NAME_VERSION (node
));
2456 if (SSA_NAME_IS_DEFAULT_DEF (node
))
2457 pp_string (pp
, "(D)");
2458 if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (node
))
2459 pp_string (pp
, "(ab)");
2462 case WITH_SIZE_EXPR
:
2463 pp_string (pp
, "WITH_SIZE_EXPR <");
2464 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2465 pp_string (pp
, ", ");
2466 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2471 pp_string (pp
, "ASSERT_EXPR <");
2472 dump_generic_node (pp
, ASSERT_EXPR_VAR (node
), spc
, flags
, false);
2473 pp_string (pp
, ", ");
2474 dump_generic_node (pp
, ASSERT_EXPR_COND (node
), spc
, flags
, false);
2479 pp_string (pp
, "scev_known");
2482 case SCEV_NOT_KNOWN
:
2483 pp_string (pp
, "scev_not_known");
2486 case POLYNOMIAL_CHREC
:
2488 dump_generic_node (pp
, CHREC_LEFT (node
), spc
, flags
, false);
2489 pp_string (pp
, ", +, ");
2490 dump_generic_node (pp
, CHREC_RIGHT (node
), spc
, flags
, false);
2491 pp_string (pp
, "}_");
2492 dump_generic_node (pp
, CHREC_VAR (node
), spc
, flags
, false);
2496 case REALIGN_LOAD_EXPR
:
2497 pp_string (pp
, "REALIGN_LOAD <");
2498 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2499 pp_string (pp
, ", ");
2500 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2501 pp_string (pp
, ", ");
2502 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2507 pp_string (pp
, " VEC_COND_EXPR < ");
2508 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2509 pp_string (pp
, " , ");
2510 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2511 pp_string (pp
, " , ");
2512 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2513 pp_string (pp
, " > ");
2517 pp_string (pp
, " VEC_PERM_EXPR < ");
2518 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2519 pp_string (pp
, " , ");
2520 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2521 pp_string (pp
, " , ");
2522 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2523 pp_string (pp
, " > ");
2527 pp_string (pp
, " DOT_PROD_EXPR < ");
2528 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2529 pp_string (pp
, ", ");
2530 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2531 pp_string (pp
, ", ");
2532 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2533 pp_string (pp
, " > ");
2536 case WIDEN_MULT_PLUS_EXPR
:
2537 pp_string (pp
, " WIDEN_MULT_PLUS_EXPR < ");
2538 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2539 pp_string (pp
, ", ");
2540 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2541 pp_string (pp
, ", ");
2542 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2543 pp_string (pp
, " > ");
2546 case WIDEN_MULT_MINUS_EXPR
:
2547 pp_string (pp
, " WIDEN_MULT_MINUS_EXPR < ");
2548 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2549 pp_string (pp
, ", ");
2550 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2551 pp_string (pp
, ", ");
2552 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2553 pp_string (pp
, " > ");
2557 pp_string (pp
, " FMA_EXPR < ");
2558 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2559 pp_string (pp
, ", ");
2560 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2561 pp_string (pp
, ", ");
2562 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2563 pp_string (pp
, " > ");
2567 pp_string (pp
, "#pragma acc parallel");
2568 dump_omp_clauses (pp
, OACC_PARALLEL_CLAUSES (node
), spc
, flags
);
2572 pp_string (pp
, "#pragma acc kernels");
2573 dump_omp_clauses (pp
, OACC_KERNELS_CLAUSES (node
), spc
, flags
);
2577 pp_string (pp
, "#pragma acc data");
2578 dump_omp_clauses (pp
, OACC_DATA_CLAUSES (node
), spc
, flags
);
2581 case OACC_HOST_DATA
:
2582 pp_string (pp
, "#pragma acc host_data");
2583 dump_omp_clauses (pp
, OACC_HOST_DATA_CLAUSES (node
), spc
, flags
);
2587 pp_string (pp
, "#pragma acc declare");
2588 dump_omp_clauses (pp
, OACC_DECLARE_CLAUSES (node
), spc
, flags
);
2592 pp_string (pp
, "#pragma acc update");
2593 dump_omp_clauses (pp
, OACC_UPDATE_CLAUSES (node
), spc
, flags
);
2596 case OACC_ENTER_DATA
:
2597 pp_string (pp
, "#pragma acc enter data");
2598 dump_omp_clauses (pp
, OACC_ENTER_DATA_CLAUSES (node
), spc
, flags
);
2601 case OACC_EXIT_DATA
:
2602 pp_string (pp
, "#pragma acc exit data");
2603 dump_omp_clauses (pp
, OACC_EXIT_DATA_CLAUSES (node
), spc
, flags
);
2607 pp_string (pp
, "#pragma acc cache");
2608 dump_omp_clauses (pp
, OACC_CACHE_CLAUSES (node
), spc
, flags
);
2612 pp_string (pp
, "#pragma omp parallel");
2613 dump_omp_clauses (pp
, OMP_PARALLEL_CLAUSES (node
), spc
, flags
);
2616 if (!(flags
& TDF_SLIM
) && OMP_BODY (node
))
2618 newline_and_indent (pp
, spc
+ 2);
2620 newline_and_indent (pp
, spc
+ 4);
2621 dump_generic_node (pp
, OMP_BODY (node
), spc
+ 4, flags
, false);
2622 newline_and_indent (pp
, spc
+ 2);
2623 pp_right_brace (pp
);
2629 pp_string (pp
, "#pragma omp task");
2630 dump_omp_clauses (pp
, OMP_TASK_CLAUSES (node
), spc
, flags
);
2634 pp_string (pp
, "#pragma omp for");
2638 pp_string (pp
, "#pragma omp simd");
2642 pp_string (pp
, "#pragma simd");
2646 /* This label points one line after dumping the clauses.
2647 For _Cilk_for the clauses are dumped after the _Cilk_for (...)
2648 parameters are printed out. */
2649 goto dump_omp_loop_cilk_for
;
2651 case OMP_DISTRIBUTE
:
2652 pp_string (pp
, "#pragma omp distribute");
2656 pp_string (pp
, "#pragma acc loop");
2660 pp_string (pp
, "#pragma omp teams");
2661 dump_omp_clauses (pp
, OMP_TEAMS_CLAUSES (node
), spc
, flags
);
2664 case OMP_TARGET_DATA
:
2665 pp_string (pp
, "#pragma omp target data");
2666 dump_omp_clauses (pp
, OMP_TARGET_DATA_CLAUSES (node
), spc
, flags
);
2670 pp_string (pp
, "#pragma omp target");
2671 dump_omp_clauses (pp
, OMP_TARGET_CLAUSES (node
), spc
, flags
);
2674 case OMP_TARGET_UPDATE
:
2675 pp_string (pp
, "#pragma omp target update");
2676 dump_omp_clauses (pp
, OMP_TARGET_UPDATE_CLAUSES (node
), spc
, flags
);
2681 dump_omp_clauses (pp
, OMP_FOR_CLAUSES (node
), spc
, flags
);
2683 dump_omp_loop_cilk_for
:
2684 if (!(flags
& TDF_SLIM
))
2688 if (OMP_FOR_PRE_BODY (node
))
2690 if (TREE_CODE (node
) == CILK_FOR
)
2691 pp_string (pp
, " ");
2693 newline_and_indent (pp
, spc
+ 2);
2696 newline_and_indent (pp
, spc
);
2697 dump_generic_node (pp
, OMP_FOR_PRE_BODY (node
),
2700 if (OMP_FOR_INIT (node
))
2703 for (i
= 0; i
< TREE_VEC_LENGTH (OMP_FOR_INIT (node
)); i
++)
2706 if (TREE_CODE (node
) != CILK_FOR
|| OMP_FOR_PRE_BODY (node
))
2707 newline_and_indent (pp
, spc
);
2708 if (TREE_CODE (node
) == CILK_FOR
)
2709 pp_string (pp
, "_Cilk_for (");
2711 pp_string (pp
, "for (");
2712 dump_generic_node (pp
,
2713 TREE_VEC_ELT (OMP_FOR_INIT (node
), i
),
2715 pp_string (pp
, "; ");
2716 dump_generic_node (pp
,
2717 TREE_VEC_ELT (OMP_FOR_COND (node
), i
),
2719 pp_string (pp
, "; ");
2720 dump_generic_node (pp
,
2721 TREE_VEC_ELT (OMP_FOR_INCR (node
), i
),
2723 pp_right_paren (pp
);
2725 if (TREE_CODE (node
) == CILK_FOR
)
2726 dump_omp_clauses (pp
, OMP_FOR_CLAUSES (node
), spc
, flags
);
2728 if (OMP_FOR_BODY (node
))
2730 newline_and_indent (pp
, spc
+ 2);
2732 newline_and_indent (pp
, spc
+ 4);
2733 dump_generic_node (pp
, OMP_FOR_BODY (node
), spc
+ 4, flags
,
2735 newline_and_indent (pp
, spc
+ 2);
2736 pp_right_brace (pp
);
2738 if (OMP_FOR_INIT (node
))
2739 spc
-= 2 * TREE_VEC_LENGTH (OMP_FOR_INIT (node
)) - 2;
2740 if (OMP_FOR_PRE_BODY (node
))
2743 newline_and_indent (pp
, spc
+ 2);
2744 pp_right_brace (pp
);
2751 pp_string (pp
, "#pragma omp sections");
2752 dump_omp_clauses (pp
, OMP_SECTIONS_CLAUSES (node
), spc
, flags
);
2756 pp_string (pp
, "#pragma omp section");
2760 pp_string (pp
, "#pragma omp master");
2764 pp_string (pp
, "#pragma omp taskgroup");
2768 pp_string (pp
, "#pragma omp ordered");
2772 pp_string (pp
, "#pragma omp critical");
2773 if (OMP_CRITICAL_NAME (node
))
2777 dump_generic_node (pp
, OMP_CRITICAL_NAME (node
), spc
,
2779 pp_right_paren (pp
);
2784 pp_string (pp
, "#pragma omp atomic");
2785 if (OMP_ATOMIC_SEQ_CST (node
))
2786 pp_string (pp
, " seq_cst");
2787 newline_and_indent (pp
, spc
+ 2);
2788 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2792 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2795 case OMP_ATOMIC_READ
:
2796 pp_string (pp
, "#pragma omp atomic read");
2797 if (OMP_ATOMIC_SEQ_CST (node
))
2798 pp_string (pp
, " seq_cst");
2799 newline_and_indent (pp
, spc
+ 2);
2800 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2804 case OMP_ATOMIC_CAPTURE_OLD
:
2805 case OMP_ATOMIC_CAPTURE_NEW
:
2806 pp_string (pp
, "#pragma omp atomic capture");
2807 if (OMP_ATOMIC_SEQ_CST (node
))
2808 pp_string (pp
, " seq_cst");
2809 newline_and_indent (pp
, spc
+ 2);
2810 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2814 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2818 pp_string (pp
, "#pragma omp single");
2819 dump_omp_clauses (pp
, OMP_SINGLE_CLAUSES (node
), spc
, flags
);
2823 dump_omp_clause (pp
, node
, spc
, flags
);
2827 case TRANSACTION_EXPR
:
2828 if (TRANSACTION_EXPR_OUTER (node
))
2829 pp_string (pp
, "__transaction_atomic [[outer]]");
2830 else if (TRANSACTION_EXPR_RELAXED (node
))
2831 pp_string (pp
, "__transaction_relaxed");
2833 pp_string (pp
, "__transaction_atomic");
2834 if (!(flags
& TDF_SLIM
) && TRANSACTION_EXPR_BODY (node
))
2836 newline_and_indent (pp
, spc
);
2838 newline_and_indent (pp
, spc
+ 2);
2839 dump_generic_node (pp
, TRANSACTION_EXPR_BODY (node
),
2840 spc
+ 2, flags
, false);
2841 newline_and_indent (pp
, spc
);
2842 pp_right_brace (pp
);
2847 case REDUC_MAX_EXPR
:
2848 pp_string (pp
, " REDUC_MAX_EXPR < ");
2849 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2850 pp_string (pp
, " > ");
2853 case REDUC_MIN_EXPR
:
2854 pp_string (pp
, " REDUC_MIN_EXPR < ");
2855 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2856 pp_string (pp
, " > ");
2859 case REDUC_PLUS_EXPR
:
2860 pp_string (pp
, " REDUC_PLUS_EXPR < ");
2861 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2862 pp_string (pp
, " > ");
2865 case VEC_WIDEN_MULT_HI_EXPR
:
2866 case VEC_WIDEN_MULT_LO_EXPR
:
2867 case VEC_WIDEN_MULT_EVEN_EXPR
:
2868 case VEC_WIDEN_MULT_ODD_EXPR
:
2869 case VEC_WIDEN_LSHIFT_HI_EXPR
:
2870 case VEC_WIDEN_LSHIFT_LO_EXPR
:
2872 for (str
= get_tree_code_name (code
); *str
; str
++)
2873 pp_character (pp
, TOUPPER (*str
));
2874 pp_string (pp
, " < ");
2875 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2876 pp_string (pp
, ", ");
2877 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2878 pp_string (pp
, " > ");
2881 case VEC_UNPACK_HI_EXPR
:
2882 pp_string (pp
, " VEC_UNPACK_HI_EXPR < ");
2883 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2884 pp_string (pp
, " > ");
2887 case VEC_UNPACK_LO_EXPR
:
2888 pp_string (pp
, " VEC_UNPACK_LO_EXPR < ");
2889 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2890 pp_string (pp
, " > ");
2893 case VEC_UNPACK_FLOAT_HI_EXPR
:
2894 pp_string (pp
, " VEC_UNPACK_FLOAT_HI_EXPR < ");
2895 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2896 pp_string (pp
, " > ");
2899 case VEC_UNPACK_FLOAT_LO_EXPR
:
2900 pp_string (pp
, " VEC_UNPACK_FLOAT_LO_EXPR < ");
2901 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2902 pp_string (pp
, " > ");
2905 case VEC_PACK_TRUNC_EXPR
:
2906 pp_string (pp
, " VEC_PACK_TRUNC_EXPR < ");
2907 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2908 pp_string (pp
, ", ");
2909 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2910 pp_string (pp
, " > ");
2913 case VEC_PACK_SAT_EXPR
:
2914 pp_string (pp
, " VEC_PACK_SAT_EXPR < ");
2915 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2916 pp_string (pp
, ", ");
2917 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2918 pp_string (pp
, " > ");
2921 case VEC_PACK_FIX_TRUNC_EXPR
:
2922 pp_string (pp
, " VEC_PACK_FIX_TRUNC_EXPR < ");
2923 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2924 pp_string (pp
, ", ");
2925 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2926 pp_string (pp
, " > ");
2930 dump_block_node (pp
, node
, spc
, flags
);
2933 case CILK_SPAWN_STMT
:
2934 pp_string (pp
, "_Cilk_spawn ");
2935 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2938 case CILK_SYNC_STMT
:
2939 pp_string (pp
, "_Cilk_sync");
2946 if (is_stmt
&& is_expr
)
2952 /* Print the declaration of a variable. */
2955 print_declaration (pretty_printer
*pp
, tree t
, int spc
, int flags
)
2959 if (TREE_CODE(t
) == NAMELIST_DECL
)
2961 pp_string(pp
, "namelist ");
2962 dump_decl_name (pp
, t
, flags
);
2967 if (TREE_CODE (t
) == TYPE_DECL
)
2968 pp_string (pp
, "typedef ");
2970 if (CODE_CONTAINS_STRUCT (TREE_CODE (t
), TS_DECL_WRTL
) && DECL_REGISTER (t
))
2971 pp_string (pp
, "register ");
2973 if (TREE_PUBLIC (t
) && DECL_EXTERNAL (t
))
2974 pp_string (pp
, "extern ");
2975 else if (TREE_STATIC (t
))
2976 pp_string (pp
, "static ");
2978 /* Print the type and name. */
2979 if (TREE_TYPE (t
) && TREE_CODE (TREE_TYPE (t
)) == ARRAY_TYPE
)
2983 /* Print array's type. */
2984 tmp
= TREE_TYPE (t
);
2985 while (TREE_CODE (TREE_TYPE (tmp
)) == ARRAY_TYPE
)
2986 tmp
= TREE_TYPE (tmp
);
2987 dump_generic_node (pp
, TREE_TYPE (tmp
), spc
, flags
, false);
2989 /* Print variable's name. */
2991 dump_generic_node (pp
, t
, spc
, flags
, false);
2993 /* Print the dimensions. */
2994 tmp
= TREE_TYPE (t
);
2995 while (TREE_CODE (tmp
) == ARRAY_TYPE
)
2997 dump_array_domain (pp
, TYPE_DOMAIN (tmp
), spc
, flags
);
2998 tmp
= TREE_TYPE (tmp
);
3001 else if (TREE_CODE (t
) == FUNCTION_DECL
)
3003 dump_generic_node (pp
, TREE_TYPE (TREE_TYPE (t
)), spc
, flags
, false);
3005 dump_decl_name (pp
, t
, flags
);
3006 dump_function_declaration (pp
, TREE_TYPE (t
), spc
, flags
);
3010 /* Print type declaration. */
3011 dump_generic_node (pp
, TREE_TYPE (t
), spc
, flags
, false);
3013 /* Print variable's name. */
3015 dump_generic_node (pp
, t
, spc
, flags
, false);
3018 if (TREE_CODE (t
) == VAR_DECL
&& DECL_HARD_REGISTER (t
))
3020 pp_string (pp
, " __asm__ ");
3022 dump_generic_node (pp
, DECL_ASSEMBLER_NAME (t
), spc
, flags
, false);
3023 pp_right_paren (pp
);
3026 /* The initial value of a function serves to determine whether the function
3027 is declared or defined. So the following does not apply to function
3029 if (TREE_CODE (t
) != FUNCTION_DECL
)
3031 /* Print the initial value. */
3032 if (DECL_INITIAL (t
))
3037 dump_generic_node (pp
, DECL_INITIAL (t
), spc
, flags
, false);
3041 if (TREE_CODE (t
) == VAR_DECL
&& DECL_HAS_VALUE_EXPR_P (t
))
3043 pp_string (pp
, " [value-expr: ");
3044 dump_generic_node (pp
, DECL_VALUE_EXPR (t
), spc
, flags
, false);
3045 pp_right_bracket (pp
);
3052 /* Prints a structure: name, fields, and methods.
3053 FIXME: Still incomplete. */
3056 print_struct_decl (pretty_printer
*pp
, const_tree node
, int spc
, int flags
)
3058 /* Print the name of the structure. */
3059 if (TYPE_NAME (node
))
3062 if (TREE_CODE (node
) == RECORD_TYPE
)
3063 pp_string (pp
, "struct ");
3064 else if ((TREE_CODE (node
) == UNION_TYPE
3065 || TREE_CODE (node
) == QUAL_UNION_TYPE
))
3066 pp_string (pp
, "union ");
3068 dump_generic_node (pp
, TYPE_NAME (node
), spc
, 0, false);
3071 /* Print the contents of the structure. */
3077 /* Print the fields of the structure. */
3080 tmp
= TYPE_FIELDS (node
);
3083 /* Avoid to print recursively the structure. */
3084 /* FIXME : Not implemented correctly...,
3085 what about the case when we have a cycle in the contain graph? ...
3086 Maybe this could be solved by looking at the scope in which the
3087 structure was declared. */
3088 if (TREE_TYPE (tmp
) != node
3089 && (TREE_CODE (TREE_TYPE (tmp
)) != POINTER_TYPE
3090 || TREE_TYPE (TREE_TYPE (tmp
)) != node
))
3092 print_declaration (pp
, tmp
, spc
+2, flags
);
3095 tmp
= DECL_CHAIN (tmp
);
3099 pp_right_brace (pp
);
3102 /* Return the priority of the operator CODE.
3104 From lowest to highest precedence with either left-to-right (L-R)
3105 or right-to-left (R-L) associativity]:
3108 2 [R-L] = += -= *= /= %= &= ^= |= <<= >>=
3120 14 [R-L] ! ~ ++ -- + - * & (type) sizeof
3121 15 [L-R] fn() [] -> .
3123 unary +, - and * have higher precedence than the corresponding binary
3127 op_code_prio (enum tree_code code
)
3144 case TRUTH_ORIF_EXPR
:
3147 case TRUTH_AND_EXPR
:
3148 case TRUTH_ANDIF_EXPR
:
3155 case TRUTH_XOR_EXPR
:
3172 case UNORDERED_EXPR
:
3183 case VEC_WIDEN_LSHIFT_HI_EXPR
:
3184 case VEC_WIDEN_LSHIFT_LO_EXPR
:
3185 case WIDEN_LSHIFT_EXPR
:
3188 case WIDEN_SUM_EXPR
:
3190 case POINTER_PLUS_EXPR
:
3194 case VEC_WIDEN_MULT_HI_EXPR
:
3195 case VEC_WIDEN_MULT_LO_EXPR
:
3196 case WIDEN_MULT_EXPR
:
3198 case WIDEN_MULT_PLUS_EXPR
:
3199 case WIDEN_MULT_MINUS_EXPR
:
3201 case MULT_HIGHPART_EXPR
:
3202 case TRUNC_DIV_EXPR
:
3204 case FLOOR_DIV_EXPR
:
3205 case ROUND_DIV_EXPR
:
3207 case EXACT_DIV_EXPR
:
3208 case TRUNC_MOD_EXPR
:
3210 case FLOOR_MOD_EXPR
:
3211 case ROUND_MOD_EXPR
:
3215 case TRUTH_NOT_EXPR
:
3217 case POSTINCREMENT_EXPR
:
3218 case POSTDECREMENT_EXPR
:
3219 case PREINCREMENT_EXPR
:
3220 case PREDECREMENT_EXPR
:
3226 case FIX_TRUNC_EXPR
:
3232 case ARRAY_RANGE_REF
:
3236 /* Special expressions. */
3242 case REDUC_MAX_EXPR
:
3243 case REDUC_MIN_EXPR
:
3244 case REDUC_PLUS_EXPR
:
3245 case VEC_UNPACK_HI_EXPR
:
3246 case VEC_UNPACK_LO_EXPR
:
3247 case VEC_UNPACK_FLOAT_HI_EXPR
:
3248 case VEC_UNPACK_FLOAT_LO_EXPR
:
3249 case VEC_PACK_TRUNC_EXPR
:
3250 case VEC_PACK_SAT_EXPR
:
3254 /* Return an arbitrarily high precedence to avoid surrounding single
3255 VAR_DECLs in ()s. */
3260 /* Return the priority of the operator OP. */
3263 op_prio (const_tree op
)
3265 enum tree_code code
;
3270 code
= TREE_CODE (op
);
3271 if (code
== SAVE_EXPR
|| code
== NON_LVALUE_EXPR
)
3272 return op_prio (TREE_OPERAND (op
, 0));
3274 return op_code_prio (code
);
3277 /* Return the symbol associated with operator CODE. */
3280 op_symbol_code (enum tree_code code
)
3288 case TRUTH_ORIF_EXPR
:
3291 case TRUTH_AND_EXPR
:
3292 case TRUTH_ANDIF_EXPR
:
3298 case TRUTH_XOR_EXPR
:
3308 case UNORDERED_EXPR
:
3354 case WIDEN_LSHIFT_EXPR
:
3357 case POINTER_PLUS_EXPR
:
3363 case REDUC_PLUS_EXPR
:
3366 case WIDEN_SUM_EXPR
:
3369 case WIDEN_MULT_EXPR
:
3372 case MULT_HIGHPART_EXPR
:
3382 case TRUTH_NOT_EXPR
:
3389 case TRUNC_DIV_EXPR
:
3396 case FLOOR_DIV_EXPR
:
3399 case ROUND_DIV_EXPR
:
3402 case EXACT_DIV_EXPR
:
3405 case TRUNC_MOD_EXPR
:
3411 case FLOOR_MOD_EXPR
:
3414 case ROUND_MOD_EXPR
:
3417 case PREDECREMENT_EXPR
:
3420 case PREINCREMENT_EXPR
:
3423 case POSTDECREMENT_EXPR
:
3426 case POSTINCREMENT_EXPR
:
3436 return "<<< ??? >>>";
3440 /* Return the symbol associated with operator OP. */
3443 op_symbol (const_tree op
)
3445 return op_symbol_code (TREE_CODE (op
));
3448 /* Prints the name of a call. NODE is the CALL_EXPR_FN of a CALL_EXPR or
3449 the gimple_call_fn of a GIMPLE_CALL. */
3452 print_call_name (pretty_printer
*pp
, tree node
, int flags
)
3456 if (TREE_CODE (op0
) == NON_LVALUE_EXPR
)
3457 op0
= TREE_OPERAND (op0
, 0);
3460 switch (TREE_CODE (op0
))
3465 dump_function_name (pp
, op0
, flags
);
3471 op0
= TREE_OPERAND (op0
, 0);
3476 dump_generic_node (pp
, TREE_OPERAND (op0
, 0), 0, flags
, false);
3477 pp_string (pp
, ") ? ");
3478 dump_generic_node (pp
, TREE_OPERAND (op0
, 1), 0, flags
, false);
3479 pp_string (pp
, " : ");
3480 dump_generic_node (pp
, TREE_OPERAND (op0
, 2), 0, flags
, false);
3484 if (TREE_CODE (TREE_OPERAND (op0
, 0)) == VAR_DECL
)
3485 dump_function_name (pp
, TREE_OPERAND (op0
, 0), flags
);
3487 dump_generic_node (pp
, op0
, 0, flags
, false);
3491 if (integer_zerop (TREE_OPERAND (op0
, 1)))
3493 op0
= TREE_OPERAND (op0
, 0);
3500 dump_generic_node (pp
, op0
, 0, flags
, false);
3508 /* Parses the string STR and replaces new-lines by '\n', tabs by '\t', ... */
3511 pretty_print_string (pretty_printer
*pp
, const char *str
)
3521 pp_string (pp
, "\\b");
3525 pp_string (pp
, "\\f");
3529 pp_string (pp
, "\\n");
3533 pp_string (pp
, "\\r");
3537 pp_string (pp
, "\\t");
3541 pp_string (pp
, "\\v");
3545 pp_string (pp
, "\\\\");
3549 pp_string (pp
, "\\\"");
3553 pp_string (pp
, "\\'");
3556 /* No need to handle \0; the loop terminates on \0. */
3559 pp_string (pp
, "\\1");
3563 pp_string (pp
, "\\2");
3567 pp_string (pp
, "\\3");
3571 pp_string (pp
, "\\4");
3575 pp_string (pp
, "\\5");
3579 pp_string (pp
, "\\6");
3583 pp_string (pp
, "\\7");
3587 pp_character (pp
, str
[0]);
3595 maybe_init_pretty_print (FILE *file
)
3599 tree_pp
= new pretty_printer ();
3600 pp_needs_newline (tree_pp
) = true;
3601 pp_translate_identifiers (tree_pp
) = false;
3604 tree_pp
->buffer
->stream
= file
;
3608 newline_and_indent (pretty_printer
*pp
, int spc
)
3614 /* Handle a %K format for TEXT. Separate from default_tree_printer so
3615 it can also be used in front ends.
3616 %K: a statement, from which EXPR_LOCATION and TREE_BLOCK will be recorded.
3620 percent_K_format (text_info
*text
)
3622 tree t
= va_arg (*text
->args_ptr
, tree
), block
;
3623 text
->set_location (0, EXPR_LOCATION (t
));
3624 gcc_assert (pp_ti_abstract_origin (text
) != NULL
);
3625 block
= TREE_BLOCK (t
);
3626 *pp_ti_abstract_origin (text
) = NULL
;
3630 /* ??? LTO drops all BLOCK_ABSTRACT_ORIGINs apart from those
3631 representing the outermost block of an inlined function.
3632 So walk the BLOCK tree until we hit such a scope. */
3634 && TREE_CODE (block
) == BLOCK
)
3636 if (inlined_function_outer_scope_p (block
))
3638 *pp_ti_abstract_origin (text
) = block
;
3641 block
= BLOCK_SUPERCONTEXT (block
);
3647 && TREE_CODE (block
) == BLOCK
3648 && BLOCK_ABSTRACT_ORIGIN (block
))
3650 tree ao
= BLOCK_ABSTRACT_ORIGIN (block
);
3652 while (TREE_CODE (ao
) == BLOCK
3653 && BLOCK_ABSTRACT_ORIGIN (ao
)
3654 && BLOCK_ABSTRACT_ORIGIN (ao
) != ao
)
3655 ao
= BLOCK_ABSTRACT_ORIGIN (ao
);
3657 if (TREE_CODE (ao
) == FUNCTION_DECL
)
3659 *pp_ti_abstract_origin (text
) = block
;
3662 block
= BLOCK_SUPERCONTEXT (block
);
3666 /* Print the identifier ID to PRETTY-PRINTER. */
3669 pp_tree_identifier (pretty_printer
*pp
, tree id
)
3671 if (pp_translate_identifiers (pp
))
3673 const char *text
= identifier_to_locale (IDENTIFIER_POINTER (id
));
3674 pp_append_text (pp
, text
, text
+ strlen (text
));
3677 pp_append_text (pp
, IDENTIFIER_POINTER (id
),
3678 IDENTIFIER_POINTER (id
) + IDENTIFIER_LENGTH (id
));
3681 /* A helper function that is used to dump function information before the
3685 dump_function_header (FILE *dump_file
, tree fdecl
, int flags
)
3687 const char *dname
, *aname
;
3688 struct cgraph_node
*node
= cgraph_node::get (fdecl
);
3689 struct function
*fun
= DECL_STRUCT_FUNCTION (fdecl
);
3691 dname
= lang_hooks
.decl_printable_name (fdecl
, 2);
3693 if (DECL_ASSEMBLER_NAME_SET_P (fdecl
))
3694 aname
= (IDENTIFIER_POINTER
3695 (DECL_ASSEMBLER_NAME (fdecl
)));
3697 aname
= "<unset-asm-name>";
3699 fprintf (dump_file
, "\n;; Function %s (%s, funcdef_no=%d",
3700 dname
, aname
, fun
->funcdef_no
);
3701 if (!(flags
& TDF_NOUID
))
3702 fprintf (dump_file
, ", decl_uid=%d", DECL_UID (fdecl
));
3705 fprintf (dump_file
, ", cgraph_uid=%d", node
->uid
);
3706 fprintf (dump_file
, ", symbol_order=%d)%s\n\n", node
->order
,
3707 node
->frequency
== NODE_FREQUENCY_HOT
3709 : node
->frequency
== NODE_FREQUENCY_UNLIKELY_EXECUTED
3710 ? " (unlikely executed)"
3711 : node
->frequency
== NODE_FREQUENCY_EXECUTED_ONCE
3712 ? " (executed once)"
3716 fprintf (dump_file
, ")\n\n");
3719 /* Dump double_int D to pretty_printer PP. UNS is true
3720 if D is unsigned and false otherwise. */
3722 pp_double_int (pretty_printer
*pp
, double_int d
, bool uns
)
3725 pp_wide_integer (pp
, d
.low
);
3726 else if (d
.fits_uhwi ())
3727 pp_unsigned_wide_integer (pp
, d
.low
);
3730 unsigned HOST_WIDE_INT low
= d
.low
;
3731 HOST_WIDE_INT high
= d
.high
;
3732 if (!uns
&& d
.is_negative ())
3735 high
= ~high
+ !low
;
3738 /* Would "%x%0*x" or "%x%*0x" get zero-padding on all
3740 sprintf (pp_buffer (pp
)->digit_buffer
,
3741 HOST_WIDE_INT_PRINT_DOUBLE_HEX
,
3742 (unsigned HOST_WIDE_INT
) high
, low
);
3743 pp_string (pp
, pp_buffer (pp
)->digit_buffer
);