From: Richard Sandiford <rdsandif...@googlemail.com>
Date: Wed, 02 May 2012 20:37:58 +0100

> I think the DSE assuption is fair though.  If you reuse MEMs like
> this, then they're no longer just serving the purpose described by
> MEM_EXPR.

The following seems to work, and matches what calls.c does when it
passes a value by reference.  Is this what you had in mind?

2012-05-02  David S. Miller  <da...@davemloft.net>

        * config/sparc/sparc.c (emit_soft_tfmode_libcall): If we pass a
        MEM directly into a libcall, mark it's MEM_EXPR as addressable.
        (sparc_emit_float_lib_cmp): Likewise.

diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c
index b987648..7434c0f 100644
--- a/gcc/config/sparc/sparc.c
+++ b/gcc/config/sparc/sparc.c
@@ -2698,7 +2698,12 @@ emit_soft_tfmode_libcall (const char *func_name, int 
nargs, rtx *operands)
 
          if (GET_CODE (this_arg) == MEM
              && ! force_stack_temp)
-           this_arg = XEXP (this_arg, 0);
+           {
+             tree expr = MEM_EXPR (this_arg);
+             if (expr)
+               mark_addressable (expr);
+             this_arg = XEXP (this_arg, 0);
+           }
          else if (CONSTANT_P (this_arg)
                   && ! force_stack_temp)
            {
@@ -7387,7 +7392,12 @@ sparc_emit_float_lib_cmp (rtx x, rtx y, enum rtx_code 
comparison)
   if (TARGET_ARCH64)
     {
       if (MEM_P (x))
-       slot0 = x;
+       {
+         tree expr = MEM_EXPR (x);
+         if (expr)
+           mark_addressable (expr);
+         slot0 = x;
+       }
       else
        {
          slot0 = assign_stack_temp (TFmode, GET_MODE_SIZE(TFmode), 0);
@@ -7395,7 +7405,12 @@ sparc_emit_float_lib_cmp (rtx x, rtx y, enum rtx_code 
comparison)
        }
 
       if (MEM_P (y))
-       slot1 = y;
+       {
+         tree expr = MEM_EXPR (y);
+         if (expr)
+           mark_addressable (expr);
+         slot1 = y;
+       }
       else
        {
          slot1 = assign_stack_temp (TFmode, GET_MODE_SIZE(TFmode), 0);

Reply via email to