1 /* Pretty formatting of GENERIC trees in C syntax.
2 Copyright (C) 2001-2022 Free Software Foundation, Inc.
3 Adapted from c-pretty-print.cc 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 #include "fold-const.h"
39 /* Routines in this file get invoked via the default tree printer
40 used by diagnostics and thus they are called from pp_printf which
41 isn't reentrant. Avoid using pp_printf in this file. */
42 #pragma GCC poison pp_printf
44 /* Disable warnings about quoting issues in the pp_xxx calls below
45 that (intentionally) don't follow GCC diagnostic conventions. */
47 # pragma GCC diagnostic push
48 # pragma GCC diagnostic ignored "-Wformat-diag"
51 /* Local functions, macros and variables. */
52 static const char *op_symbol (const_tree
);
53 static void newline_and_indent (pretty_printer
*, int);
54 static void maybe_init_pretty_print (FILE *);
55 static void print_struct_decl (pretty_printer
*, const_tree
, int, dump_flags_t
);
56 static void do_niy (pretty_printer
*, const_tree
, int, dump_flags_t
);
58 #define INDENT(SPACE) do { \
59 int i; for (i = 0; i<SPACE; i++) pp_space (pp); } while (0)
61 #define NIY do_niy (pp, node, spc, flags)
63 static pretty_printer
*tree_pp
;
65 /* Try to print something for an unknown tree code. */
68 do_niy (pretty_printer
*pp
, const_tree node
, int spc
, dump_flags_t flags
)
72 pp_string (pp
, "<<< Unknown tree: ");
73 pp_string (pp
, get_tree_code_name (TREE_CODE (node
)));
77 len
= TREE_OPERAND_LENGTH (node
);
78 for (i
= 0; i
< len
; ++i
)
80 newline_and_indent (pp
, spc
+2);
81 dump_generic_node (pp
, TREE_OPERAND (node
, i
), spc
+2, flags
, false);
85 pp_string (pp
, " >>>");
88 /* Debugging function to print out a generic expression. */
91 debug_generic_expr (tree t
)
93 print_generic_expr (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
);
94 fprintf (stderr
, "\n");
97 /* Debugging function to print out a generic statement. */
100 debug_generic_stmt (tree t
)
102 print_generic_stmt (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
);
103 fprintf (stderr
, "\n");
106 /* Debugging function to print out a chain of trees . */
109 debug_tree_chain (tree t
)
115 print_generic_expr (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
|TDF_UID
);
116 fprintf (stderr
, " ");
120 fprintf (stderr
, "... [cycled back to ");
121 print_generic_expr (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
|TDF_UID
);
122 fprintf (stderr
, "]");
126 fprintf (stderr
, "\n");
129 /* Prints declaration DECL to the FILE with details specified by FLAGS. */
131 print_generic_decl (FILE *file
, tree decl
, dump_flags_t flags
)
133 maybe_init_pretty_print (file
);
134 print_declaration (tree_pp
, decl
, 2, flags
);
135 pp_write_text_to_stream (tree_pp
);
138 /* Print tree T, and its successors, on file FILE. FLAGS specifies details
139 to show in the dump. See TDF_* in dumpfile.h. */
142 print_generic_stmt (FILE *file
, tree t
, dump_flags_t flags
)
144 maybe_init_pretty_print (file
);
145 dump_generic_node (tree_pp
, t
, 0, flags
, true);
146 pp_newline_and_flush (tree_pp
);
149 /* Print tree T, and its successors, on file FILE. FLAGS specifies details
150 to show in the dump. See TDF_* in dumpfile.h. The output is indented by
154 print_generic_stmt_indented (FILE *file
, tree t
, dump_flags_t flags
, int indent
)
158 maybe_init_pretty_print (file
);
160 for (i
= 0; i
< indent
; i
++)
162 dump_generic_node (tree_pp
, t
, indent
, flags
, true);
163 pp_newline_and_flush (tree_pp
);
166 /* Print a single expression T on file FILE. FLAGS specifies details to show
167 in the dump. See TDF_* in dumpfile.h. */
170 print_generic_expr (FILE *file
, tree t
, dump_flags_t flags
)
172 maybe_init_pretty_print (file
);
173 dump_generic_node (tree_pp
, t
, 0, flags
, false);
177 /* Print a single expression T to string, and return it. The caller
178 must free the returned memory. */
181 print_generic_expr_to_str (tree t
)
184 dump_generic_node (&pp
, t
, 0, TDF_VOPS
|TDF_MEMSYMS
, false);
185 return xstrdup (pp_formatted_text (&pp
));
188 /* Dump NAME, an IDENTIFIER_POINTER, sanitized so that D<num> sequences
189 in it are replaced with Dxxxx, as long as they are at the start or
190 preceded by $ and at the end or followed by $. See make_fancy_name
194 dump_fancy_name (pretty_printer
*pp
, tree name
)
197 int length
= IDENTIFIER_LENGTH (name
);
198 const char *n
= IDENTIFIER_POINTER (name
);
205 && (n
== IDENTIFIER_POINTER (name
) || n
[-1] == '$'))
208 while (ISDIGIT (n
[l
]))
210 if (n
[l
] == '\0' || n
[l
] == '$')
223 pp_tree_identifier (pp
, name
);
227 char *str
= XNEWVEC (char, length
+ 1);
230 q
= n
= IDENTIFIER_POINTER (name
);
237 && (q
== IDENTIFIER_POINTER (name
) || q
[-1] == '$'))
240 while (ISDIGIT (q
[l
]))
242 if (q
[l
] == '\0' || q
[l
] == '$')
244 memcpy (p
, n
, q
- n
);
245 memcpy (p
+ (q
- n
), "Dxxxx", 5);
255 memcpy (p
, n
, IDENTIFIER_LENGTH (name
) - (n
- IDENTIFIER_POINTER (name
)));
257 if (pp_translate_identifiers (pp
))
259 const char *text
= identifier_to_locale (str
);
260 pp_append_text (pp
, text
, text
+ strlen (text
));
263 pp_append_text (pp
, str
, str
+ length
);
267 /* Dump the name of a _DECL node and its DECL_UID if TDF_UID is set
271 dump_decl_name (pretty_printer
*pp
, tree node
, dump_flags_t flags
)
273 tree name
= DECL_NAME (node
);
276 if ((flags
& TDF_ASMNAME
)
277 && HAS_DECL_ASSEMBLER_NAME_P (node
)
278 && DECL_ASSEMBLER_NAME_SET_P (node
))
279 pp_tree_identifier (pp
, DECL_ASSEMBLER_NAME_RAW (node
));
280 /* For -fcompare-debug don't dump DECL_NAMELESS names at all,
281 -g might have created more fancy names and their indexes
282 could get out of sync. Usually those should be DECL_IGNORED_P
283 too, SRA can create even non-DECL_IGNORED_P DECL_NAMELESS fancy
284 names, let's hope those never get out of sync after doing the
285 dump_fancy_name sanitization. */
286 else if ((flags
& TDF_COMPARE_DEBUG
)
287 && DECL_NAMELESS (node
)
288 && DECL_IGNORED_P (node
))
290 /* For DECL_NAMELESS names look for embedded uids in the
291 names and sanitize them for TDF_NOUID. */
292 else if ((flags
& TDF_NOUID
) && DECL_NAMELESS (node
))
293 dump_fancy_name (pp
, name
);
295 pp_tree_identifier (pp
, name
);
297 char uid_sep
= (flags
& TDF_GIMPLE
) ? '_' : '.';
298 if ((flags
& TDF_UID
) || name
== NULL_TREE
)
300 if (TREE_CODE (node
) == LABEL_DECL
&& LABEL_DECL_UID (node
) != -1)
302 pp_character (pp
, 'L');
303 pp_character (pp
, uid_sep
);
304 pp_decimal_int (pp
, (int) LABEL_DECL_UID (node
));
306 else if (TREE_CODE (node
) == DEBUG_EXPR_DECL
)
308 if (flags
& TDF_NOUID
)
309 pp_string (pp
, "D#xxxx");
312 pp_string (pp
, "D#");
313 pp_decimal_int (pp
, (int) DEBUG_TEMP_UID (node
));
318 char c
= TREE_CODE (node
) == CONST_DECL
? 'C' : 'D';
319 pp_character (pp
, c
);
320 pp_character (pp
, uid_sep
);
321 if (flags
& TDF_NOUID
)
322 pp_string (pp
, "xxxx");
324 pp_scalar (pp
, "%u", DECL_UID (node
));
327 if ((flags
& TDF_ALIAS
) && DECL_PT_UID (node
) != DECL_UID (node
))
329 if (flags
& TDF_NOUID
)
330 pp_string (pp
, "ptD.xxxx");
333 pp_string (pp
, "ptD.");
334 pp_scalar (pp
, "%u", DECL_PT_UID (node
));
339 /* Like the above, but used for pretty printing function calls. */
342 dump_function_name (pretty_printer
*pp
, tree node
, dump_flags_t flags
)
344 if (CONVERT_EXPR_P (node
))
345 node
= TREE_OPERAND (node
, 0);
346 if (DECL_NAME (node
) && (flags
& TDF_ASMNAME
) == 0)
348 pp_string (pp
, lang_hooks
.decl_printable_name (node
, 1));
351 char uid_sep
= (flags
& TDF_GIMPLE
) ? '_' : '.';
352 pp_character (pp
, 'D');
353 pp_character (pp
, uid_sep
);
354 pp_scalar (pp
, "%u", DECL_UID (node
));
358 dump_decl_name (pp
, node
, flags
);
361 /* Dump a function declaration. NODE is the FUNCTION_TYPE. PP, SPC and
362 FLAGS are as in dump_generic_node. */
365 dump_function_declaration (pretty_printer
*pp
, tree node
,
366 int spc
, dump_flags_t flags
)
368 bool wrote_arg
= false;
374 /* Print the argument types. */
375 arg
= TYPE_ARG_TYPES (node
);
376 while (arg
&& arg
!= void_list_node
&& arg
!= error_mark_node
)
384 dump_generic_node (pp
, TREE_VALUE (arg
), spc
, flags
, false);
385 arg
= TREE_CHAIN (arg
);
388 /* Drop the trailing void_type_node if we had any previous argument. */
389 if (arg
== void_list_node
&& !wrote_arg
)
390 pp_string (pp
, "void");
391 /* Properly dump vararg function types. */
392 else if (!arg
&& wrote_arg
)
393 pp_string (pp
, ", ...");
394 /* Avoid printing any arg for unprototyped functions. */
399 /* Dump the domain associated with an array. */
402 dump_array_domain (pretty_printer
*pp
, tree domain
, int spc
, dump_flags_t flags
)
404 pp_left_bracket (pp
);
407 tree min
= TYPE_MIN_VALUE (domain
);
408 tree max
= TYPE_MAX_VALUE (domain
);
411 && integer_zerop (min
)
412 && tree_fits_shwi_p (max
))
413 pp_wide_integer (pp
, tree_to_shwi (max
) + 1);
417 dump_generic_node (pp
, min
, spc
, flags
, false);
420 dump_generic_node (pp
, max
, spc
, flags
, false);
424 pp_string (pp
, "<unknown>");
425 pp_right_bracket (pp
);
429 /* Dump OpenMP iterators ITER. */
432 dump_omp_iterators (pretty_printer
*pp
, tree iter
, int spc
, dump_flags_t flags
)
434 pp_string (pp
, "iterator(");
435 for (tree it
= iter
; it
; it
= TREE_CHAIN (it
))
438 pp_string (pp
, ", ");
439 dump_generic_node (pp
, TREE_TYPE (TREE_VEC_ELT (it
, 0)), spc
, flags
,
442 dump_generic_node (pp
, TREE_VEC_ELT (it
, 0), spc
, flags
, false);
444 dump_generic_node (pp
, TREE_VEC_ELT (it
, 1), spc
, flags
, false);
446 dump_generic_node (pp
, TREE_VEC_ELT (it
, 2), spc
, flags
, false);
448 dump_generic_node (pp
, TREE_VEC_ELT (it
, 3), spc
, flags
, false);
454 /* Dump OMP clause CLAUSE, without following OMP_CLAUSE_CHAIN.
456 PP, CLAUSE, SPC and FLAGS are as in dump_generic_node. */
459 dump_omp_clause (pretty_printer
*pp
, tree clause
, int spc
, dump_flags_t flags
)
462 const char *modifier
= NULL
;
463 switch (OMP_CLAUSE_CODE (clause
))
465 case OMP_CLAUSE_PRIVATE
:
468 case OMP_CLAUSE_SHARED
:
471 case OMP_CLAUSE_FIRSTPRIVATE
:
472 name
= "firstprivate";
474 case OMP_CLAUSE_LASTPRIVATE
:
475 name
= "lastprivate";
476 if (OMP_CLAUSE_LASTPRIVATE_CONDITIONAL (clause
))
477 modifier
= "conditional:";
479 case OMP_CLAUSE_COPYIN
:
482 case OMP_CLAUSE_COPYPRIVATE
:
483 name
= "copyprivate";
485 case OMP_CLAUSE_UNIFORM
:
488 case OMP_CLAUSE_USE_DEVICE_PTR
:
489 name
= "use_device_ptr";
490 if (OMP_CLAUSE_USE_DEVICE_PTR_IF_PRESENT (clause
))
491 modifier
= "if_present:";
493 case OMP_CLAUSE_USE_DEVICE_ADDR
:
494 name
= "use_device_addr";
496 case OMP_CLAUSE_HAS_DEVICE_ADDR
:
497 name
= "has_device_addr";
499 case OMP_CLAUSE_IS_DEVICE_PTR
:
500 name
= "is_device_ptr";
502 case OMP_CLAUSE_INCLUSIVE
:
505 case OMP_CLAUSE_EXCLUSIVE
:
508 case OMP_CLAUSE__LOOPTEMP_
:
511 case OMP_CLAUSE__REDUCTEMP_
:
512 name
= "_reductemp_";
514 case OMP_CLAUSE__CONDTEMP_
:
517 case OMP_CLAUSE__SCANTEMP_
:
520 case OMP_CLAUSE_TO_DECLARE
:
523 case OMP_CLAUSE_LINK
:
526 case OMP_CLAUSE_NONTEMPORAL
:
527 name
= "nontemporal";
530 pp_string (pp
, name
);
533 pp_string (pp
, modifier
);
534 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
539 case OMP_CLAUSE_TASK_REDUCTION
:
540 case OMP_CLAUSE_IN_REDUCTION
:
541 pp_string (pp
, OMP_CLAUSE_CODE (clause
) == OMP_CLAUSE_IN_REDUCTION
544 case OMP_CLAUSE_REDUCTION
:
545 pp_string (pp
, "reduction(");
546 if (OMP_CLAUSE_CODE (clause
) == OMP_CLAUSE_REDUCTION
)
548 if (OMP_CLAUSE_REDUCTION_TASK (clause
))
549 pp_string (pp
, "task,");
550 else if (OMP_CLAUSE_REDUCTION_INSCAN (clause
))
551 pp_string (pp
, "inscan,");
553 if (OMP_CLAUSE_REDUCTION_CODE (clause
) != ERROR_MARK
)
556 op_symbol_code (OMP_CLAUSE_REDUCTION_CODE (clause
)));
559 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
565 pp_string (pp
, "if(");
566 switch (OMP_CLAUSE_IF_MODIFIER (clause
))
568 case ERROR_MARK
: break;
569 case VOID_CST
: pp_string (pp
, "cancel:"); break;
570 case OMP_PARALLEL
: pp_string (pp
, "parallel:"); break;
571 case OMP_SIMD
: pp_string (pp
, "simd:"); break;
572 case OMP_TASK
: pp_string (pp
, "task:"); break;
573 case OMP_TASKLOOP
: pp_string (pp
, "taskloop:"); break;
574 case OMP_TARGET_DATA
: pp_string (pp
, "target data:"); break;
575 case OMP_TARGET
: pp_string (pp
, "target:"); break;
576 case OMP_TARGET_UPDATE
: pp_string (pp
, "target update:"); break;
577 case OMP_TARGET_ENTER_DATA
:
578 pp_string (pp
, "target enter data:"); break;
579 case OMP_TARGET_EXIT_DATA
: pp_string (pp
, "target exit data:"); break;
580 default: gcc_unreachable ();
582 dump_generic_node (pp
, OMP_CLAUSE_IF_EXPR (clause
),
587 case OMP_CLAUSE_NUM_THREADS
:
588 pp_string (pp
, "num_threads(");
589 dump_generic_node (pp
, OMP_CLAUSE_NUM_THREADS_EXPR (clause
),
594 case OMP_CLAUSE_NOWAIT
:
595 pp_string (pp
, "nowait");
597 case OMP_CLAUSE_ORDERED
:
598 pp_string (pp
, "ordered");
599 if (OMP_CLAUSE_ORDERED_EXPR (clause
))
602 dump_generic_node (pp
, OMP_CLAUSE_ORDERED_EXPR (clause
),
608 case OMP_CLAUSE_DEFAULT
:
609 pp_string (pp
, "default(");
610 switch (OMP_CLAUSE_DEFAULT_KIND (clause
))
612 case OMP_CLAUSE_DEFAULT_UNSPECIFIED
:
614 case OMP_CLAUSE_DEFAULT_SHARED
:
615 pp_string (pp
, "shared");
617 case OMP_CLAUSE_DEFAULT_NONE
:
618 pp_string (pp
, "none");
620 case OMP_CLAUSE_DEFAULT_PRIVATE
:
621 pp_string (pp
, "private");
623 case OMP_CLAUSE_DEFAULT_FIRSTPRIVATE
:
624 pp_string (pp
, "firstprivate");
626 case OMP_CLAUSE_DEFAULT_PRESENT
:
627 pp_string (pp
, "present");
635 case OMP_CLAUSE_SCHEDULE
:
636 pp_string (pp
, "schedule(");
637 if (OMP_CLAUSE_SCHEDULE_KIND (clause
)
638 & (OMP_CLAUSE_SCHEDULE_MONOTONIC
639 | OMP_CLAUSE_SCHEDULE_NONMONOTONIC
))
641 if (OMP_CLAUSE_SCHEDULE_KIND (clause
)
642 & OMP_CLAUSE_SCHEDULE_MONOTONIC
)
643 pp_string (pp
, "monotonic");
645 pp_string (pp
, "nonmonotonic");
646 if (OMP_CLAUSE_SCHEDULE_SIMD (clause
))
651 if (OMP_CLAUSE_SCHEDULE_SIMD (clause
))
652 pp_string (pp
, "simd:");
654 switch (OMP_CLAUSE_SCHEDULE_KIND (clause
) & OMP_CLAUSE_SCHEDULE_MASK
)
656 case OMP_CLAUSE_SCHEDULE_STATIC
:
657 pp_string (pp
, "static");
659 case OMP_CLAUSE_SCHEDULE_DYNAMIC
:
660 pp_string (pp
, "dynamic");
662 case OMP_CLAUSE_SCHEDULE_GUIDED
:
663 pp_string (pp
, "guided");
665 case OMP_CLAUSE_SCHEDULE_RUNTIME
:
666 pp_string (pp
, "runtime");
668 case OMP_CLAUSE_SCHEDULE_AUTO
:
669 pp_string (pp
, "auto");
674 if (OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (clause
))
677 dump_generic_node (pp
, OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (clause
),
683 case OMP_CLAUSE_UNTIED
:
684 pp_string (pp
, "untied");
687 case OMP_CLAUSE_COLLAPSE
:
688 pp_string (pp
, "collapse(");
689 dump_generic_node (pp
, OMP_CLAUSE_COLLAPSE_EXPR (clause
),
694 case OMP_CLAUSE_FINAL
:
695 pp_string (pp
, "final(");
696 dump_generic_node (pp
, OMP_CLAUSE_FINAL_EXPR (clause
),
701 case OMP_CLAUSE_MERGEABLE
:
702 pp_string (pp
, "mergeable");
705 case OMP_CLAUSE_LINEAR
:
706 pp_string (pp
, "linear(");
707 switch (OMP_CLAUSE_LINEAR_KIND (clause
))
709 case OMP_CLAUSE_LINEAR_DEFAULT
:
711 case OMP_CLAUSE_LINEAR_REF
:
712 pp_string (pp
, "ref(");
714 case OMP_CLAUSE_LINEAR_VAL
:
715 pp_string (pp
, "val(");
717 case OMP_CLAUSE_LINEAR_UVAL
:
718 pp_string (pp
, "uval(");
723 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
725 if (OMP_CLAUSE_LINEAR_KIND (clause
) != OMP_CLAUSE_LINEAR_DEFAULT
)
728 dump_generic_node (pp
, OMP_CLAUSE_LINEAR_STEP (clause
),
733 case OMP_CLAUSE_ALIGNED
:
734 pp_string (pp
, "aligned(");
735 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
737 if (OMP_CLAUSE_ALIGNED_ALIGNMENT (clause
))
740 dump_generic_node (pp
, OMP_CLAUSE_ALIGNED_ALIGNMENT (clause
),
746 case OMP_CLAUSE_ALLOCATE
:
747 pp_string (pp
, "allocate(");
748 if (OMP_CLAUSE_ALLOCATE_ALLOCATOR (clause
))
750 pp_string (pp
, "allocator(");
751 dump_generic_node (pp
, OMP_CLAUSE_ALLOCATE_ALLOCATOR (clause
),
755 if (OMP_CLAUSE_ALLOCATE_ALIGN (clause
))
757 if (OMP_CLAUSE_ALLOCATE_ALLOCATOR (clause
))
759 pp_string (pp
, "align(");
760 dump_generic_node (pp
, OMP_CLAUSE_ALLOCATE_ALIGN (clause
),
764 if (OMP_CLAUSE_ALLOCATE_ALLOCATOR (clause
)
765 || OMP_CLAUSE_ALLOCATE_ALIGN (clause
))
767 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
772 case OMP_CLAUSE_AFFINITY
:
773 pp_string (pp
, "affinity(");
775 tree t
= OMP_CLAUSE_DECL (clause
);
776 if (TREE_CODE (t
) == TREE_LIST
778 && TREE_CODE (TREE_PURPOSE (t
)) == TREE_VEC
)
780 dump_omp_iterators (pp
, TREE_PURPOSE (t
), spc
, flags
);
784 dump_generic_node (pp
, t
, spc
, flags
, false);
788 case OMP_CLAUSE_DEPEND
:
789 pp_string (pp
, "depend(");
790 switch (OMP_CLAUSE_DEPEND_KIND (clause
))
792 case OMP_CLAUSE_DEPEND_DEPOBJ
:
795 case OMP_CLAUSE_DEPEND_IN
:
798 case OMP_CLAUSE_DEPEND_OUT
:
801 case OMP_CLAUSE_DEPEND_INOUT
:
804 case OMP_CLAUSE_DEPEND_MUTEXINOUTSET
:
805 name
= "mutexinoutset";
807 case OMP_CLAUSE_DEPEND_SOURCE
:
808 pp_string (pp
, "source)");
810 case OMP_CLAUSE_DEPEND_LAST
:
811 name
= "__internal__";
813 case OMP_CLAUSE_DEPEND_SINK
:
814 pp_string (pp
, "sink:");
815 for (tree t
= OMP_CLAUSE_DECL (clause
); t
; t
= TREE_CHAIN (t
))
816 if (TREE_CODE (t
) == TREE_LIST
)
818 dump_generic_node (pp
, TREE_VALUE (t
), spc
, flags
, false);
819 if (TREE_PURPOSE (t
) != integer_zero_node
)
821 if (OMP_CLAUSE_DEPEND_SINK_NEGATIVE (t
))
825 dump_generic_node (pp
, TREE_PURPOSE (t
), spc
, flags
,
839 tree t
= OMP_CLAUSE_DECL (clause
);
840 if (TREE_CODE (t
) == TREE_LIST
842 && TREE_CODE (TREE_PURPOSE (t
)) == TREE_VEC
)
844 dump_omp_iterators (pp
, TREE_PURPOSE (t
), spc
, flags
);
850 pp_string (pp
, name
);
853 dump_generic_node (pp
, t
, spc
, flags
, false);
859 pp_string (pp
, "map(");
860 switch (OMP_CLAUSE_MAP_KIND (clause
))
863 case GOMP_MAP_POINTER
:
864 case GOMP_MAP_POINTER_TO_ZERO_LENGTH_ARRAY_SECTION
:
865 pp_string (pp
, "alloc");
867 case GOMP_MAP_IF_PRESENT
:
868 pp_string (pp
, "no_alloc");
871 case GOMP_MAP_TO_PSET
:
872 pp_string (pp
, "to");
875 pp_string (pp
, "from");
877 case GOMP_MAP_TOFROM
:
878 pp_string (pp
, "tofrom");
880 case GOMP_MAP_FORCE_ALLOC
:
881 pp_string (pp
, "force_alloc");
883 case GOMP_MAP_FORCE_TO
:
884 pp_string (pp
, "force_to");
886 case GOMP_MAP_FORCE_FROM
:
887 pp_string (pp
, "force_from");
889 case GOMP_MAP_FORCE_TOFROM
:
890 pp_string (pp
, "force_tofrom");
892 case GOMP_MAP_FORCE_PRESENT
:
893 pp_string (pp
, "force_present");
895 case GOMP_MAP_DELETE
:
896 pp_string (pp
, "delete");
898 case GOMP_MAP_FORCE_DEVICEPTR
:
899 pp_string (pp
, "force_deviceptr");
901 case GOMP_MAP_ALWAYS_TO
:
902 pp_string (pp
, "always,to");
904 case GOMP_MAP_ALWAYS_FROM
:
905 pp_string (pp
, "always,from");
907 case GOMP_MAP_ALWAYS_TOFROM
:
908 pp_string (pp
, "always,tofrom");
910 case GOMP_MAP_RELEASE
:
911 pp_string (pp
, "release");
913 case GOMP_MAP_FIRSTPRIVATE_POINTER
:
914 pp_string (pp
, "firstprivate");
916 case GOMP_MAP_FIRSTPRIVATE_REFERENCE
:
917 pp_string (pp
, "firstprivate ref");
919 case GOMP_MAP_STRUCT
:
920 pp_string (pp
, "struct");
922 case GOMP_MAP_ALWAYS_POINTER
:
923 pp_string (pp
, "always_pointer");
925 case GOMP_MAP_DEVICE_RESIDENT
:
926 pp_string (pp
, "device_resident");
929 pp_string (pp
, "link");
931 case GOMP_MAP_ATTACH
:
932 pp_string (pp
, "attach");
934 case GOMP_MAP_DETACH
:
935 pp_string (pp
, "detach");
937 case GOMP_MAP_FORCE_DETACH
:
938 pp_string (pp
, "force_detach");
940 case GOMP_MAP_ATTACH_DETACH
:
941 pp_string (pp
, "attach_detach");
943 case GOMP_MAP_ATTACH_ZERO_LENGTH_ARRAY_SECTION
:
944 pp_string (pp
, "attach_zero_length_array_section");
950 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
953 if (OMP_CLAUSE_SIZE (clause
))
955 switch (OMP_CLAUSE_CODE (clause
) == OMP_CLAUSE_MAP
956 ? OMP_CLAUSE_MAP_KIND (clause
) : GOMP_MAP_TO
)
958 case GOMP_MAP_POINTER
:
959 case GOMP_MAP_FIRSTPRIVATE_POINTER
:
960 case GOMP_MAP_FIRSTPRIVATE_REFERENCE
:
961 case GOMP_MAP_ALWAYS_POINTER
:
962 pp_string (pp
, " [pointer assign, bias: ");
964 case GOMP_MAP_POINTER_TO_ZERO_LENGTH_ARRAY_SECTION
:
965 pp_string (pp
, " [pointer assign, zero-length array section, bias: ");
967 case GOMP_MAP_TO_PSET
:
968 pp_string (pp
, " [pointer set, len: ");
970 case GOMP_MAP_ATTACH
:
971 case GOMP_MAP_DETACH
:
972 case GOMP_MAP_FORCE_DETACH
:
973 case GOMP_MAP_ATTACH_DETACH
:
974 case GOMP_MAP_ATTACH_ZERO_LENGTH_ARRAY_SECTION
:
975 pp_string (pp
, " [bias: ");
978 pp_string (pp
, " [len: ");
981 dump_generic_node (pp
, OMP_CLAUSE_SIZE (clause
),
983 pp_right_bracket (pp
);
985 if (OMP_CLAUSE_CODE (clause
) == OMP_CLAUSE_MAP
986 && OMP_CLAUSE_MAP_RUNTIME_IMPLICIT_P (clause
))
987 pp_string (pp
, "[implicit]");
991 case OMP_CLAUSE_FROM
:
992 pp_string (pp
, "from(");
993 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
995 goto print_clause_size
;
998 pp_string (pp
, "to(");
999 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
1001 goto print_clause_size
;
1003 case OMP_CLAUSE__CACHE_
:
1004 pp_string (pp
, "(");
1005 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
1007 goto print_clause_size
;
1009 case OMP_CLAUSE_NUM_TEAMS
:
1010 pp_string (pp
, "num_teams(");
1011 if (OMP_CLAUSE_NUM_TEAMS_LOWER_EXPR (clause
))
1013 dump_generic_node (pp
, OMP_CLAUSE_NUM_TEAMS_LOWER_EXPR (clause
),
1017 dump_generic_node (pp
, OMP_CLAUSE_NUM_TEAMS_UPPER_EXPR (clause
),
1019 pp_right_paren (pp
);
1022 case OMP_CLAUSE_THREAD_LIMIT
:
1023 pp_string (pp
, "thread_limit(");
1024 dump_generic_node (pp
, OMP_CLAUSE_THREAD_LIMIT_EXPR (clause
),
1026 pp_right_paren (pp
);
1029 case OMP_CLAUSE_DEVICE
:
1030 pp_string (pp
, "device(");
1031 if (OMP_CLAUSE_DEVICE_ANCESTOR (clause
))
1032 pp_string (pp
, "ancestor:");
1033 dump_generic_node (pp
, OMP_CLAUSE_DEVICE_ID (clause
),
1035 pp_right_paren (pp
);
1038 case OMP_CLAUSE_DIST_SCHEDULE
:
1039 pp_string (pp
, "dist_schedule(static");
1040 if (OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR (clause
))
1043 dump_generic_node (pp
,
1044 OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR (clause
),
1047 pp_right_paren (pp
);
1050 case OMP_CLAUSE_PROC_BIND
:
1051 pp_string (pp
, "proc_bind(");
1052 switch (OMP_CLAUSE_PROC_BIND_KIND (clause
))
1054 case OMP_CLAUSE_PROC_BIND_MASTER
:
1055 /* Same enum value: case OMP_CLAUSE_PROC_BIND_PRIMARY: */
1056 /* TODO: Change to 'primary' for OpenMP 5.1. */
1057 pp_string (pp
, "master");
1059 case OMP_CLAUSE_PROC_BIND_CLOSE
:
1060 pp_string (pp
, "close");
1062 case OMP_CLAUSE_PROC_BIND_SPREAD
:
1063 pp_string (pp
, "spread");
1068 pp_right_paren (pp
);
1071 case OMP_CLAUSE_DEVICE_TYPE
:
1072 pp_string (pp
, "device_type(");
1073 switch (OMP_CLAUSE_DEVICE_TYPE_KIND (clause
))
1075 case OMP_CLAUSE_DEVICE_TYPE_HOST
:
1076 pp_string (pp
, "host");
1078 case OMP_CLAUSE_DEVICE_TYPE_NOHOST
:
1079 pp_string (pp
, "nohost");
1081 case OMP_CLAUSE_DEVICE_TYPE_ANY
:
1082 pp_string (pp
, "any");
1087 pp_right_paren (pp
);
1090 case OMP_CLAUSE_SAFELEN
:
1091 pp_string (pp
, "safelen(");
1092 dump_generic_node (pp
, OMP_CLAUSE_SAFELEN_EXPR (clause
),
1094 pp_right_paren (pp
);
1097 case OMP_CLAUSE_SIMDLEN
:
1098 pp_string (pp
, "simdlen(");
1099 dump_generic_node (pp
, OMP_CLAUSE_SIMDLEN_EXPR (clause
),
1101 pp_right_paren (pp
);
1104 case OMP_CLAUSE_PRIORITY
:
1105 pp_string (pp
, "priority(");
1106 dump_generic_node (pp
, OMP_CLAUSE_PRIORITY_EXPR (clause
),
1108 pp_right_paren (pp
);
1111 case OMP_CLAUSE_GRAINSIZE
:
1112 pp_string (pp
, "grainsize(");
1113 if (OMP_CLAUSE_GRAINSIZE_STRICT (clause
))
1114 pp_string (pp
, "strict:");
1115 dump_generic_node (pp
, OMP_CLAUSE_GRAINSIZE_EXPR (clause
),
1117 pp_right_paren (pp
);
1120 case OMP_CLAUSE_NUM_TASKS
:
1121 pp_string (pp
, "num_tasks(");
1122 if (OMP_CLAUSE_NUM_TASKS_STRICT (clause
))
1123 pp_string (pp
, "strict:");
1124 dump_generic_node (pp
, OMP_CLAUSE_NUM_TASKS_EXPR (clause
),
1126 pp_right_paren (pp
);
1129 case OMP_CLAUSE_HINT
:
1130 pp_string (pp
, "hint(");
1131 dump_generic_node (pp
, OMP_CLAUSE_HINT_EXPR (clause
),
1133 pp_right_paren (pp
);
1136 case OMP_CLAUSE_FILTER
:
1137 pp_string (pp
, "filter(");
1138 dump_generic_node (pp
, OMP_CLAUSE_FILTER_EXPR (clause
),
1140 pp_right_paren (pp
);
1143 case OMP_CLAUSE_DEFAULTMAP
:
1144 pp_string (pp
, "defaultmap(");
1145 switch (OMP_CLAUSE_DEFAULTMAP_BEHAVIOR (clause
))
1147 case OMP_CLAUSE_DEFAULTMAP_ALLOC
:
1148 pp_string (pp
, "alloc");
1150 case OMP_CLAUSE_DEFAULTMAP_TO
:
1151 pp_string (pp
, "to");
1153 case OMP_CLAUSE_DEFAULTMAP_FROM
:
1154 pp_string (pp
, "from");
1156 case OMP_CLAUSE_DEFAULTMAP_TOFROM
:
1157 pp_string (pp
, "tofrom");
1159 case OMP_CLAUSE_DEFAULTMAP_FIRSTPRIVATE
:
1160 pp_string (pp
, "firstprivate");
1162 case OMP_CLAUSE_DEFAULTMAP_NONE
:
1163 pp_string (pp
, "none");
1165 case OMP_CLAUSE_DEFAULTMAP_DEFAULT
:
1166 pp_string (pp
, "default");
1171 switch (OMP_CLAUSE_DEFAULTMAP_CATEGORY (clause
))
1173 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_UNSPECIFIED
:
1175 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_SCALAR
:
1176 pp_string (pp
, ":scalar");
1178 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_AGGREGATE
:
1179 pp_string (pp
, ":aggregate");
1181 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_ALLOCATABLE
:
1182 pp_string (pp
, ":allocatable");
1184 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_POINTER
:
1185 pp_string (pp
, ":pointer");
1190 pp_right_paren (pp
);
1193 case OMP_CLAUSE_ORDER
:
1194 pp_string (pp
, "order(");
1195 if (OMP_CLAUSE_ORDER_UNCONSTRAINED (clause
))
1196 pp_string (pp
, "unconstrained:");
1197 else if (OMP_CLAUSE_ORDER_REPRODUCIBLE (clause
))
1198 pp_string (pp
, "reproducible:");
1199 pp_string (pp
, "concurrent)");
1202 case OMP_CLAUSE_BIND
:
1203 pp_string (pp
, "bind(");
1204 switch (OMP_CLAUSE_BIND_KIND (clause
))
1206 case OMP_CLAUSE_BIND_TEAMS
:
1207 pp_string (pp
, "teams");
1209 case OMP_CLAUSE_BIND_PARALLEL
:
1210 pp_string (pp
, "parallel");
1212 case OMP_CLAUSE_BIND_THREAD
:
1213 pp_string (pp
, "thread");
1218 pp_right_paren (pp
);
1221 case OMP_CLAUSE__SIMDUID_
:
1222 pp_string (pp
, "_simduid_(");
1223 dump_generic_node (pp
, OMP_CLAUSE__SIMDUID__DECL (clause
),
1225 pp_right_paren (pp
);
1228 case OMP_CLAUSE__SIMT_
:
1229 pp_string (pp
, "_simt_");
1232 case OMP_CLAUSE_GANG
:
1233 pp_string (pp
, "gang");
1234 if (OMP_CLAUSE_GANG_EXPR (clause
) != NULL_TREE
)
1236 pp_string (pp
, "(num: ");
1237 dump_generic_node (pp
, OMP_CLAUSE_GANG_EXPR (clause
),
1240 if (OMP_CLAUSE_GANG_STATIC_EXPR (clause
) != NULL_TREE
)
1242 if (OMP_CLAUSE_GANG_EXPR (clause
) == NULL_TREE
)
1246 pp_string (pp
, "static:");
1247 if (OMP_CLAUSE_GANG_STATIC_EXPR (clause
)
1248 == integer_minus_one_node
)
1249 pp_character (pp
, '*');
1251 dump_generic_node (pp
, OMP_CLAUSE_GANG_STATIC_EXPR (clause
),
1254 if (OMP_CLAUSE_GANG_EXPR (clause
) != NULL_TREE
1255 || OMP_CLAUSE_GANG_STATIC_EXPR (clause
) != NULL_TREE
)
1256 pp_right_paren (pp
);
1259 case OMP_CLAUSE_ASYNC
:
1260 pp_string (pp
, "async");
1261 if (OMP_CLAUSE_ASYNC_EXPR (clause
))
1263 pp_character(pp
, '(');
1264 dump_generic_node (pp
, OMP_CLAUSE_ASYNC_EXPR (clause
),
1266 pp_character(pp
, ')');
1270 case OMP_CLAUSE_AUTO
:
1271 case OMP_CLAUSE_SEQ
:
1272 pp_string (pp
, omp_clause_code_name
[OMP_CLAUSE_CODE (clause
)]);
1275 case OMP_CLAUSE_WAIT
:
1276 pp_string (pp
, "wait(");
1277 dump_generic_node (pp
, OMP_CLAUSE_WAIT_EXPR (clause
),
1279 pp_character(pp
, ')');
1282 case OMP_CLAUSE_WORKER
:
1283 pp_string (pp
, "worker");
1284 if (OMP_CLAUSE_WORKER_EXPR (clause
) != NULL_TREE
)
1287 dump_generic_node (pp
, OMP_CLAUSE_WORKER_EXPR (clause
),
1289 pp_right_paren (pp
);
1293 case OMP_CLAUSE_VECTOR
:
1294 pp_string (pp
, "vector");
1295 if (OMP_CLAUSE_VECTOR_EXPR (clause
) != NULL_TREE
)
1298 dump_generic_node (pp
, OMP_CLAUSE_VECTOR_EXPR (clause
),
1300 pp_right_paren (pp
);
1304 case OMP_CLAUSE_NUM_GANGS
:
1305 pp_string (pp
, "num_gangs(");
1306 dump_generic_node (pp
, OMP_CLAUSE_NUM_GANGS_EXPR (clause
),
1308 pp_character (pp
, ')');
1311 case OMP_CLAUSE_NUM_WORKERS
:
1312 pp_string (pp
, "num_workers(");
1313 dump_generic_node (pp
, OMP_CLAUSE_NUM_WORKERS_EXPR (clause
),
1315 pp_character (pp
, ')');
1318 case OMP_CLAUSE_VECTOR_LENGTH
:
1319 pp_string (pp
, "vector_length(");
1320 dump_generic_node (pp
, OMP_CLAUSE_VECTOR_LENGTH_EXPR (clause
),
1322 pp_character (pp
, ')');
1325 case OMP_CLAUSE_INBRANCH
:
1326 pp_string (pp
, "inbranch");
1328 case OMP_CLAUSE_NOTINBRANCH
:
1329 pp_string (pp
, "notinbranch");
1331 case OMP_CLAUSE_FOR
:
1332 pp_string (pp
, "for");
1334 case OMP_CLAUSE_PARALLEL
:
1335 pp_string (pp
, "parallel");
1337 case OMP_CLAUSE_SECTIONS
:
1338 pp_string (pp
, "sections");
1340 case OMP_CLAUSE_TASKGROUP
:
1341 pp_string (pp
, "taskgroup");
1343 case OMP_CLAUSE_NOGROUP
:
1344 pp_string (pp
, "nogroup");
1346 case OMP_CLAUSE_THREADS
:
1347 pp_string (pp
, "threads");
1349 case OMP_CLAUSE_SIMD
:
1350 pp_string (pp
, "simd");
1352 case OMP_CLAUSE_INDEPENDENT
:
1353 pp_string (pp
, "independent");
1355 case OMP_CLAUSE_TILE
:
1356 pp_string (pp
, "tile(");
1357 dump_generic_node (pp
, OMP_CLAUSE_TILE_LIST (clause
),
1359 pp_right_paren (pp
);
1362 case OMP_CLAUSE_IF_PRESENT
:
1363 pp_string (pp
, "if_present");
1365 case OMP_CLAUSE_FINALIZE
:
1366 pp_string (pp
, "finalize");
1368 case OMP_CLAUSE_NOHOST
:
1369 pp_string (pp
, "nohost");
1371 case OMP_CLAUSE_DETACH
:
1372 pp_string (pp
, "detach(");
1373 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
), spc
, flags
,
1375 pp_right_paren (pp
);
1384 /* Dump chain of OMP clauses.
1386 PP, SPC and FLAGS are as in dump_generic_node. */
1389 dump_omp_clauses (pretty_printer
*pp
, tree clause
, int spc
, dump_flags_t flags
,
1396 dump_omp_clause (pp
, clause
, spc
, flags
);
1397 leading_space
= true;
1399 clause
= OMP_CLAUSE_CHAIN (clause
);
1404 /* Dump location LOC to PP. */
1407 dump_location (pretty_printer
*pp
, location_t loc
)
1409 expanded_location xloc
= expand_location (loc
);
1411 pp_left_bracket (pp
);
1414 pp_string (pp
, xloc
.file
);
1415 pp_string (pp
, ":");
1417 pp_decimal_int (pp
, xloc
.line
);
1419 pp_decimal_int (pp
, xloc
.column
);
1420 pp_string (pp
, "] ");
1424 /* Dump lexical block BLOCK. PP, SPC and FLAGS are as in
1425 dump_generic_node. */
1428 dump_block_node (pretty_printer
*pp
, tree block
, int spc
, dump_flags_t flags
)
1432 pp_string (pp
, "BLOCK #");
1433 pp_decimal_int (pp
, BLOCK_NUMBER (block
));
1434 pp_character (pp
, ' ');
1436 if (flags
& TDF_ADDRESS
)
1438 pp_character (pp
, '[');
1439 pp_scalar (pp
, "%p", (void *) block
);
1440 pp_string (pp
, "] ");
1443 if (TREE_ASM_WRITTEN (block
))
1444 pp_string (pp
, "[written] ");
1446 if (flags
& TDF_SLIM
)
1449 if (BLOCK_SOURCE_LOCATION (block
))
1450 dump_location (pp
, BLOCK_SOURCE_LOCATION (block
));
1452 newline_and_indent (pp
, spc
+ 2);
1454 if (BLOCK_SUPERCONTEXT (block
))
1456 pp_string (pp
, "SUPERCONTEXT: ");
1457 dump_generic_node (pp
, BLOCK_SUPERCONTEXT (block
), 0,
1458 flags
| TDF_SLIM
, false);
1459 newline_and_indent (pp
, spc
+ 2);
1462 if (BLOCK_SUBBLOCKS (block
))
1464 pp_string (pp
, "SUBBLOCKS: ");
1465 for (t
= BLOCK_SUBBLOCKS (block
); t
; t
= BLOCK_CHAIN (t
))
1467 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
1470 newline_and_indent (pp
, spc
+ 2);
1473 if (BLOCK_CHAIN (block
))
1475 pp_string (pp
, "SIBLINGS: ");
1476 for (t
= BLOCK_CHAIN (block
); t
; t
= BLOCK_CHAIN (t
))
1478 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
1481 newline_and_indent (pp
, spc
+ 2);
1484 if (BLOCK_VARS (block
))
1486 pp_string (pp
, "VARS: ");
1487 for (t
= BLOCK_VARS (block
); t
; t
= TREE_CHAIN (t
))
1489 dump_generic_node (pp
, t
, 0, flags
, false);
1492 newline_and_indent (pp
, spc
+ 2);
1495 if (vec_safe_length (BLOCK_NONLOCALIZED_VARS (block
)) > 0)
1498 vec
<tree
, va_gc
> *nlv
= BLOCK_NONLOCALIZED_VARS (block
);
1500 pp_string (pp
, "NONLOCALIZED_VARS: ");
1501 FOR_EACH_VEC_ELT (*nlv
, i
, t
)
1503 dump_generic_node (pp
, t
, 0, flags
, false);
1506 newline_and_indent (pp
, spc
+ 2);
1509 if (BLOCK_ABSTRACT_ORIGIN (block
))
1511 pp_string (pp
, "ABSTRACT_ORIGIN: ");
1512 dump_generic_node (pp
, BLOCK_ABSTRACT_ORIGIN (block
), 0,
1513 flags
| TDF_SLIM
, false);
1514 newline_and_indent (pp
, spc
+ 2);
1517 if (BLOCK_FRAGMENT_ORIGIN (block
))
1519 pp_string (pp
, "FRAGMENT_ORIGIN: ");
1520 dump_generic_node (pp
, BLOCK_FRAGMENT_ORIGIN (block
), 0,
1521 flags
| TDF_SLIM
, false);
1522 newline_and_indent (pp
, spc
+ 2);
1525 if (BLOCK_FRAGMENT_CHAIN (block
))
1527 pp_string (pp
, "FRAGMENT_CHAIN: ");
1528 for (t
= BLOCK_FRAGMENT_CHAIN (block
); t
; t
= BLOCK_FRAGMENT_CHAIN (t
))
1530 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
1533 newline_and_indent (pp
, spc
+ 2);
1537 /* Dump #pragma omp atomic memory order clause. */
1540 dump_omp_atomic_memory_order (pretty_printer
*pp
, enum omp_memory_order mo
)
1542 switch (mo
& OMP_MEMORY_ORDER_MASK
)
1544 case OMP_MEMORY_ORDER_RELAXED
:
1545 pp_string (pp
, " relaxed");
1547 case OMP_MEMORY_ORDER_SEQ_CST
:
1548 pp_string (pp
, " seq_cst");
1550 case OMP_MEMORY_ORDER_ACQ_REL
:
1551 pp_string (pp
, " acq_rel");
1553 case OMP_MEMORY_ORDER_ACQUIRE
:
1554 pp_string (pp
, " acquire");
1556 case OMP_MEMORY_ORDER_RELEASE
:
1557 pp_string (pp
, " release");
1559 case OMP_MEMORY_ORDER_UNSPECIFIED
:
1564 switch (mo
& OMP_FAIL_MEMORY_ORDER_MASK
)
1566 case OMP_FAIL_MEMORY_ORDER_RELAXED
:
1567 pp_string (pp
, " fail(relaxed)");
1569 case OMP_FAIL_MEMORY_ORDER_SEQ_CST
:
1570 pp_string (pp
, " fail(seq_cst)");
1572 case OMP_FAIL_MEMORY_ORDER_ACQUIRE
:
1573 pp_string (pp
, " fail(acquire)");
1575 case OMP_FAIL_MEMORY_ORDER_UNSPECIFIED
:
1582 /* Helper to dump a MEM_REF node. */
1585 dump_mem_ref (pretty_printer
*pp
, tree node
, int spc
, dump_flags_t flags
)
1587 if (TREE_CODE (node
) == MEM_REF
&& (flags
& TDF_GIMPLE
))
1589 pp_string (pp
, "__MEM <");
1590 dump_generic_node (pp
, TREE_TYPE (node
),
1591 spc
, flags
| TDF_SLIM
, false);
1592 if (TYPE_ALIGN (TREE_TYPE (node
))
1593 != TYPE_ALIGN (TYPE_MAIN_VARIANT (TREE_TYPE (node
))))
1595 pp_string (pp
, ", ");
1596 pp_decimal_int (pp
, TYPE_ALIGN (TREE_TYPE (node
)));
1599 pp_string (pp
, " (");
1600 if (TREE_TYPE (TREE_OPERAND (node
, 0))
1601 != TREE_TYPE (TREE_OPERAND (node
, 1)))
1604 dump_generic_node (pp
, TREE_TYPE (TREE_OPERAND (node
, 1)),
1605 spc
, flags
| TDF_SLIM
, false);
1606 pp_right_paren (pp
);
1608 dump_generic_node (pp
, TREE_OPERAND (node
, 0),
1609 spc
, flags
| TDF_SLIM
, false);
1610 if (! integer_zerop (TREE_OPERAND (node
, 1)))
1612 pp_string (pp
, " + ");
1613 dump_generic_node (pp
, TREE_OPERAND (node
, 1),
1614 spc
, flags
| TDF_SLIM
, false);
1616 pp_right_paren (pp
);
1618 else if (TREE_CODE (node
) == MEM_REF
1619 && integer_zerop (TREE_OPERAND (node
, 1))
1620 /* Dump the types of INTEGER_CSTs explicitly, for we can't
1621 infer them and MEM_ATTR caching will share MEM_REFs
1622 with differently-typed op0s. */
1623 && TREE_CODE (TREE_OPERAND (node
, 0)) != INTEGER_CST
1624 /* Released SSA_NAMES have no TREE_TYPE. */
1625 && TREE_TYPE (TREE_OPERAND (node
, 0)) != NULL_TREE
1626 /* Same pointer types, but ignoring POINTER_TYPE vs.
1628 && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 0)))
1629 == TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 1))))
1630 && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (node
, 0)))
1631 == TYPE_MODE (TREE_TYPE (TREE_OPERAND (node
, 1))))
1632 && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node
, 0)))
1633 == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node
, 1))))
1634 /* Same value types ignoring qualifiers. */
1635 && (TYPE_MAIN_VARIANT (TREE_TYPE (node
))
1636 == TYPE_MAIN_VARIANT
1637 (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 1)))))
1638 && (!(flags
& TDF_ALIAS
)
1639 || MR_DEPENDENCE_CLIQUE (node
) == 0))
1641 if (TREE_CODE (TREE_OPERAND (node
, 0)) != ADDR_EXPR
)
1643 /* Enclose pointers to arrays in parentheses. */
1644 tree op0
= TREE_OPERAND (node
, 0);
1645 tree op0type
= TREE_TYPE (op0
);
1646 if (POINTER_TYPE_P (op0type
)
1647 && TREE_CODE (TREE_TYPE (op0type
)) == ARRAY_TYPE
)
1650 dump_generic_node (pp
, op0
, spc
, flags
, false);
1651 if (POINTER_TYPE_P (op0type
)
1652 && TREE_CODE (TREE_TYPE (op0type
)) == ARRAY_TYPE
)
1653 pp_right_paren (pp
);
1656 dump_generic_node (pp
,
1657 TREE_OPERAND (TREE_OPERAND (node
, 0), 0),
1662 pp_string (pp
, "MEM");
1664 tree nodetype
= TREE_TYPE (node
);
1665 tree op0
= TREE_OPERAND (node
, 0);
1666 tree op1
= TREE_OPERAND (node
, 1);
1667 tree op1type
= TYPE_MAIN_VARIANT (TREE_TYPE (op1
));
1669 tree op0size
= TYPE_SIZE (nodetype
);
1670 tree op1size
= TYPE_SIZE (TREE_TYPE (op1type
));
1672 if (!op0size
|| !op1size
1673 || !operand_equal_p (op0size
, op1size
, 0))
1675 pp_string (pp
, " <");
1676 /* If the size of the type of the operand is not the same
1677 as the size of the MEM_REF expression include the type
1678 of the latter similar to the TDF_GIMPLE output to make
1679 it clear how many bytes of memory are being accessed. */
1680 dump_generic_node (pp
, nodetype
, spc
, flags
| TDF_SLIM
, false);
1681 pp_string (pp
, "> ");
1684 pp_string (pp
, "[(");
1685 dump_generic_node (pp
, op1type
, spc
, flags
| TDF_SLIM
, false);
1686 pp_right_paren (pp
);
1687 dump_generic_node (pp
, op0
, spc
, flags
, false);
1688 if (!integer_zerop (op1
))
1690 pp_string (pp
, " + ");
1691 dump_generic_node (pp
, op1
, spc
, flags
, false);
1693 if (TREE_CODE (node
) == TARGET_MEM_REF
)
1695 tree tmp
= TMR_INDEX2 (node
);
1698 pp_string (pp
, " + ");
1699 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1701 tmp
= TMR_INDEX (node
);
1704 pp_string (pp
, " + ");
1705 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1706 tmp
= TMR_STEP (node
);
1707 pp_string (pp
, " * ");
1709 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1711 pp_string (pp
, "1");
1714 if ((flags
& TDF_ALIAS
)
1715 && MR_DEPENDENCE_CLIQUE (node
) != 0)
1717 pp_string (pp
, " clique ");
1718 pp_unsigned_wide_integer (pp
, MR_DEPENDENCE_CLIQUE (node
));
1719 pp_string (pp
, " base ");
1720 pp_unsigned_wide_integer (pp
, MR_DEPENDENCE_BASE (node
));
1722 pp_right_bracket (pp
);
1726 /* Helper function for dump_generic_node. Dump INIT or COND expression for
1727 OpenMP loop non-rectangular iterators. */
1730 dump_omp_loop_non_rect_expr (pretty_printer
*pp
, tree node
, int spc
,
1733 gcc_assert (TREE_CODE (node
) == TREE_VEC
);
1734 dump_generic_node (pp
, TREE_VEC_ELT (node
, 0), spc
, flags
, false);
1735 pp_string (pp
, " * ");
1736 if (op_prio (TREE_VEC_ELT (node
, 1)) <= op_code_prio (MULT_EXPR
))
1739 dump_generic_node (pp
, TREE_VEC_ELT (node
, 1), spc
, flags
, false);
1740 pp_right_paren (pp
);
1743 dump_generic_node (pp
, TREE_VEC_ELT (node
, 1), spc
, flags
, false);
1744 pp_string (pp
, " + ");
1745 if (op_prio (TREE_VEC_ELT (node
, 1)) <= op_code_prio (PLUS_EXPR
))
1748 dump_generic_node (pp
, TREE_VEC_ELT (node
, 2), spc
, flags
, false);
1749 pp_right_paren (pp
);
1752 dump_generic_node (pp
, TREE_VEC_ELT (node
, 2), spc
, flags
, false);
1755 /* Dump the node NODE on the pretty_printer PP, SPC spaces of
1756 indent. FLAGS specifies details to show in the dump (see TDF_* in
1757 dumpfile.h). If IS_STMT is true, the object printed is considered
1758 to be a statement and it is terminated by ';' if appropriate. */
1761 dump_generic_node (pretty_printer
*pp
, tree node
, int spc
, dump_flags_t flags
,
1768 enum tree_code code
;
1770 if (node
== NULL_TREE
)
1773 is_expr
= EXPR_P (node
);
1775 if (is_stmt
&& (flags
& TDF_STMTADDR
))
1777 pp_string (pp
, "<&");
1778 pp_scalar (pp
, "%p", (void *)node
);
1779 pp_string (pp
, "> ");
1782 if ((flags
& TDF_LINENO
) && EXPR_HAS_LOCATION (node
))
1783 dump_location (pp
, EXPR_LOCATION (node
));
1785 code
= TREE_CODE (node
);
1789 pp_string (pp
, "<<< error >>>");
1792 case IDENTIFIER_NODE
:
1793 pp_tree_identifier (pp
, node
);
1797 while (node
&& node
!= error_mark_node
)
1799 if (TREE_PURPOSE (node
))
1801 dump_generic_node (pp
, TREE_PURPOSE (node
), spc
, flags
, false);
1804 dump_generic_node (pp
, TREE_VALUE (node
), spc
, flags
, false);
1805 node
= TREE_CHAIN (node
);
1806 if (node
&& TREE_CODE (node
) == TREE_LIST
)
1815 dump_generic_node (pp
, BINFO_TYPE (node
), spc
, flags
, false);
1821 if (TREE_VEC_LENGTH (node
) > 0)
1823 size_t len
= TREE_VEC_LENGTH (node
);
1824 for (i
= 0; i
< len
- 1; i
++)
1826 dump_generic_node (pp
, TREE_VEC_ELT (node
, i
), spc
, flags
,
1831 dump_generic_node (pp
, TREE_VEC_ELT (node
, len
- 1), spc
,
1840 case FIXED_POINT_TYPE
:
1847 unsigned int quals
= TYPE_QUALS (node
);
1848 enum tree_code_class tclass
;
1850 if (quals
& TYPE_QUAL_ATOMIC
)
1851 pp_string (pp
, "atomic ");
1852 if (quals
& TYPE_QUAL_CONST
)
1853 pp_string (pp
, "const ");
1854 if (quals
& TYPE_QUAL_VOLATILE
)
1855 pp_string (pp
, "volatile ");
1856 if (quals
& TYPE_QUAL_RESTRICT
)
1857 pp_string (pp
, "restrict ");
1859 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
1861 pp_string (pp
, "<address-space-");
1862 pp_decimal_int (pp
, TYPE_ADDR_SPACE (node
));
1863 pp_string (pp
, "> ");
1866 tclass
= TREE_CODE_CLASS (TREE_CODE (node
));
1868 if (tclass
== tcc_declaration
)
1870 if (DECL_NAME (node
))
1871 dump_decl_name (pp
, node
, flags
);
1873 pp_string (pp
, "<unnamed type decl>");
1875 else if (tclass
== tcc_type
)
1877 if (TYPE_NAME (node
))
1879 if (TREE_CODE (TYPE_NAME (node
)) == IDENTIFIER_NODE
)
1880 pp_tree_identifier (pp
, TYPE_NAME (node
));
1881 else if (TREE_CODE (TYPE_NAME (node
)) == TYPE_DECL
1882 && DECL_NAME (TYPE_NAME (node
)))
1883 dump_decl_name (pp
, TYPE_NAME (node
), flags
);
1885 pp_string (pp
, "<unnamed type>");
1887 else if (TREE_CODE (node
) == VECTOR_TYPE
)
1889 pp_string (pp
, "vector");
1891 pp_wide_integer (pp
, TYPE_VECTOR_SUBPARTS (node
));
1892 pp_string (pp
, ") ");
1893 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1895 else if (TREE_CODE (node
) == INTEGER_TYPE
)
1897 if (TYPE_PRECISION (node
) == CHAR_TYPE_SIZE
)
1898 pp_string (pp
, (TYPE_UNSIGNED (node
)
1901 else if (TYPE_PRECISION (node
) == SHORT_TYPE_SIZE
)
1902 pp_string (pp
, (TYPE_UNSIGNED (node
)
1905 else if (TYPE_PRECISION (node
) == INT_TYPE_SIZE
)
1906 pp_string (pp
, (TYPE_UNSIGNED (node
)
1909 else if (TYPE_PRECISION (node
) == LONG_TYPE_SIZE
)
1910 pp_string (pp
, (TYPE_UNSIGNED (node
)
1913 else if (TYPE_PRECISION (node
) == LONG_LONG_TYPE_SIZE
)
1914 pp_string (pp
, (TYPE_UNSIGNED (node
)
1915 ? "unsigned long long"
1916 : "signed long long"));
1917 else if (TYPE_PRECISION (node
) >= CHAR_TYPE_SIZE
1918 && pow2p_hwi (TYPE_PRECISION (node
)))
1920 pp_string (pp
, (TYPE_UNSIGNED (node
) ? "uint" : "int"));
1921 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1922 pp_string (pp
, "_t");
1926 pp_string (pp
, (TYPE_UNSIGNED (node
)
1927 ? "<unnamed-unsigned:"
1928 : "<unnamed-signed:"));
1929 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1933 else if (TREE_CODE (node
) == COMPLEX_TYPE
)
1935 pp_string (pp
, "__complex__ ");
1936 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1938 else if (TREE_CODE (node
) == REAL_TYPE
)
1940 pp_string (pp
, "<float:");
1941 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1944 else if (TREE_CODE (node
) == FIXED_POINT_TYPE
)
1946 pp_string (pp
, "<fixed-point-");
1947 pp_string (pp
, TYPE_SATURATING (node
) ? "sat:" : "nonsat:");
1948 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1951 else if (TREE_CODE (node
) == BOOLEAN_TYPE
)
1953 pp_string (pp
, (TYPE_UNSIGNED (node
)
1954 ? "<unsigned-boolean:"
1955 : "<signed-boolean:"));
1956 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1959 else if (TREE_CODE (node
) == VOID_TYPE
)
1960 pp_string (pp
, "void");
1962 pp_string (pp
, "<unnamed type>");
1968 case REFERENCE_TYPE
:
1969 str
= (TREE_CODE (node
) == POINTER_TYPE
? "*" : "&");
1971 if (TREE_TYPE (node
) == NULL
)
1973 pp_string (pp
, str
);
1974 pp_string (pp
, "<null type>");
1976 else if (TREE_CODE (TREE_TYPE (node
)) == FUNCTION_TYPE
)
1978 tree fnode
= TREE_TYPE (node
);
1980 dump_generic_node (pp
, TREE_TYPE (fnode
), spc
, flags
, false);
1983 pp_string (pp
, str
);
1984 if (TYPE_IDENTIFIER (node
))
1985 dump_generic_node (pp
, TYPE_NAME (node
), spc
, flags
, false);
1986 else if (flags
& TDF_NOUID
)
1987 pp_string (pp
, "<Txxxx>");
1990 pp_string (pp
, "<T");
1991 pp_scalar (pp
, "%x", TYPE_UID (node
));
1992 pp_character (pp
, '>');
1995 pp_right_paren (pp
);
1996 dump_function_declaration (pp
, fnode
, spc
, flags
);
2000 unsigned int quals
= TYPE_QUALS (node
);
2002 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2004 pp_string (pp
, str
);
2006 if (quals
& TYPE_QUAL_CONST
)
2007 pp_string (pp
, " const");
2008 if (quals
& TYPE_QUAL_VOLATILE
)
2009 pp_string (pp
, " volatile");
2010 if (quals
& TYPE_QUAL_RESTRICT
)
2011 pp_string (pp
, " restrict");
2013 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
2015 pp_string (pp
, " <address-space-");
2016 pp_decimal_int (pp
, TYPE_ADDR_SPACE (node
));
2020 if (TYPE_REF_CAN_ALIAS_ALL (node
))
2021 pp_string (pp
, " {ref-all}");
2030 case TARGET_MEM_REF
:
2031 dump_mem_ref (pp
, node
, spc
, flags
);
2036 unsigned int quals
= TYPE_QUALS (node
);
2039 if (quals
& TYPE_QUAL_ATOMIC
)
2040 pp_string (pp
, "atomic ");
2041 if (quals
& TYPE_QUAL_CONST
)
2042 pp_string (pp
, "const ");
2043 if (quals
& TYPE_QUAL_VOLATILE
)
2044 pp_string (pp
, "volatile ");
2046 /* Print the innermost component type. */
2047 for (tmp
= TREE_TYPE (node
); TREE_CODE (tmp
) == ARRAY_TYPE
;
2048 tmp
= TREE_TYPE (tmp
))
2050 dump_generic_node (pp
, tmp
, spc
, flags
, false);
2052 /* Print the dimensions. */
2053 for (tmp
= node
; TREE_CODE (tmp
) == ARRAY_TYPE
; tmp
= TREE_TYPE (tmp
))
2054 dump_array_domain (pp
, TYPE_DOMAIN (tmp
), spc
, flags
);
2060 case QUAL_UNION_TYPE
:
2062 unsigned int quals
= TYPE_QUALS (node
);
2064 if (quals
& TYPE_QUAL_ATOMIC
)
2065 pp_string (pp
, "atomic ");
2066 if (quals
& TYPE_QUAL_CONST
)
2067 pp_string (pp
, "const ");
2068 if (quals
& TYPE_QUAL_VOLATILE
)
2069 pp_string (pp
, "volatile ");
2071 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
2073 pp_string (pp
, "<address-space-");
2074 pp_decimal_int (pp
, TYPE_ADDR_SPACE (node
));
2075 pp_string (pp
, "> ");
2078 /* Print the name of the structure. */
2079 if (TREE_CODE (node
) == RECORD_TYPE
)
2080 pp_string (pp
, "struct ");
2081 else if (TREE_CODE (node
) == UNION_TYPE
)
2082 pp_string (pp
, "union ");
2084 if (TYPE_NAME (node
))
2085 dump_generic_node (pp
, TYPE_NAME (node
), spc
, flags
, false);
2086 else if (!(flags
& TDF_SLIM
))
2087 /* FIXME: If we eliminate the 'else' above and attempt
2088 to show the fields for named types, we may get stuck
2089 following a cycle of pointers to structs. The alleged
2090 self-reference check in print_struct_decl will not detect
2091 cycles involving more than one pointer or struct type. */
2092 print_struct_decl (pp
, node
, spc
, flags
);
2101 if (flags
& TDF_GIMPLE
2102 && (POINTER_TYPE_P (TREE_TYPE (node
))
2103 || (TYPE_PRECISION (TREE_TYPE (node
))
2104 < TYPE_PRECISION (integer_type_node
))
2105 || exact_log2 (TYPE_PRECISION (TREE_TYPE (node
))) == -1
2106 || tree_int_cst_sgn (node
) < 0))
2108 pp_string (pp
, "_Literal (");
2109 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2110 pp_string (pp
, ") ");
2112 if (TREE_CODE (TREE_TYPE (node
)) == POINTER_TYPE
2113 && ! (flags
& TDF_GIMPLE
))
2115 /* In the case of a pointer, one may want to divide by the
2116 size of the pointed-to type. Unfortunately, this not
2117 straightforward. The C front-end maps expressions
2122 in such a way that the two INTEGER_CST nodes for "5" have
2123 different values but identical types. In the latter
2124 case, the 5 is multiplied by sizeof (int) in c-common.cc
2125 (pointer_int_sum) to convert it to a byte address, and
2126 yet the type of the node is left unchanged. Argh. What
2127 is consistent though is that the number value corresponds
2128 to bytes (UNITS) offset.
2130 NB: Neither of the following divisors can be trivially
2131 used to recover the original literal:
2133 TREE_INT_CST_LOW (TYPE_SIZE_UNIT (TREE_TYPE (node)))
2134 TYPE_PRECISION (TREE_TYPE (TREE_TYPE (node))) */
2135 pp_wide_integer (pp
, TREE_INT_CST_LOW (node
));
2136 pp_string (pp
, "B"); /* pseudo-unit */
2138 else if (tree_fits_shwi_p (node
))
2139 pp_wide_integer (pp
, tree_to_shwi (node
));
2140 else if (tree_fits_uhwi_p (node
))
2141 pp_unsigned_wide_integer (pp
, tree_to_uhwi (node
));
2144 wide_int val
= wi::to_wide (node
);
2146 if (wi::neg_p (val
, TYPE_SIGN (TREE_TYPE (node
))))
2151 print_hex (val
, pp_buffer (pp
)->digit_buffer
);
2152 pp_string (pp
, pp_buffer (pp
)->digit_buffer
);
2154 if ((flags
& TDF_GIMPLE
)
2155 && ! (POINTER_TYPE_P (TREE_TYPE (node
))
2156 || (TYPE_PRECISION (TREE_TYPE (node
))
2157 < TYPE_PRECISION (integer_type_node
))
2158 || exact_log2 (TYPE_PRECISION (TREE_TYPE (node
))) == -1))
2160 if (TYPE_UNSIGNED (TREE_TYPE (node
)))
2161 pp_character (pp
, 'u');
2162 if (TYPE_PRECISION (TREE_TYPE (node
))
2163 == TYPE_PRECISION (unsigned_type_node
))
2165 else if (TYPE_PRECISION (TREE_TYPE (node
))
2166 == TYPE_PRECISION (long_unsigned_type_node
))
2167 pp_character (pp
, 'l');
2168 else if (TYPE_PRECISION (TREE_TYPE (node
))
2169 == TYPE_PRECISION (long_long_unsigned_type_node
))
2170 pp_string (pp
, "ll");
2172 if (TREE_OVERFLOW (node
))
2173 pp_string (pp
, "(OVF)");
2177 pp_string (pp
, "POLY_INT_CST [");
2178 dump_generic_node (pp
, POLY_INT_CST_COEFF (node
, 0), spc
, flags
, false);
2179 for (unsigned int i
= 1; i
< NUM_POLY_INT_COEFFS
; ++i
)
2181 pp_string (pp
, ", ");
2182 dump_generic_node (pp
, POLY_INT_CST_COEFF (node
, i
),
2185 pp_string (pp
, "]");
2189 /* Code copied from print_node. */
2192 if (TREE_OVERFLOW (node
))
2193 pp_string (pp
, " overflow");
2195 d
= TREE_REAL_CST (node
);
2196 if (REAL_VALUE_ISINF (d
))
2197 pp_string (pp
, REAL_VALUE_NEGATIVE (d
) ? " -Inf" : " Inf");
2198 else if (REAL_VALUE_ISNAN (d
))
2199 pp_string (pp
, " Nan");
2203 real_to_decimal (string
, &d
, sizeof (string
), 0, 1);
2204 pp_string (pp
, string
);
2212 fixed_to_decimal (string
, TREE_FIXED_CST_PTR (node
), sizeof (string
));
2213 pp_string (pp
, string
);
2218 pp_string (pp
, "__complex__ (");
2219 dump_generic_node (pp
, TREE_REALPART (node
), spc
, flags
, false);
2220 pp_string (pp
, ", ");
2221 dump_generic_node (pp
, TREE_IMAGPART (node
), spc
, flags
, false);
2222 pp_right_paren (pp
);
2227 pp_string (pp
, "\"");
2228 if (unsigned nbytes
= TREE_STRING_LENGTH (node
))
2229 pretty_print_string (pp
, TREE_STRING_POINTER (node
), nbytes
);
2230 pp_string (pp
, "\"");
2237 if (flags
& TDF_GIMPLE
)
2239 pp_string (pp
, "_Literal (");
2240 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2241 pp_string (pp
, ") ");
2243 pp_string (pp
, "{ ");
2244 unsigned HOST_WIDE_INT nunits
;
2245 if (!VECTOR_CST_NELTS (node
).is_constant (&nunits
))
2246 nunits
= vector_cst_encoded_nelts (node
);
2247 for (i
= 0; i
< nunits
; ++i
)
2250 pp_string (pp
, ", ");
2251 dump_generic_node (pp
, VECTOR_CST_ELT (node
, i
),
2254 if (!VECTOR_CST_NELTS (node
).is_constant ())
2255 pp_string (pp
, ", ...");
2256 pp_string (pp
, " }");
2262 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2264 if (TREE_CODE (node
) == METHOD_TYPE
)
2266 if (TYPE_METHOD_BASETYPE (node
))
2267 dump_generic_node (pp
, TYPE_NAME (TYPE_METHOD_BASETYPE (node
)),
2270 pp_string (pp
, "<null method basetype>");
2271 pp_colon_colon (pp
);
2273 if (TYPE_IDENTIFIER (node
))
2274 dump_generic_node (pp
, TYPE_NAME (node
), spc
, flags
, false);
2275 else if (TYPE_NAME (node
) && DECL_NAME (TYPE_NAME (node
)))
2276 dump_decl_name (pp
, TYPE_NAME (node
), flags
);
2277 else if (flags
& TDF_NOUID
)
2278 pp_string (pp
, "<Txxxx>");
2281 pp_string (pp
, "<T");
2282 pp_scalar (pp
, "%x", TYPE_UID (node
));
2283 pp_character (pp
, '>');
2285 dump_function_declaration (pp
, node
, spc
, flags
);
2290 dump_decl_name (pp
, node
, flags
);
2294 if (DECL_NAME (node
))
2295 dump_decl_name (pp
, node
, flags
);
2296 else if (LABEL_DECL_UID (node
) != -1)
2298 if (flags
& TDF_GIMPLE
)
2300 pp_character (pp
, 'L');
2301 pp_decimal_int (pp
, (int) LABEL_DECL_UID (node
));
2305 pp_string (pp
, "<L");
2306 pp_decimal_int (pp
, (int) LABEL_DECL_UID (node
));
2307 pp_character (pp
, '>');
2312 if (flags
& TDF_NOUID
)
2313 pp_string (pp
, "<D.xxxx>");
2316 if (flags
& TDF_GIMPLE
)
2318 pp_character (pp
, 'D');
2319 pp_scalar (pp
, "%u", DECL_UID (node
));
2323 pp_string (pp
, "<D.");
2324 pp_scalar (pp
, "%u", DECL_UID (node
));
2325 pp_character (pp
, '>');
2332 if (DECL_IS_UNDECLARED_BUILTIN (node
))
2334 /* Don't print the declaration of built-in types. */
2337 if (DECL_NAME (node
))
2338 dump_decl_name (pp
, node
, flags
);
2339 else if (TYPE_NAME (TREE_TYPE (node
)) != node
)
2341 pp_string (pp
, (TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
2342 ? "union" : "struct "));
2343 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2346 pp_string (pp
, "<anon>");
2352 case DEBUG_EXPR_DECL
:
2353 case NAMESPACE_DECL
:
2355 dump_decl_name (pp
, node
, flags
);
2359 pp_string (pp
, "<retval>");
2363 op0
= TREE_OPERAND (node
, 0);
2366 && (TREE_CODE (op0
) == INDIRECT_REF
2367 || (TREE_CODE (op0
) == MEM_REF
2368 && TREE_CODE (TREE_OPERAND (op0
, 0)) != ADDR_EXPR
2369 && integer_zerop (TREE_OPERAND (op0
, 1))
2370 /* Dump the types of INTEGER_CSTs explicitly, for we
2371 can't infer them and MEM_ATTR caching will share
2372 MEM_REFs with differently-typed op0s. */
2373 && TREE_CODE (TREE_OPERAND (op0
, 0)) != INTEGER_CST
2374 /* Released SSA_NAMES have no TREE_TYPE. */
2375 && TREE_TYPE (TREE_OPERAND (op0
, 0)) != NULL_TREE
2376 /* Same pointer types, but ignoring POINTER_TYPE vs.
2378 && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 0)))
2379 == TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 1))))
2380 && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0
, 0)))
2381 == TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0
, 1))))
2382 && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0
, 0)))
2383 == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0
, 1))))
2384 /* Same value types ignoring qualifiers. */
2385 && (TYPE_MAIN_VARIANT (TREE_TYPE (op0
))
2386 == TYPE_MAIN_VARIANT
2387 (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 1)))))
2388 && MR_DEPENDENCE_CLIQUE (op0
) == 0)))
2390 op0
= TREE_OPERAND (op0
, 0);
2393 if (op_prio (op0
) < op_prio (node
))
2395 dump_generic_node (pp
, op0
, spc
, flags
, false);
2396 if (op_prio (op0
) < op_prio (node
))
2397 pp_right_paren (pp
);
2398 pp_string (pp
, str
);
2399 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2400 op0
= component_ref_field_offset (node
);
2401 if (op0
&& TREE_CODE (op0
) != INTEGER_CST
)
2403 pp_string (pp
, "{off: ");
2404 dump_generic_node (pp
, op0
, spc
, flags
, false);
2405 pp_right_brace (pp
);
2410 if (flags
& TDF_GIMPLE
)
2412 pp_string (pp
, "__BIT_FIELD_REF <");
2413 dump_generic_node (pp
, TREE_TYPE (node
),
2414 spc
, flags
| TDF_SLIM
, false);
2415 if (TYPE_ALIGN (TREE_TYPE (node
))
2416 != TYPE_ALIGN (TYPE_MAIN_VARIANT (TREE_TYPE (node
))))
2418 pp_string (pp
, ", ");
2419 pp_decimal_int (pp
, TYPE_ALIGN (TREE_TYPE (node
)));
2422 pp_string (pp
, " (");
2423 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
,
2424 flags
| TDF_SLIM
, false);
2425 pp_string (pp
, ", ");
2426 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
,
2427 flags
| TDF_SLIM
, false);
2428 pp_string (pp
, ", ");
2429 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
,
2430 flags
| TDF_SLIM
, false);
2431 pp_right_paren (pp
);
2435 pp_string (pp
, "BIT_FIELD_REF <");
2436 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2437 pp_string (pp
, ", ");
2438 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2439 pp_string (pp
, ", ");
2440 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2445 case BIT_INSERT_EXPR
:
2446 pp_string (pp
, "BIT_INSERT_EXPR <");
2447 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2448 pp_string (pp
, ", ");
2449 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2450 pp_string (pp
, ", ");
2451 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2452 pp_string (pp
, " (");
2453 if (INTEGRAL_TYPE_P (TREE_TYPE (TREE_OPERAND (node
, 1))))
2455 TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (node
, 1))));
2457 dump_generic_node (pp
, TYPE_SIZE (TREE_TYPE (TREE_OPERAND (node
, 1))),
2459 pp_string (pp
, " bits)>");
2463 case ARRAY_RANGE_REF
:
2464 op0
= TREE_OPERAND (node
, 0);
2465 if (op_prio (op0
) < op_prio (node
))
2467 dump_generic_node (pp
, op0
, spc
, flags
, false);
2468 if (op_prio (op0
) < op_prio (node
))
2469 pp_right_paren (pp
);
2470 pp_left_bracket (pp
);
2471 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2472 if (TREE_CODE (node
) == ARRAY_RANGE_REF
)
2473 pp_string (pp
, " ...");
2474 pp_right_bracket (pp
);
2476 op0
= array_ref_low_bound (node
);
2477 op1
= array_ref_element_size (node
);
2479 if (!integer_zerop (op0
)
2480 || TREE_OPERAND (node
, 2)
2481 || TREE_OPERAND (node
, 3))
2483 pp_string (pp
, "{lb: ");
2484 dump_generic_node (pp
, op0
, spc
, flags
, false);
2485 pp_string (pp
, " sz: ");
2486 dump_generic_node (pp
, op1
, spc
, flags
, false);
2487 pp_right_brace (pp
);
2493 unsigned HOST_WIDE_INT ix
;
2495 bool is_struct_init
= false;
2496 bool is_array_init
= false;
2498 if (flags
& TDF_GIMPLE
)
2500 pp_string (pp
, "_Literal (");
2501 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2502 pp_string (pp
, ") ");
2505 if (TREE_CLOBBER_P (node
))
2507 pp_string (pp
, "CLOBBER");
2508 if (CLOBBER_KIND (node
) == CLOBBER_EOL
)
2509 pp_string (pp
, "(eol)");
2511 else if (TREE_CODE (TREE_TYPE (node
)) == RECORD_TYPE
2512 || TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
)
2513 is_struct_init
= true;
2514 else if (TREE_CODE (TREE_TYPE (node
)) == ARRAY_TYPE
2515 && TYPE_DOMAIN (TREE_TYPE (node
))
2516 && TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
)))
2517 && TREE_CODE (TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
))))
2520 tree minv
= TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
)));
2521 is_array_init
= true;
2522 curidx
= wi::to_widest (minv
);
2524 FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (node
), ix
, field
, val
)
2531 dump_generic_node (pp
, field
, spc
, flags
, false);
2534 else if (is_array_init
2535 && (TREE_CODE (field
) != INTEGER_CST
2536 || curidx
!= wi::to_widest (field
)))
2538 pp_left_bracket (pp
);
2539 if (TREE_CODE (field
) == RANGE_EXPR
)
2541 dump_generic_node (pp
, TREE_OPERAND (field
, 0), spc
,
2543 pp_string (pp
, " ... ");
2544 dump_generic_node (pp
, TREE_OPERAND (field
, 1), spc
,
2546 if (TREE_CODE (TREE_OPERAND (field
, 1)) == INTEGER_CST
)
2547 curidx
= wi::to_widest (TREE_OPERAND (field
, 1));
2550 dump_generic_node (pp
, field
, spc
, flags
, false);
2551 if (TREE_CODE (field
) == INTEGER_CST
)
2552 curidx
= wi::to_widest (field
);
2553 pp_string (pp
, "]=");
2558 if (val
&& TREE_CODE (val
) == ADDR_EXPR
)
2559 if (TREE_CODE (TREE_OPERAND (val
, 0)) == FUNCTION_DECL
)
2560 val
= TREE_OPERAND (val
, 0);
2561 if (val
&& TREE_CODE (val
) == FUNCTION_DECL
)
2562 dump_decl_name (pp
, val
, flags
);
2564 dump_generic_node (pp
, val
, spc
, flags
, false);
2565 if (ix
!= CONSTRUCTOR_NELTS (node
) - 1)
2571 pp_right_brace (pp
);
2578 if (flags
& TDF_SLIM
)
2580 pp_string (pp
, "<COMPOUND_EXPR>");
2584 dump_generic_node (pp
, TREE_OPERAND (node
, 0),
2585 spc
, flags
, !(flags
& TDF_SLIM
));
2586 if (flags
& TDF_SLIM
)
2587 newline_and_indent (pp
, spc
);
2594 for (tp
= &TREE_OPERAND (node
, 1);
2595 TREE_CODE (*tp
) == COMPOUND_EXPR
;
2596 tp
= &TREE_OPERAND (*tp
, 1))
2598 dump_generic_node (pp
, TREE_OPERAND (*tp
, 0),
2599 spc
, flags
, !(flags
& TDF_SLIM
));
2600 if (flags
& TDF_SLIM
)
2601 newline_and_indent (pp
, spc
);
2609 dump_generic_node (pp
, *tp
, spc
, flags
, !(flags
& TDF_SLIM
));
2613 case STATEMENT_LIST
:
2615 tree_stmt_iterator si
;
2618 if (flags
& TDF_SLIM
)
2620 pp_string (pp
, "<STATEMENT_LIST>");
2624 for (si
= tsi_start (node
); !tsi_end_p (si
); tsi_next (&si
))
2627 newline_and_indent (pp
, spc
);
2630 dump_generic_node (pp
, tsi_stmt (si
), spc
, flags
, true);
2637 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
,
2642 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
,
2647 pp_string (pp
, "TARGET_EXPR <");
2648 dump_generic_node (pp
, TARGET_EXPR_SLOT (node
), spc
, flags
, false);
2651 dump_generic_node (pp
, TARGET_EXPR_INITIAL (node
), spc
, flags
, false);
2656 print_declaration (pp
, DECL_EXPR_DECL (node
), spc
, flags
);
2661 if (TREE_TYPE (node
) == NULL
|| TREE_TYPE (node
) == void_type_node
)
2663 pp_string (pp
, "if (");
2664 dump_generic_node (pp
, COND_EXPR_COND (node
), spc
, flags
, false);
2665 pp_right_paren (pp
);
2666 /* The lowered cond_exprs should always be printed in full. */
2667 if (COND_EXPR_THEN (node
)
2668 && (IS_EMPTY_STMT (COND_EXPR_THEN (node
))
2669 || TREE_CODE (COND_EXPR_THEN (node
)) == GOTO_EXPR
)
2670 && COND_EXPR_ELSE (node
)
2671 && (IS_EMPTY_STMT (COND_EXPR_ELSE (node
))
2672 || TREE_CODE (COND_EXPR_ELSE (node
)) == GOTO_EXPR
))
2675 dump_generic_node (pp
, COND_EXPR_THEN (node
),
2677 if (!IS_EMPTY_STMT (COND_EXPR_ELSE (node
)))
2679 pp_string (pp
, " else ");
2680 dump_generic_node (pp
, COND_EXPR_ELSE (node
),
2684 else if (!(flags
& TDF_SLIM
))
2686 /* Output COND_EXPR_THEN. */
2687 if (COND_EXPR_THEN (node
))
2689 newline_and_indent (pp
, spc
+2);
2691 newline_and_indent (pp
, spc
+4);
2692 dump_generic_node (pp
, COND_EXPR_THEN (node
), spc
+4,
2694 newline_and_indent (pp
, spc
+2);
2695 pp_right_brace (pp
);
2698 /* Output COND_EXPR_ELSE. */
2699 if (COND_EXPR_ELSE (node
)
2700 && !IS_EMPTY_STMT (COND_EXPR_ELSE (node
)))
2702 newline_and_indent (pp
, spc
);
2703 pp_string (pp
, "else");
2704 newline_and_indent (pp
, spc
+2);
2706 newline_and_indent (pp
, spc
+4);
2707 dump_generic_node (pp
, COND_EXPR_ELSE (node
), spc
+4,
2709 newline_and_indent (pp
, spc
+2);
2710 pp_right_brace (pp
);
2717 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2721 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2725 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2731 if (!(flags
& TDF_SLIM
))
2733 if (BIND_EXPR_VARS (node
))
2737 for (op0
= BIND_EXPR_VARS (node
); op0
; op0
= DECL_CHAIN (op0
))
2739 print_declaration (pp
, op0
, spc
+2, flags
);
2744 newline_and_indent (pp
, spc
+2);
2745 dump_generic_node (pp
, BIND_EXPR_BODY (node
), spc
+2, flags
, true);
2746 newline_and_indent (pp
, spc
);
2747 pp_right_brace (pp
);
2753 if (CALL_EXPR_FN (node
) != NULL_TREE
)
2754 print_call_name (pp
, CALL_EXPR_FN (node
), flags
);
2758 pp_string (pp
, internal_fn_name (CALL_EXPR_IFN (node
)));
2761 /* Print parameters. */
2766 call_expr_arg_iterator iter
;
2767 FOR_EACH_CALL_EXPR_ARG (arg
, iter
, node
)
2769 dump_generic_node (pp
, arg
, spc
, flags
, false);
2770 if (more_call_expr_args_p (&iter
))
2777 if (CALL_EXPR_VA_ARG_PACK (node
))
2779 if (call_expr_nargs (node
) > 0)
2784 pp_string (pp
, "__builtin_va_arg_pack ()");
2786 pp_right_paren (pp
);
2788 op1
= CALL_EXPR_STATIC_CHAIN (node
);
2791 pp_string (pp
, " [static-chain: ");
2792 dump_generic_node (pp
, op1
, spc
, flags
, false);
2793 pp_right_bracket (pp
);
2796 if (CALL_EXPR_RETURN_SLOT_OPT (node
))
2797 pp_string (pp
, " [return slot optimization]");
2798 if (CALL_EXPR_TAILCALL (node
))
2799 pp_string (pp
, " [tail call]");
2802 case WITH_CLEANUP_EXPR
:
2806 case CLEANUP_POINT_EXPR
:
2807 pp_string (pp
, "<<cleanup_point ");
2808 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2809 pp_string (pp
, ">>");
2812 case PLACEHOLDER_EXPR
:
2813 pp_string (pp
, "<PLACEHOLDER_EXPR ");
2814 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2818 /* Binary arithmetic and logic expressions. */
2819 case WIDEN_PLUS_EXPR
:
2820 case WIDEN_MINUS_EXPR
:
2821 case WIDEN_SUM_EXPR
:
2822 case WIDEN_MULT_EXPR
:
2824 case MULT_HIGHPART_EXPR
:
2826 case POINTER_PLUS_EXPR
:
2827 case POINTER_DIFF_EXPR
:
2829 case TRUNC_DIV_EXPR
:
2831 case FLOOR_DIV_EXPR
:
2832 case ROUND_DIV_EXPR
:
2833 case TRUNC_MOD_EXPR
:
2835 case FLOOR_MOD_EXPR
:
2836 case ROUND_MOD_EXPR
:
2838 case EXACT_DIV_EXPR
:
2843 case WIDEN_LSHIFT_EXPR
:
2847 case TRUTH_ANDIF_EXPR
:
2848 case TRUTH_ORIF_EXPR
:
2849 case TRUTH_AND_EXPR
:
2851 case TRUTH_XOR_EXPR
:
2865 case UNORDERED_EXPR
:
2867 const char *op
= op_symbol (node
);
2868 op0
= TREE_OPERAND (node
, 0);
2869 op1
= TREE_OPERAND (node
, 1);
2871 /* When the operands are expressions with less priority,
2872 keep semantics of the tree representation. */
2873 if (op_prio (op0
) <= op_prio (node
))
2876 dump_generic_node (pp
, op0
, spc
, flags
, false);
2877 pp_right_paren (pp
);
2880 dump_generic_node (pp
, op0
, spc
, flags
, false);
2886 /* When the operands are expressions with less priority,
2887 keep semantics of the tree representation. */
2888 if (op_prio (op1
) <= op_prio (node
))
2891 dump_generic_node (pp
, op1
, spc
, flags
, false);
2892 pp_right_paren (pp
);
2895 dump_generic_node (pp
, op1
, spc
, flags
, false);
2899 /* Unary arithmetic and logic expressions. */
2901 if (flags
& TDF_GIMPLE_VAL
)
2903 pp_string (pp
, "_Literal (");
2904 dump_generic_node (pp
, TREE_TYPE (node
), spc
,
2905 flags
& ~TDF_GIMPLE_VAL
, false);
2906 pp_character (pp
, ')');
2911 case TRUTH_NOT_EXPR
:
2912 case PREDECREMENT_EXPR
:
2913 case PREINCREMENT_EXPR
:
2915 if (!(flags
& TDF_GIMPLE
)
2916 && TREE_CODE (node
) == ADDR_EXPR
2917 && (TREE_CODE (TREE_OPERAND (node
, 0)) == STRING_CST
2918 || TREE_CODE (TREE_OPERAND (node
, 0)) == FUNCTION_DECL
))
2919 /* Do not output '&' for strings and function pointers when not
2920 dumping GIMPLE FE syntax. */
2923 pp_string (pp
, op_symbol (node
));
2925 if (op_prio (TREE_OPERAND (node
, 0)) < op_prio (node
))
2928 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2929 pp_right_paren (pp
);
2932 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2935 case POSTDECREMENT_EXPR
:
2936 case POSTINCREMENT_EXPR
:
2937 if (op_prio (TREE_OPERAND (node
, 0)) < op_prio (node
))
2940 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2941 pp_right_paren (pp
);
2944 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2945 pp_string (pp
, op_symbol (node
));
2949 pp_string (pp
, "MIN_EXPR <");
2950 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2951 pp_string (pp
, ", ");
2952 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2957 pp_string (pp
, "MAX_EXPR <");
2958 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2959 pp_string (pp
, ", ");
2960 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2965 pp_string (pp
, "ABS_EXPR <");
2966 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2971 pp_string (pp
, "ABSU_EXPR <");
2972 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2980 case ADDR_SPACE_CONVERT_EXPR
:
2981 case FIXED_CONVERT_EXPR
:
2982 case FIX_TRUNC_EXPR
:
2985 type
= TREE_TYPE (node
);
2986 op0
= TREE_OPERAND (node
, 0);
2987 if (type
!= TREE_TYPE (op0
))
2990 dump_generic_node (pp
, type
, spc
, flags
, false);
2991 pp_string (pp
, ") ");
2993 if (op_prio (op0
) < op_prio (node
))
2995 dump_generic_node (pp
, op0
, spc
, flags
, false);
2996 if (op_prio (op0
) < op_prio (node
))
2997 pp_right_paren (pp
);
3000 case VIEW_CONVERT_EXPR
:
3001 if (flags
& TDF_GIMPLE
)
3002 pp_string (pp
, "__VIEW_CONVERT <");
3004 pp_string (pp
, "VIEW_CONVERT_EXPR<");
3005 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
3006 pp_string (pp
, ">(");
3007 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3008 pp_right_paren (pp
);
3012 pp_string (pp
, "((");
3013 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3014 pp_string (pp
, "))");
3017 case NON_LVALUE_EXPR
:
3018 pp_string (pp
, "NON_LVALUE_EXPR <");
3019 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3024 pp_string (pp
, "SAVE_EXPR <");
3025 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3030 pp_string (pp
, "COMPLEX_EXPR <");
3031 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3032 pp_string (pp
, ", ");
3033 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3038 pp_string (pp
, "CONJ_EXPR <");
3039 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3044 if (flags
& TDF_GIMPLE
)
3046 pp_string (pp
, "__real ");
3047 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3051 pp_string (pp
, "REALPART_EXPR <");
3052 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3058 if (flags
& TDF_GIMPLE
)
3060 pp_string (pp
, "__imag ");
3061 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3065 pp_string (pp
, "IMAGPART_EXPR <");
3066 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3072 pp_string (pp
, "VA_ARG_EXPR <");
3073 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3077 case TRY_FINALLY_EXPR
:
3078 case TRY_CATCH_EXPR
:
3079 pp_string (pp
, "try");
3080 newline_and_indent (pp
, spc
+2);
3082 newline_and_indent (pp
, spc
+4);
3083 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
+4, flags
, true);
3084 newline_and_indent (pp
, spc
+2);
3085 pp_right_brace (pp
);
3086 newline_and_indent (pp
, spc
);
3087 if (TREE_CODE (node
) == TRY_CATCH_EXPR
)
3089 node
= TREE_OPERAND (node
, 1);
3090 pp_string (pp
, "catch");
3094 gcc_assert (TREE_CODE (node
) == TRY_FINALLY_EXPR
);
3095 node
= TREE_OPERAND (node
, 1);
3096 pp_string (pp
, "finally");
3097 if (TREE_CODE (node
) == EH_ELSE_EXPR
)
3099 newline_and_indent (pp
, spc
+2);
3101 newline_and_indent (pp
, spc
+4);
3102 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
+4,
3104 newline_and_indent (pp
, spc
+2);
3105 pp_right_brace (pp
);
3106 newline_and_indent (pp
, spc
);
3107 node
= TREE_OPERAND (node
, 1);
3108 pp_string (pp
, "else");
3111 newline_and_indent (pp
, spc
+2);
3113 newline_and_indent (pp
, spc
+4);
3114 dump_generic_node (pp
, node
, spc
+4, flags
, true);
3115 newline_and_indent (pp
, spc
+2);
3116 pp_right_brace (pp
);
3121 pp_string (pp
, "catch (");
3122 dump_generic_node (pp
, CATCH_TYPES (node
), spc
+2, flags
, false);
3123 pp_right_paren (pp
);
3124 newline_and_indent (pp
, spc
+2);
3126 newline_and_indent (pp
, spc
+4);
3127 dump_generic_node (pp
, CATCH_BODY (node
), spc
+4, flags
, true);
3128 newline_and_indent (pp
, spc
+2);
3129 pp_right_brace (pp
);
3133 case EH_FILTER_EXPR
:
3134 pp_string (pp
, "<<<eh_filter (");
3135 dump_generic_node (pp
, EH_FILTER_TYPES (node
), spc
+2, flags
, false);
3136 pp_string (pp
, ")>>>");
3137 newline_and_indent (pp
, spc
+2);
3139 newline_and_indent (pp
, spc
+4);
3140 dump_generic_node (pp
, EH_FILTER_FAILURE (node
), spc
+4, flags
, true);
3141 newline_and_indent (pp
, spc
+2);
3142 pp_right_brace (pp
);
3147 op0
= TREE_OPERAND (node
, 0);
3148 /* If this is for break or continue, don't bother printing it. */
3149 if (DECL_NAME (op0
))
3151 const char *name
= IDENTIFIER_POINTER (DECL_NAME (op0
));
3152 if (strcmp (name
, "break") == 0
3153 || strcmp (name
, "continue") == 0)
3156 dump_generic_node (pp
, op0
, spc
, flags
, false);
3158 if (DECL_NONLOCAL (op0
))
3159 pp_string (pp
, " [non-local]");
3163 pp_string (pp
, "while (1)");
3164 if (!(flags
& TDF_SLIM
))
3166 newline_and_indent (pp
, spc
+2);
3168 newline_and_indent (pp
, spc
+4);
3169 dump_generic_node (pp
, LOOP_EXPR_BODY (node
), spc
+4, flags
, true);
3170 newline_and_indent (pp
, spc
+2);
3171 pp_right_brace (pp
);
3177 pp_string (pp
, "// predicted ");
3178 if (PREDICT_EXPR_OUTCOME (node
))
3179 pp_string (pp
, "likely by ");
3181 pp_string (pp
, "unlikely by ");
3182 pp_string (pp
, predictor_name (PREDICT_EXPR_PREDICTOR (node
)));
3183 pp_string (pp
, " predictor.");
3187 pp_string (pp
, "ANNOTATE_EXPR <");
3188 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3189 switch ((enum annot_expr_kind
) TREE_INT_CST_LOW (TREE_OPERAND (node
, 1)))
3191 case annot_expr_ivdep_kind
:
3192 pp_string (pp
, ", ivdep");
3194 case annot_expr_unroll_kind
:
3196 pp_string (pp
, ", unroll ");
3198 (int) TREE_INT_CST_LOW (TREE_OPERAND (node
, 2)));
3201 case annot_expr_no_vector_kind
:
3202 pp_string (pp
, ", no-vector");
3204 case annot_expr_vector_kind
:
3205 pp_string (pp
, ", vector");
3207 case annot_expr_parallel_kind
:
3208 pp_string (pp
, ", parallel");
3217 pp_string (pp
, "return");
3218 op0
= TREE_OPERAND (node
, 0);
3222 if (TREE_CODE (op0
) == MODIFY_EXPR
)
3223 dump_generic_node (pp
, TREE_OPERAND (op0
, 1),
3226 dump_generic_node (pp
, op0
, spc
, flags
, false);
3231 pp_string (pp
, "if (");
3232 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3233 pp_string (pp
, ") break");
3237 pp_string (pp
, "switch (");
3238 dump_generic_node (pp
, SWITCH_COND (node
), spc
, flags
, false);
3239 pp_right_paren (pp
);
3240 if (!(flags
& TDF_SLIM
))
3242 newline_and_indent (pp
, spc
+2);
3244 if (SWITCH_BODY (node
))
3246 newline_and_indent (pp
, spc
+4);
3247 dump_generic_node (pp
, SWITCH_BODY (node
), spc
+4, flags
,
3250 newline_and_indent (pp
, spc
+2);
3251 pp_right_brace (pp
);
3257 op0
= GOTO_DESTINATION (node
);
3258 if (TREE_CODE (op0
) != SSA_NAME
&& DECL_P (op0
) && DECL_NAME (op0
))
3260 const char *name
= IDENTIFIER_POINTER (DECL_NAME (op0
));
3261 if (strcmp (name
, "break") == 0
3262 || strcmp (name
, "continue") == 0)
3264 pp_string (pp
, name
);
3268 pp_string (pp
, "goto ");
3269 dump_generic_node (pp
, op0
, spc
, flags
, false);
3273 pp_string (pp
, "__asm__");
3274 if (ASM_VOLATILE_P (node
))
3275 pp_string (pp
, " __volatile__");
3277 dump_generic_node (pp
, ASM_STRING (node
), spc
, flags
, false);
3279 dump_generic_node (pp
, ASM_OUTPUTS (node
), spc
, flags
, false);
3281 dump_generic_node (pp
, ASM_INPUTS (node
), spc
, flags
, false);
3282 if (ASM_CLOBBERS (node
))
3285 dump_generic_node (pp
, ASM_CLOBBERS (node
), spc
, flags
, false);
3287 pp_right_paren (pp
);
3290 case CASE_LABEL_EXPR
:
3291 if (CASE_LOW (node
) && CASE_HIGH (node
))
3293 pp_string (pp
, "case ");
3294 dump_generic_node (pp
, CASE_LOW (node
), spc
, flags
, false);
3295 pp_string (pp
, " ... ");
3296 dump_generic_node (pp
, CASE_HIGH (node
), spc
, flags
, false);
3298 else if (CASE_LOW (node
))
3300 pp_string (pp
, "case ");
3301 dump_generic_node (pp
, CASE_LOW (node
), spc
, flags
, false);
3304 pp_string (pp
, "default");
3309 pp_string (pp
, "OBJ_TYPE_REF(");
3310 dump_generic_node (pp
, OBJ_TYPE_REF_EXPR (node
), spc
, flags
, false);
3312 /* We omit the class type for -fcompare-debug because we may
3313 drop TYPE_BINFO early depending on debug info, and then
3314 virtual_method_call_p would return false, whereas when
3315 TYPE_BINFO is preserved it may still return true and then
3316 we'd print the class type. Compare tree and rtl dumps for
3317 libstdc++-prettyprinters/shared_ptr.cc with and without -g,
3318 for example, at occurrences of OBJ_TYPE_REF. */
3319 if (!(flags
& (TDF_SLIM
| TDF_COMPARE_DEBUG
))
3320 && virtual_method_call_p (node
, true))
3322 pp_string (pp
, "(");
3323 dump_generic_node (pp
, obj_type_ref_class (node
, true),
3325 pp_string (pp
, ")");
3327 dump_generic_node (pp
, OBJ_TYPE_REF_OBJECT (node
), spc
, flags
, false);
3329 dump_generic_node (pp
, OBJ_TYPE_REF_TOKEN (node
), spc
, flags
, false);
3330 pp_right_paren (pp
);
3334 if (SSA_NAME_IDENTIFIER (node
))
3336 if ((flags
& TDF_NOUID
)
3337 && SSA_NAME_VAR (node
)
3338 && DECL_NAMELESS (SSA_NAME_VAR (node
)))
3339 dump_fancy_name (pp
, SSA_NAME_IDENTIFIER (node
));
3340 else if (! (flags
& TDF_GIMPLE
)
3341 || SSA_NAME_VAR (node
))
3342 dump_generic_node (pp
, SSA_NAME_IDENTIFIER (node
),
3346 pp_decimal_int (pp
, SSA_NAME_VERSION (node
));
3347 if (SSA_NAME_IS_DEFAULT_DEF (node
))
3348 pp_string (pp
, "(D)");
3349 if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (node
))
3350 pp_string (pp
, "(ab)");
3353 case WITH_SIZE_EXPR
:
3354 pp_string (pp
, "WITH_SIZE_EXPR <");
3355 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3356 pp_string (pp
, ", ");
3357 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3362 pp_string (pp
, "ASSERT_EXPR <");
3363 dump_generic_node (pp
, ASSERT_EXPR_VAR (node
), spc
, flags
, false);
3364 pp_string (pp
, ", ");
3365 dump_generic_node (pp
, ASSERT_EXPR_COND (node
), spc
, flags
, false);
3370 pp_string (pp
, "scev_known");
3373 case SCEV_NOT_KNOWN
:
3374 pp_string (pp
, "scev_not_known");
3377 case POLYNOMIAL_CHREC
:
3379 dump_generic_node (pp
, CHREC_LEFT (node
), spc
, flags
, false);
3380 pp_string (pp
, ", +, ");
3381 dump_generic_node (pp
, CHREC_RIGHT (node
), spc
, flags
, false);
3382 pp_string (pp
, "}_");
3383 pp_scalar (pp
, "%u", CHREC_VARIABLE (node
));
3387 case REALIGN_LOAD_EXPR
:
3388 pp_string (pp
, "REALIGN_LOAD <");
3389 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3390 pp_string (pp
, ", ");
3391 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3392 pp_string (pp
, ", ");
3393 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3398 pp_string (pp
, " VEC_COND_EXPR < ");
3399 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3400 pp_string (pp
, " , ");
3401 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3402 pp_string (pp
, " , ");
3403 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3404 pp_string (pp
, " > ");
3408 pp_string (pp
, " VEC_PERM_EXPR < ");
3409 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3410 pp_string (pp
, " , ");
3411 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3412 pp_string (pp
, " , ");
3413 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3414 pp_string (pp
, " > ");
3418 pp_string (pp
, " DOT_PROD_EXPR < ");
3419 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3420 pp_string (pp
, ", ");
3421 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3422 pp_string (pp
, ", ");
3423 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3424 pp_string (pp
, " > ");
3427 case WIDEN_MULT_PLUS_EXPR
:
3428 pp_string (pp
, " WIDEN_MULT_PLUS_EXPR < ");
3429 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3430 pp_string (pp
, ", ");
3431 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3432 pp_string (pp
, ", ");
3433 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3434 pp_string (pp
, " > ");
3437 case WIDEN_MULT_MINUS_EXPR
:
3438 pp_string (pp
, " WIDEN_MULT_MINUS_EXPR < ");
3439 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3440 pp_string (pp
, ", ");
3441 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3442 pp_string (pp
, ", ");
3443 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3444 pp_string (pp
, " > ");
3448 pp_string (pp
, "#pragma acc parallel");
3449 goto dump_omp_clauses_body
;
3452 pp_string (pp
, "#pragma acc kernels");
3453 goto dump_omp_clauses_body
;
3456 pp_string (pp
, "#pragma acc serial");
3457 goto dump_omp_clauses_body
;
3460 pp_string (pp
, "#pragma acc data");
3461 dump_omp_clauses (pp
, OACC_DATA_CLAUSES (node
), spc
, flags
);
3464 case OACC_HOST_DATA
:
3465 pp_string (pp
, "#pragma acc host_data");
3466 dump_omp_clauses (pp
, OACC_HOST_DATA_CLAUSES (node
), spc
, flags
);
3470 pp_string (pp
, "#pragma acc declare");
3471 dump_omp_clauses (pp
, OACC_DECLARE_CLAUSES (node
), spc
, flags
);
3475 pp_string (pp
, "#pragma acc update");
3476 dump_omp_clauses (pp
, OACC_UPDATE_CLAUSES (node
), spc
, flags
);
3479 case OACC_ENTER_DATA
:
3480 pp_string (pp
, "#pragma acc enter data");
3481 dump_omp_clauses (pp
, OACC_ENTER_DATA_CLAUSES (node
), spc
, flags
);
3484 case OACC_EXIT_DATA
:
3485 pp_string (pp
, "#pragma acc exit data");
3486 dump_omp_clauses (pp
, OACC_EXIT_DATA_CLAUSES (node
), spc
, flags
);
3490 pp_string (pp
, "#pragma acc cache");
3491 dump_omp_clauses (pp
, OACC_CACHE_CLAUSES (node
), spc
, flags
);
3495 pp_string (pp
, "#pragma omp parallel");
3496 dump_omp_clauses (pp
, OMP_PARALLEL_CLAUSES (node
), spc
, flags
);
3499 dump_omp_clauses_body
:
3500 dump_omp_clauses (pp
, OMP_CLAUSES (node
), spc
, flags
);
3504 if (!(flags
& TDF_SLIM
) && OMP_BODY (node
))
3506 newline_and_indent (pp
, spc
+ 2);
3508 newline_and_indent (pp
, spc
+ 4);
3509 dump_generic_node (pp
, OMP_BODY (node
), spc
+ 4, flags
, false);
3510 newline_and_indent (pp
, spc
+ 2);
3511 pp_right_brace (pp
);
3517 pp_string (pp
, OMP_TASK_BODY (node
) ? "#pragma omp task"
3518 : "#pragma omp taskwait");
3519 dump_omp_clauses (pp
, OMP_TASK_CLAUSES (node
), spc
, flags
);
3523 pp_string (pp
, "#pragma omp for");
3527 pp_string (pp
, "#pragma omp simd");
3530 case OMP_DISTRIBUTE
:
3531 pp_string (pp
, "#pragma omp distribute");
3535 pp_string (pp
, "#pragma omp taskloop");
3539 pp_string (pp
, "#pragma omp loop");
3543 pp_string (pp
, "#pragma acc loop");
3547 pp_string (pp
, "#pragma omp teams");
3548 dump_omp_clauses (pp
, OMP_TEAMS_CLAUSES (node
), spc
, flags
);
3551 case OMP_TARGET_DATA
:
3552 pp_string (pp
, "#pragma omp target data");
3553 dump_omp_clauses (pp
, OMP_TARGET_DATA_CLAUSES (node
), spc
, flags
);
3556 case OMP_TARGET_ENTER_DATA
:
3557 pp_string (pp
, "#pragma omp target enter data");
3558 dump_omp_clauses (pp
, OMP_TARGET_ENTER_DATA_CLAUSES (node
), spc
, flags
);
3562 case OMP_TARGET_EXIT_DATA
:
3563 pp_string (pp
, "#pragma omp target exit data");
3564 dump_omp_clauses (pp
, OMP_TARGET_EXIT_DATA_CLAUSES (node
), spc
, flags
);
3569 pp_string (pp
, "#pragma omp target");
3570 dump_omp_clauses (pp
, OMP_TARGET_CLAUSES (node
), spc
, flags
);
3573 case OMP_TARGET_UPDATE
:
3574 pp_string (pp
, "#pragma omp target update");
3575 dump_omp_clauses (pp
, OMP_TARGET_UPDATE_CLAUSES (node
), spc
, flags
);
3580 dump_omp_clauses (pp
, OMP_FOR_CLAUSES (node
), spc
, flags
);
3581 if (!(flags
& TDF_SLIM
))
3585 if (OMP_FOR_PRE_BODY (node
))
3587 newline_and_indent (pp
, spc
+ 2);
3590 newline_and_indent (pp
, spc
);
3591 dump_generic_node (pp
, OMP_FOR_PRE_BODY (node
),
3594 if (OMP_FOR_INIT (node
))
3597 for (i
= 0; i
< TREE_VEC_LENGTH (OMP_FOR_INIT (node
)); i
++)
3600 newline_and_indent (pp
, spc
);
3601 pp_string (pp
, "for (");
3602 tree init
= TREE_VEC_ELT (OMP_FOR_INIT (node
), i
);
3603 if (TREE_CODE (init
) != MODIFY_EXPR
3604 || TREE_CODE (TREE_OPERAND (init
, 1)) != TREE_VEC
)
3605 dump_generic_node (pp
, init
, spc
, flags
, false);
3608 dump_generic_node (pp
, TREE_OPERAND (init
, 0),
3610 pp_string (pp
, " = ");
3611 dump_omp_loop_non_rect_expr (pp
, TREE_OPERAND (init
, 1),
3614 pp_string (pp
, "; ");
3615 tree cond
= TREE_VEC_ELT (OMP_FOR_COND (node
), i
);
3616 if (!COMPARISON_CLASS_P (cond
)
3617 || TREE_CODE (TREE_OPERAND (cond
, 1)) != TREE_VEC
)
3618 dump_generic_node (pp
, cond
, spc
, flags
, false);
3621 dump_generic_node (pp
, TREE_OPERAND (cond
, 0),
3623 const char *op
= op_symbol (cond
);
3627 dump_omp_loop_non_rect_expr (pp
, TREE_OPERAND (cond
, 1),
3630 pp_string (pp
, "; ");
3631 dump_generic_node (pp
,
3632 TREE_VEC_ELT (OMP_FOR_INCR (node
), i
),
3634 pp_right_paren (pp
);
3637 if (OMP_FOR_BODY (node
))
3639 newline_and_indent (pp
, spc
+ 2);
3641 newline_and_indent (pp
, spc
+ 4);
3642 dump_generic_node (pp
, OMP_FOR_BODY (node
), spc
+ 4, flags
,
3644 newline_and_indent (pp
, spc
+ 2);
3645 pp_right_brace (pp
);
3647 if (OMP_FOR_INIT (node
))
3648 spc
-= 2 * TREE_VEC_LENGTH (OMP_FOR_INIT (node
)) - 2;
3649 if (OMP_FOR_PRE_BODY (node
))
3652 newline_and_indent (pp
, spc
+ 2);
3653 pp_right_brace (pp
);
3660 pp_string (pp
, "#pragma omp sections");
3661 dump_omp_clauses (pp
, OMP_SECTIONS_CLAUSES (node
), spc
, flags
);
3665 pp_string (pp
, "#pragma omp section");
3669 if (OMP_SCAN_CLAUSES (node
))
3671 pp_string (pp
, "#pragma omp scan");
3672 dump_omp_clauses (pp
, OMP_SCAN_CLAUSES (node
), spc
, flags
);
3677 pp_string (pp
, "#pragma omp master");
3681 pp_string (pp
, "#pragma omp masked");
3682 dump_omp_clauses (pp
, OMP_MASKED_CLAUSES (node
), spc
, flags
);
3686 pp_string (pp
, "#pragma omp taskgroup");
3687 dump_omp_clauses (pp
, OMP_TASKGROUP_CLAUSES (node
), spc
, flags
);
3691 pp_string (pp
, "#pragma omp ordered");
3692 dump_omp_clauses (pp
, OMP_ORDERED_CLAUSES (node
), spc
, flags
);
3696 pp_string (pp
, "#pragma omp critical");
3697 if (OMP_CRITICAL_NAME (node
))
3701 dump_generic_node (pp
, OMP_CRITICAL_NAME (node
), spc
,
3703 pp_right_paren (pp
);
3705 dump_omp_clauses (pp
, OMP_CRITICAL_CLAUSES (node
), spc
, flags
);
3709 pp_string (pp
, "#pragma omp atomic");
3710 if (OMP_ATOMIC_WEAK (node
))
3711 pp_string (pp
, " weak");
3712 dump_omp_atomic_memory_order (pp
, OMP_ATOMIC_MEMORY_ORDER (node
));
3713 newline_and_indent (pp
, spc
+ 2);
3714 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3718 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3721 case OMP_ATOMIC_READ
:
3722 pp_string (pp
, "#pragma omp atomic read");
3723 dump_omp_atomic_memory_order (pp
, OMP_ATOMIC_MEMORY_ORDER (node
));
3724 newline_and_indent (pp
, spc
+ 2);
3725 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3729 case OMP_ATOMIC_CAPTURE_OLD
:
3730 case OMP_ATOMIC_CAPTURE_NEW
:
3731 pp_string (pp
, "#pragma omp atomic capture");
3732 if (OMP_ATOMIC_WEAK (node
))
3733 pp_string (pp
, " weak");
3734 dump_omp_atomic_memory_order (pp
, OMP_ATOMIC_MEMORY_ORDER (node
));
3735 newline_and_indent (pp
, spc
+ 2);
3736 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3740 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3744 pp_string (pp
, "#pragma omp single");
3745 dump_omp_clauses (pp
, OMP_SINGLE_CLAUSES (node
), spc
, flags
);
3749 pp_string (pp
, "#pragma omp scope");
3750 dump_omp_clauses (pp
, OMP_SCOPE_CLAUSES (node
), spc
, flags
);
3754 /* If we come here, we're dumping something that's not an OMP construct,
3755 for example, OMP clauses attached to a function's '__attribute__'.
3756 Dump the whole OMP clause chain. */
3757 dump_omp_clauses (pp
, node
, spc
, flags
, false);
3761 case TRANSACTION_EXPR
:
3762 if (TRANSACTION_EXPR_OUTER (node
))
3763 pp_string (pp
, "__transaction_atomic [[outer]]");
3764 else if (TRANSACTION_EXPR_RELAXED (node
))
3765 pp_string (pp
, "__transaction_relaxed");
3767 pp_string (pp
, "__transaction_atomic");
3768 if (!(flags
& TDF_SLIM
) && TRANSACTION_EXPR_BODY (node
))
3770 newline_and_indent (pp
, spc
);
3772 newline_and_indent (pp
, spc
+ 2);
3773 dump_generic_node (pp
, TRANSACTION_EXPR_BODY (node
),
3774 spc
+ 2, flags
, false);
3775 newline_and_indent (pp
, spc
);
3776 pp_right_brace (pp
);
3781 case VEC_SERIES_EXPR
:
3782 case VEC_WIDEN_MULT_HI_EXPR
:
3783 case VEC_WIDEN_MULT_LO_EXPR
:
3784 case VEC_WIDEN_PLUS_HI_EXPR
:
3785 case VEC_WIDEN_PLUS_LO_EXPR
:
3786 case VEC_WIDEN_MINUS_HI_EXPR
:
3787 case VEC_WIDEN_MINUS_LO_EXPR
:
3788 case VEC_WIDEN_MULT_EVEN_EXPR
:
3789 case VEC_WIDEN_MULT_ODD_EXPR
:
3790 case VEC_WIDEN_LSHIFT_HI_EXPR
:
3791 case VEC_WIDEN_LSHIFT_LO_EXPR
:
3793 for (str
= get_tree_code_name (code
); *str
; str
++)
3794 pp_character (pp
, TOUPPER (*str
));
3795 pp_string (pp
, " < ");
3796 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3797 pp_string (pp
, ", ");
3798 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3799 pp_string (pp
, " > ");
3802 case VEC_DUPLICATE_EXPR
:
3804 for (str
= get_tree_code_name (code
); *str
; str
++)
3805 pp_character (pp
, TOUPPER (*str
));
3806 pp_string (pp
, " < ");
3807 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3808 pp_string (pp
, " > ");
3811 case VEC_UNPACK_HI_EXPR
:
3812 pp_string (pp
, " VEC_UNPACK_HI_EXPR < ");
3813 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3814 pp_string (pp
, " > ");
3817 case VEC_UNPACK_LO_EXPR
:
3818 pp_string (pp
, " VEC_UNPACK_LO_EXPR < ");
3819 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3820 pp_string (pp
, " > ");
3823 case VEC_UNPACK_FLOAT_HI_EXPR
:
3824 pp_string (pp
, " VEC_UNPACK_FLOAT_HI_EXPR < ");
3825 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3826 pp_string (pp
, " > ");
3829 case VEC_UNPACK_FLOAT_LO_EXPR
:
3830 pp_string (pp
, " VEC_UNPACK_FLOAT_LO_EXPR < ");
3831 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3832 pp_string (pp
, " > ");
3835 case VEC_UNPACK_FIX_TRUNC_HI_EXPR
:
3836 pp_string (pp
, " VEC_UNPACK_FIX_TRUNC_HI_EXPR < ");
3837 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3838 pp_string (pp
, " > ");
3841 case VEC_UNPACK_FIX_TRUNC_LO_EXPR
:
3842 pp_string (pp
, " VEC_UNPACK_FIX_TRUNC_LO_EXPR < ");
3843 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3844 pp_string (pp
, " > ");
3847 case VEC_PACK_TRUNC_EXPR
:
3848 pp_string (pp
, " VEC_PACK_TRUNC_EXPR < ");
3849 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3850 pp_string (pp
, ", ");
3851 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3852 pp_string (pp
, " > ");
3855 case VEC_PACK_SAT_EXPR
:
3856 pp_string (pp
, " VEC_PACK_SAT_EXPR < ");
3857 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3858 pp_string (pp
, ", ");
3859 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3860 pp_string (pp
, " > ");
3863 case VEC_PACK_FIX_TRUNC_EXPR
:
3864 pp_string (pp
, " VEC_PACK_FIX_TRUNC_EXPR < ");
3865 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3866 pp_string (pp
, ", ");
3867 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3868 pp_string (pp
, " > ");
3871 case VEC_PACK_FLOAT_EXPR
:
3872 pp_string (pp
, " VEC_PACK_FLOAT_EXPR < ");
3873 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3874 pp_string (pp
, ", ");
3875 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3876 pp_string (pp
, " > ");
3880 dump_block_node (pp
, node
, spc
, flags
);
3883 case DEBUG_BEGIN_STMT
:
3884 pp_string (pp
, "# DEBUG BEGIN STMT");
3891 if (is_stmt
&& is_expr
)
3897 /* Print the declaration of a variable. */
3900 print_declaration (pretty_printer
*pp
, tree t
, int spc
, dump_flags_t flags
)
3904 if (TREE_CODE(t
) == NAMELIST_DECL
)
3906 pp_string(pp
, "namelist ");
3907 dump_decl_name (pp
, t
, flags
);
3912 if (TREE_CODE (t
) == TYPE_DECL
)
3913 pp_string (pp
, "typedef ");
3915 if (CODE_CONTAINS_STRUCT (TREE_CODE (t
), TS_DECL_WRTL
) && DECL_REGISTER (t
))
3916 pp_string (pp
, "register ");
3918 if (TREE_PUBLIC (t
) && DECL_EXTERNAL (t
))
3919 pp_string (pp
, "extern ");
3920 else if (TREE_STATIC (t
))
3921 pp_string (pp
, "static ");
3923 /* Print the type and name. */
3924 if (TREE_TYPE (t
) && TREE_CODE (TREE_TYPE (t
)) == ARRAY_TYPE
)
3928 /* Print array's type. */
3929 tmp
= TREE_TYPE (t
);
3930 while (TREE_CODE (TREE_TYPE (tmp
)) == ARRAY_TYPE
)
3931 tmp
= TREE_TYPE (tmp
);
3932 dump_generic_node (pp
, TREE_TYPE (tmp
), spc
, flags
, false);
3934 /* Print variable's name. */
3936 dump_generic_node (pp
, t
, spc
, flags
, false);
3938 /* Print the dimensions. */
3939 tmp
= TREE_TYPE (t
);
3940 while (TREE_CODE (tmp
) == ARRAY_TYPE
)
3942 dump_array_domain (pp
, TYPE_DOMAIN (tmp
), spc
, flags
);
3943 tmp
= TREE_TYPE (tmp
);
3946 else if (TREE_CODE (t
) == FUNCTION_DECL
)
3948 dump_generic_node (pp
, TREE_TYPE (TREE_TYPE (t
)), spc
, flags
, false);
3950 dump_decl_name (pp
, t
, flags
);
3951 dump_function_declaration (pp
, TREE_TYPE (t
), spc
, flags
);
3955 /* Print type declaration. */
3956 dump_generic_node (pp
, TREE_TYPE (t
), spc
, flags
, false);
3958 /* Print variable's name. */
3960 dump_generic_node (pp
, t
, spc
, flags
, false);
3963 if (VAR_P (t
) && DECL_HARD_REGISTER (t
))
3965 pp_string (pp
, " __asm__ ");
3967 dump_generic_node (pp
, DECL_ASSEMBLER_NAME (t
), spc
, flags
, false);
3968 pp_right_paren (pp
);
3971 /* The initial value of a function serves to determine whether the function
3972 is declared or defined. So the following does not apply to function
3974 if (TREE_CODE (t
) != FUNCTION_DECL
)
3976 /* Print the initial value. */
3977 if (DECL_INITIAL (t
))
3982 if (!(flags
& TDF_SLIM
))
3983 dump_generic_node (pp
, DECL_INITIAL (t
), spc
, flags
, false);
3985 pp_string (pp
, "<<< omitted >>>");
3989 if (VAR_P (t
) && DECL_HAS_VALUE_EXPR_P (t
))
3991 pp_string (pp
, " [value-expr: ");
3992 dump_generic_node (pp
, DECL_VALUE_EXPR (t
), spc
, flags
, false);
3993 pp_right_bracket (pp
);
4000 /* Prints a structure: name, fields, and methods.
4001 FIXME: Still incomplete. */
4004 print_struct_decl (pretty_printer
*pp
, const_tree node
, int spc
,
4007 /* Print the name of the structure. */
4008 if (TYPE_NAME (node
))
4011 if (TREE_CODE (node
) == RECORD_TYPE
)
4012 pp_string (pp
, "struct ");
4013 else if ((TREE_CODE (node
) == UNION_TYPE
4014 || TREE_CODE (node
) == QUAL_UNION_TYPE
))
4015 pp_string (pp
, "union ");
4017 dump_generic_node (pp
, TYPE_NAME (node
), spc
, TDF_NONE
, false);
4020 /* Print the contents of the structure. */
4026 /* Print the fields of the structure. */
4029 tmp
= TYPE_FIELDS (node
);
4032 /* Avoid to print recursively the structure. */
4033 /* FIXME : Not implemented correctly...,
4034 what about the case when we have a cycle in the contain graph? ...
4035 Maybe this could be solved by looking at the scope in which the
4036 structure was declared. */
4037 if (TREE_TYPE (tmp
) != node
4038 && (TREE_CODE (TREE_TYPE (tmp
)) != POINTER_TYPE
4039 || TREE_TYPE (TREE_TYPE (tmp
)) != node
))
4041 print_declaration (pp
, tmp
, spc
+2, flags
);
4044 tmp
= DECL_CHAIN (tmp
);
4048 pp_right_brace (pp
);
4051 /* Return the priority of the operator CODE.
4053 From lowest to highest precedence with either left-to-right (L-R)
4054 or right-to-left (R-L) associativity]:
4057 2 [R-L] = += -= *= /= %= &= ^= |= <<= >>=
4069 14 [R-L] ! ~ ++ -- + - * & (type) sizeof
4070 15 [L-R] fn() [] -> .
4072 unary +, - and * have higher precedence than the corresponding binary
4076 op_code_prio (enum tree_code code
)
4093 case TRUTH_ORIF_EXPR
:
4096 case TRUTH_AND_EXPR
:
4097 case TRUTH_ANDIF_EXPR
:
4104 case TRUTH_XOR_EXPR
:
4121 case UNORDERED_EXPR
:
4132 case VEC_WIDEN_LSHIFT_HI_EXPR
:
4133 case VEC_WIDEN_LSHIFT_LO_EXPR
:
4134 case WIDEN_LSHIFT_EXPR
:
4137 case WIDEN_SUM_EXPR
:
4139 case POINTER_PLUS_EXPR
:
4140 case POINTER_DIFF_EXPR
:
4144 case VEC_WIDEN_MULT_HI_EXPR
:
4145 case VEC_WIDEN_MULT_LO_EXPR
:
4146 case WIDEN_MULT_EXPR
:
4148 case WIDEN_MULT_PLUS_EXPR
:
4149 case WIDEN_MULT_MINUS_EXPR
:
4151 case MULT_HIGHPART_EXPR
:
4152 case TRUNC_DIV_EXPR
:
4154 case FLOOR_DIV_EXPR
:
4155 case ROUND_DIV_EXPR
:
4157 case EXACT_DIV_EXPR
:
4158 case TRUNC_MOD_EXPR
:
4160 case FLOOR_MOD_EXPR
:
4161 case ROUND_MOD_EXPR
:
4164 case TRUTH_NOT_EXPR
:
4166 case POSTINCREMENT_EXPR
:
4167 case POSTDECREMENT_EXPR
:
4168 case PREINCREMENT_EXPR
:
4169 case PREDECREMENT_EXPR
:
4175 case FIX_TRUNC_EXPR
:
4181 case ARRAY_RANGE_REF
:
4185 /* Special expressions. */
4191 case VEC_UNPACK_HI_EXPR
:
4192 case VEC_UNPACK_LO_EXPR
:
4193 case VEC_UNPACK_FLOAT_HI_EXPR
:
4194 case VEC_UNPACK_FLOAT_LO_EXPR
:
4195 case VEC_UNPACK_FIX_TRUNC_HI_EXPR
:
4196 case VEC_UNPACK_FIX_TRUNC_LO_EXPR
:
4197 case VEC_PACK_TRUNC_EXPR
:
4198 case VEC_PACK_SAT_EXPR
:
4202 /* Return an arbitrarily high precedence to avoid surrounding single
4203 VAR_DECLs in ()s. */
4208 /* Return the priority of the operator OP. */
4211 op_prio (const_tree op
)
4213 enum tree_code code
;
4218 code
= TREE_CODE (op
);
4219 if (code
== SAVE_EXPR
|| code
== NON_LVALUE_EXPR
)
4220 return op_prio (TREE_OPERAND (op
, 0));
4222 return op_code_prio (code
);
4225 /* Return the symbol associated with operator CODE. */
4228 op_symbol_code (enum tree_code code
)
4236 case TRUTH_ORIF_EXPR
:
4239 case TRUTH_AND_EXPR
:
4240 case TRUTH_ANDIF_EXPR
:
4246 case TRUTH_XOR_EXPR
:
4256 case UNORDERED_EXPR
:
4302 case WIDEN_LSHIFT_EXPR
:
4305 case WIDEN_PLUS_EXPR
:
4308 case WIDEN_MINUS_EXPR
:
4311 case POINTER_PLUS_EXPR
:
4317 case WIDEN_SUM_EXPR
:
4320 case WIDEN_MULT_EXPR
:
4323 case MULT_HIGHPART_EXPR
:
4328 case POINTER_DIFF_EXPR
:
4334 case TRUTH_NOT_EXPR
:
4341 case TRUNC_DIV_EXPR
:
4348 case FLOOR_DIV_EXPR
:
4351 case ROUND_DIV_EXPR
:
4354 case EXACT_DIV_EXPR
:
4357 case TRUNC_MOD_EXPR
:
4363 case FLOOR_MOD_EXPR
:
4366 case ROUND_MOD_EXPR
:
4369 case PREDECREMENT_EXPR
:
4372 case PREINCREMENT_EXPR
:
4375 case POSTDECREMENT_EXPR
:
4378 case POSTINCREMENT_EXPR
:
4388 return "<<< ??? >>>";
4392 /* Return the symbol associated with operator OP. */
4395 op_symbol (const_tree op
)
4397 return op_symbol_code (TREE_CODE (op
));
4400 /* Prints the name of a call. NODE is the CALL_EXPR_FN of a CALL_EXPR or
4401 the gimple_call_fn of a GIMPLE_CALL. */
4404 print_call_name (pretty_printer
*pp
, tree node
, dump_flags_t flags
)
4409 if (TREE_CODE (op0
) == NON_LVALUE_EXPR
)
4410 op0
= TREE_OPERAND (op0
, 0);
4413 switch (TREE_CODE (op0
))
4418 dump_function_name (pp
, op0
, flags
);
4424 op0
= TREE_OPERAND (op0
, 0);
4429 dump_generic_node (pp
, TREE_OPERAND (op0
, 0), 0, flags
, false);
4430 pp_string (pp
, ") ? ");
4431 dump_generic_node (pp
, TREE_OPERAND (op0
, 1), 0, flags
, false);
4432 pp_string (pp
, " : ");
4433 dump_generic_node (pp
, TREE_OPERAND (op0
, 2), 0, flags
, false);
4437 if (TREE_CODE (TREE_OPERAND (op0
, 0)) == VAR_DECL
)
4438 dump_function_name (pp
, TREE_OPERAND (op0
, 0), flags
);
4440 dump_generic_node (pp
, op0
, 0, flags
, false);
4444 if (integer_zerop (TREE_OPERAND (op0
, 1)))
4446 op0
= TREE_OPERAND (op0
, 0);
4453 dump_generic_node (pp
, op0
, 0, flags
, false);
4461 /* Print the first N characters in the array STR, replacing non-printable
4462 characters (including embedded nuls) with unambiguous escape sequences. */
4465 pretty_print_string (pretty_printer
*pp
, const char *str
, size_t n
)
4470 for ( ; n
; --n
, ++str
)
4475 pp_string (pp
, "\\b");
4479 pp_string (pp
, "\\f");
4483 pp_string (pp
, "\\n");
4487 pp_string (pp
, "\\r");
4491 pp_string (pp
, "\\t");
4495 pp_string (pp
, "\\v");
4499 pp_string (pp
, "\\\\");
4503 pp_string (pp
, "\\\"");
4507 pp_string (pp
, "\\'");
4511 if (str
[0] || n
> 1)
4513 if (!ISPRINT (str
[0]))
4516 sprintf (buf
, "\\x%02x", (unsigned char)str
[0]);
4517 pp_string (pp
, buf
);
4520 pp_character (pp
, str
[0]);
4528 maybe_init_pretty_print (FILE *file
)
4532 tree_pp
= new pretty_printer ();
4533 pp_needs_newline (tree_pp
) = true;
4534 pp_translate_identifiers (tree_pp
) = false;
4537 tree_pp
->buffer
->stream
= file
;
4541 newline_and_indent (pretty_printer
*pp
, int spc
)
4547 /* Print the identifier ID to PRETTY-PRINTER. */
4550 pp_tree_identifier (pretty_printer
*pp
, tree id
)
4552 if (pp_translate_identifiers (pp
))
4554 const char *text
= identifier_to_locale (IDENTIFIER_POINTER (id
));
4555 pp_append_text (pp
, text
, text
+ strlen (text
));
4558 pp_append_text (pp
, IDENTIFIER_POINTER (id
),
4559 IDENTIFIER_POINTER (id
) + IDENTIFIER_LENGTH (id
));
4562 /* A helper function that is used to dump function information before the
4566 dump_function_header (FILE *dump_file
, tree fdecl
, dump_flags_t flags
)
4568 const char *dname
, *aname
;
4569 struct cgraph_node
*node
= cgraph_node::get (fdecl
);
4570 struct function
*fun
= DECL_STRUCT_FUNCTION (fdecl
);
4572 dname
= lang_hooks
.decl_printable_name (fdecl
, 1);
4574 if (DECL_ASSEMBLER_NAME_SET_P (fdecl
))
4575 aname
= (IDENTIFIER_POINTER
4576 (DECL_ASSEMBLER_NAME (fdecl
)));
4578 aname
= "<unset-asm-name>";
4580 fprintf (dump_file
, "\n;; Function %s (%s, funcdef_no=%d",
4581 dname
, aname
, fun
->funcdef_no
);
4582 if (!(flags
& TDF_NOUID
))
4583 fprintf (dump_file
, ", decl_uid=%d", DECL_UID (fdecl
));
4586 fprintf (dump_file
, ", cgraph_uid=%d", node
->get_uid ());
4587 fprintf (dump_file
, ", symbol_order=%d)%s\n\n", node
->order
,
4588 node
->frequency
== NODE_FREQUENCY_HOT
4590 : node
->frequency
== NODE_FREQUENCY_UNLIKELY_EXECUTED
4591 ? " (unlikely executed)"
4592 : node
->frequency
== NODE_FREQUENCY_EXECUTED_ONCE
4593 ? " (executed once)"
4597 fprintf (dump_file
, ")\n\n");
4600 /* Dump double_int D to pretty_printer PP. UNS is true
4601 if D is unsigned and false otherwise. */
4603 pp_double_int (pretty_printer
*pp
, double_int d
, bool uns
)
4606 pp_wide_integer (pp
, d
.low
);
4607 else if (d
.fits_uhwi ())
4608 pp_unsigned_wide_integer (pp
, d
.low
);
4611 unsigned HOST_WIDE_INT low
= d
.low
;
4612 HOST_WIDE_INT high
= d
.high
;
4613 if (!uns
&& d
.is_negative ())
4616 high
= ~high
+ !low
;
4619 /* Would "%x%0*x" or "%x%*0x" get zero-padding on all
4621 sprintf (pp_buffer (pp
)->digit_buffer
,
4622 HOST_WIDE_INT_PRINT_DOUBLE_HEX
,
4623 (unsigned HOST_WIDE_INT
) high
, low
);
4624 pp_string (pp
, pp_buffer (pp
)->digit_buffer
);
4629 # pragma GCC diagnostic pop