1 /* Pretty formatting of GENERIC trees in C syntax.
2 Copyright (C) 2001-2021 Free Software Foundation, Inc.
3 Adapted from c-pretty-print.c by Diego Novillo <dnovillo@redhat.com>
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 3, or (at your option) any later
12 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING3. If not see
19 <http://www.gnu.org/licenses/>. */
23 #include "coretypes.h"
29 #include "tree-pretty-print.h"
30 #include "stor-layout.h"
31 #include "langhooks.h"
32 #include "tree-iterator.h"
34 #include "internal-fn.h"
35 #include "gomp-constants.h"
37 #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
, 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, 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
, 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
, 2);
81 dump_generic_node (pp
, TREE_OPERAND (node
, i
), 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_IS_DEVICE_PTR
:
497 name
= "is_device_ptr";
499 case OMP_CLAUSE_INCLUSIVE
:
502 case OMP_CLAUSE_EXCLUSIVE
:
505 case OMP_CLAUSE__LOOPTEMP_
:
508 case OMP_CLAUSE__REDUCTEMP_
:
509 name
= "_reductemp_";
511 case OMP_CLAUSE__CONDTEMP_
:
514 case OMP_CLAUSE__SCANTEMP_
:
517 case OMP_CLAUSE_TO_DECLARE
:
520 case OMP_CLAUSE_LINK
:
523 case OMP_CLAUSE_NONTEMPORAL
:
524 name
= "nontemporal";
527 pp_string (pp
, name
);
530 pp_string (pp
, modifier
);
531 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
536 case OMP_CLAUSE_TASK_REDUCTION
:
537 case OMP_CLAUSE_IN_REDUCTION
:
538 pp_string (pp
, OMP_CLAUSE_CODE (clause
) == OMP_CLAUSE_IN_REDUCTION
541 case OMP_CLAUSE_REDUCTION
:
542 pp_string (pp
, "reduction(");
543 if (OMP_CLAUSE_CODE (clause
) == OMP_CLAUSE_REDUCTION
)
545 if (OMP_CLAUSE_REDUCTION_TASK (clause
))
546 pp_string (pp
, "task,");
547 else if (OMP_CLAUSE_REDUCTION_INSCAN (clause
))
548 pp_string (pp
, "inscan,");
550 if (OMP_CLAUSE_REDUCTION_CODE (clause
) != ERROR_MARK
)
553 op_symbol_code (OMP_CLAUSE_REDUCTION_CODE (clause
)));
556 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
562 pp_string (pp
, "if(");
563 switch (OMP_CLAUSE_IF_MODIFIER (clause
))
565 case ERROR_MARK
: break;
566 case VOID_CST
: pp_string (pp
, "cancel:"); break;
567 case OMP_PARALLEL
: pp_string (pp
, "parallel:"); break;
568 case OMP_SIMD
: pp_string (pp
, "simd:"); break;
569 case OMP_TASK
: pp_string (pp
, "task:"); break;
570 case OMP_TASKLOOP
: pp_string (pp
, "taskloop:"); break;
571 case OMP_TARGET_DATA
: pp_string (pp
, "target data:"); break;
572 case OMP_TARGET
: pp_string (pp
, "target:"); break;
573 case OMP_TARGET_UPDATE
: pp_string (pp
, "target update:"); break;
574 case OMP_TARGET_ENTER_DATA
:
575 pp_string (pp
, "target enter data:"); break;
576 case OMP_TARGET_EXIT_DATA
: pp_string (pp
, "target exit data:"); break;
577 default: gcc_unreachable ();
579 dump_generic_node (pp
, OMP_CLAUSE_IF_EXPR (clause
),
584 case OMP_CLAUSE_NUM_THREADS
:
585 pp_string (pp
, "num_threads(");
586 dump_generic_node (pp
, OMP_CLAUSE_NUM_THREADS_EXPR (clause
),
591 case OMP_CLAUSE_NOWAIT
:
592 pp_string (pp
, "nowait");
594 case OMP_CLAUSE_ORDERED
:
595 pp_string (pp
, "ordered");
596 if (OMP_CLAUSE_ORDERED_EXPR (clause
))
599 dump_generic_node (pp
, OMP_CLAUSE_ORDERED_EXPR (clause
),
605 case OMP_CLAUSE_DEFAULT
:
606 pp_string (pp
, "default(");
607 switch (OMP_CLAUSE_DEFAULT_KIND (clause
))
609 case OMP_CLAUSE_DEFAULT_UNSPECIFIED
:
611 case OMP_CLAUSE_DEFAULT_SHARED
:
612 pp_string (pp
, "shared");
614 case OMP_CLAUSE_DEFAULT_NONE
:
615 pp_string (pp
, "none");
617 case OMP_CLAUSE_DEFAULT_PRIVATE
:
618 pp_string (pp
, "private");
620 case OMP_CLAUSE_DEFAULT_FIRSTPRIVATE
:
621 pp_string (pp
, "firstprivate");
623 case OMP_CLAUSE_DEFAULT_PRESENT
:
624 pp_string (pp
, "present");
632 case OMP_CLAUSE_SCHEDULE
:
633 pp_string (pp
, "schedule(");
634 if (OMP_CLAUSE_SCHEDULE_KIND (clause
)
635 & (OMP_CLAUSE_SCHEDULE_MONOTONIC
636 | OMP_CLAUSE_SCHEDULE_NONMONOTONIC
))
638 if (OMP_CLAUSE_SCHEDULE_KIND (clause
)
639 & OMP_CLAUSE_SCHEDULE_MONOTONIC
)
640 pp_string (pp
, "monotonic");
642 pp_string (pp
, "nonmonotonic");
643 if (OMP_CLAUSE_SCHEDULE_SIMD (clause
))
648 if (OMP_CLAUSE_SCHEDULE_SIMD (clause
))
649 pp_string (pp
, "simd:");
651 switch (OMP_CLAUSE_SCHEDULE_KIND (clause
) & OMP_CLAUSE_SCHEDULE_MASK
)
653 case OMP_CLAUSE_SCHEDULE_STATIC
:
654 pp_string (pp
, "static");
656 case OMP_CLAUSE_SCHEDULE_DYNAMIC
:
657 pp_string (pp
, "dynamic");
659 case OMP_CLAUSE_SCHEDULE_GUIDED
:
660 pp_string (pp
, "guided");
662 case OMP_CLAUSE_SCHEDULE_RUNTIME
:
663 pp_string (pp
, "runtime");
665 case OMP_CLAUSE_SCHEDULE_AUTO
:
666 pp_string (pp
, "auto");
671 if (OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (clause
))
674 dump_generic_node (pp
, OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (clause
),
680 case OMP_CLAUSE_UNTIED
:
681 pp_string (pp
, "untied");
684 case OMP_CLAUSE_COLLAPSE
:
685 pp_string (pp
, "collapse(");
686 dump_generic_node (pp
, OMP_CLAUSE_COLLAPSE_EXPR (clause
),
691 case OMP_CLAUSE_FINAL
:
692 pp_string (pp
, "final(");
693 dump_generic_node (pp
, OMP_CLAUSE_FINAL_EXPR (clause
),
698 case OMP_CLAUSE_MERGEABLE
:
699 pp_string (pp
, "mergeable");
702 case OMP_CLAUSE_LINEAR
:
703 pp_string (pp
, "linear(");
704 switch (OMP_CLAUSE_LINEAR_KIND (clause
))
706 case OMP_CLAUSE_LINEAR_DEFAULT
:
708 case OMP_CLAUSE_LINEAR_REF
:
709 pp_string (pp
, "ref(");
711 case OMP_CLAUSE_LINEAR_VAL
:
712 pp_string (pp
, "val(");
714 case OMP_CLAUSE_LINEAR_UVAL
:
715 pp_string (pp
, "uval(");
720 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
722 if (OMP_CLAUSE_LINEAR_KIND (clause
) != OMP_CLAUSE_LINEAR_DEFAULT
)
725 dump_generic_node (pp
, OMP_CLAUSE_LINEAR_STEP (clause
),
730 case OMP_CLAUSE_ALIGNED
:
731 pp_string (pp
, "aligned(");
732 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
734 if (OMP_CLAUSE_ALIGNED_ALIGNMENT (clause
))
737 dump_generic_node (pp
, OMP_CLAUSE_ALIGNED_ALIGNMENT (clause
),
743 case OMP_CLAUSE_ALLOCATE
:
744 pp_string (pp
, "allocate(");
745 if (OMP_CLAUSE_ALLOCATE_ALLOCATOR (clause
))
747 pp_string (pp
, "allocator(");
748 dump_generic_node (pp
, OMP_CLAUSE_ALLOCATE_ALLOCATOR (clause
),
752 if (OMP_CLAUSE_ALLOCATE_ALIGN (clause
))
754 if (OMP_CLAUSE_ALLOCATE_ALLOCATOR (clause
))
756 pp_string (pp
, "align(");
757 dump_generic_node (pp
, OMP_CLAUSE_ALLOCATE_ALIGN (clause
),
761 if (OMP_CLAUSE_ALLOCATE_ALLOCATOR (clause
)
762 || OMP_CLAUSE_ALLOCATE_ALIGN (clause
))
764 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
769 case OMP_CLAUSE_AFFINITY
:
770 pp_string (pp
, "affinity(");
772 tree t
= OMP_CLAUSE_DECL (clause
);
773 if (TREE_CODE (t
) == TREE_LIST
775 && TREE_CODE (TREE_PURPOSE (t
)) == TREE_VEC
)
777 dump_omp_iterators (pp
, TREE_PURPOSE (t
), spc
, flags
);
781 dump_generic_node (pp
, t
, spc
, flags
, false);
785 case OMP_CLAUSE_DEPEND
:
786 pp_string (pp
, "depend(");
787 switch (OMP_CLAUSE_DEPEND_KIND (clause
))
789 case OMP_CLAUSE_DEPEND_DEPOBJ
:
792 case OMP_CLAUSE_DEPEND_IN
:
795 case OMP_CLAUSE_DEPEND_OUT
:
798 case OMP_CLAUSE_DEPEND_INOUT
:
801 case OMP_CLAUSE_DEPEND_MUTEXINOUTSET
:
802 name
= "mutexinoutset";
804 case OMP_CLAUSE_DEPEND_SOURCE
:
805 pp_string (pp
, "source)");
807 case OMP_CLAUSE_DEPEND_LAST
:
808 name
= "__internal__";
810 case OMP_CLAUSE_DEPEND_SINK
:
811 pp_string (pp
, "sink:");
812 for (tree t
= OMP_CLAUSE_DECL (clause
); t
; t
= TREE_CHAIN (t
))
813 if (TREE_CODE (t
) == TREE_LIST
)
815 dump_generic_node (pp
, TREE_VALUE (t
), spc
, flags
, false);
816 if (TREE_PURPOSE (t
) != integer_zero_node
)
818 if (OMP_CLAUSE_DEPEND_SINK_NEGATIVE (t
))
822 dump_generic_node (pp
, TREE_PURPOSE (t
), spc
, flags
,
836 tree t
= OMP_CLAUSE_DECL (clause
);
837 if (TREE_CODE (t
) == TREE_LIST
839 && TREE_CODE (TREE_PURPOSE (t
)) == TREE_VEC
)
841 dump_omp_iterators (pp
, TREE_PURPOSE (t
), spc
, flags
);
847 pp_string (pp
, name
);
850 dump_generic_node (pp
, t
, spc
, flags
, false);
856 pp_string (pp
, "map(");
857 switch (OMP_CLAUSE_MAP_KIND (clause
))
860 case GOMP_MAP_POINTER
:
861 case GOMP_MAP_POINTER_TO_ZERO_LENGTH_ARRAY_SECTION
:
862 pp_string (pp
, "alloc");
864 case GOMP_MAP_IF_PRESENT
:
865 pp_string (pp
, "no_alloc");
868 case GOMP_MAP_TO_PSET
:
869 pp_string (pp
, "to");
872 pp_string (pp
, "from");
874 case GOMP_MAP_TOFROM
:
875 pp_string (pp
, "tofrom");
877 case GOMP_MAP_FORCE_ALLOC
:
878 pp_string (pp
, "force_alloc");
880 case GOMP_MAP_FORCE_TO
:
881 pp_string (pp
, "force_to");
883 case GOMP_MAP_FORCE_FROM
:
884 pp_string (pp
, "force_from");
886 case GOMP_MAP_FORCE_TOFROM
:
887 pp_string (pp
, "force_tofrom");
889 case GOMP_MAP_FORCE_PRESENT
:
890 pp_string (pp
, "force_present");
892 case GOMP_MAP_DELETE
:
893 pp_string (pp
, "delete");
895 case GOMP_MAP_FORCE_DEVICEPTR
:
896 pp_string (pp
, "force_deviceptr");
898 case GOMP_MAP_ALWAYS_TO
:
899 pp_string (pp
, "always,to");
901 case GOMP_MAP_ALWAYS_FROM
:
902 pp_string (pp
, "always,from");
904 case GOMP_MAP_ALWAYS_TOFROM
:
905 pp_string (pp
, "always,tofrom");
907 case GOMP_MAP_RELEASE
:
908 pp_string (pp
, "release");
910 case GOMP_MAP_FIRSTPRIVATE_POINTER
:
911 pp_string (pp
, "firstprivate");
913 case GOMP_MAP_FIRSTPRIVATE_REFERENCE
:
914 pp_string (pp
, "firstprivate ref");
916 case GOMP_MAP_STRUCT
:
917 pp_string (pp
, "struct");
919 case GOMP_MAP_ALWAYS_POINTER
:
920 pp_string (pp
, "always_pointer");
922 case GOMP_MAP_DEVICE_RESIDENT
:
923 pp_string (pp
, "device_resident");
926 pp_string (pp
, "link");
928 case GOMP_MAP_ATTACH
:
929 pp_string (pp
, "attach");
931 case GOMP_MAP_DETACH
:
932 pp_string (pp
, "detach");
934 case GOMP_MAP_FORCE_DETACH
:
935 pp_string (pp
, "force_detach");
937 case GOMP_MAP_ATTACH_DETACH
:
938 pp_string (pp
, "attach_detach");
940 case GOMP_MAP_ATTACH_ZERO_LENGTH_ARRAY_SECTION
:
941 pp_string (pp
, "attach_zero_length_array_section");
947 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
950 if (OMP_CLAUSE_SIZE (clause
))
952 switch (OMP_CLAUSE_CODE (clause
) == OMP_CLAUSE_MAP
953 ? OMP_CLAUSE_MAP_KIND (clause
) : GOMP_MAP_TO
)
955 case GOMP_MAP_POINTER
:
956 case GOMP_MAP_FIRSTPRIVATE_POINTER
:
957 case GOMP_MAP_FIRSTPRIVATE_REFERENCE
:
958 case GOMP_MAP_ALWAYS_POINTER
:
959 pp_string (pp
, " [pointer assign, bias: ");
961 case GOMP_MAP_POINTER_TO_ZERO_LENGTH_ARRAY_SECTION
:
962 pp_string (pp
, " [pointer assign, zero-length array section, bias: ");
964 case GOMP_MAP_TO_PSET
:
965 pp_string (pp
, " [pointer set, len: ");
967 case GOMP_MAP_ATTACH
:
968 case GOMP_MAP_DETACH
:
969 case GOMP_MAP_FORCE_DETACH
:
970 case GOMP_MAP_ATTACH_DETACH
:
971 case GOMP_MAP_ATTACH_ZERO_LENGTH_ARRAY_SECTION
:
972 pp_string (pp
, " [bias: ");
975 pp_string (pp
, " [len: ");
978 dump_generic_node (pp
, OMP_CLAUSE_SIZE (clause
),
980 pp_right_bracket (pp
);
982 if (OMP_CLAUSE_CODE (clause
) == OMP_CLAUSE_MAP
983 && OMP_CLAUSE_MAP_RUNTIME_IMPLICIT_P (clause
))
984 pp_string (pp
, "[implicit]");
988 case OMP_CLAUSE_FROM
:
989 pp_string (pp
, "from(");
990 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
992 goto print_clause_size
;
995 pp_string (pp
, "to(");
996 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
998 goto print_clause_size
;
1000 case OMP_CLAUSE__CACHE_
:
1001 pp_string (pp
, "(");
1002 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
1004 goto print_clause_size
;
1006 case OMP_CLAUSE_NUM_TEAMS
:
1007 pp_string (pp
, "num_teams(");
1008 if (OMP_CLAUSE_NUM_TEAMS_LOWER_EXPR (clause
))
1010 dump_generic_node (pp
, OMP_CLAUSE_NUM_TEAMS_LOWER_EXPR (clause
),
1014 dump_generic_node (pp
, OMP_CLAUSE_NUM_TEAMS_UPPER_EXPR (clause
),
1016 pp_right_paren (pp
);
1019 case OMP_CLAUSE_THREAD_LIMIT
:
1020 pp_string (pp
, "thread_limit(");
1021 dump_generic_node (pp
, OMP_CLAUSE_THREAD_LIMIT_EXPR (clause
),
1023 pp_right_paren (pp
);
1026 case OMP_CLAUSE_DEVICE
:
1027 pp_string (pp
, "device(");
1028 if (OMP_CLAUSE_DEVICE_ANCESTOR (clause
))
1029 pp_string (pp
, "ancestor:");
1030 dump_generic_node (pp
, OMP_CLAUSE_DEVICE_ID (clause
),
1032 pp_right_paren (pp
);
1035 case OMP_CLAUSE_DIST_SCHEDULE
:
1036 pp_string (pp
, "dist_schedule(static");
1037 if (OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR (clause
))
1040 dump_generic_node (pp
,
1041 OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR (clause
),
1044 pp_right_paren (pp
);
1047 case OMP_CLAUSE_PROC_BIND
:
1048 pp_string (pp
, "proc_bind(");
1049 switch (OMP_CLAUSE_PROC_BIND_KIND (clause
))
1051 case OMP_CLAUSE_PROC_BIND_MASTER
:
1052 /* Same enum value: case OMP_CLAUSE_PROC_BIND_PRIMARY: */
1053 /* TODO: Change to 'primary' for OpenMP 5.1. */
1054 pp_string (pp
, "master");
1056 case OMP_CLAUSE_PROC_BIND_CLOSE
:
1057 pp_string (pp
, "close");
1059 case OMP_CLAUSE_PROC_BIND_SPREAD
:
1060 pp_string (pp
, "spread");
1065 pp_right_paren (pp
);
1068 case OMP_CLAUSE_DEVICE_TYPE
:
1069 pp_string (pp
, "device_type(");
1070 switch (OMP_CLAUSE_DEVICE_TYPE_KIND (clause
))
1072 case OMP_CLAUSE_DEVICE_TYPE_HOST
:
1073 pp_string (pp
, "host");
1075 case OMP_CLAUSE_DEVICE_TYPE_NOHOST
:
1076 pp_string (pp
, "nohost");
1078 case OMP_CLAUSE_DEVICE_TYPE_ANY
:
1079 pp_string (pp
, "any");
1084 pp_right_paren (pp
);
1087 case OMP_CLAUSE_SAFELEN
:
1088 pp_string (pp
, "safelen(");
1089 dump_generic_node (pp
, OMP_CLAUSE_SAFELEN_EXPR (clause
),
1091 pp_right_paren (pp
);
1094 case OMP_CLAUSE_SIMDLEN
:
1095 pp_string (pp
, "simdlen(");
1096 dump_generic_node (pp
, OMP_CLAUSE_SIMDLEN_EXPR (clause
),
1098 pp_right_paren (pp
);
1101 case OMP_CLAUSE_PRIORITY
:
1102 pp_string (pp
, "priority(");
1103 dump_generic_node (pp
, OMP_CLAUSE_PRIORITY_EXPR (clause
),
1105 pp_right_paren (pp
);
1108 case OMP_CLAUSE_GRAINSIZE
:
1109 pp_string (pp
, "grainsize(");
1110 if (OMP_CLAUSE_GRAINSIZE_STRICT (clause
))
1111 pp_string (pp
, "strict:");
1112 dump_generic_node (pp
, OMP_CLAUSE_GRAINSIZE_EXPR (clause
),
1114 pp_right_paren (pp
);
1117 case OMP_CLAUSE_NUM_TASKS
:
1118 pp_string (pp
, "num_tasks(");
1119 if (OMP_CLAUSE_NUM_TASKS_STRICT (clause
))
1120 pp_string (pp
, "strict:");
1121 dump_generic_node (pp
, OMP_CLAUSE_NUM_TASKS_EXPR (clause
),
1123 pp_right_paren (pp
);
1126 case OMP_CLAUSE_HINT
:
1127 pp_string (pp
, "hint(");
1128 dump_generic_node (pp
, OMP_CLAUSE_HINT_EXPR (clause
),
1130 pp_right_paren (pp
);
1133 case OMP_CLAUSE_FILTER
:
1134 pp_string (pp
, "filter(");
1135 dump_generic_node (pp
, OMP_CLAUSE_FILTER_EXPR (clause
),
1137 pp_right_paren (pp
);
1140 case OMP_CLAUSE_DEFAULTMAP
:
1141 pp_string (pp
, "defaultmap(");
1142 switch (OMP_CLAUSE_DEFAULTMAP_BEHAVIOR (clause
))
1144 case OMP_CLAUSE_DEFAULTMAP_ALLOC
:
1145 pp_string (pp
, "alloc");
1147 case OMP_CLAUSE_DEFAULTMAP_TO
:
1148 pp_string (pp
, "to");
1150 case OMP_CLAUSE_DEFAULTMAP_FROM
:
1151 pp_string (pp
, "from");
1153 case OMP_CLAUSE_DEFAULTMAP_TOFROM
:
1154 pp_string (pp
, "tofrom");
1156 case OMP_CLAUSE_DEFAULTMAP_FIRSTPRIVATE
:
1157 pp_string (pp
, "firstprivate");
1159 case OMP_CLAUSE_DEFAULTMAP_NONE
:
1160 pp_string (pp
, "none");
1162 case OMP_CLAUSE_DEFAULTMAP_DEFAULT
:
1163 pp_string (pp
, "default");
1168 switch (OMP_CLAUSE_DEFAULTMAP_CATEGORY (clause
))
1170 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_UNSPECIFIED
:
1172 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_SCALAR
:
1173 pp_string (pp
, ":scalar");
1175 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_AGGREGATE
:
1176 pp_string (pp
, ":aggregate");
1178 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_ALLOCATABLE
:
1179 pp_string (pp
, ":allocatable");
1181 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_POINTER
:
1182 pp_string (pp
, ":pointer");
1187 pp_right_paren (pp
);
1190 case OMP_CLAUSE_ORDER
:
1191 pp_string (pp
, "order(");
1192 if (OMP_CLAUSE_ORDER_UNCONSTRAINED (clause
))
1193 pp_string (pp
, "unconstrained:");
1194 else if (OMP_CLAUSE_ORDER_REPRODUCIBLE (clause
))
1195 pp_string (pp
, "reproducible:");
1196 pp_string (pp
, "concurrent)");
1199 case OMP_CLAUSE_BIND
:
1200 pp_string (pp
, "bind(");
1201 switch (OMP_CLAUSE_BIND_KIND (clause
))
1203 case OMP_CLAUSE_BIND_TEAMS
:
1204 pp_string (pp
, "teams");
1206 case OMP_CLAUSE_BIND_PARALLEL
:
1207 pp_string (pp
, "parallel");
1209 case OMP_CLAUSE_BIND_THREAD
:
1210 pp_string (pp
, "thread");
1215 pp_right_paren (pp
);
1218 case OMP_CLAUSE__SIMDUID_
:
1219 pp_string (pp
, "_simduid_(");
1220 dump_generic_node (pp
, OMP_CLAUSE__SIMDUID__DECL (clause
),
1222 pp_right_paren (pp
);
1225 case OMP_CLAUSE__SIMT_
:
1226 pp_string (pp
, "_simt_");
1229 case OMP_CLAUSE_GANG
:
1230 pp_string (pp
, "gang");
1231 if (OMP_CLAUSE_GANG_EXPR (clause
) != NULL_TREE
)
1233 pp_string (pp
, "(num: ");
1234 dump_generic_node (pp
, OMP_CLAUSE_GANG_EXPR (clause
),
1237 if (OMP_CLAUSE_GANG_STATIC_EXPR (clause
) != NULL_TREE
)
1239 if (OMP_CLAUSE_GANG_EXPR (clause
) == NULL_TREE
)
1243 pp_string (pp
, "static:");
1244 if (OMP_CLAUSE_GANG_STATIC_EXPR (clause
)
1245 == integer_minus_one_node
)
1246 pp_character (pp
, '*');
1248 dump_generic_node (pp
, OMP_CLAUSE_GANG_STATIC_EXPR (clause
),
1251 if (OMP_CLAUSE_GANG_EXPR (clause
) != NULL_TREE
1252 || OMP_CLAUSE_GANG_STATIC_EXPR (clause
) != NULL_TREE
)
1253 pp_right_paren (pp
);
1256 case OMP_CLAUSE_ASYNC
:
1257 pp_string (pp
, "async");
1258 if (OMP_CLAUSE_ASYNC_EXPR (clause
))
1260 pp_character(pp
, '(');
1261 dump_generic_node (pp
, OMP_CLAUSE_ASYNC_EXPR (clause
),
1263 pp_character(pp
, ')');
1267 case OMP_CLAUSE_AUTO
:
1268 case OMP_CLAUSE_SEQ
:
1269 pp_string (pp
, omp_clause_code_name
[OMP_CLAUSE_CODE (clause
)]);
1272 case OMP_CLAUSE_WAIT
:
1273 pp_string (pp
, "wait(");
1274 dump_generic_node (pp
, OMP_CLAUSE_WAIT_EXPR (clause
),
1276 pp_character(pp
, ')');
1279 case OMP_CLAUSE_WORKER
:
1280 pp_string (pp
, "worker");
1281 if (OMP_CLAUSE_WORKER_EXPR (clause
) != NULL_TREE
)
1284 dump_generic_node (pp
, OMP_CLAUSE_WORKER_EXPR (clause
),
1286 pp_right_paren (pp
);
1290 case OMP_CLAUSE_VECTOR
:
1291 pp_string (pp
, "vector");
1292 if (OMP_CLAUSE_VECTOR_EXPR (clause
) != NULL_TREE
)
1295 dump_generic_node (pp
, OMP_CLAUSE_VECTOR_EXPR (clause
),
1297 pp_right_paren (pp
);
1301 case OMP_CLAUSE_NUM_GANGS
:
1302 pp_string (pp
, "num_gangs(");
1303 dump_generic_node (pp
, OMP_CLAUSE_NUM_GANGS_EXPR (clause
),
1305 pp_character (pp
, ')');
1308 case OMP_CLAUSE_NUM_WORKERS
:
1309 pp_string (pp
, "num_workers(");
1310 dump_generic_node (pp
, OMP_CLAUSE_NUM_WORKERS_EXPR (clause
),
1312 pp_character (pp
, ')');
1315 case OMP_CLAUSE_VECTOR_LENGTH
:
1316 pp_string (pp
, "vector_length(");
1317 dump_generic_node (pp
, OMP_CLAUSE_VECTOR_LENGTH_EXPR (clause
),
1319 pp_character (pp
, ')');
1322 case OMP_CLAUSE_INBRANCH
:
1323 pp_string (pp
, "inbranch");
1325 case OMP_CLAUSE_NOTINBRANCH
:
1326 pp_string (pp
, "notinbranch");
1328 case OMP_CLAUSE_FOR
:
1329 pp_string (pp
, "for");
1331 case OMP_CLAUSE_PARALLEL
:
1332 pp_string (pp
, "parallel");
1334 case OMP_CLAUSE_SECTIONS
:
1335 pp_string (pp
, "sections");
1337 case OMP_CLAUSE_TASKGROUP
:
1338 pp_string (pp
, "taskgroup");
1340 case OMP_CLAUSE_NOGROUP
:
1341 pp_string (pp
, "nogroup");
1343 case OMP_CLAUSE_THREADS
:
1344 pp_string (pp
, "threads");
1346 case OMP_CLAUSE_SIMD
:
1347 pp_string (pp
, "simd");
1349 case OMP_CLAUSE_INDEPENDENT
:
1350 pp_string (pp
, "independent");
1352 case OMP_CLAUSE_TILE
:
1353 pp_string (pp
, "tile(");
1354 dump_generic_node (pp
, OMP_CLAUSE_TILE_LIST (clause
),
1356 pp_right_paren (pp
);
1359 case OMP_CLAUSE_IF_PRESENT
:
1360 pp_string (pp
, "if_present");
1362 case OMP_CLAUSE_FINALIZE
:
1363 pp_string (pp
, "finalize");
1365 case OMP_CLAUSE_NOHOST
:
1366 pp_string (pp
, "nohost");
1368 case OMP_CLAUSE_DETACH
:
1369 pp_string (pp
, "detach(");
1370 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
), spc
, flags
,
1372 pp_right_paren (pp
);
1381 /* Dump chain of OMP clauses.
1383 PP, SPC and FLAGS are as in dump_generic_node. */
1386 dump_omp_clauses (pretty_printer
*pp
, tree clause
, int spc
, dump_flags_t flags
,
1393 dump_omp_clause (pp
, clause
, spc
, flags
);
1394 leading_space
= true;
1396 clause
= OMP_CLAUSE_CHAIN (clause
);
1401 /* Dump location LOC to PP. */
1404 dump_location (pretty_printer
*pp
, location_t loc
)
1406 expanded_location xloc
= expand_location (loc
);
1408 pp_left_bracket (pp
);
1411 pp_string (pp
, xloc
.file
);
1412 pp_string (pp
, ":");
1414 pp_decimal_int (pp
, xloc
.line
);
1416 pp_decimal_int (pp
, xloc
.column
);
1417 pp_string (pp
, "] ");
1421 /* Dump lexical block BLOCK. PP, SPC and FLAGS are as in
1422 dump_generic_node. */
1425 dump_block_node (pretty_printer
*pp
, tree block
, int spc
, dump_flags_t flags
)
1429 pp_string (pp
, "BLOCK #");
1430 pp_decimal_int (pp
, BLOCK_NUMBER (block
));
1431 pp_character (pp
, ' ');
1433 if (flags
& TDF_ADDRESS
)
1435 pp_character (pp
, '[');
1436 pp_scalar (pp
, "%p", (void *) block
);
1437 pp_string (pp
, "] ");
1440 if (TREE_ASM_WRITTEN (block
))
1441 pp_string (pp
, "[written] ");
1443 if (flags
& TDF_SLIM
)
1446 if (BLOCK_SOURCE_LOCATION (block
))
1447 dump_location (pp
, BLOCK_SOURCE_LOCATION (block
));
1449 newline_and_indent (pp
, spc
+ 2);
1451 if (BLOCK_SUPERCONTEXT (block
))
1453 pp_string (pp
, "SUPERCONTEXT: ");
1454 dump_generic_node (pp
, BLOCK_SUPERCONTEXT (block
), 0,
1455 flags
| TDF_SLIM
, false);
1456 newline_and_indent (pp
, spc
+ 2);
1459 if (BLOCK_SUBBLOCKS (block
))
1461 pp_string (pp
, "SUBBLOCKS: ");
1462 for (t
= BLOCK_SUBBLOCKS (block
); t
; t
= BLOCK_CHAIN (t
))
1464 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
1467 newline_and_indent (pp
, spc
+ 2);
1470 if (BLOCK_CHAIN (block
))
1472 pp_string (pp
, "SIBLINGS: ");
1473 for (t
= BLOCK_CHAIN (block
); t
; t
= BLOCK_CHAIN (t
))
1475 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
1478 newline_and_indent (pp
, spc
+ 2);
1481 if (BLOCK_VARS (block
))
1483 pp_string (pp
, "VARS: ");
1484 for (t
= BLOCK_VARS (block
); t
; t
= TREE_CHAIN (t
))
1486 dump_generic_node (pp
, t
, 0, flags
, false);
1489 newline_and_indent (pp
, spc
+ 2);
1492 if (vec_safe_length (BLOCK_NONLOCALIZED_VARS (block
)) > 0)
1495 vec
<tree
, va_gc
> *nlv
= BLOCK_NONLOCALIZED_VARS (block
);
1497 pp_string (pp
, "NONLOCALIZED_VARS: ");
1498 FOR_EACH_VEC_ELT (*nlv
, i
, t
)
1500 dump_generic_node (pp
, t
, 0, flags
, false);
1503 newline_and_indent (pp
, spc
+ 2);
1506 if (BLOCK_ABSTRACT_ORIGIN (block
))
1508 pp_string (pp
, "ABSTRACT_ORIGIN: ");
1509 dump_generic_node (pp
, BLOCK_ABSTRACT_ORIGIN (block
), 0,
1510 flags
| TDF_SLIM
, false);
1511 newline_and_indent (pp
, spc
+ 2);
1514 if (BLOCK_FRAGMENT_ORIGIN (block
))
1516 pp_string (pp
, "FRAGMENT_ORIGIN: ");
1517 dump_generic_node (pp
, BLOCK_FRAGMENT_ORIGIN (block
), 0,
1518 flags
| TDF_SLIM
, false);
1519 newline_and_indent (pp
, spc
+ 2);
1522 if (BLOCK_FRAGMENT_CHAIN (block
))
1524 pp_string (pp
, "FRAGMENT_CHAIN: ");
1525 for (t
= BLOCK_FRAGMENT_CHAIN (block
); t
; t
= BLOCK_FRAGMENT_CHAIN (t
))
1527 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
1530 newline_and_indent (pp
, spc
+ 2);
1534 /* Dump #pragma omp atomic memory order clause. */
1537 dump_omp_atomic_memory_order (pretty_printer
*pp
, enum omp_memory_order mo
)
1539 switch (mo
& OMP_MEMORY_ORDER_MASK
)
1541 case OMP_MEMORY_ORDER_RELAXED
:
1542 pp_string (pp
, " relaxed");
1544 case OMP_MEMORY_ORDER_SEQ_CST
:
1545 pp_string (pp
, " seq_cst");
1547 case OMP_MEMORY_ORDER_ACQ_REL
:
1548 pp_string (pp
, " acq_rel");
1550 case OMP_MEMORY_ORDER_ACQUIRE
:
1551 pp_string (pp
, " acquire");
1553 case OMP_MEMORY_ORDER_RELEASE
:
1554 pp_string (pp
, " release");
1556 case OMP_MEMORY_ORDER_UNSPECIFIED
:
1561 switch (mo
& OMP_FAIL_MEMORY_ORDER_MASK
)
1563 case OMP_FAIL_MEMORY_ORDER_RELAXED
:
1564 pp_string (pp
, " fail(relaxed)");
1566 case OMP_FAIL_MEMORY_ORDER_SEQ_CST
:
1567 pp_string (pp
, " fail(seq_cst)");
1569 case OMP_FAIL_MEMORY_ORDER_ACQUIRE
:
1570 pp_string (pp
, " fail(acquire)");
1572 case OMP_FAIL_MEMORY_ORDER_UNSPECIFIED
:
1579 /* Helper to dump a MEM_REF node. */
1582 dump_mem_ref (pretty_printer
*pp
, tree node
, int spc
, dump_flags_t flags
)
1584 if (TREE_CODE (node
) == MEM_REF
&& (flags
& TDF_GIMPLE
))
1586 pp_string (pp
, "__MEM <");
1587 dump_generic_node (pp
, TREE_TYPE (node
),
1588 spc
, flags
| TDF_SLIM
, false);
1589 if (TYPE_ALIGN (TREE_TYPE (node
))
1590 != TYPE_ALIGN (TYPE_MAIN_VARIANT (TREE_TYPE (node
))))
1592 pp_string (pp
, ", ");
1593 pp_decimal_int (pp
, TYPE_ALIGN (TREE_TYPE (node
)));
1596 pp_string (pp
, " (");
1597 if (TREE_TYPE (TREE_OPERAND (node
, 0))
1598 != TREE_TYPE (TREE_OPERAND (node
, 1)))
1601 dump_generic_node (pp
, TREE_TYPE (TREE_OPERAND (node
, 1)),
1602 spc
, flags
| TDF_SLIM
, false);
1603 pp_right_paren (pp
);
1605 dump_generic_node (pp
, TREE_OPERAND (node
, 0),
1606 spc
, flags
| TDF_SLIM
, false);
1607 if (! integer_zerop (TREE_OPERAND (node
, 1)))
1609 pp_string (pp
, " + ");
1610 dump_generic_node (pp
, TREE_OPERAND (node
, 1),
1611 spc
, flags
| TDF_SLIM
, false);
1613 pp_right_paren (pp
);
1615 else if (TREE_CODE (node
) == MEM_REF
1616 && integer_zerop (TREE_OPERAND (node
, 1))
1617 /* Dump the types of INTEGER_CSTs explicitly, for we can't
1618 infer them and MEM_ATTR caching will share MEM_REFs
1619 with differently-typed op0s. */
1620 && TREE_CODE (TREE_OPERAND (node
, 0)) != INTEGER_CST
1621 /* Released SSA_NAMES have no TREE_TYPE. */
1622 && TREE_TYPE (TREE_OPERAND (node
, 0)) != NULL_TREE
1623 /* Same pointer types, but ignoring POINTER_TYPE vs.
1625 && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 0)))
1626 == TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 1))))
1627 && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (node
, 0)))
1628 == TYPE_MODE (TREE_TYPE (TREE_OPERAND (node
, 1))))
1629 && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node
, 0)))
1630 == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node
, 1))))
1631 /* Same value types ignoring qualifiers. */
1632 && (TYPE_MAIN_VARIANT (TREE_TYPE (node
))
1633 == TYPE_MAIN_VARIANT
1634 (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 1)))))
1635 && (!(flags
& TDF_ALIAS
)
1636 || MR_DEPENDENCE_CLIQUE (node
) == 0))
1638 if (TREE_CODE (TREE_OPERAND (node
, 0)) != ADDR_EXPR
)
1640 /* Enclose pointers to arrays in parentheses. */
1641 tree op0
= TREE_OPERAND (node
, 0);
1642 tree op0type
= TREE_TYPE (op0
);
1643 if (POINTER_TYPE_P (op0type
)
1644 && TREE_CODE (TREE_TYPE (op0type
)) == ARRAY_TYPE
)
1647 dump_generic_node (pp
, op0
, spc
, flags
, false);
1648 if (POINTER_TYPE_P (op0type
)
1649 && TREE_CODE (TREE_TYPE (op0type
)) == ARRAY_TYPE
)
1650 pp_right_paren (pp
);
1653 dump_generic_node (pp
,
1654 TREE_OPERAND (TREE_OPERAND (node
, 0), 0),
1659 pp_string (pp
, "MEM");
1661 tree nodetype
= TREE_TYPE (node
);
1662 tree op0
= TREE_OPERAND (node
, 0);
1663 tree op1
= TREE_OPERAND (node
, 1);
1664 tree op1type
= TYPE_MAIN_VARIANT (TREE_TYPE (op1
));
1666 tree op0size
= TYPE_SIZE (nodetype
);
1667 tree op1size
= TYPE_SIZE (TREE_TYPE (op1type
));
1669 if (!op0size
|| !op1size
1670 || !operand_equal_p (op0size
, op1size
, 0))
1672 pp_string (pp
, " <");
1673 /* If the size of the type of the operand is not the same
1674 as the size of the MEM_REF expression include the type
1675 of the latter similar to the TDF_GIMPLE output to make
1676 it clear how many bytes of memory are being accessed. */
1677 dump_generic_node (pp
, nodetype
, spc
, flags
| TDF_SLIM
, false);
1678 pp_string (pp
, "> ");
1681 pp_string (pp
, "[(");
1682 dump_generic_node (pp
, op1type
, spc
, flags
| TDF_SLIM
, false);
1683 pp_right_paren (pp
);
1684 dump_generic_node (pp
, op0
, spc
, flags
, false);
1685 if (!integer_zerop (op1
))
1687 pp_string (pp
, " + ");
1688 dump_generic_node (pp
, op1
, spc
, flags
, false);
1690 if (TREE_CODE (node
) == TARGET_MEM_REF
)
1692 tree tmp
= TMR_INDEX2 (node
);
1695 pp_string (pp
, " + ");
1696 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1698 tmp
= TMR_INDEX (node
);
1701 pp_string (pp
, " + ");
1702 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1703 tmp
= TMR_STEP (node
);
1704 pp_string (pp
, " * ");
1706 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1708 pp_string (pp
, "1");
1711 if ((flags
& TDF_ALIAS
)
1712 && MR_DEPENDENCE_CLIQUE (node
) != 0)
1714 pp_string (pp
, " clique ");
1715 pp_unsigned_wide_integer (pp
, MR_DEPENDENCE_CLIQUE (node
));
1716 pp_string (pp
, " base ");
1717 pp_unsigned_wide_integer (pp
, MR_DEPENDENCE_BASE (node
));
1719 pp_right_bracket (pp
);
1723 /* Helper function for dump_generic_node. Dump INIT or COND expression for
1724 OpenMP loop non-rectangular iterators. */
1727 dump_omp_loop_non_rect_expr (pretty_printer
*pp
, tree node
, int spc
,
1730 gcc_assert (TREE_CODE (node
) == TREE_VEC
);
1731 dump_generic_node (pp
, TREE_VEC_ELT (node
, 0), spc
, flags
, false);
1732 pp_string (pp
, " * ");
1733 if (op_prio (TREE_VEC_ELT (node
, 1)) <= op_code_prio (MULT_EXPR
))
1736 dump_generic_node (pp
, TREE_VEC_ELT (node
, 1), spc
, flags
, false);
1737 pp_right_paren (pp
);
1740 dump_generic_node (pp
, TREE_VEC_ELT (node
, 1), spc
, flags
, false);
1741 pp_string (pp
, " + ");
1742 if (op_prio (TREE_VEC_ELT (node
, 1)) <= op_code_prio (PLUS_EXPR
))
1745 dump_generic_node (pp
, TREE_VEC_ELT (node
, 2), spc
, flags
, false);
1746 pp_right_paren (pp
);
1749 dump_generic_node (pp
, TREE_VEC_ELT (node
, 2), spc
, flags
, false);
1752 /* Dump the node NODE on the pretty_printer PP, SPC spaces of
1753 indent. FLAGS specifies details to show in the dump (see TDF_* in
1754 dumpfile.h). If IS_STMT is true, the object printed is considered
1755 to be a statement and it is terminated by ';' if appropriate. */
1758 dump_generic_node (pretty_printer
*pp
, tree node
, int spc
, dump_flags_t flags
,
1765 enum tree_code code
;
1767 if (node
== NULL_TREE
)
1770 is_expr
= EXPR_P (node
);
1772 if (is_stmt
&& (flags
& TDF_STMTADDR
))
1774 pp_string (pp
, "<&");
1775 pp_scalar (pp
, "%p", (void *)node
);
1776 pp_string (pp
, "> ");
1779 if ((flags
& TDF_LINENO
) && EXPR_HAS_LOCATION (node
))
1780 dump_location (pp
, EXPR_LOCATION (node
));
1782 code
= TREE_CODE (node
);
1786 pp_string (pp
, "<<< error >>>");
1789 case IDENTIFIER_NODE
:
1790 pp_tree_identifier (pp
, node
);
1794 while (node
&& node
!= error_mark_node
)
1796 if (TREE_PURPOSE (node
))
1798 dump_generic_node (pp
, TREE_PURPOSE (node
), spc
, flags
, false);
1801 dump_generic_node (pp
, TREE_VALUE (node
), spc
, flags
, false);
1802 node
= TREE_CHAIN (node
);
1803 if (node
&& TREE_CODE (node
) == TREE_LIST
)
1812 dump_generic_node (pp
, BINFO_TYPE (node
), spc
, flags
, false);
1818 if (TREE_VEC_LENGTH (node
) > 0)
1820 size_t len
= TREE_VEC_LENGTH (node
);
1821 for (i
= 0; i
< len
- 1; i
++)
1823 dump_generic_node (pp
, TREE_VEC_ELT (node
, i
), spc
, flags
,
1828 dump_generic_node (pp
, TREE_VEC_ELT (node
, len
- 1), spc
,
1837 case FIXED_POINT_TYPE
:
1844 unsigned int quals
= TYPE_QUALS (node
);
1845 enum tree_code_class tclass
;
1847 if (quals
& TYPE_QUAL_ATOMIC
)
1848 pp_string (pp
, "atomic ");
1849 if (quals
& TYPE_QUAL_CONST
)
1850 pp_string (pp
, "const ");
1851 if (quals
& TYPE_QUAL_VOLATILE
)
1852 pp_string (pp
, "volatile ");
1853 if (quals
& TYPE_QUAL_RESTRICT
)
1854 pp_string (pp
, "restrict ");
1856 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
1858 pp_string (pp
, "<address-space-");
1859 pp_decimal_int (pp
, TYPE_ADDR_SPACE (node
));
1860 pp_string (pp
, "> ");
1863 tclass
= TREE_CODE_CLASS (TREE_CODE (node
));
1865 if (tclass
== tcc_declaration
)
1867 if (DECL_NAME (node
))
1868 dump_decl_name (pp
, node
, flags
);
1870 pp_string (pp
, "<unnamed type decl>");
1872 else if (tclass
== tcc_type
)
1874 if (TYPE_NAME (node
))
1876 if (TREE_CODE (TYPE_NAME (node
)) == IDENTIFIER_NODE
)
1877 pp_tree_identifier (pp
, TYPE_NAME (node
));
1878 else if (TREE_CODE (TYPE_NAME (node
)) == TYPE_DECL
1879 && DECL_NAME (TYPE_NAME (node
)))
1880 dump_decl_name (pp
, TYPE_NAME (node
), flags
);
1882 pp_string (pp
, "<unnamed type>");
1884 else if (TREE_CODE (node
) == VECTOR_TYPE
)
1886 pp_string (pp
, "vector");
1888 pp_wide_integer (pp
, TYPE_VECTOR_SUBPARTS (node
));
1889 pp_string (pp
, ") ");
1890 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1892 else if (TREE_CODE (node
) == INTEGER_TYPE
)
1894 if (TYPE_PRECISION (node
) == CHAR_TYPE_SIZE
)
1895 pp_string (pp
, (TYPE_UNSIGNED (node
)
1898 else if (TYPE_PRECISION (node
) == SHORT_TYPE_SIZE
)
1899 pp_string (pp
, (TYPE_UNSIGNED (node
)
1902 else if (TYPE_PRECISION (node
) == INT_TYPE_SIZE
)
1903 pp_string (pp
, (TYPE_UNSIGNED (node
)
1906 else if (TYPE_PRECISION (node
) == LONG_TYPE_SIZE
)
1907 pp_string (pp
, (TYPE_UNSIGNED (node
)
1910 else if (TYPE_PRECISION (node
) == LONG_LONG_TYPE_SIZE
)
1911 pp_string (pp
, (TYPE_UNSIGNED (node
)
1912 ? "unsigned long long"
1913 : "signed long long"));
1914 else if (TYPE_PRECISION (node
) >= CHAR_TYPE_SIZE
1915 && pow2p_hwi (TYPE_PRECISION (node
)))
1917 pp_string (pp
, (TYPE_UNSIGNED (node
) ? "uint" : "int"));
1918 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1919 pp_string (pp
, "_t");
1923 pp_string (pp
, (TYPE_UNSIGNED (node
)
1924 ? "<unnamed-unsigned:"
1925 : "<unnamed-signed:"));
1926 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1930 else if (TREE_CODE (node
) == COMPLEX_TYPE
)
1932 pp_string (pp
, "__complex__ ");
1933 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1935 else if (TREE_CODE (node
) == REAL_TYPE
)
1937 pp_string (pp
, "<float:");
1938 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1941 else if (TREE_CODE (node
) == FIXED_POINT_TYPE
)
1943 pp_string (pp
, "<fixed-point-");
1944 pp_string (pp
, TYPE_SATURATING (node
) ? "sat:" : "nonsat:");
1945 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1948 else if (TREE_CODE (node
) == BOOLEAN_TYPE
)
1950 pp_string (pp
, (TYPE_UNSIGNED (node
)
1951 ? "<unsigned-boolean:"
1952 : "<signed-boolean:"));
1953 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1956 else if (TREE_CODE (node
) == VOID_TYPE
)
1957 pp_string (pp
, "void");
1959 pp_string (pp
, "<unnamed type>");
1965 case REFERENCE_TYPE
:
1966 str
= (TREE_CODE (node
) == POINTER_TYPE
? "*" : "&");
1968 if (TREE_TYPE (node
) == NULL
)
1970 pp_string (pp
, str
);
1971 pp_string (pp
, "<null type>");
1973 else if (TREE_CODE (TREE_TYPE (node
)) == FUNCTION_TYPE
)
1975 tree fnode
= TREE_TYPE (node
);
1977 dump_generic_node (pp
, TREE_TYPE (fnode
), spc
, flags
, false);
1980 pp_string (pp
, str
);
1981 if (TYPE_IDENTIFIER (node
))
1982 dump_generic_node (pp
, TYPE_NAME (node
), spc
, flags
, false);
1983 else if (flags
& TDF_NOUID
)
1984 pp_string (pp
, "<Txxxx>");
1987 pp_string (pp
, "<T");
1988 pp_scalar (pp
, "%x", TYPE_UID (node
));
1989 pp_character (pp
, '>');
1992 pp_right_paren (pp
);
1993 dump_function_declaration (pp
, fnode
, spc
, flags
);
1997 unsigned int quals
= TYPE_QUALS (node
);
1999 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2001 pp_string (pp
, str
);
2003 if (quals
& TYPE_QUAL_CONST
)
2004 pp_string (pp
, " const");
2005 if (quals
& TYPE_QUAL_VOLATILE
)
2006 pp_string (pp
, " volatile");
2007 if (quals
& TYPE_QUAL_RESTRICT
)
2008 pp_string (pp
, " restrict");
2010 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
2012 pp_string (pp
, " <address-space-");
2013 pp_decimal_int (pp
, TYPE_ADDR_SPACE (node
));
2017 if (TYPE_REF_CAN_ALIAS_ALL (node
))
2018 pp_string (pp
, " {ref-all}");
2027 case TARGET_MEM_REF
:
2028 dump_mem_ref (pp
, node
, spc
, flags
);
2033 unsigned int quals
= TYPE_QUALS (node
);
2036 if (quals
& TYPE_QUAL_ATOMIC
)
2037 pp_string (pp
, "atomic ");
2038 if (quals
& TYPE_QUAL_CONST
)
2039 pp_string (pp
, "const ");
2040 if (quals
& TYPE_QUAL_VOLATILE
)
2041 pp_string (pp
, "volatile ");
2043 /* Print the innermost component type. */
2044 for (tmp
= TREE_TYPE (node
); TREE_CODE (tmp
) == ARRAY_TYPE
;
2045 tmp
= TREE_TYPE (tmp
))
2047 dump_generic_node (pp
, tmp
, spc
, flags
, false);
2049 /* Print the dimensions. */
2050 for (tmp
= node
; TREE_CODE (tmp
) == ARRAY_TYPE
; tmp
= TREE_TYPE (tmp
))
2051 dump_array_domain (pp
, TYPE_DOMAIN (tmp
), spc
, flags
);
2057 case QUAL_UNION_TYPE
:
2059 unsigned int quals
= TYPE_QUALS (node
);
2061 if (quals
& TYPE_QUAL_ATOMIC
)
2062 pp_string (pp
, "atomic ");
2063 if (quals
& TYPE_QUAL_CONST
)
2064 pp_string (pp
, "const ");
2065 if (quals
& TYPE_QUAL_VOLATILE
)
2066 pp_string (pp
, "volatile ");
2068 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
2070 pp_string (pp
, "<address-space-");
2071 pp_decimal_int (pp
, TYPE_ADDR_SPACE (node
));
2072 pp_string (pp
, "> ");
2075 /* Print the name of the structure. */
2076 if (TREE_CODE (node
) == RECORD_TYPE
)
2077 pp_string (pp
, "struct ");
2078 else if (TREE_CODE (node
) == UNION_TYPE
)
2079 pp_string (pp
, "union ");
2081 if (TYPE_NAME (node
))
2082 dump_generic_node (pp
, TYPE_NAME (node
), spc
, flags
, false);
2083 else if (!(flags
& TDF_SLIM
))
2084 /* FIXME: If we eliminate the 'else' above and attempt
2085 to show the fields for named types, we may get stuck
2086 following a cycle of pointers to structs. The alleged
2087 self-reference check in print_struct_decl will not detect
2088 cycles involving more than one pointer or struct type. */
2089 print_struct_decl (pp
, node
, spc
, flags
);
2098 if (flags
& TDF_GIMPLE
2099 && (POINTER_TYPE_P (TREE_TYPE (node
))
2100 || (TYPE_PRECISION (TREE_TYPE (node
))
2101 < TYPE_PRECISION (integer_type_node
))
2102 || exact_log2 (TYPE_PRECISION (TREE_TYPE (node
))) == -1
2103 || tree_int_cst_sgn (node
) < 0))
2105 pp_string (pp
, "_Literal (");
2106 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2107 pp_string (pp
, ") ");
2109 if (TREE_CODE (TREE_TYPE (node
)) == POINTER_TYPE
2110 && ! (flags
& TDF_GIMPLE
))
2112 /* In the case of a pointer, one may want to divide by the
2113 size of the pointed-to type. Unfortunately, this not
2114 straightforward. The C front-end maps expressions
2119 in such a way that the two INTEGER_CST nodes for "5" have
2120 different values but identical types. In the latter
2121 case, the 5 is multiplied by sizeof (int) in c-common.c
2122 (pointer_int_sum) to convert it to a byte address, and
2123 yet the type of the node is left unchanged. Argh. What
2124 is consistent though is that the number value corresponds
2125 to bytes (UNITS) offset.
2127 NB: Neither of the following divisors can be trivially
2128 used to recover the original literal:
2130 TREE_INT_CST_LOW (TYPE_SIZE_UNIT (TREE_TYPE (node)))
2131 TYPE_PRECISION (TREE_TYPE (TREE_TYPE (node))) */
2132 pp_wide_integer (pp
, TREE_INT_CST_LOW (node
));
2133 pp_string (pp
, "B"); /* pseudo-unit */
2135 else if (tree_fits_shwi_p (node
))
2136 pp_wide_integer (pp
, tree_to_shwi (node
));
2137 else if (tree_fits_uhwi_p (node
))
2138 pp_unsigned_wide_integer (pp
, tree_to_uhwi (node
));
2141 wide_int val
= wi::to_wide (node
);
2143 if (wi::neg_p (val
, TYPE_SIGN (TREE_TYPE (node
))))
2148 print_hex (val
, pp_buffer (pp
)->digit_buffer
);
2149 pp_string (pp
, pp_buffer (pp
)->digit_buffer
);
2151 if ((flags
& TDF_GIMPLE
)
2152 && ! (POINTER_TYPE_P (TREE_TYPE (node
))
2153 || (TYPE_PRECISION (TREE_TYPE (node
))
2154 < TYPE_PRECISION (integer_type_node
))
2155 || exact_log2 (TYPE_PRECISION (TREE_TYPE (node
))) == -1))
2157 if (TYPE_UNSIGNED (TREE_TYPE (node
)))
2158 pp_character (pp
, 'u');
2159 if (TYPE_PRECISION (TREE_TYPE (node
))
2160 == TYPE_PRECISION (unsigned_type_node
))
2162 else if (TYPE_PRECISION (TREE_TYPE (node
))
2163 == TYPE_PRECISION (long_unsigned_type_node
))
2164 pp_character (pp
, 'l');
2165 else if (TYPE_PRECISION (TREE_TYPE (node
))
2166 == TYPE_PRECISION (long_long_unsigned_type_node
))
2167 pp_string (pp
, "ll");
2169 if (TREE_OVERFLOW (node
))
2170 pp_string (pp
, "(OVF)");
2174 pp_string (pp
, "POLY_INT_CST [");
2175 dump_generic_node (pp
, POLY_INT_CST_COEFF (node
, 0), spc
, flags
, false);
2176 for (unsigned int i
= 1; i
< NUM_POLY_INT_COEFFS
; ++i
)
2178 pp_string (pp
, ", ");
2179 dump_generic_node (pp
, POLY_INT_CST_COEFF (node
, i
),
2182 pp_string (pp
, "]");
2186 /* Code copied from print_node. */
2189 if (TREE_OVERFLOW (node
))
2190 pp_string (pp
, " overflow");
2192 d
= TREE_REAL_CST (node
);
2193 if (REAL_VALUE_ISINF (d
))
2194 pp_string (pp
, REAL_VALUE_NEGATIVE (d
) ? " -Inf" : " Inf");
2195 else if (REAL_VALUE_ISNAN (d
))
2196 pp_string (pp
, " Nan");
2200 real_to_decimal (string
, &d
, sizeof (string
), 0, 1);
2201 pp_string (pp
, string
);
2209 fixed_to_decimal (string
, TREE_FIXED_CST_PTR (node
), sizeof (string
));
2210 pp_string (pp
, string
);
2215 pp_string (pp
, "__complex__ (");
2216 dump_generic_node (pp
, TREE_REALPART (node
), spc
, flags
, false);
2217 pp_string (pp
, ", ");
2218 dump_generic_node (pp
, TREE_IMAGPART (node
), spc
, flags
, false);
2219 pp_right_paren (pp
);
2224 pp_string (pp
, "\"");
2225 if (unsigned nbytes
= TREE_STRING_LENGTH (node
))
2226 pretty_print_string (pp
, TREE_STRING_POINTER (node
), nbytes
);
2227 pp_string (pp
, "\"");
2234 if (flags
& TDF_GIMPLE
)
2236 pp_string (pp
, "_Literal (");
2237 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2238 pp_string (pp
, ") ");
2240 pp_string (pp
, "{ ");
2241 unsigned HOST_WIDE_INT nunits
;
2242 if (!VECTOR_CST_NELTS (node
).is_constant (&nunits
))
2243 nunits
= vector_cst_encoded_nelts (node
);
2244 for (i
= 0; i
< nunits
; ++i
)
2247 pp_string (pp
, ", ");
2248 dump_generic_node (pp
, VECTOR_CST_ELT (node
, i
),
2251 if (!VECTOR_CST_NELTS (node
).is_constant ())
2252 pp_string (pp
, ", ...");
2253 pp_string (pp
, " }");
2259 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2261 if (TREE_CODE (node
) == METHOD_TYPE
)
2263 if (TYPE_METHOD_BASETYPE (node
))
2264 dump_generic_node (pp
, TYPE_NAME (TYPE_METHOD_BASETYPE (node
)),
2267 pp_string (pp
, "<null method basetype>");
2268 pp_colon_colon (pp
);
2270 if (TYPE_IDENTIFIER (node
))
2271 dump_generic_node (pp
, TYPE_NAME (node
), spc
, flags
, false);
2272 else if (TYPE_NAME (node
) && DECL_NAME (TYPE_NAME (node
)))
2273 dump_decl_name (pp
, TYPE_NAME (node
), flags
);
2274 else if (flags
& TDF_NOUID
)
2275 pp_string (pp
, "<Txxxx>");
2278 pp_string (pp
, "<T");
2279 pp_scalar (pp
, "%x", TYPE_UID (node
));
2280 pp_character (pp
, '>');
2282 dump_function_declaration (pp
, node
, spc
, flags
);
2287 dump_decl_name (pp
, node
, flags
);
2291 if (DECL_NAME (node
))
2292 dump_decl_name (pp
, node
, flags
);
2293 else if (LABEL_DECL_UID (node
) != -1)
2295 if (flags
& TDF_GIMPLE
)
2297 pp_character (pp
, 'L');
2298 pp_decimal_int (pp
, (int) LABEL_DECL_UID (node
));
2302 pp_string (pp
, "<L");
2303 pp_decimal_int (pp
, (int) LABEL_DECL_UID (node
));
2304 pp_character (pp
, '>');
2309 if (flags
& TDF_NOUID
)
2310 pp_string (pp
, "<D.xxxx>");
2313 if (flags
& TDF_GIMPLE
)
2315 pp_character (pp
, 'D');
2316 pp_scalar (pp
, "%u", DECL_UID (node
));
2320 pp_string (pp
, "<D.");
2321 pp_scalar (pp
, "%u", DECL_UID (node
));
2322 pp_character (pp
, '>');
2329 if (DECL_IS_UNDECLARED_BUILTIN (node
))
2331 /* Don't print the declaration of built-in types. */
2334 if (DECL_NAME (node
))
2335 dump_decl_name (pp
, node
, flags
);
2336 else if (TYPE_NAME (TREE_TYPE (node
)) != node
)
2338 pp_string (pp
, (TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
2339 ? "union" : "struct "));
2340 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2343 pp_string (pp
, "<anon>");
2349 case DEBUG_EXPR_DECL
:
2350 case NAMESPACE_DECL
:
2352 dump_decl_name (pp
, node
, flags
);
2356 pp_string (pp
, "<retval>");
2360 op0
= TREE_OPERAND (node
, 0);
2363 && (TREE_CODE (op0
) == INDIRECT_REF
2364 || (TREE_CODE (op0
) == MEM_REF
2365 && TREE_CODE (TREE_OPERAND (op0
, 0)) != ADDR_EXPR
2366 && integer_zerop (TREE_OPERAND (op0
, 1))
2367 /* Dump the types of INTEGER_CSTs explicitly, for we
2368 can't infer them and MEM_ATTR caching will share
2369 MEM_REFs with differently-typed op0s. */
2370 && TREE_CODE (TREE_OPERAND (op0
, 0)) != INTEGER_CST
2371 /* Released SSA_NAMES have no TREE_TYPE. */
2372 && TREE_TYPE (TREE_OPERAND (op0
, 0)) != NULL_TREE
2373 /* Same pointer types, but ignoring POINTER_TYPE vs.
2375 && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 0)))
2376 == TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 1))))
2377 && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0
, 0)))
2378 == TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0
, 1))))
2379 && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0
, 0)))
2380 == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0
, 1))))
2381 /* Same value types ignoring qualifiers. */
2382 && (TYPE_MAIN_VARIANT (TREE_TYPE (op0
))
2383 == TYPE_MAIN_VARIANT
2384 (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 1)))))
2385 && MR_DEPENDENCE_CLIQUE (op0
) == 0)))
2387 op0
= TREE_OPERAND (op0
, 0);
2390 if (op_prio (op0
) < op_prio (node
))
2392 dump_generic_node (pp
, op0
, spc
, flags
, false);
2393 if (op_prio (op0
) < op_prio (node
))
2394 pp_right_paren (pp
);
2395 pp_string (pp
, str
);
2396 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2397 op0
= component_ref_field_offset (node
);
2398 if (op0
&& TREE_CODE (op0
) != INTEGER_CST
)
2400 pp_string (pp
, "{off: ");
2401 dump_generic_node (pp
, op0
, spc
, flags
, false);
2402 pp_right_brace (pp
);
2407 if (flags
& TDF_GIMPLE
)
2409 pp_string (pp
, "__BIT_FIELD_REF <");
2410 dump_generic_node (pp
, TREE_TYPE (node
),
2411 spc
, flags
| TDF_SLIM
, false);
2412 if (TYPE_ALIGN (TREE_TYPE (node
))
2413 != TYPE_ALIGN (TYPE_MAIN_VARIANT (TREE_TYPE (node
))))
2415 pp_string (pp
, ", ");
2416 pp_decimal_int (pp
, TYPE_ALIGN (TREE_TYPE (node
)));
2419 pp_string (pp
, " (");
2420 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
,
2421 flags
| TDF_SLIM
, false);
2422 pp_string (pp
, ", ");
2423 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
,
2424 flags
| TDF_SLIM
, false);
2425 pp_string (pp
, ", ");
2426 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
,
2427 flags
| TDF_SLIM
, false);
2428 pp_right_paren (pp
);
2432 pp_string (pp
, "BIT_FIELD_REF <");
2433 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2434 pp_string (pp
, ", ");
2435 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2436 pp_string (pp
, ", ");
2437 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2442 case BIT_INSERT_EXPR
:
2443 pp_string (pp
, "BIT_INSERT_EXPR <");
2444 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2445 pp_string (pp
, ", ");
2446 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2447 pp_string (pp
, ", ");
2448 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2449 pp_string (pp
, " (");
2450 if (INTEGRAL_TYPE_P (TREE_TYPE (TREE_OPERAND (node
, 1))))
2452 TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (node
, 1))));
2454 dump_generic_node (pp
, TYPE_SIZE (TREE_TYPE (TREE_OPERAND (node
, 1))),
2456 pp_string (pp
, " bits)>");
2460 case ARRAY_RANGE_REF
:
2461 op0
= TREE_OPERAND (node
, 0);
2462 if (op_prio (op0
) < op_prio (node
))
2464 dump_generic_node (pp
, op0
, spc
, flags
, false);
2465 if (op_prio (op0
) < op_prio (node
))
2466 pp_right_paren (pp
);
2467 pp_left_bracket (pp
);
2468 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2469 if (TREE_CODE (node
) == ARRAY_RANGE_REF
)
2470 pp_string (pp
, " ...");
2471 pp_right_bracket (pp
);
2473 op0
= array_ref_low_bound (node
);
2474 op1
= array_ref_element_size (node
);
2476 if (!integer_zerop (op0
)
2477 || TREE_OPERAND (node
, 2)
2478 || TREE_OPERAND (node
, 3))
2480 pp_string (pp
, "{lb: ");
2481 dump_generic_node (pp
, op0
, spc
, flags
, false);
2482 pp_string (pp
, " sz: ");
2483 dump_generic_node (pp
, op1
, spc
, flags
, false);
2484 pp_right_brace (pp
);
2490 unsigned HOST_WIDE_INT ix
;
2492 bool is_struct_init
= false;
2493 bool is_array_init
= false;
2495 if (flags
& TDF_GIMPLE
)
2497 pp_string (pp
, "_Literal (");
2498 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2499 pp_string (pp
, ") ");
2502 if (TREE_CLOBBER_P (node
))
2503 pp_string (pp
, "CLOBBER");
2504 else if (TREE_CODE (TREE_TYPE (node
)) == RECORD_TYPE
2505 || TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
)
2506 is_struct_init
= true;
2507 else if (TREE_CODE (TREE_TYPE (node
)) == ARRAY_TYPE
2508 && TYPE_DOMAIN (TREE_TYPE (node
))
2509 && TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
)))
2510 && TREE_CODE (TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
))))
2513 tree minv
= TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
)));
2514 is_array_init
= true;
2515 curidx
= wi::to_widest (minv
);
2517 FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (node
), ix
, field
, val
)
2524 dump_generic_node (pp
, field
, spc
, flags
, false);
2527 else if (is_array_init
2528 && (TREE_CODE (field
) != INTEGER_CST
2529 || curidx
!= wi::to_widest (field
)))
2531 pp_left_bracket (pp
);
2532 if (TREE_CODE (field
) == RANGE_EXPR
)
2534 dump_generic_node (pp
, TREE_OPERAND (field
, 0), spc
,
2536 pp_string (pp
, " ... ");
2537 dump_generic_node (pp
, TREE_OPERAND (field
, 1), spc
,
2539 if (TREE_CODE (TREE_OPERAND (field
, 1)) == INTEGER_CST
)
2540 curidx
= wi::to_widest (TREE_OPERAND (field
, 1));
2543 dump_generic_node (pp
, field
, spc
, flags
, false);
2544 if (TREE_CODE (field
) == INTEGER_CST
)
2545 curidx
= wi::to_widest (field
);
2546 pp_string (pp
, "]=");
2551 if (val
&& TREE_CODE (val
) == ADDR_EXPR
)
2552 if (TREE_CODE (TREE_OPERAND (val
, 0)) == FUNCTION_DECL
)
2553 val
= TREE_OPERAND (val
, 0);
2554 if (val
&& TREE_CODE (val
) == FUNCTION_DECL
)
2555 dump_decl_name (pp
, val
, flags
);
2557 dump_generic_node (pp
, val
, spc
, flags
, false);
2558 if (ix
!= CONSTRUCTOR_NELTS (node
) - 1)
2564 pp_right_brace (pp
);
2571 if (flags
& TDF_SLIM
)
2573 pp_string (pp
, "<COMPOUND_EXPR>");
2577 dump_generic_node (pp
, TREE_OPERAND (node
, 0),
2578 spc
, flags
, !(flags
& TDF_SLIM
));
2579 if (flags
& TDF_SLIM
)
2580 newline_and_indent (pp
, spc
);
2587 for (tp
= &TREE_OPERAND (node
, 1);
2588 TREE_CODE (*tp
) == COMPOUND_EXPR
;
2589 tp
= &TREE_OPERAND (*tp
, 1))
2591 dump_generic_node (pp
, TREE_OPERAND (*tp
, 0),
2592 spc
, flags
, !(flags
& TDF_SLIM
));
2593 if (flags
& TDF_SLIM
)
2594 newline_and_indent (pp
, spc
);
2602 dump_generic_node (pp
, *tp
, spc
, flags
, !(flags
& TDF_SLIM
));
2606 case STATEMENT_LIST
:
2608 tree_stmt_iterator si
;
2611 if (flags
& TDF_SLIM
)
2613 pp_string (pp
, "<STATEMENT_LIST>");
2617 for (si
= tsi_start (node
); !tsi_end_p (si
); tsi_next (&si
))
2620 newline_and_indent (pp
, spc
);
2623 dump_generic_node (pp
, tsi_stmt (si
), spc
, flags
, true);
2630 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
,
2635 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
,
2640 pp_string (pp
, "TARGET_EXPR <");
2641 dump_generic_node (pp
, TARGET_EXPR_SLOT (node
), spc
, flags
, false);
2644 dump_generic_node (pp
, TARGET_EXPR_INITIAL (node
), spc
, flags
, false);
2649 print_declaration (pp
, DECL_EXPR_DECL (node
), spc
, flags
);
2654 if (TREE_TYPE (node
) == NULL
|| TREE_TYPE (node
) == void_type_node
)
2656 pp_string (pp
, "if (");
2657 dump_generic_node (pp
, COND_EXPR_COND (node
), spc
, flags
, false);
2658 pp_right_paren (pp
);
2659 /* The lowered cond_exprs should always be printed in full. */
2660 if (COND_EXPR_THEN (node
)
2661 && (IS_EMPTY_STMT (COND_EXPR_THEN (node
))
2662 || TREE_CODE (COND_EXPR_THEN (node
)) == GOTO_EXPR
)
2663 && COND_EXPR_ELSE (node
)
2664 && (IS_EMPTY_STMT (COND_EXPR_ELSE (node
))
2665 || TREE_CODE (COND_EXPR_ELSE (node
)) == GOTO_EXPR
))
2668 dump_generic_node (pp
, COND_EXPR_THEN (node
),
2670 if (!IS_EMPTY_STMT (COND_EXPR_ELSE (node
)))
2672 pp_string (pp
, " else ");
2673 dump_generic_node (pp
, COND_EXPR_ELSE (node
),
2677 else if (!(flags
& TDF_SLIM
))
2679 /* Output COND_EXPR_THEN. */
2680 if (COND_EXPR_THEN (node
))
2682 newline_and_indent (pp
, spc
+2);
2684 newline_and_indent (pp
, spc
+4);
2685 dump_generic_node (pp
, COND_EXPR_THEN (node
), spc
+4,
2687 newline_and_indent (pp
, spc
+2);
2688 pp_right_brace (pp
);
2691 /* Output COND_EXPR_ELSE. */
2692 if (COND_EXPR_ELSE (node
)
2693 && !IS_EMPTY_STMT (COND_EXPR_ELSE (node
)))
2695 newline_and_indent (pp
, spc
);
2696 pp_string (pp
, "else");
2697 newline_and_indent (pp
, spc
+2);
2699 newline_and_indent (pp
, spc
+4);
2700 dump_generic_node (pp
, COND_EXPR_ELSE (node
), spc
+4,
2702 newline_and_indent (pp
, spc
+2);
2703 pp_right_brace (pp
);
2710 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2714 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2718 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2724 if (!(flags
& TDF_SLIM
))
2726 if (BIND_EXPR_VARS (node
))
2730 for (op0
= BIND_EXPR_VARS (node
); op0
; op0
= DECL_CHAIN (op0
))
2732 print_declaration (pp
, op0
, spc
+2, flags
);
2737 newline_and_indent (pp
, spc
+2);
2738 dump_generic_node (pp
, BIND_EXPR_BODY (node
), spc
+2, flags
, true);
2739 newline_and_indent (pp
, spc
);
2740 pp_right_brace (pp
);
2746 if (CALL_EXPR_FN (node
) != NULL_TREE
)
2747 print_call_name (pp
, CALL_EXPR_FN (node
), flags
);
2751 pp_string (pp
, internal_fn_name (CALL_EXPR_IFN (node
)));
2754 /* Print parameters. */
2759 call_expr_arg_iterator iter
;
2760 FOR_EACH_CALL_EXPR_ARG (arg
, iter
, node
)
2762 dump_generic_node (pp
, arg
, spc
, flags
, false);
2763 if (more_call_expr_args_p (&iter
))
2770 if (CALL_EXPR_VA_ARG_PACK (node
))
2772 if (call_expr_nargs (node
) > 0)
2777 pp_string (pp
, "__builtin_va_arg_pack ()");
2779 pp_right_paren (pp
);
2781 op1
= CALL_EXPR_STATIC_CHAIN (node
);
2784 pp_string (pp
, " [static-chain: ");
2785 dump_generic_node (pp
, op1
, spc
, flags
, false);
2786 pp_right_bracket (pp
);
2789 if (CALL_EXPR_RETURN_SLOT_OPT (node
))
2790 pp_string (pp
, " [return slot optimization]");
2791 if (CALL_EXPR_TAILCALL (node
))
2792 pp_string (pp
, " [tail call]");
2795 case WITH_CLEANUP_EXPR
:
2799 case CLEANUP_POINT_EXPR
:
2800 pp_string (pp
, "<<cleanup_point ");
2801 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2802 pp_string (pp
, ">>");
2805 case PLACEHOLDER_EXPR
:
2806 pp_string (pp
, "<PLACEHOLDER_EXPR ");
2807 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2811 /* Binary arithmetic and logic expressions. */
2812 case WIDEN_PLUS_EXPR
:
2813 case WIDEN_MINUS_EXPR
:
2814 case WIDEN_SUM_EXPR
:
2815 case WIDEN_MULT_EXPR
:
2817 case MULT_HIGHPART_EXPR
:
2819 case POINTER_PLUS_EXPR
:
2820 case POINTER_DIFF_EXPR
:
2822 case TRUNC_DIV_EXPR
:
2824 case FLOOR_DIV_EXPR
:
2825 case ROUND_DIV_EXPR
:
2826 case TRUNC_MOD_EXPR
:
2828 case FLOOR_MOD_EXPR
:
2829 case ROUND_MOD_EXPR
:
2831 case EXACT_DIV_EXPR
:
2836 case WIDEN_LSHIFT_EXPR
:
2840 case TRUTH_ANDIF_EXPR
:
2841 case TRUTH_ORIF_EXPR
:
2842 case TRUTH_AND_EXPR
:
2844 case TRUTH_XOR_EXPR
:
2858 case UNORDERED_EXPR
:
2860 const char *op
= op_symbol (node
);
2861 op0
= TREE_OPERAND (node
, 0);
2862 op1
= TREE_OPERAND (node
, 1);
2864 /* When the operands are expressions with less priority,
2865 keep semantics of the tree representation. */
2866 if (op_prio (op0
) <= op_prio (node
))
2869 dump_generic_node (pp
, op0
, spc
, flags
, false);
2870 pp_right_paren (pp
);
2873 dump_generic_node (pp
, op0
, spc
, flags
, false);
2879 /* When the operands are expressions with less priority,
2880 keep semantics of the tree representation. */
2881 if (op_prio (op1
) <= op_prio (node
))
2884 dump_generic_node (pp
, op1
, spc
, flags
, false);
2885 pp_right_paren (pp
);
2888 dump_generic_node (pp
, op1
, spc
, flags
, false);
2892 /* Unary arithmetic and logic expressions. */
2894 if (flags
& TDF_GIMPLE_VAL
)
2896 pp_string (pp
, "_Literal (");
2897 dump_generic_node (pp
, TREE_TYPE (node
), spc
,
2898 flags
& ~TDF_GIMPLE_VAL
, false);
2899 pp_character (pp
, ')');
2904 case TRUTH_NOT_EXPR
:
2905 case PREDECREMENT_EXPR
:
2906 case PREINCREMENT_EXPR
:
2908 if (!(flags
& TDF_GIMPLE
)
2909 && TREE_CODE (node
) == ADDR_EXPR
2910 && (TREE_CODE (TREE_OPERAND (node
, 0)) == STRING_CST
2911 || TREE_CODE (TREE_OPERAND (node
, 0)) == FUNCTION_DECL
))
2912 /* Do not output '&' for strings and function pointers when not
2913 dumping GIMPLE FE syntax. */
2916 pp_string (pp
, op_symbol (node
));
2918 if (op_prio (TREE_OPERAND (node
, 0)) < op_prio (node
))
2921 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2922 pp_right_paren (pp
);
2925 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2928 case POSTDECREMENT_EXPR
:
2929 case POSTINCREMENT_EXPR
:
2930 if (op_prio (TREE_OPERAND (node
, 0)) < op_prio (node
))
2933 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2934 pp_right_paren (pp
);
2937 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2938 pp_string (pp
, op_symbol (node
));
2942 pp_string (pp
, "MIN_EXPR <");
2943 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2944 pp_string (pp
, ", ");
2945 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2950 pp_string (pp
, "MAX_EXPR <");
2951 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2952 pp_string (pp
, ", ");
2953 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2958 pp_string (pp
, "ABS_EXPR <");
2959 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2964 pp_string (pp
, "ABSU_EXPR <");
2965 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2973 case ADDR_SPACE_CONVERT_EXPR
:
2974 case FIXED_CONVERT_EXPR
:
2975 case FIX_TRUNC_EXPR
:
2978 type
= TREE_TYPE (node
);
2979 op0
= TREE_OPERAND (node
, 0);
2980 if (type
!= TREE_TYPE (op0
))
2983 dump_generic_node (pp
, type
, spc
, flags
, false);
2984 pp_string (pp
, ") ");
2986 if (op_prio (op0
) < op_prio (node
))
2988 dump_generic_node (pp
, op0
, spc
, flags
, false);
2989 if (op_prio (op0
) < op_prio (node
))
2990 pp_right_paren (pp
);
2993 case VIEW_CONVERT_EXPR
:
2994 if (flags
& TDF_GIMPLE
)
2995 pp_string (pp
, "__VIEW_CONVERT <");
2997 pp_string (pp
, "VIEW_CONVERT_EXPR<");
2998 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2999 pp_string (pp
, ">(");
3000 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3001 pp_right_paren (pp
);
3005 pp_string (pp
, "((");
3006 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3007 pp_string (pp
, "))");
3010 case NON_LVALUE_EXPR
:
3011 pp_string (pp
, "NON_LVALUE_EXPR <");
3012 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3017 pp_string (pp
, "SAVE_EXPR <");
3018 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3023 pp_string (pp
, "COMPLEX_EXPR <");
3024 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3025 pp_string (pp
, ", ");
3026 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3031 pp_string (pp
, "CONJ_EXPR <");
3032 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3037 if (flags
& TDF_GIMPLE
)
3039 pp_string (pp
, "__real ");
3040 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3044 pp_string (pp
, "REALPART_EXPR <");
3045 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3051 if (flags
& TDF_GIMPLE
)
3053 pp_string (pp
, "__imag ");
3054 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3058 pp_string (pp
, "IMAGPART_EXPR <");
3059 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3065 pp_string (pp
, "VA_ARG_EXPR <");
3066 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3070 case TRY_FINALLY_EXPR
:
3071 case TRY_CATCH_EXPR
:
3072 pp_string (pp
, "try");
3073 newline_and_indent (pp
, spc
+2);
3075 newline_and_indent (pp
, spc
+4);
3076 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
+4, flags
, true);
3077 newline_and_indent (pp
, spc
+2);
3078 pp_right_brace (pp
);
3079 newline_and_indent (pp
, spc
);
3080 if (TREE_CODE (node
) == TRY_CATCH_EXPR
)
3082 node
= TREE_OPERAND (node
, 1);
3083 pp_string (pp
, "catch");
3087 gcc_assert (TREE_CODE (node
) == TRY_FINALLY_EXPR
);
3088 node
= TREE_OPERAND (node
, 1);
3089 pp_string (pp
, "finally");
3090 if (TREE_CODE (node
) == EH_ELSE_EXPR
)
3092 newline_and_indent (pp
, spc
+2);
3094 newline_and_indent (pp
, spc
+4);
3095 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
+4,
3097 newline_and_indent (pp
, spc
+2);
3098 pp_right_brace (pp
);
3099 newline_and_indent (pp
, spc
);
3100 node
= TREE_OPERAND (node
, 1);
3101 pp_string (pp
, "else");
3104 newline_and_indent (pp
, spc
+2);
3106 newline_and_indent (pp
, spc
+4);
3107 dump_generic_node (pp
, node
, spc
+4, flags
, true);
3108 newline_and_indent (pp
, spc
+2);
3109 pp_right_brace (pp
);
3114 pp_string (pp
, "catch (");
3115 dump_generic_node (pp
, CATCH_TYPES (node
), spc
+2, flags
, false);
3116 pp_right_paren (pp
);
3117 newline_and_indent (pp
, spc
+2);
3119 newline_and_indent (pp
, spc
+4);
3120 dump_generic_node (pp
, CATCH_BODY (node
), spc
+4, flags
, true);
3121 newline_and_indent (pp
, spc
+2);
3122 pp_right_brace (pp
);
3126 case EH_FILTER_EXPR
:
3127 pp_string (pp
, "<<<eh_filter (");
3128 dump_generic_node (pp
, EH_FILTER_TYPES (node
), spc
+2, flags
, false);
3129 pp_string (pp
, ")>>>");
3130 newline_and_indent (pp
, spc
+2);
3132 newline_and_indent (pp
, spc
+4);
3133 dump_generic_node (pp
, EH_FILTER_FAILURE (node
), spc
+4, flags
, true);
3134 newline_and_indent (pp
, spc
+2);
3135 pp_right_brace (pp
);
3140 op0
= TREE_OPERAND (node
, 0);
3141 /* If this is for break or continue, don't bother printing it. */
3142 if (DECL_NAME (op0
))
3144 const char *name
= IDENTIFIER_POINTER (DECL_NAME (op0
));
3145 if (strcmp (name
, "break") == 0
3146 || strcmp (name
, "continue") == 0)
3149 dump_generic_node (pp
, op0
, spc
, flags
, false);
3151 if (DECL_NONLOCAL (op0
))
3152 pp_string (pp
, " [non-local]");
3156 pp_string (pp
, "while (1)");
3157 if (!(flags
& TDF_SLIM
))
3159 newline_and_indent (pp
, spc
+2);
3161 newline_and_indent (pp
, spc
+4);
3162 dump_generic_node (pp
, LOOP_EXPR_BODY (node
), spc
+4, flags
, true);
3163 newline_and_indent (pp
, spc
+2);
3164 pp_right_brace (pp
);
3170 pp_string (pp
, "// predicted ");
3171 if (PREDICT_EXPR_OUTCOME (node
))
3172 pp_string (pp
, "likely by ");
3174 pp_string (pp
, "unlikely by ");
3175 pp_string (pp
, predictor_name (PREDICT_EXPR_PREDICTOR (node
)));
3176 pp_string (pp
, " predictor.");
3180 pp_string (pp
, "ANNOTATE_EXPR <");
3181 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3182 switch ((enum annot_expr_kind
) TREE_INT_CST_LOW (TREE_OPERAND (node
, 1)))
3184 case annot_expr_ivdep_kind
:
3185 pp_string (pp
, ", ivdep");
3187 case annot_expr_unroll_kind
:
3189 pp_string (pp
, ", unroll ");
3191 (int) TREE_INT_CST_LOW (TREE_OPERAND (node
, 2)));
3194 case annot_expr_no_vector_kind
:
3195 pp_string (pp
, ", no-vector");
3197 case annot_expr_vector_kind
:
3198 pp_string (pp
, ", vector");
3200 case annot_expr_parallel_kind
:
3201 pp_string (pp
, ", parallel");
3210 pp_string (pp
, "return");
3211 op0
= TREE_OPERAND (node
, 0);
3215 if (TREE_CODE (op0
) == MODIFY_EXPR
)
3216 dump_generic_node (pp
, TREE_OPERAND (op0
, 1),
3219 dump_generic_node (pp
, op0
, spc
, flags
, false);
3224 pp_string (pp
, "if (");
3225 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3226 pp_string (pp
, ") break");
3230 pp_string (pp
, "switch (");
3231 dump_generic_node (pp
, SWITCH_COND (node
), spc
, flags
, false);
3232 pp_right_paren (pp
);
3233 if (!(flags
& TDF_SLIM
))
3235 newline_and_indent (pp
, spc
+2);
3237 if (SWITCH_BODY (node
))
3239 newline_and_indent (pp
, spc
+4);
3240 dump_generic_node (pp
, SWITCH_BODY (node
), spc
+4, flags
,
3243 newline_and_indent (pp
, spc
+2);
3244 pp_right_brace (pp
);
3250 op0
= GOTO_DESTINATION (node
);
3251 if (TREE_CODE (op0
) != SSA_NAME
&& DECL_P (op0
) && DECL_NAME (op0
))
3253 const char *name
= IDENTIFIER_POINTER (DECL_NAME (op0
));
3254 if (strcmp (name
, "break") == 0
3255 || strcmp (name
, "continue") == 0)
3257 pp_string (pp
, name
);
3261 pp_string (pp
, "goto ");
3262 dump_generic_node (pp
, op0
, spc
, flags
, false);
3266 pp_string (pp
, "__asm__");
3267 if (ASM_VOLATILE_P (node
))
3268 pp_string (pp
, " __volatile__");
3270 dump_generic_node (pp
, ASM_STRING (node
), spc
, flags
, false);
3272 dump_generic_node (pp
, ASM_OUTPUTS (node
), spc
, flags
, false);
3274 dump_generic_node (pp
, ASM_INPUTS (node
), spc
, flags
, false);
3275 if (ASM_CLOBBERS (node
))
3278 dump_generic_node (pp
, ASM_CLOBBERS (node
), spc
, flags
, false);
3280 pp_right_paren (pp
);
3283 case CASE_LABEL_EXPR
:
3284 if (CASE_LOW (node
) && CASE_HIGH (node
))
3286 pp_string (pp
, "case ");
3287 dump_generic_node (pp
, CASE_LOW (node
), spc
, flags
, false);
3288 pp_string (pp
, " ... ");
3289 dump_generic_node (pp
, CASE_HIGH (node
), spc
, flags
, false);
3291 else if (CASE_LOW (node
))
3293 pp_string (pp
, "case ");
3294 dump_generic_node (pp
, CASE_LOW (node
), spc
, flags
, false);
3297 pp_string (pp
, "default");
3302 pp_string (pp
, "OBJ_TYPE_REF(");
3303 dump_generic_node (pp
, OBJ_TYPE_REF_EXPR (node
), spc
, flags
, false);
3305 /* We omit the class type for -fcompare-debug because we may
3306 drop TYPE_BINFO early depending on debug info, and then
3307 virtual_method_call_p would return false, whereas when
3308 TYPE_BINFO is preserved it may still return true and then
3309 we'd print the class type. Compare tree and rtl dumps for
3310 libstdc++-prettyprinters/shared_ptr.cc with and without -g,
3311 for example, at occurrences of OBJ_TYPE_REF. */
3312 if (!(flags
& (TDF_SLIM
| TDF_COMPARE_DEBUG
))
3313 && virtual_method_call_p (node
, true))
3315 pp_string (pp
, "(");
3316 dump_generic_node (pp
, obj_type_ref_class (node
, true),
3318 pp_string (pp
, ")");
3320 dump_generic_node (pp
, OBJ_TYPE_REF_OBJECT (node
), spc
, flags
, false);
3322 dump_generic_node (pp
, OBJ_TYPE_REF_TOKEN (node
), spc
, flags
, false);
3323 pp_right_paren (pp
);
3327 if (SSA_NAME_IDENTIFIER (node
))
3329 if ((flags
& TDF_NOUID
)
3330 && SSA_NAME_VAR (node
)
3331 && DECL_NAMELESS (SSA_NAME_VAR (node
)))
3332 dump_fancy_name (pp
, SSA_NAME_IDENTIFIER (node
));
3333 else if (! (flags
& TDF_GIMPLE
)
3334 || SSA_NAME_VAR (node
))
3335 dump_generic_node (pp
, SSA_NAME_IDENTIFIER (node
),
3339 pp_decimal_int (pp
, SSA_NAME_VERSION (node
));
3340 if (SSA_NAME_IS_DEFAULT_DEF (node
))
3341 pp_string (pp
, "(D)");
3342 if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (node
))
3343 pp_string (pp
, "(ab)");
3346 case WITH_SIZE_EXPR
:
3347 pp_string (pp
, "WITH_SIZE_EXPR <");
3348 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3349 pp_string (pp
, ", ");
3350 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3355 pp_string (pp
, "ASSERT_EXPR <");
3356 dump_generic_node (pp
, ASSERT_EXPR_VAR (node
), spc
, flags
, false);
3357 pp_string (pp
, ", ");
3358 dump_generic_node (pp
, ASSERT_EXPR_COND (node
), spc
, flags
, false);
3363 pp_string (pp
, "scev_known");
3366 case SCEV_NOT_KNOWN
:
3367 pp_string (pp
, "scev_not_known");
3370 case POLYNOMIAL_CHREC
:
3372 dump_generic_node (pp
, CHREC_LEFT (node
), spc
, flags
, false);
3373 pp_string (pp
, ", +, ");
3374 dump_generic_node (pp
, CHREC_RIGHT (node
), spc
, flags
, false);
3375 pp_string (pp
, "}_");
3376 pp_scalar (pp
, "%u", CHREC_VARIABLE (node
));
3380 case REALIGN_LOAD_EXPR
:
3381 pp_string (pp
, "REALIGN_LOAD <");
3382 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3383 pp_string (pp
, ", ");
3384 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3385 pp_string (pp
, ", ");
3386 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3391 pp_string (pp
, " VEC_COND_EXPR < ");
3392 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3393 pp_string (pp
, " , ");
3394 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3395 pp_string (pp
, " , ");
3396 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3397 pp_string (pp
, " > ");
3401 pp_string (pp
, " VEC_PERM_EXPR < ");
3402 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3403 pp_string (pp
, " , ");
3404 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3405 pp_string (pp
, " , ");
3406 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3407 pp_string (pp
, " > ");
3411 pp_string (pp
, " DOT_PROD_EXPR < ");
3412 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3413 pp_string (pp
, ", ");
3414 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3415 pp_string (pp
, ", ");
3416 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3417 pp_string (pp
, " > ");
3420 case WIDEN_MULT_PLUS_EXPR
:
3421 pp_string (pp
, " WIDEN_MULT_PLUS_EXPR < ");
3422 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3423 pp_string (pp
, ", ");
3424 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3425 pp_string (pp
, ", ");
3426 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3427 pp_string (pp
, " > ");
3430 case WIDEN_MULT_MINUS_EXPR
:
3431 pp_string (pp
, " WIDEN_MULT_MINUS_EXPR < ");
3432 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3433 pp_string (pp
, ", ");
3434 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3435 pp_string (pp
, ", ");
3436 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3437 pp_string (pp
, " > ");
3441 pp_string (pp
, "#pragma acc parallel");
3442 goto dump_omp_clauses_body
;
3445 pp_string (pp
, "#pragma acc kernels");
3446 goto dump_omp_clauses_body
;
3449 pp_string (pp
, "#pragma acc serial");
3450 goto dump_omp_clauses_body
;
3453 pp_string (pp
, "#pragma acc data");
3454 dump_omp_clauses (pp
, OACC_DATA_CLAUSES (node
), spc
, flags
);
3457 case OACC_HOST_DATA
:
3458 pp_string (pp
, "#pragma acc host_data");
3459 dump_omp_clauses (pp
, OACC_HOST_DATA_CLAUSES (node
), spc
, flags
);
3463 pp_string (pp
, "#pragma acc declare");
3464 dump_omp_clauses (pp
, OACC_DECLARE_CLAUSES (node
), spc
, flags
);
3468 pp_string (pp
, "#pragma acc update");
3469 dump_omp_clauses (pp
, OACC_UPDATE_CLAUSES (node
), spc
, flags
);
3472 case OACC_ENTER_DATA
:
3473 pp_string (pp
, "#pragma acc enter data");
3474 dump_omp_clauses (pp
, OACC_ENTER_DATA_CLAUSES (node
), spc
, flags
);
3477 case OACC_EXIT_DATA
:
3478 pp_string (pp
, "#pragma acc exit data");
3479 dump_omp_clauses (pp
, OACC_EXIT_DATA_CLAUSES (node
), spc
, flags
);
3483 pp_string (pp
, "#pragma acc cache");
3484 dump_omp_clauses (pp
, OACC_CACHE_CLAUSES (node
), spc
, flags
);
3488 pp_string (pp
, "#pragma omp parallel");
3489 dump_omp_clauses (pp
, OMP_PARALLEL_CLAUSES (node
), spc
, flags
);
3492 dump_omp_clauses_body
:
3493 dump_omp_clauses (pp
, OMP_CLAUSES (node
), spc
, flags
);
3497 if (!(flags
& TDF_SLIM
) && OMP_BODY (node
))
3499 newline_and_indent (pp
, spc
+ 2);
3501 newline_and_indent (pp
, spc
+ 4);
3502 dump_generic_node (pp
, OMP_BODY (node
), spc
+ 4, flags
, false);
3503 newline_and_indent (pp
, spc
+ 2);
3504 pp_right_brace (pp
);
3510 pp_string (pp
, OMP_TASK_BODY (node
) ? "#pragma omp task"
3511 : "#pragma omp taskwait");
3512 dump_omp_clauses (pp
, OMP_TASK_CLAUSES (node
), spc
, flags
);
3516 pp_string (pp
, "#pragma omp for");
3520 pp_string (pp
, "#pragma omp simd");
3523 case OMP_DISTRIBUTE
:
3524 pp_string (pp
, "#pragma omp distribute");
3528 pp_string (pp
, "#pragma omp taskloop");
3532 pp_string (pp
, "#pragma omp loop");
3536 pp_string (pp
, "#pragma acc loop");
3540 pp_string (pp
, "#pragma omp teams");
3541 dump_omp_clauses (pp
, OMP_TEAMS_CLAUSES (node
), spc
, flags
);
3544 case OMP_TARGET_DATA
:
3545 pp_string (pp
, "#pragma omp target data");
3546 dump_omp_clauses (pp
, OMP_TARGET_DATA_CLAUSES (node
), spc
, flags
);
3549 case OMP_TARGET_ENTER_DATA
:
3550 pp_string (pp
, "#pragma omp target enter data");
3551 dump_omp_clauses (pp
, OMP_TARGET_ENTER_DATA_CLAUSES (node
), spc
, flags
);
3555 case OMP_TARGET_EXIT_DATA
:
3556 pp_string (pp
, "#pragma omp target exit data");
3557 dump_omp_clauses (pp
, OMP_TARGET_EXIT_DATA_CLAUSES (node
), spc
, flags
);
3562 pp_string (pp
, "#pragma omp target");
3563 dump_omp_clauses (pp
, OMP_TARGET_CLAUSES (node
), spc
, flags
);
3566 case OMP_TARGET_UPDATE
:
3567 pp_string (pp
, "#pragma omp target update");
3568 dump_omp_clauses (pp
, OMP_TARGET_UPDATE_CLAUSES (node
), spc
, flags
);
3573 dump_omp_clauses (pp
, OMP_FOR_CLAUSES (node
), spc
, flags
);
3574 if (!(flags
& TDF_SLIM
))
3578 if (OMP_FOR_PRE_BODY (node
))
3580 newline_and_indent (pp
, spc
+ 2);
3583 newline_and_indent (pp
, spc
);
3584 dump_generic_node (pp
, OMP_FOR_PRE_BODY (node
),
3587 if (OMP_FOR_INIT (node
))
3590 for (i
= 0; i
< TREE_VEC_LENGTH (OMP_FOR_INIT (node
)); i
++)
3593 newline_and_indent (pp
, spc
);
3594 pp_string (pp
, "for (");
3595 tree init
= TREE_VEC_ELT (OMP_FOR_INIT (node
), i
);
3596 if (TREE_CODE (init
) != MODIFY_EXPR
3597 || TREE_CODE (TREE_OPERAND (init
, 1)) != TREE_VEC
)
3598 dump_generic_node (pp
, init
, spc
, flags
, false);
3601 dump_generic_node (pp
, TREE_OPERAND (init
, 0),
3603 pp_string (pp
, " = ");
3604 dump_omp_loop_non_rect_expr (pp
, TREE_OPERAND (init
, 1),
3607 pp_string (pp
, "; ");
3608 tree cond
= TREE_VEC_ELT (OMP_FOR_COND (node
), i
);
3609 if (!COMPARISON_CLASS_P (cond
)
3610 || TREE_CODE (TREE_OPERAND (cond
, 1)) != TREE_VEC
)
3611 dump_generic_node (pp
, cond
, spc
, flags
, false);
3614 dump_generic_node (pp
, TREE_OPERAND (cond
, 0),
3616 const char *op
= op_symbol (cond
);
3620 dump_omp_loop_non_rect_expr (pp
, TREE_OPERAND (cond
, 1),
3623 pp_string (pp
, "; ");
3624 dump_generic_node (pp
,
3625 TREE_VEC_ELT (OMP_FOR_INCR (node
), i
),
3627 pp_right_paren (pp
);
3630 if (OMP_FOR_BODY (node
))
3632 newline_and_indent (pp
, spc
+ 2);
3634 newline_and_indent (pp
, spc
+ 4);
3635 dump_generic_node (pp
, OMP_FOR_BODY (node
), spc
+ 4, flags
,
3637 newline_and_indent (pp
, spc
+ 2);
3638 pp_right_brace (pp
);
3640 if (OMP_FOR_INIT (node
))
3641 spc
-= 2 * TREE_VEC_LENGTH (OMP_FOR_INIT (node
)) - 2;
3642 if (OMP_FOR_PRE_BODY (node
))
3645 newline_and_indent (pp
, spc
+ 2);
3646 pp_right_brace (pp
);
3653 pp_string (pp
, "#pragma omp sections");
3654 dump_omp_clauses (pp
, OMP_SECTIONS_CLAUSES (node
), spc
, flags
);
3658 pp_string (pp
, "#pragma omp section");
3662 if (OMP_SCAN_CLAUSES (node
))
3664 pp_string (pp
, "#pragma omp scan");
3665 dump_omp_clauses (pp
, OMP_SCAN_CLAUSES (node
), spc
, flags
);
3670 pp_string (pp
, "#pragma omp master");
3674 pp_string (pp
, "#pragma omp masked");
3675 dump_omp_clauses (pp
, OMP_MASKED_CLAUSES (node
), spc
, flags
);
3679 pp_string (pp
, "#pragma omp taskgroup");
3680 dump_omp_clauses (pp
, OMP_TASKGROUP_CLAUSES (node
), spc
, flags
);
3684 pp_string (pp
, "#pragma omp ordered");
3685 dump_omp_clauses (pp
, OMP_ORDERED_CLAUSES (node
), spc
, flags
);
3689 pp_string (pp
, "#pragma omp critical");
3690 if (OMP_CRITICAL_NAME (node
))
3694 dump_generic_node (pp
, OMP_CRITICAL_NAME (node
), spc
,
3696 pp_right_paren (pp
);
3698 dump_omp_clauses (pp
, OMP_CRITICAL_CLAUSES (node
), spc
, flags
);
3702 pp_string (pp
, "#pragma omp atomic");
3703 if (OMP_ATOMIC_WEAK (node
))
3704 pp_string (pp
, " weak");
3705 dump_omp_atomic_memory_order (pp
, OMP_ATOMIC_MEMORY_ORDER (node
));
3706 newline_and_indent (pp
, spc
+ 2);
3707 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3711 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3714 case OMP_ATOMIC_READ
:
3715 pp_string (pp
, "#pragma omp atomic read");
3716 dump_omp_atomic_memory_order (pp
, OMP_ATOMIC_MEMORY_ORDER (node
));
3717 newline_and_indent (pp
, spc
+ 2);
3718 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3722 case OMP_ATOMIC_CAPTURE_OLD
:
3723 case OMP_ATOMIC_CAPTURE_NEW
:
3724 pp_string (pp
, "#pragma omp atomic capture");
3725 if (OMP_ATOMIC_WEAK (node
))
3726 pp_string (pp
, " weak");
3727 dump_omp_atomic_memory_order (pp
, OMP_ATOMIC_MEMORY_ORDER (node
));
3728 newline_and_indent (pp
, spc
+ 2);
3729 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3733 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3737 pp_string (pp
, "#pragma omp single");
3738 dump_omp_clauses (pp
, OMP_SINGLE_CLAUSES (node
), spc
, flags
);
3742 pp_string (pp
, "#pragma omp scope");
3743 dump_omp_clauses (pp
, OMP_SCOPE_CLAUSES (node
), spc
, flags
);
3747 /* If we come here, we're dumping something that's not an OMP construct,
3748 for example, OMP clauses attached to a function's '__attribute__'.
3749 Dump the whole OMP clause chain. */
3750 dump_omp_clauses (pp
, node
, spc
, flags
, false);
3754 case TRANSACTION_EXPR
:
3755 if (TRANSACTION_EXPR_OUTER (node
))
3756 pp_string (pp
, "__transaction_atomic [[outer]]");
3757 else if (TRANSACTION_EXPR_RELAXED (node
))
3758 pp_string (pp
, "__transaction_relaxed");
3760 pp_string (pp
, "__transaction_atomic");
3761 if (!(flags
& TDF_SLIM
) && TRANSACTION_EXPR_BODY (node
))
3763 newline_and_indent (pp
, spc
);
3765 newline_and_indent (pp
, spc
+ 2);
3766 dump_generic_node (pp
, TRANSACTION_EXPR_BODY (node
),
3767 spc
+ 2, flags
, false);
3768 newline_and_indent (pp
, spc
);
3769 pp_right_brace (pp
);
3774 case VEC_SERIES_EXPR
:
3775 case VEC_WIDEN_MULT_HI_EXPR
:
3776 case VEC_WIDEN_MULT_LO_EXPR
:
3777 case VEC_WIDEN_PLUS_HI_EXPR
:
3778 case VEC_WIDEN_PLUS_LO_EXPR
:
3779 case VEC_WIDEN_MINUS_HI_EXPR
:
3780 case VEC_WIDEN_MINUS_LO_EXPR
:
3781 case VEC_WIDEN_MULT_EVEN_EXPR
:
3782 case VEC_WIDEN_MULT_ODD_EXPR
:
3783 case VEC_WIDEN_LSHIFT_HI_EXPR
:
3784 case VEC_WIDEN_LSHIFT_LO_EXPR
:
3786 for (str
= get_tree_code_name (code
); *str
; str
++)
3787 pp_character (pp
, TOUPPER (*str
));
3788 pp_string (pp
, " < ");
3789 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3790 pp_string (pp
, ", ");
3791 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3792 pp_string (pp
, " > ");
3795 case VEC_DUPLICATE_EXPR
:
3797 for (str
= get_tree_code_name (code
); *str
; str
++)
3798 pp_character (pp
, TOUPPER (*str
));
3799 pp_string (pp
, " < ");
3800 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3801 pp_string (pp
, " > ");
3804 case VEC_UNPACK_HI_EXPR
:
3805 pp_string (pp
, " VEC_UNPACK_HI_EXPR < ");
3806 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3807 pp_string (pp
, " > ");
3810 case VEC_UNPACK_LO_EXPR
:
3811 pp_string (pp
, " VEC_UNPACK_LO_EXPR < ");
3812 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3813 pp_string (pp
, " > ");
3816 case VEC_UNPACK_FLOAT_HI_EXPR
:
3817 pp_string (pp
, " VEC_UNPACK_FLOAT_HI_EXPR < ");
3818 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3819 pp_string (pp
, " > ");
3822 case VEC_UNPACK_FLOAT_LO_EXPR
:
3823 pp_string (pp
, " VEC_UNPACK_FLOAT_LO_EXPR < ");
3824 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3825 pp_string (pp
, " > ");
3828 case VEC_UNPACK_FIX_TRUNC_HI_EXPR
:
3829 pp_string (pp
, " VEC_UNPACK_FIX_TRUNC_HI_EXPR < ");
3830 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3831 pp_string (pp
, " > ");
3834 case VEC_UNPACK_FIX_TRUNC_LO_EXPR
:
3835 pp_string (pp
, " VEC_UNPACK_FIX_TRUNC_LO_EXPR < ");
3836 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3837 pp_string (pp
, " > ");
3840 case VEC_PACK_TRUNC_EXPR
:
3841 pp_string (pp
, " VEC_PACK_TRUNC_EXPR < ");
3842 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3843 pp_string (pp
, ", ");
3844 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3845 pp_string (pp
, " > ");
3848 case VEC_PACK_SAT_EXPR
:
3849 pp_string (pp
, " VEC_PACK_SAT_EXPR < ");
3850 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3851 pp_string (pp
, ", ");
3852 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3853 pp_string (pp
, " > ");
3856 case VEC_PACK_FIX_TRUNC_EXPR
:
3857 pp_string (pp
, " VEC_PACK_FIX_TRUNC_EXPR < ");
3858 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3859 pp_string (pp
, ", ");
3860 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3861 pp_string (pp
, " > ");
3864 case VEC_PACK_FLOAT_EXPR
:
3865 pp_string (pp
, " VEC_PACK_FLOAT_EXPR < ");
3866 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3867 pp_string (pp
, ", ");
3868 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3869 pp_string (pp
, " > ");
3873 dump_block_node (pp
, node
, spc
, flags
);
3876 case DEBUG_BEGIN_STMT
:
3877 pp_string (pp
, "# DEBUG BEGIN STMT");
3884 if (is_stmt
&& is_expr
)
3890 /* Print the declaration of a variable. */
3893 print_declaration (pretty_printer
*pp
, tree t
, int spc
, dump_flags_t flags
)
3897 if (TREE_CODE(t
) == NAMELIST_DECL
)
3899 pp_string(pp
, "namelist ");
3900 dump_decl_name (pp
, t
, flags
);
3905 if (TREE_CODE (t
) == TYPE_DECL
)
3906 pp_string (pp
, "typedef ");
3908 if (CODE_CONTAINS_STRUCT (TREE_CODE (t
), TS_DECL_WRTL
) && DECL_REGISTER (t
))
3909 pp_string (pp
, "register ");
3911 if (TREE_PUBLIC (t
) && DECL_EXTERNAL (t
))
3912 pp_string (pp
, "extern ");
3913 else if (TREE_STATIC (t
))
3914 pp_string (pp
, "static ");
3916 /* Print the type and name. */
3917 if (TREE_TYPE (t
) && TREE_CODE (TREE_TYPE (t
)) == ARRAY_TYPE
)
3921 /* Print array's type. */
3922 tmp
= TREE_TYPE (t
);
3923 while (TREE_CODE (TREE_TYPE (tmp
)) == ARRAY_TYPE
)
3924 tmp
= TREE_TYPE (tmp
);
3925 dump_generic_node (pp
, TREE_TYPE (tmp
), spc
, flags
, false);
3927 /* Print variable's name. */
3929 dump_generic_node (pp
, t
, spc
, flags
, false);
3931 /* Print the dimensions. */
3932 tmp
= TREE_TYPE (t
);
3933 while (TREE_CODE (tmp
) == ARRAY_TYPE
)
3935 dump_array_domain (pp
, TYPE_DOMAIN (tmp
), spc
, flags
);
3936 tmp
= TREE_TYPE (tmp
);
3939 else if (TREE_CODE (t
) == FUNCTION_DECL
)
3941 dump_generic_node (pp
, TREE_TYPE (TREE_TYPE (t
)), spc
, flags
, false);
3943 dump_decl_name (pp
, t
, flags
);
3944 dump_function_declaration (pp
, TREE_TYPE (t
), spc
, flags
);
3948 /* Print type declaration. */
3949 dump_generic_node (pp
, TREE_TYPE (t
), spc
, flags
, false);
3951 /* Print variable's name. */
3953 dump_generic_node (pp
, t
, spc
, flags
, false);
3956 if (VAR_P (t
) && DECL_HARD_REGISTER (t
))
3958 pp_string (pp
, " __asm__ ");
3960 dump_generic_node (pp
, DECL_ASSEMBLER_NAME (t
), spc
, flags
, false);
3961 pp_right_paren (pp
);
3964 /* The initial value of a function serves to determine whether the function
3965 is declared or defined. So the following does not apply to function
3967 if (TREE_CODE (t
) != FUNCTION_DECL
)
3969 /* Print the initial value. */
3970 if (DECL_INITIAL (t
))
3975 if (!(flags
& TDF_SLIM
))
3976 dump_generic_node (pp
, DECL_INITIAL (t
), spc
, flags
, false);
3978 pp_string (pp
, "<<< omitted >>>");
3982 if (VAR_P (t
) && DECL_HAS_VALUE_EXPR_P (t
))
3984 pp_string (pp
, " [value-expr: ");
3985 dump_generic_node (pp
, DECL_VALUE_EXPR (t
), spc
, flags
, false);
3986 pp_right_bracket (pp
);
3993 /* Prints a structure: name, fields, and methods.
3994 FIXME: Still incomplete. */
3997 print_struct_decl (pretty_printer
*pp
, const_tree node
, int spc
,
4000 /* Print the name of the structure. */
4001 if (TYPE_NAME (node
))
4004 if (TREE_CODE (node
) == RECORD_TYPE
)
4005 pp_string (pp
, "struct ");
4006 else if ((TREE_CODE (node
) == UNION_TYPE
4007 || TREE_CODE (node
) == QUAL_UNION_TYPE
))
4008 pp_string (pp
, "union ");
4010 dump_generic_node (pp
, TYPE_NAME (node
), spc
, TDF_NONE
, false);
4013 /* Print the contents of the structure. */
4019 /* Print the fields of the structure. */
4022 tmp
= TYPE_FIELDS (node
);
4025 /* Avoid to print recursively the structure. */
4026 /* FIXME : Not implemented correctly...,
4027 what about the case when we have a cycle in the contain graph? ...
4028 Maybe this could be solved by looking at the scope in which the
4029 structure was declared. */
4030 if (TREE_TYPE (tmp
) != node
4031 && (TREE_CODE (TREE_TYPE (tmp
)) != POINTER_TYPE
4032 || TREE_TYPE (TREE_TYPE (tmp
)) != node
))
4034 print_declaration (pp
, tmp
, spc
+2, flags
);
4037 tmp
= DECL_CHAIN (tmp
);
4041 pp_right_brace (pp
);
4044 /* Return the priority of the operator CODE.
4046 From lowest to highest precedence with either left-to-right (L-R)
4047 or right-to-left (R-L) associativity]:
4050 2 [R-L] = += -= *= /= %= &= ^= |= <<= >>=
4062 14 [R-L] ! ~ ++ -- + - * & (type) sizeof
4063 15 [L-R] fn() [] -> .
4065 unary +, - and * have higher precedence than the corresponding binary
4069 op_code_prio (enum tree_code code
)
4086 case TRUTH_ORIF_EXPR
:
4089 case TRUTH_AND_EXPR
:
4090 case TRUTH_ANDIF_EXPR
:
4097 case TRUTH_XOR_EXPR
:
4114 case UNORDERED_EXPR
:
4125 case VEC_WIDEN_LSHIFT_HI_EXPR
:
4126 case VEC_WIDEN_LSHIFT_LO_EXPR
:
4127 case WIDEN_LSHIFT_EXPR
:
4130 case WIDEN_SUM_EXPR
:
4132 case POINTER_PLUS_EXPR
:
4133 case POINTER_DIFF_EXPR
:
4137 case VEC_WIDEN_MULT_HI_EXPR
:
4138 case VEC_WIDEN_MULT_LO_EXPR
:
4139 case WIDEN_MULT_EXPR
:
4141 case WIDEN_MULT_PLUS_EXPR
:
4142 case WIDEN_MULT_MINUS_EXPR
:
4144 case MULT_HIGHPART_EXPR
:
4145 case TRUNC_DIV_EXPR
:
4147 case FLOOR_DIV_EXPR
:
4148 case ROUND_DIV_EXPR
:
4150 case EXACT_DIV_EXPR
:
4151 case TRUNC_MOD_EXPR
:
4153 case FLOOR_MOD_EXPR
:
4154 case ROUND_MOD_EXPR
:
4157 case TRUTH_NOT_EXPR
:
4159 case POSTINCREMENT_EXPR
:
4160 case POSTDECREMENT_EXPR
:
4161 case PREINCREMENT_EXPR
:
4162 case PREDECREMENT_EXPR
:
4168 case FIX_TRUNC_EXPR
:
4174 case ARRAY_RANGE_REF
:
4178 /* Special expressions. */
4184 case VEC_UNPACK_HI_EXPR
:
4185 case VEC_UNPACK_LO_EXPR
:
4186 case VEC_UNPACK_FLOAT_HI_EXPR
:
4187 case VEC_UNPACK_FLOAT_LO_EXPR
:
4188 case VEC_UNPACK_FIX_TRUNC_HI_EXPR
:
4189 case VEC_UNPACK_FIX_TRUNC_LO_EXPR
:
4190 case VEC_PACK_TRUNC_EXPR
:
4191 case VEC_PACK_SAT_EXPR
:
4195 /* Return an arbitrarily high precedence to avoid surrounding single
4196 VAR_DECLs in ()s. */
4201 /* Return the priority of the operator OP. */
4204 op_prio (const_tree op
)
4206 enum tree_code code
;
4211 code
= TREE_CODE (op
);
4212 if (code
== SAVE_EXPR
|| code
== NON_LVALUE_EXPR
)
4213 return op_prio (TREE_OPERAND (op
, 0));
4215 return op_code_prio (code
);
4218 /* Return the symbol associated with operator CODE. */
4221 op_symbol_code (enum tree_code code
)
4229 case TRUTH_ORIF_EXPR
:
4232 case TRUTH_AND_EXPR
:
4233 case TRUTH_ANDIF_EXPR
:
4239 case TRUTH_XOR_EXPR
:
4249 case UNORDERED_EXPR
:
4295 case WIDEN_LSHIFT_EXPR
:
4298 case WIDEN_PLUS_EXPR
:
4301 case WIDEN_MINUS_EXPR
:
4304 case POINTER_PLUS_EXPR
:
4310 case WIDEN_SUM_EXPR
:
4313 case WIDEN_MULT_EXPR
:
4316 case MULT_HIGHPART_EXPR
:
4321 case POINTER_DIFF_EXPR
:
4327 case TRUTH_NOT_EXPR
:
4334 case TRUNC_DIV_EXPR
:
4341 case FLOOR_DIV_EXPR
:
4344 case ROUND_DIV_EXPR
:
4347 case EXACT_DIV_EXPR
:
4350 case TRUNC_MOD_EXPR
:
4356 case FLOOR_MOD_EXPR
:
4359 case ROUND_MOD_EXPR
:
4362 case PREDECREMENT_EXPR
:
4365 case PREINCREMENT_EXPR
:
4368 case POSTDECREMENT_EXPR
:
4371 case POSTINCREMENT_EXPR
:
4381 return "<<< ??? >>>";
4385 /* Return the symbol associated with operator OP. */
4388 op_symbol (const_tree op
)
4390 return op_symbol_code (TREE_CODE (op
));
4393 /* Prints the name of a call. NODE is the CALL_EXPR_FN of a CALL_EXPR or
4394 the gimple_call_fn of a GIMPLE_CALL. */
4397 print_call_name (pretty_printer
*pp
, tree node
, dump_flags_t flags
)
4401 if (TREE_CODE (op0
) == NON_LVALUE_EXPR
)
4402 op0
= TREE_OPERAND (op0
, 0);
4405 switch (TREE_CODE (op0
))
4410 dump_function_name (pp
, op0
, flags
);
4416 op0
= TREE_OPERAND (op0
, 0);
4421 dump_generic_node (pp
, TREE_OPERAND (op0
, 0), 0, flags
, false);
4422 pp_string (pp
, ") ? ");
4423 dump_generic_node (pp
, TREE_OPERAND (op0
, 1), 0, flags
, false);
4424 pp_string (pp
, " : ");
4425 dump_generic_node (pp
, TREE_OPERAND (op0
, 2), 0, flags
, false);
4429 if (TREE_CODE (TREE_OPERAND (op0
, 0)) == VAR_DECL
)
4430 dump_function_name (pp
, TREE_OPERAND (op0
, 0), flags
);
4432 dump_generic_node (pp
, op0
, 0, flags
, false);
4436 if (integer_zerop (TREE_OPERAND (op0
, 1)))
4438 op0
= TREE_OPERAND (op0
, 0);
4445 dump_generic_node (pp
, op0
, 0, flags
, false);
4453 /* Print the first N characters in the array STR, replacing non-printable
4454 characters (including embedded nuls) with unambiguous escape sequences. */
4457 pretty_print_string (pretty_printer
*pp
, const char *str
, size_t n
)
4462 for ( ; n
; --n
, ++str
)
4467 pp_string (pp
, "\\b");
4471 pp_string (pp
, "\\f");
4475 pp_string (pp
, "\\n");
4479 pp_string (pp
, "\\r");
4483 pp_string (pp
, "\\t");
4487 pp_string (pp
, "\\v");
4491 pp_string (pp
, "\\\\");
4495 pp_string (pp
, "\\\"");
4499 pp_string (pp
, "\\'");
4503 if (str
[0] || n
> 1)
4505 if (!ISPRINT (str
[0]))
4508 sprintf (buf
, "\\x%02x", (unsigned char)str
[0]);
4509 pp_string (pp
, buf
);
4512 pp_character (pp
, str
[0]);
4520 maybe_init_pretty_print (FILE *file
)
4524 tree_pp
= new pretty_printer ();
4525 pp_needs_newline (tree_pp
) = true;
4526 pp_translate_identifiers (tree_pp
) = false;
4529 tree_pp
->buffer
->stream
= file
;
4533 newline_and_indent (pretty_printer
*pp
, int spc
)
4539 /* Print the identifier ID to PRETTY-PRINTER. */
4542 pp_tree_identifier (pretty_printer
*pp
, tree id
)
4544 if (pp_translate_identifiers (pp
))
4546 const char *text
= identifier_to_locale (IDENTIFIER_POINTER (id
));
4547 pp_append_text (pp
, text
, text
+ strlen (text
));
4550 pp_append_text (pp
, IDENTIFIER_POINTER (id
),
4551 IDENTIFIER_POINTER (id
) + IDENTIFIER_LENGTH (id
));
4554 /* A helper function that is used to dump function information before the
4558 dump_function_header (FILE *dump_file
, tree fdecl
, dump_flags_t flags
)
4560 const char *dname
, *aname
;
4561 struct cgraph_node
*node
= cgraph_node::get (fdecl
);
4562 struct function
*fun
= DECL_STRUCT_FUNCTION (fdecl
);
4564 dname
= lang_hooks
.decl_printable_name (fdecl
, 1);
4566 if (DECL_ASSEMBLER_NAME_SET_P (fdecl
))
4567 aname
= (IDENTIFIER_POINTER
4568 (DECL_ASSEMBLER_NAME (fdecl
)));
4570 aname
= "<unset-asm-name>";
4572 fprintf (dump_file
, "\n;; Function %s (%s, funcdef_no=%d",
4573 dname
, aname
, fun
->funcdef_no
);
4574 if (!(flags
& TDF_NOUID
))
4575 fprintf (dump_file
, ", decl_uid=%d", DECL_UID (fdecl
));
4578 fprintf (dump_file
, ", cgraph_uid=%d", node
->get_uid ());
4579 fprintf (dump_file
, ", symbol_order=%d)%s\n\n", node
->order
,
4580 node
->frequency
== NODE_FREQUENCY_HOT
4582 : node
->frequency
== NODE_FREQUENCY_UNLIKELY_EXECUTED
4583 ? " (unlikely executed)"
4584 : node
->frequency
== NODE_FREQUENCY_EXECUTED_ONCE
4585 ? " (executed once)"
4589 fprintf (dump_file
, ")\n\n");
4592 /* Dump double_int D to pretty_printer PP. UNS is true
4593 if D is unsigned and false otherwise. */
4595 pp_double_int (pretty_printer
*pp
, double_int d
, bool uns
)
4598 pp_wide_integer (pp
, d
.low
);
4599 else if (d
.fits_uhwi ())
4600 pp_unsigned_wide_integer (pp
, d
.low
);
4603 unsigned HOST_WIDE_INT low
= d
.low
;
4604 HOST_WIDE_INT high
= d
.high
;
4605 if (!uns
&& d
.is_negative ())
4608 high
= ~high
+ !low
;
4611 /* Would "%x%0*x" or "%x%*0x" get zero-padding on all
4613 sprintf (pp_buffer (pp
)->digit_buffer
,
4614 HOST_WIDE_INT_PRINT_DOUBLE_HEX
,
4615 (unsigned HOST_WIDE_INT
) high
, low
);
4616 pp_string (pp
, pp_buffer (pp
)->digit_buffer
);
4621 # pragma GCC diagnostic pop