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");
3482 case annot_expr_maybe_infinite_kind
:
3483 pp_string (pp
, ", maybe-infinite");
3492 pp_string (pp
, "return");
3493 op0
= TREE_OPERAND (node
, 0);
3497 if (TREE_CODE (op0
) == MODIFY_EXPR
)
3498 dump_generic_node (pp
, TREE_OPERAND (op0
, 1),
3501 dump_generic_node (pp
, op0
, spc
, flags
, false);
3506 pp_string (pp
, "if (");
3507 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3508 pp_string (pp
, ") break");
3512 pp_string (pp
, "switch (");
3513 dump_generic_node (pp
, SWITCH_COND (node
), spc
, flags
, false);
3514 pp_right_paren (pp
);
3515 if (!(flags
& TDF_SLIM
))
3517 newline_and_indent (pp
, spc
+2);
3519 if (SWITCH_BODY (node
))
3521 newline_and_indent (pp
, spc
+4);
3522 dump_generic_node (pp
, SWITCH_BODY (node
), spc
+4, flags
,
3525 newline_and_indent (pp
, spc
+2);
3526 pp_right_brace (pp
);
3532 op0
= GOTO_DESTINATION (node
);
3533 if (TREE_CODE (op0
) != SSA_NAME
&& DECL_P (op0
) && DECL_NAME (op0
))
3535 const char *name
= IDENTIFIER_POINTER (DECL_NAME (op0
));
3536 if (strcmp (name
, "break") == 0
3537 || strcmp (name
, "continue") == 0)
3539 pp_string (pp
, name
);
3543 pp_string (pp
, "goto ");
3544 dump_generic_node (pp
, op0
, spc
, flags
, false);
3548 pp_string (pp
, "__asm__");
3549 if (ASM_VOLATILE_P (node
))
3550 pp_string (pp
, " __volatile__");
3552 dump_generic_node (pp
, ASM_STRING (node
), spc
, flags
, false);
3554 dump_generic_node (pp
, ASM_OUTPUTS (node
), spc
, flags
, false);
3556 dump_generic_node (pp
, ASM_INPUTS (node
), spc
, flags
, false);
3557 if (ASM_CLOBBERS (node
))
3560 dump_generic_node (pp
, ASM_CLOBBERS (node
), spc
, flags
, false);
3562 pp_right_paren (pp
);
3565 case CASE_LABEL_EXPR
:
3566 if (CASE_LOW (node
) && CASE_HIGH (node
))
3568 pp_string (pp
, "case ");
3569 dump_generic_node (pp
, CASE_LOW (node
), spc
, flags
, false);
3570 pp_string (pp
, " ... ");
3571 dump_generic_node (pp
, CASE_HIGH (node
), spc
, flags
, false);
3573 else if (CASE_LOW (node
))
3575 pp_string (pp
, "case ");
3576 dump_generic_node (pp
, CASE_LOW (node
), spc
, flags
, false);
3579 pp_string (pp
, "default");
3584 pp_string (pp
, "OBJ_TYPE_REF(");
3585 dump_generic_node (pp
, OBJ_TYPE_REF_EXPR (node
), spc
, flags
, false);
3587 /* We omit the class type for -fcompare-debug because we may
3588 drop TYPE_BINFO early depending on debug info, and then
3589 virtual_method_call_p would return false, whereas when
3590 TYPE_BINFO is preserved it may still return true and then
3591 we'd print the class type. Compare tree and rtl dumps for
3592 libstdc++-prettyprinters/shared_ptr.cc with and without -g,
3593 for example, at occurrences of OBJ_TYPE_REF. */
3594 if (!(flags
& (TDF_SLIM
| TDF_COMPARE_DEBUG
))
3595 && virtual_method_call_p (node
, true))
3597 pp_string (pp
, "(");
3598 dump_generic_node (pp
, obj_type_ref_class (node
, true),
3600 pp_string (pp
, ")");
3602 dump_generic_node (pp
, OBJ_TYPE_REF_OBJECT (node
), spc
, flags
, false);
3604 dump_generic_node (pp
, OBJ_TYPE_REF_TOKEN (node
), spc
, flags
, false);
3605 pp_right_paren (pp
);
3609 if (SSA_NAME_IDENTIFIER (node
))
3611 if ((flags
& TDF_NOUID
)
3612 && SSA_NAME_VAR (node
)
3613 && DECL_NAMELESS (SSA_NAME_VAR (node
)))
3614 dump_fancy_name (pp
, SSA_NAME_IDENTIFIER (node
));
3615 else if (! (flags
& TDF_GIMPLE
)
3616 || SSA_NAME_VAR (node
))
3617 dump_generic_node (pp
, SSA_NAME_IDENTIFIER (node
),
3621 pp_decimal_int (pp
, SSA_NAME_VERSION (node
));
3622 if (SSA_NAME_IS_DEFAULT_DEF (node
))
3623 pp_string (pp
, "(D)");
3624 if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (node
))
3625 pp_string (pp
, "(ab)");
3628 case WITH_SIZE_EXPR
:
3629 pp_string (pp
, "WITH_SIZE_EXPR <");
3630 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3631 pp_string (pp
, ", ");
3632 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3637 pp_string (pp
, "scev_known");
3640 case SCEV_NOT_KNOWN
:
3641 pp_string (pp
, "scev_not_known");
3644 case POLYNOMIAL_CHREC
:
3646 dump_generic_node (pp
, CHREC_LEFT (node
), spc
, flags
, false);
3647 pp_string (pp
, ", +, ");
3648 dump_generic_node (pp
, CHREC_RIGHT (node
), spc
, flags
, false);
3649 pp_string (pp
, !CHREC_NOWRAP (node
) ? "}_" : "}<nw>_");
3650 pp_scalar (pp
, "%u", CHREC_VARIABLE (node
));
3654 case REALIGN_LOAD_EXPR
:
3655 pp_string (pp
, "REALIGN_LOAD <");
3656 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3657 pp_string (pp
, ", ");
3658 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3659 pp_string (pp
, ", ");
3660 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3665 pp_string (pp
, " VEC_COND_EXPR < ");
3666 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3667 pp_string (pp
, " , ");
3668 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3669 pp_string (pp
, " , ");
3670 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3671 pp_string (pp
, " > ");
3675 pp_string (pp
, " VEC_PERM_EXPR < ");
3676 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3677 pp_string (pp
, " , ");
3678 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3679 pp_string (pp
, " , ");
3680 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3681 pp_string (pp
, " > ");
3685 pp_string (pp
, " DOT_PROD_EXPR < ");
3686 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3687 pp_string (pp
, ", ");
3688 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3689 pp_string (pp
, ", ");
3690 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3691 pp_string (pp
, " > ");
3694 case WIDEN_MULT_PLUS_EXPR
:
3695 pp_string (pp
, " WIDEN_MULT_PLUS_EXPR < ");
3696 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3697 pp_string (pp
, ", ");
3698 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3699 pp_string (pp
, ", ");
3700 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3701 pp_string (pp
, " > ");
3704 case WIDEN_MULT_MINUS_EXPR
:
3705 pp_string (pp
, " WIDEN_MULT_MINUS_EXPR < ");
3706 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3707 pp_string (pp
, ", ");
3708 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3709 pp_string (pp
, ", ");
3710 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3711 pp_string (pp
, " > ");
3715 pp_string (pp
, "#pragma acc parallel");
3716 goto dump_omp_clauses_body
;
3719 pp_string (pp
, "#pragma acc kernels");
3720 goto dump_omp_clauses_body
;
3723 pp_string (pp
, "#pragma acc serial");
3724 goto dump_omp_clauses_body
;
3727 pp_string (pp
, "#pragma acc data");
3728 dump_omp_clauses (pp
, OACC_DATA_CLAUSES (node
), spc
, flags
);
3731 case OACC_HOST_DATA
:
3732 pp_string (pp
, "#pragma acc host_data");
3733 dump_omp_clauses (pp
, OACC_HOST_DATA_CLAUSES (node
), spc
, flags
);
3737 pp_string (pp
, "#pragma acc declare");
3738 dump_omp_clauses (pp
, OACC_DECLARE_CLAUSES (node
), spc
, flags
);
3742 pp_string (pp
, "#pragma acc update");
3743 dump_omp_clauses (pp
, OACC_UPDATE_CLAUSES (node
), spc
, flags
);
3746 case OACC_ENTER_DATA
:
3747 pp_string (pp
, "#pragma acc enter data");
3748 dump_omp_clauses (pp
, OACC_ENTER_DATA_CLAUSES (node
), spc
, flags
);
3751 case OACC_EXIT_DATA
:
3752 pp_string (pp
, "#pragma acc exit data");
3753 dump_omp_clauses (pp
, OACC_EXIT_DATA_CLAUSES (node
), spc
, flags
);
3757 pp_string (pp
, "#pragma acc cache");
3758 dump_omp_clauses (pp
, OACC_CACHE_CLAUSES (node
), spc
, flags
);
3762 pp_string (pp
, "#pragma omp parallel");
3763 dump_omp_clauses (pp
, OMP_PARALLEL_CLAUSES (node
), spc
, flags
);
3766 dump_omp_clauses_body
:
3767 dump_omp_clauses (pp
, OMP_CLAUSES (node
), spc
, flags
);
3771 if (!(flags
& TDF_SLIM
) && OMP_BODY (node
))
3773 newline_and_indent (pp
, spc
+ 2);
3775 newline_and_indent (pp
, spc
+ 4);
3776 dump_generic_node (pp
, OMP_BODY (node
), spc
+ 4, flags
, false);
3777 newline_and_indent (pp
, spc
+ 2);
3778 pp_right_brace (pp
);
3784 pp_string (pp
, OMP_TASK_BODY (node
) ? "#pragma omp task"
3785 : "#pragma omp taskwait");
3786 dump_omp_clauses (pp
, OMP_TASK_CLAUSES (node
), spc
, flags
);
3790 pp_string (pp
, "#pragma omp for");
3794 pp_string (pp
, "#pragma omp simd");
3797 case OMP_DISTRIBUTE
:
3798 pp_string (pp
, "#pragma omp distribute");
3802 pp_string (pp
, "#pragma omp taskloop");
3806 pp_string (pp
, "#pragma omp loop");
3810 pp_string (pp
, "#pragma acc loop");
3814 pp_string (pp
, "#pragma omp teams");
3815 dump_omp_clauses (pp
, OMP_TEAMS_CLAUSES (node
), spc
, flags
);
3818 case OMP_TARGET_DATA
:
3819 pp_string (pp
, "#pragma omp target data");
3820 dump_omp_clauses (pp
, OMP_TARGET_DATA_CLAUSES (node
), spc
, flags
);
3823 case OMP_TARGET_ENTER_DATA
:
3824 pp_string (pp
, "#pragma omp target enter data");
3825 dump_omp_clauses (pp
, OMP_TARGET_ENTER_DATA_CLAUSES (node
), spc
, flags
);
3829 case OMP_TARGET_EXIT_DATA
:
3830 pp_string (pp
, "#pragma omp target exit data");
3831 dump_omp_clauses (pp
, OMP_TARGET_EXIT_DATA_CLAUSES (node
), spc
, flags
);
3836 pp_string (pp
, "#pragma omp target");
3837 dump_omp_clauses (pp
, OMP_TARGET_CLAUSES (node
), spc
, flags
);
3840 case OMP_TARGET_UPDATE
:
3841 pp_string (pp
, "#pragma omp target update");
3842 dump_omp_clauses (pp
, OMP_TARGET_UPDATE_CLAUSES (node
), spc
, flags
);
3847 dump_omp_clauses (pp
, OMP_FOR_CLAUSES (node
), spc
, flags
);
3848 if (!(flags
& TDF_SLIM
))
3852 if (OMP_FOR_PRE_BODY (node
))
3854 newline_and_indent (pp
, spc
+ 2);
3857 newline_and_indent (pp
, spc
);
3858 dump_generic_node (pp
, OMP_FOR_PRE_BODY (node
),
3861 if (OMP_FOR_INIT (node
))
3864 for (i
= 0; i
< TREE_VEC_LENGTH (OMP_FOR_INIT (node
)); i
++)
3867 newline_and_indent (pp
, spc
);
3868 pp_string (pp
, "for (");
3869 tree init
= TREE_VEC_ELT (OMP_FOR_INIT (node
), i
);
3870 if (TREE_CODE (init
) != MODIFY_EXPR
3871 || TREE_CODE (TREE_OPERAND (init
, 1)) != TREE_VEC
)
3872 dump_generic_node (pp
, init
, spc
, flags
, false);
3875 dump_generic_node (pp
, TREE_OPERAND (init
, 0),
3877 pp_string (pp
, " = ");
3878 dump_omp_loop_non_rect_expr (pp
, TREE_OPERAND (init
, 1),
3881 pp_string (pp
, "; ");
3882 tree cond
= TREE_VEC_ELT (OMP_FOR_COND (node
), i
);
3883 if (!COMPARISON_CLASS_P (cond
)
3884 || TREE_CODE (TREE_OPERAND (cond
, 1)) != TREE_VEC
)
3885 dump_generic_node (pp
, cond
, spc
, flags
, false);
3888 dump_generic_node (pp
, TREE_OPERAND (cond
, 0),
3890 const char *op
= op_symbol (cond
);
3894 dump_omp_loop_non_rect_expr (pp
, TREE_OPERAND (cond
, 1),
3897 pp_string (pp
, "; ");
3898 dump_generic_node (pp
,
3899 TREE_VEC_ELT (OMP_FOR_INCR (node
), i
),
3901 pp_right_paren (pp
);
3904 if (OMP_FOR_BODY (node
))
3906 newline_and_indent (pp
, spc
+ 2);
3908 newline_and_indent (pp
, spc
+ 4);
3909 dump_generic_node (pp
, OMP_FOR_BODY (node
), spc
+ 4, flags
,
3911 newline_and_indent (pp
, spc
+ 2);
3912 pp_right_brace (pp
);
3914 if (OMP_FOR_INIT (node
))
3915 spc
-= 2 * TREE_VEC_LENGTH (OMP_FOR_INIT (node
)) - 2;
3916 if (OMP_FOR_PRE_BODY (node
))
3919 newline_and_indent (pp
, spc
+ 2);
3920 pp_right_brace (pp
);
3927 pp_string (pp
, "#pragma omp sections");
3928 dump_omp_clauses (pp
, OMP_SECTIONS_CLAUSES (node
), spc
, flags
);
3932 pp_string (pp
, "#pragma omp section");
3935 case OMP_STRUCTURED_BLOCK
:
3936 pp_string (pp
, "#pragma omp __structured_block");
3940 if (OMP_SCAN_CLAUSES (node
))
3942 pp_string (pp
, "#pragma omp scan");
3943 dump_omp_clauses (pp
, OMP_SCAN_CLAUSES (node
), spc
, flags
);
3948 pp_string (pp
, "#pragma omp master");
3952 pp_string (pp
, "#pragma omp masked");
3953 dump_omp_clauses (pp
, OMP_MASKED_CLAUSES (node
), spc
, flags
);
3957 pp_string (pp
, "#pragma omp taskgroup");
3958 dump_omp_clauses (pp
, OMP_TASKGROUP_CLAUSES (node
), spc
, flags
);
3962 pp_string (pp
, "#pragma omp ordered");
3963 dump_omp_clauses (pp
, OMP_ORDERED_CLAUSES (node
), spc
, flags
);
3967 pp_string (pp
, "#pragma omp critical");
3968 if (OMP_CRITICAL_NAME (node
))
3972 dump_generic_node (pp
, OMP_CRITICAL_NAME (node
), spc
,
3974 pp_right_paren (pp
);
3976 dump_omp_clauses (pp
, OMP_CRITICAL_CLAUSES (node
), spc
, flags
);
3980 pp_string (pp
, "#pragma omp atomic");
3981 if (OMP_ATOMIC_WEAK (node
))
3982 pp_string (pp
, " weak");
3983 dump_omp_atomic_memory_order (pp
, OMP_ATOMIC_MEMORY_ORDER (node
));
3984 newline_and_indent (pp
, spc
+ 2);
3985 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3989 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3992 case OMP_ATOMIC_READ
:
3993 pp_string (pp
, "#pragma omp atomic read");
3994 dump_omp_atomic_memory_order (pp
, OMP_ATOMIC_MEMORY_ORDER (node
));
3995 newline_and_indent (pp
, spc
+ 2);
3996 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
4000 case OMP_ATOMIC_CAPTURE_OLD
:
4001 case OMP_ATOMIC_CAPTURE_NEW
:
4002 pp_string (pp
, "#pragma omp atomic capture");
4003 if (OMP_ATOMIC_WEAK (node
))
4004 pp_string (pp
, " weak");
4005 dump_omp_atomic_memory_order (pp
, OMP_ATOMIC_MEMORY_ORDER (node
));
4006 newline_and_indent (pp
, spc
+ 2);
4007 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
4011 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
4015 pp_string (pp
, "#pragma omp single");
4016 dump_omp_clauses (pp
, OMP_SINGLE_CLAUSES (node
), spc
, flags
);
4020 pp_string (pp
, "#pragma omp scope");
4021 dump_omp_clauses (pp
, OMP_SCOPE_CLAUSES (node
), spc
, flags
);
4025 /* If we come here, we're dumping something that's not an OMP construct,
4026 for example, OMP clauses attached to a function's '__attribute__'.
4027 Dump the whole OMP clause chain. */
4028 dump_omp_clauses (pp
, node
, spc
, flags
, false);
4032 case TRANSACTION_EXPR
:
4033 if (TRANSACTION_EXPR_OUTER (node
))
4034 pp_string (pp
, "__transaction_atomic [[outer]]");
4035 else if (TRANSACTION_EXPR_RELAXED (node
))
4036 pp_string (pp
, "__transaction_relaxed");
4038 pp_string (pp
, "__transaction_atomic");
4039 if (!(flags
& TDF_SLIM
) && TRANSACTION_EXPR_BODY (node
))
4041 newline_and_indent (pp
, spc
);
4043 newline_and_indent (pp
, spc
+ 2);
4044 dump_generic_node (pp
, TRANSACTION_EXPR_BODY (node
),
4045 spc
+ 2, flags
, false);
4046 newline_and_indent (pp
, spc
);
4047 pp_right_brace (pp
);
4052 case VEC_SERIES_EXPR
:
4053 case VEC_WIDEN_MULT_HI_EXPR
:
4054 case VEC_WIDEN_MULT_LO_EXPR
:
4055 case VEC_WIDEN_MULT_EVEN_EXPR
:
4056 case VEC_WIDEN_MULT_ODD_EXPR
:
4057 case VEC_WIDEN_LSHIFT_HI_EXPR
:
4058 case VEC_WIDEN_LSHIFT_LO_EXPR
:
4060 for (str
= get_tree_code_name (code
); *str
; str
++)
4061 pp_character (pp
, TOUPPER (*str
));
4062 pp_string (pp
, " < ");
4063 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
4064 pp_string (pp
, ", ");
4065 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
4066 pp_string (pp
, " > ");
4069 case VEC_DUPLICATE_EXPR
:
4071 for (str
= get_tree_code_name (code
); *str
; str
++)
4072 pp_character (pp
, TOUPPER (*str
));
4073 pp_string (pp
, " < ");
4074 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
4075 pp_string (pp
, " > ");
4078 case VEC_UNPACK_HI_EXPR
:
4079 pp_string (pp
, " VEC_UNPACK_HI_EXPR < ");
4080 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
4081 pp_string (pp
, " > ");
4084 case VEC_UNPACK_LO_EXPR
:
4085 pp_string (pp
, " VEC_UNPACK_LO_EXPR < ");
4086 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
4087 pp_string (pp
, " > ");
4090 case VEC_UNPACK_FLOAT_HI_EXPR
:
4091 pp_string (pp
, " VEC_UNPACK_FLOAT_HI_EXPR < ");
4092 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
4093 pp_string (pp
, " > ");
4096 case VEC_UNPACK_FLOAT_LO_EXPR
:
4097 pp_string (pp
, " VEC_UNPACK_FLOAT_LO_EXPR < ");
4098 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
4099 pp_string (pp
, " > ");
4102 case VEC_UNPACK_FIX_TRUNC_HI_EXPR
:
4103 pp_string (pp
, " VEC_UNPACK_FIX_TRUNC_HI_EXPR < ");
4104 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
4105 pp_string (pp
, " > ");
4108 case VEC_UNPACK_FIX_TRUNC_LO_EXPR
:
4109 pp_string (pp
, " VEC_UNPACK_FIX_TRUNC_LO_EXPR < ");
4110 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
4111 pp_string (pp
, " > ");
4114 case VEC_PACK_TRUNC_EXPR
:
4115 pp_string (pp
, " VEC_PACK_TRUNC_EXPR < ");
4116 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
4117 pp_string (pp
, ", ");
4118 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
4119 pp_string (pp
, " > ");
4122 case VEC_PACK_SAT_EXPR
:
4123 pp_string (pp
, " VEC_PACK_SAT_EXPR < ");
4124 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
4125 pp_string (pp
, ", ");
4126 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
4127 pp_string (pp
, " > ");
4130 case VEC_PACK_FIX_TRUNC_EXPR
:
4131 pp_string (pp
, " VEC_PACK_FIX_TRUNC_EXPR < ");
4132 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
4133 pp_string (pp
, ", ");
4134 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
4135 pp_string (pp
, " > ");
4138 case VEC_PACK_FLOAT_EXPR
:
4139 pp_string (pp
, " VEC_PACK_FLOAT_EXPR < ");
4140 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
4141 pp_string (pp
, ", ");
4142 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
4143 pp_string (pp
, " > ");
4147 dump_block_node (pp
, node
, spc
, flags
);
4150 case DEBUG_BEGIN_STMT
:
4151 pp_string (pp
, "# DEBUG BEGIN STMT");
4158 if (is_stmt
&& is_expr
)
4164 /* Print the declaration of a variable. */
4167 print_declaration (pretty_printer
*pp
, tree t
, int spc
, dump_flags_t flags
)
4171 if (TREE_CODE(t
) == NAMELIST_DECL
)
4173 pp_string(pp
, "namelist ");
4174 dump_decl_name (pp
, t
, flags
);
4179 if (TREE_CODE (t
) == TYPE_DECL
)
4180 pp_string (pp
, "typedef ");
4182 if (HAS_RTL_P (t
) && DECL_REGISTER (t
))
4183 pp_string (pp
, "register ");
4185 if (TREE_PUBLIC (t
) && DECL_EXTERNAL (t
))
4186 pp_string (pp
, "extern ");
4187 else if (TREE_STATIC (t
))
4188 pp_string (pp
, "static ");
4190 /* Print the type and name. */
4191 if (TREE_TYPE (t
) && TREE_CODE (TREE_TYPE (t
)) == ARRAY_TYPE
)
4195 /* Print array's type. */
4196 tmp
= TREE_TYPE (t
);
4197 while (TREE_CODE (TREE_TYPE (tmp
)) == ARRAY_TYPE
)
4198 tmp
= TREE_TYPE (tmp
);
4199 dump_generic_node (pp
, TREE_TYPE (tmp
), spc
, flags
, false);
4201 /* Print variable's name. */
4203 dump_generic_node (pp
, t
, spc
, flags
, false);
4205 /* Print the dimensions. */
4206 tmp
= TREE_TYPE (t
);
4207 while (TREE_CODE (tmp
) == ARRAY_TYPE
)
4209 dump_array_domain (pp
, TYPE_DOMAIN (tmp
), spc
, flags
);
4210 tmp
= TREE_TYPE (tmp
);
4213 else if (TREE_CODE (t
) == FUNCTION_DECL
)
4215 dump_generic_node (pp
, TREE_TYPE (TREE_TYPE (t
)), spc
, flags
, false);
4217 dump_decl_name (pp
, t
, flags
);
4218 dump_function_declaration (pp
, TREE_TYPE (t
), spc
, flags
);
4222 /* Print type declaration. */
4223 dump_generic_node (pp
, TREE_TYPE (t
), spc
, flags
, false);
4225 /* Print variable's name. */
4227 dump_generic_node (pp
, t
, spc
, flags
, false);
4230 if (VAR_P (t
) && DECL_HARD_REGISTER (t
))
4232 pp_string (pp
, " __asm__ ");
4234 dump_generic_node (pp
, DECL_ASSEMBLER_NAME (t
), spc
, flags
, false);
4235 pp_right_paren (pp
);
4238 /* The initial value of a function serves to determine whether the function
4239 is declared or defined. So the following does not apply to function
4241 if (TREE_CODE (t
) != FUNCTION_DECL
)
4243 /* Print the initial value. */
4244 if (DECL_INITIAL (t
))
4249 if (!(flags
& TDF_SLIM
))
4250 dump_generic_node (pp
, DECL_INITIAL (t
), spc
, flags
, false);
4252 pp_string (pp
, "<<< omitted >>>");
4256 if (VAR_P (t
) && DECL_HAS_VALUE_EXPR_P (t
))
4258 pp_string (pp
, " [value-expr: ");
4259 dump_generic_node (pp
, DECL_VALUE_EXPR (t
), spc
, flags
, false);
4260 pp_right_bracket (pp
);
4267 /* Prints a structure: name, fields, and methods.
4268 FIXME: Still incomplete. */
4271 print_struct_decl (pretty_printer
*pp
, const_tree node
, int spc
,
4274 /* Print the name of the structure. */
4275 if (TYPE_NAME (node
))
4278 if (TREE_CODE (node
) == RECORD_TYPE
)
4279 pp_string (pp
, "struct ");
4280 else if ((TREE_CODE (node
) == UNION_TYPE
4281 || TREE_CODE (node
) == QUAL_UNION_TYPE
))
4282 pp_string (pp
, "union ");
4284 dump_generic_node (pp
, TYPE_NAME (node
), spc
, TDF_NONE
, false);
4287 /* Print the contents of the structure. */
4293 /* Print the fields of the structure. */
4296 tmp
= TYPE_FIELDS (node
);
4299 /* Avoid to print recursively the structure. */
4300 /* FIXME : Not implemented correctly...,
4301 what about the case when we have a cycle in the contain graph? ...
4302 Maybe this could be solved by looking at the scope in which the
4303 structure was declared. */
4304 if (TREE_TYPE (tmp
) != node
4305 && (TREE_CODE (TREE_TYPE (tmp
)) != POINTER_TYPE
4306 || TREE_TYPE (TREE_TYPE (tmp
)) != node
))
4308 print_declaration (pp
, tmp
, spc
+2, flags
);
4311 tmp
= DECL_CHAIN (tmp
);
4315 pp_right_brace (pp
);
4318 /* Return the priority of the operator CODE.
4320 From lowest to highest precedence with either left-to-right (L-R)
4321 or right-to-left (R-L) associativity]:
4324 2 [R-L] = += -= *= /= %= &= ^= |= <<= >>=
4336 14 [R-L] ! ~ ++ -- + - * & (type) sizeof
4337 15 [L-R] fn() [] -> .
4339 unary +, - and * have higher precedence than the corresponding binary
4343 op_code_prio (enum tree_code code
)
4360 case TRUTH_ORIF_EXPR
:
4363 case TRUTH_AND_EXPR
:
4364 case TRUTH_ANDIF_EXPR
:
4371 case TRUTH_XOR_EXPR
:
4388 case UNORDERED_EXPR
:
4399 case VEC_WIDEN_LSHIFT_HI_EXPR
:
4400 case VEC_WIDEN_LSHIFT_LO_EXPR
:
4401 case WIDEN_LSHIFT_EXPR
:
4404 case WIDEN_SUM_EXPR
:
4406 case POINTER_PLUS_EXPR
:
4407 case POINTER_DIFF_EXPR
:
4411 case VEC_WIDEN_MULT_HI_EXPR
:
4412 case VEC_WIDEN_MULT_LO_EXPR
:
4413 case WIDEN_MULT_EXPR
:
4415 case WIDEN_MULT_PLUS_EXPR
:
4416 case WIDEN_MULT_MINUS_EXPR
:
4418 case MULT_HIGHPART_EXPR
:
4419 case TRUNC_DIV_EXPR
:
4421 case FLOOR_DIV_EXPR
:
4422 case ROUND_DIV_EXPR
:
4424 case EXACT_DIV_EXPR
:
4425 case TRUNC_MOD_EXPR
:
4427 case FLOOR_MOD_EXPR
:
4428 case ROUND_MOD_EXPR
:
4431 case TRUTH_NOT_EXPR
:
4433 case POSTINCREMENT_EXPR
:
4434 case POSTDECREMENT_EXPR
:
4435 case PREINCREMENT_EXPR
:
4436 case PREDECREMENT_EXPR
:
4442 case FIX_TRUNC_EXPR
:
4448 case ARRAY_RANGE_REF
:
4452 /* Special expressions. */
4458 case VEC_UNPACK_HI_EXPR
:
4459 case VEC_UNPACK_LO_EXPR
:
4460 case VEC_UNPACK_FLOAT_HI_EXPR
:
4461 case VEC_UNPACK_FLOAT_LO_EXPR
:
4462 case VEC_UNPACK_FIX_TRUNC_HI_EXPR
:
4463 case VEC_UNPACK_FIX_TRUNC_LO_EXPR
:
4464 case VEC_PACK_TRUNC_EXPR
:
4465 case VEC_PACK_SAT_EXPR
:
4469 /* Return an arbitrarily high precedence to avoid surrounding single
4470 VAR_DECLs in ()s. */
4475 /* Return the priority of the operator OP. */
4478 op_prio (const_tree op
)
4480 enum tree_code code
;
4485 code
= TREE_CODE (op
);
4486 if (code
== SAVE_EXPR
|| code
== NON_LVALUE_EXPR
)
4487 return op_prio (TREE_OPERAND (op
, 0));
4489 return op_code_prio (code
);
4492 /* Return the symbol associated with operator CODE. */
4495 op_symbol_code (enum tree_code code
, dump_flags_t flags
)
4503 case TRUTH_ORIF_EXPR
:
4506 case TRUTH_AND_EXPR
:
4507 case TRUTH_ANDIF_EXPR
:
4513 case TRUTH_XOR_EXPR
:
4522 return (flags
& TDF_GIMPLE
) ? "__ORDERED" : "ord";
4523 case UNORDERED_EXPR
:
4524 return (flags
& TDF_GIMPLE
) ? "__UNORDERED" : "unord";
4529 return (flags
& TDF_GIMPLE
) ? "__UNEQ" : "u==";
4537 return (flags
& TDF_GIMPLE
) ? "__UNLT" : "u<";
4542 return (flags
& TDF_GIMPLE
) ? "__UNLE" : "u<=";
4547 return (flags
& TDF_GIMPLE
) ? "__UNGT" : "u>";
4552 return (flags
& TDF_GIMPLE
) ? "__UNGE" : "u>=";
4555 return (flags
& TDF_GIMPLE
) ? "__LTGT" : "<>";
4569 case WIDEN_LSHIFT_EXPR
:
4572 case POINTER_PLUS_EXPR
:
4578 case WIDEN_SUM_EXPR
:
4581 case WIDEN_MULT_EXPR
:
4584 case MULT_HIGHPART_EXPR
:
4585 return (flags
& TDF_GIMPLE
) ? "__MULT_HIGHPART" : "h*";
4589 case POINTER_DIFF_EXPR
:
4595 case TRUTH_NOT_EXPR
:
4602 case TRUNC_DIV_EXPR
:
4609 case FLOOR_DIV_EXPR
:
4612 case ROUND_DIV_EXPR
:
4615 case EXACT_DIV_EXPR
:
4618 case TRUNC_MOD_EXPR
:
4624 case FLOOR_MOD_EXPR
:
4627 case ROUND_MOD_EXPR
:
4630 case PREDECREMENT_EXPR
:
4633 case PREINCREMENT_EXPR
:
4636 case POSTDECREMENT_EXPR
:
4639 case POSTINCREMENT_EXPR
:
4649 return "<<< ??? >>>";
4653 /* Return the symbol associated with operator OP. */
4656 op_symbol (const_tree op
, dump_flags_t flags
)
4658 return op_symbol_code (TREE_CODE (op
), flags
);
4661 /* Prints the name of a call. NODE is the CALL_EXPR_FN of a CALL_EXPR or
4662 the gimple_call_fn of a GIMPLE_CALL. */
4665 print_call_name (pretty_printer
*pp
, tree node
, dump_flags_t flags
)
4670 if (TREE_CODE (op0
) == NON_LVALUE_EXPR
)
4671 op0
= TREE_OPERAND (op0
, 0);
4674 switch (TREE_CODE (op0
))
4679 dump_function_name (pp
, op0
, flags
);
4685 op0
= TREE_OPERAND (op0
, 0);
4690 dump_generic_node (pp
, TREE_OPERAND (op0
, 0), 0, flags
, false);
4691 pp_string (pp
, ") ? ");
4692 dump_generic_node (pp
, TREE_OPERAND (op0
, 1), 0, flags
, false);
4693 pp_string (pp
, " : ");
4694 dump_generic_node (pp
, TREE_OPERAND (op0
, 2), 0, flags
, false);
4698 if (VAR_P (TREE_OPERAND (op0
, 0)))
4699 dump_function_name (pp
, TREE_OPERAND (op0
, 0), flags
);
4701 dump_generic_node (pp
, op0
, 0, flags
, false);
4705 if (integer_zerop (TREE_OPERAND (op0
, 1)))
4707 op0
= TREE_OPERAND (op0
, 0);
4714 dump_generic_node (pp
, op0
, 0, flags
, false);
4722 /* Print the first N characters in the array STR, replacing non-printable
4723 characters (including embedded nuls) with unambiguous escape sequences. */
4726 pretty_print_string (pretty_printer
*pp
, const char *str
, size_t n
)
4731 for ( ; n
; --n
, ++str
)
4736 pp_string (pp
, "\\b");
4740 pp_string (pp
, "\\f");
4744 pp_string (pp
, "\\n");
4748 pp_string (pp
, "\\r");
4752 pp_string (pp
, "\\t");
4756 pp_string (pp
, "\\v");
4760 pp_string (pp
, "\\\\");
4764 pp_string (pp
, "\\\"");
4768 pp_string (pp
, "\\'");
4772 if (str
[0] || n
> 1)
4774 if (!ISPRINT (str
[0]))
4777 sprintf (buf
, "\\x%02x", (unsigned char)str
[0]);
4778 pp_string (pp
, buf
);
4781 pp_character (pp
, str
[0]);
4789 maybe_init_pretty_print (FILE *file
)
4793 tree_pp
= new pretty_printer ();
4794 pp_needs_newline (tree_pp
) = true;
4795 pp_translate_identifiers (tree_pp
) = false;
4798 tree_pp
->buffer
->stream
= file
;
4802 newline_and_indent (pretty_printer
*pp
, int spc
)
4808 /* Print the identifier ID to PRETTY-PRINTER. */
4811 pp_tree_identifier (pretty_printer
*pp
, tree id
)
4813 if (pp_translate_identifiers (pp
))
4815 const char *text
= identifier_to_locale (IDENTIFIER_POINTER (id
));
4816 pp_append_text (pp
, text
, text
+ strlen (text
));
4819 pp_append_text (pp
, IDENTIFIER_POINTER (id
),
4820 IDENTIFIER_POINTER (id
) + IDENTIFIER_LENGTH (id
));
4823 /* A helper function that is used to dump function information before the
4827 dump_function_header (FILE *dump_file
, tree fdecl
, dump_flags_t flags
)
4829 const char *dname
, *aname
;
4830 struct cgraph_node
*node
= cgraph_node::get (fdecl
);
4831 struct function
*fun
= DECL_STRUCT_FUNCTION (fdecl
);
4833 dname
= lang_hooks
.decl_printable_name (fdecl
, 1);
4835 if (DECL_ASSEMBLER_NAME_SET_P (fdecl
))
4836 aname
= (IDENTIFIER_POINTER
4837 (DECL_ASSEMBLER_NAME (fdecl
)));
4839 aname
= "<unset-asm-name>";
4841 fprintf (dump_file
, "\n;; Function %s (%s, funcdef_no=%d",
4842 dname
, aname
, fun
->funcdef_no
);
4843 if (!(flags
& TDF_NOUID
))
4844 fprintf (dump_file
, ", decl_uid=%d", DECL_UID (fdecl
));
4847 fprintf (dump_file
, ", cgraph_uid=%d", node
->get_uid ());
4848 fprintf (dump_file
, ", symbol_order=%d)%s\n\n", node
->order
,
4849 node
->frequency
== NODE_FREQUENCY_HOT
4851 : node
->frequency
== NODE_FREQUENCY_UNLIKELY_EXECUTED
4852 ? " (unlikely executed)"
4853 : node
->frequency
== NODE_FREQUENCY_EXECUTED_ONCE
4854 ? " (executed once)"
4858 fprintf (dump_file
, ")\n\n");
4861 /* Dump double_int D to pretty_printer PP. UNS is true
4862 if D is unsigned and false otherwise. */
4864 pp_double_int (pretty_printer
*pp
, double_int d
, bool uns
)
4867 pp_wide_integer (pp
, d
.low
);
4868 else if (d
.fits_uhwi ())
4869 pp_unsigned_wide_integer (pp
, d
.low
);
4872 unsigned HOST_WIDE_INT low
= d
.low
;
4873 HOST_WIDE_INT high
= d
.high
;
4874 if (!uns
&& d
.is_negative ())
4877 high
= ~high
+ !low
;
4880 /* Would "%x%0*x" or "%x%*0x" get zero-padding on all
4882 sprintf (pp_buffer (pp
)->digit_buffer
,
4883 HOST_WIDE_INT_PRINT_DOUBLE_HEX
,
4884 (unsigned HOST_WIDE_INT
) high
, low
);
4885 pp_string (pp
, pp_buffer (pp
)->digit_buffer
);
4890 # pragma GCC diagnostic pop