1 /* Pretty formatting of GENERIC trees in C syntax.
2 Copyright (C) 2001-2016 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"
29 #include "tree-pretty-print.h"
30 #include "stor-layout.h"
31 #include "langhooks.h"
32 #include "tree-iterator.h"
34 #include "internal-fn.h"
35 #include "gomp-constants.h"
37 /* Local functions, macros and variables. */
38 static const char *op_symbol (const_tree
);
39 static void pretty_print_string (pretty_printer
*, const char*);
40 static void newline_and_indent (pretty_printer
*, int);
41 static void maybe_init_pretty_print (FILE *);
42 static void print_struct_decl (pretty_printer
*, const_tree
, int, int);
43 static void do_niy (pretty_printer
*, const_tree
, int);
45 #define INDENT(SPACE) do { \
46 int i; for (i = 0; i<SPACE; i++) pp_space (pp); } while (0)
48 #define NIY do_niy (pp, node, flags)
50 static pretty_printer
*tree_pp
;
52 /* Try to print something for an unknown tree code. */
55 do_niy (pretty_printer
*pp
, const_tree node
, int flags
)
59 pp_string (pp
, "<<< Unknown tree: ");
60 pp_string (pp
, get_tree_code_name (TREE_CODE (node
)));
64 len
= TREE_OPERAND_LENGTH (node
);
65 for (i
= 0; i
< len
; ++i
)
67 newline_and_indent (pp
, 2);
68 dump_generic_node (pp
, TREE_OPERAND (node
, i
), 2, flags
, false);
72 pp_string (pp
, " >>>");
75 /* Debugging function to print out a generic expression. */
78 debug_generic_expr (tree t
)
80 print_generic_expr (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
);
81 fprintf (stderr
, "\n");
84 /* Debugging function to print out a generic statement. */
87 debug_generic_stmt (tree t
)
89 print_generic_stmt (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
);
90 fprintf (stderr
, "\n");
93 /* Debugging function to print out a chain of trees . */
96 debug_tree_chain (tree t
)
102 print_generic_expr (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
|TDF_UID
);
103 fprintf (stderr
, " ");
107 fprintf (stderr
, "... [cycled back to ");
108 print_generic_expr (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
|TDF_UID
);
109 fprintf (stderr
, "]");
113 fprintf (stderr
, "\n");
116 /* Prints declaration DECL to the FILE with details specified by FLAGS. */
118 print_generic_decl (FILE *file
, tree decl
, int flags
)
120 maybe_init_pretty_print (file
);
121 print_declaration (tree_pp
, decl
, 2, flags
);
122 pp_write_text_to_stream (tree_pp
);
125 /* Print tree T, and its successors, on file FILE. FLAGS specifies details
126 to show in the dump. See TDF_* in dumpfile.h. */
129 print_generic_stmt (FILE *file
, tree t
, int flags
)
131 maybe_init_pretty_print (file
);
132 dump_generic_node (tree_pp
, t
, 0, flags
, true);
133 pp_newline_and_flush (tree_pp
);
136 /* Print tree T, and its successors, on file FILE. FLAGS specifies details
137 to show in the dump. See TDF_* in dumpfile.h. The output is indented by
141 print_generic_stmt_indented (FILE *file
, tree t
, int flags
, int indent
)
145 maybe_init_pretty_print (file
);
147 for (i
= 0; i
< indent
; i
++)
149 dump_generic_node (tree_pp
, t
, indent
, flags
, true);
150 pp_newline_and_flush (tree_pp
);
153 /* Print a single expression T on file FILE. FLAGS specifies details to show
154 in the dump. See TDF_* in dumpfile.h. */
157 print_generic_expr (FILE *file
, tree t
, int flags
)
159 maybe_init_pretty_print (file
);
160 dump_generic_node (tree_pp
, t
, 0, flags
, false);
164 /* Dump NAME, an IDENTIFIER_POINTER, sanitized so that D<num> sequences
165 in it are replaced with Dxxxx, as long as they are at the start or
166 preceded by $ and at the end or followed by $. See make_fancy_name
170 dump_fancy_name (pretty_printer
*pp
, tree name
)
173 int length
= IDENTIFIER_LENGTH (name
);
174 const char *n
= IDENTIFIER_POINTER (name
);
181 && (n
== IDENTIFIER_POINTER (name
) || n
[-1] == '$'))
184 while (ISDIGIT (n
[l
]))
186 if (n
[l
] == '\0' || n
[l
] == '$')
199 pp_tree_identifier (pp
, name
);
203 char *str
= XNEWVEC (char, length
+ 1);
206 q
= n
= IDENTIFIER_POINTER (name
);
213 && (q
== IDENTIFIER_POINTER (name
) || q
[-1] == '$'))
216 while (ISDIGIT (q
[l
]))
218 if (q
[l
] == '\0' || q
[l
] == '$')
220 memcpy (p
, n
, q
- n
);
221 memcpy (p
+ (q
- n
), "Dxxxx", 5);
231 memcpy (p
, n
, IDENTIFIER_LENGTH (name
) - (n
- IDENTIFIER_POINTER (name
)));
233 if (pp_translate_identifiers (pp
))
235 const char *text
= identifier_to_locale (str
);
236 pp_append_text (pp
, text
, text
+ strlen (text
));
239 pp_append_text (pp
, str
, str
+ length
);
243 /* Dump the name of a _DECL node and its DECL_UID if TDF_UID is set
247 dump_decl_name (pretty_printer
*pp
, tree node
, int flags
)
249 if (DECL_NAME (node
))
251 if ((flags
& TDF_ASMNAME
) && DECL_ASSEMBLER_NAME_SET_P (node
))
252 pp_tree_identifier (pp
, DECL_ASSEMBLER_NAME (node
));
253 /* For DECL_NAMELESS names look for embedded uids in the
254 names and sanitize them for TDF_NOUID. */
255 else if ((flags
& TDF_NOUID
) && DECL_NAMELESS (node
))
256 dump_fancy_name (pp
, DECL_NAME (node
));
258 pp_tree_identifier (pp
, DECL_NAME (node
));
260 if ((flags
& TDF_UID
) || DECL_NAME (node
) == NULL_TREE
)
262 if (TREE_CODE (node
) == LABEL_DECL
&& LABEL_DECL_UID (node
) != -1)
263 pp_printf (pp
, "L.%d", (int) LABEL_DECL_UID (node
));
264 else if (TREE_CODE (node
) == DEBUG_EXPR_DECL
)
266 if (flags
& TDF_NOUID
)
267 pp_string (pp
, "D#xxxx");
269 pp_printf (pp
, "D#%i", DEBUG_TEMP_UID (node
));
273 char c
= TREE_CODE (node
) == CONST_DECL
? 'C' : 'D';
274 if (flags
& TDF_NOUID
)
275 pp_printf (pp
, "%c.xxxx", c
);
277 pp_printf (pp
, "%c.%u", c
, DECL_UID (node
));
280 if ((flags
& TDF_ALIAS
) && DECL_PT_UID (node
) != DECL_UID (node
))
282 if (flags
& TDF_NOUID
)
283 pp_printf (pp
, "ptD.xxxx");
285 pp_printf (pp
, "ptD.%u", DECL_PT_UID (node
));
289 /* Like the above, but used for pretty printing function calls. */
292 dump_function_name (pretty_printer
*pp
, tree node
, int flags
)
294 if (CONVERT_EXPR_P (node
))
295 node
= TREE_OPERAND (node
, 0);
296 if (DECL_NAME (node
) && (flags
& TDF_ASMNAME
) == 0)
297 pp_string (pp
, lang_hooks
.decl_printable_name (node
, 1));
299 dump_decl_name (pp
, node
, flags
);
302 /* Dump a function declaration. NODE is the FUNCTION_TYPE. PP, SPC and
303 FLAGS are as in dump_generic_node. */
306 dump_function_declaration (pretty_printer
*pp
, tree node
,
309 bool wrote_arg
= false;
315 /* Print the argument types. */
316 arg
= TYPE_ARG_TYPES (node
);
317 while (arg
&& arg
!= void_list_node
&& arg
!= error_mark_node
)
325 dump_generic_node (pp
, TREE_VALUE (arg
), spc
, flags
, false);
326 arg
= TREE_CHAIN (arg
);
329 /* Drop the trailing void_type_node if we had any previous argument. */
330 if (arg
== void_list_node
&& !wrote_arg
)
331 pp_string (pp
, "void");
332 /* Properly dump vararg function types. */
333 else if (!arg
&& wrote_arg
)
334 pp_string (pp
, ", ...");
335 /* Avoid printing any arg for unprototyped functions. */
340 /* Dump the domain associated with an array. */
343 dump_array_domain (pretty_printer
*pp
, tree domain
, int spc
, int flags
)
345 pp_left_bracket (pp
);
348 tree min
= TYPE_MIN_VALUE (domain
);
349 tree max
= TYPE_MAX_VALUE (domain
);
352 && integer_zerop (min
)
353 && tree_fits_shwi_p (max
))
354 pp_wide_integer (pp
, tree_to_shwi (max
) + 1);
358 dump_generic_node (pp
, min
, spc
, flags
, false);
361 dump_generic_node (pp
, max
, spc
, flags
, false);
365 pp_string (pp
, "<unknown>");
366 pp_right_bracket (pp
);
370 /* Dump OpenMP clause CLAUSE. PP, CLAUSE, SPC and FLAGS are as in
371 dump_generic_node. */
374 dump_omp_clause (pretty_printer
*pp
, tree clause
, int spc
, int flags
)
378 switch (OMP_CLAUSE_CODE (clause
))
380 case OMP_CLAUSE_PRIVATE
:
383 case OMP_CLAUSE_SHARED
:
386 case OMP_CLAUSE_FIRSTPRIVATE
:
387 name
= "firstprivate";
389 case OMP_CLAUSE_LASTPRIVATE
:
390 name
= "lastprivate";
392 case OMP_CLAUSE_COPYIN
:
395 case OMP_CLAUSE_COPYPRIVATE
:
396 name
= "copyprivate";
398 case OMP_CLAUSE_UNIFORM
:
401 case OMP_CLAUSE_USE_DEVICE_PTR
:
402 name
= "use_device_ptr";
404 case OMP_CLAUSE_IS_DEVICE_PTR
:
405 name
= "is_device_ptr";
407 case OMP_CLAUSE__LOOPTEMP_
:
410 case OMP_CLAUSE_TO_DECLARE
:
413 case OMP_CLAUSE_LINK
:
417 pp_string (pp
, name
);
419 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
424 case OMP_CLAUSE_REDUCTION
:
425 pp_string (pp
, "reduction(");
426 if (OMP_CLAUSE_REDUCTION_CODE (clause
) != ERROR_MARK
)
429 op_symbol_code (OMP_CLAUSE_REDUCTION_CODE (clause
)));
432 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
438 pp_string (pp
, "if(");
439 switch (OMP_CLAUSE_IF_MODIFIER (clause
))
441 case ERROR_MARK
: break;
442 case OMP_PARALLEL
: pp_string (pp
, "parallel:"); break;
443 case OMP_TASK
: pp_string (pp
, "task:"); break;
444 case OMP_TASKLOOP
: pp_string (pp
, "taskloop:"); break;
445 case OMP_TARGET_DATA
: pp_string (pp
, "target data:"); break;
446 case OMP_TARGET
: pp_string (pp
, "target:"); break;
447 case OMP_TARGET_UPDATE
: pp_string (pp
, "target update:"); break;
448 case OMP_TARGET_ENTER_DATA
:
449 pp_string (pp
, "target enter data:"); break;
450 case OMP_TARGET_EXIT_DATA
: pp_string (pp
, "target exit data:"); break;
451 default: gcc_unreachable ();
453 dump_generic_node (pp
, OMP_CLAUSE_IF_EXPR (clause
),
458 case OMP_CLAUSE_NUM_THREADS
:
459 pp_string (pp
, "num_threads(");
460 dump_generic_node (pp
, OMP_CLAUSE_NUM_THREADS_EXPR (clause
),
465 case OMP_CLAUSE__CILK_FOR_COUNT_
:
466 pp_string (pp
, "_Cilk_for_count_(");
467 dump_generic_node (pp
, OMP_CLAUSE_OPERAND (clause
, 0),
472 case OMP_CLAUSE_NOWAIT
:
473 pp_string (pp
, "nowait");
475 case OMP_CLAUSE_ORDERED
:
476 pp_string (pp
, "ordered");
477 if (OMP_CLAUSE_ORDERED_EXPR (clause
))
480 dump_generic_node (pp
, OMP_CLAUSE_ORDERED_EXPR (clause
),
486 case OMP_CLAUSE_DEFAULT
:
487 pp_string (pp
, "default(");
488 switch (OMP_CLAUSE_DEFAULT_KIND (clause
))
490 case OMP_CLAUSE_DEFAULT_UNSPECIFIED
:
492 case OMP_CLAUSE_DEFAULT_SHARED
:
493 pp_string (pp
, "shared");
495 case OMP_CLAUSE_DEFAULT_NONE
:
496 pp_string (pp
, "none");
498 case OMP_CLAUSE_DEFAULT_PRIVATE
:
499 pp_string (pp
, "private");
501 case OMP_CLAUSE_DEFAULT_FIRSTPRIVATE
:
502 pp_string (pp
, "firstprivate");
510 case OMP_CLAUSE_SCHEDULE
:
511 pp_string (pp
, "schedule(");
512 if (OMP_CLAUSE_SCHEDULE_KIND (clause
)
513 & (OMP_CLAUSE_SCHEDULE_MONOTONIC
514 | OMP_CLAUSE_SCHEDULE_NONMONOTONIC
))
516 if (OMP_CLAUSE_SCHEDULE_KIND (clause
)
517 & OMP_CLAUSE_SCHEDULE_MONOTONIC
)
518 pp_string (pp
, "monotonic");
520 pp_string (pp
, "nonmonotonic");
521 if (OMP_CLAUSE_SCHEDULE_SIMD (clause
))
526 if (OMP_CLAUSE_SCHEDULE_SIMD (clause
))
527 pp_string (pp
, "simd:");
529 switch (OMP_CLAUSE_SCHEDULE_KIND (clause
) & OMP_CLAUSE_SCHEDULE_MASK
)
531 case OMP_CLAUSE_SCHEDULE_STATIC
:
532 pp_string (pp
, "static");
534 case OMP_CLAUSE_SCHEDULE_DYNAMIC
:
535 pp_string (pp
, "dynamic");
537 case OMP_CLAUSE_SCHEDULE_GUIDED
:
538 pp_string (pp
, "guided");
540 case OMP_CLAUSE_SCHEDULE_RUNTIME
:
541 pp_string (pp
, "runtime");
543 case OMP_CLAUSE_SCHEDULE_AUTO
:
544 pp_string (pp
, "auto");
546 case OMP_CLAUSE_SCHEDULE_CILKFOR
:
547 pp_string (pp
, "cilk-for grain");
552 if (OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (clause
))
555 dump_generic_node (pp
, OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (clause
),
561 case OMP_CLAUSE_UNTIED
:
562 pp_string (pp
, "untied");
565 case OMP_CLAUSE_COLLAPSE
:
566 pp_string (pp
, "collapse(");
567 dump_generic_node (pp
, OMP_CLAUSE_COLLAPSE_EXPR (clause
),
572 case OMP_CLAUSE_FINAL
:
573 pp_string (pp
, "final(");
574 dump_generic_node (pp
, OMP_CLAUSE_FINAL_EXPR (clause
),
579 case OMP_CLAUSE_MERGEABLE
:
580 pp_string (pp
, "mergeable");
583 case OMP_CLAUSE_LINEAR
:
584 pp_string (pp
, "linear(");
585 switch (OMP_CLAUSE_LINEAR_KIND (clause
))
587 case OMP_CLAUSE_LINEAR_DEFAULT
:
589 case OMP_CLAUSE_LINEAR_REF
:
590 pp_string (pp
, "ref(");
592 case OMP_CLAUSE_LINEAR_VAL
:
593 pp_string (pp
, "val(");
595 case OMP_CLAUSE_LINEAR_UVAL
:
596 pp_string (pp
, "uval(");
601 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
603 if (OMP_CLAUSE_LINEAR_KIND (clause
) != OMP_CLAUSE_LINEAR_DEFAULT
)
606 dump_generic_node (pp
, OMP_CLAUSE_LINEAR_STEP (clause
),
611 case OMP_CLAUSE_ALIGNED
:
612 pp_string (pp
, "aligned(");
613 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
615 if (OMP_CLAUSE_ALIGNED_ALIGNMENT (clause
))
618 dump_generic_node (pp
, OMP_CLAUSE_ALIGNED_ALIGNMENT (clause
),
624 case OMP_CLAUSE_DEPEND
:
625 pp_string (pp
, "depend(");
626 switch (OMP_CLAUSE_DEPEND_KIND (clause
))
628 case OMP_CLAUSE_DEPEND_IN
:
629 pp_string (pp
, "in");
631 case OMP_CLAUSE_DEPEND_OUT
:
632 pp_string (pp
, "out");
634 case OMP_CLAUSE_DEPEND_INOUT
:
635 pp_string (pp
, "inout");
637 case OMP_CLAUSE_DEPEND_SOURCE
:
638 pp_string (pp
, "source)");
640 case OMP_CLAUSE_DEPEND_SINK
:
641 pp_string (pp
, "sink:");
642 for (tree t
= OMP_CLAUSE_DECL (clause
); t
; t
= TREE_CHAIN (t
))
643 if (TREE_CODE (t
) == TREE_LIST
)
645 dump_generic_node (pp
, TREE_VALUE (t
), spc
, flags
, false);
646 if (TREE_PURPOSE (t
) != integer_zero_node
)
648 if (OMP_CLAUSE_DEPEND_SINK_NEGATIVE (t
))
652 dump_generic_node (pp
, TREE_PURPOSE (t
), spc
, flags
,
666 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
672 pp_string (pp
, "map(");
673 switch (OMP_CLAUSE_MAP_KIND (clause
))
676 case GOMP_MAP_POINTER
:
677 pp_string (pp
, "alloc");
680 case GOMP_MAP_TO_PSET
:
681 pp_string (pp
, "to");
684 pp_string (pp
, "from");
686 case GOMP_MAP_TOFROM
:
687 pp_string (pp
, "tofrom");
689 case GOMP_MAP_FORCE_ALLOC
:
690 pp_string (pp
, "force_alloc");
692 case GOMP_MAP_FORCE_TO
:
693 pp_string (pp
, "force_to");
695 case GOMP_MAP_FORCE_FROM
:
696 pp_string (pp
, "force_from");
698 case GOMP_MAP_FORCE_TOFROM
:
699 pp_string (pp
, "force_tofrom");
701 case GOMP_MAP_FORCE_PRESENT
:
702 pp_string (pp
, "force_present");
704 case GOMP_MAP_DELETE
:
705 pp_string (pp
, "delete");
707 case GOMP_MAP_FORCE_DEVICEPTR
:
708 pp_string (pp
, "force_deviceptr");
710 case GOMP_MAP_ALWAYS_TO
:
711 pp_string (pp
, "always,to");
713 case GOMP_MAP_ALWAYS_FROM
:
714 pp_string (pp
, "always,from");
716 case GOMP_MAP_ALWAYS_TOFROM
:
717 pp_string (pp
, "always,tofrom");
719 case GOMP_MAP_RELEASE
:
720 pp_string (pp
, "release");
722 case GOMP_MAP_FIRSTPRIVATE_POINTER
:
723 pp_string (pp
, "firstprivate");
725 case GOMP_MAP_FIRSTPRIVATE_REFERENCE
:
726 pp_string (pp
, "firstprivate ref");
728 case GOMP_MAP_STRUCT
:
729 pp_string (pp
, "struct");
731 case GOMP_MAP_ALWAYS_POINTER
:
732 pp_string (pp
, "always_pointer");
734 case GOMP_MAP_DEVICE_RESIDENT
:
735 pp_string (pp
, "device_resident");
738 pp_string (pp
, "link");
744 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
747 if (OMP_CLAUSE_SIZE (clause
))
749 switch (OMP_CLAUSE_CODE (clause
) == OMP_CLAUSE_MAP
750 ? OMP_CLAUSE_MAP_KIND (clause
) : GOMP_MAP_TO
)
752 case GOMP_MAP_POINTER
:
753 case GOMP_MAP_FIRSTPRIVATE_POINTER
:
754 case GOMP_MAP_FIRSTPRIVATE_REFERENCE
:
755 case GOMP_MAP_ALWAYS_POINTER
:
756 pp_string (pp
, " [pointer assign, bias: ");
758 case GOMP_MAP_TO_PSET
:
759 pp_string (pp
, " [pointer set, len: ");
762 pp_string (pp
, " [len: ");
765 dump_generic_node (pp
, OMP_CLAUSE_SIZE (clause
),
767 pp_right_bracket (pp
);
772 case OMP_CLAUSE_FROM
:
773 pp_string (pp
, "from(");
774 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
776 goto print_clause_size
;
779 pp_string (pp
, "to(");
780 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
782 goto print_clause_size
;
784 case OMP_CLAUSE__CACHE_
:
786 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
788 goto print_clause_size
;
790 case OMP_CLAUSE_NUM_TEAMS
:
791 pp_string (pp
, "num_teams(");
792 dump_generic_node (pp
, OMP_CLAUSE_NUM_TEAMS_EXPR (clause
),
797 case OMP_CLAUSE_THREAD_LIMIT
:
798 pp_string (pp
, "thread_limit(");
799 dump_generic_node (pp
, OMP_CLAUSE_THREAD_LIMIT_EXPR (clause
),
804 case OMP_CLAUSE_DEVICE
:
805 pp_string (pp
, "device(");
806 dump_generic_node (pp
, OMP_CLAUSE_DEVICE_ID (clause
),
811 case OMP_CLAUSE_DIST_SCHEDULE
:
812 pp_string (pp
, "dist_schedule(static");
813 if (OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR (clause
))
816 dump_generic_node (pp
,
817 OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR (clause
),
823 case OMP_CLAUSE_PROC_BIND
:
824 pp_string (pp
, "proc_bind(");
825 switch (OMP_CLAUSE_PROC_BIND_KIND (clause
))
827 case OMP_CLAUSE_PROC_BIND_MASTER
:
828 pp_string (pp
, "master");
830 case OMP_CLAUSE_PROC_BIND_CLOSE
:
831 pp_string (pp
, "close");
833 case OMP_CLAUSE_PROC_BIND_SPREAD
:
834 pp_string (pp
, "spread");
842 case OMP_CLAUSE_SAFELEN
:
843 pp_string (pp
, "safelen(");
844 dump_generic_node (pp
, OMP_CLAUSE_SAFELEN_EXPR (clause
),
849 case OMP_CLAUSE_SIMDLEN
:
850 pp_string (pp
, "simdlen(");
851 dump_generic_node (pp
, OMP_CLAUSE_SIMDLEN_EXPR (clause
),
856 case OMP_CLAUSE_PRIORITY
:
857 pp_string (pp
, "priority(");
858 dump_generic_node (pp
, OMP_CLAUSE_PRIORITY_EXPR (clause
),
863 case OMP_CLAUSE_GRAINSIZE
:
864 pp_string (pp
, "grainsize(");
865 dump_generic_node (pp
, OMP_CLAUSE_GRAINSIZE_EXPR (clause
),
870 case OMP_CLAUSE_NUM_TASKS
:
871 pp_string (pp
, "num_tasks(");
872 dump_generic_node (pp
, OMP_CLAUSE_NUM_TASKS_EXPR (clause
),
877 case OMP_CLAUSE_HINT
:
878 pp_string (pp
, "hint(");
879 dump_generic_node (pp
, OMP_CLAUSE_HINT_EXPR (clause
),
884 case OMP_CLAUSE_DEFAULTMAP
:
885 pp_string (pp
, "defaultmap(tofrom:scalar)");
888 case OMP_CLAUSE__SIMDUID_
:
889 pp_string (pp
, "_simduid_(");
890 dump_generic_node (pp
, OMP_CLAUSE__SIMDUID__DECL (clause
),
895 case OMP_CLAUSE_GANG
:
896 pp_string (pp
, "gang");
897 if (OMP_CLAUSE_GANG_EXPR (clause
) != NULL_TREE
)
899 pp_string (pp
, "(num: ");
900 dump_generic_node (pp
, OMP_CLAUSE_GANG_EXPR (clause
),
903 if (OMP_CLAUSE_GANG_STATIC_EXPR (clause
) != NULL_TREE
)
905 if (OMP_CLAUSE_GANG_EXPR (clause
) == NULL_TREE
)
909 pp_string (pp
, "static:");
910 if (OMP_CLAUSE_GANG_STATIC_EXPR (clause
)
911 == integer_minus_one_node
)
912 pp_character (pp
, '*');
914 dump_generic_node (pp
, OMP_CLAUSE_GANG_STATIC_EXPR (clause
),
917 if (OMP_CLAUSE_GANG_EXPR (clause
) != NULL_TREE
918 || OMP_CLAUSE_GANG_STATIC_EXPR (clause
) != NULL_TREE
)
922 case OMP_CLAUSE_ASYNC
:
923 pp_string (pp
, "async");
924 if (OMP_CLAUSE_ASYNC_EXPR (clause
))
926 pp_character(pp
, '(');
927 dump_generic_node (pp
, OMP_CLAUSE_ASYNC_EXPR (clause
),
929 pp_character(pp
, ')');
933 case OMP_CLAUSE_AUTO
:
935 pp_string (pp
, omp_clause_code_name
[OMP_CLAUSE_CODE (clause
)]);
938 case OMP_CLAUSE_WAIT
:
939 pp_string (pp
, "wait(");
940 dump_generic_node (pp
, OMP_CLAUSE_WAIT_EXPR (clause
),
942 pp_character(pp
, ')');
945 case OMP_CLAUSE_WORKER
:
946 pp_string (pp
, "worker");
947 if (OMP_CLAUSE_WORKER_EXPR (clause
) != NULL_TREE
)
950 dump_generic_node (pp
, OMP_CLAUSE_WORKER_EXPR (clause
),
956 case OMP_CLAUSE_VECTOR
:
957 pp_string (pp
, "vector");
958 if (OMP_CLAUSE_VECTOR_EXPR (clause
) != NULL_TREE
)
961 dump_generic_node (pp
, OMP_CLAUSE_VECTOR_EXPR (clause
),
967 case OMP_CLAUSE_NUM_GANGS
:
968 pp_string (pp
, "num_gangs(");
969 dump_generic_node (pp
, OMP_CLAUSE_NUM_GANGS_EXPR (clause
),
971 pp_character (pp
, ')');
974 case OMP_CLAUSE_NUM_WORKERS
:
975 pp_string (pp
, "num_workers(");
976 dump_generic_node (pp
, OMP_CLAUSE_NUM_WORKERS_EXPR (clause
),
978 pp_character (pp
, ')');
981 case OMP_CLAUSE_VECTOR_LENGTH
:
982 pp_string (pp
, "vector_length(");
983 dump_generic_node (pp
, OMP_CLAUSE_VECTOR_LENGTH_EXPR (clause
),
985 pp_character (pp
, ')');
988 case OMP_CLAUSE_INBRANCH
:
989 pp_string (pp
, "inbranch");
991 case OMP_CLAUSE_NOTINBRANCH
:
992 pp_string (pp
, "notinbranch");
995 pp_string (pp
, "for");
997 case OMP_CLAUSE_PARALLEL
:
998 pp_string (pp
, "parallel");
1000 case OMP_CLAUSE_SECTIONS
:
1001 pp_string (pp
, "sections");
1003 case OMP_CLAUSE_TASKGROUP
:
1004 pp_string (pp
, "taskgroup");
1006 case OMP_CLAUSE_NOGROUP
:
1007 pp_string (pp
, "nogroup");
1009 case OMP_CLAUSE_THREADS
:
1010 pp_string (pp
, "threads");
1012 case OMP_CLAUSE_SIMD
:
1013 pp_string (pp
, "simd");
1015 case OMP_CLAUSE_INDEPENDENT
:
1016 pp_string (pp
, "independent");
1018 case OMP_CLAUSE_TILE
:
1019 pp_string (pp
, "tile(");
1020 dump_generic_node (pp
, OMP_CLAUSE_TILE_LIST (clause
),
1022 pp_right_paren (pp
);
1025 case OMP_CLAUSE__GRIDDIM_
:
1026 pp_string (pp
, "_griddim_(");
1027 pp_unsigned_wide_integer (pp
, OMP_CLAUSE__GRIDDIM__DIMENSION (clause
));
1029 dump_generic_node (pp
, OMP_CLAUSE__GRIDDIM__SIZE (clause
), spc
, flags
,
1032 dump_generic_node (pp
, OMP_CLAUSE__GRIDDIM__GROUP (clause
), spc
, flags
,
1034 pp_right_paren (pp
);
1038 /* Should never happen. */
1039 dump_generic_node (pp
, clause
, spc
, flags
, false);
1045 /* Dump the list of OpenMP clauses. PP, SPC and FLAGS are as in
1046 dump_generic_node. */
1049 dump_omp_clauses (pretty_printer
*pp
, tree clause
, int spc
, int flags
)
1057 dump_omp_clause (pp
, clause
, spc
, flags
);
1058 clause
= OMP_CLAUSE_CHAIN (clause
);
1066 /* Dump location LOC to PP. */
1069 dump_location (pretty_printer
*pp
, location_t loc
)
1071 expanded_location xloc
= expand_location (loc
);
1073 pp_left_bracket (pp
);
1076 pp_string (pp
, xloc
.file
);
1077 pp_string (pp
, ":");
1079 pp_decimal_int (pp
, xloc
.line
);
1081 pp_decimal_int (pp
, xloc
.column
);
1082 pp_string (pp
, "] ");
1086 /* Dump lexical block BLOCK. PP, SPC and FLAGS are as in
1087 dump_generic_node. */
1090 dump_block_node (pretty_printer
*pp
, tree block
, int spc
, int flags
)
1094 pp_printf (pp
, "BLOCK #%d ", BLOCK_NUMBER (block
));
1096 if (flags
& TDF_ADDRESS
)
1097 pp_printf (pp
, "[%p] ", (void *) block
);
1099 if (BLOCK_ABSTRACT (block
))
1100 pp_string (pp
, "[abstract] ");
1102 if (TREE_ASM_WRITTEN (block
))
1103 pp_string (pp
, "[written] ");
1105 if (flags
& TDF_SLIM
)
1108 if (BLOCK_SOURCE_LOCATION (block
))
1109 dump_location (pp
, BLOCK_SOURCE_LOCATION (block
));
1111 newline_and_indent (pp
, spc
+ 2);
1113 if (BLOCK_SUPERCONTEXT (block
))
1115 pp_string (pp
, "SUPERCONTEXT: ");
1116 dump_generic_node (pp
, BLOCK_SUPERCONTEXT (block
), 0,
1117 flags
| TDF_SLIM
, false);
1118 newline_and_indent (pp
, spc
+ 2);
1121 if (BLOCK_SUBBLOCKS (block
))
1123 pp_string (pp
, "SUBBLOCKS: ");
1124 for (t
= BLOCK_SUBBLOCKS (block
); t
; t
= BLOCK_CHAIN (t
))
1126 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
1129 newline_and_indent (pp
, spc
+ 2);
1132 if (BLOCK_CHAIN (block
))
1134 pp_string (pp
, "SIBLINGS: ");
1135 for (t
= BLOCK_CHAIN (block
); t
; t
= BLOCK_CHAIN (t
))
1137 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
1140 newline_and_indent (pp
, spc
+ 2);
1143 if (BLOCK_VARS (block
))
1145 pp_string (pp
, "VARS: ");
1146 for (t
= BLOCK_VARS (block
); t
; t
= TREE_CHAIN (t
))
1148 dump_generic_node (pp
, t
, 0, flags
, false);
1151 newline_and_indent (pp
, spc
+ 2);
1154 if (vec_safe_length (BLOCK_NONLOCALIZED_VARS (block
)) > 0)
1157 vec
<tree
, va_gc
> *nlv
= BLOCK_NONLOCALIZED_VARS (block
);
1159 pp_string (pp
, "NONLOCALIZED_VARS: ");
1160 FOR_EACH_VEC_ELT (*nlv
, i
, t
)
1162 dump_generic_node (pp
, t
, 0, flags
, false);
1165 newline_and_indent (pp
, spc
+ 2);
1168 if (BLOCK_ABSTRACT_ORIGIN (block
))
1170 pp_string (pp
, "ABSTRACT_ORIGIN: ");
1171 dump_generic_node (pp
, BLOCK_ABSTRACT_ORIGIN (block
), 0,
1172 flags
| TDF_SLIM
, false);
1173 newline_and_indent (pp
, spc
+ 2);
1176 if (BLOCK_FRAGMENT_ORIGIN (block
))
1178 pp_string (pp
, "FRAGMENT_ORIGIN: ");
1179 dump_generic_node (pp
, BLOCK_FRAGMENT_ORIGIN (block
), 0,
1180 flags
| TDF_SLIM
, false);
1181 newline_and_indent (pp
, spc
+ 2);
1184 if (BLOCK_FRAGMENT_CHAIN (block
))
1186 pp_string (pp
, "FRAGMENT_CHAIN: ");
1187 for (t
= BLOCK_FRAGMENT_CHAIN (block
); t
; t
= BLOCK_FRAGMENT_CHAIN (t
))
1189 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
1192 newline_and_indent (pp
, spc
+ 2);
1197 /* Dump the node NODE on the pretty_printer PP, SPC spaces of
1198 indent. FLAGS specifies details to show in the dump (see TDF_* in
1199 dumpfile.h). If IS_STMT is true, the object printed is considered
1200 to be a statement and it is terminated by ';' if appropriate. */
1203 dump_generic_node (pretty_printer
*pp
, tree node
, int spc
, int flags
,
1210 enum tree_code code
;
1212 if (node
== NULL_TREE
)
1215 is_expr
= EXPR_P (node
);
1217 if (is_stmt
&& (flags
& TDF_STMTADDR
))
1218 pp_printf (pp
, "<&%p> ", (void *)node
);
1220 if ((flags
& TDF_LINENO
) && EXPR_HAS_LOCATION (node
))
1221 dump_location (pp
, EXPR_LOCATION (node
));
1223 code
= TREE_CODE (node
);
1227 pp_string (pp
, "<<< error >>>");
1230 case IDENTIFIER_NODE
:
1231 pp_tree_identifier (pp
, node
);
1235 while (node
&& node
!= error_mark_node
)
1237 if (TREE_PURPOSE (node
))
1239 dump_generic_node (pp
, TREE_PURPOSE (node
), spc
, flags
, false);
1242 dump_generic_node (pp
, TREE_VALUE (node
), spc
, flags
, false);
1243 node
= TREE_CHAIN (node
);
1244 if (node
&& TREE_CODE (node
) == TREE_LIST
)
1253 dump_generic_node (pp
, BINFO_TYPE (node
), spc
, flags
, false);
1259 if (TREE_VEC_LENGTH (node
) > 0)
1261 size_t len
= TREE_VEC_LENGTH (node
);
1262 for (i
= 0; i
< len
- 1; i
++)
1264 dump_generic_node (pp
, TREE_VEC_ELT (node
, i
), spc
, flags
,
1269 dump_generic_node (pp
, TREE_VEC_ELT (node
, len
- 1), spc
,
1276 case POINTER_BOUNDS_TYPE
:
1279 case FIXED_POINT_TYPE
:
1285 unsigned int quals
= TYPE_QUALS (node
);
1286 enum tree_code_class tclass
;
1288 if (quals
& TYPE_QUAL_ATOMIC
)
1289 pp_string (pp
, "atomic ");
1290 if (quals
& TYPE_QUAL_CONST
)
1291 pp_string (pp
, "const ");
1292 else if (quals
& TYPE_QUAL_VOLATILE
)
1293 pp_string (pp
, "volatile ");
1294 else if (quals
& TYPE_QUAL_RESTRICT
)
1295 pp_string (pp
, "restrict ");
1297 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
1299 pp_string (pp
, "<address-space-");
1300 pp_decimal_int (pp
, TYPE_ADDR_SPACE (node
));
1301 pp_string (pp
, "> ");
1304 tclass
= TREE_CODE_CLASS (TREE_CODE (node
));
1306 if (tclass
== tcc_declaration
)
1308 if (DECL_NAME (node
))
1309 dump_decl_name (pp
, node
, flags
);
1311 pp_string (pp
, "<unnamed type decl>");
1313 else if (tclass
== tcc_type
)
1315 if (TYPE_NAME (node
))
1317 if (TREE_CODE (TYPE_NAME (node
)) == IDENTIFIER_NODE
)
1318 pp_tree_identifier (pp
, TYPE_NAME (node
));
1319 else if (TREE_CODE (TYPE_NAME (node
)) == TYPE_DECL
1320 && DECL_NAME (TYPE_NAME (node
)))
1321 dump_decl_name (pp
, TYPE_NAME (node
), flags
);
1323 pp_string (pp
, "<unnamed type>");
1325 else if (TREE_CODE (node
) == VECTOR_TYPE
)
1327 pp_string (pp
, "vector");
1329 pp_wide_integer (pp
, TYPE_VECTOR_SUBPARTS (node
));
1330 pp_string (pp
, ") ");
1331 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1333 else if (TREE_CODE (node
) == INTEGER_TYPE
)
1335 if (TYPE_PRECISION (node
) == CHAR_TYPE_SIZE
)
1336 pp_string (pp
, (TYPE_UNSIGNED (node
)
1339 else if (TYPE_PRECISION (node
) == SHORT_TYPE_SIZE
)
1340 pp_string (pp
, (TYPE_UNSIGNED (node
)
1343 else if (TYPE_PRECISION (node
) == INT_TYPE_SIZE
)
1344 pp_string (pp
, (TYPE_UNSIGNED (node
)
1347 else if (TYPE_PRECISION (node
) == LONG_TYPE_SIZE
)
1348 pp_string (pp
, (TYPE_UNSIGNED (node
)
1351 else if (TYPE_PRECISION (node
) == LONG_LONG_TYPE_SIZE
)
1352 pp_string (pp
, (TYPE_UNSIGNED (node
)
1353 ? "unsigned long long"
1354 : "signed long long"));
1355 else if (TYPE_PRECISION (node
) >= CHAR_TYPE_SIZE
1356 && exact_log2 (TYPE_PRECISION (node
)) != -1)
1358 pp_string (pp
, (TYPE_UNSIGNED (node
) ? "uint" : "int"));
1359 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1360 pp_string (pp
, "_t");
1364 pp_string (pp
, (TYPE_UNSIGNED (node
)
1365 ? "<unnamed-unsigned:"
1366 : "<unnamed-signed:"));
1367 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1371 else if (TREE_CODE (node
) == COMPLEX_TYPE
)
1373 pp_string (pp
, "__complex__ ");
1374 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1376 else if (TREE_CODE (node
) == REAL_TYPE
)
1378 pp_string (pp
, "<float:");
1379 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1382 else if (TREE_CODE (node
) == FIXED_POINT_TYPE
)
1384 pp_string (pp
, "<fixed-point-");
1385 pp_string (pp
, TYPE_SATURATING (node
) ? "sat:" : "nonsat:");
1386 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1389 else if (TREE_CODE (node
) == VOID_TYPE
)
1390 pp_string (pp
, "void");
1392 pp_string (pp
, "<unnamed type>");
1398 case REFERENCE_TYPE
:
1399 str
= (TREE_CODE (node
) == POINTER_TYPE
? "*" : "&");
1401 if (TREE_TYPE (node
) == NULL
)
1403 pp_string (pp
, str
);
1404 pp_string (pp
, "<null type>");
1406 else if (TREE_CODE (TREE_TYPE (node
)) == FUNCTION_TYPE
)
1408 tree fnode
= TREE_TYPE (node
);
1410 dump_generic_node (pp
, TREE_TYPE (fnode
), spc
, flags
, false);
1413 pp_string (pp
, str
);
1414 if (TYPE_NAME (node
) && DECL_NAME (TYPE_NAME (node
)))
1415 dump_decl_name (pp
, TYPE_NAME (node
), flags
);
1416 else if (flags
& TDF_NOUID
)
1417 pp_printf (pp
, "<Txxxx>");
1419 pp_printf (pp
, "<T%x>", TYPE_UID (node
));
1421 pp_right_paren (pp
);
1422 dump_function_declaration (pp
, fnode
, spc
, flags
);
1426 unsigned int quals
= TYPE_QUALS (node
);
1428 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1430 pp_string (pp
, str
);
1432 if (quals
& TYPE_QUAL_CONST
)
1433 pp_string (pp
, " const");
1434 if (quals
& TYPE_QUAL_VOLATILE
)
1435 pp_string (pp
, " volatile");
1436 if (quals
& TYPE_QUAL_RESTRICT
)
1437 pp_string (pp
, " restrict");
1439 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
1441 pp_string (pp
, " <address-space-");
1442 pp_decimal_int (pp
, TYPE_ADDR_SPACE (node
));
1446 if (TYPE_REF_CAN_ALIAS_ALL (node
))
1447 pp_string (pp
, " {ref-all}");
1457 if (integer_zerop (TREE_OPERAND (node
, 1))
1458 /* Dump the types of INTEGER_CSTs explicitly, for we can't
1459 infer them and MEM_ATTR caching will share MEM_REFs
1460 with differently-typed op0s. */
1461 && TREE_CODE (TREE_OPERAND (node
, 0)) != INTEGER_CST
1462 /* Released SSA_NAMES have no TREE_TYPE. */
1463 && TREE_TYPE (TREE_OPERAND (node
, 0)) != NULL_TREE
1464 /* Same pointer types, but ignoring POINTER_TYPE vs.
1466 && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 0)))
1467 == TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 1))))
1468 && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (node
, 0)))
1469 == TYPE_MODE (TREE_TYPE (TREE_OPERAND (node
, 1))))
1470 && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node
, 0)))
1471 == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node
, 1))))
1472 /* Same value types ignoring qualifiers. */
1473 && (TYPE_MAIN_VARIANT (TREE_TYPE (node
))
1474 == TYPE_MAIN_VARIANT
1475 (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 1)))))
1476 && (!(flags
& TDF_ALIAS
)
1477 || MR_DEPENDENCE_CLIQUE (node
) == 0))
1479 if (TREE_CODE (TREE_OPERAND (node
, 0)) != ADDR_EXPR
)
1482 dump_generic_node (pp
, TREE_OPERAND (node
, 0),
1486 dump_generic_node (pp
,
1487 TREE_OPERAND (TREE_OPERAND (node
, 0), 0),
1494 pp_string (pp
, "MEM[");
1496 ptype
= TYPE_MAIN_VARIANT (TREE_TYPE (TREE_OPERAND (node
, 1)));
1497 dump_generic_node (pp
, ptype
,
1498 spc
, flags
| TDF_SLIM
, false);
1499 pp_right_paren (pp
);
1500 dump_generic_node (pp
, TREE_OPERAND (node
, 0),
1502 if (!integer_zerop (TREE_OPERAND (node
, 1)))
1504 pp_string (pp
, " + ");
1505 dump_generic_node (pp
, TREE_OPERAND (node
, 1),
1508 if ((flags
& TDF_ALIAS
)
1509 && MR_DEPENDENCE_CLIQUE (node
) != 0)
1511 pp_string (pp
, " clique ");
1512 pp_unsigned_wide_integer (pp
, MR_DEPENDENCE_CLIQUE (node
));
1513 pp_string (pp
, " base ");
1514 pp_unsigned_wide_integer (pp
, MR_DEPENDENCE_BASE (node
));
1516 pp_right_bracket (pp
);
1521 case TARGET_MEM_REF
:
1523 const char *sep
= "";
1526 pp_string (pp
, "MEM[");
1528 if (TREE_CODE (TMR_BASE (node
)) == ADDR_EXPR
)
1530 pp_string (pp
, sep
);
1532 pp_string (pp
, "symbol: ");
1533 dump_generic_node (pp
, TREE_OPERAND (TMR_BASE (node
), 0),
1538 pp_string (pp
, sep
);
1540 pp_string (pp
, "base: ");
1541 dump_generic_node (pp
, TMR_BASE (node
), spc
, flags
, false);
1543 tmp
= TMR_INDEX2 (node
);
1546 pp_string (pp
, sep
);
1548 pp_string (pp
, "base: ");
1549 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1551 tmp
= TMR_INDEX (node
);
1554 pp_string (pp
, sep
);
1556 pp_string (pp
, "index: ");
1557 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1559 tmp
= TMR_STEP (node
);
1562 pp_string (pp
, sep
);
1564 pp_string (pp
, "step: ");
1565 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1567 tmp
= TMR_OFFSET (node
);
1570 pp_string (pp
, sep
);
1572 pp_string (pp
, "offset: ");
1573 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1575 pp_right_bracket (pp
);
1583 /* Print the innermost component type. */
1584 for (tmp
= TREE_TYPE (node
); TREE_CODE (tmp
) == ARRAY_TYPE
;
1585 tmp
= TREE_TYPE (tmp
))
1587 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1589 /* Print the dimensions. */
1590 for (tmp
= node
; TREE_CODE (tmp
) == ARRAY_TYPE
; tmp
= TREE_TYPE (tmp
))
1591 dump_array_domain (pp
, TYPE_DOMAIN (tmp
), spc
, flags
);
1597 case QUAL_UNION_TYPE
:
1599 unsigned int quals
= TYPE_QUALS (node
);
1601 if (quals
& TYPE_QUAL_ATOMIC
)
1602 pp_string (pp
, "atomic ");
1603 if (quals
& TYPE_QUAL_CONST
)
1604 pp_string (pp
, "const ");
1605 if (quals
& TYPE_QUAL_VOLATILE
)
1606 pp_string (pp
, "volatile ");
1608 /* Print the name of the structure. */
1609 if (TREE_CODE (node
) == RECORD_TYPE
)
1610 pp_string (pp
, "struct ");
1611 else if (TREE_CODE (node
) == UNION_TYPE
)
1612 pp_string (pp
, "union ");
1614 if (TYPE_NAME (node
))
1615 dump_generic_node (pp
, TYPE_NAME (node
), spc
, flags
, false);
1616 else if (!(flags
& TDF_SLIM
))
1617 /* FIXME: If we eliminate the 'else' above and attempt
1618 to show the fields for named types, we may get stuck
1619 following a cycle of pointers to structs. The alleged
1620 self-reference check in print_struct_decl will not detect
1621 cycles involving more than one pointer or struct type. */
1622 print_struct_decl (pp
, node
, spc
, flags
);
1631 if (TREE_CODE (TREE_TYPE (node
)) == POINTER_TYPE
)
1633 /* In the case of a pointer, one may want to divide by the
1634 size of the pointed-to type. Unfortunately, this not
1635 straightforward. The C front-end maps expressions
1640 in such a way that the two INTEGER_CST nodes for "5" have
1641 different values but identical types. In the latter
1642 case, the 5 is multiplied by sizeof (int) in c-common.c
1643 (pointer_int_sum) to convert it to a byte address, and
1644 yet the type of the node is left unchanged. Argh. What
1645 is consistent though is that the number value corresponds
1646 to bytes (UNITS) offset.
1648 NB: Neither of the following divisors can be trivially
1649 used to recover the original literal:
1651 TREE_INT_CST_LOW (TYPE_SIZE_UNIT (TREE_TYPE (node)))
1652 TYPE_PRECISION (TREE_TYPE (TREE_TYPE (node))) */
1653 pp_wide_integer (pp
, TREE_INT_CST_LOW (node
));
1654 pp_string (pp
, "B"); /* pseudo-unit */
1656 else if (tree_fits_shwi_p (node
))
1657 pp_wide_integer (pp
, tree_to_shwi (node
));
1658 else if (tree_fits_uhwi_p (node
))
1659 pp_unsigned_wide_integer (pp
, tree_to_uhwi (node
));
1662 wide_int val
= node
;
1664 if (wi::neg_p (val
, TYPE_SIGN (TREE_TYPE (node
))))
1669 print_hex (val
, pp_buffer (pp
)->digit_buffer
);
1670 pp_string (pp
, pp_buffer (pp
)->digit_buffer
);
1672 if (TREE_OVERFLOW (node
))
1673 pp_string (pp
, "(OVF)");
1677 /* Code copied from print_node. */
1680 if (TREE_OVERFLOW (node
))
1681 pp_string (pp
, " overflow");
1683 d
= TREE_REAL_CST (node
);
1684 if (REAL_VALUE_ISINF (d
))
1685 pp_string (pp
, REAL_VALUE_NEGATIVE (d
) ? " -Inf" : " Inf");
1686 else if (REAL_VALUE_ISNAN (d
))
1687 pp_string (pp
, " Nan");
1691 real_to_decimal (string
, &d
, sizeof (string
), 0, 1);
1692 pp_string (pp
, string
);
1700 fixed_to_decimal (string
, TREE_FIXED_CST_PTR (node
), sizeof (string
));
1701 pp_string (pp
, string
);
1706 pp_string (pp
, "__complex__ (");
1707 dump_generic_node (pp
, TREE_REALPART (node
), spc
, flags
, false);
1708 pp_string (pp
, ", ");
1709 dump_generic_node (pp
, TREE_IMAGPART (node
), spc
, flags
, false);
1710 pp_right_paren (pp
);
1714 pp_string (pp
, "\"");
1715 pretty_print_string (pp
, TREE_STRING_POINTER (node
));
1716 pp_string (pp
, "\"");
1722 pp_string (pp
, "{ ");
1723 for (i
= 0; i
< VECTOR_CST_NELTS (node
); ++i
)
1726 pp_string (pp
, ", ");
1727 dump_generic_node (pp
, VECTOR_CST_ELT (node
, i
),
1730 pp_string (pp
, " }");
1736 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1738 if (TREE_CODE (node
) == METHOD_TYPE
)
1740 if (TYPE_METHOD_BASETYPE (node
))
1741 dump_decl_name (pp
, TYPE_NAME (TYPE_METHOD_BASETYPE (node
)),
1744 pp_string (pp
, "<null method basetype>");
1745 pp_colon_colon (pp
);
1747 if (TYPE_NAME (node
) && DECL_NAME (TYPE_NAME (node
)))
1748 dump_decl_name (pp
, TYPE_NAME (node
), flags
);
1749 else if (flags
& TDF_NOUID
)
1750 pp_printf (pp
, "<Txxxx>");
1752 pp_printf (pp
, "<T%x>", TYPE_UID (node
));
1753 dump_function_declaration (pp
, node
, spc
, flags
);
1758 dump_decl_name (pp
, node
, flags
);
1762 if (DECL_NAME (node
))
1763 dump_decl_name (pp
, node
, flags
);
1764 else if (LABEL_DECL_UID (node
) != -1)
1765 pp_printf (pp
, "<L%d>", (int) LABEL_DECL_UID (node
));
1768 if (flags
& TDF_NOUID
)
1769 pp_string (pp
, "<D.xxxx>");
1771 pp_printf (pp
, "<D.%u>", DECL_UID (node
));
1776 if (DECL_IS_BUILTIN (node
))
1778 /* Don't print the declaration of built-in types. */
1781 if (DECL_NAME (node
))
1782 dump_decl_name (pp
, node
, flags
);
1783 else if (TYPE_NAME (TREE_TYPE (node
)) != node
)
1785 if ((TREE_CODE (TREE_TYPE (node
)) == RECORD_TYPE
1786 || TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
)
1787 && TYPE_METHODS (TREE_TYPE (node
)))
1789 /* The type is a c++ class: all structures have at least
1791 pp_string (pp
, "class ");
1792 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1797 (TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
1798 ? "union" : "struct "));
1799 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1803 pp_string (pp
, "<anon>");
1809 case DEBUG_EXPR_DECL
:
1810 case NAMESPACE_DECL
:
1812 dump_decl_name (pp
, node
, flags
);
1816 pp_string (pp
, "<retval>");
1820 op0
= TREE_OPERAND (node
, 0);
1823 && (TREE_CODE (op0
) == INDIRECT_REF
1824 || (TREE_CODE (op0
) == MEM_REF
1825 && TREE_CODE (TREE_OPERAND (op0
, 0)) != ADDR_EXPR
1826 && integer_zerop (TREE_OPERAND (op0
, 1))
1827 /* Dump the types of INTEGER_CSTs explicitly, for we
1828 can't infer them and MEM_ATTR caching will share
1829 MEM_REFs with differently-typed op0s. */
1830 && TREE_CODE (TREE_OPERAND (op0
, 0)) != INTEGER_CST
1831 /* Released SSA_NAMES have no TREE_TYPE. */
1832 && TREE_TYPE (TREE_OPERAND (op0
, 0)) != NULL_TREE
1833 /* Same pointer types, but ignoring POINTER_TYPE vs.
1835 && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 0)))
1836 == TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 1))))
1837 && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0
, 0)))
1838 == TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0
, 1))))
1839 && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0
, 0)))
1840 == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0
, 1))))
1841 /* Same value types ignoring qualifiers. */
1842 && (TYPE_MAIN_VARIANT (TREE_TYPE (op0
))
1843 == TYPE_MAIN_VARIANT
1844 (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 1)))))
1845 && MR_DEPENDENCE_CLIQUE (op0
) == 0)))
1847 op0
= TREE_OPERAND (op0
, 0);
1850 if (op_prio (op0
) < op_prio (node
))
1852 dump_generic_node (pp
, op0
, spc
, flags
, false);
1853 if (op_prio (op0
) < op_prio (node
))
1854 pp_right_paren (pp
);
1855 pp_string (pp
, str
);
1856 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1857 op0
= component_ref_field_offset (node
);
1858 if (op0
&& TREE_CODE (op0
) != INTEGER_CST
)
1860 pp_string (pp
, "{off: ");
1861 dump_generic_node (pp
, op0
, spc
, flags
, false);
1862 pp_right_brace (pp
);
1867 pp_string (pp
, "BIT_FIELD_REF <");
1868 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1869 pp_string (pp
, ", ");
1870 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1871 pp_string (pp
, ", ");
1872 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
1876 case BIT_INSERT_EXPR
:
1877 pp_string (pp
, "BIT_INSERT_EXPR <");
1878 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1879 pp_string (pp
, ", ");
1880 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1881 pp_string (pp
, ", ");
1882 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
1883 pp_string (pp
, " (");
1884 if (INTEGRAL_TYPE_P (TREE_TYPE (TREE_OPERAND (node
, 1))))
1886 TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (node
, 1))));
1888 dump_generic_node (pp
, TYPE_SIZE (TREE_TYPE (TREE_OPERAND (node
, 1))),
1890 pp_string (pp
, " bits)>");
1894 case ARRAY_RANGE_REF
:
1895 op0
= TREE_OPERAND (node
, 0);
1896 if (op_prio (op0
) < op_prio (node
))
1898 dump_generic_node (pp
, op0
, spc
, flags
, false);
1899 if (op_prio (op0
) < op_prio (node
))
1900 pp_right_paren (pp
);
1901 pp_left_bracket (pp
);
1902 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1903 if (TREE_CODE (node
) == ARRAY_RANGE_REF
)
1904 pp_string (pp
, " ...");
1905 pp_right_bracket (pp
);
1907 op0
= array_ref_low_bound (node
);
1908 op1
= array_ref_element_size (node
);
1910 if (!integer_zerop (op0
)
1911 || TREE_OPERAND (node
, 2)
1912 || TREE_OPERAND (node
, 3))
1914 pp_string (pp
, "{lb: ");
1915 dump_generic_node (pp
, op0
, spc
, flags
, false);
1916 pp_string (pp
, " sz: ");
1917 dump_generic_node (pp
, op1
, spc
, flags
, false);
1918 pp_right_brace (pp
);
1924 unsigned HOST_WIDE_INT ix
;
1926 bool is_struct_init
= false;
1927 bool is_array_init
= false;
1930 if (TREE_CLOBBER_P (node
))
1931 pp_string (pp
, "CLOBBER");
1932 else if (TREE_CODE (TREE_TYPE (node
)) == RECORD_TYPE
1933 || TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
)
1934 is_struct_init
= true;
1935 else if (TREE_CODE (TREE_TYPE (node
)) == ARRAY_TYPE
1936 && TYPE_DOMAIN (TREE_TYPE (node
))
1937 && TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
)))
1938 && TREE_CODE (TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
))))
1941 tree minv
= TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
)));
1942 is_array_init
= true;
1943 curidx
= wi::to_widest (minv
);
1945 FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (node
), ix
, field
, val
)
1952 dump_generic_node (pp
, field
, spc
, flags
, false);
1955 else if (is_array_init
1956 && (TREE_CODE (field
) != INTEGER_CST
1957 || curidx
!= wi::to_widest (field
)))
1959 pp_left_bracket (pp
);
1960 if (TREE_CODE (field
) == RANGE_EXPR
)
1962 dump_generic_node (pp
, TREE_OPERAND (field
, 0), spc
,
1964 pp_string (pp
, " ... ");
1965 dump_generic_node (pp
, TREE_OPERAND (field
, 1), spc
,
1967 if (TREE_CODE (TREE_OPERAND (field
, 1)) == INTEGER_CST
)
1968 curidx
= wi::to_widest (TREE_OPERAND (field
, 1));
1971 dump_generic_node (pp
, field
, spc
, flags
, false);
1972 if (TREE_CODE (field
) == INTEGER_CST
)
1973 curidx
= wi::to_widest (field
);
1974 pp_string (pp
, "]=");
1979 if (val
&& TREE_CODE (val
) == ADDR_EXPR
)
1980 if (TREE_CODE (TREE_OPERAND (val
, 0)) == FUNCTION_DECL
)
1981 val
= TREE_OPERAND (val
, 0);
1982 if (val
&& TREE_CODE (val
) == FUNCTION_DECL
)
1983 dump_decl_name (pp
, val
, flags
);
1985 dump_generic_node (pp
, val
, spc
, flags
, false);
1986 if (ix
!= vec_safe_length (CONSTRUCTOR_ELTS (node
)) - 1)
1992 pp_right_brace (pp
);
1999 if (flags
& TDF_SLIM
)
2001 pp_string (pp
, "<COMPOUND_EXPR>");
2005 dump_generic_node (pp
, TREE_OPERAND (node
, 0),
2006 spc
, flags
, !(flags
& TDF_SLIM
));
2007 if (flags
& TDF_SLIM
)
2008 newline_and_indent (pp
, spc
);
2015 for (tp
= &TREE_OPERAND (node
, 1);
2016 TREE_CODE (*tp
) == COMPOUND_EXPR
;
2017 tp
= &TREE_OPERAND (*tp
, 1))
2019 dump_generic_node (pp
, TREE_OPERAND (*tp
, 0),
2020 spc
, flags
, !(flags
& TDF_SLIM
));
2021 if (flags
& TDF_SLIM
)
2022 newline_and_indent (pp
, spc
);
2030 dump_generic_node (pp
, *tp
, spc
, flags
, !(flags
& TDF_SLIM
));
2034 case STATEMENT_LIST
:
2036 tree_stmt_iterator si
;
2039 if (flags
& TDF_SLIM
)
2041 pp_string (pp
, "<STATEMENT_LIST>");
2045 for (si
= tsi_start (node
); !tsi_end_p (si
); tsi_next (&si
))
2048 newline_and_indent (pp
, spc
);
2051 dump_generic_node (pp
, tsi_stmt (si
), spc
, flags
, true);
2058 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
,
2063 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
,
2068 pp_string (pp
, "TARGET_EXPR <");
2069 dump_generic_node (pp
, TARGET_EXPR_SLOT (node
), spc
, flags
, false);
2072 dump_generic_node (pp
, TARGET_EXPR_INITIAL (node
), spc
, flags
, false);
2077 print_declaration (pp
, DECL_EXPR_DECL (node
), spc
, flags
);
2082 if (TREE_TYPE (node
) == NULL
|| TREE_TYPE (node
) == void_type_node
)
2084 pp_string (pp
, "if (");
2085 dump_generic_node (pp
, COND_EXPR_COND (node
), spc
, flags
, false);
2086 pp_right_paren (pp
);
2087 /* The lowered cond_exprs should always be printed in full. */
2088 if (COND_EXPR_THEN (node
)
2089 && (IS_EMPTY_STMT (COND_EXPR_THEN (node
))
2090 || TREE_CODE (COND_EXPR_THEN (node
)) == GOTO_EXPR
)
2091 && COND_EXPR_ELSE (node
)
2092 && (IS_EMPTY_STMT (COND_EXPR_ELSE (node
))
2093 || TREE_CODE (COND_EXPR_ELSE (node
)) == GOTO_EXPR
))
2096 dump_generic_node (pp
, COND_EXPR_THEN (node
),
2098 if (!IS_EMPTY_STMT (COND_EXPR_ELSE (node
)))
2100 pp_string (pp
, " else ");
2101 dump_generic_node (pp
, COND_EXPR_ELSE (node
),
2105 else if (!(flags
& TDF_SLIM
))
2107 /* Output COND_EXPR_THEN. */
2108 if (COND_EXPR_THEN (node
))
2110 newline_and_indent (pp
, spc
+2);
2112 newline_and_indent (pp
, spc
+4);
2113 dump_generic_node (pp
, COND_EXPR_THEN (node
), spc
+4,
2115 newline_and_indent (pp
, spc
+2);
2116 pp_right_brace (pp
);
2119 /* Output COND_EXPR_ELSE. */
2120 if (COND_EXPR_ELSE (node
)
2121 && !IS_EMPTY_STMT (COND_EXPR_ELSE (node
)))
2123 newline_and_indent (pp
, spc
);
2124 pp_string (pp
, "else");
2125 newline_and_indent (pp
, spc
+2);
2127 newline_and_indent (pp
, spc
+4);
2128 dump_generic_node (pp
, COND_EXPR_ELSE (node
), spc
+4,
2130 newline_and_indent (pp
, spc
+2);
2131 pp_right_brace (pp
);
2138 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2142 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2146 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2152 if (!(flags
& TDF_SLIM
))
2154 if (BIND_EXPR_VARS (node
))
2158 for (op0
= BIND_EXPR_VARS (node
); op0
; op0
= DECL_CHAIN (op0
))
2160 print_declaration (pp
, op0
, spc
+2, flags
);
2165 newline_and_indent (pp
, spc
+2);
2166 dump_generic_node (pp
, BIND_EXPR_BODY (node
), spc
+2, flags
, true);
2167 newline_and_indent (pp
, spc
);
2168 pp_right_brace (pp
);
2174 if (CALL_EXPR_FN (node
) != NULL_TREE
)
2175 print_call_name (pp
, CALL_EXPR_FN (node
), flags
);
2177 pp_string (pp
, internal_fn_name (CALL_EXPR_IFN (node
)));
2179 /* Print parameters. */
2184 call_expr_arg_iterator iter
;
2185 FOR_EACH_CALL_EXPR_ARG (arg
, iter
, node
)
2187 dump_generic_node (pp
, arg
, spc
, flags
, false);
2188 if (more_call_expr_args_p (&iter
))
2195 if (CALL_EXPR_VA_ARG_PACK (node
))
2197 if (call_expr_nargs (node
) > 0)
2202 pp_string (pp
, "__builtin_va_arg_pack ()");
2204 pp_right_paren (pp
);
2206 op1
= CALL_EXPR_STATIC_CHAIN (node
);
2209 pp_string (pp
, " [static-chain: ");
2210 dump_generic_node (pp
, op1
, spc
, flags
, false);
2211 pp_right_bracket (pp
);
2214 if (CALL_EXPR_RETURN_SLOT_OPT (node
))
2215 pp_string (pp
, " [return slot optimization]");
2216 if (CALL_EXPR_TAILCALL (node
))
2217 pp_string (pp
, " [tail call]");
2220 case WITH_CLEANUP_EXPR
:
2224 case CLEANUP_POINT_EXPR
:
2225 pp_string (pp
, "<<cleanup_point ");
2226 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2227 pp_string (pp
, ">>");
2230 case PLACEHOLDER_EXPR
:
2231 pp_string (pp
, "<PLACEHOLDER_EXPR ");
2232 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2236 /* Binary arithmetic and logic expressions. */
2237 case WIDEN_SUM_EXPR
:
2238 case WIDEN_MULT_EXPR
:
2240 case MULT_HIGHPART_EXPR
:
2242 case POINTER_PLUS_EXPR
:
2244 case TRUNC_DIV_EXPR
:
2246 case FLOOR_DIV_EXPR
:
2247 case ROUND_DIV_EXPR
:
2248 case TRUNC_MOD_EXPR
:
2250 case FLOOR_MOD_EXPR
:
2251 case ROUND_MOD_EXPR
:
2253 case EXACT_DIV_EXPR
:
2258 case WIDEN_LSHIFT_EXPR
:
2262 case TRUTH_ANDIF_EXPR
:
2263 case TRUTH_ORIF_EXPR
:
2264 case TRUTH_AND_EXPR
:
2266 case TRUTH_XOR_EXPR
:
2280 case UNORDERED_EXPR
:
2282 const char *op
= op_symbol (node
);
2283 op0
= TREE_OPERAND (node
, 0);
2284 op1
= TREE_OPERAND (node
, 1);
2286 /* When the operands are expressions with less priority,
2287 keep semantics of the tree representation. */
2288 if (op_prio (op0
) <= op_prio (node
))
2291 dump_generic_node (pp
, op0
, spc
, flags
, false);
2292 pp_right_paren (pp
);
2295 dump_generic_node (pp
, op0
, spc
, flags
, false);
2301 /* When the operands are expressions with less priority,
2302 keep semantics of the tree representation. */
2303 if (op_prio (op1
) <= op_prio (node
))
2306 dump_generic_node (pp
, op1
, spc
, flags
, false);
2307 pp_right_paren (pp
);
2310 dump_generic_node (pp
, op1
, spc
, flags
, false);
2314 /* Unary arithmetic and logic expressions. */
2317 case TRUTH_NOT_EXPR
:
2319 case PREDECREMENT_EXPR
:
2320 case PREINCREMENT_EXPR
:
2322 if (TREE_CODE (node
) == ADDR_EXPR
2323 && (TREE_CODE (TREE_OPERAND (node
, 0)) == STRING_CST
2324 || TREE_CODE (TREE_OPERAND (node
, 0)) == FUNCTION_DECL
))
2325 ; /* Do not output '&' for strings and function pointers. */
2327 pp_string (pp
, op_symbol (node
));
2329 if (op_prio (TREE_OPERAND (node
, 0)) < op_prio (node
))
2332 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2333 pp_right_paren (pp
);
2336 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2339 case POSTDECREMENT_EXPR
:
2340 case POSTINCREMENT_EXPR
:
2341 if (op_prio (TREE_OPERAND (node
, 0)) < op_prio (node
))
2344 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2345 pp_right_paren (pp
);
2348 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2349 pp_string (pp
, op_symbol (node
));
2353 pp_string (pp
, "MIN_EXPR <");
2354 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2355 pp_string (pp
, ", ");
2356 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2361 pp_string (pp
, "MAX_EXPR <");
2362 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2363 pp_string (pp
, ", ");
2364 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2369 pp_string (pp
, "ABS_EXPR <");
2370 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2378 case ADDR_SPACE_CONVERT_EXPR
:
2379 case FIXED_CONVERT_EXPR
:
2380 case FIX_TRUNC_EXPR
:
2383 type
= TREE_TYPE (node
);
2384 op0
= TREE_OPERAND (node
, 0);
2385 if (type
!= TREE_TYPE (op0
))
2388 dump_generic_node (pp
, type
, spc
, flags
, false);
2389 pp_string (pp
, ") ");
2391 if (op_prio (op0
) < op_prio (node
))
2393 dump_generic_node (pp
, op0
, spc
, flags
, false);
2394 if (op_prio (op0
) < op_prio (node
))
2395 pp_right_paren (pp
);
2398 case VIEW_CONVERT_EXPR
:
2399 pp_string (pp
, "VIEW_CONVERT_EXPR<");
2400 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2401 pp_string (pp
, ">(");
2402 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2403 pp_right_paren (pp
);
2407 pp_string (pp
, "((");
2408 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2409 pp_string (pp
, "))");
2412 case NON_LVALUE_EXPR
:
2413 pp_string (pp
, "NON_LVALUE_EXPR <");
2414 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2419 pp_string (pp
, "SAVE_EXPR <");
2420 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2425 pp_string (pp
, "COMPLEX_EXPR <");
2426 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2427 pp_string (pp
, ", ");
2428 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2433 pp_string (pp
, "CONJ_EXPR <");
2434 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2439 pp_string (pp
, "REALPART_EXPR <");
2440 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2445 pp_string (pp
, "IMAGPART_EXPR <");
2446 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2451 pp_string (pp
, "VA_ARG_EXPR <");
2452 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2456 case TRY_FINALLY_EXPR
:
2457 case TRY_CATCH_EXPR
:
2458 pp_string (pp
, "try");
2459 newline_and_indent (pp
, spc
+2);
2461 newline_and_indent (pp
, spc
+4);
2462 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
+4, flags
, true);
2463 newline_and_indent (pp
, spc
+2);
2464 pp_right_brace (pp
);
2465 newline_and_indent (pp
, spc
);
2467 (TREE_CODE (node
) == TRY_CATCH_EXPR
) ? "catch" : "finally");
2468 newline_and_indent (pp
, spc
+2);
2470 newline_and_indent (pp
, spc
+4);
2471 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
+4, flags
, true);
2472 newline_and_indent (pp
, spc
+2);
2473 pp_right_brace (pp
);
2478 pp_string (pp
, "catch (");
2479 dump_generic_node (pp
, CATCH_TYPES (node
), spc
+2, flags
, false);
2480 pp_right_paren (pp
);
2481 newline_and_indent (pp
, spc
+2);
2483 newline_and_indent (pp
, spc
+4);
2484 dump_generic_node (pp
, CATCH_BODY (node
), spc
+4, flags
, true);
2485 newline_and_indent (pp
, spc
+2);
2486 pp_right_brace (pp
);
2490 case EH_FILTER_EXPR
:
2491 pp_string (pp
, "<<<eh_filter (");
2492 dump_generic_node (pp
, EH_FILTER_TYPES (node
), spc
+2, flags
, false);
2493 pp_string (pp
, ")>>>");
2494 newline_and_indent (pp
, spc
+2);
2496 newline_and_indent (pp
, spc
+4);
2497 dump_generic_node (pp
, EH_FILTER_FAILURE (node
), spc
+4, flags
, true);
2498 newline_and_indent (pp
, spc
+2);
2499 pp_right_brace (pp
);
2504 op0
= TREE_OPERAND (node
, 0);
2505 /* If this is for break or continue, don't bother printing it. */
2506 if (DECL_NAME (op0
))
2508 const char *name
= IDENTIFIER_POINTER (DECL_NAME (op0
));
2509 if (strcmp (name
, "break") == 0
2510 || strcmp (name
, "continue") == 0)
2513 dump_generic_node (pp
, op0
, spc
, flags
, false);
2515 if (DECL_NONLOCAL (op0
))
2516 pp_string (pp
, " [non-local]");
2520 pp_string (pp
, "while (1)");
2521 if (!(flags
& TDF_SLIM
))
2523 newline_and_indent (pp
, spc
+2);
2525 newline_and_indent (pp
, spc
+4);
2526 dump_generic_node (pp
, LOOP_EXPR_BODY (node
), spc
+4, flags
, true);
2527 newline_and_indent (pp
, spc
+2);
2528 pp_right_brace (pp
);
2534 pp_string (pp
, "// predicted ");
2535 if (PREDICT_EXPR_OUTCOME (node
))
2536 pp_string (pp
, "likely by ");
2538 pp_string (pp
, "unlikely by ");
2539 pp_string (pp
, predictor_name (PREDICT_EXPR_PREDICTOR (node
)));
2540 pp_string (pp
, " predictor.");
2544 pp_string (pp
, "ANNOTATE_EXPR <");
2545 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2546 switch ((enum annot_expr_kind
) TREE_INT_CST_LOW (TREE_OPERAND (node
, 1)))
2548 case annot_expr_ivdep_kind
:
2549 pp_string (pp
, ", ivdep");
2551 case annot_expr_no_vector_kind
:
2552 pp_string (pp
, ", no-vector");
2554 case annot_expr_vector_kind
:
2555 pp_string (pp
, ", vector");
2564 pp_string (pp
, "return");
2565 op0
= TREE_OPERAND (node
, 0);
2569 if (TREE_CODE (op0
) == MODIFY_EXPR
)
2570 dump_generic_node (pp
, TREE_OPERAND (op0
, 1),
2573 dump_generic_node (pp
, op0
, spc
, flags
, false);
2578 pp_string (pp
, "if (");
2579 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2580 pp_string (pp
, ") break");
2584 pp_string (pp
, "switch (");
2585 dump_generic_node (pp
, SWITCH_COND (node
), spc
, flags
, false);
2586 pp_right_paren (pp
);
2587 if (!(flags
& TDF_SLIM
))
2589 newline_and_indent (pp
, spc
+2);
2591 if (SWITCH_BODY (node
))
2593 newline_and_indent (pp
, spc
+4);
2594 dump_generic_node (pp
, SWITCH_BODY (node
), spc
+4, flags
,
2599 tree vec
= SWITCH_LABELS (node
);
2600 size_t i
, n
= TREE_VEC_LENGTH (vec
);
2601 for (i
= 0; i
< n
; ++i
)
2603 tree elt
= TREE_VEC_ELT (vec
, i
);
2604 newline_and_indent (pp
, spc
+4);
2607 dump_generic_node (pp
, elt
, spc
+4, flags
, false);
2608 pp_string (pp
, " goto ");
2609 dump_generic_node (pp
, CASE_LABEL (elt
), spc
+4,
2614 pp_string (pp
, "case ???: goto ???;");
2617 newline_and_indent (pp
, spc
+2);
2618 pp_right_brace (pp
);
2624 op0
= GOTO_DESTINATION (node
);
2625 if (TREE_CODE (op0
) != SSA_NAME
&& DECL_P (op0
) && DECL_NAME (op0
))
2627 const char *name
= IDENTIFIER_POINTER (DECL_NAME (op0
));
2628 if (strcmp (name
, "break") == 0
2629 || strcmp (name
, "continue") == 0)
2631 pp_string (pp
, name
);
2635 pp_string (pp
, "goto ");
2636 dump_generic_node (pp
, op0
, spc
, flags
, false);
2640 pp_string (pp
, "__asm__");
2641 if (ASM_VOLATILE_P (node
))
2642 pp_string (pp
, " __volatile__");
2644 dump_generic_node (pp
, ASM_STRING (node
), spc
, flags
, false);
2646 dump_generic_node (pp
, ASM_OUTPUTS (node
), spc
, flags
, false);
2648 dump_generic_node (pp
, ASM_INPUTS (node
), spc
, flags
, false);
2649 if (ASM_CLOBBERS (node
))
2652 dump_generic_node (pp
, ASM_CLOBBERS (node
), spc
, flags
, false);
2654 pp_right_paren (pp
);
2657 case CASE_LABEL_EXPR
:
2658 if (CASE_LOW (node
) && CASE_HIGH (node
))
2660 pp_string (pp
, "case ");
2661 dump_generic_node (pp
, CASE_LOW (node
), spc
, flags
, false);
2662 pp_string (pp
, " ... ");
2663 dump_generic_node (pp
, CASE_HIGH (node
), spc
, flags
, false);
2665 else if (CASE_LOW (node
))
2667 pp_string (pp
, "case ");
2668 dump_generic_node (pp
, CASE_LOW (node
), spc
, flags
, false);
2671 pp_string (pp
, "default");
2676 pp_string (pp
, "OBJ_TYPE_REF(");
2677 dump_generic_node (pp
, OBJ_TYPE_REF_EXPR (node
), spc
, flags
, false);
2679 if (!(flags
& TDF_SLIM
) && virtual_method_call_p (node
))
2681 pp_string (pp
, "(");
2682 dump_generic_node (pp
, obj_type_ref_class (node
), spc
, flags
, false);
2683 pp_string (pp
, ")");
2685 dump_generic_node (pp
, OBJ_TYPE_REF_OBJECT (node
), spc
, flags
, false);
2687 dump_generic_node (pp
, OBJ_TYPE_REF_TOKEN (node
), spc
, flags
, false);
2688 pp_right_paren (pp
);
2692 if (SSA_NAME_IDENTIFIER (node
))
2694 if ((flags
& TDF_NOUID
)
2695 && SSA_NAME_VAR (node
)
2696 && DECL_NAMELESS (SSA_NAME_VAR (node
)))
2697 dump_fancy_name (pp
, SSA_NAME_IDENTIFIER (node
));
2699 dump_generic_node (pp
, SSA_NAME_IDENTIFIER (node
),
2703 pp_decimal_int (pp
, SSA_NAME_VERSION (node
));
2704 if (SSA_NAME_IS_DEFAULT_DEF (node
))
2705 pp_string (pp
, "(D)");
2706 if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (node
))
2707 pp_string (pp
, "(ab)");
2710 case WITH_SIZE_EXPR
:
2711 pp_string (pp
, "WITH_SIZE_EXPR <");
2712 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2713 pp_string (pp
, ", ");
2714 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2719 pp_string (pp
, "ASSERT_EXPR <");
2720 dump_generic_node (pp
, ASSERT_EXPR_VAR (node
), spc
, flags
, false);
2721 pp_string (pp
, ", ");
2722 dump_generic_node (pp
, ASSERT_EXPR_COND (node
), spc
, flags
, false);
2727 pp_string (pp
, "scev_known");
2730 case SCEV_NOT_KNOWN
:
2731 pp_string (pp
, "scev_not_known");
2734 case POLYNOMIAL_CHREC
:
2736 dump_generic_node (pp
, CHREC_LEFT (node
), spc
, flags
, false);
2737 pp_string (pp
, ", +, ");
2738 dump_generic_node (pp
, CHREC_RIGHT (node
), spc
, flags
, false);
2739 pp_string (pp
, "}_");
2740 dump_generic_node (pp
, CHREC_VAR (node
), spc
, flags
, false);
2744 case REALIGN_LOAD_EXPR
:
2745 pp_string (pp
, "REALIGN_LOAD <");
2746 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2747 pp_string (pp
, ", ");
2748 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2749 pp_string (pp
, ", ");
2750 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2755 pp_string (pp
, " VEC_COND_EXPR < ");
2756 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2757 pp_string (pp
, " , ");
2758 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2759 pp_string (pp
, " , ");
2760 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2761 pp_string (pp
, " > ");
2765 pp_string (pp
, " VEC_PERM_EXPR < ");
2766 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2767 pp_string (pp
, " , ");
2768 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2769 pp_string (pp
, " , ");
2770 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2771 pp_string (pp
, " > ");
2775 pp_string (pp
, " DOT_PROD_EXPR < ");
2776 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2777 pp_string (pp
, ", ");
2778 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2779 pp_string (pp
, ", ");
2780 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2781 pp_string (pp
, " > ");
2784 case WIDEN_MULT_PLUS_EXPR
:
2785 pp_string (pp
, " WIDEN_MULT_PLUS_EXPR < ");
2786 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2787 pp_string (pp
, ", ");
2788 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2789 pp_string (pp
, ", ");
2790 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2791 pp_string (pp
, " > ");
2794 case WIDEN_MULT_MINUS_EXPR
:
2795 pp_string (pp
, " WIDEN_MULT_MINUS_EXPR < ");
2796 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2797 pp_string (pp
, ", ");
2798 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2799 pp_string (pp
, ", ");
2800 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2801 pp_string (pp
, " > ");
2805 pp_string (pp
, " FMA_EXPR < ");
2806 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2807 pp_string (pp
, ", ");
2808 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2809 pp_string (pp
, ", ");
2810 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2811 pp_string (pp
, " > ");
2815 pp_string (pp
, "#pragma acc parallel");
2816 goto dump_omp_clauses_body
;
2819 pp_string (pp
, "#pragma acc kernels");
2820 goto dump_omp_clauses_body
;
2823 pp_string (pp
, "#pragma acc data");
2824 dump_omp_clauses (pp
, OACC_DATA_CLAUSES (node
), spc
, flags
);
2827 case OACC_HOST_DATA
:
2828 pp_string (pp
, "#pragma acc host_data");
2829 dump_omp_clauses (pp
, OACC_HOST_DATA_CLAUSES (node
), spc
, flags
);
2833 pp_string (pp
, "#pragma acc declare");
2834 dump_omp_clauses (pp
, OACC_DECLARE_CLAUSES (node
), spc
, flags
);
2838 pp_string (pp
, "#pragma acc update");
2839 dump_omp_clauses (pp
, OACC_UPDATE_CLAUSES (node
), spc
, flags
);
2842 case OACC_ENTER_DATA
:
2843 pp_string (pp
, "#pragma acc enter data");
2844 dump_omp_clauses (pp
, OACC_ENTER_DATA_CLAUSES (node
), spc
, flags
);
2847 case OACC_EXIT_DATA
:
2848 pp_string (pp
, "#pragma acc exit data");
2849 dump_omp_clauses (pp
, OACC_EXIT_DATA_CLAUSES (node
), spc
, flags
);
2853 pp_string (pp
, "#pragma acc cache");
2854 dump_omp_clauses (pp
, OACC_CACHE_CLAUSES (node
), spc
, flags
);
2858 pp_string (pp
, "#pragma omp parallel");
2859 dump_omp_clauses (pp
, OMP_PARALLEL_CLAUSES (node
), spc
, flags
);
2862 dump_omp_clauses_body
:
2863 dump_omp_clauses (pp
, OMP_CLAUSES (node
), spc
, flags
);
2867 if (!(flags
& TDF_SLIM
) && OMP_BODY (node
))
2869 newline_and_indent (pp
, spc
+ 2);
2871 newline_and_indent (pp
, spc
+ 4);
2872 dump_generic_node (pp
, OMP_BODY (node
), spc
+ 4, flags
, false);
2873 newline_and_indent (pp
, spc
+ 2);
2874 pp_right_brace (pp
);
2880 pp_string (pp
, "#pragma omp task");
2881 dump_omp_clauses (pp
, OMP_TASK_CLAUSES (node
), spc
, flags
);
2885 pp_string (pp
, "#pragma omp for");
2889 pp_string (pp
, "#pragma omp simd");
2893 pp_string (pp
, "#pragma simd");
2897 /* This label points one line after dumping the clauses.
2898 For _Cilk_for the clauses are dumped after the _Cilk_for (...)
2899 parameters are printed out. */
2900 goto dump_omp_loop_cilk_for
;
2902 case OMP_DISTRIBUTE
:
2903 pp_string (pp
, "#pragma omp distribute");
2907 pp_string (pp
, "#pragma omp taskloop");
2911 pp_string (pp
, "#pragma acc loop");
2915 pp_string (pp
, "#pragma omp teams");
2916 dump_omp_clauses (pp
, OMP_TEAMS_CLAUSES (node
), spc
, flags
);
2919 case OMP_TARGET_DATA
:
2920 pp_string (pp
, "#pragma omp target data");
2921 dump_omp_clauses (pp
, OMP_TARGET_DATA_CLAUSES (node
), spc
, flags
);
2924 case OMP_TARGET_ENTER_DATA
:
2925 pp_string (pp
, "#pragma omp target enter data");
2926 dump_omp_clauses (pp
, OMP_TARGET_ENTER_DATA_CLAUSES (node
), spc
, flags
);
2930 case OMP_TARGET_EXIT_DATA
:
2931 pp_string (pp
, "#pragma omp target exit data");
2932 dump_omp_clauses (pp
, OMP_TARGET_EXIT_DATA_CLAUSES (node
), spc
, flags
);
2937 pp_string (pp
, "#pragma omp target");
2938 dump_omp_clauses (pp
, OMP_TARGET_CLAUSES (node
), spc
, flags
);
2941 case OMP_TARGET_UPDATE
:
2942 pp_string (pp
, "#pragma omp target update");
2943 dump_omp_clauses (pp
, OMP_TARGET_UPDATE_CLAUSES (node
), spc
, flags
);
2948 dump_omp_clauses (pp
, OMP_FOR_CLAUSES (node
), spc
, flags
);
2950 dump_omp_loop_cilk_for
:
2951 if (!(flags
& TDF_SLIM
))
2955 if (OMP_FOR_PRE_BODY (node
))
2957 if (TREE_CODE (node
) == CILK_FOR
)
2958 pp_string (pp
, " ");
2960 newline_and_indent (pp
, spc
+ 2);
2963 newline_and_indent (pp
, spc
);
2964 dump_generic_node (pp
, OMP_FOR_PRE_BODY (node
),
2967 if (OMP_FOR_INIT (node
))
2970 for (i
= 0; i
< TREE_VEC_LENGTH (OMP_FOR_INIT (node
)); i
++)
2973 if (TREE_CODE (node
) != CILK_FOR
|| OMP_FOR_PRE_BODY (node
))
2974 newline_and_indent (pp
, spc
);
2975 if (TREE_CODE (node
) == CILK_FOR
)
2976 pp_string (pp
, "_Cilk_for (");
2978 pp_string (pp
, "for (");
2979 dump_generic_node (pp
,
2980 TREE_VEC_ELT (OMP_FOR_INIT (node
), i
),
2982 pp_string (pp
, "; ");
2983 dump_generic_node (pp
,
2984 TREE_VEC_ELT (OMP_FOR_COND (node
), i
),
2986 pp_string (pp
, "; ");
2987 dump_generic_node (pp
,
2988 TREE_VEC_ELT (OMP_FOR_INCR (node
), i
),
2990 pp_right_paren (pp
);
2992 if (TREE_CODE (node
) == CILK_FOR
)
2993 dump_omp_clauses (pp
, OMP_FOR_CLAUSES (node
), spc
, flags
);
2995 if (OMP_FOR_BODY (node
))
2997 newline_and_indent (pp
, spc
+ 2);
2999 newline_and_indent (pp
, spc
+ 4);
3000 dump_generic_node (pp
, OMP_FOR_BODY (node
), spc
+ 4, flags
,
3002 newline_and_indent (pp
, spc
+ 2);
3003 pp_right_brace (pp
);
3005 if (OMP_FOR_INIT (node
))
3006 spc
-= 2 * TREE_VEC_LENGTH (OMP_FOR_INIT (node
)) - 2;
3007 if (OMP_FOR_PRE_BODY (node
))
3010 newline_and_indent (pp
, spc
+ 2);
3011 pp_right_brace (pp
);
3018 pp_string (pp
, "#pragma omp sections");
3019 dump_omp_clauses (pp
, OMP_SECTIONS_CLAUSES (node
), spc
, flags
);
3023 pp_string (pp
, "#pragma omp section");
3027 pp_string (pp
, "#pragma omp master");
3031 pp_string (pp
, "#pragma omp taskgroup");
3035 pp_string (pp
, "#pragma omp ordered");
3036 dump_omp_clauses (pp
, OMP_ORDERED_CLAUSES (node
), spc
, flags
);
3040 pp_string (pp
, "#pragma omp critical");
3041 if (OMP_CRITICAL_NAME (node
))
3045 dump_generic_node (pp
, OMP_CRITICAL_NAME (node
), spc
,
3047 pp_right_paren (pp
);
3049 dump_omp_clauses (pp
, OMP_CRITICAL_CLAUSES (node
), spc
, flags
);
3053 pp_string (pp
, "#pragma omp atomic");
3054 if (OMP_ATOMIC_SEQ_CST (node
))
3055 pp_string (pp
, " seq_cst");
3056 newline_and_indent (pp
, spc
+ 2);
3057 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3061 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3064 case OMP_ATOMIC_READ
:
3065 pp_string (pp
, "#pragma omp atomic read");
3066 if (OMP_ATOMIC_SEQ_CST (node
))
3067 pp_string (pp
, " seq_cst");
3068 newline_and_indent (pp
, spc
+ 2);
3069 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3073 case OMP_ATOMIC_CAPTURE_OLD
:
3074 case OMP_ATOMIC_CAPTURE_NEW
:
3075 pp_string (pp
, "#pragma omp atomic capture");
3076 if (OMP_ATOMIC_SEQ_CST (node
))
3077 pp_string (pp
, " seq_cst");
3078 newline_and_indent (pp
, spc
+ 2);
3079 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3083 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3087 pp_string (pp
, "#pragma omp single");
3088 dump_omp_clauses (pp
, OMP_SINGLE_CLAUSES (node
), spc
, flags
);
3092 dump_omp_clause (pp
, node
, spc
, flags
);
3096 case TRANSACTION_EXPR
:
3097 if (TRANSACTION_EXPR_OUTER (node
))
3098 pp_string (pp
, "__transaction_atomic [[outer]]");
3099 else if (TRANSACTION_EXPR_RELAXED (node
))
3100 pp_string (pp
, "__transaction_relaxed");
3102 pp_string (pp
, "__transaction_atomic");
3103 if (!(flags
& TDF_SLIM
) && TRANSACTION_EXPR_BODY (node
))
3105 newline_and_indent (pp
, spc
);
3107 newline_and_indent (pp
, spc
+ 2);
3108 dump_generic_node (pp
, TRANSACTION_EXPR_BODY (node
),
3109 spc
+ 2, flags
, false);
3110 newline_and_indent (pp
, spc
);
3111 pp_right_brace (pp
);
3116 case REDUC_MAX_EXPR
:
3117 pp_string (pp
, " REDUC_MAX_EXPR < ");
3118 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3119 pp_string (pp
, " > ");
3122 case REDUC_MIN_EXPR
:
3123 pp_string (pp
, " REDUC_MIN_EXPR < ");
3124 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3125 pp_string (pp
, " > ");
3128 case REDUC_PLUS_EXPR
:
3129 pp_string (pp
, " REDUC_PLUS_EXPR < ");
3130 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3131 pp_string (pp
, " > ");
3134 case VEC_WIDEN_MULT_HI_EXPR
:
3135 case VEC_WIDEN_MULT_LO_EXPR
:
3136 case VEC_WIDEN_MULT_EVEN_EXPR
:
3137 case VEC_WIDEN_MULT_ODD_EXPR
:
3138 case VEC_WIDEN_LSHIFT_HI_EXPR
:
3139 case VEC_WIDEN_LSHIFT_LO_EXPR
:
3141 for (str
= get_tree_code_name (code
); *str
; str
++)
3142 pp_character (pp
, TOUPPER (*str
));
3143 pp_string (pp
, " < ");
3144 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3145 pp_string (pp
, ", ");
3146 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3147 pp_string (pp
, " > ");
3150 case VEC_UNPACK_HI_EXPR
:
3151 pp_string (pp
, " VEC_UNPACK_HI_EXPR < ");
3152 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3153 pp_string (pp
, " > ");
3156 case VEC_UNPACK_LO_EXPR
:
3157 pp_string (pp
, " VEC_UNPACK_LO_EXPR < ");
3158 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3159 pp_string (pp
, " > ");
3162 case VEC_UNPACK_FLOAT_HI_EXPR
:
3163 pp_string (pp
, " VEC_UNPACK_FLOAT_HI_EXPR < ");
3164 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3165 pp_string (pp
, " > ");
3168 case VEC_UNPACK_FLOAT_LO_EXPR
:
3169 pp_string (pp
, " VEC_UNPACK_FLOAT_LO_EXPR < ");
3170 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3171 pp_string (pp
, " > ");
3174 case VEC_PACK_TRUNC_EXPR
:
3175 pp_string (pp
, " VEC_PACK_TRUNC_EXPR < ");
3176 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3177 pp_string (pp
, ", ");
3178 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3179 pp_string (pp
, " > ");
3182 case VEC_PACK_SAT_EXPR
:
3183 pp_string (pp
, " VEC_PACK_SAT_EXPR < ");
3184 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3185 pp_string (pp
, ", ");
3186 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3187 pp_string (pp
, " > ");
3190 case VEC_PACK_FIX_TRUNC_EXPR
:
3191 pp_string (pp
, " VEC_PACK_FIX_TRUNC_EXPR < ");
3192 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3193 pp_string (pp
, ", ");
3194 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3195 pp_string (pp
, " > ");
3199 dump_block_node (pp
, node
, spc
, flags
);
3202 case CILK_SPAWN_STMT
:
3203 pp_string (pp
, "_Cilk_spawn ");
3204 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3207 case CILK_SYNC_STMT
:
3208 pp_string (pp
, "_Cilk_sync");
3215 if (is_stmt
&& is_expr
)
3221 /* Print the declaration of a variable. */
3224 print_declaration (pretty_printer
*pp
, tree t
, int spc
, int flags
)
3228 if (TREE_CODE(t
) == NAMELIST_DECL
)
3230 pp_string(pp
, "namelist ");
3231 dump_decl_name (pp
, t
, flags
);
3236 if (TREE_CODE (t
) == TYPE_DECL
)
3237 pp_string (pp
, "typedef ");
3239 if (CODE_CONTAINS_STRUCT (TREE_CODE (t
), TS_DECL_WRTL
) && DECL_REGISTER (t
))
3240 pp_string (pp
, "register ");
3242 if (TREE_PUBLIC (t
) && DECL_EXTERNAL (t
))
3243 pp_string (pp
, "extern ");
3244 else if (TREE_STATIC (t
))
3245 pp_string (pp
, "static ");
3247 /* Print the type and name. */
3248 if (TREE_TYPE (t
) && TREE_CODE (TREE_TYPE (t
)) == ARRAY_TYPE
)
3252 /* Print array's type. */
3253 tmp
= TREE_TYPE (t
);
3254 while (TREE_CODE (TREE_TYPE (tmp
)) == ARRAY_TYPE
)
3255 tmp
= TREE_TYPE (tmp
);
3256 dump_generic_node (pp
, TREE_TYPE (tmp
), spc
, flags
, false);
3258 /* Print variable's name. */
3260 dump_generic_node (pp
, t
, spc
, flags
, false);
3262 /* Print the dimensions. */
3263 tmp
= TREE_TYPE (t
);
3264 while (TREE_CODE (tmp
) == ARRAY_TYPE
)
3266 dump_array_domain (pp
, TYPE_DOMAIN (tmp
), spc
, flags
);
3267 tmp
= TREE_TYPE (tmp
);
3270 else if (TREE_CODE (t
) == FUNCTION_DECL
)
3272 dump_generic_node (pp
, TREE_TYPE (TREE_TYPE (t
)), spc
, flags
, false);
3274 dump_decl_name (pp
, t
, flags
);
3275 dump_function_declaration (pp
, TREE_TYPE (t
), spc
, flags
);
3279 /* Print type declaration. */
3280 dump_generic_node (pp
, TREE_TYPE (t
), spc
, flags
, false);
3282 /* Print variable's name. */
3284 dump_generic_node (pp
, t
, spc
, flags
, false);
3287 if (TREE_CODE (t
) == VAR_DECL
&& DECL_HARD_REGISTER (t
))
3289 pp_string (pp
, " __asm__ ");
3291 dump_generic_node (pp
, DECL_ASSEMBLER_NAME (t
), spc
, flags
, false);
3292 pp_right_paren (pp
);
3295 /* The initial value of a function serves to determine whether the function
3296 is declared or defined. So the following does not apply to function
3298 if (TREE_CODE (t
) != FUNCTION_DECL
)
3300 /* Print the initial value. */
3301 if (DECL_INITIAL (t
))
3306 dump_generic_node (pp
, DECL_INITIAL (t
), spc
, flags
, false);
3310 if (TREE_CODE (t
) == VAR_DECL
&& DECL_HAS_VALUE_EXPR_P (t
))
3312 pp_string (pp
, " [value-expr: ");
3313 dump_generic_node (pp
, DECL_VALUE_EXPR (t
), spc
, flags
, false);
3314 pp_right_bracket (pp
);
3321 /* Prints a structure: name, fields, and methods.
3322 FIXME: Still incomplete. */
3325 print_struct_decl (pretty_printer
*pp
, const_tree node
, int spc
, int flags
)
3327 /* Print the name of the structure. */
3328 if (TYPE_NAME (node
))
3331 if (TREE_CODE (node
) == RECORD_TYPE
)
3332 pp_string (pp
, "struct ");
3333 else if ((TREE_CODE (node
) == UNION_TYPE
3334 || TREE_CODE (node
) == QUAL_UNION_TYPE
))
3335 pp_string (pp
, "union ");
3337 dump_generic_node (pp
, TYPE_NAME (node
), spc
, 0, false);
3340 /* Print the contents of the structure. */
3346 /* Print the fields of the structure. */
3349 tmp
= TYPE_FIELDS (node
);
3352 /* Avoid to print recursively the structure. */
3353 /* FIXME : Not implemented correctly...,
3354 what about the case when we have a cycle in the contain graph? ...
3355 Maybe this could be solved by looking at the scope in which the
3356 structure was declared. */
3357 if (TREE_TYPE (tmp
) != node
3358 && (TREE_CODE (TREE_TYPE (tmp
)) != POINTER_TYPE
3359 || TREE_TYPE (TREE_TYPE (tmp
)) != node
))
3361 print_declaration (pp
, tmp
, spc
+2, flags
);
3364 tmp
= DECL_CHAIN (tmp
);
3368 pp_right_brace (pp
);
3371 /* Return the priority of the operator CODE.
3373 From lowest to highest precedence with either left-to-right (L-R)
3374 or right-to-left (R-L) associativity]:
3377 2 [R-L] = += -= *= /= %= &= ^= |= <<= >>=
3389 14 [R-L] ! ~ ++ -- + - * & (type) sizeof
3390 15 [L-R] fn() [] -> .
3392 unary +, - and * have higher precedence than the corresponding binary
3396 op_code_prio (enum tree_code code
)
3413 case TRUTH_ORIF_EXPR
:
3416 case TRUTH_AND_EXPR
:
3417 case TRUTH_ANDIF_EXPR
:
3424 case TRUTH_XOR_EXPR
:
3441 case UNORDERED_EXPR
:
3452 case VEC_WIDEN_LSHIFT_HI_EXPR
:
3453 case VEC_WIDEN_LSHIFT_LO_EXPR
:
3454 case WIDEN_LSHIFT_EXPR
:
3457 case WIDEN_SUM_EXPR
:
3459 case POINTER_PLUS_EXPR
:
3463 case VEC_WIDEN_MULT_HI_EXPR
:
3464 case VEC_WIDEN_MULT_LO_EXPR
:
3465 case WIDEN_MULT_EXPR
:
3467 case WIDEN_MULT_PLUS_EXPR
:
3468 case WIDEN_MULT_MINUS_EXPR
:
3470 case MULT_HIGHPART_EXPR
:
3471 case TRUNC_DIV_EXPR
:
3473 case FLOOR_DIV_EXPR
:
3474 case ROUND_DIV_EXPR
:
3476 case EXACT_DIV_EXPR
:
3477 case TRUNC_MOD_EXPR
:
3479 case FLOOR_MOD_EXPR
:
3480 case ROUND_MOD_EXPR
:
3484 case TRUTH_NOT_EXPR
:
3486 case POSTINCREMENT_EXPR
:
3487 case POSTDECREMENT_EXPR
:
3488 case PREINCREMENT_EXPR
:
3489 case PREDECREMENT_EXPR
:
3495 case FIX_TRUNC_EXPR
:
3501 case ARRAY_RANGE_REF
:
3505 /* Special expressions. */
3511 case REDUC_MAX_EXPR
:
3512 case REDUC_MIN_EXPR
:
3513 case REDUC_PLUS_EXPR
:
3514 case VEC_UNPACK_HI_EXPR
:
3515 case VEC_UNPACK_LO_EXPR
:
3516 case VEC_UNPACK_FLOAT_HI_EXPR
:
3517 case VEC_UNPACK_FLOAT_LO_EXPR
:
3518 case VEC_PACK_TRUNC_EXPR
:
3519 case VEC_PACK_SAT_EXPR
:
3523 /* Return an arbitrarily high precedence to avoid surrounding single
3524 VAR_DECLs in ()s. */
3529 /* Return the priority of the operator OP. */
3532 op_prio (const_tree op
)
3534 enum tree_code code
;
3539 code
= TREE_CODE (op
);
3540 if (code
== SAVE_EXPR
|| code
== NON_LVALUE_EXPR
)
3541 return op_prio (TREE_OPERAND (op
, 0));
3543 return op_code_prio (code
);
3546 /* Return the symbol associated with operator CODE. */
3549 op_symbol_code (enum tree_code code
)
3557 case TRUTH_ORIF_EXPR
:
3560 case TRUTH_AND_EXPR
:
3561 case TRUTH_ANDIF_EXPR
:
3567 case TRUTH_XOR_EXPR
:
3577 case UNORDERED_EXPR
:
3623 case WIDEN_LSHIFT_EXPR
:
3626 case POINTER_PLUS_EXPR
:
3632 case REDUC_PLUS_EXPR
:
3635 case WIDEN_SUM_EXPR
:
3638 case WIDEN_MULT_EXPR
:
3641 case MULT_HIGHPART_EXPR
:
3651 case TRUTH_NOT_EXPR
:
3658 case TRUNC_DIV_EXPR
:
3665 case FLOOR_DIV_EXPR
:
3668 case ROUND_DIV_EXPR
:
3671 case EXACT_DIV_EXPR
:
3674 case TRUNC_MOD_EXPR
:
3680 case FLOOR_MOD_EXPR
:
3683 case ROUND_MOD_EXPR
:
3686 case PREDECREMENT_EXPR
:
3689 case PREINCREMENT_EXPR
:
3692 case POSTDECREMENT_EXPR
:
3695 case POSTINCREMENT_EXPR
:
3705 return "<<< ??? >>>";
3709 /* Return the symbol associated with operator OP. */
3712 op_symbol (const_tree op
)
3714 return op_symbol_code (TREE_CODE (op
));
3717 /* Prints the name of a call. NODE is the CALL_EXPR_FN of a CALL_EXPR or
3718 the gimple_call_fn of a GIMPLE_CALL. */
3721 print_call_name (pretty_printer
*pp
, tree node
, int flags
)
3725 if (TREE_CODE (op0
) == NON_LVALUE_EXPR
)
3726 op0
= TREE_OPERAND (op0
, 0);
3729 switch (TREE_CODE (op0
))
3734 dump_function_name (pp
, op0
, flags
);
3740 op0
= TREE_OPERAND (op0
, 0);
3745 dump_generic_node (pp
, TREE_OPERAND (op0
, 0), 0, flags
, false);
3746 pp_string (pp
, ") ? ");
3747 dump_generic_node (pp
, TREE_OPERAND (op0
, 1), 0, flags
, false);
3748 pp_string (pp
, " : ");
3749 dump_generic_node (pp
, TREE_OPERAND (op0
, 2), 0, flags
, false);
3753 if (TREE_CODE (TREE_OPERAND (op0
, 0)) == VAR_DECL
)
3754 dump_function_name (pp
, TREE_OPERAND (op0
, 0), flags
);
3756 dump_generic_node (pp
, op0
, 0, flags
, false);
3760 if (integer_zerop (TREE_OPERAND (op0
, 1)))
3762 op0
= TREE_OPERAND (op0
, 0);
3769 dump_generic_node (pp
, op0
, 0, flags
, false);
3777 /* Parses the string STR and replaces new-lines by '\n', tabs by '\t', ... */
3780 pretty_print_string (pretty_printer
*pp
, const char *str
)
3790 pp_string (pp
, "\\b");
3794 pp_string (pp
, "\\f");
3798 pp_string (pp
, "\\n");
3802 pp_string (pp
, "\\r");
3806 pp_string (pp
, "\\t");
3810 pp_string (pp
, "\\v");
3814 pp_string (pp
, "\\\\");
3818 pp_string (pp
, "\\\"");
3822 pp_string (pp
, "\\'");
3825 /* No need to handle \0; the loop terminates on \0. */
3828 pp_string (pp
, "\\1");
3832 pp_string (pp
, "\\2");
3836 pp_string (pp
, "\\3");
3840 pp_string (pp
, "\\4");
3844 pp_string (pp
, "\\5");
3848 pp_string (pp
, "\\6");
3852 pp_string (pp
, "\\7");
3856 pp_character (pp
, str
[0]);
3864 maybe_init_pretty_print (FILE *file
)
3868 tree_pp
= new pretty_printer ();
3869 pp_needs_newline (tree_pp
) = true;
3870 pp_translate_identifiers (tree_pp
) = false;
3873 tree_pp
->buffer
->stream
= file
;
3877 newline_and_indent (pretty_printer
*pp
, int spc
)
3883 /* Handle a %K format for TEXT. Separate from default_tree_printer so
3884 it can also be used in front ends.
3885 %K: a statement, from which EXPR_LOCATION and TREE_BLOCK will be recorded.
3889 percent_K_format (text_info
*text
)
3891 tree t
= va_arg (*text
->args_ptr
, tree
), block
;
3892 text
->set_location (0, EXPR_LOCATION (t
), true);
3893 gcc_assert (pp_ti_abstract_origin (text
) != NULL
);
3894 block
= TREE_BLOCK (t
);
3895 *pp_ti_abstract_origin (text
) = NULL
;
3899 /* ??? LTO drops all BLOCK_ABSTRACT_ORIGINs apart from those
3900 representing the outermost block of an inlined function.
3901 So walk the BLOCK tree until we hit such a scope. */
3903 && TREE_CODE (block
) == BLOCK
)
3905 if (inlined_function_outer_scope_p (block
))
3907 *pp_ti_abstract_origin (text
) = block
;
3910 block
= BLOCK_SUPERCONTEXT (block
);
3916 && TREE_CODE (block
) == BLOCK
3917 && BLOCK_ABSTRACT_ORIGIN (block
))
3919 tree ao
= BLOCK_ABSTRACT_ORIGIN (block
);
3921 while (TREE_CODE (ao
) == BLOCK
3922 && BLOCK_ABSTRACT_ORIGIN (ao
)
3923 && BLOCK_ABSTRACT_ORIGIN (ao
) != ao
)
3924 ao
= BLOCK_ABSTRACT_ORIGIN (ao
);
3926 if (TREE_CODE (ao
) == FUNCTION_DECL
)
3928 *pp_ti_abstract_origin (text
) = block
;
3931 block
= BLOCK_SUPERCONTEXT (block
);
3935 /* Print the identifier ID to PRETTY-PRINTER. */
3938 pp_tree_identifier (pretty_printer
*pp
, tree id
)
3940 if (pp_translate_identifiers (pp
))
3942 const char *text
= identifier_to_locale (IDENTIFIER_POINTER (id
));
3943 pp_append_text (pp
, text
, text
+ strlen (text
));
3946 pp_append_text (pp
, IDENTIFIER_POINTER (id
),
3947 IDENTIFIER_POINTER (id
) + IDENTIFIER_LENGTH (id
));
3950 /* A helper function that is used to dump function information before the
3954 dump_function_header (FILE *dump_file
, tree fdecl
, int flags
)
3956 const char *dname
, *aname
;
3957 struct cgraph_node
*node
= cgraph_node::get (fdecl
);
3958 struct function
*fun
= DECL_STRUCT_FUNCTION (fdecl
);
3960 dname
= lang_hooks
.decl_printable_name (fdecl
, 2);
3962 if (DECL_ASSEMBLER_NAME_SET_P (fdecl
))
3963 aname
= (IDENTIFIER_POINTER
3964 (DECL_ASSEMBLER_NAME (fdecl
)));
3966 aname
= "<unset-asm-name>";
3968 fprintf (dump_file
, "\n;; Function %s (%s, funcdef_no=%d",
3969 dname
, aname
, fun
->funcdef_no
);
3970 if (!(flags
& TDF_NOUID
))
3971 fprintf (dump_file
, ", decl_uid=%d", DECL_UID (fdecl
));
3974 fprintf (dump_file
, ", cgraph_uid=%d", node
->uid
);
3975 fprintf (dump_file
, ", symbol_order=%d)%s\n\n", node
->order
,
3976 node
->frequency
== NODE_FREQUENCY_HOT
3978 : node
->frequency
== NODE_FREQUENCY_UNLIKELY_EXECUTED
3979 ? " (unlikely executed)"
3980 : node
->frequency
== NODE_FREQUENCY_EXECUTED_ONCE
3981 ? " (executed once)"
3985 fprintf (dump_file
, ")\n\n");
3988 /* Dump double_int D to pretty_printer PP. UNS is true
3989 if D is unsigned and false otherwise. */
3991 pp_double_int (pretty_printer
*pp
, double_int d
, bool uns
)
3994 pp_wide_integer (pp
, d
.low
);
3995 else if (d
.fits_uhwi ())
3996 pp_unsigned_wide_integer (pp
, d
.low
);
3999 unsigned HOST_WIDE_INT low
= d
.low
;
4000 HOST_WIDE_INT high
= d
.high
;
4001 if (!uns
&& d
.is_negative ())
4004 high
= ~high
+ !low
;
4007 /* Would "%x%0*x" or "%x%*0x" get zero-padding on all
4009 sprintf (pp_buffer (pp
)->digit_buffer
,
4010 HOST_WIDE_INT_PRINT_DOUBLE_HEX
,
4011 (unsigned HOST_WIDE_INT
) high
, low
);
4012 pp_string (pp
, pp_buffer (pp
)->digit_buffer
);