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)
106 print_generic_expr (stderr, t, TDF_VOPS|TDF_UID);
107 fprintf(stderr, " ");
110 fprintf (stderr, "\n");
113 /* Prints declaration DECL to the FILE with details specified by FLAGS. */
115 print_generic_decl (FILE *file, tree decl, int flags)
117 maybe_init_pretty_print (file);
118 print_declaration (&buffer, decl, 2, flags);
119 pp_write_text_to_stream (&buffer);
122 /* Print tree T, and its successors, on file FILE. FLAGS specifies details
123 to show in the dump. See TDF_* in tree.h. */
126 print_generic_stmt (FILE *file, tree t, int flags)
128 maybe_init_pretty_print (file);
129 dump_generic_node (&buffer, t, 0, flags, true);
133 /* Print tree T, and its successors, on file FILE. FLAGS specifies details
134 to show in the dump. See TDF_* in tree.h. The output is indented by
138 print_generic_stmt_indented (FILE *file, tree t, int flags, int indent)
142 maybe_init_pretty_print (file);
144 for (i = 0; i < indent; i++)
146 dump_generic_node (&buffer, t, indent, flags, true);
150 /* Print a single expression T on file FILE. FLAGS specifies details to show
151 in the dump. See TDF_* in tree.h. */
154 print_generic_expr (FILE *file, tree t, int flags)
156 maybe_init_pretty_print (file);
157 dump_generic_node (&buffer, t, 0, flags, false);
160 /* Dump the name of a _DECL node and its DECL_UID if TDF_UID is set
164 dump_decl_name (pretty_printer *buffer, tree node, int flags)
169 pp_tree_identifier (buffer, DECL_NAME (t));
170 if ((flags & TDF_UID)
171 || DECL_NAME (t) == NULL_TREE)
173 if (TREE_CODE (t) == LABEL_DECL
174 && LABEL_DECL_UID (t) != -1)
175 pp_printf (buffer, "L." HOST_WIDE_INT_PRINT_DEC,
179 char c = TREE_CODE (t) == CONST_DECL ? 'C' : 'D';
180 pp_printf (buffer, "%c.%u", c, DECL_UID (t));
185 /* Like the above, but used for pretty printing function calls. */
188 dump_function_name (pretty_printer *buffer, tree node)
190 if (DECL_NAME (node))
191 PRINT_FUNCTION_NAME (node);
193 dump_decl_name (buffer, node, 0);
196 /* Dump a function declaration. NODE is the FUNCTION_TYPE. BUFFER, SPC and
197 FLAGS are as in dump_generic_node. */
200 dump_function_declaration (pretty_printer *buffer, tree node,
203 bool wrote_arg = false;
207 pp_character (buffer, '(');
209 /* Print the argument types. The last element in the list is a VOID_TYPE.
210 The following avoids printing the last element. */
211 arg = TYPE_ARG_TYPES (node);
212 while (arg && TREE_CHAIN (arg) && arg != error_mark_node)
215 dump_generic_node (buffer, TREE_VALUE (arg), spc, flags, false);
216 arg = TREE_CHAIN (arg);
217 if (TREE_CHAIN (arg) && TREE_CODE (TREE_CHAIN (arg)) == TREE_LIST)
219 pp_character (buffer, ',');
225 pp_string (buffer, "void");
227 pp_character (buffer, ')');
230 /* Dump the domain associated with an array. */
233 dump_array_domain (pretty_printer *buffer, tree domain, int spc, int flags)
235 pp_character (buffer, '[');
238 tree min = TYPE_MIN_VALUE (domain);
239 tree max = TYPE_MAX_VALUE (domain);
242 && integer_zerop (min)
243 && host_integerp (max, 0))
244 pp_wide_integer (buffer, TREE_INT_CST_LOW (max) + 1);
248 dump_generic_node (buffer, min, spc, flags, false);
249 pp_character (buffer, ':');
251 dump_generic_node (buffer, max, spc, flags, false);
255 pp_string (buffer, "<unknown>");
256 pp_character (buffer, ']');
260 /* Dump OpenMP clause CLAUSE. BUFFER, CLAUSE, SPC and FLAGS are as in
261 dump_generic_node. */
264 dump_omp_clause (pretty_printer *buffer, tree clause, int spc, int flags)
268 switch (OMP_CLAUSE_CODE (clause))
270 case OMP_CLAUSE_PRIVATE:
273 case OMP_CLAUSE_SHARED:
276 case OMP_CLAUSE_FIRSTPRIVATE:
277 name = "firstprivate";
279 case OMP_CLAUSE_LASTPRIVATE:
280 name = "lastprivate";
282 case OMP_CLAUSE_COPYIN:
285 case OMP_CLAUSE_COPYPRIVATE:
286 name = "copyprivate";
289 pp_string (buffer, name);
290 pp_character (buffer, '(');
291 dump_generic_node (buffer, OMP_CLAUSE_DECL (clause),
293 pp_character (buffer, ')');
296 case OMP_CLAUSE_REDUCTION:
297 pp_string (buffer, "reduction(");
298 pp_string (buffer, op_symbol_1 (OMP_CLAUSE_REDUCTION_CODE (clause)));
299 pp_character (buffer, ':');
300 dump_generic_node (buffer, OMP_CLAUSE_DECL (clause),
302 pp_character (buffer, ')');
306 pp_string (buffer, "if(");
307 dump_generic_node (buffer, OMP_CLAUSE_IF_EXPR (clause),
309 pp_character (buffer, ')');
312 case OMP_CLAUSE_NUM_THREADS:
313 pp_string (buffer, "num_threads(");
314 dump_generic_node (buffer, OMP_CLAUSE_NUM_THREADS_EXPR (clause),
316 pp_character (buffer, ')');
319 case OMP_CLAUSE_NOWAIT:
320 pp_string (buffer, "nowait");
322 case OMP_CLAUSE_ORDERED:
323 pp_string (buffer, "ordered");
326 case OMP_CLAUSE_DEFAULT:
327 pp_string (buffer, "default(");
328 switch (OMP_CLAUSE_DEFAULT_KIND (clause))
330 case OMP_CLAUSE_DEFAULT_UNSPECIFIED:
332 case OMP_CLAUSE_DEFAULT_SHARED:
333 pp_string (buffer, "shared");
335 case OMP_CLAUSE_DEFAULT_NONE:
336 pp_string (buffer, "none");
338 case OMP_CLAUSE_DEFAULT_PRIVATE:
339 pp_string (buffer, "private");
344 pp_character (buffer, ')');
347 case OMP_CLAUSE_SCHEDULE:
348 pp_string (buffer, "schedule(");
349 switch (OMP_CLAUSE_SCHEDULE_KIND (clause))
351 case OMP_CLAUSE_SCHEDULE_STATIC:
352 pp_string (buffer, "static");
354 case OMP_CLAUSE_SCHEDULE_DYNAMIC:
355 pp_string (buffer, "dynamic");
357 case OMP_CLAUSE_SCHEDULE_GUIDED:
358 pp_string (buffer, "guided");
360 case OMP_CLAUSE_SCHEDULE_RUNTIME:
361 pp_string (buffer, "runtime");
366 if (OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (clause))
368 pp_character (buffer, ',');
369 dump_generic_node (buffer,
370 OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (clause),
373 pp_character (buffer, ')');
377 /* Should never happen. */
378 dump_generic_node (buffer, clause, spc, flags, false);
384 /* Dump the list of OpenMP clauses. BUFFER, SPC and FLAGS are as in
385 dump_generic_node. */
388 dump_omp_clauses (pretty_printer *buffer, tree clause, int spc, int flags)
396 dump_omp_clause (buffer, clause, spc, flags);
397 clause = OMP_CLAUSE_CHAIN (clause);
405 /* Dump the node NODE on the pretty_printer BUFFER, SPC spaces of indent.
406 FLAGS specifies details to show in the dump (see TDF_* in tree.h). If
407 IS_STMT is true, the object printed is considered to be a statement
408 and it is terminated by ';' if appropriate. */
411 dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
419 if (node == NULL_TREE)
422 is_expr = EXPR_P (node);
424 /* We use has_stmt_ann because CALL_EXPR can be both an expression
425 and a statement, and we have no guarantee that it will have a
426 stmt_ann when it is used as an RHS expression. stmt_ann will assert
427 if you call it on something with a non-stmt annotation attached. */
428 if (TREE_CODE (node) != ERROR_MARK
429 && is_gimple_stmt (node)
430 && (flags & TDF_VOPS)
431 && has_stmt_ann (node)
432 && TREE_CODE (node) != PHI_NODE)
433 dump_vops (buffer, node, spc, flags);
435 if (is_stmt && (flags & TDF_STMTADDR))
436 pp_printf (buffer, "<&%p> ", (void *)node);
438 if ((flags & TDF_LINENO) && EXPR_HAS_LOCATION (node))
440 expanded_location xloc = expand_location (EXPR_LOCATION (node));
441 pp_character (buffer, '[');
444 pp_string (buffer, xloc.file);
445 pp_string (buffer, " : ");
447 pp_decimal_int (buffer, xloc.line);
448 pp_string (buffer, "] ");
451 switch (TREE_CODE (node))
454 pp_string (buffer, "<<< error >>>");
457 case IDENTIFIER_NODE:
458 pp_tree_identifier (buffer, node);
462 while (node && node != error_mark_node)
464 if (TREE_PURPOSE (node))
466 dump_generic_node (buffer, TREE_PURPOSE (node), spc, flags, false);
469 dump_generic_node (buffer, TREE_VALUE (node), spc, flags, false);
470 node = TREE_CHAIN (node);
471 if (node && TREE_CODE (node) == TREE_LIST)
473 pp_character (buffer, ',');
480 dump_generic_node (buffer, BINFO_TYPE (node), spc, flags, false);
485 if (TREE_VEC_LENGTH (node) > 0)
487 size_t len = TREE_VEC_LENGTH (node);
488 for (i = 0; i < len - 1; i++)
490 dump_generic_node (buffer, TREE_VEC_ELT (node, i), spc, flags,
492 pp_character (buffer, ',');
495 dump_generic_node (buffer, TREE_VEC_ELT (node, len - 1), spc,
509 unsigned int quals = TYPE_QUALS (node);
510 enum tree_code_class class;
512 if (quals & TYPE_QUAL_CONST)
513 pp_string (buffer, "const ");
514 else if (quals & TYPE_QUAL_VOLATILE)
515 pp_string (buffer, "volatile ");
516 else if (quals & TYPE_QUAL_RESTRICT)
517 pp_string (buffer, "restrict ");
519 class = TREE_CODE_CLASS (TREE_CODE (node));
521 if (class == tcc_declaration)
523 if (DECL_NAME (node))
524 dump_decl_name (buffer, node, flags);
526 pp_string (buffer, "<unnamed type decl>");
528 else if (class == tcc_type)
530 if (TYPE_NAME (node))
532 if (TREE_CODE (TYPE_NAME (node)) == IDENTIFIER_NODE)
533 pp_tree_identifier (buffer, TYPE_NAME (node));
534 else if (TREE_CODE (TYPE_NAME (node)) == TYPE_DECL
535 && DECL_NAME (TYPE_NAME (node)))
536 dump_decl_name (buffer, TYPE_NAME (node), flags);
538 pp_string (buffer, "<unnamed type>");
540 else if (TREE_CODE (node) == VECTOR_TYPE)
542 pp_string (buffer, "vector ");
543 dump_generic_node (buffer, TREE_TYPE (node),
547 pp_string (buffer, "<unnamed type>");
554 str = (TREE_CODE (node) == POINTER_TYPE ? "*" : "&");
556 if (TREE_CODE (TREE_TYPE (node)) == FUNCTION_TYPE)
558 tree fnode = TREE_TYPE (node);
560 dump_generic_node (buffer, TREE_TYPE (fnode), spc, flags, false);
562 pp_character (buffer, '(');
563 pp_string (buffer, str);
564 if (TYPE_NAME (node) && DECL_NAME (TYPE_NAME (node)))
565 dump_decl_name (buffer, TYPE_NAME (node), flags);
567 pp_printf (buffer, "<T%x>", TYPE_UID (node));
569 pp_character (buffer, ')');
570 dump_function_declaration (buffer, fnode, spc, flags);
574 unsigned int quals = TYPE_QUALS (node);
576 dump_generic_node (buffer, TREE_TYPE (node), spc, flags, false);
578 pp_string (buffer, str);
580 if (quals & TYPE_QUAL_CONST)
581 pp_string (buffer, " const");
582 else if (quals & TYPE_QUAL_VOLATILE)
583 pp_string (buffer, "volatile");
584 else if (quals & TYPE_QUAL_RESTRICT)
585 pp_string (buffer, " restrict");
587 if (TYPE_REF_CAN_ALIAS_ALL (node))
588 pp_string (buffer, " {ref-all}");
597 dump_decl_name (buffer, TYPE_NAME (TYPE_METHOD_BASETYPE (node)), flags);
598 pp_string (buffer, "::");
603 const char *sep = "";
606 pp_string (buffer, "MEM[");
608 tmp = TMR_SYMBOL (node);
611 pp_string (buffer, sep);
613 pp_string (buffer, "symbol: ");
614 dump_generic_node (buffer, tmp, spc, flags, false);
616 tmp = TMR_BASE (node);
619 pp_string (buffer, sep);
621 pp_string (buffer, "base: ");
622 dump_generic_node (buffer, tmp, spc, flags, false);
624 tmp = TMR_INDEX (node);
627 pp_string (buffer, sep);
629 pp_string (buffer, "index: ");
630 dump_generic_node (buffer, tmp, spc, flags, false);
632 tmp = TMR_STEP (node);
635 pp_string (buffer, sep);
637 pp_string (buffer, "step: ");
638 dump_generic_node (buffer, tmp, spc, flags, false);
640 tmp = TMR_OFFSET (node);
643 pp_string (buffer, sep);
645 pp_string (buffer, "offset: ");
646 dump_generic_node (buffer, tmp, spc, flags, false);
648 pp_string (buffer, "]");
649 if (flags & TDF_DETAILS)
651 pp_string (buffer, "{");
652 dump_generic_node (buffer, TMR_ORIGINAL (node), spc, flags,
654 pp_string (buffer, "}");
663 /* Print the innermost component type. */
664 for (tmp = TREE_TYPE (node); TREE_CODE (tmp) == ARRAY_TYPE;
665 tmp = TREE_TYPE (tmp))
667 dump_generic_node (buffer, tmp, spc, flags, false);
669 /* Print the dimensions. */
670 for (tmp = node; TREE_CODE (tmp) == ARRAY_TYPE; tmp = TREE_TYPE (tmp))
671 dump_array_domain (buffer, TYPE_DOMAIN (tmp), spc, flags);
677 case QUAL_UNION_TYPE:
678 /* Print the name of the structure. */
679 if (TREE_CODE (node) == RECORD_TYPE)
680 pp_string (buffer, "struct ");
681 else if (TREE_CODE (node) == UNION_TYPE)
682 pp_string (buffer, "union ");
684 if (TYPE_NAME (node))
685 dump_generic_node (buffer, TYPE_NAME (node), spc, flags, false);
687 print_struct_decl (buffer, node, spc, flags);
695 if (TREE_CODE (TREE_TYPE (node)) == POINTER_TYPE)
697 /* In the case of a pointer, one may want to divide by the
698 size of the pointed-to type. Unfortunately, this not
699 straightforward. The C front-end maps expressions
704 in such a way that the two INTEGER_CST nodes for "5" have
705 different values but identical types. In the latter
706 case, the 5 is multiplied by sizeof (int) in c-common.c
707 (pointer_int_sum) to convert it to a byte address, and
708 yet the type of the node is left unchanged. Argh. What
709 is consistent though is that the number value corresponds
710 to bytes (UNITS) offset.
712 NB: Neither of the following divisors can be trivially
713 used to recover the original literal:
715 TREE_INT_CST_LOW (TYPE_SIZE_UNIT (TREE_TYPE (node)))
716 TYPE_PRECISION (TREE_TYPE (TREE_TYPE (node))) */
717 pp_wide_integer (buffer, TREE_INT_CST_LOW (node));
718 pp_string (buffer, "B"); /* pseudo-unit */
720 else if (! host_integerp (node, 0))
724 if (tree_int_cst_sgn (val) < 0)
726 pp_character (buffer, '-');
727 val = build_int_cst_wide (NULL_TREE,
728 -TREE_INT_CST_LOW (val),
729 ~TREE_INT_CST_HIGH (val)
730 + !TREE_INT_CST_LOW (val));
732 /* Would "%x%0*x" or "%x%*0x" get zero-padding on all
735 static char format[10]; /* "%x%09999x\0" */
737 sprintf (format, "0x%%" HOST_WIDE_INT_PRINT "x"
738 "%%0%d" HOST_WIDE_INT_PRINT "x",
739 HOST_BITS_PER_WIDE_INT / 4);
740 sprintf (pp_buffer (buffer)->digit_buffer, format,
741 TREE_INT_CST_HIGH (val),
742 TREE_INT_CST_LOW (val));
743 pp_string (buffer, pp_buffer (buffer)->digit_buffer);
747 pp_wide_integer (buffer, TREE_INT_CST_LOW (node));
751 /* Code copied from print_node. */
754 if (TREE_OVERFLOW (node))
755 pp_string (buffer, " overflow");
757 #if !defined(REAL_IS_NOT_DOUBLE) || defined(REAL_ARITHMETIC)
758 d = TREE_REAL_CST (node);
759 if (REAL_VALUE_ISINF (d))
760 pp_string (buffer, " Inf");
761 else if (REAL_VALUE_ISNAN (d))
762 pp_string (buffer, " Nan");
766 real_to_decimal (string, &d, sizeof (string), 0, 1);
767 pp_string (buffer, string);
772 unsigned char *p = (unsigned char *) &TREE_REAL_CST (node);
773 pp_string (buffer, "0x");
774 for (i = 0; i < sizeof TREE_REAL_CST (node); i++)
775 output_formatted_integer (buffer, "%02x", *p++);
782 pp_string (buffer, "__complex__ (");
783 dump_generic_node (buffer, TREE_REALPART (node), spc, flags, false);
784 pp_string (buffer, ", ");
785 dump_generic_node (buffer, TREE_IMAGPART (node), spc, flags, false);
786 pp_string (buffer, ")");
790 pp_string (buffer, "\"");
791 pretty_print_string (buffer, TREE_STRING_POINTER (node));
792 pp_string (buffer, "\"");
798 pp_string (buffer, "{ ");
799 for (elt = TREE_VECTOR_CST_ELTS (node); elt; elt = TREE_CHAIN (elt))
801 dump_generic_node (buffer, TREE_VALUE (elt), spc, flags, false);
802 if (TREE_CHAIN (elt))
803 pp_string (buffer, ", ");
805 pp_string (buffer, " }");
814 dump_decl_name (buffer, node, flags);
818 if (DECL_NAME (node))
819 dump_decl_name (buffer, node, flags);
820 else if (LABEL_DECL_UID (node) != -1)
821 pp_printf (buffer, "<L" HOST_WIDE_INT_PRINT_DEC ">",
822 LABEL_DECL_UID (node));
824 pp_printf (buffer, "<D%u>", DECL_UID (node));
828 if (DECL_IS_BUILTIN (node))
830 /* Don't print the declaration of built-in types. */
833 if (DECL_NAME (node))
834 dump_decl_name (buffer, node, flags);
837 if ((TREE_CODE (TREE_TYPE (node)) == RECORD_TYPE
838 || TREE_CODE (TREE_TYPE (node)) == UNION_TYPE)
839 && TYPE_METHODS (TREE_TYPE (node)))
841 /* The type is a c++ class: all structures have at least
843 pp_string (buffer, "class ");
844 dump_generic_node (buffer, TREE_TYPE (node), spc, flags, false);
849 (TREE_CODE (TREE_TYPE (node)) == UNION_TYPE
850 ? "union" : "struct "));
851 dump_generic_node (buffer, TREE_TYPE (node), spc, flags, false);
856 case SYMBOL_MEMORY_TAG:
857 case NAME_MEMORY_TAG:
858 case STRUCT_FIELD_TAG:
863 dump_decl_name (buffer, node, flags);
867 pp_string (buffer, "<retval>");
871 op0 = TREE_OPERAND (node, 0);
873 if (TREE_CODE (op0) == INDIRECT_REF)
875 op0 = TREE_OPERAND (op0, 0);
878 if (op_prio (op0) < op_prio (node))
879 pp_character (buffer, '(');
880 dump_generic_node (buffer, op0, spc, flags, false);
881 if (op_prio (op0) < op_prio (node))
882 pp_character (buffer, ')');
883 pp_string (buffer, str);
884 dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
886 if (TREE_CODE (op0) != VALUE_HANDLE)
888 op0 = component_ref_field_offset (node);
889 if (op0 && TREE_CODE (op0) != INTEGER_CST)
891 pp_string (buffer, "{off: ");
892 dump_generic_node (buffer, op0, spc, flags, false);
893 pp_character (buffer, '}');
899 pp_string (buffer, "BIT_FIELD_REF <");
900 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
901 pp_string (buffer, ", ");
902 dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
903 pp_string (buffer, ", ");
904 dump_generic_node (buffer, TREE_OPERAND (node, 2), spc, flags, false);
905 pp_string (buffer, ">");
909 case ARRAY_RANGE_REF:
910 op0 = TREE_OPERAND (node, 0);
911 if (op_prio (op0) < op_prio (node))
912 pp_character (buffer, '(');
913 dump_generic_node (buffer, op0, spc, flags, false);
914 if (op_prio (op0) < op_prio (node))
915 pp_character (buffer, ')');
916 pp_character (buffer, '[');
917 dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
918 if (TREE_CODE (node) == ARRAY_RANGE_REF)
919 pp_string (buffer, " ...");
920 pp_character (buffer, ']');
922 op0 = array_ref_low_bound (node);
923 op1 = array_ref_element_size (node);
925 if (!integer_zerop (op0)
926 || (TYPE_SIZE_UNIT (TREE_TYPE (node))
927 && !operand_equal_p (op1, TYPE_SIZE_UNIT (TREE_TYPE (node)), 0)))
929 pp_string (buffer, "{lb: ");
930 dump_generic_node (buffer, op0, spc, flags, false);
931 pp_string (buffer, " sz: ");
932 dump_generic_node (buffer, op1, spc, flags, false);
933 pp_character (buffer, '}');
939 unsigned HOST_WIDE_INT ix;
941 bool is_struct_init = FALSE;
942 pp_character (buffer, '{');
943 if (TREE_CODE (TREE_TYPE (node)) == RECORD_TYPE
944 || TREE_CODE (TREE_TYPE (node)) == UNION_TYPE)
945 is_struct_init = TRUE;
946 FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (node), ix, field, val)
948 if (field && is_struct_init)
950 pp_character (buffer, '.');
951 dump_generic_node (buffer, field, spc, flags, false);
952 pp_string (buffer, "=");
954 if (val && TREE_CODE (val) == ADDR_EXPR)
955 if (TREE_CODE (TREE_OPERAND (val, 0)) == FUNCTION_DECL)
956 val = TREE_OPERAND (val, 0);
957 if (val && TREE_CODE (val) == FUNCTION_DECL)
958 dump_decl_name (buffer, val, flags);
960 dump_generic_node (buffer, val, spc, flags, false);
961 if (ix != VEC_length (constructor_elt, CONSTRUCTOR_ELTS (node)) - 1)
963 pp_character (buffer, ',');
967 pp_character (buffer, '}');
974 if (flags & TDF_SLIM)
976 pp_string (buffer, "<COMPOUND_EXPR>");
980 dump_generic_node (buffer, TREE_OPERAND (node, 0),
981 spc, flags, !(flags & TDF_SLIM));
982 if (flags & TDF_SLIM)
983 newline_and_indent (buffer, spc);
986 pp_character (buffer, ',');
990 for (tp = &TREE_OPERAND (node, 1);
991 TREE_CODE (*tp) == COMPOUND_EXPR;
992 tp = &TREE_OPERAND (*tp, 1))
994 dump_generic_node (buffer, TREE_OPERAND (*tp, 0),
995 spc, flags, !(flags & TDF_SLIM));
996 if (flags & TDF_SLIM)
997 newline_and_indent (buffer, spc);
1000 pp_character (buffer, ',');
1005 dump_generic_node (buffer, *tp, spc, flags, !(flags & TDF_SLIM));
1009 case STATEMENT_LIST:
1011 tree_stmt_iterator si;
1014 if (flags & TDF_SLIM)
1016 pp_string (buffer, "<STATEMENT_LIST>");
1020 for (si = tsi_start (node); !tsi_end_p (si); tsi_next (&si))
1023 newline_and_indent (buffer, spc);
1026 dump_generic_node (buffer, tsi_stmt (si), spc, flags, true);
1033 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1035 pp_character (buffer, '=');
1037 dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
1041 pp_string (buffer, "TARGET_EXPR <");
1042 dump_generic_node (buffer, TARGET_EXPR_SLOT (node), spc, flags, false);
1043 pp_character (buffer, ',');
1045 dump_generic_node (buffer, TARGET_EXPR_INITIAL (node), spc, flags, false);
1046 pp_character (buffer, '>');
1050 print_declaration (buffer, DECL_EXPR_DECL (node), spc, flags);
1055 if (TREE_TYPE (node) == NULL || TREE_TYPE (node) == void_type_node)
1057 pp_string (buffer, "if (");
1058 dump_generic_node (buffer, COND_EXPR_COND (node), spc, flags, false);
1059 pp_character (buffer, ')');
1060 /* The lowered cond_exprs should always be printed in full. */
1061 if (COND_EXPR_THEN (node)
1062 && (IS_EMPTY_STMT (COND_EXPR_THEN (node))
1063 || TREE_CODE (COND_EXPR_THEN (node)) == GOTO_EXPR)
1064 && COND_EXPR_ELSE (node)
1065 && (IS_EMPTY_STMT (COND_EXPR_ELSE (node))
1066 || TREE_CODE (COND_EXPR_ELSE (node)) == GOTO_EXPR))
1069 dump_generic_node (buffer, COND_EXPR_THEN (node), 0, flags, true);
1070 pp_string (buffer, " else ");
1071 dump_generic_node (buffer, COND_EXPR_ELSE (node), 0, flags, true);
1073 else if (!(flags & TDF_SLIM))
1075 /* Output COND_EXPR_THEN. */
1076 if (COND_EXPR_THEN (node))
1078 newline_and_indent (buffer, spc+2);
1079 pp_character (buffer, '{');
1080 newline_and_indent (buffer, spc+4);
1081 dump_generic_node (buffer, COND_EXPR_THEN (node), spc+4,
1083 newline_and_indent (buffer, spc+2);
1084 pp_character (buffer, '}');
1087 /* Output COND_EXPR_ELSE. */
1088 if (COND_EXPR_ELSE (node))
1090 newline_and_indent (buffer, spc);
1091 pp_string (buffer, "else");
1092 newline_and_indent (buffer, spc+2);
1093 pp_character (buffer, '{');
1094 newline_and_indent (buffer, spc+4);
1095 dump_generic_node (buffer, COND_EXPR_ELSE (node), spc+4,
1097 newline_and_indent (buffer, spc+2);
1098 pp_character (buffer, '}');
1105 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1107 pp_character (buffer, '?');
1109 dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
1111 pp_character (buffer, ':');
1113 dump_generic_node (buffer, TREE_OPERAND (node, 2), spc, flags, false);
1118 pp_character (buffer, '{');
1119 if (!(flags & TDF_SLIM))
1121 if (BIND_EXPR_VARS (node))
1123 pp_newline (buffer);
1125 for (op0 = BIND_EXPR_VARS (node); op0; op0 = TREE_CHAIN (op0))
1127 print_declaration (buffer, op0, spc+2, flags);
1128 pp_newline (buffer);
1132 newline_and_indent (buffer, spc+2);
1133 dump_generic_node (buffer, BIND_EXPR_BODY (node), spc+2, flags, true);
1134 newline_and_indent (buffer, spc);
1135 pp_character (buffer, '}');
1141 print_call_name (buffer, node);
1143 /* Print parameters. */
1145 pp_character (buffer, '(');
1146 op1 = TREE_OPERAND (node, 1);
1148 dump_generic_node (buffer, op1, spc, flags, false);
1149 pp_character (buffer, ')');
1151 op1 = TREE_OPERAND (node, 2);
1154 pp_string (buffer, " [static-chain: ");
1155 dump_generic_node (buffer, op1, spc, flags, false);
1156 pp_character (buffer, ']');
1159 if (CALL_EXPR_RETURN_SLOT_OPT (node))
1160 pp_string (buffer, " [return slot optimization]");
1161 if (CALL_EXPR_TAILCALL (node))
1162 pp_string (buffer, " [tail call]");
1165 case WITH_CLEANUP_EXPR:
1169 case CLEANUP_POINT_EXPR:
1170 pp_string (buffer, "<<cleanup_point ");
1171 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1172 pp_string (buffer, ">>");
1175 case PLACEHOLDER_EXPR:
1176 pp_string (buffer, "<PLACEHOLDER_EXPR ");
1177 dump_generic_node (buffer, TREE_TYPE (node), spc, flags, false);
1178 pp_character (buffer, '>');
1181 /* Binary arithmetic and logic expressions. */
1182 case WIDEN_SUM_EXPR:
1183 case WIDEN_MULT_EXPR:
1187 case TRUNC_DIV_EXPR:
1189 case FLOOR_DIV_EXPR:
1190 case ROUND_DIV_EXPR:
1191 case TRUNC_MOD_EXPR:
1193 case FLOOR_MOD_EXPR:
1194 case ROUND_MOD_EXPR:
1196 case EXACT_DIV_EXPR:
1201 case VEC_LSHIFT_EXPR:
1202 case VEC_RSHIFT_EXPR:
1206 case TRUTH_ANDIF_EXPR:
1207 case TRUTH_ORIF_EXPR:
1208 case TRUTH_AND_EXPR:
1210 case TRUTH_XOR_EXPR:
1224 case UNORDERED_EXPR:
1226 const char *op = op_symbol (node);
1227 op0 = TREE_OPERAND (node, 0);
1228 op1 = TREE_OPERAND (node, 1);
1230 /* When the operands are expressions with less priority,
1231 keep semantics of the tree representation. */
1232 if (op_prio (op0) < op_prio (node))
1234 pp_character (buffer, '(');
1235 dump_generic_node (buffer, op0, spc, flags, false);
1236 pp_character (buffer, ')');
1239 dump_generic_node (buffer, op0, spc, flags, false);
1242 pp_string (buffer, op);
1245 /* When the operands are expressions with less priority,
1246 keep semantics of the tree representation. */
1247 if (op_prio (op1) < op_prio (node))
1249 pp_character (buffer, '(');
1250 dump_generic_node (buffer, op1, spc, flags, false);
1251 pp_character (buffer, ')');
1254 dump_generic_node (buffer, op1, spc, flags, false);
1258 /* Unary arithmetic and logic expressions. */
1261 case TRUTH_NOT_EXPR:
1263 case PREDECREMENT_EXPR:
1264 case PREINCREMENT_EXPR:
1265 case ALIGN_INDIRECT_REF:
1266 case MISALIGNED_INDIRECT_REF:
1268 if (TREE_CODE (node) == ADDR_EXPR
1269 && (TREE_CODE (TREE_OPERAND (node, 0)) == STRING_CST
1270 || TREE_CODE (TREE_OPERAND (node, 0)) == FUNCTION_DECL))
1271 ; /* Do not output '&' for strings and function pointers. */
1273 pp_string (buffer, op_symbol (node));
1275 if (op_prio (TREE_OPERAND (node, 0)) < op_prio (node))
1277 pp_character (buffer, '(');
1278 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1279 pp_character (buffer, ')');
1282 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1284 if (TREE_CODE (node) == MISALIGNED_INDIRECT_REF)
1286 pp_string (buffer, "{misalignment: ");
1287 dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
1288 pp_character (buffer, '}');
1292 case POSTDECREMENT_EXPR:
1293 case POSTINCREMENT_EXPR:
1294 if (op_prio (TREE_OPERAND (node, 0)) < op_prio (node))
1296 pp_character (buffer, '(');
1297 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1298 pp_character (buffer, ')');
1301 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1302 pp_string (buffer, op_symbol (node));
1306 pp_string (buffer, "MIN_EXPR <");
1307 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1308 pp_string (buffer, ", ");
1309 dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
1310 pp_character (buffer, '>');
1314 pp_string (buffer, "MAX_EXPR <");
1315 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1316 pp_string (buffer, ", ");
1317 dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
1318 pp_character (buffer, '>');
1322 pp_string (buffer, "ABS_EXPR <");
1323 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1324 pp_character (buffer, '>');
1331 case FIX_TRUNC_EXPR:
1333 case FIX_FLOOR_EXPR:
1334 case FIX_ROUND_EXPR:
1338 type = TREE_TYPE (node);
1339 op0 = TREE_OPERAND (node, 0);
1340 if (type != TREE_TYPE (op0))
1342 pp_character (buffer, '(');
1343 dump_generic_node (buffer, type, spc, flags, false);
1344 pp_string (buffer, ") ");
1346 if (op_prio (op0) < op_prio (node))
1347 pp_character (buffer, '(');
1348 dump_generic_node (buffer, op0, spc, flags, false);
1349 if (op_prio (op0) < op_prio (node))
1350 pp_character (buffer, ')');
1353 case VIEW_CONVERT_EXPR:
1354 pp_string (buffer, "VIEW_CONVERT_EXPR<");
1355 dump_generic_node (buffer, TREE_TYPE (node), spc, flags, false);
1356 pp_string (buffer, ">(");
1357 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1358 pp_character (buffer, ')');
1361 case NON_LVALUE_EXPR:
1362 pp_string (buffer, "NON_LVALUE_EXPR <");
1363 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1364 pp_character (buffer, '>');
1368 pp_string (buffer, "SAVE_EXPR <");
1369 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1370 pp_character (buffer, '>');
1374 pp_string (buffer, "COMPLEX_EXPR <");
1375 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1376 pp_string (buffer, ", ");
1377 dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
1378 pp_string (buffer, ">");
1382 pp_string (buffer, "CONJ_EXPR <");
1383 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1384 pp_string (buffer, ">");
1388 pp_string (buffer, "REALPART_EXPR <");
1389 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1390 pp_string (buffer, ">");
1394 pp_string (buffer, "IMAGPART_EXPR <");
1395 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1396 pp_string (buffer, ">");
1400 pp_string (buffer, "VA_ARG_EXPR <");
1401 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1402 pp_string (buffer, ">");
1405 case TRY_FINALLY_EXPR:
1406 case TRY_CATCH_EXPR:
1407 pp_string (buffer, "try");
1408 newline_and_indent (buffer, spc+2);
1409 pp_string (buffer, "{");
1410 newline_and_indent (buffer, spc+4);
1411 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc+4, flags, true);
1412 newline_and_indent (buffer, spc+2);
1413 pp_string (buffer, "}");
1414 newline_and_indent (buffer, spc);
1416 (TREE_CODE (node) == TRY_CATCH_EXPR) ? "catch" : "finally");
1417 newline_and_indent (buffer, spc+2);
1418 pp_string (buffer, "{");
1419 newline_and_indent (buffer, spc+4);
1420 dump_generic_node (buffer, TREE_OPERAND (node, 1), spc+4, flags, true);
1421 newline_and_indent (buffer, spc+2);
1422 pp_string (buffer, "}");
1427 pp_string (buffer, "catch (");
1428 dump_generic_node (buffer, CATCH_TYPES (node), spc+2, flags, false);
1429 pp_string (buffer, ")");
1430 newline_and_indent (buffer, spc+2);
1431 pp_string (buffer, "{");
1432 newline_and_indent (buffer, spc+4);
1433 dump_generic_node (buffer, CATCH_BODY (node), spc+4, flags, true);
1434 newline_and_indent (buffer, spc+2);
1435 pp_string (buffer, "}");
1439 case EH_FILTER_EXPR:
1440 pp_string (buffer, "<<<eh_filter (");
1441 dump_generic_node (buffer, EH_FILTER_TYPES (node), spc+2, flags, false);
1442 pp_string (buffer, ")>>>");
1443 newline_and_indent (buffer, spc+2);
1444 pp_string (buffer, "{");
1445 newline_and_indent (buffer, spc+4);
1446 dump_generic_node (buffer, EH_FILTER_FAILURE (node), spc+4, flags, true);
1447 newline_and_indent (buffer, spc+2);
1448 pp_string (buffer, "}");
1453 op0 = TREE_OPERAND (node, 0);
1454 /* If this is for break or continue, don't bother printing it. */
1455 if (DECL_NAME (op0))
1457 const char *name = IDENTIFIER_POINTER (DECL_NAME (op0));
1458 if (strcmp (name, "break") == 0
1459 || strcmp (name, "continue") == 0)
1462 dump_generic_node (buffer, op0, spc, flags, false);
1463 pp_character (buffer, ':');
1464 if (DECL_NONLOCAL (op0))
1465 pp_string (buffer, " [non-local]");
1469 pp_string (buffer, "<<<exception object>>>");
1473 pp_string (buffer, "<<<filter object>>>");
1477 pp_string (buffer, "while (1)");
1478 if (!(flags & TDF_SLIM))
1480 newline_and_indent (buffer, spc+2);
1481 pp_character (buffer, '{');
1482 newline_and_indent (buffer, spc+4);
1483 dump_generic_node (buffer, LOOP_EXPR_BODY (node), spc+4, flags, true);
1484 newline_and_indent (buffer, spc+2);
1485 pp_character (buffer, '}');
1491 pp_string (buffer, "return");
1492 op0 = TREE_OPERAND (node, 0);
1496 if (TREE_CODE (op0) == MODIFY_EXPR)
1497 dump_generic_node (buffer, TREE_OPERAND (op0, 1), spc, flags, false);
1499 dump_generic_node (buffer, op0, spc, flags, false);
1504 pp_string (buffer, "if (");
1505 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1506 pp_string (buffer, ") break");
1510 pp_string (buffer, "switch (");
1511 dump_generic_node (buffer, SWITCH_COND (node), spc, flags, false);
1512 pp_character (buffer, ')');
1513 if (!(flags & TDF_SLIM))
1515 newline_and_indent (buffer, spc+2);
1516 pp_character (buffer, '{');
1517 if (SWITCH_BODY (node))
1519 newline_and_indent (buffer, spc+4);
1520 dump_generic_node (buffer, SWITCH_BODY (node), spc+4, flags,
1525 tree vec = SWITCH_LABELS (node);
1526 size_t i, n = TREE_VEC_LENGTH (vec);
1527 for (i = 0; i < n; ++i)
1529 tree elt = TREE_VEC_ELT (vec, i);
1530 newline_and_indent (buffer, spc+4);
1533 dump_generic_node (buffer, elt, spc+4, flags, false);
1534 pp_string (buffer, " goto ");
1535 dump_generic_node (buffer, CASE_LABEL (elt), spc+4,
1537 pp_semicolon (buffer);
1540 pp_string (buffer, "case ???: goto ???;");
1543 newline_and_indent (buffer, spc+2);
1544 pp_character (buffer, '}');
1550 op0 = GOTO_DESTINATION (node);
1551 if (TREE_CODE (op0) != SSA_NAME && DECL_P (op0) && DECL_NAME (op0))
1553 const char *name = IDENTIFIER_POINTER (DECL_NAME (op0));
1554 if (strcmp (name, "break") == 0
1555 || strcmp (name, "continue") == 0)
1557 pp_string (buffer, name);
1561 pp_string (buffer, "goto ");
1562 dump_generic_node (buffer, op0, spc, flags, false);
1566 pp_string (buffer, "resx ");
1567 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1571 pp_string (buffer, "__asm__");
1572 if (ASM_VOLATILE_P (node))
1573 pp_string (buffer, " __volatile__");
1574 pp_character (buffer, '(');
1575 dump_generic_node (buffer, ASM_STRING (node), spc, flags, false);
1576 pp_character (buffer, ':');
1577 dump_generic_node (buffer, ASM_OUTPUTS (node), spc, flags, false);
1578 pp_character (buffer, ':');
1579 dump_generic_node (buffer, ASM_INPUTS (node), spc, flags, false);
1580 if (ASM_CLOBBERS (node))
1582 pp_character (buffer, ':');
1583 dump_generic_node (buffer, ASM_CLOBBERS (node), spc, flags, false);
1585 pp_string (buffer, ")");
1588 case CASE_LABEL_EXPR:
1589 if (CASE_LOW (node) && CASE_HIGH (node))
1591 pp_string (buffer, "case ");
1592 dump_generic_node (buffer, CASE_LOW (node), spc, flags, false);
1593 pp_string (buffer, " ... ");
1594 dump_generic_node (buffer, CASE_HIGH (node), spc, flags, false);
1596 else if (CASE_LOW (node))
1598 pp_string (buffer, "case ");
1599 dump_generic_node (buffer, CASE_LOW (node), spc, flags, false);
1602 pp_string (buffer, "default ");
1603 pp_character (buffer, ':');
1607 pp_string (buffer, "OBJ_TYPE_REF(");
1608 dump_generic_node (buffer, OBJ_TYPE_REF_EXPR (node), spc, flags, false);
1609 pp_character (buffer, ';');
1610 dump_generic_node (buffer, OBJ_TYPE_REF_OBJECT (node), spc, flags, false);
1611 pp_character (buffer, '-');
1612 pp_character (buffer, '>');
1613 dump_generic_node (buffer, OBJ_TYPE_REF_TOKEN (node), spc, flags, false);
1614 pp_character (buffer, ')');
1621 dump_generic_node (buffer, PHI_RESULT (node), spc, flags, false);
1622 pp_string (buffer, " = PHI <");
1623 for (i = 0; i < PHI_NUM_ARGS (node); i++)
1625 dump_generic_node (buffer, PHI_ARG_DEF (node, i), spc, flags, false);
1626 pp_string (buffer, "(");
1627 pp_decimal_int (buffer, PHI_ARG_EDGE (node, i)->src->index);
1628 pp_string (buffer, ")");
1629 if (i < PHI_NUM_ARGS (node) - 1)
1630 pp_string (buffer, ", ");
1632 pp_string (buffer, ">;");
1637 dump_generic_node (buffer, SSA_NAME_VAR (node), spc, flags, false);
1638 pp_string (buffer, "_");
1639 pp_decimal_int (buffer, SSA_NAME_VERSION (node));
1640 if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (node))
1641 pp_string (buffer, "(ab)");
1644 case WITH_SIZE_EXPR:
1645 pp_string (buffer, "WITH_SIZE_EXPR <");
1646 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1647 pp_string (buffer, ", ");
1648 dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
1649 pp_string (buffer, ">");
1653 pp_printf (buffer, "VH.%d", VALUE_HANDLE_ID (node));
1657 pp_string (buffer, "ASSERT_EXPR <");
1658 dump_generic_node (buffer, ASSERT_EXPR_VAR (node), spc, flags, false);
1659 pp_string (buffer, ", ");
1660 dump_generic_node (buffer, ASSERT_EXPR_COND (node), spc, flags, false);
1661 pp_string (buffer, ">");
1665 pp_string (buffer, "scev_known");
1668 case SCEV_NOT_KNOWN:
1669 pp_string (buffer, "scev_not_known");
1672 case POLYNOMIAL_CHREC:
1673 pp_string (buffer, "{");
1674 dump_generic_node (buffer, CHREC_LEFT (node), spc, flags, false);
1675 pp_string (buffer, ", +, ");
1676 dump_generic_node (buffer, CHREC_RIGHT (node), spc, flags, false);
1677 pp_string (buffer, "}_");
1678 dump_generic_node (buffer, CHREC_VAR (node), spc, flags, false);
1682 case REALIGN_LOAD_EXPR:
1683 pp_string (buffer, "REALIGN_LOAD <");
1684 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1685 pp_string (buffer, ", ");
1686 dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
1687 pp_string (buffer, ", ");
1688 dump_generic_node (buffer, TREE_OPERAND (node, 2), spc, flags, false);
1689 pp_string (buffer, ">");
1693 pp_string (buffer, " VEC_COND_EXPR < ");
1694 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1695 pp_string (buffer, " , ");
1696 dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
1697 pp_string (buffer, " , ");
1698 dump_generic_node (buffer, TREE_OPERAND (node, 2), spc, flags, false);
1699 pp_string (buffer, " > ");
1703 pp_string (buffer, " DOT_PROD_EXPR < ");
1704 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1705 pp_string (buffer, " , ");
1706 dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
1707 pp_string (buffer, " , ");
1708 dump_generic_node (buffer, TREE_OPERAND (node, 2), spc, flags, false);
1709 pp_string (buffer, " > ");
1713 pp_string (buffer, "#pragma omp parallel");
1714 dump_omp_clauses (buffer, OMP_PARALLEL_CLAUSES (node), spc, flags);
1715 if (OMP_PARALLEL_FN (node))
1717 pp_string (buffer, " [child fn: ");
1718 dump_generic_node (buffer, OMP_PARALLEL_FN (node), spc, flags, false);
1720 pp_string (buffer, " (");
1722 if (OMP_PARALLEL_DATA_ARG (node))
1723 dump_generic_node (buffer, OMP_PARALLEL_DATA_ARG (node), spc, flags,
1726 pp_string (buffer, "???");
1728 pp_string (buffer, ")]");
1732 if (!(flags & TDF_SLIM) && OMP_BODY (node))
1734 newline_and_indent (buffer, spc + 2);
1735 pp_character (buffer, '{');
1736 newline_and_indent (buffer, spc + 4);
1737 dump_generic_node (buffer, OMP_BODY (node), spc + 4, flags, false);
1738 newline_and_indent (buffer, spc + 2);
1739 pp_character (buffer, '}');
1745 pp_string (buffer, "#pragma omp for");
1746 dump_omp_clauses (buffer, OMP_FOR_CLAUSES (node), spc, flags);
1748 if (!(flags & TDF_SLIM))
1750 if (OMP_FOR_PRE_BODY (node))
1752 newline_and_indent (buffer, spc + 2);
1753 pp_character (buffer, '{');
1755 newline_and_indent (buffer, spc);
1756 dump_generic_node (buffer, OMP_FOR_PRE_BODY (node),
1759 newline_and_indent (buffer, spc);
1760 pp_string (buffer, "for (");
1761 dump_generic_node (buffer, OMP_FOR_INIT (node), spc, flags, false);
1762 pp_string (buffer, "; ");
1763 dump_generic_node (buffer, OMP_FOR_COND (node), spc, flags, false);
1764 pp_string (buffer, "; ");
1765 dump_generic_node (buffer, OMP_FOR_INCR (node), spc, flags, false);
1766 pp_string (buffer, ")");
1767 if (OMP_FOR_BODY (node))
1769 newline_and_indent (buffer, spc + 2);
1770 pp_character (buffer, '{');
1771 newline_and_indent (buffer, spc + 4);
1772 dump_generic_node (buffer, OMP_FOR_BODY (node), spc + 4, flags,
1774 newline_and_indent (buffer, spc + 2);
1775 pp_character (buffer, '}');
1777 if (OMP_FOR_PRE_BODY (node))
1780 newline_and_indent (buffer, spc + 2);
1781 pp_character (buffer, '}');
1788 pp_string (buffer, "#pragma omp sections");
1789 dump_omp_clauses (buffer, OMP_SECTIONS_CLAUSES (node), spc, flags);
1793 pp_string (buffer, "#pragma omp section");
1797 pp_string (buffer, "#pragma omp master");
1801 pp_string (buffer, "#pragma omp ordered");
1805 pp_string (buffer, "#pragma omp critical");
1806 if (OMP_CRITICAL_NAME (node))
1809 pp_character (buffer, '(');
1810 dump_generic_node (buffer, OMP_CRITICAL_NAME (node), spc,
1812 pp_character (buffer, ')');
1817 pp_string (buffer, "#pragma omp atomic");
1818 newline_and_indent (buffer, spc + 2);
1819 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1821 pp_character (buffer, '=');
1823 dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
1827 pp_string (buffer, "#pragma omp single");
1828 dump_omp_clauses (buffer, OMP_SINGLE_CLAUSES (node), spc, flags);
1832 pp_string (buffer, "OMP_RETURN");
1833 if (OMP_RETURN_NOWAIT (node))
1834 pp_string (buffer, " [nowait]");
1839 pp_string (buffer, "OMP_CONTINUE");
1844 dump_omp_clause (buffer, node, spc, flags);
1848 case REDUC_MAX_EXPR:
1849 pp_string (buffer, " REDUC_MAX_EXPR < ");
1850 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1851 pp_string (buffer, " > ");
1854 case REDUC_MIN_EXPR:
1855 pp_string (buffer, " REDUC_MIN_EXPR < ");
1856 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1857 pp_string (buffer, " > ");
1860 case REDUC_PLUS_EXPR:
1861 pp_string (buffer, " REDUC_PLUS_EXPR < ");
1862 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1863 pp_string (buffer, " > ");
1869 pp_string (buffer, "BLOCK");
1871 if (BLOCK_ABSTRACT (node))
1872 pp_string (buffer, " [abstract]");
1874 if (TREE_ASM_WRITTEN (node))
1875 pp_string (buffer, " [written]");
1877 newline_and_indent (buffer, spc + 2);
1879 if (BLOCK_SUPERCONTEXT (node))
1881 pp_string (buffer, "SUPERCONTEXT: ");
1882 if (TREE_CODE (BLOCK_SUPERCONTEXT (node)) == BLOCK)
1883 pp_printf (buffer, "BLOCK %p",
1884 (void *)BLOCK_SUPERCONTEXT (node));
1886 dump_generic_node (buffer, BLOCK_SUPERCONTEXT (node), 0, flags,
1888 newline_and_indent (buffer, spc + 2);
1891 if (BLOCK_SUBBLOCKS (node))
1893 pp_string (buffer, "SUBBLOCKS: ");
1894 for (t = BLOCK_SUBBLOCKS (node); t; t = BLOCK_CHAIN (t))
1895 pp_printf (buffer, "%p ", (void *)t);
1896 newline_and_indent (buffer, spc + 2);
1899 if (BLOCK_VARS (node))
1901 pp_string (buffer, "VARS: ");
1902 for (t = BLOCK_VARS (node); t; t = TREE_CHAIN (t))
1904 dump_generic_node (buffer, t, 0, flags, false);
1905 pp_string (buffer, " ");
1907 newline_and_indent (buffer, spc + 2);
1910 if (BLOCK_ABSTRACT_ORIGIN (node))
1912 pp_string (buffer, "ABSTRACT_ORIGIN: ");
1913 if (TREE_CODE (BLOCK_ABSTRACT_ORIGIN (node)) == BLOCK)
1914 pp_printf (buffer, "BLOCK %p",
1915 (void *)BLOCK_ABSTRACT_ORIGIN (node));
1917 dump_generic_node (buffer, BLOCK_ABSTRACT_ORIGIN (node), 0, flags,
1919 newline_and_indent (buffer, spc + 2);
1928 if (is_stmt && is_expr)
1929 pp_semicolon (buffer);
1930 pp_write_text_to_stream (buffer);
1935 /* Print the declaration of a variable. */
1938 print_declaration (pretty_printer *buffer, tree t, int spc, int flags)
1942 if (TREE_CODE (t) == TYPE_DECL)
1943 pp_string (buffer, "typedef ");
1945 if (CODE_CONTAINS_STRUCT (TREE_CODE (t), TS_DECL_WRTL) && DECL_REGISTER (t))
1946 pp_string (buffer, "register ");
1948 if (TREE_PUBLIC (t) && DECL_EXTERNAL (t))
1949 pp_string (buffer, "extern ");
1950 else if (TREE_STATIC (t))
1951 pp_string (buffer, "static ");
1953 /* Print the type and name. */
1954 if (TREE_CODE (TREE_TYPE (t)) == ARRAY_TYPE)
1958 /* Print array's type. */
1959 tmp = TREE_TYPE (t);
1960 while (TREE_CODE (TREE_TYPE (tmp)) == ARRAY_TYPE)
1961 tmp = TREE_TYPE (tmp);
1962 dump_generic_node (buffer, TREE_TYPE (tmp), spc, flags, false);
1964 /* Print variable's name. */
1966 dump_generic_node (buffer, t, spc, flags, false);
1968 /* Print the dimensions. */
1969 tmp = TREE_TYPE (t);
1970 while (TREE_CODE (tmp) == ARRAY_TYPE)
1972 dump_array_domain (buffer, TYPE_DOMAIN (tmp), spc, flags);
1973 tmp = TREE_TYPE (tmp);
1976 else if (TREE_CODE (t) == FUNCTION_DECL)
1978 dump_generic_node (buffer, TREE_TYPE (TREE_TYPE (t)), spc, flags, false);
1980 dump_decl_name (buffer, t, flags);
1981 dump_function_declaration (buffer, TREE_TYPE (t), spc, flags);
1985 /* Print type declaration. */
1986 dump_generic_node (buffer, TREE_TYPE (t), spc, flags, false);
1988 /* Print variable's name. */
1990 dump_generic_node (buffer, t, spc, flags, false);
1993 if (TREE_CODE (t) == VAR_DECL && DECL_HARD_REGISTER (t))
1995 pp_string (buffer, " __asm__ ");
1996 pp_character (buffer, '(');
1997 dump_generic_node (buffer, DECL_ASSEMBLER_NAME (t), spc, flags, false);
1998 pp_character (buffer, ')');
2001 /* The initial value of a function serves to determine wether the function
2002 is declared or defined. So the following does not apply to function
2004 if (TREE_CODE (t) != FUNCTION_DECL)
2006 /* Print the initial value. */
2007 if (DECL_INITIAL (t))
2010 pp_character (buffer, '=');
2012 dump_generic_node (buffer, DECL_INITIAL (t), spc, flags, false);
2016 if (TREE_CODE (t) == VAR_DECL && DECL_HAS_VALUE_EXPR_P (t))
2018 pp_string (buffer, " [value-expr: ");
2019 dump_generic_node (buffer, DECL_VALUE_EXPR (t), spc, flags, false);
2020 pp_character (buffer, ']');
2023 pp_character (buffer, ';');
2027 /* Prints a structure: name, fields, and methods.
2028 FIXME: Still incomplete. */
2031 print_struct_decl (pretty_printer *buffer, tree node, int spc, int flags)
2033 /* Print the name of the structure. */
2034 if (TYPE_NAME (node))
2037 if (TREE_CODE (node) == RECORD_TYPE)
2038 pp_string (buffer, "struct ");
2039 else if ((TREE_CODE (node) == UNION_TYPE
2040 || TREE_CODE (node) == QUAL_UNION_TYPE))
2041 pp_string (buffer, "union ");
2043 dump_generic_node (buffer, TYPE_NAME (node), spc, 0, false);
2046 /* Print the contents of the structure. */
2047 pp_newline (buffer);
2049 pp_character (buffer, '{');
2050 pp_newline (buffer);
2052 /* Print the fields of the structure. */
2055 tmp = TYPE_FIELDS (node);
2058 /* Avoid to print recursively the structure. */
2059 /* FIXME : Not implemented correctly...,
2060 what about the case when we have a cycle in the contain graph? ...
2061 Maybe this could be solved by looking at the scope in which the
2062 structure was declared. */
2063 if (TREE_TYPE (tmp) != node
2064 || (TREE_CODE (TREE_TYPE (tmp)) == POINTER_TYPE
2065 && TREE_TYPE (TREE_TYPE (tmp)) != node))
2067 print_declaration (buffer, tmp, spc+2, flags);
2068 pp_newline (buffer);
2070 tmp = TREE_CHAIN (tmp);
2074 pp_character (buffer, '}');
2077 /* Return the priority of the operator OP.
2079 From lowest to highest precedence with either left-to-right (L-R)
2080 or right-to-left (R-L) associativity]:
2083 2 [R-L] = += -= *= /= %= &= ^= |= <<= >>=
2095 14 [R-L] ! ~ ++ -- + - * & (type) sizeof
2096 15 [L-R] fn() [] -> .
2098 unary +, - and * have higher precedence than the corresponding binary
2107 switch (TREE_CODE (op))
2122 case TRUTH_ORIF_EXPR:
2125 case TRUTH_AND_EXPR:
2126 case TRUTH_ANDIF_EXPR:
2133 case TRUTH_XOR_EXPR:
2150 case UNORDERED_EXPR:
2163 case WIDEN_SUM_EXPR:
2168 case WIDEN_MULT_EXPR:
2171 case TRUNC_DIV_EXPR:
2173 case FLOOR_DIV_EXPR:
2174 case ROUND_DIV_EXPR:
2176 case EXACT_DIV_EXPR:
2177 case TRUNC_MOD_EXPR:
2179 case FLOOR_MOD_EXPR:
2180 case ROUND_MOD_EXPR:
2183 case TRUTH_NOT_EXPR:
2185 case POSTINCREMENT_EXPR:
2186 case POSTDECREMENT_EXPR:
2187 case PREINCREMENT_EXPR:
2188 case PREDECREMENT_EXPR:
2190 case ALIGN_INDIRECT_REF:
2191 case MISALIGNED_INDIRECT_REF:
2197 case FIX_TRUNC_EXPR:
2199 case FIX_FLOOR_EXPR:
2200 case FIX_ROUND_EXPR:
2206 case ARRAY_RANGE_REF:
2210 /* Special expressions. */
2216 case REDUC_MAX_EXPR:
2217 case REDUC_MIN_EXPR:
2218 case REDUC_PLUS_EXPR:
2219 case VEC_LSHIFT_EXPR:
2220 case VEC_RSHIFT_EXPR:
2224 case NON_LVALUE_EXPR:
2225 return op_prio (TREE_OPERAND (op, 0));
2228 /* Return an arbitrarily high precedence to avoid surrounding single
2229 VAR_DECLs in ()s. */
2235 /* Return the symbol associated with operator OP. */
2238 op_symbol_1 (enum tree_code code)
2246 case TRUTH_ORIF_EXPR:
2249 case TRUTH_AND_EXPR:
2250 case TRUTH_ANDIF_EXPR:
2256 case TRUTH_XOR_EXPR:
2266 case UNORDERED_EXPR:
2312 case VEC_LSHIFT_EXPR:
2315 case VEC_RSHIFT_EXPR:
2321 case REDUC_PLUS_EXPR:
2324 case WIDEN_SUM_EXPR:
2327 case WIDEN_MULT_EXPR:
2337 case TRUTH_NOT_EXPR:
2344 case ALIGN_INDIRECT_REF:
2347 case MISALIGNED_INDIRECT_REF:
2350 case TRUNC_DIV_EXPR:
2357 case FLOOR_DIV_EXPR:
2360 case ROUND_DIV_EXPR:
2363 case EXACT_DIV_EXPR:
2366 case TRUNC_MOD_EXPR:
2372 case FLOOR_MOD_EXPR:
2375 case ROUND_MOD_EXPR:
2378 case PREDECREMENT_EXPR:
2381 case PREINCREMENT_EXPR:
2384 case POSTDECREMENT_EXPR:
2387 case POSTINCREMENT_EXPR:
2397 return "<<< ??? >>>";
2404 return op_symbol_1 (TREE_CODE (op));
2407 /* Prints the name of a CALL_EXPR. */
2410 print_call_name (pretty_printer *buffer, tree node)
2414 gcc_assert (TREE_CODE (node) == CALL_EXPR);
2416 op0 = TREE_OPERAND (node, 0);
2418 if (TREE_CODE (op0) == NON_LVALUE_EXPR)
2419 op0 = TREE_OPERAND (op0, 0);
2421 switch (TREE_CODE (op0))
2425 dump_function_name (buffer, op0);
2431 dump_generic_node (buffer, TREE_OPERAND (op0, 0), 0, 0, false);
2435 pp_string (buffer, "(");
2436 dump_generic_node (buffer, TREE_OPERAND (op0, 0), 0, 0, false);
2437 pp_string (buffer, ") ? ");
2438 dump_generic_node (buffer, TREE_OPERAND (op0, 1), 0, 0, false);
2439 pp_string (buffer, " : ");
2440 dump_generic_node (buffer, TREE_OPERAND (op0, 2), 0, 0, false);
2444 /* The function is a pointer contained in a structure. */
2445 if (TREE_CODE (TREE_OPERAND (op0, 0)) == INDIRECT_REF ||
2446 TREE_CODE (TREE_OPERAND (op0, 0)) == VAR_DECL)
2447 dump_function_name (buffer, TREE_OPERAND (op0, 1));
2449 dump_generic_node (buffer, TREE_OPERAND (op0, 0), 0, 0, false);
2451 We can have several levels of structures and a function
2452 pointer inside. This is not implemented yet... */
2457 if (TREE_CODE (TREE_OPERAND (op0, 0)) == VAR_DECL)
2458 dump_function_name (buffer, TREE_OPERAND (op0, 0));
2460 dump_generic_node (buffer, op0, 0, 0, false);
2465 dump_generic_node (buffer, op0, 0, 0, false);
2473 /* Parses the string STR and replaces new-lines by '\n', tabs by '\t', ... */
2476 pretty_print_string (pretty_printer *buffer, const char *str)
2486 pp_string (buffer, "\\b");
2490 pp_string (buffer, "\\f");
2494 pp_string (buffer, "\\n");
2498 pp_string (buffer, "\\r");
2502 pp_string (buffer, "\\t");
2506 pp_string (buffer, "\\v");
2510 pp_string (buffer, "\\\\");
2514 pp_string (buffer, "\\\"");
2518 pp_string (buffer, "\\'");
2521 /* No need to handle \0; the loop terminates on \0. */
2524 pp_string (buffer, "\\1");
2528 pp_string (buffer, "\\2");
2532 pp_string (buffer, "\\3");
2536 pp_string (buffer, "\\4");
2540 pp_string (buffer, "\\5");
2544 pp_string (buffer, "\\6");
2548 pp_string (buffer, "\\7");
2552 pp_character (buffer, str[0]);
2560 maybe_init_pretty_print (FILE *file)
2564 pp_construct (&buffer, /* prefix */NULL, /* line-width */0);
2565 pp_needs_newline (&buffer) = true;
2569 buffer.buffer->stream = file;
2573 newline_and_indent (pretty_printer *buffer, int spc)
2575 pp_newline (buffer);
2580 dump_vops (pretty_printer *buffer, tree stmt, int spc, int flags)
2583 use_operand_p use_p;
2584 def_operand_p def_p;
2585 use_operand_p kill_p;
2588 if (!ssa_operands_active ())
2591 FOR_EACH_SSA_MAYDEF_OPERAND (def_p, use_p, stmt, iter)
2593 pp_string (buffer, "# ");
2594 dump_generic_node (buffer, DEF_FROM_PTR (def_p),
2595 spc + 2, flags, false);
2596 pp_string (buffer, " = V_MAY_DEF <");
2597 dump_generic_node (buffer, USE_FROM_PTR (use_p),
2598 spc + 2, flags, false);
2599 pp_string (buffer, ">;");
2600 newline_and_indent (buffer, spc);
2603 FOR_EACH_SSA_MUSTDEF_OPERAND (def_p, kill_p, stmt, iter)
2605 pp_string (buffer, "# ");
2606 dump_generic_node (buffer, DEF_FROM_PTR (def_p),
2607 spc + 2, flags, false);
2608 pp_string (buffer, " = V_MUST_DEF <");
2609 dump_generic_node (buffer, USE_FROM_PTR (kill_p),
2610 spc + 2, flags, false);
2611 pp_string (buffer, ">;");
2612 newline_and_indent (buffer, spc);
2615 FOR_EACH_SSA_TREE_OPERAND (use, stmt, iter, SSA_OP_VUSE)
2617 pp_string (buffer, "# VUSE <");
2618 dump_generic_node (buffer, use, spc + 2, flags, false);
2619 pp_string (buffer, ">;");
2620 newline_and_indent (buffer, spc);
2624 /* Dumps basic block BB to FILE with details described by FLAGS and
2625 indented by INDENT spaces. */
2628 dump_generic_bb (FILE *file, basic_block bb, int indent, int flags)
2630 maybe_init_pretty_print (file);
2631 dump_generic_bb_buff (&buffer, bb, indent, flags);
2635 /* Dumps header of basic block BB to buffer BUFFER indented by INDENT
2636 spaces and details described by flags. */
2639 dump_bb_header (pretty_printer *buffer, basic_block bb, int indent, int flags)
2645 if (flags & TDF_BLOCKS)
2648 pp_string (buffer, "# BLOCK ");
2649 pp_decimal_int (buffer, bb->index);
2652 pp_string (buffer, " freq:");
2653 pp_decimal_int (buffer, bb->frequency);
2657 pp_string (buffer, " count:");
2658 pp_widest_integer (buffer, bb->count);
2661 if (flags & TDF_LINENO)
2663 block_stmt_iterator bsi;
2665 for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
2666 if (get_lineno (bsi_stmt (bsi)) != -1)
2668 pp_string (buffer, ", starting at line ");
2669 pp_decimal_int (buffer, get_lineno (bsi_stmt (bsi)));
2673 newline_and_indent (buffer, indent);
2675 pp_string (buffer, "# PRED:");
2676 pp_write_text_to_stream (buffer);
2677 FOR_EACH_EDGE (e, ei, bb->preds)
2678 if (flags & TDF_SLIM)
2680 pp_string (buffer, " ");
2681 if (e->src == ENTRY_BLOCK_PTR)
2682 pp_string (buffer, "ENTRY");
2684 pp_decimal_int (buffer, e->src->index);
2687 dump_edge_info (buffer->buffer->stream, e, 0);
2688 pp_newline (buffer);
2692 stmt = first_stmt (bb);
2693 if (!stmt || TREE_CODE (stmt) != LABEL_EXPR)
2695 INDENT (indent - 2);
2696 pp_string (buffer, "<bb ");
2697 pp_decimal_int (buffer, bb->index);
2698 pp_string (buffer, ">:");
2699 pp_newline (buffer);
2702 pp_write_text_to_stream (buffer);
2703 check_bb_profile (bb, buffer->buffer->stream);
2706 /* Dumps end of basic block BB to buffer BUFFER indented by INDENT
2710 dump_bb_end (pretty_printer *buffer, basic_block bb, int indent, int flags)
2716 pp_string (buffer, "# SUCC:");
2717 pp_write_text_to_stream (buffer);
2718 FOR_EACH_EDGE (e, ei, bb->succs)
2719 if (flags & TDF_SLIM)
2721 pp_string (buffer, " ");
2722 if (e->dest == EXIT_BLOCK_PTR)
2723 pp_string (buffer, "EXIT");
2725 pp_decimal_int (buffer, e->dest->index);
2728 dump_edge_info (buffer->buffer->stream, e, 1);
2729 pp_newline (buffer);
2732 /* Dumps phi nodes of basic block BB to buffer BUFFER with details described by
2733 FLAGS indented by INDENT spaces. */
2736 dump_phi_nodes (pretty_printer *buffer, basic_block bb, int indent, int flags)
2738 tree phi = phi_nodes (bb);
2742 for (; phi; phi = PHI_CHAIN (phi))
2744 if (is_gimple_reg (PHI_RESULT (phi)) || (flags & TDF_VOPS))
2747 pp_string (buffer, "# ");
2748 dump_generic_node (buffer, phi, indent, flags, false);
2749 pp_newline (buffer);
2754 /* Dump jump to basic block BB that is represented implicitly in the cfg
2758 pp_cfg_jump (pretty_printer *buffer, basic_block bb)
2762 stmt = first_stmt (bb);
2764 pp_string (buffer, "goto <bb ");
2765 pp_decimal_int (buffer, bb->index);
2766 pp_string (buffer, ">");
2767 if (stmt && TREE_CODE (stmt) == LABEL_EXPR)
2769 pp_string (buffer, " (");
2770 dump_generic_node (buffer, LABEL_EXPR_LABEL (stmt), 0, 0, false);
2771 pp_string (buffer, ")");
2773 pp_semicolon (buffer);
2776 /* Dump edges represented implicitly in basic block BB to BUFFER, indented
2777 by INDENT spaces, with details given by FLAGS. */
2780 dump_implicit_edges (pretty_printer *buffer, basic_block bb, int indent,
2786 /* If there is a fallthru edge, we may need to add an artificial goto to the
2788 FOR_EACH_EDGE (e, ei, bb->succs)
2789 if (e->flags & EDGE_FALLTHRU)
2791 if (e && e->dest != bb->next_bb)
2795 if ((flags & TDF_LINENO)
2796 #ifdef USE_MAPPED_LOCATION
2797 && e->goto_locus != UNKNOWN_LOCATION
2803 expanded_location goto_xloc;
2804 #ifdef USE_MAPPED_LOCATION
2805 goto_xloc = expand_location (e->goto_locus);
2807 goto_xloc = *e->goto_locus;
2809 pp_character (buffer, '[');
2812 pp_string (buffer, goto_xloc.file);
2813 pp_string (buffer, " : ");
2815 pp_decimal_int (buffer, goto_xloc.line);
2816 pp_string (buffer, "] ");
2819 pp_cfg_jump (buffer, e->dest);
2820 pp_newline (buffer);
2824 /* Dumps basic block BB to buffer BUFFER with details described by FLAGS and
2825 indented by INDENT spaces. */
2828 dump_generic_bb_buff (pretty_printer *buffer, basic_block bb,
2829 int indent, int flags)
2831 block_stmt_iterator bsi;
2833 int label_indent = indent - 2;
2835 if (label_indent < 0)
2838 dump_bb_header (buffer, bb, indent, flags);
2840 dump_phi_nodes (buffer, bb, indent, flags);
2842 for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
2846 stmt = bsi_stmt (bsi);
2848 curr_indent = TREE_CODE (stmt) == LABEL_EXPR ? label_indent : indent;
2850 INDENT (curr_indent);
2851 dump_generic_node (buffer, stmt, curr_indent, flags, true);
2852 pp_newline (buffer);
2855 dump_implicit_edges (buffer, bb, indent, flags);
2857 if (flags & TDF_BLOCKS)
2858 dump_bb_end (buffer, bb, indent, flags);