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 switch (OMP_CLAUSE_MAP_KIND (clause
))
919 case GOMP_MAP_POINTER
:
920 case GOMP_MAP_POINTER_TO_ZERO_LENGTH_ARRAY_SECTION
:
921 pp_string (pp
, "alloc");
923 case GOMP_MAP_IF_PRESENT
:
924 pp_string (pp
, "no_alloc");
927 case GOMP_MAP_TO_PSET
:
928 pp_string (pp
, "to");
931 pp_string (pp
, "from");
933 case GOMP_MAP_TOFROM
:
934 pp_string (pp
, "tofrom");
936 case GOMP_MAP_FORCE_ALLOC
:
937 pp_string (pp
, "force_alloc");
939 case GOMP_MAP_FORCE_TO
:
940 pp_string (pp
, "force_to");
942 case GOMP_MAP_FORCE_FROM
:
943 pp_string (pp
, "force_from");
945 case GOMP_MAP_FORCE_TOFROM
:
946 pp_string (pp
, "force_tofrom");
948 case GOMP_MAP_FORCE_PRESENT
:
949 pp_string (pp
, "force_present");
951 case GOMP_MAP_DELETE
:
952 pp_string (pp
, "delete");
954 case GOMP_MAP_FORCE_DEVICEPTR
:
955 pp_string (pp
, "force_deviceptr");
957 case GOMP_MAP_ALWAYS_TO
:
958 pp_string (pp
, "always,to");
960 case GOMP_MAP_ALWAYS_FROM
:
961 pp_string (pp
, "always,from");
963 case GOMP_MAP_ALWAYS_TOFROM
:
964 pp_string (pp
, "always,tofrom");
966 case GOMP_MAP_RELEASE
:
967 pp_string (pp
, "release");
969 case GOMP_MAP_FIRSTPRIVATE_POINTER
:
970 pp_string (pp
, "firstprivate");
972 case GOMP_MAP_FIRSTPRIVATE_REFERENCE
:
973 pp_string (pp
, "firstprivate ref");
975 case GOMP_MAP_STRUCT
:
976 pp_string (pp
, "struct");
978 case GOMP_MAP_STRUCT_UNORD
:
979 pp_string (pp
, "struct_unord");
981 case GOMP_MAP_ALWAYS_POINTER
:
982 pp_string (pp
, "always_pointer");
984 case GOMP_MAP_DEVICE_RESIDENT
:
985 pp_string (pp
, "device_resident");
988 pp_string (pp
, "link");
990 case GOMP_MAP_ATTACH
:
991 pp_string (pp
, "attach");
993 case GOMP_MAP_DETACH
:
994 pp_string (pp
, "detach");
996 case GOMP_MAP_FORCE_DETACH
:
997 pp_string (pp
, "force_detach");
999 case GOMP_MAP_ATTACH_DETACH
:
1000 pp_string (pp
, "attach_detach");
1002 case GOMP_MAP_ATTACH_ZERO_LENGTH_ARRAY_SECTION
:
1003 pp_string (pp
, "attach_zero_length_array_section");
1005 case GOMP_MAP_PRESENT_ALLOC
:
1006 pp_string (pp
, "present,alloc");
1008 case GOMP_MAP_PRESENT_TO
:
1009 pp_string (pp
, "present,to");
1011 case GOMP_MAP_PRESENT_FROM
:
1012 pp_string (pp
, "present,from");
1014 case GOMP_MAP_PRESENT_TOFROM
:
1015 pp_string (pp
, "present,tofrom");
1017 case GOMP_MAP_ALWAYS_PRESENT_TO
:
1018 pp_string (pp
, "always,present,to");
1020 case GOMP_MAP_ALWAYS_PRESENT_FROM
:
1021 pp_string (pp
, "always,present,from");
1023 case GOMP_MAP_ALWAYS_PRESENT_TOFROM
:
1024 pp_string (pp
, "always,present,tofrom");
1030 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
1033 if (OMP_CLAUSE_SIZE (clause
))
1035 switch (OMP_CLAUSE_CODE (clause
) == OMP_CLAUSE_MAP
1036 ? OMP_CLAUSE_MAP_KIND (clause
) : GOMP_MAP_TO
)
1038 case GOMP_MAP_POINTER
:
1039 case GOMP_MAP_FIRSTPRIVATE_POINTER
:
1040 case GOMP_MAP_FIRSTPRIVATE_REFERENCE
:
1041 case GOMP_MAP_ALWAYS_POINTER
:
1042 pp_string (pp
, " [pointer assign, bias: ");
1044 case GOMP_MAP_POINTER_TO_ZERO_LENGTH_ARRAY_SECTION
:
1045 pp_string (pp
, " [pointer assign, zero-length array section, bias: ");
1047 case GOMP_MAP_TO_PSET
:
1048 pp_string (pp
, " [pointer set, len: ");
1050 case GOMP_MAP_ATTACH
:
1051 case GOMP_MAP_DETACH
:
1052 case GOMP_MAP_FORCE_DETACH
:
1053 case GOMP_MAP_ATTACH_DETACH
:
1054 case GOMP_MAP_ATTACH_ZERO_LENGTH_ARRAY_SECTION
:
1055 pp_string (pp
, " [bias: ");
1057 case GOMP_MAP_RELEASE
:
1058 case GOMP_MAP_DELETE
:
1059 if (OMP_CLAUSE_CODE (clause
) == OMP_CLAUSE_MAP
1060 && OMP_CLAUSE_RELEASE_DESCRIPTOR (clause
))
1062 pp_string (pp
, " [pointer set, len: ");
1067 pp_string (pp
, " [len: ");
1070 dump_generic_node (pp
, OMP_CLAUSE_SIZE (clause
),
1072 pp_right_bracket (pp
);
1074 if (OMP_CLAUSE_CODE (clause
) == OMP_CLAUSE_MAP
1075 && OMP_CLAUSE_MAP_RUNTIME_IMPLICIT_P (clause
))
1076 pp_string (pp
, "[implicit]");
1077 pp_right_paren (pp
);
1080 case OMP_CLAUSE_FROM
:
1081 pp_string (pp
, "from(");
1082 if (OMP_CLAUSE_MOTION_PRESENT (clause
))
1083 pp_string (pp
, "present:");
1084 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
1086 goto print_clause_size
;
1089 pp_string (pp
, "to(");
1090 if (OMP_CLAUSE_MOTION_PRESENT (clause
))
1091 pp_string (pp
, "present:");
1092 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
1094 goto print_clause_size
;
1096 case OMP_CLAUSE__CACHE_
:
1097 pp_string (pp
, "(");
1098 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
1100 goto print_clause_size
;
1102 case OMP_CLAUSE_NUM_TEAMS
:
1103 pp_string (pp
, "num_teams(");
1104 if (OMP_CLAUSE_NUM_TEAMS_LOWER_EXPR (clause
))
1106 dump_generic_node (pp
, OMP_CLAUSE_NUM_TEAMS_LOWER_EXPR (clause
),
1110 dump_generic_node (pp
, OMP_CLAUSE_NUM_TEAMS_UPPER_EXPR (clause
),
1112 pp_right_paren (pp
);
1115 case OMP_CLAUSE_THREAD_LIMIT
:
1116 pp_string (pp
, "thread_limit(");
1117 dump_generic_node (pp
, OMP_CLAUSE_THREAD_LIMIT_EXPR (clause
),
1119 pp_right_paren (pp
);
1122 case OMP_CLAUSE_DEVICE
:
1123 pp_string (pp
, "device(");
1124 if (OMP_CLAUSE_DEVICE_ANCESTOR (clause
))
1125 pp_string (pp
, "ancestor:");
1126 dump_generic_node (pp
, OMP_CLAUSE_DEVICE_ID (clause
),
1128 pp_right_paren (pp
);
1131 case OMP_CLAUSE_DIST_SCHEDULE
:
1132 pp_string (pp
, "dist_schedule(static");
1133 if (OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR (clause
))
1136 dump_generic_node (pp
,
1137 OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR (clause
),
1140 pp_right_paren (pp
);
1143 case OMP_CLAUSE_PROC_BIND
:
1144 pp_string (pp
, "proc_bind(");
1145 switch (OMP_CLAUSE_PROC_BIND_KIND (clause
))
1147 case OMP_CLAUSE_PROC_BIND_MASTER
:
1148 /* Same enum value: case OMP_CLAUSE_PROC_BIND_PRIMARY: */
1149 /* TODO: Change to 'primary' for OpenMP 5.1. */
1150 pp_string (pp
, "master");
1152 case OMP_CLAUSE_PROC_BIND_CLOSE
:
1153 pp_string (pp
, "close");
1155 case OMP_CLAUSE_PROC_BIND_SPREAD
:
1156 pp_string (pp
, "spread");
1161 pp_right_paren (pp
);
1164 case OMP_CLAUSE_DEVICE_TYPE
:
1165 pp_string (pp
, "device_type(");
1166 switch (OMP_CLAUSE_DEVICE_TYPE_KIND (clause
))
1168 case OMP_CLAUSE_DEVICE_TYPE_HOST
:
1169 pp_string (pp
, "host");
1171 case OMP_CLAUSE_DEVICE_TYPE_NOHOST
:
1172 pp_string (pp
, "nohost");
1174 case OMP_CLAUSE_DEVICE_TYPE_ANY
:
1175 pp_string (pp
, "any");
1180 pp_right_paren (pp
);
1183 case OMP_CLAUSE_SAFELEN
:
1184 pp_string (pp
, "safelen(");
1185 dump_generic_node (pp
, OMP_CLAUSE_SAFELEN_EXPR (clause
),
1187 pp_right_paren (pp
);
1190 case OMP_CLAUSE_SIMDLEN
:
1191 pp_string (pp
, "simdlen(");
1192 dump_generic_node (pp
, OMP_CLAUSE_SIMDLEN_EXPR (clause
),
1194 pp_right_paren (pp
);
1197 case OMP_CLAUSE_PRIORITY
:
1198 pp_string (pp
, "priority(");
1199 dump_generic_node (pp
, OMP_CLAUSE_PRIORITY_EXPR (clause
),
1201 pp_right_paren (pp
);
1204 case OMP_CLAUSE_GRAINSIZE
:
1205 pp_string (pp
, "grainsize(");
1206 if (OMP_CLAUSE_GRAINSIZE_STRICT (clause
))
1207 pp_string (pp
, "strict:");
1208 dump_generic_node (pp
, OMP_CLAUSE_GRAINSIZE_EXPR (clause
),
1210 pp_right_paren (pp
);
1213 case OMP_CLAUSE_NUM_TASKS
:
1214 pp_string (pp
, "num_tasks(");
1215 if (OMP_CLAUSE_NUM_TASKS_STRICT (clause
))
1216 pp_string (pp
, "strict:");
1217 dump_generic_node (pp
, OMP_CLAUSE_NUM_TASKS_EXPR (clause
),
1219 pp_right_paren (pp
);
1222 case OMP_CLAUSE_HINT
:
1223 pp_string (pp
, "hint(");
1224 dump_generic_node (pp
, OMP_CLAUSE_HINT_EXPR (clause
),
1226 pp_right_paren (pp
);
1229 case OMP_CLAUSE_FILTER
:
1230 pp_string (pp
, "filter(");
1231 dump_generic_node (pp
, OMP_CLAUSE_FILTER_EXPR (clause
),
1233 pp_right_paren (pp
);
1236 case OMP_CLAUSE_DEFAULTMAP
:
1237 pp_string (pp
, "defaultmap(");
1238 switch (OMP_CLAUSE_DEFAULTMAP_BEHAVIOR (clause
))
1240 case OMP_CLAUSE_DEFAULTMAP_ALLOC
:
1241 pp_string (pp
, "alloc");
1243 case OMP_CLAUSE_DEFAULTMAP_TO
:
1244 pp_string (pp
, "to");
1246 case OMP_CLAUSE_DEFAULTMAP_FROM
:
1247 pp_string (pp
, "from");
1249 case OMP_CLAUSE_DEFAULTMAP_TOFROM
:
1250 pp_string (pp
, "tofrom");
1252 case OMP_CLAUSE_DEFAULTMAP_FIRSTPRIVATE
:
1253 pp_string (pp
, "firstprivate");
1255 case OMP_CLAUSE_DEFAULTMAP_NONE
:
1256 pp_string (pp
, "none");
1258 case OMP_CLAUSE_DEFAULTMAP_PRESENT
:
1259 pp_string (pp
, "present");
1261 case OMP_CLAUSE_DEFAULTMAP_DEFAULT
:
1262 pp_string (pp
, "default");
1267 switch (OMP_CLAUSE_DEFAULTMAP_CATEGORY (clause
))
1269 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_UNSPECIFIED
:
1271 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_ALL
:
1272 pp_string (pp
, ":all");
1274 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_SCALAR
:
1275 pp_string (pp
, ":scalar");
1277 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_AGGREGATE
:
1278 pp_string (pp
, ":aggregate");
1280 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_ALLOCATABLE
:
1281 pp_string (pp
, ":allocatable");
1283 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_POINTER
:
1284 pp_string (pp
, ":pointer");
1289 pp_right_paren (pp
);
1292 case OMP_CLAUSE_ORDER
:
1293 pp_string (pp
, "order(");
1294 if (OMP_CLAUSE_ORDER_UNCONSTRAINED (clause
))
1295 pp_string (pp
, "unconstrained:");
1296 else if (OMP_CLAUSE_ORDER_REPRODUCIBLE (clause
))
1297 pp_string (pp
, "reproducible:");
1298 pp_string (pp
, "concurrent)");
1301 case OMP_CLAUSE_BIND
:
1302 pp_string (pp
, "bind(");
1303 switch (OMP_CLAUSE_BIND_KIND (clause
))
1305 case OMP_CLAUSE_BIND_TEAMS
:
1306 pp_string (pp
, "teams");
1308 case OMP_CLAUSE_BIND_PARALLEL
:
1309 pp_string (pp
, "parallel");
1311 case OMP_CLAUSE_BIND_THREAD
:
1312 pp_string (pp
, "thread");
1317 pp_right_paren (pp
);
1320 case OMP_CLAUSE__SIMDUID_
:
1321 pp_string (pp
, "_simduid_(");
1322 dump_generic_node (pp
, OMP_CLAUSE__SIMDUID__DECL (clause
),
1324 pp_right_paren (pp
);
1327 case OMP_CLAUSE__SIMT_
:
1328 pp_string (pp
, "_simt_");
1331 case OMP_CLAUSE_GANG
:
1332 pp_string (pp
, "gang");
1333 if (OMP_CLAUSE_GANG_EXPR (clause
) != NULL_TREE
)
1335 pp_string (pp
, "(num: ");
1336 dump_generic_node (pp
, OMP_CLAUSE_GANG_EXPR (clause
),
1339 if (OMP_CLAUSE_GANG_STATIC_EXPR (clause
) != NULL_TREE
)
1341 if (OMP_CLAUSE_GANG_EXPR (clause
) == NULL_TREE
)
1345 pp_string (pp
, "static:");
1346 if (OMP_CLAUSE_GANG_STATIC_EXPR (clause
)
1347 == integer_minus_one_node
)
1348 pp_character (pp
, '*');
1350 dump_generic_node (pp
, OMP_CLAUSE_GANG_STATIC_EXPR (clause
),
1353 if (OMP_CLAUSE_GANG_EXPR (clause
) != NULL_TREE
1354 || OMP_CLAUSE_GANG_STATIC_EXPR (clause
) != NULL_TREE
)
1355 pp_right_paren (pp
);
1358 case OMP_CLAUSE_ASYNC
:
1359 pp_string (pp
, "async");
1360 if (OMP_CLAUSE_ASYNC_EXPR (clause
))
1362 pp_character(pp
, '(');
1363 dump_generic_node (pp
, OMP_CLAUSE_ASYNC_EXPR (clause
),
1365 pp_character(pp
, ')');
1369 case OMP_CLAUSE_AUTO
:
1370 case OMP_CLAUSE_SEQ
:
1371 pp_string (pp
, omp_clause_code_name
[OMP_CLAUSE_CODE (clause
)]);
1374 case OMP_CLAUSE_WAIT
:
1375 pp_string (pp
, "wait(");
1376 dump_generic_node (pp
, OMP_CLAUSE_WAIT_EXPR (clause
),
1378 pp_character(pp
, ')');
1381 case OMP_CLAUSE_WORKER
:
1382 pp_string (pp
, "worker");
1383 if (OMP_CLAUSE_WORKER_EXPR (clause
) != NULL_TREE
)
1386 dump_generic_node (pp
, OMP_CLAUSE_WORKER_EXPR (clause
),
1388 pp_right_paren (pp
);
1392 case OMP_CLAUSE_VECTOR
:
1393 pp_string (pp
, "vector");
1394 if (OMP_CLAUSE_VECTOR_EXPR (clause
) != NULL_TREE
)
1397 dump_generic_node (pp
, OMP_CLAUSE_VECTOR_EXPR (clause
),
1399 pp_right_paren (pp
);
1403 case OMP_CLAUSE_NUM_GANGS
:
1404 pp_string (pp
, "num_gangs(");
1405 dump_generic_node (pp
, OMP_CLAUSE_NUM_GANGS_EXPR (clause
),
1407 pp_character (pp
, ')');
1410 case OMP_CLAUSE_NUM_WORKERS
:
1411 pp_string (pp
, "num_workers(");
1412 dump_generic_node (pp
, OMP_CLAUSE_NUM_WORKERS_EXPR (clause
),
1414 pp_character (pp
, ')');
1417 case OMP_CLAUSE_VECTOR_LENGTH
:
1418 pp_string (pp
, "vector_length(");
1419 dump_generic_node (pp
, OMP_CLAUSE_VECTOR_LENGTH_EXPR (clause
),
1421 pp_character (pp
, ')');
1424 case OMP_CLAUSE_INBRANCH
:
1425 pp_string (pp
, "inbranch");
1427 case OMP_CLAUSE_NOTINBRANCH
:
1428 pp_string (pp
, "notinbranch");
1430 case OMP_CLAUSE_FOR
:
1431 pp_string (pp
, "for");
1433 case OMP_CLAUSE_PARALLEL
:
1434 pp_string (pp
, "parallel");
1436 case OMP_CLAUSE_SECTIONS
:
1437 pp_string (pp
, "sections");
1439 case OMP_CLAUSE_TASKGROUP
:
1440 pp_string (pp
, "taskgroup");
1442 case OMP_CLAUSE_NOGROUP
:
1443 pp_string (pp
, "nogroup");
1445 case OMP_CLAUSE_THREADS
:
1446 pp_string (pp
, "threads");
1448 case OMP_CLAUSE_SIMD
:
1449 pp_string (pp
, "simd");
1451 case OMP_CLAUSE_INDEPENDENT
:
1452 pp_string (pp
, "independent");
1454 case OMP_CLAUSE_TILE
:
1455 pp_string (pp
, "tile(");
1456 dump_generic_node (pp
, OMP_CLAUSE_TILE_LIST (clause
),
1458 pp_right_paren (pp
);
1461 case OMP_CLAUSE_IF_PRESENT
:
1462 pp_string (pp
, "if_present");
1464 case OMP_CLAUSE_FINALIZE
:
1465 pp_string (pp
, "finalize");
1467 case OMP_CLAUSE_NOHOST
:
1468 pp_string (pp
, "nohost");
1470 case OMP_CLAUSE_DETACH
:
1471 pp_string (pp
, "detach(");
1472 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
), spc
, flags
,
1474 pp_right_paren (pp
);
1482 /* Dump chain of OMP clauses.
1484 PP, SPC and FLAGS are as in dump_generic_node. */
1487 dump_omp_clauses (pretty_printer
*pp
, tree clause
, int spc
, dump_flags_t flags
,
1494 dump_omp_clause (pp
, clause
, spc
, flags
);
1495 leading_space
= true;
1497 clause
= OMP_CLAUSE_CHAIN (clause
);
1501 /* Dump an OpenMP context selector CTX to PP. */
1503 dump_omp_context_selector (pretty_printer
*pp
, tree ctx
, int spc
,
1506 for (tree set
= ctx
; set
&& set
!= error_mark_node
; set
= TREE_CHAIN (set
))
1508 pp_string (pp
, OMP_TSS_NAME (set
));
1509 pp_string (pp
, " = {");
1510 for (tree sel
= OMP_TSS_TRAIT_SELECTORS (set
);
1511 sel
&& sel
!= error_mark_node
; sel
= TREE_CHAIN (sel
))
1513 if (OMP_TS_CODE (sel
) == OMP_TRAIT_INVALID
)
1514 pp_string (pp
, "<unknown selector>");
1516 pp_string (pp
, OMP_TS_NAME (sel
));
1517 tree score
= OMP_TS_SCORE (sel
);
1518 tree props
= OMP_TS_PROPERTIES (sel
);
1521 pp_string (pp
, " (");
1524 pp_string (pp
, "score(");
1525 dump_generic_node (pp
, score
, spc
+ 4, flags
, false);
1526 pp_string (pp
, "): ");
1528 for (tree prop
= props
; prop
; prop
= TREE_CHAIN (prop
))
1530 if (OMP_TP_NAME (prop
) == OMP_TP_NAMELIST_NODE
)
1532 const char *str
= omp_context_name_list_prop (prop
);
1533 pp_string (pp
, "\"");
1534 pretty_print_string (pp
, str
, strlen (str
) + 1);
1535 pp_string (pp
, "\"");
1537 else if (OMP_TP_NAME (prop
))
1538 dump_generic_node (pp
, OMP_TP_NAME (prop
), spc
+ 4,
1540 else if (OMP_TP_VALUE (prop
))
1541 dump_generic_node (pp
, OMP_TP_VALUE (prop
), spc
+ 4,
1543 if (TREE_CHAIN (prop
))
1549 pp_string (pp
, ")");
1551 if (TREE_CHAIN (sel
))
1557 pp_string (pp
, "}");
1558 if (TREE_CHAIN (set
))
1561 newline_and_indent (pp
, spc
);
1566 /* Wrapper for above, used for "declare variant". Compare to
1567 print_generic_expr. */
1569 print_omp_context_selector (FILE *file
, tree t
, dump_flags_t flags
)
1571 maybe_init_pretty_print (file
);
1572 dump_omp_context_selector (tree_pp
, t
, 0, flags
);
1576 /* Dump location LOC to PP. */
1579 dump_location (pretty_printer
*pp
, location_t loc
)
1581 expanded_location xloc
= expand_location (loc
);
1582 int discriminator
= get_discriminator_from_loc (loc
);
1584 pp_left_bracket (pp
);
1587 pp_string (pp
, xloc
.file
);
1588 pp_string (pp
, ":");
1590 pp_decimal_int (pp
, xloc
.line
);
1592 pp_decimal_int (pp
, xloc
.column
);
1595 pp_string (pp
, " discrim ");
1596 pp_decimal_int (pp
, discriminator
);
1598 pp_string (pp
, "] ");
1602 /* Dump lexical block BLOCK. PP, SPC and FLAGS are as in
1603 dump_generic_node. */
1606 dump_block_node (pretty_printer
*pp
, tree block
, int spc
, dump_flags_t flags
)
1610 pp_string (pp
, "BLOCK #");
1611 pp_decimal_int (pp
, BLOCK_NUMBER (block
));
1612 pp_character (pp
, ' ');
1614 if (flags
& TDF_ADDRESS
)
1616 pp_character (pp
, '[');
1617 pp_scalar (pp
, "%p", (void *) block
);
1618 pp_string (pp
, "] ");
1621 if (TREE_ASM_WRITTEN (block
))
1622 pp_string (pp
, "[written] ");
1624 if (flags
& TDF_SLIM
)
1627 if (BLOCK_SOURCE_LOCATION (block
))
1628 dump_location (pp
, BLOCK_SOURCE_LOCATION (block
));
1630 newline_and_indent (pp
, spc
+ 2);
1632 if (BLOCK_SUPERCONTEXT (block
))
1634 pp_string (pp
, "SUPERCONTEXT: ");
1635 dump_generic_node (pp
, BLOCK_SUPERCONTEXT (block
), 0,
1636 flags
| TDF_SLIM
, false);
1637 newline_and_indent (pp
, spc
+ 2);
1640 if (BLOCK_SUBBLOCKS (block
))
1642 pp_string (pp
, "SUBBLOCKS: ");
1643 for (t
= BLOCK_SUBBLOCKS (block
); t
; t
= BLOCK_CHAIN (t
))
1645 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
1648 newline_and_indent (pp
, spc
+ 2);
1651 if (BLOCK_CHAIN (block
))
1653 pp_string (pp
, "SIBLINGS: ");
1654 for (t
= BLOCK_CHAIN (block
); t
; t
= BLOCK_CHAIN (t
))
1656 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
1659 newline_and_indent (pp
, spc
+ 2);
1662 if (BLOCK_VARS (block
))
1664 pp_string (pp
, "VARS: ");
1665 for (t
= BLOCK_VARS (block
); t
; t
= TREE_CHAIN (t
))
1667 dump_generic_node (pp
, t
, 0, flags
, false);
1670 newline_and_indent (pp
, spc
+ 2);
1673 if (vec_safe_length (BLOCK_NONLOCALIZED_VARS (block
)) > 0)
1676 vec
<tree
, va_gc
> *nlv
= BLOCK_NONLOCALIZED_VARS (block
);
1678 pp_string (pp
, "NONLOCALIZED_VARS: ");
1679 FOR_EACH_VEC_ELT (*nlv
, i
, t
)
1681 dump_generic_node (pp
, t
, 0, flags
, false);
1684 newline_and_indent (pp
, spc
+ 2);
1687 if (BLOCK_ABSTRACT_ORIGIN (block
))
1689 pp_string (pp
, "ABSTRACT_ORIGIN: ");
1690 dump_generic_node (pp
, BLOCK_ABSTRACT_ORIGIN (block
), 0,
1691 flags
| TDF_SLIM
, false);
1692 newline_and_indent (pp
, spc
+ 2);
1695 if (BLOCK_FRAGMENT_ORIGIN (block
))
1697 pp_string (pp
, "FRAGMENT_ORIGIN: ");
1698 dump_generic_node (pp
, BLOCK_FRAGMENT_ORIGIN (block
), 0,
1699 flags
| TDF_SLIM
, false);
1700 newline_and_indent (pp
, spc
+ 2);
1703 if (BLOCK_FRAGMENT_CHAIN (block
))
1705 pp_string (pp
, "FRAGMENT_CHAIN: ");
1706 for (t
= BLOCK_FRAGMENT_CHAIN (block
); t
; t
= BLOCK_FRAGMENT_CHAIN (t
))
1708 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
1711 newline_and_indent (pp
, spc
+ 2);
1715 /* Dump #pragma omp atomic memory order clause. */
1718 dump_omp_atomic_memory_order (pretty_printer
*pp
, enum omp_memory_order mo
)
1720 switch (mo
& OMP_MEMORY_ORDER_MASK
)
1722 case OMP_MEMORY_ORDER_RELAXED
:
1723 pp_string (pp
, " relaxed");
1725 case OMP_MEMORY_ORDER_SEQ_CST
:
1726 pp_string (pp
, " seq_cst");
1728 case OMP_MEMORY_ORDER_ACQ_REL
:
1729 pp_string (pp
, " acq_rel");
1731 case OMP_MEMORY_ORDER_ACQUIRE
:
1732 pp_string (pp
, " acquire");
1734 case OMP_MEMORY_ORDER_RELEASE
:
1735 pp_string (pp
, " release");
1737 case OMP_MEMORY_ORDER_UNSPECIFIED
:
1742 switch (mo
& OMP_FAIL_MEMORY_ORDER_MASK
)
1744 case OMP_FAIL_MEMORY_ORDER_RELAXED
:
1745 pp_string (pp
, " fail(relaxed)");
1747 case OMP_FAIL_MEMORY_ORDER_SEQ_CST
:
1748 pp_string (pp
, " fail(seq_cst)");
1750 case OMP_FAIL_MEMORY_ORDER_ACQUIRE
:
1751 pp_string (pp
, " fail(acquire)");
1753 case OMP_FAIL_MEMORY_ORDER_UNSPECIFIED
:
1760 /* Helper to dump a MEM_REF node. */
1763 dump_mem_ref (pretty_printer
*pp
, tree node
, int spc
, dump_flags_t flags
)
1765 if ((TREE_CODE (node
) == MEM_REF
1766 || TREE_CODE (node
) == TARGET_MEM_REF
)
1767 && (flags
& TDF_GIMPLE
))
1769 pp_string (pp
, "__MEM <");
1770 dump_generic_node (pp
, TREE_TYPE (node
),
1771 spc
, flags
| TDF_SLIM
, false);
1772 if (TYPE_ALIGN (TREE_TYPE (node
))
1773 != TYPE_ALIGN (TYPE_MAIN_VARIANT (TREE_TYPE (node
))))
1775 pp_string (pp
, ", ");
1776 pp_decimal_int (pp
, TYPE_ALIGN (TREE_TYPE (node
)));
1779 pp_string (pp
, " (");
1780 if (TREE_TYPE (TREE_OPERAND (node
, 0))
1781 != TREE_TYPE (TREE_OPERAND (node
, 1)))
1784 dump_generic_node (pp
, TREE_TYPE (TREE_OPERAND (node
, 1)),
1785 spc
, flags
| TDF_SLIM
, false);
1786 pp_right_paren (pp
);
1788 dump_generic_node (pp
, TREE_OPERAND (node
, 0),
1789 spc
, flags
| TDF_SLIM
, false);
1790 if (! integer_zerop (TREE_OPERAND (node
, 1)))
1792 pp_string (pp
, " + ");
1793 dump_generic_node (pp
, TREE_OPERAND (node
, 1),
1794 spc
, flags
| TDF_SLIM
, false);
1796 if (TREE_CODE (node
) == TARGET_MEM_REF
)
1798 if (TREE_OPERAND (node
, 2))
1801 pp_string (pp
, " + ");
1802 dump_generic_node (pp
, TREE_OPERAND (node
, 2),
1803 spc
, flags
| TDF_SLIM
, false);
1804 pp_string (pp
, " * ");
1805 dump_generic_node (pp
, TREE_OPERAND (node
, 3),
1806 spc
, flags
| TDF_SLIM
, false);
1808 if (TREE_OPERAND (node
, 4))
1811 pp_string (pp
, " + ");
1812 dump_generic_node (pp
, TREE_OPERAND (node
, 4),
1813 spc
, flags
| TDF_SLIM
, false);
1816 pp_right_paren (pp
);
1818 else if (TREE_CODE (node
) == MEM_REF
1819 && integer_zerop (TREE_OPERAND (node
, 1))
1820 /* Dump the types of INTEGER_CSTs explicitly, for we can't
1821 infer them and MEM_ATTR caching will share MEM_REFs
1822 with differently-typed op0s. */
1823 && TREE_CODE (TREE_OPERAND (node
, 0)) != INTEGER_CST
1824 /* Released SSA_NAMES have no TREE_TYPE. */
1825 && TREE_TYPE (TREE_OPERAND (node
, 0)) != NULL_TREE
1826 /* Same pointer types, but ignoring POINTER_TYPE vs.
1828 && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 0)))
1829 == TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 1))))
1830 && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (node
, 0)))
1831 == TYPE_MODE (TREE_TYPE (TREE_OPERAND (node
, 1))))
1832 && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node
, 0)))
1833 == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node
, 1))))
1834 /* Same value types ignoring qualifiers. */
1835 && (TYPE_MAIN_VARIANT (TREE_TYPE (node
))
1836 == TYPE_MAIN_VARIANT
1837 (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 1)))))
1838 && (!(flags
& TDF_ALIAS
)
1839 || MR_DEPENDENCE_CLIQUE (node
) == 0))
1841 if (TREE_CODE (TREE_OPERAND (node
, 0)) != ADDR_EXPR
)
1843 /* Enclose pointers to arrays in parentheses. */
1844 tree op0
= TREE_OPERAND (node
, 0);
1845 tree op0type
= TREE_TYPE (op0
);
1846 if (POINTER_TYPE_P (op0type
)
1847 && TREE_CODE (TREE_TYPE (op0type
)) == ARRAY_TYPE
)
1850 dump_generic_node (pp
, op0
, spc
, flags
, false);
1851 if (POINTER_TYPE_P (op0type
)
1852 && TREE_CODE (TREE_TYPE (op0type
)) == ARRAY_TYPE
)
1853 pp_right_paren (pp
);
1856 dump_generic_node (pp
,
1857 TREE_OPERAND (TREE_OPERAND (node
, 0), 0),
1862 pp_string (pp
, "MEM");
1864 tree nodetype
= TREE_TYPE (node
);
1865 tree op0
= TREE_OPERAND (node
, 0);
1866 tree op1
= TREE_OPERAND (node
, 1);
1867 tree op1type
= TYPE_MAIN_VARIANT (TREE_TYPE (op1
));
1869 tree op0size
= TYPE_SIZE (nodetype
);
1870 tree op1size
= TYPE_SIZE (TREE_TYPE (op1type
));
1872 if (!op0size
|| !op1size
1873 || !operand_equal_p (op0size
, op1size
, 0))
1875 pp_string (pp
, " <");
1876 /* If the size of the type of the operand is not the same
1877 as the size of the MEM_REF expression include the type
1878 of the latter similar to the TDF_GIMPLE output to make
1879 it clear how many bytes of memory are being accessed. */
1880 dump_generic_node (pp
, nodetype
, spc
, flags
| TDF_SLIM
, false);
1881 pp_string (pp
, "> ");
1884 pp_string (pp
, "[(");
1885 dump_generic_node (pp
, op1type
, spc
, flags
| TDF_SLIM
, false);
1886 pp_right_paren (pp
);
1887 dump_generic_node (pp
, op0
, spc
, flags
, false);
1888 if (!integer_zerop (op1
))
1890 pp_string (pp
, " + ");
1891 dump_generic_node (pp
, op1
, spc
, flags
, false);
1893 if (TREE_CODE (node
) == TARGET_MEM_REF
)
1895 tree tmp
= TMR_INDEX2 (node
);
1898 pp_string (pp
, " + ");
1899 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1901 tmp
= TMR_INDEX (node
);
1904 pp_string (pp
, " + ");
1905 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1906 tmp
= TMR_STEP (node
);
1907 pp_string (pp
, " * ");
1909 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1911 pp_string (pp
, "1");
1914 if ((flags
& TDF_ALIAS
)
1915 && MR_DEPENDENCE_CLIQUE (node
) != 0)
1917 pp_string (pp
, " clique ");
1918 pp_unsigned_wide_integer (pp
, MR_DEPENDENCE_CLIQUE (node
));
1919 pp_string (pp
, " base ");
1920 pp_unsigned_wide_integer (pp
, MR_DEPENDENCE_BASE (node
));
1922 pp_right_bracket (pp
);
1926 /* Helper function for dump_generic_node. Dump INIT or COND expression for
1927 OpenMP loop non-rectangular iterators. */
1930 dump_omp_loop_non_rect_expr (pretty_printer
*pp
, tree node
, int spc
,
1933 gcc_assert (TREE_CODE (node
) == TREE_VEC
);
1934 dump_generic_node (pp
, TREE_VEC_ELT (node
, 0), spc
, flags
, false);
1935 pp_string (pp
, " * ");
1936 if (op_prio (TREE_VEC_ELT (node
, 1)) <= op_code_prio (MULT_EXPR
))
1939 dump_generic_node (pp
, TREE_VEC_ELT (node
, 1), spc
, flags
, false);
1940 pp_right_paren (pp
);
1943 dump_generic_node (pp
, TREE_VEC_ELT (node
, 1), spc
, flags
, false);
1944 pp_string (pp
, " + ");
1945 if (op_prio (TREE_VEC_ELT (node
, 1)) <= op_code_prio (PLUS_EXPR
))
1948 dump_generic_node (pp
, TREE_VEC_ELT (node
, 2), spc
, flags
, false);
1949 pp_right_paren (pp
);
1952 dump_generic_node (pp
, TREE_VEC_ELT (node
, 2), spc
, flags
, false);
1955 /* Dump the node NODE on the pretty_printer PP, SPC spaces of
1956 indent. FLAGS specifies details to show in the dump (see TDF_* in
1957 dumpfile.h). If IS_STMT is true, the object printed is considered
1958 to be a statement and it is terminated by ';' if appropriate. */
1961 dump_generic_node (pretty_printer
*pp
, tree node
, int spc
, dump_flags_t flags
,
1968 enum tree_code code
;
1970 if (node
== NULL_TREE
)
1973 is_expr
= EXPR_P (node
);
1975 if (is_stmt
&& (flags
& TDF_STMTADDR
))
1977 pp_string (pp
, "<&");
1978 pp_scalar (pp
, "%p", (void *)node
);
1979 pp_string (pp
, "> ");
1982 if ((flags
& TDF_LINENO
) && EXPR_HAS_LOCATION (node
))
1983 dump_location (pp
, EXPR_LOCATION (node
));
1985 code
= TREE_CODE (node
);
1989 pp_string (pp
, "<<< error >>>");
1992 case IDENTIFIER_NODE
:
1993 pp_tree_identifier (pp
, node
);
1997 while (node
&& node
!= error_mark_node
)
1999 if (TREE_PURPOSE (node
))
2001 dump_generic_node (pp
, TREE_PURPOSE (node
), spc
, flags
, false);
2004 dump_generic_node (pp
, TREE_VALUE (node
), spc
, flags
, false);
2005 node
= TREE_CHAIN (node
);
2006 if (node
&& TREE_CODE (node
) == TREE_LIST
)
2015 dump_generic_node (pp
, BINFO_TYPE (node
), spc
, flags
, false);
2022 if (TREE_VEC_LENGTH (node
) > 0)
2024 size_t len
= TREE_VEC_LENGTH (node
);
2025 for (i
= 0; i
< len
- 1; i
++)
2027 dump_generic_node (pp
, TREE_VEC_ELT (node
, i
), spc
, flags
,
2032 dump_generic_node (pp
, TREE_VEC_ELT (node
, len
- 1), spc
,
2035 pp_right_brace (pp
);
2042 case FIXED_POINT_TYPE
:
2050 unsigned int quals
= TYPE_QUALS (node
);
2051 enum tree_code_class tclass
;
2053 if (quals
& TYPE_QUAL_ATOMIC
)
2054 pp_string (pp
, "atomic ");
2055 if (quals
& TYPE_QUAL_CONST
)
2056 pp_string (pp
, "const ");
2057 if (quals
& TYPE_QUAL_VOLATILE
)
2058 pp_string (pp
, "volatile ");
2059 if (quals
& TYPE_QUAL_RESTRICT
)
2060 pp_string (pp
, "restrict ");
2062 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
2064 pp_string (pp
, "<address-space-");
2065 pp_decimal_int (pp
, TYPE_ADDR_SPACE (node
));
2066 pp_string (pp
, "> ");
2069 tclass
= TREE_CODE_CLASS (TREE_CODE (node
));
2071 if (tclass
== tcc_declaration
)
2073 if (DECL_NAME (node
))
2074 dump_decl_name (pp
, node
, flags
);
2076 pp_string (pp
, "<unnamed type decl>");
2078 else if (tclass
== tcc_type
)
2080 if ((flags
& TDF_GIMPLE
) && node
== sizetype
)
2081 pp_string (pp
, "__SIZETYPE__");
2082 else if (TYPE_NAME (node
))
2084 if (TREE_CODE (TYPE_NAME (node
)) == IDENTIFIER_NODE
)
2085 pp_tree_identifier (pp
, TYPE_NAME (node
));
2086 else if (TREE_CODE (TYPE_NAME (node
)) == TYPE_DECL
2087 && DECL_NAME (TYPE_NAME (node
)))
2088 dump_decl_name (pp
, TYPE_NAME (node
), flags
);
2090 pp_string (pp
, "<unnamed type>");
2092 else if (TREE_CODE (node
) == VECTOR_TYPE
)
2094 if (flags
& TDF_GIMPLE
)
2096 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2097 pp_string (pp
, " [[gnu::vector_size(");
2099 (pp
, tree_to_poly_uint64 (TYPE_SIZE_UNIT (node
)));
2100 pp_string (pp
, ")]]");
2104 pp_string (pp
, "vector");
2106 pp_wide_integer (pp
, TYPE_VECTOR_SUBPARTS (node
));
2107 pp_string (pp
, ") ");
2108 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2111 else if (TREE_CODE (node
) == INTEGER_TYPE
)
2113 if (TYPE_PRECISION (node
) == CHAR_TYPE_SIZE
)
2114 pp_string (pp
, (TYPE_UNSIGNED (node
)
2117 else if (TYPE_PRECISION (node
) == SHORT_TYPE_SIZE
)
2118 pp_string (pp
, (TYPE_UNSIGNED (node
)
2121 else if (TYPE_PRECISION (node
) == INT_TYPE_SIZE
)
2122 pp_string (pp
, (TYPE_UNSIGNED (node
)
2125 else if (TYPE_PRECISION (node
) == LONG_TYPE_SIZE
)
2126 pp_string (pp
, (TYPE_UNSIGNED (node
)
2129 else if (TYPE_PRECISION (node
) == LONG_LONG_TYPE_SIZE
)
2130 pp_string (pp
, (TYPE_UNSIGNED (node
)
2131 ? "unsigned long long"
2132 : "signed long long"));
2133 else if (TYPE_PRECISION (node
) >= CHAR_TYPE_SIZE
2134 && pow2p_hwi (TYPE_PRECISION (node
)))
2136 pp_string (pp
, (TYPE_UNSIGNED (node
) ? "uint" : "int"));
2137 pp_decimal_int (pp
, TYPE_PRECISION (node
));
2138 pp_string (pp
, "_t");
2142 pp_string (pp
, (TYPE_UNSIGNED (node
)
2143 ? "<unnamed-unsigned:"
2144 : "<unnamed-signed:"));
2145 pp_decimal_int (pp
, TYPE_PRECISION (node
));
2149 else if (TREE_CODE (node
) == COMPLEX_TYPE
)
2151 pp_string (pp
, "__complex__ ");
2152 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2154 else if (TREE_CODE (node
) == REAL_TYPE
)
2156 pp_string (pp
, "<float:");
2157 pp_decimal_int (pp
, TYPE_PRECISION (node
));
2160 else if (TREE_CODE (node
) == FIXED_POINT_TYPE
)
2162 pp_string (pp
, "<fixed-point-");
2163 pp_string (pp
, TYPE_SATURATING (node
) ? "sat:" : "nonsat:");
2164 pp_decimal_int (pp
, TYPE_PRECISION (node
));
2167 else if (TREE_CODE (node
) == BOOLEAN_TYPE
)
2169 pp_string (pp
, (TYPE_UNSIGNED (node
)
2170 ? "<unsigned-boolean:"
2171 : "<signed-boolean:"));
2172 pp_decimal_int (pp
, TYPE_PRECISION (node
));
2175 else if (TREE_CODE (node
) == BITINT_TYPE
)
2177 if (TYPE_UNSIGNED (node
))
2178 pp_string (pp
, "unsigned ");
2179 pp_string (pp
, "_BitInt(");
2180 pp_decimal_int (pp
, TYPE_PRECISION (node
));
2181 pp_right_paren (pp
);
2183 else if (TREE_CODE (node
) == VOID_TYPE
)
2184 pp_string (pp
, "void");
2186 pp_string (pp
, "<unnamed type>");
2192 case REFERENCE_TYPE
:
2193 str
= (TREE_CODE (node
) == POINTER_TYPE
? "*" : "&");
2195 if (TREE_TYPE (node
) == NULL
)
2197 pp_string (pp
, str
);
2198 pp_string (pp
, "<null type>");
2200 else if (TREE_CODE (TREE_TYPE (node
)) == FUNCTION_TYPE
)
2202 tree fnode
= TREE_TYPE (node
);
2204 dump_generic_node (pp
, TREE_TYPE (fnode
), spc
, flags
, false);
2207 pp_string (pp
, str
);
2208 if (TYPE_IDENTIFIER (node
))
2209 dump_generic_node (pp
, TYPE_NAME (node
), spc
, flags
, false);
2210 else if (flags
& TDF_NOUID
)
2211 pp_string (pp
, "<Txxxx>");
2214 pp_string (pp
, "<T");
2215 pp_scalar (pp
, "%x", TYPE_UID (node
));
2216 pp_character (pp
, '>');
2219 pp_right_paren (pp
);
2220 dump_function_declaration (pp
, fnode
, spc
, flags
);
2224 unsigned int quals
= TYPE_QUALS (node
);
2226 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2228 pp_string (pp
, str
);
2230 if (quals
& TYPE_QUAL_CONST
)
2231 pp_string (pp
, " const");
2232 if (quals
& TYPE_QUAL_VOLATILE
)
2233 pp_string (pp
, " volatile");
2234 if (quals
& TYPE_QUAL_RESTRICT
)
2235 pp_string (pp
, " restrict");
2237 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
2239 pp_string (pp
, " <address-space-");
2240 pp_decimal_int (pp
, TYPE_ADDR_SPACE (node
));
2244 if (TYPE_REF_CAN_ALIAS_ALL (node
))
2245 pp_string (pp
, " {ref-all}");
2254 case TARGET_MEM_REF
:
2255 dump_mem_ref (pp
, node
, spc
, flags
);
2260 unsigned int quals
= TYPE_QUALS (node
);
2263 if (quals
& TYPE_QUAL_ATOMIC
)
2264 pp_string (pp
, "atomic ");
2265 if (quals
& TYPE_QUAL_CONST
)
2266 pp_string (pp
, "const ");
2267 if (quals
& TYPE_QUAL_VOLATILE
)
2268 pp_string (pp
, "volatile ");
2270 /* Print the innermost component type. */
2271 for (tmp
= TREE_TYPE (node
); TREE_CODE (tmp
) == ARRAY_TYPE
;
2272 tmp
= TREE_TYPE (tmp
))
2275 /* Avoid to print recursively the array. */
2276 /* FIXME : Not implemented correctly, see print_struct_decl. */
2277 if (TREE_CODE (tmp
) != POINTER_TYPE
|| TREE_TYPE (tmp
) != node
)
2278 dump_generic_node (pp
, tmp
, spc
, flags
, false);
2280 /* Print the dimensions. */
2281 for (tmp
= node
; TREE_CODE (tmp
) == ARRAY_TYPE
; tmp
= TREE_TYPE (tmp
))
2282 dump_array_domain (pp
, TYPE_DOMAIN (tmp
), spc
, flags
);
2288 case QUAL_UNION_TYPE
:
2290 unsigned int quals
= TYPE_QUALS (node
);
2292 if (quals
& TYPE_QUAL_ATOMIC
)
2293 pp_string (pp
, "atomic ");
2294 if (quals
& TYPE_QUAL_CONST
)
2295 pp_string (pp
, "const ");
2296 if (quals
& TYPE_QUAL_VOLATILE
)
2297 pp_string (pp
, "volatile ");
2299 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
2301 pp_string (pp
, "<address-space-");
2302 pp_decimal_int (pp
, TYPE_ADDR_SPACE (node
));
2303 pp_string (pp
, "> ");
2306 /* Print the name of the structure. */
2307 if (TREE_CODE (node
) == RECORD_TYPE
)
2308 pp_string (pp
, "struct ");
2309 else if (TREE_CODE (node
) == UNION_TYPE
)
2310 pp_string (pp
, "union ");
2312 if (TYPE_NAME (node
))
2313 dump_generic_node (pp
, TYPE_NAME (node
), spc
, flags
, false);
2314 else if (!(flags
& TDF_SLIM
))
2315 /* FIXME: If we eliminate the 'else' above and attempt
2316 to show the fields for named types, we may get stuck
2317 following a cycle of pointers to structs. The alleged
2318 self-reference check in print_struct_decl will not detect
2319 cycles involving more than one pointer or struct type. */
2320 print_struct_decl (pp
, node
, spc
, flags
);
2329 if (flags
& TDF_GIMPLE
2330 && (POINTER_TYPE_P (TREE_TYPE (node
))
2331 || (TYPE_PRECISION (TREE_TYPE (node
))
2332 < TYPE_PRECISION (integer_type_node
))
2333 || exact_log2 (TYPE_PRECISION (TREE_TYPE (node
))) == -1
2334 || tree_int_cst_sgn (node
) < 0))
2336 pp_string (pp
, "_Literal (");
2337 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2338 pp_string (pp
, ") ");
2340 if (TREE_CODE (TREE_TYPE (node
)) == POINTER_TYPE
2341 && ! (flags
& TDF_GIMPLE
))
2343 /* In the case of a pointer, one may want to divide by the
2344 size of the pointed-to type. Unfortunately, this not
2345 straightforward. The C front-end maps expressions
2350 in such a way that the two INTEGER_CST nodes for "5" have
2351 different values but identical types. In the latter
2352 case, the 5 is multiplied by sizeof (int) in c-common.cc
2353 (pointer_int_sum) to convert it to a byte address, and
2354 yet the type of the node is left unchanged. Argh. What
2355 is consistent though is that the number value corresponds
2356 to bytes (UNITS) offset.
2358 NB: Neither of the following divisors can be trivially
2359 used to recover the original literal:
2361 TREE_INT_CST_LOW (TYPE_SIZE_UNIT (TREE_TYPE (node)))
2362 TYPE_PRECISION (TREE_TYPE (TREE_TYPE (node))) */
2363 pp_wide_integer (pp
, TREE_INT_CST_LOW (node
));
2364 pp_string (pp
, "B"); /* pseudo-unit */
2366 else if (tree_fits_shwi_p (node
))
2367 pp_wide_integer (pp
, tree_to_shwi (node
));
2368 else if (tree_fits_uhwi_p (node
))
2369 pp_unsigned_wide_integer (pp
, tree_to_uhwi (node
));
2372 wide_int val
= wi::to_wide (node
);
2374 if (wi::neg_p (val
, TYPE_SIGN (TREE_TYPE (node
))))
2380 print_hex_buf_size (val
, &len
);
2381 if (UNLIKELY (len
> sizeof (pp_buffer (pp
)->digit_buffer
)))
2383 char *buf
= XALLOCAVEC (char, len
);
2384 print_hex (val
, buf
);
2385 pp_string (pp
, buf
);
2389 print_hex (val
, pp_buffer (pp
)->digit_buffer
);
2390 pp_string (pp
, pp_buffer (pp
)->digit_buffer
);
2393 if ((flags
& TDF_GIMPLE
)
2394 && ! (POINTER_TYPE_P (TREE_TYPE (node
))
2395 || (TYPE_PRECISION (TREE_TYPE (node
))
2396 < TYPE_PRECISION (integer_type_node
))
2397 || exact_log2 (TYPE_PRECISION (TREE_TYPE (node
))) == -1))
2399 if (TYPE_UNSIGNED (TREE_TYPE (node
)))
2400 pp_character (pp
, 'u');
2401 if (TYPE_PRECISION (TREE_TYPE (node
))
2402 == TYPE_PRECISION (unsigned_type_node
))
2404 else if (TYPE_PRECISION (TREE_TYPE (node
))
2405 == TYPE_PRECISION (long_unsigned_type_node
))
2406 pp_character (pp
, 'l');
2407 else if (TYPE_PRECISION (TREE_TYPE (node
))
2408 == TYPE_PRECISION (long_long_unsigned_type_node
))
2409 pp_string (pp
, "ll");
2411 if (TREE_OVERFLOW (node
))
2412 pp_string (pp
, "(OVF)");
2416 pp_string (pp
, "POLY_INT_CST [");
2417 dump_generic_node (pp
, POLY_INT_CST_COEFF (node
, 0), spc
, flags
, false);
2418 for (unsigned int i
= 1; i
< NUM_POLY_INT_COEFFS
; ++i
)
2420 pp_string (pp
, ", ");
2421 dump_generic_node (pp
, POLY_INT_CST_COEFF (node
, i
),
2424 pp_string (pp
, "]");
2428 /* Code copied from print_node. */
2431 if (TREE_OVERFLOW (node
))
2432 pp_string (pp
, " overflow");
2434 d
= TREE_REAL_CST (node
);
2435 if (REAL_VALUE_ISINF (d
))
2436 pp_string (pp
, REAL_VALUE_NEGATIVE (d
) ? " -Inf" : " Inf");
2437 else if (REAL_VALUE_ISNAN (d
))
2438 pp_string (pp
, " Nan");
2442 real_to_decimal (string
, &d
, sizeof (string
), 0, 1);
2443 pp_string (pp
, string
);
2451 fixed_to_decimal (string
, TREE_FIXED_CST_PTR (node
), sizeof (string
));
2452 pp_string (pp
, string
);
2457 pp_string (pp
, "__complex__ (");
2458 dump_generic_node (pp
, TREE_REALPART (node
), spc
, flags
, false);
2459 pp_string (pp
, ", ");
2460 dump_generic_node (pp
, TREE_IMAGPART (node
), spc
, flags
, false);
2461 pp_right_paren (pp
);
2466 pp_string (pp
, "\"");
2467 if (unsigned nbytes
= TREE_STRING_LENGTH (node
))
2468 pretty_print_string (pp
, TREE_STRING_POINTER (node
), nbytes
);
2469 pp_string (pp
, "\"");
2476 if (flags
& TDF_GIMPLE
)
2478 pp_string (pp
, "_Literal (");
2479 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2480 pp_string (pp
, ") ");
2482 pp_string (pp
, "{ ");
2483 unsigned HOST_WIDE_INT nunits
;
2484 if (!VECTOR_CST_NELTS (node
).is_constant (&nunits
))
2485 nunits
= vector_cst_encoded_nelts (node
);
2486 for (i
= 0; i
< nunits
; ++i
)
2489 pp_string (pp
, ", ");
2490 dump_generic_node (pp
, VECTOR_CST_ELT (node
, i
),
2493 if (!VECTOR_CST_NELTS (node
).is_constant ())
2494 pp_string (pp
, ", ...");
2495 pp_string (pp
, " }");
2501 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2503 if (TREE_CODE (node
) == METHOD_TYPE
)
2505 if (TYPE_METHOD_BASETYPE (node
))
2506 dump_generic_node (pp
, TYPE_NAME (TYPE_METHOD_BASETYPE (node
)),
2509 pp_string (pp
, "<null method basetype>");
2510 pp_colon_colon (pp
);
2512 if (TYPE_IDENTIFIER (node
))
2513 dump_generic_node (pp
, TYPE_NAME (node
), spc
, flags
, false);
2514 else if (TYPE_NAME (node
) && DECL_NAME (TYPE_NAME (node
)))
2515 dump_decl_name (pp
, TYPE_NAME (node
), flags
);
2516 else if (flags
& TDF_NOUID
)
2517 pp_string (pp
, "<Txxxx>");
2520 pp_string (pp
, "<T");
2521 pp_scalar (pp
, "%x", TYPE_UID (node
));
2522 pp_character (pp
, '>');
2524 dump_function_declaration (pp
, node
, spc
, flags
);
2529 dump_decl_name (pp
, node
, flags
);
2533 if (DECL_NAME (node
))
2534 dump_decl_name (pp
, node
, flags
);
2535 else if (LABEL_DECL_UID (node
) != -1)
2537 if (flags
& TDF_GIMPLE
)
2539 pp_character (pp
, 'L');
2540 pp_decimal_int (pp
, (int) LABEL_DECL_UID (node
));
2544 pp_string (pp
, "<L");
2545 pp_decimal_int (pp
, (int) LABEL_DECL_UID (node
));
2546 pp_character (pp
, '>');
2551 if (flags
& TDF_NOUID
)
2552 pp_string (pp
, "<D.xxxx>");
2555 if (flags
& TDF_GIMPLE
)
2557 pp_character (pp
, 'D');
2558 pp_scalar (pp
, "%u", DECL_UID (node
));
2562 pp_string (pp
, "<D.");
2563 pp_scalar (pp
, "%u", DECL_UID (node
));
2564 pp_character (pp
, '>');
2571 if (DECL_IS_UNDECLARED_BUILTIN (node
))
2573 /* Don't print the declaration of built-in types. */
2576 if (DECL_NAME (node
))
2577 dump_decl_name (pp
, node
, flags
);
2578 else if (TYPE_NAME (TREE_TYPE (node
)) != node
)
2580 pp_string (pp
, (TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
2581 ? "union" : "struct "));
2582 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2585 pp_string (pp
, "<anon>");
2591 case DEBUG_EXPR_DECL
:
2592 case NAMESPACE_DECL
:
2594 dump_decl_name (pp
, node
, flags
);
2598 pp_string (pp
, "<retval>");
2602 op0
= TREE_OPERAND (node
, 0);
2605 && (TREE_CODE (op0
) == INDIRECT_REF
2606 || (TREE_CODE (op0
) == MEM_REF
2607 && TREE_CODE (TREE_OPERAND (op0
, 0)) != ADDR_EXPR
2608 && integer_zerop (TREE_OPERAND (op0
, 1))
2609 /* Dump the types of INTEGER_CSTs explicitly, for we
2610 can't infer them and MEM_ATTR caching will share
2611 MEM_REFs with differently-typed op0s. */
2612 && TREE_CODE (TREE_OPERAND (op0
, 0)) != INTEGER_CST
2613 /* Released SSA_NAMES have no TREE_TYPE. */
2614 && TREE_TYPE (TREE_OPERAND (op0
, 0)) != NULL_TREE
2615 /* Same pointer types, but ignoring POINTER_TYPE vs.
2617 && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 0)))
2618 == TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 1))))
2619 && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0
, 0)))
2620 == TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0
, 1))))
2621 && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0
, 0)))
2622 == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0
, 1))))
2623 /* Same value types ignoring qualifiers. */
2624 && (TYPE_MAIN_VARIANT (TREE_TYPE (op0
))
2625 == TYPE_MAIN_VARIANT
2626 (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 1)))))
2627 && MR_DEPENDENCE_CLIQUE (op0
) == 0)))
2629 op0
= TREE_OPERAND (op0
, 0);
2632 if (op_prio (op0
) < op_prio (node
))
2634 dump_generic_node (pp
, op0
, spc
, flags
, false);
2635 if (op_prio (op0
) < op_prio (node
))
2636 pp_right_paren (pp
);
2637 pp_string (pp
, str
);
2638 op1
= TREE_OPERAND (node
, 1);
2639 dump_generic_node (pp
, op1
, spc
, flags
, false);
2640 if (DECL_P (op1
)) /* Not always a decl in the C++ FE. */
2641 if (tree off
= component_ref_field_offset (node
))
2642 if (TREE_CODE (off
) != INTEGER_CST
)
2644 pp_string (pp
, "{off: ");
2645 dump_generic_node (pp
, off
, spc
, flags
, false);
2646 pp_right_brace (pp
);
2651 if (flags
& TDF_GIMPLE
)
2653 pp_string (pp
, "__BIT_FIELD_REF <");
2654 dump_generic_node (pp
, TREE_TYPE (node
),
2655 spc
, flags
| TDF_SLIM
, false);
2656 if (TYPE_ALIGN (TREE_TYPE (node
))
2657 != TYPE_ALIGN (TYPE_MAIN_VARIANT (TREE_TYPE (node
))))
2659 pp_string (pp
, ", ");
2660 pp_decimal_int (pp
, TYPE_ALIGN (TREE_TYPE (node
)));
2663 pp_string (pp
, " (");
2664 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
,
2665 flags
| TDF_SLIM
, false);
2666 pp_string (pp
, ", ");
2667 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
,
2668 flags
| TDF_SLIM
, false);
2669 pp_string (pp
, ", ");
2670 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
,
2671 flags
| TDF_SLIM
, false);
2672 pp_right_paren (pp
);
2676 pp_string (pp
, "BIT_FIELD_REF <");
2677 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2678 pp_string (pp
, ", ");
2679 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2680 pp_string (pp
, ", ");
2681 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2686 case BIT_INSERT_EXPR
:
2687 pp_string (pp
, "BIT_INSERT_EXPR <");
2688 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2689 pp_string (pp
, ", ");
2690 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2691 pp_string (pp
, ", ");
2692 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2693 pp_string (pp
, " (");
2694 if (INTEGRAL_TYPE_P (TREE_TYPE (TREE_OPERAND (node
, 1))))
2696 TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (node
, 1))));
2698 dump_generic_node (pp
, TYPE_SIZE (TREE_TYPE (TREE_OPERAND (node
, 1))),
2700 pp_string (pp
, " bits)>");
2704 case ARRAY_RANGE_REF
:
2705 op0
= TREE_OPERAND (node
, 0);
2706 if (op_prio (op0
) < op_prio (node
))
2708 dump_generic_node (pp
, op0
, spc
, flags
, false);
2709 if (op_prio (op0
) < op_prio (node
))
2710 pp_right_paren (pp
);
2711 pp_left_bracket (pp
);
2712 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2713 if (TREE_CODE (node
) == ARRAY_RANGE_REF
)
2714 pp_string (pp
, " ...");
2715 pp_right_bracket (pp
);
2717 op0
= array_ref_low_bound (node
);
2718 op1
= array_ref_element_size (node
);
2720 if (!integer_zerop (op0
)
2721 || TREE_OPERAND (node
, 2)
2722 || TREE_OPERAND (node
, 3))
2724 pp_string (pp
, "{lb: ");
2725 dump_generic_node (pp
, op0
, spc
, flags
, false);
2726 pp_string (pp
, " sz: ");
2727 dump_generic_node (pp
, op1
, spc
, flags
, false);
2728 pp_right_brace (pp
);
2734 unsigned HOST_WIDE_INT ix
;
2736 bool is_struct_init
= false;
2737 bool is_array_init
= false;
2739 if (flags
& TDF_GIMPLE
)
2741 pp_string (pp
, "_Literal (");
2742 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2743 pp_string (pp
, ") ");
2746 if (TREE_CLOBBER_P (node
))
2748 pp_string (pp
, "CLOBBER");
2749 switch (CLOBBER_KIND (node
))
2751 case CLOBBER_STORAGE_BEGIN
:
2752 pp_string (pp
, "(bos)");
2754 case CLOBBER_STORAGE_END
:
2755 pp_string (pp
, "(eos)");
2757 case CLOBBER_OBJECT_BEGIN
:
2758 pp_string (pp
, "(bob)");
2760 case CLOBBER_OBJECT_END
:
2761 pp_string (pp
, "(eob)");
2767 else if (TREE_CODE (TREE_TYPE (node
)) == RECORD_TYPE
2768 || TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
)
2769 is_struct_init
= true;
2770 else if (TREE_CODE (TREE_TYPE (node
)) == ARRAY_TYPE
2771 && TYPE_DOMAIN (TREE_TYPE (node
))
2772 && TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
)))
2773 && TREE_CODE (TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
))))
2776 tree minv
= TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
)));
2777 is_array_init
= true;
2778 curidx
= wi::to_widest (minv
);
2780 FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (node
), ix
, field
, val
)
2787 dump_generic_node (pp
, field
, spc
, flags
, false);
2790 else if (is_array_init
2791 && (TREE_CODE (field
) != INTEGER_CST
2792 || curidx
!= wi::to_widest (field
)))
2794 pp_left_bracket (pp
);
2795 if (TREE_CODE (field
) == RANGE_EXPR
)
2797 dump_generic_node (pp
, TREE_OPERAND (field
, 0), spc
,
2799 pp_string (pp
, " ... ");
2800 dump_generic_node (pp
, TREE_OPERAND (field
, 1), spc
,
2802 if (TREE_CODE (TREE_OPERAND (field
, 1)) == INTEGER_CST
)
2803 curidx
= wi::to_widest (TREE_OPERAND (field
, 1));
2806 dump_generic_node (pp
, field
, spc
, flags
, false);
2807 if (TREE_CODE (field
) == INTEGER_CST
)
2808 curidx
= wi::to_widest (field
);
2809 pp_string (pp
, "]=");
2814 if (val
&& TREE_CODE (val
) == ADDR_EXPR
)
2815 if (TREE_CODE (TREE_OPERAND (val
, 0)) == FUNCTION_DECL
)
2816 val
= TREE_OPERAND (val
, 0);
2817 if (val
&& TREE_CODE (val
) == FUNCTION_DECL
)
2818 dump_decl_name (pp
, val
, flags
);
2820 dump_generic_node (pp
, val
, spc
, flags
, false);
2821 if (ix
!= CONSTRUCTOR_NELTS (node
) - 1)
2827 pp_right_brace (pp
);
2834 if (flags
& TDF_SLIM
)
2836 pp_string (pp
, "<COMPOUND_EXPR>");
2840 dump_generic_node (pp
, TREE_OPERAND (node
, 0),
2841 spc
, flags
, !(flags
& TDF_SLIM
));
2842 if (flags
& TDF_SLIM
)
2843 newline_and_indent (pp
, spc
);
2850 for (tp
= &TREE_OPERAND (node
, 1);
2851 TREE_CODE (*tp
) == COMPOUND_EXPR
;
2852 tp
= &TREE_OPERAND (*tp
, 1))
2854 dump_generic_node (pp
, TREE_OPERAND (*tp
, 0),
2855 spc
, flags
, !(flags
& TDF_SLIM
));
2856 if (flags
& TDF_SLIM
)
2857 newline_and_indent (pp
, spc
);
2865 dump_generic_node (pp
, *tp
, spc
, flags
, !(flags
& TDF_SLIM
));
2869 case STATEMENT_LIST
:
2871 tree_stmt_iterator si
;
2874 if (flags
& TDF_SLIM
)
2876 pp_string (pp
, "<STATEMENT_LIST>");
2880 for (si
= tsi_start (node
); !tsi_end_p (si
); tsi_next (&si
))
2883 newline_and_indent (pp
, spc
);
2886 dump_generic_node (pp
, tsi_stmt (si
), spc
, flags
, true);
2893 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
,
2898 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
,
2903 pp_string (pp
, "TARGET_EXPR <");
2904 dump_generic_node (pp
, TARGET_EXPR_SLOT (node
), spc
, flags
, false);
2907 dump_generic_node (pp
, TARGET_EXPR_INITIAL (node
), spc
, flags
, false);
2912 print_declaration (pp
, DECL_EXPR_DECL (node
), spc
, flags
);
2917 if (TREE_TYPE (node
) == NULL
|| TREE_TYPE (node
) == void_type_node
)
2919 pp_string (pp
, "if (");
2920 dump_generic_node (pp
, COND_EXPR_COND (node
), spc
, flags
, false);
2921 pp_right_paren (pp
);
2922 /* The lowered cond_exprs should always be printed in full. */
2923 if (COND_EXPR_THEN (node
)
2924 && (IS_EMPTY_STMT (COND_EXPR_THEN (node
))
2925 || TREE_CODE (COND_EXPR_THEN (node
)) == GOTO_EXPR
)
2926 && COND_EXPR_ELSE (node
)
2927 && (IS_EMPTY_STMT (COND_EXPR_ELSE (node
))
2928 || TREE_CODE (COND_EXPR_ELSE (node
)) == GOTO_EXPR
))
2931 dump_generic_node (pp
, COND_EXPR_THEN (node
),
2933 if (!IS_EMPTY_STMT (COND_EXPR_ELSE (node
)))
2935 pp_string (pp
, " else ");
2936 dump_generic_node (pp
, COND_EXPR_ELSE (node
),
2940 else if (!(flags
& TDF_SLIM
))
2942 /* Output COND_EXPR_THEN. */
2943 if (COND_EXPR_THEN (node
))
2945 newline_and_indent (pp
, spc
+2);
2947 newline_and_indent (pp
, spc
+4);
2948 dump_generic_node (pp
, COND_EXPR_THEN (node
), spc
+4,
2950 newline_and_indent (pp
, spc
+2);
2951 pp_right_brace (pp
);
2954 /* Output COND_EXPR_ELSE. */
2955 if (COND_EXPR_ELSE (node
)
2956 && !IS_EMPTY_STMT (COND_EXPR_ELSE (node
)))
2958 newline_and_indent (pp
, spc
);
2959 pp_string (pp
, "else");
2960 newline_and_indent (pp
, spc
+2);
2962 newline_and_indent (pp
, spc
+4);
2963 dump_generic_node (pp
, COND_EXPR_ELSE (node
), spc
+4,
2965 newline_and_indent (pp
, spc
+2);
2966 pp_right_brace (pp
);
2973 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2977 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2981 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2987 if (!(flags
& TDF_SLIM
))
2989 if (BIND_EXPR_VARS (node
))
2993 for (op0
= BIND_EXPR_VARS (node
); op0
; op0
= DECL_CHAIN (op0
))
2995 print_declaration (pp
, op0
, spc
+2, flags
);
3000 newline_and_indent (pp
, spc
+2);
3001 dump_generic_node (pp
, BIND_EXPR_BODY (node
), spc
+2, flags
, true);
3002 newline_and_indent (pp
, spc
);
3003 pp_right_brace (pp
);
3009 if (CALL_EXPR_FN (node
) != NULL_TREE
)
3010 print_call_name (pp
, CALL_EXPR_FN (node
), flags
);
3014 pp_string (pp
, internal_fn_name (CALL_EXPR_IFN (node
)));
3017 /* Print parameters. */
3022 call_expr_arg_iterator iter
;
3023 FOR_EACH_CALL_EXPR_ARG (arg
, iter
, node
)
3025 dump_generic_node (pp
, arg
, spc
, flags
, false);
3026 if (more_call_expr_args_p (&iter
))
3033 if (CALL_EXPR_VA_ARG_PACK (node
))
3035 if (call_expr_nargs (node
) > 0)
3040 pp_string (pp
, "__builtin_va_arg_pack ()");
3042 pp_right_paren (pp
);
3044 op1
= CALL_EXPR_STATIC_CHAIN (node
);
3047 pp_string (pp
, " [static-chain: ");
3048 dump_generic_node (pp
, op1
, spc
, flags
, false);
3049 pp_right_bracket (pp
);
3052 if (CALL_EXPR_RETURN_SLOT_OPT (node
))
3053 pp_string (pp
, " [return slot optimization]");
3054 if (CALL_EXPR_TAILCALL (node
))
3055 pp_string (pp
, " [tail call]");
3058 case WITH_CLEANUP_EXPR
:
3062 case CLEANUP_POINT_EXPR
:
3063 pp_string (pp
, "<<cleanup_point ");
3064 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3065 pp_string (pp
, ">>");
3068 case PLACEHOLDER_EXPR
:
3069 pp_string (pp
, "<PLACEHOLDER_EXPR ");
3070 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
3074 /* Binary arithmetic and logic expressions. */
3075 case WIDEN_SUM_EXPR
:
3076 case WIDEN_MULT_EXPR
:
3078 case MULT_HIGHPART_EXPR
:
3080 case POINTER_PLUS_EXPR
:
3081 case POINTER_DIFF_EXPR
:
3083 case TRUNC_DIV_EXPR
:
3085 case FLOOR_DIV_EXPR
:
3086 case ROUND_DIV_EXPR
:
3087 case TRUNC_MOD_EXPR
:
3089 case FLOOR_MOD_EXPR
:
3090 case ROUND_MOD_EXPR
:
3092 case EXACT_DIV_EXPR
:
3097 case WIDEN_LSHIFT_EXPR
:
3101 case TRUTH_ANDIF_EXPR
:
3102 case TRUTH_ORIF_EXPR
:
3103 case TRUTH_AND_EXPR
:
3105 case TRUTH_XOR_EXPR
:
3119 case UNORDERED_EXPR
:
3121 const char *op
= op_symbol (node
);
3122 op0
= TREE_OPERAND (node
, 0);
3123 op1
= TREE_OPERAND (node
, 1);
3125 /* When the operands are expressions with less priority,
3126 keep semantics of the tree representation. */
3127 if (op_prio (op0
) <= op_prio (node
))
3130 dump_generic_node (pp
, op0
, spc
, flags
, false);
3131 pp_right_paren (pp
);
3134 dump_generic_node (pp
, op0
, spc
, flags
, false);
3140 /* When the operands are expressions with less priority,
3141 keep semantics of the tree representation. */
3142 if (op_prio (op1
) <= op_prio (node
))
3145 dump_generic_node (pp
, op1
, spc
, flags
, false);
3146 pp_right_paren (pp
);
3149 dump_generic_node (pp
, op1
, spc
, flags
, false);
3153 /* Unary arithmetic and logic expressions. */
3155 if (flags
& TDF_GIMPLE_VAL
)
3157 pp_string (pp
, "_Literal (");
3158 dump_generic_node (pp
, TREE_TYPE (node
), spc
,
3159 flags
& ~TDF_GIMPLE_VAL
, false);
3160 pp_character (pp
, ')');
3165 case TRUTH_NOT_EXPR
:
3166 case PREDECREMENT_EXPR
:
3167 case PREINCREMENT_EXPR
:
3169 if (!(flags
& TDF_GIMPLE
)
3170 && TREE_CODE (node
) == ADDR_EXPR
3171 && (TREE_CODE (TREE_OPERAND (node
, 0)) == STRING_CST
3172 || TREE_CODE (TREE_OPERAND (node
, 0)) == FUNCTION_DECL
))
3173 /* Do not output '&' for strings and function pointers when not
3174 dumping GIMPLE FE syntax. */
3177 pp_string (pp
, op_symbol (node
));
3179 if (op_prio (TREE_OPERAND (node
, 0)) < op_prio (node
))
3182 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3183 pp_right_paren (pp
);
3186 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3189 case POSTDECREMENT_EXPR
:
3190 case POSTINCREMENT_EXPR
:
3191 if (op_prio (TREE_OPERAND (node
, 0)) < op_prio (node
))
3194 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3195 pp_right_paren (pp
);
3198 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3199 pp_string (pp
, op_symbol (node
));
3203 pp_string (pp
, "MIN_EXPR <");
3204 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3205 pp_string (pp
, ", ");
3206 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3211 pp_string (pp
, "MAX_EXPR <");
3212 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3213 pp_string (pp
, ", ");
3214 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3219 pp_string (pp
, "ABS_EXPR <");
3220 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3225 pp_string (pp
, "ABSU_EXPR <");
3226 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3234 case ADDR_SPACE_CONVERT_EXPR
:
3235 case FIXED_CONVERT_EXPR
:
3236 case FIX_TRUNC_EXPR
:
3239 type
= TREE_TYPE (node
);
3240 op0
= TREE_OPERAND (node
, 0);
3241 if (type
!= TREE_TYPE (op0
))
3244 dump_generic_node (pp
, type
, spc
, flags
, false);
3245 pp_string (pp
, ") ");
3247 if (op_prio (op0
) < op_prio (node
))
3249 dump_generic_node (pp
, op0
, spc
, flags
, false);
3250 if (op_prio (op0
) < op_prio (node
))
3251 pp_right_paren (pp
);
3254 case VIEW_CONVERT_EXPR
:
3255 if (flags
& TDF_GIMPLE
)
3256 pp_string (pp
, "__VIEW_CONVERT <");
3258 pp_string (pp
, "VIEW_CONVERT_EXPR<");
3259 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
3260 pp_string (pp
, ">(");
3261 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3262 pp_right_paren (pp
);
3266 pp_string (pp
, "((");
3267 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3268 pp_string (pp
, "))");
3271 case NON_LVALUE_EXPR
:
3272 pp_string (pp
, "NON_LVALUE_EXPR <");
3273 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3278 pp_string (pp
, "SAVE_EXPR <");
3279 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3284 pp_string (pp
, "COMPLEX_EXPR <");
3285 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3286 pp_string (pp
, ", ");
3287 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3292 pp_string (pp
, "CONJ_EXPR <");
3293 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3298 if (flags
& TDF_GIMPLE
)
3300 pp_string (pp
, "__real ");
3301 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3305 pp_string (pp
, "REALPART_EXPR <");
3306 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3312 if (flags
& TDF_GIMPLE
)
3314 pp_string (pp
, "__imag ");
3315 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3319 pp_string (pp
, "IMAGPART_EXPR <");
3320 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3326 pp_string (pp
, "VA_ARG_EXPR <");
3327 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3331 case TRY_FINALLY_EXPR
:
3332 case TRY_CATCH_EXPR
:
3333 pp_string (pp
, "try");
3334 newline_and_indent (pp
, spc
+2);
3336 newline_and_indent (pp
, spc
+4);
3337 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
+4, flags
, true);
3338 newline_and_indent (pp
, spc
+2);
3339 pp_right_brace (pp
);
3340 newline_and_indent (pp
, spc
);
3341 if (TREE_CODE (node
) == TRY_CATCH_EXPR
)
3343 node
= TREE_OPERAND (node
, 1);
3344 pp_string (pp
, "catch");
3348 gcc_assert (TREE_CODE (node
) == TRY_FINALLY_EXPR
);
3349 node
= TREE_OPERAND (node
, 1);
3350 pp_string (pp
, "finally");
3351 if (TREE_CODE (node
) == EH_ELSE_EXPR
)
3353 newline_and_indent (pp
, spc
+2);
3355 newline_and_indent (pp
, spc
+4);
3356 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
+4,
3358 newline_and_indent (pp
, spc
+2);
3359 pp_right_brace (pp
);
3360 newline_and_indent (pp
, spc
);
3361 node
= TREE_OPERAND (node
, 1);
3362 pp_string (pp
, "else");
3365 newline_and_indent (pp
, spc
+2);
3367 newline_and_indent (pp
, spc
+4);
3368 dump_generic_node (pp
, node
, spc
+4, flags
, true);
3369 newline_and_indent (pp
, spc
+2);
3370 pp_right_brace (pp
);
3375 pp_string (pp
, "catch (");
3376 dump_generic_node (pp
, CATCH_TYPES (node
), spc
+2, flags
, false);
3377 pp_right_paren (pp
);
3378 newline_and_indent (pp
, spc
+2);
3380 newline_and_indent (pp
, spc
+4);
3381 dump_generic_node (pp
, CATCH_BODY (node
), spc
+4, flags
, true);
3382 newline_and_indent (pp
, spc
+2);
3383 pp_right_brace (pp
);
3387 case EH_FILTER_EXPR
:
3388 pp_string (pp
, "<<<eh_filter (");
3389 dump_generic_node (pp
, EH_FILTER_TYPES (node
), spc
+2, flags
, false);
3390 pp_string (pp
, ")>>>");
3391 newline_and_indent (pp
, spc
+2);
3393 newline_and_indent (pp
, spc
+4);
3394 dump_generic_node (pp
, EH_FILTER_FAILURE (node
), spc
+4, flags
, true);
3395 newline_and_indent (pp
, spc
+2);
3396 pp_right_brace (pp
);
3401 op0
= TREE_OPERAND (node
, 0);
3402 /* If this is for break or continue, don't bother printing it. */
3403 if (DECL_NAME (op0
))
3405 const char *name
= IDENTIFIER_POINTER (DECL_NAME (op0
));
3406 if (strcmp (name
, "break") == 0
3407 || strcmp (name
, "continue") == 0)
3410 dump_generic_node (pp
, op0
, spc
, flags
, false);
3412 if (DECL_NONLOCAL (op0
))
3413 pp_string (pp
, " [non-local]");
3417 pp_string (pp
, "while (1)");
3418 if (!(flags
& TDF_SLIM
))
3420 newline_and_indent (pp
, spc
+2);
3422 newline_and_indent (pp
, spc
+4);
3423 dump_generic_node (pp
, LOOP_EXPR_BODY (node
), spc
+4, flags
, true);
3424 newline_and_indent (pp
, spc
+2);
3425 pp_right_brace (pp
);
3431 pp_string (pp
, "// predicted ");
3432 if (PREDICT_EXPR_OUTCOME (node
))
3433 pp_string (pp
, "likely by ");
3435 pp_string (pp
, "unlikely by ");
3436 pp_string (pp
, predictor_name (PREDICT_EXPR_PREDICTOR (node
)));
3437 pp_string (pp
, " predictor.");
3441 pp_string (pp
, "ANNOTATE_EXPR <");
3442 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3443 switch ((enum annot_expr_kind
) TREE_INT_CST_LOW (TREE_OPERAND (node
, 1)))
3445 case annot_expr_ivdep_kind
:
3446 pp_string (pp
, ", ivdep");
3448 case annot_expr_unroll_kind
:
3450 pp_string (pp
, ", unroll ");
3452 (int) TREE_INT_CST_LOW (TREE_OPERAND (node
, 2)));
3455 case annot_expr_no_vector_kind
:
3456 pp_string (pp
, ", no-vector");
3458 case annot_expr_vector_kind
:
3459 pp_string (pp
, ", vector");
3461 case annot_expr_parallel_kind
:
3462 pp_string (pp
, ", parallel");
3471 pp_string (pp
, "return");
3472 op0
= TREE_OPERAND (node
, 0);
3476 if (TREE_CODE (op0
) == MODIFY_EXPR
)
3477 dump_generic_node (pp
, TREE_OPERAND (op0
, 1),
3480 dump_generic_node (pp
, op0
, spc
, flags
, false);
3485 pp_string (pp
, "if (");
3486 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3487 pp_string (pp
, ") break");
3491 pp_string (pp
, "switch (");
3492 dump_generic_node (pp
, SWITCH_COND (node
), spc
, flags
, false);
3493 pp_right_paren (pp
);
3494 if (!(flags
& TDF_SLIM
))
3496 newline_and_indent (pp
, spc
+2);
3498 if (SWITCH_BODY (node
))
3500 newline_and_indent (pp
, spc
+4);
3501 dump_generic_node (pp
, SWITCH_BODY (node
), spc
+4, flags
,
3504 newline_and_indent (pp
, spc
+2);
3505 pp_right_brace (pp
);
3511 op0
= GOTO_DESTINATION (node
);
3512 if (TREE_CODE (op0
) != SSA_NAME
&& DECL_P (op0
) && DECL_NAME (op0
))
3514 const char *name
= IDENTIFIER_POINTER (DECL_NAME (op0
));
3515 if (strcmp (name
, "break") == 0
3516 || strcmp (name
, "continue") == 0)
3518 pp_string (pp
, name
);
3522 pp_string (pp
, "goto ");
3523 dump_generic_node (pp
, op0
, spc
, flags
, false);
3527 pp_string (pp
, "__asm__");
3528 if (ASM_VOLATILE_P (node
))
3529 pp_string (pp
, " __volatile__");
3531 dump_generic_node (pp
, ASM_STRING (node
), spc
, flags
, false);
3533 dump_generic_node (pp
, ASM_OUTPUTS (node
), spc
, flags
, false);
3535 dump_generic_node (pp
, ASM_INPUTS (node
), spc
, flags
, false);
3536 if (ASM_CLOBBERS (node
))
3539 dump_generic_node (pp
, ASM_CLOBBERS (node
), spc
, flags
, false);
3541 pp_right_paren (pp
);
3544 case CASE_LABEL_EXPR
:
3545 if (CASE_LOW (node
) && CASE_HIGH (node
))
3547 pp_string (pp
, "case ");
3548 dump_generic_node (pp
, CASE_LOW (node
), spc
, flags
, false);
3549 pp_string (pp
, " ... ");
3550 dump_generic_node (pp
, CASE_HIGH (node
), spc
, flags
, false);
3552 else if (CASE_LOW (node
))
3554 pp_string (pp
, "case ");
3555 dump_generic_node (pp
, CASE_LOW (node
), spc
, flags
, false);
3558 pp_string (pp
, "default");
3563 pp_string (pp
, "OBJ_TYPE_REF(");
3564 dump_generic_node (pp
, OBJ_TYPE_REF_EXPR (node
), spc
, flags
, false);
3566 /* We omit the class type for -fcompare-debug because we may
3567 drop TYPE_BINFO early depending on debug info, and then
3568 virtual_method_call_p would return false, whereas when
3569 TYPE_BINFO is preserved it may still return true and then
3570 we'd print the class type. Compare tree and rtl dumps for
3571 libstdc++-prettyprinters/shared_ptr.cc with and without -g,
3572 for example, at occurrences of OBJ_TYPE_REF. */
3573 if (!(flags
& (TDF_SLIM
| TDF_COMPARE_DEBUG
))
3574 && virtual_method_call_p (node
, true))
3576 pp_string (pp
, "(");
3577 dump_generic_node (pp
, obj_type_ref_class (node
, true),
3579 pp_string (pp
, ")");
3581 dump_generic_node (pp
, OBJ_TYPE_REF_OBJECT (node
), spc
, flags
, false);
3583 dump_generic_node (pp
, OBJ_TYPE_REF_TOKEN (node
), spc
, flags
, false);
3584 pp_right_paren (pp
);
3588 if (SSA_NAME_IDENTIFIER (node
))
3590 if ((flags
& TDF_NOUID
)
3591 && SSA_NAME_VAR (node
)
3592 && DECL_NAMELESS (SSA_NAME_VAR (node
)))
3593 dump_fancy_name (pp
, SSA_NAME_IDENTIFIER (node
));
3594 else if (! (flags
& TDF_GIMPLE
)
3595 || SSA_NAME_VAR (node
))
3596 dump_generic_node (pp
, SSA_NAME_IDENTIFIER (node
),
3600 pp_decimal_int (pp
, SSA_NAME_VERSION (node
));
3601 if (SSA_NAME_IS_DEFAULT_DEF (node
))
3602 pp_string (pp
, "(D)");
3603 if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (node
))
3604 pp_string (pp
, "(ab)");
3607 case WITH_SIZE_EXPR
:
3608 pp_string (pp
, "WITH_SIZE_EXPR <");
3609 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3610 pp_string (pp
, ", ");
3611 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3616 pp_string (pp
, "scev_known");
3619 case SCEV_NOT_KNOWN
:
3620 pp_string (pp
, "scev_not_known");
3623 case POLYNOMIAL_CHREC
:
3625 dump_generic_node (pp
, CHREC_LEFT (node
), spc
, flags
, false);
3626 pp_string (pp
, ", +, ");
3627 dump_generic_node (pp
, CHREC_RIGHT (node
), spc
, flags
, false);
3628 pp_string (pp
, !CHREC_NOWRAP (node
) ? "}_" : "}<nw>_");
3629 pp_scalar (pp
, "%u", CHREC_VARIABLE (node
));
3633 case REALIGN_LOAD_EXPR
:
3634 pp_string (pp
, "REALIGN_LOAD <");
3635 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3636 pp_string (pp
, ", ");
3637 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3638 pp_string (pp
, ", ");
3639 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3644 pp_string (pp
, " VEC_COND_EXPR < ");
3645 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3646 pp_string (pp
, " , ");
3647 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3648 pp_string (pp
, " , ");
3649 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3650 pp_string (pp
, " > ");
3654 pp_string (pp
, " VEC_PERM_EXPR < ");
3655 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3656 pp_string (pp
, " , ");
3657 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3658 pp_string (pp
, " , ");
3659 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3660 pp_string (pp
, " > ");
3664 pp_string (pp
, " DOT_PROD_EXPR < ");
3665 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3666 pp_string (pp
, ", ");
3667 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3668 pp_string (pp
, ", ");
3669 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3670 pp_string (pp
, " > ");
3673 case WIDEN_MULT_PLUS_EXPR
:
3674 pp_string (pp
, " WIDEN_MULT_PLUS_EXPR < ");
3675 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3676 pp_string (pp
, ", ");
3677 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3678 pp_string (pp
, ", ");
3679 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3680 pp_string (pp
, " > ");
3683 case WIDEN_MULT_MINUS_EXPR
:
3684 pp_string (pp
, " WIDEN_MULT_MINUS_EXPR < ");
3685 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3686 pp_string (pp
, ", ");
3687 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3688 pp_string (pp
, ", ");
3689 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3690 pp_string (pp
, " > ");
3694 pp_string (pp
, "#pragma acc parallel");
3695 goto dump_omp_clauses_body
;
3698 pp_string (pp
, "#pragma acc kernels");
3699 goto dump_omp_clauses_body
;
3702 pp_string (pp
, "#pragma acc serial");
3703 goto dump_omp_clauses_body
;
3706 pp_string (pp
, "#pragma acc data");
3707 dump_omp_clauses (pp
, OACC_DATA_CLAUSES (node
), spc
, flags
);
3710 case OACC_HOST_DATA
:
3711 pp_string (pp
, "#pragma acc host_data");
3712 dump_omp_clauses (pp
, OACC_HOST_DATA_CLAUSES (node
), spc
, flags
);
3716 pp_string (pp
, "#pragma acc declare");
3717 dump_omp_clauses (pp
, OACC_DECLARE_CLAUSES (node
), spc
, flags
);
3721 pp_string (pp
, "#pragma acc update");
3722 dump_omp_clauses (pp
, OACC_UPDATE_CLAUSES (node
), spc
, flags
);
3725 case OACC_ENTER_DATA
:
3726 pp_string (pp
, "#pragma acc enter data");
3727 dump_omp_clauses (pp
, OACC_ENTER_DATA_CLAUSES (node
), spc
, flags
);
3730 case OACC_EXIT_DATA
:
3731 pp_string (pp
, "#pragma acc exit data");
3732 dump_omp_clauses (pp
, OACC_EXIT_DATA_CLAUSES (node
), spc
, flags
);
3736 pp_string (pp
, "#pragma acc cache");
3737 dump_omp_clauses (pp
, OACC_CACHE_CLAUSES (node
), spc
, flags
);
3741 pp_string (pp
, "#pragma omp parallel");
3742 dump_omp_clauses (pp
, OMP_PARALLEL_CLAUSES (node
), spc
, flags
);
3745 dump_omp_clauses_body
:
3746 dump_omp_clauses (pp
, OMP_CLAUSES (node
), spc
, flags
);
3750 if (!(flags
& TDF_SLIM
) && OMP_BODY (node
))
3752 newline_and_indent (pp
, spc
+ 2);
3754 newline_and_indent (pp
, spc
+ 4);
3755 dump_generic_node (pp
, OMP_BODY (node
), spc
+ 4, flags
, false);
3756 newline_and_indent (pp
, spc
+ 2);
3757 pp_right_brace (pp
);
3763 pp_string (pp
, OMP_TASK_BODY (node
) ? "#pragma omp task"
3764 : "#pragma omp taskwait");
3765 dump_omp_clauses (pp
, OMP_TASK_CLAUSES (node
), spc
, flags
);
3769 pp_string (pp
, "#pragma omp for");
3773 pp_string (pp
, "#pragma omp simd");
3776 case OMP_DISTRIBUTE
:
3777 pp_string (pp
, "#pragma omp distribute");
3781 pp_string (pp
, "#pragma omp taskloop");
3785 pp_string (pp
, "#pragma omp loop");
3789 pp_string (pp
, "#pragma acc loop");
3793 pp_string (pp
, "#pragma omp teams");
3794 dump_omp_clauses (pp
, OMP_TEAMS_CLAUSES (node
), spc
, flags
);
3797 case OMP_TARGET_DATA
:
3798 pp_string (pp
, "#pragma omp target data");
3799 dump_omp_clauses (pp
, OMP_TARGET_DATA_CLAUSES (node
), spc
, flags
);
3802 case OMP_TARGET_ENTER_DATA
:
3803 pp_string (pp
, "#pragma omp target enter data");
3804 dump_omp_clauses (pp
, OMP_TARGET_ENTER_DATA_CLAUSES (node
), spc
, flags
);
3808 case OMP_TARGET_EXIT_DATA
:
3809 pp_string (pp
, "#pragma omp target exit data");
3810 dump_omp_clauses (pp
, OMP_TARGET_EXIT_DATA_CLAUSES (node
), spc
, flags
);
3815 pp_string (pp
, "#pragma omp target");
3816 dump_omp_clauses (pp
, OMP_TARGET_CLAUSES (node
), spc
, flags
);
3819 case OMP_TARGET_UPDATE
:
3820 pp_string (pp
, "#pragma omp target update");
3821 dump_omp_clauses (pp
, OMP_TARGET_UPDATE_CLAUSES (node
), spc
, flags
);
3826 dump_omp_clauses (pp
, OMP_FOR_CLAUSES (node
), spc
, flags
);
3827 if (!(flags
& TDF_SLIM
))
3831 if (OMP_FOR_PRE_BODY (node
))
3833 newline_and_indent (pp
, spc
+ 2);
3836 newline_and_indent (pp
, spc
);
3837 dump_generic_node (pp
, OMP_FOR_PRE_BODY (node
),
3840 if (OMP_FOR_INIT (node
))
3843 for (i
= 0; i
< TREE_VEC_LENGTH (OMP_FOR_INIT (node
)); i
++)
3846 newline_and_indent (pp
, spc
);
3847 pp_string (pp
, "for (");
3848 tree init
= TREE_VEC_ELT (OMP_FOR_INIT (node
), i
);
3849 if (TREE_CODE (init
) != MODIFY_EXPR
3850 || TREE_CODE (TREE_OPERAND (init
, 1)) != TREE_VEC
)
3851 dump_generic_node (pp
, init
, spc
, flags
, false);
3854 dump_generic_node (pp
, TREE_OPERAND (init
, 0),
3856 pp_string (pp
, " = ");
3857 dump_omp_loop_non_rect_expr (pp
, TREE_OPERAND (init
, 1),
3860 pp_string (pp
, "; ");
3861 tree cond
= TREE_VEC_ELT (OMP_FOR_COND (node
), i
);
3862 if (!COMPARISON_CLASS_P (cond
)
3863 || TREE_CODE (TREE_OPERAND (cond
, 1)) != TREE_VEC
)
3864 dump_generic_node (pp
, cond
, spc
, flags
, false);
3867 dump_generic_node (pp
, TREE_OPERAND (cond
, 0),
3869 const char *op
= op_symbol (cond
);
3873 dump_omp_loop_non_rect_expr (pp
, TREE_OPERAND (cond
, 1),
3876 pp_string (pp
, "; ");
3877 dump_generic_node (pp
,
3878 TREE_VEC_ELT (OMP_FOR_INCR (node
), i
),
3880 pp_right_paren (pp
);
3883 if (OMP_FOR_BODY (node
))
3885 newline_and_indent (pp
, spc
+ 2);
3887 newline_and_indent (pp
, spc
+ 4);
3888 dump_generic_node (pp
, OMP_FOR_BODY (node
), spc
+ 4, flags
,
3890 newline_and_indent (pp
, spc
+ 2);
3891 pp_right_brace (pp
);
3893 if (OMP_FOR_INIT (node
))
3894 spc
-= 2 * TREE_VEC_LENGTH (OMP_FOR_INIT (node
)) - 2;
3895 if (OMP_FOR_PRE_BODY (node
))
3898 newline_and_indent (pp
, spc
+ 2);
3899 pp_right_brace (pp
);
3906 pp_string (pp
, "#pragma omp sections");
3907 dump_omp_clauses (pp
, OMP_SECTIONS_CLAUSES (node
), spc
, flags
);
3911 pp_string (pp
, "#pragma omp section");
3914 case OMP_STRUCTURED_BLOCK
:
3915 pp_string (pp
, "#pragma omp __structured_block");
3919 if (OMP_SCAN_CLAUSES (node
))
3921 pp_string (pp
, "#pragma omp scan");
3922 dump_omp_clauses (pp
, OMP_SCAN_CLAUSES (node
), spc
, flags
);
3927 pp_string (pp
, "#pragma omp master");
3931 pp_string (pp
, "#pragma omp masked");
3932 dump_omp_clauses (pp
, OMP_MASKED_CLAUSES (node
), spc
, flags
);
3936 pp_string (pp
, "#pragma omp taskgroup");
3937 dump_omp_clauses (pp
, OMP_TASKGROUP_CLAUSES (node
), spc
, flags
);
3941 pp_string (pp
, "#pragma omp ordered");
3942 dump_omp_clauses (pp
, OMP_ORDERED_CLAUSES (node
), spc
, flags
);
3946 pp_string (pp
, "#pragma omp critical");
3947 if (OMP_CRITICAL_NAME (node
))
3951 dump_generic_node (pp
, OMP_CRITICAL_NAME (node
), spc
,
3953 pp_right_paren (pp
);
3955 dump_omp_clauses (pp
, OMP_CRITICAL_CLAUSES (node
), spc
, flags
);
3959 pp_string (pp
, "#pragma omp atomic");
3960 if (OMP_ATOMIC_WEAK (node
))
3961 pp_string (pp
, " weak");
3962 dump_omp_atomic_memory_order (pp
, OMP_ATOMIC_MEMORY_ORDER (node
));
3963 newline_and_indent (pp
, spc
+ 2);
3964 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3968 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3971 case OMP_ATOMIC_READ
:
3972 pp_string (pp
, "#pragma omp atomic read");
3973 dump_omp_atomic_memory_order (pp
, OMP_ATOMIC_MEMORY_ORDER (node
));
3974 newline_and_indent (pp
, spc
+ 2);
3975 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3979 case OMP_ATOMIC_CAPTURE_OLD
:
3980 case OMP_ATOMIC_CAPTURE_NEW
:
3981 pp_string (pp
, "#pragma omp atomic capture");
3982 if (OMP_ATOMIC_WEAK (node
))
3983 pp_string (pp
, " weak");
3984 dump_omp_atomic_memory_order (pp
, OMP_ATOMIC_MEMORY_ORDER (node
));
3985 newline_and_indent (pp
, spc
+ 2);
3986 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3990 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3994 pp_string (pp
, "#pragma omp single");
3995 dump_omp_clauses (pp
, OMP_SINGLE_CLAUSES (node
), spc
, flags
);
3999 pp_string (pp
, "#pragma omp scope");
4000 dump_omp_clauses (pp
, OMP_SCOPE_CLAUSES (node
), spc
, flags
);
4004 /* If we come here, we're dumping something that's not an OMP construct,
4005 for example, OMP clauses attached to a function's '__attribute__'.
4006 Dump the whole OMP clause chain. */
4007 dump_omp_clauses (pp
, node
, spc
, flags
, false);
4011 case TRANSACTION_EXPR
:
4012 if (TRANSACTION_EXPR_OUTER (node
))
4013 pp_string (pp
, "__transaction_atomic [[outer]]");
4014 else if (TRANSACTION_EXPR_RELAXED (node
))
4015 pp_string (pp
, "__transaction_relaxed");
4017 pp_string (pp
, "__transaction_atomic");
4018 if (!(flags
& TDF_SLIM
) && TRANSACTION_EXPR_BODY (node
))
4020 newline_and_indent (pp
, spc
);
4022 newline_and_indent (pp
, spc
+ 2);
4023 dump_generic_node (pp
, TRANSACTION_EXPR_BODY (node
),
4024 spc
+ 2, flags
, false);
4025 newline_and_indent (pp
, spc
);
4026 pp_right_brace (pp
);
4031 case VEC_SERIES_EXPR
:
4032 case VEC_WIDEN_MULT_HI_EXPR
:
4033 case VEC_WIDEN_MULT_LO_EXPR
:
4034 case VEC_WIDEN_MULT_EVEN_EXPR
:
4035 case VEC_WIDEN_MULT_ODD_EXPR
:
4036 case VEC_WIDEN_LSHIFT_HI_EXPR
:
4037 case VEC_WIDEN_LSHIFT_LO_EXPR
:
4039 for (str
= get_tree_code_name (code
); *str
; str
++)
4040 pp_character (pp
, TOUPPER (*str
));
4041 pp_string (pp
, " < ");
4042 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
4043 pp_string (pp
, ", ");
4044 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
4045 pp_string (pp
, " > ");
4048 case VEC_DUPLICATE_EXPR
:
4050 for (str
= get_tree_code_name (code
); *str
; str
++)
4051 pp_character (pp
, TOUPPER (*str
));
4052 pp_string (pp
, " < ");
4053 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
4054 pp_string (pp
, " > ");
4057 case VEC_UNPACK_HI_EXPR
:
4058 pp_string (pp
, " VEC_UNPACK_HI_EXPR < ");
4059 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
4060 pp_string (pp
, " > ");
4063 case VEC_UNPACK_LO_EXPR
:
4064 pp_string (pp
, " VEC_UNPACK_LO_EXPR < ");
4065 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
4066 pp_string (pp
, " > ");
4069 case VEC_UNPACK_FLOAT_HI_EXPR
:
4070 pp_string (pp
, " VEC_UNPACK_FLOAT_HI_EXPR < ");
4071 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
4072 pp_string (pp
, " > ");
4075 case VEC_UNPACK_FLOAT_LO_EXPR
:
4076 pp_string (pp
, " VEC_UNPACK_FLOAT_LO_EXPR < ");
4077 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
4078 pp_string (pp
, " > ");
4081 case VEC_UNPACK_FIX_TRUNC_HI_EXPR
:
4082 pp_string (pp
, " VEC_UNPACK_FIX_TRUNC_HI_EXPR < ");
4083 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
4084 pp_string (pp
, " > ");
4087 case VEC_UNPACK_FIX_TRUNC_LO_EXPR
:
4088 pp_string (pp
, " VEC_UNPACK_FIX_TRUNC_LO_EXPR < ");
4089 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
4090 pp_string (pp
, " > ");
4093 case VEC_PACK_TRUNC_EXPR
:
4094 pp_string (pp
, " VEC_PACK_TRUNC_EXPR < ");
4095 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
4096 pp_string (pp
, ", ");
4097 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
4098 pp_string (pp
, " > ");
4101 case VEC_PACK_SAT_EXPR
:
4102 pp_string (pp
, " VEC_PACK_SAT_EXPR < ");
4103 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
4104 pp_string (pp
, ", ");
4105 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
4106 pp_string (pp
, " > ");
4109 case VEC_PACK_FIX_TRUNC_EXPR
:
4110 pp_string (pp
, " VEC_PACK_FIX_TRUNC_EXPR < ");
4111 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
4112 pp_string (pp
, ", ");
4113 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
4114 pp_string (pp
, " > ");
4117 case VEC_PACK_FLOAT_EXPR
:
4118 pp_string (pp
, " VEC_PACK_FLOAT_EXPR < ");
4119 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
4120 pp_string (pp
, ", ");
4121 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
4122 pp_string (pp
, " > ");
4126 dump_block_node (pp
, node
, spc
, flags
);
4129 case DEBUG_BEGIN_STMT
:
4130 pp_string (pp
, "# DEBUG BEGIN STMT");
4137 if (is_stmt
&& is_expr
)
4143 /* Print the declaration of a variable. */
4146 print_declaration (pretty_printer
*pp
, tree t
, int spc
, dump_flags_t flags
)
4150 if (TREE_CODE(t
) == NAMELIST_DECL
)
4152 pp_string(pp
, "namelist ");
4153 dump_decl_name (pp
, t
, flags
);
4158 if (TREE_CODE (t
) == TYPE_DECL
)
4159 pp_string (pp
, "typedef ");
4161 if (HAS_RTL_P (t
) && DECL_REGISTER (t
))
4162 pp_string (pp
, "register ");
4164 if (TREE_PUBLIC (t
) && DECL_EXTERNAL (t
))
4165 pp_string (pp
, "extern ");
4166 else if (TREE_STATIC (t
))
4167 pp_string (pp
, "static ");
4169 /* Print the type and name. */
4170 if (TREE_TYPE (t
) && TREE_CODE (TREE_TYPE (t
)) == ARRAY_TYPE
)
4174 /* Print array's type. */
4175 tmp
= TREE_TYPE (t
);
4176 while (TREE_CODE (TREE_TYPE (tmp
)) == ARRAY_TYPE
)
4177 tmp
= TREE_TYPE (tmp
);
4178 dump_generic_node (pp
, TREE_TYPE (tmp
), spc
, flags
, false);
4180 /* Print variable's name. */
4182 dump_generic_node (pp
, t
, spc
, flags
, false);
4184 /* Print the dimensions. */
4185 tmp
= TREE_TYPE (t
);
4186 while (TREE_CODE (tmp
) == ARRAY_TYPE
)
4188 dump_array_domain (pp
, TYPE_DOMAIN (tmp
), spc
, flags
);
4189 tmp
= TREE_TYPE (tmp
);
4192 else if (TREE_CODE (t
) == FUNCTION_DECL
)
4194 dump_generic_node (pp
, TREE_TYPE (TREE_TYPE (t
)), spc
, flags
, false);
4196 dump_decl_name (pp
, t
, flags
);
4197 dump_function_declaration (pp
, TREE_TYPE (t
), spc
, flags
);
4201 /* Print type declaration. */
4202 dump_generic_node (pp
, TREE_TYPE (t
), spc
, flags
, false);
4204 /* Print variable's name. */
4206 dump_generic_node (pp
, t
, spc
, flags
, false);
4209 if (VAR_P (t
) && DECL_HARD_REGISTER (t
))
4211 pp_string (pp
, " __asm__ ");
4213 dump_generic_node (pp
, DECL_ASSEMBLER_NAME (t
), spc
, flags
, false);
4214 pp_right_paren (pp
);
4217 /* The initial value of a function serves to determine whether the function
4218 is declared or defined. So the following does not apply to function
4220 if (TREE_CODE (t
) != FUNCTION_DECL
)
4222 /* Print the initial value. */
4223 if (DECL_INITIAL (t
))
4228 if (!(flags
& TDF_SLIM
))
4229 dump_generic_node (pp
, DECL_INITIAL (t
), spc
, flags
, false);
4231 pp_string (pp
, "<<< omitted >>>");
4235 if (VAR_P (t
) && DECL_HAS_VALUE_EXPR_P (t
))
4237 pp_string (pp
, " [value-expr: ");
4238 dump_generic_node (pp
, DECL_VALUE_EXPR (t
), spc
, flags
, false);
4239 pp_right_bracket (pp
);
4246 /* Prints a structure: name, fields, and methods.
4247 FIXME: Still incomplete. */
4250 print_struct_decl (pretty_printer
*pp
, const_tree node
, int spc
,
4253 /* Print the name of the structure. */
4254 if (TYPE_NAME (node
))
4257 if (TREE_CODE (node
) == RECORD_TYPE
)
4258 pp_string (pp
, "struct ");
4259 else if ((TREE_CODE (node
) == UNION_TYPE
4260 || TREE_CODE (node
) == QUAL_UNION_TYPE
))
4261 pp_string (pp
, "union ");
4263 dump_generic_node (pp
, TYPE_NAME (node
), spc
, TDF_NONE
, false);
4266 /* Print the contents of the structure. */
4272 /* Print the fields of the structure. */
4275 tmp
= TYPE_FIELDS (node
);
4278 /* Avoid to print recursively the structure. */
4279 /* FIXME : Not implemented correctly...,
4280 what about the case when we have a cycle in the contain graph? ...
4281 Maybe this could be solved by looking at the scope in which the
4282 structure was declared. */
4283 if (TREE_TYPE (tmp
) != node
4284 && (TREE_CODE (TREE_TYPE (tmp
)) != POINTER_TYPE
4285 || TREE_TYPE (TREE_TYPE (tmp
)) != node
))
4287 print_declaration (pp
, tmp
, spc
+2, flags
);
4290 tmp
= DECL_CHAIN (tmp
);
4294 pp_right_brace (pp
);
4297 /* Return the priority of the operator CODE.
4299 From lowest to highest precedence with either left-to-right (L-R)
4300 or right-to-left (R-L) associativity]:
4303 2 [R-L] = += -= *= /= %= &= ^= |= <<= >>=
4315 14 [R-L] ! ~ ++ -- + - * & (type) sizeof
4316 15 [L-R] fn() [] -> .
4318 unary +, - and * have higher precedence than the corresponding binary
4322 op_code_prio (enum tree_code code
)
4339 case TRUTH_ORIF_EXPR
:
4342 case TRUTH_AND_EXPR
:
4343 case TRUTH_ANDIF_EXPR
:
4350 case TRUTH_XOR_EXPR
:
4367 case UNORDERED_EXPR
:
4378 case VEC_WIDEN_LSHIFT_HI_EXPR
:
4379 case VEC_WIDEN_LSHIFT_LO_EXPR
:
4380 case WIDEN_LSHIFT_EXPR
:
4383 case WIDEN_SUM_EXPR
:
4385 case POINTER_PLUS_EXPR
:
4386 case POINTER_DIFF_EXPR
:
4390 case VEC_WIDEN_MULT_HI_EXPR
:
4391 case VEC_WIDEN_MULT_LO_EXPR
:
4392 case WIDEN_MULT_EXPR
:
4394 case WIDEN_MULT_PLUS_EXPR
:
4395 case WIDEN_MULT_MINUS_EXPR
:
4397 case MULT_HIGHPART_EXPR
:
4398 case TRUNC_DIV_EXPR
:
4400 case FLOOR_DIV_EXPR
:
4401 case ROUND_DIV_EXPR
:
4403 case EXACT_DIV_EXPR
:
4404 case TRUNC_MOD_EXPR
:
4406 case FLOOR_MOD_EXPR
:
4407 case ROUND_MOD_EXPR
:
4410 case TRUTH_NOT_EXPR
:
4412 case POSTINCREMENT_EXPR
:
4413 case POSTDECREMENT_EXPR
:
4414 case PREINCREMENT_EXPR
:
4415 case PREDECREMENT_EXPR
:
4421 case FIX_TRUNC_EXPR
:
4427 case ARRAY_RANGE_REF
:
4431 /* Special expressions. */
4437 case VEC_UNPACK_HI_EXPR
:
4438 case VEC_UNPACK_LO_EXPR
:
4439 case VEC_UNPACK_FLOAT_HI_EXPR
:
4440 case VEC_UNPACK_FLOAT_LO_EXPR
:
4441 case VEC_UNPACK_FIX_TRUNC_HI_EXPR
:
4442 case VEC_UNPACK_FIX_TRUNC_LO_EXPR
:
4443 case VEC_PACK_TRUNC_EXPR
:
4444 case VEC_PACK_SAT_EXPR
:
4448 /* Return an arbitrarily high precedence to avoid surrounding single
4449 VAR_DECLs in ()s. */
4454 /* Return the priority of the operator OP. */
4457 op_prio (const_tree op
)
4459 enum tree_code code
;
4464 code
= TREE_CODE (op
);
4465 if (code
== SAVE_EXPR
|| code
== NON_LVALUE_EXPR
)
4466 return op_prio (TREE_OPERAND (op
, 0));
4468 return op_code_prio (code
);
4471 /* Return the symbol associated with operator CODE. */
4474 op_symbol_code (enum tree_code code
, dump_flags_t flags
)
4482 case TRUTH_ORIF_EXPR
:
4485 case TRUTH_AND_EXPR
:
4486 case TRUTH_ANDIF_EXPR
:
4492 case TRUTH_XOR_EXPR
:
4501 return (flags
& TDF_GIMPLE
) ? "__ORDERED" : "ord";
4502 case UNORDERED_EXPR
:
4503 return (flags
& TDF_GIMPLE
) ? "__UNORDERED" : "unord";
4508 return (flags
& TDF_GIMPLE
) ? "__UNEQ" : "u==";
4516 return (flags
& TDF_GIMPLE
) ? "__UNLT" : "u<";
4521 return (flags
& TDF_GIMPLE
) ? "__UNLE" : "u<=";
4526 return (flags
& TDF_GIMPLE
) ? "__UNGT" : "u>";
4531 return (flags
& TDF_GIMPLE
) ? "__UNGE" : "u>=";
4534 return (flags
& TDF_GIMPLE
) ? "__LTGT" : "<>";
4548 case WIDEN_LSHIFT_EXPR
:
4551 case POINTER_PLUS_EXPR
:
4557 case WIDEN_SUM_EXPR
:
4560 case WIDEN_MULT_EXPR
:
4563 case MULT_HIGHPART_EXPR
:
4564 return (flags
& TDF_GIMPLE
) ? "__MULT_HIGHPART" : "h*";
4568 case POINTER_DIFF_EXPR
:
4574 case TRUTH_NOT_EXPR
:
4581 case TRUNC_DIV_EXPR
:
4588 case FLOOR_DIV_EXPR
:
4591 case ROUND_DIV_EXPR
:
4594 case EXACT_DIV_EXPR
:
4597 case TRUNC_MOD_EXPR
:
4603 case FLOOR_MOD_EXPR
:
4606 case ROUND_MOD_EXPR
:
4609 case PREDECREMENT_EXPR
:
4612 case PREINCREMENT_EXPR
:
4615 case POSTDECREMENT_EXPR
:
4618 case POSTINCREMENT_EXPR
:
4628 return "<<< ??? >>>";
4632 /* Return the symbol associated with operator OP. */
4635 op_symbol (const_tree op
, dump_flags_t flags
)
4637 return op_symbol_code (TREE_CODE (op
), flags
);
4640 /* Prints the name of a call. NODE is the CALL_EXPR_FN of a CALL_EXPR or
4641 the gimple_call_fn of a GIMPLE_CALL. */
4644 print_call_name (pretty_printer
*pp
, tree node
, dump_flags_t flags
)
4649 if (TREE_CODE (op0
) == NON_LVALUE_EXPR
)
4650 op0
= TREE_OPERAND (op0
, 0);
4653 switch (TREE_CODE (op0
))
4658 dump_function_name (pp
, op0
, flags
);
4664 op0
= TREE_OPERAND (op0
, 0);
4669 dump_generic_node (pp
, TREE_OPERAND (op0
, 0), 0, flags
, false);
4670 pp_string (pp
, ") ? ");
4671 dump_generic_node (pp
, TREE_OPERAND (op0
, 1), 0, flags
, false);
4672 pp_string (pp
, " : ");
4673 dump_generic_node (pp
, TREE_OPERAND (op0
, 2), 0, flags
, false);
4677 if (VAR_P (TREE_OPERAND (op0
, 0)))
4678 dump_function_name (pp
, TREE_OPERAND (op0
, 0), flags
);
4680 dump_generic_node (pp
, op0
, 0, flags
, false);
4684 if (integer_zerop (TREE_OPERAND (op0
, 1)))
4686 op0
= TREE_OPERAND (op0
, 0);
4693 dump_generic_node (pp
, op0
, 0, flags
, false);
4701 /* Print the first N characters in the array STR, replacing non-printable
4702 characters (including embedded nuls) with unambiguous escape sequences. */
4705 pretty_print_string (pretty_printer
*pp
, const char *str
, size_t n
)
4710 for ( ; n
; --n
, ++str
)
4715 pp_string (pp
, "\\b");
4719 pp_string (pp
, "\\f");
4723 pp_string (pp
, "\\n");
4727 pp_string (pp
, "\\r");
4731 pp_string (pp
, "\\t");
4735 pp_string (pp
, "\\v");
4739 pp_string (pp
, "\\\\");
4743 pp_string (pp
, "\\\"");
4747 pp_string (pp
, "\\'");
4751 if (str
[0] || n
> 1)
4753 if (!ISPRINT (str
[0]))
4756 sprintf (buf
, "\\x%02x", (unsigned char)str
[0]);
4757 pp_string (pp
, buf
);
4760 pp_character (pp
, str
[0]);
4768 maybe_init_pretty_print (FILE *file
)
4772 tree_pp
= new pretty_printer ();
4773 pp_needs_newline (tree_pp
) = true;
4774 pp_translate_identifiers (tree_pp
) = false;
4777 tree_pp
->buffer
->stream
= file
;
4781 newline_and_indent (pretty_printer
*pp
, int spc
)
4787 /* Print the identifier ID to PRETTY-PRINTER. */
4790 pp_tree_identifier (pretty_printer
*pp
, tree id
)
4792 if (pp_translate_identifiers (pp
))
4794 const char *text
= identifier_to_locale (IDENTIFIER_POINTER (id
));
4795 pp_append_text (pp
, text
, text
+ strlen (text
));
4798 pp_append_text (pp
, IDENTIFIER_POINTER (id
),
4799 IDENTIFIER_POINTER (id
) + IDENTIFIER_LENGTH (id
));
4802 /* A helper function that is used to dump function information before the
4806 dump_function_header (FILE *dump_file
, tree fdecl
, dump_flags_t flags
)
4808 const char *dname
, *aname
;
4809 struct cgraph_node
*node
= cgraph_node::get (fdecl
);
4810 struct function
*fun
= DECL_STRUCT_FUNCTION (fdecl
);
4812 dname
= lang_hooks
.decl_printable_name (fdecl
, 1);
4814 if (DECL_ASSEMBLER_NAME_SET_P (fdecl
))
4815 aname
= (IDENTIFIER_POINTER
4816 (DECL_ASSEMBLER_NAME (fdecl
)));
4818 aname
= "<unset-asm-name>";
4820 fprintf (dump_file
, "\n;; Function %s (%s, funcdef_no=%d",
4821 dname
, aname
, fun
->funcdef_no
);
4822 if (!(flags
& TDF_NOUID
))
4823 fprintf (dump_file
, ", decl_uid=%d", DECL_UID (fdecl
));
4826 fprintf (dump_file
, ", cgraph_uid=%d", node
->get_uid ());
4827 fprintf (dump_file
, ", symbol_order=%d)%s\n\n", node
->order
,
4828 node
->frequency
== NODE_FREQUENCY_HOT
4830 : node
->frequency
== NODE_FREQUENCY_UNLIKELY_EXECUTED
4831 ? " (unlikely executed)"
4832 : node
->frequency
== NODE_FREQUENCY_EXECUTED_ONCE
4833 ? " (executed once)"
4837 fprintf (dump_file
, ")\n\n");
4840 /* Dump double_int D to pretty_printer PP. UNS is true
4841 if D is unsigned and false otherwise. */
4843 pp_double_int (pretty_printer
*pp
, double_int d
, bool uns
)
4846 pp_wide_integer (pp
, d
.low
);
4847 else if (d
.fits_uhwi ())
4848 pp_unsigned_wide_integer (pp
, d
.low
);
4851 unsigned HOST_WIDE_INT low
= d
.low
;
4852 HOST_WIDE_INT high
= d
.high
;
4853 if (!uns
&& d
.is_negative ())
4856 high
= ~high
+ !low
;
4859 /* Would "%x%0*x" or "%x%*0x" get zero-padding on all
4861 sprintf (pp_buffer (pp
)->digit_buffer
,
4862 HOST_WIDE_INT_PRINT_DOUBLE_HEX
,
4863 (unsigned HOST_WIDE_INT
) high
, low
);
4864 pp_string (pp
, pp_buffer (pp
)->digit_buffer
);
4869 # pragma GCC diagnostic pop