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_SELF
:
591 pp_string (pp
, "self(");
592 dump_generic_node (pp
, OMP_CLAUSE_SELF_EXPR (clause
),
597 case OMP_CLAUSE_NUM_THREADS
:
598 pp_string (pp
, "num_threads(");
599 dump_generic_node (pp
, OMP_CLAUSE_NUM_THREADS_EXPR (clause
),
604 case OMP_CLAUSE_NOWAIT
:
605 pp_string (pp
, "nowait");
607 case OMP_CLAUSE_ORDERED
:
608 pp_string (pp
, "ordered");
609 if (OMP_CLAUSE_ORDERED_EXPR (clause
))
612 dump_generic_node (pp
, OMP_CLAUSE_ORDERED_EXPR (clause
),
618 case OMP_CLAUSE_DEFAULT
:
619 pp_string (pp
, "default(");
620 switch (OMP_CLAUSE_DEFAULT_KIND (clause
))
622 case OMP_CLAUSE_DEFAULT_UNSPECIFIED
:
624 case OMP_CLAUSE_DEFAULT_SHARED
:
625 pp_string (pp
, "shared");
627 case OMP_CLAUSE_DEFAULT_NONE
:
628 pp_string (pp
, "none");
630 case OMP_CLAUSE_DEFAULT_PRIVATE
:
631 pp_string (pp
, "private");
633 case OMP_CLAUSE_DEFAULT_FIRSTPRIVATE
:
634 pp_string (pp
, "firstprivate");
636 case OMP_CLAUSE_DEFAULT_PRESENT
:
637 pp_string (pp
, "present");
645 case OMP_CLAUSE_SCHEDULE
:
646 pp_string (pp
, "schedule(");
647 if (OMP_CLAUSE_SCHEDULE_KIND (clause
)
648 & (OMP_CLAUSE_SCHEDULE_MONOTONIC
649 | OMP_CLAUSE_SCHEDULE_NONMONOTONIC
))
651 if (OMP_CLAUSE_SCHEDULE_KIND (clause
)
652 & OMP_CLAUSE_SCHEDULE_MONOTONIC
)
653 pp_string (pp
, "monotonic");
655 pp_string (pp
, "nonmonotonic");
656 if (OMP_CLAUSE_SCHEDULE_SIMD (clause
))
661 if (OMP_CLAUSE_SCHEDULE_SIMD (clause
))
662 pp_string (pp
, "simd:");
664 switch (OMP_CLAUSE_SCHEDULE_KIND (clause
) & OMP_CLAUSE_SCHEDULE_MASK
)
666 case OMP_CLAUSE_SCHEDULE_STATIC
:
667 pp_string (pp
, "static");
669 case OMP_CLAUSE_SCHEDULE_DYNAMIC
:
670 pp_string (pp
, "dynamic");
672 case OMP_CLAUSE_SCHEDULE_GUIDED
:
673 pp_string (pp
, "guided");
675 case OMP_CLAUSE_SCHEDULE_RUNTIME
:
676 pp_string (pp
, "runtime");
678 case OMP_CLAUSE_SCHEDULE_AUTO
:
679 pp_string (pp
, "auto");
684 if (OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (clause
))
687 dump_generic_node (pp
, OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (clause
),
693 case OMP_CLAUSE_UNTIED
:
694 pp_string (pp
, "untied");
697 case OMP_CLAUSE_COLLAPSE
:
698 pp_string (pp
, "collapse(");
699 dump_generic_node (pp
, OMP_CLAUSE_COLLAPSE_EXPR (clause
),
704 case OMP_CLAUSE_FINAL
:
705 pp_string (pp
, "final(");
706 dump_generic_node (pp
, OMP_CLAUSE_FINAL_EXPR (clause
),
711 case OMP_CLAUSE_MERGEABLE
:
712 pp_string (pp
, "mergeable");
715 case OMP_CLAUSE_LINEAR
:
716 pp_string (pp
, "linear(");
717 if (OMP_CLAUSE_LINEAR_OLD_LINEAR_MODIFIER (clause
))
718 switch (OMP_CLAUSE_LINEAR_KIND (clause
))
720 case OMP_CLAUSE_LINEAR_DEFAULT
:
722 case OMP_CLAUSE_LINEAR_REF
:
723 pp_string (pp
, "ref(");
725 case OMP_CLAUSE_LINEAR_VAL
:
726 pp_string (pp
, "val(");
728 case OMP_CLAUSE_LINEAR_UVAL
:
729 pp_string (pp
, "uval(");
734 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
736 if (OMP_CLAUSE_LINEAR_OLD_LINEAR_MODIFIER (clause
)
737 && OMP_CLAUSE_LINEAR_KIND (clause
) != OMP_CLAUSE_LINEAR_DEFAULT
)
740 if (!OMP_CLAUSE_LINEAR_OLD_LINEAR_MODIFIER (clause
)
741 && OMP_CLAUSE_LINEAR_KIND (clause
) != OMP_CLAUSE_LINEAR_DEFAULT
)
742 switch (OMP_CLAUSE_LINEAR_KIND (clause
))
744 case OMP_CLAUSE_LINEAR_REF
:
745 pp_string (pp
, "ref,step(");
747 case OMP_CLAUSE_LINEAR_VAL
:
748 pp_string (pp
, "val,step(");
750 case OMP_CLAUSE_LINEAR_UVAL
:
751 pp_string (pp
, "uval,step(");
756 dump_generic_node (pp
, OMP_CLAUSE_LINEAR_STEP (clause
),
758 if (!OMP_CLAUSE_LINEAR_OLD_LINEAR_MODIFIER (clause
)
759 && OMP_CLAUSE_LINEAR_KIND (clause
) != OMP_CLAUSE_LINEAR_DEFAULT
)
764 case OMP_CLAUSE_ALIGNED
:
765 pp_string (pp
, "aligned(");
766 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
768 if (OMP_CLAUSE_ALIGNED_ALIGNMENT (clause
))
771 dump_generic_node (pp
, OMP_CLAUSE_ALIGNED_ALIGNMENT (clause
),
777 case OMP_CLAUSE_ALLOCATE
:
778 pp_string (pp
, "allocate(");
779 if (OMP_CLAUSE_ALLOCATE_ALLOCATOR (clause
))
781 pp_string (pp
, "allocator(");
782 dump_generic_node (pp
, OMP_CLAUSE_ALLOCATE_ALLOCATOR (clause
),
786 if (OMP_CLAUSE_ALLOCATE_ALIGN (clause
))
788 if (OMP_CLAUSE_ALLOCATE_ALLOCATOR (clause
))
790 pp_string (pp
, "align(");
791 dump_generic_node (pp
, OMP_CLAUSE_ALLOCATE_ALIGN (clause
),
795 if (OMP_CLAUSE_ALLOCATE_ALLOCATOR (clause
)
796 || OMP_CLAUSE_ALLOCATE_ALIGN (clause
))
798 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
803 case OMP_CLAUSE_AFFINITY
:
804 pp_string (pp
, "affinity(");
806 tree t
= OMP_CLAUSE_DECL (clause
);
807 if (TREE_CODE (t
) == TREE_LIST
809 && TREE_CODE (TREE_PURPOSE (t
)) == TREE_VEC
)
811 dump_omp_iterators (pp
, TREE_PURPOSE (t
), spc
, flags
);
815 dump_generic_node (pp
, t
, spc
, flags
, false);
819 case OMP_CLAUSE_DEPEND
:
820 pp_string (pp
, "depend(");
821 switch (OMP_CLAUSE_DEPEND_KIND (clause
))
823 case OMP_CLAUSE_DEPEND_DEPOBJ
:
826 case OMP_CLAUSE_DEPEND_IN
:
829 case OMP_CLAUSE_DEPEND_OUT
:
832 case OMP_CLAUSE_DEPEND_INOUT
:
835 case OMP_CLAUSE_DEPEND_MUTEXINOUTSET
:
836 name
= "mutexinoutset";
838 case OMP_CLAUSE_DEPEND_INOUTSET
:
841 case OMP_CLAUSE_DEPEND_LAST
:
842 name
= "__internal__";
848 tree t
= OMP_CLAUSE_DECL (clause
);
849 if (TREE_CODE (t
) == TREE_LIST
851 && TREE_CODE (TREE_PURPOSE (t
)) == TREE_VEC
)
853 dump_omp_iterators (pp
, TREE_PURPOSE (t
), spc
, flags
);
859 pp_string (pp
, name
);
862 if (t
== null_pointer_node
)
863 pp_string (pp
, "omp_all_memory");
865 dump_generic_node (pp
, t
, spc
, flags
, false);
870 case OMP_CLAUSE_DOACROSS
:
871 pp_string (pp
, OMP_CLAUSE_DOACROSS_DEPEND (clause
)
872 ? "depend(" : "doacross(");
873 switch (OMP_CLAUSE_DOACROSS_KIND (clause
))
875 case OMP_CLAUSE_DOACROSS_SOURCE
:
876 if (OMP_CLAUSE_DOACROSS_DEPEND (clause
))
877 pp_string (pp
, "source)");
879 pp_string (pp
, "source:)");
881 case OMP_CLAUSE_DOACROSS_SINK
:
882 pp_string (pp
, "sink:");
883 if (OMP_CLAUSE_DECL (clause
) == NULL_TREE
)
885 pp_string (pp
, "omp_cur_iteration-1)");
888 for (tree t
= OMP_CLAUSE_DECL (clause
); t
; t
= TREE_CHAIN (t
))
889 if (TREE_CODE (t
) == TREE_LIST
)
891 dump_generic_node (pp
, TREE_VALUE (t
), spc
, flags
, false);
892 if (TREE_PURPOSE (t
) != integer_zero_node
)
894 if (OMP_CLAUSE_DOACROSS_SINK_NEGATIVE (t
))
898 dump_generic_node (pp
, TREE_PURPOSE (t
), spc
, flags
,
914 pp_string (pp
, "map(");
915 switch (OMP_CLAUSE_MAP_KIND (clause
))
918 case GOMP_MAP_POINTER
:
919 case GOMP_MAP_POINTER_TO_ZERO_LENGTH_ARRAY_SECTION
:
920 pp_string (pp
, "alloc");
922 case GOMP_MAP_IF_PRESENT
:
923 pp_string (pp
, "no_alloc");
926 case GOMP_MAP_TO_PSET
:
927 pp_string (pp
, "to");
930 pp_string (pp
, "from");
932 case GOMP_MAP_TOFROM
:
933 pp_string (pp
, "tofrom");
935 case GOMP_MAP_FORCE_ALLOC
:
936 pp_string (pp
, "force_alloc");
938 case GOMP_MAP_FORCE_TO
:
939 pp_string (pp
, "force_to");
941 case GOMP_MAP_FORCE_FROM
:
942 pp_string (pp
, "force_from");
944 case GOMP_MAP_FORCE_TOFROM
:
945 pp_string (pp
, "force_tofrom");
947 case GOMP_MAP_FORCE_PRESENT
:
948 pp_string (pp
, "force_present");
950 case GOMP_MAP_DELETE
:
951 pp_string (pp
, "delete");
953 case GOMP_MAP_FORCE_DEVICEPTR
:
954 pp_string (pp
, "force_deviceptr");
956 case GOMP_MAP_ALWAYS_TO
:
957 pp_string (pp
, "always,to");
959 case GOMP_MAP_ALWAYS_FROM
:
960 pp_string (pp
, "always,from");
962 case GOMP_MAP_ALWAYS_TOFROM
:
963 pp_string (pp
, "always,tofrom");
965 case GOMP_MAP_RELEASE
:
966 pp_string (pp
, "release");
968 case GOMP_MAP_FIRSTPRIVATE_POINTER
:
969 pp_string (pp
, "firstprivate");
971 case GOMP_MAP_FIRSTPRIVATE_REFERENCE
:
972 pp_string (pp
, "firstprivate ref");
974 case GOMP_MAP_STRUCT
:
975 pp_string (pp
, "struct");
977 case GOMP_MAP_ALWAYS_POINTER
:
978 pp_string (pp
, "always_pointer");
980 case GOMP_MAP_DEVICE_RESIDENT
:
981 pp_string (pp
, "device_resident");
984 pp_string (pp
, "link");
986 case GOMP_MAP_ATTACH
:
987 pp_string (pp
, "attach");
989 case GOMP_MAP_DETACH
:
990 pp_string (pp
, "detach");
992 case GOMP_MAP_FORCE_DETACH
:
993 pp_string (pp
, "force_detach");
995 case GOMP_MAP_ATTACH_DETACH
:
996 pp_string (pp
, "attach_detach");
998 case GOMP_MAP_ATTACH_ZERO_LENGTH_ARRAY_SECTION
:
999 pp_string (pp
, "attach_zero_length_array_section");
1001 case GOMP_MAP_PRESENT_ALLOC
:
1002 pp_string (pp
, "present,alloc");
1004 case GOMP_MAP_PRESENT_TO
:
1005 pp_string (pp
, "present,to");
1007 case GOMP_MAP_PRESENT_FROM
:
1008 pp_string (pp
, "present,from");
1010 case GOMP_MAP_PRESENT_TOFROM
:
1011 pp_string (pp
, "present,tofrom");
1013 case GOMP_MAP_ALWAYS_PRESENT_TO
:
1014 pp_string (pp
, "always,present,to");
1016 case GOMP_MAP_ALWAYS_PRESENT_FROM
:
1017 pp_string (pp
, "always,present,from");
1019 case GOMP_MAP_ALWAYS_PRESENT_TOFROM
:
1020 pp_string (pp
, "always,present,tofrom");
1026 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
1029 if (OMP_CLAUSE_SIZE (clause
))
1031 switch (OMP_CLAUSE_CODE (clause
) == OMP_CLAUSE_MAP
1032 ? OMP_CLAUSE_MAP_KIND (clause
) : GOMP_MAP_TO
)
1034 case GOMP_MAP_POINTER
:
1035 case GOMP_MAP_FIRSTPRIVATE_POINTER
:
1036 case GOMP_MAP_FIRSTPRIVATE_REFERENCE
:
1037 case GOMP_MAP_ALWAYS_POINTER
:
1038 pp_string (pp
, " [pointer assign, bias: ");
1040 case GOMP_MAP_POINTER_TO_ZERO_LENGTH_ARRAY_SECTION
:
1041 pp_string (pp
, " [pointer assign, zero-length array section, bias: ");
1043 case GOMP_MAP_TO_PSET
:
1044 pp_string (pp
, " [pointer set, len: ");
1046 case GOMP_MAP_ATTACH
:
1047 case GOMP_MAP_DETACH
:
1048 case GOMP_MAP_FORCE_DETACH
:
1049 case GOMP_MAP_ATTACH_DETACH
:
1050 case GOMP_MAP_ATTACH_ZERO_LENGTH_ARRAY_SECTION
:
1051 pp_string (pp
, " [bias: ");
1054 pp_string (pp
, " [len: ");
1057 dump_generic_node (pp
, OMP_CLAUSE_SIZE (clause
),
1059 pp_right_bracket (pp
);
1061 if (OMP_CLAUSE_CODE (clause
) == OMP_CLAUSE_MAP
1062 && OMP_CLAUSE_MAP_RUNTIME_IMPLICIT_P (clause
))
1063 pp_string (pp
, "[implicit]");
1064 pp_right_paren (pp
);
1067 case OMP_CLAUSE_FROM
:
1068 pp_string (pp
, "from(");
1069 if (OMP_CLAUSE_MOTION_PRESENT (clause
))
1070 pp_string (pp
, "present:");
1071 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
1073 goto print_clause_size
;
1076 pp_string (pp
, "to(");
1077 if (OMP_CLAUSE_MOTION_PRESENT (clause
))
1078 pp_string (pp
, "present:");
1079 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
1081 goto print_clause_size
;
1083 case OMP_CLAUSE__CACHE_
:
1084 pp_string (pp
, "(");
1085 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
),
1087 goto print_clause_size
;
1089 case OMP_CLAUSE_NUM_TEAMS
:
1090 pp_string (pp
, "num_teams(");
1091 if (OMP_CLAUSE_NUM_TEAMS_LOWER_EXPR (clause
))
1093 dump_generic_node (pp
, OMP_CLAUSE_NUM_TEAMS_LOWER_EXPR (clause
),
1097 dump_generic_node (pp
, OMP_CLAUSE_NUM_TEAMS_UPPER_EXPR (clause
),
1099 pp_right_paren (pp
);
1102 case OMP_CLAUSE_THREAD_LIMIT
:
1103 pp_string (pp
, "thread_limit(");
1104 dump_generic_node (pp
, OMP_CLAUSE_THREAD_LIMIT_EXPR (clause
),
1106 pp_right_paren (pp
);
1109 case OMP_CLAUSE_DEVICE
:
1110 pp_string (pp
, "device(");
1111 if (OMP_CLAUSE_DEVICE_ANCESTOR (clause
))
1112 pp_string (pp
, "ancestor:");
1113 dump_generic_node (pp
, OMP_CLAUSE_DEVICE_ID (clause
),
1115 pp_right_paren (pp
);
1118 case OMP_CLAUSE_DIST_SCHEDULE
:
1119 pp_string (pp
, "dist_schedule(static");
1120 if (OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR (clause
))
1123 dump_generic_node (pp
,
1124 OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR (clause
),
1127 pp_right_paren (pp
);
1130 case OMP_CLAUSE_PROC_BIND
:
1131 pp_string (pp
, "proc_bind(");
1132 switch (OMP_CLAUSE_PROC_BIND_KIND (clause
))
1134 case OMP_CLAUSE_PROC_BIND_MASTER
:
1135 /* Same enum value: case OMP_CLAUSE_PROC_BIND_PRIMARY: */
1136 /* TODO: Change to 'primary' for OpenMP 5.1. */
1137 pp_string (pp
, "master");
1139 case OMP_CLAUSE_PROC_BIND_CLOSE
:
1140 pp_string (pp
, "close");
1142 case OMP_CLAUSE_PROC_BIND_SPREAD
:
1143 pp_string (pp
, "spread");
1148 pp_right_paren (pp
);
1151 case OMP_CLAUSE_DEVICE_TYPE
:
1152 pp_string (pp
, "device_type(");
1153 switch (OMP_CLAUSE_DEVICE_TYPE_KIND (clause
))
1155 case OMP_CLAUSE_DEVICE_TYPE_HOST
:
1156 pp_string (pp
, "host");
1158 case OMP_CLAUSE_DEVICE_TYPE_NOHOST
:
1159 pp_string (pp
, "nohost");
1161 case OMP_CLAUSE_DEVICE_TYPE_ANY
:
1162 pp_string (pp
, "any");
1167 pp_right_paren (pp
);
1170 case OMP_CLAUSE_SAFELEN
:
1171 pp_string (pp
, "safelen(");
1172 dump_generic_node (pp
, OMP_CLAUSE_SAFELEN_EXPR (clause
),
1174 pp_right_paren (pp
);
1177 case OMP_CLAUSE_SIMDLEN
:
1178 pp_string (pp
, "simdlen(");
1179 dump_generic_node (pp
, OMP_CLAUSE_SIMDLEN_EXPR (clause
),
1181 pp_right_paren (pp
);
1184 case OMP_CLAUSE_PRIORITY
:
1185 pp_string (pp
, "priority(");
1186 dump_generic_node (pp
, OMP_CLAUSE_PRIORITY_EXPR (clause
),
1188 pp_right_paren (pp
);
1191 case OMP_CLAUSE_GRAINSIZE
:
1192 pp_string (pp
, "grainsize(");
1193 if (OMP_CLAUSE_GRAINSIZE_STRICT (clause
))
1194 pp_string (pp
, "strict:");
1195 dump_generic_node (pp
, OMP_CLAUSE_GRAINSIZE_EXPR (clause
),
1197 pp_right_paren (pp
);
1200 case OMP_CLAUSE_NUM_TASKS
:
1201 pp_string (pp
, "num_tasks(");
1202 if (OMP_CLAUSE_NUM_TASKS_STRICT (clause
))
1203 pp_string (pp
, "strict:");
1204 dump_generic_node (pp
, OMP_CLAUSE_NUM_TASKS_EXPR (clause
),
1206 pp_right_paren (pp
);
1209 case OMP_CLAUSE_HINT
:
1210 pp_string (pp
, "hint(");
1211 dump_generic_node (pp
, OMP_CLAUSE_HINT_EXPR (clause
),
1213 pp_right_paren (pp
);
1216 case OMP_CLAUSE_FILTER
:
1217 pp_string (pp
, "filter(");
1218 dump_generic_node (pp
, OMP_CLAUSE_FILTER_EXPR (clause
),
1220 pp_right_paren (pp
);
1223 case OMP_CLAUSE_DEFAULTMAP
:
1224 pp_string (pp
, "defaultmap(");
1225 switch (OMP_CLAUSE_DEFAULTMAP_BEHAVIOR (clause
))
1227 case OMP_CLAUSE_DEFAULTMAP_ALLOC
:
1228 pp_string (pp
, "alloc");
1230 case OMP_CLAUSE_DEFAULTMAP_TO
:
1231 pp_string (pp
, "to");
1233 case OMP_CLAUSE_DEFAULTMAP_FROM
:
1234 pp_string (pp
, "from");
1236 case OMP_CLAUSE_DEFAULTMAP_TOFROM
:
1237 pp_string (pp
, "tofrom");
1239 case OMP_CLAUSE_DEFAULTMAP_FIRSTPRIVATE
:
1240 pp_string (pp
, "firstprivate");
1242 case OMP_CLAUSE_DEFAULTMAP_NONE
:
1243 pp_string (pp
, "none");
1245 case OMP_CLAUSE_DEFAULTMAP_PRESENT
:
1246 pp_string (pp
, "present");
1248 case OMP_CLAUSE_DEFAULTMAP_DEFAULT
:
1249 pp_string (pp
, "default");
1254 switch (OMP_CLAUSE_DEFAULTMAP_CATEGORY (clause
))
1256 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_UNSPECIFIED
:
1258 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_ALL
:
1259 pp_string (pp
, ":all");
1261 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_SCALAR
:
1262 pp_string (pp
, ":scalar");
1264 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_AGGREGATE
:
1265 pp_string (pp
, ":aggregate");
1267 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_ALLOCATABLE
:
1268 pp_string (pp
, ":allocatable");
1270 case OMP_CLAUSE_DEFAULTMAP_CATEGORY_POINTER
:
1271 pp_string (pp
, ":pointer");
1276 pp_right_paren (pp
);
1279 case OMP_CLAUSE_ORDER
:
1280 pp_string (pp
, "order(");
1281 if (OMP_CLAUSE_ORDER_UNCONSTRAINED (clause
))
1282 pp_string (pp
, "unconstrained:");
1283 else if (OMP_CLAUSE_ORDER_REPRODUCIBLE (clause
))
1284 pp_string (pp
, "reproducible:");
1285 pp_string (pp
, "concurrent)");
1288 case OMP_CLAUSE_BIND
:
1289 pp_string (pp
, "bind(");
1290 switch (OMP_CLAUSE_BIND_KIND (clause
))
1292 case OMP_CLAUSE_BIND_TEAMS
:
1293 pp_string (pp
, "teams");
1295 case OMP_CLAUSE_BIND_PARALLEL
:
1296 pp_string (pp
, "parallel");
1298 case OMP_CLAUSE_BIND_THREAD
:
1299 pp_string (pp
, "thread");
1304 pp_right_paren (pp
);
1307 case OMP_CLAUSE__SIMDUID_
:
1308 pp_string (pp
, "_simduid_(");
1309 dump_generic_node (pp
, OMP_CLAUSE__SIMDUID__DECL (clause
),
1311 pp_right_paren (pp
);
1314 case OMP_CLAUSE__SIMT_
:
1315 pp_string (pp
, "_simt_");
1318 case OMP_CLAUSE_GANG
:
1319 pp_string (pp
, "gang");
1320 if (OMP_CLAUSE_GANG_EXPR (clause
) != NULL_TREE
)
1322 pp_string (pp
, "(num: ");
1323 dump_generic_node (pp
, OMP_CLAUSE_GANG_EXPR (clause
),
1326 if (OMP_CLAUSE_GANG_STATIC_EXPR (clause
) != NULL_TREE
)
1328 if (OMP_CLAUSE_GANG_EXPR (clause
) == NULL_TREE
)
1332 pp_string (pp
, "static:");
1333 if (OMP_CLAUSE_GANG_STATIC_EXPR (clause
)
1334 == integer_minus_one_node
)
1335 pp_character (pp
, '*');
1337 dump_generic_node (pp
, OMP_CLAUSE_GANG_STATIC_EXPR (clause
),
1340 if (OMP_CLAUSE_GANG_EXPR (clause
) != NULL_TREE
1341 || OMP_CLAUSE_GANG_STATIC_EXPR (clause
) != NULL_TREE
)
1342 pp_right_paren (pp
);
1345 case OMP_CLAUSE_ASYNC
:
1346 pp_string (pp
, "async");
1347 if (OMP_CLAUSE_ASYNC_EXPR (clause
))
1349 pp_character(pp
, '(');
1350 dump_generic_node (pp
, OMP_CLAUSE_ASYNC_EXPR (clause
),
1352 pp_character(pp
, ')');
1356 case OMP_CLAUSE_AUTO
:
1357 case OMP_CLAUSE_SEQ
:
1358 pp_string (pp
, omp_clause_code_name
[OMP_CLAUSE_CODE (clause
)]);
1361 case OMP_CLAUSE_WAIT
:
1362 pp_string (pp
, "wait(");
1363 dump_generic_node (pp
, OMP_CLAUSE_WAIT_EXPR (clause
),
1365 pp_character(pp
, ')');
1368 case OMP_CLAUSE_WORKER
:
1369 pp_string (pp
, "worker");
1370 if (OMP_CLAUSE_WORKER_EXPR (clause
) != NULL_TREE
)
1373 dump_generic_node (pp
, OMP_CLAUSE_WORKER_EXPR (clause
),
1375 pp_right_paren (pp
);
1379 case OMP_CLAUSE_VECTOR
:
1380 pp_string (pp
, "vector");
1381 if (OMP_CLAUSE_VECTOR_EXPR (clause
) != NULL_TREE
)
1384 dump_generic_node (pp
, OMP_CLAUSE_VECTOR_EXPR (clause
),
1386 pp_right_paren (pp
);
1390 case OMP_CLAUSE_NUM_GANGS
:
1391 pp_string (pp
, "num_gangs(");
1392 dump_generic_node (pp
, OMP_CLAUSE_NUM_GANGS_EXPR (clause
),
1394 pp_character (pp
, ')');
1397 case OMP_CLAUSE_NUM_WORKERS
:
1398 pp_string (pp
, "num_workers(");
1399 dump_generic_node (pp
, OMP_CLAUSE_NUM_WORKERS_EXPR (clause
),
1401 pp_character (pp
, ')');
1404 case OMP_CLAUSE_VECTOR_LENGTH
:
1405 pp_string (pp
, "vector_length(");
1406 dump_generic_node (pp
, OMP_CLAUSE_VECTOR_LENGTH_EXPR (clause
),
1408 pp_character (pp
, ')');
1411 case OMP_CLAUSE_INBRANCH
:
1412 pp_string (pp
, "inbranch");
1414 case OMP_CLAUSE_NOTINBRANCH
:
1415 pp_string (pp
, "notinbranch");
1417 case OMP_CLAUSE_FOR
:
1418 pp_string (pp
, "for");
1420 case OMP_CLAUSE_PARALLEL
:
1421 pp_string (pp
, "parallel");
1423 case OMP_CLAUSE_SECTIONS
:
1424 pp_string (pp
, "sections");
1426 case OMP_CLAUSE_TASKGROUP
:
1427 pp_string (pp
, "taskgroup");
1429 case OMP_CLAUSE_NOGROUP
:
1430 pp_string (pp
, "nogroup");
1432 case OMP_CLAUSE_THREADS
:
1433 pp_string (pp
, "threads");
1435 case OMP_CLAUSE_SIMD
:
1436 pp_string (pp
, "simd");
1438 case OMP_CLAUSE_INDEPENDENT
:
1439 pp_string (pp
, "independent");
1441 case OMP_CLAUSE_TILE
:
1442 pp_string (pp
, "tile(");
1443 dump_generic_node (pp
, OMP_CLAUSE_TILE_LIST (clause
),
1445 pp_right_paren (pp
);
1448 case OMP_CLAUSE_IF_PRESENT
:
1449 pp_string (pp
, "if_present");
1451 case OMP_CLAUSE_FINALIZE
:
1452 pp_string (pp
, "finalize");
1454 case OMP_CLAUSE_NOHOST
:
1455 pp_string (pp
, "nohost");
1457 case OMP_CLAUSE_DETACH
:
1458 pp_string (pp
, "detach(");
1459 dump_generic_node (pp
, OMP_CLAUSE_DECL (clause
), spc
, flags
,
1461 pp_right_paren (pp
);
1469 /* Dump chain of OMP clauses.
1471 PP, SPC and FLAGS are as in dump_generic_node. */
1474 dump_omp_clauses (pretty_printer
*pp
, tree clause
, int spc
, dump_flags_t flags
,
1481 dump_omp_clause (pp
, clause
, spc
, flags
);
1482 leading_space
= true;
1484 clause
= OMP_CLAUSE_CHAIN (clause
);
1489 /* Dump location LOC to PP. */
1492 dump_location (pretty_printer
*pp
, location_t loc
)
1494 expanded_location xloc
= expand_location (loc
);
1495 int discriminator
= get_discriminator_from_loc (loc
);
1497 pp_left_bracket (pp
);
1500 pp_string (pp
, xloc
.file
);
1501 pp_string (pp
, ":");
1503 pp_decimal_int (pp
, xloc
.line
);
1505 pp_decimal_int (pp
, xloc
.column
);
1508 pp_string (pp
, " discrim ");
1509 pp_decimal_int (pp
, discriminator
);
1511 pp_string (pp
, "] ");
1515 /* Dump lexical block BLOCK. PP, SPC and FLAGS are as in
1516 dump_generic_node. */
1519 dump_block_node (pretty_printer
*pp
, tree block
, int spc
, dump_flags_t flags
)
1523 pp_string (pp
, "BLOCK #");
1524 pp_decimal_int (pp
, BLOCK_NUMBER (block
));
1525 pp_character (pp
, ' ');
1527 if (flags
& TDF_ADDRESS
)
1529 pp_character (pp
, '[');
1530 pp_scalar (pp
, "%p", (void *) block
);
1531 pp_string (pp
, "] ");
1534 if (TREE_ASM_WRITTEN (block
))
1535 pp_string (pp
, "[written] ");
1537 if (flags
& TDF_SLIM
)
1540 if (BLOCK_SOURCE_LOCATION (block
))
1541 dump_location (pp
, BLOCK_SOURCE_LOCATION (block
));
1543 newline_and_indent (pp
, spc
+ 2);
1545 if (BLOCK_SUPERCONTEXT (block
))
1547 pp_string (pp
, "SUPERCONTEXT: ");
1548 dump_generic_node (pp
, BLOCK_SUPERCONTEXT (block
), 0,
1549 flags
| TDF_SLIM
, false);
1550 newline_and_indent (pp
, spc
+ 2);
1553 if (BLOCK_SUBBLOCKS (block
))
1555 pp_string (pp
, "SUBBLOCKS: ");
1556 for (t
= BLOCK_SUBBLOCKS (block
); t
; t
= BLOCK_CHAIN (t
))
1558 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
1561 newline_and_indent (pp
, spc
+ 2);
1564 if (BLOCK_CHAIN (block
))
1566 pp_string (pp
, "SIBLINGS: ");
1567 for (t
= BLOCK_CHAIN (block
); t
; t
= BLOCK_CHAIN (t
))
1569 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
1572 newline_and_indent (pp
, spc
+ 2);
1575 if (BLOCK_VARS (block
))
1577 pp_string (pp
, "VARS: ");
1578 for (t
= BLOCK_VARS (block
); t
; t
= TREE_CHAIN (t
))
1580 dump_generic_node (pp
, t
, 0, flags
, false);
1583 newline_and_indent (pp
, spc
+ 2);
1586 if (vec_safe_length (BLOCK_NONLOCALIZED_VARS (block
)) > 0)
1589 vec
<tree
, va_gc
> *nlv
= BLOCK_NONLOCALIZED_VARS (block
);
1591 pp_string (pp
, "NONLOCALIZED_VARS: ");
1592 FOR_EACH_VEC_ELT (*nlv
, i
, t
)
1594 dump_generic_node (pp
, t
, 0, flags
, false);
1597 newline_and_indent (pp
, spc
+ 2);
1600 if (BLOCK_ABSTRACT_ORIGIN (block
))
1602 pp_string (pp
, "ABSTRACT_ORIGIN: ");
1603 dump_generic_node (pp
, BLOCK_ABSTRACT_ORIGIN (block
), 0,
1604 flags
| TDF_SLIM
, false);
1605 newline_and_indent (pp
, spc
+ 2);
1608 if (BLOCK_FRAGMENT_ORIGIN (block
))
1610 pp_string (pp
, "FRAGMENT_ORIGIN: ");
1611 dump_generic_node (pp
, BLOCK_FRAGMENT_ORIGIN (block
), 0,
1612 flags
| TDF_SLIM
, false);
1613 newline_and_indent (pp
, spc
+ 2);
1616 if (BLOCK_FRAGMENT_CHAIN (block
))
1618 pp_string (pp
, "FRAGMENT_CHAIN: ");
1619 for (t
= BLOCK_FRAGMENT_CHAIN (block
); t
; t
= BLOCK_FRAGMENT_CHAIN (t
))
1621 dump_generic_node (pp
, t
, 0, flags
| TDF_SLIM
, false);
1624 newline_and_indent (pp
, spc
+ 2);
1628 /* Dump #pragma omp atomic memory order clause. */
1631 dump_omp_atomic_memory_order (pretty_printer
*pp
, enum omp_memory_order mo
)
1633 switch (mo
& OMP_MEMORY_ORDER_MASK
)
1635 case OMP_MEMORY_ORDER_RELAXED
:
1636 pp_string (pp
, " relaxed");
1638 case OMP_MEMORY_ORDER_SEQ_CST
:
1639 pp_string (pp
, " seq_cst");
1641 case OMP_MEMORY_ORDER_ACQ_REL
:
1642 pp_string (pp
, " acq_rel");
1644 case OMP_MEMORY_ORDER_ACQUIRE
:
1645 pp_string (pp
, " acquire");
1647 case OMP_MEMORY_ORDER_RELEASE
:
1648 pp_string (pp
, " release");
1650 case OMP_MEMORY_ORDER_UNSPECIFIED
:
1655 switch (mo
& OMP_FAIL_MEMORY_ORDER_MASK
)
1657 case OMP_FAIL_MEMORY_ORDER_RELAXED
:
1658 pp_string (pp
, " fail(relaxed)");
1660 case OMP_FAIL_MEMORY_ORDER_SEQ_CST
:
1661 pp_string (pp
, " fail(seq_cst)");
1663 case OMP_FAIL_MEMORY_ORDER_ACQUIRE
:
1664 pp_string (pp
, " fail(acquire)");
1666 case OMP_FAIL_MEMORY_ORDER_UNSPECIFIED
:
1673 /* Helper to dump a MEM_REF node. */
1676 dump_mem_ref (pretty_printer
*pp
, tree node
, int spc
, dump_flags_t flags
)
1678 if (TREE_CODE (node
) == MEM_REF
&& (flags
& TDF_GIMPLE
))
1680 pp_string (pp
, "__MEM <");
1681 dump_generic_node (pp
, TREE_TYPE (node
),
1682 spc
, flags
| TDF_SLIM
, false);
1683 if (TYPE_ALIGN (TREE_TYPE (node
))
1684 != TYPE_ALIGN (TYPE_MAIN_VARIANT (TREE_TYPE (node
))))
1686 pp_string (pp
, ", ");
1687 pp_decimal_int (pp
, TYPE_ALIGN (TREE_TYPE (node
)));
1690 pp_string (pp
, " (");
1691 if (TREE_TYPE (TREE_OPERAND (node
, 0))
1692 != TREE_TYPE (TREE_OPERAND (node
, 1)))
1695 dump_generic_node (pp
, TREE_TYPE (TREE_OPERAND (node
, 1)),
1696 spc
, flags
| TDF_SLIM
, false);
1697 pp_right_paren (pp
);
1699 dump_generic_node (pp
, TREE_OPERAND (node
, 0),
1700 spc
, flags
| TDF_SLIM
, false);
1701 if (! integer_zerop (TREE_OPERAND (node
, 1)))
1703 pp_string (pp
, " + ");
1704 dump_generic_node (pp
, TREE_OPERAND (node
, 1),
1705 spc
, flags
| TDF_SLIM
, false);
1707 pp_right_paren (pp
);
1709 else if (TREE_CODE (node
) == MEM_REF
1710 && integer_zerop (TREE_OPERAND (node
, 1))
1711 /* Dump the types of INTEGER_CSTs explicitly, for we can't
1712 infer them and MEM_ATTR caching will share MEM_REFs
1713 with differently-typed op0s. */
1714 && TREE_CODE (TREE_OPERAND (node
, 0)) != INTEGER_CST
1715 /* Released SSA_NAMES have no TREE_TYPE. */
1716 && TREE_TYPE (TREE_OPERAND (node
, 0)) != NULL_TREE
1717 /* Same pointer types, but ignoring POINTER_TYPE vs.
1719 && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 0)))
1720 == TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 1))))
1721 && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (node
, 0)))
1722 == TYPE_MODE (TREE_TYPE (TREE_OPERAND (node
, 1))))
1723 && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node
, 0)))
1724 == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node
, 1))))
1725 /* Same value types ignoring qualifiers. */
1726 && (TYPE_MAIN_VARIANT (TREE_TYPE (node
))
1727 == TYPE_MAIN_VARIANT
1728 (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 1)))))
1729 && (!(flags
& TDF_ALIAS
)
1730 || MR_DEPENDENCE_CLIQUE (node
) == 0))
1732 if (TREE_CODE (TREE_OPERAND (node
, 0)) != ADDR_EXPR
)
1734 /* Enclose pointers to arrays in parentheses. */
1735 tree op0
= TREE_OPERAND (node
, 0);
1736 tree op0type
= TREE_TYPE (op0
);
1737 if (POINTER_TYPE_P (op0type
)
1738 && TREE_CODE (TREE_TYPE (op0type
)) == ARRAY_TYPE
)
1741 dump_generic_node (pp
, op0
, spc
, flags
, false);
1742 if (POINTER_TYPE_P (op0type
)
1743 && TREE_CODE (TREE_TYPE (op0type
)) == ARRAY_TYPE
)
1744 pp_right_paren (pp
);
1747 dump_generic_node (pp
,
1748 TREE_OPERAND (TREE_OPERAND (node
, 0), 0),
1753 pp_string (pp
, "MEM");
1755 tree nodetype
= TREE_TYPE (node
);
1756 tree op0
= TREE_OPERAND (node
, 0);
1757 tree op1
= TREE_OPERAND (node
, 1);
1758 tree op1type
= TYPE_MAIN_VARIANT (TREE_TYPE (op1
));
1760 tree op0size
= TYPE_SIZE (nodetype
);
1761 tree op1size
= TYPE_SIZE (TREE_TYPE (op1type
));
1763 if (!op0size
|| !op1size
1764 || !operand_equal_p (op0size
, op1size
, 0))
1766 pp_string (pp
, " <");
1767 /* If the size of the type of the operand is not the same
1768 as the size of the MEM_REF expression include the type
1769 of the latter similar to the TDF_GIMPLE output to make
1770 it clear how many bytes of memory are being accessed. */
1771 dump_generic_node (pp
, nodetype
, spc
, flags
| TDF_SLIM
, false);
1772 pp_string (pp
, "> ");
1775 pp_string (pp
, "[(");
1776 dump_generic_node (pp
, op1type
, spc
, flags
| TDF_SLIM
, false);
1777 pp_right_paren (pp
);
1778 dump_generic_node (pp
, op0
, spc
, flags
, false);
1779 if (!integer_zerop (op1
))
1781 pp_string (pp
, " + ");
1782 dump_generic_node (pp
, op1
, spc
, flags
, false);
1784 if (TREE_CODE (node
) == TARGET_MEM_REF
)
1786 tree tmp
= TMR_INDEX2 (node
);
1789 pp_string (pp
, " + ");
1790 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1792 tmp
= TMR_INDEX (node
);
1795 pp_string (pp
, " + ");
1796 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1797 tmp
= TMR_STEP (node
);
1798 pp_string (pp
, " * ");
1800 dump_generic_node (pp
, tmp
, spc
, flags
, false);
1802 pp_string (pp
, "1");
1805 if ((flags
& TDF_ALIAS
)
1806 && MR_DEPENDENCE_CLIQUE (node
) != 0)
1808 pp_string (pp
, " clique ");
1809 pp_unsigned_wide_integer (pp
, MR_DEPENDENCE_CLIQUE (node
));
1810 pp_string (pp
, " base ");
1811 pp_unsigned_wide_integer (pp
, MR_DEPENDENCE_BASE (node
));
1813 pp_right_bracket (pp
);
1817 /* Helper function for dump_generic_node. Dump INIT or COND expression for
1818 OpenMP loop non-rectangular iterators. */
1821 dump_omp_loop_non_rect_expr (pretty_printer
*pp
, tree node
, int spc
,
1824 gcc_assert (TREE_CODE (node
) == TREE_VEC
);
1825 dump_generic_node (pp
, TREE_VEC_ELT (node
, 0), spc
, flags
, false);
1826 pp_string (pp
, " * ");
1827 if (op_prio (TREE_VEC_ELT (node
, 1)) <= op_code_prio (MULT_EXPR
))
1830 dump_generic_node (pp
, TREE_VEC_ELT (node
, 1), spc
, flags
, false);
1831 pp_right_paren (pp
);
1834 dump_generic_node (pp
, TREE_VEC_ELT (node
, 1), spc
, flags
, false);
1835 pp_string (pp
, " + ");
1836 if (op_prio (TREE_VEC_ELT (node
, 1)) <= op_code_prio (PLUS_EXPR
))
1839 dump_generic_node (pp
, TREE_VEC_ELT (node
, 2), spc
, flags
, false);
1840 pp_right_paren (pp
);
1843 dump_generic_node (pp
, TREE_VEC_ELT (node
, 2), spc
, flags
, false);
1846 /* Dump the node NODE on the pretty_printer PP, SPC spaces of
1847 indent. FLAGS specifies details to show in the dump (see TDF_* in
1848 dumpfile.h). If IS_STMT is true, the object printed is considered
1849 to be a statement and it is terminated by ';' if appropriate. */
1852 dump_generic_node (pretty_printer
*pp
, tree node
, int spc
, dump_flags_t flags
,
1859 enum tree_code code
;
1861 if (node
== NULL_TREE
)
1864 is_expr
= EXPR_P (node
);
1866 if (is_stmt
&& (flags
& TDF_STMTADDR
))
1868 pp_string (pp
, "<&");
1869 pp_scalar (pp
, "%p", (void *)node
);
1870 pp_string (pp
, "> ");
1873 if ((flags
& TDF_LINENO
) && EXPR_HAS_LOCATION (node
))
1874 dump_location (pp
, EXPR_LOCATION (node
));
1876 code
= TREE_CODE (node
);
1880 pp_string (pp
, "<<< error >>>");
1883 case IDENTIFIER_NODE
:
1884 pp_tree_identifier (pp
, node
);
1888 while (node
&& node
!= error_mark_node
)
1890 if (TREE_PURPOSE (node
))
1892 dump_generic_node (pp
, TREE_PURPOSE (node
), spc
, flags
, false);
1895 dump_generic_node (pp
, TREE_VALUE (node
), spc
, flags
, false);
1896 node
= TREE_CHAIN (node
);
1897 if (node
&& TREE_CODE (node
) == TREE_LIST
)
1906 dump_generic_node (pp
, BINFO_TYPE (node
), spc
, flags
, false);
1913 if (TREE_VEC_LENGTH (node
) > 0)
1915 size_t len
= TREE_VEC_LENGTH (node
);
1916 for (i
= 0; i
< len
- 1; i
++)
1918 dump_generic_node (pp
, TREE_VEC_ELT (node
, i
), spc
, flags
,
1923 dump_generic_node (pp
, TREE_VEC_ELT (node
, len
- 1), spc
,
1926 pp_right_brace (pp
);
1933 case FIXED_POINT_TYPE
:
1941 unsigned int quals
= TYPE_QUALS (node
);
1942 enum tree_code_class tclass
;
1944 if (quals
& TYPE_QUAL_ATOMIC
)
1945 pp_string (pp
, "atomic ");
1946 if (quals
& TYPE_QUAL_CONST
)
1947 pp_string (pp
, "const ");
1948 if (quals
& TYPE_QUAL_VOLATILE
)
1949 pp_string (pp
, "volatile ");
1950 if (quals
& TYPE_QUAL_RESTRICT
)
1951 pp_string (pp
, "restrict ");
1953 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
1955 pp_string (pp
, "<address-space-");
1956 pp_decimal_int (pp
, TYPE_ADDR_SPACE (node
));
1957 pp_string (pp
, "> ");
1960 tclass
= TREE_CODE_CLASS (TREE_CODE (node
));
1962 if (tclass
== tcc_declaration
)
1964 if (DECL_NAME (node
))
1965 dump_decl_name (pp
, node
, flags
);
1967 pp_string (pp
, "<unnamed type decl>");
1969 else if (tclass
== tcc_type
)
1971 if (TYPE_NAME (node
))
1973 if (TREE_CODE (TYPE_NAME (node
)) == IDENTIFIER_NODE
)
1974 pp_tree_identifier (pp
, TYPE_NAME (node
));
1975 else if (TREE_CODE (TYPE_NAME (node
)) == TYPE_DECL
1976 && DECL_NAME (TYPE_NAME (node
)))
1977 dump_decl_name (pp
, TYPE_NAME (node
), flags
);
1979 pp_string (pp
, "<unnamed type>");
1981 else if (TREE_CODE (node
) == VECTOR_TYPE
)
1983 pp_string (pp
, "vector");
1985 pp_wide_integer (pp
, TYPE_VECTOR_SUBPARTS (node
));
1986 pp_string (pp
, ") ");
1987 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
1989 else if (TREE_CODE (node
) == INTEGER_TYPE
)
1991 if (TYPE_PRECISION (node
) == CHAR_TYPE_SIZE
)
1992 pp_string (pp
, (TYPE_UNSIGNED (node
)
1995 else if (TYPE_PRECISION (node
) == SHORT_TYPE_SIZE
)
1996 pp_string (pp
, (TYPE_UNSIGNED (node
)
1999 else if (TYPE_PRECISION (node
) == INT_TYPE_SIZE
)
2000 pp_string (pp
, (TYPE_UNSIGNED (node
)
2003 else if (TYPE_PRECISION (node
) == LONG_TYPE_SIZE
)
2004 pp_string (pp
, (TYPE_UNSIGNED (node
)
2007 else if (TYPE_PRECISION (node
) == LONG_LONG_TYPE_SIZE
)
2008 pp_string (pp
, (TYPE_UNSIGNED (node
)
2009 ? "unsigned long long"
2010 : "signed long long"));
2011 else if (TYPE_PRECISION (node
) >= CHAR_TYPE_SIZE
2012 && pow2p_hwi (TYPE_PRECISION (node
)))
2014 pp_string (pp
, (TYPE_UNSIGNED (node
) ? "uint" : "int"));
2015 pp_decimal_int (pp
, TYPE_PRECISION (node
));
2016 pp_string (pp
, "_t");
2020 pp_string (pp
, (TYPE_UNSIGNED (node
)
2021 ? "<unnamed-unsigned:"
2022 : "<unnamed-signed:"));
2023 pp_decimal_int (pp
, TYPE_PRECISION (node
));
2027 else if (TREE_CODE (node
) == COMPLEX_TYPE
)
2029 pp_string (pp
, "__complex__ ");
2030 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2032 else if (TREE_CODE (node
) == REAL_TYPE
)
2034 pp_string (pp
, "<float:");
2035 pp_decimal_int (pp
, TYPE_PRECISION (node
));
2038 else if (TREE_CODE (node
) == FIXED_POINT_TYPE
)
2040 pp_string (pp
, "<fixed-point-");
2041 pp_string (pp
, TYPE_SATURATING (node
) ? "sat:" : "nonsat:");
2042 pp_decimal_int (pp
, TYPE_PRECISION (node
));
2045 else if (TREE_CODE (node
) == BOOLEAN_TYPE
)
2047 pp_string (pp
, (TYPE_UNSIGNED (node
)
2048 ? "<unsigned-boolean:"
2049 : "<signed-boolean:"));
2050 pp_decimal_int (pp
, TYPE_PRECISION (node
));
2053 else if (TREE_CODE (node
) == BITINT_TYPE
)
2055 if (TYPE_UNSIGNED (node
))
2056 pp_string (pp
, "unsigned ");
2057 pp_string (pp
, "_BitInt(");
2058 pp_decimal_int (pp
, TYPE_PRECISION (node
));
2059 pp_right_paren (pp
);
2061 else if (TREE_CODE (node
) == VOID_TYPE
)
2062 pp_string (pp
, "void");
2064 pp_string (pp
, "<unnamed type>");
2070 case REFERENCE_TYPE
:
2071 str
= (TREE_CODE (node
) == POINTER_TYPE
? "*" : "&");
2073 if (TREE_TYPE (node
) == NULL
)
2075 pp_string (pp
, str
);
2076 pp_string (pp
, "<null type>");
2078 else if (TREE_CODE (TREE_TYPE (node
)) == FUNCTION_TYPE
)
2080 tree fnode
= TREE_TYPE (node
);
2082 dump_generic_node (pp
, TREE_TYPE (fnode
), spc
, flags
, false);
2085 pp_string (pp
, str
);
2086 if (TYPE_IDENTIFIER (node
))
2087 dump_generic_node (pp
, TYPE_NAME (node
), spc
, flags
, false);
2088 else if (flags
& TDF_NOUID
)
2089 pp_string (pp
, "<Txxxx>");
2092 pp_string (pp
, "<T");
2093 pp_scalar (pp
, "%x", TYPE_UID (node
));
2094 pp_character (pp
, '>');
2097 pp_right_paren (pp
);
2098 dump_function_declaration (pp
, fnode
, spc
, flags
);
2102 unsigned int quals
= TYPE_QUALS (node
);
2104 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2106 pp_string (pp
, str
);
2108 if (quals
& TYPE_QUAL_CONST
)
2109 pp_string (pp
, " const");
2110 if (quals
& TYPE_QUAL_VOLATILE
)
2111 pp_string (pp
, " volatile");
2112 if (quals
& TYPE_QUAL_RESTRICT
)
2113 pp_string (pp
, " restrict");
2115 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
2117 pp_string (pp
, " <address-space-");
2118 pp_decimal_int (pp
, TYPE_ADDR_SPACE (node
));
2122 if (TYPE_REF_CAN_ALIAS_ALL (node
))
2123 pp_string (pp
, " {ref-all}");
2132 case TARGET_MEM_REF
:
2133 dump_mem_ref (pp
, node
, spc
, flags
);
2138 unsigned int quals
= TYPE_QUALS (node
);
2141 if (quals
& TYPE_QUAL_ATOMIC
)
2142 pp_string (pp
, "atomic ");
2143 if (quals
& TYPE_QUAL_CONST
)
2144 pp_string (pp
, "const ");
2145 if (quals
& TYPE_QUAL_VOLATILE
)
2146 pp_string (pp
, "volatile ");
2148 /* Print the innermost component type. */
2149 for (tmp
= TREE_TYPE (node
); TREE_CODE (tmp
) == ARRAY_TYPE
;
2150 tmp
= TREE_TYPE (tmp
))
2153 /* Avoid to print recursively the array. */
2154 /* FIXME : Not implemented correctly, see print_struct_decl. */
2155 if (TREE_CODE (tmp
) != POINTER_TYPE
|| TREE_TYPE (tmp
) != node
)
2156 dump_generic_node (pp
, tmp
, spc
, flags
, false);
2158 /* Print the dimensions. */
2159 for (tmp
= node
; TREE_CODE (tmp
) == ARRAY_TYPE
; tmp
= TREE_TYPE (tmp
))
2160 dump_array_domain (pp
, TYPE_DOMAIN (tmp
), spc
, flags
);
2166 case QUAL_UNION_TYPE
:
2168 unsigned int quals
= TYPE_QUALS (node
);
2170 if (quals
& TYPE_QUAL_ATOMIC
)
2171 pp_string (pp
, "atomic ");
2172 if (quals
& TYPE_QUAL_CONST
)
2173 pp_string (pp
, "const ");
2174 if (quals
& TYPE_QUAL_VOLATILE
)
2175 pp_string (pp
, "volatile ");
2177 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
2179 pp_string (pp
, "<address-space-");
2180 pp_decimal_int (pp
, TYPE_ADDR_SPACE (node
));
2181 pp_string (pp
, "> ");
2184 /* Print the name of the structure. */
2185 if (TREE_CODE (node
) == RECORD_TYPE
)
2186 pp_string (pp
, "struct ");
2187 else if (TREE_CODE (node
) == UNION_TYPE
)
2188 pp_string (pp
, "union ");
2190 if (TYPE_NAME (node
))
2191 dump_generic_node (pp
, TYPE_NAME (node
), spc
, flags
, false);
2192 else if (!(flags
& TDF_SLIM
))
2193 /* FIXME: If we eliminate the 'else' above and attempt
2194 to show the fields for named types, we may get stuck
2195 following a cycle of pointers to structs. The alleged
2196 self-reference check in print_struct_decl will not detect
2197 cycles involving more than one pointer or struct type. */
2198 print_struct_decl (pp
, node
, spc
, flags
);
2207 if (flags
& TDF_GIMPLE
2208 && (POINTER_TYPE_P (TREE_TYPE (node
))
2209 || (TYPE_PRECISION (TREE_TYPE (node
))
2210 < TYPE_PRECISION (integer_type_node
))
2211 || exact_log2 (TYPE_PRECISION (TREE_TYPE (node
))) == -1
2212 || tree_int_cst_sgn (node
) < 0))
2214 pp_string (pp
, "_Literal (");
2215 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2216 pp_string (pp
, ") ");
2218 if (TREE_CODE (TREE_TYPE (node
)) == POINTER_TYPE
2219 && ! (flags
& TDF_GIMPLE
))
2221 /* In the case of a pointer, one may want to divide by the
2222 size of the pointed-to type. Unfortunately, this not
2223 straightforward. The C front-end maps expressions
2228 in such a way that the two INTEGER_CST nodes for "5" have
2229 different values but identical types. In the latter
2230 case, the 5 is multiplied by sizeof (int) in c-common.cc
2231 (pointer_int_sum) to convert it to a byte address, and
2232 yet the type of the node is left unchanged. Argh. What
2233 is consistent though is that the number value corresponds
2234 to bytes (UNITS) offset.
2236 NB: Neither of the following divisors can be trivially
2237 used to recover the original literal:
2239 TREE_INT_CST_LOW (TYPE_SIZE_UNIT (TREE_TYPE (node)))
2240 TYPE_PRECISION (TREE_TYPE (TREE_TYPE (node))) */
2241 pp_wide_integer (pp
, TREE_INT_CST_LOW (node
));
2242 pp_string (pp
, "B"); /* pseudo-unit */
2244 else if (tree_fits_shwi_p (node
))
2245 pp_wide_integer (pp
, tree_to_shwi (node
));
2246 else if (tree_fits_uhwi_p (node
))
2247 pp_unsigned_wide_integer (pp
, tree_to_uhwi (node
));
2250 wide_int val
= wi::to_wide (node
);
2252 if (wi::neg_p (val
, TYPE_SIGN (TREE_TYPE (node
))))
2258 print_hex_buf_size (val
, &len
);
2259 if (UNLIKELY (len
> sizeof (pp_buffer (pp
)->digit_buffer
)))
2261 char *buf
= XALLOCAVEC (char, len
);
2262 print_hex (val
, buf
);
2263 pp_string (pp
, buf
);
2267 print_hex (val
, pp_buffer (pp
)->digit_buffer
);
2268 pp_string (pp
, pp_buffer (pp
)->digit_buffer
);
2271 if ((flags
& TDF_GIMPLE
)
2272 && ! (POINTER_TYPE_P (TREE_TYPE (node
))
2273 || (TYPE_PRECISION (TREE_TYPE (node
))
2274 < TYPE_PRECISION (integer_type_node
))
2275 || exact_log2 (TYPE_PRECISION (TREE_TYPE (node
))) == -1))
2277 if (TYPE_UNSIGNED (TREE_TYPE (node
)))
2278 pp_character (pp
, 'u');
2279 if (TYPE_PRECISION (TREE_TYPE (node
))
2280 == TYPE_PRECISION (unsigned_type_node
))
2282 else if (TYPE_PRECISION (TREE_TYPE (node
))
2283 == TYPE_PRECISION (long_unsigned_type_node
))
2284 pp_character (pp
, 'l');
2285 else if (TYPE_PRECISION (TREE_TYPE (node
))
2286 == TYPE_PRECISION (long_long_unsigned_type_node
))
2287 pp_string (pp
, "ll");
2289 if (TREE_OVERFLOW (node
))
2290 pp_string (pp
, "(OVF)");
2294 pp_string (pp
, "POLY_INT_CST [");
2295 dump_generic_node (pp
, POLY_INT_CST_COEFF (node
, 0), spc
, flags
, false);
2296 for (unsigned int i
= 1; i
< NUM_POLY_INT_COEFFS
; ++i
)
2298 pp_string (pp
, ", ");
2299 dump_generic_node (pp
, POLY_INT_CST_COEFF (node
, i
),
2302 pp_string (pp
, "]");
2306 /* Code copied from print_node. */
2309 if (TREE_OVERFLOW (node
))
2310 pp_string (pp
, " overflow");
2312 d
= TREE_REAL_CST (node
);
2313 if (REAL_VALUE_ISINF (d
))
2314 pp_string (pp
, REAL_VALUE_NEGATIVE (d
) ? " -Inf" : " Inf");
2315 else if (REAL_VALUE_ISNAN (d
))
2316 pp_string (pp
, " Nan");
2320 real_to_decimal (string
, &d
, sizeof (string
), 0, 1);
2321 pp_string (pp
, string
);
2329 fixed_to_decimal (string
, TREE_FIXED_CST_PTR (node
), sizeof (string
));
2330 pp_string (pp
, string
);
2335 pp_string (pp
, "__complex__ (");
2336 dump_generic_node (pp
, TREE_REALPART (node
), spc
, flags
, false);
2337 pp_string (pp
, ", ");
2338 dump_generic_node (pp
, TREE_IMAGPART (node
), spc
, flags
, false);
2339 pp_right_paren (pp
);
2344 pp_string (pp
, "\"");
2345 if (unsigned nbytes
= TREE_STRING_LENGTH (node
))
2346 pretty_print_string (pp
, TREE_STRING_POINTER (node
), nbytes
);
2347 pp_string (pp
, "\"");
2354 if (flags
& TDF_GIMPLE
)
2356 pp_string (pp
, "_Literal (");
2357 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2358 pp_string (pp
, ") ");
2360 pp_string (pp
, "{ ");
2361 unsigned HOST_WIDE_INT nunits
;
2362 if (!VECTOR_CST_NELTS (node
).is_constant (&nunits
))
2363 nunits
= vector_cst_encoded_nelts (node
);
2364 for (i
= 0; i
< nunits
; ++i
)
2367 pp_string (pp
, ", ");
2368 dump_generic_node (pp
, VECTOR_CST_ELT (node
, i
),
2371 if (!VECTOR_CST_NELTS (node
).is_constant ())
2372 pp_string (pp
, ", ...");
2373 pp_string (pp
, " }");
2379 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2381 if (TREE_CODE (node
) == METHOD_TYPE
)
2383 if (TYPE_METHOD_BASETYPE (node
))
2384 dump_generic_node (pp
, TYPE_NAME (TYPE_METHOD_BASETYPE (node
)),
2387 pp_string (pp
, "<null method basetype>");
2388 pp_colon_colon (pp
);
2390 if (TYPE_IDENTIFIER (node
))
2391 dump_generic_node (pp
, TYPE_NAME (node
), spc
, flags
, false);
2392 else if (TYPE_NAME (node
) && DECL_NAME (TYPE_NAME (node
)))
2393 dump_decl_name (pp
, TYPE_NAME (node
), flags
);
2394 else if (flags
& TDF_NOUID
)
2395 pp_string (pp
, "<Txxxx>");
2398 pp_string (pp
, "<T");
2399 pp_scalar (pp
, "%x", TYPE_UID (node
));
2400 pp_character (pp
, '>');
2402 dump_function_declaration (pp
, node
, spc
, flags
);
2407 dump_decl_name (pp
, node
, flags
);
2411 if (DECL_NAME (node
))
2412 dump_decl_name (pp
, node
, flags
);
2413 else if (LABEL_DECL_UID (node
) != -1)
2415 if (flags
& TDF_GIMPLE
)
2417 pp_character (pp
, 'L');
2418 pp_decimal_int (pp
, (int) LABEL_DECL_UID (node
));
2422 pp_string (pp
, "<L");
2423 pp_decimal_int (pp
, (int) LABEL_DECL_UID (node
));
2424 pp_character (pp
, '>');
2429 if (flags
& TDF_NOUID
)
2430 pp_string (pp
, "<D.xxxx>");
2433 if (flags
& TDF_GIMPLE
)
2435 pp_character (pp
, 'D');
2436 pp_scalar (pp
, "%u", DECL_UID (node
));
2440 pp_string (pp
, "<D.");
2441 pp_scalar (pp
, "%u", DECL_UID (node
));
2442 pp_character (pp
, '>');
2449 if (DECL_IS_UNDECLARED_BUILTIN (node
))
2451 /* Don't print the declaration of built-in types. */
2454 if (DECL_NAME (node
))
2455 dump_decl_name (pp
, node
, flags
);
2456 else if (TYPE_NAME (TREE_TYPE (node
)) != node
)
2458 pp_string (pp
, (TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
2459 ? "union" : "struct "));
2460 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2463 pp_string (pp
, "<anon>");
2469 case DEBUG_EXPR_DECL
:
2470 case NAMESPACE_DECL
:
2472 dump_decl_name (pp
, node
, flags
);
2476 pp_string (pp
, "<retval>");
2480 op0
= TREE_OPERAND (node
, 0);
2483 && (TREE_CODE (op0
) == INDIRECT_REF
2484 || (TREE_CODE (op0
) == MEM_REF
2485 && TREE_CODE (TREE_OPERAND (op0
, 0)) != ADDR_EXPR
2486 && integer_zerop (TREE_OPERAND (op0
, 1))
2487 /* Dump the types of INTEGER_CSTs explicitly, for we
2488 can't infer them and MEM_ATTR caching will share
2489 MEM_REFs with differently-typed op0s. */
2490 && TREE_CODE (TREE_OPERAND (op0
, 0)) != INTEGER_CST
2491 /* Released SSA_NAMES have no TREE_TYPE. */
2492 && TREE_TYPE (TREE_OPERAND (op0
, 0)) != NULL_TREE
2493 /* Same pointer types, but ignoring POINTER_TYPE vs.
2495 && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 0)))
2496 == TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 1))))
2497 && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0
, 0)))
2498 == TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0
, 1))))
2499 && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0
, 0)))
2500 == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0
, 1))))
2501 /* Same value types ignoring qualifiers. */
2502 && (TYPE_MAIN_VARIANT (TREE_TYPE (op0
))
2503 == TYPE_MAIN_VARIANT
2504 (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 1)))))
2505 && MR_DEPENDENCE_CLIQUE (op0
) == 0)))
2507 op0
= TREE_OPERAND (op0
, 0);
2510 if (op_prio (op0
) < op_prio (node
))
2512 dump_generic_node (pp
, op0
, spc
, flags
, false);
2513 if (op_prio (op0
) < op_prio (node
))
2514 pp_right_paren (pp
);
2515 pp_string (pp
, str
);
2516 op1
= TREE_OPERAND (node
, 1);
2517 dump_generic_node (pp
, op1
, spc
, flags
, false);
2518 if (DECL_P (op1
)) /* Not always a decl in the C++ FE. */
2519 if (tree off
= component_ref_field_offset (node
))
2520 if (TREE_CODE (off
) != INTEGER_CST
)
2522 pp_string (pp
, "{off: ");
2523 dump_generic_node (pp
, off
, spc
, flags
, false);
2524 pp_right_brace (pp
);
2529 if (flags
& TDF_GIMPLE
)
2531 pp_string (pp
, "__BIT_FIELD_REF <");
2532 dump_generic_node (pp
, TREE_TYPE (node
),
2533 spc
, flags
| TDF_SLIM
, false);
2534 if (TYPE_ALIGN (TREE_TYPE (node
))
2535 != TYPE_ALIGN (TYPE_MAIN_VARIANT (TREE_TYPE (node
))))
2537 pp_string (pp
, ", ");
2538 pp_decimal_int (pp
, TYPE_ALIGN (TREE_TYPE (node
)));
2541 pp_string (pp
, " (");
2542 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
,
2543 flags
| TDF_SLIM
, false);
2544 pp_string (pp
, ", ");
2545 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
,
2546 flags
| TDF_SLIM
, false);
2547 pp_string (pp
, ", ");
2548 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
,
2549 flags
| TDF_SLIM
, false);
2550 pp_right_paren (pp
);
2554 pp_string (pp
, "BIT_FIELD_REF <");
2555 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2556 pp_string (pp
, ", ");
2557 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2558 pp_string (pp
, ", ");
2559 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2564 case BIT_INSERT_EXPR
:
2565 pp_string (pp
, "BIT_INSERT_EXPR <");
2566 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2567 pp_string (pp
, ", ");
2568 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2569 pp_string (pp
, ", ");
2570 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2571 pp_string (pp
, " (");
2572 if (INTEGRAL_TYPE_P (TREE_TYPE (TREE_OPERAND (node
, 1))))
2574 TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (node
, 1))));
2576 dump_generic_node (pp
, TYPE_SIZE (TREE_TYPE (TREE_OPERAND (node
, 1))),
2578 pp_string (pp
, " bits)>");
2582 case ARRAY_RANGE_REF
:
2583 op0
= TREE_OPERAND (node
, 0);
2584 if (op_prio (op0
) < op_prio (node
))
2586 dump_generic_node (pp
, op0
, spc
, flags
, false);
2587 if (op_prio (op0
) < op_prio (node
))
2588 pp_right_paren (pp
);
2589 pp_left_bracket (pp
);
2590 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2591 if (TREE_CODE (node
) == ARRAY_RANGE_REF
)
2592 pp_string (pp
, " ...");
2593 pp_right_bracket (pp
);
2595 op0
= array_ref_low_bound (node
);
2596 op1
= array_ref_element_size (node
);
2598 if (!integer_zerop (op0
)
2599 || TREE_OPERAND (node
, 2)
2600 || TREE_OPERAND (node
, 3))
2602 pp_string (pp
, "{lb: ");
2603 dump_generic_node (pp
, op0
, spc
, flags
, false);
2604 pp_string (pp
, " sz: ");
2605 dump_generic_node (pp
, op1
, spc
, flags
, false);
2606 pp_right_brace (pp
);
2612 unsigned HOST_WIDE_INT ix
;
2614 bool is_struct_init
= false;
2615 bool is_array_init
= false;
2617 if (flags
& TDF_GIMPLE
)
2619 pp_string (pp
, "_Literal (");
2620 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2621 pp_string (pp
, ") ");
2624 if (TREE_CLOBBER_P (node
))
2626 pp_string (pp
, "CLOBBER");
2627 if (CLOBBER_KIND (node
) == CLOBBER_EOL
)
2628 pp_string (pp
, "(eol)");
2630 else if (TREE_CODE (TREE_TYPE (node
)) == RECORD_TYPE
2631 || TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
)
2632 is_struct_init
= true;
2633 else if (TREE_CODE (TREE_TYPE (node
)) == ARRAY_TYPE
2634 && TYPE_DOMAIN (TREE_TYPE (node
))
2635 && TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
)))
2636 && TREE_CODE (TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
))))
2639 tree minv
= TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
)));
2640 is_array_init
= true;
2641 curidx
= wi::to_widest (minv
);
2643 FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (node
), ix
, field
, val
)
2650 dump_generic_node (pp
, field
, spc
, flags
, false);
2653 else if (is_array_init
2654 && (TREE_CODE (field
) != INTEGER_CST
2655 || curidx
!= wi::to_widest (field
)))
2657 pp_left_bracket (pp
);
2658 if (TREE_CODE (field
) == RANGE_EXPR
)
2660 dump_generic_node (pp
, TREE_OPERAND (field
, 0), spc
,
2662 pp_string (pp
, " ... ");
2663 dump_generic_node (pp
, TREE_OPERAND (field
, 1), spc
,
2665 if (TREE_CODE (TREE_OPERAND (field
, 1)) == INTEGER_CST
)
2666 curidx
= wi::to_widest (TREE_OPERAND (field
, 1));
2669 dump_generic_node (pp
, field
, spc
, flags
, false);
2670 if (TREE_CODE (field
) == INTEGER_CST
)
2671 curidx
= wi::to_widest (field
);
2672 pp_string (pp
, "]=");
2677 if (val
&& TREE_CODE (val
) == ADDR_EXPR
)
2678 if (TREE_CODE (TREE_OPERAND (val
, 0)) == FUNCTION_DECL
)
2679 val
= TREE_OPERAND (val
, 0);
2680 if (val
&& TREE_CODE (val
) == FUNCTION_DECL
)
2681 dump_decl_name (pp
, val
, flags
);
2683 dump_generic_node (pp
, val
, spc
, flags
, false);
2684 if (ix
!= CONSTRUCTOR_NELTS (node
) - 1)
2690 pp_right_brace (pp
);
2697 if (flags
& TDF_SLIM
)
2699 pp_string (pp
, "<COMPOUND_EXPR>");
2703 dump_generic_node (pp
, TREE_OPERAND (node
, 0),
2704 spc
, flags
, !(flags
& TDF_SLIM
));
2705 if (flags
& TDF_SLIM
)
2706 newline_and_indent (pp
, spc
);
2713 for (tp
= &TREE_OPERAND (node
, 1);
2714 TREE_CODE (*tp
) == COMPOUND_EXPR
;
2715 tp
= &TREE_OPERAND (*tp
, 1))
2717 dump_generic_node (pp
, TREE_OPERAND (*tp
, 0),
2718 spc
, flags
, !(flags
& TDF_SLIM
));
2719 if (flags
& TDF_SLIM
)
2720 newline_and_indent (pp
, spc
);
2728 dump_generic_node (pp
, *tp
, spc
, flags
, !(flags
& TDF_SLIM
));
2732 case STATEMENT_LIST
:
2734 tree_stmt_iterator si
;
2737 if (flags
& TDF_SLIM
)
2739 pp_string (pp
, "<STATEMENT_LIST>");
2743 for (si
= tsi_start (node
); !tsi_end_p (si
); tsi_next (&si
))
2746 newline_and_indent (pp
, spc
);
2749 dump_generic_node (pp
, tsi_stmt (si
), spc
, flags
, true);
2756 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
,
2761 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
,
2766 pp_string (pp
, "TARGET_EXPR <");
2767 dump_generic_node (pp
, TARGET_EXPR_SLOT (node
), spc
, flags
, false);
2770 dump_generic_node (pp
, TARGET_EXPR_INITIAL (node
), spc
, flags
, false);
2775 print_declaration (pp
, DECL_EXPR_DECL (node
), spc
, flags
);
2780 if (TREE_TYPE (node
) == NULL
|| TREE_TYPE (node
) == void_type_node
)
2782 pp_string (pp
, "if (");
2783 dump_generic_node (pp
, COND_EXPR_COND (node
), spc
, flags
, false);
2784 pp_right_paren (pp
);
2785 /* The lowered cond_exprs should always be printed in full. */
2786 if (COND_EXPR_THEN (node
)
2787 && (IS_EMPTY_STMT (COND_EXPR_THEN (node
))
2788 || TREE_CODE (COND_EXPR_THEN (node
)) == GOTO_EXPR
)
2789 && COND_EXPR_ELSE (node
)
2790 && (IS_EMPTY_STMT (COND_EXPR_ELSE (node
))
2791 || TREE_CODE (COND_EXPR_ELSE (node
)) == GOTO_EXPR
))
2794 dump_generic_node (pp
, COND_EXPR_THEN (node
),
2796 if (!IS_EMPTY_STMT (COND_EXPR_ELSE (node
)))
2798 pp_string (pp
, " else ");
2799 dump_generic_node (pp
, COND_EXPR_ELSE (node
),
2803 else if (!(flags
& TDF_SLIM
))
2805 /* Output COND_EXPR_THEN. */
2806 if (COND_EXPR_THEN (node
))
2808 newline_and_indent (pp
, spc
+2);
2810 newline_and_indent (pp
, spc
+4);
2811 dump_generic_node (pp
, COND_EXPR_THEN (node
), spc
+4,
2813 newline_and_indent (pp
, spc
+2);
2814 pp_right_brace (pp
);
2817 /* Output COND_EXPR_ELSE. */
2818 if (COND_EXPR_ELSE (node
)
2819 && !IS_EMPTY_STMT (COND_EXPR_ELSE (node
)))
2821 newline_and_indent (pp
, spc
);
2822 pp_string (pp
, "else");
2823 newline_and_indent (pp
, spc
+2);
2825 newline_and_indent (pp
, spc
+4);
2826 dump_generic_node (pp
, COND_EXPR_ELSE (node
), spc
+4,
2828 newline_and_indent (pp
, spc
+2);
2829 pp_right_brace (pp
);
2836 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2840 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2844 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2850 if (!(flags
& TDF_SLIM
))
2852 if (BIND_EXPR_VARS (node
))
2856 for (op0
= BIND_EXPR_VARS (node
); op0
; op0
= DECL_CHAIN (op0
))
2858 print_declaration (pp
, op0
, spc
+2, flags
);
2863 newline_and_indent (pp
, spc
+2);
2864 dump_generic_node (pp
, BIND_EXPR_BODY (node
), spc
+2, flags
, true);
2865 newline_and_indent (pp
, spc
);
2866 pp_right_brace (pp
);
2872 if (CALL_EXPR_FN (node
) != NULL_TREE
)
2873 print_call_name (pp
, CALL_EXPR_FN (node
), flags
);
2877 pp_string (pp
, internal_fn_name (CALL_EXPR_IFN (node
)));
2880 /* Print parameters. */
2885 call_expr_arg_iterator iter
;
2886 FOR_EACH_CALL_EXPR_ARG (arg
, iter
, node
)
2888 dump_generic_node (pp
, arg
, spc
, flags
, false);
2889 if (more_call_expr_args_p (&iter
))
2896 if (CALL_EXPR_VA_ARG_PACK (node
))
2898 if (call_expr_nargs (node
) > 0)
2903 pp_string (pp
, "__builtin_va_arg_pack ()");
2905 pp_right_paren (pp
);
2907 op1
= CALL_EXPR_STATIC_CHAIN (node
);
2910 pp_string (pp
, " [static-chain: ");
2911 dump_generic_node (pp
, op1
, spc
, flags
, false);
2912 pp_right_bracket (pp
);
2915 if (CALL_EXPR_RETURN_SLOT_OPT (node
))
2916 pp_string (pp
, " [return slot optimization]");
2917 if (CALL_EXPR_TAILCALL (node
))
2918 pp_string (pp
, " [tail call]");
2921 case WITH_CLEANUP_EXPR
:
2925 case CLEANUP_POINT_EXPR
:
2926 pp_string (pp
, "<<cleanup_point ");
2927 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2928 pp_string (pp
, ">>");
2931 case PLACEHOLDER_EXPR
:
2932 pp_string (pp
, "<PLACEHOLDER_EXPR ");
2933 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
2937 /* Binary arithmetic and logic expressions. */
2938 case WIDEN_SUM_EXPR
:
2939 case WIDEN_MULT_EXPR
:
2941 case MULT_HIGHPART_EXPR
:
2943 case POINTER_PLUS_EXPR
:
2944 case POINTER_DIFF_EXPR
:
2946 case TRUNC_DIV_EXPR
:
2948 case FLOOR_DIV_EXPR
:
2949 case ROUND_DIV_EXPR
:
2950 case TRUNC_MOD_EXPR
:
2952 case FLOOR_MOD_EXPR
:
2953 case ROUND_MOD_EXPR
:
2955 case EXACT_DIV_EXPR
:
2960 case WIDEN_LSHIFT_EXPR
:
2964 case TRUTH_ANDIF_EXPR
:
2965 case TRUTH_ORIF_EXPR
:
2966 case TRUTH_AND_EXPR
:
2968 case TRUTH_XOR_EXPR
:
2982 case UNORDERED_EXPR
:
2984 const char *op
= op_symbol (node
);
2985 op0
= TREE_OPERAND (node
, 0);
2986 op1
= TREE_OPERAND (node
, 1);
2988 /* When the operands are expressions with less priority,
2989 keep semantics of the tree representation. */
2990 if (op_prio (op0
) <= op_prio (node
))
2993 dump_generic_node (pp
, op0
, spc
, flags
, false);
2994 pp_right_paren (pp
);
2997 dump_generic_node (pp
, op0
, spc
, flags
, false);
3003 /* When the operands are expressions with less priority,
3004 keep semantics of the tree representation. */
3005 if (op_prio (op1
) <= op_prio (node
))
3008 dump_generic_node (pp
, op1
, spc
, flags
, false);
3009 pp_right_paren (pp
);
3012 dump_generic_node (pp
, op1
, spc
, flags
, false);
3016 /* Unary arithmetic and logic expressions. */
3018 if (flags
& TDF_GIMPLE_VAL
)
3020 pp_string (pp
, "_Literal (");
3021 dump_generic_node (pp
, TREE_TYPE (node
), spc
,
3022 flags
& ~TDF_GIMPLE_VAL
, false);
3023 pp_character (pp
, ')');
3028 case TRUTH_NOT_EXPR
:
3029 case PREDECREMENT_EXPR
:
3030 case PREINCREMENT_EXPR
:
3032 if (!(flags
& TDF_GIMPLE
)
3033 && TREE_CODE (node
) == ADDR_EXPR
3034 && (TREE_CODE (TREE_OPERAND (node
, 0)) == STRING_CST
3035 || TREE_CODE (TREE_OPERAND (node
, 0)) == FUNCTION_DECL
))
3036 /* Do not output '&' for strings and function pointers when not
3037 dumping GIMPLE FE syntax. */
3040 pp_string (pp
, op_symbol (node
));
3042 if (op_prio (TREE_OPERAND (node
, 0)) < op_prio (node
))
3045 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3046 pp_right_paren (pp
);
3049 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3052 case POSTDECREMENT_EXPR
:
3053 case POSTINCREMENT_EXPR
:
3054 if (op_prio (TREE_OPERAND (node
, 0)) < op_prio (node
))
3057 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3058 pp_right_paren (pp
);
3061 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3062 pp_string (pp
, op_symbol (node
));
3066 pp_string (pp
, "MIN_EXPR <");
3067 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3068 pp_string (pp
, ", ");
3069 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3074 pp_string (pp
, "MAX_EXPR <");
3075 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3076 pp_string (pp
, ", ");
3077 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3082 pp_string (pp
, "ABS_EXPR <");
3083 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3088 pp_string (pp
, "ABSU_EXPR <");
3089 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3097 case ADDR_SPACE_CONVERT_EXPR
:
3098 case FIXED_CONVERT_EXPR
:
3099 case FIX_TRUNC_EXPR
:
3102 type
= TREE_TYPE (node
);
3103 op0
= TREE_OPERAND (node
, 0);
3104 if (type
!= TREE_TYPE (op0
))
3107 dump_generic_node (pp
, type
, spc
, flags
, false);
3108 pp_string (pp
, ") ");
3110 if (op_prio (op0
) < op_prio (node
))
3112 dump_generic_node (pp
, op0
, spc
, flags
, false);
3113 if (op_prio (op0
) < op_prio (node
))
3114 pp_right_paren (pp
);
3117 case VIEW_CONVERT_EXPR
:
3118 if (flags
& TDF_GIMPLE
)
3119 pp_string (pp
, "__VIEW_CONVERT <");
3121 pp_string (pp
, "VIEW_CONVERT_EXPR<");
3122 dump_generic_node (pp
, TREE_TYPE (node
), spc
, flags
, false);
3123 pp_string (pp
, ">(");
3124 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3125 pp_right_paren (pp
);
3129 pp_string (pp
, "((");
3130 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3131 pp_string (pp
, "))");
3134 case NON_LVALUE_EXPR
:
3135 pp_string (pp
, "NON_LVALUE_EXPR <");
3136 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3141 pp_string (pp
, "SAVE_EXPR <");
3142 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3147 pp_string (pp
, "COMPLEX_EXPR <");
3148 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3149 pp_string (pp
, ", ");
3150 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3155 pp_string (pp
, "CONJ_EXPR <");
3156 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3161 if (flags
& TDF_GIMPLE
)
3163 pp_string (pp
, "__real ");
3164 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3168 pp_string (pp
, "REALPART_EXPR <");
3169 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3175 if (flags
& TDF_GIMPLE
)
3177 pp_string (pp
, "__imag ");
3178 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3182 pp_string (pp
, "IMAGPART_EXPR <");
3183 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3189 pp_string (pp
, "VA_ARG_EXPR <");
3190 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3194 case TRY_FINALLY_EXPR
:
3195 case TRY_CATCH_EXPR
:
3196 pp_string (pp
, "try");
3197 newline_and_indent (pp
, spc
+2);
3199 newline_and_indent (pp
, spc
+4);
3200 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
+4, flags
, true);
3201 newline_and_indent (pp
, spc
+2);
3202 pp_right_brace (pp
);
3203 newline_and_indent (pp
, spc
);
3204 if (TREE_CODE (node
) == TRY_CATCH_EXPR
)
3206 node
= TREE_OPERAND (node
, 1);
3207 pp_string (pp
, "catch");
3211 gcc_assert (TREE_CODE (node
) == TRY_FINALLY_EXPR
);
3212 node
= TREE_OPERAND (node
, 1);
3213 pp_string (pp
, "finally");
3214 if (TREE_CODE (node
) == EH_ELSE_EXPR
)
3216 newline_and_indent (pp
, spc
+2);
3218 newline_and_indent (pp
, spc
+4);
3219 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
+4,
3221 newline_and_indent (pp
, spc
+2);
3222 pp_right_brace (pp
);
3223 newline_and_indent (pp
, spc
);
3224 node
= TREE_OPERAND (node
, 1);
3225 pp_string (pp
, "else");
3228 newline_and_indent (pp
, spc
+2);
3230 newline_and_indent (pp
, spc
+4);
3231 dump_generic_node (pp
, node
, spc
+4, flags
, true);
3232 newline_and_indent (pp
, spc
+2);
3233 pp_right_brace (pp
);
3238 pp_string (pp
, "catch (");
3239 dump_generic_node (pp
, CATCH_TYPES (node
), spc
+2, flags
, false);
3240 pp_right_paren (pp
);
3241 newline_and_indent (pp
, spc
+2);
3243 newline_and_indent (pp
, spc
+4);
3244 dump_generic_node (pp
, CATCH_BODY (node
), spc
+4, flags
, true);
3245 newline_and_indent (pp
, spc
+2);
3246 pp_right_brace (pp
);
3250 case EH_FILTER_EXPR
:
3251 pp_string (pp
, "<<<eh_filter (");
3252 dump_generic_node (pp
, EH_FILTER_TYPES (node
), spc
+2, flags
, false);
3253 pp_string (pp
, ")>>>");
3254 newline_and_indent (pp
, spc
+2);
3256 newline_and_indent (pp
, spc
+4);
3257 dump_generic_node (pp
, EH_FILTER_FAILURE (node
), spc
+4, flags
, true);
3258 newline_and_indent (pp
, spc
+2);
3259 pp_right_brace (pp
);
3264 op0
= TREE_OPERAND (node
, 0);
3265 /* If this is for break or continue, don't bother printing it. */
3266 if (DECL_NAME (op0
))
3268 const char *name
= IDENTIFIER_POINTER (DECL_NAME (op0
));
3269 if (strcmp (name
, "break") == 0
3270 || strcmp (name
, "continue") == 0)
3273 dump_generic_node (pp
, op0
, spc
, flags
, false);
3275 if (DECL_NONLOCAL (op0
))
3276 pp_string (pp
, " [non-local]");
3280 pp_string (pp
, "while (1)");
3281 if (!(flags
& TDF_SLIM
))
3283 newline_and_indent (pp
, spc
+2);
3285 newline_and_indent (pp
, spc
+4);
3286 dump_generic_node (pp
, LOOP_EXPR_BODY (node
), spc
+4, flags
, true);
3287 newline_and_indent (pp
, spc
+2);
3288 pp_right_brace (pp
);
3294 pp_string (pp
, "// predicted ");
3295 if (PREDICT_EXPR_OUTCOME (node
))
3296 pp_string (pp
, "likely by ");
3298 pp_string (pp
, "unlikely by ");
3299 pp_string (pp
, predictor_name (PREDICT_EXPR_PREDICTOR (node
)));
3300 pp_string (pp
, " predictor.");
3304 pp_string (pp
, "ANNOTATE_EXPR <");
3305 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3306 switch ((enum annot_expr_kind
) TREE_INT_CST_LOW (TREE_OPERAND (node
, 1)))
3308 case annot_expr_ivdep_kind
:
3309 pp_string (pp
, ", ivdep");
3311 case annot_expr_unroll_kind
:
3313 pp_string (pp
, ", unroll ");
3315 (int) TREE_INT_CST_LOW (TREE_OPERAND (node
, 2)));
3318 case annot_expr_no_vector_kind
:
3319 pp_string (pp
, ", no-vector");
3321 case annot_expr_vector_kind
:
3322 pp_string (pp
, ", vector");
3324 case annot_expr_parallel_kind
:
3325 pp_string (pp
, ", parallel");
3334 pp_string (pp
, "return");
3335 op0
= TREE_OPERAND (node
, 0);
3339 if (TREE_CODE (op0
) == MODIFY_EXPR
)
3340 dump_generic_node (pp
, TREE_OPERAND (op0
, 1),
3343 dump_generic_node (pp
, op0
, spc
, flags
, false);
3348 pp_string (pp
, "if (");
3349 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3350 pp_string (pp
, ") break");
3354 pp_string (pp
, "switch (");
3355 dump_generic_node (pp
, SWITCH_COND (node
), spc
, flags
, false);
3356 pp_right_paren (pp
);
3357 if (!(flags
& TDF_SLIM
))
3359 newline_and_indent (pp
, spc
+2);
3361 if (SWITCH_BODY (node
))
3363 newline_and_indent (pp
, spc
+4);
3364 dump_generic_node (pp
, SWITCH_BODY (node
), spc
+4, flags
,
3367 newline_and_indent (pp
, spc
+2);
3368 pp_right_brace (pp
);
3374 op0
= GOTO_DESTINATION (node
);
3375 if (TREE_CODE (op0
) != SSA_NAME
&& DECL_P (op0
) && DECL_NAME (op0
))
3377 const char *name
= IDENTIFIER_POINTER (DECL_NAME (op0
));
3378 if (strcmp (name
, "break") == 0
3379 || strcmp (name
, "continue") == 0)
3381 pp_string (pp
, name
);
3385 pp_string (pp
, "goto ");
3386 dump_generic_node (pp
, op0
, spc
, flags
, false);
3390 pp_string (pp
, "__asm__");
3391 if (ASM_VOLATILE_P (node
))
3392 pp_string (pp
, " __volatile__");
3394 dump_generic_node (pp
, ASM_STRING (node
), spc
, flags
, false);
3396 dump_generic_node (pp
, ASM_OUTPUTS (node
), spc
, flags
, false);
3398 dump_generic_node (pp
, ASM_INPUTS (node
), spc
, flags
, false);
3399 if (ASM_CLOBBERS (node
))
3402 dump_generic_node (pp
, ASM_CLOBBERS (node
), spc
, flags
, false);
3404 pp_right_paren (pp
);
3407 case CASE_LABEL_EXPR
:
3408 if (CASE_LOW (node
) && CASE_HIGH (node
))
3410 pp_string (pp
, "case ");
3411 dump_generic_node (pp
, CASE_LOW (node
), spc
, flags
, false);
3412 pp_string (pp
, " ... ");
3413 dump_generic_node (pp
, CASE_HIGH (node
), spc
, flags
, false);
3415 else if (CASE_LOW (node
))
3417 pp_string (pp
, "case ");
3418 dump_generic_node (pp
, CASE_LOW (node
), spc
, flags
, false);
3421 pp_string (pp
, "default");
3426 pp_string (pp
, "OBJ_TYPE_REF(");
3427 dump_generic_node (pp
, OBJ_TYPE_REF_EXPR (node
), spc
, flags
, false);
3429 /* We omit the class type for -fcompare-debug because we may
3430 drop TYPE_BINFO early depending on debug info, and then
3431 virtual_method_call_p would return false, whereas when
3432 TYPE_BINFO is preserved it may still return true and then
3433 we'd print the class type. Compare tree and rtl dumps for
3434 libstdc++-prettyprinters/shared_ptr.cc with and without -g,
3435 for example, at occurrences of OBJ_TYPE_REF. */
3436 if (!(flags
& (TDF_SLIM
| TDF_COMPARE_DEBUG
))
3437 && virtual_method_call_p (node
, true))
3439 pp_string (pp
, "(");
3440 dump_generic_node (pp
, obj_type_ref_class (node
, true),
3442 pp_string (pp
, ")");
3444 dump_generic_node (pp
, OBJ_TYPE_REF_OBJECT (node
), spc
, flags
, false);
3446 dump_generic_node (pp
, OBJ_TYPE_REF_TOKEN (node
), spc
, flags
, false);
3447 pp_right_paren (pp
);
3451 if (SSA_NAME_IDENTIFIER (node
))
3453 if ((flags
& TDF_NOUID
)
3454 && SSA_NAME_VAR (node
)
3455 && DECL_NAMELESS (SSA_NAME_VAR (node
)))
3456 dump_fancy_name (pp
, SSA_NAME_IDENTIFIER (node
));
3457 else if (! (flags
& TDF_GIMPLE
)
3458 || SSA_NAME_VAR (node
))
3459 dump_generic_node (pp
, SSA_NAME_IDENTIFIER (node
),
3463 pp_decimal_int (pp
, SSA_NAME_VERSION (node
));
3464 if (SSA_NAME_IS_DEFAULT_DEF (node
))
3465 pp_string (pp
, "(D)");
3466 if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (node
))
3467 pp_string (pp
, "(ab)");
3470 case WITH_SIZE_EXPR
:
3471 pp_string (pp
, "WITH_SIZE_EXPR <");
3472 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3473 pp_string (pp
, ", ");
3474 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3479 pp_string (pp
, "scev_known");
3482 case SCEV_NOT_KNOWN
:
3483 pp_string (pp
, "scev_not_known");
3486 case POLYNOMIAL_CHREC
:
3488 dump_generic_node (pp
, CHREC_LEFT (node
), spc
, flags
, false);
3489 pp_string (pp
, ", +, ");
3490 dump_generic_node (pp
, CHREC_RIGHT (node
), spc
, flags
, false);
3491 pp_string (pp
, "}_");
3492 pp_scalar (pp
, "%u", CHREC_VARIABLE (node
));
3496 case REALIGN_LOAD_EXPR
:
3497 pp_string (pp
, "REALIGN_LOAD <");
3498 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3499 pp_string (pp
, ", ");
3500 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3501 pp_string (pp
, ", ");
3502 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3507 pp_string (pp
, " VEC_COND_EXPR < ");
3508 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3509 pp_string (pp
, " , ");
3510 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3511 pp_string (pp
, " , ");
3512 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3513 pp_string (pp
, " > ");
3517 pp_string (pp
, " VEC_PERM_EXPR < ");
3518 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3519 pp_string (pp
, " , ");
3520 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3521 pp_string (pp
, " , ");
3522 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3523 pp_string (pp
, " > ");
3527 pp_string (pp
, " DOT_PROD_EXPR < ");
3528 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3529 pp_string (pp
, ", ");
3530 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3531 pp_string (pp
, ", ");
3532 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3533 pp_string (pp
, " > ");
3536 case WIDEN_MULT_PLUS_EXPR
:
3537 pp_string (pp
, " WIDEN_MULT_PLUS_EXPR < ");
3538 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3539 pp_string (pp
, ", ");
3540 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3541 pp_string (pp
, ", ");
3542 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3543 pp_string (pp
, " > ");
3546 case WIDEN_MULT_MINUS_EXPR
:
3547 pp_string (pp
, " WIDEN_MULT_MINUS_EXPR < ");
3548 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3549 pp_string (pp
, ", ");
3550 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3551 pp_string (pp
, ", ");
3552 dump_generic_node (pp
, TREE_OPERAND (node
, 2), spc
, flags
, false);
3553 pp_string (pp
, " > ");
3557 pp_string (pp
, "#pragma acc parallel");
3558 goto dump_omp_clauses_body
;
3561 pp_string (pp
, "#pragma acc kernels");
3562 goto dump_omp_clauses_body
;
3565 pp_string (pp
, "#pragma acc serial");
3566 goto dump_omp_clauses_body
;
3569 pp_string (pp
, "#pragma acc data");
3570 dump_omp_clauses (pp
, OACC_DATA_CLAUSES (node
), spc
, flags
);
3573 case OACC_HOST_DATA
:
3574 pp_string (pp
, "#pragma acc host_data");
3575 dump_omp_clauses (pp
, OACC_HOST_DATA_CLAUSES (node
), spc
, flags
);
3579 pp_string (pp
, "#pragma acc declare");
3580 dump_omp_clauses (pp
, OACC_DECLARE_CLAUSES (node
), spc
, flags
);
3584 pp_string (pp
, "#pragma acc update");
3585 dump_omp_clauses (pp
, OACC_UPDATE_CLAUSES (node
), spc
, flags
);
3588 case OACC_ENTER_DATA
:
3589 pp_string (pp
, "#pragma acc enter data");
3590 dump_omp_clauses (pp
, OACC_ENTER_DATA_CLAUSES (node
), spc
, flags
);
3593 case OACC_EXIT_DATA
:
3594 pp_string (pp
, "#pragma acc exit data");
3595 dump_omp_clauses (pp
, OACC_EXIT_DATA_CLAUSES (node
), spc
, flags
);
3599 pp_string (pp
, "#pragma acc cache");
3600 dump_omp_clauses (pp
, OACC_CACHE_CLAUSES (node
), spc
, flags
);
3604 pp_string (pp
, "#pragma omp parallel");
3605 dump_omp_clauses (pp
, OMP_PARALLEL_CLAUSES (node
), spc
, flags
);
3608 dump_omp_clauses_body
:
3609 dump_omp_clauses (pp
, OMP_CLAUSES (node
), spc
, flags
);
3613 if (!(flags
& TDF_SLIM
) && OMP_BODY (node
))
3615 newline_and_indent (pp
, spc
+ 2);
3617 newline_and_indent (pp
, spc
+ 4);
3618 dump_generic_node (pp
, OMP_BODY (node
), spc
+ 4, flags
, false);
3619 newline_and_indent (pp
, spc
+ 2);
3620 pp_right_brace (pp
);
3626 pp_string (pp
, OMP_TASK_BODY (node
) ? "#pragma omp task"
3627 : "#pragma omp taskwait");
3628 dump_omp_clauses (pp
, OMP_TASK_CLAUSES (node
), spc
, flags
);
3632 pp_string (pp
, "#pragma omp for");
3636 pp_string (pp
, "#pragma omp simd");
3639 case OMP_DISTRIBUTE
:
3640 pp_string (pp
, "#pragma omp distribute");
3644 pp_string (pp
, "#pragma omp taskloop");
3648 pp_string (pp
, "#pragma omp loop");
3652 pp_string (pp
, "#pragma acc loop");
3656 pp_string (pp
, "#pragma omp teams");
3657 dump_omp_clauses (pp
, OMP_TEAMS_CLAUSES (node
), spc
, flags
);
3660 case OMP_TARGET_DATA
:
3661 pp_string (pp
, "#pragma omp target data");
3662 dump_omp_clauses (pp
, OMP_TARGET_DATA_CLAUSES (node
), spc
, flags
);
3665 case OMP_TARGET_ENTER_DATA
:
3666 pp_string (pp
, "#pragma omp target enter data");
3667 dump_omp_clauses (pp
, OMP_TARGET_ENTER_DATA_CLAUSES (node
), spc
, flags
);
3671 case OMP_TARGET_EXIT_DATA
:
3672 pp_string (pp
, "#pragma omp target exit data");
3673 dump_omp_clauses (pp
, OMP_TARGET_EXIT_DATA_CLAUSES (node
), spc
, flags
);
3678 pp_string (pp
, "#pragma omp target");
3679 dump_omp_clauses (pp
, OMP_TARGET_CLAUSES (node
), spc
, flags
);
3682 case OMP_TARGET_UPDATE
:
3683 pp_string (pp
, "#pragma omp target update");
3684 dump_omp_clauses (pp
, OMP_TARGET_UPDATE_CLAUSES (node
), spc
, flags
);
3689 dump_omp_clauses (pp
, OMP_FOR_CLAUSES (node
), spc
, flags
);
3690 if (!(flags
& TDF_SLIM
))
3694 if (OMP_FOR_PRE_BODY (node
))
3696 newline_and_indent (pp
, spc
+ 2);
3699 newline_and_indent (pp
, spc
);
3700 dump_generic_node (pp
, OMP_FOR_PRE_BODY (node
),
3703 if (OMP_FOR_INIT (node
))
3706 for (i
= 0; i
< TREE_VEC_LENGTH (OMP_FOR_INIT (node
)); i
++)
3709 newline_and_indent (pp
, spc
);
3710 pp_string (pp
, "for (");
3711 tree init
= TREE_VEC_ELT (OMP_FOR_INIT (node
), i
);
3712 if (TREE_CODE (init
) != MODIFY_EXPR
3713 || TREE_CODE (TREE_OPERAND (init
, 1)) != TREE_VEC
)
3714 dump_generic_node (pp
, init
, spc
, flags
, false);
3717 dump_generic_node (pp
, TREE_OPERAND (init
, 0),
3719 pp_string (pp
, " = ");
3720 dump_omp_loop_non_rect_expr (pp
, TREE_OPERAND (init
, 1),
3723 pp_string (pp
, "; ");
3724 tree cond
= TREE_VEC_ELT (OMP_FOR_COND (node
), i
);
3725 if (!COMPARISON_CLASS_P (cond
)
3726 || TREE_CODE (TREE_OPERAND (cond
, 1)) != TREE_VEC
)
3727 dump_generic_node (pp
, cond
, spc
, flags
, false);
3730 dump_generic_node (pp
, TREE_OPERAND (cond
, 0),
3732 const char *op
= op_symbol (cond
);
3736 dump_omp_loop_non_rect_expr (pp
, TREE_OPERAND (cond
, 1),
3739 pp_string (pp
, "; ");
3740 dump_generic_node (pp
,
3741 TREE_VEC_ELT (OMP_FOR_INCR (node
), i
),
3743 pp_right_paren (pp
);
3746 if (OMP_FOR_BODY (node
))
3748 newline_and_indent (pp
, spc
+ 2);
3750 newline_and_indent (pp
, spc
+ 4);
3751 dump_generic_node (pp
, OMP_FOR_BODY (node
), spc
+ 4, flags
,
3753 newline_and_indent (pp
, spc
+ 2);
3754 pp_right_brace (pp
);
3756 if (OMP_FOR_INIT (node
))
3757 spc
-= 2 * TREE_VEC_LENGTH (OMP_FOR_INIT (node
)) - 2;
3758 if (OMP_FOR_PRE_BODY (node
))
3761 newline_and_indent (pp
, spc
+ 2);
3762 pp_right_brace (pp
);
3769 pp_string (pp
, "#pragma omp sections");
3770 dump_omp_clauses (pp
, OMP_SECTIONS_CLAUSES (node
), spc
, flags
);
3774 pp_string (pp
, "#pragma omp section");
3777 case OMP_STRUCTURED_BLOCK
:
3778 pp_string (pp
, "#pragma omp __structured_block");
3782 if (OMP_SCAN_CLAUSES (node
))
3784 pp_string (pp
, "#pragma omp scan");
3785 dump_omp_clauses (pp
, OMP_SCAN_CLAUSES (node
), spc
, flags
);
3790 pp_string (pp
, "#pragma omp master");
3794 pp_string (pp
, "#pragma omp masked");
3795 dump_omp_clauses (pp
, OMP_MASKED_CLAUSES (node
), spc
, flags
);
3799 pp_string (pp
, "#pragma omp taskgroup");
3800 dump_omp_clauses (pp
, OMP_TASKGROUP_CLAUSES (node
), spc
, flags
);
3804 pp_string (pp
, "#pragma omp ordered");
3805 dump_omp_clauses (pp
, OMP_ORDERED_CLAUSES (node
), spc
, flags
);
3809 pp_string (pp
, "#pragma omp critical");
3810 if (OMP_CRITICAL_NAME (node
))
3814 dump_generic_node (pp
, OMP_CRITICAL_NAME (node
), spc
,
3816 pp_right_paren (pp
);
3818 dump_omp_clauses (pp
, OMP_CRITICAL_CLAUSES (node
), spc
, flags
);
3822 pp_string (pp
, "#pragma omp atomic");
3823 if (OMP_ATOMIC_WEAK (node
))
3824 pp_string (pp
, " weak");
3825 dump_omp_atomic_memory_order (pp
, OMP_ATOMIC_MEMORY_ORDER (node
));
3826 newline_and_indent (pp
, spc
+ 2);
3827 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3831 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3834 case OMP_ATOMIC_READ
:
3835 pp_string (pp
, "#pragma omp atomic read");
3836 dump_omp_atomic_memory_order (pp
, OMP_ATOMIC_MEMORY_ORDER (node
));
3837 newline_and_indent (pp
, spc
+ 2);
3838 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3842 case OMP_ATOMIC_CAPTURE_OLD
:
3843 case OMP_ATOMIC_CAPTURE_NEW
:
3844 pp_string (pp
, "#pragma omp atomic capture");
3845 if (OMP_ATOMIC_WEAK (node
))
3846 pp_string (pp
, " weak");
3847 dump_omp_atomic_memory_order (pp
, OMP_ATOMIC_MEMORY_ORDER (node
));
3848 newline_and_indent (pp
, spc
+ 2);
3849 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3853 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3857 pp_string (pp
, "#pragma omp single");
3858 dump_omp_clauses (pp
, OMP_SINGLE_CLAUSES (node
), spc
, flags
);
3862 pp_string (pp
, "#pragma omp scope");
3863 dump_omp_clauses (pp
, OMP_SCOPE_CLAUSES (node
), spc
, flags
);
3867 /* If we come here, we're dumping something that's not an OMP construct,
3868 for example, OMP clauses attached to a function's '__attribute__'.
3869 Dump the whole OMP clause chain. */
3870 dump_omp_clauses (pp
, node
, spc
, flags
, false);
3874 case TRANSACTION_EXPR
:
3875 if (TRANSACTION_EXPR_OUTER (node
))
3876 pp_string (pp
, "__transaction_atomic [[outer]]");
3877 else if (TRANSACTION_EXPR_RELAXED (node
))
3878 pp_string (pp
, "__transaction_relaxed");
3880 pp_string (pp
, "__transaction_atomic");
3881 if (!(flags
& TDF_SLIM
) && TRANSACTION_EXPR_BODY (node
))
3883 newline_and_indent (pp
, spc
);
3885 newline_and_indent (pp
, spc
+ 2);
3886 dump_generic_node (pp
, TRANSACTION_EXPR_BODY (node
),
3887 spc
+ 2, flags
, false);
3888 newline_and_indent (pp
, spc
);
3889 pp_right_brace (pp
);
3894 case VEC_SERIES_EXPR
:
3895 case VEC_WIDEN_MULT_HI_EXPR
:
3896 case VEC_WIDEN_MULT_LO_EXPR
:
3897 case VEC_WIDEN_MULT_EVEN_EXPR
:
3898 case VEC_WIDEN_MULT_ODD_EXPR
:
3899 case VEC_WIDEN_LSHIFT_HI_EXPR
:
3900 case VEC_WIDEN_LSHIFT_LO_EXPR
:
3902 for (str
= get_tree_code_name (code
); *str
; str
++)
3903 pp_character (pp
, TOUPPER (*str
));
3904 pp_string (pp
, " < ");
3905 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3906 pp_string (pp
, ", ");
3907 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3908 pp_string (pp
, " > ");
3911 case VEC_DUPLICATE_EXPR
:
3913 for (str
= get_tree_code_name (code
); *str
; str
++)
3914 pp_character (pp
, TOUPPER (*str
));
3915 pp_string (pp
, " < ");
3916 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3917 pp_string (pp
, " > ");
3920 case VEC_UNPACK_HI_EXPR
:
3921 pp_string (pp
, " VEC_UNPACK_HI_EXPR < ");
3922 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3923 pp_string (pp
, " > ");
3926 case VEC_UNPACK_LO_EXPR
:
3927 pp_string (pp
, " VEC_UNPACK_LO_EXPR < ");
3928 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3929 pp_string (pp
, " > ");
3932 case VEC_UNPACK_FLOAT_HI_EXPR
:
3933 pp_string (pp
, " VEC_UNPACK_FLOAT_HI_EXPR < ");
3934 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3935 pp_string (pp
, " > ");
3938 case VEC_UNPACK_FLOAT_LO_EXPR
:
3939 pp_string (pp
, " VEC_UNPACK_FLOAT_LO_EXPR < ");
3940 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3941 pp_string (pp
, " > ");
3944 case VEC_UNPACK_FIX_TRUNC_HI_EXPR
:
3945 pp_string (pp
, " VEC_UNPACK_FIX_TRUNC_HI_EXPR < ");
3946 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3947 pp_string (pp
, " > ");
3950 case VEC_UNPACK_FIX_TRUNC_LO_EXPR
:
3951 pp_string (pp
, " VEC_UNPACK_FIX_TRUNC_LO_EXPR < ");
3952 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3953 pp_string (pp
, " > ");
3956 case VEC_PACK_TRUNC_EXPR
:
3957 pp_string (pp
, " VEC_PACK_TRUNC_EXPR < ");
3958 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3959 pp_string (pp
, ", ");
3960 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3961 pp_string (pp
, " > ");
3964 case VEC_PACK_SAT_EXPR
:
3965 pp_string (pp
, " VEC_PACK_SAT_EXPR < ");
3966 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3967 pp_string (pp
, ", ");
3968 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3969 pp_string (pp
, " > ");
3972 case VEC_PACK_FIX_TRUNC_EXPR
:
3973 pp_string (pp
, " VEC_PACK_FIX_TRUNC_EXPR < ");
3974 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3975 pp_string (pp
, ", ");
3976 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3977 pp_string (pp
, " > ");
3980 case VEC_PACK_FLOAT_EXPR
:
3981 pp_string (pp
, " VEC_PACK_FLOAT_EXPR < ");
3982 dump_generic_node (pp
, TREE_OPERAND (node
, 0), spc
, flags
, false);
3983 pp_string (pp
, ", ");
3984 dump_generic_node (pp
, TREE_OPERAND (node
, 1), spc
, flags
, false);
3985 pp_string (pp
, " > ");
3989 dump_block_node (pp
, node
, spc
, flags
);
3992 case DEBUG_BEGIN_STMT
:
3993 pp_string (pp
, "# DEBUG BEGIN STMT");
4000 if (is_stmt
&& is_expr
)
4006 /* Print the declaration of a variable. */
4009 print_declaration (pretty_printer
*pp
, tree t
, int spc
, dump_flags_t flags
)
4013 if (TREE_CODE(t
) == NAMELIST_DECL
)
4015 pp_string(pp
, "namelist ");
4016 dump_decl_name (pp
, t
, flags
);
4021 if (TREE_CODE (t
) == TYPE_DECL
)
4022 pp_string (pp
, "typedef ");
4024 if (HAS_RTL_P (t
) && DECL_REGISTER (t
))
4025 pp_string (pp
, "register ");
4027 if (TREE_PUBLIC (t
) && DECL_EXTERNAL (t
))
4028 pp_string (pp
, "extern ");
4029 else if (TREE_STATIC (t
))
4030 pp_string (pp
, "static ");
4032 /* Print the type and name. */
4033 if (TREE_TYPE (t
) && TREE_CODE (TREE_TYPE (t
)) == ARRAY_TYPE
)
4037 /* Print array's type. */
4038 tmp
= TREE_TYPE (t
);
4039 while (TREE_CODE (TREE_TYPE (tmp
)) == ARRAY_TYPE
)
4040 tmp
= TREE_TYPE (tmp
);
4041 dump_generic_node (pp
, TREE_TYPE (tmp
), spc
, flags
, false);
4043 /* Print variable's name. */
4045 dump_generic_node (pp
, t
, spc
, flags
, false);
4047 /* Print the dimensions. */
4048 tmp
= TREE_TYPE (t
);
4049 while (TREE_CODE (tmp
) == ARRAY_TYPE
)
4051 dump_array_domain (pp
, TYPE_DOMAIN (tmp
), spc
, flags
);
4052 tmp
= TREE_TYPE (tmp
);
4055 else if (TREE_CODE (t
) == FUNCTION_DECL
)
4057 dump_generic_node (pp
, TREE_TYPE (TREE_TYPE (t
)), spc
, flags
, false);
4059 dump_decl_name (pp
, t
, flags
);
4060 dump_function_declaration (pp
, TREE_TYPE (t
), spc
, flags
);
4064 /* Print type declaration. */
4065 dump_generic_node (pp
, TREE_TYPE (t
), spc
, flags
, false);
4067 /* Print variable's name. */
4069 dump_generic_node (pp
, t
, spc
, flags
, false);
4072 if (VAR_P (t
) && DECL_HARD_REGISTER (t
))
4074 pp_string (pp
, " __asm__ ");
4076 dump_generic_node (pp
, DECL_ASSEMBLER_NAME (t
), spc
, flags
, false);
4077 pp_right_paren (pp
);
4080 /* The initial value of a function serves to determine whether the function
4081 is declared or defined. So the following does not apply to function
4083 if (TREE_CODE (t
) != FUNCTION_DECL
)
4085 /* Print the initial value. */
4086 if (DECL_INITIAL (t
))
4091 if (!(flags
& TDF_SLIM
))
4092 dump_generic_node (pp
, DECL_INITIAL (t
), spc
, flags
, false);
4094 pp_string (pp
, "<<< omitted >>>");
4098 if (VAR_P (t
) && DECL_HAS_VALUE_EXPR_P (t
))
4100 pp_string (pp
, " [value-expr: ");
4101 dump_generic_node (pp
, DECL_VALUE_EXPR (t
), spc
, flags
, false);
4102 pp_right_bracket (pp
);
4109 /* Prints a structure: name, fields, and methods.
4110 FIXME: Still incomplete. */
4113 print_struct_decl (pretty_printer
*pp
, const_tree node
, int spc
,
4116 /* Print the name of the structure. */
4117 if (TYPE_NAME (node
))
4120 if (TREE_CODE (node
) == RECORD_TYPE
)
4121 pp_string (pp
, "struct ");
4122 else if ((TREE_CODE (node
) == UNION_TYPE
4123 || TREE_CODE (node
) == QUAL_UNION_TYPE
))
4124 pp_string (pp
, "union ");
4126 dump_generic_node (pp
, TYPE_NAME (node
), spc
, TDF_NONE
, false);
4129 /* Print the contents of the structure. */
4135 /* Print the fields of the structure. */
4138 tmp
= TYPE_FIELDS (node
);
4141 /* Avoid to print recursively the structure. */
4142 /* FIXME : Not implemented correctly...,
4143 what about the case when we have a cycle in the contain graph? ...
4144 Maybe this could be solved by looking at the scope in which the
4145 structure was declared. */
4146 if (TREE_TYPE (tmp
) != node
4147 && (TREE_CODE (TREE_TYPE (tmp
)) != POINTER_TYPE
4148 || TREE_TYPE (TREE_TYPE (tmp
)) != node
))
4150 print_declaration (pp
, tmp
, spc
+2, flags
);
4153 tmp
= DECL_CHAIN (tmp
);
4157 pp_right_brace (pp
);
4160 /* Return the priority of the operator CODE.
4162 From lowest to highest precedence with either left-to-right (L-R)
4163 or right-to-left (R-L) associativity]:
4166 2 [R-L] = += -= *= /= %= &= ^= |= <<= >>=
4178 14 [R-L] ! ~ ++ -- + - * & (type) sizeof
4179 15 [L-R] fn() [] -> .
4181 unary +, - and * have higher precedence than the corresponding binary
4185 op_code_prio (enum tree_code code
)
4202 case TRUTH_ORIF_EXPR
:
4205 case TRUTH_AND_EXPR
:
4206 case TRUTH_ANDIF_EXPR
:
4213 case TRUTH_XOR_EXPR
:
4230 case UNORDERED_EXPR
:
4241 case VEC_WIDEN_LSHIFT_HI_EXPR
:
4242 case VEC_WIDEN_LSHIFT_LO_EXPR
:
4243 case WIDEN_LSHIFT_EXPR
:
4246 case WIDEN_SUM_EXPR
:
4248 case POINTER_PLUS_EXPR
:
4249 case POINTER_DIFF_EXPR
:
4253 case VEC_WIDEN_MULT_HI_EXPR
:
4254 case VEC_WIDEN_MULT_LO_EXPR
:
4255 case WIDEN_MULT_EXPR
:
4257 case WIDEN_MULT_PLUS_EXPR
:
4258 case WIDEN_MULT_MINUS_EXPR
:
4260 case MULT_HIGHPART_EXPR
:
4261 case TRUNC_DIV_EXPR
:
4263 case FLOOR_DIV_EXPR
:
4264 case ROUND_DIV_EXPR
:
4266 case EXACT_DIV_EXPR
:
4267 case TRUNC_MOD_EXPR
:
4269 case FLOOR_MOD_EXPR
:
4270 case ROUND_MOD_EXPR
:
4273 case TRUTH_NOT_EXPR
:
4275 case POSTINCREMENT_EXPR
:
4276 case POSTDECREMENT_EXPR
:
4277 case PREINCREMENT_EXPR
:
4278 case PREDECREMENT_EXPR
:
4284 case FIX_TRUNC_EXPR
:
4290 case ARRAY_RANGE_REF
:
4294 /* Special expressions. */
4300 case VEC_UNPACK_HI_EXPR
:
4301 case VEC_UNPACK_LO_EXPR
:
4302 case VEC_UNPACK_FLOAT_HI_EXPR
:
4303 case VEC_UNPACK_FLOAT_LO_EXPR
:
4304 case VEC_UNPACK_FIX_TRUNC_HI_EXPR
:
4305 case VEC_UNPACK_FIX_TRUNC_LO_EXPR
:
4306 case VEC_PACK_TRUNC_EXPR
:
4307 case VEC_PACK_SAT_EXPR
:
4311 /* Return an arbitrarily high precedence to avoid surrounding single
4312 VAR_DECLs in ()s. */
4317 /* Return the priority of the operator OP. */
4320 op_prio (const_tree op
)
4322 enum tree_code code
;
4327 code
= TREE_CODE (op
);
4328 if (code
== SAVE_EXPR
|| code
== NON_LVALUE_EXPR
)
4329 return op_prio (TREE_OPERAND (op
, 0));
4331 return op_code_prio (code
);
4334 /* Return the symbol associated with operator CODE. */
4337 op_symbol_code (enum tree_code code
, dump_flags_t flags
)
4345 case TRUTH_ORIF_EXPR
:
4348 case TRUTH_AND_EXPR
:
4349 case TRUTH_ANDIF_EXPR
:
4355 case TRUTH_XOR_EXPR
:
4364 return (flags
& TDF_GIMPLE
) ? "__ORDERED" : "ord";
4365 case UNORDERED_EXPR
:
4366 return (flags
& TDF_GIMPLE
) ? "__UNORDERED" : "unord";
4371 return (flags
& TDF_GIMPLE
) ? "__UNEQ" : "u==";
4379 return (flags
& TDF_GIMPLE
) ? "__UNLT" : "u<";
4384 return (flags
& TDF_GIMPLE
) ? "__UNLE" : "u<=";
4389 return (flags
& TDF_GIMPLE
) ? "__UNGT" : "u>";
4394 return (flags
& TDF_GIMPLE
) ? "__UNGE" : "u>=";
4397 return (flags
& TDF_GIMPLE
) ? "__LTGT" : "<>";
4411 case WIDEN_LSHIFT_EXPR
:
4414 case POINTER_PLUS_EXPR
:
4420 case WIDEN_SUM_EXPR
:
4423 case WIDEN_MULT_EXPR
:
4426 case MULT_HIGHPART_EXPR
:
4427 return (flags
& TDF_GIMPLE
) ? "__MULT_HIGHPART" : "h*";
4431 case POINTER_DIFF_EXPR
:
4437 case TRUTH_NOT_EXPR
:
4444 case TRUNC_DIV_EXPR
:
4451 case FLOOR_DIV_EXPR
:
4454 case ROUND_DIV_EXPR
:
4457 case EXACT_DIV_EXPR
:
4460 case TRUNC_MOD_EXPR
:
4466 case FLOOR_MOD_EXPR
:
4469 case ROUND_MOD_EXPR
:
4472 case PREDECREMENT_EXPR
:
4475 case PREINCREMENT_EXPR
:
4478 case POSTDECREMENT_EXPR
:
4481 case POSTINCREMENT_EXPR
:
4491 return "<<< ??? >>>";
4495 /* Return the symbol associated with operator OP. */
4498 op_symbol (const_tree op
, dump_flags_t flags
)
4500 return op_symbol_code (TREE_CODE (op
), flags
);
4503 /* Prints the name of a call. NODE is the CALL_EXPR_FN of a CALL_EXPR or
4504 the gimple_call_fn of a GIMPLE_CALL. */
4507 print_call_name (pretty_printer
*pp
, tree node
, dump_flags_t flags
)
4512 if (TREE_CODE (op0
) == NON_LVALUE_EXPR
)
4513 op0
= TREE_OPERAND (op0
, 0);
4516 switch (TREE_CODE (op0
))
4521 dump_function_name (pp
, op0
, flags
);
4527 op0
= TREE_OPERAND (op0
, 0);
4532 dump_generic_node (pp
, TREE_OPERAND (op0
, 0), 0, flags
, false);
4533 pp_string (pp
, ") ? ");
4534 dump_generic_node (pp
, TREE_OPERAND (op0
, 1), 0, flags
, false);
4535 pp_string (pp
, " : ");
4536 dump_generic_node (pp
, TREE_OPERAND (op0
, 2), 0, flags
, false);
4540 if (VAR_P (TREE_OPERAND (op0
, 0)))
4541 dump_function_name (pp
, TREE_OPERAND (op0
, 0), flags
);
4543 dump_generic_node (pp
, op0
, 0, flags
, false);
4547 if (integer_zerop (TREE_OPERAND (op0
, 1)))
4549 op0
= TREE_OPERAND (op0
, 0);
4556 dump_generic_node (pp
, op0
, 0, flags
, false);
4564 /* Print the first N characters in the array STR, replacing non-printable
4565 characters (including embedded nuls) with unambiguous escape sequences. */
4568 pretty_print_string (pretty_printer
*pp
, const char *str
, size_t n
)
4573 for ( ; n
; --n
, ++str
)
4578 pp_string (pp
, "\\b");
4582 pp_string (pp
, "\\f");
4586 pp_string (pp
, "\\n");
4590 pp_string (pp
, "\\r");
4594 pp_string (pp
, "\\t");
4598 pp_string (pp
, "\\v");
4602 pp_string (pp
, "\\\\");
4606 pp_string (pp
, "\\\"");
4610 pp_string (pp
, "\\'");
4614 if (str
[0] || n
> 1)
4616 if (!ISPRINT (str
[0]))
4619 sprintf (buf
, "\\x%02x", (unsigned char)str
[0]);
4620 pp_string (pp
, buf
);
4623 pp_character (pp
, str
[0]);
4631 maybe_init_pretty_print (FILE *file
)
4635 tree_pp
= new pretty_printer ();
4636 pp_needs_newline (tree_pp
) = true;
4637 pp_translate_identifiers (tree_pp
) = false;
4640 tree_pp
->buffer
->stream
= file
;
4644 newline_and_indent (pretty_printer
*pp
, int spc
)
4650 /* Print the identifier ID to PRETTY-PRINTER. */
4653 pp_tree_identifier (pretty_printer
*pp
, tree id
)
4655 if (pp_translate_identifiers (pp
))
4657 const char *text
= identifier_to_locale (IDENTIFIER_POINTER (id
));
4658 pp_append_text (pp
, text
, text
+ strlen (text
));
4661 pp_append_text (pp
, IDENTIFIER_POINTER (id
),
4662 IDENTIFIER_POINTER (id
) + IDENTIFIER_LENGTH (id
));
4665 /* A helper function that is used to dump function information before the
4669 dump_function_header (FILE *dump_file
, tree fdecl
, dump_flags_t flags
)
4671 const char *dname
, *aname
;
4672 struct cgraph_node
*node
= cgraph_node::get (fdecl
);
4673 struct function
*fun
= DECL_STRUCT_FUNCTION (fdecl
);
4675 dname
= lang_hooks
.decl_printable_name (fdecl
, 1);
4677 if (DECL_ASSEMBLER_NAME_SET_P (fdecl
))
4678 aname
= (IDENTIFIER_POINTER
4679 (DECL_ASSEMBLER_NAME (fdecl
)));
4681 aname
= "<unset-asm-name>";
4683 fprintf (dump_file
, "\n;; Function %s (%s, funcdef_no=%d",
4684 dname
, aname
, fun
->funcdef_no
);
4685 if (!(flags
& TDF_NOUID
))
4686 fprintf (dump_file
, ", decl_uid=%d", DECL_UID (fdecl
));
4689 fprintf (dump_file
, ", cgraph_uid=%d", node
->get_uid ());
4690 fprintf (dump_file
, ", symbol_order=%d)%s\n\n", node
->order
,
4691 node
->frequency
== NODE_FREQUENCY_HOT
4693 : node
->frequency
== NODE_FREQUENCY_UNLIKELY_EXECUTED
4694 ? " (unlikely executed)"
4695 : node
->frequency
== NODE_FREQUENCY_EXECUTED_ONCE
4696 ? " (executed once)"
4700 fprintf (dump_file
, ")\n\n");
4703 /* Dump double_int D to pretty_printer PP. UNS is true
4704 if D is unsigned and false otherwise. */
4706 pp_double_int (pretty_printer
*pp
, double_int d
, bool uns
)
4709 pp_wide_integer (pp
, d
.low
);
4710 else if (d
.fits_uhwi ())
4711 pp_unsigned_wide_integer (pp
, d
.low
);
4714 unsigned HOST_WIDE_INT low
= d
.low
;
4715 HOST_WIDE_INT high
= d
.high
;
4716 if (!uns
&& d
.is_negative ())
4719 high
= ~high
+ !low
;
4722 /* Would "%x%0*x" or "%x%*0x" get zero-padding on all
4724 sprintf (pp_buffer (pp
)->digit_buffer
,
4725 HOST_WIDE_INT_PRINT_DOUBLE_HEX
,
4726 (unsigned HOST_WIDE_INT
) high
, low
);
4727 pp_string (pp
, pp_buffer (pp
)->digit_buffer
);
4732 # pragma GCC diagnostic pop