]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR target/45820 (FAIL: gcc.c-torture/compile/pr45728.c at -O1 and above)
authorJohn David Anglin <dave.anglin@nrc-cnrc.gc.ca>
Sat, 9 Oct 2010 14:26:07 +0000 (14:26 +0000)
committerJohn David Anglin <danglin@gcc.gnu.org>
Sat, 9 Oct 2010 14:26:07 +0000 (14:26 +0000)
PR target/45820
* config/pa/pa.c (pa_secondary_reload): Handle symbolic operands
earlier.

From-SVN: r165231

gcc/ChangeLog
gcc/config/pa/pa.c

index 01389454afa12edca9362091556ce9c8cddb66a7..d027c552aa6094d44584b93b025db88d89e921fa 100644 (file)
@@ -1,3 +1,9 @@
+2010-10-09  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
+
+       PR target/45820
+       * config/pa/pa.c (pa_secondary_reload): Handle symbolic operands
+       earlier.
+
 2010-09-18  Richard Guenther  <rguenther@suse.de>
 
        PR tree-optimization/45709
index bad5e9c531641decba94675aff3fab283d1d0a2c..af09dcbf7a3912a9d1b08301b3b050b7f0e3ac8c 100644 (file)
@@ -5698,7 +5698,7 @@ static enum reg_class
 pa_secondary_reload (bool in_p, rtx x, enum reg_class class,
                     enum machine_mode mode, secondary_reload_info *sri)
 {
-  int is_symbolic, regno;
+  int regno;
 
   /* Handle the easy stuff first.  */
   if (class == R1_REGS)
@@ -5731,6 +5731,23 @@ pa_secondary_reload (bool in_p, rtx x, enum reg_class class,
       return NO_REGS;
     }
 
+  /* Secondary reloads of symbolic operands require %r1 as a scratch
+     register when we're generating PIC code and when the operand isn't
+     readonly.  */
+  if (symbolic_expression_p (x))
+    {
+      if (GET_CODE (x) == HIGH)
+       x = XEXP (x, 0);
+
+      if (flag_pic || !read_only_operand (x, VOIDmode))
+       {
+         gcc_assert (mode == SImode || mode == DImode);
+         sri->icode = (mode == SImode ? CODE_FOR_reload_insi_r1
+                       : CODE_FOR_reload_indi_r1);
+         return NO_REGS;
+       }
+    }
+
   /* Profiling showed the PA port spends about 1.3% of its compilation
      time in true_regnum from calls inside pa_secondary_reload_class.  */
   if (regno >= FIRST_PSEUDO_REGISTER || GET_CODE (x) == SUBREG)
@@ -5789,48 +5806,7 @@ pa_secondary_reload (bool in_p, rtx x, enum reg_class class,
   if (regno >= 0 && regno < FIRST_PSEUDO_REGISTER
       && (REGNO_REG_CLASS (regno) == SHIFT_REGS
       && FP_REG_CLASS_P (class)))
-    {
-      sri->icode = in_p ? reload_in_optab[mode] : reload_out_optab[mode];
-      return NO_REGS;
-    }
-
-  /* Secondary reloads of symbolic operands require %r1 as a scratch
-     register when we're generating PIC code and when the operand isn't
-     readonly.  */
-  if (GET_CODE (x) == HIGH)
-    x = XEXP (x, 0);
-
-  /* Profiling has showed GCC spends about 2.6% of its compilation
-     time in symbolic_operand from calls inside pa_secondary_reload_class.
-     So, we use an inline copy to avoid useless work.  */
-  switch (GET_CODE (x))
-    {
-      rtx op;
-
-      case SYMBOL_REF:
-        is_symbolic = !SYMBOL_REF_TLS_MODEL (x);
-        break;
-      case LABEL_REF:
-        is_symbolic = 1;
-        break;
-      case CONST:
-       op = XEXP (x, 0);
-       is_symbolic = (((GET_CODE (XEXP (op, 0)) == SYMBOL_REF
-                        && !SYMBOL_REF_TLS_MODEL (XEXP (op, 0)))
-                       || GET_CODE (XEXP (op, 0)) == LABEL_REF)
-                      && GET_CODE (XEXP (op, 1)) == CONST_INT);
-        break;
-      default:
-        is_symbolic = 0;
-        break;
-    }
-
-  if (is_symbolic && (flag_pic || !read_only_operand (x, VOIDmode)))
-    {
-      gcc_assert (mode == SImode || mode == DImode);
-      sri->icode = (mode == SImode ? CODE_FOR_reload_insi_r1
-                   : CODE_FOR_reload_indi_r1);
-    }
+    sri->icode = in_p ? reload_in_optab[mode] : reload_out_optab[mode];
 
   return NO_REGS;
 }