1 /* Pretty formatting of GENERIC trees in C syntax.
2 Copyright (C) 2001-2020 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_DEPEND
:
716 pp_string (pp
, "depend(");
717 switch (OMP_CLAUSE_DEPEND_KIND (clause
))
719 case OMP_CLAUSE_DEPEND_DEPOBJ
:
722 case OMP_CLAUSE_DEPEND_IN
:
725 case OMP_CLAUSE_DEPEND_OUT
:
728 case OMP_CLAUSE_DEPEND_INOUT
:
731 case OMP_CLAUSE_DEPEND_MUTEXINOUTSET
:
732 name
= "mutexinoutset";
734 case OMP_CLAUSE_DEPEND_SOURCE
:
735 pp_string (pp
, "source)");
737 case OMP_CLAUSE_DEPEND_LAST
:
738 name
= "__internal__";
740 case OMP_CLAUSE_DEPEND_SINK
:
741 pp_string (pp
, "sink:");
742 for (tree t
= OMP_CLAUSE_DECL (clause
); t
; t
= TREE_CHAIN (t
))
743 if (TREE_CODE (t
) == TREE_LIST
)
745 dump_generic_node (pp
, TREE_VALUE (t
), spc
, flags
, false);
746 if (TREE_PURPOSE (t
) != integer_zero_node
)
748 if (OMP_CLAUSE_DEPEND_SINK_NEGATIVE (t
))
752 dump_generic_node (pp
, TREE_PURPOSE (t
), spc
, flags
,
766 tree t
= OMP_CLAUSE_DECL (clause
);
767 if (TREE_CODE (t
) == TREE_LIST
769 && TREE_CODE (TREE_PURPOSE (t
)) == TREE_VEC
)
771 dump_omp_iterators (pp
, TREE_PURPOSE (t
), spc
, flags
);
775 pp_string (pp
, name
);
777 dump_generic_node (pp
, t
, spc
, flags
, false);
783 pp_string (pp
, "map(");
784 switch (OMP_CLAUSE_MAP_KIND (clause
))
787 case GOMP_MAP_POINTER
:
788 pp_string (pp
, "alloc");
790 case GOMP_MAP_IF_PRESENT
:
791 pp_string (pp
, "no_alloc");
794 case GOMP_MAP_TO_PSET
:
795 pp_string (pp
, "to");
798 pp_string (pp
, "from");
800 case GOMP_MAP_TOFROM
:
801 pp_string (pp
, "tofrom");
803 case GOMP_MAP_FORCE_ALLOC
:
804 pp_string (pp
, "force_alloc");
806 case GOMP_MAP_FORCE_TO
:
807 pp_string (pp
, "force_to");
809 case GOMP_MAP_FORCE_FROM
:
810 pp_string (pp
, "force_from");
812 case GOMP_MAP_FORCE_TOFROM
:
813 pp_string (pp
, "force_tofrom");
815 case GOMP_MAP_FORCE_PRESENT
:
816 pp_string (pp
, "force_present");
818 case GOMP_MAP_DELETE
:
819 pp_string (pp
, "delete");
821 case GOMP_MAP_FORCE_DEVICEPTR
:
822 pp_string (pp
, "force_deviceptr");
824 case GOMP_MAP_ALWAYS_TO
:
825 pp_string (pp
, "always,to");
827 case GOMP_MAP_ALWAYS_FROM
:
828 pp_string (pp
, "always,from");
830 case GOMP_MAP_ALWAYS_TOFROM
:
831 pp_string (pp
, "always,tofrom");
833 case GOMP_MAP_RELEASE
:
834 pp_string (pp
, "release");
836 case GOMP_MAP_FIRSTPRIVATE_POINTER
:
837 pp_string (pp
, "firstprivate");
839 case GOMP_MAP_FIRSTPRIVATE_REFERENCE
:
840 pp_string (pp
, "firstprivate ref");
842 case GOMP_MAP_STRUCT
:
843 pp_string (pp
, "struct");
845 case GOMP_MAP_ALWAYS_POINTER
:
846 pp_string (pp
, "always_pointer");
848 case GOMP_MAP_DEVICE_RESIDENT
:
849 pp_string (pp
, "device_resident");
852 pp_string (pp
, "link");
854 case GOMP_MAP_ATTACH
:
855 pp_string (pp
, "attach");
857 case GOMP_MAP_DETACH
:
858 pp_string (pp
, "detach");
860 case GOMP_MAP_FORCE_DETACH
:
861 pp_string (pp
, "force_detach");
863 case GOMP_MAP_ATTACH_DETACH
:
864 pp_string (pp
, "attach_detach");
870 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
873 if (OMP_CLAUSE_SIZE (clause
))
875 switch (OMP_CLAUSE_CODE (clause
) == OMP_CLAUSE_MAP
876 ? OMP_CLAUSE_MAP_KIND (clause
) : GOMP_MAP_TO
)
878 case GOMP_MAP_POINTER
:
879 case GOMP_MAP_FIRSTPRIVATE_POINTER
:
880 case GOMP_MAP_FIRSTPRIVATE_REFERENCE
:
881 case GOMP_MAP_ALWAYS_POINTER
:
882 pp_string (pp
, " [pointer assign, bias: ");
884 case GOMP_MAP_TO_PSET
:
885 pp_string (pp
, " [pointer set, len: ");
887 case GOMP_MAP_ATTACH
:
888 case GOMP_MAP_DETACH
:
889 case GOMP_MAP_FORCE_DETACH
:
890 case GOMP_MAP_ATTACH_DETACH
:
891 pp_string (pp
, " [bias: ");
894 pp_string (pp
, " [len: ");
897 dump_generic_node (pp
, OMP_CLAUSE_SIZE (clause
),
899 pp_right_bracket (pp
);
904 case OMP_CLAUSE_FROM
:
905 pp_string (pp
, "from(");
906 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
908 goto print_clause_size
;
911 pp_string (pp
, "to(");
912 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
914 goto print_clause_size
;
916 case OMP_CLAUSE__CACHE_
:
918 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
920 goto print_clause_size
;
922 case OMP_CLAUSE_NUM_TEAMS
:
923 pp_string (pp
, "num_teams(");
924 dump_generic_node (pp
, OMP_CLAUSE_NUM_TEAMS_EXPR (clause
),
929 case OMP_CLAUSE_THREAD_LIMIT
:
930 pp_string (pp
, "thread_limit(");
931 dump_generic_node (pp
, OMP_CLAUSE_THREAD_LIMIT_EXPR (clause
),
936 case OMP_CLAUSE_DEVICE
:
937 pp_string (pp
, "device(");
938 dump_generic_node (pp
, OMP_CLAUSE_DEVICE_ID (clause
),
943 case OMP_CLAUSE_DIST_SCHEDULE
:
944 pp_string (pp
, "dist_schedule(static");
945 if (OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR (clause
))
948 dump_generic_node (pp
,
949 OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR (clause
),
955 case OMP_CLAUSE_PROC_BIND
:
956 pp_string (pp
, "proc_bind(");
957 switch (OMP_CLAUSE_PROC_BIND_KIND (clause
))
959 case OMP_CLAUSE_PROC_BIND_MASTER
:
960 pp_string (pp
, "master");
962 case OMP_CLAUSE_PROC_BIND_CLOSE
:
963 pp_string (pp
, "close");
965 case OMP_CLAUSE_PROC_BIND_SPREAD
:
966 pp_string (pp
, "spread");
974 case OMP_CLAUSE_DEVICE_TYPE
:
975 pp_string (pp
, "device_type(");
976 switch (OMP_CLAUSE_DEVICE_TYPE_KIND (clause
))
978 case OMP_CLAUSE_DEVICE_TYPE_HOST
:
979 pp_string (pp
, "host");
981 case OMP_CLAUSE_DEVICE_TYPE_NOHOST
:
982 pp_string (pp
, "nohost");
984 case OMP_CLAUSE_DEVICE_TYPE_ANY
:
985 pp_string (pp
, "any");
993 case OMP_CLAUSE_SAFELEN
:
994 pp_string (pp
, "safelen(");
995 dump_generic_node (pp
, OMP_CLAUSE_SAFELEN_EXPR (clause
),
1000 case OMP_CLAUSE_SIMDLEN
:
1001 pp_string (pp
, "simdlen(");
1002 dump_generic_node (pp
, OMP_CLAUSE_SIMDLEN_EXPR (clause
),
1004 pp_right_paren (pp
);
1007 case OMP_CLAUSE_PRIORITY
:
1008 pp_string (pp
, "priority(");
1009 dump_generic_node (pp
, OMP_CLAUSE_PRIORITY_EXPR (clause
),
1011 pp_right_paren (pp
);
1014 case OMP_CLAUSE_GRAINSIZE
:
1015 pp_string (pp
, "grainsize(");
1016 dump_generic_node (pp
, OMP_CLAUSE_GRAINSIZE_EXPR (clause
),
1018 pp_right_paren (pp
);
1021 case OMP_CLAUSE_NUM_TASKS
:
1022 pp_string (pp
, "num_tasks(");
1023 dump_generic_node (pp
, OMP_CLAUSE_NUM_TASKS_EXPR (clause
),
1025 pp_right_paren (pp
);
1028 case OMP_CLAUSE_HINT
:
1029 pp_string (pp
, "hint(");
1030 dump_generic_node (pp
, OMP_CLAUSE_HINT_EXPR (clause
),
1032 pp_right_paren (pp
);
1035 case OMP_CLAUSE_DEFAULTMAP
:
1036 pp_string (pp
, "defaultmap(");
1037 switch (OMP_CLAUSE_DEFAULTMAP_BEHAVIOR (clause
))
1039 case OMP_CLAUSE_DEFAULTMAP_ALLOC
:
1040 pp_string (pp
, "alloc");
1042 case OMP_CLAUSE_DEFAULTMAP_TO
:
1043 pp_string (pp
, "to");
1045 case OMP_CLAUSE_DEFAULTMAP_FROM
:
1046 pp_string (pp
, "from");
1048 case OMP_CLAUSE_DEFAULTMAP_TOFROM
:
1049 pp_string (pp
, "tofrom");
1051 case OMP_CLAUSE_DEFAULTMAP_FIRSTPRIVATE
:
1052 pp_string (pp
, "firstprivate");
1054 case OMP_CLAUSE_DEFAULTMAP_NONE
:
1055 pp_string (pp
, "none");
1057 case OMP_CLAUSE_DEFAULTMAP_DEFAULT
:
1058 pp_string (pp
, "default");
1063 switch (OMP_CLAUSE_DEFAULTMAP_CATEGORY (clause
))
1065 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_UNSPECIFIED
:
1067 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_SCALAR
:
1068 pp_string (pp
, ":scalar");
1070 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_AGGREGATE
:
1071 pp_string (pp
, ":aggregate");
1073 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_ALLOCATABLE
:
1074 pp_string (pp
, ":allocatable");
1076 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_POINTER
:
1077 pp_string (pp
, ":pointer");
1082 pp_right_paren (pp
);
1085 case OMP_CLAUSE_ORDER
:
1086 pp_string (pp
, "order(concurrent)");
1089 case OMP_CLAUSE_BIND
:
1090 pp_string (pp
, "bind(");
1091 switch (OMP_CLAUSE_BIND_KIND (clause
))
1093 case OMP_CLAUSE_BIND_TEAMS
:
1094 pp_string (pp
, "teams");
1096 case OMP_CLAUSE_BIND_PARALLEL
:
1097 pp_string (pp
, "parallel");
1099 case OMP_CLAUSE_BIND_THREAD
:
1100 pp_string (pp
, "thread");
1105 pp_right_paren (pp
);
1108 case OMP_CLAUSE__SIMDUID_
:
1109 pp_string (pp
, "_simduid_(");
1110 dump_generic_node (pp
, OMP_CLAUSE__SIMDUID__DECL (clause
),
1112 pp_right_paren (pp
);
1115 case OMP_CLAUSE__SIMT_
:
1116 pp_string (pp
, "_simt_");
1119 case OMP_CLAUSE_GANG
:
1120 pp_string (pp
, "gang");
1121 if (OMP_CLAUSE_GANG_EXPR (clause
) != NULL_TREE
)
1123 pp_string (pp
, "(num: ");
1124 dump_generic_node (pp
, OMP_CLAUSE_GANG_EXPR (clause
),
1127 if (OMP_CLAUSE_GANG_STATIC_EXPR (clause
) != NULL_TREE
)
1129 if (OMP_CLAUSE_GANG_EXPR (clause
) == NULL_TREE
)
1133 pp_string (pp
, "static:");
1134 if (OMP_CLAUSE_GANG_STATIC_EXPR (clause
)
1135 == integer_minus_one_node
)
1136 pp_character (pp
, '*');
1138 dump_generic_node (pp
, OMP_CLAUSE_GANG_STATIC_EXPR (clause
),
1141 if (OMP_CLAUSE_GANG_EXPR (clause
) != NULL_TREE
1142 || OMP_CLAUSE_GANG_STATIC_EXPR (clause
) != NULL_TREE
)
1143 pp_right_paren (pp
);
1146 case OMP_CLAUSE_ASYNC
:
1147 pp_string (pp
, "async");
1148 if (OMP_CLAUSE_ASYNC_EXPR (clause
))
1150 pp_character(pp
, '(');
1151 dump_generic_node (pp
, OMP_CLAUSE_ASYNC_EXPR (clause
),
1153 pp_character(pp
, ')');
1157 case OMP_CLAUSE_AUTO
:
1158 case OMP_CLAUSE_SEQ
:
1159 pp_string (pp
, omp_clause_code_name
[OMP_CLAUSE_CODE (clause
)]);
1162 case OMP_CLAUSE_WAIT
:
1163 pp_string (pp
, "wait(");
1164 dump_generic_node (pp
, OMP_CLAUSE_WAIT_EXPR (clause
),
1166 pp_character(pp
, ')');
1169 case OMP_CLAUSE_WORKER
:
1170 pp_string (pp
, "worker");
1171 if (OMP_CLAUSE_WORKER_EXPR (clause
) != NULL_TREE
)
1174 dump_generic_node (pp
, OMP_CLAUSE_WORKER_EXPR (clause
),
1176 pp_right_paren (pp
);
1180 case OMP_CLAUSE_VECTOR
:
1181 pp_string (pp
, "vector");
1182 if (OMP_CLAUSE_VECTOR_EXPR (clause
) != NULL_TREE
)
1185 dump_generic_node (pp
, OMP_CLAUSE_VECTOR_EXPR (clause
),
1187 pp_right_paren (pp
);
1191 case OMP_CLAUSE_NUM_GANGS
:
1192 pp_string (pp
, "num_gangs(");
1193 dump_generic_node (pp
, OMP_CLAUSE_NUM_GANGS_EXPR (clause
),
1195 pp_character (pp
, ')');
1198 case OMP_CLAUSE_NUM_WORKERS
:
1199 pp_string (pp
, "num_workers(");
1200 dump_generic_node (pp
, OMP_CLAUSE_NUM_WORKERS_EXPR (clause
),
1202 pp_character (pp
, ')');
1205 case OMP_CLAUSE_VECTOR_LENGTH
:
1206 pp_string (pp
, "vector_length(");
1207 dump_generic_node (pp
, OMP_CLAUSE_VECTOR_LENGTH_EXPR (clause
),
1209 pp_character (pp
, ')');
1212 case OMP_CLAUSE_INBRANCH
:
1213 pp_string (pp
, "inbranch");
1215 case OMP_CLAUSE_NOTINBRANCH
:
1216 pp_string (pp
, "notinbranch");
1218 case OMP_CLAUSE_FOR
:
1219 pp_string (pp
, "for");
1221 case OMP_CLAUSE_PARALLEL
:
1222 pp_string (pp
, "parallel");
1224 case OMP_CLAUSE_SECTIONS
:
1225 pp_string (pp
, "sections");
1227 case OMP_CLAUSE_TASKGROUP
:
1228 pp_string (pp
, "taskgroup");
1230 case OMP_CLAUSE_NOGROUP
:
1231 pp_string (pp
, "nogroup");
1233 case OMP_CLAUSE_THREADS
:
1234 pp_string (pp
, "threads");
1236 case OMP_CLAUSE_SIMD
:
1237 pp_string (pp
, "simd");
1239 case OMP_CLAUSE_INDEPENDENT
:
1240 pp_string (pp
, "independent");
1242 case OMP_CLAUSE_TILE
:
1243 pp_string (pp
, "tile(");
1244 dump_generic_node (pp
, OMP_CLAUSE_TILE_LIST (clause
),
1246 pp_right_paren (pp
);
1249 case OMP_CLAUSE__GRIDDIM_
:
1250 pp_string (pp
, "_griddim_(");
1251 pp_unsigned_wide_integer (pp
, OMP_CLAUSE__GRIDDIM__DIMENSION (clause
));
1253 dump_generic_node (pp
, OMP_CLAUSE__GRIDDIM__SIZE (clause
), spc
, flags
,
1256 dump_generic_node (pp
, OMP_CLAUSE__GRIDDIM__GROUP (clause
), spc
, flags
,
1258 pp_right_paren (pp
);
1260 case OMP_CLAUSE_IF_PRESENT
:
1261 pp_string (pp
, "if_present");
1263 case OMP_CLAUSE_FINALIZE
:
1264 pp_string (pp
, "finalize");
1273 /* Dump the list of OpenMP clauses. PP, SPC and FLAGS are as in
1274 dump_generic_node. */
1277 dump_omp_clauses (pretty_printer
*pp
, tree clause
, int spc
, dump_flags_t flags
)
1285 dump_omp_clause (pp
, clause
, spc
, flags
);
1286 clause
= OMP_CLAUSE_CHAIN (clause
);
1294 /* Dump location LOC to PP. */
1297 dump_location (pretty_printer
*pp
, location_t loc
)
1299 expanded_location xloc
= expand_location (loc
);
1301 pp_left_bracket (pp
);
1304 pp_string (pp
, xloc
.file
);
1305 pp_string (pp
, ":");
1307 pp_decimal_int (pp
, xloc
.line
);
1309 pp_decimal_int (pp
, xloc
.column
);
1310 pp_string (pp
, "] ");
1314 /* Dump lexical block BLOCK. PP, SPC and FLAGS are as in
1315 dump_generic_node. */
1318 dump_block_node (pretty_printer
*pp
, tree block
, int spc
, dump_flags_t flags
)
1322 pp_printf (pp
, "BLOCK #%d ", BLOCK_NUMBER (block
));
1324 if (flags
& TDF_ADDRESS
)
1325 pp_printf (pp
, "[%p] ", (void *) block
);
1327 if (TREE_ASM_WRITTEN (block
))
1328 pp_string (pp
, "[written] ");
1330 if (flags
& TDF_SLIM
)
1333 if (BLOCK_SOURCE_LOCATION (block
))
1334 dump_location (pp
, BLOCK_SOURCE_LOCATION (block
));
1336 newline_and_indent (pp
, spc
+ 2);
1338 if (BLOCK_SUPERCONTEXT (block
))
1340 pp_string (pp
, "SUPERCONTEXT: ");
1341 dump_generic_node (pp
, BLOCK_SUPERCONTEXT (block
), 0,
1342 flags
| TDF_SLIM
, false);
1343 newline_and_indent (pp
, spc
+ 2);
1346 if (BLOCK_SUBBLOCKS (block
))
1348 pp_string (pp
, "SUBBLOCKS: ");
1349 for (t
= BLOCK_SUBBLOCKS (block
); t
; t
= BLOCK_CHAIN (t
))
1351 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
1354 newline_and_indent (pp
, spc
+ 2);
1357 if (BLOCK_CHAIN (block
))
1359 pp_string (pp
, "SIBLINGS: ");
1360 for (t
= BLOCK_CHAIN (block
); t
; t
= BLOCK_CHAIN (t
))
1362 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
1365 newline_and_indent (pp
, spc
+ 2);
1368 if (BLOCK_VARS (block
))
1370 pp_string (pp
, "VARS: ");
1371 for (t
= BLOCK_VARS (block
); t
; t
= TREE_CHAIN (t
))
1373 dump_generic_node (pp
, t
, 0, flags
, false);
1376 newline_and_indent (pp
, spc
+ 2);
1379 if (vec_safe_length (BLOCK_NONLOCALIZED_VARS (block
)) > 0)
1382 vec
<tree
, va_gc
> *nlv
= BLOCK_NONLOCALIZED_VARS (block
);
1384 pp_string (pp
, "NONLOCALIZED_VARS: ");
1385 FOR_EACH_VEC_ELT (*nlv
, i
, t
)
1387 dump_generic_node (pp
, t
, 0, flags
, false);
1390 newline_and_indent (pp
, spc
+ 2);
1393 if (BLOCK_ABSTRACT_ORIGIN (block
))
1395 pp_string (pp
, "ABSTRACT_ORIGIN: ");
1396 dump_generic_node (pp
, BLOCK_ABSTRACT_ORIGIN (block
), 0,
1397 flags
| TDF_SLIM
, false);
1398 newline_and_indent (pp
, spc
+ 2);
1401 if (BLOCK_FRAGMENT_ORIGIN (block
))
1403 pp_string (pp
, "FRAGMENT_ORIGIN: ");
1404 dump_generic_node (pp
, BLOCK_FRAGMENT_ORIGIN (block
), 0,
1405 flags
| TDF_SLIM
, false);
1406 newline_and_indent (pp
, spc
+ 2);
1409 if (BLOCK_FRAGMENT_CHAIN (block
))
1411 pp_string (pp
, "FRAGMENT_CHAIN: ");
1412 for (t
= BLOCK_FRAGMENT_CHAIN (block
); t
; t
= BLOCK_FRAGMENT_CHAIN (t
))
1414 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
1417 newline_and_indent (pp
, spc
+ 2);
1421 /* Dump #pragma omp atomic memory order clause. */
1424 dump_omp_atomic_memory_order (pretty_printer
*pp
, enum omp_memory_order mo
)
1428 case OMP_MEMORY_ORDER_RELAXED
:
1429 pp_string (pp
, " relaxed");
1431 case OMP_MEMORY_ORDER_SEQ_CST
:
1432 pp_string (pp
, " seq_cst");
1434 case OMP_MEMORY_ORDER_ACQ_REL
:
1435 pp_string (pp
, " acq_rel");
1437 case OMP_MEMORY_ORDER_ACQUIRE
:
1438 pp_string (pp
, " acquire");
1440 case OMP_MEMORY_ORDER_RELEASE
:
1441 pp_string (pp
, " release");
1443 case OMP_MEMORY_ORDER_UNSPECIFIED
:
1450 /* Helper to dump a MEM_REF node. */
1453 dump_mem_ref (pretty_printer
*pp
, tree node
, int spc
, dump_flags_t flags
)
1455 if (flags
& TDF_GIMPLE
)
1457 pp_string (pp
, "__MEM <");
1458 dump_generic_node (pp
, TREE_TYPE (node
),
1459 spc
, flags
| TDF_SLIM
, false);
1460 if (TYPE_ALIGN (TREE_TYPE (node
))
1461 != TYPE_ALIGN (TYPE_MAIN_VARIANT (TREE_TYPE (node
))))
1463 pp_string (pp
, ", ");
1464 pp_decimal_int (pp
, TYPE_ALIGN (TREE_TYPE (node
)));
1467 pp_string (pp
, " (");
1468 if (TREE_TYPE (TREE_OPERAND (node
, 0))
1469 != TREE_TYPE (TREE_OPERAND (node
, 1)))
1472 dump_generic_node (pp
, TREE_TYPE (TREE_OPERAND (node
, 1)),
1473 spc
, flags
| TDF_SLIM
, false);
1474 pp_right_paren (pp
);
1476 dump_generic_node (pp
, TREE_OPERAND (node
, 0),
1477 spc
, flags
| TDF_SLIM
, false);
1478 if (! integer_zerop (TREE_OPERAND (node
, 1)))
1480 pp_string (pp
, " + ");
1481 dump_generic_node (pp
, TREE_OPERAND (node
, 1),
1482 spc
, flags
| TDF_SLIM
, false);
1484 pp_right_paren (pp
);
1486 else if (integer_zerop (TREE_OPERAND (node
, 1))
1487 /* Dump the types of INTEGER_CSTs explicitly, for we can't
1488 infer them and MEM_ATTR caching will share MEM_REFs
1489 with differently-typed op0s. */
1490 && TREE_CODE (TREE_OPERAND (node
, 0)) != INTEGER_CST
1491 /* Released SSA_NAMES have no TREE_TYPE. */
1492 && TREE_TYPE (TREE_OPERAND (node
, 0)) != NULL_TREE
1493 /* Same pointer types, but ignoring POINTER_TYPE vs.
1495 && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 0)))
1496 == TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 1))))
1497 && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (node
, 0)))
1498 == TYPE_MODE (TREE_TYPE (TREE_OPERAND (node
, 1))))
1499 && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node
, 0)))
1500 == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node
, 1))))
1501 /* Same value types ignoring qualifiers. */
1502 && (TYPE_MAIN_VARIANT (TREE_TYPE (node
))
1503 == TYPE_MAIN_VARIANT
1504 (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 1)))))
1505 && (!(flags
& TDF_ALIAS
)
1506 || MR_DEPENDENCE_CLIQUE (node
) == 0))
1508 if (TREE_CODE (TREE_OPERAND (node
, 0)) != ADDR_EXPR
)
1510 /* Enclose pointers to arrays in parentheses. */
1511 tree op0
= TREE_OPERAND (node
, 0);
1512 tree op0type
= TREE_TYPE (op0
);
1513 if (POINTER_TYPE_P (op0type
)
1514 && TREE_CODE (TREE_TYPE (op0type
)) == ARRAY_TYPE
)
1517 dump_generic_node (pp
, op0
, spc
, flags
, false);
1518 if (POINTER_TYPE_P (op0type
)
1519 && TREE_CODE (TREE_TYPE (op0type
)) == ARRAY_TYPE
)
1520 pp_right_paren (pp
);
1523 dump_generic_node (pp
,
1524 TREE_OPERAND (TREE_OPERAND (node
, 0), 0),
1529 pp_string (pp
, "MEM");
1531 tree nodetype
= TREE_TYPE (node
);
1532 tree op0
= TREE_OPERAND (node
, 0);
1533 tree op1
= TREE_OPERAND (node
, 1);
1534 tree op1type
= TYPE_MAIN_VARIANT (TREE_TYPE (op1
));
1536 tree op0size
= TYPE_SIZE (nodetype
);
1537 tree op1size
= TYPE_SIZE (TREE_TYPE (op1type
));
1539 if (!op0size
|| !op1size
1540 || !operand_equal_p (op0size
, op1size
, 0))
1542 pp_string (pp
, " <");
1543 /* If the size of the type of the operand is not the same
1544 as the size of the MEM_REF expression include the type
1545 of the latter similar to the TDF_GIMPLE output to make
1546 it clear how many bytes of memory are being accessed. */
1547 dump_generic_node (pp
, nodetype
, spc
, flags
| TDF_SLIM
, false);
1548 pp_string (pp
, "> ");
1551 pp_string (pp
, "[(");
1552 dump_generic_node (pp
, op1type
, spc
, flags
| TDF_SLIM
, false);
1553 pp_right_paren (pp
);
1554 dump_generic_node (pp
, op0
, spc
, flags
, false);
1555 if (!integer_zerop (op1
))
1556 if (!integer_zerop (TREE_OPERAND (node
, 1)))
1558 pp_string (pp
, " + ");
1559 dump_generic_node (pp
, op1
, spc
, flags
, false);
1561 if ((flags
& TDF_ALIAS
)
1562 && MR_DEPENDENCE_CLIQUE (node
) != 0)
1564 pp_string (pp
, " clique ");
1565 pp_unsigned_wide_integer (pp
, MR_DEPENDENCE_CLIQUE (node
));
1566 pp_string (pp
, " base ");
1567 pp_unsigned_wide_integer (pp
, MR_DEPENDENCE_BASE (node
));
1569 pp_right_bracket (pp
);
1573 /* Helper function for dump_generic_node. Dump INIT or COND expression for
1574 OpenMP loop non-rectangular iterators. */
1577 dump_omp_loop_non_rect_expr (pretty_printer
*pp
, tree node
, int spc
,
1580 gcc_assert (TREE_CODE (node
) == TREE_VEC
);
1581 dump_generic_node (pp
, TREE_VEC_ELT (node
, 0), spc
, flags
, false);
1582 pp_string (pp
, " * ");
1583 if (op_prio (TREE_VEC_ELT (node
, 1)) <= op_code_prio (MULT_EXPR
))
1586 dump_generic_node (pp
, TREE_VEC_ELT (node
, 1), spc
, flags
, false);
1587 pp_right_paren (pp
);
1590 dump_generic_node (pp
, TREE_VEC_ELT (node
, 1), spc
, flags
, false);
1591 pp_string (pp
, " + ");
1592 if (op_prio (TREE_VEC_ELT (node
, 1)) <= op_code_prio (PLUS_EXPR
))
1595 dump_generic_node (pp
, TREE_VEC_ELT (node
, 2), spc
, flags
, false);
1596 pp_right_paren (pp
);
1599 dump_generic_node (pp
, TREE_VEC_ELT (node
, 2), spc
, flags
, false);
1602 /* Dump the node NODE on the pretty_printer PP, SPC spaces of
1603 indent. FLAGS specifies details to show in the dump (see TDF_* in
1604 dumpfile.h). If IS_STMT is true, the object printed is considered
1605 to be a statement and it is terminated by ';' if appropriate. */
1608 dump_generic_node (pretty_printer
*pp
, tree node
, int spc
, dump_flags_t flags
,
1615 enum tree_code code
;
1617 if (node
== NULL_TREE
)
1620 is_expr
= EXPR_P (node
);
1622 if (is_stmt
&& (flags
& TDF_STMTADDR
))
1623 pp_printf (pp
, "<&%p> ", (void *)node
);
1625 if ((flags
& TDF_LINENO
) && EXPR_HAS_LOCATION (node
))
1626 dump_location (pp
, EXPR_LOCATION (node
));
1628 code
= TREE_CODE (node
);
1632 pp_string (pp
, "<<< error >>>");
1635 case IDENTIFIER_NODE
:
1636 pp_tree_identifier (pp
, node
);
1640 while (node
&& node
!= error_mark_node
)
1642 if (TREE_PURPOSE (node
))
1644 dump_generic_node (pp
, TREE_PURPOSE (node
), spc
, flags
, false);
1647 dump_generic_node (pp
, TREE_VALUE (node
), spc
, flags
, false);
1648 node
= TREE_CHAIN (node
);
1649 if (node
&& TREE_CODE (node
) == TREE_LIST
)
1658 dump_generic_node (pp
, BINFO_TYPE (node
), spc
, flags
, false);
1664 if (TREE_VEC_LENGTH (node
) > 0)
1666 size_t len
= TREE_VEC_LENGTH (node
);
1667 for (i
= 0; i
< len
- 1; i
++)
1669 dump_generic_node (pp
, TREE_VEC_ELT (node
, i
), spc
, flags
,
1674 dump_generic_node (pp
, TREE_VEC_ELT (node
, len
- 1), spc
,
1683 case FIXED_POINT_TYPE
:
1689 unsigned int quals
= TYPE_QUALS (node
);
1690 enum tree_code_class tclass
;
1692 if (quals
& TYPE_QUAL_ATOMIC
)
1693 pp_string (pp
, "atomic ");
1694 if (quals
& TYPE_QUAL_CONST
)
1695 pp_string (pp
, "const ");
1696 else if (quals
& TYPE_QUAL_VOLATILE
)
1697 pp_string (pp
, "volatile ");
1698 else if (quals
& TYPE_QUAL_RESTRICT
)
1699 pp_string (pp
, "restrict ");
1701 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
1703 pp_string (pp
, "<address-space-");
1704 pp_decimal_int (pp
, TYPE_ADDR_SPACE (node
));
1705 pp_string (pp
, "> ");
1708 tclass
= TREE_CODE_CLASS (TREE_CODE (node
));
1710 if (tclass
== tcc_declaration
)
1712 if (DECL_NAME (node
))
1713 dump_decl_name (pp
, node
, flags
);
1715 pp_string (pp
, "<unnamed type decl>");
1717 else if (tclass
== tcc_type
)
1719 if (TYPE_NAME (node
))
1721 if (TREE_CODE (TYPE_NAME (node
)) == IDENTIFIER_NODE
)
1722 pp_tree_identifier (pp
, TYPE_NAME (node
));
1723 else if (TREE_CODE (TYPE_NAME (node
)) == TYPE_DECL
1724 && DECL_NAME (TYPE_NAME (node
)))
1725 dump_decl_name (pp
, TYPE_NAME (node
), flags
);
1727 pp_string (pp
, "<unnamed type>");
1729 else if (TREE_CODE (node
) == VECTOR_TYPE
)
1731 pp_string (pp
, "vector");
1733 pp_wide_integer (pp
, TYPE_VECTOR_SUBPARTS (node
));
1734 pp_string (pp
, ") ");
1735 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1737 else if (TREE_CODE (node
) == INTEGER_TYPE
)
1739 if (TYPE_PRECISION (node
) == CHAR_TYPE_SIZE
)
1740 pp_string (pp
, (TYPE_UNSIGNED (node
)
1743 else if (TYPE_PRECISION (node
) == SHORT_TYPE_SIZE
)
1744 pp_string (pp
, (TYPE_UNSIGNED (node
)
1747 else if (TYPE_PRECISION (node
) == INT_TYPE_SIZE
)
1748 pp_string (pp
, (TYPE_UNSIGNED (node
)
1751 else if (TYPE_PRECISION (node
) == LONG_TYPE_SIZE
)
1752 pp_string (pp
, (TYPE_UNSIGNED (node
)
1755 else if (TYPE_PRECISION (node
) == LONG_LONG_TYPE_SIZE
)
1756 pp_string (pp
, (TYPE_UNSIGNED (node
)
1757 ? "unsigned long long"
1758 : "signed long long"));
1759 else if (TYPE_PRECISION (node
) >= CHAR_TYPE_SIZE
1760 && pow2p_hwi (TYPE_PRECISION (node
)))
1762 pp_string (pp
, (TYPE_UNSIGNED (node
) ? "uint" : "int"));
1763 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1764 pp_string (pp
, "_t");
1768 pp_string (pp
, (TYPE_UNSIGNED (node
)
1769 ? "<unnamed-unsigned:"
1770 : "<unnamed-signed:"));
1771 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1775 else if (TREE_CODE (node
) == COMPLEX_TYPE
)
1777 pp_string (pp
, "__complex__ ");
1778 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1780 else if (TREE_CODE (node
) == REAL_TYPE
)
1782 pp_string (pp
, "<float:");
1783 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1786 else if (TREE_CODE (node
) == FIXED_POINT_TYPE
)
1788 pp_string (pp
, "<fixed-point-");
1789 pp_string (pp
, TYPE_SATURATING (node
) ? "sat:" : "nonsat:");
1790 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1793 else if (TREE_CODE (node
) == BOOLEAN_TYPE
)
1795 pp_string (pp
, (TYPE_UNSIGNED (node
)
1796 ? "<unsigned-boolean:"
1797 : "<signed-boolean:"));
1798 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1801 else if (TREE_CODE (node
) == VOID_TYPE
)
1802 pp_string (pp
, "void");
1804 pp_string (pp
, "<unnamed type>");
1810 case REFERENCE_TYPE
:
1811 str
= (TREE_CODE (node
) == POINTER_TYPE
? "*" : "&");
1813 if (TREE_TYPE (node
) == NULL
)
1815 pp_string (pp
, str
);
1816 pp_string (pp
, "<null type>");
1818 else if (TREE_CODE (TREE_TYPE (node
)) == FUNCTION_TYPE
)
1820 tree fnode
= TREE_TYPE (node
);
1822 dump_generic_node (pp
, TREE_TYPE (fnode
), spc
, flags
, false);
1825 pp_string (pp
, str
);
1826 if (TYPE_IDENTIFIER (node
))
1827 dump_generic_node (pp
, TYPE_NAME (node
), spc
, flags
, false);
1828 else if (flags
& TDF_NOUID
)
1829 pp_printf (pp
, "<Txxxx>");
1831 pp_printf (pp
, "<T%x>", TYPE_UID (node
));
1833 pp_right_paren (pp
);
1834 dump_function_declaration (pp
, fnode
, spc
, flags
);
1838 unsigned int quals
= TYPE_QUALS (node
);
1840 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1842 pp_string (pp
, str
);
1844 if (quals
& TYPE_QUAL_CONST
)
1845 pp_string (pp
, " const");
1846 if (quals
& TYPE_QUAL_VOLATILE
)
1847 pp_string (pp
, " volatile");
1848 if (quals
& TYPE_QUAL_RESTRICT
)
1849 pp_string (pp
, " restrict");
1851 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
1853 pp_string (pp
, " <address-space-");
1854 pp_decimal_int (pp
, TYPE_ADDR_SPACE (node
));
1858 if (TYPE_REF_CAN_ALIAS_ALL (node
))
1859 pp_string (pp
, " {ref-all}");
1868 dump_mem_ref (pp
, node
, spc
, flags
);
1871 case TARGET_MEM_REF
:
1873 const char *sep
= "";
1876 pp_string (pp
, "MEM[");
1878 if (TREE_CODE (TMR_BASE (node
)) == ADDR_EXPR
)
1880 pp_string (pp
, sep
);
1882 pp_string (pp
, "symbol: ");
1883 dump_generic_node (pp
, TREE_OPERAND (TMR_BASE (node
), 0),
1888 pp_string (pp
, sep
);
1890 pp_string (pp
, "base: ");
1891 dump_generic_node (pp
, TMR_BASE (node
), spc
, flags
, false);
1893 tmp
= TMR_INDEX2 (node
);
1896 pp_string (pp
, sep
);
1898 pp_string (pp
, "base: ");
1899 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1901 tmp
= TMR_INDEX (node
);
1904 pp_string (pp
, sep
);
1906 pp_string (pp
, "index: ");
1907 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1909 tmp
= TMR_STEP (node
);
1912 pp_string (pp
, sep
);
1914 pp_string (pp
, "step: ");
1915 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1917 tmp
= TMR_OFFSET (node
);
1920 pp_string (pp
, sep
);
1922 pp_string (pp
, "offset: ");
1923 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1925 pp_right_bracket (pp
);
1931 unsigned int quals
= TYPE_QUALS (node
);
1934 if (quals
& TYPE_QUAL_ATOMIC
)
1935 pp_string (pp
, "atomic ");
1936 if (quals
& TYPE_QUAL_CONST
)
1937 pp_string (pp
, "const ");
1938 if (quals
& TYPE_QUAL_VOLATILE
)
1939 pp_string (pp
, "volatile ");
1941 /* Print the innermost component type. */
1942 for (tmp
= TREE_TYPE (node
); TREE_CODE (tmp
) == ARRAY_TYPE
;
1943 tmp
= TREE_TYPE (tmp
))
1945 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1947 /* Print the dimensions. */
1948 for (tmp
= node
; TREE_CODE (tmp
) == ARRAY_TYPE
; tmp
= TREE_TYPE (tmp
))
1949 dump_array_domain (pp
, TYPE_DOMAIN (tmp
), spc
, flags
);
1955 case QUAL_UNION_TYPE
:
1957 unsigned int quals
= TYPE_QUALS (node
);
1959 if (quals
& TYPE_QUAL_ATOMIC
)
1960 pp_string (pp
, "atomic ");
1961 if (quals
& TYPE_QUAL_CONST
)
1962 pp_string (pp
, "const ");
1963 if (quals
& TYPE_QUAL_VOLATILE
)
1964 pp_string (pp
, "volatile ");
1966 /* Print the name of the structure. */
1967 if (TREE_CODE (node
) == RECORD_TYPE
)
1968 pp_string (pp
, "struct ");
1969 else if (TREE_CODE (node
) == UNION_TYPE
)
1970 pp_string (pp
, "union ");
1972 if (TYPE_NAME (node
))
1973 dump_generic_node (pp
, TYPE_NAME (node
), spc
, flags
, false);
1974 else if (!(flags
& TDF_SLIM
))
1975 /* FIXME: If we eliminate the 'else' above and attempt
1976 to show the fields for named types, we may get stuck
1977 following a cycle of pointers to structs. The alleged
1978 self-reference check in print_struct_decl will not detect
1979 cycles involving more than one pointer or struct type. */
1980 print_struct_decl (pp
, node
, spc
, flags
);
1989 if (flags
& TDF_GIMPLE
1990 && (POINTER_TYPE_P (TREE_TYPE (node
))
1991 || (TYPE_PRECISION (TREE_TYPE (node
))
1992 < TYPE_PRECISION (integer_type_node
))
1993 || exact_log2 (TYPE_PRECISION (TREE_TYPE (node
))) == -1
1994 || tree_int_cst_sgn (node
) < 0))
1996 pp_string (pp
, "_Literal (");
1997 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1998 pp_string (pp
, ") ");
2000 if (TREE_CODE (TREE_TYPE (node
)) == POINTER_TYPE
2001 && ! (flags
& TDF_GIMPLE
))
2003 /* In the case of a pointer, one may want to divide by the
2004 size of the pointed-to type. Unfortunately, this not
2005 straightforward. The C front-end maps expressions
2010 in such a way that the two INTEGER_CST nodes for "5" have
2011 different values but identical types. In the latter
2012 case, the 5 is multiplied by sizeof (int) in c-common.c
2013 (pointer_int_sum) to convert it to a byte address, and
2014 yet the type of the node is left unchanged. Argh. What
2015 is consistent though is that the number value corresponds
2016 to bytes (UNITS) offset.
2018 NB: Neither of the following divisors can be trivially
2019 used to recover the original literal:
2021 TREE_INT_CST_LOW (TYPE_SIZE_UNIT (TREE_TYPE (node)))
2022 TYPE_PRECISION (TREE_TYPE (TREE_TYPE (node))) */
2023 pp_wide_integer (pp
, TREE_INT_CST_LOW (node
));
2024 pp_string (pp
, "B"); /* pseudo-unit */
2026 else if (tree_fits_shwi_p (node
))
2027 pp_wide_integer (pp
, tree_to_shwi (node
));
2028 else if (tree_fits_uhwi_p (node
))
2029 pp_unsigned_wide_integer (pp
, tree_to_uhwi (node
));
2032 wide_int val
= wi::to_wide (node
);
2034 if (wi::neg_p (val
, TYPE_SIGN (TREE_TYPE (node
))))
2039 print_hex (val
, pp_buffer (pp
)->digit_buffer
);
2040 pp_string (pp
, pp_buffer (pp
)->digit_buffer
);
2042 if ((flags
& TDF_GIMPLE
)
2043 && ! (POINTER_TYPE_P (TREE_TYPE (node
))
2044 || (TYPE_PRECISION (TREE_TYPE (node
))
2045 < TYPE_PRECISION (integer_type_node
))
2046 || exact_log2 (TYPE_PRECISION (TREE_TYPE (node
))) == -1))
2048 if (TYPE_UNSIGNED (TREE_TYPE (node
)))
2049 pp_character (pp
, 'u');
2050 if (TYPE_PRECISION (TREE_TYPE (node
))
2051 == TYPE_PRECISION (unsigned_type_node
))
2053 else if (TYPE_PRECISION (TREE_TYPE (node
))
2054 == TYPE_PRECISION (long_unsigned_type_node
))
2055 pp_character (pp
, 'l');
2056 else if (TYPE_PRECISION (TREE_TYPE (node
))
2057 == TYPE_PRECISION (long_long_unsigned_type_node
))
2058 pp_string (pp
, "ll");
2060 if (TREE_OVERFLOW (node
))
2061 pp_string (pp
, "(OVF)");
2065 pp_string (pp
, "POLY_INT_CST [");
2066 dump_generic_node (pp
, POLY_INT_CST_COEFF (node
, 0), spc
, flags
, false);
2067 for (unsigned int i
= 1; i
< NUM_POLY_INT_COEFFS
; ++i
)
2069 pp_string (pp
, ", ");
2070 dump_generic_node (pp
, POLY_INT_CST_COEFF (node
, i
),
2073 pp_string (pp
, "]");
2077 /* Code copied from print_node. */
2080 if (TREE_OVERFLOW (node
))
2081 pp_string (pp
, " overflow");
2083 d
= TREE_REAL_CST (node
);
2084 if (REAL_VALUE_ISINF (d
))
2085 pp_string (pp
, REAL_VALUE_NEGATIVE (d
) ? " -Inf" : " Inf");
2086 else if (REAL_VALUE_ISNAN (d
))
2087 pp_string (pp
, " Nan");
2091 real_to_decimal (string
, &d
, sizeof (string
), 0, 1);
2092 pp_string (pp
, string
);
2100 fixed_to_decimal (string
, TREE_FIXED_CST_PTR (node
), sizeof (string
));
2101 pp_string (pp
, string
);
2106 pp_string (pp
, "__complex__ (");
2107 dump_generic_node (pp
, TREE_REALPART (node
), spc
, flags
, false);
2108 pp_string (pp
, ", ");
2109 dump_generic_node (pp
, TREE_IMAGPART (node
), spc
, flags
, false);
2110 pp_right_paren (pp
);
2115 pp_string (pp
, "\"");
2116 if (unsigned nbytes
= TREE_STRING_LENGTH (node
))
2117 pretty_print_string (pp
, TREE_STRING_POINTER (node
), nbytes
);
2118 pp_string (pp
, "\"");
2125 if (flags
& TDF_GIMPLE
)
2127 pp_string (pp
, "_Literal (");
2128 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2129 pp_string (pp
, ") ");
2131 pp_string (pp
, "{ ");
2132 unsigned HOST_WIDE_INT nunits
;
2133 if (!VECTOR_CST_NELTS (node
).is_constant (&nunits
))
2134 nunits
= vector_cst_encoded_nelts (node
);
2135 for (i
= 0; i
< nunits
; ++i
)
2138 pp_string (pp
, ", ");
2139 dump_generic_node (pp
, VECTOR_CST_ELT (node
, i
),
2142 if (!VECTOR_CST_NELTS (node
).is_constant ())
2143 pp_string (pp
, ", ...");
2144 pp_string (pp
, " }");
2150 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2152 if (TREE_CODE (node
) == METHOD_TYPE
)
2154 if (TYPE_METHOD_BASETYPE (node
))
2155 dump_generic_node (pp
, TYPE_NAME (TYPE_METHOD_BASETYPE (node
)),
2158 pp_string (pp
, "<null method basetype>");
2159 pp_colon_colon (pp
);
2161 if (TYPE_IDENTIFIER (node
))
2162 dump_generic_node (pp
, TYPE_NAME (node
), spc
, flags
, false);
2163 else if (TYPE_NAME (node
) && DECL_NAME (TYPE_NAME (node
)))
2164 dump_decl_name (pp
, TYPE_NAME (node
), flags
);
2165 else if (flags
& TDF_NOUID
)
2166 pp_printf (pp
, "<Txxxx>");
2168 pp_printf (pp
, "<T%x>", TYPE_UID (node
));
2169 dump_function_declaration (pp
, node
, spc
, flags
);
2174 dump_decl_name (pp
, node
, flags
);
2178 if (DECL_NAME (node
))
2179 dump_decl_name (pp
, node
, flags
);
2180 else if (LABEL_DECL_UID (node
) != -1)
2182 if (flags
& TDF_GIMPLE
)
2183 pp_printf (pp
, "L%d", (int) LABEL_DECL_UID (node
));
2185 pp_printf (pp
, "<L%d>", (int) LABEL_DECL_UID (node
));
2189 if (flags
& TDF_NOUID
)
2190 pp_string (pp
, "<D.xxxx>");
2193 if (flags
& TDF_GIMPLE
)
2194 pp_printf (pp
, "<D%u>", DECL_UID (node
));
2196 pp_printf (pp
, "<D.%u>", DECL_UID (node
));
2202 if (DECL_IS_BUILTIN (node
))
2204 /* Don't print the declaration of built-in types. */
2207 if (DECL_NAME (node
))
2208 dump_decl_name (pp
, node
, flags
);
2209 else if (TYPE_NAME (TREE_TYPE (node
)) != node
)
2211 pp_string (pp
, (TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
2212 ? "union" : "struct "));
2213 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2216 pp_string (pp
, "<anon>");
2222 case DEBUG_EXPR_DECL
:
2223 case NAMESPACE_DECL
:
2225 dump_decl_name (pp
, node
, flags
);
2229 pp_string (pp
, "<retval>");
2233 op0
= TREE_OPERAND (node
, 0);
2236 && (TREE_CODE (op0
) == INDIRECT_REF
2237 || (TREE_CODE (op0
) == MEM_REF
2238 && TREE_CODE (TREE_OPERAND (op0
, 0)) != ADDR_EXPR
2239 && integer_zerop (TREE_OPERAND (op0
, 1))
2240 /* Dump the types of INTEGER_CSTs explicitly, for we
2241 can't infer them and MEM_ATTR caching will share
2242 MEM_REFs with differently-typed op0s. */
2243 && TREE_CODE (TREE_OPERAND (op0
, 0)) != INTEGER_CST
2244 /* Released SSA_NAMES have no TREE_TYPE. */
2245 && TREE_TYPE (TREE_OPERAND (op0
, 0)) != NULL_TREE
2246 /* Same pointer types, but ignoring POINTER_TYPE vs.
2248 && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 0)))
2249 == TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 1))))
2250 && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0
, 0)))
2251 == TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0
, 1))))
2252 && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0
, 0)))
2253 == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0
, 1))))
2254 /* Same value types ignoring qualifiers. */
2255 && (TYPE_MAIN_VARIANT (TREE_TYPE (op0
))
2256 == TYPE_MAIN_VARIANT
2257 (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 1)))))
2258 && MR_DEPENDENCE_CLIQUE (op0
) == 0)))
2260 op0
= TREE_OPERAND (op0
, 0);
2263 if (op_prio (op0
) < op_prio (node
))
2265 dump_generic_node (pp
, op0
, spc
, flags
, false);
2266 if (op_prio (op0
) < op_prio (node
))
2267 pp_right_paren (pp
);
2268 pp_string (pp
, str
);
2269 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2270 op0
= component_ref_field_offset (node
);
2271 if (op0
&& TREE_CODE (op0
) != INTEGER_CST
)
2273 pp_string (pp
, "{off: ");
2274 dump_generic_node (pp
, op0
, spc
, flags
, false);
2275 pp_right_brace (pp
);
2280 if (flags
& TDF_GIMPLE
)
2282 pp_string (pp
, "__BIT_FIELD_REF <");
2283 dump_generic_node (pp
, TREE_TYPE (node
),
2284 spc
, flags
| TDF_SLIM
, false);
2285 if (TYPE_ALIGN (TREE_TYPE (node
))
2286 != TYPE_ALIGN (TYPE_MAIN_VARIANT (TREE_TYPE (node
))))
2288 pp_string (pp
, ", ");
2289 pp_decimal_int (pp
, TYPE_ALIGN (TREE_TYPE (node
)));
2292 pp_string (pp
, " (");
2293 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
,
2294 flags
| TDF_SLIM
, false);
2295 pp_string (pp
, ", ");
2296 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
,
2297 flags
| TDF_SLIM
, false);
2298 pp_string (pp
, ", ");
2299 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
,
2300 flags
| TDF_SLIM
, false);
2301 pp_right_paren (pp
);
2305 pp_string (pp
, "BIT_FIELD_REF <");
2306 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2307 pp_string (pp
, ", ");
2308 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2309 pp_string (pp
, ", ");
2310 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2315 case BIT_INSERT_EXPR
:
2316 pp_string (pp
, "BIT_INSERT_EXPR <");
2317 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2318 pp_string (pp
, ", ");
2319 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2320 pp_string (pp
, ", ");
2321 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2322 pp_string (pp
, " (");
2323 if (INTEGRAL_TYPE_P (TREE_TYPE (TREE_OPERAND (node
, 1))))
2325 TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (node
, 1))));
2327 dump_generic_node (pp
, TYPE_SIZE (TREE_TYPE (TREE_OPERAND (node
, 1))),
2329 pp_string (pp
, " bits)>");
2333 case ARRAY_RANGE_REF
:
2334 op0
= TREE_OPERAND (node
, 0);
2335 if (op_prio (op0
) < op_prio (node
))
2337 dump_generic_node (pp
, op0
, spc
, flags
, false);
2338 if (op_prio (op0
) < op_prio (node
))
2339 pp_right_paren (pp
);
2340 pp_left_bracket (pp
);
2341 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2342 if (TREE_CODE (node
) == ARRAY_RANGE_REF
)
2343 pp_string (pp
, " ...");
2344 pp_right_bracket (pp
);
2346 op0
= array_ref_low_bound (node
);
2347 op1
= array_ref_element_size (node
);
2349 if (!integer_zerop (op0
)
2350 || TREE_OPERAND (node
, 2)
2351 || TREE_OPERAND (node
, 3))
2353 pp_string (pp
, "{lb: ");
2354 dump_generic_node (pp
, op0
, spc
, flags
, false);
2355 pp_string (pp
, " sz: ");
2356 dump_generic_node (pp
, op1
, spc
, flags
, false);
2357 pp_right_brace (pp
);
2363 unsigned HOST_WIDE_INT ix
;
2365 bool is_struct_init
= false;
2366 bool is_array_init
= false;
2368 if (flags
& TDF_GIMPLE
)
2370 pp_string (pp
, "_Literal (");
2371 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2372 pp_string (pp
, ") ");
2375 if (TREE_CLOBBER_P (node
))
2376 pp_string (pp
, "CLOBBER");
2377 else if (TREE_CODE (TREE_TYPE (node
)) == RECORD_TYPE
2378 || TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
)
2379 is_struct_init
= true;
2380 else if (TREE_CODE (TREE_TYPE (node
)) == ARRAY_TYPE
2381 && TYPE_DOMAIN (TREE_TYPE (node
))
2382 && TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
)))
2383 && TREE_CODE (TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
))))
2386 tree minv
= TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
)));
2387 is_array_init
= true;
2388 curidx
= wi::to_widest (minv
);
2390 FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (node
), ix
, field
, val
)
2397 dump_generic_node (pp
, field
, spc
, flags
, false);
2400 else if (is_array_init
2401 && (TREE_CODE (field
) != INTEGER_CST
2402 || curidx
!= wi::to_widest (field
)))
2404 pp_left_bracket (pp
);
2405 if (TREE_CODE (field
) == RANGE_EXPR
)
2407 dump_generic_node (pp
, TREE_OPERAND (field
, 0), spc
,
2409 pp_string (pp
, " ... ");
2410 dump_generic_node (pp
, TREE_OPERAND (field
, 1), spc
,
2412 if (TREE_CODE (TREE_OPERAND (field
, 1)) == INTEGER_CST
)
2413 curidx
= wi::to_widest (TREE_OPERAND (field
, 1));
2416 dump_generic_node (pp
, field
, spc
, flags
, false);
2417 if (TREE_CODE (field
) == INTEGER_CST
)
2418 curidx
= wi::to_widest (field
);
2419 pp_string (pp
, "]=");
2424 if (val
&& TREE_CODE (val
) == ADDR_EXPR
)
2425 if (TREE_CODE (TREE_OPERAND (val
, 0)) == FUNCTION_DECL
)
2426 val
= TREE_OPERAND (val
, 0);
2427 if (val
&& TREE_CODE (val
) == FUNCTION_DECL
)
2428 dump_decl_name (pp
, val
, flags
);
2430 dump_generic_node (pp
, val
, spc
, flags
, false);
2431 if (ix
!= CONSTRUCTOR_NELTS (node
) - 1)
2437 pp_right_brace (pp
);
2444 if (flags
& TDF_SLIM
)
2446 pp_string (pp
, "<COMPOUND_EXPR>");
2450 dump_generic_node (pp
, TREE_OPERAND (node
, 0),
2451 spc
, flags
, !(flags
& TDF_SLIM
));
2452 if (flags
& TDF_SLIM
)
2453 newline_and_indent (pp
, spc
);
2460 for (tp
= &TREE_OPERAND (node
, 1);
2461 TREE_CODE (*tp
) == COMPOUND_EXPR
;
2462 tp
= &TREE_OPERAND (*tp
, 1))
2464 dump_generic_node (pp
, TREE_OPERAND (*tp
, 0),
2465 spc
, flags
, !(flags
& TDF_SLIM
));
2466 if (flags
& TDF_SLIM
)
2467 newline_and_indent (pp
, spc
);
2475 dump_generic_node (pp
, *tp
, spc
, flags
, !(flags
& TDF_SLIM
));
2479 case STATEMENT_LIST
:
2481 tree_stmt_iterator si
;
2484 if (flags
& TDF_SLIM
)
2486 pp_string (pp
, "<STATEMENT_LIST>");
2490 for (si
= tsi_start (node
); !tsi_end_p (si
); tsi_next (&si
))
2493 newline_and_indent (pp
, spc
);
2496 dump_generic_node (pp
, tsi_stmt (si
), spc
, flags
, true);
2503 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
,
2508 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
,
2513 pp_string (pp
, "TARGET_EXPR <");
2514 dump_generic_node (pp
, TARGET_EXPR_SLOT (node
), spc
, flags
, false);
2517 dump_generic_node (pp
, TARGET_EXPR_INITIAL (node
), spc
, flags
, false);
2522 print_declaration (pp
, DECL_EXPR_DECL (node
), spc
, flags
);
2527 if (TREE_TYPE (node
) == NULL
|| TREE_TYPE (node
) == void_type_node
)
2529 pp_string (pp
, "if (");
2530 dump_generic_node (pp
, COND_EXPR_COND (node
), spc
, flags
, false);
2531 pp_right_paren (pp
);
2532 /* The lowered cond_exprs should always be printed in full. */
2533 if (COND_EXPR_THEN (node
)
2534 && (IS_EMPTY_STMT (COND_EXPR_THEN (node
))
2535 || TREE_CODE (COND_EXPR_THEN (node
)) == GOTO_EXPR
)
2536 && COND_EXPR_ELSE (node
)
2537 && (IS_EMPTY_STMT (COND_EXPR_ELSE (node
))
2538 || TREE_CODE (COND_EXPR_ELSE (node
)) == GOTO_EXPR
))
2541 dump_generic_node (pp
, COND_EXPR_THEN (node
),
2543 if (!IS_EMPTY_STMT (COND_EXPR_ELSE (node
)))
2545 pp_string (pp
, " else ");
2546 dump_generic_node (pp
, COND_EXPR_ELSE (node
),
2550 else if (!(flags
& TDF_SLIM
))
2552 /* Output COND_EXPR_THEN. */
2553 if (COND_EXPR_THEN (node
))
2555 newline_and_indent (pp
, spc
+2);
2557 newline_and_indent (pp
, spc
+4);
2558 dump_generic_node (pp
, COND_EXPR_THEN (node
), spc
+4,
2560 newline_and_indent (pp
, spc
+2);
2561 pp_right_brace (pp
);
2564 /* Output COND_EXPR_ELSE. */
2565 if (COND_EXPR_ELSE (node
)
2566 && !IS_EMPTY_STMT (COND_EXPR_ELSE (node
)))
2568 newline_and_indent (pp
, spc
);
2569 pp_string (pp
, "else");
2570 newline_and_indent (pp
, spc
+2);
2572 newline_and_indent (pp
, spc
+4);
2573 dump_generic_node (pp
, COND_EXPR_ELSE (node
), spc
+4,
2575 newline_and_indent (pp
, spc
+2);
2576 pp_right_brace (pp
);
2583 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2587 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2591 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2597 if (!(flags
& TDF_SLIM
))
2599 if (BIND_EXPR_VARS (node
))
2603 for (op0
= BIND_EXPR_VARS (node
); op0
; op0
= DECL_CHAIN (op0
))
2605 print_declaration (pp
, op0
, spc
+2, flags
);
2610 newline_and_indent (pp
, spc
+2);
2611 dump_generic_node (pp
, BIND_EXPR_BODY (node
), spc
+2, flags
, true);
2612 newline_and_indent (pp
, spc
);
2613 pp_right_brace (pp
);
2619 if (CALL_EXPR_FN (node
) != NULL_TREE
)
2620 print_call_name (pp
, CALL_EXPR_FN (node
), flags
);
2624 pp_string (pp
, internal_fn_name (CALL_EXPR_IFN (node
)));
2627 /* Print parameters. */
2632 call_expr_arg_iterator iter
;
2633 FOR_EACH_CALL_EXPR_ARG (arg
, iter
, node
)
2635 dump_generic_node (pp
, arg
, spc
, flags
, false);
2636 if (more_call_expr_args_p (&iter
))
2643 if (CALL_EXPR_VA_ARG_PACK (node
))
2645 if (call_expr_nargs (node
) > 0)
2650 pp_string (pp
, "__builtin_va_arg_pack ()");
2652 pp_right_paren (pp
);
2654 op1
= CALL_EXPR_STATIC_CHAIN (node
);
2657 pp_string (pp
, " [static-chain: ");
2658 dump_generic_node (pp
, op1
, spc
, flags
, false);
2659 pp_right_bracket (pp
);
2662 if (CALL_EXPR_RETURN_SLOT_OPT (node
))
2663 pp_string (pp
, " [return slot optimization]");
2664 if (CALL_EXPR_TAILCALL (node
))
2665 pp_string (pp
, " [tail call]");
2668 case WITH_CLEANUP_EXPR
:
2672 case CLEANUP_POINT_EXPR
:
2673 pp_string (pp
, "<<cleanup_point ");
2674 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2675 pp_string (pp
, ">>");
2678 case PLACEHOLDER_EXPR
:
2679 pp_string (pp
, "<PLACEHOLDER_EXPR ");
2680 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2684 /* Binary arithmetic and logic expressions. */
2685 case WIDEN_SUM_EXPR
:
2686 case WIDEN_MULT_EXPR
:
2688 case MULT_HIGHPART_EXPR
:
2690 case POINTER_PLUS_EXPR
:
2691 case POINTER_DIFF_EXPR
:
2693 case TRUNC_DIV_EXPR
:
2695 case FLOOR_DIV_EXPR
:
2696 case ROUND_DIV_EXPR
:
2697 case TRUNC_MOD_EXPR
:
2699 case FLOOR_MOD_EXPR
:
2700 case ROUND_MOD_EXPR
:
2702 case EXACT_DIV_EXPR
:
2707 case WIDEN_LSHIFT_EXPR
:
2711 case TRUTH_ANDIF_EXPR
:
2712 case TRUTH_ORIF_EXPR
:
2713 case TRUTH_AND_EXPR
:
2715 case TRUTH_XOR_EXPR
:
2729 case UNORDERED_EXPR
:
2731 const char *op
= op_symbol (node
);
2732 op0
= TREE_OPERAND (node
, 0);
2733 op1
= TREE_OPERAND (node
, 1);
2735 /* When the operands are expressions with less priority,
2736 keep semantics of the tree representation. */
2737 if (op_prio (op0
) <= op_prio (node
))
2740 dump_generic_node (pp
, op0
, spc
, flags
, false);
2741 pp_right_paren (pp
);
2744 dump_generic_node (pp
, op0
, spc
, flags
, false);
2750 /* When the operands are expressions with less priority,
2751 keep semantics of the tree representation. */
2752 if (op_prio (op1
) <= op_prio (node
))
2755 dump_generic_node (pp
, op1
, spc
, flags
, false);
2756 pp_right_paren (pp
);
2759 dump_generic_node (pp
, op1
, spc
, flags
, false);
2763 /* Unary arithmetic and logic expressions. */
2766 case TRUTH_NOT_EXPR
:
2768 case PREDECREMENT_EXPR
:
2769 case PREINCREMENT_EXPR
:
2771 if (TREE_CODE (node
) == ADDR_EXPR
2772 && (TREE_CODE (TREE_OPERAND (node
, 0)) == STRING_CST
2773 || TREE_CODE (TREE_OPERAND (node
, 0)) == FUNCTION_DECL
))
2774 ; /* Do not output '&' for strings and function pointers. */
2776 pp_string (pp
, op_symbol (node
));
2778 if (op_prio (TREE_OPERAND (node
, 0)) < op_prio (node
))
2781 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2782 pp_right_paren (pp
);
2785 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2788 case POSTDECREMENT_EXPR
:
2789 case POSTINCREMENT_EXPR
:
2790 if (op_prio (TREE_OPERAND (node
, 0)) < op_prio (node
))
2793 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2794 pp_right_paren (pp
);
2797 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2798 pp_string (pp
, op_symbol (node
));
2802 pp_string (pp
, "MIN_EXPR <");
2803 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2804 pp_string (pp
, ", ");
2805 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2810 pp_string (pp
, "MAX_EXPR <");
2811 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2812 pp_string (pp
, ", ");
2813 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2818 pp_string (pp
, "ABS_EXPR <");
2819 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2824 pp_string (pp
, "ABSU_EXPR <");
2825 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2833 case ADDR_SPACE_CONVERT_EXPR
:
2834 case FIXED_CONVERT_EXPR
:
2835 case FIX_TRUNC_EXPR
:
2838 type
= TREE_TYPE (node
);
2839 op0
= TREE_OPERAND (node
, 0);
2840 if (type
!= TREE_TYPE (op0
))
2843 dump_generic_node (pp
, type
, spc
, flags
, false);
2844 pp_string (pp
, ") ");
2846 if (op_prio (op0
) < op_prio (node
))
2848 dump_generic_node (pp
, op0
, spc
, flags
, false);
2849 if (op_prio (op0
) < op_prio (node
))
2850 pp_right_paren (pp
);
2853 case VIEW_CONVERT_EXPR
:
2854 if (flags
& TDF_GIMPLE
)
2855 pp_string (pp
, "__VIEW_CONVERT <");
2857 pp_string (pp
, "VIEW_CONVERT_EXPR<");
2858 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2859 pp_string (pp
, ">(");
2860 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2861 pp_right_paren (pp
);
2865 pp_string (pp
, "((");
2866 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2867 pp_string (pp
, "))");
2870 case NON_LVALUE_EXPR
:
2871 pp_string (pp
, "NON_LVALUE_EXPR <");
2872 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2877 pp_string (pp
, "SAVE_EXPR <");
2878 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2883 pp_string (pp
, "COMPLEX_EXPR <");
2884 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2885 pp_string (pp
, ", ");
2886 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2891 pp_string (pp
, "CONJ_EXPR <");
2892 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2897 if (flags
& TDF_GIMPLE
)
2899 pp_string (pp
, "__real ");
2900 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2904 pp_string (pp
, "REALPART_EXPR <");
2905 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2911 if (flags
& TDF_GIMPLE
)
2913 pp_string (pp
, "__imag ");
2914 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2918 pp_string (pp
, "IMAGPART_EXPR <");
2919 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2925 pp_string (pp
, "VA_ARG_EXPR <");
2926 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2930 case TRY_FINALLY_EXPR
:
2931 case TRY_CATCH_EXPR
:
2932 pp_string (pp
, "try");
2933 newline_and_indent (pp
, spc
+2);
2935 newline_and_indent (pp
, spc
+4);
2936 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
+4, flags
, true);
2937 newline_and_indent (pp
, spc
+2);
2938 pp_right_brace (pp
);
2939 newline_and_indent (pp
, spc
);
2940 if (TREE_CODE (node
) == TRY_CATCH_EXPR
)
2942 node
= TREE_OPERAND (node
, 1);
2943 pp_string (pp
, "catch");
2947 gcc_assert (TREE_CODE (node
) == TRY_FINALLY_EXPR
);
2948 node
= TREE_OPERAND (node
, 1);
2949 pp_string (pp
, "finally");
2950 if (TREE_CODE (node
) == EH_ELSE_EXPR
)
2952 newline_and_indent (pp
, spc
+2);
2954 newline_and_indent (pp
, spc
+4);
2955 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
+4,
2957 newline_and_indent (pp
, spc
+2);
2958 pp_right_brace (pp
);
2959 newline_and_indent (pp
, spc
);
2960 node
= TREE_OPERAND (node
, 1);
2961 pp_string (pp
, "else");
2964 newline_and_indent (pp
, spc
+2);
2966 newline_and_indent (pp
, spc
+4);
2967 dump_generic_node (pp
, node
, spc
+4, flags
, true);
2968 newline_and_indent (pp
, spc
+2);
2969 pp_right_brace (pp
);
2974 pp_string (pp
, "catch (");
2975 dump_generic_node (pp
, CATCH_TYPES (node
), spc
+2, flags
, false);
2976 pp_right_paren (pp
);
2977 newline_and_indent (pp
, spc
+2);
2979 newline_and_indent (pp
, spc
+4);
2980 dump_generic_node (pp
, CATCH_BODY (node
), spc
+4, flags
, true);
2981 newline_and_indent (pp
, spc
+2);
2982 pp_right_brace (pp
);
2986 case EH_FILTER_EXPR
:
2987 pp_string (pp
, "<<<eh_filter (");
2988 dump_generic_node (pp
, EH_FILTER_TYPES (node
), spc
+2, flags
, false);
2989 pp_string (pp
, ")>>>");
2990 newline_and_indent (pp
, spc
+2);
2992 newline_and_indent (pp
, spc
+4);
2993 dump_generic_node (pp
, EH_FILTER_FAILURE (node
), spc
+4, flags
, true);
2994 newline_and_indent (pp
, spc
+2);
2995 pp_right_brace (pp
);
3000 op0
= TREE_OPERAND (node
, 0);
3001 /* If this is for break or continue, don't bother printing it. */
3002 if (DECL_NAME (op0
))
3004 const char *name
= IDENTIFIER_POINTER (DECL_NAME (op0
));
3005 if (strcmp (name
, "break") == 0
3006 || strcmp (name
, "continue") == 0)
3009 dump_generic_node (pp
, op0
, spc
, flags
, false);
3011 if (DECL_NONLOCAL (op0
))
3012 pp_string (pp
, " [non-local]");
3016 pp_string (pp
, "while (1)");
3017 if (!(flags
& TDF_SLIM
))
3019 newline_and_indent (pp
, spc
+2);
3021 newline_and_indent (pp
, spc
+4);
3022 dump_generic_node (pp
, LOOP_EXPR_BODY (node
), spc
+4, flags
, true);
3023 newline_and_indent (pp
, spc
+2);
3024 pp_right_brace (pp
);
3030 pp_string (pp
, "// predicted ");
3031 if (PREDICT_EXPR_OUTCOME (node
))
3032 pp_string (pp
, "likely by ");
3034 pp_string (pp
, "unlikely by ");
3035 pp_string (pp
, predictor_name (PREDICT_EXPR_PREDICTOR (node
)));
3036 pp_string (pp
, " predictor.");
3040 pp_string (pp
, "ANNOTATE_EXPR <");
3041 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3042 switch ((enum annot_expr_kind
) TREE_INT_CST_LOW (TREE_OPERAND (node
, 1)))
3044 case annot_expr_ivdep_kind
:
3045 pp_string (pp
, ", ivdep");
3047 case annot_expr_unroll_kind
:
3048 pp_printf (pp
, ", unroll %d",
3049 (int) TREE_INT_CST_LOW (TREE_OPERAND (node
, 2)));
3051 case annot_expr_no_vector_kind
:
3052 pp_string (pp
, ", no-vector");
3054 case annot_expr_vector_kind
:
3055 pp_string (pp
, ", vector");
3057 case annot_expr_parallel_kind
:
3058 pp_string (pp
, ", parallel");
3067 pp_string (pp
, "return");
3068 op0
= TREE_OPERAND (node
, 0);
3072 if (TREE_CODE (op0
) == MODIFY_EXPR
)
3073 dump_generic_node (pp
, TREE_OPERAND (op0
, 1),
3076 dump_generic_node (pp
, op0
, spc
, flags
, false);
3081 pp_string (pp
, "if (");
3082 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3083 pp_string (pp
, ") break");
3087 pp_string (pp
, "switch (");
3088 dump_generic_node (pp
, SWITCH_COND (node
), spc
, flags
, false);
3089 pp_right_paren (pp
);
3090 if (!(flags
& TDF_SLIM
))
3092 newline_and_indent (pp
, spc
+2);
3094 if (SWITCH_BODY (node
))
3096 newline_and_indent (pp
, spc
+4);
3097 dump_generic_node (pp
, SWITCH_BODY (node
), spc
+4, flags
,
3100 newline_and_indent (pp
, spc
+2);
3101 pp_right_brace (pp
);
3107 op0
= GOTO_DESTINATION (node
);
3108 if (TREE_CODE (op0
) != SSA_NAME
&& DECL_P (op0
) && DECL_NAME (op0
))
3110 const char *name
= IDENTIFIER_POINTER (DECL_NAME (op0
));
3111 if (strcmp (name
, "break") == 0
3112 || strcmp (name
, "continue") == 0)
3114 pp_string (pp
, name
);
3118 pp_string (pp
, "goto ");
3119 dump_generic_node (pp
, op0
, spc
, flags
, false);
3123 pp_string (pp
, "__asm__");
3124 if (ASM_VOLATILE_P (node
))
3125 pp_string (pp
, " __volatile__");
3127 dump_generic_node (pp
, ASM_STRING (node
), spc
, flags
, false);
3129 dump_generic_node (pp
, ASM_OUTPUTS (node
), spc
, flags
, false);
3131 dump_generic_node (pp
, ASM_INPUTS (node
), spc
, flags
, false);
3132 if (ASM_CLOBBERS (node
))
3135 dump_generic_node (pp
, ASM_CLOBBERS (node
), spc
, flags
, false);
3137 pp_right_paren (pp
);
3140 case CASE_LABEL_EXPR
:
3141 if (CASE_LOW (node
) && CASE_HIGH (node
))
3143 pp_string (pp
, "case ");
3144 dump_generic_node (pp
, CASE_LOW (node
), spc
, flags
, false);
3145 pp_string (pp
, " ... ");
3146 dump_generic_node (pp
, CASE_HIGH (node
), spc
, flags
, false);
3148 else if (CASE_LOW (node
))
3150 pp_string (pp
, "case ");
3151 dump_generic_node (pp
, CASE_LOW (node
), spc
, flags
, false);
3154 pp_string (pp
, "default");
3159 pp_string (pp
, "OBJ_TYPE_REF(");
3160 dump_generic_node (pp
, OBJ_TYPE_REF_EXPR (node
), spc
, flags
, false);
3162 /* We omit the class type for -fcompare-debug because we may
3163 drop TYPE_BINFO early depending on debug info, and then
3164 virtual_method_call_p would return false, whereas when
3165 TYPE_BINFO is preserved it may still return true and then
3166 we'd print the class type. Compare tree and rtl dumps for
3167 libstdc++-prettyprinters/shared_ptr.cc with and without -g,
3168 for example, at occurrences of OBJ_TYPE_REF. */
3169 if (!(flags
& (TDF_SLIM
| TDF_COMPARE_DEBUG
))
3170 && virtual_method_call_p (node
))
3172 pp_string (pp
, "(");
3173 dump_generic_node (pp
, obj_type_ref_class (node
), spc
, flags
, false);
3174 pp_string (pp
, ")");
3176 dump_generic_node (pp
, OBJ_TYPE_REF_OBJECT (node
), spc
, flags
, false);
3178 dump_generic_node (pp
, OBJ_TYPE_REF_TOKEN (node
), spc
, flags
, false);
3179 pp_right_paren (pp
);
3183 if (SSA_NAME_IDENTIFIER (node
))
3185 if ((flags
& TDF_NOUID
)
3186 && SSA_NAME_VAR (node
)
3187 && DECL_NAMELESS (SSA_NAME_VAR (node
)))
3188 dump_fancy_name (pp
, SSA_NAME_IDENTIFIER (node
));
3189 else if (! (flags
& TDF_GIMPLE
)
3190 || SSA_NAME_VAR (node
))
3191 dump_generic_node (pp
, SSA_NAME_IDENTIFIER (node
),
3195 pp_decimal_int (pp
, SSA_NAME_VERSION (node
));
3196 if (SSA_NAME_IS_DEFAULT_DEF (node
))
3197 pp_string (pp
, "(D)");
3198 if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (node
))
3199 pp_string (pp
, "(ab)");
3202 case WITH_SIZE_EXPR
:
3203 pp_string (pp
, "WITH_SIZE_EXPR <");
3204 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3205 pp_string (pp
, ", ");
3206 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3211 pp_string (pp
, "ASSERT_EXPR <");
3212 dump_generic_node (pp
, ASSERT_EXPR_VAR (node
), spc
, flags
, false);
3213 pp_string (pp
, ", ");
3214 dump_generic_node (pp
, ASSERT_EXPR_COND (node
), spc
, flags
, false);
3219 pp_string (pp
, "scev_known");
3222 case SCEV_NOT_KNOWN
:
3223 pp_string (pp
, "scev_not_known");
3226 case POLYNOMIAL_CHREC
:
3228 dump_generic_node (pp
, CHREC_LEFT (node
), spc
, flags
, false);
3229 pp_string (pp
, ", +, ");
3230 dump_generic_node (pp
, CHREC_RIGHT (node
), spc
, flags
, false);
3231 pp_printf (pp
, "}_%u", CHREC_VARIABLE (node
));
3235 case REALIGN_LOAD_EXPR
:
3236 pp_string (pp
, "REALIGN_LOAD <");
3237 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3238 pp_string (pp
, ", ");
3239 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3240 pp_string (pp
, ", ");
3241 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3246 pp_string (pp
, " VEC_COND_EXPR < ");
3247 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3248 pp_string (pp
, " , ");
3249 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3250 pp_string (pp
, " , ");
3251 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3252 pp_string (pp
, " > ");
3256 pp_string (pp
, " VEC_PERM_EXPR < ");
3257 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3258 pp_string (pp
, " , ");
3259 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3260 pp_string (pp
, " , ");
3261 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3262 pp_string (pp
, " > ");
3266 pp_string (pp
, " DOT_PROD_EXPR < ");
3267 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3268 pp_string (pp
, ", ");
3269 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3270 pp_string (pp
, ", ");
3271 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3272 pp_string (pp
, " > ");
3275 case WIDEN_MULT_PLUS_EXPR
:
3276 pp_string (pp
, " WIDEN_MULT_PLUS_EXPR < ");
3277 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3278 pp_string (pp
, ", ");
3279 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3280 pp_string (pp
, ", ");
3281 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3282 pp_string (pp
, " > ");
3285 case WIDEN_MULT_MINUS_EXPR
:
3286 pp_string (pp
, " WIDEN_MULT_MINUS_EXPR < ");
3287 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3288 pp_string (pp
, ", ");
3289 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3290 pp_string (pp
, ", ");
3291 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3292 pp_string (pp
, " > ");
3296 pp_string (pp
, "#pragma acc parallel");
3297 goto dump_omp_clauses_body
;
3300 pp_string (pp
, "#pragma acc kernels");
3301 goto dump_omp_clauses_body
;
3304 pp_string (pp
, "#pragma acc serial");
3305 goto dump_omp_clauses_body
;
3308 pp_string (pp
, "#pragma acc data");
3309 dump_omp_clauses (pp
, OACC_DATA_CLAUSES (node
), spc
, flags
);
3312 case OACC_HOST_DATA
:
3313 pp_string (pp
, "#pragma acc host_data");
3314 dump_omp_clauses (pp
, OACC_HOST_DATA_CLAUSES (node
), spc
, flags
);
3318 pp_string (pp
, "#pragma acc declare");
3319 dump_omp_clauses (pp
, OACC_DECLARE_CLAUSES (node
), spc
, flags
);
3323 pp_string (pp
, "#pragma acc update");
3324 dump_omp_clauses (pp
, OACC_UPDATE_CLAUSES (node
), spc
, flags
);
3327 case OACC_ENTER_DATA
:
3328 pp_string (pp
, "#pragma acc enter data");
3329 dump_omp_clauses (pp
, OACC_ENTER_DATA_CLAUSES (node
), spc
, flags
);
3332 case OACC_EXIT_DATA
:
3333 pp_string (pp
, "#pragma acc exit data");
3334 dump_omp_clauses (pp
, OACC_EXIT_DATA_CLAUSES (node
), spc
, flags
);
3338 pp_string (pp
, "#pragma acc cache");
3339 dump_omp_clauses (pp
, OACC_CACHE_CLAUSES (node
), spc
, flags
);
3343 pp_string (pp
, "#pragma omp parallel");
3344 dump_omp_clauses (pp
, OMP_PARALLEL_CLAUSES (node
), spc
, flags
);
3347 dump_omp_clauses_body
:
3348 dump_omp_clauses (pp
, OMP_CLAUSES (node
), spc
, flags
);
3352 if (!(flags
& TDF_SLIM
) && OMP_BODY (node
))
3354 newline_and_indent (pp
, spc
+ 2);
3356 newline_and_indent (pp
, spc
+ 4);
3357 dump_generic_node (pp
, OMP_BODY (node
), spc
+ 4, flags
, false);
3358 newline_and_indent (pp
, spc
+ 2);
3359 pp_right_brace (pp
);
3365 pp_string (pp
, OMP_TASK_BODY (node
) ? "#pragma omp task"
3366 : "#pragma omp taskwait");
3367 dump_omp_clauses (pp
, OMP_TASK_CLAUSES (node
), spc
, flags
);
3371 pp_string (pp
, "#pragma omp for");
3375 pp_string (pp
, "#pragma omp simd");
3378 case OMP_DISTRIBUTE
:
3379 pp_string (pp
, "#pragma omp distribute");
3383 pp_string (pp
, "#pragma omp taskloop");
3387 pp_string (pp
, "#pragma omp loop");
3391 pp_string (pp
, "#pragma acc loop");
3395 pp_string (pp
, "#pragma omp teams");
3396 dump_omp_clauses (pp
, OMP_TEAMS_CLAUSES (node
), spc
, flags
);
3399 case OMP_TARGET_DATA
:
3400 pp_string (pp
, "#pragma omp target data");
3401 dump_omp_clauses (pp
, OMP_TARGET_DATA_CLAUSES (node
), spc
, flags
);
3404 case OMP_TARGET_ENTER_DATA
:
3405 pp_string (pp
, "#pragma omp target enter data");
3406 dump_omp_clauses (pp
, OMP_TARGET_ENTER_DATA_CLAUSES (node
), spc
, flags
);
3410 case OMP_TARGET_EXIT_DATA
:
3411 pp_string (pp
, "#pragma omp target exit data");
3412 dump_omp_clauses (pp
, OMP_TARGET_EXIT_DATA_CLAUSES (node
), spc
, flags
);
3417 pp_string (pp
, "#pragma omp target");
3418 dump_omp_clauses (pp
, OMP_TARGET_CLAUSES (node
), spc
, flags
);
3421 case OMP_TARGET_UPDATE
:
3422 pp_string (pp
, "#pragma omp target update");
3423 dump_omp_clauses (pp
, OMP_TARGET_UPDATE_CLAUSES (node
), spc
, flags
);
3428 dump_omp_clauses (pp
, OMP_FOR_CLAUSES (node
), spc
, flags
);
3429 if (!(flags
& TDF_SLIM
))
3433 if (OMP_FOR_PRE_BODY (node
))
3435 newline_and_indent (pp
, spc
+ 2);
3438 newline_and_indent (pp
, spc
);
3439 dump_generic_node (pp
, OMP_FOR_PRE_BODY (node
),
3442 if (OMP_FOR_INIT (node
))
3445 for (i
= 0; i
< TREE_VEC_LENGTH (OMP_FOR_INIT (node
)); i
++)
3448 newline_and_indent (pp
, spc
);
3449 pp_string (pp
, "for (");
3450 tree init
= TREE_VEC_ELT (OMP_FOR_INIT (node
), i
);
3451 if (TREE_CODE (init
) != MODIFY_EXPR
3452 || TREE_CODE (TREE_OPERAND (init
, 1)) != TREE_VEC
)
3453 dump_generic_node (pp
, init
, spc
, flags
, false);
3456 dump_generic_node (pp
, TREE_OPERAND (init
, 0),
3458 pp_string (pp
, " = ");
3459 dump_omp_loop_non_rect_expr (pp
, TREE_OPERAND (init
, 1),
3462 pp_string (pp
, "; ");
3463 tree cond
= TREE_VEC_ELT (OMP_FOR_COND (node
), i
);
3464 if (!COMPARISON_CLASS_P (cond
)
3465 || TREE_CODE (TREE_OPERAND (cond
, 1)) != TREE_VEC
)
3466 dump_generic_node (pp
, cond
, spc
, flags
, false);
3469 dump_generic_node (pp
, TREE_OPERAND (cond
, 0),
3471 const char *op
= op_symbol (cond
);
3475 dump_omp_loop_non_rect_expr (pp
, TREE_OPERAND (cond
, 1),
3478 pp_string (pp
, "; ");
3479 dump_generic_node (pp
,
3480 TREE_VEC_ELT (OMP_FOR_INCR (node
), i
),
3482 pp_right_paren (pp
);
3485 if (OMP_FOR_BODY (node
))
3487 newline_and_indent (pp
, spc
+ 2);
3489 newline_and_indent (pp
, spc
+ 4);
3490 dump_generic_node (pp
, OMP_FOR_BODY (node
), spc
+ 4, flags
,
3492 newline_and_indent (pp
, spc
+ 2);
3493 pp_right_brace (pp
);
3495 if (OMP_FOR_INIT (node
))
3496 spc
-= 2 * TREE_VEC_LENGTH (OMP_FOR_INIT (node
)) - 2;
3497 if (OMP_FOR_PRE_BODY (node
))
3500 newline_and_indent (pp
, spc
+ 2);
3501 pp_right_brace (pp
);
3508 pp_string (pp
, "#pragma omp sections");
3509 dump_omp_clauses (pp
, OMP_SECTIONS_CLAUSES (node
), spc
, flags
);
3513 pp_string (pp
, "#pragma omp section");
3517 if (OMP_SCAN_CLAUSES (node
))
3519 pp_string (pp
, "#pragma omp scan");
3520 dump_omp_clauses (pp
, OMP_SCAN_CLAUSES (node
), spc
, flags
);
3525 pp_string (pp
, "#pragma omp master");
3529 pp_string (pp
, "#pragma omp taskgroup");
3530 dump_omp_clauses (pp
, OMP_TASKGROUP_CLAUSES (node
), spc
, flags
);
3534 pp_string (pp
, "#pragma omp ordered");
3535 dump_omp_clauses (pp
, OMP_ORDERED_CLAUSES (node
), spc
, flags
);
3539 pp_string (pp
, "#pragma omp critical");
3540 if (OMP_CRITICAL_NAME (node
))
3544 dump_generic_node (pp
, OMP_CRITICAL_NAME (node
), spc
,
3546 pp_right_paren (pp
);
3548 dump_omp_clauses (pp
, OMP_CRITICAL_CLAUSES (node
), spc
, flags
);
3552 pp_string (pp
, "#pragma omp atomic");
3553 dump_omp_atomic_memory_order (pp
, OMP_ATOMIC_MEMORY_ORDER (node
));
3554 newline_and_indent (pp
, spc
+ 2);
3555 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3559 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3562 case OMP_ATOMIC_READ
:
3563 pp_string (pp
, "#pragma omp atomic read");
3564 dump_omp_atomic_memory_order (pp
, OMP_ATOMIC_MEMORY_ORDER (node
));
3565 newline_and_indent (pp
, spc
+ 2);
3566 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3570 case OMP_ATOMIC_CAPTURE_OLD
:
3571 case OMP_ATOMIC_CAPTURE_NEW
:
3572 pp_string (pp
, "#pragma omp atomic capture");
3573 dump_omp_atomic_memory_order (pp
, OMP_ATOMIC_MEMORY_ORDER (node
));
3574 newline_and_indent (pp
, spc
+ 2);
3575 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3579 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3583 pp_string (pp
, "#pragma omp single");
3584 dump_omp_clauses (pp
, OMP_SINGLE_CLAUSES (node
), spc
, flags
);
3588 dump_omp_clause (pp
, node
, spc
, flags
);
3592 case TRANSACTION_EXPR
:
3593 if (TRANSACTION_EXPR_OUTER (node
))
3594 pp_string (pp
, "__transaction_atomic [[outer]]");
3595 else if (TRANSACTION_EXPR_RELAXED (node
))
3596 pp_string (pp
, "__transaction_relaxed");
3598 pp_string (pp
, "__transaction_atomic");
3599 if (!(flags
& TDF_SLIM
) && TRANSACTION_EXPR_BODY (node
))
3601 newline_and_indent (pp
, spc
);
3603 newline_and_indent (pp
, spc
+ 2);
3604 dump_generic_node (pp
, TRANSACTION_EXPR_BODY (node
),
3605 spc
+ 2, flags
, false);
3606 newline_and_indent (pp
, spc
);
3607 pp_right_brace (pp
);
3612 case VEC_SERIES_EXPR
:
3613 case VEC_WIDEN_MULT_HI_EXPR
:
3614 case VEC_WIDEN_MULT_LO_EXPR
:
3615 case VEC_WIDEN_MULT_EVEN_EXPR
:
3616 case VEC_WIDEN_MULT_ODD_EXPR
:
3617 case VEC_WIDEN_LSHIFT_HI_EXPR
:
3618 case VEC_WIDEN_LSHIFT_LO_EXPR
:
3620 for (str
= get_tree_code_name (code
); *str
; str
++)
3621 pp_character (pp
, TOUPPER (*str
));
3622 pp_string (pp
, " < ");
3623 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3624 pp_string (pp
, ", ");
3625 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3626 pp_string (pp
, " > ");
3629 case VEC_DUPLICATE_EXPR
:
3631 for (str
= get_tree_code_name (code
); *str
; str
++)
3632 pp_character (pp
, TOUPPER (*str
));
3633 pp_string (pp
, " < ");
3634 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3635 pp_string (pp
, " > ");
3638 case VEC_UNPACK_HI_EXPR
:
3639 pp_string (pp
, " VEC_UNPACK_HI_EXPR < ");
3640 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3641 pp_string (pp
, " > ");
3644 case VEC_UNPACK_LO_EXPR
:
3645 pp_string (pp
, " VEC_UNPACK_LO_EXPR < ");
3646 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3647 pp_string (pp
, " > ");
3650 case VEC_UNPACK_FLOAT_HI_EXPR
:
3651 pp_string (pp
, " VEC_UNPACK_FLOAT_HI_EXPR < ");
3652 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3653 pp_string (pp
, " > ");
3656 case VEC_UNPACK_FLOAT_LO_EXPR
:
3657 pp_string (pp
, " VEC_UNPACK_FLOAT_LO_EXPR < ");
3658 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3659 pp_string (pp
, " > ");
3662 case VEC_UNPACK_FIX_TRUNC_HI_EXPR
:
3663 pp_string (pp
, " VEC_UNPACK_FIX_TRUNC_HI_EXPR < ");
3664 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3665 pp_string (pp
, " > ");
3668 case VEC_UNPACK_FIX_TRUNC_LO_EXPR
:
3669 pp_string (pp
, " VEC_UNPACK_FIX_TRUNC_LO_EXPR < ");
3670 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3671 pp_string (pp
, " > ");
3674 case VEC_PACK_TRUNC_EXPR
:
3675 pp_string (pp
, " VEC_PACK_TRUNC_EXPR < ");
3676 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3677 pp_string (pp
, ", ");
3678 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3679 pp_string (pp
, " > ");
3682 case VEC_PACK_SAT_EXPR
:
3683 pp_string (pp
, " VEC_PACK_SAT_EXPR < ");
3684 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3685 pp_string (pp
, ", ");
3686 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3687 pp_string (pp
, " > ");
3690 case VEC_PACK_FIX_TRUNC_EXPR
:
3691 pp_string (pp
, " VEC_PACK_FIX_TRUNC_EXPR < ");
3692 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3693 pp_string (pp
, ", ");
3694 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3695 pp_string (pp
, " > ");
3698 case VEC_PACK_FLOAT_EXPR
:
3699 pp_string (pp
, " VEC_PACK_FLOAT_EXPR < ");
3700 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3701 pp_string (pp
, ", ");
3702 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3703 pp_string (pp
, " > ");
3707 dump_block_node (pp
, node
, spc
, flags
);
3710 case DEBUG_BEGIN_STMT
:
3711 pp_string (pp
, "# DEBUG BEGIN STMT");
3718 if (is_stmt
&& is_expr
)
3724 /* Print the declaration of a variable. */
3727 print_declaration (pretty_printer
*pp
, tree t
, int spc
, dump_flags_t flags
)
3731 if (TREE_CODE(t
) == NAMELIST_DECL
)
3733 pp_string(pp
, "namelist ");
3734 dump_decl_name (pp
, t
, flags
);
3739 if (TREE_CODE (t
) == TYPE_DECL
)
3740 pp_string (pp
, "typedef ");
3742 if (CODE_CONTAINS_STRUCT (TREE_CODE (t
), TS_DECL_WRTL
) && DECL_REGISTER (t
))
3743 pp_string (pp
, "register ");
3745 if (TREE_PUBLIC (t
) && DECL_EXTERNAL (t
))
3746 pp_string (pp
, "extern ");
3747 else if (TREE_STATIC (t
))
3748 pp_string (pp
, "static ");
3750 /* Print the type and name. */
3751 if (TREE_TYPE (t
) && TREE_CODE (TREE_TYPE (t
)) == ARRAY_TYPE
)
3755 /* Print array's type. */
3756 tmp
= TREE_TYPE (t
);
3757 while (TREE_CODE (TREE_TYPE (tmp
)) == ARRAY_TYPE
)
3758 tmp
= TREE_TYPE (tmp
);
3759 dump_generic_node (pp
, TREE_TYPE (tmp
), spc
, flags
, false);
3761 /* Print variable's name. */
3763 dump_generic_node (pp
, t
, spc
, flags
, false);
3765 /* Print the dimensions. */
3766 tmp
= TREE_TYPE (t
);
3767 while (TREE_CODE (tmp
) == ARRAY_TYPE
)
3769 dump_array_domain (pp
, TYPE_DOMAIN (tmp
), spc
, flags
);
3770 tmp
= TREE_TYPE (tmp
);
3773 else if (TREE_CODE (t
) == FUNCTION_DECL
)
3775 dump_generic_node (pp
, TREE_TYPE (TREE_TYPE (t
)), spc
, flags
, false);
3777 dump_decl_name (pp
, t
, flags
);
3778 dump_function_declaration (pp
, TREE_TYPE (t
), spc
, flags
);
3782 /* Print type declaration. */
3783 dump_generic_node (pp
, TREE_TYPE (t
), spc
, flags
, false);
3785 /* Print variable's name. */
3787 dump_generic_node (pp
, t
, spc
, flags
, false);
3790 if (VAR_P (t
) && DECL_HARD_REGISTER (t
))
3792 pp_string (pp
, " __asm__ ");
3794 dump_generic_node (pp
, DECL_ASSEMBLER_NAME (t
), spc
, flags
, false);
3795 pp_right_paren (pp
);
3798 /* The initial value of a function serves to determine whether the function
3799 is declared or defined. So the following does not apply to function
3801 if (TREE_CODE (t
) != FUNCTION_DECL
)
3803 /* Print the initial value. */
3804 if (DECL_INITIAL (t
))
3809 if (!(flags
& TDF_SLIM
))
3810 dump_generic_node (pp
, DECL_INITIAL (t
), spc
, flags
, false);
3812 pp_string (pp
, "<<< omitted >>>");
3816 if (VAR_P (t
) && DECL_HAS_VALUE_EXPR_P (t
))
3818 pp_string (pp
, " [value-expr: ");
3819 dump_generic_node (pp
, DECL_VALUE_EXPR (t
), spc
, flags
, false);
3820 pp_right_bracket (pp
);
3827 /* Prints a structure: name, fields, and methods.
3828 FIXME: Still incomplete. */
3831 print_struct_decl (pretty_printer
*pp
, const_tree node
, int spc
,
3834 /* Print the name of the structure. */
3835 if (TYPE_NAME (node
))
3838 if (TREE_CODE (node
) == RECORD_TYPE
)
3839 pp_string (pp
, "struct ");
3840 else if ((TREE_CODE (node
) == UNION_TYPE
3841 || TREE_CODE (node
) == QUAL_UNION_TYPE
))
3842 pp_string (pp
, "union ");
3844 dump_generic_node (pp
, TYPE_NAME (node
), spc
, TDF_NONE
, false);
3847 /* Print the contents of the structure. */
3853 /* Print the fields of the structure. */
3856 tmp
= TYPE_FIELDS (node
);
3859 /* Avoid to print recursively the structure. */
3860 /* FIXME : Not implemented correctly...,
3861 what about the case when we have a cycle in the contain graph? ...
3862 Maybe this could be solved by looking at the scope in which the
3863 structure was declared. */
3864 if (TREE_TYPE (tmp
) != node
3865 && (TREE_CODE (TREE_TYPE (tmp
)) != POINTER_TYPE
3866 || TREE_TYPE (TREE_TYPE (tmp
)) != node
))
3868 print_declaration (pp
, tmp
, spc
+2, flags
);
3871 tmp
= DECL_CHAIN (tmp
);
3875 pp_right_brace (pp
);
3878 /* Return the priority of the operator CODE.
3880 From lowest to highest precedence with either left-to-right (L-R)
3881 or right-to-left (R-L) associativity]:
3884 2 [R-L] = += -= *= /= %= &= ^= |= <<= >>=
3896 14 [R-L] ! ~ ++ -- + - * & (type) sizeof
3897 15 [L-R] fn() [] -> .
3899 unary +, - and * have higher precedence than the corresponding binary
3903 op_code_prio (enum tree_code code
)
3920 case TRUTH_ORIF_EXPR
:
3923 case TRUTH_AND_EXPR
:
3924 case TRUTH_ANDIF_EXPR
:
3931 case TRUTH_XOR_EXPR
:
3948 case UNORDERED_EXPR
:
3959 case VEC_WIDEN_LSHIFT_HI_EXPR
:
3960 case VEC_WIDEN_LSHIFT_LO_EXPR
:
3961 case WIDEN_LSHIFT_EXPR
:
3964 case WIDEN_SUM_EXPR
:
3966 case POINTER_PLUS_EXPR
:
3967 case POINTER_DIFF_EXPR
:
3971 case VEC_WIDEN_MULT_HI_EXPR
:
3972 case VEC_WIDEN_MULT_LO_EXPR
:
3973 case WIDEN_MULT_EXPR
:
3975 case WIDEN_MULT_PLUS_EXPR
:
3976 case WIDEN_MULT_MINUS_EXPR
:
3978 case MULT_HIGHPART_EXPR
:
3979 case TRUNC_DIV_EXPR
:
3981 case FLOOR_DIV_EXPR
:
3982 case ROUND_DIV_EXPR
:
3984 case EXACT_DIV_EXPR
:
3985 case TRUNC_MOD_EXPR
:
3987 case FLOOR_MOD_EXPR
:
3988 case ROUND_MOD_EXPR
:
3991 case TRUTH_NOT_EXPR
:
3993 case POSTINCREMENT_EXPR
:
3994 case POSTDECREMENT_EXPR
:
3995 case PREINCREMENT_EXPR
:
3996 case PREDECREMENT_EXPR
:
4002 case FIX_TRUNC_EXPR
:
4008 case ARRAY_RANGE_REF
:
4012 /* Special expressions. */
4018 case VEC_UNPACK_HI_EXPR
:
4019 case VEC_UNPACK_LO_EXPR
:
4020 case VEC_UNPACK_FLOAT_HI_EXPR
:
4021 case VEC_UNPACK_FLOAT_LO_EXPR
:
4022 case VEC_UNPACK_FIX_TRUNC_HI_EXPR
:
4023 case VEC_UNPACK_FIX_TRUNC_LO_EXPR
:
4024 case VEC_PACK_TRUNC_EXPR
:
4025 case VEC_PACK_SAT_EXPR
:
4029 /* Return an arbitrarily high precedence to avoid surrounding single
4030 VAR_DECLs in ()s. */
4035 /* Return the priority of the operator OP. */
4038 op_prio (const_tree op
)
4040 enum tree_code code
;
4045 code
= TREE_CODE (op
);
4046 if (code
== SAVE_EXPR
|| code
== NON_LVALUE_EXPR
)
4047 return op_prio (TREE_OPERAND (op
, 0));
4049 return op_code_prio (code
);
4052 /* Return the symbol associated with operator CODE. */
4055 op_symbol_code (enum tree_code code
)
4063 case TRUTH_ORIF_EXPR
:
4066 case TRUTH_AND_EXPR
:
4067 case TRUTH_ANDIF_EXPR
:
4073 case TRUTH_XOR_EXPR
:
4083 case UNORDERED_EXPR
:
4129 case WIDEN_LSHIFT_EXPR
:
4132 case POINTER_PLUS_EXPR
:
4138 case WIDEN_SUM_EXPR
:
4141 case WIDEN_MULT_EXPR
:
4144 case MULT_HIGHPART_EXPR
:
4149 case POINTER_DIFF_EXPR
:
4155 case TRUTH_NOT_EXPR
:
4162 case TRUNC_DIV_EXPR
:
4169 case FLOOR_DIV_EXPR
:
4172 case ROUND_DIV_EXPR
:
4175 case EXACT_DIV_EXPR
:
4178 case TRUNC_MOD_EXPR
:
4184 case FLOOR_MOD_EXPR
:
4187 case ROUND_MOD_EXPR
:
4190 case PREDECREMENT_EXPR
:
4193 case PREINCREMENT_EXPR
:
4196 case POSTDECREMENT_EXPR
:
4199 case POSTINCREMENT_EXPR
:
4209 return "<<< ??? >>>";
4213 /* Return the symbol associated with operator OP. */
4216 op_symbol (const_tree op
)
4218 return op_symbol_code (TREE_CODE (op
));
4221 /* Prints the name of a call. NODE is the CALL_EXPR_FN of a CALL_EXPR or
4222 the gimple_call_fn of a GIMPLE_CALL. */
4225 print_call_name (pretty_printer
*pp
, tree node
, dump_flags_t flags
)
4229 if (TREE_CODE (op0
) == NON_LVALUE_EXPR
)
4230 op0
= TREE_OPERAND (op0
, 0);
4233 switch (TREE_CODE (op0
))
4238 dump_function_name (pp
, op0
, flags
);
4244 op0
= TREE_OPERAND (op0
, 0);
4249 dump_generic_node (pp
, TREE_OPERAND (op0
, 0), 0, flags
, false);
4250 pp_string (pp
, ") ? ");
4251 dump_generic_node (pp
, TREE_OPERAND (op0
, 1), 0, flags
, false);
4252 pp_string (pp
, " : ");
4253 dump_generic_node (pp
, TREE_OPERAND (op0
, 2), 0, flags
, false);
4257 if (TREE_CODE (TREE_OPERAND (op0
, 0)) == VAR_DECL
)
4258 dump_function_name (pp
, TREE_OPERAND (op0
, 0), flags
);
4260 dump_generic_node (pp
, op0
, 0, flags
, false);
4264 if (integer_zerop (TREE_OPERAND (op0
, 1)))
4266 op0
= TREE_OPERAND (op0
, 0);
4273 dump_generic_node (pp
, op0
, 0, flags
, false);
4281 /* Print the first N characters in the array STR, replacing non-printable
4282 characters (including embedded nuls) with unambiguous escape sequences. */
4285 pretty_print_string (pretty_printer
*pp
, const char *str
, size_t n
)
4290 for ( ; n
; --n
, ++str
)
4295 pp_string (pp
, "\\b");
4299 pp_string (pp
, "\\f");
4303 pp_string (pp
, "\\n");
4307 pp_string (pp
, "\\r");
4311 pp_string (pp
, "\\t");
4315 pp_string (pp
, "\\v");
4319 pp_string (pp
, "\\\\");
4323 pp_string (pp
, "\\\"");
4327 pp_string (pp
, "\\'");
4331 if (str
[0] || n
> 1)
4333 if (!ISPRINT (str
[0]))
4336 sprintf (buf
, "\\x%02x", (unsigned char)str
[0]);
4337 pp_string (pp
, buf
);
4340 pp_character (pp
, str
[0]);
4348 maybe_init_pretty_print (FILE *file
)
4352 tree_pp
= new pretty_printer ();
4353 pp_needs_newline (tree_pp
) = true;
4354 pp_translate_identifiers (tree_pp
) = false;
4357 tree_pp
->buffer
->stream
= file
;
4361 newline_and_indent (pretty_printer
*pp
, int spc
)
4367 /* Handle the %K format for TEXT. Separate from default_tree_printer
4368 so it can also be used in front ends.
4369 The location LOC and BLOCK are expected to be extracted by the caller
4370 from the %K argument arg via EXPR_LOCATION(arg) and TREE_BLOCK(arg). */
4373 percent_K_format (text_info
*text
, location_t loc
, tree block
)
4375 text
->set_location (0, loc
, SHOW_RANGE_WITH_CARET
);
4376 gcc_assert (pp_ti_abstract_origin (text
) != NULL
);
4377 *pp_ti_abstract_origin (text
) = NULL
;
4380 && TREE_CODE (block
) == BLOCK
4381 && BLOCK_ABSTRACT_ORIGIN (block
))
4383 tree ao
= BLOCK_ABSTRACT_ORIGIN (block
);
4384 if (TREE_CODE (ao
) == FUNCTION_DECL
)
4386 *pp_ti_abstract_origin (text
) = block
;
4389 block
= BLOCK_SUPERCONTEXT (block
);
4393 /* Print the identifier ID to PRETTY-PRINTER. */
4396 pp_tree_identifier (pretty_printer
*pp
, tree id
)
4398 if (pp_translate_identifiers (pp
))
4400 const char *text
= identifier_to_locale (IDENTIFIER_POINTER (id
));
4401 pp_append_text (pp
, text
, text
+ strlen (text
));
4404 pp_append_text (pp
, IDENTIFIER_POINTER (id
),
4405 IDENTIFIER_POINTER (id
) + IDENTIFIER_LENGTH (id
));
4408 /* A helper function that is used to dump function information before the
4412 dump_function_header (FILE *dump_file
, tree fdecl
, dump_flags_t flags
)
4414 const char *dname
, *aname
;
4415 struct cgraph_node
*node
= cgraph_node::get (fdecl
);
4416 struct function
*fun
= DECL_STRUCT_FUNCTION (fdecl
);
4418 dname
= lang_hooks
.decl_printable_name (fdecl
, 1);
4420 if (DECL_ASSEMBLER_NAME_SET_P (fdecl
))
4421 aname
= (IDENTIFIER_POINTER
4422 (DECL_ASSEMBLER_NAME (fdecl
)));
4424 aname
= "<unset-asm-name>";
4426 fprintf (dump_file
, "\n;; Function %s (%s, funcdef_no=%d",
4427 dname
, aname
, fun
->funcdef_no
);
4428 if (!(flags
& TDF_NOUID
))
4429 fprintf (dump_file
, ", decl_uid=%d", DECL_UID (fdecl
));
4432 fprintf (dump_file
, ", cgraph_uid=%d", node
->get_uid ());
4433 fprintf (dump_file
, ", symbol_order=%d)%s\n\n", node
->order
,
4434 node
->frequency
== NODE_FREQUENCY_HOT
4436 : node
->frequency
== NODE_FREQUENCY_UNLIKELY_EXECUTED
4437 ? " (unlikely executed)"
4438 : node
->frequency
== NODE_FREQUENCY_EXECUTED_ONCE
4439 ? " (executed once)"
4443 fprintf (dump_file
, ")\n\n");
4446 /* Dump double_int D to pretty_printer PP. UNS is true
4447 if D is unsigned and false otherwise. */
4449 pp_double_int (pretty_printer
*pp
, double_int d
, bool uns
)
4452 pp_wide_integer (pp
, d
.low
);
4453 else if (d
.fits_uhwi ())
4454 pp_unsigned_wide_integer (pp
, d
.low
);
4457 unsigned HOST_WIDE_INT low
= d
.low
;
4458 HOST_WIDE_INT high
= d
.high
;
4459 if (!uns
&& d
.is_negative ())
4462 high
= ~high
+ !low
;
4465 /* Would "%x%0*x" or "%x%*0x" get zero-padding on all
4467 sprintf (pp_buffer (pp
)->digit_buffer
,
4468 HOST_WIDE_INT_PRINT_DOUBLE_HEX
,
4469 (unsigned HOST_WIDE_INT
) high
, low
);
4470 pp_string (pp
, pp_buffer (pp
)->digit_buffer
);
4475 # pragma GCC diagnostic pop