diff options
author | Martin Liska <mliska@suse.cz> | 2020-08-18 10:57:21 +0200 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2020-08-20 10:56:07 +0930 |
commit | 629310abec8811510177101f3c7992dfd4be24dd (patch) | |
tree | d8de5773b66f877c3f8a7ddb9a4bd27d1a4705fa /gas/config/tc-ia64.c | |
parent | 494b2fc8078502f84a2ff2a3402a5989b221526d (diff) | |
download | fsf-binutils-gdb-629310abec8811510177101f3c7992dfd4be24dd.zip fsf-binutils-gdb-629310abec8811510177101f3c7992dfd4be24dd.tar.gz fsf-binutils-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-ia64.c')
-rw-r--r-- | gas/config/tc-ia64.c | 149 |
1 files changed, 60 insertions, 89 deletions
diff --git a/gas/config/tc-ia64.c b/gas/config/tc-ia64.c index a9126ab..1686579 100644 --- a/gas/config/tc-ia64.c +++ b/gas/config/tc-ia64.c @@ -185,10 +185,10 @@ static void ia64_float_to_chars_littleendian (char *, LITTLENUM_TYPE *, int); 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. */ @@ -228,11 +228,11 @@ size_t md_longopts_size = sizeof (md_longopts); 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 @@ -4602,7 +4602,7 @@ dot_rot (int type) /* 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; } @@ -4683,12 +4683,7 @@ dot_rot (int type) 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; @@ -5166,7 +5161,6 @@ dot_pred_rel (int type) static void dot_entry (int dummy ATTRIBUTE_UNUSED) { - const char *err; char *name; int c; symbolS *symbolP; @@ -5176,10 +5170,7 @@ dot_entry (int dummy ATTRIBUTE_UNUSED) 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 (); @@ -5378,15 +5369,11 @@ pseudo_opcode[] = 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; } @@ -7241,8 +7228,6 @@ void 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; @@ -7253,10 +7238,10 @@ md_begin (void) 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, @@ -7405,20 +7390,15 @@ md_begin (void) 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); @@ -7471,13 +7451,8 @@ md_begin (void) 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. */ @@ -7980,7 +7955,7 @@ ia64_parse_name (char *name, expressionS *e, char *nextcharP) } /* 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; @@ -7988,7 +7963,7 @@ ia64_parse_name (char *name, expressionS *e, char *nextcharP) return 1; } - cdesc = hash_find (md.const_hash, name); + cdesc = str_hash_find (md.const_hash, name); if (cdesc) { e->X_op = O_constant; @@ -8054,7 +8029,7 @@ ia64_parse_name (char *name, expressionS *e, char *nextcharP) 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 @@ -10675,7 +10650,7 @@ md_assemble (char *str) 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); @@ -11750,10 +11725,9 @@ dot_alias (int section) 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); @@ -11810,21 +11784,26 @@ dot_alias (int section) } /* 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; } @@ -11832,32 +11811,19 @@ dot_alias (int section) 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) @@ -11866,43 +11832,48 @@ do_alias (const char *alias, void *value) /* 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 |