This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Small *-alias dump fixes
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Richard Biener <rguenther at suse dot de>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Tue, 22 Oct 2013 21:23:41 +0200
- Subject: [PATCH] Small *-alias dump fixes
- Authentication-results: sourceware.org; auth=none
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
Hi!
I've noticed that some -fdump-tree-*-alias dumps look badly, contain stuff
like:
<bb 4>:
# # RANGE [0, 52]
_1 = PHI <0(2), f2_12(3)>
return _1;
or:
<bb 4>:
# PT = { D.1732 } (glob)
# ALIGN = 32, MISALIGN = 0
# p_1 = PHI <&MEM[(void *)&a + 128B](2), &MEM[(void *)&a + 512B](3)>
PT = { D.1732 } (glob)
# ALIGN = 32, MISALIGN = 0
# p_3 = p_1 + 64;
note, some lines get double an extra "# " and some don't get that when it
should, in both examples.
Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
trunk?
2013-10-22 Jakub Jelinek <jakub@redhat.com>
* gimple-pretty-print.c (dump_ssaname_info): Always print "# " before
the info, not after it.
(gump_gimple_phi): Add COMMENT argument, if true, print "# " after
dump_ssaname_info call.
(pp_gimple_stmt_1): Adjust caller.
(dump_phi_nodes): Likewise. Don't print "# " here.
--- gcc/gimple-pretty-print.c.jj 2013-10-17 22:30:56.000000000 +0200
+++ gcc/gimple-pretty-print.c 2013-10-22 14:04:53.272329144 +0200
@@ -1714,7 +1714,7 @@ dump_ssaname_info (pretty_printer *buffe
{
unsigned int align, misalign;
struct ptr_info_def *pi = SSA_NAME_PTR_INFO (node);
- pp_string (buffer, "PT = ");
+ pp_string (buffer, "# PT = ");
pp_points_to_solution (buffer, &pi->pt);
newline_and_indent (buffer, spc);
if (get_ptr_info_alignment (pi, &align, &misalign))
@@ -1722,7 +1722,6 @@ dump_ssaname_info (pretty_printer *buffe
pp_printf (buffer, "# ALIGN = %u, MISALIGN = %u", align, misalign);
newline_and_indent (buffer, spc);
}
- pp_string (buffer, "# ");
}
if (!POINTER_TYPE_P (TREE_TYPE (node))
@@ -1732,7 +1731,7 @@ dump_ssaname_info (pretty_printer *buffe
value_range_type range_type = get_range_info (node, &min, &max);
if (range_type == VR_VARYING)
- pp_printf (buffer, "# RANGE VR_VARYING");
+ pp_printf (buffer, "# RANGE VR_VARYING");
else if (range_type == VR_RANGE || range_type == VR_ANTI_RANGE)
{
pp_printf (buffer, "# RANGE ");
@@ -1749,10 +1748,11 @@ dump_ssaname_info (pretty_printer *buffe
/* Dump a PHI node PHI. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1.
The caller is responsible for calling pp_flush on BUFFER to finalize
- pretty printer. */
+ pretty printer. If COMMENT is true, print this after #. */
static void
-dump_gimple_phi (pretty_printer *buffer, gimple phi, int spc, int flags)
+dump_gimple_phi (pretty_printer *buffer, gimple phi, int spc, bool comment,
+ int flags)
{
size_t i;
tree lhs = gimple_phi_result (phi);
@@ -1760,6 +1760,9 @@ dump_gimple_phi (pretty_printer *buffer,
if (flags & TDF_ALIAS)
dump_ssaname_info (buffer, lhs, spc);
+ if (comment)
+ pp_string (buffer, "# ");
+
if (flags & TDF_RAW)
dump_gimple_fmt (buffer, spc, flags, "%G <%T, ", phi,
gimple_phi_result (phi));
@@ -2095,7 +2098,7 @@ pp_gimple_stmt_1 (pretty_printer *buffer
break;
case GIMPLE_PHI:
- dump_gimple_phi (buffer, gs, spc, flags);
+ dump_gimple_phi (buffer, gs, spc, false, flags);
break;
case GIMPLE_OMP_PARALLEL:
@@ -2271,8 +2274,7 @@ dump_phi_nodes (pretty_printer *buffer,
if (!virtual_operand_p (gimple_phi_result (phi)) || (flags & TDF_VOPS))
{
INDENT (indent);
- pp_string (buffer, "# ");
- dump_gimple_phi (buffer, phi, indent, flags);
+ dump_gimple_phi (buffer, phi, indent, true, flags);
pp_newline (buffer);
}
}
Jakub