1 /* Pretty formatting of GENERIC trees in C syntax.
2 Copyright (C) 2001-2021 Free Software Foundation, Inc.
3 Adapted from c-pretty-print.c by Diego Novillo <dnovillo@redhat.com>
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 3, or (at your option) any later
12 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING3. If not see
19 <http://www.gnu.org/licenses/>. */
23 #include "coretypes.h"
29 #include "tree-pretty-print.h"
30 #include "stor-layout.h"
31 #include "langhooks.h"
32 #include "tree-iterator.h"
34 #include "internal-fn.h"
35 #include "gomp-constants.h"
37 #include "fold-const.h"
39 /* 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 newline_and_indent (pretty_printer
*, int);
49 static void maybe_init_pretty_print (FILE *);
50 static void print_struct_decl (pretty_printer
*, const_tree
, int, dump_flags_t
);
51 static void do_niy (pretty_printer
*, const_tree
, dump_flags_t
);
53 #define INDENT(SPACE) do { \
54 int i; for (i = 0; i<SPACE; i++) pp_space (pp); } while (0)
56 #define NIY do_niy (pp, node, flags)
58 static pretty_printer
*tree_pp
;
60 /* Try to print something for an unknown tree code. */
63 do_niy (pretty_printer
*pp
, const_tree node
, dump_flags_t flags
)
67 pp_string (pp
, "<<< Unknown tree: ");
68 pp_string (pp
, get_tree_code_name (TREE_CODE (node
)));
72 len
= TREE_OPERAND_LENGTH (node
);
73 for (i
= 0; i
< len
; ++i
)
75 newline_and_indent (pp
, 2);
76 dump_generic_node (pp
, TREE_OPERAND (node
, i
), 2, flags
, false);
80 pp_string (pp
, " >>>");
83 /* Debugging function to print out a generic expression. */
86 debug_generic_expr (tree t
)
88 print_generic_expr (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
);
89 fprintf (stderr
, "\n");
92 /* Debugging function to print out a generic statement. */
95 debug_generic_stmt (tree t
)
97 print_generic_stmt (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
);
98 fprintf (stderr
, "\n");
101 /* Debugging function to print out a chain of trees . */
104 debug_tree_chain (tree t
)
110 print_generic_expr (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
|TDF_UID
);
111 fprintf (stderr
, " ");
115 fprintf (stderr
, "... [cycled back to ");
116 print_generic_expr (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
|TDF_UID
);
117 fprintf (stderr
, "]");
121 fprintf (stderr
, "\n");
124 /* Prints declaration DECL to the FILE with details specified by FLAGS. */
126 print_generic_decl (FILE *file
, tree decl
, dump_flags_t flags
)
128 maybe_init_pretty_print (file
);
129 print_declaration (tree_pp
, decl
, 2, flags
);
130 pp_write_text_to_stream (tree_pp
);
133 /* Print tree T, and its successors, on file FILE. FLAGS specifies details
134 to show in the dump. See TDF_* in dumpfile.h. */
137 print_generic_stmt (FILE *file
, tree t
, dump_flags_t flags
)
139 maybe_init_pretty_print (file
);
140 dump_generic_node (tree_pp
, t
, 0, flags
, true);
141 pp_newline_and_flush (tree_pp
);
144 /* Print tree T, and its successors, on file FILE. FLAGS specifies details
145 to show in the dump. See TDF_* in dumpfile.h. The output is indented by
149 print_generic_stmt_indented (FILE *file
, tree t
, dump_flags_t flags
, int indent
)
153 maybe_init_pretty_print (file
);
155 for (i
= 0; i
< indent
; i
++)
157 dump_generic_node (tree_pp
, t
, indent
, flags
, true);
158 pp_newline_and_flush (tree_pp
);
161 /* Print a single expression T on file FILE. FLAGS specifies details to show
162 in the dump. See TDF_* in dumpfile.h. */
165 print_generic_expr (FILE *file
, tree t
, dump_flags_t flags
)
167 maybe_init_pretty_print (file
);
168 dump_generic_node (tree_pp
, t
, 0, flags
, false);
172 /* Print a single expression T to string, and return it. */
175 print_generic_expr_to_str (tree t
)
178 dump_generic_node (&pp
, t
, 0, TDF_VOPS
|TDF_MEMSYMS
, false);
179 return xstrdup (pp_formatted_text (&pp
));
182 /* Dump NAME, an IDENTIFIER_POINTER, sanitized so that D<num> sequences
183 in it are replaced with Dxxxx, as long as they are at the start or
184 preceded by $ and at the end or followed by $. See make_fancy_name
188 dump_fancy_name (pretty_printer
*pp
, tree name
)
191 int length
= IDENTIFIER_LENGTH (name
);
192 const char *n
= IDENTIFIER_POINTER (name
);
199 && (n
== IDENTIFIER_POINTER (name
) || n
[-1] == '$'))
202 while (ISDIGIT (n
[l
]))
204 if (n
[l
] == '\0' || n
[l
] == '$')
217 pp_tree_identifier (pp
, name
);
221 char *str
= XNEWVEC (char, length
+ 1);
224 q
= n
= IDENTIFIER_POINTER (name
);
231 && (q
== IDENTIFIER_POINTER (name
) || q
[-1] == '$'))
234 while (ISDIGIT (q
[l
]))
236 if (q
[l
] == '\0' || q
[l
] == '$')
238 memcpy (p
, n
, q
- n
);
239 memcpy (p
+ (q
- n
), "Dxxxx", 5);
249 memcpy (p
, n
, IDENTIFIER_LENGTH (name
) - (n
- IDENTIFIER_POINTER (name
)));
251 if (pp_translate_identifiers (pp
))
253 const char *text
= identifier_to_locale (str
);
254 pp_append_text (pp
, text
, text
+ strlen (text
));
257 pp_append_text (pp
, str
, str
+ length
);
261 /* Dump the name of a _DECL node and its DECL_UID if TDF_UID is set
265 dump_decl_name (pretty_printer
*pp
, tree node
, dump_flags_t flags
)
267 tree name
= DECL_NAME (node
);
270 if ((flags
& TDF_ASMNAME
)
271 && HAS_DECL_ASSEMBLER_NAME_P (node
)
272 && DECL_ASSEMBLER_NAME_SET_P (node
))
273 pp_tree_identifier (pp
, DECL_ASSEMBLER_NAME_RAW (node
));
274 /* For -fcompare-debug don't dump DECL_NAMELESS names at all,
275 -g might have created more fancy names and their indexes
276 could get out of sync. Usually those should be DECL_IGNORED_P
277 too, SRA can create even non-DECL_IGNORED_P DECL_NAMELESS fancy
278 names, let's hope those never get out of sync after doing the
279 dump_fancy_name sanitization. */
280 else if ((flags
& TDF_COMPARE_DEBUG
)
281 && DECL_NAMELESS (node
)
282 && DECL_IGNORED_P (node
))
284 /* For DECL_NAMELESS names look for embedded uids in the
285 names and sanitize them for TDF_NOUID. */
286 else if ((flags
& TDF_NOUID
) && DECL_NAMELESS (node
))
287 dump_fancy_name (pp
, name
);
289 pp_tree_identifier (pp
, name
);
291 char uid_sep
= (flags
& TDF_GIMPLE
) ? '_' : '.';
292 if ((flags
& TDF_UID
) || name
== NULL_TREE
)
294 if (TREE_CODE (node
) == LABEL_DECL
&& LABEL_DECL_UID (node
) != -1)
295 pp_printf (pp
, "L%c%d", uid_sep
, (int) LABEL_DECL_UID (node
));
296 else if (TREE_CODE (node
) == DEBUG_EXPR_DECL
)
298 if (flags
& TDF_NOUID
)
299 pp_string (pp
, "D#xxxx");
301 pp_printf (pp
, "D#%i", DEBUG_TEMP_UID (node
));
305 char c
= TREE_CODE (node
) == CONST_DECL
? 'C' : 'D';
306 if (flags
& TDF_NOUID
)
307 pp_printf (pp
, "%c.xxxx", c
);
309 pp_printf (pp
, "%c%c%u", c
, uid_sep
, DECL_UID (node
));
312 if ((flags
& TDF_ALIAS
) && DECL_PT_UID (node
) != DECL_UID (node
))
314 if (flags
& TDF_NOUID
)
315 pp_printf (pp
, "ptD.xxxx");
317 pp_printf (pp
, "ptD.%u", DECL_PT_UID (node
));
321 /* Like the above, but used for pretty printing function calls. */
324 dump_function_name (pretty_printer
*pp
, tree node
, dump_flags_t flags
)
326 if (CONVERT_EXPR_P (node
))
327 node
= TREE_OPERAND (node
, 0);
328 if (DECL_NAME (node
) && (flags
& TDF_ASMNAME
) == 0)
329 pp_string (pp
, lang_hooks
.decl_printable_name (node
, 1));
331 dump_decl_name (pp
, node
, flags
);
334 /* Dump a function declaration. NODE is the FUNCTION_TYPE. PP, SPC and
335 FLAGS are as in dump_generic_node. */
338 dump_function_declaration (pretty_printer
*pp
, tree node
,
339 int spc
, dump_flags_t flags
)
341 bool wrote_arg
= false;
347 /* Print the argument types. */
348 arg
= TYPE_ARG_TYPES (node
);
349 while (arg
&& arg
!= void_list_node
&& arg
!= error_mark_node
)
357 dump_generic_node (pp
, TREE_VALUE (arg
), spc
, flags
, false);
358 arg
= TREE_CHAIN (arg
);
361 /* Drop the trailing void_type_node if we had any previous argument. */
362 if (arg
== void_list_node
&& !wrote_arg
)
363 pp_string (pp
, "void");
364 /* Properly dump vararg function types. */
365 else if (!arg
&& wrote_arg
)
366 pp_string (pp
, ", ...");
367 /* Avoid printing any arg for unprototyped functions. */
372 /* Dump the domain associated with an array. */
375 dump_array_domain (pretty_printer
*pp
, tree domain
, int spc
, dump_flags_t flags
)
377 pp_left_bracket (pp
);
380 tree min
= TYPE_MIN_VALUE (domain
);
381 tree max
= TYPE_MAX_VALUE (domain
);
384 && integer_zerop (min
)
385 && tree_fits_shwi_p (max
))
386 pp_wide_integer (pp
, tree_to_shwi (max
) + 1);
390 dump_generic_node (pp
, min
, spc
, flags
, false);
393 dump_generic_node (pp
, max
, spc
, flags
, false);
397 pp_string (pp
, "<unknown>");
398 pp_right_bracket (pp
);
402 /* Dump OpenMP iterators ITER. */
405 dump_omp_iterators (pretty_printer
*pp
, tree iter
, int spc
, dump_flags_t flags
)
407 pp_string (pp
, "iterator(");
408 for (tree it
= iter
; it
; it
= TREE_CHAIN (it
))
411 pp_string (pp
, ", ");
412 dump_generic_node (pp
, TREE_TYPE (TREE_VEC_ELT (it
, 0)), spc
, flags
,
415 dump_generic_node (pp
, TREE_VEC_ELT (it
, 0), spc
, flags
, false);
417 dump_generic_node (pp
, TREE_VEC_ELT (it
, 1), spc
, flags
, false);
419 dump_generic_node (pp
, TREE_VEC_ELT (it
, 2), spc
, flags
, false);
421 dump_generic_node (pp
, TREE_VEC_ELT (it
, 3), spc
, flags
, false);
427 /* Dump OpenMP clause CLAUSE. PP, CLAUSE, SPC and FLAGS are as in
428 dump_generic_node. */
431 dump_omp_clause (pretty_printer
*pp
, tree clause
, int spc
, dump_flags_t flags
)
434 const char *modifier
= NULL
;
435 switch (OMP_CLAUSE_CODE (clause
))
437 case OMP_CLAUSE_PRIVATE
:
440 case OMP_CLAUSE_SHARED
:
443 case OMP_CLAUSE_FIRSTPRIVATE
:
444 name
= "firstprivate";
446 case OMP_CLAUSE_LASTPRIVATE
:
447 name
= "lastprivate";
448 if (OMP_CLAUSE_LASTPRIVATE_CONDITIONAL (clause
))
449 modifier
= "conditional:";
451 case OMP_CLAUSE_COPYIN
:
454 case OMP_CLAUSE_COPYPRIVATE
:
455 name
= "copyprivate";
457 case OMP_CLAUSE_UNIFORM
:
460 case OMP_CLAUSE_USE_DEVICE_PTR
:
461 name
= "use_device_ptr";
462 if (OMP_CLAUSE_USE_DEVICE_PTR_IF_PRESENT (clause
))
463 modifier
= "if_present:";
465 case OMP_CLAUSE_USE_DEVICE_ADDR
:
466 name
= "use_device_addr";
468 case OMP_CLAUSE_IS_DEVICE_PTR
:
469 name
= "is_device_ptr";
471 case OMP_CLAUSE_INCLUSIVE
:
474 case OMP_CLAUSE_EXCLUSIVE
:
477 case OMP_CLAUSE__LOOPTEMP_
:
480 case OMP_CLAUSE__REDUCTEMP_
:
481 name
= "_reductemp_";
483 case OMP_CLAUSE__CONDTEMP_
:
486 case OMP_CLAUSE__SCANTEMP_
:
489 case OMP_CLAUSE_TO_DECLARE
:
492 case OMP_CLAUSE_LINK
:
495 case OMP_CLAUSE_NONTEMPORAL
:
496 name
= "nontemporal";
499 pp_string (pp
, name
);
502 pp_string (pp
, modifier
);
503 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
508 case OMP_CLAUSE_TASK_REDUCTION
:
509 case OMP_CLAUSE_IN_REDUCTION
:
510 pp_string (pp
, OMP_CLAUSE_CODE (clause
) == OMP_CLAUSE_IN_REDUCTION
513 case OMP_CLAUSE_REDUCTION
:
514 pp_string (pp
, "reduction(");
515 if (OMP_CLAUSE_CODE (clause
) == OMP_CLAUSE_REDUCTION
)
517 if (OMP_CLAUSE_REDUCTION_TASK (clause
))
518 pp_string (pp
, "task,");
519 else if (OMP_CLAUSE_REDUCTION_INSCAN (clause
))
520 pp_string (pp
, "inscan,");
522 if (OMP_CLAUSE_REDUCTION_CODE (clause
) != ERROR_MARK
)
525 op_symbol_code (OMP_CLAUSE_REDUCTION_CODE (clause
)));
528 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
534 pp_string (pp
, "if(");
535 switch (OMP_CLAUSE_IF_MODIFIER (clause
))
537 case ERROR_MARK
: break;
538 case VOID_CST
: pp_string (pp
, "cancel:"); break;
539 case OMP_PARALLEL
: pp_string (pp
, "parallel:"); break;
540 case OMP_SIMD
: pp_string (pp
, "simd:"); break;
541 case OMP_TASK
: pp_string (pp
, "task:"); break;
542 case OMP_TASKLOOP
: pp_string (pp
, "taskloop:"); break;
543 case OMP_TARGET_DATA
: pp_string (pp
, "target data:"); break;
544 case OMP_TARGET
: pp_string (pp
, "target:"); break;
545 case OMP_TARGET_UPDATE
: pp_string (pp
, "target update:"); break;
546 case OMP_TARGET_ENTER_DATA
:
547 pp_string (pp
, "target enter data:"); break;
548 case OMP_TARGET_EXIT_DATA
: pp_string (pp
, "target exit data:"); break;
549 default: gcc_unreachable ();
551 dump_generic_node (pp
, OMP_CLAUSE_IF_EXPR (clause
),
556 case OMP_CLAUSE_NUM_THREADS
:
557 pp_string (pp
, "num_threads(");
558 dump_generic_node (pp
, OMP_CLAUSE_NUM_THREADS_EXPR (clause
),
563 case OMP_CLAUSE_NOWAIT
:
564 pp_string (pp
, "nowait");
566 case OMP_CLAUSE_ORDERED
:
567 pp_string (pp
, "ordered");
568 if (OMP_CLAUSE_ORDERED_EXPR (clause
))
571 dump_generic_node (pp
, OMP_CLAUSE_ORDERED_EXPR (clause
),
577 case OMP_CLAUSE_DEFAULT
:
578 pp_string (pp
, "default(");
579 switch (OMP_CLAUSE_DEFAULT_KIND (clause
))
581 case OMP_CLAUSE_DEFAULT_UNSPECIFIED
:
583 case OMP_CLAUSE_DEFAULT_SHARED
:
584 pp_string (pp
, "shared");
586 case OMP_CLAUSE_DEFAULT_NONE
:
587 pp_string (pp
, "none");
589 case OMP_CLAUSE_DEFAULT_PRIVATE
:
590 pp_string (pp
, "private");
592 case OMP_CLAUSE_DEFAULT_FIRSTPRIVATE
:
593 pp_string (pp
, "firstprivate");
595 case OMP_CLAUSE_DEFAULT_PRESENT
:
596 pp_string (pp
, "present");
604 case OMP_CLAUSE_SCHEDULE
:
605 pp_string (pp
, "schedule(");
606 if (OMP_CLAUSE_SCHEDULE_KIND (clause
)
607 & (OMP_CLAUSE_SCHEDULE_MONOTONIC
608 | OMP_CLAUSE_SCHEDULE_NONMONOTONIC
))
610 if (OMP_CLAUSE_SCHEDULE_KIND (clause
)
611 & OMP_CLAUSE_SCHEDULE_MONOTONIC
)
612 pp_string (pp
, "monotonic");
614 pp_string (pp
, "nonmonotonic");
615 if (OMP_CLAUSE_SCHEDULE_SIMD (clause
))
620 if (OMP_CLAUSE_SCHEDULE_SIMD (clause
))
621 pp_string (pp
, "simd:");
623 switch (OMP_CLAUSE_SCHEDULE_KIND (clause
) & OMP_CLAUSE_SCHEDULE_MASK
)
625 case OMP_CLAUSE_SCHEDULE_STATIC
:
626 pp_string (pp
, "static");
628 case OMP_CLAUSE_SCHEDULE_DYNAMIC
:
629 pp_string (pp
, "dynamic");
631 case OMP_CLAUSE_SCHEDULE_GUIDED
:
632 pp_string (pp
, "guided");
634 case OMP_CLAUSE_SCHEDULE_RUNTIME
:
635 pp_string (pp
, "runtime");
637 case OMP_CLAUSE_SCHEDULE_AUTO
:
638 pp_string (pp
, "auto");
643 if (OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (clause
))
646 dump_generic_node (pp
, OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (clause
),
652 case OMP_CLAUSE_UNTIED
:
653 pp_string (pp
, "untied");
656 case OMP_CLAUSE_COLLAPSE
:
657 pp_string (pp
, "collapse(");
658 dump_generic_node (pp
, OMP_CLAUSE_COLLAPSE_EXPR (clause
),
663 case OMP_CLAUSE_FINAL
:
664 pp_string (pp
, "final(");
665 dump_generic_node (pp
, OMP_CLAUSE_FINAL_EXPR (clause
),
670 case OMP_CLAUSE_MERGEABLE
:
671 pp_string (pp
, "mergeable");
674 case OMP_CLAUSE_LINEAR
:
675 pp_string (pp
, "linear(");
676 switch (OMP_CLAUSE_LINEAR_KIND (clause
))
678 case OMP_CLAUSE_LINEAR_DEFAULT
:
680 case OMP_CLAUSE_LINEAR_REF
:
681 pp_string (pp
, "ref(");
683 case OMP_CLAUSE_LINEAR_VAL
:
684 pp_string (pp
, "val(");
686 case OMP_CLAUSE_LINEAR_UVAL
:
687 pp_string (pp
, "uval(");
692 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
694 if (OMP_CLAUSE_LINEAR_KIND (clause
) != OMP_CLAUSE_LINEAR_DEFAULT
)
697 dump_generic_node (pp
, OMP_CLAUSE_LINEAR_STEP (clause
),
702 case OMP_CLAUSE_ALIGNED
:
703 pp_string (pp
, "aligned(");
704 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
706 if (OMP_CLAUSE_ALIGNED_ALIGNMENT (clause
))
709 dump_generic_node (pp
, OMP_CLAUSE_ALIGNED_ALIGNMENT (clause
),
715 case OMP_CLAUSE_ALLOCATE
:
716 pp_string (pp
, "allocate(");
717 if (OMP_CLAUSE_ALLOCATE_ALLOCATOR (clause
))
719 dump_generic_node (pp
, OMP_CLAUSE_ALLOCATE_ALLOCATOR (clause
),
723 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
728 case OMP_CLAUSE_DEPEND
:
729 pp_string (pp
, "depend(");
730 switch (OMP_CLAUSE_DEPEND_KIND (clause
))
732 case OMP_CLAUSE_DEPEND_DEPOBJ
:
735 case OMP_CLAUSE_DEPEND_IN
:
738 case OMP_CLAUSE_DEPEND_OUT
:
741 case OMP_CLAUSE_DEPEND_INOUT
:
744 case OMP_CLAUSE_DEPEND_MUTEXINOUTSET
:
745 name
= "mutexinoutset";
747 case OMP_CLAUSE_DEPEND_SOURCE
:
748 pp_string (pp
, "source)");
750 case OMP_CLAUSE_DEPEND_LAST
:
751 name
= "__internal__";
753 case OMP_CLAUSE_DEPEND_SINK
:
754 pp_string (pp
, "sink:");
755 for (tree t
= OMP_CLAUSE_DECL (clause
); t
; t
= TREE_CHAIN (t
))
756 if (TREE_CODE (t
) == TREE_LIST
)
758 dump_generic_node (pp
, TREE_VALUE (t
), spc
, flags
, false);
759 if (TREE_PURPOSE (t
) != integer_zero_node
)
761 if (OMP_CLAUSE_DEPEND_SINK_NEGATIVE (t
))
765 dump_generic_node (pp
, TREE_PURPOSE (t
), spc
, flags
,
779 tree t
= OMP_CLAUSE_DECL (clause
);
780 if (TREE_CODE (t
) == TREE_LIST
782 && TREE_CODE (TREE_PURPOSE (t
)) == TREE_VEC
)
784 dump_omp_iterators (pp
, TREE_PURPOSE (t
), spc
, flags
);
788 pp_string (pp
, name
);
790 dump_generic_node (pp
, t
, spc
, flags
, false);
796 pp_string (pp
, "map(");
797 switch (OMP_CLAUSE_MAP_KIND (clause
))
800 case GOMP_MAP_POINTER
:
801 pp_string (pp
, "alloc");
803 case GOMP_MAP_IF_PRESENT
:
804 pp_string (pp
, "no_alloc");
807 case GOMP_MAP_TO_PSET
:
808 pp_string (pp
, "to");
811 pp_string (pp
, "from");
813 case GOMP_MAP_TOFROM
:
814 pp_string (pp
, "tofrom");
816 case GOMP_MAP_FORCE_ALLOC
:
817 pp_string (pp
, "force_alloc");
819 case GOMP_MAP_FORCE_TO
:
820 pp_string (pp
, "force_to");
822 case GOMP_MAP_FORCE_FROM
:
823 pp_string (pp
, "force_from");
825 case GOMP_MAP_FORCE_TOFROM
:
826 pp_string (pp
, "force_tofrom");
828 case GOMP_MAP_FORCE_PRESENT
:
829 pp_string (pp
, "force_present");
831 case GOMP_MAP_DELETE
:
832 pp_string (pp
, "delete");
834 case GOMP_MAP_FORCE_DEVICEPTR
:
835 pp_string (pp
, "force_deviceptr");
837 case GOMP_MAP_ALWAYS_TO
:
838 pp_string (pp
, "always,to");
840 case GOMP_MAP_ALWAYS_FROM
:
841 pp_string (pp
, "always,from");
843 case GOMP_MAP_ALWAYS_TOFROM
:
844 pp_string (pp
, "always,tofrom");
846 case GOMP_MAP_RELEASE
:
847 pp_string (pp
, "release");
849 case GOMP_MAP_FIRSTPRIVATE_POINTER
:
850 pp_string (pp
, "firstprivate");
852 case GOMP_MAP_FIRSTPRIVATE_REFERENCE
:
853 pp_string (pp
, "firstprivate ref");
855 case GOMP_MAP_STRUCT
:
856 pp_string (pp
, "struct");
858 case GOMP_MAP_ALWAYS_POINTER
:
859 pp_string (pp
, "always_pointer");
861 case GOMP_MAP_DEVICE_RESIDENT
:
862 pp_string (pp
, "device_resident");
865 pp_string (pp
, "link");
867 case GOMP_MAP_ATTACH
:
868 pp_string (pp
, "attach");
870 case GOMP_MAP_DETACH
:
871 pp_string (pp
, "detach");
873 case GOMP_MAP_FORCE_DETACH
:
874 pp_string (pp
, "force_detach");
876 case GOMP_MAP_ATTACH_DETACH
:
877 pp_string (pp
, "attach_detach");
883 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
886 if (OMP_CLAUSE_SIZE (clause
))
888 switch (OMP_CLAUSE_CODE (clause
) == OMP_CLAUSE_MAP
889 ? OMP_CLAUSE_MAP_KIND (clause
) : GOMP_MAP_TO
)
891 case GOMP_MAP_POINTER
:
892 case GOMP_MAP_FIRSTPRIVATE_POINTER
:
893 case GOMP_MAP_FIRSTPRIVATE_REFERENCE
:
894 case GOMP_MAP_ALWAYS_POINTER
:
895 pp_string (pp
, " [pointer assign, bias: ");
897 case GOMP_MAP_TO_PSET
:
898 pp_string (pp
, " [pointer set, len: ");
900 case GOMP_MAP_ATTACH
:
901 case GOMP_MAP_DETACH
:
902 case GOMP_MAP_FORCE_DETACH
:
903 case GOMP_MAP_ATTACH_DETACH
:
904 pp_string (pp
, " [bias: ");
907 pp_string (pp
, " [len: ");
910 dump_generic_node (pp
, OMP_CLAUSE_SIZE (clause
),
912 pp_right_bracket (pp
);
917 case OMP_CLAUSE_FROM
:
918 pp_string (pp
, "from(");
919 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
921 goto print_clause_size
;
924 pp_string (pp
, "to(");
925 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
927 goto print_clause_size
;
929 case OMP_CLAUSE__CACHE_
:
931 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
933 goto print_clause_size
;
935 case OMP_CLAUSE_NUM_TEAMS
:
936 pp_string (pp
, "num_teams(");
937 dump_generic_node (pp
, OMP_CLAUSE_NUM_TEAMS_EXPR (clause
),
942 case OMP_CLAUSE_THREAD_LIMIT
:
943 pp_string (pp
, "thread_limit(");
944 dump_generic_node (pp
, OMP_CLAUSE_THREAD_LIMIT_EXPR (clause
),
949 case OMP_CLAUSE_DEVICE
:
950 pp_string (pp
, "device(");
951 dump_generic_node (pp
, OMP_CLAUSE_DEVICE_ID (clause
),
956 case OMP_CLAUSE_DIST_SCHEDULE
:
957 pp_string (pp
, "dist_schedule(static");
958 if (OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR (clause
))
961 dump_generic_node (pp
,
962 OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR (clause
),
968 case OMP_CLAUSE_PROC_BIND
:
969 pp_string (pp
, "proc_bind(");
970 switch (OMP_CLAUSE_PROC_BIND_KIND (clause
))
972 case OMP_CLAUSE_PROC_BIND_MASTER
:
973 pp_string (pp
, "master");
975 case OMP_CLAUSE_PROC_BIND_CLOSE
:
976 pp_string (pp
, "close");
978 case OMP_CLAUSE_PROC_BIND_SPREAD
:
979 pp_string (pp
, "spread");
987 case OMP_CLAUSE_DEVICE_TYPE
:
988 pp_string (pp
, "device_type(");
989 switch (OMP_CLAUSE_DEVICE_TYPE_KIND (clause
))
991 case OMP_CLAUSE_DEVICE_TYPE_HOST
:
992 pp_string (pp
, "host");
994 case OMP_CLAUSE_DEVICE_TYPE_NOHOST
:
995 pp_string (pp
, "nohost");
997 case OMP_CLAUSE_DEVICE_TYPE_ANY
:
998 pp_string (pp
, "any");
1003 pp_right_paren (pp
);
1006 case OMP_CLAUSE_SAFELEN
:
1007 pp_string (pp
, "safelen(");
1008 dump_generic_node (pp
, OMP_CLAUSE_SAFELEN_EXPR (clause
),
1010 pp_right_paren (pp
);
1013 case OMP_CLAUSE_SIMDLEN
:
1014 pp_string (pp
, "simdlen(");
1015 dump_generic_node (pp
, OMP_CLAUSE_SIMDLEN_EXPR (clause
),
1017 pp_right_paren (pp
);
1020 case OMP_CLAUSE_PRIORITY
:
1021 pp_string (pp
, "priority(");
1022 dump_generic_node (pp
, OMP_CLAUSE_PRIORITY_EXPR (clause
),
1024 pp_right_paren (pp
);
1027 case OMP_CLAUSE_GRAINSIZE
:
1028 pp_string (pp
, "grainsize(");
1029 dump_generic_node (pp
, OMP_CLAUSE_GRAINSIZE_EXPR (clause
),
1031 pp_right_paren (pp
);
1034 case OMP_CLAUSE_NUM_TASKS
:
1035 pp_string (pp
, "num_tasks(");
1036 dump_generic_node (pp
, OMP_CLAUSE_NUM_TASKS_EXPR (clause
),
1038 pp_right_paren (pp
);
1041 case OMP_CLAUSE_HINT
:
1042 pp_string (pp
, "hint(");
1043 dump_generic_node (pp
, OMP_CLAUSE_HINT_EXPR (clause
),
1045 pp_right_paren (pp
);
1048 case OMP_CLAUSE_DEFAULTMAP
:
1049 pp_string (pp
, "defaultmap(");
1050 switch (OMP_CLAUSE_DEFAULTMAP_BEHAVIOR (clause
))
1052 case OMP_CLAUSE_DEFAULTMAP_ALLOC
:
1053 pp_string (pp
, "alloc");
1055 case OMP_CLAUSE_DEFAULTMAP_TO
:
1056 pp_string (pp
, "to");
1058 case OMP_CLAUSE_DEFAULTMAP_FROM
:
1059 pp_string (pp
, "from");
1061 case OMP_CLAUSE_DEFAULTMAP_TOFROM
:
1062 pp_string (pp
, "tofrom");
1064 case OMP_CLAUSE_DEFAULTMAP_FIRSTPRIVATE
:
1065 pp_string (pp
, "firstprivate");
1067 case OMP_CLAUSE_DEFAULTMAP_NONE
:
1068 pp_string (pp
, "none");
1070 case OMP_CLAUSE_DEFAULTMAP_DEFAULT
:
1071 pp_string (pp
, "default");
1076 switch (OMP_CLAUSE_DEFAULTMAP_CATEGORY (clause
))
1078 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_UNSPECIFIED
:
1080 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_SCALAR
:
1081 pp_string (pp
, ":scalar");
1083 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_AGGREGATE
:
1084 pp_string (pp
, ":aggregate");
1086 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_ALLOCATABLE
:
1087 pp_string (pp
, ":allocatable");
1089 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_POINTER
:
1090 pp_string (pp
, ":pointer");
1095 pp_right_paren (pp
);
1098 case OMP_CLAUSE_ORDER
:
1099 pp_string (pp
, "order(concurrent)");
1102 case OMP_CLAUSE_BIND
:
1103 pp_string (pp
, "bind(");
1104 switch (OMP_CLAUSE_BIND_KIND (clause
))
1106 case OMP_CLAUSE_BIND_TEAMS
:
1107 pp_string (pp
, "teams");
1109 case OMP_CLAUSE_BIND_PARALLEL
:
1110 pp_string (pp
, "parallel");
1112 case OMP_CLAUSE_BIND_THREAD
:
1113 pp_string (pp
, "thread");
1118 pp_right_paren (pp
);
1121 case OMP_CLAUSE__SIMDUID_
:
1122 pp_string (pp
, "_simduid_(");
1123 dump_generic_node (pp
, OMP_CLAUSE__SIMDUID__DECL (clause
),
1125 pp_right_paren (pp
);
1128 case OMP_CLAUSE__SIMT_
:
1129 pp_string (pp
, "_simt_");
1132 case OMP_CLAUSE_GANG
:
1133 pp_string (pp
, "gang");
1134 if (OMP_CLAUSE_GANG_EXPR (clause
) != NULL_TREE
)
1136 pp_string (pp
, "(num: ");
1137 dump_generic_node (pp
, OMP_CLAUSE_GANG_EXPR (clause
),
1140 if (OMP_CLAUSE_GANG_STATIC_EXPR (clause
) != NULL_TREE
)
1142 if (OMP_CLAUSE_GANG_EXPR (clause
) == NULL_TREE
)
1146 pp_string (pp
, "static:");
1147 if (OMP_CLAUSE_GANG_STATIC_EXPR (clause
)
1148 == integer_minus_one_node
)
1149 pp_character (pp
, '*');
1151 dump_generic_node (pp
, OMP_CLAUSE_GANG_STATIC_EXPR (clause
),
1154 if (OMP_CLAUSE_GANG_EXPR (clause
) != NULL_TREE
1155 || OMP_CLAUSE_GANG_STATIC_EXPR (clause
) != NULL_TREE
)
1156 pp_right_paren (pp
);
1159 case OMP_CLAUSE_ASYNC
:
1160 pp_string (pp
, "async");
1161 if (OMP_CLAUSE_ASYNC_EXPR (clause
))
1163 pp_character(pp
, '(');
1164 dump_generic_node (pp
, OMP_CLAUSE_ASYNC_EXPR (clause
),
1166 pp_character(pp
, ')');
1170 case OMP_CLAUSE_AUTO
:
1171 case OMP_CLAUSE_SEQ
:
1172 pp_string (pp
, omp_clause_code_name
[OMP_CLAUSE_CODE (clause
)]);
1175 case OMP_CLAUSE_WAIT
:
1176 pp_string (pp
, "wait(");
1177 dump_generic_node (pp
, OMP_CLAUSE_WAIT_EXPR (clause
),
1179 pp_character(pp
, ')');
1182 case OMP_CLAUSE_WORKER
:
1183 pp_string (pp
, "worker");
1184 if (OMP_CLAUSE_WORKER_EXPR (clause
) != NULL_TREE
)
1187 dump_generic_node (pp
, OMP_CLAUSE_WORKER_EXPR (clause
),
1189 pp_right_paren (pp
);
1193 case OMP_CLAUSE_VECTOR
:
1194 pp_string (pp
, "vector");
1195 if (OMP_CLAUSE_VECTOR_EXPR (clause
) != NULL_TREE
)
1198 dump_generic_node (pp
, OMP_CLAUSE_VECTOR_EXPR (clause
),
1200 pp_right_paren (pp
);
1204 case OMP_CLAUSE_NUM_GANGS
:
1205 pp_string (pp
, "num_gangs(");
1206 dump_generic_node (pp
, OMP_CLAUSE_NUM_GANGS_EXPR (clause
),
1208 pp_character (pp
, ')');
1211 case OMP_CLAUSE_NUM_WORKERS
:
1212 pp_string (pp
, "num_workers(");
1213 dump_generic_node (pp
, OMP_CLAUSE_NUM_WORKERS_EXPR (clause
),
1215 pp_character (pp
, ')');
1218 case OMP_CLAUSE_VECTOR_LENGTH
:
1219 pp_string (pp
, "vector_length(");
1220 dump_generic_node (pp
, OMP_CLAUSE_VECTOR_LENGTH_EXPR (clause
),
1222 pp_character (pp
, ')');
1225 case OMP_CLAUSE_INBRANCH
:
1226 pp_string (pp
, "inbranch");
1228 case OMP_CLAUSE_NOTINBRANCH
:
1229 pp_string (pp
, "notinbranch");
1231 case OMP_CLAUSE_FOR
:
1232 pp_string (pp
, "for");
1234 case OMP_CLAUSE_PARALLEL
:
1235 pp_string (pp
, "parallel");
1237 case OMP_CLAUSE_SECTIONS
:
1238 pp_string (pp
, "sections");
1240 case OMP_CLAUSE_TASKGROUP
:
1241 pp_string (pp
, "taskgroup");
1243 case OMP_CLAUSE_NOGROUP
:
1244 pp_string (pp
, "nogroup");
1246 case OMP_CLAUSE_THREADS
:
1247 pp_string (pp
, "threads");
1249 case OMP_CLAUSE_SIMD
:
1250 pp_string (pp
, "simd");
1252 case OMP_CLAUSE_INDEPENDENT
:
1253 pp_string (pp
, "independent");
1255 case OMP_CLAUSE_TILE
:
1256 pp_string (pp
, "tile(");
1257 dump_generic_node (pp
, OMP_CLAUSE_TILE_LIST (clause
),
1259 pp_right_paren (pp
);
1262 case OMP_CLAUSE_IF_PRESENT
:
1263 pp_string (pp
, "if_present");
1265 case OMP_CLAUSE_FINALIZE
:
1266 pp_string (pp
, "finalize");
1268 case OMP_CLAUSE_DETACH
:
1269 pp_string (pp
, "detach(");
1270 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
), spc
, flags
,
1272 pp_right_paren (pp
);
1281 /* Dump the list of OpenMP clauses. PP, SPC and FLAGS are as in
1282 dump_generic_node. */
1285 dump_omp_clauses (pretty_printer
*pp
, tree clause
, int spc
, dump_flags_t flags
)
1293 dump_omp_clause (pp
, clause
, spc
, flags
);
1294 clause
= OMP_CLAUSE_CHAIN (clause
);
1302 /* Dump location LOC to PP. */
1305 dump_location (pretty_printer
*pp
, location_t loc
)
1307 expanded_location xloc
= expand_location (loc
);
1309 pp_left_bracket (pp
);
1312 pp_string (pp
, xloc
.file
);
1313 pp_string (pp
, ":");
1315 pp_decimal_int (pp
, xloc
.line
);
1317 pp_decimal_int (pp
, xloc
.column
);
1318 pp_string (pp
, "] ");
1322 /* Dump lexical block BLOCK. PP, SPC and FLAGS are as in
1323 dump_generic_node. */
1326 dump_block_node (pretty_printer
*pp
, tree block
, int spc
, dump_flags_t flags
)
1330 pp_printf (pp
, "BLOCK #%d ", BLOCK_NUMBER (block
));
1332 if (flags
& TDF_ADDRESS
)
1333 pp_printf (pp
, "[%p] ", (void *) block
);
1335 if (TREE_ASM_WRITTEN (block
))
1336 pp_string (pp
, "[written] ");
1338 if (flags
& TDF_SLIM
)
1341 if (BLOCK_SOURCE_LOCATION (block
))
1342 dump_location (pp
, BLOCK_SOURCE_LOCATION (block
));
1344 newline_and_indent (pp
, spc
+ 2);
1346 if (BLOCK_SUPERCONTEXT (block
))
1348 pp_string (pp
, "SUPERCONTEXT: ");
1349 dump_generic_node (pp
, BLOCK_SUPERCONTEXT (block
), 0,
1350 flags
| TDF_SLIM
, false);
1351 newline_and_indent (pp
, spc
+ 2);
1354 if (BLOCK_SUBBLOCKS (block
))
1356 pp_string (pp
, "SUBBLOCKS: ");
1357 for (t
= BLOCK_SUBBLOCKS (block
); t
; t
= BLOCK_CHAIN (t
))
1359 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
1362 newline_and_indent (pp
, spc
+ 2);
1365 if (BLOCK_CHAIN (block
))
1367 pp_string (pp
, "SIBLINGS: ");
1368 for (t
= BLOCK_CHAIN (block
); t
; t
= BLOCK_CHAIN (t
))
1370 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
1373 newline_and_indent (pp
, spc
+ 2);
1376 if (BLOCK_VARS (block
))
1378 pp_string (pp
, "VARS: ");
1379 for (t
= BLOCK_VARS (block
); t
; t
= TREE_CHAIN (t
))
1381 dump_generic_node (pp
, t
, 0, flags
, false);
1384 newline_and_indent (pp
, spc
+ 2);
1387 if (vec_safe_length (BLOCK_NONLOCALIZED_VARS (block
)) > 0)
1390 vec
<tree
, va_gc
> *nlv
= BLOCK_NONLOCALIZED_VARS (block
);
1392 pp_string (pp
, "NONLOCALIZED_VARS: ");
1393 FOR_EACH_VEC_ELT (*nlv
, i
, t
)
1395 dump_generic_node (pp
, t
, 0, flags
, false);
1398 newline_and_indent (pp
, spc
+ 2);
1401 if (BLOCK_ABSTRACT_ORIGIN (block
))
1403 pp_string (pp
, "ABSTRACT_ORIGIN: ");
1404 dump_generic_node (pp
, BLOCK_ABSTRACT_ORIGIN (block
), 0,
1405 flags
| TDF_SLIM
, false);
1406 newline_and_indent (pp
, spc
+ 2);
1409 if (BLOCK_FRAGMENT_ORIGIN (block
))
1411 pp_string (pp
, "FRAGMENT_ORIGIN: ");
1412 dump_generic_node (pp
, BLOCK_FRAGMENT_ORIGIN (block
), 0,
1413 flags
| TDF_SLIM
, false);
1414 newline_and_indent (pp
, spc
+ 2);
1417 if (BLOCK_FRAGMENT_CHAIN (block
))
1419 pp_string (pp
, "FRAGMENT_CHAIN: ");
1420 for (t
= BLOCK_FRAGMENT_CHAIN (block
); t
; t
= BLOCK_FRAGMENT_CHAIN (t
))
1422 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
1425 newline_and_indent (pp
, spc
+ 2);
1429 /* Dump #pragma omp atomic memory order clause. */
1432 dump_omp_atomic_memory_order (pretty_printer
*pp
, enum omp_memory_order mo
)
1436 case OMP_MEMORY_ORDER_RELAXED
:
1437 pp_string (pp
, " relaxed");
1439 case OMP_MEMORY_ORDER_SEQ_CST
:
1440 pp_string (pp
, " seq_cst");
1442 case OMP_MEMORY_ORDER_ACQ_REL
:
1443 pp_string (pp
, " acq_rel");
1445 case OMP_MEMORY_ORDER_ACQUIRE
:
1446 pp_string (pp
, " acquire");
1448 case OMP_MEMORY_ORDER_RELEASE
:
1449 pp_string (pp
, " release");
1451 case OMP_MEMORY_ORDER_UNSPECIFIED
:
1458 /* Helper to dump a MEM_REF node. */
1461 dump_mem_ref (pretty_printer
*pp
, tree node
, int spc
, dump_flags_t flags
)
1463 if (TREE_CODE (node
) == MEM_REF
&& (flags
& TDF_GIMPLE
))
1465 pp_string (pp
, "__MEM <");
1466 dump_generic_node (pp
, TREE_TYPE (node
),
1467 spc
, flags
| TDF_SLIM
, false);
1468 if (TYPE_ALIGN (TREE_TYPE (node
))
1469 != TYPE_ALIGN (TYPE_MAIN_VARIANT (TREE_TYPE (node
))))
1471 pp_string (pp
, ", ");
1472 pp_decimal_int (pp
, TYPE_ALIGN (TREE_TYPE (node
)));
1475 pp_string (pp
, " (");
1476 if (TREE_TYPE (TREE_OPERAND (node
, 0))
1477 != TREE_TYPE (TREE_OPERAND (node
, 1)))
1480 dump_generic_node (pp
, TREE_TYPE (TREE_OPERAND (node
, 1)),
1481 spc
, flags
| TDF_SLIM
, false);
1482 pp_right_paren (pp
);
1484 dump_generic_node (pp
, TREE_OPERAND (node
, 0),
1485 spc
, flags
| TDF_SLIM
, false);
1486 if (! integer_zerop (TREE_OPERAND (node
, 1)))
1488 pp_string (pp
, " + ");
1489 dump_generic_node (pp
, TREE_OPERAND (node
, 1),
1490 spc
, flags
| TDF_SLIM
, false);
1492 pp_right_paren (pp
);
1494 else if (TREE_CODE (node
) == MEM_REF
1495 && integer_zerop (TREE_OPERAND (node
, 1))
1496 /* Dump the types of INTEGER_CSTs explicitly, for we can't
1497 infer them and MEM_ATTR caching will share MEM_REFs
1498 with differently-typed op0s. */
1499 && TREE_CODE (TREE_OPERAND (node
, 0)) != INTEGER_CST
1500 /* Released SSA_NAMES have no TREE_TYPE. */
1501 && TREE_TYPE (TREE_OPERAND (node
, 0)) != NULL_TREE
1502 /* Same pointer types, but ignoring POINTER_TYPE vs.
1504 && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 0)))
1505 == TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 1))))
1506 && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (node
, 0)))
1507 == TYPE_MODE (TREE_TYPE (TREE_OPERAND (node
, 1))))
1508 && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node
, 0)))
1509 == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node
, 1))))
1510 /* Same value types ignoring qualifiers. */
1511 && (TYPE_MAIN_VARIANT (TREE_TYPE (node
))
1512 == TYPE_MAIN_VARIANT
1513 (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 1)))))
1514 && (!(flags
& TDF_ALIAS
)
1515 || MR_DEPENDENCE_CLIQUE (node
) == 0))
1517 if (TREE_CODE (TREE_OPERAND (node
, 0)) != ADDR_EXPR
)
1519 /* Enclose pointers to arrays in parentheses. */
1520 tree op0
= TREE_OPERAND (node
, 0);
1521 tree op0type
= TREE_TYPE (op0
);
1522 if (POINTER_TYPE_P (op0type
)
1523 && TREE_CODE (TREE_TYPE (op0type
)) == ARRAY_TYPE
)
1526 dump_generic_node (pp
, op0
, spc
, flags
, false);
1527 if (POINTER_TYPE_P (op0type
)
1528 && TREE_CODE (TREE_TYPE (op0type
)) == ARRAY_TYPE
)
1529 pp_right_paren (pp
);
1532 dump_generic_node (pp
,
1533 TREE_OPERAND (TREE_OPERAND (node
, 0), 0),
1538 pp_string (pp
, "MEM");
1540 tree nodetype
= TREE_TYPE (node
);
1541 tree op0
= TREE_OPERAND (node
, 0);
1542 tree op1
= TREE_OPERAND (node
, 1);
1543 tree op1type
= TYPE_MAIN_VARIANT (TREE_TYPE (op1
));
1545 tree op0size
= TYPE_SIZE (nodetype
);
1546 tree op1size
= TYPE_SIZE (TREE_TYPE (op1type
));
1548 if (!op0size
|| !op1size
1549 || !operand_equal_p (op0size
, op1size
, 0))
1551 pp_string (pp
, " <");
1552 /* If the size of the type of the operand is not the same
1553 as the size of the MEM_REF expression include the type
1554 of the latter similar to the TDF_GIMPLE output to make
1555 it clear how many bytes of memory are being accessed. */
1556 dump_generic_node (pp
, nodetype
, spc
, flags
| TDF_SLIM
, false);
1557 pp_string (pp
, "> ");
1560 pp_string (pp
, "[(");
1561 dump_generic_node (pp
, op1type
, spc
, flags
| TDF_SLIM
, false);
1562 pp_right_paren (pp
);
1563 dump_generic_node (pp
, op0
, spc
, flags
, false);
1564 if (!integer_zerop (op1
))
1566 pp_string (pp
, " + ");
1567 dump_generic_node (pp
, op1
, spc
, flags
, false);
1569 if (TREE_CODE (node
) == TARGET_MEM_REF
)
1571 tree tmp
= TMR_INDEX2 (node
);
1574 pp_string (pp
, " + ");
1575 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1577 tmp
= TMR_INDEX (node
);
1580 pp_string (pp
, " + ");
1581 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1582 tmp
= TMR_STEP (node
);
1583 pp_string (pp
, " * ");
1585 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1587 pp_string (pp
, "1");
1590 if ((flags
& TDF_ALIAS
)
1591 && MR_DEPENDENCE_CLIQUE (node
) != 0)
1593 pp_string (pp
, " clique ");
1594 pp_unsigned_wide_integer (pp
, MR_DEPENDENCE_CLIQUE (node
));
1595 pp_string (pp
, " base ");
1596 pp_unsigned_wide_integer (pp
, MR_DEPENDENCE_BASE (node
));
1598 pp_right_bracket (pp
);
1602 /* Helper function for dump_generic_node. Dump INIT or COND expression for
1603 OpenMP loop non-rectangular iterators. */
1606 dump_omp_loop_non_rect_expr (pretty_printer
*pp
, tree node
, int spc
,
1609 gcc_assert (TREE_CODE (node
) == TREE_VEC
);
1610 dump_generic_node (pp
, TREE_VEC_ELT (node
, 0), spc
, flags
, false);
1611 pp_string (pp
, " * ");
1612 if (op_prio (TREE_VEC_ELT (node
, 1)) <= op_code_prio (MULT_EXPR
))
1615 dump_generic_node (pp
, TREE_VEC_ELT (node
, 1), spc
, flags
, false);
1616 pp_right_paren (pp
);
1619 dump_generic_node (pp
, TREE_VEC_ELT (node
, 1), spc
, flags
, false);
1620 pp_string (pp
, " + ");
1621 if (op_prio (TREE_VEC_ELT (node
, 1)) <= op_code_prio (PLUS_EXPR
))
1624 dump_generic_node (pp
, TREE_VEC_ELT (node
, 2), spc
, flags
, false);
1625 pp_right_paren (pp
);
1628 dump_generic_node (pp
, TREE_VEC_ELT (node
, 2), spc
, flags
, false);
1631 /* Dump the node NODE on the pretty_printer PP, SPC spaces of
1632 indent. FLAGS specifies details to show in the dump (see TDF_* in
1633 dumpfile.h). If IS_STMT is true, the object printed is considered
1634 to be a statement and it is terminated by ';' if appropriate. */
1637 dump_generic_node (pretty_printer
*pp
, tree node
, int spc
, dump_flags_t flags
,
1644 enum tree_code code
;
1646 if (node
== NULL_TREE
)
1649 is_expr
= EXPR_P (node
);
1651 if (is_stmt
&& (flags
& TDF_STMTADDR
))
1652 pp_printf (pp
, "<&%p> ", (void *)node
);
1654 if ((flags
& TDF_LINENO
) && EXPR_HAS_LOCATION (node
))
1655 dump_location (pp
, EXPR_LOCATION (node
));
1657 code
= TREE_CODE (node
);
1661 pp_string (pp
, "<<< error >>>");
1664 case IDENTIFIER_NODE
:
1665 pp_tree_identifier (pp
, node
);
1669 while (node
&& node
!= error_mark_node
)
1671 if (TREE_PURPOSE (node
))
1673 dump_generic_node (pp
, TREE_PURPOSE (node
), spc
, flags
, false);
1676 dump_generic_node (pp
, TREE_VALUE (node
), spc
, flags
, false);
1677 node
= TREE_CHAIN (node
);
1678 if (node
&& TREE_CODE (node
) == TREE_LIST
)
1687 dump_generic_node (pp
, BINFO_TYPE (node
), spc
, flags
, false);
1693 if (TREE_VEC_LENGTH (node
) > 0)
1695 size_t len
= TREE_VEC_LENGTH (node
);
1696 for (i
= 0; i
< len
- 1; i
++)
1698 dump_generic_node (pp
, TREE_VEC_ELT (node
, i
), spc
, flags
,
1703 dump_generic_node (pp
, TREE_VEC_ELT (node
, len
- 1), spc
,
1712 case FIXED_POINT_TYPE
:
1719 unsigned int quals
= TYPE_QUALS (node
);
1720 enum tree_code_class tclass
;
1722 if (quals
& TYPE_QUAL_ATOMIC
)
1723 pp_string (pp
, "atomic ");
1724 if (quals
& TYPE_QUAL_CONST
)
1725 pp_string (pp
, "const ");
1726 if (quals
& TYPE_QUAL_VOLATILE
)
1727 pp_string (pp
, "volatile ");
1728 if (quals
& TYPE_QUAL_RESTRICT
)
1729 pp_string (pp
, "restrict ");
1731 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
1733 pp_string (pp
, "<address-space-");
1734 pp_decimal_int (pp
, TYPE_ADDR_SPACE (node
));
1735 pp_string (pp
, "> ");
1738 tclass
= TREE_CODE_CLASS (TREE_CODE (node
));
1740 if (tclass
== tcc_declaration
)
1742 if (DECL_NAME (node
))
1743 dump_decl_name (pp
, node
, flags
);
1745 pp_string (pp
, "<unnamed type decl>");
1747 else if (tclass
== tcc_type
)
1749 if (TYPE_NAME (node
))
1751 if (TREE_CODE (TYPE_NAME (node
)) == IDENTIFIER_NODE
)
1752 pp_tree_identifier (pp
, TYPE_NAME (node
));
1753 else if (TREE_CODE (TYPE_NAME (node
)) == TYPE_DECL
1754 && DECL_NAME (TYPE_NAME (node
)))
1755 dump_decl_name (pp
, TYPE_NAME (node
), flags
);
1757 pp_string (pp
, "<unnamed type>");
1759 else if (TREE_CODE (node
) == VECTOR_TYPE
)
1761 pp_string (pp
, "vector");
1763 pp_wide_integer (pp
, TYPE_VECTOR_SUBPARTS (node
));
1764 pp_string (pp
, ") ");
1765 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1767 else if (TREE_CODE (node
) == INTEGER_TYPE
)
1769 if (TYPE_PRECISION (node
) == CHAR_TYPE_SIZE
)
1770 pp_string (pp
, (TYPE_UNSIGNED (node
)
1773 else if (TYPE_PRECISION (node
) == SHORT_TYPE_SIZE
)
1774 pp_string (pp
, (TYPE_UNSIGNED (node
)
1777 else if (TYPE_PRECISION (node
) == INT_TYPE_SIZE
)
1778 pp_string (pp
, (TYPE_UNSIGNED (node
)
1781 else if (TYPE_PRECISION (node
) == LONG_TYPE_SIZE
)
1782 pp_string (pp
, (TYPE_UNSIGNED (node
)
1785 else if (TYPE_PRECISION (node
) == LONG_LONG_TYPE_SIZE
)
1786 pp_string (pp
, (TYPE_UNSIGNED (node
)
1787 ? "unsigned long long"
1788 : "signed long long"));
1789 else if (TYPE_PRECISION (node
) >= CHAR_TYPE_SIZE
1790 && pow2p_hwi (TYPE_PRECISION (node
)))
1792 pp_string (pp
, (TYPE_UNSIGNED (node
) ? "uint" : "int"));
1793 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1794 pp_string (pp
, "_t");
1798 pp_string (pp
, (TYPE_UNSIGNED (node
)
1799 ? "<unnamed-unsigned:"
1800 : "<unnamed-signed:"));
1801 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1805 else if (TREE_CODE (node
) == COMPLEX_TYPE
)
1807 pp_string (pp
, "__complex__ ");
1808 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1810 else if (TREE_CODE (node
) == REAL_TYPE
)
1812 pp_string (pp
, "<float:");
1813 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1816 else if (TREE_CODE (node
) == FIXED_POINT_TYPE
)
1818 pp_string (pp
, "<fixed-point-");
1819 pp_string (pp
, TYPE_SATURATING (node
) ? "sat:" : "nonsat:");
1820 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1823 else if (TREE_CODE (node
) == BOOLEAN_TYPE
)
1825 pp_string (pp
, (TYPE_UNSIGNED (node
)
1826 ? "<unsigned-boolean:"
1827 : "<signed-boolean:"));
1828 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1831 else if (TREE_CODE (node
) == VOID_TYPE
)
1832 pp_string (pp
, "void");
1834 pp_string (pp
, "<unnamed type>");
1840 case REFERENCE_TYPE
:
1841 str
= (TREE_CODE (node
) == POINTER_TYPE
? "*" : "&");
1843 if (TREE_TYPE (node
) == NULL
)
1845 pp_string (pp
, str
);
1846 pp_string (pp
, "<null type>");
1848 else if (TREE_CODE (TREE_TYPE (node
)) == FUNCTION_TYPE
)
1850 tree fnode
= TREE_TYPE (node
);
1852 dump_generic_node (pp
, TREE_TYPE (fnode
), spc
, flags
, false);
1855 pp_string (pp
, str
);
1856 if (TYPE_IDENTIFIER (node
))
1857 dump_generic_node (pp
, TYPE_NAME (node
), spc
, flags
, false);
1858 else if (flags
& TDF_NOUID
)
1859 pp_printf (pp
, "<Txxxx>");
1861 pp_printf (pp
, "<T%x>", TYPE_UID (node
));
1863 pp_right_paren (pp
);
1864 dump_function_declaration (pp
, fnode
, spc
, flags
);
1868 unsigned int quals
= TYPE_QUALS (node
);
1870 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1872 pp_string (pp
, str
);
1874 if (quals
& TYPE_QUAL_CONST
)
1875 pp_string (pp
, " const");
1876 if (quals
& TYPE_QUAL_VOLATILE
)
1877 pp_string (pp
, " volatile");
1878 if (quals
& TYPE_QUAL_RESTRICT
)
1879 pp_string (pp
, " restrict");
1881 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
1883 pp_string (pp
, " <address-space-");
1884 pp_decimal_int (pp
, TYPE_ADDR_SPACE (node
));
1888 if (TYPE_REF_CAN_ALIAS_ALL (node
))
1889 pp_string (pp
, " {ref-all}");
1898 case TARGET_MEM_REF
:
1899 dump_mem_ref (pp
, node
, spc
, flags
);
1904 unsigned int quals
= TYPE_QUALS (node
);
1907 if (quals
& TYPE_QUAL_ATOMIC
)
1908 pp_string (pp
, "atomic ");
1909 if (quals
& TYPE_QUAL_CONST
)
1910 pp_string (pp
, "const ");
1911 if (quals
& TYPE_QUAL_VOLATILE
)
1912 pp_string (pp
, "volatile ");
1914 /* Print the innermost component type. */
1915 for (tmp
= TREE_TYPE (node
); TREE_CODE (tmp
) == ARRAY_TYPE
;
1916 tmp
= TREE_TYPE (tmp
))
1918 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1920 /* Print the dimensions. */
1921 for (tmp
= node
; TREE_CODE (tmp
) == ARRAY_TYPE
; tmp
= TREE_TYPE (tmp
))
1922 dump_array_domain (pp
, TYPE_DOMAIN (tmp
), spc
, flags
);
1928 case QUAL_UNION_TYPE
:
1930 unsigned int quals
= TYPE_QUALS (node
);
1932 if (quals
& TYPE_QUAL_ATOMIC
)
1933 pp_string (pp
, "atomic ");
1934 if (quals
& TYPE_QUAL_CONST
)
1935 pp_string (pp
, "const ");
1936 if (quals
& TYPE_QUAL_VOLATILE
)
1937 pp_string (pp
, "volatile ");
1939 /* Print the name of the structure. */
1940 if (TREE_CODE (node
) == RECORD_TYPE
)
1941 pp_string (pp
, "struct ");
1942 else if (TREE_CODE (node
) == UNION_TYPE
)
1943 pp_string (pp
, "union ");
1945 if (TYPE_NAME (node
))
1946 dump_generic_node (pp
, TYPE_NAME (node
), spc
, flags
, false);
1947 else if (!(flags
& TDF_SLIM
))
1948 /* FIXME: If we eliminate the 'else' above and attempt
1949 to show the fields for named types, we may get stuck
1950 following a cycle of pointers to structs. The alleged
1951 self-reference check in print_struct_decl will not detect
1952 cycles involving more than one pointer or struct type. */
1953 print_struct_decl (pp
, node
, spc
, flags
);
1962 if (flags
& TDF_GIMPLE
1963 && (POINTER_TYPE_P (TREE_TYPE (node
))
1964 || (TYPE_PRECISION (TREE_TYPE (node
))
1965 < TYPE_PRECISION (integer_type_node
))
1966 || exact_log2 (TYPE_PRECISION (TREE_TYPE (node
))) == -1
1967 || tree_int_cst_sgn (node
) < 0))
1969 pp_string (pp
, "_Literal (");
1970 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1971 pp_string (pp
, ") ");
1973 if (TREE_CODE (TREE_TYPE (node
)) == POINTER_TYPE
1974 && ! (flags
& TDF_GIMPLE
))
1976 /* In the case of a pointer, one may want to divide by the
1977 size of the pointed-to type. Unfortunately, this not
1978 straightforward. The C front-end maps expressions
1983 in such a way that the two INTEGER_CST nodes for "5" have
1984 different values but identical types. In the latter
1985 case, the 5 is multiplied by sizeof (int) in c-common.c
1986 (pointer_int_sum) to convert it to a byte address, and
1987 yet the type of the node is left unchanged. Argh. What
1988 is consistent though is that the number value corresponds
1989 to bytes (UNITS) offset.
1991 NB: Neither of the following divisors can be trivially
1992 used to recover the original literal:
1994 TREE_INT_CST_LOW (TYPE_SIZE_UNIT (TREE_TYPE (node)))
1995 TYPE_PRECISION (TREE_TYPE (TREE_TYPE (node))) */
1996 pp_wide_integer (pp
, TREE_INT_CST_LOW (node
));
1997 pp_string (pp
, "B"); /* pseudo-unit */
1999 else if (tree_fits_shwi_p (node
))
2000 pp_wide_integer (pp
, tree_to_shwi (node
));
2001 else if (tree_fits_uhwi_p (node
))
2002 pp_unsigned_wide_integer (pp
, tree_to_uhwi (node
));
2005 wide_int val
= wi::to_wide (node
);
2007 if (wi::neg_p (val
, TYPE_SIGN (TREE_TYPE (node
))))
2012 print_hex (val
, pp_buffer (pp
)->digit_buffer
);
2013 pp_string (pp
, pp_buffer (pp
)->digit_buffer
);
2015 if ((flags
& TDF_GIMPLE
)
2016 && ! (POINTER_TYPE_P (TREE_TYPE (node
))
2017 || (TYPE_PRECISION (TREE_TYPE (node
))
2018 < TYPE_PRECISION (integer_type_node
))
2019 || exact_log2 (TYPE_PRECISION (TREE_TYPE (node
))) == -1))
2021 if (TYPE_UNSIGNED (TREE_TYPE (node
)))
2022 pp_character (pp
, 'u');
2023 if (TYPE_PRECISION (TREE_TYPE (node
))
2024 == TYPE_PRECISION (unsigned_type_node
))
2026 else if (TYPE_PRECISION (TREE_TYPE (node
))
2027 == TYPE_PRECISION (long_unsigned_type_node
))
2028 pp_character (pp
, 'l');
2029 else if (TYPE_PRECISION (TREE_TYPE (node
))
2030 == TYPE_PRECISION (long_long_unsigned_type_node
))
2031 pp_string (pp
, "ll");
2033 if (TREE_OVERFLOW (node
))
2034 pp_string (pp
, "(OVF)");
2038 pp_string (pp
, "POLY_INT_CST [");
2039 dump_generic_node (pp
, POLY_INT_CST_COEFF (node
, 0), spc
, flags
, false);
2040 for (unsigned int i
= 1; i
< NUM_POLY_INT_COEFFS
; ++i
)
2042 pp_string (pp
, ", ");
2043 dump_generic_node (pp
, POLY_INT_CST_COEFF (node
, i
),
2046 pp_string (pp
, "]");
2050 /* Code copied from print_node. */
2053 if (TREE_OVERFLOW (node
))
2054 pp_string (pp
, " overflow");
2056 d
= TREE_REAL_CST (node
);
2057 if (REAL_VALUE_ISINF (d
))
2058 pp_string (pp
, REAL_VALUE_NEGATIVE (d
) ? " -Inf" : " Inf");
2059 else if (REAL_VALUE_ISNAN (d
))
2060 pp_string (pp
, " Nan");
2064 real_to_decimal (string
, &d
, sizeof (string
), 0, 1);
2065 pp_string (pp
, string
);
2073 fixed_to_decimal (string
, TREE_FIXED_CST_PTR (node
), sizeof (string
));
2074 pp_string (pp
, string
);
2079 pp_string (pp
, "__complex__ (");
2080 dump_generic_node (pp
, TREE_REALPART (node
), spc
, flags
, false);
2081 pp_string (pp
, ", ");
2082 dump_generic_node (pp
, TREE_IMAGPART (node
), spc
, flags
, false);
2083 pp_right_paren (pp
);
2088 pp_string (pp
, "\"");
2089 if (unsigned nbytes
= TREE_STRING_LENGTH (node
))
2090 pretty_print_string (pp
, TREE_STRING_POINTER (node
), nbytes
);
2091 pp_string (pp
, "\"");
2098 if (flags
& TDF_GIMPLE
)
2100 pp_string (pp
, "_Literal (");
2101 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2102 pp_string (pp
, ") ");
2104 pp_string (pp
, "{ ");
2105 unsigned HOST_WIDE_INT nunits
;
2106 if (!VECTOR_CST_NELTS (node
).is_constant (&nunits
))
2107 nunits
= vector_cst_encoded_nelts (node
);
2108 for (i
= 0; i
< nunits
; ++i
)
2111 pp_string (pp
, ", ");
2112 dump_generic_node (pp
, VECTOR_CST_ELT (node
, i
),
2115 if (!VECTOR_CST_NELTS (node
).is_constant ())
2116 pp_string (pp
, ", ...");
2117 pp_string (pp
, " }");
2123 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2125 if (TREE_CODE (node
) == METHOD_TYPE
)
2127 if (TYPE_METHOD_BASETYPE (node
))
2128 dump_generic_node (pp
, TYPE_NAME (TYPE_METHOD_BASETYPE (node
)),
2131 pp_string (pp
, "<null method basetype>");
2132 pp_colon_colon (pp
);
2134 if (TYPE_IDENTIFIER (node
))
2135 dump_generic_node (pp
, TYPE_NAME (node
), spc
, flags
, false);
2136 else if (TYPE_NAME (node
) && DECL_NAME (TYPE_NAME (node
)))
2137 dump_decl_name (pp
, TYPE_NAME (node
), flags
);
2138 else if (flags
& TDF_NOUID
)
2139 pp_printf (pp
, "<Txxxx>");
2141 pp_printf (pp
, "<T%x>", TYPE_UID (node
));
2142 dump_function_declaration (pp
, node
, spc
, flags
);
2147 dump_decl_name (pp
, node
, flags
);
2151 if (DECL_NAME (node
))
2152 dump_decl_name (pp
, node
, flags
);
2153 else if (LABEL_DECL_UID (node
) != -1)
2155 if (flags
& TDF_GIMPLE
)
2156 pp_printf (pp
, "L%d", (int) LABEL_DECL_UID (node
));
2158 pp_printf (pp
, "<L%d>", (int) LABEL_DECL_UID (node
));
2162 if (flags
& TDF_NOUID
)
2163 pp_string (pp
, "<D.xxxx>");
2166 if (flags
& TDF_GIMPLE
)
2167 pp_printf (pp
, "<D%u>", DECL_UID (node
));
2169 pp_printf (pp
, "<D.%u>", DECL_UID (node
));
2175 if (DECL_IS_UNDECLARED_BUILTIN (node
))
2177 /* Don't print the declaration of built-in types. */
2180 if (DECL_NAME (node
))
2181 dump_decl_name (pp
, node
, flags
);
2182 else if (TYPE_NAME (TREE_TYPE (node
)) != node
)
2184 pp_string (pp
, (TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
2185 ? "union" : "struct "));
2186 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2189 pp_string (pp
, "<anon>");
2195 case DEBUG_EXPR_DECL
:
2196 case NAMESPACE_DECL
:
2198 dump_decl_name (pp
, node
, flags
);
2202 pp_string (pp
, "<retval>");
2206 op0
= TREE_OPERAND (node
, 0);
2209 && (TREE_CODE (op0
) == INDIRECT_REF
2210 || (TREE_CODE (op0
) == MEM_REF
2211 && TREE_CODE (TREE_OPERAND (op0
, 0)) != ADDR_EXPR
2212 && integer_zerop (TREE_OPERAND (op0
, 1))
2213 /* Dump the types of INTEGER_CSTs explicitly, for we
2214 can't infer them and MEM_ATTR caching will share
2215 MEM_REFs with differently-typed op0s. */
2216 && TREE_CODE (TREE_OPERAND (op0
, 0)) != INTEGER_CST
2217 /* Released SSA_NAMES have no TREE_TYPE. */
2218 && TREE_TYPE (TREE_OPERAND (op0
, 0)) != NULL_TREE
2219 /* Same pointer types, but ignoring POINTER_TYPE vs.
2221 && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 0)))
2222 == TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 1))))
2223 && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0
, 0)))
2224 == TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0
, 1))))
2225 && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0
, 0)))
2226 == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0
, 1))))
2227 /* Same value types ignoring qualifiers. */
2228 && (TYPE_MAIN_VARIANT (TREE_TYPE (op0
))
2229 == TYPE_MAIN_VARIANT
2230 (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 1)))))
2231 && MR_DEPENDENCE_CLIQUE (op0
) == 0)))
2233 op0
= TREE_OPERAND (op0
, 0);
2236 if (op_prio (op0
) < op_prio (node
))
2238 dump_generic_node (pp
, op0
, spc
, flags
, false);
2239 if (op_prio (op0
) < op_prio (node
))
2240 pp_right_paren (pp
);
2241 pp_string (pp
, str
);
2242 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2243 op0
= component_ref_field_offset (node
);
2244 if (op0
&& TREE_CODE (op0
) != INTEGER_CST
)
2246 pp_string (pp
, "{off: ");
2247 dump_generic_node (pp
, op0
, spc
, flags
, false);
2248 pp_right_brace (pp
);
2253 if (flags
& TDF_GIMPLE
)
2255 pp_string (pp
, "__BIT_FIELD_REF <");
2256 dump_generic_node (pp
, TREE_TYPE (node
),
2257 spc
, flags
| TDF_SLIM
, false);
2258 if (TYPE_ALIGN (TREE_TYPE (node
))
2259 != TYPE_ALIGN (TYPE_MAIN_VARIANT (TREE_TYPE (node
))))
2261 pp_string (pp
, ", ");
2262 pp_decimal_int (pp
, TYPE_ALIGN (TREE_TYPE (node
)));
2265 pp_string (pp
, " (");
2266 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
,
2267 flags
| TDF_SLIM
, false);
2268 pp_string (pp
, ", ");
2269 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
,
2270 flags
| TDF_SLIM
, false);
2271 pp_string (pp
, ", ");
2272 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
,
2273 flags
| TDF_SLIM
, false);
2274 pp_right_paren (pp
);
2278 pp_string (pp
, "BIT_FIELD_REF <");
2279 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2280 pp_string (pp
, ", ");
2281 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2282 pp_string (pp
, ", ");
2283 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2288 case BIT_INSERT_EXPR
:
2289 pp_string (pp
, "BIT_INSERT_EXPR <");
2290 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2291 pp_string (pp
, ", ");
2292 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2293 pp_string (pp
, ", ");
2294 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2295 pp_string (pp
, " (");
2296 if (INTEGRAL_TYPE_P (TREE_TYPE (TREE_OPERAND (node
, 1))))
2298 TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (node
, 1))));
2300 dump_generic_node (pp
, TYPE_SIZE (TREE_TYPE (TREE_OPERAND (node
, 1))),
2302 pp_string (pp
, " bits)>");
2306 case ARRAY_RANGE_REF
:
2307 op0
= TREE_OPERAND (node
, 0);
2308 if (op_prio (op0
) < op_prio (node
))
2310 dump_generic_node (pp
, op0
, spc
, flags
, false);
2311 if (op_prio (op0
) < op_prio (node
))
2312 pp_right_paren (pp
);
2313 pp_left_bracket (pp
);
2314 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2315 if (TREE_CODE (node
) == ARRAY_RANGE_REF
)
2316 pp_string (pp
, " ...");
2317 pp_right_bracket (pp
);
2319 op0
= array_ref_low_bound (node
);
2320 op1
= array_ref_element_size (node
);
2322 if (!integer_zerop (op0
)
2323 || TREE_OPERAND (node
, 2)
2324 || TREE_OPERAND (node
, 3))
2326 pp_string (pp
, "{lb: ");
2327 dump_generic_node (pp
, op0
, spc
, flags
, false);
2328 pp_string (pp
, " sz: ");
2329 dump_generic_node (pp
, op1
, spc
, flags
, false);
2330 pp_right_brace (pp
);
2336 unsigned HOST_WIDE_INT ix
;
2338 bool is_struct_init
= false;
2339 bool is_array_init
= false;
2341 if (flags
& TDF_GIMPLE
)
2343 pp_string (pp
, "_Literal (");
2344 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2345 pp_string (pp
, ") ");
2348 if (TREE_CLOBBER_P (node
))
2349 pp_string (pp
, "CLOBBER");
2350 else if (TREE_CODE (TREE_TYPE (node
)) == RECORD_TYPE
2351 || TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
)
2352 is_struct_init
= true;
2353 else if (TREE_CODE (TREE_TYPE (node
)) == ARRAY_TYPE
2354 && TYPE_DOMAIN (TREE_TYPE (node
))
2355 && TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
)))
2356 && TREE_CODE (TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
))))
2359 tree minv
= TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
)));
2360 is_array_init
= true;
2361 curidx
= wi::to_widest (minv
);
2363 FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (node
), ix
, field
, val
)
2370 dump_generic_node (pp
, field
, spc
, flags
, false);
2373 else if (is_array_init
2374 && (TREE_CODE (field
) != INTEGER_CST
2375 || curidx
!= wi::to_widest (field
)))
2377 pp_left_bracket (pp
);
2378 if (TREE_CODE (field
) == RANGE_EXPR
)
2380 dump_generic_node (pp
, TREE_OPERAND (field
, 0), spc
,
2382 pp_string (pp
, " ... ");
2383 dump_generic_node (pp
, TREE_OPERAND (field
, 1), spc
,
2385 if (TREE_CODE (TREE_OPERAND (field
, 1)) == INTEGER_CST
)
2386 curidx
= wi::to_widest (TREE_OPERAND (field
, 1));
2389 dump_generic_node (pp
, field
, spc
, flags
, false);
2390 if (TREE_CODE (field
) == INTEGER_CST
)
2391 curidx
= wi::to_widest (field
);
2392 pp_string (pp
, "]=");
2397 if (val
&& TREE_CODE (val
) == ADDR_EXPR
)
2398 if (TREE_CODE (TREE_OPERAND (val
, 0)) == FUNCTION_DECL
)
2399 val
= TREE_OPERAND (val
, 0);
2400 if (val
&& TREE_CODE (val
) == FUNCTION_DECL
)
2401 dump_decl_name (pp
, val
, flags
);
2403 dump_generic_node (pp
, val
, spc
, flags
, false);
2404 if (ix
!= CONSTRUCTOR_NELTS (node
) - 1)
2410 pp_right_brace (pp
);
2417 if (flags
& TDF_SLIM
)
2419 pp_string (pp
, "<COMPOUND_EXPR>");
2423 dump_generic_node (pp
, TREE_OPERAND (node
, 0),
2424 spc
, flags
, !(flags
& TDF_SLIM
));
2425 if (flags
& TDF_SLIM
)
2426 newline_and_indent (pp
, spc
);
2433 for (tp
= &TREE_OPERAND (node
, 1);
2434 TREE_CODE (*tp
) == COMPOUND_EXPR
;
2435 tp
= &TREE_OPERAND (*tp
, 1))
2437 dump_generic_node (pp
, TREE_OPERAND (*tp
, 0),
2438 spc
, flags
, !(flags
& TDF_SLIM
));
2439 if (flags
& TDF_SLIM
)
2440 newline_and_indent (pp
, spc
);
2448 dump_generic_node (pp
, *tp
, spc
, flags
, !(flags
& TDF_SLIM
));
2452 case STATEMENT_LIST
:
2454 tree_stmt_iterator si
;
2457 if (flags
& TDF_SLIM
)
2459 pp_string (pp
, "<STATEMENT_LIST>");
2463 for (si
= tsi_start (node
); !tsi_end_p (si
); tsi_next (&si
))
2466 newline_and_indent (pp
, spc
);
2469 dump_generic_node (pp
, tsi_stmt (si
), spc
, flags
, true);
2476 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
,
2481 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
,
2486 pp_string (pp
, "TARGET_EXPR <");
2487 dump_generic_node (pp
, TARGET_EXPR_SLOT (node
), spc
, flags
, false);
2490 dump_generic_node (pp
, TARGET_EXPR_INITIAL (node
), spc
, flags
, false);
2495 print_declaration (pp
, DECL_EXPR_DECL (node
), spc
, flags
);
2500 if (TREE_TYPE (node
) == NULL
|| TREE_TYPE (node
) == void_type_node
)
2502 pp_string (pp
, "if (");
2503 dump_generic_node (pp
, COND_EXPR_COND (node
), spc
, flags
, false);
2504 pp_right_paren (pp
);
2505 /* The lowered cond_exprs should always be printed in full. */
2506 if (COND_EXPR_THEN (node
)
2507 && (IS_EMPTY_STMT (COND_EXPR_THEN (node
))
2508 || TREE_CODE (COND_EXPR_THEN (node
)) == GOTO_EXPR
)
2509 && COND_EXPR_ELSE (node
)
2510 && (IS_EMPTY_STMT (COND_EXPR_ELSE (node
))
2511 || TREE_CODE (COND_EXPR_ELSE (node
)) == GOTO_EXPR
))
2514 dump_generic_node (pp
, COND_EXPR_THEN (node
),
2516 if (!IS_EMPTY_STMT (COND_EXPR_ELSE (node
)))
2518 pp_string (pp
, " else ");
2519 dump_generic_node (pp
, COND_EXPR_ELSE (node
),
2523 else if (!(flags
& TDF_SLIM
))
2525 /* Output COND_EXPR_THEN. */
2526 if (COND_EXPR_THEN (node
))
2528 newline_and_indent (pp
, spc
+2);
2530 newline_and_indent (pp
, spc
+4);
2531 dump_generic_node (pp
, COND_EXPR_THEN (node
), spc
+4,
2533 newline_and_indent (pp
, spc
+2);
2534 pp_right_brace (pp
);
2537 /* Output COND_EXPR_ELSE. */
2538 if (COND_EXPR_ELSE (node
)
2539 && !IS_EMPTY_STMT (COND_EXPR_ELSE (node
)))
2541 newline_and_indent (pp
, spc
);
2542 pp_string (pp
, "else");
2543 newline_and_indent (pp
, spc
+2);
2545 newline_and_indent (pp
, spc
+4);
2546 dump_generic_node (pp
, COND_EXPR_ELSE (node
), spc
+4,
2548 newline_and_indent (pp
, spc
+2);
2549 pp_right_brace (pp
);
2556 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2560 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2564 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2570 if (!(flags
& TDF_SLIM
))
2572 if (BIND_EXPR_VARS (node
))
2576 for (op0
= BIND_EXPR_VARS (node
); op0
; op0
= DECL_CHAIN (op0
))
2578 print_declaration (pp
, op0
, spc
+2, flags
);
2583 newline_and_indent (pp
, spc
+2);
2584 dump_generic_node (pp
, BIND_EXPR_BODY (node
), spc
+2, flags
, true);
2585 newline_and_indent (pp
, spc
);
2586 pp_right_brace (pp
);
2592 if (CALL_EXPR_FN (node
) != NULL_TREE
)
2593 print_call_name (pp
, CALL_EXPR_FN (node
), flags
);
2597 pp_string (pp
, internal_fn_name (CALL_EXPR_IFN (node
)));
2600 /* Print parameters. */
2605 call_expr_arg_iterator iter
;
2606 FOR_EACH_CALL_EXPR_ARG (arg
, iter
, node
)
2608 dump_generic_node (pp
, arg
, spc
, flags
, false);
2609 if (more_call_expr_args_p (&iter
))
2616 if (CALL_EXPR_VA_ARG_PACK (node
))
2618 if (call_expr_nargs (node
) > 0)
2623 pp_string (pp
, "__builtin_va_arg_pack ()");
2625 pp_right_paren (pp
);
2627 op1
= CALL_EXPR_STATIC_CHAIN (node
);
2630 pp_string (pp
, " [static-chain: ");
2631 dump_generic_node (pp
, op1
, spc
, flags
, false);
2632 pp_right_bracket (pp
);
2635 if (CALL_EXPR_RETURN_SLOT_OPT (node
))
2636 pp_string (pp
, " [return slot optimization]");
2637 if (CALL_EXPR_TAILCALL (node
))
2638 pp_string (pp
, " [tail call]");
2641 case WITH_CLEANUP_EXPR
:
2645 case CLEANUP_POINT_EXPR
:
2646 pp_string (pp
, "<<cleanup_point ");
2647 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2648 pp_string (pp
, ">>");
2651 case PLACEHOLDER_EXPR
:
2652 pp_string (pp
, "<PLACEHOLDER_EXPR ");
2653 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2657 /* Binary arithmetic and logic expressions. */
2658 case WIDEN_PLUS_EXPR
:
2659 case WIDEN_MINUS_EXPR
:
2660 case WIDEN_SUM_EXPR
:
2661 case WIDEN_MULT_EXPR
:
2663 case MULT_HIGHPART_EXPR
:
2665 case POINTER_PLUS_EXPR
:
2666 case POINTER_DIFF_EXPR
:
2668 case TRUNC_DIV_EXPR
:
2670 case FLOOR_DIV_EXPR
:
2671 case ROUND_DIV_EXPR
:
2672 case TRUNC_MOD_EXPR
:
2674 case FLOOR_MOD_EXPR
:
2675 case ROUND_MOD_EXPR
:
2677 case EXACT_DIV_EXPR
:
2682 case WIDEN_LSHIFT_EXPR
:
2686 case TRUTH_ANDIF_EXPR
:
2687 case TRUTH_ORIF_EXPR
:
2688 case TRUTH_AND_EXPR
:
2690 case TRUTH_XOR_EXPR
:
2704 case UNORDERED_EXPR
:
2706 const char *op
= op_symbol (node
);
2707 op0
= TREE_OPERAND (node
, 0);
2708 op1
= TREE_OPERAND (node
, 1);
2710 /* When the operands are expressions with less priority,
2711 keep semantics of the tree representation. */
2712 if (op_prio (op0
) <= op_prio (node
))
2715 dump_generic_node (pp
, op0
, spc
, flags
, false);
2716 pp_right_paren (pp
);
2719 dump_generic_node (pp
, op0
, spc
, flags
, false);
2725 /* When the operands are expressions with less priority,
2726 keep semantics of the tree representation. */
2727 if (op_prio (op1
) <= op_prio (node
))
2730 dump_generic_node (pp
, op1
, spc
, flags
, false);
2731 pp_right_paren (pp
);
2734 dump_generic_node (pp
, op1
, spc
, flags
, false);
2738 /* Unary arithmetic and logic expressions. */
2741 case TRUTH_NOT_EXPR
:
2743 case PREDECREMENT_EXPR
:
2744 case PREINCREMENT_EXPR
:
2746 if (TREE_CODE (node
) == ADDR_EXPR
2747 && (TREE_CODE (TREE_OPERAND (node
, 0)) == STRING_CST
2748 || TREE_CODE (TREE_OPERAND (node
, 0)) == FUNCTION_DECL
))
2749 ; /* Do not output '&' for strings and function pointers. */
2751 pp_string (pp
, op_symbol (node
));
2753 if (op_prio (TREE_OPERAND (node
, 0)) < op_prio (node
))
2756 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2757 pp_right_paren (pp
);
2760 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2763 case POSTDECREMENT_EXPR
:
2764 case POSTINCREMENT_EXPR
:
2765 if (op_prio (TREE_OPERAND (node
, 0)) < op_prio (node
))
2768 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2769 pp_right_paren (pp
);
2772 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2773 pp_string (pp
, op_symbol (node
));
2777 pp_string (pp
, "MIN_EXPR <");
2778 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2779 pp_string (pp
, ", ");
2780 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2785 pp_string (pp
, "MAX_EXPR <");
2786 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2787 pp_string (pp
, ", ");
2788 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2793 pp_string (pp
, "ABS_EXPR <");
2794 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2799 pp_string (pp
, "ABSU_EXPR <");
2800 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2808 case ADDR_SPACE_CONVERT_EXPR
:
2809 case FIXED_CONVERT_EXPR
:
2810 case FIX_TRUNC_EXPR
:
2813 type
= TREE_TYPE (node
);
2814 op0
= TREE_OPERAND (node
, 0);
2815 if (type
!= TREE_TYPE (op0
))
2818 dump_generic_node (pp
, type
, spc
, flags
, false);
2819 pp_string (pp
, ") ");
2821 if (op_prio (op0
) < op_prio (node
))
2823 dump_generic_node (pp
, op0
, spc
, flags
, false);
2824 if (op_prio (op0
) < op_prio (node
))
2825 pp_right_paren (pp
);
2828 case VIEW_CONVERT_EXPR
:
2829 if (flags
& TDF_GIMPLE
)
2830 pp_string (pp
, "__VIEW_CONVERT <");
2832 pp_string (pp
, "VIEW_CONVERT_EXPR<");
2833 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2834 pp_string (pp
, ">(");
2835 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2836 pp_right_paren (pp
);
2840 pp_string (pp
, "((");
2841 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2842 pp_string (pp
, "))");
2845 case NON_LVALUE_EXPR
:
2846 pp_string (pp
, "NON_LVALUE_EXPR <");
2847 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2852 pp_string (pp
, "SAVE_EXPR <");
2853 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2858 pp_string (pp
, "COMPLEX_EXPR <");
2859 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2860 pp_string (pp
, ", ");
2861 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2866 pp_string (pp
, "CONJ_EXPR <");
2867 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2872 if (flags
& TDF_GIMPLE
)
2874 pp_string (pp
, "__real ");
2875 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2879 pp_string (pp
, "REALPART_EXPR <");
2880 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2886 if (flags
& TDF_GIMPLE
)
2888 pp_string (pp
, "__imag ");
2889 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2893 pp_string (pp
, "IMAGPART_EXPR <");
2894 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2900 pp_string (pp
, "VA_ARG_EXPR <");
2901 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2905 case TRY_FINALLY_EXPR
:
2906 case TRY_CATCH_EXPR
:
2907 pp_string (pp
, "try");
2908 newline_and_indent (pp
, spc
+2);
2910 newline_and_indent (pp
, spc
+4);
2911 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
+4, flags
, true);
2912 newline_and_indent (pp
, spc
+2);
2913 pp_right_brace (pp
);
2914 newline_and_indent (pp
, spc
);
2915 if (TREE_CODE (node
) == TRY_CATCH_EXPR
)
2917 node
= TREE_OPERAND (node
, 1);
2918 pp_string (pp
, "catch");
2922 gcc_assert (TREE_CODE (node
) == TRY_FINALLY_EXPR
);
2923 node
= TREE_OPERAND (node
, 1);
2924 pp_string (pp
, "finally");
2925 if (TREE_CODE (node
) == EH_ELSE_EXPR
)
2927 newline_and_indent (pp
, spc
+2);
2929 newline_and_indent (pp
, spc
+4);
2930 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
+4,
2932 newline_and_indent (pp
, spc
+2);
2933 pp_right_brace (pp
);
2934 newline_and_indent (pp
, spc
);
2935 node
= TREE_OPERAND (node
, 1);
2936 pp_string (pp
, "else");
2939 newline_and_indent (pp
, spc
+2);
2941 newline_and_indent (pp
, spc
+4);
2942 dump_generic_node (pp
, node
, spc
+4, flags
, true);
2943 newline_and_indent (pp
, spc
+2);
2944 pp_right_brace (pp
);
2949 pp_string (pp
, "catch (");
2950 dump_generic_node (pp
, CATCH_TYPES (node
), spc
+2, flags
, false);
2951 pp_right_paren (pp
);
2952 newline_and_indent (pp
, spc
+2);
2954 newline_and_indent (pp
, spc
+4);
2955 dump_generic_node (pp
, CATCH_BODY (node
), spc
+4, flags
, true);
2956 newline_and_indent (pp
, spc
+2);
2957 pp_right_brace (pp
);
2961 case EH_FILTER_EXPR
:
2962 pp_string (pp
, "<<<eh_filter (");
2963 dump_generic_node (pp
, EH_FILTER_TYPES (node
), spc
+2, flags
, false);
2964 pp_string (pp
, ")>>>");
2965 newline_and_indent (pp
, spc
+2);
2967 newline_and_indent (pp
, spc
+4);
2968 dump_generic_node (pp
, EH_FILTER_FAILURE (node
), spc
+4, flags
, true);
2969 newline_and_indent (pp
, spc
+2);
2970 pp_right_brace (pp
);
2975 op0
= TREE_OPERAND (node
, 0);
2976 /* If this is for break or continue, don't bother printing it. */
2977 if (DECL_NAME (op0
))
2979 const char *name
= IDENTIFIER_POINTER (DECL_NAME (op0
));
2980 if (strcmp (name
, "break") == 0
2981 || strcmp (name
, "continue") == 0)
2984 dump_generic_node (pp
, op0
, spc
, flags
, false);
2986 if (DECL_NONLOCAL (op0
))
2987 pp_string (pp
, " [non-local]");
2991 pp_string (pp
, "while (1)");
2992 if (!(flags
& TDF_SLIM
))
2994 newline_and_indent (pp
, spc
+2);
2996 newline_and_indent (pp
, spc
+4);
2997 dump_generic_node (pp
, LOOP_EXPR_BODY (node
), spc
+4, flags
, true);
2998 newline_and_indent (pp
, spc
+2);
2999 pp_right_brace (pp
);
3005 pp_string (pp
, "// predicted ");
3006 if (PREDICT_EXPR_OUTCOME (node
))
3007 pp_string (pp
, "likely by ");
3009 pp_string (pp
, "unlikely by ");
3010 pp_string (pp
, predictor_name (PREDICT_EXPR_PREDICTOR (node
)));
3011 pp_string (pp
, " predictor.");
3015 pp_string (pp
, "ANNOTATE_EXPR <");
3016 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3017 switch ((enum annot_expr_kind
) TREE_INT_CST_LOW (TREE_OPERAND (node
, 1)))
3019 case annot_expr_ivdep_kind
:
3020 pp_string (pp
, ", ivdep");
3022 case annot_expr_unroll_kind
:
3023 pp_printf (pp
, ", unroll %d",
3024 (int) TREE_INT_CST_LOW (TREE_OPERAND (node
, 2)));
3026 case annot_expr_no_vector_kind
:
3027 pp_string (pp
, ", no-vector");
3029 case annot_expr_vector_kind
:
3030 pp_string (pp
, ", vector");
3032 case annot_expr_parallel_kind
:
3033 pp_string (pp
, ", parallel");
3042 pp_string (pp
, "return");
3043 op0
= TREE_OPERAND (node
, 0);
3047 if (TREE_CODE (op0
) == MODIFY_EXPR
)
3048 dump_generic_node (pp
, TREE_OPERAND (op0
, 1),
3051 dump_generic_node (pp
, op0
, spc
, flags
, false);
3056 pp_string (pp
, "if (");
3057 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3058 pp_string (pp
, ") break");
3062 pp_string (pp
, "switch (");
3063 dump_generic_node (pp
, SWITCH_COND (node
), spc
, flags
, false);
3064 pp_right_paren (pp
);
3065 if (!(flags
& TDF_SLIM
))
3067 newline_and_indent (pp
, spc
+2);
3069 if (SWITCH_BODY (node
))
3071 newline_and_indent (pp
, spc
+4);
3072 dump_generic_node (pp
, SWITCH_BODY (node
), spc
+4, flags
,
3075 newline_and_indent (pp
, spc
+2);
3076 pp_right_brace (pp
);
3082 op0
= GOTO_DESTINATION (node
);
3083 if (TREE_CODE (op0
) != SSA_NAME
&& DECL_P (op0
) && DECL_NAME (op0
))
3085 const char *name
= IDENTIFIER_POINTER (DECL_NAME (op0
));
3086 if (strcmp (name
, "break") == 0
3087 || strcmp (name
, "continue") == 0)
3089 pp_string (pp
, name
);
3093 pp_string (pp
, "goto ");
3094 dump_generic_node (pp
, op0
, spc
, flags
, false);
3098 pp_string (pp
, "__asm__");
3099 if (ASM_VOLATILE_P (node
))
3100 pp_string (pp
, " __volatile__");
3102 dump_generic_node (pp
, ASM_STRING (node
), spc
, flags
, false);
3104 dump_generic_node (pp
, ASM_OUTPUTS (node
), spc
, flags
, false);
3106 dump_generic_node (pp
, ASM_INPUTS (node
), spc
, flags
, false);
3107 if (ASM_CLOBBERS (node
))
3110 dump_generic_node (pp
, ASM_CLOBBERS (node
), spc
, flags
, false);
3112 pp_right_paren (pp
);
3115 case CASE_LABEL_EXPR
:
3116 if (CASE_LOW (node
) && CASE_HIGH (node
))
3118 pp_string (pp
, "case ");
3119 dump_generic_node (pp
, CASE_LOW (node
), spc
, flags
, false);
3120 pp_string (pp
, " ... ");
3121 dump_generic_node (pp
, CASE_HIGH (node
), spc
, flags
, false);
3123 else if (CASE_LOW (node
))
3125 pp_string (pp
, "case ");
3126 dump_generic_node (pp
, CASE_LOW (node
), spc
, flags
, false);
3129 pp_string (pp
, "default");
3134 pp_string (pp
, "OBJ_TYPE_REF(");
3135 dump_generic_node (pp
, OBJ_TYPE_REF_EXPR (node
), spc
, flags
, false);
3137 /* We omit the class type for -fcompare-debug because we may
3138 drop TYPE_BINFO early depending on debug info, and then
3139 virtual_method_call_p would return false, whereas when
3140 TYPE_BINFO is preserved it may still return true and then
3141 we'd print the class type. Compare tree and rtl dumps for
3142 libstdc++-prettyprinters/shared_ptr.cc with and without -g,
3143 for example, at occurrences of OBJ_TYPE_REF. */
3144 if (!(flags
& (TDF_SLIM
| TDF_COMPARE_DEBUG
))
3145 && virtual_method_call_p (node
, true))
3147 pp_string (pp
, "(");
3148 dump_generic_node (pp
, obj_type_ref_class (node
, true),
3150 pp_string (pp
, ")");
3152 dump_generic_node (pp
, OBJ_TYPE_REF_OBJECT (node
), spc
, flags
, false);
3154 dump_generic_node (pp
, OBJ_TYPE_REF_TOKEN (node
), spc
, flags
, false);
3155 pp_right_paren (pp
);
3159 if (SSA_NAME_IDENTIFIER (node
))
3161 if ((flags
& TDF_NOUID
)
3162 && SSA_NAME_VAR (node
)
3163 && DECL_NAMELESS (SSA_NAME_VAR (node
)))
3164 dump_fancy_name (pp
, SSA_NAME_IDENTIFIER (node
));
3165 else if (! (flags
& TDF_GIMPLE
)
3166 || SSA_NAME_VAR (node
))
3167 dump_generic_node (pp
, SSA_NAME_IDENTIFIER (node
),
3171 pp_decimal_int (pp
, SSA_NAME_VERSION (node
));
3172 if (SSA_NAME_IS_DEFAULT_DEF (node
))
3173 pp_string (pp
, "(D)");
3174 if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (node
))
3175 pp_string (pp
, "(ab)");
3178 case WITH_SIZE_EXPR
:
3179 pp_string (pp
, "WITH_SIZE_EXPR <");
3180 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3181 pp_string (pp
, ", ");
3182 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3187 pp_string (pp
, "ASSERT_EXPR <");
3188 dump_generic_node (pp
, ASSERT_EXPR_VAR (node
), spc
, flags
, false);
3189 pp_string (pp
, ", ");
3190 dump_generic_node (pp
, ASSERT_EXPR_COND (node
), spc
, flags
, false);
3195 pp_string (pp
, "scev_known");
3198 case SCEV_NOT_KNOWN
:
3199 pp_string (pp
, "scev_not_known");
3202 case POLYNOMIAL_CHREC
:
3204 dump_generic_node (pp
, CHREC_LEFT (node
), spc
, flags
, false);
3205 pp_string (pp
, ", +, ");
3206 dump_generic_node (pp
, CHREC_RIGHT (node
), spc
, flags
, false);
3207 pp_printf (pp
, "}_%u", CHREC_VARIABLE (node
));
3211 case REALIGN_LOAD_EXPR
:
3212 pp_string (pp
, "REALIGN_LOAD <");
3213 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3214 pp_string (pp
, ", ");
3215 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3216 pp_string (pp
, ", ");
3217 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3222 pp_string (pp
, " VEC_COND_EXPR < ");
3223 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3224 pp_string (pp
, " , ");
3225 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3226 pp_string (pp
, " , ");
3227 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3228 pp_string (pp
, " > ");
3232 pp_string (pp
, " VEC_PERM_EXPR < ");
3233 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3234 pp_string (pp
, " , ");
3235 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3236 pp_string (pp
, " , ");
3237 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3238 pp_string (pp
, " > ");
3242 pp_string (pp
, " DOT_PROD_EXPR < ");
3243 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3244 pp_string (pp
, ", ");
3245 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3246 pp_string (pp
, ", ");
3247 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3248 pp_string (pp
, " > ");
3251 case WIDEN_MULT_PLUS_EXPR
:
3252 pp_string (pp
, " WIDEN_MULT_PLUS_EXPR < ");
3253 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3254 pp_string (pp
, ", ");
3255 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3256 pp_string (pp
, ", ");
3257 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3258 pp_string (pp
, " > ");
3261 case WIDEN_MULT_MINUS_EXPR
:
3262 pp_string (pp
, " WIDEN_MULT_MINUS_EXPR < ");
3263 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3264 pp_string (pp
, ", ");
3265 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3266 pp_string (pp
, ", ");
3267 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3268 pp_string (pp
, " > ");
3272 pp_string (pp
, "#pragma acc parallel");
3273 goto dump_omp_clauses_body
;
3276 pp_string (pp
, "#pragma acc kernels");
3277 goto dump_omp_clauses_body
;
3280 pp_string (pp
, "#pragma acc serial");
3281 goto dump_omp_clauses_body
;
3284 pp_string (pp
, "#pragma acc data");
3285 dump_omp_clauses (pp
, OACC_DATA_CLAUSES (node
), spc
, flags
);
3288 case OACC_HOST_DATA
:
3289 pp_string (pp
, "#pragma acc host_data");
3290 dump_omp_clauses (pp
, OACC_HOST_DATA_CLAUSES (node
), spc
, flags
);
3294 pp_string (pp
, "#pragma acc declare");
3295 dump_omp_clauses (pp
, OACC_DECLARE_CLAUSES (node
), spc
, flags
);
3299 pp_string (pp
, "#pragma acc update");
3300 dump_omp_clauses (pp
, OACC_UPDATE_CLAUSES (node
), spc
, flags
);
3303 case OACC_ENTER_DATA
:
3304 pp_string (pp
, "#pragma acc enter data");
3305 dump_omp_clauses (pp
, OACC_ENTER_DATA_CLAUSES (node
), spc
, flags
);
3308 case OACC_EXIT_DATA
:
3309 pp_string (pp
, "#pragma acc exit data");
3310 dump_omp_clauses (pp
, OACC_EXIT_DATA_CLAUSES (node
), spc
, flags
);
3314 pp_string (pp
, "#pragma acc cache");
3315 dump_omp_clauses (pp
, OACC_CACHE_CLAUSES (node
), spc
, flags
);
3319 pp_string (pp
, "#pragma omp parallel");
3320 dump_omp_clauses (pp
, OMP_PARALLEL_CLAUSES (node
), spc
, flags
);
3323 dump_omp_clauses_body
:
3324 dump_omp_clauses (pp
, OMP_CLAUSES (node
), spc
, flags
);
3328 if (!(flags
& TDF_SLIM
) && OMP_BODY (node
))
3330 newline_and_indent (pp
, spc
+ 2);
3332 newline_and_indent (pp
, spc
+ 4);
3333 dump_generic_node (pp
, OMP_BODY (node
), spc
+ 4, flags
, false);
3334 newline_and_indent (pp
, spc
+ 2);
3335 pp_right_brace (pp
);
3341 pp_string (pp
, OMP_TASK_BODY (node
) ? "#pragma omp task"
3342 : "#pragma omp taskwait");
3343 dump_omp_clauses (pp
, OMP_TASK_CLAUSES (node
), spc
, flags
);
3347 pp_string (pp
, "#pragma omp for");
3351 pp_string (pp
, "#pragma omp simd");
3354 case OMP_DISTRIBUTE
:
3355 pp_string (pp
, "#pragma omp distribute");
3359 pp_string (pp
, "#pragma omp taskloop");
3363 pp_string (pp
, "#pragma omp loop");
3367 pp_string (pp
, "#pragma acc loop");
3371 pp_string (pp
, "#pragma omp teams");
3372 dump_omp_clauses (pp
, OMP_TEAMS_CLAUSES (node
), spc
, flags
);
3375 case OMP_TARGET_DATA
:
3376 pp_string (pp
, "#pragma omp target data");
3377 dump_omp_clauses (pp
, OMP_TARGET_DATA_CLAUSES (node
), spc
, flags
);
3380 case OMP_TARGET_ENTER_DATA
:
3381 pp_string (pp
, "#pragma omp target enter data");
3382 dump_omp_clauses (pp
, OMP_TARGET_ENTER_DATA_CLAUSES (node
), spc
, flags
);
3386 case OMP_TARGET_EXIT_DATA
:
3387 pp_string (pp
, "#pragma omp target exit data");
3388 dump_omp_clauses (pp
, OMP_TARGET_EXIT_DATA_CLAUSES (node
), spc
, flags
);
3393 pp_string (pp
, "#pragma omp target");
3394 dump_omp_clauses (pp
, OMP_TARGET_CLAUSES (node
), spc
, flags
);
3397 case OMP_TARGET_UPDATE
:
3398 pp_string (pp
, "#pragma omp target update");
3399 dump_omp_clauses (pp
, OMP_TARGET_UPDATE_CLAUSES (node
), spc
, flags
);
3404 dump_omp_clauses (pp
, OMP_FOR_CLAUSES (node
), spc
, flags
);
3405 if (!(flags
& TDF_SLIM
))
3409 if (OMP_FOR_PRE_BODY (node
))
3411 newline_and_indent (pp
, spc
+ 2);
3414 newline_and_indent (pp
, spc
);
3415 dump_generic_node (pp
, OMP_FOR_PRE_BODY (node
),
3418 if (OMP_FOR_INIT (node
))
3421 for (i
= 0; i
< TREE_VEC_LENGTH (OMP_FOR_INIT (node
)); i
++)
3424 newline_and_indent (pp
, spc
);
3425 pp_string (pp
, "for (");
3426 tree init
= TREE_VEC_ELT (OMP_FOR_INIT (node
), i
);
3427 if (TREE_CODE (init
) != MODIFY_EXPR
3428 || TREE_CODE (TREE_OPERAND (init
, 1)) != TREE_VEC
)
3429 dump_generic_node (pp
, init
, spc
, flags
, false);
3432 dump_generic_node (pp
, TREE_OPERAND (init
, 0),
3434 pp_string (pp
, " = ");
3435 dump_omp_loop_non_rect_expr (pp
, TREE_OPERAND (init
, 1),
3438 pp_string (pp
, "; ");
3439 tree cond
= TREE_VEC_ELT (OMP_FOR_COND (node
), i
);
3440 if (!COMPARISON_CLASS_P (cond
)
3441 || TREE_CODE (TREE_OPERAND (cond
, 1)) != TREE_VEC
)
3442 dump_generic_node (pp
, cond
, spc
, flags
, false);
3445 dump_generic_node (pp
, TREE_OPERAND (cond
, 0),
3447 const char *op
= op_symbol (cond
);
3451 dump_omp_loop_non_rect_expr (pp
, TREE_OPERAND (cond
, 1),
3454 pp_string (pp
, "; ");
3455 dump_generic_node (pp
,
3456 TREE_VEC_ELT (OMP_FOR_INCR (node
), i
),
3458 pp_right_paren (pp
);
3461 if (OMP_FOR_BODY (node
))
3463 newline_and_indent (pp
, spc
+ 2);
3465 newline_and_indent (pp
, spc
+ 4);
3466 dump_generic_node (pp
, OMP_FOR_BODY (node
), spc
+ 4, flags
,
3468 newline_and_indent (pp
, spc
+ 2);
3469 pp_right_brace (pp
);
3471 if (OMP_FOR_INIT (node
))
3472 spc
-= 2 * TREE_VEC_LENGTH (OMP_FOR_INIT (node
)) - 2;
3473 if (OMP_FOR_PRE_BODY (node
))
3476 newline_and_indent (pp
, spc
+ 2);
3477 pp_right_brace (pp
);
3484 pp_string (pp
, "#pragma omp sections");
3485 dump_omp_clauses (pp
, OMP_SECTIONS_CLAUSES (node
), spc
, flags
);
3489 pp_string (pp
, "#pragma omp section");
3493 if (OMP_SCAN_CLAUSES (node
))
3495 pp_string (pp
, "#pragma omp scan");
3496 dump_omp_clauses (pp
, OMP_SCAN_CLAUSES (node
), spc
, flags
);
3501 pp_string (pp
, "#pragma omp master");
3505 pp_string (pp
, "#pragma omp taskgroup");
3506 dump_omp_clauses (pp
, OMP_TASKGROUP_CLAUSES (node
), spc
, flags
);
3510 pp_string (pp
, "#pragma omp ordered");
3511 dump_omp_clauses (pp
, OMP_ORDERED_CLAUSES (node
), spc
, flags
);
3515 pp_string (pp
, "#pragma omp critical");
3516 if (OMP_CRITICAL_NAME (node
))
3520 dump_generic_node (pp
, OMP_CRITICAL_NAME (node
), spc
,
3522 pp_right_paren (pp
);
3524 dump_omp_clauses (pp
, OMP_CRITICAL_CLAUSES (node
), spc
, flags
);
3528 pp_string (pp
, "#pragma omp atomic");
3529 dump_omp_atomic_memory_order (pp
, OMP_ATOMIC_MEMORY_ORDER (node
));
3530 newline_and_indent (pp
, spc
+ 2);
3531 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3535 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3538 case OMP_ATOMIC_READ
:
3539 pp_string (pp
, "#pragma omp atomic read");
3540 dump_omp_atomic_memory_order (pp
, OMP_ATOMIC_MEMORY_ORDER (node
));
3541 newline_and_indent (pp
, spc
+ 2);
3542 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3546 case OMP_ATOMIC_CAPTURE_OLD
:
3547 case OMP_ATOMIC_CAPTURE_NEW
:
3548 pp_string (pp
, "#pragma omp atomic capture");
3549 dump_omp_atomic_memory_order (pp
, OMP_ATOMIC_MEMORY_ORDER (node
));
3550 newline_and_indent (pp
, spc
+ 2);
3551 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3555 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3559 pp_string (pp
, "#pragma omp single");
3560 dump_omp_clauses (pp
, OMP_SINGLE_CLAUSES (node
), spc
, flags
);
3564 dump_omp_clause (pp
, node
, spc
, flags
);
3568 case TRANSACTION_EXPR
:
3569 if (TRANSACTION_EXPR_OUTER (node
))
3570 pp_string (pp
, "__transaction_atomic [[outer]]");
3571 else if (TRANSACTION_EXPR_RELAXED (node
))
3572 pp_string (pp
, "__transaction_relaxed");
3574 pp_string (pp
, "__transaction_atomic");
3575 if (!(flags
& TDF_SLIM
) && TRANSACTION_EXPR_BODY (node
))
3577 newline_and_indent (pp
, spc
);
3579 newline_and_indent (pp
, spc
+ 2);
3580 dump_generic_node (pp
, TRANSACTION_EXPR_BODY (node
),
3581 spc
+ 2, flags
, false);
3582 newline_and_indent (pp
, spc
);
3583 pp_right_brace (pp
);
3588 case VEC_SERIES_EXPR
:
3589 case VEC_WIDEN_MULT_HI_EXPR
:
3590 case VEC_WIDEN_MULT_LO_EXPR
:
3591 case VEC_WIDEN_PLUS_HI_EXPR
:
3592 case VEC_WIDEN_PLUS_LO_EXPR
:
3593 case VEC_WIDEN_MINUS_HI_EXPR
:
3594 case VEC_WIDEN_MINUS_LO_EXPR
:
3595 case VEC_WIDEN_MULT_EVEN_EXPR
:
3596 case VEC_WIDEN_MULT_ODD_EXPR
:
3597 case VEC_WIDEN_LSHIFT_HI_EXPR
:
3598 case VEC_WIDEN_LSHIFT_LO_EXPR
:
3600 for (str
= get_tree_code_name (code
); *str
; str
++)
3601 pp_character (pp
, TOUPPER (*str
));
3602 pp_string (pp
, " < ");
3603 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3604 pp_string (pp
, ", ");
3605 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3606 pp_string (pp
, " > ");
3609 case VEC_DUPLICATE_EXPR
:
3611 for (str
= get_tree_code_name (code
); *str
; str
++)
3612 pp_character (pp
, TOUPPER (*str
));
3613 pp_string (pp
, " < ");
3614 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3615 pp_string (pp
, " > ");
3618 case VEC_UNPACK_HI_EXPR
:
3619 pp_string (pp
, " VEC_UNPACK_HI_EXPR < ");
3620 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3621 pp_string (pp
, " > ");
3624 case VEC_UNPACK_LO_EXPR
:
3625 pp_string (pp
, " VEC_UNPACK_LO_EXPR < ");
3626 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3627 pp_string (pp
, " > ");
3630 case VEC_UNPACK_FLOAT_HI_EXPR
:
3631 pp_string (pp
, " VEC_UNPACK_FLOAT_HI_EXPR < ");
3632 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3633 pp_string (pp
, " > ");
3636 case VEC_UNPACK_FLOAT_LO_EXPR
:
3637 pp_string (pp
, " VEC_UNPACK_FLOAT_LO_EXPR < ");
3638 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3639 pp_string (pp
, " > ");
3642 case VEC_UNPACK_FIX_TRUNC_HI_EXPR
:
3643 pp_string (pp
, " VEC_UNPACK_FIX_TRUNC_HI_EXPR < ");
3644 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3645 pp_string (pp
, " > ");
3648 case VEC_UNPACK_FIX_TRUNC_LO_EXPR
:
3649 pp_string (pp
, " VEC_UNPACK_FIX_TRUNC_LO_EXPR < ");
3650 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3651 pp_string (pp
, " > ");
3654 case VEC_PACK_TRUNC_EXPR
:
3655 pp_string (pp
, " VEC_PACK_TRUNC_EXPR < ");
3656 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3657 pp_string (pp
, ", ");
3658 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3659 pp_string (pp
, " > ");
3662 case VEC_PACK_SAT_EXPR
:
3663 pp_string (pp
, " VEC_PACK_SAT_EXPR < ");
3664 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3665 pp_string (pp
, ", ");
3666 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3667 pp_string (pp
, " > ");
3670 case VEC_PACK_FIX_TRUNC_EXPR
:
3671 pp_string (pp
, " VEC_PACK_FIX_TRUNC_EXPR < ");
3672 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3673 pp_string (pp
, ", ");
3674 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3675 pp_string (pp
, " > ");
3678 case VEC_PACK_FLOAT_EXPR
:
3679 pp_string (pp
, " VEC_PACK_FLOAT_EXPR < ");
3680 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3681 pp_string (pp
, ", ");
3682 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3683 pp_string (pp
, " > ");
3687 dump_block_node (pp
, node
, spc
, flags
);
3690 case DEBUG_BEGIN_STMT
:
3691 pp_string (pp
, "# DEBUG BEGIN STMT");
3698 if (is_stmt
&& is_expr
)
3704 /* Print the declaration of a variable. */
3707 print_declaration (pretty_printer
*pp
, tree t
, int spc
, dump_flags_t flags
)
3711 if (TREE_CODE(t
) == NAMELIST_DECL
)
3713 pp_string(pp
, "namelist ");
3714 dump_decl_name (pp
, t
, flags
);
3719 if (TREE_CODE (t
) == TYPE_DECL
)
3720 pp_string (pp
, "typedef ");
3722 if (CODE_CONTAINS_STRUCT (TREE_CODE (t
), TS_DECL_WRTL
) && DECL_REGISTER (t
))
3723 pp_string (pp
, "register ");
3725 if (TREE_PUBLIC (t
) && DECL_EXTERNAL (t
))
3726 pp_string (pp
, "extern ");
3727 else if (TREE_STATIC (t
))
3728 pp_string (pp
, "static ");
3730 /* Print the type and name. */
3731 if (TREE_TYPE (t
) && TREE_CODE (TREE_TYPE (t
)) == ARRAY_TYPE
)
3735 /* Print array's type. */
3736 tmp
= TREE_TYPE (t
);
3737 while (TREE_CODE (TREE_TYPE (tmp
)) == ARRAY_TYPE
)
3738 tmp
= TREE_TYPE (tmp
);
3739 dump_generic_node (pp
, TREE_TYPE (tmp
), spc
, flags
, false);
3741 /* Print variable's name. */
3743 dump_generic_node (pp
, t
, spc
, flags
, false);
3745 /* Print the dimensions. */
3746 tmp
= TREE_TYPE (t
);
3747 while (TREE_CODE (tmp
) == ARRAY_TYPE
)
3749 dump_array_domain (pp
, TYPE_DOMAIN (tmp
), spc
, flags
);
3750 tmp
= TREE_TYPE (tmp
);
3753 else if (TREE_CODE (t
) == FUNCTION_DECL
)
3755 dump_generic_node (pp
, TREE_TYPE (TREE_TYPE (t
)), spc
, flags
, false);
3757 dump_decl_name (pp
, t
, flags
);
3758 dump_function_declaration (pp
, TREE_TYPE (t
), spc
, flags
);
3762 /* Print type declaration. */
3763 dump_generic_node (pp
, TREE_TYPE (t
), spc
, flags
, false);
3765 /* Print variable's name. */
3767 dump_generic_node (pp
, t
, spc
, flags
, false);
3770 if (VAR_P (t
) && DECL_HARD_REGISTER (t
))
3772 pp_string (pp
, " __asm__ ");
3774 dump_generic_node (pp
, DECL_ASSEMBLER_NAME (t
), spc
, flags
, false);
3775 pp_right_paren (pp
);
3778 /* The initial value of a function serves to determine whether the function
3779 is declared or defined. So the following does not apply to function
3781 if (TREE_CODE (t
) != FUNCTION_DECL
)
3783 /* Print the initial value. */
3784 if (DECL_INITIAL (t
))
3789 if (!(flags
& TDF_SLIM
))
3790 dump_generic_node (pp
, DECL_INITIAL (t
), spc
, flags
, false);
3792 pp_string (pp
, "<<< omitted >>>");
3796 if (VAR_P (t
) && DECL_HAS_VALUE_EXPR_P (t
))
3798 pp_string (pp
, " [value-expr: ");
3799 dump_generic_node (pp
, DECL_VALUE_EXPR (t
), spc
, flags
, false);
3800 pp_right_bracket (pp
);
3807 /* Prints a structure: name, fields, and methods.
3808 FIXME: Still incomplete. */
3811 print_struct_decl (pretty_printer
*pp
, const_tree node
, int spc
,
3814 /* Print the name of the structure. */
3815 if (TYPE_NAME (node
))
3818 if (TREE_CODE (node
) == RECORD_TYPE
)
3819 pp_string (pp
, "struct ");
3820 else if ((TREE_CODE (node
) == UNION_TYPE
3821 || TREE_CODE (node
) == QUAL_UNION_TYPE
))
3822 pp_string (pp
, "union ");
3824 dump_generic_node (pp
, TYPE_NAME (node
), spc
, TDF_NONE
, false);
3827 /* Print the contents of the structure. */
3833 /* Print the fields of the structure. */
3836 tmp
= TYPE_FIELDS (node
);
3839 /* Avoid to print recursively the structure. */
3840 /* FIXME : Not implemented correctly...,
3841 what about the case when we have a cycle in the contain graph? ...
3842 Maybe this could be solved by looking at the scope in which the
3843 structure was declared. */
3844 if (TREE_TYPE (tmp
) != node
3845 && (TREE_CODE (TREE_TYPE (tmp
)) != POINTER_TYPE
3846 || TREE_TYPE (TREE_TYPE (tmp
)) != node
))
3848 print_declaration (pp
, tmp
, spc
+2, flags
);
3851 tmp
= DECL_CHAIN (tmp
);
3855 pp_right_brace (pp
);
3858 /* Return the priority of the operator CODE.
3860 From lowest to highest precedence with either left-to-right (L-R)
3861 or right-to-left (R-L) associativity]:
3864 2 [R-L] = += -= *= /= %= &= ^= |= <<= >>=
3876 14 [R-L] ! ~ ++ -- + - * & (type) sizeof
3877 15 [L-R] fn() [] -> .
3879 unary +, - and * have higher precedence than the corresponding binary
3883 op_code_prio (enum tree_code code
)
3900 case TRUTH_ORIF_EXPR
:
3903 case TRUTH_AND_EXPR
:
3904 case TRUTH_ANDIF_EXPR
:
3911 case TRUTH_XOR_EXPR
:
3928 case UNORDERED_EXPR
:
3939 case VEC_WIDEN_LSHIFT_HI_EXPR
:
3940 case VEC_WIDEN_LSHIFT_LO_EXPR
:
3941 case WIDEN_LSHIFT_EXPR
:
3944 case WIDEN_SUM_EXPR
:
3946 case POINTER_PLUS_EXPR
:
3947 case POINTER_DIFF_EXPR
:
3951 case VEC_WIDEN_MULT_HI_EXPR
:
3952 case VEC_WIDEN_MULT_LO_EXPR
:
3953 case WIDEN_MULT_EXPR
:
3955 case WIDEN_MULT_PLUS_EXPR
:
3956 case WIDEN_MULT_MINUS_EXPR
:
3958 case MULT_HIGHPART_EXPR
:
3959 case TRUNC_DIV_EXPR
:
3961 case FLOOR_DIV_EXPR
:
3962 case ROUND_DIV_EXPR
:
3964 case EXACT_DIV_EXPR
:
3965 case TRUNC_MOD_EXPR
:
3967 case FLOOR_MOD_EXPR
:
3968 case ROUND_MOD_EXPR
:
3971 case TRUTH_NOT_EXPR
:
3973 case POSTINCREMENT_EXPR
:
3974 case POSTDECREMENT_EXPR
:
3975 case PREINCREMENT_EXPR
:
3976 case PREDECREMENT_EXPR
:
3982 case FIX_TRUNC_EXPR
:
3988 case ARRAY_RANGE_REF
:
3992 /* Special expressions. */
3998 case VEC_UNPACK_HI_EXPR
:
3999 case VEC_UNPACK_LO_EXPR
:
4000 case VEC_UNPACK_FLOAT_HI_EXPR
:
4001 case VEC_UNPACK_FLOAT_LO_EXPR
:
4002 case VEC_UNPACK_FIX_TRUNC_HI_EXPR
:
4003 case VEC_UNPACK_FIX_TRUNC_LO_EXPR
:
4004 case VEC_PACK_TRUNC_EXPR
:
4005 case VEC_PACK_SAT_EXPR
:
4009 /* Return an arbitrarily high precedence to avoid surrounding single
4010 VAR_DECLs in ()s. */
4015 /* Return the priority of the operator OP. */
4018 op_prio (const_tree op
)
4020 enum tree_code code
;
4025 code
= TREE_CODE (op
);
4026 if (code
== SAVE_EXPR
|| code
== NON_LVALUE_EXPR
)
4027 return op_prio (TREE_OPERAND (op
, 0));
4029 return op_code_prio (code
);
4032 /* Return the symbol associated with operator CODE. */
4035 op_symbol_code (enum tree_code code
)
4043 case TRUTH_ORIF_EXPR
:
4046 case TRUTH_AND_EXPR
:
4047 case TRUTH_ANDIF_EXPR
:
4053 case TRUTH_XOR_EXPR
:
4063 case UNORDERED_EXPR
:
4109 case WIDEN_LSHIFT_EXPR
:
4112 case WIDEN_PLUS_EXPR
:
4115 case WIDEN_MINUS_EXPR
:
4118 case POINTER_PLUS_EXPR
:
4124 case WIDEN_SUM_EXPR
:
4127 case WIDEN_MULT_EXPR
:
4130 case MULT_HIGHPART_EXPR
:
4135 case POINTER_DIFF_EXPR
:
4141 case TRUTH_NOT_EXPR
:
4148 case TRUNC_DIV_EXPR
:
4155 case FLOOR_DIV_EXPR
:
4158 case ROUND_DIV_EXPR
:
4161 case EXACT_DIV_EXPR
:
4164 case TRUNC_MOD_EXPR
:
4170 case FLOOR_MOD_EXPR
:
4173 case ROUND_MOD_EXPR
:
4176 case PREDECREMENT_EXPR
:
4179 case PREINCREMENT_EXPR
:
4182 case POSTDECREMENT_EXPR
:
4185 case POSTINCREMENT_EXPR
:
4195 return "<<< ??? >>>";
4199 /* Return the symbol associated with operator OP. */
4202 op_symbol (const_tree op
)
4204 return op_symbol_code (TREE_CODE (op
));
4207 /* Prints the name of a call. NODE is the CALL_EXPR_FN of a CALL_EXPR or
4208 the gimple_call_fn of a GIMPLE_CALL. */
4211 print_call_name (pretty_printer
*pp
, tree node
, dump_flags_t flags
)
4215 if (TREE_CODE (op0
) == NON_LVALUE_EXPR
)
4216 op0
= TREE_OPERAND (op0
, 0);
4219 switch (TREE_CODE (op0
))
4224 dump_function_name (pp
, op0
, flags
);
4230 op0
= TREE_OPERAND (op0
, 0);
4235 dump_generic_node (pp
, TREE_OPERAND (op0
, 0), 0, flags
, false);
4236 pp_string (pp
, ") ? ");
4237 dump_generic_node (pp
, TREE_OPERAND (op0
, 1), 0, flags
, false);
4238 pp_string (pp
, " : ");
4239 dump_generic_node (pp
, TREE_OPERAND (op0
, 2), 0, flags
, false);
4243 if (TREE_CODE (TREE_OPERAND (op0
, 0)) == VAR_DECL
)
4244 dump_function_name (pp
, TREE_OPERAND (op0
, 0), flags
);
4246 dump_generic_node (pp
, op0
, 0, flags
, false);
4250 if (integer_zerop (TREE_OPERAND (op0
, 1)))
4252 op0
= TREE_OPERAND (op0
, 0);
4259 dump_generic_node (pp
, op0
, 0, flags
, false);
4267 /* Print the first N characters in the array STR, replacing non-printable
4268 characters (including embedded nuls) with unambiguous escape sequences. */
4271 pretty_print_string (pretty_printer
*pp
, const char *str
, size_t n
)
4276 for ( ; n
; --n
, ++str
)
4281 pp_string (pp
, "\\b");
4285 pp_string (pp
, "\\f");
4289 pp_string (pp
, "\\n");
4293 pp_string (pp
, "\\r");
4297 pp_string (pp
, "\\t");
4301 pp_string (pp
, "\\v");
4305 pp_string (pp
, "\\\\");
4309 pp_string (pp
, "\\\"");
4313 pp_string (pp
, "\\'");
4317 if (str
[0] || n
> 1)
4319 if (!ISPRINT (str
[0]))
4322 sprintf (buf
, "\\x%02x", (unsigned char)str
[0]);
4323 pp_string (pp
, buf
);
4326 pp_character (pp
, str
[0]);
4334 maybe_init_pretty_print (FILE *file
)
4338 tree_pp
= new pretty_printer ();
4339 pp_needs_newline (tree_pp
) = true;
4340 pp_translate_identifiers (tree_pp
) = false;
4343 tree_pp
->buffer
->stream
= file
;
4347 newline_and_indent (pretty_printer
*pp
, int spc
)
4353 /* Handle the %K format for TEXT. Separate from default_tree_printer
4354 so it can also be used in front ends.
4355 The location LOC and BLOCK are expected to be extracted by the caller
4356 from the %K argument arg via EXPR_LOCATION(arg) and TREE_BLOCK(arg). */
4359 percent_K_format (text_info
*text
, location_t loc
, tree block
)
4361 text
->set_location (0, loc
, SHOW_RANGE_WITH_CARET
);
4362 gcc_assert (pp_ti_abstract_origin (text
) != NULL
);
4363 *pp_ti_abstract_origin (text
) = NULL
;
4366 && TREE_CODE (block
) == BLOCK
4367 && BLOCK_ABSTRACT_ORIGIN (block
))
4369 tree ao
= BLOCK_ABSTRACT_ORIGIN (block
);
4370 if (TREE_CODE (ao
) == FUNCTION_DECL
)
4372 *pp_ti_abstract_origin (text
) = block
;
4375 block
= BLOCK_SUPERCONTEXT (block
);
4379 /* Print the identifier ID to PRETTY-PRINTER. */
4382 pp_tree_identifier (pretty_printer
*pp
, tree id
)
4384 if (pp_translate_identifiers (pp
))
4386 const char *text
= identifier_to_locale (IDENTIFIER_POINTER (id
));
4387 pp_append_text (pp
, text
, text
+ strlen (text
));
4390 pp_append_text (pp
, IDENTIFIER_POINTER (id
),
4391 IDENTIFIER_POINTER (id
) + IDENTIFIER_LENGTH (id
));
4394 /* A helper function that is used to dump function information before the
4398 dump_function_header (FILE *dump_file
, tree fdecl
, dump_flags_t flags
)
4400 const char *dname
, *aname
;
4401 struct cgraph_node
*node
= cgraph_node::get (fdecl
);
4402 struct function
*fun
= DECL_STRUCT_FUNCTION (fdecl
);
4404 dname
= lang_hooks
.decl_printable_name (fdecl
, 1);
4406 if (DECL_ASSEMBLER_NAME_SET_P (fdecl
))
4407 aname
= (IDENTIFIER_POINTER
4408 (DECL_ASSEMBLER_NAME (fdecl
)));
4410 aname
= "<unset-asm-name>";
4412 fprintf (dump_file
, "\n;; Function %s (%s, funcdef_no=%d",
4413 dname
, aname
, fun
->funcdef_no
);
4414 if (!(flags
& TDF_NOUID
))
4415 fprintf (dump_file
, ", decl_uid=%d", DECL_UID (fdecl
));
4418 fprintf (dump_file
, ", cgraph_uid=%d", node
->get_uid ());
4419 fprintf (dump_file
, ", symbol_order=%d)%s\n\n", node
->order
,
4420 node
->frequency
== NODE_FREQUENCY_HOT
4422 : node
->frequency
== NODE_FREQUENCY_UNLIKELY_EXECUTED
4423 ? " (unlikely executed)"
4424 : node
->frequency
== NODE_FREQUENCY_EXECUTED_ONCE
4425 ? " (executed once)"
4429 fprintf (dump_file
, ")\n\n");
4432 /* Dump double_int D to pretty_printer PP. UNS is true
4433 if D is unsigned and false otherwise. */
4435 pp_double_int (pretty_printer
*pp
, double_int d
, bool uns
)
4438 pp_wide_integer (pp
, d
.low
);
4439 else if (d
.fits_uhwi ())
4440 pp_unsigned_wide_integer (pp
, d
.low
);
4443 unsigned HOST_WIDE_INT low
= d
.low
;
4444 HOST_WIDE_INT high
= d
.high
;
4445 if (!uns
&& d
.is_negative ())
4448 high
= ~high
+ !low
;
4451 /* Would "%x%0*x" or "%x%*0x" get zero-padding on all
4453 sprintf (pp_buffer (pp
)->digit_buffer
,
4454 HOST_WIDE_INT_PRINT_DOUBLE_HEX
,
4455 (unsigned HOST_WIDE_INT
) high
, low
);
4456 pp_string (pp
, pp_buffer (pp
)->digit_buffer
);
4461 # pragma GCC diagnostic pop