Patchwork PR 54193: raw gimple dump of vec_perm_expr

login
register
mail settings
Submitter Marc Glisse
Date Aug. 11, 2012, 8:37 p.m.
Message ID <alpine.DEB.2.02.1208112227050.16250@stedding.saclay.inria.fr>
Download mbox | patch
Permalink /patch/176752/
State New
Headers show

Comments

Marc Glisse - Aug. 11, 2012, 8:37 p.m.
Hello,

I'll have to retest this patch tomorrow (although I don't expect the 
modified code is ever called), for some reason the testsuite took twice as 
long as usual to run and showed some weird stuff tonight.

There doesn't seem to be any test calling -fdump-tree-*-raw, so I didn't 
add any.

I wondered about spelling out 3 calls to dump_gimple_fmt to avoid the 
trailing NULLs, but who cares...

2012-08-12  Marc Glisse  <marc.glisse@inria.fr>

 	PR middle-end/54193
 	* gimple-pretty-print.c (dump_ternary_rhs): Handle 4 arguments.
Richard Guenther - Aug. 12, 2012, 1:58 p.m.
On Sat, Aug 11, 2012 at 10:37 PM, Marc Glisse <marc.glisse@inria.fr> wrote:
> Hello,
>
> I'll have to retest this patch tomorrow (although I don't expect the
> modified code is ever called), for some reason the testsuite took twice as
> long as usual to run and showed some weird stuff tonight.
>
> There doesn't seem to be any test calling -fdump-tree-*-raw, so I didn't add
> any.
>
> I wondered about spelling out 3 calls to dump_gimple_fmt to avoid the
> trailing NULLs, but who cares...

Ok.

Thanks,
Richard.

> 2012-08-12  Marc Glisse  <marc.glisse@inria.fr>
>
>         PR middle-end/54193
>         * gimple-pretty-print.c (dump_ternary_rhs): Handle 4 arguments.
>
> --
> Marc Glisse
> Index: gcc/gimple-pretty-print.c
> ===================================================================
> --- gcc/gimple-pretty-print.c   (revision 190318)
> +++ gcc/gimple-pretty-print.c   (working copy)
> @@ -470,31 +470,39 @@ dump_ternary_rhs (pretty_printer *buffer
>
>
>  /* Dump the gimple assignment GS.  BUFFER, SPC and FLAGS are as in
>     dump_gimple_stmt.  */
>
>  static void
>  dump_gimple_assign (pretty_printer *buffer, gimple gs, int spc, int flags)
>  {
>    if (flags & TDF_RAW)
>      {
> -      tree last;
> -      if (gimple_num_ops (gs) == 2)
> -        last = NULL_TREE;
> -      else if (gimple_num_ops (gs) == 3)
> -        last = gimple_assign_rhs2 (gs);
> -      else
> -        gcc_unreachable ();
> +      tree arg1 = NULL;
> +      tree arg2 = NULL;
> +      tree arg3 = NULL;
> +      switch (gimple_num_ops (gs))
> +       {
> +       case 4:
> +         arg3 = gimple_assign_rhs3 (gs);
> +       case 3:
> +         arg2 = gimple_assign_rhs2 (gs);
> +       case 2:
> +         arg1 = gimple_assign_rhs1 (gs);
> +         break;
> +       default:
> +         gcc_unreachable ();
> +       }
>
> -      dump_gimple_fmt (buffer, spc, flags, "%G <%s, %T, %T, %T>", gs,
> +      dump_gimple_fmt (buffer, spc, flags, "%G <%s, %T, %T, %T, %T>", gs,
>                         tree_code_name[gimple_assign_rhs_code (gs)],
> -                       gimple_assign_lhs (gs), gimple_assign_rhs1 (gs),
> last);
> +                       gimple_assign_lhs (gs), arg1, arg2, arg3);
>      }
>    else
>      {
>        if (!(flags & TDF_RHS_ONLY))
>         {
>           dump_generic_node (buffer, gimple_assign_lhs (gs), spc, flags,
> false);
>           pp_space (buffer);
>           pp_character (buffer, '=');
>
>           if (gimple_assign_nontemporal_move_p (gs))
>

Patch

Index: gcc/gimple-pretty-print.c

===================================================================
--- gcc/gimple-pretty-print.c	(revision 190318)

+++ gcc/gimple-pretty-print.c	(working copy)

@@ -470,31 +470,39 @@  dump_ternary_rhs (pretty_printer *buffer

 
 
 /* Dump the gimple assignment GS.  BUFFER, SPC and FLAGS are as in
    dump_gimple_stmt.  */
 
 static void
 dump_gimple_assign (pretty_printer *buffer, gimple gs, int spc, int flags)
 {
   if (flags & TDF_RAW)
     {
-      tree last;

-      if (gimple_num_ops (gs) == 2)

-        last = NULL_TREE;

-      else if (gimple_num_ops (gs) == 3)

-        last = gimple_assign_rhs2 (gs);

-      else

-        gcc_unreachable ();

+      tree arg1 = NULL;

+      tree arg2 = NULL;

+      tree arg3 = NULL;

+      switch (gimple_num_ops (gs))

+	{

+	case 4:

+	  arg3 = gimple_assign_rhs3 (gs);

+	case 3:

+	  arg2 = gimple_assign_rhs2 (gs);

+	case 2:

+	  arg1 = gimple_assign_rhs1 (gs);

+	  break;

+	default:

+	  gcc_unreachable ();

+	}

 
-      dump_gimple_fmt (buffer, spc, flags, "%G <%s, %T, %T, %T>", gs,

+      dump_gimple_fmt (buffer, spc, flags, "%G <%s, %T, %T, %T, %T>", gs,

                        tree_code_name[gimple_assign_rhs_code (gs)],
-                       gimple_assign_lhs (gs), gimple_assign_rhs1 (gs), last);

+                       gimple_assign_lhs (gs), arg1, arg2, arg3);

     }
   else
     {
       if (!(flags & TDF_RHS_ONLY))
 	{
 	  dump_generic_node (buffer, gimple_assign_lhs (gs), spc, flags, false);
 	  pp_space (buffer);
 	  pp_character (buffer, '=');
 
 	  if (gimple_assign_nontemporal_move_p (gs))