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 sprintf (pp_buffer (buffer)->digit_buffer, HOST_WIDE_INT_PRINT_DOUBLE_HEX,
736 TREE_INT_CST_HIGH (val),
737 TREE_INT_CST_LOW (val));
738 pp_string (buffer, pp_buffer (buffer)->digit_buffer);
742 pp_wide_integer (buffer, TREE_INT_CST_LOW (node));
746 /* Code copied from print_node. */
749 if (TREE_OVERFLOW (node))
750 pp_string (buffer, " overflow");
752 #if !defined(REAL_IS_NOT_DOUBLE) || defined(REAL_ARITHMETIC)
753 d = TREE_REAL_CST (node);
754 if (REAL_VALUE_ISINF (d))
755 pp_string (buffer, " Inf");
756 else if (REAL_VALUE_ISNAN (d))
757 pp_string (buffer, " Nan");
761 real_to_decimal (string, &d, sizeof (string), 0, 1);
762 pp_string (buffer, string);
767 unsigned char *p = (unsigned char *) &TREE_REAL_CST (node);
768 pp_string (buffer, "0x");
769 for (i = 0; i < sizeof TREE_REAL_CST (node); i++)
770 output_formatted_integer (buffer, "%02x", *p++);
777 pp_string (buffer, "__complex__ (");
778 dump_generic_node (buffer, TREE_REALPART (node), spc, flags, false);
779 pp_string (buffer, ", ");
780 dump_generic_node (buffer, TREE_IMAGPART (node), spc, flags, false);
781 pp_string (buffer, ")");
785 pp_string (buffer, "\"");
786 pretty_print_string (buffer, TREE_STRING_POINTER (node));
787 pp_string (buffer, "\"");
793 pp_string (buffer, "{ ");
794 for (elt = TREE_VECTOR_CST_ELTS (node); elt; elt = TREE_CHAIN (elt))
796 dump_generic_node (buffer, TREE_VALUE (elt), spc, flags, false);
797 if (TREE_CHAIN (elt))
798 pp_string (buffer, ", ");
800 pp_string (buffer, " }");
809 dump_decl_name (buffer, node, flags);
813 if (DECL_NAME (node))
814 dump_decl_name (buffer, node, flags);
815 else if (LABEL_DECL_UID (node) != -1)
816 pp_printf (buffer, "<L" HOST_WIDE_INT_PRINT_DEC ">",
817 LABEL_DECL_UID (node));
819 pp_printf (buffer, "<D%u>", DECL_UID (node));
823 if (DECL_IS_BUILTIN (node))
825 /* Don't print the declaration of built-in types. */
828 if (DECL_NAME (node))
829 dump_decl_name (buffer, node, flags);
832 if ((TREE_CODE (TREE_TYPE (node)) == RECORD_TYPE
833 || TREE_CODE (TREE_TYPE (node)) == UNION_TYPE)
834 && TYPE_METHODS (TREE_TYPE (node)))
836 /* The type is a c++ class: all structures have at least
838 pp_string (buffer, "class ");
839 dump_generic_node (buffer, TREE_TYPE (node), spc, flags, false);
844 (TREE_CODE (TREE_TYPE (node)) == UNION_TYPE
845 ? "union" : "struct "));
846 dump_generic_node (buffer, TREE_TYPE (node), spc, flags, false);
851 case SYMBOL_MEMORY_TAG:
852 case NAME_MEMORY_TAG:
853 case STRUCT_FIELD_TAG:
858 dump_decl_name (buffer, node, flags);
862 pp_string (buffer, "<retval>");
866 op0 = TREE_OPERAND (node, 0);
868 if (TREE_CODE (op0) == INDIRECT_REF)
870 op0 = TREE_OPERAND (op0, 0);
873 if (op_prio (op0) < op_prio (node))
874 pp_character (buffer, '(');
875 dump_generic_node (buffer, op0, spc, flags, false);
876 if (op_prio (op0) < op_prio (node))
877 pp_character (buffer, ')');
878 pp_string (buffer, str);
879 dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
881 if (TREE_CODE (op0) != VALUE_HANDLE)
883 op0 = component_ref_field_offset (node);
884 if (op0 && TREE_CODE (op0) != INTEGER_CST)
886 pp_string (buffer, "{off: ");
887 dump_generic_node (buffer, op0, spc, flags, false);
888 pp_character (buffer, '}');
894 pp_string (buffer, "BIT_FIELD_REF <");
895 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
896 pp_string (buffer, ", ");
897 dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
898 pp_string (buffer, ", ");
899 dump_generic_node (buffer, TREE_OPERAND (node, 2), spc, flags, false);
900 pp_string (buffer, ">");
904 case ARRAY_RANGE_REF:
905 op0 = TREE_OPERAND (node, 0);
906 if (op_prio (op0) < op_prio (node))
907 pp_character (buffer, '(');
908 dump_generic_node (buffer, op0, spc, flags, false);
909 if (op_prio (op0) < op_prio (node))
910 pp_character (buffer, ')');
911 pp_character (buffer, '[');
912 dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
913 if (TREE_CODE (node) == ARRAY_RANGE_REF)
914 pp_string (buffer, " ...");
915 pp_character (buffer, ']');
917 op0 = array_ref_low_bound (node);
918 op1 = array_ref_element_size (node);
920 if (!integer_zerop (op0)
921 || (TYPE_SIZE_UNIT (TREE_TYPE (node))
922 && !operand_equal_p (op1, TYPE_SIZE_UNIT (TREE_TYPE (node)), 0)))
924 pp_string (buffer, "{lb: ");
925 dump_generic_node (buffer, op0, spc, flags, false);
926 pp_string (buffer, " sz: ");
927 dump_generic_node (buffer, op1, spc, flags, false);
928 pp_character (buffer, '}');
934 unsigned HOST_WIDE_INT ix;
936 bool is_struct_init = FALSE;
937 pp_character (buffer, '{');
938 if (TREE_CODE (TREE_TYPE (node)) == RECORD_TYPE
939 || TREE_CODE (TREE_TYPE (node)) == UNION_TYPE)
940 is_struct_init = TRUE;
941 FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (node), ix, field, val)
943 if (field && is_struct_init)
945 pp_character (buffer, '.');
946 dump_generic_node (buffer, field, spc, flags, false);
947 pp_string (buffer, "=");
949 if (val && TREE_CODE (val) == ADDR_EXPR)
950 if (TREE_CODE (TREE_OPERAND (val, 0)) == FUNCTION_DECL)
951 val = TREE_OPERAND (val, 0);
952 if (val && TREE_CODE (val) == FUNCTION_DECL)
953 dump_decl_name (buffer, val, flags);
955 dump_generic_node (buffer, val, spc, flags, false);
956 if (ix != VEC_length (constructor_elt, CONSTRUCTOR_ELTS (node)) - 1)
958 pp_character (buffer, ',');
962 pp_character (buffer, '}');
969 if (flags & TDF_SLIM)
971 pp_string (buffer, "<COMPOUND_EXPR>");
975 dump_generic_node (buffer, TREE_OPERAND (node, 0),
976 spc, flags, !(flags & TDF_SLIM));
977 if (flags & TDF_SLIM)
978 newline_and_indent (buffer, spc);
981 pp_character (buffer, ',');
985 for (tp = &TREE_OPERAND (node, 1);
986 TREE_CODE (*tp) == COMPOUND_EXPR;
987 tp = &TREE_OPERAND (*tp, 1))
989 dump_generic_node (buffer, TREE_OPERAND (*tp, 0),
990 spc, flags, !(flags & TDF_SLIM));
991 if (flags & TDF_SLIM)
992 newline_and_indent (buffer, spc);
995 pp_character (buffer, ',');
1000 dump_generic_node (buffer, *tp, spc, flags, !(flags & TDF_SLIM));
1004 case STATEMENT_LIST:
1006 tree_stmt_iterator si;
1009 if (flags & TDF_SLIM)
1011 pp_string (buffer, "<STATEMENT_LIST>");
1015 for (si = tsi_start (node); !tsi_end_p (si); tsi_next (&si))
1018 newline_and_indent (buffer, spc);
1021 dump_generic_node (buffer, tsi_stmt (si), spc, flags, true);
1028 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1030 pp_character (buffer, '=');
1032 dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
1036 pp_string (buffer, "TARGET_EXPR <");
1037 dump_generic_node (buffer, TARGET_EXPR_SLOT (node), spc, flags, false);
1038 pp_character (buffer, ',');
1040 dump_generic_node (buffer, TARGET_EXPR_INITIAL (node), spc, flags, false);
1041 pp_character (buffer, '>');
1045 print_declaration (buffer, DECL_EXPR_DECL (node), spc, flags);
1050 if (TREE_TYPE (node) == NULL || TREE_TYPE (node) == void_type_node)
1052 pp_string (buffer, "if (");
1053 dump_generic_node (buffer, COND_EXPR_COND (node), spc, flags, false);
1054 pp_character (buffer, ')');
1055 /* The lowered cond_exprs should always be printed in full. */
1056 if (COND_EXPR_THEN (node)
1057 && (IS_EMPTY_STMT (COND_EXPR_THEN (node))
1058 || TREE_CODE (COND_EXPR_THEN (node)) == GOTO_EXPR)
1059 && COND_EXPR_ELSE (node)
1060 && (IS_EMPTY_STMT (COND_EXPR_ELSE (node))
1061 || TREE_CODE (COND_EXPR_ELSE (node)) == GOTO_EXPR))
1064 dump_generic_node (buffer, COND_EXPR_THEN (node), 0, flags, true);
1065 pp_string (buffer, " else ");
1066 dump_generic_node (buffer, COND_EXPR_ELSE (node), 0, flags, true);
1068 else if (!(flags & TDF_SLIM))
1070 /* Output COND_EXPR_THEN. */
1071 if (COND_EXPR_THEN (node))
1073 newline_and_indent (buffer, spc+2);
1074 pp_character (buffer, '{');
1075 newline_and_indent (buffer, spc+4);
1076 dump_generic_node (buffer, COND_EXPR_THEN (node), spc+4,
1078 newline_and_indent (buffer, spc+2);
1079 pp_character (buffer, '}');
1082 /* Output COND_EXPR_ELSE. */
1083 if (COND_EXPR_ELSE (node))
1085 newline_and_indent (buffer, spc);
1086 pp_string (buffer, "else");
1087 newline_and_indent (buffer, spc+2);
1088 pp_character (buffer, '{');
1089 newline_and_indent (buffer, spc+4);
1090 dump_generic_node (buffer, COND_EXPR_ELSE (node), spc+4,
1092 newline_and_indent (buffer, spc+2);
1093 pp_character (buffer, '}');
1100 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1102 pp_character (buffer, '?');
1104 dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
1106 pp_character (buffer, ':');
1108 dump_generic_node (buffer, TREE_OPERAND (node, 2), spc, flags, false);
1113 pp_character (buffer, '{');
1114 if (!(flags & TDF_SLIM))
1116 if (BIND_EXPR_VARS (node))
1118 pp_newline (buffer);
1120 for (op0 = BIND_EXPR_VARS (node); op0; op0 = TREE_CHAIN (op0))
1122 print_declaration (buffer, op0, spc+2, flags);
1123 pp_newline (buffer);
1127 newline_and_indent (buffer, spc+2);
1128 dump_generic_node (buffer, BIND_EXPR_BODY (node), spc+2, flags, true);
1129 newline_and_indent (buffer, spc);
1130 pp_character (buffer, '}');
1136 print_call_name (buffer, node);
1138 /* Print parameters. */
1140 pp_character (buffer, '(');
1141 op1 = TREE_OPERAND (node, 1);
1143 dump_generic_node (buffer, op1, spc, flags, false);
1144 pp_character (buffer, ')');
1146 op1 = TREE_OPERAND (node, 2);
1149 pp_string (buffer, " [static-chain: ");
1150 dump_generic_node (buffer, op1, spc, flags, false);
1151 pp_character (buffer, ']');
1154 if (CALL_EXPR_RETURN_SLOT_OPT (node))
1155 pp_string (buffer, " [return slot optimization]");
1156 if (CALL_EXPR_TAILCALL (node))
1157 pp_string (buffer, " [tail call]");
1160 case WITH_CLEANUP_EXPR:
1164 case CLEANUP_POINT_EXPR:
1165 pp_string (buffer, "<<cleanup_point ");
1166 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1167 pp_string (buffer, ">>");
1170 case PLACEHOLDER_EXPR:
1171 pp_string (buffer, "<PLACEHOLDER_EXPR ");
1172 dump_generic_node (buffer, TREE_TYPE (node), spc, flags, false);
1173 pp_character (buffer, '>');
1176 /* Binary arithmetic and logic expressions. */
1177 case WIDEN_SUM_EXPR:
1178 case WIDEN_MULT_EXPR:
1182 case TRUNC_DIV_EXPR:
1184 case FLOOR_DIV_EXPR:
1185 case ROUND_DIV_EXPR:
1186 case TRUNC_MOD_EXPR:
1188 case FLOOR_MOD_EXPR:
1189 case ROUND_MOD_EXPR:
1191 case EXACT_DIV_EXPR:
1196 case VEC_LSHIFT_EXPR:
1197 case VEC_RSHIFT_EXPR:
1201 case TRUTH_ANDIF_EXPR:
1202 case TRUTH_ORIF_EXPR:
1203 case TRUTH_AND_EXPR:
1205 case TRUTH_XOR_EXPR:
1219 case UNORDERED_EXPR:
1221 const char *op = op_symbol (node);
1222 op0 = TREE_OPERAND (node, 0);
1223 op1 = TREE_OPERAND (node, 1);
1225 /* When the operands are expressions with less priority,
1226 keep semantics of the tree representation. */
1227 if (op_prio (op0) < op_prio (node))
1229 pp_character (buffer, '(');
1230 dump_generic_node (buffer, op0, spc, flags, false);
1231 pp_character (buffer, ')');
1234 dump_generic_node (buffer, op0, spc, flags, false);
1237 pp_string (buffer, op);
1240 /* When the operands are expressions with less priority,
1241 keep semantics of the tree representation. */
1242 if (op_prio (op1) < op_prio (node))
1244 pp_character (buffer, '(');
1245 dump_generic_node (buffer, op1, spc, flags, false);
1246 pp_character (buffer, ')');
1249 dump_generic_node (buffer, op1, spc, flags, false);
1253 /* Unary arithmetic and logic expressions. */
1256 case TRUTH_NOT_EXPR:
1258 case PREDECREMENT_EXPR:
1259 case PREINCREMENT_EXPR:
1260 case ALIGN_INDIRECT_REF:
1261 case MISALIGNED_INDIRECT_REF:
1263 if (TREE_CODE (node) == ADDR_EXPR
1264 && (TREE_CODE (TREE_OPERAND (node, 0)) == STRING_CST
1265 || TREE_CODE (TREE_OPERAND (node, 0)) == FUNCTION_DECL))
1266 ; /* Do not output '&' for strings and function pointers. */
1268 pp_string (buffer, op_symbol (node));
1270 if (op_prio (TREE_OPERAND (node, 0)) < op_prio (node))
1272 pp_character (buffer, '(');
1273 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1274 pp_character (buffer, ')');
1277 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1279 if (TREE_CODE (node) == MISALIGNED_INDIRECT_REF)
1281 pp_string (buffer, "{misalignment: ");
1282 dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
1283 pp_character (buffer, '}');
1287 case POSTDECREMENT_EXPR:
1288 case POSTINCREMENT_EXPR:
1289 if (op_prio (TREE_OPERAND (node, 0)) < op_prio (node))
1291 pp_character (buffer, '(');
1292 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1293 pp_character (buffer, ')');
1296 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1297 pp_string (buffer, op_symbol (node));
1301 pp_string (buffer, "MIN_EXPR <");
1302 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1303 pp_string (buffer, ", ");
1304 dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
1305 pp_character (buffer, '>');
1309 pp_string (buffer, "MAX_EXPR <");
1310 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1311 pp_string (buffer, ", ");
1312 dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
1313 pp_character (buffer, '>');
1317 pp_string (buffer, "ABS_EXPR <");
1318 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1319 pp_character (buffer, '>');
1326 case FIX_TRUNC_EXPR:
1330 type = TREE_TYPE (node);
1331 op0 = TREE_OPERAND (node, 0);
1332 if (type != TREE_TYPE (op0))
1334 pp_character (buffer, '(');
1335 dump_generic_node (buffer, type, spc, flags, false);
1336 pp_string (buffer, ") ");
1338 if (op_prio (op0) < op_prio (node))
1339 pp_character (buffer, '(');
1340 dump_generic_node (buffer, op0, spc, flags, false);
1341 if (op_prio (op0) < op_prio (node))
1342 pp_character (buffer, ')');
1345 case VIEW_CONVERT_EXPR:
1346 pp_string (buffer, "VIEW_CONVERT_EXPR<");
1347 dump_generic_node (buffer, TREE_TYPE (node), spc, flags, false);
1348 pp_string (buffer, ">(");
1349 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1350 pp_character (buffer, ')');
1353 case NON_LVALUE_EXPR:
1354 pp_string (buffer, "NON_LVALUE_EXPR <");
1355 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1356 pp_character (buffer, '>');
1360 pp_string (buffer, "SAVE_EXPR <");
1361 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1362 pp_character (buffer, '>');
1366 pp_string (buffer, "COMPLEX_EXPR <");
1367 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1368 pp_string (buffer, ", ");
1369 dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
1370 pp_string (buffer, ">");
1374 pp_string (buffer, "CONJ_EXPR <");
1375 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1376 pp_string (buffer, ">");
1380 pp_string (buffer, "REALPART_EXPR <");
1381 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1382 pp_string (buffer, ">");
1386 pp_string (buffer, "IMAGPART_EXPR <");
1387 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1388 pp_string (buffer, ">");
1392 pp_string (buffer, "VA_ARG_EXPR <");
1393 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1394 pp_string (buffer, ">");
1397 case TRY_FINALLY_EXPR:
1398 case TRY_CATCH_EXPR:
1399 pp_string (buffer, "try");
1400 newline_and_indent (buffer, spc+2);
1401 pp_string (buffer, "{");
1402 newline_and_indent (buffer, spc+4);
1403 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc+4, flags, true);
1404 newline_and_indent (buffer, spc+2);
1405 pp_string (buffer, "}");
1406 newline_and_indent (buffer, spc);
1408 (TREE_CODE (node) == TRY_CATCH_EXPR) ? "catch" : "finally");
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, 1), spc+4, flags, true);
1413 newline_and_indent (buffer, spc+2);
1414 pp_string (buffer, "}");
1419 pp_string (buffer, "catch (");
1420 dump_generic_node (buffer, CATCH_TYPES (node), spc+2, flags, false);
1421 pp_string (buffer, ")");
1422 newline_and_indent (buffer, spc+2);
1423 pp_string (buffer, "{");
1424 newline_and_indent (buffer, spc+4);
1425 dump_generic_node (buffer, CATCH_BODY (node), spc+4, flags, true);
1426 newline_and_indent (buffer, spc+2);
1427 pp_string (buffer, "}");
1431 case EH_FILTER_EXPR:
1432 pp_string (buffer, "<<<eh_filter (");
1433 dump_generic_node (buffer, EH_FILTER_TYPES (node), spc+2, flags, false);
1434 pp_string (buffer, ")>>>");
1435 newline_and_indent (buffer, spc+2);
1436 pp_string (buffer, "{");
1437 newline_and_indent (buffer, spc+4);
1438 dump_generic_node (buffer, EH_FILTER_FAILURE (node), spc+4, flags, true);
1439 newline_and_indent (buffer, spc+2);
1440 pp_string (buffer, "}");
1445 op0 = TREE_OPERAND (node, 0);
1446 /* If this is for break or continue, don't bother printing it. */
1447 if (DECL_NAME (op0))
1449 const char *name = IDENTIFIER_POINTER (DECL_NAME (op0));
1450 if (strcmp (name, "break") == 0
1451 || strcmp (name, "continue") == 0)
1454 dump_generic_node (buffer, op0, spc, flags, false);
1455 pp_character (buffer, ':');
1456 if (DECL_NONLOCAL (op0))
1457 pp_string (buffer, " [non-local]");
1461 pp_string (buffer, "<<<exception object>>>");
1465 pp_string (buffer, "<<<filter object>>>");
1469 pp_string (buffer, "while (1)");
1470 if (!(flags & TDF_SLIM))
1472 newline_and_indent (buffer, spc+2);
1473 pp_character (buffer, '{');
1474 newline_and_indent (buffer, spc+4);
1475 dump_generic_node (buffer, LOOP_EXPR_BODY (node), spc+4, flags, true);
1476 newline_and_indent (buffer, spc+2);
1477 pp_character (buffer, '}');
1483 pp_string (buffer, "return");
1484 op0 = TREE_OPERAND (node, 0);
1488 if (TREE_CODE (op0) == MODIFY_EXPR)
1489 dump_generic_node (buffer, TREE_OPERAND (op0, 1), spc, flags, false);
1491 dump_generic_node (buffer, op0, spc, flags, false);
1496 pp_string (buffer, "if (");
1497 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1498 pp_string (buffer, ") break");
1502 pp_string (buffer, "switch (");
1503 dump_generic_node (buffer, SWITCH_COND (node), spc, flags, false);
1504 pp_character (buffer, ')');
1505 if (!(flags & TDF_SLIM))
1507 newline_and_indent (buffer, spc+2);
1508 pp_character (buffer, '{');
1509 if (SWITCH_BODY (node))
1511 newline_and_indent (buffer, spc+4);
1512 dump_generic_node (buffer, SWITCH_BODY (node), spc+4, flags,
1517 tree vec = SWITCH_LABELS (node);
1518 size_t i, n = TREE_VEC_LENGTH (vec);
1519 for (i = 0; i < n; ++i)
1521 tree elt = TREE_VEC_ELT (vec, i);
1522 newline_and_indent (buffer, spc+4);
1525 dump_generic_node (buffer, elt, spc+4, flags, false);
1526 pp_string (buffer, " goto ");
1527 dump_generic_node (buffer, CASE_LABEL (elt), spc+4,
1529 pp_semicolon (buffer);
1532 pp_string (buffer, "case ???: goto ???;");
1535 newline_and_indent (buffer, spc+2);
1536 pp_character (buffer, '}');
1542 op0 = GOTO_DESTINATION (node);
1543 if (TREE_CODE (op0) != SSA_NAME && DECL_P (op0) && DECL_NAME (op0))
1545 const char *name = IDENTIFIER_POINTER (DECL_NAME (op0));
1546 if (strcmp (name, "break") == 0
1547 || strcmp (name, "continue") == 0)
1549 pp_string (buffer, name);
1553 pp_string (buffer, "goto ");
1554 dump_generic_node (buffer, op0, spc, flags, false);
1558 pp_string (buffer, "resx ");
1559 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1563 pp_string (buffer, "__asm__");
1564 if (ASM_VOLATILE_P (node))
1565 pp_string (buffer, " __volatile__");
1566 pp_character (buffer, '(');
1567 dump_generic_node (buffer, ASM_STRING (node), spc, flags, false);
1568 pp_character (buffer, ':');
1569 dump_generic_node (buffer, ASM_OUTPUTS (node), spc, flags, false);
1570 pp_character (buffer, ':');
1571 dump_generic_node (buffer, ASM_INPUTS (node), spc, flags, false);
1572 if (ASM_CLOBBERS (node))
1574 pp_character (buffer, ':');
1575 dump_generic_node (buffer, ASM_CLOBBERS (node), spc, flags, false);
1577 pp_string (buffer, ")");
1580 case CASE_LABEL_EXPR:
1581 if (CASE_LOW (node) && CASE_HIGH (node))
1583 pp_string (buffer, "case ");
1584 dump_generic_node (buffer, CASE_LOW (node), spc, flags, false);
1585 pp_string (buffer, " ... ");
1586 dump_generic_node (buffer, CASE_HIGH (node), spc, flags, false);
1588 else if (CASE_LOW (node))
1590 pp_string (buffer, "case ");
1591 dump_generic_node (buffer, CASE_LOW (node), spc, flags, false);
1594 pp_string (buffer, "default ");
1595 pp_character (buffer, ':');
1599 pp_string (buffer, "OBJ_TYPE_REF(");
1600 dump_generic_node (buffer, OBJ_TYPE_REF_EXPR (node), spc, flags, false);
1601 pp_character (buffer, ';');
1602 dump_generic_node (buffer, OBJ_TYPE_REF_OBJECT (node), spc, flags, false);
1603 pp_character (buffer, '-');
1604 pp_character (buffer, '>');
1605 dump_generic_node (buffer, OBJ_TYPE_REF_TOKEN (node), spc, flags, false);
1606 pp_character (buffer, ')');
1613 dump_generic_node (buffer, PHI_RESULT (node), spc, flags, false);
1614 pp_string (buffer, " = PHI <");
1615 for (i = 0; i < PHI_NUM_ARGS (node); i++)
1617 dump_generic_node (buffer, PHI_ARG_DEF (node, i), spc, flags, false);
1618 pp_string (buffer, "(");
1619 pp_decimal_int (buffer, PHI_ARG_EDGE (node, i)->src->index);
1620 pp_string (buffer, ")");
1621 if (i < PHI_NUM_ARGS (node) - 1)
1622 pp_string (buffer, ", ");
1624 pp_string (buffer, ">;");
1629 dump_generic_node (buffer, SSA_NAME_VAR (node), spc, flags, false);
1630 pp_string (buffer, "_");
1631 pp_decimal_int (buffer, SSA_NAME_VERSION (node));
1632 if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (node))
1633 pp_string (buffer, "(ab)");
1636 case WITH_SIZE_EXPR:
1637 pp_string (buffer, "WITH_SIZE_EXPR <");
1638 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1639 pp_string (buffer, ", ");
1640 dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
1641 pp_string (buffer, ">");
1645 pp_printf (buffer, "VH.%d", VALUE_HANDLE_ID (node));
1649 pp_string (buffer, "ASSERT_EXPR <");
1650 dump_generic_node (buffer, ASSERT_EXPR_VAR (node), spc, flags, false);
1651 pp_string (buffer, ", ");
1652 dump_generic_node (buffer, ASSERT_EXPR_COND (node), spc, flags, false);
1653 pp_string (buffer, ">");
1657 pp_string (buffer, "scev_known");
1660 case SCEV_NOT_KNOWN:
1661 pp_string (buffer, "scev_not_known");
1664 case POLYNOMIAL_CHREC:
1665 pp_string (buffer, "{");
1666 dump_generic_node (buffer, CHREC_LEFT (node), spc, flags, false);
1667 pp_string (buffer, ", +, ");
1668 dump_generic_node (buffer, CHREC_RIGHT (node), spc, flags, false);
1669 pp_string (buffer, "}_");
1670 dump_generic_node (buffer, CHREC_VAR (node), spc, flags, false);
1674 case REALIGN_LOAD_EXPR:
1675 pp_string (buffer, "REALIGN_LOAD <");
1676 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1677 pp_string (buffer, ", ");
1678 dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
1679 pp_string (buffer, ", ");
1680 dump_generic_node (buffer, TREE_OPERAND (node, 2), spc, flags, false);
1681 pp_string (buffer, ">");
1685 pp_string (buffer, " VEC_COND_EXPR < ");
1686 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1687 pp_string (buffer, " , ");
1688 dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
1689 pp_string (buffer, " , ");
1690 dump_generic_node (buffer, TREE_OPERAND (node, 2), spc, flags, false);
1691 pp_string (buffer, " > ");
1695 pp_string (buffer, " DOT_PROD_EXPR < ");
1696 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1697 pp_string (buffer, ", ");
1698 dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
1699 pp_string (buffer, ", ");
1700 dump_generic_node (buffer, TREE_OPERAND (node, 2), spc, flags, false);
1701 pp_string (buffer, " > ");
1705 pp_string (buffer, "#pragma omp parallel");
1706 dump_omp_clauses (buffer, OMP_PARALLEL_CLAUSES (node), spc, flags);
1707 if (OMP_PARALLEL_FN (node))
1709 pp_string (buffer, " [child fn: ");
1710 dump_generic_node (buffer, OMP_PARALLEL_FN (node), spc, flags, false);
1712 pp_string (buffer, " (");
1714 if (OMP_PARALLEL_DATA_ARG (node))
1715 dump_generic_node (buffer, OMP_PARALLEL_DATA_ARG (node), spc, flags,
1718 pp_string (buffer, "???");
1720 pp_string (buffer, ")]");
1724 if (!(flags & TDF_SLIM) && OMP_BODY (node))
1726 newline_and_indent (buffer, spc + 2);
1727 pp_character (buffer, '{');
1728 newline_and_indent (buffer, spc + 4);
1729 dump_generic_node (buffer, OMP_BODY (node), spc + 4, flags, false);
1730 newline_and_indent (buffer, spc + 2);
1731 pp_character (buffer, '}');
1737 pp_string (buffer, "#pragma omp for");
1738 dump_omp_clauses (buffer, OMP_FOR_CLAUSES (node), spc, flags);
1740 if (!(flags & TDF_SLIM))
1742 if (OMP_FOR_PRE_BODY (node))
1744 newline_and_indent (buffer, spc + 2);
1745 pp_character (buffer, '{');
1747 newline_and_indent (buffer, spc);
1748 dump_generic_node (buffer, OMP_FOR_PRE_BODY (node),
1751 newline_and_indent (buffer, spc);
1752 pp_string (buffer, "for (");
1753 dump_generic_node (buffer, OMP_FOR_INIT (node), spc, flags, false);
1754 pp_string (buffer, "; ");
1755 dump_generic_node (buffer, OMP_FOR_COND (node), spc, flags, false);
1756 pp_string (buffer, "; ");
1757 dump_generic_node (buffer, OMP_FOR_INCR (node), spc, flags, false);
1758 pp_string (buffer, ")");
1759 if (OMP_FOR_BODY (node))
1761 newline_and_indent (buffer, spc + 2);
1762 pp_character (buffer, '{');
1763 newline_and_indent (buffer, spc + 4);
1764 dump_generic_node (buffer, OMP_FOR_BODY (node), spc + 4, flags,
1766 newline_and_indent (buffer, spc + 2);
1767 pp_character (buffer, '}');
1769 if (OMP_FOR_PRE_BODY (node))
1772 newline_and_indent (buffer, spc + 2);
1773 pp_character (buffer, '}');
1780 pp_string (buffer, "#pragma omp sections");
1781 dump_omp_clauses (buffer, OMP_SECTIONS_CLAUSES (node), spc, flags);
1785 pp_string (buffer, "#pragma omp section");
1789 pp_string (buffer, "#pragma omp master");
1793 pp_string (buffer, "#pragma omp ordered");
1797 pp_string (buffer, "#pragma omp critical");
1798 if (OMP_CRITICAL_NAME (node))
1801 pp_character (buffer, '(');
1802 dump_generic_node (buffer, OMP_CRITICAL_NAME (node), spc,
1804 pp_character (buffer, ')');
1809 pp_string (buffer, "#pragma omp atomic");
1810 newline_and_indent (buffer, spc + 2);
1811 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1813 pp_character (buffer, '=');
1815 dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
1819 pp_string (buffer, "#pragma omp single");
1820 dump_omp_clauses (buffer, OMP_SINGLE_CLAUSES (node), spc, flags);
1824 pp_string (buffer, "OMP_RETURN");
1825 if (OMP_RETURN_NOWAIT (node))
1826 pp_string (buffer, " [nowait]");
1831 pp_string (buffer, "OMP_CONTINUE");
1836 dump_omp_clause (buffer, node, spc, flags);
1840 case REDUC_MAX_EXPR:
1841 pp_string (buffer, " REDUC_MAX_EXPR < ");
1842 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1843 pp_string (buffer, " > ");
1846 case REDUC_MIN_EXPR:
1847 pp_string (buffer, " REDUC_MIN_EXPR < ");
1848 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1849 pp_string (buffer, " > ");
1852 case REDUC_PLUS_EXPR:
1853 pp_string (buffer, " REDUC_PLUS_EXPR < ");
1854 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1855 pp_string (buffer, " > ");
1858 case VEC_WIDEN_MULT_HI_EXPR:
1859 pp_string (buffer, " VEC_WIDEN_MULT_HI_EXPR < ");
1860 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1861 pp_string (buffer, ", ");
1862 dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
1863 pp_string (buffer, " > ");
1866 case VEC_WIDEN_MULT_LO_EXPR:
1867 pp_string (buffer, " VEC_WIDEN_MULT_LO_EXPR < ");
1868 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1869 pp_string (buffer, ", ");
1870 dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
1871 pp_string (buffer, " > ");
1874 case VEC_UNPACK_HI_EXPR:
1875 pp_string (buffer, " VEC_UNPACK_HI_EXPR < ");
1876 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1877 pp_string (buffer, " > ");
1880 case VEC_UNPACK_LO_EXPR:
1881 pp_string (buffer, " VEC_UNPACK_LO_EXPR < ");
1882 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1883 pp_string (buffer, " > ");
1886 case VEC_PACK_MOD_EXPR:
1887 pp_string (buffer, " VEC_PACK_MOD_EXPR < ");
1888 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1889 pp_string (buffer, ", ");
1890 dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
1891 pp_string (buffer, " > ");
1894 case VEC_PACK_SAT_EXPR:
1895 pp_string (buffer, " VEC_PACK_SAT_EXPR < ");
1896 dump_generic_node (buffer, TREE_OPERAND (node, 0), spc, flags, false);
1897 pp_string (buffer, ", ");
1898 dump_generic_node (buffer, TREE_OPERAND (node, 1), spc, flags, false);
1899 pp_string (buffer, " > ");
1905 pp_string (buffer, "BLOCK");
1907 if (BLOCK_ABSTRACT (node))
1908 pp_string (buffer, " [abstract]");
1910 if (TREE_ASM_WRITTEN (node))
1911 pp_string (buffer, " [written]");
1913 newline_and_indent (buffer, spc + 2);
1915 if (BLOCK_SUPERCONTEXT (node))
1917 pp_string (buffer, "SUPERCONTEXT: ");
1918 if (TREE_CODE (BLOCK_SUPERCONTEXT (node)) == BLOCK)
1919 pp_printf (buffer, "BLOCK %p",
1920 (void *)BLOCK_SUPERCONTEXT (node));
1922 dump_generic_node (buffer, BLOCK_SUPERCONTEXT (node), 0, flags,
1924 newline_and_indent (buffer, spc + 2);
1927 if (BLOCK_SUBBLOCKS (node))
1929 pp_string (buffer, "SUBBLOCKS: ");
1930 for (t = BLOCK_SUBBLOCKS (node); t; t = BLOCK_CHAIN (t))
1931 pp_printf (buffer, "%p ", (void *)t);
1932 newline_and_indent (buffer, spc + 2);
1935 if (BLOCK_VARS (node))
1937 pp_string (buffer, "VARS: ");
1938 for (t = BLOCK_VARS (node); t; t = TREE_CHAIN (t))
1940 dump_generic_node (buffer, t, 0, flags, false);
1941 pp_string (buffer, " ");
1943 newline_and_indent (buffer, spc + 2);
1946 if (BLOCK_ABSTRACT_ORIGIN (node))
1948 pp_string (buffer, "ABSTRACT_ORIGIN: ");
1949 if (TREE_CODE (BLOCK_ABSTRACT_ORIGIN (node)) == BLOCK)
1950 pp_printf (buffer, "BLOCK %p",
1951 (void *)BLOCK_ABSTRACT_ORIGIN (node));
1953 dump_generic_node (buffer, BLOCK_ABSTRACT_ORIGIN (node), 0, flags,
1955 newline_and_indent (buffer, spc + 2);
1964 if (is_stmt && is_expr)
1965 pp_semicolon (buffer);
1966 pp_write_text_to_stream (buffer);
1971 /* Print the declaration of a variable. */
1974 print_declaration (pretty_printer *buffer, tree t, int spc, int flags)
1978 if (TREE_CODE (t) == TYPE_DECL)
1979 pp_string (buffer, "typedef ");
1981 if (CODE_CONTAINS_STRUCT (TREE_CODE (t), TS_DECL_WRTL) && DECL_REGISTER (t))
1982 pp_string (buffer, "register ");
1984 if (TREE_PUBLIC (t) && DECL_EXTERNAL (t))
1985 pp_string (buffer, "extern ");
1986 else if (TREE_STATIC (t))
1987 pp_string (buffer, "static ");
1989 /* Print the type and name. */
1990 if (TREE_CODE (TREE_TYPE (t)) == ARRAY_TYPE)
1994 /* Print array's type. */
1995 tmp = TREE_TYPE (t);
1996 while (TREE_CODE (TREE_TYPE (tmp)) == ARRAY_TYPE)
1997 tmp = TREE_TYPE (tmp);
1998 dump_generic_node (buffer, TREE_TYPE (tmp), spc, flags, false);
2000 /* Print variable's name. */
2002 dump_generic_node (buffer, t, spc, flags, false);
2004 /* Print the dimensions. */
2005 tmp = TREE_TYPE (t);
2006 while (TREE_CODE (tmp) == ARRAY_TYPE)
2008 dump_array_domain (buffer, TYPE_DOMAIN (tmp), spc, flags);
2009 tmp = TREE_TYPE (tmp);
2012 else if (TREE_CODE (t) == FUNCTION_DECL)
2014 dump_generic_node (buffer, TREE_TYPE (TREE_TYPE (t)), spc, flags, false);
2016 dump_decl_name (buffer, t, flags);
2017 dump_function_declaration (buffer, TREE_TYPE (t), spc, flags);
2021 /* Print type declaration. */
2022 dump_generic_node (buffer, TREE_TYPE (t), spc, flags, false);
2024 /* Print variable's name. */
2026 dump_generic_node (buffer, t, spc, flags, false);
2029 if (TREE_CODE (t) == VAR_DECL && DECL_HARD_REGISTER (t))
2031 pp_string (buffer, " __asm__ ");
2032 pp_character (buffer, '(');
2033 dump_generic_node (buffer, DECL_ASSEMBLER_NAME (t), spc, flags, false);
2034 pp_character (buffer, ')');
2037 /* The initial value of a function serves to determine wether the function
2038 is declared or defined. So the following does not apply to function
2040 if (TREE_CODE (t) != FUNCTION_DECL)
2042 /* Print the initial value. */
2043 if (DECL_INITIAL (t))
2046 pp_character (buffer, '=');
2048 dump_generic_node (buffer, DECL_INITIAL (t), spc, flags, false);
2052 if (TREE_CODE (t) == VAR_DECL && DECL_HAS_VALUE_EXPR_P (t))
2054 pp_string (buffer, " [value-expr: ");
2055 dump_generic_node (buffer, DECL_VALUE_EXPR (t), spc, flags, false);
2056 pp_character (buffer, ']');
2059 pp_character (buffer, ';');
2063 /* Prints a structure: name, fields, and methods.
2064 FIXME: Still incomplete. */
2067 print_struct_decl (pretty_printer *buffer, tree node, int spc, int flags)
2069 /* Print the name of the structure. */
2070 if (TYPE_NAME (node))
2073 if (TREE_CODE (node) == RECORD_TYPE)
2074 pp_string (buffer, "struct ");
2075 else if ((TREE_CODE (node) == UNION_TYPE
2076 || TREE_CODE (node) == QUAL_UNION_TYPE))
2077 pp_string (buffer, "union ");
2079 dump_generic_node (buffer, TYPE_NAME (node), spc, 0, false);
2082 /* Print the contents of the structure. */
2083 pp_newline (buffer);
2085 pp_character (buffer, '{');
2086 pp_newline (buffer);
2088 /* Print the fields of the structure. */
2091 tmp = TYPE_FIELDS (node);
2094 /* Avoid to print recursively the structure. */
2095 /* FIXME : Not implemented correctly...,
2096 what about the case when we have a cycle in the contain graph? ...
2097 Maybe this could be solved by looking at the scope in which the
2098 structure was declared. */
2099 if (TREE_TYPE (tmp) != node
2100 || (TREE_CODE (TREE_TYPE (tmp)) == POINTER_TYPE
2101 && TREE_TYPE (TREE_TYPE (tmp)) != node))
2103 print_declaration (buffer, tmp, spc+2, flags);
2104 pp_newline (buffer);
2106 tmp = TREE_CHAIN (tmp);
2110 pp_character (buffer, '}');
2113 /* Return the priority of the operator OP.
2115 From lowest to highest precedence with either left-to-right (L-R)
2116 or right-to-left (R-L) associativity]:
2119 2 [R-L] = += -= *= /= %= &= ^= |= <<= >>=
2131 14 [R-L] ! ~ ++ -- + - * & (type) sizeof
2132 15 [L-R] fn() [] -> .
2134 unary +, - and * have higher precedence than the corresponding binary
2143 switch (TREE_CODE (op))
2158 case TRUTH_ORIF_EXPR:
2161 case TRUTH_AND_EXPR:
2162 case TRUTH_ANDIF_EXPR:
2169 case TRUTH_XOR_EXPR:
2186 case UNORDERED_EXPR:
2199 case WIDEN_SUM_EXPR:
2204 case VEC_WIDEN_MULT_HI_EXPR:
2205 case VEC_WIDEN_MULT_LO_EXPR:
2206 case WIDEN_MULT_EXPR:
2209 case TRUNC_DIV_EXPR:
2211 case FLOOR_DIV_EXPR:
2212 case ROUND_DIV_EXPR:
2214 case EXACT_DIV_EXPR:
2215 case TRUNC_MOD_EXPR:
2217 case FLOOR_MOD_EXPR:
2218 case ROUND_MOD_EXPR:
2221 case TRUTH_NOT_EXPR:
2223 case POSTINCREMENT_EXPR:
2224 case POSTDECREMENT_EXPR:
2225 case PREINCREMENT_EXPR:
2226 case PREDECREMENT_EXPR:
2228 case ALIGN_INDIRECT_REF:
2229 case MISALIGNED_INDIRECT_REF:
2235 case FIX_TRUNC_EXPR:
2241 case ARRAY_RANGE_REF:
2245 /* Special expressions. */
2251 case REDUC_MAX_EXPR:
2252 case REDUC_MIN_EXPR:
2253 case REDUC_PLUS_EXPR:
2254 case VEC_LSHIFT_EXPR:
2255 case VEC_RSHIFT_EXPR:
2256 case VEC_UNPACK_HI_EXPR:
2257 case VEC_UNPACK_LO_EXPR:
2258 case VEC_PACK_MOD_EXPR:
2259 case VEC_PACK_SAT_EXPR:
2263 case NON_LVALUE_EXPR:
2264 return op_prio (TREE_OPERAND (op, 0));
2267 /* Return an arbitrarily high precedence to avoid surrounding single
2268 VAR_DECLs in ()s. */
2274 /* Return the symbol associated with operator OP. */
2277 op_symbol_1 (enum tree_code code)
2285 case TRUTH_ORIF_EXPR:
2288 case TRUTH_AND_EXPR:
2289 case TRUTH_ANDIF_EXPR:
2295 case TRUTH_XOR_EXPR:
2305 case UNORDERED_EXPR:
2351 case VEC_LSHIFT_EXPR:
2354 case VEC_RSHIFT_EXPR:
2360 case REDUC_PLUS_EXPR:
2363 case WIDEN_SUM_EXPR:
2366 case WIDEN_MULT_EXPR:
2376 case TRUTH_NOT_EXPR:
2383 case ALIGN_INDIRECT_REF:
2386 case MISALIGNED_INDIRECT_REF:
2389 case TRUNC_DIV_EXPR:
2396 case FLOOR_DIV_EXPR:
2399 case ROUND_DIV_EXPR:
2402 case EXACT_DIV_EXPR:
2405 case TRUNC_MOD_EXPR:
2411 case FLOOR_MOD_EXPR:
2414 case ROUND_MOD_EXPR:
2417 case PREDECREMENT_EXPR:
2420 case PREINCREMENT_EXPR:
2423 case POSTDECREMENT_EXPR:
2426 case POSTINCREMENT_EXPR:
2436 return "<<< ??? >>>";
2443 return op_symbol_1 (TREE_CODE (op));
2446 /* Prints the name of a CALL_EXPR. */
2449 print_call_name (pretty_printer *buffer, tree node)
2453 gcc_assert (TREE_CODE (node) == CALL_EXPR);
2455 op0 = TREE_OPERAND (node, 0);
2457 if (TREE_CODE (op0) == NON_LVALUE_EXPR)
2458 op0 = TREE_OPERAND (op0, 0);
2460 switch (TREE_CODE (op0))
2464 dump_function_name (buffer, op0);
2470 dump_generic_node (buffer, TREE_OPERAND (op0, 0), 0, 0, false);
2474 pp_string (buffer, "(");
2475 dump_generic_node (buffer, TREE_OPERAND (op0, 0), 0, 0, false);
2476 pp_string (buffer, ") ? ");
2477 dump_generic_node (buffer, TREE_OPERAND (op0, 1), 0, 0, false);
2478 pp_string (buffer, " : ");
2479 dump_generic_node (buffer, TREE_OPERAND (op0, 2), 0, 0, false);
2483 /* The function is a pointer contained in a structure. */
2484 if (TREE_CODE (TREE_OPERAND (op0, 0)) == INDIRECT_REF ||
2485 TREE_CODE (TREE_OPERAND (op0, 0)) == VAR_DECL)
2486 dump_function_name (buffer, TREE_OPERAND (op0, 1));
2488 dump_generic_node (buffer, TREE_OPERAND (op0, 0), 0, 0, false);
2490 We can have several levels of structures and a function
2491 pointer inside. This is not implemented yet... */
2496 if (TREE_CODE (TREE_OPERAND (op0, 0)) == VAR_DECL)
2497 dump_function_name (buffer, TREE_OPERAND (op0, 0));
2499 dump_generic_node (buffer, op0, 0, 0, false);
2504 dump_generic_node (buffer, op0, 0, 0, false);
2512 /* Parses the string STR and replaces new-lines by '\n', tabs by '\t', ... */
2515 pretty_print_string (pretty_printer *buffer, const char *str)
2525 pp_string (buffer, "\\b");
2529 pp_string (buffer, "\\f");
2533 pp_string (buffer, "\\n");
2537 pp_string (buffer, "\\r");
2541 pp_string (buffer, "\\t");
2545 pp_string (buffer, "\\v");
2549 pp_string (buffer, "\\\\");
2553 pp_string (buffer, "\\\"");
2557 pp_string (buffer, "\\'");
2560 /* No need to handle \0; the loop terminates on \0. */
2563 pp_string (buffer, "\\1");
2567 pp_string (buffer, "\\2");
2571 pp_string (buffer, "\\3");
2575 pp_string (buffer, "\\4");
2579 pp_string (buffer, "\\5");
2583 pp_string (buffer, "\\6");
2587 pp_string (buffer, "\\7");
2591 pp_character (buffer, str[0]);
2599 maybe_init_pretty_print (FILE *file)
2603 pp_construct (&buffer, /* prefix */NULL, /* line-width */0);
2604 pp_needs_newline (&buffer) = true;
2608 buffer.buffer->stream = file;
2612 newline_and_indent (pretty_printer *buffer, int spc)
2614 pp_newline (buffer);
2619 dump_vops (pretty_printer *buffer, tree stmt, int spc, int flags)
2622 use_operand_p use_p;
2623 def_operand_p def_p;
2624 use_operand_p kill_p;
2627 if (!ssa_operands_active ())
2630 FOR_EACH_SSA_MAYDEF_OPERAND (def_p, use_p, stmt, iter)
2632 pp_string (buffer, "# ");
2633 dump_generic_node (buffer, DEF_FROM_PTR (def_p),
2634 spc + 2, flags, false);
2635 pp_string (buffer, " = V_MAY_DEF <");
2636 dump_generic_node (buffer, USE_FROM_PTR (use_p),
2637 spc + 2, flags, false);
2638 pp_string (buffer, ">;");
2639 newline_and_indent (buffer, spc);
2642 FOR_EACH_SSA_MUSTDEF_OPERAND (def_p, kill_p, stmt, iter)
2644 pp_string (buffer, "# ");
2645 dump_generic_node (buffer, DEF_FROM_PTR (def_p),
2646 spc + 2, flags, false);
2647 pp_string (buffer, " = V_MUST_DEF <");
2648 dump_generic_node (buffer, USE_FROM_PTR (kill_p),
2649 spc + 2, flags, false);
2650 pp_string (buffer, ">;");
2651 newline_and_indent (buffer, spc);
2654 FOR_EACH_SSA_TREE_OPERAND (use, stmt, iter, SSA_OP_VUSE)
2656 pp_string (buffer, "# VUSE <");
2657 dump_generic_node (buffer, use, spc + 2, flags, false);
2658 pp_string (buffer, ">;");
2659 newline_and_indent (buffer, spc);
2663 /* Dumps basic block BB to FILE with details described by FLAGS and
2664 indented by INDENT spaces. */
2667 dump_generic_bb (FILE *file, basic_block bb, int indent, int flags)
2669 maybe_init_pretty_print (file);
2670 dump_generic_bb_buff (&buffer, bb, indent, flags);
2674 /* Dumps header of basic block BB to buffer BUFFER indented by INDENT
2675 spaces and details described by flags. */
2678 dump_bb_header (pretty_printer *buffer, basic_block bb, int indent, int flags)
2684 if (flags & TDF_BLOCKS)
2687 pp_string (buffer, "# BLOCK ");
2688 pp_decimal_int (buffer, bb->index);
2691 pp_string (buffer, " freq:");
2692 pp_decimal_int (buffer, bb->frequency);
2696 pp_string (buffer, " count:");
2697 pp_widest_integer (buffer, bb->count);
2700 if (flags & TDF_LINENO)
2702 block_stmt_iterator bsi;
2704 for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
2705 if (get_lineno (bsi_stmt (bsi)) != -1)
2707 pp_string (buffer, ", starting at line ");
2708 pp_decimal_int (buffer, get_lineno (bsi_stmt (bsi)));
2712 newline_and_indent (buffer, indent);
2714 pp_string (buffer, "# PRED:");
2715 pp_write_text_to_stream (buffer);
2716 FOR_EACH_EDGE (e, ei, bb->preds)
2717 if (flags & TDF_SLIM)
2719 pp_string (buffer, " ");
2720 if (e->src == ENTRY_BLOCK_PTR)
2721 pp_string (buffer, "ENTRY");
2723 pp_decimal_int (buffer, e->src->index);
2726 dump_edge_info (buffer->buffer->stream, e, 0);
2727 pp_newline (buffer);
2731 stmt = first_stmt (bb);
2732 if (!stmt || TREE_CODE (stmt) != LABEL_EXPR)
2734 INDENT (indent - 2);
2735 pp_string (buffer, "<bb ");
2736 pp_decimal_int (buffer, bb->index);
2737 pp_string (buffer, ">:");
2738 pp_newline (buffer);
2741 pp_write_text_to_stream (buffer);
2742 check_bb_profile (bb, buffer->buffer->stream);
2745 /* Dumps end of basic block BB to buffer BUFFER indented by INDENT
2749 dump_bb_end (pretty_printer *buffer, basic_block bb, int indent, int flags)
2755 pp_string (buffer, "# SUCC:");
2756 pp_write_text_to_stream (buffer);
2757 FOR_EACH_EDGE (e, ei, bb->succs)
2758 if (flags & TDF_SLIM)
2760 pp_string (buffer, " ");
2761 if (e->dest == EXIT_BLOCK_PTR)
2762 pp_string (buffer, "EXIT");
2764 pp_decimal_int (buffer, e->dest->index);
2767 dump_edge_info (buffer->buffer->stream, e, 1);
2768 pp_newline (buffer);
2771 /* Dumps phi nodes of basic block BB to buffer BUFFER with details described by
2772 FLAGS indented by INDENT spaces. */
2775 dump_phi_nodes (pretty_printer *buffer, basic_block bb, int indent, int flags)
2777 tree phi = phi_nodes (bb);
2781 for (; phi; phi = PHI_CHAIN (phi))
2783 if (is_gimple_reg (PHI_RESULT (phi)) || (flags & TDF_VOPS))
2786 pp_string (buffer, "# ");
2787 dump_generic_node (buffer, phi, indent, flags, false);
2788 pp_newline (buffer);
2793 /* Dump jump to basic block BB that is represented implicitly in the cfg
2797 pp_cfg_jump (pretty_printer *buffer, basic_block bb)
2801 stmt = first_stmt (bb);
2803 pp_string (buffer, "goto <bb ");
2804 pp_decimal_int (buffer, bb->index);
2805 pp_string (buffer, ">");
2806 if (stmt && TREE_CODE (stmt) == LABEL_EXPR)
2808 pp_string (buffer, " (");
2809 dump_generic_node (buffer, LABEL_EXPR_LABEL (stmt), 0, 0, false);
2810 pp_string (buffer, ")");
2812 pp_semicolon (buffer);
2815 /* Dump edges represented implicitly in basic block BB to BUFFER, indented
2816 by INDENT spaces, with details given by FLAGS. */
2819 dump_implicit_edges (pretty_printer *buffer, basic_block bb, int indent,
2825 /* If there is a fallthru edge, we may need to add an artificial goto to the
2827 FOR_EACH_EDGE (e, ei, bb->succs)
2828 if (e->flags & EDGE_FALLTHRU)
2830 if (e && e->dest != bb->next_bb)
2834 if ((flags & TDF_LINENO)
2835 #ifdef USE_MAPPED_LOCATION
2836 && e->goto_locus != UNKNOWN_LOCATION
2842 expanded_location goto_xloc;
2843 #ifdef USE_MAPPED_LOCATION
2844 goto_xloc = expand_location (e->goto_locus);
2846 goto_xloc = *e->goto_locus;
2848 pp_character (buffer, '[');
2851 pp_string (buffer, goto_xloc.file);
2852 pp_string (buffer, " : ");
2854 pp_decimal_int (buffer, goto_xloc.line);
2855 pp_string (buffer, "] ");
2858 pp_cfg_jump (buffer, e->dest);
2859 pp_newline (buffer);
2863 /* Dumps basic block BB to buffer BUFFER with details described by FLAGS and
2864 indented by INDENT spaces. */
2867 dump_generic_bb_buff (pretty_printer *buffer, basic_block bb,
2868 int indent, int flags)
2870 block_stmt_iterator bsi;
2872 int label_indent = indent - 2;
2874 if (label_indent < 0)
2877 dump_bb_header (buffer, bb, indent, flags);
2879 dump_phi_nodes (buffer, bb, indent, flags);
2881 for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
2885 stmt = bsi_stmt (bsi);
2887 curr_indent = TREE_CODE (stmt) == LABEL_EXPR ? label_indent : indent;
2889 INDENT (curr_indent);
2890 dump_generic_node (buffer, stmt, curr_indent, flags, true);
2891 pp_newline (buffer);
2894 dump_implicit_edges (buffer, bb, indent, flags);
2896 if (flags & TDF_BLOCKS)
2897 dump_bb_end (buffer, bb, indent, flags);