gas/
[deliverable/binutils-gdb.git] / gas / config / tc-spu.c
index 995a023df9ffdc427a34f0164edb09e78f5f8af7..c5a44cedb9cdf9021ac7e90a84e33c5d7cf7b447 100644 (file)
@@ -6,7 +6,7 @@
 
    GAS is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2, or (at your option)
+   the Free Software Foundation; either version 3, or (at your option)
    any later version.
 
    GAS is distributed in the hope that it will be useful,
@@ -44,7 +44,7 @@ struct spu_insn
   unsigned int opcode;
   expressionS exp[MAX_RELOCS];
   int reloc_arg[MAX_RELOCS];
-  int flag[MAX_RELOCS];
+  bfd_reloc_code_real_type reloc[MAX_RELOCS];
   enum spu_insns tag;
 };
 
@@ -91,7 +91,7 @@ const pseudo_typeS md_pseudo_table[] =
   {"int", spu_cons, 4},
   {"long", spu_cons, 4},
   {"quad", spu_cons, 8},
-  {"string", stringer, 1},
+  {"string", stringer, 8 + 1},
   {"word", spu_cons, 4},
   /* Force set to be treated as an instruction.  */
   {"set", NULL, 0},
@@ -303,7 +303,7 @@ md_assemble (char *op)
          insn.exp[i].X_add_number = 0;
          insn.exp[i].X_op = O_illegal;
          insn.reloc_arg[i] = -1;
-         insn.flag[i] = 0;
+         insn.reloc[i] = BFD_RELOC_NONE;
        }
       insn.opcode = format->opcode;
       insn.tag = (enum spu_insns) (format - spu_opcodes);
@@ -352,17 +352,13 @@ md_assemble (char *op)
     if (insn.reloc_arg[i] >= 0) 
       {
         fixS *fixP;
-        bfd_reloc_code_real_type reloc = arg_encode[insn.reloc_arg[i]].reloc;
+        bfd_reloc_code_real_type reloc = insn.reloc[i];
        int pcrel = 0;
 
-        if (reloc == BFD_RELOC_SPU_PCREL9a
+       if (reloc == BFD_RELOC_SPU_PCREL9a
            || reloc == BFD_RELOC_SPU_PCREL9b
-            || reloc == BFD_RELOC_SPU_PCREL16)
+           || reloc == BFD_RELOC_SPU_PCREL16)
          pcrel = 1;
-       if (insn.flag[i] == 1)
-         reloc = BFD_RELOC_SPU_HI16;
-       else if (insn.flag[i] == 2)
-         reloc = BFD_RELOC_SPU_LO16;
        fixP = fix_new_exp (frag_now,
                            thisfrag - frag_now->fr_literal,
                            4,
@@ -394,7 +390,7 @@ calcop (struct spu_opcode *format, const char *param, struct spu_insn *insn)
       if (arg < A_P)
         param = get_reg (param, insn, arg, 1);
       else if (arg > A_P)
-        param = get_imm (param, insn,  arg);
+        param = get_imm (param, insn, arg);
       else if (arg == A_P)
        {
          paren++;
@@ -688,76 +684,25 @@ get_imm (const char *param, struct spu_insn *insn, int arg)
       insn->opcode |= (((val >> arg_encode[arg].rshift)
                        & ((1 << arg_encode[arg].size) - 1))
                       << arg_encode[arg].pos);
-      insn->reloc_arg[reloc_i] = -1;
-      insn->flag[reloc_i] = 0;
     }
   else
     {
       insn->reloc_arg[reloc_i] = arg;
       if (high)
-       insn->flag[reloc_i] = 1;
+       insn->reloc[reloc_i] = BFD_RELOC_SPU_HI16;
       else if (low)
-       insn->flag[reloc_i] = 2;
+       insn->reloc[reloc_i] = BFD_RELOC_SPU_LO16;
+      else
+       insn->reloc[reloc_i] = arg_encode[arg].reloc;
     }
 
   return param;
 }
 
-#define MAX_LITTLENUMS 6
-
-/* Turn a string in input_line_pointer into a floating point constant of type
-   type, and store the appropriate bytes in *litP.  The number of LITTLENUMS
-   emitted is stored in *sizeP .  An error message is returned, or NULL on OK.
- */
 char *
 md_atof (int type, char *litP, int *sizeP)
 {
-  int prec;
-  LITTLENUM_TYPE words[MAX_LITTLENUMS];
-  LITTLENUM_TYPE *wordP;
-  char *t;
-
-  switch (type)
-    {
-    case 'f':
-    case 'F':
-    case 's':
-    case 'S':
-      prec = 2;
-      break;
-
-    case 'd':
-    case 'D':
-    case 'r':
-    case 'R':
-      prec = 4;
-      break;
-
-    case 'x':
-    case 'X':
-      prec = 6;
-      break;
-
-    case 'p':
-    case 'P':
-      prec = 6;
-      break;
-
-    default:
-      *sizeP = 0;
-      return _("Bad call to MD_ATOF()");
-    }
-  t = atof_ieee (input_line_pointer, type, words);
-  if (t)
-    input_line_pointer = t;
-
-  *sizeP = prec * sizeof (LITTLENUM_TYPE);
-  for (wordP = words; prec--;)
-    {
-      md_number_to_chars (litP, (long) (*wordP++), sizeof (LITTLENUM_TYPE));
-      litP += sizeof (LITTLENUM_TYPE);
-    }
-  return 0;
+  return ieee_md_atof (type, litP, sizeP, TRUE);
 }
 
 #ifndef WORKING_DOT_WORD
@@ -820,8 +765,9 @@ spu_cons (int nbytes)
 
   do
     {
-      expression (&exp);
-      if (exp.X_op == O_symbol
+      deferred_expression (&exp);
+      if ((exp.X_op == O_symbol
+          || exp.X_op == O_constant)
          && strncasecmp (input_line_pointer, "@ppu", 4) == 0)
        {
          char *p = frag_more (nbytes);
@@ -873,6 +819,8 @@ tc_gen_reloc (asection *seg ATTRIBUTE_UNUSED, fixS *fixp)
     *reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
   else if (fixp->fx_subsy)
     *reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_subsy);
+  else
+    abort ();
   reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
   reloc->howto = bfd_reloc_type_lookup (stdoutput, fixp->fx_r_type);
   if (reloc->howto == (reloc_howto_type *) NULL)
@@ -987,6 +935,10 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg ATTRIBUTE_UNUSED)
 
   fixP->fx_addnumber = val;
 
+  if (fixP->fx_r_type == BFD_RELOC_SPU_PPU32
+      || fixP->fx_r_type == BFD_RELOC_SPU_PPU64)
+    return;
+
   if (fixP->fx_addsy == NULL && fixP->fx_pcrel == 0)
     {
       fixP->fx_done = 1;
This page took 0.029315 seconds and 4 git commands to generate.