1 /* Pretty formatting of GENERIC trees in C syntax.
2 Copyright (C) 2001-2018 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"
38 /* Local functions, macros and variables. */
39 static const char *op_symbol (const_tree
);
40 static void pretty_print_string (pretty_printer
*, const char*, unsigned);
41 static void newline_and_indent (pretty_printer
*, int);
42 static void maybe_init_pretty_print (FILE *);
43 static void print_struct_decl (pretty_printer
*, const_tree
, int, dump_flags_t
);
44 static void do_niy (pretty_printer
*, const_tree
, dump_flags_t
);
46 #define INDENT(SPACE) do { \
47 int i; for (i = 0; i<SPACE; i++) pp_space (pp); } while (0)
49 #define NIY do_niy (pp, node, flags)
51 static pretty_printer
*tree_pp
;
53 /* Try to print something for an unknown tree code. */
56 do_niy (pretty_printer
*pp
, const_tree node
, dump_flags_t flags
)
60 pp_string (pp
, "<<< Unknown tree: ");
61 pp_string (pp
, get_tree_code_name (TREE_CODE (node
)));
65 len
= TREE_OPERAND_LENGTH (node
);
66 for (i
= 0; i
< len
; ++i
)
68 newline_and_indent (pp
, 2);
69 dump_generic_node (pp
, TREE_OPERAND (node
, i
), 2, flags
, false);
73 pp_string (pp
, " >>>");
76 /* Debugging function to print out a generic expression. */
79 debug_generic_expr (tree t
)
81 print_generic_expr (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
);
82 fprintf (stderr
, "\n");
85 /* Debugging function to print out a generic statement. */
88 debug_generic_stmt (tree t
)
90 print_generic_stmt (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
);
91 fprintf (stderr
, "\n");
94 /* Debugging function to print out a chain of trees . */
97 debug_tree_chain (tree t
)
103 print_generic_expr (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
|TDF_UID
);
104 fprintf (stderr
, " ");
108 fprintf (stderr
, "... [cycled back to ");
109 print_generic_expr (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
|TDF_UID
);
110 fprintf (stderr
, "]");
114 fprintf (stderr
, "\n");
117 /* Prints declaration DECL to the FILE with details specified by FLAGS. */
119 print_generic_decl (FILE *file
, tree decl
, dump_flags_t flags
)
121 maybe_init_pretty_print (file
);
122 print_declaration (tree_pp
, decl
, 2, flags
);
123 pp_write_text_to_stream (tree_pp
);
126 /* Print tree T, and its successors, on file FILE. FLAGS specifies details
127 to show in the dump. See TDF_* in dumpfile.h. */
130 print_generic_stmt (FILE *file
, tree t
, dump_flags_t flags
)
132 maybe_init_pretty_print (file
);
133 dump_generic_node (tree_pp
, t
, 0, flags
, true);
134 pp_newline_and_flush (tree_pp
);
137 /* Print tree T, and its successors, on file FILE. FLAGS specifies details
138 to show in the dump. See TDF_* in dumpfile.h. The output is indented by
142 print_generic_stmt_indented (FILE *file
, tree t
, dump_flags_t flags
, int indent
)
146 maybe_init_pretty_print (file
);
148 for (i
= 0; i
< indent
; i
++)
150 dump_generic_node (tree_pp
, t
, indent
, flags
, true);
151 pp_newline_and_flush (tree_pp
);
154 /* Print a single expression T on file FILE. FLAGS specifies details to show
155 in the dump. See TDF_* in dumpfile.h. */
158 print_generic_expr (FILE *file
, tree t
, dump_flags_t flags
)
160 maybe_init_pretty_print (file
);
161 dump_generic_node (tree_pp
, t
, 0, flags
, false);
165 /* Print a single expression T to string, and return it. */
168 print_generic_expr_to_str (tree t
)
171 dump_generic_node (&pp
, t
, 0, TDF_VOPS
|TDF_MEMSYMS
, false);
172 return xstrdup (pp_formatted_text (&pp
));
175 /* Dump NAME, an IDENTIFIER_POINTER, sanitized so that D<num> sequences
176 in it are replaced with Dxxxx, as long as they are at the start or
177 preceded by $ and at the end or followed by $. See make_fancy_name
181 dump_fancy_name (pretty_printer
*pp
, tree name
)
184 int length
= IDENTIFIER_LENGTH (name
);
185 const char *n
= IDENTIFIER_POINTER (name
);
192 && (n
== IDENTIFIER_POINTER (name
) || n
[-1] == '$'))
195 while (ISDIGIT (n
[l
]))
197 if (n
[l
] == '\0' || n
[l
] == '$')
210 pp_tree_identifier (pp
, name
);
214 char *str
= XNEWVEC (char, length
+ 1);
217 q
= n
= IDENTIFIER_POINTER (name
);
224 && (q
== IDENTIFIER_POINTER (name
) || q
[-1] == '$'))
227 while (ISDIGIT (q
[l
]))
229 if (q
[l
] == '\0' || q
[l
] == '$')
231 memcpy (p
, n
, q
- n
);
232 memcpy (p
+ (q
- n
), "Dxxxx", 5);
242 memcpy (p
, n
, IDENTIFIER_LENGTH (name
) - (n
- IDENTIFIER_POINTER (name
)));
244 if (pp_translate_identifiers (pp
))
246 const char *text
= identifier_to_locale (str
);
247 pp_append_text (pp
, text
, text
+ strlen (text
));
250 pp_append_text (pp
, str
, str
+ length
);
254 /* Dump the name of a _DECL node and its DECL_UID if TDF_UID is set
258 dump_decl_name (pretty_printer
*pp
, tree node
, dump_flags_t flags
)
260 tree name
= DECL_NAME (node
);
263 if ((flags
& TDF_ASMNAME
)
264 && HAS_DECL_ASSEMBLER_NAME_P (node
)
265 && DECL_ASSEMBLER_NAME_SET_P (node
))
266 pp_tree_identifier (pp
, DECL_ASSEMBLER_NAME_RAW (node
));
267 /* For -fcompare-debug don't dump DECL_NAMELESS names at all,
268 -g might have created more fancy names and their indexes
269 could get out of sync. Usually those should be DECL_IGNORED_P
270 too, SRA can create even non-DECL_IGNORED_P DECL_NAMELESS fancy
271 names, let's hope those never get out of sync after doing the
272 dump_fancy_name sanitization. */
273 else if ((flags
& TDF_COMPARE_DEBUG
)
274 && DECL_NAMELESS (node
)
275 && DECL_IGNORED_P (node
))
277 /* For DECL_NAMELESS names look for embedded uids in the
278 names and sanitize them for TDF_NOUID. */
279 else if ((flags
& TDF_NOUID
) && DECL_NAMELESS (node
))
280 dump_fancy_name (pp
, name
);
282 pp_tree_identifier (pp
, name
);
284 char uid_sep
= (flags
& TDF_GIMPLE
) ? '_' : '.';
285 if ((flags
& TDF_UID
) || name
== NULL_TREE
)
287 if (TREE_CODE (node
) == LABEL_DECL
&& LABEL_DECL_UID (node
) != -1)
288 pp_printf (pp
, "L%c%d", uid_sep
, (int) LABEL_DECL_UID (node
));
289 else if (TREE_CODE (node
) == DEBUG_EXPR_DECL
)
291 if (flags
& TDF_NOUID
)
292 pp_string (pp
, "D#xxxx");
294 pp_printf (pp
, "D#%i", DEBUG_TEMP_UID (node
));
298 char c
= TREE_CODE (node
) == CONST_DECL
? 'C' : 'D';
299 if (flags
& TDF_NOUID
)
300 pp_printf (pp
, "%c.xxxx", c
);
302 pp_printf (pp
, "%c%c%u", c
, uid_sep
, DECL_UID (node
));
305 if ((flags
& TDF_ALIAS
) && DECL_PT_UID (node
) != DECL_UID (node
))
307 if (flags
& TDF_NOUID
)
308 pp_printf (pp
, "ptD.xxxx");
310 pp_printf (pp
, "ptD.%u", DECL_PT_UID (node
));
314 /* Like the above, but used for pretty printing function calls. */
317 dump_function_name (pretty_printer
*pp
, tree node
, dump_flags_t flags
)
319 if (CONVERT_EXPR_P (node
))
320 node
= TREE_OPERAND (node
, 0);
321 if (DECL_NAME (node
) && (flags
& TDF_ASMNAME
) == 0)
322 pp_string (pp
, lang_hooks
.decl_printable_name (node
, 1));
324 dump_decl_name (pp
, node
, flags
);
327 /* Dump a function declaration. NODE is the FUNCTION_TYPE. PP, SPC and
328 FLAGS are as in dump_generic_node. */
331 dump_function_declaration (pretty_printer
*pp
, tree node
,
332 int spc
, dump_flags_t flags
)
334 bool wrote_arg
= false;
340 /* Print the argument types. */
341 arg
= TYPE_ARG_TYPES (node
);
342 while (arg
&& arg
!= void_list_node
&& arg
!= error_mark_node
)
350 dump_generic_node (pp
, TREE_VALUE (arg
), spc
, flags
, false);
351 arg
= TREE_CHAIN (arg
);
354 /* Drop the trailing void_type_node if we had any previous argument. */
355 if (arg
== void_list_node
&& !wrote_arg
)
356 pp_string (pp
, "void");
357 /* Properly dump vararg function types. */
358 else if (!arg
&& wrote_arg
)
359 pp_string (pp
, ", ...");
360 /* Avoid printing any arg for unprototyped functions. */
365 /* Dump the domain associated with an array. */
368 dump_array_domain (pretty_printer
*pp
, tree domain
, int spc
, dump_flags_t flags
)
370 pp_left_bracket (pp
);
373 tree min
= TYPE_MIN_VALUE (domain
);
374 tree max
= TYPE_MAX_VALUE (domain
);
377 && integer_zerop (min
)
378 && tree_fits_shwi_p (max
))
379 pp_wide_integer (pp
, tree_to_shwi (max
) + 1);
383 dump_generic_node (pp
, min
, spc
, flags
, false);
386 dump_generic_node (pp
, max
, spc
, flags
, false);
390 pp_string (pp
, "<unknown>");
391 pp_right_bracket (pp
);
395 /* Dump OpenMP iterators ITER. */
398 dump_omp_iterators (pretty_printer
*pp
, tree iter
, int spc
, dump_flags_t flags
)
400 pp_string (pp
, "iterator(");
401 for (tree it
= iter
; it
; it
= TREE_CHAIN (it
))
404 pp_string (pp
, ", ");
405 dump_generic_node (pp
, TREE_TYPE (TREE_VEC_ELT (it
, 0)), spc
, flags
,
408 dump_generic_node (pp
, TREE_VEC_ELT (it
, 0), spc
, flags
, false);
410 dump_generic_node (pp
, TREE_VEC_ELT (it
, 1), spc
, flags
, false);
412 dump_generic_node (pp
, TREE_VEC_ELT (it
, 2), spc
, flags
, false);
414 dump_generic_node (pp
, TREE_VEC_ELT (it
, 3), spc
, flags
, false);
420 /* Dump OpenMP clause CLAUSE. PP, CLAUSE, SPC and FLAGS are as in
421 dump_generic_node. */
424 dump_omp_clause (pretty_printer
*pp
, tree clause
, int spc
, dump_flags_t flags
)
428 switch (OMP_CLAUSE_CODE (clause
))
430 case OMP_CLAUSE_PRIVATE
:
433 case OMP_CLAUSE_SHARED
:
436 case OMP_CLAUSE_FIRSTPRIVATE
:
437 name
= "firstprivate";
439 case OMP_CLAUSE_LASTPRIVATE
:
440 name
= "lastprivate";
441 if (!OMP_CLAUSE_LASTPRIVATE_CONDITIONAL (clause
))
443 pp_string (pp
, "lastprivate(conditional:");
444 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
448 case OMP_CLAUSE_COPYIN
:
451 case OMP_CLAUSE_COPYPRIVATE
:
452 name
= "copyprivate";
454 case OMP_CLAUSE_UNIFORM
:
457 case OMP_CLAUSE_USE_DEVICE_PTR
:
458 name
= "use_device_ptr";
460 case OMP_CLAUSE_IS_DEVICE_PTR
:
461 name
= "is_device_ptr";
463 case OMP_CLAUSE__LOOPTEMP_
:
466 case OMP_CLAUSE__REDUCTEMP_
:
467 name
= "_reductemp_";
469 case OMP_CLAUSE_TO_DECLARE
:
472 case OMP_CLAUSE_LINK
:
475 case OMP_CLAUSE_NONTEMPORAL
:
476 name
= "nontemporal";
479 pp_string (pp
, name
);
481 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
486 case OMP_CLAUSE_TASK_REDUCTION
:
487 case OMP_CLAUSE_IN_REDUCTION
:
488 pp_string (pp
, OMP_CLAUSE_CODE (clause
) == OMP_CLAUSE_IN_REDUCTION
491 case OMP_CLAUSE_REDUCTION
:
492 pp_string (pp
, "reduction(");
493 if (OMP_CLAUSE_CODE (clause
) == OMP_CLAUSE_REDUCTION
)
495 if (OMP_CLAUSE_REDUCTION_TASK (clause
))
496 pp_string (pp
, "task,");
497 else if (OMP_CLAUSE_REDUCTION_INSCAN (clause
))
498 pp_string (pp
, "inscan,");
500 if (OMP_CLAUSE_REDUCTION_CODE (clause
) != ERROR_MARK
)
503 op_symbol_code (OMP_CLAUSE_REDUCTION_CODE (clause
)));
506 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
512 pp_string (pp
, "if(");
513 switch (OMP_CLAUSE_IF_MODIFIER (clause
))
515 case ERROR_MARK
: break;
516 case VOID_CST
: pp_string (pp
, "cancel:"); break;
517 case OMP_PARALLEL
: pp_string (pp
, "parallel:"); break;
518 case OMP_SIMD
: pp_string (pp
, "simd:"); break;
519 case OMP_TASK
: pp_string (pp
, "task:"); break;
520 case OMP_TASKLOOP
: pp_string (pp
, "taskloop:"); break;
521 case OMP_TARGET_DATA
: pp_string (pp
, "target data:"); break;
522 case OMP_TARGET
: pp_string (pp
, "target:"); break;
523 case OMP_TARGET_UPDATE
: pp_string (pp
, "target update:"); break;
524 case OMP_TARGET_ENTER_DATA
:
525 pp_string (pp
, "target enter data:"); break;
526 case OMP_TARGET_EXIT_DATA
: pp_string (pp
, "target exit data:"); break;
527 default: gcc_unreachable ();
529 dump_generic_node (pp
, OMP_CLAUSE_IF_EXPR (clause
),
534 case OMP_CLAUSE_NUM_THREADS
:
535 pp_string (pp
, "num_threads(");
536 dump_generic_node (pp
, OMP_CLAUSE_NUM_THREADS_EXPR (clause
),
541 case OMP_CLAUSE_NOWAIT
:
542 pp_string (pp
, "nowait");
544 case OMP_CLAUSE_ORDERED
:
545 pp_string (pp
, "ordered");
546 if (OMP_CLAUSE_ORDERED_EXPR (clause
))
549 dump_generic_node (pp
, OMP_CLAUSE_ORDERED_EXPR (clause
),
555 case OMP_CLAUSE_DEFAULT
:
556 pp_string (pp
, "default(");
557 switch (OMP_CLAUSE_DEFAULT_KIND (clause
))
559 case OMP_CLAUSE_DEFAULT_UNSPECIFIED
:
561 case OMP_CLAUSE_DEFAULT_SHARED
:
562 pp_string (pp
, "shared");
564 case OMP_CLAUSE_DEFAULT_NONE
:
565 pp_string (pp
, "none");
567 case OMP_CLAUSE_DEFAULT_PRIVATE
:
568 pp_string (pp
, "private");
570 case OMP_CLAUSE_DEFAULT_FIRSTPRIVATE
:
571 pp_string (pp
, "firstprivate");
573 case OMP_CLAUSE_DEFAULT_PRESENT
:
574 pp_string (pp
, "present");
582 case OMP_CLAUSE_SCHEDULE
:
583 pp_string (pp
, "schedule(");
584 if (OMP_CLAUSE_SCHEDULE_KIND (clause
)
585 & (OMP_CLAUSE_SCHEDULE_MONOTONIC
586 | OMP_CLAUSE_SCHEDULE_NONMONOTONIC
))
588 if (OMP_CLAUSE_SCHEDULE_KIND (clause
)
589 & OMP_CLAUSE_SCHEDULE_MONOTONIC
)
590 pp_string (pp
, "monotonic");
592 pp_string (pp
, "nonmonotonic");
593 if (OMP_CLAUSE_SCHEDULE_SIMD (clause
))
598 if (OMP_CLAUSE_SCHEDULE_SIMD (clause
))
599 pp_string (pp
, "simd:");
601 switch (OMP_CLAUSE_SCHEDULE_KIND (clause
) & OMP_CLAUSE_SCHEDULE_MASK
)
603 case OMP_CLAUSE_SCHEDULE_STATIC
:
604 pp_string (pp
, "static");
606 case OMP_CLAUSE_SCHEDULE_DYNAMIC
:
607 pp_string (pp
, "dynamic");
609 case OMP_CLAUSE_SCHEDULE_GUIDED
:
610 pp_string (pp
, "guided");
612 case OMP_CLAUSE_SCHEDULE_RUNTIME
:
613 pp_string (pp
, "runtime");
615 case OMP_CLAUSE_SCHEDULE_AUTO
:
616 pp_string (pp
, "auto");
621 if (OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (clause
))
624 dump_generic_node (pp
, OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (clause
),
630 case OMP_CLAUSE_UNTIED
:
631 pp_string (pp
, "untied");
634 case OMP_CLAUSE_COLLAPSE
:
635 pp_string (pp
, "collapse(");
636 dump_generic_node (pp
, OMP_CLAUSE_COLLAPSE_EXPR (clause
),
641 case OMP_CLAUSE_FINAL
:
642 pp_string (pp
, "final(");
643 dump_generic_node (pp
, OMP_CLAUSE_FINAL_EXPR (clause
),
648 case OMP_CLAUSE_MERGEABLE
:
649 pp_string (pp
, "mergeable");
652 case OMP_CLAUSE_LINEAR
:
653 pp_string (pp
, "linear(");
654 switch (OMP_CLAUSE_LINEAR_KIND (clause
))
656 case OMP_CLAUSE_LINEAR_DEFAULT
:
658 case OMP_CLAUSE_LINEAR_REF
:
659 pp_string (pp
, "ref(");
661 case OMP_CLAUSE_LINEAR_VAL
:
662 pp_string (pp
, "val(");
664 case OMP_CLAUSE_LINEAR_UVAL
:
665 pp_string (pp
, "uval(");
670 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
672 if (OMP_CLAUSE_LINEAR_KIND (clause
) != OMP_CLAUSE_LINEAR_DEFAULT
)
675 dump_generic_node (pp
, OMP_CLAUSE_LINEAR_STEP (clause
),
680 case OMP_CLAUSE_ALIGNED
:
681 pp_string (pp
, "aligned(");
682 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
684 if (OMP_CLAUSE_ALIGNED_ALIGNMENT (clause
))
687 dump_generic_node (pp
, OMP_CLAUSE_ALIGNED_ALIGNMENT (clause
),
693 case OMP_CLAUSE_DEPEND
:
694 pp_string (pp
, "depend(");
695 switch (OMP_CLAUSE_DEPEND_KIND (clause
))
697 case OMP_CLAUSE_DEPEND_DEPOBJ
:
700 case OMP_CLAUSE_DEPEND_IN
:
703 case OMP_CLAUSE_DEPEND_OUT
:
706 case OMP_CLAUSE_DEPEND_INOUT
:
709 case OMP_CLAUSE_DEPEND_MUTEXINOUTSET
:
710 name
= "mutexinoutset";
712 case OMP_CLAUSE_DEPEND_SOURCE
:
713 pp_string (pp
, "source)");
715 case OMP_CLAUSE_DEPEND_LAST
:
716 name
= "__internal__";
718 case OMP_CLAUSE_DEPEND_SINK
:
719 pp_string (pp
, "sink:");
720 for (tree t
= OMP_CLAUSE_DECL (clause
); t
; t
= TREE_CHAIN (t
))
721 if (TREE_CODE (t
) == TREE_LIST
)
723 dump_generic_node (pp
, TREE_VALUE (t
), spc
, flags
, false);
724 if (TREE_PURPOSE (t
) != integer_zero_node
)
726 if (OMP_CLAUSE_DEPEND_SINK_NEGATIVE (t
))
730 dump_generic_node (pp
, TREE_PURPOSE (t
), spc
, flags
,
744 tree t
= OMP_CLAUSE_DECL (clause
);
745 if (TREE_CODE (t
) == TREE_LIST
747 && TREE_CODE (TREE_PURPOSE (t
)) == TREE_VEC
)
749 dump_omp_iterators (pp
, TREE_PURPOSE (t
), spc
, flags
);
753 pp_string (pp
, name
);
755 dump_generic_node (pp
, t
, spc
, flags
, false);
761 pp_string (pp
, "map(");
762 switch (OMP_CLAUSE_MAP_KIND (clause
))
765 case GOMP_MAP_POINTER
:
766 pp_string (pp
, "alloc");
769 case GOMP_MAP_TO_PSET
:
770 pp_string (pp
, "to");
773 pp_string (pp
, "from");
775 case GOMP_MAP_TOFROM
:
776 pp_string (pp
, "tofrom");
778 case GOMP_MAP_FORCE_ALLOC
:
779 pp_string (pp
, "force_alloc");
781 case GOMP_MAP_FORCE_TO
:
782 pp_string (pp
, "force_to");
784 case GOMP_MAP_FORCE_FROM
:
785 pp_string (pp
, "force_from");
787 case GOMP_MAP_FORCE_TOFROM
:
788 pp_string (pp
, "force_tofrom");
790 case GOMP_MAP_FORCE_PRESENT
:
791 pp_string (pp
, "force_present");
793 case GOMP_MAP_DELETE
:
794 pp_string (pp
, "delete");
796 case GOMP_MAP_FORCE_DEVICEPTR
:
797 pp_string (pp
, "force_deviceptr");
799 case GOMP_MAP_ALWAYS_TO
:
800 pp_string (pp
, "always,to");
802 case GOMP_MAP_ALWAYS_FROM
:
803 pp_string (pp
, "always,from");
805 case GOMP_MAP_ALWAYS_TOFROM
:
806 pp_string (pp
, "always,tofrom");
808 case GOMP_MAP_RELEASE
:
809 pp_string (pp
, "release");
811 case GOMP_MAP_FIRSTPRIVATE_POINTER
:
812 pp_string (pp
, "firstprivate");
814 case GOMP_MAP_FIRSTPRIVATE_REFERENCE
:
815 pp_string (pp
, "firstprivate ref");
817 case GOMP_MAP_STRUCT
:
818 pp_string (pp
, "struct");
820 case GOMP_MAP_ALWAYS_POINTER
:
821 pp_string (pp
, "always_pointer");
823 case GOMP_MAP_DEVICE_RESIDENT
:
824 pp_string (pp
, "device_resident");
827 pp_string (pp
, "link");
833 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
836 if (OMP_CLAUSE_SIZE (clause
))
838 switch (OMP_CLAUSE_CODE (clause
) == OMP_CLAUSE_MAP
839 ? OMP_CLAUSE_MAP_KIND (clause
) : GOMP_MAP_TO
)
841 case GOMP_MAP_POINTER
:
842 case GOMP_MAP_FIRSTPRIVATE_POINTER
:
843 case GOMP_MAP_FIRSTPRIVATE_REFERENCE
:
844 case GOMP_MAP_ALWAYS_POINTER
:
845 pp_string (pp
, " [pointer assign, bias: ");
847 case GOMP_MAP_TO_PSET
:
848 pp_string (pp
, " [pointer set, len: ");
851 pp_string (pp
, " [len: ");
854 dump_generic_node (pp
, OMP_CLAUSE_SIZE (clause
),
856 pp_right_bracket (pp
);
861 case OMP_CLAUSE_FROM
:
862 pp_string (pp
, "from(");
863 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
865 goto print_clause_size
;
868 pp_string (pp
, "to(");
869 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
871 goto print_clause_size
;
873 case OMP_CLAUSE__CACHE_
:
875 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
877 goto print_clause_size
;
879 case OMP_CLAUSE_NUM_TEAMS
:
880 pp_string (pp
, "num_teams(");
881 dump_generic_node (pp
, OMP_CLAUSE_NUM_TEAMS_EXPR (clause
),
886 case OMP_CLAUSE_THREAD_LIMIT
:
887 pp_string (pp
, "thread_limit(");
888 dump_generic_node (pp
, OMP_CLAUSE_THREAD_LIMIT_EXPR (clause
),
893 case OMP_CLAUSE_DEVICE
:
894 pp_string (pp
, "device(");
895 dump_generic_node (pp
, OMP_CLAUSE_DEVICE_ID (clause
),
900 case OMP_CLAUSE_DIST_SCHEDULE
:
901 pp_string (pp
, "dist_schedule(static");
902 if (OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR (clause
))
905 dump_generic_node (pp
,
906 OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR (clause
),
912 case OMP_CLAUSE_PROC_BIND
:
913 pp_string (pp
, "proc_bind(");
914 switch (OMP_CLAUSE_PROC_BIND_KIND (clause
))
916 case OMP_CLAUSE_PROC_BIND_MASTER
:
917 pp_string (pp
, "master");
919 case OMP_CLAUSE_PROC_BIND_CLOSE
:
920 pp_string (pp
, "close");
922 case OMP_CLAUSE_PROC_BIND_SPREAD
:
923 pp_string (pp
, "spread");
931 case OMP_CLAUSE_SAFELEN
:
932 pp_string (pp
, "safelen(");
933 dump_generic_node (pp
, OMP_CLAUSE_SAFELEN_EXPR (clause
),
938 case OMP_CLAUSE_SIMDLEN
:
939 pp_string (pp
, "simdlen(");
940 dump_generic_node (pp
, OMP_CLAUSE_SIMDLEN_EXPR (clause
),
945 case OMP_CLAUSE_PRIORITY
:
946 pp_string (pp
, "priority(");
947 dump_generic_node (pp
, OMP_CLAUSE_PRIORITY_EXPR (clause
),
952 case OMP_CLAUSE_GRAINSIZE
:
953 pp_string (pp
, "grainsize(");
954 dump_generic_node (pp
, OMP_CLAUSE_GRAINSIZE_EXPR (clause
),
959 case OMP_CLAUSE_NUM_TASKS
:
960 pp_string (pp
, "num_tasks(");
961 dump_generic_node (pp
, OMP_CLAUSE_NUM_TASKS_EXPR (clause
),
966 case OMP_CLAUSE_HINT
:
967 pp_string (pp
, "hint(");
968 dump_generic_node (pp
, OMP_CLAUSE_HINT_EXPR (clause
),
973 case OMP_CLAUSE_DEFAULTMAP
:
974 pp_string (pp
, "defaultmap(");
975 switch (OMP_CLAUSE_DEFAULTMAP_BEHAVIOR (clause
))
977 case OMP_CLAUSE_DEFAULTMAP_ALLOC
:
978 pp_string (pp
, "alloc");
980 case OMP_CLAUSE_DEFAULTMAP_TO
:
981 pp_string (pp
, "to");
983 case OMP_CLAUSE_DEFAULTMAP_FROM
:
984 pp_string (pp
, "from");
986 case OMP_CLAUSE_DEFAULTMAP_TOFROM
:
987 pp_string (pp
, "tofrom");
989 case OMP_CLAUSE_DEFAULTMAP_FIRSTPRIVATE
:
990 pp_string (pp
, "firstprivate");
992 case OMP_CLAUSE_DEFAULTMAP_NONE
:
993 pp_string (pp
, "none");
995 case OMP_CLAUSE_DEFAULTMAP_DEFAULT
:
996 pp_string (pp
, "default");
1001 switch (OMP_CLAUSE_DEFAULTMAP_CATEGORY (clause
))
1003 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_UNSPECIFIED
:
1005 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_SCALAR
:
1006 pp_string (pp
, ":scalar");
1008 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_AGGREGATE
:
1009 pp_string (pp
, ":aggregate");
1011 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_ALLOCATABLE
:
1012 pp_string (pp
, ":allocatable");
1014 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_POINTER
:
1015 pp_string (pp
, ":pointer");
1020 pp_right_paren (pp
);
1023 case OMP_CLAUSE__SIMDUID_
:
1024 pp_string (pp
, "_simduid_(");
1025 dump_generic_node (pp
, OMP_CLAUSE__SIMDUID__DECL (clause
),
1027 pp_right_paren (pp
);
1030 case OMP_CLAUSE__SIMT_
:
1031 pp_string (pp
, "_simt_");
1034 case OMP_CLAUSE_GANG
:
1035 pp_string (pp
, "gang");
1036 if (OMP_CLAUSE_GANG_EXPR (clause
) != NULL_TREE
)
1038 pp_string (pp
, "(num: ");
1039 dump_generic_node (pp
, OMP_CLAUSE_GANG_EXPR (clause
),
1042 if (OMP_CLAUSE_GANG_STATIC_EXPR (clause
) != NULL_TREE
)
1044 if (OMP_CLAUSE_GANG_EXPR (clause
) == NULL_TREE
)
1048 pp_string (pp
, "static:");
1049 if (OMP_CLAUSE_GANG_STATIC_EXPR (clause
)
1050 == integer_minus_one_node
)
1051 pp_character (pp
, '*');
1053 dump_generic_node (pp
, OMP_CLAUSE_GANG_STATIC_EXPR (clause
),
1056 if (OMP_CLAUSE_GANG_EXPR (clause
) != NULL_TREE
1057 || OMP_CLAUSE_GANG_STATIC_EXPR (clause
) != NULL_TREE
)
1058 pp_right_paren (pp
);
1061 case OMP_CLAUSE_ASYNC
:
1062 pp_string (pp
, "async");
1063 if (OMP_CLAUSE_ASYNC_EXPR (clause
))
1065 pp_character(pp
, '(');
1066 dump_generic_node (pp
, OMP_CLAUSE_ASYNC_EXPR (clause
),
1068 pp_character(pp
, ')');
1072 case OMP_CLAUSE_AUTO
:
1073 case OMP_CLAUSE_SEQ
:
1074 pp_string (pp
, omp_clause_code_name
[OMP_CLAUSE_CODE (clause
)]);
1077 case OMP_CLAUSE_WAIT
:
1078 pp_string (pp
, "wait(");
1079 dump_generic_node (pp
, OMP_CLAUSE_WAIT_EXPR (clause
),
1081 pp_character(pp
, ')');
1084 case OMP_CLAUSE_WORKER
:
1085 pp_string (pp
, "worker");
1086 if (OMP_CLAUSE_WORKER_EXPR (clause
) != NULL_TREE
)
1089 dump_generic_node (pp
, OMP_CLAUSE_WORKER_EXPR (clause
),
1091 pp_right_paren (pp
);
1095 case OMP_CLAUSE_VECTOR
:
1096 pp_string (pp
, "vector");
1097 if (OMP_CLAUSE_VECTOR_EXPR (clause
) != NULL_TREE
)
1100 dump_generic_node (pp
, OMP_CLAUSE_VECTOR_EXPR (clause
),
1102 pp_right_paren (pp
);
1106 case OMP_CLAUSE_NUM_GANGS
:
1107 pp_string (pp
, "num_gangs(");
1108 dump_generic_node (pp
, OMP_CLAUSE_NUM_GANGS_EXPR (clause
),
1110 pp_character (pp
, ')');
1113 case OMP_CLAUSE_NUM_WORKERS
:
1114 pp_string (pp
, "num_workers(");
1115 dump_generic_node (pp
, OMP_CLAUSE_NUM_WORKERS_EXPR (clause
),
1117 pp_character (pp
, ')');
1120 case OMP_CLAUSE_VECTOR_LENGTH
:
1121 pp_string (pp
, "vector_length(");
1122 dump_generic_node (pp
, OMP_CLAUSE_VECTOR_LENGTH_EXPR (clause
),
1124 pp_character (pp
, ')');
1127 case OMP_CLAUSE_INBRANCH
:
1128 pp_string (pp
, "inbranch");
1130 case OMP_CLAUSE_NOTINBRANCH
:
1131 pp_string (pp
, "notinbranch");
1133 case OMP_CLAUSE_FOR
:
1134 pp_string (pp
, "for");
1136 case OMP_CLAUSE_PARALLEL
:
1137 pp_string (pp
, "parallel");
1139 case OMP_CLAUSE_SECTIONS
:
1140 pp_string (pp
, "sections");
1142 case OMP_CLAUSE_TASKGROUP
:
1143 pp_string (pp
, "taskgroup");
1145 case OMP_CLAUSE_NOGROUP
:
1146 pp_string (pp
, "nogroup");
1148 case OMP_CLAUSE_THREADS
:
1149 pp_string (pp
, "threads");
1151 case OMP_CLAUSE_SIMD
:
1152 pp_string (pp
, "simd");
1154 case OMP_CLAUSE_INDEPENDENT
:
1155 pp_string (pp
, "independent");
1157 case OMP_CLAUSE_TILE
:
1158 pp_string (pp
, "tile(");
1159 dump_generic_node (pp
, OMP_CLAUSE_TILE_LIST (clause
),
1161 pp_right_paren (pp
);
1164 case OMP_CLAUSE__GRIDDIM_
:
1165 pp_string (pp
, "_griddim_(");
1166 pp_unsigned_wide_integer (pp
, OMP_CLAUSE__GRIDDIM__DIMENSION (clause
));
1168 dump_generic_node (pp
, OMP_CLAUSE__GRIDDIM__SIZE (clause
), spc
, flags
,
1171 dump_generic_node (pp
, OMP_CLAUSE__GRIDDIM__GROUP (clause
), spc
, flags
,
1173 pp_right_paren (pp
);
1175 case OMP_CLAUSE_IF_PRESENT
:
1176 pp_string (pp
, "if_present");
1178 case OMP_CLAUSE_FINALIZE
:
1179 pp_string (pp
, "finalize");
1188 /* Dump the list of OpenMP clauses. PP, SPC and FLAGS are as in
1189 dump_generic_node. */
1192 dump_omp_clauses (pretty_printer
*pp
, tree clause
, int spc
, dump_flags_t flags
)
1200 dump_omp_clause (pp
, clause
, spc
, flags
);
1201 clause
= OMP_CLAUSE_CHAIN (clause
);
1209 /* Dump location LOC to PP. */
1212 dump_location (pretty_printer
*pp
, location_t loc
)
1214 expanded_location xloc
= expand_location (loc
);
1216 pp_left_bracket (pp
);
1219 pp_string (pp
, xloc
.file
);
1220 pp_string (pp
, ":");
1222 pp_decimal_int (pp
, xloc
.line
);
1224 pp_decimal_int (pp
, xloc
.column
);
1225 pp_string (pp
, "] ");
1229 /* Dump lexical block BLOCK. PP, SPC and FLAGS are as in
1230 dump_generic_node. */
1233 dump_block_node (pretty_printer
*pp
, tree block
, int spc
, dump_flags_t flags
)
1237 pp_printf (pp
, "BLOCK #%d ", BLOCK_NUMBER (block
));
1239 if (flags
& TDF_ADDRESS
)
1240 pp_printf (pp
, "[%p] ", (void *) block
);
1242 if (TREE_ASM_WRITTEN (block
))
1243 pp_string (pp
, "[written] ");
1245 if (flags
& TDF_SLIM
)
1248 if (BLOCK_SOURCE_LOCATION (block
))
1249 dump_location (pp
, BLOCK_SOURCE_LOCATION (block
));
1251 newline_and_indent (pp
, spc
+ 2);
1253 if (BLOCK_SUPERCONTEXT (block
))
1255 pp_string (pp
, "SUPERCONTEXT: ");
1256 dump_generic_node (pp
, BLOCK_SUPERCONTEXT (block
), 0,
1257 flags
| TDF_SLIM
, false);
1258 newline_and_indent (pp
, spc
+ 2);
1261 if (BLOCK_SUBBLOCKS (block
))
1263 pp_string (pp
, "SUBBLOCKS: ");
1264 for (t
= BLOCK_SUBBLOCKS (block
); t
; t
= BLOCK_CHAIN (t
))
1266 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
1269 newline_and_indent (pp
, spc
+ 2);
1272 if (BLOCK_CHAIN (block
))
1274 pp_string (pp
, "SIBLINGS: ");
1275 for (t
= BLOCK_CHAIN (block
); t
; t
= BLOCK_CHAIN (t
))
1277 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
1280 newline_and_indent (pp
, spc
+ 2);
1283 if (BLOCK_VARS (block
))
1285 pp_string (pp
, "VARS: ");
1286 for (t
= BLOCK_VARS (block
); t
; t
= TREE_CHAIN (t
))
1288 dump_generic_node (pp
, t
, 0, flags
, false);
1291 newline_and_indent (pp
, spc
+ 2);
1294 if (vec_safe_length (BLOCK_NONLOCALIZED_VARS (block
)) > 0)
1297 vec
<tree
, va_gc
> *nlv
= BLOCK_NONLOCALIZED_VARS (block
);
1299 pp_string (pp
, "NONLOCALIZED_VARS: ");
1300 FOR_EACH_VEC_ELT (*nlv
, i
, t
)
1302 dump_generic_node (pp
, t
, 0, flags
, false);
1305 newline_and_indent (pp
, spc
+ 2);
1308 if (BLOCK_ABSTRACT_ORIGIN (block
))
1310 pp_string (pp
, "ABSTRACT_ORIGIN: ");
1311 dump_generic_node (pp
, BLOCK_ABSTRACT_ORIGIN (block
), 0,
1312 flags
| TDF_SLIM
, false);
1313 newline_and_indent (pp
, spc
+ 2);
1316 if (BLOCK_FRAGMENT_ORIGIN (block
))
1318 pp_string (pp
, "FRAGMENT_ORIGIN: ");
1319 dump_generic_node (pp
, BLOCK_FRAGMENT_ORIGIN (block
), 0,
1320 flags
| TDF_SLIM
, false);
1321 newline_and_indent (pp
, spc
+ 2);
1324 if (BLOCK_FRAGMENT_CHAIN (block
))
1326 pp_string (pp
, "FRAGMENT_CHAIN: ");
1327 for (t
= BLOCK_FRAGMENT_CHAIN (block
); t
; t
= BLOCK_FRAGMENT_CHAIN (t
))
1329 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
1332 newline_and_indent (pp
, spc
+ 2);
1336 /* Dump #pragma omp atomic memory order clause. */
1339 dump_omp_atomic_memory_order (pretty_printer
*pp
, enum omp_memory_order mo
)
1343 case OMP_MEMORY_ORDER_RELAXED
:
1344 pp_string (pp
, " relaxed");
1346 case OMP_MEMORY_ORDER_SEQ_CST
:
1347 pp_string (pp
, " seq_cst");
1349 case OMP_MEMORY_ORDER_ACQ_REL
:
1350 pp_string (pp
, " acq_rel");
1352 case OMP_MEMORY_ORDER_ACQUIRE
:
1353 pp_string (pp
, " acquire");
1355 case OMP_MEMORY_ORDER_RELEASE
:
1356 pp_string (pp
, " release");
1358 case OMP_MEMORY_ORDER_UNSPECIFIED
:
1365 /* Dump the node NODE on the pretty_printer PP, SPC spaces of
1366 indent. FLAGS specifies details to show in the dump (see TDF_* in
1367 dumpfile.h). If IS_STMT is true, the object printed is considered
1368 to be a statement and it is terminated by ';' if appropriate. */
1371 dump_generic_node (pretty_printer
*pp
, tree node
, int spc
, dump_flags_t flags
,
1378 enum tree_code code
;
1380 if (node
== NULL_TREE
)
1383 is_expr
= EXPR_P (node
);
1385 if (is_stmt
&& (flags
& TDF_STMTADDR
))
1386 pp_printf (pp
, "<&%p> ", (void *)node
);
1388 if ((flags
& TDF_LINENO
) && EXPR_HAS_LOCATION (node
))
1389 dump_location (pp
, EXPR_LOCATION (node
));
1391 code
= TREE_CODE (node
);
1395 pp_string (pp
, "<<< error >>>");
1398 case IDENTIFIER_NODE
:
1399 pp_tree_identifier (pp
, node
);
1403 while (node
&& node
!= error_mark_node
)
1405 if (TREE_PURPOSE (node
))
1407 dump_generic_node (pp
, TREE_PURPOSE (node
), spc
, flags
, false);
1410 dump_generic_node (pp
, TREE_VALUE (node
), spc
, flags
, false);
1411 node
= TREE_CHAIN (node
);
1412 if (node
&& TREE_CODE (node
) == TREE_LIST
)
1421 dump_generic_node (pp
, BINFO_TYPE (node
), spc
, flags
, false);
1427 if (TREE_VEC_LENGTH (node
) > 0)
1429 size_t len
= TREE_VEC_LENGTH (node
);
1430 for (i
= 0; i
< len
- 1; i
++)
1432 dump_generic_node (pp
, TREE_VEC_ELT (node
, i
), spc
, flags
,
1437 dump_generic_node (pp
, TREE_VEC_ELT (node
, len
- 1), spc
,
1446 case FIXED_POINT_TYPE
:
1452 unsigned int quals
= TYPE_QUALS (node
);
1453 enum tree_code_class tclass
;
1455 if (quals
& TYPE_QUAL_ATOMIC
)
1456 pp_string (pp
, "atomic ");
1457 if (quals
& TYPE_QUAL_CONST
)
1458 pp_string (pp
, "const ");
1459 else if (quals
& TYPE_QUAL_VOLATILE
)
1460 pp_string (pp
, "volatile ");
1461 else if (quals
& TYPE_QUAL_RESTRICT
)
1462 pp_string (pp
, "restrict ");
1464 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
1466 pp_string (pp
, "<address-space-");
1467 pp_decimal_int (pp
, TYPE_ADDR_SPACE (node
));
1468 pp_string (pp
, "> ");
1471 tclass
= TREE_CODE_CLASS (TREE_CODE (node
));
1473 if (tclass
== tcc_declaration
)
1475 if (DECL_NAME (node
))
1476 dump_decl_name (pp
, node
, flags
);
1478 pp_string (pp
, "<unnamed type decl>");
1480 else if (tclass
== tcc_type
)
1482 if (TYPE_NAME (node
))
1484 if (TREE_CODE (TYPE_NAME (node
)) == IDENTIFIER_NODE
)
1485 pp_tree_identifier (pp
, TYPE_NAME (node
));
1486 else if (TREE_CODE (TYPE_NAME (node
)) == TYPE_DECL
1487 && DECL_NAME (TYPE_NAME (node
)))
1488 dump_decl_name (pp
, TYPE_NAME (node
), flags
);
1490 pp_string (pp
, "<unnamed type>");
1492 else if (TREE_CODE (node
) == VECTOR_TYPE
)
1494 pp_string (pp
, "vector");
1496 pp_wide_integer (pp
, TYPE_VECTOR_SUBPARTS (node
));
1497 pp_string (pp
, ") ");
1498 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1500 else if (TREE_CODE (node
) == INTEGER_TYPE
)
1502 if (TYPE_PRECISION (node
) == CHAR_TYPE_SIZE
)
1503 pp_string (pp
, (TYPE_UNSIGNED (node
)
1506 else if (TYPE_PRECISION (node
) == SHORT_TYPE_SIZE
)
1507 pp_string (pp
, (TYPE_UNSIGNED (node
)
1510 else if (TYPE_PRECISION (node
) == INT_TYPE_SIZE
)
1511 pp_string (pp
, (TYPE_UNSIGNED (node
)
1514 else if (TYPE_PRECISION (node
) == LONG_TYPE_SIZE
)
1515 pp_string (pp
, (TYPE_UNSIGNED (node
)
1518 else if (TYPE_PRECISION (node
) == LONG_LONG_TYPE_SIZE
)
1519 pp_string (pp
, (TYPE_UNSIGNED (node
)
1520 ? "unsigned long long"
1521 : "signed long long"));
1522 else if (TYPE_PRECISION (node
) >= CHAR_TYPE_SIZE
1523 && pow2p_hwi (TYPE_PRECISION (node
)))
1525 pp_string (pp
, (TYPE_UNSIGNED (node
) ? "uint" : "int"));
1526 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1527 pp_string (pp
, "_t");
1531 pp_string (pp
, (TYPE_UNSIGNED (node
)
1532 ? "<unnamed-unsigned:"
1533 : "<unnamed-signed:"));
1534 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1538 else if (TREE_CODE (node
) == COMPLEX_TYPE
)
1540 pp_string (pp
, "__complex__ ");
1541 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1543 else if (TREE_CODE (node
) == REAL_TYPE
)
1545 pp_string (pp
, "<float:");
1546 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1549 else if (TREE_CODE (node
) == FIXED_POINT_TYPE
)
1551 pp_string (pp
, "<fixed-point-");
1552 pp_string (pp
, TYPE_SATURATING (node
) ? "sat:" : "nonsat:");
1553 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1556 else if (TREE_CODE (node
) == VOID_TYPE
)
1557 pp_string (pp
, "void");
1559 pp_string (pp
, "<unnamed type>");
1565 case REFERENCE_TYPE
:
1566 str
= (TREE_CODE (node
) == POINTER_TYPE
? "*" : "&");
1568 if (TREE_TYPE (node
) == NULL
)
1570 pp_string (pp
, str
);
1571 pp_string (pp
, "<null type>");
1573 else if (TREE_CODE (TREE_TYPE (node
)) == FUNCTION_TYPE
)
1575 tree fnode
= TREE_TYPE (node
);
1577 dump_generic_node (pp
, TREE_TYPE (fnode
), spc
, flags
, false);
1580 pp_string (pp
, str
);
1581 if (TYPE_IDENTIFIER (node
))
1582 dump_generic_node (pp
, TYPE_NAME (node
), spc
, flags
, false);
1583 else if (flags
& TDF_NOUID
)
1584 pp_printf (pp
, "<Txxxx>");
1586 pp_printf (pp
, "<T%x>", TYPE_UID (node
));
1588 pp_right_paren (pp
);
1589 dump_function_declaration (pp
, fnode
, spc
, flags
);
1593 unsigned int quals
= TYPE_QUALS (node
);
1595 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1597 pp_string (pp
, str
);
1599 if (quals
& TYPE_QUAL_CONST
)
1600 pp_string (pp
, " const");
1601 if (quals
& TYPE_QUAL_VOLATILE
)
1602 pp_string (pp
, " volatile");
1603 if (quals
& TYPE_QUAL_RESTRICT
)
1604 pp_string (pp
, " restrict");
1606 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
1608 pp_string (pp
, " <address-space-");
1609 pp_decimal_int (pp
, TYPE_ADDR_SPACE (node
));
1613 if (TYPE_REF_CAN_ALIAS_ALL (node
))
1614 pp_string (pp
, " {ref-all}");
1624 if (flags
& TDF_GIMPLE
)
1626 pp_string (pp
, "__MEM <");
1627 dump_generic_node (pp
, TREE_TYPE (node
),
1628 spc
, flags
| TDF_SLIM
, false);
1629 if (TYPE_ALIGN (TREE_TYPE (node
))
1630 != TYPE_ALIGN (TYPE_MAIN_VARIANT (TREE_TYPE (node
))))
1632 pp_string (pp
, ", ");
1633 pp_decimal_int (pp
, TYPE_ALIGN (TREE_TYPE (node
)));
1636 pp_string (pp
, " (");
1637 if (TREE_TYPE (TREE_OPERAND (node
, 0))
1638 != TREE_TYPE (TREE_OPERAND (node
, 1)))
1641 dump_generic_node (pp
, TREE_TYPE (TREE_OPERAND (node
, 1)),
1642 spc
, flags
| TDF_SLIM
, false);
1643 pp_right_paren (pp
);
1645 dump_generic_node (pp
, TREE_OPERAND (node
, 0),
1646 spc
, flags
| TDF_SLIM
, false);
1647 if (! integer_zerop (TREE_OPERAND (node
, 1)))
1649 pp_string (pp
, " + ");
1650 dump_generic_node (pp
, TREE_OPERAND (node
, 1),
1651 spc
, flags
| TDF_SLIM
, false);
1653 pp_right_paren (pp
);
1655 else if (integer_zerop (TREE_OPERAND (node
, 1))
1656 /* Dump the types of INTEGER_CSTs explicitly, for we can't
1657 infer them and MEM_ATTR caching will share MEM_REFs
1658 with differently-typed op0s. */
1659 && TREE_CODE (TREE_OPERAND (node
, 0)) != INTEGER_CST
1660 /* Released SSA_NAMES have no TREE_TYPE. */
1661 && TREE_TYPE (TREE_OPERAND (node
, 0)) != NULL_TREE
1662 /* Same pointer types, but ignoring POINTER_TYPE vs.
1664 && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 0)))
1665 == TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 1))))
1666 && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (node
, 0)))
1667 == TYPE_MODE (TREE_TYPE (TREE_OPERAND (node
, 1))))
1668 && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node
, 0)))
1669 == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node
, 1))))
1670 /* Same value types ignoring qualifiers. */
1671 && (TYPE_MAIN_VARIANT (TREE_TYPE (node
))
1672 == TYPE_MAIN_VARIANT
1673 (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 1)))))
1674 && (!(flags
& TDF_ALIAS
)
1675 || MR_DEPENDENCE_CLIQUE (node
) == 0))
1677 if (TREE_CODE (TREE_OPERAND (node
, 0)) != ADDR_EXPR
)
1680 dump_generic_node (pp
, TREE_OPERAND (node
, 0),
1684 dump_generic_node (pp
,
1685 TREE_OPERAND (TREE_OPERAND (node
, 0), 0),
1692 pp_string (pp
, "MEM[");
1694 ptype
= TYPE_MAIN_VARIANT (TREE_TYPE (TREE_OPERAND (node
, 1)));
1695 dump_generic_node (pp
, ptype
,
1696 spc
, flags
| TDF_SLIM
, false);
1697 pp_right_paren (pp
);
1698 dump_generic_node (pp
, TREE_OPERAND (node
, 0),
1700 if (!integer_zerop (TREE_OPERAND (node
, 1)))
1702 pp_string (pp
, " + ");
1703 dump_generic_node (pp
, TREE_OPERAND (node
, 1),
1706 if ((flags
& TDF_ALIAS
)
1707 && MR_DEPENDENCE_CLIQUE (node
) != 0)
1709 pp_string (pp
, " clique ");
1710 pp_unsigned_wide_integer (pp
, MR_DEPENDENCE_CLIQUE (node
));
1711 pp_string (pp
, " base ");
1712 pp_unsigned_wide_integer (pp
, MR_DEPENDENCE_BASE (node
));
1714 pp_right_bracket (pp
);
1719 case TARGET_MEM_REF
:
1721 const char *sep
= "";
1724 pp_string (pp
, "MEM[");
1726 if (TREE_CODE (TMR_BASE (node
)) == ADDR_EXPR
)
1728 pp_string (pp
, sep
);
1730 pp_string (pp
, "symbol: ");
1731 dump_generic_node (pp
, TREE_OPERAND (TMR_BASE (node
), 0),
1736 pp_string (pp
, sep
);
1738 pp_string (pp
, "base: ");
1739 dump_generic_node (pp
, TMR_BASE (node
), spc
, flags
, false);
1741 tmp
= TMR_INDEX2 (node
);
1744 pp_string (pp
, sep
);
1746 pp_string (pp
, "base: ");
1747 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1749 tmp
= TMR_INDEX (node
);
1752 pp_string (pp
, sep
);
1754 pp_string (pp
, "index: ");
1755 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1757 tmp
= TMR_STEP (node
);
1760 pp_string (pp
, sep
);
1762 pp_string (pp
, "step: ");
1763 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1765 tmp
= TMR_OFFSET (node
);
1768 pp_string (pp
, sep
);
1770 pp_string (pp
, "offset: ");
1771 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1773 pp_right_bracket (pp
);
1781 /* Print the innermost component type. */
1782 for (tmp
= TREE_TYPE (node
); TREE_CODE (tmp
) == ARRAY_TYPE
;
1783 tmp
= TREE_TYPE (tmp
))
1785 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1787 /* Print the dimensions. */
1788 for (tmp
= node
; TREE_CODE (tmp
) == ARRAY_TYPE
; tmp
= TREE_TYPE (tmp
))
1789 dump_array_domain (pp
, TYPE_DOMAIN (tmp
), spc
, flags
);
1795 case QUAL_UNION_TYPE
:
1797 unsigned int quals
= TYPE_QUALS (node
);
1799 if (quals
& TYPE_QUAL_ATOMIC
)
1800 pp_string (pp
, "atomic ");
1801 if (quals
& TYPE_QUAL_CONST
)
1802 pp_string (pp
, "const ");
1803 if (quals
& TYPE_QUAL_VOLATILE
)
1804 pp_string (pp
, "volatile ");
1806 /* Print the name of the structure. */
1807 if (TREE_CODE (node
) == RECORD_TYPE
)
1808 pp_string (pp
, "struct ");
1809 else if (TREE_CODE (node
) == UNION_TYPE
)
1810 pp_string (pp
, "union ");
1812 if (TYPE_NAME (node
))
1813 dump_generic_node (pp
, TYPE_NAME (node
), spc
, flags
, false);
1814 else if (!(flags
& TDF_SLIM
))
1815 /* FIXME: If we eliminate the 'else' above and attempt
1816 to show the fields for named types, we may get stuck
1817 following a cycle of pointers to structs. The alleged
1818 self-reference check in print_struct_decl will not detect
1819 cycles involving more than one pointer or struct type. */
1820 print_struct_decl (pp
, node
, spc
, flags
);
1829 if (flags
& TDF_GIMPLE
1830 && (POINTER_TYPE_P (TREE_TYPE (node
))
1831 || (TYPE_PRECISION (TREE_TYPE (node
))
1832 < TYPE_PRECISION (integer_type_node
))
1833 || exact_log2 (TYPE_PRECISION (TREE_TYPE (node
))) == -1))
1835 pp_string (pp
, "_Literal (");
1836 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1837 pp_string (pp
, ") ");
1839 if (TREE_CODE (TREE_TYPE (node
)) == POINTER_TYPE
1840 && ! (flags
& TDF_GIMPLE
))
1842 /* In the case of a pointer, one may want to divide by the
1843 size of the pointed-to type. Unfortunately, this not
1844 straightforward. The C front-end maps expressions
1849 in such a way that the two INTEGER_CST nodes for "5" have
1850 different values but identical types. In the latter
1851 case, the 5 is multiplied by sizeof (int) in c-common.c
1852 (pointer_int_sum) to convert it to a byte address, and
1853 yet the type of the node is left unchanged. Argh. What
1854 is consistent though is that the number value corresponds
1855 to bytes (UNITS) offset.
1857 NB: Neither of the following divisors can be trivially
1858 used to recover the original literal:
1860 TREE_INT_CST_LOW (TYPE_SIZE_UNIT (TREE_TYPE (node)))
1861 TYPE_PRECISION (TREE_TYPE (TREE_TYPE (node))) */
1862 pp_wide_integer (pp
, TREE_INT_CST_LOW (node
));
1863 pp_string (pp
, "B"); /* pseudo-unit */
1865 else if (tree_fits_shwi_p (node
))
1866 pp_wide_integer (pp
, tree_to_shwi (node
));
1867 else if (tree_fits_uhwi_p (node
))
1868 pp_unsigned_wide_integer (pp
, tree_to_uhwi (node
));
1871 wide_int val
= wi::to_wide (node
);
1873 if (wi::neg_p (val
, TYPE_SIGN (TREE_TYPE (node
))))
1878 print_hex (val
, pp_buffer (pp
)->digit_buffer
);
1879 pp_string (pp
, pp_buffer (pp
)->digit_buffer
);
1881 if ((flags
& TDF_GIMPLE
)
1882 && ! (POINTER_TYPE_P (TREE_TYPE (node
))
1883 || (TYPE_PRECISION (TREE_TYPE (node
))
1884 < TYPE_PRECISION (integer_type_node
))
1885 || exact_log2 (TYPE_PRECISION (TREE_TYPE (node
))) == -1))
1887 if (TYPE_UNSIGNED (TREE_TYPE (node
)))
1888 pp_character (pp
, 'u');
1889 if (TYPE_PRECISION (TREE_TYPE (node
))
1890 == TYPE_PRECISION (unsigned_type_node
))
1892 else if (TYPE_PRECISION (TREE_TYPE (node
))
1893 == TYPE_PRECISION (long_unsigned_type_node
))
1894 pp_character (pp
, 'l');
1895 else if (TYPE_PRECISION (TREE_TYPE (node
))
1896 == TYPE_PRECISION (long_long_unsigned_type_node
))
1897 pp_string (pp
, "ll");
1899 if (TREE_OVERFLOW (node
))
1900 pp_string (pp
, "(OVF)");
1904 pp_string (pp
, "POLY_INT_CST [");
1905 dump_generic_node (pp
, POLY_INT_CST_COEFF (node
, 0), spc
, flags
, false);
1906 for (unsigned int i
= 1; i
< NUM_POLY_INT_COEFFS
; ++i
)
1908 pp_string (pp
, ", ");
1909 dump_generic_node (pp
, POLY_INT_CST_COEFF (node
, i
),
1912 pp_string (pp
, "]");
1916 /* Code copied from print_node. */
1919 if (TREE_OVERFLOW (node
))
1920 pp_string (pp
, " overflow");
1922 d
= TREE_REAL_CST (node
);
1923 if (REAL_VALUE_ISINF (d
))
1924 pp_string (pp
, REAL_VALUE_NEGATIVE (d
) ? " -Inf" : " Inf");
1925 else if (REAL_VALUE_ISNAN (d
))
1926 pp_string (pp
, " Nan");
1930 real_to_decimal (string
, &d
, sizeof (string
), 0, 1);
1931 pp_string (pp
, string
);
1939 fixed_to_decimal (string
, TREE_FIXED_CST_PTR (node
), sizeof (string
));
1940 pp_string (pp
, string
);
1945 pp_string (pp
, "__complex__ (");
1946 dump_generic_node (pp
, TREE_REALPART (node
), spc
, flags
, false);
1947 pp_string (pp
, ", ");
1948 dump_generic_node (pp
, TREE_IMAGPART (node
), spc
, flags
, false);
1949 pp_right_paren (pp
);
1954 pp_string (pp
, "\"");
1955 if (unsigned nbytes
= TREE_STRING_LENGTH (node
))
1956 pretty_print_string (pp
, TREE_STRING_POINTER (node
), nbytes
);
1957 pp_string (pp
, "\"");
1964 pp_string (pp
, "{ ");
1965 unsigned HOST_WIDE_INT nunits
;
1966 if (!VECTOR_CST_NELTS (node
).is_constant (&nunits
))
1967 nunits
= vector_cst_encoded_nelts (node
);
1968 for (i
= 0; i
< nunits
; ++i
)
1971 pp_string (pp
, ", ");
1972 dump_generic_node (pp
, VECTOR_CST_ELT (node
, i
),
1975 if (!VECTOR_CST_NELTS (node
).is_constant ())
1976 pp_string (pp
, ", ...");
1977 pp_string (pp
, " }");
1983 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1985 if (TREE_CODE (node
) == METHOD_TYPE
)
1987 if (TYPE_METHOD_BASETYPE (node
))
1988 dump_generic_node (pp
, TYPE_NAME (TYPE_METHOD_BASETYPE (node
)),
1991 pp_string (pp
, "<null method basetype>");
1992 pp_colon_colon (pp
);
1994 if (TYPE_IDENTIFIER (node
))
1995 dump_generic_node (pp
, TYPE_NAME (node
), spc
, flags
, false);
1996 else if (TYPE_NAME (node
) && DECL_NAME (TYPE_NAME (node
)))
1997 dump_decl_name (pp
, TYPE_NAME (node
), flags
);
1998 else if (flags
& TDF_NOUID
)
1999 pp_printf (pp
, "<Txxxx>");
2001 pp_printf (pp
, "<T%x>", TYPE_UID (node
));
2002 dump_function_declaration (pp
, node
, spc
, flags
);
2007 dump_decl_name (pp
, node
, flags
);
2011 if (DECL_NAME (node
))
2012 dump_decl_name (pp
, node
, flags
);
2013 else if (LABEL_DECL_UID (node
) != -1)
2015 if (flags
& TDF_GIMPLE
)
2016 pp_printf (pp
, "L%d", (int) LABEL_DECL_UID (node
));
2018 pp_printf (pp
, "<L%d>", (int) LABEL_DECL_UID (node
));
2022 if (flags
& TDF_NOUID
)
2023 pp_string (pp
, "<D.xxxx>");
2026 if (flags
& TDF_GIMPLE
)
2027 pp_printf (pp
, "<D%u>", DECL_UID (node
));
2029 pp_printf (pp
, "<D.%u>", DECL_UID (node
));
2035 if (DECL_IS_BUILTIN (node
))
2037 /* Don't print the declaration of built-in types. */
2040 if (DECL_NAME (node
))
2041 dump_decl_name (pp
, node
, flags
);
2042 else if (TYPE_NAME (TREE_TYPE (node
)) != node
)
2044 pp_string (pp
, (TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
2045 ? "union" : "struct "));
2046 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2049 pp_string (pp
, "<anon>");
2055 case DEBUG_EXPR_DECL
:
2056 case NAMESPACE_DECL
:
2058 dump_decl_name (pp
, node
, flags
);
2062 pp_string (pp
, "<retval>");
2066 op0
= TREE_OPERAND (node
, 0);
2069 && (TREE_CODE (op0
) == INDIRECT_REF
2070 || (TREE_CODE (op0
) == MEM_REF
2071 && TREE_CODE (TREE_OPERAND (op0
, 0)) != ADDR_EXPR
2072 && integer_zerop (TREE_OPERAND (op0
, 1))
2073 /* Dump the types of INTEGER_CSTs explicitly, for we
2074 can't infer them and MEM_ATTR caching will share
2075 MEM_REFs with differently-typed op0s. */
2076 && TREE_CODE (TREE_OPERAND (op0
, 0)) != INTEGER_CST
2077 /* Released SSA_NAMES have no TREE_TYPE. */
2078 && TREE_TYPE (TREE_OPERAND (op0
, 0)) != NULL_TREE
2079 /* Same pointer types, but ignoring POINTER_TYPE vs.
2081 && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 0)))
2082 == TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 1))))
2083 && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0
, 0)))
2084 == TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0
, 1))))
2085 && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0
, 0)))
2086 == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0
, 1))))
2087 /* Same value types ignoring qualifiers. */
2088 && (TYPE_MAIN_VARIANT (TREE_TYPE (op0
))
2089 == TYPE_MAIN_VARIANT
2090 (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 1)))))
2091 && MR_DEPENDENCE_CLIQUE (op0
) == 0)))
2093 op0
= TREE_OPERAND (op0
, 0);
2096 if (op_prio (op0
) < op_prio (node
))
2098 dump_generic_node (pp
, op0
, spc
, flags
, false);
2099 if (op_prio (op0
) < op_prio (node
))
2100 pp_right_paren (pp
);
2101 pp_string (pp
, str
);
2102 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2103 op0
= component_ref_field_offset (node
);
2104 if (op0
&& TREE_CODE (op0
) != INTEGER_CST
)
2106 pp_string (pp
, "{off: ");
2107 dump_generic_node (pp
, op0
, spc
, flags
, false);
2108 pp_right_brace (pp
);
2113 pp_string (pp
, "BIT_FIELD_REF <");
2114 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2115 pp_string (pp
, ", ");
2116 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2117 pp_string (pp
, ", ");
2118 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2122 case BIT_INSERT_EXPR
:
2123 pp_string (pp
, "BIT_INSERT_EXPR <");
2124 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2125 pp_string (pp
, ", ");
2126 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2127 pp_string (pp
, ", ");
2128 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2129 pp_string (pp
, " (");
2130 if (INTEGRAL_TYPE_P (TREE_TYPE (TREE_OPERAND (node
, 1))))
2132 TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (node
, 1))));
2134 dump_generic_node (pp
, TYPE_SIZE (TREE_TYPE (TREE_OPERAND (node
, 1))),
2136 pp_string (pp
, " bits)>");
2140 case ARRAY_RANGE_REF
:
2141 op0
= TREE_OPERAND (node
, 0);
2142 if (op_prio (op0
) < op_prio (node
))
2144 dump_generic_node (pp
, op0
, spc
, flags
, false);
2145 if (op_prio (op0
) < op_prio (node
))
2146 pp_right_paren (pp
);
2147 pp_left_bracket (pp
);
2148 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2149 if (TREE_CODE (node
) == ARRAY_RANGE_REF
)
2150 pp_string (pp
, " ...");
2151 pp_right_bracket (pp
);
2153 op0
= array_ref_low_bound (node
);
2154 op1
= array_ref_element_size (node
);
2156 if (!integer_zerop (op0
)
2157 || TREE_OPERAND (node
, 2)
2158 || TREE_OPERAND (node
, 3))
2160 pp_string (pp
, "{lb: ");
2161 dump_generic_node (pp
, op0
, spc
, flags
, false);
2162 pp_string (pp
, " sz: ");
2163 dump_generic_node (pp
, op1
, spc
, flags
, false);
2164 pp_right_brace (pp
);
2170 unsigned HOST_WIDE_INT ix
;
2172 bool is_struct_init
= false;
2173 bool is_array_init
= false;
2176 if (TREE_CLOBBER_P (node
))
2177 pp_string (pp
, "CLOBBER");
2178 else if (TREE_CODE (TREE_TYPE (node
)) == RECORD_TYPE
2179 || TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
)
2180 is_struct_init
= true;
2181 else if (TREE_CODE (TREE_TYPE (node
)) == ARRAY_TYPE
2182 && TYPE_DOMAIN (TREE_TYPE (node
))
2183 && TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
)))
2184 && TREE_CODE (TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
))))
2187 tree minv
= TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
)));
2188 is_array_init
= true;
2189 curidx
= wi::to_widest (minv
);
2191 FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (node
), ix
, field
, val
)
2198 dump_generic_node (pp
, field
, spc
, flags
, false);
2201 else if (is_array_init
2202 && (TREE_CODE (field
) != INTEGER_CST
2203 || curidx
!= wi::to_widest (field
)))
2205 pp_left_bracket (pp
);
2206 if (TREE_CODE (field
) == RANGE_EXPR
)
2208 dump_generic_node (pp
, TREE_OPERAND (field
, 0), spc
,
2210 pp_string (pp
, " ... ");
2211 dump_generic_node (pp
, TREE_OPERAND (field
, 1), spc
,
2213 if (TREE_CODE (TREE_OPERAND (field
, 1)) == INTEGER_CST
)
2214 curidx
= wi::to_widest (TREE_OPERAND (field
, 1));
2217 dump_generic_node (pp
, field
, spc
, flags
, false);
2218 if (TREE_CODE (field
) == INTEGER_CST
)
2219 curidx
= wi::to_widest (field
);
2220 pp_string (pp
, "]=");
2225 if (val
&& TREE_CODE (val
) == ADDR_EXPR
)
2226 if (TREE_CODE (TREE_OPERAND (val
, 0)) == FUNCTION_DECL
)
2227 val
= TREE_OPERAND (val
, 0);
2228 if (val
&& TREE_CODE (val
) == FUNCTION_DECL
)
2229 dump_decl_name (pp
, val
, flags
);
2231 dump_generic_node (pp
, val
, spc
, flags
, false);
2232 if (ix
!= CONSTRUCTOR_NELTS (node
) - 1)
2238 pp_right_brace (pp
);
2245 if (flags
& TDF_SLIM
)
2247 pp_string (pp
, "<COMPOUND_EXPR>");
2251 dump_generic_node (pp
, TREE_OPERAND (node
, 0),
2252 spc
, flags
, !(flags
& TDF_SLIM
));
2253 if (flags
& TDF_SLIM
)
2254 newline_and_indent (pp
, spc
);
2261 for (tp
= &TREE_OPERAND (node
, 1);
2262 TREE_CODE (*tp
) == COMPOUND_EXPR
;
2263 tp
= &TREE_OPERAND (*tp
, 1))
2265 dump_generic_node (pp
, TREE_OPERAND (*tp
, 0),
2266 spc
, flags
, !(flags
& TDF_SLIM
));
2267 if (flags
& TDF_SLIM
)
2268 newline_and_indent (pp
, spc
);
2276 dump_generic_node (pp
, *tp
, spc
, flags
, !(flags
& TDF_SLIM
));
2280 case STATEMENT_LIST
:
2282 tree_stmt_iterator si
;
2285 if (flags
& TDF_SLIM
)
2287 pp_string (pp
, "<STATEMENT_LIST>");
2291 for (si
= tsi_start (node
); !tsi_end_p (si
); tsi_next (&si
))
2294 newline_and_indent (pp
, spc
);
2297 dump_generic_node (pp
, tsi_stmt (si
), spc
, flags
, true);
2304 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
,
2309 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
,
2314 pp_string (pp
, "TARGET_EXPR <");
2315 dump_generic_node (pp
, TARGET_EXPR_SLOT (node
), spc
, flags
, false);
2318 dump_generic_node (pp
, TARGET_EXPR_INITIAL (node
), spc
, flags
, false);
2323 print_declaration (pp
, DECL_EXPR_DECL (node
), spc
, flags
);
2328 if (TREE_TYPE (node
) == NULL
|| TREE_TYPE (node
) == void_type_node
)
2330 pp_string (pp
, "if (");
2331 dump_generic_node (pp
, COND_EXPR_COND (node
), spc
, flags
, false);
2332 pp_right_paren (pp
);
2333 /* The lowered cond_exprs should always be printed in full. */
2334 if (COND_EXPR_THEN (node
)
2335 && (IS_EMPTY_STMT (COND_EXPR_THEN (node
))
2336 || TREE_CODE (COND_EXPR_THEN (node
)) == GOTO_EXPR
)
2337 && COND_EXPR_ELSE (node
)
2338 && (IS_EMPTY_STMT (COND_EXPR_ELSE (node
))
2339 || TREE_CODE (COND_EXPR_ELSE (node
)) == GOTO_EXPR
))
2342 dump_generic_node (pp
, COND_EXPR_THEN (node
),
2344 if (!IS_EMPTY_STMT (COND_EXPR_ELSE (node
)))
2346 pp_string (pp
, " else ");
2347 dump_generic_node (pp
, COND_EXPR_ELSE (node
),
2351 else if (!(flags
& TDF_SLIM
))
2353 /* Output COND_EXPR_THEN. */
2354 if (COND_EXPR_THEN (node
))
2356 newline_and_indent (pp
, spc
+2);
2358 newline_and_indent (pp
, spc
+4);
2359 dump_generic_node (pp
, COND_EXPR_THEN (node
), spc
+4,
2361 newline_and_indent (pp
, spc
+2);
2362 pp_right_brace (pp
);
2365 /* Output COND_EXPR_ELSE. */
2366 if (COND_EXPR_ELSE (node
)
2367 && !IS_EMPTY_STMT (COND_EXPR_ELSE (node
)))
2369 newline_and_indent (pp
, spc
);
2370 pp_string (pp
, "else");
2371 newline_and_indent (pp
, spc
+2);
2373 newline_and_indent (pp
, spc
+4);
2374 dump_generic_node (pp
, COND_EXPR_ELSE (node
), spc
+4,
2376 newline_and_indent (pp
, spc
+2);
2377 pp_right_brace (pp
);
2384 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2388 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2392 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2398 if (!(flags
& TDF_SLIM
))
2400 if (BIND_EXPR_VARS (node
))
2404 for (op0
= BIND_EXPR_VARS (node
); op0
; op0
= DECL_CHAIN (op0
))
2406 print_declaration (pp
, op0
, spc
+2, flags
);
2411 newline_and_indent (pp
, spc
+2);
2412 dump_generic_node (pp
, BIND_EXPR_BODY (node
), spc
+2, flags
, true);
2413 newline_and_indent (pp
, spc
);
2414 pp_right_brace (pp
);
2420 if (CALL_EXPR_FN (node
) != NULL_TREE
)
2421 print_call_name (pp
, CALL_EXPR_FN (node
), flags
);
2425 pp_string (pp
, internal_fn_name (CALL_EXPR_IFN (node
)));
2428 /* Print parameters. */
2433 call_expr_arg_iterator iter
;
2434 FOR_EACH_CALL_EXPR_ARG (arg
, iter
, node
)
2436 dump_generic_node (pp
, arg
, spc
, flags
, false);
2437 if (more_call_expr_args_p (&iter
))
2444 if (CALL_EXPR_VA_ARG_PACK (node
))
2446 if (call_expr_nargs (node
) > 0)
2451 pp_string (pp
, "__builtin_va_arg_pack ()");
2453 pp_right_paren (pp
);
2455 op1
= CALL_EXPR_STATIC_CHAIN (node
);
2458 pp_string (pp
, " [static-chain: ");
2459 dump_generic_node (pp
, op1
, spc
, flags
, false);
2460 pp_right_bracket (pp
);
2463 if (CALL_EXPR_RETURN_SLOT_OPT (node
))
2464 pp_string (pp
, " [return slot optimization]");
2465 if (CALL_EXPR_TAILCALL (node
))
2466 pp_string (pp
, " [tail call]");
2469 case WITH_CLEANUP_EXPR
:
2473 case CLEANUP_POINT_EXPR
:
2474 pp_string (pp
, "<<cleanup_point ");
2475 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2476 pp_string (pp
, ">>");
2479 case PLACEHOLDER_EXPR
:
2480 pp_string (pp
, "<PLACEHOLDER_EXPR ");
2481 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2485 /* Binary arithmetic and logic expressions. */
2486 case WIDEN_SUM_EXPR
:
2487 case WIDEN_MULT_EXPR
:
2489 case MULT_HIGHPART_EXPR
:
2491 case POINTER_PLUS_EXPR
:
2492 case POINTER_DIFF_EXPR
:
2494 case TRUNC_DIV_EXPR
:
2496 case FLOOR_DIV_EXPR
:
2497 case ROUND_DIV_EXPR
:
2498 case TRUNC_MOD_EXPR
:
2500 case FLOOR_MOD_EXPR
:
2501 case ROUND_MOD_EXPR
:
2503 case EXACT_DIV_EXPR
:
2508 case WIDEN_LSHIFT_EXPR
:
2512 case TRUTH_ANDIF_EXPR
:
2513 case TRUTH_ORIF_EXPR
:
2514 case TRUTH_AND_EXPR
:
2516 case TRUTH_XOR_EXPR
:
2530 case UNORDERED_EXPR
:
2532 const char *op
= op_symbol (node
);
2533 op0
= TREE_OPERAND (node
, 0);
2534 op1
= TREE_OPERAND (node
, 1);
2536 /* When the operands are expressions with less priority,
2537 keep semantics of the tree representation. */
2538 if (op_prio (op0
) <= op_prio (node
))
2541 dump_generic_node (pp
, op0
, spc
, flags
, false);
2542 pp_right_paren (pp
);
2545 dump_generic_node (pp
, op0
, spc
, flags
, false);
2551 /* When the operands are expressions with less priority,
2552 keep semantics of the tree representation. */
2553 if (op_prio (op1
) <= op_prio (node
))
2556 dump_generic_node (pp
, op1
, spc
, flags
, false);
2557 pp_right_paren (pp
);
2560 dump_generic_node (pp
, op1
, spc
, flags
, false);
2564 /* Unary arithmetic and logic expressions. */
2567 case TRUTH_NOT_EXPR
:
2569 case PREDECREMENT_EXPR
:
2570 case PREINCREMENT_EXPR
:
2572 if (TREE_CODE (node
) == ADDR_EXPR
2573 && (TREE_CODE (TREE_OPERAND (node
, 0)) == STRING_CST
2574 || TREE_CODE (TREE_OPERAND (node
, 0)) == FUNCTION_DECL
))
2575 ; /* Do not output '&' for strings and function pointers. */
2577 pp_string (pp
, op_symbol (node
));
2579 if (op_prio (TREE_OPERAND (node
, 0)) < op_prio (node
))
2582 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2583 pp_right_paren (pp
);
2586 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2589 case POSTDECREMENT_EXPR
:
2590 case POSTINCREMENT_EXPR
:
2591 if (op_prio (TREE_OPERAND (node
, 0)) < op_prio (node
))
2594 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2595 pp_right_paren (pp
);
2598 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2599 pp_string (pp
, op_symbol (node
));
2603 pp_string (pp
, "MIN_EXPR <");
2604 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2605 pp_string (pp
, ", ");
2606 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2611 pp_string (pp
, "MAX_EXPR <");
2612 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2613 pp_string (pp
, ", ");
2614 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2619 pp_string (pp
, "ABS_EXPR <");
2620 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2625 pp_string (pp
, "ABSU_EXPR <");
2626 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2634 case ADDR_SPACE_CONVERT_EXPR
:
2635 case FIXED_CONVERT_EXPR
:
2636 case FIX_TRUNC_EXPR
:
2639 type
= TREE_TYPE (node
);
2640 op0
= TREE_OPERAND (node
, 0);
2641 if (type
!= TREE_TYPE (op0
))
2644 dump_generic_node (pp
, type
, spc
, flags
, false);
2645 pp_string (pp
, ") ");
2647 if (op_prio (op0
) < op_prio (node
))
2649 dump_generic_node (pp
, op0
, spc
, flags
, false);
2650 if (op_prio (op0
) < op_prio (node
))
2651 pp_right_paren (pp
);
2654 case VIEW_CONVERT_EXPR
:
2655 pp_string (pp
, "VIEW_CONVERT_EXPR<");
2656 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2657 pp_string (pp
, ">(");
2658 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2659 pp_right_paren (pp
);
2663 pp_string (pp
, "((");
2664 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2665 pp_string (pp
, "))");
2668 case NON_LVALUE_EXPR
:
2669 pp_string (pp
, "NON_LVALUE_EXPR <");
2670 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2675 pp_string (pp
, "SAVE_EXPR <");
2676 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2681 pp_string (pp
, "COMPLEX_EXPR <");
2682 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2683 pp_string (pp
, ", ");
2684 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2689 pp_string (pp
, "CONJ_EXPR <");
2690 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2695 if (flags
& TDF_GIMPLE
)
2697 pp_string (pp
, "__real ");
2698 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2702 pp_string (pp
, "REALPART_EXPR <");
2703 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2709 if (flags
& TDF_GIMPLE
)
2711 pp_string (pp
, "__imag ");
2712 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2716 pp_string (pp
, "IMAGPART_EXPR <");
2717 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2723 pp_string (pp
, "VA_ARG_EXPR <");
2724 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2728 case TRY_FINALLY_EXPR
:
2729 case TRY_CATCH_EXPR
:
2730 pp_string (pp
, "try");
2731 newline_and_indent (pp
, spc
+2);
2733 newline_and_indent (pp
, spc
+4);
2734 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
+4, flags
, true);
2735 newline_and_indent (pp
, spc
+2);
2736 pp_right_brace (pp
);
2737 newline_and_indent (pp
, spc
);
2739 (TREE_CODE (node
) == TRY_CATCH_EXPR
) ? "catch" : "finally");
2740 newline_and_indent (pp
, spc
+2);
2742 newline_and_indent (pp
, spc
+4);
2743 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
+4, flags
, true);
2744 newline_and_indent (pp
, spc
+2);
2745 pp_right_brace (pp
);
2750 pp_string (pp
, "catch (");
2751 dump_generic_node (pp
, CATCH_TYPES (node
), spc
+2, flags
, false);
2752 pp_right_paren (pp
);
2753 newline_and_indent (pp
, spc
+2);
2755 newline_and_indent (pp
, spc
+4);
2756 dump_generic_node (pp
, CATCH_BODY (node
), spc
+4, flags
, true);
2757 newline_and_indent (pp
, spc
+2);
2758 pp_right_brace (pp
);
2762 case EH_FILTER_EXPR
:
2763 pp_string (pp
, "<<<eh_filter (");
2764 dump_generic_node (pp
, EH_FILTER_TYPES (node
), spc
+2, flags
, false);
2765 pp_string (pp
, ")>>>");
2766 newline_and_indent (pp
, spc
+2);
2768 newline_and_indent (pp
, spc
+4);
2769 dump_generic_node (pp
, EH_FILTER_FAILURE (node
), spc
+4, flags
, true);
2770 newline_and_indent (pp
, spc
+2);
2771 pp_right_brace (pp
);
2776 op0
= TREE_OPERAND (node
, 0);
2777 /* If this is for break or continue, don't bother printing it. */
2778 if (DECL_NAME (op0
))
2780 const char *name
= IDENTIFIER_POINTER (DECL_NAME (op0
));
2781 if (strcmp (name
, "break") == 0
2782 || strcmp (name
, "continue") == 0)
2785 dump_generic_node (pp
, op0
, spc
, flags
, false);
2787 if (DECL_NONLOCAL (op0
))
2788 pp_string (pp
, " [non-local]");
2792 pp_string (pp
, "while (1)");
2793 if (!(flags
& TDF_SLIM
))
2795 newline_and_indent (pp
, spc
+2);
2797 newline_and_indent (pp
, spc
+4);
2798 dump_generic_node (pp
, LOOP_EXPR_BODY (node
), spc
+4, flags
, true);
2799 newline_and_indent (pp
, spc
+2);
2800 pp_right_brace (pp
);
2806 pp_string (pp
, "// predicted ");
2807 if (PREDICT_EXPR_OUTCOME (node
))
2808 pp_string (pp
, "likely by ");
2810 pp_string (pp
, "unlikely by ");
2811 pp_string (pp
, predictor_name (PREDICT_EXPR_PREDICTOR (node
)));
2812 pp_string (pp
, " predictor.");
2816 pp_string (pp
, "ANNOTATE_EXPR <");
2817 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2818 switch ((enum annot_expr_kind
) TREE_INT_CST_LOW (TREE_OPERAND (node
, 1)))
2820 case annot_expr_ivdep_kind
:
2821 pp_string (pp
, ", ivdep");
2823 case annot_expr_unroll_kind
:
2824 pp_printf (pp
, ", unroll %d",
2825 (int) TREE_INT_CST_LOW (TREE_OPERAND (node
, 2)));
2827 case annot_expr_no_vector_kind
:
2828 pp_string (pp
, ", no-vector");
2830 case annot_expr_vector_kind
:
2831 pp_string (pp
, ", vector");
2833 case annot_expr_parallel_kind
:
2834 pp_string (pp
, ", parallel");
2843 pp_string (pp
, "return");
2844 op0
= TREE_OPERAND (node
, 0);
2848 if (TREE_CODE (op0
) == MODIFY_EXPR
)
2849 dump_generic_node (pp
, TREE_OPERAND (op0
, 1),
2852 dump_generic_node (pp
, op0
, spc
, flags
, false);
2857 pp_string (pp
, "if (");
2858 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2859 pp_string (pp
, ") break");
2863 pp_string (pp
, "switch (");
2864 dump_generic_node (pp
, SWITCH_COND (node
), spc
, flags
, false);
2865 pp_right_paren (pp
);
2866 if (!(flags
& TDF_SLIM
))
2868 newline_and_indent (pp
, spc
+2);
2870 if (SWITCH_BODY (node
))
2872 newline_and_indent (pp
, spc
+4);
2873 dump_generic_node (pp
, SWITCH_BODY (node
), spc
+4, flags
,
2876 newline_and_indent (pp
, spc
+2);
2877 pp_right_brace (pp
);
2883 op0
= GOTO_DESTINATION (node
);
2884 if (TREE_CODE (op0
) != SSA_NAME
&& DECL_P (op0
) && DECL_NAME (op0
))
2886 const char *name
= IDENTIFIER_POINTER (DECL_NAME (op0
));
2887 if (strcmp (name
, "break") == 0
2888 || strcmp (name
, "continue") == 0)
2890 pp_string (pp
, name
);
2894 pp_string (pp
, "goto ");
2895 dump_generic_node (pp
, op0
, spc
, flags
, false);
2899 pp_string (pp
, "__asm__");
2900 if (ASM_VOLATILE_P (node
))
2901 pp_string (pp
, " __volatile__");
2903 dump_generic_node (pp
, ASM_STRING (node
), spc
, flags
, false);
2905 dump_generic_node (pp
, ASM_OUTPUTS (node
), spc
, flags
, false);
2907 dump_generic_node (pp
, ASM_INPUTS (node
), spc
, flags
, false);
2908 if (ASM_CLOBBERS (node
))
2911 dump_generic_node (pp
, ASM_CLOBBERS (node
), spc
, flags
, false);
2913 pp_right_paren (pp
);
2916 case CASE_LABEL_EXPR
:
2917 if (CASE_LOW (node
) && CASE_HIGH (node
))
2919 pp_string (pp
, "case ");
2920 dump_generic_node (pp
, CASE_LOW (node
), spc
, flags
, false);
2921 pp_string (pp
, " ... ");
2922 dump_generic_node (pp
, CASE_HIGH (node
), spc
, flags
, false);
2924 else if (CASE_LOW (node
))
2926 pp_string (pp
, "case ");
2927 dump_generic_node (pp
, CASE_LOW (node
), spc
, flags
, false);
2930 pp_string (pp
, "default");
2935 pp_string (pp
, "OBJ_TYPE_REF(");
2936 dump_generic_node (pp
, OBJ_TYPE_REF_EXPR (node
), spc
, flags
, false);
2938 /* We omit the class type for -fcompare-debug because we may
2939 drop TYPE_BINFO early depending on debug info, and then
2940 virtual_method_call_p would return false, whereas when
2941 TYPE_BINFO is preserved it may still return true and then
2942 we'd print the class type. Compare tree and rtl dumps for
2943 libstdc++-prettyprinters/shared_ptr.cc with and without -g,
2944 for example, at occurrences of OBJ_TYPE_REF. */
2945 if (!(flags
& (TDF_SLIM
| TDF_COMPARE_DEBUG
))
2946 && virtual_method_call_p (node
))
2948 pp_string (pp
, "(");
2949 dump_generic_node (pp
, obj_type_ref_class (node
), spc
, flags
, false);
2950 pp_string (pp
, ")");
2952 dump_generic_node (pp
, OBJ_TYPE_REF_OBJECT (node
), spc
, flags
, false);
2954 dump_generic_node (pp
, OBJ_TYPE_REF_TOKEN (node
), spc
, flags
, false);
2955 pp_right_paren (pp
);
2959 if (SSA_NAME_IDENTIFIER (node
))
2961 if ((flags
& TDF_NOUID
)
2962 && SSA_NAME_VAR (node
)
2963 && DECL_NAMELESS (SSA_NAME_VAR (node
)))
2964 dump_fancy_name (pp
, SSA_NAME_IDENTIFIER (node
));
2965 else if (! (flags
& TDF_GIMPLE
)
2966 || SSA_NAME_VAR (node
))
2967 dump_generic_node (pp
, SSA_NAME_IDENTIFIER (node
),
2971 pp_decimal_int (pp
, SSA_NAME_VERSION (node
));
2972 if (SSA_NAME_IS_DEFAULT_DEF (node
))
2973 pp_string (pp
, "(D)");
2974 if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (node
))
2975 pp_string (pp
, "(ab)");
2978 case WITH_SIZE_EXPR
:
2979 pp_string (pp
, "WITH_SIZE_EXPR <");
2980 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2981 pp_string (pp
, ", ");
2982 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2987 pp_string (pp
, "ASSERT_EXPR <");
2988 dump_generic_node (pp
, ASSERT_EXPR_VAR (node
), spc
, flags
, false);
2989 pp_string (pp
, ", ");
2990 dump_generic_node (pp
, ASSERT_EXPR_COND (node
), spc
, flags
, false);
2995 pp_string (pp
, "scev_known");
2998 case SCEV_NOT_KNOWN
:
2999 pp_string (pp
, "scev_not_known");
3002 case POLYNOMIAL_CHREC
:
3004 dump_generic_node (pp
, CHREC_LEFT (node
), spc
, flags
, false);
3005 pp_string (pp
, ", +, ");
3006 dump_generic_node (pp
, CHREC_RIGHT (node
), spc
, flags
, false);
3007 pp_printf (pp
, "}_%u", CHREC_VARIABLE (node
));
3011 case REALIGN_LOAD_EXPR
:
3012 pp_string (pp
, "REALIGN_LOAD <");
3013 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3014 pp_string (pp
, ", ");
3015 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3016 pp_string (pp
, ", ");
3017 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3022 pp_string (pp
, " VEC_COND_EXPR < ");
3023 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3024 pp_string (pp
, " , ");
3025 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3026 pp_string (pp
, " , ");
3027 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3028 pp_string (pp
, " > ");
3032 pp_string (pp
, " VEC_PERM_EXPR < ");
3033 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3034 pp_string (pp
, " , ");
3035 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3036 pp_string (pp
, " , ");
3037 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3038 pp_string (pp
, " > ");
3042 pp_string (pp
, " DOT_PROD_EXPR < ");
3043 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3044 pp_string (pp
, ", ");
3045 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3046 pp_string (pp
, ", ");
3047 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3048 pp_string (pp
, " > ");
3051 case WIDEN_MULT_PLUS_EXPR
:
3052 pp_string (pp
, " WIDEN_MULT_PLUS_EXPR < ");
3053 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3054 pp_string (pp
, ", ");
3055 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3056 pp_string (pp
, ", ");
3057 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3058 pp_string (pp
, " > ");
3061 case WIDEN_MULT_MINUS_EXPR
:
3062 pp_string (pp
, " WIDEN_MULT_MINUS_EXPR < ");
3063 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3064 pp_string (pp
, ", ");
3065 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3066 pp_string (pp
, ", ");
3067 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3068 pp_string (pp
, " > ");
3072 pp_string (pp
, "#pragma acc parallel");
3073 goto dump_omp_clauses_body
;
3076 pp_string (pp
, "#pragma acc kernels");
3077 goto dump_omp_clauses_body
;
3080 pp_string (pp
, "#pragma acc data");
3081 dump_omp_clauses (pp
, OACC_DATA_CLAUSES (node
), spc
, flags
);
3084 case OACC_HOST_DATA
:
3085 pp_string (pp
, "#pragma acc host_data");
3086 dump_omp_clauses (pp
, OACC_HOST_DATA_CLAUSES (node
), spc
, flags
);
3090 pp_string (pp
, "#pragma acc declare");
3091 dump_omp_clauses (pp
, OACC_DECLARE_CLAUSES (node
), spc
, flags
);
3095 pp_string (pp
, "#pragma acc update");
3096 dump_omp_clauses (pp
, OACC_UPDATE_CLAUSES (node
), spc
, flags
);
3099 case OACC_ENTER_DATA
:
3100 pp_string (pp
, "#pragma acc enter data");
3101 dump_omp_clauses (pp
, OACC_ENTER_DATA_CLAUSES (node
), spc
, flags
);
3104 case OACC_EXIT_DATA
:
3105 pp_string (pp
, "#pragma acc exit data");
3106 dump_omp_clauses (pp
, OACC_EXIT_DATA_CLAUSES (node
), spc
, flags
);
3110 pp_string (pp
, "#pragma acc cache");
3111 dump_omp_clauses (pp
, OACC_CACHE_CLAUSES (node
), spc
, flags
);
3115 pp_string (pp
, "#pragma omp parallel");
3116 dump_omp_clauses (pp
, OMP_PARALLEL_CLAUSES (node
), spc
, flags
);
3119 dump_omp_clauses_body
:
3120 dump_omp_clauses (pp
, OMP_CLAUSES (node
), spc
, flags
);
3124 if (!(flags
& TDF_SLIM
) && OMP_BODY (node
))
3126 newline_and_indent (pp
, spc
+ 2);
3128 newline_and_indent (pp
, spc
+ 4);
3129 dump_generic_node (pp
, OMP_BODY (node
), spc
+ 4, flags
, false);
3130 newline_and_indent (pp
, spc
+ 2);
3131 pp_right_brace (pp
);
3137 pp_string (pp
, OMP_TASK_BODY (node
) ? "#pragma omp task"
3138 : "#pragma omp taskwait");
3139 dump_omp_clauses (pp
, OMP_TASK_CLAUSES (node
), spc
, flags
);
3143 pp_string (pp
, "#pragma omp for");
3147 pp_string (pp
, "#pragma omp simd");
3150 case OMP_DISTRIBUTE
:
3151 pp_string (pp
, "#pragma omp distribute");
3155 pp_string (pp
, "#pragma omp taskloop");
3159 pp_string (pp
, "#pragma acc loop");
3163 pp_string (pp
, "#pragma omp teams");
3164 dump_omp_clauses (pp
, OMP_TEAMS_CLAUSES (node
), spc
, flags
);
3167 case OMP_TARGET_DATA
:
3168 pp_string (pp
, "#pragma omp target data");
3169 dump_omp_clauses (pp
, OMP_TARGET_DATA_CLAUSES (node
), spc
, flags
);
3172 case OMP_TARGET_ENTER_DATA
:
3173 pp_string (pp
, "#pragma omp target enter data");
3174 dump_omp_clauses (pp
, OMP_TARGET_ENTER_DATA_CLAUSES (node
), spc
, flags
);
3178 case OMP_TARGET_EXIT_DATA
:
3179 pp_string (pp
, "#pragma omp target exit data");
3180 dump_omp_clauses (pp
, OMP_TARGET_EXIT_DATA_CLAUSES (node
), spc
, flags
);
3185 pp_string (pp
, "#pragma omp target");
3186 dump_omp_clauses (pp
, OMP_TARGET_CLAUSES (node
), spc
, flags
);
3189 case OMP_TARGET_UPDATE
:
3190 pp_string (pp
, "#pragma omp target update");
3191 dump_omp_clauses (pp
, OMP_TARGET_UPDATE_CLAUSES (node
), spc
, flags
);
3196 dump_omp_clauses (pp
, OMP_FOR_CLAUSES (node
), spc
, flags
);
3197 if (!(flags
& TDF_SLIM
))
3201 if (OMP_FOR_PRE_BODY (node
))
3203 newline_and_indent (pp
, spc
+ 2);
3206 newline_and_indent (pp
, spc
);
3207 dump_generic_node (pp
, OMP_FOR_PRE_BODY (node
),
3210 if (OMP_FOR_INIT (node
))
3213 for (i
= 0; i
< TREE_VEC_LENGTH (OMP_FOR_INIT (node
)); i
++)
3216 newline_and_indent (pp
, spc
);
3217 pp_string (pp
, "for (");
3218 dump_generic_node (pp
,
3219 TREE_VEC_ELT (OMP_FOR_INIT (node
), i
),
3221 pp_string (pp
, "; ");
3222 dump_generic_node (pp
,
3223 TREE_VEC_ELT (OMP_FOR_COND (node
), i
),
3225 pp_string (pp
, "; ");
3226 dump_generic_node (pp
,
3227 TREE_VEC_ELT (OMP_FOR_INCR (node
), i
),
3229 pp_right_paren (pp
);
3232 if (OMP_FOR_BODY (node
))
3234 newline_and_indent (pp
, spc
+ 2);
3236 newline_and_indent (pp
, spc
+ 4);
3237 dump_generic_node (pp
, OMP_FOR_BODY (node
), spc
+ 4, flags
,
3239 newline_and_indent (pp
, spc
+ 2);
3240 pp_right_brace (pp
);
3242 if (OMP_FOR_INIT (node
))
3243 spc
-= 2 * TREE_VEC_LENGTH (OMP_FOR_INIT (node
)) - 2;
3244 if (OMP_FOR_PRE_BODY (node
))
3247 newline_and_indent (pp
, spc
+ 2);
3248 pp_right_brace (pp
);
3255 pp_string (pp
, "#pragma omp sections");
3256 dump_omp_clauses (pp
, OMP_SECTIONS_CLAUSES (node
), spc
, flags
);
3260 pp_string (pp
, "#pragma omp section");
3264 pp_string (pp
, "#pragma omp master");
3268 pp_string (pp
, "#pragma omp taskgroup");
3269 dump_omp_clauses (pp
, OMP_TASKGROUP_CLAUSES (node
), spc
, flags
);
3273 pp_string (pp
, "#pragma omp ordered");
3274 dump_omp_clauses (pp
, OMP_ORDERED_CLAUSES (node
), spc
, flags
);
3278 pp_string (pp
, "#pragma omp critical");
3279 if (OMP_CRITICAL_NAME (node
))
3283 dump_generic_node (pp
, OMP_CRITICAL_NAME (node
), spc
,
3285 pp_right_paren (pp
);
3287 dump_omp_clauses (pp
, OMP_CRITICAL_CLAUSES (node
), spc
, flags
);
3291 pp_string (pp
, "#pragma omp atomic");
3292 dump_omp_atomic_memory_order (pp
, OMP_ATOMIC_MEMORY_ORDER (node
));
3293 newline_and_indent (pp
, spc
+ 2);
3294 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3298 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3301 case OMP_ATOMIC_READ
:
3302 pp_string (pp
, "#pragma omp atomic read");
3303 dump_omp_atomic_memory_order (pp
, OMP_ATOMIC_MEMORY_ORDER (node
));
3304 newline_and_indent (pp
, spc
+ 2);
3305 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3309 case OMP_ATOMIC_CAPTURE_OLD
:
3310 case OMP_ATOMIC_CAPTURE_NEW
:
3311 pp_string (pp
, "#pragma omp atomic capture");
3312 dump_omp_atomic_memory_order (pp
, OMP_ATOMIC_MEMORY_ORDER (node
));
3313 newline_and_indent (pp
, spc
+ 2);
3314 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3318 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3322 pp_string (pp
, "#pragma omp single");
3323 dump_omp_clauses (pp
, OMP_SINGLE_CLAUSES (node
), spc
, flags
);
3327 dump_omp_clause (pp
, node
, spc
, flags
);
3331 case TRANSACTION_EXPR
:
3332 if (TRANSACTION_EXPR_OUTER (node
))
3333 pp_string (pp
, "__transaction_atomic [[outer]]");
3334 else if (TRANSACTION_EXPR_RELAXED (node
))
3335 pp_string (pp
, "__transaction_relaxed");
3337 pp_string (pp
, "__transaction_atomic");
3338 if (!(flags
& TDF_SLIM
) && TRANSACTION_EXPR_BODY (node
))
3340 newline_and_indent (pp
, spc
);
3342 newline_and_indent (pp
, spc
+ 2);
3343 dump_generic_node (pp
, TRANSACTION_EXPR_BODY (node
),
3344 spc
+ 2, flags
, false);
3345 newline_and_indent (pp
, spc
);
3346 pp_right_brace (pp
);
3351 case VEC_SERIES_EXPR
:
3352 case VEC_WIDEN_MULT_HI_EXPR
:
3353 case VEC_WIDEN_MULT_LO_EXPR
:
3354 case VEC_WIDEN_MULT_EVEN_EXPR
:
3355 case VEC_WIDEN_MULT_ODD_EXPR
:
3356 case VEC_WIDEN_LSHIFT_HI_EXPR
:
3357 case VEC_WIDEN_LSHIFT_LO_EXPR
:
3359 for (str
= get_tree_code_name (code
); *str
; str
++)
3360 pp_character (pp
, TOUPPER (*str
));
3361 pp_string (pp
, " < ");
3362 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3363 pp_string (pp
, ", ");
3364 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3365 pp_string (pp
, " > ");
3368 case VEC_DUPLICATE_EXPR
:
3370 for (str
= get_tree_code_name (code
); *str
; str
++)
3371 pp_character (pp
, TOUPPER (*str
));
3372 pp_string (pp
, " < ");
3373 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3374 pp_string (pp
, " > ");
3377 case VEC_UNPACK_HI_EXPR
:
3378 pp_string (pp
, " VEC_UNPACK_HI_EXPR < ");
3379 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3380 pp_string (pp
, " > ");
3383 case VEC_UNPACK_LO_EXPR
:
3384 pp_string (pp
, " VEC_UNPACK_LO_EXPR < ");
3385 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3386 pp_string (pp
, " > ");
3389 case VEC_UNPACK_FLOAT_HI_EXPR
:
3390 pp_string (pp
, " VEC_UNPACK_FLOAT_HI_EXPR < ");
3391 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3392 pp_string (pp
, " > ");
3395 case VEC_UNPACK_FLOAT_LO_EXPR
:
3396 pp_string (pp
, " VEC_UNPACK_FLOAT_LO_EXPR < ");
3397 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3398 pp_string (pp
, " > ");
3401 case VEC_UNPACK_FIX_TRUNC_HI_EXPR
:
3402 pp_string (pp
, " VEC_UNPACK_FIX_TRUNC_HI_EXPR < ");
3403 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3404 pp_string (pp
, " > ");
3407 case VEC_UNPACK_FIX_TRUNC_LO_EXPR
:
3408 pp_string (pp
, " VEC_UNPACK_FIX_TRUNC_LO_EXPR < ");
3409 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3410 pp_string (pp
, " > ");
3413 case VEC_PACK_TRUNC_EXPR
:
3414 pp_string (pp
, " VEC_PACK_TRUNC_EXPR < ");
3415 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3416 pp_string (pp
, ", ");
3417 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3418 pp_string (pp
, " > ");
3421 case VEC_PACK_SAT_EXPR
:
3422 pp_string (pp
, " VEC_PACK_SAT_EXPR < ");
3423 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3424 pp_string (pp
, ", ");
3425 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3426 pp_string (pp
, " > ");
3429 case VEC_PACK_FIX_TRUNC_EXPR
:
3430 pp_string (pp
, " VEC_PACK_FIX_TRUNC_EXPR < ");
3431 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3432 pp_string (pp
, ", ");
3433 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3434 pp_string (pp
, " > ");
3437 case VEC_PACK_FLOAT_EXPR
:
3438 pp_string (pp
, " VEC_PACK_FLOAT_EXPR < ");
3439 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3440 pp_string (pp
, ", ");
3441 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3442 pp_string (pp
, " > ");
3446 dump_block_node (pp
, node
, spc
, flags
);
3449 case DEBUG_BEGIN_STMT
:
3450 pp_string (pp
, "# DEBUG BEGIN STMT");
3457 if (is_stmt
&& is_expr
)
3463 /* Print the declaration of a variable. */
3466 print_declaration (pretty_printer
*pp
, tree t
, int spc
, dump_flags_t flags
)
3470 if (TREE_CODE(t
) == NAMELIST_DECL
)
3472 pp_string(pp
, "namelist ");
3473 dump_decl_name (pp
, t
, flags
);
3478 if (TREE_CODE (t
) == TYPE_DECL
)
3479 pp_string (pp
, "typedef ");
3481 if (CODE_CONTAINS_STRUCT (TREE_CODE (t
), TS_DECL_WRTL
) && DECL_REGISTER (t
))
3482 pp_string (pp
, "register ");
3484 if (TREE_PUBLIC (t
) && DECL_EXTERNAL (t
))
3485 pp_string (pp
, "extern ");
3486 else if (TREE_STATIC (t
))
3487 pp_string (pp
, "static ");
3489 /* Print the type and name. */
3490 if (TREE_TYPE (t
) && TREE_CODE (TREE_TYPE (t
)) == ARRAY_TYPE
)
3494 /* Print array's type. */
3495 tmp
= TREE_TYPE (t
);
3496 while (TREE_CODE (TREE_TYPE (tmp
)) == ARRAY_TYPE
)
3497 tmp
= TREE_TYPE (tmp
);
3498 dump_generic_node (pp
, TREE_TYPE (tmp
), spc
, flags
, false);
3500 /* Print variable's name. */
3502 dump_generic_node (pp
, t
, spc
, flags
, false);
3504 /* Print the dimensions. */
3505 tmp
= TREE_TYPE (t
);
3506 while (TREE_CODE (tmp
) == ARRAY_TYPE
)
3508 dump_array_domain (pp
, TYPE_DOMAIN (tmp
), spc
, flags
);
3509 tmp
= TREE_TYPE (tmp
);
3512 else if (TREE_CODE (t
) == FUNCTION_DECL
)
3514 dump_generic_node (pp
, TREE_TYPE (TREE_TYPE (t
)), spc
, flags
, false);
3516 dump_decl_name (pp
, t
, flags
);
3517 dump_function_declaration (pp
, TREE_TYPE (t
), spc
, flags
);
3521 /* Print type declaration. */
3522 dump_generic_node (pp
, TREE_TYPE (t
), spc
, flags
, false);
3524 /* Print variable's name. */
3526 dump_generic_node (pp
, t
, spc
, flags
, false);
3529 if (VAR_P (t
) && DECL_HARD_REGISTER (t
))
3531 pp_string (pp
, " __asm__ ");
3533 dump_generic_node (pp
, DECL_ASSEMBLER_NAME (t
), spc
, flags
, false);
3534 pp_right_paren (pp
);
3537 /* The initial value of a function serves to determine whether the function
3538 is declared or defined. So the following does not apply to function
3540 if (TREE_CODE (t
) != FUNCTION_DECL
)
3542 /* Print the initial value. */
3543 if (DECL_INITIAL (t
))
3548 if (!(flags
& TDF_SLIM
))
3549 dump_generic_node (pp
, DECL_INITIAL (t
), spc
, flags
, false);
3551 pp_string (pp
, "<<< omitted >>>");
3555 if (VAR_P (t
) && DECL_HAS_VALUE_EXPR_P (t
))
3557 pp_string (pp
, " [value-expr: ");
3558 dump_generic_node (pp
, DECL_VALUE_EXPR (t
), spc
, flags
, false);
3559 pp_right_bracket (pp
);
3566 /* Prints a structure: name, fields, and methods.
3567 FIXME: Still incomplete. */
3570 print_struct_decl (pretty_printer
*pp
, const_tree node
, int spc
,
3573 /* Print the name of the structure. */
3574 if (TYPE_NAME (node
))
3577 if (TREE_CODE (node
) == RECORD_TYPE
)
3578 pp_string (pp
, "struct ");
3579 else if ((TREE_CODE (node
) == UNION_TYPE
3580 || TREE_CODE (node
) == QUAL_UNION_TYPE
))
3581 pp_string (pp
, "union ");
3583 dump_generic_node (pp
, TYPE_NAME (node
), spc
, TDF_NONE
, false);
3586 /* Print the contents of the structure. */
3592 /* Print the fields of the structure. */
3595 tmp
= TYPE_FIELDS (node
);
3598 /* Avoid to print recursively the structure. */
3599 /* FIXME : Not implemented correctly...,
3600 what about the case when we have a cycle in the contain graph? ...
3601 Maybe this could be solved by looking at the scope in which the
3602 structure was declared. */
3603 if (TREE_TYPE (tmp
) != node
3604 && (TREE_CODE (TREE_TYPE (tmp
)) != POINTER_TYPE
3605 || TREE_TYPE (TREE_TYPE (tmp
)) != node
))
3607 print_declaration (pp
, tmp
, spc
+2, flags
);
3610 tmp
= DECL_CHAIN (tmp
);
3614 pp_right_brace (pp
);
3617 /* Return the priority of the operator CODE.
3619 From lowest to highest precedence with either left-to-right (L-R)
3620 or right-to-left (R-L) associativity]:
3623 2 [R-L] = += -= *= /= %= &= ^= |= <<= >>=
3635 14 [R-L] ! ~ ++ -- + - * & (type) sizeof
3636 15 [L-R] fn() [] -> .
3638 unary +, - and * have higher precedence than the corresponding binary
3642 op_code_prio (enum tree_code code
)
3659 case TRUTH_ORIF_EXPR
:
3662 case TRUTH_AND_EXPR
:
3663 case TRUTH_ANDIF_EXPR
:
3670 case TRUTH_XOR_EXPR
:
3687 case UNORDERED_EXPR
:
3698 case VEC_WIDEN_LSHIFT_HI_EXPR
:
3699 case VEC_WIDEN_LSHIFT_LO_EXPR
:
3700 case WIDEN_LSHIFT_EXPR
:
3703 case WIDEN_SUM_EXPR
:
3705 case POINTER_PLUS_EXPR
:
3706 case POINTER_DIFF_EXPR
:
3710 case VEC_WIDEN_MULT_HI_EXPR
:
3711 case VEC_WIDEN_MULT_LO_EXPR
:
3712 case WIDEN_MULT_EXPR
:
3714 case WIDEN_MULT_PLUS_EXPR
:
3715 case WIDEN_MULT_MINUS_EXPR
:
3717 case MULT_HIGHPART_EXPR
:
3718 case TRUNC_DIV_EXPR
:
3720 case FLOOR_DIV_EXPR
:
3721 case ROUND_DIV_EXPR
:
3723 case EXACT_DIV_EXPR
:
3724 case TRUNC_MOD_EXPR
:
3726 case FLOOR_MOD_EXPR
:
3727 case ROUND_MOD_EXPR
:
3730 case TRUTH_NOT_EXPR
:
3732 case POSTINCREMENT_EXPR
:
3733 case POSTDECREMENT_EXPR
:
3734 case PREINCREMENT_EXPR
:
3735 case PREDECREMENT_EXPR
:
3741 case FIX_TRUNC_EXPR
:
3747 case ARRAY_RANGE_REF
:
3751 /* Special expressions. */
3757 case VEC_UNPACK_HI_EXPR
:
3758 case VEC_UNPACK_LO_EXPR
:
3759 case VEC_UNPACK_FLOAT_HI_EXPR
:
3760 case VEC_UNPACK_FLOAT_LO_EXPR
:
3761 case VEC_UNPACK_FIX_TRUNC_HI_EXPR
:
3762 case VEC_UNPACK_FIX_TRUNC_LO_EXPR
:
3763 case VEC_PACK_TRUNC_EXPR
:
3764 case VEC_PACK_SAT_EXPR
:
3768 /* Return an arbitrarily high precedence to avoid surrounding single
3769 VAR_DECLs in ()s. */
3774 /* Return the priority of the operator OP. */
3777 op_prio (const_tree op
)
3779 enum tree_code code
;
3784 code
= TREE_CODE (op
);
3785 if (code
== SAVE_EXPR
|| code
== NON_LVALUE_EXPR
)
3786 return op_prio (TREE_OPERAND (op
, 0));
3788 return op_code_prio (code
);
3791 /* Return the symbol associated with operator CODE. */
3794 op_symbol_code (enum tree_code code
)
3802 case TRUTH_ORIF_EXPR
:
3805 case TRUTH_AND_EXPR
:
3806 case TRUTH_ANDIF_EXPR
:
3812 case TRUTH_XOR_EXPR
:
3822 case UNORDERED_EXPR
:
3868 case WIDEN_LSHIFT_EXPR
:
3871 case POINTER_PLUS_EXPR
:
3877 case WIDEN_SUM_EXPR
:
3880 case WIDEN_MULT_EXPR
:
3883 case MULT_HIGHPART_EXPR
:
3888 case POINTER_DIFF_EXPR
:
3894 case TRUTH_NOT_EXPR
:
3901 case TRUNC_DIV_EXPR
:
3908 case FLOOR_DIV_EXPR
:
3911 case ROUND_DIV_EXPR
:
3914 case EXACT_DIV_EXPR
:
3917 case TRUNC_MOD_EXPR
:
3923 case FLOOR_MOD_EXPR
:
3926 case ROUND_MOD_EXPR
:
3929 case PREDECREMENT_EXPR
:
3932 case PREINCREMENT_EXPR
:
3935 case POSTDECREMENT_EXPR
:
3938 case POSTINCREMENT_EXPR
:
3948 return "<<< ??? >>>";
3952 /* Return the symbol associated with operator OP. */
3955 op_symbol (const_tree op
)
3957 return op_symbol_code (TREE_CODE (op
));
3960 /* Prints the name of a call. NODE is the CALL_EXPR_FN of a CALL_EXPR or
3961 the gimple_call_fn of a GIMPLE_CALL. */
3964 print_call_name (pretty_printer
*pp
, tree node
, dump_flags_t flags
)
3968 if (TREE_CODE (op0
) == NON_LVALUE_EXPR
)
3969 op0
= TREE_OPERAND (op0
, 0);
3972 switch (TREE_CODE (op0
))
3977 dump_function_name (pp
, op0
, flags
);
3983 op0
= TREE_OPERAND (op0
, 0);
3988 dump_generic_node (pp
, TREE_OPERAND (op0
, 0), 0, flags
, false);
3989 pp_string (pp
, ") ? ");
3990 dump_generic_node (pp
, TREE_OPERAND (op0
, 1), 0, flags
, false);
3991 pp_string (pp
, " : ");
3992 dump_generic_node (pp
, TREE_OPERAND (op0
, 2), 0, flags
, false);
3996 if (TREE_CODE (TREE_OPERAND (op0
, 0)) == VAR_DECL
)
3997 dump_function_name (pp
, TREE_OPERAND (op0
, 0), flags
);
3999 dump_generic_node (pp
, op0
, 0, flags
, false);
4003 if (integer_zerop (TREE_OPERAND (op0
, 1)))
4005 op0
= TREE_OPERAND (op0
, 0);
4012 dump_generic_node (pp
, op0
, 0, flags
, false);
4020 /* Print the first N characters in the array STR, replacing non-printable
4021 characters (including embedded nuls) with unambiguous escape sequences. */
4024 pretty_print_string (pretty_printer
*pp
, const char *str
, unsigned n
)
4029 for ( ; n
; --n
, ++str
)
4034 pp_string (pp
, "\\b");
4038 pp_string (pp
, "\\f");
4042 pp_string (pp
, "\\n");
4046 pp_string (pp
, "\\r");
4050 pp_string (pp
, "\\t");
4054 pp_string (pp
, "\\v");
4058 pp_string (pp
, "\\\\");
4062 pp_string (pp
, "\\\"");
4066 pp_string (pp
, "\\'");
4070 if (str
[0] || n
> 1)
4072 if (!ISPRINT (str
[0]))
4075 sprintf (buf
, "\\x%02x", (unsigned char)str
[0]);
4076 pp_string (pp
, buf
);
4079 pp_character (pp
, str
[0]);
4087 maybe_init_pretty_print (FILE *file
)
4091 tree_pp
= new pretty_printer ();
4092 pp_needs_newline (tree_pp
) = true;
4093 pp_translate_identifiers (tree_pp
) = false;
4096 tree_pp
->buffer
->stream
= file
;
4100 newline_and_indent (pretty_printer
*pp
, int spc
)
4106 /* Handle the %K format for TEXT. Separate from default_tree_printer
4107 so it can also be used in front ends.
4108 The location LOC and BLOCK are expected to be extracted by the caller
4109 from the %K argument arg via EXPR_LOCATION(arg) and TREE_BLOCK(arg). */
4112 percent_K_format (text_info
*text
, location_t loc
, tree block
)
4114 text
->set_location (0, loc
, SHOW_RANGE_WITH_CARET
);
4115 gcc_assert (pp_ti_abstract_origin (text
) != NULL
);
4116 *pp_ti_abstract_origin (text
) = NULL
;
4119 && TREE_CODE (block
) == BLOCK
4120 && BLOCK_ABSTRACT_ORIGIN (block
))
4122 tree ao
= BLOCK_ABSTRACT_ORIGIN (block
);
4123 if (TREE_CODE (ao
) == FUNCTION_DECL
)
4125 *pp_ti_abstract_origin (text
) = block
;
4128 block
= BLOCK_SUPERCONTEXT (block
);
4132 /* Print the identifier ID to PRETTY-PRINTER. */
4135 pp_tree_identifier (pretty_printer
*pp
, tree id
)
4137 if (pp_translate_identifiers (pp
))
4139 const char *text
= identifier_to_locale (IDENTIFIER_POINTER (id
));
4140 pp_append_text (pp
, text
, text
+ strlen (text
));
4143 pp_append_text (pp
, IDENTIFIER_POINTER (id
),
4144 IDENTIFIER_POINTER (id
) + IDENTIFIER_LENGTH (id
));
4147 /* A helper function that is used to dump function information before the
4151 dump_function_header (FILE *dump_file
, tree fdecl
, dump_flags_t flags
)
4153 const char *dname
, *aname
;
4154 struct cgraph_node
*node
= cgraph_node::get (fdecl
);
4155 struct function
*fun
= DECL_STRUCT_FUNCTION (fdecl
);
4157 dname
= lang_hooks
.decl_printable_name (fdecl
, 1);
4159 if (DECL_ASSEMBLER_NAME_SET_P (fdecl
))
4160 aname
= (IDENTIFIER_POINTER
4161 (DECL_ASSEMBLER_NAME (fdecl
)));
4163 aname
= "<unset-asm-name>";
4165 fprintf (dump_file
, "\n;; Function %s (%s, funcdef_no=%d",
4166 dname
, aname
, fun
->funcdef_no
);
4167 if (!(flags
& TDF_NOUID
))
4168 fprintf (dump_file
, ", decl_uid=%d", DECL_UID (fdecl
));
4171 fprintf (dump_file
, ", cgraph_uid=%d", node
->get_uid ());
4172 fprintf (dump_file
, ", symbol_order=%d)%s\n\n", node
->order
,
4173 node
->frequency
== NODE_FREQUENCY_HOT
4175 : node
->frequency
== NODE_FREQUENCY_UNLIKELY_EXECUTED
4176 ? " (unlikely executed)"
4177 : node
->frequency
== NODE_FREQUENCY_EXECUTED_ONCE
4178 ? " (executed once)"
4182 fprintf (dump_file
, ")\n\n");
4185 /* Dump double_int D to pretty_printer PP. UNS is true
4186 if D is unsigned and false otherwise. */
4188 pp_double_int (pretty_printer
*pp
, double_int d
, bool uns
)
4191 pp_wide_integer (pp
, d
.low
);
4192 else if (d
.fits_uhwi ())
4193 pp_unsigned_wide_integer (pp
, d
.low
);
4196 unsigned HOST_WIDE_INT low
= d
.low
;
4197 HOST_WIDE_INT high
= d
.high
;
4198 if (!uns
&& d
.is_negative ())
4201 high
= ~high
+ !low
;
4204 /* Would "%x%0*x" or "%x%*0x" get zero-padding on all
4206 sprintf (pp_buffer (pp
)->digit_buffer
,
4207 HOST_WIDE_INT_PRINT_DOUBLE_HEX
,
4208 (unsigned HOST_WIDE_INT
) high
, low
);
4209 pp_string (pp
, pp_buffer (pp
)->digit_buffer
);