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
);
1465 case OMP_CLAUSE_IF_PRESENT
:
1466 pp_string (pp
, "if_present");
1468 case OMP_CLAUSE_FINALIZE
:
1469 pp_string (pp
, "finalize");
1471 case OMP_CLAUSE_NOHOST
:
1472 pp_string (pp
, "nohost");
1474 case OMP_CLAUSE_DETACH
:
1475 pp_string (pp
, "detach(");
1476 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
), spc
, flags
,
1478 pp_right_paren (pp
);
1486 /* Dump chain of OMP clauses.
1488 PP, SPC and FLAGS are as in dump_generic_node. */
1491 dump_omp_clauses (pretty_printer
*pp
, tree clause
, int spc
, dump_flags_t flags
,
1498 dump_omp_clause (pp
, clause
, spc
, flags
);
1499 leading_space
= true;
1501 clause
= OMP_CLAUSE_CHAIN (clause
);
1505 /* Dump an OpenMP context selector CTX to PP. */
1507 dump_omp_context_selector (pretty_printer
*pp
, tree ctx
, int spc
,
1510 for (tree set
= ctx
; set
&& set
!= error_mark_node
; set
= TREE_CHAIN (set
))
1512 pp_string (pp
, OMP_TSS_NAME (set
));
1513 pp_string (pp
, " = {");
1514 for (tree sel
= OMP_TSS_TRAIT_SELECTORS (set
);
1515 sel
&& sel
!= error_mark_node
; sel
= TREE_CHAIN (sel
))
1517 if (OMP_TS_CODE (sel
) == OMP_TRAIT_INVALID
)
1518 pp_string (pp
, "<unknown selector>");
1520 pp_string (pp
, OMP_TS_NAME (sel
));
1521 tree score
= OMP_TS_SCORE (sel
);
1522 tree props
= OMP_TS_PROPERTIES (sel
);
1525 pp_string (pp
, " (");
1528 pp_string (pp
, "score(");
1529 dump_generic_node (pp
, score
, spc
+ 4, flags
, false);
1530 pp_string (pp
, "): ");
1532 for (tree prop
= props
; prop
; prop
= TREE_CHAIN (prop
))
1534 if (OMP_TP_NAME (prop
) == OMP_TP_NAMELIST_NODE
)
1536 const char *str
= omp_context_name_list_prop (prop
);
1537 pp_string (pp
, "\"");
1538 pretty_print_string (pp
, str
, strlen (str
) + 1);
1539 pp_string (pp
, "\"");
1541 else if (OMP_TP_NAME (prop
))
1542 dump_generic_node (pp
, OMP_TP_NAME (prop
), spc
+ 4,
1544 else if (OMP_TP_VALUE (prop
))
1545 dump_generic_node (pp
, OMP_TP_VALUE (prop
), spc
+ 4,
1547 if (TREE_CHAIN (prop
))
1553 pp_string (pp
, ")");
1555 if (TREE_CHAIN (sel
))
1561 pp_string (pp
, "}");
1562 if (TREE_CHAIN (set
))
1565 newline_and_indent (pp
, spc
);
1570 /* Wrapper for above, used for "declare variant". Compare to
1571 print_generic_expr. */
1573 print_omp_context_selector (FILE *file
, tree t
, dump_flags_t flags
)
1575 maybe_init_pretty_print (file
);
1576 dump_omp_context_selector (tree_pp
, t
, 0, flags
);
1580 /* Dump location LOC to PP. */
1583 dump_location (pretty_printer
*pp
, location_t loc
)
1585 expanded_location xloc
= expand_location (loc
);
1586 int discriminator
= get_discriminator_from_loc (loc
);
1588 pp_left_bracket (pp
);
1591 pp_string (pp
, xloc
.file
);
1592 pp_string (pp
, ":");
1594 pp_decimal_int (pp
, xloc
.line
);
1596 pp_decimal_int (pp
, xloc
.column
);
1599 pp_string (pp
, " discrim ");
1600 pp_decimal_int (pp
, discriminator
);
1602 pp_string (pp
, "] ");
1606 /* Dump lexical block BLOCK. PP, SPC and FLAGS are as in
1607 dump_generic_node. */
1610 dump_block_node (pretty_printer
*pp
, tree block
, int spc
, dump_flags_t flags
)
1614 pp_string (pp
, "BLOCK #");
1615 pp_decimal_int (pp
, BLOCK_NUMBER (block
));
1616 pp_character (pp
, ' ');
1618 if (flags
& TDF_ADDRESS
)
1620 pp_character (pp
, '[');
1621 pp_scalar (pp
, "%p", (void *) block
);
1622 pp_string (pp
, "] ");
1625 if (TREE_ASM_WRITTEN (block
))
1626 pp_string (pp
, "[written] ");
1628 if (flags
& TDF_SLIM
)
1631 if (BLOCK_SOURCE_LOCATION (block
))
1632 dump_location (pp
, BLOCK_SOURCE_LOCATION (block
));
1634 newline_and_indent (pp
, spc
+ 2);
1636 if (BLOCK_SUPERCONTEXT (block
))
1638 pp_string (pp
, "SUPERCONTEXT: ");
1639 dump_generic_node (pp
, BLOCK_SUPERCONTEXT (block
), 0,
1640 flags
| TDF_SLIM
, false);
1641 newline_and_indent (pp
, spc
+ 2);
1644 if (BLOCK_SUBBLOCKS (block
))
1646 pp_string (pp
, "SUBBLOCKS: ");
1647 for (t
= BLOCK_SUBBLOCKS (block
); t
; t
= BLOCK_CHAIN (t
))
1649 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
1652 newline_and_indent (pp
, spc
+ 2);
1655 if (BLOCK_CHAIN (block
))
1657 pp_string (pp
, "SIBLINGS: ");
1658 for (t
= BLOCK_CHAIN (block
); t
; t
= BLOCK_CHAIN (t
))
1660 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
1663 newline_and_indent (pp
, spc
+ 2);
1666 if (BLOCK_VARS (block
))
1668 pp_string (pp
, "VARS: ");
1669 for (t
= BLOCK_VARS (block
); t
; t
= TREE_CHAIN (t
))
1671 dump_generic_node (pp
, t
, 0, flags
, false);
1674 newline_and_indent (pp
, spc
+ 2);
1677 if (vec_safe_length (BLOCK_NONLOCALIZED_VARS (block
)) > 0)
1680 vec
<tree
, va_gc
> *nlv
= BLOCK_NONLOCALIZED_VARS (block
);
1682 pp_string (pp
, "NONLOCALIZED_VARS: ");
1683 FOR_EACH_VEC_ELT (*nlv
, i
, t
)
1685 dump_generic_node (pp
, t
, 0, flags
, false);
1688 newline_and_indent (pp
, spc
+ 2);
1691 if (BLOCK_ABSTRACT_ORIGIN (block
))
1693 pp_string (pp
, "ABSTRACT_ORIGIN: ");
1694 dump_generic_node (pp
, BLOCK_ABSTRACT_ORIGIN (block
), 0,
1695 flags
| TDF_SLIM
, false);
1696 newline_and_indent (pp
, spc
+ 2);
1699 if (BLOCK_FRAGMENT_ORIGIN (block
))
1701 pp_string (pp
, "FRAGMENT_ORIGIN: ");
1702 dump_generic_node (pp
, BLOCK_FRAGMENT_ORIGIN (block
), 0,
1703 flags
| TDF_SLIM
, false);
1704 newline_and_indent (pp
, spc
+ 2);
1707 if (BLOCK_FRAGMENT_CHAIN (block
))
1709 pp_string (pp
, "FRAGMENT_CHAIN: ");
1710 for (t
= BLOCK_FRAGMENT_CHAIN (block
); t
; t
= BLOCK_FRAGMENT_CHAIN (t
))
1712 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
1715 newline_and_indent (pp
, spc
+ 2);
1719 /* Dump #pragma omp atomic memory order clause. */
1722 dump_omp_atomic_memory_order (pretty_printer
*pp
, enum omp_memory_order mo
)
1724 switch (mo
& OMP_MEMORY_ORDER_MASK
)
1726 case OMP_MEMORY_ORDER_RELAXED
:
1727 pp_string (pp
, " relaxed");
1729 case OMP_MEMORY_ORDER_SEQ_CST
:
1730 pp_string (pp
, " seq_cst");
1732 case OMP_MEMORY_ORDER_ACQ_REL
:
1733 pp_string (pp
, " acq_rel");
1735 case OMP_MEMORY_ORDER_ACQUIRE
:
1736 pp_string (pp
, " acquire");
1738 case OMP_MEMORY_ORDER_RELEASE
:
1739 pp_string (pp
, " release");
1741 case OMP_MEMORY_ORDER_UNSPECIFIED
:
1746 switch (mo
& OMP_FAIL_MEMORY_ORDER_MASK
)
1748 case OMP_FAIL_MEMORY_ORDER_RELAXED
:
1749 pp_string (pp
, " fail(relaxed)");
1751 case OMP_FAIL_MEMORY_ORDER_SEQ_CST
:
1752 pp_string (pp
, " fail(seq_cst)");
1754 case OMP_FAIL_MEMORY_ORDER_ACQUIRE
:
1755 pp_string (pp
, " fail(acquire)");
1757 case OMP_FAIL_MEMORY_ORDER_UNSPECIFIED
:
1764 /* Helper to dump a MEM_REF node. */
1767 dump_mem_ref (pretty_printer
*pp
, tree node
, int spc
, dump_flags_t flags
)
1769 if ((TREE_CODE (node
) == MEM_REF
1770 || TREE_CODE (node
) == TARGET_MEM_REF
)
1771 && (flags
& TDF_GIMPLE
))
1773 pp_string (pp
, "__MEM <");
1774 dump_generic_node (pp
, TREE_TYPE (node
),
1775 spc
, flags
| TDF_SLIM
, false);
1776 if (TYPE_ALIGN (TREE_TYPE (node
))
1777 != TYPE_ALIGN (TYPE_MAIN_VARIANT (TREE_TYPE (node
))))
1779 pp_string (pp
, ", ");
1780 pp_decimal_int (pp
, TYPE_ALIGN (TREE_TYPE (node
)));
1783 pp_string (pp
, " (");
1784 if (TREE_TYPE (TREE_OPERAND (node
, 0))
1785 != TREE_TYPE (TREE_OPERAND (node
, 1)))
1788 dump_generic_node (pp
, TREE_TYPE (TREE_OPERAND (node
, 1)),
1789 spc
, flags
| TDF_SLIM
, false);
1790 pp_right_paren (pp
);
1792 dump_generic_node (pp
, TREE_OPERAND (node
, 0),
1793 spc
, flags
| TDF_SLIM
, false);
1794 if (! integer_zerop (TREE_OPERAND (node
, 1)))
1796 pp_string (pp
, " + ");
1797 dump_generic_node (pp
, TREE_OPERAND (node
, 1),
1798 spc
, flags
| TDF_SLIM
, false);
1800 if (TREE_CODE (node
) == TARGET_MEM_REF
)
1802 if (TREE_OPERAND (node
, 2))
1805 pp_string (pp
, " + ");
1806 dump_generic_node (pp
, TREE_OPERAND (node
, 2),
1807 spc
, flags
| TDF_SLIM
, false);
1808 pp_string (pp
, " * ");
1809 dump_generic_node (pp
, TREE_OPERAND (node
, 3),
1810 spc
, flags
| TDF_SLIM
, false);
1812 if (TREE_OPERAND (node
, 4))
1815 pp_string (pp
, " + ");
1816 dump_generic_node (pp
, TREE_OPERAND (node
, 4),
1817 spc
, flags
| TDF_SLIM
, false);
1820 pp_right_paren (pp
);
1822 else if (TREE_CODE (node
) == MEM_REF
1823 && integer_zerop (TREE_OPERAND (node
, 1))
1824 /* Dump the types of INTEGER_CSTs explicitly, for we can't
1825 infer them and MEM_ATTR caching will share MEM_REFs
1826 with differently-typed op0s. */
1827 && TREE_CODE (TREE_OPERAND (node
, 0)) != INTEGER_CST
1828 /* Released SSA_NAMES have no TREE_TYPE. */
1829 && TREE_TYPE (TREE_OPERAND (node
, 0)) != NULL_TREE
1830 /* Same pointer types, but ignoring POINTER_TYPE vs.
1832 && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 0)))
1833 == TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 1))))
1834 && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (node
, 0)))
1835 == TYPE_MODE (TREE_TYPE (TREE_OPERAND (node
, 1))))
1836 && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node
, 0)))
1837 == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node
, 1))))
1838 /* Same value types ignoring qualifiers. */
1839 && (TYPE_MAIN_VARIANT (TREE_TYPE (node
))
1840 == TYPE_MAIN_VARIANT
1841 (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 1)))))
1842 && (!(flags
& TDF_ALIAS
)
1843 || MR_DEPENDENCE_CLIQUE (node
) == 0))
1845 if (TREE_CODE (TREE_OPERAND (node
, 0)) != ADDR_EXPR
)
1847 /* Enclose pointers to arrays in parentheses. */
1848 tree op0
= TREE_OPERAND (node
, 0);
1849 tree op0type
= TREE_TYPE (op0
);
1850 if (POINTER_TYPE_P (op0type
)
1851 && TREE_CODE (TREE_TYPE (op0type
)) == ARRAY_TYPE
)
1854 dump_generic_node (pp
, op0
, spc
, flags
, false);
1855 if (POINTER_TYPE_P (op0type
)
1856 && TREE_CODE (TREE_TYPE (op0type
)) == ARRAY_TYPE
)
1857 pp_right_paren (pp
);
1860 dump_generic_node (pp
,
1861 TREE_OPERAND (TREE_OPERAND (node
, 0), 0),
1866 pp_string (pp
, "MEM");
1868 tree nodetype
= TREE_TYPE (node
);
1869 tree op0
= TREE_OPERAND (node
, 0);
1870 tree op1
= TREE_OPERAND (node
, 1);
1871 tree op1type
= TYPE_MAIN_VARIANT (TREE_TYPE (op1
));
1873 tree op0size
= TYPE_SIZE (nodetype
);
1874 tree op1size
= TYPE_SIZE (TREE_TYPE (op1type
));
1876 if (!op0size
|| !op1size
1877 || !operand_equal_p (op0size
, op1size
, 0))
1879 pp_string (pp
, " <");
1880 /* If the size of the type of the operand is not the same
1881 as the size of the MEM_REF expression include the type
1882 of the latter similar to the TDF_GIMPLE output to make
1883 it clear how many bytes of memory are being accessed. */
1884 dump_generic_node (pp
, nodetype
, spc
, flags
| TDF_SLIM
, false);
1885 pp_string (pp
, "> ");
1888 pp_string (pp
, "[(");
1889 dump_generic_node (pp
, op1type
, spc
, flags
| TDF_SLIM
, false);
1890 pp_right_paren (pp
);
1891 dump_generic_node (pp
, op0
, spc
, flags
, false);
1892 if (!integer_zerop (op1
))
1894 pp_string (pp
, " + ");
1895 dump_generic_node (pp
, op1
, spc
, flags
, false);
1897 if (TREE_CODE (node
) == TARGET_MEM_REF
)
1899 tree tmp
= TMR_INDEX2 (node
);
1902 pp_string (pp
, " + ");
1903 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1905 tmp
= TMR_INDEX (node
);
1908 pp_string (pp
, " + ");
1909 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1910 tmp
= TMR_STEP (node
);
1911 pp_string (pp
, " * ");
1913 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1915 pp_string (pp
, "1");
1918 if ((flags
& TDF_ALIAS
)
1919 && MR_DEPENDENCE_CLIQUE (node
) != 0)
1921 pp_string (pp
, " clique ");
1922 pp_unsigned_wide_integer (pp
, MR_DEPENDENCE_CLIQUE (node
));
1923 pp_string (pp
, " base ");
1924 pp_unsigned_wide_integer (pp
, MR_DEPENDENCE_BASE (node
));
1926 pp_right_bracket (pp
);
1930 /* Helper function for dump_generic_node. Dump INIT or COND expression for
1931 OpenMP loop non-rectangular iterators. */
1934 dump_omp_loop_non_rect_expr (pretty_printer
*pp
, tree node
, int spc
,
1937 gcc_assert (TREE_CODE (node
) == TREE_VEC
);
1938 dump_generic_node (pp
, TREE_VEC_ELT (node
, 0), spc
, flags
, false);
1939 pp_string (pp
, " * ");
1940 if (op_prio (TREE_VEC_ELT (node
, 1)) <= op_code_prio (MULT_EXPR
))
1943 dump_generic_node (pp
, TREE_VEC_ELT (node
, 1), spc
, flags
, false);
1944 pp_right_paren (pp
);
1947 dump_generic_node (pp
, TREE_VEC_ELT (node
, 1), spc
, flags
, false);
1948 pp_string (pp
, " + ");
1949 if (op_prio (TREE_VEC_ELT (node
, 1)) <= op_code_prio (PLUS_EXPR
))
1952 dump_generic_node (pp
, TREE_VEC_ELT (node
, 2), spc
, flags
, false);
1953 pp_right_paren (pp
);
1956 dump_generic_node (pp
, TREE_VEC_ELT (node
, 2), spc
, flags
, false);
1959 /* Dump the node NODE on the pretty_printer PP, SPC spaces of
1960 indent. FLAGS specifies details to show in the dump (see TDF_* in
1961 dumpfile.h). If IS_STMT is true, the object printed is considered
1962 to be a statement and it is terminated by ';' if appropriate. */
1965 dump_generic_node (pretty_printer
*pp
, tree node
, int spc
, dump_flags_t flags
,
1972 enum tree_code code
;
1974 if (node
== NULL_TREE
)
1977 is_expr
= EXPR_P (node
);
1979 if (is_stmt
&& (flags
& TDF_STMTADDR
))
1981 pp_string (pp
, "<&");
1982 pp_scalar (pp
, "%p", (void *)node
);
1983 pp_string (pp
, "> ");
1986 if ((flags
& TDF_LINENO
) && EXPR_HAS_LOCATION (node
))
1987 dump_location (pp
, EXPR_LOCATION (node
));
1989 code
= TREE_CODE (node
);
1993 pp_string (pp
, "<<< error >>>");
1996 case IDENTIFIER_NODE
:
1997 pp_tree_identifier (pp
, node
);
2001 while (node
&& node
!= error_mark_node
)
2003 if (TREE_PURPOSE (node
))
2005 dump_generic_node (pp
, TREE_PURPOSE (node
), spc
, flags
, false);
2008 dump_generic_node (pp
, TREE_VALUE (node
), spc
, flags
, false);
2009 node
= TREE_CHAIN (node
);
2010 if (node
&& TREE_CODE (node
) == TREE_LIST
)
2019 dump_generic_node (pp
, BINFO_TYPE (node
), spc
, flags
, false);
2026 if (TREE_VEC_LENGTH (node
) > 0)
2028 size_t len
= TREE_VEC_LENGTH (node
);
2029 for (i
= 0; i
< len
- 1; i
++)
2031 dump_generic_node (pp
, TREE_VEC_ELT (node
, i
), spc
, flags
,
2036 dump_generic_node (pp
, TREE_VEC_ELT (node
, len
- 1), spc
,
2039 pp_right_brace (pp
);
2046 case FIXED_POINT_TYPE
:
2054 unsigned int quals
= TYPE_QUALS (node
);
2055 enum tree_code_class tclass
;
2057 if (quals
& TYPE_QUAL_ATOMIC
)
2058 pp_string (pp
, "atomic ");
2059 if (quals
& TYPE_QUAL_CONST
)
2060 pp_string (pp
, "const ");
2061 if (quals
& TYPE_QUAL_VOLATILE
)
2062 pp_string (pp
, "volatile ");
2063 if (quals
& TYPE_QUAL_RESTRICT
)
2064 pp_string (pp
, "restrict ");
2066 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
2068 pp_string (pp
, "<address-space-");
2069 pp_decimal_int (pp
, TYPE_ADDR_SPACE (node
));
2070 pp_string (pp
, "> ");
2073 tclass
= TREE_CODE_CLASS (TREE_CODE (node
));
2075 if (tclass
== tcc_declaration
)
2077 if (DECL_NAME (node
))
2078 dump_decl_name (pp
, node
, flags
);
2080 pp_string (pp
, "<unnamed type decl>");
2082 else if (tclass
== tcc_type
)
2084 if ((flags
& TDF_GIMPLE
) && node
== sizetype
)
2085 pp_string (pp
, "__SIZETYPE__");
2086 else if (TYPE_NAME (node
))
2088 if (TREE_CODE (TYPE_NAME (node
)) == IDENTIFIER_NODE
)
2089 pp_tree_identifier (pp
, TYPE_NAME (node
));
2090 else if (TREE_CODE (TYPE_NAME (node
)) == TYPE_DECL
2091 && DECL_NAME (TYPE_NAME (node
)))
2092 dump_decl_name (pp
, TYPE_NAME (node
), flags
);
2094 pp_string (pp
, "<unnamed type>");
2096 else if (TREE_CODE (node
) == VECTOR_TYPE
)
2098 if (flags
& TDF_GIMPLE
)
2100 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2101 pp_string (pp
, " [[gnu::vector_size(");
2103 (pp
, tree_to_poly_uint64 (TYPE_SIZE_UNIT (node
)));
2104 pp_string (pp
, ")]]");
2108 pp_string (pp
, "vector");
2110 pp_wide_integer (pp
, TYPE_VECTOR_SUBPARTS (node
));
2111 pp_string (pp
, ") ");
2112 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2115 else if (TREE_CODE (node
) == INTEGER_TYPE
)
2117 if (TYPE_PRECISION (node
) == CHAR_TYPE_SIZE
)
2118 pp_string (pp
, (TYPE_UNSIGNED (node
)
2121 else if (TYPE_PRECISION (node
) == SHORT_TYPE_SIZE
)
2122 pp_string (pp
, (TYPE_UNSIGNED (node
)
2125 else if (TYPE_PRECISION (node
) == INT_TYPE_SIZE
)
2126 pp_string (pp
, (TYPE_UNSIGNED (node
)
2129 else if (TYPE_PRECISION (node
) == LONG_TYPE_SIZE
)
2130 pp_string (pp
, (TYPE_UNSIGNED (node
)
2133 else if (TYPE_PRECISION (node
) == LONG_LONG_TYPE_SIZE
)
2134 pp_string (pp
, (TYPE_UNSIGNED (node
)
2135 ? "unsigned long long"
2136 : "signed long long"));
2137 else if (TYPE_PRECISION (node
) >= CHAR_TYPE_SIZE
2138 && pow2p_hwi (TYPE_PRECISION (node
)))
2140 pp_string (pp
, (TYPE_UNSIGNED (node
) ? "uint" : "int"));
2141 pp_decimal_int (pp
, TYPE_PRECISION (node
));
2142 pp_string (pp
, "_t");
2146 pp_string (pp
, (TYPE_UNSIGNED (node
)
2147 ? "<unnamed-unsigned:"
2148 : "<unnamed-signed:"));
2149 pp_decimal_int (pp
, TYPE_PRECISION (node
));
2153 else if (TREE_CODE (node
) == COMPLEX_TYPE
)
2155 pp_string (pp
, "__complex__ ");
2156 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2158 else if (TREE_CODE (node
) == REAL_TYPE
)
2160 pp_string (pp
, "<float:");
2161 pp_decimal_int (pp
, TYPE_PRECISION (node
));
2164 else if (TREE_CODE (node
) == FIXED_POINT_TYPE
)
2166 pp_string (pp
, "<fixed-point-");
2167 pp_string (pp
, TYPE_SATURATING (node
) ? "sat:" : "nonsat:");
2168 pp_decimal_int (pp
, TYPE_PRECISION (node
));
2171 else if (TREE_CODE (node
) == BOOLEAN_TYPE
)
2173 pp_string (pp
, (TYPE_UNSIGNED (node
)
2174 ? "<unsigned-boolean:"
2175 : "<signed-boolean:"));
2176 pp_decimal_int (pp
, TYPE_PRECISION (node
));
2179 else if (TREE_CODE (node
) == BITINT_TYPE
)
2181 if (TYPE_UNSIGNED (node
))
2182 pp_string (pp
, "unsigned ");
2183 pp_string (pp
, "_BitInt(");
2184 pp_decimal_int (pp
, TYPE_PRECISION (node
));
2185 pp_right_paren (pp
);
2187 else if (TREE_CODE (node
) == VOID_TYPE
)
2188 pp_string (pp
, "void");
2190 pp_string (pp
, "<unnamed type>");
2196 case REFERENCE_TYPE
:
2197 str
= (TREE_CODE (node
) == POINTER_TYPE
? "*" : "&");
2199 if (TREE_TYPE (node
) == NULL
)
2201 pp_string (pp
, str
);
2202 pp_string (pp
, "<null type>");
2204 else if (TREE_CODE (TREE_TYPE (node
)) == FUNCTION_TYPE
)
2206 tree fnode
= TREE_TYPE (node
);
2208 dump_generic_node (pp
, TREE_TYPE (fnode
), spc
, flags
, false);
2211 pp_string (pp
, str
);
2212 if (TYPE_IDENTIFIER (node
))
2213 dump_generic_node (pp
, TYPE_NAME (node
), spc
, flags
, false);
2214 else if (flags
& TDF_NOUID
)
2215 pp_string (pp
, "<Txxxx>");
2218 pp_string (pp
, "<T");
2219 pp_scalar (pp
, "%x", TYPE_UID (node
));
2220 pp_character (pp
, '>');
2223 pp_right_paren (pp
);
2224 dump_function_declaration (pp
, fnode
, spc
, flags
);
2228 unsigned int quals
= TYPE_QUALS (node
);
2230 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2232 pp_string (pp
, str
);
2234 if (quals
& TYPE_QUAL_CONST
)
2235 pp_string (pp
, " const");
2236 if (quals
& TYPE_QUAL_VOLATILE
)
2237 pp_string (pp
, " volatile");
2238 if (quals
& TYPE_QUAL_RESTRICT
)
2239 pp_string (pp
, " restrict");
2241 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
2243 pp_string (pp
, " <address-space-");
2244 pp_decimal_int (pp
, TYPE_ADDR_SPACE (node
));
2248 if (TYPE_REF_CAN_ALIAS_ALL (node
))
2249 pp_string (pp
, " {ref-all}");
2258 case TARGET_MEM_REF
:
2259 dump_mem_ref (pp
, node
, spc
, flags
);
2264 unsigned int quals
= TYPE_QUALS (node
);
2267 if (quals
& TYPE_QUAL_ATOMIC
)
2268 pp_string (pp
, "atomic ");
2269 if (quals
& TYPE_QUAL_CONST
)
2270 pp_string (pp
, "const ");
2271 if (quals
& TYPE_QUAL_VOLATILE
)
2272 pp_string (pp
, "volatile ");
2274 /* Print the innermost component type. */
2275 for (tmp
= TREE_TYPE (node
); TREE_CODE (tmp
) == ARRAY_TYPE
;
2276 tmp
= TREE_TYPE (tmp
))
2279 /* Avoid to print recursively the array. */
2280 /* FIXME : Not implemented correctly, see print_struct_decl. */
2281 if (TREE_CODE (tmp
) != POINTER_TYPE
|| TREE_TYPE (tmp
) != node
)
2282 dump_generic_node (pp
, tmp
, spc
, flags
, false);
2284 /* Print the dimensions. */
2285 for (tmp
= node
; TREE_CODE (tmp
) == ARRAY_TYPE
; tmp
= TREE_TYPE (tmp
))
2286 dump_array_domain (pp
, TYPE_DOMAIN (tmp
), spc
, flags
);
2292 case QUAL_UNION_TYPE
:
2294 unsigned int quals
= TYPE_QUALS (node
);
2296 if (quals
& TYPE_QUAL_ATOMIC
)
2297 pp_string (pp
, "atomic ");
2298 if (quals
& TYPE_QUAL_CONST
)
2299 pp_string (pp
, "const ");
2300 if (quals
& TYPE_QUAL_VOLATILE
)
2301 pp_string (pp
, "volatile ");
2303 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
2305 pp_string (pp
, "<address-space-");
2306 pp_decimal_int (pp
, TYPE_ADDR_SPACE (node
));
2307 pp_string (pp
, "> ");
2310 /* Print the name of the structure. */
2311 if (TREE_CODE (node
) == RECORD_TYPE
)
2312 pp_string (pp
, "struct ");
2313 else if (TREE_CODE (node
) == UNION_TYPE
)
2314 pp_string (pp
, "union ");
2316 if (TYPE_NAME (node
))
2317 dump_generic_node (pp
, TYPE_NAME (node
), spc
, flags
, false);
2318 else if (!(flags
& TDF_SLIM
))
2319 /* FIXME: If we eliminate the 'else' above and attempt
2320 to show the fields for named types, we may get stuck
2321 following a cycle of pointers to structs. The alleged
2322 self-reference check in print_struct_decl will not detect
2323 cycles involving more than one pointer or struct type. */
2324 print_struct_decl (pp
, node
, spc
, flags
);
2333 if (flags
& TDF_GIMPLE
2334 && (POINTER_TYPE_P (TREE_TYPE (node
))
2335 || (TYPE_PRECISION (TREE_TYPE (node
))
2336 < TYPE_PRECISION (integer_type_node
))
2337 || exact_log2 (TYPE_PRECISION (TREE_TYPE (node
))) == -1
2338 || tree_int_cst_sgn (node
) < 0))
2340 pp_string (pp
, "_Literal (");
2341 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2342 pp_string (pp
, ") ");
2344 if (TREE_CODE (TREE_TYPE (node
)) == POINTER_TYPE
2345 && ! (flags
& TDF_GIMPLE
))
2347 /* In the case of a pointer, one may want to divide by the
2348 size of the pointed-to type. Unfortunately, this not
2349 straightforward. The C front-end maps expressions
2354 in such a way that the two INTEGER_CST nodes for "5" have
2355 different values but identical types. In the latter
2356 case, the 5 is multiplied by sizeof (int) in c-common.cc
2357 (pointer_int_sum) to convert it to a byte address, and
2358 yet the type of the node is left unchanged. Argh. What
2359 is consistent though is that the number value corresponds
2360 to bytes (UNITS) offset.
2362 NB: Neither of the following divisors can be trivially
2363 used to recover the original literal:
2365 TREE_INT_CST_LOW (TYPE_SIZE_UNIT (TREE_TYPE (node)))
2366 TYPE_PRECISION (TREE_TYPE (TREE_TYPE (node))) */
2367 pp_wide_integer (pp
, TREE_INT_CST_LOW (node
));
2368 pp_string (pp
, "B"); /* pseudo-unit */
2370 else if (tree_fits_shwi_p (node
))
2371 pp_wide_integer (pp
, tree_to_shwi (node
));
2372 else if (tree_fits_uhwi_p (node
))
2373 pp_unsigned_wide_integer (pp
, tree_to_uhwi (node
));
2376 wide_int val
= wi::to_wide (node
);
2378 if (wi::neg_p (val
, TYPE_SIGN (TREE_TYPE (node
))))
2384 print_hex_buf_size (val
, &len
);
2385 if (UNLIKELY (len
> sizeof (pp_buffer (pp
)->digit_buffer
)))
2387 char *buf
= XALLOCAVEC (char, len
);
2388 print_hex (val
, buf
);
2389 pp_string (pp
, buf
);
2393 print_hex (val
, pp_buffer (pp
)->digit_buffer
);
2394 pp_string (pp
, pp_buffer (pp
)->digit_buffer
);
2397 if ((flags
& TDF_GIMPLE
)
2398 && ! (POINTER_TYPE_P (TREE_TYPE (node
))
2399 || (TYPE_PRECISION (TREE_TYPE (node
))
2400 < TYPE_PRECISION (integer_type_node
))
2401 || exact_log2 (TYPE_PRECISION (TREE_TYPE (node
))) == -1))
2403 if (TYPE_UNSIGNED (TREE_TYPE (node
)))
2404 pp_character (pp
, 'u');
2405 if (TYPE_PRECISION (TREE_TYPE (node
))
2406 == TYPE_PRECISION (unsigned_type_node
))
2408 else if (TYPE_PRECISION (TREE_TYPE (node
))
2409 == TYPE_PRECISION (long_unsigned_type_node
))
2410 pp_character (pp
, 'l');
2411 else if (TYPE_PRECISION (TREE_TYPE (node
))
2412 == TYPE_PRECISION (long_long_unsigned_type_node
))
2413 pp_string (pp
, "ll");
2415 if (TREE_OVERFLOW (node
))
2416 pp_string (pp
, "(OVF)");
2420 pp_string (pp
, "POLY_INT_CST [");
2421 dump_generic_node (pp
, POLY_INT_CST_COEFF (node
, 0), spc
, flags
, false);
2422 for (unsigned int i
= 1; i
< NUM_POLY_INT_COEFFS
; ++i
)
2424 pp_string (pp
, ", ");
2425 dump_generic_node (pp
, POLY_INT_CST_COEFF (node
, i
),
2428 pp_string (pp
, "]");
2432 /* Code copied from print_node. */
2435 if (TREE_OVERFLOW (node
))
2436 pp_string (pp
, " overflow");
2438 d
= TREE_REAL_CST (node
);
2439 if (REAL_VALUE_ISINF (d
))
2440 pp_string (pp
, REAL_VALUE_NEGATIVE (d
) ? " -Inf" : " Inf");
2441 else if (REAL_VALUE_ISNAN (d
))
2442 pp_string (pp
, " Nan");
2446 real_to_decimal (string
, &d
, sizeof (string
), 0, 1);
2447 pp_string (pp
, string
);
2455 fixed_to_decimal (string
, TREE_FIXED_CST_PTR (node
), sizeof (string
));
2456 pp_string (pp
, string
);
2461 pp_string (pp
, "__complex__ (");
2462 dump_generic_node (pp
, TREE_REALPART (node
), spc
, flags
, false);
2463 pp_string (pp
, ", ");
2464 dump_generic_node (pp
, TREE_IMAGPART (node
), spc
, flags
, false);
2465 pp_right_paren (pp
);
2470 pp_string (pp
, "\"");
2471 if (unsigned nbytes
= TREE_STRING_LENGTH (node
))
2472 pretty_print_string (pp
, TREE_STRING_POINTER (node
), nbytes
);
2473 pp_string (pp
, "\"");
2480 if (flags
& TDF_GIMPLE
)
2482 pp_string (pp
, "_Literal (");
2483 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2484 pp_string (pp
, ") ");
2486 pp_string (pp
, "{ ");
2487 unsigned HOST_WIDE_INT nunits
;
2488 if (!VECTOR_CST_NELTS (node
).is_constant (&nunits
))
2489 nunits
= vector_cst_encoded_nelts (node
);
2490 for (i
= 0; i
< nunits
; ++i
)
2493 pp_string (pp
, ", ");
2494 dump_generic_node (pp
, VECTOR_CST_ELT (node
, i
),
2497 if (!VECTOR_CST_NELTS (node
).is_constant ())
2498 pp_string (pp
, ", ...");
2499 pp_string (pp
, " }");
2505 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2507 if (TREE_CODE (node
) == METHOD_TYPE
)
2509 if (TYPE_METHOD_BASETYPE (node
))
2510 dump_generic_node (pp
, TYPE_NAME (TYPE_METHOD_BASETYPE (node
)),
2513 pp_string (pp
, "<null method basetype>");
2514 pp_colon_colon (pp
);
2516 if (TYPE_IDENTIFIER (node
))
2517 dump_generic_node (pp
, TYPE_NAME (node
), spc
, flags
, false);
2518 else if (TYPE_NAME (node
) && DECL_NAME (TYPE_NAME (node
)))
2519 dump_decl_name (pp
, TYPE_NAME (node
), flags
);
2520 else if (flags
& TDF_NOUID
)
2521 pp_string (pp
, "<Txxxx>");
2524 pp_string (pp
, "<T");
2525 pp_scalar (pp
, "%x", TYPE_UID (node
));
2526 pp_character (pp
, '>');
2528 dump_function_declaration (pp
, node
, spc
, flags
);
2533 dump_decl_name (pp
, node
, flags
);
2537 if (DECL_NAME (node
))
2538 dump_decl_name (pp
, node
, flags
);
2539 else if (LABEL_DECL_UID (node
) != -1)
2541 if (flags
& TDF_GIMPLE
)
2543 pp_character (pp
, 'L');
2544 pp_decimal_int (pp
, (int) LABEL_DECL_UID (node
));
2548 pp_string (pp
, "<L");
2549 pp_decimal_int (pp
, (int) LABEL_DECL_UID (node
));
2550 pp_character (pp
, '>');
2555 if (flags
& TDF_NOUID
)
2556 pp_string (pp
, "<D.xxxx>");
2559 if (flags
& TDF_GIMPLE
)
2561 pp_character (pp
, 'D');
2562 pp_scalar (pp
, "%u", DECL_UID (node
));
2566 pp_string (pp
, "<D.");
2567 pp_scalar (pp
, "%u", DECL_UID (node
));
2568 pp_character (pp
, '>');
2575 if (DECL_IS_UNDECLARED_BUILTIN (node
))
2577 /* Don't print the declaration of built-in types. */
2580 if (DECL_NAME (node
))
2581 dump_decl_name (pp
, node
, flags
);
2582 else if (TYPE_NAME (TREE_TYPE (node
)) != node
)
2584 pp_string (pp
, (TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
2585 ? "union" : "struct "));
2586 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2589 pp_string (pp
, "<anon>");
2595 case DEBUG_EXPR_DECL
:
2596 case NAMESPACE_DECL
:
2598 dump_decl_name (pp
, node
, flags
);
2602 pp_string (pp
, "<retval>");
2606 op0
= TREE_OPERAND (node
, 0);
2609 && (TREE_CODE (op0
) == INDIRECT_REF
2610 || (TREE_CODE (op0
) == MEM_REF
2611 && TREE_CODE (TREE_OPERAND (op0
, 0)) != ADDR_EXPR
2612 && integer_zerop (TREE_OPERAND (op0
, 1))
2613 /* Dump the types of INTEGER_CSTs explicitly, for we
2614 can't infer them and MEM_ATTR caching will share
2615 MEM_REFs with differently-typed op0s. */
2616 && TREE_CODE (TREE_OPERAND (op0
, 0)) != INTEGER_CST
2617 /* Released SSA_NAMES have no TREE_TYPE. */
2618 && TREE_TYPE (TREE_OPERAND (op0
, 0)) != NULL_TREE
2619 /* Same pointer types, but ignoring POINTER_TYPE vs.
2621 && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 0)))
2622 == TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 1))))
2623 && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0
, 0)))
2624 == TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0
, 1))))
2625 && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0
, 0)))
2626 == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0
, 1))))
2627 /* Same value types ignoring qualifiers. */
2628 && (TYPE_MAIN_VARIANT (TREE_TYPE (op0
))
2629 == TYPE_MAIN_VARIANT
2630 (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 1)))))
2631 && MR_DEPENDENCE_CLIQUE (op0
) == 0)))
2633 op0
= TREE_OPERAND (op0
, 0);
2636 if (op_prio (op0
) < op_prio (node
))
2638 dump_generic_node (pp
, op0
, spc
, flags
, false);
2639 if (op_prio (op0
) < op_prio (node
))
2640 pp_right_paren (pp
);
2641 pp_string (pp
, str
);
2642 op1
= TREE_OPERAND (node
, 1);
2643 dump_generic_node (pp
, op1
, spc
, flags
, false);
2644 if (DECL_P (op1
)) /* Not always a decl in the C++ FE. */
2645 if (tree off
= component_ref_field_offset (node
))
2646 if (TREE_CODE (off
) != INTEGER_CST
)
2648 pp_string (pp
, "{off: ");
2649 dump_generic_node (pp
, off
, spc
, flags
, false);
2650 pp_right_brace (pp
);
2655 if (flags
& TDF_GIMPLE
)
2657 pp_string (pp
, "__BIT_FIELD_REF <");
2658 dump_generic_node (pp
, TREE_TYPE (node
),
2659 spc
, flags
| TDF_SLIM
, false);
2660 if (TYPE_ALIGN (TREE_TYPE (node
))
2661 != TYPE_ALIGN (TYPE_MAIN_VARIANT (TREE_TYPE (node
))))
2663 pp_string (pp
, ", ");
2664 pp_decimal_int (pp
, TYPE_ALIGN (TREE_TYPE (node
)));
2667 pp_string (pp
, " (");
2668 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
,
2669 flags
| TDF_SLIM
, false);
2670 pp_string (pp
, ", ");
2671 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
,
2672 flags
| TDF_SLIM
, false);
2673 pp_string (pp
, ", ");
2674 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
,
2675 flags
| TDF_SLIM
, false);
2676 pp_right_paren (pp
);
2680 pp_string (pp
, "BIT_FIELD_REF <");
2681 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2682 pp_string (pp
, ", ");
2683 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2684 pp_string (pp
, ", ");
2685 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2690 case BIT_INSERT_EXPR
:
2691 pp_string (pp
, "BIT_INSERT_EXPR <");
2692 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2693 pp_string (pp
, ", ");
2694 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2695 pp_string (pp
, ", ");
2696 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2697 pp_string (pp
, " (");
2698 if (INTEGRAL_TYPE_P (TREE_TYPE (TREE_OPERAND (node
, 1))))
2700 TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (node
, 1))));
2702 dump_generic_node (pp
, TYPE_SIZE (TREE_TYPE (TREE_OPERAND (node
, 1))),
2704 pp_string (pp
, " bits)>");
2708 case ARRAY_RANGE_REF
:
2709 op0
= TREE_OPERAND (node
, 0);
2710 if (op_prio (op0
) < op_prio (node
))
2712 dump_generic_node (pp
, op0
, spc
, flags
, false);
2713 if (op_prio (op0
) < op_prio (node
))
2714 pp_right_paren (pp
);
2715 pp_left_bracket (pp
);
2716 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2717 if (TREE_CODE (node
) == ARRAY_RANGE_REF
)
2718 pp_string (pp
, " ...");
2719 pp_right_bracket (pp
);
2721 op0
= array_ref_low_bound (node
);
2722 op1
= array_ref_element_size (node
);
2724 if (!integer_zerop (op0
)
2725 || TREE_OPERAND (node
, 2)
2726 || TREE_OPERAND (node
, 3))
2728 pp_string (pp
, "{lb: ");
2729 dump_generic_node (pp
, op0
, spc
, flags
, false);
2730 pp_string (pp
, " sz: ");
2731 dump_generic_node (pp
, op1
, spc
, flags
, false);
2732 pp_right_brace (pp
);
2736 case OMP_ARRAY_SECTION
:
2737 op0
= TREE_OPERAND (node
, 0);
2738 if (op_prio (op0
) < op_prio (node
))
2740 dump_generic_node (pp
, op0
, spc
, flags
, false);
2741 if (op_prio (op0
) < op_prio (node
))
2742 pp_right_paren (pp
);
2743 pp_left_bracket (pp
);
2744 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2746 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2747 pp_right_bracket (pp
);
2752 unsigned HOST_WIDE_INT ix
;
2754 bool is_struct_init
= false;
2755 bool is_array_init
= false;
2757 if (flags
& TDF_GIMPLE
)
2759 pp_string (pp
, "_Literal (");
2760 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2761 pp_string (pp
, ") ");
2764 if (TREE_CLOBBER_P (node
))
2766 pp_string (pp
, "CLOBBER");
2767 switch (CLOBBER_KIND (node
))
2769 case CLOBBER_STORAGE_BEGIN
:
2770 pp_string (pp
, "(bos)");
2772 case CLOBBER_STORAGE_END
:
2773 pp_string (pp
, "(eos)");
2775 case CLOBBER_OBJECT_BEGIN
:
2776 pp_string (pp
, "(bob)");
2778 case CLOBBER_OBJECT_END
:
2779 pp_string (pp
, "(eob)");
2785 else if (TREE_CODE (TREE_TYPE (node
)) == RECORD_TYPE
2786 || TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
)
2787 is_struct_init
= true;
2788 else if (TREE_CODE (TREE_TYPE (node
)) == ARRAY_TYPE
2789 && TYPE_DOMAIN (TREE_TYPE (node
))
2790 && TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
)))
2791 && TREE_CODE (TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
))))
2794 tree minv
= TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
)));
2795 is_array_init
= true;
2796 curidx
= wi::to_widest (minv
);
2798 FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (node
), ix
, field
, val
)
2805 dump_generic_node (pp
, field
, spc
, flags
, false);
2808 else if (is_array_init
2809 && (TREE_CODE (field
) != INTEGER_CST
2810 || curidx
!= wi::to_widest (field
)))
2812 pp_left_bracket (pp
);
2813 if (TREE_CODE (field
) == RANGE_EXPR
)
2815 dump_generic_node (pp
, TREE_OPERAND (field
, 0), spc
,
2817 pp_string (pp
, " ... ");
2818 dump_generic_node (pp
, TREE_OPERAND (field
, 1), spc
,
2820 if (TREE_CODE (TREE_OPERAND (field
, 1)) == INTEGER_CST
)
2821 curidx
= wi::to_widest (TREE_OPERAND (field
, 1));
2824 dump_generic_node (pp
, field
, spc
, flags
, false);
2825 if (TREE_CODE (field
) == INTEGER_CST
)
2826 curidx
= wi::to_widest (field
);
2827 pp_string (pp
, "]=");
2832 if (val
&& TREE_CODE (val
) == ADDR_EXPR
)
2833 if (TREE_CODE (TREE_OPERAND (val
, 0)) == FUNCTION_DECL
)
2834 val
= TREE_OPERAND (val
, 0);
2835 if (val
&& TREE_CODE (val
) == FUNCTION_DECL
)
2836 dump_decl_name (pp
, val
, flags
);
2838 dump_generic_node (pp
, val
, spc
, flags
, false);
2839 if (ix
!= CONSTRUCTOR_NELTS (node
) - 1)
2845 pp_right_brace (pp
);
2852 if (flags
& TDF_SLIM
)
2854 pp_string (pp
, "<COMPOUND_EXPR>");
2858 dump_generic_node (pp
, TREE_OPERAND (node
, 0),
2859 spc
, flags
, !(flags
& TDF_SLIM
));
2860 if (flags
& TDF_SLIM
)
2861 newline_and_indent (pp
, spc
);
2868 for (tp
= &TREE_OPERAND (node
, 1);
2869 TREE_CODE (*tp
) == COMPOUND_EXPR
;
2870 tp
= &TREE_OPERAND (*tp
, 1))
2872 dump_generic_node (pp
, TREE_OPERAND (*tp
, 0),
2873 spc
, flags
, !(flags
& TDF_SLIM
));
2874 if (flags
& TDF_SLIM
)
2875 newline_and_indent (pp
, spc
);
2883 dump_generic_node (pp
, *tp
, spc
, flags
, !(flags
& TDF_SLIM
));
2887 case STATEMENT_LIST
:
2889 tree_stmt_iterator si
;
2892 if (flags
& TDF_SLIM
)
2894 pp_string (pp
, "<STATEMENT_LIST>");
2898 for (si
= tsi_start (node
); !tsi_end_p (si
); tsi_next (&si
))
2901 newline_and_indent (pp
, spc
);
2904 dump_generic_node (pp
, tsi_stmt (si
), spc
, flags
, true);
2911 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
,
2916 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
,
2921 pp_string (pp
, "TARGET_EXPR <");
2922 dump_generic_node (pp
, TARGET_EXPR_SLOT (node
), spc
, flags
, false);
2925 dump_generic_node (pp
, TARGET_EXPR_INITIAL (node
), spc
, flags
, false);
2930 print_declaration (pp
, DECL_EXPR_DECL (node
), spc
, flags
);
2935 if (TREE_TYPE (node
) == NULL
|| TREE_TYPE (node
) == void_type_node
)
2937 pp_string (pp
, "if (");
2938 dump_generic_node (pp
, COND_EXPR_COND (node
), spc
, flags
, false);
2939 pp_right_paren (pp
);
2940 /* The lowered cond_exprs should always be printed in full. */
2941 if (COND_EXPR_THEN (node
)
2942 && (IS_EMPTY_STMT (COND_EXPR_THEN (node
))
2943 || TREE_CODE (COND_EXPR_THEN (node
)) == GOTO_EXPR
)
2944 && COND_EXPR_ELSE (node
)
2945 && (IS_EMPTY_STMT (COND_EXPR_ELSE (node
))
2946 || TREE_CODE (COND_EXPR_ELSE (node
)) == GOTO_EXPR
))
2949 dump_generic_node (pp
, COND_EXPR_THEN (node
),
2951 if (!IS_EMPTY_STMT (COND_EXPR_ELSE (node
)))
2953 pp_string (pp
, " else ");
2954 dump_generic_node (pp
, COND_EXPR_ELSE (node
),
2958 else if (!(flags
& TDF_SLIM
))
2960 /* Output COND_EXPR_THEN. */
2961 if (COND_EXPR_THEN (node
))
2963 newline_and_indent (pp
, spc
+2);
2965 newline_and_indent (pp
, spc
+4);
2966 dump_generic_node (pp
, COND_EXPR_THEN (node
), spc
+4,
2968 newline_and_indent (pp
, spc
+2);
2969 pp_right_brace (pp
);
2972 /* Output COND_EXPR_ELSE. */
2973 if (COND_EXPR_ELSE (node
)
2974 && !IS_EMPTY_STMT (COND_EXPR_ELSE (node
)))
2976 newline_and_indent (pp
, spc
);
2977 pp_string (pp
, "else");
2978 newline_and_indent (pp
, spc
+2);
2980 newline_and_indent (pp
, spc
+4);
2981 dump_generic_node (pp
, COND_EXPR_ELSE (node
), spc
+4,
2983 newline_and_indent (pp
, spc
+2);
2984 pp_right_brace (pp
);
2991 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2995 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2999 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3005 if (!(flags
& TDF_SLIM
))
3007 if (BIND_EXPR_VARS (node
))
3011 for (op0
= BIND_EXPR_VARS (node
); op0
; op0
= DECL_CHAIN (op0
))
3013 print_declaration (pp
, op0
, spc
+2, flags
);
3018 newline_and_indent (pp
, spc
+2);
3019 dump_generic_node (pp
, BIND_EXPR_BODY (node
), spc
+2, flags
, true);
3020 newline_and_indent (pp
, spc
);
3021 pp_right_brace (pp
);
3027 if (CALL_EXPR_FN (node
) != NULL_TREE
)
3028 print_call_name (pp
, CALL_EXPR_FN (node
), flags
);
3032 pp_string (pp
, internal_fn_name (CALL_EXPR_IFN (node
)));
3035 /* Print parameters. */
3040 call_expr_arg_iterator iter
;
3041 FOR_EACH_CALL_EXPR_ARG (arg
, iter
, node
)
3043 dump_generic_node (pp
, arg
, spc
, flags
, false);
3044 if (more_call_expr_args_p (&iter
))
3051 if (CALL_EXPR_VA_ARG_PACK (node
))
3053 if (call_expr_nargs (node
) > 0)
3058 pp_string (pp
, "__builtin_va_arg_pack ()");
3060 pp_right_paren (pp
);
3062 op1
= CALL_EXPR_STATIC_CHAIN (node
);
3065 pp_string (pp
, " [static-chain: ");
3066 dump_generic_node (pp
, op1
, spc
, flags
, false);
3067 pp_right_bracket (pp
);
3070 if (CALL_EXPR_RETURN_SLOT_OPT (node
))
3071 pp_string (pp
, " [return slot optimization]");
3072 if (CALL_EXPR_TAILCALL (node
))
3073 pp_string (pp
, " [tail call]");
3076 case WITH_CLEANUP_EXPR
:
3080 case CLEANUP_POINT_EXPR
:
3081 pp_string (pp
, "<<cleanup_point ");
3082 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3083 pp_string (pp
, ">>");
3086 case PLACEHOLDER_EXPR
:
3087 pp_string (pp
, "<PLACEHOLDER_EXPR ");
3088 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
3092 /* Binary arithmetic and logic expressions. */
3093 case WIDEN_SUM_EXPR
:
3094 case WIDEN_MULT_EXPR
:
3096 case MULT_HIGHPART_EXPR
:
3098 case POINTER_PLUS_EXPR
:
3099 case POINTER_DIFF_EXPR
:
3101 case TRUNC_DIV_EXPR
:
3103 case FLOOR_DIV_EXPR
:
3104 case ROUND_DIV_EXPR
:
3105 case TRUNC_MOD_EXPR
:
3107 case FLOOR_MOD_EXPR
:
3108 case ROUND_MOD_EXPR
:
3110 case EXACT_DIV_EXPR
:
3115 case WIDEN_LSHIFT_EXPR
:
3119 case TRUTH_ANDIF_EXPR
:
3120 case TRUTH_ORIF_EXPR
:
3121 case TRUTH_AND_EXPR
:
3123 case TRUTH_XOR_EXPR
:
3137 case UNORDERED_EXPR
:
3139 const char *op
= op_symbol (node
);
3140 op0
= TREE_OPERAND (node
, 0);
3141 op1
= TREE_OPERAND (node
, 1);
3143 /* When the operands are expressions with less priority,
3144 keep semantics of the tree representation. */
3145 if (op_prio (op0
) <= op_prio (node
))
3148 dump_generic_node (pp
, op0
, spc
, flags
, false);
3149 pp_right_paren (pp
);
3152 dump_generic_node (pp
, op0
, spc
, flags
, false);
3158 /* When the operands are expressions with less priority,
3159 keep semantics of the tree representation. */
3160 if (op_prio (op1
) <= op_prio (node
))
3163 dump_generic_node (pp
, op1
, spc
, flags
, false);
3164 pp_right_paren (pp
);
3167 dump_generic_node (pp
, op1
, spc
, flags
, false);
3171 /* Unary arithmetic and logic expressions. */
3173 if (flags
& TDF_GIMPLE_VAL
)
3175 pp_string (pp
, "_Literal (");
3176 dump_generic_node (pp
, TREE_TYPE (node
), spc
,
3177 flags
& ~TDF_GIMPLE_VAL
, false);
3178 pp_character (pp
, ')');
3183 case TRUTH_NOT_EXPR
:
3184 case PREDECREMENT_EXPR
:
3185 case PREINCREMENT_EXPR
:
3187 if (!(flags
& TDF_GIMPLE
)
3188 && TREE_CODE (node
) == ADDR_EXPR
3189 && (TREE_CODE (TREE_OPERAND (node
, 0)) == STRING_CST
3190 || TREE_CODE (TREE_OPERAND (node
, 0)) == FUNCTION_DECL
))
3191 /* Do not output '&' for strings and function pointers when not
3192 dumping GIMPLE FE syntax. */
3195 pp_string (pp
, op_symbol (node
));
3197 if (op_prio (TREE_OPERAND (node
, 0)) < op_prio (node
))
3200 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3201 pp_right_paren (pp
);
3204 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3207 case POSTDECREMENT_EXPR
:
3208 case POSTINCREMENT_EXPR
:
3209 if (op_prio (TREE_OPERAND (node
, 0)) < op_prio (node
))
3212 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3213 pp_right_paren (pp
);
3216 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3217 pp_string (pp
, op_symbol (node
));
3221 pp_string (pp
, "MIN_EXPR <");
3222 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3223 pp_string (pp
, ", ");
3224 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3229 pp_string (pp
, "MAX_EXPR <");
3230 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3231 pp_string (pp
, ", ");
3232 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3237 pp_string (pp
, "ABS_EXPR <");
3238 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3243 pp_string (pp
, "ABSU_EXPR <");
3244 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3252 case ADDR_SPACE_CONVERT_EXPR
:
3253 case FIXED_CONVERT_EXPR
:
3254 case FIX_TRUNC_EXPR
:
3257 type
= TREE_TYPE (node
);
3258 op0
= TREE_OPERAND (node
, 0);
3259 if (type
!= TREE_TYPE (op0
))
3262 dump_generic_node (pp
, type
, spc
, flags
, false);
3263 pp_string (pp
, ") ");
3265 if (op_prio (op0
) < op_prio (node
))
3267 dump_generic_node (pp
, op0
, spc
, flags
, false);
3268 if (op_prio (op0
) < op_prio (node
))
3269 pp_right_paren (pp
);
3272 case VIEW_CONVERT_EXPR
:
3273 if (flags
& TDF_GIMPLE
)
3274 pp_string (pp
, "__VIEW_CONVERT <");
3276 pp_string (pp
, "VIEW_CONVERT_EXPR<");
3277 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
3278 pp_string (pp
, ">(");
3279 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3280 pp_right_paren (pp
);
3284 pp_string (pp
, "((");
3285 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3286 pp_string (pp
, "))");
3289 case NON_LVALUE_EXPR
:
3290 pp_string (pp
, "NON_LVALUE_EXPR <");
3291 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3296 pp_string (pp
, "SAVE_EXPR <");
3297 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3302 pp_string (pp
, "COMPLEX_EXPR <");
3303 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3304 pp_string (pp
, ", ");
3305 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3310 pp_string (pp
, "CONJ_EXPR <");
3311 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3316 if (flags
& TDF_GIMPLE
)
3318 pp_string (pp
, "__real ");
3319 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3323 pp_string (pp
, "REALPART_EXPR <");
3324 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3330 if (flags
& TDF_GIMPLE
)
3332 pp_string (pp
, "__imag ");
3333 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3337 pp_string (pp
, "IMAGPART_EXPR <");
3338 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3344 pp_string (pp
, "VA_ARG_EXPR <");
3345 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3349 case TRY_FINALLY_EXPR
:
3350 case TRY_CATCH_EXPR
:
3351 pp_string (pp
, "try");
3352 newline_and_indent (pp
, spc
+2);
3354 newline_and_indent (pp
, spc
+4);
3355 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
+4, flags
, true);
3356 newline_and_indent (pp
, spc
+2);
3357 pp_right_brace (pp
);
3358 newline_and_indent (pp
, spc
);
3359 if (TREE_CODE (node
) == TRY_CATCH_EXPR
)
3361 node
= TREE_OPERAND (node
, 1);
3362 pp_string (pp
, "catch");
3366 gcc_assert (TREE_CODE (node
) == TRY_FINALLY_EXPR
);
3367 node
= TREE_OPERAND (node
, 1);
3368 pp_string (pp
, "finally");
3369 if (TREE_CODE (node
) == EH_ELSE_EXPR
)
3371 newline_and_indent (pp
, spc
+2);
3373 newline_and_indent (pp
, spc
+4);
3374 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
+4,
3376 newline_and_indent (pp
, spc
+2);
3377 pp_right_brace (pp
);
3378 newline_and_indent (pp
, spc
);
3379 node
= TREE_OPERAND (node
, 1);
3380 pp_string (pp
, "else");
3383 newline_and_indent (pp
, spc
+2);
3385 newline_and_indent (pp
, spc
+4);
3386 dump_generic_node (pp
, node
, spc
+4, flags
, true);
3387 newline_and_indent (pp
, spc
+2);
3388 pp_right_brace (pp
);
3393 pp_string (pp
, "catch (");
3394 dump_generic_node (pp
, CATCH_TYPES (node
), spc
+2, flags
, false);
3395 pp_right_paren (pp
);
3396 newline_and_indent (pp
, spc
+2);
3398 newline_and_indent (pp
, spc
+4);
3399 dump_generic_node (pp
, CATCH_BODY (node
), spc
+4, flags
, true);
3400 newline_and_indent (pp
, spc
+2);
3401 pp_right_brace (pp
);
3405 case EH_FILTER_EXPR
:
3406 pp_string (pp
, "<<<eh_filter (");
3407 dump_generic_node (pp
, EH_FILTER_TYPES (node
), spc
+2, flags
, false);
3408 pp_string (pp
, ")>>>");
3409 newline_and_indent (pp
, spc
+2);
3411 newline_and_indent (pp
, spc
+4);
3412 dump_generic_node (pp
, EH_FILTER_FAILURE (node
), spc
+4, flags
, true);
3413 newline_and_indent (pp
, spc
+2);
3414 pp_right_brace (pp
);
3419 op0
= TREE_OPERAND (node
, 0);
3420 /* If this is for break or continue, don't bother printing it. */
3421 if (DECL_NAME (op0
))
3423 const char *name
= IDENTIFIER_POINTER (DECL_NAME (op0
));
3424 if (strcmp (name
, "break") == 0
3425 || strcmp (name
, "continue") == 0)
3428 dump_generic_node (pp
, op0
, spc
, flags
, false);
3430 if (DECL_NONLOCAL (op0
))
3431 pp_string (pp
, " [non-local]");
3435 pp_string (pp
, "while (1)");
3436 if (!(flags
& TDF_SLIM
))
3438 newline_and_indent (pp
, spc
+2);
3440 newline_and_indent (pp
, spc
+4);
3441 dump_generic_node (pp
, LOOP_EXPR_BODY (node
), spc
+4, flags
, true);
3442 newline_and_indent (pp
, spc
+2);
3443 pp_right_brace (pp
);
3449 pp_string (pp
, "// predicted ");
3450 if (PREDICT_EXPR_OUTCOME (node
))
3451 pp_string (pp
, "likely by ");
3453 pp_string (pp
, "unlikely by ");
3454 pp_string (pp
, predictor_name (PREDICT_EXPR_PREDICTOR (node
)));
3455 pp_string (pp
, " predictor.");
3459 pp_string (pp
, "ANNOTATE_EXPR <");
3460 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3461 switch ((enum annot_expr_kind
) TREE_INT_CST_LOW (TREE_OPERAND (node
, 1)))
3463 case annot_expr_ivdep_kind
:
3464 pp_string (pp
, ", ivdep");
3466 case annot_expr_unroll_kind
:
3468 pp_string (pp
, ", unroll ");
3470 (int) TREE_INT_CST_LOW (TREE_OPERAND (node
, 2)));
3473 case annot_expr_no_vector_kind
:
3474 pp_string (pp
, ", no-vector");
3476 case annot_expr_vector_kind
:
3477 pp_string (pp
, ", vector");
3479 case annot_expr_parallel_kind
:
3480 pp_string (pp
, ", parallel");
3489 pp_string (pp
, "return");
3490 op0
= TREE_OPERAND (node
, 0);
3494 if (TREE_CODE (op0
) == MODIFY_EXPR
)
3495 dump_generic_node (pp
, TREE_OPERAND (op0
, 1),
3498 dump_generic_node (pp
, op0
, spc
, flags
, false);
3503 pp_string (pp
, "if (");
3504 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3505 pp_string (pp
, ") break");
3509 pp_string (pp
, "switch (");
3510 dump_generic_node (pp
, SWITCH_COND (node
), spc
, flags
, false);
3511 pp_right_paren (pp
);
3512 if (!(flags
& TDF_SLIM
))
3514 newline_and_indent (pp
, spc
+2);
3516 if (SWITCH_BODY (node
))
3518 newline_and_indent (pp
, spc
+4);
3519 dump_generic_node (pp
, SWITCH_BODY (node
), spc
+4, flags
,
3522 newline_and_indent (pp
, spc
+2);
3523 pp_right_brace (pp
);
3529 op0
= GOTO_DESTINATION (node
);
3530 if (TREE_CODE (op0
) != SSA_NAME
&& DECL_P (op0
) && DECL_NAME (op0
))
3532 const char *name
= IDENTIFIER_POINTER (DECL_NAME (op0
));
3533 if (strcmp (name
, "break") == 0
3534 || strcmp (name
, "continue") == 0)
3536 pp_string (pp
, name
);
3540 pp_string (pp
, "goto ");
3541 dump_generic_node (pp
, op0
, spc
, flags
, false);
3545 pp_string (pp
, "__asm__");
3546 if (ASM_VOLATILE_P (node
))
3547 pp_string (pp
, " __volatile__");
3549 dump_generic_node (pp
, ASM_STRING (node
), spc
, flags
, false);
3551 dump_generic_node (pp
, ASM_OUTPUTS (node
), spc
, flags
, false);
3553 dump_generic_node (pp
, ASM_INPUTS (node
), spc
, flags
, false);
3554 if (ASM_CLOBBERS (node
))
3557 dump_generic_node (pp
, ASM_CLOBBERS (node
), spc
, flags
, false);
3559 pp_right_paren (pp
);
3562 case CASE_LABEL_EXPR
:
3563 if (CASE_LOW (node
) && CASE_HIGH (node
))
3565 pp_string (pp
, "case ");
3566 dump_generic_node (pp
, CASE_LOW (node
), spc
, flags
, false);
3567 pp_string (pp
, " ... ");
3568 dump_generic_node (pp
, CASE_HIGH (node
), spc
, flags
, false);
3570 else if (CASE_LOW (node
))
3572 pp_string (pp
, "case ");
3573 dump_generic_node (pp
, CASE_LOW (node
), spc
, flags
, false);
3576 pp_string (pp
, "default");
3581 pp_string (pp
, "OBJ_TYPE_REF(");
3582 dump_generic_node (pp
, OBJ_TYPE_REF_EXPR (node
), spc
, flags
, false);
3584 /* We omit the class type for -fcompare-debug because we may
3585 drop TYPE_BINFO early depending on debug info, and then
3586 virtual_method_call_p would return false, whereas when
3587 TYPE_BINFO is preserved it may still return true and then
3588 we'd print the class type. Compare tree and rtl dumps for
3589 libstdc++-prettyprinters/shared_ptr.cc with and without -g,
3590 for example, at occurrences of OBJ_TYPE_REF. */
3591 if (!(flags
& (TDF_SLIM
| TDF_COMPARE_DEBUG
))
3592 && virtual_method_call_p (node
, true))
3594 pp_string (pp
, "(");
3595 dump_generic_node (pp
, obj_type_ref_class (node
, true),
3597 pp_string (pp
, ")");
3599 dump_generic_node (pp
, OBJ_TYPE_REF_OBJECT (node
), spc
, flags
, false);
3601 dump_generic_node (pp
, OBJ_TYPE_REF_TOKEN (node
), spc
, flags
, false);
3602 pp_right_paren (pp
);
3606 if (SSA_NAME_IDENTIFIER (node
))
3608 if ((flags
& TDF_NOUID
)
3609 && SSA_NAME_VAR (node
)
3610 && DECL_NAMELESS (SSA_NAME_VAR (node
)))
3611 dump_fancy_name (pp
, SSA_NAME_IDENTIFIER (node
));
3612 else if (! (flags
& TDF_GIMPLE
)
3613 || SSA_NAME_VAR (node
))
3614 dump_generic_node (pp
, SSA_NAME_IDENTIFIER (node
),
3618 pp_decimal_int (pp
, SSA_NAME_VERSION (node
));
3619 if (SSA_NAME_IS_DEFAULT_DEF (node
))
3620 pp_string (pp
, "(D)");
3621 if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (node
))
3622 pp_string (pp
, "(ab)");
3625 case WITH_SIZE_EXPR
:
3626 pp_string (pp
, "WITH_SIZE_EXPR <");
3627 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3628 pp_string (pp
, ", ");
3629 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3634 pp_string (pp
, "scev_known");
3637 case SCEV_NOT_KNOWN
:
3638 pp_string (pp
, "scev_not_known");
3641 case POLYNOMIAL_CHREC
:
3643 dump_generic_node (pp
, CHREC_LEFT (node
), spc
, flags
, false);
3644 pp_string (pp
, ", +, ");
3645 dump_generic_node (pp
, CHREC_RIGHT (node
), spc
, flags
, false);
3646 pp_string (pp
, !CHREC_NOWRAP (node
) ? "}_" : "}<nw>_");
3647 pp_scalar (pp
, "%u", CHREC_VARIABLE (node
));
3651 case REALIGN_LOAD_EXPR
:
3652 pp_string (pp
, "REALIGN_LOAD <");
3653 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3654 pp_string (pp
, ", ");
3655 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3656 pp_string (pp
, ", ");
3657 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3662 pp_string (pp
, " VEC_COND_EXPR < ");
3663 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3664 pp_string (pp
, " , ");
3665 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3666 pp_string (pp
, " , ");
3667 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3668 pp_string (pp
, " > ");
3672 pp_string (pp
, " VEC_PERM_EXPR < ");
3673 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3674 pp_string (pp
, " , ");
3675 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3676 pp_string (pp
, " , ");
3677 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3678 pp_string (pp
, " > ");
3682 pp_string (pp
, " DOT_PROD_EXPR < ");
3683 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3684 pp_string (pp
, ", ");
3685 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3686 pp_string (pp
, ", ");
3687 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3688 pp_string (pp
, " > ");
3691 case WIDEN_MULT_PLUS_EXPR
:
3692 pp_string (pp
, " WIDEN_MULT_PLUS_EXPR < ");
3693 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3694 pp_string (pp
, ", ");
3695 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3696 pp_string (pp
, ", ");
3697 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3698 pp_string (pp
, " > ");
3701 case WIDEN_MULT_MINUS_EXPR
:
3702 pp_string (pp
, " WIDEN_MULT_MINUS_EXPR < ");
3703 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3704 pp_string (pp
, ", ");
3705 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3706 pp_string (pp
, ", ");
3707 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3708 pp_string (pp
, " > ");
3712 pp_string (pp
, "#pragma acc parallel");
3713 goto dump_omp_clauses_body
;
3716 pp_string (pp
, "#pragma acc kernels");
3717 goto dump_omp_clauses_body
;
3720 pp_string (pp
, "#pragma acc serial");
3721 goto dump_omp_clauses_body
;
3724 pp_string (pp
, "#pragma acc data");
3725 dump_omp_clauses (pp
, OACC_DATA_CLAUSES (node
), spc
, flags
);
3728 case OACC_HOST_DATA
:
3729 pp_string (pp
, "#pragma acc host_data");
3730 dump_omp_clauses (pp
, OACC_HOST_DATA_CLAUSES (node
), spc
, flags
);
3734 pp_string (pp
, "#pragma acc declare");
3735 dump_omp_clauses (pp
, OACC_DECLARE_CLAUSES (node
), spc
, flags
);
3739 pp_string (pp
, "#pragma acc update");
3740 dump_omp_clauses (pp
, OACC_UPDATE_CLAUSES (node
), spc
, flags
);
3743 case OACC_ENTER_DATA
:
3744 pp_string (pp
, "#pragma acc enter data");
3745 dump_omp_clauses (pp
, OACC_ENTER_DATA_CLAUSES (node
), spc
, flags
);
3748 case OACC_EXIT_DATA
:
3749 pp_string (pp
, "#pragma acc exit data");
3750 dump_omp_clauses (pp
, OACC_EXIT_DATA_CLAUSES (node
), spc
, flags
);
3754 pp_string (pp
, "#pragma acc cache");
3755 dump_omp_clauses (pp
, OACC_CACHE_CLAUSES (node
), spc
, flags
);
3759 pp_string (pp
, "#pragma omp parallel");
3760 dump_omp_clauses (pp
, OMP_PARALLEL_CLAUSES (node
), spc
, flags
);
3763 dump_omp_clauses_body
:
3764 dump_omp_clauses (pp
, OMP_CLAUSES (node
), spc
, flags
);
3768 if (!(flags
& TDF_SLIM
) && OMP_BODY (node
))
3770 newline_and_indent (pp
, spc
+ 2);
3772 newline_and_indent (pp
, spc
+ 4);
3773 dump_generic_node (pp
, OMP_BODY (node
), spc
+ 4, flags
, false);
3774 newline_and_indent (pp
, spc
+ 2);
3775 pp_right_brace (pp
);
3781 pp_string (pp
, OMP_TASK_BODY (node
) ? "#pragma omp task"
3782 : "#pragma omp taskwait");
3783 dump_omp_clauses (pp
, OMP_TASK_CLAUSES (node
), spc
, flags
);
3787 pp_string (pp
, "#pragma omp for");
3791 pp_string (pp
, "#pragma omp simd");
3794 case OMP_DISTRIBUTE
:
3795 pp_string (pp
, "#pragma omp distribute");
3799 pp_string (pp
, "#pragma omp taskloop");
3803 pp_string (pp
, "#pragma omp loop");
3807 pp_string (pp
, "#pragma acc loop");
3811 pp_string (pp
, "#pragma omp teams");
3812 dump_omp_clauses (pp
, OMP_TEAMS_CLAUSES (node
), spc
, flags
);
3815 case OMP_TARGET_DATA
:
3816 pp_string (pp
, "#pragma omp target data");
3817 dump_omp_clauses (pp
, OMP_TARGET_DATA_CLAUSES (node
), spc
, flags
);
3820 case OMP_TARGET_ENTER_DATA
:
3821 pp_string (pp
, "#pragma omp target enter data");
3822 dump_omp_clauses (pp
, OMP_TARGET_ENTER_DATA_CLAUSES (node
), spc
, flags
);
3826 case OMP_TARGET_EXIT_DATA
:
3827 pp_string (pp
, "#pragma omp target exit data");
3828 dump_omp_clauses (pp
, OMP_TARGET_EXIT_DATA_CLAUSES (node
), spc
, flags
);
3833 pp_string (pp
, "#pragma omp target");
3834 dump_omp_clauses (pp
, OMP_TARGET_CLAUSES (node
), spc
, flags
);
3837 case OMP_TARGET_UPDATE
:
3838 pp_string (pp
, "#pragma omp target update");
3839 dump_omp_clauses (pp
, OMP_TARGET_UPDATE_CLAUSES (node
), spc
, flags
);
3844 dump_omp_clauses (pp
, OMP_FOR_CLAUSES (node
), spc
, flags
);
3845 if (!(flags
& TDF_SLIM
))
3849 if (OMP_FOR_PRE_BODY (node
))
3851 newline_and_indent (pp
, spc
+ 2);
3854 newline_and_indent (pp
, spc
);
3855 dump_generic_node (pp
, OMP_FOR_PRE_BODY (node
),
3858 if (OMP_FOR_INIT (node
))
3861 for (i
= 0; i
< TREE_VEC_LENGTH (OMP_FOR_INIT (node
)); i
++)
3864 newline_and_indent (pp
, spc
);
3865 pp_string (pp
, "for (");
3866 tree init
= TREE_VEC_ELT (OMP_FOR_INIT (node
), i
);
3867 if (TREE_CODE (init
) != MODIFY_EXPR
3868 || TREE_CODE (TREE_OPERAND (init
, 1)) != TREE_VEC
)
3869 dump_generic_node (pp
, init
, spc
, flags
, false);
3872 dump_generic_node (pp
, TREE_OPERAND (init
, 0),
3874 pp_string (pp
, " = ");
3875 dump_omp_loop_non_rect_expr (pp
, TREE_OPERAND (init
, 1),
3878 pp_string (pp
, "; ");
3879 tree cond
= TREE_VEC_ELT (OMP_FOR_COND (node
), i
);
3880 if (!COMPARISON_CLASS_P (cond
)
3881 || TREE_CODE (TREE_OPERAND (cond
, 1)) != TREE_VEC
)
3882 dump_generic_node (pp
, cond
, spc
, flags
, false);
3885 dump_generic_node (pp
, TREE_OPERAND (cond
, 0),
3887 const char *op
= op_symbol (cond
);
3891 dump_omp_loop_non_rect_expr (pp
, TREE_OPERAND (cond
, 1),
3894 pp_string (pp
, "; ");
3895 dump_generic_node (pp
,
3896 TREE_VEC_ELT (OMP_FOR_INCR (node
), i
),
3898 pp_right_paren (pp
);
3901 if (OMP_FOR_BODY (node
))
3903 newline_and_indent (pp
, spc
+ 2);
3905 newline_and_indent (pp
, spc
+ 4);
3906 dump_generic_node (pp
, OMP_FOR_BODY (node
), spc
+ 4, flags
,
3908 newline_and_indent (pp
, spc
+ 2);
3909 pp_right_brace (pp
);
3911 if (OMP_FOR_INIT (node
))
3912 spc
-= 2 * TREE_VEC_LENGTH (OMP_FOR_INIT (node
)) - 2;
3913 if (OMP_FOR_PRE_BODY (node
))
3916 newline_and_indent (pp
, spc
+ 2);
3917 pp_right_brace (pp
);
3924 pp_string (pp
, "#pragma omp sections");
3925 dump_omp_clauses (pp
, OMP_SECTIONS_CLAUSES (node
), spc
, flags
);
3929 pp_string (pp
, "#pragma omp section");
3932 case OMP_STRUCTURED_BLOCK
:
3933 pp_string (pp
, "#pragma omp __structured_block");
3937 if (OMP_SCAN_CLAUSES (node
))
3939 pp_string (pp
, "#pragma omp scan");
3940 dump_omp_clauses (pp
, OMP_SCAN_CLAUSES (node
), spc
, flags
);
3945 pp_string (pp
, "#pragma omp master");
3949 pp_string (pp
, "#pragma omp masked");
3950 dump_omp_clauses (pp
, OMP_MASKED_CLAUSES (node
), spc
, flags
);
3954 pp_string (pp
, "#pragma omp taskgroup");
3955 dump_omp_clauses (pp
, OMP_TASKGROUP_CLAUSES (node
), spc
, flags
);
3959 pp_string (pp
, "#pragma omp ordered");
3960 dump_omp_clauses (pp
, OMP_ORDERED_CLAUSES (node
), spc
, flags
);
3964 pp_string (pp
, "#pragma omp critical");
3965 if (OMP_CRITICAL_NAME (node
))
3969 dump_generic_node (pp
, OMP_CRITICAL_NAME (node
), spc
,
3971 pp_right_paren (pp
);
3973 dump_omp_clauses (pp
, OMP_CRITICAL_CLAUSES (node
), spc
, flags
);
3977 pp_string (pp
, "#pragma omp atomic");
3978 if (OMP_ATOMIC_WEAK (node
))
3979 pp_string (pp
, " weak");
3980 dump_omp_atomic_memory_order (pp
, OMP_ATOMIC_MEMORY_ORDER (node
));
3981 newline_and_indent (pp
, spc
+ 2);
3982 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3986 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3989 case OMP_ATOMIC_READ
:
3990 pp_string (pp
, "#pragma omp atomic read");
3991 dump_omp_atomic_memory_order (pp
, OMP_ATOMIC_MEMORY_ORDER (node
));
3992 newline_and_indent (pp
, spc
+ 2);
3993 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3997 case OMP_ATOMIC_CAPTURE_OLD
:
3998 case OMP_ATOMIC_CAPTURE_NEW
:
3999 pp_string (pp
, "#pragma omp atomic capture");
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);
4012 pp_string (pp
, "#pragma omp single");
4013 dump_omp_clauses (pp
, OMP_SINGLE_CLAUSES (node
), spc
, flags
);
4017 pp_string (pp
, "#pragma omp scope");
4018 dump_omp_clauses (pp
, OMP_SCOPE_CLAUSES (node
), spc
, flags
);
4022 /* If we come here, we're dumping something that's not an OMP construct,
4023 for example, OMP clauses attached to a function's '__attribute__'.
4024 Dump the whole OMP clause chain. */
4025 dump_omp_clauses (pp
, node
, spc
, flags
, false);
4029 case TRANSACTION_EXPR
:
4030 if (TRANSACTION_EXPR_OUTER (node
))
4031 pp_string (pp
, "__transaction_atomic [[outer]]");
4032 else if (TRANSACTION_EXPR_RELAXED (node
))
4033 pp_string (pp
, "__transaction_relaxed");
4035 pp_string (pp
, "__transaction_atomic");
4036 if (!(flags
& TDF_SLIM
) && TRANSACTION_EXPR_BODY (node
))
4038 newline_and_indent (pp
, spc
);
4040 newline_and_indent (pp
, spc
+ 2);
4041 dump_generic_node (pp
, TRANSACTION_EXPR_BODY (node
),
4042 spc
+ 2, flags
, false);
4043 newline_and_indent (pp
, spc
);
4044 pp_right_brace (pp
);
4049 case VEC_SERIES_EXPR
:
4050 case VEC_WIDEN_MULT_HI_EXPR
:
4051 case VEC_WIDEN_MULT_LO_EXPR
:
4052 case VEC_WIDEN_MULT_EVEN_EXPR
:
4053 case VEC_WIDEN_MULT_ODD_EXPR
:
4054 case VEC_WIDEN_LSHIFT_HI_EXPR
:
4055 case VEC_WIDEN_LSHIFT_LO_EXPR
:
4057 for (str
= get_tree_code_name (code
); *str
; str
++)
4058 pp_character (pp
, TOUPPER (*str
));
4059 pp_string (pp
, " < ");
4060 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
4061 pp_string (pp
, ", ");
4062 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
4063 pp_string (pp
, " > ");
4066 case VEC_DUPLICATE_EXPR
:
4068 for (str
= get_tree_code_name (code
); *str
; str
++)
4069 pp_character (pp
, TOUPPER (*str
));
4070 pp_string (pp
, " < ");
4071 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
4072 pp_string (pp
, " > ");
4075 case VEC_UNPACK_HI_EXPR
:
4076 pp_string (pp
, " VEC_UNPACK_HI_EXPR < ");
4077 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
4078 pp_string (pp
, " > ");
4081 case VEC_UNPACK_LO_EXPR
:
4082 pp_string (pp
, " VEC_UNPACK_LO_EXPR < ");
4083 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
4084 pp_string (pp
, " > ");
4087 case VEC_UNPACK_FLOAT_HI_EXPR
:
4088 pp_string (pp
, " VEC_UNPACK_FLOAT_HI_EXPR < ");
4089 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
4090 pp_string (pp
, " > ");
4093 case VEC_UNPACK_FLOAT_LO_EXPR
:
4094 pp_string (pp
, " VEC_UNPACK_FLOAT_LO_EXPR < ");
4095 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
4096 pp_string (pp
, " > ");
4099 case VEC_UNPACK_FIX_TRUNC_HI_EXPR
:
4100 pp_string (pp
, " VEC_UNPACK_FIX_TRUNC_HI_EXPR < ");
4101 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
4102 pp_string (pp
, " > ");
4105 case VEC_UNPACK_FIX_TRUNC_LO_EXPR
:
4106 pp_string (pp
, " VEC_UNPACK_FIX_TRUNC_LO_EXPR < ");
4107 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
4108 pp_string (pp
, " > ");
4111 case VEC_PACK_TRUNC_EXPR
:
4112 pp_string (pp
, " VEC_PACK_TRUNC_EXPR < ");
4113 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
4114 pp_string (pp
, ", ");
4115 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
4116 pp_string (pp
, " > ");
4119 case VEC_PACK_SAT_EXPR
:
4120 pp_string (pp
, " VEC_PACK_SAT_EXPR < ");
4121 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
4122 pp_string (pp
, ", ");
4123 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
4124 pp_string (pp
, " > ");
4127 case VEC_PACK_FIX_TRUNC_EXPR
:
4128 pp_string (pp
, " VEC_PACK_FIX_TRUNC_EXPR < ");
4129 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
4130 pp_string (pp
, ", ");
4131 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
4132 pp_string (pp
, " > ");
4135 case VEC_PACK_FLOAT_EXPR
:
4136 pp_string (pp
, " VEC_PACK_FLOAT_EXPR < ");
4137 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
4138 pp_string (pp
, ", ");
4139 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
4140 pp_string (pp
, " > ");
4144 dump_block_node (pp
, node
, spc
, flags
);
4147 case DEBUG_BEGIN_STMT
:
4148 pp_string (pp
, "# DEBUG BEGIN STMT");
4155 if (is_stmt
&& is_expr
)
4161 /* Print the declaration of a variable. */
4164 print_declaration (pretty_printer
*pp
, tree t
, int spc
, dump_flags_t flags
)
4168 if (TREE_CODE(t
) == NAMELIST_DECL
)
4170 pp_string(pp
, "namelist ");
4171 dump_decl_name (pp
, t
, flags
);
4176 if (TREE_CODE (t
) == TYPE_DECL
)
4177 pp_string (pp
, "typedef ");
4179 if (HAS_RTL_P (t
) && DECL_REGISTER (t
))
4180 pp_string (pp
, "register ");
4182 if (TREE_PUBLIC (t
) && DECL_EXTERNAL (t
))
4183 pp_string (pp
, "extern ");
4184 else if (TREE_STATIC (t
))
4185 pp_string (pp
, "static ");
4187 /* Print the type and name. */
4188 if (TREE_TYPE (t
) && TREE_CODE (TREE_TYPE (t
)) == ARRAY_TYPE
)
4192 /* Print array's type. */
4193 tmp
= TREE_TYPE (t
);
4194 while (TREE_CODE (TREE_TYPE (tmp
)) == ARRAY_TYPE
)
4195 tmp
= TREE_TYPE (tmp
);
4196 dump_generic_node (pp
, TREE_TYPE (tmp
), spc
, flags
, false);
4198 /* Print variable's name. */
4200 dump_generic_node (pp
, t
, spc
, flags
, false);
4202 /* Print the dimensions. */
4203 tmp
= TREE_TYPE (t
);
4204 while (TREE_CODE (tmp
) == ARRAY_TYPE
)
4206 dump_array_domain (pp
, TYPE_DOMAIN (tmp
), spc
, flags
);
4207 tmp
= TREE_TYPE (tmp
);
4210 else if (TREE_CODE (t
) == FUNCTION_DECL
)
4212 dump_generic_node (pp
, TREE_TYPE (TREE_TYPE (t
)), spc
, flags
, false);
4214 dump_decl_name (pp
, t
, flags
);
4215 dump_function_declaration (pp
, TREE_TYPE (t
), spc
, flags
);
4219 /* Print type declaration. */
4220 dump_generic_node (pp
, TREE_TYPE (t
), spc
, flags
, false);
4222 /* Print variable's name. */
4224 dump_generic_node (pp
, t
, spc
, flags
, false);
4227 if (VAR_P (t
) && DECL_HARD_REGISTER (t
))
4229 pp_string (pp
, " __asm__ ");
4231 dump_generic_node (pp
, DECL_ASSEMBLER_NAME (t
), spc
, flags
, false);
4232 pp_right_paren (pp
);
4235 /* The initial value of a function serves to determine whether the function
4236 is declared or defined. So the following does not apply to function
4238 if (TREE_CODE (t
) != FUNCTION_DECL
)
4240 /* Print the initial value. */
4241 if (DECL_INITIAL (t
))
4246 if (!(flags
& TDF_SLIM
))
4247 dump_generic_node (pp
, DECL_INITIAL (t
), spc
, flags
, false);
4249 pp_string (pp
, "<<< omitted >>>");
4253 if (VAR_P (t
) && DECL_HAS_VALUE_EXPR_P (t
))
4255 pp_string (pp
, " [value-expr: ");
4256 dump_generic_node (pp
, DECL_VALUE_EXPR (t
), spc
, flags
, false);
4257 pp_right_bracket (pp
);
4264 /* Prints a structure: name, fields, and methods.
4265 FIXME: Still incomplete. */
4268 print_struct_decl (pretty_printer
*pp
, const_tree node
, int spc
,
4271 /* Print the name of the structure. */
4272 if (TYPE_NAME (node
))
4275 if (TREE_CODE (node
) == RECORD_TYPE
)
4276 pp_string (pp
, "struct ");
4277 else if ((TREE_CODE (node
) == UNION_TYPE
4278 || TREE_CODE (node
) == QUAL_UNION_TYPE
))
4279 pp_string (pp
, "union ");
4281 dump_generic_node (pp
, TYPE_NAME (node
), spc
, TDF_NONE
, false);
4284 /* Print the contents of the structure. */
4290 /* Print the fields of the structure. */
4293 tmp
= TYPE_FIELDS (node
);
4296 /* Avoid to print recursively the structure. */
4297 /* FIXME : Not implemented correctly...,
4298 what about the case when we have a cycle in the contain graph? ...
4299 Maybe this could be solved by looking at the scope in which the
4300 structure was declared. */
4301 if (TREE_TYPE (tmp
) != node
4302 && (TREE_CODE (TREE_TYPE (tmp
)) != POINTER_TYPE
4303 || TREE_TYPE (TREE_TYPE (tmp
)) != node
))
4305 print_declaration (pp
, tmp
, spc
+2, flags
);
4308 tmp
= DECL_CHAIN (tmp
);
4312 pp_right_brace (pp
);
4315 /* Return the priority of the operator CODE.
4317 From lowest to highest precedence with either left-to-right (L-R)
4318 or right-to-left (R-L) associativity]:
4321 2 [R-L] = += -= *= /= %= &= ^= |= <<= >>=
4333 14 [R-L] ! ~ ++ -- + - * & (type) sizeof
4334 15 [L-R] fn() [] -> .
4336 unary +, - and * have higher precedence than the corresponding binary
4340 op_code_prio (enum tree_code code
)
4357 case TRUTH_ORIF_EXPR
:
4360 case TRUTH_AND_EXPR
:
4361 case TRUTH_ANDIF_EXPR
:
4368 case TRUTH_XOR_EXPR
:
4385 case UNORDERED_EXPR
:
4396 case VEC_WIDEN_LSHIFT_HI_EXPR
:
4397 case VEC_WIDEN_LSHIFT_LO_EXPR
:
4398 case WIDEN_LSHIFT_EXPR
:
4401 case WIDEN_SUM_EXPR
:
4403 case POINTER_PLUS_EXPR
:
4404 case POINTER_DIFF_EXPR
:
4408 case VEC_WIDEN_MULT_HI_EXPR
:
4409 case VEC_WIDEN_MULT_LO_EXPR
:
4410 case WIDEN_MULT_EXPR
:
4412 case WIDEN_MULT_PLUS_EXPR
:
4413 case WIDEN_MULT_MINUS_EXPR
:
4415 case MULT_HIGHPART_EXPR
:
4416 case TRUNC_DIV_EXPR
:
4418 case FLOOR_DIV_EXPR
:
4419 case ROUND_DIV_EXPR
:
4421 case EXACT_DIV_EXPR
:
4422 case TRUNC_MOD_EXPR
:
4424 case FLOOR_MOD_EXPR
:
4425 case ROUND_MOD_EXPR
:
4428 case TRUTH_NOT_EXPR
:
4430 case POSTINCREMENT_EXPR
:
4431 case POSTDECREMENT_EXPR
:
4432 case PREINCREMENT_EXPR
:
4433 case PREDECREMENT_EXPR
:
4439 case FIX_TRUNC_EXPR
:
4445 case ARRAY_RANGE_REF
:
4449 /* Special expressions. */
4455 case VEC_UNPACK_HI_EXPR
:
4456 case VEC_UNPACK_LO_EXPR
:
4457 case VEC_UNPACK_FLOAT_HI_EXPR
:
4458 case VEC_UNPACK_FLOAT_LO_EXPR
:
4459 case VEC_UNPACK_FIX_TRUNC_HI_EXPR
:
4460 case VEC_UNPACK_FIX_TRUNC_LO_EXPR
:
4461 case VEC_PACK_TRUNC_EXPR
:
4462 case VEC_PACK_SAT_EXPR
:
4466 /* Return an arbitrarily high precedence to avoid surrounding single
4467 VAR_DECLs in ()s. */
4472 /* Return the priority of the operator OP. */
4475 op_prio (const_tree op
)
4477 enum tree_code code
;
4482 code
= TREE_CODE (op
);
4483 if (code
== SAVE_EXPR
|| code
== NON_LVALUE_EXPR
)
4484 return op_prio (TREE_OPERAND (op
, 0));
4486 return op_code_prio (code
);
4489 /* Return the symbol associated with operator CODE. */
4492 op_symbol_code (enum tree_code code
, dump_flags_t flags
)
4500 case TRUTH_ORIF_EXPR
:
4503 case TRUTH_AND_EXPR
:
4504 case TRUTH_ANDIF_EXPR
:
4510 case TRUTH_XOR_EXPR
:
4519 return (flags
& TDF_GIMPLE
) ? "__ORDERED" : "ord";
4520 case UNORDERED_EXPR
:
4521 return (flags
& TDF_GIMPLE
) ? "__UNORDERED" : "unord";
4526 return (flags
& TDF_GIMPLE
) ? "__UNEQ" : "u==";
4534 return (flags
& TDF_GIMPLE
) ? "__UNLT" : "u<";
4539 return (flags
& TDF_GIMPLE
) ? "__UNLE" : "u<=";
4544 return (flags
& TDF_GIMPLE
) ? "__UNGT" : "u>";
4549 return (flags
& TDF_GIMPLE
) ? "__UNGE" : "u>=";
4552 return (flags
& TDF_GIMPLE
) ? "__LTGT" : "<>";
4566 case WIDEN_LSHIFT_EXPR
:
4569 case POINTER_PLUS_EXPR
:
4575 case WIDEN_SUM_EXPR
:
4578 case WIDEN_MULT_EXPR
:
4581 case MULT_HIGHPART_EXPR
:
4582 return (flags
& TDF_GIMPLE
) ? "__MULT_HIGHPART" : "h*";
4586 case POINTER_DIFF_EXPR
:
4592 case TRUTH_NOT_EXPR
:
4599 case TRUNC_DIV_EXPR
:
4606 case FLOOR_DIV_EXPR
:
4609 case ROUND_DIV_EXPR
:
4612 case EXACT_DIV_EXPR
:
4615 case TRUNC_MOD_EXPR
:
4621 case FLOOR_MOD_EXPR
:
4624 case ROUND_MOD_EXPR
:
4627 case PREDECREMENT_EXPR
:
4630 case PREINCREMENT_EXPR
:
4633 case POSTDECREMENT_EXPR
:
4636 case POSTINCREMENT_EXPR
:
4646 return "<<< ??? >>>";
4650 /* Return the symbol associated with operator OP. */
4653 op_symbol (const_tree op
, dump_flags_t flags
)
4655 return op_symbol_code (TREE_CODE (op
), flags
);
4658 /* Prints the name of a call. NODE is the CALL_EXPR_FN of a CALL_EXPR or
4659 the gimple_call_fn of a GIMPLE_CALL. */
4662 print_call_name (pretty_printer
*pp
, tree node
, dump_flags_t flags
)
4667 if (TREE_CODE (op0
) == NON_LVALUE_EXPR
)
4668 op0
= TREE_OPERAND (op0
, 0);
4671 switch (TREE_CODE (op0
))
4676 dump_function_name (pp
, op0
, flags
);
4682 op0
= TREE_OPERAND (op0
, 0);
4687 dump_generic_node (pp
, TREE_OPERAND (op0
, 0), 0, flags
, false);
4688 pp_string (pp
, ") ? ");
4689 dump_generic_node (pp
, TREE_OPERAND (op0
, 1), 0, flags
, false);
4690 pp_string (pp
, " : ");
4691 dump_generic_node (pp
, TREE_OPERAND (op0
, 2), 0, flags
, false);
4695 if (VAR_P (TREE_OPERAND (op0
, 0)))
4696 dump_function_name (pp
, TREE_OPERAND (op0
, 0), flags
);
4698 dump_generic_node (pp
, op0
, 0, flags
, false);
4702 if (integer_zerop (TREE_OPERAND (op0
, 1)))
4704 op0
= TREE_OPERAND (op0
, 0);
4711 dump_generic_node (pp
, op0
, 0, flags
, false);
4719 /* Print the first N characters in the array STR, replacing non-printable
4720 characters (including embedded nuls) with unambiguous escape sequences. */
4723 pretty_print_string (pretty_printer
*pp
, const char *str
, size_t n
)
4728 for ( ; n
; --n
, ++str
)
4733 pp_string (pp
, "\\b");
4737 pp_string (pp
, "\\f");
4741 pp_string (pp
, "\\n");
4745 pp_string (pp
, "\\r");
4749 pp_string (pp
, "\\t");
4753 pp_string (pp
, "\\v");
4757 pp_string (pp
, "\\\\");
4761 pp_string (pp
, "\\\"");
4765 pp_string (pp
, "\\'");
4769 if (str
[0] || n
> 1)
4771 if (!ISPRINT (str
[0]))
4774 sprintf (buf
, "\\x%02x", (unsigned char)str
[0]);
4775 pp_string (pp
, buf
);
4778 pp_character (pp
, str
[0]);
4786 maybe_init_pretty_print (FILE *file
)
4790 tree_pp
= new pretty_printer ();
4791 pp_needs_newline (tree_pp
) = true;
4792 pp_translate_identifiers (tree_pp
) = false;
4795 tree_pp
->buffer
->stream
= file
;
4799 newline_and_indent (pretty_printer
*pp
, int spc
)
4805 /* Print the identifier ID to PRETTY-PRINTER. */
4808 pp_tree_identifier (pretty_printer
*pp
, tree id
)
4810 if (pp_translate_identifiers (pp
))
4812 const char *text
= identifier_to_locale (IDENTIFIER_POINTER (id
));
4813 pp_append_text (pp
, text
, text
+ strlen (text
));
4816 pp_append_text (pp
, IDENTIFIER_POINTER (id
),
4817 IDENTIFIER_POINTER (id
) + IDENTIFIER_LENGTH (id
));
4820 /* A helper function that is used to dump function information before the
4824 dump_function_header (FILE *dump_file
, tree fdecl
, dump_flags_t flags
)
4826 const char *dname
, *aname
;
4827 struct cgraph_node
*node
= cgraph_node::get (fdecl
);
4828 struct function
*fun
= DECL_STRUCT_FUNCTION (fdecl
);
4830 dname
= lang_hooks
.decl_printable_name (fdecl
, 1);
4832 if (DECL_ASSEMBLER_NAME_SET_P (fdecl
))
4833 aname
= (IDENTIFIER_POINTER
4834 (DECL_ASSEMBLER_NAME (fdecl
)));
4836 aname
= "<unset-asm-name>";
4838 fprintf (dump_file
, "\n;; Function %s (%s, funcdef_no=%d",
4839 dname
, aname
, fun
->funcdef_no
);
4840 if (!(flags
& TDF_NOUID
))
4841 fprintf (dump_file
, ", decl_uid=%d", DECL_UID (fdecl
));
4844 fprintf (dump_file
, ", cgraph_uid=%d", node
->get_uid ());
4845 fprintf (dump_file
, ", symbol_order=%d)%s\n\n", node
->order
,
4846 node
->frequency
== NODE_FREQUENCY_HOT
4848 : node
->frequency
== NODE_FREQUENCY_UNLIKELY_EXECUTED
4849 ? " (unlikely executed)"
4850 : node
->frequency
== NODE_FREQUENCY_EXECUTED_ONCE
4851 ? " (executed once)"
4855 fprintf (dump_file
, ")\n\n");
4858 /* Dump double_int D to pretty_printer PP. UNS is true
4859 if D is unsigned and false otherwise. */
4861 pp_double_int (pretty_printer
*pp
, double_int d
, bool uns
)
4864 pp_wide_integer (pp
, d
.low
);
4865 else if (d
.fits_uhwi ())
4866 pp_unsigned_wide_integer (pp
, d
.low
);
4869 unsigned HOST_WIDE_INT low
= d
.low
;
4870 HOST_WIDE_INT high
= d
.high
;
4871 if (!uns
&& d
.is_negative ())
4874 high
= ~high
+ !low
;
4877 /* Would "%x%0*x" or "%x%*0x" get zero-padding on all
4879 sprintf (pp_buffer (pp
)->digit_buffer
,
4880 HOST_WIDE_INT_PRINT_DOUBLE_HEX
,
4881 (unsigned HOST_WIDE_INT
) high
, low
);
4882 pp_string (pp
, pp_buffer (pp
)->digit_buffer
);
4887 # pragma GCC diagnostic pop