1 /* Pretty formatting of GENERIC trees in C syntax.
2 Copyright (C) 2001-2021 Free Software Foundation, Inc.
3 Adapted from c-pretty-print.c by Diego Novillo <dnovillo@redhat.com>
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 3, or (at your option) any later
12 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING3. If not see
19 <http://www.gnu.org/licenses/>. */
23 #include "coretypes.h"
29 #include "tree-pretty-print.h"
30 #include "stor-layout.h"
31 #include "langhooks.h"
32 #include "tree-iterator.h"
34 #include "internal-fn.h"
35 #include "gomp-constants.h"
37 #include "fold-const.h"
39 /* Routines in this file get invoked via the default tree printer
40 used by diagnostics and thus they are called from pp_printf which
41 isn't reentrant. Avoid using pp_printf in this file. */
42 #pragma GCC poison pp_printf
44 /* Disable warnings about quoting issues in the pp_xxx calls below
45 that (intentionally) don't follow GCC diagnostic conventions. */
47 # pragma GCC diagnostic push
48 # pragma GCC diagnostic ignored "-Wformat-diag"
51 /* Local functions, macros and variables. */
52 static const char *op_symbol (const_tree
);
53 static void newline_and_indent (pretty_printer
*, int);
54 static void maybe_init_pretty_print (FILE *);
55 static void print_struct_decl (pretty_printer
*, const_tree
, int, dump_flags_t
);
56 static void do_niy (pretty_printer
*, const_tree
, dump_flags_t
);
58 #define INDENT(SPACE) do { \
59 int i; for (i = 0; i<SPACE; i++) pp_space (pp); } while (0)
61 #define NIY do_niy (pp, node, flags)
63 static pretty_printer
*tree_pp
;
65 /* Try to print something for an unknown tree code. */
68 do_niy (pretty_printer
*pp
, const_tree node
, dump_flags_t flags
)
72 pp_string (pp
, "<<< Unknown tree: ");
73 pp_string (pp
, get_tree_code_name (TREE_CODE (node
)));
77 len
= TREE_OPERAND_LENGTH (node
);
78 for (i
= 0; i
< len
; ++i
)
80 newline_and_indent (pp
, 2);
81 dump_generic_node (pp
, TREE_OPERAND (node
, i
), 2, flags
, false);
85 pp_string (pp
, " >>>");
88 /* Debugging function to print out a generic expression. */
91 debug_generic_expr (tree t
)
93 print_generic_expr (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
);
94 fprintf (stderr
, "\n");
97 /* Debugging function to print out a generic statement. */
100 debug_generic_stmt (tree t
)
102 print_generic_stmt (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
);
103 fprintf (stderr
, "\n");
106 /* Debugging function to print out a chain of trees . */
109 debug_tree_chain (tree t
)
115 print_generic_expr (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
|TDF_UID
);
116 fprintf (stderr
, " ");
120 fprintf (stderr
, "... [cycled back to ");
121 print_generic_expr (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
|TDF_UID
);
122 fprintf (stderr
, "]");
126 fprintf (stderr
, "\n");
129 /* Prints declaration DECL to the FILE with details specified by FLAGS. */
131 print_generic_decl (FILE *file
, tree decl
, dump_flags_t flags
)
133 maybe_init_pretty_print (file
);
134 print_declaration (tree_pp
, decl
, 2, flags
);
135 pp_write_text_to_stream (tree_pp
);
138 /* Print tree T, and its successors, on file FILE. FLAGS specifies details
139 to show in the dump. See TDF_* in dumpfile.h. */
142 print_generic_stmt (FILE *file
, tree t
, dump_flags_t flags
)
144 maybe_init_pretty_print (file
);
145 dump_generic_node (tree_pp
, t
, 0, flags
, true);
146 pp_newline_and_flush (tree_pp
);
149 /* Print tree T, and its successors, on file FILE. FLAGS specifies details
150 to show in the dump. See TDF_* in dumpfile.h. The output is indented by
154 print_generic_stmt_indented (FILE *file
, tree t
, dump_flags_t flags
, int indent
)
158 maybe_init_pretty_print (file
);
160 for (i
= 0; i
< indent
; i
++)
162 dump_generic_node (tree_pp
, t
, indent
, flags
, true);
163 pp_newline_and_flush (tree_pp
);
166 /* Print a single expression T on file FILE. FLAGS specifies details to show
167 in the dump. See TDF_* in dumpfile.h. */
170 print_generic_expr (FILE *file
, tree t
, dump_flags_t flags
)
172 maybe_init_pretty_print (file
);
173 dump_generic_node (tree_pp
, t
, 0, flags
, false);
177 /* Print a single expression T to string, and return it. The caller
178 must free the returned memory. */
181 print_generic_expr_to_str (tree t
)
184 dump_generic_node (&pp
, t
, 0, TDF_VOPS
|TDF_MEMSYMS
, false);
185 return xstrdup (pp_formatted_text (&pp
));
188 /* Dump NAME, an IDENTIFIER_POINTER, sanitized so that D<num> sequences
189 in it are replaced with Dxxxx, as long as they are at the start or
190 preceded by $ and at the end or followed by $. See make_fancy_name
194 dump_fancy_name (pretty_printer
*pp
, tree name
)
197 int length
= IDENTIFIER_LENGTH (name
);
198 const char *n
= IDENTIFIER_POINTER (name
);
205 && (n
== IDENTIFIER_POINTER (name
) || n
[-1] == '$'))
208 while (ISDIGIT (n
[l
]))
210 if (n
[l
] == '\0' || n
[l
] == '$')
223 pp_tree_identifier (pp
, name
);
227 char *str
= XNEWVEC (char, length
+ 1);
230 q
= n
= IDENTIFIER_POINTER (name
);
237 && (q
== IDENTIFIER_POINTER (name
) || q
[-1] == '$'))
240 while (ISDIGIT (q
[l
]))
242 if (q
[l
] == '\0' || q
[l
] == '$')
244 memcpy (p
, n
, q
- n
);
245 memcpy (p
+ (q
- n
), "Dxxxx", 5);
255 memcpy (p
, n
, IDENTIFIER_LENGTH (name
) - (n
- IDENTIFIER_POINTER (name
)));
257 if (pp_translate_identifiers (pp
))
259 const char *text
= identifier_to_locale (str
);
260 pp_append_text (pp
, text
, text
+ strlen (text
));
263 pp_append_text (pp
, str
, str
+ length
);
267 /* Dump the name of a _DECL node and its DECL_UID if TDF_UID is set
271 dump_decl_name (pretty_printer
*pp
, tree node
, dump_flags_t flags
)
273 tree name
= DECL_NAME (node
);
276 if ((flags
& TDF_ASMNAME
)
277 && HAS_DECL_ASSEMBLER_NAME_P (node
)
278 && DECL_ASSEMBLER_NAME_SET_P (node
))
279 pp_tree_identifier (pp
, DECL_ASSEMBLER_NAME_RAW (node
));
280 /* For -fcompare-debug don't dump DECL_NAMELESS names at all,
281 -g might have created more fancy names and their indexes
282 could get out of sync. Usually those should be DECL_IGNORED_P
283 too, SRA can create even non-DECL_IGNORED_P DECL_NAMELESS fancy
284 names, let's hope those never get out of sync after doing the
285 dump_fancy_name sanitization. */
286 else if ((flags
& TDF_COMPARE_DEBUG
)
287 && DECL_NAMELESS (node
)
288 && DECL_IGNORED_P (node
))
290 /* For DECL_NAMELESS names look for embedded uids in the
291 names and sanitize them for TDF_NOUID. */
292 else if ((flags
& TDF_NOUID
) && DECL_NAMELESS (node
))
293 dump_fancy_name (pp
, name
);
295 pp_tree_identifier (pp
, name
);
297 char uid_sep
= (flags
& TDF_GIMPLE
) ? '_' : '.';
298 if ((flags
& TDF_UID
) || name
== NULL_TREE
)
300 if (TREE_CODE (node
) == LABEL_DECL
&& LABEL_DECL_UID (node
) != -1)
302 pp_character (pp
, 'L');
303 pp_character (pp
, uid_sep
);
304 pp_decimal_int (pp
, (int) LABEL_DECL_UID (node
));
306 else if (TREE_CODE (node
) == DEBUG_EXPR_DECL
)
308 if (flags
& TDF_NOUID
)
309 pp_string (pp
, "D#xxxx");
312 pp_string (pp
, "D#");
313 pp_decimal_int (pp
, (int) DEBUG_TEMP_UID (node
));
318 char c
= TREE_CODE (node
) == CONST_DECL
? 'C' : 'D';
319 pp_character (pp
, c
);
320 pp_character (pp
, uid_sep
);
321 if (flags
& TDF_NOUID
)
322 pp_string (pp
, "xxxx");
324 pp_scalar (pp
, "%u", DECL_UID (node
));
327 if ((flags
& TDF_ALIAS
) && DECL_PT_UID (node
) != DECL_UID (node
))
329 if (flags
& TDF_NOUID
)
330 pp_string (pp
, "ptD.xxxx");
333 pp_string (pp
, "ptD.");
334 pp_scalar (pp
, "%u", DECL_PT_UID (node
));
339 /* Like the above, but used for pretty printing function calls. */
342 dump_function_name (pretty_printer
*pp
, tree node
, dump_flags_t flags
)
344 if (CONVERT_EXPR_P (node
))
345 node
= TREE_OPERAND (node
, 0);
346 if (DECL_NAME (node
) && (flags
& TDF_ASMNAME
) == 0)
347 pp_string (pp
, lang_hooks
.decl_printable_name (node
, 1));
349 dump_decl_name (pp
, node
, flags
);
352 /* Dump a function declaration. NODE is the FUNCTION_TYPE. PP, SPC and
353 FLAGS are as in dump_generic_node. */
356 dump_function_declaration (pretty_printer
*pp
, tree node
,
357 int spc
, dump_flags_t flags
)
359 bool wrote_arg
= false;
365 /* Print the argument types. */
366 arg
= TYPE_ARG_TYPES (node
);
367 while (arg
&& arg
!= void_list_node
&& arg
!= error_mark_node
)
375 dump_generic_node (pp
, TREE_VALUE (arg
), spc
, flags
, false);
376 arg
= TREE_CHAIN (arg
);
379 /* Drop the trailing void_type_node if we had any previous argument. */
380 if (arg
== void_list_node
&& !wrote_arg
)
381 pp_string (pp
, "void");
382 /* Properly dump vararg function types. */
383 else if (!arg
&& wrote_arg
)
384 pp_string (pp
, ", ...");
385 /* Avoid printing any arg for unprototyped functions. */
390 /* Dump the domain associated with an array. */
393 dump_array_domain (pretty_printer
*pp
, tree domain
, int spc
, dump_flags_t flags
)
395 pp_left_bracket (pp
);
398 tree min
= TYPE_MIN_VALUE (domain
);
399 tree max
= TYPE_MAX_VALUE (domain
);
402 && integer_zerop (min
)
403 && tree_fits_shwi_p (max
))
404 pp_wide_integer (pp
, tree_to_shwi (max
) + 1);
408 dump_generic_node (pp
, min
, spc
, flags
, false);
411 dump_generic_node (pp
, max
, spc
, flags
, false);
415 pp_string (pp
, "<unknown>");
416 pp_right_bracket (pp
);
420 /* Dump OpenMP iterators ITER. */
423 dump_omp_iterators (pretty_printer
*pp
, tree iter
, int spc
, dump_flags_t flags
)
425 pp_string (pp
, "iterator(");
426 for (tree it
= iter
; it
; it
= TREE_CHAIN (it
))
429 pp_string (pp
, ", ");
430 dump_generic_node (pp
, TREE_TYPE (TREE_VEC_ELT (it
, 0)), spc
, flags
,
433 dump_generic_node (pp
, TREE_VEC_ELT (it
, 0), spc
, flags
, false);
435 dump_generic_node (pp
, TREE_VEC_ELT (it
, 1), spc
, flags
, false);
437 dump_generic_node (pp
, TREE_VEC_ELT (it
, 2), spc
, flags
, false);
439 dump_generic_node (pp
, TREE_VEC_ELT (it
, 3), spc
, flags
, false);
445 /* Dump OMP clause CLAUSE, without following OMP_CLAUSE_CHAIN.
447 PP, CLAUSE, SPC and FLAGS are as in dump_generic_node. */
450 dump_omp_clause (pretty_printer
*pp
, tree clause
, int spc
, dump_flags_t flags
)
453 const char *modifier
= NULL
;
454 switch (OMP_CLAUSE_CODE (clause
))
456 case OMP_CLAUSE_PRIVATE
:
459 case OMP_CLAUSE_SHARED
:
462 case OMP_CLAUSE_FIRSTPRIVATE
:
463 name
= "firstprivate";
465 case OMP_CLAUSE_LASTPRIVATE
:
466 name
= "lastprivate";
467 if (OMP_CLAUSE_LASTPRIVATE_CONDITIONAL (clause
))
468 modifier
= "conditional:";
470 case OMP_CLAUSE_COPYIN
:
473 case OMP_CLAUSE_COPYPRIVATE
:
474 name
= "copyprivate";
476 case OMP_CLAUSE_UNIFORM
:
479 case OMP_CLAUSE_USE_DEVICE_PTR
:
480 name
= "use_device_ptr";
481 if (OMP_CLAUSE_USE_DEVICE_PTR_IF_PRESENT (clause
))
482 modifier
= "if_present:";
484 case OMP_CLAUSE_USE_DEVICE_ADDR
:
485 name
= "use_device_addr";
487 case OMP_CLAUSE_IS_DEVICE_PTR
:
488 name
= "is_device_ptr";
490 case OMP_CLAUSE_INCLUSIVE
:
493 case OMP_CLAUSE_EXCLUSIVE
:
496 case OMP_CLAUSE__LOOPTEMP_
:
499 case OMP_CLAUSE__REDUCTEMP_
:
500 name
= "_reductemp_";
502 case OMP_CLAUSE__CONDTEMP_
:
505 case OMP_CLAUSE__SCANTEMP_
:
508 case OMP_CLAUSE_TO_DECLARE
:
511 case OMP_CLAUSE_LINK
:
514 case OMP_CLAUSE_NONTEMPORAL
:
515 name
= "nontemporal";
518 pp_string (pp
, name
);
521 pp_string (pp
, modifier
);
522 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
527 case OMP_CLAUSE_TASK_REDUCTION
:
528 case OMP_CLAUSE_IN_REDUCTION
:
529 pp_string (pp
, OMP_CLAUSE_CODE (clause
) == OMP_CLAUSE_IN_REDUCTION
532 case OMP_CLAUSE_REDUCTION
:
533 pp_string (pp
, "reduction(");
534 if (OMP_CLAUSE_CODE (clause
) == OMP_CLAUSE_REDUCTION
)
536 if (OMP_CLAUSE_REDUCTION_TASK (clause
))
537 pp_string (pp
, "task,");
538 else if (OMP_CLAUSE_REDUCTION_INSCAN (clause
))
539 pp_string (pp
, "inscan,");
541 if (OMP_CLAUSE_REDUCTION_CODE (clause
) != ERROR_MARK
)
544 op_symbol_code (OMP_CLAUSE_REDUCTION_CODE (clause
)));
547 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
553 pp_string (pp
, "if(");
554 switch (OMP_CLAUSE_IF_MODIFIER (clause
))
556 case ERROR_MARK
: break;
557 case VOID_CST
: pp_string (pp
, "cancel:"); break;
558 case OMP_PARALLEL
: pp_string (pp
, "parallel:"); break;
559 case OMP_SIMD
: pp_string (pp
, "simd:"); break;
560 case OMP_TASK
: pp_string (pp
, "task:"); break;
561 case OMP_TASKLOOP
: pp_string (pp
, "taskloop:"); break;
562 case OMP_TARGET_DATA
: pp_string (pp
, "target data:"); break;
563 case OMP_TARGET
: pp_string (pp
, "target:"); break;
564 case OMP_TARGET_UPDATE
: pp_string (pp
, "target update:"); break;
565 case OMP_TARGET_ENTER_DATA
:
566 pp_string (pp
, "target enter data:"); break;
567 case OMP_TARGET_EXIT_DATA
: pp_string (pp
, "target exit data:"); break;
568 default: gcc_unreachable ();
570 dump_generic_node (pp
, OMP_CLAUSE_IF_EXPR (clause
),
575 case OMP_CLAUSE_NUM_THREADS
:
576 pp_string (pp
, "num_threads(");
577 dump_generic_node (pp
, OMP_CLAUSE_NUM_THREADS_EXPR (clause
),
582 case OMP_CLAUSE_NOWAIT
:
583 pp_string (pp
, "nowait");
585 case OMP_CLAUSE_ORDERED
:
586 pp_string (pp
, "ordered");
587 if (OMP_CLAUSE_ORDERED_EXPR (clause
))
590 dump_generic_node (pp
, OMP_CLAUSE_ORDERED_EXPR (clause
),
596 case OMP_CLAUSE_DEFAULT
:
597 pp_string (pp
, "default(");
598 switch (OMP_CLAUSE_DEFAULT_KIND (clause
))
600 case OMP_CLAUSE_DEFAULT_UNSPECIFIED
:
602 case OMP_CLAUSE_DEFAULT_SHARED
:
603 pp_string (pp
, "shared");
605 case OMP_CLAUSE_DEFAULT_NONE
:
606 pp_string (pp
, "none");
608 case OMP_CLAUSE_DEFAULT_PRIVATE
:
609 pp_string (pp
, "private");
611 case OMP_CLAUSE_DEFAULT_FIRSTPRIVATE
:
612 pp_string (pp
, "firstprivate");
614 case OMP_CLAUSE_DEFAULT_PRESENT
:
615 pp_string (pp
, "present");
623 case OMP_CLAUSE_SCHEDULE
:
624 pp_string (pp
, "schedule(");
625 if (OMP_CLAUSE_SCHEDULE_KIND (clause
)
626 & (OMP_CLAUSE_SCHEDULE_MONOTONIC
627 | OMP_CLAUSE_SCHEDULE_NONMONOTONIC
))
629 if (OMP_CLAUSE_SCHEDULE_KIND (clause
)
630 & OMP_CLAUSE_SCHEDULE_MONOTONIC
)
631 pp_string (pp
, "monotonic");
633 pp_string (pp
, "nonmonotonic");
634 if (OMP_CLAUSE_SCHEDULE_SIMD (clause
))
639 if (OMP_CLAUSE_SCHEDULE_SIMD (clause
))
640 pp_string (pp
, "simd:");
642 switch (OMP_CLAUSE_SCHEDULE_KIND (clause
) & OMP_CLAUSE_SCHEDULE_MASK
)
644 case OMP_CLAUSE_SCHEDULE_STATIC
:
645 pp_string (pp
, "static");
647 case OMP_CLAUSE_SCHEDULE_DYNAMIC
:
648 pp_string (pp
, "dynamic");
650 case OMP_CLAUSE_SCHEDULE_GUIDED
:
651 pp_string (pp
, "guided");
653 case OMP_CLAUSE_SCHEDULE_RUNTIME
:
654 pp_string (pp
, "runtime");
656 case OMP_CLAUSE_SCHEDULE_AUTO
:
657 pp_string (pp
, "auto");
662 if (OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (clause
))
665 dump_generic_node (pp
, OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (clause
),
671 case OMP_CLAUSE_UNTIED
:
672 pp_string (pp
, "untied");
675 case OMP_CLAUSE_COLLAPSE
:
676 pp_string (pp
, "collapse(");
677 dump_generic_node (pp
, OMP_CLAUSE_COLLAPSE_EXPR (clause
),
682 case OMP_CLAUSE_FINAL
:
683 pp_string (pp
, "final(");
684 dump_generic_node (pp
, OMP_CLAUSE_FINAL_EXPR (clause
),
689 case OMP_CLAUSE_MERGEABLE
:
690 pp_string (pp
, "mergeable");
693 case OMP_CLAUSE_LINEAR
:
694 pp_string (pp
, "linear(");
695 switch (OMP_CLAUSE_LINEAR_KIND (clause
))
697 case OMP_CLAUSE_LINEAR_DEFAULT
:
699 case OMP_CLAUSE_LINEAR_REF
:
700 pp_string (pp
, "ref(");
702 case OMP_CLAUSE_LINEAR_VAL
:
703 pp_string (pp
, "val(");
705 case OMP_CLAUSE_LINEAR_UVAL
:
706 pp_string (pp
, "uval(");
711 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
713 if (OMP_CLAUSE_LINEAR_KIND (clause
) != OMP_CLAUSE_LINEAR_DEFAULT
)
716 dump_generic_node (pp
, OMP_CLAUSE_LINEAR_STEP (clause
),
721 case OMP_CLAUSE_ALIGNED
:
722 pp_string (pp
, "aligned(");
723 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
725 if (OMP_CLAUSE_ALIGNED_ALIGNMENT (clause
))
728 dump_generic_node (pp
, OMP_CLAUSE_ALIGNED_ALIGNMENT (clause
),
734 case OMP_CLAUSE_ALLOCATE
:
735 pp_string (pp
, "allocate(");
736 if (OMP_CLAUSE_ALLOCATE_ALLOCATOR (clause
))
738 dump_generic_node (pp
, OMP_CLAUSE_ALLOCATE_ALLOCATOR (clause
),
742 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
747 case OMP_CLAUSE_AFFINITY
:
748 pp_string (pp
, "affinity(");
750 tree t
= OMP_CLAUSE_DECL (clause
);
751 if (TREE_CODE (t
) == TREE_LIST
753 && TREE_CODE (TREE_PURPOSE (t
)) == TREE_VEC
)
755 dump_omp_iterators (pp
, TREE_PURPOSE (t
), spc
, flags
);
759 dump_generic_node (pp
, t
, spc
, flags
, false);
763 case OMP_CLAUSE_DEPEND
:
764 pp_string (pp
, "depend(");
765 switch (OMP_CLAUSE_DEPEND_KIND (clause
))
767 case OMP_CLAUSE_DEPEND_DEPOBJ
:
770 case OMP_CLAUSE_DEPEND_IN
:
773 case OMP_CLAUSE_DEPEND_OUT
:
776 case OMP_CLAUSE_DEPEND_INOUT
:
779 case OMP_CLAUSE_DEPEND_MUTEXINOUTSET
:
780 name
= "mutexinoutset";
782 case OMP_CLAUSE_DEPEND_SOURCE
:
783 pp_string (pp
, "source)");
785 case OMP_CLAUSE_DEPEND_LAST
:
786 name
= "__internal__";
788 case OMP_CLAUSE_DEPEND_SINK
:
789 pp_string (pp
, "sink:");
790 for (tree t
= OMP_CLAUSE_DECL (clause
); t
; t
= TREE_CHAIN (t
))
791 if (TREE_CODE (t
) == TREE_LIST
)
793 dump_generic_node (pp
, TREE_VALUE (t
), spc
, flags
, false);
794 if (TREE_PURPOSE (t
) != integer_zero_node
)
796 if (OMP_CLAUSE_DEPEND_SINK_NEGATIVE (t
))
800 dump_generic_node (pp
, TREE_PURPOSE (t
), spc
, flags
,
814 tree t
= OMP_CLAUSE_DECL (clause
);
815 if (TREE_CODE (t
) == TREE_LIST
817 && TREE_CODE (TREE_PURPOSE (t
)) == TREE_VEC
)
819 dump_omp_iterators (pp
, TREE_PURPOSE (t
), spc
, flags
);
825 pp_string (pp
, name
);
828 dump_generic_node (pp
, t
, spc
, flags
, false);
834 pp_string (pp
, "map(");
835 switch (OMP_CLAUSE_MAP_KIND (clause
))
838 case GOMP_MAP_POINTER
:
839 pp_string (pp
, "alloc");
841 case GOMP_MAP_IF_PRESENT
:
842 pp_string (pp
, "no_alloc");
845 case GOMP_MAP_TO_PSET
:
846 pp_string (pp
, "to");
849 pp_string (pp
, "from");
851 case GOMP_MAP_TOFROM
:
852 pp_string (pp
, "tofrom");
854 case GOMP_MAP_FORCE_ALLOC
:
855 pp_string (pp
, "force_alloc");
857 case GOMP_MAP_FORCE_TO
:
858 pp_string (pp
, "force_to");
860 case GOMP_MAP_FORCE_FROM
:
861 pp_string (pp
, "force_from");
863 case GOMP_MAP_FORCE_TOFROM
:
864 pp_string (pp
, "force_tofrom");
866 case GOMP_MAP_FORCE_PRESENT
:
867 pp_string (pp
, "force_present");
869 case GOMP_MAP_DELETE
:
870 pp_string (pp
, "delete");
872 case GOMP_MAP_FORCE_DEVICEPTR
:
873 pp_string (pp
, "force_deviceptr");
875 case GOMP_MAP_ALWAYS_TO
:
876 pp_string (pp
, "always,to");
878 case GOMP_MAP_ALWAYS_FROM
:
879 pp_string (pp
, "always,from");
881 case GOMP_MAP_ALWAYS_TOFROM
:
882 pp_string (pp
, "always,tofrom");
884 case GOMP_MAP_RELEASE
:
885 pp_string (pp
, "release");
887 case GOMP_MAP_FIRSTPRIVATE_POINTER
:
888 pp_string (pp
, "firstprivate");
890 case GOMP_MAP_FIRSTPRIVATE_REFERENCE
:
891 pp_string (pp
, "firstprivate ref");
893 case GOMP_MAP_STRUCT
:
894 pp_string (pp
, "struct");
896 case GOMP_MAP_ALWAYS_POINTER
:
897 pp_string (pp
, "always_pointer");
899 case GOMP_MAP_DEVICE_RESIDENT
:
900 pp_string (pp
, "device_resident");
903 pp_string (pp
, "link");
905 case GOMP_MAP_ATTACH
:
906 pp_string (pp
, "attach");
908 case GOMP_MAP_DETACH
:
909 pp_string (pp
, "detach");
911 case GOMP_MAP_FORCE_DETACH
:
912 pp_string (pp
, "force_detach");
914 case GOMP_MAP_ATTACH_DETACH
:
915 pp_string (pp
, "attach_detach");
921 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
924 if (OMP_CLAUSE_SIZE (clause
))
926 switch (OMP_CLAUSE_CODE (clause
) == OMP_CLAUSE_MAP
927 ? OMP_CLAUSE_MAP_KIND (clause
) : GOMP_MAP_TO
)
929 case GOMP_MAP_POINTER
:
930 case GOMP_MAP_FIRSTPRIVATE_POINTER
:
931 case GOMP_MAP_FIRSTPRIVATE_REFERENCE
:
932 case GOMP_MAP_ALWAYS_POINTER
:
933 pp_string (pp
, " [pointer assign, bias: ");
935 case GOMP_MAP_TO_PSET
:
936 pp_string (pp
, " [pointer set, len: ");
938 case GOMP_MAP_ATTACH
:
939 case GOMP_MAP_DETACH
:
940 case GOMP_MAP_FORCE_DETACH
:
941 case GOMP_MAP_ATTACH_DETACH
:
942 pp_string (pp
, " [bias: ");
945 pp_string (pp
, " [len: ");
948 dump_generic_node (pp
, OMP_CLAUSE_SIZE (clause
),
950 pp_right_bracket (pp
);
955 case OMP_CLAUSE_FROM
:
956 pp_string (pp
, "from(");
957 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
959 goto print_clause_size
;
962 pp_string (pp
, "to(");
963 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
965 goto print_clause_size
;
967 case OMP_CLAUSE__CACHE_
:
969 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
971 goto print_clause_size
;
973 case OMP_CLAUSE_NUM_TEAMS
:
974 pp_string (pp
, "num_teams(");
975 dump_generic_node (pp
, OMP_CLAUSE_NUM_TEAMS_EXPR (clause
),
980 case OMP_CLAUSE_THREAD_LIMIT
:
981 pp_string (pp
, "thread_limit(");
982 dump_generic_node (pp
, OMP_CLAUSE_THREAD_LIMIT_EXPR (clause
),
987 case OMP_CLAUSE_DEVICE
:
988 pp_string (pp
, "device(");
989 dump_generic_node (pp
, OMP_CLAUSE_DEVICE_ID (clause
),
994 case OMP_CLAUSE_DIST_SCHEDULE
:
995 pp_string (pp
, "dist_schedule(static");
996 if (OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR (clause
))
999 dump_generic_node (pp
,
1000 OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR (clause
),
1003 pp_right_paren (pp
);
1006 case OMP_CLAUSE_PROC_BIND
:
1007 pp_string (pp
, "proc_bind(");
1008 switch (OMP_CLAUSE_PROC_BIND_KIND (clause
))
1010 case OMP_CLAUSE_PROC_BIND_MASTER
:
1011 /* Same enum value: case OMP_CLAUSE_PROC_BIND_PRIMARY: */
1012 /* TODO: Change to 'primary' for OpenMP 5.1. */
1013 pp_string (pp
, "master");
1015 case OMP_CLAUSE_PROC_BIND_CLOSE
:
1016 pp_string (pp
, "close");
1018 case OMP_CLAUSE_PROC_BIND_SPREAD
:
1019 pp_string (pp
, "spread");
1024 pp_right_paren (pp
);
1027 case OMP_CLAUSE_DEVICE_TYPE
:
1028 pp_string (pp
, "device_type(");
1029 switch (OMP_CLAUSE_DEVICE_TYPE_KIND (clause
))
1031 case OMP_CLAUSE_DEVICE_TYPE_HOST
:
1032 pp_string (pp
, "host");
1034 case OMP_CLAUSE_DEVICE_TYPE_NOHOST
:
1035 pp_string (pp
, "nohost");
1037 case OMP_CLAUSE_DEVICE_TYPE_ANY
:
1038 pp_string (pp
, "any");
1043 pp_right_paren (pp
);
1046 case OMP_CLAUSE_SAFELEN
:
1047 pp_string (pp
, "safelen(");
1048 dump_generic_node (pp
, OMP_CLAUSE_SAFELEN_EXPR (clause
),
1050 pp_right_paren (pp
);
1053 case OMP_CLAUSE_SIMDLEN
:
1054 pp_string (pp
, "simdlen(");
1055 dump_generic_node (pp
, OMP_CLAUSE_SIMDLEN_EXPR (clause
),
1057 pp_right_paren (pp
);
1060 case OMP_CLAUSE_PRIORITY
:
1061 pp_string (pp
, "priority(");
1062 dump_generic_node (pp
, OMP_CLAUSE_PRIORITY_EXPR (clause
),
1064 pp_right_paren (pp
);
1067 case OMP_CLAUSE_GRAINSIZE
:
1068 pp_string (pp
, "grainsize(");
1069 if (OMP_CLAUSE_GRAINSIZE_STRICT (clause
))
1070 pp_string (pp
, "strict:");
1071 dump_generic_node (pp
, OMP_CLAUSE_GRAINSIZE_EXPR (clause
),
1073 pp_right_paren (pp
);
1076 case OMP_CLAUSE_NUM_TASKS
:
1077 pp_string (pp
, "num_tasks(");
1078 if (OMP_CLAUSE_NUM_TASKS_STRICT (clause
))
1079 pp_string (pp
, "strict:");
1080 dump_generic_node (pp
, OMP_CLAUSE_NUM_TASKS_EXPR (clause
),
1082 pp_right_paren (pp
);
1085 case OMP_CLAUSE_HINT
:
1086 pp_string (pp
, "hint(");
1087 dump_generic_node (pp
, OMP_CLAUSE_HINT_EXPR (clause
),
1089 pp_right_paren (pp
);
1092 case OMP_CLAUSE_FILTER
:
1093 pp_string (pp
, "filter(");
1094 dump_generic_node (pp
, OMP_CLAUSE_FILTER_EXPR (clause
),
1096 pp_right_paren (pp
);
1099 case OMP_CLAUSE_DEFAULTMAP
:
1100 pp_string (pp
, "defaultmap(");
1101 switch (OMP_CLAUSE_DEFAULTMAP_BEHAVIOR (clause
))
1103 case OMP_CLAUSE_DEFAULTMAP_ALLOC
:
1104 pp_string (pp
, "alloc");
1106 case OMP_CLAUSE_DEFAULTMAP_TO
:
1107 pp_string (pp
, "to");
1109 case OMP_CLAUSE_DEFAULTMAP_FROM
:
1110 pp_string (pp
, "from");
1112 case OMP_CLAUSE_DEFAULTMAP_TOFROM
:
1113 pp_string (pp
, "tofrom");
1115 case OMP_CLAUSE_DEFAULTMAP_FIRSTPRIVATE
:
1116 pp_string (pp
, "firstprivate");
1118 case OMP_CLAUSE_DEFAULTMAP_NONE
:
1119 pp_string (pp
, "none");
1121 case OMP_CLAUSE_DEFAULTMAP_DEFAULT
:
1122 pp_string (pp
, "default");
1127 switch (OMP_CLAUSE_DEFAULTMAP_CATEGORY (clause
))
1129 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_UNSPECIFIED
:
1131 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_SCALAR
:
1132 pp_string (pp
, ":scalar");
1134 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_AGGREGATE
:
1135 pp_string (pp
, ":aggregate");
1137 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_ALLOCATABLE
:
1138 pp_string (pp
, ":allocatable");
1140 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_POINTER
:
1141 pp_string (pp
, ":pointer");
1146 pp_right_paren (pp
);
1149 case OMP_CLAUSE_ORDER
:
1150 pp_string (pp
, "order(concurrent)");
1153 case OMP_CLAUSE_BIND
:
1154 pp_string (pp
, "bind(");
1155 switch (OMP_CLAUSE_BIND_KIND (clause
))
1157 case OMP_CLAUSE_BIND_TEAMS
:
1158 pp_string (pp
, "teams");
1160 case OMP_CLAUSE_BIND_PARALLEL
:
1161 pp_string (pp
, "parallel");
1163 case OMP_CLAUSE_BIND_THREAD
:
1164 pp_string (pp
, "thread");
1169 pp_right_paren (pp
);
1172 case OMP_CLAUSE__SIMDUID_
:
1173 pp_string (pp
, "_simduid_(");
1174 dump_generic_node (pp
, OMP_CLAUSE__SIMDUID__DECL (clause
),
1176 pp_right_paren (pp
);
1179 case OMP_CLAUSE__SIMT_
:
1180 pp_string (pp
, "_simt_");
1183 case OMP_CLAUSE_GANG
:
1184 pp_string (pp
, "gang");
1185 if (OMP_CLAUSE_GANG_EXPR (clause
) != NULL_TREE
)
1187 pp_string (pp
, "(num: ");
1188 dump_generic_node (pp
, OMP_CLAUSE_GANG_EXPR (clause
),
1191 if (OMP_CLAUSE_GANG_STATIC_EXPR (clause
) != NULL_TREE
)
1193 if (OMP_CLAUSE_GANG_EXPR (clause
) == NULL_TREE
)
1197 pp_string (pp
, "static:");
1198 if (OMP_CLAUSE_GANG_STATIC_EXPR (clause
)
1199 == integer_minus_one_node
)
1200 pp_character (pp
, '*');
1202 dump_generic_node (pp
, OMP_CLAUSE_GANG_STATIC_EXPR (clause
),
1205 if (OMP_CLAUSE_GANG_EXPR (clause
) != NULL_TREE
1206 || OMP_CLAUSE_GANG_STATIC_EXPR (clause
) != NULL_TREE
)
1207 pp_right_paren (pp
);
1210 case OMP_CLAUSE_ASYNC
:
1211 pp_string (pp
, "async");
1212 if (OMP_CLAUSE_ASYNC_EXPR (clause
))
1214 pp_character(pp
, '(');
1215 dump_generic_node (pp
, OMP_CLAUSE_ASYNC_EXPR (clause
),
1217 pp_character(pp
, ')');
1221 case OMP_CLAUSE_AUTO
:
1222 case OMP_CLAUSE_SEQ
:
1223 pp_string (pp
, omp_clause_code_name
[OMP_CLAUSE_CODE (clause
)]);
1226 case OMP_CLAUSE_WAIT
:
1227 pp_string (pp
, "wait(");
1228 dump_generic_node (pp
, OMP_CLAUSE_WAIT_EXPR (clause
),
1230 pp_character(pp
, ')');
1233 case OMP_CLAUSE_WORKER
:
1234 pp_string (pp
, "worker");
1235 if (OMP_CLAUSE_WORKER_EXPR (clause
) != NULL_TREE
)
1238 dump_generic_node (pp
, OMP_CLAUSE_WORKER_EXPR (clause
),
1240 pp_right_paren (pp
);
1244 case OMP_CLAUSE_VECTOR
:
1245 pp_string (pp
, "vector");
1246 if (OMP_CLAUSE_VECTOR_EXPR (clause
) != NULL_TREE
)
1249 dump_generic_node (pp
, OMP_CLAUSE_VECTOR_EXPR (clause
),
1251 pp_right_paren (pp
);
1255 case OMP_CLAUSE_NUM_GANGS
:
1256 pp_string (pp
, "num_gangs(");
1257 dump_generic_node (pp
, OMP_CLAUSE_NUM_GANGS_EXPR (clause
),
1259 pp_character (pp
, ')');
1262 case OMP_CLAUSE_NUM_WORKERS
:
1263 pp_string (pp
, "num_workers(");
1264 dump_generic_node (pp
, OMP_CLAUSE_NUM_WORKERS_EXPR (clause
),
1266 pp_character (pp
, ')');
1269 case OMP_CLAUSE_VECTOR_LENGTH
:
1270 pp_string (pp
, "vector_length(");
1271 dump_generic_node (pp
, OMP_CLAUSE_VECTOR_LENGTH_EXPR (clause
),
1273 pp_character (pp
, ')');
1276 case OMP_CLAUSE_INBRANCH
:
1277 pp_string (pp
, "inbranch");
1279 case OMP_CLAUSE_NOTINBRANCH
:
1280 pp_string (pp
, "notinbranch");
1282 case OMP_CLAUSE_FOR
:
1283 pp_string (pp
, "for");
1285 case OMP_CLAUSE_PARALLEL
:
1286 pp_string (pp
, "parallel");
1288 case OMP_CLAUSE_SECTIONS
:
1289 pp_string (pp
, "sections");
1291 case OMP_CLAUSE_TASKGROUP
:
1292 pp_string (pp
, "taskgroup");
1294 case OMP_CLAUSE_NOGROUP
:
1295 pp_string (pp
, "nogroup");
1297 case OMP_CLAUSE_THREADS
:
1298 pp_string (pp
, "threads");
1300 case OMP_CLAUSE_SIMD
:
1301 pp_string (pp
, "simd");
1303 case OMP_CLAUSE_INDEPENDENT
:
1304 pp_string (pp
, "independent");
1306 case OMP_CLAUSE_TILE
:
1307 pp_string (pp
, "tile(");
1308 dump_generic_node (pp
, OMP_CLAUSE_TILE_LIST (clause
),
1310 pp_right_paren (pp
);
1313 case OMP_CLAUSE_IF_PRESENT
:
1314 pp_string (pp
, "if_present");
1316 case OMP_CLAUSE_FINALIZE
:
1317 pp_string (pp
, "finalize");
1319 case OMP_CLAUSE_NOHOST
:
1320 pp_string (pp
, "nohost");
1322 case OMP_CLAUSE_DETACH
:
1323 pp_string (pp
, "detach(");
1324 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
), spc
, flags
,
1326 pp_right_paren (pp
);
1335 /* Dump chain of OMP clauses.
1337 PP, SPC and FLAGS are as in dump_generic_node. */
1340 dump_omp_clauses (pretty_printer
*pp
, tree clause
, int spc
, dump_flags_t flags
,
1347 dump_omp_clause (pp
, clause
, spc
, flags
);
1348 leading_space
= true;
1350 clause
= OMP_CLAUSE_CHAIN (clause
);
1355 /* Dump location LOC to PP. */
1358 dump_location (pretty_printer
*pp
, location_t loc
)
1360 expanded_location xloc
= expand_location (loc
);
1362 pp_left_bracket (pp
);
1365 pp_string (pp
, xloc
.file
);
1366 pp_string (pp
, ":");
1368 pp_decimal_int (pp
, xloc
.line
);
1370 pp_decimal_int (pp
, xloc
.column
);
1371 pp_string (pp
, "] ");
1375 /* Dump lexical block BLOCK. PP, SPC and FLAGS are as in
1376 dump_generic_node. */
1379 dump_block_node (pretty_printer
*pp
, tree block
, int spc
, dump_flags_t flags
)
1383 pp_string (pp
, "BLOCK #");
1384 pp_decimal_int (pp
, BLOCK_NUMBER (block
));
1385 pp_character (pp
, ' ');
1387 if (flags
& TDF_ADDRESS
)
1389 pp_character (pp
, '[');
1390 pp_scalar (pp
, "%p", (void *) block
);
1391 pp_string (pp
, "] ");
1394 if (TREE_ASM_WRITTEN (block
))
1395 pp_string (pp
, "[written] ");
1397 if (flags
& TDF_SLIM
)
1400 if (BLOCK_SOURCE_LOCATION (block
))
1401 dump_location (pp
, BLOCK_SOURCE_LOCATION (block
));
1403 newline_and_indent (pp
, spc
+ 2);
1405 if (BLOCK_SUPERCONTEXT (block
))
1407 pp_string (pp
, "SUPERCONTEXT: ");
1408 dump_generic_node (pp
, BLOCK_SUPERCONTEXT (block
), 0,
1409 flags
| TDF_SLIM
, false);
1410 newline_and_indent (pp
, spc
+ 2);
1413 if (BLOCK_SUBBLOCKS (block
))
1415 pp_string (pp
, "SUBBLOCKS: ");
1416 for (t
= BLOCK_SUBBLOCKS (block
); t
; t
= BLOCK_CHAIN (t
))
1418 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
1421 newline_and_indent (pp
, spc
+ 2);
1424 if (BLOCK_CHAIN (block
))
1426 pp_string (pp
, "SIBLINGS: ");
1427 for (t
= BLOCK_CHAIN (block
); t
; t
= BLOCK_CHAIN (t
))
1429 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
1432 newline_and_indent (pp
, spc
+ 2);
1435 if (BLOCK_VARS (block
))
1437 pp_string (pp
, "VARS: ");
1438 for (t
= BLOCK_VARS (block
); t
; t
= TREE_CHAIN (t
))
1440 dump_generic_node (pp
, t
, 0, flags
, false);
1443 newline_and_indent (pp
, spc
+ 2);
1446 if (vec_safe_length (BLOCK_NONLOCALIZED_VARS (block
)) > 0)
1449 vec
<tree
, va_gc
> *nlv
= BLOCK_NONLOCALIZED_VARS (block
);
1451 pp_string (pp
, "NONLOCALIZED_VARS: ");
1452 FOR_EACH_VEC_ELT (*nlv
, i
, t
)
1454 dump_generic_node (pp
, t
, 0, flags
, false);
1457 newline_and_indent (pp
, spc
+ 2);
1460 if (BLOCK_ABSTRACT_ORIGIN (block
))
1462 pp_string (pp
, "ABSTRACT_ORIGIN: ");
1463 dump_generic_node (pp
, BLOCK_ABSTRACT_ORIGIN (block
), 0,
1464 flags
| TDF_SLIM
, false);
1465 newline_and_indent (pp
, spc
+ 2);
1468 if (BLOCK_FRAGMENT_ORIGIN (block
))
1470 pp_string (pp
, "FRAGMENT_ORIGIN: ");
1471 dump_generic_node (pp
, BLOCK_FRAGMENT_ORIGIN (block
), 0,
1472 flags
| TDF_SLIM
, false);
1473 newline_and_indent (pp
, spc
+ 2);
1476 if (BLOCK_FRAGMENT_CHAIN (block
))
1478 pp_string (pp
, "FRAGMENT_CHAIN: ");
1479 for (t
= BLOCK_FRAGMENT_CHAIN (block
); t
; t
= BLOCK_FRAGMENT_CHAIN (t
))
1481 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
1484 newline_and_indent (pp
, spc
+ 2);
1488 /* Dump #pragma omp atomic memory order clause. */
1491 dump_omp_atomic_memory_order (pretty_printer
*pp
, enum omp_memory_order mo
)
1495 case OMP_MEMORY_ORDER_RELAXED
:
1496 pp_string (pp
, " relaxed");
1498 case OMP_MEMORY_ORDER_SEQ_CST
:
1499 pp_string (pp
, " seq_cst");
1501 case OMP_MEMORY_ORDER_ACQ_REL
:
1502 pp_string (pp
, " acq_rel");
1504 case OMP_MEMORY_ORDER_ACQUIRE
:
1505 pp_string (pp
, " acquire");
1507 case OMP_MEMORY_ORDER_RELEASE
:
1508 pp_string (pp
, " release");
1510 case OMP_MEMORY_ORDER_UNSPECIFIED
:
1517 /* Helper to dump a MEM_REF node. */
1520 dump_mem_ref (pretty_printer
*pp
, tree node
, int spc
, dump_flags_t flags
)
1522 if (TREE_CODE (node
) == MEM_REF
&& (flags
& TDF_GIMPLE
))
1524 pp_string (pp
, "__MEM <");
1525 dump_generic_node (pp
, TREE_TYPE (node
),
1526 spc
, flags
| TDF_SLIM
, false);
1527 if (TYPE_ALIGN (TREE_TYPE (node
))
1528 != TYPE_ALIGN (TYPE_MAIN_VARIANT (TREE_TYPE (node
))))
1530 pp_string (pp
, ", ");
1531 pp_decimal_int (pp
, TYPE_ALIGN (TREE_TYPE (node
)));
1534 pp_string (pp
, " (");
1535 if (TREE_TYPE (TREE_OPERAND (node
, 0))
1536 != TREE_TYPE (TREE_OPERAND (node
, 1)))
1539 dump_generic_node (pp
, TREE_TYPE (TREE_OPERAND (node
, 1)),
1540 spc
, flags
| TDF_SLIM
, false);
1541 pp_right_paren (pp
);
1543 dump_generic_node (pp
, TREE_OPERAND (node
, 0),
1544 spc
, flags
| TDF_SLIM
, false);
1545 if (! integer_zerop (TREE_OPERAND (node
, 1)))
1547 pp_string (pp
, " + ");
1548 dump_generic_node (pp
, TREE_OPERAND (node
, 1),
1549 spc
, flags
| TDF_SLIM
, false);
1551 pp_right_paren (pp
);
1553 else if (TREE_CODE (node
) == MEM_REF
1554 && integer_zerop (TREE_OPERAND (node
, 1))
1555 /* Dump the types of INTEGER_CSTs explicitly, for we can't
1556 infer them and MEM_ATTR caching will share MEM_REFs
1557 with differently-typed op0s. */
1558 && TREE_CODE (TREE_OPERAND (node
, 0)) != INTEGER_CST
1559 /* Released SSA_NAMES have no TREE_TYPE. */
1560 && TREE_TYPE (TREE_OPERAND (node
, 0)) != NULL_TREE
1561 /* Same pointer types, but ignoring POINTER_TYPE vs.
1563 && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 0)))
1564 == TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 1))))
1565 && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (node
, 0)))
1566 == TYPE_MODE (TREE_TYPE (TREE_OPERAND (node
, 1))))
1567 && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node
, 0)))
1568 == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node
, 1))))
1569 /* Same value types ignoring qualifiers. */
1570 && (TYPE_MAIN_VARIANT (TREE_TYPE (node
))
1571 == TYPE_MAIN_VARIANT
1572 (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 1)))))
1573 && (!(flags
& TDF_ALIAS
)
1574 || MR_DEPENDENCE_CLIQUE (node
) == 0))
1576 if (TREE_CODE (TREE_OPERAND (node
, 0)) != ADDR_EXPR
)
1578 /* Enclose pointers to arrays in parentheses. */
1579 tree op0
= TREE_OPERAND (node
, 0);
1580 tree op0type
= TREE_TYPE (op0
);
1581 if (POINTER_TYPE_P (op0type
)
1582 && TREE_CODE (TREE_TYPE (op0type
)) == ARRAY_TYPE
)
1585 dump_generic_node (pp
, op0
, spc
, flags
, false);
1586 if (POINTER_TYPE_P (op0type
)
1587 && TREE_CODE (TREE_TYPE (op0type
)) == ARRAY_TYPE
)
1588 pp_right_paren (pp
);
1591 dump_generic_node (pp
,
1592 TREE_OPERAND (TREE_OPERAND (node
, 0), 0),
1597 pp_string (pp
, "MEM");
1599 tree nodetype
= TREE_TYPE (node
);
1600 tree op0
= TREE_OPERAND (node
, 0);
1601 tree op1
= TREE_OPERAND (node
, 1);
1602 tree op1type
= TYPE_MAIN_VARIANT (TREE_TYPE (op1
));
1604 tree op0size
= TYPE_SIZE (nodetype
);
1605 tree op1size
= TYPE_SIZE (TREE_TYPE (op1type
));
1607 if (!op0size
|| !op1size
1608 || !operand_equal_p (op0size
, op1size
, 0))
1610 pp_string (pp
, " <");
1611 /* If the size of the type of the operand is not the same
1612 as the size of the MEM_REF expression include the type
1613 of the latter similar to the TDF_GIMPLE output to make
1614 it clear how many bytes of memory are being accessed. */
1615 dump_generic_node (pp
, nodetype
, spc
, flags
| TDF_SLIM
, false);
1616 pp_string (pp
, "> ");
1619 pp_string (pp
, "[(");
1620 dump_generic_node (pp
, op1type
, spc
, flags
| TDF_SLIM
, false);
1621 pp_right_paren (pp
);
1622 dump_generic_node (pp
, op0
, spc
, flags
, false);
1623 if (!integer_zerop (op1
))
1625 pp_string (pp
, " + ");
1626 dump_generic_node (pp
, op1
, spc
, flags
, false);
1628 if (TREE_CODE (node
) == TARGET_MEM_REF
)
1630 tree tmp
= TMR_INDEX2 (node
);
1633 pp_string (pp
, " + ");
1634 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1636 tmp
= TMR_INDEX (node
);
1639 pp_string (pp
, " + ");
1640 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1641 tmp
= TMR_STEP (node
);
1642 pp_string (pp
, " * ");
1644 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1646 pp_string (pp
, "1");
1649 if ((flags
& TDF_ALIAS
)
1650 && MR_DEPENDENCE_CLIQUE (node
) != 0)
1652 pp_string (pp
, " clique ");
1653 pp_unsigned_wide_integer (pp
, MR_DEPENDENCE_CLIQUE (node
));
1654 pp_string (pp
, " base ");
1655 pp_unsigned_wide_integer (pp
, MR_DEPENDENCE_BASE (node
));
1657 pp_right_bracket (pp
);
1661 /* Helper function for dump_generic_node. Dump INIT or COND expression for
1662 OpenMP loop non-rectangular iterators. */
1665 dump_omp_loop_non_rect_expr (pretty_printer
*pp
, tree node
, int spc
,
1668 gcc_assert (TREE_CODE (node
) == TREE_VEC
);
1669 dump_generic_node (pp
, TREE_VEC_ELT (node
, 0), spc
, flags
, false);
1670 pp_string (pp
, " * ");
1671 if (op_prio (TREE_VEC_ELT (node
, 1)) <= op_code_prio (MULT_EXPR
))
1674 dump_generic_node (pp
, TREE_VEC_ELT (node
, 1), spc
, flags
, false);
1675 pp_right_paren (pp
);
1678 dump_generic_node (pp
, TREE_VEC_ELT (node
, 1), spc
, flags
, false);
1679 pp_string (pp
, " + ");
1680 if (op_prio (TREE_VEC_ELT (node
, 1)) <= op_code_prio (PLUS_EXPR
))
1683 dump_generic_node (pp
, TREE_VEC_ELT (node
, 2), spc
, flags
, false);
1684 pp_right_paren (pp
);
1687 dump_generic_node (pp
, TREE_VEC_ELT (node
, 2), spc
, flags
, false);
1690 /* Dump the node NODE on the pretty_printer PP, SPC spaces of
1691 indent. FLAGS specifies details to show in the dump (see TDF_* in
1692 dumpfile.h). If IS_STMT is true, the object printed is considered
1693 to be a statement and it is terminated by ';' if appropriate. */
1696 dump_generic_node (pretty_printer
*pp
, tree node
, int spc
, dump_flags_t flags
,
1703 enum tree_code code
;
1705 if (node
== NULL_TREE
)
1708 is_expr
= EXPR_P (node
);
1710 if (is_stmt
&& (flags
& TDF_STMTADDR
))
1712 pp_string (pp
, "<&");
1713 pp_scalar (pp
, "%p", (void *)node
);
1714 pp_string (pp
, "> ");
1717 if ((flags
& TDF_LINENO
) && EXPR_HAS_LOCATION (node
))
1718 dump_location (pp
, EXPR_LOCATION (node
));
1720 code
= TREE_CODE (node
);
1724 pp_string (pp
, "<<< error >>>");
1727 case IDENTIFIER_NODE
:
1728 pp_tree_identifier (pp
, node
);
1732 while (node
&& node
!= error_mark_node
)
1734 if (TREE_PURPOSE (node
))
1736 dump_generic_node (pp
, TREE_PURPOSE (node
), spc
, flags
, false);
1739 dump_generic_node (pp
, TREE_VALUE (node
), spc
, flags
, false);
1740 node
= TREE_CHAIN (node
);
1741 if (node
&& TREE_CODE (node
) == TREE_LIST
)
1750 dump_generic_node (pp
, BINFO_TYPE (node
), spc
, flags
, false);
1756 if (TREE_VEC_LENGTH (node
) > 0)
1758 size_t len
= TREE_VEC_LENGTH (node
);
1759 for (i
= 0; i
< len
- 1; i
++)
1761 dump_generic_node (pp
, TREE_VEC_ELT (node
, i
), spc
, flags
,
1766 dump_generic_node (pp
, TREE_VEC_ELT (node
, len
- 1), spc
,
1775 case FIXED_POINT_TYPE
:
1782 unsigned int quals
= TYPE_QUALS (node
);
1783 enum tree_code_class tclass
;
1785 if (quals
& TYPE_QUAL_ATOMIC
)
1786 pp_string (pp
, "atomic ");
1787 if (quals
& TYPE_QUAL_CONST
)
1788 pp_string (pp
, "const ");
1789 if (quals
& TYPE_QUAL_VOLATILE
)
1790 pp_string (pp
, "volatile ");
1791 if (quals
& TYPE_QUAL_RESTRICT
)
1792 pp_string (pp
, "restrict ");
1794 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
1796 pp_string (pp
, "<address-space-");
1797 pp_decimal_int (pp
, TYPE_ADDR_SPACE (node
));
1798 pp_string (pp
, "> ");
1801 tclass
= TREE_CODE_CLASS (TREE_CODE (node
));
1803 if (tclass
== tcc_declaration
)
1805 if (DECL_NAME (node
))
1806 dump_decl_name (pp
, node
, flags
);
1808 pp_string (pp
, "<unnamed type decl>");
1810 else if (tclass
== tcc_type
)
1812 if (TYPE_NAME (node
))
1814 if (TREE_CODE (TYPE_NAME (node
)) == IDENTIFIER_NODE
)
1815 pp_tree_identifier (pp
, TYPE_NAME (node
));
1816 else if (TREE_CODE (TYPE_NAME (node
)) == TYPE_DECL
1817 && DECL_NAME (TYPE_NAME (node
)))
1818 dump_decl_name (pp
, TYPE_NAME (node
), flags
);
1820 pp_string (pp
, "<unnamed type>");
1822 else if (TREE_CODE (node
) == VECTOR_TYPE
)
1824 pp_string (pp
, "vector");
1826 pp_wide_integer (pp
, TYPE_VECTOR_SUBPARTS (node
));
1827 pp_string (pp
, ") ");
1828 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1830 else if (TREE_CODE (node
) == INTEGER_TYPE
)
1832 if (TYPE_PRECISION (node
) == CHAR_TYPE_SIZE
)
1833 pp_string (pp
, (TYPE_UNSIGNED (node
)
1836 else if (TYPE_PRECISION (node
) == SHORT_TYPE_SIZE
)
1837 pp_string (pp
, (TYPE_UNSIGNED (node
)
1840 else if (TYPE_PRECISION (node
) == INT_TYPE_SIZE
)
1841 pp_string (pp
, (TYPE_UNSIGNED (node
)
1844 else if (TYPE_PRECISION (node
) == LONG_TYPE_SIZE
)
1845 pp_string (pp
, (TYPE_UNSIGNED (node
)
1848 else if (TYPE_PRECISION (node
) == LONG_LONG_TYPE_SIZE
)
1849 pp_string (pp
, (TYPE_UNSIGNED (node
)
1850 ? "unsigned long long"
1851 : "signed long long"));
1852 else if (TYPE_PRECISION (node
) >= CHAR_TYPE_SIZE
1853 && pow2p_hwi (TYPE_PRECISION (node
)))
1855 pp_string (pp
, (TYPE_UNSIGNED (node
) ? "uint" : "int"));
1856 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1857 pp_string (pp
, "_t");
1861 pp_string (pp
, (TYPE_UNSIGNED (node
)
1862 ? "<unnamed-unsigned:"
1863 : "<unnamed-signed:"));
1864 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1868 else if (TREE_CODE (node
) == COMPLEX_TYPE
)
1870 pp_string (pp
, "__complex__ ");
1871 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1873 else if (TREE_CODE (node
) == REAL_TYPE
)
1875 pp_string (pp
, "<float:");
1876 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1879 else if (TREE_CODE (node
) == FIXED_POINT_TYPE
)
1881 pp_string (pp
, "<fixed-point-");
1882 pp_string (pp
, TYPE_SATURATING (node
) ? "sat:" : "nonsat:");
1883 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1886 else if (TREE_CODE (node
) == BOOLEAN_TYPE
)
1888 pp_string (pp
, (TYPE_UNSIGNED (node
)
1889 ? "<unsigned-boolean:"
1890 : "<signed-boolean:"));
1891 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1894 else if (TREE_CODE (node
) == VOID_TYPE
)
1895 pp_string (pp
, "void");
1897 pp_string (pp
, "<unnamed type>");
1903 case REFERENCE_TYPE
:
1904 str
= (TREE_CODE (node
) == POINTER_TYPE
? "*" : "&");
1906 if (TREE_TYPE (node
) == NULL
)
1908 pp_string (pp
, str
);
1909 pp_string (pp
, "<null type>");
1911 else if (TREE_CODE (TREE_TYPE (node
)) == FUNCTION_TYPE
)
1913 tree fnode
= TREE_TYPE (node
);
1915 dump_generic_node (pp
, TREE_TYPE (fnode
), spc
, flags
, false);
1918 pp_string (pp
, str
);
1919 if (TYPE_IDENTIFIER (node
))
1920 dump_generic_node (pp
, TYPE_NAME (node
), spc
, flags
, false);
1921 else if (flags
& TDF_NOUID
)
1922 pp_string (pp
, "<Txxxx>");
1925 pp_string (pp
, "<T");
1926 pp_scalar (pp
, "%x", TYPE_UID (node
));
1927 pp_character (pp
, '>');
1930 pp_right_paren (pp
);
1931 dump_function_declaration (pp
, fnode
, spc
, flags
);
1935 unsigned int quals
= TYPE_QUALS (node
);
1937 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1939 pp_string (pp
, str
);
1941 if (quals
& TYPE_QUAL_CONST
)
1942 pp_string (pp
, " const");
1943 if (quals
& TYPE_QUAL_VOLATILE
)
1944 pp_string (pp
, " volatile");
1945 if (quals
& TYPE_QUAL_RESTRICT
)
1946 pp_string (pp
, " restrict");
1948 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
1950 pp_string (pp
, " <address-space-");
1951 pp_decimal_int (pp
, TYPE_ADDR_SPACE (node
));
1955 if (TYPE_REF_CAN_ALIAS_ALL (node
))
1956 pp_string (pp
, " {ref-all}");
1965 case TARGET_MEM_REF
:
1966 dump_mem_ref (pp
, node
, spc
, flags
);
1971 unsigned int quals
= TYPE_QUALS (node
);
1974 if (quals
& TYPE_QUAL_ATOMIC
)
1975 pp_string (pp
, "atomic ");
1976 if (quals
& TYPE_QUAL_CONST
)
1977 pp_string (pp
, "const ");
1978 if (quals
& TYPE_QUAL_VOLATILE
)
1979 pp_string (pp
, "volatile ");
1981 /* Print the innermost component type. */
1982 for (tmp
= TREE_TYPE (node
); TREE_CODE (tmp
) == ARRAY_TYPE
;
1983 tmp
= TREE_TYPE (tmp
))
1985 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1987 /* Print the dimensions. */
1988 for (tmp
= node
; TREE_CODE (tmp
) == ARRAY_TYPE
; tmp
= TREE_TYPE (tmp
))
1989 dump_array_domain (pp
, TYPE_DOMAIN (tmp
), spc
, flags
);
1995 case QUAL_UNION_TYPE
:
1997 unsigned int quals
= TYPE_QUALS (node
);
1999 if (quals
& TYPE_QUAL_ATOMIC
)
2000 pp_string (pp
, "atomic ");
2001 if (quals
& TYPE_QUAL_CONST
)
2002 pp_string (pp
, "const ");
2003 if (quals
& TYPE_QUAL_VOLATILE
)
2004 pp_string (pp
, "volatile ");
2006 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
2008 pp_string (pp
, "<address-space-");
2009 pp_decimal_int (pp
, TYPE_ADDR_SPACE (node
));
2010 pp_string (pp
, "> ");
2013 /* Print the name of the structure. */
2014 if (TREE_CODE (node
) == RECORD_TYPE
)
2015 pp_string (pp
, "struct ");
2016 else if (TREE_CODE (node
) == UNION_TYPE
)
2017 pp_string (pp
, "union ");
2019 if (TYPE_NAME (node
))
2020 dump_generic_node (pp
, TYPE_NAME (node
), spc
, flags
, false);
2021 else if (!(flags
& TDF_SLIM
))
2022 /* FIXME: If we eliminate the 'else' above and attempt
2023 to show the fields for named types, we may get stuck
2024 following a cycle of pointers to structs. The alleged
2025 self-reference check in print_struct_decl will not detect
2026 cycles involving more than one pointer or struct type. */
2027 print_struct_decl (pp
, node
, spc
, flags
);
2036 if (flags
& TDF_GIMPLE
2037 && (POINTER_TYPE_P (TREE_TYPE (node
))
2038 || (TYPE_PRECISION (TREE_TYPE (node
))
2039 < TYPE_PRECISION (integer_type_node
))
2040 || exact_log2 (TYPE_PRECISION (TREE_TYPE (node
))) == -1
2041 || tree_int_cst_sgn (node
) < 0))
2043 pp_string (pp
, "_Literal (");
2044 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2045 pp_string (pp
, ") ");
2047 if (TREE_CODE (TREE_TYPE (node
)) == POINTER_TYPE
2048 && ! (flags
& TDF_GIMPLE
))
2050 /* In the case of a pointer, one may want to divide by the
2051 size of the pointed-to type. Unfortunately, this not
2052 straightforward. The C front-end maps expressions
2057 in such a way that the two INTEGER_CST nodes for "5" have
2058 different values but identical types. In the latter
2059 case, the 5 is multiplied by sizeof (int) in c-common.c
2060 (pointer_int_sum) to convert it to a byte address, and
2061 yet the type of the node is left unchanged. Argh. What
2062 is consistent though is that the number value corresponds
2063 to bytes (UNITS) offset.
2065 NB: Neither of the following divisors can be trivially
2066 used to recover the original literal:
2068 TREE_INT_CST_LOW (TYPE_SIZE_UNIT (TREE_TYPE (node)))
2069 TYPE_PRECISION (TREE_TYPE (TREE_TYPE (node))) */
2070 pp_wide_integer (pp
, TREE_INT_CST_LOW (node
));
2071 pp_string (pp
, "B"); /* pseudo-unit */
2073 else if (tree_fits_shwi_p (node
))
2074 pp_wide_integer (pp
, tree_to_shwi (node
));
2075 else if (tree_fits_uhwi_p (node
))
2076 pp_unsigned_wide_integer (pp
, tree_to_uhwi (node
));
2079 wide_int val
= wi::to_wide (node
);
2081 if (wi::neg_p (val
, TYPE_SIGN (TREE_TYPE (node
))))
2086 print_hex (val
, pp_buffer (pp
)->digit_buffer
);
2087 pp_string (pp
, pp_buffer (pp
)->digit_buffer
);
2089 if ((flags
& TDF_GIMPLE
)
2090 && ! (POINTER_TYPE_P (TREE_TYPE (node
))
2091 || (TYPE_PRECISION (TREE_TYPE (node
))
2092 < TYPE_PRECISION (integer_type_node
))
2093 || exact_log2 (TYPE_PRECISION (TREE_TYPE (node
))) == -1))
2095 if (TYPE_UNSIGNED (TREE_TYPE (node
)))
2096 pp_character (pp
, 'u');
2097 if (TYPE_PRECISION (TREE_TYPE (node
))
2098 == TYPE_PRECISION (unsigned_type_node
))
2100 else if (TYPE_PRECISION (TREE_TYPE (node
))
2101 == TYPE_PRECISION (long_unsigned_type_node
))
2102 pp_character (pp
, 'l');
2103 else if (TYPE_PRECISION (TREE_TYPE (node
))
2104 == TYPE_PRECISION (long_long_unsigned_type_node
))
2105 pp_string (pp
, "ll");
2107 if (TREE_OVERFLOW (node
))
2108 pp_string (pp
, "(OVF)");
2112 pp_string (pp
, "POLY_INT_CST [");
2113 dump_generic_node (pp
, POLY_INT_CST_COEFF (node
, 0), spc
, flags
, false);
2114 for (unsigned int i
= 1; i
< NUM_POLY_INT_COEFFS
; ++i
)
2116 pp_string (pp
, ", ");
2117 dump_generic_node (pp
, POLY_INT_CST_COEFF (node
, i
),
2120 pp_string (pp
, "]");
2124 /* Code copied from print_node. */
2127 if (TREE_OVERFLOW (node
))
2128 pp_string (pp
, " overflow");
2130 d
= TREE_REAL_CST (node
);
2131 if (REAL_VALUE_ISINF (d
))
2132 pp_string (pp
, REAL_VALUE_NEGATIVE (d
) ? " -Inf" : " Inf");
2133 else if (REAL_VALUE_ISNAN (d
))
2134 pp_string (pp
, " Nan");
2138 real_to_decimal (string
, &d
, sizeof (string
), 0, 1);
2139 pp_string (pp
, string
);
2147 fixed_to_decimal (string
, TREE_FIXED_CST_PTR (node
), sizeof (string
));
2148 pp_string (pp
, string
);
2153 pp_string (pp
, "__complex__ (");
2154 dump_generic_node (pp
, TREE_REALPART (node
), spc
, flags
, false);
2155 pp_string (pp
, ", ");
2156 dump_generic_node (pp
, TREE_IMAGPART (node
), spc
, flags
, false);
2157 pp_right_paren (pp
);
2162 pp_string (pp
, "\"");
2163 if (unsigned nbytes
= TREE_STRING_LENGTH (node
))
2164 pretty_print_string (pp
, TREE_STRING_POINTER (node
), nbytes
);
2165 pp_string (pp
, "\"");
2172 if (flags
& TDF_GIMPLE
)
2174 pp_string (pp
, "_Literal (");
2175 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2176 pp_string (pp
, ") ");
2178 pp_string (pp
, "{ ");
2179 unsigned HOST_WIDE_INT nunits
;
2180 if (!VECTOR_CST_NELTS (node
).is_constant (&nunits
))
2181 nunits
= vector_cst_encoded_nelts (node
);
2182 for (i
= 0; i
< nunits
; ++i
)
2185 pp_string (pp
, ", ");
2186 dump_generic_node (pp
, VECTOR_CST_ELT (node
, i
),
2189 if (!VECTOR_CST_NELTS (node
).is_constant ())
2190 pp_string (pp
, ", ...");
2191 pp_string (pp
, " }");
2197 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2199 if (TREE_CODE (node
) == METHOD_TYPE
)
2201 if (TYPE_METHOD_BASETYPE (node
))
2202 dump_generic_node (pp
, TYPE_NAME (TYPE_METHOD_BASETYPE (node
)),
2205 pp_string (pp
, "<null method basetype>");
2206 pp_colon_colon (pp
);
2208 if (TYPE_IDENTIFIER (node
))
2209 dump_generic_node (pp
, TYPE_NAME (node
), spc
, flags
, false);
2210 else if (TYPE_NAME (node
) && DECL_NAME (TYPE_NAME (node
)))
2211 dump_decl_name (pp
, TYPE_NAME (node
), flags
);
2212 else if (flags
& TDF_NOUID
)
2213 pp_string (pp
, "<Txxxx>");
2216 pp_string (pp
, "<T");
2217 pp_scalar (pp
, "%x", TYPE_UID (node
));
2218 pp_character (pp
, '>');
2220 dump_function_declaration (pp
, node
, spc
, flags
);
2225 dump_decl_name (pp
, node
, flags
);
2229 if (DECL_NAME (node
))
2230 dump_decl_name (pp
, node
, flags
);
2231 else if (LABEL_DECL_UID (node
) != -1)
2233 if (flags
& TDF_GIMPLE
)
2235 pp_character (pp
, 'L');
2236 pp_decimal_int (pp
, (int) LABEL_DECL_UID (node
));
2240 pp_string (pp
, "<L");
2241 pp_decimal_int (pp
, (int) LABEL_DECL_UID (node
));
2242 pp_character (pp
, '>');
2247 if (flags
& TDF_NOUID
)
2248 pp_string (pp
, "<D.xxxx>");
2251 if (flags
& TDF_GIMPLE
)
2253 pp_character (pp
, 'D');
2254 pp_scalar (pp
, "%u", DECL_UID (node
));
2258 pp_string (pp
, "<D.");
2259 pp_scalar (pp
, "%u", DECL_UID (node
));
2260 pp_character (pp
, '>');
2267 if (DECL_IS_UNDECLARED_BUILTIN (node
))
2269 /* Don't print the declaration of built-in types. */
2272 if (DECL_NAME (node
))
2273 dump_decl_name (pp
, node
, flags
);
2274 else if (TYPE_NAME (TREE_TYPE (node
)) != node
)
2276 pp_string (pp
, (TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
2277 ? "union" : "struct "));
2278 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2281 pp_string (pp
, "<anon>");
2287 case DEBUG_EXPR_DECL
:
2288 case NAMESPACE_DECL
:
2290 dump_decl_name (pp
, node
, flags
);
2294 pp_string (pp
, "<retval>");
2298 op0
= TREE_OPERAND (node
, 0);
2301 && (TREE_CODE (op0
) == INDIRECT_REF
2302 || (TREE_CODE (op0
) == MEM_REF
2303 && TREE_CODE (TREE_OPERAND (op0
, 0)) != ADDR_EXPR
2304 && integer_zerop (TREE_OPERAND (op0
, 1))
2305 /* Dump the types of INTEGER_CSTs explicitly, for we
2306 can't infer them and MEM_ATTR caching will share
2307 MEM_REFs with differently-typed op0s. */
2308 && TREE_CODE (TREE_OPERAND (op0
, 0)) != INTEGER_CST
2309 /* Released SSA_NAMES have no TREE_TYPE. */
2310 && TREE_TYPE (TREE_OPERAND (op0
, 0)) != NULL_TREE
2311 /* Same pointer types, but ignoring POINTER_TYPE vs.
2313 && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 0)))
2314 == TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 1))))
2315 && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0
, 0)))
2316 == TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0
, 1))))
2317 && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0
, 0)))
2318 == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0
, 1))))
2319 /* Same value types ignoring qualifiers. */
2320 && (TYPE_MAIN_VARIANT (TREE_TYPE (op0
))
2321 == TYPE_MAIN_VARIANT
2322 (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 1)))))
2323 && MR_DEPENDENCE_CLIQUE (op0
) == 0)))
2325 op0
= TREE_OPERAND (op0
, 0);
2328 if (op_prio (op0
) < op_prio (node
))
2330 dump_generic_node (pp
, op0
, spc
, flags
, false);
2331 if (op_prio (op0
) < op_prio (node
))
2332 pp_right_paren (pp
);
2333 pp_string (pp
, str
);
2334 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2335 op0
= component_ref_field_offset (node
);
2336 if (op0
&& TREE_CODE (op0
) != INTEGER_CST
)
2338 pp_string (pp
, "{off: ");
2339 dump_generic_node (pp
, op0
, spc
, flags
, false);
2340 pp_right_brace (pp
);
2345 if (flags
& TDF_GIMPLE
)
2347 pp_string (pp
, "__BIT_FIELD_REF <");
2348 dump_generic_node (pp
, TREE_TYPE (node
),
2349 spc
, flags
| TDF_SLIM
, false);
2350 if (TYPE_ALIGN (TREE_TYPE (node
))
2351 != TYPE_ALIGN (TYPE_MAIN_VARIANT (TREE_TYPE (node
))))
2353 pp_string (pp
, ", ");
2354 pp_decimal_int (pp
, TYPE_ALIGN (TREE_TYPE (node
)));
2357 pp_string (pp
, " (");
2358 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
,
2359 flags
| TDF_SLIM
, false);
2360 pp_string (pp
, ", ");
2361 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
,
2362 flags
| TDF_SLIM
, false);
2363 pp_string (pp
, ", ");
2364 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
,
2365 flags
| TDF_SLIM
, false);
2366 pp_right_paren (pp
);
2370 pp_string (pp
, "BIT_FIELD_REF <");
2371 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2372 pp_string (pp
, ", ");
2373 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2374 pp_string (pp
, ", ");
2375 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2380 case BIT_INSERT_EXPR
:
2381 pp_string (pp
, "BIT_INSERT_EXPR <");
2382 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2383 pp_string (pp
, ", ");
2384 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2385 pp_string (pp
, ", ");
2386 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2387 pp_string (pp
, " (");
2388 if (INTEGRAL_TYPE_P (TREE_TYPE (TREE_OPERAND (node
, 1))))
2390 TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (node
, 1))));
2392 dump_generic_node (pp
, TYPE_SIZE (TREE_TYPE (TREE_OPERAND (node
, 1))),
2394 pp_string (pp
, " bits)>");
2398 case ARRAY_RANGE_REF
:
2399 op0
= TREE_OPERAND (node
, 0);
2400 if (op_prio (op0
) < op_prio (node
))
2402 dump_generic_node (pp
, op0
, spc
, flags
, false);
2403 if (op_prio (op0
) < op_prio (node
))
2404 pp_right_paren (pp
);
2405 pp_left_bracket (pp
);
2406 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2407 if (TREE_CODE (node
) == ARRAY_RANGE_REF
)
2408 pp_string (pp
, " ...");
2409 pp_right_bracket (pp
);
2411 op0
= array_ref_low_bound (node
);
2412 op1
= array_ref_element_size (node
);
2414 if (!integer_zerop (op0
)
2415 || TREE_OPERAND (node
, 2)
2416 || TREE_OPERAND (node
, 3))
2418 pp_string (pp
, "{lb: ");
2419 dump_generic_node (pp
, op0
, spc
, flags
, false);
2420 pp_string (pp
, " sz: ");
2421 dump_generic_node (pp
, op1
, spc
, flags
, false);
2422 pp_right_brace (pp
);
2428 unsigned HOST_WIDE_INT ix
;
2430 bool is_struct_init
= false;
2431 bool is_array_init
= false;
2433 if (flags
& TDF_GIMPLE
)
2435 pp_string (pp
, "_Literal (");
2436 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2437 pp_string (pp
, ") ");
2440 if (TREE_CLOBBER_P (node
))
2441 pp_string (pp
, "CLOBBER");
2442 else if (TREE_CODE (TREE_TYPE (node
)) == RECORD_TYPE
2443 || TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
)
2444 is_struct_init
= true;
2445 else if (TREE_CODE (TREE_TYPE (node
)) == ARRAY_TYPE
2446 && TYPE_DOMAIN (TREE_TYPE (node
))
2447 && TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
)))
2448 && TREE_CODE (TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
))))
2451 tree minv
= TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
)));
2452 is_array_init
= true;
2453 curidx
= wi::to_widest (minv
);
2455 FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (node
), ix
, field
, val
)
2462 dump_generic_node (pp
, field
, spc
, flags
, false);
2465 else if (is_array_init
2466 && (TREE_CODE (field
) != INTEGER_CST
2467 || curidx
!= wi::to_widest (field
)))
2469 pp_left_bracket (pp
);
2470 if (TREE_CODE (field
) == RANGE_EXPR
)
2472 dump_generic_node (pp
, TREE_OPERAND (field
, 0), spc
,
2474 pp_string (pp
, " ... ");
2475 dump_generic_node (pp
, TREE_OPERAND (field
, 1), spc
,
2477 if (TREE_CODE (TREE_OPERAND (field
, 1)) == INTEGER_CST
)
2478 curidx
= wi::to_widest (TREE_OPERAND (field
, 1));
2481 dump_generic_node (pp
, field
, spc
, flags
, false);
2482 if (TREE_CODE (field
) == INTEGER_CST
)
2483 curidx
= wi::to_widest (field
);
2484 pp_string (pp
, "]=");
2489 if (val
&& TREE_CODE (val
) == ADDR_EXPR
)
2490 if (TREE_CODE (TREE_OPERAND (val
, 0)) == FUNCTION_DECL
)
2491 val
= TREE_OPERAND (val
, 0);
2492 if (val
&& TREE_CODE (val
) == FUNCTION_DECL
)
2493 dump_decl_name (pp
, val
, flags
);
2495 dump_generic_node (pp
, val
, spc
, flags
, false);
2496 if (ix
!= CONSTRUCTOR_NELTS (node
) - 1)
2502 pp_right_brace (pp
);
2509 if (flags
& TDF_SLIM
)
2511 pp_string (pp
, "<COMPOUND_EXPR>");
2515 dump_generic_node (pp
, TREE_OPERAND (node
, 0),
2516 spc
, flags
, !(flags
& TDF_SLIM
));
2517 if (flags
& TDF_SLIM
)
2518 newline_and_indent (pp
, spc
);
2525 for (tp
= &TREE_OPERAND (node
, 1);
2526 TREE_CODE (*tp
) == COMPOUND_EXPR
;
2527 tp
= &TREE_OPERAND (*tp
, 1))
2529 dump_generic_node (pp
, TREE_OPERAND (*tp
, 0),
2530 spc
, flags
, !(flags
& TDF_SLIM
));
2531 if (flags
& TDF_SLIM
)
2532 newline_and_indent (pp
, spc
);
2540 dump_generic_node (pp
, *tp
, spc
, flags
, !(flags
& TDF_SLIM
));
2544 case STATEMENT_LIST
:
2546 tree_stmt_iterator si
;
2549 if (flags
& TDF_SLIM
)
2551 pp_string (pp
, "<STATEMENT_LIST>");
2555 for (si
= tsi_start (node
); !tsi_end_p (si
); tsi_next (&si
))
2558 newline_and_indent (pp
, spc
);
2561 dump_generic_node (pp
, tsi_stmt (si
), spc
, flags
, true);
2568 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
,
2573 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
,
2578 pp_string (pp
, "TARGET_EXPR <");
2579 dump_generic_node (pp
, TARGET_EXPR_SLOT (node
), spc
, flags
, false);
2582 dump_generic_node (pp
, TARGET_EXPR_INITIAL (node
), spc
, flags
, false);
2587 print_declaration (pp
, DECL_EXPR_DECL (node
), spc
, flags
);
2592 if (TREE_TYPE (node
) == NULL
|| TREE_TYPE (node
) == void_type_node
)
2594 pp_string (pp
, "if (");
2595 dump_generic_node (pp
, COND_EXPR_COND (node
), spc
, flags
, false);
2596 pp_right_paren (pp
);
2597 /* The lowered cond_exprs should always be printed in full. */
2598 if (COND_EXPR_THEN (node
)
2599 && (IS_EMPTY_STMT (COND_EXPR_THEN (node
))
2600 || TREE_CODE (COND_EXPR_THEN (node
)) == GOTO_EXPR
)
2601 && COND_EXPR_ELSE (node
)
2602 && (IS_EMPTY_STMT (COND_EXPR_ELSE (node
))
2603 || TREE_CODE (COND_EXPR_ELSE (node
)) == GOTO_EXPR
))
2606 dump_generic_node (pp
, COND_EXPR_THEN (node
),
2608 if (!IS_EMPTY_STMT (COND_EXPR_ELSE (node
)))
2610 pp_string (pp
, " else ");
2611 dump_generic_node (pp
, COND_EXPR_ELSE (node
),
2615 else if (!(flags
& TDF_SLIM
))
2617 /* Output COND_EXPR_THEN. */
2618 if (COND_EXPR_THEN (node
))
2620 newline_and_indent (pp
, spc
+2);
2622 newline_and_indent (pp
, spc
+4);
2623 dump_generic_node (pp
, COND_EXPR_THEN (node
), spc
+4,
2625 newline_and_indent (pp
, spc
+2);
2626 pp_right_brace (pp
);
2629 /* Output COND_EXPR_ELSE. */
2630 if (COND_EXPR_ELSE (node
)
2631 && !IS_EMPTY_STMT (COND_EXPR_ELSE (node
)))
2633 newline_and_indent (pp
, spc
);
2634 pp_string (pp
, "else");
2635 newline_and_indent (pp
, spc
+2);
2637 newline_and_indent (pp
, spc
+4);
2638 dump_generic_node (pp
, COND_EXPR_ELSE (node
), spc
+4,
2640 newline_and_indent (pp
, spc
+2);
2641 pp_right_brace (pp
);
2648 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2652 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2656 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2662 if (!(flags
& TDF_SLIM
))
2664 if (BIND_EXPR_VARS (node
))
2668 for (op0
= BIND_EXPR_VARS (node
); op0
; op0
= DECL_CHAIN (op0
))
2670 print_declaration (pp
, op0
, spc
+2, flags
);
2675 newline_and_indent (pp
, spc
+2);
2676 dump_generic_node (pp
, BIND_EXPR_BODY (node
), spc
+2, flags
, true);
2677 newline_and_indent (pp
, spc
);
2678 pp_right_brace (pp
);
2684 if (CALL_EXPR_FN (node
) != NULL_TREE
)
2685 print_call_name (pp
, CALL_EXPR_FN (node
), flags
);
2689 pp_string (pp
, internal_fn_name (CALL_EXPR_IFN (node
)));
2692 /* Print parameters. */
2697 call_expr_arg_iterator iter
;
2698 FOR_EACH_CALL_EXPR_ARG (arg
, iter
, node
)
2700 dump_generic_node (pp
, arg
, spc
, flags
, false);
2701 if (more_call_expr_args_p (&iter
))
2708 if (CALL_EXPR_VA_ARG_PACK (node
))
2710 if (call_expr_nargs (node
) > 0)
2715 pp_string (pp
, "__builtin_va_arg_pack ()");
2717 pp_right_paren (pp
);
2719 op1
= CALL_EXPR_STATIC_CHAIN (node
);
2722 pp_string (pp
, " [static-chain: ");
2723 dump_generic_node (pp
, op1
, spc
, flags
, false);
2724 pp_right_bracket (pp
);
2727 if (CALL_EXPR_RETURN_SLOT_OPT (node
))
2728 pp_string (pp
, " [return slot optimization]");
2729 if (CALL_EXPR_TAILCALL (node
))
2730 pp_string (pp
, " [tail call]");
2733 case WITH_CLEANUP_EXPR
:
2737 case CLEANUP_POINT_EXPR
:
2738 pp_string (pp
, "<<cleanup_point ");
2739 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2740 pp_string (pp
, ">>");
2743 case PLACEHOLDER_EXPR
:
2744 pp_string (pp
, "<PLACEHOLDER_EXPR ");
2745 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2749 /* Binary arithmetic and logic expressions. */
2750 case WIDEN_PLUS_EXPR
:
2751 case WIDEN_MINUS_EXPR
:
2752 case WIDEN_SUM_EXPR
:
2753 case WIDEN_MULT_EXPR
:
2755 case MULT_HIGHPART_EXPR
:
2757 case POINTER_PLUS_EXPR
:
2758 case POINTER_DIFF_EXPR
:
2760 case TRUNC_DIV_EXPR
:
2762 case FLOOR_DIV_EXPR
:
2763 case ROUND_DIV_EXPR
:
2764 case TRUNC_MOD_EXPR
:
2766 case FLOOR_MOD_EXPR
:
2767 case ROUND_MOD_EXPR
:
2769 case EXACT_DIV_EXPR
:
2774 case WIDEN_LSHIFT_EXPR
:
2778 case TRUTH_ANDIF_EXPR
:
2779 case TRUTH_ORIF_EXPR
:
2780 case TRUTH_AND_EXPR
:
2782 case TRUTH_XOR_EXPR
:
2796 case UNORDERED_EXPR
:
2798 const char *op
= op_symbol (node
);
2799 op0
= TREE_OPERAND (node
, 0);
2800 op1
= TREE_OPERAND (node
, 1);
2802 /* When the operands are expressions with less priority,
2803 keep semantics of the tree representation. */
2804 if (op_prio (op0
) <= op_prio (node
))
2807 dump_generic_node (pp
, op0
, spc
, flags
, false);
2808 pp_right_paren (pp
);
2811 dump_generic_node (pp
, op0
, spc
, flags
, false);
2817 /* When the operands are expressions with less priority,
2818 keep semantics of the tree representation. */
2819 if (op_prio (op1
) <= op_prio (node
))
2822 dump_generic_node (pp
, op1
, spc
, flags
, false);
2823 pp_right_paren (pp
);
2826 dump_generic_node (pp
, op1
, spc
, flags
, false);
2830 /* Unary arithmetic and logic expressions. */
2833 case TRUTH_NOT_EXPR
:
2835 case PREDECREMENT_EXPR
:
2836 case PREINCREMENT_EXPR
:
2838 if (TREE_CODE (node
) == ADDR_EXPR
2839 && (TREE_CODE (TREE_OPERAND (node
, 0)) == STRING_CST
2840 || TREE_CODE (TREE_OPERAND (node
, 0)) == FUNCTION_DECL
))
2841 ; /* Do not output '&' for strings and function pointers. */
2843 pp_string (pp
, op_symbol (node
));
2845 if (op_prio (TREE_OPERAND (node
, 0)) < op_prio (node
))
2848 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2849 pp_right_paren (pp
);
2852 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2855 case POSTDECREMENT_EXPR
:
2856 case POSTINCREMENT_EXPR
:
2857 if (op_prio (TREE_OPERAND (node
, 0)) < op_prio (node
))
2860 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2861 pp_right_paren (pp
);
2864 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2865 pp_string (pp
, op_symbol (node
));
2869 pp_string (pp
, "MIN_EXPR <");
2870 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2871 pp_string (pp
, ", ");
2872 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2877 pp_string (pp
, "MAX_EXPR <");
2878 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2879 pp_string (pp
, ", ");
2880 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2885 pp_string (pp
, "ABS_EXPR <");
2886 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2891 pp_string (pp
, "ABSU_EXPR <");
2892 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2900 case ADDR_SPACE_CONVERT_EXPR
:
2901 case FIXED_CONVERT_EXPR
:
2902 case FIX_TRUNC_EXPR
:
2905 type
= TREE_TYPE (node
);
2906 op0
= TREE_OPERAND (node
, 0);
2907 if (type
!= TREE_TYPE (op0
))
2910 dump_generic_node (pp
, type
, spc
, flags
, false);
2911 pp_string (pp
, ") ");
2913 if (op_prio (op0
) < op_prio (node
))
2915 dump_generic_node (pp
, op0
, spc
, flags
, false);
2916 if (op_prio (op0
) < op_prio (node
))
2917 pp_right_paren (pp
);
2920 case VIEW_CONVERT_EXPR
:
2921 if (flags
& TDF_GIMPLE
)
2922 pp_string (pp
, "__VIEW_CONVERT <");
2924 pp_string (pp
, "VIEW_CONVERT_EXPR<");
2925 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2926 pp_string (pp
, ">(");
2927 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2928 pp_right_paren (pp
);
2932 pp_string (pp
, "((");
2933 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2934 pp_string (pp
, "))");
2937 case NON_LVALUE_EXPR
:
2938 pp_string (pp
, "NON_LVALUE_EXPR <");
2939 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2944 pp_string (pp
, "SAVE_EXPR <");
2945 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2950 pp_string (pp
, "COMPLEX_EXPR <");
2951 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2952 pp_string (pp
, ", ");
2953 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2958 pp_string (pp
, "CONJ_EXPR <");
2959 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2964 if (flags
& TDF_GIMPLE
)
2966 pp_string (pp
, "__real ");
2967 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2971 pp_string (pp
, "REALPART_EXPR <");
2972 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2978 if (flags
& TDF_GIMPLE
)
2980 pp_string (pp
, "__imag ");
2981 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2985 pp_string (pp
, "IMAGPART_EXPR <");
2986 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2992 pp_string (pp
, "VA_ARG_EXPR <");
2993 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2997 case TRY_FINALLY_EXPR
:
2998 case TRY_CATCH_EXPR
:
2999 pp_string (pp
, "try");
3000 newline_and_indent (pp
, spc
+2);
3002 newline_and_indent (pp
, spc
+4);
3003 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
+4, flags
, true);
3004 newline_and_indent (pp
, spc
+2);
3005 pp_right_brace (pp
);
3006 newline_and_indent (pp
, spc
);
3007 if (TREE_CODE (node
) == TRY_CATCH_EXPR
)
3009 node
= TREE_OPERAND (node
, 1);
3010 pp_string (pp
, "catch");
3014 gcc_assert (TREE_CODE (node
) == TRY_FINALLY_EXPR
);
3015 node
= TREE_OPERAND (node
, 1);
3016 pp_string (pp
, "finally");
3017 if (TREE_CODE (node
) == EH_ELSE_EXPR
)
3019 newline_and_indent (pp
, spc
+2);
3021 newline_and_indent (pp
, spc
+4);
3022 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
+4,
3024 newline_and_indent (pp
, spc
+2);
3025 pp_right_brace (pp
);
3026 newline_and_indent (pp
, spc
);
3027 node
= TREE_OPERAND (node
, 1);
3028 pp_string (pp
, "else");
3031 newline_and_indent (pp
, spc
+2);
3033 newline_and_indent (pp
, spc
+4);
3034 dump_generic_node (pp
, node
, spc
+4, flags
, true);
3035 newline_and_indent (pp
, spc
+2);
3036 pp_right_brace (pp
);
3041 pp_string (pp
, "catch (");
3042 dump_generic_node (pp
, CATCH_TYPES (node
), spc
+2, flags
, false);
3043 pp_right_paren (pp
);
3044 newline_and_indent (pp
, spc
+2);
3046 newline_and_indent (pp
, spc
+4);
3047 dump_generic_node (pp
, CATCH_BODY (node
), spc
+4, flags
, true);
3048 newline_and_indent (pp
, spc
+2);
3049 pp_right_brace (pp
);
3053 case EH_FILTER_EXPR
:
3054 pp_string (pp
, "<<<eh_filter (");
3055 dump_generic_node (pp
, EH_FILTER_TYPES (node
), spc
+2, flags
, false);
3056 pp_string (pp
, ")>>>");
3057 newline_and_indent (pp
, spc
+2);
3059 newline_and_indent (pp
, spc
+4);
3060 dump_generic_node (pp
, EH_FILTER_FAILURE (node
), spc
+4, flags
, true);
3061 newline_and_indent (pp
, spc
+2);
3062 pp_right_brace (pp
);
3067 op0
= TREE_OPERAND (node
, 0);
3068 /* If this is for break or continue, don't bother printing it. */
3069 if (DECL_NAME (op0
))
3071 const char *name
= IDENTIFIER_POINTER (DECL_NAME (op0
));
3072 if (strcmp (name
, "break") == 0
3073 || strcmp (name
, "continue") == 0)
3076 dump_generic_node (pp
, op0
, spc
, flags
, false);
3078 if (DECL_NONLOCAL (op0
))
3079 pp_string (pp
, " [non-local]");
3083 pp_string (pp
, "while (1)");
3084 if (!(flags
& TDF_SLIM
))
3086 newline_and_indent (pp
, spc
+2);
3088 newline_and_indent (pp
, spc
+4);
3089 dump_generic_node (pp
, LOOP_EXPR_BODY (node
), spc
+4, flags
, true);
3090 newline_and_indent (pp
, spc
+2);
3091 pp_right_brace (pp
);
3097 pp_string (pp
, "// predicted ");
3098 if (PREDICT_EXPR_OUTCOME (node
))
3099 pp_string (pp
, "likely by ");
3101 pp_string (pp
, "unlikely by ");
3102 pp_string (pp
, predictor_name (PREDICT_EXPR_PREDICTOR (node
)));
3103 pp_string (pp
, " predictor.");
3107 pp_string (pp
, "ANNOTATE_EXPR <");
3108 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3109 switch ((enum annot_expr_kind
) TREE_INT_CST_LOW (TREE_OPERAND (node
, 1)))
3111 case annot_expr_ivdep_kind
:
3112 pp_string (pp
, ", ivdep");
3114 case annot_expr_unroll_kind
:
3116 pp_string (pp
, ", unroll ");
3118 (int) TREE_INT_CST_LOW (TREE_OPERAND (node
, 2)));
3121 case annot_expr_no_vector_kind
:
3122 pp_string (pp
, ", no-vector");
3124 case annot_expr_vector_kind
:
3125 pp_string (pp
, ", vector");
3127 case annot_expr_parallel_kind
:
3128 pp_string (pp
, ", parallel");
3137 pp_string (pp
, "return");
3138 op0
= TREE_OPERAND (node
, 0);
3142 if (TREE_CODE (op0
) == MODIFY_EXPR
)
3143 dump_generic_node (pp
, TREE_OPERAND (op0
, 1),
3146 dump_generic_node (pp
, op0
, spc
, flags
, false);
3151 pp_string (pp
, "if (");
3152 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3153 pp_string (pp
, ") break");
3157 pp_string (pp
, "switch (");
3158 dump_generic_node (pp
, SWITCH_COND (node
), spc
, flags
, false);
3159 pp_right_paren (pp
);
3160 if (!(flags
& TDF_SLIM
))
3162 newline_and_indent (pp
, spc
+2);
3164 if (SWITCH_BODY (node
))
3166 newline_and_indent (pp
, spc
+4);
3167 dump_generic_node (pp
, SWITCH_BODY (node
), spc
+4, flags
,
3170 newline_and_indent (pp
, spc
+2);
3171 pp_right_brace (pp
);
3177 op0
= GOTO_DESTINATION (node
);
3178 if (TREE_CODE (op0
) != SSA_NAME
&& DECL_P (op0
) && DECL_NAME (op0
))
3180 const char *name
= IDENTIFIER_POINTER (DECL_NAME (op0
));
3181 if (strcmp (name
, "break") == 0
3182 || strcmp (name
, "continue") == 0)
3184 pp_string (pp
, name
);
3188 pp_string (pp
, "goto ");
3189 dump_generic_node (pp
, op0
, spc
, flags
, false);
3193 pp_string (pp
, "__asm__");
3194 if (ASM_VOLATILE_P (node
))
3195 pp_string (pp
, " __volatile__");
3197 dump_generic_node (pp
, ASM_STRING (node
), spc
, flags
, false);
3199 dump_generic_node (pp
, ASM_OUTPUTS (node
), spc
, flags
, false);
3201 dump_generic_node (pp
, ASM_INPUTS (node
), spc
, flags
, false);
3202 if (ASM_CLOBBERS (node
))
3205 dump_generic_node (pp
, ASM_CLOBBERS (node
), spc
, flags
, false);
3207 pp_right_paren (pp
);
3210 case CASE_LABEL_EXPR
:
3211 if (CASE_LOW (node
) && CASE_HIGH (node
))
3213 pp_string (pp
, "case ");
3214 dump_generic_node (pp
, CASE_LOW (node
), spc
, flags
, false);
3215 pp_string (pp
, " ... ");
3216 dump_generic_node (pp
, CASE_HIGH (node
), spc
, flags
, false);
3218 else if (CASE_LOW (node
))
3220 pp_string (pp
, "case ");
3221 dump_generic_node (pp
, CASE_LOW (node
), spc
, flags
, false);
3224 pp_string (pp
, "default");
3229 pp_string (pp
, "OBJ_TYPE_REF(");
3230 dump_generic_node (pp
, OBJ_TYPE_REF_EXPR (node
), spc
, flags
, false);
3232 /* We omit the class type for -fcompare-debug because we may
3233 drop TYPE_BINFO early depending on debug info, and then
3234 virtual_method_call_p would return false, whereas when
3235 TYPE_BINFO is preserved it may still return true and then
3236 we'd print the class type. Compare tree and rtl dumps for
3237 libstdc++-prettyprinters/shared_ptr.cc with and without -g,
3238 for example, at occurrences of OBJ_TYPE_REF. */
3239 if (!(flags
& (TDF_SLIM
| TDF_COMPARE_DEBUG
))
3240 && virtual_method_call_p (node
, true))
3242 pp_string (pp
, "(");
3243 dump_generic_node (pp
, obj_type_ref_class (node
, true),
3245 pp_string (pp
, ")");
3247 dump_generic_node (pp
, OBJ_TYPE_REF_OBJECT (node
), spc
, flags
, false);
3249 dump_generic_node (pp
, OBJ_TYPE_REF_TOKEN (node
), spc
, flags
, false);
3250 pp_right_paren (pp
);
3254 if (SSA_NAME_IDENTIFIER (node
))
3256 if ((flags
& TDF_NOUID
)
3257 && SSA_NAME_VAR (node
)
3258 && DECL_NAMELESS (SSA_NAME_VAR (node
)))
3259 dump_fancy_name (pp
, SSA_NAME_IDENTIFIER (node
));
3260 else if (! (flags
& TDF_GIMPLE
)
3261 || SSA_NAME_VAR (node
))
3262 dump_generic_node (pp
, SSA_NAME_IDENTIFIER (node
),
3266 pp_decimal_int (pp
, SSA_NAME_VERSION (node
));
3267 if (SSA_NAME_IS_DEFAULT_DEF (node
))
3268 pp_string (pp
, "(D)");
3269 if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (node
))
3270 pp_string (pp
, "(ab)");
3273 case WITH_SIZE_EXPR
:
3274 pp_string (pp
, "WITH_SIZE_EXPR <");
3275 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3276 pp_string (pp
, ", ");
3277 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3282 pp_string (pp
, "ASSERT_EXPR <");
3283 dump_generic_node (pp
, ASSERT_EXPR_VAR (node
), spc
, flags
, false);
3284 pp_string (pp
, ", ");
3285 dump_generic_node (pp
, ASSERT_EXPR_COND (node
), spc
, flags
, false);
3290 pp_string (pp
, "scev_known");
3293 case SCEV_NOT_KNOWN
:
3294 pp_string (pp
, "scev_not_known");
3297 case POLYNOMIAL_CHREC
:
3299 dump_generic_node (pp
, CHREC_LEFT (node
), spc
, flags
, false);
3300 pp_string (pp
, ", +, ");
3301 dump_generic_node (pp
, CHREC_RIGHT (node
), spc
, flags
, false);
3302 pp_string (pp
, "}_");
3303 pp_scalar (pp
, "%u", CHREC_VARIABLE (node
));
3307 case REALIGN_LOAD_EXPR
:
3308 pp_string (pp
, "REALIGN_LOAD <");
3309 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3310 pp_string (pp
, ", ");
3311 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3312 pp_string (pp
, ", ");
3313 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3318 pp_string (pp
, " VEC_COND_EXPR < ");
3319 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3320 pp_string (pp
, " , ");
3321 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3322 pp_string (pp
, " , ");
3323 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3324 pp_string (pp
, " > ");
3328 pp_string (pp
, " VEC_PERM_EXPR < ");
3329 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3330 pp_string (pp
, " , ");
3331 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3332 pp_string (pp
, " , ");
3333 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3334 pp_string (pp
, " > ");
3338 pp_string (pp
, " DOT_PROD_EXPR < ");
3339 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3340 pp_string (pp
, ", ");
3341 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3342 pp_string (pp
, ", ");
3343 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3344 pp_string (pp
, " > ");
3347 case WIDEN_MULT_PLUS_EXPR
:
3348 pp_string (pp
, " WIDEN_MULT_PLUS_EXPR < ");
3349 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3350 pp_string (pp
, ", ");
3351 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3352 pp_string (pp
, ", ");
3353 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3354 pp_string (pp
, " > ");
3357 case WIDEN_MULT_MINUS_EXPR
:
3358 pp_string (pp
, " WIDEN_MULT_MINUS_EXPR < ");
3359 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3360 pp_string (pp
, ", ");
3361 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3362 pp_string (pp
, ", ");
3363 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3364 pp_string (pp
, " > ");
3368 pp_string (pp
, "#pragma acc parallel");
3369 goto dump_omp_clauses_body
;
3372 pp_string (pp
, "#pragma acc kernels");
3373 goto dump_omp_clauses_body
;
3376 pp_string (pp
, "#pragma acc serial");
3377 goto dump_omp_clauses_body
;
3380 pp_string (pp
, "#pragma acc data");
3381 dump_omp_clauses (pp
, OACC_DATA_CLAUSES (node
), spc
, flags
);
3384 case OACC_HOST_DATA
:
3385 pp_string (pp
, "#pragma acc host_data");
3386 dump_omp_clauses (pp
, OACC_HOST_DATA_CLAUSES (node
), spc
, flags
);
3390 pp_string (pp
, "#pragma acc declare");
3391 dump_omp_clauses (pp
, OACC_DECLARE_CLAUSES (node
), spc
, flags
);
3395 pp_string (pp
, "#pragma acc update");
3396 dump_omp_clauses (pp
, OACC_UPDATE_CLAUSES (node
), spc
, flags
);
3399 case OACC_ENTER_DATA
:
3400 pp_string (pp
, "#pragma acc enter data");
3401 dump_omp_clauses (pp
, OACC_ENTER_DATA_CLAUSES (node
), spc
, flags
);
3404 case OACC_EXIT_DATA
:
3405 pp_string (pp
, "#pragma acc exit data");
3406 dump_omp_clauses (pp
, OACC_EXIT_DATA_CLAUSES (node
), spc
, flags
);
3410 pp_string (pp
, "#pragma acc cache");
3411 dump_omp_clauses (pp
, OACC_CACHE_CLAUSES (node
), spc
, flags
);
3415 pp_string (pp
, "#pragma omp parallel");
3416 dump_omp_clauses (pp
, OMP_PARALLEL_CLAUSES (node
), spc
, flags
);
3419 dump_omp_clauses_body
:
3420 dump_omp_clauses (pp
, OMP_CLAUSES (node
), spc
, flags
);
3424 if (!(flags
& TDF_SLIM
) && OMP_BODY (node
))
3426 newline_and_indent (pp
, spc
+ 2);
3428 newline_and_indent (pp
, spc
+ 4);
3429 dump_generic_node (pp
, OMP_BODY (node
), spc
+ 4, flags
, false);
3430 newline_and_indent (pp
, spc
+ 2);
3431 pp_right_brace (pp
);
3437 pp_string (pp
, OMP_TASK_BODY (node
) ? "#pragma omp task"
3438 : "#pragma omp taskwait");
3439 dump_omp_clauses (pp
, OMP_TASK_CLAUSES (node
), spc
, flags
);
3443 pp_string (pp
, "#pragma omp for");
3447 pp_string (pp
, "#pragma omp simd");
3450 case OMP_DISTRIBUTE
:
3451 pp_string (pp
, "#pragma omp distribute");
3455 pp_string (pp
, "#pragma omp taskloop");
3459 pp_string (pp
, "#pragma omp loop");
3463 pp_string (pp
, "#pragma acc loop");
3467 pp_string (pp
, "#pragma omp teams");
3468 dump_omp_clauses (pp
, OMP_TEAMS_CLAUSES (node
), spc
, flags
);
3471 case OMP_TARGET_DATA
:
3472 pp_string (pp
, "#pragma omp target data");
3473 dump_omp_clauses (pp
, OMP_TARGET_DATA_CLAUSES (node
), spc
, flags
);
3476 case OMP_TARGET_ENTER_DATA
:
3477 pp_string (pp
, "#pragma omp target enter data");
3478 dump_omp_clauses (pp
, OMP_TARGET_ENTER_DATA_CLAUSES (node
), spc
, flags
);
3482 case OMP_TARGET_EXIT_DATA
:
3483 pp_string (pp
, "#pragma omp target exit data");
3484 dump_omp_clauses (pp
, OMP_TARGET_EXIT_DATA_CLAUSES (node
), spc
, flags
);
3489 pp_string (pp
, "#pragma omp target");
3490 dump_omp_clauses (pp
, OMP_TARGET_CLAUSES (node
), spc
, flags
);
3493 case OMP_TARGET_UPDATE
:
3494 pp_string (pp
, "#pragma omp target update");
3495 dump_omp_clauses (pp
, OMP_TARGET_UPDATE_CLAUSES (node
), spc
, flags
);
3500 dump_omp_clauses (pp
, OMP_FOR_CLAUSES (node
), spc
, flags
);
3501 if (!(flags
& TDF_SLIM
))
3505 if (OMP_FOR_PRE_BODY (node
))
3507 newline_and_indent (pp
, spc
+ 2);
3510 newline_and_indent (pp
, spc
);
3511 dump_generic_node (pp
, OMP_FOR_PRE_BODY (node
),
3514 if (OMP_FOR_INIT (node
))
3517 for (i
= 0; i
< TREE_VEC_LENGTH (OMP_FOR_INIT (node
)); i
++)
3520 newline_and_indent (pp
, spc
);
3521 pp_string (pp
, "for (");
3522 tree init
= TREE_VEC_ELT (OMP_FOR_INIT (node
), i
);
3523 if (TREE_CODE (init
) != MODIFY_EXPR
3524 || TREE_CODE (TREE_OPERAND (init
, 1)) != TREE_VEC
)
3525 dump_generic_node (pp
, init
, spc
, flags
, false);
3528 dump_generic_node (pp
, TREE_OPERAND (init
, 0),
3530 pp_string (pp
, " = ");
3531 dump_omp_loop_non_rect_expr (pp
, TREE_OPERAND (init
, 1),
3534 pp_string (pp
, "; ");
3535 tree cond
= TREE_VEC_ELT (OMP_FOR_COND (node
), i
);
3536 if (!COMPARISON_CLASS_P (cond
)
3537 || TREE_CODE (TREE_OPERAND (cond
, 1)) != TREE_VEC
)
3538 dump_generic_node (pp
, cond
, spc
, flags
, false);
3541 dump_generic_node (pp
, TREE_OPERAND (cond
, 0),
3543 const char *op
= op_symbol (cond
);
3547 dump_omp_loop_non_rect_expr (pp
, TREE_OPERAND (cond
, 1),
3550 pp_string (pp
, "; ");
3551 dump_generic_node (pp
,
3552 TREE_VEC_ELT (OMP_FOR_INCR (node
), i
),
3554 pp_right_paren (pp
);
3557 if (OMP_FOR_BODY (node
))
3559 newline_and_indent (pp
, spc
+ 2);
3561 newline_and_indent (pp
, spc
+ 4);
3562 dump_generic_node (pp
, OMP_FOR_BODY (node
), spc
+ 4, flags
,
3564 newline_and_indent (pp
, spc
+ 2);
3565 pp_right_brace (pp
);
3567 if (OMP_FOR_INIT (node
))
3568 spc
-= 2 * TREE_VEC_LENGTH (OMP_FOR_INIT (node
)) - 2;
3569 if (OMP_FOR_PRE_BODY (node
))
3572 newline_and_indent (pp
, spc
+ 2);
3573 pp_right_brace (pp
);
3580 pp_string (pp
, "#pragma omp sections");
3581 dump_omp_clauses (pp
, OMP_SECTIONS_CLAUSES (node
), spc
, flags
);
3585 pp_string (pp
, "#pragma omp section");
3589 if (OMP_SCAN_CLAUSES (node
))
3591 pp_string (pp
, "#pragma omp scan");
3592 dump_omp_clauses (pp
, OMP_SCAN_CLAUSES (node
), spc
, flags
);
3597 pp_string (pp
, "#pragma omp master");
3601 pp_string (pp
, "#pragma omp masked");
3602 dump_omp_clauses (pp
, OMP_MASKED_CLAUSES (node
), spc
, flags
);
3606 pp_string (pp
, "#pragma omp taskgroup");
3607 dump_omp_clauses (pp
, OMP_TASKGROUP_CLAUSES (node
), spc
, flags
);
3611 pp_string (pp
, "#pragma omp ordered");
3612 dump_omp_clauses (pp
, OMP_ORDERED_CLAUSES (node
), spc
, flags
);
3616 pp_string (pp
, "#pragma omp critical");
3617 if (OMP_CRITICAL_NAME (node
))
3621 dump_generic_node (pp
, OMP_CRITICAL_NAME (node
), spc
,
3623 pp_right_paren (pp
);
3625 dump_omp_clauses (pp
, OMP_CRITICAL_CLAUSES (node
), spc
, flags
);
3629 pp_string (pp
, "#pragma omp atomic");
3630 dump_omp_atomic_memory_order (pp
, OMP_ATOMIC_MEMORY_ORDER (node
));
3631 newline_and_indent (pp
, spc
+ 2);
3632 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3636 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3639 case OMP_ATOMIC_READ
:
3640 pp_string (pp
, "#pragma omp atomic read");
3641 dump_omp_atomic_memory_order (pp
, OMP_ATOMIC_MEMORY_ORDER (node
));
3642 newline_and_indent (pp
, spc
+ 2);
3643 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3647 case OMP_ATOMIC_CAPTURE_OLD
:
3648 case OMP_ATOMIC_CAPTURE_NEW
:
3649 pp_string (pp
, "#pragma omp atomic capture");
3650 dump_omp_atomic_memory_order (pp
, OMP_ATOMIC_MEMORY_ORDER (node
));
3651 newline_and_indent (pp
, spc
+ 2);
3652 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3656 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3660 pp_string (pp
, "#pragma omp single");
3661 dump_omp_clauses (pp
, OMP_SINGLE_CLAUSES (node
), spc
, flags
);
3665 pp_string (pp
, "#pragma omp scope");
3666 dump_omp_clauses (pp
, OMP_SCOPE_CLAUSES (node
), spc
, flags
);
3670 /* If we come here, we're dumping something that's not an OMP construct,
3671 for example, OMP clauses attached to a function's '__attribute__'.
3672 Dump the whole OMP clause chain. */
3673 dump_omp_clauses (pp
, node
, spc
, flags
, false);
3677 case TRANSACTION_EXPR
:
3678 if (TRANSACTION_EXPR_OUTER (node
))
3679 pp_string (pp
, "__transaction_atomic [[outer]]");
3680 else if (TRANSACTION_EXPR_RELAXED (node
))
3681 pp_string (pp
, "__transaction_relaxed");
3683 pp_string (pp
, "__transaction_atomic");
3684 if (!(flags
& TDF_SLIM
) && TRANSACTION_EXPR_BODY (node
))
3686 newline_and_indent (pp
, spc
);
3688 newline_and_indent (pp
, spc
+ 2);
3689 dump_generic_node (pp
, TRANSACTION_EXPR_BODY (node
),
3690 spc
+ 2, flags
, false);
3691 newline_and_indent (pp
, spc
);
3692 pp_right_brace (pp
);
3697 case VEC_SERIES_EXPR
:
3698 case VEC_WIDEN_MULT_HI_EXPR
:
3699 case VEC_WIDEN_MULT_LO_EXPR
:
3700 case VEC_WIDEN_PLUS_HI_EXPR
:
3701 case VEC_WIDEN_PLUS_LO_EXPR
:
3702 case VEC_WIDEN_MINUS_HI_EXPR
:
3703 case VEC_WIDEN_MINUS_LO_EXPR
:
3704 case VEC_WIDEN_MULT_EVEN_EXPR
:
3705 case VEC_WIDEN_MULT_ODD_EXPR
:
3706 case VEC_WIDEN_LSHIFT_HI_EXPR
:
3707 case VEC_WIDEN_LSHIFT_LO_EXPR
:
3709 for (str
= get_tree_code_name (code
); *str
; str
++)
3710 pp_character (pp
, TOUPPER (*str
));
3711 pp_string (pp
, " < ");
3712 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3713 pp_string (pp
, ", ");
3714 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3715 pp_string (pp
, " > ");
3718 case VEC_DUPLICATE_EXPR
:
3720 for (str
= get_tree_code_name (code
); *str
; str
++)
3721 pp_character (pp
, TOUPPER (*str
));
3722 pp_string (pp
, " < ");
3723 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3724 pp_string (pp
, " > ");
3727 case VEC_UNPACK_HI_EXPR
:
3728 pp_string (pp
, " VEC_UNPACK_HI_EXPR < ");
3729 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3730 pp_string (pp
, " > ");
3733 case VEC_UNPACK_LO_EXPR
:
3734 pp_string (pp
, " VEC_UNPACK_LO_EXPR < ");
3735 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3736 pp_string (pp
, " > ");
3739 case VEC_UNPACK_FLOAT_HI_EXPR
:
3740 pp_string (pp
, " VEC_UNPACK_FLOAT_HI_EXPR < ");
3741 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3742 pp_string (pp
, " > ");
3745 case VEC_UNPACK_FLOAT_LO_EXPR
:
3746 pp_string (pp
, " VEC_UNPACK_FLOAT_LO_EXPR < ");
3747 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3748 pp_string (pp
, " > ");
3751 case VEC_UNPACK_FIX_TRUNC_HI_EXPR
:
3752 pp_string (pp
, " VEC_UNPACK_FIX_TRUNC_HI_EXPR < ");
3753 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3754 pp_string (pp
, " > ");
3757 case VEC_UNPACK_FIX_TRUNC_LO_EXPR
:
3758 pp_string (pp
, " VEC_UNPACK_FIX_TRUNC_LO_EXPR < ");
3759 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3760 pp_string (pp
, " > ");
3763 case VEC_PACK_TRUNC_EXPR
:
3764 pp_string (pp
, " VEC_PACK_TRUNC_EXPR < ");
3765 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3766 pp_string (pp
, ", ");
3767 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3768 pp_string (pp
, " > ");
3771 case VEC_PACK_SAT_EXPR
:
3772 pp_string (pp
, " VEC_PACK_SAT_EXPR < ");
3773 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3774 pp_string (pp
, ", ");
3775 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3776 pp_string (pp
, " > ");
3779 case VEC_PACK_FIX_TRUNC_EXPR
:
3780 pp_string (pp
, " VEC_PACK_FIX_TRUNC_EXPR < ");
3781 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3782 pp_string (pp
, ", ");
3783 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3784 pp_string (pp
, " > ");
3787 case VEC_PACK_FLOAT_EXPR
:
3788 pp_string (pp
, " VEC_PACK_FLOAT_EXPR < ");
3789 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3790 pp_string (pp
, ", ");
3791 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3792 pp_string (pp
, " > ");
3796 dump_block_node (pp
, node
, spc
, flags
);
3799 case DEBUG_BEGIN_STMT
:
3800 pp_string (pp
, "# DEBUG BEGIN STMT");
3807 if (is_stmt
&& is_expr
)
3813 /* Print the declaration of a variable. */
3816 print_declaration (pretty_printer
*pp
, tree t
, int spc
, dump_flags_t flags
)
3820 if (TREE_CODE(t
) == NAMELIST_DECL
)
3822 pp_string(pp
, "namelist ");
3823 dump_decl_name (pp
, t
, flags
);
3828 if (TREE_CODE (t
) == TYPE_DECL
)
3829 pp_string (pp
, "typedef ");
3831 if (CODE_CONTAINS_STRUCT (TREE_CODE (t
), TS_DECL_WRTL
) && DECL_REGISTER (t
))
3832 pp_string (pp
, "register ");
3834 if (TREE_PUBLIC (t
) && DECL_EXTERNAL (t
))
3835 pp_string (pp
, "extern ");
3836 else if (TREE_STATIC (t
))
3837 pp_string (pp
, "static ");
3839 /* Print the type and name. */
3840 if (TREE_TYPE (t
) && TREE_CODE (TREE_TYPE (t
)) == ARRAY_TYPE
)
3844 /* Print array's type. */
3845 tmp
= TREE_TYPE (t
);
3846 while (TREE_CODE (TREE_TYPE (tmp
)) == ARRAY_TYPE
)
3847 tmp
= TREE_TYPE (tmp
);
3848 dump_generic_node (pp
, TREE_TYPE (tmp
), spc
, flags
, false);
3850 /* Print variable's name. */
3852 dump_generic_node (pp
, t
, spc
, flags
, false);
3854 /* Print the dimensions. */
3855 tmp
= TREE_TYPE (t
);
3856 while (TREE_CODE (tmp
) == ARRAY_TYPE
)
3858 dump_array_domain (pp
, TYPE_DOMAIN (tmp
), spc
, flags
);
3859 tmp
= TREE_TYPE (tmp
);
3862 else if (TREE_CODE (t
) == FUNCTION_DECL
)
3864 dump_generic_node (pp
, TREE_TYPE (TREE_TYPE (t
)), spc
, flags
, false);
3866 dump_decl_name (pp
, t
, flags
);
3867 dump_function_declaration (pp
, TREE_TYPE (t
), spc
, flags
);
3871 /* Print type declaration. */
3872 dump_generic_node (pp
, TREE_TYPE (t
), spc
, flags
, false);
3874 /* Print variable's name. */
3876 dump_generic_node (pp
, t
, spc
, flags
, false);
3879 if (VAR_P (t
) && DECL_HARD_REGISTER (t
))
3881 pp_string (pp
, " __asm__ ");
3883 dump_generic_node (pp
, DECL_ASSEMBLER_NAME (t
), spc
, flags
, false);
3884 pp_right_paren (pp
);
3887 /* The initial value of a function serves to determine whether the function
3888 is declared or defined. So the following does not apply to function
3890 if (TREE_CODE (t
) != FUNCTION_DECL
)
3892 /* Print the initial value. */
3893 if (DECL_INITIAL (t
))
3898 if (!(flags
& TDF_SLIM
))
3899 dump_generic_node (pp
, DECL_INITIAL (t
), spc
, flags
, false);
3901 pp_string (pp
, "<<< omitted >>>");
3905 if (VAR_P (t
) && DECL_HAS_VALUE_EXPR_P (t
))
3907 pp_string (pp
, " [value-expr: ");
3908 dump_generic_node (pp
, DECL_VALUE_EXPR (t
), spc
, flags
, false);
3909 pp_right_bracket (pp
);
3916 /* Prints a structure: name, fields, and methods.
3917 FIXME: Still incomplete. */
3920 print_struct_decl (pretty_printer
*pp
, const_tree node
, int spc
,
3923 /* Print the name of the structure. */
3924 if (TYPE_NAME (node
))
3927 if (TREE_CODE (node
) == RECORD_TYPE
)
3928 pp_string (pp
, "struct ");
3929 else if ((TREE_CODE (node
) == UNION_TYPE
3930 || TREE_CODE (node
) == QUAL_UNION_TYPE
))
3931 pp_string (pp
, "union ");
3933 dump_generic_node (pp
, TYPE_NAME (node
), spc
, TDF_NONE
, false);
3936 /* Print the contents of the structure. */
3942 /* Print the fields of the structure. */
3945 tmp
= TYPE_FIELDS (node
);
3948 /* Avoid to print recursively the structure. */
3949 /* FIXME : Not implemented correctly...,
3950 what about the case when we have a cycle in the contain graph? ...
3951 Maybe this could be solved by looking at the scope in which the
3952 structure was declared. */
3953 if (TREE_TYPE (tmp
) != node
3954 && (TREE_CODE (TREE_TYPE (tmp
)) != POINTER_TYPE
3955 || TREE_TYPE (TREE_TYPE (tmp
)) != node
))
3957 print_declaration (pp
, tmp
, spc
+2, flags
);
3960 tmp
= DECL_CHAIN (tmp
);
3964 pp_right_brace (pp
);
3967 /* Return the priority of the operator CODE.
3969 From lowest to highest precedence with either left-to-right (L-R)
3970 or right-to-left (R-L) associativity]:
3973 2 [R-L] = += -= *= /= %= &= ^= |= <<= >>=
3985 14 [R-L] ! ~ ++ -- + - * & (type) sizeof
3986 15 [L-R] fn() [] -> .
3988 unary +, - and * have higher precedence than the corresponding binary
3992 op_code_prio (enum tree_code code
)
4009 case TRUTH_ORIF_EXPR
:
4012 case TRUTH_AND_EXPR
:
4013 case TRUTH_ANDIF_EXPR
:
4020 case TRUTH_XOR_EXPR
:
4037 case UNORDERED_EXPR
:
4048 case VEC_WIDEN_LSHIFT_HI_EXPR
:
4049 case VEC_WIDEN_LSHIFT_LO_EXPR
:
4050 case WIDEN_LSHIFT_EXPR
:
4053 case WIDEN_SUM_EXPR
:
4055 case POINTER_PLUS_EXPR
:
4056 case POINTER_DIFF_EXPR
:
4060 case VEC_WIDEN_MULT_HI_EXPR
:
4061 case VEC_WIDEN_MULT_LO_EXPR
:
4062 case WIDEN_MULT_EXPR
:
4064 case WIDEN_MULT_PLUS_EXPR
:
4065 case WIDEN_MULT_MINUS_EXPR
:
4067 case MULT_HIGHPART_EXPR
:
4068 case TRUNC_DIV_EXPR
:
4070 case FLOOR_DIV_EXPR
:
4071 case ROUND_DIV_EXPR
:
4073 case EXACT_DIV_EXPR
:
4074 case TRUNC_MOD_EXPR
:
4076 case FLOOR_MOD_EXPR
:
4077 case ROUND_MOD_EXPR
:
4080 case TRUTH_NOT_EXPR
:
4082 case POSTINCREMENT_EXPR
:
4083 case POSTDECREMENT_EXPR
:
4084 case PREINCREMENT_EXPR
:
4085 case PREDECREMENT_EXPR
:
4091 case FIX_TRUNC_EXPR
:
4097 case ARRAY_RANGE_REF
:
4101 /* Special expressions. */
4107 case VEC_UNPACK_HI_EXPR
:
4108 case VEC_UNPACK_LO_EXPR
:
4109 case VEC_UNPACK_FLOAT_HI_EXPR
:
4110 case VEC_UNPACK_FLOAT_LO_EXPR
:
4111 case VEC_UNPACK_FIX_TRUNC_HI_EXPR
:
4112 case VEC_UNPACK_FIX_TRUNC_LO_EXPR
:
4113 case VEC_PACK_TRUNC_EXPR
:
4114 case VEC_PACK_SAT_EXPR
:
4118 /* Return an arbitrarily high precedence to avoid surrounding single
4119 VAR_DECLs in ()s. */
4124 /* Return the priority of the operator OP. */
4127 op_prio (const_tree op
)
4129 enum tree_code code
;
4134 code
= TREE_CODE (op
);
4135 if (code
== SAVE_EXPR
|| code
== NON_LVALUE_EXPR
)
4136 return op_prio (TREE_OPERAND (op
, 0));
4138 return op_code_prio (code
);
4141 /* Return the symbol associated with operator CODE. */
4144 op_symbol_code (enum tree_code code
)
4152 case TRUTH_ORIF_EXPR
:
4155 case TRUTH_AND_EXPR
:
4156 case TRUTH_ANDIF_EXPR
:
4162 case TRUTH_XOR_EXPR
:
4172 case UNORDERED_EXPR
:
4218 case WIDEN_LSHIFT_EXPR
:
4221 case WIDEN_PLUS_EXPR
:
4224 case WIDEN_MINUS_EXPR
:
4227 case POINTER_PLUS_EXPR
:
4233 case WIDEN_SUM_EXPR
:
4236 case WIDEN_MULT_EXPR
:
4239 case MULT_HIGHPART_EXPR
:
4244 case POINTER_DIFF_EXPR
:
4250 case TRUTH_NOT_EXPR
:
4257 case TRUNC_DIV_EXPR
:
4264 case FLOOR_DIV_EXPR
:
4267 case ROUND_DIV_EXPR
:
4270 case EXACT_DIV_EXPR
:
4273 case TRUNC_MOD_EXPR
:
4279 case FLOOR_MOD_EXPR
:
4282 case ROUND_MOD_EXPR
:
4285 case PREDECREMENT_EXPR
:
4288 case PREINCREMENT_EXPR
:
4291 case POSTDECREMENT_EXPR
:
4294 case POSTINCREMENT_EXPR
:
4304 return "<<< ??? >>>";
4308 /* Return the symbol associated with operator OP. */
4311 op_symbol (const_tree op
)
4313 return op_symbol_code (TREE_CODE (op
));
4316 /* Prints the name of a call. NODE is the CALL_EXPR_FN of a CALL_EXPR or
4317 the gimple_call_fn of a GIMPLE_CALL. */
4320 print_call_name (pretty_printer
*pp
, tree node
, dump_flags_t flags
)
4324 if (TREE_CODE (op0
) == NON_LVALUE_EXPR
)
4325 op0
= TREE_OPERAND (op0
, 0);
4328 switch (TREE_CODE (op0
))
4333 dump_function_name (pp
, op0
, flags
);
4339 op0
= TREE_OPERAND (op0
, 0);
4344 dump_generic_node (pp
, TREE_OPERAND (op0
, 0), 0, flags
, false);
4345 pp_string (pp
, ") ? ");
4346 dump_generic_node (pp
, TREE_OPERAND (op0
, 1), 0, flags
, false);
4347 pp_string (pp
, " : ");
4348 dump_generic_node (pp
, TREE_OPERAND (op0
, 2), 0, flags
, false);
4352 if (TREE_CODE (TREE_OPERAND (op0
, 0)) == VAR_DECL
)
4353 dump_function_name (pp
, TREE_OPERAND (op0
, 0), flags
);
4355 dump_generic_node (pp
, op0
, 0, flags
, false);
4359 if (integer_zerop (TREE_OPERAND (op0
, 1)))
4361 op0
= TREE_OPERAND (op0
, 0);
4368 dump_generic_node (pp
, op0
, 0, flags
, false);
4376 /* Print the first N characters in the array STR, replacing non-printable
4377 characters (including embedded nuls) with unambiguous escape sequences. */
4380 pretty_print_string (pretty_printer
*pp
, const char *str
, size_t n
)
4385 for ( ; n
; --n
, ++str
)
4390 pp_string (pp
, "\\b");
4394 pp_string (pp
, "\\f");
4398 pp_string (pp
, "\\n");
4402 pp_string (pp
, "\\r");
4406 pp_string (pp
, "\\t");
4410 pp_string (pp
, "\\v");
4414 pp_string (pp
, "\\\\");
4418 pp_string (pp
, "\\\"");
4422 pp_string (pp
, "\\'");
4426 if (str
[0] || n
> 1)
4428 if (!ISPRINT (str
[0]))
4431 sprintf (buf
, "\\x%02x", (unsigned char)str
[0]);
4432 pp_string (pp
, buf
);
4435 pp_character (pp
, str
[0]);
4443 maybe_init_pretty_print (FILE *file
)
4447 tree_pp
= new pretty_printer ();
4448 pp_needs_newline (tree_pp
) = true;
4449 pp_translate_identifiers (tree_pp
) = false;
4452 tree_pp
->buffer
->stream
= file
;
4456 newline_and_indent (pretty_printer
*pp
, int spc
)
4462 /* Print the identifier ID to PRETTY-PRINTER. */
4465 pp_tree_identifier (pretty_printer
*pp
, tree id
)
4467 if (pp_translate_identifiers (pp
))
4469 const char *text
= identifier_to_locale (IDENTIFIER_POINTER (id
));
4470 pp_append_text (pp
, text
, text
+ strlen (text
));
4473 pp_append_text (pp
, IDENTIFIER_POINTER (id
),
4474 IDENTIFIER_POINTER (id
) + IDENTIFIER_LENGTH (id
));
4477 /* A helper function that is used to dump function information before the
4481 dump_function_header (FILE *dump_file
, tree fdecl
, dump_flags_t flags
)
4483 const char *dname
, *aname
;
4484 struct cgraph_node
*node
= cgraph_node::get (fdecl
);
4485 struct function
*fun
= DECL_STRUCT_FUNCTION (fdecl
);
4487 dname
= lang_hooks
.decl_printable_name (fdecl
, 1);
4489 if (DECL_ASSEMBLER_NAME_SET_P (fdecl
))
4490 aname
= (IDENTIFIER_POINTER
4491 (DECL_ASSEMBLER_NAME (fdecl
)));
4493 aname
= "<unset-asm-name>";
4495 fprintf (dump_file
, "\n;; Function %s (%s, funcdef_no=%d",
4496 dname
, aname
, fun
->funcdef_no
);
4497 if (!(flags
& TDF_NOUID
))
4498 fprintf (dump_file
, ", decl_uid=%d", DECL_UID (fdecl
));
4501 fprintf (dump_file
, ", cgraph_uid=%d", node
->get_uid ());
4502 fprintf (dump_file
, ", symbol_order=%d)%s\n\n", node
->order
,
4503 node
->frequency
== NODE_FREQUENCY_HOT
4505 : node
->frequency
== NODE_FREQUENCY_UNLIKELY_EXECUTED
4506 ? " (unlikely executed)"
4507 : node
->frequency
== NODE_FREQUENCY_EXECUTED_ONCE
4508 ? " (executed once)"
4512 fprintf (dump_file
, ")\n\n");
4515 /* Dump double_int D to pretty_printer PP. UNS is true
4516 if D is unsigned and false otherwise. */
4518 pp_double_int (pretty_printer
*pp
, double_int d
, bool uns
)
4521 pp_wide_integer (pp
, d
.low
);
4522 else if (d
.fits_uhwi ())
4523 pp_unsigned_wide_integer (pp
, d
.low
);
4526 unsigned HOST_WIDE_INT low
= d
.low
;
4527 HOST_WIDE_INT high
= d
.high
;
4528 if (!uns
&& d
.is_negative ())
4531 high
= ~high
+ !low
;
4534 /* Would "%x%0*x" or "%x%*0x" get zero-padding on all
4536 sprintf (pp_buffer (pp
)->digit_buffer
,
4537 HOST_WIDE_INT_PRINT_DOUBLE_HEX
,
4538 (unsigned HOST_WIDE_INT
) high
, low
);
4539 pp_string (pp
, pp_buffer (pp
)->digit_buffer
);
4544 # pragma GCC diagnostic pop