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 (!integer_zerop (op1
))
1547 pp_string (pp
, " + ");
1548 dump_generic_node (pp
, op1
, spc
, flags
, false);
1550 if (TREE_CODE (node
) == TARGET_MEM_REF
)
1552 tree tmp
= TMR_INDEX2 (node
);
1555 pp_string (pp
, " + ");
1556 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1558 tmp
= TMR_INDEX (node
);
1561 pp_string (pp
, " + ");
1562 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1563 tmp
= TMR_STEP (node
);
1564 pp_string (pp
, " * ");
1566 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1568 pp_string (pp
, "1");
1571 if ((flags
& TDF_ALIAS
)
1572 && MR_DEPENDENCE_CLIQUE (node
) != 0)
1574 pp_string (pp
, " clique ");
1575 pp_unsigned_wide_integer (pp
, MR_DEPENDENCE_CLIQUE (node
));
1576 pp_string (pp
, " base ");
1577 pp_unsigned_wide_integer (pp
, MR_DEPENDENCE_BASE (node
));
1579 pp_right_bracket (pp
);
1583 /* Helper function for dump_generic_node. Dump INIT or COND expression for
1584 OpenMP loop non-rectangular iterators. */
1587 dump_omp_loop_non_rect_expr (pretty_printer
*pp
, tree node
, int spc
,
1590 gcc_assert (TREE_CODE (node
) == TREE_VEC
);
1591 dump_generic_node (pp
, TREE_VEC_ELT (node
, 0), spc
, flags
, false);
1592 pp_string (pp
, " * ");
1593 if (op_prio (TREE_VEC_ELT (node
, 1)) <= op_code_prio (MULT_EXPR
))
1596 dump_generic_node (pp
, TREE_VEC_ELT (node
, 1), spc
, flags
, false);
1597 pp_right_paren (pp
);
1600 dump_generic_node (pp
, TREE_VEC_ELT (node
, 1), spc
, flags
, false);
1601 pp_string (pp
, " + ");
1602 if (op_prio (TREE_VEC_ELT (node
, 1)) <= op_code_prio (PLUS_EXPR
))
1605 dump_generic_node (pp
, TREE_VEC_ELT (node
, 2), spc
, flags
, false);
1606 pp_right_paren (pp
);
1609 dump_generic_node (pp
, TREE_VEC_ELT (node
, 2), spc
, flags
, false);
1612 /* Dump the node NODE on the pretty_printer PP, SPC spaces of
1613 indent. FLAGS specifies details to show in the dump (see TDF_* in
1614 dumpfile.h). If IS_STMT is true, the object printed is considered
1615 to be a statement and it is terminated by ';' if appropriate. */
1618 dump_generic_node (pretty_printer
*pp
, tree node
, int spc
, dump_flags_t flags
,
1625 enum tree_code code
;
1627 if (node
== NULL_TREE
)
1630 is_expr
= EXPR_P (node
);
1632 if (is_stmt
&& (flags
& TDF_STMTADDR
))
1633 pp_printf (pp
, "<&%p> ", (void *)node
);
1635 if ((flags
& TDF_LINENO
) && EXPR_HAS_LOCATION (node
))
1636 dump_location (pp
, EXPR_LOCATION (node
));
1638 code
= TREE_CODE (node
);
1642 pp_string (pp
, "<<< error >>>");
1645 case IDENTIFIER_NODE
:
1646 pp_tree_identifier (pp
, node
);
1650 while (node
&& node
!= error_mark_node
)
1652 if (TREE_PURPOSE (node
))
1654 dump_generic_node (pp
, TREE_PURPOSE (node
), spc
, flags
, false);
1657 dump_generic_node (pp
, TREE_VALUE (node
), spc
, flags
, false);
1658 node
= TREE_CHAIN (node
);
1659 if (node
&& TREE_CODE (node
) == TREE_LIST
)
1668 dump_generic_node (pp
, BINFO_TYPE (node
), spc
, flags
, false);
1674 if (TREE_VEC_LENGTH (node
) > 0)
1676 size_t len
= TREE_VEC_LENGTH (node
);
1677 for (i
= 0; i
< len
- 1; i
++)
1679 dump_generic_node (pp
, TREE_VEC_ELT (node
, i
), spc
, flags
,
1684 dump_generic_node (pp
, TREE_VEC_ELT (node
, len
- 1), spc
,
1693 case FIXED_POINT_TYPE
:
1699 unsigned int quals
= TYPE_QUALS (node
);
1700 enum tree_code_class tclass
;
1702 if (quals
& TYPE_QUAL_ATOMIC
)
1703 pp_string (pp
, "atomic ");
1704 if (quals
& TYPE_QUAL_CONST
)
1705 pp_string (pp
, "const ");
1706 if (quals
& TYPE_QUAL_VOLATILE
)
1707 pp_string (pp
, "volatile ");
1708 if (quals
& TYPE_QUAL_RESTRICT
)
1709 pp_string (pp
, "restrict ");
1711 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
1713 pp_string (pp
, "<address-space-");
1714 pp_decimal_int (pp
, TYPE_ADDR_SPACE (node
));
1715 pp_string (pp
, "> ");
1718 tclass
= TREE_CODE_CLASS (TREE_CODE (node
));
1720 if (tclass
== tcc_declaration
)
1722 if (DECL_NAME (node
))
1723 dump_decl_name (pp
, node
, flags
);
1725 pp_string (pp
, "<unnamed type decl>");
1727 else if (tclass
== tcc_type
)
1729 if (TYPE_NAME (node
))
1731 if (TREE_CODE (TYPE_NAME (node
)) == IDENTIFIER_NODE
)
1732 pp_tree_identifier (pp
, TYPE_NAME (node
));
1733 else if (TREE_CODE (TYPE_NAME (node
)) == TYPE_DECL
1734 && DECL_NAME (TYPE_NAME (node
)))
1735 dump_decl_name (pp
, TYPE_NAME (node
), flags
);
1737 pp_string (pp
, "<unnamed type>");
1739 else if (TREE_CODE (node
) == VECTOR_TYPE
)
1741 pp_string (pp
, "vector");
1743 pp_wide_integer (pp
, TYPE_VECTOR_SUBPARTS (node
));
1744 pp_string (pp
, ") ");
1745 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1747 else if (TREE_CODE (node
) == INTEGER_TYPE
)
1749 if (TYPE_PRECISION (node
) == CHAR_TYPE_SIZE
)
1750 pp_string (pp
, (TYPE_UNSIGNED (node
)
1753 else if (TYPE_PRECISION (node
) == SHORT_TYPE_SIZE
)
1754 pp_string (pp
, (TYPE_UNSIGNED (node
)
1757 else if (TYPE_PRECISION (node
) == INT_TYPE_SIZE
)
1758 pp_string (pp
, (TYPE_UNSIGNED (node
)
1761 else if (TYPE_PRECISION (node
) == LONG_TYPE_SIZE
)
1762 pp_string (pp
, (TYPE_UNSIGNED (node
)
1765 else if (TYPE_PRECISION (node
) == LONG_LONG_TYPE_SIZE
)
1766 pp_string (pp
, (TYPE_UNSIGNED (node
)
1767 ? "unsigned long long"
1768 : "signed long long"));
1769 else if (TYPE_PRECISION (node
) >= CHAR_TYPE_SIZE
1770 && pow2p_hwi (TYPE_PRECISION (node
)))
1772 pp_string (pp
, (TYPE_UNSIGNED (node
) ? "uint" : "int"));
1773 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1774 pp_string (pp
, "_t");
1778 pp_string (pp
, (TYPE_UNSIGNED (node
)
1779 ? "<unnamed-unsigned:"
1780 : "<unnamed-signed:"));
1781 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1785 else if (TREE_CODE (node
) == COMPLEX_TYPE
)
1787 pp_string (pp
, "__complex__ ");
1788 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1790 else if (TREE_CODE (node
) == REAL_TYPE
)
1792 pp_string (pp
, "<float:");
1793 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1796 else if (TREE_CODE (node
) == FIXED_POINT_TYPE
)
1798 pp_string (pp
, "<fixed-point-");
1799 pp_string (pp
, TYPE_SATURATING (node
) ? "sat:" : "nonsat:");
1800 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1803 else if (TREE_CODE (node
) == BOOLEAN_TYPE
)
1805 pp_string (pp
, (TYPE_UNSIGNED (node
)
1806 ? "<unsigned-boolean:"
1807 : "<signed-boolean:"));
1808 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1811 else if (TREE_CODE (node
) == VOID_TYPE
)
1812 pp_string (pp
, "void");
1814 pp_string (pp
, "<unnamed type>");
1820 case REFERENCE_TYPE
:
1821 str
= (TREE_CODE (node
) == POINTER_TYPE
? "*" : "&");
1823 if (TREE_TYPE (node
) == NULL
)
1825 pp_string (pp
, str
);
1826 pp_string (pp
, "<null type>");
1828 else if (TREE_CODE (TREE_TYPE (node
)) == FUNCTION_TYPE
)
1830 tree fnode
= TREE_TYPE (node
);
1832 dump_generic_node (pp
, TREE_TYPE (fnode
), spc
, flags
, false);
1835 pp_string (pp
, str
);
1836 if (TYPE_IDENTIFIER (node
))
1837 dump_generic_node (pp
, TYPE_NAME (node
), spc
, flags
, false);
1838 else if (flags
& TDF_NOUID
)
1839 pp_printf (pp
, "<Txxxx>");
1841 pp_printf (pp
, "<T%x>", TYPE_UID (node
));
1843 pp_right_paren (pp
);
1844 dump_function_declaration (pp
, fnode
, spc
, flags
);
1848 unsigned int quals
= TYPE_QUALS (node
);
1850 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1852 pp_string (pp
, str
);
1854 if (quals
& TYPE_QUAL_CONST
)
1855 pp_string (pp
, " const");
1856 if (quals
& TYPE_QUAL_VOLATILE
)
1857 pp_string (pp
, " volatile");
1858 if (quals
& TYPE_QUAL_RESTRICT
)
1859 pp_string (pp
, " restrict");
1861 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
1863 pp_string (pp
, " <address-space-");
1864 pp_decimal_int (pp
, TYPE_ADDR_SPACE (node
));
1868 if (TYPE_REF_CAN_ALIAS_ALL (node
))
1869 pp_string (pp
, " {ref-all}");
1878 case TARGET_MEM_REF
:
1879 dump_mem_ref (pp
, node
, spc
, flags
);
1884 unsigned int quals
= TYPE_QUALS (node
);
1887 if (quals
& TYPE_QUAL_ATOMIC
)
1888 pp_string (pp
, "atomic ");
1889 if (quals
& TYPE_QUAL_CONST
)
1890 pp_string (pp
, "const ");
1891 if (quals
& TYPE_QUAL_VOLATILE
)
1892 pp_string (pp
, "volatile ");
1894 /* Print the innermost component type. */
1895 for (tmp
= TREE_TYPE (node
); TREE_CODE (tmp
) == ARRAY_TYPE
;
1896 tmp
= TREE_TYPE (tmp
))
1898 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1900 /* Print the dimensions. */
1901 for (tmp
= node
; TREE_CODE (tmp
) == ARRAY_TYPE
; tmp
= TREE_TYPE (tmp
))
1902 dump_array_domain (pp
, TYPE_DOMAIN (tmp
), spc
, flags
);
1908 case QUAL_UNION_TYPE
:
1910 unsigned int quals
= TYPE_QUALS (node
);
1912 if (quals
& TYPE_QUAL_ATOMIC
)
1913 pp_string (pp
, "atomic ");
1914 if (quals
& TYPE_QUAL_CONST
)
1915 pp_string (pp
, "const ");
1916 if (quals
& TYPE_QUAL_VOLATILE
)
1917 pp_string (pp
, "volatile ");
1919 /* Print the name of the structure. */
1920 if (TREE_CODE (node
) == RECORD_TYPE
)
1921 pp_string (pp
, "struct ");
1922 else if (TREE_CODE (node
) == UNION_TYPE
)
1923 pp_string (pp
, "union ");
1925 if (TYPE_NAME (node
))
1926 dump_generic_node (pp
, TYPE_NAME (node
), spc
, flags
, false);
1927 else if (!(flags
& TDF_SLIM
))
1928 /* FIXME: If we eliminate the 'else' above and attempt
1929 to show the fields for named types, we may get stuck
1930 following a cycle of pointers to structs. The alleged
1931 self-reference check in print_struct_decl will not detect
1932 cycles involving more than one pointer or struct type. */
1933 print_struct_decl (pp
, node
, spc
, flags
);
1942 if (flags
& TDF_GIMPLE
1943 && (POINTER_TYPE_P (TREE_TYPE (node
))
1944 || (TYPE_PRECISION (TREE_TYPE (node
))
1945 < TYPE_PRECISION (integer_type_node
))
1946 || exact_log2 (TYPE_PRECISION (TREE_TYPE (node
))) == -1
1947 || tree_int_cst_sgn (node
) < 0))
1949 pp_string (pp
, "_Literal (");
1950 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1951 pp_string (pp
, ") ");
1953 if (TREE_CODE (TREE_TYPE (node
)) == POINTER_TYPE
1954 && ! (flags
& TDF_GIMPLE
))
1956 /* In the case of a pointer, one may want to divide by the
1957 size of the pointed-to type. Unfortunately, this not
1958 straightforward. The C front-end maps expressions
1963 in such a way that the two INTEGER_CST nodes for "5" have
1964 different values but identical types. In the latter
1965 case, the 5 is multiplied by sizeof (int) in c-common.c
1966 (pointer_int_sum) to convert it to a byte address, and
1967 yet the type of the node is left unchanged. Argh. What
1968 is consistent though is that the number value corresponds
1969 to bytes (UNITS) offset.
1971 NB: Neither of the following divisors can be trivially
1972 used to recover the original literal:
1974 TREE_INT_CST_LOW (TYPE_SIZE_UNIT (TREE_TYPE (node)))
1975 TYPE_PRECISION (TREE_TYPE (TREE_TYPE (node))) */
1976 pp_wide_integer (pp
, TREE_INT_CST_LOW (node
));
1977 pp_string (pp
, "B"); /* pseudo-unit */
1979 else if (tree_fits_shwi_p (node
))
1980 pp_wide_integer (pp
, tree_to_shwi (node
));
1981 else if (tree_fits_uhwi_p (node
))
1982 pp_unsigned_wide_integer (pp
, tree_to_uhwi (node
));
1985 wide_int val
= wi::to_wide (node
);
1987 if (wi::neg_p (val
, TYPE_SIGN (TREE_TYPE (node
))))
1992 print_hex (val
, pp_buffer (pp
)->digit_buffer
);
1993 pp_string (pp
, pp_buffer (pp
)->digit_buffer
);
1995 if ((flags
& TDF_GIMPLE
)
1996 && ! (POINTER_TYPE_P (TREE_TYPE (node
))
1997 || (TYPE_PRECISION (TREE_TYPE (node
))
1998 < TYPE_PRECISION (integer_type_node
))
1999 || exact_log2 (TYPE_PRECISION (TREE_TYPE (node
))) == -1))
2001 if (TYPE_UNSIGNED (TREE_TYPE (node
)))
2002 pp_character (pp
, 'u');
2003 if (TYPE_PRECISION (TREE_TYPE (node
))
2004 == TYPE_PRECISION (unsigned_type_node
))
2006 else if (TYPE_PRECISION (TREE_TYPE (node
))
2007 == TYPE_PRECISION (long_unsigned_type_node
))
2008 pp_character (pp
, 'l');
2009 else if (TYPE_PRECISION (TREE_TYPE (node
))
2010 == TYPE_PRECISION (long_long_unsigned_type_node
))
2011 pp_string (pp
, "ll");
2013 if (TREE_OVERFLOW (node
))
2014 pp_string (pp
, "(OVF)");
2018 pp_string (pp
, "POLY_INT_CST [");
2019 dump_generic_node (pp
, POLY_INT_CST_COEFF (node
, 0), spc
, flags
, false);
2020 for (unsigned int i
= 1; i
< NUM_POLY_INT_COEFFS
; ++i
)
2022 pp_string (pp
, ", ");
2023 dump_generic_node (pp
, POLY_INT_CST_COEFF (node
, i
),
2026 pp_string (pp
, "]");
2030 /* Code copied from print_node. */
2033 if (TREE_OVERFLOW (node
))
2034 pp_string (pp
, " overflow");
2036 d
= TREE_REAL_CST (node
);
2037 if (REAL_VALUE_ISINF (d
))
2038 pp_string (pp
, REAL_VALUE_NEGATIVE (d
) ? " -Inf" : " Inf");
2039 else if (REAL_VALUE_ISNAN (d
))
2040 pp_string (pp
, " Nan");
2044 real_to_decimal (string
, &d
, sizeof (string
), 0, 1);
2045 pp_string (pp
, string
);
2053 fixed_to_decimal (string
, TREE_FIXED_CST_PTR (node
), sizeof (string
));
2054 pp_string (pp
, string
);
2059 pp_string (pp
, "__complex__ (");
2060 dump_generic_node (pp
, TREE_REALPART (node
), spc
, flags
, false);
2061 pp_string (pp
, ", ");
2062 dump_generic_node (pp
, TREE_IMAGPART (node
), spc
, flags
, false);
2063 pp_right_paren (pp
);
2068 pp_string (pp
, "\"");
2069 if (unsigned nbytes
= TREE_STRING_LENGTH (node
))
2070 pretty_print_string (pp
, TREE_STRING_POINTER (node
), nbytes
);
2071 pp_string (pp
, "\"");
2078 if (flags
& TDF_GIMPLE
)
2080 pp_string (pp
, "_Literal (");
2081 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2082 pp_string (pp
, ") ");
2084 pp_string (pp
, "{ ");
2085 unsigned HOST_WIDE_INT nunits
;
2086 if (!VECTOR_CST_NELTS (node
).is_constant (&nunits
))
2087 nunits
= vector_cst_encoded_nelts (node
);
2088 for (i
= 0; i
< nunits
; ++i
)
2091 pp_string (pp
, ", ");
2092 dump_generic_node (pp
, VECTOR_CST_ELT (node
, i
),
2095 if (!VECTOR_CST_NELTS (node
).is_constant ())
2096 pp_string (pp
, ", ...");
2097 pp_string (pp
, " }");
2103 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2105 if (TREE_CODE (node
) == METHOD_TYPE
)
2107 if (TYPE_METHOD_BASETYPE (node
))
2108 dump_generic_node (pp
, TYPE_NAME (TYPE_METHOD_BASETYPE (node
)),
2111 pp_string (pp
, "<null method basetype>");
2112 pp_colon_colon (pp
);
2114 if (TYPE_IDENTIFIER (node
))
2115 dump_generic_node (pp
, TYPE_NAME (node
), spc
, flags
, false);
2116 else if (TYPE_NAME (node
) && DECL_NAME (TYPE_NAME (node
)))
2117 dump_decl_name (pp
, TYPE_NAME (node
), flags
);
2118 else if (flags
& TDF_NOUID
)
2119 pp_printf (pp
, "<Txxxx>");
2121 pp_printf (pp
, "<T%x>", TYPE_UID (node
));
2122 dump_function_declaration (pp
, node
, spc
, flags
);
2127 dump_decl_name (pp
, node
, flags
);
2131 if (DECL_NAME (node
))
2132 dump_decl_name (pp
, node
, flags
);
2133 else if (LABEL_DECL_UID (node
) != -1)
2135 if (flags
& TDF_GIMPLE
)
2136 pp_printf (pp
, "L%d", (int) LABEL_DECL_UID (node
));
2138 pp_printf (pp
, "<L%d>", (int) LABEL_DECL_UID (node
));
2142 if (flags
& TDF_NOUID
)
2143 pp_string (pp
, "<D.xxxx>");
2146 if (flags
& TDF_GIMPLE
)
2147 pp_printf (pp
, "<D%u>", DECL_UID (node
));
2149 pp_printf (pp
, "<D.%u>", DECL_UID (node
));
2155 if (DECL_IS_BUILTIN (node
))
2157 /* Don't print the declaration of built-in types. */
2160 if (DECL_NAME (node
))
2161 dump_decl_name (pp
, node
, flags
);
2162 else if (TYPE_NAME (TREE_TYPE (node
)) != node
)
2164 pp_string (pp
, (TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
2165 ? "union" : "struct "));
2166 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2169 pp_string (pp
, "<anon>");
2175 case DEBUG_EXPR_DECL
:
2176 case NAMESPACE_DECL
:
2178 dump_decl_name (pp
, node
, flags
);
2182 pp_string (pp
, "<retval>");
2186 op0
= TREE_OPERAND (node
, 0);
2189 && (TREE_CODE (op0
) == INDIRECT_REF
2190 || (TREE_CODE (op0
) == MEM_REF
2191 && TREE_CODE (TREE_OPERAND (op0
, 0)) != ADDR_EXPR
2192 && integer_zerop (TREE_OPERAND (op0
, 1))
2193 /* Dump the types of INTEGER_CSTs explicitly, for we
2194 can't infer them and MEM_ATTR caching will share
2195 MEM_REFs with differently-typed op0s. */
2196 && TREE_CODE (TREE_OPERAND (op0
, 0)) != INTEGER_CST
2197 /* Released SSA_NAMES have no TREE_TYPE. */
2198 && TREE_TYPE (TREE_OPERAND (op0
, 0)) != NULL_TREE
2199 /* Same pointer types, but ignoring POINTER_TYPE vs.
2201 && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 0)))
2202 == TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 1))))
2203 && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0
, 0)))
2204 == TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0
, 1))))
2205 && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0
, 0)))
2206 == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0
, 1))))
2207 /* Same value types ignoring qualifiers. */
2208 && (TYPE_MAIN_VARIANT (TREE_TYPE (op0
))
2209 == TYPE_MAIN_VARIANT
2210 (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 1)))))
2211 && MR_DEPENDENCE_CLIQUE (op0
) == 0)))
2213 op0
= TREE_OPERAND (op0
, 0);
2216 if (op_prio (op0
) < op_prio (node
))
2218 dump_generic_node (pp
, op0
, spc
, flags
, false);
2219 if (op_prio (op0
) < op_prio (node
))
2220 pp_right_paren (pp
);
2221 pp_string (pp
, str
);
2222 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2223 op0
= component_ref_field_offset (node
);
2224 if (op0
&& TREE_CODE (op0
) != INTEGER_CST
)
2226 pp_string (pp
, "{off: ");
2227 dump_generic_node (pp
, op0
, spc
, flags
, false);
2228 pp_right_brace (pp
);
2233 if (flags
& TDF_GIMPLE
)
2235 pp_string (pp
, "__BIT_FIELD_REF <");
2236 dump_generic_node (pp
, TREE_TYPE (node
),
2237 spc
, flags
| TDF_SLIM
, false);
2238 if (TYPE_ALIGN (TREE_TYPE (node
))
2239 != TYPE_ALIGN (TYPE_MAIN_VARIANT (TREE_TYPE (node
))))
2241 pp_string (pp
, ", ");
2242 pp_decimal_int (pp
, TYPE_ALIGN (TREE_TYPE (node
)));
2245 pp_string (pp
, " (");
2246 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
,
2247 flags
| TDF_SLIM
, false);
2248 pp_string (pp
, ", ");
2249 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
,
2250 flags
| TDF_SLIM
, false);
2251 pp_string (pp
, ", ");
2252 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
,
2253 flags
| TDF_SLIM
, false);
2254 pp_right_paren (pp
);
2258 pp_string (pp
, "BIT_FIELD_REF <");
2259 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2260 pp_string (pp
, ", ");
2261 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2262 pp_string (pp
, ", ");
2263 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2268 case BIT_INSERT_EXPR
:
2269 pp_string (pp
, "BIT_INSERT_EXPR <");
2270 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2271 pp_string (pp
, ", ");
2272 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2273 pp_string (pp
, ", ");
2274 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2275 pp_string (pp
, " (");
2276 if (INTEGRAL_TYPE_P (TREE_TYPE (TREE_OPERAND (node
, 1))))
2278 TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (node
, 1))));
2280 dump_generic_node (pp
, TYPE_SIZE (TREE_TYPE (TREE_OPERAND (node
, 1))),
2282 pp_string (pp
, " bits)>");
2286 case ARRAY_RANGE_REF
:
2287 op0
= TREE_OPERAND (node
, 0);
2288 if (op_prio (op0
) < op_prio (node
))
2290 dump_generic_node (pp
, op0
, spc
, flags
, false);
2291 if (op_prio (op0
) < op_prio (node
))
2292 pp_right_paren (pp
);
2293 pp_left_bracket (pp
);
2294 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2295 if (TREE_CODE (node
) == ARRAY_RANGE_REF
)
2296 pp_string (pp
, " ...");
2297 pp_right_bracket (pp
);
2299 op0
= array_ref_low_bound (node
);
2300 op1
= array_ref_element_size (node
);
2302 if (!integer_zerop (op0
)
2303 || TREE_OPERAND (node
, 2)
2304 || TREE_OPERAND (node
, 3))
2306 pp_string (pp
, "{lb: ");
2307 dump_generic_node (pp
, op0
, spc
, flags
, false);
2308 pp_string (pp
, " sz: ");
2309 dump_generic_node (pp
, op1
, spc
, flags
, false);
2310 pp_right_brace (pp
);
2316 unsigned HOST_WIDE_INT ix
;
2318 bool is_struct_init
= false;
2319 bool is_array_init
= false;
2321 if (flags
& TDF_GIMPLE
)
2323 pp_string (pp
, "_Literal (");
2324 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2325 pp_string (pp
, ") ");
2328 if (TREE_CLOBBER_P (node
))
2329 pp_string (pp
, "CLOBBER");
2330 else if (TREE_CODE (TREE_TYPE (node
)) == RECORD_TYPE
2331 || TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
)
2332 is_struct_init
= true;
2333 else if (TREE_CODE (TREE_TYPE (node
)) == ARRAY_TYPE
2334 && TYPE_DOMAIN (TREE_TYPE (node
))
2335 && TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
)))
2336 && TREE_CODE (TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
))))
2339 tree minv
= TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
)));
2340 is_array_init
= true;
2341 curidx
= wi::to_widest (minv
);
2343 FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (node
), ix
, field
, val
)
2350 dump_generic_node (pp
, field
, spc
, flags
, false);
2353 else if (is_array_init
2354 && (TREE_CODE (field
) != INTEGER_CST
2355 || curidx
!= wi::to_widest (field
)))
2357 pp_left_bracket (pp
);
2358 if (TREE_CODE (field
) == RANGE_EXPR
)
2360 dump_generic_node (pp
, TREE_OPERAND (field
, 0), spc
,
2362 pp_string (pp
, " ... ");
2363 dump_generic_node (pp
, TREE_OPERAND (field
, 1), spc
,
2365 if (TREE_CODE (TREE_OPERAND (field
, 1)) == INTEGER_CST
)
2366 curidx
= wi::to_widest (TREE_OPERAND (field
, 1));
2369 dump_generic_node (pp
, field
, spc
, flags
, false);
2370 if (TREE_CODE (field
) == INTEGER_CST
)
2371 curidx
= wi::to_widest (field
);
2372 pp_string (pp
, "]=");
2377 if (val
&& TREE_CODE (val
) == ADDR_EXPR
)
2378 if (TREE_CODE (TREE_OPERAND (val
, 0)) == FUNCTION_DECL
)
2379 val
= TREE_OPERAND (val
, 0);
2380 if (val
&& TREE_CODE (val
) == FUNCTION_DECL
)
2381 dump_decl_name (pp
, val
, flags
);
2383 dump_generic_node (pp
, val
, spc
, flags
, false);
2384 if (ix
!= CONSTRUCTOR_NELTS (node
) - 1)
2390 pp_right_brace (pp
);
2397 if (flags
& TDF_SLIM
)
2399 pp_string (pp
, "<COMPOUND_EXPR>");
2403 dump_generic_node (pp
, TREE_OPERAND (node
, 0),
2404 spc
, flags
, !(flags
& TDF_SLIM
));
2405 if (flags
& TDF_SLIM
)
2406 newline_and_indent (pp
, spc
);
2413 for (tp
= &TREE_OPERAND (node
, 1);
2414 TREE_CODE (*tp
) == COMPOUND_EXPR
;
2415 tp
= &TREE_OPERAND (*tp
, 1))
2417 dump_generic_node (pp
, TREE_OPERAND (*tp
, 0),
2418 spc
, flags
, !(flags
& TDF_SLIM
));
2419 if (flags
& TDF_SLIM
)
2420 newline_and_indent (pp
, spc
);
2428 dump_generic_node (pp
, *tp
, spc
, flags
, !(flags
& TDF_SLIM
));
2432 case STATEMENT_LIST
:
2434 tree_stmt_iterator si
;
2437 if (flags
& TDF_SLIM
)
2439 pp_string (pp
, "<STATEMENT_LIST>");
2443 for (si
= tsi_start (node
); !tsi_end_p (si
); tsi_next (&si
))
2446 newline_and_indent (pp
, spc
);
2449 dump_generic_node (pp
, tsi_stmt (si
), spc
, flags
, true);
2456 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
,
2461 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
,
2466 pp_string (pp
, "TARGET_EXPR <");
2467 dump_generic_node (pp
, TARGET_EXPR_SLOT (node
), spc
, flags
, false);
2470 dump_generic_node (pp
, TARGET_EXPR_INITIAL (node
), spc
, flags
, false);
2475 print_declaration (pp
, DECL_EXPR_DECL (node
), spc
, flags
);
2480 if (TREE_TYPE (node
) == NULL
|| TREE_TYPE (node
) == void_type_node
)
2482 pp_string (pp
, "if (");
2483 dump_generic_node (pp
, COND_EXPR_COND (node
), spc
, flags
, false);
2484 pp_right_paren (pp
);
2485 /* The lowered cond_exprs should always be printed in full. */
2486 if (COND_EXPR_THEN (node
)
2487 && (IS_EMPTY_STMT (COND_EXPR_THEN (node
))
2488 || TREE_CODE (COND_EXPR_THEN (node
)) == GOTO_EXPR
)
2489 && COND_EXPR_ELSE (node
)
2490 && (IS_EMPTY_STMT (COND_EXPR_ELSE (node
))
2491 || TREE_CODE (COND_EXPR_ELSE (node
)) == GOTO_EXPR
))
2494 dump_generic_node (pp
, COND_EXPR_THEN (node
),
2496 if (!IS_EMPTY_STMT (COND_EXPR_ELSE (node
)))
2498 pp_string (pp
, " else ");
2499 dump_generic_node (pp
, COND_EXPR_ELSE (node
),
2503 else if (!(flags
& TDF_SLIM
))
2505 /* Output COND_EXPR_THEN. */
2506 if (COND_EXPR_THEN (node
))
2508 newline_and_indent (pp
, spc
+2);
2510 newline_and_indent (pp
, spc
+4);
2511 dump_generic_node (pp
, COND_EXPR_THEN (node
), spc
+4,
2513 newline_and_indent (pp
, spc
+2);
2514 pp_right_brace (pp
);
2517 /* Output COND_EXPR_ELSE. */
2518 if (COND_EXPR_ELSE (node
)
2519 && !IS_EMPTY_STMT (COND_EXPR_ELSE (node
)))
2521 newline_and_indent (pp
, spc
);
2522 pp_string (pp
, "else");
2523 newline_and_indent (pp
, spc
+2);
2525 newline_and_indent (pp
, spc
+4);
2526 dump_generic_node (pp
, COND_EXPR_ELSE (node
), spc
+4,
2528 newline_and_indent (pp
, spc
+2);
2529 pp_right_brace (pp
);
2536 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2540 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2544 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2550 if (!(flags
& TDF_SLIM
))
2552 if (BIND_EXPR_VARS (node
))
2556 for (op0
= BIND_EXPR_VARS (node
); op0
; op0
= DECL_CHAIN (op0
))
2558 print_declaration (pp
, op0
, spc
+2, flags
);
2563 newline_and_indent (pp
, spc
+2);
2564 dump_generic_node (pp
, BIND_EXPR_BODY (node
), spc
+2, flags
, true);
2565 newline_and_indent (pp
, spc
);
2566 pp_right_brace (pp
);
2572 if (CALL_EXPR_FN (node
) != NULL_TREE
)
2573 print_call_name (pp
, CALL_EXPR_FN (node
), flags
);
2577 pp_string (pp
, internal_fn_name (CALL_EXPR_IFN (node
)));
2580 /* Print parameters. */
2585 call_expr_arg_iterator iter
;
2586 FOR_EACH_CALL_EXPR_ARG (arg
, iter
, node
)
2588 dump_generic_node (pp
, arg
, spc
, flags
, false);
2589 if (more_call_expr_args_p (&iter
))
2596 if (CALL_EXPR_VA_ARG_PACK (node
))
2598 if (call_expr_nargs (node
) > 0)
2603 pp_string (pp
, "__builtin_va_arg_pack ()");
2605 pp_right_paren (pp
);
2607 op1
= CALL_EXPR_STATIC_CHAIN (node
);
2610 pp_string (pp
, " [static-chain: ");
2611 dump_generic_node (pp
, op1
, spc
, flags
, false);
2612 pp_right_bracket (pp
);
2615 if (CALL_EXPR_RETURN_SLOT_OPT (node
))
2616 pp_string (pp
, " [return slot optimization]");
2617 if (CALL_EXPR_TAILCALL (node
))
2618 pp_string (pp
, " [tail call]");
2621 case WITH_CLEANUP_EXPR
:
2625 case CLEANUP_POINT_EXPR
:
2626 pp_string (pp
, "<<cleanup_point ");
2627 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2628 pp_string (pp
, ">>");
2631 case PLACEHOLDER_EXPR
:
2632 pp_string (pp
, "<PLACEHOLDER_EXPR ");
2633 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2637 /* Binary arithmetic and logic expressions. */
2638 case WIDEN_SUM_EXPR
:
2639 case WIDEN_MULT_EXPR
:
2641 case MULT_HIGHPART_EXPR
:
2643 case POINTER_PLUS_EXPR
:
2644 case POINTER_DIFF_EXPR
:
2646 case TRUNC_DIV_EXPR
:
2648 case FLOOR_DIV_EXPR
:
2649 case ROUND_DIV_EXPR
:
2650 case TRUNC_MOD_EXPR
:
2652 case FLOOR_MOD_EXPR
:
2653 case ROUND_MOD_EXPR
:
2655 case EXACT_DIV_EXPR
:
2660 case WIDEN_LSHIFT_EXPR
:
2664 case TRUTH_ANDIF_EXPR
:
2665 case TRUTH_ORIF_EXPR
:
2666 case TRUTH_AND_EXPR
:
2668 case TRUTH_XOR_EXPR
:
2682 case UNORDERED_EXPR
:
2684 const char *op
= op_symbol (node
);
2685 op0
= TREE_OPERAND (node
, 0);
2686 op1
= TREE_OPERAND (node
, 1);
2688 /* When the operands are expressions with less priority,
2689 keep semantics of the tree representation. */
2690 if (op_prio (op0
) <= op_prio (node
))
2693 dump_generic_node (pp
, op0
, spc
, flags
, false);
2694 pp_right_paren (pp
);
2697 dump_generic_node (pp
, op0
, spc
, flags
, false);
2703 /* When the operands are expressions with less priority,
2704 keep semantics of the tree representation. */
2705 if (op_prio (op1
) <= op_prio (node
))
2708 dump_generic_node (pp
, op1
, spc
, flags
, false);
2709 pp_right_paren (pp
);
2712 dump_generic_node (pp
, op1
, spc
, flags
, false);
2716 /* Unary arithmetic and logic expressions. */
2719 case TRUTH_NOT_EXPR
:
2721 case PREDECREMENT_EXPR
:
2722 case PREINCREMENT_EXPR
:
2724 if (TREE_CODE (node
) == ADDR_EXPR
2725 && (TREE_CODE (TREE_OPERAND (node
, 0)) == STRING_CST
2726 || TREE_CODE (TREE_OPERAND (node
, 0)) == FUNCTION_DECL
))
2727 ; /* Do not output '&' for strings and function pointers. */
2729 pp_string (pp
, op_symbol (node
));
2731 if (op_prio (TREE_OPERAND (node
, 0)) < op_prio (node
))
2734 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2735 pp_right_paren (pp
);
2738 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2741 case POSTDECREMENT_EXPR
:
2742 case POSTINCREMENT_EXPR
:
2743 if (op_prio (TREE_OPERAND (node
, 0)) < op_prio (node
))
2746 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2747 pp_right_paren (pp
);
2750 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2751 pp_string (pp
, op_symbol (node
));
2755 pp_string (pp
, "MIN_EXPR <");
2756 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2757 pp_string (pp
, ", ");
2758 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2763 pp_string (pp
, "MAX_EXPR <");
2764 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2765 pp_string (pp
, ", ");
2766 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2771 pp_string (pp
, "ABS_EXPR <");
2772 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2777 pp_string (pp
, "ABSU_EXPR <");
2778 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2786 case ADDR_SPACE_CONVERT_EXPR
:
2787 case FIXED_CONVERT_EXPR
:
2788 case FIX_TRUNC_EXPR
:
2791 type
= TREE_TYPE (node
);
2792 op0
= TREE_OPERAND (node
, 0);
2793 if (type
!= TREE_TYPE (op0
))
2796 dump_generic_node (pp
, type
, spc
, flags
, false);
2797 pp_string (pp
, ") ");
2799 if (op_prio (op0
) < op_prio (node
))
2801 dump_generic_node (pp
, op0
, spc
, flags
, false);
2802 if (op_prio (op0
) < op_prio (node
))
2803 pp_right_paren (pp
);
2806 case VIEW_CONVERT_EXPR
:
2807 if (flags
& TDF_GIMPLE
)
2808 pp_string (pp
, "__VIEW_CONVERT <");
2810 pp_string (pp
, "VIEW_CONVERT_EXPR<");
2811 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2812 pp_string (pp
, ">(");
2813 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2814 pp_right_paren (pp
);
2818 pp_string (pp
, "((");
2819 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2820 pp_string (pp
, "))");
2823 case NON_LVALUE_EXPR
:
2824 pp_string (pp
, "NON_LVALUE_EXPR <");
2825 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2830 pp_string (pp
, "SAVE_EXPR <");
2831 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2836 pp_string (pp
, "COMPLEX_EXPR <");
2837 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2838 pp_string (pp
, ", ");
2839 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2844 pp_string (pp
, "CONJ_EXPR <");
2845 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2850 if (flags
& TDF_GIMPLE
)
2852 pp_string (pp
, "__real ");
2853 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2857 pp_string (pp
, "REALPART_EXPR <");
2858 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2864 if (flags
& TDF_GIMPLE
)
2866 pp_string (pp
, "__imag ");
2867 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2871 pp_string (pp
, "IMAGPART_EXPR <");
2872 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2878 pp_string (pp
, "VA_ARG_EXPR <");
2879 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2883 case TRY_FINALLY_EXPR
:
2884 case TRY_CATCH_EXPR
:
2885 pp_string (pp
, "try");
2886 newline_and_indent (pp
, spc
+2);
2888 newline_and_indent (pp
, spc
+4);
2889 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
+4, flags
, true);
2890 newline_and_indent (pp
, spc
+2);
2891 pp_right_brace (pp
);
2892 newline_and_indent (pp
, spc
);
2893 if (TREE_CODE (node
) == TRY_CATCH_EXPR
)
2895 node
= TREE_OPERAND (node
, 1);
2896 pp_string (pp
, "catch");
2900 gcc_assert (TREE_CODE (node
) == TRY_FINALLY_EXPR
);
2901 node
= TREE_OPERAND (node
, 1);
2902 pp_string (pp
, "finally");
2903 if (TREE_CODE (node
) == EH_ELSE_EXPR
)
2905 newline_and_indent (pp
, spc
+2);
2907 newline_and_indent (pp
, spc
+4);
2908 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
+4,
2910 newline_and_indent (pp
, spc
+2);
2911 pp_right_brace (pp
);
2912 newline_and_indent (pp
, spc
);
2913 node
= TREE_OPERAND (node
, 1);
2914 pp_string (pp
, "else");
2917 newline_and_indent (pp
, spc
+2);
2919 newline_and_indent (pp
, spc
+4);
2920 dump_generic_node (pp
, node
, spc
+4, flags
, true);
2921 newline_and_indent (pp
, spc
+2);
2922 pp_right_brace (pp
);
2927 pp_string (pp
, "catch (");
2928 dump_generic_node (pp
, CATCH_TYPES (node
), spc
+2, flags
, false);
2929 pp_right_paren (pp
);
2930 newline_and_indent (pp
, spc
+2);
2932 newline_and_indent (pp
, spc
+4);
2933 dump_generic_node (pp
, CATCH_BODY (node
), spc
+4, flags
, true);
2934 newline_and_indent (pp
, spc
+2);
2935 pp_right_brace (pp
);
2939 case EH_FILTER_EXPR
:
2940 pp_string (pp
, "<<<eh_filter (");
2941 dump_generic_node (pp
, EH_FILTER_TYPES (node
), spc
+2, flags
, false);
2942 pp_string (pp
, ")>>>");
2943 newline_and_indent (pp
, spc
+2);
2945 newline_and_indent (pp
, spc
+4);
2946 dump_generic_node (pp
, EH_FILTER_FAILURE (node
), spc
+4, flags
, true);
2947 newline_and_indent (pp
, spc
+2);
2948 pp_right_brace (pp
);
2953 op0
= TREE_OPERAND (node
, 0);
2954 /* If this is for break or continue, don't bother printing it. */
2955 if (DECL_NAME (op0
))
2957 const char *name
= IDENTIFIER_POINTER (DECL_NAME (op0
));
2958 if (strcmp (name
, "break") == 0
2959 || strcmp (name
, "continue") == 0)
2962 dump_generic_node (pp
, op0
, spc
, flags
, false);
2964 if (DECL_NONLOCAL (op0
))
2965 pp_string (pp
, " [non-local]");
2969 pp_string (pp
, "while (1)");
2970 if (!(flags
& TDF_SLIM
))
2972 newline_and_indent (pp
, spc
+2);
2974 newline_and_indent (pp
, spc
+4);
2975 dump_generic_node (pp
, LOOP_EXPR_BODY (node
), spc
+4, flags
, true);
2976 newline_and_indent (pp
, spc
+2);
2977 pp_right_brace (pp
);
2983 pp_string (pp
, "// predicted ");
2984 if (PREDICT_EXPR_OUTCOME (node
))
2985 pp_string (pp
, "likely by ");
2987 pp_string (pp
, "unlikely by ");
2988 pp_string (pp
, predictor_name (PREDICT_EXPR_PREDICTOR (node
)));
2989 pp_string (pp
, " predictor.");
2993 pp_string (pp
, "ANNOTATE_EXPR <");
2994 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2995 switch ((enum annot_expr_kind
) TREE_INT_CST_LOW (TREE_OPERAND (node
, 1)))
2997 case annot_expr_ivdep_kind
:
2998 pp_string (pp
, ", ivdep");
3000 case annot_expr_unroll_kind
:
3001 pp_printf (pp
, ", unroll %d",
3002 (int) TREE_INT_CST_LOW (TREE_OPERAND (node
, 2)));
3004 case annot_expr_no_vector_kind
:
3005 pp_string (pp
, ", no-vector");
3007 case annot_expr_vector_kind
:
3008 pp_string (pp
, ", vector");
3010 case annot_expr_parallel_kind
:
3011 pp_string (pp
, ", parallel");
3020 pp_string (pp
, "return");
3021 op0
= TREE_OPERAND (node
, 0);
3025 if (TREE_CODE (op0
) == MODIFY_EXPR
)
3026 dump_generic_node (pp
, TREE_OPERAND (op0
, 1),
3029 dump_generic_node (pp
, op0
, spc
, flags
, false);
3034 pp_string (pp
, "if (");
3035 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3036 pp_string (pp
, ") break");
3040 pp_string (pp
, "switch (");
3041 dump_generic_node (pp
, SWITCH_COND (node
), spc
, flags
, false);
3042 pp_right_paren (pp
);
3043 if (!(flags
& TDF_SLIM
))
3045 newline_and_indent (pp
, spc
+2);
3047 if (SWITCH_BODY (node
))
3049 newline_and_indent (pp
, spc
+4);
3050 dump_generic_node (pp
, SWITCH_BODY (node
), spc
+4, flags
,
3053 newline_and_indent (pp
, spc
+2);
3054 pp_right_brace (pp
);
3060 op0
= GOTO_DESTINATION (node
);
3061 if (TREE_CODE (op0
) != SSA_NAME
&& DECL_P (op0
) && DECL_NAME (op0
))
3063 const char *name
= IDENTIFIER_POINTER (DECL_NAME (op0
));
3064 if (strcmp (name
, "break") == 0
3065 || strcmp (name
, "continue") == 0)
3067 pp_string (pp
, name
);
3071 pp_string (pp
, "goto ");
3072 dump_generic_node (pp
, op0
, spc
, flags
, false);
3076 pp_string (pp
, "__asm__");
3077 if (ASM_VOLATILE_P (node
))
3078 pp_string (pp
, " __volatile__");
3080 dump_generic_node (pp
, ASM_STRING (node
), spc
, flags
, false);
3082 dump_generic_node (pp
, ASM_OUTPUTS (node
), spc
, flags
, false);
3084 dump_generic_node (pp
, ASM_INPUTS (node
), spc
, flags
, false);
3085 if (ASM_CLOBBERS (node
))
3088 dump_generic_node (pp
, ASM_CLOBBERS (node
), spc
, flags
, false);
3090 pp_right_paren (pp
);
3093 case CASE_LABEL_EXPR
:
3094 if (CASE_LOW (node
) && CASE_HIGH (node
))
3096 pp_string (pp
, "case ");
3097 dump_generic_node (pp
, CASE_LOW (node
), spc
, flags
, false);
3098 pp_string (pp
, " ... ");
3099 dump_generic_node (pp
, CASE_HIGH (node
), spc
, flags
, false);
3101 else if (CASE_LOW (node
))
3103 pp_string (pp
, "case ");
3104 dump_generic_node (pp
, CASE_LOW (node
), spc
, flags
, false);
3107 pp_string (pp
, "default");
3112 pp_string (pp
, "OBJ_TYPE_REF(");
3113 dump_generic_node (pp
, OBJ_TYPE_REF_EXPR (node
), spc
, flags
, false);
3115 /* We omit the class type for -fcompare-debug because we may
3116 drop TYPE_BINFO early depending on debug info, and then
3117 virtual_method_call_p would return false, whereas when
3118 TYPE_BINFO is preserved it may still return true and then
3119 we'd print the class type. Compare tree and rtl dumps for
3120 libstdc++-prettyprinters/shared_ptr.cc with and without -g,
3121 for example, at occurrences of OBJ_TYPE_REF. */
3122 if (!(flags
& (TDF_SLIM
| TDF_COMPARE_DEBUG
))
3123 && virtual_method_call_p (node
, true))
3125 pp_string (pp
, "(");
3126 dump_generic_node (pp
, obj_type_ref_class (node
, true),
3128 pp_string (pp
, ")");
3130 dump_generic_node (pp
, OBJ_TYPE_REF_OBJECT (node
), spc
, flags
, false);
3132 dump_generic_node (pp
, OBJ_TYPE_REF_TOKEN (node
), spc
, flags
, false);
3133 pp_right_paren (pp
);
3137 if (SSA_NAME_IDENTIFIER (node
))
3139 if ((flags
& TDF_NOUID
)
3140 && SSA_NAME_VAR (node
)
3141 && DECL_NAMELESS (SSA_NAME_VAR (node
)))
3142 dump_fancy_name (pp
, SSA_NAME_IDENTIFIER (node
));
3143 else if (! (flags
& TDF_GIMPLE
)
3144 || SSA_NAME_VAR (node
))
3145 dump_generic_node (pp
, SSA_NAME_IDENTIFIER (node
),
3149 pp_decimal_int (pp
, SSA_NAME_VERSION (node
));
3150 if (SSA_NAME_IS_DEFAULT_DEF (node
))
3151 pp_string (pp
, "(D)");
3152 if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (node
))
3153 pp_string (pp
, "(ab)");
3156 case WITH_SIZE_EXPR
:
3157 pp_string (pp
, "WITH_SIZE_EXPR <");
3158 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3159 pp_string (pp
, ", ");
3160 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3165 pp_string (pp
, "ASSERT_EXPR <");
3166 dump_generic_node (pp
, ASSERT_EXPR_VAR (node
), spc
, flags
, false);
3167 pp_string (pp
, ", ");
3168 dump_generic_node (pp
, ASSERT_EXPR_COND (node
), spc
, flags
, false);
3173 pp_string (pp
, "scev_known");
3176 case SCEV_NOT_KNOWN
:
3177 pp_string (pp
, "scev_not_known");
3180 case POLYNOMIAL_CHREC
:
3182 dump_generic_node (pp
, CHREC_LEFT (node
), spc
, flags
, false);
3183 pp_string (pp
, ", +, ");
3184 dump_generic_node (pp
, CHREC_RIGHT (node
), spc
, flags
, false);
3185 pp_printf (pp
, "}_%u", CHREC_VARIABLE (node
));
3189 case REALIGN_LOAD_EXPR
:
3190 pp_string (pp
, "REALIGN_LOAD <");
3191 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3192 pp_string (pp
, ", ");
3193 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3194 pp_string (pp
, ", ");
3195 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3200 pp_string (pp
, " VEC_COND_EXPR < ");
3201 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3202 pp_string (pp
, " , ");
3203 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3204 pp_string (pp
, " , ");
3205 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3206 pp_string (pp
, " > ");
3210 pp_string (pp
, " VEC_PERM_EXPR < ");
3211 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3212 pp_string (pp
, " , ");
3213 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3214 pp_string (pp
, " , ");
3215 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3216 pp_string (pp
, " > ");
3220 pp_string (pp
, " DOT_PROD_EXPR < ");
3221 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3222 pp_string (pp
, ", ");
3223 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3224 pp_string (pp
, ", ");
3225 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3226 pp_string (pp
, " > ");
3229 case WIDEN_MULT_PLUS_EXPR
:
3230 pp_string (pp
, " WIDEN_MULT_PLUS_EXPR < ");
3231 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3232 pp_string (pp
, ", ");
3233 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3234 pp_string (pp
, ", ");
3235 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3236 pp_string (pp
, " > ");
3239 case WIDEN_MULT_MINUS_EXPR
:
3240 pp_string (pp
, " WIDEN_MULT_MINUS_EXPR < ");
3241 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3242 pp_string (pp
, ", ");
3243 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3244 pp_string (pp
, ", ");
3245 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3246 pp_string (pp
, " > ");
3250 pp_string (pp
, "#pragma acc parallel");
3251 goto dump_omp_clauses_body
;
3254 pp_string (pp
, "#pragma acc kernels");
3255 goto dump_omp_clauses_body
;
3258 pp_string (pp
, "#pragma acc serial");
3259 goto dump_omp_clauses_body
;
3262 pp_string (pp
, "#pragma acc data");
3263 dump_omp_clauses (pp
, OACC_DATA_CLAUSES (node
), spc
, flags
);
3266 case OACC_HOST_DATA
:
3267 pp_string (pp
, "#pragma acc host_data");
3268 dump_omp_clauses (pp
, OACC_HOST_DATA_CLAUSES (node
), spc
, flags
);
3272 pp_string (pp
, "#pragma acc declare");
3273 dump_omp_clauses (pp
, OACC_DECLARE_CLAUSES (node
), spc
, flags
);
3277 pp_string (pp
, "#pragma acc update");
3278 dump_omp_clauses (pp
, OACC_UPDATE_CLAUSES (node
), spc
, flags
);
3281 case OACC_ENTER_DATA
:
3282 pp_string (pp
, "#pragma acc enter data");
3283 dump_omp_clauses (pp
, OACC_ENTER_DATA_CLAUSES (node
), spc
, flags
);
3286 case OACC_EXIT_DATA
:
3287 pp_string (pp
, "#pragma acc exit data");
3288 dump_omp_clauses (pp
, OACC_EXIT_DATA_CLAUSES (node
), spc
, flags
);
3292 pp_string (pp
, "#pragma acc cache");
3293 dump_omp_clauses (pp
, OACC_CACHE_CLAUSES (node
), spc
, flags
);
3297 pp_string (pp
, "#pragma omp parallel");
3298 dump_omp_clauses (pp
, OMP_PARALLEL_CLAUSES (node
), spc
, flags
);
3301 dump_omp_clauses_body
:
3302 dump_omp_clauses (pp
, OMP_CLAUSES (node
), spc
, flags
);
3306 if (!(flags
& TDF_SLIM
) && OMP_BODY (node
))
3308 newline_and_indent (pp
, spc
+ 2);
3310 newline_and_indent (pp
, spc
+ 4);
3311 dump_generic_node (pp
, OMP_BODY (node
), spc
+ 4, flags
, false);
3312 newline_and_indent (pp
, spc
+ 2);
3313 pp_right_brace (pp
);
3319 pp_string (pp
, OMP_TASK_BODY (node
) ? "#pragma omp task"
3320 : "#pragma omp taskwait");
3321 dump_omp_clauses (pp
, OMP_TASK_CLAUSES (node
), spc
, flags
);
3325 pp_string (pp
, "#pragma omp for");
3329 pp_string (pp
, "#pragma omp simd");
3332 case OMP_DISTRIBUTE
:
3333 pp_string (pp
, "#pragma omp distribute");
3337 pp_string (pp
, "#pragma omp taskloop");
3341 pp_string (pp
, "#pragma omp loop");
3345 pp_string (pp
, "#pragma acc loop");
3349 pp_string (pp
, "#pragma omp teams");
3350 dump_omp_clauses (pp
, OMP_TEAMS_CLAUSES (node
), spc
, flags
);
3353 case OMP_TARGET_DATA
:
3354 pp_string (pp
, "#pragma omp target data");
3355 dump_omp_clauses (pp
, OMP_TARGET_DATA_CLAUSES (node
), spc
, flags
);
3358 case OMP_TARGET_ENTER_DATA
:
3359 pp_string (pp
, "#pragma omp target enter data");
3360 dump_omp_clauses (pp
, OMP_TARGET_ENTER_DATA_CLAUSES (node
), spc
, flags
);
3364 case OMP_TARGET_EXIT_DATA
:
3365 pp_string (pp
, "#pragma omp target exit data");
3366 dump_omp_clauses (pp
, OMP_TARGET_EXIT_DATA_CLAUSES (node
), spc
, flags
);
3371 pp_string (pp
, "#pragma omp target");
3372 dump_omp_clauses (pp
, OMP_TARGET_CLAUSES (node
), spc
, flags
);
3375 case OMP_TARGET_UPDATE
:
3376 pp_string (pp
, "#pragma omp target update");
3377 dump_omp_clauses (pp
, OMP_TARGET_UPDATE_CLAUSES (node
), spc
, flags
);
3382 dump_omp_clauses (pp
, OMP_FOR_CLAUSES (node
), spc
, flags
);
3383 if (!(flags
& TDF_SLIM
))
3387 if (OMP_FOR_PRE_BODY (node
))
3389 newline_and_indent (pp
, spc
+ 2);
3392 newline_and_indent (pp
, spc
);
3393 dump_generic_node (pp
, OMP_FOR_PRE_BODY (node
),
3396 if (OMP_FOR_INIT (node
))
3399 for (i
= 0; i
< TREE_VEC_LENGTH (OMP_FOR_INIT (node
)); i
++)
3402 newline_and_indent (pp
, spc
);
3403 pp_string (pp
, "for (");
3404 tree init
= TREE_VEC_ELT (OMP_FOR_INIT (node
), i
);
3405 if (TREE_CODE (init
) != MODIFY_EXPR
3406 || TREE_CODE (TREE_OPERAND (init
, 1)) != TREE_VEC
)
3407 dump_generic_node (pp
, init
, spc
, flags
, false);
3410 dump_generic_node (pp
, TREE_OPERAND (init
, 0),
3412 pp_string (pp
, " = ");
3413 dump_omp_loop_non_rect_expr (pp
, TREE_OPERAND (init
, 1),
3416 pp_string (pp
, "; ");
3417 tree cond
= TREE_VEC_ELT (OMP_FOR_COND (node
), i
);
3418 if (!COMPARISON_CLASS_P (cond
)
3419 || TREE_CODE (TREE_OPERAND (cond
, 1)) != TREE_VEC
)
3420 dump_generic_node (pp
, cond
, spc
, flags
, false);
3423 dump_generic_node (pp
, TREE_OPERAND (cond
, 0),
3425 const char *op
= op_symbol (cond
);
3429 dump_omp_loop_non_rect_expr (pp
, TREE_OPERAND (cond
, 1),
3432 pp_string (pp
, "; ");
3433 dump_generic_node (pp
,
3434 TREE_VEC_ELT (OMP_FOR_INCR (node
), i
),
3436 pp_right_paren (pp
);
3439 if (OMP_FOR_BODY (node
))
3441 newline_and_indent (pp
, spc
+ 2);
3443 newline_and_indent (pp
, spc
+ 4);
3444 dump_generic_node (pp
, OMP_FOR_BODY (node
), spc
+ 4, flags
,
3446 newline_and_indent (pp
, spc
+ 2);
3447 pp_right_brace (pp
);
3449 if (OMP_FOR_INIT (node
))
3450 spc
-= 2 * TREE_VEC_LENGTH (OMP_FOR_INIT (node
)) - 2;
3451 if (OMP_FOR_PRE_BODY (node
))
3454 newline_and_indent (pp
, spc
+ 2);
3455 pp_right_brace (pp
);
3462 pp_string (pp
, "#pragma omp sections");
3463 dump_omp_clauses (pp
, OMP_SECTIONS_CLAUSES (node
), spc
, flags
);
3467 pp_string (pp
, "#pragma omp section");
3471 if (OMP_SCAN_CLAUSES (node
))
3473 pp_string (pp
, "#pragma omp scan");
3474 dump_omp_clauses (pp
, OMP_SCAN_CLAUSES (node
), spc
, flags
);
3479 pp_string (pp
, "#pragma omp master");
3483 pp_string (pp
, "#pragma omp taskgroup");
3484 dump_omp_clauses (pp
, OMP_TASKGROUP_CLAUSES (node
), spc
, flags
);
3488 pp_string (pp
, "#pragma omp ordered");
3489 dump_omp_clauses (pp
, OMP_ORDERED_CLAUSES (node
), spc
, flags
);
3493 pp_string (pp
, "#pragma omp critical");
3494 if (OMP_CRITICAL_NAME (node
))
3498 dump_generic_node (pp
, OMP_CRITICAL_NAME (node
), spc
,
3500 pp_right_paren (pp
);
3502 dump_omp_clauses (pp
, OMP_CRITICAL_CLAUSES (node
), spc
, flags
);
3506 pp_string (pp
, "#pragma omp atomic");
3507 dump_omp_atomic_memory_order (pp
, OMP_ATOMIC_MEMORY_ORDER (node
));
3508 newline_and_indent (pp
, spc
+ 2);
3509 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3513 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3516 case OMP_ATOMIC_READ
:
3517 pp_string (pp
, "#pragma omp atomic read");
3518 dump_omp_atomic_memory_order (pp
, OMP_ATOMIC_MEMORY_ORDER (node
));
3519 newline_and_indent (pp
, spc
+ 2);
3520 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3524 case OMP_ATOMIC_CAPTURE_OLD
:
3525 case OMP_ATOMIC_CAPTURE_NEW
:
3526 pp_string (pp
, "#pragma omp atomic capture");
3527 dump_omp_atomic_memory_order (pp
, OMP_ATOMIC_MEMORY_ORDER (node
));
3528 newline_and_indent (pp
, spc
+ 2);
3529 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3533 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3537 pp_string (pp
, "#pragma omp single");
3538 dump_omp_clauses (pp
, OMP_SINGLE_CLAUSES (node
), spc
, flags
);
3542 dump_omp_clause (pp
, node
, spc
, flags
);
3546 case TRANSACTION_EXPR
:
3547 if (TRANSACTION_EXPR_OUTER (node
))
3548 pp_string (pp
, "__transaction_atomic [[outer]]");
3549 else if (TRANSACTION_EXPR_RELAXED (node
))
3550 pp_string (pp
, "__transaction_relaxed");
3552 pp_string (pp
, "__transaction_atomic");
3553 if (!(flags
& TDF_SLIM
) && TRANSACTION_EXPR_BODY (node
))
3555 newline_and_indent (pp
, spc
);
3557 newline_and_indent (pp
, spc
+ 2);
3558 dump_generic_node (pp
, TRANSACTION_EXPR_BODY (node
),
3559 spc
+ 2, flags
, false);
3560 newline_and_indent (pp
, spc
);
3561 pp_right_brace (pp
);
3566 case VEC_SERIES_EXPR
:
3567 case VEC_WIDEN_MULT_HI_EXPR
:
3568 case VEC_WIDEN_MULT_LO_EXPR
:
3569 case VEC_WIDEN_MULT_EVEN_EXPR
:
3570 case VEC_WIDEN_MULT_ODD_EXPR
:
3571 case VEC_WIDEN_LSHIFT_HI_EXPR
:
3572 case VEC_WIDEN_LSHIFT_LO_EXPR
:
3574 for (str
= get_tree_code_name (code
); *str
; str
++)
3575 pp_character (pp
, TOUPPER (*str
));
3576 pp_string (pp
, " < ");
3577 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3578 pp_string (pp
, ", ");
3579 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3580 pp_string (pp
, " > ");
3583 case VEC_DUPLICATE_EXPR
:
3585 for (str
= get_tree_code_name (code
); *str
; str
++)
3586 pp_character (pp
, TOUPPER (*str
));
3587 pp_string (pp
, " < ");
3588 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3589 pp_string (pp
, " > ");
3592 case VEC_UNPACK_HI_EXPR
:
3593 pp_string (pp
, " VEC_UNPACK_HI_EXPR < ");
3594 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3595 pp_string (pp
, " > ");
3598 case VEC_UNPACK_LO_EXPR
:
3599 pp_string (pp
, " VEC_UNPACK_LO_EXPR < ");
3600 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3601 pp_string (pp
, " > ");
3604 case VEC_UNPACK_FLOAT_HI_EXPR
:
3605 pp_string (pp
, " VEC_UNPACK_FLOAT_HI_EXPR < ");
3606 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3607 pp_string (pp
, " > ");
3610 case VEC_UNPACK_FLOAT_LO_EXPR
:
3611 pp_string (pp
, " VEC_UNPACK_FLOAT_LO_EXPR < ");
3612 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3613 pp_string (pp
, " > ");
3616 case VEC_UNPACK_FIX_TRUNC_HI_EXPR
:
3617 pp_string (pp
, " VEC_UNPACK_FIX_TRUNC_HI_EXPR < ");
3618 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3619 pp_string (pp
, " > ");
3622 case VEC_UNPACK_FIX_TRUNC_LO_EXPR
:
3623 pp_string (pp
, " VEC_UNPACK_FIX_TRUNC_LO_EXPR < ");
3624 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3625 pp_string (pp
, " > ");
3628 case VEC_PACK_TRUNC_EXPR
:
3629 pp_string (pp
, " VEC_PACK_TRUNC_EXPR < ");
3630 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3631 pp_string (pp
, ", ");
3632 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3633 pp_string (pp
, " > ");
3636 case VEC_PACK_SAT_EXPR
:
3637 pp_string (pp
, " VEC_PACK_SAT_EXPR < ");
3638 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3639 pp_string (pp
, ", ");
3640 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3641 pp_string (pp
, " > ");
3644 case VEC_PACK_FIX_TRUNC_EXPR
:
3645 pp_string (pp
, " VEC_PACK_FIX_TRUNC_EXPR < ");
3646 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3647 pp_string (pp
, ", ");
3648 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3649 pp_string (pp
, " > ");
3652 case VEC_PACK_FLOAT_EXPR
:
3653 pp_string (pp
, " VEC_PACK_FLOAT_EXPR < ");
3654 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3655 pp_string (pp
, ", ");
3656 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3657 pp_string (pp
, " > ");
3661 dump_block_node (pp
, node
, spc
, flags
);
3664 case DEBUG_BEGIN_STMT
:
3665 pp_string (pp
, "# DEBUG BEGIN STMT");
3672 if (is_stmt
&& is_expr
)
3678 /* Print the declaration of a variable. */
3681 print_declaration (pretty_printer
*pp
, tree t
, int spc
, dump_flags_t flags
)
3685 if (TREE_CODE(t
) == NAMELIST_DECL
)
3687 pp_string(pp
, "namelist ");
3688 dump_decl_name (pp
, t
, flags
);
3693 if (TREE_CODE (t
) == TYPE_DECL
)
3694 pp_string (pp
, "typedef ");
3696 if (CODE_CONTAINS_STRUCT (TREE_CODE (t
), TS_DECL_WRTL
) && DECL_REGISTER (t
))
3697 pp_string (pp
, "register ");
3699 if (TREE_PUBLIC (t
) && DECL_EXTERNAL (t
))
3700 pp_string (pp
, "extern ");
3701 else if (TREE_STATIC (t
))
3702 pp_string (pp
, "static ");
3704 /* Print the type and name. */
3705 if (TREE_TYPE (t
) && TREE_CODE (TREE_TYPE (t
)) == ARRAY_TYPE
)
3709 /* Print array's type. */
3710 tmp
= TREE_TYPE (t
);
3711 while (TREE_CODE (TREE_TYPE (tmp
)) == ARRAY_TYPE
)
3712 tmp
= TREE_TYPE (tmp
);
3713 dump_generic_node (pp
, TREE_TYPE (tmp
), spc
, flags
, false);
3715 /* Print variable's name. */
3717 dump_generic_node (pp
, t
, spc
, flags
, false);
3719 /* Print the dimensions. */
3720 tmp
= TREE_TYPE (t
);
3721 while (TREE_CODE (tmp
) == ARRAY_TYPE
)
3723 dump_array_domain (pp
, TYPE_DOMAIN (tmp
), spc
, flags
);
3724 tmp
= TREE_TYPE (tmp
);
3727 else if (TREE_CODE (t
) == FUNCTION_DECL
)
3729 dump_generic_node (pp
, TREE_TYPE (TREE_TYPE (t
)), spc
, flags
, false);
3731 dump_decl_name (pp
, t
, flags
);
3732 dump_function_declaration (pp
, TREE_TYPE (t
), spc
, flags
);
3736 /* Print type declaration. */
3737 dump_generic_node (pp
, TREE_TYPE (t
), spc
, flags
, false);
3739 /* Print variable's name. */
3741 dump_generic_node (pp
, t
, spc
, flags
, false);
3744 if (VAR_P (t
) && DECL_HARD_REGISTER (t
))
3746 pp_string (pp
, " __asm__ ");
3748 dump_generic_node (pp
, DECL_ASSEMBLER_NAME (t
), spc
, flags
, false);
3749 pp_right_paren (pp
);
3752 /* The initial value of a function serves to determine whether the function
3753 is declared or defined. So the following does not apply to function
3755 if (TREE_CODE (t
) != FUNCTION_DECL
)
3757 /* Print the initial value. */
3758 if (DECL_INITIAL (t
))
3763 if (!(flags
& TDF_SLIM
))
3764 dump_generic_node (pp
, DECL_INITIAL (t
), spc
, flags
, false);
3766 pp_string (pp
, "<<< omitted >>>");
3770 if (VAR_P (t
) && DECL_HAS_VALUE_EXPR_P (t
))
3772 pp_string (pp
, " [value-expr: ");
3773 dump_generic_node (pp
, DECL_VALUE_EXPR (t
), spc
, flags
, false);
3774 pp_right_bracket (pp
);
3781 /* Prints a structure: name, fields, and methods.
3782 FIXME: Still incomplete. */
3785 print_struct_decl (pretty_printer
*pp
, const_tree node
, int spc
,
3788 /* Print the name of the structure. */
3789 if (TYPE_NAME (node
))
3792 if (TREE_CODE (node
) == RECORD_TYPE
)
3793 pp_string (pp
, "struct ");
3794 else if ((TREE_CODE (node
) == UNION_TYPE
3795 || TREE_CODE (node
) == QUAL_UNION_TYPE
))
3796 pp_string (pp
, "union ");
3798 dump_generic_node (pp
, TYPE_NAME (node
), spc
, TDF_NONE
, false);
3801 /* Print the contents of the structure. */
3807 /* Print the fields of the structure. */
3810 tmp
= TYPE_FIELDS (node
);
3813 /* Avoid to print recursively the structure. */
3814 /* FIXME : Not implemented correctly...,
3815 what about the case when we have a cycle in the contain graph? ...
3816 Maybe this could be solved by looking at the scope in which the
3817 structure was declared. */
3818 if (TREE_TYPE (tmp
) != node
3819 && (TREE_CODE (TREE_TYPE (tmp
)) != POINTER_TYPE
3820 || TREE_TYPE (TREE_TYPE (tmp
)) != node
))
3822 print_declaration (pp
, tmp
, spc
+2, flags
);
3825 tmp
= DECL_CHAIN (tmp
);
3829 pp_right_brace (pp
);
3832 /* Return the priority of the operator CODE.
3834 From lowest to highest precedence with either left-to-right (L-R)
3835 or right-to-left (R-L) associativity]:
3838 2 [R-L] = += -= *= /= %= &= ^= |= <<= >>=
3850 14 [R-L] ! ~ ++ -- + - * & (type) sizeof
3851 15 [L-R] fn() [] -> .
3853 unary +, - and * have higher precedence than the corresponding binary
3857 op_code_prio (enum tree_code code
)
3874 case TRUTH_ORIF_EXPR
:
3877 case TRUTH_AND_EXPR
:
3878 case TRUTH_ANDIF_EXPR
:
3885 case TRUTH_XOR_EXPR
:
3902 case UNORDERED_EXPR
:
3913 case VEC_WIDEN_LSHIFT_HI_EXPR
:
3914 case VEC_WIDEN_LSHIFT_LO_EXPR
:
3915 case WIDEN_LSHIFT_EXPR
:
3918 case WIDEN_SUM_EXPR
:
3920 case POINTER_PLUS_EXPR
:
3921 case POINTER_DIFF_EXPR
:
3925 case VEC_WIDEN_MULT_HI_EXPR
:
3926 case VEC_WIDEN_MULT_LO_EXPR
:
3927 case WIDEN_MULT_EXPR
:
3929 case WIDEN_MULT_PLUS_EXPR
:
3930 case WIDEN_MULT_MINUS_EXPR
:
3932 case MULT_HIGHPART_EXPR
:
3933 case TRUNC_DIV_EXPR
:
3935 case FLOOR_DIV_EXPR
:
3936 case ROUND_DIV_EXPR
:
3938 case EXACT_DIV_EXPR
:
3939 case TRUNC_MOD_EXPR
:
3941 case FLOOR_MOD_EXPR
:
3942 case ROUND_MOD_EXPR
:
3945 case TRUTH_NOT_EXPR
:
3947 case POSTINCREMENT_EXPR
:
3948 case POSTDECREMENT_EXPR
:
3949 case PREINCREMENT_EXPR
:
3950 case PREDECREMENT_EXPR
:
3956 case FIX_TRUNC_EXPR
:
3962 case ARRAY_RANGE_REF
:
3966 /* Special expressions. */
3972 case VEC_UNPACK_HI_EXPR
:
3973 case VEC_UNPACK_LO_EXPR
:
3974 case VEC_UNPACK_FLOAT_HI_EXPR
:
3975 case VEC_UNPACK_FLOAT_LO_EXPR
:
3976 case VEC_UNPACK_FIX_TRUNC_HI_EXPR
:
3977 case VEC_UNPACK_FIX_TRUNC_LO_EXPR
:
3978 case VEC_PACK_TRUNC_EXPR
:
3979 case VEC_PACK_SAT_EXPR
:
3983 /* Return an arbitrarily high precedence to avoid surrounding single
3984 VAR_DECLs in ()s. */
3989 /* Return the priority of the operator OP. */
3992 op_prio (const_tree op
)
3994 enum tree_code code
;
3999 code
= TREE_CODE (op
);
4000 if (code
== SAVE_EXPR
|| code
== NON_LVALUE_EXPR
)
4001 return op_prio (TREE_OPERAND (op
, 0));
4003 return op_code_prio (code
);
4006 /* Return the symbol associated with operator CODE. */
4009 op_symbol_code (enum tree_code code
)
4017 case TRUTH_ORIF_EXPR
:
4020 case TRUTH_AND_EXPR
:
4021 case TRUTH_ANDIF_EXPR
:
4027 case TRUTH_XOR_EXPR
:
4037 case UNORDERED_EXPR
:
4083 case WIDEN_LSHIFT_EXPR
:
4086 case POINTER_PLUS_EXPR
:
4092 case WIDEN_SUM_EXPR
:
4095 case WIDEN_MULT_EXPR
:
4098 case MULT_HIGHPART_EXPR
:
4103 case POINTER_DIFF_EXPR
:
4109 case TRUTH_NOT_EXPR
:
4116 case TRUNC_DIV_EXPR
:
4123 case FLOOR_DIV_EXPR
:
4126 case ROUND_DIV_EXPR
:
4129 case EXACT_DIV_EXPR
:
4132 case TRUNC_MOD_EXPR
:
4138 case FLOOR_MOD_EXPR
:
4141 case ROUND_MOD_EXPR
:
4144 case PREDECREMENT_EXPR
:
4147 case PREINCREMENT_EXPR
:
4150 case POSTDECREMENT_EXPR
:
4153 case POSTINCREMENT_EXPR
:
4163 return "<<< ??? >>>";
4167 /* Return the symbol associated with operator OP. */
4170 op_symbol (const_tree op
)
4172 return op_symbol_code (TREE_CODE (op
));
4175 /* Prints the name of a call. NODE is the CALL_EXPR_FN of a CALL_EXPR or
4176 the gimple_call_fn of a GIMPLE_CALL. */
4179 print_call_name (pretty_printer
*pp
, tree node
, dump_flags_t flags
)
4183 if (TREE_CODE (op0
) == NON_LVALUE_EXPR
)
4184 op0
= TREE_OPERAND (op0
, 0);
4187 switch (TREE_CODE (op0
))
4192 dump_function_name (pp
, op0
, flags
);
4198 op0
= TREE_OPERAND (op0
, 0);
4203 dump_generic_node (pp
, TREE_OPERAND (op0
, 0), 0, flags
, false);
4204 pp_string (pp
, ") ? ");
4205 dump_generic_node (pp
, TREE_OPERAND (op0
, 1), 0, flags
, false);
4206 pp_string (pp
, " : ");
4207 dump_generic_node (pp
, TREE_OPERAND (op0
, 2), 0, flags
, false);
4211 if (TREE_CODE (TREE_OPERAND (op0
, 0)) == VAR_DECL
)
4212 dump_function_name (pp
, TREE_OPERAND (op0
, 0), flags
);
4214 dump_generic_node (pp
, op0
, 0, flags
, false);
4218 if (integer_zerop (TREE_OPERAND (op0
, 1)))
4220 op0
= TREE_OPERAND (op0
, 0);
4227 dump_generic_node (pp
, op0
, 0, flags
, false);
4235 /* Print the first N characters in the array STR, replacing non-printable
4236 characters (including embedded nuls) with unambiguous escape sequences. */
4239 pretty_print_string (pretty_printer
*pp
, const char *str
, size_t n
)
4244 for ( ; n
; --n
, ++str
)
4249 pp_string (pp
, "\\b");
4253 pp_string (pp
, "\\f");
4257 pp_string (pp
, "\\n");
4261 pp_string (pp
, "\\r");
4265 pp_string (pp
, "\\t");
4269 pp_string (pp
, "\\v");
4273 pp_string (pp
, "\\\\");
4277 pp_string (pp
, "\\\"");
4281 pp_string (pp
, "\\'");
4285 if (str
[0] || n
> 1)
4287 if (!ISPRINT (str
[0]))
4290 sprintf (buf
, "\\x%02x", (unsigned char)str
[0]);
4291 pp_string (pp
, buf
);
4294 pp_character (pp
, str
[0]);
4302 maybe_init_pretty_print (FILE *file
)
4306 tree_pp
= new pretty_printer ();
4307 pp_needs_newline (tree_pp
) = true;
4308 pp_translate_identifiers (tree_pp
) = false;
4311 tree_pp
->buffer
->stream
= file
;
4315 newline_and_indent (pretty_printer
*pp
, int spc
)
4321 /* Handle the %K format for TEXT. Separate from default_tree_printer
4322 so it can also be used in front ends.
4323 The location LOC and BLOCK are expected to be extracted by the caller
4324 from the %K argument arg via EXPR_LOCATION(arg) and TREE_BLOCK(arg). */
4327 percent_K_format (text_info
*text
, location_t loc
, tree block
)
4329 text
->set_location (0, loc
, SHOW_RANGE_WITH_CARET
);
4330 gcc_assert (pp_ti_abstract_origin (text
) != NULL
);
4331 *pp_ti_abstract_origin (text
) = NULL
;
4334 && TREE_CODE (block
) == BLOCK
4335 && BLOCK_ABSTRACT_ORIGIN (block
))
4337 tree ao
= BLOCK_ABSTRACT_ORIGIN (block
);
4338 if (TREE_CODE (ao
) == FUNCTION_DECL
)
4340 *pp_ti_abstract_origin (text
) = block
;
4343 block
= BLOCK_SUPERCONTEXT (block
);
4347 /* Print the identifier ID to PRETTY-PRINTER. */
4350 pp_tree_identifier (pretty_printer
*pp
, tree id
)
4352 if (pp_translate_identifiers (pp
))
4354 const char *text
= identifier_to_locale (IDENTIFIER_POINTER (id
));
4355 pp_append_text (pp
, text
, text
+ strlen (text
));
4358 pp_append_text (pp
, IDENTIFIER_POINTER (id
),
4359 IDENTIFIER_POINTER (id
) + IDENTIFIER_LENGTH (id
));
4362 /* A helper function that is used to dump function information before the
4366 dump_function_header (FILE *dump_file
, tree fdecl
, dump_flags_t flags
)
4368 const char *dname
, *aname
;
4369 struct cgraph_node
*node
= cgraph_node::get (fdecl
);
4370 struct function
*fun
= DECL_STRUCT_FUNCTION (fdecl
);
4372 dname
= lang_hooks
.decl_printable_name (fdecl
, 1);
4374 if (DECL_ASSEMBLER_NAME_SET_P (fdecl
))
4375 aname
= (IDENTIFIER_POINTER
4376 (DECL_ASSEMBLER_NAME (fdecl
)));
4378 aname
= "<unset-asm-name>";
4380 fprintf (dump_file
, "\n;; Function %s (%s, funcdef_no=%d",
4381 dname
, aname
, fun
->funcdef_no
);
4382 if (!(flags
& TDF_NOUID
))
4383 fprintf (dump_file
, ", decl_uid=%d", DECL_UID (fdecl
));
4386 fprintf (dump_file
, ", cgraph_uid=%d", node
->get_uid ());
4387 fprintf (dump_file
, ", symbol_order=%d)%s\n\n", node
->order
,
4388 node
->frequency
== NODE_FREQUENCY_HOT
4390 : node
->frequency
== NODE_FREQUENCY_UNLIKELY_EXECUTED
4391 ? " (unlikely executed)"
4392 : node
->frequency
== NODE_FREQUENCY_EXECUTED_ONCE
4393 ? " (executed once)"
4397 fprintf (dump_file
, ")\n\n");
4400 /* Dump double_int D to pretty_printer PP. UNS is true
4401 if D is unsigned and false otherwise. */
4403 pp_double_int (pretty_printer
*pp
, double_int d
, bool uns
)
4406 pp_wide_integer (pp
, d
.low
);
4407 else if (d
.fits_uhwi ())
4408 pp_unsigned_wide_integer (pp
, d
.low
);
4411 unsigned HOST_WIDE_INT low
= d
.low
;
4412 HOST_WIDE_INT high
= d
.high
;
4413 if (!uns
&& d
.is_negative ())
4416 high
= ~high
+ !low
;
4419 /* Would "%x%0*x" or "%x%*0x" get zero-padding on all
4421 sprintf (pp_buffer (pp
)->digit_buffer
,
4422 HOST_WIDE_INT_PRINT_DOUBLE_HEX
,
4423 (unsigned HOST_WIDE_INT
) high
, low
);
4424 pp_string (pp
, pp_buffer (pp
)->digit_buffer
);
4429 # pragma GCC diagnostic pop