/* Pretty formatting of GIMPLE statements and expressions.
- Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
- Free Software Foundation, Inc.
+ Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
+ 2011 Free Software Foundation, Inc.
Contributed by Aldy Hernandez <aldyh@redhat.com> and
Diego Novillo <dnovillo@google.com>
#include "tm.h"
#include "tree.h"
#include "diagnostic.h"
-#include "real.h"
+#include "tree-pretty-print.h"
+#include "gimple-pretty-print.h"
#include "hashtab.h"
#include "tree-flow.h"
#include "tree-pass.h"
#include "gimple.h"
#include "value-prof.h"
+#include "trans-mem.h"
#define INDENT(SPACE) \
do { int i; for (i = 0; i < SPACE; i++) pp_space (buffer); } while (0)
/* Print the GIMPLE statement GS on stderr. */
-void
+DEBUG_FUNCTION void
debug_gimple_stmt (gimple gs)
{
print_gimple_stmt (stderr, gs, 0, TDF_VOPS|TDF_MEMSYMS);
/* Print the GIMPLE sequence SEQ on stderr. */
-void
+DEBUG_FUNCTION void
debug_gimple_seq (gimple_seq seq)
{
print_gimple_seq (stderr, seq, 0, TDF_VOPS|TDF_MEMSYMS);
'd' - outputs an int as a decimal,
's' - outputs a string,
'n' - outputs a newline,
+ 'x' - outputs an int as hexadecimal,
'+' - increases indent by 2 then outputs a newline,
'-' - decreases indent by 2 then outputs a newline. */
newline_and_indent (buffer, spc);
break;
+ case 'x':
+ pp_scalar (buffer, "%x", va_arg (args, int));
+ break;
+
case '+':
spc += 2;
newline_and_indent (buffer, spc);
default:
gcc_unreachable ();
}
- }
+ }
else
pp_character (buffer, *c);
}
break;
case FIXED_CONVERT_EXPR:
+ case ADDR_SPACE_CONVERT_EXPR:
case FIX_TRUNC_EXPR:
case FLOAT_EXPR:
CASE_CONVERT:
else
dump_generic_node (buffer, rhs, spc, flags, false);
break;
-
+
case PAREN_EXPR:
pp_string (buffer, "((");
dump_generic_node (buffer, rhs, spc, flags, false);
pp_string (buffer, "))");
break;
-
+
case ABS_EXPR:
pp_string (buffer, "ABS_EXPR <");
dump_generic_node (buffer, rhs, spc, flags, false);
case VEC_PACK_TRUNC_EXPR:
case VEC_PACK_SAT_EXPR:
case VEC_PACK_FIX_TRUNC_EXPR:
- case VEC_EXTRACT_EVEN_EXPR:
- case VEC_EXTRACT_ODD_EXPR:
- case VEC_INTERLEAVE_HIGH_EXPR:
- case VEC_INTERLEAVE_LOW_EXPR:
+ case VEC_WIDEN_LSHIFT_HI_EXPR:
+ case VEC_WIDEN_LSHIFT_LO_EXPR:
for (p = tree_code_name [(int) code]; *p; p++)
pp_character (buffer, TOUPPER (*p));
pp_string (buffer, " <");
}
}
+/* Helper for dump_gimple_assign. Print the ternary RHS of the
+ assignment GS. BUFFER, SPC and FLAGS are as in dump_gimple_stmt. */
+
+static void
+dump_ternary_rhs (pretty_printer *buffer, gimple gs, int spc, int flags)
+{
+ const char *p;
+ enum tree_code code = gimple_assign_rhs_code (gs);
+ switch (code)
+ {
+ case WIDEN_MULT_PLUS_EXPR:
+ case WIDEN_MULT_MINUS_EXPR:
+ for (p = tree_code_name [(int) code]; *p; p++)
+ pp_character (buffer, TOUPPER (*p));
+ pp_string (buffer, " <");
+ dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags, false);
+ pp_string (buffer, ", ");
+ dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags, false);
+ pp_string (buffer, ", ");
+ dump_generic_node (buffer, gimple_assign_rhs3 (gs), spc, flags, false);
+ pp_character (buffer, '>');
+ break;
+
+ case FMA_EXPR:
+ dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags, false);
+ pp_string (buffer, " * ");
+ dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags, false);
+ pp_string (buffer, " + ");
+ dump_generic_node (buffer, gimple_assign_rhs3 (gs), spc, flags, false);
+ break;
+
+ case DOT_PROD_EXPR:
+ pp_string (buffer, "DOT_PROD_EXPR <");
+ dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags, false);
+ pp_string (buffer, ", ");
+ dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags, false);
+ pp_string (buffer, ", ");
+ dump_generic_node (buffer, gimple_assign_rhs3 (gs), spc, flags, false);
+ pp_string (buffer, ">");
+ break;
+
+ case VEC_PERM_EXPR:
+ pp_string (buffer, "VEC_PERM_EXPR <");
+ dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags, false);
+ pp_string (buffer, ", ");
+ dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags, false);
+ pp_string (buffer, ", ");
+ dump_generic_node (buffer, gimple_assign_rhs3 (gs), spc, flags, false);
+ pp_string (buffer, ">");
+ break;
+
+ case REALIGN_LOAD_EXPR:
+ pp_string (buffer, "REALIGN_LOAD <");
+ dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags, false);
+ pp_string (buffer, ", ");
+ dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags, false);
+ pp_string (buffer, ", ");
+ dump_generic_node (buffer, gimple_assign_rhs3 (gs), spc, flags, false);
+ pp_string (buffer, ">");
+ break;
+
+ case COND_EXPR:
+ dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags, false);
+ pp_string (buffer, " ? ");
+ dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags, false);
+ pp_string (buffer, " : ");
+ dump_generic_node (buffer, gimple_assign_rhs3 (gs), spc, flags, false);
+ break;
+
+ case VEC_COND_EXPR:
+ pp_string (buffer, "VEC_COND_EXPR <");
+ dump_generic_node (buffer, gimple_assign_rhs1 (gs), spc, flags, false);
+ pp_string (buffer, ", ");
+ dump_generic_node (buffer, gimple_assign_rhs2 (gs), spc, flags, false);
+ pp_string (buffer, ", ");
+ dump_generic_node (buffer, gimple_assign_rhs3 (gs), spc, flags, false);
+ pp_string (buffer, ">");
+ break;
+
+ default:
+ gcc_unreachable ();
+ }
+}
+
/* Dump the gimple assignment GS. BUFFER, SPC and FLAGS are as in
dump_gimple_stmt. */
dump_unary_rhs (buffer, gs, spc, flags);
else if (gimple_num_ops (gs) == 3)
dump_binary_rhs (buffer, gs, spc, flags);
+ else if (gimple_num_ops (gs) == 4)
+ dump_ternary_rhs (buffer, gs, spc, flags);
else
gcc_unreachable ();
if (!(flags & TDF_RHS_ONLY))
}
}
+/* Dump the points-to solution *PT to BUFFER. */
+
+static void
+pp_points_to_solution (pretty_printer *buffer, struct pt_solution *pt)
+{
+ if (pt->anything)
+ {
+ pp_string (buffer, "anything ");
+ return;
+ }
+ if (pt->nonlocal)
+ pp_string (buffer, "nonlocal ");
+ if (pt->escaped)
+ pp_string (buffer, "escaped ");
+ if (pt->ipa_escaped)
+ pp_string (buffer, "unit-escaped ");
+ if (pt->null)
+ pp_string (buffer, "null ");
+ if (pt->vars
+ && !bitmap_empty_p (pt->vars))
+ {
+ bitmap_iterator bi;
+ unsigned i;
+ pp_string (buffer, "{ ");
+ EXECUTE_IF_SET_IN_BITMAP (pt->vars, 0, i, bi)
+ {
+ tree var = referenced_var_lookup (cfun, i);
+ if (var)
+ {
+ dump_generic_node (buffer, var, 0, dump_flags, false);
+ if (DECL_PT_UID (var) != DECL_UID (var))
+ {
+ pp_string (buffer, "ptD.");
+ pp_decimal_int (buffer, DECL_PT_UID (var));
+ }
+ }
+ else
+ {
+ pp_string (buffer, "D.");
+ pp_decimal_int (buffer, i);
+ }
+ pp_character (buffer, ' ');
+ }
+ pp_character (buffer, '}');
+ if (pt->vars_contains_global)
+ pp_string (buffer, " (glob)");
+ }
+}
/* Dump the call statement GS. BUFFER, SPC and FLAGS are as in
dump_gimple_stmt. */
dump_gimple_call (pretty_printer *buffer, gimple gs, int spc, int flags)
{
tree lhs = gimple_call_lhs (gs);
+ tree fn = gimple_call_fn (gs);
+
+ if (flags & TDF_ALIAS)
+ {
+ struct pt_solution *pt;
+ pt = gimple_call_use_set (gs);
+ if (!pt_solution_empty_p (pt))
+ {
+ pp_string (buffer, "# USE = ");
+ pp_points_to_solution (buffer, pt);
+ newline_and_indent (buffer, spc);
+ }
+ pt = gimple_call_clobber_set (gs);
+ if (!pt_solution_empty_p (pt))
+ {
+ pp_string (buffer, "# CLB = ");
+ pp_points_to_solution (buffer, pt);
+ newline_and_indent (buffer, spc);
+ }
+ }
if (flags & TDF_RAW)
{
- dump_gimple_fmt (buffer, spc, flags, "%G <%T, %T",
- gs, gimple_call_fn (gs), lhs);
+ if (gimple_call_internal_p (gs))
+ dump_gimple_fmt (buffer, spc, flags, "%G <%s, %T", gs,
+ internal_fn_name (gimple_call_internal_fn (gs)), lhs);
+ else
+ dump_gimple_fmt (buffer, spc, flags, "%G <%T, %T", gs, fn, lhs);
if (gimple_call_num_args (gs) > 0)
{
pp_string (buffer, ", ");
pp_space (buffer);
}
- print_call_name (buffer, gimple_call_fn (gs));
+ if (gimple_call_internal_p (gs))
+ pp_string (buffer, internal_fn_name (gimple_call_internal_fn (gs)));
+ else
+ print_call_name (buffer, fn, flags);
pp_string (buffer, " (");
dump_gimple_call_args (buffer, gs, flags);
pp_character (buffer, ')');
if (gimple_call_return_slot_opt_p (gs))
pp_string (buffer, " [return slot optimization]");
-
if (gimple_call_tail_p (gs))
pp_string (buffer, " [tail call]");
+
+ if (fn == NULL)
+ return;
+
+ /* Dump the arguments of _ITM_beginTransaction sanely. */
+ if (TREE_CODE (fn) == ADDR_EXPR)
+ fn = TREE_OPERAND (fn, 0);
+ if (TREE_CODE (fn) == FUNCTION_DECL && decl_is_tm_clone (fn))
+ pp_string (buffer, " [tm-clone]");
+ if (TREE_CODE (fn) == FUNCTION_DECL
+ && DECL_BUILT_IN_CLASS (fn) == BUILT_IN_NORMAL
+ && DECL_FUNCTION_CODE (fn) == BUILT_IN_TM_START
+ && gimple_call_num_args (gs) > 0)
+ {
+ tree t = gimple_call_arg (gs, 0);
+ unsigned HOST_WIDE_INT props;
+ gcc_assert (TREE_CODE (t) == INTEGER_CST);
+
+ pp_string (buffer, " [ ");
+
+ /* Get the transaction code properties. */
+ props = TREE_INT_CST_LOW (t);
+
+ if (props & PR_INSTRUMENTEDCODE)
+ pp_string (buffer, "instrumentedCode ");
+ if (props & PR_UNINSTRUMENTEDCODE)
+ pp_string (buffer, "uninstrumentedCode ");
+ if (props & PR_HASNOXMMUPDATE)
+ pp_string (buffer, "hasNoXMMUpdate ");
+ if (props & PR_HASNOABORT)
+ pp_string (buffer, "hasNoAbort ");
+ if (props & PR_HASNOIRREVOCABLE)
+ pp_string (buffer, "hasNoIrrevocable ");
+ if (props & PR_DOESGOIRREVOCABLE)
+ pp_string (buffer, "doesGoIrrevocable ");
+ if (props & PR_HASNOSIMPLEREADS)
+ pp_string (buffer, "hasNoSimpleReads ");
+ if (props & PR_AWBARRIERSOMITTED)
+ pp_string (buffer, "awBarriersOmitted ");
+ if (props & PR_RARBARRIERSOMITTED)
+ pp_string (buffer, "RaRBarriersOmitted ");
+ if (props & PR_UNDOLOGCODE)
+ pp_string (buffer, "undoLogCode ");
+ if (props & PR_PREFERUNINSTRUMENTED)
+ pp_string (buffer, "preferUninstrumented ");
+ if (props & PR_EXCEPTIONBLOCK)
+ pp_string (buffer, "exceptionBlock ");
+ if (props & PR_HASELSE)
+ pp_string (buffer, "hasElse ");
+ if (props & PR_READONLY)
+ pp_string (buffer, "readOnly ");
+
+ pp_string (buffer, "]");
+ }
}
}
if (DECL_NONLOCAL (label))
pp_string (buffer, " [non-local]");
+ if ((flags & TDF_EH) && EH_LANDING_PAD_NR (label))
+ pp_printf (buffer, " [LP %d]", EH_LANDING_PAD_NR (label));
}
/* Dump a GIMPLE_GOTO tuple on the pretty_printer BUFFER, SPC
{
tree var;
- for (var = gimple_bind_vars (gs); var; var = TREE_CHAIN (var))
+ for (var = gimple_bind_vars (gs); var; var = DECL_CHAIN (var))
{
newline_and_indent (buffer, 2);
print_declaration (buffer, var, spc, flags);
}
+/* Dump a GIMPLE_EH_MUST_NOT_THROW tuple. */
+
+static void
+dump_gimple_eh_must_not_throw (pretty_printer *buffer, gimple gs,
+ int spc, int flags)
+{
+ if (flags & TDF_RAW)
+ dump_gimple_fmt (buffer, spc, flags, "%G <%T>", gs,
+ gimple_eh_must_not_throw_fndecl (gs));
+ else
+ dump_gimple_fmt (buffer, spc, flags, "<<<eh_must_not_throw (%T)>>>",
+ gimple_eh_must_not_throw_fndecl (gs));
+}
+
+
+/* Dump a GIMPLE_EH_ELSE tuple on the pretty_printer BUFFER, SPC spaces of
+ indent. FLAGS specifies details to show in the dump (see TDF_* in
+ tree-pass.h). */
+
+static void
+dump_gimple_eh_else (pretty_printer *buffer, gimple gs, int spc, int flags)
+{
+ if (flags & TDF_RAW)
+ dump_gimple_fmt (buffer, spc, flags,
+ "%G <%+N_BODY <%S>%nE_BODY <%S>%->", gs,
+ gimple_eh_else_n_body (gs), gimple_eh_else_e_body (gs));
+ else
+ dump_gimple_fmt (buffer, spc, flags,
+ "<<<if_normal_exit>>>%+{%S}%-<<<else_eh_exit>>>%+{%S}",
+ gimple_eh_else_n_body (gs), gimple_eh_else_e_body (gs));
+}
+
+
/* Dump a GIMPLE_RESX tuple on the pretty_printer BUFFER, SPC spaces of
indent. FLAGS specifies details to show in the dump (see TDF_* in
tree-pass.h). */
{
if (flags & TDF_RAW)
dump_gimple_fmt (buffer, spc, flags, "%G <%d>", gs,
- gimple_resx_region (gs));
+ gimple_resx_region (gs));
else
dump_gimple_fmt (buffer, spc, flags, "resx %d", gimple_resx_region (gs));
}
+/* Dump a GIMPLE_EH_DISPATCH tuple on the pretty_printer BUFFER. */
+
+static void
+dump_gimple_eh_dispatch (pretty_printer *buffer, gimple gs, int spc, int flags)
+{
+ if (flags & TDF_RAW)
+ dump_gimple_fmt (buffer, spc, flags, "%G <%d>", gs,
+ gimple_eh_dispatch_region (gs));
+ else
+ dump_gimple_fmt (buffer, spc, flags, "eh_dispatch %d",
+ gimple_eh_dispatch_region (gs));
+}
+
+/* Dump a GIMPLE_DEBUG tuple on the pretty_printer BUFFER, SPC spaces
+ of indent. FLAGS specifies details to show in the dump (see TDF_*
+ in tree-pass.h). */
+
+static void
+dump_gimple_debug (pretty_printer *buffer, gimple gs, int spc, int flags)
+{
+ switch (gs->gsbase.subcode)
+ {
+ case GIMPLE_DEBUG_BIND:
+ if (flags & TDF_RAW)
+ dump_gimple_fmt (buffer, spc, flags, "%G BIND <%T, %T>", gs,
+ gimple_debug_bind_get_var (gs),
+ gimple_debug_bind_get_value (gs));
+ else
+ dump_gimple_fmt (buffer, spc, flags, "# DEBUG %T => %T",
+ gimple_debug_bind_get_var (gs),
+ gimple_debug_bind_get_value (gs));
+ break;
+
+ case GIMPLE_DEBUG_SOURCE_BIND:
+ if (flags & TDF_RAW)
+ dump_gimple_fmt (buffer, spc, flags, "%G SRCBIND <%T, %T>", gs,
+ gimple_debug_source_bind_get_var (gs),
+ gimple_debug_source_bind_get_value (gs));
+ else
+ dump_gimple_fmt (buffer, spc, flags, "# DEBUG %T s=> %T",
+ gimple_debug_source_bind_get_var (gs),
+ gimple_debug_source_bind_get_value (gs));
+ break;
+
+ default:
+ gcc_unreachable ();
+ }
+}
+
/* Dump a GIMPLE_OMP_FOR tuple on the pretty_printer BUFFER. */
static void
dump_gimple_omp_for (pretty_printer *buffer, gimple gs, int spc, int flags)
}
}
+/* Dump a GIMPLE_TRANSACTION tuple on the pretty_printer BUFFER. */
+
+static void
+dump_gimple_transaction (pretty_printer *buffer, gimple gs, int spc, int flags)
+{
+ unsigned subcode = gimple_transaction_subcode (gs);
+
+ if (flags & TDF_RAW)
+ {
+ dump_gimple_fmt (buffer, spc, flags,
+ "%G [SUBCODE=%x,LABEL=%T] <%+BODY <%S> >",
+ gs, subcode, gimple_transaction_label (gs),
+ gimple_transaction_body (gs));
+ }
+ else
+ {
+ if (subcode & GTMA_IS_OUTER)
+ pp_string (buffer, "__transaction_atomic [[outer]]");
+ else if (subcode & GTMA_IS_RELAXED)
+ pp_string (buffer, "__transaction_relaxed");
+ else
+ pp_string (buffer, "__transaction_atomic");
+ subcode &= ~GTMA_DECLARATION_MASK;
+
+ if (subcode || gimple_transaction_label (gs))
+ {
+ pp_string (buffer, " //");
+ if (gimple_transaction_label (gs))
+ {
+ pp_string (buffer, " LABEL=");
+ dump_generic_node (buffer, gimple_transaction_label (gs),
+ spc, flags, false);
+ }
+ if (subcode)
+ {
+ pp_string (buffer, " SUBCODE=[ ");
+ if (subcode & GTMA_HAVE_ABORT)
+ {
+ pp_string (buffer, "GTMA_HAVE_ABORT ");
+ subcode &= ~GTMA_HAVE_ABORT;
+ }
+ if (subcode & GTMA_HAVE_LOAD)
+ {
+ pp_string (buffer, "GTMA_HAVE_LOAD ");
+ subcode &= ~GTMA_HAVE_LOAD;
+ }
+ if (subcode & GTMA_HAVE_STORE)
+ {
+ pp_string (buffer, "GTMA_HAVE_STORE ");
+ subcode &= ~GTMA_HAVE_STORE;
+ }
+ if (subcode & GTMA_MAY_ENTER_IRREVOCABLE)
+ {
+ pp_string (buffer, "GTMA_MAY_ENTER_IRREVOCABLE ");
+ subcode &= ~GTMA_MAY_ENTER_IRREVOCABLE;
+ }
+ if (subcode & GTMA_DOES_GO_IRREVOCABLE)
+ {
+ pp_string (buffer, "GTMA_DOES_GO_IRREVOCABLE ");
+ subcode &= ~GTMA_DOES_GO_IRREVOCABLE;
+ }
+ if (subcode)
+ pp_printf (buffer, "0x%x ", subcode);
+ pp_string (buffer, "]");
+ }
+ }
+
+ if (!gimple_seq_empty_p (gimple_transaction_body (gs)))
+ {
+ newline_and_indent (buffer, spc + 2);
+ pp_character (buffer, '{');
+ pp_newline (buffer);
+ dump_gimple_seq (buffer, gimple_transaction_body (gs),
+ spc + 4, flags);
+ newline_and_indent (buffer, spc + 2);
+ pp_character (buffer, '}');
+ }
+ }
+}
+
/* Dump a GIMPLE_ASM tuple on the pretty_printer BUFFER, SPC spaces of
indent. FLAGS specifies details to show in the dump (see TDF_* in
tree-pass.h). */
static void
dump_gimple_asm (pretty_printer *buffer, gimple gs, int spc, int flags)
{
- unsigned int i;
+ unsigned int i, n, f, fields;
if (flags & TDF_RAW)
- dump_gimple_fmt (buffer, spc, flags, "%G <%+STRING <%n%s%n>", gs,
- gimple_asm_string (gs));
+ {
+ dump_gimple_fmt (buffer, spc, flags, "%G <%+STRING <%n%s%n>", gs,
+ gimple_asm_string (gs));
+
+ n = gimple_asm_noutputs (gs);
+ if (n)
+ {
+ newline_and_indent (buffer, spc + 2);
+ pp_string (buffer, "OUTPUT: ");
+ for (i = 0; i < n; i++)
+ {
+ dump_generic_node (buffer, gimple_asm_output_op (gs, i),
+ spc, flags, false);
+ if (i < n - 1)
+ pp_string (buffer, ", ");
+ }
+ }
+
+ n = gimple_asm_ninputs (gs);
+ if (n)
+ {
+ newline_and_indent (buffer, spc + 2);
+ pp_string (buffer, "INPUT: ");
+ for (i = 0; i < n; i++)
+ {
+ dump_generic_node (buffer, gimple_asm_input_op (gs, i),
+ spc, flags, false);
+ if (i < n - 1)
+ pp_string (buffer, ", ");
+ }
+ }
+
+ n = gimple_asm_nclobbers (gs);
+ if (n)
+ {
+ newline_and_indent (buffer, spc + 2);
+ pp_string (buffer, "CLOBBER: ");
+ for (i = 0; i < n; i++)
+ {
+ dump_generic_node (buffer, gimple_asm_clobber_op (gs, i),
+ spc, flags, false);
+ if (i < n - 1)
+ pp_string (buffer, ", ");
+ }
+ }
+
+ n = gimple_asm_nlabels (gs);
+ if (n)
+ {
+ newline_and_indent (buffer, spc + 2);
+ pp_string (buffer, "LABEL: ");
+ for (i = 0; i < n; i++)
+ {
+ dump_generic_node (buffer, gimple_asm_label_op (gs, i),
+ spc, flags, false);
+ if (i < n - 1)
+ pp_string (buffer, ", ");
+ }
+ }
+
+ newline_and_indent (buffer, spc);
+ pp_character (buffer, '>');
+ }
else
{
pp_string (buffer, "__asm__");
if (gimple_asm_volatile_p (gs))
pp_string (buffer, " __volatile__");
+ if (gimple_asm_nlabels (gs))
+ pp_string (buffer, " goto");
pp_string (buffer, "(\"");
pp_string (buffer, gimple_asm_string (gs));
pp_string (buffer, "\"");
- }
- if (gimple_asm_ninputs (gs)
- || gimple_asm_noutputs (gs)
- || gimple_asm_nclobbers (gs))
- {
- if (gimple_asm_noutputs (gs))
- {
- if (flags & TDF_RAW)
- {
- newline_and_indent (buffer, spc + 2);
- pp_string (buffer, "OUTPUT: ");
- }
- else
- pp_string (buffer, " : ");
- }
+ if (gimple_asm_nlabels (gs))
+ fields = 4;
+ else if (gimple_asm_nclobbers (gs))
+ fields = 3;
+ else if (gimple_asm_ninputs (gs))
+ fields = 2;
+ else if (gimple_asm_noutputs (gs))
+ fields = 1;
+ else
+ fields = 0;
- for (i = 0; i < gimple_asm_noutputs (gs); i++)
- {
- dump_generic_node (buffer, gimple_asm_output_op (gs, i), spc, flags,
- false);
- if ( i < gimple_asm_noutputs (gs) -1)
- pp_string (buffer, ", ");
- }
+ for (f = 0; f < fields; ++f)
+ {
+ pp_string (buffer, " : ");
- if (gimple_asm_ninputs (gs))
- {
- if (flags & TDF_RAW)
- {
- newline_and_indent (buffer, spc + 2);
- pp_string (buffer, "INPUT: ");
- }
- else
- pp_string (buffer, " : ");
- }
+ switch (f)
+ {
+ case 0:
+ n = gimple_asm_noutputs (gs);
+ for (i = 0; i < n; i++)
+ {
+ dump_generic_node (buffer, gimple_asm_output_op (gs, i),
+ spc, flags, false);
+ if (i < n - 1)
+ pp_string (buffer, ", ");
+ }
+ break;
- for (i = 0; i < gimple_asm_ninputs (gs); i++)
- {
- dump_generic_node (buffer, gimple_asm_input_op (gs, i), spc, flags,
- false);
- if (i < gimple_asm_ninputs (gs) -1)
- pp_string (buffer, " : ");
- }
+ case 1:
+ n = gimple_asm_ninputs (gs);
+ for (i = 0; i < n; i++)
+ {
+ dump_generic_node (buffer, gimple_asm_input_op (gs, i),
+ spc, flags, false);
+ if (i < n - 1)
+ pp_string (buffer, ", ");
+ }
+ break;
- if (gimple_asm_nclobbers (gs))
- {
- if (flags & TDF_RAW)
- {
- newline_and_indent (buffer, spc + 2);
- pp_string (buffer, "CLOBBER: ");
- }
- else
- pp_string (buffer, " : ");
- }
+ case 2:
+ n = gimple_asm_nclobbers (gs);
+ for (i = 0; i < n; i++)
+ {
+ dump_generic_node (buffer, gimple_asm_clobber_op (gs, i),
+ spc, flags, false);
+ if (i < n - 1)
+ pp_string (buffer, ", ");
+ }
+ break;
- for (i = 0; i < gimple_asm_nclobbers (gs); i++)
- {
- dump_generic_node (buffer, gimple_asm_clobber_op (gs, i), spc, flags,
- false);
- if ( i < gimple_asm_nclobbers (gs) -1)
- pp_string (buffer, ", ");
- }
- }
- if (flags & TDF_RAW)
- {
- newline_and_indent (buffer, spc);
- pp_character (buffer, '>');
+ case 3:
+ n = gimple_asm_nlabels (gs);
+ for (i = 0; i < n; i++)
+ {
+ dump_generic_node (buffer, gimple_asm_label_op (gs, i),
+ spc, flags, false);
+ if (i < n - 1)
+ pp_string (buffer, ", ");
+ }
+ break;
+
+ default:
+ gcc_unreachable ();
+ }
+ }
+
+ pp_string (buffer, ");");
}
- else
- pp_string (buffer, ");");
}
dump_gimple_phi (pretty_printer *buffer, gimple phi, int spc, int flags)
{
size_t i;
+ tree lhs = gimple_phi_result (phi);
+
+ if (flags & TDF_ALIAS
+ && POINTER_TYPE_P (TREE_TYPE (lhs))
+ && SSA_NAME_PTR_INFO (lhs))
+ {
+ struct ptr_info_def *pi = SSA_NAME_PTR_INFO (lhs);
+ pp_string (buffer, "PT = ");
+ pp_points_to_solution (buffer, &pi->pt);
+ newline_and_indent (buffer, spc);
+ if (pi->align != 1)
+ pp_printf (buffer, "# ALIGN = %u, MISALIGN = %u",
+ pi->align, pi->misalign);
+ newline_and_indent (buffer, spc);
+ pp_string (buffer, "# ");
+ }
if (flags & TDF_RAW)
dump_gimple_fmt (buffer, spc, flags, "%G <%T, ", phi,
gimple_phi_result (phi));
else
{
- dump_generic_node (buffer, gimple_phi_result (phi), spc, flags, false);
+ dump_generic_node (buffer, lhs, spc, flags, false);
pp_string (buffer, " = PHI <");
}
for (i = 0; i < gimple_phi_num_args (phi); i++)
{
+ if ((flags & TDF_LINENO) && gimple_phi_arg_has_location (phi, i))
+ {
+ expanded_location xloc;
+
+ xloc = expand_location (gimple_phi_arg_location (phi, i));
+ pp_character (buffer, '[');
+ if (xloc.file)
+ {
+ pp_string (buffer, xloc.file);
+ pp_string (buffer, " : ");
+ }
+ pp_decimal_int (buffer, xloc.line);
+ pp_string (buffer, ":");
+ pp_decimal_int (buffer, xloc.column);
+ pp_string (buffer, "] ");
+ }
dump_generic_node (buffer, gimple_phi_arg_def (phi, i), spc, flags,
false);
pp_character (buffer, '(');
else
{
pp_string (buffer, "#pragma omp atomic_load");
+ if (gimple_omp_atomic_need_value_p (gs))
+ pp_string (buffer, " [needed]");
newline_and_indent (buffer, spc + 2);
dump_generic_node (buffer, gimple_omp_atomic_load_lhs (gs),
spc, flags, false);
}
else
{
- pp_string (buffer, "#pragma omp atomic_store (");
+ pp_string (buffer, "#pragma omp atomic_store ");
+ if (gimple_omp_atomic_need_value_p (gs))
+ pp_string (buffer, "[needed] ");
+ pp_character (buffer, '(');
dump_generic_node (buffer, gimple_omp_atomic_store_val (gs),
spc, flags, false);
pp_character (buffer, ')');
pp_string (buffer, " : ");
}
pp_decimal_int (buffer, xloc.line);
+ pp_string (buffer, ":");
+ pp_decimal_int (buffer, xloc.column);
pp_string (buffer, "] ");
}
+ if (flags & TDF_EH)
+ {
+ int lp_nr = lookup_stmt_eh_lp (gs);
+ if (lp_nr > 0)
+ pp_printf (buffer, "[LP %d] ", lp_nr);
+ else if (lp_nr < 0)
+ pp_printf (buffer, "[MNT %d] ", -lp_nr);
+ }
+
if ((flags & (TDF_VOPS|TDF_MEMSYMS))
&& gimple_has_mem_ops (gs))
dump_gimple_mem_ops (buffer, gs, spc, flags);
+ if ((flags & TDF_ALIAS)
+ && gimple_has_lhs (gs))
+ {
+ tree lhs = gimple_get_lhs (gs);
+ if (TREE_CODE (lhs) == SSA_NAME
+ && POINTER_TYPE_P (TREE_TYPE (lhs))
+ && SSA_NAME_PTR_INFO (lhs))
+ {
+ struct ptr_info_def *pi = SSA_NAME_PTR_INFO (lhs);
+ pp_string (buffer, "# PT = ");
+ pp_points_to_solution (buffer, &pi->pt);
+ newline_and_indent (buffer, spc);
+ if (pi->align != 1)
+ {
+ pp_printf (buffer, "# ALIGN = %u, MISALIGN = %u",
+ pi->align, pi->misalign);
+ newline_and_indent (buffer, spc);
+ }
+ }
+ }
+
switch (gimple_code (gs))
{
case GIMPLE_ASM:
dump_gimple_eh_filter (buffer, gs, spc, flags);
break;
+ case GIMPLE_EH_MUST_NOT_THROW:
+ dump_gimple_eh_must_not_throw (buffer, gs, spc, flags);
+ break;
+
+ case GIMPLE_EH_ELSE:
+ dump_gimple_eh_else (buffer, gs, spc, flags);
+ break;
+
case GIMPLE_RESX:
dump_gimple_resx (buffer, gs, spc, flags);
break;
+ case GIMPLE_EH_DISPATCH:
+ dump_gimple_eh_dispatch (buffer, gs, spc, flags);
+ break;
+
+ case GIMPLE_DEBUG:
+ dump_gimple_debug (buffer, gs, spc, flags);
+ break;
+
case GIMPLE_PREDICT:
pp_string (buffer, "// predicted ");
if (gimple_predict_outcome (gs))
pp_string (buffer, " predictor.");
break;
+ case GIMPLE_TRANSACTION:
+ dump_gimple_transaction (buffer, gs, spc, flags);
+ break;
+
default:
GIMPLE_NIY;
}
gimple_stmt_iterator gsi;
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
- if (get_lineno (gsi_stmt (gsi)) != -1)
+ if (!is_gimple_debug (gsi_stmt (gsi))
+ && get_lineno (gsi_stmt (gsi)) != UNKNOWN_LOCATION)
{
pp_string (buffer, ", starting at line ");
pp_decimal_int (buffer, get_lineno (gsi_stmt (gsi)));
break;
}
+
+ if (bb->discriminator)
+ {
+ pp_string (buffer, ", discriminator ");
+ pp_decimal_int (buffer, bb->discriminator);
+ }
}
newline_and_indent (buffer, indent);
}
}
pp_write_text_to_stream (buffer);
- check_bb_profile (bb, buffer->buffer->stream);
+ if (cfun)
+ check_bb_profile (bb, buffer->buffer->stream);
}
int flags)
{
edge e;
- edge_iterator ei;
gimple stmt;
stmt = last_stmt (bb);
/* If there is a fallthru edge, we may need to add an artificial
goto to the dump. */
- FOR_EACH_EDGE (e, ei, bb->succs)
- if (e->flags & EDGE_FALLTHRU)
- break;
+ e = find_fallthru_edge (bb->succs);
if (e && e->dest != bb->next_bb)
{
pp_string (buffer, " : ");
}
pp_decimal_int (buffer, goto_xloc.line);
+ pp_string (buffer, " : ");
+ pp_decimal_int (buffer, goto_xloc.column);
pp_string (buffer, "] ");
}