1 /* Pretty formatting of GENERIC trees in C syntax.
2 Copyright (C) 2001-2019 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
1834 || tree_int_cst_sgn (node
) < 0))
1836 pp_string (pp
, "_Literal (");
1837 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1838 pp_string (pp
, ") ");
1840 if (TREE_CODE (TREE_TYPE (node
)) == POINTER_TYPE
1841 && ! (flags
& TDF_GIMPLE
))
1843 /* In the case of a pointer, one may want to divide by the
1844 size of the pointed-to type. Unfortunately, this not
1845 straightforward. The C front-end maps expressions
1850 in such a way that the two INTEGER_CST nodes for "5" have
1851 different values but identical types. In the latter
1852 case, the 5 is multiplied by sizeof (int) in c-common.c
1853 (pointer_int_sum) to convert it to a byte address, and
1854 yet the type of the node is left unchanged. Argh. What
1855 is consistent though is that the number value corresponds
1856 to bytes (UNITS) offset.
1858 NB: Neither of the following divisors can be trivially
1859 used to recover the original literal:
1861 TREE_INT_CST_LOW (TYPE_SIZE_UNIT (TREE_TYPE (node)))
1862 TYPE_PRECISION (TREE_TYPE (TREE_TYPE (node))) */
1863 pp_wide_integer (pp
, TREE_INT_CST_LOW (node
));
1864 pp_string (pp
, "B"); /* pseudo-unit */
1866 else if (tree_fits_shwi_p (node
))
1867 pp_wide_integer (pp
, tree_to_shwi (node
));
1868 else if (tree_fits_uhwi_p (node
))
1869 pp_unsigned_wide_integer (pp
, tree_to_uhwi (node
));
1872 wide_int val
= wi::to_wide (node
);
1874 if (wi::neg_p (val
, TYPE_SIGN (TREE_TYPE (node
))))
1879 print_hex (val
, pp_buffer (pp
)->digit_buffer
);
1880 pp_string (pp
, pp_buffer (pp
)->digit_buffer
);
1882 if ((flags
& TDF_GIMPLE
)
1883 && ! (POINTER_TYPE_P (TREE_TYPE (node
))
1884 || (TYPE_PRECISION (TREE_TYPE (node
))
1885 < TYPE_PRECISION (integer_type_node
))
1886 || exact_log2 (TYPE_PRECISION (TREE_TYPE (node
))) == -1))
1888 if (TYPE_UNSIGNED (TREE_TYPE (node
)))
1889 pp_character (pp
, 'u');
1890 if (TYPE_PRECISION (TREE_TYPE (node
))
1891 == TYPE_PRECISION (unsigned_type_node
))
1893 else if (TYPE_PRECISION (TREE_TYPE (node
))
1894 == TYPE_PRECISION (long_unsigned_type_node
))
1895 pp_character (pp
, 'l');
1896 else if (TYPE_PRECISION (TREE_TYPE (node
))
1897 == TYPE_PRECISION (long_long_unsigned_type_node
))
1898 pp_string (pp
, "ll");
1900 if (TREE_OVERFLOW (node
))
1901 pp_string (pp
, "(OVF)");
1905 pp_string (pp
, "POLY_INT_CST [");
1906 dump_generic_node (pp
, POLY_INT_CST_COEFF (node
, 0), spc
, flags
, false);
1907 for (unsigned int i
= 1; i
< NUM_POLY_INT_COEFFS
; ++i
)
1909 pp_string (pp
, ", ");
1910 dump_generic_node (pp
, POLY_INT_CST_COEFF (node
, i
),
1913 pp_string (pp
, "]");
1917 /* Code copied from print_node. */
1920 if (TREE_OVERFLOW (node
))
1921 pp_string (pp
, " overflow");
1923 d
= TREE_REAL_CST (node
);
1924 if (REAL_VALUE_ISINF (d
))
1925 pp_string (pp
, REAL_VALUE_NEGATIVE (d
) ? " -Inf" : " Inf");
1926 else if (REAL_VALUE_ISNAN (d
))
1927 pp_string (pp
, " Nan");
1931 real_to_decimal (string
, &d
, sizeof (string
), 0, 1);
1932 pp_string (pp
, string
);
1940 fixed_to_decimal (string
, TREE_FIXED_CST_PTR (node
), sizeof (string
));
1941 pp_string (pp
, string
);
1946 pp_string (pp
, "__complex__ (");
1947 dump_generic_node (pp
, TREE_REALPART (node
), spc
, flags
, false);
1948 pp_string (pp
, ", ");
1949 dump_generic_node (pp
, TREE_IMAGPART (node
), spc
, flags
, false);
1950 pp_right_paren (pp
);
1955 pp_string (pp
, "\"");
1956 if (unsigned nbytes
= TREE_STRING_LENGTH (node
))
1957 pretty_print_string (pp
, TREE_STRING_POINTER (node
), nbytes
);
1958 pp_string (pp
, "\"");
1965 pp_string (pp
, "{ ");
1966 unsigned HOST_WIDE_INT nunits
;
1967 if (!VECTOR_CST_NELTS (node
).is_constant (&nunits
))
1968 nunits
= vector_cst_encoded_nelts (node
);
1969 for (i
= 0; i
< nunits
; ++i
)
1972 pp_string (pp
, ", ");
1973 dump_generic_node (pp
, VECTOR_CST_ELT (node
, i
),
1976 if (!VECTOR_CST_NELTS (node
).is_constant ())
1977 pp_string (pp
, ", ...");
1978 pp_string (pp
, " }");
1984 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1986 if (TREE_CODE (node
) == METHOD_TYPE
)
1988 if (TYPE_METHOD_BASETYPE (node
))
1989 dump_generic_node (pp
, TYPE_NAME (TYPE_METHOD_BASETYPE (node
)),
1992 pp_string (pp
, "<null method basetype>");
1993 pp_colon_colon (pp
);
1995 if (TYPE_IDENTIFIER (node
))
1996 dump_generic_node (pp
, TYPE_NAME (node
), spc
, flags
, false);
1997 else if (TYPE_NAME (node
) && DECL_NAME (TYPE_NAME (node
)))
1998 dump_decl_name (pp
, TYPE_NAME (node
), flags
);
1999 else if (flags
& TDF_NOUID
)
2000 pp_printf (pp
, "<Txxxx>");
2002 pp_printf (pp
, "<T%x>", TYPE_UID (node
));
2003 dump_function_declaration (pp
, node
, spc
, flags
);
2008 dump_decl_name (pp
, node
, flags
);
2012 if (DECL_NAME (node
))
2013 dump_decl_name (pp
, node
, flags
);
2014 else if (LABEL_DECL_UID (node
) != -1)
2016 if (flags
& TDF_GIMPLE
)
2017 pp_printf (pp
, "L%d", (int) LABEL_DECL_UID (node
));
2019 pp_printf (pp
, "<L%d>", (int) LABEL_DECL_UID (node
));
2023 if (flags
& TDF_NOUID
)
2024 pp_string (pp
, "<D.xxxx>");
2027 if (flags
& TDF_GIMPLE
)
2028 pp_printf (pp
, "<D%u>", DECL_UID (node
));
2030 pp_printf (pp
, "<D.%u>", DECL_UID (node
));
2036 if (DECL_IS_BUILTIN (node
))
2038 /* Don't print the declaration of built-in types. */
2041 if (DECL_NAME (node
))
2042 dump_decl_name (pp
, node
, flags
);
2043 else if (TYPE_NAME (TREE_TYPE (node
)) != node
)
2045 pp_string (pp
, (TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
2046 ? "union" : "struct "));
2047 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2050 pp_string (pp
, "<anon>");
2056 case DEBUG_EXPR_DECL
:
2057 case NAMESPACE_DECL
:
2059 dump_decl_name (pp
, node
, flags
);
2063 pp_string (pp
, "<retval>");
2067 op0
= TREE_OPERAND (node
, 0);
2070 && (TREE_CODE (op0
) == INDIRECT_REF
2071 || (TREE_CODE (op0
) == MEM_REF
2072 && TREE_CODE (TREE_OPERAND (op0
, 0)) != ADDR_EXPR
2073 && integer_zerop (TREE_OPERAND (op0
, 1))
2074 /* Dump the types of INTEGER_CSTs explicitly, for we
2075 can't infer them and MEM_ATTR caching will share
2076 MEM_REFs with differently-typed op0s. */
2077 && TREE_CODE (TREE_OPERAND (op0
, 0)) != INTEGER_CST
2078 /* Released SSA_NAMES have no TREE_TYPE. */
2079 && TREE_TYPE (TREE_OPERAND (op0
, 0)) != NULL_TREE
2080 /* Same pointer types, but ignoring POINTER_TYPE vs.
2082 && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 0)))
2083 == TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 1))))
2084 && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0
, 0)))
2085 == TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0
, 1))))
2086 && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0
, 0)))
2087 == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0
, 1))))
2088 /* Same value types ignoring qualifiers. */
2089 && (TYPE_MAIN_VARIANT (TREE_TYPE (op0
))
2090 == TYPE_MAIN_VARIANT
2091 (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 1)))))
2092 && MR_DEPENDENCE_CLIQUE (op0
) == 0)))
2094 op0
= TREE_OPERAND (op0
, 0);
2097 if (op_prio (op0
) < op_prio (node
))
2099 dump_generic_node (pp
, op0
, spc
, flags
, false);
2100 if (op_prio (op0
) < op_prio (node
))
2101 pp_right_paren (pp
);
2102 pp_string (pp
, str
);
2103 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2104 op0
= component_ref_field_offset (node
);
2105 if (op0
&& TREE_CODE (op0
) != INTEGER_CST
)
2107 pp_string (pp
, "{off: ");
2108 dump_generic_node (pp
, op0
, spc
, flags
, false);
2109 pp_right_brace (pp
);
2114 pp_string (pp
, "BIT_FIELD_REF <");
2115 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2116 pp_string (pp
, ", ");
2117 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2118 pp_string (pp
, ", ");
2119 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2123 case BIT_INSERT_EXPR
:
2124 pp_string (pp
, "BIT_INSERT_EXPR <");
2125 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2126 pp_string (pp
, ", ");
2127 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2128 pp_string (pp
, ", ");
2129 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2130 pp_string (pp
, " (");
2131 if (INTEGRAL_TYPE_P (TREE_TYPE (TREE_OPERAND (node
, 1))))
2133 TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (node
, 1))));
2135 dump_generic_node (pp
, TYPE_SIZE (TREE_TYPE (TREE_OPERAND (node
, 1))),
2137 pp_string (pp
, " bits)>");
2141 case ARRAY_RANGE_REF
:
2142 op0
= TREE_OPERAND (node
, 0);
2143 if (op_prio (op0
) < op_prio (node
))
2145 dump_generic_node (pp
, op0
, spc
, flags
, false);
2146 if (op_prio (op0
) < op_prio (node
))
2147 pp_right_paren (pp
);
2148 pp_left_bracket (pp
);
2149 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2150 if (TREE_CODE (node
) == ARRAY_RANGE_REF
)
2151 pp_string (pp
, " ...");
2152 pp_right_bracket (pp
);
2154 op0
= array_ref_low_bound (node
);
2155 op1
= array_ref_element_size (node
);
2157 if (!integer_zerop (op0
)
2158 || TREE_OPERAND (node
, 2)
2159 || TREE_OPERAND (node
, 3))
2161 pp_string (pp
, "{lb: ");
2162 dump_generic_node (pp
, op0
, spc
, flags
, false);
2163 pp_string (pp
, " sz: ");
2164 dump_generic_node (pp
, op1
, spc
, flags
, false);
2165 pp_right_brace (pp
);
2171 unsigned HOST_WIDE_INT ix
;
2173 bool is_struct_init
= false;
2174 bool is_array_init
= false;
2177 if (TREE_CLOBBER_P (node
))
2178 pp_string (pp
, "CLOBBER");
2179 else if (TREE_CODE (TREE_TYPE (node
)) == RECORD_TYPE
2180 || TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
)
2181 is_struct_init
= true;
2182 else if (TREE_CODE (TREE_TYPE (node
)) == ARRAY_TYPE
2183 && TYPE_DOMAIN (TREE_TYPE (node
))
2184 && TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
)))
2185 && TREE_CODE (TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
))))
2188 tree minv
= TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
)));
2189 is_array_init
= true;
2190 curidx
= wi::to_widest (minv
);
2192 FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (node
), ix
, field
, val
)
2199 dump_generic_node (pp
, field
, spc
, flags
, false);
2202 else if (is_array_init
2203 && (TREE_CODE (field
) != INTEGER_CST
2204 || curidx
!= wi::to_widest (field
)))
2206 pp_left_bracket (pp
);
2207 if (TREE_CODE (field
) == RANGE_EXPR
)
2209 dump_generic_node (pp
, TREE_OPERAND (field
, 0), spc
,
2211 pp_string (pp
, " ... ");
2212 dump_generic_node (pp
, TREE_OPERAND (field
, 1), spc
,
2214 if (TREE_CODE (TREE_OPERAND (field
, 1)) == INTEGER_CST
)
2215 curidx
= wi::to_widest (TREE_OPERAND (field
, 1));
2218 dump_generic_node (pp
, field
, spc
, flags
, false);
2219 if (TREE_CODE (field
) == INTEGER_CST
)
2220 curidx
= wi::to_widest (field
);
2221 pp_string (pp
, "]=");
2226 if (val
&& TREE_CODE (val
) == ADDR_EXPR
)
2227 if (TREE_CODE (TREE_OPERAND (val
, 0)) == FUNCTION_DECL
)
2228 val
= TREE_OPERAND (val
, 0);
2229 if (val
&& TREE_CODE (val
) == FUNCTION_DECL
)
2230 dump_decl_name (pp
, val
, flags
);
2232 dump_generic_node (pp
, val
, spc
, flags
, false);
2233 if (ix
!= CONSTRUCTOR_NELTS (node
) - 1)
2239 pp_right_brace (pp
);
2246 if (flags
& TDF_SLIM
)
2248 pp_string (pp
, "<COMPOUND_EXPR>");
2252 dump_generic_node (pp
, TREE_OPERAND (node
, 0),
2253 spc
, flags
, !(flags
& TDF_SLIM
));
2254 if (flags
& TDF_SLIM
)
2255 newline_and_indent (pp
, spc
);
2262 for (tp
= &TREE_OPERAND (node
, 1);
2263 TREE_CODE (*tp
) == COMPOUND_EXPR
;
2264 tp
= &TREE_OPERAND (*tp
, 1))
2266 dump_generic_node (pp
, TREE_OPERAND (*tp
, 0),
2267 spc
, flags
, !(flags
& TDF_SLIM
));
2268 if (flags
& TDF_SLIM
)
2269 newline_and_indent (pp
, spc
);
2277 dump_generic_node (pp
, *tp
, spc
, flags
, !(flags
& TDF_SLIM
));
2281 case STATEMENT_LIST
:
2283 tree_stmt_iterator si
;
2286 if (flags
& TDF_SLIM
)
2288 pp_string (pp
, "<STATEMENT_LIST>");
2292 for (si
= tsi_start (node
); !tsi_end_p (si
); tsi_next (&si
))
2295 newline_and_indent (pp
, spc
);
2298 dump_generic_node (pp
, tsi_stmt (si
), spc
, flags
, true);
2305 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
,
2310 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
,
2315 pp_string (pp
, "TARGET_EXPR <");
2316 dump_generic_node (pp
, TARGET_EXPR_SLOT (node
), spc
, flags
, false);
2319 dump_generic_node (pp
, TARGET_EXPR_INITIAL (node
), spc
, flags
, false);
2324 print_declaration (pp
, DECL_EXPR_DECL (node
), spc
, flags
);
2329 if (TREE_TYPE (node
) == NULL
|| TREE_TYPE (node
) == void_type_node
)
2331 pp_string (pp
, "if (");
2332 dump_generic_node (pp
, COND_EXPR_COND (node
), spc
, flags
, false);
2333 pp_right_paren (pp
);
2334 /* The lowered cond_exprs should always be printed in full. */
2335 if (COND_EXPR_THEN (node
)
2336 && (IS_EMPTY_STMT (COND_EXPR_THEN (node
))
2337 || TREE_CODE (COND_EXPR_THEN (node
)) == GOTO_EXPR
)
2338 && COND_EXPR_ELSE (node
)
2339 && (IS_EMPTY_STMT (COND_EXPR_ELSE (node
))
2340 || TREE_CODE (COND_EXPR_ELSE (node
)) == GOTO_EXPR
))
2343 dump_generic_node (pp
, COND_EXPR_THEN (node
),
2345 if (!IS_EMPTY_STMT (COND_EXPR_ELSE (node
)))
2347 pp_string (pp
, " else ");
2348 dump_generic_node (pp
, COND_EXPR_ELSE (node
),
2352 else if (!(flags
& TDF_SLIM
))
2354 /* Output COND_EXPR_THEN. */
2355 if (COND_EXPR_THEN (node
))
2357 newline_and_indent (pp
, spc
+2);
2359 newline_and_indent (pp
, spc
+4);
2360 dump_generic_node (pp
, COND_EXPR_THEN (node
), spc
+4,
2362 newline_and_indent (pp
, spc
+2);
2363 pp_right_brace (pp
);
2366 /* Output COND_EXPR_ELSE. */
2367 if (COND_EXPR_ELSE (node
)
2368 && !IS_EMPTY_STMT (COND_EXPR_ELSE (node
)))
2370 newline_and_indent (pp
, spc
);
2371 pp_string (pp
, "else");
2372 newline_and_indent (pp
, spc
+2);
2374 newline_and_indent (pp
, spc
+4);
2375 dump_generic_node (pp
, COND_EXPR_ELSE (node
), spc
+4,
2377 newline_and_indent (pp
, spc
+2);
2378 pp_right_brace (pp
);
2385 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2389 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2393 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2399 if (!(flags
& TDF_SLIM
))
2401 if (BIND_EXPR_VARS (node
))
2405 for (op0
= BIND_EXPR_VARS (node
); op0
; op0
= DECL_CHAIN (op0
))
2407 print_declaration (pp
, op0
, spc
+2, flags
);
2412 newline_and_indent (pp
, spc
+2);
2413 dump_generic_node (pp
, BIND_EXPR_BODY (node
), spc
+2, flags
, true);
2414 newline_and_indent (pp
, spc
);
2415 pp_right_brace (pp
);
2421 if (CALL_EXPR_FN (node
) != NULL_TREE
)
2422 print_call_name (pp
, CALL_EXPR_FN (node
), flags
);
2426 pp_string (pp
, internal_fn_name (CALL_EXPR_IFN (node
)));
2429 /* Print parameters. */
2434 call_expr_arg_iterator iter
;
2435 FOR_EACH_CALL_EXPR_ARG (arg
, iter
, node
)
2437 dump_generic_node (pp
, arg
, spc
, flags
, false);
2438 if (more_call_expr_args_p (&iter
))
2445 if (CALL_EXPR_VA_ARG_PACK (node
))
2447 if (call_expr_nargs (node
) > 0)
2452 pp_string (pp
, "__builtin_va_arg_pack ()");
2454 pp_right_paren (pp
);
2456 op1
= CALL_EXPR_STATIC_CHAIN (node
);
2459 pp_string (pp
, " [static-chain: ");
2460 dump_generic_node (pp
, op1
, spc
, flags
, false);
2461 pp_right_bracket (pp
);
2464 if (CALL_EXPR_RETURN_SLOT_OPT (node
))
2465 pp_string (pp
, " [return slot optimization]");
2466 if (CALL_EXPR_TAILCALL (node
))
2467 pp_string (pp
, " [tail call]");
2470 case WITH_CLEANUP_EXPR
:
2474 case CLEANUP_POINT_EXPR
:
2475 pp_string (pp
, "<<cleanup_point ");
2476 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2477 pp_string (pp
, ">>");
2480 case PLACEHOLDER_EXPR
:
2481 pp_string (pp
, "<PLACEHOLDER_EXPR ");
2482 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2486 /* Binary arithmetic and logic expressions. */
2487 case WIDEN_SUM_EXPR
:
2488 case WIDEN_MULT_EXPR
:
2490 case MULT_HIGHPART_EXPR
:
2492 case POINTER_PLUS_EXPR
:
2493 case POINTER_DIFF_EXPR
:
2495 case TRUNC_DIV_EXPR
:
2497 case FLOOR_DIV_EXPR
:
2498 case ROUND_DIV_EXPR
:
2499 case TRUNC_MOD_EXPR
:
2501 case FLOOR_MOD_EXPR
:
2502 case ROUND_MOD_EXPR
:
2504 case EXACT_DIV_EXPR
:
2509 case WIDEN_LSHIFT_EXPR
:
2513 case TRUTH_ANDIF_EXPR
:
2514 case TRUTH_ORIF_EXPR
:
2515 case TRUTH_AND_EXPR
:
2517 case TRUTH_XOR_EXPR
:
2531 case UNORDERED_EXPR
:
2533 const char *op
= op_symbol (node
);
2534 op0
= TREE_OPERAND (node
, 0);
2535 op1
= TREE_OPERAND (node
, 1);
2537 /* When the operands are expressions with less priority,
2538 keep semantics of the tree representation. */
2539 if (op_prio (op0
) <= op_prio (node
))
2542 dump_generic_node (pp
, op0
, spc
, flags
, false);
2543 pp_right_paren (pp
);
2546 dump_generic_node (pp
, op0
, spc
, flags
, false);
2552 /* When the operands are expressions with less priority,
2553 keep semantics of the tree representation. */
2554 if (op_prio (op1
) <= op_prio (node
))
2557 dump_generic_node (pp
, op1
, spc
, flags
, false);
2558 pp_right_paren (pp
);
2561 dump_generic_node (pp
, op1
, spc
, flags
, false);
2565 /* Unary arithmetic and logic expressions. */
2568 case TRUTH_NOT_EXPR
:
2570 case PREDECREMENT_EXPR
:
2571 case PREINCREMENT_EXPR
:
2573 if (TREE_CODE (node
) == ADDR_EXPR
2574 && (TREE_CODE (TREE_OPERAND (node
, 0)) == STRING_CST
2575 || TREE_CODE (TREE_OPERAND (node
, 0)) == FUNCTION_DECL
))
2576 ; /* Do not output '&' for strings and function pointers. */
2578 pp_string (pp
, op_symbol (node
));
2580 if (op_prio (TREE_OPERAND (node
, 0)) < op_prio (node
))
2583 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2584 pp_right_paren (pp
);
2587 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2590 case POSTDECREMENT_EXPR
:
2591 case POSTINCREMENT_EXPR
:
2592 if (op_prio (TREE_OPERAND (node
, 0)) < op_prio (node
))
2595 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2596 pp_right_paren (pp
);
2599 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2600 pp_string (pp
, op_symbol (node
));
2604 pp_string (pp
, "MIN_EXPR <");
2605 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2606 pp_string (pp
, ", ");
2607 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2612 pp_string (pp
, "MAX_EXPR <");
2613 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2614 pp_string (pp
, ", ");
2615 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2620 pp_string (pp
, "ABS_EXPR <");
2621 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2626 pp_string (pp
, "ABSU_EXPR <");
2627 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2635 case ADDR_SPACE_CONVERT_EXPR
:
2636 case FIXED_CONVERT_EXPR
:
2637 case FIX_TRUNC_EXPR
:
2640 type
= TREE_TYPE (node
);
2641 op0
= TREE_OPERAND (node
, 0);
2642 if (type
!= TREE_TYPE (op0
))
2645 dump_generic_node (pp
, type
, spc
, flags
, false);
2646 pp_string (pp
, ") ");
2648 if (op_prio (op0
) < op_prio (node
))
2650 dump_generic_node (pp
, op0
, spc
, flags
, false);
2651 if (op_prio (op0
) < op_prio (node
))
2652 pp_right_paren (pp
);
2655 case VIEW_CONVERT_EXPR
:
2656 pp_string (pp
, "VIEW_CONVERT_EXPR<");
2657 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2658 pp_string (pp
, ">(");
2659 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2660 pp_right_paren (pp
);
2664 pp_string (pp
, "((");
2665 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2666 pp_string (pp
, "))");
2669 case NON_LVALUE_EXPR
:
2670 pp_string (pp
, "NON_LVALUE_EXPR <");
2671 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2676 pp_string (pp
, "SAVE_EXPR <");
2677 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2682 pp_string (pp
, "COMPLEX_EXPR <");
2683 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2684 pp_string (pp
, ", ");
2685 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2690 pp_string (pp
, "CONJ_EXPR <");
2691 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2696 if (flags
& TDF_GIMPLE
)
2698 pp_string (pp
, "__real ");
2699 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2703 pp_string (pp
, "REALPART_EXPR <");
2704 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2710 if (flags
& TDF_GIMPLE
)
2712 pp_string (pp
, "__imag ");
2713 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2717 pp_string (pp
, "IMAGPART_EXPR <");
2718 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2724 pp_string (pp
, "VA_ARG_EXPR <");
2725 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2729 case TRY_FINALLY_EXPR
:
2730 case TRY_CATCH_EXPR
:
2731 pp_string (pp
, "try");
2732 newline_and_indent (pp
, spc
+2);
2734 newline_and_indent (pp
, spc
+4);
2735 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
+4, flags
, true);
2736 newline_and_indent (pp
, spc
+2);
2737 pp_right_brace (pp
);
2738 newline_and_indent (pp
, spc
);
2740 (TREE_CODE (node
) == TRY_CATCH_EXPR
) ? "catch" : "finally");
2741 newline_and_indent (pp
, spc
+2);
2743 newline_and_indent (pp
, spc
+4);
2744 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
+4, flags
, true);
2745 newline_and_indent (pp
, spc
+2);
2746 pp_right_brace (pp
);
2751 pp_string (pp
, "catch (");
2752 dump_generic_node (pp
, CATCH_TYPES (node
), spc
+2, flags
, false);
2753 pp_right_paren (pp
);
2754 newline_and_indent (pp
, spc
+2);
2756 newline_and_indent (pp
, spc
+4);
2757 dump_generic_node (pp
, CATCH_BODY (node
), spc
+4, flags
, true);
2758 newline_and_indent (pp
, spc
+2);
2759 pp_right_brace (pp
);
2763 case EH_FILTER_EXPR
:
2764 pp_string (pp
, "<<<eh_filter (");
2765 dump_generic_node (pp
, EH_FILTER_TYPES (node
), spc
+2, flags
, false);
2766 pp_string (pp
, ")>>>");
2767 newline_and_indent (pp
, spc
+2);
2769 newline_and_indent (pp
, spc
+4);
2770 dump_generic_node (pp
, EH_FILTER_FAILURE (node
), spc
+4, flags
, true);
2771 newline_and_indent (pp
, spc
+2);
2772 pp_right_brace (pp
);
2777 op0
= TREE_OPERAND (node
, 0);
2778 /* If this is for break or continue, don't bother printing it. */
2779 if (DECL_NAME (op0
))
2781 const char *name
= IDENTIFIER_POINTER (DECL_NAME (op0
));
2782 if (strcmp (name
, "break") == 0
2783 || strcmp (name
, "continue") == 0)
2786 dump_generic_node (pp
, op0
, spc
, flags
, false);
2788 if (DECL_NONLOCAL (op0
))
2789 pp_string (pp
, " [non-local]");
2793 pp_string (pp
, "while (1)");
2794 if (!(flags
& TDF_SLIM
))
2796 newline_and_indent (pp
, spc
+2);
2798 newline_and_indent (pp
, spc
+4);
2799 dump_generic_node (pp
, LOOP_EXPR_BODY (node
), spc
+4, flags
, true);
2800 newline_and_indent (pp
, spc
+2);
2801 pp_right_brace (pp
);
2807 pp_string (pp
, "// predicted ");
2808 if (PREDICT_EXPR_OUTCOME (node
))
2809 pp_string (pp
, "likely by ");
2811 pp_string (pp
, "unlikely by ");
2812 pp_string (pp
, predictor_name (PREDICT_EXPR_PREDICTOR (node
)));
2813 pp_string (pp
, " predictor.");
2817 pp_string (pp
, "ANNOTATE_EXPR <");
2818 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2819 switch ((enum annot_expr_kind
) TREE_INT_CST_LOW (TREE_OPERAND (node
, 1)))
2821 case annot_expr_ivdep_kind
:
2822 pp_string (pp
, ", ivdep");
2824 case annot_expr_unroll_kind
:
2825 pp_printf (pp
, ", unroll %d",
2826 (int) TREE_INT_CST_LOW (TREE_OPERAND (node
, 2)));
2828 case annot_expr_no_vector_kind
:
2829 pp_string (pp
, ", no-vector");
2831 case annot_expr_vector_kind
:
2832 pp_string (pp
, ", vector");
2834 case annot_expr_parallel_kind
:
2835 pp_string (pp
, ", parallel");
2844 pp_string (pp
, "return");
2845 op0
= TREE_OPERAND (node
, 0);
2849 if (TREE_CODE (op0
) == MODIFY_EXPR
)
2850 dump_generic_node (pp
, TREE_OPERAND (op0
, 1),
2853 dump_generic_node (pp
, op0
, spc
, flags
, false);
2858 pp_string (pp
, "if (");
2859 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2860 pp_string (pp
, ") break");
2864 pp_string (pp
, "switch (");
2865 dump_generic_node (pp
, SWITCH_COND (node
), spc
, flags
, false);
2866 pp_right_paren (pp
);
2867 if (!(flags
& TDF_SLIM
))
2869 newline_and_indent (pp
, spc
+2);
2871 if (SWITCH_BODY (node
))
2873 newline_and_indent (pp
, spc
+4);
2874 dump_generic_node (pp
, SWITCH_BODY (node
), spc
+4, flags
,
2877 newline_and_indent (pp
, spc
+2);
2878 pp_right_brace (pp
);
2884 op0
= GOTO_DESTINATION (node
);
2885 if (TREE_CODE (op0
) != SSA_NAME
&& DECL_P (op0
) && DECL_NAME (op0
))
2887 const char *name
= IDENTIFIER_POINTER (DECL_NAME (op0
));
2888 if (strcmp (name
, "break") == 0
2889 || strcmp (name
, "continue") == 0)
2891 pp_string (pp
, name
);
2895 pp_string (pp
, "goto ");
2896 dump_generic_node (pp
, op0
, spc
, flags
, false);
2900 pp_string (pp
, "__asm__");
2901 if (ASM_VOLATILE_P (node
))
2902 pp_string (pp
, " __volatile__");
2904 dump_generic_node (pp
, ASM_STRING (node
), spc
, flags
, false);
2906 dump_generic_node (pp
, ASM_OUTPUTS (node
), spc
, flags
, false);
2908 dump_generic_node (pp
, ASM_INPUTS (node
), spc
, flags
, false);
2909 if (ASM_CLOBBERS (node
))
2912 dump_generic_node (pp
, ASM_CLOBBERS (node
), spc
, flags
, false);
2914 pp_right_paren (pp
);
2917 case CASE_LABEL_EXPR
:
2918 if (CASE_LOW (node
) && CASE_HIGH (node
))
2920 pp_string (pp
, "case ");
2921 dump_generic_node (pp
, CASE_LOW (node
), spc
, flags
, false);
2922 pp_string (pp
, " ... ");
2923 dump_generic_node (pp
, CASE_HIGH (node
), spc
, flags
, false);
2925 else if (CASE_LOW (node
))
2927 pp_string (pp
, "case ");
2928 dump_generic_node (pp
, CASE_LOW (node
), spc
, flags
, false);
2931 pp_string (pp
, "default");
2936 pp_string (pp
, "OBJ_TYPE_REF(");
2937 dump_generic_node (pp
, OBJ_TYPE_REF_EXPR (node
), spc
, flags
, false);
2939 /* We omit the class type for -fcompare-debug because we may
2940 drop TYPE_BINFO early depending on debug info, and then
2941 virtual_method_call_p would return false, whereas when
2942 TYPE_BINFO is preserved it may still return true and then
2943 we'd print the class type. Compare tree and rtl dumps for
2944 libstdc++-prettyprinters/shared_ptr.cc with and without -g,
2945 for example, at occurrences of OBJ_TYPE_REF. */
2946 if (!(flags
& (TDF_SLIM
| TDF_COMPARE_DEBUG
))
2947 && virtual_method_call_p (node
))
2949 pp_string (pp
, "(");
2950 dump_generic_node (pp
, obj_type_ref_class (node
), spc
, flags
, false);
2951 pp_string (pp
, ")");
2953 dump_generic_node (pp
, OBJ_TYPE_REF_OBJECT (node
), spc
, flags
, false);
2955 dump_generic_node (pp
, OBJ_TYPE_REF_TOKEN (node
), spc
, flags
, false);
2956 pp_right_paren (pp
);
2960 if (SSA_NAME_IDENTIFIER (node
))
2962 if ((flags
& TDF_NOUID
)
2963 && SSA_NAME_VAR (node
)
2964 && DECL_NAMELESS (SSA_NAME_VAR (node
)))
2965 dump_fancy_name (pp
, SSA_NAME_IDENTIFIER (node
));
2966 else if (! (flags
& TDF_GIMPLE
)
2967 || SSA_NAME_VAR (node
))
2968 dump_generic_node (pp
, SSA_NAME_IDENTIFIER (node
),
2972 pp_decimal_int (pp
, SSA_NAME_VERSION (node
));
2973 if (SSA_NAME_IS_DEFAULT_DEF (node
))
2974 pp_string (pp
, "(D)");
2975 if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (node
))
2976 pp_string (pp
, "(ab)");
2979 case WITH_SIZE_EXPR
:
2980 pp_string (pp
, "WITH_SIZE_EXPR <");
2981 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2982 pp_string (pp
, ", ");
2983 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2988 pp_string (pp
, "ASSERT_EXPR <");
2989 dump_generic_node (pp
, ASSERT_EXPR_VAR (node
), spc
, flags
, false);
2990 pp_string (pp
, ", ");
2991 dump_generic_node (pp
, ASSERT_EXPR_COND (node
), spc
, flags
, false);
2996 pp_string (pp
, "scev_known");
2999 case SCEV_NOT_KNOWN
:
3000 pp_string (pp
, "scev_not_known");
3003 case POLYNOMIAL_CHREC
:
3005 dump_generic_node (pp
, CHREC_LEFT (node
), spc
, flags
, false);
3006 pp_string (pp
, ", +, ");
3007 dump_generic_node (pp
, CHREC_RIGHT (node
), spc
, flags
, false);
3008 pp_printf (pp
, "}_%u", CHREC_VARIABLE (node
));
3012 case REALIGN_LOAD_EXPR
:
3013 pp_string (pp
, "REALIGN_LOAD <");
3014 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3015 pp_string (pp
, ", ");
3016 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3017 pp_string (pp
, ", ");
3018 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3023 pp_string (pp
, " VEC_COND_EXPR < ");
3024 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3025 pp_string (pp
, " , ");
3026 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3027 pp_string (pp
, " , ");
3028 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3029 pp_string (pp
, " > ");
3033 pp_string (pp
, " VEC_PERM_EXPR < ");
3034 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3035 pp_string (pp
, " , ");
3036 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3037 pp_string (pp
, " , ");
3038 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3039 pp_string (pp
, " > ");
3043 pp_string (pp
, " DOT_PROD_EXPR < ");
3044 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3045 pp_string (pp
, ", ");
3046 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3047 pp_string (pp
, ", ");
3048 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3049 pp_string (pp
, " > ");
3052 case WIDEN_MULT_PLUS_EXPR
:
3053 pp_string (pp
, " WIDEN_MULT_PLUS_EXPR < ");
3054 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3055 pp_string (pp
, ", ");
3056 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3057 pp_string (pp
, ", ");
3058 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3059 pp_string (pp
, " > ");
3062 case WIDEN_MULT_MINUS_EXPR
:
3063 pp_string (pp
, " WIDEN_MULT_MINUS_EXPR < ");
3064 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3065 pp_string (pp
, ", ");
3066 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3067 pp_string (pp
, ", ");
3068 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3069 pp_string (pp
, " > ");
3073 pp_string (pp
, "#pragma acc parallel");
3074 goto dump_omp_clauses_body
;
3077 pp_string (pp
, "#pragma acc kernels");
3078 goto dump_omp_clauses_body
;
3081 pp_string (pp
, "#pragma acc data");
3082 dump_omp_clauses (pp
, OACC_DATA_CLAUSES (node
), spc
, flags
);
3085 case OACC_HOST_DATA
:
3086 pp_string (pp
, "#pragma acc host_data");
3087 dump_omp_clauses (pp
, OACC_HOST_DATA_CLAUSES (node
), spc
, flags
);
3091 pp_string (pp
, "#pragma acc declare");
3092 dump_omp_clauses (pp
, OACC_DECLARE_CLAUSES (node
), spc
, flags
);
3096 pp_string (pp
, "#pragma acc update");
3097 dump_omp_clauses (pp
, OACC_UPDATE_CLAUSES (node
), spc
, flags
);
3100 case OACC_ENTER_DATA
:
3101 pp_string (pp
, "#pragma acc enter data");
3102 dump_omp_clauses (pp
, OACC_ENTER_DATA_CLAUSES (node
), spc
, flags
);
3105 case OACC_EXIT_DATA
:
3106 pp_string (pp
, "#pragma acc exit data");
3107 dump_omp_clauses (pp
, OACC_EXIT_DATA_CLAUSES (node
), spc
, flags
);
3111 pp_string (pp
, "#pragma acc cache");
3112 dump_omp_clauses (pp
, OACC_CACHE_CLAUSES (node
), spc
, flags
);
3116 pp_string (pp
, "#pragma omp parallel");
3117 dump_omp_clauses (pp
, OMP_PARALLEL_CLAUSES (node
), spc
, flags
);
3120 dump_omp_clauses_body
:
3121 dump_omp_clauses (pp
, OMP_CLAUSES (node
), spc
, flags
);
3125 if (!(flags
& TDF_SLIM
) && OMP_BODY (node
))
3127 newline_and_indent (pp
, spc
+ 2);
3129 newline_and_indent (pp
, spc
+ 4);
3130 dump_generic_node (pp
, OMP_BODY (node
), spc
+ 4, flags
, false);
3131 newline_and_indent (pp
, spc
+ 2);
3132 pp_right_brace (pp
);
3138 pp_string (pp
, OMP_TASK_BODY (node
) ? "#pragma omp task"
3139 : "#pragma omp taskwait");
3140 dump_omp_clauses (pp
, OMP_TASK_CLAUSES (node
), spc
, flags
);
3144 pp_string (pp
, "#pragma omp for");
3148 pp_string (pp
, "#pragma omp simd");
3151 case OMP_DISTRIBUTE
:
3152 pp_string (pp
, "#pragma omp distribute");
3156 pp_string (pp
, "#pragma omp taskloop");
3160 pp_string (pp
, "#pragma acc loop");
3164 pp_string (pp
, "#pragma omp teams");
3165 dump_omp_clauses (pp
, OMP_TEAMS_CLAUSES (node
), spc
, flags
);
3168 case OMP_TARGET_DATA
:
3169 pp_string (pp
, "#pragma omp target data");
3170 dump_omp_clauses (pp
, OMP_TARGET_DATA_CLAUSES (node
), spc
, flags
);
3173 case OMP_TARGET_ENTER_DATA
:
3174 pp_string (pp
, "#pragma omp target enter data");
3175 dump_omp_clauses (pp
, OMP_TARGET_ENTER_DATA_CLAUSES (node
), spc
, flags
);
3179 case OMP_TARGET_EXIT_DATA
:
3180 pp_string (pp
, "#pragma omp target exit data");
3181 dump_omp_clauses (pp
, OMP_TARGET_EXIT_DATA_CLAUSES (node
), spc
, flags
);
3186 pp_string (pp
, "#pragma omp target");
3187 dump_omp_clauses (pp
, OMP_TARGET_CLAUSES (node
), spc
, flags
);
3190 case OMP_TARGET_UPDATE
:
3191 pp_string (pp
, "#pragma omp target update");
3192 dump_omp_clauses (pp
, OMP_TARGET_UPDATE_CLAUSES (node
), spc
, flags
);
3197 dump_omp_clauses (pp
, OMP_FOR_CLAUSES (node
), spc
, flags
);
3198 if (!(flags
& TDF_SLIM
))
3202 if (OMP_FOR_PRE_BODY (node
))
3204 newline_and_indent (pp
, spc
+ 2);
3207 newline_and_indent (pp
, spc
);
3208 dump_generic_node (pp
, OMP_FOR_PRE_BODY (node
),
3211 if (OMP_FOR_INIT (node
))
3214 for (i
= 0; i
< TREE_VEC_LENGTH (OMP_FOR_INIT (node
)); i
++)
3217 newline_and_indent (pp
, spc
);
3218 pp_string (pp
, "for (");
3219 dump_generic_node (pp
,
3220 TREE_VEC_ELT (OMP_FOR_INIT (node
), i
),
3222 pp_string (pp
, "; ");
3223 dump_generic_node (pp
,
3224 TREE_VEC_ELT (OMP_FOR_COND (node
), i
),
3226 pp_string (pp
, "; ");
3227 dump_generic_node (pp
,
3228 TREE_VEC_ELT (OMP_FOR_INCR (node
), i
),
3230 pp_right_paren (pp
);
3233 if (OMP_FOR_BODY (node
))
3235 newline_and_indent (pp
, spc
+ 2);
3237 newline_and_indent (pp
, spc
+ 4);
3238 dump_generic_node (pp
, OMP_FOR_BODY (node
), spc
+ 4, flags
,
3240 newline_and_indent (pp
, spc
+ 2);
3241 pp_right_brace (pp
);
3243 if (OMP_FOR_INIT (node
))
3244 spc
-= 2 * TREE_VEC_LENGTH (OMP_FOR_INIT (node
)) - 2;
3245 if (OMP_FOR_PRE_BODY (node
))
3248 newline_and_indent (pp
, spc
+ 2);
3249 pp_right_brace (pp
);
3256 pp_string (pp
, "#pragma omp sections");
3257 dump_omp_clauses (pp
, OMP_SECTIONS_CLAUSES (node
), spc
, flags
);
3261 pp_string (pp
, "#pragma omp section");
3265 pp_string (pp
, "#pragma omp master");
3269 pp_string (pp
, "#pragma omp taskgroup");
3270 dump_omp_clauses (pp
, OMP_TASKGROUP_CLAUSES (node
), spc
, flags
);
3274 pp_string (pp
, "#pragma omp ordered");
3275 dump_omp_clauses (pp
, OMP_ORDERED_CLAUSES (node
), spc
, flags
);
3279 pp_string (pp
, "#pragma omp critical");
3280 if (OMP_CRITICAL_NAME (node
))
3284 dump_generic_node (pp
, OMP_CRITICAL_NAME (node
), spc
,
3286 pp_right_paren (pp
);
3288 dump_omp_clauses (pp
, OMP_CRITICAL_CLAUSES (node
), spc
, flags
);
3292 pp_string (pp
, "#pragma omp atomic");
3293 dump_omp_atomic_memory_order (pp
, OMP_ATOMIC_MEMORY_ORDER (node
));
3294 newline_and_indent (pp
, spc
+ 2);
3295 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3299 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3302 case OMP_ATOMIC_READ
:
3303 pp_string (pp
, "#pragma omp atomic read");
3304 dump_omp_atomic_memory_order (pp
, OMP_ATOMIC_MEMORY_ORDER (node
));
3305 newline_and_indent (pp
, spc
+ 2);
3306 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3310 case OMP_ATOMIC_CAPTURE_OLD
:
3311 case OMP_ATOMIC_CAPTURE_NEW
:
3312 pp_string (pp
, "#pragma omp atomic capture");
3313 dump_omp_atomic_memory_order (pp
, OMP_ATOMIC_MEMORY_ORDER (node
));
3314 newline_and_indent (pp
, spc
+ 2);
3315 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3319 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3323 pp_string (pp
, "#pragma omp single");
3324 dump_omp_clauses (pp
, OMP_SINGLE_CLAUSES (node
), spc
, flags
);
3328 dump_omp_clause (pp
, node
, spc
, flags
);
3332 case TRANSACTION_EXPR
:
3333 if (TRANSACTION_EXPR_OUTER (node
))
3334 pp_string (pp
, "__transaction_atomic [[outer]]");
3335 else if (TRANSACTION_EXPR_RELAXED (node
))
3336 pp_string (pp
, "__transaction_relaxed");
3338 pp_string (pp
, "__transaction_atomic");
3339 if (!(flags
& TDF_SLIM
) && TRANSACTION_EXPR_BODY (node
))
3341 newline_and_indent (pp
, spc
);
3343 newline_and_indent (pp
, spc
+ 2);
3344 dump_generic_node (pp
, TRANSACTION_EXPR_BODY (node
),
3345 spc
+ 2, flags
, false);
3346 newline_and_indent (pp
, spc
);
3347 pp_right_brace (pp
);
3352 case VEC_SERIES_EXPR
:
3353 case VEC_WIDEN_MULT_HI_EXPR
:
3354 case VEC_WIDEN_MULT_LO_EXPR
:
3355 case VEC_WIDEN_MULT_EVEN_EXPR
:
3356 case VEC_WIDEN_MULT_ODD_EXPR
:
3357 case VEC_WIDEN_LSHIFT_HI_EXPR
:
3358 case VEC_WIDEN_LSHIFT_LO_EXPR
:
3360 for (str
= get_tree_code_name (code
); *str
; str
++)
3361 pp_character (pp
, TOUPPER (*str
));
3362 pp_string (pp
, " < ");
3363 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3364 pp_string (pp
, ", ");
3365 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3366 pp_string (pp
, " > ");
3369 case VEC_DUPLICATE_EXPR
:
3371 for (str
= get_tree_code_name (code
); *str
; str
++)
3372 pp_character (pp
, TOUPPER (*str
));
3373 pp_string (pp
, " < ");
3374 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3375 pp_string (pp
, " > ");
3378 case VEC_UNPACK_HI_EXPR
:
3379 pp_string (pp
, " VEC_UNPACK_HI_EXPR < ");
3380 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3381 pp_string (pp
, " > ");
3384 case VEC_UNPACK_LO_EXPR
:
3385 pp_string (pp
, " VEC_UNPACK_LO_EXPR < ");
3386 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3387 pp_string (pp
, " > ");
3390 case VEC_UNPACK_FLOAT_HI_EXPR
:
3391 pp_string (pp
, " VEC_UNPACK_FLOAT_HI_EXPR < ");
3392 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3393 pp_string (pp
, " > ");
3396 case VEC_UNPACK_FLOAT_LO_EXPR
:
3397 pp_string (pp
, " VEC_UNPACK_FLOAT_LO_EXPR < ");
3398 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3399 pp_string (pp
, " > ");
3402 case VEC_UNPACK_FIX_TRUNC_HI_EXPR
:
3403 pp_string (pp
, " VEC_UNPACK_FIX_TRUNC_HI_EXPR < ");
3404 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3405 pp_string (pp
, " > ");
3408 case VEC_UNPACK_FIX_TRUNC_LO_EXPR
:
3409 pp_string (pp
, " VEC_UNPACK_FIX_TRUNC_LO_EXPR < ");
3410 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3411 pp_string (pp
, " > ");
3414 case VEC_PACK_TRUNC_EXPR
:
3415 pp_string (pp
, " VEC_PACK_TRUNC_EXPR < ");
3416 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3417 pp_string (pp
, ", ");
3418 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3419 pp_string (pp
, " > ");
3422 case VEC_PACK_SAT_EXPR
:
3423 pp_string (pp
, " VEC_PACK_SAT_EXPR < ");
3424 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3425 pp_string (pp
, ", ");
3426 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3427 pp_string (pp
, " > ");
3430 case VEC_PACK_FIX_TRUNC_EXPR
:
3431 pp_string (pp
, " VEC_PACK_FIX_TRUNC_EXPR < ");
3432 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3433 pp_string (pp
, ", ");
3434 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3435 pp_string (pp
, " > ");
3438 case VEC_PACK_FLOAT_EXPR
:
3439 pp_string (pp
, " VEC_PACK_FLOAT_EXPR < ");
3440 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3441 pp_string (pp
, ", ");
3442 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3443 pp_string (pp
, " > ");
3447 dump_block_node (pp
, node
, spc
, flags
);
3450 case DEBUG_BEGIN_STMT
:
3451 pp_string (pp
, "# DEBUG BEGIN STMT");
3458 if (is_stmt
&& is_expr
)
3464 /* Print the declaration of a variable. */
3467 print_declaration (pretty_printer
*pp
, tree t
, int spc
, dump_flags_t flags
)
3471 if (TREE_CODE(t
) == NAMELIST_DECL
)
3473 pp_string(pp
, "namelist ");
3474 dump_decl_name (pp
, t
, flags
);
3479 if (TREE_CODE (t
) == TYPE_DECL
)
3480 pp_string (pp
, "typedef ");
3482 if (CODE_CONTAINS_STRUCT (TREE_CODE (t
), TS_DECL_WRTL
) && DECL_REGISTER (t
))
3483 pp_string (pp
, "register ");
3485 if (TREE_PUBLIC (t
) && DECL_EXTERNAL (t
))
3486 pp_string (pp
, "extern ");
3487 else if (TREE_STATIC (t
))
3488 pp_string (pp
, "static ");
3490 /* Print the type and name. */
3491 if (TREE_TYPE (t
) && TREE_CODE (TREE_TYPE (t
)) == ARRAY_TYPE
)
3495 /* Print array's type. */
3496 tmp
= TREE_TYPE (t
);
3497 while (TREE_CODE (TREE_TYPE (tmp
)) == ARRAY_TYPE
)
3498 tmp
= TREE_TYPE (tmp
);
3499 dump_generic_node (pp
, TREE_TYPE (tmp
), spc
, flags
, false);
3501 /* Print variable's name. */
3503 dump_generic_node (pp
, t
, spc
, flags
, false);
3505 /* Print the dimensions. */
3506 tmp
= TREE_TYPE (t
);
3507 while (TREE_CODE (tmp
) == ARRAY_TYPE
)
3509 dump_array_domain (pp
, TYPE_DOMAIN (tmp
), spc
, flags
);
3510 tmp
= TREE_TYPE (tmp
);
3513 else if (TREE_CODE (t
) == FUNCTION_DECL
)
3515 dump_generic_node (pp
, TREE_TYPE (TREE_TYPE (t
)), spc
, flags
, false);
3517 dump_decl_name (pp
, t
, flags
);
3518 dump_function_declaration (pp
, TREE_TYPE (t
), spc
, flags
);
3522 /* Print type declaration. */
3523 dump_generic_node (pp
, TREE_TYPE (t
), spc
, flags
, false);
3525 /* Print variable's name. */
3527 dump_generic_node (pp
, t
, spc
, flags
, false);
3530 if (VAR_P (t
) && DECL_HARD_REGISTER (t
))
3532 pp_string (pp
, " __asm__ ");
3534 dump_generic_node (pp
, DECL_ASSEMBLER_NAME (t
), spc
, flags
, false);
3535 pp_right_paren (pp
);
3538 /* The initial value of a function serves to determine whether the function
3539 is declared or defined. So the following does not apply to function
3541 if (TREE_CODE (t
) != FUNCTION_DECL
)
3543 /* Print the initial value. */
3544 if (DECL_INITIAL (t
))
3549 if (!(flags
& TDF_SLIM
))
3550 dump_generic_node (pp
, DECL_INITIAL (t
), spc
, flags
, false);
3552 pp_string (pp
, "<<< omitted >>>");
3556 if (VAR_P (t
) && DECL_HAS_VALUE_EXPR_P (t
))
3558 pp_string (pp
, " [value-expr: ");
3559 dump_generic_node (pp
, DECL_VALUE_EXPR (t
), spc
, flags
, false);
3560 pp_right_bracket (pp
);
3567 /* Prints a structure: name, fields, and methods.
3568 FIXME: Still incomplete. */
3571 print_struct_decl (pretty_printer
*pp
, const_tree node
, int spc
,
3574 /* Print the name of the structure. */
3575 if (TYPE_NAME (node
))
3578 if (TREE_CODE (node
) == RECORD_TYPE
)
3579 pp_string (pp
, "struct ");
3580 else if ((TREE_CODE (node
) == UNION_TYPE
3581 || TREE_CODE (node
) == QUAL_UNION_TYPE
))
3582 pp_string (pp
, "union ");
3584 dump_generic_node (pp
, TYPE_NAME (node
), spc
, TDF_NONE
, false);
3587 /* Print the contents of the structure. */
3593 /* Print the fields of the structure. */
3596 tmp
= TYPE_FIELDS (node
);
3599 /* Avoid to print recursively the structure. */
3600 /* FIXME : Not implemented correctly...,
3601 what about the case when we have a cycle in the contain graph? ...
3602 Maybe this could be solved by looking at the scope in which the
3603 structure was declared. */
3604 if (TREE_TYPE (tmp
) != node
3605 && (TREE_CODE (TREE_TYPE (tmp
)) != POINTER_TYPE
3606 || TREE_TYPE (TREE_TYPE (tmp
)) != node
))
3608 print_declaration (pp
, tmp
, spc
+2, flags
);
3611 tmp
= DECL_CHAIN (tmp
);
3615 pp_right_brace (pp
);
3618 /* Return the priority of the operator CODE.
3620 From lowest to highest precedence with either left-to-right (L-R)
3621 or right-to-left (R-L) associativity]:
3624 2 [R-L] = += -= *= /= %= &= ^= |= <<= >>=
3636 14 [R-L] ! ~ ++ -- + - * & (type) sizeof
3637 15 [L-R] fn() [] -> .
3639 unary +, - and * have higher precedence than the corresponding binary
3643 op_code_prio (enum tree_code code
)
3660 case TRUTH_ORIF_EXPR
:
3663 case TRUTH_AND_EXPR
:
3664 case TRUTH_ANDIF_EXPR
:
3671 case TRUTH_XOR_EXPR
:
3688 case UNORDERED_EXPR
:
3699 case VEC_WIDEN_LSHIFT_HI_EXPR
:
3700 case VEC_WIDEN_LSHIFT_LO_EXPR
:
3701 case WIDEN_LSHIFT_EXPR
:
3704 case WIDEN_SUM_EXPR
:
3706 case POINTER_PLUS_EXPR
:
3707 case POINTER_DIFF_EXPR
:
3711 case VEC_WIDEN_MULT_HI_EXPR
:
3712 case VEC_WIDEN_MULT_LO_EXPR
:
3713 case WIDEN_MULT_EXPR
:
3715 case WIDEN_MULT_PLUS_EXPR
:
3716 case WIDEN_MULT_MINUS_EXPR
:
3718 case MULT_HIGHPART_EXPR
:
3719 case TRUNC_DIV_EXPR
:
3721 case FLOOR_DIV_EXPR
:
3722 case ROUND_DIV_EXPR
:
3724 case EXACT_DIV_EXPR
:
3725 case TRUNC_MOD_EXPR
:
3727 case FLOOR_MOD_EXPR
:
3728 case ROUND_MOD_EXPR
:
3731 case TRUTH_NOT_EXPR
:
3733 case POSTINCREMENT_EXPR
:
3734 case POSTDECREMENT_EXPR
:
3735 case PREINCREMENT_EXPR
:
3736 case PREDECREMENT_EXPR
:
3742 case FIX_TRUNC_EXPR
:
3748 case ARRAY_RANGE_REF
:
3752 /* Special expressions. */
3758 case VEC_UNPACK_HI_EXPR
:
3759 case VEC_UNPACK_LO_EXPR
:
3760 case VEC_UNPACK_FLOAT_HI_EXPR
:
3761 case VEC_UNPACK_FLOAT_LO_EXPR
:
3762 case VEC_UNPACK_FIX_TRUNC_HI_EXPR
:
3763 case VEC_UNPACK_FIX_TRUNC_LO_EXPR
:
3764 case VEC_PACK_TRUNC_EXPR
:
3765 case VEC_PACK_SAT_EXPR
:
3769 /* Return an arbitrarily high precedence to avoid surrounding single
3770 VAR_DECLs in ()s. */
3775 /* Return the priority of the operator OP. */
3778 op_prio (const_tree op
)
3780 enum tree_code code
;
3785 code
= TREE_CODE (op
);
3786 if (code
== SAVE_EXPR
|| code
== NON_LVALUE_EXPR
)
3787 return op_prio (TREE_OPERAND (op
, 0));
3789 return op_code_prio (code
);
3792 /* Return the symbol associated with operator CODE. */
3795 op_symbol_code (enum tree_code code
)
3803 case TRUTH_ORIF_EXPR
:
3806 case TRUTH_AND_EXPR
:
3807 case TRUTH_ANDIF_EXPR
:
3813 case TRUTH_XOR_EXPR
:
3823 case UNORDERED_EXPR
:
3869 case WIDEN_LSHIFT_EXPR
:
3872 case POINTER_PLUS_EXPR
:
3878 case WIDEN_SUM_EXPR
:
3881 case WIDEN_MULT_EXPR
:
3884 case MULT_HIGHPART_EXPR
:
3889 case POINTER_DIFF_EXPR
:
3895 case TRUTH_NOT_EXPR
:
3902 case TRUNC_DIV_EXPR
:
3909 case FLOOR_DIV_EXPR
:
3912 case ROUND_DIV_EXPR
:
3915 case EXACT_DIV_EXPR
:
3918 case TRUNC_MOD_EXPR
:
3924 case FLOOR_MOD_EXPR
:
3927 case ROUND_MOD_EXPR
:
3930 case PREDECREMENT_EXPR
:
3933 case PREINCREMENT_EXPR
:
3936 case POSTDECREMENT_EXPR
:
3939 case POSTINCREMENT_EXPR
:
3949 return "<<< ??? >>>";
3953 /* Return the symbol associated with operator OP. */
3956 op_symbol (const_tree op
)
3958 return op_symbol_code (TREE_CODE (op
));
3961 /* Prints the name of a call. NODE is the CALL_EXPR_FN of a CALL_EXPR or
3962 the gimple_call_fn of a GIMPLE_CALL. */
3965 print_call_name (pretty_printer
*pp
, tree node
, dump_flags_t flags
)
3969 if (TREE_CODE (op0
) == NON_LVALUE_EXPR
)
3970 op0
= TREE_OPERAND (op0
, 0);
3973 switch (TREE_CODE (op0
))
3978 dump_function_name (pp
, op0
, flags
);
3984 op0
= TREE_OPERAND (op0
, 0);
3989 dump_generic_node (pp
, TREE_OPERAND (op0
, 0), 0, flags
, false);
3990 pp_string (pp
, ") ? ");
3991 dump_generic_node (pp
, TREE_OPERAND (op0
, 1), 0, flags
, false);
3992 pp_string (pp
, " : ");
3993 dump_generic_node (pp
, TREE_OPERAND (op0
, 2), 0, flags
, false);
3997 if (TREE_CODE (TREE_OPERAND (op0
, 0)) == VAR_DECL
)
3998 dump_function_name (pp
, TREE_OPERAND (op0
, 0), flags
);
4000 dump_generic_node (pp
, op0
, 0, flags
, false);
4004 if (integer_zerop (TREE_OPERAND (op0
, 1)))
4006 op0
= TREE_OPERAND (op0
, 0);
4013 dump_generic_node (pp
, op0
, 0, flags
, false);
4021 /* Print the first N characters in the array STR, replacing non-printable
4022 characters (including embedded nuls) with unambiguous escape sequences. */
4025 pretty_print_string (pretty_printer
*pp
, const char *str
, unsigned n
)
4030 for ( ; n
; --n
, ++str
)
4035 pp_string (pp
, "\\b");
4039 pp_string (pp
, "\\f");
4043 pp_string (pp
, "\\n");
4047 pp_string (pp
, "\\r");
4051 pp_string (pp
, "\\t");
4055 pp_string (pp
, "\\v");
4059 pp_string (pp
, "\\\\");
4063 pp_string (pp
, "\\\"");
4067 pp_string (pp
, "\\'");
4071 if (str
[0] || n
> 1)
4073 if (!ISPRINT (str
[0]))
4076 sprintf (buf
, "\\x%02x", (unsigned char)str
[0]);
4077 pp_string (pp
, buf
);
4080 pp_character (pp
, str
[0]);
4088 maybe_init_pretty_print (FILE *file
)
4092 tree_pp
= new pretty_printer ();
4093 pp_needs_newline (tree_pp
) = true;
4094 pp_translate_identifiers (tree_pp
) = false;
4097 tree_pp
->buffer
->stream
= file
;
4101 newline_and_indent (pretty_printer
*pp
, int spc
)
4107 /* Handle the %K format for TEXT. Separate from default_tree_printer
4108 so it can also be used in front ends.
4109 The location LOC and BLOCK are expected to be extracted by the caller
4110 from the %K argument arg via EXPR_LOCATION(arg) and TREE_BLOCK(arg). */
4113 percent_K_format (text_info
*text
, location_t loc
, tree block
)
4115 text
->set_location (0, loc
, SHOW_RANGE_WITH_CARET
);
4116 gcc_assert (pp_ti_abstract_origin (text
) != NULL
);
4117 *pp_ti_abstract_origin (text
) = NULL
;
4120 && TREE_CODE (block
) == BLOCK
4121 && BLOCK_ABSTRACT_ORIGIN (block
))
4123 tree ao
= BLOCK_ABSTRACT_ORIGIN (block
);
4124 if (TREE_CODE (ao
) == FUNCTION_DECL
)
4126 *pp_ti_abstract_origin (text
) = block
;
4129 block
= BLOCK_SUPERCONTEXT (block
);
4133 /* Print the identifier ID to PRETTY-PRINTER. */
4136 pp_tree_identifier (pretty_printer
*pp
, tree id
)
4138 if (pp_translate_identifiers (pp
))
4140 const char *text
= identifier_to_locale (IDENTIFIER_POINTER (id
));
4141 pp_append_text (pp
, text
, text
+ strlen (text
));
4144 pp_append_text (pp
, IDENTIFIER_POINTER (id
),
4145 IDENTIFIER_POINTER (id
) + IDENTIFIER_LENGTH (id
));
4148 /* A helper function that is used to dump function information before the
4152 dump_function_header (FILE *dump_file
, tree fdecl
, dump_flags_t flags
)
4154 const char *dname
, *aname
;
4155 struct cgraph_node
*node
= cgraph_node::get (fdecl
);
4156 struct function
*fun
= DECL_STRUCT_FUNCTION (fdecl
);
4158 dname
= lang_hooks
.decl_printable_name (fdecl
, 1);
4160 if (DECL_ASSEMBLER_NAME_SET_P (fdecl
))
4161 aname
= (IDENTIFIER_POINTER
4162 (DECL_ASSEMBLER_NAME (fdecl
)));
4164 aname
= "<unset-asm-name>";
4166 fprintf (dump_file
, "\n;; Function %s (%s, funcdef_no=%d",
4167 dname
, aname
, fun
->funcdef_no
);
4168 if (!(flags
& TDF_NOUID
))
4169 fprintf (dump_file
, ", decl_uid=%d", DECL_UID (fdecl
));
4172 fprintf (dump_file
, ", cgraph_uid=%d", node
->get_uid ());
4173 fprintf (dump_file
, ", symbol_order=%d)%s\n\n", node
->order
,
4174 node
->frequency
== NODE_FREQUENCY_HOT
4176 : node
->frequency
== NODE_FREQUENCY_UNLIKELY_EXECUTED
4177 ? " (unlikely executed)"
4178 : node
->frequency
== NODE_FREQUENCY_EXECUTED_ONCE
4179 ? " (executed once)"
4183 fprintf (dump_file
, ")\n\n");
4186 /* Dump double_int D to pretty_printer PP. UNS is true
4187 if D is unsigned and false otherwise. */
4189 pp_double_int (pretty_printer
*pp
, double_int d
, bool uns
)
4192 pp_wide_integer (pp
, d
.low
);
4193 else if (d
.fits_uhwi ())
4194 pp_unsigned_wide_integer (pp
, d
.low
);
4197 unsigned HOST_WIDE_INT low
= d
.low
;
4198 HOST_WIDE_INT high
= d
.high
;
4199 if (!uns
&& d
.is_negative ())
4202 high
= ~high
+ !low
;
4205 /* Would "%x%0*x" or "%x%*0x" get zero-padding on all
4207 sprintf (pp_buffer (pp
)->digit_buffer
,
4208 HOST_WIDE_INT_PRINT_DOUBLE_HEX
,
4209 (unsigned HOST_WIDE_INT
) high
, low
);
4210 pp_string (pp
, pp_buffer (pp
)->digit_buffer
);