1 /* Pretty formatting of GENERIC trees in C syntax.
2 Copyright (C) 2001-2014 Free Software Foundation, Inc.
3 Adapted from c-pretty-print.c by Diego Novillo <dnovillo@redhat.com>
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 3, or (at your option) any later
12 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING3. If not see
19 <http://www.gnu.org/licenses/>. */
23 #include "coretypes.h"
26 #include "stor-layout.h"
28 #include "tree-pretty-print.h"
30 #include "pointer-set.h"
31 #include "gimple-expr.h"
33 #include "langhooks.h"
34 #include "tree-iterator.h"
35 #include "tree-chrec.h"
37 #include "value-prof.h"
40 #include <new> // For placement-new.
42 /* Local functions, macros and variables. */
43 static const char *op_symbol (const_tree
);
44 static void pretty_print_string (pretty_printer
*, const char*);
45 static void newline_and_indent (pretty_printer
*, int);
46 static void maybe_init_pretty_print (FILE *);
47 static void print_struct_decl (pretty_printer
*, const_tree
, int, int);
48 static void do_niy (pretty_printer
*, const_tree
);
50 #define INDENT(SPACE) do { \
51 int i; for (i = 0; i<SPACE; i++) pp_space (buffer); } while (0)
53 #define NIY do_niy (buffer, node)
55 static pretty_printer buffer
;
56 static int initialized
= 0;
58 /* Try to print something for an unknown tree code. */
61 do_niy (pretty_printer
*buffer
, const_tree node
)
65 pp_string (buffer
, "<<< Unknown tree: ");
66 pp_string (buffer
, get_tree_code_name (TREE_CODE (node
)));
70 len
= TREE_OPERAND_LENGTH (node
);
71 for (i
= 0; i
< len
; ++i
)
73 newline_and_indent (buffer
, 2);
74 dump_generic_node (buffer
, TREE_OPERAND (node
, i
), 2, 0, false);
78 pp_string (buffer
, " >>>");
81 /* Debugging function to print out a generic expression. */
84 debug_generic_expr (tree t
)
86 print_generic_expr (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
);
87 fprintf (stderr
, "\n");
90 /* Debugging function to print out a generic statement. */
93 debug_generic_stmt (tree t
)
95 print_generic_stmt (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
);
96 fprintf (stderr
, "\n");
99 /* Debugging function to print out a chain of trees . */
102 debug_tree_chain (tree t
)
104 struct pointer_set_t
*seen
= pointer_set_create ();
108 print_generic_expr (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
|TDF_UID
);
109 fprintf (stderr
, " ");
111 if (pointer_set_insert (seen
, t
))
113 fprintf (stderr
, "... [cycled back to ");
114 print_generic_expr (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
|TDF_UID
);
115 fprintf (stderr
, "]");
119 fprintf (stderr
, "\n");
121 pointer_set_destroy (seen
);
124 /* Prints declaration DECL to the FILE with details specified by FLAGS. */
126 print_generic_decl (FILE *file
, tree decl
, int flags
)
128 maybe_init_pretty_print (file
);
129 print_declaration (&buffer
, decl
, 2, flags
);
130 pp_write_text_to_stream (&buffer
);
133 /* Print tree T, and its successors, on file FILE. FLAGS specifies details
134 to show in the dump. See TDF_* in dumpfile.h. */
137 print_generic_stmt (FILE *file
, tree t
, int flags
)
139 maybe_init_pretty_print (file
);
140 dump_generic_node (&buffer
, t
, 0, flags
, true);
141 pp_newline_and_flush (&buffer
);
144 /* Print tree T, and its successors, on file FILE. FLAGS specifies details
145 to show in the dump. See TDF_* in dumpfile.h. The output is indented by
149 print_generic_stmt_indented (FILE *file
, tree t
, int flags
, int indent
)
153 maybe_init_pretty_print (file
);
155 for (i
= 0; i
< indent
; i
++)
157 dump_generic_node (&buffer
, t
, indent
, flags
, true);
158 pp_newline_and_flush (&buffer
);
161 /* Print a single expression T on file FILE. FLAGS specifies details to show
162 in the dump. See TDF_* in dumpfile.h. */
165 print_generic_expr (FILE *file
, tree t
, int flags
)
167 maybe_init_pretty_print (file
);
168 dump_generic_node (&buffer
, t
, 0, flags
, false);
172 /* Dump the name of a _DECL node and its DECL_UID if TDF_UID is set
176 dump_decl_name (pretty_printer
*buffer
, tree node
, int flags
)
178 if (DECL_NAME (node
))
180 if ((flags
& TDF_ASMNAME
) && DECL_ASSEMBLER_NAME_SET_P (node
))
181 pp_tree_identifier (buffer
, DECL_ASSEMBLER_NAME (node
));
183 pp_tree_identifier (buffer
, DECL_NAME (node
));
185 if ((flags
& TDF_UID
) || DECL_NAME (node
) == NULL_TREE
)
187 if (TREE_CODE (node
) == LABEL_DECL
&& LABEL_DECL_UID (node
) != -1)
188 pp_printf (buffer
, "L.%d", (int) LABEL_DECL_UID (node
));
189 else if (TREE_CODE (node
) == DEBUG_EXPR_DECL
)
191 if (flags
& TDF_NOUID
)
192 pp_string (buffer
, "D#xxxx");
194 pp_printf (buffer
, "D#%i", DEBUG_TEMP_UID (node
));
198 char c
= TREE_CODE (node
) == CONST_DECL
? 'C' : 'D';
199 if (flags
& TDF_NOUID
)
200 pp_printf (buffer
, "%c.xxxx", c
);
202 pp_printf (buffer
, "%c.%u", c
, DECL_UID (node
));
205 if ((flags
& TDF_ALIAS
) && DECL_PT_UID (node
) != DECL_UID (node
))
207 if (flags
& TDF_NOUID
)
208 pp_printf (buffer
, "ptD.xxxx");
210 pp_printf (buffer
, "ptD.%u", DECL_PT_UID (node
));
214 /* Like the above, but used for pretty printing function calls. */
217 dump_function_name (pretty_printer
*buffer
, tree node
, int flags
)
219 if (TREE_CODE (node
) == NOP_EXPR
)
220 node
= TREE_OPERAND (node
, 0);
221 if (DECL_NAME (node
) && (flags
& TDF_ASMNAME
) == 0)
222 pp_string (buffer
, lang_hooks
.decl_printable_name (node
, 1));
224 dump_decl_name (buffer
, node
, flags
);
227 /* Dump a function declaration. NODE is the FUNCTION_TYPE. BUFFER, SPC and
228 FLAGS are as in dump_generic_node. */
231 dump_function_declaration (pretty_printer
*buffer
, tree node
,
234 bool wrote_arg
= false;
238 pp_left_paren (buffer
);
240 /* Print the argument types. */
241 arg
= TYPE_ARG_TYPES (node
);
242 while (arg
&& arg
!= void_list_node
&& arg
!= error_mark_node
)
250 dump_generic_node (buffer
, TREE_VALUE (arg
), spc
, flags
, false);
251 arg
= TREE_CHAIN (arg
);
254 /* Drop the trailing void_type_node if we had any previous argument. */
255 if (arg
== void_list_node
&& !wrote_arg
)
256 pp_string (buffer
, "void");
257 /* Properly dump vararg function types. */
258 else if (!arg
&& wrote_arg
)
259 pp_string (buffer
, ", ...");
260 /* Avoid printing any arg for unprototyped functions. */
262 pp_right_paren (buffer
);
265 /* Dump the domain associated with an array. */
268 dump_array_domain (pretty_printer
*buffer
, tree domain
, int spc
, int flags
)
270 pp_left_bracket (buffer
);
273 tree min
= TYPE_MIN_VALUE (domain
);
274 tree max
= TYPE_MAX_VALUE (domain
);
277 && integer_zerop (min
)
278 && tree_fits_shwi_p (max
))
279 pp_wide_integer (buffer
, tree_to_shwi (max
) + 1);
283 dump_generic_node (buffer
, min
, spc
, flags
, false);
286 dump_generic_node (buffer
, max
, spc
, flags
, false);
290 pp_string (buffer
, "<unknown>");
291 pp_right_bracket (buffer
);
295 /* Dump OpenMP clause CLAUSE. BUFFER, CLAUSE, SPC and FLAGS are as in
296 dump_generic_node. */
299 dump_omp_clause (pretty_printer
*buffer
, tree clause
, int spc
, int flags
)
303 switch (OMP_CLAUSE_CODE (clause
))
305 case OMP_CLAUSE_PRIVATE
:
308 case OMP_CLAUSE_SHARED
:
311 case OMP_CLAUSE_FIRSTPRIVATE
:
312 name
= "firstprivate";
314 case OMP_CLAUSE_LASTPRIVATE
:
315 name
= "lastprivate";
317 case OMP_CLAUSE_COPYIN
:
320 case OMP_CLAUSE_COPYPRIVATE
:
321 name
= "copyprivate";
323 case OMP_CLAUSE_UNIFORM
:
326 case OMP_CLAUSE__LOOPTEMP_
:
330 pp_string (buffer
, name
);
331 pp_left_paren (buffer
);
332 dump_generic_node (buffer
, OMP_CLAUSE_DECL (clause
),
334 pp_right_paren (buffer
);
337 case OMP_CLAUSE_REDUCTION
:
338 pp_string (buffer
, "reduction(");
339 if (OMP_CLAUSE_REDUCTION_CODE (clause
) != ERROR_MARK
)
342 op_symbol_code (OMP_CLAUSE_REDUCTION_CODE (clause
)));
345 dump_generic_node (buffer
, OMP_CLAUSE_DECL (clause
),
347 pp_right_paren (buffer
);
351 pp_string (buffer
, "if(");
352 dump_generic_node (buffer
, OMP_CLAUSE_IF_EXPR (clause
),
354 pp_right_paren (buffer
);
357 case OMP_CLAUSE_NUM_THREADS
:
358 pp_string (buffer
, "num_threads(");
359 dump_generic_node (buffer
, OMP_CLAUSE_NUM_THREADS_EXPR (clause
),
361 pp_right_paren (buffer
);
364 case OMP_CLAUSE_NOWAIT
:
365 pp_string (buffer
, "nowait");
367 case OMP_CLAUSE_ORDERED
:
368 pp_string (buffer
, "ordered");
371 case OMP_CLAUSE_DEFAULT
:
372 pp_string (buffer
, "default(");
373 switch (OMP_CLAUSE_DEFAULT_KIND (clause
))
375 case OMP_CLAUSE_DEFAULT_UNSPECIFIED
:
377 case OMP_CLAUSE_DEFAULT_SHARED
:
378 pp_string (buffer
, "shared");
380 case OMP_CLAUSE_DEFAULT_NONE
:
381 pp_string (buffer
, "none");
383 case OMP_CLAUSE_DEFAULT_PRIVATE
:
384 pp_string (buffer
, "private");
386 case OMP_CLAUSE_DEFAULT_FIRSTPRIVATE
:
387 pp_string (buffer
, "firstprivate");
392 pp_right_paren (buffer
);
395 case OMP_CLAUSE_SCHEDULE
:
396 pp_string (buffer
, "schedule(");
397 switch (OMP_CLAUSE_SCHEDULE_KIND (clause
))
399 case OMP_CLAUSE_SCHEDULE_STATIC
:
400 pp_string (buffer
, "static");
402 case OMP_CLAUSE_SCHEDULE_DYNAMIC
:
403 pp_string (buffer
, "dynamic");
405 case OMP_CLAUSE_SCHEDULE_GUIDED
:
406 pp_string (buffer
, "guided");
408 case OMP_CLAUSE_SCHEDULE_RUNTIME
:
409 pp_string (buffer
, "runtime");
411 case OMP_CLAUSE_SCHEDULE_AUTO
:
412 pp_string (buffer
, "auto");
417 if (OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (clause
))
420 dump_generic_node (buffer
, OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (clause
),
423 pp_right_paren (buffer
);
426 case OMP_CLAUSE_UNTIED
:
427 pp_string (buffer
, "untied");
430 case OMP_CLAUSE_COLLAPSE
:
431 pp_string (buffer
, "collapse(");
432 dump_generic_node (buffer
, OMP_CLAUSE_COLLAPSE_EXPR (clause
),
434 pp_right_paren (buffer
);
437 case OMP_CLAUSE_FINAL
:
438 pp_string (buffer
, "final(");
439 dump_generic_node (buffer
, OMP_CLAUSE_FINAL_EXPR (clause
),
441 pp_right_paren (buffer
);
444 case OMP_CLAUSE_MERGEABLE
:
445 pp_string (buffer
, "mergeable");
448 case OMP_CLAUSE_LINEAR
:
449 pp_string (buffer
, "linear(");
450 dump_generic_node (buffer
, OMP_CLAUSE_DECL (clause
),
453 dump_generic_node (buffer
, OMP_CLAUSE_LINEAR_STEP (clause
),
455 pp_right_paren (buffer
);
458 case OMP_CLAUSE_ALIGNED
:
459 pp_string (buffer
, "aligned(");
460 dump_generic_node (buffer
, OMP_CLAUSE_DECL (clause
),
462 if (OMP_CLAUSE_ALIGNED_ALIGNMENT (clause
))
465 dump_generic_node (buffer
, OMP_CLAUSE_ALIGNED_ALIGNMENT (clause
),
468 pp_right_paren (buffer
);
471 case OMP_CLAUSE_DEPEND
:
472 pp_string (buffer
, "depend(");
473 switch (OMP_CLAUSE_DEPEND_KIND (clause
))
475 case OMP_CLAUSE_DEPEND_IN
:
476 pp_string (buffer
, "in");
478 case OMP_CLAUSE_DEPEND_OUT
:
479 pp_string (buffer
, "out");
481 case OMP_CLAUSE_DEPEND_INOUT
:
482 pp_string (buffer
, "inout");
488 dump_generic_node (buffer
, OMP_CLAUSE_DECL (clause
),
490 pp_right_paren (buffer
);
494 pp_string (buffer
, "map(");
495 switch (OMP_CLAUSE_MAP_KIND (clause
))
497 case OMP_CLAUSE_MAP_ALLOC
:
498 case OMP_CLAUSE_MAP_POINTER
:
499 pp_string (buffer
, "alloc");
501 case OMP_CLAUSE_MAP_TO
:
502 case OMP_CLAUSE_MAP_TO_PSET
:
503 pp_string (buffer
, "to");
505 case OMP_CLAUSE_MAP_FROM
:
506 pp_string (buffer
, "from");
508 case OMP_CLAUSE_MAP_TOFROM
:
509 pp_string (buffer
, "tofrom");
515 dump_generic_node (buffer
, OMP_CLAUSE_DECL (clause
),
518 if (OMP_CLAUSE_SIZE (clause
))
520 if (OMP_CLAUSE_CODE (clause
) == OMP_CLAUSE_MAP
521 && OMP_CLAUSE_MAP_KIND (clause
) == OMP_CLAUSE_MAP_POINTER
)
522 pp_string (buffer
, " [pointer assign, bias: ");
523 else if (OMP_CLAUSE_CODE (clause
) == OMP_CLAUSE_MAP
524 && OMP_CLAUSE_MAP_KIND (clause
) == OMP_CLAUSE_MAP_TO_PSET
)
525 pp_string (buffer
, " [pointer set, len: ");
527 pp_string (buffer
, " [len: ");
528 dump_generic_node (buffer
, OMP_CLAUSE_SIZE (clause
),
530 pp_right_bracket (buffer
);
532 pp_right_paren (buffer
);
535 case OMP_CLAUSE_FROM
:
536 pp_string (buffer
, "from(");
537 dump_generic_node (buffer
, OMP_CLAUSE_DECL (clause
),
539 goto print_clause_size
;
542 pp_string (buffer
, "to(");
543 dump_generic_node (buffer
, OMP_CLAUSE_DECL (clause
),
545 goto print_clause_size
;
547 case OMP_CLAUSE_NUM_TEAMS
:
548 pp_string (buffer
, "num_teams(");
549 dump_generic_node (buffer
, OMP_CLAUSE_NUM_TEAMS_EXPR (clause
),
551 pp_right_paren (buffer
);
554 case OMP_CLAUSE_THREAD_LIMIT
:
555 pp_string (buffer
, "thread_limit(");
556 dump_generic_node (buffer
, OMP_CLAUSE_THREAD_LIMIT_EXPR (clause
),
558 pp_right_paren (buffer
);
561 case OMP_CLAUSE_DEVICE
:
562 pp_string (buffer
, "device(");
563 dump_generic_node (buffer
, OMP_CLAUSE_DEVICE_ID (clause
),
565 pp_right_paren (buffer
);
568 case OMP_CLAUSE_DIST_SCHEDULE
:
569 pp_string (buffer
, "dist_schedule(static");
570 if (OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR (clause
))
573 dump_generic_node (buffer
,
574 OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR (clause
),
577 pp_right_paren (buffer
);
580 case OMP_CLAUSE_PROC_BIND
:
581 pp_string (buffer
, "proc_bind(");
582 switch (OMP_CLAUSE_PROC_BIND_KIND (clause
))
584 case OMP_CLAUSE_PROC_BIND_MASTER
:
585 pp_string (buffer
, "master");
587 case OMP_CLAUSE_PROC_BIND_CLOSE
:
588 pp_string (buffer
, "close");
590 case OMP_CLAUSE_PROC_BIND_SPREAD
:
591 pp_string (buffer
, "spread");
596 pp_right_paren (buffer
);
599 case OMP_CLAUSE_SAFELEN
:
600 pp_string (buffer
, "safelen(");
601 dump_generic_node (buffer
, OMP_CLAUSE_SAFELEN_EXPR (clause
),
603 pp_right_paren (buffer
);
606 case OMP_CLAUSE_SIMDLEN
:
607 pp_string (buffer
, "simdlen(");
608 dump_generic_node (buffer
, OMP_CLAUSE_SIMDLEN_EXPR (clause
),
610 pp_right_paren (buffer
);
613 case OMP_CLAUSE__SIMDUID_
:
614 pp_string (buffer
, "_simduid_(");
615 dump_generic_node (buffer
, OMP_CLAUSE__SIMDUID__DECL (clause
),
617 pp_right_paren (buffer
);
620 case OMP_CLAUSE_INBRANCH
:
621 pp_string (buffer
, "inbranch");
623 case OMP_CLAUSE_NOTINBRANCH
:
624 pp_string (buffer
, "notinbranch");
627 pp_string (buffer
, "for");
629 case OMP_CLAUSE_PARALLEL
:
630 pp_string (buffer
, "parallel");
632 case OMP_CLAUSE_SECTIONS
:
633 pp_string (buffer
, "sections");
635 case OMP_CLAUSE_TASKGROUP
:
636 pp_string (buffer
, "taskgroup");
640 /* Should never happen. */
641 dump_generic_node (buffer
, clause
, spc
, flags
, false);
647 /* Dump the list of OpenMP clauses. BUFFER, SPC and FLAGS are as in
648 dump_generic_node. */
651 dump_omp_clauses (pretty_printer
*buffer
, tree clause
, int spc
, int flags
)
659 dump_omp_clause (buffer
, clause
, spc
, flags
);
660 clause
= OMP_CLAUSE_CHAIN (clause
);
668 /* Dump location LOC to BUFFER. */
671 dump_location (pretty_printer
*buffer
, location_t loc
)
673 expanded_location xloc
= expand_location (loc
);
675 pp_left_bracket (buffer
);
678 pp_string (buffer
, xloc
.file
);
679 pp_string (buffer
, " : ");
681 pp_decimal_int (buffer
, xloc
.line
);
682 pp_string (buffer
, "] ");
686 /* Dump lexical block BLOCK. BUFFER, SPC and FLAGS are as in
687 dump_generic_node. */
690 dump_block_node (pretty_printer
*buffer
, tree block
, int spc
, int flags
)
694 pp_printf (buffer
, "BLOCK #%d ", BLOCK_NUMBER (block
));
696 if (flags
& TDF_ADDRESS
)
697 pp_printf (buffer
, "[%p] ", (void *) block
);
699 if (BLOCK_ABSTRACT (block
))
700 pp_string (buffer
, "[abstract] ");
702 if (TREE_ASM_WRITTEN (block
))
703 pp_string (buffer
, "[written] ");
705 if (flags
& TDF_SLIM
)
708 if (BLOCK_SOURCE_LOCATION (block
))
709 dump_location (buffer
, BLOCK_SOURCE_LOCATION (block
));
711 newline_and_indent (buffer
, spc
+ 2);
713 if (BLOCK_SUPERCONTEXT (block
))
715 pp_string (buffer
, "SUPERCONTEXT: ");
716 dump_generic_node (buffer
, BLOCK_SUPERCONTEXT (block
), 0,
717 flags
| TDF_SLIM
, false);
718 newline_and_indent (buffer
, spc
+ 2);
721 if (BLOCK_SUBBLOCKS (block
))
723 pp_string (buffer
, "SUBBLOCKS: ");
724 for (t
= BLOCK_SUBBLOCKS (block
); t
; t
= BLOCK_CHAIN (t
))
726 dump_generic_node (buffer
, t
, 0, flags
| TDF_SLIM
, false);
729 newline_and_indent (buffer
, spc
+ 2);
732 if (BLOCK_CHAIN (block
))
734 pp_string (buffer
, "SIBLINGS: ");
735 for (t
= BLOCK_CHAIN (block
); t
; t
= BLOCK_CHAIN (t
))
737 dump_generic_node (buffer
, t
, 0, flags
| TDF_SLIM
, false);
740 newline_and_indent (buffer
, spc
+ 2);
743 if (BLOCK_VARS (block
))
745 pp_string (buffer
, "VARS: ");
746 for (t
= BLOCK_VARS (block
); t
; t
= TREE_CHAIN (t
))
748 dump_generic_node (buffer
, t
, 0, flags
, false);
751 newline_and_indent (buffer
, spc
+ 2);
754 if (vec_safe_length (BLOCK_NONLOCALIZED_VARS (block
)) > 0)
757 vec
<tree
, va_gc
> *nlv
= BLOCK_NONLOCALIZED_VARS (block
);
759 pp_string (buffer
, "NONLOCALIZED_VARS: ");
760 FOR_EACH_VEC_ELT (*nlv
, i
, t
)
762 dump_generic_node (buffer
, t
, 0, flags
, false);
765 newline_and_indent (buffer
, spc
+ 2);
768 if (BLOCK_ABSTRACT_ORIGIN (block
))
770 pp_string (buffer
, "ABSTRACT_ORIGIN: ");
771 dump_generic_node (buffer
, BLOCK_ABSTRACT_ORIGIN (block
), 0,
772 flags
| TDF_SLIM
, false);
773 newline_and_indent (buffer
, spc
+ 2);
776 if (BLOCK_FRAGMENT_ORIGIN (block
))
778 pp_string (buffer
, "FRAGMENT_ORIGIN: ");
779 dump_generic_node (buffer
, BLOCK_FRAGMENT_ORIGIN (block
), 0,
780 flags
| TDF_SLIM
, false);
781 newline_and_indent (buffer
, spc
+ 2);
784 if (BLOCK_FRAGMENT_CHAIN (block
))
786 pp_string (buffer
, "FRAGMENT_CHAIN: ");
787 for (t
= BLOCK_FRAGMENT_CHAIN (block
); t
; t
= BLOCK_FRAGMENT_CHAIN (t
))
789 dump_generic_node (buffer
, t
, 0, flags
| TDF_SLIM
, false);
792 newline_and_indent (buffer
, spc
+ 2);
797 /* Dump the node NODE on the pretty_printer BUFFER, SPC spaces of
798 indent. FLAGS specifies details to show in the dump (see TDF_* in
799 dumpfile.h). If IS_STMT is true, the object printed is considered
800 to be a statement and it is terminated by ';' if appropriate. */
803 dump_generic_node (pretty_printer
*buffer
, tree node
, int spc
, int flags
,
812 if (node
== NULL_TREE
)
815 is_expr
= EXPR_P (node
);
817 if (is_stmt
&& (flags
& TDF_STMTADDR
))
818 pp_printf (buffer
, "<&%p> ", (void *)node
);
820 if ((flags
& TDF_LINENO
) && EXPR_HAS_LOCATION (node
))
821 dump_location (buffer
, EXPR_LOCATION (node
));
823 code
= TREE_CODE (node
);
827 pp_string (buffer
, "<<< error >>>");
830 case IDENTIFIER_NODE
:
831 pp_tree_identifier (buffer
, node
);
835 while (node
&& node
!= error_mark_node
)
837 if (TREE_PURPOSE (node
))
839 dump_generic_node (buffer
, TREE_PURPOSE (node
), spc
, flags
, false);
842 dump_generic_node (buffer
, TREE_VALUE (node
), spc
, flags
, false);
843 node
= TREE_CHAIN (node
);
844 if (node
&& TREE_CODE (node
) == TREE_LIST
)
853 dump_generic_node (buffer
, BINFO_TYPE (node
), spc
, flags
, false);
859 if (TREE_VEC_LENGTH (node
) > 0)
861 size_t len
= TREE_VEC_LENGTH (node
);
862 for (i
= 0; i
< len
- 1; i
++)
864 dump_generic_node (buffer
, TREE_VEC_ELT (node
, i
), spc
, flags
,
869 dump_generic_node (buffer
, TREE_VEC_ELT (node
, len
- 1), spc
,
878 case FIXED_POINT_TYPE
:
884 unsigned int quals
= TYPE_QUALS (node
);
885 enum tree_code_class tclass
;
887 if (quals
& TYPE_QUAL_ATOMIC
)
888 pp_string (buffer
, "atomic ");
889 if (quals
& TYPE_QUAL_CONST
)
890 pp_string (buffer
, "const ");
891 else if (quals
& TYPE_QUAL_VOLATILE
)
892 pp_string (buffer
, "volatile ");
893 else if (quals
& TYPE_QUAL_RESTRICT
)
894 pp_string (buffer
, "restrict ");
896 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
898 pp_string (buffer
, "<address-space-");
899 pp_decimal_int (buffer
, TYPE_ADDR_SPACE (node
));
900 pp_string (buffer
, "> ");
903 tclass
= TREE_CODE_CLASS (TREE_CODE (node
));
905 if (tclass
== tcc_declaration
)
907 if (DECL_NAME (node
))
908 dump_decl_name (buffer
, node
, flags
);
910 pp_string (buffer
, "<unnamed type decl>");
912 else if (tclass
== tcc_type
)
914 if (TYPE_NAME (node
))
916 if (TREE_CODE (TYPE_NAME (node
)) == IDENTIFIER_NODE
)
917 pp_tree_identifier (buffer
, TYPE_NAME (node
));
918 else if (TREE_CODE (TYPE_NAME (node
)) == TYPE_DECL
919 && DECL_NAME (TYPE_NAME (node
)))
920 dump_decl_name (buffer
, TYPE_NAME (node
), flags
);
922 pp_string (buffer
, "<unnamed type>");
924 else if (TREE_CODE (node
) == VECTOR_TYPE
)
926 pp_string (buffer
, "vector");
927 pp_left_paren (buffer
);
928 pp_wide_integer (buffer
, TYPE_VECTOR_SUBPARTS (node
));
929 pp_string (buffer
, ") ");
930 dump_generic_node (buffer
, TREE_TYPE (node
), spc
, flags
, false);
932 else if (TREE_CODE (node
) == INTEGER_TYPE
)
934 if (TYPE_PRECISION (node
) == CHAR_TYPE_SIZE
)
935 pp_string (buffer
, (TYPE_UNSIGNED (node
)
938 else if (TYPE_PRECISION (node
) == SHORT_TYPE_SIZE
)
939 pp_string (buffer
, (TYPE_UNSIGNED (node
)
942 else if (TYPE_PRECISION (node
) == INT_TYPE_SIZE
)
943 pp_string (buffer
, (TYPE_UNSIGNED (node
)
946 else if (TYPE_PRECISION (node
) == LONG_TYPE_SIZE
)
947 pp_string (buffer
, (TYPE_UNSIGNED (node
)
950 else if (TYPE_PRECISION (node
) == LONG_LONG_TYPE_SIZE
)
951 pp_string (buffer
, (TYPE_UNSIGNED (node
)
952 ? "unsigned long long"
953 : "signed long long"));
954 else if (TYPE_PRECISION (node
) >= CHAR_TYPE_SIZE
955 && exact_log2 (TYPE_PRECISION (node
)) != -1)
957 pp_string (buffer
, (TYPE_UNSIGNED (node
) ? "uint" : "int"));
958 pp_decimal_int (buffer
, TYPE_PRECISION (node
));
959 pp_string (buffer
, "_t");
963 pp_string (buffer
, (TYPE_UNSIGNED (node
)
964 ? "<unnamed-unsigned:"
965 : "<unnamed-signed:"));
966 pp_decimal_int (buffer
, TYPE_PRECISION (node
));
970 else if (TREE_CODE (node
) == COMPLEX_TYPE
)
972 pp_string (buffer
, "__complex__ ");
973 dump_generic_node (buffer
, TREE_TYPE (node
), spc
, flags
, false);
975 else if (TREE_CODE (node
) == REAL_TYPE
)
977 pp_string (buffer
, "<float:");
978 pp_decimal_int (buffer
, TYPE_PRECISION (node
));
981 else if (TREE_CODE (node
) == FIXED_POINT_TYPE
)
983 pp_string (buffer
, "<fixed-point-");
984 pp_string (buffer
, TYPE_SATURATING (node
) ? "sat:" : "nonsat:");
985 pp_decimal_int (buffer
, TYPE_PRECISION (node
));
988 else if (TREE_CODE (node
) == VOID_TYPE
)
989 pp_string (buffer
, "void");
991 pp_string (buffer
, "<unnamed type>");
998 str
= (TREE_CODE (node
) == POINTER_TYPE
? "*" : "&");
1000 if (TREE_TYPE (node
) == NULL
)
1002 pp_string (buffer
, str
);
1003 pp_string (buffer
, "<null type>");
1005 else if (TREE_CODE (TREE_TYPE (node
)) == FUNCTION_TYPE
)
1007 tree fnode
= TREE_TYPE (node
);
1009 dump_generic_node (buffer
, TREE_TYPE (fnode
), spc
, flags
, false);
1011 pp_left_paren (buffer
);
1012 pp_string (buffer
, str
);
1013 if (TYPE_NAME (node
) && DECL_NAME (TYPE_NAME (node
)))
1014 dump_decl_name (buffer
, TYPE_NAME (node
), flags
);
1015 else if (flags
& TDF_NOUID
)
1016 pp_printf (buffer
, "<Txxxx>");
1018 pp_printf (buffer
, "<T%x>", TYPE_UID (node
));
1020 pp_right_paren (buffer
);
1021 dump_function_declaration (buffer
, fnode
, spc
, flags
);
1025 unsigned int quals
= TYPE_QUALS (node
);
1027 dump_generic_node (buffer
, TREE_TYPE (node
), spc
, flags
, false);
1029 pp_string (buffer
, str
);
1031 if (quals
& TYPE_QUAL_CONST
)
1032 pp_string (buffer
, " const");
1033 if (quals
& TYPE_QUAL_VOLATILE
)
1034 pp_string (buffer
, " volatile");
1035 if (quals
& TYPE_QUAL_RESTRICT
)
1036 pp_string (buffer
, " restrict");
1038 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
1040 pp_string (buffer
, " <address-space-");
1041 pp_decimal_int (buffer
, TYPE_ADDR_SPACE (node
));
1042 pp_greater (buffer
);
1045 if (TYPE_REF_CAN_ALIAS_ALL (node
))
1046 pp_string (buffer
, " {ref-all}");
1056 if (integer_zerop (TREE_OPERAND (node
, 1))
1057 /* Dump the types of INTEGER_CSTs explicitly, for we can't
1058 infer them and MEM_ATTR caching will share MEM_REFs
1059 with differently-typed op0s. */
1060 && TREE_CODE (TREE_OPERAND (node
, 0)) != INTEGER_CST
1061 /* Released SSA_NAMES have no TREE_TYPE. */
1062 && TREE_TYPE (TREE_OPERAND (node
, 0)) != NULL_TREE
1063 /* Same pointer types, but ignoring POINTER_TYPE vs.
1065 && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 0)))
1066 == TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 1))))
1067 && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (node
, 0)))
1068 == TYPE_MODE (TREE_TYPE (TREE_OPERAND (node
, 1))))
1069 && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node
, 0)))
1070 == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node
, 1))))
1071 /* Same value types ignoring qualifiers. */
1072 && (TYPE_MAIN_VARIANT (TREE_TYPE (node
))
1073 == TYPE_MAIN_VARIANT
1074 (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 1))))))
1076 if (TREE_CODE (TREE_OPERAND (node
, 0)) != ADDR_EXPR
)
1079 dump_generic_node (buffer
, TREE_OPERAND (node
, 0),
1083 dump_generic_node (buffer
,
1084 TREE_OPERAND (TREE_OPERAND (node
, 0), 0),
1091 pp_string (buffer
, "MEM[");
1092 pp_left_paren (buffer
);
1093 ptype
= TYPE_MAIN_VARIANT (TREE_TYPE (TREE_OPERAND (node
, 1)));
1094 dump_generic_node (buffer
, ptype
,
1095 spc
, flags
| TDF_SLIM
, false);
1096 pp_right_paren (buffer
);
1097 dump_generic_node (buffer
, TREE_OPERAND (node
, 0),
1099 if (!integer_zerop (TREE_OPERAND (node
, 1)))
1101 pp_string (buffer
, " + ");
1102 dump_generic_node (buffer
, TREE_OPERAND (node
, 1),
1105 pp_right_bracket (buffer
);
1110 case TARGET_MEM_REF
:
1112 const char *sep
= "";
1115 pp_string (buffer
, "MEM[");
1117 if (TREE_CODE (TMR_BASE (node
)) == ADDR_EXPR
)
1119 pp_string (buffer
, sep
);
1121 pp_string (buffer
, "symbol: ");
1122 dump_generic_node (buffer
, TREE_OPERAND (TMR_BASE (node
), 0),
1127 pp_string (buffer
, sep
);
1129 pp_string (buffer
, "base: ");
1130 dump_generic_node (buffer
, TMR_BASE (node
), spc
, flags
, false);
1132 tmp
= TMR_INDEX2 (node
);
1135 pp_string (buffer
, sep
);
1137 pp_string (buffer
, "base: ");
1138 dump_generic_node (buffer
, tmp
, spc
, flags
, false);
1140 tmp
= TMR_INDEX (node
);
1143 pp_string (buffer
, sep
);
1145 pp_string (buffer
, "index: ");
1146 dump_generic_node (buffer
, tmp
, spc
, flags
, false);
1148 tmp
= TMR_STEP (node
);
1151 pp_string (buffer
, sep
);
1153 pp_string (buffer
, "step: ");
1154 dump_generic_node (buffer
, tmp
, spc
, flags
, false);
1156 tmp
= TMR_OFFSET (node
);
1159 pp_string (buffer
, sep
);
1161 pp_string (buffer
, "offset: ");
1162 dump_generic_node (buffer
, tmp
, spc
, flags
, false);
1164 pp_right_bracket (buffer
);
1172 /* Print the innermost component type. */
1173 for (tmp
= TREE_TYPE (node
); TREE_CODE (tmp
) == ARRAY_TYPE
;
1174 tmp
= TREE_TYPE (tmp
))
1176 dump_generic_node (buffer
, tmp
, spc
, flags
, false);
1178 /* Print the dimensions. */
1179 for (tmp
= node
; TREE_CODE (tmp
) == ARRAY_TYPE
; tmp
= TREE_TYPE (tmp
))
1180 dump_array_domain (buffer
, TYPE_DOMAIN (tmp
), spc
, flags
);
1186 case QUAL_UNION_TYPE
:
1188 unsigned int quals
= TYPE_QUALS (node
);
1190 if (quals
& TYPE_QUAL_ATOMIC
)
1191 pp_string (buffer
, "atomic ");
1192 if (quals
& TYPE_QUAL_CONST
)
1193 pp_string (buffer
, "const ");
1194 if (quals
& TYPE_QUAL_VOLATILE
)
1195 pp_string (buffer
, "volatile ");
1197 /* Print the name of the structure. */
1198 if (TREE_CODE (node
) == RECORD_TYPE
)
1199 pp_string (buffer
, "struct ");
1200 else if (TREE_CODE (node
) == UNION_TYPE
)
1201 pp_string (buffer
, "union ");
1203 if (TYPE_NAME (node
))
1204 dump_generic_node (buffer
, TYPE_NAME (node
), spc
, flags
, false);
1205 else if (!(flags
& TDF_SLIM
))
1206 /* FIXME: If we eliminate the 'else' above and attempt
1207 to show the fields for named types, we may get stuck
1208 following a cycle of pointers to structs. The alleged
1209 self-reference check in print_struct_decl will not detect
1210 cycles involving more than one pointer or struct type. */
1211 print_struct_decl (buffer
, node
, spc
, flags
);
1220 if (TREE_CODE (TREE_TYPE (node
)) == POINTER_TYPE
)
1222 /* In the case of a pointer, one may want to divide by the
1223 size of the pointed-to type. Unfortunately, this not
1224 straightforward. The C front-end maps expressions
1229 in such a way that the two INTEGER_CST nodes for "5" have
1230 different values but identical types. In the latter
1231 case, the 5 is multiplied by sizeof (int) in c-common.c
1232 (pointer_int_sum) to convert it to a byte address, and
1233 yet the type of the node is left unchanged. Argh. What
1234 is consistent though is that the number value corresponds
1235 to bytes (UNITS) offset.
1237 NB: Neither of the following divisors can be trivially
1238 used to recover the original literal:
1240 TREE_INT_CST_LOW (TYPE_SIZE_UNIT (TREE_TYPE (node)))
1241 TYPE_PRECISION (TREE_TYPE (TREE_TYPE (node))) */
1242 pp_wide_integer (buffer
, TREE_INT_CST_LOW (node
));
1243 pp_string (buffer
, "B"); /* pseudo-unit */
1246 pp_double_int (buffer
, tree_to_double_int (node
),
1247 TYPE_UNSIGNED (TREE_TYPE (node
)));
1248 if (TREE_OVERFLOW (node
))
1249 pp_string (buffer
, "(OVF)");
1253 /* Code copied from print_node. */
1256 if (TREE_OVERFLOW (node
))
1257 pp_string (buffer
, " overflow");
1259 #if !defined(REAL_IS_NOT_DOUBLE) || defined(REAL_ARITHMETIC)
1260 d
= TREE_REAL_CST (node
);
1261 if (REAL_VALUE_ISINF (d
))
1262 pp_string (buffer
, REAL_VALUE_NEGATIVE (d
) ? " -Inf" : " Inf");
1263 else if (REAL_VALUE_ISNAN (d
))
1264 pp_string (buffer
, " Nan");
1268 real_to_decimal (string
, &d
, sizeof (string
), 0, 1);
1269 pp_string (buffer
, string
);
1274 unsigned char *p
= (unsigned char *) &TREE_REAL_CST (node
);
1275 pp_string (buffer
, "0x");
1276 for (i
= 0; i
< sizeof TREE_REAL_CST (node
); i
++)
1277 output_formatted_integer (buffer
, "%02x", *p
++);
1286 fixed_to_decimal (string
, TREE_FIXED_CST_PTR (node
), sizeof (string
));
1287 pp_string (buffer
, string
);
1292 pp_string (buffer
, "__complex__ (");
1293 dump_generic_node (buffer
, TREE_REALPART (node
), spc
, flags
, false);
1294 pp_string (buffer
, ", ");
1295 dump_generic_node (buffer
, TREE_IMAGPART (node
), spc
, flags
, false);
1296 pp_right_paren (buffer
);
1300 pp_string (buffer
, "\"");
1301 pretty_print_string (buffer
, TREE_STRING_POINTER (node
));
1302 pp_string (buffer
, "\"");
1308 pp_string (buffer
, "{ ");
1309 for (i
= 0; i
< VECTOR_CST_NELTS (node
); ++i
)
1312 pp_string (buffer
, ", ");
1313 dump_generic_node (buffer
, VECTOR_CST_ELT (node
, i
),
1316 pp_string (buffer
, " }");
1322 dump_generic_node (buffer
, TREE_TYPE (node
), spc
, flags
, false);
1324 if (TREE_CODE (node
) == METHOD_TYPE
)
1326 if (TYPE_METHOD_BASETYPE (node
))
1327 dump_decl_name (buffer
, TYPE_NAME (TYPE_METHOD_BASETYPE (node
)),
1330 pp_string (buffer
, "<null method basetype>");
1331 pp_colon_colon (buffer
);
1333 if (TYPE_NAME (node
) && DECL_NAME (TYPE_NAME (node
)))
1334 dump_decl_name (buffer
, TYPE_NAME (node
), flags
);
1335 else if (flags
& TDF_NOUID
)
1336 pp_printf (buffer
, "<Txxxx>");
1338 pp_printf (buffer
, "<T%x>", TYPE_UID (node
));
1339 dump_function_declaration (buffer
, node
, spc
, flags
);
1344 dump_decl_name (buffer
, node
, flags
);
1348 if (DECL_NAME (node
))
1349 dump_decl_name (buffer
, node
, flags
);
1350 else if (LABEL_DECL_UID (node
) != -1)
1351 pp_printf (buffer
, "<L%d>", (int) LABEL_DECL_UID (node
));
1354 if (flags
& TDF_NOUID
)
1355 pp_string (buffer
, "<D.xxxx>");
1357 pp_printf (buffer
, "<D.%u>", DECL_UID (node
));
1362 if (DECL_IS_BUILTIN (node
))
1364 /* Don't print the declaration of built-in types. */
1367 if (DECL_NAME (node
))
1368 dump_decl_name (buffer
, node
, flags
);
1369 else if (TYPE_NAME (TREE_TYPE (node
)) != node
)
1371 if ((TREE_CODE (TREE_TYPE (node
)) == RECORD_TYPE
1372 || TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
)
1373 && TYPE_METHODS (TREE_TYPE (node
)))
1375 /* The type is a c++ class: all structures have at least
1377 pp_string (buffer
, "class ");
1378 dump_generic_node (buffer
, TREE_TYPE (node
), spc
, flags
, false);
1383 (TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
1384 ? "union" : "struct "));
1385 dump_generic_node (buffer
, TREE_TYPE (node
), spc
, flags
, false);
1389 pp_string (buffer
, "<anon>");
1395 case DEBUG_EXPR_DECL
:
1396 case NAMESPACE_DECL
:
1398 dump_decl_name (buffer
, node
, flags
);
1402 pp_string (buffer
, "<retval>");
1406 op0
= TREE_OPERAND (node
, 0);
1409 && (TREE_CODE (op0
) == INDIRECT_REF
1410 || (TREE_CODE (op0
) == MEM_REF
1411 && TREE_CODE (TREE_OPERAND (op0
, 0)) != ADDR_EXPR
1412 && integer_zerop (TREE_OPERAND (op0
, 1))
1413 /* Dump the types of INTEGER_CSTs explicitly, for we
1414 can't infer them and MEM_ATTR caching will share
1415 MEM_REFs with differently-typed op0s. */
1416 && TREE_CODE (TREE_OPERAND (op0
, 0)) != INTEGER_CST
1417 /* Released SSA_NAMES have no TREE_TYPE. */
1418 && TREE_TYPE (TREE_OPERAND (op0
, 0)) != NULL_TREE
1419 /* Same pointer types, but ignoring POINTER_TYPE vs.
1421 && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 0)))
1422 == TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 1))))
1423 && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0
, 0)))
1424 == TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0
, 1))))
1425 && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0
, 0)))
1426 == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0
, 1))))
1427 /* Same value types ignoring qualifiers. */
1428 && (TYPE_MAIN_VARIANT (TREE_TYPE (op0
))
1429 == TYPE_MAIN_VARIANT
1430 (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 1))))))))
1432 op0
= TREE_OPERAND (op0
, 0);
1435 if (op_prio (op0
) < op_prio (node
))
1436 pp_left_paren (buffer
);
1437 dump_generic_node (buffer
, op0
, spc
, flags
, false);
1438 if (op_prio (op0
) < op_prio (node
))
1439 pp_right_paren (buffer
);
1440 pp_string (buffer
, str
);
1441 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1442 op0
= component_ref_field_offset (node
);
1443 if (op0
&& TREE_CODE (op0
) != INTEGER_CST
)
1445 pp_string (buffer
, "{off: ");
1446 dump_generic_node (buffer
, op0
, spc
, flags
, false);
1447 pp_right_brace (buffer
);
1452 pp_string (buffer
, "BIT_FIELD_REF <");
1453 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1454 pp_string (buffer
, ", ");
1455 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1456 pp_string (buffer
, ", ");
1457 dump_generic_node (buffer
, TREE_OPERAND (node
, 2), spc
, flags
, false);
1458 pp_greater (buffer
);
1462 case ARRAY_RANGE_REF
:
1463 op0
= TREE_OPERAND (node
, 0);
1464 if (op_prio (op0
) < op_prio (node
))
1465 pp_left_paren (buffer
);
1466 dump_generic_node (buffer
, op0
, spc
, flags
, false);
1467 if (op_prio (op0
) < op_prio (node
))
1468 pp_right_paren (buffer
);
1469 pp_left_bracket (buffer
);
1470 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1471 if (TREE_CODE (node
) == ARRAY_RANGE_REF
)
1472 pp_string (buffer
, " ...");
1473 pp_right_bracket (buffer
);
1475 op0
= array_ref_low_bound (node
);
1476 op1
= array_ref_element_size (node
);
1478 if (!integer_zerop (op0
)
1479 || TREE_OPERAND (node
, 2)
1480 || TREE_OPERAND (node
, 3))
1482 pp_string (buffer
, "{lb: ");
1483 dump_generic_node (buffer
, op0
, spc
, flags
, false);
1484 pp_string (buffer
, " sz: ");
1485 dump_generic_node (buffer
, op1
, spc
, flags
, false);
1486 pp_right_brace (buffer
);
1492 unsigned HOST_WIDE_INT ix
;
1494 bool is_struct_init
= false;
1495 bool is_array_init
= false;
1496 double_int curidx
= double_int_zero
;
1497 pp_left_brace (buffer
);
1498 if (TREE_CLOBBER_P (node
))
1499 pp_string (buffer
, "CLOBBER");
1500 else if (TREE_CODE (TREE_TYPE (node
)) == RECORD_TYPE
1501 || TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
)
1502 is_struct_init
= true;
1503 else if (TREE_CODE (TREE_TYPE (node
)) == ARRAY_TYPE
1504 && TYPE_DOMAIN (TREE_TYPE (node
))
1505 && TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
)))
1506 && TREE_CODE (TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
))))
1509 tree minv
= TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
)));
1510 is_array_init
= true;
1511 curidx
= tree_to_double_int (minv
);
1513 FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (node
), ix
, field
, val
)
1520 dump_generic_node (buffer
, field
, spc
, flags
, false);
1523 else if (is_array_init
1524 && (TREE_CODE (field
) != INTEGER_CST
1525 || tree_to_double_int (field
) != curidx
))
1527 pp_left_bracket (buffer
);
1528 if (TREE_CODE (field
) == RANGE_EXPR
)
1530 dump_generic_node (buffer
, TREE_OPERAND (field
, 0), spc
,
1532 pp_string (buffer
, " ... ");
1533 dump_generic_node (buffer
, TREE_OPERAND (field
, 1), spc
,
1535 if (TREE_CODE (TREE_OPERAND (field
, 1)) == INTEGER_CST
)
1536 curidx
= tree_to_double_int (TREE_OPERAND (field
, 1));
1539 dump_generic_node (buffer
, field
, spc
, flags
, false);
1540 if (TREE_CODE (field
) == INTEGER_CST
)
1541 curidx
= tree_to_double_int (field
);
1542 pp_string (buffer
, "]=");
1546 curidx
+= double_int_one
;
1547 if (val
&& TREE_CODE (val
) == ADDR_EXPR
)
1548 if (TREE_CODE (TREE_OPERAND (val
, 0)) == FUNCTION_DECL
)
1549 val
= TREE_OPERAND (val
, 0);
1550 if (val
&& TREE_CODE (val
) == FUNCTION_DECL
)
1551 dump_decl_name (buffer
, val
, flags
);
1553 dump_generic_node (buffer
, val
, spc
, flags
, false);
1554 if (ix
!= vec_safe_length (CONSTRUCTOR_ELTS (node
)) - 1)
1560 pp_right_brace (buffer
);
1567 if (flags
& TDF_SLIM
)
1569 pp_string (buffer
, "<COMPOUND_EXPR>");
1573 dump_generic_node (buffer
, TREE_OPERAND (node
, 0),
1574 spc
, flags
, !(flags
& TDF_SLIM
));
1575 if (flags
& TDF_SLIM
)
1576 newline_and_indent (buffer
, spc
);
1583 for (tp
= &TREE_OPERAND (node
, 1);
1584 TREE_CODE (*tp
) == COMPOUND_EXPR
;
1585 tp
= &TREE_OPERAND (*tp
, 1))
1587 dump_generic_node (buffer
, TREE_OPERAND (*tp
, 0),
1588 spc
, flags
, !(flags
& TDF_SLIM
));
1589 if (flags
& TDF_SLIM
)
1590 newline_and_indent (buffer
, spc
);
1598 dump_generic_node (buffer
, *tp
, spc
, flags
, !(flags
& TDF_SLIM
));
1602 case STATEMENT_LIST
:
1604 tree_stmt_iterator si
;
1607 if (flags
& TDF_SLIM
)
1609 pp_string (buffer
, "<STATEMENT_LIST>");
1613 for (si
= tsi_start (node
); !tsi_end_p (si
); tsi_next (&si
))
1616 newline_and_indent (buffer
, spc
);
1619 dump_generic_node (buffer
, tsi_stmt (si
), spc
, flags
, true);
1626 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
,
1631 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
,
1636 pp_string (buffer
, "TARGET_EXPR <");
1637 dump_generic_node (buffer
, TARGET_EXPR_SLOT (node
), spc
, flags
, false);
1640 dump_generic_node (buffer
, TARGET_EXPR_INITIAL (node
), spc
, flags
, false);
1641 pp_greater (buffer
);
1645 print_declaration (buffer
, DECL_EXPR_DECL (node
), spc
, flags
);
1650 if (TREE_TYPE (node
) == NULL
|| TREE_TYPE (node
) == void_type_node
)
1652 pp_string (buffer
, "if (");
1653 dump_generic_node (buffer
, COND_EXPR_COND (node
), spc
, flags
, false);
1654 pp_right_paren (buffer
);
1655 /* The lowered cond_exprs should always be printed in full. */
1656 if (COND_EXPR_THEN (node
)
1657 && (IS_EMPTY_STMT (COND_EXPR_THEN (node
))
1658 || TREE_CODE (COND_EXPR_THEN (node
)) == GOTO_EXPR
)
1659 && COND_EXPR_ELSE (node
)
1660 && (IS_EMPTY_STMT (COND_EXPR_ELSE (node
))
1661 || TREE_CODE (COND_EXPR_ELSE (node
)) == GOTO_EXPR
))
1664 dump_generic_node (buffer
, COND_EXPR_THEN (node
),
1666 if (!IS_EMPTY_STMT (COND_EXPR_ELSE (node
)))
1668 pp_string (buffer
, " else ");
1669 dump_generic_node (buffer
, COND_EXPR_ELSE (node
),
1673 else if (!(flags
& TDF_SLIM
))
1675 /* Output COND_EXPR_THEN. */
1676 if (COND_EXPR_THEN (node
))
1678 newline_and_indent (buffer
, spc
+2);
1679 pp_left_brace (buffer
);
1680 newline_and_indent (buffer
, spc
+4);
1681 dump_generic_node (buffer
, COND_EXPR_THEN (node
), spc
+4,
1683 newline_and_indent (buffer
, spc
+2);
1684 pp_right_brace (buffer
);
1687 /* Output COND_EXPR_ELSE. */
1688 if (COND_EXPR_ELSE (node
)
1689 && !IS_EMPTY_STMT (COND_EXPR_ELSE (node
)))
1691 newline_and_indent (buffer
, spc
);
1692 pp_string (buffer
, "else");
1693 newline_and_indent (buffer
, spc
+2);
1694 pp_left_brace (buffer
);
1695 newline_and_indent (buffer
, spc
+4);
1696 dump_generic_node (buffer
, COND_EXPR_ELSE (node
), spc
+4,
1698 newline_and_indent (buffer
, spc
+2);
1699 pp_right_brace (buffer
);
1706 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1708 pp_question (buffer
);
1710 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1714 dump_generic_node (buffer
, TREE_OPERAND (node
, 2), spc
, flags
, false);
1719 pp_left_brace (buffer
);
1720 if (!(flags
& TDF_SLIM
))
1722 if (BIND_EXPR_VARS (node
))
1724 pp_newline (buffer
);
1726 for (op0
= BIND_EXPR_VARS (node
); op0
; op0
= DECL_CHAIN (op0
))
1728 print_declaration (buffer
, op0
, spc
+2, flags
);
1729 pp_newline (buffer
);
1733 newline_and_indent (buffer
, spc
+2);
1734 dump_generic_node (buffer
, BIND_EXPR_BODY (node
), spc
+2, flags
, true);
1735 newline_and_indent (buffer
, spc
);
1736 pp_right_brace (buffer
);
1742 print_call_name (buffer
, CALL_EXPR_FN (node
), flags
);
1744 /* Print parameters. */
1746 pp_left_paren (buffer
);
1749 call_expr_arg_iterator iter
;
1750 FOR_EACH_CALL_EXPR_ARG (arg
, iter
, node
)
1752 dump_generic_node (buffer
, arg
, spc
, flags
, false);
1753 if (more_call_expr_args_p (&iter
))
1760 if (CALL_EXPR_VA_ARG_PACK (node
))
1762 if (call_expr_nargs (node
) > 0)
1767 pp_string (buffer
, "__builtin_va_arg_pack ()");
1769 pp_right_paren (buffer
);
1771 op1
= CALL_EXPR_STATIC_CHAIN (node
);
1774 pp_string (buffer
, " [static-chain: ");
1775 dump_generic_node (buffer
, op1
, spc
, flags
, false);
1776 pp_right_bracket (buffer
);
1779 if (CALL_EXPR_RETURN_SLOT_OPT (node
))
1780 pp_string (buffer
, " [return slot optimization]");
1781 if (CALL_EXPR_TAILCALL (node
))
1782 pp_string (buffer
, " [tail call]");
1785 case WITH_CLEANUP_EXPR
:
1789 case CLEANUP_POINT_EXPR
:
1790 pp_string (buffer
, "<<cleanup_point ");
1791 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1792 pp_string (buffer
, ">>");
1795 case PLACEHOLDER_EXPR
:
1796 pp_string (buffer
, "<PLACEHOLDER_EXPR ");
1797 dump_generic_node (buffer
, TREE_TYPE (node
), spc
, flags
, false);
1798 pp_greater (buffer
);
1801 /* Binary arithmetic and logic expressions. */
1802 case WIDEN_SUM_EXPR
:
1803 case WIDEN_MULT_EXPR
:
1805 case MULT_HIGHPART_EXPR
:
1807 case POINTER_PLUS_EXPR
:
1809 case TRUNC_DIV_EXPR
:
1811 case FLOOR_DIV_EXPR
:
1812 case ROUND_DIV_EXPR
:
1813 case TRUNC_MOD_EXPR
:
1815 case FLOOR_MOD_EXPR
:
1816 case ROUND_MOD_EXPR
:
1818 case EXACT_DIV_EXPR
:
1823 case VEC_LSHIFT_EXPR
:
1824 case VEC_RSHIFT_EXPR
:
1825 case WIDEN_LSHIFT_EXPR
:
1829 case TRUTH_ANDIF_EXPR
:
1830 case TRUTH_ORIF_EXPR
:
1831 case TRUTH_AND_EXPR
:
1833 case TRUTH_XOR_EXPR
:
1847 case UNORDERED_EXPR
:
1849 const char *op
= op_symbol (node
);
1850 op0
= TREE_OPERAND (node
, 0);
1851 op1
= TREE_OPERAND (node
, 1);
1853 /* When the operands are expressions with less priority,
1854 keep semantics of the tree representation. */
1855 if (op_prio (op0
) <= op_prio (node
))
1857 pp_left_paren (buffer
);
1858 dump_generic_node (buffer
, op0
, spc
, flags
, false);
1859 pp_right_paren (buffer
);
1862 dump_generic_node (buffer
, op0
, spc
, flags
, false);
1865 pp_string (buffer
, op
);
1868 /* When the operands are expressions with less priority,
1869 keep semantics of the tree representation. */
1870 if (op_prio (op1
) <= op_prio (node
))
1872 pp_left_paren (buffer
);
1873 dump_generic_node (buffer
, op1
, spc
, flags
, false);
1874 pp_right_paren (buffer
);
1877 dump_generic_node (buffer
, op1
, spc
, flags
, false);
1881 /* Unary arithmetic and logic expressions. */
1884 case TRUTH_NOT_EXPR
:
1886 case PREDECREMENT_EXPR
:
1887 case PREINCREMENT_EXPR
:
1889 if (TREE_CODE (node
) == ADDR_EXPR
1890 && (TREE_CODE (TREE_OPERAND (node
, 0)) == STRING_CST
1891 || TREE_CODE (TREE_OPERAND (node
, 0)) == FUNCTION_DECL
))
1892 ; /* Do not output '&' for strings and function pointers. */
1894 pp_string (buffer
, op_symbol (node
));
1896 if (op_prio (TREE_OPERAND (node
, 0)) < op_prio (node
))
1898 pp_left_paren (buffer
);
1899 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1900 pp_right_paren (buffer
);
1903 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1906 case POSTDECREMENT_EXPR
:
1907 case POSTINCREMENT_EXPR
:
1908 if (op_prio (TREE_OPERAND (node
, 0)) < op_prio (node
))
1910 pp_left_paren (buffer
);
1911 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1912 pp_right_paren (buffer
);
1915 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1916 pp_string (buffer
, op_symbol (node
));
1920 pp_string (buffer
, "MIN_EXPR <");
1921 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1922 pp_string (buffer
, ", ");
1923 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1924 pp_greater (buffer
);
1928 pp_string (buffer
, "MAX_EXPR <");
1929 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1930 pp_string (buffer
, ", ");
1931 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1932 pp_greater (buffer
);
1936 pp_string (buffer
, "ABS_EXPR <");
1937 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1938 pp_greater (buffer
);
1945 case ADDR_SPACE_CONVERT_EXPR
:
1946 case FIXED_CONVERT_EXPR
:
1947 case FIX_TRUNC_EXPR
:
1950 type
= TREE_TYPE (node
);
1951 op0
= TREE_OPERAND (node
, 0);
1952 if (type
!= TREE_TYPE (op0
))
1954 pp_left_paren (buffer
);
1955 dump_generic_node (buffer
, type
, spc
, flags
, false);
1956 pp_string (buffer
, ") ");
1958 if (op_prio (op0
) < op_prio (node
))
1959 pp_left_paren (buffer
);
1960 dump_generic_node (buffer
, op0
, spc
, flags
, false);
1961 if (op_prio (op0
) < op_prio (node
))
1962 pp_right_paren (buffer
);
1965 case VIEW_CONVERT_EXPR
:
1966 pp_string (buffer
, "VIEW_CONVERT_EXPR<");
1967 dump_generic_node (buffer
, TREE_TYPE (node
), spc
, flags
, false);
1968 pp_string (buffer
, ">(");
1969 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1970 pp_right_paren (buffer
);
1974 pp_string (buffer
, "((");
1975 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1976 pp_string (buffer
, "))");
1979 case NON_LVALUE_EXPR
:
1980 pp_string (buffer
, "NON_LVALUE_EXPR <");
1981 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1982 pp_greater (buffer
);
1986 pp_string (buffer
, "SAVE_EXPR <");
1987 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1988 pp_greater (buffer
);
1992 pp_string (buffer
, "COMPLEX_EXPR <");
1993 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1994 pp_string (buffer
, ", ");
1995 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1996 pp_greater (buffer
);
2000 pp_string (buffer
, "CONJ_EXPR <");
2001 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2002 pp_greater (buffer
);
2006 pp_string (buffer
, "REALPART_EXPR <");
2007 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2008 pp_greater (buffer
);
2012 pp_string (buffer
, "IMAGPART_EXPR <");
2013 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2014 pp_greater (buffer
);
2018 pp_string (buffer
, "VA_ARG_EXPR <");
2019 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2020 pp_greater (buffer
);
2023 case TRY_FINALLY_EXPR
:
2024 case TRY_CATCH_EXPR
:
2025 pp_string (buffer
, "try");
2026 newline_and_indent (buffer
, spc
+2);
2027 pp_left_brace (buffer
);
2028 newline_and_indent (buffer
, spc
+4);
2029 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
+4, flags
, true);
2030 newline_and_indent (buffer
, spc
+2);
2031 pp_right_brace (buffer
);
2032 newline_and_indent (buffer
, spc
);
2034 (TREE_CODE (node
) == TRY_CATCH_EXPR
) ? "catch" : "finally");
2035 newline_and_indent (buffer
, spc
+2);
2036 pp_left_brace (buffer
);
2037 newline_and_indent (buffer
, spc
+4);
2038 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
+4, flags
, true);
2039 newline_and_indent (buffer
, spc
+2);
2040 pp_right_brace (buffer
);
2045 pp_string (buffer
, "catch (");
2046 dump_generic_node (buffer
, CATCH_TYPES (node
), spc
+2, flags
, false);
2047 pp_right_paren (buffer
);
2048 newline_and_indent (buffer
, spc
+2);
2049 pp_left_brace (buffer
);
2050 newline_and_indent (buffer
, spc
+4);
2051 dump_generic_node (buffer
, CATCH_BODY (node
), spc
+4, flags
, true);
2052 newline_and_indent (buffer
, spc
+2);
2053 pp_right_brace (buffer
);
2057 case EH_FILTER_EXPR
:
2058 pp_string (buffer
, "<<<eh_filter (");
2059 dump_generic_node (buffer
, EH_FILTER_TYPES (node
), spc
+2, flags
, false);
2060 pp_string (buffer
, ")>>>");
2061 newline_and_indent (buffer
, spc
+2);
2062 pp_left_brace (buffer
);
2063 newline_and_indent (buffer
, spc
+4);
2064 dump_generic_node (buffer
, EH_FILTER_FAILURE (node
), spc
+4, flags
, true);
2065 newline_and_indent (buffer
, spc
+2);
2066 pp_right_brace (buffer
);
2071 op0
= TREE_OPERAND (node
, 0);
2072 /* If this is for break or continue, don't bother printing it. */
2073 if (DECL_NAME (op0
))
2075 const char *name
= IDENTIFIER_POINTER (DECL_NAME (op0
));
2076 if (strcmp (name
, "break") == 0
2077 || strcmp (name
, "continue") == 0)
2080 dump_generic_node (buffer
, op0
, spc
, flags
, false);
2082 if (DECL_NONLOCAL (op0
))
2083 pp_string (buffer
, " [non-local]");
2087 pp_string (buffer
, "while (1)");
2088 if (!(flags
& TDF_SLIM
))
2090 newline_and_indent (buffer
, spc
+2);
2091 pp_left_brace (buffer
);
2092 newline_and_indent (buffer
, spc
+4);
2093 dump_generic_node (buffer
, LOOP_EXPR_BODY (node
), spc
+4, flags
, true);
2094 newline_and_indent (buffer
, spc
+2);
2095 pp_right_brace (buffer
);
2101 pp_string (buffer
, "// predicted ");
2102 if (PREDICT_EXPR_OUTCOME (node
))
2103 pp_string (buffer
, "likely by ");
2105 pp_string (buffer
, "unlikely by ");
2106 pp_string (buffer
, predictor_name (PREDICT_EXPR_PREDICTOR (node
)));
2107 pp_string (buffer
, " predictor.");
2111 pp_string (buffer
, "ANNOTATE_EXPR <");
2112 switch ((enum annot_expr_kind
) TREE_INT_CST_LOW (TREE_OPERAND (node
, 1)))
2114 case annot_expr_ivdep_kind
:
2115 pp_string (buffer
, "ivdep, ");
2118 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2119 pp_greater (buffer
);
2123 pp_string (buffer
, "return");
2124 op0
= TREE_OPERAND (node
, 0);
2128 if (TREE_CODE (op0
) == MODIFY_EXPR
)
2129 dump_generic_node (buffer
, TREE_OPERAND (op0
, 1),
2132 dump_generic_node (buffer
, op0
, spc
, flags
, false);
2137 pp_string (buffer
, "if (");
2138 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2139 pp_string (buffer
, ") break");
2143 pp_string (buffer
, "switch (");
2144 dump_generic_node (buffer
, SWITCH_COND (node
), spc
, flags
, false);
2145 pp_right_paren (buffer
);
2146 if (!(flags
& TDF_SLIM
))
2148 newline_and_indent (buffer
, spc
+2);
2149 pp_left_brace (buffer
);
2150 if (SWITCH_BODY (node
))
2152 newline_and_indent (buffer
, spc
+4);
2153 dump_generic_node (buffer
, SWITCH_BODY (node
), spc
+4, flags
,
2158 tree vec
= SWITCH_LABELS (node
);
2159 size_t i
, n
= TREE_VEC_LENGTH (vec
);
2160 for (i
= 0; i
< n
; ++i
)
2162 tree elt
= TREE_VEC_ELT (vec
, i
);
2163 newline_and_indent (buffer
, spc
+4);
2166 dump_generic_node (buffer
, elt
, spc
+4, flags
, false);
2167 pp_string (buffer
, " goto ");
2168 dump_generic_node (buffer
, CASE_LABEL (elt
), spc
+4,
2170 pp_semicolon (buffer
);
2173 pp_string (buffer
, "case ???: goto ???;");
2176 newline_and_indent (buffer
, spc
+2);
2177 pp_right_brace (buffer
);
2183 op0
= GOTO_DESTINATION (node
);
2184 if (TREE_CODE (op0
) != SSA_NAME
&& DECL_P (op0
) && DECL_NAME (op0
))
2186 const char *name
= IDENTIFIER_POINTER (DECL_NAME (op0
));
2187 if (strcmp (name
, "break") == 0
2188 || strcmp (name
, "continue") == 0)
2190 pp_string (buffer
, name
);
2194 pp_string (buffer
, "goto ");
2195 dump_generic_node (buffer
, op0
, spc
, flags
, false);
2199 pp_string (buffer
, "__asm__");
2200 if (ASM_VOLATILE_P (node
))
2201 pp_string (buffer
, " __volatile__");
2202 pp_left_paren (buffer
);
2203 dump_generic_node (buffer
, ASM_STRING (node
), spc
, flags
, false);
2205 dump_generic_node (buffer
, ASM_OUTPUTS (node
), spc
, flags
, false);
2207 dump_generic_node (buffer
, ASM_INPUTS (node
), spc
, flags
, false);
2208 if (ASM_CLOBBERS (node
))
2211 dump_generic_node (buffer
, ASM_CLOBBERS (node
), spc
, flags
, false);
2213 pp_right_paren (buffer
);
2216 case CASE_LABEL_EXPR
:
2217 if (CASE_LOW (node
) && CASE_HIGH (node
))
2219 pp_string (buffer
, "case ");
2220 dump_generic_node (buffer
, CASE_LOW (node
), spc
, flags
, false);
2221 pp_string (buffer
, " ... ");
2222 dump_generic_node (buffer
, CASE_HIGH (node
), spc
, flags
, false);
2224 else if (CASE_LOW (node
))
2226 pp_string (buffer
, "case ");
2227 dump_generic_node (buffer
, CASE_LOW (node
), spc
, flags
, false);
2230 pp_string (buffer
, "default");
2235 pp_string (buffer
, "OBJ_TYPE_REF(");
2236 dump_generic_node (buffer
, OBJ_TYPE_REF_EXPR (node
), spc
, flags
, false);
2237 pp_semicolon (buffer
);
2238 if (!(flags
& TDF_SLIM
) && virtual_method_call_p (node
))
2240 pp_string (buffer
, "(");
2241 dump_generic_node (buffer
, obj_type_ref_class (node
), spc
, flags
, false);
2242 pp_string (buffer
, ")");
2244 dump_generic_node (buffer
, OBJ_TYPE_REF_OBJECT (node
), spc
, flags
, false);
2246 dump_generic_node (buffer
, OBJ_TYPE_REF_TOKEN (node
), spc
, flags
, false);
2247 pp_right_paren (buffer
);
2251 if (SSA_NAME_IDENTIFIER (node
))
2252 dump_generic_node (buffer
, SSA_NAME_IDENTIFIER (node
),
2254 pp_underscore (buffer
);
2255 pp_decimal_int (buffer
, SSA_NAME_VERSION (node
));
2256 if (SSA_NAME_IS_DEFAULT_DEF (node
))
2257 pp_string (buffer
, "(D)");
2258 if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (node
))
2259 pp_string (buffer
, "(ab)");
2262 case WITH_SIZE_EXPR
:
2263 pp_string (buffer
, "WITH_SIZE_EXPR <");
2264 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2265 pp_string (buffer
, ", ");
2266 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2267 pp_greater (buffer
);
2271 pp_string (buffer
, "ASSERT_EXPR <");
2272 dump_generic_node (buffer
, ASSERT_EXPR_VAR (node
), spc
, flags
, false);
2273 pp_string (buffer
, ", ");
2274 dump_generic_node (buffer
, ASSERT_EXPR_COND (node
), spc
, flags
, false);
2275 pp_greater (buffer
);
2279 pp_string (buffer
, "scev_known");
2282 case SCEV_NOT_KNOWN
:
2283 pp_string (buffer
, "scev_not_known");
2286 case POLYNOMIAL_CHREC
:
2287 pp_left_brace (buffer
);
2288 dump_generic_node (buffer
, CHREC_LEFT (node
), spc
, flags
, false);
2289 pp_string (buffer
, ", +, ");
2290 dump_generic_node (buffer
, CHREC_RIGHT (node
), spc
, flags
, false);
2291 pp_string (buffer
, "}_");
2292 dump_generic_node (buffer
, CHREC_VAR (node
), spc
, flags
, false);
2296 case REALIGN_LOAD_EXPR
:
2297 pp_string (buffer
, "REALIGN_LOAD <");
2298 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2299 pp_string (buffer
, ", ");
2300 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2301 pp_string (buffer
, ", ");
2302 dump_generic_node (buffer
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2303 pp_greater (buffer
);
2307 pp_string (buffer
, " VEC_COND_EXPR < ");
2308 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2309 pp_string (buffer
, " , ");
2310 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2311 pp_string (buffer
, " , ");
2312 dump_generic_node (buffer
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2313 pp_string (buffer
, " > ");
2317 pp_string (buffer
, " VEC_PERM_EXPR < ");
2318 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2319 pp_string (buffer
, " , ");
2320 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2321 pp_string (buffer
, " , ");
2322 dump_generic_node (buffer
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2323 pp_string (buffer
, " > ");
2327 pp_string (buffer
, " DOT_PROD_EXPR < ");
2328 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2329 pp_string (buffer
, ", ");
2330 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2331 pp_string (buffer
, ", ");
2332 dump_generic_node (buffer
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2333 pp_string (buffer
, " > ");
2336 case WIDEN_MULT_PLUS_EXPR
:
2337 pp_string (buffer
, " WIDEN_MULT_PLUS_EXPR < ");
2338 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2339 pp_string (buffer
, ", ");
2340 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2341 pp_string (buffer
, ", ");
2342 dump_generic_node (buffer
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2343 pp_string (buffer
, " > ");
2346 case WIDEN_MULT_MINUS_EXPR
:
2347 pp_string (buffer
, " WIDEN_MULT_MINUS_EXPR < ");
2348 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2349 pp_string (buffer
, ", ");
2350 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2351 pp_string (buffer
, ", ");
2352 dump_generic_node (buffer
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2353 pp_string (buffer
, " > ");
2357 pp_string (buffer
, " FMA_EXPR < ");
2358 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2359 pp_string (buffer
, ", ");
2360 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2361 pp_string (buffer
, ", ");
2362 dump_generic_node (buffer
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2363 pp_string (buffer
, " > ");
2367 pp_string (buffer
, "#pragma omp parallel");
2368 dump_omp_clauses (buffer
, OMP_PARALLEL_CLAUSES (node
), spc
, flags
);
2371 if (!(flags
& TDF_SLIM
) && OMP_BODY (node
))
2373 newline_and_indent (buffer
, spc
+ 2);
2374 pp_left_brace (buffer
);
2375 newline_and_indent (buffer
, spc
+ 4);
2376 dump_generic_node (buffer
, OMP_BODY (node
), spc
+ 4, flags
, false);
2377 newline_and_indent (buffer
, spc
+ 2);
2378 pp_right_brace (buffer
);
2384 pp_string (buffer
, "#pragma omp task");
2385 dump_omp_clauses (buffer
, OMP_TASK_CLAUSES (node
), spc
, flags
);
2389 pp_string (buffer
, "#pragma omp for");
2393 pp_string (buffer
, "#pragma omp simd");
2397 pp_string (buffer
, "#pragma simd");
2400 case OMP_DISTRIBUTE
:
2401 pp_string (buffer
, "#pragma omp distribute");
2405 pp_string (buffer
, "#pragma omp teams");
2406 dump_omp_clauses (buffer
, OMP_TEAMS_CLAUSES (node
), spc
, flags
);
2409 case OMP_TARGET_DATA
:
2410 pp_string (buffer
, "#pragma omp target data");
2411 dump_omp_clauses (buffer
, OMP_TARGET_DATA_CLAUSES (node
), spc
, flags
);
2415 pp_string (buffer
, "#pragma omp target");
2416 dump_omp_clauses (buffer
, OMP_TARGET_CLAUSES (node
), spc
, flags
);
2419 case OMP_TARGET_UPDATE
:
2420 pp_string (buffer
, "#pragma omp target update");
2421 dump_omp_clauses (buffer
, OMP_TARGET_UPDATE_CLAUSES (node
), spc
, flags
);
2426 dump_omp_clauses (buffer
, OMP_FOR_CLAUSES (node
), spc
, flags
);
2428 if (!(flags
& TDF_SLIM
))
2432 if (OMP_FOR_PRE_BODY (node
))
2434 newline_and_indent (buffer
, spc
+ 2);
2435 pp_left_brace (buffer
);
2437 newline_and_indent (buffer
, spc
);
2438 dump_generic_node (buffer
, OMP_FOR_PRE_BODY (node
),
2441 if (OMP_FOR_INIT (node
))
2444 for (i
= 0; i
< TREE_VEC_LENGTH (OMP_FOR_INIT (node
)); i
++)
2447 newline_and_indent (buffer
, spc
);
2448 pp_string (buffer
, "for (");
2449 dump_generic_node (buffer
,
2450 TREE_VEC_ELT (OMP_FOR_INIT (node
), i
),
2452 pp_string (buffer
, "; ");
2453 dump_generic_node (buffer
,
2454 TREE_VEC_ELT (OMP_FOR_COND (node
), i
),
2456 pp_string (buffer
, "; ");
2457 dump_generic_node (buffer
,
2458 TREE_VEC_ELT (OMP_FOR_INCR (node
), i
),
2460 pp_right_paren (buffer
);
2463 if (OMP_FOR_BODY (node
))
2465 newline_and_indent (buffer
, spc
+ 2);
2466 pp_left_brace (buffer
);
2467 newline_and_indent (buffer
, spc
+ 4);
2468 dump_generic_node (buffer
, OMP_FOR_BODY (node
), spc
+ 4, flags
,
2470 newline_and_indent (buffer
, spc
+ 2);
2471 pp_right_brace (buffer
);
2473 if (OMP_FOR_INIT (node
))
2474 spc
-= 2 * TREE_VEC_LENGTH (OMP_FOR_INIT (node
)) - 2;
2475 if (OMP_FOR_PRE_BODY (node
))
2478 newline_and_indent (buffer
, spc
+ 2);
2479 pp_right_brace (buffer
);
2486 pp_string (buffer
, "#pragma omp sections");
2487 dump_omp_clauses (buffer
, OMP_SECTIONS_CLAUSES (node
), spc
, flags
);
2491 pp_string (buffer
, "#pragma omp section");
2495 pp_string (buffer
, "#pragma omp master");
2499 pp_string (buffer
, "#pragma omp taskgroup");
2503 pp_string (buffer
, "#pragma omp ordered");
2507 pp_string (buffer
, "#pragma omp critical");
2508 if (OMP_CRITICAL_NAME (node
))
2511 pp_left_paren (buffer
);
2512 dump_generic_node (buffer
, OMP_CRITICAL_NAME (node
), spc
,
2514 pp_right_paren (buffer
);
2519 pp_string (buffer
, "#pragma omp atomic");
2520 if (OMP_ATOMIC_SEQ_CST (node
))
2521 pp_string (buffer
, " seq_cst");
2522 newline_and_indent (buffer
, spc
+ 2);
2523 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2527 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2530 case OMP_ATOMIC_READ
:
2531 pp_string (buffer
, "#pragma omp atomic read");
2532 if (OMP_ATOMIC_SEQ_CST (node
))
2533 pp_string (buffer
, " seq_cst");
2534 newline_and_indent (buffer
, spc
+ 2);
2535 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2539 case OMP_ATOMIC_CAPTURE_OLD
:
2540 case OMP_ATOMIC_CAPTURE_NEW
:
2541 pp_string (buffer
, "#pragma omp atomic capture");
2542 if (OMP_ATOMIC_SEQ_CST (node
))
2543 pp_string (buffer
, " seq_cst");
2544 newline_and_indent (buffer
, spc
+ 2);
2545 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2549 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2553 pp_string (buffer
, "#pragma omp single");
2554 dump_omp_clauses (buffer
, OMP_SINGLE_CLAUSES (node
), spc
, flags
);
2558 dump_omp_clause (buffer
, node
, spc
, flags
);
2562 case TRANSACTION_EXPR
:
2563 if (TRANSACTION_EXPR_OUTER (node
))
2564 pp_string (buffer
, "__transaction_atomic [[outer]]");
2565 else if (TRANSACTION_EXPR_RELAXED (node
))
2566 pp_string (buffer
, "__transaction_relaxed");
2568 pp_string (buffer
, "__transaction_atomic");
2569 if (!(flags
& TDF_SLIM
) && TRANSACTION_EXPR_BODY (node
))
2571 newline_and_indent (buffer
, spc
);
2572 pp_left_brace (buffer
);
2573 newline_and_indent (buffer
, spc
+ 2);
2574 dump_generic_node (buffer
, TRANSACTION_EXPR_BODY (node
),
2575 spc
+ 2, flags
, false);
2576 newline_and_indent (buffer
, spc
);
2577 pp_right_brace (buffer
);
2582 case REDUC_MAX_EXPR
:
2583 pp_string (buffer
, " REDUC_MAX_EXPR < ");
2584 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2585 pp_string (buffer
, " > ");
2588 case REDUC_MIN_EXPR
:
2589 pp_string (buffer
, " REDUC_MIN_EXPR < ");
2590 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2591 pp_string (buffer
, " > ");
2594 case REDUC_PLUS_EXPR
:
2595 pp_string (buffer
, " REDUC_PLUS_EXPR < ");
2596 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2597 pp_string (buffer
, " > ");
2600 case VEC_WIDEN_MULT_HI_EXPR
:
2601 case VEC_WIDEN_MULT_LO_EXPR
:
2602 case VEC_WIDEN_MULT_EVEN_EXPR
:
2603 case VEC_WIDEN_MULT_ODD_EXPR
:
2604 case VEC_WIDEN_LSHIFT_HI_EXPR
:
2605 case VEC_WIDEN_LSHIFT_LO_EXPR
:
2607 for (str
= get_tree_code_name (code
); *str
; str
++)
2608 pp_character (buffer
, TOUPPER (*str
));
2609 pp_string (buffer
, " < ");
2610 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2611 pp_string (buffer
, ", ");
2612 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2613 pp_string (buffer
, " > ");
2616 case VEC_UNPACK_HI_EXPR
:
2617 pp_string (buffer
, " VEC_UNPACK_HI_EXPR < ");
2618 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2619 pp_string (buffer
, " > ");
2622 case VEC_UNPACK_LO_EXPR
:
2623 pp_string (buffer
, " VEC_UNPACK_LO_EXPR < ");
2624 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2625 pp_string (buffer
, " > ");
2628 case VEC_UNPACK_FLOAT_HI_EXPR
:
2629 pp_string (buffer
, " VEC_UNPACK_FLOAT_HI_EXPR < ");
2630 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2631 pp_string (buffer
, " > ");
2634 case VEC_UNPACK_FLOAT_LO_EXPR
:
2635 pp_string (buffer
, " VEC_UNPACK_FLOAT_LO_EXPR < ");
2636 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2637 pp_string (buffer
, " > ");
2640 case VEC_PACK_TRUNC_EXPR
:
2641 pp_string (buffer
, " VEC_PACK_TRUNC_EXPR < ");
2642 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2643 pp_string (buffer
, ", ");
2644 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2645 pp_string (buffer
, " > ");
2648 case VEC_PACK_SAT_EXPR
:
2649 pp_string (buffer
, " VEC_PACK_SAT_EXPR < ");
2650 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2651 pp_string (buffer
, ", ");
2652 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2653 pp_string (buffer
, " > ");
2656 case VEC_PACK_FIX_TRUNC_EXPR
:
2657 pp_string (buffer
, " VEC_PACK_FIX_TRUNC_EXPR < ");
2658 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2659 pp_string (buffer
, ", ");
2660 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2661 pp_string (buffer
, " > ");
2665 dump_block_node (buffer
, node
, spc
, flags
);
2668 case CILK_SPAWN_STMT
:
2669 pp_string (buffer
, "_Cilk_spawn ");
2670 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2673 case CILK_SYNC_STMT
:
2674 pp_string (buffer
, "_Cilk_sync");
2681 if (is_stmt
&& is_expr
)
2682 pp_semicolon (buffer
);
2687 /* Print the declaration of a variable. */
2690 print_declaration (pretty_printer
*buffer
, tree t
, int spc
, int flags
)
2694 if (TREE_CODE(t
) == NAMELIST_DECL
)
2696 pp_string(buffer
, "namelist ");
2697 dump_decl_name (buffer
, t
, flags
);
2698 pp_semicolon (buffer
);
2702 if (TREE_CODE (t
) == TYPE_DECL
)
2703 pp_string (buffer
, "typedef ");
2705 if (CODE_CONTAINS_STRUCT (TREE_CODE (t
), TS_DECL_WRTL
) && DECL_REGISTER (t
))
2706 pp_string (buffer
, "register ");
2708 if (TREE_PUBLIC (t
) && DECL_EXTERNAL (t
))
2709 pp_string (buffer
, "extern ");
2710 else if (TREE_STATIC (t
))
2711 pp_string (buffer
, "static ");
2713 /* Print the type and name. */
2714 if (TREE_TYPE (t
) && TREE_CODE (TREE_TYPE (t
)) == ARRAY_TYPE
)
2718 /* Print array's type. */
2719 tmp
= TREE_TYPE (t
);
2720 while (TREE_CODE (TREE_TYPE (tmp
)) == ARRAY_TYPE
)
2721 tmp
= TREE_TYPE (tmp
);
2722 dump_generic_node (buffer
, TREE_TYPE (tmp
), spc
, flags
, false);
2724 /* Print variable's name. */
2726 dump_generic_node (buffer
, t
, spc
, flags
, false);
2728 /* Print the dimensions. */
2729 tmp
= TREE_TYPE (t
);
2730 while (TREE_CODE (tmp
) == ARRAY_TYPE
)
2732 dump_array_domain (buffer
, TYPE_DOMAIN (tmp
), spc
, flags
);
2733 tmp
= TREE_TYPE (tmp
);
2736 else if (TREE_CODE (t
) == FUNCTION_DECL
)
2738 dump_generic_node (buffer
, TREE_TYPE (TREE_TYPE (t
)), spc
, flags
, false);
2740 dump_decl_name (buffer
, t
, flags
);
2741 dump_function_declaration (buffer
, TREE_TYPE (t
), spc
, flags
);
2745 /* Print type declaration. */
2746 dump_generic_node (buffer
, TREE_TYPE (t
), spc
, flags
, false);
2748 /* Print variable's name. */
2750 dump_generic_node (buffer
, t
, spc
, flags
, false);
2753 if (TREE_CODE (t
) == VAR_DECL
&& DECL_HARD_REGISTER (t
))
2755 pp_string (buffer
, " __asm__ ");
2756 pp_left_paren (buffer
);
2757 dump_generic_node (buffer
, DECL_ASSEMBLER_NAME (t
), spc
, flags
, false);
2758 pp_right_paren (buffer
);
2761 /* The initial value of a function serves to determine whether the function
2762 is declared or defined. So the following does not apply to function
2764 if (TREE_CODE (t
) != FUNCTION_DECL
)
2766 /* Print the initial value. */
2767 if (DECL_INITIAL (t
))
2772 dump_generic_node (buffer
, DECL_INITIAL (t
), spc
, flags
, false);
2776 if (TREE_CODE (t
) == VAR_DECL
&& DECL_HAS_VALUE_EXPR_P (t
))
2778 pp_string (buffer
, " [value-expr: ");
2779 dump_generic_node (buffer
, DECL_VALUE_EXPR (t
), spc
, flags
, false);
2780 pp_right_bracket (buffer
);
2783 pp_semicolon (buffer
);
2787 /* Prints a structure: name, fields, and methods.
2788 FIXME: Still incomplete. */
2791 print_struct_decl (pretty_printer
*buffer
, const_tree node
, int spc
, int flags
)
2793 /* Print the name of the structure. */
2794 if (TYPE_NAME (node
))
2797 if (TREE_CODE (node
) == RECORD_TYPE
)
2798 pp_string (buffer
, "struct ");
2799 else if ((TREE_CODE (node
) == UNION_TYPE
2800 || TREE_CODE (node
) == QUAL_UNION_TYPE
))
2801 pp_string (buffer
, "union ");
2803 dump_generic_node (buffer
, TYPE_NAME (node
), spc
, 0, false);
2806 /* Print the contents of the structure. */
2807 pp_newline (buffer
);
2809 pp_left_brace (buffer
);
2810 pp_newline (buffer
);
2812 /* Print the fields of the structure. */
2815 tmp
= TYPE_FIELDS (node
);
2818 /* Avoid to print recursively the structure. */
2819 /* FIXME : Not implemented correctly...,
2820 what about the case when we have a cycle in the contain graph? ...
2821 Maybe this could be solved by looking at the scope in which the
2822 structure was declared. */
2823 if (TREE_TYPE (tmp
) != node
2824 && (TREE_CODE (TREE_TYPE (tmp
)) != POINTER_TYPE
2825 || TREE_TYPE (TREE_TYPE (tmp
)) != node
))
2827 print_declaration (buffer
, tmp
, spc
+2, flags
);
2828 pp_newline (buffer
);
2830 tmp
= DECL_CHAIN (tmp
);
2834 pp_right_brace (buffer
);
2837 /* Return the priority of the operator CODE.
2839 From lowest to highest precedence with either left-to-right (L-R)
2840 or right-to-left (R-L) associativity]:
2843 2 [R-L] = += -= *= /= %= &= ^= |= <<= >>=
2855 14 [R-L] ! ~ ++ -- + - * & (type) sizeof
2856 15 [L-R] fn() [] -> .
2858 unary +, - and * have higher precedence than the corresponding binary
2862 op_code_prio (enum tree_code code
)
2879 case TRUTH_ORIF_EXPR
:
2882 case TRUTH_AND_EXPR
:
2883 case TRUTH_ANDIF_EXPR
:
2890 case TRUTH_XOR_EXPR
:
2907 case UNORDERED_EXPR
:
2918 case VEC_WIDEN_LSHIFT_HI_EXPR
:
2919 case VEC_WIDEN_LSHIFT_LO_EXPR
:
2920 case WIDEN_LSHIFT_EXPR
:
2923 case WIDEN_SUM_EXPR
:
2925 case POINTER_PLUS_EXPR
:
2929 case VEC_WIDEN_MULT_HI_EXPR
:
2930 case VEC_WIDEN_MULT_LO_EXPR
:
2931 case WIDEN_MULT_EXPR
:
2933 case WIDEN_MULT_PLUS_EXPR
:
2934 case WIDEN_MULT_MINUS_EXPR
:
2936 case MULT_HIGHPART_EXPR
:
2937 case TRUNC_DIV_EXPR
:
2939 case FLOOR_DIV_EXPR
:
2940 case ROUND_DIV_EXPR
:
2942 case EXACT_DIV_EXPR
:
2943 case TRUNC_MOD_EXPR
:
2945 case FLOOR_MOD_EXPR
:
2946 case ROUND_MOD_EXPR
:
2950 case TRUTH_NOT_EXPR
:
2952 case POSTINCREMENT_EXPR
:
2953 case POSTDECREMENT_EXPR
:
2954 case PREINCREMENT_EXPR
:
2955 case PREDECREMENT_EXPR
:
2961 case FIX_TRUNC_EXPR
:
2967 case ARRAY_RANGE_REF
:
2971 /* Special expressions. */
2977 case REDUC_MAX_EXPR
:
2978 case REDUC_MIN_EXPR
:
2979 case REDUC_PLUS_EXPR
:
2980 case VEC_LSHIFT_EXPR
:
2981 case VEC_RSHIFT_EXPR
:
2982 case VEC_UNPACK_HI_EXPR
:
2983 case VEC_UNPACK_LO_EXPR
:
2984 case VEC_UNPACK_FLOAT_HI_EXPR
:
2985 case VEC_UNPACK_FLOAT_LO_EXPR
:
2986 case VEC_PACK_TRUNC_EXPR
:
2987 case VEC_PACK_SAT_EXPR
:
2991 /* Return an arbitrarily high precedence to avoid surrounding single
2992 VAR_DECLs in ()s. */
2997 /* Return the priority of the operator OP. */
3000 op_prio (const_tree op
)
3002 enum tree_code code
;
3007 code
= TREE_CODE (op
);
3008 if (code
== SAVE_EXPR
|| code
== NON_LVALUE_EXPR
)
3009 return op_prio (TREE_OPERAND (op
, 0));
3011 return op_code_prio (code
);
3014 /* Return the symbol associated with operator CODE. */
3017 op_symbol_code (enum tree_code code
)
3025 case TRUTH_ORIF_EXPR
:
3028 case TRUTH_AND_EXPR
:
3029 case TRUTH_ANDIF_EXPR
:
3035 case TRUTH_XOR_EXPR
:
3045 case UNORDERED_EXPR
:
3091 case VEC_LSHIFT_EXPR
:
3094 case VEC_RSHIFT_EXPR
:
3097 case WIDEN_LSHIFT_EXPR
:
3100 case POINTER_PLUS_EXPR
:
3106 case REDUC_PLUS_EXPR
:
3109 case WIDEN_SUM_EXPR
:
3112 case WIDEN_MULT_EXPR
:
3115 case MULT_HIGHPART_EXPR
:
3125 case TRUTH_NOT_EXPR
:
3132 case TRUNC_DIV_EXPR
:
3139 case FLOOR_DIV_EXPR
:
3142 case ROUND_DIV_EXPR
:
3145 case EXACT_DIV_EXPR
:
3148 case TRUNC_MOD_EXPR
:
3154 case FLOOR_MOD_EXPR
:
3157 case ROUND_MOD_EXPR
:
3160 case PREDECREMENT_EXPR
:
3163 case PREINCREMENT_EXPR
:
3166 case POSTDECREMENT_EXPR
:
3169 case POSTINCREMENT_EXPR
:
3179 return "<<< ??? >>>";
3183 /* Return the symbol associated with operator OP. */
3186 op_symbol (const_tree op
)
3188 return op_symbol_code (TREE_CODE (op
));
3191 /* Prints the name of a call. NODE is the CALL_EXPR_FN of a CALL_EXPR or
3192 the gimple_call_fn of a GIMPLE_CALL. */
3195 print_call_name (pretty_printer
*buffer
, tree node
, int flags
)
3199 if (TREE_CODE (op0
) == NON_LVALUE_EXPR
)
3200 op0
= TREE_OPERAND (op0
, 0);
3203 switch (TREE_CODE (op0
))
3208 dump_function_name (buffer
, op0
, flags
);
3214 op0
= TREE_OPERAND (op0
, 0);
3218 pp_left_paren (buffer
);
3219 dump_generic_node (buffer
, TREE_OPERAND (op0
, 0), 0, flags
, false);
3220 pp_string (buffer
, ") ? ");
3221 dump_generic_node (buffer
, TREE_OPERAND (op0
, 1), 0, flags
, false);
3222 pp_string (buffer
, " : ");
3223 dump_generic_node (buffer
, TREE_OPERAND (op0
, 2), 0, flags
, false);
3227 if (TREE_CODE (TREE_OPERAND (op0
, 0)) == VAR_DECL
)
3228 dump_function_name (buffer
, TREE_OPERAND (op0
, 0), flags
);
3230 dump_generic_node (buffer
, op0
, 0, flags
, false);
3234 if (integer_zerop (TREE_OPERAND (op0
, 1)))
3236 op0
= TREE_OPERAND (op0
, 0);
3243 dump_generic_node (buffer
, op0
, 0, flags
, false);
3251 /* Parses the string STR and replaces new-lines by '\n', tabs by '\t', ... */
3254 pretty_print_string (pretty_printer
*buffer
, const char *str
)
3264 pp_string (buffer
, "\\b");
3268 pp_string (buffer
, "\\f");
3272 pp_string (buffer
, "\\n");
3276 pp_string (buffer
, "\\r");
3280 pp_string (buffer
, "\\t");
3284 pp_string (buffer
, "\\v");
3288 pp_string (buffer
, "\\\\");
3292 pp_string (buffer
, "\\\"");
3296 pp_string (buffer
, "\\'");
3299 /* No need to handle \0; the loop terminates on \0. */
3302 pp_string (buffer
, "\\1");
3306 pp_string (buffer
, "\\2");
3310 pp_string (buffer
, "\\3");
3314 pp_string (buffer
, "\\4");
3318 pp_string (buffer
, "\\5");
3322 pp_string (buffer
, "\\6");
3326 pp_string (buffer
, "\\7");
3330 pp_character (buffer
, str
[0]);
3338 maybe_init_pretty_print (FILE *file
)
3342 new (&buffer
) pretty_printer ();
3343 pp_needs_newline (&buffer
) = true;
3344 pp_translate_identifiers (&buffer
) = false;
3348 buffer
.buffer
->stream
= file
;
3352 newline_and_indent (pretty_printer
*buffer
, int spc
)
3354 pp_newline (buffer
);
3358 /* Handle a %K format for TEXT. Separate from default_tree_printer so
3359 it can also be used in front ends.
3360 %K: a statement, from which EXPR_LOCATION and TREE_BLOCK will be recorded.
3364 percent_K_format (text_info
*text
)
3366 tree t
= va_arg (*text
->args_ptr
, tree
), block
;
3367 gcc_assert (text
->locus
!= NULL
);
3368 *text
->locus
= EXPR_LOCATION (t
);
3369 gcc_assert (pp_ti_abstract_origin (text
) != NULL
);
3370 block
= TREE_BLOCK (t
);
3371 *pp_ti_abstract_origin (text
) = NULL
;
3375 /* ??? LTO drops all BLOCK_ABSTRACT_ORIGINs apart from those
3376 representing the outermost block of an inlined function.
3377 So walk the BLOCK tree until we hit such a scope. */
3379 && TREE_CODE (block
) == BLOCK
)
3381 if (inlined_function_outer_scope_p (block
))
3383 *pp_ti_abstract_origin (text
) = block
;
3386 block
= BLOCK_SUPERCONTEXT (block
);
3392 && TREE_CODE (block
) == BLOCK
3393 && BLOCK_ABSTRACT_ORIGIN (block
))
3395 tree ao
= BLOCK_ABSTRACT_ORIGIN (block
);
3397 while (TREE_CODE (ao
) == BLOCK
3398 && BLOCK_ABSTRACT_ORIGIN (ao
)
3399 && BLOCK_ABSTRACT_ORIGIN (ao
) != ao
)
3400 ao
= BLOCK_ABSTRACT_ORIGIN (ao
);
3402 if (TREE_CODE (ao
) == FUNCTION_DECL
)
3404 *pp_ti_abstract_origin (text
) = block
;
3407 block
= BLOCK_SUPERCONTEXT (block
);
3411 /* Print the identifier ID to PRETTY-PRINTER. */
3414 pp_tree_identifier (pretty_printer
*pp
, tree id
)
3416 if (pp_translate_identifiers (pp
))
3418 const char *text
= identifier_to_locale (IDENTIFIER_POINTER (id
));
3419 pp_append_text (pp
, text
, text
+ strlen (text
));
3422 pp_append_text (pp
, IDENTIFIER_POINTER (id
),
3423 IDENTIFIER_POINTER (id
) + IDENTIFIER_LENGTH (id
));
3426 /* A helper function that is used to dump function information before the
3430 dump_function_header (FILE *dump_file
, tree fdecl
, int flags
)
3432 const char *dname
, *aname
;
3433 struct cgraph_node
*node
= cgraph_get_node (fdecl
);
3434 struct function
*fun
= DECL_STRUCT_FUNCTION (fdecl
);
3436 dname
= lang_hooks
.decl_printable_name (fdecl
, 2);
3438 if (DECL_ASSEMBLER_NAME_SET_P (fdecl
))
3439 aname
= (IDENTIFIER_POINTER
3440 (DECL_ASSEMBLER_NAME (fdecl
)));
3442 aname
= "<unset-asm-name>";
3444 fprintf (dump_file
, "\n;; Function %s (%s, funcdef_no=%d",
3445 dname
, aname
, fun
->funcdef_no
);
3446 if (!(flags
& TDF_NOUID
))
3447 fprintf (dump_file
, ", decl_uid=%d", DECL_UID (fdecl
));
3450 fprintf (dump_file
, ", symbol_order=%d)%s\n\n", node
->order
,
3451 node
->frequency
== NODE_FREQUENCY_HOT
3453 : node
->frequency
== NODE_FREQUENCY_UNLIKELY_EXECUTED
3454 ? " (unlikely executed)"
3455 : node
->frequency
== NODE_FREQUENCY_EXECUTED_ONCE
3456 ? " (executed once)"
3460 fprintf (dump_file
, ")\n\n");
3463 /* Dump double_int D to pretty_printer PP. UNS is true
3464 if D is unsigned and false otherwise. */
3466 pp_double_int (pretty_printer
*pp
, double_int d
, bool uns
)
3469 pp_wide_integer (pp
, d
.low
);
3470 else if (d
.fits_uhwi ())
3471 pp_unsigned_wide_integer (pp
, d
.low
);
3472 else if (HOST_BITS_PER_DOUBLE_INT
== HOST_BITS_PER_WIDEST_INT
)
3475 ? HOST_WIDEST_INT_PRINT_UNSIGNED
: HOST_WIDEST_INT_PRINT_DEC
,
3476 (HOST_WIDEST_INT
) ((((unsigned HOST_WIDEST_INT
) d
.high
<< 1)
3477 << (HOST_BITS_PER_WIDE_INT
- 1)) | d
.low
));
3480 unsigned HOST_WIDE_INT low
= d
.low
;
3481 HOST_WIDE_INT high
= d
.high
;
3482 if (!uns
&& d
.is_negative ())
3485 high
= ~high
+ !low
;
3488 /* Would "%x%0*x" or "%x%*0x" get zero-padding on all
3490 sprintf (pp_buffer (pp
)->digit_buffer
,
3491 HOST_WIDE_INT_PRINT_DOUBLE_HEX
,
3492 (unsigned HOST_WIDE_INT
) high
, low
);
3493 pp_string (pp
, pp_buffer (pp
)->digit_buffer
);