More fallout from 2001-03-30 changes.
authorAlan Modra <amodra@gmail.com>
Tue, 8 May 2001 13:13:56 +0000 (13:13 +0000)
committerAlan Modra <amodra@gmail.com>
Tue, 8 May 2001 13:13:56 +0000 (13:13 +0000)
* config/tc-m68k.c (md_estimate_size_before_relax): Set fr_var
from md_relax_table, and combine some switch cases.

gas/ChangeLog
gas/config/tc-m68k.c

index a5b3c3d66597f0d2d064a018ce81af25be7c45b5..d2c44413d343da996b4c8f3b6a9a0d26e5408496 100644 (file)
@@ -1,3 +1,8 @@
+2001-05-08  Alan Modra  <amodra@one.net.au>
+
+       * config/tc-m68k.c (md_estimate_size_before_relax): Set fr_var
+       from md_relax_table, and combine some switch cases.
+
 2001-05-06  Alexandre Oliva  <aoliva@redhat.com>
 
        * config/tc-mn10300.c (md_assemble): Subtract operand->shift
index 6fa019cc278f5f98bfa2b1a029e9bddf37469a33..a755285ec4bb059f4fb88cd4b93e99a0c6b8d62c 100644 (file)
@@ -4587,27 +4587,6 @@ md_estimate_size_before_relax (fragP, segment)
     {
     case TAB (BRANCHBWL, SZ_UNDEF):
     case TAB (BRABSJUNC, SZ_UNDEF):
-      {
-       if (S_GET_SEGMENT (fragP->fr_symbol) == segment
-           && relaxable_symbol (fragP->fr_symbol))
-         {
-           fragP->fr_subtype = TAB (TABTYPE (fragP->fr_subtype), BYTE);
-         }
-       else if (flag_short_refs)
-         {
-           /* Symbol is undefined and we want short ref.  */
-           fragP->fr_subtype = TAB (TABTYPE (fragP->fr_subtype), SHORT);
-           fragP->fr_var += 2;
-         }
-       else
-         {
-           /* Symbol is still undefined.  Make it LONG.  */
-           fragP->fr_subtype = TAB (TABTYPE (fragP->fr_subtype), LONG);
-           fragP->fr_var += 4;
-         }
-       break;
-      }
-
     case TAB (BRABSJCOND, SZ_UNDEF):
       {
        if (S_GET_SEGMENT (fragP->fr_symbol) == segment
@@ -4619,13 +4598,11 @@ md_estimate_size_before_relax (fragP, segment)
          {
            /* Symbol is undefined and we want short ref.  */
            fragP->fr_subtype = TAB (TABTYPE (fragP->fr_subtype), SHORT);
-           fragP->fr_var += 2;
          }
        else
          {
            /* Symbol is still undefined.  Make it LONG.  */
            fragP->fr_subtype = TAB (TABTYPE (fragP->fr_subtype), LONG);
-           fragP->fr_var += 6;
          }
        break;
       }
@@ -4641,59 +4618,24 @@ md_estimate_size_before_relax (fragP, segment)
          {
            /* Symbol is undefined and we don't have long branches.  */
            fragP->fr_subtype = TAB (TABTYPE (fragP->fr_subtype), SHORT);
-           fragP->fr_var += 2;
          }
        break;
       }
 
     case TAB (FBRANCH, SZ_UNDEF):
-      {
-       if ((S_GET_SEGMENT (fragP->fr_symbol) == segment
-            && relaxable_symbol (fragP->fr_symbol))
-           || flag_short_refs)
-         {
-           fragP->fr_subtype = TAB (FBRANCH, SHORT);
-           fragP->fr_var += 2;
-         }
-       else
-         {
-           fragP->fr_subtype = TAB (FBRANCH, LONG);
-           fragP->fr_var += 4;
-         }
-       break;
-      }
-
     case TAB (DBCCLBR, SZ_UNDEF):
     case TAB (DBCCABSJ, SZ_UNDEF):
+    case TAB (PCREL1632, SZ_UNDEF):
       {
        if ((S_GET_SEGMENT (fragP->fr_symbol) == segment
             && relaxable_symbol (fragP->fr_symbol))
            || flag_short_refs)
          {
            fragP->fr_subtype = TAB (TABTYPE (fragP->fr_subtype), SHORT);
-           fragP->fr_var += 2;
          }
        else
          {
            fragP->fr_subtype = TAB (TABTYPE (fragP->fr_subtype), LONG);
-           fragP->fr_var += 10;
-         }
-       break;
-      }
-
-    case TAB (PCREL1632, SZ_UNDEF):
-      {
-       if (((S_GET_SEGMENT (fragP->fr_symbol)) == segment
-            && relaxable_symbol (fragP->fr_symbol))
-           || flag_short_refs)
-         {
-           fragP->fr_subtype = TAB (PCREL1632, SHORT);
-           fragP->fr_var += 2;
-         }
-       else
-         {
-           fragP->fr_subtype = TAB (PCREL1632, LONG);
-           fragP->fr_var += 6;
          }
        break;
       }
@@ -4707,7 +4649,6 @@ md_estimate_size_before_relax (fragP, segment)
       else
        {
          fragP->fr_subtype = TAB (PCINDEX, LONG);
-         fragP->fr_var += 4;
        }
       break;
 
@@ -4717,12 +4658,10 @@ md_estimate_size_before_relax (fragP, segment)
             && relaxable_symbol (fragP->fr_symbol)))
          {
            fragP->fr_subtype = TAB (ABSTOPCREL, SHORT);
-           fragP->fr_var += 2;
          }
        else
          {
            fragP->fr_subtype = TAB (ABSTOPCREL, LONG);
-           fragP->fr_var += 4;
          }
        break;
       }
@@ -4757,13 +4696,13 @@ md_estimate_size_before_relax (fragP, segment)
          if (l == stop)
            {
              fragP->fr_subtype = TAB (TABTYPE (fragP->fr_subtype), SHORT);
-             fragP->fr_var += 2;
            }
        }
       break;
     default:
       break;
     }
+  fragP->fr_var = md_relax_table[fragP->fr_subtype].rlx_length;
   return fragP->fr_var + fragP->fr_fix - old_fix;
 }