Rearrange symbol_create parameters
[deliverable/binutils-gdb.git] / gas / config / tc-nios2.c
index a7039e4c17016f60ef0037f642c5eb8f95501797..a8bbe5bf1b626357d8e6c3fdc5b587e9e253495e 100644 (file)
@@ -184,20 +184,20 @@ typedef struct nios2_ps_insn_info
 } nios2_ps_insn_infoS;
 
 /* Opcode hash table.  */
-static struct hash_control *nios2_opcode_hash = NULL;
+static htab_t nios2_opcode_hash = NULL;
 #define nios2_opcode_lookup(NAME) \
-  ((struct nios2_opcode *) hash_find (nios2_opcode_hash, (NAME)))
+  ((struct nios2_opcode *) str_hash_find (nios2_opcode_hash, (NAME)))
 
 /* Register hash table.  */
-static struct hash_control *nios2_reg_hash = NULL;
+static htab_t nios2_reg_hash = NULL;
 #define nios2_reg_lookup(NAME) \
-  ((struct nios2_reg *) hash_find (nios2_reg_hash, (NAME)))
+  ((struct nios2_reg *) str_hash_find (nios2_reg_hash, (NAME)))
 
 
 /* Pseudo-op hash table.  */
-static struct hash_control *nios2_ps_hash = NULL;
+static htab_t nios2_ps_hash = NULL;
 #define nios2_ps_lookup(NAME) \
-  ((nios2_ps_insn_infoS *) hash_find (nios2_ps_hash, (NAME)))
+  ((nios2_ps_insn_infoS *) str_hash_find (nios2_ps_hash, (NAME)))
 
 /* The known current alignment of the current section.  */
 static int nios2_current_align;
@@ -2710,7 +2710,7 @@ nios2_assemble_arg_R (const char *token, nios2_insn_infoS *insn)
          mask = (reglist & 0x00ffc000) >> 14;
          if (reglist & (1 << 28))
            mask |= 1 << 10;
-         if (reglist & (1 << 31))
+         if (reglist & (1u << 31))
            mask |= 1 << 11;
        }
       insn->insn_code |= SET_IW_F1X4L17_REGMASK (mask);
@@ -3230,11 +3230,8 @@ nios2_insert_arg (char **parsed_args, const char *insert, int num,
 static void
 nios2_free_arg (char **parsed_args, int num ATTRIBUTE_UNUSED, int start)
 {
-  if (parsed_args[start])
-    {
-      free (parsed_args[start]);
-      parsed_args[start] = NULL;
-    }
+  free (parsed_args[start]);
+  parsed_args[start] = NULL;
 }
 
 /* This function swaps the pseudo-op for a real op.  */
@@ -3606,7 +3603,6 @@ void
 md_begin (void)
 {
   int i;
-  const char *inserted;
 
   switch (nios2_architecture)
     {
@@ -3623,52 +3619,21 @@ md_begin (void)
 
   /* Create and fill a hashtable for the Nios II opcodes, registers and
      arguments.  */
-  nios2_opcode_hash = hash_new ();
-  nios2_reg_hash = hash_new ();
-  nios2_ps_hash = hash_new ();
+  nios2_opcode_hash = str_htab_create ();
+  nios2_reg_hash = str_htab_create ();
+  nios2_ps_hash = str_htab_create ();
 
   for (i = 0; i < nios2_num_opcodes; ++i)
-    {
-      inserted
-       = hash_insert (nios2_opcode_hash, nios2_opcodes[i].name,
-                      (PTR) & nios2_opcodes[i]);
-      if (inserted != NULL)
-       {
-         fprintf (stderr, _("internal error: can't hash `%s': %s\n"),
-                  nios2_opcodes[i].name, inserted);
-         /* Probably a memory allocation problem?  Give up now.  */
-         as_fatal (_("Broken assembler.  No assembly attempted."));
-       }
-    }
+    str_hash_insert (nios2_opcode_hash, nios2_opcodes[i].name,
+                    (PTR) & nios2_opcodes[i]);
 
   for (i = 0; i < nios2_num_regs; ++i)
-    {
-      inserted
-       = hash_insert (nios2_reg_hash, nios2_regs[i].name,
-                      (PTR) & nios2_regs[i]);
-      if (inserted != NULL)
-       {
-         fprintf (stderr, _("internal error: can't hash `%s': %s\n"),
-                  nios2_regs[i].name, inserted);
-         /* Probably a memory allocation problem?  Give up now.  */
-         as_fatal (_("Broken assembler.  No assembly attempted."));
-       }
-
-    }
+    str_hash_insert (nios2_reg_hash, nios2_regs[i].name,
+                    (PTR) & nios2_regs[i]);
 
   for (i = 0; i < nios2_num_ps_insn_info_structs; ++i)
-    {
-      inserted
-       = hash_insert (nios2_ps_hash, nios2_ps_insn_info_structs[i].pseudo_insn,
-                      (PTR) & nios2_ps_insn_info_structs[i]);
-      if (inserted != NULL)
-       {
-         fprintf (stderr, _("internal error: can't hash `%s': %s\n"),
-                  nios2_ps_insn_info_structs[i].pseudo_insn, inserted);
-         /* Probably a memory allocation problem?  Give up now.  */
-         as_fatal (_("Broken assembler.  No assembly attempted."));
-       }
-    }
+    str_hash_insert (nios2_ps_hash, nios2_ps_insn_info_structs[i].pseudo_insn,
+                    (PTR) & nios2_ps_insn_info_structs[i]);
 
   /* Assembler option defaults.  */
   nios2_as_options.noat = FALSE;
@@ -3942,7 +3907,7 @@ md_undefined_symbol (char *name ATTRIBUTE_UNUSED)
            as_bad ("GOT already in the symbol table");
 
          GOT_symbol = symbol_new (name, undefined_section,
-                                  (valueT) 0, &zero_address_frag);
+                                  &zero_address_frag, 0);
        }
 
       return GOT_symbol;
This page took 0.024355 seconds and 4 git commands to generate.