static htab_t allocate_dis_line_table (void) { return htab_create_alloc (41, hash_dis_line_entry, eq_dis_line_entry, xfree, xcalloc, xfree); }
htab_t gdbscm_create_eqable_gsmob_ptr_map (htab_hash hash_fn, htab_eq eq_fn) { htab_t htab = htab_create_alloc (7, hash_fn, eq_fn, NULL, xcalloc, xfree); return htab; }
void solaris_elf_asm_comdat_section (const char *name, unsigned int flags, tree decl) { const char *signature; char *section; comdat_entry entry, **slot; if (TREE_CODE (decl) == IDENTIFIER_NODE) signature = IDENTIFIER_POINTER (decl); else signature = IDENTIFIER_POINTER (DECL_COMDAT_GROUP (decl)); /* Sun as requires group sections to be fragmented, i.e. to have names of the form <section>%<fragment>. Strictly speaking this is only necessary to support cc -xF, but is enforced globally in violation of the ELF gABI. We keep the section names generated by GCC (generally of the form .text.<signature>) and append %<signature> to pacify as, despite the redundancy. */ section = concat (name, "%", signature, NULL); /* Clear SECTION_LINKONCE flag so targetm.asm_out.named_section only emits this as a regular section. Emit section before .group directive since Sun as treats undeclared sections as @progbits, which conflicts with .bss* sections which are @nobits. */ targetm.asm_out.named_section (section, flags & ~SECTION_LINKONCE, decl); /* Sun as separates declaration of a group section and of the group itself, using the .group directive and the #comdat flag. */ fprintf (asm_out_file, "\t.group\t%s," SECTION_NAME_FORMAT ",#comdat\n", signature, section); /* Unlike GNU as, group signature symbols need to be defined explicitly for Sun as. With a few exceptions, this is already the case. To identify the missing ones without changing the affected frontents, remember the signature symbols and emit those not marked TREE_SYMBOL_REFERENCED in solaris_file_end. */ if (solaris_comdat_htab == NULL) solaris_comdat_htab = htab_create_alloc (37, comdat_hash, comdat_eq, NULL, xcalloc, free); entry.sig = signature; slot = (comdat_entry **) htab_find_slot (solaris_comdat_htab, &entry, INSERT); if (*slot == NULL) { *slot = XCNEW (comdat_entry); /* Remember fragmented section name. */ (*slot)->name = section; /* Emit as regular section, .group declaration has already been done. */ (*slot)->flags = flags & ~SECTION_LINKONCE; (*slot)->decl = decl; (*slot)->sig = signature; } }
void _initialize_record_btrace (void) { add_cmd ("btrace", class_obscure, cmd_record_btrace_start, _("Start branch trace recording."), &record_cmdlist); add_alias_cmd ("b", "btrace", class_obscure, 1, &record_cmdlist); init_record_btrace_ops (); add_target (&record_btrace_ops); bfcache = htab_create_alloc (50, bfcache_hash, bfcache_eq, NULL, xcalloc, xfree); }
static void process_i386_opcodes (FILE *table) { FILE *fp; char buf[2048]; unsigned int i, j; char *str, *p, *last, *name; struct opcode_hash_entry **hash_slot, **entry, *next; htab_t opcode_hash_table; struct opcode_hash_entry **opcode_array; unsigned int opcode_array_size = 1024; int lineno = 0; filename = "i386-opc.tbl"; fp = fopen (filename, "r"); if (fp == NULL) fail (_("can't find i386-opc.tbl for reading, errno = %s\n"), xstrerror (errno)); i = 0; opcode_array = (struct opcode_hash_entry **) xmalloc (sizeof (*opcode_array) * opcode_array_size); opcode_hash_table = htab_create_alloc (16, opcode_hash_hash, opcode_hash_eq, NULL, xcalloc, free); fprintf (table, "\n/* i386 opcode table. */\n\n"); fprintf (table, "const insn_template i386_optab[] =\n{\n"); /* Put everything on opcode array. */ while (!feof (fp)) { if (fgets (buf, sizeof (buf), fp) == NULL) break; lineno++; p = remove_leading_whitespaces (buf); /* Skip comments. */ str = strstr (p, "//"); if (str != NULL) str[0] = '\0'; /* Remove trailing white spaces. */ remove_trailing_whitespaces (p); switch (p[0]) { case '#': /* Ignore comments. */ case '\0': continue; break; default: break; } last = p + strlen (p); /* Find name. */ name = next_field (p, ',', &str, last); /* Get the slot in hash table. */ hash_slot = (struct opcode_hash_entry **) htab_find_slot_with_hash (opcode_hash_table, name, htab_hash_string (name), INSERT); if (*hash_slot == NULL) { /* It is the new one. Put it on opcode array. */ if (i >= opcode_array_size) { /* Grow the opcode array when needed. */ opcode_array_size += 1024; opcode_array = (struct opcode_hash_entry **) xrealloc (opcode_array, sizeof (*opcode_array) * opcode_array_size); } opcode_array[i] = (struct opcode_hash_entry *) xmalloc (sizeof (struct opcode_hash_entry)); opcode_array[i]->next = NULL; opcode_array[i]->name = xstrdup (name); opcode_array[i]->opcode = xstrdup (str); opcode_array[i]->lineno = lineno; *hash_slot = opcode_array[i]; i++; } else { /* Append it to the existing one. */ entry = hash_slot; while ((*entry) != NULL) entry = &(*entry)->next; *entry = (struct opcode_hash_entry *) xmalloc (sizeof (struct opcode_hash_entry)); (*entry)->next = NULL; (*entry)->name = (*hash_slot)->name; (*entry)->opcode = xstrdup (str); (*entry)->lineno = lineno; } } /* Process opcode array. */ for (j = 0; j < i; j++) { for (next = opcode_array[j]; next; next = next->next) { name = next->name; str = next->opcode; lineno = next->lineno; last = str + strlen (str); output_i386_opcode (table, name, str, last, lineno); } } fclose (fp); fprintf (table, " { NULL, 0, 0, 0, 0,\n"); process_i386_cpu_flag (table, "0", 0, ",", " ", -1); process_i386_opcode_modifier (table, "0", -1); fprintf (table, " { "); process_i386_operand_type (table, "0", 0, "\t ", -1); fprintf (table, " } }\n"); fprintf (table, "};\n"); }
void _initialize_tailcall_frame (void) { cache_htab = htab_create_alloc (50, cache_hash, cache_eq, NULL, xcalloc, xfree); }