diff mbox series

tree-pretty-print: Handle boolean types

Message ID mptlfm3g0kx.fsf@arm.com
State New
Headers show
Series tree-pretty-print: Handle boolean types | expand

Commit Message

Richard Sandiford May 7, 2020, 4:40 p.m. UTC
AVX512-style masks and SVE-style predicates can be difficult
to debug in gimple dumps, since the types are printed like this:

  vector(4) <unnamed type> foo;

Some important details are hidden by that <unnamed type>,
such as the number of bits in an element and whether the type
is signed or unsigned.

This patch uses an ad-hoc syntax for printing unnamed
boolean types.  Normal frontend ones should be handled
by the earlier TYPE_NAME code.

Tested on aarch64-linux-gnu and x86_64-linux-gnu.  OK to install?

Richard


2020-05-07  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
	* tree-pretty-print.c (dump_generic_node): Handle BOOLEAN_TYPEs.
---
 gcc/tree-pretty-print.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Li, Pan2 via Gcc-patches May 7, 2020, 5:02 p.m. UTC | #1
On Thu, 2020-05-07 at 17:40 +0100, Richard Sandiford wrote:
> AVX512-style masks and SVE-style predicates can be difficult
> to debug in gimple dumps, since the types are printed like this:
> 
>   vector(4) <unnamed type> foo;
> 
> Some important details are hidden by that <unnamed type>,
> such as the number of bits in an element and whether the type
> is signed or unsigned.
> 
> This patch uses an ad-hoc syntax for printing unnamed
> boolean types.  Normal frontend ones should be handled
> by the earlier TYPE_NAME code.
> 
> Tested on aarch64-linux-gnu and x86_64-linux-gnu.  OK to install?
> 
> Richard
> 
> 
> 2020-05-07  Richard Sandiford  <richard.sandiford@arm.com>
> 
> gcc/
> 	* tree-pretty-print.c (dump_generic_node): Handle BOOLEAN_TYPEs.
OK
jeff
>
Richard Biener May 7, 2020, 5:49 p.m. UTC | #2
On Thu, May 7, 2020 at 7:24 PM Richard Sandiford
<richard.sandiford@arm.com> wrote:
>
> AVX512-style masks and SVE-style predicates can be difficult
> to debug in gimple dumps, since the types are printed like this:
>
>   vector(4) <unnamed type> foo;
>
> Some important details are hidden by that <unnamed type>,
> such as the number of bits in an element and whether the type
> is signed or unsigned.
>
> This patch uses an ad-hoc syntax for printing unnamed
> boolean types.  Normal frontend ones should be handled
> by the earlier TYPE_NAME code.
>
> Tested on aarch64-linux-gnu and x86_64-linux-gnu.  OK to install?

OK.

> Richard
>
>
> 2020-05-07  Richard Sandiford  <richard.sandiford@arm.com>
>
> gcc/
>         * tree-pretty-print.c (dump_generic_node): Handle BOOLEAN_TYPEs.
> ---
>  gcc/tree-pretty-print.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/gcc/tree-pretty-print.c b/gcc/tree-pretty-print.c
> index 885ca8cd329..f04fd65091a 100644
> --- a/gcc/tree-pretty-print.c
> +++ b/gcc/tree-pretty-print.c
> @@ -1761,6 +1761,14 @@ dump_generic_node (pretty_printer *pp, tree node, int spc, dump_flags_t flags,
>                 pp_decimal_int (pp, TYPE_PRECISION (node));
>                 pp_greater (pp);
>               }
> +           else if (TREE_CODE (node) == BOOLEAN_TYPE)
> +             {
> +               pp_string (pp, (TYPE_UNSIGNED (node)
> +                               ? "<unsigned-boolean:"
> +                               : "<signed-boolean:"));
> +               pp_decimal_int (pp, TYPE_PRECISION (node));
> +               pp_greater (pp);
> +             }
>             else if (TREE_CODE (node) == VOID_TYPE)
>               pp_string (pp, "void");
>             else
diff mbox series

Patch

diff --git a/gcc/tree-pretty-print.c b/gcc/tree-pretty-print.c
index 885ca8cd329..f04fd65091a 100644
--- a/gcc/tree-pretty-print.c
+++ b/gcc/tree-pretty-print.c
@@ -1761,6 +1761,14 @@  dump_generic_node (pretty_printer *pp, tree node, int spc, dump_flags_t flags,
 		pp_decimal_int (pp, TYPE_PRECISION (node));
 		pp_greater (pp);
 	      }
+	    else if (TREE_CODE (node) == BOOLEAN_TYPE)
+	      {
+		pp_string (pp, (TYPE_UNSIGNED (node)
+				? "<unsigned-boolean:"
+				: "<signed-boolean:"));
+		pp_decimal_int (pp, TYPE_PRECISION (node));
+		pp_greater (pp);
+	      }
 	    else if (TREE_CODE (node) == VOID_TYPE)
 	      pp_string (pp, "void");
 	    else