More gcc lint with harsher warning options.
[deliverable/binutils-gdb.git] / gas / config / tc-a29k.c
index db330d2b1cdf6f87c6c2c5ebc8db549f9ee3312b..78e8d10e97252511fca7dc9c0c4e4e39f6dc4c40 100644 (file)
@@ -1,5 +1,5 @@
 /* tc-a29k.c -- Assemble for the AMD 29000.
-   Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
+   Copyright (C) 1989, 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
 
    This file is part of GAS, the GNU Assembler.
 
@@ -21,6 +21,7 @@
    to convert it to new machines' assemblers as desired.  There was too
    much bloody rewriting required before.  There still probably is.  */
 
+#include "ctype.h"
 #include "as.h"
 
 #include "opcode/a29k.h"
@@ -58,23 +59,10 @@ struct machine_it
 
 the_insn;
 
-#if __STDC__ == 1
-
-/* static int getExpression(char *str); */
-static void machine_ip (char *str);
-/* static void print_insn(struct machine_it *insn); */
-static void s_data1 (void);
-static void s_use (void);
-
-#else /* not __STDC__ */
-
-/* static int getExpression(); */
-static void machine_ip ();
-/* static void print_insn(); */
-static void s_data1 ();
-static void s_use ();
-
-#endif /* not __STDC__ */
+static void machine_ip PARAMS ((char *str));
+/* static void print_insn PARAMS ((struct machine_it *insn)); */
+static void s_data1 PARAMS ((void));
+static void s_use PARAMS ((void));
 
 const pseudo_typeS
   md_pseudo_table[] =
@@ -97,12 +85,12 @@ int md_short_jump_size = 4;
 int md_long_jump_size = 4;
 #if defined(BFD_HEADERS)
 #ifdef RELSZ
-int md_reloc_size = RELSZ;     /* Coff headers */
+const int md_reloc_size = RELSZ;       /* Coff headers */
 #else
-int md_reloc_size = 12;                /* something else headers */
+const int md_reloc_size = 12;          /* something else headers */
 #endif
 #else
-int md_reloc_size = 12;                /* Not bfdized*/
+const int md_reloc_size = 12;          /* Not bfdized*/
 #endif
 
 /* This array holds the chars that always start a comment.  If the
@@ -151,13 +139,13 @@ s_use ()
   if (strncmp (input_line_pointer, ".text", 5) == 0)
     {
       input_line_pointer += 5;
-      s_text ();
+      s_text (0);
       return;
     }
   if (strncmp (input_line_pointer, ".data", 5) == 0)
     {
       input_line_pointer += 5;
-      s_data ();
+      s_data (0);
       return;
     }
   if (strncmp (input_line_pointer, ".data1", 6) == 0)
@@ -237,6 +225,20 @@ define_some_regs ()
   insert_sreg ("mmu", SREG + 13);
   insert_sreg ("lru", SREG + 14);
 
+  /* Additional protected special-purpose registers for the 29050 */
+  insert_sreg ("rsn",  SREG + 15);
+  insert_sreg ("rma0", SREG + 16);
+  insert_sreg ("rmc0", SREG + 17);
+  insert_sreg ("rma1", SREG + 18);
+  insert_sreg ("rmc1", SREG + 19);
+  insert_sreg ("spc0", SREG + 20);
+  insert_sreg ("spc1", SREG + 21);
+  insert_sreg ("spc2", SREG + 22);
+  insert_sreg ("iba0", SREG + 23);
+  insert_sreg ("ibc0", SREG + 24);
+  insert_sreg ("iba1", SREG + 25);
+  insert_sreg ("ibc1", SREG + 26);
+
   /* Unprotected special-purpose register names */
   insert_sreg ("ipc", SREG + 128);
   insert_sreg ("ipa", SREG + 129);
@@ -267,8 +269,6 @@ md_begin ()
   /* Hash up all the opcodes for fast use later.  */
 
   op_hash = hash_new ();
-  if (op_hash == NULL)
-    as_fatal ("Virtual memory exhausted");
 
   for (i = 0; i < num_opcodes; i++)
     {
@@ -372,16 +372,12 @@ md_assemble (str)
   /* put out the symbol-dependent stuff */
   if (the_insn.reloc != NO_RELOC)
     {
-      fix_new (
-               frag_now,       /* which frag */
-               (toP - frag_now->fr_literal + the_insn.reloc_offset),   /* where */
-               4,              /* size */
-               the_insn.exp.X_add_symbol,
-               the_insn.exp.X_subtract_symbol,
-               the_insn.exp.X_add_number,
-               the_insn.pcrel,
-               the_insn.reloc
-       );
+      fix_new_exp (frag_now,
+                  (toP - frag_now->fr_literal + the_insn.reloc_offset),
+                  4,           /* size */
+                  &the_insn.exp,
+                  the_insn.pcrel,
+                  the_insn.reloc);
     }
 }
 
@@ -392,15 +388,13 @@ parse_operand (s, operandp)
 {
   char *save = input_line_pointer;
   char *new;
-  segT seg;
 
   input_line_pointer = s;
-  seg = expr (0, operandp);
+  expression (operandp);
+  if (operandp->X_op == O_absent)
+    as_bad ("missing operand");
   new = input_line_pointer;
   input_line_pointer = save;
-
-  if (seg == SEG_ABSENT)
-    as_bad ("Missing operand");
   return new;
 }
 
@@ -488,7 +482,7 @@ machine_ip (str)
          break;
 
        case 'v':               /* Trap numbers (immediate field) */
-         if (operand->X_seg == SEG_ABSOLUTE)
+         if (operand->X_op == O_constant)
            {
              if (operand->X_add_number < 256)
                {
@@ -511,11 +505,11 @@ machine_ip (str)
        case 'i':
          /* We treat the two cases identically since we mashed
                           them together in the opcode table.  */
-         if (operand->X_seg == SEG_REGISTER)
+         if (operand->X_op == O_register)
            goto general_reg;
 
          opcode |= IMMEDIATE_BIT;
-         if (operand->X_seg == SEG_ABSOLUTE)
+         if (operand->X_op == O_constant)
            {
              if (operand->X_add_number < 256)
                {
@@ -538,10 +532,10 @@ machine_ip (str)
        case 'c':
        general_reg:
          /* lrNNN or grNNN or %%expr or a user-def register name */
-         if (operand->X_seg != SEG_REGISTER)
+         if (operand->X_op != O_register)
            break;              /* Only registers */
          know (operand->X_add_symbol == 0);
-         know (operand->X_subtract_symbol == 0);
+         know (operand->X_op_symbol == 0);
          reg = operand->X_add_number;
          if (reg >= SREG)
            break;              /* No special registers */
@@ -570,7 +564,7 @@ machine_ip (str)
 
        case 'x':               /* 16 bit constant, zero-extended */
        case 'X':               /* 16 bit constant, one-extended */
-         if (operand->X_seg == SEG_ABSOLUTE)
+         if (operand->X_op == O_constant)
            {
              opcode |= (operand->X_add_number & 0xFF) << 0 |
                ((operand->X_add_number & 0xFF00) << 8);
@@ -581,7 +575,7 @@ machine_ip (str)
          continue;
 
        case 'h':
-         if (operand->X_seg == SEG_ABSOLUTE)
+         if (operand->X_op == O_constant)
            {
              opcode |= (operand->X_add_number & 0x00FF0000) >> 16 |
                (((unsigned long) operand->X_add_number
@@ -595,8 +589,8 @@ machine_ip (str)
        case 'P':               /* PC-relative jump address */
        case 'A':               /* Absolute jump address */
          /* These two are treated together since we folded the
-                          opcode table entries together.  */
-         if (operand->X_seg == SEG_ABSOLUTE)
+            opcode table entries together.  */
+         if (operand->X_op == O_constant)
            {
              opcode |= ABSOLUTE_BIT |
                (operand->X_add_number & 0x0003FC00) << 6 |
@@ -610,7 +604,7 @@ machine_ip (str)
          continue;
 
        case 'e':               /* Coprocessor enable bit for LOAD/STORE insn */
-         if (operand->X_seg == SEG_ABSOLUTE)
+         if (operand->X_op == O_constant)
            {
              if (operand->X_add_number == 0)
                continue;
@@ -623,7 +617,7 @@ machine_ip (str)
          break;
 
        case 'n':               /* Control bits for LOAD/STORE instructions */
-         if (operand->X_seg == SEG_ABSOLUTE &&
+         if (operand->X_op == O_constant &&
              operand->X_add_number < 128)
            {
              opcode |= (operand->X_add_number << 16);
@@ -632,7 +626,7 @@ machine_ip (str)
          break;
 
        case 's':               /* Special register number */
-         if (operand->X_seg != SEG_REGISTER)
+         if (operand->X_op != O_register)
            break;              /* Only registers */
          if (operand->X_add_number < SREG)
            break;              /* Not a special register */
@@ -640,7 +634,7 @@ machine_ip (str)
          continue;
 
        case 'u':               /* UI bit of CONVERT */
-         if (operand->X_seg == SEG_ABSOLUTE)
+         if (operand->X_op == O_constant)
            {
              if (operand->X_add_number == 0)
                continue;
@@ -653,7 +647,7 @@ machine_ip (str)
          break;
 
        case 'r':               /* RND bits of CONVERT */
-         if (operand->X_seg == SEG_ABSOLUTE &&
+         if (operand->X_op == O_constant &&
              operand->X_add_number < 8)
            {
              opcode |= operand->X_add_number << 4;
@@ -662,7 +656,7 @@ machine_ip (str)
          break;
 
        case 'd':               /* FD bits of CONVERT */
-         if (operand->X_seg == SEG_ABSOLUTE &&
+         if (operand->X_op == O_constant &&
              operand->X_add_number < 4)
            {
              opcode |= operand->X_add_number << 2;
@@ -672,7 +666,7 @@ machine_ip (str)
 
 
        case 'f':               /* FS bits of CONVERT */
-         if (operand->X_seg == SEG_ABSOLUTE &&
+         if (operand->X_op == O_constant &&
              operand->X_add_number < 4)
            {
              opcode |= operand->X_add_number << 0;
@@ -681,7 +675,7 @@ machine_ip (str)
          break;
 
        case 'C':
-         if (operand->X_seg == SEG_ABSOLUTE &&
+         if (operand->X_op == O_constant &&
              operand->X_add_number < 4)
            {
              opcode |= operand->X_add_number << 16;
@@ -690,7 +684,7 @@ machine_ip (str)
          break;
 
        case 'F':
-         if (operand->X_seg == SEG_ABSOLUTE &&
+         if (operand->X_op == O_constant &&
              operand->X_add_number < 16)
            {
              opcode |= operand->X_add_number << 18;
@@ -779,7 +773,7 @@ md_atof (type, litP, sizeP)
 void
 md_number_to_chars (buf, val, n)
      char *buf;
-     long val;
+     valueT val;
      int n;
 {
 
@@ -934,7 +928,7 @@ tc_coff_fix2rtype (fixP)
 void
 md_create_short_jump (ptr, from_addr, to_addr, frag, to_symbol)
      char *ptr;
-     long from_addr, to_addr;
+     addressT from_addr, to_addr;
      fragS *frag;
      symbolS *to_symbol;
 {
@@ -954,8 +948,8 @@ md_convert_frag (headers, fragP)
 void
 md_create_long_jump (ptr, from_addr, to_addr, frag, to_symbol)
      char *ptr;
-     long from_addr;
-     long to_addr;
+     addressT from_addr;
+     addressT to_addr;
      fragS *frag;
      symbolS *to_symbol;
 {
@@ -1018,10 +1012,10 @@ print_insn (insn)
           insn->exp.X_add_symbol ?
           (S_GET_NAME (insn->exp.X_add_symbol) ?
            S_GET_NAME (insn->exp.X_add_symbol) : "???") : "0");
-  fprintf (stderr, "\t\tX_sub_symbol = %s\n",
-          insn->exp.X_subtract_symbol ?
-          (S_GET_NAME (insn->exp.X_subtract_symbol) ?
-           S_GET_NAME (insn->exp.X_subtract_symbol) : "???") : "0");
+  fprintf (stderr, "\t\tX_op_symbol = %s\n",
+          insn->exp.X_op_symbol ?
+          (S_GET_NAME (insn->exp.X_op_symbol) ?
+           S_GET_NAME (insn->exp.X_op_symbol) : "???") : "0");
   fprintf (stderr, "\t\tX_add_number = %d\n",
           insn->exp.X_add_number);
   fprintf (stderr, "}\n");
@@ -1128,30 +1122,30 @@ md_operand (expressionP)
       /* We have a numeric register expression.  No biggy.  */
       input_line_pointer += 2; /* Skip %% */
       (void) expression (expressionP);
-      if (expressionP->X_seg != SEG_ABSOLUTE
+      if (expressionP->X_op != O_constant
          || expressionP->X_add_number > 255)
        as_bad ("Invalid expression after %%%%\n");
-      expressionP->X_seg = SEG_REGISTER;
+      expressionP->X_op = O_register;
     }
   else if (input_line_pointer[0] == '&')
     {
       /* We are taking the 'address' of a register...this one is not
-                      in the manual, but it *is* in traps/fpsymbol.h!  What they
-                      seem to want is the register number, as an absolute number.  */
+        in the manual, but it *is* in traps/fpsymbol.h!  What they
+        seem to want is the register number, as an absolute number.  */
       input_line_pointer++;    /* Skip & */
       (void) expression (expressionP);
-      if (expressionP->X_seg != SEG_REGISTER)
+      if (expressionP->X_op != O_register)
        as_bad ("Invalid register in & expression");
       else
-       expressionP->X_seg = SEG_ABSOLUTE;
+       expressionP->X_op = O_constant;
     }
 }
 
 /* Round up a section size to the appropriate boundary.  */
-long
+valueT
 md_section_align (segment, size)
      segT segment;
-     long size;
+     valueT size;
 {
   return size;                 /* Byte alignment is fine */
 }
This page took 0.028952 seconds and 4 git commands to generate.