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_IF_PRESENT
:
1250 pp_string (pp
, "if_present");
1252 case OMP_CLAUSE_FINALIZE
:
1253 pp_string (pp
, "finalize");
1262 /* Dump the list of OpenMP clauses. PP, SPC and FLAGS are as in
1263 dump_generic_node. */
1266 dump_omp_clauses (pretty_printer
*pp
, tree clause
, int spc
, dump_flags_t flags
)
1274 dump_omp_clause (pp
, clause
, spc
, flags
);
1275 clause
= OMP_CLAUSE_CHAIN (clause
);
1283 /* Dump location LOC to PP. */
1286 dump_location (pretty_printer
*pp
, location_t loc
)
1288 expanded_location xloc
= expand_location (loc
);
1290 pp_left_bracket (pp
);
1293 pp_string (pp
, xloc
.file
);
1294 pp_string (pp
, ":");
1296 pp_decimal_int (pp
, xloc
.line
);
1298 pp_decimal_int (pp
, xloc
.column
);
1299 pp_string (pp
, "] ");
1303 /* Dump lexical block BLOCK. PP, SPC and FLAGS are as in
1304 dump_generic_node. */
1307 dump_block_node (pretty_printer
*pp
, tree block
, int spc
, dump_flags_t flags
)
1311 pp_printf (pp
, "BLOCK #%d ", BLOCK_NUMBER (block
));
1313 if (flags
& TDF_ADDRESS
)
1314 pp_printf (pp
, "[%p] ", (void *) block
);
1316 if (TREE_ASM_WRITTEN (block
))
1317 pp_string (pp
, "[written] ");
1319 if (flags
& TDF_SLIM
)
1322 if (BLOCK_SOURCE_LOCATION (block
))
1323 dump_location (pp
, BLOCK_SOURCE_LOCATION (block
));
1325 newline_and_indent (pp
, spc
+ 2);
1327 if (BLOCK_SUPERCONTEXT (block
))
1329 pp_string (pp
, "SUPERCONTEXT: ");
1330 dump_generic_node (pp
, BLOCK_SUPERCONTEXT (block
), 0,
1331 flags
| TDF_SLIM
, false);
1332 newline_and_indent (pp
, spc
+ 2);
1335 if (BLOCK_SUBBLOCKS (block
))
1337 pp_string (pp
, "SUBBLOCKS: ");
1338 for (t
= BLOCK_SUBBLOCKS (block
); t
; t
= BLOCK_CHAIN (t
))
1340 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
1343 newline_and_indent (pp
, spc
+ 2);
1346 if (BLOCK_CHAIN (block
))
1348 pp_string (pp
, "SIBLINGS: ");
1349 for (t
= BLOCK_CHAIN (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_VARS (block
))
1359 pp_string (pp
, "VARS: ");
1360 for (t
= BLOCK_VARS (block
); t
; t
= TREE_CHAIN (t
))
1362 dump_generic_node (pp
, t
, 0, flags
, false);
1365 newline_and_indent (pp
, spc
+ 2);
1368 if (vec_safe_length (BLOCK_NONLOCALIZED_VARS (block
)) > 0)
1371 vec
<tree
, va_gc
> *nlv
= BLOCK_NONLOCALIZED_VARS (block
);
1373 pp_string (pp
, "NONLOCALIZED_VARS: ");
1374 FOR_EACH_VEC_ELT (*nlv
, i
, t
)
1376 dump_generic_node (pp
, t
, 0, flags
, false);
1379 newline_and_indent (pp
, spc
+ 2);
1382 if (BLOCK_ABSTRACT_ORIGIN (block
))
1384 pp_string (pp
, "ABSTRACT_ORIGIN: ");
1385 dump_generic_node (pp
, BLOCK_ABSTRACT_ORIGIN (block
), 0,
1386 flags
| TDF_SLIM
, false);
1387 newline_and_indent (pp
, spc
+ 2);
1390 if (BLOCK_FRAGMENT_ORIGIN (block
))
1392 pp_string (pp
, "FRAGMENT_ORIGIN: ");
1393 dump_generic_node (pp
, BLOCK_FRAGMENT_ORIGIN (block
), 0,
1394 flags
| TDF_SLIM
, false);
1395 newline_and_indent (pp
, spc
+ 2);
1398 if (BLOCK_FRAGMENT_CHAIN (block
))
1400 pp_string (pp
, "FRAGMENT_CHAIN: ");
1401 for (t
= BLOCK_FRAGMENT_CHAIN (block
); t
; t
= BLOCK_FRAGMENT_CHAIN (t
))
1403 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
1406 newline_and_indent (pp
, spc
+ 2);
1410 /* Dump #pragma omp atomic memory order clause. */
1413 dump_omp_atomic_memory_order (pretty_printer
*pp
, enum omp_memory_order mo
)
1417 case OMP_MEMORY_ORDER_RELAXED
:
1418 pp_string (pp
, " relaxed");
1420 case OMP_MEMORY_ORDER_SEQ_CST
:
1421 pp_string (pp
, " seq_cst");
1423 case OMP_MEMORY_ORDER_ACQ_REL
:
1424 pp_string (pp
, " acq_rel");
1426 case OMP_MEMORY_ORDER_ACQUIRE
:
1427 pp_string (pp
, " acquire");
1429 case OMP_MEMORY_ORDER_RELEASE
:
1430 pp_string (pp
, " release");
1432 case OMP_MEMORY_ORDER_UNSPECIFIED
:
1439 /* Helper to dump a MEM_REF node. */
1442 dump_mem_ref (pretty_printer
*pp
, tree node
, int spc
, dump_flags_t flags
)
1444 if (TREE_CODE (node
) == MEM_REF
&& (flags
& TDF_GIMPLE
))
1446 pp_string (pp
, "__MEM <");
1447 dump_generic_node (pp
, TREE_TYPE (node
),
1448 spc
, flags
| TDF_SLIM
, false);
1449 if (TYPE_ALIGN (TREE_TYPE (node
))
1450 != TYPE_ALIGN (TYPE_MAIN_VARIANT (TREE_TYPE (node
))))
1452 pp_string (pp
, ", ");
1453 pp_decimal_int (pp
, TYPE_ALIGN (TREE_TYPE (node
)));
1456 pp_string (pp
, " (");
1457 if (TREE_TYPE (TREE_OPERAND (node
, 0))
1458 != TREE_TYPE (TREE_OPERAND (node
, 1)))
1461 dump_generic_node (pp
, TREE_TYPE (TREE_OPERAND (node
, 1)),
1462 spc
, flags
| TDF_SLIM
, false);
1463 pp_right_paren (pp
);
1465 dump_generic_node (pp
, TREE_OPERAND (node
, 0),
1466 spc
, flags
| TDF_SLIM
, false);
1467 if (! integer_zerop (TREE_OPERAND (node
, 1)))
1469 pp_string (pp
, " + ");
1470 dump_generic_node (pp
, TREE_OPERAND (node
, 1),
1471 spc
, flags
| TDF_SLIM
, false);
1473 pp_right_paren (pp
);
1475 else if (TREE_CODE (node
) == MEM_REF
1476 && integer_zerop (TREE_OPERAND (node
, 1))
1477 /* Dump the types of INTEGER_CSTs explicitly, for we can't
1478 infer them and MEM_ATTR caching will share MEM_REFs
1479 with differently-typed op0s. */
1480 && TREE_CODE (TREE_OPERAND (node
, 0)) != INTEGER_CST
1481 /* Released SSA_NAMES have no TREE_TYPE. */
1482 && TREE_TYPE (TREE_OPERAND (node
, 0)) != NULL_TREE
1483 /* Same pointer types, but ignoring POINTER_TYPE vs.
1485 && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 0)))
1486 == TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 1))))
1487 && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (node
, 0)))
1488 == TYPE_MODE (TREE_TYPE (TREE_OPERAND (node
, 1))))
1489 && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node
, 0)))
1490 == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node
, 1))))
1491 /* Same value types ignoring qualifiers. */
1492 && (TYPE_MAIN_VARIANT (TREE_TYPE (node
))
1493 == TYPE_MAIN_VARIANT
1494 (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 1)))))
1495 && (!(flags
& TDF_ALIAS
)
1496 || MR_DEPENDENCE_CLIQUE (node
) == 0))
1498 if (TREE_CODE (TREE_OPERAND (node
, 0)) != ADDR_EXPR
)
1500 /* Enclose pointers to arrays in parentheses. */
1501 tree op0
= TREE_OPERAND (node
, 0);
1502 tree op0type
= TREE_TYPE (op0
);
1503 if (POINTER_TYPE_P (op0type
)
1504 && TREE_CODE (TREE_TYPE (op0type
)) == ARRAY_TYPE
)
1507 dump_generic_node (pp
, op0
, spc
, flags
, false);
1508 if (POINTER_TYPE_P (op0type
)
1509 && TREE_CODE (TREE_TYPE (op0type
)) == ARRAY_TYPE
)
1510 pp_right_paren (pp
);
1513 dump_generic_node (pp
,
1514 TREE_OPERAND (TREE_OPERAND (node
, 0), 0),
1519 pp_string (pp
, "MEM");
1521 tree nodetype
= TREE_TYPE (node
);
1522 tree op0
= TREE_OPERAND (node
, 0);
1523 tree op1
= TREE_OPERAND (node
, 1);
1524 tree op1type
= TYPE_MAIN_VARIANT (TREE_TYPE (op1
));
1526 tree op0size
= TYPE_SIZE (nodetype
);
1527 tree op1size
= TYPE_SIZE (TREE_TYPE (op1type
));
1529 if (!op0size
|| !op1size
1530 || !operand_equal_p (op0size
, op1size
, 0))
1532 pp_string (pp
, " <");
1533 /* If the size of the type of the operand is not the same
1534 as the size of the MEM_REF expression include the type
1535 of the latter similar to the TDF_GIMPLE output to make
1536 it clear how many bytes of memory are being accessed. */
1537 dump_generic_node (pp
, nodetype
, spc
, flags
| TDF_SLIM
, false);
1538 pp_string (pp
, "> ");
1541 pp_string (pp
, "[(");
1542 dump_generic_node (pp
, op1type
, spc
, flags
| TDF_SLIM
, false);
1543 pp_right_paren (pp
);
1544 dump_generic_node (pp
, op0
, spc
, flags
, false);
1545 if (TREE_CODE (node
) == MEM_REF
1546 && !integer_zerop (op1
))
1548 pp_string (pp
, " + ");
1549 dump_generic_node (pp
, op1
, spc
, flags
, false);
1551 if (TREE_CODE (node
) == TARGET_MEM_REF
)
1553 tree tmp
= TMR_INDEX2 (node
);
1556 pp_string (pp
, " + ");
1557 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1559 tmp
= TMR_INDEX (node
);
1562 pp_string (pp
, " + ");
1563 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1564 tmp
= TMR_STEP (node
);
1565 pp_string (pp
, " * ");
1567 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1569 pp_string (pp
, "1");
1572 if ((flags
& TDF_ALIAS
)
1573 && MR_DEPENDENCE_CLIQUE (node
) != 0)
1575 pp_string (pp
, " clique ");
1576 pp_unsigned_wide_integer (pp
, MR_DEPENDENCE_CLIQUE (node
));
1577 pp_string (pp
, " base ");
1578 pp_unsigned_wide_integer (pp
, MR_DEPENDENCE_BASE (node
));
1580 pp_right_bracket (pp
);
1584 /* Helper function for dump_generic_node. Dump INIT or COND expression for
1585 OpenMP loop non-rectangular iterators. */
1588 dump_omp_loop_non_rect_expr (pretty_printer
*pp
, tree node
, int spc
,
1591 gcc_assert (TREE_CODE (node
) == TREE_VEC
);
1592 dump_generic_node (pp
, TREE_VEC_ELT (node
, 0), spc
, flags
, false);
1593 pp_string (pp
, " * ");
1594 if (op_prio (TREE_VEC_ELT (node
, 1)) <= op_code_prio (MULT_EXPR
))
1597 dump_generic_node (pp
, TREE_VEC_ELT (node
, 1), spc
, flags
, false);
1598 pp_right_paren (pp
);
1601 dump_generic_node (pp
, TREE_VEC_ELT (node
, 1), spc
, flags
, false);
1602 pp_string (pp
, " + ");
1603 if (op_prio (TREE_VEC_ELT (node
, 1)) <= op_code_prio (PLUS_EXPR
))
1606 dump_generic_node (pp
, TREE_VEC_ELT (node
, 2), spc
, flags
, false);
1607 pp_right_paren (pp
);
1610 dump_generic_node (pp
, TREE_VEC_ELT (node
, 2), spc
, flags
, false);
1613 /* Dump the node NODE on the pretty_printer PP, SPC spaces of
1614 indent. FLAGS specifies details to show in the dump (see TDF_* in
1615 dumpfile.h). If IS_STMT is true, the object printed is considered
1616 to be a statement and it is terminated by ';' if appropriate. */
1619 dump_generic_node (pretty_printer
*pp
, tree node
, int spc
, dump_flags_t flags
,
1626 enum tree_code code
;
1628 if (node
== NULL_TREE
)
1631 is_expr
= EXPR_P (node
);
1633 if (is_stmt
&& (flags
& TDF_STMTADDR
))
1634 pp_printf (pp
, "<&%p> ", (void *)node
);
1636 if ((flags
& TDF_LINENO
) && EXPR_HAS_LOCATION (node
))
1637 dump_location (pp
, EXPR_LOCATION (node
));
1639 code
= TREE_CODE (node
);
1643 pp_string (pp
, "<<< error >>>");
1646 case IDENTIFIER_NODE
:
1647 pp_tree_identifier (pp
, node
);
1651 while (node
&& node
!= error_mark_node
)
1653 if (TREE_PURPOSE (node
))
1655 dump_generic_node (pp
, TREE_PURPOSE (node
), spc
, flags
, false);
1658 dump_generic_node (pp
, TREE_VALUE (node
), spc
, flags
, false);
1659 node
= TREE_CHAIN (node
);
1660 if (node
&& TREE_CODE (node
) == TREE_LIST
)
1669 dump_generic_node (pp
, BINFO_TYPE (node
), spc
, flags
, false);
1675 if (TREE_VEC_LENGTH (node
) > 0)
1677 size_t len
= TREE_VEC_LENGTH (node
);
1678 for (i
= 0; i
< len
- 1; i
++)
1680 dump_generic_node (pp
, TREE_VEC_ELT (node
, i
), spc
, flags
,
1685 dump_generic_node (pp
, TREE_VEC_ELT (node
, len
- 1), spc
,
1694 case FIXED_POINT_TYPE
:
1700 unsigned int quals
= TYPE_QUALS (node
);
1701 enum tree_code_class tclass
;
1703 if (quals
& TYPE_QUAL_ATOMIC
)
1704 pp_string (pp
, "atomic ");
1705 if (quals
& TYPE_QUAL_CONST
)
1706 pp_string (pp
, "const ");
1707 if (quals
& TYPE_QUAL_VOLATILE
)
1708 pp_string (pp
, "volatile ");
1709 if (quals
& TYPE_QUAL_RESTRICT
)
1710 pp_string (pp
, "restrict ");
1712 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
1714 pp_string (pp
, "<address-space-");
1715 pp_decimal_int (pp
, TYPE_ADDR_SPACE (node
));
1716 pp_string (pp
, "> ");
1719 tclass
= TREE_CODE_CLASS (TREE_CODE (node
));
1721 if (tclass
== tcc_declaration
)
1723 if (DECL_NAME (node
))
1724 dump_decl_name (pp
, node
, flags
);
1726 pp_string (pp
, "<unnamed type decl>");
1728 else if (tclass
== tcc_type
)
1730 if (TYPE_NAME (node
))
1732 if (TREE_CODE (TYPE_NAME (node
)) == IDENTIFIER_NODE
)
1733 pp_tree_identifier (pp
, TYPE_NAME (node
));
1734 else if (TREE_CODE (TYPE_NAME (node
)) == TYPE_DECL
1735 && DECL_NAME (TYPE_NAME (node
)))
1736 dump_decl_name (pp
, TYPE_NAME (node
), flags
);
1738 pp_string (pp
, "<unnamed type>");
1740 else if (TREE_CODE (node
) == VECTOR_TYPE
)
1742 pp_string (pp
, "vector");
1744 pp_wide_integer (pp
, TYPE_VECTOR_SUBPARTS (node
));
1745 pp_string (pp
, ") ");
1746 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1748 else if (TREE_CODE (node
) == INTEGER_TYPE
)
1750 if (TYPE_PRECISION (node
) == CHAR_TYPE_SIZE
)
1751 pp_string (pp
, (TYPE_UNSIGNED (node
)
1754 else if (TYPE_PRECISION (node
) == SHORT_TYPE_SIZE
)
1755 pp_string (pp
, (TYPE_UNSIGNED (node
)
1758 else if (TYPE_PRECISION (node
) == INT_TYPE_SIZE
)
1759 pp_string (pp
, (TYPE_UNSIGNED (node
)
1762 else if (TYPE_PRECISION (node
) == LONG_TYPE_SIZE
)
1763 pp_string (pp
, (TYPE_UNSIGNED (node
)
1766 else if (TYPE_PRECISION (node
) == LONG_LONG_TYPE_SIZE
)
1767 pp_string (pp
, (TYPE_UNSIGNED (node
)
1768 ? "unsigned long long"
1769 : "signed long long"));
1770 else if (TYPE_PRECISION (node
) >= CHAR_TYPE_SIZE
1771 && pow2p_hwi (TYPE_PRECISION (node
)))
1773 pp_string (pp
, (TYPE_UNSIGNED (node
) ? "uint" : "int"));
1774 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1775 pp_string (pp
, "_t");
1779 pp_string (pp
, (TYPE_UNSIGNED (node
)
1780 ? "<unnamed-unsigned:"
1781 : "<unnamed-signed:"));
1782 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1786 else if (TREE_CODE (node
) == COMPLEX_TYPE
)
1788 pp_string (pp
, "__complex__ ");
1789 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1791 else if (TREE_CODE (node
) == REAL_TYPE
)
1793 pp_string (pp
, "<float:");
1794 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1797 else if (TREE_CODE (node
) == FIXED_POINT_TYPE
)
1799 pp_string (pp
, "<fixed-point-");
1800 pp_string (pp
, TYPE_SATURATING (node
) ? "sat:" : "nonsat:");
1801 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1804 else if (TREE_CODE (node
) == BOOLEAN_TYPE
)
1806 pp_string (pp
, (TYPE_UNSIGNED (node
)
1807 ? "<unsigned-boolean:"
1808 : "<signed-boolean:"));
1809 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1812 else if (TREE_CODE (node
) == VOID_TYPE
)
1813 pp_string (pp
, "void");
1815 pp_string (pp
, "<unnamed type>");
1821 case REFERENCE_TYPE
:
1822 str
= (TREE_CODE (node
) == POINTER_TYPE
? "*" : "&");
1824 if (TREE_TYPE (node
) == NULL
)
1826 pp_string (pp
, str
);
1827 pp_string (pp
, "<null type>");
1829 else if (TREE_CODE (TREE_TYPE (node
)) == FUNCTION_TYPE
)
1831 tree fnode
= TREE_TYPE (node
);
1833 dump_generic_node (pp
, TREE_TYPE (fnode
), spc
, flags
, false);
1836 pp_string (pp
, str
);
1837 if (TYPE_IDENTIFIER (node
))
1838 dump_generic_node (pp
, TYPE_NAME (node
), spc
, flags
, false);
1839 else if (flags
& TDF_NOUID
)
1840 pp_printf (pp
, "<Txxxx>");
1842 pp_printf (pp
, "<T%x>", TYPE_UID (node
));
1844 pp_right_paren (pp
);
1845 dump_function_declaration (pp
, fnode
, spc
, flags
);
1849 unsigned int quals
= TYPE_QUALS (node
);
1851 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1853 pp_string (pp
, str
);
1855 if (quals
& TYPE_QUAL_CONST
)
1856 pp_string (pp
, " const");
1857 if (quals
& TYPE_QUAL_VOLATILE
)
1858 pp_string (pp
, " volatile");
1859 if (quals
& TYPE_QUAL_RESTRICT
)
1860 pp_string (pp
, " restrict");
1862 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
1864 pp_string (pp
, " <address-space-");
1865 pp_decimal_int (pp
, TYPE_ADDR_SPACE (node
));
1869 if (TYPE_REF_CAN_ALIAS_ALL (node
))
1870 pp_string (pp
, " {ref-all}");
1879 case TARGET_MEM_REF
:
1880 dump_mem_ref (pp
, node
, spc
, flags
);
1885 unsigned int quals
= TYPE_QUALS (node
);
1888 if (quals
& TYPE_QUAL_ATOMIC
)
1889 pp_string (pp
, "atomic ");
1890 if (quals
& TYPE_QUAL_CONST
)
1891 pp_string (pp
, "const ");
1892 if (quals
& TYPE_QUAL_VOLATILE
)
1893 pp_string (pp
, "volatile ");
1895 /* Print the innermost component type. */
1896 for (tmp
= TREE_TYPE (node
); TREE_CODE (tmp
) == ARRAY_TYPE
;
1897 tmp
= TREE_TYPE (tmp
))
1899 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1901 /* Print the dimensions. */
1902 for (tmp
= node
; TREE_CODE (tmp
) == ARRAY_TYPE
; tmp
= TREE_TYPE (tmp
))
1903 dump_array_domain (pp
, TYPE_DOMAIN (tmp
), spc
, flags
);
1909 case QUAL_UNION_TYPE
:
1911 unsigned int quals
= TYPE_QUALS (node
);
1913 if (quals
& TYPE_QUAL_ATOMIC
)
1914 pp_string (pp
, "atomic ");
1915 if (quals
& TYPE_QUAL_CONST
)
1916 pp_string (pp
, "const ");
1917 if (quals
& TYPE_QUAL_VOLATILE
)
1918 pp_string (pp
, "volatile ");
1920 /* Print the name of the structure. */
1921 if (TREE_CODE (node
) == RECORD_TYPE
)
1922 pp_string (pp
, "struct ");
1923 else if (TREE_CODE (node
) == UNION_TYPE
)
1924 pp_string (pp
, "union ");
1926 if (TYPE_NAME (node
))
1927 dump_generic_node (pp
, TYPE_NAME (node
), spc
, flags
, false);
1928 else if (!(flags
& TDF_SLIM
))
1929 /* FIXME: If we eliminate the 'else' above and attempt
1930 to show the fields for named types, we may get stuck
1931 following a cycle of pointers to structs. The alleged
1932 self-reference check in print_struct_decl will not detect
1933 cycles involving more than one pointer or struct type. */
1934 print_struct_decl (pp
, node
, spc
, flags
);
1943 if (flags
& TDF_GIMPLE
1944 && (POINTER_TYPE_P (TREE_TYPE (node
))
1945 || (TYPE_PRECISION (TREE_TYPE (node
))
1946 < TYPE_PRECISION (integer_type_node
))
1947 || exact_log2 (TYPE_PRECISION (TREE_TYPE (node
))) == -1
1948 || tree_int_cst_sgn (node
) < 0))
1950 pp_string (pp
, "_Literal (");
1951 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1952 pp_string (pp
, ") ");
1954 if (TREE_CODE (TREE_TYPE (node
)) == POINTER_TYPE
1955 && ! (flags
& TDF_GIMPLE
))
1957 /* In the case of a pointer, one may want to divide by the
1958 size of the pointed-to type. Unfortunately, this not
1959 straightforward. The C front-end maps expressions
1964 in such a way that the two INTEGER_CST nodes for "5" have
1965 different values but identical types. In the latter
1966 case, the 5 is multiplied by sizeof (int) in c-common.c
1967 (pointer_int_sum) to convert it to a byte address, and
1968 yet the type of the node is left unchanged. Argh. What
1969 is consistent though is that the number value corresponds
1970 to bytes (UNITS) offset.
1972 NB: Neither of the following divisors can be trivially
1973 used to recover the original literal:
1975 TREE_INT_CST_LOW (TYPE_SIZE_UNIT (TREE_TYPE (node)))
1976 TYPE_PRECISION (TREE_TYPE (TREE_TYPE (node))) */
1977 pp_wide_integer (pp
, TREE_INT_CST_LOW (node
));
1978 pp_string (pp
, "B"); /* pseudo-unit */
1980 else if (tree_fits_shwi_p (node
))
1981 pp_wide_integer (pp
, tree_to_shwi (node
));
1982 else if (tree_fits_uhwi_p (node
))
1983 pp_unsigned_wide_integer (pp
, tree_to_uhwi (node
));
1986 wide_int val
= wi::to_wide (node
);
1988 if (wi::neg_p (val
, TYPE_SIGN (TREE_TYPE (node
))))
1993 print_hex (val
, pp_buffer (pp
)->digit_buffer
);
1994 pp_string (pp
, pp_buffer (pp
)->digit_buffer
);
1996 if ((flags
& TDF_GIMPLE
)
1997 && ! (POINTER_TYPE_P (TREE_TYPE (node
))
1998 || (TYPE_PRECISION (TREE_TYPE (node
))
1999 < TYPE_PRECISION (integer_type_node
))
2000 || exact_log2 (TYPE_PRECISION (TREE_TYPE (node
))) == -1))
2002 if (TYPE_UNSIGNED (TREE_TYPE (node
)))
2003 pp_character (pp
, 'u');
2004 if (TYPE_PRECISION (TREE_TYPE (node
))
2005 == TYPE_PRECISION (unsigned_type_node
))
2007 else if (TYPE_PRECISION (TREE_TYPE (node
))
2008 == TYPE_PRECISION (long_unsigned_type_node
))
2009 pp_character (pp
, 'l');
2010 else if (TYPE_PRECISION (TREE_TYPE (node
))
2011 == TYPE_PRECISION (long_long_unsigned_type_node
))
2012 pp_string (pp
, "ll");
2014 if (TREE_OVERFLOW (node
))
2015 pp_string (pp
, "(OVF)");
2019 pp_string (pp
, "POLY_INT_CST [");
2020 dump_generic_node (pp
, POLY_INT_CST_COEFF (node
, 0), spc
, flags
, false);
2021 for (unsigned int i
= 1; i
< NUM_POLY_INT_COEFFS
; ++i
)
2023 pp_string (pp
, ", ");
2024 dump_generic_node (pp
, POLY_INT_CST_COEFF (node
, i
),
2027 pp_string (pp
, "]");
2031 /* Code copied from print_node. */
2034 if (TREE_OVERFLOW (node
))
2035 pp_string (pp
, " overflow");
2037 d
= TREE_REAL_CST (node
);
2038 if (REAL_VALUE_ISINF (d
))
2039 pp_string (pp
, REAL_VALUE_NEGATIVE (d
) ? " -Inf" : " Inf");
2040 else if (REAL_VALUE_ISNAN (d
))
2041 pp_string (pp
, " Nan");
2045 real_to_decimal (string
, &d
, sizeof (string
), 0, 1);
2046 pp_string (pp
, string
);
2054 fixed_to_decimal (string
, TREE_FIXED_CST_PTR (node
), sizeof (string
));
2055 pp_string (pp
, string
);
2060 pp_string (pp
, "__complex__ (");
2061 dump_generic_node (pp
, TREE_REALPART (node
), spc
, flags
, false);
2062 pp_string (pp
, ", ");
2063 dump_generic_node (pp
, TREE_IMAGPART (node
), spc
, flags
, false);
2064 pp_right_paren (pp
);
2069 pp_string (pp
, "\"");
2070 if (unsigned nbytes
= TREE_STRING_LENGTH (node
))
2071 pretty_print_string (pp
, TREE_STRING_POINTER (node
), nbytes
);
2072 pp_string (pp
, "\"");
2079 if (flags
& TDF_GIMPLE
)
2081 pp_string (pp
, "_Literal (");
2082 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2083 pp_string (pp
, ") ");
2085 pp_string (pp
, "{ ");
2086 unsigned HOST_WIDE_INT nunits
;
2087 if (!VECTOR_CST_NELTS (node
).is_constant (&nunits
))
2088 nunits
= vector_cst_encoded_nelts (node
);
2089 for (i
= 0; i
< nunits
; ++i
)
2092 pp_string (pp
, ", ");
2093 dump_generic_node (pp
, VECTOR_CST_ELT (node
, i
),
2096 if (!VECTOR_CST_NELTS (node
).is_constant ())
2097 pp_string (pp
, ", ...");
2098 pp_string (pp
, " }");
2104 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2106 if (TREE_CODE (node
) == METHOD_TYPE
)
2108 if (TYPE_METHOD_BASETYPE (node
))
2109 dump_generic_node (pp
, TYPE_NAME (TYPE_METHOD_BASETYPE (node
)),
2112 pp_string (pp
, "<null method basetype>");
2113 pp_colon_colon (pp
);
2115 if (TYPE_IDENTIFIER (node
))
2116 dump_generic_node (pp
, TYPE_NAME (node
), spc
, flags
, false);
2117 else if (TYPE_NAME (node
) && DECL_NAME (TYPE_NAME (node
)))
2118 dump_decl_name (pp
, TYPE_NAME (node
), flags
);
2119 else if (flags
& TDF_NOUID
)
2120 pp_printf (pp
, "<Txxxx>");
2122 pp_printf (pp
, "<T%x>", TYPE_UID (node
));
2123 dump_function_declaration (pp
, node
, spc
, flags
);
2128 dump_decl_name (pp
, node
, flags
);
2132 if (DECL_NAME (node
))
2133 dump_decl_name (pp
, node
, flags
);
2134 else if (LABEL_DECL_UID (node
) != -1)
2136 if (flags
& TDF_GIMPLE
)
2137 pp_printf (pp
, "L%d", (int) LABEL_DECL_UID (node
));
2139 pp_printf (pp
, "<L%d>", (int) LABEL_DECL_UID (node
));
2143 if (flags
& TDF_NOUID
)
2144 pp_string (pp
, "<D.xxxx>");
2147 if (flags
& TDF_GIMPLE
)
2148 pp_printf (pp
, "<D%u>", DECL_UID (node
));
2150 pp_printf (pp
, "<D.%u>", DECL_UID (node
));
2156 if (DECL_IS_BUILTIN (node
))
2158 /* Don't print the declaration of built-in types. */
2161 if (DECL_NAME (node
))
2162 dump_decl_name (pp
, node
, flags
);
2163 else if (TYPE_NAME (TREE_TYPE (node
)) != node
)
2165 pp_string (pp
, (TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
2166 ? "union" : "struct "));
2167 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2170 pp_string (pp
, "<anon>");
2176 case DEBUG_EXPR_DECL
:
2177 case NAMESPACE_DECL
:
2179 dump_decl_name (pp
, node
, flags
);
2183 pp_string (pp
, "<retval>");
2187 op0
= TREE_OPERAND (node
, 0);
2190 && (TREE_CODE (op0
) == INDIRECT_REF
2191 || (TREE_CODE (op0
) == MEM_REF
2192 && TREE_CODE (TREE_OPERAND (op0
, 0)) != ADDR_EXPR
2193 && integer_zerop (TREE_OPERAND (op0
, 1))
2194 /* Dump the types of INTEGER_CSTs explicitly, for we
2195 can't infer them and MEM_ATTR caching will share
2196 MEM_REFs with differently-typed op0s. */
2197 && TREE_CODE (TREE_OPERAND (op0
, 0)) != INTEGER_CST
2198 /* Released SSA_NAMES have no TREE_TYPE. */
2199 && TREE_TYPE (TREE_OPERAND (op0
, 0)) != NULL_TREE
2200 /* Same pointer types, but ignoring POINTER_TYPE vs.
2202 && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 0)))
2203 == TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 1))))
2204 && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0
, 0)))
2205 == TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0
, 1))))
2206 && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0
, 0)))
2207 == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0
, 1))))
2208 /* Same value types ignoring qualifiers. */
2209 && (TYPE_MAIN_VARIANT (TREE_TYPE (op0
))
2210 == TYPE_MAIN_VARIANT
2211 (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 1)))))
2212 && MR_DEPENDENCE_CLIQUE (op0
) == 0)))
2214 op0
= TREE_OPERAND (op0
, 0);
2217 if (op_prio (op0
) < op_prio (node
))
2219 dump_generic_node (pp
, op0
, spc
, flags
, false);
2220 if (op_prio (op0
) < op_prio (node
))
2221 pp_right_paren (pp
);
2222 pp_string (pp
, str
);
2223 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2224 op0
= component_ref_field_offset (node
);
2225 if (op0
&& TREE_CODE (op0
) != INTEGER_CST
)
2227 pp_string (pp
, "{off: ");
2228 dump_generic_node (pp
, op0
, spc
, flags
, false);
2229 pp_right_brace (pp
);
2234 if (flags
& TDF_GIMPLE
)
2236 pp_string (pp
, "__BIT_FIELD_REF <");
2237 dump_generic_node (pp
, TREE_TYPE (node
),
2238 spc
, flags
| TDF_SLIM
, false);
2239 if (TYPE_ALIGN (TREE_TYPE (node
))
2240 != TYPE_ALIGN (TYPE_MAIN_VARIANT (TREE_TYPE (node
))))
2242 pp_string (pp
, ", ");
2243 pp_decimal_int (pp
, TYPE_ALIGN (TREE_TYPE (node
)));
2246 pp_string (pp
, " (");
2247 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
,
2248 flags
| TDF_SLIM
, false);
2249 pp_string (pp
, ", ");
2250 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
,
2251 flags
| TDF_SLIM
, false);
2252 pp_string (pp
, ", ");
2253 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
,
2254 flags
| TDF_SLIM
, false);
2255 pp_right_paren (pp
);
2259 pp_string (pp
, "BIT_FIELD_REF <");
2260 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2261 pp_string (pp
, ", ");
2262 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2263 pp_string (pp
, ", ");
2264 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2269 case BIT_INSERT_EXPR
:
2270 pp_string (pp
, "BIT_INSERT_EXPR <");
2271 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2272 pp_string (pp
, ", ");
2273 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2274 pp_string (pp
, ", ");
2275 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2276 pp_string (pp
, " (");
2277 if (INTEGRAL_TYPE_P (TREE_TYPE (TREE_OPERAND (node
, 1))))
2279 TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (node
, 1))));
2281 dump_generic_node (pp
, TYPE_SIZE (TREE_TYPE (TREE_OPERAND (node
, 1))),
2283 pp_string (pp
, " bits)>");
2287 case ARRAY_RANGE_REF
:
2288 op0
= TREE_OPERAND (node
, 0);
2289 if (op_prio (op0
) < op_prio (node
))
2291 dump_generic_node (pp
, op0
, spc
, flags
, false);
2292 if (op_prio (op0
) < op_prio (node
))
2293 pp_right_paren (pp
);
2294 pp_left_bracket (pp
);
2295 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2296 if (TREE_CODE (node
) == ARRAY_RANGE_REF
)
2297 pp_string (pp
, " ...");
2298 pp_right_bracket (pp
);
2300 op0
= array_ref_low_bound (node
);
2301 op1
= array_ref_element_size (node
);
2303 if (!integer_zerop (op0
)
2304 || TREE_OPERAND (node
, 2)
2305 || TREE_OPERAND (node
, 3))
2307 pp_string (pp
, "{lb: ");
2308 dump_generic_node (pp
, op0
, spc
, flags
, false);
2309 pp_string (pp
, " sz: ");
2310 dump_generic_node (pp
, op1
, spc
, flags
, false);
2311 pp_right_brace (pp
);
2317 unsigned HOST_WIDE_INT ix
;
2319 bool is_struct_init
= false;
2320 bool is_array_init
= false;
2322 if (flags
& TDF_GIMPLE
)
2324 pp_string (pp
, "_Literal (");
2325 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2326 pp_string (pp
, ") ");
2329 if (TREE_CLOBBER_P (node
))
2330 pp_string (pp
, "CLOBBER");
2331 else if (TREE_CODE (TREE_TYPE (node
)) == RECORD_TYPE
2332 || TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
)
2333 is_struct_init
= true;
2334 else if (TREE_CODE (TREE_TYPE (node
)) == ARRAY_TYPE
2335 && TYPE_DOMAIN (TREE_TYPE (node
))
2336 && TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
)))
2337 && TREE_CODE (TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
))))
2340 tree minv
= TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
)));
2341 is_array_init
= true;
2342 curidx
= wi::to_widest (minv
);
2344 FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (node
), ix
, field
, val
)
2351 dump_generic_node (pp
, field
, spc
, flags
, false);
2354 else if (is_array_init
2355 && (TREE_CODE (field
) != INTEGER_CST
2356 || curidx
!= wi::to_widest (field
)))
2358 pp_left_bracket (pp
);
2359 if (TREE_CODE (field
) == RANGE_EXPR
)
2361 dump_generic_node (pp
, TREE_OPERAND (field
, 0), spc
,
2363 pp_string (pp
, " ... ");
2364 dump_generic_node (pp
, TREE_OPERAND (field
, 1), spc
,
2366 if (TREE_CODE (TREE_OPERAND (field
, 1)) == INTEGER_CST
)
2367 curidx
= wi::to_widest (TREE_OPERAND (field
, 1));
2370 dump_generic_node (pp
, field
, spc
, flags
, false);
2371 if (TREE_CODE (field
) == INTEGER_CST
)
2372 curidx
= wi::to_widest (field
);
2373 pp_string (pp
, "]=");
2378 if (val
&& TREE_CODE (val
) == ADDR_EXPR
)
2379 if (TREE_CODE (TREE_OPERAND (val
, 0)) == FUNCTION_DECL
)
2380 val
= TREE_OPERAND (val
, 0);
2381 if (val
&& TREE_CODE (val
) == FUNCTION_DECL
)
2382 dump_decl_name (pp
, val
, flags
);
2384 dump_generic_node (pp
, val
, spc
, flags
, false);
2385 if (ix
!= CONSTRUCTOR_NELTS (node
) - 1)
2391 pp_right_brace (pp
);
2398 if (flags
& TDF_SLIM
)
2400 pp_string (pp
, "<COMPOUND_EXPR>");
2404 dump_generic_node (pp
, TREE_OPERAND (node
, 0),
2405 spc
, flags
, !(flags
& TDF_SLIM
));
2406 if (flags
& TDF_SLIM
)
2407 newline_and_indent (pp
, spc
);
2414 for (tp
= &TREE_OPERAND (node
, 1);
2415 TREE_CODE (*tp
) == COMPOUND_EXPR
;
2416 tp
= &TREE_OPERAND (*tp
, 1))
2418 dump_generic_node (pp
, TREE_OPERAND (*tp
, 0),
2419 spc
, flags
, !(flags
& TDF_SLIM
));
2420 if (flags
& TDF_SLIM
)
2421 newline_and_indent (pp
, spc
);
2429 dump_generic_node (pp
, *tp
, spc
, flags
, !(flags
& TDF_SLIM
));
2433 case STATEMENT_LIST
:
2435 tree_stmt_iterator si
;
2438 if (flags
& TDF_SLIM
)
2440 pp_string (pp
, "<STATEMENT_LIST>");
2444 for (si
= tsi_start (node
); !tsi_end_p (si
); tsi_next (&si
))
2447 newline_and_indent (pp
, spc
);
2450 dump_generic_node (pp
, tsi_stmt (si
), spc
, flags
, true);
2457 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
,
2462 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
,
2467 pp_string (pp
, "TARGET_EXPR <");
2468 dump_generic_node (pp
, TARGET_EXPR_SLOT (node
), spc
, flags
, false);
2471 dump_generic_node (pp
, TARGET_EXPR_INITIAL (node
), spc
, flags
, false);
2476 print_declaration (pp
, DECL_EXPR_DECL (node
), spc
, flags
);
2481 if (TREE_TYPE (node
) == NULL
|| TREE_TYPE (node
) == void_type_node
)
2483 pp_string (pp
, "if (");
2484 dump_generic_node (pp
, COND_EXPR_COND (node
), spc
, flags
, false);
2485 pp_right_paren (pp
);
2486 /* The lowered cond_exprs should always be printed in full. */
2487 if (COND_EXPR_THEN (node
)
2488 && (IS_EMPTY_STMT (COND_EXPR_THEN (node
))
2489 || TREE_CODE (COND_EXPR_THEN (node
)) == GOTO_EXPR
)
2490 && COND_EXPR_ELSE (node
)
2491 && (IS_EMPTY_STMT (COND_EXPR_ELSE (node
))
2492 || TREE_CODE (COND_EXPR_ELSE (node
)) == GOTO_EXPR
))
2495 dump_generic_node (pp
, COND_EXPR_THEN (node
),
2497 if (!IS_EMPTY_STMT (COND_EXPR_ELSE (node
)))
2499 pp_string (pp
, " else ");
2500 dump_generic_node (pp
, COND_EXPR_ELSE (node
),
2504 else if (!(flags
& TDF_SLIM
))
2506 /* Output COND_EXPR_THEN. */
2507 if (COND_EXPR_THEN (node
))
2509 newline_and_indent (pp
, spc
+2);
2511 newline_and_indent (pp
, spc
+4);
2512 dump_generic_node (pp
, COND_EXPR_THEN (node
), spc
+4,
2514 newline_and_indent (pp
, spc
+2);
2515 pp_right_brace (pp
);
2518 /* Output COND_EXPR_ELSE. */
2519 if (COND_EXPR_ELSE (node
)
2520 && !IS_EMPTY_STMT (COND_EXPR_ELSE (node
)))
2522 newline_and_indent (pp
, spc
);
2523 pp_string (pp
, "else");
2524 newline_and_indent (pp
, spc
+2);
2526 newline_and_indent (pp
, spc
+4);
2527 dump_generic_node (pp
, COND_EXPR_ELSE (node
), spc
+4,
2529 newline_and_indent (pp
, spc
+2);
2530 pp_right_brace (pp
);
2537 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2541 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2545 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2551 if (!(flags
& TDF_SLIM
))
2553 if (BIND_EXPR_VARS (node
))
2557 for (op0
= BIND_EXPR_VARS (node
); op0
; op0
= DECL_CHAIN (op0
))
2559 print_declaration (pp
, op0
, spc
+2, flags
);
2564 newline_and_indent (pp
, spc
+2);
2565 dump_generic_node (pp
, BIND_EXPR_BODY (node
), spc
+2, flags
, true);
2566 newline_and_indent (pp
, spc
);
2567 pp_right_brace (pp
);
2573 if (CALL_EXPR_FN (node
) != NULL_TREE
)
2574 print_call_name (pp
, CALL_EXPR_FN (node
), flags
);
2578 pp_string (pp
, internal_fn_name (CALL_EXPR_IFN (node
)));
2581 /* Print parameters. */
2586 call_expr_arg_iterator iter
;
2587 FOR_EACH_CALL_EXPR_ARG (arg
, iter
, node
)
2589 dump_generic_node (pp
, arg
, spc
, flags
, false);
2590 if (more_call_expr_args_p (&iter
))
2597 if (CALL_EXPR_VA_ARG_PACK (node
))
2599 if (call_expr_nargs (node
) > 0)
2604 pp_string (pp
, "__builtin_va_arg_pack ()");
2606 pp_right_paren (pp
);
2608 op1
= CALL_EXPR_STATIC_CHAIN (node
);
2611 pp_string (pp
, " [static-chain: ");
2612 dump_generic_node (pp
, op1
, spc
, flags
, false);
2613 pp_right_bracket (pp
);
2616 if (CALL_EXPR_RETURN_SLOT_OPT (node
))
2617 pp_string (pp
, " [return slot optimization]");
2618 if (CALL_EXPR_TAILCALL (node
))
2619 pp_string (pp
, " [tail call]");
2622 case WITH_CLEANUP_EXPR
:
2626 case CLEANUP_POINT_EXPR
:
2627 pp_string (pp
, "<<cleanup_point ");
2628 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2629 pp_string (pp
, ">>");
2632 case PLACEHOLDER_EXPR
:
2633 pp_string (pp
, "<PLACEHOLDER_EXPR ");
2634 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2638 /* Binary arithmetic and logic expressions. */
2639 case WIDEN_SUM_EXPR
:
2640 case WIDEN_MULT_EXPR
:
2642 case MULT_HIGHPART_EXPR
:
2644 case POINTER_PLUS_EXPR
:
2645 case POINTER_DIFF_EXPR
:
2647 case TRUNC_DIV_EXPR
:
2649 case FLOOR_DIV_EXPR
:
2650 case ROUND_DIV_EXPR
:
2651 case TRUNC_MOD_EXPR
:
2653 case FLOOR_MOD_EXPR
:
2654 case ROUND_MOD_EXPR
:
2656 case EXACT_DIV_EXPR
:
2661 case WIDEN_LSHIFT_EXPR
:
2665 case TRUTH_ANDIF_EXPR
:
2666 case TRUTH_ORIF_EXPR
:
2667 case TRUTH_AND_EXPR
:
2669 case TRUTH_XOR_EXPR
:
2683 case UNORDERED_EXPR
:
2685 const char *op
= op_symbol (node
);
2686 op0
= TREE_OPERAND (node
, 0);
2687 op1
= TREE_OPERAND (node
, 1);
2689 /* When the operands are expressions with less priority,
2690 keep semantics of the tree representation. */
2691 if (op_prio (op0
) <= op_prio (node
))
2694 dump_generic_node (pp
, op0
, spc
, flags
, false);
2695 pp_right_paren (pp
);
2698 dump_generic_node (pp
, op0
, spc
, flags
, false);
2704 /* When the operands are expressions with less priority,
2705 keep semantics of the tree representation. */
2706 if (op_prio (op1
) <= op_prio (node
))
2709 dump_generic_node (pp
, op1
, spc
, flags
, false);
2710 pp_right_paren (pp
);
2713 dump_generic_node (pp
, op1
, spc
, flags
, false);
2717 /* Unary arithmetic and logic expressions. */
2720 case TRUTH_NOT_EXPR
:
2722 case PREDECREMENT_EXPR
:
2723 case PREINCREMENT_EXPR
:
2725 if (TREE_CODE (node
) == ADDR_EXPR
2726 && (TREE_CODE (TREE_OPERAND (node
, 0)) == STRING_CST
2727 || TREE_CODE (TREE_OPERAND (node
, 0)) == FUNCTION_DECL
))
2728 ; /* Do not output '&' for strings and function pointers. */
2730 pp_string (pp
, op_symbol (node
));
2732 if (op_prio (TREE_OPERAND (node
, 0)) < op_prio (node
))
2735 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2736 pp_right_paren (pp
);
2739 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2742 case POSTDECREMENT_EXPR
:
2743 case POSTINCREMENT_EXPR
:
2744 if (op_prio (TREE_OPERAND (node
, 0)) < op_prio (node
))
2747 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2748 pp_right_paren (pp
);
2751 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2752 pp_string (pp
, op_symbol (node
));
2756 pp_string (pp
, "MIN_EXPR <");
2757 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2758 pp_string (pp
, ", ");
2759 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2764 pp_string (pp
, "MAX_EXPR <");
2765 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2766 pp_string (pp
, ", ");
2767 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2772 pp_string (pp
, "ABS_EXPR <");
2773 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2778 pp_string (pp
, "ABSU_EXPR <");
2779 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2787 case ADDR_SPACE_CONVERT_EXPR
:
2788 case FIXED_CONVERT_EXPR
:
2789 case FIX_TRUNC_EXPR
:
2792 type
= TREE_TYPE (node
);
2793 op0
= TREE_OPERAND (node
, 0);
2794 if (type
!= TREE_TYPE (op0
))
2797 dump_generic_node (pp
, type
, spc
, flags
, false);
2798 pp_string (pp
, ") ");
2800 if (op_prio (op0
) < op_prio (node
))
2802 dump_generic_node (pp
, op0
, spc
, flags
, false);
2803 if (op_prio (op0
) < op_prio (node
))
2804 pp_right_paren (pp
);
2807 case VIEW_CONVERT_EXPR
:
2808 if (flags
& TDF_GIMPLE
)
2809 pp_string (pp
, "__VIEW_CONVERT <");
2811 pp_string (pp
, "VIEW_CONVERT_EXPR<");
2812 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2813 pp_string (pp
, ">(");
2814 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2815 pp_right_paren (pp
);
2819 pp_string (pp
, "((");
2820 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2821 pp_string (pp
, "))");
2824 case NON_LVALUE_EXPR
:
2825 pp_string (pp
, "NON_LVALUE_EXPR <");
2826 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2831 pp_string (pp
, "SAVE_EXPR <");
2832 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2837 pp_string (pp
, "COMPLEX_EXPR <");
2838 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2839 pp_string (pp
, ", ");
2840 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2845 pp_string (pp
, "CONJ_EXPR <");
2846 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2851 if (flags
& TDF_GIMPLE
)
2853 pp_string (pp
, "__real ");
2854 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2858 pp_string (pp
, "REALPART_EXPR <");
2859 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2865 if (flags
& TDF_GIMPLE
)
2867 pp_string (pp
, "__imag ");
2868 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2872 pp_string (pp
, "IMAGPART_EXPR <");
2873 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2879 pp_string (pp
, "VA_ARG_EXPR <");
2880 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2884 case TRY_FINALLY_EXPR
:
2885 case TRY_CATCH_EXPR
:
2886 pp_string (pp
, "try");
2887 newline_and_indent (pp
, spc
+2);
2889 newline_and_indent (pp
, spc
+4);
2890 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
+4, flags
, true);
2891 newline_and_indent (pp
, spc
+2);
2892 pp_right_brace (pp
);
2893 newline_and_indent (pp
, spc
);
2894 if (TREE_CODE (node
) == TRY_CATCH_EXPR
)
2896 node
= TREE_OPERAND (node
, 1);
2897 pp_string (pp
, "catch");
2901 gcc_assert (TREE_CODE (node
) == TRY_FINALLY_EXPR
);
2902 node
= TREE_OPERAND (node
, 1);
2903 pp_string (pp
, "finally");
2904 if (TREE_CODE (node
) == EH_ELSE_EXPR
)
2906 newline_and_indent (pp
, spc
+2);
2908 newline_and_indent (pp
, spc
+4);
2909 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
+4,
2911 newline_and_indent (pp
, spc
+2);
2912 pp_right_brace (pp
);
2913 newline_and_indent (pp
, spc
);
2914 node
= TREE_OPERAND (node
, 1);
2915 pp_string (pp
, "else");
2918 newline_and_indent (pp
, spc
+2);
2920 newline_and_indent (pp
, spc
+4);
2921 dump_generic_node (pp
, node
, spc
+4, flags
, true);
2922 newline_and_indent (pp
, spc
+2);
2923 pp_right_brace (pp
);
2928 pp_string (pp
, "catch (");
2929 dump_generic_node (pp
, CATCH_TYPES (node
), spc
+2, flags
, false);
2930 pp_right_paren (pp
);
2931 newline_and_indent (pp
, spc
+2);
2933 newline_and_indent (pp
, spc
+4);
2934 dump_generic_node (pp
, CATCH_BODY (node
), spc
+4, flags
, true);
2935 newline_and_indent (pp
, spc
+2);
2936 pp_right_brace (pp
);
2940 case EH_FILTER_EXPR
:
2941 pp_string (pp
, "<<<eh_filter (");
2942 dump_generic_node (pp
, EH_FILTER_TYPES (node
), spc
+2, flags
, false);
2943 pp_string (pp
, ")>>>");
2944 newline_and_indent (pp
, spc
+2);
2946 newline_and_indent (pp
, spc
+4);
2947 dump_generic_node (pp
, EH_FILTER_FAILURE (node
), spc
+4, flags
, true);
2948 newline_and_indent (pp
, spc
+2);
2949 pp_right_brace (pp
);
2954 op0
= TREE_OPERAND (node
, 0);
2955 /* If this is for break or continue, don't bother printing it. */
2956 if (DECL_NAME (op0
))
2958 const char *name
= IDENTIFIER_POINTER (DECL_NAME (op0
));
2959 if (strcmp (name
, "break") == 0
2960 || strcmp (name
, "continue") == 0)
2963 dump_generic_node (pp
, op0
, spc
, flags
, false);
2965 if (DECL_NONLOCAL (op0
))
2966 pp_string (pp
, " [non-local]");
2970 pp_string (pp
, "while (1)");
2971 if (!(flags
& TDF_SLIM
))
2973 newline_and_indent (pp
, spc
+2);
2975 newline_and_indent (pp
, spc
+4);
2976 dump_generic_node (pp
, LOOP_EXPR_BODY (node
), spc
+4, flags
, true);
2977 newline_and_indent (pp
, spc
+2);
2978 pp_right_brace (pp
);
2984 pp_string (pp
, "// predicted ");
2985 if (PREDICT_EXPR_OUTCOME (node
))
2986 pp_string (pp
, "likely by ");
2988 pp_string (pp
, "unlikely by ");
2989 pp_string (pp
, predictor_name (PREDICT_EXPR_PREDICTOR (node
)));
2990 pp_string (pp
, " predictor.");
2994 pp_string (pp
, "ANNOTATE_EXPR <");
2995 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2996 switch ((enum annot_expr_kind
) TREE_INT_CST_LOW (TREE_OPERAND (node
, 1)))
2998 case annot_expr_ivdep_kind
:
2999 pp_string (pp
, ", ivdep");
3001 case annot_expr_unroll_kind
:
3002 pp_printf (pp
, ", unroll %d",
3003 (int) TREE_INT_CST_LOW (TREE_OPERAND (node
, 2)));
3005 case annot_expr_no_vector_kind
:
3006 pp_string (pp
, ", no-vector");
3008 case annot_expr_vector_kind
:
3009 pp_string (pp
, ", vector");
3011 case annot_expr_parallel_kind
:
3012 pp_string (pp
, ", parallel");
3021 pp_string (pp
, "return");
3022 op0
= TREE_OPERAND (node
, 0);
3026 if (TREE_CODE (op0
) == MODIFY_EXPR
)
3027 dump_generic_node (pp
, TREE_OPERAND (op0
, 1),
3030 dump_generic_node (pp
, op0
, spc
, flags
, false);
3035 pp_string (pp
, "if (");
3036 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3037 pp_string (pp
, ") break");
3041 pp_string (pp
, "switch (");
3042 dump_generic_node (pp
, SWITCH_COND (node
), spc
, flags
, false);
3043 pp_right_paren (pp
);
3044 if (!(flags
& TDF_SLIM
))
3046 newline_and_indent (pp
, spc
+2);
3048 if (SWITCH_BODY (node
))
3050 newline_and_indent (pp
, spc
+4);
3051 dump_generic_node (pp
, SWITCH_BODY (node
), spc
+4, flags
,
3054 newline_and_indent (pp
, spc
+2);
3055 pp_right_brace (pp
);
3061 op0
= GOTO_DESTINATION (node
);
3062 if (TREE_CODE (op0
) != SSA_NAME
&& DECL_P (op0
) && DECL_NAME (op0
))
3064 const char *name
= IDENTIFIER_POINTER (DECL_NAME (op0
));
3065 if (strcmp (name
, "break") == 0
3066 || strcmp (name
, "continue") == 0)
3068 pp_string (pp
, name
);
3072 pp_string (pp
, "goto ");
3073 dump_generic_node (pp
, op0
, spc
, flags
, false);
3077 pp_string (pp
, "__asm__");
3078 if (ASM_VOLATILE_P (node
))
3079 pp_string (pp
, " __volatile__");
3081 dump_generic_node (pp
, ASM_STRING (node
), spc
, flags
, false);
3083 dump_generic_node (pp
, ASM_OUTPUTS (node
), spc
, flags
, false);
3085 dump_generic_node (pp
, ASM_INPUTS (node
), spc
, flags
, false);
3086 if (ASM_CLOBBERS (node
))
3089 dump_generic_node (pp
, ASM_CLOBBERS (node
), spc
, flags
, false);
3091 pp_right_paren (pp
);
3094 case CASE_LABEL_EXPR
:
3095 if (CASE_LOW (node
) && CASE_HIGH (node
))
3097 pp_string (pp
, "case ");
3098 dump_generic_node (pp
, CASE_LOW (node
), spc
, flags
, false);
3099 pp_string (pp
, " ... ");
3100 dump_generic_node (pp
, CASE_HIGH (node
), spc
, flags
, false);
3102 else if (CASE_LOW (node
))
3104 pp_string (pp
, "case ");
3105 dump_generic_node (pp
, CASE_LOW (node
), spc
, flags
, false);
3108 pp_string (pp
, "default");
3113 pp_string (pp
, "OBJ_TYPE_REF(");
3114 dump_generic_node (pp
, OBJ_TYPE_REF_EXPR (node
), spc
, flags
, false);
3116 /* We omit the class type for -fcompare-debug because we may
3117 drop TYPE_BINFO early depending on debug info, and then
3118 virtual_method_call_p would return false, whereas when
3119 TYPE_BINFO is preserved it may still return true and then
3120 we'd print the class type. Compare tree and rtl dumps for
3121 libstdc++-prettyprinters/shared_ptr.cc with and without -g,
3122 for example, at occurrences of OBJ_TYPE_REF. */
3123 if (!(flags
& (TDF_SLIM
| TDF_COMPARE_DEBUG
))
3124 && virtual_method_call_p (node
, true))
3126 pp_string (pp
, "(");
3127 dump_generic_node (pp
, obj_type_ref_class (node
, true),
3129 pp_string (pp
, ")");
3131 dump_generic_node (pp
, OBJ_TYPE_REF_OBJECT (node
), spc
, flags
, false);
3133 dump_generic_node (pp
, OBJ_TYPE_REF_TOKEN (node
), spc
, flags
, false);
3134 pp_right_paren (pp
);
3138 if (SSA_NAME_IDENTIFIER (node
))
3140 if ((flags
& TDF_NOUID
)
3141 && SSA_NAME_VAR (node
)
3142 && DECL_NAMELESS (SSA_NAME_VAR (node
)))
3143 dump_fancy_name (pp
, SSA_NAME_IDENTIFIER (node
));
3144 else if (! (flags
& TDF_GIMPLE
)
3145 || SSA_NAME_VAR (node
))
3146 dump_generic_node (pp
, SSA_NAME_IDENTIFIER (node
),
3150 pp_decimal_int (pp
, SSA_NAME_VERSION (node
));
3151 if (SSA_NAME_IS_DEFAULT_DEF (node
))
3152 pp_string (pp
, "(D)");
3153 if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (node
))
3154 pp_string (pp
, "(ab)");
3157 case WITH_SIZE_EXPR
:
3158 pp_string (pp
, "WITH_SIZE_EXPR <");
3159 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3160 pp_string (pp
, ", ");
3161 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3166 pp_string (pp
, "ASSERT_EXPR <");
3167 dump_generic_node (pp
, ASSERT_EXPR_VAR (node
), spc
, flags
, false);
3168 pp_string (pp
, ", ");
3169 dump_generic_node (pp
, ASSERT_EXPR_COND (node
), spc
, flags
, false);
3174 pp_string (pp
, "scev_known");
3177 case SCEV_NOT_KNOWN
:
3178 pp_string (pp
, "scev_not_known");
3181 case POLYNOMIAL_CHREC
:
3183 dump_generic_node (pp
, CHREC_LEFT (node
), spc
, flags
, false);
3184 pp_string (pp
, ", +, ");
3185 dump_generic_node (pp
, CHREC_RIGHT (node
), spc
, flags
, false);
3186 pp_printf (pp
, "}_%u", CHREC_VARIABLE (node
));
3190 case REALIGN_LOAD_EXPR
:
3191 pp_string (pp
, "REALIGN_LOAD <");
3192 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3193 pp_string (pp
, ", ");
3194 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3195 pp_string (pp
, ", ");
3196 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3201 pp_string (pp
, " VEC_COND_EXPR < ");
3202 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3203 pp_string (pp
, " , ");
3204 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3205 pp_string (pp
, " , ");
3206 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3207 pp_string (pp
, " > ");
3211 pp_string (pp
, " VEC_PERM_EXPR < ");
3212 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3213 pp_string (pp
, " , ");
3214 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3215 pp_string (pp
, " , ");
3216 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3217 pp_string (pp
, " > ");
3221 pp_string (pp
, " DOT_PROD_EXPR < ");
3222 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3223 pp_string (pp
, ", ");
3224 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3225 pp_string (pp
, ", ");
3226 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3227 pp_string (pp
, " > ");
3230 case WIDEN_MULT_PLUS_EXPR
:
3231 pp_string (pp
, " WIDEN_MULT_PLUS_EXPR < ");
3232 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3233 pp_string (pp
, ", ");
3234 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3235 pp_string (pp
, ", ");
3236 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3237 pp_string (pp
, " > ");
3240 case WIDEN_MULT_MINUS_EXPR
:
3241 pp_string (pp
, " WIDEN_MULT_MINUS_EXPR < ");
3242 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3243 pp_string (pp
, ", ");
3244 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3245 pp_string (pp
, ", ");
3246 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3247 pp_string (pp
, " > ");
3251 pp_string (pp
, "#pragma acc parallel");
3252 goto dump_omp_clauses_body
;
3255 pp_string (pp
, "#pragma acc kernels");
3256 goto dump_omp_clauses_body
;
3259 pp_string (pp
, "#pragma acc serial");
3260 goto dump_omp_clauses_body
;
3263 pp_string (pp
, "#pragma acc data");
3264 dump_omp_clauses (pp
, OACC_DATA_CLAUSES (node
), spc
, flags
);
3267 case OACC_HOST_DATA
:
3268 pp_string (pp
, "#pragma acc host_data");
3269 dump_omp_clauses (pp
, OACC_HOST_DATA_CLAUSES (node
), spc
, flags
);
3273 pp_string (pp
, "#pragma acc declare");
3274 dump_omp_clauses (pp
, OACC_DECLARE_CLAUSES (node
), spc
, flags
);
3278 pp_string (pp
, "#pragma acc update");
3279 dump_omp_clauses (pp
, OACC_UPDATE_CLAUSES (node
), spc
, flags
);
3282 case OACC_ENTER_DATA
:
3283 pp_string (pp
, "#pragma acc enter data");
3284 dump_omp_clauses (pp
, OACC_ENTER_DATA_CLAUSES (node
), spc
, flags
);
3287 case OACC_EXIT_DATA
:
3288 pp_string (pp
, "#pragma acc exit data");
3289 dump_omp_clauses (pp
, OACC_EXIT_DATA_CLAUSES (node
), spc
, flags
);
3293 pp_string (pp
, "#pragma acc cache");
3294 dump_omp_clauses (pp
, OACC_CACHE_CLAUSES (node
), spc
, flags
);
3298 pp_string (pp
, "#pragma omp parallel");
3299 dump_omp_clauses (pp
, OMP_PARALLEL_CLAUSES (node
), spc
, flags
);
3302 dump_omp_clauses_body
:
3303 dump_omp_clauses (pp
, OMP_CLAUSES (node
), spc
, flags
);
3307 if (!(flags
& TDF_SLIM
) && OMP_BODY (node
))
3309 newline_and_indent (pp
, spc
+ 2);
3311 newline_and_indent (pp
, spc
+ 4);
3312 dump_generic_node (pp
, OMP_BODY (node
), spc
+ 4, flags
, false);
3313 newline_and_indent (pp
, spc
+ 2);
3314 pp_right_brace (pp
);
3320 pp_string (pp
, OMP_TASK_BODY (node
) ? "#pragma omp task"
3321 : "#pragma omp taskwait");
3322 dump_omp_clauses (pp
, OMP_TASK_CLAUSES (node
), spc
, flags
);
3326 pp_string (pp
, "#pragma omp for");
3330 pp_string (pp
, "#pragma omp simd");
3333 case OMP_DISTRIBUTE
:
3334 pp_string (pp
, "#pragma omp distribute");
3338 pp_string (pp
, "#pragma omp taskloop");
3342 pp_string (pp
, "#pragma omp loop");
3346 pp_string (pp
, "#pragma acc loop");
3350 pp_string (pp
, "#pragma omp teams");
3351 dump_omp_clauses (pp
, OMP_TEAMS_CLAUSES (node
), spc
, flags
);
3354 case OMP_TARGET_DATA
:
3355 pp_string (pp
, "#pragma omp target data");
3356 dump_omp_clauses (pp
, OMP_TARGET_DATA_CLAUSES (node
), spc
, flags
);
3359 case OMP_TARGET_ENTER_DATA
:
3360 pp_string (pp
, "#pragma omp target enter data");
3361 dump_omp_clauses (pp
, OMP_TARGET_ENTER_DATA_CLAUSES (node
), spc
, flags
);
3365 case OMP_TARGET_EXIT_DATA
:
3366 pp_string (pp
, "#pragma omp target exit data");
3367 dump_omp_clauses (pp
, OMP_TARGET_EXIT_DATA_CLAUSES (node
), spc
, flags
);
3372 pp_string (pp
, "#pragma omp target");
3373 dump_omp_clauses (pp
, OMP_TARGET_CLAUSES (node
), spc
, flags
);
3376 case OMP_TARGET_UPDATE
:
3377 pp_string (pp
, "#pragma omp target update");
3378 dump_omp_clauses (pp
, OMP_TARGET_UPDATE_CLAUSES (node
), spc
, flags
);
3383 dump_omp_clauses (pp
, OMP_FOR_CLAUSES (node
), spc
, flags
);
3384 if (!(flags
& TDF_SLIM
))
3388 if (OMP_FOR_PRE_BODY (node
))
3390 newline_and_indent (pp
, spc
+ 2);
3393 newline_and_indent (pp
, spc
);
3394 dump_generic_node (pp
, OMP_FOR_PRE_BODY (node
),
3397 if (OMP_FOR_INIT (node
))
3400 for (i
= 0; i
< TREE_VEC_LENGTH (OMP_FOR_INIT (node
)); i
++)
3403 newline_and_indent (pp
, spc
);
3404 pp_string (pp
, "for (");
3405 tree init
= TREE_VEC_ELT (OMP_FOR_INIT (node
), i
);
3406 if (TREE_CODE (init
) != MODIFY_EXPR
3407 || TREE_CODE (TREE_OPERAND (init
, 1)) != TREE_VEC
)
3408 dump_generic_node (pp
, init
, spc
, flags
, false);
3411 dump_generic_node (pp
, TREE_OPERAND (init
, 0),
3413 pp_string (pp
, " = ");
3414 dump_omp_loop_non_rect_expr (pp
, TREE_OPERAND (init
, 1),
3417 pp_string (pp
, "; ");
3418 tree cond
= TREE_VEC_ELT (OMP_FOR_COND (node
), i
);
3419 if (!COMPARISON_CLASS_P (cond
)
3420 || TREE_CODE (TREE_OPERAND (cond
, 1)) != TREE_VEC
)
3421 dump_generic_node (pp
, cond
, spc
, flags
, false);
3424 dump_generic_node (pp
, TREE_OPERAND (cond
, 0),
3426 const char *op
= op_symbol (cond
);
3430 dump_omp_loop_non_rect_expr (pp
, TREE_OPERAND (cond
, 1),
3433 pp_string (pp
, "; ");
3434 dump_generic_node (pp
,
3435 TREE_VEC_ELT (OMP_FOR_INCR (node
), i
),
3437 pp_right_paren (pp
);
3440 if (OMP_FOR_BODY (node
))
3442 newline_and_indent (pp
, spc
+ 2);
3444 newline_and_indent (pp
, spc
+ 4);
3445 dump_generic_node (pp
, OMP_FOR_BODY (node
), spc
+ 4, flags
,
3447 newline_and_indent (pp
, spc
+ 2);
3448 pp_right_brace (pp
);
3450 if (OMP_FOR_INIT (node
))
3451 spc
-= 2 * TREE_VEC_LENGTH (OMP_FOR_INIT (node
)) - 2;
3452 if (OMP_FOR_PRE_BODY (node
))
3455 newline_and_indent (pp
, spc
+ 2);
3456 pp_right_brace (pp
);
3463 pp_string (pp
, "#pragma omp sections");
3464 dump_omp_clauses (pp
, OMP_SECTIONS_CLAUSES (node
), spc
, flags
);
3468 pp_string (pp
, "#pragma omp section");
3472 if (OMP_SCAN_CLAUSES (node
))
3474 pp_string (pp
, "#pragma omp scan");
3475 dump_omp_clauses (pp
, OMP_SCAN_CLAUSES (node
), spc
, flags
);
3480 pp_string (pp
, "#pragma omp master");
3484 pp_string (pp
, "#pragma omp taskgroup");
3485 dump_omp_clauses (pp
, OMP_TASKGROUP_CLAUSES (node
), spc
, flags
);
3489 pp_string (pp
, "#pragma omp ordered");
3490 dump_omp_clauses (pp
, OMP_ORDERED_CLAUSES (node
), spc
, flags
);
3494 pp_string (pp
, "#pragma omp critical");
3495 if (OMP_CRITICAL_NAME (node
))
3499 dump_generic_node (pp
, OMP_CRITICAL_NAME (node
), spc
,
3501 pp_right_paren (pp
);
3503 dump_omp_clauses (pp
, OMP_CRITICAL_CLAUSES (node
), spc
, flags
);
3507 pp_string (pp
, "#pragma omp atomic");
3508 dump_omp_atomic_memory_order (pp
, OMP_ATOMIC_MEMORY_ORDER (node
));
3509 newline_and_indent (pp
, spc
+ 2);
3510 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3514 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3517 case OMP_ATOMIC_READ
:
3518 pp_string (pp
, "#pragma omp atomic read");
3519 dump_omp_atomic_memory_order (pp
, OMP_ATOMIC_MEMORY_ORDER (node
));
3520 newline_and_indent (pp
, spc
+ 2);
3521 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3525 case OMP_ATOMIC_CAPTURE_OLD
:
3526 case OMP_ATOMIC_CAPTURE_NEW
:
3527 pp_string (pp
, "#pragma omp atomic capture");
3528 dump_omp_atomic_memory_order (pp
, OMP_ATOMIC_MEMORY_ORDER (node
));
3529 newline_and_indent (pp
, spc
+ 2);
3530 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3534 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3538 pp_string (pp
, "#pragma omp single");
3539 dump_omp_clauses (pp
, OMP_SINGLE_CLAUSES (node
), spc
, flags
);
3543 dump_omp_clause (pp
, node
, spc
, flags
);
3547 case TRANSACTION_EXPR
:
3548 if (TRANSACTION_EXPR_OUTER (node
))
3549 pp_string (pp
, "__transaction_atomic [[outer]]");
3550 else if (TRANSACTION_EXPR_RELAXED (node
))
3551 pp_string (pp
, "__transaction_relaxed");
3553 pp_string (pp
, "__transaction_atomic");
3554 if (!(flags
& TDF_SLIM
) && TRANSACTION_EXPR_BODY (node
))
3556 newline_and_indent (pp
, spc
);
3558 newline_and_indent (pp
, spc
+ 2);
3559 dump_generic_node (pp
, TRANSACTION_EXPR_BODY (node
),
3560 spc
+ 2, flags
, false);
3561 newline_and_indent (pp
, spc
);
3562 pp_right_brace (pp
);
3567 case VEC_SERIES_EXPR
:
3568 case VEC_WIDEN_MULT_HI_EXPR
:
3569 case VEC_WIDEN_MULT_LO_EXPR
:
3570 case VEC_WIDEN_MULT_EVEN_EXPR
:
3571 case VEC_WIDEN_MULT_ODD_EXPR
:
3572 case VEC_WIDEN_LSHIFT_HI_EXPR
:
3573 case VEC_WIDEN_LSHIFT_LO_EXPR
:
3575 for (str
= get_tree_code_name (code
); *str
; str
++)
3576 pp_character (pp
, TOUPPER (*str
));
3577 pp_string (pp
, " < ");
3578 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3579 pp_string (pp
, ", ");
3580 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3581 pp_string (pp
, " > ");
3584 case VEC_DUPLICATE_EXPR
:
3586 for (str
= get_tree_code_name (code
); *str
; str
++)
3587 pp_character (pp
, TOUPPER (*str
));
3588 pp_string (pp
, " < ");
3589 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3590 pp_string (pp
, " > ");
3593 case VEC_UNPACK_HI_EXPR
:
3594 pp_string (pp
, " VEC_UNPACK_HI_EXPR < ");
3595 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3596 pp_string (pp
, " > ");
3599 case VEC_UNPACK_LO_EXPR
:
3600 pp_string (pp
, " VEC_UNPACK_LO_EXPR < ");
3601 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3602 pp_string (pp
, " > ");
3605 case VEC_UNPACK_FLOAT_HI_EXPR
:
3606 pp_string (pp
, " VEC_UNPACK_FLOAT_HI_EXPR < ");
3607 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3608 pp_string (pp
, " > ");
3611 case VEC_UNPACK_FLOAT_LO_EXPR
:
3612 pp_string (pp
, " VEC_UNPACK_FLOAT_LO_EXPR < ");
3613 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3614 pp_string (pp
, " > ");
3617 case VEC_UNPACK_FIX_TRUNC_HI_EXPR
:
3618 pp_string (pp
, " VEC_UNPACK_FIX_TRUNC_HI_EXPR < ");
3619 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3620 pp_string (pp
, " > ");
3623 case VEC_UNPACK_FIX_TRUNC_LO_EXPR
:
3624 pp_string (pp
, " VEC_UNPACK_FIX_TRUNC_LO_EXPR < ");
3625 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3626 pp_string (pp
, " > ");
3629 case VEC_PACK_TRUNC_EXPR
:
3630 pp_string (pp
, " VEC_PACK_TRUNC_EXPR < ");
3631 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3632 pp_string (pp
, ", ");
3633 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3634 pp_string (pp
, " > ");
3637 case VEC_PACK_SAT_EXPR
:
3638 pp_string (pp
, " VEC_PACK_SAT_EXPR < ");
3639 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3640 pp_string (pp
, ", ");
3641 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3642 pp_string (pp
, " > ");
3645 case VEC_PACK_FIX_TRUNC_EXPR
:
3646 pp_string (pp
, " VEC_PACK_FIX_TRUNC_EXPR < ");
3647 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3648 pp_string (pp
, ", ");
3649 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3650 pp_string (pp
, " > ");
3653 case VEC_PACK_FLOAT_EXPR
:
3654 pp_string (pp
, " VEC_PACK_FLOAT_EXPR < ");
3655 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3656 pp_string (pp
, ", ");
3657 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3658 pp_string (pp
, " > ");
3662 dump_block_node (pp
, node
, spc
, flags
);
3665 case DEBUG_BEGIN_STMT
:
3666 pp_string (pp
, "# DEBUG BEGIN STMT");
3673 if (is_stmt
&& is_expr
)
3679 /* Print the declaration of a variable. */
3682 print_declaration (pretty_printer
*pp
, tree t
, int spc
, dump_flags_t flags
)
3686 if (TREE_CODE(t
) == NAMELIST_DECL
)
3688 pp_string(pp
, "namelist ");
3689 dump_decl_name (pp
, t
, flags
);
3694 if (TREE_CODE (t
) == TYPE_DECL
)
3695 pp_string (pp
, "typedef ");
3697 if (CODE_CONTAINS_STRUCT (TREE_CODE (t
), TS_DECL_WRTL
) && DECL_REGISTER (t
))
3698 pp_string (pp
, "register ");
3700 if (TREE_PUBLIC (t
) && DECL_EXTERNAL (t
))
3701 pp_string (pp
, "extern ");
3702 else if (TREE_STATIC (t
))
3703 pp_string (pp
, "static ");
3705 /* Print the type and name. */
3706 if (TREE_TYPE (t
) && TREE_CODE (TREE_TYPE (t
)) == ARRAY_TYPE
)
3710 /* Print array's type. */
3711 tmp
= TREE_TYPE (t
);
3712 while (TREE_CODE (TREE_TYPE (tmp
)) == ARRAY_TYPE
)
3713 tmp
= TREE_TYPE (tmp
);
3714 dump_generic_node (pp
, TREE_TYPE (tmp
), spc
, flags
, false);
3716 /* Print variable's name. */
3718 dump_generic_node (pp
, t
, spc
, flags
, false);
3720 /* Print the dimensions. */
3721 tmp
= TREE_TYPE (t
);
3722 while (TREE_CODE (tmp
) == ARRAY_TYPE
)
3724 dump_array_domain (pp
, TYPE_DOMAIN (tmp
), spc
, flags
);
3725 tmp
= TREE_TYPE (tmp
);
3728 else if (TREE_CODE (t
) == FUNCTION_DECL
)
3730 dump_generic_node (pp
, TREE_TYPE (TREE_TYPE (t
)), spc
, flags
, false);
3732 dump_decl_name (pp
, t
, flags
);
3733 dump_function_declaration (pp
, TREE_TYPE (t
), spc
, flags
);
3737 /* Print type declaration. */
3738 dump_generic_node (pp
, TREE_TYPE (t
), spc
, flags
, false);
3740 /* Print variable's name. */
3742 dump_generic_node (pp
, t
, spc
, flags
, false);
3745 if (VAR_P (t
) && DECL_HARD_REGISTER (t
))
3747 pp_string (pp
, " __asm__ ");
3749 dump_generic_node (pp
, DECL_ASSEMBLER_NAME (t
), spc
, flags
, false);
3750 pp_right_paren (pp
);
3753 /* The initial value of a function serves to determine whether the function
3754 is declared or defined. So the following does not apply to function
3756 if (TREE_CODE (t
) != FUNCTION_DECL
)
3758 /* Print the initial value. */
3759 if (DECL_INITIAL (t
))
3764 if (!(flags
& TDF_SLIM
))
3765 dump_generic_node (pp
, DECL_INITIAL (t
), spc
, flags
, false);
3767 pp_string (pp
, "<<< omitted >>>");
3771 if (VAR_P (t
) && DECL_HAS_VALUE_EXPR_P (t
))
3773 pp_string (pp
, " [value-expr: ");
3774 dump_generic_node (pp
, DECL_VALUE_EXPR (t
), spc
, flags
, false);
3775 pp_right_bracket (pp
);
3782 /* Prints a structure: name, fields, and methods.
3783 FIXME: Still incomplete. */
3786 print_struct_decl (pretty_printer
*pp
, const_tree node
, int spc
,
3789 /* Print the name of the structure. */
3790 if (TYPE_NAME (node
))
3793 if (TREE_CODE (node
) == RECORD_TYPE
)
3794 pp_string (pp
, "struct ");
3795 else if ((TREE_CODE (node
) == UNION_TYPE
3796 || TREE_CODE (node
) == QUAL_UNION_TYPE
))
3797 pp_string (pp
, "union ");
3799 dump_generic_node (pp
, TYPE_NAME (node
), spc
, TDF_NONE
, false);
3802 /* Print the contents of the structure. */
3808 /* Print the fields of the structure. */
3811 tmp
= TYPE_FIELDS (node
);
3814 /* Avoid to print recursively the structure. */
3815 /* FIXME : Not implemented correctly...,
3816 what about the case when we have a cycle in the contain graph? ...
3817 Maybe this could be solved by looking at the scope in which the
3818 structure was declared. */
3819 if (TREE_TYPE (tmp
) != node
3820 && (TREE_CODE (TREE_TYPE (tmp
)) != POINTER_TYPE
3821 || TREE_TYPE (TREE_TYPE (tmp
)) != node
))
3823 print_declaration (pp
, tmp
, spc
+2, flags
);
3826 tmp
= DECL_CHAIN (tmp
);
3830 pp_right_brace (pp
);
3833 /* Return the priority of the operator CODE.
3835 From lowest to highest precedence with either left-to-right (L-R)
3836 or right-to-left (R-L) associativity]:
3839 2 [R-L] = += -= *= /= %= &= ^= |= <<= >>=
3851 14 [R-L] ! ~ ++ -- + - * & (type) sizeof
3852 15 [L-R] fn() [] -> .
3854 unary +, - and * have higher precedence than the corresponding binary
3858 op_code_prio (enum tree_code code
)
3875 case TRUTH_ORIF_EXPR
:
3878 case TRUTH_AND_EXPR
:
3879 case TRUTH_ANDIF_EXPR
:
3886 case TRUTH_XOR_EXPR
:
3903 case UNORDERED_EXPR
:
3914 case VEC_WIDEN_LSHIFT_HI_EXPR
:
3915 case VEC_WIDEN_LSHIFT_LO_EXPR
:
3916 case WIDEN_LSHIFT_EXPR
:
3919 case WIDEN_SUM_EXPR
:
3921 case POINTER_PLUS_EXPR
:
3922 case POINTER_DIFF_EXPR
:
3926 case VEC_WIDEN_MULT_HI_EXPR
:
3927 case VEC_WIDEN_MULT_LO_EXPR
:
3928 case WIDEN_MULT_EXPR
:
3930 case WIDEN_MULT_PLUS_EXPR
:
3931 case WIDEN_MULT_MINUS_EXPR
:
3933 case MULT_HIGHPART_EXPR
:
3934 case TRUNC_DIV_EXPR
:
3936 case FLOOR_DIV_EXPR
:
3937 case ROUND_DIV_EXPR
:
3939 case EXACT_DIV_EXPR
:
3940 case TRUNC_MOD_EXPR
:
3942 case FLOOR_MOD_EXPR
:
3943 case ROUND_MOD_EXPR
:
3946 case TRUTH_NOT_EXPR
:
3948 case POSTINCREMENT_EXPR
:
3949 case POSTDECREMENT_EXPR
:
3950 case PREINCREMENT_EXPR
:
3951 case PREDECREMENT_EXPR
:
3957 case FIX_TRUNC_EXPR
:
3963 case ARRAY_RANGE_REF
:
3967 /* Special expressions. */
3973 case VEC_UNPACK_HI_EXPR
:
3974 case VEC_UNPACK_LO_EXPR
:
3975 case VEC_UNPACK_FLOAT_HI_EXPR
:
3976 case VEC_UNPACK_FLOAT_LO_EXPR
:
3977 case VEC_UNPACK_FIX_TRUNC_HI_EXPR
:
3978 case VEC_UNPACK_FIX_TRUNC_LO_EXPR
:
3979 case VEC_PACK_TRUNC_EXPR
:
3980 case VEC_PACK_SAT_EXPR
:
3984 /* Return an arbitrarily high precedence to avoid surrounding single
3985 VAR_DECLs in ()s. */
3990 /* Return the priority of the operator OP. */
3993 op_prio (const_tree op
)
3995 enum tree_code code
;
4000 code
= TREE_CODE (op
);
4001 if (code
== SAVE_EXPR
|| code
== NON_LVALUE_EXPR
)
4002 return op_prio (TREE_OPERAND (op
, 0));
4004 return op_code_prio (code
);
4007 /* Return the symbol associated with operator CODE. */
4010 op_symbol_code (enum tree_code code
)
4018 case TRUTH_ORIF_EXPR
:
4021 case TRUTH_AND_EXPR
:
4022 case TRUTH_ANDIF_EXPR
:
4028 case TRUTH_XOR_EXPR
:
4038 case UNORDERED_EXPR
:
4084 case WIDEN_LSHIFT_EXPR
:
4087 case POINTER_PLUS_EXPR
:
4093 case WIDEN_SUM_EXPR
:
4096 case WIDEN_MULT_EXPR
:
4099 case MULT_HIGHPART_EXPR
:
4104 case POINTER_DIFF_EXPR
:
4110 case TRUTH_NOT_EXPR
:
4117 case TRUNC_DIV_EXPR
:
4124 case FLOOR_DIV_EXPR
:
4127 case ROUND_DIV_EXPR
:
4130 case EXACT_DIV_EXPR
:
4133 case TRUNC_MOD_EXPR
:
4139 case FLOOR_MOD_EXPR
:
4142 case ROUND_MOD_EXPR
:
4145 case PREDECREMENT_EXPR
:
4148 case PREINCREMENT_EXPR
:
4151 case POSTDECREMENT_EXPR
:
4154 case POSTINCREMENT_EXPR
:
4164 return "<<< ??? >>>";
4168 /* Return the symbol associated with operator OP. */
4171 op_symbol (const_tree op
)
4173 return op_symbol_code (TREE_CODE (op
));
4176 /* Prints the name of a call. NODE is the CALL_EXPR_FN of a CALL_EXPR or
4177 the gimple_call_fn of a GIMPLE_CALL. */
4180 print_call_name (pretty_printer
*pp
, tree node
, dump_flags_t flags
)
4184 if (TREE_CODE (op0
) == NON_LVALUE_EXPR
)
4185 op0
= TREE_OPERAND (op0
, 0);
4188 switch (TREE_CODE (op0
))
4193 dump_function_name (pp
, op0
, flags
);
4199 op0
= TREE_OPERAND (op0
, 0);
4204 dump_generic_node (pp
, TREE_OPERAND (op0
, 0), 0, flags
, false);
4205 pp_string (pp
, ") ? ");
4206 dump_generic_node (pp
, TREE_OPERAND (op0
, 1), 0, flags
, false);
4207 pp_string (pp
, " : ");
4208 dump_generic_node (pp
, TREE_OPERAND (op0
, 2), 0, flags
, false);
4212 if (TREE_CODE (TREE_OPERAND (op0
, 0)) == VAR_DECL
)
4213 dump_function_name (pp
, TREE_OPERAND (op0
, 0), flags
);
4215 dump_generic_node (pp
, op0
, 0, flags
, false);
4219 if (integer_zerop (TREE_OPERAND (op0
, 1)))
4221 op0
= TREE_OPERAND (op0
, 0);
4228 dump_generic_node (pp
, op0
, 0, flags
, false);
4236 /* Print the first N characters in the array STR, replacing non-printable
4237 characters (including embedded nuls) with unambiguous escape sequences. */
4240 pretty_print_string (pretty_printer
*pp
, const char *str
, size_t n
)
4245 for ( ; n
; --n
, ++str
)
4250 pp_string (pp
, "\\b");
4254 pp_string (pp
, "\\f");
4258 pp_string (pp
, "\\n");
4262 pp_string (pp
, "\\r");
4266 pp_string (pp
, "\\t");
4270 pp_string (pp
, "\\v");
4274 pp_string (pp
, "\\\\");
4278 pp_string (pp
, "\\\"");
4282 pp_string (pp
, "\\'");
4286 if (str
[0] || n
> 1)
4288 if (!ISPRINT (str
[0]))
4291 sprintf (buf
, "\\x%02x", (unsigned char)str
[0]);
4292 pp_string (pp
, buf
);
4295 pp_character (pp
, str
[0]);
4303 maybe_init_pretty_print (FILE *file
)
4307 tree_pp
= new pretty_printer ();
4308 pp_needs_newline (tree_pp
) = true;
4309 pp_translate_identifiers (tree_pp
) = false;
4312 tree_pp
->buffer
->stream
= file
;
4316 newline_and_indent (pretty_printer
*pp
, int spc
)
4322 /* Handle the %K format for TEXT. Separate from default_tree_printer
4323 so it can also be used in front ends.
4324 The location LOC and BLOCK are expected to be extracted by the caller
4325 from the %K argument arg via EXPR_LOCATION(arg) and TREE_BLOCK(arg). */
4328 percent_K_format (text_info
*text
, location_t loc
, tree block
)
4330 text
->set_location (0, loc
, SHOW_RANGE_WITH_CARET
);
4331 gcc_assert (pp_ti_abstract_origin (text
) != NULL
);
4332 *pp_ti_abstract_origin (text
) = NULL
;
4335 && TREE_CODE (block
) == BLOCK
4336 && BLOCK_ABSTRACT_ORIGIN (block
))
4338 tree ao
= BLOCK_ABSTRACT_ORIGIN (block
);
4339 if (TREE_CODE (ao
) == FUNCTION_DECL
)
4341 *pp_ti_abstract_origin (text
) = block
;
4344 block
= BLOCK_SUPERCONTEXT (block
);
4348 /* Print the identifier ID to PRETTY-PRINTER. */
4351 pp_tree_identifier (pretty_printer
*pp
, tree id
)
4353 if (pp_translate_identifiers (pp
))
4355 const char *text
= identifier_to_locale (IDENTIFIER_POINTER (id
));
4356 pp_append_text (pp
, text
, text
+ strlen (text
));
4359 pp_append_text (pp
, IDENTIFIER_POINTER (id
),
4360 IDENTIFIER_POINTER (id
) + IDENTIFIER_LENGTH (id
));
4363 /* A helper function that is used to dump function information before the
4367 dump_function_header (FILE *dump_file
, tree fdecl
, dump_flags_t flags
)
4369 const char *dname
, *aname
;
4370 struct cgraph_node
*node
= cgraph_node::get (fdecl
);
4371 struct function
*fun
= DECL_STRUCT_FUNCTION (fdecl
);
4373 dname
= lang_hooks
.decl_printable_name (fdecl
, 1);
4375 if (DECL_ASSEMBLER_NAME_SET_P (fdecl
))
4376 aname
= (IDENTIFIER_POINTER
4377 (DECL_ASSEMBLER_NAME (fdecl
)));
4379 aname
= "<unset-asm-name>";
4381 fprintf (dump_file
, "\n;; Function %s (%s, funcdef_no=%d",
4382 dname
, aname
, fun
->funcdef_no
);
4383 if (!(flags
& TDF_NOUID
))
4384 fprintf (dump_file
, ", decl_uid=%d", DECL_UID (fdecl
));
4387 fprintf (dump_file
, ", cgraph_uid=%d", node
->get_uid ());
4388 fprintf (dump_file
, ", symbol_order=%d)%s\n\n", node
->order
,
4389 node
->frequency
== NODE_FREQUENCY_HOT
4391 : node
->frequency
== NODE_FREQUENCY_UNLIKELY_EXECUTED
4392 ? " (unlikely executed)"
4393 : node
->frequency
== NODE_FREQUENCY_EXECUTED_ONCE
4394 ? " (executed once)"
4398 fprintf (dump_file
, ")\n\n");
4401 /* Dump double_int D to pretty_printer PP. UNS is true
4402 if D is unsigned and false otherwise. */
4404 pp_double_int (pretty_printer
*pp
, double_int d
, bool uns
)
4407 pp_wide_integer (pp
, d
.low
);
4408 else if (d
.fits_uhwi ())
4409 pp_unsigned_wide_integer (pp
, d
.low
);
4412 unsigned HOST_WIDE_INT low
= d
.low
;
4413 HOST_WIDE_INT high
= d
.high
;
4414 if (!uns
&& d
.is_negative ())
4417 high
= ~high
+ !low
;
4420 /* Would "%x%0*x" or "%x%*0x" get zero-padding on all
4422 sprintf (pp_buffer (pp
)->digit_buffer
,
4423 HOST_WIDE_INT_PRINT_DOUBLE_HEX
,
4424 (unsigned HOST_WIDE_INT
) high
, low
);
4425 pp_string (pp
, pp_buffer (pp
)->digit_buffer
);
4430 # pragma GCC diagnostic pop