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 OpenMP clause CLAUSE. PP, CLAUSE, SPC and FLAGS are as in
446 dump_generic_node. */
449 dump_omp_clause (pretty_printer
*pp
, tree clause
, int spc
, dump_flags_t flags
)
452 const char *modifier
= NULL
;
453 switch (OMP_CLAUSE_CODE (clause
))
455 case OMP_CLAUSE_PRIVATE
:
458 case OMP_CLAUSE_SHARED
:
461 case OMP_CLAUSE_FIRSTPRIVATE
:
462 name
= "firstprivate";
464 case OMP_CLAUSE_LASTPRIVATE
:
465 name
= "lastprivate";
466 if (OMP_CLAUSE_LASTPRIVATE_CONDITIONAL (clause
))
467 modifier
= "conditional:";
469 case OMP_CLAUSE_COPYIN
:
472 case OMP_CLAUSE_COPYPRIVATE
:
473 name
= "copyprivate";
475 case OMP_CLAUSE_UNIFORM
:
478 case OMP_CLAUSE_USE_DEVICE_PTR
:
479 name
= "use_device_ptr";
480 if (OMP_CLAUSE_USE_DEVICE_PTR_IF_PRESENT (clause
))
481 modifier
= "if_present:";
483 case OMP_CLAUSE_USE_DEVICE_ADDR
:
484 name
= "use_device_addr";
486 case OMP_CLAUSE_IS_DEVICE_PTR
:
487 name
= "is_device_ptr";
489 case OMP_CLAUSE_INCLUSIVE
:
492 case OMP_CLAUSE_EXCLUSIVE
:
495 case OMP_CLAUSE__LOOPTEMP_
:
498 case OMP_CLAUSE__REDUCTEMP_
:
499 name
= "_reductemp_";
501 case OMP_CLAUSE__CONDTEMP_
:
504 case OMP_CLAUSE__SCANTEMP_
:
507 case OMP_CLAUSE_TO_DECLARE
:
510 case OMP_CLAUSE_LINK
:
513 case OMP_CLAUSE_NONTEMPORAL
:
514 name
= "nontemporal";
517 pp_string (pp
, name
);
520 pp_string (pp
, modifier
);
521 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
526 case OMP_CLAUSE_TASK_REDUCTION
:
527 case OMP_CLAUSE_IN_REDUCTION
:
528 pp_string (pp
, OMP_CLAUSE_CODE (clause
) == OMP_CLAUSE_IN_REDUCTION
531 case OMP_CLAUSE_REDUCTION
:
532 pp_string (pp
, "reduction(");
533 if (OMP_CLAUSE_CODE (clause
) == OMP_CLAUSE_REDUCTION
)
535 if (OMP_CLAUSE_REDUCTION_TASK (clause
))
536 pp_string (pp
, "task,");
537 else if (OMP_CLAUSE_REDUCTION_INSCAN (clause
))
538 pp_string (pp
, "inscan,");
540 if (OMP_CLAUSE_REDUCTION_CODE (clause
) != ERROR_MARK
)
543 op_symbol_code (OMP_CLAUSE_REDUCTION_CODE (clause
)));
546 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
552 pp_string (pp
, "if(");
553 switch (OMP_CLAUSE_IF_MODIFIER (clause
))
555 case ERROR_MARK
: break;
556 case VOID_CST
: pp_string (pp
, "cancel:"); break;
557 case OMP_PARALLEL
: pp_string (pp
, "parallel:"); break;
558 case OMP_SIMD
: pp_string (pp
, "simd:"); break;
559 case OMP_TASK
: pp_string (pp
, "task:"); break;
560 case OMP_TASKLOOP
: pp_string (pp
, "taskloop:"); break;
561 case OMP_TARGET_DATA
: pp_string (pp
, "target data:"); break;
562 case OMP_TARGET
: pp_string (pp
, "target:"); break;
563 case OMP_TARGET_UPDATE
: pp_string (pp
, "target update:"); break;
564 case OMP_TARGET_ENTER_DATA
:
565 pp_string (pp
, "target enter data:"); break;
566 case OMP_TARGET_EXIT_DATA
: pp_string (pp
, "target exit data:"); break;
567 default: gcc_unreachable ();
569 dump_generic_node (pp
, OMP_CLAUSE_IF_EXPR (clause
),
574 case OMP_CLAUSE_NUM_THREADS
:
575 pp_string (pp
, "num_threads(");
576 dump_generic_node (pp
, OMP_CLAUSE_NUM_THREADS_EXPR (clause
),
581 case OMP_CLAUSE_NOWAIT
:
582 pp_string (pp
, "nowait");
584 case OMP_CLAUSE_ORDERED
:
585 pp_string (pp
, "ordered");
586 if (OMP_CLAUSE_ORDERED_EXPR (clause
))
589 dump_generic_node (pp
, OMP_CLAUSE_ORDERED_EXPR (clause
),
595 case OMP_CLAUSE_DEFAULT
:
596 pp_string (pp
, "default(");
597 switch (OMP_CLAUSE_DEFAULT_KIND (clause
))
599 case OMP_CLAUSE_DEFAULT_UNSPECIFIED
:
601 case OMP_CLAUSE_DEFAULT_SHARED
:
602 pp_string (pp
, "shared");
604 case OMP_CLAUSE_DEFAULT_NONE
:
605 pp_string (pp
, "none");
607 case OMP_CLAUSE_DEFAULT_PRIVATE
:
608 pp_string (pp
, "private");
610 case OMP_CLAUSE_DEFAULT_FIRSTPRIVATE
:
611 pp_string (pp
, "firstprivate");
613 case OMP_CLAUSE_DEFAULT_PRESENT
:
614 pp_string (pp
, "present");
622 case OMP_CLAUSE_SCHEDULE
:
623 pp_string (pp
, "schedule(");
624 if (OMP_CLAUSE_SCHEDULE_KIND (clause
)
625 & (OMP_CLAUSE_SCHEDULE_MONOTONIC
626 | OMP_CLAUSE_SCHEDULE_NONMONOTONIC
))
628 if (OMP_CLAUSE_SCHEDULE_KIND (clause
)
629 & OMP_CLAUSE_SCHEDULE_MONOTONIC
)
630 pp_string (pp
, "monotonic");
632 pp_string (pp
, "nonmonotonic");
633 if (OMP_CLAUSE_SCHEDULE_SIMD (clause
))
638 if (OMP_CLAUSE_SCHEDULE_SIMD (clause
))
639 pp_string (pp
, "simd:");
641 switch (OMP_CLAUSE_SCHEDULE_KIND (clause
) & OMP_CLAUSE_SCHEDULE_MASK
)
643 case OMP_CLAUSE_SCHEDULE_STATIC
:
644 pp_string (pp
, "static");
646 case OMP_CLAUSE_SCHEDULE_DYNAMIC
:
647 pp_string (pp
, "dynamic");
649 case OMP_CLAUSE_SCHEDULE_GUIDED
:
650 pp_string (pp
, "guided");
652 case OMP_CLAUSE_SCHEDULE_RUNTIME
:
653 pp_string (pp
, "runtime");
655 case OMP_CLAUSE_SCHEDULE_AUTO
:
656 pp_string (pp
, "auto");
661 if (OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (clause
))
664 dump_generic_node (pp
, OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (clause
),
670 case OMP_CLAUSE_UNTIED
:
671 pp_string (pp
, "untied");
674 case OMP_CLAUSE_COLLAPSE
:
675 pp_string (pp
, "collapse(");
676 dump_generic_node (pp
, OMP_CLAUSE_COLLAPSE_EXPR (clause
),
681 case OMP_CLAUSE_FINAL
:
682 pp_string (pp
, "final(");
683 dump_generic_node (pp
, OMP_CLAUSE_FINAL_EXPR (clause
),
688 case OMP_CLAUSE_MERGEABLE
:
689 pp_string (pp
, "mergeable");
692 case OMP_CLAUSE_LINEAR
:
693 pp_string (pp
, "linear(");
694 switch (OMP_CLAUSE_LINEAR_KIND (clause
))
696 case OMP_CLAUSE_LINEAR_DEFAULT
:
698 case OMP_CLAUSE_LINEAR_REF
:
699 pp_string (pp
, "ref(");
701 case OMP_CLAUSE_LINEAR_VAL
:
702 pp_string (pp
, "val(");
704 case OMP_CLAUSE_LINEAR_UVAL
:
705 pp_string (pp
, "uval(");
710 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
712 if (OMP_CLAUSE_LINEAR_KIND (clause
) != OMP_CLAUSE_LINEAR_DEFAULT
)
715 dump_generic_node (pp
, OMP_CLAUSE_LINEAR_STEP (clause
),
720 case OMP_CLAUSE_ALIGNED
:
721 pp_string (pp
, "aligned(");
722 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
724 if (OMP_CLAUSE_ALIGNED_ALIGNMENT (clause
))
727 dump_generic_node (pp
, OMP_CLAUSE_ALIGNED_ALIGNMENT (clause
),
733 case OMP_CLAUSE_ALLOCATE
:
734 pp_string (pp
, "allocate(");
735 if (OMP_CLAUSE_ALLOCATE_ALLOCATOR (clause
))
737 dump_generic_node (pp
, OMP_CLAUSE_ALLOCATE_ALLOCATOR (clause
),
741 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
746 case OMP_CLAUSE_AFFINITY
:
747 pp_string (pp
, "affinity(");
749 tree t
= OMP_CLAUSE_DECL (clause
);
750 if (TREE_CODE (t
) == TREE_LIST
752 && TREE_CODE (TREE_PURPOSE (t
)) == TREE_VEC
)
754 dump_omp_iterators (pp
, TREE_PURPOSE (t
), spc
, flags
);
758 dump_generic_node (pp
, t
, spc
, flags
, false);
762 case OMP_CLAUSE_DEPEND
:
763 pp_string (pp
, "depend(");
764 switch (OMP_CLAUSE_DEPEND_KIND (clause
))
766 case OMP_CLAUSE_DEPEND_DEPOBJ
:
769 case OMP_CLAUSE_DEPEND_IN
:
772 case OMP_CLAUSE_DEPEND_OUT
:
775 case OMP_CLAUSE_DEPEND_INOUT
:
778 case OMP_CLAUSE_DEPEND_MUTEXINOUTSET
:
779 name
= "mutexinoutset";
781 case OMP_CLAUSE_DEPEND_SOURCE
:
782 pp_string (pp
, "source)");
784 case OMP_CLAUSE_DEPEND_LAST
:
785 name
= "__internal__";
787 case OMP_CLAUSE_DEPEND_SINK
:
788 pp_string (pp
, "sink:");
789 for (tree t
= OMP_CLAUSE_DECL (clause
); t
; t
= TREE_CHAIN (t
))
790 if (TREE_CODE (t
) == TREE_LIST
)
792 dump_generic_node (pp
, TREE_VALUE (t
), spc
, flags
, false);
793 if (TREE_PURPOSE (t
) != integer_zero_node
)
795 if (OMP_CLAUSE_DEPEND_SINK_NEGATIVE (t
))
799 dump_generic_node (pp
, TREE_PURPOSE (t
), spc
, flags
,
813 tree t
= OMP_CLAUSE_DECL (clause
);
814 if (TREE_CODE (t
) == TREE_LIST
816 && TREE_CODE (TREE_PURPOSE (t
)) == TREE_VEC
)
818 dump_omp_iterators (pp
, TREE_PURPOSE (t
), spc
, flags
);
824 pp_string (pp
, name
);
827 dump_generic_node (pp
, t
, spc
, flags
, false);
833 pp_string (pp
, "map(");
834 switch (OMP_CLAUSE_MAP_KIND (clause
))
837 case GOMP_MAP_POINTER
:
838 pp_string (pp
, "alloc");
840 case GOMP_MAP_IF_PRESENT
:
841 pp_string (pp
, "no_alloc");
844 case GOMP_MAP_TO_PSET
:
845 pp_string (pp
, "to");
848 pp_string (pp
, "from");
850 case GOMP_MAP_TOFROM
:
851 pp_string (pp
, "tofrom");
853 case GOMP_MAP_FORCE_ALLOC
:
854 pp_string (pp
, "force_alloc");
856 case GOMP_MAP_FORCE_TO
:
857 pp_string (pp
, "force_to");
859 case GOMP_MAP_FORCE_FROM
:
860 pp_string (pp
, "force_from");
862 case GOMP_MAP_FORCE_TOFROM
:
863 pp_string (pp
, "force_tofrom");
865 case GOMP_MAP_FORCE_PRESENT
:
866 pp_string (pp
, "force_present");
868 case GOMP_MAP_DELETE
:
869 pp_string (pp
, "delete");
871 case GOMP_MAP_FORCE_DEVICEPTR
:
872 pp_string (pp
, "force_deviceptr");
874 case GOMP_MAP_ALWAYS_TO
:
875 pp_string (pp
, "always,to");
877 case GOMP_MAP_ALWAYS_FROM
:
878 pp_string (pp
, "always,from");
880 case GOMP_MAP_ALWAYS_TOFROM
:
881 pp_string (pp
, "always,tofrom");
883 case GOMP_MAP_RELEASE
:
884 pp_string (pp
, "release");
886 case GOMP_MAP_FIRSTPRIVATE_POINTER
:
887 pp_string (pp
, "firstprivate");
889 case GOMP_MAP_FIRSTPRIVATE_REFERENCE
:
890 pp_string (pp
, "firstprivate ref");
892 case GOMP_MAP_STRUCT
:
893 pp_string (pp
, "struct");
895 case GOMP_MAP_ALWAYS_POINTER
:
896 pp_string (pp
, "always_pointer");
898 case GOMP_MAP_DEVICE_RESIDENT
:
899 pp_string (pp
, "device_resident");
902 pp_string (pp
, "link");
904 case GOMP_MAP_ATTACH
:
905 pp_string (pp
, "attach");
907 case GOMP_MAP_DETACH
:
908 pp_string (pp
, "detach");
910 case GOMP_MAP_FORCE_DETACH
:
911 pp_string (pp
, "force_detach");
913 case GOMP_MAP_ATTACH_DETACH
:
914 pp_string (pp
, "attach_detach");
920 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
923 if (OMP_CLAUSE_SIZE (clause
))
925 switch (OMP_CLAUSE_CODE (clause
) == OMP_CLAUSE_MAP
926 ? OMP_CLAUSE_MAP_KIND (clause
) : GOMP_MAP_TO
)
928 case GOMP_MAP_POINTER
:
929 case GOMP_MAP_FIRSTPRIVATE_POINTER
:
930 case GOMP_MAP_FIRSTPRIVATE_REFERENCE
:
931 case GOMP_MAP_ALWAYS_POINTER
:
932 pp_string (pp
, " [pointer assign, bias: ");
934 case GOMP_MAP_TO_PSET
:
935 pp_string (pp
, " [pointer set, len: ");
937 case GOMP_MAP_ATTACH
:
938 case GOMP_MAP_DETACH
:
939 case GOMP_MAP_FORCE_DETACH
:
940 case GOMP_MAP_ATTACH_DETACH
:
941 pp_string (pp
, " [bias: ");
944 pp_string (pp
, " [len: ");
947 dump_generic_node (pp
, OMP_CLAUSE_SIZE (clause
),
949 pp_right_bracket (pp
);
954 case OMP_CLAUSE_FROM
:
955 pp_string (pp
, "from(");
956 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
958 goto print_clause_size
;
961 pp_string (pp
, "to(");
962 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
964 goto print_clause_size
;
966 case OMP_CLAUSE__CACHE_
:
968 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
970 goto print_clause_size
;
972 case OMP_CLAUSE_NUM_TEAMS
:
973 pp_string (pp
, "num_teams(");
974 dump_generic_node (pp
, OMP_CLAUSE_NUM_TEAMS_EXPR (clause
),
979 case OMP_CLAUSE_THREAD_LIMIT
:
980 pp_string (pp
, "thread_limit(");
981 dump_generic_node (pp
, OMP_CLAUSE_THREAD_LIMIT_EXPR (clause
),
986 case OMP_CLAUSE_DEVICE
:
987 pp_string (pp
, "device(");
988 dump_generic_node (pp
, OMP_CLAUSE_DEVICE_ID (clause
),
993 case OMP_CLAUSE_DIST_SCHEDULE
:
994 pp_string (pp
, "dist_schedule(static");
995 if (OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR (clause
))
998 dump_generic_node (pp
,
999 OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR (clause
),
1002 pp_right_paren (pp
);
1005 case OMP_CLAUSE_PROC_BIND
:
1006 pp_string (pp
, "proc_bind(");
1007 switch (OMP_CLAUSE_PROC_BIND_KIND (clause
))
1009 case OMP_CLAUSE_PROC_BIND_MASTER
:
1010 pp_string (pp
, "master");
1012 case OMP_CLAUSE_PROC_BIND_CLOSE
:
1013 pp_string (pp
, "close");
1015 case OMP_CLAUSE_PROC_BIND_SPREAD
:
1016 pp_string (pp
, "spread");
1021 pp_right_paren (pp
);
1024 case OMP_CLAUSE_DEVICE_TYPE
:
1025 pp_string (pp
, "device_type(");
1026 switch (OMP_CLAUSE_DEVICE_TYPE_KIND (clause
))
1028 case OMP_CLAUSE_DEVICE_TYPE_HOST
:
1029 pp_string (pp
, "host");
1031 case OMP_CLAUSE_DEVICE_TYPE_NOHOST
:
1032 pp_string (pp
, "nohost");
1034 case OMP_CLAUSE_DEVICE_TYPE_ANY
:
1035 pp_string (pp
, "any");
1040 pp_right_paren (pp
);
1043 case OMP_CLAUSE_SAFELEN
:
1044 pp_string (pp
, "safelen(");
1045 dump_generic_node (pp
, OMP_CLAUSE_SAFELEN_EXPR (clause
),
1047 pp_right_paren (pp
);
1050 case OMP_CLAUSE_SIMDLEN
:
1051 pp_string (pp
, "simdlen(");
1052 dump_generic_node (pp
, OMP_CLAUSE_SIMDLEN_EXPR (clause
),
1054 pp_right_paren (pp
);
1057 case OMP_CLAUSE_PRIORITY
:
1058 pp_string (pp
, "priority(");
1059 dump_generic_node (pp
, OMP_CLAUSE_PRIORITY_EXPR (clause
),
1061 pp_right_paren (pp
);
1064 case OMP_CLAUSE_GRAINSIZE
:
1065 pp_string (pp
, "grainsize(");
1066 dump_generic_node (pp
, OMP_CLAUSE_GRAINSIZE_EXPR (clause
),
1068 pp_right_paren (pp
);
1071 case OMP_CLAUSE_NUM_TASKS
:
1072 pp_string (pp
, "num_tasks(");
1073 dump_generic_node (pp
, OMP_CLAUSE_NUM_TASKS_EXPR (clause
),
1075 pp_right_paren (pp
);
1078 case OMP_CLAUSE_HINT
:
1079 pp_string (pp
, "hint(");
1080 dump_generic_node (pp
, OMP_CLAUSE_HINT_EXPR (clause
),
1082 pp_right_paren (pp
);
1085 case OMP_CLAUSE_DEFAULTMAP
:
1086 pp_string (pp
, "defaultmap(");
1087 switch (OMP_CLAUSE_DEFAULTMAP_BEHAVIOR (clause
))
1089 case OMP_CLAUSE_DEFAULTMAP_ALLOC
:
1090 pp_string (pp
, "alloc");
1092 case OMP_CLAUSE_DEFAULTMAP_TO
:
1093 pp_string (pp
, "to");
1095 case OMP_CLAUSE_DEFAULTMAP_FROM
:
1096 pp_string (pp
, "from");
1098 case OMP_CLAUSE_DEFAULTMAP_TOFROM
:
1099 pp_string (pp
, "tofrom");
1101 case OMP_CLAUSE_DEFAULTMAP_FIRSTPRIVATE
:
1102 pp_string (pp
, "firstprivate");
1104 case OMP_CLAUSE_DEFAULTMAP_NONE
:
1105 pp_string (pp
, "none");
1107 case OMP_CLAUSE_DEFAULTMAP_DEFAULT
:
1108 pp_string (pp
, "default");
1113 switch (OMP_CLAUSE_DEFAULTMAP_CATEGORY (clause
))
1115 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_UNSPECIFIED
:
1117 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_SCALAR
:
1118 pp_string (pp
, ":scalar");
1120 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_AGGREGATE
:
1121 pp_string (pp
, ":aggregate");
1123 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_ALLOCATABLE
:
1124 pp_string (pp
, ":allocatable");
1126 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_POINTER
:
1127 pp_string (pp
, ":pointer");
1132 pp_right_paren (pp
);
1135 case OMP_CLAUSE_ORDER
:
1136 pp_string (pp
, "order(concurrent)");
1139 case OMP_CLAUSE_BIND
:
1140 pp_string (pp
, "bind(");
1141 switch (OMP_CLAUSE_BIND_KIND (clause
))
1143 case OMP_CLAUSE_BIND_TEAMS
:
1144 pp_string (pp
, "teams");
1146 case OMP_CLAUSE_BIND_PARALLEL
:
1147 pp_string (pp
, "parallel");
1149 case OMP_CLAUSE_BIND_THREAD
:
1150 pp_string (pp
, "thread");
1155 pp_right_paren (pp
);
1158 case OMP_CLAUSE__SIMDUID_
:
1159 pp_string (pp
, "_simduid_(");
1160 dump_generic_node (pp
, OMP_CLAUSE__SIMDUID__DECL (clause
),
1162 pp_right_paren (pp
);
1165 case OMP_CLAUSE__SIMT_
:
1166 pp_string (pp
, "_simt_");
1169 case OMP_CLAUSE_GANG
:
1170 pp_string (pp
, "gang");
1171 if (OMP_CLAUSE_GANG_EXPR (clause
) != NULL_TREE
)
1173 pp_string (pp
, "(num: ");
1174 dump_generic_node (pp
, OMP_CLAUSE_GANG_EXPR (clause
),
1177 if (OMP_CLAUSE_GANG_STATIC_EXPR (clause
) != NULL_TREE
)
1179 if (OMP_CLAUSE_GANG_EXPR (clause
) == NULL_TREE
)
1183 pp_string (pp
, "static:");
1184 if (OMP_CLAUSE_GANG_STATIC_EXPR (clause
)
1185 == integer_minus_one_node
)
1186 pp_character (pp
, '*');
1188 dump_generic_node (pp
, OMP_CLAUSE_GANG_STATIC_EXPR (clause
),
1191 if (OMP_CLAUSE_GANG_EXPR (clause
) != NULL_TREE
1192 || OMP_CLAUSE_GANG_STATIC_EXPR (clause
) != NULL_TREE
)
1193 pp_right_paren (pp
);
1196 case OMP_CLAUSE_ASYNC
:
1197 pp_string (pp
, "async");
1198 if (OMP_CLAUSE_ASYNC_EXPR (clause
))
1200 pp_character(pp
, '(');
1201 dump_generic_node (pp
, OMP_CLAUSE_ASYNC_EXPR (clause
),
1203 pp_character(pp
, ')');
1207 case OMP_CLAUSE_AUTO
:
1208 case OMP_CLAUSE_SEQ
:
1209 pp_string (pp
, omp_clause_code_name
[OMP_CLAUSE_CODE (clause
)]);
1212 case OMP_CLAUSE_WAIT
:
1213 pp_string (pp
, "wait(");
1214 dump_generic_node (pp
, OMP_CLAUSE_WAIT_EXPR (clause
),
1216 pp_character(pp
, ')');
1219 case OMP_CLAUSE_WORKER
:
1220 pp_string (pp
, "worker");
1221 if (OMP_CLAUSE_WORKER_EXPR (clause
) != NULL_TREE
)
1224 dump_generic_node (pp
, OMP_CLAUSE_WORKER_EXPR (clause
),
1226 pp_right_paren (pp
);
1230 case OMP_CLAUSE_VECTOR
:
1231 pp_string (pp
, "vector");
1232 if (OMP_CLAUSE_VECTOR_EXPR (clause
) != NULL_TREE
)
1235 dump_generic_node (pp
, OMP_CLAUSE_VECTOR_EXPR (clause
),
1237 pp_right_paren (pp
);
1241 case OMP_CLAUSE_NUM_GANGS
:
1242 pp_string (pp
, "num_gangs(");
1243 dump_generic_node (pp
, OMP_CLAUSE_NUM_GANGS_EXPR (clause
),
1245 pp_character (pp
, ')');
1248 case OMP_CLAUSE_NUM_WORKERS
:
1249 pp_string (pp
, "num_workers(");
1250 dump_generic_node (pp
, OMP_CLAUSE_NUM_WORKERS_EXPR (clause
),
1252 pp_character (pp
, ')');
1255 case OMP_CLAUSE_VECTOR_LENGTH
:
1256 pp_string (pp
, "vector_length(");
1257 dump_generic_node (pp
, OMP_CLAUSE_VECTOR_LENGTH_EXPR (clause
),
1259 pp_character (pp
, ')');
1262 case OMP_CLAUSE_INBRANCH
:
1263 pp_string (pp
, "inbranch");
1265 case OMP_CLAUSE_NOTINBRANCH
:
1266 pp_string (pp
, "notinbranch");
1268 case OMP_CLAUSE_FOR
:
1269 pp_string (pp
, "for");
1271 case OMP_CLAUSE_PARALLEL
:
1272 pp_string (pp
, "parallel");
1274 case OMP_CLAUSE_SECTIONS
:
1275 pp_string (pp
, "sections");
1277 case OMP_CLAUSE_TASKGROUP
:
1278 pp_string (pp
, "taskgroup");
1280 case OMP_CLAUSE_NOGROUP
:
1281 pp_string (pp
, "nogroup");
1283 case OMP_CLAUSE_THREADS
:
1284 pp_string (pp
, "threads");
1286 case OMP_CLAUSE_SIMD
:
1287 pp_string (pp
, "simd");
1289 case OMP_CLAUSE_INDEPENDENT
:
1290 pp_string (pp
, "independent");
1292 case OMP_CLAUSE_TILE
:
1293 pp_string (pp
, "tile(");
1294 dump_generic_node (pp
, OMP_CLAUSE_TILE_LIST (clause
),
1296 pp_right_paren (pp
);
1299 case OMP_CLAUSE_IF_PRESENT
:
1300 pp_string (pp
, "if_present");
1302 case OMP_CLAUSE_FINALIZE
:
1303 pp_string (pp
, "finalize");
1305 case OMP_CLAUSE_DETACH
:
1306 pp_string (pp
, "detach(");
1307 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
), spc
, flags
,
1309 pp_right_paren (pp
);
1318 /* Dump the list of OpenMP clauses. PP, SPC and FLAGS are as in
1319 dump_generic_node. */
1322 dump_omp_clauses (pretty_printer
*pp
, tree clause
, int spc
, dump_flags_t flags
)
1330 dump_omp_clause (pp
, clause
, spc
, flags
);
1331 clause
= OMP_CLAUSE_CHAIN (clause
);
1339 /* Dump location LOC to PP. */
1342 dump_location (pretty_printer
*pp
, location_t loc
)
1344 expanded_location xloc
= expand_location (loc
);
1346 pp_left_bracket (pp
);
1349 pp_string (pp
, xloc
.file
);
1350 pp_string (pp
, ":");
1352 pp_decimal_int (pp
, xloc
.line
);
1354 pp_decimal_int (pp
, xloc
.column
);
1355 pp_string (pp
, "] ");
1359 /* Dump lexical block BLOCK. PP, SPC and FLAGS are as in
1360 dump_generic_node. */
1363 dump_block_node (pretty_printer
*pp
, tree block
, int spc
, dump_flags_t flags
)
1367 pp_string (pp
, "BLOCK #");
1368 pp_decimal_int (pp
, BLOCK_NUMBER (block
));
1369 pp_character (pp
, ' ');
1371 if (flags
& TDF_ADDRESS
)
1373 pp_character (pp
, '[');
1374 pp_scalar (pp
, "%p", (void *) block
);
1375 pp_string (pp
, "] ");
1378 if (TREE_ASM_WRITTEN (block
))
1379 pp_string (pp
, "[written] ");
1381 if (flags
& TDF_SLIM
)
1384 if (BLOCK_SOURCE_LOCATION (block
))
1385 dump_location (pp
, BLOCK_SOURCE_LOCATION (block
));
1387 newline_and_indent (pp
, spc
+ 2);
1389 if (BLOCK_SUPERCONTEXT (block
))
1391 pp_string (pp
, "SUPERCONTEXT: ");
1392 dump_generic_node (pp
, BLOCK_SUPERCONTEXT (block
), 0,
1393 flags
| TDF_SLIM
, false);
1394 newline_and_indent (pp
, spc
+ 2);
1397 if (BLOCK_SUBBLOCKS (block
))
1399 pp_string (pp
, "SUBBLOCKS: ");
1400 for (t
= BLOCK_SUBBLOCKS (block
); t
; t
= BLOCK_CHAIN (t
))
1402 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
1405 newline_and_indent (pp
, spc
+ 2);
1408 if (BLOCK_CHAIN (block
))
1410 pp_string (pp
, "SIBLINGS: ");
1411 for (t
= BLOCK_CHAIN (block
); t
; t
= BLOCK_CHAIN (t
))
1413 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
1416 newline_and_indent (pp
, spc
+ 2);
1419 if (BLOCK_VARS (block
))
1421 pp_string (pp
, "VARS: ");
1422 for (t
= BLOCK_VARS (block
); t
; t
= TREE_CHAIN (t
))
1424 dump_generic_node (pp
, t
, 0, flags
, false);
1427 newline_and_indent (pp
, spc
+ 2);
1430 if (vec_safe_length (BLOCK_NONLOCALIZED_VARS (block
)) > 0)
1433 vec
<tree
, va_gc
> *nlv
= BLOCK_NONLOCALIZED_VARS (block
);
1435 pp_string (pp
, "NONLOCALIZED_VARS: ");
1436 FOR_EACH_VEC_ELT (*nlv
, i
, t
)
1438 dump_generic_node (pp
, t
, 0, flags
, false);
1441 newline_and_indent (pp
, spc
+ 2);
1444 if (BLOCK_ABSTRACT_ORIGIN (block
))
1446 pp_string (pp
, "ABSTRACT_ORIGIN: ");
1447 dump_generic_node (pp
, BLOCK_ABSTRACT_ORIGIN (block
), 0,
1448 flags
| TDF_SLIM
, false);
1449 newline_and_indent (pp
, spc
+ 2);
1452 if (BLOCK_FRAGMENT_ORIGIN (block
))
1454 pp_string (pp
, "FRAGMENT_ORIGIN: ");
1455 dump_generic_node (pp
, BLOCK_FRAGMENT_ORIGIN (block
), 0,
1456 flags
| TDF_SLIM
, false);
1457 newline_and_indent (pp
, spc
+ 2);
1460 if (BLOCK_FRAGMENT_CHAIN (block
))
1462 pp_string (pp
, "FRAGMENT_CHAIN: ");
1463 for (t
= BLOCK_FRAGMENT_CHAIN (block
); t
; t
= BLOCK_FRAGMENT_CHAIN (t
))
1465 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
1468 newline_and_indent (pp
, spc
+ 2);
1472 /* Dump #pragma omp atomic memory order clause. */
1475 dump_omp_atomic_memory_order (pretty_printer
*pp
, enum omp_memory_order mo
)
1479 case OMP_MEMORY_ORDER_RELAXED
:
1480 pp_string (pp
, " relaxed");
1482 case OMP_MEMORY_ORDER_SEQ_CST
:
1483 pp_string (pp
, " seq_cst");
1485 case OMP_MEMORY_ORDER_ACQ_REL
:
1486 pp_string (pp
, " acq_rel");
1488 case OMP_MEMORY_ORDER_ACQUIRE
:
1489 pp_string (pp
, " acquire");
1491 case OMP_MEMORY_ORDER_RELEASE
:
1492 pp_string (pp
, " release");
1494 case OMP_MEMORY_ORDER_UNSPECIFIED
:
1501 /* Helper to dump a MEM_REF node. */
1504 dump_mem_ref (pretty_printer
*pp
, tree node
, int spc
, dump_flags_t flags
)
1506 if (TREE_CODE (node
) == MEM_REF
&& (flags
& TDF_GIMPLE
))
1508 pp_string (pp
, "__MEM <");
1509 dump_generic_node (pp
, TREE_TYPE (node
),
1510 spc
, flags
| TDF_SLIM
, false);
1511 if (TYPE_ALIGN (TREE_TYPE (node
))
1512 != TYPE_ALIGN (TYPE_MAIN_VARIANT (TREE_TYPE (node
))))
1514 pp_string (pp
, ", ");
1515 pp_decimal_int (pp
, TYPE_ALIGN (TREE_TYPE (node
)));
1518 pp_string (pp
, " (");
1519 if (TREE_TYPE (TREE_OPERAND (node
, 0))
1520 != TREE_TYPE (TREE_OPERAND (node
, 1)))
1523 dump_generic_node (pp
, TREE_TYPE (TREE_OPERAND (node
, 1)),
1524 spc
, flags
| TDF_SLIM
, false);
1525 pp_right_paren (pp
);
1527 dump_generic_node (pp
, TREE_OPERAND (node
, 0),
1528 spc
, flags
| TDF_SLIM
, false);
1529 if (! integer_zerop (TREE_OPERAND (node
, 1)))
1531 pp_string (pp
, " + ");
1532 dump_generic_node (pp
, TREE_OPERAND (node
, 1),
1533 spc
, flags
| TDF_SLIM
, false);
1535 pp_right_paren (pp
);
1537 else if (TREE_CODE (node
) == MEM_REF
1538 && integer_zerop (TREE_OPERAND (node
, 1))
1539 /* Dump the types of INTEGER_CSTs explicitly, for we can't
1540 infer them and MEM_ATTR caching will share MEM_REFs
1541 with differently-typed op0s. */
1542 && TREE_CODE (TREE_OPERAND (node
, 0)) != INTEGER_CST
1543 /* Released SSA_NAMES have no TREE_TYPE. */
1544 && TREE_TYPE (TREE_OPERAND (node
, 0)) != NULL_TREE
1545 /* Same pointer types, but ignoring POINTER_TYPE vs.
1547 && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 0)))
1548 == TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 1))))
1549 && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (node
, 0)))
1550 == TYPE_MODE (TREE_TYPE (TREE_OPERAND (node
, 1))))
1551 && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node
, 0)))
1552 == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node
, 1))))
1553 /* Same value types ignoring qualifiers. */
1554 && (TYPE_MAIN_VARIANT (TREE_TYPE (node
))
1555 == TYPE_MAIN_VARIANT
1556 (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 1)))))
1557 && (!(flags
& TDF_ALIAS
)
1558 || MR_DEPENDENCE_CLIQUE (node
) == 0))
1560 if (TREE_CODE (TREE_OPERAND (node
, 0)) != ADDR_EXPR
)
1562 /* Enclose pointers to arrays in parentheses. */
1563 tree op0
= TREE_OPERAND (node
, 0);
1564 tree op0type
= TREE_TYPE (op0
);
1565 if (POINTER_TYPE_P (op0type
)
1566 && TREE_CODE (TREE_TYPE (op0type
)) == ARRAY_TYPE
)
1569 dump_generic_node (pp
, op0
, spc
, flags
, false);
1570 if (POINTER_TYPE_P (op0type
)
1571 && TREE_CODE (TREE_TYPE (op0type
)) == ARRAY_TYPE
)
1572 pp_right_paren (pp
);
1575 dump_generic_node (pp
,
1576 TREE_OPERAND (TREE_OPERAND (node
, 0), 0),
1581 pp_string (pp
, "MEM");
1583 tree nodetype
= TREE_TYPE (node
);
1584 tree op0
= TREE_OPERAND (node
, 0);
1585 tree op1
= TREE_OPERAND (node
, 1);
1586 tree op1type
= TYPE_MAIN_VARIANT (TREE_TYPE (op1
));
1588 tree op0size
= TYPE_SIZE (nodetype
);
1589 tree op1size
= TYPE_SIZE (TREE_TYPE (op1type
));
1591 if (!op0size
|| !op1size
1592 || !operand_equal_p (op0size
, op1size
, 0))
1594 pp_string (pp
, " <");
1595 /* If the size of the type of the operand is not the same
1596 as the size of the MEM_REF expression include the type
1597 of the latter similar to the TDF_GIMPLE output to make
1598 it clear how many bytes of memory are being accessed. */
1599 dump_generic_node (pp
, nodetype
, spc
, flags
| TDF_SLIM
, false);
1600 pp_string (pp
, "> ");
1603 pp_string (pp
, "[(");
1604 dump_generic_node (pp
, op1type
, spc
, flags
| TDF_SLIM
, false);
1605 pp_right_paren (pp
);
1606 dump_generic_node (pp
, op0
, spc
, flags
, false);
1607 if (!integer_zerop (op1
))
1609 pp_string (pp
, " + ");
1610 dump_generic_node (pp
, op1
, spc
, flags
, false);
1612 if (TREE_CODE (node
) == TARGET_MEM_REF
)
1614 tree tmp
= TMR_INDEX2 (node
);
1617 pp_string (pp
, " + ");
1618 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1620 tmp
= TMR_INDEX (node
);
1623 pp_string (pp
, " + ");
1624 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1625 tmp
= TMR_STEP (node
);
1626 pp_string (pp
, " * ");
1628 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1630 pp_string (pp
, "1");
1633 if ((flags
& TDF_ALIAS
)
1634 && MR_DEPENDENCE_CLIQUE (node
) != 0)
1636 pp_string (pp
, " clique ");
1637 pp_unsigned_wide_integer (pp
, MR_DEPENDENCE_CLIQUE (node
));
1638 pp_string (pp
, " base ");
1639 pp_unsigned_wide_integer (pp
, MR_DEPENDENCE_BASE (node
));
1641 pp_right_bracket (pp
);
1645 /* Helper function for dump_generic_node. Dump INIT or COND expression for
1646 OpenMP loop non-rectangular iterators. */
1649 dump_omp_loop_non_rect_expr (pretty_printer
*pp
, tree node
, int spc
,
1652 gcc_assert (TREE_CODE (node
) == TREE_VEC
);
1653 dump_generic_node (pp
, TREE_VEC_ELT (node
, 0), spc
, flags
, false);
1654 pp_string (pp
, " * ");
1655 if (op_prio (TREE_VEC_ELT (node
, 1)) <= op_code_prio (MULT_EXPR
))
1658 dump_generic_node (pp
, TREE_VEC_ELT (node
, 1), spc
, flags
, false);
1659 pp_right_paren (pp
);
1662 dump_generic_node (pp
, TREE_VEC_ELT (node
, 1), spc
, flags
, false);
1663 pp_string (pp
, " + ");
1664 if (op_prio (TREE_VEC_ELT (node
, 1)) <= op_code_prio (PLUS_EXPR
))
1667 dump_generic_node (pp
, TREE_VEC_ELT (node
, 2), spc
, flags
, false);
1668 pp_right_paren (pp
);
1671 dump_generic_node (pp
, TREE_VEC_ELT (node
, 2), spc
, flags
, false);
1674 /* Dump the node NODE on the pretty_printer PP, SPC spaces of
1675 indent. FLAGS specifies details to show in the dump (see TDF_* in
1676 dumpfile.h). If IS_STMT is true, the object printed is considered
1677 to be a statement and it is terminated by ';' if appropriate. */
1680 dump_generic_node (pretty_printer
*pp
, tree node
, int spc
, dump_flags_t flags
,
1687 enum tree_code code
;
1689 if (node
== NULL_TREE
)
1692 is_expr
= EXPR_P (node
);
1694 if (is_stmt
&& (flags
& TDF_STMTADDR
))
1696 pp_string (pp
, "<&");
1697 pp_scalar (pp
, "%p", (void *)node
);
1698 pp_string (pp
, "> ");
1701 if ((flags
& TDF_LINENO
) && EXPR_HAS_LOCATION (node
))
1702 dump_location (pp
, EXPR_LOCATION (node
));
1704 code
= TREE_CODE (node
);
1708 pp_string (pp
, "<<< error >>>");
1711 case IDENTIFIER_NODE
:
1712 pp_tree_identifier (pp
, node
);
1716 while (node
&& node
!= error_mark_node
)
1718 if (TREE_PURPOSE (node
))
1720 dump_generic_node (pp
, TREE_PURPOSE (node
), spc
, flags
, false);
1723 dump_generic_node (pp
, TREE_VALUE (node
), spc
, flags
, false);
1724 node
= TREE_CHAIN (node
);
1725 if (node
&& TREE_CODE (node
) == TREE_LIST
)
1734 dump_generic_node (pp
, BINFO_TYPE (node
), spc
, flags
, false);
1740 if (TREE_VEC_LENGTH (node
) > 0)
1742 size_t len
= TREE_VEC_LENGTH (node
);
1743 for (i
= 0; i
< len
- 1; i
++)
1745 dump_generic_node (pp
, TREE_VEC_ELT (node
, i
), spc
, flags
,
1750 dump_generic_node (pp
, TREE_VEC_ELT (node
, len
- 1), spc
,
1759 case FIXED_POINT_TYPE
:
1766 unsigned int quals
= TYPE_QUALS (node
);
1767 enum tree_code_class tclass
;
1769 if (quals
& TYPE_QUAL_ATOMIC
)
1770 pp_string (pp
, "atomic ");
1771 if (quals
& TYPE_QUAL_CONST
)
1772 pp_string (pp
, "const ");
1773 if (quals
& TYPE_QUAL_VOLATILE
)
1774 pp_string (pp
, "volatile ");
1775 if (quals
& TYPE_QUAL_RESTRICT
)
1776 pp_string (pp
, "restrict ");
1778 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
1780 pp_string (pp
, "<address-space-");
1781 pp_decimal_int (pp
, TYPE_ADDR_SPACE (node
));
1782 pp_string (pp
, "> ");
1785 tclass
= TREE_CODE_CLASS (TREE_CODE (node
));
1787 if (tclass
== tcc_declaration
)
1789 if (DECL_NAME (node
))
1790 dump_decl_name (pp
, node
, flags
);
1792 pp_string (pp
, "<unnamed type decl>");
1794 else if (tclass
== tcc_type
)
1796 if (TYPE_NAME (node
))
1798 if (TREE_CODE (TYPE_NAME (node
)) == IDENTIFIER_NODE
)
1799 pp_tree_identifier (pp
, TYPE_NAME (node
));
1800 else if (TREE_CODE (TYPE_NAME (node
)) == TYPE_DECL
1801 && DECL_NAME (TYPE_NAME (node
)))
1802 dump_decl_name (pp
, TYPE_NAME (node
), flags
);
1804 pp_string (pp
, "<unnamed type>");
1806 else if (TREE_CODE (node
) == VECTOR_TYPE
)
1808 pp_string (pp
, "vector");
1810 pp_wide_integer (pp
, TYPE_VECTOR_SUBPARTS (node
));
1811 pp_string (pp
, ") ");
1812 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1814 else if (TREE_CODE (node
) == INTEGER_TYPE
)
1816 if (TYPE_PRECISION (node
) == CHAR_TYPE_SIZE
)
1817 pp_string (pp
, (TYPE_UNSIGNED (node
)
1820 else if (TYPE_PRECISION (node
) == SHORT_TYPE_SIZE
)
1821 pp_string (pp
, (TYPE_UNSIGNED (node
)
1824 else if (TYPE_PRECISION (node
) == INT_TYPE_SIZE
)
1825 pp_string (pp
, (TYPE_UNSIGNED (node
)
1828 else if (TYPE_PRECISION (node
) == LONG_TYPE_SIZE
)
1829 pp_string (pp
, (TYPE_UNSIGNED (node
)
1832 else if (TYPE_PRECISION (node
) == LONG_LONG_TYPE_SIZE
)
1833 pp_string (pp
, (TYPE_UNSIGNED (node
)
1834 ? "unsigned long long"
1835 : "signed long long"));
1836 else if (TYPE_PRECISION (node
) >= CHAR_TYPE_SIZE
1837 && pow2p_hwi (TYPE_PRECISION (node
)))
1839 pp_string (pp
, (TYPE_UNSIGNED (node
) ? "uint" : "int"));
1840 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1841 pp_string (pp
, "_t");
1845 pp_string (pp
, (TYPE_UNSIGNED (node
)
1846 ? "<unnamed-unsigned:"
1847 : "<unnamed-signed:"));
1848 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1852 else if (TREE_CODE (node
) == COMPLEX_TYPE
)
1854 pp_string (pp
, "__complex__ ");
1855 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1857 else if (TREE_CODE (node
) == REAL_TYPE
)
1859 pp_string (pp
, "<float:");
1860 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1863 else if (TREE_CODE (node
) == FIXED_POINT_TYPE
)
1865 pp_string (pp
, "<fixed-point-");
1866 pp_string (pp
, TYPE_SATURATING (node
) ? "sat:" : "nonsat:");
1867 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1870 else if (TREE_CODE (node
) == BOOLEAN_TYPE
)
1872 pp_string (pp
, (TYPE_UNSIGNED (node
)
1873 ? "<unsigned-boolean:"
1874 : "<signed-boolean:"));
1875 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1878 else if (TREE_CODE (node
) == VOID_TYPE
)
1879 pp_string (pp
, "void");
1881 pp_string (pp
, "<unnamed type>");
1887 case REFERENCE_TYPE
:
1888 str
= (TREE_CODE (node
) == POINTER_TYPE
? "*" : "&");
1890 if (TREE_TYPE (node
) == NULL
)
1892 pp_string (pp
, str
);
1893 pp_string (pp
, "<null type>");
1895 else if (TREE_CODE (TREE_TYPE (node
)) == FUNCTION_TYPE
)
1897 tree fnode
= TREE_TYPE (node
);
1899 dump_generic_node (pp
, TREE_TYPE (fnode
), spc
, flags
, false);
1902 pp_string (pp
, str
);
1903 if (TYPE_IDENTIFIER (node
))
1904 dump_generic_node (pp
, TYPE_NAME (node
), spc
, flags
, false);
1905 else if (flags
& TDF_NOUID
)
1906 pp_string (pp
, "<Txxxx>");
1909 pp_string (pp
, "<T");
1910 pp_scalar (pp
, "%x", TYPE_UID (node
));
1911 pp_character (pp
, '>');
1914 pp_right_paren (pp
);
1915 dump_function_declaration (pp
, fnode
, spc
, flags
);
1919 unsigned int quals
= TYPE_QUALS (node
);
1921 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1923 pp_string (pp
, str
);
1925 if (quals
& TYPE_QUAL_CONST
)
1926 pp_string (pp
, " const");
1927 if (quals
& TYPE_QUAL_VOLATILE
)
1928 pp_string (pp
, " volatile");
1929 if (quals
& TYPE_QUAL_RESTRICT
)
1930 pp_string (pp
, " restrict");
1932 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
1934 pp_string (pp
, " <address-space-");
1935 pp_decimal_int (pp
, TYPE_ADDR_SPACE (node
));
1939 if (TYPE_REF_CAN_ALIAS_ALL (node
))
1940 pp_string (pp
, " {ref-all}");
1949 case TARGET_MEM_REF
:
1950 dump_mem_ref (pp
, node
, spc
, flags
);
1955 unsigned int quals
= TYPE_QUALS (node
);
1958 if (quals
& TYPE_QUAL_ATOMIC
)
1959 pp_string (pp
, "atomic ");
1960 if (quals
& TYPE_QUAL_CONST
)
1961 pp_string (pp
, "const ");
1962 if (quals
& TYPE_QUAL_VOLATILE
)
1963 pp_string (pp
, "volatile ");
1965 /* Print the innermost component type. */
1966 for (tmp
= TREE_TYPE (node
); TREE_CODE (tmp
) == ARRAY_TYPE
;
1967 tmp
= TREE_TYPE (tmp
))
1969 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1971 /* Print the dimensions. */
1972 for (tmp
= node
; TREE_CODE (tmp
) == ARRAY_TYPE
; tmp
= TREE_TYPE (tmp
))
1973 dump_array_domain (pp
, TYPE_DOMAIN (tmp
), spc
, flags
);
1979 case QUAL_UNION_TYPE
:
1981 unsigned int quals
= TYPE_QUALS (node
);
1983 if (quals
& TYPE_QUAL_ATOMIC
)
1984 pp_string (pp
, "atomic ");
1985 if (quals
& TYPE_QUAL_CONST
)
1986 pp_string (pp
, "const ");
1987 if (quals
& TYPE_QUAL_VOLATILE
)
1988 pp_string (pp
, "volatile ");
1990 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
1992 pp_string (pp
, "<address-space-");
1993 pp_decimal_int (pp
, TYPE_ADDR_SPACE (node
));
1994 pp_string (pp
, "> ");
1997 /* Print the name of the structure. */
1998 if (TREE_CODE (node
) == RECORD_TYPE
)
1999 pp_string (pp
, "struct ");
2000 else if (TREE_CODE (node
) == UNION_TYPE
)
2001 pp_string (pp
, "union ");
2003 if (TYPE_NAME (node
))
2004 dump_generic_node (pp
, TYPE_NAME (node
), spc
, flags
, false);
2005 else if (!(flags
& TDF_SLIM
))
2006 /* FIXME: If we eliminate the 'else' above and attempt
2007 to show the fields for named types, we may get stuck
2008 following a cycle of pointers to structs. The alleged
2009 self-reference check in print_struct_decl will not detect
2010 cycles involving more than one pointer or struct type. */
2011 print_struct_decl (pp
, node
, spc
, flags
);
2020 if (flags
& TDF_GIMPLE
2021 && (POINTER_TYPE_P (TREE_TYPE (node
))
2022 || (TYPE_PRECISION (TREE_TYPE (node
))
2023 < TYPE_PRECISION (integer_type_node
))
2024 || exact_log2 (TYPE_PRECISION (TREE_TYPE (node
))) == -1
2025 || tree_int_cst_sgn (node
) < 0))
2027 pp_string (pp
, "_Literal (");
2028 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2029 pp_string (pp
, ") ");
2031 if (TREE_CODE (TREE_TYPE (node
)) == POINTER_TYPE
2032 && ! (flags
& TDF_GIMPLE
))
2034 /* In the case of a pointer, one may want to divide by the
2035 size of the pointed-to type. Unfortunately, this not
2036 straightforward. The C front-end maps expressions
2041 in such a way that the two INTEGER_CST nodes for "5" have
2042 different values but identical types. In the latter
2043 case, the 5 is multiplied by sizeof (int) in c-common.c
2044 (pointer_int_sum) to convert it to a byte address, and
2045 yet the type of the node is left unchanged. Argh. What
2046 is consistent though is that the number value corresponds
2047 to bytes (UNITS) offset.
2049 NB: Neither of the following divisors can be trivially
2050 used to recover the original literal:
2052 TREE_INT_CST_LOW (TYPE_SIZE_UNIT (TREE_TYPE (node)))
2053 TYPE_PRECISION (TREE_TYPE (TREE_TYPE (node))) */
2054 pp_wide_integer (pp
, TREE_INT_CST_LOW (node
));
2055 pp_string (pp
, "B"); /* pseudo-unit */
2057 else if (tree_fits_shwi_p (node
))
2058 pp_wide_integer (pp
, tree_to_shwi (node
));
2059 else if (tree_fits_uhwi_p (node
))
2060 pp_unsigned_wide_integer (pp
, tree_to_uhwi (node
));
2063 wide_int val
= wi::to_wide (node
);
2065 if (wi::neg_p (val
, TYPE_SIGN (TREE_TYPE (node
))))
2070 print_hex (val
, pp_buffer (pp
)->digit_buffer
);
2071 pp_string (pp
, pp_buffer (pp
)->digit_buffer
);
2073 if ((flags
& TDF_GIMPLE
)
2074 && ! (POINTER_TYPE_P (TREE_TYPE (node
))
2075 || (TYPE_PRECISION (TREE_TYPE (node
))
2076 < TYPE_PRECISION (integer_type_node
))
2077 || exact_log2 (TYPE_PRECISION (TREE_TYPE (node
))) == -1))
2079 if (TYPE_UNSIGNED (TREE_TYPE (node
)))
2080 pp_character (pp
, 'u');
2081 if (TYPE_PRECISION (TREE_TYPE (node
))
2082 == TYPE_PRECISION (unsigned_type_node
))
2084 else if (TYPE_PRECISION (TREE_TYPE (node
))
2085 == TYPE_PRECISION (long_unsigned_type_node
))
2086 pp_character (pp
, 'l');
2087 else if (TYPE_PRECISION (TREE_TYPE (node
))
2088 == TYPE_PRECISION (long_long_unsigned_type_node
))
2089 pp_string (pp
, "ll");
2091 if (TREE_OVERFLOW (node
))
2092 pp_string (pp
, "(OVF)");
2096 pp_string (pp
, "POLY_INT_CST [");
2097 dump_generic_node (pp
, POLY_INT_CST_COEFF (node
, 0), spc
, flags
, false);
2098 for (unsigned int i
= 1; i
< NUM_POLY_INT_COEFFS
; ++i
)
2100 pp_string (pp
, ", ");
2101 dump_generic_node (pp
, POLY_INT_CST_COEFF (node
, i
),
2104 pp_string (pp
, "]");
2108 /* Code copied from print_node. */
2111 if (TREE_OVERFLOW (node
))
2112 pp_string (pp
, " overflow");
2114 d
= TREE_REAL_CST (node
);
2115 if (REAL_VALUE_ISINF (d
))
2116 pp_string (pp
, REAL_VALUE_NEGATIVE (d
) ? " -Inf" : " Inf");
2117 else if (REAL_VALUE_ISNAN (d
))
2118 pp_string (pp
, " Nan");
2122 real_to_decimal (string
, &d
, sizeof (string
), 0, 1);
2123 pp_string (pp
, string
);
2131 fixed_to_decimal (string
, TREE_FIXED_CST_PTR (node
), sizeof (string
));
2132 pp_string (pp
, string
);
2137 pp_string (pp
, "__complex__ (");
2138 dump_generic_node (pp
, TREE_REALPART (node
), spc
, flags
, false);
2139 pp_string (pp
, ", ");
2140 dump_generic_node (pp
, TREE_IMAGPART (node
), spc
, flags
, false);
2141 pp_right_paren (pp
);
2146 pp_string (pp
, "\"");
2147 if (unsigned nbytes
= TREE_STRING_LENGTH (node
))
2148 pretty_print_string (pp
, TREE_STRING_POINTER (node
), nbytes
);
2149 pp_string (pp
, "\"");
2156 if (flags
& TDF_GIMPLE
)
2158 pp_string (pp
, "_Literal (");
2159 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2160 pp_string (pp
, ") ");
2162 pp_string (pp
, "{ ");
2163 unsigned HOST_WIDE_INT nunits
;
2164 if (!VECTOR_CST_NELTS (node
).is_constant (&nunits
))
2165 nunits
= vector_cst_encoded_nelts (node
);
2166 for (i
= 0; i
< nunits
; ++i
)
2169 pp_string (pp
, ", ");
2170 dump_generic_node (pp
, VECTOR_CST_ELT (node
, i
),
2173 if (!VECTOR_CST_NELTS (node
).is_constant ())
2174 pp_string (pp
, ", ...");
2175 pp_string (pp
, " }");
2181 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2183 if (TREE_CODE (node
) == METHOD_TYPE
)
2185 if (TYPE_METHOD_BASETYPE (node
))
2186 dump_generic_node (pp
, TYPE_NAME (TYPE_METHOD_BASETYPE (node
)),
2189 pp_string (pp
, "<null method basetype>");
2190 pp_colon_colon (pp
);
2192 if (TYPE_IDENTIFIER (node
))
2193 dump_generic_node (pp
, TYPE_NAME (node
), spc
, flags
, false);
2194 else if (TYPE_NAME (node
) && DECL_NAME (TYPE_NAME (node
)))
2195 dump_decl_name (pp
, TYPE_NAME (node
), flags
);
2196 else if (flags
& TDF_NOUID
)
2197 pp_string (pp
, "<Txxxx>");
2200 pp_string (pp
, "<T");
2201 pp_scalar (pp
, "%x", TYPE_UID (node
));
2202 pp_character (pp
, '>');
2204 dump_function_declaration (pp
, node
, spc
, flags
);
2209 dump_decl_name (pp
, node
, flags
);
2213 if (DECL_NAME (node
))
2214 dump_decl_name (pp
, node
, flags
);
2215 else if (LABEL_DECL_UID (node
) != -1)
2217 if (flags
& TDF_GIMPLE
)
2219 pp_character (pp
, 'L');
2220 pp_decimal_int (pp
, (int) LABEL_DECL_UID (node
));
2224 pp_string (pp
, "<L");
2225 pp_decimal_int (pp
, (int) LABEL_DECL_UID (node
));
2226 pp_character (pp
, '>');
2231 if (flags
& TDF_NOUID
)
2232 pp_string (pp
, "<D.xxxx>");
2235 if (flags
& TDF_GIMPLE
)
2237 pp_character (pp
, 'D');
2238 pp_scalar (pp
, "%u", DECL_UID (node
));
2242 pp_string (pp
, "<D.");
2243 pp_scalar (pp
, "%u", DECL_UID (node
));
2244 pp_character (pp
, '>');
2251 if (DECL_IS_UNDECLARED_BUILTIN (node
))
2253 /* Don't print the declaration of built-in types. */
2256 if (DECL_NAME (node
))
2257 dump_decl_name (pp
, node
, flags
);
2258 else if (TYPE_NAME (TREE_TYPE (node
)) != node
)
2260 pp_string (pp
, (TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
2261 ? "union" : "struct "));
2262 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2265 pp_string (pp
, "<anon>");
2271 case DEBUG_EXPR_DECL
:
2272 case NAMESPACE_DECL
:
2274 dump_decl_name (pp
, node
, flags
);
2278 pp_string (pp
, "<retval>");
2282 op0
= TREE_OPERAND (node
, 0);
2285 && (TREE_CODE (op0
) == INDIRECT_REF
2286 || (TREE_CODE (op0
) == MEM_REF
2287 && TREE_CODE (TREE_OPERAND (op0
, 0)) != ADDR_EXPR
2288 && integer_zerop (TREE_OPERAND (op0
, 1))
2289 /* Dump the types of INTEGER_CSTs explicitly, for we
2290 can't infer them and MEM_ATTR caching will share
2291 MEM_REFs with differently-typed op0s. */
2292 && TREE_CODE (TREE_OPERAND (op0
, 0)) != INTEGER_CST
2293 /* Released SSA_NAMES have no TREE_TYPE. */
2294 && TREE_TYPE (TREE_OPERAND (op0
, 0)) != NULL_TREE
2295 /* Same pointer types, but ignoring POINTER_TYPE vs.
2297 && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 0)))
2298 == TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 1))))
2299 && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0
, 0)))
2300 == TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0
, 1))))
2301 && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0
, 0)))
2302 == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0
, 1))))
2303 /* Same value types ignoring qualifiers. */
2304 && (TYPE_MAIN_VARIANT (TREE_TYPE (op0
))
2305 == TYPE_MAIN_VARIANT
2306 (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 1)))))
2307 && MR_DEPENDENCE_CLIQUE (op0
) == 0)))
2309 op0
= TREE_OPERAND (op0
, 0);
2312 if (op_prio (op0
) < op_prio (node
))
2314 dump_generic_node (pp
, op0
, spc
, flags
, false);
2315 if (op_prio (op0
) < op_prio (node
))
2316 pp_right_paren (pp
);
2317 pp_string (pp
, str
);
2318 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2319 op0
= component_ref_field_offset (node
);
2320 if (op0
&& TREE_CODE (op0
) != INTEGER_CST
)
2322 pp_string (pp
, "{off: ");
2323 dump_generic_node (pp
, op0
, spc
, flags
, false);
2324 pp_right_brace (pp
);
2329 if (flags
& TDF_GIMPLE
)
2331 pp_string (pp
, "__BIT_FIELD_REF <");
2332 dump_generic_node (pp
, TREE_TYPE (node
),
2333 spc
, flags
| TDF_SLIM
, false);
2334 if (TYPE_ALIGN (TREE_TYPE (node
))
2335 != TYPE_ALIGN (TYPE_MAIN_VARIANT (TREE_TYPE (node
))))
2337 pp_string (pp
, ", ");
2338 pp_decimal_int (pp
, TYPE_ALIGN (TREE_TYPE (node
)));
2341 pp_string (pp
, " (");
2342 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
,
2343 flags
| TDF_SLIM
, false);
2344 pp_string (pp
, ", ");
2345 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
,
2346 flags
| TDF_SLIM
, false);
2347 pp_string (pp
, ", ");
2348 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
,
2349 flags
| TDF_SLIM
, false);
2350 pp_right_paren (pp
);
2354 pp_string (pp
, "BIT_FIELD_REF <");
2355 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2356 pp_string (pp
, ", ");
2357 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2358 pp_string (pp
, ", ");
2359 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2364 case BIT_INSERT_EXPR
:
2365 pp_string (pp
, "BIT_INSERT_EXPR <");
2366 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2367 pp_string (pp
, ", ");
2368 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2369 pp_string (pp
, ", ");
2370 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2371 pp_string (pp
, " (");
2372 if (INTEGRAL_TYPE_P (TREE_TYPE (TREE_OPERAND (node
, 1))))
2374 TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (node
, 1))));
2376 dump_generic_node (pp
, TYPE_SIZE (TREE_TYPE (TREE_OPERAND (node
, 1))),
2378 pp_string (pp
, " bits)>");
2382 case ARRAY_RANGE_REF
:
2383 op0
= TREE_OPERAND (node
, 0);
2384 if (op_prio (op0
) < op_prio (node
))
2386 dump_generic_node (pp
, op0
, spc
, flags
, false);
2387 if (op_prio (op0
) < op_prio (node
))
2388 pp_right_paren (pp
);
2389 pp_left_bracket (pp
);
2390 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2391 if (TREE_CODE (node
) == ARRAY_RANGE_REF
)
2392 pp_string (pp
, " ...");
2393 pp_right_bracket (pp
);
2395 op0
= array_ref_low_bound (node
);
2396 op1
= array_ref_element_size (node
);
2398 if (!integer_zerop (op0
)
2399 || TREE_OPERAND (node
, 2)
2400 || TREE_OPERAND (node
, 3))
2402 pp_string (pp
, "{lb: ");
2403 dump_generic_node (pp
, op0
, spc
, flags
, false);
2404 pp_string (pp
, " sz: ");
2405 dump_generic_node (pp
, op1
, spc
, flags
, false);
2406 pp_right_brace (pp
);
2412 unsigned HOST_WIDE_INT ix
;
2414 bool is_struct_init
= false;
2415 bool is_array_init
= false;
2417 if (flags
& TDF_GIMPLE
)
2419 pp_string (pp
, "_Literal (");
2420 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2421 pp_string (pp
, ") ");
2424 if (TREE_CLOBBER_P (node
))
2425 pp_string (pp
, "CLOBBER");
2426 else if (TREE_CODE (TREE_TYPE (node
)) == RECORD_TYPE
2427 || TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
)
2428 is_struct_init
= true;
2429 else if (TREE_CODE (TREE_TYPE (node
)) == ARRAY_TYPE
2430 && TYPE_DOMAIN (TREE_TYPE (node
))
2431 && TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
)))
2432 && TREE_CODE (TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
))))
2435 tree minv
= TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
)));
2436 is_array_init
= true;
2437 curidx
= wi::to_widest (minv
);
2439 FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (node
), ix
, field
, val
)
2446 dump_generic_node (pp
, field
, spc
, flags
, false);
2449 else if (is_array_init
2450 && (TREE_CODE (field
) != INTEGER_CST
2451 || curidx
!= wi::to_widest (field
)))
2453 pp_left_bracket (pp
);
2454 if (TREE_CODE (field
) == RANGE_EXPR
)
2456 dump_generic_node (pp
, TREE_OPERAND (field
, 0), spc
,
2458 pp_string (pp
, " ... ");
2459 dump_generic_node (pp
, TREE_OPERAND (field
, 1), spc
,
2461 if (TREE_CODE (TREE_OPERAND (field
, 1)) == INTEGER_CST
)
2462 curidx
= wi::to_widest (TREE_OPERAND (field
, 1));
2465 dump_generic_node (pp
, field
, spc
, flags
, false);
2466 if (TREE_CODE (field
) == INTEGER_CST
)
2467 curidx
= wi::to_widest (field
);
2468 pp_string (pp
, "]=");
2473 if (val
&& TREE_CODE (val
) == ADDR_EXPR
)
2474 if (TREE_CODE (TREE_OPERAND (val
, 0)) == FUNCTION_DECL
)
2475 val
= TREE_OPERAND (val
, 0);
2476 if (val
&& TREE_CODE (val
) == FUNCTION_DECL
)
2477 dump_decl_name (pp
, val
, flags
);
2479 dump_generic_node (pp
, val
, spc
, flags
, false);
2480 if (ix
!= CONSTRUCTOR_NELTS (node
) - 1)
2486 pp_right_brace (pp
);
2493 if (flags
& TDF_SLIM
)
2495 pp_string (pp
, "<COMPOUND_EXPR>");
2499 dump_generic_node (pp
, TREE_OPERAND (node
, 0),
2500 spc
, flags
, !(flags
& TDF_SLIM
));
2501 if (flags
& TDF_SLIM
)
2502 newline_and_indent (pp
, spc
);
2509 for (tp
= &TREE_OPERAND (node
, 1);
2510 TREE_CODE (*tp
) == COMPOUND_EXPR
;
2511 tp
= &TREE_OPERAND (*tp
, 1))
2513 dump_generic_node (pp
, TREE_OPERAND (*tp
, 0),
2514 spc
, flags
, !(flags
& TDF_SLIM
));
2515 if (flags
& TDF_SLIM
)
2516 newline_and_indent (pp
, spc
);
2524 dump_generic_node (pp
, *tp
, spc
, flags
, !(flags
& TDF_SLIM
));
2528 case STATEMENT_LIST
:
2530 tree_stmt_iterator si
;
2533 if (flags
& TDF_SLIM
)
2535 pp_string (pp
, "<STATEMENT_LIST>");
2539 for (si
= tsi_start (node
); !tsi_end_p (si
); tsi_next (&si
))
2542 newline_and_indent (pp
, spc
);
2545 dump_generic_node (pp
, tsi_stmt (si
), spc
, flags
, true);
2552 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
,
2557 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
,
2562 pp_string (pp
, "TARGET_EXPR <");
2563 dump_generic_node (pp
, TARGET_EXPR_SLOT (node
), spc
, flags
, false);
2566 dump_generic_node (pp
, TARGET_EXPR_INITIAL (node
), spc
, flags
, false);
2571 print_declaration (pp
, DECL_EXPR_DECL (node
), spc
, flags
);
2576 if (TREE_TYPE (node
) == NULL
|| TREE_TYPE (node
) == void_type_node
)
2578 pp_string (pp
, "if (");
2579 dump_generic_node (pp
, COND_EXPR_COND (node
), spc
, flags
, false);
2580 pp_right_paren (pp
);
2581 /* The lowered cond_exprs should always be printed in full. */
2582 if (COND_EXPR_THEN (node
)
2583 && (IS_EMPTY_STMT (COND_EXPR_THEN (node
))
2584 || TREE_CODE (COND_EXPR_THEN (node
)) == GOTO_EXPR
)
2585 && COND_EXPR_ELSE (node
)
2586 && (IS_EMPTY_STMT (COND_EXPR_ELSE (node
))
2587 || TREE_CODE (COND_EXPR_ELSE (node
)) == GOTO_EXPR
))
2590 dump_generic_node (pp
, COND_EXPR_THEN (node
),
2592 if (!IS_EMPTY_STMT (COND_EXPR_ELSE (node
)))
2594 pp_string (pp
, " else ");
2595 dump_generic_node (pp
, COND_EXPR_ELSE (node
),
2599 else if (!(flags
& TDF_SLIM
))
2601 /* Output COND_EXPR_THEN. */
2602 if (COND_EXPR_THEN (node
))
2604 newline_and_indent (pp
, spc
+2);
2606 newline_and_indent (pp
, spc
+4);
2607 dump_generic_node (pp
, COND_EXPR_THEN (node
), spc
+4,
2609 newline_and_indent (pp
, spc
+2);
2610 pp_right_brace (pp
);
2613 /* Output COND_EXPR_ELSE. */
2614 if (COND_EXPR_ELSE (node
)
2615 && !IS_EMPTY_STMT (COND_EXPR_ELSE (node
)))
2617 newline_and_indent (pp
, spc
);
2618 pp_string (pp
, "else");
2619 newline_and_indent (pp
, spc
+2);
2621 newline_and_indent (pp
, spc
+4);
2622 dump_generic_node (pp
, COND_EXPR_ELSE (node
), spc
+4,
2624 newline_and_indent (pp
, spc
+2);
2625 pp_right_brace (pp
);
2632 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2636 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2640 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2646 if (!(flags
& TDF_SLIM
))
2648 if (BIND_EXPR_VARS (node
))
2652 for (op0
= BIND_EXPR_VARS (node
); op0
; op0
= DECL_CHAIN (op0
))
2654 print_declaration (pp
, op0
, spc
+2, flags
);
2659 newline_and_indent (pp
, spc
+2);
2660 dump_generic_node (pp
, BIND_EXPR_BODY (node
), spc
+2, flags
, true);
2661 newline_and_indent (pp
, spc
);
2662 pp_right_brace (pp
);
2668 if (CALL_EXPR_FN (node
) != NULL_TREE
)
2669 print_call_name (pp
, CALL_EXPR_FN (node
), flags
);
2673 pp_string (pp
, internal_fn_name (CALL_EXPR_IFN (node
)));
2676 /* Print parameters. */
2681 call_expr_arg_iterator iter
;
2682 FOR_EACH_CALL_EXPR_ARG (arg
, iter
, node
)
2684 dump_generic_node (pp
, arg
, spc
, flags
, false);
2685 if (more_call_expr_args_p (&iter
))
2692 if (CALL_EXPR_VA_ARG_PACK (node
))
2694 if (call_expr_nargs (node
) > 0)
2699 pp_string (pp
, "__builtin_va_arg_pack ()");
2701 pp_right_paren (pp
);
2703 op1
= CALL_EXPR_STATIC_CHAIN (node
);
2706 pp_string (pp
, " [static-chain: ");
2707 dump_generic_node (pp
, op1
, spc
, flags
, false);
2708 pp_right_bracket (pp
);
2711 if (CALL_EXPR_RETURN_SLOT_OPT (node
))
2712 pp_string (pp
, " [return slot optimization]");
2713 if (CALL_EXPR_TAILCALL (node
))
2714 pp_string (pp
, " [tail call]");
2717 case WITH_CLEANUP_EXPR
:
2721 case CLEANUP_POINT_EXPR
:
2722 pp_string (pp
, "<<cleanup_point ");
2723 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2724 pp_string (pp
, ">>");
2727 case PLACEHOLDER_EXPR
:
2728 pp_string (pp
, "<PLACEHOLDER_EXPR ");
2729 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2733 /* Binary arithmetic and logic expressions. */
2734 case WIDEN_PLUS_EXPR
:
2735 case WIDEN_MINUS_EXPR
:
2736 case WIDEN_SUM_EXPR
:
2737 case WIDEN_MULT_EXPR
:
2739 case MULT_HIGHPART_EXPR
:
2741 case POINTER_PLUS_EXPR
:
2742 case POINTER_DIFF_EXPR
:
2744 case TRUNC_DIV_EXPR
:
2746 case FLOOR_DIV_EXPR
:
2747 case ROUND_DIV_EXPR
:
2748 case TRUNC_MOD_EXPR
:
2750 case FLOOR_MOD_EXPR
:
2751 case ROUND_MOD_EXPR
:
2753 case EXACT_DIV_EXPR
:
2758 case WIDEN_LSHIFT_EXPR
:
2762 case TRUTH_ANDIF_EXPR
:
2763 case TRUTH_ORIF_EXPR
:
2764 case TRUTH_AND_EXPR
:
2766 case TRUTH_XOR_EXPR
:
2780 case UNORDERED_EXPR
:
2782 const char *op
= op_symbol (node
);
2783 op0
= TREE_OPERAND (node
, 0);
2784 op1
= TREE_OPERAND (node
, 1);
2786 /* When the operands are expressions with less priority,
2787 keep semantics of the tree representation. */
2788 if (op_prio (op0
) <= op_prio (node
))
2791 dump_generic_node (pp
, op0
, spc
, flags
, false);
2792 pp_right_paren (pp
);
2795 dump_generic_node (pp
, op0
, spc
, flags
, false);
2801 /* When the operands are expressions with less priority,
2802 keep semantics of the tree representation. */
2803 if (op_prio (op1
) <= op_prio (node
))
2806 dump_generic_node (pp
, op1
, spc
, flags
, false);
2807 pp_right_paren (pp
);
2810 dump_generic_node (pp
, op1
, spc
, flags
, false);
2814 /* Unary arithmetic and logic expressions. */
2817 case TRUTH_NOT_EXPR
:
2819 case PREDECREMENT_EXPR
:
2820 case PREINCREMENT_EXPR
:
2822 if (TREE_CODE (node
) == ADDR_EXPR
2823 && (TREE_CODE (TREE_OPERAND (node
, 0)) == STRING_CST
2824 || TREE_CODE (TREE_OPERAND (node
, 0)) == FUNCTION_DECL
))
2825 ; /* Do not output '&' for strings and function pointers. */
2827 pp_string (pp
, op_symbol (node
));
2829 if (op_prio (TREE_OPERAND (node
, 0)) < op_prio (node
))
2832 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2833 pp_right_paren (pp
);
2836 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2839 case POSTDECREMENT_EXPR
:
2840 case POSTINCREMENT_EXPR
:
2841 if (op_prio (TREE_OPERAND (node
, 0)) < op_prio (node
))
2844 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2845 pp_right_paren (pp
);
2848 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2849 pp_string (pp
, op_symbol (node
));
2853 pp_string (pp
, "MIN_EXPR <");
2854 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2855 pp_string (pp
, ", ");
2856 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2861 pp_string (pp
, "MAX_EXPR <");
2862 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2863 pp_string (pp
, ", ");
2864 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2869 pp_string (pp
, "ABS_EXPR <");
2870 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2875 pp_string (pp
, "ABSU_EXPR <");
2876 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2884 case ADDR_SPACE_CONVERT_EXPR
:
2885 case FIXED_CONVERT_EXPR
:
2886 case FIX_TRUNC_EXPR
:
2889 type
= TREE_TYPE (node
);
2890 op0
= TREE_OPERAND (node
, 0);
2891 if (type
!= TREE_TYPE (op0
))
2894 dump_generic_node (pp
, type
, spc
, flags
, false);
2895 pp_string (pp
, ") ");
2897 if (op_prio (op0
) < op_prio (node
))
2899 dump_generic_node (pp
, op0
, spc
, flags
, false);
2900 if (op_prio (op0
) < op_prio (node
))
2901 pp_right_paren (pp
);
2904 case VIEW_CONVERT_EXPR
:
2905 if (flags
& TDF_GIMPLE
)
2906 pp_string (pp
, "__VIEW_CONVERT <");
2908 pp_string (pp
, "VIEW_CONVERT_EXPR<");
2909 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2910 pp_string (pp
, ">(");
2911 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2912 pp_right_paren (pp
);
2916 pp_string (pp
, "((");
2917 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2918 pp_string (pp
, "))");
2921 case NON_LVALUE_EXPR
:
2922 pp_string (pp
, "NON_LVALUE_EXPR <");
2923 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2928 pp_string (pp
, "SAVE_EXPR <");
2929 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2934 pp_string (pp
, "COMPLEX_EXPR <");
2935 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2936 pp_string (pp
, ", ");
2937 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2942 pp_string (pp
, "CONJ_EXPR <");
2943 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2948 if (flags
& TDF_GIMPLE
)
2950 pp_string (pp
, "__real ");
2951 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2955 pp_string (pp
, "REALPART_EXPR <");
2956 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2962 if (flags
& TDF_GIMPLE
)
2964 pp_string (pp
, "__imag ");
2965 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2969 pp_string (pp
, "IMAGPART_EXPR <");
2970 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2976 pp_string (pp
, "VA_ARG_EXPR <");
2977 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2981 case TRY_FINALLY_EXPR
:
2982 case TRY_CATCH_EXPR
:
2983 pp_string (pp
, "try");
2984 newline_and_indent (pp
, spc
+2);
2986 newline_and_indent (pp
, spc
+4);
2987 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
+4, flags
, true);
2988 newline_and_indent (pp
, spc
+2);
2989 pp_right_brace (pp
);
2990 newline_and_indent (pp
, spc
);
2991 if (TREE_CODE (node
) == TRY_CATCH_EXPR
)
2993 node
= TREE_OPERAND (node
, 1);
2994 pp_string (pp
, "catch");
2998 gcc_assert (TREE_CODE (node
) == TRY_FINALLY_EXPR
);
2999 node
= TREE_OPERAND (node
, 1);
3000 pp_string (pp
, "finally");
3001 if (TREE_CODE (node
) == EH_ELSE_EXPR
)
3003 newline_and_indent (pp
, spc
+2);
3005 newline_and_indent (pp
, spc
+4);
3006 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
+4,
3008 newline_and_indent (pp
, spc
+2);
3009 pp_right_brace (pp
);
3010 newline_and_indent (pp
, spc
);
3011 node
= TREE_OPERAND (node
, 1);
3012 pp_string (pp
, "else");
3015 newline_and_indent (pp
, spc
+2);
3017 newline_and_indent (pp
, spc
+4);
3018 dump_generic_node (pp
, node
, spc
+4, flags
, true);
3019 newline_and_indent (pp
, spc
+2);
3020 pp_right_brace (pp
);
3025 pp_string (pp
, "catch (");
3026 dump_generic_node (pp
, CATCH_TYPES (node
), spc
+2, flags
, false);
3027 pp_right_paren (pp
);
3028 newline_and_indent (pp
, spc
+2);
3030 newline_and_indent (pp
, spc
+4);
3031 dump_generic_node (pp
, CATCH_BODY (node
), spc
+4, flags
, true);
3032 newline_and_indent (pp
, spc
+2);
3033 pp_right_brace (pp
);
3037 case EH_FILTER_EXPR
:
3038 pp_string (pp
, "<<<eh_filter (");
3039 dump_generic_node (pp
, EH_FILTER_TYPES (node
), spc
+2, flags
, false);
3040 pp_string (pp
, ")>>>");
3041 newline_and_indent (pp
, spc
+2);
3043 newline_and_indent (pp
, spc
+4);
3044 dump_generic_node (pp
, EH_FILTER_FAILURE (node
), spc
+4, flags
, true);
3045 newline_and_indent (pp
, spc
+2);
3046 pp_right_brace (pp
);
3051 op0
= TREE_OPERAND (node
, 0);
3052 /* If this is for break or continue, don't bother printing it. */
3053 if (DECL_NAME (op0
))
3055 const char *name
= IDENTIFIER_POINTER (DECL_NAME (op0
));
3056 if (strcmp (name
, "break") == 0
3057 || strcmp (name
, "continue") == 0)
3060 dump_generic_node (pp
, op0
, spc
, flags
, false);
3062 if (DECL_NONLOCAL (op0
))
3063 pp_string (pp
, " [non-local]");
3067 pp_string (pp
, "while (1)");
3068 if (!(flags
& TDF_SLIM
))
3070 newline_and_indent (pp
, spc
+2);
3072 newline_and_indent (pp
, spc
+4);
3073 dump_generic_node (pp
, LOOP_EXPR_BODY (node
), spc
+4, flags
, true);
3074 newline_and_indent (pp
, spc
+2);
3075 pp_right_brace (pp
);
3081 pp_string (pp
, "// predicted ");
3082 if (PREDICT_EXPR_OUTCOME (node
))
3083 pp_string (pp
, "likely by ");
3085 pp_string (pp
, "unlikely by ");
3086 pp_string (pp
, predictor_name (PREDICT_EXPR_PREDICTOR (node
)));
3087 pp_string (pp
, " predictor.");
3091 pp_string (pp
, "ANNOTATE_EXPR <");
3092 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3093 switch ((enum annot_expr_kind
) TREE_INT_CST_LOW (TREE_OPERAND (node
, 1)))
3095 case annot_expr_ivdep_kind
:
3096 pp_string (pp
, ", ivdep");
3098 case annot_expr_unroll_kind
:
3100 pp_string (pp
, ", unroll ");
3102 (int) TREE_INT_CST_LOW (TREE_OPERAND (node
, 2)));
3105 case annot_expr_no_vector_kind
:
3106 pp_string (pp
, ", no-vector");
3108 case annot_expr_vector_kind
:
3109 pp_string (pp
, ", vector");
3111 case annot_expr_parallel_kind
:
3112 pp_string (pp
, ", parallel");
3121 pp_string (pp
, "return");
3122 op0
= TREE_OPERAND (node
, 0);
3126 if (TREE_CODE (op0
) == MODIFY_EXPR
)
3127 dump_generic_node (pp
, TREE_OPERAND (op0
, 1),
3130 dump_generic_node (pp
, op0
, spc
, flags
, false);
3135 pp_string (pp
, "if (");
3136 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3137 pp_string (pp
, ") break");
3141 pp_string (pp
, "switch (");
3142 dump_generic_node (pp
, SWITCH_COND (node
), spc
, flags
, false);
3143 pp_right_paren (pp
);
3144 if (!(flags
& TDF_SLIM
))
3146 newline_and_indent (pp
, spc
+2);
3148 if (SWITCH_BODY (node
))
3150 newline_and_indent (pp
, spc
+4);
3151 dump_generic_node (pp
, SWITCH_BODY (node
), spc
+4, flags
,
3154 newline_and_indent (pp
, spc
+2);
3155 pp_right_brace (pp
);
3161 op0
= GOTO_DESTINATION (node
);
3162 if (TREE_CODE (op0
) != SSA_NAME
&& DECL_P (op0
) && DECL_NAME (op0
))
3164 const char *name
= IDENTIFIER_POINTER (DECL_NAME (op0
));
3165 if (strcmp (name
, "break") == 0
3166 || strcmp (name
, "continue") == 0)
3168 pp_string (pp
, name
);
3172 pp_string (pp
, "goto ");
3173 dump_generic_node (pp
, op0
, spc
, flags
, false);
3177 pp_string (pp
, "__asm__");
3178 if (ASM_VOLATILE_P (node
))
3179 pp_string (pp
, " __volatile__");
3181 dump_generic_node (pp
, ASM_STRING (node
), spc
, flags
, false);
3183 dump_generic_node (pp
, ASM_OUTPUTS (node
), spc
, flags
, false);
3185 dump_generic_node (pp
, ASM_INPUTS (node
), spc
, flags
, false);
3186 if (ASM_CLOBBERS (node
))
3189 dump_generic_node (pp
, ASM_CLOBBERS (node
), spc
, flags
, false);
3191 pp_right_paren (pp
);
3194 case CASE_LABEL_EXPR
:
3195 if (CASE_LOW (node
) && CASE_HIGH (node
))
3197 pp_string (pp
, "case ");
3198 dump_generic_node (pp
, CASE_LOW (node
), spc
, flags
, false);
3199 pp_string (pp
, " ... ");
3200 dump_generic_node (pp
, CASE_HIGH (node
), spc
, flags
, false);
3202 else if (CASE_LOW (node
))
3204 pp_string (pp
, "case ");
3205 dump_generic_node (pp
, CASE_LOW (node
), spc
, flags
, false);
3208 pp_string (pp
, "default");
3213 pp_string (pp
, "OBJ_TYPE_REF(");
3214 dump_generic_node (pp
, OBJ_TYPE_REF_EXPR (node
), spc
, flags
, false);
3216 /* We omit the class type for -fcompare-debug because we may
3217 drop TYPE_BINFO early depending on debug info, and then
3218 virtual_method_call_p would return false, whereas when
3219 TYPE_BINFO is preserved it may still return true and then
3220 we'd print the class type. Compare tree and rtl dumps for
3221 libstdc++-prettyprinters/shared_ptr.cc with and without -g,
3222 for example, at occurrences of OBJ_TYPE_REF. */
3223 if (!(flags
& (TDF_SLIM
| TDF_COMPARE_DEBUG
))
3224 && virtual_method_call_p (node
, true))
3226 pp_string (pp
, "(");
3227 dump_generic_node (pp
, obj_type_ref_class (node
, true),
3229 pp_string (pp
, ")");
3231 dump_generic_node (pp
, OBJ_TYPE_REF_OBJECT (node
), spc
, flags
, false);
3233 dump_generic_node (pp
, OBJ_TYPE_REF_TOKEN (node
), spc
, flags
, false);
3234 pp_right_paren (pp
);
3238 if (SSA_NAME_IDENTIFIER (node
))
3240 if ((flags
& TDF_NOUID
)
3241 && SSA_NAME_VAR (node
)
3242 && DECL_NAMELESS (SSA_NAME_VAR (node
)))
3243 dump_fancy_name (pp
, SSA_NAME_IDENTIFIER (node
));
3244 else if (! (flags
& TDF_GIMPLE
)
3245 || SSA_NAME_VAR (node
))
3246 dump_generic_node (pp
, SSA_NAME_IDENTIFIER (node
),
3250 pp_decimal_int (pp
, SSA_NAME_VERSION (node
));
3251 if (SSA_NAME_IS_DEFAULT_DEF (node
))
3252 pp_string (pp
, "(D)");
3253 if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (node
))
3254 pp_string (pp
, "(ab)");
3257 case WITH_SIZE_EXPR
:
3258 pp_string (pp
, "WITH_SIZE_EXPR <");
3259 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3260 pp_string (pp
, ", ");
3261 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3266 pp_string (pp
, "ASSERT_EXPR <");
3267 dump_generic_node (pp
, ASSERT_EXPR_VAR (node
), spc
, flags
, false);
3268 pp_string (pp
, ", ");
3269 dump_generic_node (pp
, ASSERT_EXPR_COND (node
), spc
, flags
, false);
3274 pp_string (pp
, "scev_known");
3277 case SCEV_NOT_KNOWN
:
3278 pp_string (pp
, "scev_not_known");
3281 case POLYNOMIAL_CHREC
:
3283 dump_generic_node (pp
, CHREC_LEFT (node
), spc
, flags
, false);
3284 pp_string (pp
, ", +, ");
3285 dump_generic_node (pp
, CHREC_RIGHT (node
), spc
, flags
, false);
3286 pp_string (pp
, "}_");
3287 pp_scalar (pp
, "%u", CHREC_VARIABLE (node
));
3291 case REALIGN_LOAD_EXPR
:
3292 pp_string (pp
, "REALIGN_LOAD <");
3293 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3294 pp_string (pp
, ", ");
3295 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3296 pp_string (pp
, ", ");
3297 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3302 pp_string (pp
, " VEC_COND_EXPR < ");
3303 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3304 pp_string (pp
, " , ");
3305 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3306 pp_string (pp
, " , ");
3307 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3308 pp_string (pp
, " > ");
3312 pp_string (pp
, " VEC_PERM_EXPR < ");
3313 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3314 pp_string (pp
, " , ");
3315 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3316 pp_string (pp
, " , ");
3317 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3318 pp_string (pp
, " > ");
3322 pp_string (pp
, " DOT_PROD_EXPR < ");
3323 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3324 pp_string (pp
, ", ");
3325 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3326 pp_string (pp
, ", ");
3327 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3328 pp_string (pp
, " > ");
3331 case WIDEN_MULT_PLUS_EXPR
:
3332 pp_string (pp
, " WIDEN_MULT_PLUS_EXPR < ");
3333 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3334 pp_string (pp
, ", ");
3335 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3336 pp_string (pp
, ", ");
3337 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3338 pp_string (pp
, " > ");
3341 case WIDEN_MULT_MINUS_EXPR
:
3342 pp_string (pp
, " WIDEN_MULT_MINUS_EXPR < ");
3343 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3344 pp_string (pp
, ", ");
3345 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3346 pp_string (pp
, ", ");
3347 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3348 pp_string (pp
, " > ");
3352 pp_string (pp
, "#pragma acc parallel");
3353 goto dump_omp_clauses_body
;
3356 pp_string (pp
, "#pragma acc kernels");
3357 goto dump_omp_clauses_body
;
3360 pp_string (pp
, "#pragma acc serial");
3361 goto dump_omp_clauses_body
;
3364 pp_string (pp
, "#pragma acc data");
3365 dump_omp_clauses (pp
, OACC_DATA_CLAUSES (node
), spc
, flags
);
3368 case OACC_HOST_DATA
:
3369 pp_string (pp
, "#pragma acc host_data");
3370 dump_omp_clauses (pp
, OACC_HOST_DATA_CLAUSES (node
), spc
, flags
);
3374 pp_string (pp
, "#pragma acc declare");
3375 dump_omp_clauses (pp
, OACC_DECLARE_CLAUSES (node
), spc
, flags
);
3379 pp_string (pp
, "#pragma acc update");
3380 dump_omp_clauses (pp
, OACC_UPDATE_CLAUSES (node
), spc
, flags
);
3383 case OACC_ENTER_DATA
:
3384 pp_string (pp
, "#pragma acc enter data");
3385 dump_omp_clauses (pp
, OACC_ENTER_DATA_CLAUSES (node
), spc
, flags
);
3388 case OACC_EXIT_DATA
:
3389 pp_string (pp
, "#pragma acc exit data");
3390 dump_omp_clauses (pp
, OACC_EXIT_DATA_CLAUSES (node
), spc
, flags
);
3394 pp_string (pp
, "#pragma acc cache");
3395 dump_omp_clauses (pp
, OACC_CACHE_CLAUSES (node
), spc
, flags
);
3399 pp_string (pp
, "#pragma omp parallel");
3400 dump_omp_clauses (pp
, OMP_PARALLEL_CLAUSES (node
), spc
, flags
);
3403 dump_omp_clauses_body
:
3404 dump_omp_clauses (pp
, OMP_CLAUSES (node
), spc
, flags
);
3408 if (!(flags
& TDF_SLIM
) && OMP_BODY (node
))
3410 newline_and_indent (pp
, spc
+ 2);
3412 newline_and_indent (pp
, spc
+ 4);
3413 dump_generic_node (pp
, OMP_BODY (node
), spc
+ 4, flags
, false);
3414 newline_and_indent (pp
, spc
+ 2);
3415 pp_right_brace (pp
);
3421 pp_string (pp
, OMP_TASK_BODY (node
) ? "#pragma omp task"
3422 : "#pragma omp taskwait");
3423 dump_omp_clauses (pp
, OMP_TASK_CLAUSES (node
), spc
, flags
);
3427 pp_string (pp
, "#pragma omp for");
3431 pp_string (pp
, "#pragma omp simd");
3434 case OMP_DISTRIBUTE
:
3435 pp_string (pp
, "#pragma omp distribute");
3439 pp_string (pp
, "#pragma omp taskloop");
3443 pp_string (pp
, "#pragma omp loop");
3447 pp_string (pp
, "#pragma acc loop");
3451 pp_string (pp
, "#pragma omp teams");
3452 dump_omp_clauses (pp
, OMP_TEAMS_CLAUSES (node
), spc
, flags
);
3455 case OMP_TARGET_DATA
:
3456 pp_string (pp
, "#pragma omp target data");
3457 dump_omp_clauses (pp
, OMP_TARGET_DATA_CLAUSES (node
), spc
, flags
);
3460 case OMP_TARGET_ENTER_DATA
:
3461 pp_string (pp
, "#pragma omp target enter data");
3462 dump_omp_clauses (pp
, OMP_TARGET_ENTER_DATA_CLAUSES (node
), spc
, flags
);
3466 case OMP_TARGET_EXIT_DATA
:
3467 pp_string (pp
, "#pragma omp target exit data");
3468 dump_omp_clauses (pp
, OMP_TARGET_EXIT_DATA_CLAUSES (node
), spc
, flags
);
3473 pp_string (pp
, "#pragma omp target");
3474 dump_omp_clauses (pp
, OMP_TARGET_CLAUSES (node
), spc
, flags
);
3477 case OMP_TARGET_UPDATE
:
3478 pp_string (pp
, "#pragma omp target update");
3479 dump_omp_clauses (pp
, OMP_TARGET_UPDATE_CLAUSES (node
), spc
, flags
);
3484 dump_omp_clauses (pp
, OMP_FOR_CLAUSES (node
), spc
, flags
);
3485 if (!(flags
& TDF_SLIM
))
3489 if (OMP_FOR_PRE_BODY (node
))
3491 newline_and_indent (pp
, spc
+ 2);
3494 newline_and_indent (pp
, spc
);
3495 dump_generic_node (pp
, OMP_FOR_PRE_BODY (node
),
3498 if (OMP_FOR_INIT (node
))
3501 for (i
= 0; i
< TREE_VEC_LENGTH (OMP_FOR_INIT (node
)); i
++)
3504 newline_and_indent (pp
, spc
);
3505 pp_string (pp
, "for (");
3506 tree init
= TREE_VEC_ELT (OMP_FOR_INIT (node
), i
);
3507 if (TREE_CODE (init
) != MODIFY_EXPR
3508 || TREE_CODE (TREE_OPERAND (init
, 1)) != TREE_VEC
)
3509 dump_generic_node (pp
, init
, spc
, flags
, false);
3512 dump_generic_node (pp
, TREE_OPERAND (init
, 0),
3514 pp_string (pp
, " = ");
3515 dump_omp_loop_non_rect_expr (pp
, TREE_OPERAND (init
, 1),
3518 pp_string (pp
, "; ");
3519 tree cond
= TREE_VEC_ELT (OMP_FOR_COND (node
), i
);
3520 if (!COMPARISON_CLASS_P (cond
)
3521 || TREE_CODE (TREE_OPERAND (cond
, 1)) != TREE_VEC
)
3522 dump_generic_node (pp
, cond
, spc
, flags
, false);
3525 dump_generic_node (pp
, TREE_OPERAND (cond
, 0),
3527 const char *op
= op_symbol (cond
);
3531 dump_omp_loop_non_rect_expr (pp
, TREE_OPERAND (cond
, 1),
3534 pp_string (pp
, "; ");
3535 dump_generic_node (pp
,
3536 TREE_VEC_ELT (OMP_FOR_INCR (node
), i
),
3538 pp_right_paren (pp
);
3541 if (OMP_FOR_BODY (node
))
3543 newline_and_indent (pp
, spc
+ 2);
3545 newline_and_indent (pp
, spc
+ 4);
3546 dump_generic_node (pp
, OMP_FOR_BODY (node
), spc
+ 4, flags
,
3548 newline_and_indent (pp
, spc
+ 2);
3549 pp_right_brace (pp
);
3551 if (OMP_FOR_INIT (node
))
3552 spc
-= 2 * TREE_VEC_LENGTH (OMP_FOR_INIT (node
)) - 2;
3553 if (OMP_FOR_PRE_BODY (node
))
3556 newline_and_indent (pp
, spc
+ 2);
3557 pp_right_brace (pp
);
3564 pp_string (pp
, "#pragma omp sections");
3565 dump_omp_clauses (pp
, OMP_SECTIONS_CLAUSES (node
), spc
, flags
);
3569 pp_string (pp
, "#pragma omp section");
3573 if (OMP_SCAN_CLAUSES (node
))
3575 pp_string (pp
, "#pragma omp scan");
3576 dump_omp_clauses (pp
, OMP_SCAN_CLAUSES (node
), spc
, flags
);
3581 pp_string (pp
, "#pragma omp master");
3585 pp_string (pp
, "#pragma omp taskgroup");
3586 dump_omp_clauses (pp
, OMP_TASKGROUP_CLAUSES (node
), spc
, flags
);
3590 pp_string (pp
, "#pragma omp ordered");
3591 dump_omp_clauses (pp
, OMP_ORDERED_CLAUSES (node
), spc
, flags
);
3595 pp_string (pp
, "#pragma omp critical");
3596 if (OMP_CRITICAL_NAME (node
))
3600 dump_generic_node (pp
, OMP_CRITICAL_NAME (node
), spc
,
3602 pp_right_paren (pp
);
3604 dump_omp_clauses (pp
, OMP_CRITICAL_CLAUSES (node
), spc
, flags
);
3608 pp_string (pp
, "#pragma omp atomic");
3609 dump_omp_atomic_memory_order (pp
, OMP_ATOMIC_MEMORY_ORDER (node
));
3610 newline_and_indent (pp
, spc
+ 2);
3611 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3615 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3618 case OMP_ATOMIC_READ
:
3619 pp_string (pp
, "#pragma omp atomic read");
3620 dump_omp_atomic_memory_order (pp
, OMP_ATOMIC_MEMORY_ORDER (node
));
3621 newline_and_indent (pp
, spc
+ 2);
3622 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3626 case OMP_ATOMIC_CAPTURE_OLD
:
3627 case OMP_ATOMIC_CAPTURE_NEW
:
3628 pp_string (pp
, "#pragma omp atomic capture");
3629 dump_omp_atomic_memory_order (pp
, OMP_ATOMIC_MEMORY_ORDER (node
));
3630 newline_and_indent (pp
, spc
+ 2);
3631 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3635 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3639 pp_string (pp
, "#pragma omp single");
3640 dump_omp_clauses (pp
, OMP_SINGLE_CLAUSES (node
), spc
, flags
);
3644 dump_omp_clause (pp
, node
, spc
, flags
);
3648 case TRANSACTION_EXPR
:
3649 if (TRANSACTION_EXPR_OUTER (node
))
3650 pp_string (pp
, "__transaction_atomic [[outer]]");
3651 else if (TRANSACTION_EXPR_RELAXED (node
))
3652 pp_string (pp
, "__transaction_relaxed");
3654 pp_string (pp
, "__transaction_atomic");
3655 if (!(flags
& TDF_SLIM
) && TRANSACTION_EXPR_BODY (node
))
3657 newline_and_indent (pp
, spc
);
3659 newline_and_indent (pp
, spc
+ 2);
3660 dump_generic_node (pp
, TRANSACTION_EXPR_BODY (node
),
3661 spc
+ 2, flags
, false);
3662 newline_and_indent (pp
, spc
);
3663 pp_right_brace (pp
);
3668 case VEC_SERIES_EXPR
:
3669 case VEC_WIDEN_MULT_HI_EXPR
:
3670 case VEC_WIDEN_MULT_LO_EXPR
:
3671 case VEC_WIDEN_PLUS_HI_EXPR
:
3672 case VEC_WIDEN_PLUS_LO_EXPR
:
3673 case VEC_WIDEN_MINUS_HI_EXPR
:
3674 case VEC_WIDEN_MINUS_LO_EXPR
:
3675 case VEC_WIDEN_MULT_EVEN_EXPR
:
3676 case VEC_WIDEN_MULT_ODD_EXPR
:
3677 case VEC_WIDEN_LSHIFT_HI_EXPR
:
3678 case VEC_WIDEN_LSHIFT_LO_EXPR
:
3680 for (str
= get_tree_code_name (code
); *str
; str
++)
3681 pp_character (pp
, TOUPPER (*str
));
3682 pp_string (pp
, " < ");
3683 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3684 pp_string (pp
, ", ");
3685 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3686 pp_string (pp
, " > ");
3689 case VEC_DUPLICATE_EXPR
:
3691 for (str
= get_tree_code_name (code
); *str
; str
++)
3692 pp_character (pp
, TOUPPER (*str
));
3693 pp_string (pp
, " < ");
3694 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3695 pp_string (pp
, " > ");
3698 case VEC_UNPACK_HI_EXPR
:
3699 pp_string (pp
, " VEC_UNPACK_HI_EXPR < ");
3700 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3701 pp_string (pp
, " > ");
3704 case VEC_UNPACK_LO_EXPR
:
3705 pp_string (pp
, " VEC_UNPACK_LO_EXPR < ");
3706 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3707 pp_string (pp
, " > ");
3710 case VEC_UNPACK_FLOAT_HI_EXPR
:
3711 pp_string (pp
, " VEC_UNPACK_FLOAT_HI_EXPR < ");
3712 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3713 pp_string (pp
, " > ");
3716 case VEC_UNPACK_FLOAT_LO_EXPR
:
3717 pp_string (pp
, " VEC_UNPACK_FLOAT_LO_EXPR < ");
3718 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3719 pp_string (pp
, " > ");
3722 case VEC_UNPACK_FIX_TRUNC_HI_EXPR
:
3723 pp_string (pp
, " VEC_UNPACK_FIX_TRUNC_HI_EXPR < ");
3724 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3725 pp_string (pp
, " > ");
3728 case VEC_UNPACK_FIX_TRUNC_LO_EXPR
:
3729 pp_string (pp
, " VEC_UNPACK_FIX_TRUNC_LO_EXPR < ");
3730 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3731 pp_string (pp
, " > ");
3734 case VEC_PACK_TRUNC_EXPR
:
3735 pp_string (pp
, " VEC_PACK_TRUNC_EXPR < ");
3736 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3737 pp_string (pp
, ", ");
3738 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3739 pp_string (pp
, " > ");
3742 case VEC_PACK_SAT_EXPR
:
3743 pp_string (pp
, " VEC_PACK_SAT_EXPR < ");
3744 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3745 pp_string (pp
, ", ");
3746 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3747 pp_string (pp
, " > ");
3750 case VEC_PACK_FIX_TRUNC_EXPR
:
3751 pp_string (pp
, " VEC_PACK_FIX_TRUNC_EXPR < ");
3752 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3753 pp_string (pp
, ", ");
3754 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3755 pp_string (pp
, " > ");
3758 case VEC_PACK_FLOAT_EXPR
:
3759 pp_string (pp
, " VEC_PACK_FLOAT_EXPR < ");
3760 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3761 pp_string (pp
, ", ");
3762 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3763 pp_string (pp
, " > ");
3767 dump_block_node (pp
, node
, spc
, flags
);
3770 case DEBUG_BEGIN_STMT
:
3771 pp_string (pp
, "# DEBUG BEGIN STMT");
3778 if (is_stmt
&& is_expr
)
3784 /* Print the declaration of a variable. */
3787 print_declaration (pretty_printer
*pp
, tree t
, int spc
, dump_flags_t flags
)
3791 if (TREE_CODE(t
) == NAMELIST_DECL
)
3793 pp_string(pp
, "namelist ");
3794 dump_decl_name (pp
, t
, flags
);
3799 if (TREE_CODE (t
) == TYPE_DECL
)
3800 pp_string (pp
, "typedef ");
3802 if (CODE_CONTAINS_STRUCT (TREE_CODE (t
), TS_DECL_WRTL
) && DECL_REGISTER (t
))
3803 pp_string (pp
, "register ");
3805 if (TREE_PUBLIC (t
) && DECL_EXTERNAL (t
))
3806 pp_string (pp
, "extern ");
3807 else if (TREE_STATIC (t
))
3808 pp_string (pp
, "static ");
3810 /* Print the type and name. */
3811 if (TREE_TYPE (t
) && TREE_CODE (TREE_TYPE (t
)) == ARRAY_TYPE
)
3815 /* Print array's type. */
3816 tmp
= TREE_TYPE (t
);
3817 while (TREE_CODE (TREE_TYPE (tmp
)) == ARRAY_TYPE
)
3818 tmp
= TREE_TYPE (tmp
);
3819 dump_generic_node (pp
, TREE_TYPE (tmp
), spc
, flags
, false);
3821 /* Print variable's name. */
3823 dump_generic_node (pp
, t
, spc
, flags
, false);
3825 /* Print the dimensions. */
3826 tmp
= TREE_TYPE (t
);
3827 while (TREE_CODE (tmp
) == ARRAY_TYPE
)
3829 dump_array_domain (pp
, TYPE_DOMAIN (tmp
), spc
, flags
);
3830 tmp
= TREE_TYPE (tmp
);
3833 else if (TREE_CODE (t
) == FUNCTION_DECL
)
3835 dump_generic_node (pp
, TREE_TYPE (TREE_TYPE (t
)), spc
, flags
, false);
3837 dump_decl_name (pp
, t
, flags
);
3838 dump_function_declaration (pp
, TREE_TYPE (t
), spc
, flags
);
3842 /* Print type declaration. */
3843 dump_generic_node (pp
, TREE_TYPE (t
), spc
, flags
, false);
3845 /* Print variable's name. */
3847 dump_generic_node (pp
, t
, spc
, flags
, false);
3850 if (VAR_P (t
) && DECL_HARD_REGISTER (t
))
3852 pp_string (pp
, " __asm__ ");
3854 dump_generic_node (pp
, DECL_ASSEMBLER_NAME (t
), spc
, flags
, false);
3855 pp_right_paren (pp
);
3858 /* The initial value of a function serves to determine whether the function
3859 is declared or defined. So the following does not apply to function
3861 if (TREE_CODE (t
) != FUNCTION_DECL
)
3863 /* Print the initial value. */
3864 if (DECL_INITIAL (t
))
3869 if (!(flags
& TDF_SLIM
))
3870 dump_generic_node (pp
, DECL_INITIAL (t
), spc
, flags
, false);
3872 pp_string (pp
, "<<< omitted >>>");
3876 if (VAR_P (t
) && DECL_HAS_VALUE_EXPR_P (t
))
3878 pp_string (pp
, " [value-expr: ");
3879 dump_generic_node (pp
, DECL_VALUE_EXPR (t
), spc
, flags
, false);
3880 pp_right_bracket (pp
);
3887 /* Prints a structure: name, fields, and methods.
3888 FIXME: Still incomplete. */
3891 print_struct_decl (pretty_printer
*pp
, const_tree node
, int spc
,
3894 /* Print the name of the structure. */
3895 if (TYPE_NAME (node
))
3898 if (TREE_CODE (node
) == RECORD_TYPE
)
3899 pp_string (pp
, "struct ");
3900 else if ((TREE_CODE (node
) == UNION_TYPE
3901 || TREE_CODE (node
) == QUAL_UNION_TYPE
))
3902 pp_string (pp
, "union ");
3904 dump_generic_node (pp
, TYPE_NAME (node
), spc
, TDF_NONE
, false);
3907 /* Print the contents of the structure. */
3913 /* Print the fields of the structure. */
3916 tmp
= TYPE_FIELDS (node
);
3919 /* Avoid to print recursively the structure. */
3920 /* FIXME : Not implemented correctly...,
3921 what about the case when we have a cycle in the contain graph? ...
3922 Maybe this could be solved by looking at the scope in which the
3923 structure was declared. */
3924 if (TREE_TYPE (tmp
) != node
3925 && (TREE_CODE (TREE_TYPE (tmp
)) != POINTER_TYPE
3926 || TREE_TYPE (TREE_TYPE (tmp
)) != node
))
3928 print_declaration (pp
, tmp
, spc
+2, flags
);
3931 tmp
= DECL_CHAIN (tmp
);
3935 pp_right_brace (pp
);
3938 /* Return the priority of the operator CODE.
3940 From lowest to highest precedence with either left-to-right (L-R)
3941 or right-to-left (R-L) associativity]:
3944 2 [R-L] = += -= *= /= %= &= ^= |= <<= >>=
3956 14 [R-L] ! ~ ++ -- + - * & (type) sizeof
3957 15 [L-R] fn() [] -> .
3959 unary +, - and * have higher precedence than the corresponding binary
3963 op_code_prio (enum tree_code code
)
3980 case TRUTH_ORIF_EXPR
:
3983 case TRUTH_AND_EXPR
:
3984 case TRUTH_ANDIF_EXPR
:
3991 case TRUTH_XOR_EXPR
:
4008 case UNORDERED_EXPR
:
4019 case VEC_WIDEN_LSHIFT_HI_EXPR
:
4020 case VEC_WIDEN_LSHIFT_LO_EXPR
:
4021 case WIDEN_LSHIFT_EXPR
:
4024 case WIDEN_SUM_EXPR
:
4026 case POINTER_PLUS_EXPR
:
4027 case POINTER_DIFF_EXPR
:
4031 case VEC_WIDEN_MULT_HI_EXPR
:
4032 case VEC_WIDEN_MULT_LO_EXPR
:
4033 case WIDEN_MULT_EXPR
:
4035 case WIDEN_MULT_PLUS_EXPR
:
4036 case WIDEN_MULT_MINUS_EXPR
:
4038 case MULT_HIGHPART_EXPR
:
4039 case TRUNC_DIV_EXPR
:
4041 case FLOOR_DIV_EXPR
:
4042 case ROUND_DIV_EXPR
:
4044 case EXACT_DIV_EXPR
:
4045 case TRUNC_MOD_EXPR
:
4047 case FLOOR_MOD_EXPR
:
4048 case ROUND_MOD_EXPR
:
4051 case TRUTH_NOT_EXPR
:
4053 case POSTINCREMENT_EXPR
:
4054 case POSTDECREMENT_EXPR
:
4055 case PREINCREMENT_EXPR
:
4056 case PREDECREMENT_EXPR
:
4062 case FIX_TRUNC_EXPR
:
4068 case ARRAY_RANGE_REF
:
4072 /* Special expressions. */
4078 case VEC_UNPACK_HI_EXPR
:
4079 case VEC_UNPACK_LO_EXPR
:
4080 case VEC_UNPACK_FLOAT_HI_EXPR
:
4081 case VEC_UNPACK_FLOAT_LO_EXPR
:
4082 case VEC_UNPACK_FIX_TRUNC_HI_EXPR
:
4083 case VEC_UNPACK_FIX_TRUNC_LO_EXPR
:
4084 case VEC_PACK_TRUNC_EXPR
:
4085 case VEC_PACK_SAT_EXPR
:
4089 /* Return an arbitrarily high precedence to avoid surrounding single
4090 VAR_DECLs in ()s. */
4095 /* Return the priority of the operator OP. */
4098 op_prio (const_tree op
)
4100 enum tree_code code
;
4105 code
= TREE_CODE (op
);
4106 if (code
== SAVE_EXPR
|| code
== NON_LVALUE_EXPR
)
4107 return op_prio (TREE_OPERAND (op
, 0));
4109 return op_code_prio (code
);
4112 /* Return the symbol associated with operator CODE. */
4115 op_symbol_code (enum tree_code code
)
4123 case TRUTH_ORIF_EXPR
:
4126 case TRUTH_AND_EXPR
:
4127 case TRUTH_ANDIF_EXPR
:
4133 case TRUTH_XOR_EXPR
:
4143 case UNORDERED_EXPR
:
4189 case WIDEN_LSHIFT_EXPR
:
4192 case WIDEN_PLUS_EXPR
:
4195 case WIDEN_MINUS_EXPR
:
4198 case POINTER_PLUS_EXPR
:
4204 case WIDEN_SUM_EXPR
:
4207 case WIDEN_MULT_EXPR
:
4210 case MULT_HIGHPART_EXPR
:
4215 case POINTER_DIFF_EXPR
:
4221 case TRUTH_NOT_EXPR
:
4228 case TRUNC_DIV_EXPR
:
4235 case FLOOR_DIV_EXPR
:
4238 case ROUND_DIV_EXPR
:
4241 case EXACT_DIV_EXPR
:
4244 case TRUNC_MOD_EXPR
:
4250 case FLOOR_MOD_EXPR
:
4253 case ROUND_MOD_EXPR
:
4256 case PREDECREMENT_EXPR
:
4259 case PREINCREMENT_EXPR
:
4262 case POSTDECREMENT_EXPR
:
4265 case POSTINCREMENT_EXPR
:
4275 return "<<< ??? >>>";
4279 /* Return the symbol associated with operator OP. */
4282 op_symbol (const_tree op
)
4284 return op_symbol_code (TREE_CODE (op
));
4287 /* Prints the name of a call. NODE is the CALL_EXPR_FN of a CALL_EXPR or
4288 the gimple_call_fn of a GIMPLE_CALL. */
4291 print_call_name (pretty_printer
*pp
, tree node
, dump_flags_t flags
)
4295 if (TREE_CODE (op0
) == NON_LVALUE_EXPR
)
4296 op0
= TREE_OPERAND (op0
, 0);
4299 switch (TREE_CODE (op0
))
4304 dump_function_name (pp
, op0
, flags
);
4310 op0
= TREE_OPERAND (op0
, 0);
4315 dump_generic_node (pp
, TREE_OPERAND (op0
, 0), 0, flags
, false);
4316 pp_string (pp
, ") ? ");
4317 dump_generic_node (pp
, TREE_OPERAND (op0
, 1), 0, flags
, false);
4318 pp_string (pp
, " : ");
4319 dump_generic_node (pp
, TREE_OPERAND (op0
, 2), 0, flags
, false);
4323 if (TREE_CODE (TREE_OPERAND (op0
, 0)) == VAR_DECL
)
4324 dump_function_name (pp
, TREE_OPERAND (op0
, 0), flags
);
4326 dump_generic_node (pp
, op0
, 0, flags
, false);
4330 if (integer_zerop (TREE_OPERAND (op0
, 1)))
4332 op0
= TREE_OPERAND (op0
, 0);
4339 dump_generic_node (pp
, op0
, 0, flags
, false);
4347 /* Print the first N characters in the array STR, replacing non-printable
4348 characters (including embedded nuls) with unambiguous escape sequences. */
4351 pretty_print_string (pretty_printer
*pp
, const char *str
, size_t n
)
4356 for ( ; n
; --n
, ++str
)
4361 pp_string (pp
, "\\b");
4365 pp_string (pp
, "\\f");
4369 pp_string (pp
, "\\n");
4373 pp_string (pp
, "\\r");
4377 pp_string (pp
, "\\t");
4381 pp_string (pp
, "\\v");
4385 pp_string (pp
, "\\\\");
4389 pp_string (pp
, "\\\"");
4393 pp_string (pp
, "\\'");
4397 if (str
[0] || n
> 1)
4399 if (!ISPRINT (str
[0]))
4402 sprintf (buf
, "\\x%02x", (unsigned char)str
[0]);
4403 pp_string (pp
, buf
);
4406 pp_character (pp
, str
[0]);
4414 maybe_init_pretty_print (FILE *file
)
4418 tree_pp
= new pretty_printer ();
4419 pp_needs_newline (tree_pp
) = true;
4420 pp_translate_identifiers (tree_pp
) = false;
4423 tree_pp
->buffer
->stream
= file
;
4427 newline_and_indent (pretty_printer
*pp
, int spc
)
4433 /* Handle the %K format for TEXT. Separate from default_tree_printer
4434 so it can also be used in front ends.
4435 The location LOC and BLOCK are expected to be extracted by the caller
4436 from the %K argument arg via EXPR_LOCATION(arg) and TREE_BLOCK(arg). */
4439 percent_K_format (text_info
*text
, location_t loc
, tree block
)
4441 text
->set_location (0, loc
, SHOW_RANGE_WITH_CARET
);
4442 gcc_assert (pp_ti_abstract_origin (text
) != NULL
);
4443 *pp_ti_abstract_origin (text
) = NULL
;
4446 && TREE_CODE (block
) == BLOCK
4447 && BLOCK_ABSTRACT_ORIGIN (block
))
4449 tree ao
= BLOCK_ABSTRACT_ORIGIN (block
);
4450 if (TREE_CODE (ao
) == FUNCTION_DECL
)
4452 *pp_ti_abstract_origin (text
) = block
;
4455 block
= BLOCK_SUPERCONTEXT (block
);
4459 /* Print the identifier ID to PRETTY-PRINTER. */
4462 pp_tree_identifier (pretty_printer
*pp
, tree id
)
4464 if (pp_translate_identifiers (pp
))
4466 const char *text
= identifier_to_locale (IDENTIFIER_POINTER (id
));
4467 pp_append_text (pp
, text
, text
+ strlen (text
));
4470 pp_append_text (pp
, IDENTIFIER_POINTER (id
),
4471 IDENTIFIER_POINTER (id
) + IDENTIFIER_LENGTH (id
));
4474 /* A helper function that is used to dump function information before the
4478 dump_function_header (FILE *dump_file
, tree fdecl
, dump_flags_t flags
)
4480 const char *dname
, *aname
;
4481 struct cgraph_node
*node
= cgraph_node::get (fdecl
);
4482 struct function
*fun
= DECL_STRUCT_FUNCTION (fdecl
);
4484 dname
= lang_hooks
.decl_printable_name (fdecl
, 1);
4486 if (DECL_ASSEMBLER_NAME_SET_P (fdecl
))
4487 aname
= (IDENTIFIER_POINTER
4488 (DECL_ASSEMBLER_NAME (fdecl
)));
4490 aname
= "<unset-asm-name>";
4492 fprintf (dump_file
, "\n;; Function %s (%s, funcdef_no=%d",
4493 dname
, aname
, fun
->funcdef_no
);
4494 if (!(flags
& TDF_NOUID
))
4495 fprintf (dump_file
, ", decl_uid=%d", DECL_UID (fdecl
));
4498 fprintf (dump_file
, ", cgraph_uid=%d", node
->get_uid ());
4499 fprintf (dump_file
, ", symbol_order=%d)%s\n\n", node
->order
,
4500 node
->frequency
== NODE_FREQUENCY_HOT
4502 : node
->frequency
== NODE_FREQUENCY_UNLIKELY_EXECUTED
4503 ? " (unlikely executed)"
4504 : node
->frequency
== NODE_FREQUENCY_EXECUTED_ONCE
4505 ? " (executed once)"
4509 fprintf (dump_file
, ")\n\n");
4512 /* Dump double_int D to pretty_printer PP. UNS is true
4513 if D is unsigned and false otherwise. */
4515 pp_double_int (pretty_printer
*pp
, double_int d
, bool uns
)
4518 pp_wide_integer (pp
, d
.low
);
4519 else if (d
.fits_uhwi ())
4520 pp_unsigned_wide_integer (pp
, d
.low
);
4523 unsigned HOST_WIDE_INT low
= d
.low
;
4524 HOST_WIDE_INT high
= d
.high
;
4525 if (!uns
&& d
.is_negative ())
4528 high
= ~high
+ !low
;
4531 /* Would "%x%0*x" or "%x%*0x" get zero-padding on all
4533 sprintf (pp_buffer (pp
)->digit_buffer
,
4534 HOST_WIDE_INT_PRINT_DOUBLE_HEX
,
4535 (unsigned HOST_WIDE_INT
) high
, low
);
4536 pp_string (pp
, pp_buffer (pp
)->digit_buffer
);
4541 # pragma GCC diagnostic pop