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
) == BOOLEAN_TYPE
)
1766 pp_string (pp
, (TYPE_UNSIGNED (node
)
1767 ? "<unsigned-boolean:"
1768 : "<signed-boolean:"));
1769 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1772 else if (TREE_CODE (node
) == VOID_TYPE
)
1773 pp_string (pp
, "void");
1775 pp_string (pp
, "<unnamed type>");
1781 case REFERENCE_TYPE
:
1782 str
= (TREE_CODE (node
) == POINTER_TYPE
? "*" : "&");
1784 if (TREE_TYPE (node
) == NULL
)
1786 pp_string (pp
, str
);
1787 pp_string (pp
, "<null type>");
1789 else if (TREE_CODE (TREE_TYPE (node
)) == FUNCTION_TYPE
)
1791 tree fnode
= TREE_TYPE (node
);
1793 dump_generic_node (pp
, TREE_TYPE (fnode
), spc
, flags
, false);
1796 pp_string (pp
, str
);
1797 if (TYPE_IDENTIFIER (node
))
1798 dump_generic_node (pp
, TYPE_NAME (node
), spc
, flags
, false);
1799 else if (flags
& TDF_NOUID
)
1800 pp_printf (pp
, "<Txxxx>");
1802 pp_printf (pp
, "<T%x>", TYPE_UID (node
));
1804 pp_right_paren (pp
);
1805 dump_function_declaration (pp
, fnode
, spc
, flags
);
1809 unsigned int quals
= TYPE_QUALS (node
);
1811 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1813 pp_string (pp
, str
);
1815 if (quals
& TYPE_QUAL_CONST
)
1816 pp_string (pp
, " const");
1817 if (quals
& TYPE_QUAL_VOLATILE
)
1818 pp_string (pp
, " volatile");
1819 if (quals
& TYPE_QUAL_RESTRICT
)
1820 pp_string (pp
, " restrict");
1822 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
1824 pp_string (pp
, " <address-space-");
1825 pp_decimal_int (pp
, TYPE_ADDR_SPACE (node
));
1829 if (TYPE_REF_CAN_ALIAS_ALL (node
))
1830 pp_string (pp
, " {ref-all}");
1839 dump_mem_ref (pp
, node
, spc
, flags
);
1842 case TARGET_MEM_REF
:
1844 const char *sep
= "";
1847 pp_string (pp
, "MEM[");
1849 if (TREE_CODE (TMR_BASE (node
)) == ADDR_EXPR
)
1851 pp_string (pp
, sep
);
1853 pp_string (pp
, "symbol: ");
1854 dump_generic_node (pp
, TREE_OPERAND (TMR_BASE (node
), 0),
1859 pp_string (pp
, sep
);
1861 pp_string (pp
, "base: ");
1862 dump_generic_node (pp
, TMR_BASE (node
), spc
, flags
, false);
1864 tmp
= TMR_INDEX2 (node
);
1867 pp_string (pp
, sep
);
1869 pp_string (pp
, "base: ");
1870 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1872 tmp
= TMR_INDEX (node
);
1875 pp_string (pp
, sep
);
1877 pp_string (pp
, "index: ");
1878 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1880 tmp
= TMR_STEP (node
);
1883 pp_string (pp
, sep
);
1885 pp_string (pp
, "step: ");
1886 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1888 tmp
= TMR_OFFSET (node
);
1891 pp_string (pp
, sep
);
1893 pp_string (pp
, "offset: ");
1894 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1896 pp_right_bracket (pp
);
1902 unsigned int quals
= TYPE_QUALS (node
);
1905 if (quals
& TYPE_QUAL_ATOMIC
)
1906 pp_string (pp
, "atomic ");
1907 if (quals
& TYPE_QUAL_CONST
)
1908 pp_string (pp
, "const ");
1909 if (quals
& TYPE_QUAL_VOLATILE
)
1910 pp_string (pp
, "volatile ");
1912 /* Print the innermost component type. */
1913 for (tmp
= TREE_TYPE (node
); TREE_CODE (tmp
) == ARRAY_TYPE
;
1914 tmp
= TREE_TYPE (tmp
))
1916 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1918 /* Print the dimensions. */
1919 for (tmp
= node
; TREE_CODE (tmp
) == ARRAY_TYPE
; tmp
= TREE_TYPE (tmp
))
1920 dump_array_domain (pp
, TYPE_DOMAIN (tmp
), spc
, flags
);
1926 case QUAL_UNION_TYPE
:
1928 unsigned int quals
= TYPE_QUALS (node
);
1930 if (quals
& TYPE_QUAL_ATOMIC
)
1931 pp_string (pp
, "atomic ");
1932 if (quals
& TYPE_QUAL_CONST
)
1933 pp_string (pp
, "const ");
1934 if (quals
& TYPE_QUAL_VOLATILE
)
1935 pp_string (pp
, "volatile ");
1937 /* Print the name of the structure. */
1938 if (TREE_CODE (node
) == RECORD_TYPE
)
1939 pp_string (pp
, "struct ");
1940 else if (TREE_CODE (node
) == UNION_TYPE
)
1941 pp_string (pp
, "union ");
1943 if (TYPE_NAME (node
))
1944 dump_generic_node (pp
, TYPE_NAME (node
), spc
, flags
, false);
1945 else if (!(flags
& TDF_SLIM
))
1946 /* FIXME: If we eliminate the 'else' above and attempt
1947 to show the fields for named types, we may get stuck
1948 following a cycle of pointers to structs. The alleged
1949 self-reference check in print_struct_decl will not detect
1950 cycles involving more than one pointer or struct type. */
1951 print_struct_decl (pp
, node
, spc
, flags
);
1960 if (flags
& TDF_GIMPLE
1961 && (POINTER_TYPE_P (TREE_TYPE (node
))
1962 || (TYPE_PRECISION (TREE_TYPE (node
))
1963 < TYPE_PRECISION (integer_type_node
))
1964 || exact_log2 (TYPE_PRECISION (TREE_TYPE (node
))) == -1
1965 || tree_int_cst_sgn (node
) < 0))
1967 pp_string (pp
, "_Literal (");
1968 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1969 pp_string (pp
, ") ");
1971 if (TREE_CODE (TREE_TYPE (node
)) == POINTER_TYPE
1972 && ! (flags
& TDF_GIMPLE
))
1974 /* In the case of a pointer, one may want to divide by the
1975 size of the pointed-to type. Unfortunately, this not
1976 straightforward. The C front-end maps expressions
1981 in such a way that the two INTEGER_CST nodes for "5" have
1982 different values but identical types. In the latter
1983 case, the 5 is multiplied by sizeof (int) in c-common.c
1984 (pointer_int_sum) to convert it to a byte address, and
1985 yet the type of the node is left unchanged. Argh. What
1986 is consistent though is that the number value corresponds
1987 to bytes (UNITS) offset.
1989 NB: Neither of the following divisors can be trivially
1990 used to recover the original literal:
1992 TREE_INT_CST_LOW (TYPE_SIZE_UNIT (TREE_TYPE (node)))
1993 TYPE_PRECISION (TREE_TYPE (TREE_TYPE (node))) */
1994 pp_wide_integer (pp
, TREE_INT_CST_LOW (node
));
1995 pp_string (pp
, "B"); /* pseudo-unit */
1997 else if (tree_fits_shwi_p (node
))
1998 pp_wide_integer (pp
, tree_to_shwi (node
));
1999 else if (tree_fits_uhwi_p (node
))
2000 pp_unsigned_wide_integer (pp
, tree_to_uhwi (node
));
2003 wide_int val
= wi::to_wide (node
);
2005 if (wi::neg_p (val
, TYPE_SIGN (TREE_TYPE (node
))))
2010 print_hex (val
, pp_buffer (pp
)->digit_buffer
);
2011 pp_string (pp
, pp_buffer (pp
)->digit_buffer
);
2013 if ((flags
& TDF_GIMPLE
)
2014 && ! (POINTER_TYPE_P (TREE_TYPE (node
))
2015 || (TYPE_PRECISION (TREE_TYPE (node
))
2016 < TYPE_PRECISION (integer_type_node
))
2017 || exact_log2 (TYPE_PRECISION (TREE_TYPE (node
))) == -1))
2019 if (TYPE_UNSIGNED (TREE_TYPE (node
)))
2020 pp_character (pp
, 'u');
2021 if (TYPE_PRECISION (TREE_TYPE (node
))
2022 == TYPE_PRECISION (unsigned_type_node
))
2024 else if (TYPE_PRECISION (TREE_TYPE (node
))
2025 == TYPE_PRECISION (long_unsigned_type_node
))
2026 pp_character (pp
, 'l');
2027 else if (TYPE_PRECISION (TREE_TYPE (node
))
2028 == TYPE_PRECISION (long_long_unsigned_type_node
))
2029 pp_string (pp
, "ll");
2031 if (TREE_OVERFLOW (node
))
2032 pp_string (pp
, "(OVF)");
2036 pp_string (pp
, "POLY_INT_CST [");
2037 dump_generic_node (pp
, POLY_INT_CST_COEFF (node
, 0), spc
, flags
, false);
2038 for (unsigned int i
= 1; i
< NUM_POLY_INT_COEFFS
; ++i
)
2040 pp_string (pp
, ", ");
2041 dump_generic_node (pp
, POLY_INT_CST_COEFF (node
, i
),
2044 pp_string (pp
, "]");
2048 /* Code copied from print_node. */
2051 if (TREE_OVERFLOW (node
))
2052 pp_string (pp
, " overflow");
2054 d
= TREE_REAL_CST (node
);
2055 if (REAL_VALUE_ISINF (d
))
2056 pp_string (pp
, REAL_VALUE_NEGATIVE (d
) ? " -Inf" : " Inf");
2057 else if (REAL_VALUE_ISNAN (d
))
2058 pp_string (pp
, " Nan");
2062 real_to_decimal (string
, &d
, sizeof (string
), 0, 1);
2063 pp_string (pp
, string
);
2071 fixed_to_decimal (string
, TREE_FIXED_CST_PTR (node
), sizeof (string
));
2072 pp_string (pp
, string
);
2077 pp_string (pp
, "__complex__ (");
2078 dump_generic_node (pp
, TREE_REALPART (node
), spc
, flags
, false);
2079 pp_string (pp
, ", ");
2080 dump_generic_node (pp
, TREE_IMAGPART (node
), spc
, flags
, false);
2081 pp_right_paren (pp
);
2086 pp_string (pp
, "\"");
2087 if (unsigned nbytes
= TREE_STRING_LENGTH (node
))
2088 pretty_print_string (pp
, TREE_STRING_POINTER (node
), nbytes
);
2089 pp_string (pp
, "\"");
2096 if (flags
& TDF_GIMPLE
)
2098 pp_string (pp
, "_Literal (");
2099 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2100 pp_string (pp
, ") ");
2102 pp_string (pp
, "{ ");
2103 unsigned HOST_WIDE_INT nunits
;
2104 if (!VECTOR_CST_NELTS (node
).is_constant (&nunits
))
2105 nunits
= vector_cst_encoded_nelts (node
);
2106 for (i
= 0; i
< nunits
; ++i
)
2109 pp_string (pp
, ", ");
2110 dump_generic_node (pp
, VECTOR_CST_ELT (node
, i
),
2113 if (!VECTOR_CST_NELTS (node
).is_constant ())
2114 pp_string (pp
, ", ...");
2115 pp_string (pp
, " }");
2121 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2123 if (TREE_CODE (node
) == METHOD_TYPE
)
2125 if (TYPE_METHOD_BASETYPE (node
))
2126 dump_generic_node (pp
, TYPE_NAME (TYPE_METHOD_BASETYPE (node
)),
2129 pp_string (pp
, "<null method basetype>");
2130 pp_colon_colon (pp
);
2132 if (TYPE_IDENTIFIER (node
))
2133 dump_generic_node (pp
, TYPE_NAME (node
), spc
, flags
, false);
2134 else if (TYPE_NAME (node
) && DECL_NAME (TYPE_NAME (node
)))
2135 dump_decl_name (pp
, TYPE_NAME (node
), flags
);
2136 else if (flags
& TDF_NOUID
)
2137 pp_printf (pp
, "<Txxxx>");
2139 pp_printf (pp
, "<T%x>", TYPE_UID (node
));
2140 dump_function_declaration (pp
, node
, spc
, flags
);
2145 dump_decl_name (pp
, node
, flags
);
2149 if (DECL_NAME (node
))
2150 dump_decl_name (pp
, node
, flags
);
2151 else if (LABEL_DECL_UID (node
) != -1)
2153 if (flags
& TDF_GIMPLE
)
2154 pp_printf (pp
, "L%d", (int) LABEL_DECL_UID (node
));
2156 pp_printf (pp
, "<L%d>", (int) LABEL_DECL_UID (node
));
2160 if (flags
& TDF_NOUID
)
2161 pp_string (pp
, "<D.xxxx>");
2164 if (flags
& TDF_GIMPLE
)
2165 pp_printf (pp
, "<D%u>", DECL_UID (node
));
2167 pp_printf (pp
, "<D.%u>", DECL_UID (node
));
2173 if (DECL_IS_BUILTIN (node
))
2175 /* Don't print the declaration of built-in types. */
2178 if (DECL_NAME (node
))
2179 dump_decl_name (pp
, node
, flags
);
2180 else if (TYPE_NAME (TREE_TYPE (node
)) != node
)
2182 pp_string (pp
, (TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
2183 ? "union" : "struct "));
2184 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2187 pp_string (pp
, "<anon>");
2193 case DEBUG_EXPR_DECL
:
2194 case NAMESPACE_DECL
:
2196 dump_decl_name (pp
, node
, flags
);
2200 pp_string (pp
, "<retval>");
2204 op0
= TREE_OPERAND (node
, 0);
2207 && (TREE_CODE (op0
) == INDIRECT_REF
2208 || (TREE_CODE (op0
) == MEM_REF
2209 && TREE_CODE (TREE_OPERAND (op0
, 0)) != ADDR_EXPR
2210 && integer_zerop (TREE_OPERAND (op0
, 1))
2211 /* Dump the types of INTEGER_CSTs explicitly, for we
2212 can't infer them and MEM_ATTR caching will share
2213 MEM_REFs with differently-typed op0s. */
2214 && TREE_CODE (TREE_OPERAND (op0
, 0)) != INTEGER_CST
2215 /* Released SSA_NAMES have no TREE_TYPE. */
2216 && TREE_TYPE (TREE_OPERAND (op0
, 0)) != NULL_TREE
2217 /* Same pointer types, but ignoring POINTER_TYPE vs.
2219 && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 0)))
2220 == TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 1))))
2221 && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0
, 0)))
2222 == TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0
, 1))))
2223 && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0
, 0)))
2224 == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0
, 1))))
2225 /* Same value types ignoring qualifiers. */
2226 && (TYPE_MAIN_VARIANT (TREE_TYPE (op0
))
2227 == TYPE_MAIN_VARIANT
2228 (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 1)))))
2229 && MR_DEPENDENCE_CLIQUE (op0
) == 0)))
2231 op0
= TREE_OPERAND (op0
, 0);
2234 if (op_prio (op0
) < op_prio (node
))
2236 dump_generic_node (pp
, op0
, spc
, flags
, false);
2237 if (op_prio (op0
) < op_prio (node
))
2238 pp_right_paren (pp
);
2239 pp_string (pp
, str
);
2240 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2241 op0
= component_ref_field_offset (node
);
2242 if (op0
&& TREE_CODE (op0
) != INTEGER_CST
)
2244 pp_string (pp
, "{off: ");
2245 dump_generic_node (pp
, op0
, spc
, flags
, false);
2246 pp_right_brace (pp
);
2251 if (flags
& TDF_GIMPLE
)
2253 pp_string (pp
, "__BIT_FIELD_REF <");
2254 dump_generic_node (pp
, TREE_TYPE (node
),
2255 spc
, flags
| TDF_SLIM
, false);
2256 if (TYPE_ALIGN (TREE_TYPE (node
))
2257 != TYPE_ALIGN (TYPE_MAIN_VARIANT (TREE_TYPE (node
))))
2259 pp_string (pp
, ", ");
2260 pp_decimal_int (pp
, TYPE_ALIGN (TREE_TYPE (node
)));
2263 pp_string (pp
, " (");
2264 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
,
2265 flags
| TDF_SLIM
, false);
2266 pp_string (pp
, ", ");
2267 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
,
2268 flags
| TDF_SLIM
, false);
2269 pp_string (pp
, ", ");
2270 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
,
2271 flags
| TDF_SLIM
, false);
2272 pp_right_paren (pp
);
2276 pp_string (pp
, "BIT_FIELD_REF <");
2277 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2278 pp_string (pp
, ", ");
2279 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2280 pp_string (pp
, ", ");
2281 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2286 case BIT_INSERT_EXPR
:
2287 pp_string (pp
, "BIT_INSERT_EXPR <");
2288 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2289 pp_string (pp
, ", ");
2290 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2291 pp_string (pp
, ", ");
2292 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2293 pp_string (pp
, " (");
2294 if (INTEGRAL_TYPE_P (TREE_TYPE (TREE_OPERAND (node
, 1))))
2296 TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (node
, 1))));
2298 dump_generic_node (pp
, TYPE_SIZE (TREE_TYPE (TREE_OPERAND (node
, 1))),
2300 pp_string (pp
, " bits)>");
2304 case ARRAY_RANGE_REF
:
2305 op0
= TREE_OPERAND (node
, 0);
2306 if (op_prio (op0
) < op_prio (node
))
2308 dump_generic_node (pp
, op0
, spc
, flags
, false);
2309 if (op_prio (op0
) < op_prio (node
))
2310 pp_right_paren (pp
);
2311 pp_left_bracket (pp
);
2312 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2313 if (TREE_CODE (node
) == ARRAY_RANGE_REF
)
2314 pp_string (pp
, " ...");
2315 pp_right_bracket (pp
);
2317 op0
= array_ref_low_bound (node
);
2318 op1
= array_ref_element_size (node
);
2320 if (!integer_zerop (op0
)
2321 || TREE_OPERAND (node
, 2)
2322 || TREE_OPERAND (node
, 3))
2324 pp_string (pp
, "{lb: ");
2325 dump_generic_node (pp
, op0
, spc
, flags
, false);
2326 pp_string (pp
, " sz: ");
2327 dump_generic_node (pp
, op1
, spc
, flags
, false);
2328 pp_right_brace (pp
);
2334 unsigned HOST_WIDE_INT ix
;
2336 bool is_struct_init
= false;
2337 bool is_array_init
= false;
2339 if (flags
& TDF_GIMPLE
)
2341 pp_string (pp
, "_Literal (");
2342 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2343 pp_string (pp
, ") ");
2346 if (TREE_CLOBBER_P (node
))
2347 pp_string (pp
, "CLOBBER");
2348 else if (TREE_CODE (TREE_TYPE (node
)) == RECORD_TYPE
2349 || TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
)
2350 is_struct_init
= true;
2351 else if (TREE_CODE (TREE_TYPE (node
)) == ARRAY_TYPE
2352 && TYPE_DOMAIN (TREE_TYPE (node
))
2353 && TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
)))
2354 && TREE_CODE (TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
))))
2357 tree minv
= TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
)));
2358 is_array_init
= true;
2359 curidx
= wi::to_widest (minv
);
2361 FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (node
), ix
, field
, val
)
2368 dump_generic_node (pp
, field
, spc
, flags
, false);
2371 else if (is_array_init
2372 && (TREE_CODE (field
) != INTEGER_CST
2373 || curidx
!= wi::to_widest (field
)))
2375 pp_left_bracket (pp
);
2376 if (TREE_CODE (field
) == RANGE_EXPR
)
2378 dump_generic_node (pp
, TREE_OPERAND (field
, 0), spc
,
2380 pp_string (pp
, " ... ");
2381 dump_generic_node (pp
, TREE_OPERAND (field
, 1), spc
,
2383 if (TREE_CODE (TREE_OPERAND (field
, 1)) == INTEGER_CST
)
2384 curidx
= wi::to_widest (TREE_OPERAND (field
, 1));
2387 dump_generic_node (pp
, field
, spc
, flags
, false);
2388 if (TREE_CODE (field
) == INTEGER_CST
)
2389 curidx
= wi::to_widest (field
);
2390 pp_string (pp
, "]=");
2395 if (val
&& TREE_CODE (val
) == ADDR_EXPR
)
2396 if (TREE_CODE (TREE_OPERAND (val
, 0)) == FUNCTION_DECL
)
2397 val
= TREE_OPERAND (val
, 0);
2398 if (val
&& TREE_CODE (val
) == FUNCTION_DECL
)
2399 dump_decl_name (pp
, val
, flags
);
2401 dump_generic_node (pp
, val
, spc
, flags
, false);
2402 if (ix
!= CONSTRUCTOR_NELTS (node
) - 1)
2408 pp_right_brace (pp
);
2415 if (flags
& TDF_SLIM
)
2417 pp_string (pp
, "<COMPOUND_EXPR>");
2421 dump_generic_node (pp
, TREE_OPERAND (node
, 0),
2422 spc
, flags
, !(flags
& TDF_SLIM
));
2423 if (flags
& TDF_SLIM
)
2424 newline_and_indent (pp
, spc
);
2431 for (tp
= &TREE_OPERAND (node
, 1);
2432 TREE_CODE (*tp
) == COMPOUND_EXPR
;
2433 tp
= &TREE_OPERAND (*tp
, 1))
2435 dump_generic_node (pp
, TREE_OPERAND (*tp
, 0),
2436 spc
, flags
, !(flags
& TDF_SLIM
));
2437 if (flags
& TDF_SLIM
)
2438 newline_and_indent (pp
, spc
);
2446 dump_generic_node (pp
, *tp
, spc
, flags
, !(flags
& TDF_SLIM
));
2450 case STATEMENT_LIST
:
2452 tree_stmt_iterator si
;
2455 if (flags
& TDF_SLIM
)
2457 pp_string (pp
, "<STATEMENT_LIST>");
2461 for (si
= tsi_start (node
); !tsi_end_p (si
); tsi_next (&si
))
2464 newline_and_indent (pp
, spc
);
2467 dump_generic_node (pp
, tsi_stmt (si
), spc
, flags
, true);
2474 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
,
2479 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
,
2484 pp_string (pp
, "TARGET_EXPR <");
2485 dump_generic_node (pp
, TARGET_EXPR_SLOT (node
), spc
, flags
, false);
2488 dump_generic_node (pp
, TARGET_EXPR_INITIAL (node
), spc
, flags
, false);
2493 print_declaration (pp
, DECL_EXPR_DECL (node
), spc
, flags
);
2498 if (TREE_TYPE (node
) == NULL
|| TREE_TYPE (node
) == void_type_node
)
2500 pp_string (pp
, "if (");
2501 dump_generic_node (pp
, COND_EXPR_COND (node
), spc
, flags
, false);
2502 pp_right_paren (pp
);
2503 /* The lowered cond_exprs should always be printed in full. */
2504 if (COND_EXPR_THEN (node
)
2505 && (IS_EMPTY_STMT (COND_EXPR_THEN (node
))
2506 || TREE_CODE (COND_EXPR_THEN (node
)) == GOTO_EXPR
)
2507 && COND_EXPR_ELSE (node
)
2508 && (IS_EMPTY_STMT (COND_EXPR_ELSE (node
))
2509 || TREE_CODE (COND_EXPR_ELSE (node
)) == GOTO_EXPR
))
2512 dump_generic_node (pp
, COND_EXPR_THEN (node
),
2514 if (!IS_EMPTY_STMT (COND_EXPR_ELSE (node
)))
2516 pp_string (pp
, " else ");
2517 dump_generic_node (pp
, COND_EXPR_ELSE (node
),
2521 else if (!(flags
& TDF_SLIM
))
2523 /* Output COND_EXPR_THEN. */
2524 if (COND_EXPR_THEN (node
))
2526 newline_and_indent (pp
, spc
+2);
2528 newline_and_indent (pp
, spc
+4);
2529 dump_generic_node (pp
, COND_EXPR_THEN (node
), spc
+4,
2531 newline_and_indent (pp
, spc
+2);
2532 pp_right_brace (pp
);
2535 /* Output COND_EXPR_ELSE. */
2536 if (COND_EXPR_ELSE (node
)
2537 && !IS_EMPTY_STMT (COND_EXPR_ELSE (node
)))
2539 newline_and_indent (pp
, spc
);
2540 pp_string (pp
, "else");
2541 newline_and_indent (pp
, spc
+2);
2543 newline_and_indent (pp
, spc
+4);
2544 dump_generic_node (pp
, COND_EXPR_ELSE (node
), spc
+4,
2546 newline_and_indent (pp
, spc
+2);
2547 pp_right_brace (pp
);
2554 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2558 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2562 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2568 if (!(flags
& TDF_SLIM
))
2570 if (BIND_EXPR_VARS (node
))
2574 for (op0
= BIND_EXPR_VARS (node
); op0
; op0
= DECL_CHAIN (op0
))
2576 print_declaration (pp
, op0
, spc
+2, flags
);
2581 newline_and_indent (pp
, spc
+2);
2582 dump_generic_node (pp
, BIND_EXPR_BODY (node
), spc
+2, flags
, true);
2583 newline_and_indent (pp
, spc
);
2584 pp_right_brace (pp
);
2590 if (CALL_EXPR_FN (node
) != NULL_TREE
)
2591 print_call_name (pp
, CALL_EXPR_FN (node
), flags
);
2595 pp_string (pp
, internal_fn_name (CALL_EXPR_IFN (node
)));
2598 /* Print parameters. */
2603 call_expr_arg_iterator iter
;
2604 FOR_EACH_CALL_EXPR_ARG (arg
, iter
, node
)
2606 dump_generic_node (pp
, arg
, spc
, flags
, false);
2607 if (more_call_expr_args_p (&iter
))
2614 if (CALL_EXPR_VA_ARG_PACK (node
))
2616 if (call_expr_nargs (node
) > 0)
2621 pp_string (pp
, "__builtin_va_arg_pack ()");
2623 pp_right_paren (pp
);
2625 op1
= CALL_EXPR_STATIC_CHAIN (node
);
2628 pp_string (pp
, " [static-chain: ");
2629 dump_generic_node (pp
, op1
, spc
, flags
, false);
2630 pp_right_bracket (pp
);
2633 if (CALL_EXPR_RETURN_SLOT_OPT (node
))
2634 pp_string (pp
, " [return slot optimization]");
2635 if (CALL_EXPR_TAILCALL (node
))
2636 pp_string (pp
, " [tail call]");
2639 case WITH_CLEANUP_EXPR
:
2643 case CLEANUP_POINT_EXPR
:
2644 pp_string (pp
, "<<cleanup_point ");
2645 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2646 pp_string (pp
, ">>");
2649 case PLACEHOLDER_EXPR
:
2650 pp_string (pp
, "<PLACEHOLDER_EXPR ");
2651 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2655 /* Binary arithmetic and logic expressions. */
2656 case WIDEN_SUM_EXPR
:
2657 case WIDEN_MULT_EXPR
:
2659 case MULT_HIGHPART_EXPR
:
2661 case POINTER_PLUS_EXPR
:
2662 case POINTER_DIFF_EXPR
:
2664 case TRUNC_DIV_EXPR
:
2666 case FLOOR_DIV_EXPR
:
2667 case ROUND_DIV_EXPR
:
2668 case TRUNC_MOD_EXPR
:
2670 case FLOOR_MOD_EXPR
:
2671 case ROUND_MOD_EXPR
:
2673 case EXACT_DIV_EXPR
:
2678 case WIDEN_LSHIFT_EXPR
:
2682 case TRUTH_ANDIF_EXPR
:
2683 case TRUTH_ORIF_EXPR
:
2684 case TRUTH_AND_EXPR
:
2686 case TRUTH_XOR_EXPR
:
2700 case UNORDERED_EXPR
:
2702 const char *op
= op_symbol (node
);
2703 op0
= TREE_OPERAND (node
, 0);
2704 op1
= TREE_OPERAND (node
, 1);
2706 /* When the operands are expressions with less priority,
2707 keep semantics of the tree representation. */
2708 if (op_prio (op0
) <= op_prio (node
))
2711 dump_generic_node (pp
, op0
, spc
, flags
, false);
2712 pp_right_paren (pp
);
2715 dump_generic_node (pp
, op0
, spc
, flags
, false);
2721 /* When the operands are expressions with less priority,
2722 keep semantics of the tree representation. */
2723 if (op_prio (op1
) <= op_prio (node
))
2726 dump_generic_node (pp
, op1
, spc
, flags
, false);
2727 pp_right_paren (pp
);
2730 dump_generic_node (pp
, op1
, spc
, flags
, false);
2734 /* Unary arithmetic and logic expressions. */
2737 case TRUTH_NOT_EXPR
:
2739 case PREDECREMENT_EXPR
:
2740 case PREINCREMENT_EXPR
:
2742 if (TREE_CODE (node
) == ADDR_EXPR
2743 && (TREE_CODE (TREE_OPERAND (node
, 0)) == STRING_CST
2744 || TREE_CODE (TREE_OPERAND (node
, 0)) == FUNCTION_DECL
))
2745 ; /* Do not output '&' for strings and function pointers. */
2747 pp_string (pp
, op_symbol (node
));
2749 if (op_prio (TREE_OPERAND (node
, 0)) < op_prio (node
))
2752 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2753 pp_right_paren (pp
);
2756 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2759 case POSTDECREMENT_EXPR
:
2760 case POSTINCREMENT_EXPR
:
2761 if (op_prio (TREE_OPERAND (node
, 0)) < op_prio (node
))
2764 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2765 pp_right_paren (pp
);
2768 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2769 pp_string (pp
, op_symbol (node
));
2773 pp_string (pp
, "MIN_EXPR <");
2774 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2775 pp_string (pp
, ", ");
2776 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2781 pp_string (pp
, "MAX_EXPR <");
2782 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2783 pp_string (pp
, ", ");
2784 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2789 pp_string (pp
, "ABS_EXPR <");
2790 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2795 pp_string (pp
, "ABSU_EXPR <");
2796 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2804 case ADDR_SPACE_CONVERT_EXPR
:
2805 case FIXED_CONVERT_EXPR
:
2806 case FIX_TRUNC_EXPR
:
2809 type
= TREE_TYPE (node
);
2810 op0
= TREE_OPERAND (node
, 0);
2811 if (type
!= TREE_TYPE (op0
))
2814 dump_generic_node (pp
, type
, spc
, flags
, false);
2815 pp_string (pp
, ") ");
2817 if (op_prio (op0
) < op_prio (node
))
2819 dump_generic_node (pp
, op0
, spc
, flags
, false);
2820 if (op_prio (op0
) < op_prio (node
))
2821 pp_right_paren (pp
);
2824 case VIEW_CONVERT_EXPR
:
2825 if (flags
& TDF_GIMPLE
)
2826 pp_string (pp
, "__VIEW_CONVERT <");
2828 pp_string (pp
, "VIEW_CONVERT_EXPR<");
2829 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2830 pp_string (pp
, ">(");
2831 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2832 pp_right_paren (pp
);
2836 pp_string (pp
, "((");
2837 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2838 pp_string (pp
, "))");
2841 case NON_LVALUE_EXPR
:
2842 pp_string (pp
, "NON_LVALUE_EXPR <");
2843 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2848 pp_string (pp
, "SAVE_EXPR <");
2849 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2854 pp_string (pp
, "COMPLEX_EXPR <");
2855 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2856 pp_string (pp
, ", ");
2857 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2862 pp_string (pp
, "CONJ_EXPR <");
2863 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2868 if (flags
& TDF_GIMPLE
)
2870 pp_string (pp
, "__real ");
2871 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2875 pp_string (pp
, "REALPART_EXPR <");
2876 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2882 if (flags
& TDF_GIMPLE
)
2884 pp_string (pp
, "__imag ");
2885 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2889 pp_string (pp
, "IMAGPART_EXPR <");
2890 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2896 pp_string (pp
, "VA_ARG_EXPR <");
2897 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2901 case TRY_FINALLY_EXPR
:
2902 case TRY_CATCH_EXPR
:
2903 pp_string (pp
, "try");
2904 newline_and_indent (pp
, spc
+2);
2906 newline_and_indent (pp
, spc
+4);
2907 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
+4, flags
, true);
2908 newline_and_indent (pp
, spc
+2);
2909 pp_right_brace (pp
);
2910 newline_and_indent (pp
, spc
);
2911 if (TREE_CODE (node
) == TRY_CATCH_EXPR
)
2913 node
= TREE_OPERAND (node
, 1);
2914 pp_string (pp
, "catch");
2918 gcc_assert (TREE_CODE (node
) == TRY_FINALLY_EXPR
);
2919 node
= TREE_OPERAND (node
, 1);
2920 pp_string (pp
, "finally");
2921 if (TREE_CODE (node
) == EH_ELSE_EXPR
)
2923 newline_and_indent (pp
, spc
+2);
2925 newline_and_indent (pp
, spc
+4);
2926 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
+4,
2928 newline_and_indent (pp
, spc
+2);
2929 pp_right_brace (pp
);
2930 newline_and_indent (pp
, spc
);
2931 node
= TREE_OPERAND (node
, 1);
2932 pp_string (pp
, "else");
2935 newline_and_indent (pp
, spc
+2);
2937 newline_and_indent (pp
, spc
+4);
2938 dump_generic_node (pp
, node
, spc
+4, flags
, true);
2939 newline_and_indent (pp
, spc
+2);
2940 pp_right_brace (pp
);
2945 pp_string (pp
, "catch (");
2946 dump_generic_node (pp
, CATCH_TYPES (node
), spc
+2, flags
, false);
2947 pp_right_paren (pp
);
2948 newline_and_indent (pp
, spc
+2);
2950 newline_and_indent (pp
, spc
+4);
2951 dump_generic_node (pp
, CATCH_BODY (node
), spc
+4, flags
, true);
2952 newline_and_indent (pp
, spc
+2);
2953 pp_right_brace (pp
);
2957 case EH_FILTER_EXPR
:
2958 pp_string (pp
, "<<<eh_filter (");
2959 dump_generic_node (pp
, EH_FILTER_TYPES (node
), spc
+2, flags
, false);
2960 pp_string (pp
, ")>>>");
2961 newline_and_indent (pp
, spc
+2);
2963 newline_and_indent (pp
, spc
+4);
2964 dump_generic_node (pp
, EH_FILTER_FAILURE (node
), spc
+4, flags
, true);
2965 newline_and_indent (pp
, spc
+2);
2966 pp_right_brace (pp
);
2971 op0
= TREE_OPERAND (node
, 0);
2972 /* If this is for break or continue, don't bother printing it. */
2973 if (DECL_NAME (op0
))
2975 const char *name
= IDENTIFIER_POINTER (DECL_NAME (op0
));
2976 if (strcmp (name
, "break") == 0
2977 || strcmp (name
, "continue") == 0)
2980 dump_generic_node (pp
, op0
, spc
, flags
, false);
2982 if (DECL_NONLOCAL (op0
))
2983 pp_string (pp
, " [non-local]");
2987 pp_string (pp
, "while (1)");
2988 if (!(flags
& TDF_SLIM
))
2990 newline_and_indent (pp
, spc
+2);
2992 newline_and_indent (pp
, spc
+4);
2993 dump_generic_node (pp
, LOOP_EXPR_BODY (node
), spc
+4, flags
, true);
2994 newline_and_indent (pp
, spc
+2);
2995 pp_right_brace (pp
);
3001 pp_string (pp
, "// predicted ");
3002 if (PREDICT_EXPR_OUTCOME (node
))
3003 pp_string (pp
, "likely by ");
3005 pp_string (pp
, "unlikely by ");
3006 pp_string (pp
, predictor_name (PREDICT_EXPR_PREDICTOR (node
)));
3007 pp_string (pp
, " predictor.");
3011 pp_string (pp
, "ANNOTATE_EXPR <");
3012 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3013 switch ((enum annot_expr_kind
) TREE_INT_CST_LOW (TREE_OPERAND (node
, 1)))
3015 case annot_expr_ivdep_kind
:
3016 pp_string (pp
, ", ivdep");
3018 case annot_expr_unroll_kind
:
3019 pp_printf (pp
, ", unroll %d",
3020 (int) TREE_INT_CST_LOW (TREE_OPERAND (node
, 2)));
3022 case annot_expr_no_vector_kind
:
3023 pp_string (pp
, ", no-vector");
3025 case annot_expr_vector_kind
:
3026 pp_string (pp
, ", vector");
3028 case annot_expr_parallel_kind
:
3029 pp_string (pp
, ", parallel");
3038 pp_string (pp
, "return");
3039 op0
= TREE_OPERAND (node
, 0);
3043 if (TREE_CODE (op0
) == MODIFY_EXPR
)
3044 dump_generic_node (pp
, TREE_OPERAND (op0
, 1),
3047 dump_generic_node (pp
, op0
, spc
, flags
, false);
3052 pp_string (pp
, "if (");
3053 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3054 pp_string (pp
, ") break");
3058 pp_string (pp
, "switch (");
3059 dump_generic_node (pp
, SWITCH_COND (node
), spc
, flags
, false);
3060 pp_right_paren (pp
);
3061 if (!(flags
& TDF_SLIM
))
3063 newline_and_indent (pp
, spc
+2);
3065 if (SWITCH_BODY (node
))
3067 newline_and_indent (pp
, spc
+4);
3068 dump_generic_node (pp
, SWITCH_BODY (node
), spc
+4, flags
,
3071 newline_and_indent (pp
, spc
+2);
3072 pp_right_brace (pp
);
3078 op0
= GOTO_DESTINATION (node
);
3079 if (TREE_CODE (op0
) != SSA_NAME
&& DECL_P (op0
) && DECL_NAME (op0
))
3081 const char *name
= IDENTIFIER_POINTER (DECL_NAME (op0
));
3082 if (strcmp (name
, "break") == 0
3083 || strcmp (name
, "continue") == 0)
3085 pp_string (pp
, name
);
3089 pp_string (pp
, "goto ");
3090 dump_generic_node (pp
, op0
, spc
, flags
, false);
3094 pp_string (pp
, "__asm__");
3095 if (ASM_VOLATILE_P (node
))
3096 pp_string (pp
, " __volatile__");
3098 dump_generic_node (pp
, ASM_STRING (node
), spc
, flags
, false);
3100 dump_generic_node (pp
, ASM_OUTPUTS (node
), spc
, flags
, false);
3102 dump_generic_node (pp
, ASM_INPUTS (node
), spc
, flags
, false);
3103 if (ASM_CLOBBERS (node
))
3106 dump_generic_node (pp
, ASM_CLOBBERS (node
), spc
, flags
, false);
3108 pp_right_paren (pp
);
3111 case CASE_LABEL_EXPR
:
3112 if (CASE_LOW (node
) && CASE_HIGH (node
))
3114 pp_string (pp
, "case ");
3115 dump_generic_node (pp
, CASE_LOW (node
), spc
, flags
, false);
3116 pp_string (pp
, " ... ");
3117 dump_generic_node (pp
, CASE_HIGH (node
), spc
, flags
, false);
3119 else if (CASE_LOW (node
))
3121 pp_string (pp
, "case ");
3122 dump_generic_node (pp
, CASE_LOW (node
), spc
, flags
, false);
3125 pp_string (pp
, "default");
3130 pp_string (pp
, "OBJ_TYPE_REF(");
3131 dump_generic_node (pp
, OBJ_TYPE_REF_EXPR (node
), spc
, flags
, false);
3133 /* We omit the class type for -fcompare-debug because we may
3134 drop TYPE_BINFO early depending on debug info, and then
3135 virtual_method_call_p would return false, whereas when
3136 TYPE_BINFO is preserved it may still return true and then
3137 we'd print the class type. Compare tree and rtl dumps for
3138 libstdc++-prettyprinters/shared_ptr.cc with and without -g,
3139 for example, at occurrences of OBJ_TYPE_REF. */
3140 if (!(flags
& (TDF_SLIM
| TDF_COMPARE_DEBUG
))
3141 && virtual_method_call_p (node
))
3143 pp_string (pp
, "(");
3144 dump_generic_node (pp
, obj_type_ref_class (node
), spc
, flags
, false);
3145 pp_string (pp
, ")");
3147 dump_generic_node (pp
, OBJ_TYPE_REF_OBJECT (node
), spc
, flags
, false);
3149 dump_generic_node (pp
, OBJ_TYPE_REF_TOKEN (node
), spc
, flags
, false);
3150 pp_right_paren (pp
);
3154 if (SSA_NAME_IDENTIFIER (node
))
3156 if ((flags
& TDF_NOUID
)
3157 && SSA_NAME_VAR (node
)
3158 && DECL_NAMELESS (SSA_NAME_VAR (node
)))
3159 dump_fancy_name (pp
, SSA_NAME_IDENTIFIER (node
));
3160 else if (! (flags
& TDF_GIMPLE
)
3161 || SSA_NAME_VAR (node
))
3162 dump_generic_node (pp
, SSA_NAME_IDENTIFIER (node
),
3166 pp_decimal_int (pp
, SSA_NAME_VERSION (node
));
3167 if (SSA_NAME_IS_DEFAULT_DEF (node
))
3168 pp_string (pp
, "(D)");
3169 if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (node
))
3170 pp_string (pp
, "(ab)");
3173 case WITH_SIZE_EXPR
:
3174 pp_string (pp
, "WITH_SIZE_EXPR <");
3175 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3176 pp_string (pp
, ", ");
3177 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3182 pp_string (pp
, "ASSERT_EXPR <");
3183 dump_generic_node (pp
, ASSERT_EXPR_VAR (node
), spc
, flags
, false);
3184 pp_string (pp
, ", ");
3185 dump_generic_node (pp
, ASSERT_EXPR_COND (node
), spc
, flags
, false);
3190 pp_string (pp
, "scev_known");
3193 case SCEV_NOT_KNOWN
:
3194 pp_string (pp
, "scev_not_known");
3197 case POLYNOMIAL_CHREC
:
3199 dump_generic_node (pp
, CHREC_LEFT (node
), spc
, flags
, false);
3200 pp_string (pp
, ", +, ");
3201 dump_generic_node (pp
, CHREC_RIGHT (node
), spc
, flags
, false);
3202 pp_printf (pp
, "}_%u", CHREC_VARIABLE (node
));
3206 case REALIGN_LOAD_EXPR
:
3207 pp_string (pp
, "REALIGN_LOAD <");
3208 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3209 pp_string (pp
, ", ");
3210 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3211 pp_string (pp
, ", ");
3212 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3217 pp_string (pp
, " VEC_COND_EXPR < ");
3218 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3219 pp_string (pp
, " , ");
3220 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3221 pp_string (pp
, " , ");
3222 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3223 pp_string (pp
, " > ");
3227 pp_string (pp
, " VEC_PERM_EXPR < ");
3228 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3229 pp_string (pp
, " , ");
3230 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3231 pp_string (pp
, " , ");
3232 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3233 pp_string (pp
, " > ");
3237 pp_string (pp
, " DOT_PROD_EXPR < ");
3238 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3239 pp_string (pp
, ", ");
3240 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3241 pp_string (pp
, ", ");
3242 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3243 pp_string (pp
, " > ");
3246 case WIDEN_MULT_PLUS_EXPR
:
3247 pp_string (pp
, " WIDEN_MULT_PLUS_EXPR < ");
3248 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3249 pp_string (pp
, ", ");
3250 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3251 pp_string (pp
, ", ");
3252 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3253 pp_string (pp
, " > ");
3256 case WIDEN_MULT_MINUS_EXPR
:
3257 pp_string (pp
, " WIDEN_MULT_MINUS_EXPR < ");
3258 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3259 pp_string (pp
, ", ");
3260 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3261 pp_string (pp
, ", ");
3262 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3263 pp_string (pp
, " > ");
3267 pp_string (pp
, "#pragma acc parallel");
3268 goto dump_omp_clauses_body
;
3271 pp_string (pp
, "#pragma acc kernels");
3272 goto dump_omp_clauses_body
;
3275 pp_string (pp
, "#pragma acc serial");
3276 goto dump_omp_clauses_body
;
3279 pp_string (pp
, "#pragma acc data");
3280 dump_omp_clauses (pp
, OACC_DATA_CLAUSES (node
), spc
, flags
);
3283 case OACC_HOST_DATA
:
3284 pp_string (pp
, "#pragma acc host_data");
3285 dump_omp_clauses (pp
, OACC_HOST_DATA_CLAUSES (node
), spc
, flags
);
3289 pp_string (pp
, "#pragma acc declare");
3290 dump_omp_clauses (pp
, OACC_DECLARE_CLAUSES (node
), spc
, flags
);
3294 pp_string (pp
, "#pragma acc update");
3295 dump_omp_clauses (pp
, OACC_UPDATE_CLAUSES (node
), spc
, flags
);
3298 case OACC_ENTER_DATA
:
3299 pp_string (pp
, "#pragma acc enter data");
3300 dump_omp_clauses (pp
, OACC_ENTER_DATA_CLAUSES (node
), spc
, flags
);
3303 case OACC_EXIT_DATA
:
3304 pp_string (pp
, "#pragma acc exit data");
3305 dump_omp_clauses (pp
, OACC_EXIT_DATA_CLAUSES (node
), spc
, flags
);
3309 pp_string (pp
, "#pragma acc cache");
3310 dump_omp_clauses (pp
, OACC_CACHE_CLAUSES (node
), spc
, flags
);
3314 pp_string (pp
, "#pragma omp parallel");
3315 dump_omp_clauses (pp
, OMP_PARALLEL_CLAUSES (node
), spc
, flags
);
3318 dump_omp_clauses_body
:
3319 dump_omp_clauses (pp
, OMP_CLAUSES (node
), spc
, flags
);
3323 if (!(flags
& TDF_SLIM
) && OMP_BODY (node
))
3325 newline_and_indent (pp
, spc
+ 2);
3327 newline_and_indent (pp
, spc
+ 4);
3328 dump_generic_node (pp
, OMP_BODY (node
), spc
+ 4, flags
, false);
3329 newline_and_indent (pp
, spc
+ 2);
3330 pp_right_brace (pp
);
3336 pp_string (pp
, OMP_TASK_BODY (node
) ? "#pragma omp task"
3337 : "#pragma omp taskwait");
3338 dump_omp_clauses (pp
, OMP_TASK_CLAUSES (node
), spc
, flags
);
3342 pp_string (pp
, "#pragma omp for");
3346 pp_string (pp
, "#pragma omp simd");
3349 case OMP_DISTRIBUTE
:
3350 pp_string (pp
, "#pragma omp distribute");
3354 pp_string (pp
, "#pragma omp taskloop");
3358 pp_string (pp
, "#pragma omp loop");
3362 pp_string (pp
, "#pragma acc loop");
3366 pp_string (pp
, "#pragma omp teams");
3367 dump_omp_clauses (pp
, OMP_TEAMS_CLAUSES (node
), spc
, flags
);
3370 case OMP_TARGET_DATA
:
3371 pp_string (pp
, "#pragma omp target data");
3372 dump_omp_clauses (pp
, OMP_TARGET_DATA_CLAUSES (node
), spc
, flags
);
3375 case OMP_TARGET_ENTER_DATA
:
3376 pp_string (pp
, "#pragma omp target enter data");
3377 dump_omp_clauses (pp
, OMP_TARGET_ENTER_DATA_CLAUSES (node
), spc
, flags
);
3381 case OMP_TARGET_EXIT_DATA
:
3382 pp_string (pp
, "#pragma omp target exit data");
3383 dump_omp_clauses (pp
, OMP_TARGET_EXIT_DATA_CLAUSES (node
), spc
, flags
);
3388 pp_string (pp
, "#pragma omp target");
3389 dump_omp_clauses (pp
, OMP_TARGET_CLAUSES (node
), spc
, flags
);
3392 case OMP_TARGET_UPDATE
:
3393 pp_string (pp
, "#pragma omp target update");
3394 dump_omp_clauses (pp
, OMP_TARGET_UPDATE_CLAUSES (node
), spc
, flags
);
3399 dump_omp_clauses (pp
, OMP_FOR_CLAUSES (node
), spc
, flags
);
3400 if (!(flags
& TDF_SLIM
))
3404 if (OMP_FOR_PRE_BODY (node
))
3406 newline_and_indent (pp
, spc
+ 2);
3409 newline_and_indent (pp
, spc
);
3410 dump_generic_node (pp
, OMP_FOR_PRE_BODY (node
),
3413 if (OMP_FOR_INIT (node
))
3416 for (i
= 0; i
< TREE_VEC_LENGTH (OMP_FOR_INIT (node
)); i
++)
3419 newline_and_indent (pp
, spc
);
3420 pp_string (pp
, "for (");
3421 dump_generic_node (pp
,
3422 TREE_VEC_ELT (OMP_FOR_INIT (node
), i
),
3424 pp_string (pp
, "; ");
3425 dump_generic_node (pp
,
3426 TREE_VEC_ELT (OMP_FOR_COND (node
), i
),
3428 pp_string (pp
, "; ");
3429 dump_generic_node (pp
,
3430 TREE_VEC_ELT (OMP_FOR_INCR (node
), i
),
3432 pp_right_paren (pp
);
3435 if (OMP_FOR_BODY (node
))
3437 newline_and_indent (pp
, spc
+ 2);
3439 newline_and_indent (pp
, spc
+ 4);
3440 dump_generic_node (pp
, OMP_FOR_BODY (node
), spc
+ 4, flags
,
3442 newline_and_indent (pp
, spc
+ 2);
3443 pp_right_brace (pp
);
3445 if (OMP_FOR_INIT (node
))
3446 spc
-= 2 * TREE_VEC_LENGTH (OMP_FOR_INIT (node
)) - 2;
3447 if (OMP_FOR_PRE_BODY (node
))
3450 newline_and_indent (pp
, spc
+ 2);
3451 pp_right_brace (pp
);
3458 pp_string (pp
, "#pragma omp sections");
3459 dump_omp_clauses (pp
, OMP_SECTIONS_CLAUSES (node
), spc
, flags
);
3463 pp_string (pp
, "#pragma omp section");
3467 if (OMP_SCAN_CLAUSES (node
))
3469 pp_string (pp
, "#pragma omp scan");
3470 dump_omp_clauses (pp
, OMP_SCAN_CLAUSES (node
), spc
, flags
);
3475 pp_string (pp
, "#pragma omp master");
3479 pp_string (pp
, "#pragma omp taskgroup");
3480 dump_omp_clauses (pp
, OMP_TASKGROUP_CLAUSES (node
), spc
, flags
);
3484 pp_string (pp
, "#pragma omp ordered");
3485 dump_omp_clauses (pp
, OMP_ORDERED_CLAUSES (node
), spc
, flags
);
3489 pp_string (pp
, "#pragma omp critical");
3490 if (OMP_CRITICAL_NAME (node
))
3494 dump_generic_node (pp
, OMP_CRITICAL_NAME (node
), spc
,
3496 pp_right_paren (pp
);
3498 dump_omp_clauses (pp
, OMP_CRITICAL_CLAUSES (node
), spc
, flags
);
3502 pp_string (pp
, "#pragma omp atomic");
3503 dump_omp_atomic_memory_order (pp
, OMP_ATOMIC_MEMORY_ORDER (node
));
3504 newline_and_indent (pp
, spc
+ 2);
3505 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3509 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3512 case OMP_ATOMIC_READ
:
3513 pp_string (pp
, "#pragma omp atomic read");
3514 dump_omp_atomic_memory_order (pp
, OMP_ATOMIC_MEMORY_ORDER (node
));
3515 newline_and_indent (pp
, spc
+ 2);
3516 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3520 case OMP_ATOMIC_CAPTURE_OLD
:
3521 case OMP_ATOMIC_CAPTURE_NEW
:
3522 pp_string (pp
, "#pragma omp atomic capture");
3523 dump_omp_atomic_memory_order (pp
, OMP_ATOMIC_MEMORY_ORDER (node
));
3524 newline_and_indent (pp
, spc
+ 2);
3525 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3529 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3533 pp_string (pp
, "#pragma omp single");
3534 dump_omp_clauses (pp
, OMP_SINGLE_CLAUSES (node
), spc
, flags
);
3538 dump_omp_clause (pp
, node
, spc
, flags
);
3542 case TRANSACTION_EXPR
:
3543 if (TRANSACTION_EXPR_OUTER (node
))
3544 pp_string (pp
, "__transaction_atomic [[outer]]");
3545 else if (TRANSACTION_EXPR_RELAXED (node
))
3546 pp_string (pp
, "__transaction_relaxed");
3548 pp_string (pp
, "__transaction_atomic");
3549 if (!(flags
& TDF_SLIM
) && TRANSACTION_EXPR_BODY (node
))
3551 newline_and_indent (pp
, spc
);
3553 newline_and_indent (pp
, spc
+ 2);
3554 dump_generic_node (pp
, TRANSACTION_EXPR_BODY (node
),
3555 spc
+ 2, flags
, false);
3556 newline_and_indent (pp
, spc
);
3557 pp_right_brace (pp
);
3562 case VEC_SERIES_EXPR
:
3563 case VEC_WIDEN_MULT_HI_EXPR
:
3564 case VEC_WIDEN_MULT_LO_EXPR
:
3565 case VEC_WIDEN_MULT_EVEN_EXPR
:
3566 case VEC_WIDEN_MULT_ODD_EXPR
:
3567 case VEC_WIDEN_LSHIFT_HI_EXPR
:
3568 case VEC_WIDEN_LSHIFT_LO_EXPR
:
3570 for (str
= get_tree_code_name (code
); *str
; str
++)
3571 pp_character (pp
, TOUPPER (*str
));
3572 pp_string (pp
, " < ");
3573 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3574 pp_string (pp
, ", ");
3575 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3576 pp_string (pp
, " > ");
3579 case VEC_DUPLICATE_EXPR
:
3581 for (str
= get_tree_code_name (code
); *str
; str
++)
3582 pp_character (pp
, TOUPPER (*str
));
3583 pp_string (pp
, " < ");
3584 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3585 pp_string (pp
, " > ");
3588 case VEC_UNPACK_HI_EXPR
:
3589 pp_string (pp
, " VEC_UNPACK_HI_EXPR < ");
3590 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3591 pp_string (pp
, " > ");
3594 case VEC_UNPACK_LO_EXPR
:
3595 pp_string (pp
, " VEC_UNPACK_LO_EXPR < ");
3596 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3597 pp_string (pp
, " > ");
3600 case VEC_UNPACK_FLOAT_HI_EXPR
:
3601 pp_string (pp
, " VEC_UNPACK_FLOAT_HI_EXPR < ");
3602 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3603 pp_string (pp
, " > ");
3606 case VEC_UNPACK_FLOAT_LO_EXPR
:
3607 pp_string (pp
, " VEC_UNPACK_FLOAT_LO_EXPR < ");
3608 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3609 pp_string (pp
, " > ");
3612 case VEC_UNPACK_FIX_TRUNC_HI_EXPR
:
3613 pp_string (pp
, " VEC_UNPACK_FIX_TRUNC_HI_EXPR < ");
3614 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3615 pp_string (pp
, " > ");
3618 case VEC_UNPACK_FIX_TRUNC_LO_EXPR
:
3619 pp_string (pp
, " VEC_UNPACK_FIX_TRUNC_LO_EXPR < ");
3620 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3621 pp_string (pp
, " > ");
3624 case VEC_PACK_TRUNC_EXPR
:
3625 pp_string (pp
, " VEC_PACK_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_SAT_EXPR
:
3633 pp_string (pp
, " VEC_PACK_SAT_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
, " > ");
3640 case VEC_PACK_FIX_TRUNC_EXPR
:
3641 pp_string (pp
, " VEC_PACK_FIX_TRUNC_EXPR < ");
3642 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3643 pp_string (pp
, ", ");
3644 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3645 pp_string (pp
, " > ");
3648 case VEC_PACK_FLOAT_EXPR
:
3649 pp_string (pp
, " VEC_PACK_FLOAT_EXPR < ");
3650 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3651 pp_string (pp
, ", ");
3652 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3653 pp_string (pp
, " > ");
3657 dump_block_node (pp
, node
, spc
, flags
);
3660 case DEBUG_BEGIN_STMT
:
3661 pp_string (pp
, "# DEBUG BEGIN STMT");
3668 if (is_stmt
&& is_expr
)
3674 /* Print the declaration of a variable. */
3677 print_declaration (pretty_printer
*pp
, tree t
, int spc
, dump_flags_t flags
)
3681 if (TREE_CODE(t
) == NAMELIST_DECL
)
3683 pp_string(pp
, "namelist ");
3684 dump_decl_name (pp
, t
, flags
);
3689 if (TREE_CODE (t
) == TYPE_DECL
)
3690 pp_string (pp
, "typedef ");
3692 if (CODE_CONTAINS_STRUCT (TREE_CODE (t
), TS_DECL_WRTL
) && DECL_REGISTER (t
))
3693 pp_string (pp
, "register ");
3695 if (TREE_PUBLIC (t
) && DECL_EXTERNAL (t
))
3696 pp_string (pp
, "extern ");
3697 else if (TREE_STATIC (t
))
3698 pp_string (pp
, "static ");
3700 /* Print the type and name. */
3701 if (TREE_TYPE (t
) && TREE_CODE (TREE_TYPE (t
)) == ARRAY_TYPE
)
3705 /* Print array's type. */
3706 tmp
= TREE_TYPE (t
);
3707 while (TREE_CODE (TREE_TYPE (tmp
)) == ARRAY_TYPE
)
3708 tmp
= TREE_TYPE (tmp
);
3709 dump_generic_node (pp
, TREE_TYPE (tmp
), spc
, flags
, false);
3711 /* Print variable's name. */
3713 dump_generic_node (pp
, t
, spc
, flags
, false);
3715 /* Print the dimensions. */
3716 tmp
= TREE_TYPE (t
);
3717 while (TREE_CODE (tmp
) == ARRAY_TYPE
)
3719 dump_array_domain (pp
, TYPE_DOMAIN (tmp
), spc
, flags
);
3720 tmp
= TREE_TYPE (tmp
);
3723 else if (TREE_CODE (t
) == FUNCTION_DECL
)
3725 dump_generic_node (pp
, TREE_TYPE (TREE_TYPE (t
)), spc
, flags
, false);
3727 dump_decl_name (pp
, t
, flags
);
3728 dump_function_declaration (pp
, TREE_TYPE (t
), spc
, flags
);
3732 /* Print type declaration. */
3733 dump_generic_node (pp
, TREE_TYPE (t
), spc
, flags
, false);
3735 /* Print variable's name. */
3737 dump_generic_node (pp
, t
, spc
, flags
, false);
3740 if (VAR_P (t
) && DECL_HARD_REGISTER (t
))
3742 pp_string (pp
, " __asm__ ");
3744 dump_generic_node (pp
, DECL_ASSEMBLER_NAME (t
), spc
, flags
, false);
3745 pp_right_paren (pp
);
3748 /* The initial value of a function serves to determine whether the function
3749 is declared or defined. So the following does not apply to function
3751 if (TREE_CODE (t
) != FUNCTION_DECL
)
3753 /* Print the initial value. */
3754 if (DECL_INITIAL (t
))
3759 if (!(flags
& TDF_SLIM
))
3760 dump_generic_node (pp
, DECL_INITIAL (t
), spc
, flags
, false);
3762 pp_string (pp
, "<<< omitted >>>");
3766 if (VAR_P (t
) && DECL_HAS_VALUE_EXPR_P (t
))
3768 pp_string (pp
, " [value-expr: ");
3769 dump_generic_node (pp
, DECL_VALUE_EXPR (t
), spc
, flags
, false);
3770 pp_right_bracket (pp
);
3777 /* Prints a structure: name, fields, and methods.
3778 FIXME: Still incomplete. */
3781 print_struct_decl (pretty_printer
*pp
, const_tree node
, int spc
,
3784 /* Print the name of the structure. */
3785 if (TYPE_NAME (node
))
3788 if (TREE_CODE (node
) == RECORD_TYPE
)
3789 pp_string (pp
, "struct ");
3790 else if ((TREE_CODE (node
) == UNION_TYPE
3791 || TREE_CODE (node
) == QUAL_UNION_TYPE
))
3792 pp_string (pp
, "union ");
3794 dump_generic_node (pp
, TYPE_NAME (node
), spc
, TDF_NONE
, false);
3797 /* Print the contents of the structure. */
3803 /* Print the fields of the structure. */
3806 tmp
= TYPE_FIELDS (node
);
3809 /* Avoid to print recursively the structure. */
3810 /* FIXME : Not implemented correctly...,
3811 what about the case when we have a cycle in the contain graph? ...
3812 Maybe this could be solved by looking at the scope in which the
3813 structure was declared. */
3814 if (TREE_TYPE (tmp
) != node
3815 && (TREE_CODE (TREE_TYPE (tmp
)) != POINTER_TYPE
3816 || TREE_TYPE (TREE_TYPE (tmp
)) != node
))
3818 print_declaration (pp
, tmp
, spc
+2, flags
);
3821 tmp
= DECL_CHAIN (tmp
);
3825 pp_right_brace (pp
);
3828 /* Return the priority of the operator CODE.
3830 From lowest to highest precedence with either left-to-right (L-R)
3831 or right-to-left (R-L) associativity]:
3834 2 [R-L] = += -= *= /= %= &= ^= |= <<= >>=
3846 14 [R-L] ! ~ ++ -- + - * & (type) sizeof
3847 15 [L-R] fn() [] -> .
3849 unary +, - and * have higher precedence than the corresponding binary
3853 op_code_prio (enum tree_code code
)
3870 case TRUTH_ORIF_EXPR
:
3873 case TRUTH_AND_EXPR
:
3874 case TRUTH_ANDIF_EXPR
:
3881 case TRUTH_XOR_EXPR
:
3898 case UNORDERED_EXPR
:
3909 case VEC_WIDEN_LSHIFT_HI_EXPR
:
3910 case VEC_WIDEN_LSHIFT_LO_EXPR
:
3911 case WIDEN_LSHIFT_EXPR
:
3914 case WIDEN_SUM_EXPR
:
3916 case POINTER_PLUS_EXPR
:
3917 case POINTER_DIFF_EXPR
:
3921 case VEC_WIDEN_MULT_HI_EXPR
:
3922 case VEC_WIDEN_MULT_LO_EXPR
:
3923 case WIDEN_MULT_EXPR
:
3925 case WIDEN_MULT_PLUS_EXPR
:
3926 case WIDEN_MULT_MINUS_EXPR
:
3928 case MULT_HIGHPART_EXPR
:
3929 case TRUNC_DIV_EXPR
:
3931 case FLOOR_DIV_EXPR
:
3932 case ROUND_DIV_EXPR
:
3934 case EXACT_DIV_EXPR
:
3935 case TRUNC_MOD_EXPR
:
3937 case FLOOR_MOD_EXPR
:
3938 case ROUND_MOD_EXPR
:
3941 case TRUTH_NOT_EXPR
:
3943 case POSTINCREMENT_EXPR
:
3944 case POSTDECREMENT_EXPR
:
3945 case PREINCREMENT_EXPR
:
3946 case PREDECREMENT_EXPR
:
3952 case FIX_TRUNC_EXPR
:
3958 case ARRAY_RANGE_REF
:
3962 /* Special expressions. */
3968 case VEC_UNPACK_HI_EXPR
:
3969 case VEC_UNPACK_LO_EXPR
:
3970 case VEC_UNPACK_FLOAT_HI_EXPR
:
3971 case VEC_UNPACK_FLOAT_LO_EXPR
:
3972 case VEC_UNPACK_FIX_TRUNC_HI_EXPR
:
3973 case VEC_UNPACK_FIX_TRUNC_LO_EXPR
:
3974 case VEC_PACK_TRUNC_EXPR
:
3975 case VEC_PACK_SAT_EXPR
:
3979 /* Return an arbitrarily high precedence to avoid surrounding single
3980 VAR_DECLs in ()s. */
3985 /* Return the priority of the operator OP. */
3988 op_prio (const_tree op
)
3990 enum tree_code code
;
3995 code
= TREE_CODE (op
);
3996 if (code
== SAVE_EXPR
|| code
== NON_LVALUE_EXPR
)
3997 return op_prio (TREE_OPERAND (op
, 0));
3999 return op_code_prio (code
);
4002 /* Return the symbol associated with operator CODE. */
4005 op_symbol_code (enum tree_code code
)
4013 case TRUTH_ORIF_EXPR
:
4016 case TRUTH_AND_EXPR
:
4017 case TRUTH_ANDIF_EXPR
:
4023 case TRUTH_XOR_EXPR
:
4033 case UNORDERED_EXPR
:
4079 case WIDEN_LSHIFT_EXPR
:
4082 case POINTER_PLUS_EXPR
:
4088 case WIDEN_SUM_EXPR
:
4091 case WIDEN_MULT_EXPR
:
4094 case MULT_HIGHPART_EXPR
:
4099 case POINTER_DIFF_EXPR
:
4105 case TRUTH_NOT_EXPR
:
4112 case TRUNC_DIV_EXPR
:
4119 case FLOOR_DIV_EXPR
:
4122 case ROUND_DIV_EXPR
:
4125 case EXACT_DIV_EXPR
:
4128 case TRUNC_MOD_EXPR
:
4134 case FLOOR_MOD_EXPR
:
4137 case ROUND_MOD_EXPR
:
4140 case PREDECREMENT_EXPR
:
4143 case PREINCREMENT_EXPR
:
4146 case POSTDECREMENT_EXPR
:
4149 case POSTINCREMENT_EXPR
:
4159 return "<<< ??? >>>";
4163 /* Return the symbol associated with operator OP. */
4166 op_symbol (const_tree op
)
4168 return op_symbol_code (TREE_CODE (op
));
4171 /* Prints the name of a call. NODE is the CALL_EXPR_FN of a CALL_EXPR or
4172 the gimple_call_fn of a GIMPLE_CALL. */
4175 print_call_name (pretty_printer
*pp
, tree node
, dump_flags_t flags
)
4179 if (TREE_CODE (op0
) == NON_LVALUE_EXPR
)
4180 op0
= TREE_OPERAND (op0
, 0);
4183 switch (TREE_CODE (op0
))
4188 dump_function_name (pp
, op0
, flags
);
4194 op0
= TREE_OPERAND (op0
, 0);
4199 dump_generic_node (pp
, TREE_OPERAND (op0
, 0), 0, flags
, false);
4200 pp_string (pp
, ") ? ");
4201 dump_generic_node (pp
, TREE_OPERAND (op0
, 1), 0, flags
, false);
4202 pp_string (pp
, " : ");
4203 dump_generic_node (pp
, TREE_OPERAND (op0
, 2), 0, flags
, false);
4207 if (TREE_CODE (TREE_OPERAND (op0
, 0)) == VAR_DECL
)
4208 dump_function_name (pp
, TREE_OPERAND (op0
, 0), flags
);
4210 dump_generic_node (pp
, op0
, 0, flags
, false);
4214 if (integer_zerop (TREE_OPERAND (op0
, 1)))
4216 op0
= TREE_OPERAND (op0
, 0);
4223 dump_generic_node (pp
, op0
, 0, flags
, false);
4231 /* Print the first N characters in the array STR, replacing non-printable
4232 characters (including embedded nuls) with unambiguous escape sequences. */
4235 pretty_print_string (pretty_printer
*pp
, const char *str
, size_t n
)
4240 for ( ; n
; --n
, ++str
)
4245 pp_string (pp
, "\\b");
4249 pp_string (pp
, "\\f");
4253 pp_string (pp
, "\\n");
4257 pp_string (pp
, "\\r");
4261 pp_string (pp
, "\\t");
4265 pp_string (pp
, "\\v");
4269 pp_string (pp
, "\\\\");
4273 pp_string (pp
, "\\\"");
4277 pp_string (pp
, "\\'");
4281 if (str
[0] || n
> 1)
4283 if (!ISPRINT (str
[0]))
4286 sprintf (buf
, "\\x%02x", (unsigned char)str
[0]);
4287 pp_string (pp
, buf
);
4290 pp_character (pp
, str
[0]);
4298 maybe_init_pretty_print (FILE *file
)
4302 tree_pp
= new pretty_printer ();
4303 pp_needs_newline (tree_pp
) = true;
4304 pp_translate_identifiers (tree_pp
) = false;
4307 tree_pp
->buffer
->stream
= file
;
4311 newline_and_indent (pretty_printer
*pp
, int spc
)
4317 /* Handle the %K format for TEXT. Separate from default_tree_printer
4318 so it can also be used in front ends.
4319 The location LOC and BLOCK are expected to be extracted by the caller
4320 from the %K argument arg via EXPR_LOCATION(arg) and TREE_BLOCK(arg). */
4323 percent_K_format (text_info
*text
, location_t loc
, tree block
)
4325 text
->set_location (0, loc
, SHOW_RANGE_WITH_CARET
);
4326 gcc_assert (pp_ti_abstract_origin (text
) != NULL
);
4327 *pp_ti_abstract_origin (text
) = NULL
;
4330 && TREE_CODE (block
) == BLOCK
4331 && BLOCK_ABSTRACT_ORIGIN (block
))
4333 tree ao
= BLOCK_ABSTRACT_ORIGIN (block
);
4334 if (TREE_CODE (ao
) == FUNCTION_DECL
)
4336 *pp_ti_abstract_origin (text
) = block
;
4339 block
= BLOCK_SUPERCONTEXT (block
);
4343 /* Print the identifier ID to PRETTY-PRINTER. */
4346 pp_tree_identifier (pretty_printer
*pp
, tree id
)
4348 if (pp_translate_identifiers (pp
))
4350 const char *text
= identifier_to_locale (IDENTIFIER_POINTER (id
));
4351 pp_append_text (pp
, text
, text
+ strlen (text
));
4354 pp_append_text (pp
, IDENTIFIER_POINTER (id
),
4355 IDENTIFIER_POINTER (id
) + IDENTIFIER_LENGTH (id
));
4358 /* A helper function that is used to dump function information before the
4362 dump_function_header (FILE *dump_file
, tree fdecl
, dump_flags_t flags
)
4364 const char *dname
, *aname
;
4365 struct cgraph_node
*node
= cgraph_node::get (fdecl
);
4366 struct function
*fun
= DECL_STRUCT_FUNCTION (fdecl
);
4368 dname
= lang_hooks
.decl_printable_name (fdecl
, 1);
4370 if (DECL_ASSEMBLER_NAME_SET_P (fdecl
))
4371 aname
= (IDENTIFIER_POINTER
4372 (DECL_ASSEMBLER_NAME (fdecl
)));
4374 aname
= "<unset-asm-name>";
4376 fprintf (dump_file
, "\n;; Function %s (%s, funcdef_no=%d",
4377 dname
, aname
, fun
->funcdef_no
);
4378 if (!(flags
& TDF_NOUID
))
4379 fprintf (dump_file
, ", decl_uid=%d", DECL_UID (fdecl
));
4382 fprintf (dump_file
, ", cgraph_uid=%d", node
->get_uid ());
4383 fprintf (dump_file
, ", symbol_order=%d)%s\n\n", node
->order
,
4384 node
->frequency
== NODE_FREQUENCY_HOT
4386 : node
->frequency
== NODE_FREQUENCY_UNLIKELY_EXECUTED
4387 ? " (unlikely executed)"
4388 : node
->frequency
== NODE_FREQUENCY_EXECUTED_ONCE
4389 ? " (executed once)"
4393 fprintf (dump_file
, ")\n\n");
4396 /* Dump double_int D to pretty_printer PP. UNS is true
4397 if D is unsigned and false otherwise. */
4399 pp_double_int (pretty_printer
*pp
, double_int d
, bool uns
)
4402 pp_wide_integer (pp
, d
.low
);
4403 else if (d
.fits_uhwi ())
4404 pp_unsigned_wide_integer (pp
, d
.low
);
4407 unsigned HOST_WIDE_INT low
= d
.low
;
4408 HOST_WIDE_INT high
= d
.high
;
4409 if (!uns
&& d
.is_negative ())
4412 high
= ~high
+ !low
;
4415 /* Would "%x%0*x" or "%x%*0x" get zero-padding on all
4417 sprintf (pp_buffer (pp
)->digit_buffer
,
4418 HOST_WIDE_INT_PRINT_DOUBLE_HEX
,
4419 (unsigned HOST_WIDE_INT
) high
, low
);
4420 pp_string (pp
, pp_buffer (pp
)->digit_buffer
);
4425 # pragma GCC diagnostic pop