1 /* Pretty formatting of GENERIC trees in C syntax.
2 Copyright (C) 2001-2019 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 /* Disable warnings about quoting issues in the pp_xxx calls below
40 that (intentionally) don't follow GCC diagnostic conventions. */
42 # pragma GCC diagnostic push
43 # pragma GCC diagnostic ignored "-Wformat-diag"
46 /* Local functions, macros and variables. */
47 static const char *op_symbol (const_tree
);
48 static void pretty_print_string (pretty_printer
*, const char*, unsigned);
49 static void newline_and_indent (pretty_printer
*, int);
50 static void maybe_init_pretty_print (FILE *);
51 static void print_struct_decl (pretty_printer
*, const_tree
, int, dump_flags_t
);
52 static void do_niy (pretty_printer
*, const_tree
, dump_flags_t
);
54 #define INDENT(SPACE) do { \
55 int i; for (i = 0; i<SPACE; i++) pp_space (pp); } while (0)
57 #define NIY do_niy (pp, node, flags)
59 static pretty_printer
*tree_pp
;
61 /* Try to print something for an unknown tree code. */
64 do_niy (pretty_printer
*pp
, const_tree node
, dump_flags_t flags
)
68 pp_string (pp
, "<<< Unknown tree: ");
69 pp_string (pp
, get_tree_code_name (TREE_CODE (node
)));
73 len
= TREE_OPERAND_LENGTH (node
);
74 for (i
= 0; i
< len
; ++i
)
76 newline_and_indent (pp
, 2);
77 dump_generic_node (pp
, TREE_OPERAND (node
, i
), 2, flags
, false);
81 pp_string (pp
, " >>>");
84 /* Debugging function to print out a generic expression. */
87 debug_generic_expr (tree t
)
89 print_generic_expr (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
);
90 fprintf (stderr
, "\n");
93 /* Debugging function to print out a generic statement. */
96 debug_generic_stmt (tree t
)
98 print_generic_stmt (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
);
99 fprintf (stderr
, "\n");
102 /* Debugging function to print out a chain of trees . */
105 debug_tree_chain (tree t
)
111 print_generic_expr (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
|TDF_UID
);
112 fprintf (stderr
, " ");
116 fprintf (stderr
, "... [cycled back to ");
117 print_generic_expr (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
|TDF_UID
);
118 fprintf (stderr
, "]");
122 fprintf (stderr
, "\n");
125 /* Prints declaration DECL to the FILE with details specified by FLAGS. */
127 print_generic_decl (FILE *file
, tree decl
, dump_flags_t flags
)
129 maybe_init_pretty_print (file
);
130 print_declaration (tree_pp
, decl
, 2, flags
);
131 pp_write_text_to_stream (tree_pp
);
134 /* Print tree T, and its successors, on file FILE. FLAGS specifies details
135 to show in the dump. See TDF_* in dumpfile.h. */
138 print_generic_stmt (FILE *file
, tree t
, dump_flags_t flags
)
140 maybe_init_pretty_print (file
);
141 dump_generic_node (tree_pp
, t
, 0, flags
, true);
142 pp_newline_and_flush (tree_pp
);
145 /* Print tree T, and its successors, on file FILE. FLAGS specifies details
146 to show in the dump. See TDF_* in dumpfile.h. The output is indented by
150 print_generic_stmt_indented (FILE *file
, tree t
, dump_flags_t flags
, int indent
)
154 maybe_init_pretty_print (file
);
156 for (i
= 0; i
< indent
; i
++)
158 dump_generic_node (tree_pp
, t
, indent
, flags
, true);
159 pp_newline_and_flush (tree_pp
);
162 /* Print a single expression T on file FILE. FLAGS specifies details to show
163 in the dump. See TDF_* in dumpfile.h. */
166 print_generic_expr (FILE *file
, tree t
, dump_flags_t flags
)
168 maybe_init_pretty_print (file
);
169 dump_generic_node (tree_pp
, t
, 0, flags
, false);
173 /* Print a single expression T to string, and return it. */
176 print_generic_expr_to_str (tree t
)
179 dump_generic_node (&pp
, t
, 0, TDF_VOPS
|TDF_MEMSYMS
, false);
180 return xstrdup (pp_formatted_text (&pp
));
183 /* Dump NAME, an IDENTIFIER_POINTER, sanitized so that D<num> sequences
184 in it are replaced with Dxxxx, as long as they are at the start or
185 preceded by $ and at the end or followed by $. See make_fancy_name
189 dump_fancy_name (pretty_printer
*pp
, tree name
)
192 int length
= IDENTIFIER_LENGTH (name
);
193 const char *n
= IDENTIFIER_POINTER (name
);
200 && (n
== IDENTIFIER_POINTER (name
) || n
[-1] == '$'))
203 while (ISDIGIT (n
[l
]))
205 if (n
[l
] == '\0' || n
[l
] == '$')
218 pp_tree_identifier (pp
, name
);
222 char *str
= XNEWVEC (char, length
+ 1);
225 q
= n
= IDENTIFIER_POINTER (name
);
232 && (q
== IDENTIFIER_POINTER (name
) || q
[-1] == '$'))
235 while (ISDIGIT (q
[l
]))
237 if (q
[l
] == '\0' || q
[l
] == '$')
239 memcpy (p
, n
, q
- n
);
240 memcpy (p
+ (q
- n
), "Dxxxx", 5);
250 memcpy (p
, n
, IDENTIFIER_LENGTH (name
) - (n
- IDENTIFIER_POINTER (name
)));
252 if (pp_translate_identifiers (pp
))
254 const char *text
= identifier_to_locale (str
);
255 pp_append_text (pp
, text
, text
+ strlen (text
));
258 pp_append_text (pp
, str
, str
+ length
);
262 /* Dump the name of a _DECL node and its DECL_UID if TDF_UID is set
266 dump_decl_name (pretty_printer
*pp
, tree node
, dump_flags_t flags
)
268 tree name
= DECL_NAME (node
);
271 if ((flags
& TDF_ASMNAME
)
272 && HAS_DECL_ASSEMBLER_NAME_P (node
)
273 && DECL_ASSEMBLER_NAME_SET_P (node
))
274 pp_tree_identifier (pp
, DECL_ASSEMBLER_NAME_RAW (node
));
275 /* For -fcompare-debug don't dump DECL_NAMELESS names at all,
276 -g might have created more fancy names and their indexes
277 could get out of sync. Usually those should be DECL_IGNORED_P
278 too, SRA can create even non-DECL_IGNORED_P DECL_NAMELESS fancy
279 names, let's hope those never get out of sync after doing the
280 dump_fancy_name sanitization. */
281 else if ((flags
& TDF_COMPARE_DEBUG
)
282 && DECL_NAMELESS (node
)
283 && DECL_IGNORED_P (node
))
285 /* For DECL_NAMELESS names look for embedded uids in the
286 names and sanitize them for TDF_NOUID. */
287 else if ((flags
& TDF_NOUID
) && DECL_NAMELESS (node
))
288 dump_fancy_name (pp
, name
);
290 pp_tree_identifier (pp
, name
);
292 char uid_sep
= (flags
& TDF_GIMPLE
) ? '_' : '.';
293 if ((flags
& TDF_UID
) || name
== NULL_TREE
)
295 if (TREE_CODE (node
) == LABEL_DECL
&& LABEL_DECL_UID (node
) != -1)
296 pp_printf (pp
, "L%c%d", uid_sep
, (int) LABEL_DECL_UID (node
));
297 else if (TREE_CODE (node
) == DEBUG_EXPR_DECL
)
299 if (flags
& TDF_NOUID
)
300 pp_string (pp
, "D#xxxx");
302 pp_printf (pp
, "D#%i", DEBUG_TEMP_UID (node
));
306 char c
= TREE_CODE (node
) == CONST_DECL
? 'C' : 'D';
307 if (flags
& TDF_NOUID
)
308 pp_printf (pp
, "%c.xxxx", c
);
310 pp_printf (pp
, "%c%c%u", c
, uid_sep
, DECL_UID (node
));
313 if ((flags
& TDF_ALIAS
) && DECL_PT_UID (node
) != DECL_UID (node
))
315 if (flags
& TDF_NOUID
)
316 pp_printf (pp
, "ptD.xxxx");
318 pp_printf (pp
, "ptD.%u", DECL_PT_UID (node
));
322 /* Like the above, but used for pretty printing function calls. */
325 dump_function_name (pretty_printer
*pp
, tree node
, dump_flags_t flags
)
327 if (CONVERT_EXPR_P (node
))
328 node
= TREE_OPERAND (node
, 0);
329 if (DECL_NAME (node
) && (flags
& TDF_ASMNAME
) == 0)
330 pp_string (pp
, lang_hooks
.decl_printable_name (node
, 1));
332 dump_decl_name (pp
, node
, flags
);
335 /* Dump a function declaration. NODE is the FUNCTION_TYPE. PP, SPC and
336 FLAGS are as in dump_generic_node. */
339 dump_function_declaration (pretty_printer
*pp
, tree node
,
340 int spc
, dump_flags_t flags
)
342 bool wrote_arg
= false;
348 /* Print the argument types. */
349 arg
= TYPE_ARG_TYPES (node
);
350 while (arg
&& arg
!= void_list_node
&& arg
!= error_mark_node
)
358 dump_generic_node (pp
, TREE_VALUE (arg
), spc
, flags
, false);
359 arg
= TREE_CHAIN (arg
);
362 /* Drop the trailing void_type_node if we had any previous argument. */
363 if (arg
== void_list_node
&& !wrote_arg
)
364 pp_string (pp
, "void");
365 /* Properly dump vararg function types. */
366 else if (!arg
&& wrote_arg
)
367 pp_string (pp
, ", ...");
368 /* Avoid printing any arg for unprototyped functions. */
373 /* Dump the domain associated with an array. */
376 dump_array_domain (pretty_printer
*pp
, tree domain
, int spc
, dump_flags_t flags
)
378 pp_left_bracket (pp
);
381 tree min
= TYPE_MIN_VALUE (domain
);
382 tree max
= TYPE_MAX_VALUE (domain
);
385 && integer_zerop (min
)
386 && tree_fits_shwi_p (max
))
387 pp_wide_integer (pp
, tree_to_shwi (max
) + 1);
391 dump_generic_node (pp
, min
, spc
, flags
, false);
394 dump_generic_node (pp
, max
, spc
, flags
, false);
398 pp_string (pp
, "<unknown>");
399 pp_right_bracket (pp
);
403 /* Dump OpenMP iterators ITER. */
406 dump_omp_iterators (pretty_printer
*pp
, tree iter
, int spc
, dump_flags_t flags
)
408 pp_string (pp
, "iterator(");
409 for (tree it
= iter
; it
; it
= TREE_CHAIN (it
))
412 pp_string (pp
, ", ");
413 dump_generic_node (pp
, TREE_TYPE (TREE_VEC_ELT (it
, 0)), spc
, flags
,
416 dump_generic_node (pp
, TREE_VEC_ELT (it
, 0), spc
, flags
, false);
418 dump_generic_node (pp
, TREE_VEC_ELT (it
, 1), spc
, flags
, false);
420 dump_generic_node (pp
, TREE_VEC_ELT (it
, 2), spc
, flags
, false);
422 dump_generic_node (pp
, TREE_VEC_ELT (it
, 3), spc
, flags
, false);
428 /* Dump OpenMP clause CLAUSE. PP, CLAUSE, SPC and FLAGS are as in
429 dump_generic_node. */
432 dump_omp_clause (pretty_printer
*pp
, tree clause
, int spc
, dump_flags_t flags
)
436 switch (OMP_CLAUSE_CODE (clause
))
438 case OMP_CLAUSE_PRIVATE
:
441 case OMP_CLAUSE_SHARED
:
444 case OMP_CLAUSE_FIRSTPRIVATE
:
445 name
= "firstprivate";
447 case OMP_CLAUSE_LASTPRIVATE
:
448 name
= "lastprivate";
449 if (!OMP_CLAUSE_LASTPRIVATE_CONDITIONAL (clause
))
451 pp_string (pp
, "lastprivate(conditional:");
452 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
456 case OMP_CLAUSE_COPYIN
:
459 case OMP_CLAUSE_COPYPRIVATE
:
460 name
= "copyprivate";
462 case OMP_CLAUSE_UNIFORM
:
465 case OMP_CLAUSE_USE_DEVICE_PTR
:
466 name
= "use_device_ptr";
468 case OMP_CLAUSE_IS_DEVICE_PTR
:
469 name
= "is_device_ptr";
471 case OMP_CLAUSE_INCLUSIVE
:
474 case OMP_CLAUSE_EXCLUSIVE
:
477 case OMP_CLAUSE__LOOPTEMP_
:
480 case OMP_CLAUSE__REDUCTEMP_
:
481 name
= "_reductemp_";
483 case OMP_CLAUSE__CONDTEMP_
:
486 case OMP_CLAUSE__SCANTEMP_
:
489 case OMP_CLAUSE_TO_DECLARE
:
492 case OMP_CLAUSE_LINK
:
495 case OMP_CLAUSE_NONTEMPORAL
:
496 name
= "nontemporal";
499 pp_string (pp
, name
);
501 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
506 case OMP_CLAUSE_TASK_REDUCTION
:
507 case OMP_CLAUSE_IN_REDUCTION
:
508 pp_string (pp
, OMP_CLAUSE_CODE (clause
) == OMP_CLAUSE_IN_REDUCTION
511 case OMP_CLAUSE_REDUCTION
:
512 pp_string (pp
, "reduction(");
513 if (OMP_CLAUSE_CODE (clause
) == OMP_CLAUSE_REDUCTION
)
515 if (OMP_CLAUSE_REDUCTION_TASK (clause
))
516 pp_string (pp
, "task,");
517 else if (OMP_CLAUSE_REDUCTION_INSCAN (clause
))
518 pp_string (pp
, "inscan,");
520 if (OMP_CLAUSE_REDUCTION_CODE (clause
) != ERROR_MARK
)
523 op_symbol_code (OMP_CLAUSE_REDUCTION_CODE (clause
)));
526 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
532 pp_string (pp
, "if(");
533 switch (OMP_CLAUSE_IF_MODIFIER (clause
))
535 case ERROR_MARK
: break;
536 case VOID_CST
: pp_string (pp
, "cancel:"); break;
537 case OMP_PARALLEL
: pp_string (pp
, "parallel:"); break;
538 case OMP_SIMD
: pp_string (pp
, "simd:"); break;
539 case OMP_TASK
: pp_string (pp
, "task:"); break;
540 case OMP_TASKLOOP
: pp_string (pp
, "taskloop:"); break;
541 case OMP_TARGET_DATA
: pp_string (pp
, "target data:"); break;
542 case OMP_TARGET
: pp_string (pp
, "target:"); break;
543 case OMP_TARGET_UPDATE
: pp_string (pp
, "target update:"); break;
544 case OMP_TARGET_ENTER_DATA
:
545 pp_string (pp
, "target enter data:"); break;
546 case OMP_TARGET_EXIT_DATA
: pp_string (pp
, "target exit data:"); break;
547 default: gcc_unreachable ();
549 dump_generic_node (pp
, OMP_CLAUSE_IF_EXPR (clause
),
554 case OMP_CLAUSE_NUM_THREADS
:
555 pp_string (pp
, "num_threads(");
556 dump_generic_node (pp
, OMP_CLAUSE_NUM_THREADS_EXPR (clause
),
561 case OMP_CLAUSE_NOWAIT
:
562 pp_string (pp
, "nowait");
564 case OMP_CLAUSE_ORDERED
:
565 pp_string (pp
, "ordered");
566 if (OMP_CLAUSE_ORDERED_EXPR (clause
))
569 dump_generic_node (pp
, OMP_CLAUSE_ORDERED_EXPR (clause
),
575 case OMP_CLAUSE_DEFAULT
:
576 pp_string (pp
, "default(");
577 switch (OMP_CLAUSE_DEFAULT_KIND (clause
))
579 case OMP_CLAUSE_DEFAULT_UNSPECIFIED
:
581 case OMP_CLAUSE_DEFAULT_SHARED
:
582 pp_string (pp
, "shared");
584 case OMP_CLAUSE_DEFAULT_NONE
:
585 pp_string (pp
, "none");
587 case OMP_CLAUSE_DEFAULT_PRIVATE
:
588 pp_string (pp
, "private");
590 case OMP_CLAUSE_DEFAULT_FIRSTPRIVATE
:
591 pp_string (pp
, "firstprivate");
593 case OMP_CLAUSE_DEFAULT_PRESENT
:
594 pp_string (pp
, "present");
602 case OMP_CLAUSE_SCHEDULE
:
603 pp_string (pp
, "schedule(");
604 if (OMP_CLAUSE_SCHEDULE_KIND (clause
)
605 & (OMP_CLAUSE_SCHEDULE_MONOTONIC
606 | OMP_CLAUSE_SCHEDULE_NONMONOTONIC
))
608 if (OMP_CLAUSE_SCHEDULE_KIND (clause
)
609 & OMP_CLAUSE_SCHEDULE_MONOTONIC
)
610 pp_string (pp
, "monotonic");
612 pp_string (pp
, "nonmonotonic");
613 if (OMP_CLAUSE_SCHEDULE_SIMD (clause
))
618 if (OMP_CLAUSE_SCHEDULE_SIMD (clause
))
619 pp_string (pp
, "simd:");
621 switch (OMP_CLAUSE_SCHEDULE_KIND (clause
) & OMP_CLAUSE_SCHEDULE_MASK
)
623 case OMP_CLAUSE_SCHEDULE_STATIC
:
624 pp_string (pp
, "static");
626 case OMP_CLAUSE_SCHEDULE_DYNAMIC
:
627 pp_string (pp
, "dynamic");
629 case OMP_CLAUSE_SCHEDULE_GUIDED
:
630 pp_string (pp
, "guided");
632 case OMP_CLAUSE_SCHEDULE_RUNTIME
:
633 pp_string (pp
, "runtime");
635 case OMP_CLAUSE_SCHEDULE_AUTO
:
636 pp_string (pp
, "auto");
641 if (OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (clause
))
644 dump_generic_node (pp
, OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (clause
),
650 case OMP_CLAUSE_UNTIED
:
651 pp_string (pp
, "untied");
654 case OMP_CLAUSE_COLLAPSE
:
655 pp_string (pp
, "collapse(");
656 dump_generic_node (pp
, OMP_CLAUSE_COLLAPSE_EXPR (clause
),
661 case OMP_CLAUSE_FINAL
:
662 pp_string (pp
, "final(");
663 dump_generic_node (pp
, OMP_CLAUSE_FINAL_EXPR (clause
),
668 case OMP_CLAUSE_MERGEABLE
:
669 pp_string (pp
, "mergeable");
672 case OMP_CLAUSE_LINEAR
:
673 pp_string (pp
, "linear(");
674 switch (OMP_CLAUSE_LINEAR_KIND (clause
))
676 case OMP_CLAUSE_LINEAR_DEFAULT
:
678 case OMP_CLAUSE_LINEAR_REF
:
679 pp_string (pp
, "ref(");
681 case OMP_CLAUSE_LINEAR_VAL
:
682 pp_string (pp
, "val(");
684 case OMP_CLAUSE_LINEAR_UVAL
:
685 pp_string (pp
, "uval(");
690 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
692 if (OMP_CLAUSE_LINEAR_KIND (clause
) != OMP_CLAUSE_LINEAR_DEFAULT
)
695 dump_generic_node (pp
, OMP_CLAUSE_LINEAR_STEP (clause
),
700 case OMP_CLAUSE_ALIGNED
:
701 pp_string (pp
, "aligned(");
702 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
704 if (OMP_CLAUSE_ALIGNED_ALIGNMENT (clause
))
707 dump_generic_node (pp
, OMP_CLAUSE_ALIGNED_ALIGNMENT (clause
),
713 case OMP_CLAUSE_DEPEND
:
714 pp_string (pp
, "depend(");
715 switch (OMP_CLAUSE_DEPEND_KIND (clause
))
717 case OMP_CLAUSE_DEPEND_DEPOBJ
:
720 case OMP_CLAUSE_DEPEND_IN
:
723 case OMP_CLAUSE_DEPEND_OUT
:
726 case OMP_CLAUSE_DEPEND_INOUT
:
729 case OMP_CLAUSE_DEPEND_MUTEXINOUTSET
:
730 name
= "mutexinoutset";
732 case OMP_CLAUSE_DEPEND_SOURCE
:
733 pp_string (pp
, "source)");
735 case OMP_CLAUSE_DEPEND_LAST
:
736 name
= "__internal__";
738 case OMP_CLAUSE_DEPEND_SINK
:
739 pp_string (pp
, "sink:");
740 for (tree t
= OMP_CLAUSE_DECL (clause
); t
; t
= TREE_CHAIN (t
))
741 if (TREE_CODE (t
) == TREE_LIST
)
743 dump_generic_node (pp
, TREE_VALUE (t
), spc
, flags
, false);
744 if (TREE_PURPOSE (t
) != integer_zero_node
)
746 if (OMP_CLAUSE_DEPEND_SINK_NEGATIVE (t
))
750 dump_generic_node (pp
, TREE_PURPOSE (t
), spc
, flags
,
764 tree t
= OMP_CLAUSE_DECL (clause
);
765 if (TREE_CODE (t
) == TREE_LIST
767 && TREE_CODE (TREE_PURPOSE (t
)) == TREE_VEC
)
769 dump_omp_iterators (pp
, TREE_PURPOSE (t
), spc
, flags
);
773 pp_string (pp
, name
);
775 dump_generic_node (pp
, t
, spc
, flags
, false);
781 pp_string (pp
, "map(");
782 switch (OMP_CLAUSE_MAP_KIND (clause
))
785 case GOMP_MAP_POINTER
:
786 pp_string (pp
, "alloc");
789 case GOMP_MAP_TO_PSET
:
790 pp_string (pp
, "to");
793 pp_string (pp
, "from");
795 case GOMP_MAP_TOFROM
:
796 pp_string (pp
, "tofrom");
798 case GOMP_MAP_FORCE_ALLOC
:
799 pp_string (pp
, "force_alloc");
801 case GOMP_MAP_FORCE_TO
:
802 pp_string (pp
, "force_to");
804 case GOMP_MAP_FORCE_FROM
:
805 pp_string (pp
, "force_from");
807 case GOMP_MAP_FORCE_TOFROM
:
808 pp_string (pp
, "force_tofrom");
810 case GOMP_MAP_FORCE_PRESENT
:
811 pp_string (pp
, "force_present");
813 case GOMP_MAP_DELETE
:
814 pp_string (pp
, "delete");
816 case GOMP_MAP_FORCE_DEVICEPTR
:
817 pp_string (pp
, "force_deviceptr");
819 case GOMP_MAP_ALWAYS_TO
:
820 pp_string (pp
, "always,to");
822 case GOMP_MAP_ALWAYS_FROM
:
823 pp_string (pp
, "always,from");
825 case GOMP_MAP_ALWAYS_TOFROM
:
826 pp_string (pp
, "always,tofrom");
828 case GOMP_MAP_RELEASE
:
829 pp_string (pp
, "release");
831 case GOMP_MAP_FIRSTPRIVATE_POINTER
:
832 pp_string (pp
, "firstprivate");
834 case GOMP_MAP_FIRSTPRIVATE_REFERENCE
:
835 pp_string (pp
, "firstprivate ref");
837 case GOMP_MAP_STRUCT
:
838 pp_string (pp
, "struct");
840 case GOMP_MAP_ALWAYS_POINTER
:
841 pp_string (pp
, "always_pointer");
843 case GOMP_MAP_DEVICE_RESIDENT
:
844 pp_string (pp
, "device_resident");
847 pp_string (pp
, "link");
853 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
856 if (OMP_CLAUSE_SIZE (clause
))
858 switch (OMP_CLAUSE_CODE (clause
) == OMP_CLAUSE_MAP
859 ? OMP_CLAUSE_MAP_KIND (clause
) : GOMP_MAP_TO
)
861 case GOMP_MAP_POINTER
:
862 case GOMP_MAP_FIRSTPRIVATE_POINTER
:
863 case GOMP_MAP_FIRSTPRIVATE_REFERENCE
:
864 case GOMP_MAP_ALWAYS_POINTER
:
865 pp_string (pp
, " [pointer assign, bias: ");
867 case GOMP_MAP_TO_PSET
:
868 pp_string (pp
, " [pointer set, len: ");
871 pp_string (pp
, " [len: ");
874 dump_generic_node (pp
, OMP_CLAUSE_SIZE (clause
),
876 pp_right_bracket (pp
);
881 case OMP_CLAUSE_FROM
:
882 pp_string (pp
, "from(");
883 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
885 goto print_clause_size
;
888 pp_string (pp
, "to(");
889 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
891 goto print_clause_size
;
893 case OMP_CLAUSE__CACHE_
:
895 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
897 goto print_clause_size
;
899 case OMP_CLAUSE_NUM_TEAMS
:
900 pp_string (pp
, "num_teams(");
901 dump_generic_node (pp
, OMP_CLAUSE_NUM_TEAMS_EXPR (clause
),
906 case OMP_CLAUSE_THREAD_LIMIT
:
907 pp_string (pp
, "thread_limit(");
908 dump_generic_node (pp
, OMP_CLAUSE_THREAD_LIMIT_EXPR (clause
),
913 case OMP_CLAUSE_DEVICE
:
914 pp_string (pp
, "device(");
915 dump_generic_node (pp
, OMP_CLAUSE_DEVICE_ID (clause
),
920 case OMP_CLAUSE_DIST_SCHEDULE
:
921 pp_string (pp
, "dist_schedule(static");
922 if (OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR (clause
))
925 dump_generic_node (pp
,
926 OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR (clause
),
932 case OMP_CLAUSE_PROC_BIND
:
933 pp_string (pp
, "proc_bind(");
934 switch (OMP_CLAUSE_PROC_BIND_KIND (clause
))
936 case OMP_CLAUSE_PROC_BIND_MASTER
:
937 pp_string (pp
, "master");
939 case OMP_CLAUSE_PROC_BIND_CLOSE
:
940 pp_string (pp
, "close");
942 case OMP_CLAUSE_PROC_BIND_SPREAD
:
943 pp_string (pp
, "spread");
951 case OMP_CLAUSE_SAFELEN
:
952 pp_string (pp
, "safelen(");
953 dump_generic_node (pp
, OMP_CLAUSE_SAFELEN_EXPR (clause
),
958 case OMP_CLAUSE_SIMDLEN
:
959 pp_string (pp
, "simdlen(");
960 dump_generic_node (pp
, OMP_CLAUSE_SIMDLEN_EXPR (clause
),
965 case OMP_CLAUSE_PRIORITY
:
966 pp_string (pp
, "priority(");
967 dump_generic_node (pp
, OMP_CLAUSE_PRIORITY_EXPR (clause
),
972 case OMP_CLAUSE_GRAINSIZE
:
973 pp_string (pp
, "grainsize(");
974 dump_generic_node (pp
, OMP_CLAUSE_GRAINSIZE_EXPR (clause
),
979 case OMP_CLAUSE_NUM_TASKS
:
980 pp_string (pp
, "num_tasks(");
981 dump_generic_node (pp
, OMP_CLAUSE_NUM_TASKS_EXPR (clause
),
986 case OMP_CLAUSE_HINT
:
987 pp_string (pp
, "hint(");
988 dump_generic_node (pp
, OMP_CLAUSE_HINT_EXPR (clause
),
993 case OMP_CLAUSE_DEFAULTMAP
:
994 pp_string (pp
, "defaultmap(");
995 switch (OMP_CLAUSE_DEFAULTMAP_BEHAVIOR (clause
))
997 case OMP_CLAUSE_DEFAULTMAP_ALLOC
:
998 pp_string (pp
, "alloc");
1000 case OMP_CLAUSE_DEFAULTMAP_TO
:
1001 pp_string (pp
, "to");
1003 case OMP_CLAUSE_DEFAULTMAP_FROM
:
1004 pp_string (pp
, "from");
1006 case OMP_CLAUSE_DEFAULTMAP_TOFROM
:
1007 pp_string (pp
, "tofrom");
1009 case OMP_CLAUSE_DEFAULTMAP_FIRSTPRIVATE
:
1010 pp_string (pp
, "firstprivate");
1012 case OMP_CLAUSE_DEFAULTMAP_NONE
:
1013 pp_string (pp
, "none");
1015 case OMP_CLAUSE_DEFAULTMAP_DEFAULT
:
1016 pp_string (pp
, "default");
1021 switch (OMP_CLAUSE_DEFAULTMAP_CATEGORY (clause
))
1023 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_UNSPECIFIED
:
1025 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_SCALAR
:
1026 pp_string (pp
, ":scalar");
1028 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_AGGREGATE
:
1029 pp_string (pp
, ":aggregate");
1031 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_ALLOCATABLE
:
1032 pp_string (pp
, ":allocatable");
1034 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_POINTER
:
1035 pp_string (pp
, ":pointer");
1040 pp_right_paren (pp
);
1043 case OMP_CLAUSE__SIMDUID_
:
1044 pp_string (pp
, "_simduid_(");
1045 dump_generic_node (pp
, OMP_CLAUSE__SIMDUID__DECL (clause
),
1047 pp_right_paren (pp
);
1050 case OMP_CLAUSE__SIMT_
:
1051 pp_string (pp
, "_simt_");
1054 case OMP_CLAUSE_GANG
:
1055 pp_string (pp
, "gang");
1056 if (OMP_CLAUSE_GANG_EXPR (clause
) != NULL_TREE
)
1058 pp_string (pp
, "(num: ");
1059 dump_generic_node (pp
, OMP_CLAUSE_GANG_EXPR (clause
),
1062 if (OMP_CLAUSE_GANG_STATIC_EXPR (clause
) != NULL_TREE
)
1064 if (OMP_CLAUSE_GANG_EXPR (clause
) == NULL_TREE
)
1068 pp_string (pp
, "static:");
1069 if (OMP_CLAUSE_GANG_STATIC_EXPR (clause
)
1070 == integer_minus_one_node
)
1071 pp_character (pp
, '*');
1073 dump_generic_node (pp
, OMP_CLAUSE_GANG_STATIC_EXPR (clause
),
1076 if (OMP_CLAUSE_GANG_EXPR (clause
) != NULL_TREE
1077 || OMP_CLAUSE_GANG_STATIC_EXPR (clause
) != NULL_TREE
)
1078 pp_right_paren (pp
);
1081 case OMP_CLAUSE_ASYNC
:
1082 pp_string (pp
, "async");
1083 if (OMP_CLAUSE_ASYNC_EXPR (clause
))
1085 pp_character(pp
, '(');
1086 dump_generic_node (pp
, OMP_CLAUSE_ASYNC_EXPR (clause
),
1088 pp_character(pp
, ')');
1092 case OMP_CLAUSE_AUTO
:
1093 case OMP_CLAUSE_SEQ
:
1094 pp_string (pp
, omp_clause_code_name
[OMP_CLAUSE_CODE (clause
)]);
1097 case OMP_CLAUSE_WAIT
:
1098 pp_string (pp
, "wait(");
1099 dump_generic_node (pp
, OMP_CLAUSE_WAIT_EXPR (clause
),
1101 pp_character(pp
, ')');
1104 case OMP_CLAUSE_WORKER
:
1105 pp_string (pp
, "worker");
1106 if (OMP_CLAUSE_WORKER_EXPR (clause
) != NULL_TREE
)
1109 dump_generic_node (pp
, OMP_CLAUSE_WORKER_EXPR (clause
),
1111 pp_right_paren (pp
);
1115 case OMP_CLAUSE_VECTOR
:
1116 pp_string (pp
, "vector");
1117 if (OMP_CLAUSE_VECTOR_EXPR (clause
) != NULL_TREE
)
1120 dump_generic_node (pp
, OMP_CLAUSE_VECTOR_EXPR (clause
),
1122 pp_right_paren (pp
);
1126 case OMP_CLAUSE_NUM_GANGS
:
1127 pp_string (pp
, "num_gangs(");
1128 dump_generic_node (pp
, OMP_CLAUSE_NUM_GANGS_EXPR (clause
),
1130 pp_character (pp
, ')');
1133 case OMP_CLAUSE_NUM_WORKERS
:
1134 pp_string (pp
, "num_workers(");
1135 dump_generic_node (pp
, OMP_CLAUSE_NUM_WORKERS_EXPR (clause
),
1137 pp_character (pp
, ')');
1140 case OMP_CLAUSE_VECTOR_LENGTH
:
1141 pp_string (pp
, "vector_length(");
1142 dump_generic_node (pp
, OMP_CLAUSE_VECTOR_LENGTH_EXPR (clause
),
1144 pp_character (pp
, ')');
1147 case OMP_CLAUSE_INBRANCH
:
1148 pp_string (pp
, "inbranch");
1150 case OMP_CLAUSE_NOTINBRANCH
:
1151 pp_string (pp
, "notinbranch");
1153 case OMP_CLAUSE_FOR
:
1154 pp_string (pp
, "for");
1156 case OMP_CLAUSE_PARALLEL
:
1157 pp_string (pp
, "parallel");
1159 case OMP_CLAUSE_SECTIONS
:
1160 pp_string (pp
, "sections");
1162 case OMP_CLAUSE_TASKGROUP
:
1163 pp_string (pp
, "taskgroup");
1165 case OMP_CLAUSE_NOGROUP
:
1166 pp_string (pp
, "nogroup");
1168 case OMP_CLAUSE_THREADS
:
1169 pp_string (pp
, "threads");
1171 case OMP_CLAUSE_SIMD
:
1172 pp_string (pp
, "simd");
1174 case OMP_CLAUSE_INDEPENDENT
:
1175 pp_string (pp
, "independent");
1177 case OMP_CLAUSE_TILE
:
1178 pp_string (pp
, "tile(");
1179 dump_generic_node (pp
, OMP_CLAUSE_TILE_LIST (clause
),
1181 pp_right_paren (pp
);
1184 case OMP_CLAUSE__GRIDDIM_
:
1185 pp_string (pp
, "_griddim_(");
1186 pp_unsigned_wide_integer (pp
, OMP_CLAUSE__GRIDDIM__DIMENSION (clause
));
1188 dump_generic_node (pp
, OMP_CLAUSE__GRIDDIM__SIZE (clause
), spc
, flags
,
1191 dump_generic_node (pp
, OMP_CLAUSE__GRIDDIM__GROUP (clause
), spc
, flags
,
1193 pp_right_paren (pp
);
1195 case OMP_CLAUSE_IF_PRESENT
:
1196 pp_string (pp
, "if_present");
1198 case OMP_CLAUSE_FINALIZE
:
1199 pp_string (pp
, "finalize");
1208 /* Dump the list of OpenMP clauses. PP, SPC and FLAGS are as in
1209 dump_generic_node. */
1212 dump_omp_clauses (pretty_printer
*pp
, tree clause
, int spc
, dump_flags_t flags
)
1220 dump_omp_clause (pp
, clause
, spc
, flags
);
1221 clause
= OMP_CLAUSE_CHAIN (clause
);
1229 /* Dump location LOC to PP. */
1232 dump_location (pretty_printer
*pp
, location_t loc
)
1234 expanded_location xloc
= expand_location (loc
);
1236 pp_left_bracket (pp
);
1239 pp_string (pp
, xloc
.file
);
1240 pp_string (pp
, ":");
1242 pp_decimal_int (pp
, xloc
.line
);
1244 pp_decimal_int (pp
, xloc
.column
);
1245 pp_string (pp
, "] ");
1249 /* Dump lexical block BLOCK. PP, SPC and FLAGS are as in
1250 dump_generic_node. */
1253 dump_block_node (pretty_printer
*pp
, tree block
, int spc
, dump_flags_t flags
)
1257 pp_printf (pp
, "BLOCK #%d ", BLOCK_NUMBER (block
));
1259 if (flags
& TDF_ADDRESS
)
1260 pp_printf (pp
, "[%p] ", (void *) block
);
1262 if (TREE_ASM_WRITTEN (block
))
1263 pp_string (pp
, "[written] ");
1265 if (flags
& TDF_SLIM
)
1268 if (BLOCK_SOURCE_LOCATION (block
))
1269 dump_location (pp
, BLOCK_SOURCE_LOCATION (block
));
1271 newline_and_indent (pp
, spc
+ 2);
1273 if (BLOCK_SUPERCONTEXT (block
))
1275 pp_string (pp
, "SUPERCONTEXT: ");
1276 dump_generic_node (pp
, BLOCK_SUPERCONTEXT (block
), 0,
1277 flags
| TDF_SLIM
, false);
1278 newline_and_indent (pp
, spc
+ 2);
1281 if (BLOCK_SUBBLOCKS (block
))
1283 pp_string (pp
, "SUBBLOCKS: ");
1284 for (t
= BLOCK_SUBBLOCKS (block
); t
; t
= BLOCK_CHAIN (t
))
1286 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
1289 newline_and_indent (pp
, spc
+ 2);
1292 if (BLOCK_CHAIN (block
))
1294 pp_string (pp
, "SIBLINGS: ");
1295 for (t
= BLOCK_CHAIN (block
); t
; t
= BLOCK_CHAIN (t
))
1297 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
1300 newline_and_indent (pp
, spc
+ 2);
1303 if (BLOCK_VARS (block
))
1305 pp_string (pp
, "VARS: ");
1306 for (t
= BLOCK_VARS (block
); t
; t
= TREE_CHAIN (t
))
1308 dump_generic_node (pp
, t
, 0, flags
, false);
1311 newline_and_indent (pp
, spc
+ 2);
1314 if (vec_safe_length (BLOCK_NONLOCALIZED_VARS (block
)) > 0)
1317 vec
<tree
, va_gc
> *nlv
= BLOCK_NONLOCALIZED_VARS (block
);
1319 pp_string (pp
, "NONLOCALIZED_VARS: ");
1320 FOR_EACH_VEC_ELT (*nlv
, i
, t
)
1322 dump_generic_node (pp
, t
, 0, flags
, false);
1325 newline_and_indent (pp
, spc
+ 2);
1328 if (BLOCK_ABSTRACT_ORIGIN (block
))
1330 pp_string (pp
, "ABSTRACT_ORIGIN: ");
1331 dump_generic_node (pp
, BLOCK_ABSTRACT_ORIGIN (block
), 0,
1332 flags
| TDF_SLIM
, false);
1333 newline_and_indent (pp
, spc
+ 2);
1336 if (BLOCK_FRAGMENT_ORIGIN (block
))
1338 pp_string (pp
, "FRAGMENT_ORIGIN: ");
1339 dump_generic_node (pp
, BLOCK_FRAGMENT_ORIGIN (block
), 0,
1340 flags
| TDF_SLIM
, false);
1341 newline_and_indent (pp
, spc
+ 2);
1344 if (BLOCK_FRAGMENT_CHAIN (block
))
1346 pp_string (pp
, "FRAGMENT_CHAIN: ");
1347 for (t
= BLOCK_FRAGMENT_CHAIN (block
); t
; t
= BLOCK_FRAGMENT_CHAIN (t
))
1349 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
1352 newline_and_indent (pp
, spc
+ 2);
1356 /* Dump #pragma omp atomic memory order clause. */
1359 dump_omp_atomic_memory_order (pretty_printer
*pp
, enum omp_memory_order mo
)
1363 case OMP_MEMORY_ORDER_RELAXED
:
1364 pp_string (pp
, " relaxed");
1366 case OMP_MEMORY_ORDER_SEQ_CST
:
1367 pp_string (pp
, " seq_cst");
1369 case OMP_MEMORY_ORDER_ACQ_REL
:
1370 pp_string (pp
, " acq_rel");
1372 case OMP_MEMORY_ORDER_ACQUIRE
:
1373 pp_string (pp
, " acquire");
1375 case OMP_MEMORY_ORDER_RELEASE
:
1376 pp_string (pp
, " release");
1378 case OMP_MEMORY_ORDER_UNSPECIFIED
:
1385 /* Helper to dump a MEM_REF node. */
1388 dump_mem_ref (pretty_printer
*pp
, tree node
, int spc
, dump_flags_t flags
)
1390 if (flags
& TDF_GIMPLE
)
1392 pp_string (pp
, "__MEM <");
1393 dump_generic_node (pp
, TREE_TYPE (node
),
1394 spc
, flags
| TDF_SLIM
, false);
1395 if (TYPE_ALIGN (TREE_TYPE (node
))
1396 != TYPE_ALIGN (TYPE_MAIN_VARIANT (TREE_TYPE (node
))))
1398 pp_string (pp
, ", ");
1399 pp_decimal_int (pp
, TYPE_ALIGN (TREE_TYPE (node
)));
1402 pp_string (pp
, " (");
1403 if (TREE_TYPE (TREE_OPERAND (node
, 0))
1404 != TREE_TYPE (TREE_OPERAND (node
, 1)))
1407 dump_generic_node (pp
, TREE_TYPE (TREE_OPERAND (node
, 1)),
1408 spc
, flags
| TDF_SLIM
, false);
1409 pp_right_paren (pp
);
1411 dump_generic_node (pp
, TREE_OPERAND (node
, 0),
1412 spc
, flags
| TDF_SLIM
, false);
1413 if (! integer_zerop (TREE_OPERAND (node
, 1)))
1415 pp_string (pp
, " + ");
1416 dump_generic_node (pp
, TREE_OPERAND (node
, 1),
1417 spc
, flags
| TDF_SLIM
, false);
1419 pp_right_paren (pp
);
1421 else if (integer_zerop (TREE_OPERAND (node
, 1))
1422 /* Dump the types of INTEGER_CSTs explicitly, for we can't
1423 infer them and MEM_ATTR caching will share MEM_REFs
1424 with differently-typed op0s. */
1425 && TREE_CODE (TREE_OPERAND (node
, 0)) != INTEGER_CST
1426 /* Released SSA_NAMES have no TREE_TYPE. */
1427 && TREE_TYPE (TREE_OPERAND (node
, 0)) != NULL_TREE
1428 /* Same pointer types, but ignoring POINTER_TYPE vs.
1430 && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 0)))
1431 == TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 1))))
1432 && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (node
, 0)))
1433 == TYPE_MODE (TREE_TYPE (TREE_OPERAND (node
, 1))))
1434 && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node
, 0)))
1435 == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node
, 1))))
1436 /* Same value types ignoring qualifiers. */
1437 && (TYPE_MAIN_VARIANT (TREE_TYPE (node
))
1438 == TYPE_MAIN_VARIANT
1439 (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 1)))))
1440 && (!(flags
& TDF_ALIAS
)
1441 || MR_DEPENDENCE_CLIQUE (node
) == 0))
1443 if (TREE_CODE (TREE_OPERAND (node
, 0)) != ADDR_EXPR
)
1445 /* Enclose pointers to arrays in parentheses. */
1446 tree op0
= TREE_OPERAND (node
, 0);
1447 tree op0type
= TREE_TYPE (op0
);
1448 if (POINTER_TYPE_P (op0type
)
1449 && TREE_CODE (TREE_TYPE (op0type
)) == ARRAY_TYPE
)
1452 dump_generic_node (pp
, op0
, spc
, flags
, false);
1453 if (POINTER_TYPE_P (op0type
)
1454 && TREE_CODE (TREE_TYPE (op0type
)) == ARRAY_TYPE
)
1455 pp_right_paren (pp
);
1458 dump_generic_node (pp
,
1459 TREE_OPERAND (TREE_OPERAND (node
, 0), 0),
1464 pp_string (pp
, "MEM");
1466 tree nodetype
= TREE_TYPE (node
);
1467 tree op0
= TREE_OPERAND (node
, 0);
1468 tree op1
= TREE_OPERAND (node
, 1);
1469 tree op1type
= TYPE_MAIN_VARIANT (TREE_TYPE (op1
));
1471 tree op0size
= TYPE_SIZE (nodetype
);
1472 tree op1size
= TYPE_SIZE (TREE_TYPE (op1type
));
1474 if (!op0size
|| !op1size
1475 || !operand_equal_p (op0size
, op1size
, 0))
1477 pp_string (pp
, " <");
1478 /* If the size of the type of the operand is not the same
1479 as the size of the MEM_REF expression include the type
1480 of the latter similar to the TDF_GIMPLE output to make
1481 it clear how many bytes of memory are being accessed. */
1482 dump_generic_node (pp
, nodetype
, spc
, flags
| TDF_SLIM
, false);
1483 pp_string (pp
, "> ");
1486 pp_string (pp
, "[(");
1487 dump_generic_node (pp
, op1type
, spc
, flags
| TDF_SLIM
, false);
1488 pp_right_paren (pp
);
1489 dump_generic_node (pp
, op0
, spc
, flags
, false);
1490 if (!integer_zerop (op1
))
1491 if (!integer_zerop (TREE_OPERAND (node
, 1)))
1493 pp_string (pp
, " + ");
1494 dump_generic_node (pp
, op1
, spc
, flags
, false);
1496 if ((flags
& TDF_ALIAS
)
1497 && MR_DEPENDENCE_CLIQUE (node
) != 0)
1499 pp_string (pp
, " clique ");
1500 pp_unsigned_wide_integer (pp
, MR_DEPENDENCE_CLIQUE (node
));
1501 pp_string (pp
, " base ");
1502 pp_unsigned_wide_integer (pp
, MR_DEPENDENCE_BASE (node
));
1504 pp_right_bracket (pp
);
1508 /* Dump the node NODE on the pretty_printer PP, SPC spaces of
1509 indent. FLAGS specifies details to show in the dump (see TDF_* in
1510 dumpfile.h). If IS_STMT is true, the object printed is considered
1511 to be a statement and it is terminated by ';' if appropriate. */
1514 dump_generic_node (pretty_printer
*pp
, tree node
, int spc
, dump_flags_t flags
,
1521 enum tree_code code
;
1523 if (node
== NULL_TREE
)
1526 is_expr
= EXPR_P (node
);
1528 if (is_stmt
&& (flags
& TDF_STMTADDR
))
1529 pp_printf (pp
, "<&%p> ", (void *)node
);
1531 if ((flags
& TDF_LINENO
) && EXPR_HAS_LOCATION (node
))
1532 dump_location (pp
, EXPR_LOCATION (node
));
1534 code
= TREE_CODE (node
);
1538 pp_string (pp
, "<<< error >>>");
1541 case IDENTIFIER_NODE
:
1542 pp_tree_identifier (pp
, node
);
1546 while (node
&& node
!= error_mark_node
)
1548 if (TREE_PURPOSE (node
))
1550 dump_generic_node (pp
, TREE_PURPOSE (node
), spc
, flags
, false);
1553 dump_generic_node (pp
, TREE_VALUE (node
), spc
, flags
, false);
1554 node
= TREE_CHAIN (node
);
1555 if (node
&& TREE_CODE (node
) == TREE_LIST
)
1564 dump_generic_node (pp
, BINFO_TYPE (node
), spc
, flags
, false);
1570 if (TREE_VEC_LENGTH (node
) > 0)
1572 size_t len
= TREE_VEC_LENGTH (node
);
1573 for (i
= 0; i
< len
- 1; i
++)
1575 dump_generic_node (pp
, TREE_VEC_ELT (node
, i
), spc
, flags
,
1580 dump_generic_node (pp
, TREE_VEC_ELT (node
, len
- 1), spc
,
1589 case FIXED_POINT_TYPE
:
1595 unsigned int quals
= TYPE_QUALS (node
);
1596 enum tree_code_class tclass
;
1598 if (quals
& TYPE_QUAL_ATOMIC
)
1599 pp_string (pp
, "atomic ");
1600 if (quals
& TYPE_QUAL_CONST
)
1601 pp_string (pp
, "const ");
1602 else if (quals
& TYPE_QUAL_VOLATILE
)
1603 pp_string (pp
, "volatile ");
1604 else if (quals
& TYPE_QUAL_RESTRICT
)
1605 pp_string (pp
, "restrict ");
1607 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
1609 pp_string (pp
, "<address-space-");
1610 pp_decimal_int (pp
, TYPE_ADDR_SPACE (node
));
1611 pp_string (pp
, "> ");
1614 tclass
= TREE_CODE_CLASS (TREE_CODE (node
));
1616 if (tclass
== tcc_declaration
)
1618 if (DECL_NAME (node
))
1619 dump_decl_name (pp
, node
, flags
);
1621 pp_string (pp
, "<unnamed type decl>");
1623 else if (tclass
== tcc_type
)
1625 if (TYPE_NAME (node
))
1627 if (TREE_CODE (TYPE_NAME (node
)) == IDENTIFIER_NODE
)
1628 pp_tree_identifier (pp
, TYPE_NAME (node
));
1629 else if (TREE_CODE (TYPE_NAME (node
)) == TYPE_DECL
1630 && DECL_NAME (TYPE_NAME (node
)))
1631 dump_decl_name (pp
, TYPE_NAME (node
), flags
);
1633 pp_string (pp
, "<unnamed type>");
1635 else if (TREE_CODE (node
) == VECTOR_TYPE
)
1637 pp_string (pp
, "vector");
1639 pp_wide_integer (pp
, TYPE_VECTOR_SUBPARTS (node
));
1640 pp_string (pp
, ") ");
1641 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1643 else if (TREE_CODE (node
) == INTEGER_TYPE
)
1645 if (TYPE_PRECISION (node
) == CHAR_TYPE_SIZE
)
1646 pp_string (pp
, (TYPE_UNSIGNED (node
)
1649 else if (TYPE_PRECISION (node
) == SHORT_TYPE_SIZE
)
1650 pp_string (pp
, (TYPE_UNSIGNED (node
)
1653 else if (TYPE_PRECISION (node
) == INT_TYPE_SIZE
)
1654 pp_string (pp
, (TYPE_UNSIGNED (node
)
1657 else if (TYPE_PRECISION (node
) == LONG_TYPE_SIZE
)
1658 pp_string (pp
, (TYPE_UNSIGNED (node
)
1661 else if (TYPE_PRECISION (node
) == LONG_LONG_TYPE_SIZE
)
1662 pp_string (pp
, (TYPE_UNSIGNED (node
)
1663 ? "unsigned long long"
1664 : "signed long long"));
1665 else if (TYPE_PRECISION (node
) >= CHAR_TYPE_SIZE
1666 && pow2p_hwi (TYPE_PRECISION (node
)))
1668 pp_string (pp
, (TYPE_UNSIGNED (node
) ? "uint" : "int"));
1669 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1670 pp_string (pp
, "_t");
1674 pp_string (pp
, (TYPE_UNSIGNED (node
)
1675 ? "<unnamed-unsigned:"
1676 : "<unnamed-signed:"));
1677 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1681 else if (TREE_CODE (node
) == COMPLEX_TYPE
)
1683 pp_string (pp
, "__complex__ ");
1684 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1686 else if (TREE_CODE (node
) == REAL_TYPE
)
1688 pp_string (pp
, "<float:");
1689 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1692 else if (TREE_CODE (node
) == FIXED_POINT_TYPE
)
1694 pp_string (pp
, "<fixed-point-");
1695 pp_string (pp
, TYPE_SATURATING (node
) ? "sat:" : "nonsat:");
1696 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1699 else if (TREE_CODE (node
) == VOID_TYPE
)
1700 pp_string (pp
, "void");
1702 pp_string (pp
, "<unnamed type>");
1708 case REFERENCE_TYPE
:
1709 str
= (TREE_CODE (node
) == POINTER_TYPE
? "*" : "&");
1711 if (TREE_TYPE (node
) == NULL
)
1713 pp_string (pp
, str
);
1714 pp_string (pp
, "<null type>");
1716 else if (TREE_CODE (TREE_TYPE (node
)) == FUNCTION_TYPE
)
1718 tree fnode
= TREE_TYPE (node
);
1720 dump_generic_node (pp
, TREE_TYPE (fnode
), spc
, flags
, false);
1723 pp_string (pp
, str
);
1724 if (TYPE_IDENTIFIER (node
))
1725 dump_generic_node (pp
, TYPE_NAME (node
), spc
, flags
, false);
1726 else if (flags
& TDF_NOUID
)
1727 pp_printf (pp
, "<Txxxx>");
1729 pp_printf (pp
, "<T%x>", TYPE_UID (node
));
1731 pp_right_paren (pp
);
1732 dump_function_declaration (pp
, fnode
, spc
, flags
);
1736 unsigned int quals
= TYPE_QUALS (node
);
1738 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1740 pp_string (pp
, str
);
1742 if (quals
& TYPE_QUAL_CONST
)
1743 pp_string (pp
, " const");
1744 if (quals
& TYPE_QUAL_VOLATILE
)
1745 pp_string (pp
, " volatile");
1746 if (quals
& TYPE_QUAL_RESTRICT
)
1747 pp_string (pp
, " restrict");
1749 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
1751 pp_string (pp
, " <address-space-");
1752 pp_decimal_int (pp
, TYPE_ADDR_SPACE (node
));
1756 if (TYPE_REF_CAN_ALIAS_ALL (node
))
1757 pp_string (pp
, " {ref-all}");
1766 dump_mem_ref (pp
, node
, spc
, flags
);
1769 case TARGET_MEM_REF
:
1771 const char *sep
= "";
1774 pp_string (pp
, "MEM[");
1776 if (TREE_CODE (TMR_BASE (node
)) == ADDR_EXPR
)
1778 pp_string (pp
, sep
);
1780 pp_string (pp
, "symbol: ");
1781 dump_generic_node (pp
, TREE_OPERAND (TMR_BASE (node
), 0),
1786 pp_string (pp
, sep
);
1788 pp_string (pp
, "base: ");
1789 dump_generic_node (pp
, TMR_BASE (node
), spc
, flags
, false);
1791 tmp
= TMR_INDEX2 (node
);
1794 pp_string (pp
, sep
);
1796 pp_string (pp
, "base: ");
1797 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1799 tmp
= TMR_INDEX (node
);
1802 pp_string (pp
, sep
);
1804 pp_string (pp
, "index: ");
1805 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1807 tmp
= TMR_STEP (node
);
1810 pp_string (pp
, sep
);
1812 pp_string (pp
, "step: ");
1813 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1815 tmp
= TMR_OFFSET (node
);
1818 pp_string (pp
, sep
);
1820 pp_string (pp
, "offset: ");
1821 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1823 pp_right_bracket (pp
);
1831 /* Print the innermost component type. */
1832 for (tmp
= TREE_TYPE (node
); TREE_CODE (tmp
) == ARRAY_TYPE
;
1833 tmp
= TREE_TYPE (tmp
))
1835 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1837 /* Print the dimensions. */
1838 for (tmp
= node
; TREE_CODE (tmp
) == ARRAY_TYPE
; tmp
= TREE_TYPE (tmp
))
1839 dump_array_domain (pp
, TYPE_DOMAIN (tmp
), spc
, flags
);
1845 case QUAL_UNION_TYPE
:
1847 unsigned int quals
= TYPE_QUALS (node
);
1849 if (quals
& TYPE_QUAL_ATOMIC
)
1850 pp_string (pp
, "atomic ");
1851 if (quals
& TYPE_QUAL_CONST
)
1852 pp_string (pp
, "const ");
1853 if (quals
& TYPE_QUAL_VOLATILE
)
1854 pp_string (pp
, "volatile ");
1856 /* Print the name of the structure. */
1857 if (TREE_CODE (node
) == RECORD_TYPE
)
1858 pp_string (pp
, "struct ");
1859 else if (TREE_CODE (node
) == UNION_TYPE
)
1860 pp_string (pp
, "union ");
1862 if (TYPE_NAME (node
))
1863 dump_generic_node (pp
, TYPE_NAME (node
), spc
, flags
, false);
1864 else if (!(flags
& TDF_SLIM
))
1865 /* FIXME: If we eliminate the 'else' above and attempt
1866 to show the fields for named types, we may get stuck
1867 following a cycle of pointers to structs. The alleged
1868 self-reference check in print_struct_decl will not detect
1869 cycles involving more than one pointer or struct type. */
1870 print_struct_decl (pp
, node
, spc
, flags
);
1879 if (flags
& TDF_GIMPLE
1880 && (POINTER_TYPE_P (TREE_TYPE (node
))
1881 || (TYPE_PRECISION (TREE_TYPE (node
))
1882 < TYPE_PRECISION (integer_type_node
))
1883 || exact_log2 (TYPE_PRECISION (TREE_TYPE (node
))) == -1
1884 || tree_int_cst_sgn (node
) < 0))
1886 pp_string (pp
, "_Literal (");
1887 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1888 pp_string (pp
, ") ");
1890 if (TREE_CODE (TREE_TYPE (node
)) == POINTER_TYPE
1891 && ! (flags
& TDF_GIMPLE
))
1893 /* In the case of a pointer, one may want to divide by the
1894 size of the pointed-to type. Unfortunately, this not
1895 straightforward. The C front-end maps expressions
1900 in such a way that the two INTEGER_CST nodes for "5" have
1901 different values but identical types. In the latter
1902 case, the 5 is multiplied by sizeof (int) in c-common.c
1903 (pointer_int_sum) to convert it to a byte address, and
1904 yet the type of the node is left unchanged. Argh. What
1905 is consistent though is that the number value corresponds
1906 to bytes (UNITS) offset.
1908 NB: Neither of the following divisors can be trivially
1909 used to recover the original literal:
1911 TREE_INT_CST_LOW (TYPE_SIZE_UNIT (TREE_TYPE (node)))
1912 TYPE_PRECISION (TREE_TYPE (TREE_TYPE (node))) */
1913 pp_wide_integer (pp
, TREE_INT_CST_LOW (node
));
1914 pp_string (pp
, "B"); /* pseudo-unit */
1916 else if (tree_fits_shwi_p (node
))
1917 pp_wide_integer (pp
, tree_to_shwi (node
));
1918 else if (tree_fits_uhwi_p (node
))
1919 pp_unsigned_wide_integer (pp
, tree_to_uhwi (node
));
1922 wide_int val
= wi::to_wide (node
);
1924 if (wi::neg_p (val
, TYPE_SIGN (TREE_TYPE (node
))))
1929 print_hex (val
, pp_buffer (pp
)->digit_buffer
);
1930 pp_string (pp
, pp_buffer (pp
)->digit_buffer
);
1932 if ((flags
& TDF_GIMPLE
)
1933 && ! (POINTER_TYPE_P (TREE_TYPE (node
))
1934 || (TYPE_PRECISION (TREE_TYPE (node
))
1935 < TYPE_PRECISION (integer_type_node
))
1936 || exact_log2 (TYPE_PRECISION (TREE_TYPE (node
))) == -1))
1938 if (TYPE_UNSIGNED (TREE_TYPE (node
)))
1939 pp_character (pp
, 'u');
1940 if (TYPE_PRECISION (TREE_TYPE (node
))
1941 == TYPE_PRECISION (unsigned_type_node
))
1943 else if (TYPE_PRECISION (TREE_TYPE (node
))
1944 == TYPE_PRECISION (long_unsigned_type_node
))
1945 pp_character (pp
, 'l');
1946 else if (TYPE_PRECISION (TREE_TYPE (node
))
1947 == TYPE_PRECISION (long_long_unsigned_type_node
))
1948 pp_string (pp
, "ll");
1950 if (TREE_OVERFLOW (node
))
1951 pp_string (pp
, "(OVF)");
1955 pp_string (pp
, "POLY_INT_CST [");
1956 dump_generic_node (pp
, POLY_INT_CST_COEFF (node
, 0), spc
, flags
, false);
1957 for (unsigned int i
= 1; i
< NUM_POLY_INT_COEFFS
; ++i
)
1959 pp_string (pp
, ", ");
1960 dump_generic_node (pp
, POLY_INT_CST_COEFF (node
, i
),
1963 pp_string (pp
, "]");
1967 /* Code copied from print_node. */
1970 if (TREE_OVERFLOW (node
))
1971 pp_string (pp
, " overflow");
1973 d
= TREE_REAL_CST (node
);
1974 if (REAL_VALUE_ISINF (d
))
1975 pp_string (pp
, REAL_VALUE_NEGATIVE (d
) ? " -Inf" : " Inf");
1976 else if (REAL_VALUE_ISNAN (d
))
1977 pp_string (pp
, " Nan");
1981 real_to_decimal (string
, &d
, sizeof (string
), 0, 1);
1982 pp_string (pp
, string
);
1990 fixed_to_decimal (string
, TREE_FIXED_CST_PTR (node
), sizeof (string
));
1991 pp_string (pp
, string
);
1996 pp_string (pp
, "__complex__ (");
1997 dump_generic_node (pp
, TREE_REALPART (node
), spc
, flags
, false);
1998 pp_string (pp
, ", ");
1999 dump_generic_node (pp
, TREE_IMAGPART (node
), spc
, flags
, false);
2000 pp_right_paren (pp
);
2005 pp_string (pp
, "\"");
2006 if (unsigned nbytes
= TREE_STRING_LENGTH (node
))
2007 pretty_print_string (pp
, TREE_STRING_POINTER (node
), nbytes
);
2008 pp_string (pp
, "\"");
2015 pp_string (pp
, "{ ");
2016 unsigned HOST_WIDE_INT nunits
;
2017 if (!VECTOR_CST_NELTS (node
).is_constant (&nunits
))
2018 nunits
= vector_cst_encoded_nelts (node
);
2019 for (i
= 0; i
< nunits
; ++i
)
2022 pp_string (pp
, ", ");
2023 dump_generic_node (pp
, VECTOR_CST_ELT (node
, i
),
2026 if (!VECTOR_CST_NELTS (node
).is_constant ())
2027 pp_string (pp
, ", ...");
2028 pp_string (pp
, " }");
2034 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2036 if (TREE_CODE (node
) == METHOD_TYPE
)
2038 if (TYPE_METHOD_BASETYPE (node
))
2039 dump_generic_node (pp
, TYPE_NAME (TYPE_METHOD_BASETYPE (node
)),
2042 pp_string (pp
, "<null method basetype>");
2043 pp_colon_colon (pp
);
2045 if (TYPE_IDENTIFIER (node
))
2046 dump_generic_node (pp
, TYPE_NAME (node
), spc
, flags
, false);
2047 else if (TYPE_NAME (node
) && DECL_NAME (TYPE_NAME (node
)))
2048 dump_decl_name (pp
, TYPE_NAME (node
), flags
);
2049 else if (flags
& TDF_NOUID
)
2050 pp_printf (pp
, "<Txxxx>");
2052 pp_printf (pp
, "<T%x>", TYPE_UID (node
));
2053 dump_function_declaration (pp
, node
, spc
, flags
);
2058 dump_decl_name (pp
, node
, flags
);
2062 if (DECL_NAME (node
))
2063 dump_decl_name (pp
, node
, flags
);
2064 else if (LABEL_DECL_UID (node
) != -1)
2066 if (flags
& TDF_GIMPLE
)
2067 pp_printf (pp
, "L%d", (int) LABEL_DECL_UID (node
));
2069 pp_printf (pp
, "<L%d>", (int) LABEL_DECL_UID (node
));
2073 if (flags
& TDF_NOUID
)
2074 pp_string (pp
, "<D.xxxx>");
2077 if (flags
& TDF_GIMPLE
)
2078 pp_printf (pp
, "<D%u>", DECL_UID (node
));
2080 pp_printf (pp
, "<D.%u>", DECL_UID (node
));
2086 if (DECL_IS_BUILTIN (node
))
2088 /* Don't print the declaration of built-in types. */
2091 if (DECL_NAME (node
))
2092 dump_decl_name (pp
, node
, flags
);
2093 else if (TYPE_NAME (TREE_TYPE (node
)) != node
)
2095 pp_string (pp
, (TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
2096 ? "union" : "struct "));
2097 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2100 pp_string (pp
, "<anon>");
2106 case DEBUG_EXPR_DECL
:
2107 case NAMESPACE_DECL
:
2109 dump_decl_name (pp
, node
, flags
);
2113 pp_string (pp
, "<retval>");
2117 op0
= TREE_OPERAND (node
, 0);
2120 && (TREE_CODE (op0
) == INDIRECT_REF
2121 || (TREE_CODE (op0
) == MEM_REF
2122 && TREE_CODE (TREE_OPERAND (op0
, 0)) != ADDR_EXPR
2123 && integer_zerop (TREE_OPERAND (op0
, 1))
2124 /* Dump the types of INTEGER_CSTs explicitly, for we
2125 can't infer them and MEM_ATTR caching will share
2126 MEM_REFs with differently-typed op0s. */
2127 && TREE_CODE (TREE_OPERAND (op0
, 0)) != INTEGER_CST
2128 /* Released SSA_NAMES have no TREE_TYPE. */
2129 && TREE_TYPE (TREE_OPERAND (op0
, 0)) != NULL_TREE
2130 /* Same pointer types, but ignoring POINTER_TYPE vs.
2132 && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 0)))
2133 == TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 1))))
2134 && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0
, 0)))
2135 == TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0
, 1))))
2136 && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0
, 0)))
2137 == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0
, 1))))
2138 /* Same value types ignoring qualifiers. */
2139 && (TYPE_MAIN_VARIANT (TREE_TYPE (op0
))
2140 == TYPE_MAIN_VARIANT
2141 (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 1)))))
2142 && MR_DEPENDENCE_CLIQUE (op0
) == 0)))
2144 op0
= TREE_OPERAND (op0
, 0);
2147 if (op_prio (op0
) < op_prio (node
))
2149 dump_generic_node (pp
, op0
, spc
, flags
, false);
2150 if (op_prio (op0
) < op_prio (node
))
2151 pp_right_paren (pp
);
2152 pp_string (pp
, str
);
2153 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2154 op0
= component_ref_field_offset (node
);
2155 if (op0
&& TREE_CODE (op0
) != INTEGER_CST
)
2157 pp_string (pp
, "{off: ");
2158 dump_generic_node (pp
, op0
, spc
, flags
, false);
2159 pp_right_brace (pp
);
2164 if (flags
& TDF_GIMPLE
)
2166 pp_string (pp
, "__BIT_FIELD_REF <");
2167 dump_generic_node (pp
, TREE_TYPE (node
),
2168 spc
, flags
| TDF_SLIM
, false);
2169 if (TYPE_ALIGN (TREE_TYPE (node
))
2170 != TYPE_ALIGN (TYPE_MAIN_VARIANT (TREE_TYPE (node
))))
2172 pp_string (pp
, ", ");
2173 pp_decimal_int (pp
, TYPE_ALIGN (TREE_TYPE (node
)));
2176 pp_string (pp
, " (");
2177 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
,
2178 flags
| TDF_SLIM
, false);
2179 pp_string (pp
, ", ");
2180 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
,
2181 flags
| TDF_SLIM
, false);
2182 pp_string (pp
, ", ");
2183 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
,
2184 flags
| TDF_SLIM
, false);
2185 pp_right_paren (pp
);
2189 pp_string (pp
, "BIT_FIELD_REF <");
2190 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2191 pp_string (pp
, ", ");
2192 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2193 pp_string (pp
, ", ");
2194 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2199 case BIT_INSERT_EXPR
:
2200 pp_string (pp
, "BIT_INSERT_EXPR <");
2201 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2202 pp_string (pp
, ", ");
2203 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2204 pp_string (pp
, ", ");
2205 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2206 pp_string (pp
, " (");
2207 if (INTEGRAL_TYPE_P (TREE_TYPE (TREE_OPERAND (node
, 1))))
2209 TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (node
, 1))));
2211 dump_generic_node (pp
, TYPE_SIZE (TREE_TYPE (TREE_OPERAND (node
, 1))),
2213 pp_string (pp
, " bits)>");
2217 case ARRAY_RANGE_REF
:
2218 op0
= TREE_OPERAND (node
, 0);
2219 if (op_prio (op0
) < op_prio (node
))
2221 dump_generic_node (pp
, op0
, spc
, flags
, false);
2222 if (op_prio (op0
) < op_prio (node
))
2223 pp_right_paren (pp
);
2224 pp_left_bracket (pp
);
2225 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2226 if (TREE_CODE (node
) == ARRAY_RANGE_REF
)
2227 pp_string (pp
, " ...");
2228 pp_right_bracket (pp
);
2230 op0
= array_ref_low_bound (node
);
2231 op1
= array_ref_element_size (node
);
2233 if (!integer_zerop (op0
)
2234 || TREE_OPERAND (node
, 2)
2235 || TREE_OPERAND (node
, 3))
2237 pp_string (pp
, "{lb: ");
2238 dump_generic_node (pp
, op0
, spc
, flags
, false);
2239 pp_string (pp
, " sz: ");
2240 dump_generic_node (pp
, op1
, spc
, flags
, false);
2241 pp_right_brace (pp
);
2247 unsigned HOST_WIDE_INT ix
;
2249 bool is_struct_init
= false;
2250 bool is_array_init
= false;
2253 if (TREE_CLOBBER_P (node
))
2254 pp_string (pp
, "CLOBBER");
2255 else if (TREE_CODE (TREE_TYPE (node
)) == RECORD_TYPE
2256 || TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
)
2257 is_struct_init
= true;
2258 else if (TREE_CODE (TREE_TYPE (node
)) == ARRAY_TYPE
2259 && TYPE_DOMAIN (TREE_TYPE (node
))
2260 && TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
)))
2261 && TREE_CODE (TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
))))
2264 tree minv
= TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
)));
2265 is_array_init
= true;
2266 curidx
= wi::to_widest (minv
);
2268 FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (node
), ix
, field
, val
)
2275 dump_generic_node (pp
, field
, spc
, flags
, false);
2278 else if (is_array_init
2279 && (TREE_CODE (field
) != INTEGER_CST
2280 || curidx
!= wi::to_widest (field
)))
2282 pp_left_bracket (pp
);
2283 if (TREE_CODE (field
) == RANGE_EXPR
)
2285 dump_generic_node (pp
, TREE_OPERAND (field
, 0), spc
,
2287 pp_string (pp
, " ... ");
2288 dump_generic_node (pp
, TREE_OPERAND (field
, 1), spc
,
2290 if (TREE_CODE (TREE_OPERAND (field
, 1)) == INTEGER_CST
)
2291 curidx
= wi::to_widest (TREE_OPERAND (field
, 1));
2294 dump_generic_node (pp
, field
, spc
, flags
, false);
2295 if (TREE_CODE (field
) == INTEGER_CST
)
2296 curidx
= wi::to_widest (field
);
2297 pp_string (pp
, "]=");
2302 if (val
&& TREE_CODE (val
) == ADDR_EXPR
)
2303 if (TREE_CODE (TREE_OPERAND (val
, 0)) == FUNCTION_DECL
)
2304 val
= TREE_OPERAND (val
, 0);
2305 if (val
&& TREE_CODE (val
) == FUNCTION_DECL
)
2306 dump_decl_name (pp
, val
, flags
);
2308 dump_generic_node (pp
, val
, spc
, flags
, false);
2309 if (ix
!= CONSTRUCTOR_NELTS (node
) - 1)
2315 pp_right_brace (pp
);
2322 if (flags
& TDF_SLIM
)
2324 pp_string (pp
, "<COMPOUND_EXPR>");
2328 dump_generic_node (pp
, TREE_OPERAND (node
, 0),
2329 spc
, flags
, !(flags
& TDF_SLIM
));
2330 if (flags
& TDF_SLIM
)
2331 newline_and_indent (pp
, spc
);
2338 for (tp
= &TREE_OPERAND (node
, 1);
2339 TREE_CODE (*tp
) == COMPOUND_EXPR
;
2340 tp
= &TREE_OPERAND (*tp
, 1))
2342 dump_generic_node (pp
, TREE_OPERAND (*tp
, 0),
2343 spc
, flags
, !(flags
& TDF_SLIM
));
2344 if (flags
& TDF_SLIM
)
2345 newline_and_indent (pp
, spc
);
2353 dump_generic_node (pp
, *tp
, spc
, flags
, !(flags
& TDF_SLIM
));
2357 case STATEMENT_LIST
:
2359 tree_stmt_iterator si
;
2362 if (flags
& TDF_SLIM
)
2364 pp_string (pp
, "<STATEMENT_LIST>");
2368 for (si
= tsi_start (node
); !tsi_end_p (si
); tsi_next (&si
))
2371 newline_and_indent (pp
, spc
);
2374 dump_generic_node (pp
, tsi_stmt (si
), spc
, flags
, true);
2381 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
,
2386 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
,
2391 pp_string (pp
, "TARGET_EXPR <");
2392 dump_generic_node (pp
, TARGET_EXPR_SLOT (node
), spc
, flags
, false);
2395 dump_generic_node (pp
, TARGET_EXPR_INITIAL (node
), spc
, flags
, false);
2400 print_declaration (pp
, DECL_EXPR_DECL (node
), spc
, flags
);
2405 if (TREE_TYPE (node
) == NULL
|| TREE_TYPE (node
) == void_type_node
)
2407 pp_string (pp
, "if (");
2408 dump_generic_node (pp
, COND_EXPR_COND (node
), spc
, flags
, false);
2409 pp_right_paren (pp
);
2410 /* The lowered cond_exprs should always be printed in full. */
2411 if (COND_EXPR_THEN (node
)
2412 && (IS_EMPTY_STMT (COND_EXPR_THEN (node
))
2413 || TREE_CODE (COND_EXPR_THEN (node
)) == GOTO_EXPR
)
2414 && COND_EXPR_ELSE (node
)
2415 && (IS_EMPTY_STMT (COND_EXPR_ELSE (node
))
2416 || TREE_CODE (COND_EXPR_ELSE (node
)) == GOTO_EXPR
))
2419 dump_generic_node (pp
, COND_EXPR_THEN (node
),
2421 if (!IS_EMPTY_STMT (COND_EXPR_ELSE (node
)))
2423 pp_string (pp
, " else ");
2424 dump_generic_node (pp
, COND_EXPR_ELSE (node
),
2428 else if (!(flags
& TDF_SLIM
))
2430 /* Output COND_EXPR_THEN. */
2431 if (COND_EXPR_THEN (node
))
2433 newline_and_indent (pp
, spc
+2);
2435 newline_and_indent (pp
, spc
+4);
2436 dump_generic_node (pp
, COND_EXPR_THEN (node
), spc
+4,
2438 newline_and_indent (pp
, spc
+2);
2439 pp_right_brace (pp
);
2442 /* Output COND_EXPR_ELSE. */
2443 if (COND_EXPR_ELSE (node
)
2444 && !IS_EMPTY_STMT (COND_EXPR_ELSE (node
)))
2446 newline_and_indent (pp
, spc
);
2447 pp_string (pp
, "else");
2448 newline_and_indent (pp
, spc
+2);
2450 newline_and_indent (pp
, spc
+4);
2451 dump_generic_node (pp
, COND_EXPR_ELSE (node
), spc
+4,
2453 newline_and_indent (pp
, spc
+2);
2454 pp_right_brace (pp
);
2461 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2465 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2469 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2475 if (!(flags
& TDF_SLIM
))
2477 if (BIND_EXPR_VARS (node
))
2481 for (op0
= BIND_EXPR_VARS (node
); op0
; op0
= DECL_CHAIN (op0
))
2483 print_declaration (pp
, op0
, spc
+2, flags
);
2488 newline_and_indent (pp
, spc
+2);
2489 dump_generic_node (pp
, BIND_EXPR_BODY (node
), spc
+2, flags
, true);
2490 newline_and_indent (pp
, spc
);
2491 pp_right_brace (pp
);
2497 if (CALL_EXPR_FN (node
) != NULL_TREE
)
2498 print_call_name (pp
, CALL_EXPR_FN (node
), flags
);
2502 pp_string (pp
, internal_fn_name (CALL_EXPR_IFN (node
)));
2505 /* Print parameters. */
2510 call_expr_arg_iterator iter
;
2511 FOR_EACH_CALL_EXPR_ARG (arg
, iter
, node
)
2513 dump_generic_node (pp
, arg
, spc
, flags
, false);
2514 if (more_call_expr_args_p (&iter
))
2521 if (CALL_EXPR_VA_ARG_PACK (node
))
2523 if (call_expr_nargs (node
) > 0)
2528 pp_string (pp
, "__builtin_va_arg_pack ()");
2530 pp_right_paren (pp
);
2532 op1
= CALL_EXPR_STATIC_CHAIN (node
);
2535 pp_string (pp
, " [static-chain: ");
2536 dump_generic_node (pp
, op1
, spc
, flags
, false);
2537 pp_right_bracket (pp
);
2540 if (CALL_EXPR_RETURN_SLOT_OPT (node
))
2541 pp_string (pp
, " [return slot optimization]");
2542 if (CALL_EXPR_TAILCALL (node
))
2543 pp_string (pp
, " [tail call]");
2546 case WITH_CLEANUP_EXPR
:
2550 case CLEANUP_POINT_EXPR
:
2551 pp_string (pp
, "<<cleanup_point ");
2552 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2553 pp_string (pp
, ">>");
2556 case PLACEHOLDER_EXPR
:
2557 pp_string (pp
, "<PLACEHOLDER_EXPR ");
2558 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2562 /* Binary arithmetic and logic expressions. */
2563 case WIDEN_SUM_EXPR
:
2564 case WIDEN_MULT_EXPR
:
2566 case MULT_HIGHPART_EXPR
:
2568 case POINTER_PLUS_EXPR
:
2569 case POINTER_DIFF_EXPR
:
2571 case TRUNC_DIV_EXPR
:
2573 case FLOOR_DIV_EXPR
:
2574 case ROUND_DIV_EXPR
:
2575 case TRUNC_MOD_EXPR
:
2577 case FLOOR_MOD_EXPR
:
2578 case ROUND_MOD_EXPR
:
2580 case EXACT_DIV_EXPR
:
2585 case WIDEN_LSHIFT_EXPR
:
2589 case TRUTH_ANDIF_EXPR
:
2590 case TRUTH_ORIF_EXPR
:
2591 case TRUTH_AND_EXPR
:
2593 case TRUTH_XOR_EXPR
:
2607 case UNORDERED_EXPR
:
2609 const char *op
= op_symbol (node
);
2610 op0
= TREE_OPERAND (node
, 0);
2611 op1
= TREE_OPERAND (node
, 1);
2613 /* When the operands are expressions with less priority,
2614 keep semantics of the tree representation. */
2615 if (op_prio (op0
) <= op_prio (node
))
2618 dump_generic_node (pp
, op0
, spc
, flags
, false);
2619 pp_right_paren (pp
);
2622 dump_generic_node (pp
, op0
, spc
, flags
, false);
2628 /* When the operands are expressions with less priority,
2629 keep semantics of the tree representation. */
2630 if (op_prio (op1
) <= op_prio (node
))
2633 dump_generic_node (pp
, op1
, spc
, flags
, false);
2634 pp_right_paren (pp
);
2637 dump_generic_node (pp
, op1
, spc
, flags
, false);
2641 /* Unary arithmetic and logic expressions. */
2644 case TRUTH_NOT_EXPR
:
2646 case PREDECREMENT_EXPR
:
2647 case PREINCREMENT_EXPR
:
2649 if (TREE_CODE (node
) == ADDR_EXPR
2650 && (TREE_CODE (TREE_OPERAND (node
, 0)) == STRING_CST
2651 || TREE_CODE (TREE_OPERAND (node
, 0)) == FUNCTION_DECL
))
2652 ; /* Do not output '&' for strings and function pointers. */
2654 pp_string (pp
, op_symbol (node
));
2656 if (op_prio (TREE_OPERAND (node
, 0)) < op_prio (node
))
2659 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2660 pp_right_paren (pp
);
2663 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2666 case POSTDECREMENT_EXPR
:
2667 case POSTINCREMENT_EXPR
:
2668 if (op_prio (TREE_OPERAND (node
, 0)) < op_prio (node
))
2671 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2672 pp_right_paren (pp
);
2675 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2676 pp_string (pp
, op_symbol (node
));
2680 pp_string (pp
, "MIN_EXPR <");
2681 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2682 pp_string (pp
, ", ");
2683 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2688 pp_string (pp
, "MAX_EXPR <");
2689 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2690 pp_string (pp
, ", ");
2691 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2696 pp_string (pp
, "ABS_EXPR <");
2697 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2702 pp_string (pp
, "ABSU_EXPR <");
2703 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2711 case ADDR_SPACE_CONVERT_EXPR
:
2712 case FIXED_CONVERT_EXPR
:
2713 case FIX_TRUNC_EXPR
:
2716 type
= TREE_TYPE (node
);
2717 op0
= TREE_OPERAND (node
, 0);
2718 if (type
!= TREE_TYPE (op0
))
2721 dump_generic_node (pp
, type
, spc
, flags
, false);
2722 pp_string (pp
, ") ");
2724 if (op_prio (op0
) < op_prio (node
))
2726 dump_generic_node (pp
, op0
, spc
, flags
, false);
2727 if (op_prio (op0
) < op_prio (node
))
2728 pp_right_paren (pp
);
2731 case VIEW_CONVERT_EXPR
:
2732 if (flags
& TDF_GIMPLE
)
2733 pp_string (pp
, "__VIEW_CONVERT <");
2735 pp_string (pp
, "VIEW_CONVERT_EXPR<");
2736 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2737 pp_string (pp
, ">(");
2738 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2739 pp_right_paren (pp
);
2743 pp_string (pp
, "((");
2744 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2745 pp_string (pp
, "))");
2748 case NON_LVALUE_EXPR
:
2749 pp_string (pp
, "NON_LVALUE_EXPR <");
2750 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2755 pp_string (pp
, "SAVE_EXPR <");
2756 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2761 pp_string (pp
, "COMPLEX_EXPR <");
2762 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2763 pp_string (pp
, ", ");
2764 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2769 pp_string (pp
, "CONJ_EXPR <");
2770 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2775 if (flags
& TDF_GIMPLE
)
2777 pp_string (pp
, "__real ");
2778 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2782 pp_string (pp
, "REALPART_EXPR <");
2783 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2789 if (flags
& TDF_GIMPLE
)
2791 pp_string (pp
, "__imag ");
2792 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2796 pp_string (pp
, "IMAGPART_EXPR <");
2797 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2803 pp_string (pp
, "VA_ARG_EXPR <");
2804 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2808 case TRY_FINALLY_EXPR
:
2809 case TRY_CATCH_EXPR
:
2810 pp_string (pp
, "try");
2811 newline_and_indent (pp
, spc
+2);
2813 newline_and_indent (pp
, spc
+4);
2814 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
+4, flags
, true);
2815 newline_and_indent (pp
, spc
+2);
2816 pp_right_brace (pp
);
2817 newline_and_indent (pp
, spc
);
2818 if (TREE_CODE (node
) == TRY_CATCH_EXPR
)
2820 node
= TREE_OPERAND (node
, 1);
2821 pp_string (pp
, "catch");
2825 gcc_assert (TREE_CODE (node
) == TRY_FINALLY_EXPR
);
2826 node
= TREE_OPERAND (node
, 1);
2827 pp_string (pp
, "finally");
2828 if (TREE_CODE (node
) == EH_ELSE_EXPR
)
2830 newline_and_indent (pp
, spc
+2);
2832 newline_and_indent (pp
, spc
+4);
2833 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
+4,
2835 newline_and_indent (pp
, spc
+2);
2836 pp_right_brace (pp
);
2837 newline_and_indent (pp
, spc
);
2838 node
= TREE_OPERAND (node
, 1);
2839 pp_string (pp
, "else");
2842 newline_and_indent (pp
, spc
+2);
2844 newline_and_indent (pp
, spc
+4);
2845 dump_generic_node (pp
, node
, spc
+4, flags
, true);
2846 newline_and_indent (pp
, spc
+2);
2847 pp_right_brace (pp
);
2852 pp_string (pp
, "catch (");
2853 dump_generic_node (pp
, CATCH_TYPES (node
), spc
+2, flags
, false);
2854 pp_right_paren (pp
);
2855 newline_and_indent (pp
, spc
+2);
2857 newline_and_indent (pp
, spc
+4);
2858 dump_generic_node (pp
, CATCH_BODY (node
), spc
+4, flags
, true);
2859 newline_and_indent (pp
, spc
+2);
2860 pp_right_brace (pp
);
2864 case EH_FILTER_EXPR
:
2865 pp_string (pp
, "<<<eh_filter (");
2866 dump_generic_node (pp
, EH_FILTER_TYPES (node
), spc
+2, flags
, false);
2867 pp_string (pp
, ")>>>");
2868 newline_and_indent (pp
, spc
+2);
2870 newline_and_indent (pp
, spc
+4);
2871 dump_generic_node (pp
, EH_FILTER_FAILURE (node
), spc
+4, flags
, true);
2872 newline_and_indent (pp
, spc
+2);
2873 pp_right_brace (pp
);
2878 op0
= TREE_OPERAND (node
, 0);
2879 /* If this is for break or continue, don't bother printing it. */
2880 if (DECL_NAME (op0
))
2882 const char *name
= IDENTIFIER_POINTER (DECL_NAME (op0
));
2883 if (strcmp (name
, "break") == 0
2884 || strcmp (name
, "continue") == 0)
2887 dump_generic_node (pp
, op0
, spc
, flags
, false);
2889 if (DECL_NONLOCAL (op0
))
2890 pp_string (pp
, " [non-local]");
2894 pp_string (pp
, "while (1)");
2895 if (!(flags
& TDF_SLIM
))
2897 newline_and_indent (pp
, spc
+2);
2899 newline_and_indent (pp
, spc
+4);
2900 dump_generic_node (pp
, LOOP_EXPR_BODY (node
), spc
+4, flags
, true);
2901 newline_and_indent (pp
, spc
+2);
2902 pp_right_brace (pp
);
2908 pp_string (pp
, "// predicted ");
2909 if (PREDICT_EXPR_OUTCOME (node
))
2910 pp_string (pp
, "likely by ");
2912 pp_string (pp
, "unlikely by ");
2913 pp_string (pp
, predictor_name (PREDICT_EXPR_PREDICTOR (node
)));
2914 pp_string (pp
, " predictor.");
2918 pp_string (pp
, "ANNOTATE_EXPR <");
2919 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2920 switch ((enum annot_expr_kind
) TREE_INT_CST_LOW (TREE_OPERAND (node
, 1)))
2922 case annot_expr_ivdep_kind
:
2923 pp_string (pp
, ", ivdep");
2925 case annot_expr_unroll_kind
:
2926 pp_printf (pp
, ", unroll %d",
2927 (int) TREE_INT_CST_LOW (TREE_OPERAND (node
, 2)));
2929 case annot_expr_no_vector_kind
:
2930 pp_string (pp
, ", no-vector");
2932 case annot_expr_vector_kind
:
2933 pp_string (pp
, ", vector");
2935 case annot_expr_parallel_kind
:
2936 pp_string (pp
, ", parallel");
2945 pp_string (pp
, "return");
2946 op0
= TREE_OPERAND (node
, 0);
2950 if (TREE_CODE (op0
) == MODIFY_EXPR
)
2951 dump_generic_node (pp
, TREE_OPERAND (op0
, 1),
2954 dump_generic_node (pp
, op0
, spc
, flags
, false);
2959 pp_string (pp
, "if (");
2960 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2961 pp_string (pp
, ") break");
2965 pp_string (pp
, "switch (");
2966 dump_generic_node (pp
, SWITCH_COND (node
), spc
, flags
, false);
2967 pp_right_paren (pp
);
2968 if (!(flags
& TDF_SLIM
))
2970 newline_and_indent (pp
, spc
+2);
2972 if (SWITCH_BODY (node
))
2974 newline_and_indent (pp
, spc
+4);
2975 dump_generic_node (pp
, SWITCH_BODY (node
), spc
+4, flags
,
2978 newline_and_indent (pp
, spc
+2);
2979 pp_right_brace (pp
);
2985 op0
= GOTO_DESTINATION (node
);
2986 if (TREE_CODE (op0
) != SSA_NAME
&& DECL_P (op0
) && DECL_NAME (op0
))
2988 const char *name
= IDENTIFIER_POINTER (DECL_NAME (op0
));
2989 if (strcmp (name
, "break") == 0
2990 || strcmp (name
, "continue") == 0)
2992 pp_string (pp
, name
);
2996 pp_string (pp
, "goto ");
2997 dump_generic_node (pp
, op0
, spc
, flags
, false);
3001 pp_string (pp
, "__asm__");
3002 if (ASM_VOLATILE_P (node
))
3003 pp_string (pp
, " __volatile__");
3005 dump_generic_node (pp
, ASM_STRING (node
), spc
, flags
, false);
3007 dump_generic_node (pp
, ASM_OUTPUTS (node
), spc
, flags
, false);
3009 dump_generic_node (pp
, ASM_INPUTS (node
), spc
, flags
, false);
3010 if (ASM_CLOBBERS (node
))
3013 dump_generic_node (pp
, ASM_CLOBBERS (node
), spc
, flags
, false);
3015 pp_right_paren (pp
);
3018 case CASE_LABEL_EXPR
:
3019 if (CASE_LOW (node
) && CASE_HIGH (node
))
3021 pp_string (pp
, "case ");
3022 dump_generic_node (pp
, CASE_LOW (node
), spc
, flags
, false);
3023 pp_string (pp
, " ... ");
3024 dump_generic_node (pp
, CASE_HIGH (node
), spc
, flags
, false);
3026 else if (CASE_LOW (node
))
3028 pp_string (pp
, "case ");
3029 dump_generic_node (pp
, CASE_LOW (node
), spc
, flags
, false);
3032 pp_string (pp
, "default");
3037 pp_string (pp
, "OBJ_TYPE_REF(");
3038 dump_generic_node (pp
, OBJ_TYPE_REF_EXPR (node
), spc
, flags
, false);
3040 /* We omit the class type for -fcompare-debug because we may
3041 drop TYPE_BINFO early depending on debug info, and then
3042 virtual_method_call_p would return false, whereas when
3043 TYPE_BINFO is preserved it may still return true and then
3044 we'd print the class type. Compare tree and rtl dumps for
3045 libstdc++-prettyprinters/shared_ptr.cc with and without -g,
3046 for example, at occurrences of OBJ_TYPE_REF. */
3047 if (!(flags
& (TDF_SLIM
| TDF_COMPARE_DEBUG
))
3048 && virtual_method_call_p (node
))
3050 pp_string (pp
, "(");
3051 dump_generic_node (pp
, obj_type_ref_class (node
), spc
, flags
, false);
3052 pp_string (pp
, ")");
3054 dump_generic_node (pp
, OBJ_TYPE_REF_OBJECT (node
), spc
, flags
, false);
3056 dump_generic_node (pp
, OBJ_TYPE_REF_TOKEN (node
), spc
, flags
, false);
3057 pp_right_paren (pp
);
3061 if (SSA_NAME_IDENTIFIER (node
))
3063 if ((flags
& TDF_NOUID
)
3064 && SSA_NAME_VAR (node
)
3065 && DECL_NAMELESS (SSA_NAME_VAR (node
)))
3066 dump_fancy_name (pp
, SSA_NAME_IDENTIFIER (node
));
3067 else if (! (flags
& TDF_GIMPLE
)
3068 || SSA_NAME_VAR (node
))
3069 dump_generic_node (pp
, SSA_NAME_IDENTIFIER (node
),
3073 pp_decimal_int (pp
, SSA_NAME_VERSION (node
));
3074 if (SSA_NAME_IS_DEFAULT_DEF (node
))
3075 pp_string (pp
, "(D)");
3076 if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (node
))
3077 pp_string (pp
, "(ab)");
3080 case WITH_SIZE_EXPR
:
3081 pp_string (pp
, "WITH_SIZE_EXPR <");
3082 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3083 pp_string (pp
, ", ");
3084 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3089 pp_string (pp
, "ASSERT_EXPR <");
3090 dump_generic_node (pp
, ASSERT_EXPR_VAR (node
), spc
, flags
, false);
3091 pp_string (pp
, ", ");
3092 dump_generic_node (pp
, ASSERT_EXPR_COND (node
), spc
, flags
, false);
3097 pp_string (pp
, "scev_known");
3100 case SCEV_NOT_KNOWN
:
3101 pp_string (pp
, "scev_not_known");
3104 case POLYNOMIAL_CHREC
:
3106 dump_generic_node (pp
, CHREC_LEFT (node
), spc
, flags
, false);
3107 pp_string (pp
, ", +, ");
3108 dump_generic_node (pp
, CHREC_RIGHT (node
), spc
, flags
, false);
3109 pp_printf (pp
, "}_%u", CHREC_VARIABLE (node
));
3113 case REALIGN_LOAD_EXPR
:
3114 pp_string (pp
, "REALIGN_LOAD <");
3115 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3116 pp_string (pp
, ", ");
3117 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3118 pp_string (pp
, ", ");
3119 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3124 pp_string (pp
, " VEC_COND_EXPR < ");
3125 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3126 pp_string (pp
, " , ");
3127 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3128 pp_string (pp
, " , ");
3129 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3130 pp_string (pp
, " > ");
3134 pp_string (pp
, " VEC_PERM_EXPR < ");
3135 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3136 pp_string (pp
, " , ");
3137 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3138 pp_string (pp
, " , ");
3139 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3140 pp_string (pp
, " > ");
3144 pp_string (pp
, " DOT_PROD_EXPR < ");
3145 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3146 pp_string (pp
, ", ");
3147 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3148 pp_string (pp
, ", ");
3149 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3150 pp_string (pp
, " > ");
3153 case WIDEN_MULT_PLUS_EXPR
:
3154 pp_string (pp
, " WIDEN_MULT_PLUS_EXPR < ");
3155 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3156 pp_string (pp
, ", ");
3157 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3158 pp_string (pp
, ", ");
3159 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3160 pp_string (pp
, " > ");
3163 case WIDEN_MULT_MINUS_EXPR
:
3164 pp_string (pp
, " WIDEN_MULT_MINUS_EXPR < ");
3165 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3166 pp_string (pp
, ", ");
3167 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3168 pp_string (pp
, ", ");
3169 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3170 pp_string (pp
, " > ");
3174 pp_string (pp
, "#pragma acc parallel");
3175 goto dump_omp_clauses_body
;
3178 pp_string (pp
, "#pragma acc kernels");
3179 goto dump_omp_clauses_body
;
3182 pp_string (pp
, "#pragma acc data");
3183 dump_omp_clauses (pp
, OACC_DATA_CLAUSES (node
), spc
, flags
);
3186 case OACC_HOST_DATA
:
3187 pp_string (pp
, "#pragma acc host_data");
3188 dump_omp_clauses (pp
, OACC_HOST_DATA_CLAUSES (node
), spc
, flags
);
3192 pp_string (pp
, "#pragma acc declare");
3193 dump_omp_clauses (pp
, OACC_DECLARE_CLAUSES (node
), spc
, flags
);
3197 pp_string (pp
, "#pragma acc update");
3198 dump_omp_clauses (pp
, OACC_UPDATE_CLAUSES (node
), spc
, flags
);
3201 case OACC_ENTER_DATA
:
3202 pp_string (pp
, "#pragma acc enter data");
3203 dump_omp_clauses (pp
, OACC_ENTER_DATA_CLAUSES (node
), spc
, flags
);
3206 case OACC_EXIT_DATA
:
3207 pp_string (pp
, "#pragma acc exit data");
3208 dump_omp_clauses (pp
, OACC_EXIT_DATA_CLAUSES (node
), spc
, flags
);
3212 pp_string (pp
, "#pragma acc cache");
3213 dump_omp_clauses (pp
, OACC_CACHE_CLAUSES (node
), spc
, flags
);
3217 pp_string (pp
, "#pragma omp parallel");
3218 dump_omp_clauses (pp
, OMP_PARALLEL_CLAUSES (node
), spc
, flags
);
3221 dump_omp_clauses_body
:
3222 dump_omp_clauses (pp
, OMP_CLAUSES (node
), spc
, flags
);
3226 if (!(flags
& TDF_SLIM
) && OMP_BODY (node
))
3228 newline_and_indent (pp
, spc
+ 2);
3230 newline_and_indent (pp
, spc
+ 4);
3231 dump_generic_node (pp
, OMP_BODY (node
), spc
+ 4, flags
, false);
3232 newline_and_indent (pp
, spc
+ 2);
3233 pp_right_brace (pp
);
3239 pp_string (pp
, OMP_TASK_BODY (node
) ? "#pragma omp task"
3240 : "#pragma omp taskwait");
3241 dump_omp_clauses (pp
, OMP_TASK_CLAUSES (node
), spc
, flags
);
3245 pp_string (pp
, "#pragma omp for");
3249 pp_string (pp
, "#pragma omp simd");
3252 case OMP_DISTRIBUTE
:
3253 pp_string (pp
, "#pragma omp distribute");
3257 pp_string (pp
, "#pragma omp taskloop");
3261 pp_string (pp
, "#pragma acc loop");
3265 pp_string (pp
, "#pragma omp teams");
3266 dump_omp_clauses (pp
, OMP_TEAMS_CLAUSES (node
), spc
, flags
);
3269 case OMP_TARGET_DATA
:
3270 pp_string (pp
, "#pragma omp target data");
3271 dump_omp_clauses (pp
, OMP_TARGET_DATA_CLAUSES (node
), spc
, flags
);
3274 case OMP_TARGET_ENTER_DATA
:
3275 pp_string (pp
, "#pragma omp target enter data");
3276 dump_omp_clauses (pp
, OMP_TARGET_ENTER_DATA_CLAUSES (node
), spc
, flags
);
3280 case OMP_TARGET_EXIT_DATA
:
3281 pp_string (pp
, "#pragma omp target exit data");
3282 dump_omp_clauses (pp
, OMP_TARGET_EXIT_DATA_CLAUSES (node
), spc
, flags
);
3287 pp_string (pp
, "#pragma omp target");
3288 dump_omp_clauses (pp
, OMP_TARGET_CLAUSES (node
), spc
, flags
);
3291 case OMP_TARGET_UPDATE
:
3292 pp_string (pp
, "#pragma omp target update");
3293 dump_omp_clauses (pp
, OMP_TARGET_UPDATE_CLAUSES (node
), spc
, flags
);
3298 dump_omp_clauses (pp
, OMP_FOR_CLAUSES (node
), spc
, flags
);
3299 if (!(flags
& TDF_SLIM
))
3303 if (OMP_FOR_PRE_BODY (node
))
3305 newline_and_indent (pp
, spc
+ 2);
3308 newline_and_indent (pp
, spc
);
3309 dump_generic_node (pp
, OMP_FOR_PRE_BODY (node
),
3312 if (OMP_FOR_INIT (node
))
3315 for (i
= 0; i
< TREE_VEC_LENGTH (OMP_FOR_INIT (node
)); i
++)
3318 newline_and_indent (pp
, spc
);
3319 pp_string (pp
, "for (");
3320 dump_generic_node (pp
,
3321 TREE_VEC_ELT (OMP_FOR_INIT (node
), i
),
3323 pp_string (pp
, "; ");
3324 dump_generic_node (pp
,
3325 TREE_VEC_ELT (OMP_FOR_COND (node
), i
),
3327 pp_string (pp
, "; ");
3328 dump_generic_node (pp
,
3329 TREE_VEC_ELT (OMP_FOR_INCR (node
), i
),
3331 pp_right_paren (pp
);
3334 if (OMP_FOR_BODY (node
))
3336 newline_and_indent (pp
, spc
+ 2);
3338 newline_and_indent (pp
, spc
+ 4);
3339 dump_generic_node (pp
, OMP_FOR_BODY (node
), spc
+ 4, flags
,
3341 newline_and_indent (pp
, spc
+ 2);
3342 pp_right_brace (pp
);
3344 if (OMP_FOR_INIT (node
))
3345 spc
-= 2 * TREE_VEC_LENGTH (OMP_FOR_INIT (node
)) - 2;
3346 if (OMP_FOR_PRE_BODY (node
))
3349 newline_and_indent (pp
, spc
+ 2);
3350 pp_right_brace (pp
);
3357 pp_string (pp
, "#pragma omp sections");
3358 dump_omp_clauses (pp
, OMP_SECTIONS_CLAUSES (node
), spc
, flags
);
3362 pp_string (pp
, "#pragma omp section");
3366 if (OMP_SCAN_CLAUSES (node
))
3368 pp_string (pp
, "#pragma omp scan");
3369 dump_omp_clauses (pp
, OMP_SCAN_CLAUSES (node
), spc
, flags
);
3374 pp_string (pp
, "#pragma omp master");
3378 pp_string (pp
, "#pragma omp taskgroup");
3379 dump_omp_clauses (pp
, OMP_TASKGROUP_CLAUSES (node
), spc
, flags
);
3383 pp_string (pp
, "#pragma omp ordered");
3384 dump_omp_clauses (pp
, OMP_ORDERED_CLAUSES (node
), spc
, flags
);
3388 pp_string (pp
, "#pragma omp critical");
3389 if (OMP_CRITICAL_NAME (node
))
3393 dump_generic_node (pp
, OMP_CRITICAL_NAME (node
), spc
,
3395 pp_right_paren (pp
);
3397 dump_omp_clauses (pp
, OMP_CRITICAL_CLAUSES (node
), spc
, flags
);
3401 pp_string (pp
, "#pragma omp atomic");
3402 dump_omp_atomic_memory_order (pp
, OMP_ATOMIC_MEMORY_ORDER (node
));
3403 newline_and_indent (pp
, spc
+ 2);
3404 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3408 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3411 case OMP_ATOMIC_READ
:
3412 pp_string (pp
, "#pragma omp atomic read");
3413 dump_omp_atomic_memory_order (pp
, OMP_ATOMIC_MEMORY_ORDER (node
));
3414 newline_and_indent (pp
, spc
+ 2);
3415 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3419 case OMP_ATOMIC_CAPTURE_OLD
:
3420 case OMP_ATOMIC_CAPTURE_NEW
:
3421 pp_string (pp
, "#pragma omp atomic capture");
3422 dump_omp_atomic_memory_order (pp
, OMP_ATOMIC_MEMORY_ORDER (node
));
3423 newline_and_indent (pp
, spc
+ 2);
3424 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3428 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3432 pp_string (pp
, "#pragma omp single");
3433 dump_omp_clauses (pp
, OMP_SINGLE_CLAUSES (node
), spc
, flags
);
3437 dump_omp_clause (pp
, node
, spc
, flags
);
3441 case TRANSACTION_EXPR
:
3442 if (TRANSACTION_EXPR_OUTER (node
))
3443 pp_string (pp
, "__transaction_atomic [[outer]]");
3444 else if (TRANSACTION_EXPR_RELAXED (node
))
3445 pp_string (pp
, "__transaction_relaxed");
3447 pp_string (pp
, "__transaction_atomic");
3448 if (!(flags
& TDF_SLIM
) && TRANSACTION_EXPR_BODY (node
))
3450 newline_and_indent (pp
, spc
);
3452 newline_and_indent (pp
, spc
+ 2);
3453 dump_generic_node (pp
, TRANSACTION_EXPR_BODY (node
),
3454 spc
+ 2, flags
, false);
3455 newline_and_indent (pp
, spc
);
3456 pp_right_brace (pp
);
3461 case VEC_SERIES_EXPR
:
3462 case VEC_WIDEN_MULT_HI_EXPR
:
3463 case VEC_WIDEN_MULT_LO_EXPR
:
3464 case VEC_WIDEN_MULT_EVEN_EXPR
:
3465 case VEC_WIDEN_MULT_ODD_EXPR
:
3466 case VEC_WIDEN_LSHIFT_HI_EXPR
:
3467 case VEC_WIDEN_LSHIFT_LO_EXPR
:
3469 for (str
= get_tree_code_name (code
); *str
; str
++)
3470 pp_character (pp
, TOUPPER (*str
));
3471 pp_string (pp
, " < ");
3472 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3473 pp_string (pp
, ", ");
3474 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3475 pp_string (pp
, " > ");
3478 case VEC_DUPLICATE_EXPR
:
3480 for (str
= get_tree_code_name (code
); *str
; str
++)
3481 pp_character (pp
, TOUPPER (*str
));
3482 pp_string (pp
, " < ");
3483 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3484 pp_string (pp
, " > ");
3487 case VEC_UNPACK_HI_EXPR
:
3488 pp_string (pp
, " VEC_UNPACK_HI_EXPR < ");
3489 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3490 pp_string (pp
, " > ");
3493 case VEC_UNPACK_LO_EXPR
:
3494 pp_string (pp
, " VEC_UNPACK_LO_EXPR < ");
3495 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3496 pp_string (pp
, " > ");
3499 case VEC_UNPACK_FLOAT_HI_EXPR
:
3500 pp_string (pp
, " VEC_UNPACK_FLOAT_HI_EXPR < ");
3501 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3502 pp_string (pp
, " > ");
3505 case VEC_UNPACK_FLOAT_LO_EXPR
:
3506 pp_string (pp
, " VEC_UNPACK_FLOAT_LO_EXPR < ");
3507 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3508 pp_string (pp
, " > ");
3511 case VEC_UNPACK_FIX_TRUNC_HI_EXPR
:
3512 pp_string (pp
, " VEC_UNPACK_FIX_TRUNC_HI_EXPR < ");
3513 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3514 pp_string (pp
, " > ");
3517 case VEC_UNPACK_FIX_TRUNC_LO_EXPR
:
3518 pp_string (pp
, " VEC_UNPACK_FIX_TRUNC_LO_EXPR < ");
3519 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3520 pp_string (pp
, " > ");
3523 case VEC_PACK_TRUNC_EXPR
:
3524 pp_string (pp
, " VEC_PACK_TRUNC_EXPR < ");
3525 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3526 pp_string (pp
, ", ");
3527 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3528 pp_string (pp
, " > ");
3531 case VEC_PACK_SAT_EXPR
:
3532 pp_string (pp
, " VEC_PACK_SAT_EXPR < ");
3533 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3534 pp_string (pp
, ", ");
3535 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3536 pp_string (pp
, " > ");
3539 case VEC_PACK_FIX_TRUNC_EXPR
:
3540 pp_string (pp
, " VEC_PACK_FIX_TRUNC_EXPR < ");
3541 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3542 pp_string (pp
, ", ");
3543 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3544 pp_string (pp
, " > ");
3547 case VEC_PACK_FLOAT_EXPR
:
3548 pp_string (pp
, " VEC_PACK_FLOAT_EXPR < ");
3549 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3550 pp_string (pp
, ", ");
3551 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3552 pp_string (pp
, " > ");
3556 dump_block_node (pp
, node
, spc
, flags
);
3559 case DEBUG_BEGIN_STMT
:
3560 pp_string (pp
, "# DEBUG BEGIN STMT");
3567 if (is_stmt
&& is_expr
)
3573 /* Print the declaration of a variable. */
3576 print_declaration (pretty_printer
*pp
, tree t
, int spc
, dump_flags_t flags
)
3580 if (TREE_CODE(t
) == NAMELIST_DECL
)
3582 pp_string(pp
, "namelist ");
3583 dump_decl_name (pp
, t
, flags
);
3588 if (TREE_CODE (t
) == TYPE_DECL
)
3589 pp_string (pp
, "typedef ");
3591 if (CODE_CONTAINS_STRUCT (TREE_CODE (t
), TS_DECL_WRTL
) && DECL_REGISTER (t
))
3592 pp_string (pp
, "register ");
3594 if (TREE_PUBLIC (t
) && DECL_EXTERNAL (t
))
3595 pp_string (pp
, "extern ");
3596 else if (TREE_STATIC (t
))
3597 pp_string (pp
, "static ");
3599 /* Print the type and name. */
3600 if (TREE_TYPE (t
) && TREE_CODE (TREE_TYPE (t
)) == ARRAY_TYPE
)
3604 /* Print array's type. */
3605 tmp
= TREE_TYPE (t
);
3606 while (TREE_CODE (TREE_TYPE (tmp
)) == ARRAY_TYPE
)
3607 tmp
= TREE_TYPE (tmp
);
3608 dump_generic_node (pp
, TREE_TYPE (tmp
), spc
, flags
, false);
3610 /* Print variable's name. */
3612 dump_generic_node (pp
, t
, spc
, flags
, false);
3614 /* Print the dimensions. */
3615 tmp
= TREE_TYPE (t
);
3616 while (TREE_CODE (tmp
) == ARRAY_TYPE
)
3618 dump_array_domain (pp
, TYPE_DOMAIN (tmp
), spc
, flags
);
3619 tmp
= TREE_TYPE (tmp
);
3622 else if (TREE_CODE (t
) == FUNCTION_DECL
)
3624 dump_generic_node (pp
, TREE_TYPE (TREE_TYPE (t
)), spc
, flags
, false);
3626 dump_decl_name (pp
, t
, flags
);
3627 dump_function_declaration (pp
, TREE_TYPE (t
), spc
, flags
);
3631 /* Print type declaration. */
3632 dump_generic_node (pp
, TREE_TYPE (t
), spc
, flags
, false);
3634 /* Print variable's name. */
3636 dump_generic_node (pp
, t
, spc
, flags
, false);
3639 if (VAR_P (t
) && DECL_HARD_REGISTER (t
))
3641 pp_string (pp
, " __asm__ ");
3643 dump_generic_node (pp
, DECL_ASSEMBLER_NAME (t
), spc
, flags
, false);
3644 pp_right_paren (pp
);
3647 /* The initial value of a function serves to determine whether the function
3648 is declared or defined. So the following does not apply to function
3650 if (TREE_CODE (t
) != FUNCTION_DECL
)
3652 /* Print the initial value. */
3653 if (DECL_INITIAL (t
))
3658 if (!(flags
& TDF_SLIM
))
3659 dump_generic_node (pp
, DECL_INITIAL (t
), spc
, flags
, false);
3661 pp_string (pp
, "<<< omitted >>>");
3665 if (VAR_P (t
) && DECL_HAS_VALUE_EXPR_P (t
))
3667 pp_string (pp
, " [value-expr: ");
3668 dump_generic_node (pp
, DECL_VALUE_EXPR (t
), spc
, flags
, false);
3669 pp_right_bracket (pp
);
3676 /* Prints a structure: name, fields, and methods.
3677 FIXME: Still incomplete. */
3680 print_struct_decl (pretty_printer
*pp
, const_tree node
, int spc
,
3683 /* Print the name of the structure. */
3684 if (TYPE_NAME (node
))
3687 if (TREE_CODE (node
) == RECORD_TYPE
)
3688 pp_string (pp
, "struct ");
3689 else if ((TREE_CODE (node
) == UNION_TYPE
3690 || TREE_CODE (node
) == QUAL_UNION_TYPE
))
3691 pp_string (pp
, "union ");
3693 dump_generic_node (pp
, TYPE_NAME (node
), spc
, TDF_NONE
, false);
3696 /* Print the contents of the structure. */
3702 /* Print the fields of the structure. */
3705 tmp
= TYPE_FIELDS (node
);
3708 /* Avoid to print recursively the structure. */
3709 /* FIXME : Not implemented correctly...,
3710 what about the case when we have a cycle in the contain graph? ...
3711 Maybe this could be solved by looking at the scope in which the
3712 structure was declared. */
3713 if (TREE_TYPE (tmp
) != node
3714 && (TREE_CODE (TREE_TYPE (tmp
)) != POINTER_TYPE
3715 || TREE_TYPE (TREE_TYPE (tmp
)) != node
))
3717 print_declaration (pp
, tmp
, spc
+2, flags
);
3720 tmp
= DECL_CHAIN (tmp
);
3724 pp_right_brace (pp
);
3727 /* Return the priority of the operator CODE.
3729 From lowest to highest precedence with either left-to-right (L-R)
3730 or right-to-left (R-L) associativity]:
3733 2 [R-L] = += -= *= /= %= &= ^= |= <<= >>=
3745 14 [R-L] ! ~ ++ -- + - * & (type) sizeof
3746 15 [L-R] fn() [] -> .
3748 unary +, - and * have higher precedence than the corresponding binary
3752 op_code_prio (enum tree_code code
)
3769 case TRUTH_ORIF_EXPR
:
3772 case TRUTH_AND_EXPR
:
3773 case TRUTH_ANDIF_EXPR
:
3780 case TRUTH_XOR_EXPR
:
3797 case UNORDERED_EXPR
:
3808 case VEC_WIDEN_LSHIFT_HI_EXPR
:
3809 case VEC_WIDEN_LSHIFT_LO_EXPR
:
3810 case WIDEN_LSHIFT_EXPR
:
3813 case WIDEN_SUM_EXPR
:
3815 case POINTER_PLUS_EXPR
:
3816 case POINTER_DIFF_EXPR
:
3820 case VEC_WIDEN_MULT_HI_EXPR
:
3821 case VEC_WIDEN_MULT_LO_EXPR
:
3822 case WIDEN_MULT_EXPR
:
3824 case WIDEN_MULT_PLUS_EXPR
:
3825 case WIDEN_MULT_MINUS_EXPR
:
3827 case MULT_HIGHPART_EXPR
:
3828 case TRUNC_DIV_EXPR
:
3830 case FLOOR_DIV_EXPR
:
3831 case ROUND_DIV_EXPR
:
3833 case EXACT_DIV_EXPR
:
3834 case TRUNC_MOD_EXPR
:
3836 case FLOOR_MOD_EXPR
:
3837 case ROUND_MOD_EXPR
:
3840 case TRUTH_NOT_EXPR
:
3842 case POSTINCREMENT_EXPR
:
3843 case POSTDECREMENT_EXPR
:
3844 case PREINCREMENT_EXPR
:
3845 case PREDECREMENT_EXPR
:
3851 case FIX_TRUNC_EXPR
:
3857 case ARRAY_RANGE_REF
:
3861 /* Special expressions. */
3867 case VEC_UNPACK_HI_EXPR
:
3868 case VEC_UNPACK_LO_EXPR
:
3869 case VEC_UNPACK_FLOAT_HI_EXPR
:
3870 case VEC_UNPACK_FLOAT_LO_EXPR
:
3871 case VEC_UNPACK_FIX_TRUNC_HI_EXPR
:
3872 case VEC_UNPACK_FIX_TRUNC_LO_EXPR
:
3873 case VEC_PACK_TRUNC_EXPR
:
3874 case VEC_PACK_SAT_EXPR
:
3878 /* Return an arbitrarily high precedence to avoid surrounding single
3879 VAR_DECLs in ()s. */
3884 /* Return the priority of the operator OP. */
3887 op_prio (const_tree op
)
3889 enum tree_code code
;
3894 code
= TREE_CODE (op
);
3895 if (code
== SAVE_EXPR
|| code
== NON_LVALUE_EXPR
)
3896 return op_prio (TREE_OPERAND (op
, 0));
3898 return op_code_prio (code
);
3901 /* Return the symbol associated with operator CODE. */
3904 op_symbol_code (enum tree_code code
)
3912 case TRUTH_ORIF_EXPR
:
3915 case TRUTH_AND_EXPR
:
3916 case TRUTH_ANDIF_EXPR
:
3922 case TRUTH_XOR_EXPR
:
3932 case UNORDERED_EXPR
:
3978 case WIDEN_LSHIFT_EXPR
:
3981 case POINTER_PLUS_EXPR
:
3987 case WIDEN_SUM_EXPR
:
3990 case WIDEN_MULT_EXPR
:
3993 case MULT_HIGHPART_EXPR
:
3998 case POINTER_DIFF_EXPR
:
4004 case TRUTH_NOT_EXPR
:
4011 case TRUNC_DIV_EXPR
:
4018 case FLOOR_DIV_EXPR
:
4021 case ROUND_DIV_EXPR
:
4024 case EXACT_DIV_EXPR
:
4027 case TRUNC_MOD_EXPR
:
4033 case FLOOR_MOD_EXPR
:
4036 case ROUND_MOD_EXPR
:
4039 case PREDECREMENT_EXPR
:
4042 case PREINCREMENT_EXPR
:
4045 case POSTDECREMENT_EXPR
:
4048 case POSTINCREMENT_EXPR
:
4058 return "<<< ??? >>>";
4062 /* Return the symbol associated with operator OP. */
4065 op_symbol (const_tree op
)
4067 return op_symbol_code (TREE_CODE (op
));
4070 /* Prints the name of a call. NODE is the CALL_EXPR_FN of a CALL_EXPR or
4071 the gimple_call_fn of a GIMPLE_CALL. */
4074 print_call_name (pretty_printer
*pp
, tree node
, dump_flags_t flags
)
4078 if (TREE_CODE (op0
) == NON_LVALUE_EXPR
)
4079 op0
= TREE_OPERAND (op0
, 0);
4082 switch (TREE_CODE (op0
))
4087 dump_function_name (pp
, op0
, flags
);
4093 op0
= TREE_OPERAND (op0
, 0);
4098 dump_generic_node (pp
, TREE_OPERAND (op0
, 0), 0, flags
, false);
4099 pp_string (pp
, ") ? ");
4100 dump_generic_node (pp
, TREE_OPERAND (op0
, 1), 0, flags
, false);
4101 pp_string (pp
, " : ");
4102 dump_generic_node (pp
, TREE_OPERAND (op0
, 2), 0, flags
, false);
4106 if (TREE_CODE (TREE_OPERAND (op0
, 0)) == VAR_DECL
)
4107 dump_function_name (pp
, TREE_OPERAND (op0
, 0), flags
);
4109 dump_generic_node (pp
, op0
, 0, flags
, false);
4113 if (integer_zerop (TREE_OPERAND (op0
, 1)))
4115 op0
= TREE_OPERAND (op0
, 0);
4122 dump_generic_node (pp
, op0
, 0, flags
, false);
4130 /* Print the first N characters in the array STR, replacing non-printable
4131 characters (including embedded nuls) with unambiguous escape sequences. */
4134 pretty_print_string (pretty_printer
*pp
, const char *str
, unsigned n
)
4139 for ( ; n
; --n
, ++str
)
4144 pp_string (pp
, "\\b");
4148 pp_string (pp
, "\\f");
4152 pp_string (pp
, "\\n");
4156 pp_string (pp
, "\\r");
4160 pp_string (pp
, "\\t");
4164 pp_string (pp
, "\\v");
4168 pp_string (pp
, "\\\\");
4172 pp_string (pp
, "\\\"");
4176 pp_string (pp
, "\\'");
4180 if (str
[0] || n
> 1)
4182 if (!ISPRINT (str
[0]))
4185 sprintf (buf
, "\\x%02x", (unsigned char)str
[0]);
4186 pp_string (pp
, buf
);
4189 pp_character (pp
, str
[0]);
4197 maybe_init_pretty_print (FILE *file
)
4201 tree_pp
= new pretty_printer ();
4202 pp_needs_newline (tree_pp
) = true;
4203 pp_translate_identifiers (tree_pp
) = false;
4206 tree_pp
->buffer
->stream
= file
;
4210 newline_and_indent (pretty_printer
*pp
, int spc
)
4216 /* Handle the %K format for TEXT. Separate from default_tree_printer
4217 so it can also be used in front ends.
4218 The location LOC and BLOCK are expected to be extracted by the caller
4219 from the %K argument arg via EXPR_LOCATION(arg) and TREE_BLOCK(arg). */
4222 percent_K_format (text_info
*text
, location_t loc
, tree block
)
4224 text
->set_location (0, loc
, SHOW_RANGE_WITH_CARET
);
4225 gcc_assert (pp_ti_abstract_origin (text
) != NULL
);
4226 *pp_ti_abstract_origin (text
) = NULL
;
4229 && TREE_CODE (block
) == BLOCK
4230 && BLOCK_ABSTRACT_ORIGIN (block
))
4232 tree ao
= BLOCK_ABSTRACT_ORIGIN (block
);
4233 if (TREE_CODE (ao
) == FUNCTION_DECL
)
4235 *pp_ti_abstract_origin (text
) = block
;
4238 block
= BLOCK_SUPERCONTEXT (block
);
4242 /* Print the identifier ID to PRETTY-PRINTER. */
4245 pp_tree_identifier (pretty_printer
*pp
, tree id
)
4247 if (pp_translate_identifiers (pp
))
4249 const char *text
= identifier_to_locale (IDENTIFIER_POINTER (id
));
4250 pp_append_text (pp
, text
, text
+ strlen (text
));
4253 pp_append_text (pp
, IDENTIFIER_POINTER (id
),
4254 IDENTIFIER_POINTER (id
) + IDENTIFIER_LENGTH (id
));
4257 /* A helper function that is used to dump function information before the
4261 dump_function_header (FILE *dump_file
, tree fdecl
, dump_flags_t flags
)
4263 const char *dname
, *aname
;
4264 struct cgraph_node
*node
= cgraph_node::get (fdecl
);
4265 struct function
*fun
= DECL_STRUCT_FUNCTION (fdecl
);
4267 dname
= lang_hooks
.decl_printable_name (fdecl
, 1);
4269 if (DECL_ASSEMBLER_NAME_SET_P (fdecl
))
4270 aname
= (IDENTIFIER_POINTER
4271 (DECL_ASSEMBLER_NAME (fdecl
)));
4273 aname
= "<unset-asm-name>";
4275 fprintf (dump_file
, "\n;; Function %s (%s, funcdef_no=%d",
4276 dname
, aname
, fun
->funcdef_no
);
4277 if (!(flags
& TDF_NOUID
))
4278 fprintf (dump_file
, ", decl_uid=%d", DECL_UID (fdecl
));
4281 fprintf (dump_file
, ", cgraph_uid=%d", node
->get_uid ());
4282 fprintf (dump_file
, ", symbol_order=%d)%s\n\n", node
->order
,
4283 node
->frequency
== NODE_FREQUENCY_HOT
4285 : node
->frequency
== NODE_FREQUENCY_UNLIKELY_EXECUTED
4286 ? " (unlikely executed)"
4287 : node
->frequency
== NODE_FREQUENCY_EXECUTED_ONCE
4288 ? " (executed once)"
4292 fprintf (dump_file
, ")\n\n");
4295 /* Dump double_int D to pretty_printer PP. UNS is true
4296 if D is unsigned and false otherwise. */
4298 pp_double_int (pretty_printer
*pp
, double_int d
, bool uns
)
4301 pp_wide_integer (pp
, d
.low
);
4302 else if (d
.fits_uhwi ())
4303 pp_unsigned_wide_integer (pp
, d
.low
);
4306 unsigned HOST_WIDE_INT low
= d
.low
;
4307 HOST_WIDE_INT high
= d
.high
;
4308 if (!uns
&& d
.is_negative ())
4311 high
= ~high
+ !low
;
4314 /* Would "%x%0*x" or "%x%*0x" get zero-padding on all
4316 sprintf (pp_buffer (pp
)->digit_buffer
,
4317 HOST_WIDE_INT_PRINT_DOUBLE_HEX
,
4318 (unsigned HOST_WIDE_INT
) high
, low
);
4319 pp_string (pp
, pp_buffer (pp
)->digit_buffer
);
4324 # pragma GCC diagnostic pop