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 pp_string (pp
, "alloc");
863 case GOMP_MAP_IF_PRESENT
:
864 pp_string (pp
, "no_alloc");
867 case GOMP_MAP_TO_PSET
:
868 pp_string (pp
, "to");
871 pp_string (pp
, "from");
873 case GOMP_MAP_TOFROM
:
874 pp_string (pp
, "tofrom");
876 case GOMP_MAP_FORCE_ALLOC
:
877 pp_string (pp
, "force_alloc");
879 case GOMP_MAP_FORCE_TO
:
880 pp_string (pp
, "force_to");
882 case GOMP_MAP_FORCE_FROM
:
883 pp_string (pp
, "force_from");
885 case GOMP_MAP_FORCE_TOFROM
:
886 pp_string (pp
, "force_tofrom");
888 case GOMP_MAP_FORCE_PRESENT
:
889 pp_string (pp
, "force_present");
891 case GOMP_MAP_DELETE
:
892 pp_string (pp
, "delete");
894 case GOMP_MAP_FORCE_DEVICEPTR
:
895 pp_string (pp
, "force_deviceptr");
897 case GOMP_MAP_ALWAYS_TO
:
898 pp_string (pp
, "always,to");
900 case GOMP_MAP_ALWAYS_FROM
:
901 pp_string (pp
, "always,from");
903 case GOMP_MAP_ALWAYS_TOFROM
:
904 pp_string (pp
, "always,tofrom");
906 case GOMP_MAP_RELEASE
:
907 pp_string (pp
, "release");
909 case GOMP_MAP_FIRSTPRIVATE_POINTER
:
910 pp_string (pp
, "firstprivate");
912 case GOMP_MAP_FIRSTPRIVATE_REFERENCE
:
913 pp_string (pp
, "firstprivate ref");
915 case GOMP_MAP_STRUCT
:
916 pp_string (pp
, "struct");
918 case GOMP_MAP_ALWAYS_POINTER
:
919 pp_string (pp
, "always_pointer");
921 case GOMP_MAP_DEVICE_RESIDENT
:
922 pp_string (pp
, "device_resident");
925 pp_string (pp
, "link");
927 case GOMP_MAP_ATTACH
:
928 pp_string (pp
, "attach");
930 case GOMP_MAP_DETACH
:
931 pp_string (pp
, "detach");
933 case GOMP_MAP_FORCE_DETACH
:
934 pp_string (pp
, "force_detach");
936 case GOMP_MAP_ATTACH_DETACH
:
937 pp_string (pp
, "attach_detach");
943 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
946 if (OMP_CLAUSE_SIZE (clause
))
948 switch (OMP_CLAUSE_CODE (clause
) == OMP_CLAUSE_MAP
949 ? OMP_CLAUSE_MAP_KIND (clause
) : GOMP_MAP_TO
)
951 case GOMP_MAP_POINTER
:
952 case GOMP_MAP_FIRSTPRIVATE_POINTER
:
953 case GOMP_MAP_FIRSTPRIVATE_REFERENCE
:
954 case GOMP_MAP_ALWAYS_POINTER
:
955 pp_string (pp
, " [pointer assign, bias: ");
957 case GOMP_MAP_TO_PSET
:
958 pp_string (pp
, " [pointer set, len: ");
960 case GOMP_MAP_ATTACH
:
961 case GOMP_MAP_DETACH
:
962 case GOMP_MAP_FORCE_DETACH
:
963 case GOMP_MAP_ATTACH_DETACH
:
964 pp_string (pp
, " [bias: ");
967 pp_string (pp
, " [len: ");
970 dump_generic_node (pp
, OMP_CLAUSE_SIZE (clause
),
972 pp_right_bracket (pp
);
977 case OMP_CLAUSE_FROM
:
978 pp_string (pp
, "from(");
979 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
981 goto print_clause_size
;
984 pp_string (pp
, "to(");
985 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
987 goto print_clause_size
;
989 case OMP_CLAUSE__CACHE_
:
991 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
993 goto print_clause_size
;
995 case OMP_CLAUSE_NUM_TEAMS
:
996 pp_string (pp
, "num_teams(");
997 if (OMP_CLAUSE_NUM_TEAMS_LOWER_EXPR (clause
))
999 dump_generic_node (pp
, OMP_CLAUSE_NUM_TEAMS_LOWER_EXPR (clause
),
1003 dump_generic_node (pp
, OMP_CLAUSE_NUM_TEAMS_UPPER_EXPR (clause
),
1005 pp_right_paren (pp
);
1008 case OMP_CLAUSE_THREAD_LIMIT
:
1009 pp_string (pp
, "thread_limit(");
1010 dump_generic_node (pp
, OMP_CLAUSE_THREAD_LIMIT_EXPR (clause
),
1012 pp_right_paren (pp
);
1015 case OMP_CLAUSE_DEVICE
:
1016 pp_string (pp
, "device(");
1017 if (OMP_CLAUSE_DEVICE_ANCESTOR (clause
))
1018 pp_string (pp
, "ancestor:");
1019 dump_generic_node (pp
, OMP_CLAUSE_DEVICE_ID (clause
),
1021 pp_right_paren (pp
);
1024 case OMP_CLAUSE_DIST_SCHEDULE
:
1025 pp_string (pp
, "dist_schedule(static");
1026 if (OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR (clause
))
1029 dump_generic_node (pp
,
1030 OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR (clause
),
1033 pp_right_paren (pp
);
1036 case OMP_CLAUSE_PROC_BIND
:
1037 pp_string (pp
, "proc_bind(");
1038 switch (OMP_CLAUSE_PROC_BIND_KIND (clause
))
1040 case OMP_CLAUSE_PROC_BIND_MASTER
:
1041 /* Same enum value: case OMP_CLAUSE_PROC_BIND_PRIMARY: */
1042 /* TODO: Change to 'primary' for OpenMP 5.1. */
1043 pp_string (pp
, "master");
1045 case OMP_CLAUSE_PROC_BIND_CLOSE
:
1046 pp_string (pp
, "close");
1048 case OMP_CLAUSE_PROC_BIND_SPREAD
:
1049 pp_string (pp
, "spread");
1054 pp_right_paren (pp
);
1057 case OMP_CLAUSE_DEVICE_TYPE
:
1058 pp_string (pp
, "device_type(");
1059 switch (OMP_CLAUSE_DEVICE_TYPE_KIND (clause
))
1061 case OMP_CLAUSE_DEVICE_TYPE_HOST
:
1062 pp_string (pp
, "host");
1064 case OMP_CLAUSE_DEVICE_TYPE_NOHOST
:
1065 pp_string (pp
, "nohost");
1067 case OMP_CLAUSE_DEVICE_TYPE_ANY
:
1068 pp_string (pp
, "any");
1073 pp_right_paren (pp
);
1076 case OMP_CLAUSE_SAFELEN
:
1077 pp_string (pp
, "safelen(");
1078 dump_generic_node (pp
, OMP_CLAUSE_SAFELEN_EXPR (clause
),
1080 pp_right_paren (pp
);
1083 case OMP_CLAUSE_SIMDLEN
:
1084 pp_string (pp
, "simdlen(");
1085 dump_generic_node (pp
, OMP_CLAUSE_SIMDLEN_EXPR (clause
),
1087 pp_right_paren (pp
);
1090 case OMP_CLAUSE_PRIORITY
:
1091 pp_string (pp
, "priority(");
1092 dump_generic_node (pp
, OMP_CLAUSE_PRIORITY_EXPR (clause
),
1094 pp_right_paren (pp
);
1097 case OMP_CLAUSE_GRAINSIZE
:
1098 pp_string (pp
, "grainsize(");
1099 if (OMP_CLAUSE_GRAINSIZE_STRICT (clause
))
1100 pp_string (pp
, "strict:");
1101 dump_generic_node (pp
, OMP_CLAUSE_GRAINSIZE_EXPR (clause
),
1103 pp_right_paren (pp
);
1106 case OMP_CLAUSE_NUM_TASKS
:
1107 pp_string (pp
, "num_tasks(");
1108 if (OMP_CLAUSE_NUM_TASKS_STRICT (clause
))
1109 pp_string (pp
, "strict:");
1110 dump_generic_node (pp
, OMP_CLAUSE_NUM_TASKS_EXPR (clause
),
1112 pp_right_paren (pp
);
1115 case OMP_CLAUSE_HINT
:
1116 pp_string (pp
, "hint(");
1117 dump_generic_node (pp
, OMP_CLAUSE_HINT_EXPR (clause
),
1119 pp_right_paren (pp
);
1122 case OMP_CLAUSE_FILTER
:
1123 pp_string (pp
, "filter(");
1124 dump_generic_node (pp
, OMP_CLAUSE_FILTER_EXPR (clause
),
1126 pp_right_paren (pp
);
1129 case OMP_CLAUSE_DEFAULTMAP
:
1130 pp_string (pp
, "defaultmap(");
1131 switch (OMP_CLAUSE_DEFAULTMAP_BEHAVIOR (clause
))
1133 case OMP_CLAUSE_DEFAULTMAP_ALLOC
:
1134 pp_string (pp
, "alloc");
1136 case OMP_CLAUSE_DEFAULTMAP_TO
:
1137 pp_string (pp
, "to");
1139 case OMP_CLAUSE_DEFAULTMAP_FROM
:
1140 pp_string (pp
, "from");
1142 case OMP_CLAUSE_DEFAULTMAP_TOFROM
:
1143 pp_string (pp
, "tofrom");
1145 case OMP_CLAUSE_DEFAULTMAP_FIRSTPRIVATE
:
1146 pp_string (pp
, "firstprivate");
1148 case OMP_CLAUSE_DEFAULTMAP_NONE
:
1149 pp_string (pp
, "none");
1151 case OMP_CLAUSE_DEFAULTMAP_DEFAULT
:
1152 pp_string (pp
, "default");
1157 switch (OMP_CLAUSE_DEFAULTMAP_CATEGORY (clause
))
1159 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_UNSPECIFIED
:
1161 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_SCALAR
:
1162 pp_string (pp
, ":scalar");
1164 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_AGGREGATE
:
1165 pp_string (pp
, ":aggregate");
1167 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_ALLOCATABLE
:
1168 pp_string (pp
, ":allocatable");
1170 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_POINTER
:
1171 pp_string (pp
, ":pointer");
1176 pp_right_paren (pp
);
1179 case OMP_CLAUSE_ORDER
:
1180 pp_string (pp
, "order(");
1181 if (OMP_CLAUSE_ORDER_UNCONSTRAINED (clause
))
1182 pp_string (pp
, "unconstrained:");
1183 else if (OMP_CLAUSE_ORDER_REPRODUCIBLE (clause
))
1184 pp_string (pp
, "reproducible:");
1185 pp_string (pp
, "concurrent)");
1188 case OMP_CLAUSE_BIND
:
1189 pp_string (pp
, "bind(");
1190 switch (OMP_CLAUSE_BIND_KIND (clause
))
1192 case OMP_CLAUSE_BIND_TEAMS
:
1193 pp_string (pp
, "teams");
1195 case OMP_CLAUSE_BIND_PARALLEL
:
1196 pp_string (pp
, "parallel");
1198 case OMP_CLAUSE_BIND_THREAD
:
1199 pp_string (pp
, "thread");
1204 pp_right_paren (pp
);
1207 case OMP_CLAUSE__SIMDUID_
:
1208 pp_string (pp
, "_simduid_(");
1209 dump_generic_node (pp
, OMP_CLAUSE__SIMDUID__DECL (clause
),
1211 pp_right_paren (pp
);
1214 case OMP_CLAUSE__SIMT_
:
1215 pp_string (pp
, "_simt_");
1218 case OMP_CLAUSE_GANG
:
1219 pp_string (pp
, "gang");
1220 if (OMP_CLAUSE_GANG_EXPR (clause
) != NULL_TREE
)
1222 pp_string (pp
, "(num: ");
1223 dump_generic_node (pp
, OMP_CLAUSE_GANG_EXPR (clause
),
1226 if (OMP_CLAUSE_GANG_STATIC_EXPR (clause
) != NULL_TREE
)
1228 if (OMP_CLAUSE_GANG_EXPR (clause
) == NULL_TREE
)
1232 pp_string (pp
, "static:");
1233 if (OMP_CLAUSE_GANG_STATIC_EXPR (clause
)
1234 == integer_minus_one_node
)
1235 pp_character (pp
, '*');
1237 dump_generic_node (pp
, OMP_CLAUSE_GANG_STATIC_EXPR (clause
),
1240 if (OMP_CLAUSE_GANG_EXPR (clause
) != NULL_TREE
1241 || OMP_CLAUSE_GANG_STATIC_EXPR (clause
) != NULL_TREE
)
1242 pp_right_paren (pp
);
1245 case OMP_CLAUSE_ASYNC
:
1246 pp_string (pp
, "async");
1247 if (OMP_CLAUSE_ASYNC_EXPR (clause
))
1249 pp_character(pp
, '(');
1250 dump_generic_node (pp
, OMP_CLAUSE_ASYNC_EXPR (clause
),
1252 pp_character(pp
, ')');
1256 case OMP_CLAUSE_AUTO
:
1257 case OMP_CLAUSE_SEQ
:
1258 pp_string (pp
, omp_clause_code_name
[OMP_CLAUSE_CODE (clause
)]);
1261 case OMP_CLAUSE_WAIT
:
1262 pp_string (pp
, "wait(");
1263 dump_generic_node (pp
, OMP_CLAUSE_WAIT_EXPR (clause
),
1265 pp_character(pp
, ')');
1268 case OMP_CLAUSE_WORKER
:
1269 pp_string (pp
, "worker");
1270 if (OMP_CLAUSE_WORKER_EXPR (clause
) != NULL_TREE
)
1273 dump_generic_node (pp
, OMP_CLAUSE_WORKER_EXPR (clause
),
1275 pp_right_paren (pp
);
1279 case OMP_CLAUSE_VECTOR
:
1280 pp_string (pp
, "vector");
1281 if (OMP_CLAUSE_VECTOR_EXPR (clause
) != NULL_TREE
)
1284 dump_generic_node (pp
, OMP_CLAUSE_VECTOR_EXPR (clause
),
1286 pp_right_paren (pp
);
1290 case OMP_CLAUSE_NUM_GANGS
:
1291 pp_string (pp
, "num_gangs(");
1292 dump_generic_node (pp
, OMP_CLAUSE_NUM_GANGS_EXPR (clause
),
1294 pp_character (pp
, ')');
1297 case OMP_CLAUSE_NUM_WORKERS
:
1298 pp_string (pp
, "num_workers(");
1299 dump_generic_node (pp
, OMP_CLAUSE_NUM_WORKERS_EXPR (clause
),
1301 pp_character (pp
, ')');
1304 case OMP_CLAUSE_VECTOR_LENGTH
:
1305 pp_string (pp
, "vector_length(");
1306 dump_generic_node (pp
, OMP_CLAUSE_VECTOR_LENGTH_EXPR (clause
),
1308 pp_character (pp
, ')');
1311 case OMP_CLAUSE_INBRANCH
:
1312 pp_string (pp
, "inbranch");
1314 case OMP_CLAUSE_NOTINBRANCH
:
1315 pp_string (pp
, "notinbranch");
1317 case OMP_CLAUSE_FOR
:
1318 pp_string (pp
, "for");
1320 case OMP_CLAUSE_PARALLEL
:
1321 pp_string (pp
, "parallel");
1323 case OMP_CLAUSE_SECTIONS
:
1324 pp_string (pp
, "sections");
1326 case OMP_CLAUSE_TASKGROUP
:
1327 pp_string (pp
, "taskgroup");
1329 case OMP_CLAUSE_NOGROUP
:
1330 pp_string (pp
, "nogroup");
1332 case OMP_CLAUSE_THREADS
:
1333 pp_string (pp
, "threads");
1335 case OMP_CLAUSE_SIMD
:
1336 pp_string (pp
, "simd");
1338 case OMP_CLAUSE_INDEPENDENT
:
1339 pp_string (pp
, "independent");
1341 case OMP_CLAUSE_TILE
:
1342 pp_string (pp
, "tile(");
1343 dump_generic_node (pp
, OMP_CLAUSE_TILE_LIST (clause
),
1345 pp_right_paren (pp
);
1348 case OMP_CLAUSE_IF_PRESENT
:
1349 pp_string (pp
, "if_present");
1351 case OMP_CLAUSE_FINALIZE
:
1352 pp_string (pp
, "finalize");
1354 case OMP_CLAUSE_NOHOST
:
1355 pp_string (pp
, "nohost");
1357 case OMP_CLAUSE_DETACH
:
1358 pp_string (pp
, "detach(");
1359 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
), spc
, flags
,
1361 pp_right_paren (pp
);
1370 /* Dump chain of OMP clauses.
1372 PP, SPC and FLAGS are as in dump_generic_node. */
1375 dump_omp_clauses (pretty_printer
*pp
, tree clause
, int spc
, dump_flags_t flags
,
1382 dump_omp_clause (pp
, clause
, spc
, flags
);
1383 leading_space
= true;
1385 clause
= OMP_CLAUSE_CHAIN (clause
);
1390 /* Dump location LOC to PP. */
1393 dump_location (pretty_printer
*pp
, location_t loc
)
1395 expanded_location xloc
= expand_location (loc
);
1397 pp_left_bracket (pp
);
1400 pp_string (pp
, xloc
.file
);
1401 pp_string (pp
, ":");
1403 pp_decimal_int (pp
, xloc
.line
);
1405 pp_decimal_int (pp
, xloc
.column
);
1406 pp_string (pp
, "] ");
1410 /* Dump lexical block BLOCK. PP, SPC and FLAGS are as in
1411 dump_generic_node. */
1414 dump_block_node (pretty_printer
*pp
, tree block
, int spc
, dump_flags_t flags
)
1418 pp_string (pp
, "BLOCK #");
1419 pp_decimal_int (pp
, BLOCK_NUMBER (block
));
1420 pp_character (pp
, ' ');
1422 if (flags
& TDF_ADDRESS
)
1424 pp_character (pp
, '[');
1425 pp_scalar (pp
, "%p", (void *) block
);
1426 pp_string (pp
, "] ");
1429 if (TREE_ASM_WRITTEN (block
))
1430 pp_string (pp
, "[written] ");
1432 if (flags
& TDF_SLIM
)
1435 if (BLOCK_SOURCE_LOCATION (block
))
1436 dump_location (pp
, BLOCK_SOURCE_LOCATION (block
));
1438 newline_and_indent (pp
, spc
+ 2);
1440 if (BLOCK_SUPERCONTEXT (block
))
1442 pp_string (pp
, "SUPERCONTEXT: ");
1443 dump_generic_node (pp
, BLOCK_SUPERCONTEXT (block
), 0,
1444 flags
| TDF_SLIM
, false);
1445 newline_and_indent (pp
, spc
+ 2);
1448 if (BLOCK_SUBBLOCKS (block
))
1450 pp_string (pp
, "SUBBLOCKS: ");
1451 for (t
= BLOCK_SUBBLOCKS (block
); t
; t
= BLOCK_CHAIN (t
))
1453 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
1456 newline_and_indent (pp
, spc
+ 2);
1459 if (BLOCK_CHAIN (block
))
1461 pp_string (pp
, "SIBLINGS: ");
1462 for (t
= BLOCK_CHAIN (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_VARS (block
))
1472 pp_string (pp
, "VARS: ");
1473 for (t
= BLOCK_VARS (block
); t
; t
= TREE_CHAIN (t
))
1475 dump_generic_node (pp
, t
, 0, flags
, false);
1478 newline_and_indent (pp
, spc
+ 2);
1481 if (vec_safe_length (BLOCK_NONLOCALIZED_VARS (block
)) > 0)
1484 vec
<tree
, va_gc
> *nlv
= BLOCK_NONLOCALIZED_VARS (block
);
1486 pp_string (pp
, "NONLOCALIZED_VARS: ");
1487 FOR_EACH_VEC_ELT (*nlv
, i
, t
)
1489 dump_generic_node (pp
, t
, 0, flags
, false);
1492 newline_and_indent (pp
, spc
+ 2);
1495 if (BLOCK_ABSTRACT_ORIGIN (block
))
1497 pp_string (pp
, "ABSTRACT_ORIGIN: ");
1498 dump_generic_node (pp
, BLOCK_ABSTRACT_ORIGIN (block
), 0,
1499 flags
| TDF_SLIM
, false);
1500 newline_and_indent (pp
, spc
+ 2);
1503 if (BLOCK_FRAGMENT_ORIGIN (block
))
1505 pp_string (pp
, "FRAGMENT_ORIGIN: ");
1506 dump_generic_node (pp
, BLOCK_FRAGMENT_ORIGIN (block
), 0,
1507 flags
| TDF_SLIM
, false);
1508 newline_and_indent (pp
, spc
+ 2);
1511 if (BLOCK_FRAGMENT_CHAIN (block
))
1513 pp_string (pp
, "FRAGMENT_CHAIN: ");
1514 for (t
= BLOCK_FRAGMENT_CHAIN (block
); t
; t
= BLOCK_FRAGMENT_CHAIN (t
))
1516 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
1519 newline_and_indent (pp
, spc
+ 2);
1523 /* Dump #pragma omp atomic memory order clause. */
1526 dump_omp_atomic_memory_order (pretty_printer
*pp
, enum omp_memory_order mo
)
1528 switch (mo
& OMP_MEMORY_ORDER_MASK
)
1530 case OMP_MEMORY_ORDER_RELAXED
:
1531 pp_string (pp
, " relaxed");
1533 case OMP_MEMORY_ORDER_SEQ_CST
:
1534 pp_string (pp
, " seq_cst");
1536 case OMP_MEMORY_ORDER_ACQ_REL
:
1537 pp_string (pp
, " acq_rel");
1539 case OMP_MEMORY_ORDER_ACQUIRE
:
1540 pp_string (pp
, " acquire");
1542 case OMP_MEMORY_ORDER_RELEASE
:
1543 pp_string (pp
, " release");
1545 case OMP_MEMORY_ORDER_UNSPECIFIED
:
1550 switch (mo
& OMP_FAIL_MEMORY_ORDER_MASK
)
1552 case OMP_FAIL_MEMORY_ORDER_RELAXED
:
1553 pp_string (pp
, " fail(relaxed)");
1555 case OMP_FAIL_MEMORY_ORDER_SEQ_CST
:
1556 pp_string (pp
, " fail(seq_cst)");
1558 case OMP_FAIL_MEMORY_ORDER_ACQUIRE
:
1559 pp_string (pp
, " fail(acquire)");
1561 case OMP_FAIL_MEMORY_ORDER_UNSPECIFIED
:
1568 /* Helper to dump a MEM_REF node. */
1571 dump_mem_ref (pretty_printer
*pp
, tree node
, int spc
, dump_flags_t flags
)
1573 if (TREE_CODE (node
) == MEM_REF
&& (flags
& TDF_GIMPLE
))
1575 pp_string (pp
, "__MEM <");
1576 dump_generic_node (pp
, TREE_TYPE (node
),
1577 spc
, flags
| TDF_SLIM
, false);
1578 if (TYPE_ALIGN (TREE_TYPE (node
))
1579 != TYPE_ALIGN (TYPE_MAIN_VARIANT (TREE_TYPE (node
))))
1581 pp_string (pp
, ", ");
1582 pp_decimal_int (pp
, TYPE_ALIGN (TREE_TYPE (node
)));
1585 pp_string (pp
, " (");
1586 if (TREE_TYPE (TREE_OPERAND (node
, 0))
1587 != TREE_TYPE (TREE_OPERAND (node
, 1)))
1590 dump_generic_node (pp
, TREE_TYPE (TREE_OPERAND (node
, 1)),
1591 spc
, flags
| TDF_SLIM
, false);
1592 pp_right_paren (pp
);
1594 dump_generic_node (pp
, TREE_OPERAND (node
, 0),
1595 spc
, flags
| TDF_SLIM
, false);
1596 if (! integer_zerop (TREE_OPERAND (node
, 1)))
1598 pp_string (pp
, " + ");
1599 dump_generic_node (pp
, TREE_OPERAND (node
, 1),
1600 spc
, flags
| TDF_SLIM
, false);
1602 pp_right_paren (pp
);
1604 else if (TREE_CODE (node
) == MEM_REF
1605 && integer_zerop (TREE_OPERAND (node
, 1))
1606 /* Dump the types of INTEGER_CSTs explicitly, for we can't
1607 infer them and MEM_ATTR caching will share MEM_REFs
1608 with differently-typed op0s. */
1609 && TREE_CODE (TREE_OPERAND (node
, 0)) != INTEGER_CST
1610 /* Released SSA_NAMES have no TREE_TYPE. */
1611 && TREE_TYPE (TREE_OPERAND (node
, 0)) != NULL_TREE
1612 /* Same pointer types, but ignoring POINTER_TYPE vs.
1614 && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 0)))
1615 == TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 1))))
1616 && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (node
, 0)))
1617 == TYPE_MODE (TREE_TYPE (TREE_OPERAND (node
, 1))))
1618 && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node
, 0)))
1619 == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node
, 1))))
1620 /* Same value types ignoring qualifiers. */
1621 && (TYPE_MAIN_VARIANT (TREE_TYPE (node
))
1622 == TYPE_MAIN_VARIANT
1623 (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 1)))))
1624 && (!(flags
& TDF_ALIAS
)
1625 || MR_DEPENDENCE_CLIQUE (node
) == 0))
1627 if (TREE_CODE (TREE_OPERAND (node
, 0)) != ADDR_EXPR
)
1629 /* Enclose pointers to arrays in parentheses. */
1630 tree op0
= TREE_OPERAND (node
, 0);
1631 tree op0type
= TREE_TYPE (op0
);
1632 if (POINTER_TYPE_P (op0type
)
1633 && TREE_CODE (TREE_TYPE (op0type
)) == ARRAY_TYPE
)
1636 dump_generic_node (pp
, op0
, spc
, flags
, false);
1637 if (POINTER_TYPE_P (op0type
)
1638 && TREE_CODE (TREE_TYPE (op0type
)) == ARRAY_TYPE
)
1639 pp_right_paren (pp
);
1642 dump_generic_node (pp
,
1643 TREE_OPERAND (TREE_OPERAND (node
, 0), 0),
1648 pp_string (pp
, "MEM");
1650 tree nodetype
= TREE_TYPE (node
);
1651 tree op0
= TREE_OPERAND (node
, 0);
1652 tree op1
= TREE_OPERAND (node
, 1);
1653 tree op1type
= TYPE_MAIN_VARIANT (TREE_TYPE (op1
));
1655 tree op0size
= TYPE_SIZE (nodetype
);
1656 tree op1size
= TYPE_SIZE (TREE_TYPE (op1type
));
1658 if (!op0size
|| !op1size
1659 || !operand_equal_p (op0size
, op1size
, 0))
1661 pp_string (pp
, " <");
1662 /* If the size of the type of the operand is not the same
1663 as the size of the MEM_REF expression include the type
1664 of the latter similar to the TDF_GIMPLE output to make
1665 it clear how many bytes of memory are being accessed. */
1666 dump_generic_node (pp
, nodetype
, spc
, flags
| TDF_SLIM
, false);
1667 pp_string (pp
, "> ");
1670 pp_string (pp
, "[(");
1671 dump_generic_node (pp
, op1type
, spc
, flags
| TDF_SLIM
, false);
1672 pp_right_paren (pp
);
1673 dump_generic_node (pp
, op0
, spc
, flags
, false);
1674 if (!integer_zerop (op1
))
1676 pp_string (pp
, " + ");
1677 dump_generic_node (pp
, op1
, spc
, flags
, false);
1679 if (TREE_CODE (node
) == TARGET_MEM_REF
)
1681 tree tmp
= TMR_INDEX2 (node
);
1684 pp_string (pp
, " + ");
1685 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1687 tmp
= TMR_INDEX (node
);
1690 pp_string (pp
, " + ");
1691 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1692 tmp
= TMR_STEP (node
);
1693 pp_string (pp
, " * ");
1695 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1697 pp_string (pp
, "1");
1700 if ((flags
& TDF_ALIAS
)
1701 && MR_DEPENDENCE_CLIQUE (node
) != 0)
1703 pp_string (pp
, " clique ");
1704 pp_unsigned_wide_integer (pp
, MR_DEPENDENCE_CLIQUE (node
));
1705 pp_string (pp
, " base ");
1706 pp_unsigned_wide_integer (pp
, MR_DEPENDENCE_BASE (node
));
1708 pp_right_bracket (pp
);
1712 /* Helper function for dump_generic_node. Dump INIT or COND expression for
1713 OpenMP loop non-rectangular iterators. */
1716 dump_omp_loop_non_rect_expr (pretty_printer
*pp
, tree node
, int spc
,
1719 gcc_assert (TREE_CODE (node
) == TREE_VEC
);
1720 dump_generic_node (pp
, TREE_VEC_ELT (node
, 0), spc
, flags
, false);
1721 pp_string (pp
, " * ");
1722 if (op_prio (TREE_VEC_ELT (node
, 1)) <= op_code_prio (MULT_EXPR
))
1725 dump_generic_node (pp
, TREE_VEC_ELT (node
, 1), spc
, flags
, false);
1726 pp_right_paren (pp
);
1729 dump_generic_node (pp
, TREE_VEC_ELT (node
, 1), spc
, flags
, false);
1730 pp_string (pp
, " + ");
1731 if (op_prio (TREE_VEC_ELT (node
, 1)) <= op_code_prio (PLUS_EXPR
))
1734 dump_generic_node (pp
, TREE_VEC_ELT (node
, 2), spc
, flags
, false);
1735 pp_right_paren (pp
);
1738 dump_generic_node (pp
, TREE_VEC_ELT (node
, 2), spc
, flags
, false);
1741 /* Dump the node NODE on the pretty_printer PP, SPC spaces of
1742 indent. FLAGS specifies details to show in the dump (see TDF_* in
1743 dumpfile.h). If IS_STMT is true, the object printed is considered
1744 to be a statement and it is terminated by ';' if appropriate. */
1747 dump_generic_node (pretty_printer
*pp
, tree node
, int spc
, dump_flags_t flags
,
1754 enum tree_code code
;
1756 if (node
== NULL_TREE
)
1759 is_expr
= EXPR_P (node
);
1761 if (is_stmt
&& (flags
& TDF_STMTADDR
))
1763 pp_string (pp
, "<&");
1764 pp_scalar (pp
, "%p", (void *)node
);
1765 pp_string (pp
, "> ");
1768 if ((flags
& TDF_LINENO
) && EXPR_HAS_LOCATION (node
))
1769 dump_location (pp
, EXPR_LOCATION (node
));
1771 code
= TREE_CODE (node
);
1775 pp_string (pp
, "<<< error >>>");
1778 case IDENTIFIER_NODE
:
1779 pp_tree_identifier (pp
, node
);
1783 while (node
&& node
!= error_mark_node
)
1785 if (TREE_PURPOSE (node
))
1787 dump_generic_node (pp
, TREE_PURPOSE (node
), spc
, flags
, false);
1790 dump_generic_node (pp
, TREE_VALUE (node
), spc
, flags
, false);
1791 node
= TREE_CHAIN (node
);
1792 if (node
&& TREE_CODE (node
) == TREE_LIST
)
1801 dump_generic_node (pp
, BINFO_TYPE (node
), spc
, flags
, false);
1807 if (TREE_VEC_LENGTH (node
) > 0)
1809 size_t len
= TREE_VEC_LENGTH (node
);
1810 for (i
= 0; i
< len
- 1; i
++)
1812 dump_generic_node (pp
, TREE_VEC_ELT (node
, i
), spc
, flags
,
1817 dump_generic_node (pp
, TREE_VEC_ELT (node
, len
- 1), spc
,
1826 case FIXED_POINT_TYPE
:
1833 unsigned int quals
= TYPE_QUALS (node
);
1834 enum tree_code_class tclass
;
1836 if (quals
& TYPE_QUAL_ATOMIC
)
1837 pp_string (pp
, "atomic ");
1838 if (quals
& TYPE_QUAL_CONST
)
1839 pp_string (pp
, "const ");
1840 if (quals
& TYPE_QUAL_VOLATILE
)
1841 pp_string (pp
, "volatile ");
1842 if (quals
& TYPE_QUAL_RESTRICT
)
1843 pp_string (pp
, "restrict ");
1845 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
1847 pp_string (pp
, "<address-space-");
1848 pp_decimal_int (pp
, TYPE_ADDR_SPACE (node
));
1849 pp_string (pp
, "> ");
1852 tclass
= TREE_CODE_CLASS (TREE_CODE (node
));
1854 if (tclass
== tcc_declaration
)
1856 if (DECL_NAME (node
))
1857 dump_decl_name (pp
, node
, flags
);
1859 pp_string (pp
, "<unnamed type decl>");
1861 else if (tclass
== tcc_type
)
1863 if (TYPE_NAME (node
))
1865 if (TREE_CODE (TYPE_NAME (node
)) == IDENTIFIER_NODE
)
1866 pp_tree_identifier (pp
, TYPE_NAME (node
));
1867 else if (TREE_CODE (TYPE_NAME (node
)) == TYPE_DECL
1868 && DECL_NAME (TYPE_NAME (node
)))
1869 dump_decl_name (pp
, TYPE_NAME (node
), flags
);
1871 pp_string (pp
, "<unnamed type>");
1873 else if (TREE_CODE (node
) == VECTOR_TYPE
)
1875 pp_string (pp
, "vector");
1877 pp_wide_integer (pp
, TYPE_VECTOR_SUBPARTS (node
));
1878 pp_string (pp
, ") ");
1879 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1881 else if (TREE_CODE (node
) == INTEGER_TYPE
)
1883 if (TYPE_PRECISION (node
) == CHAR_TYPE_SIZE
)
1884 pp_string (pp
, (TYPE_UNSIGNED (node
)
1887 else if (TYPE_PRECISION (node
) == SHORT_TYPE_SIZE
)
1888 pp_string (pp
, (TYPE_UNSIGNED (node
)
1891 else if (TYPE_PRECISION (node
) == INT_TYPE_SIZE
)
1892 pp_string (pp
, (TYPE_UNSIGNED (node
)
1895 else if (TYPE_PRECISION (node
) == LONG_TYPE_SIZE
)
1896 pp_string (pp
, (TYPE_UNSIGNED (node
)
1899 else if (TYPE_PRECISION (node
) == LONG_LONG_TYPE_SIZE
)
1900 pp_string (pp
, (TYPE_UNSIGNED (node
)
1901 ? "unsigned long long"
1902 : "signed long long"));
1903 else if (TYPE_PRECISION (node
) >= CHAR_TYPE_SIZE
1904 && pow2p_hwi (TYPE_PRECISION (node
)))
1906 pp_string (pp
, (TYPE_UNSIGNED (node
) ? "uint" : "int"));
1907 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1908 pp_string (pp
, "_t");
1912 pp_string (pp
, (TYPE_UNSIGNED (node
)
1913 ? "<unnamed-unsigned:"
1914 : "<unnamed-signed:"));
1915 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1919 else if (TREE_CODE (node
) == COMPLEX_TYPE
)
1921 pp_string (pp
, "__complex__ ");
1922 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1924 else if (TREE_CODE (node
) == REAL_TYPE
)
1926 pp_string (pp
, "<float:");
1927 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1930 else if (TREE_CODE (node
) == FIXED_POINT_TYPE
)
1932 pp_string (pp
, "<fixed-point-");
1933 pp_string (pp
, TYPE_SATURATING (node
) ? "sat:" : "nonsat:");
1934 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1937 else if (TREE_CODE (node
) == BOOLEAN_TYPE
)
1939 pp_string (pp
, (TYPE_UNSIGNED (node
)
1940 ? "<unsigned-boolean:"
1941 : "<signed-boolean:"));
1942 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1945 else if (TREE_CODE (node
) == VOID_TYPE
)
1946 pp_string (pp
, "void");
1948 pp_string (pp
, "<unnamed type>");
1954 case REFERENCE_TYPE
:
1955 str
= (TREE_CODE (node
) == POINTER_TYPE
? "*" : "&");
1957 if (TREE_TYPE (node
) == NULL
)
1959 pp_string (pp
, str
);
1960 pp_string (pp
, "<null type>");
1962 else if (TREE_CODE (TREE_TYPE (node
)) == FUNCTION_TYPE
)
1964 tree fnode
= TREE_TYPE (node
);
1966 dump_generic_node (pp
, TREE_TYPE (fnode
), spc
, flags
, false);
1969 pp_string (pp
, str
);
1970 if (TYPE_IDENTIFIER (node
))
1971 dump_generic_node (pp
, TYPE_NAME (node
), spc
, flags
, false);
1972 else if (flags
& TDF_NOUID
)
1973 pp_string (pp
, "<Txxxx>");
1976 pp_string (pp
, "<T");
1977 pp_scalar (pp
, "%x", TYPE_UID (node
));
1978 pp_character (pp
, '>');
1981 pp_right_paren (pp
);
1982 dump_function_declaration (pp
, fnode
, spc
, flags
);
1986 unsigned int quals
= TYPE_QUALS (node
);
1988 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1990 pp_string (pp
, str
);
1992 if (quals
& TYPE_QUAL_CONST
)
1993 pp_string (pp
, " const");
1994 if (quals
& TYPE_QUAL_VOLATILE
)
1995 pp_string (pp
, " volatile");
1996 if (quals
& TYPE_QUAL_RESTRICT
)
1997 pp_string (pp
, " restrict");
1999 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
2001 pp_string (pp
, " <address-space-");
2002 pp_decimal_int (pp
, TYPE_ADDR_SPACE (node
));
2006 if (TYPE_REF_CAN_ALIAS_ALL (node
))
2007 pp_string (pp
, " {ref-all}");
2016 case TARGET_MEM_REF
:
2017 dump_mem_ref (pp
, node
, spc
, flags
);
2022 unsigned int quals
= TYPE_QUALS (node
);
2025 if (quals
& TYPE_QUAL_ATOMIC
)
2026 pp_string (pp
, "atomic ");
2027 if (quals
& TYPE_QUAL_CONST
)
2028 pp_string (pp
, "const ");
2029 if (quals
& TYPE_QUAL_VOLATILE
)
2030 pp_string (pp
, "volatile ");
2032 /* Print the innermost component type. */
2033 for (tmp
= TREE_TYPE (node
); TREE_CODE (tmp
) == ARRAY_TYPE
;
2034 tmp
= TREE_TYPE (tmp
))
2036 dump_generic_node (pp
, tmp
, spc
, flags
, false);
2038 /* Print the dimensions. */
2039 for (tmp
= node
; TREE_CODE (tmp
) == ARRAY_TYPE
; tmp
= TREE_TYPE (tmp
))
2040 dump_array_domain (pp
, TYPE_DOMAIN (tmp
), spc
, flags
);
2046 case QUAL_UNION_TYPE
:
2048 unsigned int quals
= TYPE_QUALS (node
);
2050 if (quals
& TYPE_QUAL_ATOMIC
)
2051 pp_string (pp
, "atomic ");
2052 if (quals
& TYPE_QUAL_CONST
)
2053 pp_string (pp
, "const ");
2054 if (quals
& TYPE_QUAL_VOLATILE
)
2055 pp_string (pp
, "volatile ");
2057 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
2059 pp_string (pp
, "<address-space-");
2060 pp_decimal_int (pp
, TYPE_ADDR_SPACE (node
));
2061 pp_string (pp
, "> ");
2064 /* Print the name of the structure. */
2065 if (TREE_CODE (node
) == RECORD_TYPE
)
2066 pp_string (pp
, "struct ");
2067 else if (TREE_CODE (node
) == UNION_TYPE
)
2068 pp_string (pp
, "union ");
2070 if (TYPE_NAME (node
))
2071 dump_generic_node (pp
, TYPE_NAME (node
), spc
, flags
, false);
2072 else if (!(flags
& TDF_SLIM
))
2073 /* FIXME: If we eliminate the 'else' above and attempt
2074 to show the fields for named types, we may get stuck
2075 following a cycle of pointers to structs. The alleged
2076 self-reference check in print_struct_decl will not detect
2077 cycles involving more than one pointer or struct type. */
2078 print_struct_decl (pp
, node
, spc
, flags
);
2087 if (flags
& TDF_GIMPLE
2088 && (POINTER_TYPE_P (TREE_TYPE (node
))
2089 || (TYPE_PRECISION (TREE_TYPE (node
))
2090 < TYPE_PRECISION (integer_type_node
))
2091 || exact_log2 (TYPE_PRECISION (TREE_TYPE (node
))) == -1
2092 || tree_int_cst_sgn (node
) < 0))
2094 pp_string (pp
, "_Literal (");
2095 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2096 pp_string (pp
, ") ");
2098 if (TREE_CODE (TREE_TYPE (node
)) == POINTER_TYPE
2099 && ! (flags
& TDF_GIMPLE
))
2101 /* In the case of a pointer, one may want to divide by the
2102 size of the pointed-to type. Unfortunately, this not
2103 straightforward. The C front-end maps expressions
2108 in such a way that the two INTEGER_CST nodes for "5" have
2109 different values but identical types. In the latter
2110 case, the 5 is multiplied by sizeof (int) in c-common.c
2111 (pointer_int_sum) to convert it to a byte address, and
2112 yet the type of the node is left unchanged. Argh. What
2113 is consistent though is that the number value corresponds
2114 to bytes (UNITS) offset.
2116 NB: Neither of the following divisors can be trivially
2117 used to recover the original literal:
2119 TREE_INT_CST_LOW (TYPE_SIZE_UNIT (TREE_TYPE (node)))
2120 TYPE_PRECISION (TREE_TYPE (TREE_TYPE (node))) */
2121 pp_wide_integer (pp
, TREE_INT_CST_LOW (node
));
2122 pp_string (pp
, "B"); /* pseudo-unit */
2124 else if (tree_fits_shwi_p (node
))
2125 pp_wide_integer (pp
, tree_to_shwi (node
));
2126 else if (tree_fits_uhwi_p (node
))
2127 pp_unsigned_wide_integer (pp
, tree_to_uhwi (node
));
2130 wide_int val
= wi::to_wide (node
);
2132 if (wi::neg_p (val
, TYPE_SIGN (TREE_TYPE (node
))))
2137 print_hex (val
, pp_buffer (pp
)->digit_buffer
);
2138 pp_string (pp
, pp_buffer (pp
)->digit_buffer
);
2140 if ((flags
& TDF_GIMPLE
)
2141 && ! (POINTER_TYPE_P (TREE_TYPE (node
))
2142 || (TYPE_PRECISION (TREE_TYPE (node
))
2143 < TYPE_PRECISION (integer_type_node
))
2144 || exact_log2 (TYPE_PRECISION (TREE_TYPE (node
))) == -1))
2146 if (TYPE_UNSIGNED (TREE_TYPE (node
)))
2147 pp_character (pp
, 'u');
2148 if (TYPE_PRECISION (TREE_TYPE (node
))
2149 == TYPE_PRECISION (unsigned_type_node
))
2151 else if (TYPE_PRECISION (TREE_TYPE (node
))
2152 == TYPE_PRECISION (long_unsigned_type_node
))
2153 pp_character (pp
, 'l');
2154 else if (TYPE_PRECISION (TREE_TYPE (node
))
2155 == TYPE_PRECISION (long_long_unsigned_type_node
))
2156 pp_string (pp
, "ll");
2158 if (TREE_OVERFLOW (node
))
2159 pp_string (pp
, "(OVF)");
2163 pp_string (pp
, "POLY_INT_CST [");
2164 dump_generic_node (pp
, POLY_INT_CST_COEFF (node
, 0), spc
, flags
, false);
2165 for (unsigned int i
= 1; i
< NUM_POLY_INT_COEFFS
; ++i
)
2167 pp_string (pp
, ", ");
2168 dump_generic_node (pp
, POLY_INT_CST_COEFF (node
, i
),
2171 pp_string (pp
, "]");
2175 /* Code copied from print_node. */
2178 if (TREE_OVERFLOW (node
))
2179 pp_string (pp
, " overflow");
2181 d
= TREE_REAL_CST (node
);
2182 if (REAL_VALUE_ISINF (d
))
2183 pp_string (pp
, REAL_VALUE_NEGATIVE (d
) ? " -Inf" : " Inf");
2184 else if (REAL_VALUE_ISNAN (d
))
2185 pp_string (pp
, " Nan");
2189 real_to_decimal (string
, &d
, sizeof (string
), 0, 1);
2190 pp_string (pp
, string
);
2198 fixed_to_decimal (string
, TREE_FIXED_CST_PTR (node
), sizeof (string
));
2199 pp_string (pp
, string
);
2204 pp_string (pp
, "__complex__ (");
2205 dump_generic_node (pp
, TREE_REALPART (node
), spc
, flags
, false);
2206 pp_string (pp
, ", ");
2207 dump_generic_node (pp
, TREE_IMAGPART (node
), spc
, flags
, false);
2208 pp_right_paren (pp
);
2213 pp_string (pp
, "\"");
2214 if (unsigned nbytes
= TREE_STRING_LENGTH (node
))
2215 pretty_print_string (pp
, TREE_STRING_POINTER (node
), nbytes
);
2216 pp_string (pp
, "\"");
2223 if (flags
& TDF_GIMPLE
)
2225 pp_string (pp
, "_Literal (");
2226 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2227 pp_string (pp
, ") ");
2229 pp_string (pp
, "{ ");
2230 unsigned HOST_WIDE_INT nunits
;
2231 if (!VECTOR_CST_NELTS (node
).is_constant (&nunits
))
2232 nunits
= vector_cst_encoded_nelts (node
);
2233 for (i
= 0; i
< nunits
; ++i
)
2236 pp_string (pp
, ", ");
2237 dump_generic_node (pp
, VECTOR_CST_ELT (node
, i
),
2240 if (!VECTOR_CST_NELTS (node
).is_constant ())
2241 pp_string (pp
, ", ...");
2242 pp_string (pp
, " }");
2248 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2250 if (TREE_CODE (node
) == METHOD_TYPE
)
2252 if (TYPE_METHOD_BASETYPE (node
))
2253 dump_generic_node (pp
, TYPE_NAME (TYPE_METHOD_BASETYPE (node
)),
2256 pp_string (pp
, "<null method basetype>");
2257 pp_colon_colon (pp
);
2259 if (TYPE_IDENTIFIER (node
))
2260 dump_generic_node (pp
, TYPE_NAME (node
), spc
, flags
, false);
2261 else if (TYPE_NAME (node
) && DECL_NAME (TYPE_NAME (node
)))
2262 dump_decl_name (pp
, TYPE_NAME (node
), flags
);
2263 else if (flags
& TDF_NOUID
)
2264 pp_string (pp
, "<Txxxx>");
2267 pp_string (pp
, "<T");
2268 pp_scalar (pp
, "%x", TYPE_UID (node
));
2269 pp_character (pp
, '>');
2271 dump_function_declaration (pp
, node
, spc
, flags
);
2276 dump_decl_name (pp
, node
, flags
);
2280 if (DECL_NAME (node
))
2281 dump_decl_name (pp
, node
, flags
);
2282 else if (LABEL_DECL_UID (node
) != -1)
2284 if (flags
& TDF_GIMPLE
)
2286 pp_character (pp
, 'L');
2287 pp_decimal_int (pp
, (int) LABEL_DECL_UID (node
));
2291 pp_string (pp
, "<L");
2292 pp_decimal_int (pp
, (int) LABEL_DECL_UID (node
));
2293 pp_character (pp
, '>');
2298 if (flags
& TDF_NOUID
)
2299 pp_string (pp
, "<D.xxxx>");
2302 if (flags
& TDF_GIMPLE
)
2304 pp_character (pp
, 'D');
2305 pp_scalar (pp
, "%u", DECL_UID (node
));
2309 pp_string (pp
, "<D.");
2310 pp_scalar (pp
, "%u", DECL_UID (node
));
2311 pp_character (pp
, '>');
2318 if (DECL_IS_UNDECLARED_BUILTIN (node
))
2320 /* Don't print the declaration of built-in types. */
2323 if (DECL_NAME (node
))
2324 dump_decl_name (pp
, node
, flags
);
2325 else if (TYPE_NAME (TREE_TYPE (node
)) != node
)
2327 pp_string (pp
, (TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
2328 ? "union" : "struct "));
2329 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2332 pp_string (pp
, "<anon>");
2338 case DEBUG_EXPR_DECL
:
2339 case NAMESPACE_DECL
:
2341 dump_decl_name (pp
, node
, flags
);
2345 pp_string (pp
, "<retval>");
2349 op0
= TREE_OPERAND (node
, 0);
2352 && (TREE_CODE (op0
) == INDIRECT_REF
2353 || (TREE_CODE (op0
) == MEM_REF
2354 && TREE_CODE (TREE_OPERAND (op0
, 0)) != ADDR_EXPR
2355 && integer_zerop (TREE_OPERAND (op0
, 1))
2356 /* Dump the types of INTEGER_CSTs explicitly, for we
2357 can't infer them and MEM_ATTR caching will share
2358 MEM_REFs with differently-typed op0s. */
2359 && TREE_CODE (TREE_OPERAND (op0
, 0)) != INTEGER_CST
2360 /* Released SSA_NAMES have no TREE_TYPE. */
2361 && TREE_TYPE (TREE_OPERAND (op0
, 0)) != NULL_TREE
2362 /* Same pointer types, but ignoring POINTER_TYPE vs.
2364 && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 0)))
2365 == TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 1))))
2366 && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0
, 0)))
2367 == TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0
, 1))))
2368 && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0
, 0)))
2369 == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0
, 1))))
2370 /* Same value types ignoring qualifiers. */
2371 && (TYPE_MAIN_VARIANT (TREE_TYPE (op0
))
2372 == TYPE_MAIN_VARIANT
2373 (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 1)))))
2374 && MR_DEPENDENCE_CLIQUE (op0
) == 0)))
2376 op0
= TREE_OPERAND (op0
, 0);
2379 if (op_prio (op0
) < op_prio (node
))
2381 dump_generic_node (pp
, op0
, spc
, flags
, false);
2382 if (op_prio (op0
) < op_prio (node
))
2383 pp_right_paren (pp
);
2384 pp_string (pp
, str
);
2385 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2386 op0
= component_ref_field_offset (node
);
2387 if (op0
&& TREE_CODE (op0
) != INTEGER_CST
)
2389 pp_string (pp
, "{off: ");
2390 dump_generic_node (pp
, op0
, spc
, flags
, false);
2391 pp_right_brace (pp
);
2396 if (flags
& TDF_GIMPLE
)
2398 pp_string (pp
, "__BIT_FIELD_REF <");
2399 dump_generic_node (pp
, TREE_TYPE (node
),
2400 spc
, flags
| TDF_SLIM
, false);
2401 if (TYPE_ALIGN (TREE_TYPE (node
))
2402 != TYPE_ALIGN (TYPE_MAIN_VARIANT (TREE_TYPE (node
))))
2404 pp_string (pp
, ", ");
2405 pp_decimal_int (pp
, TYPE_ALIGN (TREE_TYPE (node
)));
2408 pp_string (pp
, " (");
2409 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
,
2410 flags
| TDF_SLIM
, false);
2411 pp_string (pp
, ", ");
2412 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
,
2413 flags
| TDF_SLIM
, false);
2414 pp_string (pp
, ", ");
2415 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
,
2416 flags
| TDF_SLIM
, false);
2417 pp_right_paren (pp
);
2421 pp_string (pp
, "BIT_FIELD_REF <");
2422 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2423 pp_string (pp
, ", ");
2424 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2425 pp_string (pp
, ", ");
2426 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2431 case BIT_INSERT_EXPR
:
2432 pp_string (pp
, "BIT_INSERT_EXPR <");
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);
2438 pp_string (pp
, " (");
2439 if (INTEGRAL_TYPE_P (TREE_TYPE (TREE_OPERAND (node
, 1))))
2441 TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (node
, 1))));
2443 dump_generic_node (pp
, TYPE_SIZE (TREE_TYPE (TREE_OPERAND (node
, 1))),
2445 pp_string (pp
, " bits)>");
2449 case ARRAY_RANGE_REF
:
2450 op0
= TREE_OPERAND (node
, 0);
2451 if (op_prio (op0
) < op_prio (node
))
2453 dump_generic_node (pp
, op0
, spc
, flags
, false);
2454 if (op_prio (op0
) < op_prio (node
))
2455 pp_right_paren (pp
);
2456 pp_left_bracket (pp
);
2457 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2458 if (TREE_CODE (node
) == ARRAY_RANGE_REF
)
2459 pp_string (pp
, " ...");
2460 pp_right_bracket (pp
);
2462 op0
= array_ref_low_bound (node
);
2463 op1
= array_ref_element_size (node
);
2465 if (!integer_zerop (op0
)
2466 || TREE_OPERAND (node
, 2)
2467 || TREE_OPERAND (node
, 3))
2469 pp_string (pp
, "{lb: ");
2470 dump_generic_node (pp
, op0
, spc
, flags
, false);
2471 pp_string (pp
, " sz: ");
2472 dump_generic_node (pp
, op1
, spc
, flags
, false);
2473 pp_right_brace (pp
);
2479 unsigned HOST_WIDE_INT ix
;
2481 bool is_struct_init
= false;
2482 bool is_array_init
= false;
2484 if (flags
& TDF_GIMPLE
)
2486 pp_string (pp
, "_Literal (");
2487 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2488 pp_string (pp
, ") ");
2491 if (TREE_CLOBBER_P (node
))
2492 pp_string (pp
, "CLOBBER");
2493 else if (TREE_CODE (TREE_TYPE (node
)) == RECORD_TYPE
2494 || TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
)
2495 is_struct_init
= true;
2496 else if (TREE_CODE (TREE_TYPE (node
)) == ARRAY_TYPE
2497 && TYPE_DOMAIN (TREE_TYPE (node
))
2498 && TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
)))
2499 && TREE_CODE (TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
))))
2502 tree minv
= TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
)));
2503 is_array_init
= true;
2504 curidx
= wi::to_widest (minv
);
2506 FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (node
), ix
, field
, val
)
2513 dump_generic_node (pp
, field
, spc
, flags
, false);
2516 else if (is_array_init
2517 && (TREE_CODE (field
) != INTEGER_CST
2518 || curidx
!= wi::to_widest (field
)))
2520 pp_left_bracket (pp
);
2521 if (TREE_CODE (field
) == RANGE_EXPR
)
2523 dump_generic_node (pp
, TREE_OPERAND (field
, 0), spc
,
2525 pp_string (pp
, " ... ");
2526 dump_generic_node (pp
, TREE_OPERAND (field
, 1), spc
,
2528 if (TREE_CODE (TREE_OPERAND (field
, 1)) == INTEGER_CST
)
2529 curidx
= wi::to_widest (TREE_OPERAND (field
, 1));
2532 dump_generic_node (pp
, field
, spc
, flags
, false);
2533 if (TREE_CODE (field
) == INTEGER_CST
)
2534 curidx
= wi::to_widest (field
);
2535 pp_string (pp
, "]=");
2540 if (val
&& TREE_CODE (val
) == ADDR_EXPR
)
2541 if (TREE_CODE (TREE_OPERAND (val
, 0)) == FUNCTION_DECL
)
2542 val
= TREE_OPERAND (val
, 0);
2543 if (val
&& TREE_CODE (val
) == FUNCTION_DECL
)
2544 dump_decl_name (pp
, val
, flags
);
2546 dump_generic_node (pp
, val
, spc
, flags
, false);
2547 if (ix
!= CONSTRUCTOR_NELTS (node
) - 1)
2553 pp_right_brace (pp
);
2560 if (flags
& TDF_SLIM
)
2562 pp_string (pp
, "<COMPOUND_EXPR>");
2566 dump_generic_node (pp
, TREE_OPERAND (node
, 0),
2567 spc
, flags
, !(flags
& TDF_SLIM
));
2568 if (flags
& TDF_SLIM
)
2569 newline_and_indent (pp
, spc
);
2576 for (tp
= &TREE_OPERAND (node
, 1);
2577 TREE_CODE (*tp
) == COMPOUND_EXPR
;
2578 tp
= &TREE_OPERAND (*tp
, 1))
2580 dump_generic_node (pp
, TREE_OPERAND (*tp
, 0),
2581 spc
, flags
, !(flags
& TDF_SLIM
));
2582 if (flags
& TDF_SLIM
)
2583 newline_and_indent (pp
, spc
);
2591 dump_generic_node (pp
, *tp
, spc
, flags
, !(flags
& TDF_SLIM
));
2595 case STATEMENT_LIST
:
2597 tree_stmt_iterator si
;
2600 if (flags
& TDF_SLIM
)
2602 pp_string (pp
, "<STATEMENT_LIST>");
2606 for (si
= tsi_start (node
); !tsi_end_p (si
); tsi_next (&si
))
2609 newline_and_indent (pp
, spc
);
2612 dump_generic_node (pp
, tsi_stmt (si
), spc
, flags
, true);
2619 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
,
2624 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
,
2629 pp_string (pp
, "TARGET_EXPR <");
2630 dump_generic_node (pp
, TARGET_EXPR_SLOT (node
), spc
, flags
, false);
2633 dump_generic_node (pp
, TARGET_EXPR_INITIAL (node
), spc
, flags
, false);
2638 print_declaration (pp
, DECL_EXPR_DECL (node
), spc
, flags
);
2643 if (TREE_TYPE (node
) == NULL
|| TREE_TYPE (node
) == void_type_node
)
2645 pp_string (pp
, "if (");
2646 dump_generic_node (pp
, COND_EXPR_COND (node
), spc
, flags
, false);
2647 pp_right_paren (pp
);
2648 /* The lowered cond_exprs should always be printed in full. */
2649 if (COND_EXPR_THEN (node
)
2650 && (IS_EMPTY_STMT (COND_EXPR_THEN (node
))
2651 || TREE_CODE (COND_EXPR_THEN (node
)) == GOTO_EXPR
)
2652 && COND_EXPR_ELSE (node
)
2653 && (IS_EMPTY_STMT (COND_EXPR_ELSE (node
))
2654 || TREE_CODE (COND_EXPR_ELSE (node
)) == GOTO_EXPR
))
2657 dump_generic_node (pp
, COND_EXPR_THEN (node
),
2659 if (!IS_EMPTY_STMT (COND_EXPR_ELSE (node
)))
2661 pp_string (pp
, " else ");
2662 dump_generic_node (pp
, COND_EXPR_ELSE (node
),
2666 else if (!(flags
& TDF_SLIM
))
2668 /* Output COND_EXPR_THEN. */
2669 if (COND_EXPR_THEN (node
))
2671 newline_and_indent (pp
, spc
+2);
2673 newline_and_indent (pp
, spc
+4);
2674 dump_generic_node (pp
, COND_EXPR_THEN (node
), spc
+4,
2676 newline_and_indent (pp
, spc
+2);
2677 pp_right_brace (pp
);
2680 /* Output COND_EXPR_ELSE. */
2681 if (COND_EXPR_ELSE (node
)
2682 && !IS_EMPTY_STMT (COND_EXPR_ELSE (node
)))
2684 newline_and_indent (pp
, spc
);
2685 pp_string (pp
, "else");
2686 newline_and_indent (pp
, spc
+2);
2688 newline_and_indent (pp
, spc
+4);
2689 dump_generic_node (pp
, COND_EXPR_ELSE (node
), spc
+4,
2691 newline_and_indent (pp
, spc
+2);
2692 pp_right_brace (pp
);
2699 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2703 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2707 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2713 if (!(flags
& TDF_SLIM
))
2715 if (BIND_EXPR_VARS (node
))
2719 for (op0
= BIND_EXPR_VARS (node
); op0
; op0
= DECL_CHAIN (op0
))
2721 print_declaration (pp
, op0
, spc
+2, flags
);
2726 newline_and_indent (pp
, spc
+2);
2727 dump_generic_node (pp
, BIND_EXPR_BODY (node
), spc
+2, flags
, true);
2728 newline_and_indent (pp
, spc
);
2729 pp_right_brace (pp
);
2735 if (CALL_EXPR_FN (node
) != NULL_TREE
)
2736 print_call_name (pp
, CALL_EXPR_FN (node
), flags
);
2740 pp_string (pp
, internal_fn_name (CALL_EXPR_IFN (node
)));
2743 /* Print parameters. */
2748 call_expr_arg_iterator iter
;
2749 FOR_EACH_CALL_EXPR_ARG (arg
, iter
, node
)
2751 dump_generic_node (pp
, arg
, spc
, flags
, false);
2752 if (more_call_expr_args_p (&iter
))
2759 if (CALL_EXPR_VA_ARG_PACK (node
))
2761 if (call_expr_nargs (node
) > 0)
2766 pp_string (pp
, "__builtin_va_arg_pack ()");
2768 pp_right_paren (pp
);
2770 op1
= CALL_EXPR_STATIC_CHAIN (node
);
2773 pp_string (pp
, " [static-chain: ");
2774 dump_generic_node (pp
, op1
, spc
, flags
, false);
2775 pp_right_bracket (pp
);
2778 if (CALL_EXPR_RETURN_SLOT_OPT (node
))
2779 pp_string (pp
, " [return slot optimization]");
2780 if (CALL_EXPR_TAILCALL (node
))
2781 pp_string (pp
, " [tail call]");
2784 case WITH_CLEANUP_EXPR
:
2788 case CLEANUP_POINT_EXPR
:
2789 pp_string (pp
, "<<cleanup_point ");
2790 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2791 pp_string (pp
, ">>");
2794 case PLACEHOLDER_EXPR
:
2795 pp_string (pp
, "<PLACEHOLDER_EXPR ");
2796 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2800 /* Binary arithmetic and logic expressions. */
2801 case WIDEN_PLUS_EXPR
:
2802 case WIDEN_MINUS_EXPR
:
2803 case WIDEN_SUM_EXPR
:
2804 case WIDEN_MULT_EXPR
:
2806 case MULT_HIGHPART_EXPR
:
2808 case POINTER_PLUS_EXPR
:
2809 case POINTER_DIFF_EXPR
:
2811 case TRUNC_DIV_EXPR
:
2813 case FLOOR_DIV_EXPR
:
2814 case ROUND_DIV_EXPR
:
2815 case TRUNC_MOD_EXPR
:
2817 case FLOOR_MOD_EXPR
:
2818 case ROUND_MOD_EXPR
:
2820 case EXACT_DIV_EXPR
:
2825 case WIDEN_LSHIFT_EXPR
:
2829 case TRUTH_ANDIF_EXPR
:
2830 case TRUTH_ORIF_EXPR
:
2831 case TRUTH_AND_EXPR
:
2833 case TRUTH_XOR_EXPR
:
2847 case UNORDERED_EXPR
:
2849 const char *op
= op_symbol (node
);
2850 op0
= TREE_OPERAND (node
, 0);
2851 op1
= TREE_OPERAND (node
, 1);
2853 /* When the operands are expressions with less priority,
2854 keep semantics of the tree representation. */
2855 if (op_prio (op0
) <= op_prio (node
))
2858 dump_generic_node (pp
, op0
, spc
, flags
, false);
2859 pp_right_paren (pp
);
2862 dump_generic_node (pp
, op0
, spc
, flags
, false);
2868 /* When the operands are expressions with less priority,
2869 keep semantics of the tree representation. */
2870 if (op_prio (op1
) <= op_prio (node
))
2873 dump_generic_node (pp
, op1
, spc
, flags
, false);
2874 pp_right_paren (pp
);
2877 dump_generic_node (pp
, op1
, spc
, flags
, false);
2881 /* Unary arithmetic and logic expressions. */
2883 if (flags
& TDF_GIMPLE_VAL
)
2885 pp_string (pp
, "_Literal (");
2886 dump_generic_node (pp
, TREE_TYPE (node
), spc
,
2887 flags
& ~TDF_GIMPLE_VAL
, false);
2888 pp_character (pp
, ')');
2893 case TRUTH_NOT_EXPR
:
2894 case PREDECREMENT_EXPR
:
2895 case PREINCREMENT_EXPR
:
2897 if (!(flags
& TDF_GIMPLE
)
2898 && TREE_CODE (node
) == ADDR_EXPR
2899 && (TREE_CODE (TREE_OPERAND (node
, 0)) == STRING_CST
2900 || TREE_CODE (TREE_OPERAND (node
, 0)) == FUNCTION_DECL
))
2901 /* Do not output '&' for strings and function pointers when not
2902 dumping GIMPLE FE syntax. */
2905 pp_string (pp
, op_symbol (node
));
2907 if (op_prio (TREE_OPERAND (node
, 0)) < op_prio (node
))
2910 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2911 pp_right_paren (pp
);
2914 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2917 case POSTDECREMENT_EXPR
:
2918 case POSTINCREMENT_EXPR
:
2919 if (op_prio (TREE_OPERAND (node
, 0)) < op_prio (node
))
2922 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2923 pp_right_paren (pp
);
2926 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2927 pp_string (pp
, op_symbol (node
));
2931 pp_string (pp
, "MIN_EXPR <");
2932 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2933 pp_string (pp
, ", ");
2934 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2939 pp_string (pp
, "MAX_EXPR <");
2940 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2941 pp_string (pp
, ", ");
2942 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2947 pp_string (pp
, "ABS_EXPR <");
2948 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2953 pp_string (pp
, "ABSU_EXPR <");
2954 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2962 case ADDR_SPACE_CONVERT_EXPR
:
2963 case FIXED_CONVERT_EXPR
:
2964 case FIX_TRUNC_EXPR
:
2967 type
= TREE_TYPE (node
);
2968 op0
= TREE_OPERAND (node
, 0);
2969 if (type
!= TREE_TYPE (op0
))
2972 dump_generic_node (pp
, type
, spc
, flags
, false);
2973 pp_string (pp
, ") ");
2975 if (op_prio (op0
) < op_prio (node
))
2977 dump_generic_node (pp
, op0
, spc
, flags
, false);
2978 if (op_prio (op0
) < op_prio (node
))
2979 pp_right_paren (pp
);
2982 case VIEW_CONVERT_EXPR
:
2983 if (flags
& TDF_GIMPLE
)
2984 pp_string (pp
, "__VIEW_CONVERT <");
2986 pp_string (pp
, "VIEW_CONVERT_EXPR<");
2987 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2988 pp_string (pp
, ">(");
2989 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2990 pp_right_paren (pp
);
2994 pp_string (pp
, "((");
2995 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2996 pp_string (pp
, "))");
2999 case NON_LVALUE_EXPR
:
3000 pp_string (pp
, "NON_LVALUE_EXPR <");
3001 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3006 pp_string (pp
, "SAVE_EXPR <");
3007 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3012 pp_string (pp
, "COMPLEX_EXPR <");
3013 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3014 pp_string (pp
, ", ");
3015 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3020 pp_string (pp
, "CONJ_EXPR <");
3021 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3026 if (flags
& TDF_GIMPLE
)
3028 pp_string (pp
, "__real ");
3029 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3033 pp_string (pp
, "REALPART_EXPR <");
3034 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3040 if (flags
& TDF_GIMPLE
)
3042 pp_string (pp
, "__imag ");
3043 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3047 pp_string (pp
, "IMAGPART_EXPR <");
3048 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3054 pp_string (pp
, "VA_ARG_EXPR <");
3055 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3059 case TRY_FINALLY_EXPR
:
3060 case TRY_CATCH_EXPR
:
3061 pp_string (pp
, "try");
3062 newline_and_indent (pp
, spc
+2);
3064 newline_and_indent (pp
, spc
+4);
3065 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
+4, flags
, true);
3066 newline_and_indent (pp
, spc
+2);
3067 pp_right_brace (pp
);
3068 newline_and_indent (pp
, spc
);
3069 if (TREE_CODE (node
) == TRY_CATCH_EXPR
)
3071 node
= TREE_OPERAND (node
, 1);
3072 pp_string (pp
, "catch");
3076 gcc_assert (TREE_CODE (node
) == TRY_FINALLY_EXPR
);
3077 node
= TREE_OPERAND (node
, 1);
3078 pp_string (pp
, "finally");
3079 if (TREE_CODE (node
) == EH_ELSE_EXPR
)
3081 newline_and_indent (pp
, spc
+2);
3083 newline_and_indent (pp
, spc
+4);
3084 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
+4,
3086 newline_and_indent (pp
, spc
+2);
3087 pp_right_brace (pp
);
3088 newline_and_indent (pp
, spc
);
3089 node
= TREE_OPERAND (node
, 1);
3090 pp_string (pp
, "else");
3093 newline_and_indent (pp
, spc
+2);
3095 newline_and_indent (pp
, spc
+4);
3096 dump_generic_node (pp
, node
, spc
+4, flags
, true);
3097 newline_and_indent (pp
, spc
+2);
3098 pp_right_brace (pp
);
3103 pp_string (pp
, "catch (");
3104 dump_generic_node (pp
, CATCH_TYPES (node
), spc
+2, flags
, false);
3105 pp_right_paren (pp
);
3106 newline_and_indent (pp
, spc
+2);
3108 newline_and_indent (pp
, spc
+4);
3109 dump_generic_node (pp
, CATCH_BODY (node
), spc
+4, flags
, true);
3110 newline_and_indent (pp
, spc
+2);
3111 pp_right_brace (pp
);
3115 case EH_FILTER_EXPR
:
3116 pp_string (pp
, "<<<eh_filter (");
3117 dump_generic_node (pp
, EH_FILTER_TYPES (node
), spc
+2, flags
, false);
3118 pp_string (pp
, ")>>>");
3119 newline_and_indent (pp
, spc
+2);
3121 newline_and_indent (pp
, spc
+4);
3122 dump_generic_node (pp
, EH_FILTER_FAILURE (node
), spc
+4, flags
, true);
3123 newline_and_indent (pp
, spc
+2);
3124 pp_right_brace (pp
);
3129 op0
= TREE_OPERAND (node
, 0);
3130 /* If this is for break or continue, don't bother printing it. */
3131 if (DECL_NAME (op0
))
3133 const char *name
= IDENTIFIER_POINTER (DECL_NAME (op0
));
3134 if (strcmp (name
, "break") == 0
3135 || strcmp (name
, "continue") == 0)
3138 dump_generic_node (pp
, op0
, spc
, flags
, false);
3140 if (DECL_NONLOCAL (op0
))
3141 pp_string (pp
, " [non-local]");
3145 pp_string (pp
, "while (1)");
3146 if (!(flags
& TDF_SLIM
))
3148 newline_and_indent (pp
, spc
+2);
3150 newline_and_indent (pp
, spc
+4);
3151 dump_generic_node (pp
, LOOP_EXPR_BODY (node
), spc
+4, flags
, true);
3152 newline_and_indent (pp
, spc
+2);
3153 pp_right_brace (pp
);
3159 pp_string (pp
, "// predicted ");
3160 if (PREDICT_EXPR_OUTCOME (node
))
3161 pp_string (pp
, "likely by ");
3163 pp_string (pp
, "unlikely by ");
3164 pp_string (pp
, predictor_name (PREDICT_EXPR_PREDICTOR (node
)));
3165 pp_string (pp
, " predictor.");
3169 pp_string (pp
, "ANNOTATE_EXPR <");
3170 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3171 switch ((enum annot_expr_kind
) TREE_INT_CST_LOW (TREE_OPERAND (node
, 1)))
3173 case annot_expr_ivdep_kind
:
3174 pp_string (pp
, ", ivdep");
3176 case annot_expr_unroll_kind
:
3178 pp_string (pp
, ", unroll ");
3180 (int) TREE_INT_CST_LOW (TREE_OPERAND (node
, 2)));
3183 case annot_expr_no_vector_kind
:
3184 pp_string (pp
, ", no-vector");
3186 case annot_expr_vector_kind
:
3187 pp_string (pp
, ", vector");
3189 case annot_expr_parallel_kind
:
3190 pp_string (pp
, ", parallel");
3199 pp_string (pp
, "return");
3200 op0
= TREE_OPERAND (node
, 0);
3204 if (TREE_CODE (op0
) == MODIFY_EXPR
)
3205 dump_generic_node (pp
, TREE_OPERAND (op0
, 1),
3208 dump_generic_node (pp
, op0
, spc
, flags
, false);
3213 pp_string (pp
, "if (");
3214 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3215 pp_string (pp
, ") break");
3219 pp_string (pp
, "switch (");
3220 dump_generic_node (pp
, SWITCH_COND (node
), spc
, flags
, false);
3221 pp_right_paren (pp
);
3222 if (!(flags
& TDF_SLIM
))
3224 newline_and_indent (pp
, spc
+2);
3226 if (SWITCH_BODY (node
))
3228 newline_and_indent (pp
, spc
+4);
3229 dump_generic_node (pp
, SWITCH_BODY (node
), spc
+4, flags
,
3232 newline_and_indent (pp
, spc
+2);
3233 pp_right_brace (pp
);
3239 op0
= GOTO_DESTINATION (node
);
3240 if (TREE_CODE (op0
) != SSA_NAME
&& DECL_P (op0
) && DECL_NAME (op0
))
3242 const char *name
= IDENTIFIER_POINTER (DECL_NAME (op0
));
3243 if (strcmp (name
, "break") == 0
3244 || strcmp (name
, "continue") == 0)
3246 pp_string (pp
, name
);
3250 pp_string (pp
, "goto ");
3251 dump_generic_node (pp
, op0
, spc
, flags
, false);
3255 pp_string (pp
, "__asm__");
3256 if (ASM_VOLATILE_P (node
))
3257 pp_string (pp
, " __volatile__");
3259 dump_generic_node (pp
, ASM_STRING (node
), spc
, flags
, false);
3261 dump_generic_node (pp
, ASM_OUTPUTS (node
), spc
, flags
, false);
3263 dump_generic_node (pp
, ASM_INPUTS (node
), spc
, flags
, false);
3264 if (ASM_CLOBBERS (node
))
3267 dump_generic_node (pp
, ASM_CLOBBERS (node
), spc
, flags
, false);
3269 pp_right_paren (pp
);
3272 case CASE_LABEL_EXPR
:
3273 if (CASE_LOW (node
) && CASE_HIGH (node
))
3275 pp_string (pp
, "case ");
3276 dump_generic_node (pp
, CASE_LOW (node
), spc
, flags
, false);
3277 pp_string (pp
, " ... ");
3278 dump_generic_node (pp
, CASE_HIGH (node
), spc
, flags
, false);
3280 else if (CASE_LOW (node
))
3282 pp_string (pp
, "case ");
3283 dump_generic_node (pp
, CASE_LOW (node
), spc
, flags
, false);
3286 pp_string (pp
, "default");
3291 pp_string (pp
, "OBJ_TYPE_REF(");
3292 dump_generic_node (pp
, OBJ_TYPE_REF_EXPR (node
), spc
, flags
, false);
3294 /* We omit the class type for -fcompare-debug because we may
3295 drop TYPE_BINFO early depending on debug info, and then
3296 virtual_method_call_p would return false, whereas when
3297 TYPE_BINFO is preserved it may still return true and then
3298 we'd print the class type. Compare tree and rtl dumps for
3299 libstdc++-prettyprinters/shared_ptr.cc with and without -g,
3300 for example, at occurrences of OBJ_TYPE_REF. */
3301 if (!(flags
& (TDF_SLIM
| TDF_COMPARE_DEBUG
))
3302 && virtual_method_call_p (node
, true))
3304 pp_string (pp
, "(");
3305 dump_generic_node (pp
, obj_type_ref_class (node
, true),
3307 pp_string (pp
, ")");
3309 dump_generic_node (pp
, OBJ_TYPE_REF_OBJECT (node
), spc
, flags
, false);
3311 dump_generic_node (pp
, OBJ_TYPE_REF_TOKEN (node
), spc
, flags
, false);
3312 pp_right_paren (pp
);
3316 if (SSA_NAME_IDENTIFIER (node
))
3318 if ((flags
& TDF_NOUID
)
3319 && SSA_NAME_VAR (node
)
3320 && DECL_NAMELESS (SSA_NAME_VAR (node
)))
3321 dump_fancy_name (pp
, SSA_NAME_IDENTIFIER (node
));
3322 else if (! (flags
& TDF_GIMPLE
)
3323 || SSA_NAME_VAR (node
))
3324 dump_generic_node (pp
, SSA_NAME_IDENTIFIER (node
),
3328 pp_decimal_int (pp
, SSA_NAME_VERSION (node
));
3329 if (SSA_NAME_IS_DEFAULT_DEF (node
))
3330 pp_string (pp
, "(D)");
3331 if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (node
))
3332 pp_string (pp
, "(ab)");
3335 case WITH_SIZE_EXPR
:
3336 pp_string (pp
, "WITH_SIZE_EXPR <");
3337 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3338 pp_string (pp
, ", ");
3339 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3344 pp_string (pp
, "ASSERT_EXPR <");
3345 dump_generic_node (pp
, ASSERT_EXPR_VAR (node
), spc
, flags
, false);
3346 pp_string (pp
, ", ");
3347 dump_generic_node (pp
, ASSERT_EXPR_COND (node
), spc
, flags
, false);
3352 pp_string (pp
, "scev_known");
3355 case SCEV_NOT_KNOWN
:
3356 pp_string (pp
, "scev_not_known");
3359 case POLYNOMIAL_CHREC
:
3361 dump_generic_node (pp
, CHREC_LEFT (node
), spc
, flags
, false);
3362 pp_string (pp
, ", +, ");
3363 dump_generic_node (pp
, CHREC_RIGHT (node
), spc
, flags
, false);
3364 pp_string (pp
, "}_");
3365 pp_scalar (pp
, "%u", CHREC_VARIABLE (node
));
3369 case REALIGN_LOAD_EXPR
:
3370 pp_string (pp
, "REALIGN_LOAD <");
3371 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3372 pp_string (pp
, ", ");
3373 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3374 pp_string (pp
, ", ");
3375 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3380 pp_string (pp
, " VEC_COND_EXPR < ");
3381 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3382 pp_string (pp
, " , ");
3383 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3384 pp_string (pp
, " , ");
3385 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3386 pp_string (pp
, " > ");
3390 pp_string (pp
, " VEC_PERM_EXPR < ");
3391 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3392 pp_string (pp
, " , ");
3393 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3394 pp_string (pp
, " , ");
3395 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3396 pp_string (pp
, " > ");
3400 pp_string (pp
, " DOT_PROD_EXPR < ");
3401 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3402 pp_string (pp
, ", ");
3403 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3404 pp_string (pp
, ", ");
3405 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3406 pp_string (pp
, " > ");
3409 case WIDEN_MULT_PLUS_EXPR
:
3410 pp_string (pp
, " WIDEN_MULT_PLUS_EXPR < ");
3411 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3412 pp_string (pp
, ", ");
3413 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3414 pp_string (pp
, ", ");
3415 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3416 pp_string (pp
, " > ");
3419 case WIDEN_MULT_MINUS_EXPR
:
3420 pp_string (pp
, " WIDEN_MULT_MINUS_EXPR < ");
3421 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3422 pp_string (pp
, ", ");
3423 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3424 pp_string (pp
, ", ");
3425 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3426 pp_string (pp
, " > ");
3430 pp_string (pp
, "#pragma acc parallel");
3431 goto dump_omp_clauses_body
;
3434 pp_string (pp
, "#pragma acc kernels");
3435 goto dump_omp_clauses_body
;
3438 pp_string (pp
, "#pragma acc serial");
3439 goto dump_omp_clauses_body
;
3442 pp_string (pp
, "#pragma acc data");
3443 dump_omp_clauses (pp
, OACC_DATA_CLAUSES (node
), spc
, flags
);
3446 case OACC_HOST_DATA
:
3447 pp_string (pp
, "#pragma acc host_data");
3448 dump_omp_clauses (pp
, OACC_HOST_DATA_CLAUSES (node
), spc
, flags
);
3452 pp_string (pp
, "#pragma acc declare");
3453 dump_omp_clauses (pp
, OACC_DECLARE_CLAUSES (node
), spc
, flags
);
3457 pp_string (pp
, "#pragma acc update");
3458 dump_omp_clauses (pp
, OACC_UPDATE_CLAUSES (node
), spc
, flags
);
3461 case OACC_ENTER_DATA
:
3462 pp_string (pp
, "#pragma acc enter data");
3463 dump_omp_clauses (pp
, OACC_ENTER_DATA_CLAUSES (node
), spc
, flags
);
3466 case OACC_EXIT_DATA
:
3467 pp_string (pp
, "#pragma acc exit data");
3468 dump_omp_clauses (pp
, OACC_EXIT_DATA_CLAUSES (node
), spc
, flags
);
3472 pp_string (pp
, "#pragma acc cache");
3473 dump_omp_clauses (pp
, OACC_CACHE_CLAUSES (node
), spc
, flags
);
3477 pp_string (pp
, "#pragma omp parallel");
3478 dump_omp_clauses (pp
, OMP_PARALLEL_CLAUSES (node
), spc
, flags
);
3481 dump_omp_clauses_body
:
3482 dump_omp_clauses (pp
, OMP_CLAUSES (node
), spc
, flags
);
3486 if (!(flags
& TDF_SLIM
) && OMP_BODY (node
))
3488 newline_and_indent (pp
, spc
+ 2);
3490 newline_and_indent (pp
, spc
+ 4);
3491 dump_generic_node (pp
, OMP_BODY (node
), spc
+ 4, flags
, false);
3492 newline_and_indent (pp
, spc
+ 2);
3493 pp_right_brace (pp
);
3499 pp_string (pp
, OMP_TASK_BODY (node
) ? "#pragma omp task"
3500 : "#pragma omp taskwait");
3501 dump_omp_clauses (pp
, OMP_TASK_CLAUSES (node
), spc
, flags
);
3505 pp_string (pp
, "#pragma omp for");
3509 pp_string (pp
, "#pragma omp simd");
3512 case OMP_DISTRIBUTE
:
3513 pp_string (pp
, "#pragma omp distribute");
3517 pp_string (pp
, "#pragma omp taskloop");
3521 pp_string (pp
, "#pragma omp loop");
3525 pp_string (pp
, "#pragma acc loop");
3529 pp_string (pp
, "#pragma omp teams");
3530 dump_omp_clauses (pp
, OMP_TEAMS_CLAUSES (node
), spc
, flags
);
3533 case OMP_TARGET_DATA
:
3534 pp_string (pp
, "#pragma omp target data");
3535 dump_omp_clauses (pp
, OMP_TARGET_DATA_CLAUSES (node
), spc
, flags
);
3538 case OMP_TARGET_ENTER_DATA
:
3539 pp_string (pp
, "#pragma omp target enter data");
3540 dump_omp_clauses (pp
, OMP_TARGET_ENTER_DATA_CLAUSES (node
), spc
, flags
);
3544 case OMP_TARGET_EXIT_DATA
:
3545 pp_string (pp
, "#pragma omp target exit data");
3546 dump_omp_clauses (pp
, OMP_TARGET_EXIT_DATA_CLAUSES (node
), spc
, flags
);
3551 pp_string (pp
, "#pragma omp target");
3552 dump_omp_clauses (pp
, OMP_TARGET_CLAUSES (node
), spc
, flags
);
3555 case OMP_TARGET_UPDATE
:
3556 pp_string (pp
, "#pragma omp target update");
3557 dump_omp_clauses (pp
, OMP_TARGET_UPDATE_CLAUSES (node
), spc
, flags
);
3562 dump_omp_clauses (pp
, OMP_FOR_CLAUSES (node
), spc
, flags
);
3563 if (!(flags
& TDF_SLIM
))
3567 if (OMP_FOR_PRE_BODY (node
))
3569 newline_and_indent (pp
, spc
+ 2);
3572 newline_and_indent (pp
, spc
);
3573 dump_generic_node (pp
, OMP_FOR_PRE_BODY (node
),
3576 if (OMP_FOR_INIT (node
))
3579 for (i
= 0; i
< TREE_VEC_LENGTH (OMP_FOR_INIT (node
)); i
++)
3582 newline_and_indent (pp
, spc
);
3583 pp_string (pp
, "for (");
3584 tree init
= TREE_VEC_ELT (OMP_FOR_INIT (node
), i
);
3585 if (TREE_CODE (init
) != MODIFY_EXPR
3586 || TREE_CODE (TREE_OPERAND (init
, 1)) != TREE_VEC
)
3587 dump_generic_node (pp
, init
, spc
, flags
, false);
3590 dump_generic_node (pp
, TREE_OPERAND (init
, 0),
3592 pp_string (pp
, " = ");
3593 dump_omp_loop_non_rect_expr (pp
, TREE_OPERAND (init
, 1),
3596 pp_string (pp
, "; ");
3597 tree cond
= TREE_VEC_ELT (OMP_FOR_COND (node
), i
);
3598 if (!COMPARISON_CLASS_P (cond
)
3599 || TREE_CODE (TREE_OPERAND (cond
, 1)) != TREE_VEC
)
3600 dump_generic_node (pp
, cond
, spc
, flags
, false);
3603 dump_generic_node (pp
, TREE_OPERAND (cond
, 0),
3605 const char *op
= op_symbol (cond
);
3609 dump_omp_loop_non_rect_expr (pp
, TREE_OPERAND (cond
, 1),
3612 pp_string (pp
, "; ");
3613 dump_generic_node (pp
,
3614 TREE_VEC_ELT (OMP_FOR_INCR (node
), i
),
3616 pp_right_paren (pp
);
3619 if (OMP_FOR_BODY (node
))
3621 newline_and_indent (pp
, spc
+ 2);
3623 newline_and_indent (pp
, spc
+ 4);
3624 dump_generic_node (pp
, OMP_FOR_BODY (node
), spc
+ 4, flags
,
3626 newline_and_indent (pp
, spc
+ 2);
3627 pp_right_brace (pp
);
3629 if (OMP_FOR_INIT (node
))
3630 spc
-= 2 * TREE_VEC_LENGTH (OMP_FOR_INIT (node
)) - 2;
3631 if (OMP_FOR_PRE_BODY (node
))
3634 newline_and_indent (pp
, spc
+ 2);
3635 pp_right_brace (pp
);
3642 pp_string (pp
, "#pragma omp sections");
3643 dump_omp_clauses (pp
, OMP_SECTIONS_CLAUSES (node
), spc
, flags
);
3647 pp_string (pp
, "#pragma omp section");
3651 if (OMP_SCAN_CLAUSES (node
))
3653 pp_string (pp
, "#pragma omp scan");
3654 dump_omp_clauses (pp
, OMP_SCAN_CLAUSES (node
), spc
, flags
);
3659 pp_string (pp
, "#pragma omp master");
3663 pp_string (pp
, "#pragma omp masked");
3664 dump_omp_clauses (pp
, OMP_MASKED_CLAUSES (node
), spc
, flags
);
3668 pp_string (pp
, "#pragma omp taskgroup");
3669 dump_omp_clauses (pp
, OMP_TASKGROUP_CLAUSES (node
), spc
, flags
);
3673 pp_string (pp
, "#pragma omp ordered");
3674 dump_omp_clauses (pp
, OMP_ORDERED_CLAUSES (node
), spc
, flags
);
3678 pp_string (pp
, "#pragma omp critical");
3679 if (OMP_CRITICAL_NAME (node
))
3683 dump_generic_node (pp
, OMP_CRITICAL_NAME (node
), spc
,
3685 pp_right_paren (pp
);
3687 dump_omp_clauses (pp
, OMP_CRITICAL_CLAUSES (node
), spc
, flags
);
3691 pp_string (pp
, "#pragma omp atomic");
3692 if (OMP_ATOMIC_WEAK (node
))
3693 pp_string (pp
, " weak");
3694 dump_omp_atomic_memory_order (pp
, OMP_ATOMIC_MEMORY_ORDER (node
));
3695 newline_and_indent (pp
, spc
+ 2);
3696 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3700 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3703 case OMP_ATOMIC_READ
:
3704 pp_string (pp
, "#pragma omp atomic read");
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 case OMP_ATOMIC_CAPTURE_OLD
:
3712 case OMP_ATOMIC_CAPTURE_NEW
:
3713 pp_string (pp
, "#pragma omp atomic capture");
3714 if (OMP_ATOMIC_WEAK (node
))
3715 pp_string (pp
, " weak");
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 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3726 pp_string (pp
, "#pragma omp single");
3727 dump_omp_clauses (pp
, OMP_SINGLE_CLAUSES (node
), spc
, flags
);
3731 pp_string (pp
, "#pragma omp scope");
3732 dump_omp_clauses (pp
, OMP_SCOPE_CLAUSES (node
), spc
, flags
);
3736 /* If we come here, we're dumping something that's not an OMP construct,
3737 for example, OMP clauses attached to a function's '__attribute__'.
3738 Dump the whole OMP clause chain. */
3739 dump_omp_clauses (pp
, node
, spc
, flags
, false);
3743 case TRANSACTION_EXPR
:
3744 if (TRANSACTION_EXPR_OUTER (node
))
3745 pp_string (pp
, "__transaction_atomic [[outer]]");
3746 else if (TRANSACTION_EXPR_RELAXED (node
))
3747 pp_string (pp
, "__transaction_relaxed");
3749 pp_string (pp
, "__transaction_atomic");
3750 if (!(flags
& TDF_SLIM
) && TRANSACTION_EXPR_BODY (node
))
3752 newline_and_indent (pp
, spc
);
3754 newline_and_indent (pp
, spc
+ 2);
3755 dump_generic_node (pp
, TRANSACTION_EXPR_BODY (node
),
3756 spc
+ 2, flags
, false);
3757 newline_and_indent (pp
, spc
);
3758 pp_right_brace (pp
);
3763 case VEC_SERIES_EXPR
:
3764 case VEC_WIDEN_MULT_HI_EXPR
:
3765 case VEC_WIDEN_MULT_LO_EXPR
:
3766 case VEC_WIDEN_PLUS_HI_EXPR
:
3767 case VEC_WIDEN_PLUS_LO_EXPR
:
3768 case VEC_WIDEN_MINUS_HI_EXPR
:
3769 case VEC_WIDEN_MINUS_LO_EXPR
:
3770 case VEC_WIDEN_MULT_EVEN_EXPR
:
3771 case VEC_WIDEN_MULT_ODD_EXPR
:
3772 case VEC_WIDEN_LSHIFT_HI_EXPR
:
3773 case VEC_WIDEN_LSHIFT_LO_EXPR
:
3775 for (str
= get_tree_code_name (code
); *str
; str
++)
3776 pp_character (pp
, TOUPPER (*str
));
3777 pp_string (pp
, " < ");
3778 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3779 pp_string (pp
, ", ");
3780 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3781 pp_string (pp
, " > ");
3784 case VEC_DUPLICATE_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
, " > ");
3793 case VEC_UNPACK_HI_EXPR
:
3794 pp_string (pp
, " VEC_UNPACK_HI_EXPR < ");
3795 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3796 pp_string (pp
, " > ");
3799 case VEC_UNPACK_LO_EXPR
:
3800 pp_string (pp
, " VEC_UNPACK_LO_EXPR < ");
3801 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3802 pp_string (pp
, " > ");
3805 case VEC_UNPACK_FLOAT_HI_EXPR
:
3806 pp_string (pp
, " VEC_UNPACK_FLOAT_HI_EXPR < ");
3807 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3808 pp_string (pp
, " > ");
3811 case VEC_UNPACK_FLOAT_LO_EXPR
:
3812 pp_string (pp
, " VEC_UNPACK_FLOAT_LO_EXPR < ");
3813 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3814 pp_string (pp
, " > ");
3817 case VEC_UNPACK_FIX_TRUNC_HI_EXPR
:
3818 pp_string (pp
, " VEC_UNPACK_FIX_TRUNC_HI_EXPR < ");
3819 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3820 pp_string (pp
, " > ");
3823 case VEC_UNPACK_FIX_TRUNC_LO_EXPR
:
3824 pp_string (pp
, " VEC_UNPACK_FIX_TRUNC_LO_EXPR < ");
3825 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3826 pp_string (pp
, " > ");
3829 case VEC_PACK_TRUNC_EXPR
:
3830 pp_string (pp
, " VEC_PACK_TRUNC_EXPR < ");
3831 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3832 pp_string (pp
, ", ");
3833 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3834 pp_string (pp
, " > ");
3837 case VEC_PACK_SAT_EXPR
:
3838 pp_string (pp
, " VEC_PACK_SAT_EXPR < ");
3839 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3840 pp_string (pp
, ", ");
3841 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3842 pp_string (pp
, " > ");
3845 case VEC_PACK_FIX_TRUNC_EXPR
:
3846 pp_string (pp
, " VEC_PACK_FIX_TRUNC_EXPR < ");
3847 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3848 pp_string (pp
, ", ");
3849 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3850 pp_string (pp
, " > ");
3853 case VEC_PACK_FLOAT_EXPR
:
3854 pp_string (pp
, " VEC_PACK_FLOAT_EXPR < ");
3855 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3856 pp_string (pp
, ", ");
3857 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3858 pp_string (pp
, " > ");
3862 dump_block_node (pp
, node
, spc
, flags
);
3865 case DEBUG_BEGIN_STMT
:
3866 pp_string (pp
, "# DEBUG BEGIN STMT");
3873 if (is_stmt
&& is_expr
)
3879 /* Print the declaration of a variable. */
3882 print_declaration (pretty_printer
*pp
, tree t
, int spc
, dump_flags_t flags
)
3886 if (TREE_CODE(t
) == NAMELIST_DECL
)
3888 pp_string(pp
, "namelist ");
3889 dump_decl_name (pp
, t
, flags
);
3894 if (TREE_CODE (t
) == TYPE_DECL
)
3895 pp_string (pp
, "typedef ");
3897 if (CODE_CONTAINS_STRUCT (TREE_CODE (t
), TS_DECL_WRTL
) && DECL_REGISTER (t
))
3898 pp_string (pp
, "register ");
3900 if (TREE_PUBLIC (t
) && DECL_EXTERNAL (t
))
3901 pp_string (pp
, "extern ");
3902 else if (TREE_STATIC (t
))
3903 pp_string (pp
, "static ");
3905 /* Print the type and name. */
3906 if (TREE_TYPE (t
) && TREE_CODE (TREE_TYPE (t
)) == ARRAY_TYPE
)
3910 /* Print array's type. */
3911 tmp
= TREE_TYPE (t
);
3912 while (TREE_CODE (TREE_TYPE (tmp
)) == ARRAY_TYPE
)
3913 tmp
= TREE_TYPE (tmp
);
3914 dump_generic_node (pp
, TREE_TYPE (tmp
), spc
, flags
, false);
3916 /* Print variable's name. */
3918 dump_generic_node (pp
, t
, spc
, flags
, false);
3920 /* Print the dimensions. */
3921 tmp
= TREE_TYPE (t
);
3922 while (TREE_CODE (tmp
) == ARRAY_TYPE
)
3924 dump_array_domain (pp
, TYPE_DOMAIN (tmp
), spc
, flags
);
3925 tmp
= TREE_TYPE (tmp
);
3928 else if (TREE_CODE (t
) == FUNCTION_DECL
)
3930 dump_generic_node (pp
, TREE_TYPE (TREE_TYPE (t
)), spc
, flags
, false);
3932 dump_decl_name (pp
, t
, flags
);
3933 dump_function_declaration (pp
, TREE_TYPE (t
), spc
, flags
);
3937 /* Print type declaration. */
3938 dump_generic_node (pp
, TREE_TYPE (t
), spc
, flags
, false);
3940 /* Print variable's name. */
3942 dump_generic_node (pp
, t
, spc
, flags
, false);
3945 if (VAR_P (t
) && DECL_HARD_REGISTER (t
))
3947 pp_string (pp
, " __asm__ ");
3949 dump_generic_node (pp
, DECL_ASSEMBLER_NAME (t
), spc
, flags
, false);
3950 pp_right_paren (pp
);
3953 /* The initial value of a function serves to determine whether the function
3954 is declared or defined. So the following does not apply to function
3956 if (TREE_CODE (t
) != FUNCTION_DECL
)
3958 /* Print the initial value. */
3959 if (DECL_INITIAL (t
))
3964 if (!(flags
& TDF_SLIM
))
3965 dump_generic_node (pp
, DECL_INITIAL (t
), spc
, flags
, false);
3967 pp_string (pp
, "<<< omitted >>>");
3971 if (VAR_P (t
) && DECL_HAS_VALUE_EXPR_P (t
))
3973 pp_string (pp
, " [value-expr: ");
3974 dump_generic_node (pp
, DECL_VALUE_EXPR (t
), spc
, flags
, false);
3975 pp_right_bracket (pp
);
3982 /* Prints a structure: name, fields, and methods.
3983 FIXME: Still incomplete. */
3986 print_struct_decl (pretty_printer
*pp
, const_tree node
, int spc
,
3989 /* Print the name of the structure. */
3990 if (TYPE_NAME (node
))
3993 if (TREE_CODE (node
) == RECORD_TYPE
)
3994 pp_string (pp
, "struct ");
3995 else if ((TREE_CODE (node
) == UNION_TYPE
3996 || TREE_CODE (node
) == QUAL_UNION_TYPE
))
3997 pp_string (pp
, "union ");
3999 dump_generic_node (pp
, TYPE_NAME (node
), spc
, TDF_NONE
, false);
4002 /* Print the contents of the structure. */
4008 /* Print the fields of the structure. */
4011 tmp
= TYPE_FIELDS (node
);
4014 /* Avoid to print recursively the structure. */
4015 /* FIXME : Not implemented correctly...,
4016 what about the case when we have a cycle in the contain graph? ...
4017 Maybe this could be solved by looking at the scope in which the
4018 structure was declared. */
4019 if (TREE_TYPE (tmp
) != node
4020 && (TREE_CODE (TREE_TYPE (tmp
)) != POINTER_TYPE
4021 || TREE_TYPE (TREE_TYPE (tmp
)) != node
))
4023 print_declaration (pp
, tmp
, spc
+2, flags
);
4026 tmp
= DECL_CHAIN (tmp
);
4030 pp_right_brace (pp
);
4033 /* Return the priority of the operator CODE.
4035 From lowest to highest precedence with either left-to-right (L-R)
4036 or right-to-left (R-L) associativity]:
4039 2 [R-L] = += -= *= /= %= &= ^= |= <<= >>=
4051 14 [R-L] ! ~ ++ -- + - * & (type) sizeof
4052 15 [L-R] fn() [] -> .
4054 unary +, - and * have higher precedence than the corresponding binary
4058 op_code_prio (enum tree_code code
)
4075 case TRUTH_ORIF_EXPR
:
4078 case TRUTH_AND_EXPR
:
4079 case TRUTH_ANDIF_EXPR
:
4086 case TRUTH_XOR_EXPR
:
4103 case UNORDERED_EXPR
:
4114 case VEC_WIDEN_LSHIFT_HI_EXPR
:
4115 case VEC_WIDEN_LSHIFT_LO_EXPR
:
4116 case WIDEN_LSHIFT_EXPR
:
4119 case WIDEN_SUM_EXPR
:
4121 case POINTER_PLUS_EXPR
:
4122 case POINTER_DIFF_EXPR
:
4126 case VEC_WIDEN_MULT_HI_EXPR
:
4127 case VEC_WIDEN_MULT_LO_EXPR
:
4128 case WIDEN_MULT_EXPR
:
4130 case WIDEN_MULT_PLUS_EXPR
:
4131 case WIDEN_MULT_MINUS_EXPR
:
4133 case MULT_HIGHPART_EXPR
:
4134 case TRUNC_DIV_EXPR
:
4136 case FLOOR_DIV_EXPR
:
4137 case ROUND_DIV_EXPR
:
4139 case EXACT_DIV_EXPR
:
4140 case TRUNC_MOD_EXPR
:
4142 case FLOOR_MOD_EXPR
:
4143 case ROUND_MOD_EXPR
:
4146 case TRUTH_NOT_EXPR
:
4148 case POSTINCREMENT_EXPR
:
4149 case POSTDECREMENT_EXPR
:
4150 case PREINCREMENT_EXPR
:
4151 case PREDECREMENT_EXPR
:
4157 case FIX_TRUNC_EXPR
:
4163 case ARRAY_RANGE_REF
:
4167 /* Special expressions. */
4173 case VEC_UNPACK_HI_EXPR
:
4174 case VEC_UNPACK_LO_EXPR
:
4175 case VEC_UNPACK_FLOAT_HI_EXPR
:
4176 case VEC_UNPACK_FLOAT_LO_EXPR
:
4177 case VEC_UNPACK_FIX_TRUNC_HI_EXPR
:
4178 case VEC_UNPACK_FIX_TRUNC_LO_EXPR
:
4179 case VEC_PACK_TRUNC_EXPR
:
4180 case VEC_PACK_SAT_EXPR
:
4184 /* Return an arbitrarily high precedence to avoid surrounding single
4185 VAR_DECLs in ()s. */
4190 /* Return the priority of the operator OP. */
4193 op_prio (const_tree op
)
4195 enum tree_code code
;
4200 code
= TREE_CODE (op
);
4201 if (code
== SAVE_EXPR
|| code
== NON_LVALUE_EXPR
)
4202 return op_prio (TREE_OPERAND (op
, 0));
4204 return op_code_prio (code
);
4207 /* Return the symbol associated with operator CODE. */
4210 op_symbol_code (enum tree_code code
)
4218 case TRUTH_ORIF_EXPR
:
4221 case TRUTH_AND_EXPR
:
4222 case TRUTH_ANDIF_EXPR
:
4228 case TRUTH_XOR_EXPR
:
4238 case UNORDERED_EXPR
:
4284 case WIDEN_LSHIFT_EXPR
:
4287 case WIDEN_PLUS_EXPR
:
4290 case WIDEN_MINUS_EXPR
:
4293 case POINTER_PLUS_EXPR
:
4299 case WIDEN_SUM_EXPR
:
4302 case WIDEN_MULT_EXPR
:
4305 case MULT_HIGHPART_EXPR
:
4310 case POINTER_DIFF_EXPR
:
4316 case TRUTH_NOT_EXPR
:
4323 case TRUNC_DIV_EXPR
:
4330 case FLOOR_DIV_EXPR
:
4333 case ROUND_DIV_EXPR
:
4336 case EXACT_DIV_EXPR
:
4339 case TRUNC_MOD_EXPR
:
4345 case FLOOR_MOD_EXPR
:
4348 case ROUND_MOD_EXPR
:
4351 case PREDECREMENT_EXPR
:
4354 case PREINCREMENT_EXPR
:
4357 case POSTDECREMENT_EXPR
:
4360 case POSTINCREMENT_EXPR
:
4370 return "<<< ??? >>>";
4374 /* Return the symbol associated with operator OP. */
4377 op_symbol (const_tree op
)
4379 return op_symbol_code (TREE_CODE (op
));
4382 /* Prints the name of a call. NODE is the CALL_EXPR_FN of a CALL_EXPR or
4383 the gimple_call_fn of a GIMPLE_CALL. */
4386 print_call_name (pretty_printer
*pp
, tree node
, dump_flags_t flags
)
4390 if (TREE_CODE (op0
) == NON_LVALUE_EXPR
)
4391 op0
= TREE_OPERAND (op0
, 0);
4394 switch (TREE_CODE (op0
))
4399 dump_function_name (pp
, op0
, flags
);
4405 op0
= TREE_OPERAND (op0
, 0);
4410 dump_generic_node (pp
, TREE_OPERAND (op0
, 0), 0, flags
, false);
4411 pp_string (pp
, ") ? ");
4412 dump_generic_node (pp
, TREE_OPERAND (op0
, 1), 0, flags
, false);
4413 pp_string (pp
, " : ");
4414 dump_generic_node (pp
, TREE_OPERAND (op0
, 2), 0, flags
, false);
4418 if (TREE_CODE (TREE_OPERAND (op0
, 0)) == VAR_DECL
)
4419 dump_function_name (pp
, TREE_OPERAND (op0
, 0), flags
);
4421 dump_generic_node (pp
, op0
, 0, flags
, false);
4425 if (integer_zerop (TREE_OPERAND (op0
, 1)))
4427 op0
= TREE_OPERAND (op0
, 0);
4434 dump_generic_node (pp
, op0
, 0, flags
, false);
4442 /* Print the first N characters in the array STR, replacing non-printable
4443 characters (including embedded nuls) with unambiguous escape sequences. */
4446 pretty_print_string (pretty_printer
*pp
, const char *str
, size_t n
)
4451 for ( ; n
; --n
, ++str
)
4456 pp_string (pp
, "\\b");
4460 pp_string (pp
, "\\f");
4464 pp_string (pp
, "\\n");
4468 pp_string (pp
, "\\r");
4472 pp_string (pp
, "\\t");
4476 pp_string (pp
, "\\v");
4480 pp_string (pp
, "\\\\");
4484 pp_string (pp
, "\\\"");
4488 pp_string (pp
, "\\'");
4492 if (str
[0] || n
> 1)
4494 if (!ISPRINT (str
[0]))
4497 sprintf (buf
, "\\x%02x", (unsigned char)str
[0]);
4498 pp_string (pp
, buf
);
4501 pp_character (pp
, str
[0]);
4509 maybe_init_pretty_print (FILE *file
)
4513 tree_pp
= new pretty_printer ();
4514 pp_needs_newline (tree_pp
) = true;
4515 pp_translate_identifiers (tree_pp
) = false;
4518 tree_pp
->buffer
->stream
= file
;
4522 newline_and_indent (pretty_printer
*pp
, int spc
)
4528 /* Print the identifier ID to PRETTY-PRINTER. */
4531 pp_tree_identifier (pretty_printer
*pp
, tree id
)
4533 if (pp_translate_identifiers (pp
))
4535 const char *text
= identifier_to_locale (IDENTIFIER_POINTER (id
));
4536 pp_append_text (pp
, text
, text
+ strlen (text
));
4539 pp_append_text (pp
, IDENTIFIER_POINTER (id
),
4540 IDENTIFIER_POINTER (id
) + IDENTIFIER_LENGTH (id
));
4543 /* A helper function that is used to dump function information before the
4547 dump_function_header (FILE *dump_file
, tree fdecl
, dump_flags_t flags
)
4549 const char *dname
, *aname
;
4550 struct cgraph_node
*node
= cgraph_node::get (fdecl
);
4551 struct function
*fun
= DECL_STRUCT_FUNCTION (fdecl
);
4553 dname
= lang_hooks
.decl_printable_name (fdecl
, 1);
4555 if (DECL_ASSEMBLER_NAME_SET_P (fdecl
))
4556 aname
= (IDENTIFIER_POINTER
4557 (DECL_ASSEMBLER_NAME (fdecl
)));
4559 aname
= "<unset-asm-name>";
4561 fprintf (dump_file
, "\n;; Function %s (%s, funcdef_no=%d",
4562 dname
, aname
, fun
->funcdef_no
);
4563 if (!(flags
& TDF_NOUID
))
4564 fprintf (dump_file
, ", decl_uid=%d", DECL_UID (fdecl
));
4567 fprintf (dump_file
, ", cgraph_uid=%d", node
->get_uid ());
4568 fprintf (dump_file
, ", symbol_order=%d)%s\n\n", node
->order
,
4569 node
->frequency
== NODE_FREQUENCY_HOT
4571 : node
->frequency
== NODE_FREQUENCY_UNLIKELY_EXECUTED
4572 ? " (unlikely executed)"
4573 : node
->frequency
== NODE_FREQUENCY_EXECUTED_ONCE
4574 ? " (executed once)"
4578 fprintf (dump_file
, ")\n\n");
4581 /* Dump double_int D to pretty_printer PP. UNS is true
4582 if D is unsigned and false otherwise. */
4584 pp_double_int (pretty_printer
*pp
, double_int d
, bool uns
)
4587 pp_wide_integer (pp
, d
.low
);
4588 else if (d
.fits_uhwi ())
4589 pp_unsigned_wide_integer (pp
, d
.low
);
4592 unsigned HOST_WIDE_INT low
= d
.low
;
4593 HOST_WIDE_INT high
= d
.high
;
4594 if (!uns
&& d
.is_negative ())
4597 high
= ~high
+ !low
;
4600 /* Would "%x%0*x" or "%x%*0x" get zero-padding on all
4602 sprintf (pp_buffer (pp
)->digit_buffer
,
4603 HOST_WIDE_INT_PRINT_DOUBLE_HEX
,
4604 (unsigned HOST_WIDE_INT
) high
, low
);
4605 pp_string (pp
, pp_buffer (pp
)->digit_buffer
);
4610 # pragma GCC diagnostic pop