Accept an absolute expression for index scale factor.
authorAlan Modra <amodra@gmail.com>
Sun, 25 Mar 2001 05:57:09 +0000 (05:57 +0000)
committerAlan Modra <amodra@gmail.com>
Sun, 25 Mar 2001 05:57:09 +0000 (05:57 +0000)
gas/ChangeLog
gas/config/tc-i386.c

index 76a8c20894277e65e0eaaadc9772bb0d4875fe4d..09a99fbc1d8bdbb141dd56a69b1a56e852e1b11d 100644 (file)
@@ -1,3 +1,9 @@
+2001-03-25  Alan Modra  <alan@linuxcare.com.au>
+
+       * config/tc-i386.c (i386_scale): Accept an absolute expression for
+       scale factor, and return the end of the expression.
+       (i386_operand): Modify for above.
+
 2001-03-23  Nick Clifton  <nickc@redhat.com>
 
        * doc/as.texinfo: Document --listing-XXX command line switches.
index 585aa8d97ef8dba012599d5eb48e5ddb53e7902f..843db1fdb5f2c738574f2a703d7570d31acb3bdd 100644 (file)
@@ -3344,35 +3344,38 @@ i386_immediate (imm_start)
   return 1;
 }
 
-static int i386_scale PARAMS ((char *));
+static char *i386_scale PARAMS ((char *));
 
-static int
+static char *
 i386_scale (scale)
      char *scale;
 {
-  if (!isdigit (*scale))
-    goto bad_scale;
+  offsetT val;
+  char *save = input_line_pointer;
 
-  switch (*scale)
+  input_line_pointer = scale;
+  val = get_absolute_expression ();
+
+  switch (val)
     {
-    case '0':
-    case '1':
+    case 0:
+    case 1:
       i.log2_scale_factor = 0;
       break;
-    case '2':
+    case 2:
       i.log2_scale_factor = 1;
       break;
-    case '4':
+    case 4:
       i.log2_scale_factor = 2;
       break;
-    case '8':
+    case 8:
       i.log2_scale_factor = 3;
       break;
     default:
-    bad_scale:
       as_bad (_("expecting scale factor of 1, 2, 4, or 8: got `%s'"),
              scale);
-      return 0;
+      input_line_pointer = save;
+      return NULL;
     }
   if (i.log2_scale_factor != 0 && ! i.index_reg)
     {
@@ -3382,7 +3385,9 @@ i386_scale (scale)
       i.log2_scale_factor = 0;
 #endif
     }
-  return 1;
+  scale = input_line_pointer;
+  input_line_pointer = save;
+  return scale;
 }
 
 static int i386_displacement PARAMS ((char *, char *));
@@ -3830,12 +3835,14 @@ i386_operand (operand_string)
                    }
 
                  /* Check for scale factor.  */
-                 if (isdigit ((unsigned char) *base_string))
+                 if (*base_string != ')')
                    {
-                     if (!i386_scale (base_string))
+                     char *end_scale = i386_scale (base_string);
+
+                     if (!end_scale)
                        return 0;
 
-                     ++base_string;
+                     base_string = end_scale;
                      if (is_space_char (*base_string))
                        ++base_string;
                      if (*base_string != ')')
This page took 0.036195 seconds and 4 git commands to generate.