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_USE_DEVICE_ADDR
:
469 name
= "use_device_addr";
471 case OMP_CLAUSE_IS_DEVICE_PTR
:
472 name
= "is_device_ptr";
474 case OMP_CLAUSE_INCLUSIVE
:
477 case OMP_CLAUSE_EXCLUSIVE
:
480 case OMP_CLAUSE__LOOPTEMP_
:
483 case OMP_CLAUSE__REDUCTEMP_
:
484 name
= "_reductemp_";
486 case OMP_CLAUSE__CONDTEMP_
:
489 case OMP_CLAUSE__SCANTEMP_
:
492 case OMP_CLAUSE_TO_DECLARE
:
495 case OMP_CLAUSE_LINK
:
498 case OMP_CLAUSE_NONTEMPORAL
:
499 name
= "nontemporal";
502 pp_string (pp
, name
);
504 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
509 case OMP_CLAUSE_TASK_REDUCTION
:
510 case OMP_CLAUSE_IN_REDUCTION
:
511 pp_string (pp
, OMP_CLAUSE_CODE (clause
) == OMP_CLAUSE_IN_REDUCTION
514 case OMP_CLAUSE_REDUCTION
:
515 pp_string (pp
, "reduction(");
516 if (OMP_CLAUSE_CODE (clause
) == OMP_CLAUSE_REDUCTION
)
518 if (OMP_CLAUSE_REDUCTION_TASK (clause
))
519 pp_string (pp
, "task,");
520 else if (OMP_CLAUSE_REDUCTION_INSCAN (clause
))
521 pp_string (pp
, "inscan,");
523 if (OMP_CLAUSE_REDUCTION_CODE (clause
) != ERROR_MARK
)
526 op_symbol_code (OMP_CLAUSE_REDUCTION_CODE (clause
)));
529 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
535 pp_string (pp
, "if(");
536 switch (OMP_CLAUSE_IF_MODIFIER (clause
))
538 case ERROR_MARK
: break;
539 case VOID_CST
: pp_string (pp
, "cancel:"); break;
540 case OMP_PARALLEL
: pp_string (pp
, "parallel:"); break;
541 case OMP_SIMD
: pp_string (pp
, "simd:"); break;
542 case OMP_TASK
: pp_string (pp
, "task:"); break;
543 case OMP_TASKLOOP
: pp_string (pp
, "taskloop:"); break;
544 case OMP_TARGET_DATA
: pp_string (pp
, "target data:"); break;
545 case OMP_TARGET
: pp_string (pp
, "target:"); break;
546 case OMP_TARGET_UPDATE
: pp_string (pp
, "target update:"); break;
547 case OMP_TARGET_ENTER_DATA
:
548 pp_string (pp
, "target enter data:"); break;
549 case OMP_TARGET_EXIT_DATA
: pp_string (pp
, "target exit data:"); break;
550 default: gcc_unreachable ();
552 dump_generic_node (pp
, OMP_CLAUSE_IF_EXPR (clause
),
557 case OMP_CLAUSE_NUM_THREADS
:
558 pp_string (pp
, "num_threads(");
559 dump_generic_node (pp
, OMP_CLAUSE_NUM_THREADS_EXPR (clause
),
564 case OMP_CLAUSE_NOWAIT
:
565 pp_string (pp
, "nowait");
567 case OMP_CLAUSE_ORDERED
:
568 pp_string (pp
, "ordered");
569 if (OMP_CLAUSE_ORDERED_EXPR (clause
))
572 dump_generic_node (pp
, OMP_CLAUSE_ORDERED_EXPR (clause
),
578 case OMP_CLAUSE_DEFAULT
:
579 pp_string (pp
, "default(");
580 switch (OMP_CLAUSE_DEFAULT_KIND (clause
))
582 case OMP_CLAUSE_DEFAULT_UNSPECIFIED
:
584 case OMP_CLAUSE_DEFAULT_SHARED
:
585 pp_string (pp
, "shared");
587 case OMP_CLAUSE_DEFAULT_NONE
:
588 pp_string (pp
, "none");
590 case OMP_CLAUSE_DEFAULT_PRIVATE
:
591 pp_string (pp
, "private");
593 case OMP_CLAUSE_DEFAULT_FIRSTPRIVATE
:
594 pp_string (pp
, "firstprivate");
596 case OMP_CLAUSE_DEFAULT_PRESENT
:
597 pp_string (pp
, "present");
605 case OMP_CLAUSE_SCHEDULE
:
606 pp_string (pp
, "schedule(");
607 if (OMP_CLAUSE_SCHEDULE_KIND (clause
)
608 & (OMP_CLAUSE_SCHEDULE_MONOTONIC
609 | OMP_CLAUSE_SCHEDULE_NONMONOTONIC
))
611 if (OMP_CLAUSE_SCHEDULE_KIND (clause
)
612 & OMP_CLAUSE_SCHEDULE_MONOTONIC
)
613 pp_string (pp
, "monotonic");
615 pp_string (pp
, "nonmonotonic");
616 if (OMP_CLAUSE_SCHEDULE_SIMD (clause
))
621 if (OMP_CLAUSE_SCHEDULE_SIMD (clause
))
622 pp_string (pp
, "simd:");
624 switch (OMP_CLAUSE_SCHEDULE_KIND (clause
) & OMP_CLAUSE_SCHEDULE_MASK
)
626 case OMP_CLAUSE_SCHEDULE_STATIC
:
627 pp_string (pp
, "static");
629 case OMP_CLAUSE_SCHEDULE_DYNAMIC
:
630 pp_string (pp
, "dynamic");
632 case OMP_CLAUSE_SCHEDULE_GUIDED
:
633 pp_string (pp
, "guided");
635 case OMP_CLAUSE_SCHEDULE_RUNTIME
:
636 pp_string (pp
, "runtime");
638 case OMP_CLAUSE_SCHEDULE_AUTO
:
639 pp_string (pp
, "auto");
644 if (OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (clause
))
647 dump_generic_node (pp
, OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (clause
),
653 case OMP_CLAUSE_UNTIED
:
654 pp_string (pp
, "untied");
657 case OMP_CLAUSE_COLLAPSE
:
658 pp_string (pp
, "collapse(");
659 dump_generic_node (pp
, OMP_CLAUSE_COLLAPSE_EXPR (clause
),
664 case OMP_CLAUSE_FINAL
:
665 pp_string (pp
, "final(");
666 dump_generic_node (pp
, OMP_CLAUSE_FINAL_EXPR (clause
),
671 case OMP_CLAUSE_MERGEABLE
:
672 pp_string (pp
, "mergeable");
675 case OMP_CLAUSE_LINEAR
:
676 pp_string (pp
, "linear(");
677 switch (OMP_CLAUSE_LINEAR_KIND (clause
))
679 case OMP_CLAUSE_LINEAR_DEFAULT
:
681 case OMP_CLAUSE_LINEAR_REF
:
682 pp_string (pp
, "ref(");
684 case OMP_CLAUSE_LINEAR_VAL
:
685 pp_string (pp
, "val(");
687 case OMP_CLAUSE_LINEAR_UVAL
:
688 pp_string (pp
, "uval(");
693 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
695 if (OMP_CLAUSE_LINEAR_KIND (clause
) != OMP_CLAUSE_LINEAR_DEFAULT
)
698 dump_generic_node (pp
, OMP_CLAUSE_LINEAR_STEP (clause
),
703 case OMP_CLAUSE_ALIGNED
:
704 pp_string (pp
, "aligned(");
705 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
707 if (OMP_CLAUSE_ALIGNED_ALIGNMENT (clause
))
710 dump_generic_node (pp
, OMP_CLAUSE_ALIGNED_ALIGNMENT (clause
),
716 case OMP_CLAUSE_DEPEND
:
717 pp_string (pp
, "depend(");
718 switch (OMP_CLAUSE_DEPEND_KIND (clause
))
720 case OMP_CLAUSE_DEPEND_DEPOBJ
:
723 case OMP_CLAUSE_DEPEND_IN
:
726 case OMP_CLAUSE_DEPEND_OUT
:
729 case OMP_CLAUSE_DEPEND_INOUT
:
732 case OMP_CLAUSE_DEPEND_MUTEXINOUTSET
:
733 name
= "mutexinoutset";
735 case OMP_CLAUSE_DEPEND_SOURCE
:
736 pp_string (pp
, "source)");
738 case OMP_CLAUSE_DEPEND_LAST
:
739 name
= "__internal__";
741 case OMP_CLAUSE_DEPEND_SINK
:
742 pp_string (pp
, "sink:");
743 for (tree t
= OMP_CLAUSE_DECL (clause
); t
; t
= TREE_CHAIN (t
))
744 if (TREE_CODE (t
) == TREE_LIST
)
746 dump_generic_node (pp
, TREE_VALUE (t
), spc
, flags
, false);
747 if (TREE_PURPOSE (t
) != integer_zero_node
)
749 if (OMP_CLAUSE_DEPEND_SINK_NEGATIVE (t
))
753 dump_generic_node (pp
, TREE_PURPOSE (t
), spc
, flags
,
767 tree t
= OMP_CLAUSE_DECL (clause
);
768 if (TREE_CODE (t
) == TREE_LIST
770 && TREE_CODE (TREE_PURPOSE (t
)) == TREE_VEC
)
772 dump_omp_iterators (pp
, TREE_PURPOSE (t
), spc
, flags
);
776 pp_string (pp
, name
);
778 dump_generic_node (pp
, t
, spc
, flags
, false);
784 pp_string (pp
, "map(");
785 switch (OMP_CLAUSE_MAP_KIND (clause
))
788 case GOMP_MAP_POINTER
:
789 pp_string (pp
, "alloc");
791 case GOMP_MAP_IF_PRESENT
:
792 pp_string (pp
, "no_alloc");
795 case GOMP_MAP_TO_PSET
:
796 pp_string (pp
, "to");
799 pp_string (pp
, "from");
801 case GOMP_MAP_TOFROM
:
802 pp_string (pp
, "tofrom");
804 case GOMP_MAP_FORCE_ALLOC
:
805 pp_string (pp
, "force_alloc");
807 case GOMP_MAP_FORCE_TO
:
808 pp_string (pp
, "force_to");
810 case GOMP_MAP_FORCE_FROM
:
811 pp_string (pp
, "force_from");
813 case GOMP_MAP_FORCE_TOFROM
:
814 pp_string (pp
, "force_tofrom");
816 case GOMP_MAP_FORCE_PRESENT
:
817 pp_string (pp
, "force_present");
819 case GOMP_MAP_DELETE
:
820 pp_string (pp
, "delete");
822 case GOMP_MAP_FORCE_DEVICEPTR
:
823 pp_string (pp
, "force_deviceptr");
825 case GOMP_MAP_ALWAYS_TO
:
826 pp_string (pp
, "always,to");
828 case GOMP_MAP_ALWAYS_FROM
:
829 pp_string (pp
, "always,from");
831 case GOMP_MAP_ALWAYS_TOFROM
:
832 pp_string (pp
, "always,tofrom");
834 case GOMP_MAP_RELEASE
:
835 pp_string (pp
, "release");
837 case GOMP_MAP_FIRSTPRIVATE_POINTER
:
838 pp_string (pp
, "firstprivate");
840 case GOMP_MAP_FIRSTPRIVATE_REFERENCE
:
841 pp_string (pp
, "firstprivate ref");
843 case GOMP_MAP_STRUCT
:
844 pp_string (pp
, "struct");
846 case GOMP_MAP_ALWAYS_POINTER
:
847 pp_string (pp
, "always_pointer");
849 case GOMP_MAP_DEVICE_RESIDENT
:
850 pp_string (pp
, "device_resident");
853 pp_string (pp
, "link");
855 case GOMP_MAP_ATTACH
:
856 pp_string (pp
, "attach");
858 case GOMP_MAP_DETACH
:
859 pp_string (pp
, "detach");
861 case GOMP_MAP_FORCE_DETACH
:
862 pp_string (pp
, "force_detach");
864 case GOMP_MAP_ATTACH_DETACH
:
865 pp_string (pp
, "attach_detach");
871 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
874 if (OMP_CLAUSE_SIZE (clause
))
876 switch (OMP_CLAUSE_CODE (clause
) == OMP_CLAUSE_MAP
877 ? OMP_CLAUSE_MAP_KIND (clause
) : GOMP_MAP_TO
)
879 case GOMP_MAP_POINTER
:
880 case GOMP_MAP_FIRSTPRIVATE_POINTER
:
881 case GOMP_MAP_FIRSTPRIVATE_REFERENCE
:
882 case GOMP_MAP_ALWAYS_POINTER
:
883 pp_string (pp
, " [pointer assign, bias: ");
885 case GOMP_MAP_TO_PSET
:
886 pp_string (pp
, " [pointer set, len: ");
888 case GOMP_MAP_ATTACH
:
889 case GOMP_MAP_DETACH
:
890 case GOMP_MAP_FORCE_DETACH
:
891 case GOMP_MAP_ATTACH_DETACH
:
892 pp_string (pp
, " [bias: ");
895 pp_string (pp
, " [len: ");
898 dump_generic_node (pp
, OMP_CLAUSE_SIZE (clause
),
900 pp_right_bracket (pp
);
905 case OMP_CLAUSE_FROM
:
906 pp_string (pp
, "from(");
907 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
909 goto print_clause_size
;
912 pp_string (pp
, "to(");
913 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
915 goto print_clause_size
;
917 case OMP_CLAUSE__CACHE_
:
919 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
921 goto print_clause_size
;
923 case OMP_CLAUSE_NUM_TEAMS
:
924 pp_string (pp
, "num_teams(");
925 dump_generic_node (pp
, OMP_CLAUSE_NUM_TEAMS_EXPR (clause
),
930 case OMP_CLAUSE_THREAD_LIMIT
:
931 pp_string (pp
, "thread_limit(");
932 dump_generic_node (pp
, OMP_CLAUSE_THREAD_LIMIT_EXPR (clause
),
937 case OMP_CLAUSE_DEVICE
:
938 pp_string (pp
, "device(");
939 dump_generic_node (pp
, OMP_CLAUSE_DEVICE_ID (clause
),
944 case OMP_CLAUSE_DIST_SCHEDULE
:
945 pp_string (pp
, "dist_schedule(static");
946 if (OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR (clause
))
949 dump_generic_node (pp
,
950 OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR (clause
),
956 case OMP_CLAUSE_PROC_BIND
:
957 pp_string (pp
, "proc_bind(");
958 switch (OMP_CLAUSE_PROC_BIND_KIND (clause
))
960 case OMP_CLAUSE_PROC_BIND_MASTER
:
961 pp_string (pp
, "master");
963 case OMP_CLAUSE_PROC_BIND_CLOSE
:
964 pp_string (pp
, "close");
966 case OMP_CLAUSE_PROC_BIND_SPREAD
:
967 pp_string (pp
, "spread");
975 case OMP_CLAUSE_DEVICE_TYPE
:
976 pp_string (pp
, "device_type(");
977 switch (OMP_CLAUSE_DEVICE_TYPE_KIND (clause
))
979 case OMP_CLAUSE_DEVICE_TYPE_HOST
:
980 pp_string (pp
, "host");
982 case OMP_CLAUSE_DEVICE_TYPE_NOHOST
:
983 pp_string (pp
, "nohost");
985 case OMP_CLAUSE_DEVICE_TYPE_ANY
:
986 pp_string (pp
, "any");
994 case OMP_CLAUSE_SAFELEN
:
995 pp_string (pp
, "safelen(");
996 dump_generic_node (pp
, OMP_CLAUSE_SAFELEN_EXPR (clause
),
1001 case OMP_CLAUSE_SIMDLEN
:
1002 pp_string (pp
, "simdlen(");
1003 dump_generic_node (pp
, OMP_CLAUSE_SIMDLEN_EXPR (clause
),
1005 pp_right_paren (pp
);
1008 case OMP_CLAUSE_PRIORITY
:
1009 pp_string (pp
, "priority(");
1010 dump_generic_node (pp
, OMP_CLAUSE_PRIORITY_EXPR (clause
),
1012 pp_right_paren (pp
);
1015 case OMP_CLAUSE_GRAINSIZE
:
1016 pp_string (pp
, "grainsize(");
1017 dump_generic_node (pp
, OMP_CLAUSE_GRAINSIZE_EXPR (clause
),
1019 pp_right_paren (pp
);
1022 case OMP_CLAUSE_NUM_TASKS
:
1023 pp_string (pp
, "num_tasks(");
1024 dump_generic_node (pp
, OMP_CLAUSE_NUM_TASKS_EXPR (clause
),
1026 pp_right_paren (pp
);
1029 case OMP_CLAUSE_HINT
:
1030 pp_string (pp
, "hint(");
1031 dump_generic_node (pp
, OMP_CLAUSE_HINT_EXPR (clause
),
1033 pp_right_paren (pp
);
1036 case OMP_CLAUSE_DEFAULTMAP
:
1037 pp_string (pp
, "defaultmap(");
1038 switch (OMP_CLAUSE_DEFAULTMAP_BEHAVIOR (clause
))
1040 case OMP_CLAUSE_DEFAULTMAP_ALLOC
:
1041 pp_string (pp
, "alloc");
1043 case OMP_CLAUSE_DEFAULTMAP_TO
:
1044 pp_string (pp
, "to");
1046 case OMP_CLAUSE_DEFAULTMAP_FROM
:
1047 pp_string (pp
, "from");
1049 case OMP_CLAUSE_DEFAULTMAP_TOFROM
:
1050 pp_string (pp
, "tofrom");
1052 case OMP_CLAUSE_DEFAULTMAP_FIRSTPRIVATE
:
1053 pp_string (pp
, "firstprivate");
1055 case OMP_CLAUSE_DEFAULTMAP_NONE
:
1056 pp_string (pp
, "none");
1058 case OMP_CLAUSE_DEFAULTMAP_DEFAULT
:
1059 pp_string (pp
, "default");
1064 switch (OMP_CLAUSE_DEFAULTMAP_CATEGORY (clause
))
1066 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_UNSPECIFIED
:
1068 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_SCALAR
:
1069 pp_string (pp
, ":scalar");
1071 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_AGGREGATE
:
1072 pp_string (pp
, ":aggregate");
1074 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_ALLOCATABLE
:
1075 pp_string (pp
, ":allocatable");
1077 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_POINTER
:
1078 pp_string (pp
, ":pointer");
1083 pp_right_paren (pp
);
1086 case OMP_CLAUSE_ORDER
:
1087 pp_string (pp
, "order(concurrent)");
1090 case OMP_CLAUSE_BIND
:
1091 pp_string (pp
, "bind(");
1092 switch (OMP_CLAUSE_BIND_KIND (clause
))
1094 case OMP_CLAUSE_BIND_TEAMS
:
1095 pp_string (pp
, "teams");
1097 case OMP_CLAUSE_BIND_PARALLEL
:
1098 pp_string (pp
, "parallel");
1100 case OMP_CLAUSE_BIND_THREAD
:
1101 pp_string (pp
, "thread");
1106 pp_right_paren (pp
);
1109 case OMP_CLAUSE__SIMDUID_
:
1110 pp_string (pp
, "_simduid_(");
1111 dump_generic_node (pp
, OMP_CLAUSE__SIMDUID__DECL (clause
),
1113 pp_right_paren (pp
);
1116 case OMP_CLAUSE__SIMT_
:
1117 pp_string (pp
, "_simt_");
1120 case OMP_CLAUSE_GANG
:
1121 pp_string (pp
, "gang");
1122 if (OMP_CLAUSE_GANG_EXPR (clause
) != NULL_TREE
)
1124 pp_string (pp
, "(num: ");
1125 dump_generic_node (pp
, OMP_CLAUSE_GANG_EXPR (clause
),
1128 if (OMP_CLAUSE_GANG_STATIC_EXPR (clause
) != NULL_TREE
)
1130 if (OMP_CLAUSE_GANG_EXPR (clause
) == NULL_TREE
)
1134 pp_string (pp
, "static:");
1135 if (OMP_CLAUSE_GANG_STATIC_EXPR (clause
)
1136 == integer_minus_one_node
)
1137 pp_character (pp
, '*');
1139 dump_generic_node (pp
, OMP_CLAUSE_GANG_STATIC_EXPR (clause
),
1142 if (OMP_CLAUSE_GANG_EXPR (clause
) != NULL_TREE
1143 || OMP_CLAUSE_GANG_STATIC_EXPR (clause
) != NULL_TREE
)
1144 pp_right_paren (pp
);
1147 case OMP_CLAUSE_ASYNC
:
1148 pp_string (pp
, "async");
1149 if (OMP_CLAUSE_ASYNC_EXPR (clause
))
1151 pp_character(pp
, '(');
1152 dump_generic_node (pp
, OMP_CLAUSE_ASYNC_EXPR (clause
),
1154 pp_character(pp
, ')');
1158 case OMP_CLAUSE_AUTO
:
1159 case OMP_CLAUSE_SEQ
:
1160 pp_string (pp
, omp_clause_code_name
[OMP_CLAUSE_CODE (clause
)]);
1163 case OMP_CLAUSE_WAIT
:
1164 pp_string (pp
, "wait(");
1165 dump_generic_node (pp
, OMP_CLAUSE_WAIT_EXPR (clause
),
1167 pp_character(pp
, ')');
1170 case OMP_CLAUSE_WORKER
:
1171 pp_string (pp
, "worker");
1172 if (OMP_CLAUSE_WORKER_EXPR (clause
) != NULL_TREE
)
1175 dump_generic_node (pp
, OMP_CLAUSE_WORKER_EXPR (clause
),
1177 pp_right_paren (pp
);
1181 case OMP_CLAUSE_VECTOR
:
1182 pp_string (pp
, "vector");
1183 if (OMP_CLAUSE_VECTOR_EXPR (clause
) != NULL_TREE
)
1186 dump_generic_node (pp
, OMP_CLAUSE_VECTOR_EXPR (clause
),
1188 pp_right_paren (pp
);
1192 case OMP_CLAUSE_NUM_GANGS
:
1193 pp_string (pp
, "num_gangs(");
1194 dump_generic_node (pp
, OMP_CLAUSE_NUM_GANGS_EXPR (clause
),
1196 pp_character (pp
, ')');
1199 case OMP_CLAUSE_NUM_WORKERS
:
1200 pp_string (pp
, "num_workers(");
1201 dump_generic_node (pp
, OMP_CLAUSE_NUM_WORKERS_EXPR (clause
),
1203 pp_character (pp
, ')');
1206 case OMP_CLAUSE_VECTOR_LENGTH
:
1207 pp_string (pp
, "vector_length(");
1208 dump_generic_node (pp
, OMP_CLAUSE_VECTOR_LENGTH_EXPR (clause
),
1210 pp_character (pp
, ')');
1213 case OMP_CLAUSE_INBRANCH
:
1214 pp_string (pp
, "inbranch");
1216 case OMP_CLAUSE_NOTINBRANCH
:
1217 pp_string (pp
, "notinbranch");
1219 case OMP_CLAUSE_FOR
:
1220 pp_string (pp
, "for");
1222 case OMP_CLAUSE_PARALLEL
:
1223 pp_string (pp
, "parallel");
1225 case OMP_CLAUSE_SECTIONS
:
1226 pp_string (pp
, "sections");
1228 case OMP_CLAUSE_TASKGROUP
:
1229 pp_string (pp
, "taskgroup");
1231 case OMP_CLAUSE_NOGROUP
:
1232 pp_string (pp
, "nogroup");
1234 case OMP_CLAUSE_THREADS
:
1235 pp_string (pp
, "threads");
1237 case OMP_CLAUSE_SIMD
:
1238 pp_string (pp
, "simd");
1240 case OMP_CLAUSE_INDEPENDENT
:
1241 pp_string (pp
, "independent");
1243 case OMP_CLAUSE_TILE
:
1244 pp_string (pp
, "tile(");
1245 dump_generic_node (pp
, OMP_CLAUSE_TILE_LIST (clause
),
1247 pp_right_paren (pp
);
1250 case OMP_CLAUSE__GRIDDIM_
:
1251 pp_string (pp
, "_griddim_(");
1252 pp_unsigned_wide_integer (pp
, OMP_CLAUSE__GRIDDIM__DIMENSION (clause
));
1254 dump_generic_node (pp
, OMP_CLAUSE__GRIDDIM__SIZE (clause
), spc
, flags
,
1257 dump_generic_node (pp
, OMP_CLAUSE__GRIDDIM__GROUP (clause
), spc
, flags
,
1259 pp_right_paren (pp
);
1261 case OMP_CLAUSE_IF_PRESENT
:
1262 pp_string (pp
, "if_present");
1264 case OMP_CLAUSE_FINALIZE
:
1265 pp_string (pp
, "finalize");
1274 /* Dump the list of OpenMP clauses. PP, SPC and FLAGS are as in
1275 dump_generic_node. */
1278 dump_omp_clauses (pretty_printer
*pp
, tree clause
, int spc
, dump_flags_t flags
)
1286 dump_omp_clause (pp
, clause
, spc
, flags
);
1287 clause
= OMP_CLAUSE_CHAIN (clause
);
1295 /* Dump location LOC to PP. */
1298 dump_location (pretty_printer
*pp
, location_t loc
)
1300 expanded_location xloc
= expand_location (loc
);
1302 pp_left_bracket (pp
);
1305 pp_string (pp
, xloc
.file
);
1306 pp_string (pp
, ":");
1308 pp_decimal_int (pp
, xloc
.line
);
1310 pp_decimal_int (pp
, xloc
.column
);
1311 pp_string (pp
, "] ");
1315 /* Dump lexical block BLOCK. PP, SPC and FLAGS are as in
1316 dump_generic_node. */
1319 dump_block_node (pretty_printer
*pp
, tree block
, int spc
, dump_flags_t flags
)
1323 pp_printf (pp
, "BLOCK #%d ", BLOCK_NUMBER (block
));
1325 if (flags
& TDF_ADDRESS
)
1326 pp_printf (pp
, "[%p] ", (void *) block
);
1328 if (TREE_ASM_WRITTEN (block
))
1329 pp_string (pp
, "[written] ");
1331 if (flags
& TDF_SLIM
)
1334 if (BLOCK_SOURCE_LOCATION (block
))
1335 dump_location (pp
, BLOCK_SOURCE_LOCATION (block
));
1337 newline_and_indent (pp
, spc
+ 2);
1339 if (BLOCK_SUPERCONTEXT (block
))
1341 pp_string (pp
, "SUPERCONTEXT: ");
1342 dump_generic_node (pp
, BLOCK_SUPERCONTEXT (block
), 0,
1343 flags
| TDF_SLIM
, false);
1344 newline_and_indent (pp
, spc
+ 2);
1347 if (BLOCK_SUBBLOCKS (block
))
1349 pp_string (pp
, "SUBBLOCKS: ");
1350 for (t
= BLOCK_SUBBLOCKS (block
); t
; t
= BLOCK_CHAIN (t
))
1352 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
1355 newline_and_indent (pp
, spc
+ 2);
1358 if (BLOCK_CHAIN (block
))
1360 pp_string (pp
, "SIBLINGS: ");
1361 for (t
= BLOCK_CHAIN (block
); t
; t
= BLOCK_CHAIN (t
))
1363 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
1366 newline_and_indent (pp
, spc
+ 2);
1369 if (BLOCK_VARS (block
))
1371 pp_string (pp
, "VARS: ");
1372 for (t
= BLOCK_VARS (block
); t
; t
= TREE_CHAIN (t
))
1374 dump_generic_node (pp
, t
, 0, flags
, false);
1377 newline_and_indent (pp
, spc
+ 2);
1380 if (vec_safe_length (BLOCK_NONLOCALIZED_VARS (block
)) > 0)
1383 vec
<tree
, va_gc
> *nlv
= BLOCK_NONLOCALIZED_VARS (block
);
1385 pp_string (pp
, "NONLOCALIZED_VARS: ");
1386 FOR_EACH_VEC_ELT (*nlv
, i
, t
)
1388 dump_generic_node (pp
, t
, 0, flags
, false);
1391 newline_and_indent (pp
, spc
+ 2);
1394 if (BLOCK_ABSTRACT_ORIGIN (block
))
1396 pp_string (pp
, "ABSTRACT_ORIGIN: ");
1397 dump_generic_node (pp
, BLOCK_ABSTRACT_ORIGIN (block
), 0,
1398 flags
| TDF_SLIM
, false);
1399 newline_and_indent (pp
, spc
+ 2);
1402 if (BLOCK_FRAGMENT_ORIGIN (block
))
1404 pp_string (pp
, "FRAGMENT_ORIGIN: ");
1405 dump_generic_node (pp
, BLOCK_FRAGMENT_ORIGIN (block
), 0,
1406 flags
| TDF_SLIM
, false);
1407 newline_and_indent (pp
, spc
+ 2);
1410 if (BLOCK_FRAGMENT_CHAIN (block
))
1412 pp_string (pp
, "FRAGMENT_CHAIN: ");
1413 for (t
= BLOCK_FRAGMENT_CHAIN (block
); t
; t
= BLOCK_FRAGMENT_CHAIN (t
))
1415 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
1418 newline_and_indent (pp
, spc
+ 2);
1422 /* Dump #pragma omp atomic memory order clause. */
1425 dump_omp_atomic_memory_order (pretty_printer
*pp
, enum omp_memory_order mo
)
1429 case OMP_MEMORY_ORDER_RELAXED
:
1430 pp_string (pp
, " relaxed");
1432 case OMP_MEMORY_ORDER_SEQ_CST
:
1433 pp_string (pp
, " seq_cst");
1435 case OMP_MEMORY_ORDER_ACQ_REL
:
1436 pp_string (pp
, " acq_rel");
1438 case OMP_MEMORY_ORDER_ACQUIRE
:
1439 pp_string (pp
, " acquire");
1441 case OMP_MEMORY_ORDER_RELEASE
:
1442 pp_string (pp
, " release");
1444 case OMP_MEMORY_ORDER_UNSPECIFIED
:
1451 /* Helper to dump a MEM_REF node. */
1454 dump_mem_ref (pretty_printer
*pp
, tree node
, int spc
, dump_flags_t flags
)
1456 if (flags
& TDF_GIMPLE
)
1458 pp_string (pp
, "__MEM <");
1459 dump_generic_node (pp
, TREE_TYPE (node
),
1460 spc
, flags
| TDF_SLIM
, false);
1461 if (TYPE_ALIGN (TREE_TYPE (node
))
1462 != TYPE_ALIGN (TYPE_MAIN_VARIANT (TREE_TYPE (node
))))
1464 pp_string (pp
, ", ");
1465 pp_decimal_int (pp
, TYPE_ALIGN (TREE_TYPE (node
)));
1468 pp_string (pp
, " (");
1469 if (TREE_TYPE (TREE_OPERAND (node
, 0))
1470 != TREE_TYPE (TREE_OPERAND (node
, 1)))
1473 dump_generic_node (pp
, TREE_TYPE (TREE_OPERAND (node
, 1)),
1474 spc
, flags
| TDF_SLIM
, false);
1475 pp_right_paren (pp
);
1477 dump_generic_node (pp
, TREE_OPERAND (node
, 0),
1478 spc
, flags
| TDF_SLIM
, false);
1479 if (! integer_zerop (TREE_OPERAND (node
, 1)))
1481 pp_string (pp
, " + ");
1482 dump_generic_node (pp
, TREE_OPERAND (node
, 1),
1483 spc
, flags
| TDF_SLIM
, false);
1485 pp_right_paren (pp
);
1487 else if (integer_zerop (TREE_OPERAND (node
, 1))
1488 /* Dump the types of INTEGER_CSTs explicitly, for we can't
1489 infer them and MEM_ATTR caching will share MEM_REFs
1490 with differently-typed op0s. */
1491 && TREE_CODE (TREE_OPERAND (node
, 0)) != INTEGER_CST
1492 /* Released SSA_NAMES have no TREE_TYPE. */
1493 && TREE_TYPE (TREE_OPERAND (node
, 0)) != NULL_TREE
1494 /* Same pointer types, but ignoring POINTER_TYPE vs.
1496 && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 0)))
1497 == TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 1))))
1498 && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (node
, 0)))
1499 == TYPE_MODE (TREE_TYPE (TREE_OPERAND (node
, 1))))
1500 && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node
, 0)))
1501 == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node
, 1))))
1502 /* Same value types ignoring qualifiers. */
1503 && (TYPE_MAIN_VARIANT (TREE_TYPE (node
))
1504 == TYPE_MAIN_VARIANT
1505 (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 1)))))
1506 && (!(flags
& TDF_ALIAS
)
1507 || MR_DEPENDENCE_CLIQUE (node
) == 0))
1509 if (TREE_CODE (TREE_OPERAND (node
, 0)) != ADDR_EXPR
)
1511 /* Enclose pointers to arrays in parentheses. */
1512 tree op0
= TREE_OPERAND (node
, 0);
1513 tree op0type
= TREE_TYPE (op0
);
1514 if (POINTER_TYPE_P (op0type
)
1515 && TREE_CODE (TREE_TYPE (op0type
)) == ARRAY_TYPE
)
1518 dump_generic_node (pp
, op0
, spc
, flags
, false);
1519 if (POINTER_TYPE_P (op0type
)
1520 && TREE_CODE (TREE_TYPE (op0type
)) == ARRAY_TYPE
)
1521 pp_right_paren (pp
);
1524 dump_generic_node (pp
,
1525 TREE_OPERAND (TREE_OPERAND (node
, 0), 0),
1530 pp_string (pp
, "MEM");
1532 tree nodetype
= TREE_TYPE (node
);
1533 tree op0
= TREE_OPERAND (node
, 0);
1534 tree op1
= TREE_OPERAND (node
, 1);
1535 tree op1type
= TYPE_MAIN_VARIANT (TREE_TYPE (op1
));
1537 tree op0size
= TYPE_SIZE (nodetype
);
1538 tree op1size
= TYPE_SIZE (TREE_TYPE (op1type
));
1540 if (!op0size
|| !op1size
1541 || !operand_equal_p (op0size
, op1size
, 0))
1543 pp_string (pp
, " <");
1544 /* If the size of the type of the operand is not the same
1545 as the size of the MEM_REF expression include the type
1546 of the latter similar to the TDF_GIMPLE output to make
1547 it clear how many bytes of memory are being accessed. */
1548 dump_generic_node (pp
, nodetype
, spc
, flags
| TDF_SLIM
, false);
1549 pp_string (pp
, "> ");
1552 pp_string (pp
, "[(");
1553 dump_generic_node (pp
, op1type
, spc
, flags
| TDF_SLIM
, false);
1554 pp_right_paren (pp
);
1555 dump_generic_node (pp
, op0
, spc
, flags
, false);
1556 if (!integer_zerop (op1
))
1557 if (!integer_zerop (TREE_OPERAND (node
, 1)))
1559 pp_string (pp
, " + ");
1560 dump_generic_node (pp
, op1
, spc
, flags
, false);
1562 if ((flags
& TDF_ALIAS
)
1563 && MR_DEPENDENCE_CLIQUE (node
) != 0)
1565 pp_string (pp
, " clique ");
1566 pp_unsigned_wide_integer (pp
, MR_DEPENDENCE_CLIQUE (node
));
1567 pp_string (pp
, " base ");
1568 pp_unsigned_wide_integer (pp
, MR_DEPENDENCE_BASE (node
));
1570 pp_right_bracket (pp
);
1574 /* Dump the node NODE on the pretty_printer PP, SPC spaces of
1575 indent. FLAGS specifies details to show in the dump (see TDF_* in
1576 dumpfile.h). If IS_STMT is true, the object printed is considered
1577 to be a statement and it is terminated by ';' if appropriate. */
1580 dump_generic_node (pretty_printer
*pp
, tree node
, int spc
, dump_flags_t flags
,
1587 enum tree_code code
;
1589 if (node
== NULL_TREE
)
1592 is_expr
= EXPR_P (node
);
1594 if (is_stmt
&& (flags
& TDF_STMTADDR
))
1595 pp_printf (pp
, "<&%p> ", (void *)node
);
1597 if ((flags
& TDF_LINENO
) && EXPR_HAS_LOCATION (node
))
1598 dump_location (pp
, EXPR_LOCATION (node
));
1600 code
= TREE_CODE (node
);
1604 pp_string (pp
, "<<< error >>>");
1607 case IDENTIFIER_NODE
:
1608 pp_tree_identifier (pp
, node
);
1612 while (node
&& node
!= error_mark_node
)
1614 if (TREE_PURPOSE (node
))
1616 dump_generic_node (pp
, TREE_PURPOSE (node
), spc
, flags
, false);
1619 dump_generic_node (pp
, TREE_VALUE (node
), spc
, flags
, false);
1620 node
= TREE_CHAIN (node
);
1621 if (node
&& TREE_CODE (node
) == TREE_LIST
)
1630 dump_generic_node (pp
, BINFO_TYPE (node
), spc
, flags
, false);
1636 if (TREE_VEC_LENGTH (node
) > 0)
1638 size_t len
= TREE_VEC_LENGTH (node
);
1639 for (i
= 0; i
< len
- 1; i
++)
1641 dump_generic_node (pp
, TREE_VEC_ELT (node
, i
), spc
, flags
,
1646 dump_generic_node (pp
, TREE_VEC_ELT (node
, len
- 1), spc
,
1655 case FIXED_POINT_TYPE
:
1661 unsigned int quals
= TYPE_QUALS (node
);
1662 enum tree_code_class tclass
;
1664 if (quals
& TYPE_QUAL_ATOMIC
)
1665 pp_string (pp
, "atomic ");
1666 if (quals
& TYPE_QUAL_CONST
)
1667 pp_string (pp
, "const ");
1668 else if (quals
& TYPE_QUAL_VOLATILE
)
1669 pp_string (pp
, "volatile ");
1670 else if (quals
& TYPE_QUAL_RESTRICT
)
1671 pp_string (pp
, "restrict ");
1673 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
1675 pp_string (pp
, "<address-space-");
1676 pp_decimal_int (pp
, TYPE_ADDR_SPACE (node
));
1677 pp_string (pp
, "> ");
1680 tclass
= TREE_CODE_CLASS (TREE_CODE (node
));
1682 if (tclass
== tcc_declaration
)
1684 if (DECL_NAME (node
))
1685 dump_decl_name (pp
, node
, flags
);
1687 pp_string (pp
, "<unnamed type decl>");
1689 else if (tclass
== tcc_type
)
1691 if (TYPE_NAME (node
))
1693 if (TREE_CODE (TYPE_NAME (node
)) == IDENTIFIER_NODE
)
1694 pp_tree_identifier (pp
, TYPE_NAME (node
));
1695 else if (TREE_CODE (TYPE_NAME (node
)) == TYPE_DECL
1696 && DECL_NAME (TYPE_NAME (node
)))
1697 dump_decl_name (pp
, TYPE_NAME (node
), flags
);
1699 pp_string (pp
, "<unnamed type>");
1701 else if (TREE_CODE (node
) == VECTOR_TYPE
)
1703 pp_string (pp
, "vector");
1705 pp_wide_integer (pp
, TYPE_VECTOR_SUBPARTS (node
));
1706 pp_string (pp
, ") ");
1707 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1709 else if (TREE_CODE (node
) == INTEGER_TYPE
)
1711 if (TYPE_PRECISION (node
) == CHAR_TYPE_SIZE
)
1712 pp_string (pp
, (TYPE_UNSIGNED (node
)
1715 else if (TYPE_PRECISION (node
) == SHORT_TYPE_SIZE
)
1716 pp_string (pp
, (TYPE_UNSIGNED (node
)
1719 else if (TYPE_PRECISION (node
) == INT_TYPE_SIZE
)
1720 pp_string (pp
, (TYPE_UNSIGNED (node
)
1723 else if (TYPE_PRECISION (node
) == LONG_TYPE_SIZE
)
1724 pp_string (pp
, (TYPE_UNSIGNED (node
)
1727 else if (TYPE_PRECISION (node
) == LONG_LONG_TYPE_SIZE
)
1728 pp_string (pp
, (TYPE_UNSIGNED (node
)
1729 ? "unsigned long long"
1730 : "signed long long"));
1731 else if (TYPE_PRECISION (node
) >= CHAR_TYPE_SIZE
1732 && pow2p_hwi (TYPE_PRECISION (node
)))
1734 pp_string (pp
, (TYPE_UNSIGNED (node
) ? "uint" : "int"));
1735 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1736 pp_string (pp
, "_t");
1740 pp_string (pp
, (TYPE_UNSIGNED (node
)
1741 ? "<unnamed-unsigned:"
1742 : "<unnamed-signed:"));
1743 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1747 else if (TREE_CODE (node
) == COMPLEX_TYPE
)
1749 pp_string (pp
, "__complex__ ");
1750 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1752 else if (TREE_CODE (node
) == REAL_TYPE
)
1754 pp_string (pp
, "<float:");
1755 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1758 else if (TREE_CODE (node
) == FIXED_POINT_TYPE
)
1760 pp_string (pp
, "<fixed-point-");
1761 pp_string (pp
, TYPE_SATURATING (node
) ? "sat:" : "nonsat:");
1762 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1765 else if (TREE_CODE (node
) == VOID_TYPE
)
1766 pp_string (pp
, "void");
1768 pp_string (pp
, "<unnamed type>");
1774 case REFERENCE_TYPE
:
1775 str
= (TREE_CODE (node
) == POINTER_TYPE
? "*" : "&");
1777 if (TREE_TYPE (node
) == NULL
)
1779 pp_string (pp
, str
);
1780 pp_string (pp
, "<null type>");
1782 else if (TREE_CODE (TREE_TYPE (node
)) == FUNCTION_TYPE
)
1784 tree fnode
= TREE_TYPE (node
);
1786 dump_generic_node (pp
, TREE_TYPE (fnode
), spc
, flags
, false);
1789 pp_string (pp
, str
);
1790 if (TYPE_IDENTIFIER (node
))
1791 dump_generic_node (pp
, TYPE_NAME (node
), spc
, flags
, false);
1792 else if (flags
& TDF_NOUID
)
1793 pp_printf (pp
, "<Txxxx>");
1795 pp_printf (pp
, "<T%x>", TYPE_UID (node
));
1797 pp_right_paren (pp
);
1798 dump_function_declaration (pp
, fnode
, spc
, flags
);
1802 unsigned int quals
= TYPE_QUALS (node
);
1804 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1806 pp_string (pp
, str
);
1808 if (quals
& TYPE_QUAL_CONST
)
1809 pp_string (pp
, " const");
1810 if (quals
& TYPE_QUAL_VOLATILE
)
1811 pp_string (pp
, " volatile");
1812 if (quals
& TYPE_QUAL_RESTRICT
)
1813 pp_string (pp
, " restrict");
1815 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
1817 pp_string (pp
, " <address-space-");
1818 pp_decimal_int (pp
, TYPE_ADDR_SPACE (node
));
1822 if (TYPE_REF_CAN_ALIAS_ALL (node
))
1823 pp_string (pp
, " {ref-all}");
1832 dump_mem_ref (pp
, node
, spc
, flags
);
1835 case TARGET_MEM_REF
:
1837 const char *sep
= "";
1840 pp_string (pp
, "MEM[");
1842 if (TREE_CODE (TMR_BASE (node
)) == ADDR_EXPR
)
1844 pp_string (pp
, sep
);
1846 pp_string (pp
, "symbol: ");
1847 dump_generic_node (pp
, TREE_OPERAND (TMR_BASE (node
), 0),
1852 pp_string (pp
, sep
);
1854 pp_string (pp
, "base: ");
1855 dump_generic_node (pp
, TMR_BASE (node
), spc
, flags
, false);
1857 tmp
= TMR_INDEX2 (node
);
1860 pp_string (pp
, sep
);
1862 pp_string (pp
, "base: ");
1863 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1865 tmp
= TMR_INDEX (node
);
1868 pp_string (pp
, sep
);
1870 pp_string (pp
, "index: ");
1871 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1873 tmp
= TMR_STEP (node
);
1876 pp_string (pp
, sep
);
1878 pp_string (pp
, "step: ");
1879 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1881 tmp
= TMR_OFFSET (node
);
1884 pp_string (pp
, sep
);
1886 pp_string (pp
, "offset: ");
1887 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1889 pp_right_bracket (pp
);
1897 /* Print the innermost component type. */
1898 for (tmp
= TREE_TYPE (node
); TREE_CODE (tmp
) == ARRAY_TYPE
;
1899 tmp
= TREE_TYPE (tmp
))
1901 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1903 /* Print the dimensions. */
1904 for (tmp
= node
; TREE_CODE (tmp
) == ARRAY_TYPE
; tmp
= TREE_TYPE (tmp
))
1905 dump_array_domain (pp
, TYPE_DOMAIN (tmp
), spc
, flags
);
1911 case QUAL_UNION_TYPE
:
1913 unsigned int quals
= TYPE_QUALS (node
);
1915 if (quals
& TYPE_QUAL_ATOMIC
)
1916 pp_string (pp
, "atomic ");
1917 if (quals
& TYPE_QUAL_CONST
)
1918 pp_string (pp
, "const ");
1919 if (quals
& TYPE_QUAL_VOLATILE
)
1920 pp_string (pp
, "volatile ");
1922 /* Print the name of the structure. */
1923 if (TREE_CODE (node
) == RECORD_TYPE
)
1924 pp_string (pp
, "struct ");
1925 else if (TREE_CODE (node
) == UNION_TYPE
)
1926 pp_string (pp
, "union ");
1928 if (TYPE_NAME (node
))
1929 dump_generic_node (pp
, TYPE_NAME (node
), spc
, flags
, false);
1930 else if (!(flags
& TDF_SLIM
))
1931 /* FIXME: If we eliminate the 'else' above and attempt
1932 to show the fields for named types, we may get stuck
1933 following a cycle of pointers to structs. The alleged
1934 self-reference check in print_struct_decl will not detect
1935 cycles involving more than one pointer or struct type. */
1936 print_struct_decl (pp
, node
, spc
, flags
);
1945 if (flags
& TDF_GIMPLE
1946 && (POINTER_TYPE_P (TREE_TYPE (node
))
1947 || (TYPE_PRECISION (TREE_TYPE (node
))
1948 < TYPE_PRECISION (integer_type_node
))
1949 || exact_log2 (TYPE_PRECISION (TREE_TYPE (node
))) == -1
1950 || tree_int_cst_sgn (node
) < 0))
1952 pp_string (pp
, "_Literal (");
1953 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1954 pp_string (pp
, ") ");
1956 if (TREE_CODE (TREE_TYPE (node
)) == POINTER_TYPE
1957 && ! (flags
& TDF_GIMPLE
))
1959 /* In the case of a pointer, one may want to divide by the
1960 size of the pointed-to type. Unfortunately, this not
1961 straightforward. The C front-end maps expressions
1966 in such a way that the two INTEGER_CST nodes for "5" have
1967 different values but identical types. In the latter
1968 case, the 5 is multiplied by sizeof (int) in c-common.c
1969 (pointer_int_sum) to convert it to a byte address, and
1970 yet the type of the node is left unchanged. Argh. What
1971 is consistent though is that the number value corresponds
1972 to bytes (UNITS) offset.
1974 NB: Neither of the following divisors can be trivially
1975 used to recover the original literal:
1977 TREE_INT_CST_LOW (TYPE_SIZE_UNIT (TREE_TYPE (node)))
1978 TYPE_PRECISION (TREE_TYPE (TREE_TYPE (node))) */
1979 pp_wide_integer (pp
, TREE_INT_CST_LOW (node
));
1980 pp_string (pp
, "B"); /* pseudo-unit */
1982 else if (tree_fits_shwi_p (node
))
1983 pp_wide_integer (pp
, tree_to_shwi (node
));
1984 else if (tree_fits_uhwi_p (node
))
1985 pp_unsigned_wide_integer (pp
, tree_to_uhwi (node
));
1988 wide_int val
= wi::to_wide (node
);
1990 if (wi::neg_p (val
, TYPE_SIGN (TREE_TYPE (node
))))
1995 print_hex (val
, pp_buffer (pp
)->digit_buffer
);
1996 pp_string (pp
, pp_buffer (pp
)->digit_buffer
);
1998 if ((flags
& TDF_GIMPLE
)
1999 && ! (POINTER_TYPE_P (TREE_TYPE (node
))
2000 || (TYPE_PRECISION (TREE_TYPE (node
))
2001 < TYPE_PRECISION (integer_type_node
))
2002 || exact_log2 (TYPE_PRECISION (TREE_TYPE (node
))) == -1))
2004 if (TYPE_UNSIGNED (TREE_TYPE (node
)))
2005 pp_character (pp
, 'u');
2006 if (TYPE_PRECISION (TREE_TYPE (node
))
2007 == TYPE_PRECISION (unsigned_type_node
))
2009 else if (TYPE_PRECISION (TREE_TYPE (node
))
2010 == TYPE_PRECISION (long_unsigned_type_node
))
2011 pp_character (pp
, 'l');
2012 else if (TYPE_PRECISION (TREE_TYPE (node
))
2013 == TYPE_PRECISION (long_long_unsigned_type_node
))
2014 pp_string (pp
, "ll");
2016 if (TREE_OVERFLOW (node
))
2017 pp_string (pp
, "(OVF)");
2021 pp_string (pp
, "POLY_INT_CST [");
2022 dump_generic_node (pp
, POLY_INT_CST_COEFF (node
, 0), spc
, flags
, false);
2023 for (unsigned int i
= 1; i
< NUM_POLY_INT_COEFFS
; ++i
)
2025 pp_string (pp
, ", ");
2026 dump_generic_node (pp
, POLY_INT_CST_COEFF (node
, i
),
2029 pp_string (pp
, "]");
2033 /* Code copied from print_node. */
2036 if (TREE_OVERFLOW (node
))
2037 pp_string (pp
, " overflow");
2039 d
= TREE_REAL_CST (node
);
2040 if (REAL_VALUE_ISINF (d
))
2041 pp_string (pp
, REAL_VALUE_NEGATIVE (d
) ? " -Inf" : " Inf");
2042 else if (REAL_VALUE_ISNAN (d
))
2043 pp_string (pp
, " Nan");
2047 real_to_decimal (string
, &d
, sizeof (string
), 0, 1);
2048 pp_string (pp
, string
);
2056 fixed_to_decimal (string
, TREE_FIXED_CST_PTR (node
), sizeof (string
));
2057 pp_string (pp
, string
);
2062 pp_string (pp
, "__complex__ (");
2063 dump_generic_node (pp
, TREE_REALPART (node
), spc
, flags
, false);
2064 pp_string (pp
, ", ");
2065 dump_generic_node (pp
, TREE_IMAGPART (node
), spc
, flags
, false);
2066 pp_right_paren (pp
);
2071 pp_string (pp
, "\"");
2072 if (unsigned nbytes
= TREE_STRING_LENGTH (node
))
2073 pretty_print_string (pp
, TREE_STRING_POINTER (node
), nbytes
);
2074 pp_string (pp
, "\"");
2081 pp_string (pp
, "{ ");
2082 unsigned HOST_WIDE_INT nunits
;
2083 if (!VECTOR_CST_NELTS (node
).is_constant (&nunits
))
2084 nunits
= vector_cst_encoded_nelts (node
);
2085 for (i
= 0; i
< nunits
; ++i
)
2088 pp_string (pp
, ", ");
2089 dump_generic_node (pp
, VECTOR_CST_ELT (node
, i
),
2092 if (!VECTOR_CST_NELTS (node
).is_constant ())
2093 pp_string (pp
, ", ...");
2094 pp_string (pp
, " }");
2100 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2102 if (TREE_CODE (node
) == METHOD_TYPE
)
2104 if (TYPE_METHOD_BASETYPE (node
))
2105 dump_generic_node (pp
, TYPE_NAME (TYPE_METHOD_BASETYPE (node
)),
2108 pp_string (pp
, "<null method basetype>");
2109 pp_colon_colon (pp
);
2111 if (TYPE_IDENTIFIER (node
))
2112 dump_generic_node (pp
, TYPE_NAME (node
), spc
, flags
, false);
2113 else if (TYPE_NAME (node
) && DECL_NAME (TYPE_NAME (node
)))
2114 dump_decl_name (pp
, TYPE_NAME (node
), flags
);
2115 else if (flags
& TDF_NOUID
)
2116 pp_printf (pp
, "<Txxxx>");
2118 pp_printf (pp
, "<T%x>", TYPE_UID (node
));
2119 dump_function_declaration (pp
, node
, spc
, flags
);
2124 dump_decl_name (pp
, node
, flags
);
2128 if (DECL_NAME (node
))
2129 dump_decl_name (pp
, node
, flags
);
2130 else if (LABEL_DECL_UID (node
) != -1)
2132 if (flags
& TDF_GIMPLE
)
2133 pp_printf (pp
, "L%d", (int) LABEL_DECL_UID (node
));
2135 pp_printf (pp
, "<L%d>", (int) LABEL_DECL_UID (node
));
2139 if (flags
& TDF_NOUID
)
2140 pp_string (pp
, "<D.xxxx>");
2143 if (flags
& TDF_GIMPLE
)
2144 pp_printf (pp
, "<D%u>", DECL_UID (node
));
2146 pp_printf (pp
, "<D.%u>", DECL_UID (node
));
2152 if (DECL_IS_BUILTIN (node
))
2154 /* Don't print the declaration of built-in types. */
2157 if (DECL_NAME (node
))
2158 dump_decl_name (pp
, node
, flags
);
2159 else if (TYPE_NAME (TREE_TYPE (node
)) != node
)
2161 pp_string (pp
, (TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
2162 ? "union" : "struct "));
2163 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2166 pp_string (pp
, "<anon>");
2172 case DEBUG_EXPR_DECL
:
2173 case NAMESPACE_DECL
:
2175 dump_decl_name (pp
, node
, flags
);
2179 pp_string (pp
, "<retval>");
2183 op0
= TREE_OPERAND (node
, 0);
2186 && (TREE_CODE (op0
) == INDIRECT_REF
2187 || (TREE_CODE (op0
) == MEM_REF
2188 && TREE_CODE (TREE_OPERAND (op0
, 0)) != ADDR_EXPR
2189 && integer_zerop (TREE_OPERAND (op0
, 1))
2190 /* Dump the types of INTEGER_CSTs explicitly, for we
2191 can't infer them and MEM_ATTR caching will share
2192 MEM_REFs with differently-typed op0s. */
2193 && TREE_CODE (TREE_OPERAND (op0
, 0)) != INTEGER_CST
2194 /* Released SSA_NAMES have no TREE_TYPE. */
2195 && TREE_TYPE (TREE_OPERAND (op0
, 0)) != NULL_TREE
2196 /* Same pointer types, but ignoring POINTER_TYPE vs.
2198 && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 0)))
2199 == TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 1))))
2200 && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0
, 0)))
2201 == TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0
, 1))))
2202 && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0
, 0)))
2203 == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0
, 1))))
2204 /* Same value types ignoring qualifiers. */
2205 && (TYPE_MAIN_VARIANT (TREE_TYPE (op0
))
2206 == TYPE_MAIN_VARIANT
2207 (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 1)))))
2208 && MR_DEPENDENCE_CLIQUE (op0
) == 0)))
2210 op0
= TREE_OPERAND (op0
, 0);
2213 if (op_prio (op0
) < op_prio (node
))
2215 dump_generic_node (pp
, op0
, spc
, flags
, false);
2216 if (op_prio (op0
) < op_prio (node
))
2217 pp_right_paren (pp
);
2218 pp_string (pp
, str
);
2219 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2220 op0
= component_ref_field_offset (node
);
2221 if (op0
&& TREE_CODE (op0
) != INTEGER_CST
)
2223 pp_string (pp
, "{off: ");
2224 dump_generic_node (pp
, op0
, spc
, flags
, false);
2225 pp_right_brace (pp
);
2230 if (flags
& TDF_GIMPLE
)
2232 pp_string (pp
, "__BIT_FIELD_REF <");
2233 dump_generic_node (pp
, TREE_TYPE (node
),
2234 spc
, flags
| TDF_SLIM
, false);
2235 if (TYPE_ALIGN (TREE_TYPE (node
))
2236 != TYPE_ALIGN (TYPE_MAIN_VARIANT (TREE_TYPE (node
))))
2238 pp_string (pp
, ", ");
2239 pp_decimal_int (pp
, TYPE_ALIGN (TREE_TYPE (node
)));
2242 pp_string (pp
, " (");
2243 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
,
2244 flags
| TDF_SLIM
, false);
2245 pp_string (pp
, ", ");
2246 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
,
2247 flags
| TDF_SLIM
, false);
2248 pp_string (pp
, ", ");
2249 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
,
2250 flags
| TDF_SLIM
, false);
2251 pp_right_paren (pp
);
2255 pp_string (pp
, "BIT_FIELD_REF <");
2256 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2257 pp_string (pp
, ", ");
2258 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2259 pp_string (pp
, ", ");
2260 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2265 case BIT_INSERT_EXPR
:
2266 pp_string (pp
, "BIT_INSERT_EXPR <");
2267 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2268 pp_string (pp
, ", ");
2269 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2270 pp_string (pp
, ", ");
2271 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2272 pp_string (pp
, " (");
2273 if (INTEGRAL_TYPE_P (TREE_TYPE (TREE_OPERAND (node
, 1))))
2275 TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (node
, 1))));
2277 dump_generic_node (pp
, TYPE_SIZE (TREE_TYPE (TREE_OPERAND (node
, 1))),
2279 pp_string (pp
, " bits)>");
2283 case ARRAY_RANGE_REF
:
2284 op0
= TREE_OPERAND (node
, 0);
2285 if (op_prio (op0
) < op_prio (node
))
2287 dump_generic_node (pp
, op0
, spc
, flags
, false);
2288 if (op_prio (op0
) < op_prio (node
))
2289 pp_right_paren (pp
);
2290 pp_left_bracket (pp
);
2291 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2292 if (TREE_CODE (node
) == ARRAY_RANGE_REF
)
2293 pp_string (pp
, " ...");
2294 pp_right_bracket (pp
);
2296 op0
= array_ref_low_bound (node
);
2297 op1
= array_ref_element_size (node
);
2299 if (!integer_zerop (op0
)
2300 || TREE_OPERAND (node
, 2)
2301 || TREE_OPERAND (node
, 3))
2303 pp_string (pp
, "{lb: ");
2304 dump_generic_node (pp
, op0
, spc
, flags
, false);
2305 pp_string (pp
, " sz: ");
2306 dump_generic_node (pp
, op1
, spc
, flags
, false);
2307 pp_right_brace (pp
);
2313 unsigned HOST_WIDE_INT ix
;
2315 bool is_struct_init
= false;
2316 bool is_array_init
= false;
2319 if (TREE_CLOBBER_P (node
))
2320 pp_string (pp
, "CLOBBER");
2321 else if (TREE_CODE (TREE_TYPE (node
)) == RECORD_TYPE
2322 || TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
)
2323 is_struct_init
= true;
2324 else if (TREE_CODE (TREE_TYPE (node
)) == ARRAY_TYPE
2325 && TYPE_DOMAIN (TREE_TYPE (node
))
2326 && TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
)))
2327 && TREE_CODE (TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
))))
2330 tree minv
= TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
)));
2331 is_array_init
= true;
2332 curidx
= wi::to_widest (minv
);
2334 FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (node
), ix
, field
, val
)
2341 dump_generic_node (pp
, field
, spc
, flags
, false);
2344 else if (is_array_init
2345 && (TREE_CODE (field
) != INTEGER_CST
2346 || curidx
!= wi::to_widest (field
)))
2348 pp_left_bracket (pp
);
2349 if (TREE_CODE (field
) == RANGE_EXPR
)
2351 dump_generic_node (pp
, TREE_OPERAND (field
, 0), spc
,
2353 pp_string (pp
, " ... ");
2354 dump_generic_node (pp
, TREE_OPERAND (field
, 1), spc
,
2356 if (TREE_CODE (TREE_OPERAND (field
, 1)) == INTEGER_CST
)
2357 curidx
= wi::to_widest (TREE_OPERAND (field
, 1));
2360 dump_generic_node (pp
, field
, spc
, flags
, false);
2361 if (TREE_CODE (field
) == INTEGER_CST
)
2362 curidx
= wi::to_widest (field
);
2363 pp_string (pp
, "]=");
2368 if (val
&& TREE_CODE (val
) == ADDR_EXPR
)
2369 if (TREE_CODE (TREE_OPERAND (val
, 0)) == FUNCTION_DECL
)
2370 val
= TREE_OPERAND (val
, 0);
2371 if (val
&& TREE_CODE (val
) == FUNCTION_DECL
)
2372 dump_decl_name (pp
, val
, flags
);
2374 dump_generic_node (pp
, val
, spc
, flags
, false);
2375 if (ix
!= CONSTRUCTOR_NELTS (node
) - 1)
2381 pp_right_brace (pp
);
2388 if (flags
& TDF_SLIM
)
2390 pp_string (pp
, "<COMPOUND_EXPR>");
2394 dump_generic_node (pp
, TREE_OPERAND (node
, 0),
2395 spc
, flags
, !(flags
& TDF_SLIM
));
2396 if (flags
& TDF_SLIM
)
2397 newline_and_indent (pp
, spc
);
2404 for (tp
= &TREE_OPERAND (node
, 1);
2405 TREE_CODE (*tp
) == COMPOUND_EXPR
;
2406 tp
= &TREE_OPERAND (*tp
, 1))
2408 dump_generic_node (pp
, TREE_OPERAND (*tp
, 0),
2409 spc
, flags
, !(flags
& TDF_SLIM
));
2410 if (flags
& TDF_SLIM
)
2411 newline_and_indent (pp
, spc
);
2419 dump_generic_node (pp
, *tp
, spc
, flags
, !(flags
& TDF_SLIM
));
2423 case STATEMENT_LIST
:
2425 tree_stmt_iterator si
;
2428 if (flags
& TDF_SLIM
)
2430 pp_string (pp
, "<STATEMENT_LIST>");
2434 for (si
= tsi_start (node
); !tsi_end_p (si
); tsi_next (&si
))
2437 newline_and_indent (pp
, spc
);
2440 dump_generic_node (pp
, tsi_stmt (si
), spc
, flags
, true);
2447 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
,
2452 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
,
2457 pp_string (pp
, "TARGET_EXPR <");
2458 dump_generic_node (pp
, TARGET_EXPR_SLOT (node
), spc
, flags
, false);
2461 dump_generic_node (pp
, TARGET_EXPR_INITIAL (node
), spc
, flags
, false);
2466 print_declaration (pp
, DECL_EXPR_DECL (node
), spc
, flags
);
2471 if (TREE_TYPE (node
) == NULL
|| TREE_TYPE (node
) == void_type_node
)
2473 pp_string (pp
, "if (");
2474 dump_generic_node (pp
, COND_EXPR_COND (node
), spc
, flags
, false);
2475 pp_right_paren (pp
);
2476 /* The lowered cond_exprs should always be printed in full. */
2477 if (COND_EXPR_THEN (node
)
2478 && (IS_EMPTY_STMT (COND_EXPR_THEN (node
))
2479 || TREE_CODE (COND_EXPR_THEN (node
)) == GOTO_EXPR
)
2480 && COND_EXPR_ELSE (node
)
2481 && (IS_EMPTY_STMT (COND_EXPR_ELSE (node
))
2482 || TREE_CODE (COND_EXPR_ELSE (node
)) == GOTO_EXPR
))
2485 dump_generic_node (pp
, COND_EXPR_THEN (node
),
2487 if (!IS_EMPTY_STMT (COND_EXPR_ELSE (node
)))
2489 pp_string (pp
, " else ");
2490 dump_generic_node (pp
, COND_EXPR_ELSE (node
),
2494 else if (!(flags
& TDF_SLIM
))
2496 /* Output COND_EXPR_THEN. */
2497 if (COND_EXPR_THEN (node
))
2499 newline_and_indent (pp
, spc
+2);
2501 newline_and_indent (pp
, spc
+4);
2502 dump_generic_node (pp
, COND_EXPR_THEN (node
), spc
+4,
2504 newline_and_indent (pp
, spc
+2);
2505 pp_right_brace (pp
);
2508 /* Output COND_EXPR_ELSE. */
2509 if (COND_EXPR_ELSE (node
)
2510 && !IS_EMPTY_STMT (COND_EXPR_ELSE (node
)))
2512 newline_and_indent (pp
, spc
);
2513 pp_string (pp
, "else");
2514 newline_and_indent (pp
, spc
+2);
2516 newline_and_indent (pp
, spc
+4);
2517 dump_generic_node (pp
, COND_EXPR_ELSE (node
), spc
+4,
2519 newline_and_indent (pp
, spc
+2);
2520 pp_right_brace (pp
);
2527 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2531 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2535 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2541 if (!(flags
& TDF_SLIM
))
2543 if (BIND_EXPR_VARS (node
))
2547 for (op0
= BIND_EXPR_VARS (node
); op0
; op0
= DECL_CHAIN (op0
))
2549 print_declaration (pp
, op0
, spc
+2, flags
);
2554 newline_and_indent (pp
, spc
+2);
2555 dump_generic_node (pp
, BIND_EXPR_BODY (node
), spc
+2, flags
, true);
2556 newline_and_indent (pp
, spc
);
2557 pp_right_brace (pp
);
2563 if (CALL_EXPR_FN (node
) != NULL_TREE
)
2564 print_call_name (pp
, CALL_EXPR_FN (node
), flags
);
2568 pp_string (pp
, internal_fn_name (CALL_EXPR_IFN (node
)));
2571 /* Print parameters. */
2576 call_expr_arg_iterator iter
;
2577 FOR_EACH_CALL_EXPR_ARG (arg
, iter
, node
)
2579 dump_generic_node (pp
, arg
, spc
, flags
, false);
2580 if (more_call_expr_args_p (&iter
))
2587 if (CALL_EXPR_VA_ARG_PACK (node
))
2589 if (call_expr_nargs (node
) > 0)
2594 pp_string (pp
, "__builtin_va_arg_pack ()");
2596 pp_right_paren (pp
);
2598 op1
= CALL_EXPR_STATIC_CHAIN (node
);
2601 pp_string (pp
, " [static-chain: ");
2602 dump_generic_node (pp
, op1
, spc
, flags
, false);
2603 pp_right_bracket (pp
);
2606 if (CALL_EXPR_RETURN_SLOT_OPT (node
))
2607 pp_string (pp
, " [return slot optimization]");
2608 if (CALL_EXPR_TAILCALL (node
))
2609 pp_string (pp
, " [tail call]");
2612 case WITH_CLEANUP_EXPR
:
2616 case CLEANUP_POINT_EXPR
:
2617 pp_string (pp
, "<<cleanup_point ");
2618 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2619 pp_string (pp
, ">>");
2622 case PLACEHOLDER_EXPR
:
2623 pp_string (pp
, "<PLACEHOLDER_EXPR ");
2624 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2628 /* Binary arithmetic and logic expressions. */
2629 case WIDEN_SUM_EXPR
:
2630 case WIDEN_MULT_EXPR
:
2632 case MULT_HIGHPART_EXPR
:
2634 case POINTER_PLUS_EXPR
:
2635 case POINTER_DIFF_EXPR
:
2637 case TRUNC_DIV_EXPR
:
2639 case FLOOR_DIV_EXPR
:
2640 case ROUND_DIV_EXPR
:
2641 case TRUNC_MOD_EXPR
:
2643 case FLOOR_MOD_EXPR
:
2644 case ROUND_MOD_EXPR
:
2646 case EXACT_DIV_EXPR
:
2651 case WIDEN_LSHIFT_EXPR
:
2655 case TRUTH_ANDIF_EXPR
:
2656 case TRUTH_ORIF_EXPR
:
2657 case TRUTH_AND_EXPR
:
2659 case TRUTH_XOR_EXPR
:
2673 case UNORDERED_EXPR
:
2675 const char *op
= op_symbol (node
);
2676 op0
= TREE_OPERAND (node
, 0);
2677 op1
= TREE_OPERAND (node
, 1);
2679 /* When the operands are expressions with less priority,
2680 keep semantics of the tree representation. */
2681 if (op_prio (op0
) <= op_prio (node
))
2684 dump_generic_node (pp
, op0
, spc
, flags
, false);
2685 pp_right_paren (pp
);
2688 dump_generic_node (pp
, op0
, spc
, flags
, false);
2694 /* When the operands are expressions with less priority,
2695 keep semantics of the tree representation. */
2696 if (op_prio (op1
) <= op_prio (node
))
2699 dump_generic_node (pp
, op1
, spc
, flags
, false);
2700 pp_right_paren (pp
);
2703 dump_generic_node (pp
, op1
, spc
, flags
, false);
2707 /* Unary arithmetic and logic expressions. */
2710 case TRUTH_NOT_EXPR
:
2712 case PREDECREMENT_EXPR
:
2713 case PREINCREMENT_EXPR
:
2715 if (TREE_CODE (node
) == ADDR_EXPR
2716 && (TREE_CODE (TREE_OPERAND (node
, 0)) == STRING_CST
2717 || TREE_CODE (TREE_OPERAND (node
, 0)) == FUNCTION_DECL
))
2718 ; /* Do not output '&' for strings and function pointers. */
2720 pp_string (pp
, op_symbol (node
));
2722 if (op_prio (TREE_OPERAND (node
, 0)) < op_prio (node
))
2725 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2726 pp_right_paren (pp
);
2729 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2732 case POSTDECREMENT_EXPR
:
2733 case POSTINCREMENT_EXPR
:
2734 if (op_prio (TREE_OPERAND (node
, 0)) < op_prio (node
))
2737 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2738 pp_right_paren (pp
);
2741 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2742 pp_string (pp
, op_symbol (node
));
2746 pp_string (pp
, "MIN_EXPR <");
2747 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2748 pp_string (pp
, ", ");
2749 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2754 pp_string (pp
, "MAX_EXPR <");
2755 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2756 pp_string (pp
, ", ");
2757 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2762 pp_string (pp
, "ABS_EXPR <");
2763 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2768 pp_string (pp
, "ABSU_EXPR <");
2769 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2777 case ADDR_SPACE_CONVERT_EXPR
:
2778 case FIXED_CONVERT_EXPR
:
2779 case FIX_TRUNC_EXPR
:
2782 type
= TREE_TYPE (node
);
2783 op0
= TREE_OPERAND (node
, 0);
2784 if (type
!= TREE_TYPE (op0
))
2787 dump_generic_node (pp
, type
, spc
, flags
, false);
2788 pp_string (pp
, ") ");
2790 if (op_prio (op0
) < op_prio (node
))
2792 dump_generic_node (pp
, op0
, spc
, flags
, false);
2793 if (op_prio (op0
) < op_prio (node
))
2794 pp_right_paren (pp
);
2797 case VIEW_CONVERT_EXPR
:
2798 if (flags
& TDF_GIMPLE
)
2799 pp_string (pp
, "__VIEW_CONVERT <");
2801 pp_string (pp
, "VIEW_CONVERT_EXPR<");
2802 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2803 pp_string (pp
, ">(");
2804 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2805 pp_right_paren (pp
);
2809 pp_string (pp
, "((");
2810 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2811 pp_string (pp
, "))");
2814 case NON_LVALUE_EXPR
:
2815 pp_string (pp
, "NON_LVALUE_EXPR <");
2816 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2821 pp_string (pp
, "SAVE_EXPR <");
2822 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2827 pp_string (pp
, "COMPLEX_EXPR <");
2828 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2829 pp_string (pp
, ", ");
2830 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2835 pp_string (pp
, "CONJ_EXPR <");
2836 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2841 if (flags
& TDF_GIMPLE
)
2843 pp_string (pp
, "__real ");
2844 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2848 pp_string (pp
, "REALPART_EXPR <");
2849 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2855 if (flags
& TDF_GIMPLE
)
2857 pp_string (pp
, "__imag ");
2858 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2862 pp_string (pp
, "IMAGPART_EXPR <");
2863 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2869 pp_string (pp
, "VA_ARG_EXPR <");
2870 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2874 case TRY_FINALLY_EXPR
:
2875 case TRY_CATCH_EXPR
:
2876 pp_string (pp
, "try");
2877 newline_and_indent (pp
, spc
+2);
2879 newline_and_indent (pp
, spc
+4);
2880 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
+4, flags
, true);
2881 newline_and_indent (pp
, spc
+2);
2882 pp_right_brace (pp
);
2883 newline_and_indent (pp
, spc
);
2884 if (TREE_CODE (node
) == TRY_CATCH_EXPR
)
2886 node
= TREE_OPERAND (node
, 1);
2887 pp_string (pp
, "catch");
2891 gcc_assert (TREE_CODE (node
) == TRY_FINALLY_EXPR
);
2892 node
= TREE_OPERAND (node
, 1);
2893 pp_string (pp
, "finally");
2894 if (TREE_CODE (node
) == EH_ELSE_EXPR
)
2896 newline_and_indent (pp
, spc
+2);
2898 newline_and_indent (pp
, spc
+4);
2899 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
+4,
2901 newline_and_indent (pp
, spc
+2);
2902 pp_right_brace (pp
);
2903 newline_and_indent (pp
, spc
);
2904 node
= TREE_OPERAND (node
, 1);
2905 pp_string (pp
, "else");
2908 newline_and_indent (pp
, spc
+2);
2910 newline_and_indent (pp
, spc
+4);
2911 dump_generic_node (pp
, node
, spc
+4, flags
, true);
2912 newline_and_indent (pp
, spc
+2);
2913 pp_right_brace (pp
);
2918 pp_string (pp
, "catch (");
2919 dump_generic_node (pp
, CATCH_TYPES (node
), spc
+2, flags
, false);
2920 pp_right_paren (pp
);
2921 newline_and_indent (pp
, spc
+2);
2923 newline_and_indent (pp
, spc
+4);
2924 dump_generic_node (pp
, CATCH_BODY (node
), spc
+4, flags
, true);
2925 newline_and_indent (pp
, spc
+2);
2926 pp_right_brace (pp
);
2930 case EH_FILTER_EXPR
:
2931 pp_string (pp
, "<<<eh_filter (");
2932 dump_generic_node (pp
, EH_FILTER_TYPES (node
), spc
+2, flags
, false);
2933 pp_string (pp
, ")>>>");
2934 newline_and_indent (pp
, spc
+2);
2936 newline_and_indent (pp
, spc
+4);
2937 dump_generic_node (pp
, EH_FILTER_FAILURE (node
), spc
+4, flags
, true);
2938 newline_and_indent (pp
, spc
+2);
2939 pp_right_brace (pp
);
2944 op0
= TREE_OPERAND (node
, 0);
2945 /* If this is for break or continue, don't bother printing it. */
2946 if (DECL_NAME (op0
))
2948 const char *name
= IDENTIFIER_POINTER (DECL_NAME (op0
));
2949 if (strcmp (name
, "break") == 0
2950 || strcmp (name
, "continue") == 0)
2953 dump_generic_node (pp
, op0
, spc
, flags
, false);
2955 if (DECL_NONLOCAL (op0
))
2956 pp_string (pp
, " [non-local]");
2960 pp_string (pp
, "while (1)");
2961 if (!(flags
& TDF_SLIM
))
2963 newline_and_indent (pp
, spc
+2);
2965 newline_and_indent (pp
, spc
+4);
2966 dump_generic_node (pp
, LOOP_EXPR_BODY (node
), spc
+4, flags
, true);
2967 newline_and_indent (pp
, spc
+2);
2968 pp_right_brace (pp
);
2974 pp_string (pp
, "// predicted ");
2975 if (PREDICT_EXPR_OUTCOME (node
))
2976 pp_string (pp
, "likely by ");
2978 pp_string (pp
, "unlikely by ");
2979 pp_string (pp
, predictor_name (PREDICT_EXPR_PREDICTOR (node
)));
2980 pp_string (pp
, " predictor.");
2984 pp_string (pp
, "ANNOTATE_EXPR <");
2985 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2986 switch ((enum annot_expr_kind
) TREE_INT_CST_LOW (TREE_OPERAND (node
, 1)))
2988 case annot_expr_ivdep_kind
:
2989 pp_string (pp
, ", ivdep");
2991 case annot_expr_unroll_kind
:
2992 pp_printf (pp
, ", unroll %d",
2993 (int) TREE_INT_CST_LOW (TREE_OPERAND (node
, 2)));
2995 case annot_expr_no_vector_kind
:
2996 pp_string (pp
, ", no-vector");
2998 case annot_expr_vector_kind
:
2999 pp_string (pp
, ", vector");
3001 case annot_expr_parallel_kind
:
3002 pp_string (pp
, ", parallel");
3011 pp_string (pp
, "return");
3012 op0
= TREE_OPERAND (node
, 0);
3016 if (TREE_CODE (op0
) == MODIFY_EXPR
)
3017 dump_generic_node (pp
, TREE_OPERAND (op0
, 1),
3020 dump_generic_node (pp
, op0
, spc
, flags
, false);
3025 pp_string (pp
, "if (");
3026 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3027 pp_string (pp
, ") break");
3031 pp_string (pp
, "switch (");
3032 dump_generic_node (pp
, SWITCH_COND (node
), spc
, flags
, false);
3033 pp_right_paren (pp
);
3034 if (!(flags
& TDF_SLIM
))
3036 newline_and_indent (pp
, spc
+2);
3038 if (SWITCH_BODY (node
))
3040 newline_and_indent (pp
, spc
+4);
3041 dump_generic_node (pp
, SWITCH_BODY (node
), spc
+4, flags
,
3044 newline_and_indent (pp
, spc
+2);
3045 pp_right_brace (pp
);
3051 op0
= GOTO_DESTINATION (node
);
3052 if (TREE_CODE (op0
) != SSA_NAME
&& DECL_P (op0
) && DECL_NAME (op0
))
3054 const char *name
= IDENTIFIER_POINTER (DECL_NAME (op0
));
3055 if (strcmp (name
, "break") == 0
3056 || strcmp (name
, "continue") == 0)
3058 pp_string (pp
, name
);
3062 pp_string (pp
, "goto ");
3063 dump_generic_node (pp
, op0
, spc
, flags
, false);
3067 pp_string (pp
, "__asm__");
3068 if (ASM_VOLATILE_P (node
))
3069 pp_string (pp
, " __volatile__");
3071 dump_generic_node (pp
, ASM_STRING (node
), spc
, flags
, false);
3073 dump_generic_node (pp
, ASM_OUTPUTS (node
), spc
, flags
, false);
3075 dump_generic_node (pp
, ASM_INPUTS (node
), spc
, flags
, false);
3076 if (ASM_CLOBBERS (node
))
3079 dump_generic_node (pp
, ASM_CLOBBERS (node
), spc
, flags
, false);
3081 pp_right_paren (pp
);
3084 case CASE_LABEL_EXPR
:
3085 if (CASE_LOW (node
) && CASE_HIGH (node
))
3087 pp_string (pp
, "case ");
3088 dump_generic_node (pp
, CASE_LOW (node
), spc
, flags
, false);
3089 pp_string (pp
, " ... ");
3090 dump_generic_node (pp
, CASE_HIGH (node
), spc
, flags
, false);
3092 else if (CASE_LOW (node
))
3094 pp_string (pp
, "case ");
3095 dump_generic_node (pp
, CASE_LOW (node
), spc
, flags
, false);
3098 pp_string (pp
, "default");
3103 pp_string (pp
, "OBJ_TYPE_REF(");
3104 dump_generic_node (pp
, OBJ_TYPE_REF_EXPR (node
), spc
, flags
, false);
3106 /* We omit the class type for -fcompare-debug because we may
3107 drop TYPE_BINFO early depending on debug info, and then
3108 virtual_method_call_p would return false, whereas when
3109 TYPE_BINFO is preserved it may still return true and then
3110 we'd print the class type. Compare tree and rtl dumps for
3111 libstdc++-prettyprinters/shared_ptr.cc with and without -g,
3112 for example, at occurrences of OBJ_TYPE_REF. */
3113 if (!(flags
& (TDF_SLIM
| TDF_COMPARE_DEBUG
))
3114 && virtual_method_call_p (node
))
3116 pp_string (pp
, "(");
3117 dump_generic_node (pp
, obj_type_ref_class (node
), spc
, flags
, false);
3118 pp_string (pp
, ")");
3120 dump_generic_node (pp
, OBJ_TYPE_REF_OBJECT (node
), spc
, flags
, false);
3122 dump_generic_node (pp
, OBJ_TYPE_REF_TOKEN (node
), spc
, flags
, false);
3123 pp_right_paren (pp
);
3127 if (SSA_NAME_IDENTIFIER (node
))
3129 if ((flags
& TDF_NOUID
)
3130 && SSA_NAME_VAR (node
)
3131 && DECL_NAMELESS (SSA_NAME_VAR (node
)))
3132 dump_fancy_name (pp
, SSA_NAME_IDENTIFIER (node
));
3133 else if (! (flags
& TDF_GIMPLE
)
3134 || SSA_NAME_VAR (node
))
3135 dump_generic_node (pp
, SSA_NAME_IDENTIFIER (node
),
3139 pp_decimal_int (pp
, SSA_NAME_VERSION (node
));
3140 if (SSA_NAME_IS_DEFAULT_DEF (node
))
3141 pp_string (pp
, "(D)");
3142 if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (node
))
3143 pp_string (pp
, "(ab)");
3146 case WITH_SIZE_EXPR
:
3147 pp_string (pp
, "WITH_SIZE_EXPR <");
3148 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3149 pp_string (pp
, ", ");
3150 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3155 pp_string (pp
, "ASSERT_EXPR <");
3156 dump_generic_node (pp
, ASSERT_EXPR_VAR (node
), spc
, flags
, false);
3157 pp_string (pp
, ", ");
3158 dump_generic_node (pp
, ASSERT_EXPR_COND (node
), spc
, flags
, false);
3163 pp_string (pp
, "scev_known");
3166 case SCEV_NOT_KNOWN
:
3167 pp_string (pp
, "scev_not_known");
3170 case POLYNOMIAL_CHREC
:
3172 dump_generic_node (pp
, CHREC_LEFT (node
), spc
, flags
, false);
3173 pp_string (pp
, ", +, ");
3174 dump_generic_node (pp
, CHREC_RIGHT (node
), spc
, flags
, false);
3175 pp_printf (pp
, "}_%u", CHREC_VARIABLE (node
));
3179 case REALIGN_LOAD_EXPR
:
3180 pp_string (pp
, "REALIGN_LOAD <");
3181 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3182 pp_string (pp
, ", ");
3183 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3184 pp_string (pp
, ", ");
3185 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3190 pp_string (pp
, " VEC_COND_EXPR < ");
3191 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3192 pp_string (pp
, " , ");
3193 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3194 pp_string (pp
, " , ");
3195 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3196 pp_string (pp
, " > ");
3200 pp_string (pp
, " VEC_PERM_EXPR < ");
3201 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3202 pp_string (pp
, " , ");
3203 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3204 pp_string (pp
, " , ");
3205 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3206 pp_string (pp
, " > ");
3210 pp_string (pp
, " DOT_PROD_EXPR < ");
3211 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3212 pp_string (pp
, ", ");
3213 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3214 pp_string (pp
, ", ");
3215 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3216 pp_string (pp
, " > ");
3219 case WIDEN_MULT_PLUS_EXPR
:
3220 pp_string (pp
, " WIDEN_MULT_PLUS_EXPR < ");
3221 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3222 pp_string (pp
, ", ");
3223 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3224 pp_string (pp
, ", ");
3225 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3226 pp_string (pp
, " > ");
3229 case WIDEN_MULT_MINUS_EXPR
:
3230 pp_string (pp
, " WIDEN_MULT_MINUS_EXPR < ");
3231 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3232 pp_string (pp
, ", ");
3233 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3234 pp_string (pp
, ", ");
3235 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3236 pp_string (pp
, " > ");
3240 pp_string (pp
, "#pragma acc parallel");
3241 goto dump_omp_clauses_body
;
3244 pp_string (pp
, "#pragma acc kernels");
3245 goto dump_omp_clauses_body
;
3248 pp_string (pp
, "#pragma acc serial");
3249 goto dump_omp_clauses_body
;
3252 pp_string (pp
, "#pragma acc data");
3253 dump_omp_clauses (pp
, OACC_DATA_CLAUSES (node
), spc
, flags
);
3256 case OACC_HOST_DATA
:
3257 pp_string (pp
, "#pragma acc host_data");
3258 dump_omp_clauses (pp
, OACC_HOST_DATA_CLAUSES (node
), spc
, flags
);
3262 pp_string (pp
, "#pragma acc declare");
3263 dump_omp_clauses (pp
, OACC_DECLARE_CLAUSES (node
), spc
, flags
);
3267 pp_string (pp
, "#pragma acc update");
3268 dump_omp_clauses (pp
, OACC_UPDATE_CLAUSES (node
), spc
, flags
);
3271 case OACC_ENTER_DATA
:
3272 pp_string (pp
, "#pragma acc enter data");
3273 dump_omp_clauses (pp
, OACC_ENTER_DATA_CLAUSES (node
), spc
, flags
);
3276 case OACC_EXIT_DATA
:
3277 pp_string (pp
, "#pragma acc exit data");
3278 dump_omp_clauses (pp
, OACC_EXIT_DATA_CLAUSES (node
), spc
, flags
);
3282 pp_string (pp
, "#pragma acc cache");
3283 dump_omp_clauses (pp
, OACC_CACHE_CLAUSES (node
), spc
, flags
);
3287 pp_string (pp
, "#pragma omp parallel");
3288 dump_omp_clauses (pp
, OMP_PARALLEL_CLAUSES (node
), spc
, flags
);
3291 dump_omp_clauses_body
:
3292 dump_omp_clauses (pp
, OMP_CLAUSES (node
), spc
, flags
);
3296 if (!(flags
& TDF_SLIM
) && OMP_BODY (node
))
3298 newline_and_indent (pp
, spc
+ 2);
3300 newline_and_indent (pp
, spc
+ 4);
3301 dump_generic_node (pp
, OMP_BODY (node
), spc
+ 4, flags
, false);
3302 newline_and_indent (pp
, spc
+ 2);
3303 pp_right_brace (pp
);
3309 pp_string (pp
, OMP_TASK_BODY (node
) ? "#pragma omp task"
3310 : "#pragma omp taskwait");
3311 dump_omp_clauses (pp
, OMP_TASK_CLAUSES (node
), spc
, flags
);
3315 pp_string (pp
, "#pragma omp for");
3319 pp_string (pp
, "#pragma omp simd");
3322 case OMP_DISTRIBUTE
:
3323 pp_string (pp
, "#pragma omp distribute");
3327 pp_string (pp
, "#pragma omp taskloop");
3331 pp_string (pp
, "#pragma omp loop");
3335 pp_string (pp
, "#pragma acc loop");
3339 pp_string (pp
, "#pragma omp teams");
3340 dump_omp_clauses (pp
, OMP_TEAMS_CLAUSES (node
), spc
, flags
);
3343 case OMP_TARGET_DATA
:
3344 pp_string (pp
, "#pragma omp target data");
3345 dump_omp_clauses (pp
, OMP_TARGET_DATA_CLAUSES (node
), spc
, flags
);
3348 case OMP_TARGET_ENTER_DATA
:
3349 pp_string (pp
, "#pragma omp target enter data");
3350 dump_omp_clauses (pp
, OMP_TARGET_ENTER_DATA_CLAUSES (node
), spc
, flags
);
3354 case OMP_TARGET_EXIT_DATA
:
3355 pp_string (pp
, "#pragma omp target exit data");
3356 dump_omp_clauses (pp
, OMP_TARGET_EXIT_DATA_CLAUSES (node
), spc
, flags
);
3361 pp_string (pp
, "#pragma omp target");
3362 dump_omp_clauses (pp
, OMP_TARGET_CLAUSES (node
), spc
, flags
);
3365 case OMP_TARGET_UPDATE
:
3366 pp_string (pp
, "#pragma omp target update");
3367 dump_omp_clauses (pp
, OMP_TARGET_UPDATE_CLAUSES (node
), spc
, flags
);
3372 dump_omp_clauses (pp
, OMP_FOR_CLAUSES (node
), spc
, flags
);
3373 if (!(flags
& TDF_SLIM
))
3377 if (OMP_FOR_PRE_BODY (node
))
3379 newline_and_indent (pp
, spc
+ 2);
3382 newline_and_indent (pp
, spc
);
3383 dump_generic_node (pp
, OMP_FOR_PRE_BODY (node
),
3386 if (OMP_FOR_INIT (node
))
3389 for (i
= 0; i
< TREE_VEC_LENGTH (OMP_FOR_INIT (node
)); i
++)
3392 newline_and_indent (pp
, spc
);
3393 pp_string (pp
, "for (");
3394 dump_generic_node (pp
,
3395 TREE_VEC_ELT (OMP_FOR_INIT (node
), i
),
3397 pp_string (pp
, "; ");
3398 dump_generic_node (pp
,
3399 TREE_VEC_ELT (OMP_FOR_COND (node
), i
),
3401 pp_string (pp
, "; ");
3402 dump_generic_node (pp
,
3403 TREE_VEC_ELT (OMP_FOR_INCR (node
), i
),
3405 pp_right_paren (pp
);
3408 if (OMP_FOR_BODY (node
))
3410 newline_and_indent (pp
, spc
+ 2);
3412 newline_and_indent (pp
, spc
+ 4);
3413 dump_generic_node (pp
, OMP_FOR_BODY (node
), spc
+ 4, flags
,
3415 newline_and_indent (pp
, spc
+ 2);
3416 pp_right_brace (pp
);
3418 if (OMP_FOR_INIT (node
))
3419 spc
-= 2 * TREE_VEC_LENGTH (OMP_FOR_INIT (node
)) - 2;
3420 if (OMP_FOR_PRE_BODY (node
))
3423 newline_and_indent (pp
, spc
+ 2);
3424 pp_right_brace (pp
);
3431 pp_string (pp
, "#pragma omp sections");
3432 dump_omp_clauses (pp
, OMP_SECTIONS_CLAUSES (node
), spc
, flags
);
3436 pp_string (pp
, "#pragma omp section");
3440 if (OMP_SCAN_CLAUSES (node
))
3442 pp_string (pp
, "#pragma omp scan");
3443 dump_omp_clauses (pp
, OMP_SCAN_CLAUSES (node
), spc
, flags
);
3448 pp_string (pp
, "#pragma omp master");
3452 pp_string (pp
, "#pragma omp taskgroup");
3453 dump_omp_clauses (pp
, OMP_TASKGROUP_CLAUSES (node
), spc
, flags
);
3457 pp_string (pp
, "#pragma omp ordered");
3458 dump_omp_clauses (pp
, OMP_ORDERED_CLAUSES (node
), spc
, flags
);
3462 pp_string (pp
, "#pragma omp critical");
3463 if (OMP_CRITICAL_NAME (node
))
3467 dump_generic_node (pp
, OMP_CRITICAL_NAME (node
), spc
,
3469 pp_right_paren (pp
);
3471 dump_omp_clauses (pp
, OMP_CRITICAL_CLAUSES (node
), spc
, flags
);
3475 pp_string (pp
, "#pragma omp atomic");
3476 dump_omp_atomic_memory_order (pp
, OMP_ATOMIC_MEMORY_ORDER (node
));
3477 newline_and_indent (pp
, spc
+ 2);
3478 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3482 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3485 case OMP_ATOMIC_READ
:
3486 pp_string (pp
, "#pragma omp atomic read");
3487 dump_omp_atomic_memory_order (pp
, OMP_ATOMIC_MEMORY_ORDER (node
));
3488 newline_and_indent (pp
, spc
+ 2);
3489 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3493 case OMP_ATOMIC_CAPTURE_OLD
:
3494 case OMP_ATOMIC_CAPTURE_NEW
:
3495 pp_string (pp
, "#pragma omp atomic capture");
3496 dump_omp_atomic_memory_order (pp
, OMP_ATOMIC_MEMORY_ORDER (node
));
3497 newline_and_indent (pp
, spc
+ 2);
3498 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3502 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3506 pp_string (pp
, "#pragma omp single");
3507 dump_omp_clauses (pp
, OMP_SINGLE_CLAUSES (node
), spc
, flags
);
3511 dump_omp_clause (pp
, node
, spc
, flags
);
3515 case TRANSACTION_EXPR
:
3516 if (TRANSACTION_EXPR_OUTER (node
))
3517 pp_string (pp
, "__transaction_atomic [[outer]]");
3518 else if (TRANSACTION_EXPR_RELAXED (node
))
3519 pp_string (pp
, "__transaction_relaxed");
3521 pp_string (pp
, "__transaction_atomic");
3522 if (!(flags
& TDF_SLIM
) && TRANSACTION_EXPR_BODY (node
))
3524 newline_and_indent (pp
, spc
);
3526 newline_and_indent (pp
, spc
+ 2);
3527 dump_generic_node (pp
, TRANSACTION_EXPR_BODY (node
),
3528 spc
+ 2, flags
, false);
3529 newline_and_indent (pp
, spc
);
3530 pp_right_brace (pp
);
3535 case VEC_SERIES_EXPR
:
3536 case VEC_WIDEN_MULT_HI_EXPR
:
3537 case VEC_WIDEN_MULT_LO_EXPR
:
3538 case VEC_WIDEN_MULT_EVEN_EXPR
:
3539 case VEC_WIDEN_MULT_ODD_EXPR
:
3540 case VEC_WIDEN_LSHIFT_HI_EXPR
:
3541 case VEC_WIDEN_LSHIFT_LO_EXPR
:
3543 for (str
= get_tree_code_name (code
); *str
; str
++)
3544 pp_character (pp
, TOUPPER (*str
));
3545 pp_string (pp
, " < ");
3546 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3547 pp_string (pp
, ", ");
3548 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3549 pp_string (pp
, " > ");
3552 case VEC_DUPLICATE_EXPR
:
3554 for (str
= get_tree_code_name (code
); *str
; str
++)
3555 pp_character (pp
, TOUPPER (*str
));
3556 pp_string (pp
, " < ");
3557 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3558 pp_string (pp
, " > ");
3561 case VEC_UNPACK_HI_EXPR
:
3562 pp_string (pp
, " VEC_UNPACK_HI_EXPR < ");
3563 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3564 pp_string (pp
, " > ");
3567 case VEC_UNPACK_LO_EXPR
:
3568 pp_string (pp
, " VEC_UNPACK_LO_EXPR < ");
3569 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3570 pp_string (pp
, " > ");
3573 case VEC_UNPACK_FLOAT_HI_EXPR
:
3574 pp_string (pp
, " VEC_UNPACK_FLOAT_HI_EXPR < ");
3575 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3576 pp_string (pp
, " > ");
3579 case VEC_UNPACK_FLOAT_LO_EXPR
:
3580 pp_string (pp
, " VEC_UNPACK_FLOAT_LO_EXPR < ");
3581 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3582 pp_string (pp
, " > ");
3585 case VEC_UNPACK_FIX_TRUNC_HI_EXPR
:
3586 pp_string (pp
, " VEC_UNPACK_FIX_TRUNC_HI_EXPR < ");
3587 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3588 pp_string (pp
, " > ");
3591 case VEC_UNPACK_FIX_TRUNC_LO_EXPR
:
3592 pp_string (pp
, " VEC_UNPACK_FIX_TRUNC_LO_EXPR < ");
3593 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3594 pp_string (pp
, " > ");
3597 case VEC_PACK_TRUNC_EXPR
:
3598 pp_string (pp
, " VEC_PACK_TRUNC_EXPR < ");
3599 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3600 pp_string (pp
, ", ");
3601 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3602 pp_string (pp
, " > ");
3605 case VEC_PACK_SAT_EXPR
:
3606 pp_string (pp
, " VEC_PACK_SAT_EXPR < ");
3607 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3608 pp_string (pp
, ", ");
3609 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3610 pp_string (pp
, " > ");
3613 case VEC_PACK_FIX_TRUNC_EXPR
:
3614 pp_string (pp
, " VEC_PACK_FIX_TRUNC_EXPR < ");
3615 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3616 pp_string (pp
, ", ");
3617 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3618 pp_string (pp
, " > ");
3621 case VEC_PACK_FLOAT_EXPR
:
3622 pp_string (pp
, " VEC_PACK_FLOAT_EXPR < ");
3623 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3624 pp_string (pp
, ", ");
3625 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3626 pp_string (pp
, " > ");
3630 dump_block_node (pp
, node
, spc
, flags
);
3633 case DEBUG_BEGIN_STMT
:
3634 pp_string (pp
, "# DEBUG BEGIN STMT");
3641 if (is_stmt
&& is_expr
)
3647 /* Print the declaration of a variable. */
3650 print_declaration (pretty_printer
*pp
, tree t
, int spc
, dump_flags_t flags
)
3654 if (TREE_CODE(t
) == NAMELIST_DECL
)
3656 pp_string(pp
, "namelist ");
3657 dump_decl_name (pp
, t
, flags
);
3662 if (TREE_CODE (t
) == TYPE_DECL
)
3663 pp_string (pp
, "typedef ");
3665 if (CODE_CONTAINS_STRUCT (TREE_CODE (t
), TS_DECL_WRTL
) && DECL_REGISTER (t
))
3666 pp_string (pp
, "register ");
3668 if (TREE_PUBLIC (t
) && DECL_EXTERNAL (t
))
3669 pp_string (pp
, "extern ");
3670 else if (TREE_STATIC (t
))
3671 pp_string (pp
, "static ");
3673 /* Print the type and name. */
3674 if (TREE_TYPE (t
) && TREE_CODE (TREE_TYPE (t
)) == ARRAY_TYPE
)
3678 /* Print array's type. */
3679 tmp
= TREE_TYPE (t
);
3680 while (TREE_CODE (TREE_TYPE (tmp
)) == ARRAY_TYPE
)
3681 tmp
= TREE_TYPE (tmp
);
3682 dump_generic_node (pp
, TREE_TYPE (tmp
), spc
, flags
, false);
3684 /* Print variable's name. */
3686 dump_generic_node (pp
, t
, spc
, flags
, false);
3688 /* Print the dimensions. */
3689 tmp
= TREE_TYPE (t
);
3690 while (TREE_CODE (tmp
) == ARRAY_TYPE
)
3692 dump_array_domain (pp
, TYPE_DOMAIN (tmp
), spc
, flags
);
3693 tmp
= TREE_TYPE (tmp
);
3696 else if (TREE_CODE (t
) == FUNCTION_DECL
)
3698 dump_generic_node (pp
, TREE_TYPE (TREE_TYPE (t
)), spc
, flags
, false);
3700 dump_decl_name (pp
, t
, flags
);
3701 dump_function_declaration (pp
, TREE_TYPE (t
), spc
, flags
);
3705 /* Print type declaration. */
3706 dump_generic_node (pp
, TREE_TYPE (t
), spc
, flags
, false);
3708 /* Print variable's name. */
3710 dump_generic_node (pp
, t
, spc
, flags
, false);
3713 if (VAR_P (t
) && DECL_HARD_REGISTER (t
))
3715 pp_string (pp
, " __asm__ ");
3717 dump_generic_node (pp
, DECL_ASSEMBLER_NAME (t
), spc
, flags
, false);
3718 pp_right_paren (pp
);
3721 /* The initial value of a function serves to determine whether the function
3722 is declared or defined. So the following does not apply to function
3724 if (TREE_CODE (t
) != FUNCTION_DECL
)
3726 /* Print the initial value. */
3727 if (DECL_INITIAL (t
))
3732 if (!(flags
& TDF_SLIM
))
3733 dump_generic_node (pp
, DECL_INITIAL (t
), spc
, flags
, false);
3735 pp_string (pp
, "<<< omitted >>>");
3739 if (VAR_P (t
) && DECL_HAS_VALUE_EXPR_P (t
))
3741 pp_string (pp
, " [value-expr: ");
3742 dump_generic_node (pp
, DECL_VALUE_EXPR (t
), spc
, flags
, false);
3743 pp_right_bracket (pp
);
3750 /* Prints a structure: name, fields, and methods.
3751 FIXME: Still incomplete. */
3754 print_struct_decl (pretty_printer
*pp
, const_tree node
, int spc
,
3757 /* Print the name of the structure. */
3758 if (TYPE_NAME (node
))
3761 if (TREE_CODE (node
) == RECORD_TYPE
)
3762 pp_string (pp
, "struct ");
3763 else if ((TREE_CODE (node
) == UNION_TYPE
3764 || TREE_CODE (node
) == QUAL_UNION_TYPE
))
3765 pp_string (pp
, "union ");
3767 dump_generic_node (pp
, TYPE_NAME (node
), spc
, TDF_NONE
, false);
3770 /* Print the contents of the structure. */
3776 /* Print the fields of the structure. */
3779 tmp
= TYPE_FIELDS (node
);
3782 /* Avoid to print recursively the structure. */
3783 /* FIXME : Not implemented correctly...,
3784 what about the case when we have a cycle in the contain graph? ...
3785 Maybe this could be solved by looking at the scope in which the
3786 structure was declared. */
3787 if (TREE_TYPE (tmp
) != node
3788 && (TREE_CODE (TREE_TYPE (tmp
)) != POINTER_TYPE
3789 || TREE_TYPE (TREE_TYPE (tmp
)) != node
))
3791 print_declaration (pp
, tmp
, spc
+2, flags
);
3794 tmp
= DECL_CHAIN (tmp
);
3798 pp_right_brace (pp
);
3801 /* Return the priority of the operator CODE.
3803 From lowest to highest precedence with either left-to-right (L-R)
3804 or right-to-left (R-L) associativity]:
3807 2 [R-L] = += -= *= /= %= &= ^= |= <<= >>=
3819 14 [R-L] ! ~ ++ -- + - * & (type) sizeof
3820 15 [L-R] fn() [] -> .
3822 unary +, - and * have higher precedence than the corresponding binary
3826 op_code_prio (enum tree_code code
)
3843 case TRUTH_ORIF_EXPR
:
3846 case TRUTH_AND_EXPR
:
3847 case TRUTH_ANDIF_EXPR
:
3854 case TRUTH_XOR_EXPR
:
3871 case UNORDERED_EXPR
:
3882 case VEC_WIDEN_LSHIFT_HI_EXPR
:
3883 case VEC_WIDEN_LSHIFT_LO_EXPR
:
3884 case WIDEN_LSHIFT_EXPR
:
3887 case WIDEN_SUM_EXPR
:
3889 case POINTER_PLUS_EXPR
:
3890 case POINTER_DIFF_EXPR
:
3894 case VEC_WIDEN_MULT_HI_EXPR
:
3895 case VEC_WIDEN_MULT_LO_EXPR
:
3896 case WIDEN_MULT_EXPR
:
3898 case WIDEN_MULT_PLUS_EXPR
:
3899 case WIDEN_MULT_MINUS_EXPR
:
3901 case MULT_HIGHPART_EXPR
:
3902 case TRUNC_DIV_EXPR
:
3904 case FLOOR_DIV_EXPR
:
3905 case ROUND_DIV_EXPR
:
3907 case EXACT_DIV_EXPR
:
3908 case TRUNC_MOD_EXPR
:
3910 case FLOOR_MOD_EXPR
:
3911 case ROUND_MOD_EXPR
:
3914 case TRUTH_NOT_EXPR
:
3916 case POSTINCREMENT_EXPR
:
3917 case POSTDECREMENT_EXPR
:
3918 case PREINCREMENT_EXPR
:
3919 case PREDECREMENT_EXPR
:
3925 case FIX_TRUNC_EXPR
:
3931 case ARRAY_RANGE_REF
:
3935 /* Special expressions. */
3941 case VEC_UNPACK_HI_EXPR
:
3942 case VEC_UNPACK_LO_EXPR
:
3943 case VEC_UNPACK_FLOAT_HI_EXPR
:
3944 case VEC_UNPACK_FLOAT_LO_EXPR
:
3945 case VEC_UNPACK_FIX_TRUNC_HI_EXPR
:
3946 case VEC_UNPACK_FIX_TRUNC_LO_EXPR
:
3947 case VEC_PACK_TRUNC_EXPR
:
3948 case VEC_PACK_SAT_EXPR
:
3952 /* Return an arbitrarily high precedence to avoid surrounding single
3953 VAR_DECLs in ()s. */
3958 /* Return the priority of the operator OP. */
3961 op_prio (const_tree op
)
3963 enum tree_code code
;
3968 code
= TREE_CODE (op
);
3969 if (code
== SAVE_EXPR
|| code
== NON_LVALUE_EXPR
)
3970 return op_prio (TREE_OPERAND (op
, 0));
3972 return op_code_prio (code
);
3975 /* Return the symbol associated with operator CODE. */
3978 op_symbol_code (enum tree_code code
)
3986 case TRUTH_ORIF_EXPR
:
3989 case TRUTH_AND_EXPR
:
3990 case TRUTH_ANDIF_EXPR
:
3996 case TRUTH_XOR_EXPR
:
4006 case UNORDERED_EXPR
:
4052 case WIDEN_LSHIFT_EXPR
:
4055 case POINTER_PLUS_EXPR
:
4061 case WIDEN_SUM_EXPR
:
4064 case WIDEN_MULT_EXPR
:
4067 case MULT_HIGHPART_EXPR
:
4072 case POINTER_DIFF_EXPR
:
4078 case TRUTH_NOT_EXPR
:
4085 case TRUNC_DIV_EXPR
:
4092 case FLOOR_DIV_EXPR
:
4095 case ROUND_DIV_EXPR
:
4098 case EXACT_DIV_EXPR
:
4101 case TRUNC_MOD_EXPR
:
4107 case FLOOR_MOD_EXPR
:
4110 case ROUND_MOD_EXPR
:
4113 case PREDECREMENT_EXPR
:
4116 case PREINCREMENT_EXPR
:
4119 case POSTDECREMENT_EXPR
:
4122 case POSTINCREMENT_EXPR
:
4132 return "<<< ??? >>>";
4136 /* Return the symbol associated with operator OP. */
4139 op_symbol (const_tree op
)
4141 return op_symbol_code (TREE_CODE (op
));
4144 /* Prints the name of a call. NODE is the CALL_EXPR_FN of a CALL_EXPR or
4145 the gimple_call_fn of a GIMPLE_CALL. */
4148 print_call_name (pretty_printer
*pp
, tree node
, dump_flags_t flags
)
4152 if (TREE_CODE (op0
) == NON_LVALUE_EXPR
)
4153 op0
= TREE_OPERAND (op0
, 0);
4156 switch (TREE_CODE (op0
))
4161 dump_function_name (pp
, op0
, flags
);
4167 op0
= TREE_OPERAND (op0
, 0);
4172 dump_generic_node (pp
, TREE_OPERAND (op0
, 0), 0, flags
, false);
4173 pp_string (pp
, ") ? ");
4174 dump_generic_node (pp
, TREE_OPERAND (op0
, 1), 0, flags
, false);
4175 pp_string (pp
, " : ");
4176 dump_generic_node (pp
, TREE_OPERAND (op0
, 2), 0, flags
, false);
4180 if (TREE_CODE (TREE_OPERAND (op0
, 0)) == VAR_DECL
)
4181 dump_function_name (pp
, TREE_OPERAND (op0
, 0), flags
);
4183 dump_generic_node (pp
, op0
, 0, flags
, false);
4187 if (integer_zerop (TREE_OPERAND (op0
, 1)))
4189 op0
= TREE_OPERAND (op0
, 0);
4196 dump_generic_node (pp
, op0
, 0, flags
, false);
4204 /* Print the first N characters in the array STR, replacing non-printable
4205 characters (including embedded nuls) with unambiguous escape sequences. */
4208 pretty_print_string (pretty_printer
*pp
, const char *str
, unsigned n
)
4213 for ( ; n
; --n
, ++str
)
4218 pp_string (pp
, "\\b");
4222 pp_string (pp
, "\\f");
4226 pp_string (pp
, "\\n");
4230 pp_string (pp
, "\\r");
4234 pp_string (pp
, "\\t");
4238 pp_string (pp
, "\\v");
4242 pp_string (pp
, "\\\\");
4246 pp_string (pp
, "\\\"");
4250 pp_string (pp
, "\\'");
4254 if (str
[0] || n
> 1)
4256 if (!ISPRINT (str
[0]))
4259 sprintf (buf
, "\\x%02x", (unsigned char)str
[0]);
4260 pp_string (pp
, buf
);
4263 pp_character (pp
, str
[0]);
4271 maybe_init_pretty_print (FILE *file
)
4275 tree_pp
= new pretty_printer ();
4276 pp_needs_newline (tree_pp
) = true;
4277 pp_translate_identifiers (tree_pp
) = false;
4280 tree_pp
->buffer
->stream
= file
;
4284 newline_and_indent (pretty_printer
*pp
, int spc
)
4290 /* Handle the %K format for TEXT. Separate from default_tree_printer
4291 so it can also be used in front ends.
4292 The location LOC and BLOCK are expected to be extracted by the caller
4293 from the %K argument arg via EXPR_LOCATION(arg) and TREE_BLOCK(arg). */
4296 percent_K_format (text_info
*text
, location_t loc
, tree block
)
4298 text
->set_location (0, loc
, SHOW_RANGE_WITH_CARET
);
4299 gcc_assert (pp_ti_abstract_origin (text
) != NULL
);
4300 *pp_ti_abstract_origin (text
) = NULL
;
4303 && TREE_CODE (block
) == BLOCK
4304 && BLOCK_ABSTRACT_ORIGIN (block
))
4306 tree ao
= BLOCK_ABSTRACT_ORIGIN (block
);
4307 if (TREE_CODE (ao
) == FUNCTION_DECL
)
4309 *pp_ti_abstract_origin (text
) = block
;
4312 block
= BLOCK_SUPERCONTEXT (block
);
4316 /* Print the identifier ID to PRETTY-PRINTER. */
4319 pp_tree_identifier (pretty_printer
*pp
, tree id
)
4321 if (pp_translate_identifiers (pp
))
4323 const char *text
= identifier_to_locale (IDENTIFIER_POINTER (id
));
4324 pp_append_text (pp
, text
, text
+ strlen (text
));
4327 pp_append_text (pp
, IDENTIFIER_POINTER (id
),
4328 IDENTIFIER_POINTER (id
) + IDENTIFIER_LENGTH (id
));
4331 /* A helper function that is used to dump function information before the
4335 dump_function_header (FILE *dump_file
, tree fdecl
, dump_flags_t flags
)
4337 const char *dname
, *aname
;
4338 struct cgraph_node
*node
= cgraph_node::get (fdecl
);
4339 struct function
*fun
= DECL_STRUCT_FUNCTION (fdecl
);
4341 dname
= lang_hooks
.decl_printable_name (fdecl
, 1);
4343 if (DECL_ASSEMBLER_NAME_SET_P (fdecl
))
4344 aname
= (IDENTIFIER_POINTER
4345 (DECL_ASSEMBLER_NAME (fdecl
)));
4347 aname
= "<unset-asm-name>";
4349 fprintf (dump_file
, "\n;; Function %s (%s, funcdef_no=%d",
4350 dname
, aname
, fun
->funcdef_no
);
4351 if (!(flags
& TDF_NOUID
))
4352 fprintf (dump_file
, ", decl_uid=%d", DECL_UID (fdecl
));
4355 fprintf (dump_file
, ", cgraph_uid=%d", node
->get_uid ());
4356 fprintf (dump_file
, ", symbol_order=%d)%s\n\n", node
->order
,
4357 node
->frequency
== NODE_FREQUENCY_HOT
4359 : node
->frequency
== NODE_FREQUENCY_UNLIKELY_EXECUTED
4360 ? " (unlikely executed)"
4361 : node
->frequency
== NODE_FREQUENCY_EXECUTED_ONCE
4362 ? " (executed once)"
4366 fprintf (dump_file
, ")\n\n");
4369 /* Dump double_int D to pretty_printer PP. UNS is true
4370 if D is unsigned and false otherwise. */
4372 pp_double_int (pretty_printer
*pp
, double_int d
, bool uns
)
4375 pp_wide_integer (pp
, d
.low
);
4376 else if (d
.fits_uhwi ())
4377 pp_unsigned_wide_integer (pp
, d
.low
);
4380 unsigned HOST_WIDE_INT low
= d
.low
;
4381 HOST_WIDE_INT high
= d
.high
;
4382 if (!uns
&& d
.is_negative ())
4385 high
= ~high
+ !low
;
4388 /* Would "%x%0*x" or "%x%*0x" get zero-padding on all
4390 sprintf (pp_buffer (pp
)->digit_buffer
,
4391 HOST_WIDE_INT_PRINT_DOUBLE_HEX
,
4392 (unsigned HOST_WIDE_INT
) high
, low
);
4393 pp_string (pp
, pp_buffer (pp
)->digit_buffer
);
4398 # pragma GCC diagnostic pop