2007-03-06 Andreas Krebbel <krebbel1@de.ibm.com>
[deliverable/binutils-gdb.git] / gas / config / tc-s390.c
index 13ced8b6e30ff88dbf918ac774ee1753e3cebc27..6ca31f7b43b42ddd68d7a448a253521fb9aa69ab 100644 (file)
@@ -1,5 +1,5 @@
 /* tc-s390.c -- Assemble for the S390
-   Copyright 2000, 2001, 2002, 2003, 2004, 2005
+   Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006
    Free Software Foundation, Inc.
    Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
 
 
    You should have received a copy of the GNU General Public License
    along with GAS; see the file COPYING.  If not, write to the Free
-   Software Foundation, 59 Temple Place - Suite 330, Boston, MA
-   02111-1307, USA.  */
+   Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
+   02110-1301, USA.  */
 
-#include <stdio.h>
 #include "as.h"
 #include "safe-ctype.h"
 #include "subsegs.h"
@@ -410,6 +409,10 @@ md_parse_option (c, arg)
            current_cpu = S390_OPCODE_Z900;
          else if (strcmp (arg + 5, "z990") == 0)
            current_cpu = S390_OPCODE_Z990;
+         else if (strcmp (arg + 5, "z9-109") == 0)
+           current_cpu = S390_OPCODE_Z9_109;
+         else if (strcmp (arg + 5, "z9-ec") == 0)
+           current_cpu = S390_OPCODE_Z9_EC;
          else
            {
              as_bad (_("invalid switch -m%s"), arg);
@@ -1353,8 +1356,19 @@ md_gather_operands (str, insn, opcode)
              /* If there is a next operand it must be separated by a comma.  */
              if (opindex_ptr[1] != '\0')
                {
-                 if (*str++ != ',')
-                   as_bad (_("syntax error; expected ,"));
+                 if (*str != ',')
+                   {
+                     while (opindex_ptr[1] != '\0')
+                       {
+                         operand = s390_operands + *(++opindex_ptr);
+                         if (operand->flags & S390_OPERAND_OPTIONAL)
+                           continue;
+                         as_bad (_("syntax error; expected ,"));
+                         break;
+                       }
+                   }
+                 else
+                   str++;
                }
            }
          else
@@ -1386,8 +1400,19 @@ md_gather_operands (str, insn, opcode)
          /* If there is a next operand it must be separated by a comma.  */
          if (opindex_ptr[1] != '\0')
            {
-             if (*str++ != ',')
-               as_bad (_("syntax error; expected ,"));
+             if (*str != ',')
+               {
+                 while (opindex_ptr[1] != '\0')
+                   {
+                     operand = s390_operands + *(++opindex_ptr);
+                     if (operand->flags & S390_OPERAND_OPTIONAL)
+                       continue;
+                     as_bad (_("syntax error; expected ,"));
+                     break;
+                   }
+               }
+             else
+               str++;
            }
        }
       else
@@ -1405,8 +1430,19 @@ md_gather_operands (str, insn, opcode)
          /* If there is a next operand it must be separated by a comma.  */
          if (opindex_ptr[1] != '\0')
            {
-             if (*str++ != ',')
-               as_bad (_("syntax error; expected ,"));
+             if (*str != ',')
+               {
+                 while (opindex_ptr[1] != '\0')
+                   {
+                     operand = s390_operands + *(++opindex_ptr);
+                     if (operand->flags & S390_OPERAND_OPTIONAL)
+                       continue;
+                     as_bad (_("syntax error; expected ,"));
+                     break;
+                   }
+               }
+             else
+               str++;
            }
        }
     }
@@ -1449,7 +1485,7 @@ md_gather_operands (str, insn, opcode)
      BFD_RELOC_UNUSED plus the operand index.  This lets us easily
      handle fixups for any operand type, although that is admittedly
      not a very exciting feature.  We pick a BFD reloc type in
-     md_apply_fix3.  */
+     md_apply_fix.  */
   for (i = 0; i < fc; i++)
     {
 
@@ -1602,7 +1638,7 @@ s390_insn (ignore)
              && (addressT) exp.X_add_number < (1ULL << 32))
          || (   opformat->oplen == 2
              && (addressT) exp.X_add_number < (1ULL << 16)))
-       md_number_to_chars (insn, exp.X_add_number, opformat->oplen);
+       md_number_to_chars ((char *) insn, exp.X_add_number, opformat->oplen);
       else
        as_bad (_("Invalid .insn format\n"));
     }
@@ -1612,9 +1648,9 @@ s390_insn (ignore)
          && opformat->oplen == 6
          && generic_bignum[3] == 0)
        {
-         md_number_to_chars (insn, generic_bignum[2], 2);
-         md_number_to_chars (&insn[2], generic_bignum[1], 2);
-         md_number_to_chars (&insn[4], generic_bignum[0], 2);
+         md_number_to_chars ((char *) insn, generic_bignum[2], 2);
+         md_number_to_chars ((char *) &insn[2], generic_bignum[1], 2);
+         md_number_to_chars ((char *) &insn[4], generic_bignum[0], 2);
        }
       else
        as_bad (_("Invalid .insn format\n"));
@@ -1957,7 +1993,7 @@ tc_s390_force_relocation (fixp)
    fixup.  */
 
 void
-md_apply_fix3 (fixP, valP, seg)
+md_apply_fix (fixP, valP, seg)
      fixS *fixP;
      valueT *valP;
      segT seg ATTRIBUTE_UNUSED;
@@ -1992,8 +2028,8 @@ md_apply_fix3 (fixP, valP, seg)
       if (fixP->fx_done)
        {
          /* Insert the fully resolved operand value.  */
-         s390_insert_operand (where, operand, (offsetT) value,
-                              fixP->fx_file, fixP->fx_line);
+         s390_insert_operand ((unsigned char *) where, operand,
+                              (offsetT) value, fixP->fx_file, fixP->fx_line);
          return;
        }
 
@@ -2287,7 +2323,7 @@ s390_cfi_frame_initial_instructions ()
 }
 
 int
-tc_s390_regname_to_dw2regnum (const char *regname)
+tc_s390_regname_to_dw2regnum (char *regname)
 {
   int regnum = -1;
 
This page took 0.027945 seconds and 4 git commands to generate.