[gimplefe] change dump format of realpart_expr and imagpart_expr with TDF_GIMPLE

Message ID CAAgBjMnDKju0ZBTjr=TONSQCMZdL4VD3u1MZWBoowY8ME+us_A@mail.gmail.com
State New
Headers show

Commit Message

Prathamesh Kulkarni Dec. 22, 2016, 11:27 a.m.
Hi,
For TDF_GIMPLE, the attached patch changes dump
format of realpart_expr from REALPART_EXPR<var> to __real var
since the latter form is accepted by gimplefe. Similarly for imagpart_expr.
Is this OK after bootstrap+test ?

Thanks,
Prathamesh

Comments

Richard Biener Dec. 22, 2016, 1:28 p.m. | #1
On December 22, 2016 12:27:38 PM GMT+01:00, Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org> wrote:
>Hi,

>For TDF_GIMPLE, the attached patch changes dump

>format of realpart_expr from REALPART_EXPR<var> to __real var

>since the latter form is accepted by gimplefe. Similarly for

>imagpart_expr.

>Is this OK after bootstrap+test ?


OK.

Richard.

>Thanks,

>Prathamesh

Patch hide | download patch | download mbox

diff --git a/gcc/testsuite/gcc.dg/gimplefe-20.c b/gcc/testsuite/gcc.dg/gimplefe-20.c
new file mode 100644
index 0000000..99b3180
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/gimplefe-20.c
@@ -0,0 +1,20 @@ 
+/* { dg-do compile } */
+/* { dg-options "-O -fgimple -fdump-tree-ssa-gimple" } */
+
+_Complex a;
+
+double __GIMPLE() f()
+{
+  double t1;
+  double t2;
+  double _1;
+
+bb1:
+  t1_2 = __real a;
+  t2_3 = __imag a;
+  _1 = t1_2 + t2_3;
+  return _1;
+}
+
+/* { dg-final { scan-tree-dump "__real a" "ssa" } } */
+/* { dg-final { scan-tree-dump "__imag a" "ssa" } } */
diff --git a/gcc/tree-pretty-print.c b/gcc/tree-pretty-print.c
index 5b3e23e..40c0bc6 100644
--- a/gcc/tree-pretty-print.c
+++ b/gcc/tree-pretty-print.c
@@ -2451,15 +2451,31 @@  dump_generic_node (pretty_printer *pp, tree node, int spc, int flags,
       break;
 
     case REALPART_EXPR:
-      pp_string (pp, "REALPART_EXPR <");
-      dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
-      pp_greater (pp);
+      if (flags & TDF_GIMPLE)
+	{
+	  pp_string (pp, "__real ");
+	  dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
+	}
+      else
+	{
+	  pp_string (pp, "REALPART_EXPR <");
+	  dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
+	  pp_greater (pp);
+	}
       break;
 
     case IMAGPART_EXPR:
-      pp_string (pp, "IMAGPART_EXPR <");
-      dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
-      pp_greater (pp);
+      if (flags & TDF_GIMPLE)
+	{
+	  pp_string (pp, "__imag ");
+	  dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
+	}
+      else
+	{
+	  pp_string (pp, "IMAGPART_EXPR <");
+	  dump_generic_node (pp, TREE_OPERAND (node, 0), spc, flags, false);
+	  pp_greater (pp);
+	}
       break;
 
     case VA_ARG_EXPR: