* config/tc-ia64.c (ia64_convert_frag): Zero-initialize room for
[deliverable/binutils-gdb.git] / gas / config / tc-maxq.c
index dda7ca417c7c889b16f4a6b5c65924917e11be8f..58c5c300a3a7c40ed286cfd4b5e9a2dab701f260 100644 (file)
@@ -1,6 +1,6 @@
 /* tc-maxq.c -- assembler code for a MAXQ chip.
 
-   Copyright 2004, 2005 Free Software Foundation, Inc.
+   Copyright 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
 
    Contributed by HCL Technologies Pvt. Ltd.
 
@@ -11,7 +11,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) any later version.
+   Foundation; either version 3, or (at your option) any later version.
 
    GAS is distributed in the hope that it will be useful, but WITHOUT ANY
    WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
@@ -20,7 +20,7 @@
 
    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.  */
+   Foundation, 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
 
 #include "as.h"
 #include "safe-ctype.h"
 #define MAXQ10S 1
 #endif
 
-#ifndef _STRING_H
-#include "string.h"
-#endif
-
 #ifndef DEFAULT_ARCH
 #define DEFAULT_ARCH "MAXQ20"
 #endif
@@ -90,7 +86,6 @@ union _maxq20_op
 typedef union _maxq20_op maxq20_opcode;
 
 /* For handling optional L/S in Maxq20.  */
-#ifdef BFD_ASSEMBLER
 
 /* Exposed For Linker - maps indirectly to the liker relocations.  */
 #define LONG_PREFIX            MAXQ_LONGJUMP   /* BFD_RELOC_16 */
@@ -100,16 +95,6 @@ typedef union _maxq20_op maxq20_opcode;
 #define NO_PREFIX              0
 #define EXPLICT_LONG_PREFIX     14
 
-#else
-
-#define EXPLICT_LONG_PREFIX 14
-#define LONG_PREFIX  5
-#define SHORT_PREFIX 1
-#define ABSOLUTE_ADDR_FOR_DATA 0
-#define NO_PREFIX    0
-
-#endif
-
 /* The main instruction structure containing fields to describe instrn */
 typedef struct _maxq20_insn
 {
@@ -229,7 +214,6 @@ md_show_usage (FILE * stream)
        "));
 }
 
-#ifdef BFD_ASSEMBLER
 unsigned long
 maxq20_mach (void)
 {
@@ -298,8 +282,6 @@ tc_gen_reloc (asection *section ATTRIBUTE_UNUSED, fixS *fixp)
   return rel;
 }
 
-#endif
-
 /* md_estimate_size_before_relax()
 
    Called just before relax() for rs_machine_dependent frags.  The MAXQ
@@ -397,51 +379,13 @@ md_estimate_size_before_relax (fragS *fragP, segT segment)
   return 0;
 }
 
-/* Equal to MAX_PRECISION in atof-ieee.c */
-#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[4];
-  char *t;
-  int i;
-
-  switch (type)
-    {
-    case 'f':
-      prec = 2;
-      break;
-
-    case 'd':
-      prec = 2;
-      /* The size of Double has been changed to 2 words ie 32 bits.  */
-      /* prec = 4; */
-      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 * 2;
-
-  for (i = prec - 1; i >= 0; i--)
-    {
-      md_number_to_chars (litP, (valueT) words[i], 2);
-      litP += 2;
-    }
-
-  return NULL;
+  if (type == 'd')
+    /* The size of Double has been changed to 2 words ie 32 bits.  */
+    type = 'f';
+  return ieee_md_atof (type, litP, sizeP, FALSE);
 }
 
 void
@@ -464,37 +408,15 @@ maxq20_cons_fix_new (fragS * frag, unsigned int off, unsigned int len,
   return;
 }
 
-short
-tc_coff_fix2rtype (fixS * fixP)
-{
-  return fixP->fx_r_type;
-}
-
-int
-tc_coff_sizemachdep (fragS *fragP)
-{
-  if (fragP->fr_next)
-    return (fragP->fr_next->fr_address - fragP->fr_address);
-
-  return 0;
-}
-
 /* GAS will call this for every rs_machine_dependent fragment. The
-   instruction is compleated using the data from the relaxation pass. It may
+   instruction is completed using the data from the relaxation pass. It may
    also create any necessary relocations.  */
-#ifdef BFD_ASSEMBLER
 void
 md_convert_frag (bfd *   headers ATTRIBUTE_UNUSED,
                 segT    seg ATTRIBUTE_UNUSED,
                 fragS * fragP)
-#else
-void
-md_convert_frag (object_headers * headers ATTRIBUTE_UNUSED,
-                segT             sec ATTRIBUTE_UNUSED,
-                fragS *          fragP)
-#endif
 {
-  unsigned char *opcode;
+  char *opcode;
   offsetT target_address;
   offsetT opcode_address;
   offsetT displacement_from_opcode_start;
@@ -521,9 +443,7 @@ md_convert_frag (object_headers * headers ATTRIBUTE_UNUSED,
          || fragP->fr_subtype == NO_PREFIX))
     {
       /* Its a displacement.  */
-      char *p = (char *) &opcode[0];
-
-      *p = (char) displacement_from_opcode_start;
+      *opcode = (char) displacement_from_opcode_start;
     }
   else
     {
@@ -542,7 +462,6 @@ md_convert_frag (object_headers * headers ATTRIBUTE_UNUSED,
       if (fragP->fr_subtype != SHORT_PREFIX)
        {
          RELOC_ENUM reloc_type;
-         unsigned char *opcode;
          int old_fr_fix;
          int size = 2;
 
@@ -557,7 +476,6 @@ md_convert_frag (object_headers * headers ATTRIBUTE_UNUSED,
          if (reloc_type == 1)
            size = 0;
          old_fr_fix = fragP->fr_fix;
-         opcode = (unsigned char *) fragP->fr_opcode;
 
          fragP->fr_fix += (size);
 
@@ -587,13 +505,13 @@ maxq_number_to_chars (char *buf, valueT val, int n)
 
 /* GAS will call this for each fixup. It's main objective is to store the
    correct value in the object file. 'fixup_segment' performs the generic
-   overflow check on the 'valueT *val' argument after md_apply_fix3 returns.
+   overflow check on the 'valueT *val' argument after md_apply_fix returns.
    If the overflow check is relevant for the target machine, then
-   'md_apply_fix3' should modify 'valueT *val', typically to the value stored 
+   'md_apply_fix' should modify 'valueT *val', typically to the value stored 
    in the object file (not to be done in MAXQ).  */
 
 void
-md_apply_fix3 (fixS *fixP, valueT *valT, segT seg ATTRIBUTE_UNUSED)
+md_apply_fix (fixS *fixP, valueT *valT, segT seg ATTRIBUTE_UNUSED)
 {
   char *p = fixP->fx_frag->fr_literal + fixP->fx_where;
   char *frag_to_fix_at =
@@ -623,18 +541,10 @@ md_apply_fix3 (fixS *fixP, valueT *valT, segT seg ATTRIBUTE_UNUSED)
              maxq_number_to_chars (p + 1, PFX0, 1);
            }
 
-#ifdef BFD_ASSEMBLER
          /* Remember value for tc_gen_reloc.  */
          fixP->fx_addnumber = *valT;
-#endif
        }
 
-      /* This prob can be fixed by defining tc_fix_adjustable.  */
-#ifndef BFD_ASSEMBLER
-      if (fixP->fx_addsy && S_GET_SEGMENT (fixP->fx_addsy))
-       segment_info[S_GET_SEGMENT (fixP->fx_addsy)].dot = NULL;
-#endif
-
       /* Some fixups generated by GAS which gets resovled before this this
          func. is called need to be wriiten to the frag as here we are going
          to go away with the relocations fx_done=1.  */
@@ -732,20 +642,10 @@ const pseudo_typeS md_pseudo_table[] =
   {NULL, 0, 0},
 };
 
-#if defined(BFD_HEADERS)
-#ifdef RELSZ
-const int md_reloc_size = RELSZ;       /* Coff headers.  */
-#else
-const int md_reloc_size = 12;          /* Something else headers.  */
-#endif
-#else
-const int md_reloc_size = 12;          /* Not bfdized.  */
-#endif
-
 #define SET_PFX_ARG(x) (PFX_INSN[1] = x)
 
 
-/* This function sets the PFX value coresponding to the specs. Source
+/* This function sets the PFX value corresponding to the specs. Source
    Destination Index Selection ---------------------------------- Write To|
    SourceRegRange | Dest Addr Range
    ------------------------------------------------------ PFX[0] | 0h-Fh |
@@ -1208,7 +1108,7 @@ maxq20_immediate (char *imm_start)
       return 1;
     }
 
-  /* Check For Sign Charcater.  */
+  /* Check For Sign Character.  */
   sign_val = 0;
 
   do
@@ -1516,22 +1416,8 @@ maxq20_data (char *op_string)
 
   if (symbolP != NULL
       && S_GET_SEGMENT (symbolP) != now_seg
-      && S_GET_SEGMENT (symbolP) !=
-#ifdef BFD_ASSEMBLER
-      bfd_und_section_ptr
-#else
-      SEG_UNKNOWN
-#endif
-      )
+      && S_GET_SEGMENT (symbolP) != bfd_und_section_ptr)
     {
-      int val_pfx;
-
-#ifdef BFD_ASSEMBLER
-      val_pfx =        0;
-#else
-      val_pfx = (symbolP->sy_value.X_add_number) >> 8;
-#endif
-
       /* In case we do not want to always include the prefix instruction and
          let the loader handle the job or in case of a 8 bit addressing mode, 
          we will just check for val_pfx to be equal to zero and then load the 
@@ -1539,7 +1425,7 @@ maxq20_data (char *op_string)
          loaded.  */
       /* The prefix register will have to be loaded automatically as we have 
         a 16 bit addressing field.  */
-      pfx_for_imm_val (val_pfx);
+      pfx_for_imm_val (0);
       return symbolP;
     }
 
@@ -1596,23 +1482,14 @@ maxq20_displacement (char *disp_start, char *disp_end)
 #if (defined (OBJ_AOUT) || defined (OBJ_MAYBE_AOUT))
 
   if (exp->X_op != O_constant
-#ifdef BFD_ASSEMBLER
       && OUTPUT_FLAVOR == bfd_target_aout_flavour
-#endif
       && exp_seg != absolute_section
       && exp_seg != text_section
       && exp_seg != data_section
       && exp_seg != bss_section && exp_seg != undefined_section
-#ifdef BFD_ASSEMBLER
-      && !bfd_is_com_section (exp_seg)
-#endif
-    )
+      && !bfd_is_com_section (exp_seg))
     {
-#ifdef BFD_ASSEMBLER
       as_bad (_("unimplemented segment %s in operand"), exp_seg->name);
-#else
-      as_bad (_("unimplemented segment type %d in operand"), exp_seg);
-#endif
       return 0;
     }
 #endif
@@ -1681,7 +1558,7 @@ maxq20_operand (char *operand_string)
          return 1;
        }
 
-      /* Get the origanal string.  */
+      /* Get the original string.  */
       memcpy (op_string, operand_string, strlen (operand_string) + 1);
       ii = strlen (operand_string) + 1;
 
@@ -3182,7 +3059,7 @@ md_assemble (char *line)
   if (!match_filters ())
     return;
 
-  /* Check for the approprate PFX register.  */
+  /* Check for the appropriate PFX register.  */
   set_prefix ();
   pfx_for_imm_val (0);
 
This page took 0.027246 seconds and 4 git commands to generate.