Now that it's easy, avoid the "no_output" parameter
to alpha_emit_set_const.
---
        * config/alpha/alpha.c (alpha_cost_set_const): New.
        (alpha_legitimate_constant_p): Use it
        (alpha_emit_set_const): Remove no_output param.
        (alpha_split_const_mov): Update call.
        (alpha_expand_epilogue): Likewise.
---
 gcc/config/alpha/alpha.c | 26 +++++++++++++++++---------
 1 file changed, 17 insertions(+), 9 deletions(-)

diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c
index 6933601..cc25250 100644
--- a/gcc/config/alpha/alpha.c
+++ b/gcc/config/alpha/alpha.c
@@ -1998,6 +1998,18 @@ genimm_alpha::generate (rtx dest, machine_mode mode) 
const
 
 } // anon namespace
 
+/* Return the cost of outputting the constant C in MODE.  */
+
+static int
+alpha_cost_set_const (machine_mode mode, HOST_WIDE_INT c)
+{
+  if (mode == V8QImode || mode == V4HImode || mode == V2SImode)
+    mode = DImode;
+
+  genimm_alpha data = genimm_hash<genimm_alpha>::hash (c, mode);
+  return data.cost;
+}
+
 /* Try to output insns to set TARGET equal to the constant C if it can be
    done in less than N insns.  Do all computations in MODE.  Returns the place
    where the output has been placed if it can be done and the insns have been
@@ -2006,7 +2018,7 @@ genimm_alpha::generate (rtx dest, machine_mode mode) const
 
 static rtx
 alpha_emit_set_const (rtx target, machine_mode origmode,
-                     HOST_WIDE_INT c, int n, bool no_output)
+                     HOST_WIDE_INT c, int n)
 {
   machine_mode mode = origmode;
   if (mode == V8QImode || mode == V4HImode || mode == V2SImode)
@@ -2016,10 +2028,6 @@ alpha_emit_set_const (rtx target, machine_mode origmode,
   if (data.cost > n)
     return NULL;
 
-  /* If we're not emitting output, we only need return a nonnull value.  */
-  if (no_output)
-    return pc_rtx;
-
   if (origmode == mode)
     data.generate (target, mode);
   else
@@ -2132,7 +2140,7 @@ alpha_legitimate_constant_p (machine_mode mode, rtx x)
       mode = DImode;
       gcc_assert (CONST_WIDE_INT_NUNITS (x) == 2);
       i0 = CONST_WIDE_INT_ELT (x, 1);
-      if (alpha_emit_set_const (NULL_RTX, mode, i0, 3, true) == NULL)
+      if (alpha_cost_set_const (mode, i0) > 3)
        return false;
       i0 = CONST_WIDE_INT_ELT (x, 0);
       goto do_integer;
@@ -2156,7 +2164,7 @@ alpha_legitimate_constant_p (machine_mode mode, rtx x)
        return true;
       i0 = alpha_extract_integer (x);
     do_integer:
-      return alpha_emit_set_const (NULL_RTX, mode, i0, 3, true) != NULL;
+      return alpha_cost_set_const (mode, i0) <= 3;
 
     default:
       return false;
@@ -2174,7 +2182,7 @@ alpha_split_const_mov (machine_mode mode, rtx *operands)
 
   i0 = alpha_extract_integer (operands[1]);
 
-  temp = alpha_emit_set_const (operands[0], mode, i0, 3, false);
+  temp = alpha_emit_set_const (operands[0], mode, i0, 3);
 
   if (!temp && TARGET_BUILD_CONSTANTS)
     temp = alpha_emit_set_long_const (operands[0], i0);
@@ -8212,7 +8220,7 @@ alpha_expand_epilogue (void)
       else
        {
          rtx tmp = gen_rtx_REG (DImode, 23);
-         sp_adj2 = alpha_emit_set_const (tmp, DImode, frame_size, 3, false);
+         sp_adj2 = alpha_emit_set_const (tmp, DImode, frame_size, 3);
          if (!sp_adj2)
            {
              /* We can't drop new things to memory this late, afaik,
-- 
2.4.3

Reply via email to