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
);
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)
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
)
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, 0, 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 the name of a _DECL node and its DECL_UID if TDF_UID is set
168 dump_decl_name (pretty_printer
*pp
, tree node
, int flags
)
170 if (DECL_NAME (node
))
172 if ((flags
& TDF_ASMNAME
) && DECL_ASSEMBLER_NAME_SET_P (node
))
173 pp_tree_identifier (pp
, DECL_ASSEMBLER_NAME (node
));
175 pp_tree_identifier (pp
, DECL_NAME (node
));
177 if ((flags
& TDF_UID
) || DECL_NAME (node
) == NULL_TREE
)
179 if (TREE_CODE (node
) == LABEL_DECL
&& LABEL_DECL_UID (node
) != -1)
180 pp_printf (pp
, "L.%d", (int) LABEL_DECL_UID (node
));
181 else if (TREE_CODE (node
) == DEBUG_EXPR_DECL
)
183 if (flags
& TDF_NOUID
)
184 pp_string (pp
, "D#xxxx");
186 pp_printf (pp
, "D#%i", DEBUG_TEMP_UID (node
));
190 char c
= TREE_CODE (node
) == CONST_DECL
? 'C' : 'D';
191 if (flags
& TDF_NOUID
)
192 pp_printf (pp
, "%c.xxxx", c
);
194 pp_printf (pp
, "%c.%u", c
, DECL_UID (node
));
197 if ((flags
& TDF_ALIAS
) && DECL_PT_UID (node
) != DECL_UID (node
))
199 if (flags
& TDF_NOUID
)
200 pp_printf (pp
, "ptD.xxxx");
202 pp_printf (pp
, "ptD.%u", DECL_PT_UID (node
));
206 /* Like the above, but used for pretty printing function calls. */
209 dump_function_name (pretty_printer
*pp
, tree node
, int flags
)
211 if (CONVERT_EXPR_P (node
))
212 node
= TREE_OPERAND (node
, 0);
213 if (DECL_NAME (node
) && (flags
& TDF_ASMNAME
) == 0)
214 pp_string (pp
, lang_hooks
.decl_printable_name (node
, 1));
216 dump_decl_name (pp
, node
, flags
);
219 /* Dump a function declaration. NODE is the FUNCTION_TYPE. PP, SPC and
220 FLAGS are as in dump_generic_node. */
223 dump_function_declaration (pretty_printer
*pp
, tree node
,
226 bool wrote_arg
= false;
232 /* Print the argument types. */
233 arg
= TYPE_ARG_TYPES (node
);
234 while (arg
&& arg
!= void_list_node
&& arg
!= error_mark_node
)
242 dump_generic_node (pp
, TREE_VALUE (arg
), spc
, flags
, false);
243 arg
= TREE_CHAIN (arg
);
246 /* Drop the trailing void_type_node if we had any previous argument. */
247 if (arg
== void_list_node
&& !wrote_arg
)
248 pp_string (pp
, "void");
249 /* Properly dump vararg function types. */
250 else if (!arg
&& wrote_arg
)
251 pp_string (pp
, ", ...");
252 /* Avoid printing any arg for unprototyped functions. */
257 /* Dump the domain associated with an array. */
260 dump_array_domain (pretty_printer
*pp
, tree domain
, int spc
, int flags
)
262 pp_left_bracket (pp
);
265 tree min
= TYPE_MIN_VALUE (domain
);
266 tree max
= TYPE_MAX_VALUE (domain
);
269 && integer_zerop (min
)
270 && tree_fits_shwi_p (max
))
271 pp_wide_integer (pp
, tree_to_shwi (max
) + 1);
275 dump_generic_node (pp
, min
, spc
, flags
, false);
278 dump_generic_node (pp
, max
, spc
, flags
, false);
282 pp_string (pp
, "<unknown>");
283 pp_right_bracket (pp
);
287 /* Dump OpenMP clause CLAUSE. PP, CLAUSE, SPC and FLAGS are as in
288 dump_generic_node. */
291 dump_omp_clause (pretty_printer
*pp
, tree clause
, int spc
, int flags
)
295 switch (OMP_CLAUSE_CODE (clause
))
297 case OMP_CLAUSE_PRIVATE
:
300 case OMP_CLAUSE_SHARED
:
303 case OMP_CLAUSE_FIRSTPRIVATE
:
304 name
= "firstprivate";
306 case OMP_CLAUSE_LASTPRIVATE
:
307 name
= "lastprivate";
309 case OMP_CLAUSE_COPYIN
:
312 case OMP_CLAUSE_COPYPRIVATE
:
313 name
= "copyprivate";
315 case OMP_CLAUSE_UNIFORM
:
318 case OMP_CLAUSE_USE_DEVICE_PTR
:
319 name
= "use_device_ptr";
321 case OMP_CLAUSE_IS_DEVICE_PTR
:
322 name
= "is_device_ptr";
324 case OMP_CLAUSE__LOOPTEMP_
:
327 case OMP_CLAUSE_DEVICE_RESIDENT
:
328 name
= "device_resident";
330 case OMP_CLAUSE_TO_DECLARE
:
333 case OMP_CLAUSE_LINK
:
337 pp_string (pp
, name
);
339 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
344 case OMP_CLAUSE_REDUCTION
:
345 pp_string (pp
, "reduction(");
346 if (OMP_CLAUSE_REDUCTION_CODE (clause
) != ERROR_MARK
)
349 op_symbol_code (OMP_CLAUSE_REDUCTION_CODE (clause
)));
352 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
358 pp_string (pp
, "if(");
359 switch (OMP_CLAUSE_IF_MODIFIER (clause
))
361 case ERROR_MARK
: break;
362 case OMP_PARALLEL
: pp_string (pp
, "parallel:"); break;
363 case OMP_TASK
: pp_string (pp
, "task:"); break;
364 case OMP_TASKLOOP
: pp_string (pp
, "taskloop:"); break;
365 case OMP_TARGET_DATA
: pp_string (pp
, "target data:"); break;
366 case OMP_TARGET
: pp_string (pp
, "target:"); break;
367 case OMP_TARGET_UPDATE
: pp_string (pp
, "target update:"); break;
368 case OMP_TARGET_ENTER_DATA
:
369 pp_string (pp
, "target enter data:"); break;
370 case OMP_TARGET_EXIT_DATA
: pp_string (pp
, "target exit data:"); break;
371 default: gcc_unreachable ();
373 dump_generic_node (pp
, OMP_CLAUSE_IF_EXPR (clause
),
378 case OMP_CLAUSE_NUM_THREADS
:
379 pp_string (pp
, "num_threads(");
380 dump_generic_node (pp
, OMP_CLAUSE_NUM_THREADS_EXPR (clause
),
385 case OMP_CLAUSE__CILK_FOR_COUNT_
:
386 pp_string (pp
, "_Cilk_for_count_(");
387 dump_generic_node (pp
, OMP_CLAUSE_OPERAND (clause
, 0),
392 case OMP_CLAUSE_NOWAIT
:
393 pp_string (pp
, "nowait");
395 case OMP_CLAUSE_ORDERED
:
396 pp_string (pp
, "ordered");
397 if (OMP_CLAUSE_ORDERED_EXPR (clause
))
400 dump_generic_node (pp
, OMP_CLAUSE_ORDERED_EXPR (clause
),
406 case OMP_CLAUSE_DEFAULT
:
407 pp_string (pp
, "default(");
408 switch (OMP_CLAUSE_DEFAULT_KIND (clause
))
410 case OMP_CLAUSE_DEFAULT_UNSPECIFIED
:
412 case OMP_CLAUSE_DEFAULT_SHARED
:
413 pp_string (pp
, "shared");
415 case OMP_CLAUSE_DEFAULT_NONE
:
416 pp_string (pp
, "none");
418 case OMP_CLAUSE_DEFAULT_PRIVATE
:
419 pp_string (pp
, "private");
421 case OMP_CLAUSE_DEFAULT_FIRSTPRIVATE
:
422 pp_string (pp
, "firstprivate");
430 case OMP_CLAUSE_SCHEDULE
:
431 pp_string (pp
, "schedule(");
432 if (OMP_CLAUSE_SCHEDULE_KIND (clause
)
433 & (OMP_CLAUSE_SCHEDULE_MONOTONIC
434 | OMP_CLAUSE_SCHEDULE_NONMONOTONIC
))
436 if (OMP_CLAUSE_SCHEDULE_KIND (clause
)
437 & OMP_CLAUSE_SCHEDULE_MONOTONIC
)
438 pp_string (pp
, "monotonic");
440 pp_string (pp
, "nonmonotonic");
441 if (OMP_CLAUSE_SCHEDULE_SIMD (clause
))
446 if (OMP_CLAUSE_SCHEDULE_SIMD (clause
))
447 pp_string (pp
, "simd:");
449 switch (OMP_CLAUSE_SCHEDULE_KIND (clause
) & OMP_CLAUSE_SCHEDULE_MASK
)
451 case OMP_CLAUSE_SCHEDULE_STATIC
:
452 pp_string (pp
, "static");
454 case OMP_CLAUSE_SCHEDULE_DYNAMIC
:
455 pp_string (pp
, "dynamic");
457 case OMP_CLAUSE_SCHEDULE_GUIDED
:
458 pp_string (pp
, "guided");
460 case OMP_CLAUSE_SCHEDULE_RUNTIME
:
461 pp_string (pp
, "runtime");
463 case OMP_CLAUSE_SCHEDULE_AUTO
:
464 pp_string (pp
, "auto");
466 case OMP_CLAUSE_SCHEDULE_CILKFOR
:
467 pp_string (pp
, "cilk-for grain");
472 if (OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (clause
))
475 dump_generic_node (pp
, OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (clause
),
481 case OMP_CLAUSE_UNTIED
:
482 pp_string (pp
, "untied");
485 case OMP_CLAUSE_COLLAPSE
:
486 pp_string (pp
, "collapse(");
487 dump_generic_node (pp
, OMP_CLAUSE_COLLAPSE_EXPR (clause
),
492 case OMP_CLAUSE_FINAL
:
493 pp_string (pp
, "final(");
494 dump_generic_node (pp
, OMP_CLAUSE_FINAL_EXPR (clause
),
499 case OMP_CLAUSE_MERGEABLE
:
500 pp_string (pp
, "mergeable");
503 case OMP_CLAUSE_LINEAR
:
504 pp_string (pp
, "linear(");
505 switch (OMP_CLAUSE_LINEAR_KIND (clause
))
507 case OMP_CLAUSE_LINEAR_DEFAULT
:
509 case OMP_CLAUSE_LINEAR_REF
:
510 pp_string (pp
, "ref(");
512 case OMP_CLAUSE_LINEAR_VAL
:
513 pp_string (pp
, "val(");
515 case OMP_CLAUSE_LINEAR_UVAL
:
516 pp_string (pp
, "uval(");
521 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
523 if (OMP_CLAUSE_LINEAR_KIND (clause
) != OMP_CLAUSE_LINEAR_DEFAULT
)
526 dump_generic_node (pp
, OMP_CLAUSE_LINEAR_STEP (clause
),
531 case OMP_CLAUSE_ALIGNED
:
532 pp_string (pp
, "aligned(");
533 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
535 if (OMP_CLAUSE_ALIGNED_ALIGNMENT (clause
))
538 dump_generic_node (pp
, OMP_CLAUSE_ALIGNED_ALIGNMENT (clause
),
544 case OMP_CLAUSE_DEPEND
:
545 pp_string (pp
, "depend(");
546 switch (OMP_CLAUSE_DEPEND_KIND (clause
))
548 case OMP_CLAUSE_DEPEND_IN
:
549 pp_string (pp
, "in");
551 case OMP_CLAUSE_DEPEND_OUT
:
552 pp_string (pp
, "out");
554 case OMP_CLAUSE_DEPEND_INOUT
:
555 pp_string (pp
, "inout");
557 case OMP_CLAUSE_DEPEND_SOURCE
:
558 pp_string (pp
, "source)");
560 case OMP_CLAUSE_DEPEND_SINK
:
561 pp_string (pp
, "sink:");
562 for (tree t
= OMP_CLAUSE_DECL (clause
); t
; t
= TREE_CHAIN (t
))
563 if (TREE_CODE (t
) == TREE_LIST
)
565 dump_generic_node (pp
, TREE_VALUE (t
), spc
, flags
, false);
566 if (TREE_PURPOSE (t
) != integer_zero_node
)
568 if (OMP_CLAUSE_DEPEND_SINK_NEGATIVE (t
))
572 dump_generic_node (pp
, TREE_PURPOSE (t
), spc
, flags
,
586 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
592 pp_string (pp
, "map(");
593 switch (OMP_CLAUSE_MAP_KIND (clause
))
596 case GOMP_MAP_POINTER
:
597 pp_string (pp
, "alloc");
600 case GOMP_MAP_TO_PSET
:
601 pp_string (pp
, "to");
604 pp_string (pp
, "from");
606 case GOMP_MAP_TOFROM
:
607 pp_string (pp
, "tofrom");
609 case GOMP_MAP_FORCE_ALLOC
:
610 pp_string (pp
, "force_alloc");
612 case GOMP_MAP_FORCE_TO
:
613 pp_string (pp
, "force_to");
615 case GOMP_MAP_FORCE_FROM
:
616 pp_string (pp
, "force_from");
618 case GOMP_MAP_FORCE_TOFROM
:
619 pp_string (pp
, "force_tofrom");
621 case GOMP_MAP_FORCE_PRESENT
:
622 pp_string (pp
, "force_present");
624 case GOMP_MAP_FORCE_DEALLOC
:
625 pp_string (pp
, "delete");
627 case GOMP_MAP_FORCE_DEVICEPTR
:
628 pp_string (pp
, "force_deviceptr");
630 case GOMP_MAP_ALWAYS_TO
:
631 pp_string (pp
, "always,to");
633 case GOMP_MAP_ALWAYS_FROM
:
634 pp_string (pp
, "always,from");
636 case GOMP_MAP_ALWAYS_TOFROM
:
637 pp_string (pp
, "always,tofrom");
639 case GOMP_MAP_RELEASE
:
640 pp_string (pp
, "release");
642 case GOMP_MAP_FIRSTPRIVATE_POINTER
:
643 pp_string (pp
, "firstprivate");
645 case GOMP_MAP_FIRSTPRIVATE_REFERENCE
:
646 pp_string (pp
, "firstprivate ref");
648 case GOMP_MAP_STRUCT
:
649 pp_string (pp
, "struct");
651 case GOMP_MAP_ALWAYS_POINTER
:
652 pp_string (pp
, "always_pointer");
654 case GOMP_MAP_DEVICE_RESIDENT
:
655 pp_string (pp
, "device_resident");
658 pp_string (pp
, "link");
664 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
667 if (OMP_CLAUSE_SIZE (clause
))
669 switch (OMP_CLAUSE_CODE (clause
) == OMP_CLAUSE_MAP
670 ? OMP_CLAUSE_MAP_KIND (clause
) : GOMP_MAP_TO
)
672 case GOMP_MAP_POINTER
:
673 case GOMP_MAP_FIRSTPRIVATE_POINTER
:
674 case GOMP_MAP_FIRSTPRIVATE_REFERENCE
:
675 case GOMP_MAP_ALWAYS_POINTER
:
676 pp_string (pp
, " [pointer assign, bias: ");
678 case GOMP_MAP_TO_PSET
:
679 pp_string (pp
, " [pointer set, len: ");
682 pp_string (pp
, " [len: ");
685 dump_generic_node (pp
, OMP_CLAUSE_SIZE (clause
),
687 pp_right_bracket (pp
);
692 case OMP_CLAUSE_FROM
:
693 pp_string (pp
, "from(");
694 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
696 goto print_clause_size
;
699 pp_string (pp
, "to(");
700 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
702 goto print_clause_size
;
704 case OMP_CLAUSE__CACHE_
:
706 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
708 goto print_clause_size
;
710 case OMP_CLAUSE_NUM_TEAMS
:
711 pp_string (pp
, "num_teams(");
712 dump_generic_node (pp
, OMP_CLAUSE_NUM_TEAMS_EXPR (clause
),
717 case OMP_CLAUSE_THREAD_LIMIT
:
718 pp_string (pp
, "thread_limit(");
719 dump_generic_node (pp
, OMP_CLAUSE_THREAD_LIMIT_EXPR (clause
),
724 case OMP_CLAUSE_DEVICE
:
725 pp_string (pp
, "device(");
726 dump_generic_node (pp
, OMP_CLAUSE_DEVICE_ID (clause
),
731 case OMP_CLAUSE_DIST_SCHEDULE
:
732 pp_string (pp
, "dist_schedule(static");
733 if (OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR (clause
))
736 dump_generic_node (pp
,
737 OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR (clause
),
743 case OMP_CLAUSE_PROC_BIND
:
744 pp_string (pp
, "proc_bind(");
745 switch (OMP_CLAUSE_PROC_BIND_KIND (clause
))
747 case OMP_CLAUSE_PROC_BIND_MASTER
:
748 pp_string (pp
, "master");
750 case OMP_CLAUSE_PROC_BIND_CLOSE
:
751 pp_string (pp
, "close");
753 case OMP_CLAUSE_PROC_BIND_SPREAD
:
754 pp_string (pp
, "spread");
762 case OMP_CLAUSE_SAFELEN
:
763 pp_string (pp
, "safelen(");
764 dump_generic_node (pp
, OMP_CLAUSE_SAFELEN_EXPR (clause
),
769 case OMP_CLAUSE_SIMDLEN
:
770 pp_string (pp
, "simdlen(");
771 dump_generic_node (pp
, OMP_CLAUSE_SIMDLEN_EXPR (clause
),
776 case OMP_CLAUSE_PRIORITY
:
777 pp_string (pp
, "priority(");
778 dump_generic_node (pp
, OMP_CLAUSE_PRIORITY_EXPR (clause
),
783 case OMP_CLAUSE_GRAINSIZE
:
784 pp_string (pp
, "grainsize(");
785 dump_generic_node (pp
, OMP_CLAUSE_GRAINSIZE_EXPR (clause
),
790 case OMP_CLAUSE_NUM_TASKS
:
791 pp_string (pp
, "num_tasks(");
792 dump_generic_node (pp
, OMP_CLAUSE_NUM_TASKS_EXPR (clause
),
797 case OMP_CLAUSE_HINT
:
798 pp_string (pp
, "hint(");
799 dump_generic_node (pp
, OMP_CLAUSE_HINT_EXPR (clause
),
804 case OMP_CLAUSE_DEFAULTMAP
:
805 pp_string (pp
, "defaultmap(tofrom:scalar)");
808 case OMP_CLAUSE__SIMDUID_
:
809 pp_string (pp
, "_simduid_(");
810 dump_generic_node (pp
, OMP_CLAUSE__SIMDUID__DECL (clause
),
815 case OMP_CLAUSE_GANG
:
816 pp_string (pp
, "gang");
817 if (OMP_CLAUSE_GANG_EXPR (clause
) != NULL_TREE
)
819 pp_string (pp
, "(num: ");
820 dump_generic_node (pp
, OMP_CLAUSE_GANG_EXPR (clause
),
823 if (OMP_CLAUSE_GANG_STATIC_EXPR (clause
) != NULL_TREE
)
825 if (OMP_CLAUSE_GANG_EXPR (clause
) == NULL_TREE
)
829 pp_string (pp
, "static:");
830 if (OMP_CLAUSE_GANG_STATIC_EXPR (clause
)
831 == integer_minus_one_node
)
832 pp_character (pp
, '*');
834 dump_generic_node (pp
, OMP_CLAUSE_GANG_STATIC_EXPR (clause
),
837 if (OMP_CLAUSE_GANG_EXPR (clause
) != NULL_TREE
838 || OMP_CLAUSE_GANG_STATIC_EXPR (clause
) != NULL_TREE
)
842 case OMP_CLAUSE_ASYNC
:
843 pp_string (pp
, "async");
844 if (OMP_CLAUSE_ASYNC_EXPR (clause
))
846 pp_character(pp
, '(');
847 dump_generic_node (pp
, OMP_CLAUSE_ASYNC_EXPR (clause
),
849 pp_character(pp
, ')');
853 case OMP_CLAUSE_AUTO
:
855 pp_string (pp
, omp_clause_code_name
[OMP_CLAUSE_CODE (clause
)]);
858 case OMP_CLAUSE_WAIT
:
859 pp_string (pp
, "wait(");
860 dump_generic_node (pp
, OMP_CLAUSE_WAIT_EXPR (clause
),
862 pp_character(pp
, ')');
865 case OMP_CLAUSE_WORKER
:
866 pp_string (pp
, "worker");
867 if (OMP_CLAUSE_WORKER_EXPR (clause
) != NULL_TREE
)
870 dump_generic_node (pp
, OMP_CLAUSE_WORKER_EXPR (clause
),
876 case OMP_CLAUSE_VECTOR
:
877 pp_string (pp
, "vector");
878 if (OMP_CLAUSE_VECTOR_EXPR (clause
) != NULL_TREE
)
881 dump_generic_node (pp
, OMP_CLAUSE_VECTOR_EXPR (clause
),
887 case OMP_CLAUSE_NUM_GANGS
:
888 pp_string (pp
, "num_gangs(");
889 dump_generic_node (pp
, OMP_CLAUSE_NUM_GANGS_EXPR (clause
),
891 pp_character (pp
, ')');
894 case OMP_CLAUSE_NUM_WORKERS
:
895 pp_string (pp
, "num_workers(");
896 dump_generic_node (pp
, OMP_CLAUSE_NUM_WORKERS_EXPR (clause
),
898 pp_character (pp
, ')');
901 case OMP_CLAUSE_VECTOR_LENGTH
:
902 pp_string (pp
, "vector_length(");
903 dump_generic_node (pp
, OMP_CLAUSE_VECTOR_LENGTH_EXPR (clause
),
905 pp_character (pp
, ')');
908 case OMP_CLAUSE_INBRANCH
:
909 pp_string (pp
, "inbranch");
911 case OMP_CLAUSE_NOTINBRANCH
:
912 pp_string (pp
, "notinbranch");
915 pp_string (pp
, "for");
917 case OMP_CLAUSE_PARALLEL
:
918 pp_string (pp
, "parallel");
920 case OMP_CLAUSE_SECTIONS
:
921 pp_string (pp
, "sections");
923 case OMP_CLAUSE_TASKGROUP
:
924 pp_string (pp
, "taskgroup");
926 case OMP_CLAUSE_NOGROUP
:
927 pp_string (pp
, "nogroup");
929 case OMP_CLAUSE_THREADS
:
930 pp_string (pp
, "threads");
932 case OMP_CLAUSE_SIMD
:
933 pp_string (pp
, "simd");
935 case OMP_CLAUSE_INDEPENDENT
:
936 pp_string (pp
, "independent");
938 case OMP_CLAUSE_TILE
:
939 pp_string (pp
, "tile(");
940 dump_generic_node (pp
, OMP_CLAUSE_TILE_LIST (clause
),
945 case OMP_CLAUSE__GRIDDIM_
:
946 pp_string (pp
, "_griddim_(");
947 pp_unsigned_wide_integer (pp
, OMP_CLAUSE__GRIDDIM__DIMENSION (clause
));
949 dump_generic_node (pp
, OMP_CLAUSE__GRIDDIM__SIZE (clause
), spc
, flags
,
952 dump_generic_node (pp
, OMP_CLAUSE__GRIDDIM__GROUP (clause
), spc
, flags
,
958 /* Should never happen. */
959 dump_generic_node (pp
, clause
, spc
, flags
, false);
965 /* Dump the list of OpenMP clauses. PP, SPC and FLAGS are as in
966 dump_generic_node. */
969 dump_omp_clauses (pretty_printer
*pp
, tree clause
, int spc
, int flags
)
977 dump_omp_clause (pp
, clause
, spc
, flags
);
978 clause
= OMP_CLAUSE_CHAIN (clause
);
986 /* Dump location LOC to PP. */
989 dump_location (pretty_printer
*pp
, location_t loc
)
991 expanded_location xloc
= expand_location (loc
);
993 pp_left_bracket (pp
);
996 pp_string (pp
, xloc
.file
);
999 pp_decimal_int (pp
, xloc
.line
);
1001 pp_decimal_int (pp
, xloc
.column
);
1002 pp_string (pp
, "] ");
1006 /* Dump lexical block BLOCK. PP, SPC and FLAGS are as in
1007 dump_generic_node. */
1010 dump_block_node (pretty_printer
*pp
, tree block
, int spc
, int flags
)
1014 pp_printf (pp
, "BLOCK #%d ", BLOCK_NUMBER (block
));
1016 if (flags
& TDF_ADDRESS
)
1017 pp_printf (pp
, "[%p] ", (void *) block
);
1019 if (BLOCK_ABSTRACT (block
))
1020 pp_string (pp
, "[abstract] ");
1022 if (TREE_ASM_WRITTEN (block
))
1023 pp_string (pp
, "[written] ");
1025 if (flags
& TDF_SLIM
)
1028 if (BLOCK_SOURCE_LOCATION (block
))
1029 dump_location (pp
, BLOCK_SOURCE_LOCATION (block
));
1031 newline_and_indent (pp
, spc
+ 2);
1033 if (BLOCK_SUPERCONTEXT (block
))
1035 pp_string (pp
, "SUPERCONTEXT: ");
1036 dump_generic_node (pp
, BLOCK_SUPERCONTEXT (block
), 0,
1037 flags
| TDF_SLIM
, false);
1038 newline_and_indent (pp
, spc
+ 2);
1041 if (BLOCK_SUBBLOCKS (block
))
1043 pp_string (pp
, "SUBBLOCKS: ");
1044 for (t
= BLOCK_SUBBLOCKS (block
); t
; t
= BLOCK_CHAIN (t
))
1046 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
1049 newline_and_indent (pp
, spc
+ 2);
1052 if (BLOCK_CHAIN (block
))
1054 pp_string (pp
, "SIBLINGS: ");
1055 for (t
= BLOCK_CHAIN (block
); t
; t
= BLOCK_CHAIN (t
))
1057 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
1060 newline_and_indent (pp
, spc
+ 2);
1063 if (BLOCK_VARS (block
))
1065 pp_string (pp
, "VARS: ");
1066 for (t
= BLOCK_VARS (block
); t
; t
= TREE_CHAIN (t
))
1068 dump_generic_node (pp
, t
, 0, flags
, false);
1071 newline_and_indent (pp
, spc
+ 2);
1074 if (vec_safe_length (BLOCK_NONLOCALIZED_VARS (block
)) > 0)
1077 vec
<tree
, va_gc
> *nlv
= BLOCK_NONLOCALIZED_VARS (block
);
1079 pp_string (pp
, "NONLOCALIZED_VARS: ");
1080 FOR_EACH_VEC_ELT (*nlv
, i
, t
)
1082 dump_generic_node (pp
, t
, 0, flags
, false);
1085 newline_and_indent (pp
, spc
+ 2);
1088 if (BLOCK_ABSTRACT_ORIGIN (block
))
1090 pp_string (pp
, "ABSTRACT_ORIGIN: ");
1091 dump_generic_node (pp
, BLOCK_ABSTRACT_ORIGIN (block
), 0,
1092 flags
| TDF_SLIM
, false);
1093 newline_and_indent (pp
, spc
+ 2);
1096 if (BLOCK_FRAGMENT_ORIGIN (block
))
1098 pp_string (pp
, "FRAGMENT_ORIGIN: ");
1099 dump_generic_node (pp
, BLOCK_FRAGMENT_ORIGIN (block
), 0,
1100 flags
| TDF_SLIM
, false);
1101 newline_and_indent (pp
, spc
+ 2);
1104 if (BLOCK_FRAGMENT_CHAIN (block
))
1106 pp_string (pp
, "FRAGMENT_CHAIN: ");
1107 for (t
= BLOCK_FRAGMENT_CHAIN (block
); t
; t
= BLOCK_FRAGMENT_CHAIN (t
))
1109 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
1112 newline_and_indent (pp
, spc
+ 2);
1117 /* Dump the node NODE on the pretty_printer PP, SPC spaces of
1118 indent. FLAGS specifies details to show in the dump (see TDF_* in
1119 dumpfile.h). If IS_STMT is true, the object printed is considered
1120 to be a statement and it is terminated by ';' if appropriate. */
1123 dump_generic_node (pretty_printer
*pp
, tree node
, int spc
, int flags
,
1130 enum tree_code code
;
1132 if (node
== NULL_TREE
)
1135 is_expr
= EXPR_P (node
);
1137 if (is_stmt
&& (flags
& TDF_STMTADDR
))
1138 pp_printf (pp
, "<&%p> ", (void *)node
);
1140 if ((flags
& TDF_LINENO
) && EXPR_HAS_LOCATION (node
))
1141 dump_location (pp
, EXPR_LOCATION (node
));
1143 code
= TREE_CODE (node
);
1147 pp_string (pp
, "<<< error >>>");
1150 case IDENTIFIER_NODE
:
1151 pp_tree_identifier (pp
, node
);
1155 while (node
&& node
!= error_mark_node
)
1157 if (TREE_PURPOSE (node
))
1159 dump_generic_node (pp
, TREE_PURPOSE (node
), spc
, flags
, false);
1162 dump_generic_node (pp
, TREE_VALUE (node
), spc
, flags
, false);
1163 node
= TREE_CHAIN (node
);
1164 if (node
&& TREE_CODE (node
) == TREE_LIST
)
1173 dump_generic_node (pp
, BINFO_TYPE (node
), spc
, flags
, false);
1179 if (TREE_VEC_LENGTH (node
) > 0)
1181 size_t len
= TREE_VEC_LENGTH (node
);
1182 for (i
= 0; i
< len
- 1; i
++)
1184 dump_generic_node (pp
, TREE_VEC_ELT (node
, i
), spc
, flags
,
1189 dump_generic_node (pp
, TREE_VEC_ELT (node
, len
- 1), spc
,
1196 case POINTER_BOUNDS_TYPE
:
1199 case FIXED_POINT_TYPE
:
1205 unsigned int quals
= TYPE_QUALS (node
);
1206 enum tree_code_class tclass
;
1208 if (quals
& TYPE_QUAL_ATOMIC
)
1209 pp_string (pp
, "atomic ");
1210 if (quals
& TYPE_QUAL_CONST
)
1211 pp_string (pp
, "const ");
1212 else if (quals
& TYPE_QUAL_VOLATILE
)
1213 pp_string (pp
, "volatile ");
1214 else if (quals
& TYPE_QUAL_RESTRICT
)
1215 pp_string (pp
, "restrict ");
1217 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
1219 pp_string (pp
, "<address-space-");
1220 pp_decimal_int (pp
, TYPE_ADDR_SPACE (node
));
1221 pp_string (pp
, "> ");
1224 tclass
= TREE_CODE_CLASS (TREE_CODE (node
));
1226 if (tclass
== tcc_declaration
)
1228 if (DECL_NAME (node
))
1229 dump_decl_name (pp
, node
, flags
);
1231 pp_string (pp
, "<unnamed type decl>");
1233 else if (tclass
== tcc_type
)
1235 if (TYPE_NAME (node
))
1237 if (TREE_CODE (TYPE_NAME (node
)) == IDENTIFIER_NODE
)
1238 pp_tree_identifier (pp
, TYPE_NAME (node
));
1239 else if (TREE_CODE (TYPE_NAME (node
)) == TYPE_DECL
1240 && DECL_NAME (TYPE_NAME (node
)))
1241 dump_decl_name (pp
, TYPE_NAME (node
), flags
);
1243 pp_string (pp
, "<unnamed type>");
1245 else if (TREE_CODE (node
) == VECTOR_TYPE
)
1247 pp_string (pp
, "vector");
1249 pp_wide_integer (pp
, TYPE_VECTOR_SUBPARTS (node
));
1250 pp_string (pp
, ") ");
1251 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1253 else if (TREE_CODE (node
) == INTEGER_TYPE
)
1255 if (TYPE_PRECISION (node
) == CHAR_TYPE_SIZE
)
1256 pp_string (pp
, (TYPE_UNSIGNED (node
)
1259 else if (TYPE_PRECISION (node
) == SHORT_TYPE_SIZE
)
1260 pp_string (pp
, (TYPE_UNSIGNED (node
)
1263 else if (TYPE_PRECISION (node
) == INT_TYPE_SIZE
)
1264 pp_string (pp
, (TYPE_UNSIGNED (node
)
1267 else if (TYPE_PRECISION (node
) == LONG_TYPE_SIZE
)
1268 pp_string (pp
, (TYPE_UNSIGNED (node
)
1271 else if (TYPE_PRECISION (node
) == LONG_LONG_TYPE_SIZE
)
1272 pp_string (pp
, (TYPE_UNSIGNED (node
)
1273 ? "unsigned long long"
1274 : "signed long long"));
1275 else if (TYPE_PRECISION (node
) >= CHAR_TYPE_SIZE
1276 && exact_log2 (TYPE_PRECISION (node
)) != -1)
1278 pp_string (pp
, (TYPE_UNSIGNED (node
) ? "uint" : "int"));
1279 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1280 pp_string (pp
, "_t");
1284 pp_string (pp
, (TYPE_UNSIGNED (node
)
1285 ? "<unnamed-unsigned:"
1286 : "<unnamed-signed:"));
1287 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1291 else if (TREE_CODE (node
) == COMPLEX_TYPE
)
1293 pp_string (pp
, "__complex__ ");
1294 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1296 else if (TREE_CODE (node
) == REAL_TYPE
)
1298 pp_string (pp
, "<float:");
1299 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1302 else if (TREE_CODE (node
) == FIXED_POINT_TYPE
)
1304 pp_string (pp
, "<fixed-point-");
1305 pp_string (pp
, TYPE_SATURATING (node
) ? "sat:" : "nonsat:");
1306 pp_decimal_int (pp
, TYPE_PRECISION (node
));
1309 else if (TREE_CODE (node
) == VOID_TYPE
)
1310 pp_string (pp
, "void");
1312 pp_string (pp
, "<unnamed type>");
1318 case REFERENCE_TYPE
:
1319 str
= (TREE_CODE (node
) == POINTER_TYPE
? "*" : "&");
1321 if (TREE_TYPE (node
) == NULL
)
1323 pp_string (pp
, str
);
1324 pp_string (pp
, "<null type>");
1326 else if (TREE_CODE (TREE_TYPE (node
)) == FUNCTION_TYPE
)
1328 tree fnode
= TREE_TYPE (node
);
1330 dump_generic_node (pp
, TREE_TYPE (fnode
), spc
, flags
, false);
1333 pp_string (pp
, str
);
1334 if (TYPE_NAME (node
) && DECL_NAME (TYPE_NAME (node
)))
1335 dump_decl_name (pp
, TYPE_NAME (node
), flags
);
1336 else if (flags
& TDF_NOUID
)
1337 pp_printf (pp
, "<Txxxx>");
1339 pp_printf (pp
, "<T%x>", TYPE_UID (node
));
1341 pp_right_paren (pp
);
1342 dump_function_declaration (pp
, fnode
, spc
, flags
);
1346 unsigned int quals
= TYPE_QUALS (node
);
1348 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1350 pp_string (pp
, str
);
1352 if (quals
& TYPE_QUAL_CONST
)
1353 pp_string (pp
, " const");
1354 if (quals
& TYPE_QUAL_VOLATILE
)
1355 pp_string (pp
, " volatile");
1356 if (quals
& TYPE_QUAL_RESTRICT
)
1357 pp_string (pp
, " restrict");
1359 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
1361 pp_string (pp
, " <address-space-");
1362 pp_decimal_int (pp
, TYPE_ADDR_SPACE (node
));
1366 if (TYPE_REF_CAN_ALIAS_ALL (node
))
1367 pp_string (pp
, " {ref-all}");
1377 if (integer_zerop (TREE_OPERAND (node
, 1))
1378 /* Dump the types of INTEGER_CSTs explicitly, for we can't
1379 infer them and MEM_ATTR caching will share MEM_REFs
1380 with differently-typed op0s. */
1381 && TREE_CODE (TREE_OPERAND (node
, 0)) != INTEGER_CST
1382 /* Released SSA_NAMES have no TREE_TYPE. */
1383 && TREE_TYPE (TREE_OPERAND (node
, 0)) != NULL_TREE
1384 /* Same pointer types, but ignoring POINTER_TYPE vs.
1386 && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 0)))
1387 == TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 1))))
1388 && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (node
, 0)))
1389 == TYPE_MODE (TREE_TYPE (TREE_OPERAND (node
, 1))))
1390 && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node
, 0)))
1391 == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node
, 1))))
1392 /* Same value types ignoring qualifiers. */
1393 && (TYPE_MAIN_VARIANT (TREE_TYPE (node
))
1394 == TYPE_MAIN_VARIANT
1395 (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 1)))))
1396 && (!(flags
& TDF_ALIAS
)
1397 || MR_DEPENDENCE_CLIQUE (node
) == 0))
1399 if (TREE_CODE (TREE_OPERAND (node
, 0)) != ADDR_EXPR
)
1402 dump_generic_node (pp
, TREE_OPERAND (node
, 0),
1406 dump_generic_node (pp
,
1407 TREE_OPERAND (TREE_OPERAND (node
, 0), 0),
1414 pp_string (pp
, "MEM[");
1416 ptype
= TYPE_MAIN_VARIANT (TREE_TYPE (TREE_OPERAND (node
, 1)));
1417 dump_generic_node (pp
, ptype
,
1418 spc
, flags
| TDF_SLIM
, false);
1419 pp_right_paren (pp
);
1420 dump_generic_node (pp
, TREE_OPERAND (node
, 0),
1422 if (!integer_zerop (TREE_OPERAND (node
, 1)))
1424 pp_string (pp
, " + ");
1425 dump_generic_node (pp
, TREE_OPERAND (node
, 1),
1428 if ((flags
& TDF_ALIAS
)
1429 && MR_DEPENDENCE_CLIQUE (node
) != 0)
1431 pp_string (pp
, " clique ");
1432 pp_unsigned_wide_integer (pp
, MR_DEPENDENCE_CLIQUE (node
));
1433 pp_string (pp
, " base ");
1434 pp_unsigned_wide_integer (pp
, MR_DEPENDENCE_BASE (node
));
1436 pp_right_bracket (pp
);
1441 case TARGET_MEM_REF
:
1443 const char *sep
= "";
1446 pp_string (pp
, "MEM[");
1448 if (TREE_CODE (TMR_BASE (node
)) == ADDR_EXPR
)
1450 pp_string (pp
, sep
);
1452 pp_string (pp
, "symbol: ");
1453 dump_generic_node (pp
, TREE_OPERAND (TMR_BASE (node
), 0),
1458 pp_string (pp
, sep
);
1460 pp_string (pp
, "base: ");
1461 dump_generic_node (pp
, TMR_BASE (node
), spc
, flags
, false);
1463 tmp
= TMR_INDEX2 (node
);
1466 pp_string (pp
, sep
);
1468 pp_string (pp
, "base: ");
1469 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1471 tmp
= TMR_INDEX (node
);
1474 pp_string (pp
, sep
);
1476 pp_string (pp
, "index: ");
1477 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1479 tmp
= TMR_STEP (node
);
1482 pp_string (pp
, sep
);
1484 pp_string (pp
, "step: ");
1485 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1487 tmp
= TMR_OFFSET (node
);
1490 pp_string (pp
, sep
);
1492 pp_string (pp
, "offset: ");
1493 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1495 pp_right_bracket (pp
);
1503 /* Print the innermost component type. */
1504 for (tmp
= TREE_TYPE (node
); TREE_CODE (tmp
) == ARRAY_TYPE
;
1505 tmp
= TREE_TYPE (tmp
))
1507 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1509 /* Print the dimensions. */
1510 for (tmp
= node
; TREE_CODE (tmp
) == ARRAY_TYPE
; tmp
= TREE_TYPE (tmp
))
1511 dump_array_domain (pp
, TYPE_DOMAIN (tmp
), spc
, flags
);
1517 case QUAL_UNION_TYPE
:
1519 unsigned int quals
= TYPE_QUALS (node
);
1521 if (quals
& TYPE_QUAL_ATOMIC
)
1522 pp_string (pp
, "atomic ");
1523 if (quals
& TYPE_QUAL_CONST
)
1524 pp_string (pp
, "const ");
1525 if (quals
& TYPE_QUAL_VOLATILE
)
1526 pp_string (pp
, "volatile ");
1528 /* Print the name of the structure. */
1529 if (TREE_CODE (node
) == RECORD_TYPE
)
1530 pp_string (pp
, "struct ");
1531 else if (TREE_CODE (node
) == UNION_TYPE
)
1532 pp_string (pp
, "union ");
1534 if (TYPE_NAME (node
))
1535 dump_generic_node (pp
, TYPE_NAME (node
), spc
, flags
, false);
1536 else if (!(flags
& TDF_SLIM
))
1537 /* FIXME: If we eliminate the 'else' above and attempt
1538 to show the fields for named types, we may get stuck
1539 following a cycle of pointers to structs. The alleged
1540 self-reference check in print_struct_decl will not detect
1541 cycles involving more than one pointer or struct type. */
1542 print_struct_decl (pp
, node
, spc
, flags
);
1551 if (TREE_CODE (TREE_TYPE (node
)) == POINTER_TYPE
)
1553 /* In the case of a pointer, one may want to divide by the
1554 size of the pointed-to type. Unfortunately, this not
1555 straightforward. The C front-end maps expressions
1560 in such a way that the two INTEGER_CST nodes for "5" have
1561 different values but identical types. In the latter
1562 case, the 5 is multiplied by sizeof (int) in c-common.c
1563 (pointer_int_sum) to convert it to a byte address, and
1564 yet the type of the node is left unchanged. Argh. What
1565 is consistent though is that the number value corresponds
1566 to bytes (UNITS) offset.
1568 NB: Neither of the following divisors can be trivially
1569 used to recover the original literal:
1571 TREE_INT_CST_LOW (TYPE_SIZE_UNIT (TREE_TYPE (node)))
1572 TYPE_PRECISION (TREE_TYPE (TREE_TYPE (node))) */
1573 pp_wide_integer (pp
, TREE_INT_CST_LOW (node
));
1574 pp_string (pp
, "B"); /* pseudo-unit */
1576 else if (tree_fits_shwi_p (node
))
1577 pp_wide_integer (pp
, tree_to_shwi (node
));
1578 else if (tree_fits_uhwi_p (node
))
1579 pp_unsigned_wide_integer (pp
, tree_to_uhwi (node
));
1582 wide_int val
= node
;
1584 if (wi::neg_p (val
, TYPE_SIGN (TREE_TYPE (node
))))
1589 print_hex (val
, pp_buffer (pp
)->digit_buffer
);
1590 pp_string (pp
, pp_buffer (pp
)->digit_buffer
);
1592 if (TREE_OVERFLOW (node
))
1593 pp_string (pp
, "(OVF)");
1597 /* Code copied from print_node. */
1600 if (TREE_OVERFLOW (node
))
1601 pp_string (pp
, " overflow");
1603 d
= TREE_REAL_CST (node
);
1604 if (REAL_VALUE_ISINF (d
))
1605 pp_string (pp
, REAL_VALUE_NEGATIVE (d
) ? " -Inf" : " Inf");
1606 else if (REAL_VALUE_ISNAN (d
))
1607 pp_string (pp
, " Nan");
1611 real_to_decimal (string
, &d
, sizeof (string
), 0, 1);
1612 pp_string (pp
, string
);
1620 fixed_to_decimal (string
, TREE_FIXED_CST_PTR (node
), sizeof (string
));
1621 pp_string (pp
, string
);
1626 pp_string (pp
, "__complex__ (");
1627 dump_generic_node (pp
, TREE_REALPART (node
), spc
, flags
, false);
1628 pp_string (pp
, ", ");
1629 dump_generic_node (pp
, TREE_IMAGPART (node
), spc
, flags
, false);
1630 pp_right_paren (pp
);
1634 pp_string (pp
, "\"");
1635 pretty_print_string (pp
, TREE_STRING_POINTER (node
));
1636 pp_string (pp
, "\"");
1642 pp_string (pp
, "{ ");
1643 for (i
= 0; i
< VECTOR_CST_NELTS (node
); ++i
)
1646 pp_string (pp
, ", ");
1647 dump_generic_node (pp
, VECTOR_CST_ELT (node
, i
),
1650 pp_string (pp
, " }");
1656 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1658 if (TREE_CODE (node
) == METHOD_TYPE
)
1660 if (TYPE_METHOD_BASETYPE (node
))
1661 dump_decl_name (pp
, TYPE_NAME (TYPE_METHOD_BASETYPE (node
)),
1664 pp_string (pp
, "<null method basetype>");
1665 pp_colon_colon (pp
);
1667 if (TYPE_NAME (node
) && DECL_NAME (TYPE_NAME (node
)))
1668 dump_decl_name (pp
, TYPE_NAME (node
), flags
);
1669 else if (flags
& TDF_NOUID
)
1670 pp_printf (pp
, "<Txxxx>");
1672 pp_printf (pp
, "<T%x>", TYPE_UID (node
));
1673 dump_function_declaration (pp
, node
, spc
, flags
);
1678 dump_decl_name (pp
, node
, flags
);
1682 if (DECL_NAME (node
))
1683 dump_decl_name (pp
, node
, flags
);
1684 else if (LABEL_DECL_UID (node
) != -1)
1685 pp_printf (pp
, "<L%d>", (int) LABEL_DECL_UID (node
));
1688 if (flags
& TDF_NOUID
)
1689 pp_string (pp
, "<D.xxxx>");
1691 pp_printf (pp
, "<D.%u>", DECL_UID (node
));
1696 if (DECL_IS_BUILTIN (node
))
1698 /* Don't print the declaration of built-in types. */
1701 if (DECL_NAME (node
))
1702 dump_decl_name (pp
, node
, flags
);
1703 else if (TYPE_NAME (TREE_TYPE (node
)) != node
)
1705 if ((TREE_CODE (TREE_TYPE (node
)) == RECORD_TYPE
1706 || TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
)
1707 && TYPE_METHODS (TREE_TYPE (node
)))
1709 /* The type is a c++ class: all structures have at least
1711 pp_string (pp
, "class ");
1712 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1717 (TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
1718 ? "union" : "struct "));
1719 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1723 pp_string (pp
, "<anon>");
1729 case DEBUG_EXPR_DECL
:
1730 case NAMESPACE_DECL
:
1732 dump_decl_name (pp
, node
, flags
);
1736 pp_string (pp
, "<retval>");
1740 op0
= TREE_OPERAND (node
, 0);
1743 && (TREE_CODE (op0
) == INDIRECT_REF
1744 || (TREE_CODE (op0
) == MEM_REF
1745 && TREE_CODE (TREE_OPERAND (op0
, 0)) != ADDR_EXPR
1746 && integer_zerop (TREE_OPERAND (op0
, 1))
1747 /* Dump the types of INTEGER_CSTs explicitly, for we
1748 can't infer them and MEM_ATTR caching will share
1749 MEM_REFs with differently-typed op0s. */
1750 && TREE_CODE (TREE_OPERAND (op0
, 0)) != INTEGER_CST
1751 /* Released SSA_NAMES have no TREE_TYPE. */
1752 && TREE_TYPE (TREE_OPERAND (op0
, 0)) != NULL_TREE
1753 /* Same pointer types, but ignoring POINTER_TYPE vs.
1755 && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 0)))
1756 == TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 1))))
1757 && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0
, 0)))
1758 == TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0
, 1))))
1759 && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0
, 0)))
1760 == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0
, 1))))
1761 /* Same value types ignoring qualifiers. */
1762 && (TYPE_MAIN_VARIANT (TREE_TYPE (op0
))
1763 == TYPE_MAIN_VARIANT
1764 (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 1)))))
1765 && MR_DEPENDENCE_CLIQUE (op0
) == 0)))
1767 op0
= TREE_OPERAND (op0
, 0);
1770 if (op_prio (op0
) < op_prio (node
))
1772 dump_generic_node (pp
, op0
, spc
, flags
, false);
1773 if (op_prio (op0
) < op_prio (node
))
1774 pp_right_paren (pp
);
1775 pp_string (pp
, str
);
1776 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1777 op0
= component_ref_field_offset (node
);
1778 if (op0
&& TREE_CODE (op0
) != INTEGER_CST
)
1780 pp_string (pp
, "{off: ");
1781 dump_generic_node (pp
, op0
, spc
, flags
, false);
1782 pp_right_brace (pp
);
1787 pp_string (pp
, "BIT_FIELD_REF <");
1788 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1789 pp_string (pp
, ", ");
1790 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1791 pp_string (pp
, ", ");
1792 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
1797 case ARRAY_RANGE_REF
:
1798 op0
= TREE_OPERAND (node
, 0);
1799 if (op_prio (op0
) < op_prio (node
))
1801 dump_generic_node (pp
, op0
, spc
, flags
, false);
1802 if (op_prio (op0
) < op_prio (node
))
1803 pp_right_paren (pp
);
1804 pp_left_bracket (pp
);
1805 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1806 if (TREE_CODE (node
) == ARRAY_RANGE_REF
)
1807 pp_string (pp
, " ...");
1808 pp_right_bracket (pp
);
1810 op0
= array_ref_low_bound (node
);
1811 op1
= array_ref_element_size (node
);
1813 if (!integer_zerop (op0
)
1814 || TREE_OPERAND (node
, 2)
1815 || TREE_OPERAND (node
, 3))
1817 pp_string (pp
, "{lb: ");
1818 dump_generic_node (pp
, op0
, spc
, flags
, false);
1819 pp_string (pp
, " sz: ");
1820 dump_generic_node (pp
, op1
, spc
, flags
, false);
1821 pp_right_brace (pp
);
1827 unsigned HOST_WIDE_INT ix
;
1829 bool is_struct_init
= false;
1830 bool is_array_init
= false;
1833 if (TREE_CLOBBER_P (node
))
1834 pp_string (pp
, "CLOBBER");
1835 else if (TREE_CODE (TREE_TYPE (node
)) == RECORD_TYPE
1836 || TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
)
1837 is_struct_init
= true;
1838 else if (TREE_CODE (TREE_TYPE (node
)) == ARRAY_TYPE
1839 && TYPE_DOMAIN (TREE_TYPE (node
))
1840 && TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
)))
1841 && TREE_CODE (TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
))))
1844 tree minv
= TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
)));
1845 is_array_init
= true;
1846 curidx
= wi::to_widest (minv
);
1848 FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (node
), ix
, field
, val
)
1855 dump_generic_node (pp
, field
, spc
, flags
, false);
1858 else if (is_array_init
1859 && (TREE_CODE (field
) != INTEGER_CST
1860 || curidx
!= wi::to_widest (field
)))
1862 pp_left_bracket (pp
);
1863 if (TREE_CODE (field
) == RANGE_EXPR
)
1865 dump_generic_node (pp
, TREE_OPERAND (field
, 0), spc
,
1867 pp_string (pp
, " ... ");
1868 dump_generic_node (pp
, TREE_OPERAND (field
, 1), spc
,
1870 if (TREE_CODE (TREE_OPERAND (field
, 1)) == INTEGER_CST
)
1871 curidx
= wi::to_widest (TREE_OPERAND (field
, 1));
1874 dump_generic_node (pp
, field
, spc
, flags
, false);
1875 if (TREE_CODE (field
) == INTEGER_CST
)
1876 curidx
= wi::to_widest (field
);
1877 pp_string (pp
, "]=");
1882 if (val
&& TREE_CODE (val
) == ADDR_EXPR
)
1883 if (TREE_CODE (TREE_OPERAND (val
, 0)) == FUNCTION_DECL
)
1884 val
= TREE_OPERAND (val
, 0);
1885 if (val
&& TREE_CODE (val
) == FUNCTION_DECL
)
1886 dump_decl_name (pp
, val
, flags
);
1888 dump_generic_node (pp
, val
, spc
, flags
, false);
1889 if (ix
!= vec_safe_length (CONSTRUCTOR_ELTS (node
)) - 1)
1895 pp_right_brace (pp
);
1902 if (flags
& TDF_SLIM
)
1904 pp_string (pp
, "<COMPOUND_EXPR>");
1908 dump_generic_node (pp
, TREE_OPERAND (node
, 0),
1909 spc
, flags
, !(flags
& TDF_SLIM
));
1910 if (flags
& TDF_SLIM
)
1911 newline_and_indent (pp
, spc
);
1918 for (tp
= &TREE_OPERAND (node
, 1);
1919 TREE_CODE (*tp
) == COMPOUND_EXPR
;
1920 tp
= &TREE_OPERAND (*tp
, 1))
1922 dump_generic_node (pp
, TREE_OPERAND (*tp
, 0),
1923 spc
, flags
, !(flags
& TDF_SLIM
));
1924 if (flags
& TDF_SLIM
)
1925 newline_and_indent (pp
, spc
);
1933 dump_generic_node (pp
, *tp
, spc
, flags
, !(flags
& TDF_SLIM
));
1937 case STATEMENT_LIST
:
1939 tree_stmt_iterator si
;
1942 if (flags
& TDF_SLIM
)
1944 pp_string (pp
, "<STATEMENT_LIST>");
1948 for (si
= tsi_start (node
); !tsi_end_p (si
); tsi_next (&si
))
1951 newline_and_indent (pp
, spc
);
1954 dump_generic_node (pp
, tsi_stmt (si
), spc
, flags
, true);
1961 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
,
1966 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
,
1971 pp_string (pp
, "TARGET_EXPR <");
1972 dump_generic_node (pp
, TARGET_EXPR_SLOT (node
), spc
, flags
, false);
1975 dump_generic_node (pp
, TARGET_EXPR_INITIAL (node
), spc
, flags
, false);
1980 print_declaration (pp
, DECL_EXPR_DECL (node
), spc
, flags
);
1985 if (TREE_TYPE (node
) == NULL
|| TREE_TYPE (node
) == void_type_node
)
1987 pp_string (pp
, "if (");
1988 dump_generic_node (pp
, COND_EXPR_COND (node
), spc
, flags
, false);
1989 pp_right_paren (pp
);
1990 /* The lowered cond_exprs should always be printed in full. */
1991 if (COND_EXPR_THEN (node
)
1992 && (IS_EMPTY_STMT (COND_EXPR_THEN (node
))
1993 || TREE_CODE (COND_EXPR_THEN (node
)) == GOTO_EXPR
)
1994 && COND_EXPR_ELSE (node
)
1995 && (IS_EMPTY_STMT (COND_EXPR_ELSE (node
))
1996 || TREE_CODE (COND_EXPR_ELSE (node
)) == GOTO_EXPR
))
1999 dump_generic_node (pp
, COND_EXPR_THEN (node
),
2001 if (!IS_EMPTY_STMT (COND_EXPR_ELSE (node
)))
2003 pp_string (pp
, " else ");
2004 dump_generic_node (pp
, COND_EXPR_ELSE (node
),
2008 else if (!(flags
& TDF_SLIM
))
2010 /* Output COND_EXPR_THEN. */
2011 if (COND_EXPR_THEN (node
))
2013 newline_and_indent (pp
, spc
+2);
2015 newline_and_indent (pp
, spc
+4);
2016 dump_generic_node (pp
, COND_EXPR_THEN (node
), spc
+4,
2018 newline_and_indent (pp
, spc
+2);
2019 pp_right_brace (pp
);
2022 /* Output COND_EXPR_ELSE. */
2023 if (COND_EXPR_ELSE (node
)
2024 && !IS_EMPTY_STMT (COND_EXPR_ELSE (node
)))
2026 newline_and_indent (pp
, spc
);
2027 pp_string (pp
, "else");
2028 newline_and_indent (pp
, spc
+2);
2030 newline_and_indent (pp
, spc
+4);
2031 dump_generic_node (pp
, COND_EXPR_ELSE (node
), spc
+4,
2033 newline_and_indent (pp
, spc
+2);
2034 pp_right_brace (pp
);
2041 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2045 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2049 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2055 if (!(flags
& TDF_SLIM
))
2057 if (BIND_EXPR_VARS (node
))
2061 for (op0
= BIND_EXPR_VARS (node
); op0
; op0
= DECL_CHAIN (op0
))
2063 print_declaration (pp
, op0
, spc
+2, flags
);
2068 newline_and_indent (pp
, spc
+2);
2069 dump_generic_node (pp
, BIND_EXPR_BODY (node
), spc
+2, flags
, true);
2070 newline_and_indent (pp
, spc
);
2071 pp_right_brace (pp
);
2077 if (CALL_EXPR_FN (node
) != NULL_TREE
)
2078 print_call_name (pp
, CALL_EXPR_FN (node
), flags
);
2080 pp_string (pp
, internal_fn_name (CALL_EXPR_IFN (node
)));
2082 /* Print parameters. */
2087 call_expr_arg_iterator iter
;
2088 FOR_EACH_CALL_EXPR_ARG (arg
, iter
, node
)
2090 dump_generic_node (pp
, arg
, spc
, flags
, false);
2091 if (more_call_expr_args_p (&iter
))
2098 if (CALL_EXPR_VA_ARG_PACK (node
))
2100 if (call_expr_nargs (node
) > 0)
2105 pp_string (pp
, "__builtin_va_arg_pack ()");
2107 pp_right_paren (pp
);
2109 op1
= CALL_EXPR_STATIC_CHAIN (node
);
2112 pp_string (pp
, " [static-chain: ");
2113 dump_generic_node (pp
, op1
, spc
, flags
, false);
2114 pp_right_bracket (pp
);
2117 if (CALL_EXPR_RETURN_SLOT_OPT (node
))
2118 pp_string (pp
, " [return slot optimization]");
2119 if (CALL_EXPR_TAILCALL (node
))
2120 pp_string (pp
, " [tail call]");
2123 case WITH_CLEANUP_EXPR
:
2127 case CLEANUP_POINT_EXPR
:
2128 pp_string (pp
, "<<cleanup_point ");
2129 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2130 pp_string (pp
, ">>");
2133 case PLACEHOLDER_EXPR
:
2134 pp_string (pp
, "<PLACEHOLDER_EXPR ");
2135 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2139 /* Binary arithmetic and logic expressions. */
2140 case WIDEN_SUM_EXPR
:
2141 case WIDEN_MULT_EXPR
:
2143 case MULT_HIGHPART_EXPR
:
2145 case POINTER_PLUS_EXPR
:
2147 case TRUNC_DIV_EXPR
:
2149 case FLOOR_DIV_EXPR
:
2150 case ROUND_DIV_EXPR
:
2151 case TRUNC_MOD_EXPR
:
2153 case FLOOR_MOD_EXPR
:
2154 case ROUND_MOD_EXPR
:
2156 case EXACT_DIV_EXPR
:
2161 case WIDEN_LSHIFT_EXPR
:
2165 case TRUTH_ANDIF_EXPR
:
2166 case TRUTH_ORIF_EXPR
:
2167 case TRUTH_AND_EXPR
:
2169 case TRUTH_XOR_EXPR
:
2183 case UNORDERED_EXPR
:
2185 const char *op
= op_symbol (node
);
2186 op0
= TREE_OPERAND (node
, 0);
2187 op1
= TREE_OPERAND (node
, 1);
2189 /* When the operands are expressions with less priority,
2190 keep semantics of the tree representation. */
2191 if (op_prio (op0
) <= op_prio (node
))
2194 dump_generic_node (pp
, op0
, spc
, flags
, false);
2195 pp_right_paren (pp
);
2198 dump_generic_node (pp
, op0
, spc
, flags
, false);
2204 /* When the operands are expressions with less priority,
2205 keep semantics of the tree representation. */
2206 if (op_prio (op1
) <= op_prio (node
))
2209 dump_generic_node (pp
, op1
, spc
, flags
, false);
2210 pp_right_paren (pp
);
2213 dump_generic_node (pp
, op1
, spc
, flags
, false);
2217 /* Unary arithmetic and logic expressions. */
2220 case TRUTH_NOT_EXPR
:
2222 case PREDECREMENT_EXPR
:
2223 case PREINCREMENT_EXPR
:
2225 if (TREE_CODE (node
) == ADDR_EXPR
2226 && (TREE_CODE (TREE_OPERAND (node
, 0)) == STRING_CST
2227 || TREE_CODE (TREE_OPERAND (node
, 0)) == FUNCTION_DECL
))
2228 ; /* Do not output '&' for strings and function pointers. */
2230 pp_string (pp
, op_symbol (node
));
2232 if (op_prio (TREE_OPERAND (node
, 0)) < op_prio (node
))
2235 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2236 pp_right_paren (pp
);
2239 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2242 case POSTDECREMENT_EXPR
:
2243 case POSTINCREMENT_EXPR
:
2244 if (op_prio (TREE_OPERAND (node
, 0)) < op_prio (node
))
2247 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2248 pp_right_paren (pp
);
2251 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2252 pp_string (pp
, op_symbol (node
));
2256 pp_string (pp
, "MIN_EXPR <");
2257 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2258 pp_string (pp
, ", ");
2259 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2264 pp_string (pp
, "MAX_EXPR <");
2265 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2266 pp_string (pp
, ", ");
2267 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2272 pp_string (pp
, "ABS_EXPR <");
2273 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2281 case ADDR_SPACE_CONVERT_EXPR
:
2282 case FIXED_CONVERT_EXPR
:
2283 case FIX_TRUNC_EXPR
:
2286 type
= TREE_TYPE (node
);
2287 op0
= TREE_OPERAND (node
, 0);
2288 if (type
!= TREE_TYPE (op0
))
2291 dump_generic_node (pp
, type
, spc
, flags
, false);
2292 pp_string (pp
, ") ");
2294 if (op_prio (op0
) < op_prio (node
))
2296 dump_generic_node (pp
, op0
, spc
, flags
, false);
2297 if (op_prio (op0
) < op_prio (node
))
2298 pp_right_paren (pp
);
2301 case VIEW_CONVERT_EXPR
:
2302 pp_string (pp
, "VIEW_CONVERT_EXPR<");
2303 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2304 pp_string (pp
, ">(");
2305 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2306 pp_right_paren (pp
);
2310 pp_string (pp
, "((");
2311 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2312 pp_string (pp
, "))");
2315 case NON_LVALUE_EXPR
:
2316 pp_string (pp
, "NON_LVALUE_EXPR <");
2317 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2322 pp_string (pp
, "SAVE_EXPR <");
2323 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2328 pp_string (pp
, "COMPLEX_EXPR <");
2329 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2330 pp_string (pp
, ", ");
2331 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2336 pp_string (pp
, "CONJ_EXPR <");
2337 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2342 pp_string (pp
, "REALPART_EXPR <");
2343 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2348 pp_string (pp
, "IMAGPART_EXPR <");
2349 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2354 pp_string (pp
, "VA_ARG_EXPR <");
2355 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2359 case TRY_FINALLY_EXPR
:
2360 case TRY_CATCH_EXPR
:
2361 pp_string (pp
, "try");
2362 newline_and_indent (pp
, spc
+2);
2364 newline_and_indent (pp
, spc
+4);
2365 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
+4, flags
, true);
2366 newline_and_indent (pp
, spc
+2);
2367 pp_right_brace (pp
);
2368 newline_and_indent (pp
, spc
);
2370 (TREE_CODE (node
) == TRY_CATCH_EXPR
) ? "catch" : "finally");
2371 newline_and_indent (pp
, spc
+2);
2373 newline_and_indent (pp
, spc
+4);
2374 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
+4, flags
, true);
2375 newline_and_indent (pp
, spc
+2);
2376 pp_right_brace (pp
);
2381 pp_string (pp
, "catch (");
2382 dump_generic_node (pp
, CATCH_TYPES (node
), spc
+2, flags
, false);
2383 pp_right_paren (pp
);
2384 newline_and_indent (pp
, spc
+2);
2386 newline_and_indent (pp
, spc
+4);
2387 dump_generic_node (pp
, CATCH_BODY (node
), spc
+4, flags
, true);
2388 newline_and_indent (pp
, spc
+2);
2389 pp_right_brace (pp
);
2393 case EH_FILTER_EXPR
:
2394 pp_string (pp
, "<<<eh_filter (");
2395 dump_generic_node (pp
, EH_FILTER_TYPES (node
), spc
+2, flags
, false);
2396 pp_string (pp
, ")>>>");
2397 newline_and_indent (pp
, spc
+2);
2399 newline_and_indent (pp
, spc
+4);
2400 dump_generic_node (pp
, EH_FILTER_FAILURE (node
), spc
+4, flags
, true);
2401 newline_and_indent (pp
, spc
+2);
2402 pp_right_brace (pp
);
2407 op0
= TREE_OPERAND (node
, 0);
2408 /* If this is for break or continue, don't bother printing it. */
2409 if (DECL_NAME (op0
))
2411 const char *name
= IDENTIFIER_POINTER (DECL_NAME (op0
));
2412 if (strcmp (name
, "break") == 0
2413 || strcmp (name
, "continue") == 0)
2416 dump_generic_node (pp
, op0
, spc
, flags
, false);
2418 if (DECL_NONLOCAL (op0
))
2419 pp_string (pp
, " [non-local]");
2423 pp_string (pp
, "while (1)");
2424 if (!(flags
& TDF_SLIM
))
2426 newline_and_indent (pp
, spc
+2);
2428 newline_and_indent (pp
, spc
+4);
2429 dump_generic_node (pp
, LOOP_EXPR_BODY (node
), spc
+4, flags
, true);
2430 newline_and_indent (pp
, spc
+2);
2431 pp_right_brace (pp
);
2437 pp_string (pp
, "// predicted ");
2438 if (PREDICT_EXPR_OUTCOME (node
))
2439 pp_string (pp
, "likely by ");
2441 pp_string (pp
, "unlikely by ");
2442 pp_string (pp
, predictor_name (PREDICT_EXPR_PREDICTOR (node
)));
2443 pp_string (pp
, " predictor.");
2447 pp_string (pp
, "ANNOTATE_EXPR <");
2448 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2449 switch ((enum annot_expr_kind
) TREE_INT_CST_LOW (TREE_OPERAND (node
, 1)))
2451 case annot_expr_ivdep_kind
:
2452 pp_string (pp
, ", ivdep");
2454 case annot_expr_no_vector_kind
:
2455 pp_string (pp
, ", no-vector");
2457 case annot_expr_vector_kind
:
2458 pp_string (pp
, ", vector");
2467 pp_string (pp
, "return");
2468 op0
= TREE_OPERAND (node
, 0);
2472 if (TREE_CODE (op0
) == MODIFY_EXPR
)
2473 dump_generic_node (pp
, TREE_OPERAND (op0
, 1),
2476 dump_generic_node (pp
, op0
, spc
, flags
, false);
2481 pp_string (pp
, "if (");
2482 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2483 pp_string (pp
, ") break");
2487 pp_string (pp
, "switch (");
2488 dump_generic_node (pp
, SWITCH_COND (node
), spc
, flags
, false);
2489 pp_right_paren (pp
);
2490 if (!(flags
& TDF_SLIM
))
2492 newline_and_indent (pp
, spc
+2);
2494 if (SWITCH_BODY (node
))
2496 newline_and_indent (pp
, spc
+4);
2497 dump_generic_node (pp
, SWITCH_BODY (node
), spc
+4, flags
,
2502 tree vec
= SWITCH_LABELS (node
);
2503 size_t i
, n
= TREE_VEC_LENGTH (vec
);
2504 for (i
= 0; i
< n
; ++i
)
2506 tree elt
= TREE_VEC_ELT (vec
, i
);
2507 newline_and_indent (pp
, spc
+4);
2510 dump_generic_node (pp
, elt
, spc
+4, flags
, false);
2511 pp_string (pp
, " goto ");
2512 dump_generic_node (pp
, CASE_LABEL (elt
), spc
+4,
2517 pp_string (pp
, "case ???: goto ???;");
2520 newline_and_indent (pp
, spc
+2);
2521 pp_right_brace (pp
);
2527 op0
= GOTO_DESTINATION (node
);
2528 if (TREE_CODE (op0
) != SSA_NAME
&& DECL_P (op0
) && DECL_NAME (op0
))
2530 const char *name
= IDENTIFIER_POINTER (DECL_NAME (op0
));
2531 if (strcmp (name
, "break") == 0
2532 || strcmp (name
, "continue") == 0)
2534 pp_string (pp
, name
);
2538 pp_string (pp
, "goto ");
2539 dump_generic_node (pp
, op0
, spc
, flags
, false);
2543 pp_string (pp
, "__asm__");
2544 if (ASM_VOLATILE_P (node
))
2545 pp_string (pp
, " __volatile__");
2547 dump_generic_node (pp
, ASM_STRING (node
), spc
, flags
, false);
2549 dump_generic_node (pp
, ASM_OUTPUTS (node
), spc
, flags
, false);
2551 dump_generic_node (pp
, ASM_INPUTS (node
), spc
, flags
, false);
2552 if (ASM_CLOBBERS (node
))
2555 dump_generic_node (pp
, ASM_CLOBBERS (node
), spc
, flags
, false);
2557 pp_right_paren (pp
);
2560 case CASE_LABEL_EXPR
:
2561 if (CASE_LOW (node
) && CASE_HIGH (node
))
2563 pp_string (pp
, "case ");
2564 dump_generic_node (pp
, CASE_LOW (node
), spc
, flags
, false);
2565 pp_string (pp
, " ... ");
2566 dump_generic_node (pp
, CASE_HIGH (node
), spc
, flags
, false);
2568 else if (CASE_LOW (node
))
2570 pp_string (pp
, "case ");
2571 dump_generic_node (pp
, CASE_LOW (node
), spc
, flags
, false);
2574 pp_string (pp
, "default");
2579 pp_string (pp
, "OBJ_TYPE_REF(");
2580 dump_generic_node (pp
, OBJ_TYPE_REF_EXPR (node
), spc
, flags
, false);
2582 if (!(flags
& TDF_SLIM
) && virtual_method_call_p (node
))
2584 pp_string (pp
, "(");
2585 dump_generic_node (pp
, obj_type_ref_class (node
), spc
, flags
, false);
2586 pp_string (pp
, ")");
2588 dump_generic_node (pp
, OBJ_TYPE_REF_OBJECT (node
), spc
, flags
, false);
2590 dump_generic_node (pp
, OBJ_TYPE_REF_TOKEN (node
), spc
, flags
, false);
2591 pp_right_paren (pp
);
2595 if (SSA_NAME_IDENTIFIER (node
))
2596 dump_generic_node (pp
, SSA_NAME_IDENTIFIER (node
),
2599 pp_decimal_int (pp
, SSA_NAME_VERSION (node
));
2600 if (SSA_NAME_IS_DEFAULT_DEF (node
))
2601 pp_string (pp
, "(D)");
2602 if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (node
))
2603 pp_string (pp
, "(ab)");
2606 case WITH_SIZE_EXPR
:
2607 pp_string (pp
, "WITH_SIZE_EXPR <");
2608 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2609 pp_string (pp
, ", ");
2610 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2615 pp_string (pp
, "ASSERT_EXPR <");
2616 dump_generic_node (pp
, ASSERT_EXPR_VAR (node
), spc
, flags
, false);
2617 pp_string (pp
, ", ");
2618 dump_generic_node (pp
, ASSERT_EXPR_COND (node
), spc
, flags
, false);
2623 pp_string (pp
, "scev_known");
2626 case SCEV_NOT_KNOWN
:
2627 pp_string (pp
, "scev_not_known");
2630 case POLYNOMIAL_CHREC
:
2632 dump_generic_node (pp
, CHREC_LEFT (node
), spc
, flags
, false);
2633 pp_string (pp
, ", +, ");
2634 dump_generic_node (pp
, CHREC_RIGHT (node
), spc
, flags
, false);
2635 pp_string (pp
, "}_");
2636 dump_generic_node (pp
, CHREC_VAR (node
), spc
, flags
, false);
2640 case REALIGN_LOAD_EXPR
:
2641 pp_string (pp
, "REALIGN_LOAD <");
2642 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2643 pp_string (pp
, ", ");
2644 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2645 pp_string (pp
, ", ");
2646 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2651 pp_string (pp
, " VEC_COND_EXPR < ");
2652 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2653 pp_string (pp
, " , ");
2654 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2655 pp_string (pp
, " , ");
2656 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2657 pp_string (pp
, " > ");
2661 pp_string (pp
, " VEC_PERM_EXPR < ");
2662 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2663 pp_string (pp
, " , ");
2664 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2665 pp_string (pp
, " , ");
2666 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2667 pp_string (pp
, " > ");
2671 pp_string (pp
, " DOT_PROD_EXPR < ");
2672 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2673 pp_string (pp
, ", ");
2674 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2675 pp_string (pp
, ", ");
2676 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2677 pp_string (pp
, " > ");
2680 case WIDEN_MULT_PLUS_EXPR
:
2681 pp_string (pp
, " WIDEN_MULT_PLUS_EXPR < ");
2682 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2683 pp_string (pp
, ", ");
2684 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2685 pp_string (pp
, ", ");
2686 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2687 pp_string (pp
, " > ");
2690 case WIDEN_MULT_MINUS_EXPR
:
2691 pp_string (pp
, " WIDEN_MULT_MINUS_EXPR < ");
2692 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2693 pp_string (pp
, ", ");
2694 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2695 pp_string (pp
, ", ");
2696 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2697 pp_string (pp
, " > ");
2701 pp_string (pp
, " FMA_EXPR < ");
2702 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2703 pp_string (pp
, ", ");
2704 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2705 pp_string (pp
, ", ");
2706 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2707 pp_string (pp
, " > ");
2711 pp_string (pp
, "#pragma acc parallel");
2712 goto dump_omp_clauses_body
;
2715 pp_string (pp
, "#pragma acc kernels");
2716 goto dump_omp_clauses_body
;
2719 pp_string (pp
, "#pragma acc data");
2720 dump_omp_clauses (pp
, OACC_DATA_CLAUSES (node
), spc
, flags
);
2723 case OACC_HOST_DATA
:
2724 pp_string (pp
, "#pragma acc host_data");
2725 dump_omp_clauses (pp
, OACC_HOST_DATA_CLAUSES (node
), spc
, flags
);
2729 pp_string (pp
, "#pragma acc declare");
2730 dump_omp_clauses (pp
, OACC_DECLARE_CLAUSES (node
), spc
, flags
);
2734 pp_string (pp
, "#pragma acc update");
2735 dump_omp_clauses (pp
, OACC_UPDATE_CLAUSES (node
), spc
, flags
);
2738 case OACC_ENTER_DATA
:
2739 pp_string (pp
, "#pragma acc enter data");
2740 dump_omp_clauses (pp
, OACC_ENTER_DATA_CLAUSES (node
), spc
, flags
);
2743 case OACC_EXIT_DATA
:
2744 pp_string (pp
, "#pragma acc exit data");
2745 dump_omp_clauses (pp
, OACC_EXIT_DATA_CLAUSES (node
), spc
, flags
);
2749 pp_string (pp
, "#pragma acc cache");
2750 dump_omp_clauses (pp
, OACC_CACHE_CLAUSES (node
), spc
, flags
);
2754 pp_string (pp
, "#pragma omp parallel");
2755 dump_omp_clauses (pp
, OMP_PARALLEL_CLAUSES (node
), spc
, flags
);
2758 dump_omp_clauses_body
:
2759 dump_omp_clauses (pp
, OMP_CLAUSES (node
), spc
, flags
);
2763 if (!(flags
& TDF_SLIM
) && OMP_BODY (node
))
2765 newline_and_indent (pp
, spc
+ 2);
2767 newline_and_indent (pp
, spc
+ 4);
2768 dump_generic_node (pp
, OMP_BODY (node
), spc
+ 4, flags
, false);
2769 newline_and_indent (pp
, spc
+ 2);
2770 pp_right_brace (pp
);
2776 pp_string (pp
, "#pragma omp task");
2777 dump_omp_clauses (pp
, OMP_TASK_CLAUSES (node
), spc
, flags
);
2781 pp_string (pp
, "#pragma omp for");
2785 pp_string (pp
, "#pragma omp simd");
2789 pp_string (pp
, "#pragma simd");
2793 /* This label points one line after dumping the clauses.
2794 For _Cilk_for the clauses are dumped after the _Cilk_for (...)
2795 parameters are printed out. */
2796 goto dump_omp_loop_cilk_for
;
2798 case OMP_DISTRIBUTE
:
2799 pp_string (pp
, "#pragma omp distribute");
2803 pp_string (pp
, "#pragma omp taskloop");
2807 pp_string (pp
, "#pragma acc loop");
2811 pp_string (pp
, "#pragma omp teams");
2812 dump_omp_clauses (pp
, OMP_TEAMS_CLAUSES (node
), spc
, flags
);
2815 case OMP_TARGET_DATA
:
2816 pp_string (pp
, "#pragma omp target data");
2817 dump_omp_clauses (pp
, OMP_TARGET_DATA_CLAUSES (node
), spc
, flags
);
2820 case OMP_TARGET_ENTER_DATA
:
2821 pp_string (pp
, "#pragma omp target enter data");
2822 dump_omp_clauses (pp
, OMP_TARGET_ENTER_DATA_CLAUSES (node
), spc
, flags
);
2826 case OMP_TARGET_EXIT_DATA
:
2827 pp_string (pp
, "#pragma omp target exit data");
2828 dump_omp_clauses (pp
, OMP_TARGET_EXIT_DATA_CLAUSES (node
), spc
, flags
);
2833 pp_string (pp
, "#pragma omp target");
2834 dump_omp_clauses (pp
, OMP_TARGET_CLAUSES (node
), spc
, flags
);
2837 case OMP_TARGET_UPDATE
:
2838 pp_string (pp
, "#pragma omp target update");
2839 dump_omp_clauses (pp
, OMP_TARGET_UPDATE_CLAUSES (node
), spc
, flags
);
2844 dump_omp_clauses (pp
, OMP_FOR_CLAUSES (node
), spc
, flags
);
2846 dump_omp_loop_cilk_for
:
2847 if (!(flags
& TDF_SLIM
))
2851 if (OMP_FOR_PRE_BODY (node
))
2853 if (TREE_CODE (node
) == CILK_FOR
)
2854 pp_string (pp
, " ");
2856 newline_and_indent (pp
, spc
+ 2);
2859 newline_and_indent (pp
, spc
);
2860 dump_generic_node (pp
, OMP_FOR_PRE_BODY (node
),
2863 if (OMP_FOR_INIT (node
))
2866 for (i
= 0; i
< TREE_VEC_LENGTH (OMP_FOR_INIT (node
)); i
++)
2869 if (TREE_CODE (node
) != CILK_FOR
|| OMP_FOR_PRE_BODY (node
))
2870 newline_and_indent (pp
, spc
);
2871 if (TREE_CODE (node
) == CILK_FOR
)
2872 pp_string (pp
, "_Cilk_for (");
2874 pp_string (pp
, "for (");
2875 dump_generic_node (pp
,
2876 TREE_VEC_ELT (OMP_FOR_INIT (node
), i
),
2878 pp_string (pp
, "; ");
2879 dump_generic_node (pp
,
2880 TREE_VEC_ELT (OMP_FOR_COND (node
), i
),
2882 pp_string (pp
, "; ");
2883 dump_generic_node (pp
,
2884 TREE_VEC_ELT (OMP_FOR_INCR (node
), i
),
2886 pp_right_paren (pp
);
2888 if (TREE_CODE (node
) == CILK_FOR
)
2889 dump_omp_clauses (pp
, OMP_FOR_CLAUSES (node
), spc
, flags
);
2891 if (OMP_FOR_BODY (node
))
2893 newline_and_indent (pp
, spc
+ 2);
2895 newline_and_indent (pp
, spc
+ 4);
2896 dump_generic_node (pp
, OMP_FOR_BODY (node
), spc
+ 4, flags
,
2898 newline_and_indent (pp
, spc
+ 2);
2899 pp_right_brace (pp
);
2901 if (OMP_FOR_INIT (node
))
2902 spc
-= 2 * TREE_VEC_LENGTH (OMP_FOR_INIT (node
)) - 2;
2903 if (OMP_FOR_PRE_BODY (node
))
2906 newline_and_indent (pp
, spc
+ 2);
2907 pp_right_brace (pp
);
2914 pp_string (pp
, "#pragma omp sections");
2915 dump_omp_clauses (pp
, OMP_SECTIONS_CLAUSES (node
), spc
, flags
);
2919 pp_string (pp
, "#pragma omp section");
2923 pp_string (pp
, "#pragma omp master");
2927 pp_string (pp
, "#pragma omp taskgroup");
2931 pp_string (pp
, "#pragma omp ordered");
2932 dump_omp_clauses (pp
, OMP_ORDERED_CLAUSES (node
), spc
, flags
);
2936 pp_string (pp
, "#pragma omp critical");
2937 if (OMP_CRITICAL_NAME (node
))
2941 dump_generic_node (pp
, OMP_CRITICAL_NAME (node
), spc
,
2943 pp_right_paren (pp
);
2945 dump_omp_clauses (pp
, OMP_CRITICAL_CLAUSES (node
), spc
, flags
);
2949 pp_string (pp
, "#pragma omp atomic");
2950 if (OMP_ATOMIC_SEQ_CST (node
))
2951 pp_string (pp
, " seq_cst");
2952 newline_and_indent (pp
, spc
+ 2);
2953 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2957 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2960 case OMP_ATOMIC_READ
:
2961 pp_string (pp
, "#pragma omp atomic read");
2962 if (OMP_ATOMIC_SEQ_CST (node
))
2963 pp_string (pp
, " seq_cst");
2964 newline_and_indent (pp
, spc
+ 2);
2965 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2969 case OMP_ATOMIC_CAPTURE_OLD
:
2970 case OMP_ATOMIC_CAPTURE_NEW
:
2971 pp_string (pp
, "#pragma omp atomic capture");
2972 if (OMP_ATOMIC_SEQ_CST (node
))
2973 pp_string (pp
, " seq_cst");
2974 newline_and_indent (pp
, spc
+ 2);
2975 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2979 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2983 pp_string (pp
, "#pragma omp single");
2984 dump_omp_clauses (pp
, OMP_SINGLE_CLAUSES (node
), spc
, flags
);
2988 dump_omp_clause (pp
, node
, spc
, flags
);
2992 case TRANSACTION_EXPR
:
2993 if (TRANSACTION_EXPR_OUTER (node
))
2994 pp_string (pp
, "__transaction_atomic [[outer]]");
2995 else if (TRANSACTION_EXPR_RELAXED (node
))
2996 pp_string (pp
, "__transaction_relaxed");
2998 pp_string (pp
, "__transaction_atomic");
2999 if (!(flags
& TDF_SLIM
) && TRANSACTION_EXPR_BODY (node
))
3001 newline_and_indent (pp
, spc
);
3003 newline_and_indent (pp
, spc
+ 2);
3004 dump_generic_node (pp
, TRANSACTION_EXPR_BODY (node
),
3005 spc
+ 2, flags
, false);
3006 newline_and_indent (pp
, spc
);
3007 pp_right_brace (pp
);
3012 case REDUC_MAX_EXPR
:
3013 pp_string (pp
, " REDUC_MAX_EXPR < ");
3014 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3015 pp_string (pp
, " > ");
3018 case REDUC_MIN_EXPR
:
3019 pp_string (pp
, " REDUC_MIN_EXPR < ");
3020 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3021 pp_string (pp
, " > ");
3024 case REDUC_PLUS_EXPR
:
3025 pp_string (pp
, " REDUC_PLUS_EXPR < ");
3026 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3027 pp_string (pp
, " > ");
3030 case VEC_WIDEN_MULT_HI_EXPR
:
3031 case VEC_WIDEN_MULT_LO_EXPR
:
3032 case VEC_WIDEN_MULT_EVEN_EXPR
:
3033 case VEC_WIDEN_MULT_ODD_EXPR
:
3034 case VEC_WIDEN_LSHIFT_HI_EXPR
:
3035 case VEC_WIDEN_LSHIFT_LO_EXPR
:
3037 for (str
= get_tree_code_name (code
); *str
; str
++)
3038 pp_character (pp
, TOUPPER (*str
));
3039 pp_string (pp
, " < ");
3040 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3041 pp_string (pp
, ", ");
3042 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3043 pp_string (pp
, " > ");
3046 case VEC_UNPACK_HI_EXPR
:
3047 pp_string (pp
, " VEC_UNPACK_HI_EXPR < ");
3048 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3049 pp_string (pp
, " > ");
3052 case VEC_UNPACK_LO_EXPR
:
3053 pp_string (pp
, " VEC_UNPACK_LO_EXPR < ");
3054 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3055 pp_string (pp
, " > ");
3058 case VEC_UNPACK_FLOAT_HI_EXPR
:
3059 pp_string (pp
, " VEC_UNPACK_FLOAT_HI_EXPR < ");
3060 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3061 pp_string (pp
, " > ");
3064 case VEC_UNPACK_FLOAT_LO_EXPR
:
3065 pp_string (pp
, " VEC_UNPACK_FLOAT_LO_EXPR < ");
3066 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3067 pp_string (pp
, " > ");
3070 case VEC_PACK_TRUNC_EXPR
:
3071 pp_string (pp
, " VEC_PACK_TRUNC_EXPR < ");
3072 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3073 pp_string (pp
, ", ");
3074 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3075 pp_string (pp
, " > ");
3078 case VEC_PACK_SAT_EXPR
:
3079 pp_string (pp
, " VEC_PACK_SAT_EXPR < ");
3080 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3081 pp_string (pp
, ", ");
3082 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3083 pp_string (pp
, " > ");
3086 case VEC_PACK_FIX_TRUNC_EXPR
:
3087 pp_string (pp
, " VEC_PACK_FIX_TRUNC_EXPR < ");
3088 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3089 pp_string (pp
, ", ");
3090 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3091 pp_string (pp
, " > ");
3095 dump_block_node (pp
, node
, spc
, flags
);
3098 case CILK_SPAWN_STMT
:
3099 pp_string (pp
, "_Cilk_spawn ");
3100 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3103 case CILK_SYNC_STMT
:
3104 pp_string (pp
, "_Cilk_sync");
3111 if (is_stmt
&& is_expr
)
3117 /* Print the declaration of a variable. */
3120 print_declaration (pretty_printer
*pp
, tree t
, int spc
, int flags
)
3124 if (TREE_CODE(t
) == NAMELIST_DECL
)
3126 pp_string(pp
, "namelist ");
3127 dump_decl_name (pp
, t
, flags
);
3132 if (TREE_CODE (t
) == TYPE_DECL
)
3133 pp_string (pp
, "typedef ");
3135 if (CODE_CONTAINS_STRUCT (TREE_CODE (t
), TS_DECL_WRTL
) && DECL_REGISTER (t
))
3136 pp_string (pp
, "register ");
3138 if (TREE_PUBLIC (t
) && DECL_EXTERNAL (t
))
3139 pp_string (pp
, "extern ");
3140 else if (TREE_STATIC (t
))
3141 pp_string (pp
, "static ");
3143 /* Print the type and name. */
3144 if (TREE_TYPE (t
) && TREE_CODE (TREE_TYPE (t
)) == ARRAY_TYPE
)
3148 /* Print array's type. */
3149 tmp
= TREE_TYPE (t
);
3150 while (TREE_CODE (TREE_TYPE (tmp
)) == ARRAY_TYPE
)
3151 tmp
= TREE_TYPE (tmp
);
3152 dump_generic_node (pp
, TREE_TYPE (tmp
), spc
, flags
, false);
3154 /* Print variable's name. */
3156 dump_generic_node (pp
, t
, spc
, flags
, false);
3158 /* Print the dimensions. */
3159 tmp
= TREE_TYPE (t
);
3160 while (TREE_CODE (tmp
) == ARRAY_TYPE
)
3162 dump_array_domain (pp
, TYPE_DOMAIN (tmp
), spc
, flags
);
3163 tmp
= TREE_TYPE (tmp
);
3166 else if (TREE_CODE (t
) == FUNCTION_DECL
)
3168 dump_generic_node (pp
, TREE_TYPE (TREE_TYPE (t
)), spc
, flags
, false);
3170 dump_decl_name (pp
, t
, flags
);
3171 dump_function_declaration (pp
, TREE_TYPE (t
), spc
, flags
);
3175 /* Print type declaration. */
3176 dump_generic_node (pp
, TREE_TYPE (t
), spc
, flags
, false);
3178 /* Print variable's name. */
3180 dump_generic_node (pp
, t
, spc
, flags
, false);
3183 if (TREE_CODE (t
) == VAR_DECL
&& DECL_HARD_REGISTER (t
))
3185 pp_string (pp
, " __asm__ ");
3187 dump_generic_node (pp
, DECL_ASSEMBLER_NAME (t
), spc
, flags
, false);
3188 pp_right_paren (pp
);
3191 /* The initial value of a function serves to determine whether the function
3192 is declared or defined. So the following does not apply to function
3194 if (TREE_CODE (t
) != FUNCTION_DECL
)
3196 /* Print the initial value. */
3197 if (DECL_INITIAL (t
))
3202 dump_generic_node (pp
, DECL_INITIAL (t
), spc
, flags
, false);
3206 if (TREE_CODE (t
) == VAR_DECL
&& DECL_HAS_VALUE_EXPR_P (t
))
3208 pp_string (pp
, " [value-expr: ");
3209 dump_generic_node (pp
, DECL_VALUE_EXPR (t
), spc
, flags
, false);
3210 pp_right_bracket (pp
);
3217 /* Prints a structure: name, fields, and methods.
3218 FIXME: Still incomplete. */
3221 print_struct_decl (pretty_printer
*pp
, const_tree node
, int spc
, int flags
)
3223 /* Print the name of the structure. */
3224 if (TYPE_NAME (node
))
3227 if (TREE_CODE (node
) == RECORD_TYPE
)
3228 pp_string (pp
, "struct ");
3229 else if ((TREE_CODE (node
) == UNION_TYPE
3230 || TREE_CODE (node
) == QUAL_UNION_TYPE
))
3231 pp_string (pp
, "union ");
3233 dump_generic_node (pp
, TYPE_NAME (node
), spc
, 0, false);
3236 /* Print the contents of the structure. */
3242 /* Print the fields of the structure. */
3245 tmp
= TYPE_FIELDS (node
);
3248 /* Avoid to print recursively the structure. */
3249 /* FIXME : Not implemented correctly...,
3250 what about the case when we have a cycle in the contain graph? ...
3251 Maybe this could be solved by looking at the scope in which the
3252 structure was declared. */
3253 if (TREE_TYPE (tmp
) != node
3254 && (TREE_CODE (TREE_TYPE (tmp
)) != POINTER_TYPE
3255 || TREE_TYPE (TREE_TYPE (tmp
)) != node
))
3257 print_declaration (pp
, tmp
, spc
+2, flags
);
3260 tmp
= DECL_CHAIN (tmp
);
3264 pp_right_brace (pp
);
3267 /* Return the priority of the operator CODE.
3269 From lowest to highest precedence with either left-to-right (L-R)
3270 or right-to-left (R-L) associativity]:
3273 2 [R-L] = += -= *= /= %= &= ^= |= <<= >>=
3285 14 [R-L] ! ~ ++ -- + - * & (type) sizeof
3286 15 [L-R] fn() [] -> .
3288 unary +, - and * have higher precedence than the corresponding binary
3292 op_code_prio (enum tree_code code
)
3309 case TRUTH_ORIF_EXPR
:
3312 case TRUTH_AND_EXPR
:
3313 case TRUTH_ANDIF_EXPR
:
3320 case TRUTH_XOR_EXPR
:
3337 case UNORDERED_EXPR
:
3348 case VEC_WIDEN_LSHIFT_HI_EXPR
:
3349 case VEC_WIDEN_LSHIFT_LO_EXPR
:
3350 case WIDEN_LSHIFT_EXPR
:
3353 case WIDEN_SUM_EXPR
:
3355 case POINTER_PLUS_EXPR
:
3359 case VEC_WIDEN_MULT_HI_EXPR
:
3360 case VEC_WIDEN_MULT_LO_EXPR
:
3361 case WIDEN_MULT_EXPR
:
3363 case WIDEN_MULT_PLUS_EXPR
:
3364 case WIDEN_MULT_MINUS_EXPR
:
3366 case MULT_HIGHPART_EXPR
:
3367 case TRUNC_DIV_EXPR
:
3369 case FLOOR_DIV_EXPR
:
3370 case ROUND_DIV_EXPR
:
3372 case EXACT_DIV_EXPR
:
3373 case TRUNC_MOD_EXPR
:
3375 case FLOOR_MOD_EXPR
:
3376 case ROUND_MOD_EXPR
:
3380 case TRUTH_NOT_EXPR
:
3382 case POSTINCREMENT_EXPR
:
3383 case POSTDECREMENT_EXPR
:
3384 case PREINCREMENT_EXPR
:
3385 case PREDECREMENT_EXPR
:
3391 case FIX_TRUNC_EXPR
:
3397 case ARRAY_RANGE_REF
:
3401 /* Special expressions. */
3407 case REDUC_MAX_EXPR
:
3408 case REDUC_MIN_EXPR
:
3409 case REDUC_PLUS_EXPR
:
3410 case VEC_UNPACK_HI_EXPR
:
3411 case VEC_UNPACK_LO_EXPR
:
3412 case VEC_UNPACK_FLOAT_HI_EXPR
:
3413 case VEC_UNPACK_FLOAT_LO_EXPR
:
3414 case VEC_PACK_TRUNC_EXPR
:
3415 case VEC_PACK_SAT_EXPR
:
3419 /* Return an arbitrarily high precedence to avoid surrounding single
3420 VAR_DECLs in ()s. */
3425 /* Return the priority of the operator OP. */
3428 op_prio (const_tree op
)
3430 enum tree_code code
;
3435 code
= TREE_CODE (op
);
3436 if (code
== SAVE_EXPR
|| code
== NON_LVALUE_EXPR
)
3437 return op_prio (TREE_OPERAND (op
, 0));
3439 return op_code_prio (code
);
3442 /* Return the symbol associated with operator CODE. */
3445 op_symbol_code (enum tree_code code
)
3453 case TRUTH_ORIF_EXPR
:
3456 case TRUTH_AND_EXPR
:
3457 case TRUTH_ANDIF_EXPR
:
3463 case TRUTH_XOR_EXPR
:
3473 case UNORDERED_EXPR
:
3519 case WIDEN_LSHIFT_EXPR
:
3522 case POINTER_PLUS_EXPR
:
3528 case REDUC_PLUS_EXPR
:
3531 case WIDEN_SUM_EXPR
:
3534 case WIDEN_MULT_EXPR
:
3537 case MULT_HIGHPART_EXPR
:
3547 case TRUTH_NOT_EXPR
:
3554 case TRUNC_DIV_EXPR
:
3561 case FLOOR_DIV_EXPR
:
3564 case ROUND_DIV_EXPR
:
3567 case EXACT_DIV_EXPR
:
3570 case TRUNC_MOD_EXPR
:
3576 case FLOOR_MOD_EXPR
:
3579 case ROUND_MOD_EXPR
:
3582 case PREDECREMENT_EXPR
:
3585 case PREINCREMENT_EXPR
:
3588 case POSTDECREMENT_EXPR
:
3591 case POSTINCREMENT_EXPR
:
3601 return "<<< ??? >>>";
3605 /* Return the symbol associated with operator OP. */
3608 op_symbol (const_tree op
)
3610 return op_symbol_code (TREE_CODE (op
));
3613 /* Prints the name of a call. NODE is the CALL_EXPR_FN of a CALL_EXPR or
3614 the gimple_call_fn of a GIMPLE_CALL. */
3617 print_call_name (pretty_printer
*pp
, tree node
, int flags
)
3621 if (TREE_CODE (op0
) == NON_LVALUE_EXPR
)
3622 op0
= TREE_OPERAND (op0
, 0);
3625 switch (TREE_CODE (op0
))
3630 dump_function_name (pp
, op0
, flags
);
3636 op0
= TREE_OPERAND (op0
, 0);
3641 dump_generic_node (pp
, TREE_OPERAND (op0
, 0), 0, flags
, false);
3642 pp_string (pp
, ") ? ");
3643 dump_generic_node (pp
, TREE_OPERAND (op0
, 1), 0, flags
, false);
3644 pp_string (pp
, " : ");
3645 dump_generic_node (pp
, TREE_OPERAND (op0
, 2), 0, flags
, false);
3649 if (TREE_CODE (TREE_OPERAND (op0
, 0)) == VAR_DECL
)
3650 dump_function_name (pp
, TREE_OPERAND (op0
, 0), flags
);
3652 dump_generic_node (pp
, op0
, 0, flags
, false);
3656 if (integer_zerop (TREE_OPERAND (op0
, 1)))
3658 op0
= TREE_OPERAND (op0
, 0);
3665 dump_generic_node (pp
, op0
, 0, flags
, false);
3673 /* Parses the string STR and replaces new-lines by '\n', tabs by '\t', ... */
3676 pretty_print_string (pretty_printer
*pp
, const char *str
)
3686 pp_string (pp
, "\\b");
3690 pp_string (pp
, "\\f");
3694 pp_string (pp
, "\\n");
3698 pp_string (pp
, "\\r");
3702 pp_string (pp
, "\\t");
3706 pp_string (pp
, "\\v");
3710 pp_string (pp
, "\\\\");
3714 pp_string (pp
, "\\\"");
3718 pp_string (pp
, "\\'");
3721 /* No need to handle \0; the loop terminates on \0. */
3724 pp_string (pp
, "\\1");
3728 pp_string (pp
, "\\2");
3732 pp_string (pp
, "\\3");
3736 pp_string (pp
, "\\4");
3740 pp_string (pp
, "\\5");
3744 pp_string (pp
, "\\6");
3748 pp_string (pp
, "\\7");
3752 pp_character (pp
, str
[0]);
3760 maybe_init_pretty_print (FILE *file
)
3764 tree_pp
= new pretty_printer ();
3765 pp_needs_newline (tree_pp
) = true;
3766 pp_translate_identifiers (tree_pp
) = false;
3769 tree_pp
->buffer
->stream
= file
;
3773 newline_and_indent (pretty_printer
*pp
, int spc
)
3779 /* Handle a %K format for TEXT. Separate from default_tree_printer so
3780 it can also be used in front ends.
3781 %K: a statement, from which EXPR_LOCATION and TREE_BLOCK will be recorded.
3785 percent_K_format (text_info
*text
)
3787 tree t
= va_arg (*text
->args_ptr
, tree
), block
;
3788 text
->set_location (0, EXPR_LOCATION (t
), true);
3789 gcc_assert (pp_ti_abstract_origin (text
) != NULL
);
3790 block
= TREE_BLOCK (t
);
3791 *pp_ti_abstract_origin (text
) = NULL
;
3795 /* ??? LTO drops all BLOCK_ABSTRACT_ORIGINs apart from those
3796 representing the outermost block of an inlined function.
3797 So walk the BLOCK tree until we hit such a scope. */
3799 && TREE_CODE (block
) == BLOCK
)
3801 if (inlined_function_outer_scope_p (block
))
3803 *pp_ti_abstract_origin (text
) = block
;
3806 block
= BLOCK_SUPERCONTEXT (block
);
3812 && TREE_CODE (block
) == BLOCK
3813 && BLOCK_ABSTRACT_ORIGIN (block
))
3815 tree ao
= BLOCK_ABSTRACT_ORIGIN (block
);
3817 while (TREE_CODE (ao
) == BLOCK
3818 && BLOCK_ABSTRACT_ORIGIN (ao
)
3819 && BLOCK_ABSTRACT_ORIGIN (ao
) != ao
)
3820 ao
= BLOCK_ABSTRACT_ORIGIN (ao
);
3822 if (TREE_CODE (ao
) == FUNCTION_DECL
)
3824 *pp_ti_abstract_origin (text
) = block
;
3827 block
= BLOCK_SUPERCONTEXT (block
);
3831 /* Print the identifier ID to PRETTY-PRINTER. */
3834 pp_tree_identifier (pretty_printer
*pp
, tree id
)
3836 if (pp_translate_identifiers (pp
))
3838 const char *text
= identifier_to_locale (IDENTIFIER_POINTER (id
));
3839 pp_append_text (pp
, text
, text
+ strlen (text
));
3842 pp_append_text (pp
, IDENTIFIER_POINTER (id
),
3843 IDENTIFIER_POINTER (id
) + IDENTIFIER_LENGTH (id
));
3846 /* A helper function that is used to dump function information before the
3850 dump_function_header (FILE *dump_file
, tree fdecl
, int flags
)
3852 const char *dname
, *aname
;
3853 struct cgraph_node
*node
= cgraph_node::get (fdecl
);
3854 struct function
*fun
= DECL_STRUCT_FUNCTION (fdecl
);
3856 dname
= lang_hooks
.decl_printable_name (fdecl
, 2);
3858 if (DECL_ASSEMBLER_NAME_SET_P (fdecl
))
3859 aname
= (IDENTIFIER_POINTER
3860 (DECL_ASSEMBLER_NAME (fdecl
)));
3862 aname
= "<unset-asm-name>";
3864 fprintf (dump_file
, "\n;; Function %s (%s, funcdef_no=%d",
3865 dname
, aname
, fun
->funcdef_no
);
3866 if (!(flags
& TDF_NOUID
))
3867 fprintf (dump_file
, ", decl_uid=%d", DECL_UID (fdecl
));
3870 fprintf (dump_file
, ", cgraph_uid=%d", node
->uid
);
3871 fprintf (dump_file
, ", symbol_order=%d)%s\n\n", node
->order
,
3872 node
->frequency
== NODE_FREQUENCY_HOT
3874 : node
->frequency
== NODE_FREQUENCY_UNLIKELY_EXECUTED
3875 ? " (unlikely executed)"
3876 : node
->frequency
== NODE_FREQUENCY_EXECUTED_ONCE
3877 ? " (executed once)"
3881 fprintf (dump_file
, ")\n\n");
3884 /* Dump double_int D to pretty_printer PP. UNS is true
3885 if D is unsigned and false otherwise. */
3887 pp_double_int (pretty_printer
*pp
, double_int d
, bool uns
)
3890 pp_wide_integer (pp
, d
.low
);
3891 else if (d
.fits_uhwi ())
3892 pp_unsigned_wide_integer (pp
, d
.low
);
3895 unsigned HOST_WIDE_INT low
= d
.low
;
3896 HOST_WIDE_INT high
= d
.high
;
3897 if (!uns
&& d
.is_negative ())
3900 high
= ~high
+ !low
;
3903 /* Would "%x%0*x" or "%x%*0x" get zero-padding on all
3905 sprintf (pp_buffer (pp
)->digit_buffer
,
3906 HOST_WIDE_INT_PRINT_DOUBLE_HEX
,
3907 (unsigned HOST_WIDE_INT
) high
, low
);
3908 pp_string (pp
, pp_buffer (pp
)->digit_buffer
);