1 /* Pretty formatting of GENERIC trees in C syntax.
2 Copyright (C) 2001-2015 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"
28 #include "stor-layout.h"
31 #include "insn-config.h"
40 #include "tree-pretty-print.h"
41 #include "gimple-expr.h"
43 #include "langhooks.h"
44 #include "tree-iterator.h"
45 #include "tree-chrec.h"
47 #include "value-prof.h"
48 #include "wide-int-print.h"
49 #include "internal-fn.h"
50 #include "gomp-constants.h"
52 /* Local functions, macros and variables. */
53 static const char *op_symbol (const_tree
);
54 static void pretty_print_string (pretty_printer
*, const char*);
55 static void newline_and_indent (pretty_printer
*, int);
56 static void maybe_init_pretty_print (FILE *);
57 static void print_struct_decl (pretty_printer
*, const_tree
, int, int);
58 static void do_niy (pretty_printer
*, const_tree
);
60 #define INDENT(SPACE) do { \
61 int i; for (i = 0; i<SPACE; i++) pp_space (pp); } while (0)
63 #define NIY do_niy (pp, node)
65 static pretty_printer
*tree_pp
;
67 /* Try to print something for an unknown tree code. */
70 do_niy (pretty_printer
*pp
, const_tree node
)
74 pp_string (pp
, "<<< Unknown tree: ");
75 pp_string (pp
, get_tree_code_name (TREE_CODE (node
)));
79 len
= TREE_OPERAND_LENGTH (node
);
80 for (i
= 0; i
< len
; ++i
)
82 newline_and_indent (pp
, 2);
83 dump_generic_node (pp
, TREE_OPERAND (node
, i
), 2, 0, false);
87 pp_string (pp
, " >>>");
90 /* Debugging function to print out a generic expression. */
93 debug_generic_expr (tree t
)
95 print_generic_expr (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
);
96 fprintf (stderr
, "\n");
99 /* Debugging function to print out a generic statement. */
102 debug_generic_stmt (tree t
)
104 print_generic_stmt (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
);
105 fprintf (stderr
, "\n");
108 /* Debugging function to print out a chain of trees . */
111 debug_tree_chain (tree t
)
117 print_generic_expr (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
|TDF_UID
);
118 fprintf (stderr
, " ");
122 fprintf (stderr
, "... [cycled back to ");
123 print_generic_expr (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
|TDF_UID
);
124 fprintf (stderr
, "]");
128 fprintf (stderr
, "\n");
131 /* Prints declaration DECL to the FILE with details specified by FLAGS. */
133 print_generic_decl (FILE *file
, tree decl
, int flags
)
135 maybe_init_pretty_print (file
);
136 print_declaration (tree_pp
, decl
, 2, flags
);
137 pp_write_text_to_stream (tree_pp
);
140 /* Print tree T, and its successors, on file FILE. FLAGS specifies details
141 to show in the dump. See TDF_* in dumpfile.h. */
144 print_generic_stmt (FILE *file
, tree t
, int flags
)
146 maybe_init_pretty_print (file
);
147 dump_generic_node (tree_pp
, t
, 0, flags
, true);
148 pp_newline_and_flush (tree_pp
);
151 /* Print tree T, and its successors, on file FILE. FLAGS specifies details
152 to show in the dump. See TDF_* in dumpfile.h. The output is indented by
156 print_generic_stmt_indented (FILE *file
, tree t
, int flags
, int indent
)
160 maybe_init_pretty_print (file
);
162 for (i
= 0; i
< indent
; i
++)
164 dump_generic_node (tree_pp
, t
, indent
, flags
, true);
165 pp_newline_and_flush (tree_pp
);
168 /* Print a single expression T on file FILE. FLAGS specifies details to show
169 in the dump. See TDF_* in dumpfile.h. */
172 print_generic_expr (FILE *file
, tree t
, int flags
)
174 maybe_init_pretty_print (file
);
175 dump_generic_node (tree_pp
, t
, 0, flags
, false);
179 /* Dump the name of a _DECL node and its DECL_UID if TDF_UID is set
183 dump_decl_name (pretty_printer
*pp
, tree node
, int flags
)
185 if (DECL_NAME (node
))
187 if ((flags
& TDF_ASMNAME
) && DECL_ASSEMBLER_NAME_SET_P (node
))
188 pp_tree_identifier (pp
, DECL_ASSEMBLER_NAME (node
));
190 pp_tree_identifier (pp
, DECL_NAME (node
));
192 if ((flags
& TDF_UID
) || DECL_NAME (node
) == NULL_TREE
)
194 if (TREE_CODE (node
) == LABEL_DECL
&& LABEL_DECL_UID (node
) != -1)
195 pp_printf (pp
, "L.%d", (int) LABEL_DECL_UID (node
));
196 else if (TREE_CODE (node
) == DEBUG_EXPR_DECL
)
198 if (flags
& TDF_NOUID
)
199 pp_string (pp
, "D#xxxx");
201 pp_printf (pp
, "D#%i", DEBUG_TEMP_UID (node
));
205 char c
= TREE_CODE (node
) == CONST_DECL
? 'C' : 'D';
206 if (flags
& TDF_NOUID
)
207 pp_printf (pp
, "%c.xxxx", c
);
209 pp_printf (pp
, "%c.%u", c
, DECL_UID (node
));
212 if ((flags
& TDF_ALIAS
) && DECL_PT_UID (node
) != DECL_UID (node
))
214 if (flags
& TDF_NOUID
)
215 pp_printf (pp
, "ptD.xxxx");
217 pp_printf (pp
, "ptD.%u", DECL_PT_UID (node
));
221 /* Like the above, but used for pretty printing function calls. */
224 dump_function_name (pretty_printer
*pp
, tree node
, int flags
)
226 if (CONVERT_EXPR_P (node
))
227 node
= TREE_OPERAND (node
, 0);
228 if (DECL_NAME (node
) && (flags
& TDF_ASMNAME
) == 0)
229 pp_string (pp
, lang_hooks
.decl_printable_name (node
, 1));
231 dump_decl_name (pp
, node
, flags
);
234 /* Dump a function declaration. NODE is the FUNCTION_TYPE. PP, SPC and
235 FLAGS are as in dump_generic_node. */
238 dump_function_declaration (pretty_printer
*pp
, tree node
,
241 bool wrote_arg
= false;
247 /* Print the argument types. */
248 arg
= TYPE_ARG_TYPES (node
);
249 while (arg
&& arg
!= void_list_node
&& arg
!= error_mark_node
)
257 dump_generic_node (pp
, TREE_VALUE (arg
), spc
, flags
, false);
258 arg
= TREE_CHAIN (arg
);
261 /* Drop the trailing void_type_node if we had any previous argument. */
262 if (arg
== void_list_node
&& !wrote_arg
)
263 pp_string (pp
, "void");
264 /* Properly dump vararg function types. */
265 else if (!arg
&& wrote_arg
)
266 pp_string (pp
, ", ...");
267 /* Avoid printing any arg for unprototyped functions. */
272 /* Dump the domain associated with an array. */
275 dump_array_domain (pretty_printer
*pp
, tree domain
, int spc
, int flags
)
277 pp_left_bracket (pp
);
280 tree min
= TYPE_MIN_VALUE (domain
);
281 tree max
= TYPE_MAX_VALUE (domain
);
284 && integer_zerop (min
)
285 && tree_fits_shwi_p (max
))
286 pp_wide_integer (pp
, tree_to_shwi (max
) + 1);
290 dump_generic_node (pp
, min
, spc
, flags
, false);
293 dump_generic_node (pp
, max
, spc
, flags
, false);
297 pp_string (pp
, "<unknown>");
298 pp_right_bracket (pp
);
302 /* Dump OpenMP clause CLAUSE. PP, CLAUSE, SPC and FLAGS are as in
303 dump_generic_node. */
306 dump_omp_clause (pretty_printer
*pp
, tree clause
, int spc
, int flags
)
310 switch (OMP_CLAUSE_CODE (clause
))
312 case OMP_CLAUSE_PRIVATE
:
315 case OMP_CLAUSE_SHARED
:
318 case OMP_CLAUSE_FIRSTPRIVATE
:
319 name
= "firstprivate";
321 case OMP_CLAUSE_LASTPRIVATE
:
322 name
= "lastprivate";
324 case OMP_CLAUSE_COPYIN
:
327 case OMP_CLAUSE_COPYPRIVATE
:
328 name
= "copyprivate";
330 case OMP_CLAUSE_UNIFORM
:
333 case OMP_CLAUSE_USE_DEVICE_PTR
:
334 name
= "use_device_ptr";
336 case OMP_CLAUSE_IS_DEVICE_PTR
:
337 name
= "is_device_ptr";
339 case OMP_CLAUSE__LOOPTEMP_
:
342 case OMP_CLAUSE_DEVICE_RESIDENT
:
343 name
= "device_resident";
345 case OMP_CLAUSE_USE_DEVICE
:
348 case OMP_CLAUSE_TO_DECLARE
:
351 case OMP_CLAUSE_LINK
:
355 pp_string (pp
, name
);
357 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
362 case OMP_CLAUSE_REDUCTION
:
363 pp_string (pp
, "reduction(");
364 if (OMP_CLAUSE_REDUCTION_CODE (clause
) != ERROR_MARK
)
367 op_symbol_code (OMP_CLAUSE_REDUCTION_CODE (clause
)));
370 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
376 pp_string (pp
, "if(");
377 switch (OMP_CLAUSE_IF_MODIFIER (clause
))
379 case ERROR_MARK
: break;
380 case OMP_PARALLEL
: pp_string (pp
, "parallel:"); break;
381 case OMP_TASK
: pp_string (pp
, "task:"); break;
382 case OMP_TASKLOOP
: pp_string (pp
, "taskloop:"); break;
383 case OMP_TARGET_DATA
: pp_string (pp
, "target data:"); break;
384 case OMP_TARGET
: pp_string (pp
, "target:"); break;
385 case OMP_TARGET_UPDATE
: pp_string (pp
, "target update:"); break;
386 case OMP_TARGET_ENTER_DATA
:
387 pp_string (pp
, "target enter data:"); break;
388 case OMP_TARGET_EXIT_DATA
: pp_string (pp
, "target exit data:"); break;
389 default: gcc_unreachable ();
391 dump_generic_node (pp
, OMP_CLAUSE_IF_EXPR (clause
),
396 case OMP_CLAUSE_NUM_THREADS
:
397 pp_string (pp
, "num_threads(");
398 dump_generic_node (pp
, OMP_CLAUSE_NUM_THREADS_EXPR (clause
),
403 case OMP_CLAUSE__CILK_FOR_COUNT_
:
404 pp_string (pp
, "_Cilk_for_count_(");
405 dump_generic_node (pp
, OMP_CLAUSE_OPERAND (clause
, 0),
410 case OMP_CLAUSE_NOWAIT
:
411 pp_string (pp
, "nowait");
413 case OMP_CLAUSE_ORDERED
:
414 pp_string (pp
, "ordered");
415 if (OMP_CLAUSE_ORDERED_EXPR (clause
))
418 dump_generic_node (pp
, OMP_CLAUSE_ORDERED_EXPR (clause
),
424 case OMP_CLAUSE_DEFAULT
:
425 pp_string (pp
, "default(");
426 switch (OMP_CLAUSE_DEFAULT_KIND (clause
))
428 case OMP_CLAUSE_DEFAULT_UNSPECIFIED
:
430 case OMP_CLAUSE_DEFAULT_SHARED
:
431 pp_string (pp
, "shared");
433 case OMP_CLAUSE_DEFAULT_NONE
:
434 pp_string (pp
, "none");
436 case OMP_CLAUSE_DEFAULT_PRIVATE
:
437 pp_string (pp
, "private");
439 case OMP_CLAUSE_DEFAULT_FIRSTPRIVATE
:
440 pp_string (pp
, "firstprivate");
448 case OMP_CLAUSE_SCHEDULE
:
449 pp_string (pp
, "schedule(");
450 if (OMP_CLAUSE_SCHEDULE_SIMD (clause
))
451 pp_string (pp
, "simd:");
452 switch (OMP_CLAUSE_SCHEDULE_KIND (clause
))
454 case OMP_CLAUSE_SCHEDULE_STATIC
:
455 pp_string (pp
, "static");
457 case OMP_CLAUSE_SCHEDULE_DYNAMIC
:
458 pp_string (pp
, "dynamic");
460 case OMP_CLAUSE_SCHEDULE_GUIDED
:
461 pp_string (pp
, "guided");
463 case OMP_CLAUSE_SCHEDULE_RUNTIME
:
464 pp_string (pp
, "runtime");
466 case OMP_CLAUSE_SCHEDULE_AUTO
:
467 pp_string (pp
, "auto");
469 case OMP_CLAUSE_SCHEDULE_CILKFOR
:
470 pp_string (pp
, "cilk-for grain");
475 if (OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (clause
))
478 dump_generic_node (pp
, OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (clause
),
484 case OMP_CLAUSE_UNTIED
:
485 pp_string (pp
, "untied");
488 case OMP_CLAUSE_COLLAPSE
:
489 pp_string (pp
, "collapse(");
490 dump_generic_node (pp
, OMP_CLAUSE_COLLAPSE_EXPR (clause
),
495 case OMP_CLAUSE_FINAL
:
496 pp_string (pp
, "final(");
497 dump_generic_node (pp
, OMP_CLAUSE_FINAL_EXPR (clause
),
502 case OMP_CLAUSE_MERGEABLE
:
503 pp_string (pp
, "mergeable");
506 case OMP_CLAUSE_LINEAR
:
507 pp_string (pp
, "linear(");
508 switch (OMP_CLAUSE_LINEAR_KIND (clause
))
510 case OMP_CLAUSE_LINEAR_DEFAULT
:
512 case OMP_CLAUSE_LINEAR_REF
:
513 pp_string (pp
, "ref(");
515 case OMP_CLAUSE_LINEAR_VAL
:
516 pp_string (pp
, "val(");
518 case OMP_CLAUSE_LINEAR_UVAL
:
519 pp_string (pp
, "uval(");
524 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
526 if (OMP_CLAUSE_LINEAR_KIND (clause
) != OMP_CLAUSE_LINEAR_DEFAULT
)
529 dump_generic_node (pp
, OMP_CLAUSE_LINEAR_STEP (clause
),
534 case OMP_CLAUSE_ALIGNED
:
535 pp_string (pp
, "aligned(");
536 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
538 if (OMP_CLAUSE_ALIGNED_ALIGNMENT (clause
))
541 dump_generic_node (pp
, OMP_CLAUSE_ALIGNED_ALIGNMENT (clause
),
547 case OMP_CLAUSE_DEPEND
:
548 pp_string (pp
, "depend(");
549 switch (OMP_CLAUSE_DEPEND_KIND (clause
))
551 case OMP_CLAUSE_DEPEND_IN
:
552 pp_string (pp
, "in");
554 case OMP_CLAUSE_DEPEND_OUT
:
555 pp_string (pp
, "out");
557 case OMP_CLAUSE_DEPEND_INOUT
:
558 pp_string (pp
, "inout");
560 case OMP_CLAUSE_DEPEND_SOURCE
:
561 pp_string (pp
, "source)");
563 case OMP_CLAUSE_DEPEND_SINK
:
564 pp_string (pp
, "sink:");
565 for (tree t
= OMP_CLAUSE_DECL (clause
); t
; t
= TREE_CHAIN (t
))
566 if (TREE_CODE (t
) == TREE_LIST
)
568 dump_generic_node (pp
, TREE_VALUE (t
), spc
, flags
, false);
569 if (TREE_PURPOSE (t
) != integer_zero_node
)
571 if (OMP_CLAUSE_DEPEND_SINK_NEGATIVE (t
))
575 dump_generic_node (pp
, TREE_PURPOSE (t
), spc
, flags
,
589 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
595 pp_string (pp
, "map(");
596 switch (OMP_CLAUSE_MAP_KIND (clause
))
599 case GOMP_MAP_POINTER
:
600 pp_string (pp
, "alloc");
603 case GOMP_MAP_TO_PSET
:
604 pp_string (pp
, "to");
607 pp_string (pp
, "from");
609 case GOMP_MAP_TOFROM
:
610 pp_string (pp
, "tofrom");
612 case GOMP_MAP_FORCE_ALLOC
:
613 pp_string (pp
, "force_alloc");
615 case GOMP_MAP_FORCE_TO
:
616 pp_string (pp
, "force_to");
618 case GOMP_MAP_FORCE_FROM
:
619 pp_string (pp
, "force_from");
621 case GOMP_MAP_FORCE_TOFROM
:
622 pp_string (pp
, "force_tofrom");
624 case GOMP_MAP_FORCE_PRESENT
:
625 pp_string (pp
, "force_present");
627 case GOMP_MAP_FORCE_DEALLOC
:
628 pp_string (pp
, "delete");
630 case GOMP_MAP_FORCE_DEVICEPTR
:
631 pp_string (pp
, "force_deviceptr");
633 case GOMP_MAP_ALWAYS_TO
:
634 pp_string (pp
, "always,to");
636 case GOMP_MAP_ALWAYS_FROM
:
637 pp_string (pp
, "always,from");
639 case GOMP_MAP_ALWAYS_TOFROM
:
640 pp_string (pp
, "always,tofrom");
642 case GOMP_MAP_RELEASE
:
643 pp_string (pp
, "release");
645 case GOMP_MAP_FIRSTPRIVATE_POINTER
:
646 pp_string (pp
, "firstprivate");
648 case GOMP_MAP_STRUCT
:
649 pp_string (pp
, "struct");
655 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
658 if (OMP_CLAUSE_SIZE (clause
))
660 if (OMP_CLAUSE_CODE (clause
) == OMP_CLAUSE_MAP
661 && (OMP_CLAUSE_MAP_KIND (clause
) == GOMP_MAP_POINTER
662 || OMP_CLAUSE_MAP_KIND (clause
)
663 == GOMP_MAP_FIRSTPRIVATE_POINTER
))
664 pp_string (pp
, " [pointer assign, bias: ");
665 else if (OMP_CLAUSE_CODE (clause
) == OMP_CLAUSE_MAP
666 && OMP_CLAUSE_MAP_KIND (clause
) == GOMP_MAP_TO_PSET
)
667 pp_string (pp
, " [pointer set, len: ");
669 pp_string (pp
, " [len: ");
670 dump_generic_node (pp
, OMP_CLAUSE_SIZE (clause
),
672 pp_right_bracket (pp
);
677 case OMP_CLAUSE_FROM
:
678 pp_string (pp
, "from(");
679 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
681 goto print_clause_size
;
684 pp_string (pp
, "to(");
685 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
687 goto print_clause_size
;
689 case OMP_CLAUSE__CACHE_
:
691 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
693 goto print_clause_size
;
695 case OMP_CLAUSE_NUM_TEAMS
:
696 pp_string (pp
, "num_teams(");
697 dump_generic_node (pp
, OMP_CLAUSE_NUM_TEAMS_EXPR (clause
),
702 case OMP_CLAUSE_THREAD_LIMIT
:
703 pp_string (pp
, "thread_limit(");
704 dump_generic_node (pp
, OMP_CLAUSE_THREAD_LIMIT_EXPR (clause
),
709 case OMP_CLAUSE_DEVICE
:
710 pp_string (pp
, "device(");
711 dump_generic_node (pp
, OMP_CLAUSE_DEVICE_ID (clause
),
716 case OMP_CLAUSE_DIST_SCHEDULE
:
717 pp_string (pp
, "dist_schedule(static");
718 if (OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR (clause
))
721 dump_generic_node (pp
,
722 OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR (clause
),
728 case OMP_CLAUSE_PROC_BIND
:
729 pp_string (pp
, "proc_bind(");
730 switch (OMP_CLAUSE_PROC_BIND_KIND (clause
))
732 case OMP_CLAUSE_PROC_BIND_MASTER
:
733 pp_string (pp
, "master");
735 case OMP_CLAUSE_PROC_BIND_CLOSE
:
736 pp_string (pp
, "close");
738 case OMP_CLAUSE_PROC_BIND_SPREAD
:
739 pp_string (pp
, "spread");
747 case OMP_CLAUSE_SAFELEN
:
748 pp_string (pp
, "safelen(");
749 dump_generic_node (pp
, OMP_CLAUSE_SAFELEN_EXPR (clause
),
754 case OMP_CLAUSE_SIMDLEN
:
755 pp_string (pp
, "simdlen(");
756 dump_generic_node (pp
, OMP_CLAUSE_SIMDLEN_EXPR (clause
),
761 case OMP_CLAUSE_PRIORITY
:
762 pp_string (pp
, "priority(");
763 dump_generic_node (pp
, OMP_CLAUSE_PRIORITY_EXPR (clause
),
768 case OMP_CLAUSE_GRAINSIZE
:
769 pp_string (pp
, "grainsize(");
770 dump_generic_node (pp
, OMP_CLAUSE_GRAINSIZE_EXPR (clause
),
775 case OMP_CLAUSE_NUM_TASKS
:
776 pp_string (pp
, "num_tasks(");
777 dump_generic_node (pp
, OMP_CLAUSE_NUM_TASKS_EXPR (clause
),
782 case OMP_CLAUSE_HINT
:
783 pp_string (pp
, "hint(");
784 dump_generic_node (pp
, OMP_CLAUSE_HINT_EXPR (clause
),
789 case OMP_CLAUSE_DEFAULTMAP
:
790 pp_string (pp
, "defaultmap(tofrom:scalar)");
793 case OMP_CLAUSE__SIMDUID_
:
794 pp_string (pp
, "_simduid_(");
795 dump_generic_node (pp
, OMP_CLAUSE__SIMDUID__DECL (clause
),
800 case OMP_CLAUSE_GANG
:
801 pp_string (pp
, "gang");
802 if (OMP_CLAUSE_GANG_EXPR (clause
) != NULL_TREE
)
804 pp_string (pp
, "(num: ");
805 dump_generic_node (pp
, OMP_CLAUSE_GANG_EXPR (clause
),
808 if (OMP_CLAUSE_GANG_STATIC_EXPR (clause
) != NULL_TREE
)
810 if (OMP_CLAUSE_GANG_EXPR (clause
) == NULL_TREE
)
814 pp_string (pp
, "static:");
815 if (OMP_CLAUSE_GANG_STATIC_EXPR (clause
)
816 == integer_minus_one_node
)
817 pp_character (pp
, '*');
819 dump_generic_node (pp
, OMP_CLAUSE_GANG_STATIC_EXPR (clause
),
822 if (OMP_CLAUSE_GANG_EXPR (clause
) != NULL_TREE
823 || OMP_CLAUSE_GANG_STATIC_EXPR (clause
) != NULL_TREE
)
827 case OMP_CLAUSE_ASYNC
:
828 pp_string (pp
, "async");
829 if (OMP_CLAUSE_ASYNC_EXPR (clause
))
831 pp_character(pp
, '(');
832 dump_generic_node (pp
, OMP_CLAUSE_ASYNC_EXPR (clause
),
834 pp_character(pp
, ')');
838 case OMP_CLAUSE_AUTO
:
840 pp_string (pp
, omp_clause_code_name
[OMP_CLAUSE_CODE (clause
)]);
843 case OMP_CLAUSE_WAIT
:
844 pp_string (pp
, "wait(");
845 dump_generic_node (pp
, OMP_CLAUSE_WAIT_EXPR (clause
),
847 pp_character(pp
, ')');
850 case OMP_CLAUSE_WORKER
:
851 pp_string (pp
, "worker");
852 if (OMP_CLAUSE_WORKER_EXPR (clause
) != NULL_TREE
)
855 dump_generic_node (pp
, OMP_CLAUSE_WORKER_EXPR (clause
),
861 case OMP_CLAUSE_VECTOR
:
862 pp_string (pp
, "vector");
863 if (OMP_CLAUSE_VECTOR_EXPR (clause
) != NULL_TREE
)
866 dump_generic_node (pp
, OMP_CLAUSE_VECTOR_EXPR (clause
),
872 case OMP_CLAUSE_NUM_GANGS
:
873 pp_string (pp
, "num_gangs(");
874 dump_generic_node (pp
, OMP_CLAUSE_NUM_GANGS_EXPR (clause
),
876 pp_character (pp
, ')');
879 case OMP_CLAUSE_NUM_WORKERS
:
880 pp_string (pp
, "num_workers(");
881 dump_generic_node (pp
, OMP_CLAUSE_NUM_WORKERS_EXPR (clause
),
883 pp_character (pp
, ')');
886 case OMP_CLAUSE_VECTOR_LENGTH
:
887 pp_string (pp
, "vector_length(");
888 dump_generic_node (pp
, OMP_CLAUSE_VECTOR_LENGTH_EXPR (clause
),
890 pp_character (pp
, ')');
893 case OMP_CLAUSE_INBRANCH
:
894 pp_string (pp
, "inbranch");
896 case OMP_CLAUSE_NOTINBRANCH
:
897 pp_string (pp
, "notinbranch");
900 pp_string (pp
, "for");
902 case OMP_CLAUSE_PARALLEL
:
903 pp_string (pp
, "parallel");
905 case OMP_CLAUSE_SECTIONS
:
906 pp_string (pp
, "sections");
908 case OMP_CLAUSE_TASKGROUP
:
909 pp_string (pp
, "taskgroup");
911 case OMP_CLAUSE_NOGROUP
:
912 pp_string (pp
, "nogroup");
914 case OMP_CLAUSE_THREADS
:
915 pp_string (pp
, "threads");
917 case OMP_CLAUSE_SIMD
:
918 pp_string (pp
, "simd");
920 case OMP_CLAUSE_INDEPENDENT
:
921 pp_string (pp
, "independent");
925 /* Should never happen. */
926 dump_generic_node (pp
, clause
, spc
, flags
, false);
932 /* Dump the list of OpenMP clauses. PP, SPC and FLAGS are as in
933 dump_generic_node. */
936 dump_omp_clauses (pretty_printer
*pp
, tree clause
, int spc
, int flags
)
944 dump_omp_clause (pp
, clause
, spc
, flags
);
945 clause
= OMP_CLAUSE_CHAIN (clause
);
953 /* Dump location LOC to PP. */
956 dump_location (pretty_printer
*pp
, location_t loc
)
958 expanded_location xloc
= expand_location (loc
);
960 pp_left_bracket (pp
);
963 pp_string (pp
, xloc
.file
);
966 pp_decimal_int (pp
, xloc
.line
);
968 pp_decimal_int (pp
, xloc
.column
);
969 pp_string (pp
, "] ");
973 /* Dump lexical block BLOCK. PP, SPC and FLAGS are as in
974 dump_generic_node. */
977 dump_block_node (pretty_printer
*pp
, tree block
, int spc
, int flags
)
981 pp_printf (pp
, "BLOCK #%d ", BLOCK_NUMBER (block
));
983 if (flags
& TDF_ADDRESS
)
984 pp_printf (pp
, "[%p] ", (void *) block
);
986 if (BLOCK_ABSTRACT (block
))
987 pp_string (pp
, "[abstract] ");
989 if (TREE_ASM_WRITTEN (block
))
990 pp_string (pp
, "[written] ");
992 if (flags
& TDF_SLIM
)
995 if (BLOCK_SOURCE_LOCATION (block
))
996 dump_location (pp
, BLOCK_SOURCE_LOCATION (block
));
998 newline_and_indent (pp
, spc
+ 2);
1000 if (BLOCK_SUPERCONTEXT (block
))
1002 pp_string (pp
, "SUPERCONTEXT: ");
1003 dump_generic_node (pp
, BLOCK_SUPERCONTEXT (block
), 0,
1004 flags
| TDF_SLIM
, false);
1005 newline_and_indent (pp
, spc
+ 2);
1008 if (BLOCK_SUBBLOCKS (block
))
1010 pp_string (pp
, "SUBBLOCKS: ");
1011 for (t
= BLOCK_SUBBLOCKS (block
); t
; t
= BLOCK_CHAIN (t
))
1013 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
1016 newline_and_indent (pp
, spc
+ 2);
1019 if (BLOCK_CHAIN (block
))
1021 pp_string (pp
, "SIBLINGS: ");
1022 for (t
= BLOCK_CHAIN (block
); t
; t
= BLOCK_CHAIN (t
))
1024 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
1027 newline_and_indent (pp
, spc
+ 2);
1030 if (BLOCK_VARS (block
))
1032 pp_string (pp
, "VARS: ");
1033 for (t
= BLOCK_VARS (block
); t
; t
= TREE_CHAIN (t
))
1035 dump_generic_node (pp
, t
, 0, flags
, false);
1038 newline_and_indent (pp
, spc
+ 2);
1041 if (vec_safe_length (BLOCK_NONLOCALIZED_VARS (block
)) > 0)
1044 vec
<tree
, va_gc
> *nlv
= BLOCK_NONLOCALIZED_VARS (block
);
1046 pp_string (pp
, "NONLOCALIZED_VARS: ");
1047 FOR_EACH_VEC_ELT (*nlv
, i
, t
)
1049 dump_generic_node (pp
, t
, 0, flags
, false);
1052 newline_and_indent (pp
, spc
+ 2);
1055 if (BLOCK_ABSTRACT_ORIGIN (block
))
1057 pp_string (pp
, "ABSTRACT_ORIGIN: ");
1058 dump_generic_node (pp
, BLOCK_ABSTRACT_ORIGIN (block
), 0,
1059 flags
| TDF_SLIM
, false);
1060 newline_and_indent (pp
, spc
+ 2);
1063 if (BLOCK_FRAGMENT_ORIGIN (block
))
1065 pp_string (pp
, "FRAGMENT_ORIGIN: ");
1066 dump_generic_node (pp
, BLOCK_FRAGMENT_ORIGIN (block
), 0,
1067 flags
| TDF_SLIM
, false);
1068 newline_and_indent (pp
, spc
+ 2);
1071 if (BLOCK_FRAGMENT_CHAIN (block
))
1073 pp_string (pp
, "FRAGMENT_CHAIN: ");
1074 for (t
= BLOCK_FRAGMENT_CHAIN (block
); t
; t
= BLOCK_FRAGMENT_CHAIN (t
))
1076 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
1079 newline_and_indent (pp
, spc
+ 2);
1084 /* Dump the node NODE on the pretty_printer PP, SPC spaces of
1085 indent. FLAGS specifies details to show in the dump (see TDF_* in
1086 dumpfile.h). If IS_STMT is true, the object printed is considered
1087 to be a statement and it is terminated by ';' if appropriate. */
1090 dump_generic_node (pretty_printer
*pp
, tree node
, int spc
, int flags
,
1097 enum tree_code code
;
1099 if (node
== NULL_TREE
)
1102 is_expr
= EXPR_P (node
);
1104 if (is_stmt
&& (flags
& TDF_STMTADDR
))
1105 pp_printf (pp
, "<&%p> ", (void *)node
);
1107 if ((flags
& TDF_LINENO
) && EXPR_HAS_LOCATION (node
))
1108 dump_location (pp
, EXPR_LOCATION (node
));
1110 code
= TREE_CODE (node
);
1114 pp_string (pp
, "<<< error >>>");
1117 case IDENTIFIER_NODE
:
1118 pp_tree_identifier (pp
, node
);
1122 while (node
&& node
!= error_mark_node
)
1124 if (TREE_PURPOSE (node
))
1126 dump_generic_node (pp
, TREE_PURPOSE (node
), spc
, flags
, false);
1129 dump_generic_node (pp
, TREE_VALUE (node
), spc
, flags
, false);
1130 node
= TREE_CHAIN (node
);
1131 if (node
&& TREE_CODE (node
) == TREE_LIST
)
1140 dump_generic_node (pp
, BINFO_TYPE (node
), spc
, flags
, false);
1146 if (TREE_VEC_LENGTH (node
) > 0)
1148 size_t len
= TREE_VEC_LENGTH (node
);
1149 for (i
= 0; i
< len
- 1; i
++)
1151 dump_generic_node (pp
, TREE_VEC_ELT (node
, i
), spc
, flags
,
1156 dump_generic_node (pp
, TREE_VEC_ELT (node
, len
- 1), spc
,
1163 case POINTER_BOUNDS_TYPE
:
1166 case FIXED_POINT_TYPE
:
1172 unsigned int quals
= TYPE_QUALS (node
);
1173 enum tree_code_class tclass
;
1175 if (quals
& TYPE_QUAL_ATOMIC
)
1176 pp_string (pp
, "atomic ");
1177 if (quals
& TYPE_QUAL_CONST
)
1178 pp_string (pp
, "const ");
1179 else if (quals
& TYPE_QUAL_VOLATILE
)
1180 pp_string (pp
, "volatile ");
1181 else if (quals
& TYPE_QUAL_RESTRICT
)
1182 pp_string (pp
, "restrict ");
1184 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
1186 pp_string (pp
, "<address-space-");
1187 pp_decimal_int (pp
, TYPE_ADDR_SPACE (node
));
1188 pp_string (pp
, "> ");
1191 tclass
= TREE_CODE_CLASS (TREE_CODE (node
));
1193 if (tclass
== tcc_declaration
)
1195 if (DECL_NAME (node
))
1196 dump_decl_name (pp
, node
, flags
);
1198 pp_string (pp
, "<unnamed type decl>");
1200 else if (tclass
== tcc_type
)
1202 if (TYPE_NAME (node
))
1204 if (TREE_CODE (TYPE_NAME (node
)) == IDENTIFIER_NODE
)
1205 pp_tree_identifier (pp
, TYPE_NAME (node
));
1206 else if (TREE_CODE (TYPE_NAME (node
)) == TYPE_DECL
1207 && DECL_NAME (TYPE_NAME (node
)))
1208 dump_decl_name (pp
, TYPE_NAME (node
), flags
);
1210 pp_string (pp
, "<unnamed type>");
1212 else if (TREE_CODE (node
) == VECTOR_TYPE
)
1214 pp_string (pp
, "vector");
1216 pp_wide_integer (pp
, TYPE_VECTOR_SUBPARTS (node
));
1217 pp_string (pp
, ") ");
1218 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1220 else if (TREE_CODE (node
) == INTEGER_TYPE
)
1222 if (TYPE_PRECISION (node
) == CHAR_TYPE_SIZE
)
1223 pp_string (pp
, (TYPE_UNSIGNED (node
)
1226 else if (TYPE_PRECISION (node
) == SHORT_TYPE_SIZE
)
1227 pp_string (pp
, (TYPE_UNSIGNED (node
)
1230 else if (TYPE_PRECISION (node
) == INT_TYPE_SIZE
)
1231 pp_string (pp
, (TYPE_UNSIGNED (node
)
1234 else if (TYPE_PRECISION (node
) == LONG_TYPE_SIZE
)
1235 pp_string (pp
, (TYPE_UNSIGNED (node
)
1238 else if (TYPE_PRECISION (node
) == LONG_LONG_TYPE_SIZE
)
1239 pp_string (pp
, (TYPE_UNSIGNED (node
)
1240 ? "unsigned long long"
1241 : "signed long long"));
1242 else if (TYPE_PRECISION (node
) >= CHAR_TYPE_SIZE
1243 && exact_log2 (TYPE_PRECISION (node
)) != -1)
1245 pp_string (pp
, (TYPE_UNSIGNED (node
) ? "uint" : "int"));
1246 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1247 pp_string (pp
, "_t");
1251 pp_string (pp
, (TYPE_UNSIGNED (node
)
1252 ? "<unnamed-unsigned:"
1253 : "<unnamed-signed:"));
1254 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1258 else if (TREE_CODE (node
) == COMPLEX_TYPE
)
1260 pp_string (pp
, "__complex__ ");
1261 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1263 else if (TREE_CODE (node
) == REAL_TYPE
)
1265 pp_string (pp
, "<float:");
1266 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1269 else if (TREE_CODE (node
) == FIXED_POINT_TYPE
)
1271 pp_string (pp
, "<fixed-point-");
1272 pp_string (pp
, TYPE_SATURATING (node
) ? "sat:" : "nonsat:");
1273 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1276 else if (TREE_CODE (node
) == VOID_TYPE
)
1277 pp_string (pp
, "void");
1279 pp_string (pp
, "<unnamed type>");
1285 case REFERENCE_TYPE
:
1286 str
= (TREE_CODE (node
) == POINTER_TYPE
? "*" : "&");
1288 if (TREE_TYPE (node
) == NULL
)
1290 pp_string (pp
, str
);
1291 pp_string (pp
, "<null type>");
1293 else if (TREE_CODE (TREE_TYPE (node
)) == FUNCTION_TYPE
)
1295 tree fnode
= TREE_TYPE (node
);
1297 dump_generic_node (pp
, TREE_TYPE (fnode
), spc
, flags
, false);
1300 pp_string (pp
, str
);
1301 if (TYPE_NAME (node
) && DECL_NAME (TYPE_NAME (node
)))
1302 dump_decl_name (pp
, TYPE_NAME (node
), flags
);
1303 else if (flags
& TDF_NOUID
)
1304 pp_printf (pp
, "<Txxxx>");
1306 pp_printf (pp
, "<T%x>", TYPE_UID (node
));
1308 pp_right_paren (pp
);
1309 dump_function_declaration (pp
, fnode
, spc
, flags
);
1313 unsigned int quals
= TYPE_QUALS (node
);
1315 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1317 pp_string (pp
, str
);
1319 if (quals
& TYPE_QUAL_CONST
)
1320 pp_string (pp
, " const");
1321 if (quals
& TYPE_QUAL_VOLATILE
)
1322 pp_string (pp
, " volatile");
1323 if (quals
& TYPE_QUAL_RESTRICT
)
1324 pp_string (pp
, " restrict");
1326 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
1328 pp_string (pp
, " <address-space-");
1329 pp_decimal_int (pp
, TYPE_ADDR_SPACE (node
));
1333 if (TYPE_REF_CAN_ALIAS_ALL (node
))
1334 pp_string (pp
, " {ref-all}");
1344 if (integer_zerop (TREE_OPERAND (node
, 1))
1345 /* Dump the types of INTEGER_CSTs explicitly, for we can't
1346 infer them and MEM_ATTR caching will share MEM_REFs
1347 with differently-typed op0s. */
1348 && TREE_CODE (TREE_OPERAND (node
, 0)) != INTEGER_CST
1349 /* Released SSA_NAMES have no TREE_TYPE. */
1350 && TREE_TYPE (TREE_OPERAND (node
, 0)) != NULL_TREE
1351 /* Same pointer types, but ignoring POINTER_TYPE vs.
1353 && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 0)))
1354 == TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 1))))
1355 && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (node
, 0)))
1356 == TYPE_MODE (TREE_TYPE (TREE_OPERAND (node
, 1))))
1357 && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node
, 0)))
1358 == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node
, 1))))
1359 /* Same value types ignoring qualifiers. */
1360 && (TYPE_MAIN_VARIANT (TREE_TYPE (node
))
1361 == TYPE_MAIN_VARIANT
1362 (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 1)))))
1363 && (!(flags
& TDF_ALIAS
)
1364 || MR_DEPENDENCE_CLIQUE (node
) == 0))
1366 if (TREE_CODE (TREE_OPERAND (node
, 0)) != ADDR_EXPR
)
1369 dump_generic_node (pp
, TREE_OPERAND (node
, 0),
1373 dump_generic_node (pp
,
1374 TREE_OPERAND (TREE_OPERAND (node
, 0), 0),
1381 pp_string (pp
, "MEM[");
1383 ptype
= TYPE_MAIN_VARIANT (TREE_TYPE (TREE_OPERAND (node
, 1)));
1384 dump_generic_node (pp
, ptype
,
1385 spc
, flags
| TDF_SLIM
, false);
1386 pp_right_paren (pp
);
1387 dump_generic_node (pp
, TREE_OPERAND (node
, 0),
1389 if (!integer_zerop (TREE_OPERAND (node
, 1)))
1391 pp_string (pp
, " + ");
1392 dump_generic_node (pp
, TREE_OPERAND (node
, 1),
1395 if ((flags
& TDF_ALIAS
)
1396 && MR_DEPENDENCE_CLIQUE (node
) != 0)
1398 pp_string (pp
, " clique ");
1399 pp_unsigned_wide_integer (pp
, MR_DEPENDENCE_CLIQUE (node
));
1400 pp_string (pp
, " base ");
1401 pp_unsigned_wide_integer (pp
, MR_DEPENDENCE_BASE (node
));
1403 pp_right_bracket (pp
);
1408 case TARGET_MEM_REF
:
1410 const char *sep
= "";
1413 pp_string (pp
, "MEM[");
1415 if (TREE_CODE (TMR_BASE (node
)) == ADDR_EXPR
)
1417 pp_string (pp
, sep
);
1419 pp_string (pp
, "symbol: ");
1420 dump_generic_node (pp
, TREE_OPERAND (TMR_BASE (node
), 0),
1425 pp_string (pp
, sep
);
1427 pp_string (pp
, "base: ");
1428 dump_generic_node (pp
, TMR_BASE (node
), spc
, flags
, false);
1430 tmp
= TMR_INDEX2 (node
);
1433 pp_string (pp
, sep
);
1435 pp_string (pp
, "base: ");
1436 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1438 tmp
= TMR_INDEX (node
);
1441 pp_string (pp
, sep
);
1443 pp_string (pp
, "index: ");
1444 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1446 tmp
= TMR_STEP (node
);
1449 pp_string (pp
, sep
);
1451 pp_string (pp
, "step: ");
1452 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1454 tmp
= TMR_OFFSET (node
);
1457 pp_string (pp
, sep
);
1459 pp_string (pp
, "offset: ");
1460 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1462 pp_right_bracket (pp
);
1470 /* Print the innermost component type. */
1471 for (tmp
= TREE_TYPE (node
); TREE_CODE (tmp
) == ARRAY_TYPE
;
1472 tmp
= TREE_TYPE (tmp
))
1474 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1476 /* Print the dimensions. */
1477 for (tmp
= node
; TREE_CODE (tmp
) == ARRAY_TYPE
; tmp
= TREE_TYPE (tmp
))
1478 dump_array_domain (pp
, TYPE_DOMAIN (tmp
), spc
, flags
);
1484 case QUAL_UNION_TYPE
:
1486 unsigned int quals
= TYPE_QUALS (node
);
1488 if (quals
& TYPE_QUAL_ATOMIC
)
1489 pp_string (pp
, "atomic ");
1490 if (quals
& TYPE_QUAL_CONST
)
1491 pp_string (pp
, "const ");
1492 if (quals
& TYPE_QUAL_VOLATILE
)
1493 pp_string (pp
, "volatile ");
1495 /* Print the name of the structure. */
1496 if (TREE_CODE (node
) == RECORD_TYPE
)
1497 pp_string (pp
, "struct ");
1498 else if (TREE_CODE (node
) == UNION_TYPE
)
1499 pp_string (pp
, "union ");
1501 if (TYPE_NAME (node
))
1502 dump_generic_node (pp
, TYPE_NAME (node
), spc
, flags
, false);
1503 else if (!(flags
& TDF_SLIM
))
1504 /* FIXME: If we eliminate the 'else' above and attempt
1505 to show the fields for named types, we may get stuck
1506 following a cycle of pointers to structs. The alleged
1507 self-reference check in print_struct_decl will not detect
1508 cycles involving more than one pointer or struct type. */
1509 print_struct_decl (pp
, node
, spc
, flags
);
1518 if (TREE_CODE (TREE_TYPE (node
)) == POINTER_TYPE
)
1520 /* In the case of a pointer, one may want to divide by the
1521 size of the pointed-to type. Unfortunately, this not
1522 straightforward. The C front-end maps expressions
1527 in such a way that the two INTEGER_CST nodes for "5" have
1528 different values but identical types. In the latter
1529 case, the 5 is multiplied by sizeof (int) in c-common.c
1530 (pointer_int_sum) to convert it to a byte address, and
1531 yet the type of the node is left unchanged. Argh. What
1532 is consistent though is that the number value corresponds
1533 to bytes (UNITS) offset.
1535 NB: Neither of the following divisors can be trivially
1536 used to recover the original literal:
1538 TREE_INT_CST_LOW (TYPE_SIZE_UNIT (TREE_TYPE (node)))
1539 TYPE_PRECISION (TREE_TYPE (TREE_TYPE (node))) */
1540 pp_wide_integer (pp
, TREE_INT_CST_LOW (node
));
1541 pp_string (pp
, "B"); /* pseudo-unit */
1543 else if (tree_fits_shwi_p (node
))
1544 pp_wide_integer (pp
, tree_to_shwi (node
));
1545 else if (tree_fits_uhwi_p (node
))
1546 pp_unsigned_wide_integer (pp
, tree_to_uhwi (node
));
1549 wide_int val
= node
;
1551 if (wi::neg_p (val
, TYPE_SIGN (TREE_TYPE (node
))))
1556 print_hex (val
, pp_buffer (pp
)->digit_buffer
);
1557 pp_string (pp
, pp_buffer (pp
)->digit_buffer
);
1559 if (TREE_OVERFLOW (node
))
1560 pp_string (pp
, "(OVF)");
1564 /* Code copied from print_node. */
1567 if (TREE_OVERFLOW (node
))
1568 pp_string (pp
, " overflow");
1570 d
= TREE_REAL_CST (node
);
1571 if (REAL_VALUE_ISINF (d
))
1572 pp_string (pp
, REAL_VALUE_NEGATIVE (d
) ? " -Inf" : " Inf");
1573 else if (REAL_VALUE_ISNAN (d
))
1574 pp_string (pp
, " Nan");
1578 real_to_decimal (string
, &d
, sizeof (string
), 0, 1);
1579 pp_string (pp
, string
);
1587 fixed_to_decimal (string
, TREE_FIXED_CST_PTR (node
), sizeof (string
));
1588 pp_string (pp
, string
);
1593 pp_string (pp
, "__complex__ (");
1594 dump_generic_node (pp
, TREE_REALPART (node
), spc
, flags
, false);
1595 pp_string (pp
, ", ");
1596 dump_generic_node (pp
, TREE_IMAGPART (node
), spc
, flags
, false);
1597 pp_right_paren (pp
);
1601 pp_string (pp
, "\"");
1602 pretty_print_string (pp
, TREE_STRING_POINTER (node
));
1603 pp_string (pp
, "\"");
1609 pp_string (pp
, "{ ");
1610 for (i
= 0; i
< VECTOR_CST_NELTS (node
); ++i
)
1613 pp_string (pp
, ", ");
1614 dump_generic_node (pp
, VECTOR_CST_ELT (node
, i
),
1617 pp_string (pp
, " }");
1623 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1625 if (TREE_CODE (node
) == METHOD_TYPE
)
1627 if (TYPE_METHOD_BASETYPE (node
))
1628 dump_decl_name (pp
, TYPE_NAME (TYPE_METHOD_BASETYPE (node
)),
1631 pp_string (pp
, "<null method basetype>");
1632 pp_colon_colon (pp
);
1634 if (TYPE_NAME (node
) && DECL_NAME (TYPE_NAME (node
)))
1635 dump_decl_name (pp
, TYPE_NAME (node
), flags
);
1636 else if (flags
& TDF_NOUID
)
1637 pp_printf (pp
, "<Txxxx>");
1639 pp_printf (pp
, "<T%x>", TYPE_UID (node
));
1640 dump_function_declaration (pp
, node
, spc
, flags
);
1645 dump_decl_name (pp
, node
, flags
);
1649 if (DECL_NAME (node
))
1650 dump_decl_name (pp
, node
, flags
);
1651 else if (LABEL_DECL_UID (node
) != -1)
1652 pp_printf (pp
, "<L%d>", (int) LABEL_DECL_UID (node
));
1655 if (flags
& TDF_NOUID
)
1656 pp_string (pp
, "<D.xxxx>");
1658 pp_printf (pp
, "<D.%u>", DECL_UID (node
));
1663 if (DECL_IS_BUILTIN (node
))
1665 /* Don't print the declaration of built-in types. */
1668 if (DECL_NAME (node
))
1669 dump_decl_name (pp
, node
, flags
);
1670 else if (TYPE_NAME (TREE_TYPE (node
)) != node
)
1672 if ((TREE_CODE (TREE_TYPE (node
)) == RECORD_TYPE
1673 || TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
)
1674 && TYPE_METHODS (TREE_TYPE (node
)))
1676 /* The type is a c++ class: all structures have at least
1678 pp_string (pp
, "class ");
1679 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1684 (TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
1685 ? "union" : "struct "));
1686 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1690 pp_string (pp
, "<anon>");
1696 case DEBUG_EXPR_DECL
:
1697 case NAMESPACE_DECL
:
1699 dump_decl_name (pp
, node
, flags
);
1703 pp_string (pp
, "<retval>");
1707 op0
= TREE_OPERAND (node
, 0);
1710 && (TREE_CODE (op0
) == INDIRECT_REF
1711 || (TREE_CODE (op0
) == MEM_REF
1712 && TREE_CODE (TREE_OPERAND (op0
, 0)) != ADDR_EXPR
1713 && integer_zerop (TREE_OPERAND (op0
, 1))
1714 /* Dump the types of INTEGER_CSTs explicitly, for we
1715 can't infer them and MEM_ATTR caching will share
1716 MEM_REFs with differently-typed op0s. */
1717 && TREE_CODE (TREE_OPERAND (op0
, 0)) != INTEGER_CST
1718 /* Released SSA_NAMES have no TREE_TYPE. */
1719 && TREE_TYPE (TREE_OPERAND (op0
, 0)) != NULL_TREE
1720 /* Same pointer types, but ignoring POINTER_TYPE vs.
1722 && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 0)))
1723 == TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 1))))
1724 && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0
, 0)))
1725 == TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0
, 1))))
1726 && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0
, 0)))
1727 == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0
, 1))))
1728 /* Same value types ignoring qualifiers. */
1729 && (TYPE_MAIN_VARIANT (TREE_TYPE (op0
))
1730 == TYPE_MAIN_VARIANT
1731 (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 1)))))
1732 && MR_DEPENDENCE_CLIQUE (op0
) == 0)))
1734 op0
= TREE_OPERAND (op0
, 0);
1737 if (op_prio (op0
) < op_prio (node
))
1739 dump_generic_node (pp
, op0
, spc
, flags
, false);
1740 if (op_prio (op0
) < op_prio (node
))
1741 pp_right_paren (pp
);
1742 pp_string (pp
, str
);
1743 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1744 op0
= component_ref_field_offset (node
);
1745 if (op0
&& TREE_CODE (op0
) != INTEGER_CST
)
1747 pp_string (pp
, "{off: ");
1748 dump_generic_node (pp
, op0
, spc
, flags
, false);
1749 pp_right_brace (pp
);
1754 pp_string (pp
, "BIT_FIELD_REF <");
1755 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1756 pp_string (pp
, ", ");
1757 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1758 pp_string (pp
, ", ");
1759 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
1764 case ARRAY_RANGE_REF
:
1765 op0
= TREE_OPERAND (node
, 0);
1766 if (op_prio (op0
) < op_prio (node
))
1768 dump_generic_node (pp
, op0
, spc
, flags
, false);
1769 if (op_prio (op0
) < op_prio (node
))
1770 pp_right_paren (pp
);
1771 pp_left_bracket (pp
);
1772 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1773 if (TREE_CODE (node
) == ARRAY_RANGE_REF
)
1774 pp_string (pp
, " ...");
1775 pp_right_bracket (pp
);
1777 op0
= array_ref_low_bound (node
);
1778 op1
= array_ref_element_size (node
);
1780 if (!integer_zerop (op0
)
1781 || TREE_OPERAND (node
, 2)
1782 || TREE_OPERAND (node
, 3))
1784 pp_string (pp
, "{lb: ");
1785 dump_generic_node (pp
, op0
, spc
, flags
, false);
1786 pp_string (pp
, " sz: ");
1787 dump_generic_node (pp
, op1
, spc
, flags
, false);
1788 pp_right_brace (pp
);
1794 unsigned HOST_WIDE_INT ix
;
1796 bool is_struct_init
= false;
1797 bool is_array_init
= false;
1800 if (TREE_CLOBBER_P (node
))
1801 pp_string (pp
, "CLOBBER");
1802 else if (TREE_CODE (TREE_TYPE (node
)) == RECORD_TYPE
1803 || TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
)
1804 is_struct_init
= true;
1805 else if (TREE_CODE (TREE_TYPE (node
)) == ARRAY_TYPE
1806 && TYPE_DOMAIN (TREE_TYPE (node
))
1807 && TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
)))
1808 && TREE_CODE (TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
))))
1811 tree minv
= TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
)));
1812 is_array_init
= true;
1813 curidx
= wi::to_widest (minv
);
1815 FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (node
), ix
, field
, val
)
1822 dump_generic_node (pp
, field
, spc
, flags
, false);
1825 else if (is_array_init
1826 && (TREE_CODE (field
) != INTEGER_CST
1827 || curidx
!= wi::to_widest (field
)))
1829 pp_left_bracket (pp
);
1830 if (TREE_CODE (field
) == RANGE_EXPR
)
1832 dump_generic_node (pp
, TREE_OPERAND (field
, 0), spc
,
1834 pp_string (pp
, " ... ");
1835 dump_generic_node (pp
, TREE_OPERAND (field
, 1), spc
,
1837 if (TREE_CODE (TREE_OPERAND (field
, 1)) == INTEGER_CST
)
1838 curidx
= wi::to_widest (TREE_OPERAND (field
, 1));
1841 dump_generic_node (pp
, field
, spc
, flags
, false);
1842 if (TREE_CODE (field
) == INTEGER_CST
)
1843 curidx
= wi::to_widest (field
);
1844 pp_string (pp
, "]=");
1849 if (val
&& TREE_CODE (val
) == ADDR_EXPR
)
1850 if (TREE_CODE (TREE_OPERAND (val
, 0)) == FUNCTION_DECL
)
1851 val
= TREE_OPERAND (val
, 0);
1852 if (val
&& TREE_CODE (val
) == FUNCTION_DECL
)
1853 dump_decl_name (pp
, val
, flags
);
1855 dump_generic_node (pp
, val
, spc
, flags
, false);
1856 if (ix
!= vec_safe_length (CONSTRUCTOR_ELTS (node
)) - 1)
1862 pp_right_brace (pp
);
1869 if (flags
& TDF_SLIM
)
1871 pp_string (pp
, "<COMPOUND_EXPR>");
1875 dump_generic_node (pp
, TREE_OPERAND (node
, 0),
1876 spc
, flags
, !(flags
& TDF_SLIM
));
1877 if (flags
& TDF_SLIM
)
1878 newline_and_indent (pp
, spc
);
1885 for (tp
= &TREE_OPERAND (node
, 1);
1886 TREE_CODE (*tp
) == COMPOUND_EXPR
;
1887 tp
= &TREE_OPERAND (*tp
, 1))
1889 dump_generic_node (pp
, TREE_OPERAND (*tp
, 0),
1890 spc
, flags
, !(flags
& TDF_SLIM
));
1891 if (flags
& TDF_SLIM
)
1892 newline_and_indent (pp
, spc
);
1900 dump_generic_node (pp
, *tp
, spc
, flags
, !(flags
& TDF_SLIM
));
1904 case STATEMENT_LIST
:
1906 tree_stmt_iterator si
;
1909 if (flags
& TDF_SLIM
)
1911 pp_string (pp
, "<STATEMENT_LIST>");
1915 for (si
= tsi_start (node
); !tsi_end_p (si
); tsi_next (&si
))
1918 newline_and_indent (pp
, spc
);
1921 dump_generic_node (pp
, tsi_stmt (si
), spc
, flags
, true);
1928 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
,
1933 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
,
1938 pp_string (pp
, "TARGET_EXPR <");
1939 dump_generic_node (pp
, TARGET_EXPR_SLOT (node
), spc
, flags
, false);
1942 dump_generic_node (pp
, TARGET_EXPR_INITIAL (node
), spc
, flags
, false);
1947 print_declaration (pp
, DECL_EXPR_DECL (node
), spc
, flags
);
1952 if (TREE_TYPE (node
) == NULL
|| TREE_TYPE (node
) == void_type_node
)
1954 pp_string (pp
, "if (");
1955 dump_generic_node (pp
, COND_EXPR_COND (node
), spc
, flags
, false);
1956 pp_right_paren (pp
);
1957 /* The lowered cond_exprs should always be printed in full. */
1958 if (COND_EXPR_THEN (node
)
1959 && (IS_EMPTY_STMT (COND_EXPR_THEN (node
))
1960 || TREE_CODE (COND_EXPR_THEN (node
)) == GOTO_EXPR
)
1961 && COND_EXPR_ELSE (node
)
1962 && (IS_EMPTY_STMT (COND_EXPR_ELSE (node
))
1963 || TREE_CODE (COND_EXPR_ELSE (node
)) == GOTO_EXPR
))
1966 dump_generic_node (pp
, COND_EXPR_THEN (node
),
1968 if (!IS_EMPTY_STMT (COND_EXPR_ELSE (node
)))
1970 pp_string (pp
, " else ");
1971 dump_generic_node (pp
, COND_EXPR_ELSE (node
),
1975 else if (!(flags
& TDF_SLIM
))
1977 /* Output COND_EXPR_THEN. */
1978 if (COND_EXPR_THEN (node
))
1980 newline_and_indent (pp
, spc
+2);
1982 newline_and_indent (pp
, spc
+4);
1983 dump_generic_node (pp
, COND_EXPR_THEN (node
), spc
+4,
1985 newline_and_indent (pp
, spc
+2);
1986 pp_right_brace (pp
);
1989 /* Output COND_EXPR_ELSE. */
1990 if (COND_EXPR_ELSE (node
)
1991 && !IS_EMPTY_STMT (COND_EXPR_ELSE (node
)))
1993 newline_and_indent (pp
, spc
);
1994 pp_string (pp
, "else");
1995 newline_and_indent (pp
, spc
+2);
1997 newline_and_indent (pp
, spc
+4);
1998 dump_generic_node (pp
, COND_EXPR_ELSE (node
), spc
+4,
2000 newline_and_indent (pp
, spc
+2);
2001 pp_right_brace (pp
);
2008 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2012 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2016 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2022 if (!(flags
& TDF_SLIM
))
2024 if (BIND_EXPR_VARS (node
))
2028 for (op0
= BIND_EXPR_VARS (node
); op0
; op0
= DECL_CHAIN (op0
))
2030 print_declaration (pp
, op0
, spc
+2, flags
);
2035 newline_and_indent (pp
, spc
+2);
2036 dump_generic_node (pp
, BIND_EXPR_BODY (node
), spc
+2, flags
, true);
2037 newline_and_indent (pp
, spc
);
2038 pp_right_brace (pp
);
2044 if (CALL_EXPR_FN (node
) != NULL_TREE
)
2045 print_call_name (pp
, CALL_EXPR_FN (node
), flags
);
2047 pp_string (pp
, internal_fn_name (CALL_EXPR_IFN (node
)));
2049 /* Print parameters. */
2054 call_expr_arg_iterator iter
;
2055 FOR_EACH_CALL_EXPR_ARG (arg
, iter
, node
)
2057 dump_generic_node (pp
, arg
, spc
, flags
, false);
2058 if (more_call_expr_args_p (&iter
))
2065 if (CALL_EXPR_VA_ARG_PACK (node
))
2067 if (call_expr_nargs (node
) > 0)
2072 pp_string (pp
, "__builtin_va_arg_pack ()");
2074 pp_right_paren (pp
);
2076 op1
= CALL_EXPR_STATIC_CHAIN (node
);
2079 pp_string (pp
, " [static-chain: ");
2080 dump_generic_node (pp
, op1
, spc
, flags
, false);
2081 pp_right_bracket (pp
);
2084 if (CALL_EXPR_RETURN_SLOT_OPT (node
))
2085 pp_string (pp
, " [return slot optimization]");
2086 if (CALL_EXPR_TAILCALL (node
))
2087 pp_string (pp
, " [tail call]");
2090 case WITH_CLEANUP_EXPR
:
2094 case CLEANUP_POINT_EXPR
:
2095 pp_string (pp
, "<<cleanup_point ");
2096 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2097 pp_string (pp
, ">>");
2100 case PLACEHOLDER_EXPR
:
2101 pp_string (pp
, "<PLACEHOLDER_EXPR ");
2102 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2106 /* Binary arithmetic and logic expressions. */
2107 case WIDEN_SUM_EXPR
:
2108 case WIDEN_MULT_EXPR
:
2110 case MULT_HIGHPART_EXPR
:
2112 case POINTER_PLUS_EXPR
:
2114 case TRUNC_DIV_EXPR
:
2116 case FLOOR_DIV_EXPR
:
2117 case ROUND_DIV_EXPR
:
2118 case TRUNC_MOD_EXPR
:
2120 case FLOOR_MOD_EXPR
:
2121 case ROUND_MOD_EXPR
:
2123 case EXACT_DIV_EXPR
:
2128 case WIDEN_LSHIFT_EXPR
:
2132 case TRUTH_ANDIF_EXPR
:
2133 case TRUTH_ORIF_EXPR
:
2134 case TRUTH_AND_EXPR
:
2136 case TRUTH_XOR_EXPR
:
2150 case UNORDERED_EXPR
:
2152 const char *op
= op_symbol (node
);
2153 op0
= TREE_OPERAND (node
, 0);
2154 op1
= TREE_OPERAND (node
, 1);
2156 /* When the operands are expressions with less priority,
2157 keep semantics of the tree representation. */
2158 if (op_prio (op0
) <= op_prio (node
))
2161 dump_generic_node (pp
, op0
, spc
, flags
, false);
2162 pp_right_paren (pp
);
2165 dump_generic_node (pp
, op0
, spc
, flags
, false);
2171 /* When the operands are expressions with less priority,
2172 keep semantics of the tree representation. */
2173 if (op_prio (op1
) <= op_prio (node
))
2176 dump_generic_node (pp
, op1
, spc
, flags
, false);
2177 pp_right_paren (pp
);
2180 dump_generic_node (pp
, op1
, spc
, flags
, false);
2184 /* Unary arithmetic and logic expressions. */
2187 case TRUTH_NOT_EXPR
:
2189 case PREDECREMENT_EXPR
:
2190 case PREINCREMENT_EXPR
:
2192 if (TREE_CODE (node
) == ADDR_EXPR
2193 && (TREE_CODE (TREE_OPERAND (node
, 0)) == STRING_CST
2194 || TREE_CODE (TREE_OPERAND (node
, 0)) == FUNCTION_DECL
))
2195 ; /* Do not output '&' for strings and function pointers. */
2197 pp_string (pp
, op_symbol (node
));
2199 if (op_prio (TREE_OPERAND (node
, 0)) < op_prio (node
))
2202 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2203 pp_right_paren (pp
);
2206 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2209 case POSTDECREMENT_EXPR
:
2210 case POSTINCREMENT_EXPR
:
2211 if (op_prio (TREE_OPERAND (node
, 0)) < op_prio (node
))
2214 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2215 pp_right_paren (pp
);
2218 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2219 pp_string (pp
, op_symbol (node
));
2223 pp_string (pp
, "MIN_EXPR <");
2224 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2225 pp_string (pp
, ", ");
2226 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2231 pp_string (pp
, "MAX_EXPR <");
2232 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2233 pp_string (pp
, ", ");
2234 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2239 pp_string (pp
, "ABS_EXPR <");
2240 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2248 case ADDR_SPACE_CONVERT_EXPR
:
2249 case FIXED_CONVERT_EXPR
:
2250 case FIX_TRUNC_EXPR
:
2253 type
= TREE_TYPE (node
);
2254 op0
= TREE_OPERAND (node
, 0);
2255 if (type
!= TREE_TYPE (op0
))
2258 dump_generic_node (pp
, type
, spc
, flags
, false);
2259 pp_string (pp
, ") ");
2261 if (op_prio (op0
) < op_prio (node
))
2263 dump_generic_node (pp
, op0
, spc
, flags
, false);
2264 if (op_prio (op0
) < op_prio (node
))
2265 pp_right_paren (pp
);
2268 case VIEW_CONVERT_EXPR
:
2269 pp_string (pp
, "VIEW_CONVERT_EXPR<");
2270 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2271 pp_string (pp
, ">(");
2272 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2273 pp_right_paren (pp
);
2277 pp_string (pp
, "((");
2278 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2279 pp_string (pp
, "))");
2282 case NON_LVALUE_EXPR
:
2283 pp_string (pp
, "NON_LVALUE_EXPR <");
2284 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2289 pp_string (pp
, "SAVE_EXPR <");
2290 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2295 pp_string (pp
, "COMPLEX_EXPR <");
2296 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2297 pp_string (pp
, ", ");
2298 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2303 pp_string (pp
, "CONJ_EXPR <");
2304 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2309 pp_string (pp
, "REALPART_EXPR <");
2310 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2315 pp_string (pp
, "IMAGPART_EXPR <");
2316 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2321 pp_string (pp
, "VA_ARG_EXPR <");
2322 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2326 case TRY_FINALLY_EXPR
:
2327 case TRY_CATCH_EXPR
:
2328 pp_string (pp
, "try");
2329 newline_and_indent (pp
, spc
+2);
2331 newline_and_indent (pp
, spc
+4);
2332 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
+4, flags
, true);
2333 newline_and_indent (pp
, spc
+2);
2334 pp_right_brace (pp
);
2335 newline_and_indent (pp
, spc
);
2337 (TREE_CODE (node
) == TRY_CATCH_EXPR
) ? "catch" : "finally");
2338 newline_and_indent (pp
, spc
+2);
2340 newline_and_indent (pp
, spc
+4);
2341 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
+4, flags
, true);
2342 newline_and_indent (pp
, spc
+2);
2343 pp_right_brace (pp
);
2348 pp_string (pp
, "catch (");
2349 dump_generic_node (pp
, CATCH_TYPES (node
), spc
+2, flags
, false);
2350 pp_right_paren (pp
);
2351 newline_and_indent (pp
, spc
+2);
2353 newline_and_indent (pp
, spc
+4);
2354 dump_generic_node (pp
, CATCH_BODY (node
), spc
+4, flags
, true);
2355 newline_and_indent (pp
, spc
+2);
2356 pp_right_brace (pp
);
2360 case EH_FILTER_EXPR
:
2361 pp_string (pp
, "<<<eh_filter (");
2362 dump_generic_node (pp
, EH_FILTER_TYPES (node
), spc
+2, flags
, false);
2363 pp_string (pp
, ")>>>");
2364 newline_and_indent (pp
, spc
+2);
2366 newline_and_indent (pp
, spc
+4);
2367 dump_generic_node (pp
, EH_FILTER_FAILURE (node
), spc
+4, flags
, true);
2368 newline_and_indent (pp
, spc
+2);
2369 pp_right_brace (pp
);
2374 op0
= TREE_OPERAND (node
, 0);
2375 /* If this is for break or continue, don't bother printing it. */
2376 if (DECL_NAME (op0
))
2378 const char *name
= IDENTIFIER_POINTER (DECL_NAME (op0
));
2379 if (strcmp (name
, "break") == 0
2380 || strcmp (name
, "continue") == 0)
2383 dump_generic_node (pp
, op0
, spc
, flags
, false);
2385 if (DECL_NONLOCAL (op0
))
2386 pp_string (pp
, " [non-local]");
2390 pp_string (pp
, "while (1)");
2391 if (!(flags
& TDF_SLIM
))
2393 newline_and_indent (pp
, spc
+2);
2395 newline_and_indent (pp
, spc
+4);
2396 dump_generic_node (pp
, LOOP_EXPR_BODY (node
), spc
+4, flags
, true);
2397 newline_and_indent (pp
, spc
+2);
2398 pp_right_brace (pp
);
2404 pp_string (pp
, "// predicted ");
2405 if (PREDICT_EXPR_OUTCOME (node
))
2406 pp_string (pp
, "likely by ");
2408 pp_string (pp
, "unlikely by ");
2409 pp_string (pp
, predictor_name (PREDICT_EXPR_PREDICTOR (node
)));
2410 pp_string (pp
, " predictor.");
2414 pp_string (pp
, "ANNOTATE_EXPR <");
2415 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2416 switch ((enum annot_expr_kind
) TREE_INT_CST_LOW (TREE_OPERAND (node
, 1)))
2418 case annot_expr_ivdep_kind
:
2419 pp_string (pp
, ", ivdep");
2421 case annot_expr_no_vector_kind
:
2422 pp_string (pp
, ", no-vector");
2424 case annot_expr_vector_kind
:
2425 pp_string (pp
, ", vector");
2434 pp_string (pp
, "return");
2435 op0
= TREE_OPERAND (node
, 0);
2439 if (TREE_CODE (op0
) == MODIFY_EXPR
)
2440 dump_generic_node (pp
, TREE_OPERAND (op0
, 1),
2443 dump_generic_node (pp
, op0
, spc
, flags
, false);
2448 pp_string (pp
, "if (");
2449 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2450 pp_string (pp
, ") break");
2454 pp_string (pp
, "switch (");
2455 dump_generic_node (pp
, SWITCH_COND (node
), spc
, flags
, false);
2456 pp_right_paren (pp
);
2457 if (!(flags
& TDF_SLIM
))
2459 newline_and_indent (pp
, spc
+2);
2461 if (SWITCH_BODY (node
))
2463 newline_and_indent (pp
, spc
+4);
2464 dump_generic_node (pp
, SWITCH_BODY (node
), spc
+4, flags
,
2469 tree vec
= SWITCH_LABELS (node
);
2470 size_t i
, n
= TREE_VEC_LENGTH (vec
);
2471 for (i
= 0; i
< n
; ++i
)
2473 tree elt
= TREE_VEC_ELT (vec
, i
);
2474 newline_and_indent (pp
, spc
+4);
2477 dump_generic_node (pp
, elt
, spc
+4, flags
, false);
2478 pp_string (pp
, " goto ");
2479 dump_generic_node (pp
, CASE_LABEL (elt
), spc
+4,
2484 pp_string (pp
, "case ???: goto ???;");
2487 newline_and_indent (pp
, spc
+2);
2488 pp_right_brace (pp
);
2494 op0
= GOTO_DESTINATION (node
);
2495 if (TREE_CODE (op0
) != SSA_NAME
&& DECL_P (op0
) && DECL_NAME (op0
))
2497 const char *name
= IDENTIFIER_POINTER (DECL_NAME (op0
));
2498 if (strcmp (name
, "break") == 0
2499 || strcmp (name
, "continue") == 0)
2501 pp_string (pp
, name
);
2505 pp_string (pp
, "goto ");
2506 dump_generic_node (pp
, op0
, spc
, flags
, false);
2510 pp_string (pp
, "__asm__");
2511 if (ASM_VOLATILE_P (node
))
2512 pp_string (pp
, " __volatile__");
2514 dump_generic_node (pp
, ASM_STRING (node
), spc
, flags
, false);
2516 dump_generic_node (pp
, ASM_OUTPUTS (node
), spc
, flags
, false);
2518 dump_generic_node (pp
, ASM_INPUTS (node
), spc
, flags
, false);
2519 if (ASM_CLOBBERS (node
))
2522 dump_generic_node (pp
, ASM_CLOBBERS (node
), spc
, flags
, false);
2524 pp_right_paren (pp
);
2527 case CASE_LABEL_EXPR
:
2528 if (CASE_LOW (node
) && CASE_HIGH (node
))
2530 pp_string (pp
, "case ");
2531 dump_generic_node (pp
, CASE_LOW (node
), spc
, flags
, false);
2532 pp_string (pp
, " ... ");
2533 dump_generic_node (pp
, CASE_HIGH (node
), spc
, flags
, false);
2535 else if (CASE_LOW (node
))
2537 pp_string (pp
, "case ");
2538 dump_generic_node (pp
, CASE_LOW (node
), spc
, flags
, false);
2541 pp_string (pp
, "default");
2546 pp_string (pp
, "OBJ_TYPE_REF(");
2547 dump_generic_node (pp
, OBJ_TYPE_REF_EXPR (node
), spc
, flags
, false);
2549 if (!(flags
& TDF_SLIM
) && virtual_method_call_p (node
))
2551 pp_string (pp
, "(");
2552 dump_generic_node (pp
, obj_type_ref_class (node
), spc
, flags
, false);
2553 pp_string (pp
, ")");
2555 dump_generic_node (pp
, OBJ_TYPE_REF_OBJECT (node
), spc
, flags
, false);
2557 dump_generic_node (pp
, OBJ_TYPE_REF_TOKEN (node
), spc
, flags
, false);
2558 pp_right_paren (pp
);
2562 if (SSA_NAME_IDENTIFIER (node
))
2563 dump_generic_node (pp
, SSA_NAME_IDENTIFIER (node
),
2566 pp_decimal_int (pp
, SSA_NAME_VERSION (node
));
2567 if (SSA_NAME_IS_DEFAULT_DEF (node
))
2568 pp_string (pp
, "(D)");
2569 if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (node
))
2570 pp_string (pp
, "(ab)");
2573 case WITH_SIZE_EXPR
:
2574 pp_string (pp
, "WITH_SIZE_EXPR <");
2575 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2576 pp_string (pp
, ", ");
2577 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2582 pp_string (pp
, "ASSERT_EXPR <");
2583 dump_generic_node (pp
, ASSERT_EXPR_VAR (node
), spc
, flags
, false);
2584 pp_string (pp
, ", ");
2585 dump_generic_node (pp
, ASSERT_EXPR_COND (node
), spc
, flags
, false);
2590 pp_string (pp
, "scev_known");
2593 case SCEV_NOT_KNOWN
:
2594 pp_string (pp
, "scev_not_known");
2597 case POLYNOMIAL_CHREC
:
2599 dump_generic_node (pp
, CHREC_LEFT (node
), spc
, flags
, false);
2600 pp_string (pp
, ", +, ");
2601 dump_generic_node (pp
, CHREC_RIGHT (node
), spc
, flags
, false);
2602 pp_string (pp
, "}_");
2603 dump_generic_node (pp
, CHREC_VAR (node
), spc
, flags
, false);
2607 case REALIGN_LOAD_EXPR
:
2608 pp_string (pp
, "REALIGN_LOAD <");
2609 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2610 pp_string (pp
, ", ");
2611 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2612 pp_string (pp
, ", ");
2613 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2618 pp_string (pp
, " VEC_COND_EXPR < ");
2619 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2620 pp_string (pp
, " , ");
2621 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2622 pp_string (pp
, " , ");
2623 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2624 pp_string (pp
, " > ");
2628 pp_string (pp
, " VEC_PERM_EXPR < ");
2629 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2630 pp_string (pp
, " , ");
2631 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2632 pp_string (pp
, " , ");
2633 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2634 pp_string (pp
, " > ");
2638 pp_string (pp
, " DOT_PROD_EXPR < ");
2639 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2640 pp_string (pp
, ", ");
2641 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2642 pp_string (pp
, ", ");
2643 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2644 pp_string (pp
, " > ");
2647 case WIDEN_MULT_PLUS_EXPR
:
2648 pp_string (pp
, " WIDEN_MULT_PLUS_EXPR < ");
2649 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2650 pp_string (pp
, ", ");
2651 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2652 pp_string (pp
, ", ");
2653 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2654 pp_string (pp
, " > ");
2657 case WIDEN_MULT_MINUS_EXPR
:
2658 pp_string (pp
, " WIDEN_MULT_MINUS_EXPR < ");
2659 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2660 pp_string (pp
, ", ");
2661 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2662 pp_string (pp
, ", ");
2663 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2664 pp_string (pp
, " > ");
2668 pp_string (pp
, " FMA_EXPR < ");
2669 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2670 pp_string (pp
, ", ");
2671 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2672 pp_string (pp
, ", ");
2673 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2674 pp_string (pp
, " > ");
2678 pp_string (pp
, "#pragma acc parallel");
2679 dump_omp_clauses (pp
, OACC_PARALLEL_CLAUSES (node
), spc
, flags
);
2683 pp_string (pp
, "#pragma acc kernels");
2684 dump_omp_clauses (pp
, OACC_KERNELS_CLAUSES (node
), spc
, flags
);
2688 pp_string (pp
, "#pragma acc data");
2689 dump_omp_clauses (pp
, OACC_DATA_CLAUSES (node
), spc
, flags
);
2692 case OACC_HOST_DATA
:
2693 pp_string (pp
, "#pragma acc host_data");
2694 dump_omp_clauses (pp
, OACC_HOST_DATA_CLAUSES (node
), spc
, flags
);
2698 pp_string (pp
, "#pragma acc declare");
2699 dump_omp_clauses (pp
, OACC_DECLARE_CLAUSES (node
), spc
, flags
);
2703 pp_string (pp
, "#pragma acc update");
2704 dump_omp_clauses (pp
, OACC_UPDATE_CLAUSES (node
), spc
, flags
);
2707 case OACC_ENTER_DATA
:
2708 pp_string (pp
, "#pragma acc enter data");
2709 dump_omp_clauses (pp
, OACC_ENTER_DATA_CLAUSES (node
), spc
, flags
);
2712 case OACC_EXIT_DATA
:
2713 pp_string (pp
, "#pragma acc exit data");
2714 dump_omp_clauses (pp
, OACC_EXIT_DATA_CLAUSES (node
), spc
, flags
);
2718 pp_string (pp
, "#pragma acc cache");
2719 dump_omp_clauses (pp
, OACC_CACHE_CLAUSES (node
), spc
, flags
);
2723 pp_string (pp
, "#pragma omp parallel");
2724 dump_omp_clauses (pp
, OMP_PARALLEL_CLAUSES (node
), spc
, flags
);
2727 if (!(flags
& TDF_SLIM
) && OMP_BODY (node
))
2729 newline_and_indent (pp
, spc
+ 2);
2731 newline_and_indent (pp
, spc
+ 4);
2732 dump_generic_node (pp
, OMP_BODY (node
), spc
+ 4, flags
, false);
2733 newline_and_indent (pp
, spc
+ 2);
2734 pp_right_brace (pp
);
2740 pp_string (pp
, "#pragma omp task");
2741 dump_omp_clauses (pp
, OMP_TASK_CLAUSES (node
), spc
, flags
);
2745 pp_string (pp
, "#pragma omp for");
2749 pp_string (pp
, "#pragma omp simd");
2753 pp_string (pp
, "#pragma simd");
2757 /* This label points one line after dumping the clauses.
2758 For _Cilk_for the clauses are dumped after the _Cilk_for (...)
2759 parameters are printed out. */
2760 goto dump_omp_loop_cilk_for
;
2762 case OMP_DISTRIBUTE
:
2763 pp_string (pp
, "#pragma omp distribute");
2767 pp_string (pp
, "#pragma omp taskloop");
2771 pp_string (pp
, "#pragma acc loop");
2775 pp_string (pp
, "#pragma omp teams");
2776 dump_omp_clauses (pp
, OMP_TEAMS_CLAUSES (node
), spc
, flags
);
2779 case OMP_TARGET_DATA
:
2780 pp_string (pp
, "#pragma omp target data");
2781 dump_omp_clauses (pp
, OMP_TARGET_DATA_CLAUSES (node
), spc
, flags
);
2784 case OMP_TARGET_ENTER_DATA
:
2785 pp_string (pp
, "#pragma omp target enter data");
2786 dump_omp_clauses (pp
, OMP_TARGET_ENTER_DATA_CLAUSES (node
), spc
, flags
);
2790 case OMP_TARGET_EXIT_DATA
:
2791 pp_string (pp
, "#pragma omp target exit data");
2792 dump_omp_clauses (pp
, OMP_TARGET_EXIT_DATA_CLAUSES (node
), spc
, flags
);
2797 pp_string (pp
, "#pragma omp target");
2798 dump_omp_clauses (pp
, OMP_TARGET_CLAUSES (node
), spc
, flags
);
2801 case OMP_TARGET_UPDATE
:
2802 pp_string (pp
, "#pragma omp target update");
2803 dump_omp_clauses (pp
, OMP_TARGET_UPDATE_CLAUSES (node
), spc
, flags
);
2808 dump_omp_clauses (pp
, OMP_FOR_CLAUSES (node
), spc
, flags
);
2810 dump_omp_loop_cilk_for
:
2811 if (!(flags
& TDF_SLIM
))
2815 if (OMP_FOR_PRE_BODY (node
))
2817 if (TREE_CODE (node
) == CILK_FOR
)
2818 pp_string (pp
, " ");
2820 newline_and_indent (pp
, spc
+ 2);
2823 newline_and_indent (pp
, spc
);
2824 dump_generic_node (pp
, OMP_FOR_PRE_BODY (node
),
2827 if (OMP_FOR_INIT (node
))
2830 for (i
= 0; i
< TREE_VEC_LENGTH (OMP_FOR_INIT (node
)); i
++)
2833 if (TREE_CODE (node
) != CILK_FOR
|| OMP_FOR_PRE_BODY (node
))
2834 newline_and_indent (pp
, spc
);
2835 if (TREE_CODE (node
) == CILK_FOR
)
2836 pp_string (pp
, "_Cilk_for (");
2838 pp_string (pp
, "for (");
2839 dump_generic_node (pp
,
2840 TREE_VEC_ELT (OMP_FOR_INIT (node
), i
),
2842 pp_string (pp
, "; ");
2843 dump_generic_node (pp
,
2844 TREE_VEC_ELT (OMP_FOR_COND (node
), i
),
2846 pp_string (pp
, "; ");
2847 dump_generic_node (pp
,
2848 TREE_VEC_ELT (OMP_FOR_INCR (node
), i
),
2850 pp_right_paren (pp
);
2852 if (TREE_CODE (node
) == CILK_FOR
)
2853 dump_omp_clauses (pp
, OMP_FOR_CLAUSES (node
), spc
, flags
);
2855 if (OMP_FOR_BODY (node
))
2857 newline_and_indent (pp
, spc
+ 2);
2859 newline_and_indent (pp
, spc
+ 4);
2860 dump_generic_node (pp
, OMP_FOR_BODY (node
), spc
+ 4, flags
,
2862 newline_and_indent (pp
, spc
+ 2);
2863 pp_right_brace (pp
);
2865 if (OMP_FOR_INIT (node
))
2866 spc
-= 2 * TREE_VEC_LENGTH (OMP_FOR_INIT (node
)) - 2;
2867 if (OMP_FOR_PRE_BODY (node
))
2870 newline_and_indent (pp
, spc
+ 2);
2871 pp_right_brace (pp
);
2878 pp_string (pp
, "#pragma omp sections");
2879 dump_omp_clauses (pp
, OMP_SECTIONS_CLAUSES (node
), spc
, flags
);
2883 pp_string (pp
, "#pragma omp section");
2887 pp_string (pp
, "#pragma omp master");
2891 pp_string (pp
, "#pragma omp taskgroup");
2895 pp_string (pp
, "#pragma omp ordered");
2896 dump_omp_clauses (pp
, OMP_ORDERED_CLAUSES (node
), spc
, flags
);
2900 pp_string (pp
, "#pragma omp critical");
2901 if (OMP_CRITICAL_NAME (node
))
2905 dump_generic_node (pp
, OMP_CRITICAL_NAME (node
), spc
,
2907 pp_right_paren (pp
);
2909 dump_omp_clauses (pp
, OMP_CRITICAL_CLAUSES (node
), spc
, flags
);
2913 pp_string (pp
, "#pragma omp atomic");
2914 if (OMP_ATOMIC_SEQ_CST (node
))
2915 pp_string (pp
, " seq_cst");
2916 newline_and_indent (pp
, spc
+ 2);
2917 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2921 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2924 case OMP_ATOMIC_READ
:
2925 pp_string (pp
, "#pragma omp atomic read");
2926 if (OMP_ATOMIC_SEQ_CST (node
))
2927 pp_string (pp
, " seq_cst");
2928 newline_and_indent (pp
, spc
+ 2);
2929 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2933 case OMP_ATOMIC_CAPTURE_OLD
:
2934 case OMP_ATOMIC_CAPTURE_NEW
:
2935 pp_string (pp
, "#pragma omp atomic capture");
2936 if (OMP_ATOMIC_SEQ_CST (node
))
2937 pp_string (pp
, " seq_cst");
2938 newline_and_indent (pp
, spc
+ 2);
2939 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2943 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2947 pp_string (pp
, "#pragma omp single");
2948 dump_omp_clauses (pp
, OMP_SINGLE_CLAUSES (node
), spc
, flags
);
2952 dump_omp_clause (pp
, node
, spc
, flags
);
2956 case TRANSACTION_EXPR
:
2957 if (TRANSACTION_EXPR_OUTER (node
))
2958 pp_string (pp
, "__transaction_atomic [[outer]]");
2959 else if (TRANSACTION_EXPR_RELAXED (node
))
2960 pp_string (pp
, "__transaction_relaxed");
2962 pp_string (pp
, "__transaction_atomic");
2963 if (!(flags
& TDF_SLIM
) && TRANSACTION_EXPR_BODY (node
))
2965 newline_and_indent (pp
, spc
);
2967 newline_and_indent (pp
, spc
+ 2);
2968 dump_generic_node (pp
, TRANSACTION_EXPR_BODY (node
),
2969 spc
+ 2, flags
, false);
2970 newline_and_indent (pp
, spc
);
2971 pp_right_brace (pp
);
2976 case REDUC_MAX_EXPR
:
2977 pp_string (pp
, " REDUC_MAX_EXPR < ");
2978 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2979 pp_string (pp
, " > ");
2982 case REDUC_MIN_EXPR
:
2983 pp_string (pp
, " REDUC_MIN_EXPR < ");
2984 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2985 pp_string (pp
, " > ");
2988 case REDUC_PLUS_EXPR
:
2989 pp_string (pp
, " REDUC_PLUS_EXPR < ");
2990 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2991 pp_string (pp
, " > ");
2994 case VEC_WIDEN_MULT_HI_EXPR
:
2995 case VEC_WIDEN_MULT_LO_EXPR
:
2996 case VEC_WIDEN_MULT_EVEN_EXPR
:
2997 case VEC_WIDEN_MULT_ODD_EXPR
:
2998 case VEC_WIDEN_LSHIFT_HI_EXPR
:
2999 case VEC_WIDEN_LSHIFT_LO_EXPR
:
3001 for (str
= get_tree_code_name (code
); *str
; str
++)
3002 pp_character (pp
, TOUPPER (*str
));
3003 pp_string (pp
, " < ");
3004 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3005 pp_string (pp
, ", ");
3006 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3007 pp_string (pp
, " > ");
3010 case VEC_UNPACK_HI_EXPR
:
3011 pp_string (pp
, " VEC_UNPACK_HI_EXPR < ");
3012 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3013 pp_string (pp
, " > ");
3016 case VEC_UNPACK_LO_EXPR
:
3017 pp_string (pp
, " VEC_UNPACK_LO_EXPR < ");
3018 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3019 pp_string (pp
, " > ");
3022 case VEC_UNPACK_FLOAT_HI_EXPR
:
3023 pp_string (pp
, " VEC_UNPACK_FLOAT_HI_EXPR < ");
3024 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3025 pp_string (pp
, " > ");
3028 case VEC_UNPACK_FLOAT_LO_EXPR
:
3029 pp_string (pp
, " VEC_UNPACK_FLOAT_LO_EXPR < ");
3030 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3031 pp_string (pp
, " > ");
3034 case VEC_PACK_TRUNC_EXPR
:
3035 pp_string (pp
, " VEC_PACK_TRUNC_EXPR < ");
3036 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3037 pp_string (pp
, ", ");
3038 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3039 pp_string (pp
, " > ");
3042 case VEC_PACK_SAT_EXPR
:
3043 pp_string (pp
, " VEC_PACK_SAT_EXPR < ");
3044 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3045 pp_string (pp
, ", ");
3046 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3047 pp_string (pp
, " > ");
3050 case VEC_PACK_FIX_TRUNC_EXPR
:
3051 pp_string (pp
, " VEC_PACK_FIX_TRUNC_EXPR < ");
3052 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3053 pp_string (pp
, ", ");
3054 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3055 pp_string (pp
, " > ");
3059 dump_block_node (pp
, node
, spc
, flags
);
3062 case CILK_SPAWN_STMT
:
3063 pp_string (pp
, "_Cilk_spawn ");
3064 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3067 case CILK_SYNC_STMT
:
3068 pp_string (pp
, "_Cilk_sync");
3075 if (is_stmt
&& is_expr
)
3081 /* Print the declaration of a variable. */
3084 print_declaration (pretty_printer
*pp
, tree t
, int spc
, int flags
)
3088 if (TREE_CODE(t
) == NAMELIST_DECL
)
3090 pp_string(pp
, "namelist ");
3091 dump_decl_name (pp
, t
, flags
);
3096 if (TREE_CODE (t
) == TYPE_DECL
)
3097 pp_string (pp
, "typedef ");
3099 if (CODE_CONTAINS_STRUCT (TREE_CODE (t
), TS_DECL_WRTL
) && DECL_REGISTER (t
))
3100 pp_string (pp
, "register ");
3102 if (TREE_PUBLIC (t
) && DECL_EXTERNAL (t
))
3103 pp_string (pp
, "extern ");
3104 else if (TREE_STATIC (t
))
3105 pp_string (pp
, "static ");
3107 /* Print the type and name. */
3108 if (TREE_TYPE (t
) && TREE_CODE (TREE_TYPE (t
)) == ARRAY_TYPE
)
3112 /* Print array's type. */
3113 tmp
= TREE_TYPE (t
);
3114 while (TREE_CODE (TREE_TYPE (tmp
)) == ARRAY_TYPE
)
3115 tmp
= TREE_TYPE (tmp
);
3116 dump_generic_node (pp
, TREE_TYPE (tmp
), spc
, flags
, false);
3118 /* Print variable's name. */
3120 dump_generic_node (pp
, t
, spc
, flags
, false);
3122 /* Print the dimensions. */
3123 tmp
= TREE_TYPE (t
);
3124 while (TREE_CODE (tmp
) == ARRAY_TYPE
)
3126 dump_array_domain (pp
, TYPE_DOMAIN (tmp
), spc
, flags
);
3127 tmp
= TREE_TYPE (tmp
);
3130 else if (TREE_CODE (t
) == FUNCTION_DECL
)
3132 dump_generic_node (pp
, TREE_TYPE (TREE_TYPE (t
)), spc
, flags
, false);
3134 dump_decl_name (pp
, t
, flags
);
3135 dump_function_declaration (pp
, TREE_TYPE (t
), spc
, flags
);
3139 /* Print type declaration. */
3140 dump_generic_node (pp
, TREE_TYPE (t
), spc
, flags
, false);
3142 /* Print variable's name. */
3144 dump_generic_node (pp
, t
, spc
, flags
, false);
3147 if (TREE_CODE (t
) == VAR_DECL
&& DECL_HARD_REGISTER (t
))
3149 pp_string (pp
, " __asm__ ");
3151 dump_generic_node (pp
, DECL_ASSEMBLER_NAME (t
), spc
, flags
, false);
3152 pp_right_paren (pp
);
3155 /* The initial value of a function serves to determine whether the function
3156 is declared or defined. So the following does not apply to function
3158 if (TREE_CODE (t
) != FUNCTION_DECL
)
3160 /* Print the initial value. */
3161 if (DECL_INITIAL (t
))
3166 dump_generic_node (pp
, DECL_INITIAL (t
), spc
, flags
, false);
3170 if (TREE_CODE (t
) == VAR_DECL
&& DECL_HAS_VALUE_EXPR_P (t
))
3172 pp_string (pp
, " [value-expr: ");
3173 dump_generic_node (pp
, DECL_VALUE_EXPR (t
), spc
, flags
, false);
3174 pp_right_bracket (pp
);
3181 /* Prints a structure: name, fields, and methods.
3182 FIXME: Still incomplete. */
3185 print_struct_decl (pretty_printer
*pp
, const_tree node
, int spc
, int flags
)
3187 /* Print the name of the structure. */
3188 if (TYPE_NAME (node
))
3191 if (TREE_CODE (node
) == RECORD_TYPE
)
3192 pp_string (pp
, "struct ");
3193 else if ((TREE_CODE (node
) == UNION_TYPE
3194 || TREE_CODE (node
) == QUAL_UNION_TYPE
))
3195 pp_string (pp
, "union ");
3197 dump_generic_node (pp
, TYPE_NAME (node
), spc
, 0, false);
3200 /* Print the contents of the structure. */
3206 /* Print the fields of the structure. */
3209 tmp
= TYPE_FIELDS (node
);
3212 /* Avoid to print recursively the structure. */
3213 /* FIXME : Not implemented correctly...,
3214 what about the case when we have a cycle in the contain graph? ...
3215 Maybe this could be solved by looking at the scope in which the
3216 structure was declared. */
3217 if (TREE_TYPE (tmp
) != node
3218 && (TREE_CODE (TREE_TYPE (tmp
)) != POINTER_TYPE
3219 || TREE_TYPE (TREE_TYPE (tmp
)) != node
))
3221 print_declaration (pp
, tmp
, spc
+2, flags
);
3224 tmp
= DECL_CHAIN (tmp
);
3228 pp_right_brace (pp
);
3231 /* Return the priority of the operator CODE.
3233 From lowest to highest precedence with either left-to-right (L-R)
3234 or right-to-left (R-L) associativity]:
3237 2 [R-L] = += -= *= /= %= &= ^= |= <<= >>=
3249 14 [R-L] ! ~ ++ -- + - * & (type) sizeof
3250 15 [L-R] fn() [] -> .
3252 unary +, - and * have higher precedence than the corresponding binary
3256 op_code_prio (enum tree_code code
)
3273 case TRUTH_ORIF_EXPR
:
3276 case TRUTH_AND_EXPR
:
3277 case TRUTH_ANDIF_EXPR
:
3284 case TRUTH_XOR_EXPR
:
3301 case UNORDERED_EXPR
:
3312 case VEC_WIDEN_LSHIFT_HI_EXPR
:
3313 case VEC_WIDEN_LSHIFT_LO_EXPR
:
3314 case WIDEN_LSHIFT_EXPR
:
3317 case WIDEN_SUM_EXPR
:
3319 case POINTER_PLUS_EXPR
:
3323 case VEC_WIDEN_MULT_HI_EXPR
:
3324 case VEC_WIDEN_MULT_LO_EXPR
:
3325 case WIDEN_MULT_EXPR
:
3327 case WIDEN_MULT_PLUS_EXPR
:
3328 case WIDEN_MULT_MINUS_EXPR
:
3330 case MULT_HIGHPART_EXPR
:
3331 case TRUNC_DIV_EXPR
:
3333 case FLOOR_DIV_EXPR
:
3334 case ROUND_DIV_EXPR
:
3336 case EXACT_DIV_EXPR
:
3337 case TRUNC_MOD_EXPR
:
3339 case FLOOR_MOD_EXPR
:
3340 case ROUND_MOD_EXPR
:
3344 case TRUTH_NOT_EXPR
:
3346 case POSTINCREMENT_EXPR
:
3347 case POSTDECREMENT_EXPR
:
3348 case PREINCREMENT_EXPR
:
3349 case PREDECREMENT_EXPR
:
3355 case FIX_TRUNC_EXPR
:
3361 case ARRAY_RANGE_REF
:
3365 /* Special expressions. */
3371 case REDUC_MAX_EXPR
:
3372 case REDUC_MIN_EXPR
:
3373 case REDUC_PLUS_EXPR
:
3374 case VEC_UNPACK_HI_EXPR
:
3375 case VEC_UNPACK_LO_EXPR
:
3376 case VEC_UNPACK_FLOAT_HI_EXPR
:
3377 case VEC_UNPACK_FLOAT_LO_EXPR
:
3378 case VEC_PACK_TRUNC_EXPR
:
3379 case VEC_PACK_SAT_EXPR
:
3383 /* Return an arbitrarily high precedence to avoid surrounding single
3384 VAR_DECLs in ()s. */
3389 /* Return the priority of the operator OP. */
3392 op_prio (const_tree op
)
3394 enum tree_code code
;
3399 code
= TREE_CODE (op
);
3400 if (code
== SAVE_EXPR
|| code
== NON_LVALUE_EXPR
)
3401 return op_prio (TREE_OPERAND (op
, 0));
3403 return op_code_prio (code
);
3406 /* Return the symbol associated with operator CODE. */
3409 op_symbol_code (enum tree_code code
)
3417 case TRUTH_ORIF_EXPR
:
3420 case TRUTH_AND_EXPR
:
3421 case TRUTH_ANDIF_EXPR
:
3427 case TRUTH_XOR_EXPR
:
3437 case UNORDERED_EXPR
:
3483 case WIDEN_LSHIFT_EXPR
:
3486 case POINTER_PLUS_EXPR
:
3492 case REDUC_PLUS_EXPR
:
3495 case WIDEN_SUM_EXPR
:
3498 case WIDEN_MULT_EXPR
:
3501 case MULT_HIGHPART_EXPR
:
3511 case TRUTH_NOT_EXPR
:
3518 case TRUNC_DIV_EXPR
:
3525 case FLOOR_DIV_EXPR
:
3528 case ROUND_DIV_EXPR
:
3531 case EXACT_DIV_EXPR
:
3534 case TRUNC_MOD_EXPR
:
3540 case FLOOR_MOD_EXPR
:
3543 case ROUND_MOD_EXPR
:
3546 case PREDECREMENT_EXPR
:
3549 case PREINCREMENT_EXPR
:
3552 case POSTDECREMENT_EXPR
:
3555 case POSTINCREMENT_EXPR
:
3565 return "<<< ??? >>>";
3569 /* Return the symbol associated with operator OP. */
3572 op_symbol (const_tree op
)
3574 return op_symbol_code (TREE_CODE (op
));
3577 /* Prints the name of a call. NODE is the CALL_EXPR_FN of a CALL_EXPR or
3578 the gimple_call_fn of a GIMPLE_CALL. */
3581 print_call_name (pretty_printer
*pp
, tree node
, int flags
)
3585 if (TREE_CODE (op0
) == NON_LVALUE_EXPR
)
3586 op0
= TREE_OPERAND (op0
, 0);
3589 switch (TREE_CODE (op0
))
3594 dump_function_name (pp
, op0
, flags
);
3600 op0
= TREE_OPERAND (op0
, 0);
3605 dump_generic_node (pp
, TREE_OPERAND (op0
, 0), 0, flags
, false);
3606 pp_string (pp
, ") ? ");
3607 dump_generic_node (pp
, TREE_OPERAND (op0
, 1), 0, flags
, false);
3608 pp_string (pp
, " : ");
3609 dump_generic_node (pp
, TREE_OPERAND (op0
, 2), 0, flags
, false);
3613 if (TREE_CODE (TREE_OPERAND (op0
, 0)) == VAR_DECL
)
3614 dump_function_name (pp
, TREE_OPERAND (op0
, 0), flags
);
3616 dump_generic_node (pp
, op0
, 0, flags
, false);
3620 if (integer_zerop (TREE_OPERAND (op0
, 1)))
3622 op0
= TREE_OPERAND (op0
, 0);
3629 dump_generic_node (pp
, op0
, 0, flags
, false);
3637 /* Parses the string STR and replaces new-lines by '\n', tabs by '\t', ... */
3640 pretty_print_string (pretty_printer
*pp
, const char *str
)
3650 pp_string (pp
, "\\b");
3654 pp_string (pp
, "\\f");
3658 pp_string (pp
, "\\n");
3662 pp_string (pp
, "\\r");
3666 pp_string (pp
, "\\t");
3670 pp_string (pp
, "\\v");
3674 pp_string (pp
, "\\\\");
3678 pp_string (pp
, "\\\"");
3682 pp_string (pp
, "\\'");
3685 /* No need to handle \0; the loop terminates on \0. */
3688 pp_string (pp
, "\\1");
3692 pp_string (pp
, "\\2");
3696 pp_string (pp
, "\\3");
3700 pp_string (pp
, "\\4");
3704 pp_string (pp
, "\\5");
3708 pp_string (pp
, "\\6");
3712 pp_string (pp
, "\\7");
3716 pp_character (pp
, str
[0]);
3724 maybe_init_pretty_print (FILE *file
)
3728 tree_pp
= new pretty_printer ();
3729 pp_needs_newline (tree_pp
) = true;
3730 pp_translate_identifiers (tree_pp
) = false;
3733 tree_pp
->buffer
->stream
= file
;
3737 newline_and_indent (pretty_printer
*pp
, int spc
)
3743 /* Handle a %K format for TEXT. Separate from default_tree_printer so
3744 it can also be used in front ends.
3745 %K: a statement, from which EXPR_LOCATION and TREE_BLOCK will be recorded.
3749 percent_K_format (text_info
*text
)
3751 tree t
= va_arg (*text
->args_ptr
, tree
), block
;
3752 text
->set_location (0, EXPR_LOCATION (t
));
3753 gcc_assert (pp_ti_abstract_origin (text
) != NULL
);
3754 block
= TREE_BLOCK (t
);
3755 *pp_ti_abstract_origin (text
) = NULL
;
3759 /* ??? LTO drops all BLOCK_ABSTRACT_ORIGINs apart from those
3760 representing the outermost block of an inlined function.
3761 So walk the BLOCK tree until we hit such a scope. */
3763 && TREE_CODE (block
) == BLOCK
)
3765 if (inlined_function_outer_scope_p (block
))
3767 *pp_ti_abstract_origin (text
) = block
;
3770 block
= BLOCK_SUPERCONTEXT (block
);
3776 && TREE_CODE (block
) == BLOCK
3777 && BLOCK_ABSTRACT_ORIGIN (block
))
3779 tree ao
= BLOCK_ABSTRACT_ORIGIN (block
);
3781 while (TREE_CODE (ao
) == BLOCK
3782 && BLOCK_ABSTRACT_ORIGIN (ao
)
3783 && BLOCK_ABSTRACT_ORIGIN (ao
) != ao
)
3784 ao
= BLOCK_ABSTRACT_ORIGIN (ao
);
3786 if (TREE_CODE (ao
) == FUNCTION_DECL
)
3788 *pp_ti_abstract_origin (text
) = block
;
3791 block
= BLOCK_SUPERCONTEXT (block
);
3795 /* Print the identifier ID to PRETTY-PRINTER. */
3798 pp_tree_identifier (pretty_printer
*pp
, tree id
)
3800 if (pp_translate_identifiers (pp
))
3802 const char *text
= identifier_to_locale (IDENTIFIER_POINTER (id
));
3803 pp_append_text (pp
, text
, text
+ strlen (text
));
3806 pp_append_text (pp
, IDENTIFIER_POINTER (id
),
3807 IDENTIFIER_POINTER (id
) + IDENTIFIER_LENGTH (id
));
3810 /* A helper function that is used to dump function information before the
3814 dump_function_header (FILE *dump_file
, tree fdecl
, int flags
)
3816 const char *dname
, *aname
;
3817 struct cgraph_node
*node
= cgraph_node::get (fdecl
);
3818 struct function
*fun
= DECL_STRUCT_FUNCTION (fdecl
);
3820 dname
= lang_hooks
.decl_printable_name (fdecl
, 2);
3822 if (DECL_ASSEMBLER_NAME_SET_P (fdecl
))
3823 aname
= (IDENTIFIER_POINTER
3824 (DECL_ASSEMBLER_NAME (fdecl
)));
3826 aname
= "<unset-asm-name>";
3828 fprintf (dump_file
, "\n;; Function %s (%s, funcdef_no=%d",
3829 dname
, aname
, fun
->funcdef_no
);
3830 if (!(flags
& TDF_NOUID
))
3831 fprintf (dump_file
, ", decl_uid=%d", DECL_UID (fdecl
));
3834 fprintf (dump_file
, ", cgraph_uid=%d", node
->uid
);
3835 fprintf (dump_file
, ", symbol_order=%d)%s\n\n", node
->order
,
3836 node
->frequency
== NODE_FREQUENCY_HOT
3838 : node
->frequency
== NODE_FREQUENCY_UNLIKELY_EXECUTED
3839 ? " (unlikely executed)"
3840 : node
->frequency
== NODE_FREQUENCY_EXECUTED_ONCE
3841 ? " (executed once)"
3845 fprintf (dump_file
, ")\n\n");
3848 /* Dump double_int D to pretty_printer PP. UNS is true
3849 if D is unsigned and false otherwise. */
3851 pp_double_int (pretty_printer
*pp
, double_int d
, bool uns
)
3854 pp_wide_integer (pp
, d
.low
);
3855 else if (d
.fits_uhwi ())
3856 pp_unsigned_wide_integer (pp
, d
.low
);
3859 unsigned HOST_WIDE_INT low
= d
.low
;
3860 HOST_WIDE_INT high
= d
.high
;
3861 if (!uns
&& d
.is_negative ())
3864 high
= ~high
+ !low
;
3867 /* Would "%x%0*x" or "%x%*0x" get zero-padding on all
3869 sprintf (pp_buffer (pp
)->digit_buffer
,
3870 HOST_WIDE_INT_PRINT_DOUBLE_HEX
,
3871 (unsigned HOST_WIDE_INT
) high
, low
);
3872 pp_string (pp
, pp_buffer (pp
)->digit_buffer
);