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");
1183 /* Should never happen. */
1184 dump_generic_node (pp
, clause
, spc
, flags
, false);
1190 /* Dump the list of OpenMP clauses. PP, SPC and FLAGS are as in
1191 dump_generic_node. */
1194 dump_omp_clauses (pretty_printer
*pp
, tree clause
, int spc
, dump_flags_t flags
)
1202 dump_omp_clause (pp
, clause
, spc
, flags
);
1203 clause
= OMP_CLAUSE_CHAIN (clause
);
1211 /* Dump location LOC to PP. */
1214 dump_location (pretty_printer
*pp
, location_t loc
)
1216 expanded_location xloc
= expand_location (loc
);
1218 pp_left_bracket (pp
);
1221 pp_string (pp
, xloc
.file
);
1222 pp_string (pp
, ":");
1224 pp_decimal_int (pp
, xloc
.line
);
1226 pp_decimal_int (pp
, xloc
.column
);
1227 pp_string (pp
, "] ");
1231 /* Dump lexical block BLOCK. PP, SPC and FLAGS are as in
1232 dump_generic_node. */
1235 dump_block_node (pretty_printer
*pp
, tree block
, int spc
, dump_flags_t flags
)
1239 pp_printf (pp
, "BLOCK #%d ", BLOCK_NUMBER (block
));
1241 if (flags
& TDF_ADDRESS
)
1242 pp_printf (pp
, "[%p] ", (void *) block
);
1244 if (TREE_ASM_WRITTEN (block
))
1245 pp_string (pp
, "[written] ");
1247 if (flags
& TDF_SLIM
)
1250 if (BLOCK_SOURCE_LOCATION (block
))
1251 dump_location (pp
, BLOCK_SOURCE_LOCATION (block
));
1253 newline_and_indent (pp
, spc
+ 2);
1255 if (BLOCK_SUPERCONTEXT (block
))
1257 pp_string (pp
, "SUPERCONTEXT: ");
1258 dump_generic_node (pp
, BLOCK_SUPERCONTEXT (block
), 0,
1259 flags
| TDF_SLIM
, false);
1260 newline_and_indent (pp
, spc
+ 2);
1263 if (BLOCK_SUBBLOCKS (block
))
1265 pp_string (pp
, "SUBBLOCKS: ");
1266 for (t
= BLOCK_SUBBLOCKS (block
); t
; t
= BLOCK_CHAIN (t
))
1268 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
1271 newline_and_indent (pp
, spc
+ 2);
1274 if (BLOCK_CHAIN (block
))
1276 pp_string (pp
, "SIBLINGS: ");
1277 for (t
= BLOCK_CHAIN (block
); t
; t
= BLOCK_CHAIN (t
))
1279 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
1282 newline_and_indent (pp
, spc
+ 2);
1285 if (BLOCK_VARS (block
))
1287 pp_string (pp
, "VARS: ");
1288 for (t
= BLOCK_VARS (block
); t
; t
= TREE_CHAIN (t
))
1290 dump_generic_node (pp
, t
, 0, flags
, false);
1293 newline_and_indent (pp
, spc
+ 2);
1296 if (vec_safe_length (BLOCK_NONLOCALIZED_VARS (block
)) > 0)
1299 vec
<tree
, va_gc
> *nlv
= BLOCK_NONLOCALIZED_VARS (block
);
1301 pp_string (pp
, "NONLOCALIZED_VARS: ");
1302 FOR_EACH_VEC_ELT (*nlv
, i
, t
)
1304 dump_generic_node (pp
, t
, 0, flags
, false);
1307 newline_and_indent (pp
, spc
+ 2);
1310 if (BLOCK_ABSTRACT_ORIGIN (block
))
1312 pp_string (pp
, "ABSTRACT_ORIGIN: ");
1313 dump_generic_node (pp
, BLOCK_ABSTRACT_ORIGIN (block
), 0,
1314 flags
| TDF_SLIM
, false);
1315 newline_and_indent (pp
, spc
+ 2);
1318 if (BLOCK_FRAGMENT_ORIGIN (block
))
1320 pp_string (pp
, "FRAGMENT_ORIGIN: ");
1321 dump_generic_node (pp
, BLOCK_FRAGMENT_ORIGIN (block
), 0,
1322 flags
| TDF_SLIM
, false);
1323 newline_and_indent (pp
, spc
+ 2);
1326 if (BLOCK_FRAGMENT_CHAIN (block
))
1328 pp_string (pp
, "FRAGMENT_CHAIN: ");
1329 for (t
= BLOCK_FRAGMENT_CHAIN (block
); t
; t
= BLOCK_FRAGMENT_CHAIN (t
))
1331 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
1334 newline_and_indent (pp
, spc
+ 2);
1338 /* Dump #pragma omp atomic memory order clause. */
1341 dump_omp_atomic_memory_order (pretty_printer
*pp
, enum omp_memory_order mo
)
1345 case OMP_MEMORY_ORDER_RELAXED
:
1346 pp_string (pp
, " relaxed");
1348 case OMP_MEMORY_ORDER_SEQ_CST
:
1349 pp_string (pp
, " seq_cst");
1351 case OMP_MEMORY_ORDER_ACQ_REL
:
1352 pp_string (pp
, " acq_rel");
1354 case OMP_MEMORY_ORDER_ACQUIRE
:
1355 pp_string (pp
, " acquire");
1357 case OMP_MEMORY_ORDER_RELEASE
:
1358 pp_string (pp
, " release");
1360 case OMP_MEMORY_ORDER_UNSPECIFIED
:
1367 /* Dump the node NODE on the pretty_printer PP, SPC spaces of
1368 indent. FLAGS specifies details to show in the dump (see TDF_* in
1369 dumpfile.h). If IS_STMT is true, the object printed is considered
1370 to be a statement and it is terminated by ';' if appropriate. */
1373 dump_generic_node (pretty_printer
*pp
, tree node
, int spc
, dump_flags_t flags
,
1380 enum tree_code code
;
1382 if (node
== NULL_TREE
)
1385 is_expr
= EXPR_P (node
);
1387 if (is_stmt
&& (flags
& TDF_STMTADDR
))
1388 pp_printf (pp
, "<&%p> ", (void *)node
);
1390 if ((flags
& TDF_LINENO
) && EXPR_HAS_LOCATION (node
))
1391 dump_location (pp
, EXPR_LOCATION (node
));
1393 code
= TREE_CODE (node
);
1397 pp_string (pp
, "<<< error >>>");
1400 case IDENTIFIER_NODE
:
1401 pp_tree_identifier (pp
, node
);
1405 while (node
&& node
!= error_mark_node
)
1407 if (TREE_PURPOSE (node
))
1409 dump_generic_node (pp
, TREE_PURPOSE (node
), spc
, flags
, false);
1412 dump_generic_node (pp
, TREE_VALUE (node
), spc
, flags
, false);
1413 node
= TREE_CHAIN (node
);
1414 if (node
&& TREE_CODE (node
) == TREE_LIST
)
1423 dump_generic_node (pp
, BINFO_TYPE (node
), spc
, flags
, false);
1429 if (TREE_VEC_LENGTH (node
) > 0)
1431 size_t len
= TREE_VEC_LENGTH (node
);
1432 for (i
= 0; i
< len
- 1; i
++)
1434 dump_generic_node (pp
, TREE_VEC_ELT (node
, i
), spc
, flags
,
1439 dump_generic_node (pp
, TREE_VEC_ELT (node
, len
- 1), spc
,
1448 case FIXED_POINT_TYPE
:
1454 unsigned int quals
= TYPE_QUALS (node
);
1455 enum tree_code_class tclass
;
1457 if (quals
& TYPE_QUAL_ATOMIC
)
1458 pp_string (pp
, "atomic ");
1459 if (quals
& TYPE_QUAL_CONST
)
1460 pp_string (pp
, "const ");
1461 else if (quals
& TYPE_QUAL_VOLATILE
)
1462 pp_string (pp
, "volatile ");
1463 else if (quals
& TYPE_QUAL_RESTRICT
)
1464 pp_string (pp
, "restrict ");
1466 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
1468 pp_string (pp
, "<address-space-");
1469 pp_decimal_int (pp
, TYPE_ADDR_SPACE (node
));
1470 pp_string (pp
, "> ");
1473 tclass
= TREE_CODE_CLASS (TREE_CODE (node
));
1475 if (tclass
== tcc_declaration
)
1477 if (DECL_NAME (node
))
1478 dump_decl_name (pp
, node
, flags
);
1480 pp_string (pp
, "<unnamed type decl>");
1482 else if (tclass
== tcc_type
)
1484 if (TYPE_NAME (node
))
1486 if (TREE_CODE (TYPE_NAME (node
)) == IDENTIFIER_NODE
)
1487 pp_tree_identifier (pp
, TYPE_NAME (node
));
1488 else if (TREE_CODE (TYPE_NAME (node
)) == TYPE_DECL
1489 && DECL_NAME (TYPE_NAME (node
)))
1490 dump_decl_name (pp
, TYPE_NAME (node
), flags
);
1492 pp_string (pp
, "<unnamed type>");
1494 else if (TREE_CODE (node
) == VECTOR_TYPE
)
1496 pp_string (pp
, "vector");
1498 pp_wide_integer (pp
, TYPE_VECTOR_SUBPARTS (node
));
1499 pp_string (pp
, ") ");
1500 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1502 else if (TREE_CODE (node
) == INTEGER_TYPE
)
1504 if (TYPE_PRECISION (node
) == CHAR_TYPE_SIZE
)
1505 pp_string (pp
, (TYPE_UNSIGNED (node
)
1508 else if (TYPE_PRECISION (node
) == SHORT_TYPE_SIZE
)
1509 pp_string (pp
, (TYPE_UNSIGNED (node
)
1512 else if (TYPE_PRECISION (node
) == INT_TYPE_SIZE
)
1513 pp_string (pp
, (TYPE_UNSIGNED (node
)
1516 else if (TYPE_PRECISION (node
) == LONG_TYPE_SIZE
)
1517 pp_string (pp
, (TYPE_UNSIGNED (node
)
1520 else if (TYPE_PRECISION (node
) == LONG_LONG_TYPE_SIZE
)
1521 pp_string (pp
, (TYPE_UNSIGNED (node
)
1522 ? "unsigned long long"
1523 : "signed long long"));
1524 else if (TYPE_PRECISION (node
) >= CHAR_TYPE_SIZE
1525 && pow2p_hwi (TYPE_PRECISION (node
)))
1527 pp_string (pp
, (TYPE_UNSIGNED (node
) ? "uint" : "int"));
1528 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1529 pp_string (pp
, "_t");
1533 pp_string (pp
, (TYPE_UNSIGNED (node
)
1534 ? "<unnamed-unsigned:"
1535 : "<unnamed-signed:"));
1536 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1540 else if (TREE_CODE (node
) == COMPLEX_TYPE
)
1542 pp_string (pp
, "__complex__ ");
1543 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1545 else if (TREE_CODE (node
) == REAL_TYPE
)
1547 pp_string (pp
, "<float:");
1548 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1551 else if (TREE_CODE (node
) == FIXED_POINT_TYPE
)
1553 pp_string (pp
, "<fixed-point-");
1554 pp_string (pp
, TYPE_SATURATING (node
) ? "sat:" : "nonsat:");
1555 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1558 else if (TREE_CODE (node
) == VOID_TYPE
)
1559 pp_string (pp
, "void");
1561 pp_string (pp
, "<unnamed type>");
1567 case REFERENCE_TYPE
:
1568 str
= (TREE_CODE (node
) == POINTER_TYPE
? "*" : "&");
1570 if (TREE_TYPE (node
) == NULL
)
1572 pp_string (pp
, str
);
1573 pp_string (pp
, "<null type>");
1575 else if (TREE_CODE (TREE_TYPE (node
)) == FUNCTION_TYPE
)
1577 tree fnode
= TREE_TYPE (node
);
1579 dump_generic_node (pp
, TREE_TYPE (fnode
), spc
, flags
, false);
1582 pp_string (pp
, str
);
1583 if (TYPE_IDENTIFIER (node
))
1584 dump_generic_node (pp
, TYPE_NAME (node
), spc
, flags
, false);
1585 else if (flags
& TDF_NOUID
)
1586 pp_printf (pp
, "<Txxxx>");
1588 pp_printf (pp
, "<T%x>", TYPE_UID (node
));
1590 pp_right_paren (pp
);
1591 dump_function_declaration (pp
, fnode
, spc
, flags
);
1595 unsigned int quals
= TYPE_QUALS (node
);
1597 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1599 pp_string (pp
, str
);
1601 if (quals
& TYPE_QUAL_CONST
)
1602 pp_string (pp
, " const");
1603 if (quals
& TYPE_QUAL_VOLATILE
)
1604 pp_string (pp
, " volatile");
1605 if (quals
& TYPE_QUAL_RESTRICT
)
1606 pp_string (pp
, " restrict");
1608 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
1610 pp_string (pp
, " <address-space-");
1611 pp_decimal_int (pp
, TYPE_ADDR_SPACE (node
));
1615 if (TYPE_REF_CAN_ALIAS_ALL (node
))
1616 pp_string (pp
, " {ref-all}");
1626 if (flags
& TDF_GIMPLE
)
1628 pp_string (pp
, "__MEM <");
1629 dump_generic_node (pp
, TREE_TYPE (node
),
1630 spc
, flags
| TDF_SLIM
, false);
1631 if (TYPE_ALIGN (TREE_TYPE (node
))
1632 != TYPE_ALIGN (TYPE_MAIN_VARIANT (TREE_TYPE (node
))))
1634 pp_string (pp
, ", ");
1635 pp_decimal_int (pp
, TYPE_ALIGN (TREE_TYPE (node
)));
1638 pp_string (pp
, " (");
1639 if (TREE_TYPE (TREE_OPERAND (node
, 0))
1640 != TREE_TYPE (TREE_OPERAND (node
, 1)))
1643 dump_generic_node (pp
, TREE_TYPE (TREE_OPERAND (node
, 1)),
1644 spc
, flags
| TDF_SLIM
, false);
1645 pp_right_paren (pp
);
1647 dump_generic_node (pp
, TREE_OPERAND (node
, 0),
1648 spc
, flags
| TDF_SLIM
, false);
1649 if (! integer_zerop (TREE_OPERAND (node
, 1)))
1651 pp_string (pp
, " + ");
1652 dump_generic_node (pp
, TREE_OPERAND (node
, 1),
1653 spc
, flags
| TDF_SLIM
, false);
1655 pp_right_paren (pp
);
1657 else if (integer_zerop (TREE_OPERAND (node
, 1))
1658 /* Dump the types of INTEGER_CSTs explicitly, for we can't
1659 infer them and MEM_ATTR caching will share MEM_REFs
1660 with differently-typed op0s. */
1661 && TREE_CODE (TREE_OPERAND (node
, 0)) != INTEGER_CST
1662 /* Released SSA_NAMES have no TREE_TYPE. */
1663 && TREE_TYPE (TREE_OPERAND (node
, 0)) != NULL_TREE
1664 /* Same pointer types, but ignoring POINTER_TYPE vs.
1666 && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 0)))
1667 == TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 1))))
1668 && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (node
, 0)))
1669 == TYPE_MODE (TREE_TYPE (TREE_OPERAND (node
, 1))))
1670 && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node
, 0)))
1671 == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node
, 1))))
1672 /* Same value types ignoring qualifiers. */
1673 && (TYPE_MAIN_VARIANT (TREE_TYPE (node
))
1674 == TYPE_MAIN_VARIANT
1675 (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 1)))))
1676 && (!(flags
& TDF_ALIAS
)
1677 || MR_DEPENDENCE_CLIQUE (node
) == 0))
1679 if (TREE_CODE (TREE_OPERAND (node
, 0)) != ADDR_EXPR
)
1682 dump_generic_node (pp
, TREE_OPERAND (node
, 0),
1686 dump_generic_node (pp
,
1687 TREE_OPERAND (TREE_OPERAND (node
, 0), 0),
1694 pp_string (pp
, "MEM[");
1696 ptype
= TYPE_MAIN_VARIANT (TREE_TYPE (TREE_OPERAND (node
, 1)));
1697 dump_generic_node (pp
, ptype
,
1698 spc
, flags
| TDF_SLIM
, false);
1699 pp_right_paren (pp
);
1700 dump_generic_node (pp
, TREE_OPERAND (node
, 0),
1702 if (!integer_zerop (TREE_OPERAND (node
, 1)))
1704 pp_string (pp
, " + ");
1705 dump_generic_node (pp
, TREE_OPERAND (node
, 1),
1708 if ((flags
& TDF_ALIAS
)
1709 && MR_DEPENDENCE_CLIQUE (node
) != 0)
1711 pp_string (pp
, " clique ");
1712 pp_unsigned_wide_integer (pp
, MR_DEPENDENCE_CLIQUE (node
));
1713 pp_string (pp
, " base ");
1714 pp_unsigned_wide_integer (pp
, MR_DEPENDENCE_BASE (node
));
1716 pp_right_bracket (pp
);
1721 case TARGET_MEM_REF
:
1723 const char *sep
= "";
1726 pp_string (pp
, "MEM[");
1728 if (TREE_CODE (TMR_BASE (node
)) == ADDR_EXPR
)
1730 pp_string (pp
, sep
);
1732 pp_string (pp
, "symbol: ");
1733 dump_generic_node (pp
, TREE_OPERAND (TMR_BASE (node
), 0),
1738 pp_string (pp
, sep
);
1740 pp_string (pp
, "base: ");
1741 dump_generic_node (pp
, TMR_BASE (node
), spc
, flags
, false);
1743 tmp
= TMR_INDEX2 (node
);
1746 pp_string (pp
, sep
);
1748 pp_string (pp
, "base: ");
1749 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1751 tmp
= TMR_INDEX (node
);
1754 pp_string (pp
, sep
);
1756 pp_string (pp
, "index: ");
1757 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1759 tmp
= TMR_STEP (node
);
1762 pp_string (pp
, sep
);
1764 pp_string (pp
, "step: ");
1765 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1767 tmp
= TMR_OFFSET (node
);
1770 pp_string (pp
, sep
);
1772 pp_string (pp
, "offset: ");
1773 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1775 pp_right_bracket (pp
);
1783 /* Print the innermost component type. */
1784 for (tmp
= TREE_TYPE (node
); TREE_CODE (tmp
) == ARRAY_TYPE
;
1785 tmp
= TREE_TYPE (tmp
))
1787 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1789 /* Print the dimensions. */
1790 for (tmp
= node
; TREE_CODE (tmp
) == ARRAY_TYPE
; tmp
= TREE_TYPE (tmp
))
1791 dump_array_domain (pp
, TYPE_DOMAIN (tmp
), spc
, flags
);
1797 case QUAL_UNION_TYPE
:
1799 unsigned int quals
= TYPE_QUALS (node
);
1801 if (quals
& TYPE_QUAL_ATOMIC
)
1802 pp_string (pp
, "atomic ");
1803 if (quals
& TYPE_QUAL_CONST
)
1804 pp_string (pp
, "const ");
1805 if (quals
& TYPE_QUAL_VOLATILE
)
1806 pp_string (pp
, "volatile ");
1808 /* Print the name of the structure. */
1809 if (TREE_CODE (node
) == RECORD_TYPE
)
1810 pp_string (pp
, "struct ");
1811 else if (TREE_CODE (node
) == UNION_TYPE
)
1812 pp_string (pp
, "union ");
1814 if (TYPE_NAME (node
))
1815 dump_generic_node (pp
, TYPE_NAME (node
), spc
, flags
, false);
1816 else if (!(flags
& TDF_SLIM
))
1817 /* FIXME: If we eliminate the 'else' above and attempt
1818 to show the fields for named types, we may get stuck
1819 following a cycle of pointers to structs. The alleged
1820 self-reference check in print_struct_decl will not detect
1821 cycles involving more than one pointer or struct type. */
1822 print_struct_decl (pp
, node
, spc
, flags
);
1831 if (flags
& TDF_GIMPLE
1832 && (POINTER_TYPE_P (TREE_TYPE (node
))
1833 || (TYPE_PRECISION (TREE_TYPE (node
))
1834 < TYPE_PRECISION (integer_type_node
))
1835 || exact_log2 (TYPE_PRECISION (TREE_TYPE (node
))) == -1))
1837 pp_string (pp
, "_Literal (");
1838 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1839 pp_string (pp
, ") ");
1841 if (TREE_CODE (TREE_TYPE (node
)) == POINTER_TYPE
1842 && ! (flags
& TDF_GIMPLE
))
1844 /* In the case of a pointer, one may want to divide by the
1845 size of the pointed-to type. Unfortunately, this not
1846 straightforward. The C front-end maps expressions
1851 in such a way that the two INTEGER_CST nodes for "5" have
1852 different values but identical types. In the latter
1853 case, the 5 is multiplied by sizeof (int) in c-common.c
1854 (pointer_int_sum) to convert it to a byte address, and
1855 yet the type of the node is left unchanged. Argh. What
1856 is consistent though is that the number value corresponds
1857 to bytes (UNITS) offset.
1859 NB: Neither of the following divisors can be trivially
1860 used to recover the original literal:
1862 TREE_INT_CST_LOW (TYPE_SIZE_UNIT (TREE_TYPE (node)))
1863 TYPE_PRECISION (TREE_TYPE (TREE_TYPE (node))) */
1864 pp_wide_integer (pp
, TREE_INT_CST_LOW (node
));
1865 pp_string (pp
, "B"); /* pseudo-unit */
1867 else if (tree_fits_shwi_p (node
))
1868 pp_wide_integer (pp
, tree_to_shwi (node
));
1869 else if (tree_fits_uhwi_p (node
))
1870 pp_unsigned_wide_integer (pp
, tree_to_uhwi (node
));
1873 wide_int val
= wi::to_wide (node
);
1875 if (wi::neg_p (val
, TYPE_SIGN (TREE_TYPE (node
))))
1880 print_hex (val
, pp_buffer (pp
)->digit_buffer
);
1881 pp_string (pp
, pp_buffer (pp
)->digit_buffer
);
1883 if ((flags
& TDF_GIMPLE
)
1884 && ! (POINTER_TYPE_P (TREE_TYPE (node
))
1885 || (TYPE_PRECISION (TREE_TYPE (node
))
1886 < TYPE_PRECISION (integer_type_node
))
1887 || exact_log2 (TYPE_PRECISION (TREE_TYPE (node
))) == -1))
1889 if (TYPE_UNSIGNED (TREE_TYPE (node
)))
1890 pp_character (pp
, 'u');
1891 if (TYPE_PRECISION (TREE_TYPE (node
))
1892 == TYPE_PRECISION (unsigned_type_node
))
1894 else if (TYPE_PRECISION (TREE_TYPE (node
))
1895 == TYPE_PRECISION (long_unsigned_type_node
))
1896 pp_character (pp
, 'l');
1897 else if (TYPE_PRECISION (TREE_TYPE (node
))
1898 == TYPE_PRECISION (long_long_unsigned_type_node
))
1899 pp_string (pp
, "ll");
1901 if (TREE_OVERFLOW (node
))
1902 pp_string (pp
, "(OVF)");
1906 pp_string (pp
, "POLY_INT_CST [");
1907 dump_generic_node (pp
, POLY_INT_CST_COEFF (node
, 0), spc
, flags
, false);
1908 for (unsigned int i
= 1; i
< NUM_POLY_INT_COEFFS
; ++i
)
1910 pp_string (pp
, ", ");
1911 dump_generic_node (pp
, POLY_INT_CST_COEFF (node
, i
),
1914 pp_string (pp
, "]");
1918 /* Code copied from print_node. */
1921 if (TREE_OVERFLOW (node
))
1922 pp_string (pp
, " overflow");
1924 d
= TREE_REAL_CST (node
);
1925 if (REAL_VALUE_ISINF (d
))
1926 pp_string (pp
, REAL_VALUE_NEGATIVE (d
) ? " -Inf" : " Inf");
1927 else if (REAL_VALUE_ISNAN (d
))
1928 pp_string (pp
, " Nan");
1932 real_to_decimal (string
, &d
, sizeof (string
), 0, 1);
1933 pp_string (pp
, string
);
1941 fixed_to_decimal (string
, TREE_FIXED_CST_PTR (node
), sizeof (string
));
1942 pp_string (pp
, string
);
1947 pp_string (pp
, "__complex__ (");
1948 dump_generic_node (pp
, TREE_REALPART (node
), spc
, flags
, false);
1949 pp_string (pp
, ", ");
1950 dump_generic_node (pp
, TREE_IMAGPART (node
), spc
, flags
, false);
1951 pp_right_paren (pp
);
1956 pp_string (pp
, "\"");
1957 if (unsigned nbytes
= TREE_STRING_LENGTH (node
))
1958 pretty_print_string (pp
, TREE_STRING_POINTER (node
), nbytes
);
1959 pp_string (pp
, "\"");
1966 pp_string (pp
, "{ ");
1967 unsigned HOST_WIDE_INT nunits
;
1968 if (!VECTOR_CST_NELTS (node
).is_constant (&nunits
))
1969 nunits
= vector_cst_encoded_nelts (node
);
1970 for (i
= 0; i
< nunits
; ++i
)
1973 pp_string (pp
, ", ");
1974 dump_generic_node (pp
, VECTOR_CST_ELT (node
, i
),
1977 if (!VECTOR_CST_NELTS (node
).is_constant ())
1978 pp_string (pp
, ", ...");
1979 pp_string (pp
, " }");
1985 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1987 if (TREE_CODE (node
) == METHOD_TYPE
)
1989 if (TYPE_METHOD_BASETYPE (node
))
1990 dump_generic_node (pp
, TYPE_NAME (TYPE_METHOD_BASETYPE (node
)),
1993 pp_string (pp
, "<null method basetype>");
1994 pp_colon_colon (pp
);
1996 if (TYPE_IDENTIFIER (node
))
1997 dump_generic_node (pp
, TYPE_NAME (node
), spc
, flags
, false);
1998 else if (TYPE_NAME (node
) && DECL_NAME (TYPE_NAME (node
)))
1999 dump_decl_name (pp
, TYPE_NAME (node
), flags
);
2000 else if (flags
& TDF_NOUID
)
2001 pp_printf (pp
, "<Txxxx>");
2003 pp_printf (pp
, "<T%x>", TYPE_UID (node
));
2004 dump_function_declaration (pp
, node
, spc
, flags
);
2009 dump_decl_name (pp
, node
, flags
);
2013 if (DECL_NAME (node
))
2014 dump_decl_name (pp
, node
, flags
);
2015 else if (LABEL_DECL_UID (node
) != -1)
2017 if (flags
& TDF_GIMPLE
)
2018 pp_printf (pp
, "L%d", (int) LABEL_DECL_UID (node
));
2020 pp_printf (pp
, "<L%d>", (int) LABEL_DECL_UID (node
));
2024 if (flags
& TDF_NOUID
)
2025 pp_string (pp
, "<D.xxxx>");
2028 if (flags
& TDF_GIMPLE
)
2029 pp_printf (pp
, "<D%u>", DECL_UID (node
));
2031 pp_printf (pp
, "<D.%u>", DECL_UID (node
));
2037 if (DECL_IS_BUILTIN (node
))
2039 /* Don't print the declaration of built-in types. */
2042 if (DECL_NAME (node
))
2043 dump_decl_name (pp
, node
, flags
);
2044 else if (TYPE_NAME (TREE_TYPE (node
)) != node
)
2046 pp_string (pp
, (TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
2047 ? "union" : "struct "));
2048 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2051 pp_string (pp
, "<anon>");
2057 case DEBUG_EXPR_DECL
:
2058 case NAMESPACE_DECL
:
2060 dump_decl_name (pp
, node
, flags
);
2064 pp_string (pp
, "<retval>");
2068 op0
= TREE_OPERAND (node
, 0);
2071 && (TREE_CODE (op0
) == INDIRECT_REF
2072 || (TREE_CODE (op0
) == MEM_REF
2073 && TREE_CODE (TREE_OPERAND (op0
, 0)) != ADDR_EXPR
2074 && integer_zerop (TREE_OPERAND (op0
, 1))
2075 /* Dump the types of INTEGER_CSTs explicitly, for we
2076 can't infer them and MEM_ATTR caching will share
2077 MEM_REFs with differently-typed op0s. */
2078 && TREE_CODE (TREE_OPERAND (op0
, 0)) != INTEGER_CST
2079 /* Released SSA_NAMES have no TREE_TYPE. */
2080 && TREE_TYPE (TREE_OPERAND (op0
, 0)) != NULL_TREE
2081 /* Same pointer types, but ignoring POINTER_TYPE vs.
2083 && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 0)))
2084 == TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 1))))
2085 && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0
, 0)))
2086 == TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0
, 1))))
2087 && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0
, 0)))
2088 == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0
, 1))))
2089 /* Same value types ignoring qualifiers. */
2090 && (TYPE_MAIN_VARIANT (TREE_TYPE (op0
))
2091 == TYPE_MAIN_VARIANT
2092 (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 1)))))
2093 && MR_DEPENDENCE_CLIQUE (op0
) == 0)))
2095 op0
= TREE_OPERAND (op0
, 0);
2098 if (op_prio (op0
) < op_prio (node
))
2100 dump_generic_node (pp
, op0
, spc
, flags
, false);
2101 if (op_prio (op0
) < op_prio (node
))
2102 pp_right_paren (pp
);
2103 pp_string (pp
, str
);
2104 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2105 op0
= component_ref_field_offset (node
);
2106 if (op0
&& TREE_CODE (op0
) != INTEGER_CST
)
2108 pp_string (pp
, "{off: ");
2109 dump_generic_node (pp
, op0
, spc
, flags
, false);
2110 pp_right_brace (pp
);
2115 pp_string (pp
, "BIT_FIELD_REF <");
2116 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2117 pp_string (pp
, ", ");
2118 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2119 pp_string (pp
, ", ");
2120 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2124 case BIT_INSERT_EXPR
:
2125 pp_string (pp
, "BIT_INSERT_EXPR <");
2126 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2127 pp_string (pp
, ", ");
2128 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2129 pp_string (pp
, ", ");
2130 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2131 pp_string (pp
, " (");
2132 if (INTEGRAL_TYPE_P (TREE_TYPE (TREE_OPERAND (node
, 1))))
2134 TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (node
, 1))));
2136 dump_generic_node (pp
, TYPE_SIZE (TREE_TYPE (TREE_OPERAND (node
, 1))),
2138 pp_string (pp
, " bits)>");
2142 case ARRAY_RANGE_REF
:
2143 op0
= TREE_OPERAND (node
, 0);
2144 if (op_prio (op0
) < op_prio (node
))
2146 dump_generic_node (pp
, op0
, spc
, flags
, false);
2147 if (op_prio (op0
) < op_prio (node
))
2148 pp_right_paren (pp
);
2149 pp_left_bracket (pp
);
2150 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2151 if (TREE_CODE (node
) == ARRAY_RANGE_REF
)
2152 pp_string (pp
, " ...");
2153 pp_right_bracket (pp
);
2155 op0
= array_ref_low_bound (node
);
2156 op1
= array_ref_element_size (node
);
2158 if (!integer_zerop (op0
)
2159 || TREE_OPERAND (node
, 2)
2160 || TREE_OPERAND (node
, 3))
2162 pp_string (pp
, "{lb: ");
2163 dump_generic_node (pp
, op0
, spc
, flags
, false);
2164 pp_string (pp
, " sz: ");
2165 dump_generic_node (pp
, op1
, spc
, flags
, false);
2166 pp_right_brace (pp
);
2172 unsigned HOST_WIDE_INT ix
;
2174 bool is_struct_init
= false;
2175 bool is_array_init
= false;
2178 if (TREE_CLOBBER_P (node
))
2179 pp_string (pp
, "CLOBBER");
2180 else if (TREE_CODE (TREE_TYPE (node
)) == RECORD_TYPE
2181 || TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
)
2182 is_struct_init
= true;
2183 else if (TREE_CODE (TREE_TYPE (node
)) == ARRAY_TYPE
2184 && TYPE_DOMAIN (TREE_TYPE (node
))
2185 && TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
)))
2186 && TREE_CODE (TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
))))
2189 tree minv
= TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
)));
2190 is_array_init
= true;
2191 curidx
= wi::to_widest (minv
);
2193 FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (node
), ix
, field
, val
)
2200 dump_generic_node (pp
, field
, spc
, flags
, false);
2203 else if (is_array_init
2204 && (TREE_CODE (field
) != INTEGER_CST
2205 || curidx
!= wi::to_widest (field
)))
2207 pp_left_bracket (pp
);
2208 if (TREE_CODE (field
) == RANGE_EXPR
)
2210 dump_generic_node (pp
, TREE_OPERAND (field
, 0), spc
,
2212 pp_string (pp
, " ... ");
2213 dump_generic_node (pp
, TREE_OPERAND (field
, 1), spc
,
2215 if (TREE_CODE (TREE_OPERAND (field
, 1)) == INTEGER_CST
)
2216 curidx
= wi::to_widest (TREE_OPERAND (field
, 1));
2219 dump_generic_node (pp
, field
, spc
, flags
, false);
2220 if (TREE_CODE (field
) == INTEGER_CST
)
2221 curidx
= wi::to_widest (field
);
2222 pp_string (pp
, "]=");
2227 if (val
&& TREE_CODE (val
) == ADDR_EXPR
)
2228 if (TREE_CODE (TREE_OPERAND (val
, 0)) == FUNCTION_DECL
)
2229 val
= TREE_OPERAND (val
, 0);
2230 if (val
&& TREE_CODE (val
) == FUNCTION_DECL
)
2231 dump_decl_name (pp
, val
, flags
);
2233 dump_generic_node (pp
, val
, spc
, flags
, false);
2234 if (ix
!= CONSTRUCTOR_NELTS (node
) - 1)
2240 pp_right_brace (pp
);
2247 if (flags
& TDF_SLIM
)
2249 pp_string (pp
, "<COMPOUND_EXPR>");
2253 dump_generic_node (pp
, TREE_OPERAND (node
, 0),
2254 spc
, flags
, !(flags
& TDF_SLIM
));
2255 if (flags
& TDF_SLIM
)
2256 newline_and_indent (pp
, spc
);
2263 for (tp
= &TREE_OPERAND (node
, 1);
2264 TREE_CODE (*tp
) == COMPOUND_EXPR
;
2265 tp
= &TREE_OPERAND (*tp
, 1))
2267 dump_generic_node (pp
, TREE_OPERAND (*tp
, 0),
2268 spc
, flags
, !(flags
& TDF_SLIM
));
2269 if (flags
& TDF_SLIM
)
2270 newline_and_indent (pp
, spc
);
2278 dump_generic_node (pp
, *tp
, spc
, flags
, !(flags
& TDF_SLIM
));
2282 case STATEMENT_LIST
:
2284 tree_stmt_iterator si
;
2287 if (flags
& TDF_SLIM
)
2289 pp_string (pp
, "<STATEMENT_LIST>");
2293 for (si
= tsi_start (node
); !tsi_end_p (si
); tsi_next (&si
))
2296 newline_and_indent (pp
, spc
);
2299 dump_generic_node (pp
, tsi_stmt (si
), spc
, flags
, true);
2306 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
,
2311 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
,
2316 pp_string (pp
, "TARGET_EXPR <");
2317 dump_generic_node (pp
, TARGET_EXPR_SLOT (node
), spc
, flags
, false);
2320 dump_generic_node (pp
, TARGET_EXPR_INITIAL (node
), spc
, flags
, false);
2325 print_declaration (pp
, DECL_EXPR_DECL (node
), spc
, flags
);
2330 if (TREE_TYPE (node
) == NULL
|| TREE_TYPE (node
) == void_type_node
)
2332 pp_string (pp
, "if (");
2333 dump_generic_node (pp
, COND_EXPR_COND (node
), spc
, flags
, false);
2334 pp_right_paren (pp
);
2335 /* The lowered cond_exprs should always be printed in full. */
2336 if (COND_EXPR_THEN (node
)
2337 && (IS_EMPTY_STMT (COND_EXPR_THEN (node
))
2338 || TREE_CODE (COND_EXPR_THEN (node
)) == GOTO_EXPR
)
2339 && COND_EXPR_ELSE (node
)
2340 && (IS_EMPTY_STMT (COND_EXPR_ELSE (node
))
2341 || TREE_CODE (COND_EXPR_ELSE (node
)) == GOTO_EXPR
))
2344 dump_generic_node (pp
, COND_EXPR_THEN (node
),
2346 if (!IS_EMPTY_STMT (COND_EXPR_ELSE (node
)))
2348 pp_string (pp
, " else ");
2349 dump_generic_node (pp
, COND_EXPR_ELSE (node
),
2353 else if (!(flags
& TDF_SLIM
))
2355 /* Output COND_EXPR_THEN. */
2356 if (COND_EXPR_THEN (node
))
2358 newline_and_indent (pp
, spc
+2);
2360 newline_and_indent (pp
, spc
+4);
2361 dump_generic_node (pp
, COND_EXPR_THEN (node
), spc
+4,
2363 newline_and_indent (pp
, spc
+2);
2364 pp_right_brace (pp
);
2367 /* Output COND_EXPR_ELSE. */
2368 if (COND_EXPR_ELSE (node
)
2369 && !IS_EMPTY_STMT (COND_EXPR_ELSE (node
)))
2371 newline_and_indent (pp
, spc
);
2372 pp_string (pp
, "else");
2373 newline_and_indent (pp
, spc
+2);
2375 newline_and_indent (pp
, spc
+4);
2376 dump_generic_node (pp
, COND_EXPR_ELSE (node
), spc
+4,
2378 newline_and_indent (pp
, spc
+2);
2379 pp_right_brace (pp
);
2386 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2390 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2394 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2400 if (!(flags
& TDF_SLIM
))
2402 if (BIND_EXPR_VARS (node
))
2406 for (op0
= BIND_EXPR_VARS (node
); op0
; op0
= DECL_CHAIN (op0
))
2408 print_declaration (pp
, op0
, spc
+2, flags
);
2413 newline_and_indent (pp
, spc
+2);
2414 dump_generic_node (pp
, BIND_EXPR_BODY (node
), spc
+2, flags
, true);
2415 newline_and_indent (pp
, spc
);
2416 pp_right_brace (pp
);
2422 if (CALL_EXPR_FN (node
) != NULL_TREE
)
2423 print_call_name (pp
, CALL_EXPR_FN (node
), flags
);
2427 pp_string (pp
, internal_fn_name (CALL_EXPR_IFN (node
)));
2430 /* Print parameters. */
2435 call_expr_arg_iterator iter
;
2436 FOR_EACH_CALL_EXPR_ARG (arg
, iter
, node
)
2438 dump_generic_node (pp
, arg
, spc
, flags
, false);
2439 if (more_call_expr_args_p (&iter
))
2446 if (CALL_EXPR_VA_ARG_PACK (node
))
2448 if (call_expr_nargs (node
) > 0)
2453 pp_string (pp
, "__builtin_va_arg_pack ()");
2455 pp_right_paren (pp
);
2457 op1
= CALL_EXPR_STATIC_CHAIN (node
);
2460 pp_string (pp
, " [static-chain: ");
2461 dump_generic_node (pp
, op1
, spc
, flags
, false);
2462 pp_right_bracket (pp
);
2465 if (CALL_EXPR_RETURN_SLOT_OPT (node
))
2466 pp_string (pp
, " [return slot optimization]");
2467 if (CALL_EXPR_TAILCALL (node
))
2468 pp_string (pp
, " [tail call]");
2471 case WITH_CLEANUP_EXPR
:
2475 case CLEANUP_POINT_EXPR
:
2476 pp_string (pp
, "<<cleanup_point ");
2477 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2478 pp_string (pp
, ">>");
2481 case PLACEHOLDER_EXPR
:
2482 pp_string (pp
, "<PLACEHOLDER_EXPR ");
2483 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2487 /* Binary arithmetic and logic expressions. */
2488 case WIDEN_SUM_EXPR
:
2489 case WIDEN_MULT_EXPR
:
2491 case MULT_HIGHPART_EXPR
:
2493 case POINTER_PLUS_EXPR
:
2494 case POINTER_DIFF_EXPR
:
2496 case TRUNC_DIV_EXPR
:
2498 case FLOOR_DIV_EXPR
:
2499 case ROUND_DIV_EXPR
:
2500 case TRUNC_MOD_EXPR
:
2502 case FLOOR_MOD_EXPR
:
2503 case ROUND_MOD_EXPR
:
2505 case EXACT_DIV_EXPR
:
2510 case WIDEN_LSHIFT_EXPR
:
2514 case TRUTH_ANDIF_EXPR
:
2515 case TRUTH_ORIF_EXPR
:
2516 case TRUTH_AND_EXPR
:
2518 case TRUTH_XOR_EXPR
:
2532 case UNORDERED_EXPR
:
2534 const char *op
= op_symbol (node
);
2535 op0
= TREE_OPERAND (node
, 0);
2536 op1
= TREE_OPERAND (node
, 1);
2538 /* When the operands are expressions with less priority,
2539 keep semantics of the tree representation. */
2540 if (op_prio (op0
) <= op_prio (node
))
2543 dump_generic_node (pp
, op0
, spc
, flags
, false);
2544 pp_right_paren (pp
);
2547 dump_generic_node (pp
, op0
, spc
, flags
, false);
2553 /* When the operands are expressions with less priority,
2554 keep semantics of the tree representation. */
2555 if (op_prio (op1
) <= op_prio (node
))
2558 dump_generic_node (pp
, op1
, spc
, flags
, false);
2559 pp_right_paren (pp
);
2562 dump_generic_node (pp
, op1
, spc
, flags
, false);
2566 /* Unary arithmetic and logic expressions. */
2569 case TRUTH_NOT_EXPR
:
2571 case PREDECREMENT_EXPR
:
2572 case PREINCREMENT_EXPR
:
2574 if (TREE_CODE (node
) == ADDR_EXPR
2575 && (TREE_CODE (TREE_OPERAND (node
, 0)) == STRING_CST
2576 || TREE_CODE (TREE_OPERAND (node
, 0)) == FUNCTION_DECL
))
2577 ; /* Do not output '&' for strings and function pointers. */
2579 pp_string (pp
, op_symbol (node
));
2581 if (op_prio (TREE_OPERAND (node
, 0)) < op_prio (node
))
2584 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2585 pp_right_paren (pp
);
2588 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2591 case POSTDECREMENT_EXPR
:
2592 case POSTINCREMENT_EXPR
:
2593 if (op_prio (TREE_OPERAND (node
, 0)) < op_prio (node
))
2596 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2597 pp_right_paren (pp
);
2600 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2601 pp_string (pp
, op_symbol (node
));
2605 pp_string (pp
, "MIN_EXPR <");
2606 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2607 pp_string (pp
, ", ");
2608 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2613 pp_string (pp
, "MAX_EXPR <");
2614 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2615 pp_string (pp
, ", ");
2616 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2621 pp_string (pp
, "ABS_EXPR <");
2622 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2627 pp_string (pp
, "ABSU_EXPR <");
2628 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2636 case ADDR_SPACE_CONVERT_EXPR
:
2637 case FIXED_CONVERT_EXPR
:
2638 case FIX_TRUNC_EXPR
:
2641 type
= TREE_TYPE (node
);
2642 op0
= TREE_OPERAND (node
, 0);
2643 if (type
!= TREE_TYPE (op0
))
2646 dump_generic_node (pp
, type
, spc
, flags
, false);
2647 pp_string (pp
, ") ");
2649 if (op_prio (op0
) < op_prio (node
))
2651 dump_generic_node (pp
, op0
, spc
, flags
, false);
2652 if (op_prio (op0
) < op_prio (node
))
2653 pp_right_paren (pp
);
2656 case VIEW_CONVERT_EXPR
:
2657 pp_string (pp
, "VIEW_CONVERT_EXPR<");
2658 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2659 pp_string (pp
, ">(");
2660 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2661 pp_right_paren (pp
);
2665 pp_string (pp
, "((");
2666 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2667 pp_string (pp
, "))");
2670 case NON_LVALUE_EXPR
:
2671 pp_string (pp
, "NON_LVALUE_EXPR <");
2672 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2677 pp_string (pp
, "SAVE_EXPR <");
2678 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2683 pp_string (pp
, "COMPLEX_EXPR <");
2684 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2685 pp_string (pp
, ", ");
2686 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2691 pp_string (pp
, "CONJ_EXPR <");
2692 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2697 if (flags
& TDF_GIMPLE
)
2699 pp_string (pp
, "__real ");
2700 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2704 pp_string (pp
, "REALPART_EXPR <");
2705 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2711 if (flags
& TDF_GIMPLE
)
2713 pp_string (pp
, "__imag ");
2714 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2718 pp_string (pp
, "IMAGPART_EXPR <");
2719 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2725 pp_string (pp
, "VA_ARG_EXPR <");
2726 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2730 case TRY_FINALLY_EXPR
:
2731 case TRY_CATCH_EXPR
:
2732 pp_string (pp
, "try");
2733 newline_and_indent (pp
, spc
+2);
2735 newline_and_indent (pp
, spc
+4);
2736 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
+4, flags
, true);
2737 newline_and_indent (pp
, spc
+2);
2738 pp_right_brace (pp
);
2739 newline_and_indent (pp
, spc
);
2741 (TREE_CODE (node
) == TRY_CATCH_EXPR
) ? "catch" : "finally");
2742 newline_and_indent (pp
, spc
+2);
2744 newline_and_indent (pp
, spc
+4);
2745 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
+4, flags
, true);
2746 newline_and_indent (pp
, spc
+2);
2747 pp_right_brace (pp
);
2752 pp_string (pp
, "catch (");
2753 dump_generic_node (pp
, CATCH_TYPES (node
), spc
+2, flags
, false);
2754 pp_right_paren (pp
);
2755 newline_and_indent (pp
, spc
+2);
2757 newline_and_indent (pp
, spc
+4);
2758 dump_generic_node (pp
, CATCH_BODY (node
), spc
+4, flags
, true);
2759 newline_and_indent (pp
, spc
+2);
2760 pp_right_brace (pp
);
2764 case EH_FILTER_EXPR
:
2765 pp_string (pp
, "<<<eh_filter (");
2766 dump_generic_node (pp
, EH_FILTER_TYPES (node
), spc
+2, flags
, false);
2767 pp_string (pp
, ")>>>");
2768 newline_and_indent (pp
, spc
+2);
2770 newline_and_indent (pp
, spc
+4);
2771 dump_generic_node (pp
, EH_FILTER_FAILURE (node
), spc
+4, flags
, true);
2772 newline_and_indent (pp
, spc
+2);
2773 pp_right_brace (pp
);
2778 op0
= TREE_OPERAND (node
, 0);
2779 /* If this is for break or continue, don't bother printing it. */
2780 if (DECL_NAME (op0
))
2782 const char *name
= IDENTIFIER_POINTER (DECL_NAME (op0
));
2783 if (strcmp (name
, "break") == 0
2784 || strcmp (name
, "continue") == 0)
2787 dump_generic_node (pp
, op0
, spc
, flags
, false);
2789 if (DECL_NONLOCAL (op0
))
2790 pp_string (pp
, " [non-local]");
2794 pp_string (pp
, "while (1)");
2795 if (!(flags
& TDF_SLIM
))
2797 newline_and_indent (pp
, spc
+2);
2799 newline_and_indent (pp
, spc
+4);
2800 dump_generic_node (pp
, LOOP_EXPR_BODY (node
), spc
+4, flags
, true);
2801 newline_and_indent (pp
, spc
+2);
2802 pp_right_brace (pp
);
2808 pp_string (pp
, "// predicted ");
2809 if (PREDICT_EXPR_OUTCOME (node
))
2810 pp_string (pp
, "likely by ");
2812 pp_string (pp
, "unlikely by ");
2813 pp_string (pp
, predictor_name (PREDICT_EXPR_PREDICTOR (node
)));
2814 pp_string (pp
, " predictor.");
2818 pp_string (pp
, "ANNOTATE_EXPR <");
2819 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2820 switch ((enum annot_expr_kind
) TREE_INT_CST_LOW (TREE_OPERAND (node
, 1)))
2822 case annot_expr_ivdep_kind
:
2823 pp_string (pp
, ", ivdep");
2825 case annot_expr_unroll_kind
:
2826 pp_printf (pp
, ", unroll %d",
2827 (int) TREE_INT_CST_LOW (TREE_OPERAND (node
, 2)));
2829 case annot_expr_no_vector_kind
:
2830 pp_string (pp
, ", no-vector");
2832 case annot_expr_vector_kind
:
2833 pp_string (pp
, ", vector");
2835 case annot_expr_parallel_kind
:
2836 pp_string (pp
, ", parallel");
2845 pp_string (pp
, "return");
2846 op0
= TREE_OPERAND (node
, 0);
2850 if (TREE_CODE (op0
) == MODIFY_EXPR
)
2851 dump_generic_node (pp
, TREE_OPERAND (op0
, 1),
2854 dump_generic_node (pp
, op0
, spc
, flags
, false);
2859 pp_string (pp
, "if (");
2860 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2861 pp_string (pp
, ") break");
2865 pp_string (pp
, "switch (");
2866 dump_generic_node (pp
, SWITCH_COND (node
), spc
, flags
, false);
2867 pp_right_paren (pp
);
2868 if (!(flags
& TDF_SLIM
))
2870 newline_and_indent (pp
, spc
+2);
2872 if (SWITCH_BODY (node
))
2874 newline_and_indent (pp
, spc
+4);
2875 dump_generic_node (pp
, SWITCH_BODY (node
), spc
+4, flags
,
2878 newline_and_indent (pp
, spc
+2);
2879 pp_right_brace (pp
);
2885 op0
= GOTO_DESTINATION (node
);
2886 if (TREE_CODE (op0
) != SSA_NAME
&& DECL_P (op0
) && DECL_NAME (op0
))
2888 const char *name
= IDENTIFIER_POINTER (DECL_NAME (op0
));
2889 if (strcmp (name
, "break") == 0
2890 || strcmp (name
, "continue") == 0)
2892 pp_string (pp
, name
);
2896 pp_string (pp
, "goto ");
2897 dump_generic_node (pp
, op0
, spc
, flags
, false);
2901 pp_string (pp
, "__asm__");
2902 if (ASM_VOLATILE_P (node
))
2903 pp_string (pp
, " __volatile__");
2905 dump_generic_node (pp
, ASM_STRING (node
), spc
, flags
, false);
2907 dump_generic_node (pp
, ASM_OUTPUTS (node
), spc
, flags
, false);
2909 dump_generic_node (pp
, ASM_INPUTS (node
), spc
, flags
, false);
2910 if (ASM_CLOBBERS (node
))
2913 dump_generic_node (pp
, ASM_CLOBBERS (node
), spc
, flags
, false);
2915 pp_right_paren (pp
);
2918 case CASE_LABEL_EXPR
:
2919 if (CASE_LOW (node
) && CASE_HIGH (node
))
2921 pp_string (pp
, "case ");
2922 dump_generic_node (pp
, CASE_LOW (node
), spc
, flags
, false);
2923 pp_string (pp
, " ... ");
2924 dump_generic_node (pp
, CASE_HIGH (node
), spc
, flags
, false);
2926 else if (CASE_LOW (node
))
2928 pp_string (pp
, "case ");
2929 dump_generic_node (pp
, CASE_LOW (node
), spc
, flags
, false);
2932 pp_string (pp
, "default");
2937 pp_string (pp
, "OBJ_TYPE_REF(");
2938 dump_generic_node (pp
, OBJ_TYPE_REF_EXPR (node
), spc
, flags
, false);
2940 /* We omit the class type for -fcompare-debug because we may
2941 drop TYPE_BINFO early depending on debug info, and then
2942 virtual_method_call_p would return false, whereas when
2943 TYPE_BINFO is preserved it may still return true and then
2944 we'd print the class type. Compare tree and rtl dumps for
2945 libstdc++-prettyprinters/shared_ptr.cc with and without -g,
2946 for example, at occurrences of OBJ_TYPE_REF. */
2947 if (!(flags
& (TDF_SLIM
| TDF_COMPARE_DEBUG
))
2948 && virtual_method_call_p (node
))
2950 pp_string (pp
, "(");
2951 dump_generic_node (pp
, obj_type_ref_class (node
), spc
, flags
, false);
2952 pp_string (pp
, ")");
2954 dump_generic_node (pp
, OBJ_TYPE_REF_OBJECT (node
), spc
, flags
, false);
2956 dump_generic_node (pp
, OBJ_TYPE_REF_TOKEN (node
), spc
, flags
, false);
2957 pp_right_paren (pp
);
2961 if (SSA_NAME_IDENTIFIER (node
))
2963 if ((flags
& TDF_NOUID
)
2964 && SSA_NAME_VAR (node
)
2965 && DECL_NAMELESS (SSA_NAME_VAR (node
)))
2966 dump_fancy_name (pp
, SSA_NAME_IDENTIFIER (node
));
2967 else if (! (flags
& TDF_GIMPLE
)
2968 || SSA_NAME_VAR (node
))
2969 dump_generic_node (pp
, SSA_NAME_IDENTIFIER (node
),
2973 pp_decimal_int (pp
, SSA_NAME_VERSION (node
));
2974 if (SSA_NAME_IS_DEFAULT_DEF (node
))
2975 pp_string (pp
, "(D)");
2976 if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (node
))
2977 pp_string (pp
, "(ab)");
2980 case WITH_SIZE_EXPR
:
2981 pp_string (pp
, "WITH_SIZE_EXPR <");
2982 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2983 pp_string (pp
, ", ");
2984 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2989 pp_string (pp
, "ASSERT_EXPR <");
2990 dump_generic_node (pp
, ASSERT_EXPR_VAR (node
), spc
, flags
, false);
2991 pp_string (pp
, ", ");
2992 dump_generic_node (pp
, ASSERT_EXPR_COND (node
), spc
, flags
, false);
2997 pp_string (pp
, "scev_known");
3000 case SCEV_NOT_KNOWN
:
3001 pp_string (pp
, "scev_not_known");
3004 case POLYNOMIAL_CHREC
:
3006 dump_generic_node (pp
, CHREC_LEFT (node
), spc
, flags
, false);
3007 pp_string (pp
, ", +, ");
3008 dump_generic_node (pp
, CHREC_RIGHT (node
), spc
, flags
, false);
3009 pp_printf (pp
, "}_%u", CHREC_VARIABLE (node
));
3013 case REALIGN_LOAD_EXPR
:
3014 pp_string (pp
, "REALIGN_LOAD <");
3015 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3016 pp_string (pp
, ", ");
3017 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3018 pp_string (pp
, ", ");
3019 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3024 pp_string (pp
, " VEC_COND_EXPR < ");
3025 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3026 pp_string (pp
, " , ");
3027 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3028 pp_string (pp
, " , ");
3029 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3030 pp_string (pp
, " > ");
3034 pp_string (pp
, " VEC_PERM_EXPR < ");
3035 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3036 pp_string (pp
, " , ");
3037 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3038 pp_string (pp
, " , ");
3039 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3040 pp_string (pp
, " > ");
3044 pp_string (pp
, " DOT_PROD_EXPR < ");
3045 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3046 pp_string (pp
, ", ");
3047 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3048 pp_string (pp
, ", ");
3049 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3050 pp_string (pp
, " > ");
3053 case WIDEN_MULT_PLUS_EXPR
:
3054 pp_string (pp
, " WIDEN_MULT_PLUS_EXPR < ");
3055 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3056 pp_string (pp
, ", ");
3057 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3058 pp_string (pp
, ", ");
3059 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3060 pp_string (pp
, " > ");
3063 case WIDEN_MULT_MINUS_EXPR
:
3064 pp_string (pp
, " WIDEN_MULT_MINUS_EXPR < ");
3065 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3066 pp_string (pp
, ", ");
3067 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3068 pp_string (pp
, ", ");
3069 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3070 pp_string (pp
, " > ");
3074 pp_string (pp
, "#pragma acc parallel");
3075 goto dump_omp_clauses_body
;
3078 pp_string (pp
, "#pragma acc kernels");
3079 goto dump_omp_clauses_body
;
3082 pp_string (pp
, "#pragma acc data");
3083 dump_omp_clauses (pp
, OACC_DATA_CLAUSES (node
), spc
, flags
);
3086 case OACC_HOST_DATA
:
3087 pp_string (pp
, "#pragma acc host_data");
3088 dump_omp_clauses (pp
, OACC_HOST_DATA_CLAUSES (node
), spc
, flags
);
3092 pp_string (pp
, "#pragma acc declare");
3093 dump_omp_clauses (pp
, OACC_DECLARE_CLAUSES (node
), spc
, flags
);
3097 pp_string (pp
, "#pragma acc update");
3098 dump_omp_clauses (pp
, OACC_UPDATE_CLAUSES (node
), spc
, flags
);
3101 case OACC_ENTER_DATA
:
3102 pp_string (pp
, "#pragma acc enter data");
3103 dump_omp_clauses (pp
, OACC_ENTER_DATA_CLAUSES (node
), spc
, flags
);
3106 case OACC_EXIT_DATA
:
3107 pp_string (pp
, "#pragma acc exit data");
3108 dump_omp_clauses (pp
, OACC_EXIT_DATA_CLAUSES (node
), spc
, flags
);
3112 pp_string (pp
, "#pragma acc cache");
3113 dump_omp_clauses (pp
, OACC_CACHE_CLAUSES (node
), spc
, flags
);
3117 pp_string (pp
, "#pragma omp parallel");
3118 dump_omp_clauses (pp
, OMP_PARALLEL_CLAUSES (node
), spc
, flags
);
3121 dump_omp_clauses_body
:
3122 dump_omp_clauses (pp
, OMP_CLAUSES (node
), spc
, flags
);
3126 if (!(flags
& TDF_SLIM
) && OMP_BODY (node
))
3128 newline_and_indent (pp
, spc
+ 2);
3130 newline_and_indent (pp
, spc
+ 4);
3131 dump_generic_node (pp
, OMP_BODY (node
), spc
+ 4, flags
, false);
3132 newline_and_indent (pp
, spc
+ 2);
3133 pp_right_brace (pp
);
3139 pp_string (pp
, OMP_TASK_BODY (node
) ? "#pragma omp task"
3140 : "#pragma omp taskwait");
3141 dump_omp_clauses (pp
, OMP_TASK_CLAUSES (node
), spc
, flags
);
3145 pp_string (pp
, "#pragma omp for");
3149 pp_string (pp
, "#pragma omp simd");
3152 case OMP_DISTRIBUTE
:
3153 pp_string (pp
, "#pragma omp distribute");
3157 pp_string (pp
, "#pragma omp taskloop");
3161 pp_string (pp
, "#pragma acc loop");
3165 pp_string (pp
, "#pragma omp teams");
3166 dump_omp_clauses (pp
, OMP_TEAMS_CLAUSES (node
), spc
, flags
);
3169 case OMP_TARGET_DATA
:
3170 pp_string (pp
, "#pragma omp target data");
3171 dump_omp_clauses (pp
, OMP_TARGET_DATA_CLAUSES (node
), spc
, flags
);
3174 case OMP_TARGET_ENTER_DATA
:
3175 pp_string (pp
, "#pragma omp target enter data");
3176 dump_omp_clauses (pp
, OMP_TARGET_ENTER_DATA_CLAUSES (node
), spc
, flags
);
3180 case OMP_TARGET_EXIT_DATA
:
3181 pp_string (pp
, "#pragma omp target exit data");
3182 dump_omp_clauses (pp
, OMP_TARGET_EXIT_DATA_CLAUSES (node
), spc
, flags
);
3187 pp_string (pp
, "#pragma omp target");
3188 dump_omp_clauses (pp
, OMP_TARGET_CLAUSES (node
), spc
, flags
);
3191 case OMP_TARGET_UPDATE
:
3192 pp_string (pp
, "#pragma omp target update");
3193 dump_omp_clauses (pp
, OMP_TARGET_UPDATE_CLAUSES (node
), spc
, flags
);
3198 dump_omp_clauses (pp
, OMP_FOR_CLAUSES (node
), spc
, flags
);
3199 if (!(flags
& TDF_SLIM
))
3203 if (OMP_FOR_PRE_BODY (node
))
3205 newline_and_indent (pp
, spc
+ 2);
3208 newline_and_indent (pp
, spc
);
3209 dump_generic_node (pp
, OMP_FOR_PRE_BODY (node
),
3212 if (OMP_FOR_INIT (node
))
3215 for (i
= 0; i
< TREE_VEC_LENGTH (OMP_FOR_INIT (node
)); i
++)
3218 newline_and_indent (pp
, spc
);
3219 pp_string (pp
, "for (");
3220 dump_generic_node (pp
,
3221 TREE_VEC_ELT (OMP_FOR_INIT (node
), i
),
3223 pp_string (pp
, "; ");
3224 dump_generic_node (pp
,
3225 TREE_VEC_ELT (OMP_FOR_COND (node
), i
),
3227 pp_string (pp
, "; ");
3228 dump_generic_node (pp
,
3229 TREE_VEC_ELT (OMP_FOR_INCR (node
), i
),
3231 pp_right_paren (pp
);
3234 if (OMP_FOR_BODY (node
))
3236 newline_and_indent (pp
, spc
+ 2);
3238 newline_and_indent (pp
, spc
+ 4);
3239 dump_generic_node (pp
, OMP_FOR_BODY (node
), spc
+ 4, flags
,
3241 newline_and_indent (pp
, spc
+ 2);
3242 pp_right_brace (pp
);
3244 if (OMP_FOR_INIT (node
))
3245 spc
-= 2 * TREE_VEC_LENGTH (OMP_FOR_INIT (node
)) - 2;
3246 if (OMP_FOR_PRE_BODY (node
))
3249 newline_and_indent (pp
, spc
+ 2);
3250 pp_right_brace (pp
);
3257 pp_string (pp
, "#pragma omp sections");
3258 dump_omp_clauses (pp
, OMP_SECTIONS_CLAUSES (node
), spc
, flags
);
3262 pp_string (pp
, "#pragma omp section");
3266 pp_string (pp
, "#pragma omp master");
3270 pp_string (pp
, "#pragma omp taskgroup");
3271 dump_omp_clauses (pp
, OMP_TASKGROUP_CLAUSES (node
), spc
, flags
);
3275 pp_string (pp
, "#pragma omp ordered");
3276 dump_omp_clauses (pp
, OMP_ORDERED_CLAUSES (node
), spc
, flags
);
3280 pp_string (pp
, "#pragma omp critical");
3281 if (OMP_CRITICAL_NAME (node
))
3285 dump_generic_node (pp
, OMP_CRITICAL_NAME (node
), spc
,
3287 pp_right_paren (pp
);
3289 dump_omp_clauses (pp
, OMP_CRITICAL_CLAUSES (node
), spc
, flags
);
3293 pp_string (pp
, "#pragma omp atomic");
3294 dump_omp_atomic_memory_order (pp
, OMP_ATOMIC_MEMORY_ORDER (node
));
3295 newline_and_indent (pp
, spc
+ 2);
3296 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3300 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3303 case OMP_ATOMIC_READ
:
3304 pp_string (pp
, "#pragma omp atomic read");
3305 dump_omp_atomic_memory_order (pp
, OMP_ATOMIC_MEMORY_ORDER (node
));
3306 newline_and_indent (pp
, spc
+ 2);
3307 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3311 case OMP_ATOMIC_CAPTURE_OLD
:
3312 case OMP_ATOMIC_CAPTURE_NEW
:
3313 pp_string (pp
, "#pragma omp atomic capture");
3314 dump_omp_atomic_memory_order (pp
, OMP_ATOMIC_MEMORY_ORDER (node
));
3315 newline_and_indent (pp
, spc
+ 2);
3316 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3320 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3324 pp_string (pp
, "#pragma omp single");
3325 dump_omp_clauses (pp
, OMP_SINGLE_CLAUSES (node
), spc
, flags
);
3329 dump_omp_clause (pp
, node
, spc
, flags
);
3333 case TRANSACTION_EXPR
:
3334 if (TRANSACTION_EXPR_OUTER (node
))
3335 pp_string (pp
, "__transaction_atomic [[outer]]");
3336 else if (TRANSACTION_EXPR_RELAXED (node
))
3337 pp_string (pp
, "__transaction_relaxed");
3339 pp_string (pp
, "__transaction_atomic");
3340 if (!(flags
& TDF_SLIM
) && TRANSACTION_EXPR_BODY (node
))
3342 newline_and_indent (pp
, spc
);
3344 newline_and_indent (pp
, spc
+ 2);
3345 dump_generic_node (pp
, TRANSACTION_EXPR_BODY (node
),
3346 spc
+ 2, flags
, false);
3347 newline_and_indent (pp
, spc
);
3348 pp_right_brace (pp
);
3353 case VEC_SERIES_EXPR
:
3354 case VEC_WIDEN_MULT_HI_EXPR
:
3355 case VEC_WIDEN_MULT_LO_EXPR
:
3356 case VEC_WIDEN_MULT_EVEN_EXPR
:
3357 case VEC_WIDEN_MULT_ODD_EXPR
:
3358 case VEC_WIDEN_LSHIFT_HI_EXPR
:
3359 case VEC_WIDEN_LSHIFT_LO_EXPR
:
3361 for (str
= get_tree_code_name (code
); *str
; str
++)
3362 pp_character (pp
, TOUPPER (*str
));
3363 pp_string (pp
, " < ");
3364 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3365 pp_string (pp
, ", ");
3366 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3367 pp_string (pp
, " > ");
3370 case VEC_DUPLICATE_EXPR
:
3372 for (str
= get_tree_code_name (code
); *str
; str
++)
3373 pp_character (pp
, TOUPPER (*str
));
3374 pp_string (pp
, " < ");
3375 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3376 pp_string (pp
, " > ");
3379 case VEC_UNPACK_HI_EXPR
:
3380 pp_string (pp
, " VEC_UNPACK_HI_EXPR < ");
3381 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3382 pp_string (pp
, " > ");
3385 case VEC_UNPACK_LO_EXPR
:
3386 pp_string (pp
, " VEC_UNPACK_LO_EXPR < ");
3387 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3388 pp_string (pp
, " > ");
3391 case VEC_UNPACK_FLOAT_HI_EXPR
:
3392 pp_string (pp
, " VEC_UNPACK_FLOAT_HI_EXPR < ");
3393 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3394 pp_string (pp
, " > ");
3397 case VEC_UNPACK_FLOAT_LO_EXPR
:
3398 pp_string (pp
, " VEC_UNPACK_FLOAT_LO_EXPR < ");
3399 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3400 pp_string (pp
, " > ");
3403 case VEC_UNPACK_FIX_TRUNC_HI_EXPR
:
3404 pp_string (pp
, " VEC_UNPACK_FIX_TRUNC_HI_EXPR < ");
3405 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3406 pp_string (pp
, " > ");
3409 case VEC_UNPACK_FIX_TRUNC_LO_EXPR
:
3410 pp_string (pp
, " VEC_UNPACK_FIX_TRUNC_LO_EXPR < ");
3411 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3412 pp_string (pp
, " > ");
3415 case VEC_PACK_TRUNC_EXPR
:
3416 pp_string (pp
, " VEC_PACK_TRUNC_EXPR < ");
3417 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3418 pp_string (pp
, ", ");
3419 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3420 pp_string (pp
, " > ");
3423 case VEC_PACK_SAT_EXPR
:
3424 pp_string (pp
, " VEC_PACK_SAT_EXPR < ");
3425 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3426 pp_string (pp
, ", ");
3427 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3428 pp_string (pp
, " > ");
3431 case VEC_PACK_FIX_TRUNC_EXPR
:
3432 pp_string (pp
, " VEC_PACK_FIX_TRUNC_EXPR < ");
3433 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3434 pp_string (pp
, ", ");
3435 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3436 pp_string (pp
, " > ");
3439 case VEC_PACK_FLOAT_EXPR
:
3440 pp_string (pp
, " VEC_PACK_FLOAT_EXPR < ");
3441 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3442 pp_string (pp
, ", ");
3443 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3444 pp_string (pp
, " > ");
3448 dump_block_node (pp
, node
, spc
, flags
);
3451 case DEBUG_BEGIN_STMT
:
3452 pp_string (pp
, "# DEBUG BEGIN STMT");
3459 if (is_stmt
&& is_expr
)
3465 /* Print the declaration of a variable. */
3468 print_declaration (pretty_printer
*pp
, tree t
, int spc
, dump_flags_t flags
)
3472 if (TREE_CODE(t
) == NAMELIST_DECL
)
3474 pp_string(pp
, "namelist ");
3475 dump_decl_name (pp
, t
, flags
);
3480 if (TREE_CODE (t
) == TYPE_DECL
)
3481 pp_string (pp
, "typedef ");
3483 if (CODE_CONTAINS_STRUCT (TREE_CODE (t
), TS_DECL_WRTL
) && DECL_REGISTER (t
))
3484 pp_string (pp
, "register ");
3486 if (TREE_PUBLIC (t
) && DECL_EXTERNAL (t
))
3487 pp_string (pp
, "extern ");
3488 else if (TREE_STATIC (t
))
3489 pp_string (pp
, "static ");
3491 /* Print the type and name. */
3492 if (TREE_TYPE (t
) && TREE_CODE (TREE_TYPE (t
)) == ARRAY_TYPE
)
3496 /* Print array's type. */
3497 tmp
= TREE_TYPE (t
);
3498 while (TREE_CODE (TREE_TYPE (tmp
)) == ARRAY_TYPE
)
3499 tmp
= TREE_TYPE (tmp
);
3500 dump_generic_node (pp
, TREE_TYPE (tmp
), spc
, flags
, false);
3502 /* Print variable's name. */
3504 dump_generic_node (pp
, t
, spc
, flags
, false);
3506 /* Print the dimensions. */
3507 tmp
= TREE_TYPE (t
);
3508 while (TREE_CODE (tmp
) == ARRAY_TYPE
)
3510 dump_array_domain (pp
, TYPE_DOMAIN (tmp
), spc
, flags
);
3511 tmp
= TREE_TYPE (tmp
);
3514 else if (TREE_CODE (t
) == FUNCTION_DECL
)
3516 dump_generic_node (pp
, TREE_TYPE (TREE_TYPE (t
)), spc
, flags
, false);
3518 dump_decl_name (pp
, t
, flags
);
3519 dump_function_declaration (pp
, TREE_TYPE (t
), spc
, flags
);
3523 /* Print type declaration. */
3524 dump_generic_node (pp
, TREE_TYPE (t
), spc
, flags
, false);
3526 /* Print variable's name. */
3528 dump_generic_node (pp
, t
, spc
, flags
, false);
3531 if (VAR_P (t
) && DECL_HARD_REGISTER (t
))
3533 pp_string (pp
, " __asm__ ");
3535 dump_generic_node (pp
, DECL_ASSEMBLER_NAME (t
), spc
, flags
, false);
3536 pp_right_paren (pp
);
3539 /* The initial value of a function serves to determine whether the function
3540 is declared or defined. So the following does not apply to function
3542 if (TREE_CODE (t
) != FUNCTION_DECL
)
3544 /* Print the initial value. */
3545 if (DECL_INITIAL (t
))
3550 if (!(flags
& TDF_SLIM
))
3551 dump_generic_node (pp
, DECL_INITIAL (t
), spc
, flags
, false);
3553 pp_string (pp
, "<<< omitted >>>");
3557 if (VAR_P (t
) && DECL_HAS_VALUE_EXPR_P (t
))
3559 pp_string (pp
, " [value-expr: ");
3560 dump_generic_node (pp
, DECL_VALUE_EXPR (t
), spc
, flags
, false);
3561 pp_right_bracket (pp
);
3568 /* Prints a structure: name, fields, and methods.
3569 FIXME: Still incomplete. */
3572 print_struct_decl (pretty_printer
*pp
, const_tree node
, int spc
,
3575 /* Print the name of the structure. */
3576 if (TYPE_NAME (node
))
3579 if (TREE_CODE (node
) == RECORD_TYPE
)
3580 pp_string (pp
, "struct ");
3581 else if ((TREE_CODE (node
) == UNION_TYPE
3582 || TREE_CODE (node
) == QUAL_UNION_TYPE
))
3583 pp_string (pp
, "union ");
3585 dump_generic_node (pp
, TYPE_NAME (node
), spc
, TDF_NONE
, false);
3588 /* Print the contents of the structure. */
3594 /* Print the fields of the structure. */
3597 tmp
= TYPE_FIELDS (node
);
3600 /* Avoid to print recursively the structure. */
3601 /* FIXME : Not implemented correctly...,
3602 what about the case when we have a cycle in the contain graph? ...
3603 Maybe this could be solved by looking at the scope in which the
3604 structure was declared. */
3605 if (TREE_TYPE (tmp
) != node
3606 && (TREE_CODE (TREE_TYPE (tmp
)) != POINTER_TYPE
3607 || TREE_TYPE (TREE_TYPE (tmp
)) != node
))
3609 print_declaration (pp
, tmp
, spc
+2, flags
);
3612 tmp
= DECL_CHAIN (tmp
);
3616 pp_right_brace (pp
);
3619 /* Return the priority of the operator CODE.
3621 From lowest to highest precedence with either left-to-right (L-R)
3622 or right-to-left (R-L) associativity]:
3625 2 [R-L] = += -= *= /= %= &= ^= |= <<= >>=
3637 14 [R-L] ! ~ ++ -- + - * & (type) sizeof
3638 15 [L-R] fn() [] -> .
3640 unary +, - and * have higher precedence than the corresponding binary
3644 op_code_prio (enum tree_code code
)
3661 case TRUTH_ORIF_EXPR
:
3664 case TRUTH_AND_EXPR
:
3665 case TRUTH_ANDIF_EXPR
:
3672 case TRUTH_XOR_EXPR
:
3689 case UNORDERED_EXPR
:
3700 case VEC_WIDEN_LSHIFT_HI_EXPR
:
3701 case VEC_WIDEN_LSHIFT_LO_EXPR
:
3702 case WIDEN_LSHIFT_EXPR
:
3705 case WIDEN_SUM_EXPR
:
3707 case POINTER_PLUS_EXPR
:
3708 case POINTER_DIFF_EXPR
:
3712 case VEC_WIDEN_MULT_HI_EXPR
:
3713 case VEC_WIDEN_MULT_LO_EXPR
:
3714 case WIDEN_MULT_EXPR
:
3716 case WIDEN_MULT_PLUS_EXPR
:
3717 case WIDEN_MULT_MINUS_EXPR
:
3719 case MULT_HIGHPART_EXPR
:
3720 case TRUNC_DIV_EXPR
:
3722 case FLOOR_DIV_EXPR
:
3723 case ROUND_DIV_EXPR
:
3725 case EXACT_DIV_EXPR
:
3726 case TRUNC_MOD_EXPR
:
3728 case FLOOR_MOD_EXPR
:
3729 case ROUND_MOD_EXPR
:
3732 case TRUTH_NOT_EXPR
:
3734 case POSTINCREMENT_EXPR
:
3735 case POSTDECREMENT_EXPR
:
3736 case PREINCREMENT_EXPR
:
3737 case PREDECREMENT_EXPR
:
3743 case FIX_TRUNC_EXPR
:
3749 case ARRAY_RANGE_REF
:
3753 /* Special expressions. */
3759 case VEC_UNPACK_HI_EXPR
:
3760 case VEC_UNPACK_LO_EXPR
:
3761 case VEC_UNPACK_FLOAT_HI_EXPR
:
3762 case VEC_UNPACK_FLOAT_LO_EXPR
:
3763 case VEC_UNPACK_FIX_TRUNC_HI_EXPR
:
3764 case VEC_UNPACK_FIX_TRUNC_LO_EXPR
:
3765 case VEC_PACK_TRUNC_EXPR
:
3766 case VEC_PACK_SAT_EXPR
:
3770 /* Return an arbitrarily high precedence to avoid surrounding single
3771 VAR_DECLs in ()s. */
3776 /* Return the priority of the operator OP. */
3779 op_prio (const_tree op
)
3781 enum tree_code code
;
3786 code
= TREE_CODE (op
);
3787 if (code
== SAVE_EXPR
|| code
== NON_LVALUE_EXPR
)
3788 return op_prio (TREE_OPERAND (op
, 0));
3790 return op_code_prio (code
);
3793 /* Return the symbol associated with operator CODE. */
3796 op_symbol_code (enum tree_code code
)
3804 case TRUTH_ORIF_EXPR
:
3807 case TRUTH_AND_EXPR
:
3808 case TRUTH_ANDIF_EXPR
:
3814 case TRUTH_XOR_EXPR
:
3824 case UNORDERED_EXPR
:
3870 case WIDEN_LSHIFT_EXPR
:
3873 case POINTER_PLUS_EXPR
:
3879 case WIDEN_SUM_EXPR
:
3882 case WIDEN_MULT_EXPR
:
3885 case MULT_HIGHPART_EXPR
:
3890 case POINTER_DIFF_EXPR
:
3896 case TRUTH_NOT_EXPR
:
3903 case TRUNC_DIV_EXPR
:
3910 case FLOOR_DIV_EXPR
:
3913 case ROUND_DIV_EXPR
:
3916 case EXACT_DIV_EXPR
:
3919 case TRUNC_MOD_EXPR
:
3925 case FLOOR_MOD_EXPR
:
3928 case ROUND_MOD_EXPR
:
3931 case PREDECREMENT_EXPR
:
3934 case PREINCREMENT_EXPR
:
3937 case POSTDECREMENT_EXPR
:
3940 case POSTINCREMENT_EXPR
:
3950 return "<<< ??? >>>";
3954 /* Return the symbol associated with operator OP. */
3957 op_symbol (const_tree op
)
3959 return op_symbol_code (TREE_CODE (op
));
3962 /* Prints the name of a call. NODE is the CALL_EXPR_FN of a CALL_EXPR or
3963 the gimple_call_fn of a GIMPLE_CALL. */
3966 print_call_name (pretty_printer
*pp
, tree node
, dump_flags_t flags
)
3970 if (TREE_CODE (op0
) == NON_LVALUE_EXPR
)
3971 op0
= TREE_OPERAND (op0
, 0);
3974 switch (TREE_CODE (op0
))
3979 dump_function_name (pp
, op0
, flags
);
3985 op0
= TREE_OPERAND (op0
, 0);
3990 dump_generic_node (pp
, TREE_OPERAND (op0
, 0), 0, flags
, false);
3991 pp_string (pp
, ") ? ");
3992 dump_generic_node (pp
, TREE_OPERAND (op0
, 1), 0, flags
, false);
3993 pp_string (pp
, " : ");
3994 dump_generic_node (pp
, TREE_OPERAND (op0
, 2), 0, flags
, false);
3998 if (TREE_CODE (TREE_OPERAND (op0
, 0)) == VAR_DECL
)
3999 dump_function_name (pp
, TREE_OPERAND (op0
, 0), flags
);
4001 dump_generic_node (pp
, op0
, 0, flags
, false);
4005 if (integer_zerop (TREE_OPERAND (op0
, 1)))
4007 op0
= TREE_OPERAND (op0
, 0);
4014 dump_generic_node (pp
, op0
, 0, flags
, false);
4022 /* Print the first N characters in the array STR, replacing non-printable
4023 characters (including embedded nuls) with unambiguous escape sequences. */
4026 pretty_print_string (pretty_printer
*pp
, const char *str
, unsigned n
)
4031 for ( ; n
; --n
, ++str
)
4036 pp_string (pp
, "\\b");
4040 pp_string (pp
, "\\f");
4044 pp_string (pp
, "\\n");
4048 pp_string (pp
, "\\r");
4052 pp_string (pp
, "\\t");
4056 pp_string (pp
, "\\v");
4060 pp_string (pp
, "\\\\");
4064 pp_string (pp
, "\\\"");
4068 pp_string (pp
, "\\'");
4072 if (str
[0] || n
> 1)
4074 if (!ISPRINT (str
[0]))
4077 sprintf (buf
, "\\x%02x", (unsigned char)str
[0]);
4078 pp_string (pp
, buf
);
4081 pp_character (pp
, str
[0]);
4089 maybe_init_pretty_print (FILE *file
)
4093 tree_pp
= new pretty_printer ();
4094 pp_needs_newline (tree_pp
) = true;
4095 pp_translate_identifiers (tree_pp
) = false;
4098 tree_pp
->buffer
->stream
= file
;
4102 newline_and_indent (pretty_printer
*pp
, int spc
)
4108 /* Handle the %K format for TEXT. Separate from default_tree_printer
4109 so it can also be used in front ends.
4110 The location LOC and BLOCK are expected to be extracted by the caller
4111 from the %K argument arg via EXPR_LOCATION(arg) and TREE_BLOCK(arg). */
4114 percent_K_format (text_info
*text
, location_t loc
, tree block
)
4116 text
->set_location (0, loc
, SHOW_RANGE_WITH_CARET
);
4117 gcc_assert (pp_ti_abstract_origin (text
) != NULL
);
4118 *pp_ti_abstract_origin (text
) = NULL
;
4121 && TREE_CODE (block
) == BLOCK
4122 && BLOCK_ABSTRACT_ORIGIN (block
))
4124 tree ao
= BLOCK_ABSTRACT_ORIGIN (block
);
4125 if (TREE_CODE (ao
) == FUNCTION_DECL
)
4127 *pp_ti_abstract_origin (text
) = block
;
4130 block
= BLOCK_SUPERCONTEXT (block
);
4134 /* Print the identifier ID to PRETTY-PRINTER. */
4137 pp_tree_identifier (pretty_printer
*pp
, tree id
)
4139 if (pp_translate_identifiers (pp
))
4141 const char *text
= identifier_to_locale (IDENTIFIER_POINTER (id
));
4142 pp_append_text (pp
, text
, text
+ strlen (text
));
4145 pp_append_text (pp
, IDENTIFIER_POINTER (id
),
4146 IDENTIFIER_POINTER (id
) + IDENTIFIER_LENGTH (id
));
4149 /* A helper function that is used to dump function information before the
4153 dump_function_header (FILE *dump_file
, tree fdecl
, dump_flags_t flags
)
4155 const char *dname
, *aname
;
4156 struct cgraph_node
*node
= cgraph_node::get (fdecl
);
4157 struct function
*fun
= DECL_STRUCT_FUNCTION (fdecl
);
4159 dname
= lang_hooks
.decl_printable_name (fdecl
, 1);
4161 if (DECL_ASSEMBLER_NAME_SET_P (fdecl
))
4162 aname
= (IDENTIFIER_POINTER
4163 (DECL_ASSEMBLER_NAME (fdecl
)));
4165 aname
= "<unset-asm-name>";
4167 fprintf (dump_file
, "\n;; Function %s (%s, funcdef_no=%d",
4168 dname
, aname
, fun
->funcdef_no
);
4169 if (!(flags
& TDF_NOUID
))
4170 fprintf (dump_file
, ", decl_uid=%d", DECL_UID (fdecl
));
4173 fprintf (dump_file
, ", cgraph_uid=%d", node
->get_uid ());
4174 fprintf (dump_file
, ", symbol_order=%d)%s\n\n", node
->order
,
4175 node
->frequency
== NODE_FREQUENCY_HOT
4177 : node
->frequency
== NODE_FREQUENCY_UNLIKELY_EXECUTED
4178 ? " (unlikely executed)"
4179 : node
->frequency
== NODE_FREQUENCY_EXECUTED_ONCE
4180 ? " (executed once)"
4184 fprintf (dump_file
, ")\n\n");
4187 /* Dump double_int D to pretty_printer PP. UNS is true
4188 if D is unsigned and false otherwise. */
4190 pp_double_int (pretty_printer
*pp
, double_int d
, bool uns
)
4193 pp_wide_integer (pp
, d
.low
);
4194 else if (d
.fits_uhwi ())
4195 pp_unsigned_wide_integer (pp
, d
.low
);
4198 unsigned HOST_WIDE_INT low
= d
.low
;
4199 HOST_WIDE_INT high
= d
.high
;
4200 if (!uns
&& d
.is_negative ())
4203 high
= ~high
+ !low
;
4206 /* Would "%x%0*x" or "%x%*0x" get zero-padding on all
4208 sprintf (pp_buffer (pp
)->digit_buffer
,
4209 HOST_WIDE_INT_PRINT_DOUBLE_HEX
,
4210 (unsigned HOST_WIDE_INT
) high
, low
);
4211 pp_string (pp
, pp_buffer (pp
)->digit_buffer
);