aboutsummaryrefslogtreecommitdiff
path: root/gas/config/tc-tic54x.c
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2020-08-18 10:57:21 +0200
committerAlan Modra <amodra@gmail.com>2020-08-20 10:56:07 +0930
commit629310abec8811510177101f3c7992dfd4be24dd (patch)
treed8de5773b66f877c3f8a7ddb9a4bd27d1a4705fa /gas/config/tc-tic54x.c
parent494b2fc8078502f84a2ff2a3402a5989b221526d (diff)
downloadgdb-629310abec8811510177101f3c7992dfd4be24dd.zip
gdb-629310abec8811510177101f3c7992dfd4be24dd.tar.gz
gdb-629310abec8811510177101f3c7992dfd4be24dd.tar.bz2
Port gas/config/* to str_htab.
* 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.
Diffstat (limited to 'gas/config/tc-tic54x.c')
-rw-r--r--gas/config/tc-tic54x.c201
1 files changed, 94 insertions, 107 deletions
diff --git a/gas/config/tc-tic54x.c b/gas/config/tc-tic54x.c
index 736192a..93586b3 100644
--- a/gas/config/tc-tic54x.c
+++ b/gas/config/tc-tic54x.c
@@ -181,12 +181,12 @@ static symbolS *last_label_seen = NULL;
/* 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
@@ -197,18 +197,18 @@ static struct hash_control *subsym_hash[MAX_SUBSYM_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. */
@@ -569,7 +569,7 @@ stag_add_field_symbols (struct stag *stag,
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.
@@ -740,7 +740,7 @@ tic54x_endstruct (int is_union)
/* 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);
@@ -770,7 +770,7 @@ tic54x_tag (int ignore ATTRIBUTE_UNUSED)
{
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)
{
@@ -1117,11 +1117,14 @@ tic54x_global (int type)
/* 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. */
@@ -1129,7 +1132,7 @@ tic54x_remove_local_label (const char *key, void *value ATTRIBUTE_UNUSED)
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
@@ -2235,7 +2238,7 @@ tic54x_var (int ignore ATTRIBUTE_UNUSED)
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 == ',')
{
@@ -2503,8 +2506,8 @@ tic54x_macro_start (void)
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
@@ -2520,7 +2523,7 @@ tic54x_macro_info (const macro_entry *macro)
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);
}
}
@@ -2529,9 +2532,9 @@ tic54x_macro_info (const macro_entry *macro)
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;
}
@@ -2685,9 +2688,9 @@ subsym_isname (char *a, char *ignore ATTRIBUTE_UNUSED)
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;
}
@@ -2697,7 +2700,7 @@ subsym_isreg (char *a, char *ignore ATTRIBUTE_UNUSED)
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;
@@ -2965,7 +2968,6 @@ md_begin (void)
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");
@@ -2989,27 +2991,21 @@ md_begin (void)
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. */
@@ -3017,54 +3013,54 @@ md_begin (void)
(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
@@ -3257,7 +3253,7 @@ is_mmreg (struct opstruct *operand)
{
return (is_absolute (operand)
|| is_immediate (operand)
- || hash_find (mmreg_hash, operand->buf) != 0);
+ || str_hash_find (mmreg_hash, operand->buf) != 0);
}
static int
@@ -3301,13 +3297,13 @@ is_type (struct opstruct *operand, enum optype type)
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))
@@ -3649,7 +3645,7 @@ encode_integer (tic54x_insn *insn,
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);
@@ -3709,7 +3705,7 @@ encode_condition (tic54x_insn *insn, struct opstruct *operand)
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)
@@ -3738,7 +3734,7 @@ encode_arx (tic54x_insn *insn, struct opstruct *operand)
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)
{
@@ -3898,7 +3894,7 @@ encode_operand (tic54x_insn *insn, enum optype type, struct opstruct *operand)
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;
@@ -3912,7 +3908,7 @@ encode_operand (tic54x_insn *insn, enum optype type, struct opstruct *operand)
}
/* 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)
@@ -4152,7 +4148,7 @@ optimize_insn (tic54x_insn *insn)
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);
@@ -4175,7 +4171,7 @@ tic54x_parse_insn (tic54x_insn *insn, char *line)
/* 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;
}
@@ -4210,7 +4206,7 @@ next_line_shows_parallel (char *next_line)
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\""),
@@ -4341,17 +4337,8 @@ subsym_create_or_replace (char *name, char *value)
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.
@@ -4361,7 +4348,7 @@ subsym_create_or_replace (char *name, char *value)
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;
@@ -4482,7 +4469,7 @@ subsym_substitute (char *line, int forced)
}
/* 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 "
@@ -4498,7 +4485,7 @@ subsym_substitute (char *line, int forced)
{
/* 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];
@@ -4510,7 +4497,7 @@ subsym_substitute (char *line, int forced)
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;
@@ -4519,7 +4506,7 @@ subsym_substitute (char *line, int forced)
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;
@@ -4631,9 +4618,9 @@ subsym_substitute (char *line, int forced)
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. */
@@ -5022,19 +5009,19 @@ tic54x_undefined_symbol (char *name)
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,