+2020-08-20 Martin Liska <mliska@suse.cz>
+
+ * config/obj-coff-seh.c (seh_hash_insert): Port to use new
+ str_htab type.
+ (seh_hash_find): Likewise.
+ (seh_hash_find_or_make): Likewise.
+ * config/obj-coff.c (tag_init): Likewise.
+ (tag_insert): Likewise.
+ (tag_find): Likewise.
+ * config/obj-elf.c (struct group_list): Likewise.
+ (build_additional_section_info): Likewise.
+ (free_section_idx): Likewise.
+ (elf_adjust_symtab): Likewise.
+ (elf_frob_file_after_relocs): Likewise.
+ * config/tc-aarch64.c (INSN_SIZE): Likewise.
+ (parse_reg): Likewise.
+ (insert_reg_alias): Likewise.
+ (create_register_alias): Likewise.
+ (s_unreq): Likewise.
+ (parse_shift): Likewise.
+ (parse_pldop): Likewise.
+ (parse_barrier): Likewise.
+ (parse_barrier_psb): Likewise.
+ (parse_bti_operand): Likewise.
+ (parse_sys_reg): Likewise.
+ (parse_sys_ins_reg): Likewise.
+ (lookup_mnemonic): Likewise.
+ (opcode_lookup): Likewise.
+ (parse_operands): Likewise.
+ (checked_hash_insert): Likewise.
+ (sysreg_hash_insert): Likewise.
+ (fill_instruction_hash_table): Likewise.
+ (md_begin): Likewise.
+ * config/tc-alpha.c (struct alpha_reloc_tag): Likewise.
+ (get_alpha_reloc_tag): Likewise.
+ (assemble_tokens_to_insn): Likewise.
+ (assemble_tokens): Likewise.
+ (md_begin): Likewise.
+ * config/tc-arc.c (arc_find_opcode): Likewise.
+ (arc_insert_opcode): Likewise.
+ (find_opcode_match): Likewise.
+ (declare_register): Likewise.
+ (declare_addrtype): Likewise.
+ (md_begin): Likewise.
+ (arc_parse_name): Likewise.
+ (tc_arc_regname_to_dw2regnum): Likewise.
+ (arc_extcorereg): Likewise.
+ * config/tc-arm.c (MVE_BAD_QREG): Likewise.
+ (arm_reg_parse_multi): Likewise.
+ (parse_reloc): Likewise.
+ (insert_reg_alias): Likewise.
+ (create_register_alias): Likewise.
+ (s_unreq): Likewise.
+ (parse_shift): Likewise.
+ (parse_psr): Likewise.
+ (parse_cond): Likewise.
+ (parse_barrier): Likewise.
+ (do_vfp_nsyn_opcode): Likewise.
+ (opcode_lookup): Likewise.
+ (arm_tc_equal_in_insn): Likewise.
+ (md_begin): Likewise.
+ * config/tc-avr.c (md_begin): Likewise.
+ (avr_ldi_expression): Likewise.
+ (md_assemble): Likewise.
+ (avr_update_gccisr): Likewise.
+ (avr_emit_insn): Likewise.
+ * config/tc-cr16.c (get_register): Likewise.
+ (get_register_pair): Likewise.
+ (get_index_register): Likewise.
+ (get_index_register_pair): Likewise.
+ (get_pregister): Likewise.
+ (get_pregisterp): Likewise.
+ (initialise_reg_hash_table): Likewise.
+ (md_begin): Likewise.
+ (cr16_assemble): Likewise.
+ (md_assemble): Likewise.
+ * config/tc-cris.c (cris_insn_first_word_frag): Likewise.
+ (md_begin): Likewise.
+ (cris_process_instruction): Likewise.
+ * config/tc-crx.c (get_register): Likewise.
+ (get_copregister): Likewise.
+ (md_begin): Likewise.
+ (md_assemble): Likewise.
+ * config/tc-csky.c (md_begin): Likewise.
+ (parse_opcode): Likewise.
+ (get_operand_value): Likewise.
+ (v1_work_jbsr): Likewise.
+ (v2_work_rotlc): Likewise.
+ (v2_work_bgeni): Likewise.
+ (v2_work_not): Likewise.
+ * config/tc-d10v.c (sizeof): Likewise.
+ (md_begin): Likewise.
+ (do_assemble): Likewise.
+ (md_apply_fix): Likewise.
+ * config/tc-d30v.c (sizeof): Likewise.
+ (md_begin): Likewise.
+ (do_assemble): Likewise.
+ * config/tc-dlx.c (RELOC_DLX_VTENTRY): Likewise.
+ (md_begin): Likewise.
+ (machine_ip): Likewise.
+ * config/tc-ft32.c (md_begin): Likewise.
+ (md_assemble): Likewise.
+ * config/tc-h8300.c (md_begin): Likewise.
+ (md_assemble): Likewise.
+ * config/tc-hppa.c (pa_ip): Likewise.
+ (md_begin): Likewise.
+ * config/tc-i386.c (md_begin): Likewise.
+ (i386_print_statistics): Likewise.
+ (parse_insn): Likewise.
+ (process_operands): Likewise.
+ (i386_index_check): Likewise.
+ (parse_real_register): Likewise.
+ * config/tc-ia64.c (dot_rot): Likewise.
+ (dot_entry): Likewise.
+ (declare_register): Likewise.
+ (md_begin): Likewise.
+ (ia64_parse_name): Likewise.
+ (md_assemble): Likewise.
+ (dot_alias): Likewise.
+ (do_alias): Likewise.
+ (ia64_adjust_symtab): Likewise.
+ (do_secalias): Likewise.
+ (ia64_frob_file): Likewise.
+ * config/tc-m68hc11.c (m68hc11_print_statistics): Likewise.
+ (md_begin): Likewise.
+ (print_insn_format): Likewise.
+ (md_assemble): Likewise.
+ * config/tc-m68k.c (tc_gen_reloc): Likewise.
+ (m68k_ip): Likewise.
+ (md_begin): Likewise.
+ * config/tc-mcore.c (md_begin): Likewise.
+ (md_assemble): Likewise.
+ * config/tc-microblaze.c (md_begin): Likewise.
+ (md_assemble): Likewise.
+ (md_apply_fix): Likewise.
+ * config/tc-mips.c (nopic_need_relax): Likewise.
+ (md_begin): Likewise.
+ (macro_build): Likewise.
+ (mips16_macro_build): Likewise.
+ (mips_lookup_insn): Likewise.
+ (mips_ip): Likewise.
+ (mips16_ip): Likewise.
+ * config/tc-mmix.c (sizeof): Likewise.
+ (mmix_md_begin): Likewise.
+ (md_assemble): Likewise.
+ * config/tc-mn10200.c (md_begin): Likewise.
+ (md_assemble): Likewise.
+ * config/tc-mn10300.c (HAVE_AM30): Likewise.
+ (md_begin): Likewise.
+ (md_assemble): Likewise.
+ * config/tc-moxie.c (md_begin): Likewise.
+ (md_assemble): Likewise.
+ * config/tc-msp430.c (md_begin): Likewise.
+ (msp430_operands): Likewise.
+ (md_assemble): Likewise.
+ * config/tc-nds32.c (PV_DONT_CARE): Likewise.
+ (builtin_isreg): Likewise.
+ (builtin_regnum): Likewise.
+ (nds32_init_nds32_pseudo_opcodes): Likewise.
+ (nds32_lookup_pseudo_opcode): Likewise.
+ (nds32_relax_hint): Likewise.
+ (md_begin): Likewise.
+ (nds32_find_reloc_table): Likewise.
+ (nds32_elf_append_relax_relocs_traverse): Likewise.
+ (nds32_relax_branch_instructions): Likewise.
+ (md_convert_frag): Likewise.
+ (nds32_elf_analysis_relax_hint): Likewise.
+ (tc_nds32_regname_to_dw2regnum): Likewise.
+ * config/tc-nios2.c (nios2_opcode_lookup): Likewise.
+ (nios2_reg_lookup): Likewise.
+ (nios2_ps_lookup): Likewise.
+ (md_begin): Likewise.
+ * config/tc-ns32k.c (struct hash_control): Likewise.
+ (parse): Likewise.
+ (md_begin): Likewise.
+ * config/tc-pdp11.c (md_begin): Likewise.
+ (md_assemble): Likewise.
+ * config/tc-pj.c (fake_opcode): Likewise.
+ (alias): Likewise.
+ (md_begin): Likewise.
+ (md_assemble): Likewise.
+ * config/tc-ppc.c (ppc_setup_opcodes): Likewise.
+ (md_assemble): Likewise.
+ * config/tc-pru.c (pru_opcode_lookup): Likewise.
+ (pru_reg_lookup): Likewise.
+ (md_begin): Likewise.
+ (md_end): Likewise.
+ * config/tc-riscv.c (init_ext_version_hash): Likewise.
+ (riscv_get_default_ext_version): Likewise.
+ (riscv_set_arch): Likewise.
+ (init_opcode_names_hash): Likewise.
+ (opcode_name_lookup): Likewise.
+ (enum reg_class): Likewise.
+ (hash_reg_name): Likewise.
+ (riscv_init_csr_hash): Likewise.
+ (reg_csr_lookup_internal): Likewise.
+ (reg_lookup_internal): Likewise.
+ (init_opcode_hash): Likewise.
+ (md_begin): Likewise.
+ (DECLARE_CSR): Likewise.
+ (macro_build): Likewise.
+ (riscv_ip): Likewise.
+ * config/tc-s390.c (register_name): Likewise.
+ (s390_setup_opcodes): Likewise.
+ (md_begin): Likewise.
+ (md_assemble): Likewise.
+ (s390_insn): Likewise.
+ * config/tc-score.c (struct s3_reg_map): Likewise.
+ (s3_score_reg_parse): Likewise.
+ (s3_dependency_type_from_insn): Likewise.
+ (s3_parse_16_32_inst): Likewise.
+ (s3_parse_48_inst): Likewise.
+ (s3_insert_reg): Likewise.
+ (s3_build_reg_hsh): Likewise.
+ (s3_build_score_ops_hsh): Likewise.
+ (s3_build_dependency_insn_hsh): Likewise.
+ (s3_begin): Likewise.
+ * config/tc-score7.c (struct s7_reg_map): Likewise.
+ (s7_score_reg_parse): Likewise.
+ (s7_dependency_type_from_insn): Likewise.
+ (s7_parse_16_32_inst): Likewise.
+ (s7_build_score_ops_hsh): Likewise.
+ (s7_build_dependency_insn_hsh): Likewise.
+ (s7_insert_reg): Likewise.
+ (s7_build_reg_hsh): Likewise.
+ (s7_begin): Likewise.
+ * config/tc-sh.c (EMPTY): Likewise.
+ (md_begin): Likewise.
+ (find_cooked_opcode): Likewise.
+ * config/tc-sparc.c (md_begin): Likewise.
+ (sparc_ip): Likewise.
+ * config/tc-spu.c (md_begin): Likewise.
+ (md_assemble): Likewise.
+ * config/tc-tic30.c (md_begin): Likewise.
+ (tic30_operand): Likewise.
+ (tic30_parallel_insn): Likewise.
+ (md_assemble): Likewise.
+ * config/tc-tic4x.c (TIC4X_ALT_SYNTAX): Likewise.
+ (tic4x_asg): Likewise.
+ (tic4x_inst_insert): Likewise.
+ (tic4x_inst_add): Likewise.
+ (md_begin): Likewise.
+ (tic4x_operand_parse): Likewise.
+ (md_assemble): Likewise.
+ * config/tc-tic54x.c (MAX_SUBSYM_HASH): Likewise.
+ (stag_add_field_symbols): Likewise.
+ (tic54x_endstruct): Likewise.
+ (tic54x_tag): Likewise.
+ (tic54x_remove_local_label): Likewise.
+ (tic54x_clear_local_labels): Likewise.
+ (tic54x_var): Likewise.
+ (tic54x_macro_start): Likewise.
+ (tic54x_macro_info): Likewise.
+ (tic54x_macro_end): Likewise.
+ (subsym_isreg): Likewise.
+ (subsym_structsz): Likewise.
+ (md_begin): Likewise.
+ (is_mmreg): Likewise.
+ (is_type): Likewise.
+ (encode_condition): Likewise.
+ (encode_cc3): Likewise.
+ (encode_cc2): Likewise.
+ (encode_operand): Likewise.
+ (tic54x_parse_insn): Likewise.
+ (tic54x_parse_parallel_insn_firstline): Likewise.
+ (subsym_create_or_replace): Likewise.
+ (subsym_lookup): Likewise.
+ (subsym_substitute): Likewise.
+ (tic54x_undefined_symbol): Likewise.
+ * config/tc-tic6x.c (md_begin): Likewise.
+ (md_assemble): Likewise.
+ * config/tc-tilegx.c (O_hw2_last_plt): Likewise.
+ (INSERT_SPECIAL_OP): Likewise.
+ (md_begin): Likewise.
+ (tilegx_parse_name): Likewise.
+ (parse_reg_expression): Likewise.
+ (md_assemble): Likewise.
+ * config/tc-tilepro.c (O_tls_ie_load): Likewise.
+ (INSERT_SPECIAL_OP): Likewise.
+ (tilepro_parse_name): Likewise.
+ (parse_reg_expression): Likewise.
+ (md_assemble): Likewise.
+ * config/tc-v850.c (md_begin): Likewise.
+ (md_assemble): Likewise.
+ * config/tc-vax.c (md_ri_to_chars): Likewise.
+ (vip_begin): Likewise.
+ (vip): Likewise.
+ (main): Likewise.
+ (md_begin): Likewise.
+ * config/tc-wasm32.c (md_begin): Likewise.
+ (md_assemble): Likewise.
+ * config/tc-xgate.c (xgate_parse_operand): Likewise.
+ (md_begin): Likewise.
+ (md_assemble): Likewise.
+ * config/tc-z8k.c (md_begin): Likewise.
+ (md_assemble): Likewise.
+
2020-08-20 Martin Liska <mliska@suse.cz>
* dw2gencfi.c (dwcfi_hash_insert): Use htab_t and str_hash_*
/* Local data. */
static seh_context *seh_ctx_cur = NULL;
-static struct hash_control *seh_hash;
+static htab_t seh_hash;
static struct seh_seg_list *x_segcur = NULL;
static struct seh_seg_list *p_segcur = NULL;
static void
seh_hash_insert (const char *name, struct seh_seg_list *item)
{
- const char *error_string;
-
- if ((error_string = hash_jam (seh_hash, name, (char *) item)))
- as_fatal (_("Inserting \"%s\" into structure table failed: %s"),
- name, error_string);
+ str_hash_insert (seh_hash, name, (char *) item);
}
static struct seh_seg_list *
seh_hash_find (char *name)
{
- return (struct seh_seg_list *) hash_find (seh_hash, name);
+ return (struct seh_seg_list *) str_hash_find (seh_hash, name);
}
static struct seh_seg_list *
/* Initialize seh_hash once. */
if (!seh_hash)
- seh_hash = hash_new ();
+ seh_hash = str_htab_create ();
name = get_pxdata_name (cseg, base_name);
\f
/* Maintain a list of the tagnames of the structures. */
-static struct hash_control *tag_hash;
+static htab_t tag_hash;
static void
tag_init (void)
{
- tag_hash = hash_new ();
+ tag_hash = str_htab_create ();
}
static void
tag_insert (const char *name, symbolS *symbolP)
{
- const char *error_string;
-
- if ((error_string = hash_jam (tag_hash, name, (char *) symbolP)))
- as_fatal (_("Inserting \"%s\" into structure table failed: %s"),
- name, error_string);
+ str_hash_insert (tag_hash, name, (char *) symbolP);
}
static symbolS *
tag_find (char *name)
{
- return (symbolS *) hash_find (tag_hash, name);
+ return (symbolS *) str_hash_find (tag_hash, name);
}
static symbolS *
{
asection **head; /* Section lists. */
unsigned int num_group; /* Number of lists. */
- struct hash_control *indexes; /* Maps group name to index in head array. */
+ htab_t indexes; /* Maps group name to index in head array. */
};
static struct group_list groups;
/* If this group already has a list, add the section to the head of
the list. */
- elem_idx = (unsigned int *) hash_find (list->indexes, group_name);
+ elem_idx = (unsigned int *) str_hash_find (list->indexes, group_name);
if (elem_idx != NULL)
{
elf_next_in_group (sec) = list->head[*elem_idx];
/* Add index to hash. */
idx_ptr = XNEW (unsigned int);
*idx_ptr = i;
- hash_insert (list->indexes, group_name, idx_ptr);
+ str_hash_insert (list->indexes, group_name, (char *)idx_ptr);
}
-static void free_section_idx (const char *key ATTRIBUTE_UNUSED, void *val)
+static int
+free_section_idx (void **slot, void *arg ATTRIBUTE_UNUSED)
{
- free ((unsigned int *) val);
+ string_tuple_t *tuple = *((string_tuple_t **) slot);
+ free ((char *)tuple->value);
+ return 1;
}
/* Create symbols for group signature. */
/* Go find section groups. */
groups.num_group = 0;
groups.head = NULL;
- groups.indexes = hash_new ();
+ groups.indexes = str_htab_create ();
bfd_map_over_sections (stdoutput, build_additional_section_info,
&groups);
}
/* Cleanup hash. */
- hash_traverse (groups.indexes, free_section_idx);
- hash_die (groups.indexes);
+ htab_traverse (groups.indexes, free_section_idx, NULL);
+ htab_delete (groups.indexes);
#ifdef NEED_ECOFF_DEBUG
if (ECOFF_DEBUGGING)
/* Instructions take 4 bytes in the object file. */
#define INSN_SIZE 4
-static struct hash_control *aarch64_ops_hsh;
-static struct hash_control *aarch64_cond_hsh;
-static struct hash_control *aarch64_shift_hsh;
-static struct hash_control *aarch64_sys_regs_hsh;
-static struct hash_control *aarch64_pstatefield_hsh;
-static struct hash_control *aarch64_sys_regs_ic_hsh;
-static struct hash_control *aarch64_sys_regs_dc_hsh;
-static struct hash_control *aarch64_sys_regs_at_hsh;
-static struct hash_control *aarch64_sys_regs_tlbi_hsh;
-static struct hash_control *aarch64_sys_regs_sr_hsh;
-static struct hash_control *aarch64_reg_hsh;
-static struct hash_control *aarch64_barrier_opt_hsh;
-static struct hash_control *aarch64_nzcv_hsh;
-static struct hash_control *aarch64_pldop_hsh;
-static struct hash_control *aarch64_hint_opt_hsh;
+static htab_t aarch64_ops_hsh;
+static htab_t aarch64_cond_hsh;
+static htab_t aarch64_shift_hsh;
+static htab_t aarch64_sys_regs_hsh;
+static htab_t aarch64_pstatefield_hsh;
+static htab_t aarch64_sys_regs_ic_hsh;
+static htab_t aarch64_sys_regs_dc_hsh;
+static htab_t aarch64_sys_regs_at_hsh;
+static htab_t aarch64_sys_regs_tlbi_hsh;
+static htab_t aarch64_sys_regs_sr_hsh;
+static htab_t aarch64_reg_hsh;
+static htab_t aarch64_barrier_opt_hsh;
+static htab_t aarch64_nzcv_hsh;
+static htab_t aarch64_pldop_hsh;
+static htab_t aarch64_hint_opt_hsh;
/* Stuff needed to resolve the label ambiguity
As:
p++;
while (ISALPHA (*p) || ISDIGIT (*p) || *p == '_');
- reg = (reg_entry *) hash_find_n (aarch64_reg_hsh, start, p - start);
+ reg = (reg_entry *) str_hash_find_n (aarch64_reg_hsh, start, p - start);
if (!reg)
return NULL;
reg_entry *new;
const char *name;
- if ((new = hash_find (aarch64_reg_hsh, str)) != 0)
+ if ((new = str_hash_find (aarch64_reg_hsh, str)) != 0)
{
if (new->builtin)
as_warn (_("ignoring attempt to redefine built-in register '%s'"),
new->type = type;
new->builtin = FALSE;
- if (hash_insert (aarch64_reg_hsh, name, (void *) new))
- abort ();
+ str_hash_insert (aarch64_reg_hsh, name, (void *) new);
return new;
}
if (*oldname == '\0')
return FALSE;
- old = hash_find (aarch64_reg_hsh, oldname);
+ old = str_hash_find (aarch64_reg_hsh, oldname);
if (!old)
{
as_warn (_("unknown register '%s' -- .req ignored"), oldname);
as_bad (_("invalid syntax for .unreq directive"));
else
{
- reg_entry *reg = hash_find (aarch64_reg_hsh, name);
+ reg_entry *reg = str_hash_find (aarch64_reg_hsh, name);
if (!reg)
as_bad (_("unknown register alias '%s'"), name);
char *p;
char *nbuf;
- hash_delete (aarch64_reg_hsh, name, FALSE);
+ str_hash_delete (aarch64_reg_hsh, name);
free ((char *) reg->name);
free (reg);
nbuf = strdup (name);
for (p = nbuf; *p; p++)
*p = TOUPPER (*p);
- reg = hash_find (aarch64_reg_hsh, nbuf);
+ reg = str_hash_find (aarch64_reg_hsh, nbuf);
if (reg)
{
- hash_delete (aarch64_reg_hsh, nbuf, FALSE);
+ str_hash_delete (aarch64_reg_hsh, nbuf);
free ((char *) reg->name);
free (reg);
}
for (p = nbuf; *p; p++)
*p = TOLOWER (*p);
- reg = hash_find (aarch64_reg_hsh, nbuf);
+ reg = str_hash_find (aarch64_reg_hsh, nbuf);
if (reg)
{
- hash_delete (aarch64_reg_hsh, nbuf, FALSE);
+ str_hash_delete (aarch64_reg_hsh, nbuf);
free ((char *) reg->name);
free (reg);
}
return FALSE;
}
- shift_op = hash_find_n (aarch64_shift_hsh, *str, p - *str);
+ shift_op = str_hash_find_n (aarch64_shift_hsh, *str, p - *str);
if (shift_op == NULL)
{
while (ISALNUM (*q))
q++;
- o = hash_find_n (aarch64_pldop_hsh, p, q - p);
+ o = str_hash_find_n (aarch64_pldop_hsh, p, q - p);
if (!o)
return PARSE_FAIL;
while (ISALPHA (*q))
q++;
- o = hash_find_n (aarch64_barrier_opt_hsh, p, q - p);
+ o = str_hash_find_n (aarch64_barrier_opt_hsh, p, q - p);
if (!o)
return PARSE_FAIL;
while (ISALPHA (*q))
q++;
- o = hash_find_n (aarch64_hint_opt_hsh, p, q - p);
+ o = str_hash_find_n (aarch64_hint_opt_hsh, p, q - p);
if (!o)
{
set_fatal_syntax_error
while (ISALPHA (*q))
q++;
- o = hash_find_n (aarch64_hint_opt_hsh, p, q - p);
+ o = str_hash_find_n (aarch64_hint_opt_hsh, p, q - p);
if (!o)
{
set_fatal_syntax_error
*/
static int
-parse_sys_reg (char **str, struct hash_control *sys_regs,
+parse_sys_reg (char **str, htab_t sys_regs,
int imple_defined_p, int pstatefield_p,
uint32_t* flags)
{
if (p - buf != q - *str)
return PARSE_FAIL;
- o = hash_find (sys_regs, buf);
+ o = str_hash_find (sys_regs, buf);
if (!o)
{
if (!imple_defined_p)
for the option, or NULL. */
static const aarch64_sys_ins_reg *
-parse_sys_ins_reg (char **str, struct hash_control *sys_ins_regs)
+parse_sys_ins_reg (char **str, htab_t sys_ins_regs)
{
char *p, *q;
char buf[AARCH64_MAX_SYSREG_NAME_LEN];
if (p - buf != q - *str)
return NULL;
- o = hash_find (sys_ins_regs, buf);
+ o = str_hash_find (sys_ins_regs, buf);
if (!o)
return NULL;
{
templates *templ = NULL;
- templ = hash_find_n (aarch64_ops_hsh, start, len);
+ templ = str_hash_find_n (aarch64_ops_hsh, start, len);
return templ;
}
/* Handle a possible condition. */
if (dot)
{
- cond = hash_find_n (aarch64_cond_hsh, dot + 1, end - dot - 1);
+ cond = str_hash_find_n (aarch64_cond_hsh, dot + 1, end - dot - 1);
if (cond)
{
inst.cond = cond->value;
case AARCH64_OPND_NZCV:
{
- const asm_nzcv *nzcv = hash_find_n (aarch64_nzcv_hsh, str, 4);
+ const asm_nzcv *nzcv = str_hash_find_n (aarch64_nzcv_hsh, str, 4);
if (nzcv != NULL)
{
str += 4;
do
str++;
while (ISALPHA (*str));
- info->cond = hash_find_n (aarch64_cond_hsh, start, str - start);
+ info->cond = str_hash_find_n (aarch64_cond_hsh, start, str - start);
if (info->cond == NULL)
{
set_syntax_error (_("invalid condition"));
}
static void
-checked_hash_insert (struct hash_control *table, const char *key, void *value)
+checked_hash_insert (htab_t table, const char *key, void *value)
{
- const char *hash_err;
-
- hash_err = hash_insert (table, key, value);
- if (hash_err)
- printf ("Internal Error: Can't hash %s\n", key);
+ str_hash_insert (table, key, value);
}
static void
-sysreg_hash_insert (struct hash_control *table, const char *key, void *value)
+sysreg_hash_insert (htab_t table, const char *key, void *value)
{
gas_assert (strlen (key) < AARCH64_MAX_SYSREG_NAME_LEN);
checked_hash_insert (table, key, value);
while (opcode->name != NULL)
{
templates *templ, *new_templ;
- templ = hash_find (aarch64_ops_hsh, opcode->name);
+ templ = str_hash_find (aarch64_ops_hsh, opcode->name);
new_templ = XNEW (templates);
new_templ->opcode = opcode;
unsigned mach;
unsigned int i;
- if ((aarch64_ops_hsh = hash_new ()) == NULL
- || (aarch64_cond_hsh = hash_new ()) == NULL
- || (aarch64_shift_hsh = hash_new ()) == NULL
- || (aarch64_sys_regs_hsh = hash_new ()) == NULL
- || (aarch64_pstatefield_hsh = hash_new ()) == NULL
- || (aarch64_sys_regs_ic_hsh = hash_new ()) == NULL
- || (aarch64_sys_regs_dc_hsh = hash_new ()) == NULL
- || (aarch64_sys_regs_at_hsh = hash_new ()) == NULL
- || (aarch64_sys_regs_tlbi_hsh = hash_new ()) == NULL
- || (aarch64_sys_regs_sr_hsh = hash_new ()) == NULL
- || (aarch64_reg_hsh = hash_new ()) == NULL
- || (aarch64_barrier_opt_hsh = hash_new ()) == NULL
- || (aarch64_nzcv_hsh = hash_new ()) == NULL
- || (aarch64_pldop_hsh = hash_new ()) == NULL
- || (aarch64_hint_opt_hsh = hash_new ()) == NULL)
+ if ((aarch64_ops_hsh = str_htab_create ()) == NULL
+ || (aarch64_cond_hsh = str_htab_create ()) == NULL
+ || (aarch64_shift_hsh = str_htab_create ()) == NULL
+ || (aarch64_sys_regs_hsh = str_htab_create ()) == NULL
+ || (aarch64_pstatefield_hsh = str_htab_create ()) == NULL
+ || (aarch64_sys_regs_ic_hsh = str_htab_create ()) == NULL
+ || (aarch64_sys_regs_dc_hsh = str_htab_create ()) == NULL
+ || (aarch64_sys_regs_at_hsh = str_htab_create ()) == NULL
+ || (aarch64_sys_regs_tlbi_hsh = str_htab_create ()) == NULL
+ || (aarch64_sys_regs_sr_hsh = str_htab_create ()) == NULL
+ || (aarch64_reg_hsh = str_htab_create ()) == NULL
+ || (aarch64_barrier_opt_hsh = str_htab_create ()) == NULL
+ || (aarch64_nzcv_hsh = str_htab_create ()) == NULL
+ || (aarch64_pldop_hsh = str_htab_create ()) == NULL
+ || (aarch64_hint_opt_hsh = str_htab_create ()) == NULL)
as_fatal (_("virtual memory exhausted"));
fill_instruction_hash_table ();
static const char *alpha_target_name = "<all>";
/* The hash table of instruction opcodes. */
-static struct hash_control *alpha_opcode_hash;
+static htab_t alpha_opcode_hash;
/* The hash table of macro opcodes. */
-static struct hash_control *alpha_macro_hash;
+static htab_t alpha_macro_hash;
#ifdef OBJ_ECOFF
/* The $gp relocation symbol. */
};
/* Hash table to link up literals with the appropriate lituse. */
-static struct hash_control *alpha_literal_hash;
+static htab_t alpha_literal_hash;
/* Sequence numbers for internal use by macros. */
static long next_sequence_num = -1;
sprintf (buffer, "!%ld", sequence);
- info = (struct alpha_reloc_tag *) hash_find (alpha_literal_hash, buffer);
+ info = (struct alpha_reloc_tag *) str_hash_find (alpha_literal_hash, buffer);
if (! info)
{
size_t len = strlen (buffer);
- const char *errmsg;
info = (struct alpha_reloc_tag *)
xcalloc (sizeof (struct alpha_reloc_tag) + len, 1);
info->segment = now_seg;
info->sequence = sequence;
strcpy (info->string, buffer);
- errmsg = hash_insert (alpha_literal_hash, info->string, (void *) info);
- if (errmsg)
- as_fatal ("%s", errmsg);
+ str_hash_insert (alpha_literal_hash, info->string, (void *) info);
#ifdef OBJ_EVAX
info->sym = 0;
info->psym = 0;
const struct alpha_opcode *opcode;
/* Search opcodes. */
- opcode = (const struct alpha_opcode *) hash_find (alpha_opcode_hash, opname);
+ opcode = (const struct alpha_opcode *) str_hash_find (alpha_opcode_hash, opname);
if (opcode)
{
int cpumatch;
if (local_macros_on)
{
macro = ((const struct alpha_macro *)
- hash_find (alpha_macro_hash, opname));
+ str_hash_find (alpha_macro_hash, opname));
if (macro)
{
found_something = 1;
}
/* Search opcodes. */
- opcode = (const struct alpha_opcode *) hash_find (alpha_opcode_hash, opname);
+ opcode = (const struct alpha_opcode *) str_hash_find (alpha_opcode_hash, opname);
if (opcode)
{
found_something = 1;
}
/* Create the opcode hash table. */
- alpha_opcode_hash = hash_new ();
+ alpha_opcode_hash = str_htab_create ();
for (i = 0; i < alpha_num_opcodes;)
{
- const char *name, *retval, *slash;
+ const char *name, *slash;
name = alpha_opcodes[i].name;
- retval = hash_insert (alpha_opcode_hash, name, (void *) &alpha_opcodes[i]);
- if (retval)
- as_fatal (_("internal error: can't hash opcode `%s': %s"),
- name, retval);
+ str_hash_insert (alpha_opcode_hash, name, (void *) &alpha_opcodes[i]);
/* Some opcodes include modifiers of various sorts with a "/mod"
syntax, like the architecture manual suggests. However, for
memcpy (p, name, slash - name);
strcpy (p + (slash - name), slash + 1);
- (void) hash_insert (alpha_opcode_hash, p, (void *) &alpha_opcodes[i]);
+ (void) str_hash_insert (alpha_opcode_hash, p, (void *) &alpha_opcodes[i]);
/* Ignore failures -- the opcode table does duplicate some
variants in different forms, like "hw_stq" and "hw_st/q". */
}
}
/* Create the macro hash table. */
- alpha_macro_hash = hash_new ();
+ alpha_macro_hash = str_htab_create ();
for (i = 0; i < alpha_num_macros;)
{
- const char *name, *retval;
+ const char *name;
name = alpha_macros[i].name;
- retval = hash_insert (alpha_macro_hash, name, (void *) &alpha_macros[i]);
- if (retval)
- as_fatal (_("internal error: can't hash macro `%s': %s"),
- name, retval);
+ str_hash_insert (alpha_macro_hash, name, (void *) &alpha_macros[i]);
while (++i < alpha_num_macros
&& (alpha_macros[i].name == name
#endif
/* Create literal lookup hash table. */
- alpha_literal_hash = hash_new ();
+ alpha_literal_hash = str_htab_create ();
subseg_set (text_section, 0);
}
static enum mach_selection_type mach_selection_mode = MACH_SELECTION_NONE;
/* The hash table of instruction opcodes. */
-static struct hash_control *arc_opcode_hash;
+static htab_t arc_opcode_hash;
/* The hash table of register symbols. */
-static struct hash_control *arc_reg_hash;
+static htab_t arc_reg_hash;
/* The hash table of aux register symbols. */
-static struct hash_control *arc_aux_hash;
+static htab_t arc_aux_hash;
/* The hash table of address types. */
-static struct hash_control *arc_addrtype_hash;
+static htab_t arc_addrtype_hash;
#define ARC_CPU_TYPE_A6xx(NAME,EXTRA) \
{ #NAME, ARC_OPCODE_ARC600, bfd_mach_arc_arc600, \
{
const struct arc_opcode_hash_entry *entry;
- entry = hash_find (arc_opcode_hash, name);
+ entry = str_hash_find (arc_opcode_hash, name);
return entry;
}
static void
arc_insert_opcode (const struct arc_opcode *opcode)
{
- const char *name, *retval;
+ const char *name;
struct arc_opcode_hash_entry *entry;
name = opcode->name;
- entry = hash_find (arc_opcode_hash, name);
+ entry = str_hash_find (arc_opcode_hash, name);
if (entry == NULL)
{
entry = XNEW (struct arc_opcode_hash_entry);
entry->count = 0;
entry->opcode = NULL;
- retval = hash_insert (arc_opcode_hash, name, (void *) entry);
- if (retval)
- as_fatal (_("internal error: can't hash opcode '%s': %s"),
- name, retval);
+ str_hash_insert (arc_opcode_hash, name, (void *) entry);
}
entry->opcode = XRESIZEVEC (const struct arc_opcode *, entry->opcode,
tmpp = strdup (p);
for (pp = tmpp; *pp; ++pp) *pp = TOLOWER (*pp);
- auxr = hash_find (arc_aux_hash, tmpp);
+ auxr = str_hash_find (arc_aux_hash, tmpp);
if (auxr)
{
/* We modify the token array here, safe in the
static void
declare_register (const char *name, int number)
{
- const char *err;
symbolS *regS = symbol_create (name, reg_section,
number, &zero_address_frag);
- err = hash_insert (arc_reg_hash, S_GET_NAME (regS), (void *) regS);
- if (err)
- as_fatal (_("Inserting \"%s\" into register table failed: %s"),
- name, err);
+ str_hash_insert (arc_reg_hash, S_GET_NAME (regS), (void *) regS);
}
/* Construct symbols for each of the general registers. */
static void
declare_addrtype (const char *name, int number)
{
- const char *err;
symbolS *addrtypeS = symbol_create (name, undefined_section,
number, &zero_address_frag);
- err = hash_insert (arc_addrtype_hash, S_GET_NAME (addrtypeS),
- (void *) addrtypeS);
- if (err)
- as_fatal (_("Inserting \"%s\" into address type table failed: %s"),
- name, err);
+ str_hash_insert (arc_addrtype_hash, S_GET_NAME (addrtypeS),
+ (void *) addrtypeS);
}
/* Port-specific assembler initialization. This function is called
bfd_set_private_flags (stdoutput, selected_cpu.eflags);
/* Set up a hash table for the instructions. */
- arc_opcode_hash = hash_new ();
+ arc_opcode_hash = str_htab_create ();
if (arc_opcode_hash == NULL)
as_fatal (_("Virtual memory exhausted"));
}while (opcode->name);
/* Register declaration. */
- arc_reg_hash = hash_new ();
+ arc_reg_hash = str_htab_create ();
if (arc_reg_hash == NULL)
as_fatal (_("Virtual memory exhausted"));
memset (&arc_last_insns[0], 0, sizeof (arc_last_insns));
/* Aux register declaration. */
- arc_aux_hash = hash_new ();
+ arc_aux_hash = str_htab_create ();
if (arc_aux_hash == NULL)
as_fatal (_("Virtual memory exhausted"));
unsigned int i;
for (i = 0; i < arc_num_aux_regs; i++, auxr++)
{
- const char *retval;
-
if (!(auxr->cpu & selected_cpu.flags))
continue;
&& !check_cpu_feature (auxr->subclass))
continue;
- retval = hash_insert (arc_aux_hash, auxr->name, (void *) auxr);
- if (retval)
- as_fatal (_("internal error: can't hash aux register '%s': %s"),
- auxr->name, retval);
+ str_hash_insert (arc_aux_hash, auxr->name, (void *) auxr);
}
/* Address type declaration. */
- arc_addrtype_hash = hash_new ();
+ arc_addrtype_hash = str_htab_create ();
if (arc_addrtype_hash == NULL)
as_fatal (_("Virtual memory exhausted"));
&& e->X_md == O_absent)
return FALSE;
- sym = hash_find (arc_reg_hash, name);
+ sym = str_hash_find (arc_reg_hash, name);
if (sym)
{
e->X_op = O_register;
return TRUE;
}
- sym = hash_find (arc_addrtype_hash, name);
+ sym = str_hash_find (arc_addrtype_hash, name);
if (sym)
{
e->X_op = O_addrtype;
{
struct symbol *sym;
- sym = hash_find (arc_reg_hash, regname);
+ sym = str_hash_find (arc_reg_hash, regname);
if (sym)
return S_GET_VALUE (sym);
{
extRegister_t ereg;
struct arc_aux_reg *auxr;
- const char *retval;
struct arc_flag_operand *ccode;
memset (&ereg, 0, sizeof (ereg));
auxr->cpu = selected_cpu.flags;
auxr->subclass = NONE;
auxr->address = ereg.number;
- retval = hash_insert (arc_aux_hash, auxr->name, (void *) auxr);
- if (retval)
- as_fatal (_("internal error: can't hash aux register '%s': %s"),
- auxr->name, retval);
+ str_hash_insert (arc_aux_hash, auxr->name, (void *) auxr);
break;
case EXT_COND_CODE:
/* Condition code. */
#define BAD_EL_TYPE _("bad element type for instruction")
#define MVE_BAD_QREG _("MVE vector register Q[0..7] expected")
-static struct hash_control * arm_ops_hsh;
-static struct hash_control * arm_cond_hsh;
-static struct hash_control * arm_vcond_hsh;
-static struct hash_control * arm_shift_hsh;
-static struct hash_control * arm_psr_hsh;
-static struct hash_control * arm_v7m_psr_hsh;
-static struct hash_control * arm_reg_hsh;
-static struct hash_control * arm_reloc_hsh;
-static struct hash_control * arm_barrier_opt_hsh;
+static htab_t arm_ops_hsh;
+static htab_t arm_cond_hsh;
+static htab_t arm_vcond_hsh;
+static htab_t arm_shift_hsh;
+static htab_t arm_psr_hsh;
+static htab_t arm_v7m_psr_hsh;
+static htab_t arm_reg_hsh;
+static htab_t arm_reloc_hsh;
+static htab_t arm_barrier_opt_hsh;
/* Stuff needed to resolve the label ambiguity
As:
p++;
while (ISALPHA (*p) || ISDIGIT (*p) || *p == '_');
- reg = (struct reg_entry *) hash_find_n (arm_reg_hsh, start, p - start);
+ reg = (struct reg_entry *) str_hash_find_n (arm_reg_hsh, start, p - start);
if (!reg)
return NULL;
return -1;
if ((r = (struct reloc_entry *)
- hash_find_n (arm_reloc_hsh, p, q - p)) == NULL)
+ str_hash_find_n (arm_reloc_hsh, p, q - p)) == NULL)
return -1;
*str = q + 1;
struct reg_entry *new_reg;
const char *name;
- if ((new_reg = (struct reg_entry *) hash_find (arm_reg_hsh, str)) != 0)
+ if ((new_reg = (struct reg_entry *) str_hash_find (arm_reg_hsh, str)) != 0)
{
if (new_reg->builtin)
as_warn (_("ignoring attempt to redefine built-in register '%s'"), str);
new_reg->builtin = FALSE;
new_reg->neon = NULL;
- if (hash_insert (arm_reg_hsh, name, (void *) new_reg))
- abort ();
+ str_hash_insert (arm_reg_hsh, name, new_reg);
return new_reg;
}
if (*oldname == '\0')
return FALSE;
- old = (struct reg_entry *) hash_find (arm_reg_hsh, oldname);
+ old = (struct reg_entry *) str_hash_find (arm_reg_hsh, oldname);
if (!old)
{
as_warn (_("unknown register '%s' -- .req ignored"), oldname);
as_bad (_("invalid syntax for .unreq directive"));
else
{
- struct reg_entry *reg = (struct reg_entry *) hash_find (arm_reg_hsh,
+ struct reg_entry *reg = (struct reg_entry *) str_hash_find (arm_reg_hsh,
name);
if (!reg)
char * p;
char * nbuf;
- hash_delete (arm_reg_hsh, name, FALSE);
+ str_hash_delete (arm_reg_hsh, name);
free ((char *) reg->name);
free (reg->neon);
free (reg);
nbuf = strdup (name);
for (p = nbuf; *p; p++)
*p = TOUPPER (*p);
- reg = (struct reg_entry *) hash_find (arm_reg_hsh, nbuf);
+ reg = (struct reg_entry *) str_hash_find (arm_reg_hsh, nbuf);
if (reg)
{
- hash_delete (arm_reg_hsh, nbuf, FALSE);
+ str_hash_delete (arm_reg_hsh, nbuf);
free ((char *) reg->name);
free (reg->neon);
free (reg);
for (p = nbuf; *p; p++)
*p = TOLOWER (*p);
- reg = (struct reg_entry *) hash_find (arm_reg_hsh, nbuf);
+ reg = (struct reg_entry *) str_hash_find (arm_reg_hsh, nbuf);
if (reg)
{
- hash_delete (arm_reg_hsh, nbuf, FALSE);
+ str_hash_delete (arm_reg_hsh, nbuf);
free ((char *) reg->name);
free (reg->neon);
free (reg);
return FAIL;
}
- shift_name = (const struct asm_shift_name *) hash_find_n (arm_shift_hsh, *str,
+ shift_name = (const struct asm_shift_name *) str_hash_find_n (arm_shift_hsh, *str,
p - *str);
if (shift_name == NULL)
|| strncasecmp (start, "psr", 3) == 0)
p = start + strcspn (start, "rR") + 1;
- psr = (const struct asm_psr *) hash_find_n (arm_v7m_psr_hsh, start,
+ psr = (const struct asm_psr *) str_hash_find_n (arm_v7m_psr_hsh, start,
p - start);
if (!psr)
}
else
{
- psr = (const struct asm_psr *) hash_find_n (arm_psr_hsh, start,
+ psr = (const struct asm_psr *) str_hash_find_n (arm_psr_hsh, start,
p - start);
if (!psr)
goto error;
n++;
}
- c = (const struct asm_cond *) hash_find_n (arm_cond_hsh, cond, n);
+ c = (const struct asm_cond *) str_hash_find_n (arm_cond_hsh, cond, n);
if (!c)
{
inst.error = _("condition required");
while (ISALPHA (*q))
q++;
- o = (const struct asm_barrier_opt *) hash_find_n (arm_barrier_opt_hsh, p,
+ o = (const struct asm_barrier_opt *) str_hash_find_n (arm_barrier_opt_hsh, p,
q - p);
if (!o)
return FAIL;
{
const struct asm_opcode *opcode;
- opcode = (const struct asm_opcode *) hash_find (arm_ops_hsh, opname);
+ opcode = (const struct asm_opcode *) str_hash_find (arm_ops_hsh, opname);
if (!opcode)
abort ();
*str = end;
/* Look for unaffixed or special-case affixed mnemonic. */
- opcode = (const struct asm_opcode *) hash_find_n (arm_ops_hsh, base,
+ opcode = (const struct asm_opcode *) str_hash_find_n (arm_ops_hsh, base,
end - base);
if (opcode)
{
if (warn_on_deprecated && unified_syntax)
as_tsktsk (_("conditional infixes are deprecated in unified syntax"));
affix = base + (opcode->tag - OT_odd_infix_0);
- cond = (const struct asm_cond *) hash_find_n (arm_cond_hsh, affix, 2);
+ cond = (const struct asm_cond *) str_hash_find_n (arm_cond_hsh, affix, 2);
gas_assert (cond);
inst.cond = cond->value;
if (end - base < 2)
return NULL;
affix = end - 1;
- cond = (const struct asm_cond *) hash_find_n (arm_vcond_hsh, affix, 1);
- opcode = (const struct asm_opcode *) hash_find_n (arm_ops_hsh, base,
+ cond = (const struct asm_cond *) str_hash_find_n (arm_vcond_hsh, affix, 1);
+ opcode = (const struct asm_opcode *) str_hash_find_n (arm_ops_hsh, base,
affix - base);
/* If this opcode can not be vector predicated then don't accept it with a
vector predication code. */
/* Look for suffixed mnemonic. */
affix = end - 2;
- cond = (const struct asm_cond *) hash_find_n (arm_cond_hsh, affix, 2);
- opcode = (const struct asm_opcode *) hash_find_n (arm_ops_hsh, base,
+ cond = (const struct asm_cond *) str_hash_find_n (arm_cond_hsh, affix, 2);
+ opcode = (const struct asm_opcode *) str_hash_find_n (arm_ops_hsh, base,
affix - base);
}
/* Look for infixed mnemonic in the usual position. */
affix = base + 3;
- cond = (const struct asm_cond *) hash_find_n (arm_cond_hsh, affix, 2);
+ cond = (const struct asm_cond *) str_hash_find_n (arm_cond_hsh, affix, 2);
if (!cond)
return NULL;
memcpy (save, affix, 2);
memmove (affix, affix + 2, (end - affix) - 2);
- opcode = (const struct asm_opcode *) hash_find_n (arm_ops_hsh, base,
+ opcode = (const struct asm_opcode *) str_hash_find_n (arm_ops_hsh, base,
(end - base) - 2);
memmove (affix + 2, affix, (end - affix) - 2);
memcpy (affix, save, 2);
for (p = nbuf; *p; p++)
*p = TOLOWER (*p);
- if (hash_find (arm_ops_hsh, nbuf) != NULL)
+ if (str_hash_find (arm_ops_hsh, nbuf) != NULL)
{
- static struct hash_control * already_warned = NULL;
+ static htab_t already_warned = NULL;
if (already_warned == NULL)
- already_warned = hash_new ();
+ already_warned = str_htab_create ();
/* Only warn about the symbol once. To keep the code
- simple we let hash_insert do the lookup for us. */
- if (hash_insert (already_warned, nbuf, NULL) == NULL)
- as_warn (_("[-mwarn-syms]: Assignment makes a symbol match an ARM instruction: %s"), name);
+ simple we let str_hash_insert do the lookup for us. */
+ if (str_hash_find (already_warned, nbuf) == NULL)
+ {
+ as_warn (_("[-mwarn-syms]: Assignment makes a symbol match an ARM instruction: %s"), name);
+ str_hash_insert (already_warned, nbuf, NULL);
+ }
}
else
free (nbuf);
unsigned mach;
unsigned int i;
- if ( (arm_ops_hsh = hash_new ()) == NULL
- || (arm_cond_hsh = hash_new ()) == NULL
- || (arm_vcond_hsh = hash_new ()) == NULL
- || (arm_shift_hsh = hash_new ()) == NULL
- || (arm_psr_hsh = hash_new ()) == NULL
- || (arm_v7m_psr_hsh = hash_new ()) == NULL
- || (arm_reg_hsh = hash_new ()) == NULL
- || (arm_reloc_hsh = hash_new ()) == NULL
- || (arm_barrier_opt_hsh = hash_new ()) == NULL)
+ if ( (arm_ops_hsh = str_htab_create ()) == NULL
+ || (arm_cond_hsh = str_htab_create ()) == NULL
+ || (arm_vcond_hsh = str_htab_create ()) == NULL
+ || (arm_shift_hsh = str_htab_create ()) == NULL
+ || (arm_psr_hsh = str_htab_create ()) == NULL
+ || (arm_v7m_psr_hsh = str_htab_create ()) == NULL
+ || (arm_reg_hsh = str_htab_create ()) == NULL
+ || (arm_reloc_hsh = str_htab_create ()) == NULL
+ || (arm_barrier_opt_hsh = str_htab_create ()) == NULL)
as_fatal (_("virtual memory exhausted"));
for (i = 0; i < sizeof (insns) / sizeof (struct asm_opcode); i++)
- hash_insert (arm_ops_hsh, insns[i].template_name, (void *) (insns + i));
+ if (str_hash_find (arm_ops_hsh, insns[i].template_name) == NULL)
+ str_hash_insert (arm_ops_hsh, insns[i].template_name, (void *) (insns + i));
for (i = 0; i < sizeof (conds) / sizeof (struct asm_cond); i++)
- hash_insert (arm_cond_hsh, conds[i].template_name, (void *) (conds + i));
+ str_hash_insert (arm_cond_hsh, conds[i].template_name, (void *) (conds + i));
for (i = 0; i < sizeof (vconds) / sizeof (struct asm_cond); i++)
- hash_insert (arm_vcond_hsh, vconds[i].template_name, (void *) (vconds + i));
+ str_hash_insert (arm_vcond_hsh, vconds[i].template_name, (void *) (vconds + i));
for (i = 0; i < sizeof (shift_names) / sizeof (struct asm_shift_name); i++)
- hash_insert (arm_shift_hsh, shift_names[i].name, (void *) (shift_names + i));
+ str_hash_insert (arm_shift_hsh, shift_names[i].name, (void *) (shift_names + i));
for (i = 0; i < sizeof (psrs) / sizeof (struct asm_psr); i++)
- hash_insert (arm_psr_hsh, psrs[i].template_name, (void *) (psrs + i));
+ str_hash_insert (arm_psr_hsh, psrs[i].template_name, (void *) (psrs + i));
for (i = 0; i < sizeof (v7m_psrs) / sizeof (struct asm_psr); i++)
- hash_insert (arm_v7m_psr_hsh, v7m_psrs[i].template_name,
+ str_hash_insert (arm_v7m_psr_hsh, v7m_psrs[i].template_name,
(void *) (v7m_psrs + i));
for (i = 0; i < sizeof (reg_names) / sizeof (struct reg_entry); i++)
- hash_insert (arm_reg_hsh, reg_names[i].name, (void *) (reg_names + i));
+ str_hash_insert (arm_reg_hsh, reg_names[i].name, (void *) (reg_names + i));
for (i = 0;
i < sizeof (barrier_opt_names) / sizeof (struct asm_barrier_opt);
i++)
- hash_insert (arm_barrier_opt_hsh, barrier_opt_names[i].template_name,
+ str_hash_insert (arm_barrier_opt_hsh, barrier_opt_names[i].template_name,
(void *) (barrier_opt_names + i));
#ifdef OBJ_ELF
for (i = 0; i < ARRAY_SIZE (reloc_names); i++)
/* This makes encode_branch() use the EABI versions of this relocation. */
entry->reloc = BFD_RELOC_UNUSED;
- hash_insert (arm_reloc_hsh, entry->name, (void *) entry);
+ str_hash_insert (arm_reloc_hsh, entry->name, (void *) entry);
}
#endif
} mod_index;
/* Opcode hash table. */
-static struct hash_control *avr_hash;
+static htab_t avr_hash;
/* Reloc modifiers hash control (hh8,hi8,lo8,pm_xx). */
-static struct hash_control *avr_mod_hash;
+static htab_t avr_mod_hash;
/* Whether some opcode does not change SREG. */
-static struct hash_control *avr_no_sreg_hash;
+static htab_t avr_no_sreg_hash;
static const char* const avr_no_sreg[] =
{
unsigned int i;
struct avr_opcodes_s *opcode;
- avr_hash = hash_new ();
+ avr_hash = str_htab_create ();
/* Insert unique names into hash table. This hash table then provides a
quick index to the first opcode with a particular name in the opcode
table. */
for (opcode = avr_opcodes; opcode->name; opcode++)
- hash_insert (avr_hash, opcode->name, (char *) opcode);
+ if (str_hash_find (avr_hash, opcode->name) == NULL)
+ str_hash_insert (avr_hash, opcode->name, (char *) opcode);
- avr_mod_hash = hash_new ();
+ avr_mod_hash = str_htab_create ();
for (i = 0; i < ARRAY_SIZE (exp_mod); ++i)
{
mod_index m;
m.index = i + 10;
- hash_insert (avr_mod_hash, EXP_MOD_NAME (i), m.ptr);
+ str_hash_find (avr_mod_hash, EXP_MOD_NAME (i));
+ str_hash_insert (avr_mod_hash, EXP_MOD_NAME (i), m.ptr);
}
- avr_no_sreg_hash = hash_new ();
+ avr_no_sreg_hash = str_htab_create ();
for (i = 0; i < ARRAY_SIZE (avr_no_sreg); ++i)
{
- gas_assert (hash_find (avr_hash, avr_no_sreg[i]));
- hash_insert (avr_no_sreg_hash, avr_no_sreg[i], (char*) 4 /* dummy */);
+ gas_assert (str_hash_find (avr_hash, avr_no_sreg[i]));
+ str_hash_insert (avr_no_sreg_hash, avr_no_sreg[i], (char*) 4 /* dummy */);
}
- avr_gccisr_opcode = (struct avr_opcodes_s*) hash_find (avr_hash, "__gcc_isr");
+ avr_gccisr_opcode = (struct avr_opcodes_s*) str_hash_find (avr_hash, "__gcc_isr");
gas_assert (avr_gccisr_opcode);
bfd_set_arch_mach (stdoutput, TARGET_ARCH, avr_mcu->mach);
{
mod_index m;
- m.ptr = hash_find (avr_mod_hash, op);
+ m.ptr = str_hash_find (avr_mod_hash, op);
mod = m.index;
if (mod)
if (!op[0])
as_bad (_("can't find opcode "));
- opcode = (struct avr_opcodes_s *) hash_find (avr_hash, op);
+ opcode = (struct avr_opcodes_s *) str_hash_find (avr_hash, op);
if (opcode && !avr_opt.all_opcodes)
{
/* SREG: Look up instructions that don't clobber SREG. */
if (!avr_isr.need_sreg
- && !hash_find (avr_no_sreg_hash, opcode->name))
+ && !str_hash_find (avr_no_sreg_hash, opcode->name))
{
avr_isr.need_sreg = 1;
}
const int sreg = 0x3f;
unsigned bin = 0;
const struct avr_opcodes_s *op
- = (struct avr_opcodes_s*) hash_find (avr_hash, insn);
+ = (struct avr_opcodes_s*) str_hash_find (avr_hash, insn);
/* We only have to deal with: IN, OUT, PUSH, POP, CLR, LDI 0. All of
these deal with at least one Reg and are 1-word instructions. */
op_err;
/* Opcode mnemonics hash table. */
-static struct hash_control *cr16_inst_hash;
+static htab_t cr16_inst_hash;
/* CR16 registers hash table. */
-static struct hash_control *reg_hash;
+static htab_t reg_hash;
/* CR16 register pair hash table. */
-static struct hash_control *regp_hash;
+static htab_t regp_hash;
/* CR16 processor registers hash table. */
-static struct hash_control *preg_hash;
+static htab_t preg_hash;
/* CR16 processor registers 32 bit hash table. */
-static struct hash_control *pregp_hash;
+static htab_t pregp_hash;
/* Current instruction we're assembling. */
const inst *instruction;
{
const reg_entry *rreg;
- rreg = (const reg_entry *) hash_find (reg_hash, reg_name);
+ rreg = (const reg_entry *) str_hash_find (reg_hash, reg_name);
if (rreg != NULL)
return rreg->value.reg_val;
tmp_rp[0] = '(';
strcat (tmp_rp, reg_name);
strcat (tmp_rp,")");
- rreg = (const reg_entry *) hash_find (regp_hash, tmp_rp);
+ rreg = (const reg_entry *) str_hash_find (regp_hash, tmp_rp);
}
else
- rreg = (const reg_entry *) hash_find (regp_hash, reg_name);
+ rreg = (const reg_entry *) str_hash_find (regp_hash, reg_name);
if (rreg != NULL)
return rreg->value.reg_val;
{
const reg_entry *rreg;
- rreg = (const reg_entry *) hash_find (reg_hash, reg_name);
+ rreg = (const reg_entry *) str_hash_find (reg_hash, reg_name);
if ((rreg != NULL)
&& ((rreg->value.reg_val == 12) || (rreg->value.reg_val == 13)))
{
const reg_entry *rreg;
- rreg = (const reg_entry *) hash_find (regp_hash, reg_name);
+ rreg = (const reg_entry *) str_hash_find (regp_hash, reg_name);
if (rreg != NULL)
{
{
const reg_entry *prreg;
- prreg = (const reg_entry *) hash_find (preg_hash, preg_name);
+ prreg = (const reg_entry *) str_hash_find (preg_hash, preg_name);
if (prreg != NULL)
return prreg->value.preg_val;
{
const reg_entry *prreg;
- prreg = (const reg_entry *) hash_find (pregp_hash, preg_name);
+ prreg = (const reg_entry *) str_hash_find (pregp_hash, preg_name);
if (prreg != NULL)
return prreg->value.preg_val;
}
static void
-initialise_reg_hash_table (struct hash_control ** hash_table,
+initialise_reg_hash_table (htab_t * hash_table,
const reg_entry * register_table,
const unsigned int num_entries)
{
const reg_entry * rreg;
- const char *hashret;
-
- if ((* hash_table = hash_new ()) == NULL)
+ if ((* hash_table = str_htab_create ()) == NULL)
as_fatal (_("Virtual memory exhausted"));
for (rreg = register_table;
rreg < (register_table + num_entries);
rreg++)
- {
- hashret = hash_insert (* hash_table, rreg->name, (char *) rreg);
- if (hashret)
- as_fatal (_("Internal Error: Can't hash %s: %s"),
- rreg->name, hashret);
- }
+ str_hash_insert (* hash_table, rreg->name, (char *) rreg);
}
/* This function is called once, at assembler startup time. This should
int i = 0;
/* Set up a hash table for the instructions. */
- if ((cr16_inst_hash = hash_new ()) == NULL)
+ if ((cr16_inst_hash = str_htab_create ()) == NULL)
as_fatal (_("Virtual memory exhausted"));
while (cr16_instruction[i].mnemonic != NULL)
{
- const char *hashret;
const char *mnemonic = cr16_instruction[i].mnemonic;
- hashret = hash_insert (cr16_inst_hash, mnemonic,
- (char *)(cr16_instruction + i));
-
- if (hashret != NULL && *hashret != '\0')
- as_fatal (_("Can't hash `%s': %s\n"), cr16_instruction[i].mnemonic,
- *hashret == 0 ? _("(unknown reason)") : hashret);
-
+ str_hash_insert (cr16_inst_hash, mnemonic,
+ (char *)(cr16_instruction + i));
/* Insert unique names into hash table. The CR16 instruction set
has many identical opcode names that have different opcodes based
on the operands. This hash table then provides a quick index to
ins cr16_ins;
/* Find the instruction. */
- instruction = (const inst *) hash_find (cr16_inst_hash, op);
+ instruction = (const inst *) str_hash_find (cr16_inst_hash, op);
if (instruction == NULL)
{
as_bad (_("Unknown opcode: `%s'"), op);
{
strcpy (param1, param);
/* Find the instruction. */
- instruction = (const inst *) hash_find (cr16_inst_hash, op);
+ instruction = (const inst *) str_hash_find (cr16_inst_hash, op);
parse_operands (&cr16_ins, param1);
if (((&cr16_ins)->arg[0].type == arg_ic)
&& ((&cr16_ins)->arg[0].constant >= 0))
static char *cris_insn_first_word_frag (void);
/* Handle to the opcode hash table. */
-static struct hash_control *op_hash = NULL;
+static htab_t op_hash = NULL;
/* If we target cris-axis-linux-gnu (as opposed to generic cris-axis-elf),
we default to no underscore and required register-prefixes. The
void
md_begin (void)
{
- const char *hashret = NULL;
int i = 0;
/* Set up a hash table for the instructions. */
- op_hash = hash_new ();
+ op_hash = str_htab_create ();
if (op_hash == NULL)
as_fatal (_("Virtual memory exhausted"));
continue;
}
- /* Need to cast to get rid of "const". FIXME: Fix hash_insert instead. */
- hashret = hash_insert (op_hash, name, (void *) &cris_opcodes[i]);
-
- if (hashret != NULL && *hashret != '\0')
- as_fatal (_("Can't hash `%s': %s\n"), cris_opcodes[i].name,
- *hashret == 0 ? _("(unknown reason)") : hashret);
+ /* Need to cast to get rid of "const". FIXME: Fix str_hash_insert instead. */
+ str_hash_insert (op_hash, name, (void *) &cris_opcodes[i]);
do
{
if (cris_opcodes[i].match & cris_opcodes[i].lose)
}
/* Find the instruction. */
- instruction = (struct cris_opcode *) hash_find (op_hash, insn_text);
+ instruction = (struct cris_opcode *) str_hash_find (op_hash, insn_text);
if (instruction == NULL)
{
as_bad (_("Unknown opcode: `%s'"), insn_text);
op_err;
/* Opcode mnemonics hash table. */
-static struct hash_control *crx_inst_hash;
+static htab_t crx_inst_hash;
/* CRX registers hash table. */
-static struct hash_control *reg_hash;
+static htab_t reg_hash;
/* CRX coprocessor registers hash table. */
-static struct hash_control *copreg_hash;
+static htab_t copreg_hash;
/* Current instruction we're assembling. */
static const inst *instruction;
{
const reg_entry *rreg;
- rreg = (const reg_entry *) hash_find (reg_hash, reg_name);
+ rreg = (const reg_entry *) str_hash_find (reg_hash, reg_name);
if (rreg != NULL)
return rreg->value.reg_val;
{
const reg_entry *coreg;
- coreg = (const reg_entry *) hash_find (copreg_hash, copreg_name);
+ coreg = (const reg_entry *) str_hash_find (copreg_hash, copreg_name);
if (coreg != NULL)
return coreg->value.copreg_val;
void
md_begin (void)
{
- const char *hashret = NULL;
int i = 0;
/* Set up a hash table for the instructions. */
- if ((crx_inst_hash = hash_new ()) == NULL)
+ if ((crx_inst_hash = str_htab_create ()) == NULL)
as_fatal (_("Virtual memory exhausted"));
while (crx_instruction[i].mnemonic != NULL)
{
const char *mnemonic = crx_instruction[i].mnemonic;
- hashret = hash_insert (crx_inst_hash, mnemonic,
+ str_hash_insert (crx_inst_hash, mnemonic,
(void *) &crx_instruction[i]);
- if (hashret != NULL && *hashret != '\0')
- as_fatal (_("Can't hash `%s': %s\n"), crx_instruction[i].mnemonic,
- *hashret == 0 ? _("(unknown reason)") : hashret);
-
/* Insert unique names into hash table. The CRX instruction set
has many identical opcode names that have different opcodes based
on the operands. This hash table then provides a quick index to
}
/* Initialize reg_hash hash table. */
- if ((reg_hash = hash_new ()) == NULL)
+ if ((reg_hash = str_htab_create ()) == NULL)
as_fatal (_("Virtual memory exhausted"));
{
for (regtab = crx_regtab;
regtab < (crx_regtab + NUMREGS); regtab++)
- {
- hashret = hash_insert (reg_hash, regtab->name, (void *) regtab);
- if (hashret)
- as_fatal (_("Internal error: Can't hash %s: %s"),
- regtab->name,
- hashret);
- }
+ str_hash_insert (reg_hash, regtab->name, (void *) regtab);
}
/* Initialize copreg_hash hash table. */
- if ((copreg_hash = hash_new ()) == NULL)
+ if ((copreg_hash = str_htab_create ()) == NULL)
as_fatal (_("Virtual memory exhausted"));
{
for (copregtab = crx_copregtab; copregtab < (crx_copregtab + NUMCOPREGS);
copregtab++)
- {
- hashret = hash_insert (copreg_hash, copregtab->name,
- (void *) copregtab);
- if (hashret)
- as_fatal (_("Internal error: Can't hash %s: %s"),
- copregtab->name,
- hashret);
- }
+ str_hash_insert (copreg_hash, copregtab->name,
+ (void *) copregtab);
}
/* Set linkrelax here to avoid fixups in most sections. */
linkrelax = 1;
*param++ = '\0';
/* Find the instruction. */
- instruction = (const inst *) hash_find (crx_inst_hash, op);
+ instruction = (const inst *) str_hash_find (crx_inst_hash, op);
if (instruction == NULL)
{
as_bad (_("Unknown opcode: `%s'"), op);
static struct csky_insn_info csky_insn;
-static struct hash_control *csky_opcodes_hash;
-static struct hash_control *csky_macros_hash;
+static htab_t csky_opcodes_hash;
+static htab_t csky_macros_hash;
static struct csky_macro_info v1_macros_table[] =
{
}
/* Establish hash table for opcodes and macros. */
- csky_macros_hash = hash_new ();
- csky_opcodes_hash = hash_new ();
+ csky_macros_hash = str_htab_create ();
+ csky_opcodes_hash = str_htab_create ();
for ( ; opcode->mnemonic != NULL; opcode++)
if ((isa_flag & (opcode->isa_flag16 | opcode->isa_flag32)) != 0)
- hash_insert (csky_opcodes_hash, opcode->mnemonic, (char *)opcode);
+ str_hash_insert (csky_opcodes_hash, opcode->mnemonic, (char *)opcode);
for ( ; macro->name != NULL; macro++)
if ((isa_flag & macro->isa_flag) != 0)
- hash_insert (csky_macros_hash, macro->name, (char *)macro);
+ str_hash_insert (csky_macros_hash, macro->name, (char *)macro);
if (do_nolrw && (isa_flag & CSKYV2_ISA_1E2) != 0)
- hash_insert (csky_macros_hash,
+ str_hash_insert (csky_macros_hash,
v2_lrw_macro_opcode.name,
(char *)&v2_lrw_macro_opcode);
/* Set e_flag to ELF Head. */
csky_insn.number = csky_count_operands (opcode_end);
/* Find hash by name in csky_macros_hash and csky_opcodes_hash. */
- csky_insn.macro = (struct csky_macro_info *) hash_find (csky_macros_hash,
+ csky_insn.macro = (struct csky_macro_info *) str_hash_find (csky_macros_hash,
macro_name);
- csky_insn.opcode = (struct csky_opcode *) hash_find (csky_opcodes_hash,
+ csky_insn.opcode = (struct csky_opcode *) str_hash_find (csky_opcodes_hash,
name);
if (csky_insn.macro == NULL && csky_insn.opcode == NULL)
{
const char *name = "movi";
csky_insn.opcode = (struct csky_opcode *)
- hash_find (csky_opcodes_hash, name);
+ str_hash_find (csky_opcodes_hash, name);
csky_insn.val[csky_insn.idx - 1] = 1 << val;
}
return TRUE;
{
const char *name = "movi";
csky_insn.opcode = (struct csky_opcode *)
- hash_find (csky_opcodes_hash, name);
+ str_hash_find (csky_opcodes_hash, name);
as_warn (_("translating mgeni to movi"));
}
else
{
const char *op_movi = "movi";
csky_insn.opcode = (struct csky_opcode *)
- hash_find (csky_opcodes_hash, op_movi);
+ str_hash_find (csky_opcodes_hash, op_movi);
if (csky_insn.opcode == NULL)
return FALSE;
csky_insn.val[csky_insn.idx - 1] = (1 << mask_val) - 1;
{
const char *op_movi = "movi";
csky_insn.opcode = (struct csky_opcode *)
- hash_find (csky_opcodes_hash, op_movi);
+ str_hash_find (csky_opcodes_hash, op_movi);
if (csky_insn.opcode == NULL)
return FALSE;
csky_insn.val[csky_insn.idx - 1] = (1 << (mask_val + 1)) - 1;
/* Using jsri instruction. */
const char *name = "jsri";
csky_insn.opcode = (struct csky_opcode *)
- hash_find (csky_opcodes_hash, name);
+ str_hash_find (csky_opcodes_hash, name);
csky_insn.opcode_idx = 0;
csky_insn.isize = 2;
{
const char *name = "addc";
csky_insn.opcode
- = (struct csky_opcode *) hash_find (csky_opcodes_hash, name);
+ = (struct csky_opcode *) str_hash_find (csky_opcodes_hash, name);
csky_insn.opcode_idx = 0;
if (csky_insn.isize == 2)
{
val >>= 16;
}
csky_insn.opcode
- = (struct csky_opcode *) hash_find (csky_opcodes_hash, name);
+ = (struct csky_opcode *) str_hash_find (csky_opcodes_hash, name);
csky_insn.opcode_idx = 0;
csky_insn.val[1] = val;
{
const char *name = "nor";
csky_insn.opcode
- = (struct csky_opcode *) hash_find (csky_opcodes_hash, name);
+ = (struct csky_opcode *) str_hash_find (csky_opcodes_hash, name);
csky_insn.opcode_idx = 0;
if (csky_insn.number == 1)
{
size_t md_longopts_size = sizeof (md_longopts);
/* Opcode hash table. */
-static struct hash_control *d10v_hash;
+static htab_t d10v_hash;
/* Do a binary search of the d10v_predefined_registers array to see if
NAME is a valid register name. Return the register number from the
{
const char *prev_name = "";
struct d10v_opcode *opcode;
- d10v_hash = hash_new ();
+ d10v_hash = str_htab_create ();
/* Insert unique names into hash table. The D10v instruction set
has many identical opcode names that have different opcodes based
if (strcmp (prev_name, opcode->name))
{
prev_name = (char *) opcode->name;
- hash_insert (d10v_hash, opcode->name, (char *) opcode);
+ str_hash_insert (d10v_hash, opcode->name, (char *) opcode);
}
}
return -1;
/* Find the first opcode with the proper name. */
- *opcode = (struct d10v_opcode *) hash_find (d10v_hash, name);
+ *opcode = (struct d10v_opcode *) str_hash_find (d10v_hash, name);
if (*opcode == NULL)
return -1;
{
struct d10v_opcode *rep, *repi;
- rep = (struct d10v_opcode *) hash_find (d10v_hash, "rep");
- repi = (struct d10v_opcode *) hash_find (d10v_hash, "repi");
+ rep = (struct d10v_opcode *) str_hash_find (d10v_hash, "rep");
+ repi = (struct d10v_opcode *) str_hash_find (d10v_hash, "repi");
if ((insn & FM11) == FM11
&& ((repi != NULL
&& (insn & repi->mask) == (unsigned) repi->opcode)
size_t md_longopts_size = sizeof (md_longopts);
/* Opcode hash table. */
-static struct hash_control *d30v_hash;
+static htab_t d30v_hash;
/* Do a binary search of the pre_defined_registers array to see if
NAME is a valid register name. Return the register number from the
md_begin (void)
{
struct d30v_opcode *opcode;
- d30v_hash = hash_new ();
+ d30v_hash = str_htab_create ();
/* Insert opcode names into a hash table. */
for (opcode = (struct d30v_opcode *) d30v_opcode_table; opcode->name; opcode++)
- hash_insert (d30v_hash, opcode->name, (char *) opcode);
+ str_hash_insert (d30v_hash, opcode->name, (char *) opcode);
fixups = &FixUps[0];
FixUps[0].next = &FixUps[1];
}
/* Find the first opcode with the proper name. */
- opcode->op = (struct d30v_opcode *) hash_find (d30v_hash, name);
+ opcode->op = (struct d30v_opcode *) str_hash_find (d30v_hash, name);
if (opcode->op == NULL)
{
as_bad (_("unknown opcode: %s"), name);
#define RELOC_DLX_VTENTRY BFD_RELOC_VTABLE_ENTRY
/* handle of the OPCODE hash table */
-static struct hash_control *op_hash = NULL;
+static htab_t op_hash = NULL;
struct machine_it
{
void
md_begin (void)
{
- const char *retval = NULL;
- int lose = 0;
unsigned int i;
/* Create a new hash table. */
- op_hash = hash_new ();
+ op_hash = str_htab_create ();
/* Hash up all the opcodes for fast use later. */
for (i = 0; i < num_dlx_opcodes; i++)
{
const char *name = machine_opcodes[i].name;
-
- retval = hash_insert (op_hash, name, (void *) &machine_opcodes[i]);
-
- if (retval != NULL)
- {
- fprintf (stderr, _("internal error: can't hash `%s': %s\n"),
- machine_opcodes[i].name, retval);
- lose = 1;
- }
+ str_hash_insert (op_hash, name, (void *) &machine_opcodes[i]);
}
- if (lose)
- as_fatal (_("Broken assembler. No assembly attempted."));
-
define_some_regs ();
}
}
/* Hash the opcode, insn will have the string from opcode table. */
- if ((insn = (struct machine_opcode *) hash_find (op_hash, str)) == NULL)
+ if ((insn = (struct machine_opcode *) str_hash_find (op_hash, str)) == NULL)
{
/* Handle the ret and return macro here. */
if ((strcmp (str, "ret") == 0) || (strcmp (str, "return") == 0))
const char line_comment_chars[] = "#";
static int pending_reloc;
-static struct hash_control *opcode_hash_control;
+static htab_t opcode_hash_control;
static valueT md_chars_to_number (char * buf, int n);
md_begin (void)
{
const ft32_opc_info_t *opcode;
- opcode_hash_control = hash_new ();
+ opcode_hash_control = str_htab_create ();
/* Insert names into hash table. */
for (opcode = ft32_opc_info; opcode->name; opcode++)
- hash_insert (opcode_hash_control, opcode->name, (char *) opcode);
+ str_hash_insert (opcode_hash_control, opcode->name, (char *) opcode);
bfd_set_arch_mach (stdoutput, TARGET_ARCH, 0);
if (!norelax)
if (nlen == 0)
as_bad (_("can't find opcode "));
- opcode = (ft32_opc_info_t *) hash_find (opcode_hash_control, op_start);
+ opcode = (ft32_opc_info_t *) str_hash_find (opcode_hash_control, op_start);
*op_end = pend;
if (opcode == NULL)
or 0d1.2345e12. */
const char FLT_CHARS[] = "rRsSfFdDxXpP";
-static struct hash_control *opcode_hash_control; /* Opcode mnemonics. */
+static htab_t opcode_hash_control; /* Opcode mnemonics. */
/* This function is called once, at assembler startup time. This
should set up all the tables, etc. that the MD part of the assembler
if (!bfd_set_arch_mach (stdoutput, bfd_arch_h8300, default_mach))
as_warn (_("could not set architecture and machine"));
- opcode_hash_control = hash_new ();
+ opcode_hash_control = str_htab_create ();
prev_buffer[0] = 0;
nopcodes = sizeof (h8_opcodes) / sizeof (struct h8_opcode);
len = dst - buffer;
if (cmplen == 0)
cmplen = len;
- hash_insert (opcode_hash_control, buffer, (char *) pi);
+ str_hash_insert (opcode_hash_control, buffer, (char *) pi);
strcpy (prev_buffer, buffer);
idx++;
*slash = TOLOWER (*slash);
instruction = (const struct h8_instruction *)
- hash_find (opcode_hash_control, op_start);
+ str_hash_find (opcode_hash_control, op_start);
if (instruction == NULL)
{
static struct call_desc last_call_desc;
/* handle of the OPCODE hash table */
-static struct hash_control *op_hash = NULL;
+static htab_t op_hash = NULL;
/* These characters can be suffixes of opcode names and they may be
followed by meaningful whitespace. We don't include `,' and `!'
}
/* Look up the opcode in the hash table. */
- if ((insn = (struct pa_opcode *) hash_find (op_hash, str)) == NULL)
+ if ((insn = (struct pa_opcode *) str_hash_find (op_hash, str)) == NULL)
{
as_bad (_("Unknown opcode: `%s'"), str);
return;
void
md_begin (void)
{
- const char *retval = NULL;
int lose = 0;
unsigned int i = 0;
pa_spaces_begin ();
#endif
- op_hash = hash_new ();
+ op_hash = str_htab_create ();
while (i < NUMOPCODES)
{
const char *name = pa_opcodes[i].name;
- retval = hash_insert (op_hash, name, (struct pa_opcode *) &pa_opcodes[i]);
- if (retval != NULL && *retval != '\0')
- {
- as_fatal (_("Internal error: can't hash `%s': %s\n"), name, retval);
- lose = 1;
- }
+ str_hash_insert (op_hash, name, (void *)&pa_opcodes[i]);
do
{
extern char *input_line_pointer;
/* Hash table for instruction mnemonic lookup. */
-static struct hash_control *op_hash;
+static htab_t op_hash;
/* Hash table for register lookup. */
-static struct hash_control *reg_hash;
+static htab_t reg_hash;
\f
/* Various efficient no-op patterns for aligning code labels.
Note: Don't try to assemble the instructions in the comments.
void
md_begin (void)
{
- const char *hash_err;
-
/* Support pseudo prefixes like {disp32}. */
lex_type ['{'] = LEX_BEGIN_NAME;
/* Initialize op_hash hash table. */
- op_hash = hash_new ();
+ op_hash = str_htab_create ();
{
const insn_template *optab;
/* different name --> ship out current template list;
add to hash table; & begin anew. */
core_optab->end = optab;
- hash_err = hash_insert (op_hash,
- (optab - 1)->name,
- (void *) core_optab);
- if (hash_err)
- {
- as_fatal (_("can't hash %s: %s"),
- (optab - 1)->name,
- hash_err);
- }
+ str_hash_insert (op_hash, (optab - 1)->name, (void *) core_optab);
if (optab->name == NULL)
break;
core_optab = XNEW (templates);
}
/* Initialize reg_hash hash table. */
- reg_hash = hash_new ();
+ reg_hash = str_htab_create ();
{
const reg_entry *regtab;
unsigned int regtab_size = i386_regtab_size;
for (regtab = i386_regtab; regtab_size--; regtab++)
- {
- hash_err = hash_insert (reg_hash, regtab->reg_name, (void *) regtab);
- if (hash_err)
- as_fatal (_("can't hash %s: %s"),
- regtab->reg_name,
- hash_err);
- }
+ str_hash_insert (reg_hash, regtab->reg_name, (void *) regtab);
}
/* Fill in lexical tables: mnemonic_chars, operand_chars. */
void
i386_print_statistics (FILE *file)
{
- hash_print_statistics (file, "i386 opcode", op_hash);
- hash_print_statistics (file, "i386 register", reg_hash);
+ htab_print_statistics (file, "i386 opcode", op_hash);
+ htab_print_statistics (file, "i386 register", reg_hash);
}
\f
#ifdef DEBUG386
}
/* Look up instruction (or prefix) via hash table. */
- current_templates = (const templates *) hash_find (op_hash, mnemonic);
+ current_templates = (const templates *) str_hash_find (op_hash, mnemonic);
if (*l != END_OF_INSN
&& (!is_space_char (*l) || l[1] != END_OF_INSN)
goto check_suffix;
mnem_p = dot_p;
*dot_p = '\0';
- current_templates = (const templates *) hash_find (op_hash, mnemonic);
+ current_templates = (const templates *) str_hash_find (op_hash, mnemonic);
}
if (!current_templates)
case QWORD_MNEM_SUFFIX:
i.suffix = mnem_p[-1];
mnem_p[-1] = '\0';
- current_templates = (const templates *) hash_find (op_hash,
+ current_templates = (const templates *) str_hash_find (op_hash,
mnemonic);
break;
case SHORT_MNEM_SUFFIX:
{
i.suffix = mnem_p[-1];
mnem_p[-1] = '\0';
- current_templates = (const templates *) hash_find (op_hash,
+ current_templates = (const templates *) str_hash_find (op_hash,
mnemonic);
}
break;
else
i.suffix = LONG_MNEM_SUFFIX;
mnem_p[-1] = '\0';
- current_templates = (const templates *) hash_find (op_hash,
+ current_templates = (const templates *) str_hash_find (op_hash,
mnemonic);
}
break;
i.flags[j] = i.flags[j - 1];
}
i.op[0].regs
- = (const reg_entry *) hash_find (reg_hash, "xmm0");
+ = (const reg_entry *) str_hash_find (reg_hash, "xmm0");
i.types[0] = regxmm;
i.tm.operand_types[0] = regxmm;
&& current_templates->end[-1].operand_types[1]
.bitfield.baseindex))
op = 1;
- expected_reg = hash_find (reg_hash, di_si[addr_mode][op == es_op]);
+ expected_reg = (const reg_entry *)str_hash_find (reg_hash, di_si[addr_mode][op == es_op]);
}
else
- expected_reg = hash_find (reg_hash, bx[addr_mode]);
+ expected_reg = (const reg_entry *)str_hash_find (reg_hash, bx[addr_mode]);
if (i.base_reg != expected_reg
|| i.index_reg
*end_op = s;
- r = (const reg_entry *) hash_find (reg_hash, reg_name_given);
+ r = (const reg_entry *) str_hash_find (reg_hash, reg_name_given);
/* Handle floating point regs, allowing spaces in the (i) part. */
if (r == i386_regtab /* %st is first entry of table */)
if (*s == ')')
{
*end_op = s + 1;
- r = (const reg_entry *) hash_find (reg_hash, "st(0)");
+ r = (const reg_entry *) str_hash_find (reg_hash, "st(0)");
know (r);
return r + fpr;
}
static void (*ia64_float_to_chars) (char *, LITTLENUM_TYPE *, int);
-static struct hash_control *alias_hash;
-static struct hash_control *alias_name_hash;
-static struct hash_control *secalias_hash;
-static struct hash_control *secalias_name_hash;
+static htab_t alias_hash;
+static htab_t alias_name_hash;
+static htab_t secalias_hash;
+static htab_t secalias_name_hash;
/* List of chars besides those in app.c:symbol_chars that can start an
operand. Used to prevent the scrubber eating vital white-space. */
static struct
{
- struct hash_control *pseudo_hash; /* pseudo opcode hash table */
- struct hash_control *reg_hash; /* register name hash table */
- struct hash_control *dynreg_hash; /* dynamic register hash table */
- struct hash_control *const_hash; /* constant hash table */
- struct hash_control *entry_hash; /* code entry hint hash table */
+ htab_t pseudo_hash; /* pseudo opcode hash table */
+ htab_t reg_hash; /* register name hash table */
+ htab_t dynreg_hash; /* dynamic register hash table */
+ htab_t const_hash; /* constant hash table */
+ htab_t entry_hash; /* code entry hint hash table */
/* If X_op is != O_absent, the register name for the instruction's
qualifying predicate. If NULL, p0 is assumed for instructions
/* First, remove existing names from hash table. */
for (dr = md.dynreg[type]; dr && dr->num_regs; dr = dr->next)
{
- hash_delete (md.dynreg_hash, dr->name, FALSE);
+ str_hash_delete (md.dynreg_hash, dr->name);
/* FIXME: Free dr->name. */
dr->num_regs = 0;
}
drpp = &dr->next;
base_reg += num_regs;
- if (hash_insert (md.dynreg_hash, name, dr))
- {
- as_bad (_("Attempt to redefine register set `%s'"), name);
- obstack_free (¬es, name);
- goto err;
- }
+ str_hash_insert (md.dynreg_hash, name, dr);
if (*input_line_pointer != ',')
break;
static void
dot_entry (int dummy ATTRIBUTE_UNUSED)
{
- const char *err;
char *name;
int c;
symbolS *symbolP;
c = get_symbol_name (&name);
symbolP = symbol_find_or_make (name);
- err = hash_insert (md.entry_hash, S_GET_NAME (symbolP), (void *) symbolP);
- if (err)
- as_fatal (_("Inserting \"%s\" into entry hint table failed: %s"),
- name, err);
+ str_hash_insert (md.entry_hash, S_GET_NAME (symbolP), (void *) symbolP);
*input_line_pointer = c;
SKIP_WHITESPACE_AFTER_NAME ();
static symbolS *
declare_register (const char *name, unsigned int regnum)
{
- const char *err;
symbolS *sym;
sym = symbol_create (name, reg_section, regnum, &zero_address_frag);
- err = hash_insert (md.reg_hash, S_GET_NAME (sym), (void *) sym);
- if (err)
- as_fatal ("Inserting \"%s\" into register table failed: %s",
- name, err);
+ str_hash_insert (md.reg_hash, S_GET_NAME (sym), (void *) sym);
return sym;
}
md_begin (void)
{
int i, j, k, t, goodness, best, ok;
- const char *err;
- char name[8];
md.auto_align = 1;
md.explicit_mode = md.default_explicit_mode;
target_big_endian = -1;
dot_byteorder (default_big_endian);
- alias_hash = hash_new ();
- alias_name_hash = hash_new ();
- secalias_hash = hash_new ();
- secalias_name_hash = hash_new ();
+ alias_hash = str_htab_create ();
+ alias_name_hash = str_htab_create ();
+ secalias_hash = str_htab_create ();
+ secalias_name_hash = str_htab_create ();
pseudo_func[FUNC_DTP_MODULE].u.sym =
symbol_new (".<dtpmod>", undefined_section, FUNC_DTP_MODULE,
for (i = 0; i < NUM_SLOTS; ++i)
md.slot[i].user_template = -1;
- md.pseudo_hash = hash_new ();
+ md.pseudo_hash = str_htab_create ();
for (i = 0; i < NELEMS (pseudo_opcode); ++i)
- {
- err = hash_insert (md.pseudo_hash, pseudo_opcode[i].name,
- (void *) (pseudo_opcode + i));
- if (err)
- as_fatal (_("ia64.md_begin: can't hash `%s': %s"),
- pseudo_opcode[i].name, err);
- }
+ str_hash_insert (md.pseudo_hash, pseudo_opcode[i].name,
+ (void *) (pseudo_opcode + i));
- md.reg_hash = hash_new ();
- md.dynreg_hash = hash_new ();
- md.const_hash = hash_new ();
- md.entry_hash = hash_new ();
+ md.reg_hash = str_htab_create ();
+ md.dynreg_hash = str_htab_create ();
+ md.const_hash = str_htab_create ();
+ md.entry_hash = str_htab_create ();
/* general registers: */
declare_register_set ("r", 128, REG_GR);
declare_register ("psp", REG_PSP);
for (i = 0; i < NELEMS (const_bits); ++i)
- {
- err = hash_insert (md.const_hash, const_bits[i].name,
- (void *) (const_bits + i));
- if (err)
- as_fatal (_("Inserting \"%s\" into constant hash table failed: %s"),
- name, err);
- }
+ str_hash_insert (md.const_hash, const_bits[i].name,
+ (void *) (const_bits + i));
/* Set the architecture and machine depending on defaults and command line
options. */
}
/* first see if NAME is a known register name: */
- sym = hash_find (md.reg_hash, name);
+ sym = str_hash_find (md.reg_hash, name);
if (sym)
{
e->X_op = O_register;
return 1;
}
- cdesc = hash_find (md.const_hash, name);
+ cdesc = str_hash_find (md.const_hash, name);
if (cdesc)
{
e->X_op = O_constant;
end = xstrdup (name);
name = ia64_canonicalize_symbol_name (end);
- if ((dr = hash_find (md.dynreg_hash, name)))
+ if ((dr = str_hash_find (md.dynreg_hash, name)))
{
/* We've got ourselves the name of a rotating register set.
Store the base register number in the low 16 bits of
ch = get_symbol_name (&temp);
mnemonic = temp;
- pdesc = (struct pseudo_opcode *) hash_find (md.pseudo_hash, mnemonic);
+ pdesc = (struct pseudo_opcode *) str_hash_find (md.pseudo_hash, mnemonic);
if (pdesc)
{
(void) restore_line_pointer (ch);
char delim;
char *end_name;
int len;
- const char *error_string;
struct alias *h;
const char *a;
- struct hash_control *ahash, *nhash;
+ htab_t ahash, nhash;
const char *kind;
delim = get_symbol_name (&name);
}
/* Check if alias has been used before. */
- h = (struct alias *) hash_find (ahash, alias);
+
+ h = (struct alias *) str_hash_find (ahash, alias);
if (h)
{
if (strcmp (h->name, name))
as_bad (_("`%s' is already the alias of %s `%s'"),
alias, kind, h->name);
+ obstack_free (¬es, name);
+ obstack_free (¬es, alias);
goto out;
}
/* Check if name already has an alias. */
- a = (const char *) hash_find (nhash, name);
+ a = (const char *) str_hash_find (nhash, name);
if (a)
{
if (strcmp (a, alias))
as_bad (_("%s `%s' already has an alias `%s'"), kind, name, a);
+ obstack_free (¬es, name);
+ obstack_free (¬es, alias);
goto out;
}
h->file = as_where (&h->line);
h->name = name;
- error_string = hash_jam (ahash, alias, (void *) h);
- if (error_string)
- {
- as_fatal (_("inserting \"%s\" into %s alias hash table failed: %s"),
- alias, kind, error_string);
- goto out;
- }
-
- error_string = hash_jam (nhash, name, (void *) alias);
- if (error_string)
- {
- as_fatal (_("inserting \"%s\" into %s name hash table failed: %s"),
- alias, kind, error_string);
- out:
- obstack_free (¬es, name);
- obstack_free (¬es, alias);
- }
+ str_hash_insert (ahash, alias, (void *) h);
+ str_hash_insert (nhash, name, (void *) alias);
+out:
demand_empty_rest_of_line ();
}
/* It renames the original symbol name to its alias. */
-static void
-do_alias (const char *alias, void *value)
+static int
+do_alias (void **slot, void *arg ATTRIBUTE_UNUSED)
{
- struct alias *h = (struct alias *) value;
+ string_tuple_t *tuple = *((string_tuple_t **) slot);
+ struct alias *h = (struct alias *) tuple->value;
symbolS *sym = symbol_find (h->name);
if (sym == NULL)
/* Uses .alias extensively to alias CRTL functions to same with
decc$ prefix. Sometimes function gets optimized away and a
warning results, which should be suppressed. */
- if (strncmp (alias, "decc$", 5) != 0)
+ if (strncmp (tuple->key, "decc$", 5) != 0)
#endif
as_warn_where (h->file, h->line,
_("symbol `%s' aliased to `%s' is not used"),
- h->name, alias);
+ h->name, tuple->key);
}
else
- S_SET_NAME (sym, (char *) alias);
+ S_SET_NAME (sym, (char *) tuple->key);
+
+ return 1;
}
/* Called from write_object_file. */
void
ia64_adjust_symtab (void)
{
- hash_traverse (alias_hash, do_alias);
+ htab_traverse (alias_hash, do_alias, NULL);
}
/* It renames the original section name to its alias. */
-static void
-do_secalias (const char *alias, void *value)
+static int
+do_secalias (void **slot, void *arg ATTRIBUTE_UNUSED)
{
- struct alias *h = (struct alias *) value;
+ string_tuple_t *tuple = *((string_tuple_t **) slot);
+ struct alias *h = (struct alias *) tuple->value;
segT sec = bfd_get_section_by_name (stdoutput, h->name);
if (sec == NULL)
as_warn_where (h->file, h->line,
_("section `%s' aliased to `%s' is not used"),
- h->name, alias);
+ h->name, tuple->key);
else
- sec->name = alias;
+ sec->name = tuple->key;
+
+ return 1;
}
/* Called from write_object_file. */
void
ia64_frob_file (void)
{
- hash_traverse (secalias_hash, do_secalias);
+ htab_traverse (secalias_hash, do_secalias, NULL);
}
#ifdef TE_VMS
static short flag_print_opcodes = 0;
/* Opcode hash table. */
-static struct hash_control *m68hc11_hash;
+static htab_t m68hc11_hash;
/* Current cpu (either cpu6811 or cpu6812). This is determined automagically
by 'get_default_target' by looking at default BFD vector. This is overridden
int i;
struct m68hc11_opcode_def *opc;
- hash_print_statistics (file, "opcode table", m68hc11_hash);
+ htab_print_statistics (file, "opcode table", m68hc11_hash);
opc = m68hc11_opcode_defs;
if (opc == 0 || m68hc11_nb_opcode_defs == 0)
get_default_target ();
- m68hc11_hash = hash_new ();
+ m68hc11_hash = str_htab_create ();
/* Get a writable copy of the opcode table and sort it on the names. */
opcodes = XNEWVEC (struct m68hc11_opcode, m68hc11_num_opcodes);
opc->nb_modes = 0;
opc->opcode = opcodes;
opc->used = 0;
- hash_insert (m68hc11_hash, opcodes->name, opc);
+ str_hash_insert (m68hc11_hash, opcodes->name, opc);
}
opc->nb_modes++;
opc->format |= opcodes->format;
struct m68hc11_opcode *opcode;
char buf[128];
- opc = (struct m68hc11_opcode_def *) hash_find (m68hc11_hash, name);
+ opc = (struct m68hc11_opcode_def *) str_hash_find (m68hc11_hash, name);
if (opc == NULL)
{
as_bad (_("Instruction `%s' is not recognized."), name);
if (current_architecture == cpuxgate)
{
/* Find the opcode definition given its name. */
- opc = (struct m68hc11_opcode_def *) hash_find (m68hc11_hash, name);
+ opc = (struct m68hc11_opcode_def *) str_hash_find (m68hc11_hash, name);
if (opc == NULL)
{
as_bad (_("Opcode `%s' is not recognized."), name);
}
/* Find the opcode definition given its name. */
- opc = (struct m68hc11_opcode_def *) hash_find (m68hc11_hash, name);
+ opc = (struct m68hc11_opcode_def *) str_hash_find (m68hc11_hash, name);
/* If it's not recognized, look for 'jbsr' and 'jbxx'. These are
pseudo insns for relative branch. For these branches, we always
is given. */
if (opc == NULL && name[0] == 'j' && name[1] == 'b')
{
- opc = (struct m68hc11_opcode_def *) hash_find (m68hc11_hash, &name[1]);
+ opc = (struct m68hc11_opcode_def *) str_hash_find (m68hc11_hash, &name[1]);
if (opc
&& (!(opc->format & M6811_OP_JUMP_REL)
|| (opc->format & M6811_OP_BITMASK)))
{
name[nlen++] = TOLOWER (*op_end++);
name[nlen] = 0;
- opc = (struct m68hc11_opcode_def *) hash_find (m68hc11_hash,
+ opc = (struct m68hc11_opcode_def *) str_hash_find (m68hc11_hash,
name);
}
}
/* Handle of the OPCODE hash table. NULL means any use before
m68k_ip_begin() will crash. */
-static struct hash_control *op_hash;
+static htab_t op_hash;
\f
/* Assemble an m68k instruction. */
c = *p;
*p = '\0';
- opcode = (const struct m68k_incant *) hash_find (op_hash, instring);
+ opcode = (const struct m68k_incant *) str_hash_find (op_hash, instring);
*p = c;
if (pdot != NULL)
{
const struct m68k_opcode *ins;
struct m68k_incant *hack, *slak;
- const char *retval = 0; /* Empty string, or error msg text. */
int i;
/* Set up hash tables with 68000 instructions.
qsort (m68k_sorted_opcodes, m68k_numopcodes,
sizeof (m68k_sorted_opcodes[0]), m68k_compare_opcode);
- op_hash = hash_new ();
+ op_hash = str_htab_create ();
obstack_begin (&robyn, 4000);
for (i = 0; i < m68k_numopcodes; i++)
}
while (slak);
- retval = hash_insert (op_hash, ins->name, (char *) hack);
- if (retval)
- as_fatal (_("Internal Error: Can't hash %s: %s"), ins->name, retval);
+ str_hash_insert (op_hash, ins->name, (char *) hack);
}
for (i = 0; i < m68k_numaliases; i++)
{
const char *name = m68k_opcode_aliases[i].primary;
const char *alias = m68k_opcode_aliases[i].alias;
- void *val = hash_find (op_hash, name);
+ void *val = (void *)str_hash_find (op_hash, name);
if (!val)
as_fatal (_("Internal Error: Can't find %s in hash table"), name);
- retval = hash_insert (op_hash, alias, val);
- if (retval)
- as_fatal (_("Internal Error: Can't hash %s: %s"), alias, retval);
+ str_hash_insert (op_hash, alias, val);
}
/* In MRI mode, all unsized branches are variable sized. Normally,
{
const char *name = mri_aliases[i].primary;
const char *alias = mri_aliases[i].alias;
- void *val = hash_find (op_hash, name);
+ void *val = (void *)str_hash_find (op_hash, name);
if (!val)
as_fatal (_("Internal Error: Can't find %s in hash table"), name);
- retval = hash_jam (op_hash, alias, val);
- if (retval)
- as_fatal (_("Internal Error: Can't hash %s: %s"), alias, retval);
+ str_hash_insert (op_hash, alias, val);
}
}
while (mote_pseudo_table[n].poc_name)
{
hack = XOBNEW (&robyn, struct m68k_incant);
- hash_insert (op_hash,
+ str_hash_insert (op_hash,
mote_pseudo_table[n].poc_name, (char *) hack);
hack->m_operands = 0;
hack->m_opnum = n;
#define SPANEXIT (600)
static symbolS * poolsym; /* Label for current pool. */
static char poolname[8];
-static struct hash_control * opcode_hash_control; /* Opcode mnemonics. */
+static htab_t opcode_hash_control; /* Opcode mnemonics. */
#define POOL_END_LABEL ".LE"
#define POOL_START_LABEL ".LS"
const char * prev_name = "";
unsigned int i;
- opcode_hash_control = hash_new ();
+ opcode_hash_control = str_htab_create ();
/* Insert unique names into hash table. */
for (i = 0; i < ARRAY_SIZE (mcore_table); i++)
if (! streq (prev_name, mcore_table[i].name))
{
prev_name = mcore_table[i].name;
- hash_insert (opcode_hash_control, mcore_table[i].name, (char *) &mcore_table[i]);
+ str_hash_insert (opcode_hash_control, mcore_table[i].name, (char *) &mcore_table[i]);
}
}
}
return;
}
- opcode = (mcore_opcode_info *) hash_find (opcode_hash_control, name);
+ opcode = (mcore_opcode_info *) str_hash_find (opcode_hash_control, name);
if (opcode == NULL)
{
as_bad (_("unknown opcode \"%s\""), name);
{ 0x7fffffff, 0x80000000, INST_WORD_SIZE*2, 0 } /* 18: TEXT_PC_OFFSET. */
};
-static struct hash_control * opcode_hash_control; /* Opcode mnemonics. */
+static htab_t opcode_hash_control; /* Opcode mnemonics. */
static segT sbss_segment = 0; /* Small bss section. */
static segT sbss2_segment = 0; /* Section not used. */
{
struct op_code_struct * opcode;
- opcode_hash_control = hash_new ();
+ opcode_hash_control = str_htab_create ();
/* Insert unique names into hash table. */
for (opcode = opcodes; opcode->name; opcode ++)
- hash_insert (opcode_hash_control, opcode->name, (char *) opcode);
+ str_hash_insert (opcode_hash_control, opcode->name, (char *) opcode);
}
/* Try to parse a reg name. */
return;
}
- opcode = (struct op_code_struct *) hash_find (opcode_hash_control, name);
+ opcode = (struct op_code_struct *) str_hash_find (opcode_hash_control, name);
if (opcode == NULL)
{
as_bad (_("unknown opcode \"%s\""), name);
count = 32 - reg1;
if (streq (name, "lmi"))
- opcode = (struct op_code_struct *) hash_find (opcode_hash_control, "lwi");
+ opcode = (struct op_code_struct *) str_hash_find (opcode_hash_control, "lwi");
else
- opcode = (struct op_code_struct *) hash_find (opcode_hash_control, "swi");
+ opcode = (struct op_code_struct *) str_hash_find (opcode_hash_control, "swi");
if (opcode == NULL)
{
as_bad (_("unknown opcode \"%s\""), "lwi");
if ((temp != 0) && (temp != 0xFFFF8000))
{
/* Needs an immediate inst. */
- opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imm");
+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imm");
if (opcode1 == NULL)
{
as_bad (_("unknown opcode \"%s\""), "imm");
if ((temp != 0) && (temp != 0xFFFF8000))
{
/* Needs an immediate inst. */
- opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imm");
+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imm");
if (opcode1 == NULL)
{
as_bad (_("unknown opcode \"%s\""), "imm");
if ((temp != 0) && (temp != 0xFFFF8000))
{
/* Needs an immediate inst. */
- opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imm");
+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imm");
if (opcode1 == NULL)
{
as_bad (_("unknown opcode \"%s\""), "imm");
if ((temp != 0) && (temp != 0xFFFF8000))
{
/* Needs an immediate inst. */
- opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imm");
+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imm");
if (opcode1 == NULL)
{
as_bad (_("unknown opcode \"%s\""), "imm");
buf[i + INST_WORD_SIZE] = buf[i];
/* Generate the imm instruction. */
- opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imm");
+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imm");
if (opcode1 == NULL)
{
as_bad (_("unknown opcode \"%s\""), "imm");
buf[i + INST_WORD_SIZE] = buf[i];
/* Generate the imm instruction. */
- opcode1 = (struct op_code_struct *) hash_find (opcode_hash_control, "imm");
+ opcode1 = (struct op_code_struct *) str_hash_find (opcode_hash_control, "imm");
if (opcode1 == NULL)
{
as_bad (_("unknown opcode \"%s\""), "imm");
static int nopic_need_relax (symbolS *, int);
/* Handle of the OPCODE hash table. */
-static struct hash_control *op_hash = NULL;
+static htab_t op_hash = NULL;
/* The opcode hash table we use for the mips16. */
-static struct hash_control *mips16_op_hash = NULL;
+static htab_t mips16_op_hash = NULL;
/* The opcode hash table we use for the microMIPS ASE. */
-static struct hash_control *micromips_op_hash = NULL;
+static htab_t micromips_op_hash = NULL;
/* This array holds the chars that always start a comment. If the
pre-processor is disabled, these aren't very useful. */
void
md_begin (void)
{
- const char *retval = NULL;
int i = 0;
int broken = 0;
if (! bfd_set_arch_mach (stdoutput, bfd_arch_mips, file_mips_opts.arch))
as_warn (_("could not set architecture and machine"));
- op_hash = hash_new ();
+ op_hash = str_htab_create ();
mips_operands = XCNEWVEC (struct mips_operand_array, NUMOPCODES);
for (i = 0; i < NUMOPCODES;)
{
const char *name = mips_opcodes[i].name;
- retval = hash_insert (op_hash, name, (void *) &mips_opcodes[i]);
- if (retval != NULL)
- {
- fprintf (stderr, _("internal error: can't hash `%s': %s\n"),
- mips_opcodes[i].name, retval);
- /* Probably a memory allocation problem? Give up now. */
- as_fatal (_("broken assembler, no assembly attempted"));
- }
+ str_hash_insert (op_hash, name, (void *) &mips_opcodes[i]);
do
{
if (!validate_mips_insn (&mips_opcodes[i], 0xffffffff,
while ((i < NUMOPCODES) && !strcmp (mips_opcodes[i].name, name));
}
- mips16_op_hash = hash_new ();
+ mips16_op_hash = str_htab_create ();
mips16_operands = XCNEWVEC (struct mips_operand_array,
bfd_mips16_num_opcodes);
{
const char *name = mips16_opcodes[i].name;
- retval = hash_insert (mips16_op_hash, name, (void *) &mips16_opcodes[i]);
- if (retval != NULL)
- as_fatal (_("internal: can't hash `%s': %s"),
- mips16_opcodes[i].name, retval);
+ str_hash_insert (mips16_op_hash, name, (void *) &mips16_opcodes[i]);
do
{
if (!validate_mips16_insn (&mips16_opcodes[i], &mips16_operands[i]))
&& strcmp (mips16_opcodes[i].name, name) == 0);
}
- micromips_op_hash = hash_new ();
+ micromips_op_hash = str_htab_create ();
micromips_operands = XCNEWVEC (struct mips_operand_array,
bfd_micromips_num_opcodes);
{
const char *name = micromips_opcodes[i].name;
- retval = hash_insert (micromips_op_hash, name,
+ str_hash_insert (micromips_op_hash, name,
(void *) µmips_opcodes[i]);
- if (retval != NULL)
- as_fatal (_("internal: can't hash `%s': %s"),
- micromips_opcodes[i].name, retval);
do
{
struct mips_cl_insn *micromips_nop_insn;
bfd_reloc_code_real_type r[3];
const struct mips_opcode *amo;
const struct mips_operand *operand;
- struct hash_control *hash;
+ htab_t hash;
struct mips_cl_insn insn;
va_list args;
unsigned int uval;
r[1] = BFD_RELOC_UNUSED;
r[2] = BFD_RELOC_UNUSED;
hash = mips_opts.micromips ? micromips_op_hash : op_hash;
- amo = (struct mips_opcode *) hash_find (hash, name);
+ amo = (struct mips_opcode *) str_hash_find (hash, name);
gas_assert (amo);
gas_assert (strcmp (name, amo->name) == 0);
bfd_reloc_code_real_type r[3]
= {BFD_RELOC_UNUSED, BFD_RELOC_UNUSED, BFD_RELOC_UNUSED};
- mo = (struct mips_opcode *) hash_find (mips16_op_hash, name);
+ mo = (struct mips_opcode *) str_hash_find (mips16_op_hash, name);
gas_assert (mo);
gas_assert (strcmp (name, mo->name) == 0);
opcode bits in *OPCODE_EXTRA. */
static struct mips_opcode *
-mips_lookup_insn (struct hash_control *hash, const char *start,
+mips_lookup_insn (htab_t hash, const char *start,
ssize_t length, unsigned int *opcode_extra)
{
char *name, *dot, *p;
name = xstrndup (start, length);
/* Look up the instruction as-is. */
- insn = (struct mips_opcode *) hash_find (hash, name);
+ insn = (struct mips_opcode *) str_hash_find (hash, name);
if (insn)
goto end;
if (*p == 0 && mask != 0)
{
*dot = 0;
- insn = (struct mips_opcode *) hash_find (hash, name);
+ insn = (struct mips_opcode *) str_hash_find (hash, name);
*dot = '.';
if (insn && (insn->pinfo2 & INSN2_VU0_CHANNEL_SUFFIX) != 0)
{
if (suffix)
{
memmove (name + opend - 2, name + opend, length - opend + 1);
- insn = (struct mips_opcode *) hash_find (hash, name);
+ insn = (struct mips_opcode *) str_hash_find (hash, name);
if (insn)
{
forced_insn_length = suffix;
mips_ip (char *str, struct mips_cl_insn *insn)
{
const struct mips_opcode *first, *past;
- struct hash_control *hash;
+ htab_t hash;
char format;
size_t end;
struct mips_operand_token *tokens;
forced_insn_length = l;
*end = 0;
- first = (struct mips_opcode *) hash_find (mips16_op_hash, str);
+ first = (struct mips_opcode *) str_hash_find (mips16_op_hash, str);
*end = c;
if (!first)
size_t md_longopts_size = sizeof (md_longopts);
-static struct hash_control *mmix_opcode_hash;
+static htab_t mmix_opcode_hash;
/* We use these when implementing the PREFIX pseudo. */
char *mmix_current_prefix;
only way to make ':' part of a name, and a name beginner. */
lex_type[':'] = (LEX_NAME | LEX_BEGIN_NAME);
- mmix_opcode_hash = hash_new ();
+ mmix_opcode_hash = str_htab_create ();
real_reg_section
= bfd_make_section_old_way (stdoutput, MMIX_REG_SECTION_NAME);
for (opcode = mmix_opcodes; opcode->name; opcode++)
- hash_insert (mmix_opcode_hash, opcode->name, (char *) opcode);
+ str_hash_insert (mmix_opcode_hash, opcode->name, (char *) opcode);
/* We always insert the ordinary registers 0..255 as registers. */
for (i = 0; i < 256; i++)
*operands++ = '\0';
}
- instruction = (struct mmix_opcode *) hash_find (mmix_opcode_hash, str);
+ instruction = (struct mmix_opcode *) str_hash_find (mmix_opcode_hash, str);
if (instruction == NULL)
{
as_bad (_("unknown opcode: `%s'"), str);
};
/* Opcode hash table. */
-static struct hash_control *mn10200_hash;
+static htab_t mn10200_hash;
/* This table is sorted. Suitable for searching by a binary search. */
static const struct reg_name data_registers[] =
const char *prev_name = "";
const struct mn10200_opcode *op;
- mn10200_hash = hash_new ();
+ mn10200_hash = str_htab_create ();
/* Insert unique names into hash table. The MN10200 instruction set
has many identical opcode names that have different opcodes based
if (strcmp (prev_name, op->name))
{
prev_name = (char *) op->name;
- hash_insert (mn10200_hash, op->name, (char *) op);
+ str_hash_insert (mn10200_hash, op->name, (char *) op);
}
op++;
}
*s++ = '\0';
/* Find the first opcode with the proper name. */
- opcode = (struct mn10200_opcode *) hash_find (mn10200_hash, str);
+ opcode = (struct mn10200_opcode *) str_hash_find (mn10200_hash, str);
if (opcode == NULL)
{
as_bad (_("Unrecognized opcode: `%s'"), str);
#define HAVE_AM30 (current_machine == AM30)
/* Opcode hash table. */
-static struct hash_control *mn10300_hash;
+static htab_t mn10300_hash;
/* This table is sorted. Suitable for searching by a binary search. */
static const struct reg_name data_registers[] =
const char *prev_name = "";
const struct mn10300_opcode *op;
- mn10300_hash = hash_new ();
+ mn10300_hash = str_htab_create ();
/* Insert unique names into hash table. The MN10300 instruction set
has many identical opcode names that have different opcodes based
if (strcmp (prev_name, op->name))
{
prev_name = (char *) op->name;
- hash_insert (mn10300_hash, op->name, (char *) op);
+ str_hash_insert (mn10300_hash, op->name, (char *) op);
}
op++;
}
*s++ = '\0';
/* Find the first opcode with the proper name. */
- opcode = (struct mn10300_opcode *) hash_find (mn10300_hash, str);
+ opcode = (struct mn10300_opcode *) str_hash_find (mn10300_hash, str);
if (opcode == NULL)
{
as_bad (_("Unrecognized opcode: `%s'"), str);
const char line_comment_chars[] = "#";
static int pending_reloc;
-static struct hash_control *opcode_hash_control;
+static htab_t opcode_hash_control;
const pseudo_typeS md_pseudo_table[] =
{
{
int count;
const moxie_opc_info_t *opcode;
- opcode_hash_control = hash_new ();
+ opcode_hash_control = str_htab_create ();
/* Insert names into hash table. */
for (count = 0, opcode = moxie_form1_opc_info; count++ < 64; opcode++)
- hash_insert (opcode_hash_control, opcode->name, (char *) opcode);
+ str_hash_insert (opcode_hash_control, opcode->name, (char *) opcode);
for (count = 0, opcode = moxie_form2_opc_info; count++ < 4; opcode++)
- hash_insert (opcode_hash_control, opcode->name, (char *) opcode);
+ str_hash_insert (opcode_hash_control, opcode->name, (char *) opcode);
for (count = 0, opcode = moxie_form3_opc_info; count++ < 10; opcode++)
- hash_insert (opcode_hash_control, opcode->name, (char *) opcode);
+ str_hash_insert (opcode_hash_control, opcode->name, (char *) opcode);
bfd_set_arch_mach (stdoutput, TARGET_ARCH, 0);
}
if (nlen == 0)
as_bad (_("can't find opcode "));
- opcode = (moxie_opc_info_t *) hash_find (opcode_hash_control, op_start);
+ opcode = (moxie_opc_info_t *) str_hash_find (opcode_hash_control, op_start);
*op_end = pend;
if (opcode == NULL)
/* Handle long expressions. */
extern LITTLENUM_TYPE generic_bignum[];
-static struct hash_control *msp430_hash;
+static htab_t msp430_hash;
/* Relaxations. */
#define STATE_UNCOND_BRANCH 1 /* jump */
md_begin (void)
{
struct msp430_opcode_s * opcode;
- msp430_hash = hash_new ();
+ msp430_hash = str_htab_create ();
for (opcode = msp430_opcodes; opcode->name; opcode++)
- hash_insert (msp430_hash, opcode->name, (char *) opcode);
+ if (str_hash_find (msp430_hash, opcode->name) == NULL)
+ str_hash_insert (msp430_hash, opcode->name, (char *) opcode);
bfd_set_arch_mach (stdoutput, TARGET_ARCH,
target_is_430x () ? bfd_mach_msp430x : bfd_mach_msp11);
char real_name[32];
sprintf (real_name, "%sa", old_name);
- opcode = hash_find (msp430_hash, real_name);
+ opcode = str_hash_find (msp430_hash, real_name);
if (opcode == NULL)
{
as_bad (_("instruction %s.a does not exist"), old_name);
return;
}
- opcode = (struct msp430_opcode_s *) hash_find (msp430_hash, cmd);
+ opcode = (struct msp430_opcode_s *) str_hash_find (msp430_hash, cmd);
if (opcode == NULL)
{
".flag verbatim" at beginning of the content. We have
'nds32_flag' to parse it and set this field to be non-zero. */
static int verbatim = 0;
-static struct hash_control *nds32_gprs_hash;
-static struct hash_control *nds32_hint_hash;
+static htab_t nds32_gprs_hash;
+static htab_t nds32_hint_hash;
#define TLS_REG "$r27"
#define GOT_NAME "_GLOBAL_OFFSET_TABLE_"
static enum ict_option ict_flag = ICT_NONE;
\f
-static struct hash_control *nds32_relax_info_hash;
+static htab_t nds32_relax_info_hash;
/* Branch patterns. */
static relax_info_t relax_table[] =
};
#define PV_DONT_CARE 0
-static struct hash_control *nds32_pseudo_opcode_hash = NULL;
+static htab_t nds32_pseudo_opcode_hash = NULL;
static int
builtin_isreg (const char *s, const char *x ATTRIBUTE_UNUSED)
{
- if (s [0] == '$' && hash_find (nds32_gprs_hash, (s + 1)))
+ if (s [0] == '$' && str_hash_find (nds32_gprs_hash, (s + 1)))
return 1;
return 0;
}
if (*s != '$')
return -1;
s++;
- k = hash_find (nds32_gprs_hash, s);
+ k = str_hash_find (nds32_gprs_hash, s);
if (k == NULL)
return -1;
{
struct nds32_pseudo_opcode *opcode = nds32_pseudo_opcode_table;
- nds32_pseudo_opcode_hash = hash_new ();
+ nds32_pseudo_opcode_hash = str_htab_create ();
for ( ; opcode->opcode; opcode++)
{
void *op;
- op = hash_find (nds32_pseudo_opcode_hash, opcode->opcode);
+ op = str_hash_find (nds32_pseudo_opcode_hash, opcode->opcode);
if (op != NULL)
{
as_warn (_("Duplicated pseudo-opcode %s."), opcode->opcode);
continue;
}
- hash_insert (nds32_pseudo_opcode_hash, opcode->opcode, opcode);
+ str_hash_insert (nds32_pseudo_opcode_hash, opcode->opcode, opcode);
}
}
}
op[i] = '\0';
- result = hash_find (nds32_pseudo_opcode_hash, op);
+ result = str_hash_find (nds32_pseudo_opcode_hash, op);
free (op);
return result;
}
/* Find relax hint entry for next instruction, and all member will be
initialized at that time. */
- relocs = hash_find (nds32_hint_hash, name);
+ relocs = str_hash_find (nds32_hint_hash, name);
if (relocs == NULL)
{
relocs = XNEW (struct nds32_relocs_pattern);
memset (relocs, 0, sizeof (struct nds32_relocs_pattern));
- hash_insert (nds32_hint_hash, name, relocs);
+ str_hash_insert (nds32_hint_hash, name, relocs);
}
else
{
nds32_asm_init (&asm_desc, flags);
/* Initial general purpose registers hash table. */
- nds32_gprs_hash = hash_new ();
+ nds32_gprs_hash = str_htab_create ();
for (k = keyword_gpr; k->name; k++)
- hash_insert (nds32_gprs_hash, k->name, k);
+ str_hash_insert (nds32_gprs_hash, k->name, k);
/* Initial branch hash table. */
- nds32_relax_info_hash = hash_new ();
+ nds32_relax_info_hash = str_htab_create ();
for (relax_info = relax_table; relax_info->opcode; relax_info++)
- hash_insert (nds32_relax_info_hash, relax_info->opcode, relax_info);
+ str_hash_insert (nds32_relax_info_hash, relax_info->opcode, relax_info);
/* Initial relax hint hash table. */
- nds32_hint_hash = hash_new ();
+ nds32_hint_hash = str_htab_create ();
enable_16bit = nds32_16bit_ext;
}
if (opc)
{
/* Branch relax pattern. */
- relax_info = hash_find (nds32_relax_info_hash, opc);
+ relax_info = str_hash_find (nds32_relax_info_hash, opc);
if (!relax_info)
return FALSE;
fixup_info = relax_info->relax_fixup[range];
frchain_now = frchain_bak;
}
+static int
+nds32_elf_append_relax_relocs_traverse (void **slot, void *arg ATTRIBUTE_UNUSED)
+{
+ string_tuple_t *tuple = *((string_tuple_t **) slot);
+ nds32_elf_append_relax_relocs (tuple->key, tuple->value);
+ return 1;
+}
+
+
static void
nds32_str_tolower (const char *src, char *dest)
{
return 0;
}
- relax_info = hash_find (nds32_relax_info_hash, opcode->opcode);
+ relax_info = str_hash_find (nds32_relax_info_hash, opcode->opcode);
if (relax_info == NULL)
return adjust;
if (fragP->tc_frag_data.flag & NDS32_FRAG_RELAXABLE_BRANCH)
{
- relax_info = hash_find (nds32_relax_info_hash, opcode->opcode);
+ relax_info = str_hash_find (nds32_relax_info_hash, opcode->opcode);
if (relax_info == NULL)
return;
else if (fragP->tc_frag_data.flag & NDS32_FRAG_BRANCH)
{
/* Branch instruction adjust and append relocations. */
- relax_info = hash_find (nds32_relax_info_hash, opcode->opcode);
+ relax_info = str_hash_find (nds32_relax_info_hash, opcode->opcode);
if (relax_info == NULL)
return;
static void
nds32_elf_analysis_relax_hint (void)
{
- hash_traverse (nds32_hint_hash, nds32_elf_append_relax_relocs);
+ htab_traverse (nds32_hint_hash, nds32_elf_append_relax_relocs_traverse, NULL);
}
static void
int
tc_nds32_regname_to_dw2regnum (char *regname)
{
- struct nds32_keyword *sym = hash_find (nds32_gprs_hash, regname);
+ struct nds32_keyword *sym = str_hash_find (nds32_gprs_hash, regname);
if (!sym)
return -1;
} 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;
md_begin (void)
{
int i;
- const char *inserted;
switch (nios2_architecture)
{
/* 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;
typedef struct addr_mode addr_modeS;
char *freeptr, *freeptr_static; /* Points at some number of free bytes. */
-struct hash_control *inst_hash_handle;
+htab_t inst_hash_handle;
struct ns32k_opcode *desc; /* Pointer at description of instruction. */
addr_modeS addr_modeP;
c = *lineptr;
*(char *) lineptr = '\0';
- if (!(desc = (struct ns32k_opcode *) hash_find (inst_hash_handle, line)))
+ if (!(desc = (struct ns32k_opcode *) str_hash_find (inst_hash_handle, line)))
as_fatal (_("No such opcode"));
*(char *) lineptr = c;
{
/* Build a hashtable of the instructions. */
const struct ns32k_opcode *ptr;
- const char *status;
const struct ns32k_opcode *endop;
- inst_hash_handle = hash_new ();
+ inst_hash_handle = str_htab_create ();
endop = ns32k_opcodes + sizeof (ns32k_opcodes) / sizeof (ns32k_opcodes[0]);
for (ptr = ns32k_opcodes; ptr < endop; ptr++)
- {
- if ((status = hash_insert (inst_hash_handle, ptr->name, (char *) ptr)))
- /* Fatal. */
- as_fatal (_("Can't hash %s: %s"), ptr->name, status);
- }
+ str_hash_insert (inst_hash_handle, ptr->name, (char *) ptr);
/* Some private space please! */
freeptr_static = XNEWVEC (char, PRIVATE_SIZE);
{ 0, 0, 0 },
};
-static struct hash_control *insn_hash = NULL;
+static htab_t insn_hash = NULL;
\f
static int
set_option (const char *arg)
init_defaults ();
- insn_hash = hash_new ();
+ insn_hash = str_htab_create ();
if (insn_hash == NULL)
as_fatal (_("Virtual memory exhausted"));
for (i = 0; i < pdp11_num_opcodes; i++)
- hash_insert (insn_hash, pdp11_opcodes[i].name, (void *) (pdp11_opcodes + i));
+ str_hash_insert (insn_hash, pdp11_opcodes[i].name, (void *) (pdp11_opcodes + i));
for (i = 0; i < pdp11_num_aliases; i++)
- hash_insert (insn_hash, pdp11_aliases[i].name, (void *) (pdp11_aliases + i));
+ str_hash_insert (insn_hash, pdp11_aliases[i].name, (void *) (pdp11_aliases + i));
}
void
c = *p;
*p = '\0';
- op = (struct pdp11_opcode *)hash_find (insn_hash, str);
+ op = (struct pdp11_opcode *)str_hash_find (insn_hash, str);
*p = c;
if (op == 0)
{
const char line_comment_chars[] = "/!#";
static int pending_reloc;
-static struct hash_control *opcode_hash_control;
+static htab_t opcode_hash_control;
static void
little (int ignore ATTRIBUTE_UNUSED)
fake->opcode = -1;
fake->opcode_next = -1;
fake->u.func = func;
- hash_insert (opcode_hash_control, name, (char *) fake);
+ str_hash_insert (opcode_hash_control, name, (char *) fake);
}
/* Enter another entry into the opcode hash table so the same opcode
static void
alias (const char *new_name, const char *old)
{
- hash_insert (opcode_hash_control, new_name,
- (char *) hash_find (opcode_hash_control, old));
+ str_hash_insert (opcode_hash_control, new_name,
+ (char *) str_hash_find (opcode_hash_control, old));
}
/* This function is called once, at assembler startup time. It sets
md_begin (void)
{
const pj_opc_info_t *opcode;
- opcode_hash_control = hash_new ();
+ opcode_hash_control = str_htab_create ();
/* Insert names into hash table. */
for (opcode = pj_opc_info; opcode->u.name; opcode++)
- hash_insert (opcode_hash_control, opcode->u.name, (char *) opcode);
+ str_hash_insert (opcode_hash_control, opcode->u.name, (char *) opcode);
/* Insert the only fake opcode. */
fake_opcode ("ipush", ipush_code);
if (nlen == 0)
as_bad (_("can't find opcode "));
- opcode = (pj_opc_info_t *) hash_find (opcode_hash_control, op_start);
+ opcode = (pj_opc_info_t *) str_hash_find (opcode_hash_control, op_start);
*op_end = pend;
if (opcode == NULL)
static unsigned int ppc_obj64 = BFD_DEFAULT_TARGET_SIZE == 64;
/* Opcode hash table. */
-static struct hash_control *ppc_hash;
+static htab_t ppc_hash;
/* Macro hash table. */
-static struct hash_control *ppc_macro_hash;
+static htab_t ppc_macro_hash;
#ifdef OBJ_ELF
/* What type of shared library support to use. */
bfd_boolean bad_insn = FALSE;
if (ppc_hash != NULL)
- hash_die (ppc_hash);
+ htab_delete (ppc_hash);
if (ppc_macro_hash != NULL)
- hash_die (ppc_macro_hash);
+ htab_delete (ppc_macro_hash);
/* Insert the opcodes into a hash table. */
- ppc_hash = hash_new ();
+ ppc_hash = str_htab_create ();
if (ENABLE_CHECKING)
{
if ((ppc_cpu & op->flags) != 0
&& !(ppc_cpu & op->deprecated))
- {
- const char *retval;
-
- retval = hash_insert (ppc_hash, op->name, (void *) op);
- if (retval != NULL)
- {
- as_bad (_("duplicate instruction %s"),
- op->name);
- bad_insn = TRUE;
- }
- }
+ str_hash_insert (ppc_hash, op->name, (void *) op);
}
if ((ppc_cpu & PPC_OPCODE_ANY) != 0)
for (op = powerpc_opcodes; op < op_end; op++)
- hash_insert (ppc_hash, op->name, (void *) op);
+ str_hash_insert (ppc_hash, op->name, (void *) op);
op_end = prefix_opcodes + prefix_num_opcodes;
for (op = prefix_opcodes; op < op_end; op++)
if ((ppc_cpu & op->flags) != 0
&& !(ppc_cpu & op->deprecated))
- {
- const char *retval;
-
- retval = hash_insert (ppc_hash, op->name, (void *) op);
- if (retval != NULL)
- {
- as_bad (_("duplicate instruction %s"),
- op->name);
- bad_insn = TRUE;
- }
- }
+ str_hash_insert (ppc_hash, op->name, (void *) op);
}
if ((ppc_cpu & PPC_OPCODE_ANY) != 0)
for (op = prefix_opcodes; op < op_end; op++)
- hash_insert (ppc_hash, op->name, (void *) op);
+ str_hash_insert (ppc_hash, op->name, (void *) op);
op_end = vle_opcodes + vle_num_opcodes;
for (op = vle_opcodes; op < op_end; op++)
if ((ppc_cpu & op->flags) != 0
&& !(ppc_cpu & op->deprecated))
- {
- const char *retval;
-
- retval = hash_insert (ppc_hash, op->name, (void *) op);
- if (retval != NULL)
- {
- as_bad (_("duplicate instruction %s"),
- op->name);
- bad_insn = TRUE;
- }
- }
+ str_hash_insert (ppc_hash, op->name, (void *) op);
}
/* SPE2 instructions */
}
if ((ppc_cpu & op->flags) != 0 && !(ppc_cpu & op->deprecated))
- {
- const char *retval;
-
- retval = hash_insert (ppc_hash, op->name, (void *) op);
- if (retval != NULL)
- {
- as_bad (_("duplicate instruction %s"),
- op->name);
- bad_insn = TRUE;
- }
- }
+ str_hash_insert (ppc_hash, op->name, (void *) op);
}
for (op = spe2_opcodes; op < op_end; op++)
- hash_insert (ppc_hash, op->name, (void *) op);
+ str_hash_insert (ppc_hash, op->name, (void *) op);
}
/* Insert the macros into a hash table. */
- ppc_macro_hash = hash_new ();
+ ppc_macro_hash = str_htab_create ();
macro_end = powerpc_macros + powerpc_num_macros;
for (macro = powerpc_macros; macro < macro_end; macro++)
{
if ((macro->flags & ppc_cpu) != 0 || (ppc_cpu & PPC_OPCODE_ANY) != 0)
- {
- const char *retval;
-
- retval = hash_insert (ppc_macro_hash, macro->name, (void *) macro);
- if (retval != (const char *) NULL)
- {
- as_bad (_("duplicate macro %s"), macro->name);
- bad_insn = TRUE;
- }
- }
+ str_hash_insert (ppc_macro_hash, macro->name, (void *) macro);
}
if (bad_insn)
*s++ = '\0';
/* Look up the opcode in the hash table. */
- opcode = (const struct powerpc_opcode *) hash_find (ppc_hash, str);
+ opcode = (const struct powerpc_opcode *) str_hash_find (ppc_hash, str);
if (opcode == (const struct powerpc_opcode *) NULL)
{
const struct powerpc_macro *macro;
- macro = (const struct powerpc_macro *) hash_find (ppc_macro_hash, str);
+ macro = (const struct powerpc_macro *) str_hash_find (ppc_macro_hash, str);
if (macro == (const struct powerpc_macro *) NULL)
as_bad (_("unrecognized opcode: `%s'"), str);
else
} pru_insn_infoS;
/* Opcode hash table. */
-static struct hash_control *pru_opcode_hash = NULL;
+static htab_t pru_opcode_hash = NULL;
#define pru_opcode_lookup(NAME) \
- ((struct pru_opcode *) hash_find (pru_opcode_hash, (NAME)))
+ ((struct pru_opcode *) str_hash_find (pru_opcode_hash, (NAME)))
/* Register hash table. */
-static struct hash_control *pru_reg_hash = NULL;
+static htab_t pru_reg_hash = NULL;
#define pru_reg_lookup(NAME) \
- ((struct pru_reg *) hash_find (pru_reg_hash, (NAME)))
+ ((struct pru_reg *) str_hash_find (pru_reg_hash, (NAME)))
/* The known current alignment of the current section. */
static int pru_current_align;
md_begin (void)
{
int i;
- const char *inserted;
/* Create and fill a hashtable for the PRU opcodes, registers and
arguments. */
- pru_opcode_hash = hash_new ();
- pru_reg_hash = hash_new ();
+ pru_opcode_hash = str_htab_create ();
+ pru_reg_hash = str_htab_create ();
for (i = 0; i < NUMOPCODES; ++i)
- {
- inserted
- = hash_insert (pru_opcode_hash, pru_opcodes[i].name,
- (PTR) & pru_opcodes[i]);
- if (inserted != NULL)
- {
- fprintf (stderr, _("internal error: can't hash `%s': %s\n"),
- pru_opcodes[i].name, inserted);
- /* Probably a memory allocation problem? Give up now. */
- as_fatal (_("Broken assembler. No assembly attempted."));
- }
- }
+ str_hash_insert (pru_opcode_hash, pru_opcodes[i].name,
+ (PTR) & pru_opcodes[i]);
for (i = 0; i < pru_num_regs; ++i)
- {
- inserted
- = hash_insert (pru_reg_hash, pru_regs[i].name,
- (PTR) & pru_regs[i]);
- if (inserted != NULL)
- {
- fprintf (stderr, _("internal error: can't hash `%s': %s\n"),
- pru_regs[i].name, inserted);
- /* Probably a memory allocation problem? Give up now. */
- as_fatal (_("Broken assembler. No assembly attempted."));
- }
-
- }
+ str_hash_insert (pru_reg_hash, pru_regs[i].name,
+ (PTR) & pru_regs[i]);
linkrelax = pru_opt.link_relax;
/* Initialize the alignment data. */
void
md_end (void)
{
- hash_die (pru_opcode_hash);
- hash_die (pru_reg_hash);
+ htab_delete (pru_opcode_hash);
+ htab_delete (pru_reg_hash);
}
symbolS *
}
/* Handle of the extension with version hash table. */
-static struct hash_control *ext_version_hash = NULL;
+static htab_t ext_version_hash = NULL;
-static struct hash_control *
+static htab_t
init_ext_version_hash (const struct riscv_ext_version *table)
{
int i = 0;
- struct hash_control *hash = hash_new ();
+ htab_t hash = str_htab_create ();
while (table[i].name)
{
const char *name = table[i].name;
- const char *hash_error =
- hash_insert (hash, name, (void *) &table[i]);
-
- if (hash_error != NULL)
- {
- fprintf (stderr, _("internal error: can't hash `%s': %s\n"),
- table[i].name, hash_error);
- /* Probably a memory allocation problem? Give up now. */
- as_fatal (_("Broken assembler. No assembly attempted."));
- return NULL;
- }
+ str_hash_insert (hash, name, (void *) &table[i]);
i++;
while (table[i].name
if (name == NULL || default_isa_spec == ISA_SPEC_CLASS_NONE)
return;
- ext = (struct riscv_ext_version *) hash_find (ext_version_hash, name);
+ ext = (struct riscv_ext_version *) str_hash_find (ext_version_hash, name);
while (ext
&& ext->name
&& strcmp (ext->name, name) == 0)
}
/* Handle of the OPCODE hash table. */
-static struct hash_control *op_hash = NULL;
+static htab_t op_hash = NULL;
/* Handle of the type of .insn hash table. */
-static struct hash_control *insn_type_hash = NULL;
+static htab_t insn_type_hash = NULL;
/* This array holds the chars that always start a comment. If the
pre-processor is disabled, these aren't very useful */
};
/* Hash table for lookup opcode name. */
-static struct hash_control *opcode_names_hash = NULL;
+static htab_t opcode_names_hash = NULL;
/* Initialization for hash table of opcode name. */
static void
init_opcode_names_hash (void)
{
- const char *retval;
const struct opcode_name_t *opcode;
for (opcode = &opcode_name_list[0]; opcode->name != NULL; ++opcode)
- {
- retval = hash_insert (opcode_names_hash, opcode->name, (void *)opcode);
-
- if (retval != NULL)
- as_fatal (_("internal error: can't hash `%s': %s"),
- opcode->name, retval);
- }
+ str_hash_insert (opcode_names_hash, opcode->name, (void *)opcode);
}
/* Find `s` is a valid opcode name or not,
save_c = *e;
*e = '\0';
- o = (struct opcode_name_t *) hash_find (opcode_names_hash, *s);
+ o = (struct opcode_name_t *) str_hash_find (opcode_names_hash, *s);
/* Advance to next token if one was recognized. */
if (o)
RCLASS_CSR
};
-static struct hash_control *reg_names_hash = NULL;
-static struct hash_control *csr_extra_hash = NULL;
+static htab_t reg_names_hash = NULL;
+static htab_t csr_extra_hash = NULL;
#define ENCODE_REG_HASH(cls, n) \
((void *)(uintptr_t)((n) * RCLASS_MAX + (cls) + 1))
hash_reg_name (enum reg_class class, const char *name, unsigned n)
{
void *hash = ENCODE_REG_HASH (class, n);
- const char *retval = hash_insert (reg_names_hash, name, hash);
-
- if (retval != NULL)
- as_fatal (_("internal error: can't hash `%s': %s"), name, retval);
+ str_hash_insert (reg_names_hash, name, hash);
}
static void
enum riscv_priv_spec_class abort_version)
{
struct riscv_csr_extra *entry, *pre_entry;
- const char *hash_error = NULL;
bfd_boolean need_enrty = TRUE;
pre_entry = NULL;
- entry = (struct riscv_csr_extra *) hash_find (csr_extra_hash, name);
+ entry = (struct riscv_csr_extra *) str_hash_find (csr_extra_hash, name);
while (need_enrty && entry != NULL)
{
if (entry->csr_class == class
Otherwise, attach the extra information to the entry which is already
in the hash table. */
if (pre_entry == NULL)
- {
- hash_error = hash_insert (csr_extra_hash, name, (void *) entry);
- if (hash_error != NULL)
- {
- fprintf (stderr, _("internal error: can't hash `%s': %s\n"),
- name, hash_error);
- /* Probably a memory allocation problem? Give up now. */
- as_fatal (_("Broken assembler. No assembly attempted."));
- }
- }
+ str_hash_insert (csr_extra_hash, name, (void *) entry);
else
pre_entry->next = entry;
}
reg_csr_lookup_internal (const char *s)
{
struct riscv_csr_extra *r =
- (struct riscv_csr_extra *) hash_find (csr_extra_hash, s);
+ (struct riscv_csr_extra *) str_hash_find (csr_extra_hash, s);
if (r == NULL)
return -1U;
if (class == RCLASS_CSR)
return reg_csr_lookup_internal (s);
- r = hash_find (reg_names_hash, s);
+ r = str_hash_find (reg_names_hash, s);
if (r == NULL || DECODE_REG_CLASS (r) != class)
return -1;
/* Common hash table initialization function for
instruction and .insn directive. */
-static struct hash_control *
+static htab_t
init_opcode_hash (const struct riscv_opcode *opcodes,
bfd_boolean insn_directive_p)
{
int i = 0;
int length;
- struct hash_control *hash = hash_new ();
+ htab_t hash = str_htab_create ();
while (opcodes[i].name)
{
const char *name = opcodes[i].name;
- const char *hash_error =
- hash_insert (hash, name, (void *) &opcodes[i]);
-
- if (hash_error != NULL)
- {
- fprintf (stderr, _("internal error: can't hash `%s': %s\n"),
- opcodes[i].name, hash_error);
- /* Probably a memory allocation problem? Give up now. */
- as_fatal (_("Broken assembler. No assembly attempted."));
- }
+ str_hash_insert (hash, name, (void *) &opcodes[i]);
do
{
op_hash = init_opcode_hash (riscv_opcodes, FALSE);
insn_type_hash = init_opcode_hash (riscv_insn_types, TRUE);
- reg_names_hash = hash_new ();
+ reg_names_hash = str_htab_create ();
hash_reg_names (RCLASS_GPR, riscv_gpr_names_numeric, NGPR);
hash_reg_names (RCLASS_GPR, riscv_gpr_names_abi, NGPR);
hash_reg_names (RCLASS_FPR, riscv_fpr_names_numeric, NFPR);
hash_reg_name (RCLASS_GPR, "fp", 8);
/* Create and insert CSR hash tables. */
- csr_extra_hash = hash_new ();
+ csr_extra_hash = str_htab_create ();
#define DECLARE_CSR(name, num, class, define_version, abort_version) \
riscv_init_csr_hash (#name, num, class, define_version, abort_version);
#define DECLARE_CSR_ALIAS(name, num, class, define_version, abort_version) \
#include "opcode/riscv-opc.h"
#undef DECLARE_CSR
- opcode_names_hash = hash_new ();
+ opcode_names_hash = str_htab_create ();
init_opcode_names_hash ();
/* Set the default alignment for the text section. */
va_start (args, fmt);
r = BFD_RELOC_UNUSED;
- mo = (struct riscv_opcode *) hash_find (op_hash, name);
+ mo = (struct riscv_opcode *) str_hash_find (op_hash, name);
gas_assert (mo);
/* Find a non-RVC variant of the instruction. append_insn will compress
static const char *
riscv_ip (char *str, struct riscv_cl_insn *ip, expressionS *imm_expr,
- bfd_reloc_code_real_type *imm_reloc, struct hash_control *hash)
+ bfd_reloc_code_real_type *imm_reloc, htab_t hash)
{
char *s;
const char *args;
bfd_boolean insn_with_csr = FALSE;
/* Parse the name of the instruction. Terminate the string if whitespace
- is found so that hash_find only sees the name part of the string. */
+ is found so that str_hash_find only sees the name part of the string. */
for (s = str; *s != '\0'; ++s)
if (ISSPACE (*s))
{
break;
}
- insn = (struct riscv_opcode *) hash_find (hash, str);
+ insn = (struct riscv_opcode *) str_hash_find (hash, str);
argsStart = s;
for ( ; insn && insn->name && strcmp (insn->name, str) == 0; insn++)
/* Local variables. */
/* Opformat hash table. */
-static struct hash_control *s390_opformat_hash;
+static htab_t s390_opformat_hash;
/* Opcode hash table. */
-static struct hash_control *s390_opcode_hash = NULL;
+static htab_t s390_opcode_hash = NULL;
/* Flags to set in the elf header */
static flagword s390_flags = 0;
const struct s390_opcode *op;
const struct s390_opcode *op_end;
bfd_boolean dup_insn = FALSE;
- const char *retval;
if (s390_opcode_hash != NULL)
- hash_die (s390_opcode_hash);
+ htab_delete (s390_opcode_hash);
/* Insert the opcodes into a hash table. */
- s390_opcode_hash = hash_new ();
+ s390_opcode_hash = str_htab_create ();
op_end = s390_opcodes + s390_num_opcodes;
for (op = s390_opcodes; op < op_end; op++)
use_opcode = ((f & current_flags) == f);
}
if (use_opcode)
- {
- retval = hash_insert (s390_opcode_hash, op->name, (void *) op);
- if (retval != (const char *) NULL)
- {
- as_bad (_("Internal assembler error for instruction %s"),
- op->name);
- dup_insn = TRUE;
- }
- }
+ str_hash_insert (s390_opcode_hash, op->name, (void *) op);
while (op < op_end - 1 && strcmp (op->name, op[1].name) == 0)
op++;
{
const struct s390_opcode *op;
const struct s390_opcode *op_end;
- const char *retval;
/* Give a warning if the combination -m64-bit and -Aesa is used. */
if (s390_arch_size == 64 && current_cpu < S390_OPCODE_Z900)
bfd_set_private_flags (stdoutput, s390_flags);
/* Insert the opcode formats into a hash table. */
- s390_opformat_hash = hash_new ();
+ s390_opformat_hash = str_htab_create ();
op_end = s390_opformats + s390_num_opformats;
for (op = s390_opformats; op < op_end; op++)
- {
- retval = hash_insert (s390_opformat_hash, op->name, (void *) op);
- if (retval != (const char *) NULL)
- as_bad (_("Internal assembler error for instruction format %s"),
- op->name);
- }
+ str_hash_insert (s390_opformat_hash, op->name, (void *) op);
s390_setup_opcodes ();
*s++ = '\0';
/* Look up the opcode in the hash table. */
- opcode = (struct s390_opcode *) hash_find (s390_opcode_hash, str);
+ opcode = (struct s390_opcode *) str_hash_find (s390_opcode_hash, str);
if (opcode == (const struct s390_opcode *) NULL)
{
as_bad (_("Unrecognized opcode: `%s'"), str);
/* Look up the opcode in the hash table. */
opformat = (struct s390_opcode *)
- hash_find (s390_opformat_hash, input_line_pointer);
+ str_hash_find (s390_opformat_hash, input_line_pointer);
if (opformat == (const struct s390_opcode *) NULL)
{
as_bad (_("Unrecognized opcode format: `%s'"), input_line_pointer);
{
const struct s3_reg_entry *names;
int max_regno;
- struct hash_control *htab;
+ htab_t htab;
const char *expected;
};
{s3_score_crn_table, 31, NULL, N_("S+core co-processor register expected")},
};
-static struct hash_control *s3_score_ops_hsh = NULL;
-static struct hash_control *s3_dependency_insn_hsh = NULL;
+static htab_t s3_score_ops_hsh = NULL;
+static htab_t s3_dependency_insn_hsh = NULL;
struct s3_datafield_range
}
static int
-s3_score_reg_parse (char **ccp, struct hash_control *htab)
+s3_score_reg_parse (char **ccp, htab_t htab)
{
char *start = *ccp;
char c;
c = *p++;
*--p = 0;
- reg = (struct s3_reg_entry *) hash_find (htab, start);
+ reg = (struct s3_reg_entry *) str_hash_find (htab, start);
*p = c;
if (reg)
const struct s3_insn_to_dependency *tmp;
strcpy (name, insn_name);
- tmp = (const struct s3_insn_to_dependency *) hash_find (s3_dependency_insn_hsh, name);
+ tmp = (const struct s3_insn_to_dependency *) str_hash_find (s3_dependency_insn_hsh, name);
if (tmp)
return tmp->type;
c = *p;
*p = '\0';
- opcode = (const struct s3_asm_opcode *) hash_find (s3_score_ops_hsh, operator);
+ opcode = (const struct s3_asm_opcode *) str_hash_find (s3_score_ops_hsh, operator);
*p = c;
memset (&s3_inst, '\0', sizeof (s3_inst));
c = *p;
*p = '\0';
- opcode = (const struct s3_asm_opcode *) hash_find (s3_score_ops_hsh, operator);
+ opcode = (const struct s3_asm_opcode *) str_hash_find (s3_score_ops_hsh, operator);
*p = c;
memset (&s3_inst, '\0', sizeof (s3_inst));
}
static void
-s3_insert_reg (const struct s3_reg_entry *r, struct hash_control *htab)
+s3_insert_reg (const struct s3_reg_entry *r, htab_t htab)
{
int i = 0;
int len = strlen (r->name) + 2;
}
buf2[i] = '\0';
- hash_insert (htab, buf, (void *) r);
- hash_insert (htab, buf2, (void *) r);
+ str_hash_insert (htab, buf, (void *) r);
+ str_hash_insert (htab, buf2, (void *) r);
}
static void
{
const struct s3_reg_entry *r;
- if ((map->htab = hash_new ()) == NULL)
+ if ((map->htab = str_htab_create ()) == NULL)
{
as_fatal (_("virtual memory exhausted"));
}
new_opcode->relax_value = insn->relax_value;
new_opcode->type = insn->type;
new_opcode->bitmask = insn->bitmask;
- hash_insert (s3_score_ops_hsh, new_opcode->template_name,
+ str_hash_insert (s3_score_ops_hsh, new_opcode->template_name,
(void *) new_opcode);
}
}
strcpy (buf, tmp->insn_name);
new_i2n->insn_name = buf;
new_i2n->type = tmp->type;
- hash_insert (s3_dependency_insn_hsh, new_i2n->insn_name,
+ str_hash_insert (s3_dependency_insn_hsh, new_i2n->insn_name,
(void *) new_i2n);
}
}
segT seg;
subsegT subseg;
- if ((s3_score_ops_hsh = hash_new ()) == NULL)
+ if ((s3_score_ops_hsh = str_htab_create ()) == NULL)
as_fatal (_("virtual memory exhausted"));
s3_build_score_ops_hsh ();
- if ((s3_dependency_insn_hsh = hash_new ()) == NULL)
+ if ((s3_dependency_insn_hsh = str_htab_create ()) == NULL)
as_fatal (_("virtual memory exhausted"));
s3_build_dependency_insn_hsh ();
{
const struct s7_reg_entry *names;
int max_regno;
- struct hash_control *htab;
+ htab_t htab;
const char *expected;
};
{s7_score_crn_table, 31, NULL, N_("S+core co-processor register expected")},
};
-static struct hash_control *s7_score_ops_hsh = NULL;
-static struct hash_control *s7_dependency_insn_hsh = NULL;
+static htab_t s7_score_ops_hsh = NULL;
+static htab_t s7_dependency_insn_hsh = NULL;
\f
struct s7_datafield_range
}
static int
-s7_score_reg_parse (char **ccp, struct hash_control *htab)
+s7_score_reg_parse (char **ccp, htab_t htab)
{
char *start = *ccp;
char c;
c = *p++;
*--p = 0;
- reg = (struct s7_reg_entry *) hash_find (htab, start);
+ reg = (struct s7_reg_entry *) str_hash_find (htab, start);
*p = c;
if (reg)
const struct s7_insn_to_dependency *tmp;
strcpy (name, insn_name);
- tmp = (const struct s7_insn_to_dependency *) hash_find (s7_dependency_insn_hsh, name);
+ tmp = (const struct s7_insn_to_dependency *) str_hash_find (s7_dependency_insn_hsh, name);
if (tmp)
return tmp->type;
c = *p;
*p = '\0';
- opcode = (const struct s7_asm_opcode *) hash_find (s7_score_ops_hsh, operator);
+ opcode = (const struct s7_asm_opcode *) str_hash_find (s7_score_ops_hsh, operator);
*p = c;
memset (&s7_inst, '\0', sizeof (s7_inst));
new_opcode->relax_value = insn->relax_value;
new_opcode->type = insn->type;
new_opcode->bitmask = insn->bitmask;
- hash_insert (s7_score_ops_hsh, new_opcode->template_name,
+ str_hash_insert (s7_score_ops_hsh, new_opcode->template_name,
(void *) new_opcode);
}
}
strcpy (insn_name, tmp->insn_name);
new_i2d->insn_name = insn_name;
new_i2d->type = tmp->type;
- hash_insert (s7_dependency_insn_hsh, new_i2d->insn_name,
+ str_hash_insert (s7_dependency_insn_hsh, new_i2d->insn_name,
(void *) new_i2d);
}
}
\f
static void
-s7_insert_reg (const struct s7_reg_entry *r, struct hash_control *htab)
+s7_insert_reg (const struct s7_reg_entry *r, htab_t htab)
{
int i = 0;
int len = strlen (r->name) + 2;
}
buf2[i] = '\0';
- hash_insert (htab, buf, (void *) r);
- hash_insert (htab, buf2, (void *) r);
+ str_hash_insert (htab, buf, (void *) r);
+ str_hash_insert (htab, buf2, (void *) r);
}
static void
{
const struct s7_reg_entry *r;
- if ((map->htab = hash_new ()) == NULL)
+ if ((map->htab = str_htab_create ()) == NULL)
{
as_fatal (_("virtual memory exhausted"));
}
segT seg;
subsegT subseg;
- if ((s7_score_ops_hsh = hash_new ()) == NULL)
+ if ((s7_score_ops_hsh = str_htab_create ()) == NULL)
as_fatal (_("virtual memory exhausted"));
s7_build_score_ops_hsh ();
- if ((s7_dependency_insn_hsh = hash_new ()) == NULL)
+ if ((s7_dependency_insn_hsh = str_htab_create ()) == NULL)
as_fatal (_("virtual memory exhausted"));
s7_build_dependency_insn_hsh ();
#undef EMPTY
-static struct hash_control *opcode_hash_control; /* Opcode mnemonics */
+static htab_t opcode_hash_control; /* Opcode mnemonics */
\f
#ifdef OBJ_ELF
= preset_target_arch ? preset_target_arch : arch_sh_up & ~arch_sh_has_dsp;
valid_arch = target_arch;
- opcode_hash_control = hash_new ();
+ opcode_hash_control = str_htab_create ();
/* Insert unique names into hash table. */
for (opcode = sh_table; opcode->name; opcode++)
if (!SH_MERGE_ARCH_SET_VALID (opcode->arch, target_arch))
continue;
prev_name = opcode->name;
- hash_insert (opcode_hash_control, opcode->name, (char *) opcode);
+ str_hash_insert (opcode_hash_control, opcode->name, (char *) opcode);
}
}
}
if (nlen == 0)
as_bad (_("can't find opcode "));
- return (sh_opcode_info *) hash_find (opcode_hash_control, name);
+ return (sh_opcode_info *) str_hash_find (opcode_hash_control, name);
}
/* Assemble a parallel processing insn. */
#endif
/* Handle of the OPCODE hash table. */
-static struct hash_control *op_hash;
+static htab_t op_hash;
static void s_data1 (void);
static void s_seg (int);
void
md_begin (void)
{
- const char *retval = NULL;
int lose = 0;
unsigned int i = 0;
init_default_arch ();
sparc_cie_data_alignment = sparc_arch_size == 64 ? -8 : -4;
- op_hash = hash_new ();
+ op_hash = str_htab_create ();
while (i < (unsigned int) sparc_num_opcodes)
{
const char *name = sparc_opcodes[i].name;
- retval = hash_insert (op_hash, name, (void *) &sparc_opcodes[i]);
- if (retval != NULL)
- {
- as_bad (_("Internal error: can't hash `%s': %s\n"),
- sparc_opcodes[i].name, retval);
- lose = 1;
- }
+ str_hash_insert (op_hash, name, (void *) &sparc_opcodes[i]);
do
{
if (sparc_opcodes[i].match & sparc_opcodes[i].lose)
const char *name = ((sparc_arch_size == 32)
? native_op_table[i].name32
: native_op_table[i].name64);
- insn = (struct sparc_opcode *) hash_find (op_hash, name);
+ insn = (struct sparc_opcode *) str_hash_find (op_hash, name);
if (insn == NULL)
{
as_bad (_("Internal error: can't find opcode `%s' for `%s'\n"),
lose = 1;
}
else
- {
- retval = hash_insert (op_hash, native_op_table[i].name,
- (void *) insn);
- if (retval != NULL)
- {
- as_bad (_("Internal error: can't hash `%s': %s\n"),
- sparc_opcodes[i].name, retval);
- lose = 1;
- }
- }
+ str_hash_insert (op_hash, native_op_table[i].name,
+ (void *) insn);
}
if (lose)
*pinsn = NULL;
return special_case;
}
- insn = (struct sparc_opcode *) hash_find (op_hash, str);
+ insn = (struct sparc_opcode *) str_hash_find (op_hash, str);
*pinsn = insn;
if (insn == NULL)
{
static void spu_cons (int);
extern char *myname;
-static struct hash_control *op_hash = NULL;
+static htab_t op_hash = NULL;
/* These bits should be turned off in the first address of every segment */
int md_seg_align = 7;
void
md_begin (void)
{
- const char *retval = NULL;
int i;
/* initialize hash table */
- op_hash = hash_new ();
+ op_hash = str_htab_create ();
/* loop until you see the end of the list */
for (i = 0; i < spu_num_opcodes; i++)
- {
- /* hash each mnemonic and record its position */
-
- retval = hash_insert (op_hash, spu_opcodes[i].mnemonic,
- (void *) &spu_opcodes[i]);
-
- if (retval != NULL && strcmp (retval, "exists") != 0)
- as_fatal (_("Can't hash instruction '%s':%s"),
- spu_opcodes[i].mnemonic, retval);
- }
+ /* hash each mnemonic and record its position */
+ if (str_hash_find (op_hash, spu_opcodes[i].mnemonic) == NULL)
+ str_hash_insert (op_hash, spu_opcodes[i].mnemonic,
+ (void *) &spu_opcodes[i]);
}
\f
const char *md_shortopts = "";
/* try to find the instruction in the hash table */
- if ((format = (struct spu_opcode *) hash_find (op_hash, op)) == NULL)
+ if ((format = (struct spu_opcode *) str_hash_find (op_hash, op)) == NULL)
{
as_bad (_("Invalid mnemonic '%s'"), op);
return;
}
/* Hash table for opcode lookup. */
-static struct hash_control *op_hash;
+static htab_t op_hash;
/* Hash table for parallel opcode lookup. */
-static struct hash_control *parop_hash;
+static htab_t parop_hash;
/* Hash table for register lookup. */
-static struct hash_control *reg_hash;
+static htab_t reg_hash;
/* Hash table for indirect addressing lookup. */
-static struct hash_control *ind_hash;
+static htab_t ind_hash;
void
md_begin (void)
{
- const char *hash_err;
-
debug ("In md_begin()\n");
- op_hash = hash_new ();
+ op_hash = str_htab_create ();
{
const insn_template *current_optab = tic30_optab;
for (; current_optab < tic30_optab_end; current_optab++)
- {
- hash_err = hash_insert (op_hash, current_optab->name,
- (char *) current_optab);
- if (hash_err)
- as_fatal ("Internal Error: Can't Hash %s: %s",
- current_optab->name, hash_err);
- }
+ str_hash_insert (op_hash, current_optab->name,
+ (char *) current_optab);
}
- parop_hash = hash_new ();
+ parop_hash = str_htab_create ();
{
const partemplate *current_parop = tic30_paroptab;
for (; current_parop < tic30_paroptab_end; current_parop++)
- {
- hash_err = hash_insert (parop_hash, current_parop->name,
- (char *) current_parop);
- if (hash_err)
- as_fatal ("Internal Error: Can't Hash %s: %s",
- current_parop->name, hash_err);
- }
+ str_hash_insert (parop_hash, current_parop->name,
+ (char *) current_parop);
}
- reg_hash = hash_new ();
+ reg_hash = str_htab_create ();
{
const reg *current_reg = tic30_regtab;
for (; current_reg < tic30_regtab_end; current_reg++)
- {
- hash_err = hash_insert (reg_hash, current_reg->name,
- (char *) current_reg);
- if (hash_err)
- as_fatal ("Internal Error: Can't Hash %s: %s",
- current_reg->name, hash_err);
- }
+ str_hash_insert (reg_hash, current_reg->name,
+ (char *) current_reg);
}
- ind_hash = hash_new ();
+ ind_hash = str_htab_create ();
{
const ind_addr_type *current_ind = tic30_indaddr_tab;
for (; current_ind < tic30_indaddrtab_end; current_ind++)
- {
- hash_err = hash_insert (ind_hash, current_ind->syntax,
- (char *) current_ind);
- if (hash_err)
- as_fatal ("Internal Error: Can't Hash %s: %s",
- current_ind->syntax, hash_err);
- }
+ str_hash_insert (ind_hash, current_ind->syntax,
+ (char *) current_ind);
}
/* Fill in lexical tables: opcode_chars, operand_chars, space_chars. */
&& (*(token + count) == 'r' || *(token + count) == 'R'))
{
/* AR reference is found, so get its number and remove
- it from the buffer so it can pass through hash_find(). */
+ it from the buffer so it can pass through str_hash_find(). */
if (found_ar)
{
as_bad (_("More than one AR register found in indirect reference"));
return NULL;
}
- ind_addr_op = (ind_addr_type *) hash_find (ind_hash, ind_buffer);
+ ind_addr_op = (ind_addr_type *) str_hash_find (ind_hash, ind_buffer);
if (ind_addr_op)
{
debug ("Found indirect reference: %s\n", ind_addr_op->syntax);
}
else
{
- reg *regop = (reg *) hash_find (reg_hash, token);
+ reg *regop = (reg *) str_hash_find (reg_hash, token);
if (regop)
{
/* Find instruction. */
save_char = *current_posn;
*current_posn = '\0';
- p_opcode = (partemplate *) hash_find (parop_hash, token);
+ p_opcode = (partemplate *) str_hash_find (parop_hash, token);
if (p_opcode)
{
debug ("Found instruction %s\n", p_opcode->name);
debug ("first_opcode = %s\n", first_opcode);
debug ("second_opcode = %s\n", second_opcode);
sprintf (token, "q_%s_%s", second_opcode, first_opcode);
- p_opcode = (partemplate *) hash_find (parop_hash, token);
+ p_opcode = (partemplate *) str_hash_find (parop_hash, token);
if (p_opcode)
{
/* Find instruction. */
save_char = *current_posn;
*current_posn = '\0';
- op = (insn_template *) hash_find (op_hash, token_start);
+ op = (insn_template *) str_hash_find (op_hash, token_start);
if (op)
{
debug ("Found instruction %s\n", op->name);
#define TIC4X_ALT_SYNTAX
/* Handle of the inst mnemonic hash table. */
-static struct hash_control *tic4x_op_hash = NULL;
+static htab_t tic4x_op_hash = NULL;
/* Handle asg pseudo. */
-static struct hash_control *tic4x_asg_hash = NULL;
+static htab_t tic4x_asg_hash = NULL;
static unsigned int tic4x_cpu = 0; /* Default to TMS320C40. */
static unsigned int tic4x_revision = 0; /* CPU revision */
c = get_symbol_name (&name); /* Get terminator. */
str = xstrdup (str);
name = xstrdup (name);
- if (hash_find (tic4x_asg_hash, name))
- hash_replace (tic4x_asg_hash, name, (void *) str);
- else
- hash_insert (tic4x_asg_hash, name, (void *) str);
+ str_hash_insert (tic4x_asg_hash, name, str);
(void) restore_line_pointer (c);
demand_empty_rest_of_line ();
}
}
/* Insert a new instruction template into hash table. */
-static int
+static void
tic4x_inst_insert (const tic4x_inst_t *inst)
{
static char prev_name[16];
- const char *retval = NULL;
/* Only insert the first name if have several similar entries. */
if (!strcmp (inst->name, prev_name) || inst->name[0] == '\0')
- return 1;
+ return;
- retval = hash_insert (tic4x_op_hash, inst->name, (void *) inst);
- if (retval != NULL)
- fprintf (stderr, "internal error: can't hash `%s': %s\n",
- inst->name, retval);
- else
- strcpy (prev_name, inst->name);
- return retval == NULL;
+ str_hash_insert (tic4x_op_hash, inst->name, (void *) inst);
+ strcpy (prev_name, inst->name);
}
/* Make a new instruction template. */
}
/* Add instruction template, creating dynamic templates as required. */
-static int
+static void
tic4x_inst_add (const tic4x_inst_t *insts)
{
const char *s = insts->name;
char *d;
unsigned int i;
- int ok = 1;
char name[16];
d = name;
/* We do not care about INSNs that is not a part of our
oplevel setting. */
if ((insts->oplevel & tic4x_oplevel) == 0)
- return ok;
+ return;
while (1)
{
*e = '\0';
/* If instruction found then have already processed it. */
- if (hash_find (tic4x_op_hash, name))
- return 1;
+ if (str_hash_find (tic4x_op_hash, name))
+ return;
do
{
(*s == 'B' ? 16 : 23)),
insts[k].args);
if (k == 0) /* Save strcmp() with following func. */
- ok &= tic4x_inst_insert (inst);
+ tic4x_inst_insert (inst);
k++;
}
while (!strcmp (insts->name,
insts[k].name));
}
- return ok;
- break;
+ return;
case '\0':
- return tic4x_inst_insert (insts);
- break;
+ tic4x_inst_insert (insts);
+ return;
default:
*d++ = *s++;
void
md_begin (void)
{
- int ok = 1;
unsigned int i;
/* Setup the proper opcode level according to the
tic4x_oplevel |= OP_IDLE2;
/* Create hash table for mnemonics. */
- tic4x_op_hash = hash_new ();
+ tic4x_op_hash = str_htab_create ();
/* Create hash table for asg pseudo. */
- tic4x_asg_hash = hash_new ();
+ tic4x_asg_hash = str_htab_create ();
/* Add mnemonics to hash table, expanding conditional mnemonics on fly. */
for (i = 0; i < tic4x_num_insts; i++)
- ok &= tic4x_inst_add (tic4x_insts + i);
+ tic4x_inst_add (tic4x_insts + i);
/* Create dummy inst to avoid errors accessing end of table. */
tic4x_inst_make ("", 0, "");
- if (!ok)
- as_fatal ("Broken assembler. No assembly attempted.");
-
/* Add registers to symbol table. */
tic4x_init_regtable ();
c = get_symbol_name (&str); /* Get terminator. */
new_pointer = input_line_pointer;
- if (strlen (str) && (entry = hash_find (tic4x_asg_hash, str)) != NULL)
+ if (strlen (str) && (entry = str_hash_find (tic4x_asg_hash, str)) != NULL)
{
(void) restore_line_pointer (c);
input_line_pointer = (char *) entry;
/* Skip past instruction mnemonic. */
while (*s && *s != ' ')
s++;
- if (*s) /* Null terminate for hash_find. */
+ if (*s) /* Null terminate for str_hash_find. */
*s++ = '\0'; /* and skip past null. */
len = strlen (insn->name);
snprintf (insn->name + len, TIC4X_NAME_MAX - len, "_%s", str);
if (insn->in_use)
{
if ((insn->inst = (struct tic4x_inst *)
- hash_find (tic4x_op_hash, insn->name)) == NULL)
+ str_hash_find (tic4x_op_hash, insn->name)) == NULL)
{
as_bad (_("Unknown opcode `%s'."), insn->name);
insn->parallel = 0;
s = str;
while (*s && *s != ' ') /* Skip past instruction mnemonic. */
s++;
- if (*s) /* Null terminate for hash_find. */
+ if (*s) /* Null terminate for str_hash_find. */
*s++ = '\0'; /* and skip past null. */
strncpy (insn->name, str, TIC4X_NAME_MAX - 1);
insn->name[TIC4X_NAME_MAX - 1] = '\0';
/* This ensures that all new labels are unique. */
static int local_label_id;
-static struct hash_control *subsym_recurse_hash; /* Prevent infinite recurse. */
-static struct hash_control *math_hash; /* Built-in math functions. */
+static htab_t subsym_recurse_hash; /* Prevent infinite recurse. */
+static htab_t math_hash; /* Built-in math functions. */
/* Allow maximum levels of macro nesting; level 0 is the main substitution
symbol table. The other assembler only does 32 levels, so there! */
#define MAX_SUBSYM_HASH 100
-static struct hash_control *subsym_hash[MAX_SUBSYM_HASH];
+static htab_t subsym_hash[MAX_SUBSYM_HASH];
/* Keep track of local labels so we can substitute them before GAS sees them
since macros use their own 'namespace' for local labels, use a separate hash
We use our own macro nesting counter, since GAS overloads it when expanding
other things (like conditionals and repeat loops). */
static int macro_level = 0;
-static struct hash_control *local_label_hash[100];
+static htab_t local_label_hash[100];
/* Keep track of struct/union tags. */
-static struct hash_control *stag_hash;
-static struct hash_control *op_hash;
-static struct hash_control *parop_hash;
-static struct hash_control *reg_hash;
-static struct hash_control *mmreg_hash;
-static struct hash_control *cc_hash;
-static struct hash_control *cc2_hash;
-static struct hash_control *cc3_hash;
-static struct hash_control *sbit_hash;
-static struct hash_control *misc_symbol_hash;
+static htab_t stag_hash;
+static htab_t op_hash;
+static htab_t parop_hash;
+static htab_t reg_hash;
+static htab_t mmreg_hash;
+static htab_t cc_hash;
+static htab_t cc2_hash;
+static htab_t cc3_hash;
+static htab_t sbit_hash;
+static htab_t misc_symbol_hash;
/* Only word (et al.), align, or conditionals are allowed within
.struct/.union. */
replacement = concat (S_GET_NAME (rootsym), "+", root_stag_name,
name + strlen (S_GET_NAME (rootsym)), NULL);
- hash_insert (subsym_hash[0], name, replacement);
+ str_hash_insert (subsym_hash[0], name, replacement);
}
/* Recurse if the field is a structure.
/* Nested .structs don't get put in the stag table. */
if (current_stag->outer == NULL)
{
- hash_insert (stag_hash, current_stag->name, current_stag);
+ str_hash_insert (stag_hash, current_stag->name, current_stag);
stag_add_field_symbols (current_stag, path,
S_GET_VALUE (current_stag->sym),
NULL, NULL);
{
char *name;
int c = get_symbol_name (&name);
- struct stag *stag = (struct stag *) hash_find (stag_hash, name);
+ struct stag *stag = (struct stag *) str_hash_find (stag_hash, name);
if (!stag)
{
/* Remove the symbol from the local label hash lookup. */
-static void
-tic54x_remove_local_label (const char *key, void *value ATTRIBUTE_UNUSED)
+static int
+tic54x_remove_local_label (void **slot, void *arg ATTRIBUTE_UNUSED)
{
- void *elem = hash_delete (local_label_hash[macro_level], key, FALSE);
+ string_tuple_t *tuple = *((string_tuple_t **) slot);
+ void *elem = str_hash_find (local_label_hash[macro_level], tuple->key);
+ str_hash_delete (local_label_hash[macro_level], tuple->key);
free (elem);
+ return 0;
}
/* Reset all local labels. */
static void
tic54x_clear_local_labels (int ignored ATTRIBUTE_UNUSED)
{
- hash_traverse (local_label_hash[macro_level], tic54x_remove_local_label);
+ htab_traverse (local_label_hash[macro_level], tic54x_remove_local_label, NULL);
}
/* .text
c = get_symbol_name (&name);
/* .var symbols start out with a null string. */
name = xstrdup (name);
- hash_insert (subsym_hash[macro_level], name, empty);
+ str_hash_insert (subsym_hash[macro_level], name, empty);
c = restore_line_pointer (c);
if (c == ',')
{
as_fatal (_("Macro nesting is too deep"));
return;
}
- subsym_hash[macro_level] = hash_new ();
- local_label_hash[macro_level] = hash_new ();
+ subsym_hash[macro_level] = str_htab_create ();
+ local_label_hash[macro_level] = str_htab_create ();
}
void
name[entry->name.len] = '\0';
value[entry->actual.len] = '\0';
- hash_insert (subsym_hash[macro_level], name, value);
+ str_hash_insert (subsym_hash[macro_level], name, value);
}
}
void
tic54x_macro_end (void)
{
- hash_die (subsym_hash[macro_level]);
+ htab_delete (subsym_hash[macro_level]);
subsym_hash[macro_level] = NULL;
- hash_die (local_label_hash[macro_level]);
+ htab_delete (local_label_hash[macro_level]);
local_label_hash[macro_level] = NULL;
--macro_level;
}
static int
subsym_isreg (char *a, char *ignore ATTRIBUTE_UNUSED)
{
- if (hash_find (reg_hash, a))
+ if (str_hash_find (reg_hash, a))
return 1;
- if (hash_find (mmreg_hash, a))
+ if (str_hash_find (mmreg_hash, a))
return 1;
return 0;
}
static int
subsym_structsz (char *name, char *ignore ATTRIBUTE_UNUSED)
{
- struct stag *stag = (struct stag *) hash_find (stag_hash, name);
+ struct stag *stag = (struct stag *) str_hash_find (stag_hash, name);
if (stag)
return stag->size;
tic54x_symbol *sym;
const subsym_proc_entry *subsym_proc;
const math_proc_entry *math_proc;
- const char *hash_err;
char **symname;
char *TIC54X_DIR = getenv ("TIC54X_DIR");
char *A_DIR = TIC54X_DIR ? TIC54X_DIR : getenv ("A_DIR");
while (tmp != NULL);
}
- op_hash = hash_new ();
+ op_hash = str_htab_create ();
for (tm = (insn_template *) tic54x_optab; tm->name; tm++)
{
- if (hash_find (op_hash, tm->name))
+ if (str_hash_find (op_hash, tm->name))
continue;
- hash_err = hash_insert (op_hash, tm->name, (char *) tm);
- if (hash_err)
- as_fatal ("Internal Error: Can't hash %s: %s",
- tm->name, hash_err);
+ str_hash_insert (op_hash, tm->name, (char *) tm);
}
- parop_hash = hash_new ();
+ parop_hash = str_htab_create ();
for (tm = (insn_template *) tic54x_paroptab; tm->name; tm++)
{
- if (hash_find (parop_hash, tm->name))
+ if (str_hash_find (parop_hash, tm->name))
continue;
- hash_err = hash_insert (parop_hash, tm->name, (char *) tm);
- if (hash_err)
- as_fatal ("Internal Error: Can't hash %s: %s",
- tm->name, hash_err);
+ str_hash_insert (parop_hash, tm->name, (char *) tm);
}
- reg_hash = hash_new ();
+ reg_hash = str_htab_create ();
for (sym = (tic54x_symbol *) regs; sym->name; sym++)
{
/* Add basic registers to the symbol table. */
(valueT) sym->value, &zero_address_frag);
SF_SET_LOCAL (symbolP);
symbol_table_insert (symbolP);
- hash_err = hash_insert (reg_hash, sym->name, (char *) sym);
+ str_hash_insert (reg_hash, sym->name, (char *) sym);
}
for (sym = (tic54x_symbol *) mmregs; sym->name; sym++)
- hash_err = hash_insert (reg_hash, sym->name, (char *) sym);
- mmreg_hash = hash_new ();
+ str_hash_insert (reg_hash, sym->name, (char *) sym);
+ mmreg_hash = str_htab_create ();
for (sym = (tic54x_symbol *) mmregs; sym->name; sym++)
- hash_err = hash_insert (mmreg_hash, sym->name, (char *) sym);
+ str_hash_insert (mmreg_hash, sym->name, (char *) sym);
- cc_hash = hash_new ();
+ cc_hash = str_htab_create ();
for (sym = (tic54x_symbol *) condition_codes; sym->name; sym++)
- hash_err = hash_insert (cc_hash, sym->name, (char *) sym);
+ str_hash_insert (cc_hash, sym->name, (char *) sym);
- cc2_hash = hash_new ();
+ cc2_hash = str_htab_create ();
for (sym = (tic54x_symbol *) cc2_codes; sym->name; sym++)
- hash_err = hash_insert (cc2_hash, sym->name, (char *) sym);
+ str_hash_insert (cc2_hash, sym->name, (char *) sym);
- cc3_hash = hash_new ();
+ cc3_hash = str_htab_create ();
for (sym = (tic54x_symbol *) cc3_codes; sym->name; sym++)
- hash_err = hash_insert (cc3_hash, sym->name, (char *) sym);
+ str_hash_insert (cc3_hash, sym->name, (char *) sym);
- sbit_hash = hash_new ();
+ sbit_hash = str_htab_create ();
for (sym = (tic54x_symbol *) status_bits; sym->name; sym++)
- hash_err = hash_insert (sbit_hash, sym->name, (char *) sym);
+ str_hash_insert (sbit_hash, sym->name, (char *) sym);
- misc_symbol_hash = hash_new ();
+ misc_symbol_hash = str_htab_create ();
for (symname = (char **) misc_symbols; *symname; symname++)
- hash_err = hash_insert (misc_symbol_hash, *symname, *symname);
+ str_hash_insert (misc_symbol_hash, *symname, *symname);
/* Only the base substitution table and local label table are initialized;
the others (for local macro substitution) get instantiated as needed. */
- local_label_hash[0] = hash_new ();
- subsym_hash[0] = hash_new ();
+ local_label_hash[0] = str_htab_create ();
+ subsym_hash[0] = str_htab_create ();
for (subsym_proc = subsym_procs; subsym_proc->name; subsym_proc++)
- hash_err = hash_insert (subsym_hash[0], subsym_proc->name,
- (char *) subsym_proc);
+ str_hash_insert (subsym_hash[0], subsym_proc->name,
+ (char *) subsym_proc);
- math_hash = hash_new ();
+ math_hash = str_htab_create ();
for (math_proc = math_procs; math_proc->name; math_proc++)
{
/* Insert into the main subsym hash for recognition; insert into
the math hash to actually store information. */
- hash_err = hash_insert (subsym_hash[0], math_proc->name,
- (char *) math_proc);
- hash_err = hash_insert (math_hash, math_proc->name,
- (char *) math_proc);
+ str_hash_insert (subsym_hash[0], math_proc->name,
+ (char *) math_proc);
+ str_hash_insert (math_hash, math_proc->name,
+ (char *) math_proc);
}
- subsym_recurse_hash = hash_new ();
- stag_hash = hash_new ();
+ subsym_recurse_hash = str_htab_create ();
+ stag_hash = str_htab_create ();
}
static int
{
return (is_absolute (operand)
|| is_immediate (operand)
- || hash_find (mmreg_hash, operand->buf) != 0);
+ || str_hash_find (mmreg_hash, operand->buf) != 0);
}
static int
return strncasecmp ("ar", operand->buf, 2) == 0
&& ISDIGIT (operand->buf[2]);
case OP_SBIT:
- return hash_find (sbit_hash, operand->buf) != 0 || is_absolute (operand);
+ return str_hash_find (sbit_hash, operand->buf) != 0 || is_absolute (operand);
case OP_CC:
- return hash_find (cc_hash, operand->buf) != 0;
+ return str_hash_find (cc_hash, operand->buf) != 0;
case OP_CC2:
- return hash_find (cc2_hash, operand->buf) != 0;
+ return str_hash_find (cc2_hash, operand->buf) != 0;
case OP_CC3:
- return hash_find (cc3_hash, operand->buf) != 0
+ return str_hash_find (cc3_hash, operand->buf) != 0
|| is_immediate (operand) || is_absolute (operand);
case OP_16:
return (is_immediate (operand) || is_absolute (operand))
static int
encode_condition (tic54x_insn *insn, struct opstruct *operand)
{
- tic54x_symbol *cc = (tic54x_symbol *) hash_find (cc_hash, operand->buf);
+ tic54x_symbol *cc = (tic54x_symbol *) str_hash_find (cc_hash, operand->buf);
if (!cc)
{
as_bad (_("Unrecognized condition code \"%s\""), operand->buf);
static int
encode_cc3 (tic54x_insn *insn, struct opstruct *operand)
{
- tic54x_symbol *cc3 = (tic54x_symbol *) hash_find (cc3_hash, operand->buf);
+ tic54x_symbol *cc3 = (tic54x_symbol *) str_hash_find (cc3_hash, operand->buf);
int value = cc3 ? cc3->value : operand->exp.X_add_number << 8;
if ((value & 0x0300) != value)
static int
encode_cc2 (tic54x_insn *insn, struct opstruct *operand)
{
- tic54x_symbol *cc2 = (tic54x_symbol *) hash_find (cc2_hash, operand->buf);
+ tic54x_symbol *cc2 = (tic54x_symbol *) str_hash_find (cc2_hash, operand->buf);
if (!cc2)
{
case OP_SBIT:
{
tic54x_symbol *sbit = (tic54x_symbol *)
- hash_find (sbit_hash, operand->buf);
+ str_hash_find (sbit_hash, operand->buf);
int value = is_absolute (operand) ?
operand->exp.X_add_number : (sbit ? sbit->value : -1);
int reg = 0;
}
/* Guess the register based on the status bit; "ovb" is the last
status bit defined for st0. */
- if (sbit > (tic54x_symbol *) hash_find (sbit_hash, "ovb"))
+ if (sbit > (tic54x_symbol *) str_hash_find (sbit_hash, "ovb"))
reg = 1;
}
if (value == -1)
static int
tic54x_parse_insn (tic54x_insn *insn, char *line)
{
- insn->tm = (insn_template *) hash_find (op_hash, insn->mnemonic);
+ insn->tm = (insn_template *) str_hash_find (op_hash, insn->mnemonic);
if (!insn->tm)
{
as_bad (_("Unrecognized instruction \"%s\""), insn->mnemonic);
/* SUCCESS! now try some optimizations. */
if (optimize_insn (insn))
{
- insn->tm = (insn_template *) hash_find (op_hash,
+ insn->tm = (insn_template *) str_hash_find (op_hash,
insn->mnemonic);
continue;
}
static int
tic54x_parse_parallel_insn_firstline (tic54x_insn *insn, char *line)
{
- insn->tm = (insn_template *) hash_find (parop_hash, insn->mnemonic);
+ insn->tm = (insn_template *) str_hash_find (parop_hash, insn->mnemonic);
if (!insn->tm)
{
as_bad (_("Unrecognized parallel instruction \"%s\""),
int i;
for (i = macro_level; i > 0; i--)
- {
- if (hash_find (subsym_hash[i], name))
- {
- hash_replace (subsym_hash[i], name, value);
- return;
- }
- }
- if (hash_find (subsym_hash[0], name))
- hash_replace (subsym_hash[0], name, value);
- else
- hash_insert (subsym_hash[0], name, value);
+ str_hash_insert (subsym_hash[i], name, value);
+ str_hash_insert (subsym_hash[0], name, value);
}
/* Look up the substitution string replacement for the given symbol.
static char *
subsym_lookup (char *name, int nest_level)
{
- char *value = hash_find (subsym_hash[nest_level], name);
+ char *value = str_hash_find (subsym_hash[nest_level], name);
if (value || nest_level == 0)
return value;
}
/* Avoid infinite recursion; if a symbol shows up a second time for
substitution, leave it as is. */
- if (hash_find (subsym_recurse_hash, name) == NULL)
+ if (str_hash_find (subsym_recurse_hash, name) == NULL)
value = subsym_lookup (name, macro_level);
else
as_warn (_("%s symbol recursion stopped at "
{
/* Use an existing identifier for that label if, available, or
create a new, unique identifier. */
- value = hash_find (local_label_hash[macro_level], name);
+ value = str_hash_find (local_label_hash[macro_level], name);
if (value == NULL)
{
char digit[11];
value[strlen (value) - 1] = '\0';
sprintf (digit, ".%d", local_label_id++);
strcat (value, digit);
- hash_insert (local_label_hash[macro_level], namecopy, value);
+ str_hash_insert (local_label_hash[macro_level], namecopy, value);
}
/* Indicate where to continue looking for substitutions. */
ptr = tail;
else if (value != NULL && *name == '$')
{
subsym_proc_entry *entry = (subsym_proc_entry *) value;
- math_proc_entry *math_entry = hash_find (math_hash, name);
+ math_proc_entry *math_entry = str_hash_find (math_hash, name);
char *arg1, *arg2 = NULL;
*ptr = c;
try to replace a symbol once. */
if (recurse)
{
- hash_insert (subsym_recurse_hash, name, name);
+ str_hash_insert (subsym_recurse_hash, name, name);
value = subsym_substitute (value, macro_level > 0);
- hash_delete (subsym_recurse_hash, name, FALSE);
+ str_hash_delete (subsym_recurse_hash, name);
}
/* Temporarily zero-terminate where the symbol started. */
tic54x_symbol *sym;
/* Not sure how to handle predefined symbols. */
- if ((sym = (tic54x_symbol *) hash_find (cc_hash, name)) != NULL ||
- (sym = (tic54x_symbol *) hash_find (cc2_hash, name)) != NULL ||
- (sym = (tic54x_symbol *) hash_find (cc3_hash, name)) != NULL ||
- (sym = (tic54x_symbol *) hash_find (misc_symbol_hash, name)) != NULL ||
- (sym = (tic54x_symbol *) hash_find (sbit_hash, name)) != NULL)
+ if ((sym = (tic54x_symbol *) str_hash_find (cc_hash, name)) != NULL ||
+ (sym = (tic54x_symbol *) str_hash_find (cc2_hash, name)) != NULL ||
+ (sym = (tic54x_symbol *) str_hash_find (cc3_hash, name)) != NULL ||
+ (sym = (tic54x_symbol *) str_hash_find (misc_symbol_hash, name)) != NULL ||
+ (sym = (tic54x_symbol *) str_hash_find (sbit_hash, name)) != NULL)
{
return symbol_new (name, reg_section,
(valueT) sym->value,
&zero_address_frag);
}
- if ((sym = (tic54x_symbol *) hash_find (reg_hash, name)) != NULL ||
- (sym = (tic54x_symbol *) hash_find (mmreg_hash, name)) != NULL ||
+ if ((sym = (tic54x_symbol *) str_hash_find (reg_hash, name)) != NULL ||
+ (sym = (tic54x_symbol *) str_hash_find (mmreg_hash, name)) != NULL ||
!strcasecmp (name, "a") || !strcasecmp (name, "b"))
{
return symbol_new (name, reg_section,
/* Hash table of opcodes. For each opcode name, this stores a pointer
to a tic6x_opcode_list listing (in an arbitrary order) all opcode
table entries with that name. */
-static struct hash_control *opcode_hash;
+static htab_t opcode_hash;
/* Initialize the assembler (called once at assembler startup). */
bfd_set_arch_mach (stdoutput, TARGET_ARCH, 0);
/* Insert opcodes into the hash table. */
- opcode_hash = hash_new ();
+ opcode_hash = str_htab_create ();
for (id = 0; id < tic6x_opcode_max; id++)
{
- const char *errmsg;
tic6x_opcode_list *opc = XNEW (tic6x_opcode_list);
opc->id = id;
- opc->next = hash_find (opcode_hash, tic6x_opcode_table[id].name);
- if ((errmsg = hash_jam (opcode_hash, tic6x_opcode_table[id].name, opc))
- != NULL)
- as_fatal ("%s", _(errmsg));
+ opc->next = str_hash_find (opcode_hash, tic6x_opcode_table[id].name);
+ str_hash_insert (opcode_hash, tic6x_opcode_table[id].name, opc);
}
/* Save the current subseg so we can restore it [it's the default one and
this_insn_label_list = seginfo->tc_segment_info_data.label_list;
seginfo->tc_segment_info_data.label_list = NULL;
- opc_list = hash_find_n (opcode_hash, str, p - str);
+ opc_list = str_hash_find_n (opcode_hash, str, p - str);
if (opc_list == NULL)
{
char c = *p;
#define O_hw1_last_plt O_md27
#define O_hw2_last_plt O_md28
-static struct hash_control *special_operator_hash;
+static htab_t special_operator_hash;
/* Hash tables for instruction mnemonic lookup. */
-static struct hash_control *op_hash;
+static htab_t op_hash;
/* Hash table for spr lookup. */
-static struct hash_control *spr_hash;
+static htab_t spr_hash;
/* True temporarily while parsing an SPR expression. This changes the
* namespace to include SPR names. */
for that register (e.g. r63 instead of zero), so we should generate
a warning. The attempted register number can be found by clearing
NONCANONICAL_REG_NAME_FLAG. */
-static struct hash_control *main_reg_hash;
+static htab_t main_reg_hash;
/* We cannot unambiguously store a 0 in a hash table and look it up,
tilegx_cie_data_alignment = (tilegx_arch_size == 64 ? -8 : -4);
/* Initialize special operator hash table. */
- special_operator_hash = hash_new ();
+ special_operator_hash = str_htab_create ();
#define INSERT_SPECIAL_OP(name) \
- hash_insert (special_operator_hash, #name, (void *)O_##name)
+ str_hash_insert (special_operator_hash, #name, (void *)O_##name)
INSERT_SPECIAL_OP (hw0);
INSERT_SPECIAL_OP (hw1);
INSERT_SPECIAL_OP (hw1_last);
INSERT_SPECIAL_OP (hw2_last);
/* hw3_last is a convenience alias for the equivalent hw3. */
- hash_insert (special_operator_hash, "hw3_last", (void*)O_hw3);
+ str_hash_insert (special_operator_hash, "hw3_last", (void*)O_hw3);
INSERT_SPECIAL_OP (hw0_got);
INSERT_SPECIAL_OP (hw0_last_got);
INSERT_SPECIAL_OP (hw1_last_got);
#undef INSERT_SPECIAL_OP
/* Initialize op_hash hash table. */
- op_hash = hash_new ();
+ op_hash = str_htab_create ();
for (op = &tilegx_opcodes[0]; op->name != NULL; op++)
- {
- const char *hash_err = hash_insert (op_hash, op->name, (void *)op);
- if (hash_err != NULL)
- as_fatal (_("Internal Error: Can't hash %s: %s"), op->name, hash_err);
- }
+ str_hash_insert (op_hash, op->name, (void *)op);
/* Initialize the spr hash table. */
parsing_spr = 0;
- spr_hash = hash_new ();
+ spr_hash = str_htab_create ();
for (i = 0; i < tilegx_num_sprs; i++)
- hash_insert (spr_hash, tilegx_sprs[i].name,
+ str_hash_insert (spr_hash, tilegx_sprs[i].name,
(void *) &tilegx_sprs[i]);
/* Set up the main_reg_hash table. We use this instead of
creating a symbol in the register section to avoid ambiguities
with labels that have the same names as registers. */
- main_reg_hash = hash_new ();
+ main_reg_hash = str_htab_create ();
for (i = 0; i < TILEGX_NUM_REGISTERS; i++)
{
char buf[64];
- hash_insert (main_reg_hash, tilegx_register_names[i],
+ str_hash_insert (main_reg_hash, tilegx_register_names[i],
(void *) (long) (i | CANONICAL_REG_NAME_FLAG));
/* See if we should insert a noncanonical alias, like r63. */
sprintf (buf, "r%d", i);
if (strcmp (buf, tilegx_register_names[i]) != 0)
- hash_insert (main_reg_hash, xstrdup (buf),
+ str_hash_insert (main_reg_hash, xstrdup (buf),
(void *) (long) (i | NONCANONICAL_REG_NAME_FLAG));
}
}
if (parsing_spr)
{
- void* val = hash_find (spr_hash, name);
+ void* val = str_hash_find (spr_hash, name);
if (val == NULL)
return 0;
else
{
/* Look up the operator in our table. */
- void* val = hash_find (special_operator_hash, name);
+ void* val = str_hash_find (special_operator_hash, name);
if (val == 0)
return 0;
op = (operatorT)(long)val;
terminating_char = get_symbol_name (®name);
- pval = hash_find (main_reg_hash, regname);
+ pval = str_hash_find (main_reg_hash, regname);
if (pval == NULL)
as_bad (_("Expected register, got '%s'."), regname);
old_char = str[opname_len];
str[opname_len] = '\0';
- op = hash_find(op_hash, str);
+ op = str_hash_find(op_hash, str);
str[opname_len] = old_char;
if (op == NULL)
{
#define O_tls_gd_add O_md22
#define O_tls_ie_load O_md23
-static struct hash_control *special_operator_hash;
+static htab_t special_operator_hash;
/* Hash tables for instruction mnemonic lookup. */
-static struct hash_control *op_hash;
+static htab_t op_hash;
/* Hash table for spr lookup. */
-static struct hash_control *spr_hash;
+static htab_t spr_hash;
/* True temporarily while parsing an SPR expression. This changes the
* namespace to include SPR names. */
for that register (e.g. r63 instead of zero), so we should generate
a warning. The attempted register number can be found by clearing
NONCANONICAL_REG_NAME_FLAG. */
-static struct hash_control *main_reg_hash;
+static htab_t main_reg_hash;
/* We cannot unambiguously store a 0 in a hash table and look it up,
inside_bundle = 0;
/* Initialize special operator hash table. */
- special_operator_hash = hash_new ();
+ special_operator_hash = str_htab_create ();
#define INSERT_SPECIAL_OP(name) \
- hash_insert (special_operator_hash, #name, (void *)O_##name)
+ str_hash_insert (special_operator_hash, #name, (void *)O_##name)
INSERT_SPECIAL_OP(lo16);
INSERT_SPECIAL_OP(hi16);
#undef INSERT_SPECIAL_OP
/* Initialize op_hash hash table. */
- op_hash = hash_new ();
+ op_hash = str_htab_create ();
for (op = &tilepro_opcodes[0]; op->name != NULL; op++)
- {
- const char *hash_err = hash_insert (op_hash, op->name, (void *)op);
- if (hash_err != NULL)
- {
- as_fatal (_("Internal Error: Can't hash %s: %s"),
- op->name, hash_err);
- }
- }
+ str_hash_insert (op_hash, op->name, (void *)op);
/* Initialize the spr hash table. */
parsing_spr = 0;
- spr_hash = hash_new ();
+ spr_hash = str_htab_create ();
for (i = 0; i < tilepro_num_sprs; i++)
- hash_insert (spr_hash, tilepro_sprs[i].name,
+ str_hash_insert (spr_hash, tilepro_sprs[i].name,
(void *) &tilepro_sprs[i]);
/* Set up the main_reg_hash table. We use this instead of
* creating a symbol in the register section to avoid ambiguities
* with labels that have the same names as registers. */
- main_reg_hash = hash_new ();
+ main_reg_hash = str_htab_create ();
for (i = 0; i < TILEPRO_NUM_REGISTERS; i++)
{
char buf[64];
- hash_insert (main_reg_hash, tilepro_register_names[i],
+ str_hash_insert (main_reg_hash, tilepro_register_names[i],
(void *) (long)(i | CANONICAL_REG_NAME_FLAG));
/* See if we should insert a noncanonical alias, like r63. */
sprintf (buf, "r%d", i);
if (strcmp (buf, tilepro_register_names[i]) != 0)
- hash_insert (main_reg_hash, xstrdup (buf),
+ str_hash_insert (main_reg_hash, xstrdup (buf),
(void *) (long)(i | NONCANONICAL_REG_NAME_FLAG));
}
/* Insert obsolete backwards-compatibility register names. */
- hash_insert (main_reg_hash, "io0",
+ str_hash_insert (main_reg_hash, "io0",
(void *) (long) (TREG_IDN0 | CANONICAL_REG_NAME_FLAG));
- hash_insert (main_reg_hash, "io1",
+ str_hash_insert (main_reg_hash, "io1",
(void *) (long) (TREG_IDN1 | CANONICAL_REG_NAME_FLAG));
- hash_insert (main_reg_hash, "us0",
+ str_hash_insert (main_reg_hash, "us0",
(void *) (long) (TREG_UDN0 | CANONICAL_REG_NAME_FLAG));
- hash_insert (main_reg_hash, "us1",
+ str_hash_insert (main_reg_hash, "us1",
(void *) (long) (TREG_UDN1 | CANONICAL_REG_NAME_FLAG));
- hash_insert (main_reg_hash, "us2",
+ str_hash_insert (main_reg_hash, "us2",
(void *) (long) (TREG_UDN2 | CANONICAL_REG_NAME_FLAG));
- hash_insert (main_reg_hash, "us3",
+ str_hash_insert (main_reg_hash, "us3",
(void *) (long) (TREG_UDN3 | CANONICAL_REG_NAME_FLAG));
}
if (parsing_spr)
{
- void *val = hash_find (spr_hash, name);
+ void *val = str_hash_find (spr_hash, name);
if (val == NULL)
return 0;
else
{
/* Look up the operator in our table. */
- void *val = hash_find (special_operator_hash, name);
+ void *val = str_hash_find (special_operator_hash, name);
if (val == 0)
return 0;
op = (operatorT)(long)val;
char *regname;
char terminating_char = get_symbol_name (®name);
- void* pval = hash_find (main_reg_hash, regname);
+ void* pval = str_hash_find (main_reg_hash, regname);
if (pval == NULL)
as_bad (_("Expected register, got '%s'."), regname);
old_char = str[opname_len];
str[opname_len] = '\0';
- op = hash_find(op_hash, str);
+ op = str_hash_find(op_hash, str);
str[opname_len] = old_char;
if (op == NULL)
{
};
/* Opcode hash table. */
-static struct hash_control *v850_hash;
+static htab_t v850_hash;
/* This table is sorted. Suitable for searching by a binary search. */
static const struct reg_name pre_defined_registers[] =
if (soft_float == -1)
soft_float = machine < bfd_mach_v850e2v3;
- v850_hash = hash_new ();
+ v850_hash = str_htab_create ();
/* Insert unique names into hash table. The V850 instruction set
has many identical opcode names that have different opcodes based
if (strcmp (prev_name, op->name))
{
prev_name = (char *) op->name;
- hash_insert (v850_hash, op->name, (char *) op);
+ if (str_hash_find (v850_hash, op->name) == NULL)
+ str_hash_insert (v850_hash, op->name, (char *) op);
}
op++;
}
*s++ = '\0';
/* Find the first opcode with the proper name. */
- opcode = (struct v850_opcode *) hash_find (v850_hash, str);
+ opcode = (struct v850_opcode *) str_hash_find (v850_hash, str);
if (opcode == NULL)
{
/* xgettext:c-format */
source file, and changed the makefile. */
/* Handle of the OPCODE hash table. */
-static struct hash_control *op_hash;
+static htab_t op_hash;
/* In: 1 character, from "bdfghloqpw" being the data-type of an operand
of a vax instruction.
instruction table.
You must nominate metacharacters for eg DEC's "#", "@", "^". */
-static const char *
+static void
vip_begin (int synthetic_too, /* 1 means include jXXX op-codes. */
const char *immediate,
const char *indirect,
const char *displen)
{
const struct vot *vP; /* scan votstrs */
- const char *retval = 0; /* error text */
- op_hash = hash_new ();
+ op_hash = str_htab_create ();
- for (vP = votstrs; *vP->vot_name && !retval; vP++)
- retval = hash_insert (op_hash, vP->vot_name, (void *) &vP->vot_detail);
+ for (vP = votstrs; *vP->vot_name; vP++)
+ str_hash_insert (op_hash, vP->vot_name, (void *) &vP->vot_detail);
if (synthetic_too)
- for (vP = synthetic_votstrs; *vP->vot_name && !retval; vP++)
- retval = hash_insert (op_hash, vP->vot_name, (void *) &vP->vot_detail);
+ for (vP = synthetic_votstrs; *vP->vot_name; vP++)
+ str_hash_insert (op_hash, vP->vot_name, (void *) &vP->vot_detail);
#ifndef CONST_TABLE
vip_op_defaults (immediate, indirect, displen);
#endif
-
- return retval;
}
/* Take 3 char.s, the last of which may be `\0` (non-existent)
/* Here with instring pointing to what better be an op-name, and p
pointing to character just past that.
We trust instring points to an op-name, with no whitespace. */
- vwP = (struct vot_wot *) hash_find (op_hash, instring);
+ vwP = (struct vot_wot *) str_hash_find (op_hash, instring);
/* Restore char after op-code. */
*p = c;
if (vwP == 0)
printf ("enter displen symbols eg enter ^ ");
gets (my_displen);
- if (p = vip_begin (mysynth, my_immediate, my_indirect, my_displen))
- error ("vip_begin=%s", p);
+ vip_begin (mysynth, my_immediate, my_indirect, my_displen)
printf ("An empty input line will quit you from the vax instruction parser\n");
for (;;)
void
md_begin (void)
{
- const char *errtxt;
FLONUM_TYPE *fP;
int i;
- if ((errtxt = vip_begin (1, "$", "*", "`")) != 0)
- as_fatal (_("VIP_BEGIN error:%s"), errtxt);
+ vip_begin (1, "$", "*", "`");
for (i = 0, fP = float_operand;
fP < float_operand + VIT_MAX_OPERANDS;
/* Opcode hash table. */
-static struct hash_control *wasm32_hash;
+static htab_t wasm32_hash;
struct option md_longopts[] =
{
{
struct wasm32_opcode_s *opcode;
- wasm32_hash = hash_new ();
+ wasm32_hash = str_htab_create ();
/* Insert unique names into hash table. This hash table then
provides a quick index to the first opcode with a particular name
in the opcode table. */
for (opcode = wasm32_opcodes; opcode->name; opcode++)
- hash_insert (wasm32_hash, opcode->name, (char *) opcode);
+ str_hash_insert (wasm32_hash, opcode->name, (char *) opcode);
linkrelax = 0;
flag_sectname_subst = 1;
if (!op[0])
as_bad (_("can't find opcode "));
- opcode = (struct wasm32_opcode_s *) hash_find (wasm32_hash, op);
+ opcode = (struct wasm32_opcode_s *) str_hash_find (wasm32_hash, op);
if (opcode == NULL)
{
static unsigned int xgate_parse_operand (struct xgate_opcode *, int *, int,
char **, s_operand);
-static struct hash_control *xgate_hash;
+static htab_t xgate_hash;
/* Previous opcode. */
static unsigned int prev = 0;
op_handles = XNEWVEC (struct xgate_opcode_handle, number_of_op_handles);
/* Insert unique opcode names into hash table, aliasing duplicates. */
- xgate_hash = hash_new ();
+ xgate_hash = str_htab_create ();
prev_op_name = "";
for (xgate_opcode_ptr = xgate_op_table, i = 0, j = 0; i < xgate_num_opcodes;
j++;
op_handles[j].name = xgate_opcode_ptr->name;
op_handles[j].opc0[0] = xgate_opcode_ptr;
- hash_insert (xgate_hash, (char *) op_handles[j].name,
+ str_hash_insert (xgate_hash, (char *) op_handles[j].name,
(char *) &(op_handles[j]));
}
op_handles[j].number_of_modes = handle_enum;
if (!op_name[0])
as_bad (_("opcode missing or not found on input line"));
- if (!(opcode_handle = (struct xgate_opcode_handle *) hash_find (xgate_hash,
+ if (!(opcode_handle = (struct xgate_opcode_handle *) str_hash_find (xgate_hash,
op_name)))
{
as_bad (_("opcode %s not found in opcode hash table"), op_name);
p = extract_word (p, op_name, 10);
if (!(opcode_handle = (struct xgate_opcode_handle *)
- hash_find (xgate_hash, op_name)))
+ str_hash_find (xgate_hash, op_name)))
{
as_bad (_(": processing macro, real opcode handle"
" not found in hash"));
const char FLT_CHARS[] = "rRsSfFdDxXpP";
/* Opcode mnemonics. */
-static struct hash_control *opcode_hash_control;
+static htab_t opcode_hash_control;
void
md_begin (void)
const opcode_entry_type *opcode;
unsigned int idx = -1u;
- opcode_hash_control = hash_new ();
+ opcode_hash_control = str_htab_create ();
for (opcode = z8k_table; opcode->name; opcode++)
{
/* Only enter unique codes into the table. */
if (idx != opcode->idx)
- hash_insert (opcode_hash_control, opcode->name, (char *) opcode);
+ str_hash_insert (opcode_hash_control, opcode->name, (char *) opcode);
idx = opcode->idx;
}
fake_opcode->name = md_pseudo_table[idx].poc_name;
fake_opcode->func = (void *) (md_pseudo_table + idx);
fake_opcode->opcode = 250;
- hash_insert (opcode_hash_control, fake_opcode->name, fake_opcode);
+ str_hash_insert (opcode_hash_control, fake_opcode->name, fake_opcode);
}
}
}
c = *op_end;
- *op_end = 0; /* Zero-terminate op code string for hash_find() call. */
+ *op_end = 0; /* Zero-terminate op code string for str_hash_find() call. */
- opcode = (opcode_entry_type *) hash_find (opcode_hash_control, op_start);
+ opcode = (opcode_entry_type *) str_hash_find (opcode_hash_control, op_start);
if (opcode == NULL)
{