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 char uid_sep
= (flags
& TDF_GIMPLE
) ? '_' : '.';
261 if ((flags
& TDF_UID
) || DECL_NAME (node
) == NULL_TREE
)
263 if (TREE_CODE (node
) == LABEL_DECL
&& LABEL_DECL_UID (node
) != -1)
264 pp_printf (pp
, "L%c%d", uid_sep
, (int) LABEL_DECL_UID (node
));
265 else if (TREE_CODE (node
) == DEBUG_EXPR_DECL
)
267 if (flags
& TDF_NOUID
)
268 pp_string (pp
, "D#xxxx");
270 pp_printf (pp
, "D#%i", DEBUG_TEMP_UID (node
));
274 char c
= TREE_CODE (node
) == CONST_DECL
? 'C' : 'D';
275 if (flags
& TDF_NOUID
)
276 pp_printf (pp
, "%c.xxxx", c
);
278 pp_printf (pp
, "%c%c%u", c
, uid_sep
, DECL_UID (node
));
281 if ((flags
& TDF_ALIAS
) && DECL_PT_UID (node
) != DECL_UID (node
))
283 if (flags
& TDF_NOUID
)
284 pp_printf (pp
, "ptD.xxxx");
286 pp_printf (pp
, "ptD.%u", DECL_PT_UID (node
));
290 /* Like the above, but used for pretty printing function calls. */
293 dump_function_name (pretty_printer
*pp
, tree node
, int flags
)
295 if (CONVERT_EXPR_P (node
))
296 node
= TREE_OPERAND (node
, 0);
297 if (DECL_NAME (node
) && (flags
& TDF_ASMNAME
) == 0)
298 pp_string (pp
, lang_hooks
.decl_printable_name (node
, 1));
300 dump_decl_name (pp
, node
, flags
);
303 /* Dump a function declaration. NODE is the FUNCTION_TYPE. PP, SPC and
304 FLAGS are as in dump_generic_node. */
307 dump_function_declaration (pretty_printer
*pp
, tree node
,
310 bool wrote_arg
= false;
316 /* Print the argument types. */
317 arg
= TYPE_ARG_TYPES (node
);
318 while (arg
&& arg
!= void_list_node
&& arg
!= error_mark_node
)
326 dump_generic_node (pp
, TREE_VALUE (arg
), spc
, flags
, false);
327 arg
= TREE_CHAIN (arg
);
330 /* Drop the trailing void_type_node if we had any previous argument. */
331 if (arg
== void_list_node
&& !wrote_arg
)
332 pp_string (pp
, "void");
333 /* Properly dump vararg function types. */
334 else if (!arg
&& wrote_arg
)
335 pp_string (pp
, ", ...");
336 /* Avoid printing any arg for unprototyped functions. */
341 /* Dump the domain associated with an array. */
344 dump_array_domain (pretty_printer
*pp
, tree domain
, int spc
, int flags
)
346 pp_left_bracket (pp
);
349 tree min
= TYPE_MIN_VALUE (domain
);
350 tree max
= TYPE_MAX_VALUE (domain
);
353 && integer_zerop (min
)
354 && tree_fits_shwi_p (max
))
355 pp_wide_integer (pp
, tree_to_shwi (max
) + 1);
359 dump_generic_node (pp
, min
, spc
, flags
, false);
362 dump_generic_node (pp
, max
, spc
, flags
, false);
366 pp_string (pp
, "<unknown>");
367 pp_right_bracket (pp
);
371 /* Dump OpenMP clause CLAUSE. PP, CLAUSE, SPC and FLAGS are as in
372 dump_generic_node. */
375 dump_omp_clause (pretty_printer
*pp
, tree clause
, int spc
, int flags
)
379 switch (OMP_CLAUSE_CODE (clause
))
381 case OMP_CLAUSE_PRIVATE
:
384 case OMP_CLAUSE_SHARED
:
387 case OMP_CLAUSE_FIRSTPRIVATE
:
388 name
= "firstprivate";
390 case OMP_CLAUSE_LASTPRIVATE
:
391 name
= "lastprivate";
393 case OMP_CLAUSE_COPYIN
:
396 case OMP_CLAUSE_COPYPRIVATE
:
397 name
= "copyprivate";
399 case OMP_CLAUSE_UNIFORM
:
402 case OMP_CLAUSE_USE_DEVICE_PTR
:
403 name
= "use_device_ptr";
405 case OMP_CLAUSE_IS_DEVICE_PTR
:
406 name
= "is_device_ptr";
408 case OMP_CLAUSE__LOOPTEMP_
:
411 case OMP_CLAUSE_TO_DECLARE
:
414 case OMP_CLAUSE_LINK
:
418 pp_string (pp
, name
);
420 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
425 case OMP_CLAUSE_REDUCTION
:
426 pp_string (pp
, "reduction(");
427 if (OMP_CLAUSE_REDUCTION_CODE (clause
) != ERROR_MARK
)
430 op_symbol_code (OMP_CLAUSE_REDUCTION_CODE (clause
)));
433 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
439 pp_string (pp
, "if(");
440 switch (OMP_CLAUSE_IF_MODIFIER (clause
))
442 case ERROR_MARK
: break;
443 case OMP_PARALLEL
: pp_string (pp
, "parallel:"); break;
444 case OMP_TASK
: pp_string (pp
, "task:"); break;
445 case OMP_TASKLOOP
: pp_string (pp
, "taskloop:"); break;
446 case OMP_TARGET_DATA
: pp_string (pp
, "target data:"); break;
447 case OMP_TARGET
: pp_string (pp
, "target:"); break;
448 case OMP_TARGET_UPDATE
: pp_string (pp
, "target update:"); break;
449 case OMP_TARGET_ENTER_DATA
:
450 pp_string (pp
, "target enter data:"); break;
451 case OMP_TARGET_EXIT_DATA
: pp_string (pp
, "target exit data:"); break;
452 default: gcc_unreachable ();
454 dump_generic_node (pp
, OMP_CLAUSE_IF_EXPR (clause
),
459 case OMP_CLAUSE_NUM_THREADS
:
460 pp_string (pp
, "num_threads(");
461 dump_generic_node (pp
, OMP_CLAUSE_NUM_THREADS_EXPR (clause
),
466 case OMP_CLAUSE__CILK_FOR_COUNT_
:
467 pp_string (pp
, "_Cilk_for_count_(");
468 dump_generic_node (pp
, OMP_CLAUSE_OPERAND (clause
, 0),
473 case OMP_CLAUSE_NOWAIT
:
474 pp_string (pp
, "nowait");
476 case OMP_CLAUSE_ORDERED
:
477 pp_string (pp
, "ordered");
478 if (OMP_CLAUSE_ORDERED_EXPR (clause
))
481 dump_generic_node (pp
, OMP_CLAUSE_ORDERED_EXPR (clause
),
487 case OMP_CLAUSE_DEFAULT
:
488 pp_string (pp
, "default(");
489 switch (OMP_CLAUSE_DEFAULT_KIND (clause
))
491 case OMP_CLAUSE_DEFAULT_UNSPECIFIED
:
493 case OMP_CLAUSE_DEFAULT_SHARED
:
494 pp_string (pp
, "shared");
496 case OMP_CLAUSE_DEFAULT_NONE
:
497 pp_string (pp
, "none");
499 case OMP_CLAUSE_DEFAULT_PRIVATE
:
500 pp_string (pp
, "private");
502 case OMP_CLAUSE_DEFAULT_FIRSTPRIVATE
:
503 pp_string (pp
, "firstprivate");
511 case OMP_CLAUSE_SCHEDULE
:
512 pp_string (pp
, "schedule(");
513 if (OMP_CLAUSE_SCHEDULE_KIND (clause
)
514 & (OMP_CLAUSE_SCHEDULE_MONOTONIC
515 | OMP_CLAUSE_SCHEDULE_NONMONOTONIC
))
517 if (OMP_CLAUSE_SCHEDULE_KIND (clause
)
518 & OMP_CLAUSE_SCHEDULE_MONOTONIC
)
519 pp_string (pp
, "monotonic");
521 pp_string (pp
, "nonmonotonic");
522 if (OMP_CLAUSE_SCHEDULE_SIMD (clause
))
527 if (OMP_CLAUSE_SCHEDULE_SIMD (clause
))
528 pp_string (pp
, "simd:");
530 switch (OMP_CLAUSE_SCHEDULE_KIND (clause
) & OMP_CLAUSE_SCHEDULE_MASK
)
532 case OMP_CLAUSE_SCHEDULE_STATIC
:
533 pp_string (pp
, "static");
535 case OMP_CLAUSE_SCHEDULE_DYNAMIC
:
536 pp_string (pp
, "dynamic");
538 case OMP_CLAUSE_SCHEDULE_GUIDED
:
539 pp_string (pp
, "guided");
541 case OMP_CLAUSE_SCHEDULE_RUNTIME
:
542 pp_string (pp
, "runtime");
544 case OMP_CLAUSE_SCHEDULE_AUTO
:
545 pp_string (pp
, "auto");
547 case OMP_CLAUSE_SCHEDULE_CILKFOR
:
548 pp_string (pp
, "cilk-for grain");
553 if (OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (clause
))
556 dump_generic_node (pp
, OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (clause
),
562 case OMP_CLAUSE_UNTIED
:
563 pp_string (pp
, "untied");
566 case OMP_CLAUSE_COLLAPSE
:
567 pp_string (pp
, "collapse(");
568 dump_generic_node (pp
, OMP_CLAUSE_COLLAPSE_EXPR (clause
),
573 case OMP_CLAUSE_FINAL
:
574 pp_string (pp
, "final(");
575 dump_generic_node (pp
, OMP_CLAUSE_FINAL_EXPR (clause
),
580 case OMP_CLAUSE_MERGEABLE
:
581 pp_string (pp
, "mergeable");
584 case OMP_CLAUSE_LINEAR
:
585 pp_string (pp
, "linear(");
586 switch (OMP_CLAUSE_LINEAR_KIND (clause
))
588 case OMP_CLAUSE_LINEAR_DEFAULT
:
590 case OMP_CLAUSE_LINEAR_REF
:
591 pp_string (pp
, "ref(");
593 case OMP_CLAUSE_LINEAR_VAL
:
594 pp_string (pp
, "val(");
596 case OMP_CLAUSE_LINEAR_UVAL
:
597 pp_string (pp
, "uval(");
602 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
604 if (OMP_CLAUSE_LINEAR_KIND (clause
) != OMP_CLAUSE_LINEAR_DEFAULT
)
607 dump_generic_node (pp
, OMP_CLAUSE_LINEAR_STEP (clause
),
612 case OMP_CLAUSE_ALIGNED
:
613 pp_string (pp
, "aligned(");
614 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
616 if (OMP_CLAUSE_ALIGNED_ALIGNMENT (clause
))
619 dump_generic_node (pp
, OMP_CLAUSE_ALIGNED_ALIGNMENT (clause
),
625 case OMP_CLAUSE_DEPEND
:
626 pp_string (pp
, "depend(");
627 switch (OMP_CLAUSE_DEPEND_KIND (clause
))
629 case OMP_CLAUSE_DEPEND_IN
:
630 pp_string (pp
, "in");
632 case OMP_CLAUSE_DEPEND_OUT
:
633 pp_string (pp
, "out");
635 case OMP_CLAUSE_DEPEND_INOUT
:
636 pp_string (pp
, "inout");
638 case OMP_CLAUSE_DEPEND_SOURCE
:
639 pp_string (pp
, "source)");
641 case OMP_CLAUSE_DEPEND_SINK
:
642 pp_string (pp
, "sink:");
643 for (tree t
= OMP_CLAUSE_DECL (clause
); t
; t
= TREE_CHAIN (t
))
644 if (TREE_CODE (t
) == TREE_LIST
)
646 dump_generic_node (pp
, TREE_VALUE (t
), spc
, flags
, false);
647 if (TREE_PURPOSE (t
) != integer_zero_node
)
649 if (OMP_CLAUSE_DEPEND_SINK_NEGATIVE (t
))
653 dump_generic_node (pp
, TREE_PURPOSE (t
), spc
, flags
,
667 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
673 pp_string (pp
, "map(");
674 switch (OMP_CLAUSE_MAP_KIND (clause
))
677 case GOMP_MAP_POINTER
:
678 pp_string (pp
, "alloc");
681 case GOMP_MAP_TO_PSET
:
682 pp_string (pp
, "to");
685 pp_string (pp
, "from");
687 case GOMP_MAP_TOFROM
:
688 pp_string (pp
, "tofrom");
690 case GOMP_MAP_FORCE_ALLOC
:
691 pp_string (pp
, "force_alloc");
693 case GOMP_MAP_FORCE_TO
:
694 pp_string (pp
, "force_to");
696 case GOMP_MAP_FORCE_FROM
:
697 pp_string (pp
, "force_from");
699 case GOMP_MAP_FORCE_TOFROM
:
700 pp_string (pp
, "force_tofrom");
702 case GOMP_MAP_FORCE_PRESENT
:
703 pp_string (pp
, "force_present");
705 case GOMP_MAP_DELETE
:
706 pp_string (pp
, "delete");
708 case GOMP_MAP_FORCE_DEVICEPTR
:
709 pp_string (pp
, "force_deviceptr");
711 case GOMP_MAP_ALWAYS_TO
:
712 pp_string (pp
, "always,to");
714 case GOMP_MAP_ALWAYS_FROM
:
715 pp_string (pp
, "always,from");
717 case GOMP_MAP_ALWAYS_TOFROM
:
718 pp_string (pp
, "always,tofrom");
720 case GOMP_MAP_RELEASE
:
721 pp_string (pp
, "release");
723 case GOMP_MAP_FIRSTPRIVATE_POINTER
:
724 pp_string (pp
, "firstprivate");
726 case GOMP_MAP_FIRSTPRIVATE_REFERENCE
:
727 pp_string (pp
, "firstprivate ref");
729 case GOMP_MAP_STRUCT
:
730 pp_string (pp
, "struct");
732 case GOMP_MAP_ALWAYS_POINTER
:
733 pp_string (pp
, "always_pointer");
735 case GOMP_MAP_DEVICE_RESIDENT
:
736 pp_string (pp
, "device_resident");
739 pp_string (pp
, "link");
745 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
748 if (OMP_CLAUSE_SIZE (clause
))
750 switch (OMP_CLAUSE_CODE (clause
) == OMP_CLAUSE_MAP
751 ? OMP_CLAUSE_MAP_KIND (clause
) : GOMP_MAP_TO
)
753 case GOMP_MAP_POINTER
:
754 case GOMP_MAP_FIRSTPRIVATE_POINTER
:
755 case GOMP_MAP_FIRSTPRIVATE_REFERENCE
:
756 case GOMP_MAP_ALWAYS_POINTER
:
757 pp_string (pp
, " [pointer assign, bias: ");
759 case GOMP_MAP_TO_PSET
:
760 pp_string (pp
, " [pointer set, len: ");
763 pp_string (pp
, " [len: ");
766 dump_generic_node (pp
, OMP_CLAUSE_SIZE (clause
),
768 pp_right_bracket (pp
);
773 case OMP_CLAUSE_FROM
:
774 pp_string (pp
, "from(");
775 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
777 goto print_clause_size
;
780 pp_string (pp
, "to(");
781 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
783 goto print_clause_size
;
785 case OMP_CLAUSE__CACHE_
:
787 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
789 goto print_clause_size
;
791 case OMP_CLAUSE_NUM_TEAMS
:
792 pp_string (pp
, "num_teams(");
793 dump_generic_node (pp
, OMP_CLAUSE_NUM_TEAMS_EXPR (clause
),
798 case OMP_CLAUSE_THREAD_LIMIT
:
799 pp_string (pp
, "thread_limit(");
800 dump_generic_node (pp
, OMP_CLAUSE_THREAD_LIMIT_EXPR (clause
),
805 case OMP_CLAUSE_DEVICE
:
806 pp_string (pp
, "device(");
807 dump_generic_node (pp
, OMP_CLAUSE_DEVICE_ID (clause
),
812 case OMP_CLAUSE_DIST_SCHEDULE
:
813 pp_string (pp
, "dist_schedule(static");
814 if (OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR (clause
))
817 dump_generic_node (pp
,
818 OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR (clause
),
824 case OMP_CLAUSE_PROC_BIND
:
825 pp_string (pp
, "proc_bind(");
826 switch (OMP_CLAUSE_PROC_BIND_KIND (clause
))
828 case OMP_CLAUSE_PROC_BIND_MASTER
:
829 pp_string (pp
, "master");
831 case OMP_CLAUSE_PROC_BIND_CLOSE
:
832 pp_string (pp
, "close");
834 case OMP_CLAUSE_PROC_BIND_SPREAD
:
835 pp_string (pp
, "spread");
843 case OMP_CLAUSE_SAFELEN
:
844 pp_string (pp
, "safelen(");
845 dump_generic_node (pp
, OMP_CLAUSE_SAFELEN_EXPR (clause
),
850 case OMP_CLAUSE_SIMDLEN
:
851 pp_string (pp
, "simdlen(");
852 dump_generic_node (pp
, OMP_CLAUSE_SIMDLEN_EXPR (clause
),
857 case OMP_CLAUSE_PRIORITY
:
858 pp_string (pp
, "priority(");
859 dump_generic_node (pp
, OMP_CLAUSE_PRIORITY_EXPR (clause
),
864 case OMP_CLAUSE_GRAINSIZE
:
865 pp_string (pp
, "grainsize(");
866 dump_generic_node (pp
, OMP_CLAUSE_GRAINSIZE_EXPR (clause
),
871 case OMP_CLAUSE_NUM_TASKS
:
872 pp_string (pp
, "num_tasks(");
873 dump_generic_node (pp
, OMP_CLAUSE_NUM_TASKS_EXPR (clause
),
878 case OMP_CLAUSE_HINT
:
879 pp_string (pp
, "hint(");
880 dump_generic_node (pp
, OMP_CLAUSE_HINT_EXPR (clause
),
885 case OMP_CLAUSE_DEFAULTMAP
:
886 pp_string (pp
, "defaultmap(tofrom:scalar)");
889 case OMP_CLAUSE__SIMDUID_
:
890 pp_string (pp
, "_simduid_(");
891 dump_generic_node (pp
, OMP_CLAUSE__SIMDUID__DECL (clause
),
896 case OMP_CLAUSE_GANG
:
897 pp_string (pp
, "gang");
898 if (OMP_CLAUSE_GANG_EXPR (clause
) != NULL_TREE
)
900 pp_string (pp
, "(num: ");
901 dump_generic_node (pp
, OMP_CLAUSE_GANG_EXPR (clause
),
904 if (OMP_CLAUSE_GANG_STATIC_EXPR (clause
) != NULL_TREE
)
906 if (OMP_CLAUSE_GANG_EXPR (clause
) == NULL_TREE
)
910 pp_string (pp
, "static:");
911 if (OMP_CLAUSE_GANG_STATIC_EXPR (clause
)
912 == integer_minus_one_node
)
913 pp_character (pp
, '*');
915 dump_generic_node (pp
, OMP_CLAUSE_GANG_STATIC_EXPR (clause
),
918 if (OMP_CLAUSE_GANG_EXPR (clause
) != NULL_TREE
919 || OMP_CLAUSE_GANG_STATIC_EXPR (clause
) != NULL_TREE
)
923 case OMP_CLAUSE_ASYNC
:
924 pp_string (pp
, "async");
925 if (OMP_CLAUSE_ASYNC_EXPR (clause
))
927 pp_character(pp
, '(');
928 dump_generic_node (pp
, OMP_CLAUSE_ASYNC_EXPR (clause
),
930 pp_character(pp
, ')');
934 case OMP_CLAUSE_AUTO
:
936 pp_string (pp
, omp_clause_code_name
[OMP_CLAUSE_CODE (clause
)]);
939 case OMP_CLAUSE_WAIT
:
940 pp_string (pp
, "wait(");
941 dump_generic_node (pp
, OMP_CLAUSE_WAIT_EXPR (clause
),
943 pp_character(pp
, ')');
946 case OMP_CLAUSE_WORKER
:
947 pp_string (pp
, "worker");
948 if (OMP_CLAUSE_WORKER_EXPR (clause
) != NULL_TREE
)
951 dump_generic_node (pp
, OMP_CLAUSE_WORKER_EXPR (clause
),
957 case OMP_CLAUSE_VECTOR
:
958 pp_string (pp
, "vector");
959 if (OMP_CLAUSE_VECTOR_EXPR (clause
) != NULL_TREE
)
962 dump_generic_node (pp
, OMP_CLAUSE_VECTOR_EXPR (clause
),
968 case OMP_CLAUSE_NUM_GANGS
:
969 pp_string (pp
, "num_gangs(");
970 dump_generic_node (pp
, OMP_CLAUSE_NUM_GANGS_EXPR (clause
),
972 pp_character (pp
, ')');
975 case OMP_CLAUSE_NUM_WORKERS
:
976 pp_string (pp
, "num_workers(");
977 dump_generic_node (pp
, OMP_CLAUSE_NUM_WORKERS_EXPR (clause
),
979 pp_character (pp
, ')');
982 case OMP_CLAUSE_VECTOR_LENGTH
:
983 pp_string (pp
, "vector_length(");
984 dump_generic_node (pp
, OMP_CLAUSE_VECTOR_LENGTH_EXPR (clause
),
986 pp_character (pp
, ')');
989 case OMP_CLAUSE_INBRANCH
:
990 pp_string (pp
, "inbranch");
992 case OMP_CLAUSE_NOTINBRANCH
:
993 pp_string (pp
, "notinbranch");
996 pp_string (pp
, "for");
998 case OMP_CLAUSE_PARALLEL
:
999 pp_string (pp
, "parallel");
1001 case OMP_CLAUSE_SECTIONS
:
1002 pp_string (pp
, "sections");
1004 case OMP_CLAUSE_TASKGROUP
:
1005 pp_string (pp
, "taskgroup");
1007 case OMP_CLAUSE_NOGROUP
:
1008 pp_string (pp
, "nogroup");
1010 case OMP_CLAUSE_THREADS
:
1011 pp_string (pp
, "threads");
1013 case OMP_CLAUSE_SIMD
:
1014 pp_string (pp
, "simd");
1016 case OMP_CLAUSE_INDEPENDENT
:
1017 pp_string (pp
, "independent");
1019 case OMP_CLAUSE_TILE
:
1020 pp_string (pp
, "tile(");
1021 dump_generic_node (pp
, OMP_CLAUSE_TILE_LIST (clause
),
1023 pp_right_paren (pp
);
1026 case OMP_CLAUSE__GRIDDIM_
:
1027 pp_string (pp
, "_griddim_(");
1028 pp_unsigned_wide_integer (pp
, OMP_CLAUSE__GRIDDIM__DIMENSION (clause
));
1030 dump_generic_node (pp
, OMP_CLAUSE__GRIDDIM__SIZE (clause
), spc
, flags
,
1033 dump_generic_node (pp
, OMP_CLAUSE__GRIDDIM__GROUP (clause
), spc
, flags
,
1035 pp_right_paren (pp
);
1039 /* Should never happen. */
1040 dump_generic_node (pp
, clause
, spc
, flags
, false);
1046 /* Dump the list of OpenMP clauses. PP, SPC and FLAGS are as in
1047 dump_generic_node. */
1050 dump_omp_clauses (pretty_printer
*pp
, tree clause
, int spc
, int flags
)
1058 dump_omp_clause (pp
, clause
, spc
, flags
);
1059 clause
= OMP_CLAUSE_CHAIN (clause
);
1067 /* Dump location LOC to PP. */
1070 dump_location (pretty_printer
*pp
, location_t loc
)
1072 expanded_location xloc
= expand_location (loc
);
1074 pp_left_bracket (pp
);
1077 pp_string (pp
, xloc
.file
);
1078 pp_string (pp
, ":");
1080 pp_decimal_int (pp
, xloc
.line
);
1082 pp_decimal_int (pp
, xloc
.column
);
1083 pp_string (pp
, "] ");
1087 /* Dump lexical block BLOCK. PP, SPC and FLAGS are as in
1088 dump_generic_node. */
1091 dump_block_node (pretty_printer
*pp
, tree block
, int spc
, int flags
)
1095 pp_printf (pp
, "BLOCK #%d ", BLOCK_NUMBER (block
));
1097 if (flags
& TDF_ADDRESS
)
1098 pp_printf (pp
, "[%p] ", (void *) block
);
1100 if (BLOCK_ABSTRACT (block
))
1101 pp_string (pp
, "[abstract] ");
1103 if (TREE_ASM_WRITTEN (block
))
1104 pp_string (pp
, "[written] ");
1106 if (flags
& TDF_SLIM
)
1109 if (BLOCK_SOURCE_LOCATION (block
))
1110 dump_location (pp
, BLOCK_SOURCE_LOCATION (block
));
1112 newline_and_indent (pp
, spc
+ 2);
1114 if (BLOCK_SUPERCONTEXT (block
))
1116 pp_string (pp
, "SUPERCONTEXT: ");
1117 dump_generic_node (pp
, BLOCK_SUPERCONTEXT (block
), 0,
1118 flags
| TDF_SLIM
, false);
1119 newline_and_indent (pp
, spc
+ 2);
1122 if (BLOCK_SUBBLOCKS (block
))
1124 pp_string (pp
, "SUBBLOCKS: ");
1125 for (t
= BLOCK_SUBBLOCKS (block
); t
; t
= BLOCK_CHAIN (t
))
1127 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
1130 newline_and_indent (pp
, spc
+ 2);
1133 if (BLOCK_CHAIN (block
))
1135 pp_string (pp
, "SIBLINGS: ");
1136 for (t
= BLOCK_CHAIN (block
); t
; t
= BLOCK_CHAIN (t
))
1138 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
1141 newline_and_indent (pp
, spc
+ 2);
1144 if (BLOCK_VARS (block
))
1146 pp_string (pp
, "VARS: ");
1147 for (t
= BLOCK_VARS (block
); t
; t
= TREE_CHAIN (t
))
1149 dump_generic_node (pp
, t
, 0, flags
, false);
1152 newline_and_indent (pp
, spc
+ 2);
1155 if (vec_safe_length (BLOCK_NONLOCALIZED_VARS (block
)) > 0)
1158 vec
<tree
, va_gc
> *nlv
= BLOCK_NONLOCALIZED_VARS (block
);
1160 pp_string (pp
, "NONLOCALIZED_VARS: ");
1161 FOR_EACH_VEC_ELT (*nlv
, i
, t
)
1163 dump_generic_node (pp
, t
, 0, flags
, false);
1166 newline_and_indent (pp
, spc
+ 2);
1169 if (BLOCK_ABSTRACT_ORIGIN (block
))
1171 pp_string (pp
, "ABSTRACT_ORIGIN: ");
1172 dump_generic_node (pp
, BLOCK_ABSTRACT_ORIGIN (block
), 0,
1173 flags
| TDF_SLIM
, false);
1174 newline_and_indent (pp
, spc
+ 2);
1177 if (BLOCK_FRAGMENT_ORIGIN (block
))
1179 pp_string (pp
, "FRAGMENT_ORIGIN: ");
1180 dump_generic_node (pp
, BLOCK_FRAGMENT_ORIGIN (block
), 0,
1181 flags
| TDF_SLIM
, false);
1182 newline_and_indent (pp
, spc
+ 2);
1185 if (BLOCK_FRAGMENT_CHAIN (block
))
1187 pp_string (pp
, "FRAGMENT_CHAIN: ");
1188 for (t
= BLOCK_FRAGMENT_CHAIN (block
); t
; t
= BLOCK_FRAGMENT_CHAIN (t
))
1190 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
1193 newline_and_indent (pp
, spc
+ 2);
1198 /* Dump the node NODE on the pretty_printer PP, SPC spaces of
1199 indent. FLAGS specifies details to show in the dump (see TDF_* in
1200 dumpfile.h). If IS_STMT is true, the object printed is considered
1201 to be a statement and it is terminated by ';' if appropriate. */
1204 dump_generic_node (pretty_printer
*pp
, tree node
, int spc
, int flags
,
1211 enum tree_code code
;
1213 if (node
== NULL_TREE
)
1216 is_expr
= EXPR_P (node
);
1218 if (is_stmt
&& (flags
& TDF_STMTADDR
))
1219 pp_printf (pp
, "<&%p> ", (void *)node
);
1221 if ((flags
& TDF_LINENO
) && EXPR_HAS_LOCATION (node
))
1222 dump_location (pp
, EXPR_LOCATION (node
));
1224 code
= TREE_CODE (node
);
1228 pp_string (pp
, "<<< error >>>");
1231 case IDENTIFIER_NODE
:
1232 pp_tree_identifier (pp
, node
);
1236 while (node
&& node
!= error_mark_node
)
1238 if (TREE_PURPOSE (node
))
1240 dump_generic_node (pp
, TREE_PURPOSE (node
), spc
, flags
, false);
1243 dump_generic_node (pp
, TREE_VALUE (node
), spc
, flags
, false);
1244 node
= TREE_CHAIN (node
);
1245 if (node
&& TREE_CODE (node
) == TREE_LIST
)
1254 dump_generic_node (pp
, BINFO_TYPE (node
), spc
, flags
, false);
1260 if (TREE_VEC_LENGTH (node
) > 0)
1262 size_t len
= TREE_VEC_LENGTH (node
);
1263 for (i
= 0; i
< len
- 1; i
++)
1265 dump_generic_node (pp
, TREE_VEC_ELT (node
, i
), spc
, flags
,
1270 dump_generic_node (pp
, TREE_VEC_ELT (node
, len
- 1), spc
,
1277 case POINTER_BOUNDS_TYPE
:
1280 case FIXED_POINT_TYPE
:
1286 unsigned int quals
= TYPE_QUALS (node
);
1287 enum tree_code_class tclass
;
1289 if (quals
& TYPE_QUAL_ATOMIC
)
1290 pp_string (pp
, "atomic ");
1291 if (quals
& TYPE_QUAL_CONST
)
1292 pp_string (pp
, "const ");
1293 else if (quals
& TYPE_QUAL_VOLATILE
)
1294 pp_string (pp
, "volatile ");
1295 else if (quals
& TYPE_QUAL_RESTRICT
)
1296 pp_string (pp
, "restrict ");
1298 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
1300 pp_string (pp
, "<address-space-");
1301 pp_decimal_int (pp
, TYPE_ADDR_SPACE (node
));
1302 pp_string (pp
, "> ");
1305 tclass
= TREE_CODE_CLASS (TREE_CODE (node
));
1307 if (tclass
== tcc_declaration
)
1309 if (DECL_NAME (node
))
1310 dump_decl_name (pp
, node
, flags
);
1312 pp_string (pp
, "<unnamed type decl>");
1314 else if (tclass
== tcc_type
)
1316 if (TYPE_NAME (node
))
1318 if (TREE_CODE (TYPE_NAME (node
)) == IDENTIFIER_NODE
)
1319 pp_tree_identifier (pp
, TYPE_NAME (node
));
1320 else if (TREE_CODE (TYPE_NAME (node
)) == TYPE_DECL
1321 && DECL_NAME (TYPE_NAME (node
)))
1322 dump_decl_name (pp
, TYPE_NAME (node
), flags
);
1324 pp_string (pp
, "<unnamed type>");
1326 else if (TREE_CODE (node
) == VECTOR_TYPE
)
1328 pp_string (pp
, "vector");
1330 pp_wide_integer (pp
, TYPE_VECTOR_SUBPARTS (node
));
1331 pp_string (pp
, ") ");
1332 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1334 else if (TREE_CODE (node
) == INTEGER_TYPE
)
1336 if (TYPE_PRECISION (node
) == CHAR_TYPE_SIZE
)
1337 pp_string (pp
, (TYPE_UNSIGNED (node
)
1340 else if (TYPE_PRECISION (node
) == SHORT_TYPE_SIZE
)
1341 pp_string (pp
, (TYPE_UNSIGNED (node
)
1344 else if (TYPE_PRECISION (node
) == INT_TYPE_SIZE
)
1345 pp_string (pp
, (TYPE_UNSIGNED (node
)
1348 else if (TYPE_PRECISION (node
) == LONG_TYPE_SIZE
)
1349 pp_string (pp
, (TYPE_UNSIGNED (node
)
1352 else if (TYPE_PRECISION (node
) == LONG_LONG_TYPE_SIZE
)
1353 pp_string (pp
, (TYPE_UNSIGNED (node
)
1354 ? "unsigned long long"
1355 : "signed long long"));
1356 else if (TYPE_PRECISION (node
) >= CHAR_TYPE_SIZE
1357 && pow2p_hwi (TYPE_PRECISION (node
)))
1359 pp_string (pp
, (TYPE_UNSIGNED (node
) ? "uint" : "int"));
1360 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1361 pp_string (pp
, "_t");
1365 pp_string (pp
, (TYPE_UNSIGNED (node
)
1366 ? "<unnamed-unsigned:"
1367 : "<unnamed-signed:"));
1368 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1372 else if (TREE_CODE (node
) == COMPLEX_TYPE
)
1374 pp_string (pp
, "__complex__ ");
1375 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1377 else if (TREE_CODE (node
) == REAL_TYPE
)
1379 pp_string (pp
, "<float:");
1380 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1383 else if (TREE_CODE (node
) == FIXED_POINT_TYPE
)
1385 pp_string (pp
, "<fixed-point-");
1386 pp_string (pp
, TYPE_SATURATING (node
) ? "sat:" : "nonsat:");
1387 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1390 else if (TREE_CODE (node
) == VOID_TYPE
)
1391 pp_string (pp
, "void");
1393 pp_string (pp
, "<unnamed type>");
1399 case REFERENCE_TYPE
:
1400 str
= (TREE_CODE (node
) == POINTER_TYPE
? "*" : "&");
1402 if (TREE_TYPE (node
) == NULL
)
1404 pp_string (pp
, str
);
1405 pp_string (pp
, "<null type>");
1407 else if (TREE_CODE (TREE_TYPE (node
)) == FUNCTION_TYPE
)
1409 tree fnode
= TREE_TYPE (node
);
1411 dump_generic_node (pp
, TREE_TYPE (fnode
), spc
, flags
, false);
1414 pp_string (pp
, str
);
1415 if (TYPE_NAME (node
) && DECL_NAME (TYPE_NAME (node
)))
1416 dump_decl_name (pp
, TYPE_NAME (node
), flags
);
1417 else if (flags
& TDF_NOUID
)
1418 pp_printf (pp
, "<Txxxx>");
1420 pp_printf (pp
, "<T%x>", TYPE_UID (node
));
1422 pp_right_paren (pp
);
1423 dump_function_declaration (pp
, fnode
, spc
, flags
);
1427 unsigned int quals
= TYPE_QUALS (node
);
1429 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1431 pp_string (pp
, str
);
1433 if (quals
& TYPE_QUAL_CONST
)
1434 pp_string (pp
, " const");
1435 if (quals
& TYPE_QUAL_VOLATILE
)
1436 pp_string (pp
, " volatile");
1437 if (quals
& TYPE_QUAL_RESTRICT
)
1438 pp_string (pp
, " restrict");
1440 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
1442 pp_string (pp
, " <address-space-");
1443 pp_decimal_int (pp
, TYPE_ADDR_SPACE (node
));
1447 if (TYPE_REF_CAN_ALIAS_ALL (node
))
1448 pp_string (pp
, " {ref-all}");
1458 if (integer_zerop (TREE_OPERAND (node
, 1))
1459 /* Dump the types of INTEGER_CSTs explicitly, for we can't
1460 infer them and MEM_ATTR caching will share MEM_REFs
1461 with differently-typed op0s. */
1462 && TREE_CODE (TREE_OPERAND (node
, 0)) != INTEGER_CST
1463 /* Released SSA_NAMES have no TREE_TYPE. */
1464 && TREE_TYPE (TREE_OPERAND (node
, 0)) != NULL_TREE
1465 /* Same pointer types, but ignoring POINTER_TYPE vs.
1467 && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 0)))
1468 == TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 1))))
1469 && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (node
, 0)))
1470 == TYPE_MODE (TREE_TYPE (TREE_OPERAND (node
, 1))))
1471 && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node
, 0)))
1472 == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node
, 1))))
1473 /* Same value types ignoring qualifiers. */
1474 && (TYPE_MAIN_VARIANT (TREE_TYPE (node
))
1475 == TYPE_MAIN_VARIANT
1476 (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 1)))))
1477 && (!(flags
& TDF_ALIAS
)
1478 || MR_DEPENDENCE_CLIQUE (node
) == 0))
1480 if (TREE_CODE (TREE_OPERAND (node
, 0)) != ADDR_EXPR
)
1483 dump_generic_node (pp
, TREE_OPERAND (node
, 0),
1487 dump_generic_node (pp
,
1488 TREE_OPERAND (TREE_OPERAND (node
, 0), 0),
1495 pp_string (pp
, "MEM[");
1497 ptype
= TYPE_MAIN_VARIANT (TREE_TYPE (TREE_OPERAND (node
, 1)));
1498 dump_generic_node (pp
, ptype
,
1499 spc
, flags
| TDF_SLIM
, false);
1500 pp_right_paren (pp
);
1501 dump_generic_node (pp
, TREE_OPERAND (node
, 0),
1503 if (!integer_zerop (TREE_OPERAND (node
, 1)))
1505 pp_string (pp
, " + ");
1506 dump_generic_node (pp
, TREE_OPERAND (node
, 1),
1509 if ((flags
& TDF_ALIAS
)
1510 && MR_DEPENDENCE_CLIQUE (node
) != 0)
1512 pp_string (pp
, " clique ");
1513 pp_unsigned_wide_integer (pp
, MR_DEPENDENCE_CLIQUE (node
));
1514 pp_string (pp
, " base ");
1515 pp_unsigned_wide_integer (pp
, MR_DEPENDENCE_BASE (node
));
1517 pp_right_bracket (pp
);
1522 case TARGET_MEM_REF
:
1524 const char *sep
= "";
1527 pp_string (pp
, "MEM[");
1529 if (TREE_CODE (TMR_BASE (node
)) == ADDR_EXPR
)
1531 pp_string (pp
, sep
);
1533 pp_string (pp
, "symbol: ");
1534 dump_generic_node (pp
, TREE_OPERAND (TMR_BASE (node
), 0),
1539 pp_string (pp
, sep
);
1541 pp_string (pp
, "base: ");
1542 dump_generic_node (pp
, TMR_BASE (node
), spc
, flags
, false);
1544 tmp
= TMR_INDEX2 (node
);
1547 pp_string (pp
, sep
);
1549 pp_string (pp
, "base: ");
1550 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1552 tmp
= TMR_INDEX (node
);
1555 pp_string (pp
, sep
);
1557 pp_string (pp
, "index: ");
1558 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1560 tmp
= TMR_STEP (node
);
1563 pp_string (pp
, sep
);
1565 pp_string (pp
, "step: ");
1566 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1568 tmp
= TMR_OFFSET (node
);
1571 pp_string (pp
, sep
);
1573 pp_string (pp
, "offset: ");
1574 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1576 pp_right_bracket (pp
);
1584 /* Print the innermost component type. */
1585 for (tmp
= TREE_TYPE (node
); TREE_CODE (tmp
) == ARRAY_TYPE
;
1586 tmp
= TREE_TYPE (tmp
))
1588 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1590 /* Print the dimensions. */
1591 for (tmp
= node
; TREE_CODE (tmp
) == ARRAY_TYPE
; tmp
= TREE_TYPE (tmp
))
1592 dump_array_domain (pp
, TYPE_DOMAIN (tmp
), spc
, flags
);
1598 case QUAL_UNION_TYPE
:
1600 unsigned int quals
= TYPE_QUALS (node
);
1602 if (quals
& TYPE_QUAL_ATOMIC
)
1603 pp_string (pp
, "atomic ");
1604 if (quals
& TYPE_QUAL_CONST
)
1605 pp_string (pp
, "const ");
1606 if (quals
& TYPE_QUAL_VOLATILE
)
1607 pp_string (pp
, "volatile ");
1609 /* Print the name of the structure. */
1610 if (TREE_CODE (node
) == RECORD_TYPE
)
1611 pp_string (pp
, "struct ");
1612 else if (TREE_CODE (node
) == UNION_TYPE
)
1613 pp_string (pp
, "union ");
1615 if (TYPE_NAME (node
))
1616 dump_generic_node (pp
, TYPE_NAME (node
), spc
, flags
, false);
1617 else if (!(flags
& TDF_SLIM
))
1618 /* FIXME: If we eliminate the 'else' above and attempt
1619 to show the fields for named types, we may get stuck
1620 following a cycle of pointers to structs. The alleged
1621 self-reference check in print_struct_decl will not detect
1622 cycles involving more than one pointer or struct type. */
1623 print_struct_decl (pp
, node
, spc
, flags
);
1632 if (TREE_CODE (TREE_TYPE (node
)) == POINTER_TYPE
)
1634 /* In the case of a pointer, one may want to divide by the
1635 size of the pointed-to type. Unfortunately, this not
1636 straightforward. The C front-end maps expressions
1641 in such a way that the two INTEGER_CST nodes for "5" have
1642 different values but identical types. In the latter
1643 case, the 5 is multiplied by sizeof (int) in c-common.c
1644 (pointer_int_sum) to convert it to a byte address, and
1645 yet the type of the node is left unchanged. Argh. What
1646 is consistent though is that the number value corresponds
1647 to bytes (UNITS) offset.
1649 NB: Neither of the following divisors can be trivially
1650 used to recover the original literal:
1652 TREE_INT_CST_LOW (TYPE_SIZE_UNIT (TREE_TYPE (node)))
1653 TYPE_PRECISION (TREE_TYPE (TREE_TYPE (node))) */
1654 pp_wide_integer (pp
, TREE_INT_CST_LOW (node
));
1655 pp_string (pp
, "B"); /* pseudo-unit */
1657 else if (tree_fits_shwi_p (node
))
1658 pp_wide_integer (pp
, tree_to_shwi (node
));
1659 else if (tree_fits_uhwi_p (node
))
1660 pp_unsigned_wide_integer (pp
, tree_to_uhwi (node
));
1663 wide_int val
= node
;
1665 if (wi::neg_p (val
, TYPE_SIGN (TREE_TYPE (node
))))
1670 print_hex (val
, pp_buffer (pp
)->digit_buffer
);
1671 pp_string (pp
, pp_buffer (pp
)->digit_buffer
);
1673 if (TREE_OVERFLOW (node
))
1674 pp_string (pp
, "(OVF)");
1678 /* Code copied from print_node. */
1681 if (TREE_OVERFLOW (node
))
1682 pp_string (pp
, " overflow");
1684 d
= TREE_REAL_CST (node
);
1685 if (REAL_VALUE_ISINF (d
))
1686 pp_string (pp
, REAL_VALUE_NEGATIVE (d
) ? " -Inf" : " Inf");
1687 else if (REAL_VALUE_ISNAN (d
))
1688 pp_string (pp
, " Nan");
1692 real_to_decimal (string
, &d
, sizeof (string
), 0, 1);
1693 pp_string (pp
, string
);
1701 fixed_to_decimal (string
, TREE_FIXED_CST_PTR (node
), sizeof (string
));
1702 pp_string (pp
, string
);
1707 pp_string (pp
, "__complex__ (");
1708 dump_generic_node (pp
, TREE_REALPART (node
), spc
, flags
, false);
1709 pp_string (pp
, ", ");
1710 dump_generic_node (pp
, TREE_IMAGPART (node
), spc
, flags
, false);
1711 pp_right_paren (pp
);
1715 pp_string (pp
, "\"");
1716 pretty_print_string (pp
, TREE_STRING_POINTER (node
));
1717 pp_string (pp
, "\"");
1723 pp_string (pp
, "{ ");
1724 for (i
= 0; i
< VECTOR_CST_NELTS (node
); ++i
)
1727 pp_string (pp
, ", ");
1728 dump_generic_node (pp
, VECTOR_CST_ELT (node
, i
),
1731 pp_string (pp
, " }");
1737 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1739 if (TREE_CODE (node
) == METHOD_TYPE
)
1741 if (TYPE_METHOD_BASETYPE (node
))
1742 dump_decl_name (pp
, TYPE_NAME (TYPE_METHOD_BASETYPE (node
)),
1745 pp_string (pp
, "<null method basetype>");
1746 pp_colon_colon (pp
);
1748 if (TYPE_NAME (node
) && DECL_NAME (TYPE_NAME (node
)))
1749 dump_decl_name (pp
, TYPE_NAME (node
), flags
);
1750 else if (flags
& TDF_NOUID
)
1751 pp_printf (pp
, "<Txxxx>");
1753 pp_printf (pp
, "<T%x>", TYPE_UID (node
));
1754 dump_function_declaration (pp
, node
, spc
, flags
);
1759 dump_decl_name (pp
, node
, flags
);
1763 if (DECL_NAME (node
))
1764 dump_decl_name (pp
, node
, flags
);
1765 else if (LABEL_DECL_UID (node
) != -1)
1767 if (flags
& TDF_GIMPLE
)
1768 pp_printf (pp
, "L%d", (int) LABEL_DECL_UID (node
));
1770 pp_printf (pp
, "<L%d>", (int) LABEL_DECL_UID (node
));
1774 if (flags
& TDF_NOUID
)
1775 pp_string (pp
, "<D.xxxx>");
1778 if (flags
& TDF_GIMPLE
)
1779 pp_printf (pp
, "<D%u>", DECL_UID (node
));
1781 pp_printf (pp
, "<D.%u>", DECL_UID (node
));
1787 if (DECL_IS_BUILTIN (node
))
1789 /* Don't print the declaration of built-in types. */
1792 if (DECL_NAME (node
))
1793 dump_decl_name (pp
, node
, flags
);
1794 else if (TYPE_NAME (TREE_TYPE (node
)) != node
)
1796 if ((TREE_CODE (TREE_TYPE (node
)) == RECORD_TYPE
1797 || TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
)
1798 && TYPE_METHODS (TREE_TYPE (node
)))
1800 /* The type is a c++ class: all structures have at least
1802 pp_string (pp
, "class ");
1803 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1808 (TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
1809 ? "union" : "struct "));
1810 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1814 pp_string (pp
, "<anon>");
1820 case DEBUG_EXPR_DECL
:
1821 case NAMESPACE_DECL
:
1823 dump_decl_name (pp
, node
, flags
);
1827 pp_string (pp
, "<retval>");
1831 op0
= TREE_OPERAND (node
, 0);
1834 && (TREE_CODE (op0
) == INDIRECT_REF
1835 || (TREE_CODE (op0
) == MEM_REF
1836 && TREE_CODE (TREE_OPERAND (op0
, 0)) != ADDR_EXPR
1837 && integer_zerop (TREE_OPERAND (op0
, 1))
1838 /* Dump the types of INTEGER_CSTs explicitly, for we
1839 can't infer them and MEM_ATTR caching will share
1840 MEM_REFs with differently-typed op0s. */
1841 && TREE_CODE (TREE_OPERAND (op0
, 0)) != INTEGER_CST
1842 /* Released SSA_NAMES have no TREE_TYPE. */
1843 && TREE_TYPE (TREE_OPERAND (op0
, 0)) != NULL_TREE
1844 /* Same pointer types, but ignoring POINTER_TYPE vs.
1846 && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 0)))
1847 == TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 1))))
1848 && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0
, 0)))
1849 == TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0
, 1))))
1850 && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0
, 0)))
1851 == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0
, 1))))
1852 /* Same value types ignoring qualifiers. */
1853 && (TYPE_MAIN_VARIANT (TREE_TYPE (op0
))
1854 == TYPE_MAIN_VARIANT
1855 (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 1)))))
1856 && MR_DEPENDENCE_CLIQUE (op0
) == 0)))
1858 op0
= TREE_OPERAND (op0
, 0);
1861 if (op_prio (op0
) < op_prio (node
))
1863 dump_generic_node (pp
, op0
, spc
, flags
, false);
1864 if (op_prio (op0
) < op_prio (node
))
1865 pp_right_paren (pp
);
1866 pp_string (pp
, str
);
1867 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1868 op0
= component_ref_field_offset (node
);
1869 if (op0
&& TREE_CODE (op0
) != INTEGER_CST
)
1871 pp_string (pp
, "{off: ");
1872 dump_generic_node (pp
, op0
, spc
, flags
, false);
1873 pp_right_brace (pp
);
1878 pp_string (pp
, "BIT_FIELD_REF <");
1879 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1880 pp_string (pp
, ", ");
1881 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1882 pp_string (pp
, ", ");
1883 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
1887 case BIT_INSERT_EXPR
:
1888 pp_string (pp
, "BIT_INSERT_EXPR <");
1889 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1890 pp_string (pp
, ", ");
1891 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1892 pp_string (pp
, ", ");
1893 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
1894 pp_string (pp
, " (");
1895 if (INTEGRAL_TYPE_P (TREE_TYPE (TREE_OPERAND (node
, 1))))
1897 TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (node
, 1))));
1899 dump_generic_node (pp
, TYPE_SIZE (TREE_TYPE (TREE_OPERAND (node
, 1))),
1901 pp_string (pp
, " bits)>");
1905 case ARRAY_RANGE_REF
:
1906 op0
= TREE_OPERAND (node
, 0);
1907 if (op_prio (op0
) < op_prio (node
))
1909 dump_generic_node (pp
, op0
, spc
, flags
, false);
1910 if (op_prio (op0
) < op_prio (node
))
1911 pp_right_paren (pp
);
1912 pp_left_bracket (pp
);
1913 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1914 if (TREE_CODE (node
) == ARRAY_RANGE_REF
)
1915 pp_string (pp
, " ...");
1916 pp_right_bracket (pp
);
1918 op0
= array_ref_low_bound (node
);
1919 op1
= array_ref_element_size (node
);
1921 if (!integer_zerop (op0
)
1922 || TREE_OPERAND (node
, 2)
1923 || TREE_OPERAND (node
, 3))
1925 pp_string (pp
, "{lb: ");
1926 dump_generic_node (pp
, op0
, spc
, flags
, false);
1927 pp_string (pp
, " sz: ");
1928 dump_generic_node (pp
, op1
, spc
, flags
, false);
1929 pp_right_brace (pp
);
1935 unsigned HOST_WIDE_INT ix
;
1937 bool is_struct_init
= false;
1938 bool is_array_init
= false;
1941 if (TREE_CLOBBER_P (node
))
1942 pp_string (pp
, "CLOBBER");
1943 else if (TREE_CODE (TREE_TYPE (node
)) == RECORD_TYPE
1944 || TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
)
1945 is_struct_init
= true;
1946 else if (TREE_CODE (TREE_TYPE (node
)) == ARRAY_TYPE
1947 && TYPE_DOMAIN (TREE_TYPE (node
))
1948 && TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
)))
1949 && TREE_CODE (TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
))))
1952 tree minv
= TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
)));
1953 is_array_init
= true;
1954 curidx
= wi::to_widest (minv
);
1956 FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (node
), ix
, field
, val
)
1963 dump_generic_node (pp
, field
, spc
, flags
, false);
1966 else if (is_array_init
1967 && (TREE_CODE (field
) != INTEGER_CST
1968 || curidx
!= wi::to_widest (field
)))
1970 pp_left_bracket (pp
);
1971 if (TREE_CODE (field
) == RANGE_EXPR
)
1973 dump_generic_node (pp
, TREE_OPERAND (field
, 0), spc
,
1975 pp_string (pp
, " ... ");
1976 dump_generic_node (pp
, TREE_OPERAND (field
, 1), spc
,
1978 if (TREE_CODE (TREE_OPERAND (field
, 1)) == INTEGER_CST
)
1979 curidx
= wi::to_widest (TREE_OPERAND (field
, 1));
1982 dump_generic_node (pp
, field
, spc
, flags
, false);
1983 if (TREE_CODE (field
) == INTEGER_CST
)
1984 curidx
= wi::to_widest (field
);
1985 pp_string (pp
, "]=");
1990 if (val
&& TREE_CODE (val
) == ADDR_EXPR
)
1991 if (TREE_CODE (TREE_OPERAND (val
, 0)) == FUNCTION_DECL
)
1992 val
= TREE_OPERAND (val
, 0);
1993 if (val
&& TREE_CODE (val
) == FUNCTION_DECL
)
1994 dump_decl_name (pp
, val
, flags
);
1996 dump_generic_node (pp
, val
, spc
, flags
, false);
1997 if (ix
!= CONSTRUCTOR_NELTS (node
) - 1)
2003 pp_right_brace (pp
);
2010 if (flags
& TDF_SLIM
)
2012 pp_string (pp
, "<COMPOUND_EXPR>");
2016 dump_generic_node (pp
, TREE_OPERAND (node
, 0),
2017 spc
, flags
, !(flags
& TDF_SLIM
));
2018 if (flags
& TDF_SLIM
)
2019 newline_and_indent (pp
, spc
);
2026 for (tp
= &TREE_OPERAND (node
, 1);
2027 TREE_CODE (*tp
) == COMPOUND_EXPR
;
2028 tp
= &TREE_OPERAND (*tp
, 1))
2030 dump_generic_node (pp
, TREE_OPERAND (*tp
, 0),
2031 spc
, flags
, !(flags
& TDF_SLIM
));
2032 if (flags
& TDF_SLIM
)
2033 newline_and_indent (pp
, spc
);
2041 dump_generic_node (pp
, *tp
, spc
, flags
, !(flags
& TDF_SLIM
));
2045 case STATEMENT_LIST
:
2047 tree_stmt_iterator si
;
2050 if (flags
& TDF_SLIM
)
2052 pp_string (pp
, "<STATEMENT_LIST>");
2056 for (si
= tsi_start (node
); !tsi_end_p (si
); tsi_next (&si
))
2059 newline_and_indent (pp
, spc
);
2062 dump_generic_node (pp
, tsi_stmt (si
), spc
, flags
, true);
2069 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
,
2074 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
,
2079 pp_string (pp
, "TARGET_EXPR <");
2080 dump_generic_node (pp
, TARGET_EXPR_SLOT (node
), spc
, flags
, false);
2083 dump_generic_node (pp
, TARGET_EXPR_INITIAL (node
), spc
, flags
, false);
2088 print_declaration (pp
, DECL_EXPR_DECL (node
), spc
, flags
);
2093 if (TREE_TYPE (node
) == NULL
|| TREE_TYPE (node
) == void_type_node
)
2095 pp_string (pp
, "if (");
2096 dump_generic_node (pp
, COND_EXPR_COND (node
), spc
, flags
, false);
2097 pp_right_paren (pp
);
2098 /* The lowered cond_exprs should always be printed in full. */
2099 if (COND_EXPR_THEN (node
)
2100 && (IS_EMPTY_STMT (COND_EXPR_THEN (node
))
2101 || TREE_CODE (COND_EXPR_THEN (node
)) == GOTO_EXPR
)
2102 && COND_EXPR_ELSE (node
)
2103 && (IS_EMPTY_STMT (COND_EXPR_ELSE (node
))
2104 || TREE_CODE (COND_EXPR_ELSE (node
)) == GOTO_EXPR
))
2107 dump_generic_node (pp
, COND_EXPR_THEN (node
),
2109 if (!IS_EMPTY_STMT (COND_EXPR_ELSE (node
)))
2111 pp_string (pp
, " else ");
2112 dump_generic_node (pp
, COND_EXPR_ELSE (node
),
2116 else if (!(flags
& TDF_SLIM
))
2118 /* Output COND_EXPR_THEN. */
2119 if (COND_EXPR_THEN (node
))
2121 newline_and_indent (pp
, spc
+2);
2123 newline_and_indent (pp
, spc
+4);
2124 dump_generic_node (pp
, COND_EXPR_THEN (node
), spc
+4,
2126 newline_and_indent (pp
, spc
+2);
2127 pp_right_brace (pp
);
2130 /* Output COND_EXPR_ELSE. */
2131 if (COND_EXPR_ELSE (node
)
2132 && !IS_EMPTY_STMT (COND_EXPR_ELSE (node
)))
2134 newline_and_indent (pp
, spc
);
2135 pp_string (pp
, "else");
2136 newline_and_indent (pp
, spc
+2);
2138 newline_and_indent (pp
, spc
+4);
2139 dump_generic_node (pp
, COND_EXPR_ELSE (node
), spc
+4,
2141 newline_and_indent (pp
, spc
+2);
2142 pp_right_brace (pp
);
2149 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2153 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2157 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2163 if (!(flags
& TDF_SLIM
))
2165 if (BIND_EXPR_VARS (node
))
2169 for (op0
= BIND_EXPR_VARS (node
); op0
; op0
= DECL_CHAIN (op0
))
2171 print_declaration (pp
, op0
, spc
+2, flags
);
2176 newline_and_indent (pp
, spc
+2);
2177 dump_generic_node (pp
, BIND_EXPR_BODY (node
), spc
+2, flags
, true);
2178 newline_and_indent (pp
, spc
);
2179 pp_right_brace (pp
);
2185 if (CALL_EXPR_FN (node
) != NULL_TREE
)
2186 print_call_name (pp
, CALL_EXPR_FN (node
), flags
);
2188 pp_string (pp
, internal_fn_name (CALL_EXPR_IFN (node
)));
2190 /* Print parameters. */
2195 call_expr_arg_iterator iter
;
2196 FOR_EACH_CALL_EXPR_ARG (arg
, iter
, node
)
2198 dump_generic_node (pp
, arg
, spc
, flags
, false);
2199 if (more_call_expr_args_p (&iter
))
2206 if (CALL_EXPR_VA_ARG_PACK (node
))
2208 if (call_expr_nargs (node
) > 0)
2213 pp_string (pp
, "__builtin_va_arg_pack ()");
2215 pp_right_paren (pp
);
2217 op1
= CALL_EXPR_STATIC_CHAIN (node
);
2220 pp_string (pp
, " [static-chain: ");
2221 dump_generic_node (pp
, op1
, spc
, flags
, false);
2222 pp_right_bracket (pp
);
2225 if (CALL_EXPR_RETURN_SLOT_OPT (node
))
2226 pp_string (pp
, " [return slot optimization]");
2227 if (CALL_EXPR_TAILCALL (node
))
2228 pp_string (pp
, " [tail call]");
2231 case WITH_CLEANUP_EXPR
:
2235 case CLEANUP_POINT_EXPR
:
2236 pp_string (pp
, "<<cleanup_point ");
2237 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2238 pp_string (pp
, ">>");
2241 case PLACEHOLDER_EXPR
:
2242 pp_string (pp
, "<PLACEHOLDER_EXPR ");
2243 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2247 /* Binary arithmetic and logic expressions. */
2248 case WIDEN_SUM_EXPR
:
2249 case WIDEN_MULT_EXPR
:
2251 case MULT_HIGHPART_EXPR
:
2253 case POINTER_PLUS_EXPR
:
2255 case TRUNC_DIV_EXPR
:
2257 case FLOOR_DIV_EXPR
:
2258 case ROUND_DIV_EXPR
:
2259 case TRUNC_MOD_EXPR
:
2261 case FLOOR_MOD_EXPR
:
2262 case ROUND_MOD_EXPR
:
2264 case EXACT_DIV_EXPR
:
2269 case WIDEN_LSHIFT_EXPR
:
2273 case TRUTH_ANDIF_EXPR
:
2274 case TRUTH_ORIF_EXPR
:
2275 case TRUTH_AND_EXPR
:
2277 case TRUTH_XOR_EXPR
:
2291 case UNORDERED_EXPR
:
2293 const char *op
= op_symbol (node
);
2294 op0
= TREE_OPERAND (node
, 0);
2295 op1
= TREE_OPERAND (node
, 1);
2297 /* When the operands are expressions with less priority,
2298 keep semantics of the tree representation. */
2299 if (op_prio (op0
) <= op_prio (node
))
2302 dump_generic_node (pp
, op0
, spc
, flags
, false);
2303 pp_right_paren (pp
);
2306 dump_generic_node (pp
, op0
, spc
, flags
, false);
2312 /* When the operands are expressions with less priority,
2313 keep semantics of the tree representation. */
2314 if (op_prio (op1
) <= op_prio (node
))
2317 dump_generic_node (pp
, op1
, spc
, flags
, false);
2318 pp_right_paren (pp
);
2321 dump_generic_node (pp
, op1
, spc
, flags
, false);
2325 /* Unary arithmetic and logic expressions. */
2328 case TRUTH_NOT_EXPR
:
2330 case PREDECREMENT_EXPR
:
2331 case PREINCREMENT_EXPR
:
2333 if (TREE_CODE (node
) == ADDR_EXPR
2334 && (TREE_CODE (TREE_OPERAND (node
, 0)) == STRING_CST
2335 || TREE_CODE (TREE_OPERAND (node
, 0)) == FUNCTION_DECL
))
2336 ; /* Do not output '&' for strings and function pointers. */
2338 pp_string (pp
, op_symbol (node
));
2340 if (op_prio (TREE_OPERAND (node
, 0)) < op_prio (node
))
2343 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2344 pp_right_paren (pp
);
2347 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2350 case POSTDECREMENT_EXPR
:
2351 case POSTINCREMENT_EXPR
:
2352 if (op_prio (TREE_OPERAND (node
, 0)) < op_prio (node
))
2355 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2356 pp_right_paren (pp
);
2359 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2360 pp_string (pp
, op_symbol (node
));
2364 pp_string (pp
, "MIN_EXPR <");
2365 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2366 pp_string (pp
, ", ");
2367 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2372 pp_string (pp
, "MAX_EXPR <");
2373 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2374 pp_string (pp
, ", ");
2375 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2380 pp_string (pp
, "ABS_EXPR <");
2381 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2389 case ADDR_SPACE_CONVERT_EXPR
:
2390 case FIXED_CONVERT_EXPR
:
2391 case FIX_TRUNC_EXPR
:
2394 type
= TREE_TYPE (node
);
2395 op0
= TREE_OPERAND (node
, 0);
2396 if (type
!= TREE_TYPE (op0
))
2399 dump_generic_node (pp
, type
, spc
, flags
, false);
2400 pp_string (pp
, ") ");
2402 if (op_prio (op0
) < op_prio (node
))
2404 dump_generic_node (pp
, op0
, spc
, flags
, false);
2405 if (op_prio (op0
) < op_prio (node
))
2406 pp_right_paren (pp
);
2409 case VIEW_CONVERT_EXPR
:
2410 pp_string (pp
, "VIEW_CONVERT_EXPR<");
2411 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2412 pp_string (pp
, ">(");
2413 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2414 pp_right_paren (pp
);
2418 pp_string (pp
, "((");
2419 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2420 pp_string (pp
, "))");
2423 case NON_LVALUE_EXPR
:
2424 pp_string (pp
, "NON_LVALUE_EXPR <");
2425 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2430 pp_string (pp
, "SAVE_EXPR <");
2431 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2436 pp_string (pp
, "COMPLEX_EXPR <");
2437 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2438 pp_string (pp
, ", ");
2439 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2444 pp_string (pp
, "CONJ_EXPR <");
2445 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2450 pp_string (pp
, "REALPART_EXPR <");
2451 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2456 pp_string (pp
, "IMAGPART_EXPR <");
2457 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2462 pp_string (pp
, "VA_ARG_EXPR <");
2463 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2467 case TRY_FINALLY_EXPR
:
2468 case TRY_CATCH_EXPR
:
2469 pp_string (pp
, "try");
2470 newline_and_indent (pp
, spc
+2);
2472 newline_and_indent (pp
, spc
+4);
2473 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
+4, flags
, true);
2474 newline_and_indent (pp
, spc
+2);
2475 pp_right_brace (pp
);
2476 newline_and_indent (pp
, spc
);
2478 (TREE_CODE (node
) == TRY_CATCH_EXPR
) ? "catch" : "finally");
2479 newline_and_indent (pp
, spc
+2);
2481 newline_and_indent (pp
, spc
+4);
2482 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
+4, flags
, true);
2483 newline_and_indent (pp
, spc
+2);
2484 pp_right_brace (pp
);
2489 pp_string (pp
, "catch (");
2490 dump_generic_node (pp
, CATCH_TYPES (node
), spc
+2, flags
, false);
2491 pp_right_paren (pp
);
2492 newline_and_indent (pp
, spc
+2);
2494 newline_and_indent (pp
, spc
+4);
2495 dump_generic_node (pp
, CATCH_BODY (node
), spc
+4, flags
, true);
2496 newline_and_indent (pp
, spc
+2);
2497 pp_right_brace (pp
);
2501 case EH_FILTER_EXPR
:
2502 pp_string (pp
, "<<<eh_filter (");
2503 dump_generic_node (pp
, EH_FILTER_TYPES (node
), spc
+2, flags
, false);
2504 pp_string (pp
, ")>>>");
2505 newline_and_indent (pp
, spc
+2);
2507 newline_and_indent (pp
, spc
+4);
2508 dump_generic_node (pp
, EH_FILTER_FAILURE (node
), spc
+4, flags
, true);
2509 newline_and_indent (pp
, spc
+2);
2510 pp_right_brace (pp
);
2515 op0
= TREE_OPERAND (node
, 0);
2516 /* If this is for break or continue, don't bother printing it. */
2517 if (DECL_NAME (op0
))
2519 const char *name
= IDENTIFIER_POINTER (DECL_NAME (op0
));
2520 if (strcmp (name
, "break") == 0
2521 || strcmp (name
, "continue") == 0)
2524 dump_generic_node (pp
, op0
, spc
, flags
, false);
2526 if (DECL_NONLOCAL (op0
))
2527 pp_string (pp
, " [non-local]");
2531 pp_string (pp
, "while (1)");
2532 if (!(flags
& TDF_SLIM
))
2534 newline_and_indent (pp
, spc
+2);
2536 newline_and_indent (pp
, spc
+4);
2537 dump_generic_node (pp
, LOOP_EXPR_BODY (node
), spc
+4, flags
, true);
2538 newline_and_indent (pp
, spc
+2);
2539 pp_right_brace (pp
);
2545 pp_string (pp
, "// predicted ");
2546 if (PREDICT_EXPR_OUTCOME (node
))
2547 pp_string (pp
, "likely by ");
2549 pp_string (pp
, "unlikely by ");
2550 pp_string (pp
, predictor_name (PREDICT_EXPR_PREDICTOR (node
)));
2551 pp_string (pp
, " predictor.");
2555 pp_string (pp
, "ANNOTATE_EXPR <");
2556 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2557 switch ((enum annot_expr_kind
) TREE_INT_CST_LOW (TREE_OPERAND (node
, 1)))
2559 case annot_expr_ivdep_kind
:
2560 pp_string (pp
, ", ivdep");
2562 case annot_expr_no_vector_kind
:
2563 pp_string (pp
, ", no-vector");
2565 case annot_expr_vector_kind
:
2566 pp_string (pp
, ", vector");
2575 pp_string (pp
, "return");
2576 op0
= TREE_OPERAND (node
, 0);
2580 if (TREE_CODE (op0
) == MODIFY_EXPR
)
2581 dump_generic_node (pp
, TREE_OPERAND (op0
, 1),
2584 dump_generic_node (pp
, op0
, spc
, flags
, false);
2589 pp_string (pp
, "if (");
2590 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2591 pp_string (pp
, ") break");
2595 pp_string (pp
, "switch (");
2596 dump_generic_node (pp
, SWITCH_COND (node
), spc
, flags
, false);
2597 pp_right_paren (pp
);
2598 if (!(flags
& TDF_SLIM
))
2600 newline_and_indent (pp
, spc
+2);
2602 if (SWITCH_BODY (node
))
2604 newline_and_indent (pp
, spc
+4);
2605 dump_generic_node (pp
, SWITCH_BODY (node
), spc
+4, flags
,
2610 tree vec
= SWITCH_LABELS (node
);
2611 size_t i
, n
= TREE_VEC_LENGTH (vec
);
2612 for (i
= 0; i
< n
; ++i
)
2614 tree elt
= TREE_VEC_ELT (vec
, i
);
2615 newline_and_indent (pp
, spc
+4);
2618 dump_generic_node (pp
, elt
, spc
+4, flags
, false);
2619 pp_string (pp
, " goto ");
2620 dump_generic_node (pp
, CASE_LABEL (elt
), spc
+4,
2625 pp_string (pp
, "case ???: goto ???;");
2628 newline_and_indent (pp
, spc
+2);
2629 pp_right_brace (pp
);
2635 op0
= GOTO_DESTINATION (node
);
2636 if (TREE_CODE (op0
) != SSA_NAME
&& DECL_P (op0
) && DECL_NAME (op0
))
2638 const char *name
= IDENTIFIER_POINTER (DECL_NAME (op0
));
2639 if (strcmp (name
, "break") == 0
2640 || strcmp (name
, "continue") == 0)
2642 pp_string (pp
, name
);
2646 pp_string (pp
, "goto ");
2647 dump_generic_node (pp
, op0
, spc
, flags
, false);
2651 pp_string (pp
, "__asm__");
2652 if (ASM_VOLATILE_P (node
))
2653 pp_string (pp
, " __volatile__");
2655 dump_generic_node (pp
, ASM_STRING (node
), spc
, flags
, false);
2657 dump_generic_node (pp
, ASM_OUTPUTS (node
), spc
, flags
, false);
2659 dump_generic_node (pp
, ASM_INPUTS (node
), spc
, flags
, false);
2660 if (ASM_CLOBBERS (node
))
2663 dump_generic_node (pp
, ASM_CLOBBERS (node
), spc
, flags
, false);
2665 pp_right_paren (pp
);
2668 case CASE_LABEL_EXPR
:
2669 if (CASE_LOW (node
) && CASE_HIGH (node
))
2671 pp_string (pp
, "case ");
2672 dump_generic_node (pp
, CASE_LOW (node
), spc
, flags
, false);
2673 pp_string (pp
, " ... ");
2674 dump_generic_node (pp
, CASE_HIGH (node
), spc
, flags
, false);
2676 else if (CASE_LOW (node
))
2678 pp_string (pp
, "case ");
2679 dump_generic_node (pp
, CASE_LOW (node
), spc
, flags
, false);
2682 pp_string (pp
, "default");
2687 pp_string (pp
, "OBJ_TYPE_REF(");
2688 dump_generic_node (pp
, OBJ_TYPE_REF_EXPR (node
), spc
, flags
, false);
2690 if (!(flags
& TDF_SLIM
) && virtual_method_call_p (node
))
2692 pp_string (pp
, "(");
2693 dump_generic_node (pp
, obj_type_ref_class (node
), spc
, flags
, false);
2694 pp_string (pp
, ")");
2696 dump_generic_node (pp
, OBJ_TYPE_REF_OBJECT (node
), spc
, flags
, false);
2698 dump_generic_node (pp
, OBJ_TYPE_REF_TOKEN (node
), spc
, flags
, false);
2699 pp_right_paren (pp
);
2703 if (SSA_NAME_IDENTIFIER (node
))
2705 if ((flags
& TDF_NOUID
)
2706 && SSA_NAME_VAR (node
)
2707 && DECL_NAMELESS (SSA_NAME_VAR (node
)))
2708 dump_fancy_name (pp
, SSA_NAME_IDENTIFIER (node
));
2709 else if (! (flags
& TDF_GIMPLE
)
2710 || SSA_NAME_VAR (node
))
2711 dump_generic_node (pp
, SSA_NAME_IDENTIFIER (node
),
2715 pp_decimal_int (pp
, SSA_NAME_VERSION (node
));
2716 if (SSA_NAME_IS_DEFAULT_DEF (node
))
2717 pp_string (pp
, "(D)");
2718 if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (node
))
2719 pp_string (pp
, "(ab)");
2722 case WITH_SIZE_EXPR
:
2723 pp_string (pp
, "WITH_SIZE_EXPR <");
2724 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2725 pp_string (pp
, ", ");
2726 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2731 pp_string (pp
, "ASSERT_EXPR <");
2732 dump_generic_node (pp
, ASSERT_EXPR_VAR (node
), spc
, flags
, false);
2733 pp_string (pp
, ", ");
2734 dump_generic_node (pp
, ASSERT_EXPR_COND (node
), spc
, flags
, false);
2739 pp_string (pp
, "scev_known");
2742 case SCEV_NOT_KNOWN
:
2743 pp_string (pp
, "scev_not_known");
2746 case POLYNOMIAL_CHREC
:
2748 dump_generic_node (pp
, CHREC_LEFT (node
), spc
, flags
, false);
2749 pp_string (pp
, ", +, ");
2750 dump_generic_node (pp
, CHREC_RIGHT (node
), spc
, flags
, false);
2751 pp_string (pp
, "}_");
2752 dump_generic_node (pp
, CHREC_VAR (node
), spc
, flags
, false);
2756 case REALIGN_LOAD_EXPR
:
2757 pp_string (pp
, "REALIGN_LOAD <");
2758 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2759 pp_string (pp
, ", ");
2760 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2761 pp_string (pp
, ", ");
2762 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2767 pp_string (pp
, " VEC_COND_EXPR < ");
2768 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2769 pp_string (pp
, " , ");
2770 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2771 pp_string (pp
, " , ");
2772 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2773 pp_string (pp
, " > ");
2777 pp_string (pp
, " VEC_PERM_EXPR < ");
2778 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2779 pp_string (pp
, " , ");
2780 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2781 pp_string (pp
, " , ");
2782 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2783 pp_string (pp
, " > ");
2787 pp_string (pp
, " DOT_PROD_EXPR < ");
2788 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2789 pp_string (pp
, ", ");
2790 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2791 pp_string (pp
, ", ");
2792 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2793 pp_string (pp
, " > ");
2796 case WIDEN_MULT_PLUS_EXPR
:
2797 pp_string (pp
, " WIDEN_MULT_PLUS_EXPR < ");
2798 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2799 pp_string (pp
, ", ");
2800 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2801 pp_string (pp
, ", ");
2802 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2803 pp_string (pp
, " > ");
2806 case WIDEN_MULT_MINUS_EXPR
:
2807 pp_string (pp
, " WIDEN_MULT_MINUS_EXPR < ");
2808 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2809 pp_string (pp
, ", ");
2810 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2811 pp_string (pp
, ", ");
2812 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2813 pp_string (pp
, " > ");
2817 pp_string (pp
, " FMA_EXPR < ");
2818 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2819 pp_string (pp
, ", ");
2820 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2821 pp_string (pp
, ", ");
2822 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2823 pp_string (pp
, " > ");
2827 pp_string (pp
, "#pragma acc parallel");
2828 goto dump_omp_clauses_body
;
2831 pp_string (pp
, "#pragma acc kernels");
2832 goto dump_omp_clauses_body
;
2835 pp_string (pp
, "#pragma acc data");
2836 dump_omp_clauses (pp
, OACC_DATA_CLAUSES (node
), spc
, flags
);
2839 case OACC_HOST_DATA
:
2840 pp_string (pp
, "#pragma acc host_data");
2841 dump_omp_clauses (pp
, OACC_HOST_DATA_CLAUSES (node
), spc
, flags
);
2845 pp_string (pp
, "#pragma acc declare");
2846 dump_omp_clauses (pp
, OACC_DECLARE_CLAUSES (node
), spc
, flags
);
2850 pp_string (pp
, "#pragma acc update");
2851 dump_omp_clauses (pp
, OACC_UPDATE_CLAUSES (node
), spc
, flags
);
2854 case OACC_ENTER_DATA
:
2855 pp_string (pp
, "#pragma acc enter data");
2856 dump_omp_clauses (pp
, OACC_ENTER_DATA_CLAUSES (node
), spc
, flags
);
2859 case OACC_EXIT_DATA
:
2860 pp_string (pp
, "#pragma acc exit data");
2861 dump_omp_clauses (pp
, OACC_EXIT_DATA_CLAUSES (node
), spc
, flags
);
2865 pp_string (pp
, "#pragma acc cache");
2866 dump_omp_clauses (pp
, OACC_CACHE_CLAUSES (node
), spc
, flags
);
2870 pp_string (pp
, "#pragma omp parallel");
2871 dump_omp_clauses (pp
, OMP_PARALLEL_CLAUSES (node
), spc
, flags
);
2874 dump_omp_clauses_body
:
2875 dump_omp_clauses (pp
, OMP_CLAUSES (node
), spc
, flags
);
2879 if (!(flags
& TDF_SLIM
) && OMP_BODY (node
))
2881 newline_and_indent (pp
, spc
+ 2);
2883 newline_and_indent (pp
, spc
+ 4);
2884 dump_generic_node (pp
, OMP_BODY (node
), spc
+ 4, flags
, false);
2885 newline_and_indent (pp
, spc
+ 2);
2886 pp_right_brace (pp
);
2892 pp_string (pp
, "#pragma omp task");
2893 dump_omp_clauses (pp
, OMP_TASK_CLAUSES (node
), spc
, flags
);
2897 pp_string (pp
, "#pragma omp for");
2901 pp_string (pp
, "#pragma omp simd");
2905 pp_string (pp
, "#pragma simd");
2909 /* This label points one line after dumping the clauses.
2910 For _Cilk_for the clauses are dumped after the _Cilk_for (...)
2911 parameters are printed out. */
2912 goto dump_omp_loop_cilk_for
;
2914 case OMP_DISTRIBUTE
:
2915 pp_string (pp
, "#pragma omp distribute");
2919 pp_string (pp
, "#pragma omp taskloop");
2923 pp_string (pp
, "#pragma acc loop");
2927 pp_string (pp
, "#pragma omp teams");
2928 dump_omp_clauses (pp
, OMP_TEAMS_CLAUSES (node
), spc
, flags
);
2931 case OMP_TARGET_DATA
:
2932 pp_string (pp
, "#pragma omp target data");
2933 dump_omp_clauses (pp
, OMP_TARGET_DATA_CLAUSES (node
), spc
, flags
);
2936 case OMP_TARGET_ENTER_DATA
:
2937 pp_string (pp
, "#pragma omp target enter data");
2938 dump_omp_clauses (pp
, OMP_TARGET_ENTER_DATA_CLAUSES (node
), spc
, flags
);
2942 case OMP_TARGET_EXIT_DATA
:
2943 pp_string (pp
, "#pragma omp target exit data");
2944 dump_omp_clauses (pp
, OMP_TARGET_EXIT_DATA_CLAUSES (node
), spc
, flags
);
2949 pp_string (pp
, "#pragma omp target");
2950 dump_omp_clauses (pp
, OMP_TARGET_CLAUSES (node
), spc
, flags
);
2953 case OMP_TARGET_UPDATE
:
2954 pp_string (pp
, "#pragma omp target update");
2955 dump_omp_clauses (pp
, OMP_TARGET_UPDATE_CLAUSES (node
), spc
, flags
);
2960 dump_omp_clauses (pp
, OMP_FOR_CLAUSES (node
), spc
, flags
);
2962 dump_omp_loop_cilk_for
:
2963 if (!(flags
& TDF_SLIM
))
2967 if (OMP_FOR_PRE_BODY (node
))
2969 if (TREE_CODE (node
) == CILK_FOR
)
2970 pp_string (pp
, " ");
2972 newline_and_indent (pp
, spc
+ 2);
2975 newline_and_indent (pp
, spc
);
2976 dump_generic_node (pp
, OMP_FOR_PRE_BODY (node
),
2979 if (OMP_FOR_INIT (node
))
2982 for (i
= 0; i
< TREE_VEC_LENGTH (OMP_FOR_INIT (node
)); i
++)
2985 if (TREE_CODE (node
) != CILK_FOR
|| OMP_FOR_PRE_BODY (node
))
2986 newline_and_indent (pp
, spc
);
2987 if (TREE_CODE (node
) == CILK_FOR
)
2988 pp_string (pp
, "_Cilk_for (");
2990 pp_string (pp
, "for (");
2991 dump_generic_node (pp
,
2992 TREE_VEC_ELT (OMP_FOR_INIT (node
), i
),
2994 pp_string (pp
, "; ");
2995 dump_generic_node (pp
,
2996 TREE_VEC_ELT (OMP_FOR_COND (node
), i
),
2998 pp_string (pp
, "; ");
2999 dump_generic_node (pp
,
3000 TREE_VEC_ELT (OMP_FOR_INCR (node
), i
),
3002 pp_right_paren (pp
);
3004 if (TREE_CODE (node
) == CILK_FOR
)
3005 dump_omp_clauses (pp
, OMP_FOR_CLAUSES (node
), spc
, flags
);
3007 if (OMP_FOR_BODY (node
))
3009 newline_and_indent (pp
, spc
+ 2);
3011 newline_and_indent (pp
, spc
+ 4);
3012 dump_generic_node (pp
, OMP_FOR_BODY (node
), spc
+ 4, flags
,
3014 newline_and_indent (pp
, spc
+ 2);
3015 pp_right_brace (pp
);
3017 if (OMP_FOR_INIT (node
))
3018 spc
-= 2 * TREE_VEC_LENGTH (OMP_FOR_INIT (node
)) - 2;
3019 if (OMP_FOR_PRE_BODY (node
))
3022 newline_and_indent (pp
, spc
+ 2);
3023 pp_right_brace (pp
);
3030 pp_string (pp
, "#pragma omp sections");
3031 dump_omp_clauses (pp
, OMP_SECTIONS_CLAUSES (node
), spc
, flags
);
3035 pp_string (pp
, "#pragma omp section");
3039 pp_string (pp
, "#pragma omp master");
3043 pp_string (pp
, "#pragma omp taskgroup");
3047 pp_string (pp
, "#pragma omp ordered");
3048 dump_omp_clauses (pp
, OMP_ORDERED_CLAUSES (node
), spc
, flags
);
3052 pp_string (pp
, "#pragma omp critical");
3053 if (OMP_CRITICAL_NAME (node
))
3057 dump_generic_node (pp
, OMP_CRITICAL_NAME (node
), spc
,
3059 pp_right_paren (pp
);
3061 dump_omp_clauses (pp
, OMP_CRITICAL_CLAUSES (node
), spc
, flags
);
3065 pp_string (pp
, "#pragma omp atomic");
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 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3076 case OMP_ATOMIC_READ
:
3077 pp_string (pp
, "#pragma omp atomic read");
3078 if (OMP_ATOMIC_SEQ_CST (node
))
3079 pp_string (pp
, " seq_cst");
3080 newline_and_indent (pp
, spc
+ 2);
3081 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3085 case OMP_ATOMIC_CAPTURE_OLD
:
3086 case OMP_ATOMIC_CAPTURE_NEW
:
3087 pp_string (pp
, "#pragma omp atomic capture");
3088 if (OMP_ATOMIC_SEQ_CST (node
))
3089 pp_string (pp
, " seq_cst");
3090 newline_and_indent (pp
, spc
+ 2);
3091 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3095 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3099 pp_string (pp
, "#pragma omp single");
3100 dump_omp_clauses (pp
, OMP_SINGLE_CLAUSES (node
), spc
, flags
);
3104 dump_omp_clause (pp
, node
, spc
, flags
);
3108 case TRANSACTION_EXPR
:
3109 if (TRANSACTION_EXPR_OUTER (node
))
3110 pp_string (pp
, "__transaction_atomic [[outer]]");
3111 else if (TRANSACTION_EXPR_RELAXED (node
))
3112 pp_string (pp
, "__transaction_relaxed");
3114 pp_string (pp
, "__transaction_atomic");
3115 if (!(flags
& TDF_SLIM
) && TRANSACTION_EXPR_BODY (node
))
3117 newline_and_indent (pp
, spc
);
3119 newline_and_indent (pp
, spc
+ 2);
3120 dump_generic_node (pp
, TRANSACTION_EXPR_BODY (node
),
3121 spc
+ 2, flags
, false);
3122 newline_and_indent (pp
, spc
);
3123 pp_right_brace (pp
);
3128 case REDUC_MAX_EXPR
:
3129 pp_string (pp
, " REDUC_MAX_EXPR < ");
3130 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3131 pp_string (pp
, " > ");
3134 case REDUC_MIN_EXPR
:
3135 pp_string (pp
, " REDUC_MIN_EXPR < ");
3136 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3137 pp_string (pp
, " > ");
3140 case REDUC_PLUS_EXPR
:
3141 pp_string (pp
, " REDUC_PLUS_EXPR < ");
3142 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3143 pp_string (pp
, " > ");
3146 case VEC_WIDEN_MULT_HI_EXPR
:
3147 case VEC_WIDEN_MULT_LO_EXPR
:
3148 case VEC_WIDEN_MULT_EVEN_EXPR
:
3149 case VEC_WIDEN_MULT_ODD_EXPR
:
3150 case VEC_WIDEN_LSHIFT_HI_EXPR
:
3151 case VEC_WIDEN_LSHIFT_LO_EXPR
:
3153 for (str
= get_tree_code_name (code
); *str
; str
++)
3154 pp_character (pp
, TOUPPER (*str
));
3155 pp_string (pp
, " < ");
3156 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3157 pp_string (pp
, ", ");
3158 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3159 pp_string (pp
, " > ");
3162 case VEC_UNPACK_HI_EXPR
:
3163 pp_string (pp
, " VEC_UNPACK_HI_EXPR < ");
3164 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3165 pp_string (pp
, " > ");
3168 case VEC_UNPACK_LO_EXPR
:
3169 pp_string (pp
, " VEC_UNPACK_LO_EXPR < ");
3170 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3171 pp_string (pp
, " > ");
3174 case VEC_UNPACK_FLOAT_HI_EXPR
:
3175 pp_string (pp
, " VEC_UNPACK_FLOAT_HI_EXPR < ");
3176 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3177 pp_string (pp
, " > ");
3180 case VEC_UNPACK_FLOAT_LO_EXPR
:
3181 pp_string (pp
, " VEC_UNPACK_FLOAT_LO_EXPR < ");
3182 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3183 pp_string (pp
, " > ");
3186 case VEC_PACK_TRUNC_EXPR
:
3187 pp_string (pp
, " VEC_PACK_TRUNC_EXPR < ");
3188 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3189 pp_string (pp
, ", ");
3190 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3191 pp_string (pp
, " > ");
3194 case VEC_PACK_SAT_EXPR
:
3195 pp_string (pp
, " VEC_PACK_SAT_EXPR < ");
3196 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3197 pp_string (pp
, ", ");
3198 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3199 pp_string (pp
, " > ");
3202 case VEC_PACK_FIX_TRUNC_EXPR
:
3203 pp_string (pp
, " VEC_PACK_FIX_TRUNC_EXPR < ");
3204 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3205 pp_string (pp
, ", ");
3206 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3207 pp_string (pp
, " > ");
3211 dump_block_node (pp
, node
, spc
, flags
);
3214 case CILK_SPAWN_STMT
:
3215 pp_string (pp
, "_Cilk_spawn ");
3216 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3219 case CILK_SYNC_STMT
:
3220 pp_string (pp
, "_Cilk_sync");
3227 if (is_stmt
&& is_expr
)
3233 /* Print the declaration of a variable. */
3236 print_declaration (pretty_printer
*pp
, tree t
, int spc
, int flags
)
3240 if (TREE_CODE(t
) == NAMELIST_DECL
)
3242 pp_string(pp
, "namelist ");
3243 dump_decl_name (pp
, t
, flags
);
3248 if (TREE_CODE (t
) == TYPE_DECL
)
3249 pp_string (pp
, "typedef ");
3251 if (CODE_CONTAINS_STRUCT (TREE_CODE (t
), TS_DECL_WRTL
) && DECL_REGISTER (t
))
3252 pp_string (pp
, "register ");
3254 if (TREE_PUBLIC (t
) && DECL_EXTERNAL (t
))
3255 pp_string (pp
, "extern ");
3256 else if (TREE_STATIC (t
))
3257 pp_string (pp
, "static ");
3259 /* Print the type and name. */
3260 if (TREE_TYPE (t
) && TREE_CODE (TREE_TYPE (t
)) == ARRAY_TYPE
)
3264 /* Print array's type. */
3265 tmp
= TREE_TYPE (t
);
3266 while (TREE_CODE (TREE_TYPE (tmp
)) == ARRAY_TYPE
)
3267 tmp
= TREE_TYPE (tmp
);
3268 dump_generic_node (pp
, TREE_TYPE (tmp
), spc
, flags
, false);
3270 /* Print variable's name. */
3272 dump_generic_node (pp
, t
, spc
, flags
, false);
3274 /* Print the dimensions. */
3275 tmp
= TREE_TYPE (t
);
3276 while (TREE_CODE (tmp
) == ARRAY_TYPE
)
3278 dump_array_domain (pp
, TYPE_DOMAIN (tmp
), spc
, flags
);
3279 tmp
= TREE_TYPE (tmp
);
3282 else if (TREE_CODE (t
) == FUNCTION_DECL
)
3284 dump_generic_node (pp
, TREE_TYPE (TREE_TYPE (t
)), spc
, flags
, false);
3286 dump_decl_name (pp
, t
, flags
);
3287 dump_function_declaration (pp
, TREE_TYPE (t
), spc
, flags
);
3291 /* Print type declaration. */
3292 dump_generic_node (pp
, TREE_TYPE (t
), spc
, flags
, false);
3294 /* Print variable's name. */
3296 dump_generic_node (pp
, t
, spc
, flags
, false);
3299 if (VAR_P (t
) && DECL_HARD_REGISTER (t
))
3301 pp_string (pp
, " __asm__ ");
3303 dump_generic_node (pp
, DECL_ASSEMBLER_NAME (t
), spc
, flags
, false);
3304 pp_right_paren (pp
);
3307 /* The initial value of a function serves to determine whether the function
3308 is declared or defined. So the following does not apply to function
3310 if (TREE_CODE (t
) != FUNCTION_DECL
)
3312 /* Print the initial value. */
3313 if (DECL_INITIAL (t
))
3318 dump_generic_node (pp
, DECL_INITIAL (t
), spc
, flags
, false);
3322 if (VAR_P (t
) && DECL_HAS_VALUE_EXPR_P (t
))
3324 pp_string (pp
, " [value-expr: ");
3325 dump_generic_node (pp
, DECL_VALUE_EXPR (t
), spc
, flags
, false);
3326 pp_right_bracket (pp
);
3333 /* Prints a structure: name, fields, and methods.
3334 FIXME: Still incomplete. */
3337 print_struct_decl (pretty_printer
*pp
, const_tree node
, int spc
, int flags
)
3339 /* Print the name of the structure. */
3340 if (TYPE_NAME (node
))
3343 if (TREE_CODE (node
) == RECORD_TYPE
)
3344 pp_string (pp
, "struct ");
3345 else if ((TREE_CODE (node
) == UNION_TYPE
3346 || TREE_CODE (node
) == QUAL_UNION_TYPE
))
3347 pp_string (pp
, "union ");
3349 dump_generic_node (pp
, TYPE_NAME (node
), spc
, 0, false);
3352 /* Print the contents of the structure. */
3358 /* Print the fields of the structure. */
3361 tmp
= TYPE_FIELDS (node
);
3364 /* Avoid to print recursively the structure. */
3365 /* FIXME : Not implemented correctly...,
3366 what about the case when we have a cycle in the contain graph? ...
3367 Maybe this could be solved by looking at the scope in which the
3368 structure was declared. */
3369 if (TREE_TYPE (tmp
) != node
3370 && (TREE_CODE (TREE_TYPE (tmp
)) != POINTER_TYPE
3371 || TREE_TYPE (TREE_TYPE (tmp
)) != node
))
3373 print_declaration (pp
, tmp
, spc
+2, flags
);
3376 tmp
= DECL_CHAIN (tmp
);
3380 pp_right_brace (pp
);
3383 /* Return the priority of the operator CODE.
3385 From lowest to highest precedence with either left-to-right (L-R)
3386 or right-to-left (R-L) associativity]:
3389 2 [R-L] = += -= *= /= %= &= ^= |= <<= >>=
3401 14 [R-L] ! ~ ++ -- + - * & (type) sizeof
3402 15 [L-R] fn() [] -> .
3404 unary +, - and * have higher precedence than the corresponding binary
3408 op_code_prio (enum tree_code code
)
3425 case TRUTH_ORIF_EXPR
:
3428 case TRUTH_AND_EXPR
:
3429 case TRUTH_ANDIF_EXPR
:
3436 case TRUTH_XOR_EXPR
:
3453 case UNORDERED_EXPR
:
3464 case VEC_WIDEN_LSHIFT_HI_EXPR
:
3465 case VEC_WIDEN_LSHIFT_LO_EXPR
:
3466 case WIDEN_LSHIFT_EXPR
:
3469 case WIDEN_SUM_EXPR
:
3471 case POINTER_PLUS_EXPR
:
3475 case VEC_WIDEN_MULT_HI_EXPR
:
3476 case VEC_WIDEN_MULT_LO_EXPR
:
3477 case WIDEN_MULT_EXPR
:
3479 case WIDEN_MULT_PLUS_EXPR
:
3480 case WIDEN_MULT_MINUS_EXPR
:
3482 case MULT_HIGHPART_EXPR
:
3483 case TRUNC_DIV_EXPR
:
3485 case FLOOR_DIV_EXPR
:
3486 case ROUND_DIV_EXPR
:
3488 case EXACT_DIV_EXPR
:
3489 case TRUNC_MOD_EXPR
:
3491 case FLOOR_MOD_EXPR
:
3492 case ROUND_MOD_EXPR
:
3496 case TRUTH_NOT_EXPR
:
3498 case POSTINCREMENT_EXPR
:
3499 case POSTDECREMENT_EXPR
:
3500 case PREINCREMENT_EXPR
:
3501 case PREDECREMENT_EXPR
:
3507 case FIX_TRUNC_EXPR
:
3513 case ARRAY_RANGE_REF
:
3517 /* Special expressions. */
3523 case REDUC_MAX_EXPR
:
3524 case REDUC_MIN_EXPR
:
3525 case REDUC_PLUS_EXPR
:
3526 case VEC_UNPACK_HI_EXPR
:
3527 case VEC_UNPACK_LO_EXPR
:
3528 case VEC_UNPACK_FLOAT_HI_EXPR
:
3529 case VEC_UNPACK_FLOAT_LO_EXPR
:
3530 case VEC_PACK_TRUNC_EXPR
:
3531 case VEC_PACK_SAT_EXPR
:
3535 /* Return an arbitrarily high precedence to avoid surrounding single
3536 VAR_DECLs in ()s. */
3541 /* Return the priority of the operator OP. */
3544 op_prio (const_tree op
)
3546 enum tree_code code
;
3551 code
= TREE_CODE (op
);
3552 if (code
== SAVE_EXPR
|| code
== NON_LVALUE_EXPR
)
3553 return op_prio (TREE_OPERAND (op
, 0));
3555 return op_code_prio (code
);
3558 /* Return the symbol associated with operator CODE. */
3561 op_symbol_code (enum tree_code code
)
3569 case TRUTH_ORIF_EXPR
:
3572 case TRUTH_AND_EXPR
:
3573 case TRUTH_ANDIF_EXPR
:
3579 case TRUTH_XOR_EXPR
:
3589 case UNORDERED_EXPR
:
3635 case WIDEN_LSHIFT_EXPR
:
3638 case POINTER_PLUS_EXPR
:
3644 case REDUC_PLUS_EXPR
:
3647 case WIDEN_SUM_EXPR
:
3650 case WIDEN_MULT_EXPR
:
3653 case MULT_HIGHPART_EXPR
:
3663 case TRUTH_NOT_EXPR
:
3670 case TRUNC_DIV_EXPR
:
3677 case FLOOR_DIV_EXPR
:
3680 case ROUND_DIV_EXPR
:
3683 case EXACT_DIV_EXPR
:
3686 case TRUNC_MOD_EXPR
:
3692 case FLOOR_MOD_EXPR
:
3695 case ROUND_MOD_EXPR
:
3698 case PREDECREMENT_EXPR
:
3701 case PREINCREMENT_EXPR
:
3704 case POSTDECREMENT_EXPR
:
3707 case POSTINCREMENT_EXPR
:
3717 return "<<< ??? >>>";
3721 /* Return the symbol associated with operator OP. */
3724 op_symbol (const_tree op
)
3726 return op_symbol_code (TREE_CODE (op
));
3729 /* Prints the name of a call. NODE is the CALL_EXPR_FN of a CALL_EXPR or
3730 the gimple_call_fn of a GIMPLE_CALL. */
3733 print_call_name (pretty_printer
*pp
, tree node
, int flags
)
3737 if (TREE_CODE (op0
) == NON_LVALUE_EXPR
)
3738 op0
= TREE_OPERAND (op0
, 0);
3741 switch (TREE_CODE (op0
))
3746 dump_function_name (pp
, op0
, flags
);
3752 op0
= TREE_OPERAND (op0
, 0);
3757 dump_generic_node (pp
, TREE_OPERAND (op0
, 0), 0, flags
, false);
3758 pp_string (pp
, ") ? ");
3759 dump_generic_node (pp
, TREE_OPERAND (op0
, 1), 0, flags
, false);
3760 pp_string (pp
, " : ");
3761 dump_generic_node (pp
, TREE_OPERAND (op0
, 2), 0, flags
, false);
3765 if (TREE_CODE (TREE_OPERAND (op0
, 0)) == VAR_DECL
)
3766 dump_function_name (pp
, TREE_OPERAND (op0
, 0), flags
);
3768 dump_generic_node (pp
, op0
, 0, flags
, false);
3772 if (integer_zerop (TREE_OPERAND (op0
, 1)))
3774 op0
= TREE_OPERAND (op0
, 0);
3781 dump_generic_node (pp
, op0
, 0, flags
, false);
3789 /* Parses the string STR and replaces new-lines by '\n', tabs by '\t', ... */
3792 pretty_print_string (pretty_printer
*pp
, const char *str
)
3802 pp_string (pp
, "\\b");
3806 pp_string (pp
, "\\f");
3810 pp_string (pp
, "\\n");
3814 pp_string (pp
, "\\r");
3818 pp_string (pp
, "\\t");
3822 pp_string (pp
, "\\v");
3826 pp_string (pp
, "\\\\");
3830 pp_string (pp
, "\\\"");
3834 pp_string (pp
, "\\'");
3837 /* No need to handle \0; the loop terminates on \0. */
3840 pp_string (pp
, "\\1");
3844 pp_string (pp
, "\\2");
3848 pp_string (pp
, "\\3");
3852 pp_string (pp
, "\\4");
3856 pp_string (pp
, "\\5");
3860 pp_string (pp
, "\\6");
3864 pp_string (pp
, "\\7");
3868 pp_character (pp
, str
[0]);
3876 maybe_init_pretty_print (FILE *file
)
3880 tree_pp
= new pretty_printer ();
3881 pp_needs_newline (tree_pp
) = true;
3882 pp_translate_identifiers (tree_pp
) = false;
3885 tree_pp
->buffer
->stream
= file
;
3889 newline_and_indent (pretty_printer
*pp
, int spc
)
3895 /* Handle a %K format for TEXT. Separate from default_tree_printer so
3896 it can also be used in front ends.
3897 %K: a statement, from which EXPR_LOCATION and TREE_BLOCK will be recorded.
3901 percent_K_format (text_info
*text
)
3903 tree t
= va_arg (*text
->args_ptr
, tree
), block
;
3904 text
->set_location (0, EXPR_LOCATION (t
), true);
3905 gcc_assert (pp_ti_abstract_origin (text
) != NULL
);
3906 block
= TREE_BLOCK (t
);
3907 *pp_ti_abstract_origin (text
) = NULL
;
3911 /* ??? LTO drops all BLOCK_ABSTRACT_ORIGINs apart from those
3912 representing the outermost block of an inlined function.
3913 So walk the BLOCK tree until we hit such a scope. */
3915 && TREE_CODE (block
) == BLOCK
)
3917 if (inlined_function_outer_scope_p (block
))
3919 *pp_ti_abstract_origin (text
) = block
;
3922 block
= BLOCK_SUPERCONTEXT (block
);
3928 && TREE_CODE (block
) == BLOCK
3929 && BLOCK_ABSTRACT_ORIGIN (block
))
3931 tree ao
= BLOCK_ABSTRACT_ORIGIN (block
);
3933 while (TREE_CODE (ao
) == BLOCK
3934 && BLOCK_ABSTRACT_ORIGIN (ao
)
3935 && BLOCK_ABSTRACT_ORIGIN (ao
) != ao
)
3936 ao
= BLOCK_ABSTRACT_ORIGIN (ao
);
3938 if (TREE_CODE (ao
) == FUNCTION_DECL
)
3940 *pp_ti_abstract_origin (text
) = block
;
3943 block
= BLOCK_SUPERCONTEXT (block
);
3947 /* Print the identifier ID to PRETTY-PRINTER. */
3950 pp_tree_identifier (pretty_printer
*pp
, tree id
)
3952 if (pp_translate_identifiers (pp
))
3954 const char *text
= identifier_to_locale (IDENTIFIER_POINTER (id
));
3955 pp_append_text (pp
, text
, text
+ strlen (text
));
3958 pp_append_text (pp
, IDENTIFIER_POINTER (id
),
3959 IDENTIFIER_POINTER (id
) + IDENTIFIER_LENGTH (id
));
3962 /* A helper function that is used to dump function information before the
3966 dump_function_header (FILE *dump_file
, tree fdecl
, int flags
)
3968 const char *dname
, *aname
;
3969 struct cgraph_node
*node
= cgraph_node::get (fdecl
);
3970 struct function
*fun
= DECL_STRUCT_FUNCTION (fdecl
);
3972 dname
= lang_hooks
.decl_printable_name (fdecl
, 2);
3974 if (DECL_ASSEMBLER_NAME_SET_P (fdecl
))
3975 aname
= (IDENTIFIER_POINTER
3976 (DECL_ASSEMBLER_NAME (fdecl
)));
3978 aname
= "<unset-asm-name>";
3980 fprintf (dump_file
, "\n;; Function %s (%s, funcdef_no=%d",
3981 dname
, aname
, fun
->funcdef_no
);
3982 if (!(flags
& TDF_NOUID
))
3983 fprintf (dump_file
, ", decl_uid=%d", DECL_UID (fdecl
));
3986 fprintf (dump_file
, ", cgraph_uid=%d", node
->uid
);
3987 fprintf (dump_file
, ", symbol_order=%d)%s\n\n", node
->order
,
3988 node
->frequency
== NODE_FREQUENCY_HOT
3990 : node
->frequency
== NODE_FREQUENCY_UNLIKELY_EXECUTED
3991 ? " (unlikely executed)"
3992 : node
->frequency
== NODE_FREQUENCY_EXECUTED_ONCE
3993 ? " (executed once)"
3997 fprintf (dump_file
, ")\n\n");
4000 /* Dump double_int D to pretty_printer PP. UNS is true
4001 if D is unsigned and false otherwise. */
4003 pp_double_int (pretty_printer
*pp
, double_int d
, bool uns
)
4006 pp_wide_integer (pp
, d
.low
);
4007 else if (d
.fits_uhwi ())
4008 pp_unsigned_wide_integer (pp
, d
.low
);
4011 unsigned HOST_WIDE_INT low
= d
.low
;
4012 HOST_WIDE_INT high
= d
.high
;
4013 if (!uns
&& d
.is_negative ())
4016 high
= ~high
+ !low
;
4019 /* Would "%x%0*x" or "%x%*0x" get zero-padding on all
4021 sprintf (pp_buffer (pp
)->digit_buffer
,
4022 HOST_WIDE_INT_PRINT_DOUBLE_HEX
,
4023 (unsigned HOST_WIDE_INT
) high
, low
);
4024 pp_string (pp
, pp_buffer (pp
)->digit_buffer
);