OSDN Git Service

* doc/tm.texi (defmac SMALL_REGISTER_CLASSES): Remove.
[pf3gnuchains/gcc-fork.git] / gcc / config / sh / sh.c
index 04b98c1..c3293fe 100644 (file)
@@ -865,7 +865,7 @@ sh_override_options (void)
       || (TARGET_SHMEDIA && !TARGET_PT_FIXED))
     flag_no_function_cse = 1;
 
-  if (SMALL_REGISTER_CLASSES)
+  if (targetm.small_register_classes_for_mode_p (VOIDmode))            \
     {
       /* Never run scheduling before reload, since that can
         break global alloc, and generates slower code anyway due
@@ -4410,6 +4410,7 @@ find_barrier (int num_mova, rtx mova, rtx from)
   int hi_limit;
   rtx orig = from;
   rtx last_got = NULL_RTX;
+  rtx last_symoff = NULL_RTX;
 
   /* For HImode: range is 510, add 4 because pc counts from address of
      second instruction after this one, subtract 2 for the jump instruction
@@ -4551,6 +4552,16 @@ find_barrier (int num_mova, rtx mova, rtx from)
        {
          switch (untangle_mova (&num_mova, &mova, from))
            {
+             case 1:
+               if (flag_pic)
+                 {
+                   rtx src = SET_SRC (PATTERN (from));
+                   if (GET_CODE (src) == CONST
+                       && GET_CODE (XEXP (src, 0)) == UNSPEC
+                       && XINT (XEXP (src, 0), 1) == UNSPEC_SYMOFF)
+                     last_symoff = from;
+                 }
+               break;
              case 0:   return find_barrier (0, 0, mova);
              case 2:
                {
@@ -4654,6 +4665,12 @@ find_barrier (int num_mova, rtx mova, rtx from)
         so we'll make one.  */
       rtx label = gen_label_rtx ();
 
+      /* Don't emit a constant table in the middle of insns for
+        casesi_worker_2.  This is a bit overkill but is enough
+        because casesi_worker_2 wouldn't appear so frequently.  */
+      if (last_symoff)
+       from = last_symoff;
+
       /* If we exceeded the range, then we must back up over the last
         instruction we looked at.  Otherwise, we just need to undo the
         NEXT_INSN at the end of the loop.  */
@@ -9294,7 +9311,7 @@ get_free_reg (HARD_REG_SET regs_live)
   if (! TEST_HARD_REG_BIT (regs_live, 1))
     return gen_rtx_REG (Pmode, 1);
 
-  /* Hard reg 1 is live; since this is a SMALL_REGISTER_CLASSES target,
+  /* Hard reg 1 is live; since this is a small register classes target,
      there shouldn't be anything but a jump before the function end.  */
   gcc_assert (!TEST_HARD_REG_BIT (regs_live, 7));
   return gen_rtx_REG (Pmode, 7);
@@ -11235,6 +11252,14 @@ sh_cannot_change_mode_class (enum machine_mode from, enum machine_mode to,
   return 0;
 }
 
+/* Return true if registers in machine mode MODE will likely be
+   allocated to registers in small register classes.  */
+
+static bool
+sh_small_register_classes_for_mode_p (enum machine_mode mode ATTRIBUTE_UNUSED)
+{
+  return (! TARGET_SHMEDIA);
+}
 
 /* If ADDRESS refers to a CODE_LABEL, add NUSES to the number of times
    that label is used.  */