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"
37 #include "fold-const.h"
39 /* Disable warnings about quoting issues in the pp_xxx calls below
40 that (intentionally) don't follow GCC diagnostic conventions. */
42 # pragma GCC diagnostic push
43 # pragma GCC diagnostic ignored "-Wformat-diag"
46 /* Local functions, macros and variables. */
47 static const char *op_symbol (const_tree
);
48 static void pretty_print_string (pretty_printer
*, const char*, unsigned);
49 static void newline_and_indent (pretty_printer
*, int);
50 static void maybe_init_pretty_print (FILE *);
51 static void print_struct_decl (pretty_printer
*, const_tree
, int, dump_flags_t
);
52 static void do_niy (pretty_printer
*, const_tree
, dump_flags_t
);
54 #define INDENT(SPACE) do { \
55 int i; for (i = 0; i<SPACE; i++) pp_space (pp); } while (0)
57 #define NIY do_niy (pp, node, flags)
59 static pretty_printer
*tree_pp
;
61 /* Try to print something for an unknown tree code. */
64 do_niy (pretty_printer
*pp
, const_tree node
, dump_flags_t flags
)
68 pp_string (pp
, "<<< Unknown tree: ");
69 pp_string (pp
, get_tree_code_name (TREE_CODE (node
)));
73 len
= TREE_OPERAND_LENGTH (node
);
74 for (i
= 0; i
< len
; ++i
)
76 newline_and_indent (pp
, 2);
77 dump_generic_node (pp
, TREE_OPERAND (node
, i
), 2, flags
, false);
81 pp_string (pp
, " >>>");
84 /* Debugging function to print out a generic expression. */
87 debug_generic_expr (tree t
)
89 print_generic_expr (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
);
90 fprintf (stderr
, "\n");
93 /* Debugging function to print out a generic statement. */
96 debug_generic_stmt (tree t
)
98 print_generic_stmt (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
);
99 fprintf (stderr
, "\n");
102 /* Debugging function to print out a chain of trees . */
105 debug_tree_chain (tree t
)
111 print_generic_expr (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
|TDF_UID
);
112 fprintf (stderr
, " ");
116 fprintf (stderr
, "... [cycled back to ");
117 print_generic_expr (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
|TDF_UID
);
118 fprintf (stderr
, "]");
122 fprintf (stderr
, "\n");
125 /* Prints declaration DECL to the FILE with details specified by FLAGS. */
127 print_generic_decl (FILE *file
, tree decl
, dump_flags_t flags
)
129 maybe_init_pretty_print (file
);
130 print_declaration (tree_pp
, decl
, 2, flags
);
131 pp_write_text_to_stream (tree_pp
);
134 /* Print tree T, and its successors, on file FILE. FLAGS specifies details
135 to show in the dump. See TDF_* in dumpfile.h. */
138 print_generic_stmt (FILE *file
, tree t
, dump_flags_t flags
)
140 maybe_init_pretty_print (file
);
141 dump_generic_node (tree_pp
, t
, 0, flags
, true);
142 pp_newline_and_flush (tree_pp
);
145 /* Print tree T, and its successors, on file FILE. FLAGS specifies details
146 to show in the dump. See TDF_* in dumpfile.h. The output is indented by
150 print_generic_stmt_indented (FILE *file
, tree t
, dump_flags_t flags
, int indent
)
154 maybe_init_pretty_print (file
);
156 for (i
= 0; i
< indent
; i
++)
158 dump_generic_node (tree_pp
, t
, indent
, flags
, true);
159 pp_newline_and_flush (tree_pp
);
162 /* Print a single expression T on file FILE. FLAGS specifies details to show
163 in the dump. See TDF_* in dumpfile.h. */
166 print_generic_expr (FILE *file
, tree t
, dump_flags_t flags
)
168 maybe_init_pretty_print (file
);
169 dump_generic_node (tree_pp
, t
, 0, flags
, false);
173 /* Print a single expression T to string, and return it. */
176 print_generic_expr_to_str (tree t
)
179 dump_generic_node (&pp
, t
, 0, TDF_VOPS
|TDF_MEMSYMS
, false);
180 return xstrdup (pp_formatted_text (&pp
));
183 /* Dump NAME, an IDENTIFIER_POINTER, sanitized so that D<num> sequences
184 in it are replaced with Dxxxx, as long as they are at the start or
185 preceded by $ and at the end or followed by $. See make_fancy_name
189 dump_fancy_name (pretty_printer
*pp
, tree name
)
192 int length
= IDENTIFIER_LENGTH (name
);
193 const char *n
= IDENTIFIER_POINTER (name
);
200 && (n
== IDENTIFIER_POINTER (name
) || n
[-1] == '$'))
203 while (ISDIGIT (n
[l
]))
205 if (n
[l
] == '\0' || n
[l
] == '$')
218 pp_tree_identifier (pp
, name
);
222 char *str
= XNEWVEC (char, length
+ 1);
225 q
= n
= IDENTIFIER_POINTER (name
);
232 && (q
== IDENTIFIER_POINTER (name
) || q
[-1] == '$'))
235 while (ISDIGIT (q
[l
]))
237 if (q
[l
] == '\0' || q
[l
] == '$')
239 memcpy (p
, n
, q
- n
);
240 memcpy (p
+ (q
- n
), "Dxxxx", 5);
250 memcpy (p
, n
, IDENTIFIER_LENGTH (name
) - (n
- IDENTIFIER_POINTER (name
)));
252 if (pp_translate_identifiers (pp
))
254 const char *text
= identifier_to_locale (str
);
255 pp_append_text (pp
, text
, text
+ strlen (text
));
258 pp_append_text (pp
, str
, str
+ length
);
262 /* Dump the name of a _DECL node and its DECL_UID if TDF_UID is set
266 dump_decl_name (pretty_printer
*pp
, tree node
, dump_flags_t flags
)
268 tree name
= DECL_NAME (node
);
271 if ((flags
& TDF_ASMNAME
)
272 && HAS_DECL_ASSEMBLER_NAME_P (node
)
273 && DECL_ASSEMBLER_NAME_SET_P (node
))
274 pp_tree_identifier (pp
, DECL_ASSEMBLER_NAME_RAW (node
));
275 /* For -fcompare-debug don't dump DECL_NAMELESS names at all,
276 -g might have created more fancy names and their indexes
277 could get out of sync. Usually those should be DECL_IGNORED_P
278 too, SRA can create even non-DECL_IGNORED_P DECL_NAMELESS fancy
279 names, let's hope those never get out of sync after doing the
280 dump_fancy_name sanitization. */
281 else if ((flags
& TDF_COMPARE_DEBUG
)
282 && DECL_NAMELESS (node
)
283 && DECL_IGNORED_P (node
))
285 /* For DECL_NAMELESS names look for embedded uids in the
286 names and sanitize them for TDF_NOUID. */
287 else if ((flags
& TDF_NOUID
) && DECL_NAMELESS (node
))
288 dump_fancy_name (pp
, name
);
290 pp_tree_identifier (pp
, name
);
292 char uid_sep
= (flags
& TDF_GIMPLE
) ? '_' : '.';
293 if ((flags
& TDF_UID
) || name
== NULL_TREE
)
295 if (TREE_CODE (node
) == LABEL_DECL
&& LABEL_DECL_UID (node
) != -1)
296 pp_printf (pp
, "L%c%d", uid_sep
, (int) LABEL_DECL_UID (node
));
297 else if (TREE_CODE (node
) == DEBUG_EXPR_DECL
)
299 if (flags
& TDF_NOUID
)
300 pp_string (pp
, "D#xxxx");
302 pp_printf (pp
, "D#%i", DEBUG_TEMP_UID (node
));
306 char c
= TREE_CODE (node
) == CONST_DECL
? 'C' : 'D';
307 if (flags
& TDF_NOUID
)
308 pp_printf (pp
, "%c.xxxx", c
);
310 pp_printf (pp
, "%c%c%u", c
, uid_sep
, DECL_UID (node
));
313 if ((flags
& TDF_ALIAS
) && DECL_PT_UID (node
) != DECL_UID (node
))
315 if (flags
& TDF_NOUID
)
316 pp_printf (pp
, "ptD.xxxx");
318 pp_printf (pp
, "ptD.%u", DECL_PT_UID (node
));
322 /* Like the above, but used for pretty printing function calls. */
325 dump_function_name (pretty_printer
*pp
, tree node
, dump_flags_t flags
)
327 if (CONVERT_EXPR_P (node
))
328 node
= TREE_OPERAND (node
, 0);
329 if (DECL_NAME (node
) && (flags
& TDF_ASMNAME
) == 0)
330 pp_string (pp
, lang_hooks
.decl_printable_name (node
, 1));
332 dump_decl_name (pp
, node
, flags
);
335 /* Dump a function declaration. NODE is the FUNCTION_TYPE. PP, SPC and
336 FLAGS are as in dump_generic_node. */
339 dump_function_declaration (pretty_printer
*pp
, tree node
,
340 int spc
, dump_flags_t flags
)
342 bool wrote_arg
= false;
348 /* Print the argument types. */
349 arg
= TYPE_ARG_TYPES (node
);
350 while (arg
&& arg
!= void_list_node
&& arg
!= error_mark_node
)
358 dump_generic_node (pp
, TREE_VALUE (arg
), spc
, flags
, false);
359 arg
= TREE_CHAIN (arg
);
362 /* Drop the trailing void_type_node if we had any previous argument. */
363 if (arg
== void_list_node
&& !wrote_arg
)
364 pp_string (pp
, "void");
365 /* Properly dump vararg function types. */
366 else if (!arg
&& wrote_arg
)
367 pp_string (pp
, ", ...");
368 /* Avoid printing any arg for unprototyped functions. */
373 /* Dump the domain associated with an array. */
376 dump_array_domain (pretty_printer
*pp
, tree domain
, int spc
, dump_flags_t flags
)
378 pp_left_bracket (pp
);
381 tree min
= TYPE_MIN_VALUE (domain
);
382 tree max
= TYPE_MAX_VALUE (domain
);
385 && integer_zerop (min
)
386 && tree_fits_shwi_p (max
))
387 pp_wide_integer (pp
, tree_to_shwi (max
) + 1);
391 dump_generic_node (pp
, min
, spc
, flags
, false);
394 dump_generic_node (pp
, max
, spc
, flags
, false);
398 pp_string (pp
, "<unknown>");
399 pp_right_bracket (pp
);
403 /* Dump OpenMP iterators ITER. */
406 dump_omp_iterators (pretty_printer
*pp
, tree iter
, int spc
, dump_flags_t flags
)
408 pp_string (pp
, "iterator(");
409 for (tree it
= iter
; it
; it
= TREE_CHAIN (it
))
412 pp_string (pp
, ", ");
413 dump_generic_node (pp
, TREE_TYPE (TREE_VEC_ELT (it
, 0)), spc
, flags
,
416 dump_generic_node (pp
, TREE_VEC_ELT (it
, 0), spc
, flags
, false);
418 dump_generic_node (pp
, TREE_VEC_ELT (it
, 1), spc
, flags
, false);
420 dump_generic_node (pp
, TREE_VEC_ELT (it
, 2), spc
, flags
, false);
422 dump_generic_node (pp
, TREE_VEC_ELT (it
, 3), spc
, flags
, false);
428 /* Dump OpenMP clause CLAUSE. PP, CLAUSE, SPC and FLAGS are as in
429 dump_generic_node. */
432 dump_omp_clause (pretty_printer
*pp
, tree clause
, int spc
, dump_flags_t flags
)
436 switch (OMP_CLAUSE_CODE (clause
))
438 case OMP_CLAUSE_PRIVATE
:
441 case OMP_CLAUSE_SHARED
:
444 case OMP_CLAUSE_FIRSTPRIVATE
:
445 name
= "firstprivate";
447 case OMP_CLAUSE_LASTPRIVATE
:
448 name
= "lastprivate";
449 if (!OMP_CLAUSE_LASTPRIVATE_CONDITIONAL (clause
))
451 pp_string (pp
, "lastprivate(conditional:");
452 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
456 case OMP_CLAUSE_COPYIN
:
459 case OMP_CLAUSE_COPYPRIVATE
:
460 name
= "copyprivate";
462 case OMP_CLAUSE_UNIFORM
:
465 case OMP_CLAUSE_USE_DEVICE_PTR
:
466 name
= "use_device_ptr";
468 case OMP_CLAUSE_USE_DEVICE_ADDR
:
469 name
= "use_device_addr";
471 case OMP_CLAUSE_IS_DEVICE_PTR
:
472 name
= "is_device_ptr";
474 case OMP_CLAUSE_INCLUSIVE
:
477 case OMP_CLAUSE_EXCLUSIVE
:
480 case OMP_CLAUSE__LOOPTEMP_
:
483 case OMP_CLAUSE__REDUCTEMP_
:
484 name
= "_reductemp_";
486 case OMP_CLAUSE__CONDTEMP_
:
489 case OMP_CLAUSE__SCANTEMP_
:
492 case OMP_CLAUSE_TO_DECLARE
:
495 case OMP_CLAUSE_LINK
:
498 case OMP_CLAUSE_NONTEMPORAL
:
499 name
= "nontemporal";
502 pp_string (pp
, name
);
504 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
509 case OMP_CLAUSE_TASK_REDUCTION
:
510 case OMP_CLAUSE_IN_REDUCTION
:
511 pp_string (pp
, OMP_CLAUSE_CODE (clause
) == OMP_CLAUSE_IN_REDUCTION
514 case OMP_CLAUSE_REDUCTION
:
515 pp_string (pp
, "reduction(");
516 if (OMP_CLAUSE_CODE (clause
) == OMP_CLAUSE_REDUCTION
)
518 if (OMP_CLAUSE_REDUCTION_TASK (clause
))
519 pp_string (pp
, "task,");
520 else if (OMP_CLAUSE_REDUCTION_INSCAN (clause
))
521 pp_string (pp
, "inscan,");
523 if (OMP_CLAUSE_REDUCTION_CODE (clause
) != ERROR_MARK
)
526 op_symbol_code (OMP_CLAUSE_REDUCTION_CODE (clause
)));
529 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
535 pp_string (pp
, "if(");
536 switch (OMP_CLAUSE_IF_MODIFIER (clause
))
538 case ERROR_MARK
: break;
539 case VOID_CST
: pp_string (pp
, "cancel:"); break;
540 case OMP_PARALLEL
: pp_string (pp
, "parallel:"); break;
541 case OMP_SIMD
: pp_string (pp
, "simd:"); break;
542 case OMP_TASK
: pp_string (pp
, "task:"); break;
543 case OMP_TASKLOOP
: pp_string (pp
, "taskloop:"); break;
544 case OMP_TARGET_DATA
: pp_string (pp
, "target data:"); break;
545 case OMP_TARGET
: pp_string (pp
, "target:"); break;
546 case OMP_TARGET_UPDATE
: pp_string (pp
, "target update:"); break;
547 case OMP_TARGET_ENTER_DATA
:
548 pp_string (pp
, "target enter data:"); break;
549 case OMP_TARGET_EXIT_DATA
: pp_string (pp
, "target exit data:"); break;
550 default: gcc_unreachable ();
552 dump_generic_node (pp
, OMP_CLAUSE_IF_EXPR (clause
),
557 case OMP_CLAUSE_NUM_THREADS
:
558 pp_string (pp
, "num_threads(");
559 dump_generic_node (pp
, OMP_CLAUSE_NUM_THREADS_EXPR (clause
),
564 case OMP_CLAUSE_NOWAIT
:
565 pp_string (pp
, "nowait");
567 case OMP_CLAUSE_ORDERED
:
568 pp_string (pp
, "ordered");
569 if (OMP_CLAUSE_ORDERED_EXPR (clause
))
572 dump_generic_node (pp
, OMP_CLAUSE_ORDERED_EXPR (clause
),
578 case OMP_CLAUSE_DEFAULT
:
579 pp_string (pp
, "default(");
580 switch (OMP_CLAUSE_DEFAULT_KIND (clause
))
582 case OMP_CLAUSE_DEFAULT_UNSPECIFIED
:
584 case OMP_CLAUSE_DEFAULT_SHARED
:
585 pp_string (pp
, "shared");
587 case OMP_CLAUSE_DEFAULT_NONE
:
588 pp_string (pp
, "none");
590 case OMP_CLAUSE_DEFAULT_PRIVATE
:
591 pp_string (pp
, "private");
593 case OMP_CLAUSE_DEFAULT_FIRSTPRIVATE
:
594 pp_string (pp
, "firstprivate");
596 case OMP_CLAUSE_DEFAULT_PRESENT
:
597 pp_string (pp
, "present");
605 case OMP_CLAUSE_SCHEDULE
:
606 pp_string (pp
, "schedule(");
607 if (OMP_CLAUSE_SCHEDULE_KIND (clause
)
608 & (OMP_CLAUSE_SCHEDULE_MONOTONIC
609 | OMP_CLAUSE_SCHEDULE_NONMONOTONIC
))
611 if (OMP_CLAUSE_SCHEDULE_KIND (clause
)
612 & OMP_CLAUSE_SCHEDULE_MONOTONIC
)
613 pp_string (pp
, "monotonic");
615 pp_string (pp
, "nonmonotonic");
616 if (OMP_CLAUSE_SCHEDULE_SIMD (clause
))
621 if (OMP_CLAUSE_SCHEDULE_SIMD (clause
))
622 pp_string (pp
, "simd:");
624 switch (OMP_CLAUSE_SCHEDULE_KIND (clause
) & OMP_CLAUSE_SCHEDULE_MASK
)
626 case OMP_CLAUSE_SCHEDULE_STATIC
:
627 pp_string (pp
, "static");
629 case OMP_CLAUSE_SCHEDULE_DYNAMIC
:
630 pp_string (pp
, "dynamic");
632 case OMP_CLAUSE_SCHEDULE_GUIDED
:
633 pp_string (pp
, "guided");
635 case OMP_CLAUSE_SCHEDULE_RUNTIME
:
636 pp_string (pp
, "runtime");
638 case OMP_CLAUSE_SCHEDULE_AUTO
:
639 pp_string (pp
, "auto");
644 if (OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (clause
))
647 dump_generic_node (pp
, OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (clause
),
653 case OMP_CLAUSE_UNTIED
:
654 pp_string (pp
, "untied");
657 case OMP_CLAUSE_COLLAPSE
:
658 pp_string (pp
, "collapse(");
659 dump_generic_node (pp
, OMP_CLAUSE_COLLAPSE_EXPR (clause
),
664 case OMP_CLAUSE_FINAL
:
665 pp_string (pp
, "final(");
666 dump_generic_node (pp
, OMP_CLAUSE_FINAL_EXPR (clause
),
671 case OMP_CLAUSE_MERGEABLE
:
672 pp_string (pp
, "mergeable");
675 case OMP_CLAUSE_LINEAR
:
676 pp_string (pp
, "linear(");
677 switch (OMP_CLAUSE_LINEAR_KIND (clause
))
679 case OMP_CLAUSE_LINEAR_DEFAULT
:
681 case OMP_CLAUSE_LINEAR_REF
:
682 pp_string (pp
, "ref(");
684 case OMP_CLAUSE_LINEAR_VAL
:
685 pp_string (pp
, "val(");
687 case OMP_CLAUSE_LINEAR_UVAL
:
688 pp_string (pp
, "uval(");
693 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
695 if (OMP_CLAUSE_LINEAR_KIND (clause
) != OMP_CLAUSE_LINEAR_DEFAULT
)
698 dump_generic_node (pp
, OMP_CLAUSE_LINEAR_STEP (clause
),
703 case OMP_CLAUSE_ALIGNED
:
704 pp_string (pp
, "aligned(");
705 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
707 if (OMP_CLAUSE_ALIGNED_ALIGNMENT (clause
))
710 dump_generic_node (pp
, OMP_CLAUSE_ALIGNED_ALIGNMENT (clause
),
716 case OMP_CLAUSE_DEPEND
:
717 pp_string (pp
, "depend(");
718 switch (OMP_CLAUSE_DEPEND_KIND (clause
))
720 case OMP_CLAUSE_DEPEND_DEPOBJ
:
723 case OMP_CLAUSE_DEPEND_IN
:
726 case OMP_CLAUSE_DEPEND_OUT
:
729 case OMP_CLAUSE_DEPEND_INOUT
:
732 case OMP_CLAUSE_DEPEND_MUTEXINOUTSET
:
733 name
= "mutexinoutset";
735 case OMP_CLAUSE_DEPEND_SOURCE
:
736 pp_string (pp
, "source)");
738 case OMP_CLAUSE_DEPEND_LAST
:
739 name
= "__internal__";
741 case OMP_CLAUSE_DEPEND_SINK
:
742 pp_string (pp
, "sink:");
743 for (tree t
= OMP_CLAUSE_DECL (clause
); t
; t
= TREE_CHAIN (t
))
744 if (TREE_CODE (t
) == TREE_LIST
)
746 dump_generic_node (pp
, TREE_VALUE (t
), spc
, flags
, false);
747 if (TREE_PURPOSE (t
) != integer_zero_node
)
749 if (OMP_CLAUSE_DEPEND_SINK_NEGATIVE (t
))
753 dump_generic_node (pp
, TREE_PURPOSE (t
), spc
, flags
,
767 tree t
= OMP_CLAUSE_DECL (clause
);
768 if (TREE_CODE (t
) == TREE_LIST
770 && TREE_CODE (TREE_PURPOSE (t
)) == TREE_VEC
)
772 dump_omp_iterators (pp
, TREE_PURPOSE (t
), spc
, flags
);
776 pp_string (pp
, name
);
778 dump_generic_node (pp
, t
, spc
, flags
, false);
784 pp_string (pp
, "map(");
785 switch (OMP_CLAUSE_MAP_KIND (clause
))
788 case GOMP_MAP_POINTER
:
789 pp_string (pp
, "alloc");
792 case GOMP_MAP_TO_PSET
:
793 pp_string (pp
, "to");
796 pp_string (pp
, "from");
798 case GOMP_MAP_TOFROM
:
799 pp_string (pp
, "tofrom");
801 case GOMP_MAP_FORCE_ALLOC
:
802 pp_string (pp
, "force_alloc");
804 case GOMP_MAP_FORCE_TO
:
805 pp_string (pp
, "force_to");
807 case GOMP_MAP_FORCE_FROM
:
808 pp_string (pp
, "force_from");
810 case GOMP_MAP_FORCE_TOFROM
:
811 pp_string (pp
, "force_tofrom");
813 case GOMP_MAP_FORCE_PRESENT
:
814 pp_string (pp
, "force_present");
816 case GOMP_MAP_DELETE
:
817 pp_string (pp
, "delete");
819 case GOMP_MAP_FORCE_DEVICEPTR
:
820 pp_string (pp
, "force_deviceptr");
822 case GOMP_MAP_ALWAYS_TO
:
823 pp_string (pp
, "always,to");
825 case GOMP_MAP_ALWAYS_FROM
:
826 pp_string (pp
, "always,from");
828 case GOMP_MAP_ALWAYS_TOFROM
:
829 pp_string (pp
, "always,tofrom");
831 case GOMP_MAP_RELEASE
:
832 pp_string (pp
, "release");
834 case GOMP_MAP_FIRSTPRIVATE_POINTER
:
835 pp_string (pp
, "firstprivate");
837 case GOMP_MAP_FIRSTPRIVATE_REFERENCE
:
838 pp_string (pp
, "firstprivate ref");
840 case GOMP_MAP_STRUCT
:
841 pp_string (pp
, "struct");
843 case GOMP_MAP_ALWAYS_POINTER
:
844 pp_string (pp
, "always_pointer");
846 case GOMP_MAP_DEVICE_RESIDENT
:
847 pp_string (pp
, "device_resident");
850 pp_string (pp
, "link");
856 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
859 if (OMP_CLAUSE_SIZE (clause
))
861 switch (OMP_CLAUSE_CODE (clause
) == OMP_CLAUSE_MAP
862 ? OMP_CLAUSE_MAP_KIND (clause
) : GOMP_MAP_TO
)
864 case GOMP_MAP_POINTER
:
865 case GOMP_MAP_FIRSTPRIVATE_POINTER
:
866 case GOMP_MAP_FIRSTPRIVATE_REFERENCE
:
867 case GOMP_MAP_ALWAYS_POINTER
:
868 pp_string (pp
, " [pointer assign, bias: ");
870 case GOMP_MAP_TO_PSET
:
871 pp_string (pp
, " [pointer set, len: ");
874 pp_string (pp
, " [len: ");
877 dump_generic_node (pp
, OMP_CLAUSE_SIZE (clause
),
879 pp_right_bracket (pp
);
884 case OMP_CLAUSE_FROM
:
885 pp_string (pp
, "from(");
886 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
888 goto print_clause_size
;
891 pp_string (pp
, "to(");
892 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
894 goto print_clause_size
;
896 case OMP_CLAUSE__CACHE_
:
898 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
900 goto print_clause_size
;
902 case OMP_CLAUSE_NUM_TEAMS
:
903 pp_string (pp
, "num_teams(");
904 dump_generic_node (pp
, OMP_CLAUSE_NUM_TEAMS_EXPR (clause
),
909 case OMP_CLAUSE_THREAD_LIMIT
:
910 pp_string (pp
, "thread_limit(");
911 dump_generic_node (pp
, OMP_CLAUSE_THREAD_LIMIT_EXPR (clause
),
916 case OMP_CLAUSE_DEVICE
:
917 pp_string (pp
, "device(");
918 dump_generic_node (pp
, OMP_CLAUSE_DEVICE_ID (clause
),
923 case OMP_CLAUSE_DIST_SCHEDULE
:
924 pp_string (pp
, "dist_schedule(static");
925 if (OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR (clause
))
928 dump_generic_node (pp
,
929 OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR (clause
),
935 case OMP_CLAUSE_PROC_BIND
:
936 pp_string (pp
, "proc_bind(");
937 switch (OMP_CLAUSE_PROC_BIND_KIND (clause
))
939 case OMP_CLAUSE_PROC_BIND_MASTER
:
940 pp_string (pp
, "master");
942 case OMP_CLAUSE_PROC_BIND_CLOSE
:
943 pp_string (pp
, "close");
945 case OMP_CLAUSE_PROC_BIND_SPREAD
:
946 pp_string (pp
, "spread");
954 case OMP_CLAUSE_DEVICE_TYPE
:
955 pp_string (pp
, "device_type(");
956 switch (OMP_CLAUSE_DEVICE_TYPE_KIND (clause
))
958 case OMP_CLAUSE_DEVICE_TYPE_HOST
:
959 pp_string (pp
, "host");
961 case OMP_CLAUSE_DEVICE_TYPE_NOHOST
:
962 pp_string (pp
, "nohost");
964 case OMP_CLAUSE_DEVICE_TYPE_ANY
:
965 pp_string (pp
, "any");
973 case OMP_CLAUSE_SAFELEN
:
974 pp_string (pp
, "safelen(");
975 dump_generic_node (pp
, OMP_CLAUSE_SAFELEN_EXPR (clause
),
980 case OMP_CLAUSE_SIMDLEN
:
981 pp_string (pp
, "simdlen(");
982 dump_generic_node (pp
, OMP_CLAUSE_SIMDLEN_EXPR (clause
),
987 case OMP_CLAUSE_PRIORITY
:
988 pp_string (pp
, "priority(");
989 dump_generic_node (pp
, OMP_CLAUSE_PRIORITY_EXPR (clause
),
994 case OMP_CLAUSE_GRAINSIZE
:
995 pp_string (pp
, "grainsize(");
996 dump_generic_node (pp
, OMP_CLAUSE_GRAINSIZE_EXPR (clause
),
1001 case OMP_CLAUSE_NUM_TASKS
:
1002 pp_string (pp
, "num_tasks(");
1003 dump_generic_node (pp
, OMP_CLAUSE_NUM_TASKS_EXPR (clause
),
1005 pp_right_paren (pp
);
1008 case OMP_CLAUSE_HINT
:
1009 pp_string (pp
, "hint(");
1010 dump_generic_node (pp
, OMP_CLAUSE_HINT_EXPR (clause
),
1012 pp_right_paren (pp
);
1015 case OMP_CLAUSE_DEFAULTMAP
:
1016 pp_string (pp
, "defaultmap(");
1017 switch (OMP_CLAUSE_DEFAULTMAP_BEHAVIOR (clause
))
1019 case OMP_CLAUSE_DEFAULTMAP_ALLOC
:
1020 pp_string (pp
, "alloc");
1022 case OMP_CLAUSE_DEFAULTMAP_TO
:
1023 pp_string (pp
, "to");
1025 case OMP_CLAUSE_DEFAULTMAP_FROM
:
1026 pp_string (pp
, "from");
1028 case OMP_CLAUSE_DEFAULTMAP_TOFROM
:
1029 pp_string (pp
, "tofrom");
1031 case OMP_CLAUSE_DEFAULTMAP_FIRSTPRIVATE
:
1032 pp_string (pp
, "firstprivate");
1034 case OMP_CLAUSE_DEFAULTMAP_NONE
:
1035 pp_string (pp
, "none");
1037 case OMP_CLAUSE_DEFAULTMAP_DEFAULT
:
1038 pp_string (pp
, "default");
1043 switch (OMP_CLAUSE_DEFAULTMAP_CATEGORY (clause
))
1045 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_UNSPECIFIED
:
1047 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_SCALAR
:
1048 pp_string (pp
, ":scalar");
1050 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_AGGREGATE
:
1051 pp_string (pp
, ":aggregate");
1053 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_ALLOCATABLE
:
1054 pp_string (pp
, ":allocatable");
1056 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_POINTER
:
1057 pp_string (pp
, ":pointer");
1062 pp_right_paren (pp
);
1065 case OMP_CLAUSE_ORDER
:
1066 pp_string (pp
, "order(concurrent)");
1069 case OMP_CLAUSE_BIND
:
1070 pp_string (pp
, "bind(");
1071 switch (OMP_CLAUSE_BIND_KIND (clause
))
1073 case OMP_CLAUSE_BIND_TEAMS
:
1074 pp_string (pp
, "teams");
1076 case OMP_CLAUSE_BIND_PARALLEL
:
1077 pp_string (pp
, "parallel");
1079 case OMP_CLAUSE_BIND_THREAD
:
1080 pp_string (pp
, "thread");
1085 pp_right_paren (pp
);
1088 case OMP_CLAUSE__SIMDUID_
:
1089 pp_string (pp
, "_simduid_(");
1090 dump_generic_node (pp
, OMP_CLAUSE__SIMDUID__DECL (clause
),
1092 pp_right_paren (pp
);
1095 case OMP_CLAUSE__SIMT_
:
1096 pp_string (pp
, "_simt_");
1099 case OMP_CLAUSE_GANG
:
1100 pp_string (pp
, "gang");
1101 if (OMP_CLAUSE_GANG_EXPR (clause
) != NULL_TREE
)
1103 pp_string (pp
, "(num: ");
1104 dump_generic_node (pp
, OMP_CLAUSE_GANG_EXPR (clause
),
1107 if (OMP_CLAUSE_GANG_STATIC_EXPR (clause
) != NULL_TREE
)
1109 if (OMP_CLAUSE_GANG_EXPR (clause
) == NULL_TREE
)
1113 pp_string (pp
, "static:");
1114 if (OMP_CLAUSE_GANG_STATIC_EXPR (clause
)
1115 == integer_minus_one_node
)
1116 pp_character (pp
, '*');
1118 dump_generic_node (pp
, OMP_CLAUSE_GANG_STATIC_EXPR (clause
),
1121 if (OMP_CLAUSE_GANG_EXPR (clause
) != NULL_TREE
1122 || OMP_CLAUSE_GANG_STATIC_EXPR (clause
) != NULL_TREE
)
1123 pp_right_paren (pp
);
1126 case OMP_CLAUSE_ASYNC
:
1127 pp_string (pp
, "async");
1128 if (OMP_CLAUSE_ASYNC_EXPR (clause
))
1130 pp_character(pp
, '(');
1131 dump_generic_node (pp
, OMP_CLAUSE_ASYNC_EXPR (clause
),
1133 pp_character(pp
, ')');
1137 case OMP_CLAUSE_AUTO
:
1138 case OMP_CLAUSE_SEQ
:
1139 pp_string (pp
, omp_clause_code_name
[OMP_CLAUSE_CODE (clause
)]);
1142 case OMP_CLAUSE_WAIT
:
1143 pp_string (pp
, "wait(");
1144 dump_generic_node (pp
, OMP_CLAUSE_WAIT_EXPR (clause
),
1146 pp_character(pp
, ')');
1149 case OMP_CLAUSE_WORKER
:
1150 pp_string (pp
, "worker");
1151 if (OMP_CLAUSE_WORKER_EXPR (clause
) != NULL_TREE
)
1154 dump_generic_node (pp
, OMP_CLAUSE_WORKER_EXPR (clause
),
1156 pp_right_paren (pp
);
1160 case OMP_CLAUSE_VECTOR
:
1161 pp_string (pp
, "vector");
1162 if (OMP_CLAUSE_VECTOR_EXPR (clause
) != NULL_TREE
)
1165 dump_generic_node (pp
, OMP_CLAUSE_VECTOR_EXPR (clause
),
1167 pp_right_paren (pp
);
1171 case OMP_CLAUSE_NUM_GANGS
:
1172 pp_string (pp
, "num_gangs(");
1173 dump_generic_node (pp
, OMP_CLAUSE_NUM_GANGS_EXPR (clause
),
1175 pp_character (pp
, ')');
1178 case OMP_CLAUSE_NUM_WORKERS
:
1179 pp_string (pp
, "num_workers(");
1180 dump_generic_node (pp
, OMP_CLAUSE_NUM_WORKERS_EXPR (clause
),
1182 pp_character (pp
, ')');
1185 case OMP_CLAUSE_VECTOR_LENGTH
:
1186 pp_string (pp
, "vector_length(");
1187 dump_generic_node (pp
, OMP_CLAUSE_VECTOR_LENGTH_EXPR (clause
),
1189 pp_character (pp
, ')');
1192 case OMP_CLAUSE_INBRANCH
:
1193 pp_string (pp
, "inbranch");
1195 case OMP_CLAUSE_NOTINBRANCH
:
1196 pp_string (pp
, "notinbranch");
1198 case OMP_CLAUSE_FOR
:
1199 pp_string (pp
, "for");
1201 case OMP_CLAUSE_PARALLEL
:
1202 pp_string (pp
, "parallel");
1204 case OMP_CLAUSE_SECTIONS
:
1205 pp_string (pp
, "sections");
1207 case OMP_CLAUSE_TASKGROUP
:
1208 pp_string (pp
, "taskgroup");
1210 case OMP_CLAUSE_NOGROUP
:
1211 pp_string (pp
, "nogroup");
1213 case OMP_CLAUSE_THREADS
:
1214 pp_string (pp
, "threads");
1216 case OMP_CLAUSE_SIMD
:
1217 pp_string (pp
, "simd");
1219 case OMP_CLAUSE_INDEPENDENT
:
1220 pp_string (pp
, "independent");
1222 case OMP_CLAUSE_TILE
:
1223 pp_string (pp
, "tile(");
1224 dump_generic_node (pp
, OMP_CLAUSE_TILE_LIST (clause
),
1226 pp_right_paren (pp
);
1229 case OMP_CLAUSE__GRIDDIM_
:
1230 pp_string (pp
, "_griddim_(");
1231 pp_unsigned_wide_integer (pp
, OMP_CLAUSE__GRIDDIM__DIMENSION (clause
));
1233 dump_generic_node (pp
, OMP_CLAUSE__GRIDDIM__SIZE (clause
), spc
, flags
,
1236 dump_generic_node (pp
, OMP_CLAUSE__GRIDDIM__GROUP (clause
), spc
, flags
,
1238 pp_right_paren (pp
);
1240 case OMP_CLAUSE_IF_PRESENT
:
1241 pp_string (pp
, "if_present");
1243 case OMP_CLAUSE_FINALIZE
:
1244 pp_string (pp
, "finalize");
1253 /* Dump the list of OpenMP clauses. PP, SPC and FLAGS are as in
1254 dump_generic_node. */
1257 dump_omp_clauses (pretty_printer
*pp
, tree clause
, int spc
, dump_flags_t flags
)
1265 dump_omp_clause (pp
, clause
, spc
, flags
);
1266 clause
= OMP_CLAUSE_CHAIN (clause
);
1274 /* Dump location LOC to PP. */
1277 dump_location (pretty_printer
*pp
, location_t loc
)
1279 expanded_location xloc
= expand_location (loc
);
1281 pp_left_bracket (pp
);
1284 pp_string (pp
, xloc
.file
);
1285 pp_string (pp
, ":");
1287 pp_decimal_int (pp
, xloc
.line
);
1289 pp_decimal_int (pp
, xloc
.column
);
1290 pp_string (pp
, "] ");
1294 /* Dump lexical block BLOCK. PP, SPC and FLAGS are as in
1295 dump_generic_node. */
1298 dump_block_node (pretty_printer
*pp
, tree block
, int spc
, dump_flags_t flags
)
1302 pp_printf (pp
, "BLOCK #%d ", BLOCK_NUMBER (block
));
1304 if (flags
& TDF_ADDRESS
)
1305 pp_printf (pp
, "[%p] ", (void *) block
);
1307 if (TREE_ASM_WRITTEN (block
))
1308 pp_string (pp
, "[written] ");
1310 if (flags
& TDF_SLIM
)
1313 if (BLOCK_SOURCE_LOCATION (block
))
1314 dump_location (pp
, BLOCK_SOURCE_LOCATION (block
));
1316 newline_and_indent (pp
, spc
+ 2);
1318 if (BLOCK_SUPERCONTEXT (block
))
1320 pp_string (pp
, "SUPERCONTEXT: ");
1321 dump_generic_node (pp
, BLOCK_SUPERCONTEXT (block
), 0,
1322 flags
| TDF_SLIM
, false);
1323 newline_and_indent (pp
, spc
+ 2);
1326 if (BLOCK_SUBBLOCKS (block
))
1328 pp_string (pp
, "SUBBLOCKS: ");
1329 for (t
= BLOCK_SUBBLOCKS (block
); t
; t
= BLOCK_CHAIN (t
))
1331 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
1334 newline_and_indent (pp
, spc
+ 2);
1337 if (BLOCK_CHAIN (block
))
1339 pp_string (pp
, "SIBLINGS: ");
1340 for (t
= BLOCK_CHAIN (block
); t
; t
= BLOCK_CHAIN (t
))
1342 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
1345 newline_and_indent (pp
, spc
+ 2);
1348 if (BLOCK_VARS (block
))
1350 pp_string (pp
, "VARS: ");
1351 for (t
= BLOCK_VARS (block
); t
; t
= TREE_CHAIN (t
))
1353 dump_generic_node (pp
, t
, 0, flags
, false);
1356 newline_and_indent (pp
, spc
+ 2);
1359 if (vec_safe_length (BLOCK_NONLOCALIZED_VARS (block
)) > 0)
1362 vec
<tree
, va_gc
> *nlv
= BLOCK_NONLOCALIZED_VARS (block
);
1364 pp_string (pp
, "NONLOCALIZED_VARS: ");
1365 FOR_EACH_VEC_ELT (*nlv
, i
, t
)
1367 dump_generic_node (pp
, t
, 0, flags
, false);
1370 newline_and_indent (pp
, spc
+ 2);
1373 if (BLOCK_ABSTRACT_ORIGIN (block
))
1375 pp_string (pp
, "ABSTRACT_ORIGIN: ");
1376 dump_generic_node (pp
, BLOCK_ABSTRACT_ORIGIN (block
), 0,
1377 flags
| TDF_SLIM
, false);
1378 newline_and_indent (pp
, spc
+ 2);
1381 if (BLOCK_FRAGMENT_ORIGIN (block
))
1383 pp_string (pp
, "FRAGMENT_ORIGIN: ");
1384 dump_generic_node (pp
, BLOCK_FRAGMENT_ORIGIN (block
), 0,
1385 flags
| TDF_SLIM
, false);
1386 newline_and_indent (pp
, spc
+ 2);
1389 if (BLOCK_FRAGMENT_CHAIN (block
))
1391 pp_string (pp
, "FRAGMENT_CHAIN: ");
1392 for (t
= BLOCK_FRAGMENT_CHAIN (block
); t
; t
= BLOCK_FRAGMENT_CHAIN (t
))
1394 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
1397 newline_and_indent (pp
, spc
+ 2);
1401 /* Dump #pragma omp atomic memory order clause. */
1404 dump_omp_atomic_memory_order (pretty_printer
*pp
, enum omp_memory_order mo
)
1408 case OMP_MEMORY_ORDER_RELAXED
:
1409 pp_string (pp
, " relaxed");
1411 case OMP_MEMORY_ORDER_SEQ_CST
:
1412 pp_string (pp
, " seq_cst");
1414 case OMP_MEMORY_ORDER_ACQ_REL
:
1415 pp_string (pp
, " acq_rel");
1417 case OMP_MEMORY_ORDER_ACQUIRE
:
1418 pp_string (pp
, " acquire");
1420 case OMP_MEMORY_ORDER_RELEASE
:
1421 pp_string (pp
, " release");
1423 case OMP_MEMORY_ORDER_UNSPECIFIED
:
1430 /* Helper to dump a MEM_REF node. */
1433 dump_mem_ref (pretty_printer
*pp
, tree node
, int spc
, dump_flags_t flags
)
1435 if (flags
& TDF_GIMPLE
)
1437 pp_string (pp
, "__MEM <");
1438 dump_generic_node (pp
, TREE_TYPE (node
),
1439 spc
, flags
| TDF_SLIM
, false);
1440 if (TYPE_ALIGN (TREE_TYPE (node
))
1441 != TYPE_ALIGN (TYPE_MAIN_VARIANT (TREE_TYPE (node
))))
1443 pp_string (pp
, ", ");
1444 pp_decimal_int (pp
, TYPE_ALIGN (TREE_TYPE (node
)));
1447 pp_string (pp
, " (");
1448 if (TREE_TYPE (TREE_OPERAND (node
, 0))
1449 != TREE_TYPE (TREE_OPERAND (node
, 1)))
1452 dump_generic_node (pp
, TREE_TYPE (TREE_OPERAND (node
, 1)),
1453 spc
, flags
| TDF_SLIM
, false);
1454 pp_right_paren (pp
);
1456 dump_generic_node (pp
, TREE_OPERAND (node
, 0),
1457 spc
, flags
| TDF_SLIM
, false);
1458 if (! integer_zerop (TREE_OPERAND (node
, 1)))
1460 pp_string (pp
, " + ");
1461 dump_generic_node (pp
, TREE_OPERAND (node
, 1),
1462 spc
, flags
| TDF_SLIM
, false);
1464 pp_right_paren (pp
);
1466 else if (integer_zerop (TREE_OPERAND (node
, 1))
1467 /* Dump the types of INTEGER_CSTs explicitly, for we can't
1468 infer them and MEM_ATTR caching will share MEM_REFs
1469 with differently-typed op0s. */
1470 && TREE_CODE (TREE_OPERAND (node
, 0)) != INTEGER_CST
1471 /* Released SSA_NAMES have no TREE_TYPE. */
1472 && TREE_TYPE (TREE_OPERAND (node
, 0)) != NULL_TREE
1473 /* Same pointer types, but ignoring POINTER_TYPE vs.
1475 && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 0)))
1476 == TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 1))))
1477 && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (node
, 0)))
1478 == TYPE_MODE (TREE_TYPE (TREE_OPERAND (node
, 1))))
1479 && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node
, 0)))
1480 == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node
, 1))))
1481 /* Same value types ignoring qualifiers. */
1482 && (TYPE_MAIN_VARIANT (TREE_TYPE (node
))
1483 == TYPE_MAIN_VARIANT
1484 (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 1)))))
1485 && (!(flags
& TDF_ALIAS
)
1486 || MR_DEPENDENCE_CLIQUE (node
) == 0))
1488 if (TREE_CODE (TREE_OPERAND (node
, 0)) != ADDR_EXPR
)
1490 /* Enclose pointers to arrays in parentheses. */
1491 tree op0
= TREE_OPERAND (node
, 0);
1492 tree op0type
= TREE_TYPE (op0
);
1493 if (POINTER_TYPE_P (op0type
)
1494 && TREE_CODE (TREE_TYPE (op0type
)) == ARRAY_TYPE
)
1497 dump_generic_node (pp
, op0
, spc
, flags
, false);
1498 if (POINTER_TYPE_P (op0type
)
1499 && TREE_CODE (TREE_TYPE (op0type
)) == ARRAY_TYPE
)
1500 pp_right_paren (pp
);
1503 dump_generic_node (pp
,
1504 TREE_OPERAND (TREE_OPERAND (node
, 0), 0),
1509 pp_string (pp
, "MEM");
1511 tree nodetype
= TREE_TYPE (node
);
1512 tree op0
= TREE_OPERAND (node
, 0);
1513 tree op1
= TREE_OPERAND (node
, 1);
1514 tree op1type
= TYPE_MAIN_VARIANT (TREE_TYPE (op1
));
1516 tree op0size
= TYPE_SIZE (nodetype
);
1517 tree op1size
= TYPE_SIZE (TREE_TYPE (op1type
));
1519 if (!op0size
|| !op1size
1520 || !operand_equal_p (op0size
, op1size
, 0))
1522 pp_string (pp
, " <");
1523 /* If the size of the type of the operand is not the same
1524 as the size of the MEM_REF expression include the type
1525 of the latter similar to the TDF_GIMPLE output to make
1526 it clear how many bytes of memory are being accessed. */
1527 dump_generic_node (pp
, nodetype
, spc
, flags
| TDF_SLIM
, false);
1528 pp_string (pp
, "> ");
1531 pp_string (pp
, "[(");
1532 dump_generic_node (pp
, op1type
, spc
, flags
| TDF_SLIM
, false);
1533 pp_right_paren (pp
);
1534 dump_generic_node (pp
, op0
, spc
, flags
, false);
1535 if (!integer_zerop (op1
))
1536 if (!integer_zerop (TREE_OPERAND (node
, 1)))
1538 pp_string (pp
, " + ");
1539 dump_generic_node (pp
, op1
, spc
, flags
, false);
1541 if ((flags
& TDF_ALIAS
)
1542 && MR_DEPENDENCE_CLIQUE (node
) != 0)
1544 pp_string (pp
, " clique ");
1545 pp_unsigned_wide_integer (pp
, MR_DEPENDENCE_CLIQUE (node
));
1546 pp_string (pp
, " base ");
1547 pp_unsigned_wide_integer (pp
, MR_DEPENDENCE_BASE (node
));
1549 pp_right_bracket (pp
);
1553 /* Dump the node NODE on the pretty_printer PP, SPC spaces of
1554 indent. FLAGS specifies details to show in the dump (see TDF_* in
1555 dumpfile.h). If IS_STMT is true, the object printed is considered
1556 to be a statement and it is terminated by ';' if appropriate. */
1559 dump_generic_node (pretty_printer
*pp
, tree node
, int spc
, dump_flags_t flags
,
1566 enum tree_code code
;
1568 if (node
== NULL_TREE
)
1571 is_expr
= EXPR_P (node
);
1573 if (is_stmt
&& (flags
& TDF_STMTADDR
))
1574 pp_printf (pp
, "<&%p> ", (void *)node
);
1576 if ((flags
& TDF_LINENO
) && EXPR_HAS_LOCATION (node
))
1577 dump_location (pp
, EXPR_LOCATION (node
));
1579 code
= TREE_CODE (node
);
1583 pp_string (pp
, "<<< error >>>");
1586 case IDENTIFIER_NODE
:
1587 pp_tree_identifier (pp
, node
);
1591 while (node
&& node
!= error_mark_node
)
1593 if (TREE_PURPOSE (node
))
1595 dump_generic_node (pp
, TREE_PURPOSE (node
), spc
, flags
, false);
1598 dump_generic_node (pp
, TREE_VALUE (node
), spc
, flags
, false);
1599 node
= TREE_CHAIN (node
);
1600 if (node
&& TREE_CODE (node
) == TREE_LIST
)
1609 dump_generic_node (pp
, BINFO_TYPE (node
), spc
, flags
, false);
1615 if (TREE_VEC_LENGTH (node
) > 0)
1617 size_t len
= TREE_VEC_LENGTH (node
);
1618 for (i
= 0; i
< len
- 1; i
++)
1620 dump_generic_node (pp
, TREE_VEC_ELT (node
, i
), spc
, flags
,
1625 dump_generic_node (pp
, TREE_VEC_ELT (node
, len
- 1), spc
,
1634 case FIXED_POINT_TYPE
:
1640 unsigned int quals
= TYPE_QUALS (node
);
1641 enum tree_code_class tclass
;
1643 if (quals
& TYPE_QUAL_ATOMIC
)
1644 pp_string (pp
, "atomic ");
1645 if (quals
& TYPE_QUAL_CONST
)
1646 pp_string (pp
, "const ");
1647 else if (quals
& TYPE_QUAL_VOLATILE
)
1648 pp_string (pp
, "volatile ");
1649 else if (quals
& TYPE_QUAL_RESTRICT
)
1650 pp_string (pp
, "restrict ");
1652 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
1654 pp_string (pp
, "<address-space-");
1655 pp_decimal_int (pp
, TYPE_ADDR_SPACE (node
));
1656 pp_string (pp
, "> ");
1659 tclass
= TREE_CODE_CLASS (TREE_CODE (node
));
1661 if (tclass
== tcc_declaration
)
1663 if (DECL_NAME (node
))
1664 dump_decl_name (pp
, node
, flags
);
1666 pp_string (pp
, "<unnamed type decl>");
1668 else if (tclass
== tcc_type
)
1670 if (TYPE_NAME (node
))
1672 if (TREE_CODE (TYPE_NAME (node
)) == IDENTIFIER_NODE
)
1673 pp_tree_identifier (pp
, TYPE_NAME (node
));
1674 else if (TREE_CODE (TYPE_NAME (node
)) == TYPE_DECL
1675 && DECL_NAME (TYPE_NAME (node
)))
1676 dump_decl_name (pp
, TYPE_NAME (node
), flags
);
1678 pp_string (pp
, "<unnamed type>");
1680 else if (TREE_CODE (node
) == VECTOR_TYPE
)
1682 pp_string (pp
, "vector");
1684 pp_wide_integer (pp
, TYPE_VECTOR_SUBPARTS (node
));
1685 pp_string (pp
, ") ");
1686 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1688 else if (TREE_CODE (node
) == INTEGER_TYPE
)
1690 if (TYPE_PRECISION (node
) == CHAR_TYPE_SIZE
)
1691 pp_string (pp
, (TYPE_UNSIGNED (node
)
1694 else if (TYPE_PRECISION (node
) == SHORT_TYPE_SIZE
)
1695 pp_string (pp
, (TYPE_UNSIGNED (node
)
1698 else if (TYPE_PRECISION (node
) == INT_TYPE_SIZE
)
1699 pp_string (pp
, (TYPE_UNSIGNED (node
)
1702 else if (TYPE_PRECISION (node
) == LONG_TYPE_SIZE
)
1703 pp_string (pp
, (TYPE_UNSIGNED (node
)
1706 else if (TYPE_PRECISION (node
) == LONG_LONG_TYPE_SIZE
)
1707 pp_string (pp
, (TYPE_UNSIGNED (node
)
1708 ? "unsigned long long"
1709 : "signed long long"));
1710 else if (TYPE_PRECISION (node
) >= CHAR_TYPE_SIZE
1711 && pow2p_hwi (TYPE_PRECISION (node
)))
1713 pp_string (pp
, (TYPE_UNSIGNED (node
) ? "uint" : "int"));
1714 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1715 pp_string (pp
, "_t");
1719 pp_string (pp
, (TYPE_UNSIGNED (node
)
1720 ? "<unnamed-unsigned:"
1721 : "<unnamed-signed:"));
1722 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1726 else if (TREE_CODE (node
) == COMPLEX_TYPE
)
1728 pp_string (pp
, "__complex__ ");
1729 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1731 else if (TREE_CODE (node
) == REAL_TYPE
)
1733 pp_string (pp
, "<float:");
1734 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1737 else if (TREE_CODE (node
) == FIXED_POINT_TYPE
)
1739 pp_string (pp
, "<fixed-point-");
1740 pp_string (pp
, TYPE_SATURATING (node
) ? "sat:" : "nonsat:");
1741 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1744 else if (TREE_CODE (node
) == VOID_TYPE
)
1745 pp_string (pp
, "void");
1747 pp_string (pp
, "<unnamed type>");
1753 case REFERENCE_TYPE
:
1754 str
= (TREE_CODE (node
) == POINTER_TYPE
? "*" : "&");
1756 if (TREE_TYPE (node
) == NULL
)
1758 pp_string (pp
, str
);
1759 pp_string (pp
, "<null type>");
1761 else if (TREE_CODE (TREE_TYPE (node
)) == FUNCTION_TYPE
)
1763 tree fnode
= TREE_TYPE (node
);
1765 dump_generic_node (pp
, TREE_TYPE (fnode
), spc
, flags
, false);
1768 pp_string (pp
, str
);
1769 if (TYPE_IDENTIFIER (node
))
1770 dump_generic_node (pp
, TYPE_NAME (node
), spc
, flags
, false);
1771 else if (flags
& TDF_NOUID
)
1772 pp_printf (pp
, "<Txxxx>");
1774 pp_printf (pp
, "<T%x>", TYPE_UID (node
));
1776 pp_right_paren (pp
);
1777 dump_function_declaration (pp
, fnode
, spc
, flags
);
1781 unsigned int quals
= TYPE_QUALS (node
);
1783 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1785 pp_string (pp
, str
);
1787 if (quals
& TYPE_QUAL_CONST
)
1788 pp_string (pp
, " const");
1789 if (quals
& TYPE_QUAL_VOLATILE
)
1790 pp_string (pp
, " volatile");
1791 if (quals
& TYPE_QUAL_RESTRICT
)
1792 pp_string (pp
, " restrict");
1794 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
1796 pp_string (pp
, " <address-space-");
1797 pp_decimal_int (pp
, TYPE_ADDR_SPACE (node
));
1801 if (TYPE_REF_CAN_ALIAS_ALL (node
))
1802 pp_string (pp
, " {ref-all}");
1811 dump_mem_ref (pp
, node
, spc
, flags
);
1814 case TARGET_MEM_REF
:
1816 const char *sep
= "";
1819 pp_string (pp
, "MEM[");
1821 if (TREE_CODE (TMR_BASE (node
)) == ADDR_EXPR
)
1823 pp_string (pp
, sep
);
1825 pp_string (pp
, "symbol: ");
1826 dump_generic_node (pp
, TREE_OPERAND (TMR_BASE (node
), 0),
1831 pp_string (pp
, sep
);
1833 pp_string (pp
, "base: ");
1834 dump_generic_node (pp
, TMR_BASE (node
), spc
, flags
, false);
1836 tmp
= TMR_INDEX2 (node
);
1839 pp_string (pp
, sep
);
1841 pp_string (pp
, "base: ");
1842 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1844 tmp
= TMR_INDEX (node
);
1847 pp_string (pp
, sep
);
1849 pp_string (pp
, "index: ");
1850 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1852 tmp
= TMR_STEP (node
);
1855 pp_string (pp
, sep
);
1857 pp_string (pp
, "step: ");
1858 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1860 tmp
= TMR_OFFSET (node
);
1863 pp_string (pp
, sep
);
1865 pp_string (pp
, "offset: ");
1866 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1868 pp_right_bracket (pp
);
1876 /* Print the innermost component type. */
1877 for (tmp
= TREE_TYPE (node
); TREE_CODE (tmp
) == ARRAY_TYPE
;
1878 tmp
= TREE_TYPE (tmp
))
1880 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1882 /* Print the dimensions. */
1883 for (tmp
= node
; TREE_CODE (tmp
) == ARRAY_TYPE
; tmp
= TREE_TYPE (tmp
))
1884 dump_array_domain (pp
, TYPE_DOMAIN (tmp
), spc
, flags
);
1890 case QUAL_UNION_TYPE
:
1892 unsigned int quals
= TYPE_QUALS (node
);
1894 if (quals
& TYPE_QUAL_ATOMIC
)
1895 pp_string (pp
, "atomic ");
1896 if (quals
& TYPE_QUAL_CONST
)
1897 pp_string (pp
, "const ");
1898 if (quals
& TYPE_QUAL_VOLATILE
)
1899 pp_string (pp
, "volatile ");
1901 /* Print the name of the structure. */
1902 if (TREE_CODE (node
) == RECORD_TYPE
)
1903 pp_string (pp
, "struct ");
1904 else if (TREE_CODE (node
) == UNION_TYPE
)
1905 pp_string (pp
, "union ");
1907 if (TYPE_NAME (node
))
1908 dump_generic_node (pp
, TYPE_NAME (node
), spc
, flags
, false);
1909 else if (!(flags
& TDF_SLIM
))
1910 /* FIXME: If we eliminate the 'else' above and attempt
1911 to show the fields for named types, we may get stuck
1912 following a cycle of pointers to structs. The alleged
1913 self-reference check in print_struct_decl will not detect
1914 cycles involving more than one pointer or struct type. */
1915 print_struct_decl (pp
, node
, spc
, flags
);
1924 if (flags
& TDF_GIMPLE
1925 && (POINTER_TYPE_P (TREE_TYPE (node
))
1926 || (TYPE_PRECISION (TREE_TYPE (node
))
1927 < TYPE_PRECISION (integer_type_node
))
1928 || exact_log2 (TYPE_PRECISION (TREE_TYPE (node
))) == -1
1929 || tree_int_cst_sgn (node
) < 0))
1931 pp_string (pp
, "_Literal (");
1932 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1933 pp_string (pp
, ") ");
1935 if (TREE_CODE (TREE_TYPE (node
)) == POINTER_TYPE
1936 && ! (flags
& TDF_GIMPLE
))
1938 /* In the case of a pointer, one may want to divide by the
1939 size of the pointed-to type. Unfortunately, this not
1940 straightforward. The C front-end maps expressions
1945 in such a way that the two INTEGER_CST nodes for "5" have
1946 different values but identical types. In the latter
1947 case, the 5 is multiplied by sizeof (int) in c-common.c
1948 (pointer_int_sum) to convert it to a byte address, and
1949 yet the type of the node is left unchanged. Argh. What
1950 is consistent though is that the number value corresponds
1951 to bytes (UNITS) offset.
1953 NB: Neither of the following divisors can be trivially
1954 used to recover the original literal:
1956 TREE_INT_CST_LOW (TYPE_SIZE_UNIT (TREE_TYPE (node)))
1957 TYPE_PRECISION (TREE_TYPE (TREE_TYPE (node))) */
1958 pp_wide_integer (pp
, TREE_INT_CST_LOW (node
));
1959 pp_string (pp
, "B"); /* pseudo-unit */
1961 else if (tree_fits_shwi_p (node
))
1962 pp_wide_integer (pp
, tree_to_shwi (node
));
1963 else if (tree_fits_uhwi_p (node
))
1964 pp_unsigned_wide_integer (pp
, tree_to_uhwi (node
));
1967 wide_int val
= wi::to_wide (node
);
1969 if (wi::neg_p (val
, TYPE_SIGN (TREE_TYPE (node
))))
1974 print_hex (val
, pp_buffer (pp
)->digit_buffer
);
1975 pp_string (pp
, pp_buffer (pp
)->digit_buffer
);
1977 if ((flags
& TDF_GIMPLE
)
1978 && ! (POINTER_TYPE_P (TREE_TYPE (node
))
1979 || (TYPE_PRECISION (TREE_TYPE (node
))
1980 < TYPE_PRECISION (integer_type_node
))
1981 || exact_log2 (TYPE_PRECISION (TREE_TYPE (node
))) == -1))
1983 if (TYPE_UNSIGNED (TREE_TYPE (node
)))
1984 pp_character (pp
, 'u');
1985 if (TYPE_PRECISION (TREE_TYPE (node
))
1986 == TYPE_PRECISION (unsigned_type_node
))
1988 else if (TYPE_PRECISION (TREE_TYPE (node
))
1989 == TYPE_PRECISION (long_unsigned_type_node
))
1990 pp_character (pp
, 'l');
1991 else if (TYPE_PRECISION (TREE_TYPE (node
))
1992 == TYPE_PRECISION (long_long_unsigned_type_node
))
1993 pp_string (pp
, "ll");
1995 if (TREE_OVERFLOW (node
))
1996 pp_string (pp
, "(OVF)");
2000 pp_string (pp
, "POLY_INT_CST [");
2001 dump_generic_node (pp
, POLY_INT_CST_COEFF (node
, 0), spc
, flags
, false);
2002 for (unsigned int i
= 1; i
< NUM_POLY_INT_COEFFS
; ++i
)
2004 pp_string (pp
, ", ");
2005 dump_generic_node (pp
, POLY_INT_CST_COEFF (node
, i
),
2008 pp_string (pp
, "]");
2012 /* Code copied from print_node. */
2015 if (TREE_OVERFLOW (node
))
2016 pp_string (pp
, " overflow");
2018 d
= TREE_REAL_CST (node
);
2019 if (REAL_VALUE_ISINF (d
))
2020 pp_string (pp
, REAL_VALUE_NEGATIVE (d
) ? " -Inf" : " Inf");
2021 else if (REAL_VALUE_ISNAN (d
))
2022 pp_string (pp
, " Nan");
2026 real_to_decimal (string
, &d
, sizeof (string
), 0, 1);
2027 pp_string (pp
, string
);
2035 fixed_to_decimal (string
, TREE_FIXED_CST_PTR (node
), sizeof (string
));
2036 pp_string (pp
, string
);
2041 pp_string (pp
, "__complex__ (");
2042 dump_generic_node (pp
, TREE_REALPART (node
), spc
, flags
, false);
2043 pp_string (pp
, ", ");
2044 dump_generic_node (pp
, TREE_IMAGPART (node
), spc
, flags
, false);
2045 pp_right_paren (pp
);
2050 pp_string (pp
, "\"");
2051 if (unsigned nbytes
= TREE_STRING_LENGTH (node
))
2052 pretty_print_string (pp
, TREE_STRING_POINTER (node
), nbytes
);
2053 pp_string (pp
, "\"");
2060 pp_string (pp
, "{ ");
2061 unsigned HOST_WIDE_INT nunits
;
2062 if (!VECTOR_CST_NELTS (node
).is_constant (&nunits
))
2063 nunits
= vector_cst_encoded_nelts (node
);
2064 for (i
= 0; i
< nunits
; ++i
)
2067 pp_string (pp
, ", ");
2068 dump_generic_node (pp
, VECTOR_CST_ELT (node
, i
),
2071 if (!VECTOR_CST_NELTS (node
).is_constant ())
2072 pp_string (pp
, ", ...");
2073 pp_string (pp
, " }");
2079 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2081 if (TREE_CODE (node
) == METHOD_TYPE
)
2083 if (TYPE_METHOD_BASETYPE (node
))
2084 dump_generic_node (pp
, TYPE_NAME (TYPE_METHOD_BASETYPE (node
)),
2087 pp_string (pp
, "<null method basetype>");
2088 pp_colon_colon (pp
);
2090 if (TYPE_IDENTIFIER (node
))
2091 dump_generic_node (pp
, TYPE_NAME (node
), spc
, flags
, false);
2092 else if (TYPE_NAME (node
) && DECL_NAME (TYPE_NAME (node
)))
2093 dump_decl_name (pp
, TYPE_NAME (node
), flags
);
2094 else if (flags
& TDF_NOUID
)
2095 pp_printf (pp
, "<Txxxx>");
2097 pp_printf (pp
, "<T%x>", TYPE_UID (node
));
2098 dump_function_declaration (pp
, node
, spc
, flags
);
2103 dump_decl_name (pp
, node
, flags
);
2107 if (DECL_NAME (node
))
2108 dump_decl_name (pp
, node
, flags
);
2109 else if (LABEL_DECL_UID (node
) != -1)
2111 if (flags
& TDF_GIMPLE
)
2112 pp_printf (pp
, "L%d", (int) LABEL_DECL_UID (node
));
2114 pp_printf (pp
, "<L%d>", (int) LABEL_DECL_UID (node
));
2118 if (flags
& TDF_NOUID
)
2119 pp_string (pp
, "<D.xxxx>");
2122 if (flags
& TDF_GIMPLE
)
2123 pp_printf (pp
, "<D%u>", DECL_UID (node
));
2125 pp_printf (pp
, "<D.%u>", DECL_UID (node
));
2131 if (DECL_IS_BUILTIN (node
))
2133 /* Don't print the declaration of built-in types. */
2136 if (DECL_NAME (node
))
2137 dump_decl_name (pp
, node
, flags
);
2138 else if (TYPE_NAME (TREE_TYPE (node
)) != node
)
2140 pp_string (pp
, (TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
2141 ? "union" : "struct "));
2142 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2145 pp_string (pp
, "<anon>");
2151 case DEBUG_EXPR_DECL
:
2152 case NAMESPACE_DECL
:
2154 dump_decl_name (pp
, node
, flags
);
2158 pp_string (pp
, "<retval>");
2162 op0
= TREE_OPERAND (node
, 0);
2165 && (TREE_CODE (op0
) == INDIRECT_REF
2166 || (TREE_CODE (op0
) == MEM_REF
2167 && TREE_CODE (TREE_OPERAND (op0
, 0)) != ADDR_EXPR
2168 && integer_zerop (TREE_OPERAND (op0
, 1))
2169 /* Dump the types of INTEGER_CSTs explicitly, for we
2170 can't infer them and MEM_ATTR caching will share
2171 MEM_REFs with differently-typed op0s. */
2172 && TREE_CODE (TREE_OPERAND (op0
, 0)) != INTEGER_CST
2173 /* Released SSA_NAMES have no TREE_TYPE. */
2174 && TREE_TYPE (TREE_OPERAND (op0
, 0)) != NULL_TREE
2175 /* Same pointer types, but ignoring POINTER_TYPE vs.
2177 && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 0)))
2178 == TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 1))))
2179 && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0
, 0)))
2180 == TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0
, 1))))
2181 && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0
, 0)))
2182 == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0
, 1))))
2183 /* Same value types ignoring qualifiers. */
2184 && (TYPE_MAIN_VARIANT (TREE_TYPE (op0
))
2185 == TYPE_MAIN_VARIANT
2186 (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 1)))))
2187 && MR_DEPENDENCE_CLIQUE (op0
) == 0)))
2189 op0
= TREE_OPERAND (op0
, 0);
2192 if (op_prio (op0
) < op_prio (node
))
2194 dump_generic_node (pp
, op0
, spc
, flags
, false);
2195 if (op_prio (op0
) < op_prio (node
))
2196 pp_right_paren (pp
);
2197 pp_string (pp
, str
);
2198 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2199 op0
= component_ref_field_offset (node
);
2200 if (op0
&& TREE_CODE (op0
) != INTEGER_CST
)
2202 pp_string (pp
, "{off: ");
2203 dump_generic_node (pp
, op0
, spc
, flags
, false);
2204 pp_right_brace (pp
);
2209 if (flags
& TDF_GIMPLE
)
2211 pp_string (pp
, "__BIT_FIELD_REF <");
2212 dump_generic_node (pp
, TREE_TYPE (node
),
2213 spc
, flags
| TDF_SLIM
, false);
2214 if (TYPE_ALIGN (TREE_TYPE (node
))
2215 != TYPE_ALIGN (TYPE_MAIN_VARIANT (TREE_TYPE (node
))))
2217 pp_string (pp
, ", ");
2218 pp_decimal_int (pp
, TYPE_ALIGN (TREE_TYPE (node
)));
2221 pp_string (pp
, " (");
2222 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
,
2223 flags
| TDF_SLIM
, false);
2224 pp_string (pp
, ", ");
2225 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
,
2226 flags
| TDF_SLIM
, false);
2227 pp_string (pp
, ", ");
2228 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
,
2229 flags
| TDF_SLIM
, false);
2230 pp_right_paren (pp
);
2234 pp_string (pp
, "BIT_FIELD_REF <");
2235 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2236 pp_string (pp
, ", ");
2237 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2238 pp_string (pp
, ", ");
2239 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2244 case BIT_INSERT_EXPR
:
2245 pp_string (pp
, "BIT_INSERT_EXPR <");
2246 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2247 pp_string (pp
, ", ");
2248 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2249 pp_string (pp
, ", ");
2250 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2251 pp_string (pp
, " (");
2252 if (INTEGRAL_TYPE_P (TREE_TYPE (TREE_OPERAND (node
, 1))))
2254 TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (node
, 1))));
2256 dump_generic_node (pp
, TYPE_SIZE (TREE_TYPE (TREE_OPERAND (node
, 1))),
2258 pp_string (pp
, " bits)>");
2262 case ARRAY_RANGE_REF
:
2263 op0
= TREE_OPERAND (node
, 0);
2264 if (op_prio (op0
) < op_prio (node
))
2266 dump_generic_node (pp
, op0
, spc
, flags
, false);
2267 if (op_prio (op0
) < op_prio (node
))
2268 pp_right_paren (pp
);
2269 pp_left_bracket (pp
);
2270 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2271 if (TREE_CODE (node
) == ARRAY_RANGE_REF
)
2272 pp_string (pp
, " ...");
2273 pp_right_bracket (pp
);
2275 op0
= array_ref_low_bound (node
);
2276 op1
= array_ref_element_size (node
);
2278 if (!integer_zerop (op0
)
2279 || TREE_OPERAND (node
, 2)
2280 || TREE_OPERAND (node
, 3))
2282 pp_string (pp
, "{lb: ");
2283 dump_generic_node (pp
, op0
, spc
, flags
, false);
2284 pp_string (pp
, " sz: ");
2285 dump_generic_node (pp
, op1
, spc
, flags
, false);
2286 pp_right_brace (pp
);
2292 unsigned HOST_WIDE_INT ix
;
2294 bool is_struct_init
= false;
2295 bool is_array_init
= false;
2298 if (TREE_CLOBBER_P (node
))
2299 pp_string (pp
, "CLOBBER");
2300 else if (TREE_CODE (TREE_TYPE (node
)) == RECORD_TYPE
2301 || TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
)
2302 is_struct_init
= true;
2303 else if (TREE_CODE (TREE_TYPE (node
)) == ARRAY_TYPE
2304 && TYPE_DOMAIN (TREE_TYPE (node
))
2305 && TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
)))
2306 && TREE_CODE (TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
))))
2309 tree minv
= TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
)));
2310 is_array_init
= true;
2311 curidx
= wi::to_widest (minv
);
2313 FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (node
), ix
, field
, val
)
2320 dump_generic_node (pp
, field
, spc
, flags
, false);
2323 else if (is_array_init
2324 && (TREE_CODE (field
) != INTEGER_CST
2325 || curidx
!= wi::to_widest (field
)))
2327 pp_left_bracket (pp
);
2328 if (TREE_CODE (field
) == RANGE_EXPR
)
2330 dump_generic_node (pp
, TREE_OPERAND (field
, 0), spc
,
2332 pp_string (pp
, " ... ");
2333 dump_generic_node (pp
, TREE_OPERAND (field
, 1), spc
,
2335 if (TREE_CODE (TREE_OPERAND (field
, 1)) == INTEGER_CST
)
2336 curidx
= wi::to_widest (TREE_OPERAND (field
, 1));
2339 dump_generic_node (pp
, field
, spc
, flags
, false);
2340 if (TREE_CODE (field
) == INTEGER_CST
)
2341 curidx
= wi::to_widest (field
);
2342 pp_string (pp
, "]=");
2347 if (val
&& TREE_CODE (val
) == ADDR_EXPR
)
2348 if (TREE_CODE (TREE_OPERAND (val
, 0)) == FUNCTION_DECL
)
2349 val
= TREE_OPERAND (val
, 0);
2350 if (val
&& TREE_CODE (val
) == FUNCTION_DECL
)
2351 dump_decl_name (pp
, val
, flags
);
2353 dump_generic_node (pp
, val
, spc
, flags
, false);
2354 if (ix
!= CONSTRUCTOR_NELTS (node
) - 1)
2360 pp_right_brace (pp
);
2367 if (flags
& TDF_SLIM
)
2369 pp_string (pp
, "<COMPOUND_EXPR>");
2373 dump_generic_node (pp
, TREE_OPERAND (node
, 0),
2374 spc
, flags
, !(flags
& TDF_SLIM
));
2375 if (flags
& TDF_SLIM
)
2376 newline_and_indent (pp
, spc
);
2383 for (tp
= &TREE_OPERAND (node
, 1);
2384 TREE_CODE (*tp
) == COMPOUND_EXPR
;
2385 tp
= &TREE_OPERAND (*tp
, 1))
2387 dump_generic_node (pp
, TREE_OPERAND (*tp
, 0),
2388 spc
, flags
, !(flags
& TDF_SLIM
));
2389 if (flags
& TDF_SLIM
)
2390 newline_and_indent (pp
, spc
);
2398 dump_generic_node (pp
, *tp
, spc
, flags
, !(flags
& TDF_SLIM
));
2402 case STATEMENT_LIST
:
2404 tree_stmt_iterator si
;
2407 if (flags
& TDF_SLIM
)
2409 pp_string (pp
, "<STATEMENT_LIST>");
2413 for (si
= tsi_start (node
); !tsi_end_p (si
); tsi_next (&si
))
2416 newline_and_indent (pp
, spc
);
2419 dump_generic_node (pp
, tsi_stmt (si
), spc
, flags
, true);
2426 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
,
2431 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
,
2436 pp_string (pp
, "TARGET_EXPR <");
2437 dump_generic_node (pp
, TARGET_EXPR_SLOT (node
), spc
, flags
, false);
2440 dump_generic_node (pp
, TARGET_EXPR_INITIAL (node
), spc
, flags
, false);
2445 print_declaration (pp
, DECL_EXPR_DECL (node
), spc
, flags
);
2450 if (TREE_TYPE (node
) == NULL
|| TREE_TYPE (node
) == void_type_node
)
2452 pp_string (pp
, "if (");
2453 dump_generic_node (pp
, COND_EXPR_COND (node
), spc
, flags
, false);
2454 pp_right_paren (pp
);
2455 /* The lowered cond_exprs should always be printed in full. */
2456 if (COND_EXPR_THEN (node
)
2457 && (IS_EMPTY_STMT (COND_EXPR_THEN (node
))
2458 || TREE_CODE (COND_EXPR_THEN (node
)) == GOTO_EXPR
)
2459 && COND_EXPR_ELSE (node
)
2460 && (IS_EMPTY_STMT (COND_EXPR_ELSE (node
))
2461 || TREE_CODE (COND_EXPR_ELSE (node
)) == GOTO_EXPR
))
2464 dump_generic_node (pp
, COND_EXPR_THEN (node
),
2466 if (!IS_EMPTY_STMT (COND_EXPR_ELSE (node
)))
2468 pp_string (pp
, " else ");
2469 dump_generic_node (pp
, COND_EXPR_ELSE (node
),
2473 else if (!(flags
& TDF_SLIM
))
2475 /* Output COND_EXPR_THEN. */
2476 if (COND_EXPR_THEN (node
))
2478 newline_and_indent (pp
, spc
+2);
2480 newline_and_indent (pp
, spc
+4);
2481 dump_generic_node (pp
, COND_EXPR_THEN (node
), spc
+4,
2483 newline_and_indent (pp
, spc
+2);
2484 pp_right_brace (pp
);
2487 /* Output COND_EXPR_ELSE. */
2488 if (COND_EXPR_ELSE (node
)
2489 && !IS_EMPTY_STMT (COND_EXPR_ELSE (node
)))
2491 newline_and_indent (pp
, spc
);
2492 pp_string (pp
, "else");
2493 newline_and_indent (pp
, spc
+2);
2495 newline_and_indent (pp
, spc
+4);
2496 dump_generic_node (pp
, COND_EXPR_ELSE (node
), spc
+4,
2498 newline_and_indent (pp
, spc
+2);
2499 pp_right_brace (pp
);
2506 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2510 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2514 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2520 if (!(flags
& TDF_SLIM
))
2522 if (BIND_EXPR_VARS (node
))
2526 for (op0
= BIND_EXPR_VARS (node
); op0
; op0
= DECL_CHAIN (op0
))
2528 print_declaration (pp
, op0
, spc
+2, flags
);
2533 newline_and_indent (pp
, spc
+2);
2534 dump_generic_node (pp
, BIND_EXPR_BODY (node
), spc
+2, flags
, true);
2535 newline_and_indent (pp
, spc
);
2536 pp_right_brace (pp
);
2542 if (CALL_EXPR_FN (node
) != NULL_TREE
)
2543 print_call_name (pp
, CALL_EXPR_FN (node
), flags
);
2547 pp_string (pp
, internal_fn_name (CALL_EXPR_IFN (node
)));
2550 /* Print parameters. */
2555 call_expr_arg_iterator iter
;
2556 FOR_EACH_CALL_EXPR_ARG (arg
, iter
, node
)
2558 dump_generic_node (pp
, arg
, spc
, flags
, false);
2559 if (more_call_expr_args_p (&iter
))
2566 if (CALL_EXPR_VA_ARG_PACK (node
))
2568 if (call_expr_nargs (node
) > 0)
2573 pp_string (pp
, "__builtin_va_arg_pack ()");
2575 pp_right_paren (pp
);
2577 op1
= CALL_EXPR_STATIC_CHAIN (node
);
2580 pp_string (pp
, " [static-chain: ");
2581 dump_generic_node (pp
, op1
, spc
, flags
, false);
2582 pp_right_bracket (pp
);
2585 if (CALL_EXPR_RETURN_SLOT_OPT (node
))
2586 pp_string (pp
, " [return slot optimization]");
2587 if (CALL_EXPR_TAILCALL (node
))
2588 pp_string (pp
, " [tail call]");
2591 case WITH_CLEANUP_EXPR
:
2595 case CLEANUP_POINT_EXPR
:
2596 pp_string (pp
, "<<cleanup_point ");
2597 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2598 pp_string (pp
, ">>");
2601 case PLACEHOLDER_EXPR
:
2602 pp_string (pp
, "<PLACEHOLDER_EXPR ");
2603 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2607 /* Binary arithmetic and logic expressions. */
2608 case WIDEN_SUM_EXPR
:
2609 case WIDEN_MULT_EXPR
:
2611 case MULT_HIGHPART_EXPR
:
2613 case POINTER_PLUS_EXPR
:
2614 case POINTER_DIFF_EXPR
:
2616 case TRUNC_DIV_EXPR
:
2618 case FLOOR_DIV_EXPR
:
2619 case ROUND_DIV_EXPR
:
2620 case TRUNC_MOD_EXPR
:
2622 case FLOOR_MOD_EXPR
:
2623 case ROUND_MOD_EXPR
:
2625 case EXACT_DIV_EXPR
:
2630 case WIDEN_LSHIFT_EXPR
:
2634 case TRUTH_ANDIF_EXPR
:
2635 case TRUTH_ORIF_EXPR
:
2636 case TRUTH_AND_EXPR
:
2638 case TRUTH_XOR_EXPR
:
2652 case UNORDERED_EXPR
:
2654 const char *op
= op_symbol (node
);
2655 op0
= TREE_OPERAND (node
, 0);
2656 op1
= TREE_OPERAND (node
, 1);
2658 /* When the operands are expressions with less priority,
2659 keep semantics of the tree representation. */
2660 if (op_prio (op0
) <= op_prio (node
))
2663 dump_generic_node (pp
, op0
, spc
, flags
, false);
2664 pp_right_paren (pp
);
2667 dump_generic_node (pp
, op0
, spc
, flags
, false);
2673 /* When the operands are expressions with less priority,
2674 keep semantics of the tree representation. */
2675 if (op_prio (op1
) <= op_prio (node
))
2678 dump_generic_node (pp
, op1
, spc
, flags
, false);
2679 pp_right_paren (pp
);
2682 dump_generic_node (pp
, op1
, spc
, flags
, false);
2686 /* Unary arithmetic and logic expressions. */
2689 case TRUTH_NOT_EXPR
:
2691 case PREDECREMENT_EXPR
:
2692 case PREINCREMENT_EXPR
:
2694 if (TREE_CODE (node
) == ADDR_EXPR
2695 && (TREE_CODE (TREE_OPERAND (node
, 0)) == STRING_CST
2696 || TREE_CODE (TREE_OPERAND (node
, 0)) == FUNCTION_DECL
))
2697 ; /* Do not output '&' for strings and function pointers. */
2699 pp_string (pp
, op_symbol (node
));
2701 if (op_prio (TREE_OPERAND (node
, 0)) < op_prio (node
))
2704 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2705 pp_right_paren (pp
);
2708 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2711 case POSTDECREMENT_EXPR
:
2712 case POSTINCREMENT_EXPR
:
2713 if (op_prio (TREE_OPERAND (node
, 0)) < op_prio (node
))
2716 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2717 pp_right_paren (pp
);
2720 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2721 pp_string (pp
, op_symbol (node
));
2725 pp_string (pp
, "MIN_EXPR <");
2726 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2727 pp_string (pp
, ", ");
2728 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2733 pp_string (pp
, "MAX_EXPR <");
2734 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2735 pp_string (pp
, ", ");
2736 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2741 pp_string (pp
, "ABS_EXPR <");
2742 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2747 pp_string (pp
, "ABSU_EXPR <");
2748 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2756 case ADDR_SPACE_CONVERT_EXPR
:
2757 case FIXED_CONVERT_EXPR
:
2758 case FIX_TRUNC_EXPR
:
2761 type
= TREE_TYPE (node
);
2762 op0
= TREE_OPERAND (node
, 0);
2763 if (type
!= TREE_TYPE (op0
))
2766 dump_generic_node (pp
, type
, spc
, flags
, false);
2767 pp_string (pp
, ") ");
2769 if (op_prio (op0
) < op_prio (node
))
2771 dump_generic_node (pp
, op0
, spc
, flags
, false);
2772 if (op_prio (op0
) < op_prio (node
))
2773 pp_right_paren (pp
);
2776 case VIEW_CONVERT_EXPR
:
2777 if (flags
& TDF_GIMPLE
)
2778 pp_string (pp
, "__VIEW_CONVERT <");
2780 pp_string (pp
, "VIEW_CONVERT_EXPR<");
2781 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2782 pp_string (pp
, ">(");
2783 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2784 pp_right_paren (pp
);
2788 pp_string (pp
, "((");
2789 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2790 pp_string (pp
, "))");
2793 case NON_LVALUE_EXPR
:
2794 pp_string (pp
, "NON_LVALUE_EXPR <");
2795 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2800 pp_string (pp
, "SAVE_EXPR <");
2801 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2806 pp_string (pp
, "COMPLEX_EXPR <");
2807 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2808 pp_string (pp
, ", ");
2809 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2814 pp_string (pp
, "CONJ_EXPR <");
2815 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2820 if (flags
& TDF_GIMPLE
)
2822 pp_string (pp
, "__real ");
2823 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2827 pp_string (pp
, "REALPART_EXPR <");
2828 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2834 if (flags
& TDF_GIMPLE
)
2836 pp_string (pp
, "__imag ");
2837 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2841 pp_string (pp
, "IMAGPART_EXPR <");
2842 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2848 pp_string (pp
, "VA_ARG_EXPR <");
2849 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2853 case TRY_FINALLY_EXPR
:
2854 case TRY_CATCH_EXPR
:
2855 pp_string (pp
, "try");
2856 newline_and_indent (pp
, spc
+2);
2858 newline_and_indent (pp
, spc
+4);
2859 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
+4, flags
, true);
2860 newline_and_indent (pp
, spc
+2);
2861 pp_right_brace (pp
);
2862 newline_and_indent (pp
, spc
);
2863 if (TREE_CODE (node
) == TRY_CATCH_EXPR
)
2865 node
= TREE_OPERAND (node
, 1);
2866 pp_string (pp
, "catch");
2870 gcc_assert (TREE_CODE (node
) == TRY_FINALLY_EXPR
);
2871 node
= TREE_OPERAND (node
, 1);
2872 pp_string (pp
, "finally");
2873 if (TREE_CODE (node
) == EH_ELSE_EXPR
)
2875 newline_and_indent (pp
, spc
+2);
2877 newline_and_indent (pp
, spc
+4);
2878 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
+4,
2880 newline_and_indent (pp
, spc
+2);
2881 pp_right_brace (pp
);
2882 newline_and_indent (pp
, spc
);
2883 node
= TREE_OPERAND (node
, 1);
2884 pp_string (pp
, "else");
2887 newline_and_indent (pp
, spc
+2);
2889 newline_and_indent (pp
, spc
+4);
2890 dump_generic_node (pp
, node
, spc
+4, flags
, true);
2891 newline_and_indent (pp
, spc
+2);
2892 pp_right_brace (pp
);
2897 pp_string (pp
, "catch (");
2898 dump_generic_node (pp
, CATCH_TYPES (node
), spc
+2, flags
, false);
2899 pp_right_paren (pp
);
2900 newline_and_indent (pp
, spc
+2);
2902 newline_and_indent (pp
, spc
+4);
2903 dump_generic_node (pp
, CATCH_BODY (node
), spc
+4, flags
, true);
2904 newline_and_indent (pp
, spc
+2);
2905 pp_right_brace (pp
);
2909 case EH_FILTER_EXPR
:
2910 pp_string (pp
, "<<<eh_filter (");
2911 dump_generic_node (pp
, EH_FILTER_TYPES (node
), spc
+2, flags
, false);
2912 pp_string (pp
, ")>>>");
2913 newline_and_indent (pp
, spc
+2);
2915 newline_and_indent (pp
, spc
+4);
2916 dump_generic_node (pp
, EH_FILTER_FAILURE (node
), spc
+4, flags
, true);
2917 newline_and_indent (pp
, spc
+2);
2918 pp_right_brace (pp
);
2923 op0
= TREE_OPERAND (node
, 0);
2924 /* If this is for break or continue, don't bother printing it. */
2925 if (DECL_NAME (op0
))
2927 const char *name
= IDENTIFIER_POINTER (DECL_NAME (op0
));
2928 if (strcmp (name
, "break") == 0
2929 || strcmp (name
, "continue") == 0)
2932 dump_generic_node (pp
, op0
, spc
, flags
, false);
2934 if (DECL_NONLOCAL (op0
))
2935 pp_string (pp
, " [non-local]");
2939 pp_string (pp
, "while (1)");
2940 if (!(flags
& TDF_SLIM
))
2942 newline_and_indent (pp
, spc
+2);
2944 newline_and_indent (pp
, spc
+4);
2945 dump_generic_node (pp
, LOOP_EXPR_BODY (node
), spc
+4, flags
, true);
2946 newline_and_indent (pp
, spc
+2);
2947 pp_right_brace (pp
);
2953 pp_string (pp
, "// predicted ");
2954 if (PREDICT_EXPR_OUTCOME (node
))
2955 pp_string (pp
, "likely by ");
2957 pp_string (pp
, "unlikely by ");
2958 pp_string (pp
, predictor_name (PREDICT_EXPR_PREDICTOR (node
)));
2959 pp_string (pp
, " predictor.");
2963 pp_string (pp
, "ANNOTATE_EXPR <");
2964 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2965 switch ((enum annot_expr_kind
) TREE_INT_CST_LOW (TREE_OPERAND (node
, 1)))
2967 case annot_expr_ivdep_kind
:
2968 pp_string (pp
, ", ivdep");
2970 case annot_expr_unroll_kind
:
2971 pp_printf (pp
, ", unroll %d",
2972 (int) TREE_INT_CST_LOW (TREE_OPERAND (node
, 2)));
2974 case annot_expr_no_vector_kind
:
2975 pp_string (pp
, ", no-vector");
2977 case annot_expr_vector_kind
:
2978 pp_string (pp
, ", vector");
2980 case annot_expr_parallel_kind
:
2981 pp_string (pp
, ", parallel");
2990 pp_string (pp
, "return");
2991 op0
= TREE_OPERAND (node
, 0);
2995 if (TREE_CODE (op0
) == MODIFY_EXPR
)
2996 dump_generic_node (pp
, TREE_OPERAND (op0
, 1),
2999 dump_generic_node (pp
, op0
, spc
, flags
, false);
3004 pp_string (pp
, "if (");
3005 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3006 pp_string (pp
, ") break");
3010 pp_string (pp
, "switch (");
3011 dump_generic_node (pp
, SWITCH_COND (node
), spc
, flags
, false);
3012 pp_right_paren (pp
);
3013 if (!(flags
& TDF_SLIM
))
3015 newline_and_indent (pp
, spc
+2);
3017 if (SWITCH_BODY (node
))
3019 newline_and_indent (pp
, spc
+4);
3020 dump_generic_node (pp
, SWITCH_BODY (node
), spc
+4, flags
,
3023 newline_and_indent (pp
, spc
+2);
3024 pp_right_brace (pp
);
3030 op0
= GOTO_DESTINATION (node
);
3031 if (TREE_CODE (op0
) != SSA_NAME
&& DECL_P (op0
) && DECL_NAME (op0
))
3033 const char *name
= IDENTIFIER_POINTER (DECL_NAME (op0
));
3034 if (strcmp (name
, "break") == 0
3035 || strcmp (name
, "continue") == 0)
3037 pp_string (pp
, name
);
3041 pp_string (pp
, "goto ");
3042 dump_generic_node (pp
, op0
, spc
, flags
, false);
3046 pp_string (pp
, "__asm__");
3047 if (ASM_VOLATILE_P (node
))
3048 pp_string (pp
, " __volatile__");
3050 dump_generic_node (pp
, ASM_STRING (node
), spc
, flags
, false);
3052 dump_generic_node (pp
, ASM_OUTPUTS (node
), spc
, flags
, false);
3054 dump_generic_node (pp
, ASM_INPUTS (node
), spc
, flags
, false);
3055 if (ASM_CLOBBERS (node
))
3058 dump_generic_node (pp
, ASM_CLOBBERS (node
), spc
, flags
, false);
3060 pp_right_paren (pp
);
3063 case CASE_LABEL_EXPR
:
3064 if (CASE_LOW (node
) && CASE_HIGH (node
))
3066 pp_string (pp
, "case ");
3067 dump_generic_node (pp
, CASE_LOW (node
), spc
, flags
, false);
3068 pp_string (pp
, " ... ");
3069 dump_generic_node (pp
, CASE_HIGH (node
), spc
, flags
, false);
3071 else if (CASE_LOW (node
))
3073 pp_string (pp
, "case ");
3074 dump_generic_node (pp
, CASE_LOW (node
), spc
, flags
, false);
3077 pp_string (pp
, "default");
3082 pp_string (pp
, "OBJ_TYPE_REF(");
3083 dump_generic_node (pp
, OBJ_TYPE_REF_EXPR (node
), spc
, flags
, false);
3085 /* We omit the class type for -fcompare-debug because we may
3086 drop TYPE_BINFO early depending on debug info, and then
3087 virtual_method_call_p would return false, whereas when
3088 TYPE_BINFO is preserved it may still return true and then
3089 we'd print the class type. Compare tree and rtl dumps for
3090 libstdc++-prettyprinters/shared_ptr.cc with and without -g,
3091 for example, at occurrences of OBJ_TYPE_REF. */
3092 if (!(flags
& (TDF_SLIM
| TDF_COMPARE_DEBUG
))
3093 && virtual_method_call_p (node
))
3095 pp_string (pp
, "(");
3096 dump_generic_node (pp
, obj_type_ref_class (node
), spc
, flags
, false);
3097 pp_string (pp
, ")");
3099 dump_generic_node (pp
, OBJ_TYPE_REF_OBJECT (node
), spc
, flags
, false);
3101 dump_generic_node (pp
, OBJ_TYPE_REF_TOKEN (node
), spc
, flags
, false);
3102 pp_right_paren (pp
);
3106 if (SSA_NAME_IDENTIFIER (node
))
3108 if ((flags
& TDF_NOUID
)
3109 && SSA_NAME_VAR (node
)
3110 && DECL_NAMELESS (SSA_NAME_VAR (node
)))
3111 dump_fancy_name (pp
, SSA_NAME_IDENTIFIER (node
));
3112 else if (! (flags
& TDF_GIMPLE
)
3113 || SSA_NAME_VAR (node
))
3114 dump_generic_node (pp
, SSA_NAME_IDENTIFIER (node
),
3118 pp_decimal_int (pp
, SSA_NAME_VERSION (node
));
3119 if (SSA_NAME_IS_DEFAULT_DEF (node
))
3120 pp_string (pp
, "(D)");
3121 if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (node
))
3122 pp_string (pp
, "(ab)");
3125 case WITH_SIZE_EXPR
:
3126 pp_string (pp
, "WITH_SIZE_EXPR <");
3127 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3128 pp_string (pp
, ", ");
3129 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3134 pp_string (pp
, "ASSERT_EXPR <");
3135 dump_generic_node (pp
, ASSERT_EXPR_VAR (node
), spc
, flags
, false);
3136 pp_string (pp
, ", ");
3137 dump_generic_node (pp
, ASSERT_EXPR_COND (node
), spc
, flags
, false);
3142 pp_string (pp
, "scev_known");
3145 case SCEV_NOT_KNOWN
:
3146 pp_string (pp
, "scev_not_known");
3149 case POLYNOMIAL_CHREC
:
3151 dump_generic_node (pp
, CHREC_LEFT (node
), spc
, flags
, false);
3152 pp_string (pp
, ", +, ");
3153 dump_generic_node (pp
, CHREC_RIGHT (node
), spc
, flags
, false);
3154 pp_printf (pp
, "}_%u", CHREC_VARIABLE (node
));
3158 case REALIGN_LOAD_EXPR
:
3159 pp_string (pp
, "REALIGN_LOAD <");
3160 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3161 pp_string (pp
, ", ");
3162 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3163 pp_string (pp
, ", ");
3164 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3169 pp_string (pp
, " VEC_COND_EXPR < ");
3170 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3171 pp_string (pp
, " , ");
3172 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3173 pp_string (pp
, " , ");
3174 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3175 pp_string (pp
, " > ");
3179 pp_string (pp
, " VEC_PERM_EXPR < ");
3180 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3181 pp_string (pp
, " , ");
3182 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3183 pp_string (pp
, " , ");
3184 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3185 pp_string (pp
, " > ");
3189 pp_string (pp
, " DOT_PROD_EXPR < ");
3190 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3191 pp_string (pp
, ", ");
3192 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3193 pp_string (pp
, ", ");
3194 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3195 pp_string (pp
, " > ");
3198 case WIDEN_MULT_PLUS_EXPR
:
3199 pp_string (pp
, " WIDEN_MULT_PLUS_EXPR < ");
3200 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3201 pp_string (pp
, ", ");
3202 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3203 pp_string (pp
, ", ");
3204 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3205 pp_string (pp
, " > ");
3208 case WIDEN_MULT_MINUS_EXPR
:
3209 pp_string (pp
, " WIDEN_MULT_MINUS_EXPR < ");
3210 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3211 pp_string (pp
, ", ");
3212 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3213 pp_string (pp
, ", ");
3214 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3215 pp_string (pp
, " > ");
3219 pp_string (pp
, "#pragma acc parallel");
3220 goto dump_omp_clauses_body
;
3223 pp_string (pp
, "#pragma acc kernels");
3224 goto dump_omp_clauses_body
;
3227 pp_string (pp
, "#pragma acc data");
3228 dump_omp_clauses (pp
, OACC_DATA_CLAUSES (node
), spc
, flags
);
3231 case OACC_HOST_DATA
:
3232 pp_string (pp
, "#pragma acc host_data");
3233 dump_omp_clauses (pp
, OACC_HOST_DATA_CLAUSES (node
), spc
, flags
);
3237 pp_string (pp
, "#pragma acc declare");
3238 dump_omp_clauses (pp
, OACC_DECLARE_CLAUSES (node
), spc
, flags
);
3242 pp_string (pp
, "#pragma acc update");
3243 dump_omp_clauses (pp
, OACC_UPDATE_CLAUSES (node
), spc
, flags
);
3246 case OACC_ENTER_DATA
:
3247 pp_string (pp
, "#pragma acc enter data");
3248 dump_omp_clauses (pp
, OACC_ENTER_DATA_CLAUSES (node
), spc
, flags
);
3251 case OACC_EXIT_DATA
:
3252 pp_string (pp
, "#pragma acc exit data");
3253 dump_omp_clauses (pp
, OACC_EXIT_DATA_CLAUSES (node
), spc
, flags
);
3257 pp_string (pp
, "#pragma acc cache");
3258 dump_omp_clauses (pp
, OACC_CACHE_CLAUSES (node
), spc
, flags
);
3262 pp_string (pp
, "#pragma omp parallel");
3263 dump_omp_clauses (pp
, OMP_PARALLEL_CLAUSES (node
), spc
, flags
);
3266 dump_omp_clauses_body
:
3267 dump_omp_clauses (pp
, OMP_CLAUSES (node
), spc
, flags
);
3271 if (!(flags
& TDF_SLIM
) && OMP_BODY (node
))
3273 newline_and_indent (pp
, spc
+ 2);
3275 newline_and_indent (pp
, spc
+ 4);
3276 dump_generic_node (pp
, OMP_BODY (node
), spc
+ 4, flags
, false);
3277 newline_and_indent (pp
, spc
+ 2);
3278 pp_right_brace (pp
);
3284 pp_string (pp
, OMP_TASK_BODY (node
) ? "#pragma omp task"
3285 : "#pragma omp taskwait");
3286 dump_omp_clauses (pp
, OMP_TASK_CLAUSES (node
), spc
, flags
);
3290 pp_string (pp
, "#pragma omp for");
3294 pp_string (pp
, "#pragma omp simd");
3297 case OMP_DISTRIBUTE
:
3298 pp_string (pp
, "#pragma omp distribute");
3302 pp_string (pp
, "#pragma omp taskloop");
3306 pp_string (pp
, "#pragma omp loop");
3310 pp_string (pp
, "#pragma acc loop");
3314 pp_string (pp
, "#pragma omp teams");
3315 dump_omp_clauses (pp
, OMP_TEAMS_CLAUSES (node
), spc
, flags
);
3318 case OMP_TARGET_DATA
:
3319 pp_string (pp
, "#pragma omp target data");
3320 dump_omp_clauses (pp
, OMP_TARGET_DATA_CLAUSES (node
), spc
, flags
);
3323 case OMP_TARGET_ENTER_DATA
:
3324 pp_string (pp
, "#pragma omp target enter data");
3325 dump_omp_clauses (pp
, OMP_TARGET_ENTER_DATA_CLAUSES (node
), spc
, flags
);
3329 case OMP_TARGET_EXIT_DATA
:
3330 pp_string (pp
, "#pragma omp target exit data");
3331 dump_omp_clauses (pp
, OMP_TARGET_EXIT_DATA_CLAUSES (node
), spc
, flags
);
3336 pp_string (pp
, "#pragma omp target");
3337 dump_omp_clauses (pp
, OMP_TARGET_CLAUSES (node
), spc
, flags
);
3340 case OMP_TARGET_UPDATE
:
3341 pp_string (pp
, "#pragma omp target update");
3342 dump_omp_clauses (pp
, OMP_TARGET_UPDATE_CLAUSES (node
), spc
, flags
);
3347 dump_omp_clauses (pp
, OMP_FOR_CLAUSES (node
), spc
, flags
);
3348 if (!(flags
& TDF_SLIM
))
3352 if (OMP_FOR_PRE_BODY (node
))
3354 newline_and_indent (pp
, spc
+ 2);
3357 newline_and_indent (pp
, spc
);
3358 dump_generic_node (pp
, OMP_FOR_PRE_BODY (node
),
3361 if (OMP_FOR_INIT (node
))
3364 for (i
= 0; i
< TREE_VEC_LENGTH (OMP_FOR_INIT (node
)); i
++)
3367 newline_and_indent (pp
, spc
);
3368 pp_string (pp
, "for (");
3369 dump_generic_node (pp
,
3370 TREE_VEC_ELT (OMP_FOR_INIT (node
), i
),
3372 pp_string (pp
, "; ");
3373 dump_generic_node (pp
,
3374 TREE_VEC_ELT (OMP_FOR_COND (node
), i
),
3376 pp_string (pp
, "; ");
3377 dump_generic_node (pp
,
3378 TREE_VEC_ELT (OMP_FOR_INCR (node
), i
),
3380 pp_right_paren (pp
);
3383 if (OMP_FOR_BODY (node
))
3385 newline_and_indent (pp
, spc
+ 2);
3387 newline_and_indent (pp
, spc
+ 4);
3388 dump_generic_node (pp
, OMP_FOR_BODY (node
), spc
+ 4, flags
,
3390 newline_and_indent (pp
, spc
+ 2);
3391 pp_right_brace (pp
);
3393 if (OMP_FOR_INIT (node
))
3394 spc
-= 2 * TREE_VEC_LENGTH (OMP_FOR_INIT (node
)) - 2;
3395 if (OMP_FOR_PRE_BODY (node
))
3398 newline_and_indent (pp
, spc
+ 2);
3399 pp_right_brace (pp
);
3406 pp_string (pp
, "#pragma omp sections");
3407 dump_omp_clauses (pp
, OMP_SECTIONS_CLAUSES (node
), spc
, flags
);
3411 pp_string (pp
, "#pragma omp section");
3415 if (OMP_SCAN_CLAUSES (node
))
3417 pp_string (pp
, "#pragma omp scan");
3418 dump_omp_clauses (pp
, OMP_SCAN_CLAUSES (node
), spc
, flags
);
3423 pp_string (pp
, "#pragma omp master");
3427 pp_string (pp
, "#pragma omp taskgroup");
3428 dump_omp_clauses (pp
, OMP_TASKGROUP_CLAUSES (node
), spc
, flags
);
3432 pp_string (pp
, "#pragma omp ordered");
3433 dump_omp_clauses (pp
, OMP_ORDERED_CLAUSES (node
), spc
, flags
);
3437 pp_string (pp
, "#pragma omp critical");
3438 if (OMP_CRITICAL_NAME (node
))
3442 dump_generic_node (pp
, OMP_CRITICAL_NAME (node
), spc
,
3444 pp_right_paren (pp
);
3446 dump_omp_clauses (pp
, OMP_CRITICAL_CLAUSES (node
), spc
, flags
);
3450 pp_string (pp
, "#pragma omp atomic");
3451 dump_omp_atomic_memory_order (pp
, OMP_ATOMIC_MEMORY_ORDER (node
));
3452 newline_and_indent (pp
, spc
+ 2);
3453 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3457 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3460 case OMP_ATOMIC_READ
:
3461 pp_string (pp
, "#pragma omp atomic read");
3462 dump_omp_atomic_memory_order (pp
, OMP_ATOMIC_MEMORY_ORDER (node
));
3463 newline_and_indent (pp
, spc
+ 2);
3464 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3468 case OMP_ATOMIC_CAPTURE_OLD
:
3469 case OMP_ATOMIC_CAPTURE_NEW
:
3470 pp_string (pp
, "#pragma omp atomic capture");
3471 dump_omp_atomic_memory_order (pp
, OMP_ATOMIC_MEMORY_ORDER (node
));
3472 newline_and_indent (pp
, spc
+ 2);
3473 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3477 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3481 pp_string (pp
, "#pragma omp single");
3482 dump_omp_clauses (pp
, OMP_SINGLE_CLAUSES (node
), spc
, flags
);
3486 dump_omp_clause (pp
, node
, spc
, flags
);
3490 case TRANSACTION_EXPR
:
3491 if (TRANSACTION_EXPR_OUTER (node
))
3492 pp_string (pp
, "__transaction_atomic [[outer]]");
3493 else if (TRANSACTION_EXPR_RELAXED (node
))
3494 pp_string (pp
, "__transaction_relaxed");
3496 pp_string (pp
, "__transaction_atomic");
3497 if (!(flags
& TDF_SLIM
) && TRANSACTION_EXPR_BODY (node
))
3499 newline_and_indent (pp
, spc
);
3501 newline_and_indent (pp
, spc
+ 2);
3502 dump_generic_node (pp
, TRANSACTION_EXPR_BODY (node
),
3503 spc
+ 2, flags
, false);
3504 newline_and_indent (pp
, spc
);
3505 pp_right_brace (pp
);
3510 case VEC_SERIES_EXPR
:
3511 case VEC_WIDEN_MULT_HI_EXPR
:
3512 case VEC_WIDEN_MULT_LO_EXPR
:
3513 case VEC_WIDEN_MULT_EVEN_EXPR
:
3514 case VEC_WIDEN_MULT_ODD_EXPR
:
3515 case VEC_WIDEN_LSHIFT_HI_EXPR
:
3516 case VEC_WIDEN_LSHIFT_LO_EXPR
:
3518 for (str
= get_tree_code_name (code
); *str
; str
++)
3519 pp_character (pp
, TOUPPER (*str
));
3520 pp_string (pp
, " < ");
3521 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3522 pp_string (pp
, ", ");
3523 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3524 pp_string (pp
, " > ");
3527 case VEC_DUPLICATE_EXPR
:
3529 for (str
= get_tree_code_name (code
); *str
; str
++)
3530 pp_character (pp
, TOUPPER (*str
));
3531 pp_string (pp
, " < ");
3532 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3533 pp_string (pp
, " > ");
3536 case VEC_UNPACK_HI_EXPR
:
3537 pp_string (pp
, " VEC_UNPACK_HI_EXPR < ");
3538 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3539 pp_string (pp
, " > ");
3542 case VEC_UNPACK_LO_EXPR
:
3543 pp_string (pp
, " VEC_UNPACK_LO_EXPR < ");
3544 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3545 pp_string (pp
, " > ");
3548 case VEC_UNPACK_FLOAT_HI_EXPR
:
3549 pp_string (pp
, " VEC_UNPACK_FLOAT_HI_EXPR < ");
3550 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3551 pp_string (pp
, " > ");
3554 case VEC_UNPACK_FLOAT_LO_EXPR
:
3555 pp_string (pp
, " VEC_UNPACK_FLOAT_LO_EXPR < ");
3556 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3557 pp_string (pp
, " > ");
3560 case VEC_UNPACK_FIX_TRUNC_HI_EXPR
:
3561 pp_string (pp
, " VEC_UNPACK_FIX_TRUNC_HI_EXPR < ");
3562 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3563 pp_string (pp
, " > ");
3566 case VEC_UNPACK_FIX_TRUNC_LO_EXPR
:
3567 pp_string (pp
, " VEC_UNPACK_FIX_TRUNC_LO_EXPR < ");
3568 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3569 pp_string (pp
, " > ");
3572 case VEC_PACK_TRUNC_EXPR
:
3573 pp_string (pp
, " VEC_PACK_TRUNC_EXPR < ");
3574 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3575 pp_string (pp
, ", ");
3576 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3577 pp_string (pp
, " > ");
3580 case VEC_PACK_SAT_EXPR
:
3581 pp_string (pp
, " VEC_PACK_SAT_EXPR < ");
3582 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3583 pp_string (pp
, ", ");
3584 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3585 pp_string (pp
, " > ");
3588 case VEC_PACK_FIX_TRUNC_EXPR
:
3589 pp_string (pp
, " VEC_PACK_FIX_TRUNC_EXPR < ");
3590 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3591 pp_string (pp
, ", ");
3592 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3593 pp_string (pp
, " > ");
3596 case VEC_PACK_FLOAT_EXPR
:
3597 pp_string (pp
, " VEC_PACK_FLOAT_EXPR < ");
3598 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3599 pp_string (pp
, ", ");
3600 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3601 pp_string (pp
, " > ");
3605 dump_block_node (pp
, node
, spc
, flags
);
3608 case DEBUG_BEGIN_STMT
:
3609 pp_string (pp
, "# DEBUG BEGIN STMT");
3616 if (is_stmt
&& is_expr
)
3622 /* Print the declaration of a variable. */
3625 print_declaration (pretty_printer
*pp
, tree t
, int spc
, dump_flags_t flags
)
3629 if (TREE_CODE(t
) == NAMELIST_DECL
)
3631 pp_string(pp
, "namelist ");
3632 dump_decl_name (pp
, t
, flags
);
3637 if (TREE_CODE (t
) == TYPE_DECL
)
3638 pp_string (pp
, "typedef ");
3640 if (CODE_CONTAINS_STRUCT (TREE_CODE (t
), TS_DECL_WRTL
) && DECL_REGISTER (t
))
3641 pp_string (pp
, "register ");
3643 if (TREE_PUBLIC (t
) && DECL_EXTERNAL (t
))
3644 pp_string (pp
, "extern ");
3645 else if (TREE_STATIC (t
))
3646 pp_string (pp
, "static ");
3648 /* Print the type and name. */
3649 if (TREE_TYPE (t
) && TREE_CODE (TREE_TYPE (t
)) == ARRAY_TYPE
)
3653 /* Print array's type. */
3654 tmp
= TREE_TYPE (t
);
3655 while (TREE_CODE (TREE_TYPE (tmp
)) == ARRAY_TYPE
)
3656 tmp
= TREE_TYPE (tmp
);
3657 dump_generic_node (pp
, TREE_TYPE (tmp
), spc
, flags
, false);
3659 /* Print variable's name. */
3661 dump_generic_node (pp
, t
, spc
, flags
, false);
3663 /* Print the dimensions. */
3664 tmp
= TREE_TYPE (t
);
3665 while (TREE_CODE (tmp
) == ARRAY_TYPE
)
3667 dump_array_domain (pp
, TYPE_DOMAIN (tmp
), spc
, flags
);
3668 tmp
= TREE_TYPE (tmp
);
3671 else if (TREE_CODE (t
) == FUNCTION_DECL
)
3673 dump_generic_node (pp
, TREE_TYPE (TREE_TYPE (t
)), spc
, flags
, false);
3675 dump_decl_name (pp
, t
, flags
);
3676 dump_function_declaration (pp
, TREE_TYPE (t
), spc
, flags
);
3680 /* Print type declaration. */
3681 dump_generic_node (pp
, TREE_TYPE (t
), spc
, flags
, false);
3683 /* Print variable's name. */
3685 dump_generic_node (pp
, t
, spc
, flags
, false);
3688 if (VAR_P (t
) && DECL_HARD_REGISTER (t
))
3690 pp_string (pp
, " __asm__ ");
3692 dump_generic_node (pp
, DECL_ASSEMBLER_NAME (t
), spc
, flags
, false);
3693 pp_right_paren (pp
);
3696 /* The initial value of a function serves to determine whether the function
3697 is declared or defined. So the following does not apply to function
3699 if (TREE_CODE (t
) != FUNCTION_DECL
)
3701 /* Print the initial value. */
3702 if (DECL_INITIAL (t
))
3707 if (!(flags
& TDF_SLIM
))
3708 dump_generic_node (pp
, DECL_INITIAL (t
), spc
, flags
, false);
3710 pp_string (pp
, "<<< omitted >>>");
3714 if (VAR_P (t
) && DECL_HAS_VALUE_EXPR_P (t
))
3716 pp_string (pp
, " [value-expr: ");
3717 dump_generic_node (pp
, DECL_VALUE_EXPR (t
), spc
, flags
, false);
3718 pp_right_bracket (pp
);
3725 /* Prints a structure: name, fields, and methods.
3726 FIXME: Still incomplete. */
3729 print_struct_decl (pretty_printer
*pp
, const_tree node
, int spc
,
3732 /* Print the name of the structure. */
3733 if (TYPE_NAME (node
))
3736 if (TREE_CODE (node
) == RECORD_TYPE
)
3737 pp_string (pp
, "struct ");
3738 else if ((TREE_CODE (node
) == UNION_TYPE
3739 || TREE_CODE (node
) == QUAL_UNION_TYPE
))
3740 pp_string (pp
, "union ");
3742 dump_generic_node (pp
, TYPE_NAME (node
), spc
, TDF_NONE
, false);
3745 /* Print the contents of the structure. */
3751 /* Print the fields of the structure. */
3754 tmp
= TYPE_FIELDS (node
);
3757 /* Avoid to print recursively the structure. */
3758 /* FIXME : Not implemented correctly...,
3759 what about the case when we have a cycle in the contain graph? ...
3760 Maybe this could be solved by looking at the scope in which the
3761 structure was declared. */
3762 if (TREE_TYPE (tmp
) != node
3763 && (TREE_CODE (TREE_TYPE (tmp
)) != POINTER_TYPE
3764 || TREE_TYPE (TREE_TYPE (tmp
)) != node
))
3766 print_declaration (pp
, tmp
, spc
+2, flags
);
3769 tmp
= DECL_CHAIN (tmp
);
3773 pp_right_brace (pp
);
3776 /* Return the priority of the operator CODE.
3778 From lowest to highest precedence with either left-to-right (L-R)
3779 or right-to-left (R-L) associativity]:
3782 2 [R-L] = += -= *= /= %= &= ^= |= <<= >>=
3794 14 [R-L] ! ~ ++ -- + - * & (type) sizeof
3795 15 [L-R] fn() [] -> .
3797 unary +, - and * have higher precedence than the corresponding binary
3801 op_code_prio (enum tree_code code
)
3818 case TRUTH_ORIF_EXPR
:
3821 case TRUTH_AND_EXPR
:
3822 case TRUTH_ANDIF_EXPR
:
3829 case TRUTH_XOR_EXPR
:
3846 case UNORDERED_EXPR
:
3857 case VEC_WIDEN_LSHIFT_HI_EXPR
:
3858 case VEC_WIDEN_LSHIFT_LO_EXPR
:
3859 case WIDEN_LSHIFT_EXPR
:
3862 case WIDEN_SUM_EXPR
:
3864 case POINTER_PLUS_EXPR
:
3865 case POINTER_DIFF_EXPR
:
3869 case VEC_WIDEN_MULT_HI_EXPR
:
3870 case VEC_WIDEN_MULT_LO_EXPR
:
3871 case WIDEN_MULT_EXPR
:
3873 case WIDEN_MULT_PLUS_EXPR
:
3874 case WIDEN_MULT_MINUS_EXPR
:
3876 case MULT_HIGHPART_EXPR
:
3877 case TRUNC_DIV_EXPR
:
3879 case FLOOR_DIV_EXPR
:
3880 case ROUND_DIV_EXPR
:
3882 case EXACT_DIV_EXPR
:
3883 case TRUNC_MOD_EXPR
:
3885 case FLOOR_MOD_EXPR
:
3886 case ROUND_MOD_EXPR
:
3889 case TRUTH_NOT_EXPR
:
3891 case POSTINCREMENT_EXPR
:
3892 case POSTDECREMENT_EXPR
:
3893 case PREINCREMENT_EXPR
:
3894 case PREDECREMENT_EXPR
:
3900 case FIX_TRUNC_EXPR
:
3906 case ARRAY_RANGE_REF
:
3910 /* Special expressions. */
3916 case VEC_UNPACK_HI_EXPR
:
3917 case VEC_UNPACK_LO_EXPR
:
3918 case VEC_UNPACK_FLOAT_HI_EXPR
:
3919 case VEC_UNPACK_FLOAT_LO_EXPR
:
3920 case VEC_UNPACK_FIX_TRUNC_HI_EXPR
:
3921 case VEC_UNPACK_FIX_TRUNC_LO_EXPR
:
3922 case VEC_PACK_TRUNC_EXPR
:
3923 case VEC_PACK_SAT_EXPR
:
3927 /* Return an arbitrarily high precedence to avoid surrounding single
3928 VAR_DECLs in ()s. */
3933 /* Return the priority of the operator OP. */
3936 op_prio (const_tree op
)
3938 enum tree_code code
;
3943 code
= TREE_CODE (op
);
3944 if (code
== SAVE_EXPR
|| code
== NON_LVALUE_EXPR
)
3945 return op_prio (TREE_OPERAND (op
, 0));
3947 return op_code_prio (code
);
3950 /* Return the symbol associated with operator CODE. */
3953 op_symbol_code (enum tree_code code
)
3961 case TRUTH_ORIF_EXPR
:
3964 case TRUTH_AND_EXPR
:
3965 case TRUTH_ANDIF_EXPR
:
3971 case TRUTH_XOR_EXPR
:
3981 case UNORDERED_EXPR
:
4027 case WIDEN_LSHIFT_EXPR
:
4030 case POINTER_PLUS_EXPR
:
4036 case WIDEN_SUM_EXPR
:
4039 case WIDEN_MULT_EXPR
:
4042 case MULT_HIGHPART_EXPR
:
4047 case POINTER_DIFF_EXPR
:
4053 case TRUTH_NOT_EXPR
:
4060 case TRUNC_DIV_EXPR
:
4067 case FLOOR_DIV_EXPR
:
4070 case ROUND_DIV_EXPR
:
4073 case EXACT_DIV_EXPR
:
4076 case TRUNC_MOD_EXPR
:
4082 case FLOOR_MOD_EXPR
:
4085 case ROUND_MOD_EXPR
:
4088 case PREDECREMENT_EXPR
:
4091 case PREINCREMENT_EXPR
:
4094 case POSTDECREMENT_EXPR
:
4097 case POSTINCREMENT_EXPR
:
4107 return "<<< ??? >>>";
4111 /* Return the symbol associated with operator OP. */
4114 op_symbol (const_tree op
)
4116 return op_symbol_code (TREE_CODE (op
));
4119 /* Prints the name of a call. NODE is the CALL_EXPR_FN of a CALL_EXPR or
4120 the gimple_call_fn of a GIMPLE_CALL. */
4123 print_call_name (pretty_printer
*pp
, tree node
, dump_flags_t flags
)
4127 if (TREE_CODE (op0
) == NON_LVALUE_EXPR
)
4128 op0
= TREE_OPERAND (op0
, 0);
4131 switch (TREE_CODE (op0
))
4136 dump_function_name (pp
, op0
, flags
);
4142 op0
= TREE_OPERAND (op0
, 0);
4147 dump_generic_node (pp
, TREE_OPERAND (op0
, 0), 0, flags
, false);
4148 pp_string (pp
, ") ? ");
4149 dump_generic_node (pp
, TREE_OPERAND (op0
, 1), 0, flags
, false);
4150 pp_string (pp
, " : ");
4151 dump_generic_node (pp
, TREE_OPERAND (op0
, 2), 0, flags
, false);
4155 if (TREE_CODE (TREE_OPERAND (op0
, 0)) == VAR_DECL
)
4156 dump_function_name (pp
, TREE_OPERAND (op0
, 0), flags
);
4158 dump_generic_node (pp
, op0
, 0, flags
, false);
4162 if (integer_zerop (TREE_OPERAND (op0
, 1)))
4164 op0
= TREE_OPERAND (op0
, 0);
4171 dump_generic_node (pp
, op0
, 0, flags
, false);
4179 /* Print the first N characters in the array STR, replacing non-printable
4180 characters (including embedded nuls) with unambiguous escape sequences. */
4183 pretty_print_string (pretty_printer
*pp
, const char *str
, unsigned n
)
4188 for ( ; n
; --n
, ++str
)
4193 pp_string (pp
, "\\b");
4197 pp_string (pp
, "\\f");
4201 pp_string (pp
, "\\n");
4205 pp_string (pp
, "\\r");
4209 pp_string (pp
, "\\t");
4213 pp_string (pp
, "\\v");
4217 pp_string (pp
, "\\\\");
4221 pp_string (pp
, "\\\"");
4225 pp_string (pp
, "\\'");
4229 if (str
[0] || n
> 1)
4231 if (!ISPRINT (str
[0]))
4234 sprintf (buf
, "\\x%02x", (unsigned char)str
[0]);
4235 pp_string (pp
, buf
);
4238 pp_character (pp
, str
[0]);
4246 maybe_init_pretty_print (FILE *file
)
4250 tree_pp
= new pretty_printer ();
4251 pp_needs_newline (tree_pp
) = true;
4252 pp_translate_identifiers (tree_pp
) = false;
4255 tree_pp
->buffer
->stream
= file
;
4259 newline_and_indent (pretty_printer
*pp
, int spc
)
4265 /* Handle the %K format for TEXT. Separate from default_tree_printer
4266 so it can also be used in front ends.
4267 The location LOC and BLOCK are expected to be extracted by the caller
4268 from the %K argument arg via EXPR_LOCATION(arg) and TREE_BLOCK(arg). */
4271 percent_K_format (text_info
*text
, location_t loc
, tree block
)
4273 text
->set_location (0, loc
, SHOW_RANGE_WITH_CARET
);
4274 gcc_assert (pp_ti_abstract_origin (text
) != NULL
);
4275 *pp_ti_abstract_origin (text
) = NULL
;
4278 && TREE_CODE (block
) == BLOCK
4279 && BLOCK_ABSTRACT_ORIGIN (block
))
4281 tree ao
= BLOCK_ABSTRACT_ORIGIN (block
);
4282 if (TREE_CODE (ao
) == FUNCTION_DECL
)
4284 *pp_ti_abstract_origin (text
) = block
;
4287 block
= BLOCK_SUPERCONTEXT (block
);
4291 /* Print the identifier ID to PRETTY-PRINTER. */
4294 pp_tree_identifier (pretty_printer
*pp
, tree id
)
4296 if (pp_translate_identifiers (pp
))
4298 const char *text
= identifier_to_locale (IDENTIFIER_POINTER (id
));
4299 pp_append_text (pp
, text
, text
+ strlen (text
));
4302 pp_append_text (pp
, IDENTIFIER_POINTER (id
),
4303 IDENTIFIER_POINTER (id
) + IDENTIFIER_LENGTH (id
));
4306 /* A helper function that is used to dump function information before the
4310 dump_function_header (FILE *dump_file
, tree fdecl
, dump_flags_t flags
)
4312 const char *dname
, *aname
;
4313 struct cgraph_node
*node
= cgraph_node::get (fdecl
);
4314 struct function
*fun
= DECL_STRUCT_FUNCTION (fdecl
);
4316 dname
= lang_hooks
.decl_printable_name (fdecl
, 1);
4318 if (DECL_ASSEMBLER_NAME_SET_P (fdecl
))
4319 aname
= (IDENTIFIER_POINTER
4320 (DECL_ASSEMBLER_NAME (fdecl
)));
4322 aname
= "<unset-asm-name>";
4324 fprintf (dump_file
, "\n;; Function %s (%s, funcdef_no=%d",
4325 dname
, aname
, fun
->funcdef_no
);
4326 if (!(flags
& TDF_NOUID
))
4327 fprintf (dump_file
, ", decl_uid=%d", DECL_UID (fdecl
));
4330 fprintf (dump_file
, ", cgraph_uid=%d", node
->get_uid ());
4331 fprintf (dump_file
, ", symbol_order=%d)%s\n\n", node
->order
,
4332 node
->frequency
== NODE_FREQUENCY_HOT
4334 : node
->frequency
== NODE_FREQUENCY_UNLIKELY_EXECUTED
4335 ? " (unlikely executed)"
4336 : node
->frequency
== NODE_FREQUENCY_EXECUTED_ONCE
4337 ? " (executed once)"
4341 fprintf (dump_file
, ")\n\n");
4344 /* Dump double_int D to pretty_printer PP. UNS is true
4345 if D is unsigned and false otherwise. */
4347 pp_double_int (pretty_printer
*pp
, double_int d
, bool uns
)
4350 pp_wide_integer (pp
, d
.low
);
4351 else if (d
.fits_uhwi ())
4352 pp_unsigned_wide_integer (pp
, d
.low
);
4355 unsigned HOST_WIDE_INT low
= d
.low
;
4356 HOST_WIDE_INT high
= d
.high
;
4357 if (!uns
&& d
.is_negative ())
4360 high
= ~high
+ !low
;
4363 /* Would "%x%0*x" or "%x%*0x" get zero-padding on all
4365 sprintf (pp_buffer (pp
)->digit_buffer
,
4366 HOST_WIDE_INT_PRINT_DOUBLE_HEX
,
4367 (unsigned HOST_WIDE_INT
) high
, low
);
4368 pp_string (pp
, pp_buffer (pp
)->digit_buffer
);
4373 # pragma GCC diagnostic pop