1 /* Pretty formatting of GENERIC trees in C syntax.
2 Copyright (C) 2001-2024 Free Software Foundation, Inc.
3 Adapted from c-pretty-print.cc by Diego Novillo <dnovillo@redhat.com>
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 3, or (at your option) any later
12 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING3. If not see
19 <http://www.gnu.org/licenses/>. */
23 #include "coretypes.h"
29 #include "tree-pretty-print.h"
30 #include "stor-layout.h"
31 #include "langhooks.h"
32 #include "tree-iterator.h"
34 #include "internal-fn.h"
35 #include "gomp-constants.h"
37 #include "fold-const.h"
38 #include "omp-general.h"
40 /* Routines in this file get invoked via the default tree printer
41 used by diagnostics and thus they are called from pp_printf which
42 isn't reentrant. Avoid using pp_printf in this file. */
43 #pragma GCC poison pp_printf
45 /* Disable warnings about quoting issues in the pp_xxx calls below
46 that (intentionally) don't follow GCC diagnostic conventions. */
48 # pragma GCC diagnostic push
49 # pragma GCC diagnostic ignored "-Wformat-diag"
52 /* Local functions, macros and variables. */
53 static const char *op_symbol (const_tree
, dump_flags_t
= TDF_NONE
);
54 static void newline_and_indent (pretty_printer
*, int);
55 static void maybe_init_pretty_print (FILE *);
56 static void print_struct_decl (pretty_printer
*, const_tree
, int, dump_flags_t
);
57 static void do_niy (pretty_printer
*, const_tree
, int, dump_flags_t
);
59 #define INDENT(SPACE) do { \
60 int i; for (i = 0; i<SPACE; i++) pp_space (pp); } while (0)
62 #define NIY do_niy (pp, node, spc, flags)
64 static pretty_printer
*tree_pp
;
66 /* Try to print something for an unknown tree code. */
69 do_niy (pretty_printer
*pp
, const_tree node
, int spc
, dump_flags_t flags
)
73 pp_string (pp
, "<<< Unknown tree: ");
74 pp_string (pp
, get_tree_code_name (TREE_CODE (node
)));
78 len
= TREE_OPERAND_LENGTH (node
);
79 for (i
= 0; i
< len
; ++i
)
81 newline_and_indent (pp
, spc
+2);
82 dump_generic_node (pp
, TREE_OPERAND (node
, i
), spc
+2, flags
, false);
86 pp_string (pp
, " >>>");
89 /* Debugging function to print out a generic expression. */
92 debug_generic_expr (tree t
)
94 print_generic_expr (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
);
95 fprintf (stderr
, "\n");
98 /* Debugging function to print out a generic statement. */
101 debug_generic_stmt (tree t
)
103 print_generic_stmt (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
);
104 fprintf (stderr
, "\n");
107 /* Debugging function to print out a chain of trees . */
110 debug_tree_chain (tree t
)
116 print_generic_expr (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
|TDF_UID
);
117 fprintf (stderr
, " ");
121 fprintf (stderr
, "... [cycled back to ");
122 print_generic_expr (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
|TDF_UID
);
123 fprintf (stderr
, "]");
127 fprintf (stderr
, "\n");
130 /* Prints declaration DECL to the FILE with details specified by FLAGS. */
132 print_generic_decl (FILE *file
, tree decl
, dump_flags_t flags
)
134 maybe_init_pretty_print (file
);
135 print_declaration (tree_pp
, decl
, 2, flags
);
136 pp_write_text_to_stream (tree_pp
);
139 /* Print tree T, and its successors, on file FILE. FLAGS specifies details
140 to show in the dump. See TDF_* in dumpfile.h. */
143 print_generic_stmt (FILE *file
, tree t
, dump_flags_t flags
)
145 maybe_init_pretty_print (file
);
146 dump_generic_node (tree_pp
, t
, 0, flags
, true);
147 pp_newline_and_flush (tree_pp
);
150 /* Print tree T, and its successors, on file FILE. FLAGS specifies details
151 to show in the dump. See TDF_* in dumpfile.h. The output is indented by
155 print_generic_stmt_indented (FILE *file
, tree t
, dump_flags_t flags
, int indent
)
159 maybe_init_pretty_print (file
);
161 for (i
= 0; i
< indent
; i
++)
163 dump_generic_node (tree_pp
, t
, indent
, flags
, true);
164 pp_newline_and_flush (tree_pp
);
167 /* Print a single expression T on file FILE. FLAGS specifies details to show
168 in the dump. See TDF_* in dumpfile.h. */
171 print_generic_expr (FILE *file
, tree t
, dump_flags_t flags
)
173 maybe_init_pretty_print (file
);
174 dump_generic_node (tree_pp
, t
, 0, flags
, false);
178 /* Print a single expression T to string, and return it. The caller
179 must free the returned memory. */
182 print_generic_expr_to_str (tree t
)
185 dump_generic_node (&pp
, t
, 0, TDF_VOPS
|TDF_MEMSYMS
, false);
186 return xstrdup (pp_formatted_text (&pp
));
189 /* Dump NAME, an IDENTIFIER_POINTER, sanitized so that D<num> sequences
190 in it are replaced with Dxxxx, as long as they are at the start or
191 preceded by $ and at the end or followed by $. See make_fancy_name
195 dump_fancy_name (pretty_printer
*pp
, tree name
)
198 int length
= IDENTIFIER_LENGTH (name
);
199 const char *n
= IDENTIFIER_POINTER (name
);
206 && (n
== IDENTIFIER_POINTER (name
) || n
[-1] == '$'))
209 while (ISDIGIT (n
[l
]))
211 if (n
[l
] == '\0' || n
[l
] == '$')
224 pp_tree_identifier (pp
, name
);
228 char *str
= XNEWVEC (char, length
+ 1);
231 q
= n
= IDENTIFIER_POINTER (name
);
238 && (q
== IDENTIFIER_POINTER (name
) || q
[-1] == '$'))
241 while (ISDIGIT (q
[l
]))
243 if (q
[l
] == '\0' || q
[l
] == '$')
245 memcpy (p
, n
, q
- n
);
246 memcpy (p
+ (q
- n
), "Dxxxx", 5);
256 memcpy (p
, n
, IDENTIFIER_LENGTH (name
) - (n
- IDENTIFIER_POINTER (name
)));
258 if (pp_translate_identifiers (pp
))
260 const char *text
= identifier_to_locale (str
);
261 pp_append_text (pp
, text
, text
+ strlen (text
));
264 pp_append_text (pp
, str
, str
+ length
);
268 /* Dump the name of a _DECL node and its DECL_UID if TDF_UID is set
272 dump_decl_name (pretty_printer
*pp
, tree node
, dump_flags_t flags
)
274 tree name
= DECL_NAME (node
);
277 if ((flags
& TDF_ASMNAME
)
278 && HAS_DECL_ASSEMBLER_NAME_P (node
)
279 && DECL_ASSEMBLER_NAME_SET_P (node
))
280 pp_tree_identifier (pp
, DECL_ASSEMBLER_NAME_RAW (node
));
281 /* For -fcompare-debug don't dump DECL_NAMELESS names at all,
282 -g might have created more fancy names and their indexes
283 could get out of sync. Usually those should be DECL_IGNORED_P
284 too, SRA can create even non-DECL_IGNORED_P DECL_NAMELESS fancy
285 names, let's hope those never get out of sync after doing the
286 dump_fancy_name sanitization. */
287 else if ((flags
& TDF_COMPARE_DEBUG
)
288 && DECL_NAMELESS (node
)
289 && DECL_IGNORED_P (node
))
291 /* For DECL_NAMELESS names look for embedded uids in the
292 names and sanitize them for TDF_NOUID. */
293 else if ((flags
& TDF_NOUID
) && DECL_NAMELESS (node
))
294 dump_fancy_name (pp
, name
);
296 pp_tree_identifier (pp
, name
);
298 char uid_sep
= (flags
& TDF_GIMPLE
) ? '_' : '.';
299 if ((flags
& TDF_UID
) || name
== NULL_TREE
)
301 if (TREE_CODE (node
) == LABEL_DECL
&& LABEL_DECL_UID (node
) != -1)
303 pp_character (pp
, 'L');
304 pp_character (pp
, uid_sep
);
305 pp_decimal_int (pp
, (int) LABEL_DECL_UID (node
));
307 else if (TREE_CODE (node
) == DEBUG_EXPR_DECL
)
309 if (flags
& TDF_NOUID
)
310 pp_string (pp
, "D#xxxx");
313 pp_string (pp
, "D#");
314 pp_decimal_int (pp
, (int) DEBUG_TEMP_UID (node
));
319 char c
= TREE_CODE (node
) == CONST_DECL
? 'C' : 'D';
320 pp_character (pp
, c
);
321 pp_character (pp
, uid_sep
);
322 if (flags
& TDF_NOUID
)
323 pp_string (pp
, "xxxx");
325 pp_scalar (pp
, "%u", DECL_UID (node
));
328 if ((flags
& TDF_ALIAS
) && DECL_PT_UID (node
) != DECL_UID (node
))
330 if (flags
& TDF_NOUID
)
331 pp_string (pp
, "ptD.xxxx");
334 pp_string (pp
, "ptD.");
335 pp_scalar (pp
, "%u", DECL_PT_UID (node
));
340 /* Like the above, but used for pretty printing function calls. */
343 dump_function_name (pretty_printer
*pp
, tree node
, dump_flags_t flags
)
345 if (CONVERT_EXPR_P (node
))
346 node
= TREE_OPERAND (node
, 0);
347 if (DECL_NAME (node
) && (flags
& TDF_ASMNAME
) == 0)
349 pp_string (pp
, lang_hooks
.decl_printable_name (node
, 1));
352 char uid_sep
= (flags
& TDF_GIMPLE
) ? '_' : '.';
353 pp_character (pp
, 'D');
354 pp_character (pp
, uid_sep
);
355 pp_scalar (pp
, "%u", DECL_UID (node
));
359 dump_decl_name (pp
, node
, flags
);
362 /* Dump a function declaration. NODE is the FUNCTION_TYPE. PP, SPC and
363 FLAGS are as in dump_generic_node. */
366 dump_function_declaration (pretty_printer
*pp
, tree node
,
367 int spc
, dump_flags_t flags
)
369 bool wrote_arg
= false;
375 /* Print the argument types. */
376 arg
= TYPE_ARG_TYPES (node
);
377 while (arg
&& arg
!= void_list_node
&& arg
!= error_mark_node
)
385 dump_generic_node (pp
, TREE_VALUE (arg
), spc
, flags
, false);
386 arg
= TREE_CHAIN (arg
);
389 /* Drop the trailing void_type_node if we had any previous argument. */
390 if (arg
== void_list_node
&& !wrote_arg
)
391 pp_string (pp
, "void");
392 /* Properly dump vararg function types. */
393 else if (!arg
&& wrote_arg
)
394 pp_string (pp
, ", ...");
395 /* Avoid printing any arg for unprototyped functions. */
400 /* Dump the domain associated with an array. */
403 dump_array_domain (pretty_printer
*pp
, tree domain
, int spc
, dump_flags_t flags
)
405 pp_left_bracket (pp
);
408 tree min
= TYPE_MIN_VALUE (domain
);
409 tree max
= TYPE_MAX_VALUE (domain
);
412 && integer_zerop (min
)
413 && tree_fits_shwi_p (max
))
414 pp_wide_integer (pp
, tree_to_shwi (max
) + 1);
418 dump_generic_node (pp
, min
, spc
, flags
, false);
421 dump_generic_node (pp
, max
, spc
, flags
, false);
425 pp_string (pp
, "<unknown>");
426 pp_right_bracket (pp
);
430 /* Dump OpenMP iterators ITER. */
433 dump_omp_iterators (pretty_printer
*pp
, tree iter
, int spc
, dump_flags_t flags
)
435 pp_string (pp
, "iterator(");
436 for (tree it
= iter
; it
; it
= TREE_CHAIN (it
))
439 pp_string (pp
, ", ");
440 dump_generic_node (pp
, TREE_TYPE (TREE_VEC_ELT (it
, 0)), spc
, flags
,
443 dump_generic_node (pp
, TREE_VEC_ELT (it
, 0), spc
, flags
, false);
445 dump_generic_node (pp
, TREE_VEC_ELT (it
, 1), spc
, flags
, false);
447 dump_generic_node (pp
, TREE_VEC_ELT (it
, 2), spc
, flags
, false);
449 dump_generic_node (pp
, TREE_VEC_ELT (it
, 3), spc
, flags
, false);
455 /* Dump OMP clause CLAUSE, without following OMP_CLAUSE_CHAIN.
457 PP, CLAUSE, SPC and FLAGS are as in dump_generic_node. */
460 dump_omp_clause (pretty_printer
*pp
, tree clause
, int spc
, dump_flags_t flags
)
463 const char *modifier
= NULL
;
464 switch (OMP_CLAUSE_CODE (clause
))
466 case OMP_CLAUSE_PRIVATE
:
469 case OMP_CLAUSE_SHARED
:
472 case OMP_CLAUSE_FIRSTPRIVATE
:
473 name
= "firstprivate";
475 case OMP_CLAUSE_LASTPRIVATE
:
476 name
= "lastprivate";
477 if (OMP_CLAUSE_LASTPRIVATE_CONDITIONAL (clause
))
478 modifier
= "conditional:";
480 case OMP_CLAUSE_COPYIN
:
483 case OMP_CLAUSE_COPYPRIVATE
:
484 name
= "copyprivate";
486 case OMP_CLAUSE_UNIFORM
:
489 case OMP_CLAUSE_USE_DEVICE_PTR
:
490 name
= "use_device_ptr";
491 if (OMP_CLAUSE_USE_DEVICE_PTR_IF_PRESENT (clause
))
492 modifier
= "if_present:";
494 case OMP_CLAUSE_USE_DEVICE_ADDR
:
495 name
= "use_device_addr";
497 case OMP_CLAUSE_HAS_DEVICE_ADDR
:
498 name
= "has_device_addr";
500 case OMP_CLAUSE_IS_DEVICE_PTR
:
501 name
= "is_device_ptr";
503 case OMP_CLAUSE_INCLUSIVE
:
506 case OMP_CLAUSE_EXCLUSIVE
:
509 case OMP_CLAUSE__LOOPTEMP_
:
512 case OMP_CLAUSE__REDUCTEMP_
:
513 name
= "_reductemp_";
515 case OMP_CLAUSE__CONDTEMP_
:
518 case OMP_CLAUSE__SCANTEMP_
:
521 case OMP_CLAUSE_ENTER
:
522 if (OMP_CLAUSE_ENTER_TO (clause
))
527 case OMP_CLAUSE_LINK
:
530 case OMP_CLAUSE_NONTEMPORAL
:
531 name
= "nontemporal";
534 pp_string (pp
, name
);
537 pp_string (pp
, modifier
);
538 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
543 case OMP_CLAUSE_TASK_REDUCTION
:
544 case OMP_CLAUSE_IN_REDUCTION
:
545 pp_string (pp
, OMP_CLAUSE_CODE (clause
) == OMP_CLAUSE_IN_REDUCTION
548 case OMP_CLAUSE_REDUCTION
:
549 pp_string (pp
, "reduction(");
550 if (OMP_CLAUSE_CODE (clause
) == OMP_CLAUSE_REDUCTION
)
552 if (OMP_CLAUSE_REDUCTION_TASK (clause
))
553 pp_string (pp
, "task,");
554 else if (OMP_CLAUSE_REDUCTION_INSCAN (clause
))
555 pp_string (pp
, "inscan,");
557 if (OMP_CLAUSE_REDUCTION_CODE (clause
) != ERROR_MARK
)
560 op_symbol_code (OMP_CLAUSE_REDUCTION_CODE (clause
)));
563 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
569 pp_string (pp
, "if(");
570 switch (OMP_CLAUSE_IF_MODIFIER (clause
))
572 case ERROR_MARK
: break;
573 case VOID_CST
: pp_string (pp
, "cancel:"); break;
574 case OMP_PARALLEL
: pp_string (pp
, "parallel:"); break;
575 case OMP_SIMD
: pp_string (pp
, "simd:"); break;
576 case OMP_TASK
: pp_string (pp
, "task:"); break;
577 case OMP_TASKLOOP
: pp_string (pp
, "taskloop:"); break;
578 case OMP_TARGET_DATA
: pp_string (pp
, "target data:"); break;
579 case OMP_TARGET
: pp_string (pp
, "target:"); break;
580 case OMP_TARGET_UPDATE
: pp_string (pp
, "target update:"); break;
581 case OMP_TARGET_ENTER_DATA
:
582 pp_string (pp
, "target enter data:"); break;
583 case OMP_TARGET_EXIT_DATA
: pp_string (pp
, "target exit data:"); break;
584 default: gcc_unreachable ();
586 dump_generic_node (pp
, OMP_CLAUSE_IF_EXPR (clause
),
591 case OMP_CLAUSE_SELF
:
592 pp_string (pp
, "self(");
593 dump_generic_node (pp
, OMP_CLAUSE_SELF_EXPR (clause
),
598 case OMP_CLAUSE_NUM_THREADS
:
599 pp_string (pp
, "num_threads(");
600 dump_generic_node (pp
, OMP_CLAUSE_NUM_THREADS_EXPR (clause
),
605 case OMP_CLAUSE_NOWAIT
:
606 pp_string (pp
, "nowait");
608 case OMP_CLAUSE_ORDERED
:
609 pp_string (pp
, "ordered");
610 if (OMP_CLAUSE_ORDERED_EXPR (clause
))
613 dump_generic_node (pp
, OMP_CLAUSE_ORDERED_EXPR (clause
),
619 case OMP_CLAUSE_DEFAULT
:
620 pp_string (pp
, "default(");
621 switch (OMP_CLAUSE_DEFAULT_KIND (clause
))
623 case OMP_CLAUSE_DEFAULT_UNSPECIFIED
:
625 case OMP_CLAUSE_DEFAULT_SHARED
:
626 pp_string (pp
, "shared");
628 case OMP_CLAUSE_DEFAULT_NONE
:
629 pp_string (pp
, "none");
631 case OMP_CLAUSE_DEFAULT_PRIVATE
:
632 pp_string (pp
, "private");
634 case OMP_CLAUSE_DEFAULT_FIRSTPRIVATE
:
635 pp_string (pp
, "firstprivate");
637 case OMP_CLAUSE_DEFAULT_PRESENT
:
638 pp_string (pp
, "present");
646 case OMP_CLAUSE_SCHEDULE
:
647 pp_string (pp
, "schedule(");
648 if (OMP_CLAUSE_SCHEDULE_KIND (clause
)
649 & (OMP_CLAUSE_SCHEDULE_MONOTONIC
650 | OMP_CLAUSE_SCHEDULE_NONMONOTONIC
))
652 if (OMP_CLAUSE_SCHEDULE_KIND (clause
)
653 & OMP_CLAUSE_SCHEDULE_MONOTONIC
)
654 pp_string (pp
, "monotonic");
656 pp_string (pp
, "nonmonotonic");
657 if (OMP_CLAUSE_SCHEDULE_SIMD (clause
))
662 if (OMP_CLAUSE_SCHEDULE_SIMD (clause
))
663 pp_string (pp
, "simd:");
665 switch (OMP_CLAUSE_SCHEDULE_KIND (clause
) & OMP_CLAUSE_SCHEDULE_MASK
)
667 case OMP_CLAUSE_SCHEDULE_STATIC
:
668 pp_string (pp
, "static");
670 case OMP_CLAUSE_SCHEDULE_DYNAMIC
:
671 pp_string (pp
, "dynamic");
673 case OMP_CLAUSE_SCHEDULE_GUIDED
:
674 pp_string (pp
, "guided");
676 case OMP_CLAUSE_SCHEDULE_RUNTIME
:
677 pp_string (pp
, "runtime");
679 case OMP_CLAUSE_SCHEDULE_AUTO
:
680 pp_string (pp
, "auto");
685 if (OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (clause
))
688 dump_generic_node (pp
, OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (clause
),
694 case OMP_CLAUSE_UNTIED
:
695 pp_string (pp
, "untied");
698 case OMP_CLAUSE_COLLAPSE
:
699 pp_string (pp
, "collapse(");
700 dump_generic_node (pp
, OMP_CLAUSE_COLLAPSE_EXPR (clause
),
705 case OMP_CLAUSE_FINAL
:
706 pp_string (pp
, "final(");
707 dump_generic_node (pp
, OMP_CLAUSE_FINAL_EXPR (clause
),
712 case OMP_CLAUSE_MERGEABLE
:
713 pp_string (pp
, "mergeable");
716 case OMP_CLAUSE_LINEAR
:
717 pp_string (pp
, "linear(");
718 if (OMP_CLAUSE_LINEAR_OLD_LINEAR_MODIFIER (clause
))
719 switch (OMP_CLAUSE_LINEAR_KIND (clause
))
721 case OMP_CLAUSE_LINEAR_DEFAULT
:
723 case OMP_CLAUSE_LINEAR_REF
:
724 pp_string (pp
, "ref(");
726 case OMP_CLAUSE_LINEAR_VAL
:
727 pp_string (pp
, "val(");
729 case OMP_CLAUSE_LINEAR_UVAL
:
730 pp_string (pp
, "uval(");
735 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
737 if (OMP_CLAUSE_LINEAR_OLD_LINEAR_MODIFIER (clause
)
738 && OMP_CLAUSE_LINEAR_KIND (clause
) != OMP_CLAUSE_LINEAR_DEFAULT
)
741 if (!OMP_CLAUSE_LINEAR_OLD_LINEAR_MODIFIER (clause
)
742 && OMP_CLAUSE_LINEAR_KIND (clause
) != OMP_CLAUSE_LINEAR_DEFAULT
)
743 switch (OMP_CLAUSE_LINEAR_KIND (clause
))
745 case OMP_CLAUSE_LINEAR_REF
:
746 pp_string (pp
, "ref,step(");
748 case OMP_CLAUSE_LINEAR_VAL
:
749 pp_string (pp
, "val,step(");
751 case OMP_CLAUSE_LINEAR_UVAL
:
752 pp_string (pp
, "uval,step(");
757 dump_generic_node (pp
, OMP_CLAUSE_LINEAR_STEP (clause
),
759 if (!OMP_CLAUSE_LINEAR_OLD_LINEAR_MODIFIER (clause
)
760 && OMP_CLAUSE_LINEAR_KIND (clause
) != OMP_CLAUSE_LINEAR_DEFAULT
)
765 case OMP_CLAUSE_ALIGNED
:
766 pp_string (pp
, "aligned(");
767 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
769 if (OMP_CLAUSE_ALIGNED_ALIGNMENT (clause
))
772 dump_generic_node (pp
, OMP_CLAUSE_ALIGNED_ALIGNMENT (clause
),
778 case OMP_CLAUSE_ALLOCATE
:
779 pp_string (pp
, "allocate(");
780 if (OMP_CLAUSE_ALLOCATE_ALLOCATOR (clause
))
782 pp_string (pp
, "allocator(");
783 dump_generic_node (pp
, OMP_CLAUSE_ALLOCATE_ALLOCATOR (clause
),
787 if (OMP_CLAUSE_ALLOCATE_ALIGN (clause
))
789 if (OMP_CLAUSE_ALLOCATE_ALLOCATOR (clause
))
791 pp_string (pp
, "align(");
792 dump_generic_node (pp
, OMP_CLAUSE_ALLOCATE_ALIGN (clause
),
796 if (OMP_CLAUSE_ALLOCATE_ALLOCATOR (clause
)
797 || OMP_CLAUSE_ALLOCATE_ALIGN (clause
))
799 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
804 case OMP_CLAUSE_AFFINITY
:
805 pp_string (pp
, "affinity(");
807 tree t
= OMP_CLAUSE_DECL (clause
);
808 if (TREE_CODE (t
) == TREE_LIST
810 && TREE_CODE (TREE_PURPOSE (t
)) == TREE_VEC
)
812 dump_omp_iterators (pp
, TREE_PURPOSE (t
), spc
, flags
);
816 dump_generic_node (pp
, t
, spc
, flags
, false);
820 case OMP_CLAUSE_DEPEND
:
821 pp_string (pp
, "depend(");
822 switch (OMP_CLAUSE_DEPEND_KIND (clause
))
824 case OMP_CLAUSE_DEPEND_DEPOBJ
:
827 case OMP_CLAUSE_DEPEND_IN
:
830 case OMP_CLAUSE_DEPEND_OUT
:
833 case OMP_CLAUSE_DEPEND_INOUT
:
836 case OMP_CLAUSE_DEPEND_MUTEXINOUTSET
:
837 name
= "mutexinoutset";
839 case OMP_CLAUSE_DEPEND_INOUTSET
:
842 case OMP_CLAUSE_DEPEND_LAST
:
843 name
= "__internal__";
849 tree t
= OMP_CLAUSE_DECL (clause
);
850 if (TREE_CODE (t
) == TREE_LIST
852 && TREE_CODE (TREE_PURPOSE (t
)) == TREE_VEC
)
854 dump_omp_iterators (pp
, TREE_PURPOSE (t
), spc
, flags
);
860 pp_string (pp
, name
);
863 if (t
== null_pointer_node
)
864 pp_string (pp
, "omp_all_memory");
866 dump_generic_node (pp
, t
, spc
, flags
, false);
871 case OMP_CLAUSE_DOACROSS
:
872 pp_string (pp
, OMP_CLAUSE_DOACROSS_DEPEND (clause
)
873 ? "depend(" : "doacross(");
874 switch (OMP_CLAUSE_DOACROSS_KIND (clause
))
876 case OMP_CLAUSE_DOACROSS_SOURCE
:
877 if (OMP_CLAUSE_DOACROSS_DEPEND (clause
))
878 pp_string (pp
, "source)");
880 pp_string (pp
, "source:)");
882 case OMP_CLAUSE_DOACROSS_SINK
:
883 pp_string (pp
, "sink:");
884 if (OMP_CLAUSE_DECL (clause
) == NULL_TREE
)
886 pp_string (pp
, "omp_cur_iteration-1)");
889 for (tree t
= OMP_CLAUSE_DECL (clause
); t
; t
= TREE_CHAIN (t
))
890 if (TREE_CODE (t
) == TREE_LIST
)
892 dump_generic_node (pp
, TREE_VALUE (t
), spc
, flags
, false);
893 if (TREE_PURPOSE (t
) != integer_zero_node
)
895 if (OMP_CLAUSE_DOACROSS_SINK_NEGATIVE (t
))
899 dump_generic_node (pp
, TREE_PURPOSE (t
), spc
, flags
,
915 pp_string (pp
, "map(");
916 if (OMP_CLAUSE_MAP_READONLY (clause
))
917 pp_string (pp
, "readonly,");
918 switch (OMP_CLAUSE_MAP_KIND (clause
))
921 case GOMP_MAP_POINTER
:
922 case GOMP_MAP_POINTER_TO_ZERO_LENGTH_ARRAY_SECTION
:
923 pp_string (pp
, "alloc");
925 case GOMP_MAP_IF_PRESENT
:
926 pp_string (pp
, "no_alloc");
929 case GOMP_MAP_TO_PSET
:
930 pp_string (pp
, "to");
933 pp_string (pp
, "from");
935 case GOMP_MAP_TOFROM
:
936 pp_string (pp
, "tofrom");
938 case GOMP_MAP_FORCE_ALLOC
:
939 pp_string (pp
, "force_alloc");
941 case GOMP_MAP_FORCE_TO
:
942 pp_string (pp
, "force_to");
944 case GOMP_MAP_FORCE_FROM
:
945 pp_string (pp
, "force_from");
947 case GOMP_MAP_FORCE_TOFROM
:
948 pp_string (pp
, "force_tofrom");
950 case GOMP_MAP_FORCE_PRESENT
:
951 pp_string (pp
, "force_present");
953 case GOMP_MAP_DELETE
:
954 pp_string (pp
, "delete");
956 case GOMP_MAP_FORCE_DEVICEPTR
:
957 pp_string (pp
, "force_deviceptr");
959 case GOMP_MAP_ALWAYS_TO
:
960 pp_string (pp
, "always,to");
962 case GOMP_MAP_ALWAYS_FROM
:
963 pp_string (pp
, "always,from");
965 case GOMP_MAP_ALWAYS_TOFROM
:
966 pp_string (pp
, "always,tofrom");
968 case GOMP_MAP_RELEASE
:
969 pp_string (pp
, "release");
971 case GOMP_MAP_FIRSTPRIVATE_POINTER
:
972 pp_string (pp
, "firstprivate");
974 case GOMP_MAP_FIRSTPRIVATE_REFERENCE
:
975 pp_string (pp
, "firstprivate ref");
977 case GOMP_MAP_STRUCT
:
978 pp_string (pp
, "struct");
980 case GOMP_MAP_STRUCT_UNORD
:
981 pp_string (pp
, "struct_unord");
983 case GOMP_MAP_ALWAYS_POINTER
:
984 pp_string (pp
, "always_pointer");
986 case GOMP_MAP_DEVICE_RESIDENT
:
987 pp_string (pp
, "device_resident");
990 pp_string (pp
, "link");
992 case GOMP_MAP_ATTACH
:
993 pp_string (pp
, "attach");
995 case GOMP_MAP_DETACH
:
996 pp_string (pp
, "detach");
998 case GOMP_MAP_FORCE_DETACH
:
999 pp_string (pp
, "force_detach");
1001 case GOMP_MAP_ATTACH_DETACH
:
1002 pp_string (pp
, "attach_detach");
1004 case GOMP_MAP_ATTACH_ZERO_LENGTH_ARRAY_SECTION
:
1005 pp_string (pp
, "attach_zero_length_array_section");
1007 case GOMP_MAP_PRESENT_ALLOC
:
1008 pp_string (pp
, "present,alloc");
1010 case GOMP_MAP_PRESENT_TO
:
1011 pp_string (pp
, "present,to");
1013 case GOMP_MAP_PRESENT_FROM
:
1014 pp_string (pp
, "present,from");
1016 case GOMP_MAP_PRESENT_TOFROM
:
1017 pp_string (pp
, "present,tofrom");
1019 case GOMP_MAP_ALWAYS_PRESENT_TO
:
1020 pp_string (pp
, "always,present,to");
1022 case GOMP_MAP_ALWAYS_PRESENT_FROM
:
1023 pp_string (pp
, "always,present,from");
1025 case GOMP_MAP_ALWAYS_PRESENT_TOFROM
:
1026 pp_string (pp
, "always,present,tofrom");
1032 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
1035 if (OMP_CLAUSE_SIZE (clause
))
1037 switch (OMP_CLAUSE_CODE (clause
) == OMP_CLAUSE_MAP
1038 ? OMP_CLAUSE_MAP_KIND (clause
) : GOMP_MAP_TO
)
1040 case GOMP_MAP_POINTER
:
1041 case GOMP_MAP_FIRSTPRIVATE_POINTER
:
1042 case GOMP_MAP_FIRSTPRIVATE_REFERENCE
:
1043 case GOMP_MAP_ALWAYS_POINTER
:
1044 pp_string (pp
, " [pointer assign, bias: ");
1046 case GOMP_MAP_POINTER_TO_ZERO_LENGTH_ARRAY_SECTION
:
1047 pp_string (pp
, " [pointer assign, zero-length array section, bias: ");
1049 case GOMP_MAP_TO_PSET
:
1050 pp_string (pp
, " [pointer set, len: ");
1052 case GOMP_MAP_ATTACH
:
1053 case GOMP_MAP_DETACH
:
1054 case GOMP_MAP_FORCE_DETACH
:
1055 case GOMP_MAP_ATTACH_DETACH
:
1056 case GOMP_MAP_ATTACH_ZERO_LENGTH_ARRAY_SECTION
:
1057 pp_string (pp
, " [bias: ");
1059 case GOMP_MAP_RELEASE
:
1060 case GOMP_MAP_DELETE
:
1061 if (OMP_CLAUSE_CODE (clause
) == OMP_CLAUSE_MAP
1062 && OMP_CLAUSE_RELEASE_DESCRIPTOR (clause
))
1064 pp_string (pp
, " [pointer set, len: ");
1069 pp_string (pp
, " [len: ");
1072 dump_generic_node (pp
, OMP_CLAUSE_SIZE (clause
),
1074 pp_right_bracket (pp
);
1076 if (OMP_CLAUSE_CODE (clause
) == OMP_CLAUSE_MAP
1077 && OMP_CLAUSE_MAP_RUNTIME_IMPLICIT_P (clause
))
1078 pp_string (pp
, "[implicit]");
1079 pp_right_paren (pp
);
1082 case OMP_CLAUSE_FROM
:
1083 pp_string (pp
, "from(");
1084 if (OMP_CLAUSE_MOTION_PRESENT (clause
))
1085 pp_string (pp
, "present:");
1086 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
1088 goto print_clause_size
;
1091 pp_string (pp
, "to(");
1092 if (OMP_CLAUSE_MOTION_PRESENT (clause
))
1093 pp_string (pp
, "present:");
1094 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
1096 goto print_clause_size
;
1098 case OMP_CLAUSE__CACHE_
:
1099 pp_string (pp
, "(");
1100 if (OMP_CLAUSE__CACHE__READONLY (clause
))
1101 pp_string (pp
, "readonly:");
1102 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
1104 goto print_clause_size
;
1106 case OMP_CLAUSE_NUM_TEAMS
:
1107 pp_string (pp
, "num_teams(");
1108 if (OMP_CLAUSE_NUM_TEAMS_LOWER_EXPR (clause
))
1110 dump_generic_node (pp
, OMP_CLAUSE_NUM_TEAMS_LOWER_EXPR (clause
),
1114 dump_generic_node (pp
, OMP_CLAUSE_NUM_TEAMS_UPPER_EXPR (clause
),
1116 pp_right_paren (pp
);
1119 case OMP_CLAUSE_THREAD_LIMIT
:
1120 pp_string (pp
, "thread_limit(");
1121 dump_generic_node (pp
, OMP_CLAUSE_THREAD_LIMIT_EXPR (clause
),
1123 pp_right_paren (pp
);
1126 case OMP_CLAUSE_DEVICE
:
1127 pp_string (pp
, "device(");
1128 if (OMP_CLAUSE_DEVICE_ANCESTOR (clause
))
1129 pp_string (pp
, "ancestor:");
1130 dump_generic_node (pp
, OMP_CLAUSE_DEVICE_ID (clause
),
1132 pp_right_paren (pp
);
1135 case OMP_CLAUSE_DIST_SCHEDULE
:
1136 pp_string (pp
, "dist_schedule(static");
1137 if (OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR (clause
))
1140 dump_generic_node (pp
,
1141 OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR (clause
),
1144 pp_right_paren (pp
);
1147 case OMP_CLAUSE_PROC_BIND
:
1148 pp_string (pp
, "proc_bind(");
1149 switch (OMP_CLAUSE_PROC_BIND_KIND (clause
))
1151 case OMP_CLAUSE_PROC_BIND_MASTER
:
1152 /* Same enum value: case OMP_CLAUSE_PROC_BIND_PRIMARY: */
1153 /* TODO: Change to 'primary' for OpenMP 5.1. */
1154 pp_string (pp
, "master");
1156 case OMP_CLAUSE_PROC_BIND_CLOSE
:
1157 pp_string (pp
, "close");
1159 case OMP_CLAUSE_PROC_BIND_SPREAD
:
1160 pp_string (pp
, "spread");
1165 pp_right_paren (pp
);
1168 case OMP_CLAUSE_DEVICE_TYPE
:
1169 pp_string (pp
, "device_type(");
1170 switch (OMP_CLAUSE_DEVICE_TYPE_KIND (clause
))
1172 case OMP_CLAUSE_DEVICE_TYPE_HOST
:
1173 pp_string (pp
, "host");
1175 case OMP_CLAUSE_DEVICE_TYPE_NOHOST
:
1176 pp_string (pp
, "nohost");
1178 case OMP_CLAUSE_DEVICE_TYPE_ANY
:
1179 pp_string (pp
, "any");
1184 pp_right_paren (pp
);
1187 case OMP_CLAUSE_SAFELEN
:
1188 pp_string (pp
, "safelen(");
1189 dump_generic_node (pp
, OMP_CLAUSE_SAFELEN_EXPR (clause
),
1191 pp_right_paren (pp
);
1194 case OMP_CLAUSE_SIMDLEN
:
1195 pp_string (pp
, "simdlen(");
1196 dump_generic_node (pp
, OMP_CLAUSE_SIMDLEN_EXPR (clause
),
1198 pp_right_paren (pp
);
1201 case OMP_CLAUSE_PRIORITY
:
1202 pp_string (pp
, "priority(");
1203 dump_generic_node (pp
, OMP_CLAUSE_PRIORITY_EXPR (clause
),
1205 pp_right_paren (pp
);
1208 case OMP_CLAUSE_GRAINSIZE
:
1209 pp_string (pp
, "grainsize(");
1210 if (OMP_CLAUSE_GRAINSIZE_STRICT (clause
))
1211 pp_string (pp
, "strict:");
1212 dump_generic_node (pp
, OMP_CLAUSE_GRAINSIZE_EXPR (clause
),
1214 pp_right_paren (pp
);
1217 case OMP_CLAUSE_NUM_TASKS
:
1218 pp_string (pp
, "num_tasks(");
1219 if (OMP_CLAUSE_NUM_TASKS_STRICT (clause
))
1220 pp_string (pp
, "strict:");
1221 dump_generic_node (pp
, OMP_CLAUSE_NUM_TASKS_EXPR (clause
),
1223 pp_right_paren (pp
);
1226 case OMP_CLAUSE_HINT
:
1227 pp_string (pp
, "hint(");
1228 dump_generic_node (pp
, OMP_CLAUSE_HINT_EXPR (clause
),
1230 pp_right_paren (pp
);
1233 case OMP_CLAUSE_FILTER
:
1234 pp_string (pp
, "filter(");
1235 dump_generic_node (pp
, OMP_CLAUSE_FILTER_EXPR (clause
),
1237 pp_right_paren (pp
);
1240 case OMP_CLAUSE_DEFAULTMAP
:
1241 pp_string (pp
, "defaultmap(");
1242 switch (OMP_CLAUSE_DEFAULTMAP_BEHAVIOR (clause
))
1244 case OMP_CLAUSE_DEFAULTMAP_ALLOC
:
1245 pp_string (pp
, "alloc");
1247 case OMP_CLAUSE_DEFAULTMAP_TO
:
1248 pp_string (pp
, "to");
1250 case OMP_CLAUSE_DEFAULTMAP_FROM
:
1251 pp_string (pp
, "from");
1253 case OMP_CLAUSE_DEFAULTMAP_TOFROM
:
1254 pp_string (pp
, "tofrom");
1256 case OMP_CLAUSE_DEFAULTMAP_FIRSTPRIVATE
:
1257 pp_string (pp
, "firstprivate");
1259 case OMP_CLAUSE_DEFAULTMAP_NONE
:
1260 pp_string (pp
, "none");
1262 case OMP_CLAUSE_DEFAULTMAP_PRESENT
:
1263 pp_string (pp
, "present");
1265 case OMP_CLAUSE_DEFAULTMAP_DEFAULT
:
1266 pp_string (pp
, "default");
1271 switch (OMP_CLAUSE_DEFAULTMAP_CATEGORY (clause
))
1273 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_UNSPECIFIED
:
1275 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_ALL
:
1276 pp_string (pp
, ":all");
1278 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_SCALAR
:
1279 pp_string (pp
, ":scalar");
1281 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_AGGREGATE
:
1282 pp_string (pp
, ":aggregate");
1284 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_ALLOCATABLE
:
1285 pp_string (pp
, ":allocatable");
1287 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_POINTER
:
1288 pp_string (pp
, ":pointer");
1293 pp_right_paren (pp
);
1296 case OMP_CLAUSE_ORDER
:
1297 pp_string (pp
, "order(");
1298 if (OMP_CLAUSE_ORDER_UNCONSTRAINED (clause
))
1299 pp_string (pp
, "unconstrained:");
1300 else if (OMP_CLAUSE_ORDER_REPRODUCIBLE (clause
))
1301 pp_string (pp
, "reproducible:");
1302 pp_string (pp
, "concurrent)");
1305 case OMP_CLAUSE_BIND
:
1306 pp_string (pp
, "bind(");
1307 switch (OMP_CLAUSE_BIND_KIND (clause
))
1309 case OMP_CLAUSE_BIND_TEAMS
:
1310 pp_string (pp
, "teams");
1312 case OMP_CLAUSE_BIND_PARALLEL
:
1313 pp_string (pp
, "parallel");
1315 case OMP_CLAUSE_BIND_THREAD
:
1316 pp_string (pp
, "thread");
1321 pp_right_paren (pp
);
1324 case OMP_CLAUSE__SIMDUID_
:
1325 pp_string (pp
, "_simduid_(");
1326 dump_generic_node (pp
, OMP_CLAUSE__SIMDUID__DECL (clause
),
1328 pp_right_paren (pp
);
1331 case OMP_CLAUSE__SIMT_
:
1332 pp_string (pp
, "_simt_");
1335 case OMP_CLAUSE_GANG
:
1336 pp_string (pp
, "gang");
1337 if (OMP_CLAUSE_GANG_EXPR (clause
) != NULL_TREE
)
1339 pp_string (pp
, "(num: ");
1340 dump_generic_node (pp
, OMP_CLAUSE_GANG_EXPR (clause
),
1343 if (OMP_CLAUSE_GANG_STATIC_EXPR (clause
) != NULL_TREE
)
1345 if (OMP_CLAUSE_GANG_EXPR (clause
) == NULL_TREE
)
1349 pp_string (pp
, "static:");
1350 if (OMP_CLAUSE_GANG_STATIC_EXPR (clause
)
1351 == integer_minus_one_node
)
1352 pp_character (pp
, '*');
1354 dump_generic_node (pp
, OMP_CLAUSE_GANG_STATIC_EXPR (clause
),
1357 if (OMP_CLAUSE_GANG_EXPR (clause
) != NULL_TREE
1358 || OMP_CLAUSE_GANG_STATIC_EXPR (clause
) != NULL_TREE
)
1359 pp_right_paren (pp
);
1362 case OMP_CLAUSE_ASYNC
:
1363 pp_string (pp
, "async");
1364 if (OMP_CLAUSE_ASYNC_EXPR (clause
))
1366 pp_character(pp
, '(');
1367 dump_generic_node (pp
, OMP_CLAUSE_ASYNC_EXPR (clause
),
1369 pp_character(pp
, ')');
1373 case OMP_CLAUSE_AUTO
:
1374 case OMP_CLAUSE_SEQ
:
1375 pp_string (pp
, omp_clause_code_name
[OMP_CLAUSE_CODE (clause
)]);
1378 case OMP_CLAUSE_WAIT
:
1379 pp_string (pp
, "wait(");
1380 dump_generic_node (pp
, OMP_CLAUSE_WAIT_EXPR (clause
),
1382 pp_character(pp
, ')');
1385 case OMP_CLAUSE_WORKER
:
1386 pp_string (pp
, "worker");
1387 if (OMP_CLAUSE_WORKER_EXPR (clause
) != NULL_TREE
)
1390 dump_generic_node (pp
, OMP_CLAUSE_WORKER_EXPR (clause
),
1392 pp_right_paren (pp
);
1396 case OMP_CLAUSE_VECTOR
:
1397 pp_string (pp
, "vector");
1398 if (OMP_CLAUSE_VECTOR_EXPR (clause
) != NULL_TREE
)
1401 dump_generic_node (pp
, OMP_CLAUSE_VECTOR_EXPR (clause
),
1403 pp_right_paren (pp
);
1407 case OMP_CLAUSE_NUM_GANGS
:
1408 pp_string (pp
, "num_gangs(");
1409 dump_generic_node (pp
, OMP_CLAUSE_NUM_GANGS_EXPR (clause
),
1411 pp_character (pp
, ')');
1414 case OMP_CLAUSE_NUM_WORKERS
:
1415 pp_string (pp
, "num_workers(");
1416 dump_generic_node (pp
, OMP_CLAUSE_NUM_WORKERS_EXPR (clause
),
1418 pp_character (pp
, ')');
1421 case OMP_CLAUSE_VECTOR_LENGTH
:
1422 pp_string (pp
, "vector_length(");
1423 dump_generic_node (pp
, OMP_CLAUSE_VECTOR_LENGTH_EXPR (clause
),
1425 pp_character (pp
, ')');
1428 case OMP_CLAUSE_INBRANCH
:
1429 pp_string (pp
, "inbranch");
1431 case OMP_CLAUSE_NOTINBRANCH
:
1432 pp_string (pp
, "notinbranch");
1434 case OMP_CLAUSE_FOR
:
1435 pp_string (pp
, "for");
1437 case OMP_CLAUSE_PARALLEL
:
1438 pp_string (pp
, "parallel");
1440 case OMP_CLAUSE_SECTIONS
:
1441 pp_string (pp
, "sections");
1443 case OMP_CLAUSE_TASKGROUP
:
1444 pp_string (pp
, "taskgroup");
1446 case OMP_CLAUSE_NOGROUP
:
1447 pp_string (pp
, "nogroup");
1449 case OMP_CLAUSE_THREADS
:
1450 pp_string (pp
, "threads");
1452 case OMP_CLAUSE_SIMD
:
1453 pp_string (pp
, "simd");
1455 case OMP_CLAUSE_INDEPENDENT
:
1456 pp_string (pp
, "independent");
1458 case OMP_CLAUSE_TILE
:
1459 pp_string (pp
, "tile(");
1460 dump_generic_node (pp
, OMP_CLAUSE_TILE_LIST (clause
),
1462 pp_right_paren (pp
);
1464 case OMP_CLAUSE_PARTIAL
:
1465 pp_string (pp
, "partial");
1466 if (OMP_CLAUSE_PARTIAL_EXPR (clause
))
1469 dump_generic_node (pp
, OMP_CLAUSE_PARTIAL_EXPR (clause
),
1471 pp_right_paren (pp
);
1474 case OMP_CLAUSE_FULL
:
1475 pp_string (pp
, "full");
1477 case OMP_CLAUSE_SIZES
:
1478 pp_string (pp
, "sizes(");
1479 dump_generic_node (pp
, OMP_CLAUSE_SIZES_LIST (clause
),
1481 pp_right_paren (pp
);
1484 case OMP_CLAUSE_IF_PRESENT
:
1485 pp_string (pp
, "if_present");
1487 case OMP_CLAUSE_FINALIZE
:
1488 pp_string (pp
, "finalize");
1490 case OMP_CLAUSE_NOHOST
:
1491 pp_string (pp
, "nohost");
1493 case OMP_CLAUSE_DETACH
:
1494 pp_string (pp
, "detach(");
1495 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
), spc
, flags
,
1497 pp_right_paren (pp
);
1505 /* Dump chain of OMP clauses.
1507 PP, SPC and FLAGS are as in dump_generic_node. */
1510 dump_omp_clauses (pretty_printer
*pp
, tree clause
, int spc
, dump_flags_t flags
,
1517 dump_omp_clause (pp
, clause
, spc
, flags
);
1518 leading_space
= true;
1520 clause
= OMP_CLAUSE_CHAIN (clause
);
1524 /* Dump an OpenMP context selector CTX to PP. */
1526 dump_omp_context_selector (pretty_printer
*pp
, tree ctx
, int spc
,
1529 for (tree set
= ctx
; set
&& set
!= error_mark_node
; set
= TREE_CHAIN (set
))
1531 pp_string (pp
, OMP_TSS_NAME (set
));
1532 pp_string (pp
, " = {");
1533 for (tree sel
= OMP_TSS_TRAIT_SELECTORS (set
);
1534 sel
&& sel
!= error_mark_node
; sel
= TREE_CHAIN (sel
))
1536 if (OMP_TS_CODE (sel
) == OMP_TRAIT_INVALID
)
1537 pp_string (pp
, "<unknown selector>");
1539 pp_string (pp
, OMP_TS_NAME (sel
));
1540 tree score
= OMP_TS_SCORE (sel
);
1541 tree props
= OMP_TS_PROPERTIES (sel
);
1544 pp_string (pp
, " (");
1547 pp_string (pp
, "score(");
1548 dump_generic_node (pp
, score
, spc
+ 4, flags
, false);
1549 pp_string (pp
, "): ");
1551 for (tree prop
= props
; prop
; prop
= TREE_CHAIN (prop
))
1553 if (OMP_TP_NAME (prop
) == OMP_TP_NAMELIST_NODE
)
1555 const char *str
= omp_context_name_list_prop (prop
);
1556 pp_string (pp
, "\"");
1557 pretty_print_string (pp
, str
, strlen (str
) + 1);
1558 pp_string (pp
, "\"");
1560 else if (OMP_TP_NAME (prop
))
1561 dump_generic_node (pp
, OMP_TP_NAME (prop
), spc
+ 4,
1563 else if (OMP_TP_VALUE (prop
))
1564 dump_generic_node (pp
, OMP_TP_VALUE (prop
), spc
+ 4,
1566 if (TREE_CHAIN (prop
))
1572 pp_string (pp
, ")");
1574 if (TREE_CHAIN (sel
))
1580 pp_string (pp
, "}");
1581 if (TREE_CHAIN (set
))
1584 newline_and_indent (pp
, spc
);
1589 /* Wrapper for above, used for "declare variant". Compare to
1590 print_generic_expr. */
1592 print_omp_context_selector (FILE *file
, tree t
, dump_flags_t flags
)
1594 maybe_init_pretty_print (file
);
1595 dump_omp_context_selector (tree_pp
, t
, 0, flags
);
1599 /* Dump location LOC to PP. */
1602 dump_location (pretty_printer
*pp
, location_t loc
)
1604 expanded_location xloc
= expand_location (loc
);
1605 int discriminator
= get_discriminator_from_loc (loc
);
1607 pp_left_bracket (pp
);
1610 pp_string (pp
, xloc
.file
);
1611 pp_string (pp
, ":");
1613 pp_decimal_int (pp
, xloc
.line
);
1615 pp_decimal_int (pp
, xloc
.column
);
1618 pp_string (pp
, " discrim ");
1619 pp_decimal_int (pp
, discriminator
);
1621 pp_string (pp
, "] ");
1625 /* Dump lexical block BLOCK. PP, SPC and FLAGS are as in
1626 dump_generic_node. */
1629 dump_block_node (pretty_printer
*pp
, tree block
, int spc
, dump_flags_t flags
)
1633 pp_string (pp
, "BLOCK #");
1634 pp_decimal_int (pp
, BLOCK_NUMBER (block
));
1635 pp_character (pp
, ' ');
1637 if (flags
& TDF_ADDRESS
)
1639 pp_character (pp
, '[');
1640 pp_scalar (pp
, "%p", (void *) block
);
1641 pp_string (pp
, "] ");
1644 if (TREE_ASM_WRITTEN (block
))
1645 pp_string (pp
, "[written] ");
1647 if (flags
& TDF_SLIM
)
1650 if (BLOCK_SOURCE_LOCATION (block
))
1651 dump_location (pp
, BLOCK_SOURCE_LOCATION (block
));
1653 newline_and_indent (pp
, spc
+ 2);
1655 if (BLOCK_SUPERCONTEXT (block
))
1657 pp_string (pp
, "SUPERCONTEXT: ");
1658 dump_generic_node (pp
, BLOCK_SUPERCONTEXT (block
), 0,
1659 flags
| TDF_SLIM
, false);
1660 newline_and_indent (pp
, spc
+ 2);
1663 if (BLOCK_SUBBLOCKS (block
))
1665 pp_string (pp
, "SUBBLOCKS: ");
1666 for (t
= BLOCK_SUBBLOCKS (block
); t
; t
= BLOCK_CHAIN (t
))
1668 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
1671 newline_and_indent (pp
, spc
+ 2);
1674 if (BLOCK_CHAIN (block
))
1676 pp_string (pp
, "SIBLINGS: ");
1677 for (t
= BLOCK_CHAIN (block
); t
; t
= BLOCK_CHAIN (t
))
1679 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
1682 newline_and_indent (pp
, spc
+ 2);
1685 if (BLOCK_VARS (block
))
1687 pp_string (pp
, "VARS: ");
1688 for (t
= BLOCK_VARS (block
); t
; t
= TREE_CHAIN (t
))
1690 dump_generic_node (pp
, t
, 0, flags
, false);
1693 newline_and_indent (pp
, spc
+ 2);
1696 if (vec_safe_length (BLOCK_NONLOCALIZED_VARS (block
)) > 0)
1699 vec
<tree
, va_gc
> *nlv
= BLOCK_NONLOCALIZED_VARS (block
);
1701 pp_string (pp
, "NONLOCALIZED_VARS: ");
1702 FOR_EACH_VEC_ELT (*nlv
, i
, t
)
1704 dump_generic_node (pp
, t
, 0, flags
, false);
1707 newline_and_indent (pp
, spc
+ 2);
1710 if (BLOCK_ABSTRACT_ORIGIN (block
))
1712 pp_string (pp
, "ABSTRACT_ORIGIN: ");
1713 dump_generic_node (pp
, BLOCK_ABSTRACT_ORIGIN (block
), 0,
1714 flags
| TDF_SLIM
, false);
1715 newline_and_indent (pp
, spc
+ 2);
1718 if (BLOCK_FRAGMENT_ORIGIN (block
))
1720 pp_string (pp
, "FRAGMENT_ORIGIN: ");
1721 dump_generic_node (pp
, BLOCK_FRAGMENT_ORIGIN (block
), 0,
1722 flags
| TDF_SLIM
, false);
1723 newline_and_indent (pp
, spc
+ 2);
1726 if (BLOCK_FRAGMENT_CHAIN (block
))
1728 pp_string (pp
, "FRAGMENT_CHAIN: ");
1729 for (t
= BLOCK_FRAGMENT_CHAIN (block
); t
; t
= BLOCK_FRAGMENT_CHAIN (t
))
1731 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
1734 newline_and_indent (pp
, spc
+ 2);
1738 /* Dump #pragma omp atomic memory order clause. */
1741 dump_omp_atomic_memory_order (pretty_printer
*pp
, enum omp_memory_order mo
)
1743 switch (mo
& OMP_MEMORY_ORDER_MASK
)
1745 case OMP_MEMORY_ORDER_RELAXED
:
1746 pp_string (pp
, " relaxed");
1748 case OMP_MEMORY_ORDER_SEQ_CST
:
1749 pp_string (pp
, " seq_cst");
1751 case OMP_MEMORY_ORDER_ACQ_REL
:
1752 pp_string (pp
, " acq_rel");
1754 case OMP_MEMORY_ORDER_ACQUIRE
:
1755 pp_string (pp
, " acquire");
1757 case OMP_MEMORY_ORDER_RELEASE
:
1758 pp_string (pp
, " release");
1760 case OMP_MEMORY_ORDER_UNSPECIFIED
:
1765 switch (mo
& OMP_FAIL_MEMORY_ORDER_MASK
)
1767 case OMP_FAIL_MEMORY_ORDER_RELAXED
:
1768 pp_string (pp
, " fail(relaxed)");
1770 case OMP_FAIL_MEMORY_ORDER_SEQ_CST
:
1771 pp_string (pp
, " fail(seq_cst)");
1773 case OMP_FAIL_MEMORY_ORDER_ACQUIRE
:
1774 pp_string (pp
, " fail(acquire)");
1776 case OMP_FAIL_MEMORY_ORDER_UNSPECIFIED
:
1783 /* Helper to dump a MEM_REF node. */
1786 dump_mem_ref (pretty_printer
*pp
, tree node
, int spc
, dump_flags_t flags
)
1788 if ((TREE_CODE (node
) == MEM_REF
1789 || TREE_CODE (node
) == TARGET_MEM_REF
)
1790 && (flags
& TDF_GIMPLE
))
1792 pp_string (pp
, "__MEM <");
1793 dump_generic_node (pp
, TREE_TYPE (node
),
1794 spc
, flags
| TDF_SLIM
, false);
1795 if (TYPE_ALIGN (TREE_TYPE (node
))
1796 != TYPE_ALIGN (TYPE_MAIN_VARIANT (TREE_TYPE (node
))))
1798 pp_string (pp
, ", ");
1799 pp_decimal_int (pp
, TYPE_ALIGN (TREE_TYPE (node
)));
1802 pp_string (pp
, " (");
1803 if (TREE_TYPE (TREE_OPERAND (node
, 0))
1804 != TREE_TYPE (TREE_OPERAND (node
, 1)))
1807 dump_generic_node (pp
, TREE_TYPE (TREE_OPERAND (node
, 1)),
1808 spc
, flags
| TDF_SLIM
, false);
1809 pp_right_paren (pp
);
1811 dump_generic_node (pp
, TREE_OPERAND (node
, 0),
1812 spc
, flags
| TDF_SLIM
, false);
1813 if (! integer_zerop (TREE_OPERAND (node
, 1)))
1815 pp_string (pp
, " + ");
1816 dump_generic_node (pp
, TREE_OPERAND (node
, 1),
1817 spc
, flags
| TDF_SLIM
, false);
1819 if (TREE_CODE (node
) == TARGET_MEM_REF
)
1821 if (TREE_OPERAND (node
, 2))
1824 pp_string (pp
, " + ");
1825 dump_generic_node (pp
, TREE_OPERAND (node
, 2),
1826 spc
, flags
| TDF_SLIM
, false);
1827 pp_string (pp
, " * ");
1828 dump_generic_node (pp
, TREE_OPERAND (node
, 3),
1829 spc
, flags
| TDF_SLIM
, false);
1831 if (TREE_OPERAND (node
, 4))
1834 pp_string (pp
, " + ");
1835 dump_generic_node (pp
, TREE_OPERAND (node
, 4),
1836 spc
, flags
| TDF_SLIM
, false);
1839 pp_right_paren (pp
);
1841 else if (TREE_CODE (node
) == MEM_REF
1842 && integer_zerop (TREE_OPERAND (node
, 1))
1843 /* Dump the types of INTEGER_CSTs explicitly, for we can't
1844 infer them and MEM_ATTR caching will share MEM_REFs
1845 with differently-typed op0s. */
1846 && TREE_CODE (TREE_OPERAND (node
, 0)) != INTEGER_CST
1847 /* Released SSA_NAMES have no TREE_TYPE. */
1848 && TREE_TYPE (TREE_OPERAND (node
, 0)) != NULL_TREE
1849 /* Same pointer types, but ignoring POINTER_TYPE vs.
1851 && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 0)))
1852 == TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 1))))
1853 && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (node
, 0)))
1854 == TYPE_MODE (TREE_TYPE (TREE_OPERAND (node
, 1))))
1855 && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node
, 0)))
1856 == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node
, 1))))
1857 /* Same value types ignoring qualifiers. */
1858 && (TYPE_MAIN_VARIANT (TREE_TYPE (node
))
1859 == TYPE_MAIN_VARIANT
1860 (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 1)))))
1861 && (!(flags
& TDF_ALIAS
)
1862 || MR_DEPENDENCE_CLIQUE (node
) == 0))
1864 if (TREE_CODE (TREE_OPERAND (node
, 0)) != ADDR_EXPR
)
1866 /* Enclose pointers to arrays in parentheses. */
1867 tree op0
= TREE_OPERAND (node
, 0);
1868 tree op0type
= TREE_TYPE (op0
);
1869 if (POINTER_TYPE_P (op0type
)
1870 && TREE_CODE (TREE_TYPE (op0type
)) == ARRAY_TYPE
)
1873 dump_generic_node (pp
, op0
, spc
, flags
, false);
1874 if (POINTER_TYPE_P (op0type
)
1875 && TREE_CODE (TREE_TYPE (op0type
)) == ARRAY_TYPE
)
1876 pp_right_paren (pp
);
1879 dump_generic_node (pp
,
1880 TREE_OPERAND (TREE_OPERAND (node
, 0), 0),
1885 pp_string (pp
, "MEM");
1887 tree nodetype
= TREE_TYPE (node
);
1888 tree op0
= TREE_OPERAND (node
, 0);
1889 tree op1
= TREE_OPERAND (node
, 1);
1890 tree op1type
= TYPE_MAIN_VARIANT (TREE_TYPE (op1
));
1892 tree op0size
= TYPE_SIZE (nodetype
);
1893 tree op1size
= TYPE_SIZE (TREE_TYPE (op1type
));
1895 if (!op0size
|| !op1size
1896 || !operand_equal_p (op0size
, op1size
, 0))
1898 pp_string (pp
, " <");
1899 /* If the size of the type of the operand is not the same
1900 as the size of the MEM_REF expression include the type
1901 of the latter similar to the TDF_GIMPLE output to make
1902 it clear how many bytes of memory are being accessed. */
1903 dump_generic_node (pp
, nodetype
, spc
, flags
| TDF_SLIM
, false);
1904 pp_string (pp
, "> ");
1907 pp_string (pp
, "[(");
1908 dump_generic_node (pp
, op1type
, spc
, flags
| TDF_SLIM
, false);
1909 pp_right_paren (pp
);
1910 dump_generic_node (pp
, op0
, spc
, flags
, false);
1911 if (!integer_zerop (op1
))
1913 pp_string (pp
, " + ");
1914 dump_generic_node (pp
, op1
, spc
, flags
, false);
1916 if (TREE_CODE (node
) == TARGET_MEM_REF
)
1918 tree tmp
= TMR_INDEX2 (node
);
1921 pp_string (pp
, " + ");
1922 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1924 tmp
= TMR_INDEX (node
);
1927 pp_string (pp
, " + ");
1928 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1929 tmp
= TMR_STEP (node
);
1930 pp_string (pp
, " * ");
1932 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1934 pp_string (pp
, "1");
1937 if ((flags
& TDF_ALIAS
)
1938 && MR_DEPENDENCE_CLIQUE (node
) != 0)
1940 pp_string (pp
, " clique ");
1941 pp_unsigned_wide_integer (pp
, MR_DEPENDENCE_CLIQUE (node
));
1942 pp_string (pp
, " base ");
1943 pp_unsigned_wide_integer (pp
, MR_DEPENDENCE_BASE (node
));
1945 pp_right_bracket (pp
);
1949 /* Helper function for dump_generic_node. Dump INIT or COND expression for
1950 OpenMP loop non-rectangular iterators. */
1953 dump_omp_loop_non_rect_expr (pretty_printer
*pp
, tree node
, int spc
,
1956 gcc_assert (TREE_CODE (node
) == TREE_VEC
);
1957 dump_generic_node (pp
, TREE_VEC_ELT (node
, 0), spc
, flags
, false);
1958 pp_string (pp
, " * ");
1959 if (op_prio (TREE_VEC_ELT (node
, 1)) <= op_code_prio (MULT_EXPR
))
1962 dump_generic_node (pp
, TREE_VEC_ELT (node
, 1), spc
, flags
, false);
1963 pp_right_paren (pp
);
1966 dump_generic_node (pp
, TREE_VEC_ELT (node
, 1), spc
, flags
, false);
1967 pp_string (pp
, " + ");
1968 if (op_prio (TREE_VEC_ELT (node
, 1)) <= op_code_prio (PLUS_EXPR
))
1971 dump_generic_node (pp
, TREE_VEC_ELT (node
, 2), spc
, flags
, false);
1972 pp_right_paren (pp
);
1975 dump_generic_node (pp
, TREE_VEC_ELT (node
, 2), spc
, flags
, false);
1978 /* Dump the node NODE on the pretty_printer PP, SPC spaces of
1979 indent. FLAGS specifies details to show in the dump (see TDF_* in
1980 dumpfile.h). If IS_STMT is true, the object printed is considered
1981 to be a statement and it is terminated by ';' if appropriate. */
1984 dump_generic_node (pretty_printer
*pp
, tree node
, int spc
, dump_flags_t flags
,
1991 enum tree_code code
;
1993 if (node
== NULL_TREE
)
1996 is_expr
= EXPR_P (node
);
1998 if (is_stmt
&& (flags
& TDF_STMTADDR
))
2000 pp_string (pp
, "<&");
2001 pp_scalar (pp
, "%p", (void *)node
);
2002 pp_string (pp
, "> ");
2005 if ((flags
& TDF_LINENO
) && EXPR_HAS_LOCATION (node
))
2006 dump_location (pp
, EXPR_LOCATION (node
));
2008 code
= TREE_CODE (node
);
2012 pp_string (pp
, "<<< error >>>");
2015 case IDENTIFIER_NODE
:
2016 pp_tree_identifier (pp
, node
);
2020 while (node
&& node
!= error_mark_node
)
2022 if (TREE_PURPOSE (node
))
2024 dump_generic_node (pp
, TREE_PURPOSE (node
), spc
, flags
, false);
2027 dump_generic_node (pp
, TREE_VALUE (node
), spc
, flags
, false);
2028 node
= TREE_CHAIN (node
);
2029 if (node
&& TREE_CODE (node
) == TREE_LIST
)
2038 dump_generic_node (pp
, BINFO_TYPE (node
), spc
, flags
, false);
2045 if (TREE_VEC_LENGTH (node
) > 0)
2047 size_t len
= TREE_VEC_LENGTH (node
);
2048 for (i
= 0; i
< len
- 1; i
++)
2050 dump_generic_node (pp
, TREE_VEC_ELT (node
, i
), spc
, flags
,
2055 dump_generic_node (pp
, TREE_VEC_ELT (node
, len
- 1), spc
,
2058 pp_right_brace (pp
);
2065 case FIXED_POINT_TYPE
:
2073 unsigned int quals
= TYPE_QUALS (node
);
2074 enum tree_code_class tclass
;
2076 if (quals
& TYPE_QUAL_ATOMIC
)
2077 pp_string (pp
, "atomic ");
2078 if (quals
& TYPE_QUAL_CONST
)
2079 pp_string (pp
, "const ");
2080 if (quals
& TYPE_QUAL_VOLATILE
)
2081 pp_string (pp
, "volatile ");
2082 if (quals
& TYPE_QUAL_RESTRICT
)
2083 pp_string (pp
, "restrict ");
2085 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
2087 pp_string (pp
, "<address-space-");
2088 pp_decimal_int (pp
, TYPE_ADDR_SPACE (node
));
2089 pp_string (pp
, "> ");
2092 tclass
= TREE_CODE_CLASS (TREE_CODE (node
));
2094 if (tclass
== tcc_declaration
)
2096 if (DECL_NAME (node
))
2097 dump_decl_name (pp
, node
, flags
);
2099 pp_string (pp
, "<unnamed type decl>");
2101 else if (tclass
== tcc_type
)
2103 if ((flags
& TDF_GIMPLE
) && node
== sizetype
)
2104 pp_string (pp
, "__SIZETYPE__");
2105 else if (TYPE_NAME (node
))
2107 if (TREE_CODE (TYPE_NAME (node
)) == IDENTIFIER_NODE
)
2108 pp_tree_identifier (pp
, TYPE_NAME (node
));
2109 else if (TREE_CODE (TYPE_NAME (node
)) == TYPE_DECL
2110 && DECL_NAME (TYPE_NAME (node
)))
2111 dump_decl_name (pp
, TYPE_NAME (node
), flags
);
2113 pp_string (pp
, "<unnamed type>");
2115 else if (TREE_CODE (node
) == VECTOR_TYPE
)
2117 if (flags
& TDF_GIMPLE
)
2119 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2120 pp_string (pp
, " [[gnu::vector_size(");
2122 (pp
, tree_to_poly_uint64 (TYPE_SIZE_UNIT (node
)));
2123 pp_string (pp
, ")]]");
2127 pp_string (pp
, "vector");
2129 pp_wide_integer (pp
, TYPE_VECTOR_SUBPARTS (node
));
2130 pp_string (pp
, ") ");
2131 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2134 else if (TREE_CODE (node
) == INTEGER_TYPE
)
2136 if (TYPE_PRECISION (node
) == CHAR_TYPE_SIZE
)
2137 pp_string (pp
, (TYPE_UNSIGNED (node
)
2140 else if (TYPE_PRECISION (node
) == SHORT_TYPE_SIZE
)
2141 pp_string (pp
, (TYPE_UNSIGNED (node
)
2144 else if (TYPE_PRECISION (node
) == INT_TYPE_SIZE
)
2145 pp_string (pp
, (TYPE_UNSIGNED (node
)
2148 else if (TYPE_PRECISION (node
) == LONG_TYPE_SIZE
)
2149 pp_string (pp
, (TYPE_UNSIGNED (node
)
2152 else if (TYPE_PRECISION (node
) == LONG_LONG_TYPE_SIZE
)
2153 pp_string (pp
, (TYPE_UNSIGNED (node
)
2154 ? "unsigned long long"
2155 : "signed long long"));
2156 else if (TYPE_PRECISION (node
) >= CHAR_TYPE_SIZE
2157 && pow2p_hwi (TYPE_PRECISION (node
)))
2159 pp_string (pp
, (TYPE_UNSIGNED (node
) ? "uint" : "int"));
2160 pp_decimal_int (pp
, TYPE_PRECISION (node
));
2161 pp_string (pp
, "_t");
2165 pp_string (pp
, (TYPE_UNSIGNED (node
)
2166 ? "<unnamed-unsigned:"
2167 : "<unnamed-signed:"));
2168 pp_decimal_int (pp
, TYPE_PRECISION (node
));
2172 else if (TREE_CODE (node
) == COMPLEX_TYPE
)
2174 pp_string (pp
, "__complex__ ");
2175 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2177 else if (TREE_CODE (node
) == REAL_TYPE
)
2179 pp_string (pp
, "<float:");
2180 pp_decimal_int (pp
, TYPE_PRECISION (node
));
2183 else if (TREE_CODE (node
) == FIXED_POINT_TYPE
)
2185 pp_string (pp
, "<fixed-point-");
2186 pp_string (pp
, TYPE_SATURATING (node
) ? "sat:" : "nonsat:");
2187 pp_decimal_int (pp
, TYPE_PRECISION (node
));
2190 else if (TREE_CODE (node
) == BOOLEAN_TYPE
)
2192 pp_string (pp
, (TYPE_UNSIGNED (node
)
2193 ? "<unsigned-boolean:"
2194 : "<signed-boolean:"));
2195 pp_decimal_int (pp
, TYPE_PRECISION (node
));
2198 else if (TREE_CODE (node
) == BITINT_TYPE
)
2200 if (TYPE_UNSIGNED (node
))
2201 pp_string (pp
, "unsigned ");
2202 pp_string (pp
, "_BitInt(");
2203 pp_decimal_int (pp
, TYPE_PRECISION (node
));
2204 pp_right_paren (pp
);
2206 else if (TREE_CODE (node
) == VOID_TYPE
)
2207 pp_string (pp
, "void");
2209 pp_string (pp
, "<unnamed type>");
2215 case REFERENCE_TYPE
:
2216 str
= (TREE_CODE (node
) == POINTER_TYPE
? "*" : "&");
2218 if (TREE_TYPE (node
) == NULL
)
2220 pp_string (pp
, str
);
2221 pp_string (pp
, "<null type>");
2223 else if (TREE_CODE (TREE_TYPE (node
)) == FUNCTION_TYPE
)
2225 tree fnode
= TREE_TYPE (node
);
2227 dump_generic_node (pp
, TREE_TYPE (fnode
), spc
, flags
, false);
2230 pp_string (pp
, str
);
2231 if (TYPE_IDENTIFIER (node
))
2232 dump_generic_node (pp
, TYPE_NAME (node
), spc
, flags
, false);
2233 else if (flags
& TDF_NOUID
)
2234 pp_string (pp
, "<Txxxx>");
2237 pp_string (pp
, "<T");
2238 pp_scalar (pp
, "%x", TYPE_UID (node
));
2239 pp_character (pp
, '>');
2242 pp_right_paren (pp
);
2243 dump_function_declaration (pp
, fnode
, spc
, flags
);
2247 unsigned int quals
= TYPE_QUALS (node
);
2249 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2251 pp_string (pp
, str
);
2253 if (quals
& TYPE_QUAL_CONST
)
2254 pp_string (pp
, " const");
2255 if (quals
& TYPE_QUAL_VOLATILE
)
2256 pp_string (pp
, " volatile");
2257 if (quals
& TYPE_QUAL_RESTRICT
)
2258 pp_string (pp
, " restrict");
2260 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
2262 pp_string (pp
, " <address-space-");
2263 pp_decimal_int (pp
, TYPE_ADDR_SPACE (node
));
2267 if (TYPE_REF_CAN_ALIAS_ALL (node
))
2268 pp_string (pp
, " {ref-all}");
2277 case TARGET_MEM_REF
:
2278 dump_mem_ref (pp
, node
, spc
, flags
);
2283 unsigned int quals
= TYPE_QUALS (node
);
2286 if (quals
& TYPE_QUAL_ATOMIC
)
2287 pp_string (pp
, "atomic ");
2288 if (quals
& TYPE_QUAL_CONST
)
2289 pp_string (pp
, "const ");
2290 if (quals
& TYPE_QUAL_VOLATILE
)
2291 pp_string (pp
, "volatile ");
2293 /* Print the innermost component type. */
2294 for (tmp
= TREE_TYPE (node
); TREE_CODE (tmp
) == ARRAY_TYPE
;
2295 tmp
= TREE_TYPE (tmp
))
2298 /* Avoid to print recursively the array. */
2299 /* FIXME : Not implemented correctly, see print_struct_decl. */
2300 if (TREE_CODE (tmp
) != POINTER_TYPE
|| TREE_TYPE (tmp
) != node
)
2301 dump_generic_node (pp
, tmp
, spc
, flags
, false);
2303 /* Print the dimensions. */
2304 for (tmp
= node
; TREE_CODE (tmp
) == ARRAY_TYPE
; tmp
= TREE_TYPE (tmp
))
2305 dump_array_domain (pp
, TYPE_DOMAIN (tmp
), spc
, flags
);
2311 case QUAL_UNION_TYPE
:
2313 unsigned int quals
= TYPE_QUALS (node
);
2315 if (quals
& TYPE_QUAL_ATOMIC
)
2316 pp_string (pp
, "atomic ");
2317 if (quals
& TYPE_QUAL_CONST
)
2318 pp_string (pp
, "const ");
2319 if (quals
& TYPE_QUAL_VOLATILE
)
2320 pp_string (pp
, "volatile ");
2322 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
2324 pp_string (pp
, "<address-space-");
2325 pp_decimal_int (pp
, TYPE_ADDR_SPACE (node
));
2326 pp_string (pp
, "> ");
2329 /* Print the name of the structure. */
2330 if (TREE_CODE (node
) == RECORD_TYPE
)
2331 pp_string (pp
, "struct ");
2332 else if (TREE_CODE (node
) == UNION_TYPE
)
2333 pp_string (pp
, "union ");
2335 if (TYPE_NAME (node
))
2336 dump_generic_node (pp
, TYPE_NAME (node
), spc
, flags
, false);
2337 else if (!(flags
& TDF_SLIM
))
2338 /* FIXME: If we eliminate the 'else' above and attempt
2339 to show the fields for named types, we may get stuck
2340 following a cycle of pointers to structs. The alleged
2341 self-reference check in print_struct_decl will not detect
2342 cycles involving more than one pointer or struct type. */
2343 print_struct_decl (pp
, node
, spc
, flags
);
2352 if (flags
& TDF_GIMPLE
2353 && (POINTER_TYPE_P (TREE_TYPE (node
))
2354 || (TYPE_PRECISION (TREE_TYPE (node
))
2355 < TYPE_PRECISION (integer_type_node
))
2356 || exact_log2 (TYPE_PRECISION (TREE_TYPE (node
))) == -1
2357 || tree_int_cst_sgn (node
) < 0))
2359 pp_string (pp
, "_Literal (");
2360 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2361 pp_string (pp
, ") ");
2363 if (TREE_CODE (TREE_TYPE (node
)) == POINTER_TYPE
2364 && ! (flags
& TDF_GIMPLE
))
2366 /* In the case of a pointer, one may want to divide by the
2367 size of the pointed-to type. Unfortunately, this not
2368 straightforward. The C front-end maps expressions
2373 in such a way that the two INTEGER_CST nodes for "5" have
2374 different values but identical types. In the latter
2375 case, the 5 is multiplied by sizeof (int) in c-common.cc
2376 (pointer_int_sum) to convert it to a byte address, and
2377 yet the type of the node is left unchanged. Argh. What
2378 is consistent though is that the number value corresponds
2379 to bytes (UNITS) offset.
2381 NB: Neither of the following divisors can be trivially
2382 used to recover the original literal:
2384 TREE_INT_CST_LOW (TYPE_SIZE_UNIT (TREE_TYPE (node)))
2385 TYPE_PRECISION (TREE_TYPE (TREE_TYPE (node))) */
2386 pp_wide_integer (pp
, TREE_INT_CST_LOW (node
));
2387 pp_string (pp
, "B"); /* pseudo-unit */
2389 else if (tree_fits_shwi_p (node
))
2390 pp_wide_integer (pp
, tree_to_shwi (node
));
2391 else if (tree_fits_uhwi_p (node
))
2392 pp_unsigned_wide_integer (pp
, tree_to_uhwi (node
));
2395 wide_int val
= wi::to_wide (node
);
2397 if (wi::neg_p (val
, TYPE_SIGN (TREE_TYPE (node
))))
2403 print_hex_buf_size (val
, &len
);
2404 if (UNLIKELY (len
> sizeof (pp_buffer (pp
)->digit_buffer
)))
2406 char *buf
= XALLOCAVEC (char, len
);
2407 print_hex (val
, buf
);
2408 pp_string (pp
, buf
);
2412 print_hex (val
, pp_buffer (pp
)->digit_buffer
);
2413 pp_string (pp
, pp_buffer (pp
)->digit_buffer
);
2416 if ((flags
& TDF_GIMPLE
)
2417 && ! (POINTER_TYPE_P (TREE_TYPE (node
))
2418 || (TYPE_PRECISION (TREE_TYPE (node
))
2419 < TYPE_PRECISION (integer_type_node
))
2420 || exact_log2 (TYPE_PRECISION (TREE_TYPE (node
))) == -1))
2422 if (TYPE_UNSIGNED (TREE_TYPE (node
)))
2423 pp_character (pp
, 'u');
2424 if (TYPE_PRECISION (TREE_TYPE (node
))
2425 == TYPE_PRECISION (unsigned_type_node
))
2427 else if (TYPE_PRECISION (TREE_TYPE (node
))
2428 == TYPE_PRECISION (long_unsigned_type_node
))
2429 pp_character (pp
, 'l');
2430 else if (TYPE_PRECISION (TREE_TYPE (node
))
2431 == TYPE_PRECISION (long_long_unsigned_type_node
))
2432 pp_string (pp
, "ll");
2434 if (TREE_OVERFLOW (node
))
2435 pp_string (pp
, "(OVF)");
2439 pp_string (pp
, "POLY_INT_CST [");
2440 dump_generic_node (pp
, POLY_INT_CST_COEFF (node
, 0), spc
, flags
, false);
2441 for (unsigned int i
= 1; i
< NUM_POLY_INT_COEFFS
; ++i
)
2443 pp_string (pp
, ", ");
2444 dump_generic_node (pp
, POLY_INT_CST_COEFF (node
, i
),
2447 pp_string (pp
, "]");
2451 /* Code copied from print_node. */
2454 if (TREE_OVERFLOW (node
))
2455 pp_string (pp
, " overflow");
2457 d
= TREE_REAL_CST (node
);
2458 if (REAL_VALUE_ISINF (d
))
2459 pp_string (pp
, REAL_VALUE_NEGATIVE (d
) ? " -Inf" : " Inf");
2460 else if (REAL_VALUE_ISNAN (d
))
2461 pp_string (pp
, " Nan");
2465 real_to_decimal (string
, &d
, sizeof (string
), 0, 1);
2466 pp_string (pp
, string
);
2474 fixed_to_decimal (string
, TREE_FIXED_CST_PTR (node
), sizeof (string
));
2475 pp_string (pp
, string
);
2480 pp_string (pp
, "__complex__ (");
2481 dump_generic_node (pp
, TREE_REALPART (node
), spc
, flags
, false);
2482 pp_string (pp
, ", ");
2483 dump_generic_node (pp
, TREE_IMAGPART (node
), spc
, flags
, false);
2484 pp_right_paren (pp
);
2489 pp_string (pp
, "\"");
2490 if (unsigned nbytes
= TREE_STRING_LENGTH (node
))
2491 pretty_print_string (pp
, TREE_STRING_POINTER (node
), nbytes
);
2492 pp_string (pp
, "\"");
2499 if (flags
& TDF_GIMPLE
)
2501 pp_string (pp
, "_Literal (");
2502 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2503 pp_string (pp
, ") ");
2505 pp_string (pp
, "{ ");
2506 unsigned HOST_WIDE_INT nunits
;
2507 if (!VECTOR_CST_NELTS (node
).is_constant (&nunits
))
2508 nunits
= vector_cst_encoded_nelts (node
);
2509 for (i
= 0; i
< nunits
; ++i
)
2512 pp_string (pp
, ", ");
2513 dump_generic_node (pp
, VECTOR_CST_ELT (node
, i
),
2516 if (!VECTOR_CST_NELTS (node
).is_constant ())
2517 pp_string (pp
, ", ...");
2518 pp_string (pp
, " }");
2524 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2526 if (TREE_CODE (node
) == METHOD_TYPE
)
2528 if (TYPE_METHOD_BASETYPE (node
))
2529 dump_generic_node (pp
, TYPE_NAME (TYPE_METHOD_BASETYPE (node
)),
2532 pp_string (pp
, "<null method basetype>");
2533 pp_colon_colon (pp
);
2535 if (TYPE_IDENTIFIER (node
))
2536 dump_generic_node (pp
, TYPE_NAME (node
), spc
, flags
, false);
2537 else if (TYPE_NAME (node
) && DECL_NAME (TYPE_NAME (node
)))
2538 dump_decl_name (pp
, TYPE_NAME (node
), flags
);
2539 else if (flags
& TDF_NOUID
)
2540 pp_string (pp
, "<Txxxx>");
2543 pp_string (pp
, "<T");
2544 pp_scalar (pp
, "%x", TYPE_UID (node
));
2545 pp_character (pp
, '>');
2547 dump_function_declaration (pp
, node
, spc
, flags
);
2552 dump_decl_name (pp
, node
, flags
);
2556 if (DECL_NAME (node
))
2557 dump_decl_name (pp
, node
, flags
);
2558 else if (LABEL_DECL_UID (node
) != -1)
2560 if (flags
& TDF_GIMPLE
)
2562 pp_character (pp
, 'L');
2563 pp_decimal_int (pp
, (int) LABEL_DECL_UID (node
));
2567 pp_string (pp
, "<L");
2568 pp_decimal_int (pp
, (int) LABEL_DECL_UID (node
));
2569 pp_character (pp
, '>');
2574 if (flags
& TDF_NOUID
)
2575 pp_string (pp
, "<D.xxxx>");
2578 if (flags
& TDF_GIMPLE
)
2580 pp_character (pp
, 'D');
2581 pp_scalar (pp
, "%u", DECL_UID (node
));
2585 pp_string (pp
, "<D.");
2586 pp_scalar (pp
, "%u", DECL_UID (node
));
2587 pp_character (pp
, '>');
2594 if (DECL_IS_UNDECLARED_BUILTIN (node
))
2596 /* Don't print the declaration of built-in types. */
2599 if (DECL_NAME (node
))
2600 dump_decl_name (pp
, node
, flags
);
2601 else if (TYPE_NAME (TREE_TYPE (node
)) != node
)
2603 pp_string (pp
, (TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
2604 ? "union" : "struct "));
2605 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2608 pp_string (pp
, "<anon>");
2614 case DEBUG_EXPR_DECL
:
2615 case NAMESPACE_DECL
:
2617 dump_decl_name (pp
, node
, flags
);
2621 pp_string (pp
, "<retval>");
2625 op0
= TREE_OPERAND (node
, 0);
2628 && (TREE_CODE (op0
) == INDIRECT_REF
2629 || (TREE_CODE (op0
) == MEM_REF
2630 && TREE_CODE (TREE_OPERAND (op0
, 0)) != ADDR_EXPR
2631 && integer_zerop (TREE_OPERAND (op0
, 1))
2632 /* Dump the types of INTEGER_CSTs explicitly, for we
2633 can't infer them and MEM_ATTR caching will share
2634 MEM_REFs with differently-typed op0s. */
2635 && TREE_CODE (TREE_OPERAND (op0
, 0)) != INTEGER_CST
2636 /* Released SSA_NAMES have no TREE_TYPE. */
2637 && TREE_TYPE (TREE_OPERAND (op0
, 0)) != NULL_TREE
2638 /* Same pointer types, but ignoring POINTER_TYPE vs.
2640 && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 0)))
2641 == TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 1))))
2642 && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0
, 0)))
2643 == TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0
, 1))))
2644 && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0
, 0)))
2645 == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0
, 1))))
2646 /* Same value types ignoring qualifiers. */
2647 && (TYPE_MAIN_VARIANT (TREE_TYPE (op0
))
2648 == TYPE_MAIN_VARIANT
2649 (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 1)))))
2650 && MR_DEPENDENCE_CLIQUE (op0
) == 0)))
2652 op0
= TREE_OPERAND (op0
, 0);
2655 if (op_prio (op0
) < op_prio (node
))
2657 dump_generic_node (pp
, op0
, spc
, flags
, false);
2658 if (op_prio (op0
) < op_prio (node
))
2659 pp_right_paren (pp
);
2660 pp_string (pp
, str
);
2661 op1
= TREE_OPERAND (node
, 1);
2662 dump_generic_node (pp
, op1
, spc
, flags
, false);
2663 if (DECL_P (op1
)) /* Not always a decl in the C++ FE. */
2664 if (tree off
= component_ref_field_offset (node
))
2665 if (TREE_CODE (off
) != INTEGER_CST
)
2667 pp_string (pp
, "{off: ");
2668 dump_generic_node (pp
, off
, spc
, flags
, false);
2669 pp_right_brace (pp
);
2674 if (flags
& TDF_GIMPLE
)
2676 pp_string (pp
, "__BIT_FIELD_REF <");
2677 dump_generic_node (pp
, TREE_TYPE (node
),
2678 spc
, flags
| TDF_SLIM
, false);
2679 if (TYPE_ALIGN (TREE_TYPE (node
))
2680 != TYPE_ALIGN (TYPE_MAIN_VARIANT (TREE_TYPE (node
))))
2682 pp_string (pp
, ", ");
2683 pp_decimal_int (pp
, TYPE_ALIGN (TREE_TYPE (node
)));
2686 pp_string (pp
, " (");
2687 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
,
2688 flags
| TDF_SLIM
, false);
2689 pp_string (pp
, ", ");
2690 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
,
2691 flags
| TDF_SLIM
, false);
2692 pp_string (pp
, ", ");
2693 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
,
2694 flags
| TDF_SLIM
, false);
2695 pp_right_paren (pp
);
2699 pp_string (pp
, "BIT_FIELD_REF <");
2700 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2701 pp_string (pp
, ", ");
2702 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2703 pp_string (pp
, ", ");
2704 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2709 case BIT_INSERT_EXPR
:
2710 pp_string (pp
, "BIT_INSERT_EXPR <");
2711 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2712 pp_string (pp
, ", ");
2713 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2714 pp_string (pp
, ", ");
2715 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2716 pp_string (pp
, " (");
2717 if (INTEGRAL_TYPE_P (TREE_TYPE (TREE_OPERAND (node
, 1))))
2719 TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (node
, 1))));
2721 dump_generic_node (pp
, TYPE_SIZE (TREE_TYPE (TREE_OPERAND (node
, 1))),
2723 pp_string (pp
, " bits)>");
2727 case ARRAY_RANGE_REF
:
2728 op0
= TREE_OPERAND (node
, 0);
2729 if (op_prio (op0
) < op_prio (node
))
2731 dump_generic_node (pp
, op0
, spc
, flags
, false);
2732 if (op_prio (op0
) < op_prio (node
))
2733 pp_right_paren (pp
);
2734 pp_left_bracket (pp
);
2735 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2736 if (TREE_CODE (node
) == ARRAY_RANGE_REF
)
2737 pp_string (pp
, " ...");
2738 pp_right_bracket (pp
);
2740 op0
= array_ref_low_bound (node
);
2741 op1
= array_ref_element_size (node
);
2743 if (!integer_zerop (op0
)
2744 || TREE_OPERAND (node
, 2)
2745 || TREE_OPERAND (node
, 3))
2747 pp_string (pp
, "{lb: ");
2748 dump_generic_node (pp
, op0
, spc
, flags
, false);
2749 pp_string (pp
, " sz: ");
2750 dump_generic_node (pp
, op1
, spc
, flags
, false);
2751 pp_right_brace (pp
);
2755 case OMP_ARRAY_SECTION
:
2756 op0
= TREE_OPERAND (node
, 0);
2757 if (op_prio (op0
) < op_prio (node
))
2759 dump_generic_node (pp
, op0
, spc
, flags
, false);
2760 if (op_prio (op0
) < op_prio (node
))
2761 pp_right_paren (pp
);
2762 pp_left_bracket (pp
);
2763 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2765 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2766 pp_right_bracket (pp
);
2771 unsigned HOST_WIDE_INT ix
;
2773 bool is_struct_init
= false;
2774 bool is_array_init
= false;
2776 if (flags
& TDF_GIMPLE
)
2778 pp_string (pp
, "_Literal (");
2779 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2780 pp_string (pp
, ") ");
2783 if (TREE_CLOBBER_P (node
))
2785 pp_string (pp
, "CLOBBER");
2786 switch (CLOBBER_KIND (node
))
2788 case CLOBBER_STORAGE_BEGIN
:
2789 pp_string (pp
, "(bos)");
2791 case CLOBBER_STORAGE_END
:
2792 pp_string (pp
, "(eos)");
2794 case CLOBBER_OBJECT_BEGIN
:
2795 pp_string (pp
, "(bob)");
2797 case CLOBBER_OBJECT_END
:
2798 pp_string (pp
, "(eob)");
2804 else if (TREE_CODE (TREE_TYPE (node
)) == RECORD_TYPE
2805 || TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
)
2806 is_struct_init
= true;
2807 else if (TREE_CODE (TREE_TYPE (node
)) == ARRAY_TYPE
2808 && TYPE_DOMAIN (TREE_TYPE (node
))
2809 && TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
)))
2810 && TREE_CODE (TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
))))
2813 tree minv
= TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
)));
2814 is_array_init
= true;
2815 curidx
= wi::to_widest (minv
);
2817 FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (node
), ix
, field
, val
)
2824 dump_generic_node (pp
, field
, spc
, flags
, false);
2827 else if (is_array_init
2828 && (TREE_CODE (field
) != INTEGER_CST
2829 || curidx
!= wi::to_widest (field
)))
2831 pp_left_bracket (pp
);
2832 if (TREE_CODE (field
) == RANGE_EXPR
)
2834 dump_generic_node (pp
, TREE_OPERAND (field
, 0), spc
,
2836 pp_string (pp
, " ... ");
2837 dump_generic_node (pp
, TREE_OPERAND (field
, 1), spc
,
2839 if (TREE_CODE (TREE_OPERAND (field
, 1)) == INTEGER_CST
)
2840 curidx
= wi::to_widest (TREE_OPERAND (field
, 1));
2843 dump_generic_node (pp
, field
, spc
, flags
, false);
2844 if (TREE_CODE (field
) == INTEGER_CST
)
2845 curidx
= wi::to_widest (field
);
2846 pp_string (pp
, "]=");
2851 if (val
&& TREE_CODE (val
) == ADDR_EXPR
)
2852 if (TREE_CODE (TREE_OPERAND (val
, 0)) == FUNCTION_DECL
)
2853 val
= TREE_OPERAND (val
, 0);
2854 if (val
&& TREE_CODE (val
) == FUNCTION_DECL
)
2855 dump_decl_name (pp
, val
, flags
);
2857 dump_generic_node (pp
, val
, spc
, flags
, false);
2858 if (ix
!= CONSTRUCTOR_NELTS (node
) - 1)
2864 pp_right_brace (pp
);
2871 if (flags
& TDF_SLIM
)
2873 pp_string (pp
, "<COMPOUND_EXPR>");
2877 dump_generic_node (pp
, TREE_OPERAND (node
, 0),
2882 for (tp
= &TREE_OPERAND (node
, 1);
2883 TREE_CODE (*tp
) == COMPOUND_EXPR
;
2884 tp
= &TREE_OPERAND (*tp
, 1))
2886 dump_generic_node (pp
, TREE_OPERAND (*tp
, 0),
2892 dump_generic_node (pp
, *tp
, spc
, flags
, false);
2896 case STATEMENT_LIST
:
2898 tree_stmt_iterator si
;
2901 if (flags
& TDF_SLIM
)
2903 pp_string (pp
, "<STATEMENT_LIST>");
2907 for (si
= tsi_start (node
); !tsi_end_p (si
); tsi_next (&si
))
2910 newline_and_indent (pp
, spc
);
2913 dump_generic_node (pp
, tsi_stmt (si
), spc
, flags
, true);
2920 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
,
2925 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
,
2930 pp_string (pp
, "TARGET_EXPR <");
2931 dump_generic_node (pp
, TARGET_EXPR_SLOT (node
), spc
, flags
, false);
2934 dump_generic_node (pp
, TARGET_EXPR_INITIAL (node
), spc
, flags
, false);
2939 print_declaration (pp
, DECL_EXPR_DECL (node
), spc
, flags
);
2944 if (TREE_TYPE (node
) == NULL
|| TREE_TYPE (node
) == void_type_node
)
2946 pp_string (pp
, "if (");
2947 dump_generic_node (pp
, COND_EXPR_COND (node
), spc
, flags
, false);
2948 pp_right_paren (pp
);
2949 /* The lowered cond_exprs should always be printed in full. */
2950 if (COND_EXPR_THEN (node
)
2951 && (IS_EMPTY_STMT (COND_EXPR_THEN (node
))
2952 || TREE_CODE (COND_EXPR_THEN (node
)) == GOTO_EXPR
)
2953 && COND_EXPR_ELSE (node
)
2954 && (IS_EMPTY_STMT (COND_EXPR_ELSE (node
))
2955 || TREE_CODE (COND_EXPR_ELSE (node
)) == GOTO_EXPR
))
2958 dump_generic_node (pp
, COND_EXPR_THEN (node
),
2960 if (!IS_EMPTY_STMT (COND_EXPR_ELSE (node
)))
2962 pp_string (pp
, " else ");
2963 dump_generic_node (pp
, COND_EXPR_ELSE (node
),
2967 else if (!(flags
& TDF_SLIM
))
2969 /* Output COND_EXPR_THEN. */
2970 if (COND_EXPR_THEN (node
))
2972 newline_and_indent (pp
, spc
+2);
2974 newline_and_indent (pp
, spc
+4);
2975 dump_generic_node (pp
, COND_EXPR_THEN (node
), spc
+4,
2977 newline_and_indent (pp
, spc
+2);
2978 pp_right_brace (pp
);
2981 /* Output COND_EXPR_ELSE. */
2982 if (COND_EXPR_ELSE (node
)
2983 && !IS_EMPTY_STMT (COND_EXPR_ELSE (node
)))
2985 newline_and_indent (pp
, spc
);
2986 pp_string (pp
, "else");
2987 newline_and_indent (pp
, spc
+2);
2989 newline_and_indent (pp
, spc
+4);
2990 dump_generic_node (pp
, COND_EXPR_ELSE (node
), spc
+4,
2992 newline_and_indent (pp
, spc
+2);
2993 pp_right_brace (pp
);
3000 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3004 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3008 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3014 if (!(flags
& TDF_SLIM
))
3016 if (BIND_EXPR_VARS (node
))
3020 for (op0
= BIND_EXPR_VARS (node
); op0
; op0
= DECL_CHAIN (op0
))
3022 print_declaration (pp
, op0
, spc
+2, flags
);
3027 newline_and_indent (pp
, spc
+2);
3028 dump_generic_node (pp
, BIND_EXPR_BODY (node
), spc
+2, flags
, true);
3029 newline_and_indent (pp
, spc
);
3030 pp_right_brace (pp
);
3036 if (CALL_EXPR_FN (node
) != NULL_TREE
)
3037 print_call_name (pp
, CALL_EXPR_FN (node
), flags
);
3041 pp_string (pp
, internal_fn_name (CALL_EXPR_IFN (node
)));
3044 /* Print parameters. */
3049 call_expr_arg_iterator iter
;
3050 FOR_EACH_CALL_EXPR_ARG (arg
, iter
, node
)
3052 dump_generic_node (pp
, arg
, spc
, flags
, false);
3053 if (more_call_expr_args_p (&iter
))
3060 if (CALL_EXPR_VA_ARG_PACK (node
))
3062 if (call_expr_nargs (node
) > 0)
3067 pp_string (pp
, "__builtin_va_arg_pack ()");
3069 pp_right_paren (pp
);
3071 op1
= CALL_EXPR_STATIC_CHAIN (node
);
3074 pp_string (pp
, " [static-chain: ");
3075 dump_generic_node (pp
, op1
, spc
, flags
, false);
3076 pp_right_bracket (pp
);
3079 if (CALL_EXPR_RETURN_SLOT_OPT (node
))
3080 pp_string (pp
, " [return slot optimization]");
3081 if (CALL_EXPR_TAILCALL (node
))
3082 pp_string (pp
, " [tail call]");
3085 case WITH_CLEANUP_EXPR
:
3089 case CLEANUP_POINT_EXPR
:
3090 pp_string (pp
, "<<cleanup_point ");
3091 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3092 pp_string (pp
, ">>");
3095 case PLACEHOLDER_EXPR
:
3096 pp_string (pp
, "<PLACEHOLDER_EXPR ");
3097 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
3101 /* Binary arithmetic and logic expressions. */
3102 case WIDEN_SUM_EXPR
:
3103 case WIDEN_MULT_EXPR
:
3105 case MULT_HIGHPART_EXPR
:
3107 case POINTER_PLUS_EXPR
:
3108 case POINTER_DIFF_EXPR
:
3110 case TRUNC_DIV_EXPR
:
3112 case FLOOR_DIV_EXPR
:
3113 case ROUND_DIV_EXPR
:
3114 case TRUNC_MOD_EXPR
:
3116 case FLOOR_MOD_EXPR
:
3117 case ROUND_MOD_EXPR
:
3119 case EXACT_DIV_EXPR
:
3124 case WIDEN_LSHIFT_EXPR
:
3128 case TRUTH_ANDIF_EXPR
:
3129 case TRUTH_ORIF_EXPR
:
3130 case TRUTH_AND_EXPR
:
3132 case TRUTH_XOR_EXPR
:
3146 case UNORDERED_EXPR
:
3148 const char *op
= op_symbol (node
);
3149 op0
= TREE_OPERAND (node
, 0);
3150 op1
= TREE_OPERAND (node
, 1);
3152 /* When the operands are expressions with less priority,
3153 keep semantics of the tree representation. */
3154 if (op_prio (op0
) <= op_prio (node
))
3157 dump_generic_node (pp
, op0
, spc
, flags
, false);
3158 pp_right_paren (pp
);
3161 dump_generic_node (pp
, op0
, spc
, flags
, false);
3167 /* When the operands are expressions with less priority,
3168 keep semantics of the tree representation. */
3169 if (op_prio (op1
) <= op_prio (node
))
3172 dump_generic_node (pp
, op1
, spc
, flags
, false);
3173 pp_right_paren (pp
);
3176 dump_generic_node (pp
, op1
, spc
, flags
, false);
3180 /* Unary arithmetic and logic expressions. */
3182 if (flags
& TDF_GIMPLE_VAL
)
3184 pp_string (pp
, "_Literal (");
3185 dump_generic_node (pp
, TREE_TYPE (node
), spc
,
3186 flags
& ~TDF_GIMPLE_VAL
, false);
3187 pp_character (pp
, ')');
3192 case TRUTH_NOT_EXPR
:
3193 case PREDECREMENT_EXPR
:
3194 case PREINCREMENT_EXPR
:
3196 if (!(flags
& TDF_GIMPLE
)
3197 && TREE_CODE (node
) == ADDR_EXPR
3198 && (TREE_CODE (TREE_OPERAND (node
, 0)) == STRING_CST
3199 || TREE_CODE (TREE_OPERAND (node
, 0)) == FUNCTION_DECL
))
3200 /* Do not output '&' for strings and function pointers when not
3201 dumping GIMPLE FE syntax. */
3204 pp_string (pp
, op_symbol (node
));
3206 if (op_prio (TREE_OPERAND (node
, 0)) < op_prio (node
))
3209 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3210 pp_right_paren (pp
);
3213 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3216 case POSTDECREMENT_EXPR
:
3217 case POSTINCREMENT_EXPR
:
3218 if (op_prio (TREE_OPERAND (node
, 0)) < op_prio (node
))
3221 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3222 pp_right_paren (pp
);
3225 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3226 pp_string (pp
, op_symbol (node
));
3230 pp_string (pp
, "MIN_EXPR <");
3231 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3232 pp_string (pp
, ", ");
3233 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3238 pp_string (pp
, "MAX_EXPR <");
3239 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3240 pp_string (pp
, ", ");
3241 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3246 pp_string (pp
, "ABS_EXPR <");
3247 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3252 pp_string (pp
, "ABSU_EXPR <");
3253 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3261 case ADDR_SPACE_CONVERT_EXPR
:
3262 case FIXED_CONVERT_EXPR
:
3263 case FIX_TRUNC_EXPR
:
3266 type
= TREE_TYPE (node
);
3267 op0
= TREE_OPERAND (node
, 0);
3268 if (type
!= TREE_TYPE (op0
))
3271 dump_generic_node (pp
, type
, spc
, flags
, false);
3272 pp_string (pp
, ") ");
3274 if (op_prio (op0
) < op_prio (node
))
3276 dump_generic_node (pp
, op0
, spc
, flags
, false);
3277 if (op_prio (op0
) < op_prio (node
))
3278 pp_right_paren (pp
);
3281 case VIEW_CONVERT_EXPR
:
3282 if (flags
& TDF_GIMPLE
)
3283 pp_string (pp
, "__VIEW_CONVERT <");
3285 pp_string (pp
, "VIEW_CONVERT_EXPR<");
3286 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
3287 pp_string (pp
, ">(");
3288 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3289 pp_right_paren (pp
);
3293 pp_string (pp
, "((");
3294 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3295 pp_string (pp
, "))");
3298 case NON_LVALUE_EXPR
:
3299 pp_string (pp
, "NON_LVALUE_EXPR <");
3300 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3305 pp_string (pp
, "SAVE_EXPR <");
3306 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3311 pp_string (pp
, "COMPLEX_EXPR <");
3312 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3313 pp_string (pp
, ", ");
3314 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3319 pp_string (pp
, "CONJ_EXPR <");
3320 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3325 if (flags
& TDF_GIMPLE
)
3327 pp_string (pp
, "__real ");
3328 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3332 pp_string (pp
, "REALPART_EXPR <");
3333 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3339 if (flags
& TDF_GIMPLE
)
3341 pp_string (pp
, "__imag ");
3342 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3346 pp_string (pp
, "IMAGPART_EXPR <");
3347 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3353 pp_string (pp
, "VA_ARG_EXPR <");
3354 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3358 case TRY_FINALLY_EXPR
:
3359 case TRY_CATCH_EXPR
:
3360 pp_string (pp
, "try");
3361 newline_and_indent (pp
, spc
+2);
3363 newline_and_indent (pp
, spc
+4);
3364 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
+4, flags
, true);
3365 newline_and_indent (pp
, spc
+2);
3366 pp_right_brace (pp
);
3367 newline_and_indent (pp
, spc
);
3368 if (TREE_CODE (node
) == TRY_CATCH_EXPR
)
3370 node
= TREE_OPERAND (node
, 1);
3371 pp_string (pp
, "catch");
3375 gcc_assert (TREE_CODE (node
) == TRY_FINALLY_EXPR
);
3376 node
= TREE_OPERAND (node
, 1);
3377 pp_string (pp
, "finally");
3378 if (TREE_CODE (node
) == EH_ELSE_EXPR
)
3380 newline_and_indent (pp
, spc
+2);
3382 newline_and_indent (pp
, spc
+4);
3383 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
+4,
3385 newline_and_indent (pp
, spc
+2);
3386 pp_right_brace (pp
);
3387 newline_and_indent (pp
, spc
);
3388 node
= TREE_OPERAND (node
, 1);
3389 pp_string (pp
, "else");
3392 newline_and_indent (pp
, spc
+2);
3394 newline_and_indent (pp
, spc
+4);
3395 dump_generic_node (pp
, node
, spc
+4, flags
, true);
3396 newline_and_indent (pp
, spc
+2);
3397 pp_right_brace (pp
);
3402 pp_string (pp
, "catch (");
3403 dump_generic_node (pp
, CATCH_TYPES (node
), spc
+2, flags
, false);
3404 pp_right_paren (pp
);
3405 newline_and_indent (pp
, spc
+2);
3407 newline_and_indent (pp
, spc
+4);
3408 dump_generic_node (pp
, CATCH_BODY (node
), spc
+4, flags
, true);
3409 newline_and_indent (pp
, spc
+2);
3410 pp_right_brace (pp
);
3414 case EH_FILTER_EXPR
:
3415 pp_string (pp
, "<<<eh_filter (");
3416 dump_generic_node (pp
, EH_FILTER_TYPES (node
), spc
+2, flags
, false);
3417 pp_string (pp
, ")>>>");
3418 newline_and_indent (pp
, spc
+2);
3420 newline_and_indent (pp
, spc
+4);
3421 dump_generic_node (pp
, EH_FILTER_FAILURE (node
), spc
+4, flags
, true);
3422 newline_and_indent (pp
, spc
+2);
3423 pp_right_brace (pp
);
3428 op0
= TREE_OPERAND (node
, 0);
3429 /* If this is for break or continue, don't bother printing it. */
3430 if (DECL_NAME (op0
))
3432 const char *name
= IDENTIFIER_POINTER (DECL_NAME (op0
));
3433 if (strcmp (name
, "break") == 0
3434 || strcmp (name
, "continue") == 0)
3437 dump_generic_node (pp
, op0
, spc
, flags
, false);
3439 if (DECL_NONLOCAL (op0
))
3440 pp_string (pp
, " [non-local]");
3444 pp_string (pp
, "while (1)");
3445 if (!(flags
& TDF_SLIM
))
3447 newline_and_indent (pp
, spc
+2);
3449 newline_and_indent (pp
, spc
+4);
3450 dump_generic_node (pp
, LOOP_EXPR_BODY (node
), spc
+4, flags
, true);
3451 newline_and_indent (pp
, spc
+2);
3452 pp_right_brace (pp
);
3458 pp_string (pp
, "// predicted ");
3459 if (PREDICT_EXPR_OUTCOME (node
))
3460 pp_string (pp
, "likely by ");
3462 pp_string (pp
, "unlikely by ");
3463 pp_string (pp
, predictor_name (PREDICT_EXPR_PREDICTOR (node
)));
3464 pp_string (pp
, " predictor.");
3468 pp_string (pp
, "ANNOTATE_EXPR <");
3469 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3470 switch ((enum annot_expr_kind
) TREE_INT_CST_LOW (TREE_OPERAND (node
, 1)))
3472 case annot_expr_ivdep_kind
:
3473 pp_string (pp
, ", ivdep");
3475 case annot_expr_unroll_kind
:
3477 pp_string (pp
, ", unroll ");
3479 (int) TREE_INT_CST_LOW (TREE_OPERAND (node
, 2)));
3482 case annot_expr_no_vector_kind
:
3483 pp_string (pp
, ", no-vector");
3485 case annot_expr_vector_kind
:
3486 pp_string (pp
, ", vector");
3488 case annot_expr_parallel_kind
:
3489 pp_string (pp
, ", parallel");
3491 case annot_expr_maybe_infinite_kind
:
3492 pp_string (pp
, ", maybe-infinite");
3501 pp_string (pp
, "return");
3502 op0
= TREE_OPERAND (node
, 0);
3506 if (TREE_CODE (op0
) == MODIFY_EXPR
)
3507 dump_generic_node (pp
, TREE_OPERAND (op0
, 1),
3510 dump_generic_node (pp
, op0
, spc
, flags
, false);
3515 pp_string (pp
, "if (");
3516 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3517 pp_string (pp
, ") break");
3521 pp_string (pp
, "switch (");
3522 dump_generic_node (pp
, SWITCH_COND (node
), spc
, flags
, false);
3523 pp_right_paren (pp
);
3524 if (!(flags
& TDF_SLIM
))
3526 newline_and_indent (pp
, spc
+2);
3528 if (SWITCH_BODY (node
))
3530 newline_and_indent (pp
, spc
+4);
3531 dump_generic_node (pp
, SWITCH_BODY (node
), spc
+4, flags
,
3534 newline_and_indent (pp
, spc
+2);
3535 pp_right_brace (pp
);
3541 op0
= GOTO_DESTINATION (node
);
3542 if (TREE_CODE (op0
) != SSA_NAME
&& DECL_P (op0
) && DECL_NAME (op0
))
3544 const char *name
= IDENTIFIER_POINTER (DECL_NAME (op0
));
3545 if (strcmp (name
, "break") == 0
3546 || strcmp (name
, "continue") == 0)
3548 pp_string (pp
, name
);
3552 pp_string (pp
, "goto ");
3553 dump_generic_node (pp
, op0
, spc
, flags
, false);
3557 pp_string (pp
, "__asm__");
3558 if (ASM_VOLATILE_P (node
))
3559 pp_string (pp
, " __volatile__");
3561 dump_generic_node (pp
, ASM_STRING (node
), spc
, flags
, false);
3563 dump_generic_node (pp
, ASM_OUTPUTS (node
), spc
, flags
, false);
3565 dump_generic_node (pp
, ASM_INPUTS (node
), spc
, flags
, false);
3566 if (ASM_CLOBBERS (node
))
3569 dump_generic_node (pp
, ASM_CLOBBERS (node
), spc
, flags
, false);
3571 pp_right_paren (pp
);
3574 case CASE_LABEL_EXPR
:
3575 if (CASE_LOW (node
) && CASE_HIGH (node
))
3577 pp_string (pp
, "case ");
3578 dump_generic_node (pp
, CASE_LOW (node
), spc
, flags
, false);
3579 pp_string (pp
, " ... ");
3580 dump_generic_node (pp
, CASE_HIGH (node
), spc
, flags
, false);
3582 else if (CASE_LOW (node
))
3584 pp_string (pp
, "case ");
3585 dump_generic_node (pp
, CASE_LOW (node
), spc
, flags
, false);
3588 pp_string (pp
, "default");
3593 pp_string (pp
, "OBJ_TYPE_REF(");
3594 dump_generic_node (pp
, OBJ_TYPE_REF_EXPR (node
), spc
, flags
, false);
3596 /* We omit the class type for -fcompare-debug because we may
3597 drop TYPE_BINFO early depending on debug info, and then
3598 virtual_method_call_p would return false, whereas when
3599 TYPE_BINFO is preserved it may still return true and then
3600 we'd print the class type. Compare tree and rtl dumps for
3601 libstdc++-prettyprinters/shared_ptr.cc with and without -g,
3602 for example, at occurrences of OBJ_TYPE_REF. */
3603 if (!(flags
& (TDF_SLIM
| TDF_COMPARE_DEBUG
))
3604 && virtual_method_call_p (node
, true))
3606 pp_string (pp
, "(");
3607 dump_generic_node (pp
, obj_type_ref_class (node
, true),
3609 pp_string (pp
, ")");
3611 dump_generic_node (pp
, OBJ_TYPE_REF_OBJECT (node
), spc
, flags
, false);
3613 dump_generic_node (pp
, OBJ_TYPE_REF_TOKEN (node
), spc
, flags
, false);
3614 pp_right_paren (pp
);
3618 if (SSA_NAME_IDENTIFIER (node
))
3620 if ((flags
& TDF_NOUID
)
3621 && SSA_NAME_VAR (node
)
3622 && DECL_NAMELESS (SSA_NAME_VAR (node
)))
3623 dump_fancy_name (pp
, SSA_NAME_IDENTIFIER (node
));
3624 else if (! (flags
& TDF_GIMPLE
)
3625 || SSA_NAME_VAR (node
))
3626 dump_generic_node (pp
, SSA_NAME_IDENTIFIER (node
),
3630 pp_decimal_int (pp
, SSA_NAME_VERSION (node
));
3631 if (SSA_NAME_IS_DEFAULT_DEF (node
))
3632 pp_string (pp
, "(D)");
3633 if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (node
))
3634 pp_string (pp
, "(ab)");
3637 case WITH_SIZE_EXPR
:
3638 pp_string (pp
, "WITH_SIZE_EXPR <");
3639 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3640 pp_string (pp
, ", ");
3641 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3646 pp_string (pp
, "scev_known");
3649 case SCEV_NOT_KNOWN
:
3650 pp_string (pp
, "scev_not_known");
3653 case POLYNOMIAL_CHREC
:
3655 dump_generic_node (pp
, CHREC_LEFT (node
), spc
, flags
, false);
3656 pp_string (pp
, ", +, ");
3657 dump_generic_node (pp
, CHREC_RIGHT (node
), spc
, flags
, false);
3658 pp_string (pp
, !CHREC_NOWRAP (node
) ? "}_" : "}<nw>_");
3659 pp_scalar (pp
, "%u", CHREC_VARIABLE (node
));
3663 case REALIGN_LOAD_EXPR
:
3664 pp_string (pp
, "REALIGN_LOAD <");
3665 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3666 pp_string (pp
, ", ");
3667 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3668 pp_string (pp
, ", ");
3669 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3674 pp_string (pp
, " VEC_COND_EXPR < ");
3675 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3676 pp_string (pp
, " , ");
3677 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3678 pp_string (pp
, " , ");
3679 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3680 pp_string (pp
, " > ");
3684 pp_string (pp
, " VEC_PERM_EXPR < ");
3685 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3686 pp_string (pp
, " , ");
3687 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3688 pp_string (pp
, " , ");
3689 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3690 pp_string (pp
, " > ");
3694 pp_string (pp
, " DOT_PROD_EXPR < ");
3695 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3696 pp_string (pp
, ", ");
3697 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3698 pp_string (pp
, ", ");
3699 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3700 pp_string (pp
, " > ");
3703 case WIDEN_MULT_PLUS_EXPR
:
3704 pp_string (pp
, " WIDEN_MULT_PLUS_EXPR < ");
3705 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3706 pp_string (pp
, ", ");
3707 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3708 pp_string (pp
, ", ");
3709 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3710 pp_string (pp
, " > ");
3713 case WIDEN_MULT_MINUS_EXPR
:
3714 pp_string (pp
, " WIDEN_MULT_MINUS_EXPR < ");
3715 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3716 pp_string (pp
, ", ");
3717 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3718 pp_string (pp
, ", ");
3719 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3720 pp_string (pp
, " > ");
3724 pp_string (pp
, "#pragma acc parallel");
3725 goto dump_omp_clauses_body
;
3728 pp_string (pp
, "#pragma acc kernels");
3729 goto dump_omp_clauses_body
;
3732 pp_string (pp
, "#pragma acc serial");
3733 goto dump_omp_clauses_body
;
3736 pp_string (pp
, "#pragma acc data");
3737 dump_omp_clauses (pp
, OACC_DATA_CLAUSES (node
), spc
, flags
);
3740 case OACC_HOST_DATA
:
3741 pp_string (pp
, "#pragma acc host_data");
3742 dump_omp_clauses (pp
, OACC_HOST_DATA_CLAUSES (node
), spc
, flags
);
3746 pp_string (pp
, "#pragma acc declare");
3747 dump_omp_clauses (pp
, OACC_DECLARE_CLAUSES (node
), spc
, flags
);
3751 pp_string (pp
, "#pragma acc update");
3752 dump_omp_clauses (pp
, OACC_UPDATE_CLAUSES (node
), spc
, flags
);
3755 case OACC_ENTER_DATA
:
3756 pp_string (pp
, "#pragma acc enter data");
3757 dump_omp_clauses (pp
, OACC_ENTER_DATA_CLAUSES (node
), spc
, flags
);
3760 case OACC_EXIT_DATA
:
3761 pp_string (pp
, "#pragma acc exit data");
3762 dump_omp_clauses (pp
, OACC_EXIT_DATA_CLAUSES (node
), spc
, flags
);
3766 pp_string (pp
, "#pragma acc cache");
3767 dump_omp_clauses (pp
, OACC_CACHE_CLAUSES (node
), spc
, flags
);
3771 pp_string (pp
, "#pragma omp parallel");
3772 dump_omp_clauses (pp
, OMP_PARALLEL_CLAUSES (node
), spc
, flags
);
3775 dump_omp_clauses_body
:
3776 dump_omp_clauses (pp
, OMP_CLAUSES (node
), spc
, flags
);
3780 if (!(flags
& TDF_SLIM
) && OMP_BODY (node
))
3782 newline_and_indent (pp
, spc
+ 2);
3784 newline_and_indent (pp
, spc
+ 4);
3785 dump_generic_node (pp
, OMP_BODY (node
), spc
+ 4, flags
, false);
3786 newline_and_indent (pp
, spc
+ 2);
3787 pp_right_brace (pp
);
3793 pp_string (pp
, OMP_TASK_BODY (node
) ? "#pragma omp task"
3794 : "#pragma omp taskwait");
3795 dump_omp_clauses (pp
, OMP_TASK_CLAUSES (node
), spc
, flags
);
3799 pp_string (pp
, "#pragma omp for");
3803 pp_string (pp
, "#pragma omp simd");
3806 case OMP_DISTRIBUTE
:
3807 pp_string (pp
, "#pragma omp distribute");
3811 pp_string (pp
, "#pragma omp taskloop");
3815 pp_string (pp
, "#pragma omp loop");
3819 pp_string (pp
, "#pragma omp tile");
3823 pp_string (pp
, "#pragma omp unroll");
3827 pp_string (pp
, "#pragma acc loop");
3831 pp_string (pp
, "#pragma omp teams");
3832 dump_omp_clauses (pp
, OMP_TEAMS_CLAUSES (node
), spc
, flags
);
3835 case OMP_TARGET_DATA
:
3836 pp_string (pp
, "#pragma omp target data");
3837 dump_omp_clauses (pp
, OMP_TARGET_DATA_CLAUSES (node
), spc
, flags
);
3840 case OMP_TARGET_ENTER_DATA
:
3841 pp_string (pp
, "#pragma omp target enter data");
3842 dump_omp_clauses (pp
, OMP_TARGET_ENTER_DATA_CLAUSES (node
), spc
, flags
);
3846 case OMP_TARGET_EXIT_DATA
:
3847 pp_string (pp
, "#pragma omp target exit data");
3848 dump_omp_clauses (pp
, OMP_TARGET_EXIT_DATA_CLAUSES (node
), spc
, flags
);
3853 pp_string (pp
, "#pragma omp target");
3854 dump_omp_clauses (pp
, OMP_TARGET_CLAUSES (node
), spc
, flags
);
3857 case OMP_TARGET_UPDATE
:
3858 pp_string (pp
, "#pragma omp target update");
3859 dump_omp_clauses (pp
, OMP_TARGET_UPDATE_CLAUSES (node
), spc
, flags
);
3864 dump_omp_clauses (pp
, OMP_FOR_CLAUSES (node
), spc
, flags
);
3865 if (!(flags
& TDF_SLIM
))
3869 if (OMP_FOR_PRE_BODY (node
))
3871 newline_and_indent (pp
, spc
+ 2);
3874 newline_and_indent (pp
, spc
);
3875 dump_generic_node (pp
, OMP_FOR_PRE_BODY (node
),
3878 if (OMP_FOR_INIT (node
))
3881 for (i
= 0; i
< TREE_VEC_LENGTH (OMP_FOR_INIT (node
)); i
++)
3883 if (TREE_VEC_ELT (OMP_FOR_INIT (node
), i
) == NULL_TREE
)
3886 newline_and_indent (pp
, spc
);
3887 pp_string (pp
, "for (");
3888 tree init
= TREE_VEC_ELT (OMP_FOR_INIT (node
), i
);
3889 if (TREE_CODE (init
) != MODIFY_EXPR
3890 || TREE_CODE (TREE_OPERAND (init
, 1)) != TREE_VEC
)
3891 dump_generic_node (pp
, init
, spc
, flags
, false);
3894 dump_generic_node (pp
, TREE_OPERAND (init
, 0),
3896 pp_string (pp
, " = ");
3897 dump_omp_loop_non_rect_expr (pp
, TREE_OPERAND (init
, 1),
3900 pp_string (pp
, "; ");
3901 tree cond
= TREE_VEC_ELT (OMP_FOR_COND (node
), i
);
3902 if (!COMPARISON_CLASS_P (cond
)
3903 || TREE_CODE (TREE_OPERAND (cond
, 1)) != TREE_VEC
)
3904 dump_generic_node (pp
, cond
, spc
, flags
, false);
3907 dump_generic_node (pp
, TREE_OPERAND (cond
, 0),
3909 const char *op
= op_symbol (cond
);
3913 dump_omp_loop_non_rect_expr (pp
, TREE_OPERAND (cond
, 1),
3916 pp_string (pp
, "; ");
3917 dump_generic_node (pp
,
3918 TREE_VEC_ELT (OMP_FOR_INCR (node
), i
),
3920 pp_right_paren (pp
);
3923 if (OMP_FOR_BODY (node
))
3925 newline_and_indent (pp
, spc
+ 2);
3927 newline_and_indent (pp
, spc
+ 4);
3928 dump_generic_node (pp
, OMP_FOR_BODY (node
), spc
+ 4, flags
,
3930 newline_and_indent (pp
, spc
+ 2);
3931 pp_right_brace (pp
);
3933 if (OMP_FOR_INIT (node
))
3934 spc
-= 2 * TREE_VEC_LENGTH (OMP_FOR_INIT (node
)) - 2;
3935 if (OMP_FOR_PRE_BODY (node
))
3938 newline_and_indent (pp
, spc
+ 2);
3939 pp_right_brace (pp
);
3946 pp_string (pp
, "#pragma omp sections");
3947 dump_omp_clauses (pp
, OMP_SECTIONS_CLAUSES (node
), spc
, flags
);
3951 pp_string (pp
, "#pragma omp section");
3954 case OMP_STRUCTURED_BLOCK
:
3955 pp_string (pp
, "#pragma omp __structured_block");
3959 if (OMP_SCAN_CLAUSES (node
))
3961 pp_string (pp
, "#pragma omp scan");
3962 dump_omp_clauses (pp
, OMP_SCAN_CLAUSES (node
), spc
, flags
);
3967 pp_string (pp
, "#pragma omp master");
3971 pp_string (pp
, "#pragma omp masked");
3972 dump_omp_clauses (pp
, OMP_MASKED_CLAUSES (node
), spc
, flags
);
3976 pp_string (pp
, "#pragma omp taskgroup");
3977 dump_omp_clauses (pp
, OMP_TASKGROUP_CLAUSES (node
), spc
, flags
);
3981 pp_string (pp
, "#pragma omp ordered");
3982 dump_omp_clauses (pp
, OMP_ORDERED_CLAUSES (node
), spc
, flags
);
3986 pp_string (pp
, "#pragma omp critical");
3987 if (OMP_CRITICAL_NAME (node
))
3991 dump_generic_node (pp
, OMP_CRITICAL_NAME (node
), spc
,
3993 pp_right_paren (pp
);
3995 dump_omp_clauses (pp
, OMP_CRITICAL_CLAUSES (node
), spc
, flags
);
3999 pp_string (pp
, "#pragma omp atomic");
4000 if (OMP_ATOMIC_WEAK (node
))
4001 pp_string (pp
, " weak");
4002 dump_omp_atomic_memory_order (pp
, OMP_ATOMIC_MEMORY_ORDER (node
));
4003 newline_and_indent (pp
, spc
+ 2);
4004 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
4008 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
4011 case OMP_ATOMIC_READ
:
4012 pp_string (pp
, "#pragma omp atomic read");
4013 dump_omp_atomic_memory_order (pp
, OMP_ATOMIC_MEMORY_ORDER (node
));
4014 newline_and_indent (pp
, spc
+ 2);
4015 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
4019 case OMP_ATOMIC_CAPTURE_OLD
:
4020 case OMP_ATOMIC_CAPTURE_NEW
:
4021 pp_string (pp
, "#pragma omp atomic capture");
4022 if (OMP_ATOMIC_WEAK (node
))
4023 pp_string (pp
, " weak");
4024 dump_omp_atomic_memory_order (pp
, OMP_ATOMIC_MEMORY_ORDER (node
));
4025 newline_and_indent (pp
, spc
+ 2);
4026 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
4030 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
4034 pp_string (pp
, "#pragma omp single");
4035 dump_omp_clauses (pp
, OMP_SINGLE_CLAUSES (node
), spc
, flags
);
4039 pp_string (pp
, "#pragma omp scope");
4040 dump_omp_clauses (pp
, OMP_SCOPE_CLAUSES (node
), spc
, flags
);
4044 /* If we come here, we're dumping something that's not an OMP construct,
4045 for example, OMP clauses attached to a function's '__attribute__'.
4046 Dump the whole OMP clause chain. */
4047 dump_omp_clauses (pp
, node
, spc
, flags
, false);
4051 case TRANSACTION_EXPR
:
4052 if (TRANSACTION_EXPR_OUTER (node
))
4053 pp_string (pp
, "__transaction_atomic [[outer]]");
4054 else if (TRANSACTION_EXPR_RELAXED (node
))
4055 pp_string (pp
, "__transaction_relaxed");
4057 pp_string (pp
, "__transaction_atomic");
4058 if (!(flags
& TDF_SLIM
) && TRANSACTION_EXPR_BODY (node
))
4060 newline_and_indent (pp
, spc
);
4062 newline_and_indent (pp
, spc
+ 2);
4063 dump_generic_node (pp
, TRANSACTION_EXPR_BODY (node
),
4064 spc
+ 2, flags
, false);
4065 newline_and_indent (pp
, spc
);
4066 pp_right_brace (pp
);
4071 case VEC_SERIES_EXPR
:
4072 case VEC_WIDEN_MULT_HI_EXPR
:
4073 case VEC_WIDEN_MULT_LO_EXPR
:
4074 case VEC_WIDEN_MULT_EVEN_EXPR
:
4075 case VEC_WIDEN_MULT_ODD_EXPR
:
4076 case VEC_WIDEN_LSHIFT_HI_EXPR
:
4077 case VEC_WIDEN_LSHIFT_LO_EXPR
:
4079 for (str
= get_tree_code_name (code
); *str
; str
++)
4080 pp_character (pp
, TOUPPER (*str
));
4081 pp_string (pp
, " < ");
4082 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
4083 pp_string (pp
, ", ");
4084 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
4085 pp_string (pp
, " > ");
4088 case VEC_DUPLICATE_EXPR
:
4090 for (str
= get_tree_code_name (code
); *str
; str
++)
4091 pp_character (pp
, TOUPPER (*str
));
4092 pp_string (pp
, " < ");
4093 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
4094 pp_string (pp
, " > ");
4097 case VEC_UNPACK_HI_EXPR
:
4098 pp_string (pp
, " VEC_UNPACK_HI_EXPR < ");
4099 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
4100 pp_string (pp
, " > ");
4103 case VEC_UNPACK_LO_EXPR
:
4104 pp_string (pp
, " VEC_UNPACK_LO_EXPR < ");
4105 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
4106 pp_string (pp
, " > ");
4109 case VEC_UNPACK_FLOAT_HI_EXPR
:
4110 pp_string (pp
, " VEC_UNPACK_FLOAT_HI_EXPR < ");
4111 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
4112 pp_string (pp
, " > ");
4115 case VEC_UNPACK_FLOAT_LO_EXPR
:
4116 pp_string (pp
, " VEC_UNPACK_FLOAT_LO_EXPR < ");
4117 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
4118 pp_string (pp
, " > ");
4121 case VEC_UNPACK_FIX_TRUNC_HI_EXPR
:
4122 pp_string (pp
, " VEC_UNPACK_FIX_TRUNC_HI_EXPR < ");
4123 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
4124 pp_string (pp
, " > ");
4127 case VEC_UNPACK_FIX_TRUNC_LO_EXPR
:
4128 pp_string (pp
, " VEC_UNPACK_FIX_TRUNC_LO_EXPR < ");
4129 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
4130 pp_string (pp
, " > ");
4133 case VEC_PACK_TRUNC_EXPR
:
4134 pp_string (pp
, " VEC_PACK_TRUNC_EXPR < ");
4135 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
4136 pp_string (pp
, ", ");
4137 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
4138 pp_string (pp
, " > ");
4141 case VEC_PACK_SAT_EXPR
:
4142 pp_string (pp
, " VEC_PACK_SAT_EXPR < ");
4143 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
4144 pp_string (pp
, ", ");
4145 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
4146 pp_string (pp
, " > ");
4149 case VEC_PACK_FIX_TRUNC_EXPR
:
4150 pp_string (pp
, " VEC_PACK_FIX_TRUNC_EXPR < ");
4151 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
4152 pp_string (pp
, ", ");
4153 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
4154 pp_string (pp
, " > ");
4157 case VEC_PACK_FLOAT_EXPR
:
4158 pp_string (pp
, " VEC_PACK_FLOAT_EXPR < ");
4159 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
4160 pp_string (pp
, ", ");
4161 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
4162 pp_string (pp
, " > ");
4166 dump_block_node (pp
, node
, spc
, flags
);
4169 case DEBUG_BEGIN_STMT
:
4170 pp_string (pp
, "# DEBUG BEGIN STMT");
4177 if (is_stmt
&& is_expr
)
4183 /* Print the declaration of a variable. */
4186 print_declaration (pretty_printer
*pp
, tree t
, int spc
, dump_flags_t flags
)
4190 if (TREE_CODE(t
) == NAMELIST_DECL
)
4192 pp_string(pp
, "namelist ");
4193 dump_decl_name (pp
, t
, flags
);
4198 if (TREE_CODE (t
) == TYPE_DECL
)
4199 pp_string (pp
, "typedef ");
4201 if (HAS_RTL_P (t
) && DECL_REGISTER (t
))
4202 pp_string (pp
, "register ");
4204 if (TREE_PUBLIC (t
) && DECL_EXTERNAL (t
))
4205 pp_string (pp
, "extern ");
4206 else if (TREE_STATIC (t
))
4207 pp_string (pp
, "static ");
4209 /* Print the type and name. */
4210 if (TREE_TYPE (t
) && TREE_CODE (TREE_TYPE (t
)) == ARRAY_TYPE
)
4214 /* Print array's type. */
4215 tmp
= TREE_TYPE (t
);
4216 while (TREE_CODE (TREE_TYPE (tmp
)) == ARRAY_TYPE
)
4217 tmp
= TREE_TYPE (tmp
);
4218 dump_generic_node (pp
, TREE_TYPE (tmp
), spc
, flags
, false);
4220 /* Print variable's name. */
4222 dump_generic_node (pp
, t
, spc
, flags
, false);
4224 /* Print the dimensions. */
4225 tmp
= TREE_TYPE (t
);
4226 while (TREE_CODE (tmp
) == ARRAY_TYPE
)
4228 dump_array_domain (pp
, TYPE_DOMAIN (tmp
), spc
, flags
);
4229 tmp
= TREE_TYPE (tmp
);
4232 else if (TREE_CODE (t
) == FUNCTION_DECL
)
4234 dump_generic_node (pp
, TREE_TYPE (TREE_TYPE (t
)), spc
, flags
, false);
4236 dump_decl_name (pp
, t
, flags
);
4237 dump_function_declaration (pp
, TREE_TYPE (t
), spc
, flags
);
4241 /* Print type declaration. */
4242 dump_generic_node (pp
, TREE_TYPE (t
), spc
, flags
, false);
4244 /* Print variable's name. */
4246 dump_generic_node (pp
, t
, spc
, flags
, false);
4249 if (VAR_P (t
) && DECL_HARD_REGISTER (t
))
4251 pp_string (pp
, " __asm__ ");
4253 dump_generic_node (pp
, DECL_ASSEMBLER_NAME (t
), spc
, flags
, false);
4254 pp_right_paren (pp
);
4257 /* The initial value of a function serves to determine whether the function
4258 is declared or defined. So the following does not apply to function
4260 if (TREE_CODE (t
) != FUNCTION_DECL
)
4262 /* Print the initial value. */
4263 if (DECL_INITIAL (t
))
4268 if (!(flags
& TDF_SLIM
))
4269 dump_generic_node (pp
, DECL_INITIAL (t
), spc
, flags
, false);
4271 pp_string (pp
, "<<< omitted >>>");
4275 if (VAR_P (t
) && DECL_HAS_VALUE_EXPR_P (t
))
4277 pp_string (pp
, " [value-expr: ");
4278 dump_generic_node (pp
, DECL_VALUE_EXPR (t
), spc
, flags
, false);
4279 pp_right_bracket (pp
);
4286 /* Prints a structure: name, fields, and methods.
4287 FIXME: Still incomplete. */
4290 print_struct_decl (pretty_printer
*pp
, const_tree node
, int spc
,
4293 /* Print the name of the structure. */
4294 if (TYPE_NAME (node
))
4297 if (TREE_CODE (node
) == RECORD_TYPE
)
4298 pp_string (pp
, "struct ");
4299 else if ((TREE_CODE (node
) == UNION_TYPE
4300 || TREE_CODE (node
) == QUAL_UNION_TYPE
))
4301 pp_string (pp
, "union ");
4303 dump_generic_node (pp
, TYPE_NAME (node
), spc
, TDF_NONE
, false);
4306 /* Print the contents of the structure. */
4312 /* Print the fields of the structure. */
4315 tmp
= TYPE_FIELDS (node
);
4318 /* Avoid to print recursively the structure. */
4319 /* FIXME : Not implemented correctly...,
4320 what about the case when we have a cycle in the contain graph? ...
4321 Maybe this could be solved by looking at the scope in which the
4322 structure was declared. */
4323 if (TREE_TYPE (tmp
) != node
4324 && (TREE_CODE (TREE_TYPE (tmp
)) != POINTER_TYPE
4325 || TREE_TYPE (TREE_TYPE (tmp
)) != node
))
4327 print_declaration (pp
, tmp
, spc
+2, flags
);
4330 tmp
= DECL_CHAIN (tmp
);
4334 pp_right_brace (pp
);
4337 /* Return the priority of the operator CODE.
4339 From lowest to highest precedence with either left-to-right (L-R)
4340 or right-to-left (R-L) associativity]:
4343 2 [R-L] = += -= *= /= %= &= ^= |= <<= >>=
4355 14 [R-L] ! ~ ++ -- + - * & (type) sizeof
4356 15 [L-R] fn() [] -> .
4358 unary +, - and * have higher precedence than the corresponding binary
4362 op_code_prio (enum tree_code code
)
4379 case TRUTH_ORIF_EXPR
:
4382 case TRUTH_AND_EXPR
:
4383 case TRUTH_ANDIF_EXPR
:
4390 case TRUTH_XOR_EXPR
:
4407 case UNORDERED_EXPR
:
4418 case VEC_WIDEN_LSHIFT_HI_EXPR
:
4419 case VEC_WIDEN_LSHIFT_LO_EXPR
:
4420 case WIDEN_LSHIFT_EXPR
:
4423 case WIDEN_SUM_EXPR
:
4425 case POINTER_PLUS_EXPR
:
4426 case POINTER_DIFF_EXPR
:
4430 case VEC_WIDEN_MULT_HI_EXPR
:
4431 case VEC_WIDEN_MULT_LO_EXPR
:
4432 case WIDEN_MULT_EXPR
:
4434 case WIDEN_MULT_PLUS_EXPR
:
4435 case WIDEN_MULT_MINUS_EXPR
:
4437 case MULT_HIGHPART_EXPR
:
4438 case TRUNC_DIV_EXPR
:
4440 case FLOOR_DIV_EXPR
:
4441 case ROUND_DIV_EXPR
:
4443 case EXACT_DIV_EXPR
:
4444 case TRUNC_MOD_EXPR
:
4446 case FLOOR_MOD_EXPR
:
4447 case ROUND_MOD_EXPR
:
4450 case TRUTH_NOT_EXPR
:
4452 case POSTINCREMENT_EXPR
:
4453 case POSTDECREMENT_EXPR
:
4454 case PREINCREMENT_EXPR
:
4455 case PREDECREMENT_EXPR
:
4461 case FIX_TRUNC_EXPR
:
4467 case ARRAY_RANGE_REF
:
4471 /* Special expressions. */
4477 case VEC_UNPACK_HI_EXPR
:
4478 case VEC_UNPACK_LO_EXPR
:
4479 case VEC_UNPACK_FLOAT_HI_EXPR
:
4480 case VEC_UNPACK_FLOAT_LO_EXPR
:
4481 case VEC_UNPACK_FIX_TRUNC_HI_EXPR
:
4482 case VEC_UNPACK_FIX_TRUNC_LO_EXPR
:
4483 case VEC_PACK_TRUNC_EXPR
:
4484 case VEC_PACK_SAT_EXPR
:
4488 /* Return an arbitrarily high precedence to avoid surrounding single
4489 VAR_DECLs in ()s. */
4494 /* Return the priority of the operator OP. */
4497 op_prio (const_tree op
)
4499 enum tree_code code
;
4504 code
= TREE_CODE (op
);
4505 if (code
== SAVE_EXPR
|| code
== NON_LVALUE_EXPR
)
4506 return op_prio (TREE_OPERAND (op
, 0));
4508 return op_code_prio (code
);
4511 /* Return the symbol associated with operator CODE. */
4514 op_symbol_code (enum tree_code code
, dump_flags_t flags
)
4522 case TRUTH_ORIF_EXPR
:
4525 case TRUTH_AND_EXPR
:
4526 case TRUTH_ANDIF_EXPR
:
4532 case TRUTH_XOR_EXPR
:
4541 return (flags
& TDF_GIMPLE
) ? "__ORDERED" : "ord";
4542 case UNORDERED_EXPR
:
4543 return (flags
& TDF_GIMPLE
) ? "__UNORDERED" : "unord";
4548 return (flags
& TDF_GIMPLE
) ? "__UNEQ" : "u==";
4556 return (flags
& TDF_GIMPLE
) ? "__UNLT" : "u<";
4561 return (flags
& TDF_GIMPLE
) ? "__UNLE" : "u<=";
4566 return (flags
& TDF_GIMPLE
) ? "__UNGT" : "u>";
4571 return (flags
& TDF_GIMPLE
) ? "__UNGE" : "u>=";
4574 return (flags
& TDF_GIMPLE
) ? "__LTGT" : "<>";
4588 case WIDEN_LSHIFT_EXPR
:
4591 case POINTER_PLUS_EXPR
:
4597 case WIDEN_SUM_EXPR
:
4600 case WIDEN_MULT_EXPR
:
4603 case MULT_HIGHPART_EXPR
:
4604 return (flags
& TDF_GIMPLE
) ? "__MULT_HIGHPART" : "h*";
4608 case POINTER_DIFF_EXPR
:
4614 case TRUTH_NOT_EXPR
:
4621 case TRUNC_DIV_EXPR
:
4628 case FLOOR_DIV_EXPR
:
4631 case ROUND_DIV_EXPR
:
4634 case EXACT_DIV_EXPR
:
4637 case TRUNC_MOD_EXPR
:
4643 case FLOOR_MOD_EXPR
:
4646 case ROUND_MOD_EXPR
:
4649 case PREDECREMENT_EXPR
:
4652 case PREINCREMENT_EXPR
:
4655 case POSTDECREMENT_EXPR
:
4658 case POSTINCREMENT_EXPR
:
4668 return "<<< ??? >>>";
4672 /* Return the symbol associated with operator OP. */
4675 op_symbol (const_tree op
, dump_flags_t flags
)
4677 return op_symbol_code (TREE_CODE (op
), flags
);
4680 /* Prints the name of a call. NODE is the CALL_EXPR_FN of a CALL_EXPR or
4681 the gimple_call_fn of a GIMPLE_CALL. */
4684 print_call_name (pretty_printer
*pp
, tree node
, dump_flags_t flags
)
4689 if (TREE_CODE (op0
) == NON_LVALUE_EXPR
)
4690 op0
= TREE_OPERAND (op0
, 0);
4693 switch (TREE_CODE (op0
))
4698 dump_function_name (pp
, op0
, flags
);
4704 op0
= TREE_OPERAND (op0
, 0);
4709 dump_generic_node (pp
, TREE_OPERAND (op0
, 0), 0, flags
, false);
4710 pp_string (pp
, ") ? ");
4711 dump_generic_node (pp
, TREE_OPERAND (op0
, 1), 0, flags
, false);
4712 pp_string (pp
, " : ");
4713 dump_generic_node (pp
, TREE_OPERAND (op0
, 2), 0, flags
, false);
4717 if (VAR_P (TREE_OPERAND (op0
, 0)))
4718 dump_function_name (pp
, TREE_OPERAND (op0
, 0), flags
);
4720 dump_generic_node (pp
, op0
, 0, flags
, false);
4724 if (integer_zerop (TREE_OPERAND (op0
, 1)))
4726 op0
= TREE_OPERAND (op0
, 0);
4733 dump_generic_node (pp
, op0
, 0, flags
, false);
4741 /* Print the first N characters in the array STR, replacing non-printable
4742 characters (including embedded nuls) with unambiguous escape sequences. */
4745 pretty_print_string (pretty_printer
*pp
, const char *str
, size_t n
)
4750 for ( ; n
; --n
, ++str
)
4755 pp_string (pp
, "\\b");
4759 pp_string (pp
, "\\f");
4763 pp_string (pp
, "\\n");
4767 pp_string (pp
, "\\r");
4771 pp_string (pp
, "\\t");
4775 pp_string (pp
, "\\v");
4779 pp_string (pp
, "\\\\");
4783 pp_string (pp
, "\\\"");
4787 pp_string (pp
, "\\'");
4791 if (str
[0] || n
> 1)
4793 if (!ISPRINT (str
[0]))
4796 sprintf (buf
, "\\x%02x", (unsigned char)str
[0]);
4797 pp_string (pp
, buf
);
4800 pp_character (pp
, str
[0]);
4808 maybe_init_pretty_print (FILE *file
)
4812 tree_pp
= new pretty_printer ();
4813 pp_needs_newline (tree_pp
) = true;
4814 pp_translate_identifiers (tree_pp
) = false;
4817 tree_pp
->set_output_stream (file
);
4821 newline_and_indent (pretty_printer
*pp
, int spc
)
4827 /* Print the identifier ID to PRETTY-PRINTER. */
4830 pp_tree_identifier (pretty_printer
*pp
, tree id
)
4832 if (pp_translate_identifiers (pp
))
4834 const char *text
= identifier_to_locale (IDENTIFIER_POINTER (id
));
4835 pp_append_text (pp
, text
, text
+ strlen (text
));
4838 pp_append_text (pp
, IDENTIFIER_POINTER (id
),
4839 IDENTIFIER_POINTER (id
) + IDENTIFIER_LENGTH (id
));
4842 /* A helper function that is used to dump function information before the
4846 dump_function_header (FILE *dump_file
, tree fdecl
, dump_flags_t flags
)
4848 const char *dname
, *aname
;
4849 struct cgraph_node
*node
= cgraph_node::get (fdecl
);
4850 struct function
*fun
= DECL_STRUCT_FUNCTION (fdecl
);
4852 dname
= lang_hooks
.decl_printable_name (fdecl
, 1);
4854 if (DECL_ASSEMBLER_NAME_SET_P (fdecl
))
4855 aname
= (IDENTIFIER_POINTER
4856 (DECL_ASSEMBLER_NAME (fdecl
)));
4858 aname
= "<unset-asm-name>";
4860 fprintf (dump_file
, "\n;; Function %s (%s, funcdef_no=%d",
4861 dname
, aname
, fun
->funcdef_no
);
4862 if (!(flags
& TDF_NOUID
))
4863 fprintf (dump_file
, ", decl_uid=%d", DECL_UID (fdecl
));
4866 fprintf (dump_file
, ", cgraph_uid=%d", node
->get_uid ());
4867 fprintf (dump_file
, ", symbol_order=%d)%s\n\n", node
->order
,
4868 node
->frequency
== NODE_FREQUENCY_HOT
4870 : node
->frequency
== NODE_FREQUENCY_UNLIKELY_EXECUTED
4871 ? " (unlikely executed)"
4872 : node
->frequency
== NODE_FREQUENCY_EXECUTED_ONCE
4873 ? " (executed once)"
4877 fprintf (dump_file
, ")\n\n");
4880 /* Dump double_int D to pretty_printer PP. UNS is true
4881 if D is unsigned and false otherwise. */
4883 pp_double_int (pretty_printer
*pp
, double_int d
, bool uns
)
4886 pp_wide_integer (pp
, d
.low
);
4887 else if (d
.fits_uhwi ())
4888 pp_unsigned_wide_integer (pp
, d
.low
);
4891 unsigned HOST_WIDE_INT low
= d
.low
;
4892 HOST_WIDE_INT high
= d
.high
;
4893 if (!uns
&& d
.is_negative ())
4896 high
= ~high
+ !low
;
4899 /* Would "%x%0*x" or "%x%*0x" get zero-padding on all
4901 sprintf (pp_buffer (pp
)->digit_buffer
,
4902 HOST_WIDE_INT_PRINT_DOUBLE_HEX
,
4903 (unsigned HOST_WIDE_INT
) high
, low
);
4904 pp_string (pp
, pp_buffer (pp
)->digit_buffer
);
4909 # pragma GCC diagnostic pop