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 pp_string (buffer
, "to");
504 case OMP_CLAUSE_MAP_FROM
:
505 pp_string (buffer
, "from");
507 case OMP_CLAUSE_MAP_TOFROM
:
508 pp_string (buffer
, "tofrom");
514 dump_generic_node (buffer
, OMP_CLAUSE_DECL (clause
),
517 if (OMP_CLAUSE_SIZE (clause
))
519 if (OMP_CLAUSE_CODE (clause
) == OMP_CLAUSE_MAP
520 && OMP_CLAUSE_MAP_KIND (clause
) == OMP_CLAUSE_MAP_POINTER
)
521 pp_string (buffer
, " [pointer assign, bias: ");
523 pp_string (buffer
, " [len: ");
524 dump_generic_node (buffer
, OMP_CLAUSE_SIZE (clause
),
526 pp_right_bracket (buffer
);
528 pp_right_paren (buffer
);
531 case OMP_CLAUSE_FROM
:
532 pp_string (buffer
, "from(");
533 dump_generic_node (buffer
, OMP_CLAUSE_DECL (clause
),
535 goto print_clause_size
;
538 pp_string (buffer
, "to(");
539 dump_generic_node (buffer
, OMP_CLAUSE_DECL (clause
),
541 goto print_clause_size
;
543 case OMP_CLAUSE_NUM_TEAMS
:
544 pp_string (buffer
, "num_teams(");
545 dump_generic_node (buffer
, OMP_CLAUSE_NUM_TEAMS_EXPR (clause
),
547 pp_right_paren (buffer
);
550 case OMP_CLAUSE_THREAD_LIMIT
:
551 pp_string (buffer
, "thread_limit(");
552 dump_generic_node (buffer
, OMP_CLAUSE_THREAD_LIMIT_EXPR (clause
),
554 pp_right_paren (buffer
);
557 case OMP_CLAUSE_DEVICE
:
558 pp_string (buffer
, "device(");
559 dump_generic_node (buffer
, OMP_CLAUSE_DEVICE_ID (clause
),
561 pp_right_paren (buffer
);
564 case OMP_CLAUSE_DIST_SCHEDULE
:
565 pp_string (buffer
, "dist_schedule(static");
566 if (OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR (clause
))
569 dump_generic_node (buffer
,
570 OMP_CLAUSE_DIST_SCHEDULE_CHUNK_EXPR (clause
),
573 pp_right_paren (buffer
);
576 case OMP_CLAUSE_PROC_BIND
:
577 pp_string (buffer
, "proc_bind(");
578 switch (OMP_CLAUSE_PROC_BIND_KIND (clause
))
580 case OMP_CLAUSE_PROC_BIND_MASTER
:
581 pp_string (buffer
, "master");
583 case OMP_CLAUSE_PROC_BIND_CLOSE
:
584 pp_string (buffer
, "close");
586 case OMP_CLAUSE_PROC_BIND_SPREAD
:
587 pp_string (buffer
, "spread");
592 pp_right_paren (buffer
);
595 case OMP_CLAUSE_SAFELEN
:
596 pp_string (buffer
, "safelen(");
597 dump_generic_node (buffer
, OMP_CLAUSE_SAFELEN_EXPR (clause
),
599 pp_right_paren (buffer
);
602 case OMP_CLAUSE_SIMDLEN
:
603 pp_string (buffer
, "simdlen(");
604 dump_generic_node (buffer
, OMP_CLAUSE_SIMDLEN_EXPR (clause
),
606 pp_right_paren (buffer
);
609 case OMP_CLAUSE__SIMDUID_
:
610 pp_string (buffer
, "_simduid_(");
611 dump_generic_node (buffer
, OMP_CLAUSE__SIMDUID__DECL (clause
),
613 pp_right_paren (buffer
);
616 case OMP_CLAUSE_INBRANCH
:
617 pp_string (buffer
, "inbranch");
619 case OMP_CLAUSE_NOTINBRANCH
:
620 pp_string (buffer
, "notinbranch");
623 pp_string (buffer
, "for");
625 case OMP_CLAUSE_PARALLEL
:
626 pp_string (buffer
, "parallel");
628 case OMP_CLAUSE_SECTIONS
:
629 pp_string (buffer
, "sections");
631 case OMP_CLAUSE_TASKGROUP
:
632 pp_string (buffer
, "taskgroup");
636 /* Should never happen. */
637 dump_generic_node (buffer
, clause
, spc
, flags
, false);
643 /* Dump the list of OpenMP clauses. BUFFER, SPC and FLAGS are as in
644 dump_generic_node. */
647 dump_omp_clauses (pretty_printer
*buffer
, tree clause
, int spc
, int flags
)
655 dump_omp_clause (buffer
, clause
, spc
, flags
);
656 clause
= OMP_CLAUSE_CHAIN (clause
);
664 /* Dump location LOC to BUFFER. */
667 dump_location (pretty_printer
*buffer
, location_t loc
)
669 expanded_location xloc
= expand_location (loc
);
671 pp_left_bracket (buffer
);
674 pp_string (buffer
, xloc
.file
);
675 pp_string (buffer
, " : ");
677 pp_decimal_int (buffer
, xloc
.line
);
678 pp_string (buffer
, "] ");
682 /* Dump lexical block BLOCK. BUFFER, SPC and FLAGS are as in
683 dump_generic_node. */
686 dump_block_node (pretty_printer
*buffer
, tree block
, int spc
, int flags
)
690 pp_printf (buffer
, "BLOCK #%d ", BLOCK_NUMBER (block
));
692 if (flags
& TDF_ADDRESS
)
693 pp_printf (buffer
, "[%p] ", (void *) block
);
695 if (BLOCK_ABSTRACT (block
))
696 pp_string (buffer
, "[abstract] ");
698 if (TREE_ASM_WRITTEN (block
))
699 pp_string (buffer
, "[written] ");
701 if (flags
& TDF_SLIM
)
704 if (BLOCK_SOURCE_LOCATION (block
))
705 dump_location (buffer
, BLOCK_SOURCE_LOCATION (block
));
707 newline_and_indent (buffer
, spc
+ 2);
709 if (BLOCK_SUPERCONTEXT (block
))
711 pp_string (buffer
, "SUPERCONTEXT: ");
712 dump_generic_node (buffer
, BLOCK_SUPERCONTEXT (block
), 0,
713 flags
| TDF_SLIM
, false);
714 newline_and_indent (buffer
, spc
+ 2);
717 if (BLOCK_SUBBLOCKS (block
))
719 pp_string (buffer
, "SUBBLOCKS: ");
720 for (t
= BLOCK_SUBBLOCKS (block
); t
; t
= BLOCK_CHAIN (t
))
722 dump_generic_node (buffer
, t
, 0, flags
| TDF_SLIM
, false);
725 newline_and_indent (buffer
, spc
+ 2);
728 if (BLOCK_CHAIN (block
))
730 pp_string (buffer
, "SIBLINGS: ");
731 for (t
= BLOCK_CHAIN (block
); t
; t
= BLOCK_CHAIN (t
))
733 dump_generic_node (buffer
, t
, 0, flags
| TDF_SLIM
, false);
736 newline_and_indent (buffer
, spc
+ 2);
739 if (BLOCK_VARS (block
))
741 pp_string (buffer
, "VARS: ");
742 for (t
= BLOCK_VARS (block
); t
; t
= TREE_CHAIN (t
))
744 dump_generic_node (buffer
, t
, 0, flags
, false);
747 newline_and_indent (buffer
, spc
+ 2);
750 if (vec_safe_length (BLOCK_NONLOCALIZED_VARS (block
)) > 0)
753 vec
<tree
, va_gc
> *nlv
= BLOCK_NONLOCALIZED_VARS (block
);
755 pp_string (buffer
, "NONLOCALIZED_VARS: ");
756 FOR_EACH_VEC_ELT (*nlv
, i
, t
)
758 dump_generic_node (buffer
, t
, 0, flags
, false);
761 newline_and_indent (buffer
, spc
+ 2);
764 if (BLOCK_ABSTRACT_ORIGIN (block
))
766 pp_string (buffer
, "ABSTRACT_ORIGIN: ");
767 dump_generic_node (buffer
, BLOCK_ABSTRACT_ORIGIN (block
), 0,
768 flags
| TDF_SLIM
, false);
769 newline_and_indent (buffer
, spc
+ 2);
772 if (BLOCK_FRAGMENT_ORIGIN (block
))
774 pp_string (buffer
, "FRAGMENT_ORIGIN: ");
775 dump_generic_node (buffer
, BLOCK_FRAGMENT_ORIGIN (block
), 0,
776 flags
| TDF_SLIM
, false);
777 newline_and_indent (buffer
, spc
+ 2);
780 if (BLOCK_FRAGMENT_CHAIN (block
))
782 pp_string (buffer
, "FRAGMENT_CHAIN: ");
783 for (t
= BLOCK_FRAGMENT_CHAIN (block
); t
; t
= BLOCK_FRAGMENT_CHAIN (t
))
785 dump_generic_node (buffer
, t
, 0, flags
| TDF_SLIM
, false);
788 newline_and_indent (buffer
, spc
+ 2);
793 /* Dump the node NODE on the pretty_printer BUFFER, SPC spaces of
794 indent. FLAGS specifies details to show in the dump (see TDF_* in
795 dumpfile.h). If IS_STMT is true, the object printed is considered
796 to be a statement and it is terminated by ';' if appropriate. */
799 dump_generic_node (pretty_printer
*buffer
, tree node
, int spc
, int flags
,
808 if (node
== NULL_TREE
)
811 is_expr
= EXPR_P (node
);
813 if (is_stmt
&& (flags
& TDF_STMTADDR
))
814 pp_printf (buffer
, "<&%p> ", (void *)node
);
816 if ((flags
& TDF_LINENO
) && EXPR_HAS_LOCATION (node
))
817 dump_location (buffer
, EXPR_LOCATION (node
));
819 code
= TREE_CODE (node
);
823 pp_string (buffer
, "<<< error >>>");
826 case IDENTIFIER_NODE
:
827 pp_tree_identifier (buffer
, node
);
831 while (node
&& node
!= error_mark_node
)
833 if (TREE_PURPOSE (node
))
835 dump_generic_node (buffer
, TREE_PURPOSE (node
), spc
, flags
, false);
838 dump_generic_node (buffer
, TREE_VALUE (node
), spc
, flags
, false);
839 node
= TREE_CHAIN (node
);
840 if (node
&& TREE_CODE (node
) == TREE_LIST
)
849 dump_generic_node (buffer
, BINFO_TYPE (node
), spc
, flags
, false);
855 if (TREE_VEC_LENGTH (node
) > 0)
857 size_t len
= TREE_VEC_LENGTH (node
);
858 for (i
= 0; i
< len
- 1; i
++)
860 dump_generic_node (buffer
, TREE_VEC_ELT (node
, i
), spc
, flags
,
865 dump_generic_node (buffer
, TREE_VEC_ELT (node
, len
- 1), spc
,
874 case FIXED_POINT_TYPE
:
880 unsigned int quals
= TYPE_QUALS (node
);
881 enum tree_code_class tclass
;
883 if (quals
& TYPE_QUAL_ATOMIC
)
884 pp_string (buffer
, "atomic ");
885 if (quals
& TYPE_QUAL_CONST
)
886 pp_string (buffer
, "const ");
887 else if (quals
& TYPE_QUAL_VOLATILE
)
888 pp_string (buffer
, "volatile ");
889 else if (quals
& TYPE_QUAL_RESTRICT
)
890 pp_string (buffer
, "restrict ");
892 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
894 pp_string (buffer
, "<address-space-");
895 pp_decimal_int (buffer
, TYPE_ADDR_SPACE (node
));
896 pp_string (buffer
, "> ");
899 tclass
= TREE_CODE_CLASS (TREE_CODE (node
));
901 if (tclass
== tcc_declaration
)
903 if (DECL_NAME (node
))
904 dump_decl_name (buffer
, node
, flags
);
906 pp_string (buffer
, "<unnamed type decl>");
908 else if (tclass
== tcc_type
)
910 if (TYPE_NAME (node
))
912 if (TREE_CODE (TYPE_NAME (node
)) == IDENTIFIER_NODE
)
913 pp_tree_identifier (buffer
, TYPE_NAME (node
));
914 else if (TREE_CODE (TYPE_NAME (node
)) == TYPE_DECL
915 && DECL_NAME (TYPE_NAME (node
)))
916 dump_decl_name (buffer
, TYPE_NAME (node
), flags
);
918 pp_string (buffer
, "<unnamed type>");
920 else if (TREE_CODE (node
) == VECTOR_TYPE
)
922 pp_string (buffer
, "vector");
923 pp_left_paren (buffer
);
924 pp_wide_integer (buffer
, TYPE_VECTOR_SUBPARTS (node
));
925 pp_string (buffer
, ") ");
926 dump_generic_node (buffer
, TREE_TYPE (node
), spc
, flags
, false);
928 else if (TREE_CODE (node
) == INTEGER_TYPE
)
930 if (TYPE_PRECISION (node
) == CHAR_TYPE_SIZE
)
931 pp_string (buffer
, (TYPE_UNSIGNED (node
)
934 else if (TYPE_PRECISION (node
) == SHORT_TYPE_SIZE
)
935 pp_string (buffer
, (TYPE_UNSIGNED (node
)
938 else if (TYPE_PRECISION (node
) == INT_TYPE_SIZE
)
939 pp_string (buffer
, (TYPE_UNSIGNED (node
)
942 else if (TYPE_PRECISION (node
) == LONG_TYPE_SIZE
)
943 pp_string (buffer
, (TYPE_UNSIGNED (node
)
946 else if (TYPE_PRECISION (node
) == LONG_LONG_TYPE_SIZE
)
947 pp_string (buffer
, (TYPE_UNSIGNED (node
)
948 ? "unsigned long long"
949 : "signed long long"));
950 else if (TYPE_PRECISION (node
) >= CHAR_TYPE_SIZE
951 && exact_log2 (TYPE_PRECISION (node
)) != -1)
953 pp_string (buffer
, (TYPE_UNSIGNED (node
) ? "uint" : "int"));
954 pp_decimal_int (buffer
, TYPE_PRECISION (node
));
955 pp_string (buffer
, "_t");
959 pp_string (buffer
, (TYPE_UNSIGNED (node
)
960 ? "<unnamed-unsigned:"
961 : "<unnamed-signed:"));
962 pp_decimal_int (buffer
, TYPE_PRECISION (node
));
966 else if (TREE_CODE (node
) == COMPLEX_TYPE
)
968 pp_string (buffer
, "__complex__ ");
969 dump_generic_node (buffer
, TREE_TYPE (node
), spc
, flags
, false);
971 else if (TREE_CODE (node
) == REAL_TYPE
)
973 pp_string (buffer
, "<float:");
974 pp_decimal_int (buffer
, TYPE_PRECISION (node
));
977 else if (TREE_CODE (node
) == FIXED_POINT_TYPE
)
979 pp_string (buffer
, "<fixed-point-");
980 pp_string (buffer
, TYPE_SATURATING (node
) ? "sat:" : "nonsat:");
981 pp_decimal_int (buffer
, TYPE_PRECISION (node
));
984 else if (TREE_CODE (node
) == VOID_TYPE
)
985 pp_string (buffer
, "void");
987 pp_string (buffer
, "<unnamed type>");
994 str
= (TREE_CODE (node
) == POINTER_TYPE
? "*" : "&");
996 if (TREE_TYPE (node
) == NULL
)
998 pp_string (buffer
, str
);
999 pp_string (buffer
, "<null type>");
1001 else if (TREE_CODE (TREE_TYPE (node
)) == FUNCTION_TYPE
)
1003 tree fnode
= TREE_TYPE (node
);
1005 dump_generic_node (buffer
, TREE_TYPE (fnode
), spc
, flags
, false);
1007 pp_left_paren (buffer
);
1008 pp_string (buffer
, str
);
1009 if (TYPE_NAME (node
) && DECL_NAME (TYPE_NAME (node
)))
1010 dump_decl_name (buffer
, TYPE_NAME (node
), flags
);
1011 else if (flags
& TDF_NOUID
)
1012 pp_printf (buffer
, "<Txxxx>");
1014 pp_printf (buffer
, "<T%x>", TYPE_UID (node
));
1016 pp_right_paren (buffer
);
1017 dump_function_declaration (buffer
, fnode
, spc
, flags
);
1021 unsigned int quals
= TYPE_QUALS (node
);
1023 dump_generic_node (buffer
, TREE_TYPE (node
), spc
, flags
, false);
1025 pp_string (buffer
, str
);
1027 if (quals
& TYPE_QUAL_CONST
)
1028 pp_string (buffer
, " const");
1029 if (quals
& TYPE_QUAL_VOLATILE
)
1030 pp_string (buffer
, " volatile");
1031 if (quals
& TYPE_QUAL_RESTRICT
)
1032 pp_string (buffer
, " restrict");
1034 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
1036 pp_string (buffer
, " <address-space-");
1037 pp_decimal_int (buffer
, TYPE_ADDR_SPACE (node
));
1038 pp_greater (buffer
);
1041 if (TYPE_REF_CAN_ALIAS_ALL (node
))
1042 pp_string (buffer
, " {ref-all}");
1052 if (integer_zerop (TREE_OPERAND (node
, 1))
1053 /* Dump the types of INTEGER_CSTs explicitly, for we can't
1054 infer them and MEM_ATTR caching will share MEM_REFs
1055 with differently-typed op0s. */
1056 && TREE_CODE (TREE_OPERAND (node
, 0)) != INTEGER_CST
1057 /* Released SSA_NAMES have no TREE_TYPE. */
1058 && TREE_TYPE (TREE_OPERAND (node
, 0)) != NULL_TREE
1059 /* Same pointer types, but ignoring POINTER_TYPE vs.
1061 && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 0)))
1062 == TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 1))))
1063 && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (node
, 0)))
1064 == TYPE_MODE (TREE_TYPE (TREE_OPERAND (node
, 1))))
1065 && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node
, 0)))
1066 == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node
, 1))))
1067 /* Same value types ignoring qualifiers. */
1068 && (TYPE_MAIN_VARIANT (TREE_TYPE (node
))
1069 == TYPE_MAIN_VARIANT
1070 (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 1))))))
1072 if (TREE_CODE (TREE_OPERAND (node
, 0)) != ADDR_EXPR
)
1075 dump_generic_node (buffer
, TREE_OPERAND (node
, 0),
1079 dump_generic_node (buffer
,
1080 TREE_OPERAND (TREE_OPERAND (node
, 0), 0),
1087 pp_string (buffer
, "MEM[");
1088 pp_left_paren (buffer
);
1089 ptype
= TYPE_MAIN_VARIANT (TREE_TYPE (TREE_OPERAND (node
, 1)));
1090 dump_generic_node (buffer
, ptype
,
1091 spc
, flags
| TDF_SLIM
, false);
1092 pp_right_paren (buffer
);
1093 dump_generic_node (buffer
, TREE_OPERAND (node
, 0),
1095 if (!integer_zerop (TREE_OPERAND (node
, 1)))
1097 pp_string (buffer
, " + ");
1098 dump_generic_node (buffer
, TREE_OPERAND (node
, 1),
1101 pp_right_bracket (buffer
);
1106 case TARGET_MEM_REF
:
1108 const char *sep
= "";
1111 pp_string (buffer
, "MEM[");
1113 if (TREE_CODE (TMR_BASE (node
)) == ADDR_EXPR
)
1115 pp_string (buffer
, sep
);
1117 pp_string (buffer
, "symbol: ");
1118 dump_generic_node (buffer
, TREE_OPERAND (TMR_BASE (node
), 0),
1123 pp_string (buffer
, sep
);
1125 pp_string (buffer
, "base: ");
1126 dump_generic_node (buffer
, TMR_BASE (node
), spc
, flags
, false);
1128 tmp
= TMR_INDEX2 (node
);
1131 pp_string (buffer
, sep
);
1133 pp_string (buffer
, "base: ");
1134 dump_generic_node (buffer
, tmp
, spc
, flags
, false);
1136 tmp
= TMR_INDEX (node
);
1139 pp_string (buffer
, sep
);
1141 pp_string (buffer
, "index: ");
1142 dump_generic_node (buffer
, tmp
, spc
, flags
, false);
1144 tmp
= TMR_STEP (node
);
1147 pp_string (buffer
, sep
);
1149 pp_string (buffer
, "step: ");
1150 dump_generic_node (buffer
, tmp
, spc
, flags
, false);
1152 tmp
= TMR_OFFSET (node
);
1155 pp_string (buffer
, sep
);
1157 pp_string (buffer
, "offset: ");
1158 dump_generic_node (buffer
, tmp
, spc
, flags
, false);
1160 pp_right_bracket (buffer
);
1168 /* Print the innermost component type. */
1169 for (tmp
= TREE_TYPE (node
); TREE_CODE (tmp
) == ARRAY_TYPE
;
1170 tmp
= TREE_TYPE (tmp
))
1172 dump_generic_node (buffer
, tmp
, spc
, flags
, false);
1174 /* Print the dimensions. */
1175 for (tmp
= node
; TREE_CODE (tmp
) == ARRAY_TYPE
; tmp
= TREE_TYPE (tmp
))
1176 dump_array_domain (buffer
, TYPE_DOMAIN (tmp
), spc
, flags
);
1182 case QUAL_UNION_TYPE
:
1184 unsigned int quals
= TYPE_QUALS (node
);
1186 if (quals
& TYPE_QUAL_ATOMIC
)
1187 pp_string (buffer
, "atomic ");
1188 if (quals
& TYPE_QUAL_CONST
)
1189 pp_string (buffer
, "const ");
1190 if (quals
& TYPE_QUAL_VOLATILE
)
1191 pp_string (buffer
, "volatile ");
1193 /* Print the name of the structure. */
1194 if (TREE_CODE (node
) == RECORD_TYPE
)
1195 pp_string (buffer
, "struct ");
1196 else if (TREE_CODE (node
) == UNION_TYPE
)
1197 pp_string (buffer
, "union ");
1199 if (TYPE_NAME (node
))
1200 dump_generic_node (buffer
, TYPE_NAME (node
), spc
, flags
, false);
1201 else if (!(flags
& TDF_SLIM
))
1202 /* FIXME: If we eliminate the 'else' above and attempt
1203 to show the fields for named types, we may get stuck
1204 following a cycle of pointers to structs. The alleged
1205 self-reference check in print_struct_decl will not detect
1206 cycles involving more than one pointer or struct type. */
1207 print_struct_decl (buffer
, node
, spc
, flags
);
1216 if (TREE_CODE (TREE_TYPE (node
)) == POINTER_TYPE
)
1218 /* In the case of a pointer, one may want to divide by the
1219 size of the pointed-to type. Unfortunately, this not
1220 straightforward. The C front-end maps expressions
1225 in such a way that the two INTEGER_CST nodes for "5" have
1226 different values but identical types. In the latter
1227 case, the 5 is multiplied by sizeof (int) in c-common.c
1228 (pointer_int_sum) to convert it to a byte address, and
1229 yet the type of the node is left unchanged. Argh. What
1230 is consistent though is that the number value corresponds
1231 to bytes (UNITS) offset.
1233 NB: Neither of the following divisors can be trivially
1234 used to recover the original literal:
1236 TREE_INT_CST_LOW (TYPE_SIZE_UNIT (TREE_TYPE (node)))
1237 TYPE_PRECISION (TREE_TYPE (TREE_TYPE (node))) */
1238 pp_wide_integer (buffer
, TREE_INT_CST_LOW (node
));
1239 pp_string (buffer
, "B"); /* pseudo-unit */
1242 pp_double_int (buffer
, tree_to_double_int (node
),
1243 TYPE_UNSIGNED (TREE_TYPE (node
)));
1244 if (TREE_OVERFLOW (node
))
1245 pp_string (buffer
, "(OVF)");
1249 /* Code copied from print_node. */
1252 if (TREE_OVERFLOW (node
))
1253 pp_string (buffer
, " overflow");
1255 #if !defined(REAL_IS_NOT_DOUBLE) || defined(REAL_ARITHMETIC)
1256 d
= TREE_REAL_CST (node
);
1257 if (REAL_VALUE_ISINF (d
))
1258 pp_string (buffer
, REAL_VALUE_NEGATIVE (d
) ? " -Inf" : " Inf");
1259 else if (REAL_VALUE_ISNAN (d
))
1260 pp_string (buffer
, " Nan");
1264 real_to_decimal (string
, &d
, sizeof (string
), 0, 1);
1265 pp_string (buffer
, string
);
1270 unsigned char *p
= (unsigned char *) &TREE_REAL_CST (node
);
1271 pp_string (buffer
, "0x");
1272 for (i
= 0; i
< sizeof TREE_REAL_CST (node
); i
++)
1273 output_formatted_integer (buffer
, "%02x", *p
++);
1282 fixed_to_decimal (string
, TREE_FIXED_CST_PTR (node
), sizeof (string
));
1283 pp_string (buffer
, string
);
1288 pp_string (buffer
, "__complex__ (");
1289 dump_generic_node (buffer
, TREE_REALPART (node
), spc
, flags
, false);
1290 pp_string (buffer
, ", ");
1291 dump_generic_node (buffer
, TREE_IMAGPART (node
), spc
, flags
, false);
1292 pp_right_paren (buffer
);
1296 pp_string (buffer
, "\"");
1297 pretty_print_string (buffer
, TREE_STRING_POINTER (node
));
1298 pp_string (buffer
, "\"");
1304 pp_string (buffer
, "{ ");
1305 for (i
= 0; i
< VECTOR_CST_NELTS (node
); ++i
)
1308 pp_string (buffer
, ", ");
1309 dump_generic_node (buffer
, VECTOR_CST_ELT (node
, i
),
1312 pp_string (buffer
, " }");
1318 dump_generic_node (buffer
, TREE_TYPE (node
), spc
, flags
, false);
1320 if (TREE_CODE (node
) == METHOD_TYPE
)
1322 if (TYPE_METHOD_BASETYPE (node
))
1323 dump_decl_name (buffer
, TYPE_NAME (TYPE_METHOD_BASETYPE (node
)),
1326 pp_string (buffer
, "<null method basetype>");
1327 pp_colon_colon (buffer
);
1329 if (TYPE_NAME (node
) && DECL_NAME (TYPE_NAME (node
)))
1330 dump_decl_name (buffer
, TYPE_NAME (node
), flags
);
1331 else if (flags
& TDF_NOUID
)
1332 pp_printf (buffer
, "<Txxxx>");
1334 pp_printf (buffer
, "<T%x>", TYPE_UID (node
));
1335 dump_function_declaration (buffer
, node
, spc
, flags
);
1340 dump_decl_name (buffer
, node
, flags
);
1344 if (DECL_NAME (node
))
1345 dump_decl_name (buffer
, node
, flags
);
1346 else if (LABEL_DECL_UID (node
) != -1)
1347 pp_printf (buffer
, "<L%d>", (int) LABEL_DECL_UID (node
));
1350 if (flags
& TDF_NOUID
)
1351 pp_string (buffer
, "<D.xxxx>");
1353 pp_printf (buffer
, "<D.%u>", DECL_UID (node
));
1358 if (DECL_IS_BUILTIN (node
))
1360 /* Don't print the declaration of built-in types. */
1363 if (DECL_NAME (node
))
1364 dump_decl_name (buffer
, node
, flags
);
1365 else if (TYPE_NAME (TREE_TYPE (node
)) != node
)
1367 if ((TREE_CODE (TREE_TYPE (node
)) == RECORD_TYPE
1368 || TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
)
1369 && TYPE_METHODS (TREE_TYPE (node
)))
1371 /* The type is a c++ class: all structures have at least
1373 pp_string (buffer
, "class ");
1374 dump_generic_node (buffer
, TREE_TYPE (node
), spc
, flags
, false);
1379 (TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
1380 ? "union" : "struct "));
1381 dump_generic_node (buffer
, TREE_TYPE (node
), spc
, flags
, false);
1385 pp_string (buffer
, "<anon>");
1391 case DEBUG_EXPR_DECL
:
1392 case NAMESPACE_DECL
:
1394 dump_decl_name (buffer
, node
, flags
);
1398 pp_string (buffer
, "<retval>");
1402 op0
= TREE_OPERAND (node
, 0);
1405 && (TREE_CODE (op0
) == INDIRECT_REF
1406 || (TREE_CODE (op0
) == MEM_REF
1407 && TREE_CODE (TREE_OPERAND (op0
, 0)) != ADDR_EXPR
1408 && integer_zerop (TREE_OPERAND (op0
, 1))
1409 /* Dump the types of INTEGER_CSTs explicitly, for we
1410 can't infer them and MEM_ATTR caching will share
1411 MEM_REFs with differently-typed op0s. */
1412 && TREE_CODE (TREE_OPERAND (op0
, 0)) != INTEGER_CST
1413 /* Released SSA_NAMES have no TREE_TYPE. */
1414 && TREE_TYPE (TREE_OPERAND (op0
, 0)) != NULL_TREE
1415 /* Same pointer types, but ignoring POINTER_TYPE vs.
1417 && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 0)))
1418 == TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 1))))
1419 && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0
, 0)))
1420 == TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0
, 1))))
1421 && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0
, 0)))
1422 == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0
, 1))))
1423 /* Same value types ignoring qualifiers. */
1424 && (TYPE_MAIN_VARIANT (TREE_TYPE (op0
))
1425 == TYPE_MAIN_VARIANT
1426 (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 1))))))))
1428 op0
= TREE_OPERAND (op0
, 0);
1431 if (op_prio (op0
) < op_prio (node
))
1432 pp_left_paren (buffer
);
1433 dump_generic_node (buffer
, op0
, spc
, flags
, false);
1434 if (op_prio (op0
) < op_prio (node
))
1435 pp_right_paren (buffer
);
1436 pp_string (buffer
, str
);
1437 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1438 op0
= component_ref_field_offset (node
);
1439 if (op0
&& TREE_CODE (op0
) != INTEGER_CST
)
1441 pp_string (buffer
, "{off: ");
1442 dump_generic_node (buffer
, op0
, spc
, flags
, false);
1443 pp_right_brace (buffer
);
1448 pp_string (buffer
, "BIT_FIELD_REF <");
1449 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1450 pp_string (buffer
, ", ");
1451 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1452 pp_string (buffer
, ", ");
1453 dump_generic_node (buffer
, TREE_OPERAND (node
, 2), spc
, flags
, false);
1454 pp_greater (buffer
);
1458 case ARRAY_RANGE_REF
:
1459 op0
= TREE_OPERAND (node
, 0);
1460 if (op_prio (op0
) < op_prio (node
))
1461 pp_left_paren (buffer
);
1462 dump_generic_node (buffer
, op0
, spc
, flags
, false);
1463 if (op_prio (op0
) < op_prio (node
))
1464 pp_right_paren (buffer
);
1465 pp_left_bracket (buffer
);
1466 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1467 if (TREE_CODE (node
) == ARRAY_RANGE_REF
)
1468 pp_string (buffer
, " ...");
1469 pp_right_bracket (buffer
);
1471 op0
= array_ref_low_bound (node
);
1472 op1
= array_ref_element_size (node
);
1474 if (!integer_zerop (op0
)
1475 || TREE_OPERAND (node
, 2)
1476 || TREE_OPERAND (node
, 3))
1478 pp_string (buffer
, "{lb: ");
1479 dump_generic_node (buffer
, op0
, spc
, flags
, false);
1480 pp_string (buffer
, " sz: ");
1481 dump_generic_node (buffer
, op1
, spc
, flags
, false);
1482 pp_right_brace (buffer
);
1488 unsigned HOST_WIDE_INT ix
;
1490 bool is_struct_init
= false;
1491 bool is_array_init
= false;
1492 double_int curidx
= double_int_zero
;
1493 pp_left_brace (buffer
);
1494 if (TREE_CLOBBER_P (node
))
1495 pp_string (buffer
, "CLOBBER");
1496 else if (TREE_CODE (TREE_TYPE (node
)) == RECORD_TYPE
1497 || TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
)
1498 is_struct_init
= true;
1499 else if (TREE_CODE (TREE_TYPE (node
)) == ARRAY_TYPE
1500 && TYPE_DOMAIN (TREE_TYPE (node
))
1501 && TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
)))
1502 && TREE_CODE (TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
))))
1505 tree minv
= TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
)));
1506 is_array_init
= true;
1507 curidx
= tree_to_double_int (minv
);
1509 FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (node
), ix
, field
, val
)
1516 dump_generic_node (buffer
, field
, spc
, flags
, false);
1519 else if (is_array_init
1520 && (TREE_CODE (field
) != INTEGER_CST
1521 || tree_to_double_int (field
) != curidx
))
1523 pp_left_bracket (buffer
);
1524 if (TREE_CODE (field
) == RANGE_EXPR
)
1526 dump_generic_node (buffer
, TREE_OPERAND (field
, 0), spc
,
1528 pp_string (buffer
, " ... ");
1529 dump_generic_node (buffer
, TREE_OPERAND (field
, 1), spc
,
1531 if (TREE_CODE (TREE_OPERAND (field
, 1)) == INTEGER_CST
)
1532 curidx
= tree_to_double_int (TREE_OPERAND (field
, 1));
1535 dump_generic_node (buffer
, field
, spc
, flags
, false);
1536 if (TREE_CODE (field
) == INTEGER_CST
)
1537 curidx
= tree_to_double_int (field
);
1538 pp_string (buffer
, "]=");
1542 curidx
+= double_int_one
;
1543 if (val
&& TREE_CODE (val
) == ADDR_EXPR
)
1544 if (TREE_CODE (TREE_OPERAND (val
, 0)) == FUNCTION_DECL
)
1545 val
= TREE_OPERAND (val
, 0);
1546 if (val
&& TREE_CODE (val
) == FUNCTION_DECL
)
1547 dump_decl_name (buffer
, val
, flags
);
1549 dump_generic_node (buffer
, val
, spc
, flags
, false);
1550 if (ix
!= vec_safe_length (CONSTRUCTOR_ELTS (node
)) - 1)
1556 pp_right_brace (buffer
);
1563 if (flags
& TDF_SLIM
)
1565 pp_string (buffer
, "<COMPOUND_EXPR>");
1569 dump_generic_node (buffer
, TREE_OPERAND (node
, 0),
1570 spc
, flags
, !(flags
& TDF_SLIM
));
1571 if (flags
& TDF_SLIM
)
1572 newline_and_indent (buffer
, spc
);
1579 for (tp
= &TREE_OPERAND (node
, 1);
1580 TREE_CODE (*tp
) == COMPOUND_EXPR
;
1581 tp
= &TREE_OPERAND (*tp
, 1))
1583 dump_generic_node (buffer
, TREE_OPERAND (*tp
, 0),
1584 spc
, flags
, !(flags
& TDF_SLIM
));
1585 if (flags
& TDF_SLIM
)
1586 newline_and_indent (buffer
, spc
);
1594 dump_generic_node (buffer
, *tp
, spc
, flags
, !(flags
& TDF_SLIM
));
1598 case STATEMENT_LIST
:
1600 tree_stmt_iterator si
;
1603 if (flags
& TDF_SLIM
)
1605 pp_string (buffer
, "<STATEMENT_LIST>");
1609 for (si
= tsi_start (node
); !tsi_end_p (si
); tsi_next (&si
))
1612 newline_and_indent (buffer
, spc
);
1615 dump_generic_node (buffer
, tsi_stmt (si
), spc
, flags
, true);
1622 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
,
1627 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
,
1632 pp_string (buffer
, "TARGET_EXPR <");
1633 dump_generic_node (buffer
, TARGET_EXPR_SLOT (node
), spc
, flags
, false);
1636 dump_generic_node (buffer
, TARGET_EXPR_INITIAL (node
), spc
, flags
, false);
1637 pp_greater (buffer
);
1641 print_declaration (buffer
, DECL_EXPR_DECL (node
), spc
, flags
);
1646 if (TREE_TYPE (node
) == NULL
|| TREE_TYPE (node
) == void_type_node
)
1648 pp_string (buffer
, "if (");
1649 dump_generic_node (buffer
, COND_EXPR_COND (node
), spc
, flags
, false);
1650 pp_right_paren (buffer
);
1651 /* The lowered cond_exprs should always be printed in full. */
1652 if (COND_EXPR_THEN (node
)
1653 && (IS_EMPTY_STMT (COND_EXPR_THEN (node
))
1654 || TREE_CODE (COND_EXPR_THEN (node
)) == GOTO_EXPR
)
1655 && COND_EXPR_ELSE (node
)
1656 && (IS_EMPTY_STMT (COND_EXPR_ELSE (node
))
1657 || TREE_CODE (COND_EXPR_ELSE (node
)) == GOTO_EXPR
))
1660 dump_generic_node (buffer
, COND_EXPR_THEN (node
),
1662 if (!IS_EMPTY_STMT (COND_EXPR_ELSE (node
)))
1664 pp_string (buffer
, " else ");
1665 dump_generic_node (buffer
, COND_EXPR_ELSE (node
),
1669 else if (!(flags
& TDF_SLIM
))
1671 /* Output COND_EXPR_THEN. */
1672 if (COND_EXPR_THEN (node
))
1674 newline_and_indent (buffer
, spc
+2);
1675 pp_left_brace (buffer
);
1676 newline_and_indent (buffer
, spc
+4);
1677 dump_generic_node (buffer
, COND_EXPR_THEN (node
), spc
+4,
1679 newline_and_indent (buffer
, spc
+2);
1680 pp_right_brace (buffer
);
1683 /* Output COND_EXPR_ELSE. */
1684 if (COND_EXPR_ELSE (node
)
1685 && !IS_EMPTY_STMT (COND_EXPR_ELSE (node
)))
1687 newline_and_indent (buffer
, spc
);
1688 pp_string (buffer
, "else");
1689 newline_and_indent (buffer
, spc
+2);
1690 pp_left_brace (buffer
);
1691 newline_and_indent (buffer
, spc
+4);
1692 dump_generic_node (buffer
, COND_EXPR_ELSE (node
), spc
+4,
1694 newline_and_indent (buffer
, spc
+2);
1695 pp_right_brace (buffer
);
1702 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1704 pp_question (buffer
);
1706 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1710 dump_generic_node (buffer
, TREE_OPERAND (node
, 2), spc
, flags
, false);
1715 pp_left_brace (buffer
);
1716 if (!(flags
& TDF_SLIM
))
1718 if (BIND_EXPR_VARS (node
))
1720 pp_newline (buffer
);
1722 for (op0
= BIND_EXPR_VARS (node
); op0
; op0
= DECL_CHAIN (op0
))
1724 print_declaration (buffer
, op0
, spc
+2, flags
);
1725 pp_newline (buffer
);
1729 newline_and_indent (buffer
, spc
+2);
1730 dump_generic_node (buffer
, BIND_EXPR_BODY (node
), spc
+2, flags
, true);
1731 newline_and_indent (buffer
, spc
);
1732 pp_right_brace (buffer
);
1738 print_call_name (buffer
, CALL_EXPR_FN (node
), flags
);
1740 /* Print parameters. */
1742 pp_left_paren (buffer
);
1745 call_expr_arg_iterator iter
;
1746 FOR_EACH_CALL_EXPR_ARG (arg
, iter
, node
)
1748 dump_generic_node (buffer
, arg
, spc
, flags
, false);
1749 if (more_call_expr_args_p (&iter
))
1756 if (CALL_EXPR_VA_ARG_PACK (node
))
1758 if (call_expr_nargs (node
) > 0)
1763 pp_string (buffer
, "__builtin_va_arg_pack ()");
1765 pp_right_paren (buffer
);
1767 op1
= CALL_EXPR_STATIC_CHAIN (node
);
1770 pp_string (buffer
, " [static-chain: ");
1771 dump_generic_node (buffer
, op1
, spc
, flags
, false);
1772 pp_right_bracket (buffer
);
1775 if (CALL_EXPR_RETURN_SLOT_OPT (node
))
1776 pp_string (buffer
, " [return slot optimization]");
1777 if (CALL_EXPR_TAILCALL (node
))
1778 pp_string (buffer
, " [tail call]");
1781 case WITH_CLEANUP_EXPR
:
1785 case CLEANUP_POINT_EXPR
:
1786 pp_string (buffer
, "<<cleanup_point ");
1787 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1788 pp_string (buffer
, ">>");
1791 case PLACEHOLDER_EXPR
:
1792 pp_string (buffer
, "<PLACEHOLDER_EXPR ");
1793 dump_generic_node (buffer
, TREE_TYPE (node
), spc
, flags
, false);
1794 pp_greater (buffer
);
1797 /* Binary arithmetic and logic expressions. */
1798 case WIDEN_SUM_EXPR
:
1799 case WIDEN_MULT_EXPR
:
1801 case MULT_HIGHPART_EXPR
:
1803 case POINTER_PLUS_EXPR
:
1805 case TRUNC_DIV_EXPR
:
1807 case FLOOR_DIV_EXPR
:
1808 case ROUND_DIV_EXPR
:
1809 case TRUNC_MOD_EXPR
:
1811 case FLOOR_MOD_EXPR
:
1812 case ROUND_MOD_EXPR
:
1814 case EXACT_DIV_EXPR
:
1819 case VEC_LSHIFT_EXPR
:
1820 case VEC_RSHIFT_EXPR
:
1821 case WIDEN_LSHIFT_EXPR
:
1825 case TRUTH_ANDIF_EXPR
:
1826 case TRUTH_ORIF_EXPR
:
1827 case TRUTH_AND_EXPR
:
1829 case TRUTH_XOR_EXPR
:
1843 case UNORDERED_EXPR
:
1845 const char *op
= op_symbol (node
);
1846 op0
= TREE_OPERAND (node
, 0);
1847 op1
= TREE_OPERAND (node
, 1);
1849 /* When the operands are expressions with less priority,
1850 keep semantics of the tree representation. */
1851 if (op_prio (op0
) <= op_prio (node
))
1853 pp_left_paren (buffer
);
1854 dump_generic_node (buffer
, op0
, spc
, flags
, false);
1855 pp_right_paren (buffer
);
1858 dump_generic_node (buffer
, op0
, spc
, flags
, false);
1861 pp_string (buffer
, op
);
1864 /* When the operands are expressions with less priority,
1865 keep semantics of the tree representation. */
1866 if (op_prio (op1
) <= op_prio (node
))
1868 pp_left_paren (buffer
);
1869 dump_generic_node (buffer
, op1
, spc
, flags
, false);
1870 pp_right_paren (buffer
);
1873 dump_generic_node (buffer
, op1
, spc
, flags
, false);
1877 /* Unary arithmetic and logic expressions. */
1880 case TRUTH_NOT_EXPR
:
1882 case PREDECREMENT_EXPR
:
1883 case PREINCREMENT_EXPR
:
1885 if (TREE_CODE (node
) == ADDR_EXPR
1886 && (TREE_CODE (TREE_OPERAND (node
, 0)) == STRING_CST
1887 || TREE_CODE (TREE_OPERAND (node
, 0)) == FUNCTION_DECL
))
1888 ; /* Do not output '&' for strings and function pointers. */
1890 pp_string (buffer
, op_symbol (node
));
1892 if (op_prio (TREE_OPERAND (node
, 0)) < op_prio (node
))
1894 pp_left_paren (buffer
);
1895 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1896 pp_right_paren (buffer
);
1899 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1902 case POSTDECREMENT_EXPR
:
1903 case POSTINCREMENT_EXPR
:
1904 if (op_prio (TREE_OPERAND (node
, 0)) < op_prio (node
))
1906 pp_left_paren (buffer
);
1907 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1908 pp_right_paren (buffer
);
1911 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1912 pp_string (buffer
, op_symbol (node
));
1916 pp_string (buffer
, "MIN_EXPR <");
1917 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1918 pp_string (buffer
, ", ");
1919 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1920 pp_greater (buffer
);
1924 pp_string (buffer
, "MAX_EXPR <");
1925 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1926 pp_string (buffer
, ", ");
1927 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1928 pp_greater (buffer
);
1932 pp_string (buffer
, "ABS_EXPR <");
1933 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1934 pp_greater (buffer
);
1941 case ADDR_SPACE_CONVERT_EXPR
:
1942 case FIXED_CONVERT_EXPR
:
1943 case FIX_TRUNC_EXPR
:
1946 type
= TREE_TYPE (node
);
1947 op0
= TREE_OPERAND (node
, 0);
1948 if (type
!= TREE_TYPE (op0
))
1950 pp_left_paren (buffer
);
1951 dump_generic_node (buffer
, type
, spc
, flags
, false);
1952 pp_string (buffer
, ") ");
1954 if (op_prio (op0
) < op_prio (node
))
1955 pp_left_paren (buffer
);
1956 dump_generic_node (buffer
, op0
, spc
, flags
, false);
1957 if (op_prio (op0
) < op_prio (node
))
1958 pp_right_paren (buffer
);
1961 case VIEW_CONVERT_EXPR
:
1962 pp_string (buffer
, "VIEW_CONVERT_EXPR<");
1963 dump_generic_node (buffer
, TREE_TYPE (node
), spc
, flags
, false);
1964 pp_string (buffer
, ">(");
1965 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1966 pp_right_paren (buffer
);
1970 pp_string (buffer
, "((");
1971 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1972 pp_string (buffer
, "))");
1975 case NON_LVALUE_EXPR
:
1976 pp_string (buffer
, "NON_LVALUE_EXPR <");
1977 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1978 pp_greater (buffer
);
1982 pp_string (buffer
, "SAVE_EXPR <");
1983 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1984 pp_greater (buffer
);
1988 pp_string (buffer
, "COMPLEX_EXPR <");
1989 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1990 pp_string (buffer
, ", ");
1991 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1992 pp_greater (buffer
);
1996 pp_string (buffer
, "CONJ_EXPR <");
1997 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1998 pp_greater (buffer
);
2002 pp_string (buffer
, "REALPART_EXPR <");
2003 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2004 pp_greater (buffer
);
2008 pp_string (buffer
, "IMAGPART_EXPR <");
2009 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2010 pp_greater (buffer
);
2014 pp_string (buffer
, "VA_ARG_EXPR <");
2015 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2016 pp_greater (buffer
);
2019 case TRY_FINALLY_EXPR
:
2020 case TRY_CATCH_EXPR
:
2021 pp_string (buffer
, "try");
2022 newline_and_indent (buffer
, spc
+2);
2023 pp_left_brace (buffer
);
2024 newline_and_indent (buffer
, spc
+4);
2025 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
+4, flags
, true);
2026 newline_and_indent (buffer
, spc
+2);
2027 pp_right_brace (buffer
);
2028 newline_and_indent (buffer
, spc
);
2030 (TREE_CODE (node
) == TRY_CATCH_EXPR
) ? "catch" : "finally");
2031 newline_and_indent (buffer
, spc
+2);
2032 pp_left_brace (buffer
);
2033 newline_and_indent (buffer
, spc
+4);
2034 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
+4, flags
, true);
2035 newline_and_indent (buffer
, spc
+2);
2036 pp_right_brace (buffer
);
2041 pp_string (buffer
, "catch (");
2042 dump_generic_node (buffer
, CATCH_TYPES (node
), spc
+2, flags
, false);
2043 pp_right_paren (buffer
);
2044 newline_and_indent (buffer
, spc
+2);
2045 pp_left_brace (buffer
);
2046 newline_and_indent (buffer
, spc
+4);
2047 dump_generic_node (buffer
, CATCH_BODY (node
), spc
+4, flags
, true);
2048 newline_and_indent (buffer
, spc
+2);
2049 pp_right_brace (buffer
);
2053 case EH_FILTER_EXPR
:
2054 pp_string (buffer
, "<<<eh_filter (");
2055 dump_generic_node (buffer
, EH_FILTER_TYPES (node
), spc
+2, flags
, false);
2056 pp_string (buffer
, ")>>>");
2057 newline_and_indent (buffer
, spc
+2);
2058 pp_left_brace (buffer
);
2059 newline_and_indent (buffer
, spc
+4);
2060 dump_generic_node (buffer
, EH_FILTER_FAILURE (node
), spc
+4, flags
, true);
2061 newline_and_indent (buffer
, spc
+2);
2062 pp_right_brace (buffer
);
2067 op0
= TREE_OPERAND (node
, 0);
2068 /* If this is for break or continue, don't bother printing it. */
2069 if (DECL_NAME (op0
))
2071 const char *name
= IDENTIFIER_POINTER (DECL_NAME (op0
));
2072 if (strcmp (name
, "break") == 0
2073 || strcmp (name
, "continue") == 0)
2076 dump_generic_node (buffer
, op0
, spc
, flags
, false);
2078 if (DECL_NONLOCAL (op0
))
2079 pp_string (buffer
, " [non-local]");
2083 pp_string (buffer
, "while (1)");
2084 if (!(flags
& TDF_SLIM
))
2086 newline_and_indent (buffer
, spc
+2);
2087 pp_left_brace (buffer
);
2088 newline_and_indent (buffer
, spc
+4);
2089 dump_generic_node (buffer
, LOOP_EXPR_BODY (node
), spc
+4, flags
, true);
2090 newline_and_indent (buffer
, spc
+2);
2091 pp_right_brace (buffer
);
2097 pp_string (buffer
, "// predicted ");
2098 if (PREDICT_EXPR_OUTCOME (node
))
2099 pp_string (buffer
, "likely by ");
2101 pp_string (buffer
, "unlikely by ");
2102 pp_string (buffer
, predictor_name (PREDICT_EXPR_PREDICTOR (node
)));
2103 pp_string (buffer
, " predictor.");
2107 pp_string (buffer
, "ANNOTATE_EXPR <");
2108 switch ((enum annot_expr_kind
) TREE_INT_CST_LOW (TREE_OPERAND (node
, 1)))
2110 case annot_expr_ivdep_kind
:
2111 pp_string (buffer
, "ivdep, ");
2114 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2115 pp_greater (buffer
);
2119 pp_string (buffer
, "return");
2120 op0
= TREE_OPERAND (node
, 0);
2124 if (TREE_CODE (op0
) == MODIFY_EXPR
)
2125 dump_generic_node (buffer
, TREE_OPERAND (op0
, 1),
2128 dump_generic_node (buffer
, op0
, spc
, flags
, false);
2133 pp_string (buffer
, "if (");
2134 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2135 pp_string (buffer
, ") break");
2139 pp_string (buffer
, "switch (");
2140 dump_generic_node (buffer
, SWITCH_COND (node
), spc
, flags
, false);
2141 pp_right_paren (buffer
);
2142 if (!(flags
& TDF_SLIM
))
2144 newline_and_indent (buffer
, spc
+2);
2145 pp_left_brace (buffer
);
2146 if (SWITCH_BODY (node
))
2148 newline_and_indent (buffer
, spc
+4);
2149 dump_generic_node (buffer
, SWITCH_BODY (node
), spc
+4, flags
,
2154 tree vec
= SWITCH_LABELS (node
);
2155 size_t i
, n
= TREE_VEC_LENGTH (vec
);
2156 for (i
= 0; i
< n
; ++i
)
2158 tree elt
= TREE_VEC_ELT (vec
, i
);
2159 newline_and_indent (buffer
, spc
+4);
2162 dump_generic_node (buffer
, elt
, spc
+4, flags
, false);
2163 pp_string (buffer
, " goto ");
2164 dump_generic_node (buffer
, CASE_LABEL (elt
), spc
+4,
2166 pp_semicolon (buffer
);
2169 pp_string (buffer
, "case ???: goto ???;");
2172 newline_and_indent (buffer
, spc
+2);
2173 pp_right_brace (buffer
);
2179 op0
= GOTO_DESTINATION (node
);
2180 if (TREE_CODE (op0
) != SSA_NAME
&& DECL_P (op0
) && DECL_NAME (op0
))
2182 const char *name
= IDENTIFIER_POINTER (DECL_NAME (op0
));
2183 if (strcmp (name
, "break") == 0
2184 || strcmp (name
, "continue") == 0)
2186 pp_string (buffer
, name
);
2190 pp_string (buffer
, "goto ");
2191 dump_generic_node (buffer
, op0
, spc
, flags
, false);
2195 pp_string (buffer
, "__asm__");
2196 if (ASM_VOLATILE_P (node
))
2197 pp_string (buffer
, " __volatile__");
2198 pp_left_paren (buffer
);
2199 dump_generic_node (buffer
, ASM_STRING (node
), spc
, flags
, false);
2201 dump_generic_node (buffer
, ASM_OUTPUTS (node
), spc
, flags
, false);
2203 dump_generic_node (buffer
, ASM_INPUTS (node
), spc
, flags
, false);
2204 if (ASM_CLOBBERS (node
))
2207 dump_generic_node (buffer
, ASM_CLOBBERS (node
), spc
, flags
, false);
2209 pp_right_paren (buffer
);
2212 case CASE_LABEL_EXPR
:
2213 if (CASE_LOW (node
) && CASE_HIGH (node
))
2215 pp_string (buffer
, "case ");
2216 dump_generic_node (buffer
, CASE_LOW (node
), spc
, flags
, false);
2217 pp_string (buffer
, " ... ");
2218 dump_generic_node (buffer
, CASE_HIGH (node
), spc
, flags
, false);
2220 else if (CASE_LOW (node
))
2222 pp_string (buffer
, "case ");
2223 dump_generic_node (buffer
, CASE_LOW (node
), spc
, flags
, false);
2226 pp_string (buffer
, "default");
2231 pp_string (buffer
, "OBJ_TYPE_REF(");
2232 dump_generic_node (buffer
, OBJ_TYPE_REF_EXPR (node
), spc
, flags
, false);
2233 pp_semicolon (buffer
);
2234 if (!(flags
& TDF_SLIM
) && virtual_method_call_p (node
))
2236 pp_string (buffer
, "(");
2237 dump_generic_node (buffer
, obj_type_ref_class (node
), spc
, flags
, false);
2238 pp_string (buffer
, ")");
2240 dump_generic_node (buffer
, OBJ_TYPE_REF_OBJECT (node
), spc
, flags
, false);
2242 dump_generic_node (buffer
, OBJ_TYPE_REF_TOKEN (node
), spc
, flags
, false);
2243 pp_right_paren (buffer
);
2247 if (SSA_NAME_IDENTIFIER (node
))
2248 dump_generic_node (buffer
, SSA_NAME_IDENTIFIER (node
),
2250 pp_underscore (buffer
);
2251 pp_decimal_int (buffer
, SSA_NAME_VERSION (node
));
2252 if (SSA_NAME_IS_DEFAULT_DEF (node
))
2253 pp_string (buffer
, "(D)");
2254 if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (node
))
2255 pp_string (buffer
, "(ab)");
2258 case WITH_SIZE_EXPR
:
2259 pp_string (buffer
, "WITH_SIZE_EXPR <");
2260 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2261 pp_string (buffer
, ", ");
2262 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2263 pp_greater (buffer
);
2267 pp_string (buffer
, "ASSERT_EXPR <");
2268 dump_generic_node (buffer
, ASSERT_EXPR_VAR (node
), spc
, flags
, false);
2269 pp_string (buffer
, ", ");
2270 dump_generic_node (buffer
, ASSERT_EXPR_COND (node
), spc
, flags
, false);
2271 pp_greater (buffer
);
2275 pp_string (buffer
, "scev_known");
2278 case SCEV_NOT_KNOWN
:
2279 pp_string (buffer
, "scev_not_known");
2282 case POLYNOMIAL_CHREC
:
2283 pp_left_brace (buffer
);
2284 dump_generic_node (buffer
, CHREC_LEFT (node
), spc
, flags
, false);
2285 pp_string (buffer
, ", +, ");
2286 dump_generic_node (buffer
, CHREC_RIGHT (node
), spc
, flags
, false);
2287 pp_string (buffer
, "}_");
2288 dump_generic_node (buffer
, CHREC_VAR (node
), spc
, flags
, false);
2292 case REALIGN_LOAD_EXPR
:
2293 pp_string (buffer
, "REALIGN_LOAD <");
2294 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2295 pp_string (buffer
, ", ");
2296 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2297 pp_string (buffer
, ", ");
2298 dump_generic_node (buffer
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2299 pp_greater (buffer
);
2303 pp_string (buffer
, " VEC_COND_EXPR < ");
2304 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2305 pp_string (buffer
, " , ");
2306 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2307 pp_string (buffer
, " , ");
2308 dump_generic_node (buffer
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2309 pp_string (buffer
, " > ");
2313 pp_string (buffer
, " VEC_PERM_EXPR < ");
2314 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2315 pp_string (buffer
, " , ");
2316 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2317 pp_string (buffer
, " , ");
2318 dump_generic_node (buffer
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2319 pp_string (buffer
, " > ");
2323 pp_string (buffer
, " DOT_PROD_EXPR < ");
2324 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2325 pp_string (buffer
, ", ");
2326 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2327 pp_string (buffer
, ", ");
2328 dump_generic_node (buffer
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2329 pp_string (buffer
, " > ");
2332 case WIDEN_MULT_PLUS_EXPR
:
2333 pp_string (buffer
, " WIDEN_MULT_PLUS_EXPR < ");
2334 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2335 pp_string (buffer
, ", ");
2336 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2337 pp_string (buffer
, ", ");
2338 dump_generic_node (buffer
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2339 pp_string (buffer
, " > ");
2342 case WIDEN_MULT_MINUS_EXPR
:
2343 pp_string (buffer
, " WIDEN_MULT_MINUS_EXPR < ");
2344 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2345 pp_string (buffer
, ", ");
2346 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2347 pp_string (buffer
, ", ");
2348 dump_generic_node (buffer
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2349 pp_string (buffer
, " > ");
2353 pp_string (buffer
, " FMA_EXPR < ");
2354 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2355 pp_string (buffer
, ", ");
2356 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2357 pp_string (buffer
, ", ");
2358 dump_generic_node (buffer
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2359 pp_string (buffer
, " > ");
2363 pp_string (buffer
, "#pragma omp parallel");
2364 dump_omp_clauses (buffer
, OMP_PARALLEL_CLAUSES (node
), spc
, flags
);
2367 if (!(flags
& TDF_SLIM
) && OMP_BODY (node
))
2369 newline_and_indent (buffer
, spc
+ 2);
2370 pp_left_brace (buffer
);
2371 newline_and_indent (buffer
, spc
+ 4);
2372 dump_generic_node (buffer
, OMP_BODY (node
), spc
+ 4, flags
, false);
2373 newline_and_indent (buffer
, spc
+ 2);
2374 pp_right_brace (buffer
);
2380 pp_string (buffer
, "#pragma omp task");
2381 dump_omp_clauses (buffer
, OMP_TASK_CLAUSES (node
), spc
, flags
);
2385 pp_string (buffer
, "#pragma omp for");
2389 pp_string (buffer
, "#pragma omp simd");
2393 pp_string (buffer
, "#pragma simd");
2396 case OMP_DISTRIBUTE
:
2397 pp_string (buffer
, "#pragma omp distribute");
2401 pp_string (buffer
, "#pragma omp teams");
2402 dump_omp_clauses (buffer
, OMP_TEAMS_CLAUSES (node
), spc
, flags
);
2405 case OMP_TARGET_DATA
:
2406 pp_string (buffer
, "#pragma omp target data");
2407 dump_omp_clauses (buffer
, OMP_TARGET_DATA_CLAUSES (node
), spc
, flags
);
2411 pp_string (buffer
, "#pragma omp target");
2412 dump_omp_clauses (buffer
, OMP_TARGET_CLAUSES (node
), spc
, flags
);
2415 case OMP_TARGET_UPDATE
:
2416 pp_string (buffer
, "#pragma omp target update");
2417 dump_omp_clauses (buffer
, OMP_TARGET_UPDATE_CLAUSES (node
), spc
, flags
);
2422 dump_omp_clauses (buffer
, OMP_FOR_CLAUSES (node
), spc
, flags
);
2424 if (!(flags
& TDF_SLIM
))
2428 if (OMP_FOR_PRE_BODY (node
))
2430 newline_and_indent (buffer
, spc
+ 2);
2431 pp_left_brace (buffer
);
2433 newline_and_indent (buffer
, spc
);
2434 dump_generic_node (buffer
, OMP_FOR_PRE_BODY (node
),
2437 if (OMP_FOR_INIT (node
))
2440 for (i
= 0; i
< TREE_VEC_LENGTH (OMP_FOR_INIT (node
)); i
++)
2443 newline_and_indent (buffer
, spc
);
2444 pp_string (buffer
, "for (");
2445 dump_generic_node (buffer
,
2446 TREE_VEC_ELT (OMP_FOR_INIT (node
), i
),
2448 pp_string (buffer
, "; ");
2449 dump_generic_node (buffer
,
2450 TREE_VEC_ELT (OMP_FOR_COND (node
), i
),
2452 pp_string (buffer
, "; ");
2453 dump_generic_node (buffer
,
2454 TREE_VEC_ELT (OMP_FOR_INCR (node
), i
),
2456 pp_right_paren (buffer
);
2459 if (OMP_FOR_BODY (node
))
2461 newline_and_indent (buffer
, spc
+ 2);
2462 pp_left_brace (buffer
);
2463 newline_and_indent (buffer
, spc
+ 4);
2464 dump_generic_node (buffer
, OMP_FOR_BODY (node
), spc
+ 4, flags
,
2466 newline_and_indent (buffer
, spc
+ 2);
2467 pp_right_brace (buffer
);
2469 if (OMP_FOR_INIT (node
))
2470 spc
-= 2 * TREE_VEC_LENGTH (OMP_FOR_INIT (node
)) - 2;
2471 if (OMP_FOR_PRE_BODY (node
))
2474 newline_and_indent (buffer
, spc
+ 2);
2475 pp_right_brace (buffer
);
2482 pp_string (buffer
, "#pragma omp sections");
2483 dump_omp_clauses (buffer
, OMP_SECTIONS_CLAUSES (node
), spc
, flags
);
2487 pp_string (buffer
, "#pragma omp section");
2491 pp_string (buffer
, "#pragma omp master");
2495 pp_string (buffer
, "#pragma omp taskgroup");
2499 pp_string (buffer
, "#pragma omp ordered");
2503 pp_string (buffer
, "#pragma omp critical");
2504 if (OMP_CRITICAL_NAME (node
))
2507 pp_left_paren (buffer
);
2508 dump_generic_node (buffer
, OMP_CRITICAL_NAME (node
), spc
,
2510 pp_right_paren (buffer
);
2515 pp_string (buffer
, "#pragma omp atomic");
2516 if (OMP_ATOMIC_SEQ_CST (node
))
2517 pp_string (buffer
, " seq_cst");
2518 newline_and_indent (buffer
, spc
+ 2);
2519 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2523 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2526 case OMP_ATOMIC_READ
:
2527 pp_string (buffer
, "#pragma omp atomic read");
2528 if (OMP_ATOMIC_SEQ_CST (node
))
2529 pp_string (buffer
, " seq_cst");
2530 newline_and_indent (buffer
, spc
+ 2);
2531 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2535 case OMP_ATOMIC_CAPTURE_OLD
:
2536 case OMP_ATOMIC_CAPTURE_NEW
:
2537 pp_string (buffer
, "#pragma omp atomic capture");
2538 if (OMP_ATOMIC_SEQ_CST (node
))
2539 pp_string (buffer
, " seq_cst");
2540 newline_and_indent (buffer
, spc
+ 2);
2541 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2545 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2549 pp_string (buffer
, "#pragma omp single");
2550 dump_omp_clauses (buffer
, OMP_SINGLE_CLAUSES (node
), spc
, flags
);
2554 dump_omp_clause (buffer
, node
, spc
, flags
);
2558 case TRANSACTION_EXPR
:
2559 if (TRANSACTION_EXPR_OUTER (node
))
2560 pp_string (buffer
, "__transaction_atomic [[outer]]");
2561 else if (TRANSACTION_EXPR_RELAXED (node
))
2562 pp_string (buffer
, "__transaction_relaxed");
2564 pp_string (buffer
, "__transaction_atomic");
2565 if (!(flags
& TDF_SLIM
) && TRANSACTION_EXPR_BODY (node
))
2567 newline_and_indent (buffer
, spc
);
2568 pp_left_brace (buffer
);
2569 newline_and_indent (buffer
, spc
+ 2);
2570 dump_generic_node (buffer
, TRANSACTION_EXPR_BODY (node
),
2571 spc
+ 2, flags
, false);
2572 newline_and_indent (buffer
, spc
);
2573 pp_right_brace (buffer
);
2578 case REDUC_MAX_EXPR
:
2579 pp_string (buffer
, " REDUC_MAX_EXPR < ");
2580 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2581 pp_string (buffer
, " > ");
2584 case REDUC_MIN_EXPR
:
2585 pp_string (buffer
, " REDUC_MIN_EXPR < ");
2586 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2587 pp_string (buffer
, " > ");
2590 case REDUC_PLUS_EXPR
:
2591 pp_string (buffer
, " REDUC_PLUS_EXPR < ");
2592 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2593 pp_string (buffer
, " > ");
2596 case VEC_WIDEN_MULT_HI_EXPR
:
2597 case VEC_WIDEN_MULT_LO_EXPR
:
2598 case VEC_WIDEN_MULT_EVEN_EXPR
:
2599 case VEC_WIDEN_MULT_ODD_EXPR
:
2600 case VEC_WIDEN_LSHIFT_HI_EXPR
:
2601 case VEC_WIDEN_LSHIFT_LO_EXPR
:
2603 for (str
= get_tree_code_name (code
); *str
; str
++)
2604 pp_character (buffer
, TOUPPER (*str
));
2605 pp_string (buffer
, " < ");
2606 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2607 pp_string (buffer
, ", ");
2608 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2609 pp_string (buffer
, " > ");
2612 case VEC_UNPACK_HI_EXPR
:
2613 pp_string (buffer
, " VEC_UNPACK_HI_EXPR < ");
2614 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2615 pp_string (buffer
, " > ");
2618 case VEC_UNPACK_LO_EXPR
:
2619 pp_string (buffer
, " VEC_UNPACK_LO_EXPR < ");
2620 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2621 pp_string (buffer
, " > ");
2624 case VEC_UNPACK_FLOAT_HI_EXPR
:
2625 pp_string (buffer
, " VEC_UNPACK_FLOAT_HI_EXPR < ");
2626 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2627 pp_string (buffer
, " > ");
2630 case VEC_UNPACK_FLOAT_LO_EXPR
:
2631 pp_string (buffer
, " VEC_UNPACK_FLOAT_LO_EXPR < ");
2632 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2633 pp_string (buffer
, " > ");
2636 case VEC_PACK_TRUNC_EXPR
:
2637 pp_string (buffer
, " VEC_PACK_TRUNC_EXPR < ");
2638 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2639 pp_string (buffer
, ", ");
2640 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2641 pp_string (buffer
, " > ");
2644 case VEC_PACK_SAT_EXPR
:
2645 pp_string (buffer
, " VEC_PACK_SAT_EXPR < ");
2646 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2647 pp_string (buffer
, ", ");
2648 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2649 pp_string (buffer
, " > ");
2652 case VEC_PACK_FIX_TRUNC_EXPR
:
2653 pp_string (buffer
, " VEC_PACK_FIX_TRUNC_EXPR < ");
2654 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2655 pp_string (buffer
, ", ");
2656 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2657 pp_string (buffer
, " > ");
2661 dump_block_node (buffer
, node
, spc
, flags
);
2664 case CILK_SPAWN_STMT
:
2665 pp_string (buffer
, "_Cilk_spawn ");
2666 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2669 case CILK_SYNC_STMT
:
2670 pp_string (buffer
, "_Cilk_sync");
2677 if (is_stmt
&& is_expr
)
2678 pp_semicolon (buffer
);
2683 /* Print the declaration of a variable. */
2686 print_declaration (pretty_printer
*buffer
, tree t
, int spc
, int flags
)
2690 if (TREE_CODE(t
) == NAMELIST_DECL
)
2692 pp_string(buffer
, "namelist ");
2693 dump_decl_name (buffer
, t
, flags
);
2694 pp_semicolon (buffer
);
2698 if (TREE_CODE (t
) == TYPE_DECL
)
2699 pp_string (buffer
, "typedef ");
2701 if (CODE_CONTAINS_STRUCT (TREE_CODE (t
), TS_DECL_WRTL
) && DECL_REGISTER (t
))
2702 pp_string (buffer
, "register ");
2704 if (TREE_PUBLIC (t
) && DECL_EXTERNAL (t
))
2705 pp_string (buffer
, "extern ");
2706 else if (TREE_STATIC (t
))
2707 pp_string (buffer
, "static ");
2709 /* Print the type and name. */
2710 if (TREE_TYPE (t
) && TREE_CODE (TREE_TYPE (t
)) == ARRAY_TYPE
)
2714 /* Print array's type. */
2715 tmp
= TREE_TYPE (t
);
2716 while (TREE_CODE (TREE_TYPE (tmp
)) == ARRAY_TYPE
)
2717 tmp
= TREE_TYPE (tmp
);
2718 dump_generic_node (buffer
, TREE_TYPE (tmp
), spc
, flags
, false);
2720 /* Print variable's name. */
2722 dump_generic_node (buffer
, t
, spc
, flags
, false);
2724 /* Print the dimensions. */
2725 tmp
= TREE_TYPE (t
);
2726 while (TREE_CODE (tmp
) == ARRAY_TYPE
)
2728 dump_array_domain (buffer
, TYPE_DOMAIN (tmp
), spc
, flags
);
2729 tmp
= TREE_TYPE (tmp
);
2732 else if (TREE_CODE (t
) == FUNCTION_DECL
)
2734 dump_generic_node (buffer
, TREE_TYPE (TREE_TYPE (t
)), spc
, flags
, false);
2736 dump_decl_name (buffer
, t
, flags
);
2737 dump_function_declaration (buffer
, TREE_TYPE (t
), spc
, flags
);
2741 /* Print type declaration. */
2742 dump_generic_node (buffer
, TREE_TYPE (t
), spc
, flags
, false);
2744 /* Print variable's name. */
2746 dump_generic_node (buffer
, t
, spc
, flags
, false);
2749 if (TREE_CODE (t
) == VAR_DECL
&& DECL_HARD_REGISTER (t
))
2751 pp_string (buffer
, " __asm__ ");
2752 pp_left_paren (buffer
);
2753 dump_generic_node (buffer
, DECL_ASSEMBLER_NAME (t
), spc
, flags
, false);
2754 pp_right_paren (buffer
);
2757 /* The initial value of a function serves to determine whether the function
2758 is declared or defined. So the following does not apply to function
2760 if (TREE_CODE (t
) != FUNCTION_DECL
)
2762 /* Print the initial value. */
2763 if (DECL_INITIAL (t
))
2768 dump_generic_node (buffer
, DECL_INITIAL (t
), spc
, flags
, false);
2772 if (TREE_CODE (t
) == VAR_DECL
&& DECL_HAS_VALUE_EXPR_P (t
))
2774 pp_string (buffer
, " [value-expr: ");
2775 dump_generic_node (buffer
, DECL_VALUE_EXPR (t
), spc
, flags
, false);
2776 pp_right_bracket (buffer
);
2779 pp_semicolon (buffer
);
2783 /* Prints a structure: name, fields, and methods.
2784 FIXME: Still incomplete. */
2787 print_struct_decl (pretty_printer
*buffer
, const_tree node
, int spc
, int flags
)
2789 /* Print the name of the structure. */
2790 if (TYPE_NAME (node
))
2793 if (TREE_CODE (node
) == RECORD_TYPE
)
2794 pp_string (buffer
, "struct ");
2795 else if ((TREE_CODE (node
) == UNION_TYPE
2796 || TREE_CODE (node
) == QUAL_UNION_TYPE
))
2797 pp_string (buffer
, "union ");
2799 dump_generic_node (buffer
, TYPE_NAME (node
), spc
, 0, false);
2802 /* Print the contents of the structure. */
2803 pp_newline (buffer
);
2805 pp_left_brace (buffer
);
2806 pp_newline (buffer
);
2808 /* Print the fields of the structure. */
2811 tmp
= TYPE_FIELDS (node
);
2814 /* Avoid to print recursively the structure. */
2815 /* FIXME : Not implemented correctly...,
2816 what about the case when we have a cycle in the contain graph? ...
2817 Maybe this could be solved by looking at the scope in which the
2818 structure was declared. */
2819 if (TREE_TYPE (tmp
) != node
2820 && (TREE_CODE (TREE_TYPE (tmp
)) != POINTER_TYPE
2821 || TREE_TYPE (TREE_TYPE (tmp
)) != node
))
2823 print_declaration (buffer
, tmp
, spc
+2, flags
);
2824 pp_newline (buffer
);
2826 tmp
= DECL_CHAIN (tmp
);
2830 pp_right_brace (buffer
);
2833 /* Return the priority of the operator CODE.
2835 From lowest to highest precedence with either left-to-right (L-R)
2836 or right-to-left (R-L) associativity]:
2839 2 [R-L] = += -= *= /= %= &= ^= |= <<= >>=
2851 14 [R-L] ! ~ ++ -- + - * & (type) sizeof
2852 15 [L-R] fn() [] -> .
2854 unary +, - and * have higher precedence than the corresponding binary
2858 op_code_prio (enum tree_code code
)
2875 case TRUTH_ORIF_EXPR
:
2878 case TRUTH_AND_EXPR
:
2879 case TRUTH_ANDIF_EXPR
:
2886 case TRUTH_XOR_EXPR
:
2903 case UNORDERED_EXPR
:
2914 case VEC_WIDEN_LSHIFT_HI_EXPR
:
2915 case VEC_WIDEN_LSHIFT_LO_EXPR
:
2916 case WIDEN_LSHIFT_EXPR
:
2919 case WIDEN_SUM_EXPR
:
2921 case POINTER_PLUS_EXPR
:
2925 case VEC_WIDEN_MULT_HI_EXPR
:
2926 case VEC_WIDEN_MULT_LO_EXPR
:
2927 case WIDEN_MULT_EXPR
:
2929 case WIDEN_MULT_PLUS_EXPR
:
2930 case WIDEN_MULT_MINUS_EXPR
:
2932 case MULT_HIGHPART_EXPR
:
2933 case TRUNC_DIV_EXPR
:
2935 case FLOOR_DIV_EXPR
:
2936 case ROUND_DIV_EXPR
:
2938 case EXACT_DIV_EXPR
:
2939 case TRUNC_MOD_EXPR
:
2941 case FLOOR_MOD_EXPR
:
2942 case ROUND_MOD_EXPR
:
2946 case TRUTH_NOT_EXPR
:
2948 case POSTINCREMENT_EXPR
:
2949 case POSTDECREMENT_EXPR
:
2950 case PREINCREMENT_EXPR
:
2951 case PREDECREMENT_EXPR
:
2957 case FIX_TRUNC_EXPR
:
2963 case ARRAY_RANGE_REF
:
2967 /* Special expressions. */
2973 case REDUC_MAX_EXPR
:
2974 case REDUC_MIN_EXPR
:
2975 case REDUC_PLUS_EXPR
:
2976 case VEC_LSHIFT_EXPR
:
2977 case VEC_RSHIFT_EXPR
:
2978 case VEC_UNPACK_HI_EXPR
:
2979 case VEC_UNPACK_LO_EXPR
:
2980 case VEC_UNPACK_FLOAT_HI_EXPR
:
2981 case VEC_UNPACK_FLOAT_LO_EXPR
:
2982 case VEC_PACK_TRUNC_EXPR
:
2983 case VEC_PACK_SAT_EXPR
:
2987 /* Return an arbitrarily high precedence to avoid surrounding single
2988 VAR_DECLs in ()s. */
2993 /* Return the priority of the operator OP. */
2996 op_prio (const_tree op
)
2998 enum tree_code code
;
3003 code
= TREE_CODE (op
);
3004 if (code
== SAVE_EXPR
|| code
== NON_LVALUE_EXPR
)
3005 return op_prio (TREE_OPERAND (op
, 0));
3007 return op_code_prio (code
);
3010 /* Return the symbol associated with operator CODE. */
3013 op_symbol_code (enum tree_code code
)
3021 case TRUTH_ORIF_EXPR
:
3024 case TRUTH_AND_EXPR
:
3025 case TRUTH_ANDIF_EXPR
:
3031 case TRUTH_XOR_EXPR
:
3041 case UNORDERED_EXPR
:
3087 case VEC_LSHIFT_EXPR
:
3090 case VEC_RSHIFT_EXPR
:
3093 case WIDEN_LSHIFT_EXPR
:
3096 case POINTER_PLUS_EXPR
:
3102 case REDUC_PLUS_EXPR
:
3105 case WIDEN_SUM_EXPR
:
3108 case WIDEN_MULT_EXPR
:
3111 case MULT_HIGHPART_EXPR
:
3121 case TRUTH_NOT_EXPR
:
3128 case TRUNC_DIV_EXPR
:
3135 case FLOOR_DIV_EXPR
:
3138 case ROUND_DIV_EXPR
:
3141 case EXACT_DIV_EXPR
:
3144 case TRUNC_MOD_EXPR
:
3150 case FLOOR_MOD_EXPR
:
3153 case ROUND_MOD_EXPR
:
3156 case PREDECREMENT_EXPR
:
3159 case PREINCREMENT_EXPR
:
3162 case POSTDECREMENT_EXPR
:
3165 case POSTINCREMENT_EXPR
:
3175 return "<<< ??? >>>";
3179 /* Return the symbol associated with operator OP. */
3182 op_symbol (const_tree op
)
3184 return op_symbol_code (TREE_CODE (op
));
3187 /* Prints the name of a call. NODE is the CALL_EXPR_FN of a CALL_EXPR or
3188 the gimple_call_fn of a GIMPLE_CALL. */
3191 print_call_name (pretty_printer
*buffer
, tree node
, int flags
)
3195 if (TREE_CODE (op0
) == NON_LVALUE_EXPR
)
3196 op0
= TREE_OPERAND (op0
, 0);
3199 switch (TREE_CODE (op0
))
3204 dump_function_name (buffer
, op0
, flags
);
3210 op0
= TREE_OPERAND (op0
, 0);
3214 pp_left_paren (buffer
);
3215 dump_generic_node (buffer
, TREE_OPERAND (op0
, 0), 0, flags
, false);
3216 pp_string (buffer
, ") ? ");
3217 dump_generic_node (buffer
, TREE_OPERAND (op0
, 1), 0, flags
, false);
3218 pp_string (buffer
, " : ");
3219 dump_generic_node (buffer
, TREE_OPERAND (op0
, 2), 0, flags
, false);
3223 if (TREE_CODE (TREE_OPERAND (op0
, 0)) == VAR_DECL
)
3224 dump_function_name (buffer
, TREE_OPERAND (op0
, 0), flags
);
3226 dump_generic_node (buffer
, op0
, 0, flags
, false);
3230 if (integer_zerop (TREE_OPERAND (op0
, 1)))
3232 op0
= TREE_OPERAND (op0
, 0);
3239 dump_generic_node (buffer
, op0
, 0, flags
, false);
3247 /* Parses the string STR and replaces new-lines by '\n', tabs by '\t', ... */
3250 pretty_print_string (pretty_printer
*buffer
, const char *str
)
3260 pp_string (buffer
, "\\b");
3264 pp_string (buffer
, "\\f");
3268 pp_string (buffer
, "\\n");
3272 pp_string (buffer
, "\\r");
3276 pp_string (buffer
, "\\t");
3280 pp_string (buffer
, "\\v");
3284 pp_string (buffer
, "\\\\");
3288 pp_string (buffer
, "\\\"");
3292 pp_string (buffer
, "\\'");
3295 /* No need to handle \0; the loop terminates on \0. */
3298 pp_string (buffer
, "\\1");
3302 pp_string (buffer
, "\\2");
3306 pp_string (buffer
, "\\3");
3310 pp_string (buffer
, "\\4");
3314 pp_string (buffer
, "\\5");
3318 pp_string (buffer
, "\\6");
3322 pp_string (buffer
, "\\7");
3326 pp_character (buffer
, str
[0]);
3334 maybe_init_pretty_print (FILE *file
)
3338 new (&buffer
) pretty_printer ();
3339 pp_needs_newline (&buffer
) = true;
3340 pp_translate_identifiers (&buffer
) = false;
3344 buffer
.buffer
->stream
= file
;
3348 newline_and_indent (pretty_printer
*buffer
, int spc
)
3350 pp_newline (buffer
);
3354 /* Handle a %K format for TEXT. Separate from default_tree_printer so
3355 it can also be used in front ends.
3356 %K: a statement, from which EXPR_LOCATION and TREE_BLOCK will be recorded.
3360 percent_K_format (text_info
*text
)
3362 tree t
= va_arg (*text
->args_ptr
, tree
), block
;
3363 gcc_assert (text
->locus
!= NULL
);
3364 *text
->locus
= EXPR_LOCATION (t
);
3365 gcc_assert (pp_ti_abstract_origin (text
) != NULL
);
3366 block
= TREE_BLOCK (t
);
3367 *pp_ti_abstract_origin (text
) = NULL
;
3371 /* ??? LTO drops all BLOCK_ABSTRACT_ORIGINs apart from those
3372 representing the outermost block of an inlined function.
3373 So walk the BLOCK tree until we hit such a scope. */
3375 && TREE_CODE (block
) == BLOCK
)
3377 if (inlined_function_outer_scope_p (block
))
3379 *pp_ti_abstract_origin (text
) = block
;
3382 block
= BLOCK_SUPERCONTEXT (block
);
3388 && TREE_CODE (block
) == BLOCK
3389 && BLOCK_ABSTRACT_ORIGIN (block
))
3391 tree ao
= BLOCK_ABSTRACT_ORIGIN (block
);
3393 while (TREE_CODE (ao
) == BLOCK
3394 && BLOCK_ABSTRACT_ORIGIN (ao
)
3395 && BLOCK_ABSTRACT_ORIGIN (ao
) != ao
)
3396 ao
= BLOCK_ABSTRACT_ORIGIN (ao
);
3398 if (TREE_CODE (ao
) == FUNCTION_DECL
)
3400 *pp_ti_abstract_origin (text
) = block
;
3403 block
= BLOCK_SUPERCONTEXT (block
);
3407 /* Print the identifier ID to PRETTY-PRINTER. */
3410 pp_tree_identifier (pretty_printer
*pp
, tree id
)
3412 if (pp_translate_identifiers (pp
))
3414 const char *text
= identifier_to_locale (IDENTIFIER_POINTER (id
));
3415 pp_append_text (pp
, text
, text
+ strlen (text
));
3418 pp_append_text (pp
, IDENTIFIER_POINTER (id
),
3419 IDENTIFIER_POINTER (id
) + IDENTIFIER_LENGTH (id
));
3422 /* A helper function that is used to dump function information before the
3426 dump_function_header (FILE *dump_file
, tree fdecl
, int flags
)
3428 const char *dname
, *aname
;
3429 struct cgraph_node
*node
= cgraph_get_node (fdecl
);
3430 struct function
*fun
= DECL_STRUCT_FUNCTION (fdecl
);
3432 dname
= lang_hooks
.decl_printable_name (fdecl
, 2);
3434 if (DECL_ASSEMBLER_NAME_SET_P (fdecl
))
3435 aname
= (IDENTIFIER_POINTER
3436 (DECL_ASSEMBLER_NAME (fdecl
)));
3438 aname
= "<unset-asm-name>";
3440 fprintf (dump_file
, "\n;; Function %s (%s, funcdef_no=%d",
3441 dname
, aname
, fun
->funcdef_no
);
3442 if (!(flags
& TDF_NOUID
))
3443 fprintf (dump_file
, ", decl_uid=%d", DECL_UID (fdecl
));
3446 fprintf (dump_file
, ", symbol_order=%d)%s\n\n", node
->order
,
3447 node
->frequency
== NODE_FREQUENCY_HOT
3449 : node
->frequency
== NODE_FREQUENCY_UNLIKELY_EXECUTED
3450 ? " (unlikely executed)"
3451 : node
->frequency
== NODE_FREQUENCY_EXECUTED_ONCE
3452 ? " (executed once)"
3456 fprintf (dump_file
, ")\n\n");
3459 /* Dump double_int D to pretty_printer PP. UNS is true
3460 if D is unsigned and false otherwise. */
3462 pp_double_int (pretty_printer
*pp
, double_int d
, bool uns
)
3465 pp_wide_integer (pp
, d
.low
);
3466 else if (d
.fits_uhwi ())
3467 pp_unsigned_wide_integer (pp
, d
.low
);
3468 else if (HOST_BITS_PER_DOUBLE_INT
== HOST_BITS_PER_WIDEST_INT
)
3471 ? HOST_WIDEST_INT_PRINT_UNSIGNED
: HOST_WIDEST_INT_PRINT_DEC
,
3472 (HOST_WIDEST_INT
) ((((unsigned HOST_WIDEST_INT
) d
.high
<< 1)
3473 << (HOST_BITS_PER_WIDE_INT
- 1)) | d
.low
));
3476 unsigned HOST_WIDE_INT low
= d
.low
;
3477 HOST_WIDE_INT high
= d
.high
;
3478 if (!uns
&& d
.is_negative ())
3481 high
= ~high
+ !low
;
3484 /* Would "%x%0*x" or "%x%*0x" get zero-padding on all
3486 sprintf (pp_buffer (pp
)->digit_buffer
,
3487 HOST_WIDE_INT_PRINT_DOUBLE_HEX
,
3488 (unsigned HOST_WIDE_INT
) high
, low
);
3489 pp_string (pp
, pp_buffer (pp
)->digit_buffer
);