1 /* Pretty formatting of GENERIC trees in C syntax.
2 Copyright (C) 2001-2015 Free Software Foundation, Inc.
3 Adapted from c-pretty-print.c by Diego Novillo <dnovillo@redhat.com>
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 3, or (at your option) any later
12 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING3. If not see
19 <http://www.gnu.org/licenses/>. */
23 #include "coretypes.h"
28 #include "stor-layout.h"
29 #include "hard-reg-set.h"
33 #include "insn-config.h"
42 #include "tree-pretty-print.h"
43 #include "gimple-expr.h"
46 #include "langhooks.h"
47 #include "tree-iterator.h"
48 #include "tree-chrec.h"
50 #include "value-prof.h"
51 #include "wide-int-print.h"
52 #include "internal-fn.h"
53 #include "gomp-constants.h"
55 /* Local functions, macros and variables. */
56 static const char *op_symbol (const_tree
);
57 static void pretty_print_string (pretty_printer
*, const char*);
58 static void newline_and_indent (pretty_printer
*, int);
59 static void maybe_init_pretty_print (FILE *);
60 static void print_struct_decl (pretty_printer
*, const_tree
, int, int);
61 static void do_niy (pretty_printer
*, const_tree
);
63 #define INDENT(SPACE) do { \
64 int i; for (i = 0; i<SPACE; i++) pp_space (pp); } while (0)
66 #define NIY do_niy (pp, node)
68 static pretty_printer
*tree_pp
;
70 /* Try to print something for an unknown tree code. */
73 do_niy (pretty_printer
*pp
, const_tree node
)
77 pp_string (pp
, "<<< Unknown tree: ");
78 pp_string (pp
, get_tree_code_name (TREE_CODE (node
)));
82 len
= TREE_OPERAND_LENGTH (node
);
83 for (i
= 0; i
< len
; ++i
)
85 newline_and_indent (pp
, 2);
86 dump_generic_node (pp
, TREE_OPERAND (node
, i
), 2, 0, false);
90 pp_string (pp
, " >>>");
93 /* Debugging function to print out a generic expression. */
96 debug_generic_expr (tree t
)
98 print_generic_expr (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
);
99 fprintf (stderr
, "\n");
102 /* Debugging function to print out a generic statement. */
105 debug_generic_stmt (tree t
)
107 print_generic_stmt (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
);
108 fprintf (stderr
, "\n");
111 /* Debugging function to print out a chain of trees . */
114 debug_tree_chain (tree t
)
120 print_generic_expr (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
|TDF_UID
);
121 fprintf (stderr
, " ");
125 fprintf (stderr
, "... [cycled back to ");
126 print_generic_expr (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
|TDF_UID
);
127 fprintf (stderr
, "]");
131 fprintf (stderr
, "\n");
134 /* Prints declaration DECL to the FILE with details specified by FLAGS. */
136 print_generic_decl (FILE *file
, tree decl
, int flags
)
138 maybe_init_pretty_print (file
);
139 print_declaration (tree_pp
, decl
, 2, flags
);
140 pp_write_text_to_stream (tree_pp
);
143 /* Print tree T, and its successors, on file FILE. FLAGS specifies details
144 to show in the dump. See TDF_* in dumpfile.h. */
147 print_generic_stmt (FILE *file
, tree t
, int flags
)
149 maybe_init_pretty_print (file
);
150 dump_generic_node (tree_pp
, t
, 0, flags
, true);
151 pp_newline_and_flush (tree_pp
);
154 /* Print tree T, and its successors, on file FILE. FLAGS specifies details
155 to show in the dump. See TDF_* in dumpfile.h. The output is indented by
159 print_generic_stmt_indented (FILE *file
, tree t
, int flags
, int indent
)
163 maybe_init_pretty_print (file
);
165 for (i
= 0; i
< indent
; i
++)
167 dump_generic_node (tree_pp
, t
, indent
, flags
, true);
168 pp_newline_and_flush (tree_pp
);
171 /* Print a single expression T on file FILE. FLAGS specifies details to show
172 in the dump. See TDF_* in dumpfile.h. */
175 print_generic_expr (FILE *file
, tree t
, int flags
)
177 maybe_init_pretty_print (file
);
178 dump_generic_node (tree_pp
, t
, 0, flags
, false);
182 /* Dump the name of a _DECL node and its DECL_UID if TDF_UID is set
186 dump_decl_name (pretty_printer
*pp
, tree node
, int flags
)
188 if (DECL_NAME (node
))
190 if ((flags
& TDF_ASMNAME
) && DECL_ASSEMBLER_NAME_SET_P (node
))
191 pp_tree_identifier (pp
, DECL_ASSEMBLER_NAME (node
));
193 pp_tree_identifier (pp
, DECL_NAME (node
));
195 if ((flags
& TDF_UID
) || DECL_NAME (node
) == NULL_TREE
)
197 if (TREE_CODE (node
) == LABEL_DECL
&& LABEL_DECL_UID (node
) != -1)
198 pp_printf (pp
, "L.%d", (int) LABEL_DECL_UID (node
));
199 else if (TREE_CODE (node
) == DEBUG_EXPR_DECL
)
201 if (flags
& TDF_NOUID
)
202 pp_string (pp
, "D#xxxx");
204 pp_printf (pp
, "D#%i", DEBUG_TEMP_UID (node
));
208 char c
= TREE_CODE (node
) == CONST_DECL
? 'C' : 'D';
209 if (flags
& TDF_NOUID
)
210 pp_printf (pp
, "%c.xxxx", c
);
212 pp_printf (pp
, "%c.%u", c
, DECL_UID (node
));
215 if ((flags
& TDF_ALIAS
) && DECL_PT_UID (node
) != DECL_UID (node
))
217 if (flags
& TDF_NOUID
)
218 pp_printf (pp
, "ptD.xxxx");
220 pp_printf (pp
, "ptD.%u", DECL_PT_UID (node
));
224 /* Like the above, but used for pretty printing function calls. */
227 dump_function_name (pretty_printer
*pp
, tree node
, int flags
)
229 if (CONVERT_EXPR_P (node
))
230 node
= TREE_OPERAND (node
, 0);
231 if (DECL_NAME (node
) && (flags
& TDF_ASMNAME
) == 0)
232 pp_string (pp
, lang_hooks
.decl_printable_name (node
, 1));
234 dump_decl_name (pp
, node
, flags
);
237 /* Dump a function declaration. NODE is the FUNCTION_TYPE. PP, SPC and
238 FLAGS are as in dump_generic_node. */
241 dump_function_declaration (pretty_printer
*pp
, tree node
,
244 bool wrote_arg
= false;
250 /* Print the argument types. */
251 arg
= TYPE_ARG_TYPES (node
);
252 while (arg
&& arg
!= void_list_node
&& arg
!= error_mark_node
)
260 dump_generic_node (pp
, TREE_VALUE (arg
), spc
, flags
, false);
261 arg
= TREE_CHAIN (arg
);
264 /* Drop the trailing void_type_node if we had any previous argument. */
265 if (arg
== void_list_node
&& !wrote_arg
)
266 pp_string (pp
, "void");
267 /* Properly dump vararg function types. */
268 else if (!arg
&& wrote_arg
)
269 pp_string (pp
, ", ...");
270 /* Avoid printing any arg for unprototyped functions. */
275 /* Dump the domain associated with an array. */
278 dump_array_domain (pretty_printer
*pp
, tree domain
, int spc
, int flags
)
280 pp_left_bracket (pp
);
283 tree min
= TYPE_MIN_VALUE (domain
);
284 tree max
= TYPE_MAX_VALUE (domain
);
287 && integer_zerop (min
)
288 && tree_fits_shwi_p (max
))
289 pp_wide_integer (pp
, tree_to_shwi (max
) + 1);
293 dump_generic_node (pp
, min
, spc
, flags
, false);
296 dump_generic_node (pp
, max
, spc
, flags
, false);
300 pp_string (pp
, "<unknown>");
301 pp_right_bracket (pp
);
305 /* Dump OpenMP clause CLAUSE. PP, CLAUSE, SPC and FLAGS are as in
306 dump_generic_node. */
309 dump_omp_clause (pretty_printer
*pp
, tree clause
, int spc
, int flags
)
313 switch (OMP_CLAUSE_CODE (clause
))
315 case OMP_CLAUSE_PRIVATE
:
318 case OMP_CLAUSE_SHARED
:
321 case OMP_CLAUSE_FIRSTPRIVATE
:
322 name
= "firstprivate";
324 case OMP_CLAUSE_LASTPRIVATE
:
325 name
= "lastprivate";
327 case OMP_CLAUSE_COPYIN
:
330 case OMP_CLAUSE_COPYPRIVATE
:
331 name
= "copyprivate";
333 case OMP_CLAUSE_UNIFORM
:
336 case OMP_CLAUSE__LOOPTEMP_
:
339 case OMP_CLAUSE_DEVICE_RESIDENT
:
340 name
= "device_resident";
342 case OMP_CLAUSE_USE_DEVICE
:
346 pp_string (pp
, name
);
348 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
353 case OMP_CLAUSE_REDUCTION
:
354 pp_string (pp
, "reduction(");
355 if (OMP_CLAUSE_REDUCTION_CODE (clause
) != ERROR_MARK
)
358 op_symbol_code (OMP_CLAUSE_REDUCTION_CODE (clause
)));
361 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
367 pp_string (pp
, "if(");
368 dump_generic_node (pp
, OMP_CLAUSE_IF_EXPR (clause
),
373 case OMP_CLAUSE_NUM_THREADS
:
374 pp_string (pp
, "num_threads(");
375 dump_generic_node (pp
, OMP_CLAUSE_NUM_THREADS_EXPR (clause
),
380 case OMP_CLAUSE__CILK_FOR_COUNT_
:
381 pp_string (pp
, "_Cilk_for_count_(");
382 dump_generic_node (pp
, OMP_CLAUSE_OPERAND (clause
, 0),
387 case OMP_CLAUSE_NOWAIT
:
388 pp_string (pp
, "nowait");
390 case OMP_CLAUSE_ORDERED
:
391 pp_string (pp
, "ordered");
392 if (OMP_CLAUSE_ORDERED_EXPR (clause
))
395 dump_generic_node (pp
, OMP_CLAUSE_ORDERED_EXPR (clause
),
401 case OMP_CLAUSE_DEFAULT
:
402 pp_string (pp
, "default(");
403 switch (OMP_CLAUSE_DEFAULT_KIND (clause
))
405 case OMP_CLAUSE_DEFAULT_UNSPECIFIED
:
407 case OMP_CLAUSE_DEFAULT_SHARED
:
408 pp_string (pp
, "shared");
410 case OMP_CLAUSE_DEFAULT_NONE
:
411 pp_string (pp
, "none");
413 case OMP_CLAUSE_DEFAULT_PRIVATE
:
414 pp_string (pp
, "private");
416 case OMP_CLAUSE_DEFAULT_FIRSTPRIVATE
:
417 pp_string (pp
, "firstprivate");
425 case OMP_CLAUSE_SCHEDULE
:
426 pp_string (pp
, "schedule(");
427 if (OMP_CLAUSE_SCHEDULE_SIMD (clause
))
428 pp_string (pp
, "simd:");
429 switch (OMP_CLAUSE_SCHEDULE_KIND (clause
))
431 case OMP_CLAUSE_SCHEDULE_STATIC
:
432 pp_string (pp
, "static");
434 case OMP_CLAUSE_SCHEDULE_DYNAMIC
:
435 pp_string (pp
, "dynamic");
437 case OMP_CLAUSE_SCHEDULE_GUIDED
:
438 pp_string (pp
, "guided");
440 case OMP_CLAUSE_SCHEDULE_RUNTIME
:
441 pp_string (pp
, "runtime");
443 case OMP_CLAUSE_SCHEDULE_AUTO
:
444 pp_string (pp
, "auto");
446 case OMP_CLAUSE_SCHEDULE_CILKFOR
:
447 pp_string (pp
, "cilk-for grain");
452 if (OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (clause
))
455 dump_generic_node (pp
, OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (clause
),
461 case OMP_CLAUSE_UNTIED
:
462 pp_string (pp
, "untied");
465 case OMP_CLAUSE_COLLAPSE
:
466 pp_string (pp
, "collapse(");
467 dump_generic_node (pp
, OMP_CLAUSE_COLLAPSE_EXPR (clause
),
472 case OMP_CLAUSE_FINAL
:
473 pp_string (pp
, "final(");
474 dump_generic_node (pp
, OMP_CLAUSE_FINAL_EXPR (clause
),
479 case OMP_CLAUSE_MERGEABLE
:
480 pp_string (pp
, "mergeable");
483 case OMP_CLAUSE_LINEAR
:
484 pp_string (pp
, "linear(");
485 switch (OMP_CLAUSE_LINEAR_KIND (clause
))
487 case OMP_CLAUSE_LINEAR_DEFAULT
:
489 case OMP_CLAUSE_LINEAR_REF
:
490 pp_string (pp
, "ref(");
492 case OMP_CLAUSE_LINEAR_VAL
:
493 pp_string (pp
, "val(");
495 case OMP_CLAUSE_LINEAR_UVAL
:
496 pp_string (pp
, "uval(");
501 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
503 if (OMP_CLAUSE_LINEAR_KIND (clause
) != OMP_CLAUSE_LINEAR_DEFAULT
)
506 dump_generic_node (pp
, OMP_CLAUSE_LINEAR_STEP (clause
),
511 case OMP_CLAUSE_ALIGNED
:
512 pp_string (pp
, "aligned(");
513 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
515 if (OMP_CLAUSE_ALIGNED_ALIGNMENT (clause
))
518 dump_generic_node (pp
, OMP_CLAUSE_ALIGNED_ALIGNMENT (clause
),
524 case OMP_CLAUSE_DEPEND
:
525 pp_string (pp
, "depend(");
526 switch (OMP_CLAUSE_DEPEND_KIND (clause
))
528 case OMP_CLAUSE_DEPEND_IN
:
529 pp_string (pp
, "in");
531 case OMP_CLAUSE_DEPEND_OUT
:
532 pp_string (pp
, "out");
534 case OMP_CLAUSE_DEPEND_INOUT
:
535 pp_string (pp
, "inout");
537 case OMP_CLAUSE_DEPEND_SOURCE
:
538 pp_string (pp
, "source)");
544 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
550 pp_string (pp
, "map(");
551 switch (OMP_CLAUSE_MAP_KIND (clause
))
554 case GOMP_MAP_POINTER
:
555 pp_string (pp
, "alloc");
558 case GOMP_MAP_TO_PSET
:
559 pp_string (pp
, "to");
562 pp_string (pp
, "from");
564 case GOMP_MAP_TOFROM
:
565 pp_string (pp
, "tofrom");
567 case GOMP_MAP_FORCE_ALLOC
:
568 pp_string (pp
, "force_alloc");
570 case GOMP_MAP_FORCE_TO
:
571 pp_string (pp
, "force_to");
573 case GOMP_MAP_FORCE_FROM
:
574 pp_string (pp
, "force_from");
576 case GOMP_MAP_FORCE_TOFROM
:
577 pp_string (pp
, "force_tofrom");
579 case GOMP_MAP_FORCE_PRESENT
:
580 pp_string (pp
, "force_present");
582 case GOMP_MAP_FORCE_DEALLOC
:
583 pp_string (pp
, "delete");
585 case GOMP_MAP_FORCE_DEVICEPTR
:
586 pp_string (pp
, "force_deviceptr");
588 case GOMP_MAP_ALWAYS_TO
:
589 pp_string (pp
, "always,to");
591 case GOMP_MAP_ALWAYS_FROM
:
592 pp_string (pp
, "always,from");
594 case GOMP_MAP_ALWAYS_TOFROM
:
595 pp_string (pp
, "always,tofrom");
597 case GOMP_MAP_RELEASE
:
598 pp_string (pp
, "release");
604 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
607 if (OMP_CLAUSE_SIZE (clause
))
609 if (OMP_CLAUSE_CODE (clause
) == OMP_CLAUSE_MAP
610 && OMP_CLAUSE_MAP_KIND (clause
) == GOMP_MAP_POINTER
)
611 pp_string (pp
, " [pointer assign, bias: ");
612 else if (OMP_CLAUSE_CODE (clause
) == OMP_CLAUSE_MAP
613 && OMP_CLAUSE_MAP_KIND (clause
) == GOMP_MAP_TO_PSET
)
614 pp_string (pp
, " [pointer set, len: ");
616 pp_string (pp
, " [len: ");
617 dump_generic_node (pp
, OMP_CLAUSE_SIZE (clause
),
619 pp_right_bracket (pp
);
624 case OMP_CLAUSE_FROM
:
625 pp_string (pp
, "from(");
626 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
628 goto print_clause_size
;
631 pp_string (pp
, "to(");
632 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
634 goto print_clause_size
;
636 case OMP_CLAUSE__CACHE_
:
638 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
640 goto print_clause_size
;
642 case OMP_CLAUSE_NUM_TEAMS
:
643 pp_string (pp
, "num_teams(");
644 dump_generic_node (pp
, OMP_CLAUSE_NUM_TEAMS_EXPR (clause
),
649 case OMP_CLAUSE_THREAD_LIMIT
:
650 pp_string (pp
, "thread_limit(");
651 dump_generic_node (pp
, OMP_CLAUSE_THREAD_LIMIT_EXPR (clause
),
656 case OMP_CLAUSE_DEVICE
:
657 pp_string (pp
, "device(");
658 dump_generic_node (pp
, OMP_CLAUSE_DEVICE_ID (clause
),
663 case OMP_CLAUSE_DIST_SCHEDULE
:
664 pp_string (pp
, "dist_schedule(static");
665 if (OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR (clause
))
668 dump_generic_node (pp
,
669 OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR (clause
),
675 case OMP_CLAUSE_PROC_BIND
:
676 pp_string (pp
, "proc_bind(");
677 switch (OMP_CLAUSE_PROC_BIND_KIND (clause
))
679 case OMP_CLAUSE_PROC_BIND_MASTER
:
680 pp_string (pp
, "master");
682 case OMP_CLAUSE_PROC_BIND_CLOSE
:
683 pp_string (pp
, "close");
685 case OMP_CLAUSE_PROC_BIND_SPREAD
:
686 pp_string (pp
, "spread");
694 case OMP_CLAUSE_SAFELEN
:
695 pp_string (pp
, "safelen(");
696 dump_generic_node (pp
, OMP_CLAUSE_SAFELEN_EXPR (clause
),
701 case OMP_CLAUSE_SIMDLEN
:
702 pp_string (pp
, "simdlen(");
703 dump_generic_node (pp
, OMP_CLAUSE_SIMDLEN_EXPR (clause
),
708 case OMP_CLAUSE_PRIORITY
:
709 pp_string (pp
, "priority(");
710 dump_generic_node (pp
, OMP_CLAUSE_PRIORITY_EXPR (clause
),
715 case OMP_CLAUSE_GRAINSIZE
:
716 pp_string (pp
, "grainsize(");
717 dump_generic_node (pp
, OMP_CLAUSE_GRAINSIZE_EXPR (clause
),
722 case OMP_CLAUSE_NUM_TASKS
:
723 pp_string (pp
, "num_tasks(");
724 dump_generic_node (pp
, OMP_CLAUSE_NUM_TASKS_EXPR (clause
),
729 case OMP_CLAUSE_HINT
:
730 pp_string (pp
, "hint(");
731 dump_generic_node (pp
, OMP_CLAUSE_HINT_EXPR (clause
),
736 case OMP_CLAUSE_DEFAULTMAP
:
737 pp_string (pp
, "defaultmap(tofrom:scalar)");
740 case OMP_CLAUSE__SIMDUID_
:
741 pp_string (pp
, "_simduid_(");
742 dump_generic_node (pp
, OMP_CLAUSE__SIMDUID__DECL (clause
),
747 case OMP_CLAUSE_GANG
:
748 pp_string (pp
, "gang");
749 if (OMP_CLAUSE_GANG_EXPR (clause
) != NULL_TREE
)
751 pp_string (pp
, "(num: ");
752 dump_generic_node (pp
, OMP_CLAUSE_GANG_EXPR (clause
),
755 if (OMP_CLAUSE_GANG_STATIC_EXPR (clause
) != NULL_TREE
)
757 if (OMP_CLAUSE_GANG_EXPR (clause
) == NULL_TREE
)
761 pp_string (pp
, "static:");
762 if (OMP_CLAUSE_GANG_STATIC_EXPR (clause
)
763 == integer_minus_one_node
)
764 pp_character (pp
, '*');
766 dump_generic_node (pp
, OMP_CLAUSE_GANG_STATIC_EXPR (clause
),
769 if (OMP_CLAUSE_GANG_EXPR (clause
) != NULL_TREE
770 || OMP_CLAUSE_GANG_STATIC_EXPR (clause
) != NULL_TREE
)
774 case OMP_CLAUSE_ASYNC
:
775 pp_string (pp
, "async");
776 if (OMP_CLAUSE_ASYNC_EXPR (clause
))
778 pp_character(pp
, '(');
779 dump_generic_node (pp
, OMP_CLAUSE_ASYNC_EXPR (clause
),
781 pp_character(pp
, ')');
785 case OMP_CLAUSE_AUTO
:
787 pp_string (pp
, omp_clause_code_name
[OMP_CLAUSE_CODE (clause
)]);
790 case OMP_CLAUSE_WAIT
:
791 pp_string (pp
, "wait(");
792 dump_generic_node (pp
, OMP_CLAUSE_WAIT_EXPR (clause
),
794 pp_character(pp
, ')');
797 case OMP_CLAUSE_WORKER
:
798 pp_string (pp
, "worker");
799 if (OMP_CLAUSE_WORKER_EXPR (clause
) != NULL_TREE
)
802 dump_generic_node (pp
, OMP_CLAUSE_WORKER_EXPR (clause
),
808 case OMP_CLAUSE_VECTOR
:
809 pp_string (pp
, "vector");
810 if (OMP_CLAUSE_VECTOR_EXPR (clause
) != NULL_TREE
)
813 dump_generic_node (pp
, OMP_CLAUSE_VECTOR_EXPR (clause
),
819 case OMP_CLAUSE_NUM_GANGS
:
820 pp_string (pp
, "num_gangs(");
821 dump_generic_node (pp
, OMP_CLAUSE_NUM_GANGS_EXPR (clause
),
823 pp_character (pp
, ')');
826 case OMP_CLAUSE_NUM_WORKERS
:
827 pp_string (pp
, "num_workers(");
828 dump_generic_node (pp
, OMP_CLAUSE_NUM_WORKERS_EXPR (clause
),
830 pp_character (pp
, ')');
833 case OMP_CLAUSE_VECTOR_LENGTH
:
834 pp_string (pp
, "vector_length(");
835 dump_generic_node (pp
, OMP_CLAUSE_VECTOR_LENGTH_EXPR (clause
),
837 pp_character (pp
, ')');
840 case OMP_CLAUSE_INBRANCH
:
841 pp_string (pp
, "inbranch");
843 case OMP_CLAUSE_NOTINBRANCH
:
844 pp_string (pp
, "notinbranch");
847 pp_string (pp
, "for");
849 case OMP_CLAUSE_PARALLEL
:
850 pp_string (pp
, "parallel");
852 case OMP_CLAUSE_SECTIONS
:
853 pp_string (pp
, "sections");
855 case OMP_CLAUSE_TASKGROUP
:
856 pp_string (pp
, "taskgroup");
858 case OMP_CLAUSE_NOGROUP
:
859 pp_string (pp
, "nogroup");
861 case OMP_CLAUSE_THREADS
:
862 pp_string (pp
, "threads");
864 case OMP_CLAUSE_SIMD
:
865 pp_string (pp
, "simd");
867 case OMP_CLAUSE_INDEPENDENT
:
868 pp_string (pp
, "independent");
872 /* Should never happen. */
873 dump_generic_node (pp
, clause
, spc
, flags
, false);
879 /* Dump the list of OpenMP clauses. PP, SPC and FLAGS are as in
880 dump_generic_node. */
883 dump_omp_clauses (pretty_printer
*pp
, tree clause
, int spc
, int flags
)
891 dump_omp_clause (pp
, clause
, spc
, flags
);
892 clause
= OMP_CLAUSE_CHAIN (clause
);
900 /* Dump location LOC to PP. */
903 dump_location (pretty_printer
*pp
, location_t loc
)
905 expanded_location xloc
= expand_location (loc
);
907 pp_left_bracket (pp
);
910 pp_string (pp
, xloc
.file
);
913 pp_decimal_int (pp
, xloc
.line
);
915 pp_decimal_int (pp
, xloc
.column
);
916 pp_string (pp
, "] ");
920 /* Dump lexical block BLOCK. PP, SPC and FLAGS are as in
921 dump_generic_node. */
924 dump_block_node (pretty_printer
*pp
, tree block
, int spc
, int flags
)
928 pp_printf (pp
, "BLOCK #%d ", BLOCK_NUMBER (block
));
930 if (flags
& TDF_ADDRESS
)
931 pp_printf (pp
, "[%p] ", (void *) block
);
933 if (BLOCK_ABSTRACT (block
))
934 pp_string (pp
, "[abstract] ");
936 if (TREE_ASM_WRITTEN (block
))
937 pp_string (pp
, "[written] ");
939 if (flags
& TDF_SLIM
)
942 if (BLOCK_SOURCE_LOCATION (block
))
943 dump_location (pp
, BLOCK_SOURCE_LOCATION (block
));
945 newline_and_indent (pp
, spc
+ 2);
947 if (BLOCK_SUPERCONTEXT (block
))
949 pp_string (pp
, "SUPERCONTEXT: ");
950 dump_generic_node (pp
, BLOCK_SUPERCONTEXT (block
), 0,
951 flags
| TDF_SLIM
, false);
952 newline_and_indent (pp
, spc
+ 2);
955 if (BLOCK_SUBBLOCKS (block
))
957 pp_string (pp
, "SUBBLOCKS: ");
958 for (t
= BLOCK_SUBBLOCKS (block
); t
; t
= BLOCK_CHAIN (t
))
960 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
963 newline_and_indent (pp
, spc
+ 2);
966 if (BLOCK_CHAIN (block
))
968 pp_string (pp
, "SIBLINGS: ");
969 for (t
= BLOCK_CHAIN (block
); t
; t
= BLOCK_CHAIN (t
))
971 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
974 newline_and_indent (pp
, spc
+ 2);
977 if (BLOCK_VARS (block
))
979 pp_string (pp
, "VARS: ");
980 for (t
= BLOCK_VARS (block
); t
; t
= TREE_CHAIN (t
))
982 dump_generic_node (pp
, t
, 0, flags
, false);
985 newline_and_indent (pp
, spc
+ 2);
988 if (vec_safe_length (BLOCK_NONLOCALIZED_VARS (block
)) > 0)
991 vec
<tree
, va_gc
> *nlv
= BLOCK_NONLOCALIZED_VARS (block
);
993 pp_string (pp
, "NONLOCALIZED_VARS: ");
994 FOR_EACH_VEC_ELT (*nlv
, i
, t
)
996 dump_generic_node (pp
, t
, 0, flags
, false);
999 newline_and_indent (pp
, spc
+ 2);
1002 if (BLOCK_ABSTRACT_ORIGIN (block
))
1004 pp_string (pp
, "ABSTRACT_ORIGIN: ");
1005 dump_generic_node (pp
, BLOCK_ABSTRACT_ORIGIN (block
), 0,
1006 flags
| TDF_SLIM
, false);
1007 newline_and_indent (pp
, spc
+ 2);
1010 if (BLOCK_FRAGMENT_ORIGIN (block
))
1012 pp_string (pp
, "FRAGMENT_ORIGIN: ");
1013 dump_generic_node (pp
, BLOCK_FRAGMENT_ORIGIN (block
), 0,
1014 flags
| TDF_SLIM
, false);
1015 newline_and_indent (pp
, spc
+ 2);
1018 if (BLOCK_FRAGMENT_CHAIN (block
))
1020 pp_string (pp
, "FRAGMENT_CHAIN: ");
1021 for (t
= BLOCK_FRAGMENT_CHAIN (block
); t
; t
= BLOCK_FRAGMENT_CHAIN (t
))
1023 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
1026 newline_and_indent (pp
, spc
+ 2);
1031 /* Dump the node NODE on the pretty_printer PP, SPC spaces of
1032 indent. FLAGS specifies details to show in the dump (see TDF_* in
1033 dumpfile.h). If IS_STMT is true, the object printed is considered
1034 to be a statement and it is terminated by ';' if appropriate. */
1037 dump_generic_node (pretty_printer
*pp
, tree node
, int spc
, int flags
,
1044 enum tree_code code
;
1046 if (node
== NULL_TREE
)
1049 is_expr
= EXPR_P (node
);
1051 if (is_stmt
&& (flags
& TDF_STMTADDR
))
1052 pp_printf (pp
, "<&%p> ", (void *)node
);
1054 if ((flags
& TDF_LINENO
) && EXPR_HAS_LOCATION (node
))
1055 dump_location (pp
, EXPR_LOCATION (node
));
1057 code
= TREE_CODE (node
);
1061 pp_string (pp
, "<<< error >>>");
1064 case IDENTIFIER_NODE
:
1065 pp_tree_identifier (pp
, node
);
1069 while (node
&& node
!= error_mark_node
)
1071 if (TREE_PURPOSE (node
))
1073 dump_generic_node (pp
, TREE_PURPOSE (node
), spc
, flags
, false);
1076 dump_generic_node (pp
, TREE_VALUE (node
), spc
, flags
, false);
1077 node
= TREE_CHAIN (node
);
1078 if (node
&& TREE_CODE (node
) == TREE_LIST
)
1087 dump_generic_node (pp
, BINFO_TYPE (node
), spc
, flags
, false);
1093 if (TREE_VEC_LENGTH (node
) > 0)
1095 size_t len
= TREE_VEC_LENGTH (node
);
1096 for (i
= 0; i
< len
- 1; i
++)
1098 dump_generic_node (pp
, TREE_VEC_ELT (node
, i
), spc
, flags
,
1103 dump_generic_node (pp
, TREE_VEC_ELT (node
, len
- 1), spc
,
1110 case POINTER_BOUNDS_TYPE
:
1113 case FIXED_POINT_TYPE
:
1119 unsigned int quals
= TYPE_QUALS (node
);
1120 enum tree_code_class tclass
;
1122 if (quals
& TYPE_QUAL_ATOMIC
)
1123 pp_string (pp
, "atomic ");
1124 if (quals
& TYPE_QUAL_CONST
)
1125 pp_string (pp
, "const ");
1126 else if (quals
& TYPE_QUAL_VOLATILE
)
1127 pp_string (pp
, "volatile ");
1128 else if (quals
& TYPE_QUAL_RESTRICT
)
1129 pp_string (pp
, "restrict ");
1131 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
1133 pp_string (pp
, "<address-space-");
1134 pp_decimal_int (pp
, TYPE_ADDR_SPACE (node
));
1135 pp_string (pp
, "> ");
1138 tclass
= TREE_CODE_CLASS (TREE_CODE (node
));
1140 if (tclass
== tcc_declaration
)
1142 if (DECL_NAME (node
))
1143 dump_decl_name (pp
, node
, flags
);
1145 pp_string (pp
, "<unnamed type decl>");
1147 else if (tclass
== tcc_type
)
1149 if (TYPE_NAME (node
))
1151 if (TREE_CODE (TYPE_NAME (node
)) == IDENTIFIER_NODE
)
1152 pp_tree_identifier (pp
, TYPE_NAME (node
));
1153 else if (TREE_CODE (TYPE_NAME (node
)) == TYPE_DECL
1154 && DECL_NAME (TYPE_NAME (node
)))
1155 dump_decl_name (pp
, TYPE_NAME (node
), flags
);
1157 pp_string (pp
, "<unnamed type>");
1159 else if (TREE_CODE (node
) == VECTOR_TYPE
)
1161 pp_string (pp
, "vector");
1163 pp_wide_integer (pp
, TYPE_VECTOR_SUBPARTS (node
));
1164 pp_string (pp
, ") ");
1165 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1167 else if (TREE_CODE (node
) == INTEGER_TYPE
)
1169 if (TYPE_PRECISION (node
) == CHAR_TYPE_SIZE
)
1170 pp_string (pp
, (TYPE_UNSIGNED (node
)
1173 else if (TYPE_PRECISION (node
) == SHORT_TYPE_SIZE
)
1174 pp_string (pp
, (TYPE_UNSIGNED (node
)
1177 else if (TYPE_PRECISION (node
) == INT_TYPE_SIZE
)
1178 pp_string (pp
, (TYPE_UNSIGNED (node
)
1181 else if (TYPE_PRECISION (node
) == LONG_TYPE_SIZE
)
1182 pp_string (pp
, (TYPE_UNSIGNED (node
)
1185 else if (TYPE_PRECISION (node
) == LONG_LONG_TYPE_SIZE
)
1186 pp_string (pp
, (TYPE_UNSIGNED (node
)
1187 ? "unsigned long long"
1188 : "signed long long"));
1189 else if (TYPE_PRECISION (node
) >= CHAR_TYPE_SIZE
1190 && exact_log2 (TYPE_PRECISION (node
)) != -1)
1192 pp_string (pp
, (TYPE_UNSIGNED (node
) ? "uint" : "int"));
1193 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1194 pp_string (pp
, "_t");
1198 pp_string (pp
, (TYPE_UNSIGNED (node
)
1199 ? "<unnamed-unsigned:"
1200 : "<unnamed-signed:"));
1201 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1205 else if (TREE_CODE (node
) == COMPLEX_TYPE
)
1207 pp_string (pp
, "__complex__ ");
1208 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1210 else if (TREE_CODE (node
) == REAL_TYPE
)
1212 pp_string (pp
, "<float:");
1213 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1216 else if (TREE_CODE (node
) == FIXED_POINT_TYPE
)
1218 pp_string (pp
, "<fixed-point-");
1219 pp_string (pp
, TYPE_SATURATING (node
) ? "sat:" : "nonsat:");
1220 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1223 else if (TREE_CODE (node
) == VOID_TYPE
)
1224 pp_string (pp
, "void");
1226 pp_string (pp
, "<unnamed type>");
1232 case REFERENCE_TYPE
:
1233 str
= (TREE_CODE (node
) == POINTER_TYPE
? "*" : "&");
1235 if (TREE_TYPE (node
) == NULL
)
1237 pp_string (pp
, str
);
1238 pp_string (pp
, "<null type>");
1240 else if (TREE_CODE (TREE_TYPE (node
)) == FUNCTION_TYPE
)
1242 tree fnode
= TREE_TYPE (node
);
1244 dump_generic_node (pp
, TREE_TYPE (fnode
), spc
, flags
, false);
1247 pp_string (pp
, str
);
1248 if (TYPE_NAME (node
) && DECL_NAME (TYPE_NAME (node
)))
1249 dump_decl_name (pp
, TYPE_NAME (node
), flags
);
1250 else if (flags
& TDF_NOUID
)
1251 pp_printf (pp
, "<Txxxx>");
1253 pp_printf (pp
, "<T%x>", TYPE_UID (node
));
1255 pp_right_paren (pp
);
1256 dump_function_declaration (pp
, fnode
, spc
, flags
);
1260 unsigned int quals
= TYPE_QUALS (node
);
1262 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1264 pp_string (pp
, str
);
1266 if (quals
& TYPE_QUAL_CONST
)
1267 pp_string (pp
, " const");
1268 if (quals
& TYPE_QUAL_VOLATILE
)
1269 pp_string (pp
, " volatile");
1270 if (quals
& TYPE_QUAL_RESTRICT
)
1271 pp_string (pp
, " restrict");
1273 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
1275 pp_string (pp
, " <address-space-");
1276 pp_decimal_int (pp
, TYPE_ADDR_SPACE (node
));
1280 if (TYPE_REF_CAN_ALIAS_ALL (node
))
1281 pp_string (pp
, " {ref-all}");
1291 if (integer_zerop (TREE_OPERAND (node
, 1))
1292 /* Dump the types of INTEGER_CSTs explicitly, for we can't
1293 infer them and MEM_ATTR caching will share MEM_REFs
1294 with differently-typed op0s. */
1295 && TREE_CODE (TREE_OPERAND (node
, 0)) != INTEGER_CST
1296 /* Released SSA_NAMES have no TREE_TYPE. */
1297 && TREE_TYPE (TREE_OPERAND (node
, 0)) != NULL_TREE
1298 /* Same pointer types, but ignoring POINTER_TYPE vs.
1300 && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 0)))
1301 == TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 1))))
1302 && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (node
, 0)))
1303 == TYPE_MODE (TREE_TYPE (TREE_OPERAND (node
, 1))))
1304 && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node
, 0)))
1305 == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node
, 1))))
1306 /* Same value types ignoring qualifiers. */
1307 && (TYPE_MAIN_VARIANT (TREE_TYPE (node
))
1308 == TYPE_MAIN_VARIANT
1309 (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 1)))))
1310 && (!(flags
& TDF_ALIAS
)
1311 || MR_DEPENDENCE_CLIQUE (node
) == 0))
1313 if (TREE_CODE (TREE_OPERAND (node
, 0)) != ADDR_EXPR
)
1316 dump_generic_node (pp
, TREE_OPERAND (node
, 0),
1320 dump_generic_node (pp
,
1321 TREE_OPERAND (TREE_OPERAND (node
, 0), 0),
1328 pp_string (pp
, "MEM[");
1330 ptype
= TYPE_MAIN_VARIANT (TREE_TYPE (TREE_OPERAND (node
, 1)));
1331 dump_generic_node (pp
, ptype
,
1332 spc
, flags
| TDF_SLIM
, false);
1333 pp_right_paren (pp
);
1334 dump_generic_node (pp
, TREE_OPERAND (node
, 0),
1336 if (!integer_zerop (TREE_OPERAND (node
, 1)))
1338 pp_string (pp
, " + ");
1339 dump_generic_node (pp
, TREE_OPERAND (node
, 1),
1342 if ((flags
& TDF_ALIAS
)
1343 && MR_DEPENDENCE_CLIQUE (node
) != 0)
1345 pp_string (pp
, " clique ");
1346 pp_unsigned_wide_integer (pp
, MR_DEPENDENCE_CLIQUE (node
));
1347 pp_string (pp
, " base ");
1348 pp_unsigned_wide_integer (pp
, MR_DEPENDENCE_BASE (node
));
1350 pp_right_bracket (pp
);
1355 case TARGET_MEM_REF
:
1357 const char *sep
= "";
1360 pp_string (pp
, "MEM[");
1362 if (TREE_CODE (TMR_BASE (node
)) == ADDR_EXPR
)
1364 pp_string (pp
, sep
);
1366 pp_string (pp
, "symbol: ");
1367 dump_generic_node (pp
, TREE_OPERAND (TMR_BASE (node
), 0),
1372 pp_string (pp
, sep
);
1374 pp_string (pp
, "base: ");
1375 dump_generic_node (pp
, TMR_BASE (node
), spc
, flags
, false);
1377 tmp
= TMR_INDEX2 (node
);
1380 pp_string (pp
, sep
);
1382 pp_string (pp
, "base: ");
1383 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1385 tmp
= TMR_INDEX (node
);
1388 pp_string (pp
, sep
);
1390 pp_string (pp
, "index: ");
1391 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1393 tmp
= TMR_STEP (node
);
1396 pp_string (pp
, sep
);
1398 pp_string (pp
, "step: ");
1399 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1401 tmp
= TMR_OFFSET (node
);
1404 pp_string (pp
, sep
);
1406 pp_string (pp
, "offset: ");
1407 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1409 pp_right_bracket (pp
);
1417 /* Print the innermost component type. */
1418 for (tmp
= TREE_TYPE (node
); TREE_CODE (tmp
) == ARRAY_TYPE
;
1419 tmp
= TREE_TYPE (tmp
))
1421 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1423 /* Print the dimensions. */
1424 for (tmp
= node
; TREE_CODE (tmp
) == ARRAY_TYPE
; tmp
= TREE_TYPE (tmp
))
1425 dump_array_domain (pp
, TYPE_DOMAIN (tmp
), spc
, flags
);
1431 case QUAL_UNION_TYPE
:
1433 unsigned int quals
= TYPE_QUALS (node
);
1435 if (quals
& TYPE_QUAL_ATOMIC
)
1436 pp_string (pp
, "atomic ");
1437 if (quals
& TYPE_QUAL_CONST
)
1438 pp_string (pp
, "const ");
1439 if (quals
& TYPE_QUAL_VOLATILE
)
1440 pp_string (pp
, "volatile ");
1442 /* Print the name of the structure. */
1443 if (TREE_CODE (node
) == RECORD_TYPE
)
1444 pp_string (pp
, "struct ");
1445 else if (TREE_CODE (node
) == UNION_TYPE
)
1446 pp_string (pp
, "union ");
1448 if (TYPE_NAME (node
))
1449 dump_generic_node (pp
, TYPE_NAME (node
), spc
, flags
, false);
1450 else if (!(flags
& TDF_SLIM
))
1451 /* FIXME: If we eliminate the 'else' above and attempt
1452 to show the fields for named types, we may get stuck
1453 following a cycle of pointers to structs. The alleged
1454 self-reference check in print_struct_decl will not detect
1455 cycles involving more than one pointer or struct type. */
1456 print_struct_decl (pp
, node
, spc
, flags
);
1465 if (TREE_CODE (TREE_TYPE (node
)) == POINTER_TYPE
)
1467 /* In the case of a pointer, one may want to divide by the
1468 size of the pointed-to type. Unfortunately, this not
1469 straightforward. The C front-end maps expressions
1474 in such a way that the two INTEGER_CST nodes for "5" have
1475 different values but identical types. In the latter
1476 case, the 5 is multiplied by sizeof (int) in c-common.c
1477 (pointer_int_sum) to convert it to a byte address, and
1478 yet the type of the node is left unchanged. Argh. What
1479 is consistent though is that the number value corresponds
1480 to bytes (UNITS) offset.
1482 NB: Neither of the following divisors can be trivially
1483 used to recover the original literal:
1485 TREE_INT_CST_LOW (TYPE_SIZE_UNIT (TREE_TYPE (node)))
1486 TYPE_PRECISION (TREE_TYPE (TREE_TYPE (node))) */
1487 pp_wide_integer (pp
, TREE_INT_CST_LOW (node
));
1488 pp_string (pp
, "B"); /* pseudo-unit */
1490 else if (tree_fits_shwi_p (node
))
1491 pp_wide_integer (pp
, tree_to_shwi (node
));
1492 else if (tree_fits_uhwi_p (node
))
1493 pp_unsigned_wide_integer (pp
, tree_to_uhwi (node
));
1496 wide_int val
= node
;
1498 if (wi::neg_p (val
, TYPE_SIGN (TREE_TYPE (node
))))
1503 print_hex (val
, pp_buffer (pp
)->digit_buffer
);
1504 pp_string (pp
, pp_buffer (pp
)->digit_buffer
);
1506 if (TREE_OVERFLOW (node
))
1507 pp_string (pp
, "(OVF)");
1511 /* Code copied from print_node. */
1514 if (TREE_OVERFLOW (node
))
1515 pp_string (pp
, " overflow");
1517 #if !defined(REAL_IS_NOT_DOUBLE) || defined(REAL_ARITHMETIC)
1518 d
= TREE_REAL_CST (node
);
1519 if (REAL_VALUE_ISINF (d
))
1520 pp_string (pp
, REAL_VALUE_NEGATIVE (d
) ? " -Inf" : " Inf");
1521 else if (REAL_VALUE_ISNAN (d
))
1522 pp_string (pp
, " Nan");
1526 real_to_decimal (string
, &d
, sizeof (string
), 0, 1);
1527 pp_string (pp
, string
);
1532 unsigned char *p
= (unsigned char *) &TREE_REAL_CST (node
);
1533 pp_string (pp
, "0x");
1534 for (i
= 0; i
< sizeof TREE_REAL_CST (node
); i
++)
1535 output_formatted_integer (pp
, "%02x", *p
++);
1544 fixed_to_decimal (string
, TREE_FIXED_CST_PTR (node
), sizeof (string
));
1545 pp_string (pp
, string
);
1550 pp_string (pp
, "__complex__ (");
1551 dump_generic_node (pp
, TREE_REALPART (node
), spc
, flags
, false);
1552 pp_string (pp
, ", ");
1553 dump_generic_node (pp
, TREE_IMAGPART (node
), spc
, flags
, false);
1554 pp_right_paren (pp
);
1558 pp_string (pp
, "\"");
1559 pretty_print_string (pp
, TREE_STRING_POINTER (node
));
1560 pp_string (pp
, "\"");
1566 pp_string (pp
, "{ ");
1567 for (i
= 0; i
< VECTOR_CST_NELTS (node
); ++i
)
1570 pp_string (pp
, ", ");
1571 dump_generic_node (pp
, VECTOR_CST_ELT (node
, i
),
1574 pp_string (pp
, " }");
1580 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1582 if (TREE_CODE (node
) == METHOD_TYPE
)
1584 if (TYPE_METHOD_BASETYPE (node
))
1585 dump_decl_name (pp
, TYPE_NAME (TYPE_METHOD_BASETYPE (node
)),
1588 pp_string (pp
, "<null method basetype>");
1589 pp_colon_colon (pp
);
1591 if (TYPE_NAME (node
) && DECL_NAME (TYPE_NAME (node
)))
1592 dump_decl_name (pp
, TYPE_NAME (node
), flags
);
1593 else if (flags
& TDF_NOUID
)
1594 pp_printf (pp
, "<Txxxx>");
1596 pp_printf (pp
, "<T%x>", TYPE_UID (node
));
1597 dump_function_declaration (pp
, node
, spc
, flags
);
1602 dump_decl_name (pp
, node
, flags
);
1606 if (DECL_NAME (node
))
1607 dump_decl_name (pp
, node
, flags
);
1608 else if (LABEL_DECL_UID (node
) != -1)
1609 pp_printf (pp
, "<L%d>", (int) LABEL_DECL_UID (node
));
1612 if (flags
& TDF_NOUID
)
1613 pp_string (pp
, "<D.xxxx>");
1615 pp_printf (pp
, "<D.%u>", DECL_UID (node
));
1620 if (DECL_IS_BUILTIN (node
))
1622 /* Don't print the declaration of built-in types. */
1625 if (DECL_NAME (node
))
1626 dump_decl_name (pp
, node
, flags
);
1627 else if (TYPE_NAME (TREE_TYPE (node
)) != node
)
1629 if ((TREE_CODE (TREE_TYPE (node
)) == RECORD_TYPE
1630 || TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
)
1631 && TYPE_METHODS (TREE_TYPE (node
)))
1633 /* The type is a c++ class: all structures have at least
1635 pp_string (pp
, "class ");
1636 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1641 (TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
1642 ? "union" : "struct "));
1643 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1647 pp_string (pp
, "<anon>");
1653 case DEBUG_EXPR_DECL
:
1654 case NAMESPACE_DECL
:
1656 dump_decl_name (pp
, node
, flags
);
1660 pp_string (pp
, "<retval>");
1664 op0
= TREE_OPERAND (node
, 0);
1667 && (TREE_CODE (op0
) == INDIRECT_REF
1668 || (TREE_CODE (op0
) == MEM_REF
1669 && TREE_CODE (TREE_OPERAND (op0
, 0)) != ADDR_EXPR
1670 && integer_zerop (TREE_OPERAND (op0
, 1))
1671 /* Dump the types of INTEGER_CSTs explicitly, for we
1672 can't infer them and MEM_ATTR caching will share
1673 MEM_REFs with differently-typed op0s. */
1674 && TREE_CODE (TREE_OPERAND (op0
, 0)) != INTEGER_CST
1675 /* Released SSA_NAMES have no TREE_TYPE. */
1676 && TREE_TYPE (TREE_OPERAND (op0
, 0)) != NULL_TREE
1677 /* Same pointer types, but ignoring POINTER_TYPE vs.
1679 && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 0)))
1680 == TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 1))))
1681 && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0
, 0)))
1682 == TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0
, 1))))
1683 && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0
, 0)))
1684 == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0
, 1))))
1685 /* Same value types ignoring qualifiers. */
1686 && (TYPE_MAIN_VARIANT (TREE_TYPE (op0
))
1687 == TYPE_MAIN_VARIANT
1688 (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 1)))))
1689 && MR_DEPENDENCE_CLIQUE (op0
) == 0)))
1691 op0
= TREE_OPERAND (op0
, 0);
1694 if (op_prio (op0
) < op_prio (node
))
1696 dump_generic_node (pp
, op0
, spc
, flags
, false);
1697 if (op_prio (op0
) < op_prio (node
))
1698 pp_right_paren (pp
);
1699 pp_string (pp
, str
);
1700 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1701 op0
= component_ref_field_offset (node
);
1702 if (op0
&& TREE_CODE (op0
) != INTEGER_CST
)
1704 pp_string (pp
, "{off: ");
1705 dump_generic_node (pp
, op0
, spc
, flags
, false);
1706 pp_right_brace (pp
);
1711 pp_string (pp
, "BIT_FIELD_REF <");
1712 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1713 pp_string (pp
, ", ");
1714 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1715 pp_string (pp
, ", ");
1716 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
1721 case ARRAY_RANGE_REF
:
1722 op0
= TREE_OPERAND (node
, 0);
1723 if (op_prio (op0
) < op_prio (node
))
1725 dump_generic_node (pp
, op0
, spc
, flags
, false);
1726 if (op_prio (op0
) < op_prio (node
))
1727 pp_right_paren (pp
);
1728 pp_left_bracket (pp
);
1729 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1730 if (TREE_CODE (node
) == ARRAY_RANGE_REF
)
1731 pp_string (pp
, " ...");
1732 pp_right_bracket (pp
);
1734 op0
= array_ref_low_bound (node
);
1735 op1
= array_ref_element_size (node
);
1737 if (!integer_zerop (op0
)
1738 || TREE_OPERAND (node
, 2)
1739 || TREE_OPERAND (node
, 3))
1741 pp_string (pp
, "{lb: ");
1742 dump_generic_node (pp
, op0
, spc
, flags
, false);
1743 pp_string (pp
, " sz: ");
1744 dump_generic_node (pp
, op1
, spc
, flags
, false);
1745 pp_right_brace (pp
);
1751 unsigned HOST_WIDE_INT ix
;
1753 bool is_struct_init
= false;
1754 bool is_array_init
= false;
1757 if (TREE_CLOBBER_P (node
))
1758 pp_string (pp
, "CLOBBER");
1759 else if (TREE_CODE (TREE_TYPE (node
)) == RECORD_TYPE
1760 || TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
)
1761 is_struct_init
= true;
1762 else if (TREE_CODE (TREE_TYPE (node
)) == ARRAY_TYPE
1763 && TYPE_DOMAIN (TREE_TYPE (node
))
1764 && TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
)))
1765 && TREE_CODE (TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
))))
1768 tree minv
= TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
)));
1769 is_array_init
= true;
1770 curidx
= wi::to_widest (minv
);
1772 FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (node
), ix
, field
, val
)
1779 dump_generic_node (pp
, field
, spc
, flags
, false);
1782 else if (is_array_init
1783 && (TREE_CODE (field
) != INTEGER_CST
1784 || curidx
!= wi::to_widest (field
)))
1786 pp_left_bracket (pp
);
1787 if (TREE_CODE (field
) == RANGE_EXPR
)
1789 dump_generic_node (pp
, TREE_OPERAND (field
, 0), spc
,
1791 pp_string (pp
, " ... ");
1792 dump_generic_node (pp
, TREE_OPERAND (field
, 1), spc
,
1794 if (TREE_CODE (TREE_OPERAND (field
, 1)) == INTEGER_CST
)
1795 curidx
= wi::to_widest (TREE_OPERAND (field
, 1));
1798 dump_generic_node (pp
, field
, spc
, flags
, false);
1799 if (TREE_CODE (field
) == INTEGER_CST
)
1800 curidx
= wi::to_widest (field
);
1801 pp_string (pp
, "]=");
1806 if (val
&& TREE_CODE (val
) == ADDR_EXPR
)
1807 if (TREE_CODE (TREE_OPERAND (val
, 0)) == FUNCTION_DECL
)
1808 val
= TREE_OPERAND (val
, 0);
1809 if (val
&& TREE_CODE (val
) == FUNCTION_DECL
)
1810 dump_decl_name (pp
, val
, flags
);
1812 dump_generic_node (pp
, val
, spc
, flags
, false);
1813 if (ix
!= vec_safe_length (CONSTRUCTOR_ELTS (node
)) - 1)
1819 pp_right_brace (pp
);
1826 if (flags
& TDF_SLIM
)
1828 pp_string (pp
, "<COMPOUND_EXPR>");
1832 dump_generic_node (pp
, TREE_OPERAND (node
, 0),
1833 spc
, flags
, !(flags
& TDF_SLIM
));
1834 if (flags
& TDF_SLIM
)
1835 newline_and_indent (pp
, spc
);
1842 for (tp
= &TREE_OPERAND (node
, 1);
1843 TREE_CODE (*tp
) == COMPOUND_EXPR
;
1844 tp
= &TREE_OPERAND (*tp
, 1))
1846 dump_generic_node (pp
, TREE_OPERAND (*tp
, 0),
1847 spc
, flags
, !(flags
& TDF_SLIM
));
1848 if (flags
& TDF_SLIM
)
1849 newline_and_indent (pp
, spc
);
1857 dump_generic_node (pp
, *tp
, spc
, flags
, !(flags
& TDF_SLIM
));
1861 case STATEMENT_LIST
:
1863 tree_stmt_iterator si
;
1866 if (flags
& TDF_SLIM
)
1868 pp_string (pp
, "<STATEMENT_LIST>");
1872 for (si
= tsi_start (node
); !tsi_end_p (si
); tsi_next (&si
))
1875 newline_and_indent (pp
, spc
);
1878 dump_generic_node (pp
, tsi_stmt (si
), spc
, flags
, true);
1885 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
,
1890 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
,
1895 pp_string (pp
, "TARGET_EXPR <");
1896 dump_generic_node (pp
, TARGET_EXPR_SLOT (node
), spc
, flags
, false);
1899 dump_generic_node (pp
, TARGET_EXPR_INITIAL (node
), spc
, flags
, false);
1904 print_declaration (pp
, DECL_EXPR_DECL (node
), spc
, flags
);
1909 if (TREE_TYPE (node
) == NULL
|| TREE_TYPE (node
) == void_type_node
)
1911 pp_string (pp
, "if (");
1912 dump_generic_node (pp
, COND_EXPR_COND (node
), spc
, flags
, false);
1913 pp_right_paren (pp
);
1914 /* The lowered cond_exprs should always be printed in full. */
1915 if (COND_EXPR_THEN (node
)
1916 && (IS_EMPTY_STMT (COND_EXPR_THEN (node
))
1917 || TREE_CODE (COND_EXPR_THEN (node
)) == GOTO_EXPR
)
1918 && COND_EXPR_ELSE (node
)
1919 && (IS_EMPTY_STMT (COND_EXPR_ELSE (node
))
1920 || TREE_CODE (COND_EXPR_ELSE (node
)) == GOTO_EXPR
))
1923 dump_generic_node (pp
, COND_EXPR_THEN (node
),
1925 if (!IS_EMPTY_STMT (COND_EXPR_ELSE (node
)))
1927 pp_string (pp
, " else ");
1928 dump_generic_node (pp
, COND_EXPR_ELSE (node
),
1932 else if (!(flags
& TDF_SLIM
))
1934 /* Output COND_EXPR_THEN. */
1935 if (COND_EXPR_THEN (node
))
1937 newline_and_indent (pp
, spc
+2);
1939 newline_and_indent (pp
, spc
+4);
1940 dump_generic_node (pp
, COND_EXPR_THEN (node
), spc
+4,
1942 newline_and_indent (pp
, spc
+2);
1943 pp_right_brace (pp
);
1946 /* Output COND_EXPR_ELSE. */
1947 if (COND_EXPR_ELSE (node
)
1948 && !IS_EMPTY_STMT (COND_EXPR_ELSE (node
)))
1950 newline_and_indent (pp
, spc
);
1951 pp_string (pp
, "else");
1952 newline_and_indent (pp
, spc
+2);
1954 newline_and_indent (pp
, spc
+4);
1955 dump_generic_node (pp
, COND_EXPR_ELSE (node
), spc
+4,
1957 newline_and_indent (pp
, spc
+2);
1958 pp_right_brace (pp
);
1965 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1969 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1973 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
1979 if (!(flags
& TDF_SLIM
))
1981 if (BIND_EXPR_VARS (node
))
1985 for (op0
= BIND_EXPR_VARS (node
); op0
; op0
= DECL_CHAIN (op0
))
1987 print_declaration (pp
, op0
, spc
+2, flags
);
1992 newline_and_indent (pp
, spc
+2);
1993 dump_generic_node (pp
, BIND_EXPR_BODY (node
), spc
+2, flags
, true);
1994 newline_and_indent (pp
, spc
);
1995 pp_right_brace (pp
);
2001 if (CALL_EXPR_FN (node
) != NULL_TREE
)
2002 print_call_name (pp
, CALL_EXPR_FN (node
), flags
);
2004 pp_string (pp
, internal_fn_name (CALL_EXPR_IFN (node
)));
2006 /* Print parameters. */
2011 call_expr_arg_iterator iter
;
2012 FOR_EACH_CALL_EXPR_ARG (arg
, iter
, node
)
2014 dump_generic_node (pp
, arg
, spc
, flags
, false);
2015 if (more_call_expr_args_p (&iter
))
2022 if (CALL_EXPR_VA_ARG_PACK (node
))
2024 if (call_expr_nargs (node
) > 0)
2029 pp_string (pp
, "__builtin_va_arg_pack ()");
2031 pp_right_paren (pp
);
2033 op1
= CALL_EXPR_STATIC_CHAIN (node
);
2036 pp_string (pp
, " [static-chain: ");
2037 dump_generic_node (pp
, op1
, spc
, flags
, false);
2038 pp_right_bracket (pp
);
2041 if (CALL_EXPR_RETURN_SLOT_OPT (node
))
2042 pp_string (pp
, " [return slot optimization]");
2043 if (CALL_EXPR_TAILCALL (node
))
2044 pp_string (pp
, " [tail call]");
2047 case WITH_CLEANUP_EXPR
:
2051 case CLEANUP_POINT_EXPR
:
2052 pp_string (pp
, "<<cleanup_point ");
2053 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2054 pp_string (pp
, ">>");
2057 case PLACEHOLDER_EXPR
:
2058 pp_string (pp
, "<PLACEHOLDER_EXPR ");
2059 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2063 /* Binary arithmetic and logic expressions. */
2064 case WIDEN_SUM_EXPR
:
2065 case WIDEN_MULT_EXPR
:
2067 case MULT_HIGHPART_EXPR
:
2069 case POINTER_PLUS_EXPR
:
2071 case TRUNC_DIV_EXPR
:
2073 case FLOOR_DIV_EXPR
:
2074 case ROUND_DIV_EXPR
:
2075 case TRUNC_MOD_EXPR
:
2077 case FLOOR_MOD_EXPR
:
2078 case ROUND_MOD_EXPR
:
2080 case EXACT_DIV_EXPR
:
2085 case WIDEN_LSHIFT_EXPR
:
2089 case TRUTH_ANDIF_EXPR
:
2090 case TRUTH_ORIF_EXPR
:
2091 case TRUTH_AND_EXPR
:
2093 case TRUTH_XOR_EXPR
:
2107 case UNORDERED_EXPR
:
2109 const char *op
= op_symbol (node
);
2110 op0
= TREE_OPERAND (node
, 0);
2111 op1
= TREE_OPERAND (node
, 1);
2113 /* When the operands are expressions with less priority,
2114 keep semantics of the tree representation. */
2115 if (op_prio (op0
) <= op_prio (node
))
2118 dump_generic_node (pp
, op0
, spc
, flags
, false);
2119 pp_right_paren (pp
);
2122 dump_generic_node (pp
, op0
, spc
, flags
, false);
2128 /* When the operands are expressions with less priority,
2129 keep semantics of the tree representation. */
2130 if (op_prio (op1
) <= op_prio (node
))
2133 dump_generic_node (pp
, op1
, spc
, flags
, false);
2134 pp_right_paren (pp
);
2137 dump_generic_node (pp
, op1
, spc
, flags
, false);
2141 /* Unary arithmetic and logic expressions. */
2144 case TRUTH_NOT_EXPR
:
2146 case PREDECREMENT_EXPR
:
2147 case PREINCREMENT_EXPR
:
2149 if (TREE_CODE (node
) == ADDR_EXPR
2150 && (TREE_CODE (TREE_OPERAND (node
, 0)) == STRING_CST
2151 || TREE_CODE (TREE_OPERAND (node
, 0)) == FUNCTION_DECL
))
2152 ; /* Do not output '&' for strings and function pointers. */
2154 pp_string (pp
, op_symbol (node
));
2156 if (op_prio (TREE_OPERAND (node
, 0)) < op_prio (node
))
2159 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2160 pp_right_paren (pp
);
2163 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2166 case POSTDECREMENT_EXPR
:
2167 case POSTINCREMENT_EXPR
:
2168 if (op_prio (TREE_OPERAND (node
, 0)) < op_prio (node
))
2171 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2172 pp_right_paren (pp
);
2175 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2176 pp_string (pp
, op_symbol (node
));
2180 pp_string (pp
, "MIN_EXPR <");
2181 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2182 pp_string (pp
, ", ");
2183 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2188 pp_string (pp
, "MAX_EXPR <");
2189 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2190 pp_string (pp
, ", ");
2191 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2196 pp_string (pp
, "ABS_EXPR <");
2197 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2205 case ADDR_SPACE_CONVERT_EXPR
:
2206 case FIXED_CONVERT_EXPR
:
2207 case FIX_TRUNC_EXPR
:
2210 type
= TREE_TYPE (node
);
2211 op0
= TREE_OPERAND (node
, 0);
2212 if (type
!= TREE_TYPE (op0
))
2215 dump_generic_node (pp
, type
, spc
, flags
, false);
2216 pp_string (pp
, ") ");
2218 if (op_prio (op0
) < op_prio (node
))
2220 dump_generic_node (pp
, op0
, spc
, flags
, false);
2221 if (op_prio (op0
) < op_prio (node
))
2222 pp_right_paren (pp
);
2225 case VIEW_CONVERT_EXPR
:
2226 pp_string (pp
, "VIEW_CONVERT_EXPR<");
2227 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2228 pp_string (pp
, ">(");
2229 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2230 pp_right_paren (pp
);
2234 pp_string (pp
, "((");
2235 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2236 pp_string (pp
, "))");
2239 case NON_LVALUE_EXPR
:
2240 pp_string (pp
, "NON_LVALUE_EXPR <");
2241 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2246 pp_string (pp
, "SAVE_EXPR <");
2247 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2252 pp_string (pp
, "COMPLEX_EXPR <");
2253 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2254 pp_string (pp
, ", ");
2255 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2260 pp_string (pp
, "CONJ_EXPR <");
2261 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2266 pp_string (pp
, "REALPART_EXPR <");
2267 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2272 pp_string (pp
, "IMAGPART_EXPR <");
2273 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2278 pp_string (pp
, "VA_ARG_EXPR <");
2279 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2283 case TRY_FINALLY_EXPR
:
2284 case TRY_CATCH_EXPR
:
2285 pp_string (pp
, "try");
2286 newline_and_indent (pp
, spc
+2);
2288 newline_and_indent (pp
, spc
+4);
2289 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
+4, flags
, true);
2290 newline_and_indent (pp
, spc
+2);
2291 pp_right_brace (pp
);
2292 newline_and_indent (pp
, spc
);
2294 (TREE_CODE (node
) == TRY_CATCH_EXPR
) ? "catch" : "finally");
2295 newline_and_indent (pp
, spc
+2);
2297 newline_and_indent (pp
, spc
+4);
2298 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
+4, flags
, true);
2299 newline_and_indent (pp
, spc
+2);
2300 pp_right_brace (pp
);
2305 pp_string (pp
, "catch (");
2306 dump_generic_node (pp
, CATCH_TYPES (node
), spc
+2, flags
, false);
2307 pp_right_paren (pp
);
2308 newline_and_indent (pp
, spc
+2);
2310 newline_and_indent (pp
, spc
+4);
2311 dump_generic_node (pp
, CATCH_BODY (node
), spc
+4, flags
, true);
2312 newline_and_indent (pp
, spc
+2);
2313 pp_right_brace (pp
);
2317 case EH_FILTER_EXPR
:
2318 pp_string (pp
, "<<<eh_filter (");
2319 dump_generic_node (pp
, EH_FILTER_TYPES (node
), spc
+2, flags
, false);
2320 pp_string (pp
, ")>>>");
2321 newline_and_indent (pp
, spc
+2);
2323 newline_and_indent (pp
, spc
+4);
2324 dump_generic_node (pp
, EH_FILTER_FAILURE (node
), spc
+4, flags
, true);
2325 newline_and_indent (pp
, spc
+2);
2326 pp_right_brace (pp
);
2331 op0
= TREE_OPERAND (node
, 0);
2332 /* If this is for break or continue, don't bother printing it. */
2333 if (DECL_NAME (op0
))
2335 const char *name
= IDENTIFIER_POINTER (DECL_NAME (op0
));
2336 if (strcmp (name
, "break") == 0
2337 || strcmp (name
, "continue") == 0)
2340 dump_generic_node (pp
, op0
, spc
, flags
, false);
2342 if (DECL_NONLOCAL (op0
))
2343 pp_string (pp
, " [non-local]");
2347 pp_string (pp
, "while (1)");
2348 if (!(flags
& TDF_SLIM
))
2350 newline_and_indent (pp
, spc
+2);
2352 newline_and_indent (pp
, spc
+4);
2353 dump_generic_node (pp
, LOOP_EXPR_BODY (node
), spc
+4, flags
, true);
2354 newline_and_indent (pp
, spc
+2);
2355 pp_right_brace (pp
);
2361 pp_string (pp
, "// predicted ");
2362 if (PREDICT_EXPR_OUTCOME (node
))
2363 pp_string (pp
, "likely by ");
2365 pp_string (pp
, "unlikely by ");
2366 pp_string (pp
, predictor_name (PREDICT_EXPR_PREDICTOR (node
)));
2367 pp_string (pp
, " predictor.");
2371 pp_string (pp
, "ANNOTATE_EXPR <");
2372 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2373 switch ((enum annot_expr_kind
) TREE_INT_CST_LOW (TREE_OPERAND (node
, 1)))
2375 case annot_expr_ivdep_kind
:
2376 pp_string (pp
, ", ivdep");
2378 case annot_expr_no_vector_kind
:
2379 pp_string (pp
, ", no-vector");
2381 case annot_expr_vector_kind
:
2382 pp_string (pp
, ", vector");
2391 pp_string (pp
, "return");
2392 op0
= TREE_OPERAND (node
, 0);
2396 if (TREE_CODE (op0
) == MODIFY_EXPR
)
2397 dump_generic_node (pp
, TREE_OPERAND (op0
, 1),
2400 dump_generic_node (pp
, op0
, spc
, flags
, false);
2405 pp_string (pp
, "if (");
2406 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2407 pp_string (pp
, ") break");
2411 pp_string (pp
, "switch (");
2412 dump_generic_node (pp
, SWITCH_COND (node
), spc
, flags
, false);
2413 pp_right_paren (pp
);
2414 if (!(flags
& TDF_SLIM
))
2416 newline_and_indent (pp
, spc
+2);
2418 if (SWITCH_BODY (node
))
2420 newline_and_indent (pp
, spc
+4);
2421 dump_generic_node (pp
, SWITCH_BODY (node
), spc
+4, flags
,
2426 tree vec
= SWITCH_LABELS (node
);
2427 size_t i
, n
= TREE_VEC_LENGTH (vec
);
2428 for (i
= 0; i
< n
; ++i
)
2430 tree elt
= TREE_VEC_ELT (vec
, i
);
2431 newline_and_indent (pp
, spc
+4);
2434 dump_generic_node (pp
, elt
, spc
+4, flags
, false);
2435 pp_string (pp
, " goto ");
2436 dump_generic_node (pp
, CASE_LABEL (elt
), spc
+4,
2441 pp_string (pp
, "case ???: goto ???;");
2444 newline_and_indent (pp
, spc
+2);
2445 pp_right_brace (pp
);
2451 op0
= GOTO_DESTINATION (node
);
2452 if (TREE_CODE (op0
) != SSA_NAME
&& DECL_P (op0
) && DECL_NAME (op0
))
2454 const char *name
= IDENTIFIER_POINTER (DECL_NAME (op0
));
2455 if (strcmp (name
, "break") == 0
2456 || strcmp (name
, "continue") == 0)
2458 pp_string (pp
, name
);
2462 pp_string (pp
, "goto ");
2463 dump_generic_node (pp
, op0
, spc
, flags
, false);
2467 pp_string (pp
, "__asm__");
2468 if (ASM_VOLATILE_P (node
))
2469 pp_string (pp
, " __volatile__");
2471 dump_generic_node (pp
, ASM_STRING (node
), spc
, flags
, false);
2473 dump_generic_node (pp
, ASM_OUTPUTS (node
), spc
, flags
, false);
2475 dump_generic_node (pp
, ASM_INPUTS (node
), spc
, flags
, false);
2476 if (ASM_CLOBBERS (node
))
2479 dump_generic_node (pp
, ASM_CLOBBERS (node
), spc
, flags
, false);
2481 pp_right_paren (pp
);
2484 case CASE_LABEL_EXPR
:
2485 if (CASE_LOW (node
) && CASE_HIGH (node
))
2487 pp_string (pp
, "case ");
2488 dump_generic_node (pp
, CASE_LOW (node
), spc
, flags
, false);
2489 pp_string (pp
, " ... ");
2490 dump_generic_node (pp
, CASE_HIGH (node
), spc
, flags
, false);
2492 else if (CASE_LOW (node
))
2494 pp_string (pp
, "case ");
2495 dump_generic_node (pp
, CASE_LOW (node
), spc
, flags
, false);
2498 pp_string (pp
, "default");
2503 pp_string (pp
, "OBJ_TYPE_REF(");
2504 dump_generic_node (pp
, OBJ_TYPE_REF_EXPR (node
), spc
, flags
, false);
2506 if (!(flags
& TDF_SLIM
) && virtual_method_call_p (node
))
2508 pp_string (pp
, "(");
2509 dump_generic_node (pp
, obj_type_ref_class (node
), spc
, flags
, false);
2510 pp_string (pp
, ")");
2512 dump_generic_node (pp
, OBJ_TYPE_REF_OBJECT (node
), spc
, flags
, false);
2514 dump_generic_node (pp
, OBJ_TYPE_REF_TOKEN (node
), spc
, flags
, false);
2515 pp_right_paren (pp
);
2519 if (SSA_NAME_IDENTIFIER (node
))
2520 dump_generic_node (pp
, SSA_NAME_IDENTIFIER (node
),
2523 pp_decimal_int (pp
, SSA_NAME_VERSION (node
));
2524 if (SSA_NAME_IS_DEFAULT_DEF (node
))
2525 pp_string (pp
, "(D)");
2526 if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (node
))
2527 pp_string (pp
, "(ab)");
2530 case WITH_SIZE_EXPR
:
2531 pp_string (pp
, "WITH_SIZE_EXPR <");
2532 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2533 pp_string (pp
, ", ");
2534 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2539 pp_string (pp
, "ASSERT_EXPR <");
2540 dump_generic_node (pp
, ASSERT_EXPR_VAR (node
), spc
, flags
, false);
2541 pp_string (pp
, ", ");
2542 dump_generic_node (pp
, ASSERT_EXPR_COND (node
), spc
, flags
, false);
2547 pp_string (pp
, "scev_known");
2550 case SCEV_NOT_KNOWN
:
2551 pp_string (pp
, "scev_not_known");
2554 case POLYNOMIAL_CHREC
:
2556 dump_generic_node (pp
, CHREC_LEFT (node
), spc
, flags
, false);
2557 pp_string (pp
, ", +, ");
2558 dump_generic_node (pp
, CHREC_RIGHT (node
), spc
, flags
, false);
2559 pp_string (pp
, "}_");
2560 dump_generic_node (pp
, CHREC_VAR (node
), spc
, flags
, false);
2564 case REALIGN_LOAD_EXPR
:
2565 pp_string (pp
, "REALIGN_LOAD <");
2566 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2567 pp_string (pp
, ", ");
2568 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2569 pp_string (pp
, ", ");
2570 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2575 pp_string (pp
, " VEC_COND_EXPR < ");
2576 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2577 pp_string (pp
, " , ");
2578 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2579 pp_string (pp
, " , ");
2580 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2581 pp_string (pp
, " > ");
2585 pp_string (pp
, " VEC_PERM_EXPR < ");
2586 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2587 pp_string (pp
, " , ");
2588 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2589 pp_string (pp
, " , ");
2590 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2591 pp_string (pp
, " > ");
2595 pp_string (pp
, " DOT_PROD_EXPR < ");
2596 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2597 pp_string (pp
, ", ");
2598 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2599 pp_string (pp
, ", ");
2600 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2601 pp_string (pp
, " > ");
2604 case WIDEN_MULT_PLUS_EXPR
:
2605 pp_string (pp
, " WIDEN_MULT_PLUS_EXPR < ");
2606 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2607 pp_string (pp
, ", ");
2608 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2609 pp_string (pp
, ", ");
2610 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2611 pp_string (pp
, " > ");
2614 case WIDEN_MULT_MINUS_EXPR
:
2615 pp_string (pp
, " WIDEN_MULT_MINUS_EXPR < ");
2616 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2617 pp_string (pp
, ", ");
2618 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2619 pp_string (pp
, ", ");
2620 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2621 pp_string (pp
, " > ");
2625 pp_string (pp
, " FMA_EXPR < ");
2626 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2627 pp_string (pp
, ", ");
2628 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2629 pp_string (pp
, ", ");
2630 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2631 pp_string (pp
, " > ");
2635 pp_string (pp
, "#pragma acc parallel");
2636 dump_omp_clauses (pp
, OACC_PARALLEL_CLAUSES (node
), spc
, flags
);
2640 pp_string (pp
, "#pragma acc kernels");
2641 dump_omp_clauses (pp
, OACC_KERNELS_CLAUSES (node
), spc
, flags
);
2645 pp_string (pp
, "#pragma acc data");
2646 dump_omp_clauses (pp
, OACC_DATA_CLAUSES (node
), spc
, flags
);
2649 case OACC_HOST_DATA
:
2650 pp_string (pp
, "#pragma acc host_data");
2651 dump_omp_clauses (pp
, OACC_HOST_DATA_CLAUSES (node
), spc
, flags
);
2655 pp_string (pp
, "#pragma acc declare");
2656 dump_omp_clauses (pp
, OACC_DECLARE_CLAUSES (node
), spc
, flags
);
2660 pp_string (pp
, "#pragma acc update");
2661 dump_omp_clauses (pp
, OACC_UPDATE_CLAUSES (node
), spc
, flags
);
2664 case OACC_ENTER_DATA
:
2665 pp_string (pp
, "#pragma acc enter data");
2666 dump_omp_clauses (pp
, OACC_ENTER_DATA_CLAUSES (node
), spc
, flags
);
2669 case OACC_EXIT_DATA
:
2670 pp_string (pp
, "#pragma acc exit data");
2671 dump_omp_clauses (pp
, OACC_EXIT_DATA_CLAUSES (node
), spc
, flags
);
2675 pp_string (pp
, "#pragma acc cache");
2676 dump_omp_clauses (pp
, OACC_CACHE_CLAUSES (node
), spc
, flags
);
2680 pp_string (pp
, "#pragma omp parallel");
2681 dump_omp_clauses (pp
, OMP_PARALLEL_CLAUSES (node
), spc
, flags
);
2684 if (!(flags
& TDF_SLIM
) && OMP_BODY (node
))
2686 newline_and_indent (pp
, spc
+ 2);
2688 newline_and_indent (pp
, spc
+ 4);
2689 dump_generic_node (pp
, OMP_BODY (node
), spc
+ 4, flags
, false);
2690 newline_and_indent (pp
, spc
+ 2);
2691 pp_right_brace (pp
);
2697 pp_string (pp
, "#pragma omp task");
2698 dump_omp_clauses (pp
, OMP_TASK_CLAUSES (node
), spc
, flags
);
2702 pp_string (pp
, "#pragma omp for");
2706 pp_string (pp
, "#pragma omp simd");
2710 pp_string (pp
, "#pragma simd");
2714 /* This label points one line after dumping the clauses.
2715 For _Cilk_for the clauses are dumped after the _Cilk_for (...)
2716 parameters are printed out. */
2717 goto dump_omp_loop_cilk_for
;
2719 case OMP_DISTRIBUTE
:
2720 pp_string (pp
, "#pragma omp distribute");
2724 pp_string (pp
, "#pragma omp taskloop");
2728 pp_string (pp
, "#pragma acc loop");
2732 pp_string (pp
, "#pragma omp teams");
2733 dump_omp_clauses (pp
, OMP_TEAMS_CLAUSES (node
), spc
, flags
);
2736 case OMP_TARGET_DATA
:
2737 pp_string (pp
, "#pragma omp target data");
2738 dump_omp_clauses (pp
, OMP_TARGET_DATA_CLAUSES (node
), spc
, flags
);
2741 case OMP_TARGET_ENTER_DATA
:
2742 pp_string (pp
, "#pragma omp target enter data");
2743 dump_omp_clauses (pp
, OMP_TARGET_ENTER_DATA_CLAUSES (node
), spc
, flags
);
2747 case OMP_TARGET_EXIT_DATA
:
2748 pp_string (pp
, "#pragma omp target exit data");
2749 dump_omp_clauses (pp
, OMP_TARGET_EXIT_DATA_CLAUSES (node
), spc
, flags
);
2754 pp_string (pp
, "#pragma omp target");
2755 dump_omp_clauses (pp
, OMP_TARGET_CLAUSES (node
), spc
, flags
);
2758 case OMP_TARGET_UPDATE
:
2759 pp_string (pp
, "#pragma omp target update");
2760 dump_omp_clauses (pp
, OMP_TARGET_UPDATE_CLAUSES (node
), spc
, flags
);
2765 dump_omp_clauses (pp
, OMP_FOR_CLAUSES (node
), spc
, flags
);
2767 dump_omp_loop_cilk_for
:
2768 if (!(flags
& TDF_SLIM
))
2772 if (OMP_FOR_PRE_BODY (node
))
2774 if (TREE_CODE (node
) == CILK_FOR
)
2775 pp_string (pp
, " ");
2777 newline_and_indent (pp
, spc
+ 2);
2780 newline_and_indent (pp
, spc
);
2781 dump_generic_node (pp
, OMP_FOR_PRE_BODY (node
),
2784 if (OMP_FOR_INIT (node
))
2787 for (i
= 0; i
< TREE_VEC_LENGTH (OMP_FOR_INIT (node
)); i
++)
2790 if (TREE_CODE (node
) != CILK_FOR
|| OMP_FOR_PRE_BODY (node
))
2791 newline_and_indent (pp
, spc
);
2792 if (TREE_CODE (node
) == CILK_FOR
)
2793 pp_string (pp
, "_Cilk_for (");
2795 pp_string (pp
, "for (");
2796 dump_generic_node (pp
,
2797 TREE_VEC_ELT (OMP_FOR_INIT (node
), i
),
2799 pp_string (pp
, "; ");
2800 dump_generic_node (pp
,
2801 TREE_VEC_ELT (OMP_FOR_COND (node
), i
),
2803 pp_string (pp
, "; ");
2804 dump_generic_node (pp
,
2805 TREE_VEC_ELT (OMP_FOR_INCR (node
), i
),
2807 pp_right_paren (pp
);
2809 if (TREE_CODE (node
) == CILK_FOR
)
2810 dump_omp_clauses (pp
, OMP_FOR_CLAUSES (node
), spc
, flags
);
2812 if (OMP_FOR_BODY (node
))
2814 newline_and_indent (pp
, spc
+ 2);
2816 newline_and_indent (pp
, spc
+ 4);
2817 dump_generic_node (pp
, OMP_FOR_BODY (node
), spc
+ 4, flags
,
2819 newline_and_indent (pp
, spc
+ 2);
2820 pp_right_brace (pp
);
2822 if (OMP_FOR_INIT (node
))
2823 spc
-= 2 * TREE_VEC_LENGTH (OMP_FOR_INIT (node
)) - 2;
2824 if (OMP_FOR_PRE_BODY (node
))
2827 newline_and_indent (pp
, spc
+ 2);
2828 pp_right_brace (pp
);
2835 pp_string (pp
, "#pragma omp sections");
2836 dump_omp_clauses (pp
, OMP_SECTIONS_CLAUSES (node
), spc
, flags
);
2840 pp_string (pp
, "#pragma omp section");
2844 pp_string (pp
, "#pragma omp master");
2848 pp_string (pp
, "#pragma omp taskgroup");
2852 pp_string (pp
, "#pragma omp ordered");
2853 dump_omp_clauses (pp
, OMP_ORDERED_CLAUSES (node
), spc
, flags
);
2857 pp_string (pp
, "#pragma omp critical");
2858 if (OMP_CRITICAL_NAME (node
))
2862 dump_generic_node (pp
, OMP_CRITICAL_NAME (node
), spc
,
2864 pp_right_paren (pp
);
2866 dump_omp_clauses (pp
, OMP_CRITICAL_CLAUSES (node
), spc
, flags
);
2870 pp_string (pp
, "#pragma omp atomic");
2871 if (OMP_ATOMIC_SEQ_CST (node
))
2872 pp_string (pp
, " seq_cst");
2873 newline_and_indent (pp
, spc
+ 2);
2874 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2878 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2881 case OMP_ATOMIC_READ
:
2882 pp_string (pp
, "#pragma omp atomic read");
2883 if (OMP_ATOMIC_SEQ_CST (node
))
2884 pp_string (pp
, " seq_cst");
2885 newline_and_indent (pp
, spc
+ 2);
2886 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2890 case OMP_ATOMIC_CAPTURE_OLD
:
2891 case OMP_ATOMIC_CAPTURE_NEW
:
2892 pp_string (pp
, "#pragma omp atomic capture");
2893 if (OMP_ATOMIC_SEQ_CST (node
))
2894 pp_string (pp
, " seq_cst");
2895 newline_and_indent (pp
, spc
+ 2);
2896 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2900 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2904 pp_string (pp
, "#pragma omp single");
2905 dump_omp_clauses (pp
, OMP_SINGLE_CLAUSES (node
), spc
, flags
);
2909 dump_omp_clause (pp
, node
, spc
, flags
);
2913 case TRANSACTION_EXPR
:
2914 if (TRANSACTION_EXPR_OUTER (node
))
2915 pp_string (pp
, "__transaction_atomic [[outer]]");
2916 else if (TRANSACTION_EXPR_RELAXED (node
))
2917 pp_string (pp
, "__transaction_relaxed");
2919 pp_string (pp
, "__transaction_atomic");
2920 if (!(flags
& TDF_SLIM
) && TRANSACTION_EXPR_BODY (node
))
2922 newline_and_indent (pp
, spc
);
2924 newline_and_indent (pp
, spc
+ 2);
2925 dump_generic_node (pp
, TRANSACTION_EXPR_BODY (node
),
2926 spc
+ 2, flags
, false);
2927 newline_and_indent (pp
, spc
);
2928 pp_right_brace (pp
);
2933 case REDUC_MAX_EXPR
:
2934 pp_string (pp
, " REDUC_MAX_EXPR < ");
2935 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2936 pp_string (pp
, " > ");
2939 case REDUC_MIN_EXPR
:
2940 pp_string (pp
, " REDUC_MIN_EXPR < ");
2941 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2942 pp_string (pp
, " > ");
2945 case REDUC_PLUS_EXPR
:
2946 pp_string (pp
, " REDUC_PLUS_EXPR < ");
2947 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2948 pp_string (pp
, " > ");
2951 case VEC_WIDEN_MULT_HI_EXPR
:
2952 case VEC_WIDEN_MULT_LO_EXPR
:
2953 case VEC_WIDEN_MULT_EVEN_EXPR
:
2954 case VEC_WIDEN_MULT_ODD_EXPR
:
2955 case VEC_WIDEN_LSHIFT_HI_EXPR
:
2956 case VEC_WIDEN_LSHIFT_LO_EXPR
:
2958 for (str
= get_tree_code_name (code
); *str
; str
++)
2959 pp_character (pp
, TOUPPER (*str
));
2960 pp_string (pp
, " < ");
2961 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2962 pp_string (pp
, ", ");
2963 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2964 pp_string (pp
, " > ");
2967 case VEC_UNPACK_HI_EXPR
:
2968 pp_string (pp
, " VEC_UNPACK_HI_EXPR < ");
2969 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2970 pp_string (pp
, " > ");
2973 case VEC_UNPACK_LO_EXPR
:
2974 pp_string (pp
, " VEC_UNPACK_LO_EXPR < ");
2975 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2976 pp_string (pp
, " > ");
2979 case VEC_UNPACK_FLOAT_HI_EXPR
:
2980 pp_string (pp
, " VEC_UNPACK_FLOAT_HI_EXPR < ");
2981 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2982 pp_string (pp
, " > ");
2985 case VEC_UNPACK_FLOAT_LO_EXPR
:
2986 pp_string (pp
, " VEC_UNPACK_FLOAT_LO_EXPR < ");
2987 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2988 pp_string (pp
, " > ");
2991 case VEC_PACK_TRUNC_EXPR
:
2992 pp_string (pp
, " VEC_PACK_TRUNC_EXPR < ");
2993 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2994 pp_string (pp
, ", ");
2995 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2996 pp_string (pp
, " > ");
2999 case VEC_PACK_SAT_EXPR
:
3000 pp_string (pp
, " VEC_PACK_SAT_EXPR < ");
3001 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3002 pp_string (pp
, ", ");
3003 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3004 pp_string (pp
, " > ");
3007 case VEC_PACK_FIX_TRUNC_EXPR
:
3008 pp_string (pp
, " VEC_PACK_FIX_TRUNC_EXPR < ");
3009 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3010 pp_string (pp
, ", ");
3011 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3012 pp_string (pp
, " > ");
3016 dump_block_node (pp
, node
, spc
, flags
);
3019 case CILK_SPAWN_STMT
:
3020 pp_string (pp
, "_Cilk_spawn ");
3021 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3024 case CILK_SYNC_STMT
:
3025 pp_string (pp
, "_Cilk_sync");
3032 if (is_stmt
&& is_expr
)
3038 /* Print the declaration of a variable. */
3041 print_declaration (pretty_printer
*pp
, tree t
, int spc
, int flags
)
3045 if (TREE_CODE(t
) == NAMELIST_DECL
)
3047 pp_string(pp
, "namelist ");
3048 dump_decl_name (pp
, t
, flags
);
3053 if (TREE_CODE (t
) == TYPE_DECL
)
3054 pp_string (pp
, "typedef ");
3056 if (CODE_CONTAINS_STRUCT (TREE_CODE (t
), TS_DECL_WRTL
) && DECL_REGISTER (t
))
3057 pp_string (pp
, "register ");
3059 if (TREE_PUBLIC (t
) && DECL_EXTERNAL (t
))
3060 pp_string (pp
, "extern ");
3061 else if (TREE_STATIC (t
))
3062 pp_string (pp
, "static ");
3064 /* Print the type and name. */
3065 if (TREE_TYPE (t
) && TREE_CODE (TREE_TYPE (t
)) == ARRAY_TYPE
)
3069 /* Print array's type. */
3070 tmp
= TREE_TYPE (t
);
3071 while (TREE_CODE (TREE_TYPE (tmp
)) == ARRAY_TYPE
)
3072 tmp
= TREE_TYPE (tmp
);
3073 dump_generic_node (pp
, TREE_TYPE (tmp
), spc
, flags
, false);
3075 /* Print variable's name. */
3077 dump_generic_node (pp
, t
, spc
, flags
, false);
3079 /* Print the dimensions. */
3080 tmp
= TREE_TYPE (t
);
3081 while (TREE_CODE (tmp
) == ARRAY_TYPE
)
3083 dump_array_domain (pp
, TYPE_DOMAIN (tmp
), spc
, flags
);
3084 tmp
= TREE_TYPE (tmp
);
3087 else if (TREE_CODE (t
) == FUNCTION_DECL
)
3089 dump_generic_node (pp
, TREE_TYPE (TREE_TYPE (t
)), spc
, flags
, false);
3091 dump_decl_name (pp
, t
, flags
);
3092 dump_function_declaration (pp
, TREE_TYPE (t
), spc
, flags
);
3096 /* Print type declaration. */
3097 dump_generic_node (pp
, TREE_TYPE (t
), spc
, flags
, false);
3099 /* Print variable's name. */
3101 dump_generic_node (pp
, t
, spc
, flags
, false);
3104 if (TREE_CODE (t
) == VAR_DECL
&& DECL_HARD_REGISTER (t
))
3106 pp_string (pp
, " __asm__ ");
3108 dump_generic_node (pp
, DECL_ASSEMBLER_NAME (t
), spc
, flags
, false);
3109 pp_right_paren (pp
);
3112 /* The initial value of a function serves to determine whether the function
3113 is declared or defined. So the following does not apply to function
3115 if (TREE_CODE (t
) != FUNCTION_DECL
)
3117 /* Print the initial value. */
3118 if (DECL_INITIAL (t
))
3123 dump_generic_node (pp
, DECL_INITIAL (t
), spc
, flags
, false);
3127 if (TREE_CODE (t
) == VAR_DECL
&& DECL_HAS_VALUE_EXPR_P (t
))
3129 pp_string (pp
, " [value-expr: ");
3130 dump_generic_node (pp
, DECL_VALUE_EXPR (t
), spc
, flags
, false);
3131 pp_right_bracket (pp
);
3138 /* Prints a structure: name, fields, and methods.
3139 FIXME: Still incomplete. */
3142 print_struct_decl (pretty_printer
*pp
, const_tree node
, int spc
, int flags
)
3144 /* Print the name of the structure. */
3145 if (TYPE_NAME (node
))
3148 if (TREE_CODE (node
) == RECORD_TYPE
)
3149 pp_string (pp
, "struct ");
3150 else if ((TREE_CODE (node
) == UNION_TYPE
3151 || TREE_CODE (node
) == QUAL_UNION_TYPE
))
3152 pp_string (pp
, "union ");
3154 dump_generic_node (pp
, TYPE_NAME (node
), spc
, 0, false);
3157 /* Print the contents of the structure. */
3163 /* Print the fields of the structure. */
3166 tmp
= TYPE_FIELDS (node
);
3169 /* Avoid to print recursively the structure. */
3170 /* FIXME : Not implemented correctly...,
3171 what about the case when we have a cycle in the contain graph? ...
3172 Maybe this could be solved by looking at the scope in which the
3173 structure was declared. */
3174 if (TREE_TYPE (tmp
) != node
3175 && (TREE_CODE (TREE_TYPE (tmp
)) != POINTER_TYPE
3176 || TREE_TYPE (TREE_TYPE (tmp
)) != node
))
3178 print_declaration (pp
, tmp
, spc
+2, flags
);
3181 tmp
= DECL_CHAIN (tmp
);
3185 pp_right_brace (pp
);
3188 /* Return the priority of the operator CODE.
3190 From lowest to highest precedence with either left-to-right (L-R)
3191 or right-to-left (R-L) associativity]:
3194 2 [R-L] = += -= *= /= %= &= ^= |= <<= >>=
3206 14 [R-L] ! ~ ++ -- + - * & (type) sizeof
3207 15 [L-R] fn() [] -> .
3209 unary +, - and * have higher precedence than the corresponding binary
3213 op_code_prio (enum tree_code code
)
3230 case TRUTH_ORIF_EXPR
:
3233 case TRUTH_AND_EXPR
:
3234 case TRUTH_ANDIF_EXPR
:
3241 case TRUTH_XOR_EXPR
:
3258 case UNORDERED_EXPR
:
3269 case VEC_WIDEN_LSHIFT_HI_EXPR
:
3270 case VEC_WIDEN_LSHIFT_LO_EXPR
:
3271 case WIDEN_LSHIFT_EXPR
:
3274 case WIDEN_SUM_EXPR
:
3276 case POINTER_PLUS_EXPR
:
3280 case VEC_WIDEN_MULT_HI_EXPR
:
3281 case VEC_WIDEN_MULT_LO_EXPR
:
3282 case WIDEN_MULT_EXPR
:
3284 case WIDEN_MULT_PLUS_EXPR
:
3285 case WIDEN_MULT_MINUS_EXPR
:
3287 case MULT_HIGHPART_EXPR
:
3288 case TRUNC_DIV_EXPR
:
3290 case FLOOR_DIV_EXPR
:
3291 case ROUND_DIV_EXPR
:
3293 case EXACT_DIV_EXPR
:
3294 case TRUNC_MOD_EXPR
:
3296 case FLOOR_MOD_EXPR
:
3297 case ROUND_MOD_EXPR
:
3301 case TRUTH_NOT_EXPR
:
3303 case POSTINCREMENT_EXPR
:
3304 case POSTDECREMENT_EXPR
:
3305 case PREINCREMENT_EXPR
:
3306 case PREDECREMENT_EXPR
:
3312 case FIX_TRUNC_EXPR
:
3318 case ARRAY_RANGE_REF
:
3322 /* Special expressions. */
3328 case REDUC_MAX_EXPR
:
3329 case REDUC_MIN_EXPR
:
3330 case REDUC_PLUS_EXPR
:
3331 case VEC_UNPACK_HI_EXPR
:
3332 case VEC_UNPACK_LO_EXPR
:
3333 case VEC_UNPACK_FLOAT_HI_EXPR
:
3334 case VEC_UNPACK_FLOAT_LO_EXPR
:
3335 case VEC_PACK_TRUNC_EXPR
:
3336 case VEC_PACK_SAT_EXPR
:
3340 /* Return an arbitrarily high precedence to avoid surrounding single
3341 VAR_DECLs in ()s. */
3346 /* Return the priority of the operator OP. */
3349 op_prio (const_tree op
)
3351 enum tree_code code
;
3356 code
= TREE_CODE (op
);
3357 if (code
== SAVE_EXPR
|| code
== NON_LVALUE_EXPR
)
3358 return op_prio (TREE_OPERAND (op
, 0));
3360 return op_code_prio (code
);
3363 /* Return the symbol associated with operator CODE. */
3366 op_symbol_code (enum tree_code code
)
3374 case TRUTH_ORIF_EXPR
:
3377 case TRUTH_AND_EXPR
:
3378 case TRUTH_ANDIF_EXPR
:
3384 case TRUTH_XOR_EXPR
:
3394 case UNORDERED_EXPR
:
3440 case WIDEN_LSHIFT_EXPR
:
3443 case POINTER_PLUS_EXPR
:
3449 case REDUC_PLUS_EXPR
:
3452 case WIDEN_SUM_EXPR
:
3455 case WIDEN_MULT_EXPR
:
3458 case MULT_HIGHPART_EXPR
:
3468 case TRUTH_NOT_EXPR
:
3475 case TRUNC_DIV_EXPR
:
3482 case FLOOR_DIV_EXPR
:
3485 case ROUND_DIV_EXPR
:
3488 case EXACT_DIV_EXPR
:
3491 case TRUNC_MOD_EXPR
:
3497 case FLOOR_MOD_EXPR
:
3500 case ROUND_MOD_EXPR
:
3503 case PREDECREMENT_EXPR
:
3506 case PREINCREMENT_EXPR
:
3509 case POSTDECREMENT_EXPR
:
3512 case POSTINCREMENT_EXPR
:
3522 return "<<< ??? >>>";
3526 /* Return the symbol associated with operator OP. */
3529 op_symbol (const_tree op
)
3531 return op_symbol_code (TREE_CODE (op
));
3534 /* Prints the name of a call. NODE is the CALL_EXPR_FN of a CALL_EXPR or
3535 the gimple_call_fn of a GIMPLE_CALL. */
3538 print_call_name (pretty_printer
*pp
, tree node
, int flags
)
3542 if (TREE_CODE (op0
) == NON_LVALUE_EXPR
)
3543 op0
= TREE_OPERAND (op0
, 0);
3546 switch (TREE_CODE (op0
))
3551 dump_function_name (pp
, op0
, flags
);
3557 op0
= TREE_OPERAND (op0
, 0);
3562 dump_generic_node (pp
, TREE_OPERAND (op0
, 0), 0, flags
, false);
3563 pp_string (pp
, ") ? ");
3564 dump_generic_node (pp
, TREE_OPERAND (op0
, 1), 0, flags
, false);
3565 pp_string (pp
, " : ");
3566 dump_generic_node (pp
, TREE_OPERAND (op0
, 2), 0, flags
, false);
3570 if (TREE_CODE (TREE_OPERAND (op0
, 0)) == VAR_DECL
)
3571 dump_function_name (pp
, TREE_OPERAND (op0
, 0), flags
);
3573 dump_generic_node (pp
, op0
, 0, flags
, false);
3577 if (integer_zerop (TREE_OPERAND (op0
, 1)))
3579 op0
= TREE_OPERAND (op0
, 0);
3586 dump_generic_node (pp
, op0
, 0, flags
, false);
3594 /* Parses the string STR and replaces new-lines by '\n', tabs by '\t', ... */
3597 pretty_print_string (pretty_printer
*pp
, const char *str
)
3607 pp_string (pp
, "\\b");
3611 pp_string (pp
, "\\f");
3615 pp_string (pp
, "\\n");
3619 pp_string (pp
, "\\r");
3623 pp_string (pp
, "\\t");
3627 pp_string (pp
, "\\v");
3631 pp_string (pp
, "\\\\");
3635 pp_string (pp
, "\\\"");
3639 pp_string (pp
, "\\'");
3642 /* No need to handle \0; the loop terminates on \0. */
3645 pp_string (pp
, "\\1");
3649 pp_string (pp
, "\\2");
3653 pp_string (pp
, "\\3");
3657 pp_string (pp
, "\\4");
3661 pp_string (pp
, "\\5");
3665 pp_string (pp
, "\\6");
3669 pp_string (pp
, "\\7");
3673 pp_character (pp
, str
[0]);
3681 maybe_init_pretty_print (FILE *file
)
3685 tree_pp
= new pretty_printer ();
3686 pp_needs_newline (tree_pp
) = true;
3687 pp_translate_identifiers (tree_pp
) = false;
3690 tree_pp
->buffer
->stream
= file
;
3694 newline_and_indent (pretty_printer
*pp
, int spc
)
3700 /* Handle a %K format for TEXT. Separate from default_tree_printer so
3701 it can also be used in front ends.
3702 %K: a statement, from which EXPR_LOCATION and TREE_BLOCK will be recorded.
3706 percent_K_format (text_info
*text
)
3708 tree t
= va_arg (*text
->args_ptr
, tree
), block
;
3709 text
->set_location (0, EXPR_LOCATION (t
));
3710 gcc_assert (pp_ti_abstract_origin (text
) != NULL
);
3711 block
= TREE_BLOCK (t
);
3712 *pp_ti_abstract_origin (text
) = NULL
;
3716 /* ??? LTO drops all BLOCK_ABSTRACT_ORIGINs apart from those
3717 representing the outermost block of an inlined function.
3718 So walk the BLOCK tree until we hit such a scope. */
3720 && TREE_CODE (block
) == BLOCK
)
3722 if (inlined_function_outer_scope_p (block
))
3724 *pp_ti_abstract_origin (text
) = block
;
3727 block
= BLOCK_SUPERCONTEXT (block
);
3733 && TREE_CODE (block
) == BLOCK
3734 && BLOCK_ABSTRACT_ORIGIN (block
))
3736 tree ao
= BLOCK_ABSTRACT_ORIGIN (block
);
3738 while (TREE_CODE (ao
) == BLOCK
3739 && BLOCK_ABSTRACT_ORIGIN (ao
)
3740 && BLOCK_ABSTRACT_ORIGIN (ao
) != ao
)
3741 ao
= BLOCK_ABSTRACT_ORIGIN (ao
);
3743 if (TREE_CODE (ao
) == FUNCTION_DECL
)
3745 *pp_ti_abstract_origin (text
) = block
;
3748 block
= BLOCK_SUPERCONTEXT (block
);
3752 /* Print the identifier ID to PRETTY-PRINTER. */
3755 pp_tree_identifier (pretty_printer
*pp
, tree id
)
3757 if (pp_translate_identifiers (pp
))
3759 const char *text
= identifier_to_locale (IDENTIFIER_POINTER (id
));
3760 pp_append_text (pp
, text
, text
+ strlen (text
));
3763 pp_append_text (pp
, IDENTIFIER_POINTER (id
),
3764 IDENTIFIER_POINTER (id
) + IDENTIFIER_LENGTH (id
));
3767 /* A helper function that is used to dump function information before the
3771 dump_function_header (FILE *dump_file
, tree fdecl
, int flags
)
3773 const char *dname
, *aname
;
3774 struct cgraph_node
*node
= cgraph_node::get (fdecl
);
3775 struct function
*fun
= DECL_STRUCT_FUNCTION (fdecl
);
3777 dname
= lang_hooks
.decl_printable_name (fdecl
, 2);
3779 if (DECL_ASSEMBLER_NAME_SET_P (fdecl
))
3780 aname
= (IDENTIFIER_POINTER
3781 (DECL_ASSEMBLER_NAME (fdecl
)));
3783 aname
= "<unset-asm-name>";
3785 fprintf (dump_file
, "\n;; Function %s (%s, funcdef_no=%d",
3786 dname
, aname
, fun
->funcdef_no
);
3787 if (!(flags
& TDF_NOUID
))
3788 fprintf (dump_file
, ", decl_uid=%d", DECL_UID (fdecl
));
3791 fprintf (dump_file
, ", cgraph_uid=%d", node
->uid
);
3792 fprintf (dump_file
, ", symbol_order=%d)%s\n\n", node
->order
,
3793 node
->frequency
== NODE_FREQUENCY_HOT
3795 : node
->frequency
== NODE_FREQUENCY_UNLIKELY_EXECUTED
3796 ? " (unlikely executed)"
3797 : node
->frequency
== NODE_FREQUENCY_EXECUTED_ONCE
3798 ? " (executed once)"
3802 fprintf (dump_file
, ")\n\n");
3805 /* Dump double_int D to pretty_printer PP. UNS is true
3806 if D is unsigned and false otherwise. */
3808 pp_double_int (pretty_printer
*pp
, double_int d
, bool uns
)
3811 pp_wide_integer (pp
, d
.low
);
3812 else if (d
.fits_uhwi ())
3813 pp_unsigned_wide_integer (pp
, d
.low
);
3816 unsigned HOST_WIDE_INT low
= d
.low
;
3817 HOST_WIDE_INT high
= d
.high
;
3818 if (!uns
&& d
.is_negative ())
3821 high
= ~high
+ !low
;
3824 /* Would "%x%0*x" or "%x%*0x" get zero-padding on all
3826 sprintf (pp_buffer (pp
)->digit_buffer
,
3827 HOST_WIDE_INT_PRINT_DOUBLE_HEX
,
3828 (unsigned HOST_WIDE_INT
) high
, low
);
3829 pp_string (pp
, pp_buffer (pp
)->digit_buffer
);