1 /* Pretty formatting of GENERIC trees in C syntax.
2 Copyright (C) 2001-2023 Free Software Foundation, Inc.
3 Adapted from c-pretty-print.cc by Diego Novillo <dnovillo@redhat.com>
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 3, or (at your option) any later
12 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING3. If not see
19 <http://www.gnu.org/licenses/>. */
23 #include "coretypes.h"
29 #include "tree-pretty-print.h"
30 #include "stor-layout.h"
31 #include "langhooks.h"
32 #include "tree-iterator.h"
34 #include "internal-fn.h"
35 #include "gomp-constants.h"
37 #include "fold-const.h"
39 /* Routines in this file get invoked via the default tree printer
40 used by diagnostics and thus they are called from pp_printf which
41 isn't reentrant. Avoid using pp_printf in this file. */
42 #pragma GCC poison pp_printf
44 /* Disable warnings about quoting issues in the pp_xxx calls below
45 that (intentionally) don't follow GCC diagnostic conventions. */
47 # pragma GCC diagnostic push
48 # pragma GCC diagnostic ignored "-Wformat-diag"
51 /* Local functions, macros and variables. */
52 static const char *op_symbol (const_tree
, dump_flags_t
= TDF_NONE
);
53 static void newline_and_indent (pretty_printer
*, int);
54 static void maybe_init_pretty_print (FILE *);
55 static void print_struct_decl (pretty_printer
*, const_tree
, int, dump_flags_t
);
56 static void do_niy (pretty_printer
*, const_tree
, int, dump_flags_t
);
58 #define INDENT(SPACE) do { \
59 int i; for (i = 0; i<SPACE; i++) pp_space (pp); } while (0)
61 #define NIY do_niy (pp, node, spc, flags)
63 static pretty_printer
*tree_pp
;
65 /* Try to print something for an unknown tree code. */
68 do_niy (pretty_printer
*pp
, const_tree node
, int spc
, dump_flags_t flags
)
72 pp_string (pp
, "<<< Unknown tree: ");
73 pp_string (pp
, get_tree_code_name (TREE_CODE (node
)));
77 len
= TREE_OPERAND_LENGTH (node
);
78 for (i
= 0; i
< len
; ++i
)
80 newline_and_indent (pp
, spc
+2);
81 dump_generic_node (pp
, TREE_OPERAND (node
, i
), spc
+2, flags
, false);
85 pp_string (pp
, " >>>");
88 /* Debugging function to print out a generic expression. */
91 debug_generic_expr (tree t
)
93 print_generic_expr (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
);
94 fprintf (stderr
, "\n");
97 /* Debugging function to print out a generic statement. */
100 debug_generic_stmt (tree t
)
102 print_generic_stmt (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
);
103 fprintf (stderr
, "\n");
106 /* Debugging function to print out a chain of trees . */
109 debug_tree_chain (tree t
)
115 print_generic_expr (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
|TDF_UID
);
116 fprintf (stderr
, " ");
120 fprintf (stderr
, "... [cycled back to ");
121 print_generic_expr (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
|TDF_UID
);
122 fprintf (stderr
, "]");
126 fprintf (stderr
, "\n");
129 /* Prints declaration DECL to the FILE with details specified by FLAGS. */
131 print_generic_decl (FILE *file
, tree decl
, dump_flags_t flags
)
133 maybe_init_pretty_print (file
);
134 print_declaration (tree_pp
, decl
, 2, flags
);
135 pp_write_text_to_stream (tree_pp
);
138 /* Print tree T, and its successors, on file FILE. FLAGS specifies details
139 to show in the dump. See TDF_* in dumpfile.h. */
142 print_generic_stmt (FILE *file
, tree t
, dump_flags_t flags
)
144 maybe_init_pretty_print (file
);
145 dump_generic_node (tree_pp
, t
, 0, flags
, true);
146 pp_newline_and_flush (tree_pp
);
149 /* Print tree T, and its successors, on file FILE. FLAGS specifies details
150 to show in the dump. See TDF_* in dumpfile.h. The output is indented by
154 print_generic_stmt_indented (FILE *file
, tree t
, dump_flags_t flags
, int indent
)
158 maybe_init_pretty_print (file
);
160 for (i
= 0; i
< indent
; i
++)
162 dump_generic_node (tree_pp
, t
, indent
, flags
, true);
163 pp_newline_and_flush (tree_pp
);
166 /* Print a single expression T on file FILE. FLAGS specifies details to show
167 in the dump. See TDF_* in dumpfile.h. */
170 print_generic_expr (FILE *file
, tree t
, dump_flags_t flags
)
172 maybe_init_pretty_print (file
);
173 dump_generic_node (tree_pp
, t
, 0, flags
, false);
177 /* Print a single expression T to string, and return it. The caller
178 must free the returned memory. */
181 print_generic_expr_to_str (tree t
)
184 dump_generic_node (&pp
, t
, 0, TDF_VOPS
|TDF_MEMSYMS
, false);
185 return xstrdup (pp_formatted_text (&pp
));
188 /* Dump NAME, an IDENTIFIER_POINTER, sanitized so that D<num> sequences
189 in it are replaced with Dxxxx, as long as they are at the start or
190 preceded by $ and at the end or followed by $. See make_fancy_name
194 dump_fancy_name (pretty_printer
*pp
, tree name
)
197 int length
= IDENTIFIER_LENGTH (name
);
198 const char *n
= IDENTIFIER_POINTER (name
);
205 && (n
== IDENTIFIER_POINTER (name
) || n
[-1] == '$'))
208 while (ISDIGIT (n
[l
]))
210 if (n
[l
] == '\0' || n
[l
] == '$')
223 pp_tree_identifier (pp
, name
);
227 char *str
= XNEWVEC (char, length
+ 1);
230 q
= n
= IDENTIFIER_POINTER (name
);
237 && (q
== IDENTIFIER_POINTER (name
) || q
[-1] == '$'))
240 while (ISDIGIT (q
[l
]))
242 if (q
[l
] == '\0' || q
[l
] == '$')
244 memcpy (p
, n
, q
- n
);
245 memcpy (p
+ (q
- n
), "Dxxxx", 5);
255 memcpy (p
, n
, IDENTIFIER_LENGTH (name
) - (n
- IDENTIFIER_POINTER (name
)));
257 if (pp_translate_identifiers (pp
))
259 const char *text
= identifier_to_locale (str
);
260 pp_append_text (pp
, text
, text
+ strlen (text
));
263 pp_append_text (pp
, str
, str
+ length
);
267 /* Dump the name of a _DECL node and its DECL_UID if TDF_UID is set
271 dump_decl_name (pretty_printer
*pp
, tree node
, dump_flags_t flags
)
273 tree name
= DECL_NAME (node
);
276 if ((flags
& TDF_ASMNAME
)
277 && HAS_DECL_ASSEMBLER_NAME_P (node
)
278 && DECL_ASSEMBLER_NAME_SET_P (node
))
279 pp_tree_identifier (pp
, DECL_ASSEMBLER_NAME_RAW (node
));
280 /* For -fcompare-debug don't dump DECL_NAMELESS names at all,
281 -g might have created more fancy names and their indexes
282 could get out of sync. Usually those should be DECL_IGNORED_P
283 too, SRA can create even non-DECL_IGNORED_P DECL_NAMELESS fancy
284 names, let's hope those never get out of sync after doing the
285 dump_fancy_name sanitization. */
286 else if ((flags
& TDF_COMPARE_DEBUG
)
287 && DECL_NAMELESS (node
)
288 && DECL_IGNORED_P (node
))
290 /* For DECL_NAMELESS names look for embedded uids in the
291 names and sanitize them for TDF_NOUID. */
292 else if ((flags
& TDF_NOUID
) && DECL_NAMELESS (node
))
293 dump_fancy_name (pp
, name
);
295 pp_tree_identifier (pp
, name
);
297 char uid_sep
= (flags
& TDF_GIMPLE
) ? '_' : '.';
298 if ((flags
& TDF_UID
) || name
== NULL_TREE
)
300 if (TREE_CODE (node
) == LABEL_DECL
&& LABEL_DECL_UID (node
) != -1)
302 pp_character (pp
, 'L');
303 pp_character (pp
, uid_sep
);
304 pp_decimal_int (pp
, (int) LABEL_DECL_UID (node
));
306 else if (TREE_CODE (node
) == DEBUG_EXPR_DECL
)
308 if (flags
& TDF_NOUID
)
309 pp_string (pp
, "D#xxxx");
312 pp_string (pp
, "D#");
313 pp_decimal_int (pp
, (int) DEBUG_TEMP_UID (node
));
318 char c
= TREE_CODE (node
) == CONST_DECL
? 'C' : 'D';
319 pp_character (pp
, c
);
320 pp_character (pp
, uid_sep
);
321 if (flags
& TDF_NOUID
)
322 pp_string (pp
, "xxxx");
324 pp_scalar (pp
, "%u", DECL_UID (node
));
327 if ((flags
& TDF_ALIAS
) && DECL_PT_UID (node
) != DECL_UID (node
))
329 if (flags
& TDF_NOUID
)
330 pp_string (pp
, "ptD.xxxx");
333 pp_string (pp
, "ptD.");
334 pp_scalar (pp
, "%u", DECL_PT_UID (node
));
339 /* Like the above, but used for pretty printing function calls. */
342 dump_function_name (pretty_printer
*pp
, tree node
, dump_flags_t flags
)
344 if (CONVERT_EXPR_P (node
))
345 node
= TREE_OPERAND (node
, 0);
346 if (DECL_NAME (node
) && (flags
& TDF_ASMNAME
) == 0)
348 pp_string (pp
, lang_hooks
.decl_printable_name (node
, 1));
351 char uid_sep
= (flags
& TDF_GIMPLE
) ? '_' : '.';
352 pp_character (pp
, 'D');
353 pp_character (pp
, uid_sep
);
354 pp_scalar (pp
, "%u", DECL_UID (node
));
358 dump_decl_name (pp
, node
, flags
);
361 /* Dump a function declaration. NODE is the FUNCTION_TYPE. PP, SPC and
362 FLAGS are as in dump_generic_node. */
365 dump_function_declaration (pretty_printer
*pp
, tree node
,
366 int spc
, dump_flags_t flags
)
368 bool wrote_arg
= false;
374 /* Print the argument types. */
375 arg
= TYPE_ARG_TYPES (node
);
376 while (arg
&& arg
!= void_list_node
&& arg
!= error_mark_node
)
384 dump_generic_node (pp
, TREE_VALUE (arg
), spc
, flags
, false);
385 arg
= TREE_CHAIN (arg
);
388 /* Drop the trailing void_type_node if we had any previous argument. */
389 if (arg
== void_list_node
&& !wrote_arg
)
390 pp_string (pp
, "void");
391 /* Properly dump vararg function types. */
392 else if (!arg
&& wrote_arg
)
393 pp_string (pp
, ", ...");
394 /* Avoid printing any arg for unprototyped functions. */
399 /* Dump the domain associated with an array. */
402 dump_array_domain (pretty_printer
*pp
, tree domain
, int spc
, dump_flags_t flags
)
404 pp_left_bracket (pp
);
407 tree min
= TYPE_MIN_VALUE (domain
);
408 tree max
= TYPE_MAX_VALUE (domain
);
411 && integer_zerop (min
)
412 && tree_fits_shwi_p (max
))
413 pp_wide_integer (pp
, tree_to_shwi (max
) + 1);
417 dump_generic_node (pp
, min
, spc
, flags
, false);
420 dump_generic_node (pp
, max
, spc
, flags
, false);
424 pp_string (pp
, "<unknown>");
425 pp_right_bracket (pp
);
429 /* Dump OpenMP iterators ITER. */
432 dump_omp_iterators (pretty_printer
*pp
, tree iter
, int spc
, dump_flags_t flags
)
434 pp_string (pp
, "iterator(");
435 for (tree it
= iter
; it
; it
= TREE_CHAIN (it
))
438 pp_string (pp
, ", ");
439 dump_generic_node (pp
, TREE_TYPE (TREE_VEC_ELT (it
, 0)), spc
, flags
,
442 dump_generic_node (pp
, TREE_VEC_ELT (it
, 0), spc
, flags
, false);
444 dump_generic_node (pp
, TREE_VEC_ELT (it
, 1), spc
, flags
, false);
446 dump_generic_node (pp
, TREE_VEC_ELT (it
, 2), spc
, flags
, false);
448 dump_generic_node (pp
, TREE_VEC_ELT (it
, 3), spc
, flags
, false);
454 /* Dump OMP clause CLAUSE, without following OMP_CLAUSE_CHAIN.
456 PP, CLAUSE, SPC and FLAGS are as in dump_generic_node. */
459 dump_omp_clause (pretty_printer
*pp
, tree clause
, int spc
, dump_flags_t flags
)
462 const char *modifier
= NULL
;
463 switch (OMP_CLAUSE_CODE (clause
))
465 case OMP_CLAUSE_PRIVATE
:
468 case OMP_CLAUSE_SHARED
:
471 case OMP_CLAUSE_FIRSTPRIVATE
:
472 name
= "firstprivate";
474 case OMP_CLAUSE_LASTPRIVATE
:
475 name
= "lastprivate";
476 if (OMP_CLAUSE_LASTPRIVATE_CONDITIONAL (clause
))
477 modifier
= "conditional:";
479 case OMP_CLAUSE_COPYIN
:
482 case OMP_CLAUSE_COPYPRIVATE
:
483 name
= "copyprivate";
485 case OMP_CLAUSE_UNIFORM
:
488 case OMP_CLAUSE_USE_DEVICE_PTR
:
489 name
= "use_device_ptr";
490 if (OMP_CLAUSE_USE_DEVICE_PTR_IF_PRESENT (clause
))
491 modifier
= "if_present:";
493 case OMP_CLAUSE_USE_DEVICE_ADDR
:
494 name
= "use_device_addr";
496 case OMP_CLAUSE_HAS_DEVICE_ADDR
:
497 name
= "has_device_addr";
499 case OMP_CLAUSE_IS_DEVICE_PTR
:
500 name
= "is_device_ptr";
502 case OMP_CLAUSE_INCLUSIVE
:
505 case OMP_CLAUSE_EXCLUSIVE
:
508 case OMP_CLAUSE__LOOPTEMP_
:
511 case OMP_CLAUSE__REDUCTEMP_
:
512 name
= "_reductemp_";
514 case OMP_CLAUSE__CONDTEMP_
:
517 case OMP_CLAUSE__SCANTEMP_
:
520 case OMP_CLAUSE_ENTER
:
521 if (OMP_CLAUSE_ENTER_TO (clause
))
526 case OMP_CLAUSE_LINK
:
529 case OMP_CLAUSE_NONTEMPORAL
:
530 name
= "nontemporal";
533 pp_string (pp
, name
);
536 pp_string (pp
, modifier
);
537 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
542 case OMP_CLAUSE_TASK_REDUCTION
:
543 case OMP_CLAUSE_IN_REDUCTION
:
544 pp_string (pp
, OMP_CLAUSE_CODE (clause
) == OMP_CLAUSE_IN_REDUCTION
547 case OMP_CLAUSE_REDUCTION
:
548 pp_string (pp
, "reduction(");
549 if (OMP_CLAUSE_CODE (clause
) == OMP_CLAUSE_REDUCTION
)
551 if (OMP_CLAUSE_REDUCTION_TASK (clause
))
552 pp_string (pp
, "task,");
553 else if (OMP_CLAUSE_REDUCTION_INSCAN (clause
))
554 pp_string (pp
, "inscan,");
556 if (OMP_CLAUSE_REDUCTION_CODE (clause
) != ERROR_MARK
)
559 op_symbol_code (OMP_CLAUSE_REDUCTION_CODE (clause
)));
562 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
568 pp_string (pp
, "if(");
569 switch (OMP_CLAUSE_IF_MODIFIER (clause
))
571 case ERROR_MARK
: break;
572 case VOID_CST
: pp_string (pp
, "cancel:"); break;
573 case OMP_PARALLEL
: pp_string (pp
, "parallel:"); break;
574 case OMP_SIMD
: pp_string (pp
, "simd:"); break;
575 case OMP_TASK
: pp_string (pp
, "task:"); break;
576 case OMP_TASKLOOP
: pp_string (pp
, "taskloop:"); break;
577 case OMP_TARGET_DATA
: pp_string (pp
, "target data:"); break;
578 case OMP_TARGET
: pp_string (pp
, "target:"); break;
579 case OMP_TARGET_UPDATE
: pp_string (pp
, "target update:"); break;
580 case OMP_TARGET_ENTER_DATA
:
581 pp_string (pp
, "target enter data:"); break;
582 case OMP_TARGET_EXIT_DATA
: pp_string (pp
, "target exit data:"); break;
583 default: gcc_unreachable ();
585 dump_generic_node (pp
, OMP_CLAUSE_IF_EXPR (clause
),
590 case OMP_CLAUSE_NUM_THREADS
:
591 pp_string (pp
, "num_threads(");
592 dump_generic_node (pp
, OMP_CLAUSE_NUM_THREADS_EXPR (clause
),
597 case OMP_CLAUSE_NOWAIT
:
598 pp_string (pp
, "nowait");
600 case OMP_CLAUSE_ORDERED
:
601 pp_string (pp
, "ordered");
602 if (OMP_CLAUSE_ORDERED_EXPR (clause
))
605 dump_generic_node (pp
, OMP_CLAUSE_ORDERED_EXPR (clause
),
611 case OMP_CLAUSE_DEFAULT
:
612 pp_string (pp
, "default(");
613 switch (OMP_CLAUSE_DEFAULT_KIND (clause
))
615 case OMP_CLAUSE_DEFAULT_UNSPECIFIED
:
617 case OMP_CLAUSE_DEFAULT_SHARED
:
618 pp_string (pp
, "shared");
620 case OMP_CLAUSE_DEFAULT_NONE
:
621 pp_string (pp
, "none");
623 case OMP_CLAUSE_DEFAULT_PRIVATE
:
624 pp_string (pp
, "private");
626 case OMP_CLAUSE_DEFAULT_FIRSTPRIVATE
:
627 pp_string (pp
, "firstprivate");
629 case OMP_CLAUSE_DEFAULT_PRESENT
:
630 pp_string (pp
, "present");
638 case OMP_CLAUSE_SCHEDULE
:
639 pp_string (pp
, "schedule(");
640 if (OMP_CLAUSE_SCHEDULE_KIND (clause
)
641 & (OMP_CLAUSE_SCHEDULE_MONOTONIC
642 | OMP_CLAUSE_SCHEDULE_NONMONOTONIC
))
644 if (OMP_CLAUSE_SCHEDULE_KIND (clause
)
645 & OMP_CLAUSE_SCHEDULE_MONOTONIC
)
646 pp_string (pp
, "monotonic");
648 pp_string (pp
, "nonmonotonic");
649 if (OMP_CLAUSE_SCHEDULE_SIMD (clause
))
654 if (OMP_CLAUSE_SCHEDULE_SIMD (clause
))
655 pp_string (pp
, "simd:");
657 switch (OMP_CLAUSE_SCHEDULE_KIND (clause
) & OMP_CLAUSE_SCHEDULE_MASK
)
659 case OMP_CLAUSE_SCHEDULE_STATIC
:
660 pp_string (pp
, "static");
662 case OMP_CLAUSE_SCHEDULE_DYNAMIC
:
663 pp_string (pp
, "dynamic");
665 case OMP_CLAUSE_SCHEDULE_GUIDED
:
666 pp_string (pp
, "guided");
668 case OMP_CLAUSE_SCHEDULE_RUNTIME
:
669 pp_string (pp
, "runtime");
671 case OMP_CLAUSE_SCHEDULE_AUTO
:
672 pp_string (pp
, "auto");
677 if (OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (clause
))
680 dump_generic_node (pp
, OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (clause
),
686 case OMP_CLAUSE_UNTIED
:
687 pp_string (pp
, "untied");
690 case OMP_CLAUSE_COLLAPSE
:
691 pp_string (pp
, "collapse(");
692 dump_generic_node (pp
, OMP_CLAUSE_COLLAPSE_EXPR (clause
),
697 case OMP_CLAUSE_FINAL
:
698 pp_string (pp
, "final(");
699 dump_generic_node (pp
, OMP_CLAUSE_FINAL_EXPR (clause
),
704 case OMP_CLAUSE_MERGEABLE
:
705 pp_string (pp
, "mergeable");
708 case OMP_CLAUSE_LINEAR
:
709 pp_string (pp
, "linear(");
710 if (OMP_CLAUSE_LINEAR_OLD_LINEAR_MODIFIER (clause
))
711 switch (OMP_CLAUSE_LINEAR_KIND (clause
))
713 case OMP_CLAUSE_LINEAR_DEFAULT
:
715 case OMP_CLAUSE_LINEAR_REF
:
716 pp_string (pp
, "ref(");
718 case OMP_CLAUSE_LINEAR_VAL
:
719 pp_string (pp
, "val(");
721 case OMP_CLAUSE_LINEAR_UVAL
:
722 pp_string (pp
, "uval(");
727 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
729 if (OMP_CLAUSE_LINEAR_OLD_LINEAR_MODIFIER (clause
)
730 && OMP_CLAUSE_LINEAR_KIND (clause
) != OMP_CLAUSE_LINEAR_DEFAULT
)
733 if (!OMP_CLAUSE_LINEAR_OLD_LINEAR_MODIFIER (clause
)
734 && OMP_CLAUSE_LINEAR_KIND (clause
) != OMP_CLAUSE_LINEAR_DEFAULT
)
735 switch (OMP_CLAUSE_LINEAR_KIND (clause
))
737 case OMP_CLAUSE_LINEAR_REF
:
738 pp_string (pp
, "ref,step(");
740 case OMP_CLAUSE_LINEAR_VAL
:
741 pp_string (pp
, "val,step(");
743 case OMP_CLAUSE_LINEAR_UVAL
:
744 pp_string (pp
, "uval,step(");
749 dump_generic_node (pp
, OMP_CLAUSE_LINEAR_STEP (clause
),
751 if (!OMP_CLAUSE_LINEAR_OLD_LINEAR_MODIFIER (clause
)
752 && OMP_CLAUSE_LINEAR_KIND (clause
) != OMP_CLAUSE_LINEAR_DEFAULT
)
757 case OMP_CLAUSE_ALIGNED
:
758 pp_string (pp
, "aligned(");
759 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
761 if (OMP_CLAUSE_ALIGNED_ALIGNMENT (clause
))
764 dump_generic_node (pp
, OMP_CLAUSE_ALIGNED_ALIGNMENT (clause
),
770 case OMP_CLAUSE_ALLOCATE
:
771 pp_string (pp
, "allocate(");
772 if (OMP_CLAUSE_ALLOCATE_ALLOCATOR (clause
))
774 pp_string (pp
, "allocator(");
775 dump_generic_node (pp
, OMP_CLAUSE_ALLOCATE_ALLOCATOR (clause
),
779 if (OMP_CLAUSE_ALLOCATE_ALIGN (clause
))
781 if (OMP_CLAUSE_ALLOCATE_ALLOCATOR (clause
))
783 pp_string (pp
, "align(");
784 dump_generic_node (pp
, OMP_CLAUSE_ALLOCATE_ALIGN (clause
),
788 if (OMP_CLAUSE_ALLOCATE_ALLOCATOR (clause
)
789 || OMP_CLAUSE_ALLOCATE_ALIGN (clause
))
791 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
796 case OMP_CLAUSE_AFFINITY
:
797 pp_string (pp
, "affinity(");
799 tree t
= OMP_CLAUSE_DECL (clause
);
800 if (TREE_CODE (t
) == TREE_LIST
802 && TREE_CODE (TREE_PURPOSE (t
)) == TREE_VEC
)
804 dump_omp_iterators (pp
, TREE_PURPOSE (t
), spc
, flags
);
808 dump_generic_node (pp
, t
, spc
, flags
, false);
812 case OMP_CLAUSE_DEPEND
:
813 pp_string (pp
, "depend(");
814 switch (OMP_CLAUSE_DEPEND_KIND (clause
))
816 case OMP_CLAUSE_DEPEND_DEPOBJ
:
819 case OMP_CLAUSE_DEPEND_IN
:
822 case OMP_CLAUSE_DEPEND_OUT
:
825 case OMP_CLAUSE_DEPEND_INOUT
:
828 case OMP_CLAUSE_DEPEND_MUTEXINOUTSET
:
829 name
= "mutexinoutset";
831 case OMP_CLAUSE_DEPEND_INOUTSET
:
834 case OMP_CLAUSE_DEPEND_LAST
:
835 name
= "__internal__";
841 tree t
= OMP_CLAUSE_DECL (clause
);
842 if (TREE_CODE (t
) == TREE_LIST
844 && TREE_CODE (TREE_PURPOSE (t
)) == TREE_VEC
)
846 dump_omp_iterators (pp
, TREE_PURPOSE (t
), spc
, flags
);
852 pp_string (pp
, name
);
855 if (t
== null_pointer_node
)
856 pp_string (pp
, "omp_all_memory");
858 dump_generic_node (pp
, t
, spc
, flags
, false);
863 case OMP_CLAUSE_DOACROSS
:
864 pp_string (pp
, OMP_CLAUSE_DOACROSS_DEPEND (clause
)
865 ? "depend(" : "doacross(");
866 switch (OMP_CLAUSE_DOACROSS_KIND (clause
))
868 case OMP_CLAUSE_DOACROSS_SOURCE
:
869 if (OMP_CLAUSE_DOACROSS_DEPEND (clause
))
870 pp_string (pp
, "source)");
872 pp_string (pp
, "source:)");
874 case OMP_CLAUSE_DOACROSS_SINK
:
875 pp_string (pp
, "sink:");
876 if (OMP_CLAUSE_DECL (clause
) == NULL_TREE
)
878 pp_string (pp
, "omp_cur_iteration-1)");
881 for (tree t
= OMP_CLAUSE_DECL (clause
); t
; t
= TREE_CHAIN (t
))
882 if (TREE_CODE (t
) == TREE_LIST
)
884 dump_generic_node (pp
, TREE_VALUE (t
), spc
, flags
, false);
885 if (TREE_PURPOSE (t
) != integer_zero_node
)
887 if (OMP_CLAUSE_DOACROSS_SINK_NEGATIVE (t
))
891 dump_generic_node (pp
, TREE_PURPOSE (t
), spc
, flags
,
907 pp_string (pp
, "map(");
908 switch (OMP_CLAUSE_MAP_KIND (clause
))
911 case GOMP_MAP_POINTER
:
912 case GOMP_MAP_POINTER_TO_ZERO_LENGTH_ARRAY_SECTION
:
913 pp_string (pp
, "alloc");
915 case GOMP_MAP_IF_PRESENT
:
916 pp_string (pp
, "no_alloc");
919 case GOMP_MAP_TO_PSET
:
920 pp_string (pp
, "to");
923 pp_string (pp
, "from");
925 case GOMP_MAP_TOFROM
:
926 pp_string (pp
, "tofrom");
928 case GOMP_MAP_FORCE_ALLOC
:
929 pp_string (pp
, "force_alloc");
931 case GOMP_MAP_FORCE_TO
:
932 pp_string (pp
, "force_to");
934 case GOMP_MAP_FORCE_FROM
:
935 pp_string (pp
, "force_from");
937 case GOMP_MAP_FORCE_TOFROM
:
938 pp_string (pp
, "force_tofrom");
940 case GOMP_MAP_FORCE_PRESENT
:
941 pp_string (pp
, "force_present");
943 case GOMP_MAP_DELETE
:
944 pp_string (pp
, "delete");
946 case GOMP_MAP_FORCE_DEVICEPTR
:
947 pp_string (pp
, "force_deviceptr");
949 case GOMP_MAP_ALWAYS_TO
:
950 pp_string (pp
, "always,to");
952 case GOMP_MAP_ALWAYS_FROM
:
953 pp_string (pp
, "always,from");
955 case GOMP_MAP_ALWAYS_TOFROM
:
956 pp_string (pp
, "always,tofrom");
958 case GOMP_MAP_RELEASE
:
959 pp_string (pp
, "release");
961 case GOMP_MAP_FIRSTPRIVATE_POINTER
:
962 pp_string (pp
, "firstprivate");
964 case GOMP_MAP_FIRSTPRIVATE_REFERENCE
:
965 pp_string (pp
, "firstprivate ref");
967 case GOMP_MAP_STRUCT
:
968 pp_string (pp
, "struct");
970 case GOMP_MAP_ALWAYS_POINTER
:
971 pp_string (pp
, "always_pointer");
973 case GOMP_MAP_DEVICE_RESIDENT
:
974 pp_string (pp
, "device_resident");
977 pp_string (pp
, "link");
979 case GOMP_MAP_ATTACH
:
980 pp_string (pp
, "attach");
982 case GOMP_MAP_DETACH
:
983 pp_string (pp
, "detach");
985 case GOMP_MAP_FORCE_DETACH
:
986 pp_string (pp
, "force_detach");
988 case GOMP_MAP_ATTACH_DETACH
:
989 pp_string (pp
, "attach_detach");
991 case GOMP_MAP_ATTACH_ZERO_LENGTH_ARRAY_SECTION
:
992 pp_string (pp
, "attach_zero_length_array_section");
994 case GOMP_MAP_PRESENT_ALLOC
:
995 pp_string (pp
, "present,alloc");
997 case GOMP_MAP_PRESENT_TO
:
998 pp_string (pp
, "present,to");
1000 case GOMP_MAP_PRESENT_FROM
:
1001 pp_string (pp
, "present,from");
1003 case GOMP_MAP_PRESENT_TOFROM
:
1004 pp_string (pp
, "present,tofrom");
1006 case GOMP_MAP_ALWAYS_PRESENT_TO
:
1007 pp_string (pp
, "always,present,to");
1009 case GOMP_MAP_ALWAYS_PRESENT_FROM
:
1010 pp_string (pp
, "always,present,from");
1012 case GOMP_MAP_ALWAYS_PRESENT_TOFROM
:
1013 pp_string (pp
, "always,present,tofrom");
1019 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
1022 if (OMP_CLAUSE_SIZE (clause
))
1024 switch (OMP_CLAUSE_CODE (clause
) == OMP_CLAUSE_MAP
1025 ? OMP_CLAUSE_MAP_KIND (clause
) : GOMP_MAP_TO
)
1027 case GOMP_MAP_POINTER
:
1028 case GOMP_MAP_FIRSTPRIVATE_POINTER
:
1029 case GOMP_MAP_FIRSTPRIVATE_REFERENCE
:
1030 case GOMP_MAP_ALWAYS_POINTER
:
1031 pp_string (pp
, " [pointer assign, bias: ");
1033 case GOMP_MAP_POINTER_TO_ZERO_LENGTH_ARRAY_SECTION
:
1034 pp_string (pp
, " [pointer assign, zero-length array section, bias: ");
1036 case GOMP_MAP_TO_PSET
:
1037 pp_string (pp
, " [pointer set, len: ");
1039 case GOMP_MAP_ATTACH
:
1040 case GOMP_MAP_DETACH
:
1041 case GOMP_MAP_FORCE_DETACH
:
1042 case GOMP_MAP_ATTACH_DETACH
:
1043 case GOMP_MAP_ATTACH_ZERO_LENGTH_ARRAY_SECTION
:
1044 pp_string (pp
, " [bias: ");
1047 pp_string (pp
, " [len: ");
1050 dump_generic_node (pp
, OMP_CLAUSE_SIZE (clause
),
1052 pp_right_bracket (pp
);
1054 if (OMP_CLAUSE_CODE (clause
) == OMP_CLAUSE_MAP
1055 && OMP_CLAUSE_MAP_RUNTIME_IMPLICIT_P (clause
))
1056 pp_string (pp
, "[implicit]");
1057 pp_right_paren (pp
);
1060 case OMP_CLAUSE_FROM
:
1061 pp_string (pp
, "from(");
1062 if (OMP_CLAUSE_MOTION_PRESENT (clause
))
1063 pp_string (pp
, "present:");
1064 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
1066 goto print_clause_size
;
1069 pp_string (pp
, "to(");
1070 if (OMP_CLAUSE_MOTION_PRESENT (clause
))
1071 pp_string (pp
, "present:");
1072 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
1074 goto print_clause_size
;
1076 case OMP_CLAUSE__CACHE_
:
1077 pp_string (pp
, "(");
1078 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
1080 goto print_clause_size
;
1082 case OMP_CLAUSE_NUM_TEAMS
:
1083 pp_string (pp
, "num_teams(");
1084 if (OMP_CLAUSE_NUM_TEAMS_LOWER_EXPR (clause
))
1086 dump_generic_node (pp
, OMP_CLAUSE_NUM_TEAMS_LOWER_EXPR (clause
),
1090 dump_generic_node (pp
, OMP_CLAUSE_NUM_TEAMS_UPPER_EXPR (clause
),
1092 pp_right_paren (pp
);
1095 case OMP_CLAUSE_THREAD_LIMIT
:
1096 pp_string (pp
, "thread_limit(");
1097 dump_generic_node (pp
, OMP_CLAUSE_THREAD_LIMIT_EXPR (clause
),
1099 pp_right_paren (pp
);
1102 case OMP_CLAUSE_DEVICE
:
1103 pp_string (pp
, "device(");
1104 if (OMP_CLAUSE_DEVICE_ANCESTOR (clause
))
1105 pp_string (pp
, "ancestor:");
1106 dump_generic_node (pp
, OMP_CLAUSE_DEVICE_ID (clause
),
1108 pp_right_paren (pp
);
1111 case OMP_CLAUSE_DIST_SCHEDULE
:
1112 pp_string (pp
, "dist_schedule(static");
1113 if (OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR (clause
))
1116 dump_generic_node (pp
,
1117 OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR (clause
),
1120 pp_right_paren (pp
);
1123 case OMP_CLAUSE_PROC_BIND
:
1124 pp_string (pp
, "proc_bind(");
1125 switch (OMP_CLAUSE_PROC_BIND_KIND (clause
))
1127 case OMP_CLAUSE_PROC_BIND_MASTER
:
1128 /* Same enum value: case OMP_CLAUSE_PROC_BIND_PRIMARY: */
1129 /* TODO: Change to 'primary' for OpenMP 5.1. */
1130 pp_string (pp
, "master");
1132 case OMP_CLAUSE_PROC_BIND_CLOSE
:
1133 pp_string (pp
, "close");
1135 case OMP_CLAUSE_PROC_BIND_SPREAD
:
1136 pp_string (pp
, "spread");
1141 pp_right_paren (pp
);
1144 case OMP_CLAUSE_DEVICE_TYPE
:
1145 pp_string (pp
, "device_type(");
1146 switch (OMP_CLAUSE_DEVICE_TYPE_KIND (clause
))
1148 case OMP_CLAUSE_DEVICE_TYPE_HOST
:
1149 pp_string (pp
, "host");
1151 case OMP_CLAUSE_DEVICE_TYPE_NOHOST
:
1152 pp_string (pp
, "nohost");
1154 case OMP_CLAUSE_DEVICE_TYPE_ANY
:
1155 pp_string (pp
, "any");
1160 pp_right_paren (pp
);
1163 case OMP_CLAUSE_SAFELEN
:
1164 pp_string (pp
, "safelen(");
1165 dump_generic_node (pp
, OMP_CLAUSE_SAFELEN_EXPR (clause
),
1167 pp_right_paren (pp
);
1170 case OMP_CLAUSE_SIMDLEN
:
1171 pp_string (pp
, "simdlen(");
1172 dump_generic_node (pp
, OMP_CLAUSE_SIMDLEN_EXPR (clause
),
1174 pp_right_paren (pp
);
1177 case OMP_CLAUSE_PRIORITY
:
1178 pp_string (pp
, "priority(");
1179 dump_generic_node (pp
, OMP_CLAUSE_PRIORITY_EXPR (clause
),
1181 pp_right_paren (pp
);
1184 case OMP_CLAUSE_GRAINSIZE
:
1185 pp_string (pp
, "grainsize(");
1186 if (OMP_CLAUSE_GRAINSIZE_STRICT (clause
))
1187 pp_string (pp
, "strict:");
1188 dump_generic_node (pp
, OMP_CLAUSE_GRAINSIZE_EXPR (clause
),
1190 pp_right_paren (pp
);
1193 case OMP_CLAUSE_NUM_TASKS
:
1194 pp_string (pp
, "num_tasks(");
1195 if (OMP_CLAUSE_NUM_TASKS_STRICT (clause
))
1196 pp_string (pp
, "strict:");
1197 dump_generic_node (pp
, OMP_CLAUSE_NUM_TASKS_EXPR (clause
),
1199 pp_right_paren (pp
);
1202 case OMP_CLAUSE_HINT
:
1203 pp_string (pp
, "hint(");
1204 dump_generic_node (pp
, OMP_CLAUSE_HINT_EXPR (clause
),
1206 pp_right_paren (pp
);
1209 case OMP_CLAUSE_FILTER
:
1210 pp_string (pp
, "filter(");
1211 dump_generic_node (pp
, OMP_CLAUSE_FILTER_EXPR (clause
),
1213 pp_right_paren (pp
);
1216 case OMP_CLAUSE_DEFAULTMAP
:
1217 pp_string (pp
, "defaultmap(");
1218 switch (OMP_CLAUSE_DEFAULTMAP_BEHAVIOR (clause
))
1220 case OMP_CLAUSE_DEFAULTMAP_ALLOC
:
1221 pp_string (pp
, "alloc");
1223 case OMP_CLAUSE_DEFAULTMAP_TO
:
1224 pp_string (pp
, "to");
1226 case OMP_CLAUSE_DEFAULTMAP_FROM
:
1227 pp_string (pp
, "from");
1229 case OMP_CLAUSE_DEFAULTMAP_TOFROM
:
1230 pp_string (pp
, "tofrom");
1232 case OMP_CLAUSE_DEFAULTMAP_FIRSTPRIVATE
:
1233 pp_string (pp
, "firstprivate");
1235 case OMP_CLAUSE_DEFAULTMAP_NONE
:
1236 pp_string (pp
, "none");
1238 case OMP_CLAUSE_DEFAULTMAP_PRESENT
:
1239 pp_string (pp
, "present");
1241 case OMP_CLAUSE_DEFAULTMAP_DEFAULT
:
1242 pp_string (pp
, "default");
1247 switch (OMP_CLAUSE_DEFAULTMAP_CATEGORY (clause
))
1249 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_UNSPECIFIED
:
1251 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_ALL
:
1252 pp_string (pp
, ":all");
1254 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_SCALAR
:
1255 pp_string (pp
, ":scalar");
1257 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_AGGREGATE
:
1258 pp_string (pp
, ":aggregate");
1260 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_ALLOCATABLE
:
1261 pp_string (pp
, ":allocatable");
1263 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_POINTER
:
1264 pp_string (pp
, ":pointer");
1269 pp_right_paren (pp
);
1272 case OMP_CLAUSE_ORDER
:
1273 pp_string (pp
, "order(");
1274 if (OMP_CLAUSE_ORDER_UNCONSTRAINED (clause
))
1275 pp_string (pp
, "unconstrained:");
1276 else if (OMP_CLAUSE_ORDER_REPRODUCIBLE (clause
))
1277 pp_string (pp
, "reproducible:");
1278 pp_string (pp
, "concurrent)");
1281 case OMP_CLAUSE_BIND
:
1282 pp_string (pp
, "bind(");
1283 switch (OMP_CLAUSE_BIND_KIND (clause
))
1285 case OMP_CLAUSE_BIND_TEAMS
:
1286 pp_string (pp
, "teams");
1288 case OMP_CLAUSE_BIND_PARALLEL
:
1289 pp_string (pp
, "parallel");
1291 case OMP_CLAUSE_BIND_THREAD
:
1292 pp_string (pp
, "thread");
1297 pp_right_paren (pp
);
1300 case OMP_CLAUSE__SIMDUID_
:
1301 pp_string (pp
, "_simduid_(");
1302 dump_generic_node (pp
, OMP_CLAUSE__SIMDUID__DECL (clause
),
1304 pp_right_paren (pp
);
1307 case OMP_CLAUSE__SIMT_
:
1308 pp_string (pp
, "_simt_");
1311 case OMP_CLAUSE_GANG
:
1312 pp_string (pp
, "gang");
1313 if (OMP_CLAUSE_GANG_EXPR (clause
) != NULL_TREE
)
1315 pp_string (pp
, "(num: ");
1316 dump_generic_node (pp
, OMP_CLAUSE_GANG_EXPR (clause
),
1319 if (OMP_CLAUSE_GANG_STATIC_EXPR (clause
) != NULL_TREE
)
1321 if (OMP_CLAUSE_GANG_EXPR (clause
) == NULL_TREE
)
1325 pp_string (pp
, "static:");
1326 if (OMP_CLAUSE_GANG_STATIC_EXPR (clause
)
1327 == integer_minus_one_node
)
1328 pp_character (pp
, '*');
1330 dump_generic_node (pp
, OMP_CLAUSE_GANG_STATIC_EXPR (clause
),
1333 if (OMP_CLAUSE_GANG_EXPR (clause
) != NULL_TREE
1334 || OMP_CLAUSE_GANG_STATIC_EXPR (clause
) != NULL_TREE
)
1335 pp_right_paren (pp
);
1338 case OMP_CLAUSE_ASYNC
:
1339 pp_string (pp
, "async");
1340 if (OMP_CLAUSE_ASYNC_EXPR (clause
))
1342 pp_character(pp
, '(');
1343 dump_generic_node (pp
, OMP_CLAUSE_ASYNC_EXPR (clause
),
1345 pp_character(pp
, ')');
1349 case OMP_CLAUSE_AUTO
:
1350 case OMP_CLAUSE_SEQ
:
1351 pp_string (pp
, omp_clause_code_name
[OMP_CLAUSE_CODE (clause
)]);
1354 case OMP_CLAUSE_WAIT
:
1355 pp_string (pp
, "wait(");
1356 dump_generic_node (pp
, OMP_CLAUSE_WAIT_EXPR (clause
),
1358 pp_character(pp
, ')');
1361 case OMP_CLAUSE_WORKER
:
1362 pp_string (pp
, "worker");
1363 if (OMP_CLAUSE_WORKER_EXPR (clause
) != NULL_TREE
)
1366 dump_generic_node (pp
, OMP_CLAUSE_WORKER_EXPR (clause
),
1368 pp_right_paren (pp
);
1372 case OMP_CLAUSE_VECTOR
:
1373 pp_string (pp
, "vector");
1374 if (OMP_CLAUSE_VECTOR_EXPR (clause
) != NULL_TREE
)
1377 dump_generic_node (pp
, OMP_CLAUSE_VECTOR_EXPR (clause
),
1379 pp_right_paren (pp
);
1383 case OMP_CLAUSE_NUM_GANGS
:
1384 pp_string (pp
, "num_gangs(");
1385 dump_generic_node (pp
, OMP_CLAUSE_NUM_GANGS_EXPR (clause
),
1387 pp_character (pp
, ')');
1390 case OMP_CLAUSE_NUM_WORKERS
:
1391 pp_string (pp
, "num_workers(");
1392 dump_generic_node (pp
, OMP_CLAUSE_NUM_WORKERS_EXPR (clause
),
1394 pp_character (pp
, ')');
1397 case OMP_CLAUSE_VECTOR_LENGTH
:
1398 pp_string (pp
, "vector_length(");
1399 dump_generic_node (pp
, OMP_CLAUSE_VECTOR_LENGTH_EXPR (clause
),
1401 pp_character (pp
, ')');
1404 case OMP_CLAUSE_INBRANCH
:
1405 pp_string (pp
, "inbranch");
1407 case OMP_CLAUSE_NOTINBRANCH
:
1408 pp_string (pp
, "notinbranch");
1410 case OMP_CLAUSE_FOR
:
1411 pp_string (pp
, "for");
1413 case OMP_CLAUSE_PARALLEL
:
1414 pp_string (pp
, "parallel");
1416 case OMP_CLAUSE_SECTIONS
:
1417 pp_string (pp
, "sections");
1419 case OMP_CLAUSE_TASKGROUP
:
1420 pp_string (pp
, "taskgroup");
1422 case OMP_CLAUSE_NOGROUP
:
1423 pp_string (pp
, "nogroup");
1425 case OMP_CLAUSE_THREADS
:
1426 pp_string (pp
, "threads");
1428 case OMP_CLAUSE_SIMD
:
1429 pp_string (pp
, "simd");
1431 case OMP_CLAUSE_INDEPENDENT
:
1432 pp_string (pp
, "independent");
1434 case OMP_CLAUSE_TILE
:
1435 pp_string (pp
, "tile(");
1436 dump_generic_node (pp
, OMP_CLAUSE_TILE_LIST (clause
),
1438 pp_right_paren (pp
);
1441 case OMP_CLAUSE_IF_PRESENT
:
1442 pp_string (pp
, "if_present");
1444 case OMP_CLAUSE_FINALIZE
:
1445 pp_string (pp
, "finalize");
1447 case OMP_CLAUSE_NOHOST
:
1448 pp_string (pp
, "nohost");
1450 case OMP_CLAUSE_DETACH
:
1451 pp_string (pp
, "detach(");
1452 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
), spc
, flags
,
1454 pp_right_paren (pp
);
1463 /* Dump chain of OMP clauses.
1465 PP, SPC and FLAGS are as in dump_generic_node. */
1468 dump_omp_clauses (pretty_printer
*pp
, tree clause
, int spc
, dump_flags_t flags
,
1475 dump_omp_clause (pp
, clause
, spc
, flags
);
1476 leading_space
= true;
1478 clause
= OMP_CLAUSE_CHAIN (clause
);
1483 /* Dump location LOC to PP. */
1486 dump_location (pretty_printer
*pp
, location_t loc
)
1488 expanded_location xloc
= expand_location (loc
);
1489 int discriminator
= get_discriminator_from_loc (loc
);
1491 pp_left_bracket (pp
);
1494 pp_string (pp
, xloc
.file
);
1495 pp_string (pp
, ":");
1497 pp_decimal_int (pp
, xloc
.line
);
1499 pp_decimal_int (pp
, xloc
.column
);
1502 pp_string (pp
, " discrim ");
1503 pp_decimal_int (pp
, discriminator
);
1505 pp_string (pp
, "] ");
1509 /* Dump lexical block BLOCK. PP, SPC and FLAGS are as in
1510 dump_generic_node. */
1513 dump_block_node (pretty_printer
*pp
, tree block
, int spc
, dump_flags_t flags
)
1517 pp_string (pp
, "BLOCK #");
1518 pp_decimal_int (pp
, BLOCK_NUMBER (block
));
1519 pp_character (pp
, ' ');
1521 if (flags
& TDF_ADDRESS
)
1523 pp_character (pp
, '[');
1524 pp_scalar (pp
, "%p", (void *) block
);
1525 pp_string (pp
, "] ");
1528 if (TREE_ASM_WRITTEN (block
))
1529 pp_string (pp
, "[written] ");
1531 if (flags
& TDF_SLIM
)
1534 if (BLOCK_SOURCE_LOCATION (block
))
1535 dump_location (pp
, BLOCK_SOURCE_LOCATION (block
));
1537 newline_and_indent (pp
, spc
+ 2);
1539 if (BLOCK_SUPERCONTEXT (block
))
1541 pp_string (pp
, "SUPERCONTEXT: ");
1542 dump_generic_node (pp
, BLOCK_SUPERCONTEXT (block
), 0,
1543 flags
| TDF_SLIM
, false);
1544 newline_and_indent (pp
, spc
+ 2);
1547 if (BLOCK_SUBBLOCKS (block
))
1549 pp_string (pp
, "SUBBLOCKS: ");
1550 for (t
= BLOCK_SUBBLOCKS (block
); t
; t
= BLOCK_CHAIN (t
))
1552 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
1555 newline_and_indent (pp
, spc
+ 2);
1558 if (BLOCK_CHAIN (block
))
1560 pp_string (pp
, "SIBLINGS: ");
1561 for (t
= BLOCK_CHAIN (block
); t
; t
= BLOCK_CHAIN (t
))
1563 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
1566 newline_and_indent (pp
, spc
+ 2);
1569 if (BLOCK_VARS (block
))
1571 pp_string (pp
, "VARS: ");
1572 for (t
= BLOCK_VARS (block
); t
; t
= TREE_CHAIN (t
))
1574 dump_generic_node (pp
, t
, 0, flags
, false);
1577 newline_and_indent (pp
, spc
+ 2);
1580 if (vec_safe_length (BLOCK_NONLOCALIZED_VARS (block
)) > 0)
1583 vec
<tree
, va_gc
> *nlv
= BLOCK_NONLOCALIZED_VARS (block
);
1585 pp_string (pp
, "NONLOCALIZED_VARS: ");
1586 FOR_EACH_VEC_ELT (*nlv
, i
, t
)
1588 dump_generic_node (pp
, t
, 0, flags
, false);
1591 newline_and_indent (pp
, spc
+ 2);
1594 if (BLOCK_ABSTRACT_ORIGIN (block
))
1596 pp_string (pp
, "ABSTRACT_ORIGIN: ");
1597 dump_generic_node (pp
, BLOCK_ABSTRACT_ORIGIN (block
), 0,
1598 flags
| TDF_SLIM
, false);
1599 newline_and_indent (pp
, spc
+ 2);
1602 if (BLOCK_FRAGMENT_ORIGIN (block
))
1604 pp_string (pp
, "FRAGMENT_ORIGIN: ");
1605 dump_generic_node (pp
, BLOCK_FRAGMENT_ORIGIN (block
), 0,
1606 flags
| TDF_SLIM
, false);
1607 newline_and_indent (pp
, spc
+ 2);
1610 if (BLOCK_FRAGMENT_CHAIN (block
))
1612 pp_string (pp
, "FRAGMENT_CHAIN: ");
1613 for (t
= BLOCK_FRAGMENT_CHAIN (block
); t
; t
= BLOCK_FRAGMENT_CHAIN (t
))
1615 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
1618 newline_and_indent (pp
, spc
+ 2);
1622 /* Dump #pragma omp atomic memory order clause. */
1625 dump_omp_atomic_memory_order (pretty_printer
*pp
, enum omp_memory_order mo
)
1627 switch (mo
& OMP_MEMORY_ORDER_MASK
)
1629 case OMP_MEMORY_ORDER_RELAXED
:
1630 pp_string (pp
, " relaxed");
1632 case OMP_MEMORY_ORDER_SEQ_CST
:
1633 pp_string (pp
, " seq_cst");
1635 case OMP_MEMORY_ORDER_ACQ_REL
:
1636 pp_string (pp
, " acq_rel");
1638 case OMP_MEMORY_ORDER_ACQUIRE
:
1639 pp_string (pp
, " acquire");
1641 case OMP_MEMORY_ORDER_RELEASE
:
1642 pp_string (pp
, " release");
1644 case OMP_MEMORY_ORDER_UNSPECIFIED
:
1649 switch (mo
& OMP_FAIL_MEMORY_ORDER_MASK
)
1651 case OMP_FAIL_MEMORY_ORDER_RELAXED
:
1652 pp_string (pp
, " fail(relaxed)");
1654 case OMP_FAIL_MEMORY_ORDER_SEQ_CST
:
1655 pp_string (pp
, " fail(seq_cst)");
1657 case OMP_FAIL_MEMORY_ORDER_ACQUIRE
:
1658 pp_string (pp
, " fail(acquire)");
1660 case OMP_FAIL_MEMORY_ORDER_UNSPECIFIED
:
1667 /* Helper to dump a MEM_REF node. */
1670 dump_mem_ref (pretty_printer
*pp
, tree node
, int spc
, dump_flags_t flags
)
1672 if (TREE_CODE (node
) == MEM_REF
&& (flags
& TDF_GIMPLE
))
1674 pp_string (pp
, "__MEM <");
1675 dump_generic_node (pp
, TREE_TYPE (node
),
1676 spc
, flags
| TDF_SLIM
, false);
1677 if (TYPE_ALIGN (TREE_TYPE (node
))
1678 != TYPE_ALIGN (TYPE_MAIN_VARIANT (TREE_TYPE (node
))))
1680 pp_string (pp
, ", ");
1681 pp_decimal_int (pp
, TYPE_ALIGN (TREE_TYPE (node
)));
1684 pp_string (pp
, " (");
1685 if (TREE_TYPE (TREE_OPERAND (node
, 0))
1686 != TREE_TYPE (TREE_OPERAND (node
, 1)))
1689 dump_generic_node (pp
, TREE_TYPE (TREE_OPERAND (node
, 1)),
1690 spc
, flags
| TDF_SLIM
, false);
1691 pp_right_paren (pp
);
1693 dump_generic_node (pp
, TREE_OPERAND (node
, 0),
1694 spc
, flags
| TDF_SLIM
, false);
1695 if (! integer_zerop (TREE_OPERAND (node
, 1)))
1697 pp_string (pp
, " + ");
1698 dump_generic_node (pp
, TREE_OPERAND (node
, 1),
1699 spc
, flags
| TDF_SLIM
, false);
1701 pp_right_paren (pp
);
1703 else if (TREE_CODE (node
) == MEM_REF
1704 && integer_zerop (TREE_OPERAND (node
, 1))
1705 /* Dump the types of INTEGER_CSTs explicitly, for we can't
1706 infer them and MEM_ATTR caching will share MEM_REFs
1707 with differently-typed op0s. */
1708 && TREE_CODE (TREE_OPERAND (node
, 0)) != INTEGER_CST
1709 /* Released SSA_NAMES have no TREE_TYPE. */
1710 && TREE_TYPE (TREE_OPERAND (node
, 0)) != NULL_TREE
1711 /* Same pointer types, but ignoring POINTER_TYPE vs.
1713 && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 0)))
1714 == TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 1))))
1715 && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (node
, 0)))
1716 == TYPE_MODE (TREE_TYPE (TREE_OPERAND (node
, 1))))
1717 && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node
, 0)))
1718 == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node
, 1))))
1719 /* Same value types ignoring qualifiers. */
1720 && (TYPE_MAIN_VARIANT (TREE_TYPE (node
))
1721 == TYPE_MAIN_VARIANT
1722 (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 1)))))
1723 && (!(flags
& TDF_ALIAS
)
1724 || MR_DEPENDENCE_CLIQUE (node
) == 0))
1726 if (TREE_CODE (TREE_OPERAND (node
, 0)) != ADDR_EXPR
)
1728 /* Enclose pointers to arrays in parentheses. */
1729 tree op0
= TREE_OPERAND (node
, 0);
1730 tree op0type
= TREE_TYPE (op0
);
1731 if (POINTER_TYPE_P (op0type
)
1732 && TREE_CODE (TREE_TYPE (op0type
)) == ARRAY_TYPE
)
1735 dump_generic_node (pp
, op0
, spc
, flags
, false);
1736 if (POINTER_TYPE_P (op0type
)
1737 && TREE_CODE (TREE_TYPE (op0type
)) == ARRAY_TYPE
)
1738 pp_right_paren (pp
);
1741 dump_generic_node (pp
,
1742 TREE_OPERAND (TREE_OPERAND (node
, 0), 0),
1747 pp_string (pp
, "MEM");
1749 tree nodetype
= TREE_TYPE (node
);
1750 tree op0
= TREE_OPERAND (node
, 0);
1751 tree op1
= TREE_OPERAND (node
, 1);
1752 tree op1type
= TYPE_MAIN_VARIANT (TREE_TYPE (op1
));
1754 tree op0size
= TYPE_SIZE (nodetype
);
1755 tree op1size
= TYPE_SIZE (TREE_TYPE (op1type
));
1757 if (!op0size
|| !op1size
1758 || !operand_equal_p (op0size
, op1size
, 0))
1760 pp_string (pp
, " <");
1761 /* If the size of the type of the operand is not the same
1762 as the size of the MEM_REF expression include the type
1763 of the latter similar to the TDF_GIMPLE output to make
1764 it clear how many bytes of memory are being accessed. */
1765 dump_generic_node (pp
, nodetype
, spc
, flags
| TDF_SLIM
, false);
1766 pp_string (pp
, "> ");
1769 pp_string (pp
, "[(");
1770 dump_generic_node (pp
, op1type
, spc
, flags
| TDF_SLIM
, false);
1771 pp_right_paren (pp
);
1772 dump_generic_node (pp
, op0
, spc
, flags
, false);
1773 if (!integer_zerop (op1
))
1775 pp_string (pp
, " + ");
1776 dump_generic_node (pp
, op1
, spc
, flags
, false);
1778 if (TREE_CODE (node
) == TARGET_MEM_REF
)
1780 tree tmp
= TMR_INDEX2 (node
);
1783 pp_string (pp
, " + ");
1784 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1786 tmp
= TMR_INDEX (node
);
1789 pp_string (pp
, " + ");
1790 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1791 tmp
= TMR_STEP (node
);
1792 pp_string (pp
, " * ");
1794 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1796 pp_string (pp
, "1");
1799 if ((flags
& TDF_ALIAS
)
1800 && MR_DEPENDENCE_CLIQUE (node
) != 0)
1802 pp_string (pp
, " clique ");
1803 pp_unsigned_wide_integer (pp
, MR_DEPENDENCE_CLIQUE (node
));
1804 pp_string (pp
, " base ");
1805 pp_unsigned_wide_integer (pp
, MR_DEPENDENCE_BASE (node
));
1807 pp_right_bracket (pp
);
1811 /* Helper function for dump_generic_node. Dump INIT or COND expression for
1812 OpenMP loop non-rectangular iterators. */
1815 dump_omp_loop_non_rect_expr (pretty_printer
*pp
, tree node
, int spc
,
1818 gcc_assert (TREE_CODE (node
) == TREE_VEC
);
1819 dump_generic_node (pp
, TREE_VEC_ELT (node
, 0), spc
, flags
, false);
1820 pp_string (pp
, " * ");
1821 if (op_prio (TREE_VEC_ELT (node
, 1)) <= op_code_prio (MULT_EXPR
))
1824 dump_generic_node (pp
, TREE_VEC_ELT (node
, 1), spc
, flags
, false);
1825 pp_right_paren (pp
);
1828 dump_generic_node (pp
, TREE_VEC_ELT (node
, 1), spc
, flags
, false);
1829 pp_string (pp
, " + ");
1830 if (op_prio (TREE_VEC_ELT (node
, 1)) <= op_code_prio (PLUS_EXPR
))
1833 dump_generic_node (pp
, TREE_VEC_ELT (node
, 2), spc
, flags
, false);
1834 pp_right_paren (pp
);
1837 dump_generic_node (pp
, TREE_VEC_ELT (node
, 2), spc
, flags
, false);
1840 /* Dump the node NODE on the pretty_printer PP, SPC spaces of
1841 indent. FLAGS specifies details to show in the dump (see TDF_* in
1842 dumpfile.h). If IS_STMT is true, the object printed is considered
1843 to be a statement and it is terminated by ';' if appropriate. */
1846 dump_generic_node (pretty_printer
*pp
, tree node
, int spc
, dump_flags_t flags
,
1853 enum tree_code code
;
1855 if (node
== NULL_TREE
)
1858 is_expr
= EXPR_P (node
);
1860 if (is_stmt
&& (flags
& TDF_STMTADDR
))
1862 pp_string (pp
, "<&");
1863 pp_scalar (pp
, "%p", (void *)node
);
1864 pp_string (pp
, "> ");
1867 if ((flags
& TDF_LINENO
) && EXPR_HAS_LOCATION (node
))
1868 dump_location (pp
, EXPR_LOCATION (node
));
1870 code
= TREE_CODE (node
);
1874 pp_string (pp
, "<<< error >>>");
1877 case IDENTIFIER_NODE
:
1878 pp_tree_identifier (pp
, node
);
1882 while (node
&& node
!= error_mark_node
)
1884 if (TREE_PURPOSE (node
))
1886 dump_generic_node (pp
, TREE_PURPOSE (node
), spc
, flags
, false);
1889 dump_generic_node (pp
, TREE_VALUE (node
), spc
, flags
, false);
1890 node
= TREE_CHAIN (node
);
1891 if (node
&& TREE_CODE (node
) == TREE_LIST
)
1900 dump_generic_node (pp
, BINFO_TYPE (node
), spc
, flags
, false);
1907 if (TREE_VEC_LENGTH (node
) > 0)
1909 size_t len
= TREE_VEC_LENGTH (node
);
1910 for (i
= 0; i
< len
- 1; i
++)
1912 dump_generic_node (pp
, TREE_VEC_ELT (node
, i
), spc
, flags
,
1917 dump_generic_node (pp
, TREE_VEC_ELT (node
, len
- 1), spc
,
1920 pp_right_brace (pp
);
1927 case FIXED_POINT_TYPE
:
1935 unsigned int quals
= TYPE_QUALS (node
);
1936 enum tree_code_class tclass
;
1938 if (quals
& TYPE_QUAL_ATOMIC
)
1939 pp_string (pp
, "atomic ");
1940 if (quals
& TYPE_QUAL_CONST
)
1941 pp_string (pp
, "const ");
1942 if (quals
& TYPE_QUAL_VOLATILE
)
1943 pp_string (pp
, "volatile ");
1944 if (quals
& TYPE_QUAL_RESTRICT
)
1945 pp_string (pp
, "restrict ");
1947 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
1949 pp_string (pp
, "<address-space-");
1950 pp_decimal_int (pp
, TYPE_ADDR_SPACE (node
));
1951 pp_string (pp
, "> ");
1954 tclass
= TREE_CODE_CLASS (TREE_CODE (node
));
1956 if (tclass
== tcc_declaration
)
1958 if (DECL_NAME (node
))
1959 dump_decl_name (pp
, node
, flags
);
1961 pp_string (pp
, "<unnamed type decl>");
1963 else if (tclass
== tcc_type
)
1965 if (TYPE_NAME (node
))
1967 if (TREE_CODE (TYPE_NAME (node
)) == IDENTIFIER_NODE
)
1968 pp_tree_identifier (pp
, TYPE_NAME (node
));
1969 else if (TREE_CODE (TYPE_NAME (node
)) == TYPE_DECL
1970 && DECL_NAME (TYPE_NAME (node
)))
1971 dump_decl_name (pp
, TYPE_NAME (node
), flags
);
1973 pp_string (pp
, "<unnamed type>");
1975 else if (TREE_CODE (node
) == VECTOR_TYPE
)
1977 pp_string (pp
, "vector");
1979 pp_wide_integer (pp
, TYPE_VECTOR_SUBPARTS (node
));
1980 pp_string (pp
, ") ");
1981 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1983 else if (TREE_CODE (node
) == INTEGER_TYPE
)
1985 if (TYPE_PRECISION (node
) == CHAR_TYPE_SIZE
)
1986 pp_string (pp
, (TYPE_UNSIGNED (node
)
1989 else if (TYPE_PRECISION (node
) == SHORT_TYPE_SIZE
)
1990 pp_string (pp
, (TYPE_UNSIGNED (node
)
1993 else if (TYPE_PRECISION (node
) == INT_TYPE_SIZE
)
1994 pp_string (pp
, (TYPE_UNSIGNED (node
)
1997 else if (TYPE_PRECISION (node
) == LONG_TYPE_SIZE
)
1998 pp_string (pp
, (TYPE_UNSIGNED (node
)
2001 else if (TYPE_PRECISION (node
) == LONG_LONG_TYPE_SIZE
)
2002 pp_string (pp
, (TYPE_UNSIGNED (node
)
2003 ? "unsigned long long"
2004 : "signed long long"));
2005 else if (TYPE_PRECISION (node
) >= CHAR_TYPE_SIZE
2006 && pow2p_hwi (TYPE_PRECISION (node
)))
2008 pp_string (pp
, (TYPE_UNSIGNED (node
) ? "uint" : "int"));
2009 pp_decimal_int (pp
, TYPE_PRECISION (node
));
2010 pp_string (pp
, "_t");
2014 pp_string (pp
, (TYPE_UNSIGNED (node
)
2015 ? "<unnamed-unsigned:"
2016 : "<unnamed-signed:"));
2017 pp_decimal_int (pp
, TYPE_PRECISION (node
));
2021 else if (TREE_CODE (node
) == COMPLEX_TYPE
)
2023 pp_string (pp
, "__complex__ ");
2024 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2026 else if (TREE_CODE (node
) == REAL_TYPE
)
2028 pp_string (pp
, "<float:");
2029 pp_decimal_int (pp
, TYPE_PRECISION (node
));
2032 else if (TREE_CODE (node
) == FIXED_POINT_TYPE
)
2034 pp_string (pp
, "<fixed-point-");
2035 pp_string (pp
, TYPE_SATURATING (node
) ? "sat:" : "nonsat:");
2036 pp_decimal_int (pp
, TYPE_PRECISION (node
));
2039 else if (TREE_CODE (node
) == BOOLEAN_TYPE
)
2041 pp_string (pp
, (TYPE_UNSIGNED (node
)
2042 ? "<unsigned-boolean:"
2043 : "<signed-boolean:"));
2044 pp_decimal_int (pp
, TYPE_PRECISION (node
));
2047 else if (TREE_CODE (node
) == BITINT_TYPE
)
2049 if (TYPE_UNSIGNED (node
))
2050 pp_string (pp
, "unsigned ");
2051 pp_string (pp
, "_BitInt(");
2052 pp_decimal_int (pp
, TYPE_PRECISION (node
));
2053 pp_right_paren (pp
);
2055 else if (TREE_CODE (node
) == VOID_TYPE
)
2056 pp_string (pp
, "void");
2058 pp_string (pp
, "<unnamed type>");
2064 case REFERENCE_TYPE
:
2065 str
= (TREE_CODE (node
) == POINTER_TYPE
? "*" : "&");
2067 if (TREE_TYPE (node
) == NULL
)
2069 pp_string (pp
, str
);
2070 pp_string (pp
, "<null type>");
2072 else if (TREE_CODE (TREE_TYPE (node
)) == FUNCTION_TYPE
)
2074 tree fnode
= TREE_TYPE (node
);
2076 dump_generic_node (pp
, TREE_TYPE (fnode
), spc
, flags
, false);
2079 pp_string (pp
, str
);
2080 if (TYPE_IDENTIFIER (node
))
2081 dump_generic_node (pp
, TYPE_NAME (node
), spc
, flags
, false);
2082 else if (flags
& TDF_NOUID
)
2083 pp_string (pp
, "<Txxxx>");
2086 pp_string (pp
, "<T");
2087 pp_scalar (pp
, "%x", TYPE_UID (node
));
2088 pp_character (pp
, '>');
2091 pp_right_paren (pp
);
2092 dump_function_declaration (pp
, fnode
, spc
, flags
);
2096 unsigned int quals
= TYPE_QUALS (node
);
2098 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2100 pp_string (pp
, str
);
2102 if (quals
& TYPE_QUAL_CONST
)
2103 pp_string (pp
, " const");
2104 if (quals
& TYPE_QUAL_VOLATILE
)
2105 pp_string (pp
, " volatile");
2106 if (quals
& TYPE_QUAL_RESTRICT
)
2107 pp_string (pp
, " restrict");
2109 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
2111 pp_string (pp
, " <address-space-");
2112 pp_decimal_int (pp
, TYPE_ADDR_SPACE (node
));
2116 if (TYPE_REF_CAN_ALIAS_ALL (node
))
2117 pp_string (pp
, " {ref-all}");
2126 case TARGET_MEM_REF
:
2127 dump_mem_ref (pp
, node
, spc
, flags
);
2132 unsigned int quals
= TYPE_QUALS (node
);
2135 if (quals
& TYPE_QUAL_ATOMIC
)
2136 pp_string (pp
, "atomic ");
2137 if (quals
& TYPE_QUAL_CONST
)
2138 pp_string (pp
, "const ");
2139 if (quals
& TYPE_QUAL_VOLATILE
)
2140 pp_string (pp
, "volatile ");
2142 /* Print the innermost component type. */
2143 for (tmp
= TREE_TYPE (node
); TREE_CODE (tmp
) == ARRAY_TYPE
;
2144 tmp
= TREE_TYPE (tmp
))
2147 /* Avoid to print recursively the array. */
2148 /* FIXME : Not implemented correctly, see print_struct_decl. */
2149 if (TREE_CODE (tmp
) != POINTER_TYPE
|| TREE_TYPE (tmp
) != node
)
2150 dump_generic_node (pp
, tmp
, spc
, flags
, false);
2152 /* Print the dimensions. */
2153 for (tmp
= node
; TREE_CODE (tmp
) == ARRAY_TYPE
; tmp
= TREE_TYPE (tmp
))
2154 dump_array_domain (pp
, TYPE_DOMAIN (tmp
), spc
, flags
);
2160 case QUAL_UNION_TYPE
:
2162 unsigned int quals
= TYPE_QUALS (node
);
2164 if (quals
& TYPE_QUAL_ATOMIC
)
2165 pp_string (pp
, "atomic ");
2166 if (quals
& TYPE_QUAL_CONST
)
2167 pp_string (pp
, "const ");
2168 if (quals
& TYPE_QUAL_VOLATILE
)
2169 pp_string (pp
, "volatile ");
2171 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
2173 pp_string (pp
, "<address-space-");
2174 pp_decimal_int (pp
, TYPE_ADDR_SPACE (node
));
2175 pp_string (pp
, "> ");
2178 /* Print the name of the structure. */
2179 if (TREE_CODE (node
) == RECORD_TYPE
)
2180 pp_string (pp
, "struct ");
2181 else if (TREE_CODE (node
) == UNION_TYPE
)
2182 pp_string (pp
, "union ");
2184 if (TYPE_NAME (node
))
2185 dump_generic_node (pp
, TYPE_NAME (node
), spc
, flags
, false);
2186 else if (!(flags
& TDF_SLIM
))
2187 /* FIXME: If we eliminate the 'else' above and attempt
2188 to show the fields for named types, we may get stuck
2189 following a cycle of pointers to structs. The alleged
2190 self-reference check in print_struct_decl will not detect
2191 cycles involving more than one pointer or struct type. */
2192 print_struct_decl (pp
, node
, spc
, flags
);
2201 if (flags
& TDF_GIMPLE
2202 && (POINTER_TYPE_P (TREE_TYPE (node
))
2203 || (TYPE_PRECISION (TREE_TYPE (node
))
2204 < TYPE_PRECISION (integer_type_node
))
2205 || exact_log2 (TYPE_PRECISION (TREE_TYPE (node
))) == -1
2206 || tree_int_cst_sgn (node
) < 0))
2208 pp_string (pp
, "_Literal (");
2209 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2210 pp_string (pp
, ") ");
2212 if (TREE_CODE (TREE_TYPE (node
)) == POINTER_TYPE
2213 && ! (flags
& TDF_GIMPLE
))
2215 /* In the case of a pointer, one may want to divide by the
2216 size of the pointed-to type. Unfortunately, this not
2217 straightforward. The C front-end maps expressions
2222 in such a way that the two INTEGER_CST nodes for "5" have
2223 different values but identical types. In the latter
2224 case, the 5 is multiplied by sizeof (int) in c-common.cc
2225 (pointer_int_sum) to convert it to a byte address, and
2226 yet the type of the node is left unchanged. Argh. What
2227 is consistent though is that the number value corresponds
2228 to bytes (UNITS) offset.
2230 NB: Neither of the following divisors can be trivially
2231 used to recover the original literal:
2233 TREE_INT_CST_LOW (TYPE_SIZE_UNIT (TREE_TYPE (node)))
2234 TYPE_PRECISION (TREE_TYPE (TREE_TYPE (node))) */
2235 pp_wide_integer (pp
, TREE_INT_CST_LOW (node
));
2236 pp_string (pp
, "B"); /* pseudo-unit */
2238 else if (tree_fits_shwi_p (node
))
2239 pp_wide_integer (pp
, tree_to_shwi (node
));
2240 else if (tree_fits_uhwi_p (node
))
2241 pp_unsigned_wide_integer (pp
, tree_to_uhwi (node
));
2244 wide_int val
= wi::to_wide (node
);
2246 if (wi::neg_p (val
, TYPE_SIGN (TREE_TYPE (node
))))
2252 print_hex_buf_size (val
, &len
);
2253 if (UNLIKELY (len
> sizeof (pp_buffer (pp
)->digit_buffer
)))
2255 char *buf
= XALLOCAVEC (char, len
);
2256 print_hex (val
, buf
);
2257 pp_string (pp
, buf
);
2261 print_hex (val
, pp_buffer (pp
)->digit_buffer
);
2262 pp_string (pp
, pp_buffer (pp
)->digit_buffer
);
2265 if ((flags
& TDF_GIMPLE
)
2266 && ! (POINTER_TYPE_P (TREE_TYPE (node
))
2267 || (TYPE_PRECISION (TREE_TYPE (node
))
2268 < TYPE_PRECISION (integer_type_node
))
2269 || exact_log2 (TYPE_PRECISION (TREE_TYPE (node
))) == -1))
2271 if (TYPE_UNSIGNED (TREE_TYPE (node
)))
2272 pp_character (pp
, 'u');
2273 if (TYPE_PRECISION (TREE_TYPE (node
))
2274 == TYPE_PRECISION (unsigned_type_node
))
2276 else if (TYPE_PRECISION (TREE_TYPE (node
))
2277 == TYPE_PRECISION (long_unsigned_type_node
))
2278 pp_character (pp
, 'l');
2279 else if (TYPE_PRECISION (TREE_TYPE (node
))
2280 == TYPE_PRECISION (long_long_unsigned_type_node
))
2281 pp_string (pp
, "ll");
2283 if (TREE_OVERFLOW (node
))
2284 pp_string (pp
, "(OVF)");
2288 pp_string (pp
, "POLY_INT_CST [");
2289 dump_generic_node (pp
, POLY_INT_CST_COEFF (node
, 0), spc
, flags
, false);
2290 for (unsigned int i
= 1; i
< NUM_POLY_INT_COEFFS
; ++i
)
2292 pp_string (pp
, ", ");
2293 dump_generic_node (pp
, POLY_INT_CST_COEFF (node
, i
),
2296 pp_string (pp
, "]");
2300 /* Code copied from print_node. */
2303 if (TREE_OVERFLOW (node
))
2304 pp_string (pp
, " overflow");
2306 d
= TREE_REAL_CST (node
);
2307 if (REAL_VALUE_ISINF (d
))
2308 pp_string (pp
, REAL_VALUE_NEGATIVE (d
) ? " -Inf" : " Inf");
2309 else if (REAL_VALUE_ISNAN (d
))
2310 pp_string (pp
, " Nan");
2314 real_to_decimal (string
, &d
, sizeof (string
), 0, 1);
2315 pp_string (pp
, string
);
2323 fixed_to_decimal (string
, TREE_FIXED_CST_PTR (node
), sizeof (string
));
2324 pp_string (pp
, string
);
2329 pp_string (pp
, "__complex__ (");
2330 dump_generic_node (pp
, TREE_REALPART (node
), spc
, flags
, false);
2331 pp_string (pp
, ", ");
2332 dump_generic_node (pp
, TREE_IMAGPART (node
), spc
, flags
, false);
2333 pp_right_paren (pp
);
2338 pp_string (pp
, "\"");
2339 if (unsigned nbytes
= TREE_STRING_LENGTH (node
))
2340 pretty_print_string (pp
, TREE_STRING_POINTER (node
), nbytes
);
2341 pp_string (pp
, "\"");
2348 if (flags
& TDF_GIMPLE
)
2350 pp_string (pp
, "_Literal (");
2351 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2352 pp_string (pp
, ") ");
2354 pp_string (pp
, "{ ");
2355 unsigned HOST_WIDE_INT nunits
;
2356 if (!VECTOR_CST_NELTS (node
).is_constant (&nunits
))
2357 nunits
= vector_cst_encoded_nelts (node
);
2358 for (i
= 0; i
< nunits
; ++i
)
2361 pp_string (pp
, ", ");
2362 dump_generic_node (pp
, VECTOR_CST_ELT (node
, i
),
2365 if (!VECTOR_CST_NELTS (node
).is_constant ())
2366 pp_string (pp
, ", ...");
2367 pp_string (pp
, " }");
2373 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2375 if (TREE_CODE (node
) == METHOD_TYPE
)
2377 if (TYPE_METHOD_BASETYPE (node
))
2378 dump_generic_node (pp
, TYPE_NAME (TYPE_METHOD_BASETYPE (node
)),
2381 pp_string (pp
, "<null method basetype>");
2382 pp_colon_colon (pp
);
2384 if (TYPE_IDENTIFIER (node
))
2385 dump_generic_node (pp
, TYPE_NAME (node
), spc
, flags
, false);
2386 else if (TYPE_NAME (node
) && DECL_NAME (TYPE_NAME (node
)))
2387 dump_decl_name (pp
, TYPE_NAME (node
), flags
);
2388 else if (flags
& TDF_NOUID
)
2389 pp_string (pp
, "<Txxxx>");
2392 pp_string (pp
, "<T");
2393 pp_scalar (pp
, "%x", TYPE_UID (node
));
2394 pp_character (pp
, '>');
2396 dump_function_declaration (pp
, node
, spc
, flags
);
2401 dump_decl_name (pp
, node
, flags
);
2405 if (DECL_NAME (node
))
2406 dump_decl_name (pp
, node
, flags
);
2407 else if (LABEL_DECL_UID (node
) != -1)
2409 if (flags
& TDF_GIMPLE
)
2411 pp_character (pp
, 'L');
2412 pp_decimal_int (pp
, (int) LABEL_DECL_UID (node
));
2416 pp_string (pp
, "<L");
2417 pp_decimal_int (pp
, (int) LABEL_DECL_UID (node
));
2418 pp_character (pp
, '>');
2423 if (flags
& TDF_NOUID
)
2424 pp_string (pp
, "<D.xxxx>");
2427 if (flags
& TDF_GIMPLE
)
2429 pp_character (pp
, 'D');
2430 pp_scalar (pp
, "%u", DECL_UID (node
));
2434 pp_string (pp
, "<D.");
2435 pp_scalar (pp
, "%u", DECL_UID (node
));
2436 pp_character (pp
, '>');
2443 if (DECL_IS_UNDECLARED_BUILTIN (node
))
2445 /* Don't print the declaration of built-in types. */
2448 if (DECL_NAME (node
))
2449 dump_decl_name (pp
, node
, flags
);
2450 else if (TYPE_NAME (TREE_TYPE (node
)) != node
)
2452 pp_string (pp
, (TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
2453 ? "union" : "struct "));
2454 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2457 pp_string (pp
, "<anon>");
2463 case DEBUG_EXPR_DECL
:
2464 case NAMESPACE_DECL
:
2466 dump_decl_name (pp
, node
, flags
);
2470 pp_string (pp
, "<retval>");
2474 op0
= TREE_OPERAND (node
, 0);
2477 && (TREE_CODE (op0
) == INDIRECT_REF
2478 || (TREE_CODE (op0
) == MEM_REF
2479 && TREE_CODE (TREE_OPERAND (op0
, 0)) != ADDR_EXPR
2480 && integer_zerop (TREE_OPERAND (op0
, 1))
2481 /* Dump the types of INTEGER_CSTs explicitly, for we
2482 can't infer them and MEM_ATTR caching will share
2483 MEM_REFs with differently-typed op0s. */
2484 && TREE_CODE (TREE_OPERAND (op0
, 0)) != INTEGER_CST
2485 /* Released SSA_NAMES have no TREE_TYPE. */
2486 && TREE_TYPE (TREE_OPERAND (op0
, 0)) != NULL_TREE
2487 /* Same pointer types, but ignoring POINTER_TYPE vs.
2489 && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 0)))
2490 == TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 1))))
2491 && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0
, 0)))
2492 == TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0
, 1))))
2493 && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0
, 0)))
2494 == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0
, 1))))
2495 /* Same value types ignoring qualifiers. */
2496 && (TYPE_MAIN_VARIANT (TREE_TYPE (op0
))
2497 == TYPE_MAIN_VARIANT
2498 (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 1)))))
2499 && MR_DEPENDENCE_CLIQUE (op0
) == 0)))
2501 op0
= TREE_OPERAND (op0
, 0);
2504 if (op_prio (op0
) < op_prio (node
))
2506 dump_generic_node (pp
, op0
, spc
, flags
, false);
2507 if (op_prio (op0
) < op_prio (node
))
2508 pp_right_paren (pp
);
2509 pp_string (pp
, str
);
2510 op1
= TREE_OPERAND (node
, 1);
2511 dump_generic_node (pp
, op1
, spc
, flags
, false);
2512 if (DECL_P (op1
)) /* Not always a decl in the C++ FE. */
2513 if (tree off
= component_ref_field_offset (node
))
2514 if (TREE_CODE (off
) != INTEGER_CST
)
2516 pp_string (pp
, "{off: ");
2517 dump_generic_node (pp
, off
, spc
, flags
, false);
2518 pp_right_brace (pp
);
2523 if (flags
& TDF_GIMPLE
)
2525 pp_string (pp
, "__BIT_FIELD_REF <");
2526 dump_generic_node (pp
, TREE_TYPE (node
),
2527 spc
, flags
| TDF_SLIM
, false);
2528 if (TYPE_ALIGN (TREE_TYPE (node
))
2529 != TYPE_ALIGN (TYPE_MAIN_VARIANT (TREE_TYPE (node
))))
2531 pp_string (pp
, ", ");
2532 pp_decimal_int (pp
, TYPE_ALIGN (TREE_TYPE (node
)));
2535 pp_string (pp
, " (");
2536 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
,
2537 flags
| TDF_SLIM
, false);
2538 pp_string (pp
, ", ");
2539 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
,
2540 flags
| TDF_SLIM
, false);
2541 pp_string (pp
, ", ");
2542 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
,
2543 flags
| TDF_SLIM
, false);
2544 pp_right_paren (pp
);
2548 pp_string (pp
, "BIT_FIELD_REF <");
2549 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2550 pp_string (pp
, ", ");
2551 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2552 pp_string (pp
, ", ");
2553 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2558 case BIT_INSERT_EXPR
:
2559 pp_string (pp
, "BIT_INSERT_EXPR <");
2560 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2561 pp_string (pp
, ", ");
2562 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2563 pp_string (pp
, ", ");
2564 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2565 pp_string (pp
, " (");
2566 if (INTEGRAL_TYPE_P (TREE_TYPE (TREE_OPERAND (node
, 1))))
2568 TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (node
, 1))));
2570 dump_generic_node (pp
, TYPE_SIZE (TREE_TYPE (TREE_OPERAND (node
, 1))),
2572 pp_string (pp
, " bits)>");
2576 case ARRAY_RANGE_REF
:
2577 op0
= TREE_OPERAND (node
, 0);
2578 if (op_prio (op0
) < op_prio (node
))
2580 dump_generic_node (pp
, op0
, spc
, flags
, false);
2581 if (op_prio (op0
) < op_prio (node
))
2582 pp_right_paren (pp
);
2583 pp_left_bracket (pp
);
2584 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2585 if (TREE_CODE (node
) == ARRAY_RANGE_REF
)
2586 pp_string (pp
, " ...");
2587 pp_right_bracket (pp
);
2589 op0
= array_ref_low_bound (node
);
2590 op1
= array_ref_element_size (node
);
2592 if (!integer_zerop (op0
)
2593 || TREE_OPERAND (node
, 2)
2594 || TREE_OPERAND (node
, 3))
2596 pp_string (pp
, "{lb: ");
2597 dump_generic_node (pp
, op0
, spc
, flags
, false);
2598 pp_string (pp
, " sz: ");
2599 dump_generic_node (pp
, op1
, spc
, flags
, false);
2600 pp_right_brace (pp
);
2606 unsigned HOST_WIDE_INT ix
;
2608 bool is_struct_init
= false;
2609 bool is_array_init
= false;
2611 if (flags
& TDF_GIMPLE
)
2613 pp_string (pp
, "_Literal (");
2614 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2615 pp_string (pp
, ") ");
2618 if (TREE_CLOBBER_P (node
))
2620 pp_string (pp
, "CLOBBER");
2621 if (CLOBBER_KIND (node
) == CLOBBER_EOL
)
2622 pp_string (pp
, "(eol)");
2624 else if (TREE_CODE (TREE_TYPE (node
)) == RECORD_TYPE
2625 || TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
)
2626 is_struct_init
= true;
2627 else if (TREE_CODE (TREE_TYPE (node
)) == ARRAY_TYPE
2628 && TYPE_DOMAIN (TREE_TYPE (node
))
2629 && TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
)))
2630 && TREE_CODE (TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
))))
2633 tree minv
= TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
)));
2634 is_array_init
= true;
2635 curidx
= wi::to_widest (minv
);
2637 FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (node
), ix
, field
, val
)
2644 dump_generic_node (pp
, field
, spc
, flags
, false);
2647 else if (is_array_init
2648 && (TREE_CODE (field
) != INTEGER_CST
2649 || curidx
!= wi::to_widest (field
)))
2651 pp_left_bracket (pp
);
2652 if (TREE_CODE (field
) == RANGE_EXPR
)
2654 dump_generic_node (pp
, TREE_OPERAND (field
, 0), spc
,
2656 pp_string (pp
, " ... ");
2657 dump_generic_node (pp
, TREE_OPERAND (field
, 1), spc
,
2659 if (TREE_CODE (TREE_OPERAND (field
, 1)) == INTEGER_CST
)
2660 curidx
= wi::to_widest (TREE_OPERAND (field
, 1));
2663 dump_generic_node (pp
, field
, spc
, flags
, false);
2664 if (TREE_CODE (field
) == INTEGER_CST
)
2665 curidx
= wi::to_widest (field
);
2666 pp_string (pp
, "]=");
2671 if (val
&& TREE_CODE (val
) == ADDR_EXPR
)
2672 if (TREE_CODE (TREE_OPERAND (val
, 0)) == FUNCTION_DECL
)
2673 val
= TREE_OPERAND (val
, 0);
2674 if (val
&& TREE_CODE (val
) == FUNCTION_DECL
)
2675 dump_decl_name (pp
, val
, flags
);
2677 dump_generic_node (pp
, val
, spc
, flags
, false);
2678 if (ix
!= CONSTRUCTOR_NELTS (node
) - 1)
2684 pp_right_brace (pp
);
2691 if (flags
& TDF_SLIM
)
2693 pp_string (pp
, "<COMPOUND_EXPR>");
2697 dump_generic_node (pp
, TREE_OPERAND (node
, 0),
2698 spc
, flags
, !(flags
& TDF_SLIM
));
2699 if (flags
& TDF_SLIM
)
2700 newline_and_indent (pp
, spc
);
2707 for (tp
= &TREE_OPERAND (node
, 1);
2708 TREE_CODE (*tp
) == COMPOUND_EXPR
;
2709 tp
= &TREE_OPERAND (*tp
, 1))
2711 dump_generic_node (pp
, TREE_OPERAND (*tp
, 0),
2712 spc
, flags
, !(flags
& TDF_SLIM
));
2713 if (flags
& TDF_SLIM
)
2714 newline_and_indent (pp
, spc
);
2722 dump_generic_node (pp
, *tp
, spc
, flags
, !(flags
& TDF_SLIM
));
2726 case STATEMENT_LIST
:
2728 tree_stmt_iterator si
;
2731 if (flags
& TDF_SLIM
)
2733 pp_string (pp
, "<STATEMENT_LIST>");
2737 for (si
= tsi_start (node
); !tsi_end_p (si
); tsi_next (&si
))
2740 newline_and_indent (pp
, spc
);
2743 dump_generic_node (pp
, tsi_stmt (si
), spc
, flags
, true);
2750 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
,
2755 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
,
2760 pp_string (pp
, "TARGET_EXPR <");
2761 dump_generic_node (pp
, TARGET_EXPR_SLOT (node
), spc
, flags
, false);
2764 dump_generic_node (pp
, TARGET_EXPR_INITIAL (node
), spc
, flags
, false);
2769 print_declaration (pp
, DECL_EXPR_DECL (node
), spc
, flags
);
2774 if (TREE_TYPE (node
) == NULL
|| TREE_TYPE (node
) == void_type_node
)
2776 pp_string (pp
, "if (");
2777 dump_generic_node (pp
, COND_EXPR_COND (node
), spc
, flags
, false);
2778 pp_right_paren (pp
);
2779 /* The lowered cond_exprs should always be printed in full. */
2780 if (COND_EXPR_THEN (node
)
2781 && (IS_EMPTY_STMT (COND_EXPR_THEN (node
))
2782 || TREE_CODE (COND_EXPR_THEN (node
)) == GOTO_EXPR
)
2783 && COND_EXPR_ELSE (node
)
2784 && (IS_EMPTY_STMT (COND_EXPR_ELSE (node
))
2785 || TREE_CODE (COND_EXPR_ELSE (node
)) == GOTO_EXPR
))
2788 dump_generic_node (pp
, COND_EXPR_THEN (node
),
2790 if (!IS_EMPTY_STMT (COND_EXPR_ELSE (node
)))
2792 pp_string (pp
, " else ");
2793 dump_generic_node (pp
, COND_EXPR_ELSE (node
),
2797 else if (!(flags
& TDF_SLIM
))
2799 /* Output COND_EXPR_THEN. */
2800 if (COND_EXPR_THEN (node
))
2802 newline_and_indent (pp
, spc
+2);
2804 newline_and_indent (pp
, spc
+4);
2805 dump_generic_node (pp
, COND_EXPR_THEN (node
), spc
+4,
2807 newline_and_indent (pp
, spc
+2);
2808 pp_right_brace (pp
);
2811 /* Output COND_EXPR_ELSE. */
2812 if (COND_EXPR_ELSE (node
)
2813 && !IS_EMPTY_STMT (COND_EXPR_ELSE (node
)))
2815 newline_and_indent (pp
, spc
);
2816 pp_string (pp
, "else");
2817 newline_and_indent (pp
, spc
+2);
2819 newline_and_indent (pp
, spc
+4);
2820 dump_generic_node (pp
, COND_EXPR_ELSE (node
), spc
+4,
2822 newline_and_indent (pp
, spc
+2);
2823 pp_right_brace (pp
);
2830 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2834 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2838 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2844 if (!(flags
& TDF_SLIM
))
2846 if (BIND_EXPR_VARS (node
))
2850 for (op0
= BIND_EXPR_VARS (node
); op0
; op0
= DECL_CHAIN (op0
))
2852 print_declaration (pp
, op0
, spc
+2, flags
);
2857 newline_and_indent (pp
, spc
+2);
2858 dump_generic_node (pp
, BIND_EXPR_BODY (node
), spc
+2, flags
, true);
2859 newline_and_indent (pp
, spc
);
2860 pp_right_brace (pp
);
2866 if (CALL_EXPR_FN (node
) != NULL_TREE
)
2867 print_call_name (pp
, CALL_EXPR_FN (node
), flags
);
2871 pp_string (pp
, internal_fn_name (CALL_EXPR_IFN (node
)));
2874 /* Print parameters. */
2879 call_expr_arg_iterator iter
;
2880 FOR_EACH_CALL_EXPR_ARG (arg
, iter
, node
)
2882 dump_generic_node (pp
, arg
, spc
, flags
, false);
2883 if (more_call_expr_args_p (&iter
))
2890 if (CALL_EXPR_VA_ARG_PACK (node
))
2892 if (call_expr_nargs (node
) > 0)
2897 pp_string (pp
, "__builtin_va_arg_pack ()");
2899 pp_right_paren (pp
);
2901 op1
= CALL_EXPR_STATIC_CHAIN (node
);
2904 pp_string (pp
, " [static-chain: ");
2905 dump_generic_node (pp
, op1
, spc
, flags
, false);
2906 pp_right_bracket (pp
);
2909 if (CALL_EXPR_RETURN_SLOT_OPT (node
))
2910 pp_string (pp
, " [return slot optimization]");
2911 if (CALL_EXPR_TAILCALL (node
))
2912 pp_string (pp
, " [tail call]");
2915 case WITH_CLEANUP_EXPR
:
2919 case CLEANUP_POINT_EXPR
:
2920 pp_string (pp
, "<<cleanup_point ");
2921 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2922 pp_string (pp
, ">>");
2925 case PLACEHOLDER_EXPR
:
2926 pp_string (pp
, "<PLACEHOLDER_EXPR ");
2927 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2931 /* Binary arithmetic and logic expressions. */
2932 case WIDEN_SUM_EXPR
:
2933 case WIDEN_MULT_EXPR
:
2935 case MULT_HIGHPART_EXPR
:
2937 case POINTER_PLUS_EXPR
:
2938 case POINTER_DIFF_EXPR
:
2940 case TRUNC_DIV_EXPR
:
2942 case FLOOR_DIV_EXPR
:
2943 case ROUND_DIV_EXPR
:
2944 case TRUNC_MOD_EXPR
:
2946 case FLOOR_MOD_EXPR
:
2947 case ROUND_MOD_EXPR
:
2949 case EXACT_DIV_EXPR
:
2954 case WIDEN_LSHIFT_EXPR
:
2958 case TRUTH_ANDIF_EXPR
:
2959 case TRUTH_ORIF_EXPR
:
2960 case TRUTH_AND_EXPR
:
2962 case TRUTH_XOR_EXPR
:
2976 case UNORDERED_EXPR
:
2978 const char *op
= op_symbol (node
);
2979 op0
= TREE_OPERAND (node
, 0);
2980 op1
= TREE_OPERAND (node
, 1);
2982 /* When the operands are expressions with less priority,
2983 keep semantics of the tree representation. */
2984 if (op_prio (op0
) <= op_prio (node
))
2987 dump_generic_node (pp
, op0
, spc
, flags
, false);
2988 pp_right_paren (pp
);
2991 dump_generic_node (pp
, op0
, spc
, flags
, false);
2997 /* When the operands are expressions with less priority,
2998 keep semantics of the tree representation. */
2999 if (op_prio (op1
) <= op_prio (node
))
3002 dump_generic_node (pp
, op1
, spc
, flags
, false);
3003 pp_right_paren (pp
);
3006 dump_generic_node (pp
, op1
, spc
, flags
, false);
3010 /* Unary arithmetic and logic expressions. */
3012 if (flags
& TDF_GIMPLE_VAL
)
3014 pp_string (pp
, "_Literal (");
3015 dump_generic_node (pp
, TREE_TYPE (node
), spc
,
3016 flags
& ~TDF_GIMPLE_VAL
, false);
3017 pp_character (pp
, ')');
3022 case TRUTH_NOT_EXPR
:
3023 case PREDECREMENT_EXPR
:
3024 case PREINCREMENT_EXPR
:
3026 if (!(flags
& TDF_GIMPLE
)
3027 && TREE_CODE (node
) == ADDR_EXPR
3028 && (TREE_CODE (TREE_OPERAND (node
, 0)) == STRING_CST
3029 || TREE_CODE (TREE_OPERAND (node
, 0)) == FUNCTION_DECL
))
3030 /* Do not output '&' for strings and function pointers when not
3031 dumping GIMPLE FE syntax. */
3034 pp_string (pp
, op_symbol (node
));
3036 if (op_prio (TREE_OPERAND (node
, 0)) < op_prio (node
))
3039 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3040 pp_right_paren (pp
);
3043 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3046 case POSTDECREMENT_EXPR
:
3047 case POSTINCREMENT_EXPR
:
3048 if (op_prio (TREE_OPERAND (node
, 0)) < op_prio (node
))
3051 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3052 pp_right_paren (pp
);
3055 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3056 pp_string (pp
, op_symbol (node
));
3060 pp_string (pp
, "MIN_EXPR <");
3061 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3062 pp_string (pp
, ", ");
3063 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3068 pp_string (pp
, "MAX_EXPR <");
3069 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3070 pp_string (pp
, ", ");
3071 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3076 pp_string (pp
, "ABS_EXPR <");
3077 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3082 pp_string (pp
, "ABSU_EXPR <");
3083 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3091 case ADDR_SPACE_CONVERT_EXPR
:
3092 case FIXED_CONVERT_EXPR
:
3093 case FIX_TRUNC_EXPR
:
3096 type
= TREE_TYPE (node
);
3097 op0
= TREE_OPERAND (node
, 0);
3098 if (type
!= TREE_TYPE (op0
))
3101 dump_generic_node (pp
, type
, spc
, flags
, false);
3102 pp_string (pp
, ") ");
3104 if (op_prio (op0
) < op_prio (node
))
3106 dump_generic_node (pp
, op0
, spc
, flags
, false);
3107 if (op_prio (op0
) < op_prio (node
))
3108 pp_right_paren (pp
);
3111 case VIEW_CONVERT_EXPR
:
3112 if (flags
& TDF_GIMPLE
)
3113 pp_string (pp
, "__VIEW_CONVERT <");
3115 pp_string (pp
, "VIEW_CONVERT_EXPR<");
3116 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
3117 pp_string (pp
, ">(");
3118 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3119 pp_right_paren (pp
);
3123 pp_string (pp
, "((");
3124 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3125 pp_string (pp
, "))");
3128 case NON_LVALUE_EXPR
:
3129 pp_string (pp
, "NON_LVALUE_EXPR <");
3130 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3135 pp_string (pp
, "SAVE_EXPR <");
3136 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3141 pp_string (pp
, "COMPLEX_EXPR <");
3142 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3143 pp_string (pp
, ", ");
3144 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3149 pp_string (pp
, "CONJ_EXPR <");
3150 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3155 if (flags
& TDF_GIMPLE
)
3157 pp_string (pp
, "__real ");
3158 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3162 pp_string (pp
, "REALPART_EXPR <");
3163 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3169 if (flags
& TDF_GIMPLE
)
3171 pp_string (pp
, "__imag ");
3172 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3176 pp_string (pp
, "IMAGPART_EXPR <");
3177 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3183 pp_string (pp
, "VA_ARG_EXPR <");
3184 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3188 case TRY_FINALLY_EXPR
:
3189 case TRY_CATCH_EXPR
:
3190 pp_string (pp
, "try");
3191 newline_and_indent (pp
, spc
+2);
3193 newline_and_indent (pp
, spc
+4);
3194 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
+4, flags
, true);
3195 newline_and_indent (pp
, spc
+2);
3196 pp_right_brace (pp
);
3197 newline_and_indent (pp
, spc
);
3198 if (TREE_CODE (node
) == TRY_CATCH_EXPR
)
3200 node
= TREE_OPERAND (node
, 1);
3201 pp_string (pp
, "catch");
3205 gcc_assert (TREE_CODE (node
) == TRY_FINALLY_EXPR
);
3206 node
= TREE_OPERAND (node
, 1);
3207 pp_string (pp
, "finally");
3208 if (TREE_CODE (node
) == EH_ELSE_EXPR
)
3210 newline_and_indent (pp
, spc
+2);
3212 newline_and_indent (pp
, spc
+4);
3213 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
+4,
3215 newline_and_indent (pp
, spc
+2);
3216 pp_right_brace (pp
);
3217 newline_and_indent (pp
, spc
);
3218 node
= TREE_OPERAND (node
, 1);
3219 pp_string (pp
, "else");
3222 newline_and_indent (pp
, spc
+2);
3224 newline_and_indent (pp
, spc
+4);
3225 dump_generic_node (pp
, node
, spc
+4, flags
, true);
3226 newline_and_indent (pp
, spc
+2);
3227 pp_right_brace (pp
);
3232 pp_string (pp
, "catch (");
3233 dump_generic_node (pp
, CATCH_TYPES (node
), spc
+2, flags
, false);
3234 pp_right_paren (pp
);
3235 newline_and_indent (pp
, spc
+2);
3237 newline_and_indent (pp
, spc
+4);
3238 dump_generic_node (pp
, CATCH_BODY (node
), spc
+4, flags
, true);
3239 newline_and_indent (pp
, spc
+2);
3240 pp_right_brace (pp
);
3244 case EH_FILTER_EXPR
:
3245 pp_string (pp
, "<<<eh_filter (");
3246 dump_generic_node (pp
, EH_FILTER_TYPES (node
), spc
+2, flags
, false);
3247 pp_string (pp
, ")>>>");
3248 newline_and_indent (pp
, spc
+2);
3250 newline_and_indent (pp
, spc
+4);
3251 dump_generic_node (pp
, EH_FILTER_FAILURE (node
), spc
+4, flags
, true);
3252 newline_and_indent (pp
, spc
+2);
3253 pp_right_brace (pp
);
3258 op0
= TREE_OPERAND (node
, 0);
3259 /* If this is for break or continue, don't bother printing it. */
3260 if (DECL_NAME (op0
))
3262 const char *name
= IDENTIFIER_POINTER (DECL_NAME (op0
));
3263 if (strcmp (name
, "break") == 0
3264 || strcmp (name
, "continue") == 0)
3267 dump_generic_node (pp
, op0
, spc
, flags
, false);
3269 if (DECL_NONLOCAL (op0
))
3270 pp_string (pp
, " [non-local]");
3274 pp_string (pp
, "while (1)");
3275 if (!(flags
& TDF_SLIM
))
3277 newline_and_indent (pp
, spc
+2);
3279 newline_and_indent (pp
, spc
+4);
3280 dump_generic_node (pp
, LOOP_EXPR_BODY (node
), spc
+4, flags
, true);
3281 newline_and_indent (pp
, spc
+2);
3282 pp_right_brace (pp
);
3288 pp_string (pp
, "// predicted ");
3289 if (PREDICT_EXPR_OUTCOME (node
))
3290 pp_string (pp
, "likely by ");
3292 pp_string (pp
, "unlikely by ");
3293 pp_string (pp
, predictor_name (PREDICT_EXPR_PREDICTOR (node
)));
3294 pp_string (pp
, " predictor.");
3298 pp_string (pp
, "ANNOTATE_EXPR <");
3299 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3300 switch ((enum annot_expr_kind
) TREE_INT_CST_LOW (TREE_OPERAND (node
, 1)))
3302 case annot_expr_ivdep_kind
:
3303 pp_string (pp
, ", ivdep");
3305 case annot_expr_unroll_kind
:
3307 pp_string (pp
, ", unroll ");
3309 (int) TREE_INT_CST_LOW (TREE_OPERAND (node
, 2)));
3312 case annot_expr_no_vector_kind
:
3313 pp_string (pp
, ", no-vector");
3315 case annot_expr_vector_kind
:
3316 pp_string (pp
, ", vector");
3318 case annot_expr_parallel_kind
:
3319 pp_string (pp
, ", parallel");
3328 pp_string (pp
, "return");
3329 op0
= TREE_OPERAND (node
, 0);
3333 if (TREE_CODE (op0
) == MODIFY_EXPR
)
3334 dump_generic_node (pp
, TREE_OPERAND (op0
, 1),
3337 dump_generic_node (pp
, op0
, spc
, flags
, false);
3342 pp_string (pp
, "if (");
3343 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3344 pp_string (pp
, ") break");
3348 pp_string (pp
, "switch (");
3349 dump_generic_node (pp
, SWITCH_COND (node
), spc
, flags
, false);
3350 pp_right_paren (pp
);
3351 if (!(flags
& TDF_SLIM
))
3353 newline_and_indent (pp
, spc
+2);
3355 if (SWITCH_BODY (node
))
3357 newline_and_indent (pp
, spc
+4);
3358 dump_generic_node (pp
, SWITCH_BODY (node
), spc
+4, flags
,
3361 newline_and_indent (pp
, spc
+2);
3362 pp_right_brace (pp
);
3368 op0
= GOTO_DESTINATION (node
);
3369 if (TREE_CODE (op0
) != SSA_NAME
&& DECL_P (op0
) && DECL_NAME (op0
))
3371 const char *name
= IDENTIFIER_POINTER (DECL_NAME (op0
));
3372 if (strcmp (name
, "break") == 0
3373 || strcmp (name
, "continue") == 0)
3375 pp_string (pp
, name
);
3379 pp_string (pp
, "goto ");
3380 dump_generic_node (pp
, op0
, spc
, flags
, false);
3384 pp_string (pp
, "__asm__");
3385 if (ASM_VOLATILE_P (node
))
3386 pp_string (pp
, " __volatile__");
3388 dump_generic_node (pp
, ASM_STRING (node
), spc
, flags
, false);
3390 dump_generic_node (pp
, ASM_OUTPUTS (node
), spc
, flags
, false);
3392 dump_generic_node (pp
, ASM_INPUTS (node
), spc
, flags
, false);
3393 if (ASM_CLOBBERS (node
))
3396 dump_generic_node (pp
, ASM_CLOBBERS (node
), spc
, flags
, false);
3398 pp_right_paren (pp
);
3401 case CASE_LABEL_EXPR
:
3402 if (CASE_LOW (node
) && CASE_HIGH (node
))
3404 pp_string (pp
, "case ");
3405 dump_generic_node (pp
, CASE_LOW (node
), spc
, flags
, false);
3406 pp_string (pp
, " ... ");
3407 dump_generic_node (pp
, CASE_HIGH (node
), spc
, flags
, false);
3409 else if (CASE_LOW (node
))
3411 pp_string (pp
, "case ");
3412 dump_generic_node (pp
, CASE_LOW (node
), spc
, flags
, false);
3415 pp_string (pp
, "default");
3420 pp_string (pp
, "OBJ_TYPE_REF(");
3421 dump_generic_node (pp
, OBJ_TYPE_REF_EXPR (node
), spc
, flags
, false);
3423 /* We omit the class type for -fcompare-debug because we may
3424 drop TYPE_BINFO early depending on debug info, and then
3425 virtual_method_call_p would return false, whereas when
3426 TYPE_BINFO is preserved it may still return true and then
3427 we'd print the class type. Compare tree and rtl dumps for
3428 libstdc++-prettyprinters/shared_ptr.cc with and without -g,
3429 for example, at occurrences of OBJ_TYPE_REF. */
3430 if (!(flags
& (TDF_SLIM
| TDF_COMPARE_DEBUG
))
3431 && virtual_method_call_p (node
, true))
3433 pp_string (pp
, "(");
3434 dump_generic_node (pp
, obj_type_ref_class (node
, true),
3436 pp_string (pp
, ")");
3438 dump_generic_node (pp
, OBJ_TYPE_REF_OBJECT (node
), spc
, flags
, false);
3440 dump_generic_node (pp
, OBJ_TYPE_REF_TOKEN (node
), spc
, flags
, false);
3441 pp_right_paren (pp
);
3445 if (SSA_NAME_IDENTIFIER (node
))
3447 if ((flags
& TDF_NOUID
)
3448 && SSA_NAME_VAR (node
)
3449 && DECL_NAMELESS (SSA_NAME_VAR (node
)))
3450 dump_fancy_name (pp
, SSA_NAME_IDENTIFIER (node
));
3451 else if (! (flags
& TDF_GIMPLE
)
3452 || SSA_NAME_VAR (node
))
3453 dump_generic_node (pp
, SSA_NAME_IDENTIFIER (node
),
3457 pp_decimal_int (pp
, SSA_NAME_VERSION (node
));
3458 if (SSA_NAME_IS_DEFAULT_DEF (node
))
3459 pp_string (pp
, "(D)");
3460 if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (node
))
3461 pp_string (pp
, "(ab)");
3464 case WITH_SIZE_EXPR
:
3465 pp_string (pp
, "WITH_SIZE_EXPR <");
3466 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3467 pp_string (pp
, ", ");
3468 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3473 pp_string (pp
, "scev_known");
3476 case SCEV_NOT_KNOWN
:
3477 pp_string (pp
, "scev_not_known");
3480 case POLYNOMIAL_CHREC
:
3482 dump_generic_node (pp
, CHREC_LEFT (node
), spc
, flags
, false);
3483 pp_string (pp
, ", +, ");
3484 dump_generic_node (pp
, CHREC_RIGHT (node
), spc
, flags
, false);
3485 pp_string (pp
, "}_");
3486 pp_scalar (pp
, "%u", CHREC_VARIABLE (node
));
3490 case REALIGN_LOAD_EXPR
:
3491 pp_string (pp
, "REALIGN_LOAD <");
3492 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3493 pp_string (pp
, ", ");
3494 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3495 pp_string (pp
, ", ");
3496 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3501 pp_string (pp
, " VEC_COND_EXPR < ");
3502 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3503 pp_string (pp
, " , ");
3504 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3505 pp_string (pp
, " , ");
3506 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3507 pp_string (pp
, " > ");
3511 pp_string (pp
, " VEC_PERM_EXPR < ");
3512 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3513 pp_string (pp
, " , ");
3514 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3515 pp_string (pp
, " , ");
3516 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3517 pp_string (pp
, " > ");
3521 pp_string (pp
, " DOT_PROD_EXPR < ");
3522 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3523 pp_string (pp
, ", ");
3524 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3525 pp_string (pp
, ", ");
3526 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3527 pp_string (pp
, " > ");
3530 case WIDEN_MULT_PLUS_EXPR
:
3531 pp_string (pp
, " WIDEN_MULT_PLUS_EXPR < ");
3532 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3533 pp_string (pp
, ", ");
3534 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3535 pp_string (pp
, ", ");
3536 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3537 pp_string (pp
, " > ");
3540 case WIDEN_MULT_MINUS_EXPR
:
3541 pp_string (pp
, " WIDEN_MULT_MINUS_EXPR < ");
3542 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3543 pp_string (pp
, ", ");
3544 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3545 pp_string (pp
, ", ");
3546 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3547 pp_string (pp
, " > ");
3551 pp_string (pp
, "#pragma acc parallel");
3552 goto dump_omp_clauses_body
;
3555 pp_string (pp
, "#pragma acc kernels");
3556 goto dump_omp_clauses_body
;
3559 pp_string (pp
, "#pragma acc serial");
3560 goto dump_omp_clauses_body
;
3563 pp_string (pp
, "#pragma acc data");
3564 dump_omp_clauses (pp
, OACC_DATA_CLAUSES (node
), spc
, flags
);
3567 case OACC_HOST_DATA
:
3568 pp_string (pp
, "#pragma acc host_data");
3569 dump_omp_clauses (pp
, OACC_HOST_DATA_CLAUSES (node
), spc
, flags
);
3573 pp_string (pp
, "#pragma acc declare");
3574 dump_omp_clauses (pp
, OACC_DECLARE_CLAUSES (node
), spc
, flags
);
3578 pp_string (pp
, "#pragma acc update");
3579 dump_omp_clauses (pp
, OACC_UPDATE_CLAUSES (node
), spc
, flags
);
3582 case OACC_ENTER_DATA
:
3583 pp_string (pp
, "#pragma acc enter data");
3584 dump_omp_clauses (pp
, OACC_ENTER_DATA_CLAUSES (node
), spc
, flags
);
3587 case OACC_EXIT_DATA
:
3588 pp_string (pp
, "#pragma acc exit data");
3589 dump_omp_clauses (pp
, OACC_EXIT_DATA_CLAUSES (node
), spc
, flags
);
3593 pp_string (pp
, "#pragma acc cache");
3594 dump_omp_clauses (pp
, OACC_CACHE_CLAUSES (node
), spc
, flags
);
3598 pp_string (pp
, "#pragma omp parallel");
3599 dump_omp_clauses (pp
, OMP_PARALLEL_CLAUSES (node
), spc
, flags
);
3602 dump_omp_clauses_body
:
3603 dump_omp_clauses (pp
, OMP_CLAUSES (node
), spc
, flags
);
3607 if (!(flags
& TDF_SLIM
) && OMP_BODY (node
))
3609 newline_and_indent (pp
, spc
+ 2);
3611 newline_and_indent (pp
, spc
+ 4);
3612 dump_generic_node (pp
, OMP_BODY (node
), spc
+ 4, flags
, false);
3613 newline_and_indent (pp
, spc
+ 2);
3614 pp_right_brace (pp
);
3620 pp_string (pp
, OMP_TASK_BODY (node
) ? "#pragma omp task"
3621 : "#pragma omp taskwait");
3622 dump_omp_clauses (pp
, OMP_TASK_CLAUSES (node
), spc
, flags
);
3626 pp_string (pp
, "#pragma omp for");
3630 pp_string (pp
, "#pragma omp simd");
3633 case OMP_DISTRIBUTE
:
3634 pp_string (pp
, "#pragma omp distribute");
3638 pp_string (pp
, "#pragma omp taskloop");
3642 pp_string (pp
, "#pragma omp loop");
3646 pp_string (pp
, "#pragma acc loop");
3650 pp_string (pp
, "#pragma omp teams");
3651 dump_omp_clauses (pp
, OMP_TEAMS_CLAUSES (node
), spc
, flags
);
3654 case OMP_TARGET_DATA
:
3655 pp_string (pp
, "#pragma omp target data");
3656 dump_omp_clauses (pp
, OMP_TARGET_DATA_CLAUSES (node
), spc
, flags
);
3659 case OMP_TARGET_ENTER_DATA
:
3660 pp_string (pp
, "#pragma omp target enter data");
3661 dump_omp_clauses (pp
, OMP_TARGET_ENTER_DATA_CLAUSES (node
), spc
, flags
);
3665 case OMP_TARGET_EXIT_DATA
:
3666 pp_string (pp
, "#pragma omp target exit data");
3667 dump_omp_clauses (pp
, OMP_TARGET_EXIT_DATA_CLAUSES (node
), spc
, flags
);
3672 pp_string (pp
, "#pragma omp target");
3673 dump_omp_clauses (pp
, OMP_TARGET_CLAUSES (node
), spc
, flags
);
3676 case OMP_TARGET_UPDATE
:
3677 pp_string (pp
, "#pragma omp target update");
3678 dump_omp_clauses (pp
, OMP_TARGET_UPDATE_CLAUSES (node
), spc
, flags
);
3683 dump_omp_clauses (pp
, OMP_FOR_CLAUSES (node
), spc
, flags
);
3684 if (!(flags
& TDF_SLIM
))
3688 if (OMP_FOR_PRE_BODY (node
))
3690 newline_and_indent (pp
, spc
+ 2);
3693 newline_and_indent (pp
, spc
);
3694 dump_generic_node (pp
, OMP_FOR_PRE_BODY (node
),
3697 if (OMP_FOR_INIT (node
))
3700 for (i
= 0; i
< TREE_VEC_LENGTH (OMP_FOR_INIT (node
)); i
++)
3703 newline_and_indent (pp
, spc
);
3704 pp_string (pp
, "for (");
3705 tree init
= TREE_VEC_ELT (OMP_FOR_INIT (node
), i
);
3706 if (TREE_CODE (init
) != MODIFY_EXPR
3707 || TREE_CODE (TREE_OPERAND (init
, 1)) != TREE_VEC
)
3708 dump_generic_node (pp
, init
, spc
, flags
, false);
3711 dump_generic_node (pp
, TREE_OPERAND (init
, 0),
3713 pp_string (pp
, " = ");
3714 dump_omp_loop_non_rect_expr (pp
, TREE_OPERAND (init
, 1),
3717 pp_string (pp
, "; ");
3718 tree cond
= TREE_VEC_ELT (OMP_FOR_COND (node
), i
);
3719 if (!COMPARISON_CLASS_P (cond
)
3720 || TREE_CODE (TREE_OPERAND (cond
, 1)) != TREE_VEC
)
3721 dump_generic_node (pp
, cond
, spc
, flags
, false);
3724 dump_generic_node (pp
, TREE_OPERAND (cond
, 0),
3726 const char *op
= op_symbol (cond
);
3730 dump_omp_loop_non_rect_expr (pp
, TREE_OPERAND (cond
, 1),
3733 pp_string (pp
, "; ");
3734 dump_generic_node (pp
,
3735 TREE_VEC_ELT (OMP_FOR_INCR (node
), i
),
3737 pp_right_paren (pp
);
3740 if (OMP_FOR_BODY (node
))
3742 newline_and_indent (pp
, spc
+ 2);
3744 newline_and_indent (pp
, spc
+ 4);
3745 dump_generic_node (pp
, OMP_FOR_BODY (node
), spc
+ 4, flags
,
3747 newline_and_indent (pp
, spc
+ 2);
3748 pp_right_brace (pp
);
3750 if (OMP_FOR_INIT (node
))
3751 spc
-= 2 * TREE_VEC_LENGTH (OMP_FOR_INIT (node
)) - 2;
3752 if (OMP_FOR_PRE_BODY (node
))
3755 newline_and_indent (pp
, spc
+ 2);
3756 pp_right_brace (pp
);
3763 pp_string (pp
, "#pragma omp sections");
3764 dump_omp_clauses (pp
, OMP_SECTIONS_CLAUSES (node
), spc
, flags
);
3768 pp_string (pp
, "#pragma omp section");
3771 case OMP_STRUCTURED_BLOCK
:
3772 pp_string (pp
, "#pragma omp __structured_block");
3776 if (OMP_SCAN_CLAUSES (node
))
3778 pp_string (pp
, "#pragma omp scan");
3779 dump_omp_clauses (pp
, OMP_SCAN_CLAUSES (node
), spc
, flags
);
3784 pp_string (pp
, "#pragma omp master");
3788 pp_string (pp
, "#pragma omp masked");
3789 dump_omp_clauses (pp
, OMP_MASKED_CLAUSES (node
), spc
, flags
);
3793 pp_string (pp
, "#pragma omp taskgroup");
3794 dump_omp_clauses (pp
, OMP_TASKGROUP_CLAUSES (node
), spc
, flags
);
3798 pp_string (pp
, "#pragma omp ordered");
3799 dump_omp_clauses (pp
, OMP_ORDERED_CLAUSES (node
), spc
, flags
);
3803 pp_string (pp
, "#pragma omp critical");
3804 if (OMP_CRITICAL_NAME (node
))
3808 dump_generic_node (pp
, OMP_CRITICAL_NAME (node
), spc
,
3810 pp_right_paren (pp
);
3812 dump_omp_clauses (pp
, OMP_CRITICAL_CLAUSES (node
), spc
, flags
);
3816 pp_string (pp
, "#pragma omp atomic");
3817 if (OMP_ATOMIC_WEAK (node
))
3818 pp_string (pp
, " weak");
3819 dump_omp_atomic_memory_order (pp
, OMP_ATOMIC_MEMORY_ORDER (node
));
3820 newline_and_indent (pp
, spc
+ 2);
3821 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3825 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3828 case OMP_ATOMIC_READ
:
3829 pp_string (pp
, "#pragma omp atomic read");
3830 dump_omp_atomic_memory_order (pp
, OMP_ATOMIC_MEMORY_ORDER (node
));
3831 newline_and_indent (pp
, spc
+ 2);
3832 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3836 case OMP_ATOMIC_CAPTURE_OLD
:
3837 case OMP_ATOMIC_CAPTURE_NEW
:
3838 pp_string (pp
, "#pragma omp atomic capture");
3839 if (OMP_ATOMIC_WEAK (node
))
3840 pp_string (pp
, " weak");
3841 dump_omp_atomic_memory_order (pp
, OMP_ATOMIC_MEMORY_ORDER (node
));
3842 newline_and_indent (pp
, spc
+ 2);
3843 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3847 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3851 pp_string (pp
, "#pragma omp single");
3852 dump_omp_clauses (pp
, OMP_SINGLE_CLAUSES (node
), spc
, flags
);
3856 pp_string (pp
, "#pragma omp scope");
3857 dump_omp_clauses (pp
, OMP_SCOPE_CLAUSES (node
), spc
, flags
);
3861 /* If we come here, we're dumping something that's not an OMP construct,
3862 for example, OMP clauses attached to a function's '__attribute__'.
3863 Dump the whole OMP clause chain. */
3864 dump_omp_clauses (pp
, node
, spc
, flags
, false);
3868 case TRANSACTION_EXPR
:
3869 if (TRANSACTION_EXPR_OUTER (node
))
3870 pp_string (pp
, "__transaction_atomic [[outer]]");
3871 else if (TRANSACTION_EXPR_RELAXED (node
))
3872 pp_string (pp
, "__transaction_relaxed");
3874 pp_string (pp
, "__transaction_atomic");
3875 if (!(flags
& TDF_SLIM
) && TRANSACTION_EXPR_BODY (node
))
3877 newline_and_indent (pp
, spc
);
3879 newline_and_indent (pp
, spc
+ 2);
3880 dump_generic_node (pp
, TRANSACTION_EXPR_BODY (node
),
3881 spc
+ 2, flags
, false);
3882 newline_and_indent (pp
, spc
);
3883 pp_right_brace (pp
);
3888 case VEC_SERIES_EXPR
:
3889 case VEC_WIDEN_MULT_HI_EXPR
:
3890 case VEC_WIDEN_MULT_LO_EXPR
:
3891 case VEC_WIDEN_MULT_EVEN_EXPR
:
3892 case VEC_WIDEN_MULT_ODD_EXPR
:
3893 case VEC_WIDEN_LSHIFT_HI_EXPR
:
3894 case VEC_WIDEN_LSHIFT_LO_EXPR
:
3896 for (str
= get_tree_code_name (code
); *str
; str
++)
3897 pp_character (pp
, TOUPPER (*str
));
3898 pp_string (pp
, " < ");
3899 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3900 pp_string (pp
, ", ");
3901 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3902 pp_string (pp
, " > ");
3905 case VEC_DUPLICATE_EXPR
:
3907 for (str
= get_tree_code_name (code
); *str
; str
++)
3908 pp_character (pp
, TOUPPER (*str
));
3909 pp_string (pp
, " < ");
3910 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3911 pp_string (pp
, " > ");
3914 case VEC_UNPACK_HI_EXPR
:
3915 pp_string (pp
, " VEC_UNPACK_HI_EXPR < ");
3916 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3917 pp_string (pp
, " > ");
3920 case VEC_UNPACK_LO_EXPR
:
3921 pp_string (pp
, " VEC_UNPACK_LO_EXPR < ");
3922 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3923 pp_string (pp
, " > ");
3926 case VEC_UNPACK_FLOAT_HI_EXPR
:
3927 pp_string (pp
, " VEC_UNPACK_FLOAT_HI_EXPR < ");
3928 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3929 pp_string (pp
, " > ");
3932 case VEC_UNPACK_FLOAT_LO_EXPR
:
3933 pp_string (pp
, " VEC_UNPACK_FLOAT_LO_EXPR < ");
3934 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3935 pp_string (pp
, " > ");
3938 case VEC_UNPACK_FIX_TRUNC_HI_EXPR
:
3939 pp_string (pp
, " VEC_UNPACK_FIX_TRUNC_HI_EXPR < ");
3940 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3941 pp_string (pp
, " > ");
3944 case VEC_UNPACK_FIX_TRUNC_LO_EXPR
:
3945 pp_string (pp
, " VEC_UNPACK_FIX_TRUNC_LO_EXPR < ");
3946 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3947 pp_string (pp
, " > ");
3950 case VEC_PACK_TRUNC_EXPR
:
3951 pp_string (pp
, " VEC_PACK_TRUNC_EXPR < ");
3952 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3953 pp_string (pp
, ", ");
3954 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3955 pp_string (pp
, " > ");
3958 case VEC_PACK_SAT_EXPR
:
3959 pp_string (pp
, " VEC_PACK_SAT_EXPR < ");
3960 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3961 pp_string (pp
, ", ");
3962 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3963 pp_string (pp
, " > ");
3966 case VEC_PACK_FIX_TRUNC_EXPR
:
3967 pp_string (pp
, " VEC_PACK_FIX_TRUNC_EXPR < ");
3968 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3969 pp_string (pp
, ", ");
3970 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3971 pp_string (pp
, " > ");
3974 case VEC_PACK_FLOAT_EXPR
:
3975 pp_string (pp
, " VEC_PACK_FLOAT_EXPR < ");
3976 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3977 pp_string (pp
, ", ");
3978 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3979 pp_string (pp
, " > ");
3983 dump_block_node (pp
, node
, spc
, flags
);
3986 case DEBUG_BEGIN_STMT
:
3987 pp_string (pp
, "# DEBUG BEGIN STMT");
3994 if (is_stmt
&& is_expr
)
4000 /* Print the declaration of a variable. */
4003 print_declaration (pretty_printer
*pp
, tree t
, int spc
, dump_flags_t flags
)
4007 if (TREE_CODE(t
) == NAMELIST_DECL
)
4009 pp_string(pp
, "namelist ");
4010 dump_decl_name (pp
, t
, flags
);
4015 if (TREE_CODE (t
) == TYPE_DECL
)
4016 pp_string (pp
, "typedef ");
4018 if (HAS_RTL_P (t
) && DECL_REGISTER (t
))
4019 pp_string (pp
, "register ");
4021 if (TREE_PUBLIC (t
) && DECL_EXTERNAL (t
))
4022 pp_string (pp
, "extern ");
4023 else if (TREE_STATIC (t
))
4024 pp_string (pp
, "static ");
4026 /* Print the type and name. */
4027 if (TREE_TYPE (t
) && TREE_CODE (TREE_TYPE (t
)) == ARRAY_TYPE
)
4031 /* Print array's type. */
4032 tmp
= TREE_TYPE (t
);
4033 while (TREE_CODE (TREE_TYPE (tmp
)) == ARRAY_TYPE
)
4034 tmp
= TREE_TYPE (tmp
);
4035 dump_generic_node (pp
, TREE_TYPE (tmp
), spc
, flags
, false);
4037 /* Print variable's name. */
4039 dump_generic_node (pp
, t
, spc
, flags
, false);
4041 /* Print the dimensions. */
4042 tmp
= TREE_TYPE (t
);
4043 while (TREE_CODE (tmp
) == ARRAY_TYPE
)
4045 dump_array_domain (pp
, TYPE_DOMAIN (tmp
), spc
, flags
);
4046 tmp
= TREE_TYPE (tmp
);
4049 else if (TREE_CODE (t
) == FUNCTION_DECL
)
4051 dump_generic_node (pp
, TREE_TYPE (TREE_TYPE (t
)), spc
, flags
, false);
4053 dump_decl_name (pp
, t
, flags
);
4054 dump_function_declaration (pp
, TREE_TYPE (t
), spc
, flags
);
4058 /* Print type declaration. */
4059 dump_generic_node (pp
, TREE_TYPE (t
), spc
, flags
, false);
4061 /* Print variable's name. */
4063 dump_generic_node (pp
, t
, spc
, flags
, false);
4066 if (VAR_P (t
) && DECL_HARD_REGISTER (t
))
4068 pp_string (pp
, " __asm__ ");
4070 dump_generic_node (pp
, DECL_ASSEMBLER_NAME (t
), spc
, flags
, false);
4071 pp_right_paren (pp
);
4074 /* The initial value of a function serves to determine whether the function
4075 is declared or defined. So the following does not apply to function
4077 if (TREE_CODE (t
) != FUNCTION_DECL
)
4079 /* Print the initial value. */
4080 if (DECL_INITIAL (t
))
4085 if (!(flags
& TDF_SLIM
))
4086 dump_generic_node (pp
, DECL_INITIAL (t
), spc
, flags
, false);
4088 pp_string (pp
, "<<< omitted >>>");
4092 if (VAR_P (t
) && DECL_HAS_VALUE_EXPR_P (t
))
4094 pp_string (pp
, " [value-expr: ");
4095 dump_generic_node (pp
, DECL_VALUE_EXPR (t
), spc
, flags
, false);
4096 pp_right_bracket (pp
);
4103 /* Prints a structure: name, fields, and methods.
4104 FIXME: Still incomplete. */
4107 print_struct_decl (pretty_printer
*pp
, const_tree node
, int spc
,
4110 /* Print the name of the structure. */
4111 if (TYPE_NAME (node
))
4114 if (TREE_CODE (node
) == RECORD_TYPE
)
4115 pp_string (pp
, "struct ");
4116 else if ((TREE_CODE (node
) == UNION_TYPE
4117 || TREE_CODE (node
) == QUAL_UNION_TYPE
))
4118 pp_string (pp
, "union ");
4120 dump_generic_node (pp
, TYPE_NAME (node
), spc
, TDF_NONE
, false);
4123 /* Print the contents of the structure. */
4129 /* Print the fields of the structure. */
4132 tmp
= TYPE_FIELDS (node
);
4135 /* Avoid to print recursively the structure. */
4136 /* FIXME : Not implemented correctly...,
4137 what about the case when we have a cycle in the contain graph? ...
4138 Maybe this could be solved by looking at the scope in which the
4139 structure was declared. */
4140 if (TREE_TYPE (tmp
) != node
4141 && (TREE_CODE (TREE_TYPE (tmp
)) != POINTER_TYPE
4142 || TREE_TYPE (TREE_TYPE (tmp
)) != node
))
4144 print_declaration (pp
, tmp
, spc
+2, flags
);
4147 tmp
= DECL_CHAIN (tmp
);
4151 pp_right_brace (pp
);
4154 /* Return the priority of the operator CODE.
4156 From lowest to highest precedence with either left-to-right (L-R)
4157 or right-to-left (R-L) associativity]:
4160 2 [R-L] = += -= *= /= %= &= ^= |= <<= >>=
4172 14 [R-L] ! ~ ++ -- + - * & (type) sizeof
4173 15 [L-R] fn() [] -> .
4175 unary +, - and * have higher precedence than the corresponding binary
4179 op_code_prio (enum tree_code code
)
4196 case TRUTH_ORIF_EXPR
:
4199 case TRUTH_AND_EXPR
:
4200 case TRUTH_ANDIF_EXPR
:
4207 case TRUTH_XOR_EXPR
:
4224 case UNORDERED_EXPR
:
4235 case VEC_WIDEN_LSHIFT_HI_EXPR
:
4236 case VEC_WIDEN_LSHIFT_LO_EXPR
:
4237 case WIDEN_LSHIFT_EXPR
:
4240 case WIDEN_SUM_EXPR
:
4242 case POINTER_PLUS_EXPR
:
4243 case POINTER_DIFF_EXPR
:
4247 case VEC_WIDEN_MULT_HI_EXPR
:
4248 case VEC_WIDEN_MULT_LO_EXPR
:
4249 case WIDEN_MULT_EXPR
:
4251 case WIDEN_MULT_PLUS_EXPR
:
4252 case WIDEN_MULT_MINUS_EXPR
:
4254 case MULT_HIGHPART_EXPR
:
4255 case TRUNC_DIV_EXPR
:
4257 case FLOOR_DIV_EXPR
:
4258 case ROUND_DIV_EXPR
:
4260 case EXACT_DIV_EXPR
:
4261 case TRUNC_MOD_EXPR
:
4263 case FLOOR_MOD_EXPR
:
4264 case ROUND_MOD_EXPR
:
4267 case TRUTH_NOT_EXPR
:
4269 case POSTINCREMENT_EXPR
:
4270 case POSTDECREMENT_EXPR
:
4271 case PREINCREMENT_EXPR
:
4272 case PREDECREMENT_EXPR
:
4278 case FIX_TRUNC_EXPR
:
4284 case ARRAY_RANGE_REF
:
4288 /* Special expressions. */
4294 case VEC_UNPACK_HI_EXPR
:
4295 case VEC_UNPACK_LO_EXPR
:
4296 case VEC_UNPACK_FLOAT_HI_EXPR
:
4297 case VEC_UNPACK_FLOAT_LO_EXPR
:
4298 case VEC_UNPACK_FIX_TRUNC_HI_EXPR
:
4299 case VEC_UNPACK_FIX_TRUNC_LO_EXPR
:
4300 case VEC_PACK_TRUNC_EXPR
:
4301 case VEC_PACK_SAT_EXPR
:
4305 /* Return an arbitrarily high precedence to avoid surrounding single
4306 VAR_DECLs in ()s. */
4311 /* Return the priority of the operator OP. */
4314 op_prio (const_tree op
)
4316 enum tree_code code
;
4321 code
= TREE_CODE (op
);
4322 if (code
== SAVE_EXPR
|| code
== NON_LVALUE_EXPR
)
4323 return op_prio (TREE_OPERAND (op
, 0));
4325 return op_code_prio (code
);
4328 /* Return the symbol associated with operator CODE. */
4331 op_symbol_code (enum tree_code code
, dump_flags_t flags
)
4339 case TRUTH_ORIF_EXPR
:
4342 case TRUTH_AND_EXPR
:
4343 case TRUTH_ANDIF_EXPR
:
4349 case TRUTH_XOR_EXPR
:
4358 return (flags
& TDF_GIMPLE
) ? "__ORDERED" : "ord";
4359 case UNORDERED_EXPR
:
4360 return (flags
& TDF_GIMPLE
) ? "__UNORDERED" : "unord";
4365 return (flags
& TDF_GIMPLE
) ? "__UNEQ" : "u==";
4373 return (flags
& TDF_GIMPLE
) ? "__UNLT" : "u<";
4378 return (flags
& TDF_GIMPLE
) ? "__UNLE" : "u<=";
4383 return (flags
& TDF_GIMPLE
) ? "__UNGT" : "u>";
4388 return (flags
& TDF_GIMPLE
) ? "__UNGE" : "u>=";
4391 return (flags
& TDF_GIMPLE
) ? "__LTGT" : "<>";
4405 case WIDEN_LSHIFT_EXPR
:
4408 case POINTER_PLUS_EXPR
:
4414 case WIDEN_SUM_EXPR
:
4417 case WIDEN_MULT_EXPR
:
4420 case MULT_HIGHPART_EXPR
:
4421 return (flags
& TDF_GIMPLE
) ? "__MULT_HIGHPART" : "h*";
4425 case POINTER_DIFF_EXPR
:
4431 case TRUTH_NOT_EXPR
:
4438 case TRUNC_DIV_EXPR
:
4445 case FLOOR_DIV_EXPR
:
4448 case ROUND_DIV_EXPR
:
4451 case EXACT_DIV_EXPR
:
4454 case TRUNC_MOD_EXPR
:
4460 case FLOOR_MOD_EXPR
:
4463 case ROUND_MOD_EXPR
:
4466 case PREDECREMENT_EXPR
:
4469 case PREINCREMENT_EXPR
:
4472 case POSTDECREMENT_EXPR
:
4475 case POSTINCREMENT_EXPR
:
4485 return "<<< ??? >>>";
4489 /* Return the symbol associated with operator OP. */
4492 op_symbol (const_tree op
, dump_flags_t flags
)
4494 return op_symbol_code (TREE_CODE (op
), flags
);
4497 /* Prints the name of a call. NODE is the CALL_EXPR_FN of a CALL_EXPR or
4498 the gimple_call_fn of a GIMPLE_CALL. */
4501 print_call_name (pretty_printer
*pp
, tree node
, dump_flags_t flags
)
4506 if (TREE_CODE (op0
) == NON_LVALUE_EXPR
)
4507 op0
= TREE_OPERAND (op0
, 0);
4510 switch (TREE_CODE (op0
))
4515 dump_function_name (pp
, op0
, flags
);
4521 op0
= TREE_OPERAND (op0
, 0);
4526 dump_generic_node (pp
, TREE_OPERAND (op0
, 0), 0, flags
, false);
4527 pp_string (pp
, ") ? ");
4528 dump_generic_node (pp
, TREE_OPERAND (op0
, 1), 0, flags
, false);
4529 pp_string (pp
, " : ");
4530 dump_generic_node (pp
, TREE_OPERAND (op0
, 2), 0, flags
, false);
4534 if (VAR_P (TREE_OPERAND (op0
, 0)))
4535 dump_function_name (pp
, TREE_OPERAND (op0
, 0), flags
);
4537 dump_generic_node (pp
, op0
, 0, flags
, false);
4541 if (integer_zerop (TREE_OPERAND (op0
, 1)))
4543 op0
= TREE_OPERAND (op0
, 0);
4550 dump_generic_node (pp
, op0
, 0, flags
, false);
4558 /* Print the first N characters in the array STR, replacing non-printable
4559 characters (including embedded nuls) with unambiguous escape sequences. */
4562 pretty_print_string (pretty_printer
*pp
, const char *str
, size_t n
)
4567 for ( ; n
; --n
, ++str
)
4572 pp_string (pp
, "\\b");
4576 pp_string (pp
, "\\f");
4580 pp_string (pp
, "\\n");
4584 pp_string (pp
, "\\r");
4588 pp_string (pp
, "\\t");
4592 pp_string (pp
, "\\v");
4596 pp_string (pp
, "\\\\");
4600 pp_string (pp
, "\\\"");
4604 pp_string (pp
, "\\'");
4608 if (str
[0] || n
> 1)
4610 if (!ISPRINT (str
[0]))
4613 sprintf (buf
, "\\x%02x", (unsigned char)str
[0]);
4614 pp_string (pp
, buf
);
4617 pp_character (pp
, str
[0]);
4625 maybe_init_pretty_print (FILE *file
)
4629 tree_pp
= new pretty_printer ();
4630 pp_needs_newline (tree_pp
) = true;
4631 pp_translate_identifiers (tree_pp
) = false;
4634 tree_pp
->buffer
->stream
= file
;
4638 newline_and_indent (pretty_printer
*pp
, int spc
)
4644 /* Print the identifier ID to PRETTY-PRINTER. */
4647 pp_tree_identifier (pretty_printer
*pp
, tree id
)
4649 if (pp_translate_identifiers (pp
))
4651 const char *text
= identifier_to_locale (IDENTIFIER_POINTER (id
));
4652 pp_append_text (pp
, text
, text
+ strlen (text
));
4655 pp_append_text (pp
, IDENTIFIER_POINTER (id
),
4656 IDENTIFIER_POINTER (id
) + IDENTIFIER_LENGTH (id
));
4659 /* A helper function that is used to dump function information before the
4663 dump_function_header (FILE *dump_file
, tree fdecl
, dump_flags_t flags
)
4665 const char *dname
, *aname
;
4666 struct cgraph_node
*node
= cgraph_node::get (fdecl
);
4667 struct function
*fun
= DECL_STRUCT_FUNCTION (fdecl
);
4669 dname
= lang_hooks
.decl_printable_name (fdecl
, 1);
4671 if (DECL_ASSEMBLER_NAME_SET_P (fdecl
))
4672 aname
= (IDENTIFIER_POINTER
4673 (DECL_ASSEMBLER_NAME (fdecl
)));
4675 aname
= "<unset-asm-name>";
4677 fprintf (dump_file
, "\n;; Function %s (%s, funcdef_no=%d",
4678 dname
, aname
, fun
->funcdef_no
);
4679 if (!(flags
& TDF_NOUID
))
4680 fprintf (dump_file
, ", decl_uid=%d", DECL_UID (fdecl
));
4683 fprintf (dump_file
, ", cgraph_uid=%d", node
->get_uid ());
4684 fprintf (dump_file
, ", symbol_order=%d)%s\n\n", node
->order
,
4685 node
->frequency
== NODE_FREQUENCY_HOT
4687 : node
->frequency
== NODE_FREQUENCY_UNLIKELY_EXECUTED
4688 ? " (unlikely executed)"
4689 : node
->frequency
== NODE_FREQUENCY_EXECUTED_ONCE
4690 ? " (executed once)"
4694 fprintf (dump_file
, ")\n\n");
4697 /* Dump double_int D to pretty_printer PP. UNS is true
4698 if D is unsigned and false otherwise. */
4700 pp_double_int (pretty_printer
*pp
, double_int d
, bool uns
)
4703 pp_wide_integer (pp
, d
.low
);
4704 else if (d
.fits_uhwi ())
4705 pp_unsigned_wide_integer (pp
, d
.low
);
4708 unsigned HOST_WIDE_INT low
= d
.low
;
4709 HOST_WIDE_INT high
= d
.high
;
4710 if (!uns
&& d
.is_negative ())
4713 high
= ~high
+ !low
;
4716 /* Would "%x%0*x" or "%x%*0x" get zero-padding on all
4718 sprintf (pp_buffer (pp
)->digit_buffer
,
4719 HOST_WIDE_INT_PRINT_DOUBLE_HEX
,
4720 (unsigned HOST_WIDE_INT
) high
, low
);
4721 pp_string (pp
, pp_buffer (pp
)->digit_buffer
);
4726 # pragma GCC diagnostic pop