1 /* Pretty formatting of GENERIC trees in C syntax.
2 Copyright (C) 2001-2016 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 /* Local functions, macros and variables. */
38 static const char *op_symbol (const_tree
);
39 static void pretty_print_string (pretty_printer
*, const char*);
40 static void newline_and_indent (pretty_printer
*, int);
41 static void maybe_init_pretty_print (FILE *);
42 static void print_struct_decl (pretty_printer
*, const_tree
, int, int);
43 static void do_niy (pretty_printer
*, const_tree
, int);
45 #define INDENT(SPACE) do { \
46 int i; for (i = 0; i<SPACE; i++) pp_space (pp); } while (0)
48 #define NIY do_niy (pp, node, flags)
50 static pretty_printer
*tree_pp
;
52 /* Try to print something for an unknown tree code. */
55 do_niy (pretty_printer
*pp
, const_tree node
, int flags
)
59 pp_string (pp
, "<<< Unknown tree: ");
60 pp_string (pp
, get_tree_code_name (TREE_CODE (node
)));
64 len
= TREE_OPERAND_LENGTH (node
);
65 for (i
= 0; i
< len
; ++i
)
67 newline_and_indent (pp
, 2);
68 dump_generic_node (pp
, TREE_OPERAND (node
, i
), 2, flags
, false);
72 pp_string (pp
, " >>>");
75 /* Debugging function to print out a generic expression. */
78 debug_generic_expr (tree t
)
80 print_generic_expr (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
);
81 fprintf (stderr
, "\n");
84 /* Debugging function to print out a generic statement. */
87 debug_generic_stmt (tree t
)
89 print_generic_stmt (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
);
90 fprintf (stderr
, "\n");
93 /* Debugging function to print out a chain of trees . */
96 debug_tree_chain (tree t
)
102 print_generic_expr (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
|TDF_UID
);
103 fprintf (stderr
, " ");
107 fprintf (stderr
, "... [cycled back to ");
108 print_generic_expr (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
|TDF_UID
);
109 fprintf (stderr
, "]");
113 fprintf (stderr
, "\n");
116 /* Prints declaration DECL to the FILE with details specified by FLAGS. */
118 print_generic_decl (FILE *file
, tree decl
, int flags
)
120 maybe_init_pretty_print (file
);
121 print_declaration (tree_pp
, decl
, 2, flags
);
122 pp_write_text_to_stream (tree_pp
);
125 /* Print tree T, and its successors, on file FILE. FLAGS specifies details
126 to show in the dump. See TDF_* in dumpfile.h. */
129 print_generic_stmt (FILE *file
, tree t
, int flags
)
131 maybe_init_pretty_print (file
);
132 dump_generic_node (tree_pp
, t
, 0, flags
, true);
133 pp_newline_and_flush (tree_pp
);
136 /* Print tree T, and its successors, on file FILE. FLAGS specifies details
137 to show in the dump. See TDF_* in dumpfile.h. The output is indented by
141 print_generic_stmt_indented (FILE *file
, tree t
, int flags
, int indent
)
145 maybe_init_pretty_print (file
);
147 for (i
= 0; i
< indent
; i
++)
149 dump_generic_node (tree_pp
, t
, indent
, flags
, true);
150 pp_newline_and_flush (tree_pp
);
153 /* Print a single expression T on file FILE. FLAGS specifies details to show
154 in the dump. See TDF_* in dumpfile.h. */
157 print_generic_expr (FILE *file
, tree t
, int flags
)
159 maybe_init_pretty_print (file
);
160 dump_generic_node (tree_pp
, t
, 0, flags
, false);
164 /* Dump NAME, an IDENTIFIER_POINTER, sanitized so that D<num> sequences
165 in it are replaced with Dxxxx, as long as they are at the start or
166 preceded by $ and at the end or followed by $. See make_fancy_name
170 dump_fancy_name (pretty_printer
*pp
, tree name
)
173 int length
= IDENTIFIER_LENGTH (name
);
174 const char *n
= IDENTIFIER_POINTER (name
);
181 && (n
== IDENTIFIER_POINTER (name
) || n
[-1] == '$'))
184 while (ISDIGIT (n
[l
]))
186 if (n
[l
] == '\0' || n
[l
] == '$')
199 pp_tree_identifier (pp
, name
);
203 char *str
= XNEWVEC (char, length
+ 1);
206 q
= n
= IDENTIFIER_POINTER (name
);
213 && (q
== IDENTIFIER_POINTER (name
) || q
[-1] == '$'))
216 while (ISDIGIT (q
[l
]))
218 if (q
[l
] == '\0' || q
[l
] == '$')
220 memcpy (p
, n
, q
- n
);
221 memcpy (p
+ (q
- n
), "Dxxxx", 5);
231 memcpy (p
, n
, IDENTIFIER_LENGTH (name
) - (n
- IDENTIFIER_POINTER (name
)));
233 if (pp_translate_identifiers (pp
))
235 const char *text
= identifier_to_locale (str
);
236 pp_append_text (pp
, text
, text
+ strlen (text
));
239 pp_append_text (pp
, str
, str
+ length
);
243 /* Dump the name of a _DECL node and its DECL_UID if TDF_UID is set
247 dump_decl_name (pretty_printer
*pp
, tree node
, int flags
)
249 if (DECL_NAME (node
))
251 if ((flags
& TDF_ASMNAME
) && DECL_ASSEMBLER_NAME_SET_P (node
))
252 pp_tree_identifier (pp
, DECL_ASSEMBLER_NAME (node
));
253 /* For DECL_NAMELESS names look for embedded uids in the
254 names and sanitize them for TDF_NOUID. */
255 else if ((flags
& TDF_NOUID
) && DECL_NAMELESS (node
))
256 dump_fancy_name (pp
, DECL_NAME (node
));
258 pp_tree_identifier (pp
, DECL_NAME (node
));
260 char uid_sep
= (flags
& TDF_GIMPLE
) ? '_' : '.';
261 if ((flags
& TDF_UID
) || DECL_NAME (node
) == NULL_TREE
)
263 if (TREE_CODE (node
) == LABEL_DECL
&& LABEL_DECL_UID (node
) != -1)
264 pp_printf (pp
, "L%c%d", uid_sep
, (int) LABEL_DECL_UID (node
));
265 else if (TREE_CODE (node
) == DEBUG_EXPR_DECL
)
267 if (flags
& TDF_NOUID
)
268 pp_string (pp
, "D#xxxx");
270 pp_printf (pp
, "D#%i", DEBUG_TEMP_UID (node
));
274 char c
= TREE_CODE (node
) == CONST_DECL
? 'C' : 'D';
275 if (flags
& TDF_NOUID
)
276 pp_printf (pp
, "%c.xxxx", c
);
278 pp_printf (pp
, "%c%c%u", c
, uid_sep
, DECL_UID (node
));
281 if ((flags
& TDF_ALIAS
) && DECL_PT_UID (node
) != DECL_UID (node
))
283 if (flags
& TDF_NOUID
)
284 pp_printf (pp
, "ptD.xxxx");
286 pp_printf (pp
, "ptD.%u", DECL_PT_UID (node
));
290 /* Like the above, but used for pretty printing function calls. */
293 dump_function_name (pretty_printer
*pp
, tree node
, int flags
)
295 if (CONVERT_EXPR_P (node
))
296 node
= TREE_OPERAND (node
, 0);
297 if (DECL_NAME (node
) && (flags
& TDF_ASMNAME
) == 0)
298 pp_string (pp
, lang_hooks
.decl_printable_name (node
, 1));
300 dump_decl_name (pp
, node
, flags
);
303 /* Dump a function declaration. NODE is the FUNCTION_TYPE. PP, SPC and
304 FLAGS are as in dump_generic_node. */
307 dump_function_declaration (pretty_printer
*pp
, tree node
,
310 bool wrote_arg
= false;
316 /* Print the argument types. */
317 arg
= TYPE_ARG_TYPES (node
);
318 while (arg
&& arg
!= void_list_node
&& arg
!= error_mark_node
)
326 dump_generic_node (pp
, TREE_VALUE (arg
), spc
, flags
, false);
327 arg
= TREE_CHAIN (arg
);
330 /* Drop the trailing void_type_node if we had any previous argument. */
331 if (arg
== void_list_node
&& !wrote_arg
)
332 pp_string (pp
, "void");
333 /* Properly dump vararg function types. */
334 else if (!arg
&& wrote_arg
)
335 pp_string (pp
, ", ...");
336 /* Avoid printing any arg for unprototyped functions. */
341 /* Dump the domain associated with an array. */
344 dump_array_domain (pretty_printer
*pp
, tree domain
, int spc
, int flags
)
346 pp_left_bracket (pp
);
349 tree min
= TYPE_MIN_VALUE (domain
);
350 tree max
= TYPE_MAX_VALUE (domain
);
353 && integer_zerop (min
)
354 && tree_fits_shwi_p (max
))
355 pp_wide_integer (pp
, tree_to_shwi (max
) + 1);
359 dump_generic_node (pp
, min
, spc
, flags
, false);
362 dump_generic_node (pp
, max
, spc
, flags
, false);
366 pp_string (pp
, "<unknown>");
367 pp_right_bracket (pp
);
371 /* Dump OpenMP clause CLAUSE. PP, CLAUSE, SPC and FLAGS are as in
372 dump_generic_node. */
375 dump_omp_clause (pretty_printer
*pp
, tree clause
, int spc
, int flags
)
379 switch (OMP_CLAUSE_CODE (clause
))
381 case OMP_CLAUSE_PRIVATE
:
384 case OMP_CLAUSE_SHARED
:
387 case OMP_CLAUSE_FIRSTPRIVATE
:
388 name
= "firstprivate";
390 case OMP_CLAUSE_LASTPRIVATE
:
391 name
= "lastprivate";
393 case OMP_CLAUSE_COPYIN
:
396 case OMP_CLAUSE_COPYPRIVATE
:
397 name
= "copyprivate";
399 case OMP_CLAUSE_UNIFORM
:
402 case OMP_CLAUSE_USE_DEVICE_PTR
:
403 name
= "use_device_ptr";
405 case OMP_CLAUSE_IS_DEVICE_PTR
:
406 name
= "is_device_ptr";
408 case OMP_CLAUSE__LOOPTEMP_
:
411 case OMP_CLAUSE_TO_DECLARE
:
414 case OMP_CLAUSE_LINK
:
418 pp_string (pp
, name
);
420 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
425 case OMP_CLAUSE_REDUCTION
:
426 pp_string (pp
, "reduction(");
427 if (OMP_CLAUSE_REDUCTION_CODE (clause
) != ERROR_MARK
)
430 op_symbol_code (OMP_CLAUSE_REDUCTION_CODE (clause
)));
433 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
439 pp_string (pp
, "if(");
440 switch (OMP_CLAUSE_IF_MODIFIER (clause
))
442 case ERROR_MARK
: break;
443 case OMP_PARALLEL
: pp_string (pp
, "parallel:"); break;
444 case OMP_TASK
: pp_string (pp
, "task:"); break;
445 case OMP_TASKLOOP
: pp_string (pp
, "taskloop:"); break;
446 case OMP_TARGET_DATA
: pp_string (pp
, "target data:"); break;
447 case OMP_TARGET
: pp_string (pp
, "target:"); break;
448 case OMP_TARGET_UPDATE
: pp_string (pp
, "target update:"); break;
449 case OMP_TARGET_ENTER_DATA
:
450 pp_string (pp
, "target enter data:"); break;
451 case OMP_TARGET_EXIT_DATA
: pp_string (pp
, "target exit data:"); break;
452 default: gcc_unreachable ();
454 dump_generic_node (pp
, OMP_CLAUSE_IF_EXPR (clause
),
459 case OMP_CLAUSE_NUM_THREADS
:
460 pp_string (pp
, "num_threads(");
461 dump_generic_node (pp
, OMP_CLAUSE_NUM_THREADS_EXPR (clause
),
466 case OMP_CLAUSE__CILK_FOR_COUNT_
:
467 pp_string (pp
, "_Cilk_for_count_(");
468 dump_generic_node (pp
, OMP_CLAUSE_OPERAND (clause
, 0),
473 case OMP_CLAUSE_NOWAIT
:
474 pp_string (pp
, "nowait");
476 case OMP_CLAUSE_ORDERED
:
477 pp_string (pp
, "ordered");
478 if (OMP_CLAUSE_ORDERED_EXPR (clause
))
481 dump_generic_node (pp
, OMP_CLAUSE_ORDERED_EXPR (clause
),
487 case OMP_CLAUSE_DEFAULT
:
488 pp_string (pp
, "default(");
489 switch (OMP_CLAUSE_DEFAULT_KIND (clause
))
491 case OMP_CLAUSE_DEFAULT_UNSPECIFIED
:
493 case OMP_CLAUSE_DEFAULT_SHARED
:
494 pp_string (pp
, "shared");
496 case OMP_CLAUSE_DEFAULT_NONE
:
497 pp_string (pp
, "none");
499 case OMP_CLAUSE_DEFAULT_PRIVATE
:
500 pp_string (pp
, "private");
502 case OMP_CLAUSE_DEFAULT_FIRSTPRIVATE
:
503 pp_string (pp
, "firstprivate");
511 case OMP_CLAUSE_SCHEDULE
:
512 pp_string (pp
, "schedule(");
513 if (OMP_CLAUSE_SCHEDULE_KIND (clause
)
514 & (OMP_CLAUSE_SCHEDULE_MONOTONIC
515 | OMP_CLAUSE_SCHEDULE_NONMONOTONIC
))
517 if (OMP_CLAUSE_SCHEDULE_KIND (clause
)
518 & OMP_CLAUSE_SCHEDULE_MONOTONIC
)
519 pp_string (pp
, "monotonic");
521 pp_string (pp
, "nonmonotonic");
522 if (OMP_CLAUSE_SCHEDULE_SIMD (clause
))
527 if (OMP_CLAUSE_SCHEDULE_SIMD (clause
))
528 pp_string (pp
, "simd:");
530 switch (OMP_CLAUSE_SCHEDULE_KIND (clause
) & OMP_CLAUSE_SCHEDULE_MASK
)
532 case OMP_CLAUSE_SCHEDULE_STATIC
:
533 pp_string (pp
, "static");
535 case OMP_CLAUSE_SCHEDULE_DYNAMIC
:
536 pp_string (pp
, "dynamic");
538 case OMP_CLAUSE_SCHEDULE_GUIDED
:
539 pp_string (pp
, "guided");
541 case OMP_CLAUSE_SCHEDULE_RUNTIME
:
542 pp_string (pp
, "runtime");
544 case OMP_CLAUSE_SCHEDULE_AUTO
:
545 pp_string (pp
, "auto");
547 case OMP_CLAUSE_SCHEDULE_CILKFOR
:
548 pp_string (pp
, "cilk-for grain");
553 if (OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (clause
))
556 dump_generic_node (pp
, OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (clause
),
562 case OMP_CLAUSE_UNTIED
:
563 pp_string (pp
, "untied");
566 case OMP_CLAUSE_COLLAPSE
:
567 pp_string (pp
, "collapse(");
568 dump_generic_node (pp
, OMP_CLAUSE_COLLAPSE_EXPR (clause
),
573 case OMP_CLAUSE_FINAL
:
574 pp_string (pp
, "final(");
575 dump_generic_node (pp
, OMP_CLAUSE_FINAL_EXPR (clause
),
580 case OMP_CLAUSE_MERGEABLE
:
581 pp_string (pp
, "mergeable");
584 case OMP_CLAUSE_LINEAR
:
585 pp_string (pp
, "linear(");
586 switch (OMP_CLAUSE_LINEAR_KIND (clause
))
588 case OMP_CLAUSE_LINEAR_DEFAULT
:
590 case OMP_CLAUSE_LINEAR_REF
:
591 pp_string (pp
, "ref(");
593 case OMP_CLAUSE_LINEAR_VAL
:
594 pp_string (pp
, "val(");
596 case OMP_CLAUSE_LINEAR_UVAL
:
597 pp_string (pp
, "uval(");
602 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
604 if (OMP_CLAUSE_LINEAR_KIND (clause
) != OMP_CLAUSE_LINEAR_DEFAULT
)
607 dump_generic_node (pp
, OMP_CLAUSE_LINEAR_STEP (clause
),
612 case OMP_CLAUSE_ALIGNED
:
613 pp_string (pp
, "aligned(");
614 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
616 if (OMP_CLAUSE_ALIGNED_ALIGNMENT (clause
))
619 dump_generic_node (pp
, OMP_CLAUSE_ALIGNED_ALIGNMENT (clause
),
625 case OMP_CLAUSE_DEPEND
:
626 pp_string (pp
, "depend(");
627 switch (OMP_CLAUSE_DEPEND_KIND (clause
))
629 case OMP_CLAUSE_DEPEND_IN
:
630 pp_string (pp
, "in");
632 case OMP_CLAUSE_DEPEND_OUT
:
633 pp_string (pp
, "out");
635 case OMP_CLAUSE_DEPEND_INOUT
:
636 pp_string (pp
, "inout");
638 case OMP_CLAUSE_DEPEND_SOURCE
:
639 pp_string (pp
, "source)");
641 case OMP_CLAUSE_DEPEND_SINK
:
642 pp_string (pp
, "sink:");
643 for (tree t
= OMP_CLAUSE_DECL (clause
); t
; t
= TREE_CHAIN (t
))
644 if (TREE_CODE (t
) == TREE_LIST
)
646 dump_generic_node (pp
, TREE_VALUE (t
), spc
, flags
, false);
647 if (TREE_PURPOSE (t
) != integer_zero_node
)
649 if (OMP_CLAUSE_DEPEND_SINK_NEGATIVE (t
))
653 dump_generic_node (pp
, TREE_PURPOSE (t
), spc
, flags
,
667 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
673 pp_string (pp
, "map(");
674 switch (OMP_CLAUSE_MAP_KIND (clause
))
677 case GOMP_MAP_POINTER
:
678 pp_string (pp
, "alloc");
681 case GOMP_MAP_TO_PSET
:
682 pp_string (pp
, "to");
685 pp_string (pp
, "from");
687 case GOMP_MAP_TOFROM
:
688 pp_string (pp
, "tofrom");
690 case GOMP_MAP_FORCE_ALLOC
:
691 pp_string (pp
, "force_alloc");
693 case GOMP_MAP_FORCE_TO
:
694 pp_string (pp
, "force_to");
696 case GOMP_MAP_FORCE_FROM
:
697 pp_string (pp
, "force_from");
699 case GOMP_MAP_FORCE_TOFROM
:
700 pp_string (pp
, "force_tofrom");
702 case GOMP_MAP_FORCE_PRESENT
:
703 pp_string (pp
, "force_present");
705 case GOMP_MAP_DELETE
:
706 pp_string (pp
, "delete");
708 case GOMP_MAP_FORCE_DEVICEPTR
:
709 pp_string (pp
, "force_deviceptr");
711 case GOMP_MAP_ALWAYS_TO
:
712 pp_string (pp
, "always,to");
714 case GOMP_MAP_ALWAYS_FROM
:
715 pp_string (pp
, "always,from");
717 case GOMP_MAP_ALWAYS_TOFROM
:
718 pp_string (pp
, "always,tofrom");
720 case GOMP_MAP_RELEASE
:
721 pp_string (pp
, "release");
723 case GOMP_MAP_FIRSTPRIVATE_POINTER
:
724 pp_string (pp
, "firstprivate");
726 case GOMP_MAP_FIRSTPRIVATE_REFERENCE
:
727 pp_string (pp
, "firstprivate ref");
729 case GOMP_MAP_STRUCT
:
730 pp_string (pp
, "struct");
732 case GOMP_MAP_ALWAYS_POINTER
:
733 pp_string (pp
, "always_pointer");
735 case GOMP_MAP_DEVICE_RESIDENT
:
736 pp_string (pp
, "device_resident");
739 pp_string (pp
, "link");
745 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
748 if (OMP_CLAUSE_SIZE (clause
))
750 switch (OMP_CLAUSE_CODE (clause
) == OMP_CLAUSE_MAP
751 ? OMP_CLAUSE_MAP_KIND (clause
) : GOMP_MAP_TO
)
753 case GOMP_MAP_POINTER
:
754 case GOMP_MAP_FIRSTPRIVATE_POINTER
:
755 case GOMP_MAP_FIRSTPRIVATE_REFERENCE
:
756 case GOMP_MAP_ALWAYS_POINTER
:
757 pp_string (pp
, " [pointer assign, bias: ");
759 case GOMP_MAP_TO_PSET
:
760 pp_string (pp
, " [pointer set, len: ");
763 pp_string (pp
, " [len: ");
766 dump_generic_node (pp
, OMP_CLAUSE_SIZE (clause
),
768 pp_right_bracket (pp
);
773 case OMP_CLAUSE_FROM
:
774 pp_string (pp
, "from(");
775 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
777 goto print_clause_size
;
780 pp_string (pp
, "to(");
781 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
783 goto print_clause_size
;
785 case OMP_CLAUSE__CACHE_
:
787 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
789 goto print_clause_size
;
791 case OMP_CLAUSE_NUM_TEAMS
:
792 pp_string (pp
, "num_teams(");
793 dump_generic_node (pp
, OMP_CLAUSE_NUM_TEAMS_EXPR (clause
),
798 case OMP_CLAUSE_THREAD_LIMIT
:
799 pp_string (pp
, "thread_limit(");
800 dump_generic_node (pp
, OMP_CLAUSE_THREAD_LIMIT_EXPR (clause
),
805 case OMP_CLAUSE_DEVICE
:
806 pp_string (pp
, "device(");
807 dump_generic_node (pp
, OMP_CLAUSE_DEVICE_ID (clause
),
812 case OMP_CLAUSE_DIST_SCHEDULE
:
813 pp_string (pp
, "dist_schedule(static");
814 if (OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR (clause
))
817 dump_generic_node (pp
,
818 OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR (clause
),
824 case OMP_CLAUSE_PROC_BIND
:
825 pp_string (pp
, "proc_bind(");
826 switch (OMP_CLAUSE_PROC_BIND_KIND (clause
))
828 case OMP_CLAUSE_PROC_BIND_MASTER
:
829 pp_string (pp
, "master");
831 case OMP_CLAUSE_PROC_BIND_CLOSE
:
832 pp_string (pp
, "close");
834 case OMP_CLAUSE_PROC_BIND_SPREAD
:
835 pp_string (pp
, "spread");
843 case OMP_CLAUSE_SAFELEN
:
844 pp_string (pp
, "safelen(");
845 dump_generic_node (pp
, OMP_CLAUSE_SAFELEN_EXPR (clause
),
850 case OMP_CLAUSE_SIMDLEN
:
851 pp_string (pp
, "simdlen(");
852 dump_generic_node (pp
, OMP_CLAUSE_SIMDLEN_EXPR (clause
),
857 case OMP_CLAUSE_PRIORITY
:
858 pp_string (pp
, "priority(");
859 dump_generic_node (pp
, OMP_CLAUSE_PRIORITY_EXPR (clause
),
864 case OMP_CLAUSE_GRAINSIZE
:
865 pp_string (pp
, "grainsize(");
866 dump_generic_node (pp
, OMP_CLAUSE_GRAINSIZE_EXPR (clause
),
871 case OMP_CLAUSE_NUM_TASKS
:
872 pp_string (pp
, "num_tasks(");
873 dump_generic_node (pp
, OMP_CLAUSE_NUM_TASKS_EXPR (clause
),
878 case OMP_CLAUSE_HINT
:
879 pp_string (pp
, "hint(");
880 dump_generic_node (pp
, OMP_CLAUSE_HINT_EXPR (clause
),
885 case OMP_CLAUSE_DEFAULTMAP
:
886 pp_string (pp
, "defaultmap(tofrom:scalar)");
889 case OMP_CLAUSE__SIMDUID_
:
890 pp_string (pp
, "_simduid_(");
891 dump_generic_node (pp
, OMP_CLAUSE__SIMDUID__DECL (clause
),
896 case OMP_CLAUSE__SIMT_
:
897 pp_string (pp
, "_simt_");
900 case OMP_CLAUSE_GANG
:
901 pp_string (pp
, "gang");
902 if (OMP_CLAUSE_GANG_EXPR (clause
) != NULL_TREE
)
904 pp_string (pp
, "(num: ");
905 dump_generic_node (pp
, OMP_CLAUSE_GANG_EXPR (clause
),
908 if (OMP_CLAUSE_GANG_STATIC_EXPR (clause
) != NULL_TREE
)
910 if (OMP_CLAUSE_GANG_EXPR (clause
) == NULL_TREE
)
914 pp_string (pp
, "static:");
915 if (OMP_CLAUSE_GANG_STATIC_EXPR (clause
)
916 == integer_minus_one_node
)
917 pp_character (pp
, '*');
919 dump_generic_node (pp
, OMP_CLAUSE_GANG_STATIC_EXPR (clause
),
922 if (OMP_CLAUSE_GANG_EXPR (clause
) != NULL_TREE
923 || OMP_CLAUSE_GANG_STATIC_EXPR (clause
) != NULL_TREE
)
927 case OMP_CLAUSE_ASYNC
:
928 pp_string (pp
, "async");
929 if (OMP_CLAUSE_ASYNC_EXPR (clause
))
931 pp_character(pp
, '(');
932 dump_generic_node (pp
, OMP_CLAUSE_ASYNC_EXPR (clause
),
934 pp_character(pp
, ')');
938 case OMP_CLAUSE_AUTO
:
940 pp_string (pp
, omp_clause_code_name
[OMP_CLAUSE_CODE (clause
)]);
943 case OMP_CLAUSE_WAIT
:
944 pp_string (pp
, "wait(");
945 dump_generic_node (pp
, OMP_CLAUSE_WAIT_EXPR (clause
),
947 pp_character(pp
, ')');
950 case OMP_CLAUSE_WORKER
:
951 pp_string (pp
, "worker");
952 if (OMP_CLAUSE_WORKER_EXPR (clause
) != NULL_TREE
)
955 dump_generic_node (pp
, OMP_CLAUSE_WORKER_EXPR (clause
),
961 case OMP_CLAUSE_VECTOR
:
962 pp_string (pp
, "vector");
963 if (OMP_CLAUSE_VECTOR_EXPR (clause
) != NULL_TREE
)
966 dump_generic_node (pp
, OMP_CLAUSE_VECTOR_EXPR (clause
),
972 case OMP_CLAUSE_NUM_GANGS
:
973 pp_string (pp
, "num_gangs(");
974 dump_generic_node (pp
, OMP_CLAUSE_NUM_GANGS_EXPR (clause
),
976 pp_character (pp
, ')');
979 case OMP_CLAUSE_NUM_WORKERS
:
980 pp_string (pp
, "num_workers(");
981 dump_generic_node (pp
, OMP_CLAUSE_NUM_WORKERS_EXPR (clause
),
983 pp_character (pp
, ')');
986 case OMP_CLAUSE_VECTOR_LENGTH
:
987 pp_string (pp
, "vector_length(");
988 dump_generic_node (pp
, OMP_CLAUSE_VECTOR_LENGTH_EXPR (clause
),
990 pp_character (pp
, ')');
993 case OMP_CLAUSE_INBRANCH
:
994 pp_string (pp
, "inbranch");
996 case OMP_CLAUSE_NOTINBRANCH
:
997 pp_string (pp
, "notinbranch");
1000 pp_string (pp
, "for");
1002 case OMP_CLAUSE_PARALLEL
:
1003 pp_string (pp
, "parallel");
1005 case OMP_CLAUSE_SECTIONS
:
1006 pp_string (pp
, "sections");
1008 case OMP_CLAUSE_TASKGROUP
:
1009 pp_string (pp
, "taskgroup");
1011 case OMP_CLAUSE_NOGROUP
:
1012 pp_string (pp
, "nogroup");
1014 case OMP_CLAUSE_THREADS
:
1015 pp_string (pp
, "threads");
1017 case OMP_CLAUSE_SIMD
:
1018 pp_string (pp
, "simd");
1020 case OMP_CLAUSE_INDEPENDENT
:
1021 pp_string (pp
, "independent");
1023 case OMP_CLAUSE_TILE
:
1024 pp_string (pp
, "tile(");
1025 dump_generic_node (pp
, OMP_CLAUSE_TILE_LIST (clause
),
1027 pp_right_paren (pp
);
1030 case OMP_CLAUSE__GRIDDIM_
:
1031 pp_string (pp
, "_griddim_(");
1032 pp_unsigned_wide_integer (pp
, OMP_CLAUSE__GRIDDIM__DIMENSION (clause
));
1034 dump_generic_node (pp
, OMP_CLAUSE__GRIDDIM__SIZE (clause
), spc
, flags
,
1037 dump_generic_node (pp
, OMP_CLAUSE__GRIDDIM__GROUP (clause
), spc
, flags
,
1039 pp_right_paren (pp
);
1043 /* Should never happen. */
1044 dump_generic_node (pp
, clause
, spc
, flags
, false);
1050 /* Dump the list of OpenMP clauses. PP, SPC and FLAGS are as in
1051 dump_generic_node. */
1054 dump_omp_clauses (pretty_printer
*pp
, tree clause
, int spc
, int flags
)
1062 dump_omp_clause (pp
, clause
, spc
, flags
);
1063 clause
= OMP_CLAUSE_CHAIN (clause
);
1071 /* Dump location LOC to PP. */
1074 dump_location (pretty_printer
*pp
, location_t loc
)
1076 expanded_location xloc
= expand_location (loc
);
1078 pp_left_bracket (pp
);
1081 pp_string (pp
, xloc
.file
);
1082 pp_string (pp
, ":");
1084 pp_decimal_int (pp
, xloc
.line
);
1086 pp_decimal_int (pp
, xloc
.column
);
1087 pp_string (pp
, "] ");
1091 /* Dump lexical block BLOCK. PP, SPC and FLAGS are as in
1092 dump_generic_node. */
1095 dump_block_node (pretty_printer
*pp
, tree block
, int spc
, int flags
)
1099 pp_printf (pp
, "BLOCK #%d ", BLOCK_NUMBER (block
));
1101 if (flags
& TDF_ADDRESS
)
1102 pp_printf (pp
, "[%p] ", (void *) block
);
1104 if (BLOCK_ABSTRACT (block
))
1105 pp_string (pp
, "[abstract] ");
1107 if (TREE_ASM_WRITTEN (block
))
1108 pp_string (pp
, "[written] ");
1110 if (flags
& TDF_SLIM
)
1113 if (BLOCK_SOURCE_LOCATION (block
))
1114 dump_location (pp
, BLOCK_SOURCE_LOCATION (block
));
1116 newline_and_indent (pp
, spc
+ 2);
1118 if (BLOCK_SUPERCONTEXT (block
))
1120 pp_string (pp
, "SUPERCONTEXT: ");
1121 dump_generic_node (pp
, BLOCK_SUPERCONTEXT (block
), 0,
1122 flags
| TDF_SLIM
, false);
1123 newline_and_indent (pp
, spc
+ 2);
1126 if (BLOCK_SUBBLOCKS (block
))
1128 pp_string (pp
, "SUBBLOCKS: ");
1129 for (t
= BLOCK_SUBBLOCKS (block
); t
; t
= BLOCK_CHAIN (t
))
1131 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
1134 newline_and_indent (pp
, spc
+ 2);
1137 if (BLOCK_CHAIN (block
))
1139 pp_string (pp
, "SIBLINGS: ");
1140 for (t
= BLOCK_CHAIN (block
); t
; t
= BLOCK_CHAIN (t
))
1142 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
1145 newline_and_indent (pp
, spc
+ 2);
1148 if (BLOCK_VARS (block
))
1150 pp_string (pp
, "VARS: ");
1151 for (t
= BLOCK_VARS (block
); t
; t
= TREE_CHAIN (t
))
1153 dump_generic_node (pp
, t
, 0, flags
, false);
1156 newline_and_indent (pp
, spc
+ 2);
1159 if (vec_safe_length (BLOCK_NONLOCALIZED_VARS (block
)) > 0)
1162 vec
<tree
, va_gc
> *nlv
= BLOCK_NONLOCALIZED_VARS (block
);
1164 pp_string (pp
, "NONLOCALIZED_VARS: ");
1165 FOR_EACH_VEC_ELT (*nlv
, i
, t
)
1167 dump_generic_node (pp
, t
, 0, flags
, false);
1170 newline_and_indent (pp
, spc
+ 2);
1173 if (BLOCK_ABSTRACT_ORIGIN (block
))
1175 pp_string (pp
, "ABSTRACT_ORIGIN: ");
1176 dump_generic_node (pp
, BLOCK_ABSTRACT_ORIGIN (block
), 0,
1177 flags
| TDF_SLIM
, false);
1178 newline_and_indent (pp
, spc
+ 2);
1181 if (BLOCK_FRAGMENT_ORIGIN (block
))
1183 pp_string (pp
, "FRAGMENT_ORIGIN: ");
1184 dump_generic_node (pp
, BLOCK_FRAGMENT_ORIGIN (block
), 0,
1185 flags
| TDF_SLIM
, false);
1186 newline_and_indent (pp
, spc
+ 2);
1189 if (BLOCK_FRAGMENT_CHAIN (block
))
1191 pp_string (pp
, "FRAGMENT_CHAIN: ");
1192 for (t
= BLOCK_FRAGMENT_CHAIN (block
); t
; t
= BLOCK_FRAGMENT_CHAIN (t
))
1194 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
1197 newline_and_indent (pp
, spc
+ 2);
1202 /* Dump the node NODE on the pretty_printer PP, SPC spaces of
1203 indent. FLAGS specifies details to show in the dump (see TDF_* in
1204 dumpfile.h). If IS_STMT is true, the object printed is considered
1205 to be a statement and it is terminated by ';' if appropriate. */
1208 dump_generic_node (pretty_printer
*pp
, tree node
, int spc
, int flags
,
1215 enum tree_code code
;
1217 if (node
== NULL_TREE
)
1220 is_expr
= EXPR_P (node
);
1222 if (is_stmt
&& (flags
& TDF_STMTADDR
))
1223 pp_printf (pp
, "<&%p> ", (void *)node
);
1225 if ((flags
& TDF_LINENO
) && EXPR_HAS_LOCATION (node
))
1226 dump_location (pp
, EXPR_LOCATION (node
));
1228 code
= TREE_CODE (node
);
1232 pp_string (pp
, "<<< error >>>");
1235 case IDENTIFIER_NODE
:
1236 pp_tree_identifier (pp
, node
);
1240 while (node
&& node
!= error_mark_node
)
1242 if (TREE_PURPOSE (node
))
1244 dump_generic_node (pp
, TREE_PURPOSE (node
), spc
, flags
, false);
1247 dump_generic_node (pp
, TREE_VALUE (node
), spc
, flags
, false);
1248 node
= TREE_CHAIN (node
);
1249 if (node
&& TREE_CODE (node
) == TREE_LIST
)
1258 dump_generic_node (pp
, BINFO_TYPE (node
), spc
, flags
, false);
1264 if (TREE_VEC_LENGTH (node
) > 0)
1266 size_t len
= TREE_VEC_LENGTH (node
);
1267 for (i
= 0; i
< len
- 1; i
++)
1269 dump_generic_node (pp
, TREE_VEC_ELT (node
, i
), spc
, flags
,
1274 dump_generic_node (pp
, TREE_VEC_ELT (node
, len
- 1), spc
,
1281 case POINTER_BOUNDS_TYPE
:
1284 case FIXED_POINT_TYPE
:
1290 unsigned int quals
= TYPE_QUALS (node
);
1291 enum tree_code_class tclass
;
1293 if (quals
& TYPE_QUAL_ATOMIC
)
1294 pp_string (pp
, "atomic ");
1295 if (quals
& TYPE_QUAL_CONST
)
1296 pp_string (pp
, "const ");
1297 else if (quals
& TYPE_QUAL_VOLATILE
)
1298 pp_string (pp
, "volatile ");
1299 else if (quals
& TYPE_QUAL_RESTRICT
)
1300 pp_string (pp
, "restrict ");
1302 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
1304 pp_string (pp
, "<address-space-");
1305 pp_decimal_int (pp
, TYPE_ADDR_SPACE (node
));
1306 pp_string (pp
, "> ");
1309 tclass
= TREE_CODE_CLASS (TREE_CODE (node
));
1311 if (tclass
== tcc_declaration
)
1313 if (DECL_NAME (node
))
1314 dump_decl_name (pp
, node
, flags
);
1316 pp_string (pp
, "<unnamed type decl>");
1318 else if (tclass
== tcc_type
)
1320 if (TYPE_NAME (node
))
1322 if (TREE_CODE (TYPE_NAME (node
)) == IDENTIFIER_NODE
)
1323 pp_tree_identifier (pp
, TYPE_NAME (node
));
1324 else if (TREE_CODE (TYPE_NAME (node
)) == TYPE_DECL
1325 && DECL_NAME (TYPE_NAME (node
)))
1326 dump_decl_name (pp
, TYPE_NAME (node
), flags
);
1328 pp_string (pp
, "<unnamed type>");
1330 else if (TREE_CODE (node
) == VECTOR_TYPE
)
1332 pp_string (pp
, "vector");
1334 pp_wide_integer (pp
, TYPE_VECTOR_SUBPARTS (node
));
1335 pp_string (pp
, ") ");
1336 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1338 else if (TREE_CODE (node
) == INTEGER_TYPE
)
1340 if (TYPE_PRECISION (node
) == CHAR_TYPE_SIZE
)
1341 pp_string (pp
, (TYPE_UNSIGNED (node
)
1344 else if (TYPE_PRECISION (node
) == SHORT_TYPE_SIZE
)
1345 pp_string (pp
, (TYPE_UNSIGNED (node
)
1348 else if (TYPE_PRECISION (node
) == INT_TYPE_SIZE
)
1349 pp_string (pp
, (TYPE_UNSIGNED (node
)
1352 else if (TYPE_PRECISION (node
) == LONG_TYPE_SIZE
)
1353 pp_string (pp
, (TYPE_UNSIGNED (node
)
1356 else if (TYPE_PRECISION (node
) == LONG_LONG_TYPE_SIZE
)
1357 pp_string (pp
, (TYPE_UNSIGNED (node
)
1358 ? "unsigned long long"
1359 : "signed long long"));
1360 else if (TYPE_PRECISION (node
) >= CHAR_TYPE_SIZE
1361 && pow2p_hwi (TYPE_PRECISION (node
)))
1363 pp_string (pp
, (TYPE_UNSIGNED (node
) ? "uint" : "int"));
1364 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1365 pp_string (pp
, "_t");
1369 pp_string (pp
, (TYPE_UNSIGNED (node
)
1370 ? "<unnamed-unsigned:"
1371 : "<unnamed-signed:"));
1372 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1376 else if (TREE_CODE (node
) == COMPLEX_TYPE
)
1378 pp_string (pp
, "__complex__ ");
1379 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1381 else if (TREE_CODE (node
) == REAL_TYPE
)
1383 pp_string (pp
, "<float:");
1384 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1387 else if (TREE_CODE (node
) == FIXED_POINT_TYPE
)
1389 pp_string (pp
, "<fixed-point-");
1390 pp_string (pp
, TYPE_SATURATING (node
) ? "sat:" : "nonsat:");
1391 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1394 else if (TREE_CODE (node
) == VOID_TYPE
)
1395 pp_string (pp
, "void");
1397 pp_string (pp
, "<unnamed type>");
1403 case REFERENCE_TYPE
:
1404 str
= (TREE_CODE (node
) == POINTER_TYPE
? "*" : "&");
1406 if (TREE_TYPE (node
) == NULL
)
1408 pp_string (pp
, str
);
1409 pp_string (pp
, "<null type>");
1411 else if (TREE_CODE (TREE_TYPE (node
)) == FUNCTION_TYPE
)
1413 tree fnode
= TREE_TYPE (node
);
1415 dump_generic_node (pp
, TREE_TYPE (fnode
), spc
, flags
, false);
1418 pp_string (pp
, str
);
1419 if (TYPE_NAME (node
) && DECL_NAME (TYPE_NAME (node
)))
1420 dump_decl_name (pp
, TYPE_NAME (node
), flags
);
1421 else if (flags
& TDF_NOUID
)
1422 pp_printf (pp
, "<Txxxx>");
1424 pp_printf (pp
, "<T%x>", TYPE_UID (node
));
1426 pp_right_paren (pp
);
1427 dump_function_declaration (pp
, fnode
, spc
, flags
);
1431 unsigned int quals
= TYPE_QUALS (node
);
1433 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1435 pp_string (pp
, str
);
1437 if (quals
& TYPE_QUAL_CONST
)
1438 pp_string (pp
, " const");
1439 if (quals
& TYPE_QUAL_VOLATILE
)
1440 pp_string (pp
, " volatile");
1441 if (quals
& TYPE_QUAL_RESTRICT
)
1442 pp_string (pp
, " restrict");
1444 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
1446 pp_string (pp
, " <address-space-");
1447 pp_decimal_int (pp
, TYPE_ADDR_SPACE (node
));
1451 if (TYPE_REF_CAN_ALIAS_ALL (node
))
1452 pp_string (pp
, " {ref-all}");
1462 if (integer_zerop (TREE_OPERAND (node
, 1))
1463 /* Dump the types of INTEGER_CSTs explicitly, for we can't
1464 infer them and MEM_ATTR caching will share MEM_REFs
1465 with differently-typed op0s. */
1466 && TREE_CODE (TREE_OPERAND (node
, 0)) != INTEGER_CST
1467 /* Released SSA_NAMES have no TREE_TYPE. */
1468 && TREE_TYPE (TREE_OPERAND (node
, 0)) != NULL_TREE
1469 /* Same pointer types, but ignoring POINTER_TYPE vs.
1471 && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 0)))
1472 == TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 1))))
1473 && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (node
, 0)))
1474 == TYPE_MODE (TREE_TYPE (TREE_OPERAND (node
, 1))))
1475 && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node
, 0)))
1476 == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node
, 1))))
1477 /* Same value types ignoring qualifiers. */
1478 && (TYPE_MAIN_VARIANT (TREE_TYPE (node
))
1479 == TYPE_MAIN_VARIANT
1480 (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 1)))))
1481 && (!(flags
& TDF_ALIAS
)
1482 || MR_DEPENDENCE_CLIQUE (node
) == 0))
1484 if (TREE_CODE (TREE_OPERAND (node
, 0)) != ADDR_EXPR
)
1487 dump_generic_node (pp
, TREE_OPERAND (node
, 0),
1491 dump_generic_node (pp
,
1492 TREE_OPERAND (TREE_OPERAND (node
, 0), 0),
1499 pp_string (pp
, "MEM[");
1501 ptype
= TYPE_MAIN_VARIANT (TREE_TYPE (TREE_OPERAND (node
, 1)));
1502 dump_generic_node (pp
, ptype
,
1503 spc
, flags
| TDF_SLIM
, false);
1504 pp_right_paren (pp
);
1505 dump_generic_node (pp
, TREE_OPERAND (node
, 0),
1507 if (!integer_zerop (TREE_OPERAND (node
, 1)))
1509 pp_string (pp
, " + ");
1510 dump_generic_node (pp
, TREE_OPERAND (node
, 1),
1513 if ((flags
& TDF_ALIAS
)
1514 && MR_DEPENDENCE_CLIQUE (node
) != 0)
1516 pp_string (pp
, " clique ");
1517 pp_unsigned_wide_integer (pp
, MR_DEPENDENCE_CLIQUE (node
));
1518 pp_string (pp
, " base ");
1519 pp_unsigned_wide_integer (pp
, MR_DEPENDENCE_BASE (node
));
1521 pp_right_bracket (pp
);
1526 case TARGET_MEM_REF
:
1528 const char *sep
= "";
1531 pp_string (pp
, "MEM[");
1533 if (TREE_CODE (TMR_BASE (node
)) == ADDR_EXPR
)
1535 pp_string (pp
, sep
);
1537 pp_string (pp
, "symbol: ");
1538 dump_generic_node (pp
, TREE_OPERAND (TMR_BASE (node
), 0),
1543 pp_string (pp
, sep
);
1545 pp_string (pp
, "base: ");
1546 dump_generic_node (pp
, TMR_BASE (node
), spc
, flags
, false);
1548 tmp
= TMR_INDEX2 (node
);
1551 pp_string (pp
, sep
);
1553 pp_string (pp
, "base: ");
1554 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1556 tmp
= TMR_INDEX (node
);
1559 pp_string (pp
, sep
);
1561 pp_string (pp
, "index: ");
1562 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1564 tmp
= TMR_STEP (node
);
1567 pp_string (pp
, sep
);
1569 pp_string (pp
, "step: ");
1570 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1572 tmp
= TMR_OFFSET (node
);
1575 pp_string (pp
, sep
);
1577 pp_string (pp
, "offset: ");
1578 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1580 pp_right_bracket (pp
);
1588 /* Print the innermost component type. */
1589 for (tmp
= TREE_TYPE (node
); TREE_CODE (tmp
) == ARRAY_TYPE
;
1590 tmp
= TREE_TYPE (tmp
))
1592 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1594 /* Print the dimensions. */
1595 for (tmp
= node
; TREE_CODE (tmp
) == ARRAY_TYPE
; tmp
= TREE_TYPE (tmp
))
1596 dump_array_domain (pp
, TYPE_DOMAIN (tmp
), spc
, flags
);
1602 case QUAL_UNION_TYPE
:
1604 unsigned int quals
= TYPE_QUALS (node
);
1606 if (quals
& TYPE_QUAL_ATOMIC
)
1607 pp_string (pp
, "atomic ");
1608 if (quals
& TYPE_QUAL_CONST
)
1609 pp_string (pp
, "const ");
1610 if (quals
& TYPE_QUAL_VOLATILE
)
1611 pp_string (pp
, "volatile ");
1613 /* Print the name of the structure. */
1614 if (TREE_CODE (node
) == RECORD_TYPE
)
1615 pp_string (pp
, "struct ");
1616 else if (TREE_CODE (node
) == UNION_TYPE
)
1617 pp_string (pp
, "union ");
1619 if (TYPE_NAME (node
))
1620 dump_generic_node (pp
, TYPE_NAME (node
), spc
, flags
, false);
1621 else if (!(flags
& TDF_SLIM
))
1622 /* FIXME: If we eliminate the 'else' above and attempt
1623 to show the fields for named types, we may get stuck
1624 following a cycle of pointers to structs. The alleged
1625 self-reference check in print_struct_decl will not detect
1626 cycles involving more than one pointer or struct type. */
1627 print_struct_decl (pp
, node
, spc
, flags
);
1636 if (TREE_CODE (TREE_TYPE (node
)) == POINTER_TYPE
)
1638 /* In the case of a pointer, one may want to divide by the
1639 size of the pointed-to type. Unfortunately, this not
1640 straightforward. The C front-end maps expressions
1645 in such a way that the two INTEGER_CST nodes for "5" have
1646 different values but identical types. In the latter
1647 case, the 5 is multiplied by sizeof (int) in c-common.c
1648 (pointer_int_sum) to convert it to a byte address, and
1649 yet the type of the node is left unchanged. Argh. What
1650 is consistent though is that the number value corresponds
1651 to bytes (UNITS) offset.
1653 NB: Neither of the following divisors can be trivially
1654 used to recover the original literal:
1656 TREE_INT_CST_LOW (TYPE_SIZE_UNIT (TREE_TYPE (node)))
1657 TYPE_PRECISION (TREE_TYPE (TREE_TYPE (node))) */
1658 pp_wide_integer (pp
, TREE_INT_CST_LOW (node
));
1659 pp_string (pp
, "B"); /* pseudo-unit */
1661 else if (tree_fits_shwi_p (node
))
1662 pp_wide_integer (pp
, tree_to_shwi (node
));
1663 else if (tree_fits_uhwi_p (node
))
1664 pp_unsigned_wide_integer (pp
, tree_to_uhwi (node
));
1667 wide_int val
= node
;
1669 if (wi::neg_p (val
, TYPE_SIGN (TREE_TYPE (node
))))
1674 print_hex (val
, pp_buffer (pp
)->digit_buffer
);
1675 pp_string (pp
, pp_buffer (pp
)->digit_buffer
);
1677 if (TREE_OVERFLOW (node
))
1678 pp_string (pp
, "(OVF)");
1682 /* Code copied from print_node. */
1685 if (TREE_OVERFLOW (node
))
1686 pp_string (pp
, " overflow");
1688 d
= TREE_REAL_CST (node
);
1689 if (REAL_VALUE_ISINF (d
))
1690 pp_string (pp
, REAL_VALUE_NEGATIVE (d
) ? " -Inf" : " Inf");
1691 else if (REAL_VALUE_ISNAN (d
))
1692 pp_string (pp
, " Nan");
1696 real_to_decimal (string
, &d
, sizeof (string
), 0, 1);
1697 pp_string (pp
, string
);
1705 fixed_to_decimal (string
, TREE_FIXED_CST_PTR (node
), sizeof (string
));
1706 pp_string (pp
, string
);
1711 pp_string (pp
, "__complex__ (");
1712 dump_generic_node (pp
, TREE_REALPART (node
), spc
, flags
, false);
1713 pp_string (pp
, ", ");
1714 dump_generic_node (pp
, TREE_IMAGPART (node
), spc
, flags
, false);
1715 pp_right_paren (pp
);
1719 pp_string (pp
, "\"");
1720 pretty_print_string (pp
, TREE_STRING_POINTER (node
));
1721 pp_string (pp
, "\"");
1727 pp_string (pp
, "{ ");
1728 for (i
= 0; i
< VECTOR_CST_NELTS (node
); ++i
)
1731 pp_string (pp
, ", ");
1732 dump_generic_node (pp
, VECTOR_CST_ELT (node
, i
),
1735 pp_string (pp
, " }");
1741 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1743 if (TREE_CODE (node
) == METHOD_TYPE
)
1745 if (TYPE_METHOD_BASETYPE (node
))
1746 dump_decl_name (pp
, TYPE_NAME (TYPE_METHOD_BASETYPE (node
)),
1749 pp_string (pp
, "<null method basetype>");
1750 pp_colon_colon (pp
);
1752 if (TYPE_NAME (node
) && DECL_NAME (TYPE_NAME (node
)))
1753 dump_decl_name (pp
, TYPE_NAME (node
), flags
);
1754 else if (flags
& TDF_NOUID
)
1755 pp_printf (pp
, "<Txxxx>");
1757 pp_printf (pp
, "<T%x>", TYPE_UID (node
));
1758 dump_function_declaration (pp
, node
, spc
, flags
);
1763 dump_decl_name (pp
, node
, flags
);
1767 if (DECL_NAME (node
))
1768 dump_decl_name (pp
, node
, flags
);
1769 else if (LABEL_DECL_UID (node
) != -1)
1771 if (flags
& TDF_GIMPLE
)
1772 pp_printf (pp
, "L%d", (int) LABEL_DECL_UID (node
));
1774 pp_printf (pp
, "<L%d>", (int) LABEL_DECL_UID (node
));
1778 if (flags
& TDF_NOUID
)
1779 pp_string (pp
, "<D.xxxx>");
1782 if (flags
& TDF_GIMPLE
)
1783 pp_printf (pp
, "<D%u>", DECL_UID (node
));
1785 pp_printf (pp
, "<D.%u>", DECL_UID (node
));
1791 if (DECL_IS_BUILTIN (node
))
1793 /* Don't print the declaration of built-in types. */
1796 if (DECL_NAME (node
))
1797 dump_decl_name (pp
, node
, flags
);
1798 else if (TYPE_NAME (TREE_TYPE (node
)) != node
)
1800 if ((TREE_CODE (TREE_TYPE (node
)) == RECORD_TYPE
1801 || TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
)
1802 && TYPE_METHODS (TREE_TYPE (node
)))
1804 /* The type is a c++ class: all structures have at least
1806 pp_string (pp
, "class ");
1807 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1812 (TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
1813 ? "union" : "struct "));
1814 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1818 pp_string (pp
, "<anon>");
1824 case DEBUG_EXPR_DECL
:
1825 case NAMESPACE_DECL
:
1827 dump_decl_name (pp
, node
, flags
);
1831 pp_string (pp
, "<retval>");
1835 op0
= TREE_OPERAND (node
, 0);
1838 && (TREE_CODE (op0
) == INDIRECT_REF
1839 || (TREE_CODE (op0
) == MEM_REF
1840 && TREE_CODE (TREE_OPERAND (op0
, 0)) != ADDR_EXPR
1841 && integer_zerop (TREE_OPERAND (op0
, 1))
1842 /* Dump the types of INTEGER_CSTs explicitly, for we
1843 can't infer them and MEM_ATTR caching will share
1844 MEM_REFs with differently-typed op0s. */
1845 && TREE_CODE (TREE_OPERAND (op0
, 0)) != INTEGER_CST
1846 /* Released SSA_NAMES have no TREE_TYPE. */
1847 && TREE_TYPE (TREE_OPERAND (op0
, 0)) != NULL_TREE
1848 /* Same pointer types, but ignoring POINTER_TYPE vs.
1850 && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 0)))
1851 == TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 1))))
1852 && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0
, 0)))
1853 == TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0
, 1))))
1854 && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0
, 0)))
1855 == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0
, 1))))
1856 /* Same value types ignoring qualifiers. */
1857 && (TYPE_MAIN_VARIANT (TREE_TYPE (op0
))
1858 == TYPE_MAIN_VARIANT
1859 (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 1)))))
1860 && MR_DEPENDENCE_CLIQUE (op0
) == 0)))
1862 op0
= TREE_OPERAND (op0
, 0);
1865 if (op_prio (op0
) < op_prio (node
))
1867 dump_generic_node (pp
, op0
, spc
, flags
, false);
1868 if (op_prio (op0
) < op_prio (node
))
1869 pp_right_paren (pp
);
1870 pp_string (pp
, str
);
1871 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1872 op0
= component_ref_field_offset (node
);
1873 if (op0
&& TREE_CODE (op0
) != INTEGER_CST
)
1875 pp_string (pp
, "{off: ");
1876 dump_generic_node (pp
, op0
, spc
, flags
, false);
1877 pp_right_brace (pp
);
1882 pp_string (pp
, "BIT_FIELD_REF <");
1883 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1884 pp_string (pp
, ", ");
1885 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1886 pp_string (pp
, ", ");
1887 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
1891 case BIT_INSERT_EXPR
:
1892 pp_string (pp
, "BIT_INSERT_EXPR <");
1893 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1894 pp_string (pp
, ", ");
1895 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1896 pp_string (pp
, ", ");
1897 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
1898 pp_string (pp
, " (");
1899 if (INTEGRAL_TYPE_P (TREE_TYPE (TREE_OPERAND (node
, 1))))
1901 TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (node
, 1))));
1903 dump_generic_node (pp
, TYPE_SIZE (TREE_TYPE (TREE_OPERAND (node
, 1))),
1905 pp_string (pp
, " bits)>");
1909 case ARRAY_RANGE_REF
:
1910 op0
= TREE_OPERAND (node
, 0);
1911 if (op_prio (op0
) < op_prio (node
))
1913 dump_generic_node (pp
, op0
, spc
, flags
, false);
1914 if (op_prio (op0
) < op_prio (node
))
1915 pp_right_paren (pp
);
1916 pp_left_bracket (pp
);
1917 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1918 if (TREE_CODE (node
) == ARRAY_RANGE_REF
)
1919 pp_string (pp
, " ...");
1920 pp_right_bracket (pp
);
1922 op0
= array_ref_low_bound (node
);
1923 op1
= array_ref_element_size (node
);
1925 if (!integer_zerop (op0
)
1926 || TREE_OPERAND (node
, 2)
1927 || TREE_OPERAND (node
, 3))
1929 pp_string (pp
, "{lb: ");
1930 dump_generic_node (pp
, op0
, spc
, flags
, false);
1931 pp_string (pp
, " sz: ");
1932 dump_generic_node (pp
, op1
, spc
, flags
, false);
1933 pp_right_brace (pp
);
1939 unsigned HOST_WIDE_INT ix
;
1941 bool is_struct_init
= false;
1942 bool is_array_init
= false;
1945 if (TREE_CLOBBER_P (node
))
1946 pp_string (pp
, "CLOBBER");
1947 else if (TREE_CODE (TREE_TYPE (node
)) == RECORD_TYPE
1948 || TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
)
1949 is_struct_init
= true;
1950 else if (TREE_CODE (TREE_TYPE (node
)) == ARRAY_TYPE
1951 && TYPE_DOMAIN (TREE_TYPE (node
))
1952 && TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
)))
1953 && TREE_CODE (TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
))))
1956 tree minv
= TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
)));
1957 is_array_init
= true;
1958 curidx
= wi::to_widest (minv
);
1960 FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (node
), ix
, field
, val
)
1967 dump_generic_node (pp
, field
, spc
, flags
, false);
1970 else if (is_array_init
1971 && (TREE_CODE (field
) != INTEGER_CST
1972 || curidx
!= wi::to_widest (field
)))
1974 pp_left_bracket (pp
);
1975 if (TREE_CODE (field
) == RANGE_EXPR
)
1977 dump_generic_node (pp
, TREE_OPERAND (field
, 0), spc
,
1979 pp_string (pp
, " ... ");
1980 dump_generic_node (pp
, TREE_OPERAND (field
, 1), spc
,
1982 if (TREE_CODE (TREE_OPERAND (field
, 1)) == INTEGER_CST
)
1983 curidx
= wi::to_widest (TREE_OPERAND (field
, 1));
1986 dump_generic_node (pp
, field
, spc
, flags
, false);
1987 if (TREE_CODE (field
) == INTEGER_CST
)
1988 curidx
= wi::to_widest (field
);
1989 pp_string (pp
, "]=");
1994 if (val
&& TREE_CODE (val
) == ADDR_EXPR
)
1995 if (TREE_CODE (TREE_OPERAND (val
, 0)) == FUNCTION_DECL
)
1996 val
= TREE_OPERAND (val
, 0);
1997 if (val
&& TREE_CODE (val
) == FUNCTION_DECL
)
1998 dump_decl_name (pp
, val
, flags
);
2000 dump_generic_node (pp
, val
, spc
, flags
, false);
2001 if (ix
!= CONSTRUCTOR_NELTS (node
) - 1)
2007 pp_right_brace (pp
);
2014 if (flags
& TDF_SLIM
)
2016 pp_string (pp
, "<COMPOUND_EXPR>");
2020 dump_generic_node (pp
, TREE_OPERAND (node
, 0),
2021 spc
, flags
, !(flags
& TDF_SLIM
));
2022 if (flags
& TDF_SLIM
)
2023 newline_and_indent (pp
, spc
);
2030 for (tp
= &TREE_OPERAND (node
, 1);
2031 TREE_CODE (*tp
) == COMPOUND_EXPR
;
2032 tp
= &TREE_OPERAND (*tp
, 1))
2034 dump_generic_node (pp
, TREE_OPERAND (*tp
, 0),
2035 spc
, flags
, !(flags
& TDF_SLIM
));
2036 if (flags
& TDF_SLIM
)
2037 newline_and_indent (pp
, spc
);
2045 dump_generic_node (pp
, *tp
, spc
, flags
, !(flags
& TDF_SLIM
));
2049 case STATEMENT_LIST
:
2051 tree_stmt_iterator si
;
2054 if (flags
& TDF_SLIM
)
2056 pp_string (pp
, "<STATEMENT_LIST>");
2060 for (si
= tsi_start (node
); !tsi_end_p (si
); tsi_next (&si
))
2063 newline_and_indent (pp
, spc
);
2066 dump_generic_node (pp
, tsi_stmt (si
), spc
, flags
, true);
2073 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
,
2078 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
,
2083 pp_string (pp
, "TARGET_EXPR <");
2084 dump_generic_node (pp
, TARGET_EXPR_SLOT (node
), spc
, flags
, false);
2087 dump_generic_node (pp
, TARGET_EXPR_INITIAL (node
), spc
, flags
, false);
2092 print_declaration (pp
, DECL_EXPR_DECL (node
), spc
, flags
);
2097 if (TREE_TYPE (node
) == NULL
|| TREE_TYPE (node
) == void_type_node
)
2099 pp_string (pp
, "if (");
2100 dump_generic_node (pp
, COND_EXPR_COND (node
), spc
, flags
, false);
2101 pp_right_paren (pp
);
2102 /* The lowered cond_exprs should always be printed in full. */
2103 if (COND_EXPR_THEN (node
)
2104 && (IS_EMPTY_STMT (COND_EXPR_THEN (node
))
2105 || TREE_CODE (COND_EXPR_THEN (node
)) == GOTO_EXPR
)
2106 && COND_EXPR_ELSE (node
)
2107 && (IS_EMPTY_STMT (COND_EXPR_ELSE (node
))
2108 || TREE_CODE (COND_EXPR_ELSE (node
)) == GOTO_EXPR
))
2111 dump_generic_node (pp
, COND_EXPR_THEN (node
),
2113 if (!IS_EMPTY_STMT (COND_EXPR_ELSE (node
)))
2115 pp_string (pp
, " else ");
2116 dump_generic_node (pp
, COND_EXPR_ELSE (node
),
2120 else if (!(flags
& TDF_SLIM
))
2122 /* Output COND_EXPR_THEN. */
2123 if (COND_EXPR_THEN (node
))
2125 newline_and_indent (pp
, spc
+2);
2127 newline_and_indent (pp
, spc
+4);
2128 dump_generic_node (pp
, COND_EXPR_THEN (node
), spc
+4,
2130 newline_and_indent (pp
, spc
+2);
2131 pp_right_brace (pp
);
2134 /* Output COND_EXPR_ELSE. */
2135 if (COND_EXPR_ELSE (node
)
2136 && !IS_EMPTY_STMT (COND_EXPR_ELSE (node
)))
2138 newline_and_indent (pp
, spc
);
2139 pp_string (pp
, "else");
2140 newline_and_indent (pp
, spc
+2);
2142 newline_and_indent (pp
, spc
+4);
2143 dump_generic_node (pp
, COND_EXPR_ELSE (node
), spc
+4,
2145 newline_and_indent (pp
, spc
+2);
2146 pp_right_brace (pp
);
2153 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2157 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2161 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2167 if (!(flags
& TDF_SLIM
))
2169 if (BIND_EXPR_VARS (node
))
2173 for (op0
= BIND_EXPR_VARS (node
); op0
; op0
= DECL_CHAIN (op0
))
2175 print_declaration (pp
, op0
, spc
+2, flags
);
2180 newline_and_indent (pp
, spc
+2);
2181 dump_generic_node (pp
, BIND_EXPR_BODY (node
), spc
+2, flags
, true);
2182 newline_and_indent (pp
, spc
);
2183 pp_right_brace (pp
);
2189 if (CALL_EXPR_FN (node
) != NULL_TREE
)
2190 print_call_name (pp
, CALL_EXPR_FN (node
), flags
);
2192 pp_string (pp
, internal_fn_name (CALL_EXPR_IFN (node
)));
2194 /* Print parameters. */
2199 call_expr_arg_iterator iter
;
2200 FOR_EACH_CALL_EXPR_ARG (arg
, iter
, node
)
2202 dump_generic_node (pp
, arg
, spc
, flags
, false);
2203 if (more_call_expr_args_p (&iter
))
2210 if (CALL_EXPR_VA_ARG_PACK (node
))
2212 if (call_expr_nargs (node
) > 0)
2217 pp_string (pp
, "__builtin_va_arg_pack ()");
2219 pp_right_paren (pp
);
2221 op1
= CALL_EXPR_STATIC_CHAIN (node
);
2224 pp_string (pp
, " [static-chain: ");
2225 dump_generic_node (pp
, op1
, spc
, flags
, false);
2226 pp_right_bracket (pp
);
2229 if (CALL_EXPR_RETURN_SLOT_OPT (node
))
2230 pp_string (pp
, " [return slot optimization]");
2231 if (CALL_EXPR_TAILCALL (node
))
2232 pp_string (pp
, " [tail call]");
2235 case WITH_CLEANUP_EXPR
:
2239 case CLEANUP_POINT_EXPR
:
2240 pp_string (pp
, "<<cleanup_point ");
2241 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2242 pp_string (pp
, ">>");
2245 case PLACEHOLDER_EXPR
:
2246 pp_string (pp
, "<PLACEHOLDER_EXPR ");
2247 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2251 /* Binary arithmetic and logic expressions. */
2252 case WIDEN_SUM_EXPR
:
2253 case WIDEN_MULT_EXPR
:
2255 case MULT_HIGHPART_EXPR
:
2257 case POINTER_PLUS_EXPR
:
2259 case TRUNC_DIV_EXPR
:
2261 case FLOOR_DIV_EXPR
:
2262 case ROUND_DIV_EXPR
:
2263 case TRUNC_MOD_EXPR
:
2265 case FLOOR_MOD_EXPR
:
2266 case ROUND_MOD_EXPR
:
2268 case EXACT_DIV_EXPR
:
2273 case WIDEN_LSHIFT_EXPR
:
2277 case TRUTH_ANDIF_EXPR
:
2278 case TRUTH_ORIF_EXPR
:
2279 case TRUTH_AND_EXPR
:
2281 case TRUTH_XOR_EXPR
:
2295 case UNORDERED_EXPR
:
2297 const char *op
= op_symbol (node
);
2298 op0
= TREE_OPERAND (node
, 0);
2299 op1
= TREE_OPERAND (node
, 1);
2301 /* When the operands are expressions with less priority,
2302 keep semantics of the tree representation. */
2303 if (op_prio (op0
) <= op_prio (node
))
2306 dump_generic_node (pp
, op0
, spc
, flags
, false);
2307 pp_right_paren (pp
);
2310 dump_generic_node (pp
, op0
, spc
, flags
, false);
2316 /* When the operands are expressions with less priority,
2317 keep semantics of the tree representation. */
2318 if (op_prio (op1
) <= op_prio (node
))
2321 dump_generic_node (pp
, op1
, spc
, flags
, false);
2322 pp_right_paren (pp
);
2325 dump_generic_node (pp
, op1
, spc
, flags
, false);
2329 /* Unary arithmetic and logic expressions. */
2332 case TRUTH_NOT_EXPR
:
2334 case PREDECREMENT_EXPR
:
2335 case PREINCREMENT_EXPR
:
2337 if (TREE_CODE (node
) == ADDR_EXPR
2338 && (TREE_CODE (TREE_OPERAND (node
, 0)) == STRING_CST
2339 || TREE_CODE (TREE_OPERAND (node
, 0)) == FUNCTION_DECL
))
2340 ; /* Do not output '&' for strings and function pointers. */
2342 pp_string (pp
, op_symbol (node
));
2344 if (op_prio (TREE_OPERAND (node
, 0)) < op_prio (node
))
2347 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2348 pp_right_paren (pp
);
2351 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2354 case POSTDECREMENT_EXPR
:
2355 case POSTINCREMENT_EXPR
:
2356 if (op_prio (TREE_OPERAND (node
, 0)) < op_prio (node
))
2359 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2360 pp_right_paren (pp
);
2363 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2364 pp_string (pp
, op_symbol (node
));
2368 pp_string (pp
, "MIN_EXPR <");
2369 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2370 pp_string (pp
, ", ");
2371 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2376 pp_string (pp
, "MAX_EXPR <");
2377 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2378 pp_string (pp
, ", ");
2379 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2384 pp_string (pp
, "ABS_EXPR <");
2385 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2393 case ADDR_SPACE_CONVERT_EXPR
:
2394 case FIXED_CONVERT_EXPR
:
2395 case FIX_TRUNC_EXPR
:
2398 type
= TREE_TYPE (node
);
2399 op0
= TREE_OPERAND (node
, 0);
2400 if (type
!= TREE_TYPE (op0
))
2403 dump_generic_node (pp
, type
, spc
, flags
, false);
2404 pp_string (pp
, ") ");
2406 if (op_prio (op0
) < op_prio (node
))
2408 dump_generic_node (pp
, op0
, spc
, flags
, false);
2409 if (op_prio (op0
) < op_prio (node
))
2410 pp_right_paren (pp
);
2413 case VIEW_CONVERT_EXPR
:
2414 pp_string (pp
, "VIEW_CONVERT_EXPR<");
2415 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2416 pp_string (pp
, ">(");
2417 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2418 pp_right_paren (pp
);
2422 pp_string (pp
, "((");
2423 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2424 pp_string (pp
, "))");
2427 case NON_LVALUE_EXPR
:
2428 pp_string (pp
, "NON_LVALUE_EXPR <");
2429 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2434 pp_string (pp
, "SAVE_EXPR <");
2435 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2440 pp_string (pp
, "COMPLEX_EXPR <");
2441 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2442 pp_string (pp
, ", ");
2443 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2448 pp_string (pp
, "CONJ_EXPR <");
2449 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2454 if (flags
& TDF_GIMPLE
)
2456 pp_string (pp
, "__real ");
2457 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2461 pp_string (pp
, "REALPART_EXPR <");
2462 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2468 if (flags
& TDF_GIMPLE
)
2470 pp_string (pp
, "__imag ");
2471 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2475 pp_string (pp
, "IMAGPART_EXPR <");
2476 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2482 pp_string (pp
, "VA_ARG_EXPR <");
2483 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2487 case TRY_FINALLY_EXPR
:
2488 case TRY_CATCH_EXPR
:
2489 pp_string (pp
, "try");
2490 newline_and_indent (pp
, spc
+2);
2492 newline_and_indent (pp
, spc
+4);
2493 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
+4, flags
, true);
2494 newline_and_indent (pp
, spc
+2);
2495 pp_right_brace (pp
);
2496 newline_and_indent (pp
, spc
);
2498 (TREE_CODE (node
) == TRY_CATCH_EXPR
) ? "catch" : "finally");
2499 newline_and_indent (pp
, spc
+2);
2501 newline_and_indent (pp
, spc
+4);
2502 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
+4, flags
, true);
2503 newline_and_indent (pp
, spc
+2);
2504 pp_right_brace (pp
);
2509 pp_string (pp
, "catch (");
2510 dump_generic_node (pp
, CATCH_TYPES (node
), spc
+2, flags
, false);
2511 pp_right_paren (pp
);
2512 newline_and_indent (pp
, spc
+2);
2514 newline_and_indent (pp
, spc
+4);
2515 dump_generic_node (pp
, CATCH_BODY (node
), spc
+4, flags
, true);
2516 newline_and_indent (pp
, spc
+2);
2517 pp_right_brace (pp
);
2521 case EH_FILTER_EXPR
:
2522 pp_string (pp
, "<<<eh_filter (");
2523 dump_generic_node (pp
, EH_FILTER_TYPES (node
), spc
+2, flags
, false);
2524 pp_string (pp
, ")>>>");
2525 newline_and_indent (pp
, spc
+2);
2527 newline_and_indent (pp
, spc
+4);
2528 dump_generic_node (pp
, EH_FILTER_FAILURE (node
), spc
+4, flags
, true);
2529 newline_and_indent (pp
, spc
+2);
2530 pp_right_brace (pp
);
2535 op0
= TREE_OPERAND (node
, 0);
2536 /* If this is for break or continue, don't bother printing it. */
2537 if (DECL_NAME (op0
))
2539 const char *name
= IDENTIFIER_POINTER (DECL_NAME (op0
));
2540 if (strcmp (name
, "break") == 0
2541 || strcmp (name
, "continue") == 0)
2544 dump_generic_node (pp
, op0
, spc
, flags
, false);
2546 if (DECL_NONLOCAL (op0
))
2547 pp_string (pp
, " [non-local]");
2551 pp_string (pp
, "while (1)");
2552 if (!(flags
& TDF_SLIM
))
2554 newline_and_indent (pp
, spc
+2);
2556 newline_and_indent (pp
, spc
+4);
2557 dump_generic_node (pp
, LOOP_EXPR_BODY (node
), spc
+4, flags
, true);
2558 newline_and_indent (pp
, spc
+2);
2559 pp_right_brace (pp
);
2565 pp_string (pp
, "// predicted ");
2566 if (PREDICT_EXPR_OUTCOME (node
))
2567 pp_string (pp
, "likely by ");
2569 pp_string (pp
, "unlikely by ");
2570 pp_string (pp
, predictor_name (PREDICT_EXPR_PREDICTOR (node
)));
2571 pp_string (pp
, " predictor.");
2575 pp_string (pp
, "ANNOTATE_EXPR <");
2576 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2577 switch ((enum annot_expr_kind
) TREE_INT_CST_LOW (TREE_OPERAND (node
, 1)))
2579 case annot_expr_ivdep_kind
:
2580 pp_string (pp
, ", ivdep");
2582 case annot_expr_no_vector_kind
:
2583 pp_string (pp
, ", no-vector");
2585 case annot_expr_vector_kind
:
2586 pp_string (pp
, ", vector");
2595 pp_string (pp
, "return");
2596 op0
= TREE_OPERAND (node
, 0);
2600 if (TREE_CODE (op0
) == MODIFY_EXPR
)
2601 dump_generic_node (pp
, TREE_OPERAND (op0
, 1),
2604 dump_generic_node (pp
, op0
, spc
, flags
, false);
2609 pp_string (pp
, "if (");
2610 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2611 pp_string (pp
, ") break");
2615 pp_string (pp
, "switch (");
2616 dump_generic_node (pp
, SWITCH_COND (node
), spc
, flags
, false);
2617 pp_right_paren (pp
);
2618 if (!(flags
& TDF_SLIM
))
2620 newline_and_indent (pp
, spc
+2);
2622 if (SWITCH_BODY (node
))
2624 newline_and_indent (pp
, spc
+4);
2625 dump_generic_node (pp
, SWITCH_BODY (node
), spc
+4, flags
,
2630 tree vec
= SWITCH_LABELS (node
);
2631 size_t i
, n
= TREE_VEC_LENGTH (vec
);
2632 for (i
= 0; i
< n
; ++i
)
2634 tree elt
= TREE_VEC_ELT (vec
, i
);
2635 newline_and_indent (pp
, spc
+4);
2638 dump_generic_node (pp
, elt
, spc
+4, flags
, false);
2639 pp_string (pp
, " goto ");
2640 dump_generic_node (pp
, CASE_LABEL (elt
), spc
+4,
2645 pp_string (pp
, "case ???: goto ???;");
2648 newline_and_indent (pp
, spc
+2);
2649 pp_right_brace (pp
);
2655 op0
= GOTO_DESTINATION (node
);
2656 if (TREE_CODE (op0
) != SSA_NAME
&& DECL_P (op0
) && DECL_NAME (op0
))
2658 const char *name
= IDENTIFIER_POINTER (DECL_NAME (op0
));
2659 if (strcmp (name
, "break") == 0
2660 || strcmp (name
, "continue") == 0)
2662 pp_string (pp
, name
);
2666 pp_string (pp
, "goto ");
2667 dump_generic_node (pp
, op0
, spc
, flags
, false);
2671 pp_string (pp
, "__asm__");
2672 if (ASM_VOLATILE_P (node
))
2673 pp_string (pp
, " __volatile__");
2675 dump_generic_node (pp
, ASM_STRING (node
), spc
, flags
, false);
2677 dump_generic_node (pp
, ASM_OUTPUTS (node
), spc
, flags
, false);
2679 dump_generic_node (pp
, ASM_INPUTS (node
), spc
, flags
, false);
2680 if (ASM_CLOBBERS (node
))
2683 dump_generic_node (pp
, ASM_CLOBBERS (node
), spc
, flags
, false);
2685 pp_right_paren (pp
);
2688 case CASE_LABEL_EXPR
:
2689 if (CASE_LOW (node
) && CASE_HIGH (node
))
2691 pp_string (pp
, "case ");
2692 dump_generic_node (pp
, CASE_LOW (node
), spc
, flags
, false);
2693 pp_string (pp
, " ... ");
2694 dump_generic_node (pp
, CASE_HIGH (node
), spc
, flags
, false);
2696 else if (CASE_LOW (node
))
2698 pp_string (pp
, "case ");
2699 dump_generic_node (pp
, CASE_LOW (node
), spc
, flags
, false);
2702 pp_string (pp
, "default");
2707 pp_string (pp
, "OBJ_TYPE_REF(");
2708 dump_generic_node (pp
, OBJ_TYPE_REF_EXPR (node
), spc
, flags
, false);
2710 if (!(flags
& TDF_SLIM
) && virtual_method_call_p (node
))
2712 pp_string (pp
, "(");
2713 dump_generic_node (pp
, obj_type_ref_class (node
), spc
, flags
, false);
2714 pp_string (pp
, ")");
2716 dump_generic_node (pp
, OBJ_TYPE_REF_OBJECT (node
), spc
, flags
, false);
2718 dump_generic_node (pp
, OBJ_TYPE_REF_TOKEN (node
), spc
, flags
, false);
2719 pp_right_paren (pp
);
2723 if (SSA_NAME_IDENTIFIER (node
))
2725 if ((flags
& TDF_NOUID
)
2726 && SSA_NAME_VAR (node
)
2727 && DECL_NAMELESS (SSA_NAME_VAR (node
)))
2728 dump_fancy_name (pp
, SSA_NAME_IDENTIFIER (node
));
2729 else if (! (flags
& TDF_GIMPLE
)
2730 || SSA_NAME_VAR (node
))
2731 dump_generic_node (pp
, SSA_NAME_IDENTIFIER (node
),
2735 pp_decimal_int (pp
, SSA_NAME_VERSION (node
));
2736 if (SSA_NAME_IS_DEFAULT_DEF (node
))
2737 pp_string (pp
, "(D)");
2738 if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (node
))
2739 pp_string (pp
, "(ab)");
2742 case WITH_SIZE_EXPR
:
2743 pp_string (pp
, "WITH_SIZE_EXPR <");
2744 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2745 pp_string (pp
, ", ");
2746 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2751 pp_string (pp
, "ASSERT_EXPR <");
2752 dump_generic_node (pp
, ASSERT_EXPR_VAR (node
), spc
, flags
, false);
2753 pp_string (pp
, ", ");
2754 dump_generic_node (pp
, ASSERT_EXPR_COND (node
), spc
, flags
, false);
2759 pp_string (pp
, "scev_known");
2762 case SCEV_NOT_KNOWN
:
2763 pp_string (pp
, "scev_not_known");
2766 case POLYNOMIAL_CHREC
:
2768 dump_generic_node (pp
, CHREC_LEFT (node
), spc
, flags
, false);
2769 pp_string (pp
, ", +, ");
2770 dump_generic_node (pp
, CHREC_RIGHT (node
), spc
, flags
, false);
2771 pp_string (pp
, "}_");
2772 dump_generic_node (pp
, CHREC_VAR (node
), spc
, flags
, false);
2776 case REALIGN_LOAD_EXPR
:
2777 pp_string (pp
, "REALIGN_LOAD <");
2778 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2779 pp_string (pp
, ", ");
2780 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2781 pp_string (pp
, ", ");
2782 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2787 pp_string (pp
, " VEC_COND_EXPR < ");
2788 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2789 pp_string (pp
, " , ");
2790 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2791 pp_string (pp
, " , ");
2792 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2793 pp_string (pp
, " > ");
2797 pp_string (pp
, " VEC_PERM_EXPR < ");
2798 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2799 pp_string (pp
, " , ");
2800 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2801 pp_string (pp
, " , ");
2802 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2803 pp_string (pp
, " > ");
2807 pp_string (pp
, " DOT_PROD_EXPR < ");
2808 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2809 pp_string (pp
, ", ");
2810 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2811 pp_string (pp
, ", ");
2812 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2813 pp_string (pp
, " > ");
2816 case WIDEN_MULT_PLUS_EXPR
:
2817 pp_string (pp
, " WIDEN_MULT_PLUS_EXPR < ");
2818 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2819 pp_string (pp
, ", ");
2820 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2821 pp_string (pp
, ", ");
2822 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2823 pp_string (pp
, " > ");
2826 case WIDEN_MULT_MINUS_EXPR
:
2827 pp_string (pp
, " WIDEN_MULT_MINUS_EXPR < ");
2828 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2829 pp_string (pp
, ", ");
2830 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2831 pp_string (pp
, ", ");
2832 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2833 pp_string (pp
, " > ");
2837 pp_string (pp
, " FMA_EXPR < ");
2838 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2839 pp_string (pp
, ", ");
2840 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2841 pp_string (pp
, ", ");
2842 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2843 pp_string (pp
, " > ");
2847 pp_string (pp
, "#pragma acc parallel");
2848 goto dump_omp_clauses_body
;
2851 pp_string (pp
, "#pragma acc kernels");
2852 goto dump_omp_clauses_body
;
2855 pp_string (pp
, "#pragma acc data");
2856 dump_omp_clauses (pp
, OACC_DATA_CLAUSES (node
), spc
, flags
);
2859 case OACC_HOST_DATA
:
2860 pp_string (pp
, "#pragma acc host_data");
2861 dump_omp_clauses (pp
, OACC_HOST_DATA_CLAUSES (node
), spc
, flags
);
2865 pp_string (pp
, "#pragma acc declare");
2866 dump_omp_clauses (pp
, OACC_DECLARE_CLAUSES (node
), spc
, flags
);
2870 pp_string (pp
, "#pragma acc update");
2871 dump_omp_clauses (pp
, OACC_UPDATE_CLAUSES (node
), spc
, flags
);
2874 case OACC_ENTER_DATA
:
2875 pp_string (pp
, "#pragma acc enter data");
2876 dump_omp_clauses (pp
, OACC_ENTER_DATA_CLAUSES (node
), spc
, flags
);
2879 case OACC_EXIT_DATA
:
2880 pp_string (pp
, "#pragma acc exit data");
2881 dump_omp_clauses (pp
, OACC_EXIT_DATA_CLAUSES (node
), spc
, flags
);
2885 pp_string (pp
, "#pragma acc cache");
2886 dump_omp_clauses (pp
, OACC_CACHE_CLAUSES (node
), spc
, flags
);
2890 pp_string (pp
, "#pragma omp parallel");
2891 dump_omp_clauses (pp
, OMP_PARALLEL_CLAUSES (node
), spc
, flags
);
2894 dump_omp_clauses_body
:
2895 dump_omp_clauses (pp
, OMP_CLAUSES (node
), spc
, flags
);
2899 if (!(flags
& TDF_SLIM
) && OMP_BODY (node
))
2901 newline_and_indent (pp
, spc
+ 2);
2903 newline_and_indent (pp
, spc
+ 4);
2904 dump_generic_node (pp
, OMP_BODY (node
), spc
+ 4, flags
, false);
2905 newline_and_indent (pp
, spc
+ 2);
2906 pp_right_brace (pp
);
2912 pp_string (pp
, "#pragma omp task");
2913 dump_omp_clauses (pp
, OMP_TASK_CLAUSES (node
), spc
, flags
);
2917 pp_string (pp
, "#pragma omp for");
2921 pp_string (pp
, "#pragma omp simd");
2925 pp_string (pp
, "#pragma simd");
2929 /* This label points one line after dumping the clauses.
2930 For _Cilk_for the clauses are dumped after the _Cilk_for (...)
2931 parameters are printed out. */
2932 goto dump_omp_loop_cilk_for
;
2934 case OMP_DISTRIBUTE
:
2935 pp_string (pp
, "#pragma omp distribute");
2939 pp_string (pp
, "#pragma omp taskloop");
2943 pp_string (pp
, "#pragma acc loop");
2947 pp_string (pp
, "#pragma omp teams");
2948 dump_omp_clauses (pp
, OMP_TEAMS_CLAUSES (node
), spc
, flags
);
2951 case OMP_TARGET_DATA
:
2952 pp_string (pp
, "#pragma omp target data");
2953 dump_omp_clauses (pp
, OMP_TARGET_DATA_CLAUSES (node
), spc
, flags
);
2956 case OMP_TARGET_ENTER_DATA
:
2957 pp_string (pp
, "#pragma omp target enter data");
2958 dump_omp_clauses (pp
, OMP_TARGET_ENTER_DATA_CLAUSES (node
), spc
, flags
);
2962 case OMP_TARGET_EXIT_DATA
:
2963 pp_string (pp
, "#pragma omp target exit data");
2964 dump_omp_clauses (pp
, OMP_TARGET_EXIT_DATA_CLAUSES (node
), spc
, flags
);
2969 pp_string (pp
, "#pragma omp target");
2970 dump_omp_clauses (pp
, OMP_TARGET_CLAUSES (node
), spc
, flags
);
2973 case OMP_TARGET_UPDATE
:
2974 pp_string (pp
, "#pragma omp target update");
2975 dump_omp_clauses (pp
, OMP_TARGET_UPDATE_CLAUSES (node
), spc
, flags
);
2980 dump_omp_clauses (pp
, OMP_FOR_CLAUSES (node
), spc
, flags
);
2982 dump_omp_loop_cilk_for
:
2983 if (!(flags
& TDF_SLIM
))
2987 if (OMP_FOR_PRE_BODY (node
))
2989 if (TREE_CODE (node
) == CILK_FOR
)
2990 pp_string (pp
, " ");
2992 newline_and_indent (pp
, spc
+ 2);
2995 newline_and_indent (pp
, spc
);
2996 dump_generic_node (pp
, OMP_FOR_PRE_BODY (node
),
2999 if (OMP_FOR_INIT (node
))
3002 for (i
= 0; i
< TREE_VEC_LENGTH (OMP_FOR_INIT (node
)); i
++)
3005 if (TREE_CODE (node
) != CILK_FOR
|| OMP_FOR_PRE_BODY (node
))
3006 newline_and_indent (pp
, spc
);
3007 if (TREE_CODE (node
) == CILK_FOR
)
3008 pp_string (pp
, "_Cilk_for (");
3010 pp_string (pp
, "for (");
3011 dump_generic_node (pp
,
3012 TREE_VEC_ELT (OMP_FOR_INIT (node
), i
),
3014 pp_string (pp
, "; ");
3015 dump_generic_node (pp
,
3016 TREE_VEC_ELT (OMP_FOR_COND (node
), i
),
3018 pp_string (pp
, "; ");
3019 dump_generic_node (pp
,
3020 TREE_VEC_ELT (OMP_FOR_INCR (node
), i
),
3022 pp_right_paren (pp
);
3024 if (TREE_CODE (node
) == CILK_FOR
)
3025 dump_omp_clauses (pp
, OMP_FOR_CLAUSES (node
), spc
, flags
);
3027 if (OMP_FOR_BODY (node
))
3029 newline_and_indent (pp
, spc
+ 2);
3031 newline_and_indent (pp
, spc
+ 4);
3032 dump_generic_node (pp
, OMP_FOR_BODY (node
), spc
+ 4, flags
,
3034 newline_and_indent (pp
, spc
+ 2);
3035 pp_right_brace (pp
);
3037 if (OMP_FOR_INIT (node
))
3038 spc
-= 2 * TREE_VEC_LENGTH (OMP_FOR_INIT (node
)) - 2;
3039 if (OMP_FOR_PRE_BODY (node
))
3042 newline_and_indent (pp
, spc
+ 2);
3043 pp_right_brace (pp
);
3050 pp_string (pp
, "#pragma omp sections");
3051 dump_omp_clauses (pp
, OMP_SECTIONS_CLAUSES (node
), spc
, flags
);
3055 pp_string (pp
, "#pragma omp section");
3059 pp_string (pp
, "#pragma omp master");
3063 pp_string (pp
, "#pragma omp taskgroup");
3067 pp_string (pp
, "#pragma omp ordered");
3068 dump_omp_clauses (pp
, OMP_ORDERED_CLAUSES (node
), spc
, flags
);
3072 pp_string (pp
, "#pragma omp critical");
3073 if (OMP_CRITICAL_NAME (node
))
3077 dump_generic_node (pp
, OMP_CRITICAL_NAME (node
), spc
,
3079 pp_right_paren (pp
);
3081 dump_omp_clauses (pp
, OMP_CRITICAL_CLAUSES (node
), spc
, flags
);
3085 pp_string (pp
, "#pragma omp atomic");
3086 if (OMP_ATOMIC_SEQ_CST (node
))
3087 pp_string (pp
, " seq_cst");
3088 newline_and_indent (pp
, spc
+ 2);
3089 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3093 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3096 case OMP_ATOMIC_READ
:
3097 pp_string (pp
, "#pragma omp atomic read");
3098 if (OMP_ATOMIC_SEQ_CST (node
))
3099 pp_string (pp
, " seq_cst");
3100 newline_and_indent (pp
, spc
+ 2);
3101 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3105 case OMP_ATOMIC_CAPTURE_OLD
:
3106 case OMP_ATOMIC_CAPTURE_NEW
:
3107 pp_string (pp
, "#pragma omp atomic capture");
3108 if (OMP_ATOMIC_SEQ_CST (node
))
3109 pp_string (pp
, " seq_cst");
3110 newline_and_indent (pp
, spc
+ 2);
3111 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3115 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3119 pp_string (pp
, "#pragma omp single");
3120 dump_omp_clauses (pp
, OMP_SINGLE_CLAUSES (node
), spc
, flags
);
3124 dump_omp_clause (pp
, node
, spc
, flags
);
3128 case TRANSACTION_EXPR
:
3129 if (TRANSACTION_EXPR_OUTER (node
))
3130 pp_string (pp
, "__transaction_atomic [[outer]]");
3131 else if (TRANSACTION_EXPR_RELAXED (node
))
3132 pp_string (pp
, "__transaction_relaxed");
3134 pp_string (pp
, "__transaction_atomic");
3135 if (!(flags
& TDF_SLIM
) && TRANSACTION_EXPR_BODY (node
))
3137 newline_and_indent (pp
, spc
);
3139 newline_and_indent (pp
, spc
+ 2);
3140 dump_generic_node (pp
, TRANSACTION_EXPR_BODY (node
),
3141 spc
+ 2, flags
, false);
3142 newline_and_indent (pp
, spc
);
3143 pp_right_brace (pp
);
3148 case REDUC_MAX_EXPR
:
3149 pp_string (pp
, " REDUC_MAX_EXPR < ");
3150 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3151 pp_string (pp
, " > ");
3154 case REDUC_MIN_EXPR
:
3155 pp_string (pp
, " REDUC_MIN_EXPR < ");
3156 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3157 pp_string (pp
, " > ");
3160 case REDUC_PLUS_EXPR
:
3161 pp_string (pp
, " REDUC_PLUS_EXPR < ");
3162 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3163 pp_string (pp
, " > ");
3166 case VEC_WIDEN_MULT_HI_EXPR
:
3167 case VEC_WIDEN_MULT_LO_EXPR
:
3168 case VEC_WIDEN_MULT_EVEN_EXPR
:
3169 case VEC_WIDEN_MULT_ODD_EXPR
:
3170 case VEC_WIDEN_LSHIFT_HI_EXPR
:
3171 case VEC_WIDEN_LSHIFT_LO_EXPR
:
3173 for (str
= get_tree_code_name (code
); *str
; str
++)
3174 pp_character (pp
, TOUPPER (*str
));
3175 pp_string (pp
, " < ");
3176 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3177 pp_string (pp
, ", ");
3178 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3179 pp_string (pp
, " > ");
3182 case VEC_UNPACK_HI_EXPR
:
3183 pp_string (pp
, " VEC_UNPACK_HI_EXPR < ");
3184 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3185 pp_string (pp
, " > ");
3188 case VEC_UNPACK_LO_EXPR
:
3189 pp_string (pp
, " VEC_UNPACK_LO_EXPR < ");
3190 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3191 pp_string (pp
, " > ");
3194 case VEC_UNPACK_FLOAT_HI_EXPR
:
3195 pp_string (pp
, " VEC_UNPACK_FLOAT_HI_EXPR < ");
3196 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3197 pp_string (pp
, " > ");
3200 case VEC_UNPACK_FLOAT_LO_EXPR
:
3201 pp_string (pp
, " VEC_UNPACK_FLOAT_LO_EXPR < ");
3202 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3203 pp_string (pp
, " > ");
3206 case VEC_PACK_TRUNC_EXPR
:
3207 pp_string (pp
, " VEC_PACK_TRUNC_EXPR < ");
3208 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3209 pp_string (pp
, ", ");
3210 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3211 pp_string (pp
, " > ");
3214 case VEC_PACK_SAT_EXPR
:
3215 pp_string (pp
, " VEC_PACK_SAT_EXPR < ");
3216 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3217 pp_string (pp
, ", ");
3218 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3219 pp_string (pp
, " > ");
3222 case VEC_PACK_FIX_TRUNC_EXPR
:
3223 pp_string (pp
, " VEC_PACK_FIX_TRUNC_EXPR < ");
3224 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3225 pp_string (pp
, ", ");
3226 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3227 pp_string (pp
, " > ");
3231 dump_block_node (pp
, node
, spc
, flags
);
3234 case CILK_SPAWN_STMT
:
3235 pp_string (pp
, "_Cilk_spawn ");
3236 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3239 case CILK_SYNC_STMT
:
3240 pp_string (pp
, "_Cilk_sync");
3247 if (is_stmt
&& is_expr
)
3253 /* Print the declaration of a variable. */
3256 print_declaration (pretty_printer
*pp
, tree t
, int spc
, int flags
)
3260 if (TREE_CODE(t
) == NAMELIST_DECL
)
3262 pp_string(pp
, "namelist ");
3263 dump_decl_name (pp
, t
, flags
);
3268 if (TREE_CODE (t
) == TYPE_DECL
)
3269 pp_string (pp
, "typedef ");
3271 if (CODE_CONTAINS_STRUCT (TREE_CODE (t
), TS_DECL_WRTL
) && DECL_REGISTER (t
))
3272 pp_string (pp
, "register ");
3274 if (TREE_PUBLIC (t
) && DECL_EXTERNAL (t
))
3275 pp_string (pp
, "extern ");
3276 else if (TREE_STATIC (t
))
3277 pp_string (pp
, "static ");
3279 /* Print the type and name. */
3280 if (TREE_TYPE (t
) && TREE_CODE (TREE_TYPE (t
)) == ARRAY_TYPE
)
3284 /* Print array's type. */
3285 tmp
= TREE_TYPE (t
);
3286 while (TREE_CODE (TREE_TYPE (tmp
)) == ARRAY_TYPE
)
3287 tmp
= TREE_TYPE (tmp
);
3288 dump_generic_node (pp
, TREE_TYPE (tmp
), spc
, flags
, false);
3290 /* Print variable's name. */
3292 dump_generic_node (pp
, t
, spc
, flags
, false);
3294 /* Print the dimensions. */
3295 tmp
= TREE_TYPE (t
);
3296 while (TREE_CODE (tmp
) == ARRAY_TYPE
)
3298 dump_array_domain (pp
, TYPE_DOMAIN (tmp
), spc
, flags
);
3299 tmp
= TREE_TYPE (tmp
);
3302 else if (TREE_CODE (t
) == FUNCTION_DECL
)
3304 dump_generic_node (pp
, TREE_TYPE (TREE_TYPE (t
)), spc
, flags
, false);
3306 dump_decl_name (pp
, t
, flags
);
3307 dump_function_declaration (pp
, TREE_TYPE (t
), spc
, flags
);
3311 /* Print type declaration. */
3312 dump_generic_node (pp
, TREE_TYPE (t
), spc
, flags
, false);
3314 /* Print variable's name. */
3316 dump_generic_node (pp
, t
, spc
, flags
, false);
3319 if (VAR_P (t
) && DECL_HARD_REGISTER (t
))
3321 pp_string (pp
, " __asm__ ");
3323 dump_generic_node (pp
, DECL_ASSEMBLER_NAME (t
), spc
, flags
, false);
3324 pp_right_paren (pp
);
3327 /* The initial value of a function serves to determine whether the function
3328 is declared or defined. So the following does not apply to function
3330 if (TREE_CODE (t
) != FUNCTION_DECL
)
3332 /* Print the initial value. */
3333 if (DECL_INITIAL (t
))
3338 dump_generic_node (pp
, DECL_INITIAL (t
), spc
, flags
, false);
3342 if (VAR_P (t
) && DECL_HAS_VALUE_EXPR_P (t
))
3344 pp_string (pp
, " [value-expr: ");
3345 dump_generic_node (pp
, DECL_VALUE_EXPR (t
), spc
, flags
, false);
3346 pp_right_bracket (pp
);
3353 /* Prints a structure: name, fields, and methods.
3354 FIXME: Still incomplete. */
3357 print_struct_decl (pretty_printer
*pp
, const_tree node
, int spc
, int flags
)
3359 /* Print the name of the structure. */
3360 if (TYPE_NAME (node
))
3363 if (TREE_CODE (node
) == RECORD_TYPE
)
3364 pp_string (pp
, "struct ");
3365 else if ((TREE_CODE (node
) == UNION_TYPE
3366 || TREE_CODE (node
) == QUAL_UNION_TYPE
))
3367 pp_string (pp
, "union ");
3369 dump_generic_node (pp
, TYPE_NAME (node
), spc
, 0, false);
3372 /* Print the contents of the structure. */
3378 /* Print the fields of the structure. */
3381 tmp
= TYPE_FIELDS (node
);
3384 /* Avoid to print recursively the structure. */
3385 /* FIXME : Not implemented correctly...,
3386 what about the case when we have a cycle in the contain graph? ...
3387 Maybe this could be solved by looking at the scope in which the
3388 structure was declared. */
3389 if (TREE_TYPE (tmp
) != node
3390 && (TREE_CODE (TREE_TYPE (tmp
)) != POINTER_TYPE
3391 || TREE_TYPE (TREE_TYPE (tmp
)) != node
))
3393 print_declaration (pp
, tmp
, spc
+2, flags
);
3396 tmp
= DECL_CHAIN (tmp
);
3400 pp_right_brace (pp
);
3403 /* Return the priority of the operator CODE.
3405 From lowest to highest precedence with either left-to-right (L-R)
3406 or right-to-left (R-L) associativity]:
3409 2 [R-L] = += -= *= /= %= &= ^= |= <<= >>=
3421 14 [R-L] ! ~ ++ -- + - * & (type) sizeof
3422 15 [L-R] fn() [] -> .
3424 unary +, - and * have higher precedence than the corresponding binary
3428 op_code_prio (enum tree_code code
)
3445 case TRUTH_ORIF_EXPR
:
3448 case TRUTH_AND_EXPR
:
3449 case TRUTH_ANDIF_EXPR
:
3456 case TRUTH_XOR_EXPR
:
3473 case UNORDERED_EXPR
:
3484 case VEC_WIDEN_LSHIFT_HI_EXPR
:
3485 case VEC_WIDEN_LSHIFT_LO_EXPR
:
3486 case WIDEN_LSHIFT_EXPR
:
3489 case WIDEN_SUM_EXPR
:
3491 case POINTER_PLUS_EXPR
:
3495 case VEC_WIDEN_MULT_HI_EXPR
:
3496 case VEC_WIDEN_MULT_LO_EXPR
:
3497 case WIDEN_MULT_EXPR
:
3499 case WIDEN_MULT_PLUS_EXPR
:
3500 case WIDEN_MULT_MINUS_EXPR
:
3502 case MULT_HIGHPART_EXPR
:
3503 case TRUNC_DIV_EXPR
:
3505 case FLOOR_DIV_EXPR
:
3506 case ROUND_DIV_EXPR
:
3508 case EXACT_DIV_EXPR
:
3509 case TRUNC_MOD_EXPR
:
3511 case FLOOR_MOD_EXPR
:
3512 case ROUND_MOD_EXPR
:
3516 case TRUTH_NOT_EXPR
:
3518 case POSTINCREMENT_EXPR
:
3519 case POSTDECREMENT_EXPR
:
3520 case PREINCREMENT_EXPR
:
3521 case PREDECREMENT_EXPR
:
3527 case FIX_TRUNC_EXPR
:
3533 case ARRAY_RANGE_REF
:
3537 /* Special expressions. */
3543 case REDUC_MAX_EXPR
:
3544 case REDUC_MIN_EXPR
:
3545 case REDUC_PLUS_EXPR
:
3546 case VEC_UNPACK_HI_EXPR
:
3547 case VEC_UNPACK_LO_EXPR
:
3548 case VEC_UNPACK_FLOAT_HI_EXPR
:
3549 case VEC_UNPACK_FLOAT_LO_EXPR
:
3550 case VEC_PACK_TRUNC_EXPR
:
3551 case VEC_PACK_SAT_EXPR
:
3555 /* Return an arbitrarily high precedence to avoid surrounding single
3556 VAR_DECLs in ()s. */
3561 /* Return the priority of the operator OP. */
3564 op_prio (const_tree op
)
3566 enum tree_code code
;
3571 code
= TREE_CODE (op
);
3572 if (code
== SAVE_EXPR
|| code
== NON_LVALUE_EXPR
)
3573 return op_prio (TREE_OPERAND (op
, 0));
3575 return op_code_prio (code
);
3578 /* Return the symbol associated with operator CODE. */
3581 op_symbol_code (enum tree_code code
)
3589 case TRUTH_ORIF_EXPR
:
3592 case TRUTH_AND_EXPR
:
3593 case TRUTH_ANDIF_EXPR
:
3599 case TRUTH_XOR_EXPR
:
3609 case UNORDERED_EXPR
:
3655 case WIDEN_LSHIFT_EXPR
:
3658 case POINTER_PLUS_EXPR
:
3664 case REDUC_PLUS_EXPR
:
3667 case WIDEN_SUM_EXPR
:
3670 case WIDEN_MULT_EXPR
:
3673 case MULT_HIGHPART_EXPR
:
3683 case TRUTH_NOT_EXPR
:
3690 case TRUNC_DIV_EXPR
:
3697 case FLOOR_DIV_EXPR
:
3700 case ROUND_DIV_EXPR
:
3703 case EXACT_DIV_EXPR
:
3706 case TRUNC_MOD_EXPR
:
3712 case FLOOR_MOD_EXPR
:
3715 case ROUND_MOD_EXPR
:
3718 case PREDECREMENT_EXPR
:
3721 case PREINCREMENT_EXPR
:
3724 case POSTDECREMENT_EXPR
:
3727 case POSTINCREMENT_EXPR
:
3737 return "<<< ??? >>>";
3741 /* Return the symbol associated with operator OP. */
3744 op_symbol (const_tree op
)
3746 return op_symbol_code (TREE_CODE (op
));
3749 /* Prints the name of a call. NODE is the CALL_EXPR_FN of a CALL_EXPR or
3750 the gimple_call_fn of a GIMPLE_CALL. */
3753 print_call_name (pretty_printer
*pp
, tree node
, int flags
)
3757 if (TREE_CODE (op0
) == NON_LVALUE_EXPR
)
3758 op0
= TREE_OPERAND (op0
, 0);
3761 switch (TREE_CODE (op0
))
3766 dump_function_name (pp
, op0
, flags
);
3772 op0
= TREE_OPERAND (op0
, 0);
3777 dump_generic_node (pp
, TREE_OPERAND (op0
, 0), 0, flags
, false);
3778 pp_string (pp
, ") ? ");
3779 dump_generic_node (pp
, TREE_OPERAND (op0
, 1), 0, flags
, false);
3780 pp_string (pp
, " : ");
3781 dump_generic_node (pp
, TREE_OPERAND (op0
, 2), 0, flags
, false);
3785 if (TREE_CODE (TREE_OPERAND (op0
, 0)) == VAR_DECL
)
3786 dump_function_name (pp
, TREE_OPERAND (op0
, 0), flags
);
3788 dump_generic_node (pp
, op0
, 0, flags
, false);
3792 if (integer_zerop (TREE_OPERAND (op0
, 1)))
3794 op0
= TREE_OPERAND (op0
, 0);
3801 dump_generic_node (pp
, op0
, 0, flags
, false);
3809 /* Parses the string STR and replaces new-lines by '\n', tabs by '\t', ... */
3812 pretty_print_string (pretty_printer
*pp
, const char *str
)
3822 pp_string (pp
, "\\b");
3826 pp_string (pp
, "\\f");
3830 pp_string (pp
, "\\n");
3834 pp_string (pp
, "\\r");
3838 pp_string (pp
, "\\t");
3842 pp_string (pp
, "\\v");
3846 pp_string (pp
, "\\\\");
3850 pp_string (pp
, "\\\"");
3854 pp_string (pp
, "\\'");
3857 /* No need to handle \0; the loop terminates on \0. */
3860 pp_string (pp
, "\\1");
3864 pp_string (pp
, "\\2");
3868 pp_string (pp
, "\\3");
3872 pp_string (pp
, "\\4");
3876 pp_string (pp
, "\\5");
3880 pp_string (pp
, "\\6");
3884 pp_string (pp
, "\\7");
3888 if (!ISPRINT (str
[0]))
3891 sprintf (buf
, "\\x%x", (unsigned char)str
[0]);
3892 pp_string (pp
, buf
);
3895 pp_character (pp
, str
[0]);
3903 maybe_init_pretty_print (FILE *file
)
3907 tree_pp
= new pretty_printer ();
3908 pp_needs_newline (tree_pp
) = true;
3909 pp_translate_identifiers (tree_pp
) = false;
3912 tree_pp
->buffer
->stream
= file
;
3916 newline_and_indent (pretty_printer
*pp
, int spc
)
3922 /* Handle a %K format for TEXT. Separate from default_tree_printer so
3923 it can also be used in front ends.
3924 %K: a statement, from which EXPR_LOCATION and TREE_BLOCK will be recorded.
3928 percent_K_format (text_info
*text
)
3930 tree t
= va_arg (*text
->args_ptr
, tree
), block
;
3931 text
->set_location (0, EXPR_LOCATION (t
), true);
3932 gcc_assert (pp_ti_abstract_origin (text
) != NULL
);
3933 block
= TREE_BLOCK (t
);
3934 *pp_ti_abstract_origin (text
) = NULL
;
3938 /* ??? LTO drops all BLOCK_ABSTRACT_ORIGINs apart from those
3939 representing the outermost block of an inlined function.
3940 So walk the BLOCK tree until we hit such a scope. */
3942 && TREE_CODE (block
) == BLOCK
)
3944 if (inlined_function_outer_scope_p (block
))
3946 *pp_ti_abstract_origin (text
) = block
;
3949 block
= BLOCK_SUPERCONTEXT (block
);
3955 && TREE_CODE (block
) == BLOCK
3956 && BLOCK_ABSTRACT_ORIGIN (block
))
3958 tree ao
= BLOCK_ABSTRACT_ORIGIN (block
);
3960 while (TREE_CODE (ao
) == BLOCK
3961 && BLOCK_ABSTRACT_ORIGIN (ao
)
3962 && BLOCK_ABSTRACT_ORIGIN (ao
) != ao
)
3963 ao
= BLOCK_ABSTRACT_ORIGIN (ao
);
3965 if (TREE_CODE (ao
) == FUNCTION_DECL
)
3967 *pp_ti_abstract_origin (text
) = block
;
3970 block
= BLOCK_SUPERCONTEXT (block
);
3974 /* Print the identifier ID to PRETTY-PRINTER. */
3977 pp_tree_identifier (pretty_printer
*pp
, tree id
)
3979 if (pp_translate_identifiers (pp
))
3981 const char *text
= identifier_to_locale (IDENTIFIER_POINTER (id
));
3982 pp_append_text (pp
, text
, text
+ strlen (text
));
3985 pp_append_text (pp
, IDENTIFIER_POINTER (id
),
3986 IDENTIFIER_POINTER (id
) + IDENTIFIER_LENGTH (id
));
3989 /* A helper function that is used to dump function information before the
3993 dump_function_header (FILE *dump_file
, tree fdecl
, int flags
)
3995 const char *dname
, *aname
;
3996 struct cgraph_node
*node
= cgraph_node::get (fdecl
);
3997 struct function
*fun
= DECL_STRUCT_FUNCTION (fdecl
);
3999 dname
= lang_hooks
.decl_printable_name (fdecl
, 2);
4001 if (DECL_ASSEMBLER_NAME_SET_P (fdecl
))
4002 aname
= (IDENTIFIER_POINTER
4003 (DECL_ASSEMBLER_NAME (fdecl
)));
4005 aname
= "<unset-asm-name>";
4007 fprintf (dump_file
, "\n;; Function %s (%s, funcdef_no=%d",
4008 dname
, aname
, fun
->funcdef_no
);
4009 if (!(flags
& TDF_NOUID
))
4010 fprintf (dump_file
, ", decl_uid=%d", DECL_UID (fdecl
));
4013 fprintf (dump_file
, ", cgraph_uid=%d", node
->uid
);
4014 fprintf (dump_file
, ", symbol_order=%d)%s\n\n", node
->order
,
4015 node
->frequency
== NODE_FREQUENCY_HOT
4017 : node
->frequency
== NODE_FREQUENCY_UNLIKELY_EXECUTED
4018 ? " (unlikely executed)"
4019 : node
->frequency
== NODE_FREQUENCY_EXECUTED_ONCE
4020 ? " (executed once)"
4024 fprintf (dump_file
, ")\n\n");
4027 /* Dump double_int D to pretty_printer PP. UNS is true
4028 if D is unsigned and false otherwise. */
4030 pp_double_int (pretty_printer
*pp
, double_int d
, bool uns
)
4033 pp_wide_integer (pp
, d
.low
);
4034 else if (d
.fits_uhwi ())
4035 pp_unsigned_wide_integer (pp
, d
.low
);
4038 unsigned HOST_WIDE_INT low
= d
.low
;
4039 HOST_WIDE_INT high
= d
.high
;
4040 if (!uns
&& d
.is_negative ())
4043 high
= ~high
+ !low
;
4046 /* Would "%x%0*x" or "%x%*0x" get zero-padding on all
4048 sprintf (pp_buffer (pp
)->digit_buffer
,
4049 HOST_WIDE_INT_PRINT_DOUBLE_HEX
,
4050 (unsigned HOST_WIDE_INT
) high
, low
);
4051 pp_string (pp
, pp_buffer (pp
)->digit_buffer
);