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 dump_generic_node (pp
, OMP_CLAUSE_NUM_TEAMS_EXPR (clause
),
1002 case OMP_CLAUSE_THREAD_LIMIT
:
1003 pp_string (pp
, "thread_limit(");
1004 dump_generic_node (pp
, OMP_CLAUSE_THREAD_LIMIT_EXPR (clause
),
1006 pp_right_paren (pp
);
1009 case OMP_CLAUSE_DEVICE
:
1010 pp_string (pp
, "device(");
1011 if (OMP_CLAUSE_DEVICE_ANCESTOR (clause
))
1012 pp_string (pp
, "ancestor:");
1013 dump_generic_node (pp
, OMP_CLAUSE_DEVICE_ID (clause
),
1015 pp_right_paren (pp
);
1018 case OMP_CLAUSE_DIST_SCHEDULE
:
1019 pp_string (pp
, "dist_schedule(static");
1020 if (OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR (clause
))
1023 dump_generic_node (pp
,
1024 OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR (clause
),
1027 pp_right_paren (pp
);
1030 case OMP_CLAUSE_PROC_BIND
:
1031 pp_string (pp
, "proc_bind(");
1032 switch (OMP_CLAUSE_PROC_BIND_KIND (clause
))
1034 case OMP_CLAUSE_PROC_BIND_MASTER
:
1035 /* Same enum value: case OMP_CLAUSE_PROC_BIND_PRIMARY: */
1036 /* TODO: Change to 'primary' for OpenMP 5.1. */
1037 pp_string (pp
, "master");
1039 case OMP_CLAUSE_PROC_BIND_CLOSE
:
1040 pp_string (pp
, "close");
1042 case OMP_CLAUSE_PROC_BIND_SPREAD
:
1043 pp_string (pp
, "spread");
1048 pp_right_paren (pp
);
1051 case OMP_CLAUSE_DEVICE_TYPE
:
1052 pp_string (pp
, "device_type(");
1053 switch (OMP_CLAUSE_DEVICE_TYPE_KIND (clause
))
1055 case OMP_CLAUSE_DEVICE_TYPE_HOST
:
1056 pp_string (pp
, "host");
1058 case OMP_CLAUSE_DEVICE_TYPE_NOHOST
:
1059 pp_string (pp
, "nohost");
1061 case OMP_CLAUSE_DEVICE_TYPE_ANY
:
1062 pp_string (pp
, "any");
1067 pp_right_paren (pp
);
1070 case OMP_CLAUSE_SAFELEN
:
1071 pp_string (pp
, "safelen(");
1072 dump_generic_node (pp
, OMP_CLAUSE_SAFELEN_EXPR (clause
),
1074 pp_right_paren (pp
);
1077 case OMP_CLAUSE_SIMDLEN
:
1078 pp_string (pp
, "simdlen(");
1079 dump_generic_node (pp
, OMP_CLAUSE_SIMDLEN_EXPR (clause
),
1081 pp_right_paren (pp
);
1084 case OMP_CLAUSE_PRIORITY
:
1085 pp_string (pp
, "priority(");
1086 dump_generic_node (pp
, OMP_CLAUSE_PRIORITY_EXPR (clause
),
1088 pp_right_paren (pp
);
1091 case OMP_CLAUSE_GRAINSIZE
:
1092 pp_string (pp
, "grainsize(");
1093 if (OMP_CLAUSE_GRAINSIZE_STRICT (clause
))
1094 pp_string (pp
, "strict:");
1095 dump_generic_node (pp
, OMP_CLAUSE_GRAINSIZE_EXPR (clause
),
1097 pp_right_paren (pp
);
1100 case OMP_CLAUSE_NUM_TASKS
:
1101 pp_string (pp
, "num_tasks(");
1102 if (OMP_CLAUSE_NUM_TASKS_STRICT (clause
))
1103 pp_string (pp
, "strict:");
1104 dump_generic_node (pp
, OMP_CLAUSE_NUM_TASKS_EXPR (clause
),
1106 pp_right_paren (pp
);
1109 case OMP_CLAUSE_HINT
:
1110 pp_string (pp
, "hint(");
1111 dump_generic_node (pp
, OMP_CLAUSE_HINT_EXPR (clause
),
1113 pp_right_paren (pp
);
1116 case OMP_CLAUSE_FILTER
:
1117 pp_string (pp
, "filter(");
1118 dump_generic_node (pp
, OMP_CLAUSE_FILTER_EXPR (clause
),
1120 pp_right_paren (pp
);
1123 case OMP_CLAUSE_DEFAULTMAP
:
1124 pp_string (pp
, "defaultmap(");
1125 switch (OMP_CLAUSE_DEFAULTMAP_BEHAVIOR (clause
))
1127 case OMP_CLAUSE_DEFAULTMAP_ALLOC
:
1128 pp_string (pp
, "alloc");
1130 case OMP_CLAUSE_DEFAULTMAP_TO
:
1131 pp_string (pp
, "to");
1133 case OMP_CLAUSE_DEFAULTMAP_FROM
:
1134 pp_string (pp
, "from");
1136 case OMP_CLAUSE_DEFAULTMAP_TOFROM
:
1137 pp_string (pp
, "tofrom");
1139 case OMP_CLAUSE_DEFAULTMAP_FIRSTPRIVATE
:
1140 pp_string (pp
, "firstprivate");
1142 case OMP_CLAUSE_DEFAULTMAP_NONE
:
1143 pp_string (pp
, "none");
1145 case OMP_CLAUSE_DEFAULTMAP_DEFAULT
:
1146 pp_string (pp
, "default");
1151 switch (OMP_CLAUSE_DEFAULTMAP_CATEGORY (clause
))
1153 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_UNSPECIFIED
:
1155 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_SCALAR
:
1156 pp_string (pp
, ":scalar");
1158 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_AGGREGATE
:
1159 pp_string (pp
, ":aggregate");
1161 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_ALLOCATABLE
:
1162 pp_string (pp
, ":allocatable");
1164 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_POINTER
:
1165 pp_string (pp
, ":pointer");
1170 pp_right_paren (pp
);
1173 case OMP_CLAUSE_ORDER
:
1174 pp_string (pp
, "order(");
1175 if (OMP_CLAUSE_ORDER_UNCONSTRAINED (clause
))
1176 pp_string (pp
, "unconstrained:");
1177 else if (OMP_CLAUSE_ORDER_REPRODUCIBLE (clause
))
1178 pp_string (pp
, "reproducible:");
1179 pp_string (pp
, "concurrent)");
1182 case OMP_CLAUSE_BIND
:
1183 pp_string (pp
, "bind(");
1184 switch (OMP_CLAUSE_BIND_KIND (clause
))
1186 case OMP_CLAUSE_BIND_TEAMS
:
1187 pp_string (pp
, "teams");
1189 case OMP_CLAUSE_BIND_PARALLEL
:
1190 pp_string (pp
, "parallel");
1192 case OMP_CLAUSE_BIND_THREAD
:
1193 pp_string (pp
, "thread");
1198 pp_right_paren (pp
);
1201 case OMP_CLAUSE__SIMDUID_
:
1202 pp_string (pp
, "_simduid_(");
1203 dump_generic_node (pp
, OMP_CLAUSE__SIMDUID__DECL (clause
),
1205 pp_right_paren (pp
);
1208 case OMP_CLAUSE__SIMT_
:
1209 pp_string (pp
, "_simt_");
1212 case OMP_CLAUSE_GANG
:
1213 pp_string (pp
, "gang");
1214 if (OMP_CLAUSE_GANG_EXPR (clause
) != NULL_TREE
)
1216 pp_string (pp
, "(num: ");
1217 dump_generic_node (pp
, OMP_CLAUSE_GANG_EXPR (clause
),
1220 if (OMP_CLAUSE_GANG_STATIC_EXPR (clause
) != NULL_TREE
)
1222 if (OMP_CLAUSE_GANG_EXPR (clause
) == NULL_TREE
)
1226 pp_string (pp
, "static:");
1227 if (OMP_CLAUSE_GANG_STATIC_EXPR (clause
)
1228 == integer_minus_one_node
)
1229 pp_character (pp
, '*');
1231 dump_generic_node (pp
, OMP_CLAUSE_GANG_STATIC_EXPR (clause
),
1234 if (OMP_CLAUSE_GANG_EXPR (clause
) != NULL_TREE
1235 || OMP_CLAUSE_GANG_STATIC_EXPR (clause
) != NULL_TREE
)
1236 pp_right_paren (pp
);
1239 case OMP_CLAUSE_ASYNC
:
1240 pp_string (pp
, "async");
1241 if (OMP_CLAUSE_ASYNC_EXPR (clause
))
1243 pp_character(pp
, '(');
1244 dump_generic_node (pp
, OMP_CLAUSE_ASYNC_EXPR (clause
),
1246 pp_character(pp
, ')');
1250 case OMP_CLAUSE_AUTO
:
1251 case OMP_CLAUSE_SEQ
:
1252 pp_string (pp
, omp_clause_code_name
[OMP_CLAUSE_CODE (clause
)]);
1255 case OMP_CLAUSE_WAIT
:
1256 pp_string (pp
, "wait(");
1257 dump_generic_node (pp
, OMP_CLAUSE_WAIT_EXPR (clause
),
1259 pp_character(pp
, ')');
1262 case OMP_CLAUSE_WORKER
:
1263 pp_string (pp
, "worker");
1264 if (OMP_CLAUSE_WORKER_EXPR (clause
) != NULL_TREE
)
1267 dump_generic_node (pp
, OMP_CLAUSE_WORKER_EXPR (clause
),
1269 pp_right_paren (pp
);
1273 case OMP_CLAUSE_VECTOR
:
1274 pp_string (pp
, "vector");
1275 if (OMP_CLAUSE_VECTOR_EXPR (clause
) != NULL_TREE
)
1278 dump_generic_node (pp
, OMP_CLAUSE_VECTOR_EXPR (clause
),
1280 pp_right_paren (pp
);
1284 case OMP_CLAUSE_NUM_GANGS
:
1285 pp_string (pp
, "num_gangs(");
1286 dump_generic_node (pp
, OMP_CLAUSE_NUM_GANGS_EXPR (clause
),
1288 pp_character (pp
, ')');
1291 case OMP_CLAUSE_NUM_WORKERS
:
1292 pp_string (pp
, "num_workers(");
1293 dump_generic_node (pp
, OMP_CLAUSE_NUM_WORKERS_EXPR (clause
),
1295 pp_character (pp
, ')');
1298 case OMP_CLAUSE_VECTOR_LENGTH
:
1299 pp_string (pp
, "vector_length(");
1300 dump_generic_node (pp
, OMP_CLAUSE_VECTOR_LENGTH_EXPR (clause
),
1302 pp_character (pp
, ')');
1305 case OMP_CLAUSE_INBRANCH
:
1306 pp_string (pp
, "inbranch");
1308 case OMP_CLAUSE_NOTINBRANCH
:
1309 pp_string (pp
, "notinbranch");
1311 case OMP_CLAUSE_FOR
:
1312 pp_string (pp
, "for");
1314 case OMP_CLAUSE_PARALLEL
:
1315 pp_string (pp
, "parallel");
1317 case OMP_CLAUSE_SECTIONS
:
1318 pp_string (pp
, "sections");
1320 case OMP_CLAUSE_TASKGROUP
:
1321 pp_string (pp
, "taskgroup");
1323 case OMP_CLAUSE_NOGROUP
:
1324 pp_string (pp
, "nogroup");
1326 case OMP_CLAUSE_THREADS
:
1327 pp_string (pp
, "threads");
1329 case OMP_CLAUSE_SIMD
:
1330 pp_string (pp
, "simd");
1332 case OMP_CLAUSE_INDEPENDENT
:
1333 pp_string (pp
, "independent");
1335 case OMP_CLAUSE_TILE
:
1336 pp_string (pp
, "tile(");
1337 dump_generic_node (pp
, OMP_CLAUSE_TILE_LIST (clause
),
1339 pp_right_paren (pp
);
1342 case OMP_CLAUSE_IF_PRESENT
:
1343 pp_string (pp
, "if_present");
1345 case OMP_CLAUSE_FINALIZE
:
1346 pp_string (pp
, "finalize");
1348 case OMP_CLAUSE_NOHOST
:
1349 pp_string (pp
, "nohost");
1351 case OMP_CLAUSE_DETACH
:
1352 pp_string (pp
, "detach(");
1353 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
), spc
, flags
,
1355 pp_right_paren (pp
);
1364 /* Dump chain of OMP clauses.
1366 PP, SPC and FLAGS are as in dump_generic_node. */
1369 dump_omp_clauses (pretty_printer
*pp
, tree clause
, int spc
, dump_flags_t flags
,
1376 dump_omp_clause (pp
, clause
, spc
, flags
);
1377 leading_space
= true;
1379 clause
= OMP_CLAUSE_CHAIN (clause
);
1384 /* Dump location LOC to PP. */
1387 dump_location (pretty_printer
*pp
, location_t loc
)
1389 expanded_location xloc
= expand_location (loc
);
1391 pp_left_bracket (pp
);
1394 pp_string (pp
, xloc
.file
);
1395 pp_string (pp
, ":");
1397 pp_decimal_int (pp
, xloc
.line
);
1399 pp_decimal_int (pp
, xloc
.column
);
1400 pp_string (pp
, "] ");
1404 /* Dump lexical block BLOCK. PP, SPC and FLAGS are as in
1405 dump_generic_node. */
1408 dump_block_node (pretty_printer
*pp
, tree block
, int spc
, dump_flags_t flags
)
1412 pp_string (pp
, "BLOCK #");
1413 pp_decimal_int (pp
, BLOCK_NUMBER (block
));
1414 pp_character (pp
, ' ');
1416 if (flags
& TDF_ADDRESS
)
1418 pp_character (pp
, '[');
1419 pp_scalar (pp
, "%p", (void *) block
);
1420 pp_string (pp
, "] ");
1423 if (TREE_ASM_WRITTEN (block
))
1424 pp_string (pp
, "[written] ");
1426 if (flags
& TDF_SLIM
)
1429 if (BLOCK_SOURCE_LOCATION (block
))
1430 dump_location (pp
, BLOCK_SOURCE_LOCATION (block
));
1432 newline_and_indent (pp
, spc
+ 2);
1434 if (BLOCK_SUPERCONTEXT (block
))
1436 pp_string (pp
, "SUPERCONTEXT: ");
1437 dump_generic_node (pp
, BLOCK_SUPERCONTEXT (block
), 0,
1438 flags
| TDF_SLIM
, false);
1439 newline_and_indent (pp
, spc
+ 2);
1442 if (BLOCK_SUBBLOCKS (block
))
1444 pp_string (pp
, "SUBBLOCKS: ");
1445 for (t
= BLOCK_SUBBLOCKS (block
); t
; t
= BLOCK_CHAIN (t
))
1447 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
1450 newline_and_indent (pp
, spc
+ 2);
1453 if (BLOCK_CHAIN (block
))
1455 pp_string (pp
, "SIBLINGS: ");
1456 for (t
= BLOCK_CHAIN (block
); t
; t
= BLOCK_CHAIN (t
))
1458 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
1461 newline_and_indent (pp
, spc
+ 2);
1464 if (BLOCK_VARS (block
))
1466 pp_string (pp
, "VARS: ");
1467 for (t
= BLOCK_VARS (block
); t
; t
= TREE_CHAIN (t
))
1469 dump_generic_node (pp
, t
, 0, flags
, false);
1472 newline_and_indent (pp
, spc
+ 2);
1475 if (vec_safe_length (BLOCK_NONLOCALIZED_VARS (block
)) > 0)
1478 vec
<tree
, va_gc
> *nlv
= BLOCK_NONLOCALIZED_VARS (block
);
1480 pp_string (pp
, "NONLOCALIZED_VARS: ");
1481 FOR_EACH_VEC_ELT (*nlv
, i
, t
)
1483 dump_generic_node (pp
, t
, 0, flags
, false);
1486 newline_and_indent (pp
, spc
+ 2);
1489 if (BLOCK_ABSTRACT_ORIGIN (block
))
1491 pp_string (pp
, "ABSTRACT_ORIGIN: ");
1492 dump_generic_node (pp
, BLOCK_ABSTRACT_ORIGIN (block
), 0,
1493 flags
| TDF_SLIM
, false);
1494 newline_and_indent (pp
, spc
+ 2);
1497 if (BLOCK_FRAGMENT_ORIGIN (block
))
1499 pp_string (pp
, "FRAGMENT_ORIGIN: ");
1500 dump_generic_node (pp
, BLOCK_FRAGMENT_ORIGIN (block
), 0,
1501 flags
| TDF_SLIM
, false);
1502 newline_and_indent (pp
, spc
+ 2);
1505 if (BLOCK_FRAGMENT_CHAIN (block
))
1507 pp_string (pp
, "FRAGMENT_CHAIN: ");
1508 for (t
= BLOCK_FRAGMENT_CHAIN (block
); t
; t
= BLOCK_FRAGMENT_CHAIN (t
))
1510 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
1513 newline_and_indent (pp
, spc
+ 2);
1517 /* Dump #pragma omp atomic memory order clause. */
1520 dump_omp_atomic_memory_order (pretty_printer
*pp
, enum omp_memory_order mo
)
1522 switch (mo
& OMP_MEMORY_ORDER_MASK
)
1524 case OMP_MEMORY_ORDER_RELAXED
:
1525 pp_string (pp
, " relaxed");
1527 case OMP_MEMORY_ORDER_SEQ_CST
:
1528 pp_string (pp
, " seq_cst");
1530 case OMP_MEMORY_ORDER_ACQ_REL
:
1531 pp_string (pp
, " acq_rel");
1533 case OMP_MEMORY_ORDER_ACQUIRE
:
1534 pp_string (pp
, " acquire");
1536 case OMP_MEMORY_ORDER_RELEASE
:
1537 pp_string (pp
, " release");
1539 case OMP_MEMORY_ORDER_UNSPECIFIED
:
1544 switch (mo
& OMP_FAIL_MEMORY_ORDER_MASK
)
1546 case OMP_FAIL_MEMORY_ORDER_RELAXED
:
1547 pp_string (pp
, " fail(relaxed)");
1549 case OMP_FAIL_MEMORY_ORDER_SEQ_CST
:
1550 pp_string (pp
, " fail(seq_cst)");
1552 case OMP_FAIL_MEMORY_ORDER_ACQUIRE
:
1553 pp_string (pp
, " fail(acquire)");
1555 case OMP_FAIL_MEMORY_ORDER_UNSPECIFIED
:
1562 /* Helper to dump a MEM_REF node. */
1565 dump_mem_ref (pretty_printer
*pp
, tree node
, int spc
, dump_flags_t flags
)
1567 if (TREE_CODE (node
) == MEM_REF
&& (flags
& TDF_GIMPLE
))
1569 pp_string (pp
, "__MEM <");
1570 dump_generic_node (pp
, TREE_TYPE (node
),
1571 spc
, flags
| TDF_SLIM
, false);
1572 if (TYPE_ALIGN (TREE_TYPE (node
))
1573 != TYPE_ALIGN (TYPE_MAIN_VARIANT (TREE_TYPE (node
))))
1575 pp_string (pp
, ", ");
1576 pp_decimal_int (pp
, TYPE_ALIGN (TREE_TYPE (node
)));
1579 pp_string (pp
, " (");
1580 if (TREE_TYPE (TREE_OPERAND (node
, 0))
1581 != TREE_TYPE (TREE_OPERAND (node
, 1)))
1584 dump_generic_node (pp
, TREE_TYPE (TREE_OPERAND (node
, 1)),
1585 spc
, flags
| TDF_SLIM
, false);
1586 pp_right_paren (pp
);
1588 dump_generic_node (pp
, TREE_OPERAND (node
, 0),
1589 spc
, flags
| TDF_SLIM
, false);
1590 if (! integer_zerop (TREE_OPERAND (node
, 1)))
1592 pp_string (pp
, " + ");
1593 dump_generic_node (pp
, TREE_OPERAND (node
, 1),
1594 spc
, flags
| TDF_SLIM
, false);
1596 pp_right_paren (pp
);
1598 else if (TREE_CODE (node
) == MEM_REF
1599 && integer_zerop (TREE_OPERAND (node
, 1))
1600 /* Dump the types of INTEGER_CSTs explicitly, for we can't
1601 infer them and MEM_ATTR caching will share MEM_REFs
1602 with differently-typed op0s. */
1603 && TREE_CODE (TREE_OPERAND (node
, 0)) != INTEGER_CST
1604 /* Released SSA_NAMES have no TREE_TYPE. */
1605 && TREE_TYPE (TREE_OPERAND (node
, 0)) != NULL_TREE
1606 /* Same pointer types, but ignoring POINTER_TYPE vs.
1608 && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 0)))
1609 == TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 1))))
1610 && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (node
, 0)))
1611 == TYPE_MODE (TREE_TYPE (TREE_OPERAND (node
, 1))))
1612 && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node
, 0)))
1613 == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node
, 1))))
1614 /* Same value types ignoring qualifiers. */
1615 && (TYPE_MAIN_VARIANT (TREE_TYPE (node
))
1616 == TYPE_MAIN_VARIANT
1617 (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 1)))))
1618 && (!(flags
& TDF_ALIAS
)
1619 || MR_DEPENDENCE_CLIQUE (node
) == 0))
1621 if (TREE_CODE (TREE_OPERAND (node
, 0)) != ADDR_EXPR
)
1623 /* Enclose pointers to arrays in parentheses. */
1624 tree op0
= TREE_OPERAND (node
, 0);
1625 tree op0type
= TREE_TYPE (op0
);
1626 if (POINTER_TYPE_P (op0type
)
1627 && TREE_CODE (TREE_TYPE (op0type
)) == ARRAY_TYPE
)
1630 dump_generic_node (pp
, op0
, spc
, flags
, false);
1631 if (POINTER_TYPE_P (op0type
)
1632 && TREE_CODE (TREE_TYPE (op0type
)) == ARRAY_TYPE
)
1633 pp_right_paren (pp
);
1636 dump_generic_node (pp
,
1637 TREE_OPERAND (TREE_OPERAND (node
, 0), 0),
1642 pp_string (pp
, "MEM");
1644 tree nodetype
= TREE_TYPE (node
);
1645 tree op0
= TREE_OPERAND (node
, 0);
1646 tree op1
= TREE_OPERAND (node
, 1);
1647 tree op1type
= TYPE_MAIN_VARIANT (TREE_TYPE (op1
));
1649 tree op0size
= TYPE_SIZE (nodetype
);
1650 tree op1size
= TYPE_SIZE (TREE_TYPE (op1type
));
1652 if (!op0size
|| !op1size
1653 || !operand_equal_p (op0size
, op1size
, 0))
1655 pp_string (pp
, " <");
1656 /* If the size of the type of the operand is not the same
1657 as the size of the MEM_REF expression include the type
1658 of the latter similar to the TDF_GIMPLE output to make
1659 it clear how many bytes of memory are being accessed. */
1660 dump_generic_node (pp
, nodetype
, spc
, flags
| TDF_SLIM
, false);
1661 pp_string (pp
, "> ");
1664 pp_string (pp
, "[(");
1665 dump_generic_node (pp
, op1type
, spc
, flags
| TDF_SLIM
, false);
1666 pp_right_paren (pp
);
1667 dump_generic_node (pp
, op0
, spc
, flags
, false);
1668 if (!integer_zerop (op1
))
1670 pp_string (pp
, " + ");
1671 dump_generic_node (pp
, op1
, spc
, flags
, false);
1673 if (TREE_CODE (node
) == TARGET_MEM_REF
)
1675 tree tmp
= TMR_INDEX2 (node
);
1678 pp_string (pp
, " + ");
1679 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1681 tmp
= TMR_INDEX (node
);
1684 pp_string (pp
, " + ");
1685 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1686 tmp
= TMR_STEP (node
);
1687 pp_string (pp
, " * ");
1689 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1691 pp_string (pp
, "1");
1694 if ((flags
& TDF_ALIAS
)
1695 && MR_DEPENDENCE_CLIQUE (node
) != 0)
1697 pp_string (pp
, " clique ");
1698 pp_unsigned_wide_integer (pp
, MR_DEPENDENCE_CLIQUE (node
));
1699 pp_string (pp
, " base ");
1700 pp_unsigned_wide_integer (pp
, MR_DEPENDENCE_BASE (node
));
1702 pp_right_bracket (pp
);
1706 /* Helper function for dump_generic_node. Dump INIT or COND expression for
1707 OpenMP loop non-rectangular iterators. */
1710 dump_omp_loop_non_rect_expr (pretty_printer
*pp
, tree node
, int spc
,
1713 gcc_assert (TREE_CODE (node
) == TREE_VEC
);
1714 dump_generic_node (pp
, TREE_VEC_ELT (node
, 0), spc
, flags
, false);
1715 pp_string (pp
, " * ");
1716 if (op_prio (TREE_VEC_ELT (node
, 1)) <= op_code_prio (MULT_EXPR
))
1719 dump_generic_node (pp
, TREE_VEC_ELT (node
, 1), spc
, flags
, false);
1720 pp_right_paren (pp
);
1723 dump_generic_node (pp
, TREE_VEC_ELT (node
, 1), spc
, flags
, false);
1724 pp_string (pp
, " + ");
1725 if (op_prio (TREE_VEC_ELT (node
, 1)) <= op_code_prio (PLUS_EXPR
))
1728 dump_generic_node (pp
, TREE_VEC_ELT (node
, 2), spc
, flags
, false);
1729 pp_right_paren (pp
);
1732 dump_generic_node (pp
, TREE_VEC_ELT (node
, 2), spc
, flags
, false);
1735 /* Dump the node NODE on the pretty_printer PP, SPC spaces of
1736 indent. FLAGS specifies details to show in the dump (see TDF_* in
1737 dumpfile.h). If IS_STMT is true, the object printed is considered
1738 to be a statement and it is terminated by ';' if appropriate. */
1741 dump_generic_node (pretty_printer
*pp
, tree node
, int spc
, dump_flags_t flags
,
1748 enum tree_code code
;
1750 if (node
== NULL_TREE
)
1753 is_expr
= EXPR_P (node
);
1755 if (is_stmt
&& (flags
& TDF_STMTADDR
))
1757 pp_string (pp
, "<&");
1758 pp_scalar (pp
, "%p", (void *)node
);
1759 pp_string (pp
, "> ");
1762 if ((flags
& TDF_LINENO
) && EXPR_HAS_LOCATION (node
))
1763 dump_location (pp
, EXPR_LOCATION (node
));
1765 code
= TREE_CODE (node
);
1769 pp_string (pp
, "<<< error >>>");
1772 case IDENTIFIER_NODE
:
1773 pp_tree_identifier (pp
, node
);
1777 while (node
&& node
!= error_mark_node
)
1779 if (TREE_PURPOSE (node
))
1781 dump_generic_node (pp
, TREE_PURPOSE (node
), spc
, flags
, false);
1784 dump_generic_node (pp
, TREE_VALUE (node
), spc
, flags
, false);
1785 node
= TREE_CHAIN (node
);
1786 if (node
&& TREE_CODE (node
) == TREE_LIST
)
1795 dump_generic_node (pp
, BINFO_TYPE (node
), spc
, flags
, false);
1801 if (TREE_VEC_LENGTH (node
) > 0)
1803 size_t len
= TREE_VEC_LENGTH (node
);
1804 for (i
= 0; i
< len
- 1; i
++)
1806 dump_generic_node (pp
, TREE_VEC_ELT (node
, i
), spc
, flags
,
1811 dump_generic_node (pp
, TREE_VEC_ELT (node
, len
- 1), spc
,
1820 case FIXED_POINT_TYPE
:
1827 unsigned int quals
= TYPE_QUALS (node
);
1828 enum tree_code_class tclass
;
1830 if (quals
& TYPE_QUAL_ATOMIC
)
1831 pp_string (pp
, "atomic ");
1832 if (quals
& TYPE_QUAL_CONST
)
1833 pp_string (pp
, "const ");
1834 if (quals
& TYPE_QUAL_VOLATILE
)
1835 pp_string (pp
, "volatile ");
1836 if (quals
& TYPE_QUAL_RESTRICT
)
1837 pp_string (pp
, "restrict ");
1839 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
1841 pp_string (pp
, "<address-space-");
1842 pp_decimal_int (pp
, TYPE_ADDR_SPACE (node
));
1843 pp_string (pp
, "> ");
1846 tclass
= TREE_CODE_CLASS (TREE_CODE (node
));
1848 if (tclass
== tcc_declaration
)
1850 if (DECL_NAME (node
))
1851 dump_decl_name (pp
, node
, flags
);
1853 pp_string (pp
, "<unnamed type decl>");
1855 else if (tclass
== tcc_type
)
1857 if (TYPE_NAME (node
))
1859 if (TREE_CODE (TYPE_NAME (node
)) == IDENTIFIER_NODE
)
1860 pp_tree_identifier (pp
, TYPE_NAME (node
));
1861 else if (TREE_CODE (TYPE_NAME (node
)) == TYPE_DECL
1862 && DECL_NAME (TYPE_NAME (node
)))
1863 dump_decl_name (pp
, TYPE_NAME (node
), flags
);
1865 pp_string (pp
, "<unnamed type>");
1867 else if (TREE_CODE (node
) == VECTOR_TYPE
)
1869 pp_string (pp
, "vector");
1871 pp_wide_integer (pp
, TYPE_VECTOR_SUBPARTS (node
));
1872 pp_string (pp
, ") ");
1873 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1875 else if (TREE_CODE (node
) == INTEGER_TYPE
)
1877 if (TYPE_PRECISION (node
) == CHAR_TYPE_SIZE
)
1878 pp_string (pp
, (TYPE_UNSIGNED (node
)
1881 else if (TYPE_PRECISION (node
) == SHORT_TYPE_SIZE
)
1882 pp_string (pp
, (TYPE_UNSIGNED (node
)
1885 else if (TYPE_PRECISION (node
) == INT_TYPE_SIZE
)
1886 pp_string (pp
, (TYPE_UNSIGNED (node
)
1889 else if (TYPE_PRECISION (node
) == LONG_TYPE_SIZE
)
1890 pp_string (pp
, (TYPE_UNSIGNED (node
)
1893 else if (TYPE_PRECISION (node
) == LONG_LONG_TYPE_SIZE
)
1894 pp_string (pp
, (TYPE_UNSIGNED (node
)
1895 ? "unsigned long long"
1896 : "signed long long"));
1897 else if (TYPE_PRECISION (node
) >= CHAR_TYPE_SIZE
1898 && pow2p_hwi (TYPE_PRECISION (node
)))
1900 pp_string (pp
, (TYPE_UNSIGNED (node
) ? "uint" : "int"));
1901 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1902 pp_string (pp
, "_t");
1906 pp_string (pp
, (TYPE_UNSIGNED (node
)
1907 ? "<unnamed-unsigned:"
1908 : "<unnamed-signed:"));
1909 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1913 else if (TREE_CODE (node
) == COMPLEX_TYPE
)
1915 pp_string (pp
, "__complex__ ");
1916 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1918 else if (TREE_CODE (node
) == REAL_TYPE
)
1920 pp_string (pp
, "<float:");
1921 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1924 else if (TREE_CODE (node
) == FIXED_POINT_TYPE
)
1926 pp_string (pp
, "<fixed-point-");
1927 pp_string (pp
, TYPE_SATURATING (node
) ? "sat:" : "nonsat:");
1928 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1931 else if (TREE_CODE (node
) == BOOLEAN_TYPE
)
1933 pp_string (pp
, (TYPE_UNSIGNED (node
)
1934 ? "<unsigned-boolean:"
1935 : "<signed-boolean:"));
1936 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1939 else if (TREE_CODE (node
) == VOID_TYPE
)
1940 pp_string (pp
, "void");
1942 pp_string (pp
, "<unnamed type>");
1948 case REFERENCE_TYPE
:
1949 str
= (TREE_CODE (node
) == POINTER_TYPE
? "*" : "&");
1951 if (TREE_TYPE (node
) == NULL
)
1953 pp_string (pp
, str
);
1954 pp_string (pp
, "<null type>");
1956 else if (TREE_CODE (TREE_TYPE (node
)) == FUNCTION_TYPE
)
1958 tree fnode
= TREE_TYPE (node
);
1960 dump_generic_node (pp
, TREE_TYPE (fnode
), spc
, flags
, false);
1963 pp_string (pp
, str
);
1964 if (TYPE_IDENTIFIER (node
))
1965 dump_generic_node (pp
, TYPE_NAME (node
), spc
, flags
, false);
1966 else if (flags
& TDF_NOUID
)
1967 pp_string (pp
, "<Txxxx>");
1970 pp_string (pp
, "<T");
1971 pp_scalar (pp
, "%x", TYPE_UID (node
));
1972 pp_character (pp
, '>');
1975 pp_right_paren (pp
);
1976 dump_function_declaration (pp
, fnode
, spc
, flags
);
1980 unsigned int quals
= TYPE_QUALS (node
);
1982 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1984 pp_string (pp
, str
);
1986 if (quals
& TYPE_QUAL_CONST
)
1987 pp_string (pp
, " const");
1988 if (quals
& TYPE_QUAL_VOLATILE
)
1989 pp_string (pp
, " volatile");
1990 if (quals
& TYPE_QUAL_RESTRICT
)
1991 pp_string (pp
, " restrict");
1993 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
1995 pp_string (pp
, " <address-space-");
1996 pp_decimal_int (pp
, TYPE_ADDR_SPACE (node
));
2000 if (TYPE_REF_CAN_ALIAS_ALL (node
))
2001 pp_string (pp
, " {ref-all}");
2010 case TARGET_MEM_REF
:
2011 dump_mem_ref (pp
, node
, spc
, flags
);
2016 unsigned int quals
= TYPE_QUALS (node
);
2019 if (quals
& TYPE_QUAL_ATOMIC
)
2020 pp_string (pp
, "atomic ");
2021 if (quals
& TYPE_QUAL_CONST
)
2022 pp_string (pp
, "const ");
2023 if (quals
& TYPE_QUAL_VOLATILE
)
2024 pp_string (pp
, "volatile ");
2026 /* Print the innermost component type. */
2027 for (tmp
= TREE_TYPE (node
); TREE_CODE (tmp
) == ARRAY_TYPE
;
2028 tmp
= TREE_TYPE (tmp
))
2030 dump_generic_node (pp
, tmp
, spc
, flags
, false);
2032 /* Print the dimensions. */
2033 for (tmp
= node
; TREE_CODE (tmp
) == ARRAY_TYPE
; tmp
= TREE_TYPE (tmp
))
2034 dump_array_domain (pp
, TYPE_DOMAIN (tmp
), spc
, flags
);
2040 case QUAL_UNION_TYPE
:
2042 unsigned int quals
= TYPE_QUALS (node
);
2044 if (quals
& TYPE_QUAL_ATOMIC
)
2045 pp_string (pp
, "atomic ");
2046 if (quals
& TYPE_QUAL_CONST
)
2047 pp_string (pp
, "const ");
2048 if (quals
& TYPE_QUAL_VOLATILE
)
2049 pp_string (pp
, "volatile ");
2051 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
2053 pp_string (pp
, "<address-space-");
2054 pp_decimal_int (pp
, TYPE_ADDR_SPACE (node
));
2055 pp_string (pp
, "> ");
2058 /* Print the name of the structure. */
2059 if (TREE_CODE (node
) == RECORD_TYPE
)
2060 pp_string (pp
, "struct ");
2061 else if (TREE_CODE (node
) == UNION_TYPE
)
2062 pp_string (pp
, "union ");
2064 if (TYPE_NAME (node
))
2065 dump_generic_node (pp
, TYPE_NAME (node
), spc
, flags
, false);
2066 else if (!(flags
& TDF_SLIM
))
2067 /* FIXME: If we eliminate the 'else' above and attempt
2068 to show the fields for named types, we may get stuck
2069 following a cycle of pointers to structs. The alleged
2070 self-reference check in print_struct_decl will not detect
2071 cycles involving more than one pointer or struct type. */
2072 print_struct_decl (pp
, node
, spc
, flags
);
2081 if (flags
& TDF_GIMPLE
2082 && (POINTER_TYPE_P (TREE_TYPE (node
))
2083 || (TYPE_PRECISION (TREE_TYPE (node
))
2084 < TYPE_PRECISION (integer_type_node
))
2085 || exact_log2 (TYPE_PRECISION (TREE_TYPE (node
))) == -1
2086 || tree_int_cst_sgn (node
) < 0))
2088 pp_string (pp
, "_Literal (");
2089 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2090 pp_string (pp
, ") ");
2092 if (TREE_CODE (TREE_TYPE (node
)) == POINTER_TYPE
2093 && ! (flags
& TDF_GIMPLE
))
2095 /* In the case of a pointer, one may want to divide by the
2096 size of the pointed-to type. Unfortunately, this not
2097 straightforward. The C front-end maps expressions
2102 in such a way that the two INTEGER_CST nodes for "5" have
2103 different values but identical types. In the latter
2104 case, the 5 is multiplied by sizeof (int) in c-common.c
2105 (pointer_int_sum) to convert it to a byte address, and
2106 yet the type of the node is left unchanged. Argh. What
2107 is consistent though is that the number value corresponds
2108 to bytes (UNITS) offset.
2110 NB: Neither of the following divisors can be trivially
2111 used to recover the original literal:
2113 TREE_INT_CST_LOW (TYPE_SIZE_UNIT (TREE_TYPE (node)))
2114 TYPE_PRECISION (TREE_TYPE (TREE_TYPE (node))) */
2115 pp_wide_integer (pp
, TREE_INT_CST_LOW (node
));
2116 pp_string (pp
, "B"); /* pseudo-unit */
2118 else if (tree_fits_shwi_p (node
))
2119 pp_wide_integer (pp
, tree_to_shwi (node
));
2120 else if (tree_fits_uhwi_p (node
))
2121 pp_unsigned_wide_integer (pp
, tree_to_uhwi (node
));
2124 wide_int val
= wi::to_wide (node
);
2126 if (wi::neg_p (val
, TYPE_SIGN (TREE_TYPE (node
))))
2131 print_hex (val
, pp_buffer (pp
)->digit_buffer
);
2132 pp_string (pp
, pp_buffer (pp
)->digit_buffer
);
2134 if ((flags
& TDF_GIMPLE
)
2135 && ! (POINTER_TYPE_P (TREE_TYPE (node
))
2136 || (TYPE_PRECISION (TREE_TYPE (node
))
2137 < TYPE_PRECISION (integer_type_node
))
2138 || exact_log2 (TYPE_PRECISION (TREE_TYPE (node
))) == -1))
2140 if (TYPE_UNSIGNED (TREE_TYPE (node
)))
2141 pp_character (pp
, 'u');
2142 if (TYPE_PRECISION (TREE_TYPE (node
))
2143 == TYPE_PRECISION (unsigned_type_node
))
2145 else if (TYPE_PRECISION (TREE_TYPE (node
))
2146 == TYPE_PRECISION (long_unsigned_type_node
))
2147 pp_character (pp
, 'l');
2148 else if (TYPE_PRECISION (TREE_TYPE (node
))
2149 == TYPE_PRECISION (long_long_unsigned_type_node
))
2150 pp_string (pp
, "ll");
2152 if (TREE_OVERFLOW (node
))
2153 pp_string (pp
, "(OVF)");
2157 pp_string (pp
, "POLY_INT_CST [");
2158 dump_generic_node (pp
, POLY_INT_CST_COEFF (node
, 0), spc
, flags
, false);
2159 for (unsigned int i
= 1; i
< NUM_POLY_INT_COEFFS
; ++i
)
2161 pp_string (pp
, ", ");
2162 dump_generic_node (pp
, POLY_INT_CST_COEFF (node
, i
),
2165 pp_string (pp
, "]");
2169 /* Code copied from print_node. */
2172 if (TREE_OVERFLOW (node
))
2173 pp_string (pp
, " overflow");
2175 d
= TREE_REAL_CST (node
);
2176 if (REAL_VALUE_ISINF (d
))
2177 pp_string (pp
, REAL_VALUE_NEGATIVE (d
) ? " -Inf" : " Inf");
2178 else if (REAL_VALUE_ISNAN (d
))
2179 pp_string (pp
, " Nan");
2183 real_to_decimal (string
, &d
, sizeof (string
), 0, 1);
2184 pp_string (pp
, string
);
2192 fixed_to_decimal (string
, TREE_FIXED_CST_PTR (node
), sizeof (string
));
2193 pp_string (pp
, string
);
2198 pp_string (pp
, "__complex__ (");
2199 dump_generic_node (pp
, TREE_REALPART (node
), spc
, flags
, false);
2200 pp_string (pp
, ", ");
2201 dump_generic_node (pp
, TREE_IMAGPART (node
), spc
, flags
, false);
2202 pp_right_paren (pp
);
2207 pp_string (pp
, "\"");
2208 if (unsigned nbytes
= TREE_STRING_LENGTH (node
))
2209 pretty_print_string (pp
, TREE_STRING_POINTER (node
), nbytes
);
2210 pp_string (pp
, "\"");
2217 if (flags
& TDF_GIMPLE
)
2219 pp_string (pp
, "_Literal (");
2220 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2221 pp_string (pp
, ") ");
2223 pp_string (pp
, "{ ");
2224 unsigned HOST_WIDE_INT nunits
;
2225 if (!VECTOR_CST_NELTS (node
).is_constant (&nunits
))
2226 nunits
= vector_cst_encoded_nelts (node
);
2227 for (i
= 0; i
< nunits
; ++i
)
2230 pp_string (pp
, ", ");
2231 dump_generic_node (pp
, VECTOR_CST_ELT (node
, i
),
2234 if (!VECTOR_CST_NELTS (node
).is_constant ())
2235 pp_string (pp
, ", ...");
2236 pp_string (pp
, " }");
2242 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2244 if (TREE_CODE (node
) == METHOD_TYPE
)
2246 if (TYPE_METHOD_BASETYPE (node
))
2247 dump_generic_node (pp
, TYPE_NAME (TYPE_METHOD_BASETYPE (node
)),
2250 pp_string (pp
, "<null method basetype>");
2251 pp_colon_colon (pp
);
2253 if (TYPE_IDENTIFIER (node
))
2254 dump_generic_node (pp
, TYPE_NAME (node
), spc
, flags
, false);
2255 else if (TYPE_NAME (node
) && DECL_NAME (TYPE_NAME (node
)))
2256 dump_decl_name (pp
, TYPE_NAME (node
), flags
);
2257 else if (flags
& TDF_NOUID
)
2258 pp_string (pp
, "<Txxxx>");
2261 pp_string (pp
, "<T");
2262 pp_scalar (pp
, "%x", TYPE_UID (node
));
2263 pp_character (pp
, '>');
2265 dump_function_declaration (pp
, node
, spc
, flags
);
2270 dump_decl_name (pp
, node
, flags
);
2274 if (DECL_NAME (node
))
2275 dump_decl_name (pp
, node
, flags
);
2276 else if (LABEL_DECL_UID (node
) != -1)
2278 if (flags
& TDF_GIMPLE
)
2280 pp_character (pp
, 'L');
2281 pp_decimal_int (pp
, (int) LABEL_DECL_UID (node
));
2285 pp_string (pp
, "<L");
2286 pp_decimal_int (pp
, (int) LABEL_DECL_UID (node
));
2287 pp_character (pp
, '>');
2292 if (flags
& TDF_NOUID
)
2293 pp_string (pp
, "<D.xxxx>");
2296 if (flags
& TDF_GIMPLE
)
2298 pp_character (pp
, 'D');
2299 pp_scalar (pp
, "%u", DECL_UID (node
));
2303 pp_string (pp
, "<D.");
2304 pp_scalar (pp
, "%u", DECL_UID (node
));
2305 pp_character (pp
, '>');
2312 if (DECL_IS_UNDECLARED_BUILTIN (node
))
2314 /* Don't print the declaration of built-in types. */
2317 if (DECL_NAME (node
))
2318 dump_decl_name (pp
, node
, flags
);
2319 else if (TYPE_NAME (TREE_TYPE (node
)) != node
)
2321 pp_string (pp
, (TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
2322 ? "union" : "struct "));
2323 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2326 pp_string (pp
, "<anon>");
2332 case DEBUG_EXPR_DECL
:
2333 case NAMESPACE_DECL
:
2335 dump_decl_name (pp
, node
, flags
);
2339 pp_string (pp
, "<retval>");
2343 op0
= TREE_OPERAND (node
, 0);
2346 && (TREE_CODE (op0
) == INDIRECT_REF
2347 || (TREE_CODE (op0
) == MEM_REF
2348 && TREE_CODE (TREE_OPERAND (op0
, 0)) != ADDR_EXPR
2349 && integer_zerop (TREE_OPERAND (op0
, 1))
2350 /* Dump the types of INTEGER_CSTs explicitly, for we
2351 can't infer them and MEM_ATTR caching will share
2352 MEM_REFs with differently-typed op0s. */
2353 && TREE_CODE (TREE_OPERAND (op0
, 0)) != INTEGER_CST
2354 /* Released SSA_NAMES have no TREE_TYPE. */
2355 && TREE_TYPE (TREE_OPERAND (op0
, 0)) != NULL_TREE
2356 /* Same pointer types, but ignoring POINTER_TYPE vs.
2358 && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 0)))
2359 == TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 1))))
2360 && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0
, 0)))
2361 == TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0
, 1))))
2362 && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0
, 0)))
2363 == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0
, 1))))
2364 /* Same value types ignoring qualifiers. */
2365 && (TYPE_MAIN_VARIANT (TREE_TYPE (op0
))
2366 == TYPE_MAIN_VARIANT
2367 (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 1)))))
2368 && MR_DEPENDENCE_CLIQUE (op0
) == 0)))
2370 op0
= TREE_OPERAND (op0
, 0);
2373 if (op_prio (op0
) < op_prio (node
))
2375 dump_generic_node (pp
, op0
, spc
, flags
, false);
2376 if (op_prio (op0
) < op_prio (node
))
2377 pp_right_paren (pp
);
2378 pp_string (pp
, str
);
2379 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2380 op0
= component_ref_field_offset (node
);
2381 if (op0
&& TREE_CODE (op0
) != INTEGER_CST
)
2383 pp_string (pp
, "{off: ");
2384 dump_generic_node (pp
, op0
, spc
, flags
, false);
2385 pp_right_brace (pp
);
2390 if (flags
& TDF_GIMPLE
)
2392 pp_string (pp
, "__BIT_FIELD_REF <");
2393 dump_generic_node (pp
, TREE_TYPE (node
),
2394 spc
, flags
| TDF_SLIM
, false);
2395 if (TYPE_ALIGN (TREE_TYPE (node
))
2396 != TYPE_ALIGN (TYPE_MAIN_VARIANT (TREE_TYPE (node
))))
2398 pp_string (pp
, ", ");
2399 pp_decimal_int (pp
, TYPE_ALIGN (TREE_TYPE (node
)));
2402 pp_string (pp
, " (");
2403 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
,
2404 flags
| TDF_SLIM
, false);
2405 pp_string (pp
, ", ");
2406 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
,
2407 flags
| TDF_SLIM
, false);
2408 pp_string (pp
, ", ");
2409 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
,
2410 flags
| TDF_SLIM
, false);
2411 pp_right_paren (pp
);
2415 pp_string (pp
, "BIT_FIELD_REF <");
2416 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2417 pp_string (pp
, ", ");
2418 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2419 pp_string (pp
, ", ");
2420 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2425 case BIT_INSERT_EXPR
:
2426 pp_string (pp
, "BIT_INSERT_EXPR <");
2427 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2428 pp_string (pp
, ", ");
2429 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2430 pp_string (pp
, ", ");
2431 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2432 pp_string (pp
, " (");
2433 if (INTEGRAL_TYPE_P (TREE_TYPE (TREE_OPERAND (node
, 1))))
2435 TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (node
, 1))));
2437 dump_generic_node (pp
, TYPE_SIZE (TREE_TYPE (TREE_OPERAND (node
, 1))),
2439 pp_string (pp
, " bits)>");
2443 case ARRAY_RANGE_REF
:
2444 op0
= TREE_OPERAND (node
, 0);
2445 if (op_prio (op0
) < op_prio (node
))
2447 dump_generic_node (pp
, op0
, spc
, flags
, false);
2448 if (op_prio (op0
) < op_prio (node
))
2449 pp_right_paren (pp
);
2450 pp_left_bracket (pp
);
2451 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2452 if (TREE_CODE (node
) == ARRAY_RANGE_REF
)
2453 pp_string (pp
, " ...");
2454 pp_right_bracket (pp
);
2456 op0
= array_ref_low_bound (node
);
2457 op1
= array_ref_element_size (node
);
2459 if (!integer_zerop (op0
)
2460 || TREE_OPERAND (node
, 2)
2461 || TREE_OPERAND (node
, 3))
2463 pp_string (pp
, "{lb: ");
2464 dump_generic_node (pp
, op0
, spc
, flags
, false);
2465 pp_string (pp
, " sz: ");
2466 dump_generic_node (pp
, op1
, spc
, flags
, false);
2467 pp_right_brace (pp
);
2473 unsigned HOST_WIDE_INT ix
;
2475 bool is_struct_init
= false;
2476 bool is_array_init
= false;
2478 if (flags
& TDF_GIMPLE
)
2480 pp_string (pp
, "_Literal (");
2481 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2482 pp_string (pp
, ") ");
2485 if (TREE_CLOBBER_P (node
))
2486 pp_string (pp
, "CLOBBER");
2487 else if (TREE_CODE (TREE_TYPE (node
)) == RECORD_TYPE
2488 || TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
)
2489 is_struct_init
= true;
2490 else if (TREE_CODE (TREE_TYPE (node
)) == ARRAY_TYPE
2491 && TYPE_DOMAIN (TREE_TYPE (node
))
2492 && TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
)))
2493 && TREE_CODE (TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
))))
2496 tree minv
= TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
)));
2497 is_array_init
= true;
2498 curidx
= wi::to_widest (minv
);
2500 FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (node
), ix
, field
, val
)
2507 dump_generic_node (pp
, field
, spc
, flags
, false);
2510 else if (is_array_init
2511 && (TREE_CODE (field
) != INTEGER_CST
2512 || curidx
!= wi::to_widest (field
)))
2514 pp_left_bracket (pp
);
2515 if (TREE_CODE (field
) == RANGE_EXPR
)
2517 dump_generic_node (pp
, TREE_OPERAND (field
, 0), spc
,
2519 pp_string (pp
, " ... ");
2520 dump_generic_node (pp
, TREE_OPERAND (field
, 1), spc
,
2522 if (TREE_CODE (TREE_OPERAND (field
, 1)) == INTEGER_CST
)
2523 curidx
= wi::to_widest (TREE_OPERAND (field
, 1));
2526 dump_generic_node (pp
, field
, spc
, flags
, false);
2527 if (TREE_CODE (field
) == INTEGER_CST
)
2528 curidx
= wi::to_widest (field
);
2529 pp_string (pp
, "]=");
2534 if (val
&& TREE_CODE (val
) == ADDR_EXPR
)
2535 if (TREE_CODE (TREE_OPERAND (val
, 0)) == FUNCTION_DECL
)
2536 val
= TREE_OPERAND (val
, 0);
2537 if (val
&& TREE_CODE (val
) == FUNCTION_DECL
)
2538 dump_decl_name (pp
, val
, flags
);
2540 dump_generic_node (pp
, val
, spc
, flags
, false);
2541 if (ix
!= CONSTRUCTOR_NELTS (node
) - 1)
2547 pp_right_brace (pp
);
2554 if (flags
& TDF_SLIM
)
2556 pp_string (pp
, "<COMPOUND_EXPR>");
2560 dump_generic_node (pp
, TREE_OPERAND (node
, 0),
2561 spc
, flags
, !(flags
& TDF_SLIM
));
2562 if (flags
& TDF_SLIM
)
2563 newline_and_indent (pp
, spc
);
2570 for (tp
= &TREE_OPERAND (node
, 1);
2571 TREE_CODE (*tp
) == COMPOUND_EXPR
;
2572 tp
= &TREE_OPERAND (*tp
, 1))
2574 dump_generic_node (pp
, TREE_OPERAND (*tp
, 0),
2575 spc
, flags
, !(flags
& TDF_SLIM
));
2576 if (flags
& TDF_SLIM
)
2577 newline_and_indent (pp
, spc
);
2585 dump_generic_node (pp
, *tp
, spc
, flags
, !(flags
& TDF_SLIM
));
2589 case STATEMENT_LIST
:
2591 tree_stmt_iterator si
;
2594 if (flags
& TDF_SLIM
)
2596 pp_string (pp
, "<STATEMENT_LIST>");
2600 for (si
= tsi_start (node
); !tsi_end_p (si
); tsi_next (&si
))
2603 newline_and_indent (pp
, spc
);
2606 dump_generic_node (pp
, tsi_stmt (si
), spc
, flags
, true);
2613 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
,
2618 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
,
2623 pp_string (pp
, "TARGET_EXPR <");
2624 dump_generic_node (pp
, TARGET_EXPR_SLOT (node
), spc
, flags
, false);
2627 dump_generic_node (pp
, TARGET_EXPR_INITIAL (node
), spc
, flags
, false);
2632 print_declaration (pp
, DECL_EXPR_DECL (node
), spc
, flags
);
2637 if (TREE_TYPE (node
) == NULL
|| TREE_TYPE (node
) == void_type_node
)
2639 pp_string (pp
, "if (");
2640 dump_generic_node (pp
, COND_EXPR_COND (node
), spc
, flags
, false);
2641 pp_right_paren (pp
);
2642 /* The lowered cond_exprs should always be printed in full. */
2643 if (COND_EXPR_THEN (node
)
2644 && (IS_EMPTY_STMT (COND_EXPR_THEN (node
))
2645 || TREE_CODE (COND_EXPR_THEN (node
)) == GOTO_EXPR
)
2646 && COND_EXPR_ELSE (node
)
2647 && (IS_EMPTY_STMT (COND_EXPR_ELSE (node
))
2648 || TREE_CODE (COND_EXPR_ELSE (node
)) == GOTO_EXPR
))
2651 dump_generic_node (pp
, COND_EXPR_THEN (node
),
2653 if (!IS_EMPTY_STMT (COND_EXPR_ELSE (node
)))
2655 pp_string (pp
, " else ");
2656 dump_generic_node (pp
, COND_EXPR_ELSE (node
),
2660 else if (!(flags
& TDF_SLIM
))
2662 /* Output COND_EXPR_THEN. */
2663 if (COND_EXPR_THEN (node
))
2665 newline_and_indent (pp
, spc
+2);
2667 newline_and_indent (pp
, spc
+4);
2668 dump_generic_node (pp
, COND_EXPR_THEN (node
), spc
+4,
2670 newline_and_indent (pp
, spc
+2);
2671 pp_right_brace (pp
);
2674 /* Output COND_EXPR_ELSE. */
2675 if (COND_EXPR_ELSE (node
)
2676 && !IS_EMPTY_STMT (COND_EXPR_ELSE (node
)))
2678 newline_and_indent (pp
, spc
);
2679 pp_string (pp
, "else");
2680 newline_and_indent (pp
, spc
+2);
2682 newline_and_indent (pp
, spc
+4);
2683 dump_generic_node (pp
, COND_EXPR_ELSE (node
), spc
+4,
2685 newline_and_indent (pp
, spc
+2);
2686 pp_right_brace (pp
);
2693 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2697 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2701 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2707 if (!(flags
& TDF_SLIM
))
2709 if (BIND_EXPR_VARS (node
))
2713 for (op0
= BIND_EXPR_VARS (node
); op0
; op0
= DECL_CHAIN (op0
))
2715 print_declaration (pp
, op0
, spc
+2, flags
);
2720 newline_and_indent (pp
, spc
+2);
2721 dump_generic_node (pp
, BIND_EXPR_BODY (node
), spc
+2, flags
, true);
2722 newline_and_indent (pp
, spc
);
2723 pp_right_brace (pp
);
2729 if (CALL_EXPR_FN (node
) != NULL_TREE
)
2730 print_call_name (pp
, CALL_EXPR_FN (node
), flags
);
2734 pp_string (pp
, internal_fn_name (CALL_EXPR_IFN (node
)));
2737 /* Print parameters. */
2742 call_expr_arg_iterator iter
;
2743 FOR_EACH_CALL_EXPR_ARG (arg
, iter
, node
)
2745 dump_generic_node (pp
, arg
, spc
, flags
, false);
2746 if (more_call_expr_args_p (&iter
))
2753 if (CALL_EXPR_VA_ARG_PACK (node
))
2755 if (call_expr_nargs (node
) > 0)
2760 pp_string (pp
, "__builtin_va_arg_pack ()");
2762 pp_right_paren (pp
);
2764 op1
= CALL_EXPR_STATIC_CHAIN (node
);
2767 pp_string (pp
, " [static-chain: ");
2768 dump_generic_node (pp
, op1
, spc
, flags
, false);
2769 pp_right_bracket (pp
);
2772 if (CALL_EXPR_RETURN_SLOT_OPT (node
))
2773 pp_string (pp
, " [return slot optimization]");
2774 if (CALL_EXPR_TAILCALL (node
))
2775 pp_string (pp
, " [tail call]");
2778 case WITH_CLEANUP_EXPR
:
2782 case CLEANUP_POINT_EXPR
:
2783 pp_string (pp
, "<<cleanup_point ");
2784 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2785 pp_string (pp
, ">>");
2788 case PLACEHOLDER_EXPR
:
2789 pp_string (pp
, "<PLACEHOLDER_EXPR ");
2790 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2794 /* Binary arithmetic and logic expressions. */
2795 case WIDEN_PLUS_EXPR
:
2796 case WIDEN_MINUS_EXPR
:
2797 case WIDEN_SUM_EXPR
:
2798 case WIDEN_MULT_EXPR
:
2800 case MULT_HIGHPART_EXPR
:
2802 case POINTER_PLUS_EXPR
:
2803 case POINTER_DIFF_EXPR
:
2805 case TRUNC_DIV_EXPR
:
2807 case FLOOR_DIV_EXPR
:
2808 case ROUND_DIV_EXPR
:
2809 case TRUNC_MOD_EXPR
:
2811 case FLOOR_MOD_EXPR
:
2812 case ROUND_MOD_EXPR
:
2814 case EXACT_DIV_EXPR
:
2819 case WIDEN_LSHIFT_EXPR
:
2823 case TRUTH_ANDIF_EXPR
:
2824 case TRUTH_ORIF_EXPR
:
2825 case TRUTH_AND_EXPR
:
2827 case TRUTH_XOR_EXPR
:
2841 case UNORDERED_EXPR
:
2843 const char *op
= op_symbol (node
);
2844 op0
= TREE_OPERAND (node
, 0);
2845 op1
= TREE_OPERAND (node
, 1);
2847 /* When the operands are expressions with less priority,
2848 keep semantics of the tree representation. */
2849 if (op_prio (op0
) <= op_prio (node
))
2852 dump_generic_node (pp
, op0
, spc
, flags
, false);
2853 pp_right_paren (pp
);
2856 dump_generic_node (pp
, op0
, spc
, flags
, false);
2862 /* When the operands are expressions with less priority,
2863 keep semantics of the tree representation. */
2864 if (op_prio (op1
) <= op_prio (node
))
2867 dump_generic_node (pp
, op1
, spc
, flags
, false);
2868 pp_right_paren (pp
);
2871 dump_generic_node (pp
, op1
, spc
, flags
, false);
2875 /* Unary arithmetic and logic expressions. */
2877 if (flags
& TDF_GIMPLE_VAL
)
2879 pp_string (pp
, "_Literal (");
2880 dump_generic_node (pp
, TREE_TYPE (node
), spc
,
2881 flags
& ~TDF_GIMPLE_VAL
, false);
2882 pp_character (pp
, ')');
2887 case TRUTH_NOT_EXPR
:
2888 case PREDECREMENT_EXPR
:
2889 case PREINCREMENT_EXPR
:
2891 if (!(flags
& TDF_GIMPLE
)
2892 && TREE_CODE (node
) == ADDR_EXPR
2893 && (TREE_CODE (TREE_OPERAND (node
, 0)) == STRING_CST
2894 || TREE_CODE (TREE_OPERAND (node
, 0)) == FUNCTION_DECL
))
2895 /* Do not output '&' for strings and function pointers when not
2896 dumping GIMPLE FE syntax. */
2899 pp_string (pp
, op_symbol (node
));
2901 if (op_prio (TREE_OPERAND (node
, 0)) < op_prio (node
))
2904 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2905 pp_right_paren (pp
);
2908 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2911 case POSTDECREMENT_EXPR
:
2912 case POSTINCREMENT_EXPR
:
2913 if (op_prio (TREE_OPERAND (node
, 0)) < op_prio (node
))
2916 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2917 pp_right_paren (pp
);
2920 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2921 pp_string (pp
, op_symbol (node
));
2925 pp_string (pp
, "MIN_EXPR <");
2926 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2927 pp_string (pp
, ", ");
2928 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2933 pp_string (pp
, "MAX_EXPR <");
2934 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2935 pp_string (pp
, ", ");
2936 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2941 pp_string (pp
, "ABS_EXPR <");
2942 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2947 pp_string (pp
, "ABSU_EXPR <");
2948 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2956 case ADDR_SPACE_CONVERT_EXPR
:
2957 case FIXED_CONVERT_EXPR
:
2958 case FIX_TRUNC_EXPR
:
2961 type
= TREE_TYPE (node
);
2962 op0
= TREE_OPERAND (node
, 0);
2963 if (type
!= TREE_TYPE (op0
))
2966 dump_generic_node (pp
, type
, spc
, flags
, false);
2967 pp_string (pp
, ") ");
2969 if (op_prio (op0
) < op_prio (node
))
2971 dump_generic_node (pp
, op0
, spc
, flags
, false);
2972 if (op_prio (op0
) < op_prio (node
))
2973 pp_right_paren (pp
);
2976 case VIEW_CONVERT_EXPR
:
2977 if (flags
& TDF_GIMPLE
)
2978 pp_string (pp
, "__VIEW_CONVERT <");
2980 pp_string (pp
, "VIEW_CONVERT_EXPR<");
2981 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2982 pp_string (pp
, ">(");
2983 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2984 pp_right_paren (pp
);
2988 pp_string (pp
, "((");
2989 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2990 pp_string (pp
, "))");
2993 case NON_LVALUE_EXPR
:
2994 pp_string (pp
, "NON_LVALUE_EXPR <");
2995 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3000 pp_string (pp
, "SAVE_EXPR <");
3001 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3006 pp_string (pp
, "COMPLEX_EXPR <");
3007 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3008 pp_string (pp
, ", ");
3009 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3014 pp_string (pp
, "CONJ_EXPR <");
3015 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3020 if (flags
& TDF_GIMPLE
)
3022 pp_string (pp
, "__real ");
3023 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3027 pp_string (pp
, "REALPART_EXPR <");
3028 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3034 if (flags
& TDF_GIMPLE
)
3036 pp_string (pp
, "__imag ");
3037 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3041 pp_string (pp
, "IMAGPART_EXPR <");
3042 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3048 pp_string (pp
, "VA_ARG_EXPR <");
3049 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3053 case TRY_FINALLY_EXPR
:
3054 case TRY_CATCH_EXPR
:
3055 pp_string (pp
, "try");
3056 newline_and_indent (pp
, spc
+2);
3058 newline_and_indent (pp
, spc
+4);
3059 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
+4, flags
, true);
3060 newline_and_indent (pp
, spc
+2);
3061 pp_right_brace (pp
);
3062 newline_and_indent (pp
, spc
);
3063 if (TREE_CODE (node
) == TRY_CATCH_EXPR
)
3065 node
= TREE_OPERAND (node
, 1);
3066 pp_string (pp
, "catch");
3070 gcc_assert (TREE_CODE (node
) == TRY_FINALLY_EXPR
);
3071 node
= TREE_OPERAND (node
, 1);
3072 pp_string (pp
, "finally");
3073 if (TREE_CODE (node
) == EH_ELSE_EXPR
)
3075 newline_and_indent (pp
, spc
+2);
3077 newline_and_indent (pp
, spc
+4);
3078 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
+4,
3080 newline_and_indent (pp
, spc
+2);
3081 pp_right_brace (pp
);
3082 newline_and_indent (pp
, spc
);
3083 node
= TREE_OPERAND (node
, 1);
3084 pp_string (pp
, "else");
3087 newline_and_indent (pp
, spc
+2);
3089 newline_and_indent (pp
, spc
+4);
3090 dump_generic_node (pp
, node
, spc
+4, flags
, true);
3091 newline_and_indent (pp
, spc
+2);
3092 pp_right_brace (pp
);
3097 pp_string (pp
, "catch (");
3098 dump_generic_node (pp
, CATCH_TYPES (node
), spc
+2, flags
, false);
3099 pp_right_paren (pp
);
3100 newline_and_indent (pp
, spc
+2);
3102 newline_and_indent (pp
, spc
+4);
3103 dump_generic_node (pp
, CATCH_BODY (node
), spc
+4, flags
, true);
3104 newline_and_indent (pp
, spc
+2);
3105 pp_right_brace (pp
);
3109 case EH_FILTER_EXPR
:
3110 pp_string (pp
, "<<<eh_filter (");
3111 dump_generic_node (pp
, EH_FILTER_TYPES (node
), spc
+2, flags
, false);
3112 pp_string (pp
, ")>>>");
3113 newline_and_indent (pp
, spc
+2);
3115 newline_and_indent (pp
, spc
+4);
3116 dump_generic_node (pp
, EH_FILTER_FAILURE (node
), spc
+4, flags
, true);
3117 newline_and_indent (pp
, spc
+2);
3118 pp_right_brace (pp
);
3123 op0
= TREE_OPERAND (node
, 0);
3124 /* If this is for break or continue, don't bother printing it. */
3125 if (DECL_NAME (op0
))
3127 const char *name
= IDENTIFIER_POINTER (DECL_NAME (op0
));
3128 if (strcmp (name
, "break") == 0
3129 || strcmp (name
, "continue") == 0)
3132 dump_generic_node (pp
, op0
, spc
, flags
, false);
3134 if (DECL_NONLOCAL (op0
))
3135 pp_string (pp
, " [non-local]");
3139 pp_string (pp
, "while (1)");
3140 if (!(flags
& TDF_SLIM
))
3142 newline_and_indent (pp
, spc
+2);
3144 newline_and_indent (pp
, spc
+4);
3145 dump_generic_node (pp
, LOOP_EXPR_BODY (node
), spc
+4, flags
, true);
3146 newline_and_indent (pp
, spc
+2);
3147 pp_right_brace (pp
);
3153 pp_string (pp
, "// predicted ");
3154 if (PREDICT_EXPR_OUTCOME (node
))
3155 pp_string (pp
, "likely by ");
3157 pp_string (pp
, "unlikely by ");
3158 pp_string (pp
, predictor_name (PREDICT_EXPR_PREDICTOR (node
)));
3159 pp_string (pp
, " predictor.");
3163 pp_string (pp
, "ANNOTATE_EXPR <");
3164 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3165 switch ((enum annot_expr_kind
) TREE_INT_CST_LOW (TREE_OPERAND (node
, 1)))
3167 case annot_expr_ivdep_kind
:
3168 pp_string (pp
, ", ivdep");
3170 case annot_expr_unroll_kind
:
3172 pp_string (pp
, ", unroll ");
3174 (int) TREE_INT_CST_LOW (TREE_OPERAND (node
, 2)));
3177 case annot_expr_no_vector_kind
:
3178 pp_string (pp
, ", no-vector");
3180 case annot_expr_vector_kind
:
3181 pp_string (pp
, ", vector");
3183 case annot_expr_parallel_kind
:
3184 pp_string (pp
, ", parallel");
3193 pp_string (pp
, "return");
3194 op0
= TREE_OPERAND (node
, 0);
3198 if (TREE_CODE (op0
) == MODIFY_EXPR
)
3199 dump_generic_node (pp
, TREE_OPERAND (op0
, 1),
3202 dump_generic_node (pp
, op0
, spc
, flags
, false);
3207 pp_string (pp
, "if (");
3208 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3209 pp_string (pp
, ") break");
3213 pp_string (pp
, "switch (");
3214 dump_generic_node (pp
, SWITCH_COND (node
), spc
, flags
, false);
3215 pp_right_paren (pp
);
3216 if (!(flags
& TDF_SLIM
))
3218 newline_and_indent (pp
, spc
+2);
3220 if (SWITCH_BODY (node
))
3222 newline_and_indent (pp
, spc
+4);
3223 dump_generic_node (pp
, SWITCH_BODY (node
), spc
+4, flags
,
3226 newline_and_indent (pp
, spc
+2);
3227 pp_right_brace (pp
);
3233 op0
= GOTO_DESTINATION (node
);
3234 if (TREE_CODE (op0
) != SSA_NAME
&& DECL_P (op0
) && DECL_NAME (op0
))
3236 const char *name
= IDENTIFIER_POINTER (DECL_NAME (op0
));
3237 if (strcmp (name
, "break") == 0
3238 || strcmp (name
, "continue") == 0)
3240 pp_string (pp
, name
);
3244 pp_string (pp
, "goto ");
3245 dump_generic_node (pp
, op0
, spc
, flags
, false);
3249 pp_string (pp
, "__asm__");
3250 if (ASM_VOLATILE_P (node
))
3251 pp_string (pp
, " __volatile__");
3253 dump_generic_node (pp
, ASM_STRING (node
), spc
, flags
, false);
3255 dump_generic_node (pp
, ASM_OUTPUTS (node
), spc
, flags
, false);
3257 dump_generic_node (pp
, ASM_INPUTS (node
), spc
, flags
, false);
3258 if (ASM_CLOBBERS (node
))
3261 dump_generic_node (pp
, ASM_CLOBBERS (node
), spc
, flags
, false);
3263 pp_right_paren (pp
);
3266 case CASE_LABEL_EXPR
:
3267 if (CASE_LOW (node
) && CASE_HIGH (node
))
3269 pp_string (pp
, "case ");
3270 dump_generic_node (pp
, CASE_LOW (node
), spc
, flags
, false);
3271 pp_string (pp
, " ... ");
3272 dump_generic_node (pp
, CASE_HIGH (node
), spc
, flags
, false);
3274 else if (CASE_LOW (node
))
3276 pp_string (pp
, "case ");
3277 dump_generic_node (pp
, CASE_LOW (node
), spc
, flags
, false);
3280 pp_string (pp
, "default");
3285 pp_string (pp
, "OBJ_TYPE_REF(");
3286 dump_generic_node (pp
, OBJ_TYPE_REF_EXPR (node
), spc
, flags
, false);
3288 /* We omit the class type for -fcompare-debug because we may
3289 drop TYPE_BINFO early depending on debug info, and then
3290 virtual_method_call_p would return false, whereas when
3291 TYPE_BINFO is preserved it may still return true and then
3292 we'd print the class type. Compare tree and rtl dumps for
3293 libstdc++-prettyprinters/shared_ptr.cc with and without -g,
3294 for example, at occurrences of OBJ_TYPE_REF. */
3295 if (!(flags
& (TDF_SLIM
| TDF_COMPARE_DEBUG
))
3296 && virtual_method_call_p (node
, true))
3298 pp_string (pp
, "(");
3299 dump_generic_node (pp
, obj_type_ref_class (node
, true),
3301 pp_string (pp
, ")");
3303 dump_generic_node (pp
, OBJ_TYPE_REF_OBJECT (node
), spc
, flags
, false);
3305 dump_generic_node (pp
, OBJ_TYPE_REF_TOKEN (node
), spc
, flags
, false);
3306 pp_right_paren (pp
);
3310 if (SSA_NAME_IDENTIFIER (node
))
3312 if ((flags
& TDF_NOUID
)
3313 && SSA_NAME_VAR (node
)
3314 && DECL_NAMELESS (SSA_NAME_VAR (node
)))
3315 dump_fancy_name (pp
, SSA_NAME_IDENTIFIER (node
));
3316 else if (! (flags
& TDF_GIMPLE
)
3317 || SSA_NAME_VAR (node
))
3318 dump_generic_node (pp
, SSA_NAME_IDENTIFIER (node
),
3322 pp_decimal_int (pp
, SSA_NAME_VERSION (node
));
3323 if (SSA_NAME_IS_DEFAULT_DEF (node
))
3324 pp_string (pp
, "(D)");
3325 if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (node
))
3326 pp_string (pp
, "(ab)");
3329 case WITH_SIZE_EXPR
:
3330 pp_string (pp
, "WITH_SIZE_EXPR <");
3331 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3332 pp_string (pp
, ", ");
3333 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3338 pp_string (pp
, "ASSERT_EXPR <");
3339 dump_generic_node (pp
, ASSERT_EXPR_VAR (node
), spc
, flags
, false);
3340 pp_string (pp
, ", ");
3341 dump_generic_node (pp
, ASSERT_EXPR_COND (node
), spc
, flags
, false);
3346 pp_string (pp
, "scev_known");
3349 case SCEV_NOT_KNOWN
:
3350 pp_string (pp
, "scev_not_known");
3353 case POLYNOMIAL_CHREC
:
3355 dump_generic_node (pp
, CHREC_LEFT (node
), spc
, flags
, false);
3356 pp_string (pp
, ", +, ");
3357 dump_generic_node (pp
, CHREC_RIGHT (node
), spc
, flags
, false);
3358 pp_string (pp
, "}_");
3359 pp_scalar (pp
, "%u", CHREC_VARIABLE (node
));
3363 case REALIGN_LOAD_EXPR
:
3364 pp_string (pp
, "REALIGN_LOAD <");
3365 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3366 pp_string (pp
, ", ");
3367 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3368 pp_string (pp
, ", ");
3369 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3374 pp_string (pp
, " VEC_COND_EXPR < ");
3375 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3376 pp_string (pp
, " , ");
3377 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3378 pp_string (pp
, " , ");
3379 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3380 pp_string (pp
, " > ");
3384 pp_string (pp
, " VEC_PERM_EXPR < ");
3385 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3386 pp_string (pp
, " , ");
3387 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3388 pp_string (pp
, " , ");
3389 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3390 pp_string (pp
, " > ");
3394 pp_string (pp
, " DOT_PROD_EXPR < ");
3395 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3396 pp_string (pp
, ", ");
3397 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3398 pp_string (pp
, ", ");
3399 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3400 pp_string (pp
, " > ");
3403 case WIDEN_MULT_PLUS_EXPR
:
3404 pp_string (pp
, " WIDEN_MULT_PLUS_EXPR < ");
3405 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3406 pp_string (pp
, ", ");
3407 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3408 pp_string (pp
, ", ");
3409 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3410 pp_string (pp
, " > ");
3413 case WIDEN_MULT_MINUS_EXPR
:
3414 pp_string (pp
, " WIDEN_MULT_MINUS_EXPR < ");
3415 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3416 pp_string (pp
, ", ");
3417 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3418 pp_string (pp
, ", ");
3419 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3420 pp_string (pp
, " > ");
3424 pp_string (pp
, "#pragma acc parallel");
3425 goto dump_omp_clauses_body
;
3428 pp_string (pp
, "#pragma acc kernels");
3429 goto dump_omp_clauses_body
;
3432 pp_string (pp
, "#pragma acc serial");
3433 goto dump_omp_clauses_body
;
3436 pp_string (pp
, "#pragma acc data");
3437 dump_omp_clauses (pp
, OACC_DATA_CLAUSES (node
), spc
, flags
);
3440 case OACC_HOST_DATA
:
3441 pp_string (pp
, "#pragma acc host_data");
3442 dump_omp_clauses (pp
, OACC_HOST_DATA_CLAUSES (node
), spc
, flags
);
3446 pp_string (pp
, "#pragma acc declare");
3447 dump_omp_clauses (pp
, OACC_DECLARE_CLAUSES (node
), spc
, flags
);
3451 pp_string (pp
, "#pragma acc update");
3452 dump_omp_clauses (pp
, OACC_UPDATE_CLAUSES (node
), spc
, flags
);
3455 case OACC_ENTER_DATA
:
3456 pp_string (pp
, "#pragma acc enter data");
3457 dump_omp_clauses (pp
, OACC_ENTER_DATA_CLAUSES (node
), spc
, flags
);
3460 case OACC_EXIT_DATA
:
3461 pp_string (pp
, "#pragma acc exit data");
3462 dump_omp_clauses (pp
, OACC_EXIT_DATA_CLAUSES (node
), spc
, flags
);
3466 pp_string (pp
, "#pragma acc cache");
3467 dump_omp_clauses (pp
, OACC_CACHE_CLAUSES (node
), spc
, flags
);
3471 pp_string (pp
, "#pragma omp parallel");
3472 dump_omp_clauses (pp
, OMP_PARALLEL_CLAUSES (node
), spc
, flags
);
3475 dump_omp_clauses_body
:
3476 dump_omp_clauses (pp
, OMP_CLAUSES (node
), spc
, flags
);
3480 if (!(flags
& TDF_SLIM
) && OMP_BODY (node
))
3482 newline_and_indent (pp
, spc
+ 2);
3484 newline_and_indent (pp
, spc
+ 4);
3485 dump_generic_node (pp
, OMP_BODY (node
), spc
+ 4, flags
, false);
3486 newline_and_indent (pp
, spc
+ 2);
3487 pp_right_brace (pp
);
3493 pp_string (pp
, OMP_TASK_BODY (node
) ? "#pragma omp task"
3494 : "#pragma omp taskwait");
3495 dump_omp_clauses (pp
, OMP_TASK_CLAUSES (node
), spc
, flags
);
3499 pp_string (pp
, "#pragma omp for");
3503 pp_string (pp
, "#pragma omp simd");
3506 case OMP_DISTRIBUTE
:
3507 pp_string (pp
, "#pragma omp distribute");
3511 pp_string (pp
, "#pragma omp taskloop");
3515 pp_string (pp
, "#pragma omp loop");
3519 pp_string (pp
, "#pragma acc loop");
3523 pp_string (pp
, "#pragma omp teams");
3524 dump_omp_clauses (pp
, OMP_TEAMS_CLAUSES (node
), spc
, flags
);
3527 case OMP_TARGET_DATA
:
3528 pp_string (pp
, "#pragma omp target data");
3529 dump_omp_clauses (pp
, OMP_TARGET_DATA_CLAUSES (node
), spc
, flags
);
3532 case OMP_TARGET_ENTER_DATA
:
3533 pp_string (pp
, "#pragma omp target enter data");
3534 dump_omp_clauses (pp
, OMP_TARGET_ENTER_DATA_CLAUSES (node
), spc
, flags
);
3538 case OMP_TARGET_EXIT_DATA
:
3539 pp_string (pp
, "#pragma omp target exit data");
3540 dump_omp_clauses (pp
, OMP_TARGET_EXIT_DATA_CLAUSES (node
), spc
, flags
);
3545 pp_string (pp
, "#pragma omp target");
3546 dump_omp_clauses (pp
, OMP_TARGET_CLAUSES (node
), spc
, flags
);
3549 case OMP_TARGET_UPDATE
:
3550 pp_string (pp
, "#pragma omp target update");
3551 dump_omp_clauses (pp
, OMP_TARGET_UPDATE_CLAUSES (node
), spc
, flags
);
3556 dump_omp_clauses (pp
, OMP_FOR_CLAUSES (node
), spc
, flags
);
3557 if (!(flags
& TDF_SLIM
))
3561 if (OMP_FOR_PRE_BODY (node
))
3563 newline_and_indent (pp
, spc
+ 2);
3566 newline_and_indent (pp
, spc
);
3567 dump_generic_node (pp
, OMP_FOR_PRE_BODY (node
),
3570 if (OMP_FOR_INIT (node
))
3573 for (i
= 0; i
< TREE_VEC_LENGTH (OMP_FOR_INIT (node
)); i
++)
3576 newline_and_indent (pp
, spc
);
3577 pp_string (pp
, "for (");
3578 tree init
= TREE_VEC_ELT (OMP_FOR_INIT (node
), i
);
3579 if (TREE_CODE (init
) != MODIFY_EXPR
3580 || TREE_CODE (TREE_OPERAND (init
, 1)) != TREE_VEC
)
3581 dump_generic_node (pp
, init
, spc
, flags
, false);
3584 dump_generic_node (pp
, TREE_OPERAND (init
, 0),
3586 pp_string (pp
, " = ");
3587 dump_omp_loop_non_rect_expr (pp
, TREE_OPERAND (init
, 1),
3590 pp_string (pp
, "; ");
3591 tree cond
= TREE_VEC_ELT (OMP_FOR_COND (node
), i
);
3592 if (!COMPARISON_CLASS_P (cond
)
3593 || TREE_CODE (TREE_OPERAND (cond
, 1)) != TREE_VEC
)
3594 dump_generic_node (pp
, cond
, spc
, flags
, false);
3597 dump_generic_node (pp
, TREE_OPERAND (cond
, 0),
3599 const char *op
= op_symbol (cond
);
3603 dump_omp_loop_non_rect_expr (pp
, TREE_OPERAND (cond
, 1),
3606 pp_string (pp
, "; ");
3607 dump_generic_node (pp
,
3608 TREE_VEC_ELT (OMP_FOR_INCR (node
), i
),
3610 pp_right_paren (pp
);
3613 if (OMP_FOR_BODY (node
))
3615 newline_and_indent (pp
, spc
+ 2);
3617 newline_and_indent (pp
, spc
+ 4);
3618 dump_generic_node (pp
, OMP_FOR_BODY (node
), spc
+ 4, flags
,
3620 newline_and_indent (pp
, spc
+ 2);
3621 pp_right_brace (pp
);
3623 if (OMP_FOR_INIT (node
))
3624 spc
-= 2 * TREE_VEC_LENGTH (OMP_FOR_INIT (node
)) - 2;
3625 if (OMP_FOR_PRE_BODY (node
))
3628 newline_and_indent (pp
, spc
+ 2);
3629 pp_right_brace (pp
);
3636 pp_string (pp
, "#pragma omp sections");
3637 dump_omp_clauses (pp
, OMP_SECTIONS_CLAUSES (node
), spc
, flags
);
3641 pp_string (pp
, "#pragma omp section");
3645 if (OMP_SCAN_CLAUSES (node
))
3647 pp_string (pp
, "#pragma omp scan");
3648 dump_omp_clauses (pp
, OMP_SCAN_CLAUSES (node
), spc
, flags
);
3653 pp_string (pp
, "#pragma omp master");
3657 pp_string (pp
, "#pragma omp masked");
3658 dump_omp_clauses (pp
, OMP_MASKED_CLAUSES (node
), spc
, flags
);
3662 pp_string (pp
, "#pragma omp taskgroup");
3663 dump_omp_clauses (pp
, OMP_TASKGROUP_CLAUSES (node
), spc
, flags
);
3667 pp_string (pp
, "#pragma omp ordered");
3668 dump_omp_clauses (pp
, OMP_ORDERED_CLAUSES (node
), spc
, flags
);
3672 pp_string (pp
, "#pragma omp critical");
3673 if (OMP_CRITICAL_NAME (node
))
3677 dump_generic_node (pp
, OMP_CRITICAL_NAME (node
), spc
,
3679 pp_right_paren (pp
);
3681 dump_omp_clauses (pp
, OMP_CRITICAL_CLAUSES (node
), spc
, flags
);
3685 pp_string (pp
, "#pragma omp atomic");
3686 if (OMP_ATOMIC_WEAK (node
))
3687 pp_string (pp
, " weak");
3688 dump_omp_atomic_memory_order (pp
, OMP_ATOMIC_MEMORY_ORDER (node
));
3689 newline_and_indent (pp
, spc
+ 2);
3690 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3694 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3697 case OMP_ATOMIC_READ
:
3698 pp_string (pp
, "#pragma omp atomic read");
3699 dump_omp_atomic_memory_order (pp
, OMP_ATOMIC_MEMORY_ORDER (node
));
3700 newline_and_indent (pp
, spc
+ 2);
3701 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3705 case OMP_ATOMIC_CAPTURE_OLD
:
3706 case OMP_ATOMIC_CAPTURE_NEW
:
3707 pp_string (pp
, "#pragma omp atomic capture");
3708 if (OMP_ATOMIC_WEAK (node
))
3709 pp_string (pp
, " weak");
3710 dump_omp_atomic_memory_order (pp
, OMP_ATOMIC_MEMORY_ORDER (node
));
3711 newline_and_indent (pp
, spc
+ 2);
3712 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3716 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3720 pp_string (pp
, "#pragma omp single");
3721 dump_omp_clauses (pp
, OMP_SINGLE_CLAUSES (node
), spc
, flags
);
3725 pp_string (pp
, "#pragma omp scope");
3726 dump_omp_clauses (pp
, OMP_SCOPE_CLAUSES (node
), spc
, flags
);
3730 /* If we come here, we're dumping something that's not an OMP construct,
3731 for example, OMP clauses attached to a function's '__attribute__'.
3732 Dump the whole OMP clause chain. */
3733 dump_omp_clauses (pp
, node
, spc
, flags
, false);
3737 case TRANSACTION_EXPR
:
3738 if (TRANSACTION_EXPR_OUTER (node
))
3739 pp_string (pp
, "__transaction_atomic [[outer]]");
3740 else if (TRANSACTION_EXPR_RELAXED (node
))
3741 pp_string (pp
, "__transaction_relaxed");
3743 pp_string (pp
, "__transaction_atomic");
3744 if (!(flags
& TDF_SLIM
) && TRANSACTION_EXPR_BODY (node
))
3746 newline_and_indent (pp
, spc
);
3748 newline_and_indent (pp
, spc
+ 2);
3749 dump_generic_node (pp
, TRANSACTION_EXPR_BODY (node
),
3750 spc
+ 2, flags
, false);
3751 newline_and_indent (pp
, spc
);
3752 pp_right_brace (pp
);
3757 case VEC_SERIES_EXPR
:
3758 case VEC_WIDEN_MULT_HI_EXPR
:
3759 case VEC_WIDEN_MULT_LO_EXPR
:
3760 case VEC_WIDEN_PLUS_HI_EXPR
:
3761 case VEC_WIDEN_PLUS_LO_EXPR
:
3762 case VEC_WIDEN_MINUS_HI_EXPR
:
3763 case VEC_WIDEN_MINUS_LO_EXPR
:
3764 case VEC_WIDEN_MULT_EVEN_EXPR
:
3765 case VEC_WIDEN_MULT_ODD_EXPR
:
3766 case VEC_WIDEN_LSHIFT_HI_EXPR
:
3767 case VEC_WIDEN_LSHIFT_LO_EXPR
:
3769 for (str
= get_tree_code_name (code
); *str
; str
++)
3770 pp_character (pp
, TOUPPER (*str
));
3771 pp_string (pp
, " < ");
3772 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3773 pp_string (pp
, ", ");
3774 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3775 pp_string (pp
, " > ");
3778 case VEC_DUPLICATE_EXPR
:
3780 for (str
= get_tree_code_name (code
); *str
; str
++)
3781 pp_character (pp
, TOUPPER (*str
));
3782 pp_string (pp
, " < ");
3783 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3784 pp_string (pp
, " > ");
3787 case VEC_UNPACK_HI_EXPR
:
3788 pp_string (pp
, " VEC_UNPACK_HI_EXPR < ");
3789 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3790 pp_string (pp
, " > ");
3793 case VEC_UNPACK_LO_EXPR
:
3794 pp_string (pp
, " VEC_UNPACK_LO_EXPR < ");
3795 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3796 pp_string (pp
, " > ");
3799 case VEC_UNPACK_FLOAT_HI_EXPR
:
3800 pp_string (pp
, " VEC_UNPACK_FLOAT_HI_EXPR < ");
3801 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3802 pp_string (pp
, " > ");
3805 case VEC_UNPACK_FLOAT_LO_EXPR
:
3806 pp_string (pp
, " VEC_UNPACK_FLOAT_LO_EXPR < ");
3807 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3808 pp_string (pp
, " > ");
3811 case VEC_UNPACK_FIX_TRUNC_HI_EXPR
:
3812 pp_string (pp
, " VEC_UNPACK_FIX_TRUNC_HI_EXPR < ");
3813 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3814 pp_string (pp
, " > ");
3817 case VEC_UNPACK_FIX_TRUNC_LO_EXPR
:
3818 pp_string (pp
, " VEC_UNPACK_FIX_TRUNC_LO_EXPR < ");
3819 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3820 pp_string (pp
, " > ");
3823 case VEC_PACK_TRUNC_EXPR
:
3824 pp_string (pp
, " VEC_PACK_TRUNC_EXPR < ");
3825 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3826 pp_string (pp
, ", ");
3827 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3828 pp_string (pp
, " > ");
3831 case VEC_PACK_SAT_EXPR
:
3832 pp_string (pp
, " VEC_PACK_SAT_EXPR < ");
3833 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3834 pp_string (pp
, ", ");
3835 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3836 pp_string (pp
, " > ");
3839 case VEC_PACK_FIX_TRUNC_EXPR
:
3840 pp_string (pp
, " VEC_PACK_FIX_TRUNC_EXPR < ");
3841 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3842 pp_string (pp
, ", ");
3843 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3844 pp_string (pp
, " > ");
3847 case VEC_PACK_FLOAT_EXPR
:
3848 pp_string (pp
, " VEC_PACK_FLOAT_EXPR < ");
3849 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3850 pp_string (pp
, ", ");
3851 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3852 pp_string (pp
, " > ");
3856 dump_block_node (pp
, node
, spc
, flags
);
3859 case DEBUG_BEGIN_STMT
:
3860 pp_string (pp
, "# DEBUG BEGIN STMT");
3867 if (is_stmt
&& is_expr
)
3873 /* Print the declaration of a variable. */
3876 print_declaration (pretty_printer
*pp
, tree t
, int spc
, dump_flags_t flags
)
3880 if (TREE_CODE(t
) == NAMELIST_DECL
)
3882 pp_string(pp
, "namelist ");
3883 dump_decl_name (pp
, t
, flags
);
3888 if (TREE_CODE (t
) == TYPE_DECL
)
3889 pp_string (pp
, "typedef ");
3891 if (CODE_CONTAINS_STRUCT (TREE_CODE (t
), TS_DECL_WRTL
) && DECL_REGISTER (t
))
3892 pp_string (pp
, "register ");
3894 if (TREE_PUBLIC (t
) && DECL_EXTERNAL (t
))
3895 pp_string (pp
, "extern ");
3896 else if (TREE_STATIC (t
))
3897 pp_string (pp
, "static ");
3899 /* Print the type and name. */
3900 if (TREE_TYPE (t
) && TREE_CODE (TREE_TYPE (t
)) == ARRAY_TYPE
)
3904 /* Print array's type. */
3905 tmp
= TREE_TYPE (t
);
3906 while (TREE_CODE (TREE_TYPE (tmp
)) == ARRAY_TYPE
)
3907 tmp
= TREE_TYPE (tmp
);
3908 dump_generic_node (pp
, TREE_TYPE (tmp
), spc
, flags
, false);
3910 /* Print variable's name. */
3912 dump_generic_node (pp
, t
, spc
, flags
, false);
3914 /* Print the dimensions. */
3915 tmp
= TREE_TYPE (t
);
3916 while (TREE_CODE (tmp
) == ARRAY_TYPE
)
3918 dump_array_domain (pp
, TYPE_DOMAIN (tmp
), spc
, flags
);
3919 tmp
= TREE_TYPE (tmp
);
3922 else if (TREE_CODE (t
) == FUNCTION_DECL
)
3924 dump_generic_node (pp
, TREE_TYPE (TREE_TYPE (t
)), spc
, flags
, false);
3926 dump_decl_name (pp
, t
, flags
);
3927 dump_function_declaration (pp
, TREE_TYPE (t
), spc
, flags
);
3931 /* Print type declaration. */
3932 dump_generic_node (pp
, TREE_TYPE (t
), spc
, flags
, false);
3934 /* Print variable's name. */
3936 dump_generic_node (pp
, t
, spc
, flags
, false);
3939 if (VAR_P (t
) && DECL_HARD_REGISTER (t
))
3941 pp_string (pp
, " __asm__ ");
3943 dump_generic_node (pp
, DECL_ASSEMBLER_NAME (t
), spc
, flags
, false);
3944 pp_right_paren (pp
);
3947 /* The initial value of a function serves to determine whether the function
3948 is declared or defined. So the following does not apply to function
3950 if (TREE_CODE (t
) != FUNCTION_DECL
)
3952 /* Print the initial value. */
3953 if (DECL_INITIAL (t
))
3958 if (!(flags
& TDF_SLIM
))
3959 dump_generic_node (pp
, DECL_INITIAL (t
), spc
, flags
, false);
3961 pp_string (pp
, "<<< omitted >>>");
3965 if (VAR_P (t
) && DECL_HAS_VALUE_EXPR_P (t
))
3967 pp_string (pp
, " [value-expr: ");
3968 dump_generic_node (pp
, DECL_VALUE_EXPR (t
), spc
, flags
, false);
3969 pp_right_bracket (pp
);
3976 /* Prints a structure: name, fields, and methods.
3977 FIXME: Still incomplete. */
3980 print_struct_decl (pretty_printer
*pp
, const_tree node
, int spc
,
3983 /* Print the name of the structure. */
3984 if (TYPE_NAME (node
))
3987 if (TREE_CODE (node
) == RECORD_TYPE
)
3988 pp_string (pp
, "struct ");
3989 else if ((TREE_CODE (node
) == UNION_TYPE
3990 || TREE_CODE (node
) == QUAL_UNION_TYPE
))
3991 pp_string (pp
, "union ");
3993 dump_generic_node (pp
, TYPE_NAME (node
), spc
, TDF_NONE
, false);
3996 /* Print the contents of the structure. */
4002 /* Print the fields of the structure. */
4005 tmp
= TYPE_FIELDS (node
);
4008 /* Avoid to print recursively the structure. */
4009 /* FIXME : Not implemented correctly...,
4010 what about the case when we have a cycle in the contain graph? ...
4011 Maybe this could be solved by looking at the scope in which the
4012 structure was declared. */
4013 if (TREE_TYPE (tmp
) != node
4014 && (TREE_CODE (TREE_TYPE (tmp
)) != POINTER_TYPE
4015 || TREE_TYPE (TREE_TYPE (tmp
)) != node
))
4017 print_declaration (pp
, tmp
, spc
+2, flags
);
4020 tmp
= DECL_CHAIN (tmp
);
4024 pp_right_brace (pp
);
4027 /* Return the priority of the operator CODE.
4029 From lowest to highest precedence with either left-to-right (L-R)
4030 or right-to-left (R-L) associativity]:
4033 2 [R-L] = += -= *= /= %= &= ^= |= <<= >>=
4045 14 [R-L] ! ~ ++ -- + - * & (type) sizeof
4046 15 [L-R] fn() [] -> .
4048 unary +, - and * have higher precedence than the corresponding binary
4052 op_code_prio (enum tree_code code
)
4069 case TRUTH_ORIF_EXPR
:
4072 case TRUTH_AND_EXPR
:
4073 case TRUTH_ANDIF_EXPR
:
4080 case TRUTH_XOR_EXPR
:
4097 case UNORDERED_EXPR
:
4108 case VEC_WIDEN_LSHIFT_HI_EXPR
:
4109 case VEC_WIDEN_LSHIFT_LO_EXPR
:
4110 case WIDEN_LSHIFT_EXPR
:
4113 case WIDEN_SUM_EXPR
:
4115 case POINTER_PLUS_EXPR
:
4116 case POINTER_DIFF_EXPR
:
4120 case VEC_WIDEN_MULT_HI_EXPR
:
4121 case VEC_WIDEN_MULT_LO_EXPR
:
4122 case WIDEN_MULT_EXPR
:
4124 case WIDEN_MULT_PLUS_EXPR
:
4125 case WIDEN_MULT_MINUS_EXPR
:
4127 case MULT_HIGHPART_EXPR
:
4128 case TRUNC_DIV_EXPR
:
4130 case FLOOR_DIV_EXPR
:
4131 case ROUND_DIV_EXPR
:
4133 case EXACT_DIV_EXPR
:
4134 case TRUNC_MOD_EXPR
:
4136 case FLOOR_MOD_EXPR
:
4137 case ROUND_MOD_EXPR
:
4140 case TRUTH_NOT_EXPR
:
4142 case POSTINCREMENT_EXPR
:
4143 case POSTDECREMENT_EXPR
:
4144 case PREINCREMENT_EXPR
:
4145 case PREDECREMENT_EXPR
:
4151 case FIX_TRUNC_EXPR
:
4157 case ARRAY_RANGE_REF
:
4161 /* Special expressions. */
4167 case VEC_UNPACK_HI_EXPR
:
4168 case VEC_UNPACK_LO_EXPR
:
4169 case VEC_UNPACK_FLOAT_HI_EXPR
:
4170 case VEC_UNPACK_FLOAT_LO_EXPR
:
4171 case VEC_UNPACK_FIX_TRUNC_HI_EXPR
:
4172 case VEC_UNPACK_FIX_TRUNC_LO_EXPR
:
4173 case VEC_PACK_TRUNC_EXPR
:
4174 case VEC_PACK_SAT_EXPR
:
4178 /* Return an arbitrarily high precedence to avoid surrounding single
4179 VAR_DECLs in ()s. */
4184 /* Return the priority of the operator OP. */
4187 op_prio (const_tree op
)
4189 enum tree_code code
;
4194 code
= TREE_CODE (op
);
4195 if (code
== SAVE_EXPR
|| code
== NON_LVALUE_EXPR
)
4196 return op_prio (TREE_OPERAND (op
, 0));
4198 return op_code_prio (code
);
4201 /* Return the symbol associated with operator CODE. */
4204 op_symbol_code (enum tree_code code
)
4212 case TRUTH_ORIF_EXPR
:
4215 case TRUTH_AND_EXPR
:
4216 case TRUTH_ANDIF_EXPR
:
4222 case TRUTH_XOR_EXPR
:
4232 case UNORDERED_EXPR
:
4278 case WIDEN_LSHIFT_EXPR
:
4281 case WIDEN_PLUS_EXPR
:
4284 case WIDEN_MINUS_EXPR
:
4287 case POINTER_PLUS_EXPR
:
4293 case WIDEN_SUM_EXPR
:
4296 case WIDEN_MULT_EXPR
:
4299 case MULT_HIGHPART_EXPR
:
4304 case POINTER_DIFF_EXPR
:
4310 case TRUTH_NOT_EXPR
:
4317 case TRUNC_DIV_EXPR
:
4324 case FLOOR_DIV_EXPR
:
4327 case ROUND_DIV_EXPR
:
4330 case EXACT_DIV_EXPR
:
4333 case TRUNC_MOD_EXPR
:
4339 case FLOOR_MOD_EXPR
:
4342 case ROUND_MOD_EXPR
:
4345 case PREDECREMENT_EXPR
:
4348 case PREINCREMENT_EXPR
:
4351 case POSTDECREMENT_EXPR
:
4354 case POSTINCREMENT_EXPR
:
4364 return "<<< ??? >>>";
4368 /* Return the symbol associated with operator OP. */
4371 op_symbol (const_tree op
)
4373 return op_symbol_code (TREE_CODE (op
));
4376 /* Prints the name of a call. NODE is the CALL_EXPR_FN of a CALL_EXPR or
4377 the gimple_call_fn of a GIMPLE_CALL. */
4380 print_call_name (pretty_printer
*pp
, tree node
, dump_flags_t flags
)
4384 if (TREE_CODE (op0
) == NON_LVALUE_EXPR
)
4385 op0
= TREE_OPERAND (op0
, 0);
4388 switch (TREE_CODE (op0
))
4393 dump_function_name (pp
, op0
, flags
);
4399 op0
= TREE_OPERAND (op0
, 0);
4404 dump_generic_node (pp
, TREE_OPERAND (op0
, 0), 0, flags
, false);
4405 pp_string (pp
, ") ? ");
4406 dump_generic_node (pp
, TREE_OPERAND (op0
, 1), 0, flags
, false);
4407 pp_string (pp
, " : ");
4408 dump_generic_node (pp
, TREE_OPERAND (op0
, 2), 0, flags
, false);
4412 if (TREE_CODE (TREE_OPERAND (op0
, 0)) == VAR_DECL
)
4413 dump_function_name (pp
, TREE_OPERAND (op0
, 0), flags
);
4415 dump_generic_node (pp
, op0
, 0, flags
, false);
4419 if (integer_zerop (TREE_OPERAND (op0
, 1)))
4421 op0
= TREE_OPERAND (op0
, 0);
4428 dump_generic_node (pp
, op0
, 0, flags
, false);
4436 /* Print the first N characters in the array STR, replacing non-printable
4437 characters (including embedded nuls) with unambiguous escape sequences. */
4440 pretty_print_string (pretty_printer
*pp
, const char *str
, size_t n
)
4445 for ( ; n
; --n
, ++str
)
4450 pp_string (pp
, "\\b");
4454 pp_string (pp
, "\\f");
4458 pp_string (pp
, "\\n");
4462 pp_string (pp
, "\\r");
4466 pp_string (pp
, "\\t");
4470 pp_string (pp
, "\\v");
4474 pp_string (pp
, "\\\\");
4478 pp_string (pp
, "\\\"");
4482 pp_string (pp
, "\\'");
4486 if (str
[0] || n
> 1)
4488 if (!ISPRINT (str
[0]))
4491 sprintf (buf
, "\\x%02x", (unsigned char)str
[0]);
4492 pp_string (pp
, buf
);
4495 pp_character (pp
, str
[0]);
4503 maybe_init_pretty_print (FILE *file
)
4507 tree_pp
= new pretty_printer ();
4508 pp_needs_newline (tree_pp
) = true;
4509 pp_translate_identifiers (tree_pp
) = false;
4512 tree_pp
->buffer
->stream
= file
;
4516 newline_and_indent (pretty_printer
*pp
, int spc
)
4522 /* Print the identifier ID to PRETTY-PRINTER. */
4525 pp_tree_identifier (pretty_printer
*pp
, tree id
)
4527 if (pp_translate_identifiers (pp
))
4529 const char *text
= identifier_to_locale (IDENTIFIER_POINTER (id
));
4530 pp_append_text (pp
, text
, text
+ strlen (text
));
4533 pp_append_text (pp
, IDENTIFIER_POINTER (id
),
4534 IDENTIFIER_POINTER (id
) + IDENTIFIER_LENGTH (id
));
4537 /* A helper function that is used to dump function information before the
4541 dump_function_header (FILE *dump_file
, tree fdecl
, dump_flags_t flags
)
4543 const char *dname
, *aname
;
4544 struct cgraph_node
*node
= cgraph_node::get (fdecl
);
4545 struct function
*fun
= DECL_STRUCT_FUNCTION (fdecl
);
4547 dname
= lang_hooks
.decl_printable_name (fdecl
, 1);
4549 if (DECL_ASSEMBLER_NAME_SET_P (fdecl
))
4550 aname
= (IDENTIFIER_POINTER
4551 (DECL_ASSEMBLER_NAME (fdecl
)));
4553 aname
= "<unset-asm-name>";
4555 fprintf (dump_file
, "\n;; Function %s (%s, funcdef_no=%d",
4556 dname
, aname
, fun
->funcdef_no
);
4557 if (!(flags
& TDF_NOUID
))
4558 fprintf (dump_file
, ", decl_uid=%d", DECL_UID (fdecl
));
4561 fprintf (dump_file
, ", cgraph_uid=%d", node
->get_uid ());
4562 fprintf (dump_file
, ", symbol_order=%d)%s\n\n", node
->order
,
4563 node
->frequency
== NODE_FREQUENCY_HOT
4565 : node
->frequency
== NODE_FREQUENCY_UNLIKELY_EXECUTED
4566 ? " (unlikely executed)"
4567 : node
->frequency
== NODE_FREQUENCY_EXECUTED_ONCE
4568 ? " (executed once)"
4572 fprintf (dump_file
, ")\n\n");
4575 /* Dump double_int D to pretty_printer PP. UNS is true
4576 if D is unsigned and false otherwise. */
4578 pp_double_int (pretty_printer
*pp
, double_int d
, bool uns
)
4581 pp_wide_integer (pp
, d
.low
);
4582 else if (d
.fits_uhwi ())
4583 pp_unsigned_wide_integer (pp
, d
.low
);
4586 unsigned HOST_WIDE_INT low
= d
.low
;
4587 HOST_WIDE_INT high
= d
.high
;
4588 if (!uns
&& d
.is_negative ())
4591 high
= ~high
+ !low
;
4594 /* Would "%x%0*x" or "%x%*0x" get zero-padding on all
4596 sprintf (pp_buffer (pp
)->digit_buffer
,
4597 HOST_WIDE_INT_PRINT_DOUBLE_HEX
,
4598 (unsigned HOST_WIDE_INT
) high
, low
);
4599 pp_string (pp
, pp_buffer (pp
)->digit_buffer
);
4604 # pragma GCC diagnostic pop