1 /* Pretty formatting of GENERIC trees in C syntax.
2 Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006
3 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 2, 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 COPYING. If not, write to the Free
20 Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
25 #include "coretypes.h"
28 #include "diagnostic.h"
31 #include "tree-flow.h"
32 #include "langhooks.h"
33 #include "tree-iterator.h"
34 #include "tree-chrec.h"
35 #include "tree-pass.h"
37 /* Local functions, macros and variables. */
38 static int op_prio (tree
);
39 static const char *op_symbol_1 (enum tree_code
);
40 static const char *op_symbol (tree
);
41 static void pretty_print_string (pretty_printer
*, const char*);
42 static void print_call_name (pretty_printer
*, tree
);
43 static void newline_and_indent (pretty_printer
*, int);
44 static void maybe_init_pretty_print (FILE *);
45 static void print_declaration (pretty_printer
*, tree
, int, int);
46 static void print_struct_decl (pretty_printer
*, tree
, int, int);
47 static void do_niy (pretty_printer
*, tree
);
48 static void dump_vops (pretty_printer
*, tree
, int, int);
49 static void dump_generic_bb_buff (pretty_printer
*, basic_block
, int, int);
51 #define INDENT(SPACE) do { \
52 int i; for (i = 0; i<SPACE; i++) pp_space (buffer); } while (0)
54 #define NIY do_niy(buffer,node)
56 #define PRINT_FUNCTION_NAME(NODE) pp_printf \
57 (buffer, "%s", TREE_CODE (NODE) == NOP_EXPR ? \
58 lang_hooks.decl_printable_name (TREE_OPERAND (NODE, 0), 1) : \
59 lang_hooks.decl_printable_name (NODE, 1))
61 static pretty_printer buffer
;
62 static int initialized
= 0;
64 /* Try to print something for an unknown tree code. */
67 do_niy (pretty_printer
*buffer
, tree node
)
71 pp_string (buffer
, "<<< Unknown tree: ");
72 pp_string (buffer
, tree_code_name
[(int) TREE_CODE (node
)]);
76 len
= TREE_CODE_LENGTH (TREE_CODE (node
));
77 for (i
= 0; i
< len
; ++i
)
79 newline_and_indent (buffer
, 2);
80 dump_generic_node (buffer
, TREE_OPERAND (node
, i
), 2, 0, false);
84 pp_string (buffer
, " >>>\n");
88 debug_generic_expr (tree t
)
90 print_generic_expr (stderr
, t
, TDF_VOPS
|TDF_UID
);
91 fprintf (stderr
, "\n");
95 debug_generic_stmt (tree t
)
97 print_generic_stmt (stderr
, t
, TDF_VOPS
|TDF_UID
);
98 fprintf (stderr
, "\n");
102 debug_tree_chain (tree t
)
104 print_generic_expr (stderr
, t
, TDF_VOPS
|TDF_UID
|TDF_CHAIN
);
105 fprintf (stderr
, "\n");
108 /* Prints declaration DECL to the FILE with details specified by FLAGS. */
110 print_generic_decl (FILE *file
, tree decl
, int flags
)
112 maybe_init_pretty_print (file
);
113 print_declaration (&buffer
, decl
, 2, flags
);
114 pp_write_text_to_stream (&buffer
);
117 /* Print tree T, and its successors, on file FILE. FLAGS specifies details
118 to show in the dump. See TDF_* in tree.h. */
121 print_generic_stmt (FILE *file
, tree t
, int flags
)
123 maybe_init_pretty_print (file
);
124 dump_generic_node (&buffer
, t
, 0, flags
, true);
128 /* Print tree T, and its successors, on file FILE. FLAGS specifies details
129 to show in the dump. See TDF_* in tree.h. The output is indented by
133 print_generic_stmt_indented (FILE *file
, tree t
, int flags
, int indent
)
137 maybe_init_pretty_print (file
);
139 for (i
= 0; i
< indent
; i
++)
141 dump_generic_node (&buffer
, t
, indent
, flags
, true);
145 /* Print a single expression T on file FILE. FLAGS specifies details to show
146 in the dump. See TDF_* in tree.h. */
149 print_generic_expr (FILE *file
, tree t
, int flags
)
151 maybe_init_pretty_print (file
);
152 dump_generic_node (&buffer
, t
, 0, flags
, false);
155 /* Dump the name of a _DECL node and its DECL_UID if TDF_UID is set
159 dump_decl_name (pretty_printer
*buffer
, tree node
, int flags
)
166 pp_tree_identifier (buffer
, DECL_NAME (t
));
168 if ((flags
& TDF_UID
)
169 || DECL_NAME (t
) == NULL_TREE
)
171 if (TREE_CODE (t
) == LABEL_DECL
172 && LABEL_DECL_UID (t
) != -1)
173 pp_printf (buffer
, "L." HOST_WIDE_INT_PRINT_DEC
,
177 char c
= TREE_CODE (t
) == CONST_DECL
? 'C' : 'D';
178 pp_printf (buffer
, "%c.%u", c
, DECL_UID (t
));
182 if (flags
& TDF_CHAIN
)
185 pp_string (buffer
, " ");
192 /* Like the above, but used for pretty printing function calls. */
195 dump_function_name (pretty_printer
*buffer
, tree node
)
197 if (DECL_NAME (node
))
198 PRINT_FUNCTION_NAME (node
);
200 dump_decl_name (buffer
, node
, 0);
203 /* Dump a function declaration. NODE is the FUNCTION_TYPE. BUFFER, SPC and
204 FLAGS are as in dump_generic_node. */
207 dump_function_declaration (pretty_printer
*buffer
, tree node
,
210 bool wrote_arg
= false;
214 pp_character (buffer
, '(');
216 /* Print the argument types. The last element in the list is a VOID_TYPE.
217 The following avoids printing the last element. */
218 arg
= TYPE_ARG_TYPES (node
);
219 while (arg
&& TREE_CHAIN (arg
) && arg
!= error_mark_node
)
222 dump_generic_node (buffer
, TREE_VALUE (arg
), spc
, flags
, false);
223 arg
= TREE_CHAIN (arg
);
224 if (TREE_CHAIN (arg
) && TREE_CODE (TREE_CHAIN (arg
)) == TREE_LIST
)
226 pp_character (buffer
, ',');
232 pp_string (buffer
, "void");
234 pp_character (buffer
, ')');
237 /* Dump the domain associated with an array. */
240 dump_array_domain (pretty_printer
*buffer
, tree domain
, int spc
, int flags
)
242 pp_character (buffer
, '[');
245 tree min
= TYPE_MIN_VALUE (domain
);
246 tree max
= TYPE_MAX_VALUE (domain
);
249 && integer_zerop (min
)
250 && host_integerp (max
, 0))
251 pp_wide_integer (buffer
, TREE_INT_CST_LOW (max
) + 1);
255 dump_generic_node (buffer
, min
, spc
, flags
, false);
256 pp_character (buffer
, ':');
258 dump_generic_node (buffer
, max
, spc
, flags
, false);
262 pp_string (buffer
, "<unknown>");
263 pp_character (buffer
, ']');
267 /* Dump OpenMP clause CLAUSE. BUFFER, CLAUSE, SPC and FLAGS are as in
268 dump_generic_node. */
271 dump_omp_clause (pretty_printer
*buffer
, tree clause
, int spc
, int flags
)
275 switch (OMP_CLAUSE_CODE (clause
))
277 case OMP_CLAUSE_PRIVATE
:
280 case OMP_CLAUSE_SHARED
:
283 case OMP_CLAUSE_FIRSTPRIVATE
:
284 name
= "firstprivate";
286 case OMP_CLAUSE_LASTPRIVATE
:
287 name
= "lastprivate";
289 case OMP_CLAUSE_COPYIN
:
292 case OMP_CLAUSE_COPYPRIVATE
:
293 name
= "copyprivate";
296 pp_string (buffer
, name
);
297 pp_character (buffer
, '(');
298 dump_generic_node (buffer
, OMP_CLAUSE_DECL (clause
),
300 pp_character (buffer
, ')');
303 case OMP_CLAUSE_REDUCTION
:
304 pp_string (buffer
, "reduction(");
305 pp_string (buffer
, op_symbol_1 (OMP_CLAUSE_REDUCTION_CODE (clause
)));
306 pp_character (buffer
, ':');
307 dump_generic_node (buffer
, OMP_CLAUSE_DECL (clause
),
309 pp_character (buffer
, ')');
313 pp_string (buffer
, "if(");
314 dump_generic_node (buffer
, OMP_CLAUSE_IF_EXPR (clause
),
316 pp_character (buffer
, ')');
319 case OMP_CLAUSE_NUM_THREADS
:
320 pp_string (buffer
, "num_threads(");
321 dump_generic_node (buffer
, OMP_CLAUSE_NUM_THREADS_EXPR (clause
),
323 pp_character (buffer
, ')');
326 case OMP_CLAUSE_NOWAIT
:
327 pp_string (buffer
, "nowait");
329 case OMP_CLAUSE_ORDERED
:
330 pp_string (buffer
, "ordered");
333 case OMP_CLAUSE_DEFAULT
:
334 pp_string (buffer
, "default(");
335 switch (OMP_CLAUSE_DEFAULT_KIND (clause
))
337 case OMP_CLAUSE_DEFAULT_UNSPECIFIED
:
339 case OMP_CLAUSE_DEFAULT_SHARED
:
340 pp_string (buffer
, "shared");
342 case OMP_CLAUSE_DEFAULT_NONE
:
343 pp_string (buffer
, "none");
345 case OMP_CLAUSE_DEFAULT_PRIVATE
:
346 pp_string (buffer
, "private");
351 pp_character (buffer
, ')');
354 case OMP_CLAUSE_SCHEDULE
:
355 pp_string (buffer
, "schedule(");
356 switch (OMP_CLAUSE_SCHEDULE_KIND (clause
))
358 case OMP_CLAUSE_SCHEDULE_STATIC
:
359 pp_string (buffer
, "static");
361 case OMP_CLAUSE_SCHEDULE_DYNAMIC
:
362 pp_string (buffer
, "dynamic");
364 case OMP_CLAUSE_SCHEDULE_GUIDED
:
365 pp_string (buffer
, "guided");
367 case OMP_CLAUSE_SCHEDULE_RUNTIME
:
368 pp_string (buffer
, "runtime");
373 if (OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (clause
))
375 pp_character (buffer
, ',');
376 dump_generic_node (buffer
,
377 OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (clause
),
380 pp_character (buffer
, ')');
384 /* Should never happen. */
385 dump_generic_node (buffer
, clause
, spc
, flags
, false);
391 /* Dump the list of OpenMP clauses. BUFFER, SPC and FLAGS are as in
392 dump_generic_node. */
395 dump_omp_clauses (pretty_printer
*buffer
, tree clause
, int spc
, int flags
)
403 dump_omp_clause (buffer
, clause
, spc
, flags
);
404 clause
= OMP_CLAUSE_CHAIN (clause
);
412 /* Dump the node NODE on the pretty_printer BUFFER, SPC spaces of indent.
413 FLAGS specifies details to show in the dump (see TDF_* in tree.h). If
414 IS_STMT is true, the object printed is considered to be a statement
415 and it is terminated by ';' if appropriate. */
418 dump_generic_node (pretty_printer
*buffer
, tree node
, int spc
, int flags
,
426 if (node
== NULL_TREE
)
429 is_expr
= EXPR_P (node
);
431 if (TREE_CODE (node
) != ERROR_MARK
432 && is_gimple_stmt (node
)
433 && (flags
& TDF_VOPS
)
435 && TREE_CODE (node
) != PHI_NODE
)
436 dump_vops (buffer
, node
, spc
, flags
);
438 if (is_stmt
&& (flags
& TDF_STMTADDR
))
439 pp_printf (buffer
, "<&%p> ", (void *)node
);
441 if ((flags
& TDF_LINENO
) && EXPR_HAS_LOCATION (node
))
443 expanded_location xloc
= expand_location (EXPR_LOCATION (node
));
444 pp_character (buffer
, '[');
447 pp_string (buffer
, xloc
.file
);
448 pp_string (buffer
, " : ");
450 pp_decimal_int (buffer
, xloc
.line
);
451 pp_string (buffer
, "] ");
454 switch (TREE_CODE (node
))
457 pp_string (buffer
, "<<< error >>>");
460 case IDENTIFIER_NODE
:
461 pp_tree_identifier (buffer
, node
);
465 while (node
&& node
!= error_mark_node
)
467 if (TREE_PURPOSE (node
))
469 dump_generic_node (buffer
, TREE_PURPOSE (node
), spc
, flags
, false);
472 dump_generic_node (buffer
, TREE_VALUE (node
), spc
, flags
, false);
473 node
= TREE_CHAIN (node
);
474 if (node
&& TREE_CODE (node
) == TREE_LIST
)
476 pp_character (buffer
, ',');
483 dump_generic_node (buffer
, BINFO_TYPE (node
), spc
, flags
, false);
488 if (TREE_VEC_LENGTH (node
) > 0)
490 size_t len
= TREE_VEC_LENGTH (node
);
491 for (i
= 0; i
< len
- 1; i
++)
493 dump_generic_node (buffer
, TREE_VEC_ELT (node
, i
), spc
, flags
,
495 pp_character (buffer
, ',');
498 dump_generic_node (buffer
, TREE_VEC_ELT (node
, len
- 1), spc
,
512 unsigned int quals
= TYPE_QUALS (node
);
513 enum tree_code_class
class;
515 if (quals
& TYPE_QUAL_CONST
)
516 pp_string (buffer
, "const ");
517 else if (quals
& TYPE_QUAL_VOLATILE
)
518 pp_string (buffer
, "volatile ");
519 else if (quals
& TYPE_QUAL_RESTRICT
)
520 pp_string (buffer
, "restrict ");
522 class = TREE_CODE_CLASS (TREE_CODE (node
));
524 if (class == tcc_declaration
)
526 if (DECL_NAME (node
))
527 dump_decl_name (buffer
, node
, flags
);
529 pp_string (buffer
, "<unnamed type decl>");
531 else if (class == tcc_type
)
533 if (TYPE_NAME (node
))
535 if (TREE_CODE (TYPE_NAME (node
)) == IDENTIFIER_NODE
)
536 pp_tree_identifier (buffer
, TYPE_NAME (node
));
537 else if (TREE_CODE (TYPE_NAME (node
)) == TYPE_DECL
538 && DECL_NAME (TYPE_NAME (node
)))
539 dump_decl_name (buffer
, TYPE_NAME (node
), flags
);
541 pp_string (buffer
, "<unnamed type>");
543 else if (TREE_CODE (node
) == VECTOR_TYPE
)
545 pp_string (buffer
, "vector ");
546 dump_generic_node (buffer
, TREE_TYPE (node
),
550 pp_string (buffer
, "<unnamed type>");
557 str
= (TREE_CODE (node
) == POINTER_TYPE
? "*" : "&");
559 if (TREE_CODE (TREE_TYPE (node
)) == FUNCTION_TYPE
)
561 tree fnode
= TREE_TYPE (node
);
563 dump_generic_node (buffer
, TREE_TYPE (fnode
), spc
, flags
, false);
565 pp_character (buffer
, '(');
566 pp_string (buffer
, str
);
567 if (TYPE_NAME (node
) && DECL_NAME (TYPE_NAME (node
)))
568 dump_decl_name (buffer
, TYPE_NAME (node
), flags
);
570 pp_printf (buffer
, "<T%x>", TYPE_UID (node
));
572 pp_character (buffer
, ')');
573 dump_function_declaration (buffer
, fnode
, spc
, flags
);
577 unsigned int quals
= TYPE_QUALS (node
);
579 dump_generic_node (buffer
, TREE_TYPE (node
), spc
, flags
, false);
581 pp_string (buffer
, str
);
583 if (quals
& TYPE_QUAL_CONST
)
584 pp_string (buffer
, " const");
585 else if (quals
& TYPE_QUAL_VOLATILE
)
586 pp_string (buffer
, "volatile");
587 else if (quals
& TYPE_QUAL_RESTRICT
)
588 pp_string (buffer
, " restrict");
590 if (TYPE_REF_CAN_ALIAS_ALL (node
))
591 pp_string (buffer
, " {ref-all}");
600 dump_decl_name (buffer
, TYPE_NAME (TYPE_METHOD_BASETYPE (node
)), flags
);
601 pp_string (buffer
, "::");
606 const char *sep
= "";
609 pp_string (buffer
, "MEM[");
611 tmp
= TMR_SYMBOL (node
);
614 pp_string (buffer
, sep
);
616 pp_string (buffer
, "symbol: ");
617 dump_generic_node (buffer
, tmp
, spc
, flags
, false);
619 tmp
= TMR_BASE (node
);
622 pp_string (buffer
, sep
);
624 pp_string (buffer
, "base: ");
625 dump_generic_node (buffer
, tmp
, spc
, flags
, false);
627 tmp
= TMR_INDEX (node
);
630 pp_string (buffer
, sep
);
632 pp_string (buffer
, "index: ");
633 dump_generic_node (buffer
, tmp
, spc
, flags
, false);
635 tmp
= TMR_STEP (node
);
638 pp_string (buffer
, sep
);
640 pp_string (buffer
, "step: ");
641 dump_generic_node (buffer
, tmp
, spc
, flags
, false);
643 tmp
= TMR_OFFSET (node
);
646 pp_string (buffer
, sep
);
648 pp_string (buffer
, "offset: ");
649 dump_generic_node (buffer
, tmp
, spc
, flags
, false);
651 pp_string (buffer
, "]");
652 if (flags
& TDF_DETAILS
)
654 pp_string (buffer
, "{");
655 dump_generic_node (buffer
, TMR_ORIGINAL (node
), spc
, flags
,
657 pp_string (buffer
, "}");
666 /* Print the innermost component type. */
667 for (tmp
= TREE_TYPE (node
); TREE_CODE (tmp
) == ARRAY_TYPE
;
668 tmp
= TREE_TYPE (tmp
))
670 dump_generic_node (buffer
, tmp
, spc
, flags
, false);
672 /* Print the dimensions. */
673 for (tmp
= node
; TREE_CODE (tmp
) == ARRAY_TYPE
; tmp
= TREE_TYPE (tmp
))
674 dump_array_domain (buffer
, TYPE_DOMAIN (tmp
), spc
, flags
);
680 case QUAL_UNION_TYPE
:
681 /* Print the name of the structure. */
682 if (TREE_CODE (node
) == RECORD_TYPE
)
683 pp_string (buffer
, "struct ");
684 else if (TREE_CODE (node
) == UNION_TYPE
)
685 pp_string (buffer
, "union ");
687 if (TYPE_NAME (node
))
688 dump_generic_node (buffer
, TYPE_NAME (node
), spc
, flags
, false);
690 print_struct_decl (buffer
, node
, spc
, flags
);
698 if (TREE_CODE (TREE_TYPE (node
)) == POINTER_TYPE
)
700 /* In the case of a pointer, one may want to divide by the
701 size of the pointed-to type. Unfortunately, this not
702 straightforward. The C front-end maps expressions
707 in such a way that the two INTEGER_CST nodes for "5" have
708 different values but identical types. In the latter
709 case, the 5 is multiplied by sizeof (int) in c-common.c
710 (pointer_int_sum) to convert it to a byte address, and
711 yet the type of the node is left unchanged. Argh. What
712 is consistent though is that the number value corresponds
713 to bytes (UNITS) offset.
715 NB: Neither of the following divisors can be trivially
716 used to recover the original literal:
718 TREE_INT_CST_LOW (TYPE_SIZE_UNIT (TREE_TYPE (node)))
719 TYPE_PRECISION (TREE_TYPE (TREE_TYPE (node))) */
720 pp_wide_integer (buffer
, TREE_INT_CST_LOW (node
));
721 pp_string (buffer
, "B"); /* pseudo-unit */
723 else if (! host_integerp (node
, 0))
727 if (tree_int_cst_sgn (val
) < 0)
729 pp_character (buffer
, '-');
730 val
= build_int_cst_wide (NULL_TREE
,
731 -TREE_INT_CST_LOW (val
),
732 ~TREE_INT_CST_HIGH (val
)
733 + !TREE_INT_CST_LOW (val
));
735 /* Would "%x%0*x" or "%x%*0x" get zero-padding on all
738 static char format
[10]; /* "%x%09999x\0" */
740 sprintf (format
, "%%x%%0%dx", HOST_BITS_PER_INT
/ 4);
741 sprintf (pp_buffer (buffer
)->digit_buffer
, format
,
742 TREE_INT_CST_HIGH (val
),
743 TREE_INT_CST_LOW (val
));
744 pp_string (buffer
, pp_buffer (buffer
)->digit_buffer
);
748 pp_wide_integer (buffer
, TREE_INT_CST_LOW (node
));
752 /* Code copied from print_node. */
755 if (TREE_OVERFLOW (node
))
756 pp_string (buffer
, " overflow");
758 #if !defined(REAL_IS_NOT_DOUBLE) || defined(REAL_ARITHMETIC)
759 d
= TREE_REAL_CST (node
);
760 if (REAL_VALUE_ISINF (d
))
761 pp_string (buffer
, " Inf");
762 else if (REAL_VALUE_ISNAN (d
))
763 pp_string (buffer
, " Nan");
767 real_to_decimal (string
, &d
, sizeof (string
), 0, 1);
768 pp_string (buffer
, string
);
773 unsigned char *p
= (unsigned char *) &TREE_REAL_CST (node
);
774 pp_string (buffer
, "0x");
775 for (i
= 0; i
< sizeof TREE_REAL_CST (node
); i
++)
776 output_formatted_integer (buffer
, "%02x", *p
++);
783 pp_string (buffer
, "__complex__ (");
784 dump_generic_node (buffer
, TREE_REALPART (node
), spc
, flags
, false);
785 pp_string (buffer
, ", ");
786 dump_generic_node (buffer
, TREE_IMAGPART (node
), spc
, flags
, false);
787 pp_string (buffer
, ")");
791 pp_string (buffer
, "\"");
792 pretty_print_string (buffer
, TREE_STRING_POINTER (node
));
793 pp_string (buffer
, "\"");
799 pp_string (buffer
, "{ ");
800 for (elt
= TREE_VECTOR_CST_ELTS (node
); elt
; elt
= TREE_CHAIN (elt
))
802 dump_generic_node (buffer
, TREE_VALUE (elt
), spc
, flags
, false);
803 if (TREE_CHAIN (elt
))
804 pp_string (buffer
, ", ");
806 pp_string (buffer
, " }");
815 dump_decl_name (buffer
, node
, flags
);
819 if (DECL_NAME (node
))
820 dump_decl_name (buffer
, node
, flags
);
821 else if (LABEL_DECL_UID (node
) != -1)
822 pp_printf (buffer
, "<L" HOST_WIDE_INT_PRINT_DEC
">",
823 LABEL_DECL_UID (node
));
825 pp_printf (buffer
, "<D%u>", DECL_UID (node
));
829 if (DECL_IS_BUILTIN (node
))
831 /* Don't print the declaration of built-in types. */
834 if (DECL_NAME (node
))
835 dump_decl_name (buffer
, node
, flags
);
838 if ((TREE_CODE (TREE_TYPE (node
)) == RECORD_TYPE
839 || TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
)
840 && TYPE_METHODS (TREE_TYPE (node
)))
842 /* The type is a c++ class: all structures have at least
844 pp_string (buffer
, "class ");
845 dump_generic_node (buffer
, TREE_TYPE (node
), spc
, flags
, false);
850 (TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
851 ? "union" : "struct "));
852 dump_generic_node (buffer
, TREE_TYPE (node
), spc
, flags
, false);
857 case TYPE_MEMORY_TAG
:
858 case NAME_MEMORY_TAG
:
859 case STRUCT_FIELD_TAG
:
864 dump_decl_name (buffer
, node
, flags
);
868 pp_string (buffer
, "<retval>");
872 op0
= TREE_OPERAND (node
, 0);
874 if (TREE_CODE (op0
) == INDIRECT_REF
)
876 op0
= TREE_OPERAND (op0
, 0);
879 if (op_prio (op0
) < op_prio (node
))
880 pp_character (buffer
, '(');
881 dump_generic_node (buffer
, op0
, spc
, flags
, false);
882 if (op_prio (op0
) < op_prio (node
))
883 pp_character (buffer
, ')');
884 pp_string (buffer
, str
);
885 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
887 if (TREE_CODE (op0
) != VALUE_HANDLE
)
889 op0
= component_ref_field_offset (node
);
890 if (op0
&& TREE_CODE (op0
) != INTEGER_CST
)
892 pp_string (buffer
, "{off: ");
893 dump_generic_node (buffer
, op0
, spc
, flags
, false);
894 pp_character (buffer
, '}');
900 pp_string (buffer
, "BIT_FIELD_REF <");
901 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
902 pp_string (buffer
, ", ");
903 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
904 pp_string (buffer
, ", ");
905 dump_generic_node (buffer
, TREE_OPERAND (node
, 2), spc
, flags
, false);
906 pp_string (buffer
, ">");
910 case ARRAY_RANGE_REF
:
911 op0
= TREE_OPERAND (node
, 0);
912 if (op_prio (op0
) < op_prio (node
))
913 pp_character (buffer
, '(');
914 dump_generic_node (buffer
, op0
, spc
, flags
, false);
915 if (op_prio (op0
) < op_prio (node
))
916 pp_character (buffer
, ')');
917 pp_character (buffer
, '[');
918 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
919 if (TREE_CODE (node
) == ARRAY_RANGE_REF
)
920 pp_string (buffer
, " ...");
921 pp_character (buffer
, ']');
923 op0
= array_ref_low_bound (node
);
924 op1
= array_ref_element_size (node
);
926 if (!integer_zerop (op0
)
927 || (TYPE_SIZE_UNIT (TREE_TYPE (node
))
928 && !operand_equal_p (op1
, TYPE_SIZE_UNIT (TREE_TYPE (node
)), 0)))
930 pp_string (buffer
, "{lb: ");
931 dump_generic_node (buffer
, op0
, spc
, flags
, false);
932 pp_string (buffer
, " sz: ");
933 dump_generic_node (buffer
, op1
, spc
, flags
, false);
934 pp_character (buffer
, '}');
940 unsigned HOST_WIDE_INT ix
;
942 bool is_struct_init
= FALSE
;
943 pp_character (buffer
, '{');
944 if (TREE_CODE (TREE_TYPE (node
)) == RECORD_TYPE
945 || TREE_CODE (TREE_TYPE (node
)) == UNION_TYPE
)
946 is_struct_init
= TRUE
;
947 FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (node
), ix
, field
, val
)
949 if (field
&& is_struct_init
)
951 pp_character (buffer
, '.');
952 dump_generic_node (buffer
, field
, spc
, flags
, false);
953 pp_string (buffer
, "=");
955 if (val
&& TREE_CODE (val
) == ADDR_EXPR
)
956 if (TREE_CODE (TREE_OPERAND (val
, 0)) == FUNCTION_DECL
)
957 val
= TREE_OPERAND (val
, 0);
958 if (val
&& TREE_CODE (val
) == FUNCTION_DECL
)
959 dump_decl_name (buffer
, val
, flags
);
961 dump_generic_node (buffer
, val
, spc
, flags
, false);
962 if (ix
!= VEC_length (constructor_elt
, CONSTRUCTOR_ELTS (node
)) - 1)
964 pp_character (buffer
, ',');
968 pp_character (buffer
, '}');
975 if (flags
& TDF_SLIM
)
977 pp_string (buffer
, "<COMPOUND_EXPR>");
981 dump_generic_node (buffer
, TREE_OPERAND (node
, 0),
982 spc
, flags
, !(flags
& TDF_SLIM
));
983 if (flags
& TDF_SLIM
)
984 newline_and_indent (buffer
, spc
);
987 pp_character (buffer
, ',');
991 for (tp
= &TREE_OPERAND (node
, 1);
992 TREE_CODE (*tp
) == COMPOUND_EXPR
;
993 tp
= &TREE_OPERAND (*tp
, 1))
995 dump_generic_node (buffer
, TREE_OPERAND (*tp
, 0),
996 spc
, flags
, !(flags
& TDF_SLIM
));
997 if (flags
& TDF_SLIM
)
998 newline_and_indent (buffer
, spc
);
1001 pp_character (buffer
, ',');
1006 dump_generic_node (buffer
, *tp
, spc
, flags
, !(flags
& TDF_SLIM
));
1010 case STATEMENT_LIST
:
1012 tree_stmt_iterator si
;
1015 if (flags
& TDF_SLIM
)
1017 pp_string (buffer
, "<STATEMENT_LIST>");
1021 for (si
= tsi_start (node
); !tsi_end_p (si
); tsi_next (&si
))
1024 newline_and_indent (buffer
, spc
);
1027 dump_generic_node (buffer
, tsi_stmt (si
), spc
, flags
, true);
1034 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1036 pp_character (buffer
, '=');
1038 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1042 pp_string (buffer
, "TARGET_EXPR <");
1043 dump_generic_node (buffer
, TARGET_EXPR_SLOT (node
), spc
, flags
, false);
1044 pp_character (buffer
, ',');
1046 dump_generic_node (buffer
, TARGET_EXPR_INITIAL (node
), spc
, flags
, false);
1047 pp_character (buffer
, '>');
1051 print_declaration (buffer
, DECL_EXPR_DECL (node
), spc
, flags
);
1056 if (TREE_TYPE (node
) == NULL
|| TREE_TYPE (node
) == void_type_node
)
1058 pp_string (buffer
, "if (");
1059 dump_generic_node (buffer
, COND_EXPR_COND (node
), spc
, flags
, false);
1060 pp_character (buffer
, ')');
1061 /* The lowered cond_exprs should always be printed in full. */
1062 if (COND_EXPR_THEN (node
)
1063 && (IS_EMPTY_STMT (COND_EXPR_THEN (node
))
1064 || TREE_CODE (COND_EXPR_THEN (node
)) == GOTO_EXPR
)
1065 && COND_EXPR_ELSE (node
)
1066 && (IS_EMPTY_STMT (COND_EXPR_ELSE (node
))
1067 || TREE_CODE (COND_EXPR_ELSE (node
)) == GOTO_EXPR
))
1070 dump_generic_node (buffer
, COND_EXPR_THEN (node
), 0, flags
, true);
1071 pp_string (buffer
, " else ");
1072 dump_generic_node (buffer
, COND_EXPR_ELSE (node
), 0, flags
, true);
1074 else if (!(flags
& TDF_SLIM
))
1076 /* Output COND_EXPR_THEN. */
1077 if (COND_EXPR_THEN (node
))
1079 newline_and_indent (buffer
, spc
+2);
1080 pp_character (buffer
, '{');
1081 newline_and_indent (buffer
, spc
+4);
1082 dump_generic_node (buffer
, COND_EXPR_THEN (node
), spc
+4,
1084 newline_and_indent (buffer
, spc
+2);
1085 pp_character (buffer
, '}');
1088 /* Output COND_EXPR_ELSE. */
1089 if (COND_EXPR_ELSE (node
))
1091 newline_and_indent (buffer
, spc
);
1092 pp_string (buffer
, "else");
1093 newline_and_indent (buffer
, spc
+2);
1094 pp_character (buffer
, '{');
1095 newline_and_indent (buffer
, spc
+4);
1096 dump_generic_node (buffer
, COND_EXPR_ELSE (node
), spc
+4,
1098 newline_and_indent (buffer
, spc
+2);
1099 pp_character (buffer
, '}');
1106 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1108 pp_character (buffer
, '?');
1110 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1112 pp_character (buffer
, ':');
1114 dump_generic_node (buffer
, TREE_OPERAND (node
, 2), spc
, flags
, false);
1119 pp_character (buffer
, '{');
1120 if (!(flags
& TDF_SLIM
))
1122 if (BIND_EXPR_VARS (node
))
1124 pp_newline (buffer
);
1126 for (op0
= BIND_EXPR_VARS (node
); op0
; op0
= TREE_CHAIN (op0
))
1128 print_declaration (buffer
, op0
, spc
+2, flags
);
1129 pp_newline (buffer
);
1133 newline_and_indent (buffer
, spc
+2);
1134 dump_generic_node (buffer
, BIND_EXPR_BODY (node
), spc
+2, flags
, true);
1135 newline_and_indent (buffer
, spc
);
1136 pp_character (buffer
, '}');
1142 print_call_name (buffer
, node
);
1144 /* Print parameters. */
1146 pp_character (buffer
, '(');
1147 op1
= TREE_OPERAND (node
, 1);
1149 dump_generic_node (buffer
, op1
, spc
, flags
, false);
1150 pp_character (buffer
, ')');
1152 op1
= TREE_OPERAND (node
, 2);
1155 pp_string (buffer
, " [static-chain: ");
1156 dump_generic_node (buffer
, op1
, spc
, flags
, false);
1157 pp_character (buffer
, ']');
1160 if (CALL_EXPR_RETURN_SLOT_OPT (node
))
1161 pp_string (buffer
, " [return slot optimization]");
1162 if (CALL_EXPR_TAILCALL (node
))
1163 pp_string (buffer
, " [tail call]");
1166 case WITH_CLEANUP_EXPR
:
1170 case CLEANUP_POINT_EXPR
:
1171 pp_string (buffer
, "<<cleanup_point ");
1172 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1173 pp_string (buffer
, ">>");
1176 case PLACEHOLDER_EXPR
:
1177 pp_string (buffer
, "<PLACEHOLDER_EXPR ");
1178 dump_generic_node (buffer
, TREE_TYPE (node
), spc
, flags
, false);
1179 pp_character (buffer
, '>');
1182 /* Binary arithmetic and logic expressions. */
1183 case WIDEN_SUM_EXPR
:
1184 case WIDEN_MULT_EXPR
:
1188 case TRUNC_DIV_EXPR
:
1190 case FLOOR_DIV_EXPR
:
1191 case ROUND_DIV_EXPR
:
1192 case TRUNC_MOD_EXPR
:
1194 case FLOOR_MOD_EXPR
:
1195 case ROUND_MOD_EXPR
:
1197 case EXACT_DIV_EXPR
:
1202 case VEC_LSHIFT_EXPR
:
1203 case VEC_RSHIFT_EXPR
:
1207 case TRUTH_ANDIF_EXPR
:
1208 case TRUTH_ORIF_EXPR
:
1209 case TRUTH_AND_EXPR
:
1211 case TRUTH_XOR_EXPR
:
1225 case UNORDERED_EXPR
:
1227 const char *op
= op_symbol (node
);
1228 op0
= TREE_OPERAND (node
, 0);
1229 op1
= TREE_OPERAND (node
, 1);
1231 /* When the operands are expressions with less priority,
1232 keep semantics of the tree representation. */
1233 if (op_prio (op0
) < op_prio (node
))
1235 pp_character (buffer
, '(');
1236 dump_generic_node (buffer
, op0
, spc
, flags
, false);
1237 pp_character (buffer
, ')');
1240 dump_generic_node (buffer
, op0
, spc
, flags
, false);
1243 pp_string (buffer
, op
);
1246 /* When the operands are expressions with less priority,
1247 keep semantics of the tree representation. */
1248 if (op_prio (op1
) < op_prio (node
))
1250 pp_character (buffer
, '(');
1251 dump_generic_node (buffer
, op1
, spc
, flags
, false);
1252 pp_character (buffer
, ')');
1255 dump_generic_node (buffer
, op1
, spc
, flags
, false);
1259 /* Unary arithmetic and logic expressions. */
1262 case TRUTH_NOT_EXPR
:
1264 case PREDECREMENT_EXPR
:
1265 case PREINCREMENT_EXPR
:
1266 case ALIGN_INDIRECT_REF
:
1267 case MISALIGNED_INDIRECT_REF
:
1269 if (TREE_CODE (node
) == ADDR_EXPR
1270 && (TREE_CODE (TREE_OPERAND (node
, 0)) == STRING_CST
1271 || TREE_CODE (TREE_OPERAND (node
, 0)) == FUNCTION_DECL
))
1272 ; /* Do not output '&' for strings and function pointers. */
1274 pp_string (buffer
, op_symbol (node
));
1276 if (op_prio (TREE_OPERAND (node
, 0)) < op_prio (node
))
1278 pp_character (buffer
, '(');
1279 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1280 pp_character (buffer
, ')');
1283 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1285 if (TREE_CODE (node
) == MISALIGNED_INDIRECT_REF
)
1287 pp_string (buffer
, "{misalignment: ");
1288 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1289 pp_character (buffer
, '}');
1293 case POSTDECREMENT_EXPR
:
1294 case POSTINCREMENT_EXPR
:
1295 if (op_prio (TREE_OPERAND (node
, 0)) < op_prio (node
))
1297 pp_character (buffer
, '(');
1298 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1299 pp_character (buffer
, ')');
1302 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1303 pp_string (buffer
, op_symbol (node
));
1307 pp_string (buffer
, "MIN_EXPR <");
1308 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1309 pp_string (buffer
, ", ");
1310 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1311 pp_character (buffer
, '>');
1315 pp_string (buffer
, "MAX_EXPR <");
1316 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1317 pp_string (buffer
, ", ");
1318 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1319 pp_character (buffer
, '>');
1323 pp_string (buffer
, "ABS_EXPR <");
1324 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1325 pp_character (buffer
, '>');
1332 case FIX_TRUNC_EXPR
:
1334 case FIX_FLOOR_EXPR
:
1335 case FIX_ROUND_EXPR
:
1339 type
= TREE_TYPE (node
);
1340 op0
= TREE_OPERAND (node
, 0);
1341 if (type
!= TREE_TYPE (op0
))
1343 pp_character (buffer
, '(');
1344 dump_generic_node (buffer
, type
, spc
, flags
, false);
1345 pp_string (buffer
, ") ");
1347 if (op_prio (op0
) < op_prio (node
))
1348 pp_character (buffer
, '(');
1349 dump_generic_node (buffer
, op0
, spc
, flags
, false);
1350 if (op_prio (op0
) < op_prio (node
))
1351 pp_character (buffer
, ')');
1354 case VIEW_CONVERT_EXPR
:
1355 pp_string (buffer
, "VIEW_CONVERT_EXPR<");
1356 dump_generic_node (buffer
, TREE_TYPE (node
), spc
, flags
, false);
1357 pp_string (buffer
, ">(");
1358 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1359 pp_character (buffer
, ')');
1362 case NON_LVALUE_EXPR
:
1363 pp_string (buffer
, "NON_LVALUE_EXPR <");
1364 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1365 pp_character (buffer
, '>');
1369 pp_string (buffer
, "SAVE_EXPR <");
1370 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1371 pp_character (buffer
, '>');
1375 pp_string (buffer
, "COMPLEX_EXPR <");
1376 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1377 pp_string (buffer
, ", ");
1378 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1379 pp_string (buffer
, ">");
1383 pp_string (buffer
, "CONJ_EXPR <");
1384 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1385 pp_string (buffer
, ">");
1389 pp_string (buffer
, "REALPART_EXPR <");
1390 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1391 pp_string (buffer
, ">");
1395 pp_string (buffer
, "IMAGPART_EXPR <");
1396 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1397 pp_string (buffer
, ">");
1401 pp_string (buffer
, "VA_ARG_EXPR <");
1402 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1403 pp_string (buffer
, ">");
1406 case TRY_FINALLY_EXPR
:
1407 case TRY_CATCH_EXPR
:
1408 pp_string (buffer
, "try");
1409 newline_and_indent (buffer
, spc
+2);
1410 pp_string (buffer
, "{");
1411 newline_and_indent (buffer
, spc
+4);
1412 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
+4, flags
, true);
1413 newline_and_indent (buffer
, spc
+2);
1414 pp_string (buffer
, "}");
1415 newline_and_indent (buffer
, spc
);
1417 (TREE_CODE (node
) == TRY_CATCH_EXPR
) ? "catch" : "finally");
1418 newline_and_indent (buffer
, spc
+2);
1419 pp_string (buffer
, "{");
1420 newline_and_indent (buffer
, spc
+4);
1421 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
+4, flags
, true);
1422 newline_and_indent (buffer
, spc
+2);
1423 pp_string (buffer
, "}");
1428 pp_string (buffer
, "catch (");
1429 dump_generic_node (buffer
, CATCH_TYPES (node
), spc
+2, flags
, false);
1430 pp_string (buffer
, ")");
1431 newline_and_indent (buffer
, spc
+2);
1432 pp_string (buffer
, "{");
1433 newline_and_indent (buffer
, spc
+4);
1434 dump_generic_node (buffer
, CATCH_BODY (node
), spc
+4, flags
, true);
1435 newline_and_indent (buffer
, spc
+2);
1436 pp_string (buffer
, "}");
1440 case EH_FILTER_EXPR
:
1441 pp_string (buffer
, "<<<eh_filter (");
1442 dump_generic_node (buffer
, EH_FILTER_TYPES (node
), spc
+2, flags
, false);
1443 pp_string (buffer
, ")>>>");
1444 newline_and_indent (buffer
, spc
+2);
1445 pp_string (buffer
, "{");
1446 newline_and_indent (buffer
, spc
+4);
1447 dump_generic_node (buffer
, EH_FILTER_FAILURE (node
), spc
+4, flags
, true);
1448 newline_and_indent (buffer
, spc
+2);
1449 pp_string (buffer
, "}");
1454 op0
= TREE_OPERAND (node
, 0);
1455 /* If this is for break or continue, don't bother printing it. */
1456 if (DECL_NAME (op0
))
1458 const char *name
= IDENTIFIER_POINTER (DECL_NAME (op0
));
1459 if (strcmp (name
, "break") == 0
1460 || strcmp (name
, "continue") == 0)
1463 dump_generic_node (buffer
, op0
, spc
, flags
, false);
1464 pp_character (buffer
, ':');
1465 if (DECL_NONLOCAL (op0
))
1466 pp_string (buffer
, " [non-local]");
1470 pp_string (buffer
, "<<<exception object>>>");
1474 pp_string (buffer
, "<<<filter object>>>");
1478 pp_string (buffer
, "while (1)");
1479 if (!(flags
& TDF_SLIM
))
1481 newline_and_indent (buffer
, spc
+2);
1482 pp_character (buffer
, '{');
1483 newline_and_indent (buffer
, spc
+4);
1484 dump_generic_node (buffer
, LOOP_EXPR_BODY (node
), spc
+4, flags
, true);
1485 newline_and_indent (buffer
, spc
+2);
1486 pp_character (buffer
, '}');
1492 pp_string (buffer
, "return");
1493 op0
= TREE_OPERAND (node
, 0);
1497 if (TREE_CODE (op0
) == MODIFY_EXPR
)
1498 dump_generic_node (buffer
, TREE_OPERAND (op0
, 1), spc
, flags
, false);
1500 dump_generic_node (buffer
, op0
, spc
, flags
, false);
1505 pp_string (buffer
, "if (");
1506 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1507 pp_string (buffer
, ") break");
1511 pp_string (buffer
, "switch (");
1512 dump_generic_node (buffer
, SWITCH_COND (node
), spc
, flags
, false);
1513 pp_character (buffer
, ')');
1514 if (!(flags
& TDF_SLIM
))
1516 newline_and_indent (buffer
, spc
+2);
1517 pp_character (buffer
, '{');
1518 if (SWITCH_BODY (node
))
1520 newline_and_indent (buffer
, spc
+4);
1521 dump_generic_node (buffer
, SWITCH_BODY (node
), spc
+4, flags
,
1526 tree vec
= SWITCH_LABELS (node
);
1527 size_t i
, n
= TREE_VEC_LENGTH (vec
);
1528 for (i
= 0; i
< n
; ++i
)
1530 tree elt
= TREE_VEC_ELT (vec
, i
);
1531 newline_and_indent (buffer
, spc
+4);
1534 dump_generic_node (buffer
, elt
, spc
+4, flags
, false);
1535 pp_string (buffer
, " goto ");
1536 dump_generic_node (buffer
, CASE_LABEL (elt
), spc
+4,
1538 pp_semicolon (buffer
);
1541 pp_string (buffer
, "case ???: goto ???;");
1544 newline_and_indent (buffer
, spc
+2);
1545 pp_character (buffer
, '}');
1551 op0
= GOTO_DESTINATION (node
);
1552 if (TREE_CODE (op0
) != SSA_NAME
&& DECL_P (op0
) && DECL_NAME (op0
))
1554 const char *name
= IDENTIFIER_POINTER (DECL_NAME (op0
));
1555 if (strcmp (name
, "break") == 0
1556 || strcmp (name
, "continue") == 0)
1558 pp_string (buffer
, name
);
1562 pp_string (buffer
, "goto ");
1563 dump_generic_node (buffer
, op0
, spc
, flags
, false);
1567 pp_string (buffer
, "resx");
1568 /* ??? Any sensible way to present the eh region? */
1572 pp_string (buffer
, "__asm__");
1573 if (ASM_VOLATILE_P (node
))
1574 pp_string (buffer
, " __volatile__");
1575 pp_character (buffer
, '(');
1576 dump_generic_node (buffer
, ASM_STRING (node
), spc
, flags
, false);
1577 pp_character (buffer
, ':');
1578 dump_generic_node (buffer
, ASM_OUTPUTS (node
), spc
, flags
, false);
1579 pp_character (buffer
, ':');
1580 dump_generic_node (buffer
, ASM_INPUTS (node
), spc
, flags
, false);
1581 if (ASM_CLOBBERS (node
))
1583 pp_character (buffer
, ':');
1584 dump_generic_node (buffer
, ASM_CLOBBERS (node
), spc
, flags
, false);
1586 pp_string (buffer
, ")");
1589 case CASE_LABEL_EXPR
:
1590 if (CASE_LOW (node
) && CASE_HIGH (node
))
1592 pp_string (buffer
, "case ");
1593 dump_generic_node (buffer
, CASE_LOW (node
), spc
, flags
, false);
1594 pp_string (buffer
, " ... ");
1595 dump_generic_node (buffer
, CASE_HIGH (node
), spc
, flags
, false);
1597 else if (CASE_LOW (node
))
1599 pp_string (buffer
, "case ");
1600 dump_generic_node (buffer
, CASE_LOW (node
), spc
, flags
, false);
1603 pp_string (buffer
, "default ");
1604 pp_character (buffer
, ':');
1608 pp_string (buffer
, "OBJ_TYPE_REF(");
1609 dump_generic_node (buffer
, OBJ_TYPE_REF_EXPR (node
), spc
, flags
, false);
1610 pp_character (buffer
, ';');
1611 dump_generic_node (buffer
, OBJ_TYPE_REF_OBJECT (node
), spc
, flags
, false);
1612 pp_character (buffer
, '-');
1613 pp_character (buffer
, '>');
1614 dump_generic_node (buffer
, OBJ_TYPE_REF_TOKEN (node
), spc
, flags
, false);
1615 pp_character (buffer
, ')');
1622 dump_generic_node (buffer
, PHI_RESULT (node
), spc
, flags
, false);
1623 pp_string (buffer
, " = PHI <");
1624 for (i
= 0; i
< PHI_NUM_ARGS (node
); i
++)
1626 dump_generic_node (buffer
, PHI_ARG_DEF (node
, i
), spc
, flags
, false);
1627 pp_string (buffer
, "(");
1628 pp_decimal_int (buffer
, PHI_ARG_EDGE (node
, i
)->src
->index
);
1629 pp_string (buffer
, ")");
1630 if (i
< PHI_NUM_ARGS (node
) - 1)
1631 pp_string (buffer
, ", ");
1633 pp_string (buffer
, ">;");
1638 dump_generic_node (buffer
, SSA_NAME_VAR (node
), spc
, flags
, false);
1639 pp_string (buffer
, "_");
1640 pp_decimal_int (buffer
, SSA_NAME_VERSION (node
));
1641 if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (node
))
1642 pp_string (buffer
, "(ab)");
1645 case WITH_SIZE_EXPR
:
1646 pp_string (buffer
, "WITH_SIZE_EXPR <");
1647 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1648 pp_string (buffer
, ", ");
1649 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1650 pp_string (buffer
, ">");
1654 pp_printf (buffer
, "VH.%d", VALUE_HANDLE_ID (node
));
1658 pp_string (buffer
, "ASSERT_EXPR <");
1659 dump_generic_node (buffer
, ASSERT_EXPR_VAR (node
), spc
, flags
, false);
1660 pp_string (buffer
, ", ");
1661 dump_generic_node (buffer
, ASSERT_EXPR_COND (node
), spc
, flags
, false);
1662 pp_string (buffer
, ">");
1666 pp_string (buffer
, "scev_known");
1669 case SCEV_NOT_KNOWN
:
1670 pp_string (buffer
, "scev_not_known");
1673 case POLYNOMIAL_CHREC
:
1674 pp_string (buffer
, "{");
1675 dump_generic_node (buffer
, CHREC_LEFT (node
), spc
, flags
, false);
1676 pp_string (buffer
, ", +, ");
1677 dump_generic_node (buffer
, CHREC_RIGHT (node
), spc
, flags
, false);
1678 pp_string (buffer
, "}_");
1679 dump_generic_node (buffer
, CHREC_VAR (node
), spc
, flags
, false);
1683 case REALIGN_LOAD_EXPR
:
1684 pp_string (buffer
, "REALIGN_LOAD <");
1685 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1686 pp_string (buffer
, ", ");
1687 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1688 pp_string (buffer
, ", ");
1689 dump_generic_node (buffer
, TREE_OPERAND (node
, 2), spc
, flags
, false);
1690 pp_string (buffer
, ">");
1694 pp_string (buffer
, " VEC_COND_EXPR < ");
1695 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1696 pp_string (buffer
, " , ");
1697 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1698 pp_string (buffer
, " , ");
1699 dump_generic_node (buffer
, TREE_OPERAND (node
, 2), spc
, flags
, false);
1700 pp_string (buffer
, " > ");
1704 pp_string (buffer
, " DOT_PROD_EXPR < ");
1705 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1706 pp_string (buffer
, " , ");
1707 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1708 pp_string (buffer
, " , ");
1709 dump_generic_node (buffer
, TREE_OPERAND (node
, 2), spc
, flags
, false);
1710 pp_string (buffer
, " > ");
1714 pp_string (buffer
, "#pragma omp parallel");
1715 dump_omp_clauses (buffer
, OMP_PARALLEL_CLAUSES (node
), spc
, flags
);
1716 if (OMP_PARALLEL_FN (node
))
1718 pp_string (buffer
, " [child fn: ");
1719 dump_generic_node (buffer
, OMP_PARALLEL_FN (node
), spc
, flags
, false);
1721 pp_string (buffer
, " (");
1723 if (OMP_PARALLEL_DATA_ARG (node
))
1724 dump_generic_node (buffer
, OMP_PARALLEL_DATA_ARG (node
), spc
, flags
,
1727 pp_string (buffer
, "???");
1729 pp_string (buffer
, ")]");
1733 if (!(flags
& TDF_SLIM
) && OMP_BODY (node
))
1735 newline_and_indent (buffer
, spc
+ 2);
1736 pp_character (buffer
, '{');
1737 newline_and_indent (buffer
, spc
+ 4);
1738 dump_generic_node (buffer
, OMP_BODY (node
), spc
+ 4, flags
, false);
1739 newline_and_indent (buffer
, spc
+ 2);
1740 pp_character (buffer
, '}');
1746 pp_string (buffer
, "#pragma omp for");
1747 dump_omp_clauses (buffer
, OMP_FOR_CLAUSES (node
), spc
, flags
);
1749 if (!(flags
& TDF_SLIM
))
1751 if (OMP_FOR_PRE_BODY (node
))
1753 newline_and_indent (buffer
, spc
+ 2);
1754 pp_character (buffer
, '{');
1756 newline_and_indent (buffer
, spc
);
1757 dump_generic_node (buffer
, OMP_FOR_PRE_BODY (node
),
1760 newline_and_indent (buffer
, spc
);
1761 pp_string (buffer
, "for (");
1762 dump_generic_node (buffer
, OMP_FOR_INIT (node
), spc
, flags
, false);
1763 pp_string (buffer
, "; ");
1764 dump_generic_node (buffer
, OMP_FOR_COND (node
), spc
, flags
, false);
1765 pp_string (buffer
, "; ");
1766 dump_generic_node (buffer
, OMP_FOR_INCR (node
), spc
, flags
, false);
1767 pp_string (buffer
, ")");
1768 if (OMP_FOR_BODY (node
))
1770 newline_and_indent (buffer
, spc
+ 2);
1771 pp_character (buffer
, '{');
1772 newline_and_indent (buffer
, spc
+ 4);
1773 dump_generic_node (buffer
, OMP_FOR_BODY (node
), spc
+ 4, flags
,
1775 newline_and_indent (buffer
, spc
+ 2);
1776 pp_character (buffer
, '}');
1778 if (OMP_FOR_PRE_BODY (node
))
1781 newline_and_indent (buffer
, spc
+ 2);
1782 pp_character (buffer
, '}');
1789 pp_string (buffer
, "#pragma omp sections");
1790 dump_omp_clauses (buffer
, OMP_SECTIONS_CLAUSES (node
), spc
, flags
);
1794 pp_string (buffer
, "#pragma omp section");
1798 pp_string (buffer
, "#pragma omp master");
1802 pp_string (buffer
, "#pragma omp ordered");
1806 pp_string (buffer
, "#pragma omp critical");
1807 if (OMP_CRITICAL_NAME (node
))
1810 pp_character (buffer
, '(');
1811 dump_generic_node (buffer
, OMP_CRITICAL_NAME (node
), spc
,
1813 pp_character (buffer
, ')');
1818 pp_string (buffer
, "#pragma omp atomic");
1819 newline_and_indent (buffer
, spc
+ 2);
1820 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1822 pp_character (buffer
, '=');
1824 dump_generic_node (buffer
, TREE_OPERAND (node
, 1), spc
, flags
, false);
1828 pp_string (buffer
, "#pragma omp single");
1829 dump_omp_clauses (buffer
, OMP_SINGLE_CLAUSES (node
), spc
, flags
);
1832 case OMP_RETURN_EXPR
:
1833 pp_string (buffer
, "OMP_RETURN");
1838 dump_omp_clause (buffer
, node
, spc
, flags
);
1842 case REDUC_MAX_EXPR
:
1843 pp_string (buffer
, " REDUC_MAX_EXPR < ");
1844 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1845 pp_string (buffer
, " > ");
1848 case REDUC_MIN_EXPR
:
1849 pp_string (buffer
, " REDUC_MIN_EXPR < ");
1850 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1851 pp_string (buffer
, " > ");
1854 case REDUC_PLUS_EXPR
:
1855 pp_string (buffer
, " REDUC_PLUS_EXPR < ");
1856 dump_generic_node (buffer
, TREE_OPERAND (node
, 0), spc
, flags
, false);
1857 pp_string (buffer
, " > ");
1863 pp_string (buffer
, "BLOCK");
1865 if (BLOCK_ABSTRACT (node
))
1866 pp_string (buffer
, " [abstract]");
1868 if (TREE_ASM_WRITTEN (node
))
1869 pp_string (buffer
, " [written]");
1871 newline_and_indent (buffer
, spc
+ 2);
1873 if (BLOCK_SUPERCONTEXT (node
))
1875 pp_string (buffer
, "SUPERCONTEXT: ");
1876 if (TREE_CODE (BLOCK_SUPERCONTEXT (node
)) == BLOCK
)
1877 pp_printf (buffer
, "BLOCK %p",
1878 (void *)BLOCK_SUPERCONTEXT (node
));
1880 dump_generic_node (buffer
, BLOCK_SUPERCONTEXT (node
), 0, flags
,
1882 newline_and_indent (buffer
, spc
+ 2);
1885 if (BLOCK_SUBBLOCKS (node
))
1887 pp_string (buffer
, "SUBBLOCKS: ");
1888 for (t
= BLOCK_SUBBLOCKS (node
); t
; t
= BLOCK_CHAIN (t
))
1889 pp_printf (buffer
, "%p ", (void *)t
);
1890 newline_and_indent (buffer
, spc
+ 2);
1893 if (BLOCK_VARS (node
))
1895 pp_string (buffer
, "VARS: ");
1896 for (t
= BLOCK_VARS (node
); t
; t
= TREE_CHAIN (t
))
1898 dump_generic_node (buffer
, t
, 0, flags
, false);
1899 pp_string (buffer
, " ");
1901 newline_and_indent (buffer
, spc
+ 2);
1904 if (BLOCK_ABSTRACT_ORIGIN (node
))
1906 pp_string (buffer
, "ABSTRACT_ORIGIN: ");
1907 if (TREE_CODE (BLOCK_ABSTRACT_ORIGIN (node
)) == BLOCK
)
1908 pp_printf (buffer
, "BLOCK %p",
1909 (void *)BLOCK_ABSTRACT_ORIGIN (node
));
1911 dump_generic_node (buffer
, BLOCK_ABSTRACT_ORIGIN (node
), 0, flags
,
1913 newline_and_indent (buffer
, spc
+ 2);
1922 if (is_stmt
&& is_expr
)
1923 pp_semicolon (buffer
);
1924 pp_write_text_to_stream (buffer
);
1929 /* Print the declaration of a variable. */
1932 print_declaration (pretty_printer
*buffer
, tree t
, int spc
, int flags
)
1936 if (TREE_CODE (t
) == TYPE_DECL
)
1937 pp_string (buffer
, "typedef ");
1939 if (CODE_CONTAINS_STRUCT (TREE_CODE (t
), TS_DECL_WRTL
) && DECL_REGISTER (t
))
1940 pp_string (buffer
, "register ");
1942 if (TREE_PUBLIC (t
) && DECL_EXTERNAL (t
))
1943 pp_string (buffer
, "extern ");
1944 else if (TREE_STATIC (t
))
1945 pp_string (buffer
, "static ");
1947 /* Print the type and name. */
1948 if (TREE_CODE (TREE_TYPE (t
)) == ARRAY_TYPE
)
1952 /* Print array's type. */
1953 tmp
= TREE_TYPE (t
);
1954 while (TREE_CODE (TREE_TYPE (tmp
)) == ARRAY_TYPE
)
1955 tmp
= TREE_TYPE (tmp
);
1956 dump_generic_node (buffer
, TREE_TYPE (tmp
), spc
, flags
, false);
1958 /* Print variable's name. */
1960 dump_generic_node (buffer
, t
, spc
, flags
, false);
1962 /* Print the dimensions. */
1963 tmp
= TREE_TYPE (t
);
1964 while (TREE_CODE (tmp
) == ARRAY_TYPE
)
1966 dump_array_domain (buffer
, TYPE_DOMAIN (tmp
), spc
, flags
);
1967 tmp
= TREE_TYPE (tmp
);
1970 else if (TREE_CODE (t
) == FUNCTION_DECL
)
1972 dump_generic_node (buffer
, TREE_TYPE (TREE_TYPE (t
)), spc
, flags
, false);
1974 dump_decl_name (buffer
, t
, flags
);
1975 dump_function_declaration (buffer
, TREE_TYPE (t
), spc
, flags
);
1979 /* Print type declaration. */
1980 dump_generic_node (buffer
, TREE_TYPE (t
), spc
, flags
, false);
1982 /* Print variable's name. */
1984 dump_generic_node (buffer
, t
, spc
, flags
, false);
1987 if (TREE_CODE (t
) == VAR_DECL
&& DECL_HARD_REGISTER (t
))
1989 pp_string (buffer
, " __asm__ ");
1990 pp_character (buffer
, '(');
1991 dump_generic_node (buffer
, DECL_ASSEMBLER_NAME (t
), spc
, flags
, false);
1992 pp_character (buffer
, ')');
1995 /* The initial value of a function serves to determine wether the function
1996 is declared or defined. So the following does not apply to function
1998 if (TREE_CODE (t
) != FUNCTION_DECL
)
2000 /* Print the initial value. */
2001 if (DECL_INITIAL (t
))
2004 pp_character (buffer
, '=');
2006 dump_generic_node (buffer
, DECL_INITIAL (t
), spc
, flags
, false);
2010 if (TREE_CODE (t
) == VAR_DECL
&& DECL_HAS_VALUE_EXPR_P (t
))
2012 pp_string (buffer
, " [value-expr: ");
2013 dump_generic_node (buffer
, DECL_VALUE_EXPR (t
), spc
, flags
, false);
2014 pp_character (buffer
, ']');
2017 pp_character (buffer
, ';');
2021 /* Prints a structure: name, fields, and methods.
2022 FIXME: Still incomplete. */
2025 print_struct_decl (pretty_printer
*buffer
, tree node
, int spc
, int flags
)
2027 /* Print the name of the structure. */
2028 if (TYPE_NAME (node
))
2031 if (TREE_CODE (node
) == RECORD_TYPE
)
2032 pp_string (buffer
, "struct ");
2033 else if ((TREE_CODE (node
) == UNION_TYPE
2034 || TREE_CODE (node
) == QUAL_UNION_TYPE
))
2035 pp_string (buffer
, "union ");
2037 dump_generic_node (buffer
, TYPE_NAME (node
), spc
, 0, false);
2040 /* Print the contents of the structure. */
2041 pp_newline (buffer
);
2043 pp_character (buffer
, '{');
2044 pp_newline (buffer
);
2046 /* Print the fields of the structure. */
2049 tmp
= TYPE_FIELDS (node
);
2052 /* Avoid to print recursively the structure. */
2053 /* FIXME : Not implemented correctly...,
2054 what about the case when we have a cycle in the contain graph? ...
2055 Maybe this could be solved by looking at the scope in which the
2056 structure was declared. */
2057 if (TREE_TYPE (tmp
) != node
2058 || (TREE_CODE (TREE_TYPE (tmp
)) == POINTER_TYPE
2059 && TREE_TYPE (TREE_TYPE (tmp
)) != node
))
2061 print_declaration (buffer
, tmp
, spc
+2, flags
);
2062 pp_newline (buffer
);
2064 tmp
= TREE_CHAIN (tmp
);
2068 pp_character (buffer
, '}');
2071 /* Return the priority of the operator OP.
2073 From lowest to highest precedence with either left-to-right (L-R)
2074 or right-to-left (R-L) associativity]:
2077 2 [R-L] = += -= *= /= %= &= ^= |= <<= >>=
2089 14 [R-L] ! ~ ++ -- + - * & (type) sizeof
2090 15 [L-R] fn() [] -> .
2092 unary +, - and * have higher precedence than the corresponding binary
2101 switch (TREE_CODE (op
))
2116 case TRUTH_ORIF_EXPR
:
2119 case TRUTH_AND_EXPR
:
2120 case TRUTH_ANDIF_EXPR
:
2127 case TRUTH_XOR_EXPR
:
2144 case UNORDERED_EXPR
:
2157 case WIDEN_SUM_EXPR
:
2162 case WIDEN_MULT_EXPR
:
2165 case TRUNC_DIV_EXPR
:
2167 case FLOOR_DIV_EXPR
:
2168 case ROUND_DIV_EXPR
:
2170 case EXACT_DIV_EXPR
:
2171 case TRUNC_MOD_EXPR
:
2173 case FLOOR_MOD_EXPR
:
2174 case ROUND_MOD_EXPR
:
2177 case TRUTH_NOT_EXPR
:
2179 case POSTINCREMENT_EXPR
:
2180 case POSTDECREMENT_EXPR
:
2181 case PREINCREMENT_EXPR
:
2182 case PREDECREMENT_EXPR
:
2184 case ALIGN_INDIRECT_REF
:
2185 case MISALIGNED_INDIRECT_REF
:
2191 case FIX_TRUNC_EXPR
:
2193 case FIX_FLOOR_EXPR
:
2194 case FIX_ROUND_EXPR
:
2200 case ARRAY_RANGE_REF
:
2204 /* Special expressions. */
2210 case REDUC_MAX_EXPR
:
2211 case REDUC_MIN_EXPR
:
2212 case REDUC_PLUS_EXPR
:
2213 case VEC_LSHIFT_EXPR
:
2214 case VEC_RSHIFT_EXPR
:
2218 case NON_LVALUE_EXPR
:
2219 return op_prio (TREE_OPERAND (op
, 0));
2222 /* Return an arbitrarily high precedence to avoid surrounding single
2223 VAR_DECLs in ()s. */
2229 /* Return the symbol associated with operator OP. */
2232 op_symbol_1 (enum tree_code code
)
2240 case TRUTH_ORIF_EXPR
:
2243 case TRUTH_AND_EXPR
:
2244 case TRUTH_ANDIF_EXPR
:
2250 case TRUTH_XOR_EXPR
:
2260 case UNORDERED_EXPR
:
2306 case VEC_LSHIFT_EXPR
:
2309 case VEC_RSHIFT_EXPR
:
2315 case REDUC_PLUS_EXPR
:
2318 case WIDEN_SUM_EXPR
:
2321 case WIDEN_MULT_EXPR
:
2331 case TRUTH_NOT_EXPR
:
2338 case ALIGN_INDIRECT_REF
:
2341 case MISALIGNED_INDIRECT_REF
:
2344 case TRUNC_DIV_EXPR
:
2351 case FLOOR_DIV_EXPR
:
2354 case ROUND_DIV_EXPR
:
2357 case EXACT_DIV_EXPR
:
2360 case TRUNC_MOD_EXPR
:
2366 case FLOOR_MOD_EXPR
:
2369 case ROUND_MOD_EXPR
:
2372 case PREDECREMENT_EXPR
:
2375 case PREINCREMENT_EXPR
:
2378 case POSTDECREMENT_EXPR
:
2381 case POSTINCREMENT_EXPR
:
2391 return "<<< ??? >>>";
2398 return op_symbol_1 (TREE_CODE (op
));
2401 /* Prints the name of a CALL_EXPR. */
2404 print_call_name (pretty_printer
*buffer
, tree node
)
2408 gcc_assert (TREE_CODE (node
) == CALL_EXPR
);
2410 op0
= TREE_OPERAND (node
, 0);
2412 if (TREE_CODE (op0
) == NON_LVALUE_EXPR
)
2413 op0
= TREE_OPERAND (op0
, 0);
2415 switch (TREE_CODE (op0
))
2419 dump_function_name (buffer
, op0
);
2425 dump_generic_node (buffer
, TREE_OPERAND (op0
, 0), 0, 0, false);
2429 pp_string (buffer
, "(");
2430 dump_generic_node (buffer
, TREE_OPERAND (op0
, 0), 0, 0, false);
2431 pp_string (buffer
, ") ? ");
2432 dump_generic_node (buffer
, TREE_OPERAND (op0
, 1), 0, 0, false);
2433 pp_string (buffer
, " : ");
2434 dump_generic_node (buffer
, TREE_OPERAND (op0
, 2), 0, 0, false);
2438 /* The function is a pointer contained in a structure. */
2439 if (TREE_CODE (TREE_OPERAND (op0
, 0)) == INDIRECT_REF
||
2440 TREE_CODE (TREE_OPERAND (op0
, 0)) == VAR_DECL
)
2441 dump_function_name (buffer
, TREE_OPERAND (op0
, 1));
2443 dump_generic_node (buffer
, TREE_OPERAND (op0
, 0), 0, 0, false);
2445 We can have several levels of structures and a function
2446 pointer inside. This is not implemented yet... */
2451 if (TREE_CODE (TREE_OPERAND (op0
, 0)) == VAR_DECL
)
2452 dump_function_name (buffer
, TREE_OPERAND (op0
, 0));
2454 dump_generic_node (buffer
, op0
, 0, 0, false);
2459 dump_generic_node (buffer
, op0
, 0, 0, false);
2467 /* Parses the string STR and replaces new-lines by '\n', tabs by '\t', ... */
2470 pretty_print_string (pretty_printer
*buffer
, const char *str
)
2480 pp_string (buffer
, "\\b");
2484 pp_string (buffer
, "\\f");
2488 pp_string (buffer
, "\\n");
2492 pp_string (buffer
, "\\r");
2496 pp_string (buffer
, "\\t");
2500 pp_string (buffer
, "\\v");
2504 pp_string (buffer
, "\\\\");
2508 pp_string (buffer
, "\\\"");
2512 pp_string (buffer
, "\\'");
2516 pp_string (buffer
, "\\0");
2520 pp_string (buffer
, "\\1");
2524 pp_string (buffer
, "\\2");
2528 pp_string (buffer
, "\\3");
2532 pp_string (buffer
, "\\4");
2536 pp_string (buffer
, "\\5");
2540 pp_string (buffer
, "\\6");
2544 pp_string (buffer
, "\\7");
2548 pp_character (buffer
, str
[0]);
2556 maybe_init_pretty_print (FILE *file
)
2560 pp_construct (&buffer
, /* prefix */NULL
, /* line-width */0);
2561 pp_needs_newline (&buffer
) = true;
2565 buffer
.buffer
->stream
= file
;
2569 newline_and_indent (pretty_printer
*buffer
, int spc
)
2571 pp_newline (buffer
);
2576 dump_vops (pretty_printer
*buffer
, tree stmt
, int spc
, int flags
)
2579 use_operand_p use_p
;
2580 def_operand_p def_p
;
2581 use_operand_p kill_p
;
2584 if (!ssa_operands_active ())
2587 FOR_EACH_SSA_MAYDEF_OPERAND (def_p
, use_p
, stmt
, iter
)
2589 pp_string (buffer
, "# ");
2590 dump_generic_node (buffer
, DEF_FROM_PTR (def_p
),
2591 spc
+ 2, flags
, false);
2592 pp_string (buffer
, " = V_MAY_DEF <");
2593 dump_generic_node (buffer
, USE_FROM_PTR (use_p
),
2594 spc
+ 2, flags
, false);
2595 pp_string (buffer
, ">;");
2596 newline_and_indent (buffer
, spc
);
2599 FOR_EACH_SSA_MUSTDEF_OPERAND (def_p
, kill_p
, stmt
, iter
)
2601 pp_string (buffer
, "# ");
2602 dump_generic_node (buffer
, DEF_FROM_PTR (def_p
),
2603 spc
+ 2, flags
, false);
2604 pp_string (buffer
, " = V_MUST_DEF <");
2605 dump_generic_node (buffer
, USE_FROM_PTR (kill_p
),
2606 spc
+ 2, flags
, false);
2607 pp_string (buffer
, ">;");
2608 newline_and_indent (buffer
, spc
);
2611 FOR_EACH_SSA_TREE_OPERAND (use
, stmt
, iter
, SSA_OP_VUSE
)
2613 pp_string (buffer
, "# VUSE <");
2614 dump_generic_node (buffer
, use
, spc
+ 2, flags
, false);
2615 pp_string (buffer
, ">;");
2616 newline_and_indent (buffer
, spc
);
2620 /* Dumps basic block BB to FILE with details described by FLAGS and
2621 indented by INDENT spaces. */
2624 dump_generic_bb (FILE *file
, basic_block bb
, int indent
, int flags
)
2626 maybe_init_pretty_print (file
);
2627 dump_generic_bb_buff (&buffer
, bb
, indent
, flags
);
2631 /* Dumps header of basic block BB to buffer BUFFER indented by INDENT
2632 spaces and details described by flags. */
2635 dump_bb_header (pretty_printer
*buffer
, basic_block bb
, int indent
, int flags
)
2641 if (flags
& TDF_BLOCKS
)
2644 pp_string (buffer
, "# BLOCK ");
2645 pp_decimal_int (buffer
, bb
->index
);
2648 pp_string (buffer
, " freq:");
2649 pp_decimal_int (buffer
, bb
->frequency
);
2653 pp_string (buffer
, " count:");
2654 pp_widest_integer (buffer
, bb
->count
);
2657 if (flags
& TDF_LINENO
)
2659 block_stmt_iterator bsi
;
2661 for (bsi
= bsi_start (bb
); !bsi_end_p (bsi
); bsi_next (&bsi
))
2662 if (get_lineno (bsi_stmt (bsi
)) != -1)
2664 pp_string (buffer
, ", starting at line ");
2665 pp_decimal_int (buffer
, get_lineno (bsi_stmt (bsi
)));
2669 newline_and_indent (buffer
, indent
);
2671 pp_string (buffer
, "# PRED:");
2672 pp_write_text_to_stream (buffer
);
2673 FOR_EACH_EDGE (e
, ei
, bb
->preds
)
2674 if (flags
& TDF_SLIM
)
2676 pp_string (buffer
, " ");
2677 if (e
->src
== ENTRY_BLOCK_PTR
)
2678 pp_string (buffer
, "ENTRY");
2680 pp_decimal_int (buffer
, e
->src
->index
);
2683 dump_edge_info (buffer
->buffer
->stream
, e
, 0);
2684 pp_newline (buffer
);
2688 stmt
= first_stmt (bb
);
2689 if (!stmt
|| TREE_CODE (stmt
) != LABEL_EXPR
)
2691 INDENT (indent
- 2);
2692 pp_string (buffer
, "<bb ");
2693 pp_decimal_int (buffer
, bb
->index
);
2694 pp_string (buffer
, ">:");
2695 pp_newline (buffer
);
2698 pp_write_text_to_stream (buffer
);
2699 check_bb_profile (bb
, buffer
->buffer
->stream
);
2702 /* Dumps end of basic block BB to buffer BUFFER indented by INDENT
2706 dump_bb_end (pretty_printer
*buffer
, basic_block bb
, int indent
, int flags
)
2712 pp_string (buffer
, "# SUCC:");
2713 pp_write_text_to_stream (buffer
);
2714 FOR_EACH_EDGE (e
, ei
, bb
->succs
)
2715 if (flags
& TDF_SLIM
)
2717 pp_string (buffer
, " ");
2718 if (e
->dest
== EXIT_BLOCK_PTR
)
2719 pp_string (buffer
, "EXIT");
2721 pp_decimal_int (buffer
, e
->dest
->index
);
2724 dump_edge_info (buffer
->buffer
->stream
, e
, 1);
2725 pp_newline (buffer
);
2728 /* Dumps phi nodes of basic block BB to buffer BUFFER with details described by
2729 FLAGS indented by INDENT spaces. */
2732 dump_phi_nodes (pretty_printer
*buffer
, basic_block bb
, int indent
, int flags
)
2734 tree phi
= phi_nodes (bb
);
2738 for (; phi
; phi
= PHI_CHAIN (phi
))
2740 if (is_gimple_reg (PHI_RESULT (phi
)) || (flags
& TDF_VOPS
))
2743 pp_string (buffer
, "# ");
2744 dump_generic_node (buffer
, phi
, indent
, flags
, false);
2745 pp_newline (buffer
);
2750 /* Dump jump to basic block BB that is represented implicitly in the cfg
2754 pp_cfg_jump (pretty_printer
*buffer
, basic_block bb
)
2758 stmt
= first_stmt (bb
);
2760 pp_string (buffer
, "goto <bb ");
2761 pp_decimal_int (buffer
, bb
->index
);
2762 pp_string (buffer
, ">");
2763 if (stmt
&& TREE_CODE (stmt
) == LABEL_EXPR
)
2765 pp_string (buffer
, " (");
2766 dump_generic_node (buffer
, LABEL_EXPR_LABEL (stmt
), 0, 0, false);
2767 pp_string (buffer
, ")");
2769 pp_semicolon (buffer
);
2772 /* Dump edges represented implicitly in basic block BB to BUFFER, indented
2773 by INDENT spaces, with details given by FLAGS. */
2776 dump_implicit_edges (pretty_printer
*buffer
, basic_block bb
, int indent
,
2782 /* If there is a fallthru edge, we may need to add an artificial goto to the
2784 FOR_EACH_EDGE (e
, ei
, bb
->succs
)
2785 if (e
->flags
& EDGE_FALLTHRU
)
2787 if (e
&& e
->dest
!= bb
->next_bb
)
2791 if ((flags
& TDF_LINENO
)
2792 #ifdef USE_MAPPED_LOCATION
2793 && e
->goto_locus
!= UNKNOWN_LOCATION
2799 expanded_location goto_xloc
;
2800 #ifdef USE_MAPPED_LOCATION
2801 goto_xloc
= expand_location (e
->goto_locus
);
2803 goto_xloc
= *e
->goto_locus
;
2805 pp_character (buffer
, '[');
2808 pp_string (buffer
, goto_xloc
.file
);
2809 pp_string (buffer
, " : ");
2811 pp_decimal_int (buffer
, goto_xloc
.line
);
2812 pp_string (buffer
, "] ");
2815 pp_cfg_jump (buffer
, e
->dest
);
2816 pp_newline (buffer
);
2820 /* Dumps basic block BB to buffer BUFFER with details described by FLAGS and
2821 indented by INDENT spaces. */
2824 dump_generic_bb_buff (pretty_printer
*buffer
, basic_block bb
,
2825 int indent
, int flags
)
2827 block_stmt_iterator bsi
;
2829 int label_indent
= indent
- 2;
2831 if (label_indent
< 0)
2834 dump_bb_header (buffer
, bb
, indent
, flags
);
2836 dump_phi_nodes (buffer
, bb
, indent
, flags
);
2838 for (bsi
= bsi_start (bb
); !bsi_end_p (bsi
); bsi_next (&bsi
))
2842 stmt
= bsi_stmt (bsi
);
2844 curr_indent
= TREE_CODE (stmt
) == LABEL_EXPR
? label_indent
: indent
;
2846 INDENT (curr_indent
);
2847 dump_generic_node (buffer
, stmt
, curr_indent
, flags
, true);
2848 pp_newline (buffer
);
2851 dump_implicit_edges (buffer
, bb
, indent
, flags
);
2853 if (flags
& TDF_BLOCKS
)
2854 dump_bb_end (buffer
, bb
, indent
, flags
);