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_DEPEND
:
747 pp_string (pp
, "depend(");
748 switch (OMP_CLAUSE_DEPEND_KIND (clause
))
750 case OMP_CLAUSE_DEPEND_DEPOBJ
:
753 case OMP_CLAUSE_DEPEND_IN
:
756 case OMP_CLAUSE_DEPEND_OUT
:
759 case OMP_CLAUSE_DEPEND_INOUT
:
762 case OMP_CLAUSE_DEPEND_MUTEXINOUTSET
:
763 name
= "mutexinoutset";
765 case OMP_CLAUSE_DEPEND_SOURCE
:
766 pp_string (pp
, "source)");
768 case OMP_CLAUSE_DEPEND_LAST
:
769 name
= "__internal__";
771 case OMP_CLAUSE_DEPEND_SINK
:
772 pp_string (pp
, "sink:");
773 for (tree t
= OMP_CLAUSE_DECL (clause
); t
; t
= TREE_CHAIN (t
))
774 if (TREE_CODE (t
) == TREE_LIST
)
776 dump_generic_node (pp
, TREE_VALUE (t
), spc
, flags
, false);
777 if (TREE_PURPOSE (t
) != integer_zero_node
)
779 if (OMP_CLAUSE_DEPEND_SINK_NEGATIVE (t
))
783 dump_generic_node (pp
, TREE_PURPOSE (t
), spc
, flags
,
797 tree t
= OMP_CLAUSE_DECL (clause
);
798 if (TREE_CODE (t
) == TREE_LIST
800 && TREE_CODE (TREE_PURPOSE (t
)) == TREE_VEC
)
802 dump_omp_iterators (pp
, TREE_PURPOSE (t
), spc
, flags
);
806 pp_string (pp
, name
);
808 dump_generic_node (pp
, t
, spc
, flags
, false);
814 pp_string (pp
, "map(");
815 switch (OMP_CLAUSE_MAP_KIND (clause
))
818 case GOMP_MAP_POINTER
:
819 pp_string (pp
, "alloc");
821 case GOMP_MAP_IF_PRESENT
:
822 pp_string (pp
, "no_alloc");
825 case GOMP_MAP_TO_PSET
:
826 pp_string (pp
, "to");
829 pp_string (pp
, "from");
831 case GOMP_MAP_TOFROM
:
832 pp_string (pp
, "tofrom");
834 case GOMP_MAP_FORCE_ALLOC
:
835 pp_string (pp
, "force_alloc");
837 case GOMP_MAP_FORCE_TO
:
838 pp_string (pp
, "force_to");
840 case GOMP_MAP_FORCE_FROM
:
841 pp_string (pp
, "force_from");
843 case GOMP_MAP_FORCE_TOFROM
:
844 pp_string (pp
, "force_tofrom");
846 case GOMP_MAP_FORCE_PRESENT
:
847 pp_string (pp
, "force_present");
849 case GOMP_MAP_DELETE
:
850 pp_string (pp
, "delete");
852 case GOMP_MAP_FORCE_DEVICEPTR
:
853 pp_string (pp
, "force_deviceptr");
855 case GOMP_MAP_ALWAYS_TO
:
856 pp_string (pp
, "always,to");
858 case GOMP_MAP_ALWAYS_FROM
:
859 pp_string (pp
, "always,from");
861 case GOMP_MAP_ALWAYS_TOFROM
:
862 pp_string (pp
, "always,tofrom");
864 case GOMP_MAP_RELEASE
:
865 pp_string (pp
, "release");
867 case GOMP_MAP_FIRSTPRIVATE_POINTER
:
868 pp_string (pp
, "firstprivate");
870 case GOMP_MAP_FIRSTPRIVATE_REFERENCE
:
871 pp_string (pp
, "firstprivate ref");
873 case GOMP_MAP_STRUCT
:
874 pp_string (pp
, "struct");
876 case GOMP_MAP_ALWAYS_POINTER
:
877 pp_string (pp
, "always_pointer");
879 case GOMP_MAP_DEVICE_RESIDENT
:
880 pp_string (pp
, "device_resident");
883 pp_string (pp
, "link");
885 case GOMP_MAP_ATTACH
:
886 pp_string (pp
, "attach");
888 case GOMP_MAP_DETACH
:
889 pp_string (pp
, "detach");
891 case GOMP_MAP_FORCE_DETACH
:
892 pp_string (pp
, "force_detach");
894 case GOMP_MAP_ATTACH_DETACH
:
895 pp_string (pp
, "attach_detach");
901 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
904 if (OMP_CLAUSE_SIZE (clause
))
906 switch (OMP_CLAUSE_CODE (clause
) == OMP_CLAUSE_MAP
907 ? OMP_CLAUSE_MAP_KIND (clause
) : GOMP_MAP_TO
)
909 case GOMP_MAP_POINTER
:
910 case GOMP_MAP_FIRSTPRIVATE_POINTER
:
911 case GOMP_MAP_FIRSTPRIVATE_REFERENCE
:
912 case GOMP_MAP_ALWAYS_POINTER
:
913 pp_string (pp
, " [pointer assign, bias: ");
915 case GOMP_MAP_TO_PSET
:
916 pp_string (pp
, " [pointer set, len: ");
918 case GOMP_MAP_ATTACH
:
919 case GOMP_MAP_DETACH
:
920 case GOMP_MAP_FORCE_DETACH
:
921 case GOMP_MAP_ATTACH_DETACH
:
922 pp_string (pp
, " [bias: ");
925 pp_string (pp
, " [len: ");
928 dump_generic_node (pp
, OMP_CLAUSE_SIZE (clause
),
930 pp_right_bracket (pp
);
935 case OMP_CLAUSE_FROM
:
936 pp_string (pp
, "from(");
937 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
939 goto print_clause_size
;
942 pp_string (pp
, "to(");
943 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
945 goto print_clause_size
;
947 case OMP_CLAUSE__CACHE_
:
949 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
951 goto print_clause_size
;
953 case OMP_CLAUSE_NUM_TEAMS
:
954 pp_string (pp
, "num_teams(");
955 dump_generic_node (pp
, OMP_CLAUSE_NUM_TEAMS_EXPR (clause
),
960 case OMP_CLAUSE_THREAD_LIMIT
:
961 pp_string (pp
, "thread_limit(");
962 dump_generic_node (pp
, OMP_CLAUSE_THREAD_LIMIT_EXPR (clause
),
967 case OMP_CLAUSE_DEVICE
:
968 pp_string (pp
, "device(");
969 dump_generic_node (pp
, OMP_CLAUSE_DEVICE_ID (clause
),
974 case OMP_CLAUSE_DIST_SCHEDULE
:
975 pp_string (pp
, "dist_schedule(static");
976 if (OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR (clause
))
979 dump_generic_node (pp
,
980 OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR (clause
),
986 case OMP_CLAUSE_PROC_BIND
:
987 pp_string (pp
, "proc_bind(");
988 switch (OMP_CLAUSE_PROC_BIND_KIND (clause
))
990 case OMP_CLAUSE_PROC_BIND_MASTER
:
991 pp_string (pp
, "master");
993 case OMP_CLAUSE_PROC_BIND_CLOSE
:
994 pp_string (pp
, "close");
996 case OMP_CLAUSE_PROC_BIND_SPREAD
:
997 pp_string (pp
, "spread");
1002 pp_right_paren (pp
);
1005 case OMP_CLAUSE_DEVICE_TYPE
:
1006 pp_string (pp
, "device_type(");
1007 switch (OMP_CLAUSE_DEVICE_TYPE_KIND (clause
))
1009 case OMP_CLAUSE_DEVICE_TYPE_HOST
:
1010 pp_string (pp
, "host");
1012 case OMP_CLAUSE_DEVICE_TYPE_NOHOST
:
1013 pp_string (pp
, "nohost");
1015 case OMP_CLAUSE_DEVICE_TYPE_ANY
:
1016 pp_string (pp
, "any");
1021 pp_right_paren (pp
);
1024 case OMP_CLAUSE_SAFELEN
:
1025 pp_string (pp
, "safelen(");
1026 dump_generic_node (pp
, OMP_CLAUSE_SAFELEN_EXPR (clause
),
1028 pp_right_paren (pp
);
1031 case OMP_CLAUSE_SIMDLEN
:
1032 pp_string (pp
, "simdlen(");
1033 dump_generic_node (pp
, OMP_CLAUSE_SIMDLEN_EXPR (clause
),
1035 pp_right_paren (pp
);
1038 case OMP_CLAUSE_PRIORITY
:
1039 pp_string (pp
, "priority(");
1040 dump_generic_node (pp
, OMP_CLAUSE_PRIORITY_EXPR (clause
),
1042 pp_right_paren (pp
);
1045 case OMP_CLAUSE_GRAINSIZE
:
1046 pp_string (pp
, "grainsize(");
1047 dump_generic_node (pp
, OMP_CLAUSE_GRAINSIZE_EXPR (clause
),
1049 pp_right_paren (pp
);
1052 case OMP_CLAUSE_NUM_TASKS
:
1053 pp_string (pp
, "num_tasks(");
1054 dump_generic_node (pp
, OMP_CLAUSE_NUM_TASKS_EXPR (clause
),
1056 pp_right_paren (pp
);
1059 case OMP_CLAUSE_HINT
:
1060 pp_string (pp
, "hint(");
1061 dump_generic_node (pp
, OMP_CLAUSE_HINT_EXPR (clause
),
1063 pp_right_paren (pp
);
1066 case OMP_CLAUSE_DEFAULTMAP
:
1067 pp_string (pp
, "defaultmap(");
1068 switch (OMP_CLAUSE_DEFAULTMAP_BEHAVIOR (clause
))
1070 case OMP_CLAUSE_DEFAULTMAP_ALLOC
:
1071 pp_string (pp
, "alloc");
1073 case OMP_CLAUSE_DEFAULTMAP_TO
:
1074 pp_string (pp
, "to");
1076 case OMP_CLAUSE_DEFAULTMAP_FROM
:
1077 pp_string (pp
, "from");
1079 case OMP_CLAUSE_DEFAULTMAP_TOFROM
:
1080 pp_string (pp
, "tofrom");
1082 case OMP_CLAUSE_DEFAULTMAP_FIRSTPRIVATE
:
1083 pp_string (pp
, "firstprivate");
1085 case OMP_CLAUSE_DEFAULTMAP_NONE
:
1086 pp_string (pp
, "none");
1088 case OMP_CLAUSE_DEFAULTMAP_DEFAULT
:
1089 pp_string (pp
, "default");
1094 switch (OMP_CLAUSE_DEFAULTMAP_CATEGORY (clause
))
1096 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_UNSPECIFIED
:
1098 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_SCALAR
:
1099 pp_string (pp
, ":scalar");
1101 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_AGGREGATE
:
1102 pp_string (pp
, ":aggregate");
1104 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_ALLOCATABLE
:
1105 pp_string (pp
, ":allocatable");
1107 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_POINTER
:
1108 pp_string (pp
, ":pointer");
1113 pp_right_paren (pp
);
1116 case OMP_CLAUSE_ORDER
:
1117 pp_string (pp
, "order(concurrent)");
1120 case OMP_CLAUSE_BIND
:
1121 pp_string (pp
, "bind(");
1122 switch (OMP_CLAUSE_BIND_KIND (clause
))
1124 case OMP_CLAUSE_BIND_TEAMS
:
1125 pp_string (pp
, "teams");
1127 case OMP_CLAUSE_BIND_PARALLEL
:
1128 pp_string (pp
, "parallel");
1130 case OMP_CLAUSE_BIND_THREAD
:
1131 pp_string (pp
, "thread");
1136 pp_right_paren (pp
);
1139 case OMP_CLAUSE__SIMDUID_
:
1140 pp_string (pp
, "_simduid_(");
1141 dump_generic_node (pp
, OMP_CLAUSE__SIMDUID__DECL (clause
),
1143 pp_right_paren (pp
);
1146 case OMP_CLAUSE__SIMT_
:
1147 pp_string (pp
, "_simt_");
1150 case OMP_CLAUSE_GANG
:
1151 pp_string (pp
, "gang");
1152 if (OMP_CLAUSE_GANG_EXPR (clause
) != NULL_TREE
)
1154 pp_string (pp
, "(num: ");
1155 dump_generic_node (pp
, OMP_CLAUSE_GANG_EXPR (clause
),
1158 if (OMP_CLAUSE_GANG_STATIC_EXPR (clause
) != NULL_TREE
)
1160 if (OMP_CLAUSE_GANG_EXPR (clause
) == NULL_TREE
)
1164 pp_string (pp
, "static:");
1165 if (OMP_CLAUSE_GANG_STATIC_EXPR (clause
)
1166 == integer_minus_one_node
)
1167 pp_character (pp
, '*');
1169 dump_generic_node (pp
, OMP_CLAUSE_GANG_STATIC_EXPR (clause
),
1172 if (OMP_CLAUSE_GANG_EXPR (clause
) != NULL_TREE
1173 || OMP_CLAUSE_GANG_STATIC_EXPR (clause
) != NULL_TREE
)
1174 pp_right_paren (pp
);
1177 case OMP_CLAUSE_ASYNC
:
1178 pp_string (pp
, "async");
1179 if (OMP_CLAUSE_ASYNC_EXPR (clause
))
1181 pp_character(pp
, '(');
1182 dump_generic_node (pp
, OMP_CLAUSE_ASYNC_EXPR (clause
),
1184 pp_character(pp
, ')');
1188 case OMP_CLAUSE_AUTO
:
1189 case OMP_CLAUSE_SEQ
:
1190 pp_string (pp
, omp_clause_code_name
[OMP_CLAUSE_CODE (clause
)]);
1193 case OMP_CLAUSE_WAIT
:
1194 pp_string (pp
, "wait(");
1195 dump_generic_node (pp
, OMP_CLAUSE_WAIT_EXPR (clause
),
1197 pp_character(pp
, ')');
1200 case OMP_CLAUSE_WORKER
:
1201 pp_string (pp
, "worker");
1202 if (OMP_CLAUSE_WORKER_EXPR (clause
) != NULL_TREE
)
1205 dump_generic_node (pp
, OMP_CLAUSE_WORKER_EXPR (clause
),
1207 pp_right_paren (pp
);
1211 case OMP_CLAUSE_VECTOR
:
1212 pp_string (pp
, "vector");
1213 if (OMP_CLAUSE_VECTOR_EXPR (clause
) != NULL_TREE
)
1216 dump_generic_node (pp
, OMP_CLAUSE_VECTOR_EXPR (clause
),
1218 pp_right_paren (pp
);
1222 case OMP_CLAUSE_NUM_GANGS
:
1223 pp_string (pp
, "num_gangs(");
1224 dump_generic_node (pp
, OMP_CLAUSE_NUM_GANGS_EXPR (clause
),
1226 pp_character (pp
, ')');
1229 case OMP_CLAUSE_NUM_WORKERS
:
1230 pp_string (pp
, "num_workers(");
1231 dump_generic_node (pp
, OMP_CLAUSE_NUM_WORKERS_EXPR (clause
),
1233 pp_character (pp
, ')');
1236 case OMP_CLAUSE_VECTOR_LENGTH
:
1237 pp_string (pp
, "vector_length(");
1238 dump_generic_node (pp
, OMP_CLAUSE_VECTOR_LENGTH_EXPR (clause
),
1240 pp_character (pp
, ')');
1243 case OMP_CLAUSE_INBRANCH
:
1244 pp_string (pp
, "inbranch");
1246 case OMP_CLAUSE_NOTINBRANCH
:
1247 pp_string (pp
, "notinbranch");
1249 case OMP_CLAUSE_FOR
:
1250 pp_string (pp
, "for");
1252 case OMP_CLAUSE_PARALLEL
:
1253 pp_string (pp
, "parallel");
1255 case OMP_CLAUSE_SECTIONS
:
1256 pp_string (pp
, "sections");
1258 case OMP_CLAUSE_TASKGROUP
:
1259 pp_string (pp
, "taskgroup");
1261 case OMP_CLAUSE_NOGROUP
:
1262 pp_string (pp
, "nogroup");
1264 case OMP_CLAUSE_THREADS
:
1265 pp_string (pp
, "threads");
1267 case OMP_CLAUSE_SIMD
:
1268 pp_string (pp
, "simd");
1270 case OMP_CLAUSE_INDEPENDENT
:
1271 pp_string (pp
, "independent");
1273 case OMP_CLAUSE_TILE
:
1274 pp_string (pp
, "tile(");
1275 dump_generic_node (pp
, OMP_CLAUSE_TILE_LIST (clause
),
1277 pp_right_paren (pp
);
1280 case OMP_CLAUSE_IF_PRESENT
:
1281 pp_string (pp
, "if_present");
1283 case OMP_CLAUSE_FINALIZE
:
1284 pp_string (pp
, "finalize");
1286 case OMP_CLAUSE_DETACH
:
1287 pp_string (pp
, "detach(");
1288 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
), spc
, flags
,
1290 pp_right_paren (pp
);
1299 /* Dump the list of OpenMP clauses. PP, SPC and FLAGS are as in
1300 dump_generic_node. */
1303 dump_omp_clauses (pretty_printer
*pp
, tree clause
, int spc
, dump_flags_t flags
)
1311 dump_omp_clause (pp
, clause
, spc
, flags
);
1312 clause
= OMP_CLAUSE_CHAIN (clause
);
1320 /* Dump location LOC to PP. */
1323 dump_location (pretty_printer
*pp
, location_t loc
)
1325 expanded_location xloc
= expand_location (loc
);
1327 pp_left_bracket (pp
);
1330 pp_string (pp
, xloc
.file
);
1331 pp_string (pp
, ":");
1333 pp_decimal_int (pp
, xloc
.line
);
1335 pp_decimal_int (pp
, xloc
.column
);
1336 pp_string (pp
, "] ");
1340 /* Dump lexical block BLOCK. PP, SPC and FLAGS are as in
1341 dump_generic_node. */
1344 dump_block_node (pretty_printer
*pp
, tree block
, int spc
, dump_flags_t flags
)
1348 pp_string (pp
, "BLOCK #");
1349 pp_decimal_int (pp
, BLOCK_NUMBER (block
));
1350 pp_character (pp
, ' ');
1352 if (flags
& TDF_ADDRESS
)
1354 pp_character (pp
, '[');
1355 pp_scalar (pp
, "%p", (void *) block
);
1356 pp_string (pp
, "] ");
1359 if (TREE_ASM_WRITTEN (block
))
1360 pp_string (pp
, "[written] ");
1362 if (flags
& TDF_SLIM
)
1365 if (BLOCK_SOURCE_LOCATION (block
))
1366 dump_location (pp
, BLOCK_SOURCE_LOCATION (block
));
1368 newline_and_indent (pp
, spc
+ 2);
1370 if (BLOCK_SUPERCONTEXT (block
))
1372 pp_string (pp
, "SUPERCONTEXT: ");
1373 dump_generic_node (pp
, BLOCK_SUPERCONTEXT (block
), 0,
1374 flags
| TDF_SLIM
, false);
1375 newline_and_indent (pp
, spc
+ 2);
1378 if (BLOCK_SUBBLOCKS (block
))
1380 pp_string (pp
, "SUBBLOCKS: ");
1381 for (t
= BLOCK_SUBBLOCKS (block
); t
; t
= BLOCK_CHAIN (t
))
1383 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
1386 newline_and_indent (pp
, spc
+ 2);
1389 if (BLOCK_CHAIN (block
))
1391 pp_string (pp
, "SIBLINGS: ");
1392 for (t
= BLOCK_CHAIN (block
); t
; t
= BLOCK_CHAIN (t
))
1394 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
1397 newline_and_indent (pp
, spc
+ 2);
1400 if (BLOCK_VARS (block
))
1402 pp_string (pp
, "VARS: ");
1403 for (t
= BLOCK_VARS (block
); t
; t
= TREE_CHAIN (t
))
1405 dump_generic_node (pp
, t
, 0, flags
, false);
1408 newline_and_indent (pp
, spc
+ 2);
1411 if (vec_safe_length (BLOCK_NONLOCALIZED_VARS (block
)) > 0)
1414 vec
<tree
, va_gc
> *nlv
= BLOCK_NONLOCALIZED_VARS (block
);
1416 pp_string (pp
, "NONLOCALIZED_VARS: ");
1417 FOR_EACH_VEC_ELT (*nlv
, i
, t
)
1419 dump_generic_node (pp
, t
, 0, flags
, false);
1422 newline_and_indent (pp
, spc
+ 2);
1425 if (BLOCK_ABSTRACT_ORIGIN (block
))
1427 pp_string (pp
, "ABSTRACT_ORIGIN: ");
1428 dump_generic_node (pp
, BLOCK_ABSTRACT_ORIGIN (block
), 0,
1429 flags
| TDF_SLIM
, false);
1430 newline_and_indent (pp
, spc
+ 2);
1433 if (BLOCK_FRAGMENT_ORIGIN (block
))
1435 pp_string (pp
, "FRAGMENT_ORIGIN: ");
1436 dump_generic_node (pp
, BLOCK_FRAGMENT_ORIGIN (block
), 0,
1437 flags
| TDF_SLIM
, false);
1438 newline_and_indent (pp
, spc
+ 2);
1441 if (BLOCK_FRAGMENT_CHAIN (block
))
1443 pp_string (pp
, "FRAGMENT_CHAIN: ");
1444 for (t
= BLOCK_FRAGMENT_CHAIN (block
); t
; t
= BLOCK_FRAGMENT_CHAIN (t
))
1446 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
1449 newline_and_indent (pp
, spc
+ 2);
1453 /* Dump #pragma omp atomic memory order clause. */
1456 dump_omp_atomic_memory_order (pretty_printer
*pp
, enum omp_memory_order mo
)
1460 case OMP_MEMORY_ORDER_RELAXED
:
1461 pp_string (pp
, " relaxed");
1463 case OMP_MEMORY_ORDER_SEQ_CST
:
1464 pp_string (pp
, " seq_cst");
1466 case OMP_MEMORY_ORDER_ACQ_REL
:
1467 pp_string (pp
, " acq_rel");
1469 case OMP_MEMORY_ORDER_ACQUIRE
:
1470 pp_string (pp
, " acquire");
1472 case OMP_MEMORY_ORDER_RELEASE
:
1473 pp_string (pp
, " release");
1475 case OMP_MEMORY_ORDER_UNSPECIFIED
:
1482 /* Helper to dump a MEM_REF node. */
1485 dump_mem_ref (pretty_printer
*pp
, tree node
, int spc
, dump_flags_t flags
)
1487 if (TREE_CODE (node
) == MEM_REF
&& (flags
& TDF_GIMPLE
))
1489 pp_string (pp
, "__MEM <");
1490 dump_generic_node (pp
, TREE_TYPE (node
),
1491 spc
, flags
| TDF_SLIM
, false);
1492 if (TYPE_ALIGN (TREE_TYPE (node
))
1493 != TYPE_ALIGN (TYPE_MAIN_VARIANT (TREE_TYPE (node
))))
1495 pp_string (pp
, ", ");
1496 pp_decimal_int (pp
, TYPE_ALIGN (TREE_TYPE (node
)));
1499 pp_string (pp
, " (");
1500 if (TREE_TYPE (TREE_OPERAND (node
, 0))
1501 != TREE_TYPE (TREE_OPERAND (node
, 1)))
1504 dump_generic_node (pp
, TREE_TYPE (TREE_OPERAND (node
, 1)),
1505 spc
, flags
| TDF_SLIM
, false);
1506 pp_right_paren (pp
);
1508 dump_generic_node (pp
, TREE_OPERAND (node
, 0),
1509 spc
, flags
| TDF_SLIM
, false);
1510 if (! integer_zerop (TREE_OPERAND (node
, 1)))
1512 pp_string (pp
, " + ");
1513 dump_generic_node (pp
, TREE_OPERAND (node
, 1),
1514 spc
, flags
| TDF_SLIM
, false);
1516 pp_right_paren (pp
);
1518 else if (TREE_CODE (node
) == MEM_REF
1519 && integer_zerop (TREE_OPERAND (node
, 1))
1520 /* Dump the types of INTEGER_CSTs explicitly, for we can't
1521 infer them and MEM_ATTR caching will share MEM_REFs
1522 with differently-typed op0s. */
1523 && TREE_CODE (TREE_OPERAND (node
, 0)) != INTEGER_CST
1524 /* Released SSA_NAMES have no TREE_TYPE. */
1525 && TREE_TYPE (TREE_OPERAND (node
, 0)) != NULL_TREE
1526 /* Same pointer types, but ignoring POINTER_TYPE vs.
1528 && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 0)))
1529 == TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 1))))
1530 && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (node
, 0)))
1531 == TYPE_MODE (TREE_TYPE (TREE_OPERAND (node
, 1))))
1532 && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node
, 0)))
1533 == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node
, 1))))
1534 /* Same value types ignoring qualifiers. */
1535 && (TYPE_MAIN_VARIANT (TREE_TYPE (node
))
1536 == TYPE_MAIN_VARIANT
1537 (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 1)))))
1538 && (!(flags
& TDF_ALIAS
)
1539 || MR_DEPENDENCE_CLIQUE (node
) == 0))
1541 if (TREE_CODE (TREE_OPERAND (node
, 0)) != ADDR_EXPR
)
1543 /* Enclose pointers to arrays in parentheses. */
1544 tree op0
= TREE_OPERAND (node
, 0);
1545 tree op0type
= TREE_TYPE (op0
);
1546 if (POINTER_TYPE_P (op0type
)
1547 && TREE_CODE (TREE_TYPE (op0type
)) == ARRAY_TYPE
)
1550 dump_generic_node (pp
, op0
, spc
, flags
, false);
1551 if (POINTER_TYPE_P (op0type
)
1552 && TREE_CODE (TREE_TYPE (op0type
)) == ARRAY_TYPE
)
1553 pp_right_paren (pp
);
1556 dump_generic_node (pp
,
1557 TREE_OPERAND (TREE_OPERAND (node
, 0), 0),
1562 pp_string (pp
, "MEM");
1564 tree nodetype
= TREE_TYPE (node
);
1565 tree op0
= TREE_OPERAND (node
, 0);
1566 tree op1
= TREE_OPERAND (node
, 1);
1567 tree op1type
= TYPE_MAIN_VARIANT (TREE_TYPE (op1
));
1569 tree op0size
= TYPE_SIZE (nodetype
);
1570 tree op1size
= TYPE_SIZE (TREE_TYPE (op1type
));
1572 if (!op0size
|| !op1size
1573 || !operand_equal_p (op0size
, op1size
, 0))
1575 pp_string (pp
, " <");
1576 /* If the size of the type of the operand is not the same
1577 as the size of the MEM_REF expression include the type
1578 of the latter similar to the TDF_GIMPLE output to make
1579 it clear how many bytes of memory are being accessed. */
1580 dump_generic_node (pp
, nodetype
, spc
, flags
| TDF_SLIM
, false);
1581 pp_string (pp
, "> ");
1584 pp_string (pp
, "[(");
1585 dump_generic_node (pp
, op1type
, spc
, flags
| TDF_SLIM
, false);
1586 pp_right_paren (pp
);
1587 dump_generic_node (pp
, op0
, spc
, flags
, false);
1588 if (!integer_zerop (op1
))
1590 pp_string (pp
, " + ");
1591 dump_generic_node (pp
, op1
, spc
, flags
, false);
1593 if (TREE_CODE (node
) == TARGET_MEM_REF
)
1595 tree tmp
= TMR_INDEX2 (node
);
1598 pp_string (pp
, " + ");
1599 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1601 tmp
= TMR_INDEX (node
);
1604 pp_string (pp
, " + ");
1605 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1606 tmp
= TMR_STEP (node
);
1607 pp_string (pp
, " * ");
1609 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1611 pp_string (pp
, "1");
1614 if ((flags
& TDF_ALIAS
)
1615 && MR_DEPENDENCE_CLIQUE (node
) != 0)
1617 pp_string (pp
, " clique ");
1618 pp_unsigned_wide_integer (pp
, MR_DEPENDENCE_CLIQUE (node
));
1619 pp_string (pp
, " base ");
1620 pp_unsigned_wide_integer (pp
, MR_DEPENDENCE_BASE (node
));
1622 pp_right_bracket (pp
);
1626 /* Helper function for dump_generic_node. Dump INIT or COND expression for
1627 OpenMP loop non-rectangular iterators. */
1630 dump_omp_loop_non_rect_expr (pretty_printer
*pp
, tree node
, int spc
,
1633 gcc_assert (TREE_CODE (node
) == TREE_VEC
);
1634 dump_generic_node (pp
, TREE_VEC_ELT (node
, 0), spc
, flags
, false);
1635 pp_string (pp
, " * ");
1636 if (op_prio (TREE_VEC_ELT (node
, 1)) <= op_code_prio (MULT_EXPR
))
1639 dump_generic_node (pp
, TREE_VEC_ELT (node
, 1), spc
, flags
, false);
1640 pp_right_paren (pp
);
1643 dump_generic_node (pp
, TREE_VEC_ELT (node
, 1), spc
, flags
, false);
1644 pp_string (pp
, " + ");
1645 if (op_prio (TREE_VEC_ELT (node
, 1)) <= op_code_prio (PLUS_EXPR
))
1648 dump_generic_node (pp
, TREE_VEC_ELT (node
, 2), spc
, flags
, false);
1649 pp_right_paren (pp
);
1652 dump_generic_node (pp
, TREE_VEC_ELT (node
, 2), spc
, flags
, false);
1655 /* Dump the node NODE on the pretty_printer PP, SPC spaces of
1656 indent. FLAGS specifies details to show in the dump (see TDF_* in
1657 dumpfile.h). If IS_STMT is true, the object printed is considered
1658 to be a statement and it is terminated by ';' if appropriate. */
1661 dump_generic_node (pretty_printer
*pp
, tree node
, int spc
, dump_flags_t flags
,
1668 enum tree_code code
;
1670 if (node
== NULL_TREE
)
1673 is_expr
= EXPR_P (node
);
1675 if (is_stmt
&& (flags
& TDF_STMTADDR
))
1677 pp_string (pp
, "<&");
1678 pp_scalar (pp
, "%p", (void *)node
);
1679 pp_string (pp
, "> ");
1682 if ((flags
& TDF_LINENO
) && EXPR_HAS_LOCATION (node
))
1683 dump_location (pp
, EXPR_LOCATION (node
));
1685 code
= TREE_CODE (node
);
1689 pp_string (pp
, "<<< error >>>");
1692 case IDENTIFIER_NODE
:
1693 pp_tree_identifier (pp
, node
);
1697 while (node
&& node
!= error_mark_node
)
1699 if (TREE_PURPOSE (node
))
1701 dump_generic_node (pp
, TREE_PURPOSE (node
), spc
, flags
, false);
1704 dump_generic_node (pp
, TREE_VALUE (node
), spc
, flags
, false);
1705 node
= TREE_CHAIN (node
);
1706 if (node
&& TREE_CODE (node
) == TREE_LIST
)
1715 dump_generic_node (pp
, BINFO_TYPE (node
), spc
, flags
, false);
1721 if (TREE_VEC_LENGTH (node
) > 0)
1723 size_t len
= TREE_VEC_LENGTH (node
);
1724 for (i
= 0; i
< len
- 1; i
++)
1726 dump_generic_node (pp
, TREE_VEC_ELT (node
, i
), spc
, flags
,
1731 dump_generic_node (pp
, TREE_VEC_ELT (node
, len
- 1), spc
,
1740 case FIXED_POINT_TYPE
:
1747 unsigned int quals
= TYPE_QUALS (node
);
1748 enum tree_code_class tclass
;
1750 if (quals
& TYPE_QUAL_ATOMIC
)
1751 pp_string (pp
, "atomic ");
1752 if (quals
& TYPE_QUAL_CONST
)
1753 pp_string (pp
, "const ");
1754 if (quals
& TYPE_QUAL_VOLATILE
)
1755 pp_string (pp
, "volatile ");
1756 if (quals
& TYPE_QUAL_RESTRICT
)
1757 pp_string (pp
, "restrict ");
1759 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
1761 pp_string (pp
, "<address-space-");
1762 pp_decimal_int (pp
, TYPE_ADDR_SPACE (node
));
1763 pp_string (pp
, "> ");
1766 tclass
= TREE_CODE_CLASS (TREE_CODE (node
));
1768 if (tclass
== tcc_declaration
)
1770 if (DECL_NAME (node
))
1771 dump_decl_name (pp
, node
, flags
);
1773 pp_string (pp
, "<unnamed type decl>");
1775 else if (tclass
== tcc_type
)
1777 if (TYPE_NAME (node
))
1779 if (TREE_CODE (TYPE_NAME (node
)) == IDENTIFIER_NODE
)
1780 pp_tree_identifier (pp
, TYPE_NAME (node
));
1781 else if (TREE_CODE (TYPE_NAME (node
)) == TYPE_DECL
1782 && DECL_NAME (TYPE_NAME (node
)))
1783 dump_decl_name (pp
, TYPE_NAME (node
), flags
);
1785 pp_string (pp
, "<unnamed type>");
1787 else if (TREE_CODE (node
) == VECTOR_TYPE
)
1789 pp_string (pp
, "vector");
1791 pp_wide_integer (pp
, TYPE_VECTOR_SUBPARTS (node
));
1792 pp_string (pp
, ") ");
1793 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1795 else if (TREE_CODE (node
) == INTEGER_TYPE
)
1797 if (TYPE_PRECISION (node
) == CHAR_TYPE_SIZE
)
1798 pp_string (pp
, (TYPE_UNSIGNED (node
)
1801 else if (TYPE_PRECISION (node
) == SHORT_TYPE_SIZE
)
1802 pp_string (pp
, (TYPE_UNSIGNED (node
)
1805 else if (TYPE_PRECISION (node
) == INT_TYPE_SIZE
)
1806 pp_string (pp
, (TYPE_UNSIGNED (node
)
1809 else if (TYPE_PRECISION (node
) == LONG_TYPE_SIZE
)
1810 pp_string (pp
, (TYPE_UNSIGNED (node
)
1813 else if (TYPE_PRECISION (node
) == LONG_LONG_TYPE_SIZE
)
1814 pp_string (pp
, (TYPE_UNSIGNED (node
)
1815 ? "unsigned long long"
1816 : "signed long long"));
1817 else if (TYPE_PRECISION (node
) >= CHAR_TYPE_SIZE
1818 && pow2p_hwi (TYPE_PRECISION (node
)))
1820 pp_string (pp
, (TYPE_UNSIGNED (node
) ? "uint" : "int"));
1821 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1822 pp_string (pp
, "_t");
1826 pp_string (pp
, (TYPE_UNSIGNED (node
)
1827 ? "<unnamed-unsigned:"
1828 : "<unnamed-signed:"));
1829 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1833 else if (TREE_CODE (node
) == COMPLEX_TYPE
)
1835 pp_string (pp
, "__complex__ ");
1836 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1838 else if (TREE_CODE (node
) == REAL_TYPE
)
1840 pp_string (pp
, "<float:");
1841 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1844 else if (TREE_CODE (node
) == FIXED_POINT_TYPE
)
1846 pp_string (pp
, "<fixed-point-");
1847 pp_string (pp
, TYPE_SATURATING (node
) ? "sat:" : "nonsat:");
1848 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1851 else if (TREE_CODE (node
) == BOOLEAN_TYPE
)
1853 pp_string (pp
, (TYPE_UNSIGNED (node
)
1854 ? "<unsigned-boolean:"
1855 : "<signed-boolean:"));
1856 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1859 else if (TREE_CODE (node
) == VOID_TYPE
)
1860 pp_string (pp
, "void");
1862 pp_string (pp
, "<unnamed type>");
1868 case REFERENCE_TYPE
:
1869 str
= (TREE_CODE (node
) == POINTER_TYPE
? "*" : "&");
1871 if (TREE_TYPE (node
) == NULL
)
1873 pp_string (pp
, str
);
1874 pp_string (pp
, "<null type>");
1876 else if (TREE_CODE (TREE_TYPE (node
)) == FUNCTION_TYPE
)
1878 tree fnode
= TREE_TYPE (node
);
1880 dump_generic_node (pp
, TREE_TYPE (fnode
), spc
, flags
, false);
1883 pp_string (pp
, str
);
1884 if (TYPE_IDENTIFIER (node
))
1885 dump_generic_node (pp
, TYPE_NAME (node
), spc
, flags
, false);
1886 else if (flags
& TDF_NOUID
)
1887 pp_string (pp
, "<Txxxx>");
1890 pp_string (pp
, "<T");
1891 pp_scalar (pp
, "%x", TYPE_UID (node
));
1892 pp_character (pp
, '>');
1895 pp_right_paren (pp
);
1896 dump_function_declaration (pp
, fnode
, spc
, flags
);
1900 unsigned int quals
= TYPE_QUALS (node
);
1902 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1904 pp_string (pp
, str
);
1906 if (quals
& TYPE_QUAL_CONST
)
1907 pp_string (pp
, " const");
1908 if (quals
& TYPE_QUAL_VOLATILE
)
1909 pp_string (pp
, " volatile");
1910 if (quals
& TYPE_QUAL_RESTRICT
)
1911 pp_string (pp
, " restrict");
1913 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
1915 pp_string (pp
, " <address-space-");
1916 pp_decimal_int (pp
, TYPE_ADDR_SPACE (node
));
1920 if (TYPE_REF_CAN_ALIAS_ALL (node
))
1921 pp_string (pp
, " {ref-all}");
1930 case TARGET_MEM_REF
:
1931 dump_mem_ref (pp
, node
, spc
, flags
);
1936 unsigned int quals
= TYPE_QUALS (node
);
1939 if (quals
& TYPE_QUAL_ATOMIC
)
1940 pp_string (pp
, "atomic ");
1941 if (quals
& TYPE_QUAL_CONST
)
1942 pp_string (pp
, "const ");
1943 if (quals
& TYPE_QUAL_VOLATILE
)
1944 pp_string (pp
, "volatile ");
1946 /* Print the innermost component type. */
1947 for (tmp
= TREE_TYPE (node
); TREE_CODE (tmp
) == ARRAY_TYPE
;
1948 tmp
= TREE_TYPE (tmp
))
1950 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1952 /* Print the dimensions. */
1953 for (tmp
= node
; TREE_CODE (tmp
) == ARRAY_TYPE
; tmp
= TREE_TYPE (tmp
))
1954 dump_array_domain (pp
, TYPE_DOMAIN (tmp
), spc
, flags
);
1960 case QUAL_UNION_TYPE
:
1962 unsigned int quals
= TYPE_QUALS (node
);
1964 if (quals
& TYPE_QUAL_ATOMIC
)
1965 pp_string (pp
, "atomic ");
1966 if (quals
& TYPE_QUAL_CONST
)
1967 pp_string (pp
, "const ");
1968 if (quals
& TYPE_QUAL_VOLATILE
)
1969 pp_string (pp
, "volatile ");
1971 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
1973 pp_string (pp
, "<address-space-");
1974 pp_decimal_int (pp
, TYPE_ADDR_SPACE (node
));
1975 pp_string (pp
, "> ");
1978 /* Print the name of the structure. */
1979 if (TREE_CODE (node
) == RECORD_TYPE
)
1980 pp_string (pp
, "struct ");
1981 else if (TREE_CODE (node
) == UNION_TYPE
)
1982 pp_string (pp
, "union ");
1984 if (TYPE_NAME (node
))
1985 dump_generic_node (pp
, TYPE_NAME (node
), spc
, flags
, false);
1986 else if (!(flags
& TDF_SLIM
))
1987 /* FIXME: If we eliminate the 'else' above and attempt
1988 to show the fields for named types, we may get stuck
1989 following a cycle of pointers to structs. The alleged
1990 self-reference check in print_struct_decl will not detect
1991 cycles involving more than one pointer or struct type. */
1992 print_struct_decl (pp
, node
, spc
, flags
);
2001 if (flags
& TDF_GIMPLE
2002 && (POINTER_TYPE_P (TREE_TYPE (node
))
2003 || (TYPE_PRECISION (TREE_TYPE (node
))
2004 < TYPE_PRECISION (integer_type_node
))
2005 || exact_log2 (TYPE_PRECISION (TREE_TYPE (node
))) == -1
2006 || tree_int_cst_sgn (node
) < 0))
2008 pp_string (pp
, "_Literal (");
2009 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2010 pp_string (pp
, ") ");
2012 if (TREE_CODE (TREE_TYPE (node
)) == POINTER_TYPE
2013 && ! (flags
& TDF_GIMPLE
))
2015 /* In the case of a pointer, one may want to divide by the
2016 size of the pointed-to type. Unfortunately, this not
2017 straightforward. The C front-end maps expressions
2022 in such a way that the two INTEGER_CST nodes for "5" have
2023 different values but identical types. In the latter
2024 case, the 5 is multiplied by sizeof (int) in c-common.c
2025 (pointer_int_sum) to convert it to a byte address, and
2026 yet the type of the node is left unchanged. Argh. What
2027 is consistent though is that the number value corresponds
2028 to bytes (UNITS) offset.
2030 NB: Neither of the following divisors can be trivially
2031 used to recover the original literal:
2033 TREE_INT_CST_LOW (TYPE_SIZE_UNIT (TREE_TYPE (node)))
2034 TYPE_PRECISION (TREE_TYPE (TREE_TYPE (node))) */
2035 pp_wide_integer (pp
, TREE_INT_CST_LOW (node
));
2036 pp_string (pp
, "B"); /* pseudo-unit */
2038 else if (tree_fits_shwi_p (node
))
2039 pp_wide_integer (pp
, tree_to_shwi (node
));
2040 else if (tree_fits_uhwi_p (node
))
2041 pp_unsigned_wide_integer (pp
, tree_to_uhwi (node
));
2044 wide_int val
= wi::to_wide (node
);
2046 if (wi::neg_p (val
, TYPE_SIGN (TREE_TYPE (node
))))
2051 print_hex (val
, pp_buffer (pp
)->digit_buffer
);
2052 pp_string (pp
, pp_buffer (pp
)->digit_buffer
);
2054 if ((flags
& TDF_GIMPLE
)
2055 && ! (POINTER_TYPE_P (TREE_TYPE (node
))
2056 || (TYPE_PRECISION (TREE_TYPE (node
))
2057 < TYPE_PRECISION (integer_type_node
))
2058 || exact_log2 (TYPE_PRECISION (TREE_TYPE (node
))) == -1))
2060 if (TYPE_UNSIGNED (TREE_TYPE (node
)))
2061 pp_character (pp
, 'u');
2062 if (TYPE_PRECISION (TREE_TYPE (node
))
2063 == TYPE_PRECISION (unsigned_type_node
))
2065 else if (TYPE_PRECISION (TREE_TYPE (node
))
2066 == TYPE_PRECISION (long_unsigned_type_node
))
2067 pp_character (pp
, 'l');
2068 else if (TYPE_PRECISION (TREE_TYPE (node
))
2069 == TYPE_PRECISION (long_long_unsigned_type_node
))
2070 pp_string (pp
, "ll");
2072 if (TREE_OVERFLOW (node
))
2073 pp_string (pp
, "(OVF)");
2077 pp_string (pp
, "POLY_INT_CST [");
2078 dump_generic_node (pp
, POLY_INT_CST_COEFF (node
, 0), spc
, flags
, false);
2079 for (unsigned int i
= 1; i
< NUM_POLY_INT_COEFFS
; ++i
)
2081 pp_string (pp
, ", ");
2082 dump_generic_node (pp
, POLY_INT_CST_COEFF (node
, i
),
2085 pp_string (pp
, "]");
2089 /* Code copied from print_node. */
2092 if (TREE_OVERFLOW (node
))
2093 pp_string (pp
, " overflow");
2095 d
= TREE_REAL_CST (node
);
2096 if (REAL_VALUE_ISINF (d
))
2097 pp_string (pp
, REAL_VALUE_NEGATIVE (d
) ? " -Inf" : " Inf");
2098 else if (REAL_VALUE_ISNAN (d
))
2099 pp_string (pp
, " Nan");
2103 real_to_decimal (string
, &d
, sizeof (string
), 0, 1);
2104 pp_string (pp
, string
);
2112 fixed_to_decimal (string
, TREE_FIXED_CST_PTR (node
), sizeof (string
));
2113 pp_string (pp
, string
);
2118 pp_string (pp
, "__complex__ (");
2119 dump_generic_node (pp
, TREE_REALPART (node
), spc
, flags
, false);
2120 pp_string (pp
, ", ");
2121 dump_generic_node (pp
, TREE_IMAGPART (node
), spc
, flags
, false);
2122 pp_right_paren (pp
);
2127 pp_string (pp
, "\"");
2128 if (unsigned nbytes
= TREE_STRING_LENGTH (node
))
2129 pretty_print_string (pp
, TREE_STRING_POINTER (node
), nbytes
);
2130 pp_string (pp
, "\"");
2137 if (flags
& TDF_GIMPLE
)
2139 pp_string (pp
, "_Literal (");
2140 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2141 pp_string (pp
, ") ");
2143 pp_string (pp
, "{ ");
2144 unsigned HOST_WIDE_INT nunits
;
2145 if (!VECTOR_CST_NELTS (node
).is_constant (&nunits
))
2146 nunits
= vector_cst_encoded_nelts (node
);
2147 for (i
= 0; i
< nunits
; ++i
)
2150 pp_string (pp
, ", ");
2151 dump_generic_node (pp
, VECTOR_CST_ELT (node
, i
),
2154 if (!VECTOR_CST_NELTS (node
).is_constant ())
2155 pp_string (pp
, ", ...");
2156 pp_string (pp
, " }");
2162 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2164 if (TREE_CODE (node
) == METHOD_TYPE
)
2166 if (TYPE_METHOD_BASETYPE (node
))
2167 dump_generic_node (pp
, TYPE_NAME (TYPE_METHOD_BASETYPE (node
)),
2170 pp_string (pp
, "<null method basetype>");
2171 pp_colon_colon (pp
);
2173 if (TYPE_IDENTIFIER (node
))
2174 dump_generic_node (pp
, TYPE_NAME (node
), spc
, flags
, false);
2175 else if (TYPE_NAME (node
) && DECL_NAME (TYPE_NAME (node
)))
2176 dump_decl_name (pp
, TYPE_NAME (node
), flags
);
2177 else if (flags
& TDF_NOUID
)
2178 pp_string (pp
, "<Txxxx>");
2181 pp_string (pp
, "<T");
2182 pp_scalar (pp
, "%x", TYPE_UID (node
));
2183 pp_character (pp
, '>');
2185 dump_function_declaration (pp
, node
, spc
, flags
);
2190 dump_decl_name (pp
, node
, flags
);
2194 if (DECL_NAME (node
))
2195 dump_decl_name (pp
, node
, flags
);
2196 else if (LABEL_DECL_UID (node
) != -1)
2198 if (flags
& TDF_GIMPLE
)
2200 pp_character (pp
, 'L');
2201 pp_decimal_int (pp
, (int) LABEL_DECL_UID (node
));
2205 pp_string (pp
, "<L");
2206 pp_decimal_int (pp
, (int) LABEL_DECL_UID (node
));
2207 pp_character (pp
, '>');
2212 if (flags
& TDF_NOUID
)
2213 pp_string (pp
, "<D.xxxx>");
2216 if (flags
& TDF_GIMPLE
)
2218 pp_character (pp
, 'D');
2219 pp_scalar (pp
, "%u", DECL_UID (node
));
2223 pp_string (pp
, "<D.");
2224 pp_scalar (pp
, "%u", DECL_UID (node
));
2225 pp_character (pp
, '>');
2232 if (DECL_IS_UNDECLARED_BUILTIN (node
))
2234 /* Don't print the declaration of built-in types. */
2237 if (DECL_NAME (node
))
2238 dump_decl_name (pp
, node
, flags
);
2239 else if (TYPE_NAME (TREE_TYPE (node
)) != node
)
2241 pp_string (pp
, (TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
2242 ? "union" : "struct "));
2243 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2246 pp_string (pp
, "<anon>");
2252 case DEBUG_EXPR_DECL
:
2253 case NAMESPACE_DECL
:
2255 dump_decl_name (pp
, node
, flags
);
2259 pp_string (pp
, "<retval>");
2263 op0
= TREE_OPERAND (node
, 0);
2266 && (TREE_CODE (op0
) == INDIRECT_REF
2267 || (TREE_CODE (op0
) == MEM_REF
2268 && TREE_CODE (TREE_OPERAND (op0
, 0)) != ADDR_EXPR
2269 && integer_zerop (TREE_OPERAND (op0
, 1))
2270 /* Dump the types of INTEGER_CSTs explicitly, for we
2271 can't infer them and MEM_ATTR caching will share
2272 MEM_REFs with differently-typed op0s. */
2273 && TREE_CODE (TREE_OPERAND (op0
, 0)) != INTEGER_CST
2274 /* Released SSA_NAMES have no TREE_TYPE. */
2275 && TREE_TYPE (TREE_OPERAND (op0
, 0)) != NULL_TREE
2276 /* Same pointer types, but ignoring POINTER_TYPE vs.
2278 && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 0)))
2279 == TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 1))))
2280 && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0
, 0)))
2281 == TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0
, 1))))
2282 && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0
, 0)))
2283 == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0
, 1))))
2284 /* Same value types ignoring qualifiers. */
2285 && (TYPE_MAIN_VARIANT (TREE_TYPE (op0
))
2286 == TYPE_MAIN_VARIANT
2287 (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 1)))))
2288 && MR_DEPENDENCE_CLIQUE (op0
) == 0)))
2290 op0
= TREE_OPERAND (op0
, 0);
2293 if (op_prio (op0
) < op_prio (node
))
2295 dump_generic_node (pp
, op0
, spc
, flags
, false);
2296 if (op_prio (op0
) < op_prio (node
))
2297 pp_right_paren (pp
);
2298 pp_string (pp
, str
);
2299 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2300 op0
= component_ref_field_offset (node
);
2301 if (op0
&& TREE_CODE (op0
) != INTEGER_CST
)
2303 pp_string (pp
, "{off: ");
2304 dump_generic_node (pp
, op0
, spc
, flags
, false);
2305 pp_right_brace (pp
);
2310 if (flags
& TDF_GIMPLE
)
2312 pp_string (pp
, "__BIT_FIELD_REF <");
2313 dump_generic_node (pp
, TREE_TYPE (node
),
2314 spc
, flags
| TDF_SLIM
, false);
2315 if (TYPE_ALIGN (TREE_TYPE (node
))
2316 != TYPE_ALIGN (TYPE_MAIN_VARIANT (TREE_TYPE (node
))))
2318 pp_string (pp
, ", ");
2319 pp_decimal_int (pp
, TYPE_ALIGN (TREE_TYPE (node
)));
2322 pp_string (pp
, " (");
2323 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
,
2324 flags
| TDF_SLIM
, false);
2325 pp_string (pp
, ", ");
2326 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
,
2327 flags
| TDF_SLIM
, false);
2328 pp_string (pp
, ", ");
2329 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
,
2330 flags
| TDF_SLIM
, false);
2331 pp_right_paren (pp
);
2335 pp_string (pp
, "BIT_FIELD_REF <");
2336 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2337 pp_string (pp
, ", ");
2338 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2339 pp_string (pp
, ", ");
2340 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2345 case BIT_INSERT_EXPR
:
2346 pp_string (pp
, "BIT_INSERT_EXPR <");
2347 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2348 pp_string (pp
, ", ");
2349 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2350 pp_string (pp
, ", ");
2351 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2352 pp_string (pp
, " (");
2353 if (INTEGRAL_TYPE_P (TREE_TYPE (TREE_OPERAND (node
, 1))))
2355 TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (node
, 1))));
2357 dump_generic_node (pp
, TYPE_SIZE (TREE_TYPE (TREE_OPERAND (node
, 1))),
2359 pp_string (pp
, " bits)>");
2363 case ARRAY_RANGE_REF
:
2364 op0
= TREE_OPERAND (node
, 0);
2365 if (op_prio (op0
) < op_prio (node
))
2367 dump_generic_node (pp
, op0
, spc
, flags
, false);
2368 if (op_prio (op0
) < op_prio (node
))
2369 pp_right_paren (pp
);
2370 pp_left_bracket (pp
);
2371 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2372 if (TREE_CODE (node
) == ARRAY_RANGE_REF
)
2373 pp_string (pp
, " ...");
2374 pp_right_bracket (pp
);
2376 op0
= array_ref_low_bound (node
);
2377 op1
= array_ref_element_size (node
);
2379 if (!integer_zerop (op0
)
2380 || TREE_OPERAND (node
, 2)
2381 || TREE_OPERAND (node
, 3))
2383 pp_string (pp
, "{lb: ");
2384 dump_generic_node (pp
, op0
, spc
, flags
, false);
2385 pp_string (pp
, " sz: ");
2386 dump_generic_node (pp
, op1
, spc
, flags
, false);
2387 pp_right_brace (pp
);
2393 unsigned HOST_WIDE_INT ix
;
2395 bool is_struct_init
= false;
2396 bool is_array_init
= false;
2398 if (flags
& TDF_GIMPLE
)
2400 pp_string (pp
, "_Literal (");
2401 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2402 pp_string (pp
, ") ");
2405 if (TREE_CLOBBER_P (node
))
2406 pp_string (pp
, "CLOBBER");
2407 else if (TREE_CODE (TREE_TYPE (node
)) == RECORD_TYPE
2408 || TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
)
2409 is_struct_init
= true;
2410 else if (TREE_CODE (TREE_TYPE (node
)) == ARRAY_TYPE
2411 && TYPE_DOMAIN (TREE_TYPE (node
))
2412 && TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
)))
2413 && TREE_CODE (TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
))))
2416 tree minv
= TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
)));
2417 is_array_init
= true;
2418 curidx
= wi::to_widest (minv
);
2420 FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (node
), ix
, field
, val
)
2427 dump_generic_node (pp
, field
, spc
, flags
, false);
2430 else if (is_array_init
2431 && (TREE_CODE (field
) != INTEGER_CST
2432 || curidx
!= wi::to_widest (field
)))
2434 pp_left_bracket (pp
);
2435 if (TREE_CODE (field
) == RANGE_EXPR
)
2437 dump_generic_node (pp
, TREE_OPERAND (field
, 0), spc
,
2439 pp_string (pp
, " ... ");
2440 dump_generic_node (pp
, TREE_OPERAND (field
, 1), spc
,
2442 if (TREE_CODE (TREE_OPERAND (field
, 1)) == INTEGER_CST
)
2443 curidx
= wi::to_widest (TREE_OPERAND (field
, 1));
2446 dump_generic_node (pp
, field
, spc
, flags
, false);
2447 if (TREE_CODE (field
) == INTEGER_CST
)
2448 curidx
= wi::to_widest (field
);
2449 pp_string (pp
, "]=");
2454 if (val
&& TREE_CODE (val
) == ADDR_EXPR
)
2455 if (TREE_CODE (TREE_OPERAND (val
, 0)) == FUNCTION_DECL
)
2456 val
= TREE_OPERAND (val
, 0);
2457 if (val
&& TREE_CODE (val
) == FUNCTION_DECL
)
2458 dump_decl_name (pp
, val
, flags
);
2460 dump_generic_node (pp
, val
, spc
, flags
, false);
2461 if (ix
!= CONSTRUCTOR_NELTS (node
) - 1)
2467 pp_right_brace (pp
);
2474 if (flags
& TDF_SLIM
)
2476 pp_string (pp
, "<COMPOUND_EXPR>");
2480 dump_generic_node (pp
, TREE_OPERAND (node
, 0),
2481 spc
, flags
, !(flags
& TDF_SLIM
));
2482 if (flags
& TDF_SLIM
)
2483 newline_and_indent (pp
, spc
);
2490 for (tp
= &TREE_OPERAND (node
, 1);
2491 TREE_CODE (*tp
) == COMPOUND_EXPR
;
2492 tp
= &TREE_OPERAND (*tp
, 1))
2494 dump_generic_node (pp
, TREE_OPERAND (*tp
, 0),
2495 spc
, flags
, !(flags
& TDF_SLIM
));
2496 if (flags
& TDF_SLIM
)
2497 newline_and_indent (pp
, spc
);
2505 dump_generic_node (pp
, *tp
, spc
, flags
, !(flags
& TDF_SLIM
));
2509 case STATEMENT_LIST
:
2511 tree_stmt_iterator si
;
2514 if (flags
& TDF_SLIM
)
2516 pp_string (pp
, "<STATEMENT_LIST>");
2520 for (si
= tsi_start (node
); !tsi_end_p (si
); tsi_next (&si
))
2523 newline_and_indent (pp
, spc
);
2526 dump_generic_node (pp
, tsi_stmt (si
), spc
, flags
, true);
2533 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
,
2538 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
,
2543 pp_string (pp
, "TARGET_EXPR <");
2544 dump_generic_node (pp
, TARGET_EXPR_SLOT (node
), spc
, flags
, false);
2547 dump_generic_node (pp
, TARGET_EXPR_INITIAL (node
), spc
, flags
, false);
2552 print_declaration (pp
, DECL_EXPR_DECL (node
), spc
, flags
);
2557 if (TREE_TYPE (node
) == NULL
|| TREE_TYPE (node
) == void_type_node
)
2559 pp_string (pp
, "if (");
2560 dump_generic_node (pp
, COND_EXPR_COND (node
), spc
, flags
, false);
2561 pp_right_paren (pp
);
2562 /* The lowered cond_exprs should always be printed in full. */
2563 if (COND_EXPR_THEN (node
)
2564 && (IS_EMPTY_STMT (COND_EXPR_THEN (node
))
2565 || TREE_CODE (COND_EXPR_THEN (node
)) == GOTO_EXPR
)
2566 && COND_EXPR_ELSE (node
)
2567 && (IS_EMPTY_STMT (COND_EXPR_ELSE (node
))
2568 || TREE_CODE (COND_EXPR_ELSE (node
)) == GOTO_EXPR
))
2571 dump_generic_node (pp
, COND_EXPR_THEN (node
),
2573 if (!IS_EMPTY_STMT (COND_EXPR_ELSE (node
)))
2575 pp_string (pp
, " else ");
2576 dump_generic_node (pp
, COND_EXPR_ELSE (node
),
2580 else if (!(flags
& TDF_SLIM
))
2582 /* Output COND_EXPR_THEN. */
2583 if (COND_EXPR_THEN (node
))
2585 newline_and_indent (pp
, spc
+2);
2587 newline_and_indent (pp
, spc
+4);
2588 dump_generic_node (pp
, COND_EXPR_THEN (node
), spc
+4,
2590 newline_and_indent (pp
, spc
+2);
2591 pp_right_brace (pp
);
2594 /* Output COND_EXPR_ELSE. */
2595 if (COND_EXPR_ELSE (node
)
2596 && !IS_EMPTY_STMT (COND_EXPR_ELSE (node
)))
2598 newline_and_indent (pp
, spc
);
2599 pp_string (pp
, "else");
2600 newline_and_indent (pp
, spc
+2);
2602 newline_and_indent (pp
, spc
+4);
2603 dump_generic_node (pp
, COND_EXPR_ELSE (node
), spc
+4,
2605 newline_and_indent (pp
, spc
+2);
2606 pp_right_brace (pp
);
2613 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2617 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2621 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2627 if (!(flags
& TDF_SLIM
))
2629 if (BIND_EXPR_VARS (node
))
2633 for (op0
= BIND_EXPR_VARS (node
); op0
; op0
= DECL_CHAIN (op0
))
2635 print_declaration (pp
, op0
, spc
+2, flags
);
2640 newline_and_indent (pp
, spc
+2);
2641 dump_generic_node (pp
, BIND_EXPR_BODY (node
), spc
+2, flags
, true);
2642 newline_and_indent (pp
, spc
);
2643 pp_right_brace (pp
);
2649 if (CALL_EXPR_FN (node
) != NULL_TREE
)
2650 print_call_name (pp
, CALL_EXPR_FN (node
), flags
);
2654 pp_string (pp
, internal_fn_name (CALL_EXPR_IFN (node
)));
2657 /* Print parameters. */
2662 call_expr_arg_iterator iter
;
2663 FOR_EACH_CALL_EXPR_ARG (arg
, iter
, node
)
2665 dump_generic_node (pp
, arg
, spc
, flags
, false);
2666 if (more_call_expr_args_p (&iter
))
2673 if (CALL_EXPR_VA_ARG_PACK (node
))
2675 if (call_expr_nargs (node
) > 0)
2680 pp_string (pp
, "__builtin_va_arg_pack ()");
2682 pp_right_paren (pp
);
2684 op1
= CALL_EXPR_STATIC_CHAIN (node
);
2687 pp_string (pp
, " [static-chain: ");
2688 dump_generic_node (pp
, op1
, spc
, flags
, false);
2689 pp_right_bracket (pp
);
2692 if (CALL_EXPR_RETURN_SLOT_OPT (node
))
2693 pp_string (pp
, " [return slot optimization]");
2694 if (CALL_EXPR_TAILCALL (node
))
2695 pp_string (pp
, " [tail call]");
2698 case WITH_CLEANUP_EXPR
:
2702 case CLEANUP_POINT_EXPR
:
2703 pp_string (pp
, "<<cleanup_point ");
2704 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2705 pp_string (pp
, ">>");
2708 case PLACEHOLDER_EXPR
:
2709 pp_string (pp
, "<PLACEHOLDER_EXPR ");
2710 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2714 /* Binary arithmetic and logic expressions. */
2715 case WIDEN_PLUS_EXPR
:
2716 case WIDEN_MINUS_EXPR
:
2717 case WIDEN_SUM_EXPR
:
2718 case WIDEN_MULT_EXPR
:
2720 case MULT_HIGHPART_EXPR
:
2722 case POINTER_PLUS_EXPR
:
2723 case POINTER_DIFF_EXPR
:
2725 case TRUNC_DIV_EXPR
:
2727 case FLOOR_DIV_EXPR
:
2728 case ROUND_DIV_EXPR
:
2729 case TRUNC_MOD_EXPR
:
2731 case FLOOR_MOD_EXPR
:
2732 case ROUND_MOD_EXPR
:
2734 case EXACT_DIV_EXPR
:
2739 case WIDEN_LSHIFT_EXPR
:
2743 case TRUTH_ANDIF_EXPR
:
2744 case TRUTH_ORIF_EXPR
:
2745 case TRUTH_AND_EXPR
:
2747 case TRUTH_XOR_EXPR
:
2761 case UNORDERED_EXPR
:
2763 const char *op
= op_symbol (node
);
2764 op0
= TREE_OPERAND (node
, 0);
2765 op1
= TREE_OPERAND (node
, 1);
2767 /* When the operands are expressions with less priority,
2768 keep semantics of the tree representation. */
2769 if (op_prio (op0
) <= op_prio (node
))
2772 dump_generic_node (pp
, op0
, spc
, flags
, false);
2773 pp_right_paren (pp
);
2776 dump_generic_node (pp
, op0
, spc
, flags
, false);
2782 /* When the operands are expressions with less priority,
2783 keep semantics of the tree representation. */
2784 if (op_prio (op1
) <= op_prio (node
))
2787 dump_generic_node (pp
, op1
, spc
, flags
, false);
2788 pp_right_paren (pp
);
2791 dump_generic_node (pp
, op1
, spc
, flags
, false);
2795 /* Unary arithmetic and logic expressions. */
2798 case TRUTH_NOT_EXPR
:
2800 case PREDECREMENT_EXPR
:
2801 case PREINCREMENT_EXPR
:
2803 if (TREE_CODE (node
) == ADDR_EXPR
2804 && (TREE_CODE (TREE_OPERAND (node
, 0)) == STRING_CST
2805 || TREE_CODE (TREE_OPERAND (node
, 0)) == FUNCTION_DECL
))
2806 ; /* Do not output '&' for strings and function pointers. */
2808 pp_string (pp
, op_symbol (node
));
2810 if (op_prio (TREE_OPERAND (node
, 0)) < op_prio (node
))
2813 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2814 pp_right_paren (pp
);
2817 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2820 case POSTDECREMENT_EXPR
:
2821 case POSTINCREMENT_EXPR
:
2822 if (op_prio (TREE_OPERAND (node
, 0)) < op_prio (node
))
2825 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2826 pp_right_paren (pp
);
2829 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2830 pp_string (pp
, op_symbol (node
));
2834 pp_string (pp
, "MIN_EXPR <");
2835 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2836 pp_string (pp
, ", ");
2837 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2842 pp_string (pp
, "MAX_EXPR <");
2843 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2844 pp_string (pp
, ", ");
2845 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2850 pp_string (pp
, "ABS_EXPR <");
2851 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2856 pp_string (pp
, "ABSU_EXPR <");
2857 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2865 case ADDR_SPACE_CONVERT_EXPR
:
2866 case FIXED_CONVERT_EXPR
:
2867 case FIX_TRUNC_EXPR
:
2870 type
= TREE_TYPE (node
);
2871 op0
= TREE_OPERAND (node
, 0);
2872 if (type
!= TREE_TYPE (op0
))
2875 dump_generic_node (pp
, type
, spc
, flags
, false);
2876 pp_string (pp
, ") ");
2878 if (op_prio (op0
) < op_prio (node
))
2880 dump_generic_node (pp
, op0
, spc
, flags
, false);
2881 if (op_prio (op0
) < op_prio (node
))
2882 pp_right_paren (pp
);
2885 case VIEW_CONVERT_EXPR
:
2886 if (flags
& TDF_GIMPLE
)
2887 pp_string (pp
, "__VIEW_CONVERT <");
2889 pp_string (pp
, "VIEW_CONVERT_EXPR<");
2890 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2891 pp_string (pp
, ">(");
2892 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2893 pp_right_paren (pp
);
2897 pp_string (pp
, "((");
2898 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2899 pp_string (pp
, "))");
2902 case NON_LVALUE_EXPR
:
2903 pp_string (pp
, "NON_LVALUE_EXPR <");
2904 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2909 pp_string (pp
, "SAVE_EXPR <");
2910 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2915 pp_string (pp
, "COMPLEX_EXPR <");
2916 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2917 pp_string (pp
, ", ");
2918 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2923 pp_string (pp
, "CONJ_EXPR <");
2924 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2929 if (flags
& TDF_GIMPLE
)
2931 pp_string (pp
, "__real ");
2932 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2936 pp_string (pp
, "REALPART_EXPR <");
2937 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2943 if (flags
& TDF_GIMPLE
)
2945 pp_string (pp
, "__imag ");
2946 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2950 pp_string (pp
, "IMAGPART_EXPR <");
2951 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2957 pp_string (pp
, "VA_ARG_EXPR <");
2958 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2962 case TRY_FINALLY_EXPR
:
2963 case TRY_CATCH_EXPR
:
2964 pp_string (pp
, "try");
2965 newline_and_indent (pp
, spc
+2);
2967 newline_and_indent (pp
, spc
+4);
2968 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
+4, flags
, true);
2969 newline_and_indent (pp
, spc
+2);
2970 pp_right_brace (pp
);
2971 newline_and_indent (pp
, spc
);
2972 if (TREE_CODE (node
) == TRY_CATCH_EXPR
)
2974 node
= TREE_OPERAND (node
, 1);
2975 pp_string (pp
, "catch");
2979 gcc_assert (TREE_CODE (node
) == TRY_FINALLY_EXPR
);
2980 node
= TREE_OPERAND (node
, 1);
2981 pp_string (pp
, "finally");
2982 if (TREE_CODE (node
) == EH_ELSE_EXPR
)
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,
2989 newline_and_indent (pp
, spc
+2);
2990 pp_right_brace (pp
);
2991 newline_and_indent (pp
, spc
);
2992 node
= TREE_OPERAND (node
, 1);
2993 pp_string (pp
, "else");
2996 newline_and_indent (pp
, spc
+2);
2998 newline_and_indent (pp
, spc
+4);
2999 dump_generic_node (pp
, node
, spc
+4, flags
, true);
3000 newline_and_indent (pp
, spc
+2);
3001 pp_right_brace (pp
);
3006 pp_string (pp
, "catch (");
3007 dump_generic_node (pp
, CATCH_TYPES (node
), spc
+2, flags
, false);
3008 pp_right_paren (pp
);
3009 newline_and_indent (pp
, spc
+2);
3011 newline_and_indent (pp
, spc
+4);
3012 dump_generic_node (pp
, CATCH_BODY (node
), spc
+4, flags
, true);
3013 newline_and_indent (pp
, spc
+2);
3014 pp_right_brace (pp
);
3018 case EH_FILTER_EXPR
:
3019 pp_string (pp
, "<<<eh_filter (");
3020 dump_generic_node (pp
, EH_FILTER_TYPES (node
), spc
+2, flags
, false);
3021 pp_string (pp
, ")>>>");
3022 newline_and_indent (pp
, spc
+2);
3024 newline_and_indent (pp
, spc
+4);
3025 dump_generic_node (pp
, EH_FILTER_FAILURE (node
), spc
+4, flags
, true);
3026 newline_and_indent (pp
, spc
+2);
3027 pp_right_brace (pp
);
3032 op0
= TREE_OPERAND (node
, 0);
3033 /* If this is for break or continue, don't bother printing it. */
3034 if (DECL_NAME (op0
))
3036 const char *name
= IDENTIFIER_POINTER (DECL_NAME (op0
));
3037 if (strcmp (name
, "break") == 0
3038 || strcmp (name
, "continue") == 0)
3041 dump_generic_node (pp
, op0
, spc
, flags
, false);
3043 if (DECL_NONLOCAL (op0
))
3044 pp_string (pp
, " [non-local]");
3048 pp_string (pp
, "while (1)");
3049 if (!(flags
& TDF_SLIM
))
3051 newline_and_indent (pp
, spc
+2);
3053 newline_and_indent (pp
, spc
+4);
3054 dump_generic_node (pp
, LOOP_EXPR_BODY (node
), spc
+4, flags
, true);
3055 newline_and_indent (pp
, spc
+2);
3056 pp_right_brace (pp
);
3062 pp_string (pp
, "// predicted ");
3063 if (PREDICT_EXPR_OUTCOME (node
))
3064 pp_string (pp
, "likely by ");
3066 pp_string (pp
, "unlikely by ");
3067 pp_string (pp
, predictor_name (PREDICT_EXPR_PREDICTOR (node
)));
3068 pp_string (pp
, " predictor.");
3072 pp_string (pp
, "ANNOTATE_EXPR <");
3073 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3074 switch ((enum annot_expr_kind
) TREE_INT_CST_LOW (TREE_OPERAND (node
, 1)))
3076 case annot_expr_ivdep_kind
:
3077 pp_string (pp
, ", ivdep");
3079 case annot_expr_unroll_kind
:
3081 pp_string (pp
, ", unroll ");
3083 (int) TREE_INT_CST_LOW (TREE_OPERAND (node
, 2)));
3086 case annot_expr_no_vector_kind
:
3087 pp_string (pp
, ", no-vector");
3089 case annot_expr_vector_kind
:
3090 pp_string (pp
, ", vector");
3092 case annot_expr_parallel_kind
:
3093 pp_string (pp
, ", parallel");
3102 pp_string (pp
, "return");
3103 op0
= TREE_OPERAND (node
, 0);
3107 if (TREE_CODE (op0
) == MODIFY_EXPR
)
3108 dump_generic_node (pp
, TREE_OPERAND (op0
, 1),
3111 dump_generic_node (pp
, op0
, spc
, flags
, false);
3116 pp_string (pp
, "if (");
3117 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3118 pp_string (pp
, ") break");
3122 pp_string (pp
, "switch (");
3123 dump_generic_node (pp
, SWITCH_COND (node
), spc
, flags
, false);
3124 pp_right_paren (pp
);
3125 if (!(flags
& TDF_SLIM
))
3127 newline_and_indent (pp
, spc
+2);
3129 if (SWITCH_BODY (node
))
3131 newline_and_indent (pp
, spc
+4);
3132 dump_generic_node (pp
, SWITCH_BODY (node
), spc
+4, flags
,
3135 newline_and_indent (pp
, spc
+2);
3136 pp_right_brace (pp
);
3142 op0
= GOTO_DESTINATION (node
);
3143 if (TREE_CODE (op0
) != SSA_NAME
&& DECL_P (op0
) && DECL_NAME (op0
))
3145 const char *name
= IDENTIFIER_POINTER (DECL_NAME (op0
));
3146 if (strcmp (name
, "break") == 0
3147 || strcmp (name
, "continue") == 0)
3149 pp_string (pp
, name
);
3153 pp_string (pp
, "goto ");
3154 dump_generic_node (pp
, op0
, spc
, flags
, false);
3158 pp_string (pp
, "__asm__");
3159 if (ASM_VOLATILE_P (node
))
3160 pp_string (pp
, " __volatile__");
3162 dump_generic_node (pp
, ASM_STRING (node
), spc
, flags
, false);
3164 dump_generic_node (pp
, ASM_OUTPUTS (node
), spc
, flags
, false);
3166 dump_generic_node (pp
, ASM_INPUTS (node
), spc
, flags
, false);
3167 if (ASM_CLOBBERS (node
))
3170 dump_generic_node (pp
, ASM_CLOBBERS (node
), spc
, flags
, false);
3172 pp_right_paren (pp
);
3175 case CASE_LABEL_EXPR
:
3176 if (CASE_LOW (node
) && CASE_HIGH (node
))
3178 pp_string (pp
, "case ");
3179 dump_generic_node (pp
, CASE_LOW (node
), spc
, flags
, false);
3180 pp_string (pp
, " ... ");
3181 dump_generic_node (pp
, CASE_HIGH (node
), spc
, flags
, false);
3183 else if (CASE_LOW (node
))
3185 pp_string (pp
, "case ");
3186 dump_generic_node (pp
, CASE_LOW (node
), spc
, flags
, false);
3189 pp_string (pp
, "default");
3194 pp_string (pp
, "OBJ_TYPE_REF(");
3195 dump_generic_node (pp
, OBJ_TYPE_REF_EXPR (node
), spc
, flags
, false);
3197 /* We omit the class type for -fcompare-debug because we may
3198 drop TYPE_BINFO early depending on debug info, and then
3199 virtual_method_call_p would return false, whereas when
3200 TYPE_BINFO is preserved it may still return true and then
3201 we'd print the class type. Compare tree and rtl dumps for
3202 libstdc++-prettyprinters/shared_ptr.cc with and without -g,
3203 for example, at occurrences of OBJ_TYPE_REF. */
3204 if (!(flags
& (TDF_SLIM
| TDF_COMPARE_DEBUG
))
3205 && virtual_method_call_p (node
, true))
3207 pp_string (pp
, "(");
3208 dump_generic_node (pp
, obj_type_ref_class (node
, true),
3210 pp_string (pp
, ")");
3212 dump_generic_node (pp
, OBJ_TYPE_REF_OBJECT (node
), spc
, flags
, false);
3214 dump_generic_node (pp
, OBJ_TYPE_REF_TOKEN (node
), spc
, flags
, false);
3215 pp_right_paren (pp
);
3219 if (SSA_NAME_IDENTIFIER (node
))
3221 if ((flags
& TDF_NOUID
)
3222 && SSA_NAME_VAR (node
)
3223 && DECL_NAMELESS (SSA_NAME_VAR (node
)))
3224 dump_fancy_name (pp
, SSA_NAME_IDENTIFIER (node
));
3225 else if (! (flags
& TDF_GIMPLE
)
3226 || SSA_NAME_VAR (node
))
3227 dump_generic_node (pp
, SSA_NAME_IDENTIFIER (node
),
3231 pp_decimal_int (pp
, SSA_NAME_VERSION (node
));
3232 if (SSA_NAME_IS_DEFAULT_DEF (node
))
3233 pp_string (pp
, "(D)");
3234 if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (node
))
3235 pp_string (pp
, "(ab)");
3238 case WITH_SIZE_EXPR
:
3239 pp_string (pp
, "WITH_SIZE_EXPR <");
3240 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3241 pp_string (pp
, ", ");
3242 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3247 pp_string (pp
, "ASSERT_EXPR <");
3248 dump_generic_node (pp
, ASSERT_EXPR_VAR (node
), spc
, flags
, false);
3249 pp_string (pp
, ", ");
3250 dump_generic_node (pp
, ASSERT_EXPR_COND (node
), spc
, flags
, false);
3255 pp_string (pp
, "scev_known");
3258 case SCEV_NOT_KNOWN
:
3259 pp_string (pp
, "scev_not_known");
3262 case POLYNOMIAL_CHREC
:
3264 dump_generic_node (pp
, CHREC_LEFT (node
), spc
, flags
, false);
3265 pp_string (pp
, ", +, ");
3266 dump_generic_node (pp
, CHREC_RIGHT (node
), spc
, flags
, false);
3267 pp_string (pp
, "}_");
3268 pp_scalar (pp
, "%u", CHREC_VARIABLE (node
));
3272 case REALIGN_LOAD_EXPR
:
3273 pp_string (pp
, "REALIGN_LOAD <");
3274 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3275 pp_string (pp
, ", ");
3276 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3277 pp_string (pp
, ", ");
3278 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3283 pp_string (pp
, " VEC_COND_EXPR < ");
3284 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3285 pp_string (pp
, " , ");
3286 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3287 pp_string (pp
, " , ");
3288 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3289 pp_string (pp
, " > ");
3293 pp_string (pp
, " VEC_PERM_EXPR < ");
3294 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3295 pp_string (pp
, " , ");
3296 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3297 pp_string (pp
, " , ");
3298 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3299 pp_string (pp
, " > ");
3303 pp_string (pp
, " DOT_PROD_EXPR < ");
3304 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3305 pp_string (pp
, ", ");
3306 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3307 pp_string (pp
, ", ");
3308 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3309 pp_string (pp
, " > ");
3312 case WIDEN_MULT_PLUS_EXPR
:
3313 pp_string (pp
, " WIDEN_MULT_PLUS_EXPR < ");
3314 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3315 pp_string (pp
, ", ");
3316 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3317 pp_string (pp
, ", ");
3318 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3319 pp_string (pp
, " > ");
3322 case WIDEN_MULT_MINUS_EXPR
:
3323 pp_string (pp
, " WIDEN_MULT_MINUS_EXPR < ");
3324 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3325 pp_string (pp
, ", ");
3326 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3327 pp_string (pp
, ", ");
3328 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3329 pp_string (pp
, " > ");
3333 pp_string (pp
, "#pragma acc parallel");
3334 goto dump_omp_clauses_body
;
3337 pp_string (pp
, "#pragma acc kernels");
3338 goto dump_omp_clauses_body
;
3341 pp_string (pp
, "#pragma acc serial");
3342 goto dump_omp_clauses_body
;
3345 pp_string (pp
, "#pragma acc data");
3346 dump_omp_clauses (pp
, OACC_DATA_CLAUSES (node
), spc
, flags
);
3349 case OACC_HOST_DATA
:
3350 pp_string (pp
, "#pragma acc host_data");
3351 dump_omp_clauses (pp
, OACC_HOST_DATA_CLAUSES (node
), spc
, flags
);
3355 pp_string (pp
, "#pragma acc declare");
3356 dump_omp_clauses (pp
, OACC_DECLARE_CLAUSES (node
), spc
, flags
);
3360 pp_string (pp
, "#pragma acc update");
3361 dump_omp_clauses (pp
, OACC_UPDATE_CLAUSES (node
), spc
, flags
);
3364 case OACC_ENTER_DATA
:
3365 pp_string (pp
, "#pragma acc enter data");
3366 dump_omp_clauses (pp
, OACC_ENTER_DATA_CLAUSES (node
), spc
, flags
);
3369 case OACC_EXIT_DATA
:
3370 pp_string (pp
, "#pragma acc exit data");
3371 dump_omp_clauses (pp
, OACC_EXIT_DATA_CLAUSES (node
), spc
, flags
);
3375 pp_string (pp
, "#pragma acc cache");
3376 dump_omp_clauses (pp
, OACC_CACHE_CLAUSES (node
), spc
, flags
);
3380 pp_string (pp
, "#pragma omp parallel");
3381 dump_omp_clauses (pp
, OMP_PARALLEL_CLAUSES (node
), spc
, flags
);
3384 dump_omp_clauses_body
:
3385 dump_omp_clauses (pp
, OMP_CLAUSES (node
), spc
, flags
);
3389 if (!(flags
& TDF_SLIM
) && OMP_BODY (node
))
3391 newline_and_indent (pp
, spc
+ 2);
3393 newline_and_indent (pp
, spc
+ 4);
3394 dump_generic_node (pp
, OMP_BODY (node
), spc
+ 4, flags
, false);
3395 newline_and_indent (pp
, spc
+ 2);
3396 pp_right_brace (pp
);
3402 pp_string (pp
, OMP_TASK_BODY (node
) ? "#pragma omp task"
3403 : "#pragma omp taskwait");
3404 dump_omp_clauses (pp
, OMP_TASK_CLAUSES (node
), spc
, flags
);
3408 pp_string (pp
, "#pragma omp for");
3412 pp_string (pp
, "#pragma omp simd");
3415 case OMP_DISTRIBUTE
:
3416 pp_string (pp
, "#pragma omp distribute");
3420 pp_string (pp
, "#pragma omp taskloop");
3424 pp_string (pp
, "#pragma omp loop");
3428 pp_string (pp
, "#pragma acc loop");
3432 pp_string (pp
, "#pragma omp teams");
3433 dump_omp_clauses (pp
, OMP_TEAMS_CLAUSES (node
), spc
, flags
);
3436 case OMP_TARGET_DATA
:
3437 pp_string (pp
, "#pragma omp target data");
3438 dump_omp_clauses (pp
, OMP_TARGET_DATA_CLAUSES (node
), spc
, flags
);
3441 case OMP_TARGET_ENTER_DATA
:
3442 pp_string (pp
, "#pragma omp target enter data");
3443 dump_omp_clauses (pp
, OMP_TARGET_ENTER_DATA_CLAUSES (node
), spc
, flags
);
3447 case OMP_TARGET_EXIT_DATA
:
3448 pp_string (pp
, "#pragma omp target exit data");
3449 dump_omp_clauses (pp
, OMP_TARGET_EXIT_DATA_CLAUSES (node
), spc
, flags
);
3454 pp_string (pp
, "#pragma omp target");
3455 dump_omp_clauses (pp
, OMP_TARGET_CLAUSES (node
), spc
, flags
);
3458 case OMP_TARGET_UPDATE
:
3459 pp_string (pp
, "#pragma omp target update");
3460 dump_omp_clauses (pp
, OMP_TARGET_UPDATE_CLAUSES (node
), spc
, flags
);
3465 dump_omp_clauses (pp
, OMP_FOR_CLAUSES (node
), spc
, flags
);
3466 if (!(flags
& TDF_SLIM
))
3470 if (OMP_FOR_PRE_BODY (node
))
3472 newline_and_indent (pp
, spc
+ 2);
3475 newline_and_indent (pp
, spc
);
3476 dump_generic_node (pp
, OMP_FOR_PRE_BODY (node
),
3479 if (OMP_FOR_INIT (node
))
3482 for (i
= 0; i
< TREE_VEC_LENGTH (OMP_FOR_INIT (node
)); i
++)
3485 newline_and_indent (pp
, spc
);
3486 pp_string (pp
, "for (");
3487 tree init
= TREE_VEC_ELT (OMP_FOR_INIT (node
), i
);
3488 if (TREE_CODE (init
) != MODIFY_EXPR
3489 || TREE_CODE (TREE_OPERAND (init
, 1)) != TREE_VEC
)
3490 dump_generic_node (pp
, init
, spc
, flags
, false);
3493 dump_generic_node (pp
, TREE_OPERAND (init
, 0),
3495 pp_string (pp
, " = ");
3496 dump_omp_loop_non_rect_expr (pp
, TREE_OPERAND (init
, 1),
3499 pp_string (pp
, "; ");
3500 tree cond
= TREE_VEC_ELT (OMP_FOR_COND (node
), i
);
3501 if (!COMPARISON_CLASS_P (cond
)
3502 || TREE_CODE (TREE_OPERAND (cond
, 1)) != TREE_VEC
)
3503 dump_generic_node (pp
, cond
, spc
, flags
, false);
3506 dump_generic_node (pp
, TREE_OPERAND (cond
, 0),
3508 const char *op
= op_symbol (cond
);
3512 dump_omp_loop_non_rect_expr (pp
, TREE_OPERAND (cond
, 1),
3515 pp_string (pp
, "; ");
3516 dump_generic_node (pp
,
3517 TREE_VEC_ELT (OMP_FOR_INCR (node
), i
),
3519 pp_right_paren (pp
);
3522 if (OMP_FOR_BODY (node
))
3524 newline_and_indent (pp
, spc
+ 2);
3526 newline_and_indent (pp
, spc
+ 4);
3527 dump_generic_node (pp
, OMP_FOR_BODY (node
), spc
+ 4, flags
,
3529 newline_and_indent (pp
, spc
+ 2);
3530 pp_right_brace (pp
);
3532 if (OMP_FOR_INIT (node
))
3533 spc
-= 2 * TREE_VEC_LENGTH (OMP_FOR_INIT (node
)) - 2;
3534 if (OMP_FOR_PRE_BODY (node
))
3537 newline_and_indent (pp
, spc
+ 2);
3538 pp_right_brace (pp
);
3545 pp_string (pp
, "#pragma omp sections");
3546 dump_omp_clauses (pp
, OMP_SECTIONS_CLAUSES (node
), spc
, flags
);
3550 pp_string (pp
, "#pragma omp section");
3554 if (OMP_SCAN_CLAUSES (node
))
3556 pp_string (pp
, "#pragma omp scan");
3557 dump_omp_clauses (pp
, OMP_SCAN_CLAUSES (node
), spc
, flags
);
3562 pp_string (pp
, "#pragma omp master");
3566 pp_string (pp
, "#pragma omp taskgroup");
3567 dump_omp_clauses (pp
, OMP_TASKGROUP_CLAUSES (node
), spc
, flags
);
3571 pp_string (pp
, "#pragma omp ordered");
3572 dump_omp_clauses (pp
, OMP_ORDERED_CLAUSES (node
), spc
, flags
);
3576 pp_string (pp
, "#pragma omp critical");
3577 if (OMP_CRITICAL_NAME (node
))
3581 dump_generic_node (pp
, OMP_CRITICAL_NAME (node
), spc
,
3583 pp_right_paren (pp
);
3585 dump_omp_clauses (pp
, OMP_CRITICAL_CLAUSES (node
), spc
, flags
);
3589 pp_string (pp
, "#pragma omp atomic");
3590 dump_omp_atomic_memory_order (pp
, OMP_ATOMIC_MEMORY_ORDER (node
));
3591 newline_and_indent (pp
, spc
+ 2);
3592 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3596 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3599 case OMP_ATOMIC_READ
:
3600 pp_string (pp
, "#pragma omp atomic read");
3601 dump_omp_atomic_memory_order (pp
, OMP_ATOMIC_MEMORY_ORDER (node
));
3602 newline_and_indent (pp
, spc
+ 2);
3603 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3607 case OMP_ATOMIC_CAPTURE_OLD
:
3608 case OMP_ATOMIC_CAPTURE_NEW
:
3609 pp_string (pp
, "#pragma omp atomic capture");
3610 dump_omp_atomic_memory_order (pp
, OMP_ATOMIC_MEMORY_ORDER (node
));
3611 newline_and_indent (pp
, spc
+ 2);
3612 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3616 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3620 pp_string (pp
, "#pragma omp single");
3621 dump_omp_clauses (pp
, OMP_SINGLE_CLAUSES (node
), spc
, flags
);
3625 dump_omp_clause (pp
, node
, spc
, flags
);
3629 case TRANSACTION_EXPR
:
3630 if (TRANSACTION_EXPR_OUTER (node
))
3631 pp_string (pp
, "__transaction_atomic [[outer]]");
3632 else if (TRANSACTION_EXPR_RELAXED (node
))
3633 pp_string (pp
, "__transaction_relaxed");
3635 pp_string (pp
, "__transaction_atomic");
3636 if (!(flags
& TDF_SLIM
) && TRANSACTION_EXPR_BODY (node
))
3638 newline_and_indent (pp
, spc
);
3640 newline_and_indent (pp
, spc
+ 2);
3641 dump_generic_node (pp
, TRANSACTION_EXPR_BODY (node
),
3642 spc
+ 2, flags
, false);
3643 newline_and_indent (pp
, spc
);
3644 pp_right_brace (pp
);
3649 case VEC_SERIES_EXPR
:
3650 case VEC_WIDEN_MULT_HI_EXPR
:
3651 case VEC_WIDEN_MULT_LO_EXPR
:
3652 case VEC_WIDEN_PLUS_HI_EXPR
:
3653 case VEC_WIDEN_PLUS_LO_EXPR
:
3654 case VEC_WIDEN_MINUS_HI_EXPR
:
3655 case VEC_WIDEN_MINUS_LO_EXPR
:
3656 case VEC_WIDEN_MULT_EVEN_EXPR
:
3657 case VEC_WIDEN_MULT_ODD_EXPR
:
3658 case VEC_WIDEN_LSHIFT_HI_EXPR
:
3659 case VEC_WIDEN_LSHIFT_LO_EXPR
:
3661 for (str
= get_tree_code_name (code
); *str
; str
++)
3662 pp_character (pp
, TOUPPER (*str
));
3663 pp_string (pp
, " < ");
3664 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3665 pp_string (pp
, ", ");
3666 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3667 pp_string (pp
, " > ");
3670 case VEC_DUPLICATE_EXPR
:
3672 for (str
= get_tree_code_name (code
); *str
; str
++)
3673 pp_character (pp
, TOUPPER (*str
));
3674 pp_string (pp
, " < ");
3675 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3676 pp_string (pp
, " > ");
3679 case VEC_UNPACK_HI_EXPR
:
3680 pp_string (pp
, " VEC_UNPACK_HI_EXPR < ");
3681 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3682 pp_string (pp
, " > ");
3685 case VEC_UNPACK_LO_EXPR
:
3686 pp_string (pp
, " VEC_UNPACK_LO_EXPR < ");
3687 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3688 pp_string (pp
, " > ");
3691 case VEC_UNPACK_FLOAT_HI_EXPR
:
3692 pp_string (pp
, " VEC_UNPACK_FLOAT_HI_EXPR < ");
3693 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3694 pp_string (pp
, " > ");
3697 case VEC_UNPACK_FLOAT_LO_EXPR
:
3698 pp_string (pp
, " VEC_UNPACK_FLOAT_LO_EXPR < ");
3699 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3700 pp_string (pp
, " > ");
3703 case VEC_UNPACK_FIX_TRUNC_HI_EXPR
:
3704 pp_string (pp
, " VEC_UNPACK_FIX_TRUNC_HI_EXPR < ");
3705 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3706 pp_string (pp
, " > ");
3709 case VEC_UNPACK_FIX_TRUNC_LO_EXPR
:
3710 pp_string (pp
, " VEC_UNPACK_FIX_TRUNC_LO_EXPR < ");
3711 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3712 pp_string (pp
, " > ");
3715 case VEC_PACK_TRUNC_EXPR
:
3716 pp_string (pp
, " VEC_PACK_TRUNC_EXPR < ");
3717 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3718 pp_string (pp
, ", ");
3719 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3720 pp_string (pp
, " > ");
3723 case VEC_PACK_SAT_EXPR
:
3724 pp_string (pp
, " VEC_PACK_SAT_EXPR < ");
3725 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3726 pp_string (pp
, ", ");
3727 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3728 pp_string (pp
, " > ");
3731 case VEC_PACK_FIX_TRUNC_EXPR
:
3732 pp_string (pp
, " VEC_PACK_FIX_TRUNC_EXPR < ");
3733 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3734 pp_string (pp
, ", ");
3735 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3736 pp_string (pp
, " > ");
3739 case VEC_PACK_FLOAT_EXPR
:
3740 pp_string (pp
, " VEC_PACK_FLOAT_EXPR < ");
3741 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3742 pp_string (pp
, ", ");
3743 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3744 pp_string (pp
, " > ");
3748 dump_block_node (pp
, node
, spc
, flags
);
3751 case DEBUG_BEGIN_STMT
:
3752 pp_string (pp
, "# DEBUG BEGIN STMT");
3759 if (is_stmt
&& is_expr
)
3765 /* Print the declaration of a variable. */
3768 print_declaration (pretty_printer
*pp
, tree t
, int spc
, dump_flags_t flags
)
3772 if (TREE_CODE(t
) == NAMELIST_DECL
)
3774 pp_string(pp
, "namelist ");
3775 dump_decl_name (pp
, t
, flags
);
3780 if (TREE_CODE (t
) == TYPE_DECL
)
3781 pp_string (pp
, "typedef ");
3783 if (CODE_CONTAINS_STRUCT (TREE_CODE (t
), TS_DECL_WRTL
) && DECL_REGISTER (t
))
3784 pp_string (pp
, "register ");
3786 if (TREE_PUBLIC (t
) && DECL_EXTERNAL (t
))
3787 pp_string (pp
, "extern ");
3788 else if (TREE_STATIC (t
))
3789 pp_string (pp
, "static ");
3791 /* Print the type and name. */
3792 if (TREE_TYPE (t
) && TREE_CODE (TREE_TYPE (t
)) == ARRAY_TYPE
)
3796 /* Print array's type. */
3797 tmp
= TREE_TYPE (t
);
3798 while (TREE_CODE (TREE_TYPE (tmp
)) == ARRAY_TYPE
)
3799 tmp
= TREE_TYPE (tmp
);
3800 dump_generic_node (pp
, TREE_TYPE (tmp
), spc
, flags
, false);
3802 /* Print variable's name. */
3804 dump_generic_node (pp
, t
, spc
, flags
, false);
3806 /* Print the dimensions. */
3807 tmp
= TREE_TYPE (t
);
3808 while (TREE_CODE (tmp
) == ARRAY_TYPE
)
3810 dump_array_domain (pp
, TYPE_DOMAIN (tmp
), spc
, flags
);
3811 tmp
= TREE_TYPE (tmp
);
3814 else if (TREE_CODE (t
) == FUNCTION_DECL
)
3816 dump_generic_node (pp
, TREE_TYPE (TREE_TYPE (t
)), spc
, flags
, false);
3818 dump_decl_name (pp
, t
, flags
);
3819 dump_function_declaration (pp
, TREE_TYPE (t
), spc
, flags
);
3823 /* Print type declaration. */
3824 dump_generic_node (pp
, TREE_TYPE (t
), spc
, flags
, false);
3826 /* Print variable's name. */
3828 dump_generic_node (pp
, t
, spc
, flags
, false);
3831 if (VAR_P (t
) && DECL_HARD_REGISTER (t
))
3833 pp_string (pp
, " __asm__ ");
3835 dump_generic_node (pp
, DECL_ASSEMBLER_NAME (t
), spc
, flags
, false);
3836 pp_right_paren (pp
);
3839 /* The initial value of a function serves to determine whether the function
3840 is declared or defined. So the following does not apply to function
3842 if (TREE_CODE (t
) != FUNCTION_DECL
)
3844 /* Print the initial value. */
3845 if (DECL_INITIAL (t
))
3850 if (!(flags
& TDF_SLIM
))
3851 dump_generic_node (pp
, DECL_INITIAL (t
), spc
, flags
, false);
3853 pp_string (pp
, "<<< omitted >>>");
3857 if (VAR_P (t
) && DECL_HAS_VALUE_EXPR_P (t
))
3859 pp_string (pp
, " [value-expr: ");
3860 dump_generic_node (pp
, DECL_VALUE_EXPR (t
), spc
, flags
, false);
3861 pp_right_bracket (pp
);
3868 /* Prints a structure: name, fields, and methods.
3869 FIXME: Still incomplete. */
3872 print_struct_decl (pretty_printer
*pp
, const_tree node
, int spc
,
3875 /* Print the name of the structure. */
3876 if (TYPE_NAME (node
))
3879 if (TREE_CODE (node
) == RECORD_TYPE
)
3880 pp_string (pp
, "struct ");
3881 else if ((TREE_CODE (node
) == UNION_TYPE
3882 || TREE_CODE (node
) == QUAL_UNION_TYPE
))
3883 pp_string (pp
, "union ");
3885 dump_generic_node (pp
, TYPE_NAME (node
), spc
, TDF_NONE
, false);
3888 /* Print the contents of the structure. */
3894 /* Print the fields of the structure. */
3897 tmp
= TYPE_FIELDS (node
);
3900 /* Avoid to print recursively the structure. */
3901 /* FIXME : Not implemented correctly...,
3902 what about the case when we have a cycle in the contain graph? ...
3903 Maybe this could be solved by looking at the scope in which the
3904 structure was declared. */
3905 if (TREE_TYPE (tmp
) != node
3906 && (TREE_CODE (TREE_TYPE (tmp
)) != POINTER_TYPE
3907 || TREE_TYPE (TREE_TYPE (tmp
)) != node
))
3909 print_declaration (pp
, tmp
, spc
+2, flags
);
3912 tmp
= DECL_CHAIN (tmp
);
3916 pp_right_brace (pp
);
3919 /* Return the priority of the operator CODE.
3921 From lowest to highest precedence with either left-to-right (L-R)
3922 or right-to-left (R-L) associativity]:
3925 2 [R-L] = += -= *= /= %= &= ^= |= <<= >>=
3937 14 [R-L] ! ~ ++ -- + - * & (type) sizeof
3938 15 [L-R] fn() [] -> .
3940 unary +, - and * have higher precedence than the corresponding binary
3944 op_code_prio (enum tree_code code
)
3961 case TRUTH_ORIF_EXPR
:
3964 case TRUTH_AND_EXPR
:
3965 case TRUTH_ANDIF_EXPR
:
3972 case TRUTH_XOR_EXPR
:
3989 case UNORDERED_EXPR
:
4000 case VEC_WIDEN_LSHIFT_HI_EXPR
:
4001 case VEC_WIDEN_LSHIFT_LO_EXPR
:
4002 case WIDEN_LSHIFT_EXPR
:
4005 case WIDEN_SUM_EXPR
:
4007 case POINTER_PLUS_EXPR
:
4008 case POINTER_DIFF_EXPR
:
4012 case VEC_WIDEN_MULT_HI_EXPR
:
4013 case VEC_WIDEN_MULT_LO_EXPR
:
4014 case WIDEN_MULT_EXPR
:
4016 case WIDEN_MULT_PLUS_EXPR
:
4017 case WIDEN_MULT_MINUS_EXPR
:
4019 case MULT_HIGHPART_EXPR
:
4020 case TRUNC_DIV_EXPR
:
4022 case FLOOR_DIV_EXPR
:
4023 case ROUND_DIV_EXPR
:
4025 case EXACT_DIV_EXPR
:
4026 case TRUNC_MOD_EXPR
:
4028 case FLOOR_MOD_EXPR
:
4029 case ROUND_MOD_EXPR
:
4032 case TRUTH_NOT_EXPR
:
4034 case POSTINCREMENT_EXPR
:
4035 case POSTDECREMENT_EXPR
:
4036 case PREINCREMENT_EXPR
:
4037 case PREDECREMENT_EXPR
:
4043 case FIX_TRUNC_EXPR
:
4049 case ARRAY_RANGE_REF
:
4053 /* Special expressions. */
4059 case VEC_UNPACK_HI_EXPR
:
4060 case VEC_UNPACK_LO_EXPR
:
4061 case VEC_UNPACK_FLOAT_HI_EXPR
:
4062 case VEC_UNPACK_FLOAT_LO_EXPR
:
4063 case VEC_UNPACK_FIX_TRUNC_HI_EXPR
:
4064 case VEC_UNPACK_FIX_TRUNC_LO_EXPR
:
4065 case VEC_PACK_TRUNC_EXPR
:
4066 case VEC_PACK_SAT_EXPR
:
4070 /* Return an arbitrarily high precedence to avoid surrounding single
4071 VAR_DECLs in ()s. */
4076 /* Return the priority of the operator OP. */
4079 op_prio (const_tree op
)
4081 enum tree_code code
;
4086 code
= TREE_CODE (op
);
4087 if (code
== SAVE_EXPR
|| code
== NON_LVALUE_EXPR
)
4088 return op_prio (TREE_OPERAND (op
, 0));
4090 return op_code_prio (code
);
4093 /* Return the symbol associated with operator CODE. */
4096 op_symbol_code (enum tree_code code
)
4104 case TRUTH_ORIF_EXPR
:
4107 case TRUTH_AND_EXPR
:
4108 case TRUTH_ANDIF_EXPR
:
4114 case TRUTH_XOR_EXPR
:
4124 case UNORDERED_EXPR
:
4170 case WIDEN_LSHIFT_EXPR
:
4173 case WIDEN_PLUS_EXPR
:
4176 case WIDEN_MINUS_EXPR
:
4179 case POINTER_PLUS_EXPR
:
4185 case WIDEN_SUM_EXPR
:
4188 case WIDEN_MULT_EXPR
:
4191 case MULT_HIGHPART_EXPR
:
4196 case POINTER_DIFF_EXPR
:
4202 case TRUTH_NOT_EXPR
:
4209 case TRUNC_DIV_EXPR
:
4216 case FLOOR_DIV_EXPR
:
4219 case ROUND_DIV_EXPR
:
4222 case EXACT_DIV_EXPR
:
4225 case TRUNC_MOD_EXPR
:
4231 case FLOOR_MOD_EXPR
:
4234 case ROUND_MOD_EXPR
:
4237 case PREDECREMENT_EXPR
:
4240 case PREINCREMENT_EXPR
:
4243 case POSTDECREMENT_EXPR
:
4246 case POSTINCREMENT_EXPR
:
4256 return "<<< ??? >>>";
4260 /* Return the symbol associated with operator OP. */
4263 op_symbol (const_tree op
)
4265 return op_symbol_code (TREE_CODE (op
));
4268 /* Prints the name of a call. NODE is the CALL_EXPR_FN of a CALL_EXPR or
4269 the gimple_call_fn of a GIMPLE_CALL. */
4272 print_call_name (pretty_printer
*pp
, tree node
, dump_flags_t flags
)
4276 if (TREE_CODE (op0
) == NON_LVALUE_EXPR
)
4277 op0
= TREE_OPERAND (op0
, 0);
4280 switch (TREE_CODE (op0
))
4285 dump_function_name (pp
, op0
, flags
);
4291 op0
= TREE_OPERAND (op0
, 0);
4296 dump_generic_node (pp
, TREE_OPERAND (op0
, 0), 0, flags
, false);
4297 pp_string (pp
, ") ? ");
4298 dump_generic_node (pp
, TREE_OPERAND (op0
, 1), 0, flags
, false);
4299 pp_string (pp
, " : ");
4300 dump_generic_node (pp
, TREE_OPERAND (op0
, 2), 0, flags
, false);
4304 if (TREE_CODE (TREE_OPERAND (op0
, 0)) == VAR_DECL
)
4305 dump_function_name (pp
, TREE_OPERAND (op0
, 0), flags
);
4307 dump_generic_node (pp
, op0
, 0, flags
, false);
4311 if (integer_zerop (TREE_OPERAND (op0
, 1)))
4313 op0
= TREE_OPERAND (op0
, 0);
4320 dump_generic_node (pp
, op0
, 0, flags
, false);
4328 /* Print the first N characters in the array STR, replacing non-printable
4329 characters (including embedded nuls) with unambiguous escape sequences. */
4332 pretty_print_string (pretty_printer
*pp
, const char *str
, size_t n
)
4337 for ( ; n
; --n
, ++str
)
4342 pp_string (pp
, "\\b");
4346 pp_string (pp
, "\\f");
4350 pp_string (pp
, "\\n");
4354 pp_string (pp
, "\\r");
4358 pp_string (pp
, "\\t");
4362 pp_string (pp
, "\\v");
4366 pp_string (pp
, "\\\\");
4370 pp_string (pp
, "\\\"");
4374 pp_string (pp
, "\\'");
4378 if (str
[0] || n
> 1)
4380 if (!ISPRINT (str
[0]))
4383 sprintf (buf
, "\\x%02x", (unsigned char)str
[0]);
4384 pp_string (pp
, buf
);
4387 pp_character (pp
, str
[0]);
4395 maybe_init_pretty_print (FILE *file
)
4399 tree_pp
= new pretty_printer ();
4400 pp_needs_newline (tree_pp
) = true;
4401 pp_translate_identifiers (tree_pp
) = false;
4404 tree_pp
->buffer
->stream
= file
;
4408 newline_and_indent (pretty_printer
*pp
, int spc
)
4414 /* Handle the %K format for TEXT. Separate from default_tree_printer
4415 so it can also be used in front ends.
4416 The location LOC and BLOCK are expected to be extracted by the caller
4417 from the %K argument arg via EXPR_LOCATION(arg) and TREE_BLOCK(arg). */
4420 percent_K_format (text_info
*text
, location_t loc
, tree block
)
4422 text
->set_location (0, loc
, SHOW_RANGE_WITH_CARET
);
4423 gcc_assert (pp_ti_abstract_origin (text
) != NULL
);
4424 *pp_ti_abstract_origin (text
) = NULL
;
4427 && TREE_CODE (block
) == BLOCK
4428 && BLOCK_ABSTRACT_ORIGIN (block
))
4430 tree ao
= BLOCK_ABSTRACT_ORIGIN (block
);
4431 if (TREE_CODE (ao
) == FUNCTION_DECL
)
4433 *pp_ti_abstract_origin (text
) = block
;
4436 block
= BLOCK_SUPERCONTEXT (block
);
4440 /* Print the identifier ID to PRETTY-PRINTER. */
4443 pp_tree_identifier (pretty_printer
*pp
, tree id
)
4445 if (pp_translate_identifiers (pp
))
4447 const char *text
= identifier_to_locale (IDENTIFIER_POINTER (id
));
4448 pp_append_text (pp
, text
, text
+ strlen (text
));
4451 pp_append_text (pp
, IDENTIFIER_POINTER (id
),
4452 IDENTIFIER_POINTER (id
) + IDENTIFIER_LENGTH (id
));
4455 /* A helper function that is used to dump function information before the
4459 dump_function_header (FILE *dump_file
, tree fdecl
, dump_flags_t flags
)
4461 const char *dname
, *aname
;
4462 struct cgraph_node
*node
= cgraph_node::get (fdecl
);
4463 struct function
*fun
= DECL_STRUCT_FUNCTION (fdecl
);
4465 dname
= lang_hooks
.decl_printable_name (fdecl
, 1);
4467 if (DECL_ASSEMBLER_NAME_SET_P (fdecl
))
4468 aname
= (IDENTIFIER_POINTER
4469 (DECL_ASSEMBLER_NAME (fdecl
)));
4471 aname
= "<unset-asm-name>";
4473 fprintf (dump_file
, "\n;; Function %s (%s, funcdef_no=%d",
4474 dname
, aname
, fun
->funcdef_no
);
4475 if (!(flags
& TDF_NOUID
))
4476 fprintf (dump_file
, ", decl_uid=%d", DECL_UID (fdecl
));
4479 fprintf (dump_file
, ", cgraph_uid=%d", node
->get_uid ());
4480 fprintf (dump_file
, ", symbol_order=%d)%s\n\n", node
->order
,
4481 node
->frequency
== NODE_FREQUENCY_HOT
4483 : node
->frequency
== NODE_FREQUENCY_UNLIKELY_EXECUTED
4484 ? " (unlikely executed)"
4485 : node
->frequency
== NODE_FREQUENCY_EXECUTED_ONCE
4486 ? " (executed once)"
4490 fprintf (dump_file
, ")\n\n");
4493 /* Dump double_int D to pretty_printer PP. UNS is true
4494 if D is unsigned and false otherwise. */
4496 pp_double_int (pretty_printer
*pp
, double_int d
, bool uns
)
4499 pp_wide_integer (pp
, d
.low
);
4500 else if (d
.fits_uhwi ())
4501 pp_unsigned_wide_integer (pp
, d
.low
);
4504 unsigned HOST_WIDE_INT low
= d
.low
;
4505 HOST_WIDE_INT high
= d
.high
;
4506 if (!uns
&& d
.is_negative ())
4509 high
= ~high
+ !low
;
4512 /* Would "%x%0*x" or "%x%*0x" get zero-padding on all
4514 sprintf (pp_buffer (pp
)->digit_buffer
,
4515 HOST_WIDE_INT_PRINT_DOUBLE_HEX
,
4516 (unsigned HOST_WIDE_INT
) high
, low
);
4517 pp_string (pp
, pp_buffer (pp
)->digit_buffer
);
4522 # pragma GCC diagnostic pop