1 /* Pretty formatting of GENERIC trees in C syntax.
2 Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
3 2011 Free Software Foundation, Inc.
4 Adapted from c-pretty-print.c by Diego Novillo <dnovillo@redhat.com>
6 This file is part of GCC.
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 3, or (at your option) any later
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING3. If not see
20 <http://www.gnu.org/licenses/>. */
24 #include "coretypes.h"
28 #include "tree-pretty-print.h"
30 #include "tree-flow.h"
31 #include "langhooks.h"
32 #include "tree-iterator.h"
33 #include "tree-chrec.h"
34 #include "tree-pass.h"
35 #include "value-prof.h"
38 /* Local functions, macros and variables. */
39 static const char *op_symbol (const_tree
);
40 static void pretty_print_string (pretty_printer
*, const char*);
41 static void newline_and_indent (pretty_printer
*, int);
42 static void maybe_init_pretty_print (FILE *);
43 static void print_struct_decl (pretty_printer
*, const_tree
, int, int);
44 static void do_niy (pretty_printer
*, const_tree
);
46 #define INDENT(SPACE) do { \
47 int i; for (i = 0; i<SPACE; i++) pp_space (buffer); } while (0)
49 #define NIY do_niy(buffer,node)
51 static pretty_printer buffer
;
52 static int initialized
= 0;
54 /* Try to print something for an unknown tree code. */
57 do_niy (pretty_printer
*buffer
, const_tree node
)
61 pp_string (buffer
, "<<< Unknown tree: ");
62 pp_string (buffer
, tree_code_name
[(int) TREE_CODE (node
)]);
66 len
= TREE_OPERAND_LENGTH (node
);
67 for (i
= 0; i
< len
; ++i
)
69 newline_and_indent (buffer
, 2);
70 dump_generic_node (buffer
, TREE_OPERAND (node
, i
), 2, 0, false);
74 pp_string (buffer
, " >>>");
77 /* Debugging function to print out a generic expression. */
80 debug_generic_expr (tree t
)
82 print_generic_expr (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
);
83 fprintf (stderr
, "\n");
86 /* Debugging function to print out a generic statement. */
89 debug_generic_stmt (tree t
)
91 print_generic_stmt (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
);
92 fprintf (stderr
, "\n");
95 /* Debugging function to print out a chain of trees . */
98 debug_tree_chain (tree t
)
100 struct pointer_set_t
*seen
= pointer_set_create ();
104 print_generic_expr (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
|TDF_UID
);
105 fprintf (stderr
, " ");
107 if (pointer_set_insert (seen
, t
))
109 fprintf (stderr
, "... [cycled back to ");
110 print_generic_expr (stderr
, t
, TDF_VOPS
|TDF_MEMSYMS
|TDF_UID
);
111 fprintf (stderr
, "]");
115 fprintf (stderr
, "\n");
117 pointer_set_destroy (seen
);
120 /* Prints declaration DECL to the FILE with details specified by FLAGS. */
122 print_generic_decl (FILE *file
, tree decl
, int flags
)
124 maybe_init_pretty_print (file
);
125 print_declaration (&buffer
, decl
, 2, flags
);
126 pp_write_text_to_stream (&buffer
);
129 /* Print tree T, and its successors, on file FILE. FLAGS specifies details
130 to show in the dump. See TDF_* in tree-pass.h. */
133 print_generic_stmt (FILE *file
, tree t
, int flags
)
135 maybe_init_pretty_print (file
);
136 dump_generic_node (&buffer
, t
, 0, flags
, true);
140 /* Print tree T, and its successors, on file FILE. FLAGS specifies details
141 to show in the dump. See TDF_* in tree-pass.h. The output is indented by
145 print_generic_stmt_indented (FILE *file
, tree t
, int flags
, int indent
)
149 maybe_init_pretty_print (file
);
151 for (i
= 0; i
< indent
; i
++)
153 dump_generic_node (&buffer
, t
, indent
, flags
, true);
157 /* Print a single expression T on file FILE. FLAGS specifies details to show
158 in the dump. See TDF_* in tree-pass.h. */
161 print_generic_expr (FILE *file
, tree t
, int flags
)
163 maybe_init_pretty_print (file
);
164 dump_generic_node (&buffer
, t
, 0, flags
, false);
167 /* Dump the name of a _DECL node and its DECL_UID if TDF_UID is set
171 dump_decl_name (pretty_printer
*buffer
, tree node
, int flags
)
173 if (DECL_NAME (node
))
175 if ((flags
& TDF_ASMNAME
) && DECL_ASSEMBLER_NAME_SET_P (node
))
176 pp_tree_identifier (buffer
, DECL_ASSEMBLER_NAME (node
));
178 pp_tree_identifier (buffer
, DECL_NAME (node
));
180 if ((flags
& TDF_UID
) || DECL_NAME (node
) == NULL_TREE
)
182 if (TREE_CODE (node
) == LABEL_DECL
&& LABEL_DECL_UID (node
) != -1)
183 pp_printf (buffer
, "L.%d", (int) LABEL_DECL_UID (node
));
184 else if (TREE_CODE (node
) == DEBUG_EXPR_DECL
)
186 if (flags
& TDF_NOUID
)
187 pp_string (buffer
, "D#xxxx");
189 pp_printf (buffer
, "D#%i", DEBUG_TEMP_UID (node
));
193 char c
= TREE_CODE (node
) == CONST_DECL
? 'C' : 'D';
194 if (flags
& TDF_NOUID
)
195 pp_printf (buffer
, "%c.xxxx", c
);
197 pp_printf (buffer
, "%c.%u", c
, DECL_UID (node
));
200 if ((flags
& TDF_ALIAS
) && DECL_PT_UID (node
) != DECL_UID (node
))
202 if (flags
& TDF_NOUID
)
203 pp_printf (buffer
, "ptD.xxxx");
205 pp_printf (buffer
, "ptD.%u", DECL_PT_UID (node
));
209 /* Like the above, but used for pretty printing function calls. */
212 dump_function_name (pretty_printer
*buffer
, tree node
, int flags
)
214 if (TREE_CODE (node
) == NOP_EXPR
)
215 node
= TREE_OPERAND (node
, 0);
216 if (DECL_NAME (node
) && (flags
& TDF_ASMNAME
) == 0)
217 pp_string (buffer
, lang_hooks
.decl_printable_name (node
, 1));
219 dump_decl_name (buffer
, node
, flags
);
222 /* Dump a function declaration. NODE is the FUNCTION_TYPE. BUFFER, SPC and
223 FLAGS are as in dump_generic_node. */
226 dump_function_declaration (pretty_printer
*buffer
, tree node
,
229 bool wrote_arg
= false;
233 pp_character (buffer
, '(');
235 /* Print the argument types. */
236 arg
= TYPE_ARG_TYPES (node
);
237 while (arg
&& arg
!= void_list_node
&& arg
!= error_mark_node
)
241 pp_character (buffer
, ',');
245 dump_generic_node (buffer
, TREE_VALUE (arg
), spc
, flags
, false);
246 arg
= TREE_CHAIN (arg
);
249 /* Drop the trailing void_type_node if we had any previous argument. */
250 if (arg
== void_list_node
&& !wrote_arg
)
251 pp_string (buffer
, "void");
252 /* Properly dump vararg function types. */
253 else if (!arg
&& wrote_arg
)
254 pp_string (buffer
, ", ...");
255 /* Avoid printing any arg for unprototyped functions. */
257 pp_character (buffer
, ')');
260 /* Dump the domain associated with an array. */
263 dump_array_domain (pretty_printer
*buffer
, tree domain
, int spc
, int flags
)
265 pp_character (buffer
, '[');
268 tree min
= TYPE_MIN_VALUE (domain
);
269 tree max
= TYPE_MAX_VALUE (domain
);
272 && integer_zerop (min
)
273 && host_integerp (max
, 0))
274 pp_wide_integer (buffer
, TREE_INT_CST_LOW (max
) + 1);
278 dump_generic_node (buffer
, min
, spc
, flags
, false);
279 pp_character (buffer
, ':');
281 dump_generic_node (buffer
, max
, spc
, flags
, false);
285 pp_string (buffer
, "<unknown>");
286 pp_character (buffer
, ']');
290 /* Dump OpenMP clause CLAUSE. BUFFER, CLAUSE, SPC and FLAGS are as in
291 dump_generic_node. */
294 dump_omp_clause (pretty_printer
*buffer
, tree clause
, int spc
, int flags
)
298 switch (OMP_CLAUSE_CODE (clause
))
300 case OMP_CLAUSE_PRIVATE
:
303 case OMP_CLAUSE_SHARED
:
306 case OMP_CLAUSE_FIRSTPRIVATE
:
307 name
= "firstprivate";
309 case OMP_CLAUSE_LASTPRIVATE
:
310 name
= "lastprivate";
312 case OMP_CLAUSE_COPYIN
:
315 case OMP_CLAUSE_COPYPRIVATE
:
316 name
= "copyprivate";
319 pp_string (buffer
, name
);
320 pp_character (buffer
, '(');
321 dump_generic_node (buffer
, OMP_CLAUSE_DECL (clause
),
323 pp_character (buffer
, ')');
326 case OMP_CLAUSE_REDUCTION
:
327 pp_string (buffer
, "reduction(");
328 pp_string (buffer
, op_symbol_code (OMP_CLAUSE_REDUCTION_CODE (clause
)));
329 pp_character (buffer
, ':');
330 dump_generic_node (buffer
, OMP_CLAUSE_DECL (clause
),
332 pp_character (buffer
, ')');
336 pp_string (buffer
, "if(");
337 dump_generic_node (buffer
, OMP_CLAUSE_IF_EXPR (clause
),
339 pp_character (buffer
, ')');
342 case OMP_CLAUSE_NUM_THREADS
:
343 pp_string (buffer
, "num_threads(");
344 dump_generic_node (buffer
, OMP_CLAUSE_NUM_THREADS_EXPR (clause
),
346 pp_character (buffer
, ')');
349 case OMP_CLAUSE_NOWAIT
:
350 pp_string (buffer
, "nowait");
352 case OMP_CLAUSE_ORDERED
:
353 pp_string (buffer
, "ordered");
356 case OMP_CLAUSE_DEFAULT
:
357 pp_string (buffer
, "default(");
358 switch (OMP_CLAUSE_DEFAULT_KIND (clause
))
360 case OMP_CLAUSE_DEFAULT_UNSPECIFIED
:
362 case OMP_CLAUSE_DEFAULT_SHARED
:
363 pp_string (buffer
, "shared");
365 case OMP_CLAUSE_DEFAULT_NONE
:
366 pp_string (buffer
, "none");
368 case OMP_CLAUSE_DEFAULT_PRIVATE
:
369 pp_string (buffer
, "private");
371 case OMP_CLAUSE_DEFAULT_FIRSTPRIVATE
:
372 pp_string (buffer
, "firstprivate");
377 pp_character (buffer
, ')');
380 case OMP_CLAUSE_SCHEDULE
:
381 pp_string (buffer
, "schedule(");
382 switch (OMP_CLAUSE_SCHEDULE_KIND (clause
))
384 case OMP_CLAUSE_SCHEDULE_STATIC
:
385 pp_string (buffer
, "static");
387 case OMP_CLAUSE_SCHEDULE_DYNAMIC
:
388 pp_string (buffer
, "dynamic");
390 case OMP_CLAUSE_SCHEDULE_GUIDED
:
391 pp_string (buffer
, "guided");
393 case OMP_CLAUSE_SCHEDULE_RUNTIME
:
394 pp_string (buffer
, "runtime");
396 case OMP_CLAUSE_SCHEDULE_AUTO
:
397 pp_string (buffer
, "auto");
402 if (OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (clause
))
404 pp_character (buffer
, ',');
405 dump_generic_node (buffer
,
406 OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (clause
),
409 pp_character (buffer
, ')');
412 case OMP_CLAUSE_UNTIED
:
413 pp_string (buffer
, "untied");
416 case OMP_CLAUSE_COLLAPSE
:
417 pp_string (buffer
, "collapse(");
418 dump_generic_node (buffer
,
419 OMP_CLAUSE_COLLAPSE_EXPR (clause
),
421 pp_character (buffer
, ')');
424 case OMP_CLAUSE_FINAL
:
425 pp_string (buffer
, "final(");
426 dump_generic_node (buffer
, OMP_CLAUSE_FINAL_EXPR (clause
),
428 pp_character (buffer
, ')');
431 case OMP_CLAUSE_MERGEABLE
:
432 pp_string (buffer
, "mergeable");
436 /* Should never happen. */
437 dump_generic_node (buffer
, clause
, spc
, flags
, false);
443 /* Dump the list of OpenMP clauses. BUFFER, SPC and FLAGS are as in
444 dump_generic_node. */
447 dump_omp_clauses (pretty_printer
*buffer
, tree clause
, int spc
, int flags
)
455 dump_omp_clause (buffer
, clause
, spc
, flags
);
456 clause
= OMP_CLAUSE_CHAIN (clause
);
464 /* Dump location LOC to BUFFER. */
467 dump_location (pretty_printer
*buffer
, location_t loc
)
469 expanded_location xloc
= expand_location (loc
);
471 pp_character (buffer
, '[');
474 pp_string (buffer
, xloc
.file
);
475 pp_string (buffer
, " : ");
477 pp_decimal_int (buffer
, xloc
.line
);
478 pp_string (buffer
, "] ");
482 /* Dump lexical block BLOCK. BUFFER, SPC and FLAGS are as in
483 dump_generic_node. */
486 dump_block_node (pretty_printer
*buffer
, tree block
, int spc
, int flags
)
490 pp_printf (buffer
, "BLOCK #%d ", BLOCK_NUMBER (block
));
492 if (flags
& TDF_ADDRESS
)
493 pp_printf (buffer
, "[%p] ", (void *) block
);
495 if (BLOCK_ABSTRACT (block
))
496 pp_string (buffer
, "[abstract] ");
498 if (TREE_ASM_WRITTEN (block
))
499 pp_string (buffer
, "[written] ");
501 if (flags
& TDF_SLIM
)
504 if (BLOCK_SOURCE_LOCATION (block
))
505 dump_location (buffer
, BLOCK_SOURCE_LOCATION (block
));
507 newline_and_indent (buffer
, spc
+ 2);
509 if (BLOCK_SUPERCONTEXT (block
))
511 pp_string (buffer
, "SUPERCONTEXT: ");
512 dump_generic_node (buffer
, BLOCK_SUPERCONTEXT (block
), 0,
513 flags
| TDF_SLIM
, false);
514 newline_and_indent (buffer
, spc
+ 2);
517 if (BLOCK_SUBBLOCKS (block
))
519 pp_string (buffer
, "SUBBLOCKS: ");
520 for (t
= BLOCK_SUBBLOCKS (block
); t
; t
= BLOCK_CHAIN (t
))
522 dump_generic_node (buffer
, t
, 0, flags
| TDF_SLIM
, false);
523 pp_string (buffer
, " ");
525 newline_and_indent (buffer
, spc
+ 2);
528 if (BLOCK_CHAIN (block
))
530 pp_string (buffer
, "SIBLINGS: ");
531 for (t
= BLOCK_CHAIN (block
); t
; t
= BLOCK_CHAIN (t
))
533 dump_generic_node (buffer
, t
, 0, flags
| TDF_SLIM
, false);
534 pp_string (buffer
, " ");
536 newline_and_indent (buffer
, spc
+ 2);
539 if (BLOCK_VARS (block
))
541 pp_string (buffer
, "VARS: ");
542 for (t
= BLOCK_VARS (block
); t
; t
= TREE_CHAIN (t
))
544 dump_generic_node (buffer
, t
, 0, flags
, false);
545 pp_string (buffer
, " ");
547 newline_and_indent (buffer
, spc
+ 2);
550 if (VEC_length (tree
, BLOCK_NONLOCALIZED_VARS (block
)) > 0)
553 VEC(tree
,gc
) *nlv
= BLOCK_NONLOCALIZED_VARS (block
);
555 pp_string (buffer
, "NONLOCALIZED_VARS: ");
556 FOR_EACH_VEC_ELT (tree
, nlv
, i
, t
)
558 dump_generic_node (buffer
, t
, 0, flags
, false);
559 pp_string (buffer
, " ");
561 newline_and_indent (buffer
, spc
+ 2);
564 if (BLOCK_ABSTRACT_ORIGIN (block
))
566 pp_string (buffer
, "ABSTRACT_ORIGIN: ");
567 dump_generic_node (buffer
, BLOCK_ABSTRACT_ORIGIN (block
), 0,
568 flags
| TDF_SLIM
, false);
569 newline_and_indent (buffer
, spc
+ 2);
572 if (BLOCK_FRAGMENT_ORIGIN (block
))
574 pp_string (buffer
, "FRAGMENT_ORIGIN: ");
575 dump_generic_node (buffer
, BLOCK_FRAGMENT_ORIGIN (block
), 0,
576 flags
| TDF_SLIM
, false);
577 newline_and_indent (buffer
, spc
+ 2);
580 if (BLOCK_FRAGMENT_CHAIN (block
))
582 pp_string (buffer
, "FRAGMENT_CHAIN: ");
583 for (t
= BLOCK_FRAGMENT_CHAIN (block
); t
; t
= BLOCK_FRAGMENT_CHAIN (t
))
585 dump_generic_node (buffer
, t
, 0, flags
| TDF_SLIM
, false);
586 pp_string (buffer
, " ");
588 newline_and_indent (buffer
, spc
+ 2);
593 /* Dump the node NODE on the pretty_printer BUFFER, SPC spaces of
594 indent. FLAGS specifies details to show in the dump (see TDF_* in
595 tree-pass.h). If IS_STMT is true, the object printed is considered
596 to be a statement and it is terminated by ';' if appropriate. */
599 dump_generic_node (pretty_printer
*buffer
, tree node
, int spc
, int flags
,
607 if (node
== NULL_TREE
)
610 is_expr
= EXPR_P (node
);
612 if (is_stmt
&& (flags
& TDF_STMTADDR
))
613 pp_printf (buffer
, "<&%p> ", (void *)node
);
615 if ((flags
& TDF_LINENO
) && EXPR_HAS_LOCATION (node
))
616 dump_location (buffer
, EXPR_LOCATION (node
));
618 switch (TREE_CODE (node
))
621 pp_string (buffer
, "<<< error >>>");
624 case IDENTIFIER_NODE
:
625 pp_tree_identifier (buffer
, node
);
629 while (node
&& node
!= error_mark_node
)
631 if (TREE_PURPOSE (node
))
633 dump_generic_node (buffer
, TREE_PURPOSE (node
), spc
, flags
, false);
636 dump_generic_node (buffer
, TREE_VALUE (node
), spc
, flags
, false);
637 node
= TREE_CHAIN (node
);
638 if (node
&& TREE_CODE (node
) == TREE_LIST
)
640 pp_character (buffer
, ',');
647 dump_generic_node (buffer
, BINFO_TYPE (node
), spc
, flags
, false);
653 if (TREE_VEC_LENGTH (node
) > 0)
655 size_t len
= TREE_VEC_LENGTH (node
);
656 for (i
= 0; i
< len
- 1; i
++)
658 dump_generic_node (buffer
, TREE_VEC_ELT (node
, i
), spc
, flags
,
660 pp_character (buffer
, ',');
663 dump_generic_node (buffer
, TREE_VEC_ELT (node
, len
- 1), spc
,
672 case FIXED_POINT_TYPE
:
678 unsigned int quals
= TYPE_QUALS (node
);
679 enum tree_code_class tclass
;
681 if (quals
& TYPE_QUAL_CONST
)
682 pp_string (buffer
, "const ");
683 else if (quals
& TYPE_QUAL_VOLATILE
)
684 pp_string (buffer
, "volatile ");
685 else if (quals
& TYPE_QUAL_RESTRICT
)
686 pp_string (buffer
, "restrict ");
688 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
690 pp_string (buffer
, "<address-space-");
691 pp_decimal_int (buffer
, TYPE_ADDR_SPACE (node
));
692 pp_string (buffer
, "> ");
695 tclass
= TREE_CODE_CLASS (TREE_CODE (node
));
697 if (tclass
== tcc_declaration
)
699 if (DECL_NAME (node
))
700 dump_decl_name (buffer
, node
, flags
);
702 pp_string (buffer
, "<unnamed type decl>");
704 else if (tclass
== tcc_type
)
706 if (TYPE_NAME (node
))
708 if (TREE_CODE (TYPE_NAME (node
)) == IDENTIFIER_NODE
)
709 pp_tree_identifier (buffer
, TYPE_NAME (node
));
710 else if (TREE_CODE (TYPE_NAME (node
)) == TYPE_DECL
711 && DECL_NAME (TYPE_NAME (node
)))
712 dump_decl_name (buffer
, TYPE_NAME (node
), flags
);
714 pp_string (buffer
, "<unnamed type>");
716 else if (TREE_CODE (node
) == VECTOR_TYPE
)
718 pp_string (buffer
, "vector");
719 pp_character (buffer
, '(');
720 pp_wide_integer (buffer
, TYPE_VECTOR_SUBPARTS (node
));
721 pp_string (buffer
, ") ");
722 dump_generic_node (buffer
, TREE_TYPE (node
), spc
, flags
, false);
724 else if (TREE_CODE (node
) == INTEGER_TYPE
)
726 pp_string (buffer
, (TYPE_UNSIGNED (node
)
727 ? "<unnamed-unsigned:"
728 : "<unnamed-signed:"));
729 pp_decimal_int (buffer
, TYPE_PRECISION (node
));
730 pp_string (buffer
, ">");
732 else if (TREE_CODE (node
) == COMPLEX_TYPE
)
734 pp_string (buffer
, "__complex__ ");
735 dump_generic_node (buffer
, TREE_TYPE (node
), spc
, flags
, false);
737 else if (TREE_CODE (node
) == REAL_TYPE
)
739 pp_string (buffer
, "<float:");
740 pp_decimal_int (buffer
, TYPE_PRECISION (node
));
741 pp_string (buffer
, ">");
743 else if (TREE_CODE (node
) == FIXED_POINT_TYPE
)
745 pp_string (buffer
, "<fixed-point-");
746 pp_string (buffer
, TYPE_SATURATING (node
) ? "sat:" : "nonsat:");
747 pp_decimal_int (buffer
, TYPE_PRECISION (node
));
748 pp_string (buffer
, ">");
750 else if (TREE_CODE (node
) == VOID_TYPE
)
751 pp_string (buffer
, "void");
753 pp_string (buffer
, "<unnamed type>");
760 str
= (TREE_CODE (node
) == POINTER_TYPE
? "*" : "&");
762 if (TREE_TYPE (node
) == NULL
)
764 pp_string (buffer
, str
);
765 pp_string (buffer
, "<null type>");
767 else if (TREE_CODE (TREE_TYPE (node
)) == FUNCTION_TYPE
)
769 tree fnode
= TREE_TYPE (node
);
771 dump_generic_node (buffer
, TREE_TYPE (fnode
), spc
, flags
, false);
773 pp_character (buffer
, '(');
774 pp_string (buffer
, str
);
775 if (TYPE_NAME (node
) && DECL_NAME (TYPE_NAME (node
)))
776 dump_decl_name (buffer
, TYPE_NAME (node
), flags
);
777 else if (flags
& TDF_NOUID
)
778 pp_printf (buffer
, "<Txxxx>");
780 pp_printf (buffer
, "<T%x>", TYPE_UID (node
));
782 pp_character (buffer
, ')');
783 dump_function_declaration (buffer
, fnode
, spc
, flags
);
787 unsigned int quals
= TYPE_QUALS (node
);
789 dump_generic_node (buffer
, TREE_TYPE (node
), spc
, flags
, false);
791 pp_string (buffer
, str
);
793 if (quals
& TYPE_QUAL_CONST
)
794 pp_string (buffer
, " const");
795 if (quals
& TYPE_QUAL_VOLATILE
)
796 pp_string (buffer
, " volatile");
797 if (quals
& TYPE_QUAL_RESTRICT
)
798 pp_string (buffer
, " restrict");
800 if (!ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (node
)))
802 pp_string (buffer
, " <address-space-");
803 pp_decimal_int (buffer
, TYPE_ADDR_SPACE (node
));
804 pp_string (buffer
, ">");
807 if (TYPE_REF_CAN_ALIAS_ALL (node
))
808 pp_string (buffer
, " {ref-all}");
818 if (integer_zerop (TREE_OPERAND (node
, 1))
819 /* Dump the types of INTEGER_CSTs explicitly, for we can't
820 infer them and MEM_ATTR caching will share MEM_REFs
821 with differently-typed op0s. */
822 && TREE_CODE (TREE_OPERAND (node
, 0)) != INTEGER_CST
823 /* Released SSA_NAMES have no TREE_TYPE. */
824 && TREE_TYPE (TREE_OPERAND (node
, 0)) != NULL_TREE
825 /* Same pointer types, but ignoring POINTER_TYPE vs.
827 && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 0)))
828 == TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 1))))
829 && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (node
, 0)))
830 == TYPE_MODE (TREE_TYPE (TREE_OPERAND (node
, 1))))
831 && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node
, 0)))
832 == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (node
, 1))))
833 /* Same value types ignoring qualifiers. */
834 && (TYPE_MAIN_VARIANT (TREE_TYPE (node
))
836 (TREE_TYPE (TREE_TYPE (TREE_OPERAND (node
, 1))))))
838 if (TREE_CODE (TREE_OPERAND (node
, 0)) != ADDR_EXPR
)
840 pp_string (buffer
, "*");
841 dump_generic_node (buffer
, TREE_OPERAND (node
, 0),
845 dump_generic_node (buffer
,
846 TREE_OPERAND (TREE_OPERAND (node
, 0), 0),
853 pp_string (buffer
, "MEM[");
854 pp_string (buffer
, "(");
855 ptype
= TYPE_MAIN_VARIANT (TREE_TYPE (TREE_OPERAND (node
, 1)));
856 dump_generic_node (buffer
, ptype
,
857 spc
, flags
| TDF_SLIM
, false);
858 pp_string (buffer
, ")");
859 dump_generic_node (buffer
, TREE_OPERAND (node
, 0),
861 if (!integer_zerop (TREE_OPERAND (node
, 1)))
863 pp_string (buffer
, " + ");
864 dump_generic_node (buffer
, TREE_OPERAND (node
, 1),
867 pp_string (buffer
, "]");
874 const char *sep
= "";
877 pp_string (buffer
, "MEM[");
879 if (TREE_CODE (TMR_BASE (node
)) == ADDR_EXPR
)
881 pp_string (buffer
, sep
);
883 pp_string (buffer
, "symbol: ");
884 dump_generic_node (buffer
, TREE_OPERAND (TMR_BASE (node
), 0),
889 pp_string (buffer
, sep
);
891 pp_string (buffer
, "base: ");
892 dump_generic_node (buffer
, TMR_BASE (node
), spc
, flags
, false);
894 tmp
= TMR_INDEX2 (node
);
897 pp_string (buffer
, sep
);
899 pp_string (buffer
, "base: ");
900 dump_generic_node (buffer
, tmp
, spc
, flags
, false);
902 tmp
= TMR_INDEX (node
);
905 pp_string (buffer
, sep
);
907 pp_string (buffer
, "index: ");
908 dump_generic_node (buffer
, tmp
, spc
, flags
, false);
910 tmp
= TMR_STEP (node
);
913 pp_string (buffer
, sep
);
915 pp_string (buffer
, "step: ");
916 dump_generic_node (buffer
, tmp
, spc
, flags
, false);
918 tmp
= TMR_OFFSET (node
);
921 pp_string (buffer
, sep
);
923 pp_string (buffer
, "offset: ");
924 dump_generic_node (buffer
, tmp
, spc
, flags
, false);
926 pp_string (buffer
, "]");
934 /* Print the innermost component type. */
935 for (tmp
= TREE_TYPE (node
); TREE_CODE (tmp
) == ARRAY_TYPE
;
936 tmp
= TREE_TYPE (tmp
))
938 dump_generic_node (buffer
, tmp
, spc
, flags
, false);
940 /* Print the dimensions. */
941 for (tmp
= node
; TREE_CODE (tmp
) == ARRAY_TYPE
; tmp
= TREE_TYPE (tmp
))
942 dump_array_domain (buffer
, TYPE_DOMAIN (tmp
), spc
, flags
);
948 case QUAL_UNION_TYPE
:
950 unsigned int quals
= TYPE_QUALS (node
);
952 if (quals
& TYPE_QUAL_CONST
)
953 pp_string (buffer
, "const ");
954 if (quals
& TYPE_QUAL_VOLATILE
)
955 pp_string (buffer
, "volatile ");
957 /* Print the name of the structure. */
958 if (TREE_CODE (node
) == RECORD_TYPE
)
959 pp_string (buffer
, "struct ");
960 else if (TREE_CODE (node
) == UNION_TYPE
)
961 pp_string (buffer
, "union ");
963 if (TYPE_NAME (node
))
964 dump_generic_node (buffer
, TYPE_NAME (node
), spc
, flags
, false);
965 else if (!(flags
& TDF_SLIM
))
966 /* FIXME: If we eliminate the 'else' above and attempt
967 to show the fields for named types, we may get stuck
968 following a cycle of pointers to structs. The alleged
969 self-reference check in print_struct_decl will not detect
970 cycles involving more than one pointer or struct type. */
971 print_struct_decl (buffer
, node
, spc
, flags
);
980 if (TREE_CODE (TREE_TYPE (node
)) == POINTER_TYPE
)
982 /* In the case of a pointer, one may want to divide by the
983 size of the pointed-to type. Unfortunately, this not
984 straightforward. The C front-end maps expressions
989 in such a way that the two INTEGER_CST nodes for "5" have
990 different values but identical types. In the latter
991 case, the 5 is multiplied by sizeof (int) in c-common.c
992 (pointer_int_sum) to convert it to a byte address, and
993 yet the type of the node is left unchanged. Argh. What
994 is consistent though is that the number value corresponds
995 to bytes (UNITS) offset.
997 NB: Neither of the following divisors can be trivially
998 used to recover the original literal:
1000 TREE_INT_CST_LOW (TYPE_SIZE_UNIT (TREE_TYPE (node)))
1001 TYPE_PRECISION (TREE_TYPE (TREE_TYPE (node))) */
1002 pp_wide_integer (buffer
, TREE_INT_CST_LOW (node
));
1003 pp_string (buffer
, "B"); /* pseudo-unit */
1005 else if (host_integerp (node
, 0))
1006 pp_wide_integer (buffer
, TREE_INT_CST_LOW (node
));
1007 else if (host_integerp (node
, 1))
1008 pp_unsigned_wide_integer (buffer
, TREE_INT_CST_LOW (node
));
1012 unsigned HOST_WIDE_INT low
= TREE_INT_CST_LOW (val
);
1013 HOST_WIDE_INT high
= TREE_INT_CST_HIGH (val
);
1015 if (tree_int_cst_sgn (val
) < 0)
1017 pp_character (buffer
, '-');
1018 high
= ~high
+ !low
;
1021 /* Would "%x%0*x" or "%x%*0x" get zero-padding on all
1023 sprintf (pp_buffer (buffer
)->digit_buffer
,
1024 HOST_WIDE_INT_PRINT_DOUBLE_HEX
,
1025 (unsigned HOST_WIDE_INT
) high
, low
);
1026 pp_string (buffer
, pp_buffer (buffer
)->digit_buffer
);
1031 /* Code copied from print_node. */
1034 if (TREE_OVERFLOW (node
))
1035 pp_string (buffer
, " overflow");
1037 #if !defined(REAL_IS_NOT_DOUBLE) || defined(REAL_ARITHMETIC)
1038 d
= TREE_REAL_CST (node
);
1039 if (REAL_VALUE_ISINF (d
))
1040 pp_string (buffer
, REAL_VALUE_NEGATIVE (d
) ? " -Inf" : " Inf");
1041 else if (REAL_VALUE_ISNAN (d
))
1042 pp_string (buffer
, " Nan");
1046 real_to_decimal (string
, &d
, sizeof (string
), 0, 1);
1047 pp_string (buffer
, string
);
1052 unsigned char *p
= (unsigned char *) &TREE_REAL_CST (node
);
1053 pp_string (buffer
, "0x");
1054 for (i
= 0; i
< sizeof TREE_REAL_CST (node
); i
++)
1055 output_formatted_integer (buffer
, "%02x", *p
++);
1064 fixed_to_decimal (string
, TREE_FIXED_CST_PTR (node
), sizeof (string
));
1065 pp_string (buffer
, string
);
1070 pp_string (buffer
, "__complex__ (");
1071 dump_generic_node (buffer
, TREE_REALPART (node
), spc
, flags
, false);
1072 pp_string (buffer
, ", ");
1073 dump_generic_node (buffer
, TREE_IMAGPART (node
), spc
, flags
, false);
1074 pp_string (buffer
, ")");
1078 pp_string (buffer
, "\"");
1079 pretty_print_string (buffer
, TREE_STRING_POINTER (node
));
1080 pp_string (buffer
, "\"");
1086 pp_string (buffer
, "{ ");
1087 for (elt
= TREE_VECTOR_CST_ELTS (node
); elt
; elt
= TREE_CHAIN (elt
))
1089 dump_generic_node (buffer
, TREE_VALUE (elt
), spc
, flags
, false);
1090 if (TREE_CHAIN (elt
))
1091 pp_string (buffer
, ", ");
1093 pp_string (buffer
, " }");
1099 dump_generic_node (buffer
, TREE_TYPE (node
), spc
, flags
, false);
1101 if (TREE_CODE (node
) == METHOD_TYPE
)
1103 if (TYPE_METHOD_BASETYPE (node
))
1104 dump_decl_name (buffer
, TYPE_NAME (TYPE_METHOD_BASETYPE (node
)),
1107 pp_string (buffer
, "<null method basetype>");
1108 pp_string (buffer
, "::");
1110 if (TYPE_NAME (node
) && DECL_NAME (TYPE_NAME (node
)))
1111 dump_decl_name (buffer
, TYPE_NAME (node
), flags
);
1112 else if (flags
& TDF_NOUID
)
1113 pp_printf (buffer
, "<Txxxx>");
1115 pp_printf (buffer
, "<T%x>", TYPE_UID (node
));
1116 dump_function_declaration (buffer
, node
, spc
, flags
);
1121 dump_decl_name (buffer
, node
, flags
);
1125 if (DECL_NAME (node
))
1126 dump_decl_name (buffer
, node
, flags
);
1127 else if (LABEL_DECL_UID (node
) != -1)
1128 pp_printf (buffer
, "<L%d>", (int) LABEL_DECL_UID (node
));
1131 if (flags
& TDF_NOUID
)
1132 pp_string (buffer
, "<D.xxxx>");
1134 pp_printf (buffer
, "<D.%u>", DECL_UID (node
));
1139 if (DECL_IS_BUILTIN (node
))
1141 /* Don't print the declaration of built-in types. */
1144 if (DECL_NAME (node
))
1145 dump_decl_name (buffer
, node
, flags
);
1146 else if (TYPE_NAME (TREE_TYPE (node
)) != node
)
1148 if ((TREE_CODE (TREE_TYPE (node
)) == RECORD_TYPE
1149 || TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
)
1150 && TYPE_METHODS (TREE_TYPE (node
)))
1152 /* The type is a c++ class: all structures have at least
1154 pp_string (buffer
, "class ");
1155 dump_generic_node (buffer
, TREE_TYPE (node
), spc
, flags
, false);
1160 (TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
1161 ? "union" : "struct "));
1162 dump_generic_node (buffer
, TREE_TYPE (node
), spc
, flags
, false);
1166 pp_string (buffer
, "<anon>");
1172 case DEBUG_EXPR_DECL
:
1173 case NAMESPACE_DECL
:
1174 dump_decl_name (buffer
, node
, flags
);
1178 pp_string (buffer
, "<retval>");
1182 op0
= TREE_OPERAND (node
, 0);
1185 && (TREE_CODE (op0
) == INDIRECT_REF
1186 || (TREE_CODE (op0
) == MEM_REF
1187 && TREE_CODE (TREE_OPERAND (op0
, 0)) != ADDR_EXPR
1188 && integer_zerop (TREE_OPERAND (op0
, 1))
1189 /* Dump the types of INTEGER_CSTs explicitly, for we
1190 can't infer them and MEM_ATTR caching will share
1191 MEM_REFs with differently-typed op0s. */
1192 && TREE_CODE (TREE_OPERAND (op0
, 0)) != INTEGER_CST
1193 /* Released SSA_NAMES have no TREE_TYPE. */
1194 && TREE_TYPE (TREE_OPERAND (op0
, 0)) != NULL_TREE
1195 /* Same pointer types, but ignoring POINTER_TYPE vs.
1197 && (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 0)))
1198 == TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 1))))
1199 && (TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0
, 0)))
1200 == TYPE_MODE (TREE_TYPE (TREE_OPERAND (op0
, 1))))
1201 && (TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0
, 0)))
1202 == TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (TREE_OPERAND (op0
, 1))))
1203 /* Same value types ignoring qualifiers. */
1204 && (TYPE_MAIN_VARIANT (TREE_TYPE (op0
))
1205 == TYPE_MAIN_VARIANT
1206 (TREE_TYPE (TREE_TYPE (TREE_OPERAND (op0
, 1))))))))
1208 op0
= TREE_OPERAND (op0
, 0);
1211 if (op_prio (op0
) < op_prio (node
))
1212 pp_character (buffer
, '(');
1213 dump_generic_node (buffer
, op0
, spc
, flags
, false);
1214 if (op_prio (op0
) < op_prio (node
))
1215 pp_character (buffer
, ')');
1216 pp_string (buffer
, str
);
1217 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1218 op0
= component_ref_field_offset (node
);
1219 if (op0
&& TREE_CODE (op0
) != INTEGER_CST
)
1221 pp_string (buffer
, "{off: ");
1222 dump_generic_node (buffer
, op0
, spc
, flags
, false);
1223 pp_character (buffer
, '}');
1228 pp_string (buffer
, "BIT_FIELD_REF <");
1229 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1230 pp_string (buffer
, ", ");
1231 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1232 pp_string (buffer
, ", ");
1233 dump_generic_node (buffer
, TREE_OPERAND (node
, 2), spc
, flags
, false);
1234 pp_string (buffer
, ">");
1238 case ARRAY_RANGE_REF
:
1239 op0
= TREE_OPERAND (node
, 0);
1240 if (op_prio (op0
) < op_prio (node
))
1241 pp_character (buffer
, '(');
1242 dump_generic_node (buffer
, op0
, spc
, flags
, false);
1243 if (op_prio (op0
) < op_prio (node
))
1244 pp_character (buffer
, ')');
1245 pp_character (buffer
, '[');
1246 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1247 if (TREE_CODE (node
) == ARRAY_RANGE_REF
)
1248 pp_string (buffer
, " ...");
1249 pp_character (buffer
, ']');
1251 op0
= array_ref_low_bound (node
);
1252 op1
= array_ref_element_size (node
);
1254 if (!integer_zerop (op0
)
1255 || TREE_OPERAND (node
, 2)
1256 || TREE_OPERAND (node
, 3))
1258 pp_string (buffer
, "{lb: ");
1259 dump_generic_node (buffer
, op0
, spc
, flags
, false);
1260 pp_string (buffer
, " sz: ");
1261 dump_generic_node (buffer
, op1
, spc
, flags
, false);
1262 pp_character (buffer
, '}');
1268 unsigned HOST_WIDE_INT ix
;
1270 bool is_struct_init
= false;
1271 bool is_array_init
= false;
1272 double_int curidx
= double_int_zero
;
1273 pp_character (buffer
, '{');
1274 if (TREE_CODE (TREE_TYPE (node
)) == RECORD_TYPE
1275 || TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
)
1276 is_struct_init
= true;
1277 else if (TREE_CODE (TREE_TYPE (node
)) == ARRAY_TYPE
1278 && TYPE_DOMAIN (TREE_TYPE (node
))
1279 && TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
)))
1280 && TREE_CODE (TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
))))
1283 tree minv
= TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node
)));
1284 is_array_init
= true;
1285 curidx
= tree_to_double_int (minv
);
1287 FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (node
), ix
, field
, val
)
1293 pp_character (buffer
, '.');
1294 dump_generic_node (buffer
, field
, spc
, flags
, false);
1295 pp_character (buffer
, '=');
1297 else if (is_array_init
1298 && (TREE_CODE (field
) != INTEGER_CST
1299 || !double_int_equal_p (tree_to_double_int (field
),
1302 pp_character (buffer
, '[');
1303 if (TREE_CODE (field
) == RANGE_EXPR
)
1305 dump_generic_node (buffer
, TREE_OPERAND (field
, 0), spc
,
1307 pp_string (buffer
, " ... ");
1308 dump_generic_node (buffer
, TREE_OPERAND (field
, 1), spc
,
1310 if (TREE_CODE (TREE_OPERAND (field
, 1)) == INTEGER_CST
)
1311 curidx
= tree_to_double_int (TREE_OPERAND (field
, 1));
1314 dump_generic_node (buffer
, field
, spc
, flags
, false);
1315 if (TREE_CODE (field
) == INTEGER_CST
)
1316 curidx
= tree_to_double_int (field
);
1317 pp_string (buffer
, "]=");
1321 curidx
= double_int_add (curidx
, double_int_one
);
1322 if (val
&& TREE_CODE (val
) == ADDR_EXPR
)
1323 if (TREE_CODE (TREE_OPERAND (val
, 0)) == FUNCTION_DECL
)
1324 val
= TREE_OPERAND (val
, 0);
1325 if (val
&& TREE_CODE (val
) == FUNCTION_DECL
)
1326 dump_decl_name (buffer
, val
, flags
);
1328 dump_generic_node (buffer
, val
, spc
, flags
, false);
1329 if (ix
!= VEC_length (constructor_elt
, CONSTRUCTOR_ELTS (node
)) - 1)
1331 pp_character (buffer
, ',');
1335 pp_character (buffer
, '}');
1342 if (flags
& TDF_SLIM
)
1344 pp_string (buffer
, "<COMPOUND_EXPR>");
1348 dump_generic_node (buffer
, TREE_OPERAND (node
, 0),
1349 spc
, flags
, !(flags
& TDF_SLIM
));
1350 if (flags
& TDF_SLIM
)
1351 newline_and_indent (buffer
, spc
);
1354 pp_character (buffer
, ',');
1358 for (tp
= &TREE_OPERAND (node
, 1);
1359 TREE_CODE (*tp
) == COMPOUND_EXPR
;
1360 tp
= &TREE_OPERAND (*tp
, 1))
1362 dump_generic_node (buffer
, TREE_OPERAND (*tp
, 0),
1363 spc
, flags
, !(flags
& TDF_SLIM
));
1364 if (flags
& TDF_SLIM
)
1365 newline_and_indent (buffer
, spc
);
1368 pp_character (buffer
, ',');
1373 dump_generic_node (buffer
, *tp
, spc
, flags
, !(flags
& TDF_SLIM
));
1377 case STATEMENT_LIST
:
1379 tree_stmt_iterator si
;
1382 if (flags
& TDF_SLIM
)
1384 pp_string (buffer
, "<STATEMENT_LIST>");
1388 for (si
= tsi_start (node
); !tsi_end_p (si
); tsi_next (&si
))
1391 newline_and_indent (buffer
, spc
);
1394 dump_generic_node (buffer
, tsi_stmt (si
), spc
, flags
, true);
1401 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
,
1404 pp_character (buffer
, '=');
1405 if (TREE_CODE (node
) == MODIFY_EXPR
1406 && MOVE_NONTEMPORAL (node
))
1407 pp_string (buffer
, "{nt}");
1409 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
,
1414 pp_string (buffer
, "TARGET_EXPR <");
1415 dump_generic_node (buffer
, TARGET_EXPR_SLOT (node
), spc
, flags
, false);
1416 pp_character (buffer
, ',');
1418 dump_generic_node (buffer
, TARGET_EXPR_INITIAL (node
), spc
, flags
, false);
1419 pp_character (buffer
, '>');
1423 print_declaration (buffer
, DECL_EXPR_DECL (node
), spc
, flags
);
1428 if (TREE_TYPE (node
) == NULL
|| TREE_TYPE (node
) == void_type_node
)
1430 pp_string (buffer
, "if (");
1431 dump_generic_node (buffer
, COND_EXPR_COND (node
), spc
, flags
, false);
1432 pp_character (buffer
, ')');
1433 /* The lowered cond_exprs should always be printed in full. */
1434 if (COND_EXPR_THEN (node
)
1435 && (IS_EMPTY_STMT (COND_EXPR_THEN (node
))
1436 || TREE_CODE (COND_EXPR_THEN (node
)) == GOTO_EXPR
)
1437 && COND_EXPR_ELSE (node
)
1438 && (IS_EMPTY_STMT (COND_EXPR_ELSE (node
))
1439 || TREE_CODE (COND_EXPR_ELSE (node
)) == GOTO_EXPR
))
1442 dump_generic_node (buffer
, COND_EXPR_THEN (node
),
1444 if (!IS_EMPTY_STMT (COND_EXPR_ELSE (node
)))
1446 pp_string (buffer
, " else ");
1447 dump_generic_node (buffer
, COND_EXPR_ELSE (node
),
1451 else if (!(flags
& TDF_SLIM
))
1453 /* Output COND_EXPR_THEN. */
1454 if (COND_EXPR_THEN (node
))
1456 newline_and_indent (buffer
, spc
+2);
1457 pp_character (buffer
, '{');
1458 newline_and_indent (buffer
, spc
+4);
1459 dump_generic_node (buffer
, COND_EXPR_THEN (node
), spc
+4,
1461 newline_and_indent (buffer
, spc
+2);
1462 pp_character (buffer
, '}');
1465 /* Output COND_EXPR_ELSE. */
1466 if (COND_EXPR_ELSE (node
)
1467 && !IS_EMPTY_STMT (COND_EXPR_ELSE (node
)))
1469 newline_and_indent (buffer
, spc
);
1470 pp_string (buffer
, "else");
1471 newline_and_indent (buffer
, spc
+2);
1472 pp_character (buffer
, '{');
1473 newline_and_indent (buffer
, spc
+4);
1474 dump_generic_node (buffer
, COND_EXPR_ELSE (node
), spc
+4,
1476 newline_and_indent (buffer
, spc
+2);
1477 pp_character (buffer
, '}');
1484 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1486 pp_character (buffer
, '?');
1488 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1490 pp_character (buffer
, ':');
1492 dump_generic_node (buffer
, TREE_OPERAND (node
, 2), spc
, flags
, false);
1497 pp_character (buffer
, '{');
1498 if (!(flags
& TDF_SLIM
))
1500 if (BIND_EXPR_VARS (node
))
1502 pp_newline (buffer
);
1504 for (op0
= BIND_EXPR_VARS (node
); op0
; op0
= DECL_CHAIN (op0
))
1506 print_declaration (buffer
, op0
, spc
+2, flags
);
1507 pp_newline (buffer
);
1511 newline_and_indent (buffer
, spc
+2);
1512 dump_generic_node (buffer
, BIND_EXPR_BODY (node
), spc
+2, flags
, true);
1513 newline_and_indent (buffer
, spc
);
1514 pp_character (buffer
, '}');
1520 print_call_name (buffer
, CALL_EXPR_FN (node
), flags
);
1522 /* Print parameters. */
1524 pp_character (buffer
, '(');
1527 call_expr_arg_iterator iter
;
1528 FOR_EACH_CALL_EXPR_ARG (arg
, iter
, node
)
1530 dump_generic_node (buffer
, arg
, spc
, flags
, false);
1531 if (more_call_expr_args_p (&iter
))
1533 pp_character (buffer
, ',');
1538 if (CALL_EXPR_VA_ARG_PACK (node
))
1540 if (call_expr_nargs (node
) > 0)
1542 pp_character (buffer
, ',');
1545 pp_string (buffer
, "__builtin_va_arg_pack ()");
1547 pp_character (buffer
, ')');
1549 op1
= CALL_EXPR_STATIC_CHAIN (node
);
1552 pp_string (buffer
, " [static-chain: ");
1553 dump_generic_node (buffer
, op1
, spc
, flags
, false);
1554 pp_character (buffer
, ']');
1557 if (CALL_EXPR_RETURN_SLOT_OPT (node
))
1558 pp_string (buffer
, " [return slot optimization]");
1559 if (CALL_EXPR_TAILCALL (node
))
1560 pp_string (buffer
, " [tail call]");
1563 case WITH_CLEANUP_EXPR
:
1567 case CLEANUP_POINT_EXPR
:
1568 pp_string (buffer
, "<<cleanup_point ");
1569 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1570 pp_string (buffer
, ">>");
1573 case PLACEHOLDER_EXPR
:
1574 pp_string (buffer
, "<PLACEHOLDER_EXPR ");
1575 dump_generic_node (buffer
, TREE_TYPE (node
), spc
, flags
, false);
1576 pp_character (buffer
, '>');
1579 /* Binary arithmetic and logic expressions. */
1580 case WIDEN_SUM_EXPR
:
1581 case WIDEN_MULT_EXPR
:
1584 case POINTER_PLUS_EXPR
:
1586 case TRUNC_DIV_EXPR
:
1588 case FLOOR_DIV_EXPR
:
1589 case ROUND_DIV_EXPR
:
1590 case TRUNC_MOD_EXPR
:
1592 case FLOOR_MOD_EXPR
:
1593 case ROUND_MOD_EXPR
:
1595 case EXACT_DIV_EXPR
:
1600 case VEC_LSHIFT_EXPR
:
1601 case VEC_RSHIFT_EXPR
:
1602 case WIDEN_LSHIFT_EXPR
:
1606 case TRUTH_ANDIF_EXPR
:
1607 case TRUTH_ORIF_EXPR
:
1608 case TRUTH_AND_EXPR
:
1610 case TRUTH_XOR_EXPR
:
1624 case UNORDERED_EXPR
:
1626 const char *op
= op_symbol (node
);
1627 op0
= TREE_OPERAND (node
, 0);
1628 op1
= TREE_OPERAND (node
, 1);
1630 /* When the operands are expressions with less priority,
1631 keep semantics of the tree representation. */
1632 if (op_prio (op0
) <= op_prio (node
))
1634 pp_character (buffer
, '(');
1635 dump_generic_node (buffer
, op0
, spc
, flags
, false);
1636 pp_character (buffer
, ')');
1639 dump_generic_node (buffer
, op0
, spc
, flags
, false);
1642 pp_string (buffer
, op
);
1645 /* When the operands are expressions with less priority,
1646 keep semantics of the tree representation. */
1647 if (op_prio (op1
) <= op_prio (node
))
1649 pp_character (buffer
, '(');
1650 dump_generic_node (buffer
, op1
, spc
, flags
, false);
1651 pp_character (buffer
, ')');
1654 dump_generic_node (buffer
, op1
, spc
, flags
, false);
1658 /* Unary arithmetic and logic expressions. */
1661 case TRUTH_NOT_EXPR
:
1663 case PREDECREMENT_EXPR
:
1664 case PREINCREMENT_EXPR
:
1666 if (TREE_CODE (node
) == ADDR_EXPR
1667 && (TREE_CODE (TREE_OPERAND (node
, 0)) == STRING_CST
1668 || TREE_CODE (TREE_OPERAND (node
, 0)) == FUNCTION_DECL
))
1669 ; /* Do not output '&' for strings and function pointers. */
1671 pp_string (buffer
, op_symbol (node
));
1673 if (op_prio (TREE_OPERAND (node
, 0)) < op_prio (node
))
1675 pp_character (buffer
, '(');
1676 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1677 pp_character (buffer
, ')');
1680 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1683 case POSTDECREMENT_EXPR
:
1684 case POSTINCREMENT_EXPR
:
1685 if (op_prio (TREE_OPERAND (node
, 0)) < op_prio (node
))
1687 pp_character (buffer
, '(');
1688 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1689 pp_character (buffer
, ')');
1692 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1693 pp_string (buffer
, op_symbol (node
));
1697 pp_string (buffer
, "MIN_EXPR <");
1698 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1699 pp_string (buffer
, ", ");
1700 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1701 pp_character (buffer
, '>');
1705 pp_string (buffer
, "MAX_EXPR <");
1706 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1707 pp_string (buffer
, ", ");
1708 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1709 pp_character (buffer
, '>');
1713 pp_string (buffer
, "ABS_EXPR <");
1714 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1715 pp_character (buffer
, '>');
1722 case ADDR_SPACE_CONVERT_EXPR
:
1723 case FIXED_CONVERT_EXPR
:
1724 case FIX_TRUNC_EXPR
:
1727 type
= TREE_TYPE (node
);
1728 op0
= TREE_OPERAND (node
, 0);
1729 if (type
!= TREE_TYPE (op0
))
1731 pp_character (buffer
, '(');
1732 dump_generic_node (buffer
, type
, spc
, flags
, false);
1733 pp_string (buffer
, ") ");
1735 if (op_prio (op0
) < op_prio (node
))
1736 pp_character (buffer
, '(');
1737 dump_generic_node (buffer
, op0
, spc
, flags
, false);
1738 if (op_prio (op0
) < op_prio (node
))
1739 pp_character (buffer
, ')');
1742 case VIEW_CONVERT_EXPR
:
1743 pp_string (buffer
, "VIEW_CONVERT_EXPR<");
1744 dump_generic_node (buffer
, TREE_TYPE (node
), spc
, flags
, false);
1745 pp_string (buffer
, ">(");
1746 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1747 pp_character (buffer
, ')');
1751 pp_string (buffer
, "((");
1752 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1753 pp_string (buffer
, "))");
1756 case NON_LVALUE_EXPR
:
1757 pp_string (buffer
, "NON_LVALUE_EXPR <");
1758 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1759 pp_character (buffer
, '>');
1763 pp_string (buffer
, "SAVE_EXPR <");
1764 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1765 pp_character (buffer
, '>');
1769 pp_string (buffer
, "COMPLEX_EXPR <");
1770 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1771 pp_string (buffer
, ", ");
1772 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1773 pp_string (buffer
, ">");
1777 pp_string (buffer
, "CONJ_EXPR <");
1778 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1779 pp_string (buffer
, ">");
1783 pp_string (buffer
, "REALPART_EXPR <");
1784 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1785 pp_string (buffer
, ">");
1789 pp_string (buffer
, "IMAGPART_EXPR <");
1790 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1791 pp_string (buffer
, ">");
1795 pp_string (buffer
, "VA_ARG_EXPR <");
1796 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1797 pp_string (buffer
, ">");
1800 case TRY_FINALLY_EXPR
:
1801 case TRY_CATCH_EXPR
:
1802 pp_string (buffer
, "try");
1803 newline_and_indent (buffer
, spc
+2);
1804 pp_string (buffer
, "{");
1805 newline_and_indent (buffer
, spc
+4);
1806 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
+4, flags
, true);
1807 newline_and_indent (buffer
, spc
+2);
1808 pp_string (buffer
, "}");
1809 newline_and_indent (buffer
, spc
);
1811 (TREE_CODE (node
) == TRY_CATCH_EXPR
) ? "catch" : "finally");
1812 newline_and_indent (buffer
, spc
+2);
1813 pp_string (buffer
, "{");
1814 newline_and_indent (buffer
, spc
+4);
1815 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
+4, flags
, true);
1816 newline_and_indent (buffer
, spc
+2);
1817 pp_string (buffer
, "}");
1822 pp_string (buffer
, "catch (");
1823 dump_generic_node (buffer
, CATCH_TYPES (node
), spc
+2, flags
, false);
1824 pp_string (buffer
, ")");
1825 newline_and_indent (buffer
, spc
+2);
1826 pp_string (buffer
, "{");
1827 newline_and_indent (buffer
, spc
+4);
1828 dump_generic_node (buffer
, CATCH_BODY (node
), spc
+4, flags
, true);
1829 newline_and_indent (buffer
, spc
+2);
1830 pp_string (buffer
, "}");
1834 case EH_FILTER_EXPR
:
1835 pp_string (buffer
, "<<<eh_filter (");
1836 dump_generic_node (buffer
, EH_FILTER_TYPES (node
), spc
+2, flags
, false);
1837 pp_string (buffer
, ")>>>");
1838 newline_and_indent (buffer
, spc
+2);
1839 pp_string (buffer
, "{");
1840 newline_and_indent (buffer
, spc
+4);
1841 dump_generic_node (buffer
, EH_FILTER_FAILURE (node
), spc
+4, flags
, true);
1842 newline_and_indent (buffer
, spc
+2);
1843 pp_string (buffer
, "}");
1848 op0
= TREE_OPERAND (node
, 0);
1849 /* If this is for break or continue, don't bother printing it. */
1850 if (DECL_NAME (op0
))
1852 const char *name
= IDENTIFIER_POINTER (DECL_NAME (op0
));
1853 if (strcmp (name
, "break") == 0
1854 || strcmp (name
, "continue") == 0)
1857 dump_generic_node (buffer
, op0
, spc
, flags
, false);
1858 pp_character (buffer
, ':');
1859 if (DECL_NONLOCAL (op0
))
1860 pp_string (buffer
, " [non-local]");
1864 pp_string (buffer
, "while (1)");
1865 if (!(flags
& TDF_SLIM
))
1867 newline_and_indent (buffer
, spc
+2);
1868 pp_character (buffer
, '{');
1869 newline_and_indent (buffer
, spc
+4);
1870 dump_generic_node (buffer
, LOOP_EXPR_BODY (node
), spc
+4, flags
, true);
1871 newline_and_indent (buffer
, spc
+2);
1872 pp_character (buffer
, '}');
1878 pp_string (buffer
, "// predicted ");
1879 if (PREDICT_EXPR_OUTCOME (node
))
1880 pp_string (buffer
, "likely by ");
1882 pp_string (buffer
, "unlikely by ");
1883 pp_string (buffer
, predictor_name (PREDICT_EXPR_PREDICTOR (node
)));
1884 pp_string (buffer
, " predictor.");
1888 pp_string (buffer
, "return");
1889 op0
= TREE_OPERAND (node
, 0);
1893 if (TREE_CODE (op0
) == MODIFY_EXPR
)
1894 dump_generic_node (buffer
, TREE_OPERAND (op0
, 1),
1897 dump_generic_node (buffer
, op0
, spc
, flags
, false);
1902 pp_string (buffer
, "if (");
1903 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1904 pp_string (buffer
, ") break");
1908 pp_string (buffer
, "switch (");
1909 dump_generic_node (buffer
, SWITCH_COND (node
), spc
, flags
, false);
1910 pp_character (buffer
, ')');
1911 if (!(flags
& TDF_SLIM
))
1913 newline_and_indent (buffer
, spc
+2);
1914 pp_character (buffer
, '{');
1915 if (SWITCH_BODY (node
))
1917 newline_and_indent (buffer
, spc
+4);
1918 dump_generic_node (buffer
, SWITCH_BODY (node
), spc
+4, flags
,
1923 tree vec
= SWITCH_LABELS (node
);
1924 size_t i
, n
= TREE_VEC_LENGTH (vec
);
1925 for (i
= 0; i
< n
; ++i
)
1927 tree elt
= TREE_VEC_ELT (vec
, i
);
1928 newline_and_indent (buffer
, spc
+4);
1931 dump_generic_node (buffer
, elt
, spc
+4, flags
, false);
1932 pp_string (buffer
, " goto ");
1933 dump_generic_node (buffer
, CASE_LABEL (elt
), spc
+4,
1935 pp_semicolon (buffer
);
1938 pp_string (buffer
, "case ???: goto ???;");
1941 newline_and_indent (buffer
, spc
+2);
1942 pp_character (buffer
, '}');
1948 op0
= GOTO_DESTINATION (node
);
1949 if (TREE_CODE (op0
) != SSA_NAME
&& DECL_P (op0
) && DECL_NAME (op0
))
1951 const char *name
= IDENTIFIER_POINTER (DECL_NAME (op0
));
1952 if (strcmp (name
, "break") == 0
1953 || strcmp (name
, "continue") == 0)
1955 pp_string (buffer
, name
);
1959 pp_string (buffer
, "goto ");
1960 dump_generic_node (buffer
, op0
, spc
, flags
, false);
1964 pp_string (buffer
, "__asm__");
1965 if (ASM_VOLATILE_P (node
))
1966 pp_string (buffer
, " __volatile__");
1967 pp_character (buffer
, '(');
1968 dump_generic_node (buffer
, ASM_STRING (node
), spc
, flags
, false);
1969 pp_character (buffer
, ':');
1970 dump_generic_node (buffer
, ASM_OUTPUTS (node
), spc
, flags
, false);
1971 pp_character (buffer
, ':');
1972 dump_generic_node (buffer
, ASM_INPUTS (node
), spc
, flags
, false);
1973 if (ASM_CLOBBERS (node
))
1975 pp_character (buffer
, ':');
1976 dump_generic_node (buffer
, ASM_CLOBBERS (node
), spc
, flags
, false);
1978 pp_string (buffer
, ")");
1981 case CASE_LABEL_EXPR
:
1982 if (CASE_LOW (node
) && CASE_HIGH (node
))
1984 pp_string (buffer
, "case ");
1985 dump_generic_node (buffer
, CASE_LOW (node
), spc
, flags
, false);
1986 pp_string (buffer
, " ... ");
1987 dump_generic_node (buffer
, CASE_HIGH (node
), spc
, flags
, false);
1989 else if (CASE_LOW (node
))
1991 pp_string (buffer
, "case ");
1992 dump_generic_node (buffer
, CASE_LOW (node
), spc
, flags
, false);
1995 pp_string (buffer
, "default");
1996 pp_character (buffer
, ':');
2000 pp_string (buffer
, "OBJ_TYPE_REF(");
2001 dump_generic_node (buffer
, OBJ_TYPE_REF_EXPR (node
), spc
, flags
, false);
2002 pp_character (buffer
, ';');
2003 dump_generic_node (buffer
, OBJ_TYPE_REF_OBJECT (node
), spc
, flags
, false);
2004 pp_character (buffer
, '-');
2005 pp_character (buffer
, '>');
2006 dump_generic_node (buffer
, OBJ_TYPE_REF_TOKEN (node
), spc
, flags
, false);
2007 pp_character (buffer
, ')');
2011 dump_generic_node (buffer
, SSA_NAME_VAR (node
), spc
, flags
, false);
2012 pp_string (buffer
, "_");
2013 pp_decimal_int (buffer
, SSA_NAME_VERSION (node
));
2014 if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (node
))
2015 pp_string (buffer
, "(ab)");
2016 else if (SSA_NAME_IS_DEFAULT_DEF (node
))
2017 pp_string (buffer
, "(D)");
2020 case WITH_SIZE_EXPR
:
2021 pp_string (buffer
, "WITH_SIZE_EXPR <");
2022 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2023 pp_string (buffer
, ", ");
2024 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2025 pp_string (buffer
, ">");
2029 pp_string (buffer
, "ASSERT_EXPR <");
2030 dump_generic_node (buffer
, ASSERT_EXPR_VAR (node
), spc
, flags
, false);
2031 pp_string (buffer
, ", ");
2032 dump_generic_node (buffer
, ASSERT_EXPR_COND (node
), spc
, flags
, false);
2033 pp_string (buffer
, ">");
2037 pp_string (buffer
, "scev_known");
2040 case SCEV_NOT_KNOWN
:
2041 pp_string (buffer
, "scev_not_known");
2044 case POLYNOMIAL_CHREC
:
2045 pp_string (buffer
, "{");
2046 dump_generic_node (buffer
, CHREC_LEFT (node
), spc
, flags
, false);
2047 pp_string (buffer
, ", +, ");
2048 dump_generic_node (buffer
, CHREC_RIGHT (node
), spc
, flags
, false);
2049 pp_string (buffer
, "}_");
2050 dump_generic_node (buffer
, CHREC_VAR (node
), spc
, flags
, false);
2054 case REALIGN_LOAD_EXPR
:
2055 pp_string (buffer
, "REALIGN_LOAD <");
2056 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2057 pp_string (buffer
, ", ");
2058 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2059 pp_string (buffer
, ", ");
2060 dump_generic_node (buffer
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2061 pp_string (buffer
, ">");
2065 pp_string (buffer
, " VEC_COND_EXPR < ");
2066 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2067 pp_string (buffer
, " , ");
2068 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2069 pp_string (buffer
, " , ");
2070 dump_generic_node (buffer
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2071 pp_string (buffer
, " > ");
2075 pp_string (buffer
, " VEC_PERM_EXPR < ");
2076 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2077 pp_string (buffer
, " , ");
2078 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2079 pp_string (buffer
, " , ");
2080 dump_generic_node (buffer
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2081 pp_string (buffer
, " > ");
2085 pp_string (buffer
, " DOT_PROD_EXPR < ");
2086 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2087 pp_string (buffer
, ", ");
2088 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2089 pp_string (buffer
, ", ");
2090 dump_generic_node (buffer
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2091 pp_string (buffer
, " > ");
2094 case WIDEN_MULT_PLUS_EXPR
:
2095 pp_string (buffer
, " WIDEN_MULT_PLUS_EXPR < ");
2096 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2097 pp_string (buffer
, ", ");
2098 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2099 pp_string (buffer
, ", ");
2100 dump_generic_node (buffer
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2101 pp_string (buffer
, " > ");
2104 case WIDEN_MULT_MINUS_EXPR
:
2105 pp_string (buffer
, " WIDEN_MULT_MINUS_EXPR < ");
2106 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2107 pp_string (buffer
, ", ");
2108 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2109 pp_string (buffer
, ", ");
2110 dump_generic_node (buffer
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2111 pp_string (buffer
, " > ");
2115 pp_string (buffer
, " FMA_EXPR < ");
2116 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2117 pp_string (buffer
, ", ");
2118 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2119 pp_string (buffer
, ", ");
2120 dump_generic_node (buffer
, TREE_OPERAND (node
, 2), spc
, flags
, false);
2121 pp_string (buffer
, " > ");
2125 pp_string (buffer
, "#pragma omp parallel");
2126 dump_omp_clauses (buffer
, OMP_PARALLEL_CLAUSES (node
), spc
, flags
);
2129 if (!(flags
& TDF_SLIM
) && OMP_BODY (node
))
2131 newline_and_indent (buffer
, spc
+ 2);
2132 pp_character (buffer
, '{');
2133 newline_and_indent (buffer
, spc
+ 4);
2134 dump_generic_node (buffer
, OMP_BODY (node
), spc
+ 4, flags
, false);
2135 newline_and_indent (buffer
, spc
+ 2);
2136 pp_character (buffer
, '}');
2142 pp_string (buffer
, "#pragma omp task");
2143 dump_omp_clauses (buffer
, OMP_TASK_CLAUSES (node
), spc
, flags
);
2147 pp_string (buffer
, "#pragma omp for");
2148 dump_omp_clauses (buffer
, OMP_FOR_CLAUSES (node
), spc
, flags
);
2150 if (!(flags
& TDF_SLIM
))
2154 if (OMP_FOR_PRE_BODY (node
))
2156 newline_and_indent (buffer
, spc
+ 2);
2157 pp_character (buffer
, '{');
2159 newline_and_indent (buffer
, spc
);
2160 dump_generic_node (buffer
, OMP_FOR_PRE_BODY (node
),
2164 for (i
= 0; i
< TREE_VEC_LENGTH (OMP_FOR_INIT (node
)); i
++)
2167 newline_and_indent (buffer
, spc
);
2168 pp_string (buffer
, "for (");
2169 dump_generic_node (buffer
, TREE_VEC_ELT (OMP_FOR_INIT (node
), i
),
2171 pp_string (buffer
, "; ");
2172 dump_generic_node (buffer
, TREE_VEC_ELT (OMP_FOR_COND (node
), i
),
2174 pp_string (buffer
, "; ");
2175 dump_generic_node (buffer
, TREE_VEC_ELT (OMP_FOR_INCR (node
), i
),
2177 pp_string (buffer
, ")");
2179 if (OMP_FOR_BODY (node
))
2181 newline_and_indent (buffer
, spc
+ 2);
2182 pp_character (buffer
, '{');
2183 newline_and_indent (buffer
, spc
+ 4);
2184 dump_generic_node (buffer
, OMP_FOR_BODY (node
), spc
+ 4, flags
,
2186 newline_and_indent (buffer
, spc
+ 2);
2187 pp_character (buffer
, '}');
2189 spc
-= 2 * TREE_VEC_LENGTH (OMP_FOR_INIT (node
)) - 2;
2190 if (OMP_FOR_PRE_BODY (node
))
2193 newline_and_indent (buffer
, spc
+ 2);
2194 pp_character (buffer
, '}');
2201 pp_string (buffer
, "#pragma omp sections");
2202 dump_omp_clauses (buffer
, OMP_SECTIONS_CLAUSES (node
), spc
, flags
);
2206 pp_string (buffer
, "#pragma omp section");
2210 pp_string (buffer
, "#pragma omp master");
2214 pp_string (buffer
, "#pragma omp ordered");
2218 pp_string (buffer
, "#pragma omp critical");
2219 if (OMP_CRITICAL_NAME (node
))
2222 pp_character (buffer
, '(');
2223 dump_generic_node (buffer
, OMP_CRITICAL_NAME (node
), spc
,
2225 pp_character (buffer
, ')');
2230 pp_string (buffer
, "#pragma omp atomic");
2231 newline_and_indent (buffer
, spc
+ 2);
2232 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2234 pp_character (buffer
, '=');
2236 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2239 case OMP_ATOMIC_READ
:
2240 pp_string (buffer
, "#pragma omp atomic read");
2241 newline_and_indent (buffer
, spc
+ 2);
2242 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2246 case OMP_ATOMIC_CAPTURE_OLD
:
2247 case OMP_ATOMIC_CAPTURE_NEW
:
2248 pp_string (buffer
, "#pragma omp atomic capture");
2249 newline_and_indent (buffer
, spc
+ 2);
2250 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2252 pp_character (buffer
, '=');
2254 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2258 pp_string (buffer
, "#pragma omp single");
2259 dump_omp_clauses (buffer
, OMP_SINGLE_CLAUSES (node
), spc
, flags
);
2263 dump_omp_clause (buffer
, node
, spc
, flags
);
2267 case REDUC_MAX_EXPR
:
2268 pp_string (buffer
, " REDUC_MAX_EXPR < ");
2269 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2270 pp_string (buffer
, " > ");
2273 case REDUC_MIN_EXPR
:
2274 pp_string (buffer
, " REDUC_MIN_EXPR < ");
2275 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2276 pp_string (buffer
, " > ");
2279 case REDUC_PLUS_EXPR
:
2280 pp_string (buffer
, " REDUC_PLUS_EXPR < ");
2281 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2282 pp_string (buffer
, " > ");
2285 case VEC_WIDEN_MULT_HI_EXPR
:
2286 pp_string (buffer
, " VEC_WIDEN_MULT_HI_EXPR < ");
2287 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2288 pp_string (buffer
, ", ");
2289 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2290 pp_string (buffer
, " > ");
2293 case VEC_WIDEN_MULT_LO_EXPR
:
2294 pp_string (buffer
, " VEC_WIDEN_MULT_LO_EXPR < ");
2295 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2296 pp_string (buffer
, ", ");
2297 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2298 pp_string (buffer
, " > ");
2301 case VEC_WIDEN_LSHIFT_HI_EXPR
:
2302 pp_string (buffer
, " VEC_WIDEN_LSHIFT_HI_EXPR < ");
2303 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2304 pp_string (buffer
, ", ");
2305 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2306 pp_string (buffer
, " > ");
2309 case VEC_WIDEN_LSHIFT_LO_EXPR
:
2310 pp_string (buffer
, " VEC_WIDEN_LSHIFT_HI_EXPR < ");
2311 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2312 pp_string (buffer
, ", ");
2313 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2314 pp_string (buffer
, " > ");
2317 case VEC_UNPACK_HI_EXPR
:
2318 pp_string (buffer
, " VEC_UNPACK_HI_EXPR < ");
2319 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2320 pp_string (buffer
, " > ");
2323 case VEC_UNPACK_LO_EXPR
:
2324 pp_string (buffer
, " VEC_UNPACK_LO_EXPR < ");
2325 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2326 pp_string (buffer
, " > ");
2329 case VEC_UNPACK_FLOAT_HI_EXPR
:
2330 pp_string (buffer
, " VEC_UNPACK_FLOAT_HI_EXPR < ");
2331 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2332 pp_string (buffer
, " > ");
2335 case VEC_UNPACK_FLOAT_LO_EXPR
:
2336 pp_string (buffer
, " VEC_UNPACK_FLOAT_LO_EXPR < ");
2337 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2338 pp_string (buffer
, " > ");
2341 case VEC_PACK_TRUNC_EXPR
:
2342 pp_string (buffer
, " VEC_PACK_TRUNC_EXPR < ");
2343 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2344 pp_string (buffer
, ", ");
2345 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2346 pp_string (buffer
, " > ");
2349 case VEC_PACK_SAT_EXPR
:
2350 pp_string (buffer
, " VEC_PACK_SAT_EXPR < ");
2351 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2352 pp_string (buffer
, ", ");
2353 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2354 pp_string (buffer
, " > ");
2357 case VEC_PACK_FIX_TRUNC_EXPR
:
2358 pp_string (buffer
, " VEC_PACK_FIX_TRUNC_EXPR < ");
2359 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2360 pp_string (buffer
, ", ");
2361 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2362 pp_string (buffer
, " > ");
2366 dump_block_node (buffer
, node
, spc
, flags
);
2369 case VEC_EXTRACT_EVEN_EXPR
:
2370 pp_string (buffer
, " VEC_EXTRACT_EVEN_EXPR < ");
2371 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2372 pp_string (buffer
, ", ");
2373 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2374 pp_string (buffer
, " > ");
2377 case VEC_EXTRACT_ODD_EXPR
:
2378 pp_string (buffer
, " VEC_EXTRACT_ODD_EXPR < ");
2379 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2380 pp_string (buffer
, ", ");
2381 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2382 pp_string (buffer
, " > ");
2385 case VEC_INTERLEAVE_HIGH_EXPR
:
2386 pp_string (buffer
, " VEC_INTERLEAVE_HIGH_EXPR < ");
2387 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2388 pp_string (buffer
, ", ");
2389 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2390 pp_string (buffer
, " > ");
2393 case VEC_INTERLEAVE_LOW_EXPR
:
2394 pp_string (buffer
, " VEC_INTERLEAVE_LOW_EXPR < ");
2395 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
2396 pp_string (buffer
, ", ");
2397 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
2398 pp_string (buffer
, " > ");
2405 if (is_stmt
&& is_expr
)
2406 pp_semicolon (buffer
);
2408 /* If we're building a diagnostic, the formatted text will be written
2409 into BUFFER's stream by the caller; otherwise, write it now. */
2410 if (!(flags
& TDF_DIAGNOSTIC
))
2411 pp_write_text_to_stream (buffer
);
2416 /* Print the declaration of a variable. */
2419 print_declaration (pretty_printer
*buffer
, tree t
, int spc
, int flags
)
2423 if (TREE_CODE (t
) == TYPE_DECL
)
2424 pp_string (buffer
, "typedef ");
2426 if (CODE_CONTAINS_STRUCT (TREE_CODE (t
), TS_DECL_WRTL
) && DECL_REGISTER (t
))
2427 pp_string (buffer
, "register ");
2429 if (TREE_PUBLIC (t
) && DECL_EXTERNAL (t
))
2430 pp_string (buffer
, "extern ");
2431 else if (TREE_STATIC (t
))
2432 pp_string (buffer
, "static ");
2434 /* Print the type and name. */
2435 if (TREE_TYPE (t
) && TREE_CODE (TREE_TYPE (t
)) == ARRAY_TYPE
)
2439 /* Print array's type. */
2440 tmp
= TREE_TYPE (t
);
2441 while (TREE_CODE (TREE_TYPE (tmp
)) == ARRAY_TYPE
)
2442 tmp
= TREE_TYPE (tmp
);
2443 dump_generic_node (buffer
, TREE_TYPE (tmp
), spc
, flags
, false);
2445 /* Print variable's name. */
2447 dump_generic_node (buffer
, t
, spc
, flags
, false);
2449 /* Print the dimensions. */
2450 tmp
= TREE_TYPE (t
);
2451 while (TREE_CODE (tmp
) == ARRAY_TYPE
)
2453 dump_array_domain (buffer
, TYPE_DOMAIN (tmp
), spc
, flags
);
2454 tmp
= TREE_TYPE (tmp
);
2457 else if (TREE_CODE (t
) == FUNCTION_DECL
)
2459 dump_generic_node (buffer
, TREE_TYPE (TREE_TYPE (t
)), spc
, flags
, false);
2461 dump_decl_name (buffer
, t
, flags
);
2462 dump_function_declaration (buffer
, TREE_TYPE (t
), spc
, flags
);
2466 /* Print type declaration. */
2467 dump_generic_node (buffer
, TREE_TYPE (t
), spc
, flags
, false);
2469 /* Print variable's name. */
2471 dump_generic_node (buffer
, t
, spc
, flags
, false);
2474 if (TREE_CODE (t
) == VAR_DECL
&& DECL_HARD_REGISTER (t
))
2476 pp_string (buffer
, " __asm__ ");
2477 pp_character (buffer
, '(');
2478 dump_generic_node (buffer
, DECL_ASSEMBLER_NAME (t
), spc
, flags
, false);
2479 pp_character (buffer
, ')');
2482 /* The initial value of a function serves to determine whether the function
2483 is declared or defined. So the following does not apply to function
2485 if (TREE_CODE (t
) != FUNCTION_DECL
)
2487 /* Print the initial value. */
2488 if (DECL_INITIAL (t
))
2491 pp_character (buffer
, '=');
2493 dump_generic_node (buffer
, DECL_INITIAL (t
), spc
, flags
, false);
2497 if (TREE_CODE (t
) == VAR_DECL
&& DECL_HAS_VALUE_EXPR_P (t
))
2499 pp_string (buffer
, " [value-expr: ");
2500 dump_generic_node (buffer
, DECL_VALUE_EXPR (t
), spc
, flags
, false);
2501 pp_character (buffer
, ']');
2504 pp_character (buffer
, ';');
2508 /* Prints a structure: name, fields, and methods.
2509 FIXME: Still incomplete. */
2512 print_struct_decl (pretty_printer
*buffer
, const_tree node
, int spc
, int flags
)
2514 /* Print the name of the structure. */
2515 if (TYPE_NAME (node
))
2518 if (TREE_CODE (node
) == RECORD_TYPE
)
2519 pp_string (buffer
, "struct ");
2520 else if ((TREE_CODE (node
) == UNION_TYPE
2521 || TREE_CODE (node
) == QUAL_UNION_TYPE
))
2522 pp_string (buffer
, "union ");
2524 dump_generic_node (buffer
, TYPE_NAME (node
), spc
, 0, false);
2527 /* Print the contents of the structure. */
2528 pp_newline (buffer
);
2530 pp_character (buffer
, '{');
2531 pp_newline (buffer
);
2533 /* Print the fields of the structure. */
2536 tmp
= TYPE_FIELDS (node
);
2539 /* Avoid to print recursively the structure. */
2540 /* FIXME : Not implemented correctly...,
2541 what about the case when we have a cycle in the contain graph? ...
2542 Maybe this could be solved by looking at the scope in which the
2543 structure was declared. */
2544 if (TREE_TYPE (tmp
) != node
2545 && (TREE_CODE (TREE_TYPE (tmp
)) != POINTER_TYPE
2546 || TREE_TYPE (TREE_TYPE (tmp
)) != node
))
2548 print_declaration (buffer
, tmp
, spc
+2, flags
);
2549 pp_newline (buffer
);
2551 tmp
= DECL_CHAIN (tmp
);
2555 pp_character (buffer
, '}');
2558 /* Return the priority of the operator CODE.
2560 From lowest to highest precedence with either left-to-right (L-R)
2561 or right-to-left (R-L) associativity]:
2564 2 [R-L] = += -= *= /= %= &= ^= |= <<= >>=
2576 14 [R-L] ! ~ ++ -- + - * & (type) sizeof
2577 15 [L-R] fn() [] -> .
2579 unary +, - and * have higher precedence than the corresponding binary
2583 op_code_prio (enum tree_code code
)
2600 case TRUTH_ORIF_EXPR
:
2603 case TRUTH_AND_EXPR
:
2604 case TRUTH_ANDIF_EXPR
:
2611 case TRUTH_XOR_EXPR
:
2628 case UNORDERED_EXPR
:
2639 case VEC_WIDEN_LSHIFT_HI_EXPR
:
2640 case VEC_WIDEN_LSHIFT_LO_EXPR
:
2641 case WIDEN_LSHIFT_EXPR
:
2644 case WIDEN_SUM_EXPR
:
2646 case POINTER_PLUS_EXPR
:
2650 case VEC_WIDEN_MULT_HI_EXPR
:
2651 case VEC_WIDEN_MULT_LO_EXPR
:
2652 case WIDEN_MULT_EXPR
:
2654 case WIDEN_MULT_PLUS_EXPR
:
2655 case WIDEN_MULT_MINUS_EXPR
:
2657 case TRUNC_DIV_EXPR
:
2659 case FLOOR_DIV_EXPR
:
2660 case ROUND_DIV_EXPR
:
2662 case EXACT_DIV_EXPR
:
2663 case TRUNC_MOD_EXPR
:
2665 case FLOOR_MOD_EXPR
:
2666 case ROUND_MOD_EXPR
:
2670 case TRUTH_NOT_EXPR
:
2672 case POSTINCREMENT_EXPR
:
2673 case POSTDECREMENT_EXPR
:
2674 case PREINCREMENT_EXPR
:
2675 case PREDECREMENT_EXPR
:
2681 case FIX_TRUNC_EXPR
:
2687 case ARRAY_RANGE_REF
:
2691 /* Special expressions. */
2697 case REDUC_MAX_EXPR
:
2698 case REDUC_MIN_EXPR
:
2699 case REDUC_PLUS_EXPR
:
2700 case VEC_LSHIFT_EXPR
:
2701 case VEC_RSHIFT_EXPR
:
2702 case VEC_UNPACK_HI_EXPR
:
2703 case VEC_UNPACK_LO_EXPR
:
2704 case VEC_UNPACK_FLOAT_HI_EXPR
:
2705 case VEC_UNPACK_FLOAT_LO_EXPR
:
2706 case VEC_PACK_TRUNC_EXPR
:
2707 case VEC_PACK_SAT_EXPR
:
2711 /* Return an arbitrarily high precedence to avoid surrounding single
2712 VAR_DECLs in ()s. */
2717 /* Return the priority of the operator OP. */
2720 op_prio (const_tree op
)
2722 enum tree_code code
;
2727 code
= TREE_CODE (op
);
2728 if (code
== SAVE_EXPR
|| code
== NON_LVALUE_EXPR
)
2729 return op_prio (TREE_OPERAND (op
, 0));
2731 return op_code_prio (code
);
2734 /* Return the symbol associated with operator CODE. */
2737 op_symbol_code (enum tree_code code
)
2745 case TRUTH_ORIF_EXPR
:
2748 case TRUTH_AND_EXPR
:
2749 case TRUTH_ANDIF_EXPR
:
2755 case TRUTH_XOR_EXPR
:
2765 case UNORDERED_EXPR
:
2811 case VEC_LSHIFT_EXPR
:
2814 case VEC_RSHIFT_EXPR
:
2817 case WIDEN_LSHIFT_EXPR
:
2820 case POINTER_PLUS_EXPR
:
2826 case REDUC_PLUS_EXPR
:
2829 case WIDEN_SUM_EXPR
:
2832 case WIDEN_MULT_EXPR
:
2842 case TRUTH_NOT_EXPR
:
2849 case TRUNC_DIV_EXPR
:
2856 case FLOOR_DIV_EXPR
:
2859 case ROUND_DIV_EXPR
:
2862 case EXACT_DIV_EXPR
:
2865 case TRUNC_MOD_EXPR
:
2871 case FLOOR_MOD_EXPR
:
2874 case ROUND_MOD_EXPR
:
2877 case PREDECREMENT_EXPR
:
2880 case PREINCREMENT_EXPR
:
2883 case POSTDECREMENT_EXPR
:
2886 case POSTINCREMENT_EXPR
:
2896 return "<<< ??? >>>";
2900 /* Return the symbol associated with operator OP. */
2903 op_symbol (const_tree op
)
2905 return op_symbol_code (TREE_CODE (op
));
2908 /* Prints the name of a call. NODE is the CALL_EXPR_FN of a CALL_EXPR or
2909 the gimple_call_fn of a GIMPLE_CALL. */
2912 print_call_name (pretty_printer
*buffer
, tree node
, int flags
)
2916 if (TREE_CODE (op0
) == NON_LVALUE_EXPR
)
2917 op0
= TREE_OPERAND (op0
, 0);
2920 switch (TREE_CODE (op0
))
2925 dump_function_name (buffer
, op0
, flags
);
2931 op0
= TREE_OPERAND (op0
, 0);
2935 pp_string (buffer
, "(");
2936 dump_generic_node (buffer
, TREE_OPERAND (op0
, 0), 0, flags
, false);
2937 pp_string (buffer
, ") ? ");
2938 dump_generic_node (buffer
, TREE_OPERAND (op0
, 1), 0, flags
, false);
2939 pp_string (buffer
, " : ");
2940 dump_generic_node (buffer
, TREE_OPERAND (op0
, 2), 0, flags
, false);
2944 if (TREE_CODE (TREE_OPERAND (op0
, 0)) == VAR_DECL
)
2945 dump_function_name (buffer
, TREE_OPERAND (op0
, 0), flags
);
2947 dump_generic_node (buffer
, op0
, 0, flags
, false);
2951 if (integer_zerop (TREE_OPERAND (op0
, 1)))
2953 op0
= TREE_OPERAND (op0
, 0);
2960 dump_generic_node (buffer
, op0
, 0, flags
, false);
2968 /* Parses the string STR and replaces new-lines by '\n', tabs by '\t', ... */
2971 pretty_print_string (pretty_printer
*buffer
, const char *str
)
2981 pp_string (buffer
, "\\b");
2985 pp_string (buffer
, "\\f");
2989 pp_string (buffer
, "\\n");
2993 pp_string (buffer
, "\\r");
2997 pp_string (buffer
, "\\t");
3001 pp_string (buffer
, "\\v");
3005 pp_string (buffer
, "\\\\");
3009 pp_string (buffer
, "\\\"");
3013 pp_string (buffer
, "\\'");
3016 /* No need to handle \0; the loop terminates on \0. */
3019 pp_string (buffer
, "\\1");
3023 pp_string (buffer
, "\\2");
3027 pp_string (buffer
, "\\3");
3031 pp_string (buffer
, "\\4");
3035 pp_string (buffer
, "\\5");
3039 pp_string (buffer
, "\\6");
3043 pp_string (buffer
, "\\7");
3047 pp_character (buffer
, str
[0]);
3055 maybe_init_pretty_print (FILE *file
)
3059 pp_construct (&buffer
, /* prefix */NULL
, /* line-width */0);
3060 pp_needs_newline (&buffer
) = true;
3061 pp_translate_identifiers (&buffer
) = false;
3065 buffer
.buffer
->stream
= file
;
3069 newline_and_indent (pretty_printer
*buffer
, int spc
)
3071 pp_newline (buffer
);
3075 /* Handle a %K format for TEXT. Separate from default_tree_printer so
3076 it can also be used in front ends.
3077 %K: a statement, from which EXPR_LOCATION and TREE_BLOCK will be recorded.
3081 percent_K_format (text_info
*text
)
3083 tree t
= va_arg (*text
->args_ptr
, tree
), block
;
3084 gcc_assert (text
->locus
!= NULL
);
3085 *text
->locus
= EXPR_LOCATION (t
);
3086 gcc_assert (pp_ti_abstract_origin (text
) != NULL
);
3087 block
= TREE_BLOCK (t
);
3088 *pp_ti_abstract_origin (text
) = NULL
;
3090 && TREE_CODE (block
) == BLOCK
3091 && BLOCK_ABSTRACT_ORIGIN (block
))
3093 tree ao
= BLOCK_ABSTRACT_ORIGIN (block
);
3095 while (TREE_CODE (ao
) == BLOCK
3096 && BLOCK_ABSTRACT_ORIGIN (ao
)
3097 && BLOCK_ABSTRACT_ORIGIN (ao
) != ao
)
3098 ao
= BLOCK_ABSTRACT_ORIGIN (ao
);
3100 if (TREE_CODE (ao
) == FUNCTION_DECL
)
3102 *pp_ti_abstract_origin (text
) = block
;
3105 block
= BLOCK_SUPERCONTEXT (block
);
3109 /* Print the identifier ID to PRETTY-PRINTER. */
3112 pp_base_tree_identifier (pretty_printer
*pp
, tree id
)
3114 if (pp_translate_identifiers (pp
))
3116 const char *text
= identifier_to_locale (IDENTIFIER_POINTER (id
));
3117 pp_append_text (pp
, text
, text
+ strlen (text
));
3120 pp_append_text (pp
, IDENTIFIER_POINTER (id
),
3121 IDENTIFIER_POINTER (id
) + IDENTIFIER_LENGTH (id
));
3124 /* A helper function that is used to dump function information before the
3128 dump_function_header (FILE *dump_file
, tree fdecl
, int flags
)
3130 const char *dname
, *aname
;
3131 struct cgraph_node
*node
= cgraph_get_node (fdecl
);
3132 struct function
*fun
= DECL_STRUCT_FUNCTION (fdecl
);
3134 dname
= lang_hooks
.decl_printable_name (fdecl
, 2);
3136 if (DECL_ASSEMBLER_NAME_SET_P (fdecl
))
3137 aname
= (IDENTIFIER_POINTER
3138 (DECL_ASSEMBLER_NAME (fdecl
)));
3140 aname
= "<unset-asm-name>";
3142 fprintf (dump_file
, "\n;; Function %s (%s, funcdef_no=%d",
3143 dname
, aname
, fun
->funcdef_no
);
3144 if (!(flags
& TDF_NOUID
))
3145 fprintf (dump_file
, ", decl_uid=%d", DECL_UID (fdecl
));
3148 fprintf (dump_file
, ", cgraph_uid=%d)%s\n\n", node
->uid
,
3149 node
->frequency
== NODE_FREQUENCY_HOT
3151 : node
->frequency
== NODE_FREQUENCY_UNLIKELY_EXECUTED
3152 ? " (unlikely executed)"
3153 : node
->frequency
== NODE_FREQUENCY_EXECUTED_ONCE
3154 ? " (executed once)"
3158 fprintf (dump_file
, ")\n\n");