1 /* Pretty formatting of GENERIC trees in C syntax.
2 Copyright (C) 2001-2020 Free Software Foundation, Inc.
3 Adapted from c-pretty-print.c by Diego Novillo <dnovillo@redhat.com>
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 3, or (at your option) any later
12 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING3. If not see
19 <http://www.gnu.org/licenses/>. */
23 #include "coretypes.h"
29 #include "tree-pretty-print.h"
30 #include "stor-layout.h"
31 #include "langhooks.h"
32 #include "tree-iterator.h"
34 #include "internal-fn.h"
35 #include "gomp-constants.h"
37 #include "fold-const.h"
39 /* Disable warnings about quoting issues in the pp_xxx calls below
40 that (intentionally) don't follow GCC diagnostic conventions. */
42 # pragma GCC diagnostic push
43 # pragma GCC diagnostic ignored "-Wformat-diag"
46 /* Local functions, macros and variables. */
47 static const char *op_symbol (const_tree
);
48 static void newline_and_indent (pretty_printer
*, int);
49 static void maybe_init_pretty_print (FILE *);
50 static void print_struct_decl (pretty_printer
*, const_tree
, int, dump_flags_t
);
51 static void do_niy (pretty_printer
*, const_tree
, dump_flags_t
);
53 #define INDENT(SPACE) do { \
54 int i; for (i = 0; i<SPACE; i++) pp_space (pp); } while (0)
56 #define NIY do_niy (pp, node, flags)
58 static pretty_printer
*tree_pp
;
60 /* Try to print something for an unknown tree code. */
63 do_niy (pretty_printer
*pp
, const_tree node
, dump_flags_t flags
)
67 pp_string (pp
, "<<< Unknown tree: ");
68 pp_string (pp
, get_tree_code_name (TREE_CODE (node
)));
72 len
= TREE_OPERAND_LENGTH (node
);
73 for (i
= 0; i
< len
; ++i
)
75 newline_and_indent (pp
, 2);
76 dump_generic_node (pp
, TREE_OPERAND (node
, i
), 2, flags
, false);
80 pp_string (pp
, " >>>");
83 /* Debugging function to print out a generic expression. */
86 debug_generic_expr (tree t
)
88 print_generic_expr (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
);
89 fprintf (stderr
, "\n");
92 /* Debugging function to print out a generic statement. */
95 debug_generic_stmt (tree t
)
97 print_generic_stmt (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
);
98 fprintf (stderr
, "\n");
101 /* Debugging function to print out a chain of trees . */
104 debug_tree_chain (tree t
)
110 print_generic_expr (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
|TDF_UID
);
111 fprintf (stderr
, " ");
115 fprintf (stderr
, "... [cycled back to ");
116 print_generic_expr (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
|TDF_UID
);
117 fprintf (stderr
, "]");
121 fprintf (stderr
, "\n");
124 /* Prints declaration DECL to the FILE with details specified by FLAGS. */
126 print_generic_decl (FILE *file
, tree decl
, dump_flags_t flags
)
128 maybe_init_pretty_print (file
);
129 print_declaration (tree_pp
, decl
, 2, flags
);
130 pp_write_text_to_stream (tree_pp
);
133 /* Print tree T, and its successors, on file FILE. FLAGS specifies details
134 to show in the dump. See TDF_* in dumpfile.h. */
137 print_generic_stmt (FILE *file
, tree t
, dump_flags_t flags
)
139 maybe_init_pretty_print (file
);
140 dump_generic_node (tree_pp
, t
, 0, flags
, true);
141 pp_newline_and_flush (tree_pp
);
144 /* Print tree T, and its successors, on file FILE. FLAGS specifies details
145 to show in the dump. See TDF_* in dumpfile.h. The output is indented by
149 print_generic_stmt_indented (FILE *file
, tree t
, dump_flags_t flags
, int indent
)
153 maybe_init_pretty_print (file
);
155 for (i
= 0; i
< indent
; i
++)
157 dump_generic_node (tree_pp
, t
, indent
, flags
, true);
158 pp_newline_and_flush (tree_pp
);
161 /* Print a single expression T on file FILE. FLAGS specifies details to show
162 in the dump. See TDF_* in dumpfile.h. */
165 print_generic_expr (FILE *file
, tree t
, dump_flags_t flags
)
167 maybe_init_pretty_print (file
);
168 dump_generic_node (tree_pp
, t
, 0, flags
, false);
172 /* Print a single expression T to string, and return it. */
175 print_generic_expr_to_str (tree t
)
178 dump_generic_node (&pp
, t
, 0, TDF_VOPS
|TDF_MEMSYMS
, false);
179 return xstrdup (pp_formatted_text (&pp
));
182 /* Dump NAME, an IDENTIFIER_POINTER, sanitized so that D<num> sequences
183 in it are replaced with Dxxxx, as long as they are at the start or
184 preceded by $ and at the end or followed by $. See make_fancy_name
188 dump_fancy_name (pretty_printer
*pp
, tree name
)
191 int length
= IDENTIFIER_LENGTH (name
);
192 const char *n
= IDENTIFIER_POINTER (name
);
199 && (n
== IDENTIFIER_POINTER (name
) || n
[-1] == '$'))
202 while (ISDIGIT (n
[l
]))
204 if (n
[l
] == '\0' || n
[l
] == '$')
217 pp_tree_identifier (pp
, name
);
221 char *str
= XNEWVEC (char, length
+ 1);
224 q
= n
= IDENTIFIER_POINTER (name
);
231 && (q
== IDENTIFIER_POINTER (name
) || q
[-1] == '$'))
234 while (ISDIGIT (q
[l
]))
236 if (q
[l
] == '\0' || q
[l
] == '$')
238 memcpy (p
, n
, q
- n
);
239 memcpy (p
+ (q
- n
), "Dxxxx", 5);
249 memcpy (p
, n
, IDENTIFIER_LENGTH (name
) - (n
- IDENTIFIER_POINTER (name
)));
251 if (pp_translate_identifiers (pp
))
253 const char *text
= identifier_to_locale (str
);
254 pp_append_text (pp
, text
, text
+ strlen (text
));
257 pp_append_text (pp
, str
, str
+ length
);
261 /* Dump the name of a _DECL node and its DECL_UID if TDF_UID is set
265 dump_decl_name (pretty_printer
*pp
, tree node
, dump_flags_t flags
)
267 tree name
= DECL_NAME (node
);
270 if ((flags
& TDF_ASMNAME
)
271 && HAS_DECL_ASSEMBLER_NAME_P (node
)
272 && DECL_ASSEMBLER_NAME_SET_P (node
))
273 pp_tree_identifier (pp
, DECL_ASSEMBLER_NAME_RAW (node
));
274 /* For -fcompare-debug don't dump DECL_NAMELESS names at all,
275 -g might have created more fancy names and their indexes
276 could get out of sync. Usually those should be DECL_IGNORED_P
277 too, SRA can create even non-DECL_IGNORED_P DECL_NAMELESS fancy
278 names, let's hope those never get out of sync after doing the
279 dump_fancy_name sanitization. */
280 else if ((flags
& TDF_COMPARE_DEBUG
)
281 && DECL_NAMELESS (node
)
282 && DECL_IGNORED_P (node
))
284 /* For DECL_NAMELESS names look for embedded uids in the
285 names and sanitize them for TDF_NOUID. */
286 else if ((flags
& TDF_NOUID
) && DECL_NAMELESS (node
))
287 dump_fancy_name (pp
, name
);
289 pp_tree_identifier (pp
, name
);
291 char uid_sep
= (flags
& TDF_GIMPLE
) ? '_' : '.';
292 if ((flags
& TDF_UID
) || name
== NULL_TREE
)
294 if (TREE_CODE (node
) == LABEL_DECL
&& LABEL_DECL_UID (node
) != -1)
295 pp_printf (pp
, "L%c%d", uid_sep
, (int) LABEL_DECL_UID (node
));
296 else if (TREE_CODE (node
) == DEBUG_EXPR_DECL
)
298 if (flags
& TDF_NOUID
)
299 pp_string (pp
, "D#xxxx");
301 pp_printf (pp
, "D#%i", DEBUG_TEMP_UID (node
));
305 char c
= TREE_CODE (node
) == CONST_DECL
? 'C' : 'D';
306 if (flags
& TDF_NOUID
)
307 pp_printf (pp
, "%c.xxxx", c
);
309 pp_printf (pp
, "%c%c%u", c
, uid_sep
, DECL_UID (node
));
312 if ((flags
& TDF_ALIAS
) && DECL_PT_UID (node
) != DECL_UID (node
))
314 if (flags
& TDF_NOUID
)
315 pp_printf (pp
, "ptD.xxxx");
317 pp_printf (pp
, "ptD.%u", DECL_PT_UID (node
));
321 /* Like the above, but used for pretty printing function calls. */
324 dump_function_name (pretty_printer
*pp
, tree node
, dump_flags_t flags
)
326 if (CONVERT_EXPR_P (node
))
327 node
= TREE_OPERAND (node
, 0);
328 if (DECL_NAME (node
) && (flags
& TDF_ASMNAME
) == 0)
329 pp_string (pp
, lang_hooks
.decl_printable_name (node
, 1));
331 dump_decl_name (pp
, node
, flags
);
334 /* Dump a function declaration. NODE is the FUNCTION_TYPE. PP, SPC and
335 FLAGS are as in dump_generic_node. */
338 dump_function_declaration (pretty_printer
*pp
, tree node
,
339 int spc
, dump_flags_t flags
)
341 bool wrote_arg
= false;
347 /* Print the argument types. */
348 arg
= TYPE_ARG_TYPES (node
);
349 while (arg
&& arg
!= void_list_node
&& arg
!= error_mark_node
)
357 dump_generic_node (pp
, TREE_VALUE (arg
), spc
, flags
, false);
358 arg
= TREE_CHAIN (arg
);
361 /* Drop the trailing void_type_node if we had any previous argument. */
362 if (arg
== void_list_node
&& !wrote_arg
)
363 pp_string (pp
, "void");
364 /* Properly dump vararg function types. */
365 else if (!arg
&& wrote_arg
)
366 pp_string (pp
, ", ...");
367 /* Avoid printing any arg for unprototyped functions. */
372 /* Dump the domain associated with an array. */
375 dump_array_domain (pretty_printer
*pp
, tree domain
, int spc
, dump_flags_t flags
)
377 pp_left_bracket (pp
);
380 tree min
= TYPE_MIN_VALUE (domain
);
381 tree max
= TYPE_MAX_VALUE (domain
);
384 && integer_zerop (min
)
385 && tree_fits_shwi_p (max
))
386 pp_wide_integer (pp
, tree_to_shwi (max
) + 1);
390 dump_generic_node (pp
, min
, spc
, flags
, false);
393 dump_generic_node (pp
, max
, spc
, flags
, false);
397 pp_string (pp
, "<unknown>");
398 pp_right_bracket (pp
);
402 /* Dump OpenMP iterators ITER. */
405 dump_omp_iterators (pretty_printer
*pp
, tree iter
, int spc
, dump_flags_t flags
)
407 pp_string (pp
, "iterator(");
408 for (tree it
= iter
; it
; it
= TREE_CHAIN (it
))
411 pp_string (pp
, ", ");
412 dump_generic_node (pp
, TREE_TYPE (TREE_VEC_ELT (it
, 0)), spc
, flags
,
415 dump_generic_node (pp
, TREE_VEC_ELT (it
, 0), spc
, flags
, false);
417 dump_generic_node (pp
, TREE_VEC_ELT (it
, 1), spc
, flags
, false);
419 dump_generic_node (pp
, TREE_VEC_ELT (it
, 2), spc
, flags
, false);
421 dump_generic_node (pp
, TREE_VEC_ELT (it
, 3), spc
, flags
, false);
427 /* Dump OpenMP clause CLAUSE. PP, CLAUSE, SPC and FLAGS are as in
428 dump_generic_node. */
431 dump_omp_clause (pretty_printer
*pp
, tree clause
, int spc
, dump_flags_t flags
)
434 const char *modifier
= NULL
;
435 switch (OMP_CLAUSE_CODE (clause
))
437 case OMP_CLAUSE_PRIVATE
:
440 case OMP_CLAUSE_SHARED
:
443 case OMP_CLAUSE_FIRSTPRIVATE
:
444 name
= "firstprivate";
446 case OMP_CLAUSE_LASTPRIVATE
:
447 name
= "lastprivate";
448 if (OMP_CLAUSE_LASTPRIVATE_CONDITIONAL (clause
))
449 modifier
= "conditional:";
451 case OMP_CLAUSE_COPYIN
:
454 case OMP_CLAUSE_COPYPRIVATE
:
455 name
= "copyprivate";
457 case OMP_CLAUSE_UNIFORM
:
460 case OMP_CLAUSE_USE_DEVICE_PTR
:
461 name
= "use_device_ptr";
462 if (OMP_CLAUSE_USE_DEVICE_PTR_IF_PRESENT (clause
))
463 modifier
= "if_present:";
465 case OMP_CLAUSE_USE_DEVICE_ADDR
:
466 name
= "use_device_addr";
468 case OMP_CLAUSE_IS_DEVICE_PTR
:
469 name
= "is_device_ptr";
471 case OMP_CLAUSE_INCLUSIVE
:
474 case OMP_CLAUSE_EXCLUSIVE
:
477 case OMP_CLAUSE__LOOPTEMP_
:
480 case OMP_CLAUSE__REDUCTEMP_
:
481 name
= "_reductemp_";
483 case OMP_CLAUSE__CONDTEMP_
:
486 case OMP_CLAUSE__SCANTEMP_
:
489 case OMP_CLAUSE_TO_DECLARE
:
492 case OMP_CLAUSE_LINK
:
495 case OMP_CLAUSE_NONTEMPORAL
:
496 name
= "nontemporal";
499 pp_string (pp
, name
);
502 pp_string (pp
, modifier
);
503 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
508 case OMP_CLAUSE_TASK_REDUCTION
:
509 case OMP_CLAUSE_IN_REDUCTION
:
510 pp_string (pp
, OMP_CLAUSE_CODE (clause
) == OMP_CLAUSE_IN_REDUCTION
513 case OMP_CLAUSE_REDUCTION
:
514 pp_string (pp
, "reduction(");
515 if (OMP_CLAUSE_CODE (clause
) == OMP_CLAUSE_REDUCTION
)
517 if (OMP_CLAUSE_REDUCTION_TASK (clause
))
518 pp_string (pp
, "task,");
519 else if (OMP_CLAUSE_REDUCTION_INSCAN (clause
))
520 pp_string (pp
, "inscan,");
522 if (OMP_CLAUSE_REDUCTION_CODE (clause
) != ERROR_MARK
)
525 op_symbol_code (OMP_CLAUSE_REDUCTION_CODE (clause
)));
528 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
534 pp_string (pp
, "if(");
535 switch (OMP_CLAUSE_IF_MODIFIER (clause
))
537 case ERROR_MARK
: break;
538 case VOID_CST
: pp_string (pp
, "cancel:"); break;
539 case OMP_PARALLEL
: pp_string (pp
, "parallel:"); break;
540 case OMP_SIMD
: pp_string (pp
, "simd:"); break;
541 case OMP_TASK
: pp_string (pp
, "task:"); break;
542 case OMP_TASKLOOP
: pp_string (pp
, "taskloop:"); break;
543 case OMP_TARGET_DATA
: pp_string (pp
, "target data:"); break;
544 case OMP_TARGET
: pp_string (pp
, "target:"); break;
545 case OMP_TARGET_UPDATE
: pp_string (pp
, "target update:"); break;
546 case OMP_TARGET_ENTER_DATA
:
547 pp_string (pp
, "target enter data:"); break;
548 case OMP_TARGET_EXIT_DATA
: pp_string (pp
, "target exit data:"); break;
549 default: gcc_unreachable ();
551 dump_generic_node (pp
, OMP_CLAUSE_IF_EXPR (clause
),
556 case OMP_CLAUSE_NUM_THREADS
:
557 pp_string (pp
, "num_threads(");
558 dump_generic_node (pp
, OMP_CLAUSE_NUM_THREADS_EXPR (clause
),
563 case OMP_CLAUSE_NOWAIT
:
564 pp_string (pp
, "nowait");
566 case OMP_CLAUSE_ORDERED
:
567 pp_string (pp
, "ordered");
568 if (OMP_CLAUSE_ORDERED_EXPR (clause
))
571 dump_generic_node (pp
, OMP_CLAUSE_ORDERED_EXPR (clause
),
577 case OMP_CLAUSE_DEFAULT
:
578 pp_string (pp
, "default(");
579 switch (OMP_CLAUSE_DEFAULT_KIND (clause
))
581 case OMP_CLAUSE_DEFAULT_UNSPECIFIED
:
583 case OMP_CLAUSE_DEFAULT_SHARED
:
584 pp_string (pp
, "shared");
586 case OMP_CLAUSE_DEFAULT_NONE
:
587 pp_string (pp
, "none");
589 case OMP_CLAUSE_DEFAULT_PRIVATE
:
590 pp_string (pp
, "private");
592 case OMP_CLAUSE_DEFAULT_FIRSTPRIVATE
:
593 pp_string (pp
, "firstprivate");
595 case OMP_CLAUSE_DEFAULT_PRESENT
:
596 pp_string (pp
, "present");
604 case OMP_CLAUSE_SCHEDULE
:
605 pp_string (pp
, "schedule(");
606 if (OMP_CLAUSE_SCHEDULE_KIND (clause
)
607 & (OMP_CLAUSE_SCHEDULE_MONOTONIC
608 | OMP_CLAUSE_SCHEDULE_NONMONOTONIC
))
610 if (OMP_CLAUSE_SCHEDULE_KIND (clause
)
611 & OMP_CLAUSE_SCHEDULE_MONOTONIC
)
612 pp_string (pp
, "monotonic");
614 pp_string (pp
, "nonmonotonic");
615 if (OMP_CLAUSE_SCHEDULE_SIMD (clause
))
620 if (OMP_CLAUSE_SCHEDULE_SIMD (clause
))
621 pp_string (pp
, "simd:");
623 switch (OMP_CLAUSE_SCHEDULE_KIND (clause
) & OMP_CLAUSE_SCHEDULE_MASK
)
625 case OMP_CLAUSE_SCHEDULE_STATIC
:
626 pp_string (pp
, "static");
628 case OMP_CLAUSE_SCHEDULE_DYNAMIC
:
629 pp_string (pp
, "dynamic");
631 case OMP_CLAUSE_SCHEDULE_GUIDED
:
632 pp_string (pp
, "guided");
634 case OMP_CLAUSE_SCHEDULE_RUNTIME
:
635 pp_string (pp
, "runtime");
637 case OMP_CLAUSE_SCHEDULE_AUTO
:
638 pp_string (pp
, "auto");
643 if (OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (clause
))
646 dump_generic_node (pp
, OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (clause
),
652 case OMP_CLAUSE_UNTIED
:
653 pp_string (pp
, "untied");
656 case OMP_CLAUSE_COLLAPSE
:
657 pp_string (pp
, "collapse(");
658 dump_generic_node (pp
, OMP_CLAUSE_COLLAPSE_EXPR (clause
),
663 case OMP_CLAUSE_FINAL
:
664 pp_string (pp
, "final(");
665 dump_generic_node (pp
, OMP_CLAUSE_FINAL_EXPR (clause
),
670 case OMP_CLAUSE_MERGEABLE
:
671 pp_string (pp
, "mergeable");
674 case OMP_CLAUSE_LINEAR
:
675 pp_string (pp
, "linear(");
676 switch (OMP_CLAUSE_LINEAR_KIND (clause
))
678 case OMP_CLAUSE_LINEAR_DEFAULT
:
680 case OMP_CLAUSE_LINEAR_REF
:
681 pp_string (pp
, "ref(");
683 case OMP_CLAUSE_LINEAR_VAL
:
684 pp_string (pp
, "val(");
686 case OMP_CLAUSE_LINEAR_UVAL
:
687 pp_string (pp
, "uval(");
692 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
694 if (OMP_CLAUSE_LINEAR_KIND (clause
) != OMP_CLAUSE_LINEAR_DEFAULT
)
697 dump_generic_node (pp
, OMP_CLAUSE_LINEAR_STEP (clause
),
702 case OMP_CLAUSE_ALIGNED
:
703 pp_string (pp
, "aligned(");
704 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
706 if (OMP_CLAUSE_ALIGNED_ALIGNMENT (clause
))
709 dump_generic_node (pp
, OMP_CLAUSE_ALIGNED_ALIGNMENT (clause
),
715 case OMP_CLAUSE_DEPEND
:
716 pp_string (pp
, "depend(");
717 switch (OMP_CLAUSE_DEPEND_KIND (clause
))
719 case OMP_CLAUSE_DEPEND_DEPOBJ
:
722 case OMP_CLAUSE_DEPEND_IN
:
725 case OMP_CLAUSE_DEPEND_OUT
:
728 case OMP_CLAUSE_DEPEND_INOUT
:
731 case OMP_CLAUSE_DEPEND_MUTEXINOUTSET
:
732 name
= "mutexinoutset";
734 case OMP_CLAUSE_DEPEND_SOURCE
:
735 pp_string (pp
, "source)");
737 case OMP_CLAUSE_DEPEND_LAST
:
738 name
= "__internal__";
740 case OMP_CLAUSE_DEPEND_SINK
:
741 pp_string (pp
, "sink:");
742 for (tree t
= OMP_CLAUSE_DECL (clause
); t
; t
= TREE_CHAIN (t
))
743 if (TREE_CODE (t
) == TREE_LIST
)
745 dump_generic_node (pp
, TREE_VALUE (t
), spc
, flags
, false);
746 if (TREE_PURPOSE (t
) != integer_zero_node
)
748 if (OMP_CLAUSE_DEPEND_SINK_NEGATIVE (t
))
752 dump_generic_node (pp
, TREE_PURPOSE (t
), spc
, flags
,
766 tree t
= OMP_CLAUSE_DECL (clause
);
767 if (TREE_CODE (t
) == TREE_LIST
769 && TREE_CODE (TREE_PURPOSE (t
)) == TREE_VEC
)
771 dump_omp_iterators (pp
, TREE_PURPOSE (t
), spc
, flags
);
775 pp_string (pp
, name
);
777 dump_generic_node (pp
, t
, spc
, flags
, false);
783 pp_string (pp
, "map(");
784 switch (OMP_CLAUSE_MAP_KIND (clause
))
787 case GOMP_MAP_POINTER
:
788 pp_string (pp
, "alloc");
790 case GOMP_MAP_IF_PRESENT
:
791 pp_string (pp
, "no_alloc");
794 case GOMP_MAP_TO_PSET
:
795 pp_string (pp
, "to");
798 pp_string (pp
, "from");
800 case GOMP_MAP_TOFROM
:
801 pp_string (pp
, "tofrom");
803 case GOMP_MAP_FORCE_ALLOC
:
804 pp_string (pp
, "force_alloc");
806 case GOMP_MAP_FORCE_TO
:
807 pp_string (pp
, "force_to");
809 case GOMP_MAP_FORCE_FROM
:
810 pp_string (pp
, "force_from");
812 case GOMP_MAP_FORCE_TOFROM
:
813 pp_string (pp
, "force_tofrom");
815 case GOMP_MAP_FORCE_PRESENT
:
816 pp_string (pp
, "force_present");
818 case GOMP_MAP_DELETE
:
819 pp_string (pp
, "delete");
821 case GOMP_MAP_FORCE_DEVICEPTR
:
822 pp_string (pp
, "force_deviceptr");
824 case GOMP_MAP_ALWAYS_TO
:
825 pp_string (pp
, "always,to");
827 case GOMP_MAP_ALWAYS_FROM
:
828 pp_string (pp
, "always,from");
830 case GOMP_MAP_ALWAYS_TOFROM
:
831 pp_string (pp
, "always,tofrom");
833 case GOMP_MAP_RELEASE
:
834 pp_string (pp
, "release");
836 case GOMP_MAP_FIRSTPRIVATE_POINTER
:
837 pp_string (pp
, "firstprivate");
839 case GOMP_MAP_FIRSTPRIVATE_REFERENCE
:
840 pp_string (pp
, "firstprivate ref");
842 case GOMP_MAP_STRUCT
:
843 pp_string (pp
, "struct");
845 case GOMP_MAP_ALWAYS_POINTER
:
846 pp_string (pp
, "always_pointer");
848 case GOMP_MAP_DEVICE_RESIDENT
:
849 pp_string (pp
, "device_resident");
852 pp_string (pp
, "link");
854 case GOMP_MAP_ATTACH
:
855 pp_string (pp
, "attach");
857 case GOMP_MAP_DETACH
:
858 pp_string (pp
, "detach");
860 case GOMP_MAP_FORCE_DETACH
:
861 pp_string (pp
, "force_detach");
863 case GOMP_MAP_ATTACH_DETACH
:
864 pp_string (pp
, "attach_detach");
870 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
873 if (OMP_CLAUSE_SIZE (clause
))
875 switch (OMP_CLAUSE_CODE (clause
) == OMP_CLAUSE_MAP
876 ? OMP_CLAUSE_MAP_KIND (clause
) : GOMP_MAP_TO
)
878 case GOMP_MAP_POINTER
:
879 case GOMP_MAP_FIRSTPRIVATE_POINTER
:
880 case GOMP_MAP_FIRSTPRIVATE_REFERENCE
:
881 case GOMP_MAP_ALWAYS_POINTER
:
882 pp_string (pp
, " [pointer assign, bias: ");
884 case GOMP_MAP_TO_PSET
:
885 pp_string (pp
, " [pointer set, len: ");
887 case GOMP_MAP_ATTACH
:
888 case GOMP_MAP_DETACH
:
889 case GOMP_MAP_FORCE_DETACH
:
890 case GOMP_MAP_ATTACH_DETACH
:
891 pp_string (pp
, " [bias: ");
894 pp_string (pp
, " [len: ");
897 dump_generic_node (pp
, OMP_CLAUSE_SIZE (clause
),
899 pp_right_bracket (pp
);
904 case OMP_CLAUSE_FROM
:
905 pp_string (pp
, "from(");
906 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
908 goto print_clause_size
;
911 pp_string (pp
, "to(");
912 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
914 goto print_clause_size
;
916 case OMP_CLAUSE__CACHE_
:
918 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
920 goto print_clause_size
;
922 case OMP_CLAUSE_NUM_TEAMS
:
923 pp_string (pp
, "num_teams(");
924 dump_generic_node (pp
, OMP_CLAUSE_NUM_TEAMS_EXPR (clause
),
929 case OMP_CLAUSE_THREAD_LIMIT
:
930 pp_string (pp
, "thread_limit(");
931 dump_generic_node (pp
, OMP_CLAUSE_THREAD_LIMIT_EXPR (clause
),
936 case OMP_CLAUSE_DEVICE
:
937 pp_string (pp
, "device(");
938 dump_generic_node (pp
, OMP_CLAUSE_DEVICE_ID (clause
),
943 case OMP_CLAUSE_DIST_SCHEDULE
:
944 pp_string (pp
, "dist_schedule(static");
945 if (OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR (clause
))
948 dump_generic_node (pp
,
949 OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR (clause
),
955 case OMP_CLAUSE_PROC_BIND
:
956 pp_string (pp
, "proc_bind(");
957 switch (OMP_CLAUSE_PROC_BIND_KIND (clause
))
959 case OMP_CLAUSE_PROC_BIND_MASTER
:
960 pp_string (pp
, "master");
962 case OMP_CLAUSE_PROC_BIND_CLOSE
:
963 pp_string (pp
, "close");
965 case OMP_CLAUSE_PROC_BIND_SPREAD
:
966 pp_string (pp
, "spread");
974 case OMP_CLAUSE_DEVICE_TYPE
:
975 pp_string (pp
, "device_type(");
976 switch (OMP_CLAUSE_DEVICE_TYPE_KIND (clause
))
978 case OMP_CLAUSE_DEVICE_TYPE_HOST
:
979 pp_string (pp
, "host");
981 case OMP_CLAUSE_DEVICE_TYPE_NOHOST
:
982 pp_string (pp
, "nohost");
984 case OMP_CLAUSE_DEVICE_TYPE_ANY
:
985 pp_string (pp
, "any");
993 case OMP_CLAUSE_SAFELEN
:
994 pp_string (pp
, "safelen(");
995 dump_generic_node (pp
, OMP_CLAUSE_SAFELEN_EXPR (clause
),
1000 case OMP_CLAUSE_SIMDLEN
:
1001 pp_string (pp
, "simdlen(");
1002 dump_generic_node (pp
, OMP_CLAUSE_SIMDLEN_EXPR (clause
),
1004 pp_right_paren (pp
);
1007 case OMP_CLAUSE_PRIORITY
:
1008 pp_string (pp
, "priority(");
1009 dump_generic_node (pp
, OMP_CLAUSE_PRIORITY_EXPR (clause
),
1011 pp_right_paren (pp
);
1014 case OMP_CLAUSE_GRAINSIZE
:
1015 pp_string (pp
, "grainsize(");
1016 dump_generic_node (pp
, OMP_CLAUSE_GRAINSIZE_EXPR (clause
),
1018 pp_right_paren (pp
);
1021 case OMP_CLAUSE_NUM_TASKS
:
1022 pp_string (pp
, "num_tasks(");
1023 dump_generic_node (pp
, OMP_CLAUSE_NUM_TASKS_EXPR (clause
),
1025 pp_right_paren (pp
);
1028 case OMP_CLAUSE_HINT
:
1029 pp_string (pp
, "hint(");
1030 dump_generic_node (pp
, OMP_CLAUSE_HINT_EXPR (clause
),
1032 pp_right_paren (pp
);
1035 case OMP_CLAUSE_DEFAULTMAP
:
1036 pp_string (pp
, "defaultmap(");
1037 switch (OMP_CLAUSE_DEFAULTMAP_BEHAVIOR (clause
))
1039 case OMP_CLAUSE_DEFAULTMAP_ALLOC
:
1040 pp_string (pp
, "alloc");
1042 case OMP_CLAUSE_DEFAULTMAP_TO
:
1043 pp_string (pp
, "to");
1045 case OMP_CLAUSE_DEFAULTMAP_FROM
:
1046 pp_string (pp
, "from");
1048 case OMP_CLAUSE_DEFAULTMAP_TOFROM
:
1049 pp_string (pp
, "tofrom");
1051 case OMP_CLAUSE_DEFAULTMAP_FIRSTPRIVATE
:
1052 pp_string (pp
, "firstprivate");
1054 case OMP_CLAUSE_DEFAULTMAP_NONE
:
1055 pp_string (pp
, "none");
1057 case OMP_CLAUSE_DEFAULTMAP_DEFAULT
:
1058 pp_string (pp
, "default");
1063 switch (OMP_CLAUSE_DEFAULTMAP_CATEGORY (clause
))
1065 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_UNSPECIFIED
:
1067 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_SCALAR
:
1068 pp_string (pp
, ":scalar");
1070 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_AGGREGATE
:
1071 pp_string (pp
, ":aggregate");
1073 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_ALLOCATABLE
:
1074 pp_string (pp
, ":allocatable");
1076 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_POINTER
:
1077 pp_string (pp
, ":pointer");
1082 pp_right_paren (pp
);
1085 case OMP_CLAUSE_ORDER
:
1086 pp_string (pp
, "order(concurrent)");
1089 case OMP_CLAUSE_BIND
:
1090 pp_string (pp
, "bind(");
1091 switch (OMP_CLAUSE_BIND_KIND (clause
))
1093 case OMP_CLAUSE_BIND_TEAMS
:
1094 pp_string (pp
, "teams");
1096 case OMP_CLAUSE_BIND_PARALLEL
:
1097 pp_string (pp
, "parallel");
1099 case OMP_CLAUSE_BIND_THREAD
:
1100 pp_string (pp
, "thread");
1105 pp_right_paren (pp
);
1108 case OMP_CLAUSE__SIMDUID_
:
1109 pp_string (pp
, "_simduid_(");
1110 dump_generic_node (pp
, OMP_CLAUSE__SIMDUID__DECL (clause
),
1112 pp_right_paren (pp
);
1115 case OMP_CLAUSE__SIMT_
:
1116 pp_string (pp
, "_simt_");
1119 case OMP_CLAUSE_GANG
:
1120 pp_string (pp
, "gang");
1121 if (OMP_CLAUSE_GANG_EXPR (clause
) != NULL_TREE
)
1123 pp_string (pp
, "(num: ");
1124 dump_generic_node (pp
, OMP_CLAUSE_GANG_EXPR (clause
),
1127 if (OMP_CLAUSE_GANG_STATIC_EXPR (clause
) != NULL_TREE
)
1129 if (OMP_CLAUSE_GANG_EXPR (clause
) == NULL_TREE
)
1133 pp_string (pp
, "static:");
1134 if (OMP_CLAUSE_GANG_STATIC_EXPR (clause
)
1135 == integer_minus_one_node
)
1136 pp_character (pp
, '*');
1138 dump_generic_node (pp
, OMP_CLAUSE_GANG_STATIC_EXPR (clause
),
1141 if (OMP_CLAUSE_GANG_EXPR (clause
) != NULL_TREE
1142 || OMP_CLAUSE_GANG_STATIC_EXPR (clause
) != NULL_TREE
)
1143 pp_right_paren (pp
);
1146 case OMP_CLAUSE_ASYNC
:
1147 pp_string (pp
, "async");
1148 if (OMP_CLAUSE_ASYNC_EXPR (clause
))
1150 pp_character(pp
, '(');
1151 dump_generic_node (pp
, OMP_CLAUSE_ASYNC_EXPR (clause
),
1153 pp_character(pp
, ')');
1157 case OMP_CLAUSE_AUTO
:
1158 case OMP_CLAUSE_SEQ
:
1159 pp_string (pp
, omp_clause_code_name
[OMP_CLAUSE_CODE (clause
)]);
1162 case OMP_CLAUSE_WAIT
:
1163 pp_string (pp
, "wait(");
1164 dump_generic_node (pp
, OMP_CLAUSE_WAIT_EXPR (clause
),
1166 pp_character(pp
, ')');
1169 case OMP_CLAUSE_WORKER
:
1170 pp_string (pp
, "worker");
1171 if (OMP_CLAUSE_WORKER_EXPR (clause
) != NULL_TREE
)
1174 dump_generic_node (pp
, OMP_CLAUSE_WORKER_EXPR (clause
),
1176 pp_right_paren (pp
);
1180 case OMP_CLAUSE_VECTOR
:
1181 pp_string (pp
, "vector");
1182 if (OMP_CLAUSE_VECTOR_EXPR (clause
) != NULL_TREE
)
1185 dump_generic_node (pp
, OMP_CLAUSE_VECTOR_EXPR (clause
),
1187 pp_right_paren (pp
);
1191 case OMP_CLAUSE_NUM_GANGS
:
1192 pp_string (pp
, "num_gangs(");
1193 dump_generic_node (pp
, OMP_CLAUSE_NUM_GANGS_EXPR (clause
),
1195 pp_character (pp
, ')');
1198 case OMP_CLAUSE_NUM_WORKERS
:
1199 pp_string (pp
, "num_workers(");
1200 dump_generic_node (pp
, OMP_CLAUSE_NUM_WORKERS_EXPR (clause
),
1202 pp_character (pp
, ')');
1205 case OMP_CLAUSE_VECTOR_LENGTH
:
1206 pp_string (pp
, "vector_length(");
1207 dump_generic_node (pp
, OMP_CLAUSE_VECTOR_LENGTH_EXPR (clause
),
1209 pp_character (pp
, ')');
1212 case OMP_CLAUSE_INBRANCH
:
1213 pp_string (pp
, "inbranch");
1215 case OMP_CLAUSE_NOTINBRANCH
:
1216 pp_string (pp
, "notinbranch");
1218 case OMP_CLAUSE_FOR
:
1219 pp_string (pp
, "for");
1221 case OMP_CLAUSE_PARALLEL
:
1222 pp_string (pp
, "parallel");
1224 case OMP_CLAUSE_SECTIONS
:
1225 pp_string (pp
, "sections");
1227 case OMP_CLAUSE_TASKGROUP
:
1228 pp_string (pp
, "taskgroup");
1230 case OMP_CLAUSE_NOGROUP
:
1231 pp_string (pp
, "nogroup");
1233 case OMP_CLAUSE_THREADS
:
1234 pp_string (pp
, "threads");
1236 case OMP_CLAUSE_SIMD
:
1237 pp_string (pp
, "simd");
1239 case OMP_CLAUSE_INDEPENDENT
:
1240 pp_string (pp
, "independent");
1242 case OMP_CLAUSE_TILE
:
1243 pp_string (pp
, "tile(");
1244 dump_generic_node (pp
, OMP_CLAUSE_TILE_LIST (clause
),
1246 pp_right_paren (pp
);
1249 case OMP_CLAUSE__GRIDDIM_
:
1250 pp_string (pp
, "_griddim_(");
1251 pp_unsigned_wide_integer (pp
, OMP_CLAUSE__GRIDDIM__DIMENSION (clause
));
1253 dump_generic_node (pp
, OMP_CLAUSE__GRIDDIM__SIZE (clause
), spc
, flags
,
1256 dump_generic_node (pp
, OMP_CLAUSE__GRIDDIM__GROUP (clause
), spc
, flags
,
1258 pp_right_paren (pp
);
1260 case OMP_CLAUSE_IF_PRESENT
:
1261 pp_string (pp
, "if_present");
1263 case OMP_CLAUSE_FINALIZE
:
1264 pp_string (pp
, "finalize");
1273 /* Dump the list of OpenMP clauses. PP, SPC and FLAGS are as in
1274 dump_generic_node. */
1277 dump_omp_clauses (pretty_printer
*pp
, tree clause
, int spc
, dump_flags_t flags
)
1285 dump_omp_clause (pp
, clause
, spc
, flags
);
1286 clause
= OMP_CLAUSE_CHAIN (clause
);
1294 /* Dump location LOC to PP. */
1297 dump_location (pretty_printer
*pp
, location_t loc
)
1299 expanded_location xloc
= expand_location (loc
);
1301 pp_left_bracket (pp
);
1304 pp_string (pp
, xloc
.file
);
1305 pp_string (pp
, ":");
1307 pp_decimal_int (pp
, xloc
.line
);
1309 pp_decimal_int (pp
, xloc
.column
);
1310 pp_string (pp
, "] ");
1314 /* Dump lexical block BLOCK. PP, SPC and FLAGS are as in
1315 dump_generic_node. */
1318 dump_block_node (pretty_printer
*pp
, tree block
, int spc
, dump_flags_t flags
)
1322 pp_printf (pp
, "BLOCK #%d ", BLOCK_NUMBER (block
));
1324 if (flags
& TDF_ADDRESS
)
1325 pp_printf (pp
, "[%p] ", (void *) block
);
1327 if (TREE_ASM_WRITTEN (block
))
1328 pp_string (pp
, "[written] ");
1330 if (flags
& TDF_SLIM
)
1333 if (BLOCK_SOURCE_LOCATION (block
))
1334 dump_location (pp
, BLOCK_SOURCE_LOCATION (block
));
1336 newline_and_indent (pp
, spc
+ 2);
1338 if (BLOCK_SUPERCONTEXT (block
))
1340 pp_string (pp
, "SUPERCONTEXT: ");
1341 dump_generic_node (pp
, BLOCK_SUPERCONTEXT (block
), 0,
1342 flags
| TDF_SLIM
, false);
1343 newline_and_indent (pp
, spc
+ 2);
1346 if (BLOCK_SUBBLOCKS (block
))
1348 pp_string (pp
, "SUBBLOCKS: ");
1349 for (t
= BLOCK_SUBBLOCKS (block
); t
; t
= BLOCK_CHAIN (t
))
1351 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
1354 newline_and_indent (pp
, spc
+ 2);
1357 if (BLOCK_CHAIN (block
))
1359 pp_string (pp
, "SIBLINGS: ");
1360 for (t
= BLOCK_CHAIN (block
); t
; t
= BLOCK_CHAIN (t
))
1362 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
1365 newline_and_indent (pp
, spc
+ 2);
1368 if (BLOCK_VARS (block
))
1370 pp_string (pp
, "VARS: ");
1371 for (t
= BLOCK_VARS (block
); t
; t
= TREE_CHAIN (t
))
1373 dump_generic_node (pp
, t
, 0, flags
, false);
1376 newline_and_indent (pp
, spc
+ 2);
1379 if (vec_safe_length (BLOCK_NONLOCALIZED_VARS (block
)) > 0)
1382 vec
<tree
, va_gc
> *nlv
= BLOCK_NONLOCALIZED_VARS (block
);
1384 pp_string (pp
, "NONLOCALIZED_VARS: ");
1385 FOR_EACH_VEC_ELT (*nlv
, i
, t
)
1387 dump_generic_node (pp
, t
, 0, flags
, false);
1390 newline_and_indent (pp
, spc
+ 2);
1393 if (BLOCK_ABSTRACT_ORIGIN (block
))
1395 pp_string (pp
, "ABSTRACT_ORIGIN: ");
1396 dump_generic_node (pp
, BLOCK_ABSTRACT_ORIGIN (block
), 0,
1397 flags
| TDF_SLIM
, false);
1398 newline_and_indent (pp
, spc
+ 2);
1401 if (BLOCK_FRAGMENT_ORIGIN (block
))
1403 pp_string (pp
, "FRAGMENT_ORIGIN: ");
1404 dump_generic_node (pp
, BLOCK_FRAGMENT_ORIGIN (block
), 0,
1405 flags
| TDF_SLIM
, false);
1406 newline_and_indent (pp
, spc
+ 2);
1409 if (BLOCK_FRAGMENT_CHAIN (block
))
1411 pp_string (pp
, "FRAGMENT_CHAIN: ");
1412 for (t
= BLOCK_FRAGMENT_CHAIN (block
); t
; t
= BLOCK_FRAGMENT_CHAIN (t
))
1414 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
1417 newline_and_indent (pp
, spc
+ 2);
1421 /* Dump #pragma omp atomic memory order clause. */
1424 dump_omp_atomic_memory_order (pretty_printer
*pp
, enum omp_memory_order mo
)
1428 case OMP_MEMORY_ORDER_RELAXED
:
1429 pp_string (pp
, " relaxed");
1431 case OMP_MEMORY_ORDER_SEQ_CST
:
1432 pp_string (pp
, " seq_cst");
1434 case OMP_MEMORY_ORDER_ACQ_REL
:
1435 pp_string (pp
, " acq_rel");
1437 case OMP_MEMORY_ORDER_ACQUIRE
:
1438 pp_string (pp
, " acquire");
1440 case OMP_MEMORY_ORDER_RELEASE
:
1441 pp_string (pp
, " release");
1443 case OMP_MEMORY_ORDER_UNSPECIFIED
:
1450 /* Helper to dump a MEM_REF node. */
1453 dump_mem_ref (pretty_printer
*pp
, tree node
, int spc
, dump_flags_t flags
)
1455 if (flags
& TDF_GIMPLE
)
1457 pp_string (pp
, "__MEM <");
1458 dump_generic_node (pp
, TREE_TYPE (node
),
1459 spc
, flags
| TDF_SLIM
, false);
1460 if (TYPE_ALIGN (TREE_TYPE (node
))
1461 != TYPE_ALIGN (TYPE_MAIN_VARIANT (TREE_TYPE (node
))))
1463 pp_string (pp
, ", ");
1464 pp_decimal_int (pp
, TYPE_ALIGN (TREE_TYPE (node
)));
1467 pp_string (pp
, " (");
1468 if (TREE_TYPE (TREE_OPERAND (node
, 0))
1469 != TREE_TYPE (TREE_OPERAND (node
, 1)))
1472 dump_generic_node (pp
, TREE_TYPE (TREE_OPERAND (node
, 1)),
1473 spc
, flags
| TDF_SLIM
, false);
1474 pp_right_paren (pp
);
1476 dump_generic_node (pp
, TREE_OPERAND (node
, 0),
1477 spc
, flags
| TDF_SLIM
, false);
1478 if (! integer_zerop (TREE_OPERAND (node
, 1)))
1480 pp_string (pp
, " + ");
1481 dump_generic_node (pp
, TREE_OPERAND (node
, 1),
1482 spc
, flags
| TDF_SLIM
, false);
1484 pp_right_paren (pp
);
1486 else if (integer_zerop (TREE_OPERAND (node
, 1))
1487 /* Dump the types of INTEGER_CSTs explicitly, for we can't
1488 infer them and MEM_ATTR caching will share MEM_REFs
1489 with differently-typed op0s. */
1490 && TREE_CODE (TREE_OPERAND (node
, 0)) != INTEGER_CST
1491 /* Released SSA_NAMES have no TREE_TYPE. */
1492 && TREE_TYPE (TREE_OPERAND (node
, 0)) != NULL_TREE
1493 /* Same pointer types, but ignoring POINTER_TYPE vs.
1495 && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 0)))
1496 == TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 1))))
1497 && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (node
, 0)))
1498 == TYPE_MODE (TREE_TYPE (TREE_OPERAND (node
, 1))))
1499 && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node
, 0)))
1500 == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node
, 1))))
1501 /* Same value types ignoring qualifiers. */
1502 && (TYPE_MAIN_VARIANT (TREE_TYPE (node
))
1503 == TYPE_MAIN_VARIANT
1504 (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 1)))))
1505 && (!(flags
& TDF_ALIAS
)
1506 || MR_DEPENDENCE_CLIQUE (node
) == 0))
1508 if (TREE_CODE (TREE_OPERAND (node
, 0)) != ADDR_EXPR
)
1510 /* Enclose pointers to arrays in parentheses. */
1511 tree op0
= TREE_OPERAND (node
, 0);
1512 tree op0type
= TREE_TYPE (op0
);
1513 if (POINTER_TYPE_P (op0type
)
1514 && TREE_CODE (TREE_TYPE (op0type
)) == ARRAY_TYPE
)
1517 dump_generic_node (pp
, op0
, spc
, flags
, false);
1518 if (POINTER_TYPE_P (op0type
)
1519 && TREE_CODE (TREE_TYPE (op0type
)) == ARRAY_TYPE
)
1520 pp_right_paren (pp
);
1523 dump_generic_node (pp
,
1524 TREE_OPERAND (TREE_OPERAND (node
, 0), 0),
1529 pp_string (pp
, "MEM");
1531 tree nodetype
= TREE_TYPE (node
);
1532 tree op0
= TREE_OPERAND (node
, 0);
1533 tree op1
= TREE_OPERAND (node
, 1);
1534 tree op1type
= TYPE_MAIN_VARIANT (TREE_TYPE (op1
));
1536 tree op0size
= TYPE_SIZE (nodetype
);
1537 tree op1size
= TYPE_SIZE (TREE_TYPE (op1type
));
1539 if (!op0size
|| !op1size
1540 || !operand_equal_p (op0size
, op1size
, 0))
1542 pp_string (pp
, " <");
1543 /* If the size of the type of the operand is not the same
1544 as the size of the MEM_REF expression include the type
1545 of the latter similar to the TDF_GIMPLE output to make
1546 it clear how many bytes of memory are being accessed. */
1547 dump_generic_node (pp
, nodetype
, spc
, flags
| TDF_SLIM
, false);
1548 pp_string (pp
, "> ");
1551 pp_string (pp
, "[(");
1552 dump_generic_node (pp
, op1type
, spc
, flags
| TDF_SLIM
, false);
1553 pp_right_paren (pp
);
1554 dump_generic_node (pp
, op0
, spc
, flags
, false);
1555 if (!integer_zerop (op1
))
1556 if (!integer_zerop (TREE_OPERAND (node
, 1)))
1558 pp_string (pp
, " + ");
1559 dump_generic_node (pp
, op1
, spc
, flags
, false);
1561 if ((flags
& TDF_ALIAS
)
1562 && MR_DEPENDENCE_CLIQUE (node
) != 0)
1564 pp_string (pp
, " clique ");
1565 pp_unsigned_wide_integer (pp
, MR_DEPENDENCE_CLIQUE (node
));
1566 pp_string (pp
, " base ");
1567 pp_unsigned_wide_integer (pp
, MR_DEPENDENCE_BASE (node
));
1569 pp_right_bracket (pp
);
1573 /* Dump the node NODE on the pretty_printer PP, SPC spaces of
1574 indent. FLAGS specifies details to show in the dump (see TDF_* in
1575 dumpfile.h). If IS_STMT is true, the object printed is considered
1576 to be a statement and it is terminated by ';' if appropriate. */
1579 dump_generic_node (pretty_printer
*pp
, tree node
, int spc
, dump_flags_t flags
,
1586 enum tree_code code
;
1588 if (node
== NULL_TREE
)
1591 is_expr
= EXPR_P (node
);
1593 if (is_stmt
&& (flags
& TDF_STMTADDR
))
1594 pp_printf (pp
, "<&%p> ", (void *)node
);
1596 if ((flags
& TDF_LINENO
) && EXPR_HAS_LOCATION (node
))
1597 dump_location (pp
, EXPR_LOCATION (node
));
1599 code
= TREE_CODE (node
);
1603 pp_string (pp
, "<<< error >>>");
1606 case IDENTIFIER_NODE
:
1607 pp_tree_identifier (pp
, node
);
1611 while (node
&& node
!= error_mark_node
)
1613 if (TREE_PURPOSE (node
))
1615 dump_generic_node (pp
, TREE_PURPOSE (node
), spc
, flags
, false);
1618 dump_generic_node (pp
, TREE_VALUE (node
), spc
, flags
, false);
1619 node
= TREE_CHAIN (node
);
1620 if (node
&& TREE_CODE (node
) == TREE_LIST
)
1629 dump_generic_node (pp
, BINFO_TYPE (node
), spc
, flags
, false);
1635 if (TREE_VEC_LENGTH (node
) > 0)
1637 size_t len
= TREE_VEC_LENGTH (node
);
1638 for (i
= 0; i
< len
- 1; i
++)
1640 dump_generic_node (pp
, TREE_VEC_ELT (node
, i
), spc
, flags
,
1645 dump_generic_node (pp
, TREE_VEC_ELT (node
, len
- 1), spc
,
1654 case FIXED_POINT_TYPE
:
1660 unsigned int quals
= TYPE_QUALS (node
);
1661 enum tree_code_class tclass
;
1663 if (quals
& TYPE_QUAL_ATOMIC
)
1664 pp_string (pp
, "atomic ");
1665 if (quals
& TYPE_QUAL_CONST
)
1666 pp_string (pp
, "const ");
1667 else if (quals
& TYPE_QUAL_VOLATILE
)
1668 pp_string (pp
, "volatile ");
1669 else if (quals
& TYPE_QUAL_RESTRICT
)
1670 pp_string (pp
, "restrict ");
1672 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
1674 pp_string (pp
, "<address-space-");
1675 pp_decimal_int (pp
, TYPE_ADDR_SPACE (node
));
1676 pp_string (pp
, "> ");
1679 tclass
= TREE_CODE_CLASS (TREE_CODE (node
));
1681 if (tclass
== tcc_declaration
)
1683 if (DECL_NAME (node
))
1684 dump_decl_name (pp
, node
, flags
);
1686 pp_string (pp
, "<unnamed type decl>");
1688 else if (tclass
== tcc_type
)
1690 if (TYPE_NAME (node
))
1692 if (TREE_CODE (TYPE_NAME (node
)) == IDENTIFIER_NODE
)
1693 pp_tree_identifier (pp
, TYPE_NAME (node
));
1694 else if (TREE_CODE (TYPE_NAME (node
)) == TYPE_DECL
1695 && DECL_NAME (TYPE_NAME (node
)))
1696 dump_decl_name (pp
, TYPE_NAME (node
), flags
);
1698 pp_string (pp
, "<unnamed type>");
1700 else if (TREE_CODE (node
) == VECTOR_TYPE
)
1702 pp_string (pp
, "vector");
1704 pp_wide_integer (pp
, TYPE_VECTOR_SUBPARTS (node
));
1705 pp_string (pp
, ") ");
1706 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1708 else if (TREE_CODE (node
) == INTEGER_TYPE
)
1710 if (TYPE_PRECISION (node
) == CHAR_TYPE_SIZE
)
1711 pp_string (pp
, (TYPE_UNSIGNED (node
)
1714 else if (TYPE_PRECISION (node
) == SHORT_TYPE_SIZE
)
1715 pp_string (pp
, (TYPE_UNSIGNED (node
)
1718 else if (TYPE_PRECISION (node
) == INT_TYPE_SIZE
)
1719 pp_string (pp
, (TYPE_UNSIGNED (node
)
1722 else if (TYPE_PRECISION (node
) == LONG_TYPE_SIZE
)
1723 pp_string (pp
, (TYPE_UNSIGNED (node
)
1726 else if (TYPE_PRECISION (node
) == LONG_LONG_TYPE_SIZE
)
1727 pp_string (pp
, (TYPE_UNSIGNED (node
)
1728 ? "unsigned long long"
1729 : "signed long long"));
1730 else if (TYPE_PRECISION (node
) >= CHAR_TYPE_SIZE
1731 && pow2p_hwi (TYPE_PRECISION (node
)))
1733 pp_string (pp
, (TYPE_UNSIGNED (node
) ? "uint" : "int"));
1734 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1735 pp_string (pp
, "_t");
1739 pp_string (pp
, (TYPE_UNSIGNED (node
)
1740 ? "<unnamed-unsigned:"
1741 : "<unnamed-signed:"));
1742 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1746 else if (TREE_CODE (node
) == COMPLEX_TYPE
)
1748 pp_string (pp
, "__complex__ ");
1749 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1751 else if (TREE_CODE (node
) == REAL_TYPE
)
1753 pp_string (pp
, "<float:");
1754 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1757 else if (TREE_CODE (node
) == FIXED_POINT_TYPE
)
1759 pp_string (pp
, "<fixed-point-");
1760 pp_string (pp
, TYPE_SATURATING (node
) ? "sat:" : "nonsat:");
1761 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1764 else if (TREE_CODE (node
) == VOID_TYPE
)
1765 pp_string (pp
, "void");
1767 pp_string (pp
, "<unnamed type>");
1773 case REFERENCE_TYPE
:
1774 str
= (TREE_CODE (node
) == POINTER_TYPE
? "*" : "&");
1776 if (TREE_TYPE (node
) == NULL
)
1778 pp_string (pp
, str
);
1779 pp_string (pp
, "<null type>");
1781 else if (TREE_CODE (TREE_TYPE (node
)) == FUNCTION_TYPE
)
1783 tree fnode
= TREE_TYPE (node
);
1785 dump_generic_node (pp
, TREE_TYPE (fnode
), spc
, flags
, false);
1788 pp_string (pp
, str
);
1789 if (TYPE_IDENTIFIER (node
))
1790 dump_generic_node (pp
, TYPE_NAME (node
), spc
, flags
, false);
1791 else if (flags
& TDF_NOUID
)
1792 pp_printf (pp
, "<Txxxx>");
1794 pp_printf (pp
, "<T%x>", TYPE_UID (node
));
1796 pp_right_paren (pp
);
1797 dump_function_declaration (pp
, fnode
, spc
, flags
);
1801 unsigned int quals
= TYPE_QUALS (node
);
1803 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1805 pp_string (pp
, str
);
1807 if (quals
& TYPE_QUAL_CONST
)
1808 pp_string (pp
, " const");
1809 if (quals
& TYPE_QUAL_VOLATILE
)
1810 pp_string (pp
, " volatile");
1811 if (quals
& TYPE_QUAL_RESTRICT
)
1812 pp_string (pp
, " restrict");
1814 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
1816 pp_string (pp
, " <address-space-");
1817 pp_decimal_int (pp
, TYPE_ADDR_SPACE (node
));
1821 if (TYPE_REF_CAN_ALIAS_ALL (node
))
1822 pp_string (pp
, " {ref-all}");
1831 dump_mem_ref (pp
, node
, spc
, flags
);
1834 case TARGET_MEM_REF
:
1836 const char *sep
= "";
1839 pp_string (pp
, "MEM[");
1841 if (TREE_CODE (TMR_BASE (node
)) == ADDR_EXPR
)
1843 pp_string (pp
, sep
);
1845 pp_string (pp
, "symbol: ");
1846 dump_generic_node (pp
, TREE_OPERAND (TMR_BASE (node
), 0),
1851 pp_string (pp
, sep
);
1853 pp_string (pp
, "base: ");
1854 dump_generic_node (pp
, TMR_BASE (node
), spc
, flags
, false);
1856 tmp
= TMR_INDEX2 (node
);
1859 pp_string (pp
, sep
);
1861 pp_string (pp
, "base: ");
1862 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1864 tmp
= TMR_INDEX (node
);
1867 pp_string (pp
, sep
);
1869 pp_string (pp
, "index: ");
1870 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1872 tmp
= TMR_STEP (node
);
1875 pp_string (pp
, sep
);
1877 pp_string (pp
, "step: ");
1878 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1880 tmp
= TMR_OFFSET (node
);
1883 pp_string (pp
, sep
);
1885 pp_string (pp
, "offset: ");
1886 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1888 pp_right_bracket (pp
);
1896 /* Print the innermost component type. */
1897 for (tmp
= TREE_TYPE (node
); TREE_CODE (tmp
) == ARRAY_TYPE
;
1898 tmp
= TREE_TYPE (tmp
))
1900 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1902 /* Print the dimensions. */
1903 for (tmp
= node
; TREE_CODE (tmp
) == ARRAY_TYPE
; tmp
= TREE_TYPE (tmp
))
1904 dump_array_domain (pp
, TYPE_DOMAIN (tmp
), spc
, flags
);
1910 case QUAL_UNION_TYPE
:
1912 unsigned int quals
= TYPE_QUALS (node
);
1914 if (quals
& TYPE_QUAL_ATOMIC
)
1915 pp_string (pp
, "atomic ");
1916 if (quals
& TYPE_QUAL_CONST
)
1917 pp_string (pp
, "const ");
1918 if (quals
& TYPE_QUAL_VOLATILE
)
1919 pp_string (pp
, "volatile ");
1921 /* Print the name of the structure. */
1922 if (TREE_CODE (node
) == RECORD_TYPE
)
1923 pp_string (pp
, "struct ");
1924 else if (TREE_CODE (node
) == UNION_TYPE
)
1925 pp_string (pp
, "union ");
1927 if (TYPE_NAME (node
))
1928 dump_generic_node (pp
, TYPE_NAME (node
), spc
, flags
, false);
1929 else if (!(flags
& TDF_SLIM
))
1930 /* FIXME: If we eliminate the 'else' above and attempt
1931 to show the fields for named types, we may get stuck
1932 following a cycle of pointers to structs. The alleged
1933 self-reference check in print_struct_decl will not detect
1934 cycles involving more than one pointer or struct type. */
1935 print_struct_decl (pp
, node
, spc
, flags
);
1944 if (flags
& TDF_GIMPLE
1945 && (POINTER_TYPE_P (TREE_TYPE (node
))
1946 || (TYPE_PRECISION (TREE_TYPE (node
))
1947 < TYPE_PRECISION (integer_type_node
))
1948 || exact_log2 (TYPE_PRECISION (TREE_TYPE (node
))) == -1
1949 || tree_int_cst_sgn (node
) < 0))
1951 pp_string (pp
, "_Literal (");
1952 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1953 pp_string (pp
, ") ");
1955 if (TREE_CODE (TREE_TYPE (node
)) == POINTER_TYPE
1956 && ! (flags
& TDF_GIMPLE
))
1958 /* In the case of a pointer, one may want to divide by the
1959 size of the pointed-to type. Unfortunately, this not
1960 straightforward. The C front-end maps expressions
1965 in such a way that the two INTEGER_CST nodes for "5" have
1966 different values but identical types. In the latter
1967 case, the 5 is multiplied by sizeof (int) in c-common.c
1968 (pointer_int_sum) to convert it to a byte address, and
1969 yet the type of the node is left unchanged. Argh. What
1970 is consistent though is that the number value corresponds
1971 to bytes (UNITS) offset.
1973 NB: Neither of the following divisors can be trivially
1974 used to recover the original literal:
1976 TREE_INT_CST_LOW (TYPE_SIZE_UNIT (TREE_TYPE (node)))
1977 TYPE_PRECISION (TREE_TYPE (TREE_TYPE (node))) */
1978 pp_wide_integer (pp
, TREE_INT_CST_LOW (node
));
1979 pp_string (pp
, "B"); /* pseudo-unit */
1981 else if (tree_fits_shwi_p (node
))
1982 pp_wide_integer (pp
, tree_to_shwi (node
));
1983 else if (tree_fits_uhwi_p (node
))
1984 pp_unsigned_wide_integer (pp
, tree_to_uhwi (node
));
1987 wide_int val
= wi::to_wide (node
);
1989 if (wi::neg_p (val
, TYPE_SIGN (TREE_TYPE (node
))))
1994 print_hex (val
, pp_buffer (pp
)->digit_buffer
);
1995 pp_string (pp
, pp_buffer (pp
)->digit_buffer
);
1997 if ((flags
& TDF_GIMPLE
)
1998 && ! (POINTER_TYPE_P (TREE_TYPE (node
))
1999 || (TYPE_PRECISION (TREE_TYPE (node
))
2000 < TYPE_PRECISION (integer_type_node
))
2001 || exact_log2 (TYPE_PRECISION (TREE_TYPE (node
))) == -1))
2003 if (TYPE_UNSIGNED (TREE_TYPE (node
)))
2004 pp_character (pp
, 'u');
2005 if (TYPE_PRECISION (TREE_TYPE (node
))
2006 == TYPE_PRECISION (unsigned_type_node
))
2008 else if (TYPE_PRECISION (TREE_TYPE (node
))
2009 == TYPE_PRECISION (long_unsigned_type_node
))
2010 pp_character (pp
, 'l');
2011 else if (TYPE_PRECISION (TREE_TYPE (node
))
2012 == TYPE_PRECISION (long_long_unsigned_type_node
))
2013 pp_string (pp
, "ll");
2015 if (TREE_OVERFLOW (node
))
2016 pp_string (pp
, "(OVF)");
2020 pp_string (pp
, "POLY_INT_CST [");
2021 dump_generic_node (pp
, POLY_INT_CST_COEFF (node
, 0), spc
, flags
, false);
2022 for (unsigned int i
= 1; i
< NUM_POLY_INT_COEFFS
; ++i
)
2024 pp_string (pp
, ", ");
2025 dump_generic_node (pp
, POLY_INT_CST_COEFF (node
, i
),
2028 pp_string (pp
, "]");
2032 /* Code copied from print_node. */
2035 if (TREE_OVERFLOW (node
))
2036 pp_string (pp
, " overflow");
2038 d
= TREE_REAL_CST (node
);
2039 if (REAL_VALUE_ISINF (d
))
2040 pp_string (pp
, REAL_VALUE_NEGATIVE (d
) ? " -Inf" : " Inf");
2041 else if (REAL_VALUE_ISNAN (d
))
2042 pp_string (pp
, " Nan");
2046 real_to_decimal (string
, &d
, sizeof (string
), 0, 1);
2047 pp_string (pp
, string
);
2055 fixed_to_decimal (string
, TREE_FIXED_CST_PTR (node
), sizeof (string
));
2056 pp_string (pp
, string
);
2061 pp_string (pp
, "__complex__ (");
2062 dump_generic_node (pp
, TREE_REALPART (node
), spc
, flags
, false);
2063 pp_string (pp
, ", ");
2064 dump_generic_node (pp
, TREE_IMAGPART (node
), spc
, flags
, false);
2065 pp_right_paren (pp
);
2070 pp_string (pp
, "\"");
2071 if (unsigned nbytes
= TREE_STRING_LENGTH (node
))
2072 pretty_print_string (pp
, TREE_STRING_POINTER (node
), nbytes
);
2073 pp_string (pp
, "\"");
2080 if (flags
& TDF_GIMPLE
)
2082 pp_string (pp
, "_Literal (");
2083 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2084 pp_string (pp
, ") ");
2086 pp_string (pp
, "{ ");
2087 unsigned HOST_WIDE_INT nunits
;
2088 if (!VECTOR_CST_NELTS (node
).is_constant (&nunits
))
2089 nunits
= vector_cst_encoded_nelts (node
);
2090 for (i
= 0; i
< nunits
; ++i
)
2093 pp_string (pp
, ", ");
2094 dump_generic_node (pp
, VECTOR_CST_ELT (node
, i
),
2097 if (!VECTOR_CST_NELTS (node
).is_constant ())
2098 pp_string (pp
, ", ...");
2099 pp_string (pp
, " }");
2105 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2107 if (TREE_CODE (node
) == METHOD_TYPE
)
2109 if (TYPE_METHOD_BASETYPE (node
))
2110 dump_generic_node (pp
, TYPE_NAME (TYPE_METHOD_BASETYPE (node
)),
2113 pp_string (pp
, "<null method basetype>");
2114 pp_colon_colon (pp
);
2116 if (TYPE_IDENTIFIER (node
))
2117 dump_generic_node (pp
, TYPE_NAME (node
), spc
, flags
, false);
2118 else if (TYPE_NAME (node
) && DECL_NAME (TYPE_NAME (node
)))
2119 dump_decl_name (pp
, TYPE_NAME (node
), flags
);
2120 else if (flags
& TDF_NOUID
)
2121 pp_printf (pp
, "<Txxxx>");
2123 pp_printf (pp
, "<T%x>", TYPE_UID (node
));
2124 dump_function_declaration (pp
, node
, spc
, flags
);
2129 dump_decl_name (pp
, node
, flags
);
2133 if (DECL_NAME (node
))
2134 dump_decl_name (pp
, node
, flags
);
2135 else if (LABEL_DECL_UID (node
) != -1)
2137 if (flags
& TDF_GIMPLE
)
2138 pp_printf (pp
, "L%d", (int) LABEL_DECL_UID (node
));
2140 pp_printf (pp
, "<L%d>", (int) LABEL_DECL_UID (node
));
2144 if (flags
& TDF_NOUID
)
2145 pp_string (pp
, "<D.xxxx>");
2148 if (flags
& TDF_GIMPLE
)
2149 pp_printf (pp
, "<D%u>", DECL_UID (node
));
2151 pp_printf (pp
, "<D.%u>", DECL_UID (node
));
2157 if (DECL_IS_BUILTIN (node
))
2159 /* Don't print the declaration of built-in types. */
2162 if (DECL_NAME (node
))
2163 dump_decl_name (pp
, node
, flags
);
2164 else if (TYPE_NAME (TREE_TYPE (node
)) != node
)
2166 pp_string (pp
, (TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
2167 ? "union" : "struct "));
2168 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2171 pp_string (pp
, "<anon>");
2177 case DEBUG_EXPR_DECL
:
2178 case NAMESPACE_DECL
:
2180 dump_decl_name (pp
, node
, flags
);
2184 pp_string (pp
, "<retval>");
2188 op0
= TREE_OPERAND (node
, 0);
2191 && (TREE_CODE (op0
) == INDIRECT_REF
2192 || (TREE_CODE (op0
) == MEM_REF
2193 && TREE_CODE (TREE_OPERAND (op0
, 0)) != ADDR_EXPR
2194 && integer_zerop (TREE_OPERAND (op0
, 1))
2195 /* Dump the types of INTEGER_CSTs explicitly, for we
2196 can't infer them and MEM_ATTR caching will share
2197 MEM_REFs with differently-typed op0s. */
2198 && TREE_CODE (TREE_OPERAND (op0
, 0)) != INTEGER_CST
2199 /* Released SSA_NAMES have no TREE_TYPE. */
2200 && TREE_TYPE (TREE_OPERAND (op0
, 0)) != NULL_TREE
2201 /* Same pointer types, but ignoring POINTER_TYPE vs.
2203 && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 0)))
2204 == TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 1))))
2205 && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0
, 0)))
2206 == TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0
, 1))))
2207 && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0
, 0)))
2208 == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0
, 1))))
2209 /* Same value types ignoring qualifiers. */
2210 && (TYPE_MAIN_VARIANT (TREE_TYPE (op0
))
2211 == TYPE_MAIN_VARIANT
2212 (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 1)))))
2213 && MR_DEPENDENCE_CLIQUE (op0
) == 0)))
2215 op0
= TREE_OPERAND (op0
, 0);
2218 if (op_prio (op0
) < op_prio (node
))
2220 dump_generic_node (pp
, op0
, spc
, flags
, false);
2221 if (op_prio (op0
) < op_prio (node
))
2222 pp_right_paren (pp
);
2223 pp_string (pp
, str
);
2224 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2225 op0
= component_ref_field_offset (node
);
2226 if (op0
&& TREE_CODE (op0
) != INTEGER_CST
)
2228 pp_string (pp
, "{off: ");
2229 dump_generic_node (pp
, op0
, spc
, flags
, false);
2230 pp_right_brace (pp
);
2235 if (flags
& TDF_GIMPLE
)
2237 pp_string (pp
, "__BIT_FIELD_REF <");
2238 dump_generic_node (pp
, TREE_TYPE (node
),
2239 spc
, flags
| TDF_SLIM
, false);
2240 if (TYPE_ALIGN (TREE_TYPE (node
))
2241 != TYPE_ALIGN (TYPE_MAIN_VARIANT (TREE_TYPE (node
))))
2243 pp_string (pp
, ", ");
2244 pp_decimal_int (pp
, TYPE_ALIGN (TREE_TYPE (node
)));
2247 pp_string (pp
, " (");
2248 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
,
2249 flags
| TDF_SLIM
, false);
2250 pp_string (pp
, ", ");
2251 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
,
2252 flags
| TDF_SLIM
, false);
2253 pp_string (pp
, ", ");
2254 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
,
2255 flags
| TDF_SLIM
, false);
2256 pp_right_paren (pp
);
2260 pp_string (pp
, "BIT_FIELD_REF <");
2261 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2262 pp_string (pp
, ", ");
2263 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2264 pp_string (pp
, ", ");
2265 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2270 case BIT_INSERT_EXPR
:
2271 pp_string (pp
, "BIT_INSERT_EXPR <");
2272 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2273 pp_string (pp
, ", ");
2274 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2275 pp_string (pp
, ", ");
2276 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2277 pp_string (pp
, " (");
2278 if (INTEGRAL_TYPE_P (TREE_TYPE (TREE_OPERAND (node
, 1))))
2280 TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (node
, 1))));
2282 dump_generic_node (pp
, TYPE_SIZE (TREE_TYPE (TREE_OPERAND (node
, 1))),
2284 pp_string (pp
, " bits)>");
2288 case ARRAY_RANGE_REF
:
2289 op0
= TREE_OPERAND (node
, 0);
2290 if (op_prio (op0
) < op_prio (node
))
2292 dump_generic_node (pp
, op0
, spc
, flags
, false);
2293 if (op_prio (op0
) < op_prio (node
))
2294 pp_right_paren (pp
);
2295 pp_left_bracket (pp
);
2296 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2297 if (TREE_CODE (node
) == ARRAY_RANGE_REF
)
2298 pp_string (pp
, " ...");
2299 pp_right_bracket (pp
);
2301 op0
= array_ref_low_bound (node
);
2302 op1
= array_ref_element_size (node
);
2304 if (!integer_zerop (op0
)
2305 || TREE_OPERAND (node
, 2)
2306 || TREE_OPERAND (node
, 3))
2308 pp_string (pp
, "{lb: ");
2309 dump_generic_node (pp
, op0
, spc
, flags
, false);
2310 pp_string (pp
, " sz: ");
2311 dump_generic_node (pp
, op1
, spc
, flags
, false);
2312 pp_right_brace (pp
);
2318 unsigned HOST_WIDE_INT ix
;
2320 bool is_struct_init
= false;
2321 bool is_array_init
= false;
2323 if (flags
& TDF_GIMPLE
)
2325 pp_string (pp
, "_Literal (");
2326 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2327 pp_string (pp
, ") ");
2330 if (TREE_CLOBBER_P (node
))
2331 pp_string (pp
, "CLOBBER");
2332 else if (TREE_CODE (TREE_TYPE (node
)) == RECORD_TYPE
2333 || TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
)
2334 is_struct_init
= true;
2335 else if (TREE_CODE (TREE_TYPE (node
)) == ARRAY_TYPE
2336 && TYPE_DOMAIN (TREE_TYPE (node
))
2337 && TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
)))
2338 && TREE_CODE (TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
))))
2341 tree minv
= TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
)));
2342 is_array_init
= true;
2343 curidx
= wi::to_widest (minv
);
2345 FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (node
), ix
, field
, val
)
2352 dump_generic_node (pp
, field
, spc
, flags
, false);
2355 else if (is_array_init
2356 && (TREE_CODE (field
) != INTEGER_CST
2357 || curidx
!= wi::to_widest (field
)))
2359 pp_left_bracket (pp
);
2360 if (TREE_CODE (field
) == RANGE_EXPR
)
2362 dump_generic_node (pp
, TREE_OPERAND (field
, 0), spc
,
2364 pp_string (pp
, " ... ");
2365 dump_generic_node (pp
, TREE_OPERAND (field
, 1), spc
,
2367 if (TREE_CODE (TREE_OPERAND (field
, 1)) == INTEGER_CST
)
2368 curidx
= wi::to_widest (TREE_OPERAND (field
, 1));
2371 dump_generic_node (pp
, field
, spc
, flags
, false);
2372 if (TREE_CODE (field
) == INTEGER_CST
)
2373 curidx
= wi::to_widest (field
);
2374 pp_string (pp
, "]=");
2379 if (val
&& TREE_CODE (val
) == ADDR_EXPR
)
2380 if (TREE_CODE (TREE_OPERAND (val
, 0)) == FUNCTION_DECL
)
2381 val
= TREE_OPERAND (val
, 0);
2382 if (val
&& TREE_CODE (val
) == FUNCTION_DECL
)
2383 dump_decl_name (pp
, val
, flags
);
2385 dump_generic_node (pp
, val
, spc
, flags
, false);
2386 if (ix
!= CONSTRUCTOR_NELTS (node
) - 1)
2392 pp_right_brace (pp
);
2399 if (flags
& TDF_SLIM
)
2401 pp_string (pp
, "<COMPOUND_EXPR>");
2405 dump_generic_node (pp
, TREE_OPERAND (node
, 0),
2406 spc
, flags
, !(flags
& TDF_SLIM
));
2407 if (flags
& TDF_SLIM
)
2408 newline_and_indent (pp
, spc
);
2415 for (tp
= &TREE_OPERAND (node
, 1);
2416 TREE_CODE (*tp
) == COMPOUND_EXPR
;
2417 tp
= &TREE_OPERAND (*tp
, 1))
2419 dump_generic_node (pp
, TREE_OPERAND (*tp
, 0),
2420 spc
, flags
, !(flags
& TDF_SLIM
));
2421 if (flags
& TDF_SLIM
)
2422 newline_and_indent (pp
, spc
);
2430 dump_generic_node (pp
, *tp
, spc
, flags
, !(flags
& TDF_SLIM
));
2434 case STATEMENT_LIST
:
2436 tree_stmt_iterator si
;
2439 if (flags
& TDF_SLIM
)
2441 pp_string (pp
, "<STATEMENT_LIST>");
2445 for (si
= tsi_start (node
); !tsi_end_p (si
); tsi_next (&si
))
2448 newline_and_indent (pp
, spc
);
2451 dump_generic_node (pp
, tsi_stmt (si
), spc
, flags
, true);
2458 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
,
2463 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
,
2468 pp_string (pp
, "TARGET_EXPR <");
2469 dump_generic_node (pp
, TARGET_EXPR_SLOT (node
), spc
, flags
, false);
2472 dump_generic_node (pp
, TARGET_EXPR_INITIAL (node
), spc
, flags
, false);
2477 print_declaration (pp
, DECL_EXPR_DECL (node
), spc
, flags
);
2482 if (TREE_TYPE (node
) == NULL
|| TREE_TYPE (node
) == void_type_node
)
2484 pp_string (pp
, "if (");
2485 dump_generic_node (pp
, COND_EXPR_COND (node
), spc
, flags
, false);
2486 pp_right_paren (pp
);
2487 /* The lowered cond_exprs should always be printed in full. */
2488 if (COND_EXPR_THEN (node
)
2489 && (IS_EMPTY_STMT (COND_EXPR_THEN (node
))
2490 || TREE_CODE (COND_EXPR_THEN (node
)) == GOTO_EXPR
)
2491 && COND_EXPR_ELSE (node
)
2492 && (IS_EMPTY_STMT (COND_EXPR_ELSE (node
))
2493 || TREE_CODE (COND_EXPR_ELSE (node
)) == GOTO_EXPR
))
2496 dump_generic_node (pp
, COND_EXPR_THEN (node
),
2498 if (!IS_EMPTY_STMT (COND_EXPR_ELSE (node
)))
2500 pp_string (pp
, " else ");
2501 dump_generic_node (pp
, COND_EXPR_ELSE (node
),
2505 else if (!(flags
& TDF_SLIM
))
2507 /* Output COND_EXPR_THEN. */
2508 if (COND_EXPR_THEN (node
))
2510 newline_and_indent (pp
, spc
+2);
2512 newline_and_indent (pp
, spc
+4);
2513 dump_generic_node (pp
, COND_EXPR_THEN (node
), spc
+4,
2515 newline_and_indent (pp
, spc
+2);
2516 pp_right_brace (pp
);
2519 /* Output COND_EXPR_ELSE. */
2520 if (COND_EXPR_ELSE (node
)
2521 && !IS_EMPTY_STMT (COND_EXPR_ELSE (node
)))
2523 newline_and_indent (pp
, spc
);
2524 pp_string (pp
, "else");
2525 newline_and_indent (pp
, spc
+2);
2527 newline_and_indent (pp
, spc
+4);
2528 dump_generic_node (pp
, COND_EXPR_ELSE (node
), spc
+4,
2530 newline_and_indent (pp
, spc
+2);
2531 pp_right_brace (pp
);
2538 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2542 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2546 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2552 if (!(flags
& TDF_SLIM
))
2554 if (BIND_EXPR_VARS (node
))
2558 for (op0
= BIND_EXPR_VARS (node
); op0
; op0
= DECL_CHAIN (op0
))
2560 print_declaration (pp
, op0
, spc
+2, flags
);
2565 newline_and_indent (pp
, spc
+2);
2566 dump_generic_node (pp
, BIND_EXPR_BODY (node
), spc
+2, flags
, true);
2567 newline_and_indent (pp
, spc
);
2568 pp_right_brace (pp
);
2574 if (CALL_EXPR_FN (node
) != NULL_TREE
)
2575 print_call_name (pp
, CALL_EXPR_FN (node
), flags
);
2579 pp_string (pp
, internal_fn_name (CALL_EXPR_IFN (node
)));
2582 /* Print parameters. */
2587 call_expr_arg_iterator iter
;
2588 FOR_EACH_CALL_EXPR_ARG (arg
, iter
, node
)
2590 dump_generic_node (pp
, arg
, spc
, flags
, false);
2591 if (more_call_expr_args_p (&iter
))
2598 if (CALL_EXPR_VA_ARG_PACK (node
))
2600 if (call_expr_nargs (node
) > 0)
2605 pp_string (pp
, "__builtin_va_arg_pack ()");
2607 pp_right_paren (pp
);
2609 op1
= CALL_EXPR_STATIC_CHAIN (node
);
2612 pp_string (pp
, " [static-chain: ");
2613 dump_generic_node (pp
, op1
, spc
, flags
, false);
2614 pp_right_bracket (pp
);
2617 if (CALL_EXPR_RETURN_SLOT_OPT (node
))
2618 pp_string (pp
, " [return slot optimization]");
2619 if (CALL_EXPR_TAILCALL (node
))
2620 pp_string (pp
, " [tail call]");
2623 case WITH_CLEANUP_EXPR
:
2627 case CLEANUP_POINT_EXPR
:
2628 pp_string (pp
, "<<cleanup_point ");
2629 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2630 pp_string (pp
, ">>");
2633 case PLACEHOLDER_EXPR
:
2634 pp_string (pp
, "<PLACEHOLDER_EXPR ");
2635 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2639 /* Binary arithmetic and logic expressions. */
2640 case WIDEN_SUM_EXPR
:
2641 case WIDEN_MULT_EXPR
:
2643 case MULT_HIGHPART_EXPR
:
2645 case POINTER_PLUS_EXPR
:
2646 case POINTER_DIFF_EXPR
:
2648 case TRUNC_DIV_EXPR
:
2650 case FLOOR_DIV_EXPR
:
2651 case ROUND_DIV_EXPR
:
2652 case TRUNC_MOD_EXPR
:
2654 case FLOOR_MOD_EXPR
:
2655 case ROUND_MOD_EXPR
:
2657 case EXACT_DIV_EXPR
:
2662 case WIDEN_LSHIFT_EXPR
:
2666 case TRUTH_ANDIF_EXPR
:
2667 case TRUTH_ORIF_EXPR
:
2668 case TRUTH_AND_EXPR
:
2670 case TRUTH_XOR_EXPR
:
2684 case UNORDERED_EXPR
:
2686 const char *op
= op_symbol (node
);
2687 op0
= TREE_OPERAND (node
, 0);
2688 op1
= TREE_OPERAND (node
, 1);
2690 /* When the operands are expressions with less priority,
2691 keep semantics of the tree representation. */
2692 if (op_prio (op0
) <= op_prio (node
))
2695 dump_generic_node (pp
, op0
, spc
, flags
, false);
2696 pp_right_paren (pp
);
2699 dump_generic_node (pp
, op0
, spc
, flags
, false);
2705 /* When the operands are expressions with less priority,
2706 keep semantics of the tree representation. */
2707 if (op_prio (op1
) <= op_prio (node
))
2710 dump_generic_node (pp
, op1
, spc
, flags
, false);
2711 pp_right_paren (pp
);
2714 dump_generic_node (pp
, op1
, spc
, flags
, false);
2718 /* Unary arithmetic and logic expressions. */
2721 case TRUTH_NOT_EXPR
:
2723 case PREDECREMENT_EXPR
:
2724 case PREINCREMENT_EXPR
:
2726 if (TREE_CODE (node
) == ADDR_EXPR
2727 && (TREE_CODE (TREE_OPERAND (node
, 0)) == STRING_CST
2728 || TREE_CODE (TREE_OPERAND (node
, 0)) == FUNCTION_DECL
))
2729 ; /* Do not output '&' for strings and function pointers. */
2731 pp_string (pp
, op_symbol (node
));
2733 if (op_prio (TREE_OPERAND (node
, 0)) < op_prio (node
))
2736 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2737 pp_right_paren (pp
);
2740 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2743 case POSTDECREMENT_EXPR
:
2744 case POSTINCREMENT_EXPR
:
2745 if (op_prio (TREE_OPERAND (node
, 0)) < op_prio (node
))
2748 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2749 pp_right_paren (pp
);
2752 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2753 pp_string (pp
, op_symbol (node
));
2757 pp_string (pp
, "MIN_EXPR <");
2758 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2759 pp_string (pp
, ", ");
2760 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2765 pp_string (pp
, "MAX_EXPR <");
2766 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2767 pp_string (pp
, ", ");
2768 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2773 pp_string (pp
, "ABS_EXPR <");
2774 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2779 pp_string (pp
, "ABSU_EXPR <");
2780 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2788 case ADDR_SPACE_CONVERT_EXPR
:
2789 case FIXED_CONVERT_EXPR
:
2790 case FIX_TRUNC_EXPR
:
2793 type
= TREE_TYPE (node
);
2794 op0
= TREE_OPERAND (node
, 0);
2795 if (type
!= TREE_TYPE (op0
))
2798 dump_generic_node (pp
, type
, spc
, flags
, false);
2799 pp_string (pp
, ") ");
2801 if (op_prio (op0
) < op_prio (node
))
2803 dump_generic_node (pp
, op0
, spc
, flags
, false);
2804 if (op_prio (op0
) < op_prio (node
))
2805 pp_right_paren (pp
);
2808 case VIEW_CONVERT_EXPR
:
2809 if (flags
& TDF_GIMPLE
)
2810 pp_string (pp
, "__VIEW_CONVERT <");
2812 pp_string (pp
, "VIEW_CONVERT_EXPR<");
2813 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2814 pp_string (pp
, ">(");
2815 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2816 pp_right_paren (pp
);
2820 pp_string (pp
, "((");
2821 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2822 pp_string (pp
, "))");
2825 case NON_LVALUE_EXPR
:
2826 pp_string (pp
, "NON_LVALUE_EXPR <");
2827 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2832 pp_string (pp
, "SAVE_EXPR <");
2833 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2838 pp_string (pp
, "COMPLEX_EXPR <");
2839 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2840 pp_string (pp
, ", ");
2841 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2846 pp_string (pp
, "CONJ_EXPR <");
2847 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2852 if (flags
& TDF_GIMPLE
)
2854 pp_string (pp
, "__real ");
2855 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2859 pp_string (pp
, "REALPART_EXPR <");
2860 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2866 if (flags
& TDF_GIMPLE
)
2868 pp_string (pp
, "__imag ");
2869 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2873 pp_string (pp
, "IMAGPART_EXPR <");
2874 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2880 pp_string (pp
, "VA_ARG_EXPR <");
2881 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2885 case TRY_FINALLY_EXPR
:
2886 case TRY_CATCH_EXPR
:
2887 pp_string (pp
, "try");
2888 newline_and_indent (pp
, spc
+2);
2890 newline_and_indent (pp
, spc
+4);
2891 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
+4, flags
, true);
2892 newline_and_indent (pp
, spc
+2);
2893 pp_right_brace (pp
);
2894 newline_and_indent (pp
, spc
);
2895 if (TREE_CODE (node
) == TRY_CATCH_EXPR
)
2897 node
= TREE_OPERAND (node
, 1);
2898 pp_string (pp
, "catch");
2902 gcc_assert (TREE_CODE (node
) == TRY_FINALLY_EXPR
);
2903 node
= TREE_OPERAND (node
, 1);
2904 pp_string (pp
, "finally");
2905 if (TREE_CODE (node
) == EH_ELSE_EXPR
)
2907 newline_and_indent (pp
, spc
+2);
2909 newline_and_indent (pp
, spc
+4);
2910 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
+4,
2912 newline_and_indent (pp
, spc
+2);
2913 pp_right_brace (pp
);
2914 newline_and_indent (pp
, spc
);
2915 node
= TREE_OPERAND (node
, 1);
2916 pp_string (pp
, "else");
2919 newline_and_indent (pp
, spc
+2);
2921 newline_and_indent (pp
, spc
+4);
2922 dump_generic_node (pp
, node
, spc
+4, flags
, true);
2923 newline_and_indent (pp
, spc
+2);
2924 pp_right_brace (pp
);
2929 pp_string (pp
, "catch (");
2930 dump_generic_node (pp
, CATCH_TYPES (node
), spc
+2, flags
, false);
2931 pp_right_paren (pp
);
2932 newline_and_indent (pp
, spc
+2);
2934 newline_and_indent (pp
, spc
+4);
2935 dump_generic_node (pp
, CATCH_BODY (node
), spc
+4, flags
, true);
2936 newline_and_indent (pp
, spc
+2);
2937 pp_right_brace (pp
);
2941 case EH_FILTER_EXPR
:
2942 pp_string (pp
, "<<<eh_filter (");
2943 dump_generic_node (pp
, EH_FILTER_TYPES (node
), spc
+2, flags
, false);
2944 pp_string (pp
, ")>>>");
2945 newline_and_indent (pp
, spc
+2);
2947 newline_and_indent (pp
, spc
+4);
2948 dump_generic_node (pp
, EH_FILTER_FAILURE (node
), spc
+4, flags
, true);
2949 newline_and_indent (pp
, spc
+2);
2950 pp_right_brace (pp
);
2955 op0
= TREE_OPERAND (node
, 0);
2956 /* If this is for break or continue, don't bother printing it. */
2957 if (DECL_NAME (op0
))
2959 const char *name
= IDENTIFIER_POINTER (DECL_NAME (op0
));
2960 if (strcmp (name
, "break") == 0
2961 || strcmp (name
, "continue") == 0)
2964 dump_generic_node (pp
, op0
, spc
, flags
, false);
2966 if (DECL_NONLOCAL (op0
))
2967 pp_string (pp
, " [non-local]");
2971 pp_string (pp
, "while (1)");
2972 if (!(flags
& TDF_SLIM
))
2974 newline_and_indent (pp
, spc
+2);
2976 newline_and_indent (pp
, spc
+4);
2977 dump_generic_node (pp
, LOOP_EXPR_BODY (node
), spc
+4, flags
, true);
2978 newline_and_indent (pp
, spc
+2);
2979 pp_right_brace (pp
);
2985 pp_string (pp
, "// predicted ");
2986 if (PREDICT_EXPR_OUTCOME (node
))
2987 pp_string (pp
, "likely by ");
2989 pp_string (pp
, "unlikely by ");
2990 pp_string (pp
, predictor_name (PREDICT_EXPR_PREDICTOR (node
)));
2991 pp_string (pp
, " predictor.");
2995 pp_string (pp
, "ANNOTATE_EXPR <");
2996 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2997 switch ((enum annot_expr_kind
) TREE_INT_CST_LOW (TREE_OPERAND (node
, 1)))
2999 case annot_expr_ivdep_kind
:
3000 pp_string (pp
, ", ivdep");
3002 case annot_expr_unroll_kind
:
3003 pp_printf (pp
, ", unroll %d",
3004 (int) TREE_INT_CST_LOW (TREE_OPERAND (node
, 2)));
3006 case annot_expr_no_vector_kind
:
3007 pp_string (pp
, ", no-vector");
3009 case annot_expr_vector_kind
:
3010 pp_string (pp
, ", vector");
3012 case annot_expr_parallel_kind
:
3013 pp_string (pp
, ", parallel");
3022 pp_string (pp
, "return");
3023 op0
= TREE_OPERAND (node
, 0);
3027 if (TREE_CODE (op0
) == MODIFY_EXPR
)
3028 dump_generic_node (pp
, TREE_OPERAND (op0
, 1),
3031 dump_generic_node (pp
, op0
, spc
, flags
, false);
3036 pp_string (pp
, "if (");
3037 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3038 pp_string (pp
, ") break");
3042 pp_string (pp
, "switch (");
3043 dump_generic_node (pp
, SWITCH_COND (node
), spc
, flags
, false);
3044 pp_right_paren (pp
);
3045 if (!(flags
& TDF_SLIM
))
3047 newline_and_indent (pp
, spc
+2);
3049 if (SWITCH_BODY (node
))
3051 newline_and_indent (pp
, spc
+4);
3052 dump_generic_node (pp
, SWITCH_BODY (node
), spc
+4, flags
,
3055 newline_and_indent (pp
, spc
+2);
3056 pp_right_brace (pp
);
3062 op0
= GOTO_DESTINATION (node
);
3063 if (TREE_CODE (op0
) != SSA_NAME
&& DECL_P (op0
) && DECL_NAME (op0
))
3065 const char *name
= IDENTIFIER_POINTER (DECL_NAME (op0
));
3066 if (strcmp (name
, "break") == 0
3067 || strcmp (name
, "continue") == 0)
3069 pp_string (pp
, name
);
3073 pp_string (pp
, "goto ");
3074 dump_generic_node (pp
, op0
, spc
, flags
, false);
3078 pp_string (pp
, "__asm__");
3079 if (ASM_VOLATILE_P (node
))
3080 pp_string (pp
, " __volatile__");
3082 dump_generic_node (pp
, ASM_STRING (node
), spc
, flags
, false);
3084 dump_generic_node (pp
, ASM_OUTPUTS (node
), spc
, flags
, false);
3086 dump_generic_node (pp
, ASM_INPUTS (node
), spc
, flags
, false);
3087 if (ASM_CLOBBERS (node
))
3090 dump_generic_node (pp
, ASM_CLOBBERS (node
), spc
, flags
, false);
3092 pp_right_paren (pp
);
3095 case CASE_LABEL_EXPR
:
3096 if (CASE_LOW (node
) && CASE_HIGH (node
))
3098 pp_string (pp
, "case ");
3099 dump_generic_node (pp
, CASE_LOW (node
), spc
, flags
, false);
3100 pp_string (pp
, " ... ");
3101 dump_generic_node (pp
, CASE_HIGH (node
), spc
, flags
, false);
3103 else if (CASE_LOW (node
))
3105 pp_string (pp
, "case ");
3106 dump_generic_node (pp
, CASE_LOW (node
), spc
, flags
, false);
3109 pp_string (pp
, "default");
3114 pp_string (pp
, "OBJ_TYPE_REF(");
3115 dump_generic_node (pp
, OBJ_TYPE_REF_EXPR (node
), spc
, flags
, false);
3117 /* We omit the class type for -fcompare-debug because we may
3118 drop TYPE_BINFO early depending on debug info, and then
3119 virtual_method_call_p would return false, whereas when
3120 TYPE_BINFO is preserved it may still return true and then
3121 we'd print the class type. Compare tree and rtl dumps for
3122 libstdc++-prettyprinters/shared_ptr.cc with and without -g,
3123 for example, at occurrences of OBJ_TYPE_REF. */
3124 if (!(flags
& (TDF_SLIM
| TDF_COMPARE_DEBUG
))
3125 && virtual_method_call_p (node
))
3127 pp_string (pp
, "(");
3128 dump_generic_node (pp
, obj_type_ref_class (node
), spc
, flags
, false);
3129 pp_string (pp
, ")");
3131 dump_generic_node (pp
, OBJ_TYPE_REF_OBJECT (node
), spc
, flags
, false);
3133 dump_generic_node (pp
, OBJ_TYPE_REF_TOKEN (node
), spc
, flags
, false);
3134 pp_right_paren (pp
);
3138 if (SSA_NAME_IDENTIFIER (node
))
3140 if ((flags
& TDF_NOUID
)
3141 && SSA_NAME_VAR (node
)
3142 && DECL_NAMELESS (SSA_NAME_VAR (node
)))
3143 dump_fancy_name (pp
, SSA_NAME_IDENTIFIER (node
));
3144 else if (! (flags
& TDF_GIMPLE
)
3145 || SSA_NAME_VAR (node
))
3146 dump_generic_node (pp
, SSA_NAME_IDENTIFIER (node
),
3150 pp_decimal_int (pp
, SSA_NAME_VERSION (node
));
3151 if (SSA_NAME_IS_DEFAULT_DEF (node
))
3152 pp_string (pp
, "(D)");
3153 if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (node
))
3154 pp_string (pp
, "(ab)");
3157 case WITH_SIZE_EXPR
:
3158 pp_string (pp
, "WITH_SIZE_EXPR <");
3159 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3160 pp_string (pp
, ", ");
3161 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3166 pp_string (pp
, "ASSERT_EXPR <");
3167 dump_generic_node (pp
, ASSERT_EXPR_VAR (node
), spc
, flags
, false);
3168 pp_string (pp
, ", ");
3169 dump_generic_node (pp
, ASSERT_EXPR_COND (node
), spc
, flags
, false);
3174 pp_string (pp
, "scev_known");
3177 case SCEV_NOT_KNOWN
:
3178 pp_string (pp
, "scev_not_known");
3181 case POLYNOMIAL_CHREC
:
3183 dump_generic_node (pp
, CHREC_LEFT (node
), spc
, flags
, false);
3184 pp_string (pp
, ", +, ");
3185 dump_generic_node (pp
, CHREC_RIGHT (node
), spc
, flags
, false);
3186 pp_printf (pp
, "}_%u", CHREC_VARIABLE (node
));
3190 case REALIGN_LOAD_EXPR
:
3191 pp_string (pp
, "REALIGN_LOAD <");
3192 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3193 pp_string (pp
, ", ");
3194 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3195 pp_string (pp
, ", ");
3196 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3201 pp_string (pp
, " VEC_COND_EXPR < ");
3202 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3203 pp_string (pp
, " , ");
3204 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3205 pp_string (pp
, " , ");
3206 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3207 pp_string (pp
, " > ");
3211 pp_string (pp
, " VEC_PERM_EXPR < ");
3212 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3213 pp_string (pp
, " , ");
3214 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3215 pp_string (pp
, " , ");
3216 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3217 pp_string (pp
, " > ");
3221 pp_string (pp
, " DOT_PROD_EXPR < ");
3222 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3223 pp_string (pp
, ", ");
3224 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3225 pp_string (pp
, ", ");
3226 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3227 pp_string (pp
, " > ");
3230 case WIDEN_MULT_PLUS_EXPR
:
3231 pp_string (pp
, " WIDEN_MULT_PLUS_EXPR < ");
3232 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3233 pp_string (pp
, ", ");
3234 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3235 pp_string (pp
, ", ");
3236 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3237 pp_string (pp
, " > ");
3240 case WIDEN_MULT_MINUS_EXPR
:
3241 pp_string (pp
, " WIDEN_MULT_MINUS_EXPR < ");
3242 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3243 pp_string (pp
, ", ");
3244 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3245 pp_string (pp
, ", ");
3246 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3247 pp_string (pp
, " > ");
3251 pp_string (pp
, "#pragma acc parallel");
3252 goto dump_omp_clauses_body
;
3255 pp_string (pp
, "#pragma acc kernels");
3256 goto dump_omp_clauses_body
;
3259 pp_string (pp
, "#pragma acc serial");
3260 goto dump_omp_clauses_body
;
3263 pp_string (pp
, "#pragma acc data");
3264 dump_omp_clauses (pp
, OACC_DATA_CLAUSES (node
), spc
, flags
);
3267 case OACC_HOST_DATA
:
3268 pp_string (pp
, "#pragma acc host_data");
3269 dump_omp_clauses (pp
, OACC_HOST_DATA_CLAUSES (node
), spc
, flags
);
3273 pp_string (pp
, "#pragma acc declare");
3274 dump_omp_clauses (pp
, OACC_DECLARE_CLAUSES (node
), spc
, flags
);
3278 pp_string (pp
, "#pragma acc update");
3279 dump_omp_clauses (pp
, OACC_UPDATE_CLAUSES (node
), spc
, flags
);
3282 case OACC_ENTER_DATA
:
3283 pp_string (pp
, "#pragma acc enter data");
3284 dump_omp_clauses (pp
, OACC_ENTER_DATA_CLAUSES (node
), spc
, flags
);
3287 case OACC_EXIT_DATA
:
3288 pp_string (pp
, "#pragma acc exit data");
3289 dump_omp_clauses (pp
, OACC_EXIT_DATA_CLAUSES (node
), spc
, flags
);
3293 pp_string (pp
, "#pragma acc cache");
3294 dump_omp_clauses (pp
, OACC_CACHE_CLAUSES (node
), spc
, flags
);
3298 pp_string (pp
, "#pragma omp parallel");
3299 dump_omp_clauses (pp
, OMP_PARALLEL_CLAUSES (node
), spc
, flags
);
3302 dump_omp_clauses_body
:
3303 dump_omp_clauses (pp
, OMP_CLAUSES (node
), spc
, flags
);
3307 if (!(flags
& TDF_SLIM
) && OMP_BODY (node
))
3309 newline_and_indent (pp
, spc
+ 2);
3311 newline_and_indent (pp
, spc
+ 4);
3312 dump_generic_node (pp
, OMP_BODY (node
), spc
+ 4, flags
, false);
3313 newline_and_indent (pp
, spc
+ 2);
3314 pp_right_brace (pp
);
3320 pp_string (pp
, OMP_TASK_BODY (node
) ? "#pragma omp task"
3321 : "#pragma omp taskwait");
3322 dump_omp_clauses (pp
, OMP_TASK_CLAUSES (node
), spc
, flags
);
3326 pp_string (pp
, "#pragma omp for");
3330 pp_string (pp
, "#pragma omp simd");
3333 case OMP_DISTRIBUTE
:
3334 pp_string (pp
, "#pragma omp distribute");
3338 pp_string (pp
, "#pragma omp taskloop");
3342 pp_string (pp
, "#pragma omp loop");
3346 pp_string (pp
, "#pragma acc loop");
3350 pp_string (pp
, "#pragma omp teams");
3351 dump_omp_clauses (pp
, OMP_TEAMS_CLAUSES (node
), spc
, flags
);
3354 case OMP_TARGET_DATA
:
3355 pp_string (pp
, "#pragma omp target data");
3356 dump_omp_clauses (pp
, OMP_TARGET_DATA_CLAUSES (node
), spc
, flags
);
3359 case OMP_TARGET_ENTER_DATA
:
3360 pp_string (pp
, "#pragma omp target enter data");
3361 dump_omp_clauses (pp
, OMP_TARGET_ENTER_DATA_CLAUSES (node
), spc
, flags
);
3365 case OMP_TARGET_EXIT_DATA
:
3366 pp_string (pp
, "#pragma omp target exit data");
3367 dump_omp_clauses (pp
, OMP_TARGET_EXIT_DATA_CLAUSES (node
), spc
, flags
);
3372 pp_string (pp
, "#pragma omp target");
3373 dump_omp_clauses (pp
, OMP_TARGET_CLAUSES (node
), spc
, flags
);
3376 case OMP_TARGET_UPDATE
:
3377 pp_string (pp
, "#pragma omp target update");
3378 dump_omp_clauses (pp
, OMP_TARGET_UPDATE_CLAUSES (node
), spc
, flags
);
3383 dump_omp_clauses (pp
, OMP_FOR_CLAUSES (node
), spc
, flags
);
3384 if (!(flags
& TDF_SLIM
))
3388 if (OMP_FOR_PRE_BODY (node
))
3390 newline_and_indent (pp
, spc
+ 2);
3393 newline_and_indent (pp
, spc
);
3394 dump_generic_node (pp
, OMP_FOR_PRE_BODY (node
),
3397 if (OMP_FOR_INIT (node
))
3400 for (i
= 0; i
< TREE_VEC_LENGTH (OMP_FOR_INIT (node
)); i
++)
3403 newline_and_indent (pp
, spc
);
3404 pp_string (pp
, "for (");
3405 dump_generic_node (pp
,
3406 TREE_VEC_ELT (OMP_FOR_INIT (node
), i
),
3408 pp_string (pp
, "; ");
3409 dump_generic_node (pp
,
3410 TREE_VEC_ELT (OMP_FOR_COND (node
), i
),
3412 pp_string (pp
, "; ");
3413 dump_generic_node (pp
,
3414 TREE_VEC_ELT (OMP_FOR_INCR (node
), i
),
3416 pp_right_paren (pp
);
3419 if (OMP_FOR_BODY (node
))
3421 newline_and_indent (pp
, spc
+ 2);
3423 newline_and_indent (pp
, spc
+ 4);
3424 dump_generic_node (pp
, OMP_FOR_BODY (node
), spc
+ 4, flags
,
3426 newline_and_indent (pp
, spc
+ 2);
3427 pp_right_brace (pp
);
3429 if (OMP_FOR_INIT (node
))
3430 spc
-= 2 * TREE_VEC_LENGTH (OMP_FOR_INIT (node
)) - 2;
3431 if (OMP_FOR_PRE_BODY (node
))
3434 newline_and_indent (pp
, spc
+ 2);
3435 pp_right_brace (pp
);
3442 pp_string (pp
, "#pragma omp sections");
3443 dump_omp_clauses (pp
, OMP_SECTIONS_CLAUSES (node
), spc
, flags
);
3447 pp_string (pp
, "#pragma omp section");
3451 if (OMP_SCAN_CLAUSES (node
))
3453 pp_string (pp
, "#pragma omp scan");
3454 dump_omp_clauses (pp
, OMP_SCAN_CLAUSES (node
), spc
, flags
);
3459 pp_string (pp
, "#pragma omp master");
3463 pp_string (pp
, "#pragma omp taskgroup");
3464 dump_omp_clauses (pp
, OMP_TASKGROUP_CLAUSES (node
), spc
, flags
);
3468 pp_string (pp
, "#pragma omp ordered");
3469 dump_omp_clauses (pp
, OMP_ORDERED_CLAUSES (node
), spc
, flags
);
3473 pp_string (pp
, "#pragma omp critical");
3474 if (OMP_CRITICAL_NAME (node
))
3478 dump_generic_node (pp
, OMP_CRITICAL_NAME (node
), spc
,
3480 pp_right_paren (pp
);
3482 dump_omp_clauses (pp
, OMP_CRITICAL_CLAUSES (node
), spc
, flags
);
3486 pp_string (pp
, "#pragma omp atomic");
3487 dump_omp_atomic_memory_order (pp
, OMP_ATOMIC_MEMORY_ORDER (node
));
3488 newline_and_indent (pp
, spc
+ 2);
3489 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3493 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3496 case OMP_ATOMIC_READ
:
3497 pp_string (pp
, "#pragma omp atomic read");
3498 dump_omp_atomic_memory_order (pp
, OMP_ATOMIC_MEMORY_ORDER (node
));
3499 newline_and_indent (pp
, spc
+ 2);
3500 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3504 case OMP_ATOMIC_CAPTURE_OLD
:
3505 case OMP_ATOMIC_CAPTURE_NEW
:
3506 pp_string (pp
, "#pragma omp atomic capture");
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);
3517 pp_string (pp
, "#pragma omp single");
3518 dump_omp_clauses (pp
, OMP_SINGLE_CLAUSES (node
), spc
, flags
);
3522 dump_omp_clause (pp
, node
, spc
, flags
);
3526 case TRANSACTION_EXPR
:
3527 if (TRANSACTION_EXPR_OUTER (node
))
3528 pp_string (pp
, "__transaction_atomic [[outer]]");
3529 else if (TRANSACTION_EXPR_RELAXED (node
))
3530 pp_string (pp
, "__transaction_relaxed");
3532 pp_string (pp
, "__transaction_atomic");
3533 if (!(flags
& TDF_SLIM
) && TRANSACTION_EXPR_BODY (node
))
3535 newline_and_indent (pp
, spc
);
3537 newline_and_indent (pp
, spc
+ 2);
3538 dump_generic_node (pp
, TRANSACTION_EXPR_BODY (node
),
3539 spc
+ 2, flags
, false);
3540 newline_and_indent (pp
, spc
);
3541 pp_right_brace (pp
);
3546 case VEC_SERIES_EXPR
:
3547 case VEC_WIDEN_MULT_HI_EXPR
:
3548 case VEC_WIDEN_MULT_LO_EXPR
:
3549 case VEC_WIDEN_MULT_EVEN_EXPR
:
3550 case VEC_WIDEN_MULT_ODD_EXPR
:
3551 case VEC_WIDEN_LSHIFT_HI_EXPR
:
3552 case VEC_WIDEN_LSHIFT_LO_EXPR
:
3554 for (str
= get_tree_code_name (code
); *str
; str
++)
3555 pp_character (pp
, TOUPPER (*str
));
3556 pp_string (pp
, " < ");
3557 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3558 pp_string (pp
, ", ");
3559 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3560 pp_string (pp
, " > ");
3563 case VEC_DUPLICATE_EXPR
:
3565 for (str
= get_tree_code_name (code
); *str
; str
++)
3566 pp_character (pp
, TOUPPER (*str
));
3567 pp_string (pp
, " < ");
3568 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3569 pp_string (pp
, " > ");
3572 case VEC_UNPACK_HI_EXPR
:
3573 pp_string (pp
, " VEC_UNPACK_HI_EXPR < ");
3574 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3575 pp_string (pp
, " > ");
3578 case VEC_UNPACK_LO_EXPR
:
3579 pp_string (pp
, " VEC_UNPACK_LO_EXPR < ");
3580 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3581 pp_string (pp
, " > ");
3584 case VEC_UNPACK_FLOAT_HI_EXPR
:
3585 pp_string (pp
, " VEC_UNPACK_FLOAT_HI_EXPR < ");
3586 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3587 pp_string (pp
, " > ");
3590 case VEC_UNPACK_FLOAT_LO_EXPR
:
3591 pp_string (pp
, " VEC_UNPACK_FLOAT_LO_EXPR < ");
3592 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3593 pp_string (pp
, " > ");
3596 case VEC_UNPACK_FIX_TRUNC_HI_EXPR
:
3597 pp_string (pp
, " VEC_UNPACK_FIX_TRUNC_HI_EXPR < ");
3598 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3599 pp_string (pp
, " > ");
3602 case VEC_UNPACK_FIX_TRUNC_LO_EXPR
:
3603 pp_string (pp
, " VEC_UNPACK_FIX_TRUNC_LO_EXPR < ");
3604 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3605 pp_string (pp
, " > ");
3608 case VEC_PACK_TRUNC_EXPR
:
3609 pp_string (pp
, " VEC_PACK_TRUNC_EXPR < ");
3610 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3611 pp_string (pp
, ", ");
3612 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3613 pp_string (pp
, " > ");
3616 case VEC_PACK_SAT_EXPR
:
3617 pp_string (pp
, " VEC_PACK_SAT_EXPR < ");
3618 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3619 pp_string (pp
, ", ");
3620 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3621 pp_string (pp
, " > ");
3624 case VEC_PACK_FIX_TRUNC_EXPR
:
3625 pp_string (pp
, " VEC_PACK_FIX_TRUNC_EXPR < ");
3626 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3627 pp_string (pp
, ", ");
3628 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3629 pp_string (pp
, " > ");
3632 case VEC_PACK_FLOAT_EXPR
:
3633 pp_string (pp
, " VEC_PACK_FLOAT_EXPR < ");
3634 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3635 pp_string (pp
, ", ");
3636 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3637 pp_string (pp
, " > ");
3641 dump_block_node (pp
, node
, spc
, flags
);
3644 case DEBUG_BEGIN_STMT
:
3645 pp_string (pp
, "# DEBUG BEGIN STMT");
3652 if (is_stmt
&& is_expr
)
3658 /* Print the declaration of a variable. */
3661 print_declaration (pretty_printer
*pp
, tree t
, int spc
, dump_flags_t flags
)
3665 if (TREE_CODE(t
) == NAMELIST_DECL
)
3667 pp_string(pp
, "namelist ");
3668 dump_decl_name (pp
, t
, flags
);
3673 if (TREE_CODE (t
) == TYPE_DECL
)
3674 pp_string (pp
, "typedef ");
3676 if (CODE_CONTAINS_STRUCT (TREE_CODE (t
), TS_DECL_WRTL
) && DECL_REGISTER (t
))
3677 pp_string (pp
, "register ");
3679 if (TREE_PUBLIC (t
) && DECL_EXTERNAL (t
))
3680 pp_string (pp
, "extern ");
3681 else if (TREE_STATIC (t
))
3682 pp_string (pp
, "static ");
3684 /* Print the type and name. */
3685 if (TREE_TYPE (t
) && TREE_CODE (TREE_TYPE (t
)) == ARRAY_TYPE
)
3689 /* Print array's type. */
3690 tmp
= TREE_TYPE (t
);
3691 while (TREE_CODE (TREE_TYPE (tmp
)) == ARRAY_TYPE
)
3692 tmp
= TREE_TYPE (tmp
);
3693 dump_generic_node (pp
, TREE_TYPE (tmp
), spc
, flags
, false);
3695 /* Print variable's name. */
3697 dump_generic_node (pp
, t
, spc
, flags
, false);
3699 /* Print the dimensions. */
3700 tmp
= TREE_TYPE (t
);
3701 while (TREE_CODE (tmp
) == ARRAY_TYPE
)
3703 dump_array_domain (pp
, TYPE_DOMAIN (tmp
), spc
, flags
);
3704 tmp
= TREE_TYPE (tmp
);
3707 else if (TREE_CODE (t
) == FUNCTION_DECL
)
3709 dump_generic_node (pp
, TREE_TYPE (TREE_TYPE (t
)), spc
, flags
, false);
3711 dump_decl_name (pp
, t
, flags
);
3712 dump_function_declaration (pp
, TREE_TYPE (t
), spc
, flags
);
3716 /* Print type declaration. */
3717 dump_generic_node (pp
, TREE_TYPE (t
), spc
, flags
, false);
3719 /* Print variable's name. */
3721 dump_generic_node (pp
, t
, spc
, flags
, false);
3724 if (VAR_P (t
) && DECL_HARD_REGISTER (t
))
3726 pp_string (pp
, " __asm__ ");
3728 dump_generic_node (pp
, DECL_ASSEMBLER_NAME (t
), spc
, flags
, false);
3729 pp_right_paren (pp
);
3732 /* The initial value of a function serves to determine whether the function
3733 is declared or defined. So the following does not apply to function
3735 if (TREE_CODE (t
) != FUNCTION_DECL
)
3737 /* Print the initial value. */
3738 if (DECL_INITIAL (t
))
3743 if (!(flags
& TDF_SLIM
))
3744 dump_generic_node (pp
, DECL_INITIAL (t
), spc
, flags
, false);
3746 pp_string (pp
, "<<< omitted >>>");
3750 if (VAR_P (t
) && DECL_HAS_VALUE_EXPR_P (t
))
3752 pp_string (pp
, " [value-expr: ");
3753 dump_generic_node (pp
, DECL_VALUE_EXPR (t
), spc
, flags
, false);
3754 pp_right_bracket (pp
);
3761 /* Prints a structure: name, fields, and methods.
3762 FIXME: Still incomplete. */
3765 print_struct_decl (pretty_printer
*pp
, const_tree node
, int spc
,
3768 /* Print the name of the structure. */
3769 if (TYPE_NAME (node
))
3772 if (TREE_CODE (node
) == RECORD_TYPE
)
3773 pp_string (pp
, "struct ");
3774 else if ((TREE_CODE (node
) == UNION_TYPE
3775 || TREE_CODE (node
) == QUAL_UNION_TYPE
))
3776 pp_string (pp
, "union ");
3778 dump_generic_node (pp
, TYPE_NAME (node
), spc
, TDF_NONE
, false);
3781 /* Print the contents of the structure. */
3787 /* Print the fields of the structure. */
3790 tmp
= TYPE_FIELDS (node
);
3793 /* Avoid to print recursively the structure. */
3794 /* FIXME : Not implemented correctly...,
3795 what about the case when we have a cycle in the contain graph? ...
3796 Maybe this could be solved by looking at the scope in which the
3797 structure was declared. */
3798 if (TREE_TYPE (tmp
) != node
3799 && (TREE_CODE (TREE_TYPE (tmp
)) != POINTER_TYPE
3800 || TREE_TYPE (TREE_TYPE (tmp
)) != node
))
3802 print_declaration (pp
, tmp
, spc
+2, flags
);
3805 tmp
= DECL_CHAIN (tmp
);
3809 pp_right_brace (pp
);
3812 /* Return the priority of the operator CODE.
3814 From lowest to highest precedence with either left-to-right (L-R)
3815 or right-to-left (R-L) associativity]:
3818 2 [R-L] = += -= *= /= %= &= ^= |= <<= >>=
3830 14 [R-L] ! ~ ++ -- + - * & (type) sizeof
3831 15 [L-R] fn() [] -> .
3833 unary +, - and * have higher precedence than the corresponding binary
3837 op_code_prio (enum tree_code code
)
3854 case TRUTH_ORIF_EXPR
:
3857 case TRUTH_AND_EXPR
:
3858 case TRUTH_ANDIF_EXPR
:
3865 case TRUTH_XOR_EXPR
:
3882 case UNORDERED_EXPR
:
3893 case VEC_WIDEN_LSHIFT_HI_EXPR
:
3894 case VEC_WIDEN_LSHIFT_LO_EXPR
:
3895 case WIDEN_LSHIFT_EXPR
:
3898 case WIDEN_SUM_EXPR
:
3900 case POINTER_PLUS_EXPR
:
3901 case POINTER_DIFF_EXPR
:
3905 case VEC_WIDEN_MULT_HI_EXPR
:
3906 case VEC_WIDEN_MULT_LO_EXPR
:
3907 case WIDEN_MULT_EXPR
:
3909 case WIDEN_MULT_PLUS_EXPR
:
3910 case WIDEN_MULT_MINUS_EXPR
:
3912 case MULT_HIGHPART_EXPR
:
3913 case TRUNC_DIV_EXPR
:
3915 case FLOOR_DIV_EXPR
:
3916 case ROUND_DIV_EXPR
:
3918 case EXACT_DIV_EXPR
:
3919 case TRUNC_MOD_EXPR
:
3921 case FLOOR_MOD_EXPR
:
3922 case ROUND_MOD_EXPR
:
3925 case TRUTH_NOT_EXPR
:
3927 case POSTINCREMENT_EXPR
:
3928 case POSTDECREMENT_EXPR
:
3929 case PREINCREMENT_EXPR
:
3930 case PREDECREMENT_EXPR
:
3936 case FIX_TRUNC_EXPR
:
3942 case ARRAY_RANGE_REF
:
3946 /* Special expressions. */
3952 case VEC_UNPACK_HI_EXPR
:
3953 case VEC_UNPACK_LO_EXPR
:
3954 case VEC_UNPACK_FLOAT_HI_EXPR
:
3955 case VEC_UNPACK_FLOAT_LO_EXPR
:
3956 case VEC_UNPACK_FIX_TRUNC_HI_EXPR
:
3957 case VEC_UNPACK_FIX_TRUNC_LO_EXPR
:
3958 case VEC_PACK_TRUNC_EXPR
:
3959 case VEC_PACK_SAT_EXPR
:
3963 /* Return an arbitrarily high precedence to avoid surrounding single
3964 VAR_DECLs in ()s. */
3969 /* Return the priority of the operator OP. */
3972 op_prio (const_tree op
)
3974 enum tree_code code
;
3979 code
= TREE_CODE (op
);
3980 if (code
== SAVE_EXPR
|| code
== NON_LVALUE_EXPR
)
3981 return op_prio (TREE_OPERAND (op
, 0));
3983 return op_code_prio (code
);
3986 /* Return the symbol associated with operator CODE. */
3989 op_symbol_code (enum tree_code code
)
3997 case TRUTH_ORIF_EXPR
:
4000 case TRUTH_AND_EXPR
:
4001 case TRUTH_ANDIF_EXPR
:
4007 case TRUTH_XOR_EXPR
:
4017 case UNORDERED_EXPR
:
4063 case WIDEN_LSHIFT_EXPR
:
4066 case POINTER_PLUS_EXPR
:
4072 case WIDEN_SUM_EXPR
:
4075 case WIDEN_MULT_EXPR
:
4078 case MULT_HIGHPART_EXPR
:
4083 case POINTER_DIFF_EXPR
:
4089 case TRUTH_NOT_EXPR
:
4096 case TRUNC_DIV_EXPR
:
4103 case FLOOR_DIV_EXPR
:
4106 case ROUND_DIV_EXPR
:
4109 case EXACT_DIV_EXPR
:
4112 case TRUNC_MOD_EXPR
:
4118 case FLOOR_MOD_EXPR
:
4121 case ROUND_MOD_EXPR
:
4124 case PREDECREMENT_EXPR
:
4127 case PREINCREMENT_EXPR
:
4130 case POSTDECREMENT_EXPR
:
4133 case POSTINCREMENT_EXPR
:
4143 return "<<< ??? >>>";
4147 /* Return the symbol associated with operator OP. */
4150 op_symbol (const_tree op
)
4152 return op_symbol_code (TREE_CODE (op
));
4155 /* Prints the name of a call. NODE is the CALL_EXPR_FN of a CALL_EXPR or
4156 the gimple_call_fn of a GIMPLE_CALL. */
4159 print_call_name (pretty_printer
*pp
, tree node
, dump_flags_t flags
)
4163 if (TREE_CODE (op0
) == NON_LVALUE_EXPR
)
4164 op0
= TREE_OPERAND (op0
, 0);
4167 switch (TREE_CODE (op0
))
4172 dump_function_name (pp
, op0
, flags
);
4178 op0
= TREE_OPERAND (op0
, 0);
4183 dump_generic_node (pp
, TREE_OPERAND (op0
, 0), 0, flags
, false);
4184 pp_string (pp
, ") ? ");
4185 dump_generic_node (pp
, TREE_OPERAND (op0
, 1), 0, flags
, false);
4186 pp_string (pp
, " : ");
4187 dump_generic_node (pp
, TREE_OPERAND (op0
, 2), 0, flags
, false);
4191 if (TREE_CODE (TREE_OPERAND (op0
, 0)) == VAR_DECL
)
4192 dump_function_name (pp
, TREE_OPERAND (op0
, 0), flags
);
4194 dump_generic_node (pp
, op0
, 0, flags
, false);
4198 if (integer_zerop (TREE_OPERAND (op0
, 1)))
4200 op0
= TREE_OPERAND (op0
, 0);
4207 dump_generic_node (pp
, op0
, 0, flags
, false);
4215 /* Print the first N characters in the array STR, replacing non-printable
4216 characters (including embedded nuls) with unambiguous escape sequences. */
4219 pretty_print_string (pretty_printer
*pp
, const char *str
, size_t n
)
4224 for ( ; n
; --n
, ++str
)
4229 pp_string (pp
, "\\b");
4233 pp_string (pp
, "\\f");
4237 pp_string (pp
, "\\n");
4241 pp_string (pp
, "\\r");
4245 pp_string (pp
, "\\t");
4249 pp_string (pp
, "\\v");
4253 pp_string (pp
, "\\\\");
4257 pp_string (pp
, "\\\"");
4261 pp_string (pp
, "\\'");
4265 if (str
[0] || n
> 1)
4267 if (!ISPRINT (str
[0]))
4270 sprintf (buf
, "\\x%02x", (unsigned char)str
[0]);
4271 pp_string (pp
, buf
);
4274 pp_character (pp
, str
[0]);
4282 maybe_init_pretty_print (FILE *file
)
4286 tree_pp
= new pretty_printer ();
4287 pp_needs_newline (tree_pp
) = true;
4288 pp_translate_identifiers (tree_pp
) = false;
4291 tree_pp
->buffer
->stream
= file
;
4295 newline_and_indent (pretty_printer
*pp
, int spc
)
4301 /* Handle the %K format for TEXT. Separate from default_tree_printer
4302 so it can also be used in front ends.
4303 The location LOC and BLOCK are expected to be extracted by the caller
4304 from the %K argument arg via EXPR_LOCATION(arg) and TREE_BLOCK(arg). */
4307 percent_K_format (text_info
*text
, location_t loc
, tree block
)
4309 text
->set_location (0, loc
, SHOW_RANGE_WITH_CARET
);
4310 gcc_assert (pp_ti_abstract_origin (text
) != NULL
);
4311 *pp_ti_abstract_origin (text
) = NULL
;
4314 && TREE_CODE (block
) == BLOCK
4315 && BLOCK_ABSTRACT_ORIGIN (block
))
4317 tree ao
= BLOCK_ABSTRACT_ORIGIN (block
);
4318 if (TREE_CODE (ao
) == FUNCTION_DECL
)
4320 *pp_ti_abstract_origin (text
) = block
;
4323 block
= BLOCK_SUPERCONTEXT (block
);
4327 /* Print the identifier ID to PRETTY-PRINTER. */
4330 pp_tree_identifier (pretty_printer
*pp
, tree id
)
4332 if (pp_translate_identifiers (pp
))
4334 const char *text
= identifier_to_locale (IDENTIFIER_POINTER (id
));
4335 pp_append_text (pp
, text
, text
+ strlen (text
));
4338 pp_append_text (pp
, IDENTIFIER_POINTER (id
),
4339 IDENTIFIER_POINTER (id
) + IDENTIFIER_LENGTH (id
));
4342 /* A helper function that is used to dump function information before the
4346 dump_function_header (FILE *dump_file
, tree fdecl
, dump_flags_t flags
)
4348 const char *dname
, *aname
;
4349 struct cgraph_node
*node
= cgraph_node::get (fdecl
);
4350 struct function
*fun
= DECL_STRUCT_FUNCTION (fdecl
);
4352 dname
= lang_hooks
.decl_printable_name (fdecl
, 1);
4354 if (DECL_ASSEMBLER_NAME_SET_P (fdecl
))
4355 aname
= (IDENTIFIER_POINTER
4356 (DECL_ASSEMBLER_NAME (fdecl
)));
4358 aname
= "<unset-asm-name>";
4360 fprintf (dump_file
, "\n;; Function %s (%s, funcdef_no=%d",
4361 dname
, aname
, fun
->funcdef_no
);
4362 if (!(flags
& TDF_NOUID
))
4363 fprintf (dump_file
, ", decl_uid=%d", DECL_UID (fdecl
));
4366 fprintf (dump_file
, ", cgraph_uid=%d", node
->get_uid ());
4367 fprintf (dump_file
, ", symbol_order=%d)%s\n\n", node
->order
,
4368 node
->frequency
== NODE_FREQUENCY_HOT
4370 : node
->frequency
== NODE_FREQUENCY_UNLIKELY_EXECUTED
4371 ? " (unlikely executed)"
4372 : node
->frequency
== NODE_FREQUENCY_EXECUTED_ONCE
4373 ? " (executed once)"
4377 fprintf (dump_file
, ")\n\n");
4380 /* Dump double_int D to pretty_printer PP. UNS is true
4381 if D is unsigned and false otherwise. */
4383 pp_double_int (pretty_printer
*pp
, double_int d
, bool uns
)
4386 pp_wide_integer (pp
, d
.low
);
4387 else if (d
.fits_uhwi ())
4388 pp_unsigned_wide_integer (pp
, d
.low
);
4391 unsigned HOST_WIDE_INT low
= d
.low
;
4392 HOST_WIDE_INT high
= d
.high
;
4393 if (!uns
&& d
.is_negative ())
4396 high
= ~high
+ !low
;
4399 /* Would "%x%0*x" or "%x%*0x" get zero-padding on all
4401 sprintf (pp_buffer (pp
)->digit_buffer
,
4402 HOST_WIDE_INT_PRINT_DOUBLE_HEX
,
4403 (unsigned HOST_WIDE_INT
) high
, low
);
4404 pp_string (pp
, pp_buffer (pp
)->digit_buffer
);
4409 # pragma GCC diagnostic pop